Version 1.22.0

Merge d7cd0ae781bdc8af94cb94f177e6d6ee47f21344 into stable
diff --git a/.gitattributes b/.gitattributes
index 0f5ea98..30c6123 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -29,9 +29,9 @@
 tests/lib/mirrors/method_mirror_source_line_ending_lf.dart -text
 tests/lib/mirrors/method_mirror_source_test.dart -text
 tests/lib/mirrors/method_mirror_source_other.dart -text
-pkg/dev_compiler/test/codegen/language/multiline_newline_crlf.dart -text
-pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_cr.dart -text
-pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_crlf.dart -text
+tests/language_strong/multiline_newline_crlf.dart -text
+tests/lib_strong/mirrors/method_mirror_source_line_ending_cr.dart -text
+tests/lib_strong/mirrors/method_mirror_source_line_ending_crlf.dart -text
 
 # Files to leave alone and not diff.
 *.png binary
diff --git a/.gitignore b/.gitignore
index a0b469f..8cdeac8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@
 *.vcxproj
 *.vcxproj.filters
 /*.vcxproj.user
+*.stamp
 
 # Gyp generated files
 *.xcodeproj
diff --git a/.packages b/.packages
index 1a6226d..8900db8 100644
--- a/.packages
+++ b/.packages
@@ -89,6 +89,7 @@
 stream_channel:third_party/pkg/stream_channel/lib
 string_scanner:third_party/pkg/string_scanner/lib
 test:third_party/pkg/test/lib
+testing:third_party/testing/lib
 test_reflective_loader:third_party/pkg/test_reflective_loader/lib
 typed_data:third_party/pkg/typed_data/lib
 typed_mock:pkg/typed_mock/lib
diff --git a/.travis.yml b/.travis.yml
index f458e35..7e4d785 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -43,13 +43,16 @@
   - git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
   - export PATH=`pwd`/depot_tools:"$PATH"
 
-  # Checkout everything if we're building the SDK
+  # Checkout everything to pull in sdk and third_party dart packages
   - cd ..
   - 'gclient config --spec=''solutions = [ { "name": "sdk", "url": "git@github.com:dart-lang/sdk.git", "deps_file": "DEPS", "managed": False } ]'''
-  - gclient sync
+  - gclient sync -n
+  - download_from_google_storage --no_auth --no_resume --bucket dart-dependencies --extract -s sdk/third_party/pkg/unittest.tar.gz.sha1
   - cd sdk
 
-  # If a C++ compiler is set, build the SDK - else use the preinstalled SDK instead.
+  # If a C++ compiler is set, run hooks and build the SDK - else use the preinstalled SDK instead.
+  - export DART_USE_GYP=1
+  - if [ "$CXX" ]; then gclient runhooks ; fi
   - if [ "$CXX" ]; then ./tools/build.py -m release create_sdk ; fi
   - if [ "$CXX" ]; then export PATH=`pwd`/out/ReleaseX64/dart-sdk/bin:"$PATH" ; fi
   - dart --version
@@ -75,14 +78,13 @@
   - ANALYZER=master
   - ANALYZER=master DDC_BROWSERS=Firefox
   - ANALYZER=master DDC_BROWSERS=ChromeCanaryTravis
-  - ANALYZER=master CXX=g++
   - ANALYZER=master CXX=clang++
   - TEST=coverage
   - TEST=package
 matrix:
   allow_failures:
-    - env: ANALYZER=master CXX=g++
     - env: ANALYZER=master DDC_BROWSERS=ChromeCanaryTravis
+    - env: ANALYZER=master CXX=clang++
 notifications:
   email:
     recipients:
diff --git a/BUILD.gn b/BUILD.gn
index a027a2e..033a324 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -4,12 +4,20 @@
 
 # This target will be built if no target is specified when invoking ninja.
 group("default") {
+  if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
+    # Fuchsia has run_vm_tests marked testonly.
+    testonly = true
+  }
   deps = [
     ":runtime",
   ]
 }
 
 group("most") {
+  if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
+    # Fuchsia has run_vm_tests marked testonly.
+    testonly = true
+  }
   deps = [
     ":analysis_server",
     ":create_sdk",
@@ -22,6 +30,10 @@
 }
 
 group("runtime") {
+  if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
+    # Fuchsia has run_vm_tests marked testonly.
+    testonly = true
+  }
   deps = [
     "runtime/bin:dart",
     "runtime/bin:dart_bootstrap($host_toolchain)",
@@ -37,19 +49,7 @@
   deps = [
     "runtime/bin:dart_bootstrap($host_toolchain)",
     "runtime/bin:dart_precompiled_runtime",
-    "runtime/vm:patched_sdk",
-  ]
-}
-
-group("runtime_and_noopt") {
-  deps = [
-    "runtime/bin:dart",
-    "runtime/bin:dart_bootstrap($host_toolchain)",
-    "runtime/bin:dart_noopt",
     "runtime/bin:process_test",
-    "runtime/bin:run_vm_tests",
-    "runtime/bin:sample_extension",
-    "runtime/bin:test_extension",
     "runtime/vm:patched_sdk",
   ]
 }
@@ -70,12 +70,16 @@
   ]
 
   sdk_lib_files = exec_script("tools/list_dart_files.py",
-                              [ rebase_path("sdk/lib") ],
+                              [
+                                "absolute",
+                                rebase_path("sdk/lib"),
+                              ],
                               "list lines")
 
   preamble_files =
       exec_script("tools/list_files.py",
                   [
+                    "absolute",
                     "",
                     rebase_path("sdk/lib/_internal/js_runtime/lib/preambles"),
                   ],
@@ -83,15 +87,13 @@
 
   sdk_bin_files = exec_script("tools/list_files.py",
                               [
+                                "absolute",
                                 "",
                                 rebase_path("sdk/bin"),
                               ],
                               "list lines")
 
-  inputs = rebase_path(sdk_lib_files, "", "sdk/lib") +
-           rebase_path(preamble_files, "", "sdk/lib") +
-           rebase_path(sdk_bin_files, "", "sdk/bin") +
-           [
+  inputs = sdk_lib_files + preamble_files + sdk_bin_files + [
              "sdk/lib/dart_client.platform",
              "sdk/lib/dart_server.platform",
              "sdk/lib/dart_shared.platform",
@@ -119,6 +121,11 @@
     "--snapshot_location",
     rebase_path("$root_gen_dir"),
   ]
+  if (defined(is_fuchsia) && is_fuchsia_host) {
+    args += [
+      "--copy_libs"
+    ]
+  }
 }
 
 group("dart2js") {
@@ -165,3 +172,77 @@
     "runtime/bin:sample_extension",
   ]
 }
+
+
+# The rules below build a qemu Fuchsia OS image that includes the Dart tree
+# under /system/test/dart. Building this image is gated by the GN argument
+# 'dart_build_fuchsia_test_image' because building the image is slow.
+if (defined(is_fuchsia) && (is_fuchsia)) {
+  declare_args() {
+    dart_build_fuchsia_test_image = false
+  }
+
+  if (dart_build_fuchsia_test_image) {
+    action("generate_dart_test_manifest") {
+      testonly = true
+
+      deps = [
+        "//packages/gn:mkbootfs",
+      ]
+
+      output_prefix = "$target_gen_dir/dart_test_tree"
+      outputs = [
+        "$output_prefix.manifest",
+      ]
+
+      mode = "release"
+      if (is_debug) {
+        mode = "debug"
+      }
+
+      mkbootfs_gen = get_label_info("//packages/gn:mkbootfs", "target_gen_dir")
+      user_manifest = "$mkbootfs_gen/user.bootfs.manifest"
+
+      script = "tools/gen_fuchsia_test_manifest.py"
+      args = [
+        "-m",
+        mode,
+        "-u",
+        rebase_path(user_manifest),
+        "-o",
+        rebase_path(output_prefix),
+      ]
+    }
+
+    action("generate_dart_test_image") {
+      testonly = true
+      deps = [
+        "runtime/bin:dart",
+        "runtime/bin:run_vm_tests",
+        "runtime/bin:process_test",
+        ":generate_dart_test_manifest",
+      ]
+
+      input = "$target_gen_dir/dart_test_tree.manifest"
+      inputs = [
+        input,
+      ]
+
+      output = "$root_out_dir/dart_test_tree.bin"
+      outputs = [
+        output,
+      ]
+
+      script = "//packages/gn/make_bootfs.py"
+      args = [
+        "--manifest",
+        rebase_path(input),
+        "--output-file",
+        rebase_path(output),
+        "--build-id-map",
+        rebase_path("$target_gen_dir/build_id_map"),
+        "--compress",
+      ]
+    }
+  }
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8f8b775..a831e65 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,261 @@
+## 1.22.0 - 2017-02-14
+
+### Language
+
+  * Breaking change: ['Generalized tear-offs'](https://github.com/gbracha/generalizedTearOffs/blob/master/proposal.md)
+    are no longer supported, and will cause errors. We updated the language spec
+    and added warnings in 1.21, and are now taking the last step to fully
+    de-support them. They were previously only supported in the VM, and there
+    are almost no known uses of them in the wild.
+
+  * The `assert()` statement has been expanded to support an optional second
+    `message` argument (SDK issue [27342](https://github.com/dart-lang/sdk/issues/27342)).
+
+    The message is displayed if the assert fails. It can be any object, and it
+    is accessible as `AssertionError.message`. It can be used to provide more
+    user friendly exception outputs. As an example, the following assert:
+
+    ```dart
+    assert(configFile != null, "Tool config missing. Please see https://goo.gl/k8iAi for details.");
+    ```
+
+    would produce the following exception output:
+
+    ```
+    Unhandled exception:
+    'file:///Users/mit/tmp/tool/bin/main.dart': Failed assertion: line 9 pos 10:
+    'configFile != null': Tool config missing. Please see https://goo.gl/k8iAi for details.
+    #0      _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:33)
+    #1      _AssertionError._throwNew (dart:core-patch/errors_patch.dart:29)
+    #2      main (file:///Users/mit/tmp/tool/bin/main.dart:9:10)
+    ```
+
+  * The `Null` type has been moved to the bottom of the type hierarchy. As such,
+    it is considered a subtype of every other type. The `null` *literal* was
+    always treated as a bottom type. Now the named class `Null` is too:
+
+    ```dart
+    const empty = <Null>[];
+
+    String concatenate(List<String> parts) => parts.join();
+    int sum(List<int> numbers) => numbers.fold(0, (sum, n) => sum + n);
+
+    concatenate(empty); // OK.
+    sum(empty); // OK.
+    ```
+
+  * Introduce `covariant` modifier on parameters. It indicates that the
+    parameter (and the corresponding parameter in any method that overrides it)
+    has looser override rules. In strong mode, these require a runtime type
+    check to maintain soundness, but enable an architectural pattern that is
+    useful in some code.
+
+    It lets you specialize a family of classes together, like so:
+
+    ```dart
+    abstract class Predator {
+      void chaseAndEat(covariant Prey p);
+    }
+
+    abstract class Prey {}
+
+    class Mouse extends Prey {}
+
+    class Seal extends Prey {}
+
+    class Cat extends Predator {
+      void chaseAndEat(Mouse m) => ...
+    }
+
+    class Orca extends Predator {
+      void chaseAndEat(Seal s) => ...
+    }
+    ```
+
+    This isn't statically safe, because you could do:
+
+    ```dart
+    Predator predator = new Cat(); // Upcast.
+    predator(new Seal()); // Cats can't eat seals!
+    ```
+
+    To preserve soundness in strong mode, in the body of a method that uses a
+    covariant override (here, `Cat.chaseAndEat()`), the compiler automatically
+    inserts a check that the parameter is of the expected type. So the compiler
+    gives you something like:
+
+    ```dart
+    class Cat extends Predator {
+      void chaseAndEat(o) {
+        var m = o as Mouse;
+        ...
+      }
+    }
+    ```
+
+    Spec mode allows this unsound behavior on all parameters, even though users
+    rarely rely on it. Strong mode disallowed it initially. Now, strong mode
+    lets you opt into this behavior in the places where you do want it by using
+    this modifier. Outside of strong mode, the modifier is ignored.
+
+  * Change instantiate-to-bounds rules for generic type parameters when running
+    in strong mode. If you leave off the type parameters from a generic type, we
+    need to decide what to fill them in with.  Dart 1.0 says just use `dynamic`,
+    but that isn't sound:
+
+    ```dart
+    class Abser<T extends num> {
+       void absThis(T n) { n.abs(); }
+    }
+
+    var a = new Abser(); // Abser<dynamic>.
+    a.absThis("not a num");
+    ```
+
+    We want the body of `absThis()` to be able to safely assume `n` is at
+    least a `num` -- that's why there's a constraint on T, after all. Implicitly
+    using `dynamic` as the type parameter in this example breaks that.
+
+    Instead, strong mode uses the bound. In the above example, it fills it in
+    with `num`, and then the second line where a string is passed becomes a
+    static error.
+
+    However, there are some cases where it is hard to figure out what that
+    default bound should be:
+
+    ```dart
+    class RuhRoh<T extends Comparable<T>> {}
+    ```
+
+    Strong mode's initial behavior sometimes produced surprising, unintended
+    results. For 1.22, we take a simpler approach and then report an error if
+    a good default type argument can't be found.
+
+### Core libraries
+
+  * Define `FutureOr<T>` for code that works with either a future or an
+    immediate value of some type. For example, say you do a lot of text
+    manipulation, and you want a handy function to chain a bunch of them:
+
+    ```dart
+    typedef String StringSwizzler(String input);
+
+    String swizzle(String input, List<StringSwizzler> swizzlers) {
+      var result = input;
+      for (var swizzler in swizzlers) {
+        result = swizzler(result);
+      }
+
+      return result;
+    }
+    ```
+
+    This works fine:
+
+    ```dart
+    main() {
+      var result = swizzle("input", [
+        (s) => s.toUpperCase(),
+        (s) => () => s * 2)
+      ]);
+      print(result); // "INPUTINPUT".
+    }
+    ```
+
+    Later, you realize you'd also like to support swizzlers that are
+    asynchronous (maybe they look up synonyms for words online). You could make
+    your API strictly asynchronous, but then users of simple synchronous
+    swizzlers have to manually wrap the return value in a `Future.value()`.
+    Ideally, your `swizzle()` function would be "polymorphic over asynchrony".
+    It would allow both synchronous and asynchronous swizzlers. Because `await`
+    accepts immediate values, it is easy to implement this dynamically:
+
+    ```dart
+    Future<String> swizzle(String input, List<StringSwizzler> swizzlers) async {
+      var result = input;
+      for (var swizzler in swizzlers) {
+        result = await swizzler(result);
+      }
+
+      return result;
+    }
+
+    main() async {
+      var result = swizzle("input", [
+        (s) => s.toUpperCase(),
+        (s) => new Future.delayed(new Duration(milliseconds: 40), () => s * 2)
+      ]);
+      print(await result);
+    }
+    ```
+
+    What should the declared return type on StringSwizzler be? In the past, you
+    had to use `dynamic` or `Object`, but that doesn't tell the user much. Now,
+    you can do:
+
+    ```dart
+    typedef FutureOr<String> StringSwizzler(String input);
+    ```
+
+    Like the name implies, `FutureOr<String>` is a union type. It can be a
+    `String` or a `Future<String>`, but not anything else. In this case, that's
+    not super useful beyond just stating a more precise type for readers of the
+    code. It does give you a little better error checking in code that uses the
+    result of that.
+
+    `FutureOr<T>` becomes really important in *generic* methods like
+    `Future.then()`. In those cases, having the type system understand this
+    magical union type helps type inference figure out the type argument of
+    `then()` based on the closure you pass it.
+
+    Previously, strong mode had hard-coded rules for handling `Future.then()`
+    specifically. `FutureOr<T>` exposes that functionality so third-party APIs
+    can take advantage of it too.
+
+### Tool changes
+
+* Dart2Js
+
+  * Remove support for (long-time deprecated) mixin typedefs.
+
+* Pub
+
+  * Avoid using a barback asset server for executables unless they actually use
+    transformers. This makes precompilation substantially faster, produces
+    better error messages when precompilation fails, and allows
+    globally-activated executables to consistently use the
+    `Isolate.resolvePackageUri()` API.
+
+  * On Linux systems, always ignore packages' original file owners and
+    permissions when extracting those packages. This was already the default
+    under most circumstances.
+
+  * Properly close the standard input stream of child processes started using
+    `pub run`.
+
+  * Handle parse errors from the package cache more gracefully. A package whose
+    pubspec can't be parsed will now be ignored by `pub get --offline` and
+    deleted by `pub cache repair`.
+
+  * Make `pub run` run executables in spawned isolates. This lets them handle
+    signals and use standard IO reliably.
+
+  * Fix source-maps produced by dart2js when running in `pub serve`: URL
+    references to assets from packages match the location where `pub serve`
+    serves them (`packages/package_name/` instead of
+    `../packages/package_name/`).
+
+### Infrastructure changes
+
+  * The SDK now uses GN rather than gyp to generate its build files, which will
+    now be exclusively ninja flavored. Documentation can be found on our
+    [wiki](https://github.com/dart-lang/sdk/wiki/Building-with-GN). Also see the
+    help message of `tools/gn.py`. This change is in response to the deprecation
+    of gyp. Build file generation with gyp will continue to be available in this
+    release by setting the environment variable `DART_USE_GYP` before running
+    `gclient sync` or `gclient runhooks`, but this will be removed in a future
+    release.
+
 ## 1.21.1 - 2017-01-13
 
 Patch release, resolves one issue:
@@ -17,30 +275,48 @@
   [informal specification](https://gist.github.com/eernstg/cff159be9e34d5ea295d8c24b1a3e594)
   for details.
 * Don't warn about switch case fallthrough if the case ends in a `rethrow`
-  statement.
+  statement.  (SDK issue
+  [27650](https://github.com/dart-lang/sdk/issues/27650))
 * Also don't warn if the entire switch case is wrapped in braces - as long as
   the block ends with a `break`, `continue`, `rethrow`, `return` or `throw`.
 * Allow `=` as well as `:` as separator for named parameter default values.
 
+  ```dart
+  enableFlags({bool hidden: false}) { … }
+  ```
+
+  can now be replaced by
+
+  ```dart
+  enableFlags({bool hidden = false}) { … }
+  ```
+
+  (SDK issue [27559](https://github.com/dart-lang/sdk/issues/27559))
+
 ### Core library changes
 
-* `dart:core`: `Set.difference` now takes a `Set<Object>` as argument.
+* `dart:core`: `Set.difference` now takes a `Set<Object>` as argument.  (SDK
+  issue [27573](https://github.com/dart-lang/sdk/issues/27573))
 
-* `dart:developer`:
-  * The service protocol http server can now be controlled from Dart code.
+* `dart:developer`
+
+  * Added `Service` class.
+    * Allows inspecting and controlling the VM service protocol HTTP server.
+    * Provides an API to access the ID of an `Isolate`.
 
 ### Tool changes
 
 * Dart Dev Compiler
 
   * Support calls to `loadLibrary()` on deferred libraries. Deferred libraries
-    are still loaded eagerly. (#27343)
+    are still loaded eagerly. (SDK issue
+    [27343](https://github.com/dart-lang/sdk/issues/27343))
 
 ## 1.20.1 - 2016-10-13
 
 Patch release, resolves one issue:
 
-* Dartium: Fixes a bug that caused crashes.  No issue filed
+* Dartium: Fixes a bug that caused crashes.  No issue filed.
 
 ### Strong Mode
 
@@ -80,7 +356,8 @@
   directory containing root certificate files hashed using `c_rehash`.
 
 * The VM now throws a catchable `Error` when method compilation fails. This
-  allows easier debugging of syntax errors, especially when testing.
+  allows easier debugging of syntax errors, especially when testing.  (SDK issue
+  [23684](https://github.com/dart-lang/sdk/issues/23684))
 
 ### Core library changes
 
@@ -88,14 +365,17 @@
   Use the class in `package:resource` instead.
 * `dart:async`
   * `Future.wait` now catches synchronous errors and returns them in the
-    returned Future.
+    returned Future.  (SDK issue
+    [27249](https://github.com/dart-lang/sdk/issues/27249))
   * More aggressively returns a `Future` on `Stream.cancel` operations.
-    Discourages to return `null` from `cancel`.
+    Discourages to return `null` from `cancel`.  (SDK issue
+    [26777](https://github.com/dart-lang/sdk/issues/26777))
   * Fixes a few bugs where the cancel future wasn't passed through
     transformations.
 * `dart:io`
   * Added `WebSocket.addUtf8Text` to allow sending a pre-encoded text message
-    without a round-trip UTF-8 conversion.
+    without a round-trip UTF-8 conversion.  (SDK issue
+    [27129](https://github.com/dart-lang/sdk/issues/27129))
 
 ### Strong Mode
 
@@ -180,13 +460,16 @@
     generates a `.packages` file, called a package spec. To generate
     a `packages/` directory in addition to the package spec, use the
     `--packages-dir` flag with `pub get`, `pub upgrade`, and `pub downgrade`.
+    See the [Good-bye
+    symlinks](http://news.dartlang.org/2016/10/good-bye-symlinks.html) article
+    for details.
 
 ## 1.19.1 - 2016-09-08
 
 Patch release, resolves one issue:
 
-* Dartdoc:  Fixes a bug that prevented generation of docs
-(Dartdoc issue [1233](https://github.com/dart-lang/dartdoc/issues/1233))
+* Dartdoc:  Fixes a bug that prevented generation of docs.
+  (Dartdoc issue [1233](https://github.com/dart-lang/dartdoc/issues/1233))
 
 ## 1.19.0 - 2016-08-26
 
diff --git a/DEPS b/DEPS
index 4f5d541..156d98c 100644
--- a/DEPS
+++ b/DEPS
@@ -27,8 +27,10 @@
   # Only use this temporarily while waiting for a mirror for a new package.
   "github_dartlang": "https://github.com/dart-lang/%s.git",
 
+  "github_testing": "https://github.com/peter-ahe-google/testing.git",
+
   "gyp_rev": "@6ee91ad8659871916f9aa840d42e1513befdf638",
-  "co19_rev": "@f05d5aee5930bfd487aedf832fbd7b832f502b15",
+  "co19_rev": "@cf831f58ac65f68f14824c0b1515f6b7814d94b8",
 
   # Revisions of GN related dependencies.
   "buildtools_revision": "@39b1db2ab4aa4b2ccaa263c29bdf63e7c1ee28aa",
@@ -43,10 +45,10 @@
   "barback-0.14.0_rev": "@36398",
   "barback-0.14.1_rev": "@38525",
   "barback_tag" : "@0.15.2+9",
-  "bazel_worker_tag": "@0.1.1",
+  "bazel_worker_tag": "@0.1.2",
   "boolean_selector_tag" : "@1.0.2",
-  "boringssl_gen_rev": "@62c20247d582444cb2804f9ea4e3abaa6e47f6a5",
-  "boringssl_rev" : "@8d343b44bbab829d1a28fdef650ca95f7db4412e",
+  "boringssl_gen_rev": "@1a810313a0290e1caace9da73fa3ab89995ad2c7",
+  "boringssl_rev" : "@d519bf6be0b447fb80fbc539d4bff4479b5482a2",
   "charcode_tag": "@1.1.0",
   "chrome_rev" : "@19997",
   "cli_util_tag" : "@0.0.1+3",
@@ -57,8 +59,8 @@
   "csslib_tag" : "@0.13.2",
   "dart2js_info_tag" : "@0.5.0",
   "dart_services_rev" : "@7aea2574e6f3924bf409a80afb8ad52aa2be4f97",
-  "dart_style_tag": "@0.2.13",
-  "dartdoc_tag" : "@v0.9.8",
+  "dart_style_tag": "@0.2.16",
+  "dartdoc_tag" : "@v0.9.8+1",
   "fixnum_tag": "@0.10.5",
   "func_tag": "@0.1.0",
   "glob_tag": "@1.1.3",
@@ -73,7 +75,7 @@
   "isolate_tag": "@0.2.3",
   "jinja2_rev": "@2222b31554f03e62600cd7e383376a7c187967a1",
   "json_rpc_2_tag": "@2.0.2",
-  "linter_tag": "@0.1.29",
+  "linter_rev": "@89f93362c5b48ef5192d77e9a28cf9590542669b",
   "logging_tag": "@0.11.3+1",
   "markdown_tag": "@0.11.0",
   "matcher_tag": "@0.12.0+2",
@@ -84,17 +86,17 @@
   "observatory_pub_packages_rev": "@26aad88f1c1915d39bbcbff3cad589e2402fdcf1",
   "observe_tag": "@0.13.5",
   "package_config_tag": "@1.0.0",
-  "package_resolver_tag": "@1.0.2",
-  "path_tag": "@1.3.9",
+  "package_resolver_tag": "@1.0.2+1",
+  "path_tag": "@1.4.1",
   "plugin_tag": "@0.2.0",
   "ply_rev": "@604b32590ffad5cbb82e4afef1d305512d06ae93",
   "pool_tag": "@1.2.4",
   "protobuf_tag": "@0.5.3",
-  "pub_rev": "@3dd04bd17ba269ccdd34502a253041dd96ded3be",
+  "pub_rev": "@53327f4a7ca2ddd20a40f6a94db61ac136371b03",
   "pub_semver_tag": "@1.3.0",
   "quiver_tag": "@0.22.0",
   "resource_rev":"@a49101ba2deb29c728acba6fb86000a8f730f4b1",
-  "root_certificates_rev": "@aed07942ce98507d2be28cbd29e879525410c7fc",
+  "root_certificates_rev": "@0068d8911140e591ebb750af296e81940a9906f5",
   "scheduled_test_tag": "@0.12.6",
   "shelf_static_tag": "@0.2.4",
   "shelf_packages_handler_tag": "@1.0.0",
@@ -109,6 +111,7 @@
   "stream_channel_tag": "@1.5.0",
   "string_scanner_tag": "@1.0.0",
   "sunflower_rev": "@879b704933413414679396b129f5dfa96f7a0b1e",
+  "testing_rev": "@2e196d51c147411a93a949109656be93626bda49",
   "test_reflective_loader_tag": "@0.1.0",
   "test_tag": "@0.12.15+6",
   "typed_data_tag": "@1.1.3",
@@ -235,7 +238,7 @@
   Var("dart_root") + "/third_party/pkg/json_rpc_2":
       (Var("github_mirror") % "json_rpc_2") + Var("json_rpc_2_tag"),
   Var("dart_root") + "/third_party/pkg/linter":
-      (Var("github_mirror") % "linter") + Var("linter_tag"),
+      (Var("github_mirror") % "linter") + Var("linter_rev"),
   Var("dart_root") + "/third_party/pkg/logging":
       (Var("github_mirror") % "logging") + Var("logging_tag"),
   Var("dart_root") + "/third_party/pkg/markdown":
@@ -315,6 +318,8 @@
       Var("sunflower_rev"),
   Var("dart_root") + "/third_party/pkg/test":
       (Var("github_mirror") % "test") + Var("test_tag"),
+  Var("dart_root") + "/third_party/testing":
+      Var("github_testing") + Var("testing_rev"),
   Var("dart_root") + "/third_party/pkg/test_reflective_loader":
       (Var("github_mirror") % "test_reflective_loader") +
       Var("test_reflective_loader_tag"),
diff --git a/README.md b/README.md
index e2a2f1e..2cea132 100644
--- a/README.md
+++ b/README.md
@@ -14,8 +14,9 @@
 
 ## Building Dart
 
-Learn how to [get the source](https://github.com/dart-lang/sdk/wiki/Building#getting-the-source)
-and [prepare your machine to build the SDK](https://github.com/dart-lang/sdk/wiki/Preparing-your-machine-to-build-the-Dart-SDK).
+If you want to build Dart yourself, here is a guide to
+[getting the source, preparing your machine to build the SDK, and
+building](https://github.com/dart-lang/sdk/wiki/Building).
 
 There are more documents on our [wiki](https://github.com/dart-lang/sdk/wiki).
 
@@ -25,9 +26,9 @@
 
 You can also contribute patches, as described in [Contributing][contrib].
 
-## License
+## License & patents
 
-See [LICENSE][license].
+See [LICENSE][license] and [PATENTS][patents].
 
 [website]: https://www.dartlang.org
 [license]: https://github.com/dart-lang/sdk/blob/master/LICENSE
@@ -38,3 +39,4 @@
 [dartbug]: http://dartbug.com
 [contrib]: https://github.com/dart-lang/sdk/wiki/Contributing
 [pubsite]: https://pub.dartlang.org
+[patents]: https://github.com/dart-lang/sdk/blob/master/PATENTS
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 52043c8..82761c3 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -2,6 +2,17 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+declare_args() {
+  # The optimization level to use for debug builds.
+  if (is_android) {
+    # On Android we kind of optimize some things that don't affect debugging
+    # much even when optimization is disabled to get the binary size down.
+    debug_optimization_level = "s"
+  } else {
+    debug_optimization_level = "2"
+  }
+}
+
 import("//build/config/android/config.gni")
 if (current_cpu == "arm") {
   import("//build/config/arm.gni")
@@ -226,6 +237,10 @@
         ]
       }
     } else if (current_cpu == "mipsel") {
+      # Some toolchains default to big-endian.
+      cflags += [ "-EL" ]
+      ldflags += [ "-EL" ]
+
       # We have to explicitly request exceptions to get good heap profiles from
       # tcmalloc.
       if (is_debug || is_release) {
@@ -292,16 +307,24 @@
   # Linux/Android common flags setup.
   # ---------------------------------
   if (is_linux || is_android) {
-    cflags += [ "-fPIC" ]
-
     ldflags += [
-      "-fPIC",
       "-Wl,-z,noexecstack",
       "-Wl,-z,now",
       "-Wl,-z,relro",
     ]
   }
 
+  # We need -fPIC:
+  # 1. On ARM and MIPS for tcmalloc.
+  # 2. On Android.
+  # 3. When using the sanitizers.
+  # Otherwise there is a performance hit, in particular on ia32.
+  if (is_android || is_asan || is_lsan || is_msan || is_tsan ||
+      (is_linux && (current_cpu == "arm" || current_cpu == "mipsel"))) {
+    cflags += [ "-fPIC" ]
+    ldflags += [ "-fPIC" ]
+  }
+
   # Linux-specific compiler flags setup.
   # ------------------------------------
   if (is_linux) {
@@ -731,21 +754,21 @@
     # The only difference on windows is that the inlining is less aggressive.
     # (We accept the default level). Otherwise it is very slow.
     cflags = [
-      "/O2",  # Do some optimizations.
+      "/O${debug_optimization_level}",  # Do some optimizations.
       "/Oy-",  # Disable omitting frame pointers, must be after /O2.
     ]
   } else if (is_android) {
     # On Android we kind of optimize some things that don't affect debugging
     # much even when optimization is disabled to get the binary size down.
     cflags = [
-      "-Os",
+      "-O${debug_optimization_level}",
       "-fdata-sections",
       "-ffunction-sections",
     ]
     ldflags = common_optimize_on_ldflags
   } else {
     cflags = [
-      "-O1",
+      "-O${debug_optimization_level}",
       "-fdata-sections",
       "-ffunction-sections",
     ]
diff --git a/build/config/gcc/BUILD.gn b/build/config/gcc/BUILD.gn
index 47bcc0b..110f1cc 100644
--- a/build/config/gcc/BUILD.gn
+++ b/build/config/gcc/BUILD.gn
@@ -31,6 +31,7 @@
       # Want to pass "\$". GN will re-escape as required for ninja.
       "-Wl,-rpath=\$ORIGIN/",
       "-Wl,-rpath-link=",
+      "-Wl,-z,origin",
 
       # Newer binutils don't set DT_RPATH unless you disable "new" dtags
       # and the new DT_RUNPATH doesn't work without --no-as-needed flag.
diff --git a/create_sdk.gyp b/create_sdk.gyp
index b1b9361..9e41ef9 100644
--- a/create_sdk.gyp
+++ b/create_sdk.gyp
@@ -23,15 +23,15 @@
           'inputs': [
             # Xcode can only handle a certain amount of files in one list
             # (also depending on the length of the path from where you run).
-            '<!@(["python", "tools/list_files.py",'
-                '"dart$",'
+            '<!@(["python", "tools/list_files.py", "relative", "dart$",'
                 '"sdk/lib"])',
             'sdk/lib/dart_client.platform',
             'sdk/lib/dart_server.platform',
             'sdk/lib/dart_shared.platform',
-            '<!@(["python", "tools/list_files.py", "", '
+            '<!@(["python", "tools/list_files.py", "relative", "", '
                 '"sdk/lib/_internal/js_runtime/lib/preambles"])',
-            '<!@(["python", "tools/list_files.py", "", "sdk/bin"])',
+            '<!@(["python", "tools/list_files.py", "relative",  "", '
+                '"sdk/bin"])',
             'tools/create_sdk.py',
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
             '<(SHARED_INTERMEDIATE_DIR)/dart2js.dart.snapshot',
diff --git a/dart.gyp b/dart.gyp
index 5e1508d..70fd7162 100644
--- a/dart.gyp
+++ b/dart.gyp
@@ -46,23 +46,6 @@
         'runtime/dart-runtime.gyp:generate_patched_sdk#host',
       ],
     },
-    {
-      # This is the target that is built on the VM build bots.  It
-      # must depend on anything that is required by the VM test
-      # suites.
-      'target_name': 'runtime_and_noopt',
-      'type': 'none',
-      'dependencies': [
-        'runtime/dart-runtime.gyp:dart',
-        'runtime/dart-runtime.gyp:dart_noopt',
-        'runtime/dart-runtime.gyp:dart_bootstrap#host',
-        'runtime/dart-runtime.gyp:run_vm_tests',
-        'runtime/dart-runtime.gyp:process_test',
-        'runtime/dart-runtime.gyp:test_extension',
-        'runtime/dart-runtime.gyp:sample_extension',
-        'runtime/dart-runtime.gyp:generate_patched_sdk#host',
-      ],
-    },
 
     {
       'target_name': 'create_sdk',
diff --git a/docs/language/dart.sty b/docs/language/dart.sty
index d22dde6..125c771 100644
--- a/docs/language/dart.sty
+++ b/docs/language/dart.sty
@@ -3,64 +3,59 @@
 \def\comment#1{\textit{#1}}
 \def\capt#1{\rmfamily \caption{#1}}
 \newcommand{\cd}[1]{\textsf{#1}}
-\def\lt{$<$}
-\def\gt{$>$}
-\def\<{$\langle$}
-\def\>{$\rangle$}
+\def\lt{\ensuremath{<}}
+\def\gt{\ensuremath{>}}
+\def\<{\ensuremath{\langle}}
+\def\>{\ensuremath{\rangle}}
 \def\metavar#1{\ensuremath{\mathit{#1}}}
+
 \def\ABSTRACT{\builtinId{abstract}}
 \def\AS{\builtinId{as}}
+\def\DEFERRED{\builtinId{deferred}}
+\def\DYNAMIC{\builtinId{dynamic}}
+\def\EXPORT{\builtinId{export}}
+\def\EXTERNAL{\builtinId{external}}
+\def\FACTORY{\builtinId{factory}}
+\def\GET{\builtinId{get}}
+\def\IMPLEMENTS{\builtinId{implements}}
+\def\IMPORT{\builtinId{import}}
+\def\LIBRARY{\builtinId{library}}
+\def\OPERATOR{\builtinId{operator}}
+\def\PART{\builtinId{part}}
+\def\SET{\builtinId{set}}
+\def\STATIC{\builtinId{static}}
+\def\TYPEDEF{\builtinId{typedef}}
+
 \def\ASSERT{\keyword{assert}}
 \def\ASYNC{\keyword{async}}
 \def\AWAIT{\keyword{await}}
-\def\BOOLEAN{\keyword{boolean}}
 \def\BREAK{\keyword{break}}
-\def\CASE{\keyword{case}}
-\def\CLASS{\keyword{class}}
 \def\CALL{\keyword{call}}
+\def\CASE{\keyword{case}}
 \def\CATCH{\keyword{catch}}
+\def\CLASS{\keyword{class}}
 \def\CONST{\keyword{const}}
 \def\CONTINUE{\keyword{continue}}
 \def\DEFAULT{\keyword{default}}
-\def\DEFERRED{\keyword{deferred}}
-\def\DYNAMIC{\builtinId{dynamic}}
 \def\DO{\keyword{do}}
 \def\ELSE{\keyword{else}}
 \def\ENUM{\keyword{enum}}
-\def\EQUALS{\keyword{equals}}
-\def\EXPORT{\builtinId{export}}
 \def\EXTENDS{\keyword{extends}}
-\def\EXTERNAL{\builtinId{external}}
-\def\FACTORY{\builtinId{factory}}
 \def\FALSE{\keyword{false}}
 \def\FINAL{\keyword{final}}
 \def\FINALLY{\keyword{finally}}
 \def\FOR{\keyword{for}}
-\def\GET{\builtinId{get}}
 \def\HIDE{\keyword{hide}}
 \def\IF{\keyword{if}}
-\def\IMPLEMENTS{\builtinId{implements}}
-\def\IMPORT{\builtinId{import}}
 \def\IN{\keyword{in}}
-\def\INT{\keyword{int}}
-\def\INTERFACE{\keyword{interface}}
 \def\IS{\keyword{is}}
-\def\LIBRARY{\builtinId{library}}
-\def\NATIVE{\keyword{native}}
-\def\NEGATE{\keyword{negate}}
 \def\NEW{\keyword{new}}
 \def\NULL{\keyword{null}}
-\def\ON{\keyword{on}}
 \def\OF{\keyword{of}}
-\def\OPERATOR{\builtinId{operator}}
-\def\PART{\builtinId{part}}
-\def\PRIVATE{\keyword{private}}
+\def\ON{\keyword{on}}
 \def\RETHROW{\keyword{rethrow}}
 \def\RETURN{\keyword{return}}
-\def\SET{\builtinId{set}}
 \def\SHOW{\keyword{show}}
-\def\SOURCE{\keyword{source}}
-\def\STATIC{\builtinId{static}}
 \def\SUPER{\keyword{super}}
 \def\SWITCH{\keyword{switch}}
 \def\SYNC{\keyword{sync}}
@@ -68,20 +63,15 @@
 \def\THROW{\keyword{throw}}
 \def\TRUE{\keyword{true}}
 \def\TRY{\keyword{try}}
-\def\TYPEDEF{\builtinId{typedef}}
-\def\THIS{\keyword{this}}
 \def\VAR{\keyword{var}}
 \def\VOID{\keyword{void}}
 \def\WHILE{\keyword{while}}
 \def\WITH{\keyword{with}}
 \def\YIELD{\keyword{yield}}
-\def\TRUE{\keyword{true}}
 
-\newenvironment{Q}[1]{{\bf #1}}
-
-\newenvironment{rationale}[1]{{\it #1}}
-
-\newenvironment{commentary}[1]{{\sf #1}}
+\newenvironment{Q}[1]{{\bf #1}}{}
+\newenvironment{rationale}[1]{{\it #1}}{}
+\newenvironment{commentary}[1]{{\sf #1}}{}
 
 \newenvironment{dartCode}[1][!ht] {
 %  \begin{verbatim}[#1]
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex
index a01d8eb2..158a10f 100644
--- a/docs/language/dartLangSpec.tex
+++ b/docs/language/dartLangSpec.tex
@@ -8,13 +8,60 @@
 \usepackage[T1]{fontenc}
 \newcommand{\code}[1]{{\sf #1}}
 \title{Dart Programming Language  Specification  \\
-{4th edition draft}\\
+{5th edition draft}\\
 {\large Version 1.15.0}}
 
 % For information about Location Markers (and in particular the
 % commands \LMHash and \LMLabel), see the long comment at the
 % end of this file.
 
+% CHANGES
+% =======
+% Significant changes to the specification.
+%
+% 1.15
+% - Change how language specification describes control flow.
+% - Object initialization now specifies initialization order correctly.
+% - Specifies that leaving an await-for loop must wait for the subscription
+%   to be canceled.
+% - An await-for loop only pauses the subscription if it does something async.
+% - Assert statements may now also include a "message" operand.
+% - The Null type is now considered a subtype of all types in most cases.
+%
+% 1.14
+% - The call "C()" where "C" is a class name, is a now compile-time error.
+% - Changed description of rewrites that depended on a function literal.
+%   In many cases, the rewrite wasn't safe for asynchronous code.
+% - Removed generalized tear-offs.
+% - Allow "rethrow" to also end a switch case. Allow braces around switch cases.
+% - Allow using '=' as default-value separator for named parameters.
+% - Make it a compile-time error if a library includes the same part twice.
+% - Now more specific about the return types of sync*/async/async* functions
+%   in relation to return statements.
+% - Allow Unicode surrogate values in String literals.
+% - Make an initializing formal's value accessible in the initializer list.
+% - Allow any expression in assert statements (was only conditionalExpression).
+% - Allow trailing commas in argument and parameter lists.
+%
+% 1.11 - ECMA 408 - 4th Edition
+% - Specify that potentially constant expressions must be valid expressions
+%   if the parameters are non-constant.
+% - Make "??" a compile-time constant operator.
+% - Having multiple unnamed libraries no longer causes warnings.
+% - Specify null-aware operators for static methods.
+%
+% 1.10
+% - Allow mixins to have super-classes and super-calls.
+% - Specify static type checking for the implicit for-in iterator variable.
+% - Specify static types for a number of expressions where it was missing.
+% - Make calls on the exact type "Function" not cause warnings.
+% - Specify null-aware behavior of "e?.v++" and similar expressions.
+% - Specify that `package:` URIs are treated in an implementation dependent way.
+% - Require warning if for-in is used on object with no "iterator" member.
+%
+% 1.9 - ECMA-408 - 3rd Edition
+%
+
 \begin{document}
 \maketitle
 \tableofcontents
@@ -195,8 +242,10 @@
 \LMHash{}
 A scope $S_0$ induces a namespace $NS_0$ that maps the simple name of each variable, type or function declaration $d$ declared in $S_0$ to $d$. Labels are not included in the induced namespace of a scope; instead they have their own dedicated namespace.
 
-\commentary{It is therefore impossible, e.g.,  to define a class that declares a method and a field with the same name in Dart. Similarly one cannot declare a top-level function with the same name as a library variable or class.
-  }
+\commentary{
+It is therefore impossible, e.g., to define a class that declares a method and a getter with the same name in Dart.
+Similarly one cannot declare a top-level function with the same name as a library variable or a class.
+}
 
 \LMHash{}
 It is a compile-time error if there is more than one entity with the same name declared in the same scope.
@@ -1058,7 +1107,7 @@
 It is a compile-time error if a class has both a getter and a method with the same name. This restriction holds regardless of whether the getter is defined explicitly or implicitly, or whether the getter or the method are inherited or not.
 
 \commentary{
-This implies that a getter can never override a method, and a method can never override a getter or field.
+This implies that a getter can never override a method, and a method can never override a getter or an instance variable.
 }
 
 \LMHash{}
@@ -1245,7 +1294,9 @@
 A {\em constructor parameter list} is a parenthesized, comma-separated list of formal constructor parameters. A {\em formal constructor parameter} is either a formal parameter (\ref{formalParameters}) or an initializing formal. An {\em initializing formal} has the form \code{\THIS{}.$id$}, where $id$ is the name of an instance variable of the immediately enclosing class.  It is a compile-time error if $id$ is not an instance variable of the immediately enclosing class. It is a compile-time error if an initializing formal is used by a function other than a non-redirecting generative constructor.
 
 \LMHash{}
-If an explicit type is attached to the initializing formal, that is its static type. Otherwise, the type of an initializing formal named $id$ is $T_{id}$, where $T_{id}$ is the type of the field named $id$ in the immediately enclosing class. It is a static warning if the static type of $id$ is not assignable to $T_{id}$.
+If an explicit type is attached to the initializing formal, that is its static type.
+Otherwise, the type of an initializing formal named $id$ is $T_{id}$, where $T_{id}$ is the type of the instance variable named $id$ in the immediately enclosing class.
+It is a static warning if the static type of $id$ is not assignable to $T_{id}$.
 
 \LMHash{}
 Initializing formals constitute an exception to the rule that every formal parameter introduces a local variable into the formal parameter scope (\ref{formalParameters}).
@@ -1259,8 +1310,9 @@
 }
 
 \LMHash{}
-Initializing formals are executed during the execution of generative constructors detailed below. Executing an initializing formal  \code{\THIS{}.$id$} causes the field $id$ of the immediately surrounding class to be assigned the value of the corresponding actual parameter, unless $id$ is a final variable that has already been initialized, in which case a runtime error occurs.
-
+Initializing formals are executed during the execution of generative constructors detailed below.
+Executing an initializing formal \code{\THIS{}.$id$} causes the instance variable $id$ of the immediately surrounding class to be assigned the value of the corresponding actual parameter,
+unless $id$ is a final variable that has already been initialized, in which case a runtime error occurs.
 
 \commentary{
 The above rule allows initializing formals to be used as optional parameters:
@@ -1390,8 +1442,7 @@
 \LMHash{}
 Then if any instance variable of $i$ declared by the immediately enclosing class
 is not yet bound to a value,
-it is a dynamic error if such a variable is a \FINAL{} variable,
-otherwise all such variables are initialized with the \NULL{} value.
+all such variables are initialized with the \NULL{} value.
 
 \LMHash{}
 Then, unless the enclosing class is \code{Object}, the explicitly specified or
@@ -1411,7 +1462,9 @@
 After the superinitializer has completed, the body of $k$ is executed in a scope where \THIS{} is bound to $i$.
 
 \rationale{
-This process ensures that no uninitialized final field is ever seen by code. Note that \THIS{} is not in scope on the right hand side of an initializer (see \ref{this}) so no instance method can execute during initialization: an instance method cannot be directly invoked, nor can \THIS{} be passed into any other code being invoked in the initializer.
+This process ensures that no uninitialized final instance variable is ever seen by code.
+Note that \THIS{} is not in scope on the right hand side of an initializer (see \ref{this}) so no instance method can execute during initialization:
+an instance method cannot be directly invoked, nor can \THIS{} be passed into any other code being invoked in the initializer.
 }
 
 \LMHash{}
@@ -1420,7 +1473,10 @@
 proceeds as follows:
 
 \LMHash{}
-First, the expression $e$ is evaluated to an object $o$. Then, the instance variable $v$ of $i$ is bound to $o$, unless $v$ is a final variable that has already been initialized, in which case a runtime error occurs. In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interface of the class of $o$ is not a subtype of the actual type of the field $v$.
+First, the expression $e$ is evaluated to an object $o$.
+%%STRONG_MODE: The runtime error in the next sentence will be compile-time.
+Then, the instance variable $v$ of $i$ is bound to $o$, unless $v$ is a final variable that has already been initialized, in which case a runtime error occurs.
+In checked mode, it is a dynamic type error if $o$ is not \NULL{} and the interface of the class of $o$ is not a subtype of the actual type of the instance variable $v$.
 
 \LMHash{}
 An initializer of the form \code{$v$ = $e$} is equivalent to an initializer of the form \code{\THIS{}.$v$ = $e$}.
@@ -1782,9 +1838,8 @@
 The scope of the \EXTENDS{} and \WITH{} clauses of a class $C$ is the type-parameter scope of $C$.
 
 \LMHash{}
-%It is a compile-time error if  the \EXTENDS{} clause of a class $C$ includes a type expression that does not denote a class available in the lexical scope of $C$.
-It is a compile-time error if  the \EXTENDS{} clause of a class $C$ specifies an enumerated type (\ref{enums}), a malformed  type or a deferred type (\ref{staticTypes}) as a superclass.
-% too strict? Do we e want extends List<Undeclared> to work as List<dynamic>?
+It is a compile-time error if the \EXTENDS{} clause of a class $C$ specifies a type variable (\ref{generics}), a type alias (\ref{typedef}), an enumerated type (\ref{enums}), a malformed type, or a deferred type (\ref{staticTypes}) as a superclass.
+It is a compile-time error if the \EXTENDS{} clause of a class $C$ specifies type \DYNAMIC{} as a superinterface.
 
 \commentary{ The type parameters of a generic class are available in the lexical scope of the superclass clause, potentially shadowing classes in the surrounding scope. The following code is therefore illegal and should cause a compile-time error:
 }
@@ -1830,11 +1885,13 @@
 A class may override instance members that would otherwise have been inherited from its superclass.
 
 \LMHash{}
-Let $C = S_0$ be a class declared in library $L$, and let $\{S_1 \ldots S_k\}$ be the set of all superclasses of $C$, where $S_i$ is the superclass of $S_{i-1}$ for $i \in 1 .. k$. Let $C$ declare a member $m$, and let  $m^\prime$ be a member of $S_j, j  \in 1 .. k$,  that has the same name as $m$, such that $m^\prime$ is accessible to $L$.  Then $m$ overrides $m^\prime$ if $m^\prime$ is not already overridden by a member of at least one of $S_1 \ldots S_{j-1}$ and neither $m$ nor $m^\prime$ are fields.
+Let $C = S_0$ be a class declared in library $L$, and let $\{S_1 \ldots S_k\}$ be the set of all superclasses of $C$, where $S_i$ is the superclass of $S_{i-1}$ for $i \in 1 .. k$.
+Let $C$ declare a member $m$, and let  $m^\prime$ be a member of $S_j, j  \in 1 .. k$,  that has the same name as $m$, such that $m^\prime$ is accessible to $L$.
+Then $m$ overrides $m^\prime$ if $m^\prime$ is not already overridden by a member of at least one of $S_1 \ldots S_{j-1}$ and neither $m$ nor $m^\prime$ are instance variables.
 
 %Let $C$ be a class declared in library $L$, with superclass $S$ and let $C$ declare an instance member $m$, and  assume $S$ declares an instance member $m^\prime$ with the same name as $m$. Then $m$ {\em overrides} $m^\prime$ iff $m^\prime$ is accessible (\ref{privacy}) to $L$, $m$ has the same name as  $m^\prime$  and neither $m$ nor $m^\prime$ are fields.
 
-\commentary{Fields never override each other. The getters and setters induced by fields do.}
+\commentary{Instance variables never override each other. The getters and setters induced by instance variables do.}
 
 \rationale{Again, a local definition of overriding would be preferable, but fails to account for library privacy.
 }
@@ -1861,7 +1918,9 @@
 
 \begin{enumerate}
 
-\item There is only one namespace for getters, setters, methods and constructors (\ref{scoping}). A field $f$ introduces a getter $f$ and a non-final field $f$ also introduces a setter $f=$ (\ref{instanceVariables}, \ref{staticVariables}). When we speak of members here, we mean accessible fields, getters, setters and methods (\ref{classes}).
+\item There is only one namespace for getters, setters, methods and constructors (\ref{scoping}).
+  An instance or static variable $f$ introduces a getter $f$ and a non-final instance or static variable $f$ also introduces a setter $f=$ (\ref{instanceVariables}, \ref{staticVariables}).
+  When we speak of members here, we mean accessible instance or static variables, getters, setters, and methods (\ref{classes}).
 \item You cannot have two  members with the same name in the same class - be they declared or inherited (\ref{scoping}, \ref{classes}).
 \item Static members are never inherited.
 \item It is a warning if you have an  static member named $m$ in your class or any superclass (even though it is not inherited) and an  instance member of the same name (\ref{instanceMethods}, \ref{getters}, \ref{setters}).
@@ -1918,7 +1977,9 @@
 The scope of the \IMPLEMENTS{} clause of a class $C$ is the type-parameter scope of $C$.
 
 \LMHash{}
-It is a compile-time error if  the \IMPLEMENTS{}  clause of a class $C$ specifies a type variable as a superinterface. It is a compile-time error if  the  \IMPLEMENTS{} clause of a class $C$ specifies an enumerated type (\ref{enums}),  a malformed type or deferred type (\ref{staticTypes}) as a superinterface.  It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DYNAMIC{} as a superinterface. It is a compile-time error if  the  \IMPLEMENTS{} clause of a class $C$ specifies  a type $T$ as a superinterface more than once.
+It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies a type variable (\ref{generics}), a type alias (\ref{typedef}), an enumerated type (\ref{enums}), a malformed type, or a deferred type (\ref{staticTypes}) as a superinterface.
+It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DYNAMIC{} as a superinterface.
+It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies a type $T$ as a superinterface more than once.
 It is a compile-time error if the superclass of a class $C$ is specified as a superinterface of $C$.
 
 \rationale{
@@ -2091,8 +2152,10 @@
 \LMLabel{mixinApplication}
 
 \LMHash{}
-A mixin may be applied to a superclass, yielding a new class. Mixin application occurs when a mixin is mixed into a class declaration via its \WITH{} clause.  The mixin application may be used to extend a class per section (\ref{classes}); alternately, a class may be defined as a mixin application as described in this section.   It is a compile-time error if the \WITH{} clause of a mixin application $C$ includes a deferred type expression.
-
+A mixin may be applied to a superclass, yielding a new class.
+Mixin application occurs when a mixin is mixed into a class declaration via its \WITH{} clause.
+The mixin application may be used to extend a class per section (\ref{classes}); alternately, a class may be defined as a mixin application as described in this section.
+It is a compile-time error if the \WITH{} clause of a mixin application $C$ includes a type variable (\ref{generics}), a type alias (\ref{typedef}), an enumerated type (\ref{enums}), a malformed type, or a deferred type (\ref{staticTypes}).
 
 \begin{grammar}
 {\bf  mixinApplicationClass:}
@@ -2110,7 +2173,8 @@
 A  mixin application of the form  \code{$S$ \WITH{} $M_1, \ldots, M_k$;} defines a class  $C$ whose superclass is the application of the mixin composition (\ref{mixinComposition}) $M_{k-1} * \ldots * M_1$ to $S$.
 
 \LMHash{}
-In both cases above, $C$ declares the same instance members as $M$ (respectively, $M_k$). If any of the instance fields of $M$ (respectively, $M_k$) have initializers, they are executed in the scope of $M$ (respectively, $M_k$) to initialize the corresponding fields of $C$.
+In both cases above, $C$ declares the same instance members as $M$ (respectively, $M_k$).
+If any of the instance variables of $M$ (respectively, $M_k$) have initializers, they are executed in the scope of $M$ (respectively, $M_k$) to initialize the corresponding instance variables of $C$.
 
 \LMHash{}
 Let $L_M$ be the library in which $M$ is declared.
@@ -2250,7 +2314,7 @@
 }
 
 \begin{dartCode}
-\INTERFACE{} Ordered<T> \{
+\CLASS{} Ordered<T> \{
   operator > (T x);
 \}
 
@@ -2320,12 +2384,12 @@
 
 %\begin{grammar}
 %classInterfaceInjection:
-      %class qualified typeParameters? interfaces '{\escapegrammar ;}'
+      %class qualified typeParameters? interfaces `{\escapegrammar ;}'
       %  .
 
 
 %interfaceInterfaceInjection:
-      %interface qualified typeParameters? superinterfaces '{\escapegrammar ;}'
+      %interface qualified typeParameters? superinterfaces `{\escapegrammar ;}'
     %.
 %\end{grammar}
 
@@ -2378,7 +2442,7 @@
 }
 
 \LMHash{}
-Metadata can appear before a library, part header, class, typedef, type parameter, constructor, factory, function, field, parameter, or variable declaration and before an import, export or part directive.
+Metadata can appear before a library, part header, class, typedef, type parameter, constructor, factory, function, parameter, or variable declaration and before an import, export or part directive.
 
 \LMHash{}
 The constant expression given in an annotation  is type checked and evaluated in the scope surrounding the declaration being annotated.
@@ -2460,8 +2524,8 @@
  OR
  \item $c_1$ and $c_2$ are constant lists that are defined to be identical in the specification of literal list expressions (\ref{lists}), OR
  \item $c_1$ and $c_2$ are constant maps that are defined to be identical in the specification of literal map expressions (\ref{maps}), OR
- \item $c_1$ and $c_2$ are constant objects of the same class $C$ and each member field of $c_1$ is identical to the corresponding field of $c_2$. OR
-\item $c_1$ and $c_2$ are the same object.
+ \item $c_1$ and $c_2$ are constant objects of the same class $C$ and the value of each instance variable of $c_1$ is identical to the value of the corresponding instance variable of $c_2$. OR
+ \item $c_1$ and $c_2$ are the same object.
 \end{itemize}
 
 \commentary{
@@ -2614,13 +2678,10 @@
 
 \LMHash{}
 The null object is the sole instance of the built-in class \code{Null}. Attempting to instantiate \code{Null} causes a run-time error. It is a compile-time error for a class to extend, mix in or implement \code{Null}.
-The \code{Null} class declares no methods except those also declared by \code{Object}.
+The \code{Null} class extends the \code{Object} class and declares no methods except those also declared by \code{Object}.
 
 \LMHash{}
-The static type of \NULL{} is $\bot$.
-
-\rationale{The decision to use $\bot$ instead of \code{Null} allows \NULL{} to be be assigned everywhere without complaint by the static checker.
-}
+The static type of \NULL{} is the \code{Null} type.
 
 
 \subsection{Numbers}
@@ -3536,13 +3597,19 @@
 \begin{itemize}
 \item If during execution of the program, a constant object expression has already evaluated to an instance $j$ of class $R$ with type arguments $V_i, 1 \le i \le m$, then:
 \begin{itemize}
-\item For each instance variable $f$ of $i$, let $v_{if}$ be the value of the field $f$ in $i$, and let $v_{jf}$ be the value of the field $f$ in $j$. If  \code{identical($v_{if}$, $v_{jf}$)} for all fields $f$ in $i$, then the value of $e$ is $j$, otherwise the value of $e$ is $i$.
+\item For each instance variable $f$ of $i$, let $v_{if}$ be the value of the instance variable $f$ in $i$, and let $v_{jf}$ be the value of the instance variable $f$ in $j$.
+  If \code{identical($v_{if}$, $v_{jf}$)} for all instance variables $f$ in $i$ then the value of $e$ is $j$, otherwise the value of $e$ is $i$.
 \end{itemize}
 \item Otherwise the value of $e$ is $i$.
 \end{itemize}
 
 \commentary{
-In other words, constant objects are canonicalized.  In order to determine if an object is actually new, one has to compute it; then it can be compared to any cached instances. If an equivalent object exists in the cache, we throw away the newly created object and use the cached one. Objects are equivalent if they have identical fields and identical type arguments. Since the constructor cannot induce any side effects, the execution of the constructor is unobservable.  The constructor need only be executed once per call site, at compile-time.
+In other words, constant objects are canonicalized.
+In order to determine if an object is actually new, one has to compute it; then it can be compared to any cached instances.
+If an equivalent object exists in the cache, we throw away the newly created object and use the cached one.
+Objects are equivalent if they have identical type arguments and identical instance variables.
+Since the constructor cannot induce any side effects, the execution of the constructor is unobservable.
+The constructor need only be executed once per call site, at compile-time.
 }
 
 \LMHash{}
@@ -5069,8 +5136,9 @@
 \LMHash{}
 The static type of such an expression is the static type of $v$.
 
-
-\rationale{The above ensures that if $v$ is a field, the getter gets called exactly once. Likewise in the cases below.
+\rationale{
+The above ensures that if $v$ is a variable, the getter gets called exactly once.
+Likewise in the cases below.
 }
 
 \LMHash{}
@@ -5435,13 +5503,18 @@
 Let $v$  be a local variable or a formal parameter. An is-expression of the form \code{$v$ \IS{} $T$} shows that $v$  has type $T$ iff $T$ is more specific than the type $S$ of the expression $v$ and  both $T \ne \DYNAMIC{}$ and $S \ne \DYNAMIC{}$.
 
 \rationale{
-The motivation for the ``shows that v has type T" relation is to reduce spurious warnings thereby enabling a more natural coding style. The rules in the current specification are deliberately kept simple. It would be upwardly compatible to refine these rules in the future; such a refinement would accept more code without warning, but not reject any code now warning-free.
+The motivation for the ``shows that v has type T" relation is to reduce spurious warnings thereby enabling a more natural coding style.
+The rules in the current specification are deliberately kept simple.
+It would be upwardly compatible to refine these rules in the future; such a refinement would accept more code without warning, but not reject any code now warning-free.
 
-The rule only applies to locals and parameters, as fields could be modified via side-effecting functions or methods that are not accessible to a local analysis.
+The rule only applies to locals and parameters, as instance or static variables could be modified via side-effecting functions or methods that are not accessible to a local analysis.
 
-It is pointless to deduce a weaker type than what is already known. Furthermore, this would lead to a situation where multiple types are associated with a variable at a given point, which complicates the specification. Hence the requirement that $T << S$ (we use $<<$ rather than subtyping because subtyping is not a partial order).
+It is pointless to deduce a weaker type than what is already known.
+Furthermore, this would lead to a situation where multiple types are associated with a variable at a given point, which complicates the specification.
+Hence the requirement that $T << S$ (we use $<<$ rather than subtyping because subtyping is not a partial order).
 
-We do not want to refine the type of a variable of type \DYNAMIC{}, as this could lead to more warnings rather than less.  The opposite requirement, that $T \ne \DYNAMIC{}$ is a safeguard lest $S$ ever be $\bot$.
+We do not want to refine the type of a variable of type \DYNAMIC{}, as this could lead to more warnings rather than fewer.
+The opposite requirement, that $T \ne \DYNAMIC{}$ is a safeguard lest $S$ ever be $\bot$.
 }
 
 \LMHash{}
@@ -5584,7 +5657,7 @@
 
  \begin{grammar}
 {\bf localVariableDeclaration:}
-    initializedVariableDeclaration {\escapegrammar';'}
+    initializedVariableDeclaration `{\escapegrammar ;}'
   .
  \end{grammar}
 
@@ -7332,7 +7405,7 @@
 	.
 
 {\bf functionTypeAlias:}
-       functionPrefix  typeParameters? formalParameterList '{\escapegrammar ;}'
+       functionPrefix  typeParameters? formalParameterList `{\escapegrammar ;}'
     .
 
     {\bf functionPrefix:}
@@ -7370,11 +7443,6 @@
 \item If $J$ is a mixin application (\ref{mixinApplication}) of the mixin of $I$.
 \end{itemize}
 
-\commentary{
-
-
-}
-
 %\Q{Can wacky stuff happen with interface injection, e.g., a direct superinterface becomes indirect? What about side effects - loading order can affect type relationships.
 %}
 
@@ -7382,8 +7450,9 @@
 A type $T$ is more specific than a type $S$, written $T << S$,  if one of the following conditions is met:
 \begin{itemize}
 \item $T$ is $S$.
-\item T is $\bot$.
-\item S is \DYNAMIC{}.
+\item $T$ is $\bot$.
+\item $T$ is \code{Null} and $S$ is not $\bot$.
+\item $S$ is \DYNAMIC{}.
 \item $S$ is a direct supertype of $T$.
 \item $T$ is a type parameter and $S$ is the upper bound of $T$.
 \item $T$ is a type parameter and $S$ is \cd{Object}.
@@ -7404,13 +7473,20 @@
 Although $<:$ is not a partial order on types, it does contain a partial order, namely $<<$. This means that, barring raw types, intuition about classical subtype rules does apply.
 }
 
+\commentary{
+The \code{Null} type is more specific than all non-$\bot$ types, even though
+it doesn't actually extend or implement those types.
+The other types are effectively treated as if they are {\em nullable},
+which makes \NULL{} assignable to them.
+}
+
 \LMHash{}
 $S$ is a supertype of $T$, written $S :> T$, iff $T$ is a subtype of $S$.
 
 \commentary{The supertypes of an interface are its direct supertypes and their supertypes. }
 
 \LMHash{}
-An interface type $T$ may be assigned to a type $S$, written  $T \Longleftrightarrow S$, iff either $T <: S$ or $S <: T$.
+An interface type $T$ may be assigned to a type $S$, written  $T \Longleftrightarrow S$, iff either $T <: S$, $S <: T$.
 
 \rationale{This rule may surprise readers accustomed to conventional typechecking. The intent of the $\Longleftrightarrow$ relation is not to ensure that an assignment is correct. Instead, it aims to only flag assignments that are almost certain to be erroneous, without precluding assignments that may work.
 
diff --git a/docs/language/informal/README.md b/docs/language/informal/README.md
new file mode 100644
index 0000000..5774998
--- /dev/null
+++ b/docs/language/informal/README.md
@@ -0,0 +1,17 @@
+This directory contains "informal specifications".
+
+In order to move faster and get better feedback, we implement and iterate on
+language changes before the full official specification has been written. Still,
+the implementers need *something* to go on.
+
+For that, the language team writes "informal specifications". These are
+intended to be precise enough for a good faith implementer to correctly
+understand the syntax and semantics of the language, but without all of the
+laborious detail of the complete specification.
+
+Once the feature has been implemented, tested, and we are confident in it, the
+language team will write the real text in the language specification and the
+document here becomes deprecated and no longer canonical.
+
+Until then, while the feature is in progress, a live pull request for the
+informal spec is the source of truth for the feature.
diff --git a/docs/language/informal/covariant-overrides.md b/docs/language/informal/covariant-overrides.md
new file mode 100644
index 0000000..1533324
--- /dev/null
+++ b/docs/language/informal/covariant-overrides.md
@@ -0,0 +1,894 @@
+# Covariant Overrides
+
+Owner: rnystrom@, eernstg@.
+
+## Summary
+
+Allow an overriding method to tighten a parameter type if it has the
+modifier `covariant`, using dynamic checks to ensure soundness. This
+provides a better user experience for a programming idiom that appears in
+many UI frameworks.
+
+Note that this feature is relevant in strong mode where parameter types
+cannot otherwise be tightened, but it affects standard mode Dart in the
+sense that the syntax should be accepted and ignored.
+
+## Informal specification
+
+We set out by giving the informal specification for the syntax of this
+feature (which is shared among standard mode and strong mode). Following
+that, we specify the other aspects of the feature in standard mode,
+followed by those other aspects in strong mode.
+
+### Syntax
+
+The set of built-in identifiers is extended with `covariant`. This means
+that the identifier `covariant` cannot be the name of a type. The grammar
+is updated as follows:
+
+```
+normalFormalParameter: // CHANGED
+  functionFormalParameter |
+  fieldFormalParameter |
+  simpleFormalParameter
+
+functionFormalParameter: // NEW
+  metadata 'covariant'? returnType? identifier formalParameterList
+
+simpleFormalParameter: // CHANGED
+  declaredIdentifier |
+  metadata 'covariant'? identifier
+
+declaredIdentifier: // CHANGED
+  metadata 'covariant'? finalConstVarOrType identifier
+
+declaration: // CHANGED: last alternative
+  constantConstructorSignature (redirection | initializers)? |
+  constructorSignature (redirection | initializers)? |
+  'external' constantConstructorSignature |
+  'external' constructorSignature |
+  ('external' 'static'?)? getterSignature |
+  ('external' 'static'?)? setterSignature |
+  'external'? operatorSignature |
+  ('external' 'static'?)? functionSignature |
+  'static' ('final' | 'const') type? staticFinalDeclarationList |
+  'final' type? initializedIdentifierList |
+  ('static' | 'covariant')? ('var' | type) initializedIdentifierList
+```
+
+### Standard mode
+
+The static analysis in standard mode ignores `covariant` modifiers, and so
+does the dynamic semantics.
+
+*This means that covariant overrides are essentially ignored in standard
+mode. The feature is useless because covariant parameter types are always
+allowed, but we wish to enable source code to be used in both standard and
+strong mode. So standard mode needs to include support for accepting and
+ignoring the syntax.*
+
+### Strong mode
+
+In strong mode, the covariant overrides feature affects the static analysis
+and dynamic semantics in several ways.
+
+#### Static checking
+
+In this section we discuss a few general issues; several larger subtopics
+are discussed in the following subsections.
+
+It is a compile-time error if the `covariant` modifier occurs on a
+parameter of a function which is not an instance method (which includes
+instance setters and instance operators). It is a compile-time error if the
+`covariant` modifier occurs on a variable declaration which is not a
+non-final instance variable.
+
+For a given parameter `p` in an instance method (including setter and
+operator) `m`, `p` is considered to be a **covariant parameter** if it has
+the modifier `covariant` or there is a direct or indirect supertype
+containing an overridden declaration of `m` where the parameter
+corresponding to `p` has the modifier `covariant`. For a type `T`, if
+multiple direct supertypes of `T` has a method `m` which is not overridden
+in `T`, each parameter of `m` is covariant iff that parameter is covariant
+in `m` in at least one of the supertypes.
+
+*In short, the property of being covariant is inherited, for each
+parameter. There is no conflict if only some overridden declarations have
+the `covariant` modifier, and others do not. The parameter is covariant iff
+at least one of them has it.*
+
+Function typing is unaffected by covariant overriding: When the type of a
+function is determined for a property extraction which tears off an
+instance method with one or more covariant parameters, the resulting type
+has no covariant parameters. Other expressions with a function type do not
+admit covariant parameters, and hence function types never include
+covariant parameters.
+
+*In particular, subtyping among function types is unaffected by covariant
+overriding, and so is type checking for invocations of first-class
+functions. Note that it is a non-trivial step to determine the run-time
+type of a torn off method, as described below.*
+
+An invocation of an instance method with one or more covariant parameters
+is checked as if no `covariant` modifiers had been present on any of the
+involved declarations.
+
+*From one point of view, covariant overrides are irrelevant for clients,
+it is a feature which is encapsulated in the invoked method. This is
+reflected in the typing. From another point of view, clients may need to
+provide arguments with a proper subtype of the one required in the static
+type, because there may be a dynamic check for that subtype. This is
+handled by developers using ad-hoc reasoning and suitable programming
+idioms. The whole point of this mechanism is to allow this.*
+
+##### Overriding
+
+The static warnings specified for override relationships among instance
+method declarations regarding the number and kind (named, positional) of
+parameters remain unchanged, except that any `covariant` modifiers are
+ignored.
+
+For a covariant parameter, the override rule is that its type must be
+either a supertype or a subtype of the type declared for the corresponding
+parameter in each of the directly or indirectly overridden declarations.
+
+*For a parameter which is not covariant, the override rule is is unchanged:
+its type must be a supertype of the type declared for the corresponding
+parameter in each directly overridden declaration. This includes the
+typical case where the type does not change, because any type is a
+supertype of itself. Override checking for return types is also unchanged.*
+
+##### Closurization
+
+The static type of a property extraction expression `e.m` which gives rise
+to closurization of a method (including an operator or a setter) which has
+one or more covariant parameters is the static type of the function `T.m`,
+where `T` is the static type of `e`, if `T.m` is defined. Otherwise the
+static type of `e.m` is `dynamic`.
+
+The static type of a property extraction expression `super.m` which gives
+rise to closurization of a method (including an operator or a setter)
+which has one or more covariant parameters is the static type of the
+function `T.m`, where `T` is the superclass of the enclosing class.
+
+In both cases, for the static type of the function `T.m`, all occurrences
+of the modifier `covariant` are ignored.
+
+*In short, the static type of a tear-off ignores covariant overrides. Note
+that this is not true for the dynamic type of the tear-off.*
+
+#### Dynamic semantics
+
+*The run-time semantics of the language with covariant overrides is the
+same as the run-time semantics of the language without that feature, except
+for the dynamic type of tear-offs, and except that some type checks which
+are not guaranteed to succeed based on static checks must be performed at
+run time.*
+
+A dynamic error occurs if a method with a covariant parameter `p` is
+invoked, and the binding for `p` is a value which is not `null` and whose
+run-time type is not a subtype of the type declared for `p`.
+
+##### The dynamic type of a closurized instance method
+
+The dynamic type of a function *f* which is created by closurization
+during evaluation of a property extraction expression is determined as
+follows:
+
+Let `m` be the name of the method (operator, setter) which is being
+closurized, let `T` be the type of the receiver, and let *D* be declaration
+of `m` in `T` or inherited by `T`.
+
+The return type of *f* the is the static return type of *D*. For each
+parameter `p` declared in *D* which is not covariant, the part in the
+dynamic type of *f* which corresponds to `p` is the static type of `p` in
+*D*. For each covariant parameter `q`, the part in the dynamic type of *f*
+which corresponds to `q` is `Object`.
+
+# Background Material
+
+The rest of this document contains motivations for having the covariant
+overrides feature, and discussions about it, leading to the design which is
+specified in the first part of this document.
+
+## Motivation
+
+In object-oriented class hierarchies, especially in user interface frameworks,
+it's fairly common to run into code like this:
+
+```dart
+class Widget {
+  void addChild(Widget widget) {...}
+}
+
+class RadioButton extends Widget {
+  void select() {...}
+}
+
+class RadioGroup extends Widget {
+  void addChild(RadioButton button) {
+    button.select();
+    super.addChild(button);
+  }
+}
+```
+
+Here, a `RadioGroup` is a kind of widget. It *refines* the base `Widget` interface
+by stating that its children must be `RadioButton`s and cannot be any arbitrary
+widget. Note that the parameter type in `RadioGroup.addChild()` is
+`RadioButton`, which is a subclass of `Widget`.
+
+This might seem innocuous at first, but it's actually statically unsound.
+Consider:
+
+```dart
+Widget widget = new RadioGroup(); // Upcast to Widget.
+widget.addChild(new Widget());    // Add the wrong kind of child.
+```
+
+Tightening a parameter type, that is, using a proper subtype of the existing
+one in an overriding definition, breaks the [Liskov substitution principle][].
+A `RadioGroup` doesn't support everything that its superclass Widget does.
+`Widget` claims you can add *any* kind of widget to it as a child, but
+`RadioGroup` requires it to be a `RadioButton`.
+
+[liskov substitution principle]: https://en.wikipedia.org/wiki/Liskov_substitution_principle
+
+Breaking substitutability is a little dubious, but in practice it works out
+fine. Developers can be careful and ensure that they only add the right kinds
+of children to their `RadioGroup`s. However, because this isn't *statically*
+safe, many languages disallow it, including Dart strong mode. (Dart 1.0
+permits it.)
+
+Instead, users must currently manually tighten the type in the body of the
+method:
+
+```dart
+class RadioGroup extends Widget {
+  void addChild(Widget widget) {
+    var button = widget as RadioButton;
+    button.select();
+    super.addChild(button);
+  }
+}
+```
+
+The declaration is now statically safe, since it takes the same type as the
+superclass method. The call to `select()` is safe because it's guarded by an
+explicit `as` cast. That cast is checked and will fail at runtime if the passed
+widget isn't actually a `RadioButton`.
+
+In most languages, this pattern is what you have to do. It has (at least) two
+problems. First, it's verbose. Many users intuitively expect to be able to
+define subclasses that refine the contracts of their superclasses, even though
+it's not strictly safe to do so. When they instead have to apply the above
+pattern, they are surprised, and find the resulting code ugly.
+
+The other problem is that this pattern leads to a worse static typing user
+experience. Because the cast is now hidden inside the body of the method, a user
+of `RadioGroup` can no longer see the tightened type requirement at the API level.
+
+If they read the generated docs for `addChild()` it appears to accept any old
+Widget even though it will blow up on anything other than a RadioGroup. In this
+code:
+
+```dart
+var group = new RadioGroup();
+group.addChild(new Widget());
+```
+
+There is no static error even though it's obviously statically incorrect.
+
+Anyone who has designed a widget hierarchy has likely run into this problem a
+couple of times. In particular, this showed up in a number of places in Flutter.
+
+In some cases, you can solve this using generics:
+
+```dart
+class Widget<T extends Widget> {
+  void addChild(T widget) {...}
+}
+
+class RadioButton extends Widget<Null> {
+  void select() {...}
+}
+
+class RadioGroup extends Widget<RadioButton> {
+  void addChild(RadioButton button) {
+    button.select();
+    super.addChild(button);
+  }
+}
+```
+
+In practice, this often doesn't work out. Often you have a family of related
+types, and making one generic means they all have to be, each with type
+parameters referring to the other. It often requires API consumers to make their
+own code generic simply to pass these objects around.
+
+## The covariant override feature
+
+Earlier, we showed the pattern users manually apply when they want to tighten a
+parameter type in a method override:
+
+```dart
+void addChild(Widget widget) {
+  var button = widget as RadioButton;
+  ...
+}
+```
+
+This proposal is roughly akin to syntactic sugar for that pattern. In this
+method, `widget` effectively has *two* types:
+
+*   The **original type** is the type that is declared on the method parameter.
+    Here, it's `Widget`. This type must follow the type system's rules for a
+    valid override in order to preserve the soundness guarantees of the
+    language.
+
+    With method parameters, that means the type must be equivalent to or a
+    supertype of the parameter type in the superclass and all of its
+    superinterfaces. This is the usual
+    [sound rule for function subtyping][contra].
+
+[contra]: https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)#Function_types
+
+*   The **desired type** is the type that the user wants to use inside the body
+    of the method. This is the real type that the overridden method requires in
+    order to function. Here, it's `RadioButton`.
+
+    The desired type is a subtype of the original type. Going from the original
+    type to the desired type is a downcast, which means the cast needs to be
+    checked and may fail at runtime.
+
+    Even though the desired type is ensconced in the body of the method in the
+    manual pattern, it really is part of the method's signature. If you are
+    calling `addChild()` *on an object that you statically know is a
+    RadioGroup*, you want the errors as if its declared type was the tighter
+    desired type, not the original one. This is something the manual pattern
+    can't express.
+
+So we need to understand the original type, the desired type, and when
+this feature comes into play. To enable it on a method parameter, you
+mark it with the contextual keyword `covariant`:
+
+```dart
+class Widget {
+  void addChild(covariant Widget widget) {...}
+}
+```
+
+Doing so says "A subclass may override this parameter with a tighter desired
+type". A subclass can then override it like so:
+
+```dart
+class RadioGroup extends Widget {
+  void addChild(RadioButton button) {
+    ...
+  }
+}
+```
+
+No special marker is needed in the overriding definition. The presence of
+`covariant` in the superclass is enough. The parameter type in the base class
+method becomes the *original type* of the overridden parameter. The parameter
+type in the derived method is the *desired type*.
+
+This approach fits well when a developer provides a library or framework where
+some parameter types were designed for getting tightened. For instance, the
+`Widget` hierarchy was designed like that.
+
+In cases where the supertype authors did not foresee this need, it is still
+possible to tighten a parameter type by putting the `covariant` modifier on
+the *overriding* parameter declaration.
+
+In general, a tightened type for a parameter `p` in a method `m` is allowed
+when at least one of the overridden declarations of `m` has a `covariant`
+modifier on the declaration corresponding to `p`.
+
+The `covariant` modifier can also be used on mutable fields. Doing so
+corresponds to marking the parameter in the implicitly generated setter
+for that field as `covariant`:
+
+```dart
+class Widget {
+  covariant Widget child;
+}
+```
+
+This is syntactic sugar for:
+
+```dart
+class Widget {
+  Widget _child;
+  Widget get child => _child;
+  set child(covariant Widget value) { _child = value; }
+}
+```
+
+#### Overriding rules
+
+With this feature, type checking of an overriding instance method or operator
+declaration depends on the `covariant` modifiers. For a given parameter
+`p` in a method or operator `m`, `p` is considered to be a **covariant
+parameter** if there is a direct or indirect supertype containing an overridden
+declaration of `m` where the parameter corresponding to `p` is marked
+`covariant`. In short, `covariant` is inherited, for each parameter. There is
+no conflict if only some overridden declarations have the `covariant` modifier
+and others do not, the parameter is covariant as soon as any one of them has
+it.
+
+We could have chosen to require that every supertype chain must make the
+parameter covariant, rather than just requiring that there exists such a
+supertype chain. This is a software engineering trade off: both choices
+can be implemented, and both choices provide a certain amount of protection
+against tightening types by accident. We have chosen the permissive variant,
+and it is always possible to make a linter require a stricter one.
+
+For a regular (non-covariant) parameter, the override rule is is unchanged:
+its type must be a supertype of the type declared for the same parameter in
+each directly overridden declaration. This includes the typical case where the
+type does not change, because any type is a supertype of itself.
+
+For a covariant parameter, the override rule is that its type must be either a
+supertype or a subtype of the type declared for the same parameter in each
+of the directly or indirectly overridden declarations.
+
+It is not enough to require a relationship with the directly overridden
+declarations: If we only required a subtype or supertype relation to each
+directly overridden declaration, we can easily create an example showing
+that there are no guarantees about the relationship between the statically
+known (original) parameter type and the actual (desired) parameter type
+at run time:
+
+```dart
+class A { void foo(int i) {...}}
+class B implements A { void foo(Object o) {...}}
+class C implements B { void foo(covariant String s) {...}}
+
+main() {
+  A a = new C();
+  a.foo(42); // Original type: int, desired type: String: Unrelated.
+}
+```
+
+Checking all overridden declarations may seem expensive, because all
+supertypes must be inspected in order to find those declarations. However, we
+expect that the cost can be kept at a reasonable level:
+
+First, covariant parameters are expected to be rare, and it is possible for
+a compiler to detect them at a reasonable cost: For each parameter, the status
+of being covariant or not covariant can be maintained by storing it after
+inspecting the stored value for that parameter in each directly overridden
+method. With that information available, it is cheap to detect whether a given
+method has any covariant parameters. If that is not the case then the override
+checks are unchanged, compared to the language without this feature.
+
+Otherwise the parameter is covariant, and in this case it will be necessary to
+find all overridden declarations (direct and indirect) for that method, and
+gather all types for that parameter. Given that overridden methods would
+themselves often have a corresponding covariant parameter, it may be worthwhile
+to cache the result. In that case there will be a set of types that occur as
+the declared type of the given parameter, and the check will then be to iterate
+over these overridden parameter types and verify that the overriding parameter
+type is a subtype or a supertype of each of them.
+
+#### Subtyping
+
+`covariant` modifiers are ignored when deciding subtype relationships among
+classes. So this:
+
+```dart
+var group = new RadioGroup();
+Widget widget = group;
+```
+
+... is perfectly fine.
+
+#### Method invocations
+
+Method invocations are checked according to the statically known receiver type,
+and all `covariant` modifiers are ignored. That is, we check against that which
+we called the original parameter types, and we ignore that the desired parameter
+type may be different. So this:
+
+```dart
+var group = new RadioGroup();
+group.addChild(new Widget()); // <--
+```
+
+... reports an error on the marked line. But this:
+
+```dart
+Widget widget = new RadioGroup();
+widget.addChild(new Widget());
+```
+
+... does not. Both will fail at run time, but the whole point of allowing
+covariant overrides is that developers should be allowed to opt in and take
+that risk.
+
+#### Tear-offs
+
+The *static* type of a tear-off is the type declared in the statically known
+receiver type:
+
+```dart
+var closure = new RadioGroup().addChild;
+```
+
+Here, `closure` has static type `(RadioButton) -> void`.
+
+```dart
+var closure = (new RadioGroup() as Widget).addChild;
+```
+
+Here, it has static type `(Widget) -> void`.
+
+Note that in both cases, we're tearing off the same actual method at runtime. We
+discuss below which runtime type such a tear-off should have.
+
+### Runtime semantics
+
+The runtime semantics of the language with covariant overrides is the same
+as the runtime semantics of the language without that feature, except that
+some type checks are not guaranteed to succeed based on static checks, so
+they must be performed at run time.
+
+In particular, when a method with a covariant parameter is invoked, it is not
+possible to guarantee based on the static type check at call sites that
+the actual argument will have the type which is declared for that parameter
+in the method that is actually invoked. A dynamic type check must then be
+performed to verify that the actual argument is null or has that type,
+and a `CastError` must be thrown if the check fails.
+
+In other words, the static checks enforce the original type, and the dynamic
+check enforces the desired type, and both checks are required because the
+desired type can be a proper subtype of the original type. Here is an example:
+
+```dart
+Widget widget = new RadioGroup();
+try {
+  widget.addChild(new Widget());
+} on CastError {
+  print("Caught!"); // Gets printed.
+}
+```
+
+In practice, a compiler may generate code such that every covariant parameter
+in each method implementation gets checked before the body of the method is
+executed. This is a correct implementation strategy because the dynamic check
+is performed with the desired type and it is performed for all invocations,
+no matter which original type the call site had.
+
+As an optimization, the dynamic check could be omitted in some cases, because
+it is guaranteed to succeed. For instance, we may know statically that the
+original and the desired type are the same, because the receiver's type is
+known exactly:
+
+```dart
+new RadioGroup().add(myRadioButton())
+```
+
+#### The runtime type of a tear-off
+
+For any given declaration *D* of a method `m`, the reified type
+obtained by tearing off `m` from a receiver whose dynamic type is a
+class `C` wherein *D* is the most specific declaration of `m` (that
+is, *D* has not been overridden by any other method declaration in
+`C`) can be computed as follows: Collect the set of all declarations
+of `m` in direct and indirect supertypes of `C`. For the reified
+return type, choose the greatest lower bound of all declared return
+types; for the reified parameter type of each covariant parameter,
+choose the least upper bound of all declared types for that parameter
+(including any declarations of that parameter which are not
+covariant).
+
+As a consequence, the reified type of a torn off method is at least as
+specific as every possible statically known type for that method, and
+that means that it is safe to assign the torn off method to a
+variable whose declared type is the statically known type of that
+method, no matter which supertype of the dynamic type of the receiver
+is the statically known receiver type.
+
+(Note that the computation of a "least upper bound" in Dart does not
+in fact yield a *least* upper bound, but it does yield some *upper
+bound*, which is sufficient to ensure that this safety property holds.)
+
+This rule is sufficiently complex to justify a rather lengthy
+discussion, which follows below.
+
+To give an example of the rule itself, consider `addChild` of
+`RadioGroup`. The set of declarations of `addChild` have the following
+types:
+
+* `(Widget) -> void` (From `Widget.addChild()`)
+* `(RadioButton) -> void` (From `RadioGroup.addChild()`)
+
+So the reified return type is `void`, and the argument type is the least upper
+bound of `Widget` and `RadioButton`: `Widget`. Thus the torn off method from
+`(new RadioGroup()).addChild` has reified type `(Widget) -> void`.
+
+To motivate this rule, we will consider some design options and their
+consequences. Consider the following tear-offs:
+
+```dart
+var closureRadio = new RadioGroup().addChild;
+var closureWidget = (new RadioGroup() as Widget).addChild;
+```
+
+Here, `closureRadio` has static type `(RadioButton) -> void`, and
+`closureWidget` has static type `(Widget) -> void`. However, they are both
+obtained by tearing off the same method from the exact same type of
+receiver at run time, so which of these types (or which type in
+general) do we *reify at runtime?*
+
+We could reify the type which is declared in the actual method which is torn
+off. (That is a specific method because method lookup is determined by the
+dynamic receiver type, and a tear-off embodies one specific receiver). In the
+example, the reified type would then be `(RadioButton) -> void`. Intuitively,
+this means that we will reify the "true" type of the method, based on its actual
+declaration.
+
+Or we could reify the statically known type, except that there are several
+possible statically known types when the method is inherited and overridden in
+several supertypes. In order to allow the torn off method to be passed around
+based on the statically known type, it should have the most specific type which
+this tear-off could ever have statically.
+
+To achieve is, we consider all the static types the receiver could
+have where the torn off method is statically known (in the example it
+would be `RadioGroup` and `Widget`, but not `Object` because
+`addChild()` is not inherited from there). In this set of classes,
+each declaration for the relevant method specifies a type for each
+covariant parameter. We may choose the least upper bound of all these
+types, or we may insist that there is a maximal type among them (such
+that all the others are subtypes of that type) and otherwise reject
+the method declaration as a compile-time error. In the example, this
+check succeeds and the resulting reified type is `(Widget) -> void`.
+
+With the first model (where we reify the "true" type `(RadioButton) ->
+void`), we get the property that the reified type is the most
+informative type there exists, but the tear-off fails to have the
+statically known type. This means that we may get a runtime exception
+by assigning a tear-off to a variable with the statically known type:
+
+```dart
+typedef void WidgetCallback(Widget widget);
+
+Widget widget = new RadioGroup();
+WidgetCallback callback = widget.addChild; // Statically OK, fails at run time.
+```
+
+This differs from the general situation. For instance, if `addChild` had been
+a getter then an initialization like:
+
+```dart
+WidgetCallback callback = widget.addChild;
+```
+
+would never fail
+with a type error, because the value returned by the getter is guaranteed to
+have the declared return type or be null. As a consequence, all tear-off
+expressions would have to be treated differently by compilers than other
+expressions, because they would have to generate the dynamic check.
+
+With the second model (where we aim for covering all statically known
+types and reify `(Widget) -> void`), it is possible that an invocation
+of the torn off closure fails, because the statically known
+requirement on the actual argument is less restrictive that the actual
+requirement at runtime. For instance, the actual torn off method would
+have a parameter type `RadioButton` even though the statically known
+parameter type is `Widget`. Here is an example:
+
+```dart
+typedef void WidgetCallback(Widget widget);
+
+Widget widget = new RadioGroup();
+WidgetCallback callback = widget.addChild; // Statically and dynamically OK.
+callback(new Widget()); // Statically OK, fails at run time.
+```
+
+As expected, both models are unsound. However, the second model exhibits a
+kind of unsoundness which is in line with the rest of the language, because
+it is a parameter passing operation that fails, and not an expression
+evaluation that yields a value which does not have the static type. This is
+also reflected in the fact that no dynamic checks must be generated at
+locations where such checks are otherwise avoided.
+
+So there are pros and cons to both approaches, but we have chosen to
+use the second model, yielding reified type `(Widget) -> void`.
+Reasons for this include the following:
+
+*   This choice lines up with the reified type you would get if you didn't have
+    this language feature and applied the pattern above manually:
+
+    ```dart
+    class RadioGroup extends Widget {
+      void addChild(Widget widget) {
+        var button = widget as RadioButton;
+        button.select();
+        super.addChild(button);
+      }
+    }
+    ```
+
+    Here, standard override rules are followed, and `RadioGroup.addChild` has
+    reified type `(Widget) -> void`.
+
+*   Polymorphic code that does implicit type tests won't spontaneously blow up
+    when encountering overridden methods with tighter types. Consider:
+
+    ```dart
+    typedef void TakesWidget(Widget widget);
+
+    grabClosures(List<Widget> widgets) {
+      var closures = <TakesWidget>[];
+      for (var widget in widgets) {
+        closures.add(widget.addChild);
+      }
+    }
+
+    grabClosures([
+      new Widget(),
+      new RadioGroup()
+    ]);
+    ```
+
+    The call to `List.add()` has to check the type of the added object at
+    runtime thanks to covariant generics. If the reified type of
+    `RadioGroup.addChild` had been `(RadioButton) -> void`, that check would fail.
+
+The main downside to reifying with the more special type is that you lose the
+ability to use an `is` check to detect which type of argument is *actually*
+required, you can just call it and hope that the dynamic check in the body
+succeeds. In practice, though, code we see using this pattern doesn't avoid
+those cast errors by using `is` checks, it avoids cast errors by managing how
+the objects collaborate with each other.
+
+## Questions
+
+### Why not always put `covariant` in the superclass?
+
+We could require each covariant parameter to be covariant everywhere, that is,
+we could require that every overridden declaration of that parameter either
+has the `covariant` modifier, or that it overrides another declaration which
+has it, directly or indirectly.
+
+There are no technical difficulties in implementing this approach, and it has
+the nice property that all call sites can be checked for type safety: If a
+given actual argument does not correspond to a formal parameter which is
+statically known to be covariant then that argument will not be passed to a
+covariant parameter at runtime. In other words, the desired type is a supertype
+of the original type (typically they are identical), and no runtime check
+failure is possible.
+
+The problem with this approach is that it requires the author of all the
+involved supertypes to foresee the need for covariance. Moreover, the safety
+property is more aggressive than other guarantees provided in Dart (for
+instance, an argument like `a` in `List<T>.add(a)` is always subject to a
+dynamic check because the list could have a type argument which is a proper
+subtype of `T`).
+
+So we made the choice to accept the dynamic checks, and in return allow
+developers to use covariant overrides even in cases where some of the supertype
+authors did not foresee the need.
+
+It should be noted, however, that it is *possible* to maintain a style where
+every covariant parameter is everywhere-covariant (that is, to put `covariant`
+in all supertypes), and it is possible to let a linter check that this style
+is used consistently. So developers may use this style, the language just
+doesn't enforce it.
+
+There are many intermediate forms where a given parameter is covariant
+in some supertypes but not all. This could mean that `covariant` is applied
+to a parameter in a library, because the design makes it useful to use
+covariant overrides for that parameter in subtypes and the library authors
+wish to make that known. Subtype authors would then automatically get the
+"permission" to tighten the corresponding parameter type, without an
+explicit `covariant` modifier. At the same time, it would not violate
+any rules if one of these parameters were overriding some additional
+declarations of the same method, even if the authors of those declarations
+were unaware of the need to use covariant overriding.
+
+### Why not allow all parameters to be tightened?
+
+Dart 1.0 allows any parameter in an overriding method declaration to have a
+tighter type than the one in the overridden method. We could certainly
+continue to allow this, and retain all the same safety properties in the
+semantics by inferring which parameters would be forced to have the
+`covariant` modifier, according to this proposal. There are several arguments
+in relation to this idea:
+
+*   We expect the situation where an overriding method is intended to have
+    a tightened parameter type to be rare, compared to the situation where
+    it is intended to have the same type (or even a supertype). This means
+    that an actual covariant override may be much more likely to be an
+    accident than an intended design choice. In that case it makes sense
+    to require the explicit opt-in that a modifier would provide.
+
+*   If a widely used class method is generalized to allow a looser type for
+    some parameter, third party implementations of that method in subtypes
+    could introduce covariance, silently and without changing the subtype
+    at all. This might cause invocations to fail at run time, even in
+    situations where the subtype could just as well have been changed to use
+    the new, looser parameter type, had the situation been detected.
+
+*   We have widespread feedback from users that they want greater confidence
+    in the static safety of their code. Allowing all parameters to silently
+    tighten their type shifts the balance in the direction of diminished
+    static safety, in return for added dynamic flexibility.
+
+*   Parameter covariance requires a runtime check, which has a run time
+    performance cost.
+
+*   Most other statically typed object-oriented languages do not allow this. It
+    is an error in Java, C#, C++, and others. Dart's type system strikes a
+    balance where certain constructs are allowed, even though they are not
+    type safe. But this balance should not be such that guarantees familiar to
+    users coming from those languages are violated in ways that are gratuitous
+    or error-prone.
+
+*   Finally, we are about to introduce a mechanism whereby the types of an
+    instance method declaration are inherited from overridden declarations, if
+    those types are omitted. With this mechanism in place, it will be a strong
+    signal in itself that a parameter type is present: This means that the
+    developer had the intention to specify something _new_, relative to the
+    overridden declarations of the same parameter. It is not unambiguous,
+    though, because it could be the case that the type is given explicitly
+    because there is no overridden method, or it could be that the type is
+    specified because it is changed contravariantly, or finally the type could
+    be specified explicitly simply because the source code is older than the
+    feature which allows it to be omitted, or because the organization
+    maintaining the code prefers a coding style where the types are always
+    explicit.
+
+Based on arguments like this, we decided that covariant overrides must be
+marked explicitly.
+
+### Why not `checked` or `unsafe`?
+
+Instead of "covariant", we could use "checked" to indicate that invocations
+passing actual arguments to this parameter will be subject to a runtime
+check. We decided not to do this, because it puts the focus on an action
+which is required by the type system to enforce a certain discipline on the
+program behavior at runtime, but the developers should be allowed to focus
+on what the program will do and how they may achieve that, not how it might
+fail.
+
+The word "covariant" may be esoteric, but if a developer knows the word or
+looks it up the meaning of this word directly addresses the functionality that
+this feature provides: It is possible to request a subtype for this parameter
+in an overriding version of the method.
+
+Similarly, the word "unsafe" puts the focus on the possible `CastError` at
+runtime, which is not the motivation for the developer to use this feature,
+it's a cost that they are willing to pay. Moreover, C#, Go, and Rust all use
+"unsafe" to refer to code that may violate soundness and memory safety entirely,
+e.g., using raw pointers or reinterpreting memory.
+
+What we're doing here isn't that risky. It stays within the soundness
+boundaries of the language, that is, it maintains heap soundness. The feature
+just requires a runtime check to do that, and this is a well-known situation
+in Dart.
+
+## Interactions with other language features
+
+This is yet another use of least upper bounds, which has traditionally been hard
+for users to understand in cases where the types are even a little bit complex,
+like generics. In practice, we expect most uses of this feature to only override
+a single chain of methods, in which case the least upper bound has no effect and
+the original type is just the most general parameter type in the chain.
+
+## Comparison to other languages
+
+**TODO**
+
+## Notes
+
+The feature (using a `@checked` metadata annotation rather than the `covariant`
+modifier) has already been implemented in strong mode, and is being used by
+Flutter. See here:
+
+https://github.com/dart-lang/sdk/commit/a4734d4b33f60776969b72ad475fea267c2091d5
+https://github.com/dart-lang/sdk/commit/70f6e16c97dc0f48d29deefdd7960cf3172b31a2
diff --git a/pkg/BUILD.gn b/pkg/BUILD.gn
index e1ce11d..bd7eb4c 100644
--- a/pkg/BUILD.gn
+++ b/pkg/BUILD.gn
@@ -16,7 +16,6 @@
       pattern = invoker.pattern
     }
     path = path
-    new_base = "//"
     output = "$target_gen_dir/third_party_pkg_files_$id.stamp"
   }
 }
diff --git a/pkg/analysis_server/BUILD.gn b/pkg/analysis_server/BUILD.gn
index 9e65d54..fae5d08 100644
--- a/pkg/analysis_server/BUILD.gn
+++ b/pkg/analysis_server/BUILD.gn
@@ -11,10 +11,10 @@
 
   deps = [
     "//dart/pkg/analyzer",
+    "//dart/third_party/pkg/linter",
     "//third_party/dart-pkg/pub/args",
     "//third_party/dart-pkg/pub/dart_style",
     "//third_party/dart-pkg/pub/isolate",
-    "//third_party/dart-pkg/pub/linter",
     "//third_party/dart-pkg/pub/logging",
     "//third_party/dart-pkg/pub/package_config",
     "//third_party/dart-pkg/pub/path",
diff --git a/pkg/analysis_server/benchmark/perf/benchmark_angular.dart b/pkg/analysis_server/benchmark/perf/benchmark_angular.dart
new file mode 100644
index 0000000..d1effe1
--- /dev/null
+++ b/pkg/analysis_server/benchmark/perf/benchmark_angular.dart
@@ -0,0 +1,117 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library server.performance.local;
+
+import 'dart:async';
+
+import 'benchmark_scenario.dart';
+import 'memory_tests.dart';
+
+main(List<String> args) async {
+  int length = args.length;
+  if (length < 1) {
+    print(
+        'Usage: dart benchmark_local.dart path_to_np8080 (an example ngdart project)'
+        ' [benchmark_id]');
+    return;
+  }
+  paths = new PathHolder(projectPath: args[0]);
+  String id = args.length >= 2 ? args[1] : null;
+  if (id == null) {
+    for (String id in benchmarks.keys) {
+      BenchmarkFunction benchmark = benchmarks[id];
+      await benchmark(id);
+    }
+  } else {
+    BenchmarkFunction benchmark = benchmarks[id];
+    if (benchmark != null) {
+      benchmark(id);
+    }
+  }
+}
+
+const Map<String, BenchmarkFunction> benchmarks =
+    const <String, BenchmarkFunction>{
+  'ng-initialAnalysis': run_ng_initialAnalysis,
+  'ng-change-dart': run_ng_change_dart,
+  'ng-change-html': run_ng_change_html,
+  'ng-memory-initialAnalysis': run_ng_memory_initialAnalysis,
+};
+
+PathHolder paths;
+
+Future run_ng_change_dart(String id) async {
+  String description = r'''
+1. Open 'packages/np8080'.
+2. Add an @Output to the class
+3. Measure the time to finish analysis.
+4. Rollback changes to the file and wait for analysis.
+5. Go to (2).
+''';
+  List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze(
+      roots: [paths.packageNp8080],
+      file: paths.editorDart,
+      fileChange: new FileChange(
+          afterStr: 'showPreview = false;',
+          insertStr: '@Output() EventEmitter<int> myEventEmitter;'),
+      numOfRepeats: 10);
+  printBenchmarkResults(id, description, times);
+}
+
+Future run_ng_change_html(String id) async {
+  String description = r'''
+1. Open 'packages/np8080'.
+2. Change the contents of a mustache
+3. Measure the time to finish analysis.
+4. Rollback changes to the file and wait for analysis.
+5. Go to (2).
+''';
+  List<int> times = await new BenchmarkScenario().waitAnalyze_change_analyze(
+      roots: [paths.packageNp8080],
+      file: paths.editorHtml,
+      fileChange: new FileChange(
+          afterStr: 'note.lastModified', afterStrBack: 4, insertStr: 'NewName'),
+      numOfRepeats: 4);
+  printBenchmarkResults(id, description, times);
+}
+
+Future run_ng_initialAnalysis(String id) async {
+  String description = r'''
+1. Start server, set 'package/np8080' analysis roots.
+2. Measure the time to finish initial analysis.
+3. Shutdown the server.
+4. Go to (1).
+''';
+  List<int> times = await BenchmarkScenario.start_waitInitialAnalysis_shutdown(
+      roots: [paths.packageNp8080], numOfRepeats: 5);
+  printBenchmarkResults(id, description, times);
+}
+
+Future run_ng_memory_initialAnalysis(String id) async {
+  String description = r'''
+1. Start server, set 'package/np8080' as the analysis root.
+2. Measure the memory usage after finishing initial analysis.
+3. Shutdown the server.
+4. Go to (1).
+''';
+  List<int> sizes = await AnalysisServerMemoryUsageTest
+      .start_waitInitialAnalysis_shutdown(
+          roots: <String>[paths.packageNp8080], numOfRepeats: 3);
+  printMemoryResults(id, description, sizes);
+}
+
+typedef BenchmarkFunction(String id);
+
+class PathHolder {
+  String editorHtml;
+  String editorDart;
+  String packageNp8080;
+
+  PathHolder({String projectPath}) {
+    editorHtml = '$projectPath/lib/editor/editor_component.html';
+    editorDart = '$projectPath/lib/editor/editor_component.dart';
+    packageNp8080 = projectPath;
+  }
+}
diff --git a/pkg/analysis_server/lib/plugin/edit/fix/fix_dart.dart b/pkg/analysis_server/lib/plugin/edit/fix/fix_dart.dart
index a0527d6..7b5d3d5 100644
--- a/pkg/analysis_server/lib/plugin/edit/fix/fix_dart.dart
+++ b/pkg/analysis_server/lib/plugin/edit/fix/fix_dart.dart
@@ -9,9 +9,20 @@
 import 'package:analysis_server/plugin/edit/fix/fix_core.dart';
 import 'package:analysis_server/src/services/correction/fix_internal.dart'
     show DartFixContextImpl;
+import 'package:analysis_server/src/services/correction/namespace.dart'
+    show getExportedElement;
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/task/dart.dart' show LIBRARY_ELEMENT4;
+
+/**
+ * Complete with top-level declarations with the given [name].
+ */
+typedef Future<List<TopLevelDeclarationInSource>> GetTopLevelDeclarations(
+    String name);
 
 /**
  * An object used to provide context information for [DartFixContributor]s.
@@ -20,6 +31,11 @@
  */
 abstract class DartFixContext implements FixContext {
   /**
+   * The function to get top-level declarations from.
+   */
+  GetTopLevelDeclarations get getTopLevelDeclarations;
+
+  /**
    * The [CompilationUnit] to compute fixes in.
    */
   CompilationUnit get unit;
@@ -48,7 +64,8 @@
     if (unit == null) {
       return Fix.EMPTY_LIST;
     }
-    DartFixContext dartContext = new DartFixContextImpl(context, unit);
+    DartFixContext dartContext = new DartFixContextImpl(
+        context, _getTopLevelDeclarations(analysisContext), unit);
     return internalComputeFixes(dartContext);
   }
 
@@ -56,4 +73,43 @@
    * Return a list of fixes for the given [context].
    */
   Future<List<Fix>> internalComputeFixes(DartFixContext context);
+
+  GetTopLevelDeclarations _getTopLevelDeclarations(AnalysisContext context) {
+    return (String name) async {
+      List<TopLevelDeclarationInSource> declarations = [];
+      List<Source> librarySources = context.librarySources;
+      for (Source librarySource in librarySources) {
+        // Prepare the LibraryElement.
+        LibraryElement libraryElement =
+            context.getResult(librarySource, LIBRARY_ELEMENT4);
+        if (libraryElement == null) {
+          continue;
+        }
+        // Prepare the exported Element.
+        Element element = getExportedElement(libraryElement, name);
+        if (element == null) {
+          continue;
+        }
+        if (element is PropertyAccessorElement) {
+          element = (element as PropertyAccessorElement).variable;
+        }
+        // Add a new declaration.
+        TopLevelDeclarationKind topLevelKind;
+        if (element.kind == ElementKind.CLASS ||
+            element.kind == ElementKind.FUNCTION_TYPE_ALIAS) {
+          topLevelKind = TopLevelDeclarationKind.type;
+        } else if (element.kind == ElementKind.FUNCTION) {
+          topLevelKind = TopLevelDeclarationKind.function;
+        } else if (element.kind == ElementKind.TOP_LEVEL_VARIABLE) {
+          topLevelKind = TopLevelDeclarationKind.variable;
+        }
+        if (topLevelKind != null) {
+          bool isExported = element.librarySource != librarySource;
+          declarations.add(new TopLevelDeclarationInSource(librarySource,
+              new TopLevelDeclaration(topLevelKind, element.name), isExported));
+        }
+      }
+      return declarations;
+    };
+  }
 }
diff --git a/pkg/analysis_server/lib/plugin/protocol/protocol.dart b/pkg/analysis_server/lib/plugin/protocol/protocol.dart
index 92ef921..49e19c1 100644
--- a/pkg/analysis_server/lib/plugin/protocol/protocol.dart
+++ b/pkg/analysis_server/lib/plugin/protocol/protocol.dart
@@ -567,6 +567,12 @@
                 RequestErrorCode.UNSUPPORTED_FEATURE, message));
 
   /**
+   * Return a table mapping the names of result fields to their values.  Should
+   * be `null` if there is no result to send.
+   */
+  Map<String, Object> get result => _result;
+
+  /**
    * Return a table representing the structure of the Json object that will be
    * sent to the client to represent this response.
    */
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index c8afeae..dcce078 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -26,7 +26,9 @@
 import 'package:analysis_server/src/services/search/search_engine_internal.dart';
 import 'package:analysis_server/src/services/search/search_engine_internal2.dart';
 import 'package:analysis_server/src/single_context_manager.dart';
+import 'package:analysis_server/src/utilities/null_string_sink.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/exception/exception.dart';
 import 'package:analyzer/file_system/file_system.dart';
@@ -240,7 +242,7 @@
   /**
    * The controller that is notified when analysis is started.
    */
-  StreamController<AnalysisContext> _onAnalysisStartedController;
+  StreamController<bool> _onAnalysisStartedController;
 
   /**
    * The controller that is notified when a single file has been analyzed.
@@ -330,12 +332,6 @@
   final Set<String> priorityFiles = new Set<String>();
 
   /**
-   * The cached results for [priorityFiles].
-   * These results must have not `null` units.
-   */
-  final Map<String, nd.AnalysisResult> priorityFileResults = {};
-
-  /**
    * Initialize a newly created server to receive requests from and send
    * responses to the given [channel].
    *
@@ -367,7 +363,20 @@
         options.finerGrainedInvalidation;
     defaultContextOptions.generateImplicitErrors = false;
     operationQueue = new ServerOperationQueue();
-    _analysisPerformanceLogger = new nd.PerformanceLog(io.stdout);
+
+    {
+      String name = options.newAnalysisDriverLog;
+      StringSink sink = new NullStringSink();
+      if (name != null) {
+        if (name == 'stdout') {
+          sink = io.stdout;
+        } else if (name.startsWith('file:')) {
+          String path = name.substring('file:'.length);
+          sink = new io.File(path).openWrite(mode: io.FileMode.APPEND);
+        }
+      }
+      _analysisPerformanceLogger = new nd.PerformanceLog(sink);
+    }
     if (resourceProvider is PhysicalResourceProvider) {
       byteStore = new MemoryCachingByteStore(
           new FileByteStore(
@@ -381,6 +390,7 @@
         new nd.AnalysisDriverScheduler(_analysisPerformanceLogger);
     analysisDriverScheduler.status.listen(sendStatusNotificationNew);
     analysisDriverScheduler.start();
+
     if (useSingleContextManager) {
       contextManager = new SingleContextManager(resourceProvider, sdkManager,
           packageResolverProvider, analyzedFilesGlobs, defaultContextOptions);
@@ -482,9 +492,9 @@
   }
 
   /**
-   * The stream that is notified when analysis of a context is started.
+   * The stream that is notified with `true` when analysis is started.
    */
-  Stream<AnalysisContext> get onAnalysisStarted {
+  Stream<bool> get onAnalysisStarted {
     return _onAnalysisStartedController.stream;
   }
 
@@ -614,12 +624,14 @@
    * otherwise in the first driver, otherwise `null` is returned.
    */
   Future<nd.AnalysisResult> getAnalysisResult(String path) async {
-    nd.AnalysisResult result = priorityFileResults[path];
-    if (result != null) {
-      return result;
+    try {
+      nd.AnalysisDriver driver = getAnalysisDriver(path);
+      return await driver?.getResult(path);
+    } catch (e) {
+      // Ignore the exception.
+      // We don't want to log the same exception again and again.
+      return null;
     }
-    nd.AnalysisDriver driver = getAnalysisDriver(path);
-    return driver?.getResult(path);
   }
 
   CompilationUnitElement getCompilationUnitElement(String file) {
@@ -656,6 +668,19 @@
   }
 
   /**
+   * Return the [nd.AnalysisDriver] for the "innermost" context whose associated
+   * folder is or contains the given path.  ("innermost" refers to the nesting
+   * of contexts, so if there is a context for path /foo and a context for
+   * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is
+   * the context for /foo/bar.)
+   *
+   * If no context contains the given path, `null` is returned.
+   */
+  nd.AnalysisDriver getContainingDriver(String path) {
+    return contextManager.getDriverFor(path);
+  }
+
+  /**
    * Return the primary [ContextSourcePair] representing the given [path].
    *
    * The [AnalysisContext] of this pair will be the context that explicitly
@@ -894,7 +919,7 @@
    * Return `true` if analysis is complete.
    */
   bool isAnalysisComplete() {
-    return operationQueue.isEmpty;
+    return operationQueue.isEmpty && !analysisDriverScheduler.isAnalyzing;
   }
 
   /**
@@ -1059,7 +1084,7 @@
    * Schedules analysis of the given context.
    */
   void schedulePerformAnalysisOperation(AnalysisContext context) {
-    _onAnalysisStartedController.add(context);
+    _onAnalysisStartedController.add(true);
     scheduleOperation(new PerformAnalysisOperation(context, false));
   }
 
@@ -1139,10 +1164,24 @@
   }
 
   /**
-   * Send status notification to the client. The `operation` is the operation
-   * being performed or `null` if analysis is complete.
+   * Send status notification to the client. The state of analysis is given by
+   * the [status] information.
    */
   void sendStatusNotificationNew(nd.AnalysisStatus status) {
+    if (status.isAnalyzing) {
+      _onAnalysisStartedController.add(true);
+    }
+    if (_onAnalysisCompleteCompleter != null && !status.isAnalyzing) {
+      _onAnalysisCompleteCompleter.complete();
+      _onAnalysisCompleteCompleter = null;
+    }
+    // Perform on-idle actions.
+    if (!status.isAnalyzing) {
+      if (generalAnalysisServices
+          .contains(GeneralAnalysisService.ANALYZED_FILES)) {
+        sendAnalysisNotificationAnalyzedFiles(this);
+      }
+    }
     // Only send status when subscribed.
     if (!serverServices.contains(ServerService.STATUS)) {
       return;
@@ -1197,7 +1236,7 @@
           // The result will be produced by the "results" stream with
           // the fully resolved unit, and processed with sending analysis
           // notifications as it happens after content changes.
-          driver.getResult(file);
+          driver.getResult(file).catchError((exception, stackTrace) {});
         }
       }
       return;
@@ -1245,7 +1284,9 @@
                 sendAnalysisNotificationHighlights(this, file, dartUnit);
                 break;
               case AnalysisService.OUTLINE:
-                AnalysisContext context = dartUnit.element.context;
+                AnalysisContext context = resolutionMap
+                    .elementDeclaredByCompilationUnit(dartUnit)
+                    .context;
                 LineInfo lineInfo = context.getLineInfo(source);
                 SourceKind kind = context.getKindOf(source);
                 sendAnalysisNotificationOutline(
@@ -1292,10 +1333,6 @@
    */
   void setPriorityFiles(String requestId, List<String> files) {
     if (options.enableNewAnalysisDriver) {
-      // Flush results for files that are not priority anymore.
-      priorityFiles
-          .difference(files.toSet())
-          .forEach(priorityFileResults.remove);
       priorityFiles.clear();
       priorityFiles.addAll(files);
       // Set priority files in drivers.
@@ -1425,8 +1462,6 @@
   void updateContent(String id, Map<String, dynamic> changes) {
     if (options.enableNewAnalysisDriver) {
       changes.forEach((file, change) {
-        priorityFileResults.remove(file);
-
         // Prepare the new contents.
         String oldContents = fileContentOverlay[file];
         String newContents;
@@ -1459,6 +1494,11 @@
         driverMap.values.forEach((driver) {
           driver.changeFile(file);
         });
+
+        // If the file did not exist, and is "overlay only", it still should be
+        // analyzed. Add it to driver to which it should have been added.
+        contextManager.getDriverFor(file)?.addFile(file);
+
         // TODO(scheglov) implement other cases
       });
       return;
@@ -1733,6 +1773,7 @@
   bool noIndex = false;
   bool useAnalysisHighlight2 = false;
   String fileReadMode = 'as-is';
+  String newAnalysisDriverLog;
 }
 
 /**
@@ -1777,35 +1818,13 @@
 
   @override
   nd.AnalysisDriver addAnalysisDriver(Folder folder, AnalysisOptions options) {
-    SourceFactory sourceFactory;
-    AnalysisOptions analysisOptions;
-    {
-      ContextBuilder builder = createContextBuilder(folder, options);
-      AnalysisContext context = builder.buildContext(folder.path);
-      sourceFactory = context.sourceFactory;
-      analysisOptions = context.analysisOptions;
-      context.dispose();
-    }
-    nd.AnalysisDriver analysisDriver = new nd.AnalysisDriver(
-        analysisServer.analysisDriverScheduler,
-        analysisServer._analysisPerformanceLogger,
-        resourceProvider,
-        analysisServer.byteStore,
-        analysisServer.fileContentOverlay,
-        sourceFactory,
-        analysisOptions);
-    analysisDriver.name = folder.shortName;
+    ContextBuilder builder = createContextBuilder(folder, options);
+    nd.AnalysisDriver analysisDriver = builder.buildDriver(folder.path);
     analysisDriver.status.listen((status) {
       // TODO(scheglov) send server status
     });
     analysisDriver.results.listen((result) {
-      if (analysisServer.priorityFiles.contains(result.path) &&
-          result.unit != null) {
-        analysisServer.priorityFileResults[result.path] = result;
-      }
-      _runDelayed(() {
-        new_sendErrorNotification(analysisServer, result);
-      });
+      new_sendErrorNotification(analysisServer, result);
       String path = result.path;
       CompilationUnit unit = result.unit;
       if (unit != null) {
@@ -1822,16 +1841,35 @@
           });
         }
         if (analysisServer._hasAnalysisServiceSubscription(
+            AnalysisService.OCCURRENCES, path)) {
+          _runDelayed(() {
+            new_sendDartNotificationOccurrences(analysisServer, result);
+          });
+        }
+        if (analysisServer._hasAnalysisServiceSubscription(
             AnalysisService.OVERRIDES, path)) {
           _runDelayed(() {
             sendAnalysisNotificationOverrides(analysisServer, path, unit);
           });
         }
+        if (analysisServer._hasAnalysisServiceSubscription(
+            AnalysisService.OUTLINE, path)) {
+          _runDelayed(() {
+            SourceKind sourceKind =
+                unit.directives.any((d) => d is PartOfDirective)
+                    ? SourceKind.PART
+                    : SourceKind.LIBRARY;
+            sendAnalysisNotificationOutline(
+                analysisServer, path, result.lineInfo, sourceKind, unit);
+          });
+        }
       }
       // TODO(scheglov) Implement more notifications.
       // IMPLEMENTED
-      // OCCURRENCES (not used in IDEA)
-      // OUTLINE (not used in IDEA)
+    });
+    analysisDriver.exceptions.listen((nd.ExceptionResult result) {
+      AnalysisEngine.instance.logger
+          .logError('Analysis failed: ${result.path}', result.exception);
     });
     analysisServer.driverMap[folder] = analysisDriver;
     return analysisDriver;
@@ -1881,6 +1919,12 @@
   }
 
   @override
+  void applyFileRemoved(nd.AnalysisDriver driver, String file) {
+    driver.removeFile(file);
+    sendAnalysisNotificationFlushResults(analysisServer, [file]);
+  }
+
+  @override
   void computingPackageMap(bool computing) =>
       analysisServer._computingPackageMap(computing);
 
@@ -1913,6 +1957,10 @@
         options: builderOptions);
     builder.fileResolverProvider = analysisServer.fileResolverProvider;
     builder.packageResolverProvider = analysisServer.packageResolverProvider;
+    builder.analysisDriverScheduler = analysisServer.analysisDriverScheduler;
+    builder.performanceLog = analysisServer._analysisPerformanceLogger;
+    builder.byteStore = analysisServer.byteStore;
+    builder.fileContentOverlay = analysisServer.fileContentOverlay;
     return builder;
   }
 
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights.dart b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
index 1214ea4..5768a88 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights.dart
@@ -500,6 +500,19 @@
   }
 
   @override
+  Object visitGenericFunctionType(GenericFunctionType node) {
+    computer._addRegion_token(
+        node.functionKeyword, HighlightRegionType.KEYWORD);
+    return super.visitGenericFunctionType(node);
+  }
+
+  @override
+  Object visitGenericTypeAlias(GenericTypeAlias node) {
+    computer._addRegion_token(node.typedefKeyword, HighlightRegionType.KEYWORD);
+    return super.visitGenericTypeAlias(node);
+  }
+
+  @override
   Object visitHideCombinator(HideCombinator node) {
     computer._addRegion_token(node.keyword, HighlightRegionType.BUILT_IN);
     return super.visitHideCombinator(node);
diff --git a/pkg/analysis_server/lib/src/computer/computer_highlights2.dart b/pkg/analysis_server/lib/src/computer/computer_highlights2.dart
index 7d67c26..184c35d 100644
--- a/pkg/analysis_server/lib/src/computer/computer_highlights2.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_highlights2.dart
@@ -6,6 +6,7 @@
 
 import 'package:analysis_server/plugin/protocol/protocol.dart' hide Element;
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -428,7 +429,7 @@
     if (e is SimpleIdentifier && e.staticElement is PrefixElement) {
       return false;
     }
-    return e.bestType.isDynamic;
+    return resolutionMap.bestTypeForExpression(e).isDynamic;
   }
 }
 
@@ -590,6 +591,19 @@
   }
 
   @override
+  Object visitGenericFunctionType(GenericFunctionType node) {
+    computer._addRegion_token(
+        node.functionKeyword, HighlightRegionType.KEYWORD);
+    return super.visitGenericFunctionType(node);
+  }
+
+  @override
+  Object visitGenericTypeAlias(GenericTypeAlias node) {
+    computer._addRegion_token(node.typedefKeyword, HighlightRegionType.KEYWORD);
+    return super.visitGenericTypeAlias(node);
+  }
+
+  @override
   Object visitHideCombinator(HideCombinator node) {
     computer._addRegion_token(node.keyword, HighlightRegionType.BUILT_IN);
     return super.visitHideCombinator(node);
diff --git a/pkg/analysis_server/lib/src/computer/computer_outline.dart b/pkg/analysis_server/lib/src/computer/computer_outline.dart
index a89ff02..f72cbe9 100644
--- a/pkg/analysis_server/lib/src/computer/computer_outline.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_outline.dart
@@ -40,7 +40,7 @@
             FieldDeclaration fieldDeclaration = classMember;
             VariableDeclarationList fields = fieldDeclaration.fields;
             if (fields != null) {
-              TypeName fieldType = fields.type;
+              TypeAnnotation fieldType = fields.type;
               String fieldTypeName = _safeToSource(fieldType);
               for (VariableDeclaration field in fields.variables) {
                 classContents.add(_newVariableOutline(fieldTypeName,
@@ -67,7 +67,7 @@
         TopLevelVariableDeclaration fieldDeclaration = unitMember;
         VariableDeclarationList fields = fieldDeclaration.variables;
         if (fields != null) {
-          TypeName fieldType = fields.type;
+          TypeAnnotation fieldType = fields.type;
           String fieldTypeName = _safeToSource(fieldType);
           for (VariableDeclaration field in fields.variables) {
             unitContents.add(_newVariableOutline(
@@ -251,7 +251,7 @@
   }
 
   Outline _newFunctionOutline(FunctionDeclaration function, bool isStatic) {
-    TypeName returnType = function.returnType;
+    TypeAnnotation returnType = function.returnType;
     SimpleIdentifier nameNode = function.name;
     String name = nameNode.name;
     FunctionExpression functionExpression = function.functionExpression;
@@ -285,7 +285,7 @@
   }
 
   Outline _newFunctionTypeAliasOutline(FunctionTypeAlias node) {
-    TypeName returnType = node.returnType;
+    TypeAnnotation returnType = node.returnType;
     SimpleIdentifier nameNode = node.name;
     String name = nameNode.name;
     _SourceRegion sourceRegion = _getSourceRegion(node);
@@ -306,7 +306,7 @@
   }
 
   Outline _newMethodOutline(MethodDeclaration method) {
-    TypeName returnType = method.returnType;
+    TypeAnnotation returnType = method.returnType;
     SimpleIdentifier nameNode = method.name;
     String name = nameNode.name;
     FormalParameterList parameters = method.parameters;
diff --git a/pkg/analysis_server/lib/src/computer/new_notifications.dart b/pkg/analysis_server/lib/src/computer/new_notifications.dart
index b4e3460..1ca3636 100644
--- a/pkg/analysis_server/lib/src/computer/new_notifications.dart
+++ b/pkg/analysis_server/lib/src/computer/new_notifications.dart
@@ -6,8 +6,9 @@
 import 'package:analysis_server/src/analysis_server.dart' show AnalysisServer;
 import 'package:analysis_server/src/domains/analysis/navigation.dart';
 import 'package:analysis_server/src/domains/analysis/navigation_dart.dart';
+import 'package:analysis_server/src/domains/analysis/occurrences.dart';
+import 'package:analysis_server/src/domains/analysis/occurrences_dart.dart';
 import 'package:analysis_server/src/protocol_server.dart' as protocol;
-import 'package:analyzer/error/error.dart';
 import 'package:analyzer/src/dart/analysis/driver.dart';
 
 void new_sendDartNotificationNavigation(
@@ -15,7 +16,7 @@
   var unit = result.unit;
   if (unit != null) {
     NavigationCollectorImpl collector = new NavigationCollectorImpl();
-    computeSimpleDartNavigation(collector, unit);
+    computeDartNavigation(collector, unit, null, null);
     collector.createRegions();
     var params = new protocol.AnalysisNavigationParams(
         result.path, collector.regions, collector.targets, collector.files);
@@ -23,13 +24,22 @@
   }
 }
 
+void new_sendDartNotificationOccurrences(
+    AnalysisServer analysisServer, AnalysisResult result) {
+  var unit = result.unit;
+  if (unit != null) {
+    OccurrencesCollectorImpl collector = new OccurrencesCollectorImpl();
+    addDartOccurrences(collector, unit);
+    var params = new protocol.AnalysisOccurrencesParams(
+        result.path, collector.allOccurrences);
+    analysisServer.sendNotification(params.toNotification());
+  }
+}
+
 void new_sendErrorNotification(
     AnalysisServer analysisServer, AnalysisResult result) {
-  var serverErrors = <protocol.AnalysisError>[];
-  for (AnalysisError error in result.errors) {
-    serverErrors
-        .add(protocol.newAnalysisError_fromEngine(result.lineInfo, error));
-  }
+  var serverErrors = protocol.doAnalysisError_listFromEngine(
+      result.driver.analysisOptions, result.lineInfo, result.errors);
   var params = new protocol.AnalysisErrorsParams(result.path, serverErrors);
   analysisServer.sendNotification(params.toNotification());
 }
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 19737b8..c8faf13 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -10,10 +10,8 @@
 import 'dart:core';
 
 import 'package:analysis_server/src/analysis_server.dart';
-import 'package:analyzer/exception/exception.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/instrumentation/instrumentation.dart';
-import 'package:analyzer/plugin/options.dart';
 import 'package:analyzer/plugin/resolver_provider.dart';
 import 'package:analyzer/source/analysis_options_provider.dart';
 import 'package:analyzer/source/package_map_provider.dart';
@@ -292,6 +290,24 @@
   AnalysisContext getContextFor(String path);
 
   /**
+   * Return the [AnalysisDriver] for the "innermost" context whose associated
+   * folder is or contains the given path.  ("innermost" refers to the nesting
+   * of contexts, so if there is a context for path /foo and a context for
+   * path /foo/bar, then the innermost context containing /foo/bar/baz.dart is
+   * the context for /foo/bar.)
+   *
+   * If no driver contains the given path, `null` is returned.
+   */
+  AnalysisDriver getDriverFor(String path);
+
+  /**
+   * Return a list of all of the analysis drivers reachable from the given
+   * [analysisRoot] (the driver associated with [analysisRoot] and all of its
+   * descendants).
+   */
+  List<AnalysisDriver> getDriversInAnalysisRoot(Folder analysisRoot);
+
+  /**
    * Return `true` if the given [path] is ignored by a [ContextInfo] whose
    * folder contains it.
    */
@@ -350,6 +366,11 @@
   void applyChangesToContext(Folder contextFolder, ChangeSet changeSet);
 
   /**
+   * The given [file] was removed from the folder analyzed in the [driver].
+   */
+  void applyFileRemoved(AnalysisDriver driver, String file);
+
+  /**
    * Signals that the context manager has started to compute a package map (if
    * [computing] is `true`) or has finished (if [computing] is `false`).
    */
@@ -589,6 +610,35 @@
   }
 
   @override
+  AnalysisDriver getDriverFor(String path) {
+    return _getInnermostContextInfoFor(path)?.analysisDriver;
+  }
+
+  @override
+  List<AnalysisDriver> getDriversInAnalysisRoot(Folder analysisRoot) {
+    List<AnalysisDriver> drivers = <AnalysisDriver>[];
+    void addContextAndDescendants(ContextInfo info) {
+      drivers.add(info.analysisDriver);
+      info.children.forEach(addContextAndDescendants);
+    }
+
+    ContextInfo innermostContainingInfo =
+        _getInnermostContextInfoFor(analysisRoot.path);
+    if (innermostContainingInfo != null) {
+      if (analysisRoot == innermostContainingInfo.folder) {
+        addContextAndDescendants(innermostContainingInfo);
+      } else {
+        for (ContextInfo info in innermostContainingInfo.children) {
+          if (analysisRoot.isOrContains(info.folder.path)) {
+            addContextAndDescendants(info);
+          }
+        }
+      }
+    }
+    return drivers;
+  }
+
+  @override
   bool isIgnored(String path) {
     ContextInfo info = rootInfo;
     do {
@@ -627,37 +677,25 @@
       return;
     }
 
-    // In case options files are removed, revert to defaults.
+    AnalysisOptionsImpl analysisOptions;
     if (optionsRemoved) {
-      // Start with defaults.
-      info.context.analysisOptions = new AnalysisOptionsImpl();
-
+      // In case options files are removed, revert to defaults.
+      analysisOptions = new AnalysisOptionsImpl.from(defaultContextOptions);
       // Apply inherited options.
       options = _toStringMap(_getEmbeddedOptions(info));
-      if (options != null) {
-        configureContextOptions(info.context, options);
-      }
     } else {
+      analysisOptions =
+          new AnalysisOptionsImpl.from(info.context.analysisOptions);
       // Check for embedded options.
       Map embeddedOptions = _getEmbeddedOptions(info);
       if (embeddedOptions != null) {
         options = _toStringMap(new Merger().merge(embeddedOptions, options));
       }
     }
-
-    // Notify options processors.
-    AnalysisEngine.instance.optionsPlugin.optionsProcessors
-        .forEach((OptionsProcessor p) {
-      try {
-        p.optionsProcessed(info.context, options);
-      } catch (e, stacktrace) {
-        AnalysisEngine.instance.logger.logError(
-            'Error processing analysis options',
-            new CaughtException(e, stacktrace));
-      }
-    });
-
-    configureContextOptions(info.context, options);
+    if (options != null) {
+      applyToAnalysisOptions(analysisOptions, options);
+    }
+    info.context.analysisOptions = analysisOptions;
 
     // Nothing more to do.
     if (options == null) {
@@ -678,51 +716,20 @@
   /**
    * Process [options] for the given context [info].
    */
-  void processOptionsForDriver(ContextInfo info, Map<String, Object> options,
-      {bool optionsRemoved: false}) {
-    if (options == null && !optionsRemoved) {
-      return;
-    }
-    AnalysisOptions analysisOptions = info.analysisDriver.analysisOptions;
-
-    // In case options files are removed, revert to defaults.
-    if (optionsRemoved) {
-      // Start with defaults.
-      analysisOptions.resetToDefaults();
-
-      // Apply inherited options.
-      options = _toStringMap(_getEmbeddedOptions(info));
-      if (options != null) {
-        applyToAnalysisOptions(analysisOptions, options);
-      }
-    } else {
-      // Check for embedded options.
-      Map embeddedOptions = _getEmbeddedOptions(info);
-      if (embeddedOptions != null) {
-        options = _toStringMap(new Merger().merge(embeddedOptions, options));
-      }
-    }
-
-    // TODO(brianwilkerson) Figure out what to do here.
-//    // Notify options processors.
-//    AnalysisEngine.instance.optionsPlugin.optionsProcessors
-//        .forEach((OptionsProcessor p) {
-//      try {
-//        p.optionsProcessed(info.context, options);
-//      } catch (e, stacktrace) {
-//        AnalysisEngine.instance.logger.logError(
-//            'Error processing analysis options',
-//            new CaughtException(e, stacktrace));
-//      }
-//    });
-
-    applyToAnalysisOptions(analysisOptions, options);
-
-    // Nothing more to do.
+  void processOptionsForDriver(ContextInfo info,
+      AnalysisOptionsImpl analysisOptions, Map<String, Object> options) {
     if (options == null) {
       return;
     }
 
+    // Check for embedded options.
+    Map embeddedOptions = _getEmbeddedOptions(info);
+    if (embeddedOptions != null) {
+      options = _toStringMap(new Merger().merge(embeddedOptions, options));
+    }
+
+    applyToAnalysisOptions(analysisOptions, options);
+
     var analyzer = options[AnalyzerOptions.analyzer];
     if (analyzer is Map) {
       // Set ignore patterns.
@@ -978,15 +985,27 @@
   void _checkForAnalysisOptionsUpdate(
       String path, ContextInfo info, ChangeType changeType) {
     if (AnalysisEngine.isAnalysisOptionsFileName(path, pathContext)) {
-      var analysisContext = info.context;
-      if (analysisContext is context.AnalysisContextImpl) {
-        Map<String, Object> options =
-            readOptions(info.folder, info.disposition.packages);
-        processOptionsForContext(info, options,
-            optionsRemoved: changeType == ChangeType.REMOVE);
-        analysisContext.sourceFactory = _createSourceFactory(
-            analysisContext, analysisContext.analysisOptions, info.folder);
-        callbacks.applyChangesToContext(info.folder, new ChangeSet());
+      if (enableNewAnalysisDriver) {
+        AnalysisDriver driver = info.analysisDriver;
+        String contextRoot = info.folder.path;
+        ContextBuilder builder =
+            callbacks.createContextBuilder(info.folder, defaultContextOptions);
+        AnalysisOptions options = builder.getAnalysisOptions(contextRoot);
+        SourceFactory factory =
+            builder.createSourceFactory(contextRoot, options);
+        driver.configure(analysisOptions: options, sourceFactory: factory);
+        // TODO(brianwilkerson) Set exclusion patterns.
+      } else {
+        var analysisContext = info.context;
+        if (analysisContext is context.AnalysisContextImpl) {
+          Map<String, Object> options =
+              readOptions(info.folder, info.disposition.packages);
+          processOptionsForContext(info, options,
+              optionsRemoved: changeType == ChangeType.REMOVE);
+          analysisContext.sourceFactory = _createSourceFactory(
+              analysisContext, analysisContext.analysisOptions, info.folder);
+          callbacks.applyChangesToContext(info.folder, new ChangeSet());
+        }
       }
     }
   }
@@ -999,11 +1018,15 @@
       String contextRoot = info.folder.path;
       ContextBuilder builder =
           callbacks.createContextBuilder(info.folder, defaultContextOptions);
-      AnalysisOptions options =
-          builder.getAnalysisOptions(info.context, contextRoot);
+      AnalysisOptions options = builder.getAnalysisOptions(contextRoot);
       SourceFactory factory = builder.createSourceFactory(contextRoot, options);
-      info.context.analysisOptions = options;
-      info.context.sourceFactory = factory;
+      if (enableNewAnalysisDriver) {
+        AnalysisDriver driver = info.analysisDriver;
+        driver.configure(analysisOptions: options, sourceFactory: factory);
+      } else {
+        info.context.analysisOptions = options;
+        info.context.sourceFactory = factory;
+      }
     }
   }
 
@@ -1015,11 +1038,11 @@
    */
   List<String> _computeFlushedFiles(ContextInfo info) {
     if (enableNewAnalysisDriver) {
-      Set<String> flushedFiles = info.analysisDriver.knownFiles.toSet();
+      Set<String> flushedFiles = info.analysisDriver.addedFiles.toSet();
       for (ContextInfo contextInfo in rootInfo.descendants) {
         AnalysisDriver other = contextInfo.analysisDriver;
         if (other != info.analysisDriver) {
-          flushedFiles.removeAll(other.knownFiles);
+          flushedFiles.removeAll(other.addedFiles);
         }
       }
       return flushedFiles.toList(growable: false);
@@ -1142,30 +1165,12 @@
 
     info.setDependencies(dependencies);
     if (enableNewAnalysisDriver) {
+      processOptionsForDriver(info, options, optionMap);
       info.analysisDriver = callbacks.addAnalysisDriver(folder, options);
     } else {
       info.context = callbacks.addContext(folder, options);
       _folderMap[folder] = info.context;
       info.context.name = folder.path;
-    }
-
-    // Look for pubspec-specified analysis configuration.
-    File pubspec;
-    if (packagespecFile?.exists == true) {
-      if (packagespecFile.shortName == PUBSPEC_NAME) {
-        pubspec = packagespecFile;
-      }
-    }
-    if (pubspec == null) {
-      Resource child = folder.getChild(PUBSPEC_NAME);
-      if (child.exists && child is File) {
-        pubspec = child;
-      }
-    }
-
-    if (enableNewAnalysisDriver) {
-      processOptionsForDriver(info, optionMap);
-    } else {
       processOptionsForContext(info, optionMap);
     }
 
@@ -1479,7 +1484,7 @@
         }
 
         if (enableNewAnalysisDriver) {
-          info.analysisDriver.removeFile(path);
+          callbacks.applyFileRemoved(info.analysisDriver, path);
         } else {
           List<Source> sources = info.context.getSourcesWithFullName(path);
           if (!sources.isEmpty) {
@@ -1665,10 +1670,18 @@
   }
 
   void _updateContextPackageUriResolver(Folder contextFolder) {
-    AnalysisContext context = folderMap[contextFolder];
-    context.sourceFactory =
-        _createSourceFactory(context, context.analysisOptions, contextFolder);
-    callbacks.updateContextPackageUriResolver(context);
+    if (enableNewAnalysisDriver) {
+      ContextInfo info = getContextInfoFor(contextFolder);
+      AnalysisDriver driver = info.analysisDriver;
+      SourceFactory sourceFactory =
+          _createSourceFactory(null, driver.analysisOptions, contextFolder);
+      driver.configure(sourceFactory: sourceFactory);
+    } else {
+      AnalysisContext context = folderMap[contextFolder];
+      context.sourceFactory =
+          _createSourceFactory(context, context.analysisOptions, contextFolder);
+      callbacks.updateContextPackageUriResolver(context);
+    }
   }
 
   /**
diff --git a/pkg/analysis_server/lib/src/domain_analysis.dart b/pkg/analysis_server/lib/src/domain_analysis.dart
index 499fd99..424815d 100644
--- a/pkg/analysis_server/lib/src/domain_analysis.dart
+++ b/pkg/analysis_server/lib/src/domain_analysis.dart
@@ -13,6 +13,7 @@
 import 'package:analysis_server/src/constants.dart';
 import 'package:analysis_server/src/context_manager.dart';
 import 'package:analysis_server/src/domains/analysis/navigation.dart';
+import 'package:analysis_server/src/domains/analysis/navigation_dart.dart';
 import 'package:analysis_server/src/operation/operation_analysis.dart'
     show NavigationOperation, OccurrencesOperation;
 import 'package:analysis_server/src/protocol/protocol_internal.dart';
@@ -21,6 +22,7 @@
 import 'package:analysis_server/src/services/dependencies/reachable_source_collector.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/error/error.dart' as engine;
 import 'package:analyzer/exception/exception.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/src/dart/analysis/driver.dart';
@@ -48,39 +50,49 @@
   /**
    * Implement the `analysis.getErrors` request.
    */
-  Response getErrors(Request request) {
+  Future<Null> getErrors(Request request) async {
     String file = new AnalysisGetErrorsParams.fromRequest(request).file;
+
+    void send(engine.AnalysisOptions analysisOptions, LineInfo lineInfo,
+        List<engine.AnalysisError> errors) {
+      if (lineInfo == null) {
+        server.sendResponse(new Response.getErrorsInvalidFile(request));
+      } else {
+        List<AnalysisError> protocolErrors =
+            doAnalysisError_listFromEngine(analysisOptions, lineInfo, errors);
+        server.sendResponse(
+            new AnalysisGetErrorsResult(protocolErrors).toResponse(request.id));
+      }
+    }
+
+    if (server.options.enableNewAnalysisDriver) {
+      var result = await server.getAnalysisResult(file);
+      send(result?.driver?.analysisOptions, result?.lineInfo, result?.errors);
+      return;
+    }
+
     Future<AnalysisDoneReason> completionFuture =
         server.onFileAnalysisComplete(file);
     if (completionFuture == null) {
-      return new Response.getErrorsInvalidFile(request);
+      server.sendResponse(new Response.getErrorsInvalidFile(request));
     }
-    completionFuture.then((AnalysisDoneReason reason) {
+    completionFuture.then((AnalysisDoneReason reason) async {
       switch (reason) {
         case AnalysisDoneReason.COMPLETE:
           engine.AnalysisErrorInfo errorInfo = server.getErrors(file);
-          List<AnalysisError> errors;
           if (errorInfo == null) {
             server.sendResponse(new Response.getErrorsInvalidFile(request));
           } else {
             engine.AnalysisContext context = server.getAnalysisContext(file);
-            errors = doAnalysisError_listFromEngine(
-                context, errorInfo.lineInfo, errorInfo.errors);
-            server.sendResponse(
-                new AnalysisGetErrorsResult(errors).toResponse(request.id));
+            send(context.analysisOptions, errorInfo.lineInfo, errorInfo.errors);
           }
           break;
         case AnalysisDoneReason.CONTEXT_REMOVED:
           // The active contexts have changed, so try again.
-          Response response = getErrors(request);
-          if (response != Response.DELAYED_RESPONSE) {
-            server.sendResponse(response);
-          }
+          await getErrors(request);
           break;
       }
     });
-    // delay response
-    return Response.DELAYED_RESPONSE;
   }
 
   /**
@@ -132,17 +144,35 @@
   /**
    * Implement the `analysis.getNavigation` request.
    */
-  Response getNavigation(Request request) {
-    if (server.options.enableNewAnalysisDriver) {
-      // TODO(scheglov) implement for the new analysis driver
-      return new Response.getNavigationInvalidFile(request);
-    }
+  Future<Null> getNavigation(Request request) async {
     var params = new AnalysisGetNavigationParams.fromRequest(request);
     String file = params.file;
+
+    if (server.options.enableNewAnalysisDriver) {
+      AnalysisDriver driver = server.getContainingDriver(file);
+      if (driver == null) {
+        server.sendResponse(new Response.getNavigationInvalidFile(request));
+      } else {
+        AnalysisResult result = await server.getAnalysisResult(file);
+        CompilationUnit unit = result?.unit;
+        if (unit == null || !result.exists) {
+          server.sendResponse(new Response.getNavigationInvalidFile(request));
+        } else {
+          NavigationCollectorImpl collector = new NavigationCollectorImpl();
+          computeDartNavigation(collector, unit, params.offset, params.length);
+          collector.createRegions();
+          server.sendResponse(new AnalysisGetNavigationResult(
+                  collector.files, collector.targets, collector.regions)
+              .toResponse(request.id));
+        }
+      }
+      return;
+    }
+
     Future<AnalysisDoneReason> analysisFuture =
         server.onFileAnalysisComplete(file);
     if (analysisFuture == null) {
-      return new Response.getNavigationInvalidFile(request);
+      server.sendResponse(new Response.getNavigationInvalidFile(request));
     }
     analysisFuture.then((AnalysisDoneReason reason) async {
       switch (reason) {
@@ -165,15 +195,10 @@
           break;
         case AnalysisDoneReason.CONTEXT_REMOVED:
           // The active contexts have changed, so try again.
-          Response response = getNavigation(request);
-          if (response != Response.DELAYED_RESPONSE) {
-            server.sendResponse(response);
-          }
+          await getNavigation(request);
           break;
       }
     });
-    // delay response
-    return Response.DELAYED_RESPONSE;
   }
 
   /**
@@ -198,14 +223,16 @@
     try {
       String requestName = request.method;
       if (requestName == ANALYSIS_GET_ERRORS) {
-        return getErrors(request);
+        getErrors(request);
+        return Response.DELAYED_RESPONSE;
       } else if (requestName == ANALYSIS_GET_HOVER) {
         getHover(request);
         return Response.DELAYED_RESPONSE;
       } else if (requestName == ANALYSIS_GET_LIBRARY_DEPENDENCIES) {
         return getLibraryDependencies(request);
       } else if (requestName == ANALYSIS_GET_NAVIGATION) {
-        return getNavigation(request);
+        getNavigation(request);
+        return Response.DELAYED_RESPONSE;
       } else if (requestName == ANALYSIS_GET_REACHABLE_SOURCES) {
         return getReachableSources(request);
       } else if (requestName == ANALYSIS_REANALYZE) {
diff --git a/pkg/analysis_server/lib/src/domain_completion.dart b/pkg/analysis_server/lib/src/domain_completion.dart
index 6bad443..436254e 100644
--- a/pkg/analysis_server/lib/src/domain_completion.dart
+++ b/pkg/analysis_server/lib/src/domain_completion.dart
@@ -138,7 +138,7 @@
     if (server.options.enableNewAnalysisDriver) {
       result = await server.getAnalysisResult(params.file);
 
-      if (result == null) {
+      if (result == null || !result.exists) {
         server.sendResponse(new Response.unknownSource(request));
         return;
       }
diff --git a/pkg/analysis_server/lib/src/domain_diagnostic.dart b/pkg/analysis_server/lib/src/domain_diagnostic.dart
index 1f2609c..d91aacf 100644
--- a/pkg/analysis_server/lib/src/domain_diagnostic.dart
+++ b/pkg/analysis_server/lib/src/domain_diagnostic.dart
@@ -11,6 +11,7 @@
 import 'package:analysis_server/src/analysis_server.dart';
 import 'package:analyzer/src/context/cache.dart';
 import 'package:analyzer/src/context/context.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart' as nd;
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/utilities_collection.dart';
@@ -38,15 +39,19 @@
 
   /// Answer the `diagnostic.diagnostics` request.
   Response computeDiagnostics(Request request) {
-    List<ContextData> infos = <ContextData>[];
-    for (AnalysisContext context in server.analysisContexts) {
-      infos.add(extractData(context));
+    List<ContextData> contexts = <ContextData>[];
+    if (server.options.enableNewAnalysisDriver) {
+      contexts = server.driverMap.values.map(extractDataFromDriver).toList();
+    } else {
+      for (AnalysisContext context in server.analysisContexts) {
+        contexts.add(extractDataFromContext(context));
+      }
     }
-    return new DiagnosticGetDiagnosticsResult(infos).toResponse(request.id);
+    return new DiagnosticGetDiagnosticsResult(contexts).toResponse(request.id);
   }
 
   /// Extract context data from the given [context].
-  ContextData extractData(AnalysisContext context) {
+  ContextData extractDataFromContext(AnalysisContext context) {
     int explicitFiles = 0;
     int implicitFiles = 0;
     int workItems = 0;
@@ -84,6 +89,14 @@
         workItems, exceptions.toList());
   }
 
+  /// Extract context data from the given [driver].
+  ContextData extractDataFromDriver(nd.AnalysisDriver driver) {
+    int explicitFileCount = driver.addedFiles.length;
+    int knownFileCount = driver.knownFiles.length;
+    return new ContextData(driver.name, explicitFileCount,
+        knownFileCount - explicitFileCount, driver.numberOfFilesToAnalyze, []);
+  }
+
   @override
   Response handleRequest(Request request) {
     try {
diff --git a/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart b/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart
index 42e7213..c284ee8 100644
--- a/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart
+++ b/pkg/analysis_server/lib/src/domains/analysis/implemented_dart.dart
@@ -5,7 +5,6 @@
 library domains.analysis.implemented_dart;
 
 import 'package:analysis_server/src/protocol_server.dart' as protocol;
-import 'package:analysis_server/src/services/search/hierarchy.dart';
 import 'package:analysis_server/src/services/search/search_engine.dart';
 import 'package:analyzer/dart/element/element.dart';
 
@@ -31,7 +30,7 @@
         continue;
       }
       // analyze ancestors
-      subtypes = await getSubClasses(searchEngine, type);
+      subtypes = await searchEngine.searchAllSubtypes(type);
       if (subtypes.isNotEmpty) {
         _addImplementedClass(type);
       }
diff --git a/pkg/analysis_server/lib/src/domains/analysis/navigation_dart.dart b/pkg/analysis_server/lib/src/domains/analysis/navigation_dart.dart
index 1ae3193..63f10df 100644
--- a/pkg/analysis_server/lib/src/domains/analysis/navigation_dart.dart
+++ b/pkg/analysis_server/lib/src/domains/analysis/navigation_dart.dart
@@ -15,16 +15,31 @@
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
 
-NavigationCollector computeSimpleDartNavigation(
-    NavigationCollector collector, CompilationUnit unit) {
+NavigationCollector computeDartNavigation(NavigationCollector collector,
+    CompilationUnit unit, int offset, int length) {
   _DartNavigationCollector dartCollector =
       new _DartNavigationCollector(collector);
   _DartNavigationComputerVisitor visitor =
       new _DartNavigationComputerVisitor(dartCollector);
-  unit.accept(visitor);
+  if (offset == null || length == null) {
+    unit.accept(visitor);
+  } else {
+    AstNode node = _getNodeForRange(unit, offset, length);
+    node?.accept(visitor);
+  }
   return collector;
 }
 
+AstNode _getNodeForRange(CompilationUnit unit, int offset, int length) {
+  AstNode node = new NodeLocator(offset, offset + length).searchWithin(unit);
+  for (AstNode n = node; n != null; n = n.parent) {
+    if (n is Directive) {
+      return n;
+    }
+  }
+  return node;
+}
+
 /**
  * A computer for navigation regions in a Dart [CompilationUnit].
  */
@@ -37,30 +52,10 @@
       CompilationUnit unit =
           context.getResolvedCompilationUnit2(source, libraries.first);
       if (unit != null) {
-        _DartNavigationCollector dartCollector =
-            new _DartNavigationCollector(collector);
-        _DartNavigationComputerVisitor visitor =
-            new _DartNavigationComputerVisitor(dartCollector);
-        if (offset == null || length == null) {
-          unit.accept(visitor);
-        } else {
-          AstNode node = _getNodeForRange(unit, offset, length);
-          node?.accept(visitor);
-        }
+        computeDartNavigation(collector, unit, offset, length);
       }
     }
   }
-
-  static AstNode _getNodeForRange(
-      CompilationUnit unit, int offset, int length) {
-    AstNode node = new NodeLocator(offset, offset + length).searchWithin(unit);
-    for (AstNode n = node; n != null; n = n.parent) {
-      if (n is Directive) {
-        return n;
-      }
-    }
-    return node;
-  }
 }
 
 /**
diff --git a/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart b/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart
index 9434d19..3204b2f 100644
--- a/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart
+++ b/pkg/analysis_server/lib/src/domains/analysis/occurrences_dart.dart
@@ -14,6 +14,19 @@
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
 
+void addDartOccurrences(OccurrencesCollector collector, CompilationUnit unit) {
+  _DartUnitOccurrencesComputerVisitor visitor =
+      new _DartUnitOccurrencesComputerVisitor();
+  unit.accept(visitor);
+  visitor.elementsOffsets.forEach((engineElement, offsets) {
+    int length = engineElement.nameLength;
+    protocol.Element serverElement = protocol.convertElement(engineElement);
+    protocol.Occurrences occurrences =
+        new protocol.Occurrences(serverElement, offsets, length);
+    collector.addOccurrences(occurrences);
+  });
+}
+
 /**
  * A computer for occurrences in a Dart [CompilationUnit].
  */
@@ -26,17 +39,7 @@
       CompilationUnit unit =
           context.getResolvedCompilationUnit2(source, libraries.first);
       if (unit != null) {
-        _DartUnitOccurrencesComputerVisitor visitor =
-            new _DartUnitOccurrencesComputerVisitor();
-        unit.accept(visitor);
-        visitor.elementsOffsets.forEach((engineElement, offsets) {
-          int length = engineElement.nameLength;
-          protocol.Element serverElement =
-              protocol.convertElement(engineElement);
-          protocol.Occurrences occurrences =
-              new protocol.Occurrences(serverElement, offsets, length);
-          collector.addOccurrences(occurrences);
-        });
+        addDartOccurrences(collector, unit);
       }
     }
   }
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 1cde3a7..e848fbe 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -24,6 +24,7 @@
 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
 import 'package:analysis_server/src/services/search/search_engine.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart' as engine;
 import 'package:analyzer/file_system/file_system.dart';
@@ -143,11 +144,13 @@
       AnalysisResult result = await server.getAnalysisResult(params.file);
       if (result != null) {
         CompilationUnit unit = result.unit;
+        CompilationUnitElement compilationUnitElement =
+            resolutionMap.elementDeclaredByCompilationUnit(unit);
         DartAssistContext dartAssistContext = new _DartAssistContextForValues(
-            unit.element.source,
+            compilationUnitElement.source,
             params.offset,
             params.length,
-            unit.element.context,
+            compilationUnitElement.context,
             unit);
         try {
           AssistProcessor processor = new AssistProcessor(dartAssistContext);
@@ -189,10 +192,15 @@
           int errorLine = lineInfo.getLocation(error.offset).lineNumber;
           if (errorLine == requestLine) {
             var context = new _DartFixContextImpl(
-                server.resourceProvider, unit.element.context, unit, error);
+                server.resourceProvider,
+                result.driver.getTopLevelNameDeclarations,
+                resolutionMap.elementDeclaredByCompilationUnit(unit).context,
+                unit,
+                error);
             List<Fix> fixes =
                 await new DefaultFixContributor().internalComputeFixes(context);
             if (fixes.isNotEmpty) {
+              fixes.sort(Fix.SORT_BY_RELEVANCE);
               AnalysisError serverError =
                   newAnalysisError_fromEngine(lineInfo, error);
               AnalysisErrorFixes errorFixes =
@@ -214,8 +222,11 @@
         for (engine.AnalysisError error in errorInfo.errors) {
           int errorLine = lineInfo.getLocation(error.offset).lineNumber;
           if (errorLine == requestLine) {
-            List<Fix> fixes = await computeFixes(server.serverPlugin,
-                server.resourceProvider, unit.element.context, error);
+            List<Fix> fixes = await computeFixes(
+                server.serverPlugin,
+                server.resourceProvider,
+                resolutionMap.elementDeclaredByCompilationUnit(unit).context,
+                error);
             if (fixes.isNotEmpty) {
               AnalysisError serverError =
                   newAnalysisError_fromEngine(lineInfo, error);
@@ -296,8 +307,10 @@
         return;
       }
       // prepare context
-      engine.AnalysisContext context = unit.element.context;
-      Source source = unit.element.source;
+      CompilationUnitElement compilationUnitElement =
+          resolutionMap.elementDeclaredByCompilationUnit(unit);
+      engine.AnalysisContext context = compilationUnitElement.context;
+      Source source = compilationUnitElement.source;
       errors = context.computeErrors(source);
       // prepare code
       fileStamp = context.getModificationStamp(source);
@@ -406,8 +419,8 @@
       if (element != null) {
         // try CONVERT_METHOD_TO_GETTER
         if (element is ExecutableElement) {
-          Refactoring refactoring =
-              new ConvertMethodToGetterRefactoring(searchEngine, element);
+          Refactoring refactoring = new ConvertMethodToGetterRefactoring(
+              searchEngine, _getResolvedUnit, element);
           RefactoringStatus status = await refactoring.checkInitialConditions();
           if (!status.hasFatalError) {
             kinds.add(RefactoringKind.CONVERT_METHOD_TO_GETTER);
@@ -440,11 +453,17 @@
     return Response.DELAYED_RESPONSE;
   }
 
+  Future<CompilationUnit> _getResolvedUnit(Element element) {
+    String path = element.source.fullName;
+    return server.getResolvedCompilationUnit(path);
+  }
+
   /**
    * Initializes [refactoringManager] with a new instance.
    */
   void _newRefactoringManager() {
-    refactoringManager = new _RefactoringManager(server, searchEngine);
+    refactoringManager =
+        new _RefactoringManager(server, _getResolvedUnit, searchEngine);
   }
 
   static int _getNumberOfScanParseErrors(List<engine.AnalysisError> errors) {
@@ -491,6 +510,9 @@
   final ResourceProvider resourceProvider;
 
   @override
+  final GetTopLevelDeclarations getTopLevelDeclarations;
+
+  @override
   final engine.AnalysisContext analysisContext;
 
   @override
@@ -499,8 +521,8 @@
   @override
   final engine.AnalysisError error;
 
-  _DartFixContextImpl(
-      this.resourceProvider, this.analysisContext, this.unit, this.error);
+  _DartFixContextImpl(this.resourceProvider, this.getTopLevelDeclarations,
+      this.analysisContext, this.unit, this.error);
 }
 
 /**
@@ -518,6 +540,7 @@
       const <RefactoringProblem>[];
 
   final AnalysisServer server;
+  final GetResolvedUnit getResolvedUnit;
   final SearchEngine searchEngine;
   StreamSubscription subscriptionToReset;
 
@@ -534,7 +557,7 @@
   Request request;
   EditGetRefactoringResult result;
 
-  _RefactoringManager(this.server, this.searchEngine) {
+  _RefactoringManager(this.server, this.getResolvedUnit, this.searchEngine) {
     _reset();
   }
 
@@ -726,8 +749,8 @@
       if (element != null) {
         if (element is ExecutableElement) {
           _resetOnAnalysisStarted();
-          refactoring =
-              new ConvertMethodToGetterRefactoring(searchEngine, element);
+          refactoring = new ConvertMethodToGetterRefactoring(
+              searchEngine, getResolvedUnit, element);
         }
       }
     }
@@ -763,11 +786,8 @@
       CompilationUnit unit = await server.getResolvedCompilationUnit(file);
       if (unit != null) {
         _resetOnAnalysisStarted();
-        refactoring =
-            new InlineMethodRefactoring(searchEngine, (Element element) async {
-          String elementPath = element.source.fullName;
-          return await server.getResolvedCompilationUnit(elementPath);
-        }, unit, offset);
+        refactoring = new InlineMethodRefactoring(
+            searchEngine, getResolvedUnit, unit, offset);
       }
     }
     if (kind == RefactoringKind.MOVE_FILE) {
diff --git a/pkg/analysis_server/lib/src/operation/operation_analysis.dart b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
index 0c4c85f..96d4538 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -17,6 +17,7 @@
 import 'package:analysis_server/src/services/dependencies/library_dependencies.dart';
 import 'package:analysis_server/src/services/search/search_engine.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/src/generated/engine.dart';
@@ -71,7 +72,8 @@
 void scheduleIndexOperation(
     AnalysisServer server, String file, CompilationUnit dartUnit) {
   if (server.index != null) {
-    AnalysisContext context = dartUnit.element.context;
+    AnalysisContext context =
+        resolutionMap.elementDeclaredByCompilationUnit(dartUnit).context;
     server.addOperation(new _DartIndexOperation(context, file, dartUnit));
   }
 }
@@ -133,13 +135,17 @@
 
 void sendAnalysisNotificationAnalyzedFiles(AnalysisServer server) {
   _sendNotification(server, () {
-    // TODO(paulberry): if it proves to be too inefficient to recompute the set
-    // of analyzed files each time analysis is complete, consider modifying the
-    // analysis engine to update this set incrementally as analysis is
-    // performed.
-    LibraryDependencyCollector collector =
-        new LibraryDependencyCollector(server.analysisContexts.toList());
-    Set<String> analyzedFiles = collector.collectLibraryDependencies();
+    Set<String> analyzedFiles;
+    if (server.options.enableNewAnalysisDriver) {
+      analyzedFiles = server.driverMap.values
+          .map((driver) => driver.knownFiles)
+          .expand((files) => files)
+          .toSet();
+    } else {
+      LibraryDependencyCollector collector =
+          new LibraryDependencyCollector(server.analysisContexts.toList());
+      analyzedFiles = collector.collectLibraryDependencies();
+    }
     Set<String> prevAnalyzedFiles = server.prevAnalyzedFiles;
     if (prevAnalyzedFiles != null &&
         prevAnalyzedFiles.length == analyzedFiles.length &&
@@ -165,8 +171,9 @@
     if (errors == null) {
       errors = <AnalysisError>[];
     }
-    var serverErrors =
-        protocol.doAnalysisError_listFromEngine(context, lineInfo, errors);
+    AnalysisOptions analysisOptions = context.analysisOptions;
+    var serverErrors = protocol.doAnalysisError_listFromEngine(
+        analysisOptions, lineInfo, errors);
     var params = new protocol.AnalysisErrorsParams(file, serverErrors);
     server.sendNotification(params.toNotification());
   });
diff --git a/pkg/analysis_server/lib/src/plugin/linter_plugin.dart b/pkg/analysis_server/lib/src/plugin/linter_plugin.dart
deleted file mode 100644
index 07fb54e..0000000
--- a/pkg/analysis_server/lib/src/plugin/linter_plugin.dart
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analysis_server.src.plugin.linter_plugin;
-
-import 'package:analysis_server/src/services/linter/linter.dart';
-import 'package:analyzer/plugin/options.dart';
-import 'package:plugin/plugin.dart';
-
-/// The shared linter server plugin instance.
-final LinterServerPlugin linterServerPlugin = new LinterServerPlugin();
-
-/// A plugin that defines the extension points and extensions that enhance
-/// linting in the server.
-class LinterServerPlugin implements Plugin {
-  /// The unique identifier of this plugin.
-  static const String UNIQUE_IDENTIFIER = 'linter.server';
-
-  @override
-  String get uniqueIdentifier => UNIQUE_IDENTIFIER;
-
-  @override
-  void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
-    // None.
-  }
-
-  @override
-  void registerExtensions(RegisterExtension registerExtension) {
-    //
-    // Register options validators.
-    //
-    registerExtension(
-        OPTIONS_VALIDATOR_EXTENSION_POINT_ID, new LinterRuleOptionsValidator());
-  }
-}
diff --git a/pkg/analysis_server/lib/src/protocol_server.dart b/pkg/analysis_server/lib/src/protocol_server.dart
index 3b61ade..596b873 100644
--- a/pkg/analysis_server/lib/src/protocol_server.dart
+++ b/pkg/analysis_server/lib/src/protocol_server.dart
@@ -30,12 +30,13 @@
  * errors.
  */
 List<AnalysisError> doAnalysisError_listFromEngine(
-    engine.AnalysisContext context,
+    engine.AnalysisOptions analysisOptions,
     engine.LineInfo lineInfo,
     List<engine.AnalysisError> errors) {
   List<AnalysisError> serverErrors = <AnalysisError>[];
   for (engine.AnalysisError error in errors) {
-    ErrorProcessor processor = ErrorProcessor.getProcessor(context, error);
+    ErrorProcessor processor =
+        ErrorProcessor.getProcessor(analysisOptions, error);
     if (processor != null) {
       engine.ErrorSeverity severity = processor.severity;
       // Errors with null severity are filtered out.
diff --git a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart
index bec47b4..5d226f2 100644
--- a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart
+++ b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_dart.dart
@@ -9,6 +9,7 @@
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:analysis_server/src/provisional/completion/completion_core.dart';
 import 'package:analysis_server/src/provisional/completion/dart/completion_target.dart';
+import 'package:analysis_server/src/services/completion/dart/optype.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
@@ -100,6 +101,12 @@
   DartType get objectType;
 
   /**
+   * The [OpType] which describes which types of suggestions would fit the
+   * request.
+   */
+  OpType get opType;
+
+  /**
    * Return the [SourceFactory] of the request.
    */
   SourceFactory get sourceFactory;
diff --git a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
index 9e998e0..3fde4ac 100644
--- a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
+++ b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
@@ -137,16 +137,20 @@
   /**
    * Compute the appropriate [CompletionTarget] for the given [offset] within
    * the [compilationUnit].
+   * 
+   * Optionally, start the search from within [entryPoint] instead of using
+   * the [compilationUnit], which is useful for analyzing ASTs that have no
+   * [compilationUnit] such as dart expressions within angular templates.
    */
   factory CompletionTarget.forOffset(
-      CompilationUnit compilationUnit, int offset) {
+      CompilationUnit compilationUnit, int offset, {AstNode entryPoint}) {
     // The precise algorithm is as follows.  We perform a depth-first search of
     // all edges in the parse tree (both those that point to AST nodes and
     // those that point to tokens), visiting parents before children.  The
     // first edge which points to an entity satisfying either _isCandidateToken
     // or _isCandidateNode is the completion target.  If no edge is found that
     // satisfies these two predicates, then we set the completion target entity
-    // to null and the containingNode to the compilationUnit.
+    // to null and the containingNode to the entryPoint.
     //
     // Note that if a token is not a candidate target, then none of the tokens
     // that precede it are candidate targets either.  Therefore any entity
@@ -154,7 +158,8 @@
     // prune the search to the point where no recursion is necessary; at each
     // step in the process we know exactly which child node we need to proceed
     // to.
-    AstNode containingNode = compilationUnit;
+    entryPoint ??= compilationUnit;
+    AstNode containingNode = entryPoint;
     outerLoop: while (true) {
       if (containingNode is Comment) {
         // Comments are handled specially: we descend into any CommentReference
@@ -232,13 +237,13 @@
       // the first time through the outer loop (since we only jump to the start
       // of the outer loop after determining that the completion target is
       // inside an entity).  We can check that assumption by verifying that
-      // containingNode is still the compilationUnit.
-      assert(identical(containingNode, compilationUnit));
+      // containingNode is still the entryPoint.
+      assert(identical(containingNode, entryPoint));
 
       // Since no completion target was found, we set the completion target
-      // entity to null and use the compilationUnit as the parent.
+      // entity to null and use the entryPoint as the parent.
       return new CompletionTarget._(
-          compilationUnit, offset, compilationUnit, null, false);
+          compilationUnit, offset, entryPoint, null, false);
     }
   }
 
diff --git a/pkg/analysis_server/lib/src/search/search_domain.dart b/pkg/analysis_server/lib/src/search/search_domain.dart
index 9031325..3dffbad 100644
--- a/pkg/analysis_server/lib/src/search/search_domain.dart
+++ b/pkg/analysis_server/lib/src/search/search_domain.dart
@@ -141,21 +141,15 @@
    * Implement the `search.getTypeHierarchy` request.
    */
   Future getTypeHierarchy(protocol.Request request) async {
-    if (server.options.enableNewAnalysisDriver) {
-      // TODO(scheglov) implement for the new analysis driver
-      protocol.Response response =
-          new protocol.SearchGetTypeHierarchyResult(hierarchyItems: [])
-              .toResponse(request.id);
-      server.sendResponse(response);
-      return;
-    }
     var params = new protocol.SearchGetTypeHierarchyParams.fromRequest(request);
     String file = params.file;
     // wait for analysis
-    if (params.superOnly == true) {
-      await server.onFileAnalysisComplete(file);
-    } else {
-      await server.onAnalysisComplete;
+    if (!server.options.enableNewAnalysisDriver) {
+      if (params.superOnly == true) {
+        await server.onFileAnalysisComplete(file);
+      } else {
+        await server.onAnalysisComplete;
+      }
     }
     // prepare element
     Element element = await server.getElementAtOffset(file, params.offset);
diff --git a/pkg/analysis_server/lib/src/server/driver.dart b/pkg/analysis_server/lib/src/server/driver.dart
index f813e78..072fa75 100644
--- a/pkg/analysis_server/lib/src/server/driver.dart
+++ b/pkg/analysis_server/lib/src/server/driver.dart
@@ -9,7 +9,6 @@
 import 'dart:math';
 
 import 'package:analysis_server/src/analysis_server.dart';
-import 'package:analysis_server/src/plugin/linter_plugin.dart';
 import 'package:analysis_server/src/plugin/server_plugin.dart';
 import 'package:analysis_server/src/provisional/completion/dart/completion_plugin.dart';
 import 'package:analysis_server/src/server/http_server.dart';
@@ -25,7 +24,7 @@
 import 'package:analyzer/src/generated/incremental_logger.dart';
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:args/args.dart';
-import 'package:linter/src/plugin/linter_plugin.dart';
+import 'package:linter/src/rules.dart' as linter;
 import 'package:plugin/manager.dart';
 import 'package:plugin/plugin.dart';
 
@@ -243,7 +242,7 @@
       "incremental-resolution-validation";
 
   /**
-   * The name of the option used to enable using pub summary manager.
+   * The name of the option used to enable using the new analysis driver.
    */
   static const String ENABLE_NEW_ANALYSIS_DRIVER = 'enable-new-analysis-driver';
 
@@ -276,6 +275,11 @@
   static const String INTERNAL_PRINT_TO_CONSOLE = "internal-print-to-console";
 
   /**
+   * The name of the option used to describe the new analysis driver logger.
+   */
+  static const String NEW_ANALYSIS_DRIVER_LOG = 'new-analysis-driver-log';
+
+  /**
    * The name of the flag used to disable error notifications.
    */
   static const String NO_ERROR_NOTIFICATION = "no-error-notification";
@@ -399,6 +403,8 @@
     analysisServerOptions.useAnalysisHighlight2 =
         results[USE_ANALISYS_HIGHLIGHT2];
     analysisServerOptions.fileReadMode = results[FILE_READ_MODE];
+    analysisServerOptions.newAnalysisDriverLog =
+        results[NEW_ANALYSIS_DRIVER_LOG];
 
     _initIncrementalLogger(results[INCREMENTAL_RESOLUTION_LOG]);
 
@@ -408,15 +414,12 @@
     ServerPlugin serverPlugin = new ServerPlugin();
     List<Plugin> plugins = <Plugin>[];
     plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-    plugins.add(AnalysisEngine.instance.commandLinePlugin);
-    plugins.add(AnalysisEngine.instance.optionsPlugin);
     plugins.add(serverPlugin);
-    plugins.add(linterPlugin);
-    plugins.add(linterServerPlugin);
     plugins.add(dartCompletionPlugin);
     plugins.addAll(_userDefinedPlugins);
     ExtensionManager manager = new ExtensionManager();
     manager.processPlugins(plugins);
+    linter.registerLintRules();
 
     String defaultSdkPath;
     if (results[SDK_OPTION] != null) {
@@ -559,6 +562,8 @@
         help: "enable sending `print` output to the console",
         defaultsTo: false,
         negatable: false);
+    parser.addOption(NEW_ANALYSIS_DRIVER_LOG,
+        help: "set a destination for the new analysis driver's log");
     parser.addOption(PORT_OPTION,
         help: "the http diagnostic port on which the server provides"
             " status and performance information");
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/combinator_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/combinator_contributor.dart
index 4010ece..9b2dbb1 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/combinator_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/combinator_contributor.dart
@@ -26,6 +26,9 @@
       return EMPTY_LIST;
     }
 
+    // TODO(scheglov) Not sure why we need this now.
+    await request.resolveImports();
+
     // Build list of suggestions
     var directive = node.getAncestor((parent) => parent is NamespaceDirective);
     if (directive is NamespaceDirective) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index e00ec2a..0e7a4f3 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -19,6 +19,8 @@
 import 'package:analysis_server/src/services/completion/dart/optype.dart';
 import 'package:analysis_server/src/services/search/search_engine.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
@@ -178,7 +180,8 @@
   @override
   LibraryElement get coreLib {
     if (result != null) {
-      AnalysisContext context = result.unit.element.context;
+      AnalysisContext context =
+          resolutionMap.elementDeclaredByCompilationUnit(result.unit).context;
       _coreLib = context.typeProvider.objectType.element.library;
     } else {
       Source coreUri = sourceFactory.forUri('dart:core');
@@ -189,12 +192,7 @@
 
   @override
   bool get includeIdentifiers {
-    opType; // <<< ensure _opType is initialized
-    return !_opType.isPrefixed &&
-        (_opType.includeReturnValueSuggestions ||
-            _opType.includeTypeNameSuggestions ||
-            _opType.includeVoidReturnSuggestions ||
-            _opType.includeConstructorSuggestions);
+    return opType.includeIdentifiers;
   }
 
   @override
@@ -226,7 +224,13 @@
   }
 
   @override
-  String get sourceContents => context.getContents(source)?.data;
+  String get sourceContents {
+    if (result != null) {
+      return result.content;
+    } else {
+      return context.getContents(source)?.data;
+    }
+  }
 
   @override
   SourceFactory get sourceFactory {
@@ -305,14 +309,18 @@
     if (libElem == null) {
       return null;
     }
-    _resolvedImports = <ImportElement>[];
-    for (ImportElement importElem in libElem.imports) {
-      if (importElem.importedLibrary?.exportNamespace == null) {
-        await _computeAsync(this, importElem.importedLibrary.source,
-            LIBRARY_ELEMENT4, performance, 'resolve imported library');
-        checkAborted();
+    if (result != null) {
+      _resolvedImports = libElem.imports;
+    } else {
+      _resolvedImports = <ImportElement>[];
+      for (ImportElement importElem in libElem.imports) {
+        if (importElem.importedLibrary?.exportNamespace == null) {
+          await _computeAsync(this, importElem.importedLibrary.source,
+              LIBRARY_ELEMENT4, performance, 'resolve imported library');
+          checkAborted();
+        }
+        _resolvedImports.add(importElem);
       }
-      _resolvedImports.add(importElem);
     }
     return _resolvedImports;
   }
@@ -324,7 +332,10 @@
       return _resolvedUnits;
     }
     if (result != null) {
-      _resolvedUnits = result.unit.element.library.units;
+      _resolvedUnits = resolutionMap
+          .elementDeclaredByCompilationUnit(result.unit)
+          .library
+          .units;
       return _resolvedUnits;
     }
     LibraryElement libElem = libraryElement;
@@ -395,7 +406,7 @@
     if (request.context == null) {
       unit = request.result.unit;
       // TODO(scheglov) support for parts
-      libSource = unit.element.source;
+      libSource = resolutionMap.elementDeclaredByCompilationUnit(unit).source;
     } else {
       Source source = request.source;
       AnalysisContext context = request.context;
@@ -516,7 +527,8 @@
         }
       }
       if (token is StringToken) {
-        SimpleStringLiteral uri = new SimpleStringLiteral(token, token.lexeme);
+        SimpleStringLiteral uri =
+            astFactory.simpleStringLiteral(token, token.lexeme);
         Keyword keyword = token.previous?.keyword;
         if (keyword == Keyword.IMPORT ||
             keyword == Keyword.EXPORT ||
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart
index fed6a7b..5a41099 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/inherited_reference_contributor.dart
@@ -8,10 +8,10 @@
 
 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
 import 'package:analysis_server/src/provisional/completion/dart/completion_target.dart';
-import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
 import 'package:analysis_server/src/services/completion/dart/optype.dart';
 import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 
@@ -61,35 +61,54 @@
     if (!request.includeIdentifiers) {
       return EMPTY_LIST;
     }
+
     ClassDeclaration classDecl = _enclosingClass(request.target);
     if (classDecl == null || classDecl.element == null) {
       return EMPTY_LIST;
     }
-
     containingLibrary = request.libraryElement;
+    return _computeSuggestionsForClass2(resolutionMap
+        .elementDeclaredByClassDeclaration(classDecl), request);
+  }
+
+  List<CompletionSuggestion> _computeSuggestionsForClass2(
+      ClassElement classElement, DartCompletionRequest request,
+      {bool skipChildClass: true}) {
     bool isFunctionalArgument = request.target.isFunctionalArgument();
     kind = isFunctionalArgument
         ? CompletionSuggestionKind.IDENTIFIER
         : CompletionSuggestionKind.INVOCATION;
-    OpType optype = (request as DartCompletionRequestImpl).opType;
-    for (InterfaceType type in classDecl.element.allSupertypes) {
-      if (!isFunctionalArgument) {
-        for (PropertyAccessorElement elem in type.accessors) {
-          if (elem.isGetter) {
-            if (optype.includeReturnValueSuggestions) {
-              addSuggestion(elem);
-            }
-          } else {
-            if (optype.includeVoidReturnSuggestions) {
-              addSuggestion(elem);
-            }
-          }
-        }
-      }
-      for (MethodElement elem in type.methods) {
-        if (elem.returnType == null) {
-          addSuggestion(elem);
-        } else if (!elem.returnType.isVoid) {
+    OpType optype = request.opType;
+
+    if (!skipChildClass) {
+      _addSuggestionsForType(classElement.type, optype,
+          isFunctionalArgument: isFunctionalArgument);
+    }
+
+    for (InterfaceType type in classElement.allSupertypes) {
+      _addSuggestionsForType(type, optype,
+          isFunctionalArgument: isFunctionalArgument);
+    }
+    return suggestions;
+  }
+
+  List<CompletionSuggestion> computeSuggestionsForClass(
+      ClassElement classElement, DartCompletionRequest request,
+      {bool skipChildClass: true}) {
+    if (!request.includeIdentifiers) {
+      return EMPTY_LIST;
+    }
+    containingLibrary = request.libraryElement;
+
+    return _computeSuggestionsForClass2(classElement, request,
+        skipChildClass: skipChildClass);
+  }
+
+  _addSuggestionsForType(InterfaceType type, OpType optype,
+      {bool isFunctionalArgument: false}) {
+    if (!isFunctionalArgument) {
+      for (PropertyAccessorElement elem in type.accessors) {
+        if (elem.isGetter) {
           if (optype.includeReturnValueSuggestions) {
             addSuggestion(elem);
           }
@@ -100,6 +119,18 @@
         }
       }
     }
-    return suggestions;
+    for (MethodElement elem in type.methods) {
+      if (elem.returnType == null) {
+        addSuggestion(elem);
+      } else if (!elem.returnType.isVoid) {
+        if (optype.includeReturnValueSuggestions) {
+          addSuggestion(elem);
+        }
+      } else {
+        if (optype.includeVoidReturnSuggestions) {
+          addSuggestion(elem);
+        }
+      }
+    }
   }
 }
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/label_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/label_contributor.dart
index 8600be2..774727d 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/label_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/label_contributor.dart
@@ -7,146 +7,17 @@
 import 'dart:async';
 
 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
-    show Element, ElementKind;
+    show ElementKind;
+import 'package:analysis_server/src/protocol_server.dart'
+    show CompletionSuggestion, CompletionSuggestionKind;
 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
 import 'package:analysis_server/src/services/completion/dart/completion_manager.dart'
     show DartCompletionRequestImpl;
 import 'package:analysis_server/src/services/completion/dart/local_declaration_visitor.dart'
     show LocalDeclarationVisitor;
 import 'package:analysis_server/src/services/completion/dart/optype.dart';
+import 'package:analysis_server/src/services/completion/dart/utilities.dart';
 import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/src/dart/ast/token.dart';
-import 'package:analyzer/src/generated/source.dart';
-
-import '../../../protocol_server.dart'
-    show CompletionSuggestion, CompletionSuggestionKind, Location;
-
-const DYNAMIC = 'dynamic';
-
-final TypeName NO_RETURN_TYPE = new TypeName(
-    new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), null);
-
-/**
-* Create a new protocol Element for inclusion in a completion suggestion.
-*/
-protocol.Element createLocalElement(
-    Source source, protocol.ElementKind kind, SimpleIdentifier id,
-    {String parameters,
-    TypeName returnType,
-    bool isAbstract: false,
-    bool isDeprecated: false}) {
-  String name;
-  Location location;
-  if (id != null) {
-    name = id.name;
-    // TODO(danrubel) use lineInfo to determine startLine and startColumn
-    location = new Location(source.fullName, id.offset, id.length, 0, 0);
-  } else {
-    name = '';
-    location = new Location(source.fullName, -1, 0, 1, 0);
-  }
-  int flags = protocol.Element.makeFlags(
-      isAbstract: isAbstract,
-      isDeprecated: isDeprecated,
-      isPrivate: Identifier.isPrivateName(name));
-  return new protocol.Element(kind, name, flags,
-      location: location,
-      parameters: parameters,
-      returnType: nameForType(returnType));
-}
-
-/**
-* Create a new suggestion for the given field.
-* Return the new suggestion or `null` if it could not be created.
-*/
-CompletionSuggestion createLocalFieldSuggestion(
-    Source source, FieldDeclaration fieldDecl, VariableDeclaration varDecl) {
-  bool deprecated = isDeprecated(fieldDecl) || isDeprecated(varDecl);
-  TypeName type = fieldDecl.fields.type;
-  return createLocalSuggestion(
-      varDecl.name, deprecated, DART_RELEVANCE_LOCAL_FIELD, type,
-      classDecl: fieldDecl.parent,
-      element: createLocalElement(
-          source, protocol.ElementKind.FIELD, varDecl.name,
-          returnType: type, isDeprecated: deprecated));
-}
-
-/**
-* Create a new suggestion based upon the given information.
-* Return the new suggestion or `null` if it could not be created.
-*/
-CompletionSuggestion createLocalSuggestion(SimpleIdentifier id,
-    bool isDeprecated, int defaultRelevance, TypeName returnType,
-    {ClassDeclaration classDecl, protocol.Element element}) {
-  if (id == null) {
-    return null;
-  }
-  String completion = id.name;
-  if (completion == null || completion.length <= 0 || completion == '_') {
-    return null;
-  }
-  CompletionSuggestion suggestion = new CompletionSuggestion(
-      CompletionSuggestionKind.INVOCATION,
-      isDeprecated ? DART_RELEVANCE_LOW : defaultRelevance,
-      completion,
-      completion.length,
-      0,
-      isDeprecated,
-      false,
-      returnType: nameForType(returnType),
-      element: element);
-  if (classDecl != null) {
-    SimpleIdentifier classId = classDecl.name;
-    if (classId != null) {
-      String className = classId.name;
-      if (className != null && className.length > 0) {
-        suggestion.declaringType = className;
-      }
-    }
-  }
-  return suggestion;
-}
-
-/**
-* Return `true` if the @deprecated annotation is present
-*/
-bool isDeprecated(AnnotatedNode node) {
-  if (node != null) {
-    NodeList<Annotation> metadata = node.metadata;
-    if (metadata != null) {
-      return metadata.any((Annotation a) {
-        return a.name is SimpleIdentifier && a.name.name == 'deprecated';
-      });
-    }
-  }
-  return false;
-}
-
-/**
-* Return the name for the given type.
-*/
-String nameForType(TypeName type) {
-  if (type == NO_RETURN_TYPE) {
-    return null;
-  }
-  if (type == null) {
-    return DYNAMIC;
-  }
-  Identifier id = type.name;
-  if (id == null) {
-    return DYNAMIC;
-  }
-  String name = id.name;
-  if (name == null || name.length <= 0) {
-    return DYNAMIC;
-  }
-  TypeArgumentList typeArgs = type.typeArguments;
-  if (typeArgs != null) {
-    //TODO (danrubel) include type arguments
-  }
-  return name;
-}
 
 /**
  * A contributor for calculating label suggestions.
@@ -232,7 +103,7 @@
   }
 
   @override
-  void declaredLocalVar(SimpleIdentifier name, TypeName type) {
+  void declaredLocalVar(SimpleIdentifier name, TypeAnnotation type) {
     // ignored
   }
 
@@ -242,7 +113,7 @@
   }
 
   @override
-  void declaredParam(SimpleIdentifier name, TypeName type) {
+  void declaredParam(SimpleIdentifier name, TypeAnnotation type) {
     // ignored
   }
 
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart
index 8778f6c..7b908a8 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_constructor_contributor.dart
@@ -8,6 +8,8 @@
 
 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
     show Element, ElementKind;
+import 'package:analysis_server/src/protocol_server.dart'
+    show CompletionSuggestion, CompletionSuggestionKind;
 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
 import 'package:analysis_server/src/services/completion/dart/completion_manager.dart'
     show DartCompletionRequestImpl;
@@ -15,140 +17,10 @@
     show LocalDeclarationVisitor;
 import 'package:analysis_server/src/services/completion/dart/optype.dart';
 import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
+import 'package:analysis_server/src/services/completion/dart/utilities.dart';
 import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/src/dart/ast/token.dart';
-import 'package:analyzer/src/generated/source.dart';
-
-import '../../../protocol_server.dart'
-    show CompletionSuggestion, CompletionSuggestionKind, Location;
-
-const DYNAMIC = 'dynamic';
-
-final TypeName NO_RETURN_TYPE = new TypeName(
-    new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), null);
-
-/**
-* Create a new protocol Element for inclusion in a completion suggestion.
-*/
-protocol.Element createLocalElement(
-    Source source, protocol.ElementKind kind, SimpleIdentifier id,
-    {String parameters,
-    TypeName returnType,
-    bool isAbstract: false,
-    bool isDeprecated: false}) {
-  String name;
-  Location location;
-  if (id != null) {
-    name = id.name;
-    // TODO(danrubel) use lineInfo to determine startLine and startColumn
-    location = new Location(source.fullName, id.offset, id.length, 0, 0);
-  } else {
-    name = '';
-    location = new Location(source.fullName, -1, 0, 1, 0);
-  }
-  int flags = protocol.Element.makeFlags(
-      isAbstract: isAbstract,
-      isDeprecated: isDeprecated,
-      isPrivate: Identifier.isPrivateName(name));
-  return new protocol.Element(kind, name, flags,
-      location: location,
-      parameters: parameters,
-      returnType: nameForType(returnType));
-}
-
-/**
-* Create a new suggestion for the given field.
-* Return the new suggestion or `null` if it could not be created.
-*/
-CompletionSuggestion createLocalFieldSuggestion(
-    Source source, FieldDeclaration fieldDecl, VariableDeclaration varDecl) {
-  bool deprecated = isDeprecated(fieldDecl) || isDeprecated(varDecl);
-  TypeName type = fieldDecl.fields.type;
-  return createLocalSuggestion(
-      varDecl.name, deprecated, DART_RELEVANCE_LOCAL_FIELD, type,
-      classDecl: fieldDecl.parent,
-      element: createLocalElement(
-          source, protocol.ElementKind.FIELD, varDecl.name,
-          returnType: type, isDeprecated: deprecated));
-}
-
-/**
-* Create a new suggestion based upon the given information.
-* Return the new suggestion or `null` if it could not be created.
-*/
-CompletionSuggestion createLocalSuggestion(SimpleIdentifier id,
-    bool isDeprecated, int defaultRelevance, TypeName returnType,
-    {ClassDeclaration classDecl, protocol.Element element}) {
-  if (id == null) {
-    return null;
-  }
-  String completion = id.name;
-  if (completion == null || completion.length <= 0 || completion == '_') {
-    return null;
-  }
-  CompletionSuggestion suggestion = new CompletionSuggestion(
-      CompletionSuggestionKind.INVOCATION,
-      isDeprecated ? DART_RELEVANCE_LOW : defaultRelevance,
-      completion,
-      completion.length,
-      0,
-      isDeprecated,
-      false,
-      returnType: nameForType(returnType),
-      element: element);
-  if (classDecl != null) {
-    SimpleIdentifier classId = classDecl.name;
-    if (classId != null) {
-      String className = classId.name;
-      if (className != null && className.length > 0) {
-        suggestion.declaringType = className;
-      }
-    }
-  }
-  return suggestion;
-}
-
-/**
-* Return `true` if the @deprecated annotation is present
-*/
-bool isDeprecated(AnnotatedNode node) {
-  if (node != null) {
-    NodeList<Annotation> metadata = node.metadata;
-    if (metadata != null) {
-      return metadata.any((Annotation a) {
-        return a.name is SimpleIdentifier && a.name.name == 'deprecated';
-      });
-    }
-  }
-  return false;
-}
-
-/**
-* Return the name for the given type.
-*/
-String nameForType(TypeName type) {
-  if (type == NO_RETURN_TYPE) {
-    return null;
-  }
-  if (type == null) {
-    return DYNAMIC;
-  }
-  Identifier id = type.name;
-  if (id == null) {
-    return DYNAMIC;
-  }
-  String name = id.name;
-  if (name == null || name.length <= 0) {
-    return DYNAMIC;
-  }
-  TypeArgumentList typeArgs = type.typeArguments;
-  if (typeArgs != null) {
-    //TODO (danrubel) include type arguments
-  }
-  return name;
-}
 
 /**
  * A contributor for calculating constructor suggestions
@@ -223,13 +95,13 @@
   void declaredLabel(Label label, bool isCaseLabel) {}
 
   @override
-  void declaredLocalVar(SimpleIdentifier name, TypeName type) {}
+  void declaredLocalVar(SimpleIdentifier name, TypeAnnotation type) {}
 
   @override
   void declaredMethod(MethodDeclaration declaration) {}
 
   @override
-  void declaredParam(SimpleIdentifier name, TypeName type) {}
+  void declaredParam(SimpleIdentifier name, TypeAnnotation type) {}
 
   @override
   void declaredTopLevelVar(
@@ -246,8 +118,10 @@
     String completion = classDecl.name.name;
     SimpleIdentifier elemId;
 
+    ClassElement classElement =
+        resolutionMap.elementDeclaredByClassDeclaration(classDecl);
     int relevance = optype.constructorSuggestionsFilter(
-        classDecl.element?.type, DART_RELEVANCE_DEFAULT);
+        classElement?.type, DART_RELEVANCE_DEFAULT);
     if (relevance == null) {
       return;
     }
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_declaration_visitor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_declaration_visitor.dart
index f0c2b3a..e290304 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_declaration_visitor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_declaration_visitor.dart
@@ -5,6 +5,7 @@
 library services.completion.dart.local.declaration.visitor;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/src/dart/ast/token.dart';
@@ -15,8 +16,8 @@
  * which catches the exception thrown by [finished()].
  */
 abstract class LocalDeclarationVisitor extends GeneralizingAstVisitor {
-  static final TypeName STACKTRACE_TYPE = new TypeName(
-      new SimpleIdentifier(
+  static final TypeName STACKTRACE_TYPE = astFactory.typeName(
+      astFactory.simpleIdentifier(
           new StringToken(TokenType.IDENTIFIER, 'StackTrace', 0)),
       null);
 
@@ -38,11 +39,11 @@
 
   void declaredLabel(Label label, bool isCaseLabel);
 
-  void declaredLocalVar(SimpleIdentifier name, TypeName type);
+  void declaredLocalVar(SimpleIdentifier name, TypeAnnotation type);
 
   void declaredMethod(MethodDeclaration declaration);
 
-  void declaredParam(SimpleIdentifier name, TypeName type);
+  void declaredParam(SimpleIdentifier name, TypeAnnotation type);
 
   void declaredTopLevelVar(
       VariableDeclarationList varList, VariableDeclaration varDecl);
@@ -127,7 +128,7 @@
   @override
   void visitForEachStatement(ForEachStatement node) {
     SimpleIdentifier id;
-    TypeName type;
+    TypeAnnotation type;
     DeclaredIdentifier loopVar = node.loopVariable;
     if (loopVar != null) {
       id = loopVar.identifier;
@@ -232,7 +233,7 @@
         } else if (param is NormalFormalParameter) {
           normalParam = param;
         }
-        TypeName type = null;
+        TypeAnnotation type = null;
         if (normalParam is FieldFormalParameter) {
           type = normalParam.type;
         } else if (normalParam is FunctionTypedFormalParameter) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index 70b2b44..ae66900 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -8,140 +8,24 @@
 
 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
     show Element, ElementKind;
+import 'package:analysis_server/src/protocol_server.dart'
+    show CompletionSuggestion, CompletionSuggestionKind, Location;
 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
 import 'package:analysis_server/src/services/completion/dart/completion_manager.dart'
     show DartCompletionRequestImpl;
 import 'package:analysis_server/src/services/completion/dart/local_declaration_visitor.dart'
     show LocalDeclarationVisitor;
 import 'package:analysis_server/src/services/completion/dart/optype.dart';
+import 'package:analysis_server/src/services/completion/dart/utilities.dart';
 import 'package:analysis_server/src/services/correction/strings.dart';
 import 'package:analysis_server/src/utilities/documentation.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/dart/ast/token.dart';
-import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/utilities_dart.dart' show ParameterKind;
 
-import '../../../protocol_server.dart'
-    show CompletionSuggestion, CompletionSuggestionKind, Location;
-
-const DYNAMIC = 'dynamic';
-
-final TypeName NO_RETURN_TYPE = new TypeName(
-    new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)), null);
-
-/**
-* Create a new protocol Element for inclusion in a completion suggestion.
-*/
-protocol.Element _createLocalElement(
-    Source source, protocol.ElementKind kind, SimpleIdentifier id,
-    {String parameters,
-    TypeName returnType,
-    bool isAbstract: false,
-    bool isDeprecated: false}) {
-  String name;
-  Location location;
-  if (id != null) {
-    name = id.name;
-    // TODO(danrubel) use lineInfo to determine startLine and startColumn
-    location = new Location(source.fullName, id.offset, id.length, 0, 0);
-  } else {
-    name = '';
-    location = new Location(source.fullName, -1, 0, 1, 0);
-  }
-  int flags = protocol.Element.makeFlags(
-      isAbstract: isAbstract,
-      isDeprecated: isDeprecated,
-      isPrivate: Identifier.isPrivateName(name));
-  return new protocol.Element(kind, name, flags,
-      location: location,
-      parameters: parameters,
-      returnType: _nameForType(returnType));
-}
-
-/**
-* Create a new suggestion based upon the given information.
-* Return the new suggestion or `null` if it could not be created.
-*/
-CompletionSuggestion _createLocalSuggestion(
-    SimpleIdentifier id,
-    CompletionSuggestionKind kind,
-    bool isDeprecated,
-    int defaultRelevance,
-    TypeName returnType,
-    {ClassDeclaration classDecl,
-    protocol.Element element}) {
-  if (id == null) {
-    return null;
-  }
-  String completion = id.name;
-  if (completion == null || completion.length <= 0 || completion == '_') {
-    return null;
-  }
-  CompletionSuggestion suggestion = new CompletionSuggestion(
-      kind,
-      isDeprecated ? DART_RELEVANCE_LOW : defaultRelevance,
-      completion,
-      completion.length,
-      0,
-      isDeprecated,
-      false,
-      returnType: _nameForType(returnType),
-      element: element);
-  if (classDecl != null) {
-    SimpleIdentifier classId = classDecl.name;
-    if (classId != null) {
-      String className = classId.name;
-      if (className != null && className.length > 0) {
-        suggestion.declaringType = className;
-      }
-    }
-  }
-  return suggestion;
-}
-
-/**
-* Return `true` if the @deprecated annotation is present
-*/
-bool _isDeprecated(AnnotatedNode node) {
-  if (node != null) {
-    NodeList<Annotation> metadata = node.metadata;
-    if (metadata != null) {
-      return metadata.any((Annotation a) {
-        return a.name is SimpleIdentifier && a.name.name == 'deprecated';
-      });
-    }
-  }
-  return false;
-}
-
-/**
-* Return the name for the given type.
-*/
-String _nameForType(TypeName type) {
-  if (type == NO_RETURN_TYPE) {
-    return null;
-  }
-  if (type == null) {
-    return DYNAMIC;
-  }
-  Identifier id = type.name;
-  if (id == null) {
-    return DYNAMIC;
-  }
-  String name = id.name;
-  if (name == null || name.length <= 0) {
-    return DYNAMIC;
-  }
-  TypeArgumentList typeArgs = type.typeArguments;
-  if (typeArgs != null) {
-    //TODO (danrubel) include type arguments
-  }
-  return name;
-}
-
 /**
  * A contributor for calculating suggestions for declarations in the local
  * file and containing library.
@@ -241,7 +125,7 @@
           NO_RETURN_TYPE,
           protocol.ElementKind.CLASS,
           isAbstract: declaration.isAbstract,
-          isDeprecated: _isDeprecated(declaration));
+          isDeprecated: isDeprecated(declaration));
     }
   }
 
@@ -254,7 +138,7 @@
           NO_RETURN_TYPE,
           protocol.ElementKind.CLASS_TYPE_ALIAS,
           isAbstract: true,
-          isDeprecated: _isDeprecated(declaration));
+          isDeprecated: isDeprecated(declaration));
     }
   }
 
@@ -266,12 +150,12 @@
           declaration.name,
           NO_RETURN_TYPE,
           protocol.ElementKind.ENUM,
-          isDeprecated: _isDeprecated(declaration));
+          isDeprecated: isDeprecated(declaration));
       for (EnumConstantDeclaration enumConstant in declaration.constants) {
         if (!enumConstant.isSynthetic) {
           _addLocalSuggestion_includeReturnValueSuggestions_enumConstant(
               enumConstant, declaration,
-              isDeprecated: _isDeprecated(declaration));
+              isDeprecated: isDeprecated(declaration));
         }
       }
     }
@@ -281,8 +165,8 @@
   void declaredField(FieldDeclaration fieldDecl, VariableDeclaration varDecl) {
     if (optype.includeReturnValueSuggestions &&
         (!optype.inStaticMethodBody || fieldDecl.isStatic)) {
-      bool deprecated = _isDeprecated(fieldDecl) || _isDeprecated(varDecl);
-      TypeName typeName = fieldDecl.fields.type;
+      bool deprecated = isDeprecated(fieldDecl) || isDeprecated(varDecl);
+      TypeAnnotation typeName = fieldDecl.fields.type;
       _addLocalSuggestion_includeReturnValueSuggestions(
           fieldDecl.documentationComment,
           varDecl.name,
@@ -298,7 +182,7 @@
   void declaredFunction(FunctionDeclaration declaration) {
     if (optype.includeReturnValueSuggestions ||
         optype.includeVoidReturnSuggestions) {
-      TypeName typeName = declaration.returnType;
+      TypeAnnotation typeName = declaration.returnType;
       protocol.ElementKind elemKind;
       int relevance = DART_RELEVANCE_DEFAULT;
       if (declaration.isGetter) {
@@ -323,7 +207,7 @@
           declaration.name,
           typeName,
           elemKind,
-          isDeprecated: _isDeprecated(declaration),
+          isDeprecated: isDeprecated(declaration),
           param: declaration.functionExpression.parameters,
           relevance: relevance);
     }
@@ -339,7 +223,7 @@
           declaration.returnType,
           protocol.ElementKind.FUNCTION_TYPE_ALIAS,
           isAbstract: true,
-          isDeprecated: _isDeprecated(declaration));
+          isDeprecated: isDeprecated(declaration));
     }
   }
 
@@ -349,7 +233,7 @@
   }
 
   @override
-  void declaredLocalVar(SimpleIdentifier id, TypeName typeName) {
+  void declaredLocalVar(SimpleIdentifier id, TypeAnnotation typeName) {
     if (optype.includeReturnValueSuggestions) {
       _addLocalSuggestion_includeReturnValueSuggestions(
           null, id, typeName, protocol.ElementKind.LOCAL_VARIABLE,
@@ -364,7 +248,7 @@
         (!optype.inStaticMethodBody || declaration.isStatic)) {
       protocol.ElementKind elemKind;
       FormalParameterList param;
-      TypeName typeName = declaration.returnType;
+      TypeAnnotation typeName = declaration.returnType;
       int relevance = DART_RELEVANCE_DEFAULT;
       if (declaration.isGetter) {
         elemKind = protocol.ElementKind.GETTER;
@@ -391,7 +275,7 @@
           typeName,
           elemKind,
           isAbstract: declaration.isAbstract,
-          isDeprecated: _isDeprecated(declaration),
+          isDeprecated: isDeprecated(declaration),
           classDecl: declaration.parent,
           param: param,
           relevance: relevance);
@@ -399,7 +283,7 @@
   }
 
   @override
-  void declaredParam(SimpleIdentifier id, TypeName typeName) {
+  void declaredParam(SimpleIdentifier id, TypeAnnotation typeName) {
     if (optype.includeReturnValueSuggestions) {
       _addLocalSuggestion_includeReturnValueSuggestions(
           null, id, typeName, protocol.ElementKind.PARAMETER,
@@ -416,13 +300,13 @@
           varDecl.name,
           varList.type,
           protocol.ElementKind.TOP_LEVEL_VARIABLE,
-          isDeprecated: _isDeprecated(varList) || _isDeprecated(varDecl),
+          isDeprecated: isDeprecated(varList) || isDeprecated(varDecl),
           relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
     }
   }
 
   void _addLocalSuggestion(Comment documentationComment, SimpleIdentifier id,
-      TypeName typeName, protocol.ElementKind elemKind,
+      TypeAnnotation typeName, protocol.ElementKind elemKind,
       {bool isAbstract: false,
       bool isDeprecated: false,
       ClassDeclaration classDecl,
@@ -431,9 +315,9 @@
     CompletionSuggestionKind kind = targetIsFunctionalArgument
         ? CompletionSuggestionKind.IDENTIFIER
         : optype.suggestKind;
-    CompletionSuggestion suggestion = _createLocalSuggestion(
-        id, kind, isDeprecated, relevance, typeName,
-        classDecl: classDecl);
+    CompletionSuggestion suggestion = createLocalSuggestion(
+        id, isDeprecated, relevance, typeName,
+        classDecl: classDecl, kind: kind);
     if (suggestion != null) {
       _setDocumentation(suggestion, documentationComment);
       if (privateMemberRelevance != null &&
@@ -441,7 +325,7 @@
         suggestion.relevance = privateMemberRelevance;
       }
       suggestionMap.putIfAbsent(suggestion.completion, () => suggestion);
-      suggestion.element = _createLocalElement(request.source, elemKind, id,
+      suggestion.element = createLocalElement(request.source, elemKind, id,
           isAbstract: isAbstract,
           isDeprecated: isDeprecated,
           parameters: param?.toSource(),
@@ -493,7 +377,7 @@
   void _addLocalSuggestion_includeReturnValueSuggestions(
       Comment documentationComment,
       SimpleIdentifier id,
-      TypeName typeName,
+      TypeAnnotation typeName,
       protocol.ElementKind elemKind,
       {bool isAbstract: false,
       bool isDeprecated: false,
@@ -518,8 +402,10 @@
       {bool isAbstract: false,
       bool isDeprecated: false,
       int relevance: DART_RELEVANCE_DEFAULT}) {
-    relevance = optype.returnValueSuggestionsFilter(
-        enumDeclaration.element?.type, relevance);
+    ClassElement classElement =
+        resolutionMap.elementDeclaredByEnumDeclaration(enumDeclaration);
+    relevance =
+        optype.returnValueSuggestionsFilter(classElement?.type, relevance);
     if (relevance != null) {
       _addLocalSuggestion_enumConstant(constantDeclaration, enumDeclaration,
           isAbstract: isAbstract,
@@ -531,7 +417,7 @@
   void _addLocalSuggestion_includeTypeNameSuggestions(
       Comment documentationComment,
       SimpleIdentifier id,
-      TypeName typeName,
+      TypeAnnotation typeName,
       protocol.ElementKind elemKind,
       {bool isAbstract: false,
       bool isDeprecated: false,
@@ -557,7 +443,7 @@
         .map((FormalParameter param) => param.identifier.name)
         .toList();
     suggestion.parameterTypes = paramList.map((FormalParameter param) {
-      TypeName type = null;
+      TypeAnnotation type = null;
       if (param is DefaultFormalParameter) {
         NormalFormalParameter child = param.parameter;
         if (child is SimpleFormalParameter) {
@@ -574,11 +460,15 @@
       if (type == null) {
         return 'dynamic';
       }
-      Identifier typeId = type.name;
-      if (typeId == null) {
-        return 'dynamic';
+      if (type is TypeName) {
+        Identifier typeId = type.name;
+        if (typeId == null) {
+          return 'dynamic';
+        }
+        return typeId.name;
       }
-      return typeId.name;
+      // TODO(brianwilkerson) Support function types.
+      return 'dynamic';
     }).toList();
     suggestion.requiredParameterCount = paramList
         .where((FormalParameter param) => param is! DefaultFormalParameter)
@@ -587,8 +477,8 @@
         .any((FormalParameter param) => param.kind == ParameterKind.NAMED);
   }
 
-  bool _isVoid(TypeName returnType) {
-    if (returnType != null) {
+  bool _isVoid(TypeAnnotation returnType) {
+    if (returnType is TypeName) {
       Identifier id = returnType.name;
       if (id != null && id.name == 'void') {
         return true;
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/optype.dart b/pkg/analysis_server/lib/src/services/completion/dart/optype.dart
index 132c823..c9954d5 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/optype.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/optype.dart
@@ -8,6 +8,7 @@
 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
 import 'package:analysis_server/src/provisional/completion/dart/completion_target.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -125,6 +126,17 @@
   OpType._();
 
   /**
+   * Return `true` if free standing identifiers should be suggested
+   */
+  bool get includeIdentifiers {
+    return !isPrefixed &&
+        (includeReturnValueSuggestions ||
+            includeTypeNameSuggestions ||
+            includeVoidReturnSuggestions ||
+            includeConstructorSuggestions);
+  }
+
+  /**
    * Indicate whether only type names should be suggested
    */
   bool get includeOnlyNamedArgumentSuggestions =>
@@ -567,7 +579,9 @@
         if (node.parent is VariableDeclaration) {
           VariableDeclaration varDeclaration =
               node.parent as VariableDeclaration;
-          localTypeAssertion = varDeclaration.element?.type;
+          localTypeAssertion = resolutionMap
+              .elementDeclaredByVariableDeclaration(varDeclaration)
+              ?.type;
         } else if (node.parent is AssignmentExpression) {
           AssignmentExpression assignmentExpression =
               node.parent as AssignmentExpression;
@@ -653,7 +667,7 @@
     if (identical(entity, node.expression)) {
       optype.includeReturnValueSuggestions = true;
       optype.returnValueSuggestionsFilter = (DartType dartType, int relevance) {
-        DartType type = node.element?.type;
+        DartType type = resolutionMap.elementForNamedExpression(node)?.type;
         bool isEnum = type != null &&
             type.element is ClassElement &&
             (type.element as ClassElement).isEnum;
@@ -831,9 +845,9 @@
 
   @override
   void visitTypeArgumentList(TypeArgumentList node) {
-    NodeList<TypeName> arguments = node.arguments;
-    for (TypeName typeName in arguments) {
-      if (identical(entity, typeName)) {
+    NodeList<TypeAnnotation> arguments = node.arguments;
+    for (TypeAnnotation type in arguments) {
+      if (identical(entity, type)) {
         optype.includeTypeNameSuggestions = true;
         break;
       }
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
index d535ef4..1921bfa 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/type_member_contributor.dart
@@ -161,7 +161,7 @@
   @override
   void declaredFunction(FunctionDeclaration declaration) {
     if (declaration.name.name == targetName) {
-      TypeName typeName = declaration.returnType;
+      TypeAnnotation typeName = declaration.returnType;
       if (typeName != null) {
         typeFound = typeName.type;
       }
@@ -172,7 +172,7 @@
   @override
   void declaredFunctionTypeAlias(FunctionTypeAlias declaration) {
     if (declaration.name.name == targetName) {
-      TypeName typeName = declaration.returnType;
+      TypeAnnotation typeName = declaration.returnType;
       if (typeName != null) {
         typeFound = typeName.type;
       }
@@ -189,7 +189,7 @@
   }
 
   @override
-  void declaredLocalVar(SimpleIdentifier name, TypeName type) {
+  void declaredLocalVar(SimpleIdentifier name, TypeAnnotation type) {
     if (name.name == targetName) {
       typeFound = name.bestType;
       finished();
@@ -199,7 +199,7 @@
   @override
   void declaredMethod(MethodDeclaration declaration) {
     if (declaration.name.name == targetName) {
-      TypeName typeName = declaration.returnType;
+      TypeAnnotation typeName = declaration.returnType;
       if (typeName != null) {
         typeFound = typeName.type;
       }
@@ -208,7 +208,7 @@
   }
 
   @override
-  void declaredParam(SimpleIdentifier name, TypeName type) {
+  void declaredParam(SimpleIdentifier name, TypeAnnotation type) {
     if (name.name == targetName) {
       // Type provided by the element in computeFull above
       finished();
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
new file mode 100644
index 0000000..a3ec936
--- /dev/null
+++ b/pkg/analysis_server/lib/src/services/completion/dart/utilities.dart
@@ -0,0 +1,157 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * A collection of utility methods used by completion contributors.
+ */
+import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
+    show Element, ElementKind;
+import 'package:analysis_server/src/protocol_server.dart'
+    show CompletionSuggestion, CompletionSuggestionKind, Location;
+import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/src/dart/ast/token.dart';
+import 'package:analyzer/src/generated/source.dart';
+
+/**
+ * The name of the type `dynamic`;
+ */
+const DYNAMIC = 'dynamic';
+
+/**
+ * A marker used in place of `null` when a function has no return type.
+ */
+final TypeName NO_RETURN_TYPE = astFactory.typeName(
+    astFactory.simpleIdentifier(new StringToken(TokenType.IDENTIFIER, '', 0)),
+    null);
+
+/**
+ * Create a new protocol Element for inclusion in a completion suggestion.
+ */
+protocol.Element createLocalElement(
+    Source source, protocol.ElementKind kind, SimpleIdentifier id,
+    {String parameters,
+    TypeAnnotation returnType,
+    bool isAbstract: false,
+    bool isDeprecated: false}) {
+  String name;
+  Location location;
+  if (id != null) {
+    name = id.name;
+    // TODO(danrubel) use lineInfo to determine startLine and startColumn
+    location = new Location(source.fullName, id.offset, id.length, 0, 0);
+  } else {
+    name = '';
+    location = new Location(source.fullName, -1, 0, 1, 0);
+  }
+  int flags = protocol.Element.makeFlags(
+      isAbstract: isAbstract,
+      isDeprecated: isDeprecated,
+      isPrivate: Identifier.isPrivateName(name));
+  return new protocol.Element(kind, name, flags,
+      location: location,
+      parameters: parameters,
+      returnType: nameForType(returnType));
+}
+
+/**
+ * Create a new suggestion for the given [fieldDecl]. Return the new suggestion
+ * or `null` if it could not be created.
+ */
+CompletionSuggestion createLocalFieldSuggestion(
+    Source source, FieldDeclaration fieldDecl, VariableDeclaration varDecl) {
+  bool deprecated = isDeprecated(fieldDecl) || isDeprecated(varDecl);
+  TypeAnnotation type = fieldDecl.fields.type;
+  return createLocalSuggestion(
+      varDecl.name, deprecated, DART_RELEVANCE_LOCAL_FIELD, type,
+      classDecl: fieldDecl.parent,
+      element: createLocalElement(
+          source, protocol.ElementKind.FIELD, varDecl.name,
+          returnType: type, isDeprecated: deprecated));
+}
+
+/**
+ * Create a new suggestion based upon the given information. Return the new
+ * suggestion or `null` if it could not be created.
+ */
+CompletionSuggestion createLocalSuggestion(SimpleIdentifier id,
+    bool isDeprecated, int defaultRelevance, TypeAnnotation returnType,
+    {ClassDeclaration classDecl,
+    CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION,
+    protocol.Element element}) {
+  if (id == null) {
+    return null;
+  }
+  String completion = id.name;
+  if (completion == null || completion.length <= 0 || completion == '_') {
+    return null;
+  }
+  CompletionSuggestion suggestion = new CompletionSuggestion(
+      kind,
+      isDeprecated ? DART_RELEVANCE_LOW : defaultRelevance,
+      completion,
+      completion.length,
+      0,
+      isDeprecated,
+      false,
+      returnType: nameForType(returnType),
+      element: element);
+  if (classDecl != null) {
+    SimpleIdentifier classId = classDecl.name;
+    if (classId != null) {
+      String className = classId.name;
+      if (className != null && className.length > 0) {
+        suggestion.declaringType = className;
+      }
+    }
+  }
+  return suggestion;
+}
+
+/**
+ * Return `true` if the @deprecated annotation is present on the given [node].
+ */
+bool isDeprecated(AnnotatedNode node) {
+  if (node != null) {
+    NodeList<Annotation> metadata = node.metadata;
+    if (metadata != null) {
+      return metadata.any((Annotation a) {
+        return a.name is SimpleIdentifier && a.name.name == 'deprecated';
+      });
+    }
+  }
+  return false;
+}
+
+/**
+ * Return the name for the given [type].
+ */
+String nameForType(TypeAnnotation type) {
+  if (type == NO_RETURN_TYPE) {
+    return null;
+  }
+  if (type == null) {
+    return DYNAMIC;
+  }
+  if (type is TypeName) {
+    Identifier id = type.name;
+    if (id == null) {
+      return DYNAMIC;
+    }
+    String name = id.name;
+    if (name == null || name.length <= 0) {
+      return DYNAMIC;
+    }
+    TypeArgumentList typeArgs = type.typeArguments;
+    if (typeArgs != null) {
+      //TODO (danrubel) include type arguments
+    }
+    return name;
+  } else if (type is GenericFunctionType) {
+    // TODO(brianwilkerson) Implement this.
+  }
+  return DYNAMIC;
+}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
index 2c4d913..98b7f4b 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/variable_name_contributor.dart
@@ -56,7 +56,10 @@
           strName = _getStringName(node.expression as Identifier);
         }
       } else if (node is VariableDeclarationList) {
-        strName = _getStringName(node.type.name);
+        TypeAnnotation typeAnnotation = node.type;
+        if (typeAnnotation is TypeName) {
+          strName = _getStringName(typeAnnotation.name);
+        }
       } else if (node is TopLevelVariableDeclaration) {
         // The parser parses 'Foo ' and 'Foo ;' differently, resulting in the
         // following.
@@ -64,8 +67,11 @@
         // 'Foo ;': TopLevelVariableDeclaration with type null, and a first
         // variable of 'Foo'
         VariableDeclarationList varDeclarationList = node.variables;
-        if (varDeclarationList.type != null) {
-          strName = _getStringName(varDeclarationList.type.name);
+        TypeAnnotation typeAnnotation = varDeclarationList.type;
+        if (typeAnnotation != null) {
+          if (typeAnnotation is TypeName) {
+            strName = _getStringName(typeAnnotation.name);
+          }
         } else {
           NodeList<VariableDeclaration> varDeclarations =
               varDeclarationList.variables;
diff --git a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
index 9899681..c92920d 100644
--- a/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/assist_internal.dart
@@ -18,6 +18,7 @@
 import 'package:analysis_server/src/services/correction/util.dart';
 import 'package:analysis_server/src/services/search/hierarchy.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -72,7 +73,9 @@
     unit = dartContext.unit;
     unitElement = dartContext.unit.element;
     // library
-    unitLibraryElement = dartContext.unit.element.library;
+    unitLibraryElement = resolutionMap
+        .elementDeclaredByCompilationUnit(dartContext.unit)
+        .library;
     unitLibraryFile = unitLibraryElement.source.fullName;
     unitLibraryFolder = dirname(unitLibraryFile);
     // selection
@@ -233,7 +236,7 @@
     DartType type = declaredIdentifier.identifier.bestType;
     if (type is InterfaceType || type is FunctionType) {
       _configureTargetLocation(node);
-      Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+      Set<Source> librariesToImport = new Set<Source>();
       typeSource = utils.getTypeSource(type, librariesToImport);
       addLibraryImports(change, unitLibraryElement, librariesToImport);
     } else {
@@ -285,7 +288,7 @@
     String typeSource;
     {
       _configureTargetLocation(node);
-      Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+      Set<Source> librariesToImport = new Set<Source>();
       typeSource = utils.getTypeSource(type, librariesToImport);
       addLibraryImports(change, unitLibraryElement, librariesToImport);
     }
@@ -335,9 +338,9 @@
     DartType type = initializer.bestType;
     // prepare type source
     String typeSource;
-    if (type is InterfaceType || type is FunctionType) {
+    if (type is InterfaceType && !type.isDartCoreNull || type is FunctionType) {
       _configureTargetLocation(node);
-      Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+      Set<Source> librariesToImport = new Set<Source>();
       typeSource = utils.getTypeSource(type, librariesToImport);
       addLibraryImports(change, unitLibraryElement, librariesToImport);
     } else {
@@ -502,7 +505,9 @@
         getter = n;
         break;
       }
-      if (n is SimpleIdentifier || n is TypeName || n is TypeArgumentList) {
+      if (n is SimpleIdentifier ||
+          n is TypeAnnotation ||
+          n is TypeArgumentList) {
         continue;
       }
       break;
@@ -568,7 +573,7 @@
       if (n is SimpleIdentifier ||
           n is VariableDeclaration ||
           n is VariableDeclarationList ||
-          n is TypeName ||
+          n is TypeAnnotation ||
           n is TypeArgumentList) {
         continue;
       }
@@ -1002,7 +1007,7 @@
       String name = (node as SimpleIdentifier).name;
       // prepare type
       DartType type = parameterElement.type;
-      Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+      Set<Source> librariesToImport = new Set<Source>();
       String typeCode = utils.getTypeSource(type, librariesToImport);
       // replace parameter
       if (type.isDynamic) {
@@ -1561,7 +1566,7 @@
       return;
     }
     // we need a type
-    TypeName typeNode = declarationList.type;
+    TypeAnnotation typeNode = declarationList.type;
     if (typeNode == null) {
       _coverageMarker();
       return;
diff --git a/pkg/analysis_server/lib/src/services/correction/fix.dart b/pkg/analysis_server/lib/src/services/correction/fix.dart
index 0d49cf4..124621e 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix.dart
@@ -126,8 +126,6 @@
   static const ADD_NE_NULL = const FixKind('ADD_NE_NULL', 50, "Add != null");
   static const ADD_PACKAGE_DEPENDENCY = const FixKind(
       'ADD_PACKAGE_DEPENDENCY', 50, "Add dependency on package '{0}'");
-  static const ADD_PART_OF =
-      const FixKind('ADD_PART_OF', 50, "Add 'part of' directive");
   static const ADD_SUPER_CONSTRUCTOR_INVOCATION = const FixKind(
       'ADD_SUPER_CONSTRUCTOR_INVOCATION',
       50,
@@ -209,8 +207,6 @@
       const FixKind('REMOVE_UNUSED_IMPORT', 50, "Remove unused import");
   static const REPLACE_BOOLEAN_WITH_BOOL = const FixKind(
       'REPLACE_BOOLEAN_WITH_BOOL', 50, "Replace 'boolean' with 'bool'");
-  static const REPLACE_IMPORT_URI =
-      const FixKind('REPLACE_IMPORT_URI', 50, "Replace with '{0}'");
   static const REPLACE_VAR_WITH_DYNAMIC = const FixKind(
       'REPLACE_VAR_WITH_DYNAMIC', 50, "Replace 'var' with 'dynamic'");
   static const REPLACE_RETURN_TYPE_FUTURE = const FixKind(
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 76ee0e1..dc59c71 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -25,18 +25,22 @@
 import 'package:analysis_server/src/services/correction/util.dart';
 import 'package:analysis_server/src/services/search/hierarchy.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
 import 'package:analyzer/src/dart/ast/token.dart';
 import 'package:analyzer/src/dart/ast/utilities.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/member.dart';
 import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/dart/resolver/inheritance_manager.dart';
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/error_verifier.dart';
 import 'package:analyzer/src/generated/java_core.dart';
 import 'package:analyzer/src/generated/parser.dart';
 import 'package:analyzer/src/generated/sdk.dart';
@@ -56,12 +60,12 @@
  * Clients may not extend, implement or mix-in this class.
  */
 class DartFixContextImpl extends FixContextImpl implements DartFixContext {
-  /**
-   * The [CompilationUnit] to compute fixes in.
-   */
+  final GetTopLevelDeclarations getTopLevelDeclarations;
   final CompilationUnit unit;
 
-  DartFixContextImpl(FixContext fixContext, this.unit) : super.from(fixContext);
+  DartFixContextImpl(
+      FixContext fixContext, this.getTopLevelDeclarations, this.unit)
+      : super.from(fixContext);
 }
 
 /**
@@ -86,6 +90,7 @@
   static const int MAX_LEVENSHTEIN_DISTANCE = 3;
 
   ResourceProvider resourceProvider;
+  GetTopLevelDeclarations getTopLevelDeclarations;
   CompilationUnit unit;
   AnalysisError error;
   AnalysisContext context;
@@ -103,7 +108,7 @@
   final LinkedHashMap<String, LinkedEditGroup> linkedPositionGroups =
       new LinkedHashMap<String, LinkedEditGroup>();
   Position exitPosition = null;
-  Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+  Set<Source> librariesToImport = new Set<Source>();
 
   CorrectionUtils utils;
   int errorOffset;
@@ -115,6 +120,7 @@
 
   FixProcessor(DartFixContext dartContext) {
     resourceProvider = dartContext.resourceProvider;
+    getTopLevelDeclarations = dartContext.getTopLevelDeclarations;
     context = dartContext.analysisContext;
     // unit
     unit = dartContext.unit;
@@ -177,9 +183,9 @@
         if (name != null && name.staticElement == null) {
           node = name;
           if (annotation.arguments == null) {
-            _addFix_importLibrary_withTopLevelVariable();
+            await _addFix_importLibrary_withTopLevelVariable();
           } else {
-            _addFix_importLibrary_withType();
+            await _addFix_importLibrary_withType();
             _addFix_createClass();
             _addFix_undefinedClass_useSimilar();
           }
@@ -194,9 +200,6 @@
         CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT) {
       _addFix_createConstructorSuperImplicit();
     }
-    if (errorCode == CompileTimeErrorCode.PART_OF_NON_PART) {
-      _addFix_addPartOfDirective();
-    }
     if (errorCode ==
         CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT) {
       _addFix_createConstructorSuperExplicit();
@@ -204,10 +207,6 @@
     if (errorCode == CompileTimeErrorCode.URI_DOES_NOT_EXIST) {
       _addFix_createImportUri();
       _addFix_createPartUri();
-      _addFix_replaceImportUri();
-    }
-    if (errorCode == CompileTimeErrorCode.URI_HAS_NOT_BEEN_GENERATED) {
-      _addFix_replaceImportUri();
     }
     if (errorCode == HintCode.CAN_BE_NULL_AFTER_NULL_AWARE) {
       _addFix_canBeNullAfterNullAware();
@@ -287,20 +286,13 @@
       _addFix_makeEnclosingClassAbstract();
       _addFix_createNoSuchMethod();
       // implement methods
-      // TODO(scheglov) Fix another way to get unimplemented methods.
-      // AnalysisErrorWithProperties does not work with the new analysis driver.
-      if (error is AnalysisErrorWithProperties) {
-        AnalysisErrorWithProperties errorWithProperties =
-            error as AnalysisErrorWithProperties;
-        List<ExecutableElement> missingOverrides = errorWithProperties
-            .getProperty(ErrorProperty.UNIMPLEMENTED_METHODS);
-        _addFix_createMissingOverrides(missingOverrides);
-      }
+      _addFix_createMissingOverrides();
     }
-    if (errorCode == StaticWarningCode.CAST_TO_NON_TYPE ||
+    if (errorCode == CompileTimeErrorCode.UNDEFINED_CLASS ||
+        errorCode == StaticWarningCode.CAST_TO_NON_TYPE ||
         errorCode == StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME ||
         errorCode == StaticWarningCode.UNDEFINED_CLASS) {
-      _addFix_importLibrary_withType();
+      await _addFix_importLibrary_withType();
       _addFix_createClass();
       _addFix_undefinedClass_useSimilar();
     }
@@ -319,8 +311,8 @@
       _addFix_createField();
       _addFix_createGetter();
       _addFix_createFunction_forFunctionType();
-      _addFix_importLibrary_withType();
-      _addFix_importLibrary_withTopLevelVariable();
+      await _addFix_importLibrary_withType();
+      await _addFix_importLibrary_withTopLevelVariable();
       _addFix_createLocalVariable();
     }
     if (errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT) {
@@ -343,11 +335,11 @@
       _addFix_nonBoolCondition_addNotNull();
     }
     if (errorCode == StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT) {
-      _addFix_importLibrary_withType();
+      await _addFix_importLibrary_withType();
       _addFix_createClass();
     }
     if (errorCode == StaticTypeWarningCode.UNDEFINED_FUNCTION) {
-      _addFix_importLibrary_withFunction();
+      await _addFix_importLibrary_withFunction();
       _addFix_undefinedFunction_useSimilar();
       _addFix_undefinedFunction_create();
     }
@@ -359,7 +351,7 @@
     }
     if (errorCode == HintCode.UNDEFINED_METHOD ||
         errorCode == StaticTypeWarningCode.UNDEFINED_METHOD) {
-      _addFix_importLibrary_withFunction();
+      await _addFix_importLibrary_withFunction();
       _addFix_undefinedMethod_useSimilar();
       _addFix_undefinedMethod_create();
       _addFix_undefinedFunction_create();
@@ -495,9 +487,17 @@
           AstNode targetNode = targetElement.computeNode();
           if (targetNode is FunctionDeclaration) {
             FunctionExpression function = targetNode.functionExpression;
-            targetOffset = function.parameters.leftParenthesis.end;
+            Token paren = function.parameters.leftParenthesis;
+            if (paren == null) {
+              return;
+            }
+            targetOffset = paren.end;
           } else if (targetNode is MethodDeclaration) {
-            targetOffset = targetNode.parameters.leftParenthesis.end;
+            Token paren = targetNode.parameters.leftParenthesis;
+            if (paren == null) {
+              return;
+            }
+            targetOffset = paren.end;
           } else {
             return;
           }
@@ -538,26 +538,6 @@
     }
   }
 
-  void _addFix_addPartOfDirective() {
-    // TODO(brianwilkerson) Generalize this to allow other valid string literals.
-    if (node is SimpleStringLiteral && node.parent is PartDirective) {
-      PartDirective directive = node.parent;
-      Source partSource = directive.uriSource;
-      CompilationUnit partUnit;
-      partUnit = context.getResolvedCompilationUnit2(partSource, partSource);
-      if (partUnit != null) {
-        CorrectionUtils partUtils = new CorrectionUtils(partUnit);
-        CorrectionUtils_InsertDesc desc = partUtils.getInsertDescTop();
-        String libraryName = unitLibraryElement.name;
-        _addInsertEdit(
-            desc.offset,
-            '${desc.prefix}part of $libraryName;$eol${desc.suffix}',
-            partUnit.element);
-        _addFix(DartFixKind.ADD_PART_OF, []);
-      }
-    }
-  }
-
   void _addFix_boolInsteadOfBoolean() {
     SourceRange range = rf.rangeError(error);
     _addReplaceEdit(range, 'bool');
@@ -590,7 +570,7 @@
       AstNode variableList = declaration.parent;
       if (variableList is VariableDeclarationList &&
           variableList.variables.length == 1) {
-        TypeName typeNode = variableList.type;
+        TypeAnnotation typeNode = variableList.type;
         if (typeNode != null) {
           Expression initializer = coveredNode;
           DartType newType = initializer.bestType;
@@ -599,7 +579,7 @@
                 utils.getTypeSource(newType, librariesToImport);
             _addReplaceEdit(rf.rangeNode(typeNode), newTypeSource);
             _addFix(DartFixKind.CHANGE_TYPE_ANNOTATION,
-                [typeNode.type.displayName, newTypeSource]);
+                [resolutionMap.typeForTypeName(typeNode), newTypeSource]);
           }
         }
       }
@@ -1031,6 +1011,9 @@
       }
       staticModifier = _inStaticContext();
     }
+    if (targetClassElement.librarySource.isInSystemLibrary) {
+      return;
+    }
     utils.targetClassElement = targetClassElement;
     // prepare target ClassDeclaration
     AstNode targetTypeNode = getParsedClassElementNode(targetClassElement);
@@ -1164,6 +1147,9 @@
       }
       staticModifier = _inStaticContext();
     }
+    if (targetClassElement.librarySource.isInSystemLibrary) {
+      return;
+    }
     utils.targetClassElement = targetClassElement;
     // prepare target ClassDeclaration
     AstNode targetTypeNode = getParsedClassElementNode(targetClassElement);
@@ -1279,9 +1265,19 @@
     _addFix(DartFixKind.CREATE_LOCAL_VARIABLE, [name]);
   }
 
-  void _addFix_createMissingOverrides(List<ExecutableElement> elements) {
-    elements = elements.toList();
-    int numElements = elements.length;
+  void _addFix_createMissingOverrides() {
+    // prepare target
+    ClassDeclaration targetClass = node.parent as ClassDeclaration;
+    ClassElement targetClassElement = targetClass.element;
+    utils.targetClassElement = targetClassElement;
+    List<ExecutableElement> elements = ErrorVerifier
+        .computeMissingOverrides(
+            context.analysisOptions.strongMode,
+            context.typeProvider,
+            context.typeSystem,
+            new InheritanceManager(unitLibraryElement),
+            targetClassElement)
+        .toList();
     // sort by name, getters before setters
     elements.sort((Element a, Element b) {
       int names = compareStrings(a.displayName, b.displayName);
@@ -1293,9 +1289,6 @@
       }
       return 1;
     });
-    // prepare target
-    ClassDeclaration targetClass = node.parent as ClassDeclaration;
-    utils.targetClassElement = targetClass.element;
     // prepare SourceBuilder
     int insertOffset = targetClass.end - 1;
     SourceBuilder sb = new SourceBuilder(file, insertOffset);
@@ -1310,6 +1303,7 @@
 
     // merge getter/setter pairs into fields
     String prefix = utils.getIndent(1);
+    int numElements = elements.length;
     for (int i = 0; i < elements.length; i++) {
       ExecutableElement element = elements[i];
       if (element.kind == ElementKind.GETTER && i + 1 < elements.length) {
@@ -1350,6 +1344,7 @@
 
   void _addFix_createMissingOverrides_single(SourceBuilder sb,
       ClassDeclaration targetClass, ExecutableElement element) {
+    utils.targetExecutableElement = element;
     // prepare environment
     String prefix = utils.getIndent(1);
     String prefix2 = utils.getIndent(2);
@@ -1385,6 +1380,7 @@
     }
     // name
     sb.append(element.displayName);
+    _appendTypeParameters(sb, element.typeParameters);
     // parameters + body
     if (isGetter) {
       sb.append(' => null;');
@@ -1402,6 +1398,7 @@
       sb.append('}');
     }
     sb.append(eol);
+    utils.targetExecutableElement = null;
   }
 
   void _addFix_createNoSuchMethod() {
@@ -1445,20 +1442,20 @@
 
   void _addFix_illegalAsyncReturnType() {
     // prepare the existing type
-    TypeName typeName = node.getAncestor((n) => n is TypeName);
+    TypeAnnotation typeName = node.getAncestor((n) => n is TypeAnnotation);
     _replaceTypeWithFuture(typeName);
     // add proposal
     _addFix(DartFixKind.REPLACE_RETURN_TYPE_FUTURE, []);
   }
 
-  void _addFix_importLibrary(FixKind kind, LibraryElement libraryElement) {
-    librariesToImport.add(libraryElement);
-    Source librarySource = libraryElement.source;
-    String libraryUri = getLibrarySourceUri(unitLibraryElement, librarySource);
+  void _addFix_importLibrary(FixKind kind, Source library) {
+    librariesToImport.add(library);
+    String libraryUri = getLibrarySourceUri(unitLibraryElement, library);
     _addFix(kind, [libraryUri], importsOnly: true);
   }
 
-  void _addFix_importLibrary_withElement(String name, ElementKind kind) {
+  Future<Null> _addFix_importLibrary_withElement(String name,
+      List<ElementKind> elementKinds, TopLevelDeclarationKind kind2) async {
     // ignore if private
     if (name.startsWith('_')) {
       return;
@@ -1476,7 +1473,7 @@
       if (element is PropertyAccessorElement) {
         element = (element as PropertyAccessorElement).variable;
       }
-      if (element.kind != kind) {
+      if (!elementKinds.contains(element.kind)) {
         continue;
       }
       // may be apply prefix
@@ -1538,50 +1535,37 @@
         if (element is PropertyAccessorElement) {
           element = (element as PropertyAccessorElement).variable;
         }
-        if (element.kind != kind) {
+        if (!elementKinds.contains(element.kind)) {
           continue;
         }
         // add import
-        _addFix_importLibrary(DartFixKind.IMPORT_LIBRARY_SDK, libraryElement);
+        _addFix_importLibrary(
+            DartFixKind.IMPORT_LIBRARY_SDK, libraryElement.source);
       }
     }
     // check project libraries
     {
-      List<Source> librarySources = context.librarySources;
-      for (Source librarySource in librarySources) {
-        // we don't need SDK libraries here
+      List<TopLevelDeclarationInSource> declarations =
+          await getTopLevelDeclarations(name);
+      for (TopLevelDeclarationInSource declaration in declarations) {
+        // Check the kind.
+        if (declaration.declaration.kind != kind2) {
+          continue;
+        }
+        // Check the source.
+        Source librarySource = declaration.source;
         if (librarySource.isInSystemLibrary) {
           continue;
         }
-        // maybe already imported
         if (alreadyImportedWithPrefix.contains(librarySource)) {
           continue;
         }
-        // prepare LibraryElement
-        LibraryElement libraryElement =
-            context.getResult(librarySource, LIBRARY_ELEMENT4);
-        if (libraryElement == null) {
-          continue;
-        }
-        // prepare exported Element
-        Element element = getExportedElement(libraryElement, name);
-        if (element == null) {
-          continue;
-        }
-        if (element is PropertyAccessorElement) {
-          element = (element as PropertyAccessorElement).variable;
-        }
-        if (element.kind != kind) {
-          continue;
-        }
         // Compute the fix kind.
         FixKind fixKind;
-        if (resourceProvider.pathContext
-            .split(librarySource.fullName)
-            .contains('src')) {
+        if (_isLibSrcPath(librarySource.fullName)) {
           // Bad: non-API.
           fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT3;
-        } else if (element.library != libraryElement) {
+        } else if (declaration.isExported) {
           // Ugly: exports.
           fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT2;
         } else {
@@ -1589,34 +1573,39 @@
           fixKind = DartFixKind.IMPORT_LIBRARY_PROJECT1;
         }
         // Add the fix.
-        _addFix_importLibrary(fixKind, libraryElement);
+        _addFix_importLibrary(fixKind, librarySource);
       }
     }
   }
 
-  void _addFix_importLibrary_withFunction() {
+  Future<Null> _addFix_importLibrary_withFunction() async {
     if (node is SimpleIdentifier && node.parent is MethodInvocation) {
       MethodInvocation invocation = node.parent as MethodInvocation;
       if (invocation.realTarget == null && invocation.methodName == node) {
         String name = (node as SimpleIdentifier).name;
-        _addFix_importLibrary_withElement(name, ElementKind.FUNCTION);
+        await _addFix_importLibrary_withElement(name,
+            const [ElementKind.FUNCTION], TopLevelDeclarationKind.function);
       }
     }
   }
 
-  void _addFix_importLibrary_withTopLevelVariable() {
+  Future<Null> _addFix_importLibrary_withTopLevelVariable() async {
     if (node is SimpleIdentifier) {
       String name = (node as SimpleIdentifier).name;
-      _addFix_importLibrary_withElement(name, ElementKind.TOP_LEVEL_VARIABLE);
+      await _addFix_importLibrary_withElement(
+          name,
+          const [ElementKind.TOP_LEVEL_VARIABLE],
+          TopLevelDeclarationKind.variable);
     }
   }
 
-  void _addFix_importLibrary_withType() {
+  Future<Null> _addFix_importLibrary_withType() async {
     if (_mayBeTypeIdentifier(node)) {
       String typeName = (node as SimpleIdentifier).name;
-      _addFix_importLibrary_withElement(typeName, ElementKind.CLASS);
-      _addFix_importLibrary_withElement(
-          typeName, ElementKind.FUNCTION_TYPE_ALIAS);
+      await _addFix_importLibrary_withElement(
+          typeName,
+          const [ElementKind.CLASS, ElementKind.FUNCTION_TYPE_ALIAS],
+          TopLevelDeclarationKind.type);
     }
   }
 
@@ -1652,6 +1641,9 @@
   void _addFix_makeEnclosingClassAbstract() {
     ClassDeclaration enclosingClass =
         node.getAncestor((node) => node is ClassDeclaration);
+    if (enclosingClass == null) {
+      return;
+    }
     String className = enclosingClass.name.name;
     _addInsertEdit(enclosingClass.classKeyword.offset, 'abstract ');
     _addFix(DartFixKind.MAKE_CLASS_ABSTRACT, [className]);
@@ -1801,32 +1793,6 @@
     _addFix(DartFixKind.REMOVE_UNUSED_IMPORT, []);
   }
 
-  void _addFix_replaceImportUri() {
-    if (node is SimpleStringLiteral) {
-      SimpleStringLiteral stringLiteral = node;
-      String uri = stringLiteral.value;
-      String uriName = substringAfterLast(uri, '/');
-      for (Source libSource in context.librarySources) {
-        String libFile = libSource.fullName;
-        if (substringAfterLast(libFile, '/') == uriName) {
-          String fixedUri;
-          // may be "package:" URI
-          String libPackageUri = findNonFileUri(context, libFile);
-          if (libPackageUri != null) {
-            fixedUri = libPackageUri;
-          } else {
-            String relativeFile = relative(libFile, from: unitLibraryFolder);
-            fixedUri = split(relativeFile).join('/');
-          }
-          // add fix
-          SourceRange range = rf.rangeNode(node);
-          _addReplaceEdit(range, "'$fixedUri'");
-          _addFix(DartFixKind.REPLACE_IMPORT_URI, [fixedUri]);
-        }
-      }
-    }
-  }
-
   void _addFix_replaceVarWithDynamic() {
     SourceRange range = rf.rangeError(error);
     _addReplaceEdit(range, 'dynamic');
@@ -2036,23 +2002,17 @@
       MethodInvocation invocation = node.parent as MethodInvocation;
       // prepare environment
       Element targetElement;
-      String prefix;
-      int insertOffset;
-      String sourcePrefix;
-      String sourceSuffix;
       bool staticModifier = false;
+
+      ClassDeclaration targetClassNode;
       Expression target = invocation.realTarget;
       if (target == null) {
         targetElement = unitElement;
         ClassMember enclosingMember =
             node.getAncestor((node) => node is ClassMember);
-        ClassDeclaration enclosingClass = enclosingMember.parent;
-        utils.targetClassElement = enclosingClass.element;
+        targetClassNode = enclosingMember.parent;
+        utils.targetClassElement = targetClassNode.element;
         staticModifier = _inStaticContext();
-        prefix = utils.getNodePrefix(enclosingMember);
-        insertOffset = enclosingMember.end;
-        sourcePrefix = '$eol$eol';
-        sourceSuffix = '';
       } else {
         // prepare target interface type
         DartType targetType = target.bestType;
@@ -2060,38 +2020,35 @@
           return;
         }
         ClassElement targetClassElement = targetType.element as ClassElement;
+        if (targetClassElement.librarySource.isInSystemLibrary) {
+          return;
+        }
         targetElement = targetClassElement;
         // prepare target ClassDeclaration
         AstNode targetTypeNode = getParsedClassElementNode(targetClassElement);
         if (targetTypeNode is! ClassDeclaration) {
           return;
         }
-        ClassDeclaration targetClassNode = targetTypeNode;
+        targetClassNode = targetTypeNode;
         // maybe static
         if (target is Identifier) {
-          staticModifier = target.bestElement.kind == ElementKind.CLASS;
+          staticModifier =
+              resolutionMap.bestElementForIdentifier(target).kind ==
+                  ElementKind.CLASS;
         }
-        // prepare insert offset
-        prefix = '  ';
-        insertOffset = targetClassNode.end - 1;
-        if (targetClassNode.members.isEmpty) {
-          sourcePrefix = '';
-        } else {
-          sourcePrefix = eol;
-        }
-        sourceSuffix = eol;
         // use different utils
         CompilationUnitElement targetUnitElement =
             getCompilationUnitElement(targetClassElement);
         CompilationUnit targetUnit = getParsedUnit(targetUnitElement);
         utils = new CorrectionUtils(targetUnit);
       }
+      ClassMemberLocation targetLocation =
+          utils.prepareNewMethodLocation(targetClassNode);
       String targetFile = targetElement.source.fullName;
       // build method source
-      SourceBuilder sb = new SourceBuilder(targetFile, insertOffset);
+      SourceBuilder sb = new SourceBuilder(targetFile, targetLocation.offset);
       {
-        sb.append(sourcePrefix);
-        sb.append(prefix);
+        sb.append(targetLocation.prefix);
         // maybe "static"
         if (staticModifier) {
           sb.append('static ');
@@ -2108,8 +2065,8 @@
           sb.endPosition();
         }
         _addFix_undefinedMethod_create_parameters(sb, invocation.argumentList);
-        sb.append(') {$eol$prefix}');
-        sb.append(sourceSuffix);
+        sb.append(') {}');
+        sb.append(targetLocation.suffix);
       }
       // insert source
       _insertBuilder(sb, targetElement);
@@ -2166,33 +2123,31 @@
     ConstructorDeclaration constructor = node.parent;
     // add these fields
     List<FieldElement> fields =
-        error.getProperty(ErrorProperty.NOT_INITIALIZED_FIELDS);
-    if (fields != null) {
-      // prepare new parameters code
-      fields.sort((a, b) => a.nameOffset - b.nameOffset);
-      String fieldParametersCode =
-          fields.map((field) => 'this.${field.name}').join(', ');
-      // prepare the last required parameter
-      FormalParameter lastRequiredParameter;
-      List<FormalParameter> parameters = constructor.parameters.parameters;
-      for (FormalParameter parameter in parameters) {
-        if (parameter.kind == ParameterKind.REQUIRED) {
-          lastRequiredParameter = parameter;
-        }
+        ErrorVerifier.computeNotInitializedFields(constructor);
+    // prepare new parameters code
+    fields.sort((a, b) => a.nameOffset - b.nameOffset);
+    String fieldParametersCode =
+        fields.map((field) => 'this.${field.name}').join(', ');
+    // prepare the last required parameter
+    FormalParameter lastRequiredParameter;
+    List<FormalParameter> parameters = constructor.parameters.parameters;
+    for (FormalParameter parameter in parameters) {
+      if (parameter.kind == ParameterKind.REQUIRED) {
+        lastRequiredParameter = parameter;
       }
-      // append new field formal initializers
-      if (lastRequiredParameter != null) {
-        _addInsertEdit(lastRequiredParameter.end, ', $fieldParametersCode');
-      } else {
-        int offset = constructor.parameters.leftParenthesis.end;
-        if (parameters.isNotEmpty) {
-          fieldParametersCode += ', ';
-        }
-        _addInsertEdit(offset, fieldParametersCode);
-      }
-      // add proposal
-      _addFix(DartFixKind.ADD_FIELD_FORMAL_PARAMETERS, []);
     }
+    // append new field formal initializers
+    if (lastRequiredParameter != null) {
+      _addInsertEdit(lastRequiredParameter.end, ', $fieldParametersCode');
+    } else {
+      int offset = constructor.parameters.leftParenthesis.end;
+      if (parameters.isNotEmpty) {
+        fieldParametersCode += ', ';
+      }
+      _addInsertEdit(offset, fieldParametersCode);
+    }
+    // add proposal
+    _addFix(DartFixKind.ADD_FIELD_FORMAL_PARAMETERS, []);
   }
 
   void _addFix_useEffectiveIntegerDivision() {
@@ -2456,8 +2411,11 @@
 
   void _appendParameterForArgument(
       SourceBuilder sb, Set<String> excluded, int index, Expression argument) {
-    // append type name
     DartType type = argument.bestType;
+    if (type == null || type.isBottom || type.isDartCoreNull) {
+      type = DynamicTypeImpl.instance;
+    }
+    // append type name
     String typeSource = utils.getTypeSource(type, librariesToImport);
     if (typeSource != 'dynamic') {
       sb.startPosition('TYPE$index');
@@ -2536,7 +2494,7 @@
   }
 
   void _appendType(SourceBuilder sb, DartType type,
-      {String groupId, bool orVar: false}) {
+      {String groupId, bool orVar: false, bool trailingSpace: true}) {
     if (type != null && !type.isDynamic) {
       String typeSource = utils.getTypeSource(type, librariesToImport);
       if (groupId != null) {
@@ -2546,12 +2504,39 @@
       } else {
         sb.append(typeSource);
       }
-      sb.append(' ');
+      if (trailingSpace) {
+        sb.append(' ');
+      }
     } else if (orVar) {
       sb.append('var ');
     }
   }
 
+  void _appendTypeParameter(
+      SourceBuilder sb, TypeParameterElement typeParameter) {
+    sb.append(typeParameter.name);
+    if (typeParameter.bound != null) {
+      sb.append(' extends ');
+      _appendType(sb, typeParameter.bound, trailingSpace: false);
+    }
+  }
+
+  void _appendTypeParameters(
+      SourceBuilder sb, List<TypeParameterElement> typeParameters) {
+    if (typeParameters.isNotEmpty) {
+      sb.append('<');
+      bool isFirst = true;
+      for (TypeParameterElement typeParameter in typeParameters) {
+        if (!isFirst) {
+          sb.append(', ');
+        }
+        isFirst = false;
+        _appendTypeParameter(sb, typeParameter);
+      }
+      sb.append('>');
+    }
+  }
+
   /**
    * Computes the name of the library at the given [path].
    * See https://www.dartlang.org/articles/style-guide/#names for conventions.
@@ -2812,6 +2797,16 @@
     return node is SimpleIdentifier && node.name == 'await';
   }
 
+  bool _isLibSrcPath(String path) {
+    List<String> parts = resourceProvider.pathContext.split(path);
+    for (int i = 0; i < parts.length - 2; i++) {
+      if (parts[i] == 'lib' && parts[i + 1] == 'src') {
+        return true;
+      }
+    }
+    return false;
+  }
+
   /**
    * Removes any [ParenthesizedExpression] enclosing [expr].
    *
@@ -2842,7 +2837,7 @@
     }
   }
 
-  void _replaceTypeWithFuture(TypeName typeName) {
+  void _replaceTypeWithFuture(TypeAnnotation typeName) {
     InterfaceType futureType = context.typeProvider.futureType;
     // validate the type
     DartType type = typeName?.type;
diff --git a/pkg/analysis_server/lib/src/services/correction/namespace.dart b/pkg/analysis_server/lib/src/services/correction/namespace.dart
index 87c38dd..7519679 100644
--- a/pkg/analysis_server/lib/src/services/correction/namespace.dart
+++ b/pkg/analysis_server/lib/src/services/correction/namespace.dart
@@ -5,6 +5,7 @@
 library services.src.correction.namespace;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/dart/resolver/scope.dart';
 
@@ -141,7 +142,8 @@
   AstNode parent = prefixNode.parent;
   CompilationUnit unit =
       prefixNode.getAncestor((node) => node is CompilationUnit);
-  LibraryElement libraryElement = unit.element.library;
+  LibraryElement libraryElement =
+      resolutionMap.elementDeclaredByCompilationUnit(unit).library;
   // prepare used element
   Element usedElement = null;
   if (parent is PrefixedIdentifier) {
diff --git a/pkg/analysis_server/lib/src/services/correction/util.dart b/pkg/analysis_server/lib/src/services/correction/util.dart
index 82f2652..cbed44a 100644
--- a/pkg/analysis_server/lib/src/services/correction/util.dart
+++ b/pkg/analysis_server/lib/src/services/correction/util.dart
@@ -29,8 +29,8 @@
  * Adds edits to the given [change] that ensure that all the [libraries] are
  * imported into the given [targetLibrary].
  */
-void addLibraryImports(SourceChange change, LibraryElement targetLibrary,
-    Set<LibraryElement> libraries) {
+void addLibraryImports(
+    SourceChange change, LibraryElement targetLibrary, Set<Source> libraries) {
   CorrectionUtils libUtils;
   try {
     CompilationUnitElement unitElement = targetLibrary.definingCompilationUnit;
@@ -54,7 +54,7 @@
 
   // Prepare all URIs to import.
   List<String> uriList = libraries
-      .map((library) => getLibrarySourceUri(targetLibrary, library.source))
+      .map((library) => getLibrarySourceUri(targetLibrary, library))
       .toList();
   uriList.sort((a, b) => a.compareTo(b));
 
@@ -158,25 +158,6 @@
 }
 
 /**
- * Attempts to convert the given absolute path into an absolute URI, such as
- * "dart" or "package" URI.
- *
- * [context] - the [AnalysisContext] to work in.
- * [path] - the absolute path, not `null`.
- *
- * Returns the absolute (non-file) URI or `null`.
- */
-String findNonFileUri(AnalysisContext context, String path) {
-  Source fileSource =
-      new NonExistingSource(path, toUri(path), UriKind.FILE_URI);
-  Uri uri = context.sourceFactory.restoreUri(fileSource);
-  if (uri == null || uri.scheme == 'file') {
-    return null;
-  }
-  return uri.toString();
-}
-
-/**
  * Returns the EOL to use for the given [code].
  */
 String getCodeEndOfLine(String code) {
@@ -367,7 +348,7 @@
  * Computes the best URI to import [what] into [from].
  */
 String getLibrarySourceUri(LibraryElement from, Source what) {
-  String whatFile = what.fullName;
+  String whatPath = what.fullName;
   // check if an absolute URI (such as 'dart:' or 'package:')
   Uri whatUri = what.uri;
   String whatUriScheme = whatUri.scheme;
@@ -376,7 +357,7 @@
   }
   // compute a relative URI
   String fromFolder = dirname(from.source.fullName);
-  String relativeFile = relative(whatFile, from: fromFolder);
+  String relativeFile = relative(whatPath, from: fromFolder);
   return split(relativeFile).join('/');
 }
 
@@ -699,6 +680,8 @@
    */
   ClassElement targetClassElement;
 
+  ExecutableElement targetExecutableElement;
+
   LibraryElement _library;
   String _buffer;
   String _endOfLine;
@@ -765,7 +748,7 @@
    * if can not be resolved, should be treated as the `dynamic` type.
    */
   String getExpressionTypeSource(
-      Expression expression, Set<LibraryElement> librariesToImport) {
+      Expression expression, Set<Source> librariesToImport) {
     if (expression == null) {
       return null;
     }
@@ -1054,7 +1037,7 @@
    * @return the source for the parameter with the given type and name.
    */
   String getParameterSource(
-      DartType type, String name, Set<LibraryElement> librariesToImport) {
+      DartType type, String name, Set<Source> librariesToImport) {
     // no type
     if (type == null || type.isDynamic) {
       return name;
@@ -1121,7 +1104,7 @@
    * Fills [librariesToImport] with [LibraryElement]s whose elements are
    * used by the generated source, but not imported.
    */
-  String getTypeSource(DartType type, Set<LibraryElement> librariesToImport,
+  String getTypeSource(DartType type, Set<Source> librariesToImport,
       {StringBuffer parametersBuffer}) {
     StringBuffer sb = new StringBuffer();
     // type parameter
@@ -1146,8 +1129,8 @@
       parametersBuffer.write(')');
       return getTypeSource(type.returnType, librariesToImport);
     }
-    // BottomType
-    if (type.isBottom) {
+    // <Bottom>, Null
+    if (type.isBottom || type.isDartCoreNull) {
       return 'dynamic';
     }
     // prepare element
@@ -1173,7 +1156,7 @@
           sb.write(".");
         }
       } else {
-        librariesToImport.add(library);
+        librariesToImport.add(library.source);
       }
     }
     // append simple name
@@ -1317,6 +1300,16 @@
             member is MethodDeclaration && member.isGetter);
   }
 
+  ClassMemberLocation prepareNewMethodLocation(
+      ClassDeclaration classDeclaration) {
+    return prepareNewClassMemberLocation(
+        classDeclaration,
+        (member) =>
+            member is FieldDeclaration ||
+            member is ConstructorDeclaration ||
+            member is MethodDeclaration);
+  }
+
   /**
    * Returns the source with indentation changed from [oldIndent] to
    * [newIndent], keeping indentation of lines relative to each other.
@@ -1490,13 +1483,15 @@
   }
 
   /**
-   * Checks if [type] is visible at [targetOffset].
+   * Checks if [type] is visible in [targetExecutableElement] or
+   * [targetClassElement].
    */
   bool _isTypeVisible(DartType type) {
     if (type is TypeParameterType) {
       TypeParameterElement parameterElement = type.element;
       Element parameterClassElement = parameterElement.enclosingElement;
-      return identical(parameterClassElement, targetClassElement);
+      return identical(parameterClassElement, targetExecutableElement) ||
+          identical(parameterClassElement, targetClassElement);
     }
     return true;
   }
diff --git a/pkg/analysis_server/lib/src/services/index/index.dart b/pkg/analysis_server/lib/src/services/index/index.dart
index dcf8ea3..e45be24 100644
--- a/pkg/analysis_server/lib/src/services/index/index.dart
+++ b/pkg/analysis_server/lib/src/services/index/index.dart
@@ -6,6 +6,7 @@
 
 import 'package:analysis_server/src/services/index/index_unit.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
 import 'package:analyzer/src/generated/source.dart';
@@ -80,10 +81,15 @@
    * Index declarations in the given partially resolved [unit].
    */
   void indexDeclarations(CompilationUnit unit) {
-    if (unit?.element?.library == null) {
+    if (unit == null) {
       return;
     }
-    AnalysisContext context = unit.element.context;
+    CompilationUnitElement compilationUnitElement =
+        resolutionMap.elementDeclaredByCompilationUnit(unit);
+    if (compilationUnitElement?.library == null) {
+      return;
+    }
+    AnalysisContext context = compilationUnitElement.context;
     _getContextIndex(context).indexDeclarations(unit);
   }
 
@@ -91,10 +97,15 @@
    * Index the given fully resolved [unit].
    */
   void indexUnit(CompilationUnit unit) {
-    if (unit?.element?.library == null) {
+    if (unit == null) {
       return;
     }
-    AnalysisContext context = unit.element.context;
+    CompilationUnitElement compilationUnitElement =
+        resolutionMap.elementDeclaredByCompilationUnit(unit);
+    if (compilationUnitElement?.library == null) {
+      return;
+    }
+    AnalysisContext context = compilationUnitElement.context;
     _getContextIndex(context).indexUnit(unit);
   }
 
diff --git a/pkg/analysis_server/lib/src/services/index/index_unit.dart b/pkg/analysis_server/lib/src/services/index/index_unit.dart
index 5a9cb47..8f1ce08 100644
--- a/pkg/analysis_server/lib/src/services/index/index_unit.dart
+++ b/pkg/analysis_server/lib/src/services/index/index_unit.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -489,7 +490,10 @@
   @override
   visitClassDeclaration(ClassDeclaration node) {
     if (node.extendsClause == null) {
-      ClassElement objectElement = node.element.supertype?.element;
+      ClassElement objectElement = resolutionMap
+          .elementDeclaredByClassDeclaration(node)
+          .supertype
+          ?.element;
       recordRelationOffset(objectElement, IndexRelationKind.IS_EXTENDED_BY,
           node.name.offset, 0, true);
     }
diff --git a/pkg/analysis_server/lib/src/services/refactoring/convert_method_to_getter.dart b/pkg/analysis_server/lib/src/services/refactoring/convert_method_to_getter.dart
index b742612..e8ef23c 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/convert_method_to_getter.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/convert_method_to_getter.dart
@@ -24,11 +24,13 @@
 class ConvertMethodToGetterRefactoringImpl extends RefactoringImpl
     implements ConvertMethodToGetterRefactoring {
   final SearchEngine searchEngine;
+  final GetResolvedUnit getResolvedUnit;
   final ExecutableElement element;
 
   SourceChange change;
 
-  ConvertMethodToGetterRefactoringImpl(this.searchEngine, this.element);
+  ConvertMethodToGetterRefactoringImpl(
+      this.searchEngine, this.getResolvedUnit, this.element);
 
   @override
   String get refactoringName => 'Convert Method To Getter';
@@ -114,7 +116,7 @@
     }
   }
 
-  Future _updateElementReferences(Element element) async {
+  Future<Null> _updateElementReferences(Element element) async {
     List<SearchMatch> matches = await searchEngine.searchReferences(element);
     List<SourceReference> references = getSourceReferences(matches);
     for (SourceReference reference in references) {
@@ -123,7 +125,7 @@
       // prepare invocation
       MethodInvocation invocation;
       {
-        CompilationUnit refUnit = refElement.unit;
+        CompilationUnit refUnit = await getResolvedUnit(refElement);
         AstNode refNode =
             new NodeLocator(refRange.offset).searchWithin(refUnit);
         invocation = refNode.getAncestor((node) => node is MethodInvocation);
diff --git a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
index 4c613cfd..6e3c2cb 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/extract_method.dart
@@ -21,6 +21,7 @@
 import 'package:analysis_server/src/services/search/element_visitors.dart';
 import 'package:analysis_server/src/services/search/search_engine.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -81,7 +82,7 @@
   LibraryElement libraryElement;
   SourceRange selectionRange;
   CorrectionUtils utils;
-  Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+  Set<Source> librariesToImport = new Set<Source>();
 
   String returnType = '';
   String variableType;
@@ -411,7 +412,8 @@
     AstNode parent = _parentMember.parent;
     // top-level function
     if (parent is CompilationUnit) {
-      LibraryElement libraryElement = parent.element.library;
+      LibraryElement libraryElement =
+          resolutionMap.elementDeclaredByCompilationUnit(parent).library;
       return validateCreateFunction(searchEngine, libraryElement, name);
     }
     // method of class
@@ -857,6 +859,15 @@
   }
 
   @override
+  Object visitGenericFunctionType(GenericFunctionType node) {
+    super.visitGenericFunctionType(node);
+    if (_isFirstSelectedNode(node)) {
+      invalidSelection('Cannot extract a single type reference.');
+    }
+    return null;
+  }
+
+  @override
   Object visitSimpleIdentifier(SimpleIdentifier node) {
     super.visitSimpleIdentifier(node);
     if (_isFirstSelectedNode(node)) {
@@ -1217,8 +1228,7 @@
       if (returnType is InterfaceType && type is InterfaceType) {
         returnType = InterfaceType.getSmartLeastUpperBound(returnType, type);
       } else {
-        returnType = context.typeSystem
-            .getLeastUpperBound(context.typeProvider, returnType, type);
+        returnType = context.typeSystem.getLeastUpperBound(returnType, type);
       }
     }
   }
diff --git a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
index 8a0322c..68acb96 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
@@ -191,20 +191,15 @@
 }
 
 /**
- * Completes with the resolved [CompilationUnit] that contains the [element].
- */
-typedef Future<CompilationUnit> GetResolvedUnitContainingElement(
-    Element element);
-
-/**
  * [InlineMethodRefactoring] implementation.
  */
 class InlineMethodRefactoringImpl extends RefactoringImpl
     implements InlineMethodRefactoring {
   final SearchEngine searchEngine;
-  final GetResolvedUnitContainingElement getResolvedUnit;
+  final GetResolvedUnit getResolvedUnit;
   final CompilationUnit unit;
   final int offset;
+  _UnitCache _unitCache;
   CorrectionUtils utils;
   SourceChange change;
 
@@ -227,6 +222,7 @@
 
   InlineMethodRefactoringImpl(
       this.searchEngine, this.getResolvedUnit, this.unit, this.offset) {
+    _unitCache = new _UnitCache(getResolvedUnit, unit);
     utils = new CorrectionUtils(unit);
   }
 
@@ -323,6 +319,20 @@
   @override
   bool requiresPreview() => false;
 
+  Future<FunctionDeclaration> _computeFunctionDeclaration() async {
+    CompilationUnit unit = await _unitCache.getUnit(_methodElement);
+    return new NodeLocator(_methodElement.nameOffset)
+        .searchWithin(unit)
+        .getAncestor((n) => n is FunctionDeclaration) as FunctionDeclaration;
+  }
+
+  Future<MethodDeclaration> _computeMethodDeclaration() async {
+    CompilationUnit unit = await _unitCache.getUnit(_methodElement);
+    return new NodeLocator(_methodElement.nameOffset)
+        .searchWithin(unit)
+        .getAncestor((n) => n is MethodDeclaration) as MethodDeclaration;
+  }
+
   _SourcePart _createSourcePart(SourceRange range) {
     String source = _methodUtils.getRangeText(range);
     String prefix = getLinePrefix(source);
@@ -361,12 +371,12 @@
     }
     _methodElement = element as ExecutableElement;
     _isAccessor = element is PropertyAccessorElement;
-    _methodUnit = await getResolvedUnit(element);
+    _methodUnit = await _unitCache.getUnit(element);
     _methodUtils = new CorrectionUtils(_methodUnit);
     // class member
     bool isClassMember = element.enclosingElement is ClassElement;
     if (element is MethodElement || _isAccessor && isClassMember) {
-      MethodDeclaration methodDeclaration = element.computeNode();
+      MethodDeclaration methodDeclaration = await _computeMethodDeclaration();
       _methodNode = methodDeclaration;
       _methodParameters = methodDeclaration.parameters;
       _methodBody = methodDeclaration.body;
@@ -379,7 +389,8 @@
     // unit member
     bool isUnitMember = element.enclosingElement is CompilationUnitElement;
     if (element is FunctionElement || _isAccessor && isUnitMember) {
-      FunctionDeclaration functionDeclaration = element.computeNode();
+      FunctionDeclaration functionDeclaration =
+          await _computeFunctionDeclaration();
       _methodNode = functionDeclaration;
       _methodParameters = functionDeclaration.functionExpression.parameters;
       _methodBody = functionDeclaration.functionExpression.body;
@@ -457,7 +468,7 @@
   Future<Null> init() async {
     refElement = reference.element;
     // prepare CorrectionUtils
-    CompilationUnit refUnit = await ref.getResolvedUnit(refElement);
+    CompilationUnit refUnit = await ref._unitCache.getUnit(refElement);
     _refUtils = new CorrectionUtils(refUnit);
     // prepare node and environment
     _node = _refUtils.findNode(reference.sourceRange.offset);
@@ -777,6 +788,26 @@
   }
 }
 
+class _UnitCache {
+  final GetResolvedUnit getResolvedUnit;
+  final Map<CompilationUnitElement, CompilationUnit> map = {};
+
+  _UnitCache(this.getResolvedUnit, CompilationUnit unit) {
+    map[unit.element] = unit;
+  }
+
+  Future<CompilationUnit> getUnit(Element element) async {
+    Element unitElement =
+        element.getAncestor((e) => e is CompilationUnitElement);
+    CompilationUnit unit = map[unitElement];
+    if (unit == null) {
+      unit = unitElement.unit;
+      map[unitElement] = unit;
+    }
+    return unit;
+  }
+}
+
 /**
  * A visitor that fills [_SourcePart] with fields, parameters and variables.
  */
diff --git a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
index 5cf982f..9c2da5d 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
@@ -31,6 +31,11 @@
 import 'package:analyzer/src/generated/source.dart';
 
 /**
+ * Completes with the resolved [CompilationUnit] that contains the [element].
+ */
+typedef Future<CompilationUnit> GetResolvedUnit(Element element);
+
+/**
  * [Refactoring] to convert getters into normal [MethodDeclaration]s.
  */
 abstract class ConvertGetterToMethodRefactoring implements Refactoring {
@@ -52,9 +57,10 @@
    * Returns a new [ConvertMethodToGetterRefactoring] instance for converting
    * [element] and all the corresponding hierarchy elements.
    */
-  factory ConvertMethodToGetterRefactoring(
-      SearchEngine searchEngine, ExecutableElement element) {
-    return new ConvertMethodToGetterRefactoringImpl(searchEngine, element);
+  factory ConvertMethodToGetterRefactoring(SearchEngine searchEngine,
+      GetResolvedUnit getResolvedUnit, ExecutableElement element) {
+    return new ConvertMethodToGetterRefactoringImpl(
+        searchEngine, getResolvedUnit, element);
   }
 }
 
@@ -248,11 +254,8 @@
   /**
    * Returns a new [InlineMethodRefactoring] instance.
    */
-  factory InlineMethodRefactoring(
-      SearchEngine searchEngine,
-      GetResolvedUnitContainingElement getResolvedUnit,
-      CompilationUnit unit,
-      int offset) {
+  factory InlineMethodRefactoring(SearchEngine searchEngine,
+      GetResolvedUnit getResolvedUnit, CompilationUnit unit, int offset) {
     return new InlineMethodRefactoringImpl(
         searchEngine, getResolvedUnit, unit, offset);
   }
diff --git a/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart b/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart
index 5c9e12f..0e802d6 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/rename_class_member.dart
@@ -164,7 +164,7 @@
     Set<ClassElement> superClasses = getSuperClasses(elementClass);
     await _prepareReferences();
     Set<ClassElement> subClasses =
-        await getSubClasses(searchEngine, elementClass);
+        await searchEngine.searchAllSubtypes(elementClass);
     // check shadowing of class names
     if (element != null) {
       for (Element element in elements) {
diff --git a/pkg/analysis_server/lib/src/services/search/hierarchy.dart b/pkg/analysis_server/lib/src/services/search/hierarchy.dart
index 1822f1b..92aca41 100644
--- a/pkg/analysis_server/lib/src/services/search/hierarchy.dart
+++ b/pkg/analysis_server/lib/src/services/search/hierarchy.dart
@@ -87,7 +87,7 @@
     }
     // check all sub- classes
     Set<ClassElement> subClasses =
-        await getSubClasses(searchEngine, superClass);
+        await searchEngine.searchAllSubtypes(superClass);
     subClasses.add(superClass);
     for (ClassElement subClass in subClasses) {
       List<Element> subClassMembers = getChildren(subClass, name);
@@ -119,15 +119,6 @@
 }
 
 /**
- * Returns a [Set] with all direct and indirect subclasses of [seed].
- */
-Future<Set<ClassElement>> getSubClasses(
-    SearchEngine searchEngine, ClassElement seed) async {
-  List<SearchMatch> matches = await searchEngine.searchAllSubtypes(seed);
-  return matches.map((match) => match.element).toSet();
-}
-
-/**
  * Returns a [Set] with all direct and indirect superclasses of [seed].
  */
 Set<ClassElement> getSuperClasses(ClassElement seed) {
diff --git a/pkg/analysis_server/lib/src/services/search/search_engine.dart b/pkg/analysis_server/lib/src/services/search/search_engine.dart
index 6ea3395..b739b95 100644
--- a/pkg/analysis_server/lib/src/services/search/search_engine.dart
+++ b/pkg/analysis_server/lib/src/services/search/search_engine.dart
@@ -62,7 +62,7 @@
    *
    * [type] - the [ClassElement] being subtyped by the found matches.
    */
-  Future<List<SearchMatch>> searchAllSubtypes(ClassElement type);
+  Future<Set<ClassElement>> searchAllSubtypes(ClassElement type);
 
   /**
    * Returns declarations of class members with the given name.
diff --git a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart
index cdd6a91..63a6996 100644
--- a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart
+++ b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart
@@ -30,11 +30,11 @@
   SearchEngineImpl(this._index);
 
   @override
-  Future<List<SearchMatch>> searchAllSubtypes(ClassElement type) async {
+  Future<Set<ClassElement>> searchAllSubtypes(ClassElement type) async {
     List<SearchMatch> matches = <SearchMatch>[];
     await _addMatches(
         matches, type, IndexRelationKind.IS_ANCESTOR_OF, MatchKind.DECLARATION);
-    return matches;
+    return matches.map((match) => match.element as ClassElement).toSet();
   }
 
   @override
diff --git a/pkg/analysis_server/lib/src/services/search/search_engine_internal2.dart b/pkg/analysis_server/lib/src/services/search/search_engine_internal2.dart
index 72cd494..e14a6ac 100644
--- a/pkg/analysis_server/lib/src/services/search/search_engine_internal2.dart
+++ b/pkg/analysis_server/lib/src/services/search/search_engine_internal2.dart
@@ -19,21 +19,43 @@
   SearchEngineImpl2(this._drivers);
 
   @override
-  Future<List<SearchMatch>> searchAllSubtypes(ClassElement type) async {
-    // TODO(scheglov) implement
-    return [];
+  Future<Set<ClassElement>> searchAllSubtypes(ClassElement type) async {
+    Set<ClassElement> allSubtypes = new Set<ClassElement>();
+
+    Future<Null> addSubtypes(ClassElement type) async {
+      List<SearchResult> directResults = await _searchDirectSubtypes(type);
+      for (SearchResult directResult in directResults) {
+        var directSubtype = directResult.enclosingElement as ClassElement;
+        if (allSubtypes.add(directSubtype)) {
+          await addSubtypes(directSubtype);
+        }
+      }
+    }
+
+    await addSubtypes(type);
+    return allSubtypes;
   }
 
   @override
   Future<List<SearchMatch>> searchMemberDeclarations(String name) async {
-    // TODO(scheglov) implement
-    return [];
+    List<SearchMatch> allDeclarations = [];
+    RegExp regExp = new RegExp('^$name\$');
+    for (AnalysisDriver driver in _drivers) {
+      List<Element> elements = await driver.search.classMembers(regExp);
+      allDeclarations.addAll(elements.map(_SearchMatch.forElement));
+    }
+    return allDeclarations;
   }
 
   @override
   Future<List<SearchMatch>> searchMemberReferences(String name) async {
-    // TODO(scheglov) implement
-    return [];
+    List<SearchResult> allResults = [];
+    for (AnalysisDriver driver in _drivers) {
+      List<SearchResult> results =
+          await driver.search.unresolvedMemberReferences(name);
+      allResults.addAll(results);
+    }
+    return allResults.map(_SearchMatch.forSearchResult).toList();
   }
 
   @override
@@ -48,14 +70,28 @@
 
   @override
   Future<List<SearchMatch>> searchSubtypes(ClassElement type) async {
-    // TODO(scheglov) implement
-    return [];
+    List<SearchResult> results = await _searchDirectSubtypes(type);
+    return results.map(_SearchMatch.forSearchResult).toList();
   }
 
   @override
   Future<List<SearchMatch>> searchTopLevelDeclarations(String pattern) async {
-    // TODO(scheglov) implement
-    return [];
+    List<SearchMatch> allDeclarations = [];
+    RegExp regExp = new RegExp(pattern);
+    for (AnalysisDriver driver in _drivers) {
+      List<Element> elements = await driver.search.topLevelElements(regExp);
+      allDeclarations.addAll(elements.map(_SearchMatch.forElement));
+    }
+    return allDeclarations;
+  }
+
+  Future<List<SearchResult>> _searchDirectSubtypes(ClassElement type) async {
+    List<SearchResult> allResults = [];
+    for (AnalysisDriver driver in _drivers) {
+      List<SearchResult> results = await driver.search.subTypes(type);
+      allResults.addAll(results);
+    }
+    return allResults;
   }
 }
 
@@ -131,6 +167,19 @@
         new SourceRange(result.offset, result.length));
   }
 
+  static _SearchMatch forElement(Element element) {
+    return new _SearchMatch(
+        element.source.fullName,
+        element.librarySource,
+        element.source,
+        element.library,
+        element,
+        true,
+        true,
+        MatchKind.DECLARATION,
+        new SourceRange(element.nameOffset, element.nameLength));
+  }
+
   static MatchKind toMatchKind(SearchResultKind kind) {
     if (kind == SearchResultKind.READ) {
       return MatchKind.READ;
diff --git a/pkg/analysis_server/lib/src/single_context_manager.dart b/pkg/analysis_server/lib/src/single_context_manager.dart
index fa99c96..0efb049 100644
--- a/pkg/analysis_server/lib/src/single_context_manager.dart
+++ b/pkg/analysis_server/lib/src/single_context_manager.dart
@@ -147,6 +147,18 @@
   }
 
   @override
+  AnalysisDriver getDriverFor(String path) {
+    throw new UnimplementedError(
+        'Unexpected invocation of getDriverFor in SingleContextManager');
+  }
+
+  @override
+  List<AnalysisDriver> getDriversInAnalysisRoot(Folder analysisRoot) {
+    throw new UnimplementedError(
+        'Unexpected invocation of getDriversInAnalysisRoot in SingleContextManager');
+  }
+
+  @override
   bool isIgnored(String path) {
     return !_isContainedIn(includedPaths, path) || _isExcludedPath(path);
   }
diff --git a/pkg/analysis_server/lib/src/status/ast_writer.dart b/pkg/analysis_server/lib/src/status/ast_writer.dart
index 1b292d6..b32886d 100644
--- a/pkg/analysis_server/lib/src/status/ast_writer.dart
+++ b/pkg/analysis_server/lib/src/status/ast_writer.dart
@@ -141,7 +141,7 @@
       properties['value'] = node.value;
     } else if (node is SuperConstructorInvocation) {
       properties['static element'] = node.staticElement;
-    } else if (node is TypeName) {
+    } else if (node is TypeAnnotation) {
       properties['type'] = node.type;
     } else if (node is VariableDeclarationList) {
       properties['keyword'] = node.keyword;
@@ -195,7 +195,7 @@
       return node.name.name;
     } else if (node is TopLevelVariableDeclaration) {
       return _getNames(node.variables);
-    } else if (node is TypeName) {
+    } else if (node is TypeAnnotation) {
       return node.toSource();
     } else if (node is TypeParameter) {
       return node.name.name;
diff --git a/pkg/analysis_server/lib/src/status/get_handler.dart b/pkg/analysis_server/lib/src/status/get_handler.dart
index d6ed6eb..087b658 100644
--- a/pkg/analysis_server/lib/src/status/get_handler.dart
+++ b/pkg/analysis_server/lib/src/status/get_handler.dart
@@ -421,7 +421,7 @@
    */
   String _encodeSdkDescriptor(SdkDescription descriptor) {
     StringBuffer buffer = new StringBuffer();
-    buffer.write(descriptor.options.encodeCrossContextOptions().join(','));
+    buffer.write(descriptor.options.signature.join(','));
     for (String path in descriptor.paths) {
       buffer.write('+');
       buffer.write(path);
@@ -552,6 +552,7 @@
       results.add(LINTS);
       results.add(INFERABLE_STATIC_VARIABLES_IN_UNIT);
       results.add(LIBRARY_UNIT_ERRORS);
+      results.add(RESOLVE_DIRECTIVES_ERRORS);
       results.add(RESOLVE_TYPE_NAMES_ERRORS);
       results.add(RESOLVE_TYPE_BOUNDS_ERRORS);
       results.add(RESOLVE_UNIT_ERRORS);
diff --git a/pkg/analysis_server/lib/src/status/get_handler2.dart b/pkg/analysis_server/lib/src/status/get_handler2.dart
index 8bd958e..2541deb 100644
--- a/pkg/analysis_server/lib/src/status/get_handler2.dart
+++ b/pkg/analysis_server/lib/src/status/get_handler2.dart
@@ -383,8 +383,7 @@
       driver = analysisServer.driverMap[folder];
     }
 
-    // TODO(scheglov) Show priority files.
-//    List<String> priorityNames = <String>[];
+    List<String> priorityFiles = driver.priorityFiles;
     List<String> addedFiles = driver.addedFiles.toList();
     List<String> implicitFiles =
         driver.knownFiles.difference(driver.addedFiles).toList();
@@ -517,9 +516,8 @@
           }
         }
 
-        // TODO(scheglov) Show priority files.
-//        _writeFiles(
-//            buffer, 'Priority Files (${priorityNames.length})', priorityNames);
+        _writeFiles(
+            buffer, 'Priority Files (${priorityFiles.length})', priorityFiles);
         _writeFiles(buffer, 'Added Files (${addedFiles.length})', addedFiles);
         _writeFiles(
             buffer,
diff --git a/pkg/analysis_server/lib/src/utilities/change_builder_dart.dart b/pkg/analysis_server/lib/src/utilities/change_builder_dart.dart
index 94853ad..f438d257 100644
--- a/pkg/analysis_server/lib/src/utilities/change_builder_dart.dart
+++ b/pkg/analysis_server/lib/src/utilities/change_builder_dart.dart
@@ -458,10 +458,10 @@
   CorrectionUtils utils;
 
   /**
-   * A set containing the elements of the libraries that need to be imported in
+   * A set containing the sources of the libraries that need to be imported in
    * order to make visible the names used in generated code.
    */
-  Set<LibraryElement> librariesToImport = new Set<LibraryElement>();
+  Set<Source> librariesToImport = new Set<Source>();
 
   /**
    * Initialize a newly created builder to build a source file edit within the
diff --git a/pkg/analysis_server/lib/src/utilities/null_string_sink.dart b/pkg/analysis_server/lib/src/utilities/null_string_sink.dart
new file mode 100644
index 0000000..27fef3a
--- /dev/null
+++ b/pkg/analysis_server/lib/src/utilities/null_string_sink.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * A string sink that ignores everything written to it.
+ */
+class NullStringSink implements StringSink {
+  void write(Object obj) {}
+  void writeAll(Iterable objects, [String separator = ""]) {}
+  void writeCharCode(int charCode) {}
+  void writeln([Object obj = ""]) {}
+}
diff --git a/pkg/analysis_server/test/abstract_context.dart b/pkg/analysis_server/test/abstract_context.dart
index 2b7a648..d243352 100644
--- a/pkg/analysis_server/test/abstract_context.dart
+++ b/pkg/analysis_server/test/abstract_context.dart
@@ -4,6 +4,8 @@
 
 library testing.abstract_context;
 
+import 'dart:async';
+
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/visitor.dart';
@@ -11,7 +13,11 @@
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/source/package_map_resolver.dart';
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/engine.dart' as engine;
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source_io.dart';
 
@@ -40,13 +46,35 @@
 typedef void _ElementVisitorFunction(Element element);
 
 class AbstractContextTest {
-  static final DartSdk SDK = new MockSdk();
-  static final UriResolver SDK_RESOLVER = new DartUriResolver(SDK);
-
   MemoryResourceProvider provider;
+  DartSdk sdk;
   Map<String, List<Folder>> packageMap;
   UriResolver resourceResolver;
-  AnalysisContext context;
+
+  AnalysisContext _context;
+
+  StringBuffer _logBuffer = new StringBuffer();
+  FileContentOverlay _fileContentOverlay = new FileContentOverlay();
+  AnalysisDriver _driver;
+
+  AnalysisContext get context {
+    if (enableNewAnalysisDriver) {
+      throw new StateError('Should not be used with the new analysis driver.');
+    }
+    return _context;
+  }
+
+  AnalysisDriver get driver {
+    if (enableNewAnalysisDriver) {
+      return _driver;
+    }
+    throw new StateError('Should be used with the new analysis driver.');
+  }
+
+  /**
+   * Return `true` if the new analysis driver should be used by these tests.
+   */
+  bool get enableNewAnalysisDriver => false;
 
   Source addPackageSource(String packageName, String filePath, String content) {
     packageMap[packageName] = [(newFolder('/pubcache/$packageName'))];
@@ -56,12 +84,18 @@
 
   Source addSource(String path, String content, [Uri uri]) {
     File file = newFile(path, content);
-    Source source = file.createSource(uri);
-    ChangeSet changeSet = new ChangeSet();
-    changeSet.addedSource(source);
-    context.applyChanges(changeSet);
-    context.setContents(source, content);
-    return source;
+    if (enableNewAnalysisDriver) {
+      driver.addFile(path);
+      _fileContentOverlay[path] = content;
+      return null;
+    } else {
+      Source source = file.createSource(uri);
+      ChangeSet changeSet = new ChangeSet();
+      changeSet.addedSource(source);
+      context.applyChanges(changeSet);
+      context.setContents(source, content);
+      return source;
+    }
   }
 
   File newFile(String path, [String content]) =>
@@ -74,8 +108,11 @@
    * Performs all analysis tasks in [context].
    */
   void performAllAnalysisTasks() {
+    if (enableNewAnalysisDriver) {
+      return;
+    }
     while (true) {
-      AnalysisResult result = context.performAnalysisTask();
+      engine.AnalysisResult result = context.performAnalysisTask();
       if (!result.hasMoreWork) {
         break;
       }
@@ -86,24 +123,41 @@
     AnalysisEngine.instance.processRequiredPlugins();
   }
 
-  CompilationUnit resolveDartUnit(Source unitSource, Source librarySource) {
-    return context.resolveCompilationUnit2(unitSource, librarySource);
-  }
-
-  CompilationUnit resolveLibraryUnit(Source source) {
-    return context.resolveCompilationUnit2(source, source);
+  Future<CompilationUnit> resolveLibraryUnit(Source source) async {
+    if (enableNewAnalysisDriver) {
+      return (await driver.getResult(source.fullName))?.unit;
+    } else {
+      return context.resolveCompilationUnit2(source, source);
+    }
   }
 
   void setUp() {
     processRequiredPlugins();
     setupResourceProvider();
+    sdk = new MockSdk(resourceProvider: provider);
     resourceResolver = new ResourceUriResolver(provider);
     packageMap = new Map<String, List<Folder>>();
     PackageMapUriResolver packageResolver =
         new PackageMapUriResolver(provider, packageMap);
-    context = AnalysisEngine.instance.createAnalysisContext();
-    context.sourceFactory =
-        new SourceFactory([SDK_RESOLVER, packageResolver, resourceResolver]);
+    SourceFactory sourceFactory = new SourceFactory(
+        [new DartUriResolver(sdk), packageResolver, resourceResolver]);
+    if (enableNewAnalysisDriver) {
+      PerformanceLog log = new PerformanceLog(_logBuffer);
+      AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(log);
+      _driver = new AnalysisDriver(
+          scheduler,
+          log,
+          provider,
+          new MemoryByteStore(),
+          _fileContentOverlay,
+          'test',
+          sourceFactory,
+          new AnalysisOptionsImpl());
+      scheduler.start();
+    } else {
+      _context = AnalysisEngine.instance.createAnalysisContext();
+      context.sourceFactory = sourceFactory;
+    }
     AnalysisEngine.instance.logger = PrintLogger.instance;
   }
 
@@ -112,7 +166,7 @@
   }
 
   void tearDown() {
-    context = null;
+    _context = null;
     provider = null;
     AnalysisEngine.instance.logger = null;
   }
diff --git a/pkg/analysis_server/test/abstract_single_unit.dart b/pkg/analysis_server/test/abstract_single_unit.dart
index bda1d20..b515476 100644
--- a/pkg/analysis_server/test/abstract_single_unit.dart
+++ b/pkg/analysis_server/test/abstract_single_unit.dart
@@ -4,10 +4,12 @@
 
 library test.services.src.index.abstract_single_file;
 
+import 'dart:async';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/src/dart/ast/utilities.dart';
+import 'package:analyzer/src/dart/error/hint_codes.dart';
 import 'package:analyzer/src/generated/java_engine.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:test/test.dart';
@@ -29,11 +31,6 @@
     testSource = addSource(testFile, code, uri);
   }
 
-  void assertNoErrorsInSource(Source source) {
-    List<AnalysisError> errors = context.getErrors(source).errors;
-    expect(errors, isEmpty);
-  }
-
   Element findElement(String name, [ElementKind kind]) {
     return findChildElement(testUnitElement, name, kind);
   }
@@ -98,11 +95,28 @@
     return length;
   }
 
-  void resolveTestUnit(String code) {
+  Future<Null> resolveTestUnit(String code) async {
     addTestSource(code);
-    testUnit = resolveLibraryUnit(testSource);
-    if (verifyNoTestUnitErrors) {
-      assertNoErrorsInSource(testSource);
+    if (enableNewAnalysisDriver) {
+      var result = await driver.getResult(testFile);
+      testUnit = (result).unit;
+      if (verifyNoTestUnitErrors) {
+        expect(result.errors.where((AnalysisError error) {
+          return
+            error.errorCode != HintCode.DEAD_CODE &&
+            error.errorCode != HintCode.UNUSED_CATCH_CLAUSE &&
+              error.errorCode != HintCode.UNUSED_CATCH_STACK &&
+              error.errorCode != HintCode.UNUSED_ELEMENT &&
+              error.errorCode != HintCode.UNUSED_FIELD &&
+              error.errorCode != HintCode.UNUSED_IMPORT &&
+              error.errorCode != HintCode.UNUSED_LOCAL_VARIABLE;
+        }), isEmpty);
+      }
+    } else {
+      testUnit = await resolveLibraryUnit(testSource);
+      if (verifyNoTestUnitErrors) {
+        expect(context.getErrors(testSource).errors, isEmpty);
+      }
     }
     testUnitElement = testUnit.element;
     testLibraryElement = testUnitElement.library;
diff --git a/pkg/analysis_server/test/analysis/get_navigation_test.dart b/pkg/analysis_server/test/analysis/get_navigation_test.dart
index 5e262a7..085659e 100644
--- a/pkg/analysis_server/test/analysis/get_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/get_navigation_test.dart
@@ -15,6 +15,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(GetNavigationTest);
+    defineReflectiveTests(GetNavigationTest_Driver);
   });
 }
 
@@ -248,3 +249,13 @@
     regions = result.regions;
   }
 }
+
+@reflectiveTest
+class GetNavigationTest_Driver extends GetNavigationTest {
+  @override
+  void setUp() {
+    enableNewAnalysisDriver = true;
+    generateSummaryFiles = true;
+    super.setUp();
+  }
+}
diff --git a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
index 7d08f0f..c4c0435 100644
--- a/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_analysis_options_test.dart
@@ -4,11 +4,12 @@
 
 library test.analysis.notification_analysis_options_test;
 
-import 'package:analysis_server/plugin/protocol/protocol.dart';
+import 'package:analysis_server/plugin/protocol/protocol.dart'
+    hide AnalysisOptions;
 import 'package:analysis_server/src/constants.dart';
 import 'package:analysis_server/src/domain_analysis.dart';
 import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/services/lint.dart';
+import 'package:linter/src/rules.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -19,6 +20,8 @@
   defineReflectiveSuite(() {
     defineReflectiveTests(NewAnalysisOptionsFileNotificationTest);
     defineReflectiveTests(OldAnalysisOptionsFileNotificationTest);
+    defineReflectiveTests(NewAnalysisOptionsFileNotificationTest_Driver);
+    defineReflectiveTests(OldAnalysisOptionsFileNotificationTest_Driver);
   });
 }
 
@@ -39,8 +42,6 @@
 
   String get optionsFilePath;
 
-  AnalysisContext get testContext => server.getContainingContext(testFile);
-
   List<AnalysisError> get testFileErrors => filesErrors[testFile];
 
   void addOptionsFile(String contents) {
@@ -74,6 +75,7 @@
 
   @override
   void setUp() {
+    registerLintRules();
     super.setUp();
     server.handlers = [new AnalysisDomainHandler(server)];
   }
@@ -103,9 +105,14 @@
     await waitForTasksFinished();
 
     // Verify options file.
-    expect(optionsFileErrors, isEmpty);
+    if (!enableNewAnalysisDriver) {
+      // TODO(brianwilkerson) Implement options file analysis in the new driver.
+      expect(optionsFileErrors, isNotNull);
+      expect(optionsFileErrors, isEmpty);
+    }
 
     // Verify test file.
+    expect(testFileErrors, isNotNull);
     expect(testFileErrors, isEmpty);
   }
 
@@ -127,9 +134,14 @@
     await waitForTasksFinished();
 
     // Verify options file.
-    expect(optionsFileErrors, isEmpty);
+    if (!enableNewAnalysisDriver) {
+      // TODO(brianwilkerson) Implement options file analysis in the new driver.
+      expect(optionsFileErrors, isNotNull);
+      expect(optionsFileErrors, isEmpty);
+    }
 
     // Verify test file.
+    expect(testFileErrors, isNotNull);
     expect(testFileErrors, isEmpty);
 
     addOptionsFile('''
@@ -142,7 +154,10 @@
     await waitForTasksFinished();
 
     // Verify options file.
-    expect(optionsFileErrors, isEmpty);
+    if (!enableNewAnalysisDriver) {
+      // TODO(brianwilkerson) Implement options file analysis in the new driver.
+      expect(optionsFileErrors, isEmpty);
+    }
 
     // Verify test file.
     expect(testFileErrors, hasLength(1));
@@ -187,9 +202,12 @@
 
     await waitForTasksFinished();
 
-    expect(optionsFileErrors, hasLength(1));
-    expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.WARNING);
-    expect(optionsFileErrors.first.type, AnalysisErrorType.STATIC_WARNING);
+    if (!enableNewAnalysisDriver) {
+      // TODO(brianwilkerson) Implement options file analysis in the new driver.
+      expect(optionsFileErrors, hasLength(1));
+      expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.WARNING);
+      expect(optionsFileErrors.first.type, AnalysisErrorType.STATIC_WARNING);
+    }
   }
 
   test_options_file_added() async {
@@ -221,9 +239,13 @@
 
     await waitForTasksFinished();
 
-    expect(optionsFileErrors, hasLength(1));
-    expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.ERROR);
-    expect(optionsFileErrors.first.type, AnalysisErrorType.COMPILE_TIME_ERROR);
+    if (!enableNewAnalysisDriver) {
+      // TODO(brianwilkerson) Implement options file analysis in the new driver.
+      expect(optionsFileErrors, hasLength(1));
+      expect(optionsFileErrors.first.severity, AnalysisErrorSeverity.ERROR);
+      expect(
+          optionsFileErrors.first.type, AnalysisErrorType.COMPILE_TIME_ERROR);
+    }
   }
 
   test_options_file_removed() async {
@@ -287,14 +309,15 @@
   }
 
   void verifyLintsEnabled(List<String> lints) {
-    expect(testContext.analysisOptions.lint, true);
-    var rules = getLints(testContext).map((rule) => rule.name);
+    AnalysisOptions options = analysisOptions;
+    expect(options.lint, true);
+    var rules = options.lintRules.map((rule) => rule.name);
     expect(rules, unorderedEquals(lints));
   }
 
   verifyStrongMode({bool enabled}) {
     // Verify strong-mode enabled.
-    expect(testContext.analysisOptions.strongMode, enabled);
+    expect(analysisOptions.strongMode, enabled);
 
     if (enabled) {
       // Should produce a type warning.
@@ -311,11 +334,35 @@
 @reflectiveTest
 class NewAnalysisOptionsFileNotificationTest
     extends AnalysisOptionsFileNotificationTest {
+  @override
   String get optionsFilePath => '$projectPath/analysis_options.yaml';
 }
 
 @reflectiveTest
+class NewAnalysisOptionsFileNotificationTest_Driver
+    extends NewAnalysisOptionsFileNotificationTest {
+  @override
+  void setUp() {
+    enableNewAnalysisDriver = true;
+    generateSummaryFiles = true;
+    super.setUp();
+  }
+}
+
+@reflectiveTest
 class OldAnalysisOptionsFileNotificationTest
     extends AnalysisOptionsFileNotificationTest {
+  @override
   String get optionsFilePath => '$projectPath/.analysis_options';
 }
+
+@reflectiveTest
+class OldAnalysisOptionsFileNotificationTest_Driver
+    extends OldAnalysisOptionsFileNotificationTest {
+  @override
+  void setUp() {
+    enableNewAnalysisDriver = true;
+    generateSummaryFiles = true;
+    super.setUp();
+  }
+}
diff --git a/pkg/analysis_server/test/analysis/notification_analyzedFiles_test.dart b/pkg/analysis_server/test/analysis/notification_analyzedFiles_test.dart
index f9c95ae..25cef9d 100644
--- a/pkg/analysis_server/test/analysis/notification_analyzedFiles_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_analyzedFiles_test.dart
@@ -17,6 +17,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AnalysisNotificationAnalyzedFilesTest);
+    defineReflectiveTests(AnalysisNotificationAnalyzedFilesTest_Driver);
   });
 }
 
@@ -30,9 +31,9 @@
     expect(analyzedFiles, contains(filePath));
   }
 
-  Future prepareAnalyzedFiles() {
+  Future<Null> prepareAnalyzedFiles() async {
     addGeneralAnalysisSubscription(GeneralAnalysisService.ANALYZED_FILES);
-    return waitForTasksFinished();
+    await pumpEventQueue();
   }
 
   void processNotification(Notification notification) {
@@ -71,12 +72,11 @@
     // not trigger the notification to be re-sent.
     addTestFile('class A {}');
     await prepareAnalyzedFiles();
-    await waitForTasksFinished();
     expect(analyzedFilesReceived, isTrue);
+
     analyzedFilesReceived = false;
     modifyTestFile('class B {}');
-    await pumpEventQueue();
-    await waitForTasksFinished();
+    await prepareAnalyzedFiles();
     expect(analyzedFilesReceived, isFalse);
   }
 
@@ -85,10 +85,11 @@
     // re-sent, even if nothing has changed.
     addTestFile('class A {}');
     await prepareAnalyzedFiles();
-    await waitForTasksFinished();
     expect(analyzedFilesReceived, isTrue);
+
     unsubscribeAnalyzedFiles();
     analyzedFilesReceived = false;
+
     await prepareAnalyzedFiles();
     expect(analyzedFilesReceived, isTrue);
     assertHasFile(testFile);
@@ -98,15 +99,13 @@
     // Making a change that *does* affect the set of reachable files should
     // trigger the notification to be re-sent.
     addTestFile('class A {}');
-    addFile('/foo.dart', 'library foo');
+    addFile('/foo.dart', 'library foo;');
     await prepareAnalyzedFiles();
-    await waitForTasksFinished();
     expect(analyzedFilesReceived, isTrue);
+
     analyzedFilesReceived = false;
     modifyTestFile('import "/foo.dart";');
-    await pumpEventQueue();
-    await waitForTasksFinished();
-    expect(analyzedFilesReceived, isTrue);
+    await prepareAnalyzedFiles();
     assertHasFile('/foo.dart');
   }
 
@@ -114,3 +113,14 @@
     removeGeneralAnalysisSubscription(GeneralAnalysisService.ANALYZED_FILES);
   }
 }
+
+@reflectiveTest
+class AnalysisNotificationAnalyzedFilesTest_Driver
+    extends AnalysisNotificationAnalyzedFilesTest {
+  @override
+  void setUp() {
+    enableNewAnalysisDriver = true;
+    generateSummaryFiles = true;
+    super.setUp();
+  }
+}
diff --git a/pkg/analysis_server/test/analysis/notification_errors_test.dart b/pkg/analysis_server/test/analysis/notification_errors_test.dart
index 8ab02c3..9baa09f 100644
--- a/pkg/analysis_server/test/analysis/notification_errors_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_errors_test.dart
@@ -6,23 +6,28 @@
 
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:analysis_server/src/constants.dart';
+import 'package:analysis_server/src/context_manager.dart';
 import 'package:analysis_server/src/domain_analysis.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/lint/linter.dart';
 import 'package:analyzer/src/services/lint.dart';
-import 'package:linter/src/linter.dart';
+import 'package:linter/src/rules.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import '../analysis_abstract.dart';
+import '../mocks.dart';
 
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(NotificationErrorsTest);
+    defineReflectiveTests(NotificationErrorsTest_Driver);
   });
 }
 
 @reflectiveTest
-class NotificationErrorsTest extends AbstractAnalysisTest {
+class AbstractNotificationErrorsTest extends AbstractAnalysisTest {
   Map<String, List<AnalysisError>> filesErrors = {};
 
   void processNotification(Notification notification) {
@@ -34,6 +39,7 @@
 
   @override
   void setUp() {
+    registerLintRules();
     super.setUp();
     server.handlers = [
       new AnalysisDomainHandler(server),
@@ -47,6 +53,7 @@
 import 'does_not_exist.dart';
 ''');
     await waitForTasksFinished();
+    await pumpEventQueue();
     List<AnalysisError> errors = filesErrors[testFile];
     // Verify that we are generating only 1 error for the bad URI.
     // https://github.com/dart-lang/sdk/issues/23754
@@ -75,8 +82,16 @@
     handleSuccessfulRequest(request);
 
     await waitForTasksFinished();
-    AnalysisContext testContext = server.getContainingContext(testFile);
-    List<Linter> lints = getLints(testContext);
+    List<Linter> lints;
+    if (enableNewAnalysisDriver) {
+      AnalysisDriver testDriver = (server.contextManager as ContextManagerImpl)
+          .getContextInfoFor(resourceProvider.getFolder(projectPath))
+          .analysisDriver;
+      lints = testDriver.analysisOptions.lintRules;
+    } else {
+      AnalysisContext testContext = server.getContainingContext(testFile);
+      lints = getLints(testContext);
+    }
     // Registry should only contain single lint rule.
     expect(lints, hasLength(1));
     LintRule lint = lints.first as LintRule;
@@ -109,6 +124,7 @@
     createProject();
     addTestFile('library lib');
     await waitForTasksFinished();
+    await pumpEventQueue();
     List<AnalysisError> errors = filesErrors[testFile];
     expect(errors, hasLength(1));
     AnalysisError error = errors[0];
@@ -128,6 +144,7 @@
 }
 ''');
     await waitForTasksFinished();
+    await pumpEventQueue();
     List<AnalysisError> errors = filesErrors[testFile];
     expect(errors, hasLength(1));
     AnalysisError error = errors[0];
@@ -135,3 +152,16 @@
     expect(error.type, AnalysisErrorType.STATIC_WARNING);
   }
 }
+
+@reflectiveTest
+class NotificationErrorsTest extends AbstractNotificationErrorsTest {}
+
+@reflectiveTest
+class NotificationErrorsTest_Driver extends AbstractNotificationErrorsTest {
+  @override
+  void setUp() {
+    enableNewAnalysisDriver = true;
+    generateSummaryFiles = true;
+    super.setUp();
+  }
+}
diff --git a/pkg/analysis_server/test/analysis/update_content_test.dart b/pkg/analysis_server/test/analysis/update_content_test.dart
index 788088f..005528e 100644
--- a/pkg/analysis_server/test/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/analysis/update_content_test.dart
@@ -9,6 +9,7 @@
 import 'package:analysis_server/src/constants.dart';
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
@@ -293,7 +294,9 @@
 
   @override
   bool matches(arg) {
-    return arg is CompilationUnit && arg.element.source.fullName == file;
+    return arg is CompilationUnit &&
+        resolutionMap.elementDeclaredByCompilationUnit(arg).source.fullName ==
+            file;
   }
 }
 
diff --git a/pkg/analysis_server/test/analysis_abstract.dart b/pkg/analysis_server/test/analysis_abstract.dart
index d9f8984..c147c23 100644
--- a/pkg/analysis_server/test/analysis_abstract.dart
+++ b/pkg/analysis_server/test/analysis_abstract.dart
@@ -6,20 +6,20 @@
 
 import 'dart:async';
 
-import 'package:analysis_server/plugin/protocol/protocol.dart';
+import 'package:analysis_server/plugin/protocol/protocol.dart'
+    hide AnalysisOptions;
 import 'package:analysis_server/src/analysis_server.dart';
 import 'package:analysis_server/src/constants.dart';
 import 'package:analysis_server/src/domain_analysis.dart';
-import 'package:analysis_server/src/plugin/linter_plugin.dart';
 import 'package:analysis_server/src/plugin/server_plugin.dart';
 import 'package:analysis_server/src/provisional/completion/dart/completion_plugin.dart';
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/instrumentation/instrumentation.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/sdk.dart';
-import 'package:linter/src/plugin/linter_plugin.dart';
 import 'package:plugin/manager.dart';
 import 'package:plugin/plugin.dart';
 import 'package:test/test.dart';
@@ -46,6 +46,8 @@
  * An abstract base for all 'analysis' domain tests.
  */
 class AbstractAnalysisTest {
+  bool enableNewAnalysisDriver = false;
+  bool generateSummaryFiles = false;
   MockServerChannel serverChannel;
   MemoryResourceProvider resourceProvider;
   MockPackageMapProvider packageMapProvider;
@@ -67,8 +69,14 @@
   AnalysisDomainHandler get analysisHandler => server.handlers
       .singleWhere((handler) => handler is AnalysisDomainHandler);
 
+  AnalysisOptions get analysisOptions => enableNewAnalysisDriver
+      ? testDiver.analysisOptions
+      : testContext.analysisOptions;
+
   AnalysisContext get testContext => server.getAnalysisContext(testFile);
 
+  AnalysisDriver get testDiver => server.getAnalysisDriver(testFile);
+
   void addAnalysisSubscription(AnalysisService service, String file) {
     // add file to subscription
     var files = analysisSubscriptions[service];
@@ -111,12 +119,8 @@
     ServerPlugin serverPlugin = new ServerPlugin();
     List<Plugin> plugins = <Plugin>[];
     plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-    plugins.add(AnalysisEngine.instance.commandLinePlugin);
-    plugins.add(AnalysisEngine.instance.optionsPlugin);
     plugins.add(serverPlugin);
     plugins.add(dartCompletionPlugin);
-    plugins.add(linterPlugin);
-    plugins.add(linterServerPlugin);
     addServerPlugins(plugins);
     //
     // Process plugins
@@ -126,18 +130,22 @@
     //
     // Create an SDK in the mock file system.
     //
-    new MockSdk(resourceProvider: resourceProvider);
+    new MockSdk(
+        generateSummaryFiles: generateSummaryFiles,
+        resourceProvider: resourceProvider);
     //
     // Create server
     //
+    AnalysisServerOptions options = new AnalysisServerOptions();
+    options.enableNewAnalysisDriver = enableNewAnalysisDriver;
     return new AnalysisServer(
         serverChannel,
         resourceProvider,
         packageMapProvider,
         index,
         serverPlugin,
-        new AnalysisServerOptions(),
-        new DartSdkManager(resourceProvider.convertPath('/'), false),
+        options,
+        new DartSdkManager(resourceProvider.convertPath('/'), true),
         InstrumentationService.NULL_SERVICE);
   }
 
@@ -189,7 +197,8 @@
   }
 
   String modifyTestFile(String content) {
-    addFile(testFile, content);
+    String path = resourceProvider.convertPath(testFile);
+    resourceProvider.updateFile(path, content);
     this.testCode = content;
     return testFile;
   }
diff --git a/pkg/analysis_server/test/analysis_server_test.dart b/pkg/analysis_server/test/analysis_server_test.dart
index a76d57b..d4df528 100644
--- a/pkg/analysis_server/test/analysis_server_test.dart
+++ b/pkg/analysis_server/test/analysis_server_test.dart
@@ -121,20 +121,18 @@
     });
   }
 
-  void processRequiredPlugins() {
+  void processRequiredPlugins(ServerPlugin serverPlugin) {
     List<Plugin> plugins = <Plugin>[];
     plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-    plugins.add(AnalysisEngine.instance.optionsPlugin);
-    plugins.add(server.serverPlugin);
+    plugins.add(serverPlugin);
 
     ExtensionManager manager = new ExtensionManager();
     manager.processPlugins(plugins);
   }
 
   void setUp() {
-    ExtensionManager manager = new ExtensionManager();
-    ServerPlugin plugin = new ServerPlugin();
-    manager.processPlugins([plugin]);
+    ServerPlugin serverPlugin = new ServerPlugin();
+    processRequiredPlugins(serverPlugin);
     channel = new MockServerChannel();
     resourceProvider = new MemoryResourceProvider();
     // Create an SDK in the mock file system.
@@ -145,12 +143,11 @@
         resourceProvider,
         packageMapProvider,
         null,
-        plugin,
+        serverPlugin,
         new AnalysisServerOptions(),
         new DartSdkManager('/', false),
         InstrumentationService.NULL_SERVICE,
         rethrowExceptions: true);
-    processRequiredPlugins();
   }
 
   Future test_contextDisposed() {
diff --git a/pkg/analysis_server/test/completion_test.dart b/pkg/analysis_server/test/completion_test.dart
index 93483ce..154f29b 100644
--- a/pkg/analysis_server/test/completion_test.dart
+++ b/pkg/analysis_server/test/completion_test.dart
@@ -863,15 +863,7 @@
         'testCommentSnippets083b',
         '''
 main() { null.!1 }''',
-        <String>["1+toString"],
-        failingTests: '1');
-
-    buildTests(
-        'testCommentSnippets084',
-        '''
-class List{}class Map{}typedef X = !1Lis!2t with !3Ma!4p;''',
-        <String>["1+Map", "2+List", "2-Map", "3+List", "4+Map", "4-List"],
-        failingTests: '1234');
+        <String>["1+toString"]);
 
     buildTests(
         'testCommentSnippets085',
@@ -2436,10 +2428,8 @@
         '''
 !1class Aclass {}
 class Bclass !2extends!3 !4Aclass {}
-!5typedef Ctype = !6Bclass with !7Aclass;
-class Dclass extends !8Ctype {}
-!9abstract class Eclass implements Dclass,!C Ctype, Bclass {}
-class Fclass extends Bclass !Awith !B Eclass {}''',
+!5abstract class Eclass implements Aclass, Bclass {}
+class Fclass extends Bclass !6with !7 Eclass {}''',
         <String>[
           "1+class",
           "1-implements",
@@ -2449,21 +2439,13 @@
           "3+extends",
           "4+Aclass",
           "4-Bclass",
-          "5+typedef",
-          "6+Bclass",
-          "6-Ctype",
-          "7+Aclass",
-          "7-Bclass",
-          "8+Ctype",
-          "9+abstract",
-          "A+with",
-          "B+Eclass",
-          "B-Dclass",
-          "B-Ctype",
-          "C+Bclass",
-          "C-Eclass"
+          "5+abstract",
+          "6+with",
+          "7+Eclass",
+          "7-Dclass",
+          "7-Ctype",
         ],
-        failingTests: '23467ABC');
+        failingTests: '23467');
 
     // keywords
     buildTests(
@@ -2665,8 +2647,7 @@
 }''',
         <String>["1+true", "1+truefalse", "1-falsetrue"]);
 
-    buildTests('test020', '''var x = null.!1''', <String>["1+toString"],
-        failingTests: '1');
+    buildTests('test020', '''var x = null.!1''', <String>["1+toString"]);
 
     buildTests('test021', '''var x = .!1''', <String>["1-toString"]);
 
diff --git a/pkg/analysis_server/test/context_manager_driver_test.dart b/pkg/analysis_server/test/context_manager_driver_test.dart
new file mode 100644
index 0000000..4930908
--- /dev/null
+++ b/pkg/analysis_server/test/context_manager_driver_test.dart
@@ -0,0 +1,106 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'context_manager_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(AbstractContextManagerTest_Driver);
+    defineReflectiveTests(ContextManagerWithNewOptionsTest_Driver);
+    defineReflectiveTests(ContextManagerWithOldOptionsTest_Driver);
+  });
+}
+
+@reflectiveTest
+class AbstractContextManagerTest_Driver extends AbstractContextManagerTest {
+  bool get enableAnalysisDriver => true;
+
+  @failingTest
+  test_embedder_added() {
+    // NoSuchMethodError: The getter 'apiSignature' was called on null.
+    // Receiver: null
+    // Tried calling: apiSignature
+    // dart:core                                                          Object.noSuchMethod
+    // package:analyzer/src/dart/analysis/driver.dart 460:20              AnalysisDriver.configure
+    // package:analysis_server/src/context_manager.dart 1043:16           ContextManagerImpl._checkForPackagespecUpdate
+    // package:analysis_server/src/context_manager.dart 1553:5            ContextManagerImpl._handleWatchEvent
+    //return super.test_embedder_added();
+    fail('NoSuchMethodError');
+  }
+}
+
+@reflectiveTest
+class ContextManagerWithNewOptionsTest_Driver
+    extends ContextManagerWithNewOptionsTest {
+  bool get enableAnalysisDriver => true;
+
+  @failingTest
+  test_analysis_options_file_delete_with_embedder() async {
+    // This fails because the ContextBuilder doesn't pick up the strongMode
+    // flag from the embedder.yaml file.
+    return super.test_analysis_options_file_delete_with_embedder();
+  }
+
+  @failingTest
+  test_embedder_options() async {
+    // This fails because the ContextBuilder doesn't pick up the strongMode
+    // flag from the embedder.yaml file.
+    return super.test_embedder_options();
+  }
+
+  @failingTest
+  test_optionsFile_update_strongMode() async {
+    // It appears that this fails because we are not correctly updating the
+    // analysis options in the driver when the file is modified.
+    //return super.test_optionsFile_update_strongMode();
+    // After a few other changes, the test now times out on my machine, so I'm
+    // disabling it in order to prevent it from being flaky.
+    fail('Test times out');
+  }
+
+  @failingTest
+  test_path_filter_analysis_option() async {
+    // This fails because we're not analyzing the analyis options file.
+    return super.test_path_filter_analysis_option();
+  }
+}
+
+@reflectiveTest
+class ContextManagerWithOldOptionsTest_Driver
+    extends ContextManagerWithOldOptionsTest {
+  bool get enableAnalysisDriver => true;
+
+  @failingTest
+  test_analysis_options_file_delete_with_embedder() async {
+    // This fails because the ContextBuilder doesn't pick up the strongMode
+    // flag from the embedder.yaml file.
+    return super.test_analysis_options_file_delete_with_embedder();
+  }
+
+  @failingTest
+  test_embedder_options() async {
+    // This fails because the ContextBuilder doesn't pick up the strongMode
+    // flag from the embedder.yaml file.
+    return super.test_embedder_options();
+  }
+
+  @failingTest
+  test_optionsFile_update_strongMode() async {
+    // It appears that this fails because we are not correctly updating the
+    // analysis options in the driver when the file is modified.
+    //return super.test_optionsFile_update_strongMode();
+    // After a few other changes, the test now times out on my machine, so I'm
+    // disabling it in order to prevent it from being flaky.
+    fail('Test times out');
+  }
+
+  @failingTest
+  test_path_filter_analysis_option() async {
+    // This fails because we're not analyzing the analyis options file.
+    return super.test_path_filter_analysis_option();
+  }
+}
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart
index 46a2d44..4f51e86 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -7,21 +7,25 @@
 import 'dart:collection';
 
 import 'package:analysis_server/src/context_manager.dart';
+import 'package:analysis_server/src/utilities/null_string_sink.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/instrumentation/instrumentation.dart';
 import 'package:analyzer/source/error_processor.dart';
 import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
 import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/services/lint.dart';
+import 'package:analyzer/src/summary/summary_file_builder.dart';
 import 'package:analyzer/src/util/glob.dart';
-import 'package:linter/src/plugin/linter_plugin.dart';
+import 'package:linter/src/rules.dart';
 import 'package:linter/src/rules/avoid_as.dart';
 import 'package:path/path.dart' as path;
 import 'package:plugin/manager.dart';
@@ -52,19 +56,32 @@
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // Make sure that there really are contexts for both the main project and
     // the subproject.
-    Folder projFolder = resourceProvider.getFolder(projPath);
-    ContextInfo projContextInfo = manager.getContextInfoFor(projFolder);
+    Folder projectFolder = resourceProvider.getFolder(projPath);
+    ContextInfo projContextInfo = manager.getContextInfoFor(projectFolder);
     expect(projContextInfo, isNotNull);
-    expect(projContextInfo.folder, projFolder);
+    expect(projContextInfo.folder, projectFolder);
     ContextInfo subProjContextInfo = manager.getContextInfoFor(subProjFolder);
     expect(subProjContextInfo, isNotNull);
     expect(subProjContextInfo.folder, subProjFolder);
-    expect(projContextInfo.context != subProjContextInfo.context, isTrue);
-    // Check that contextsInAnalysisRoot() works.
-    List<AnalysisContext> contexts = manager.contextsInAnalysisRoot(projFolder);
-    expect(contexts, hasLength(2));
-    expect(contexts, contains(projContextInfo.context));
-    expect(contexts, contains(subProjContextInfo.context));
+    if (enableAnalysisDriver) {
+      expect(projContextInfo.analysisDriver,
+          isNot(equals(subProjContextInfo.analysisDriver)));
+      // Check that getDriversInAnalysisRoot() works.
+      List<AnalysisDriver> drivers =
+          manager.getDriversInAnalysisRoot(projectFolder);
+      expect(drivers, isNotNull);
+      expect(drivers, hasLength(2));
+      expect(drivers, contains(projContextInfo.analysisDriver));
+      expect(drivers, contains(subProjContextInfo.analysisDriver));
+    } else {
+      expect(projContextInfo.context != subProjContextInfo.context, isTrue);
+      // Check that contextsInAnalysisRoot() works.
+      List<AnalysisContext> contexts =
+          manager.contextsInAnalysisRoot(projectFolder);
+      expect(contexts, hasLength(2));
+      expect(contexts, contains(projContextInfo.context));
+      expect(contexts, contains(subProjContextInfo.context));
+    }
   }
 
   test_embedder_added() async {
@@ -93,14 +110,21 @@
     // Setup context.
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     await pumpEventQueue();
-    // Confirm that one context was created.
-    List<AnalysisContext> contexts =
-        manager.contextsInAnalysisRoot(projectFolder);
-    expect(contexts, isNotNull);
-    expect(contexts, hasLength(1));
+    // Confirm that one driver / context was created.
+    if (enableAnalysisDriver) {
+      List<AnalysisDriver> drivers =
+          manager.getDriversInAnalysisRoot(projectFolder);
+      expect(drivers, isNotNull);
+      expect(drivers, hasLength(1));
+    } else {
+      List<AnalysisContext> contexts =
+          manager.contextsInAnalysisRoot(projectFolder);
+      expect(contexts, isNotNull);
+      expect(contexts, hasLength(1));
+    }
 
     // No embedded libs yet.
-    expect(contexts.first.sourceFactory.forUri('dart:typed_data'), isNull);
+    expect(sourceFactory.forUri('dart:typed_data'), isNull);
 
     // Add .packages file that introduces a dependency with embedded libs.
     newFile(
@@ -110,14 +134,22 @@
 
     await pumpEventQueue();
 
-    contexts = manager.contextsInAnalysisRoot(projectFolder);
+    // Confirm that we still have just one driver / context.
+    if (enableAnalysisDriver) {
+      List<AnalysisDriver> drivers =
+          manager.getDriversInAnalysisRoot(projectFolder);
+      expect(drivers, isNotNull);
+      expect(drivers, hasLength(1));
+    } else {
+      List<AnalysisContext> contexts =
+          manager.contextsInAnalysisRoot(projectFolder);
 
-    // Confirm that we still have just one context.
-    expect(contexts, isNotNull);
-    expect(contexts, hasLength(1));
+      expect(contexts, isNotNull);
+      expect(contexts, hasLength(1));
+    }
 
     // Embedded lib should be defined now.
-    expect(contexts.first.sourceFactory.forUri('dart:typed_data'), isNotNull);
+    expect(sourceFactory.forUri('dart:typed_data'), isNotNull);
   }
 
   test_embedder_packagespec() async {
@@ -151,16 +183,15 @@
         manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
     expect(contexts, isNotNull);
     expect(contexts.length, equals(1));
-    var context = contexts[0];
-    var source = context.sourceFactory.forUri('dart:foobar');
+    var source = sourceFactory.forUri('dart:foobar');
     expect(source, isNotNull);
     expect(source.fullName, '/my/proj/sdk_ext/entry.dart');
     // We can't find dart:core because we didn't list it in our
     // embedded_libs map.
-    expect(context.sourceFactory.forUri('dart:core'), isNull);
+    expect(sourceFactory.forUri('dart:core'), isNull);
     // We can find dart:typed_data because we listed it in our
     // embedded_libs map.
-    expect(context.sourceFactory.forUri('dart:typed_data'), isNotNull);
+    expect(sourceFactory.forUri('dart:typed_data'), isNotNull);
   }
 
   test_ignoreFilesInPackagesFolder() {
@@ -172,12 +203,12 @@
     resourceProvider.newFile(filePath1, 'contents');
     // "packages" files are ignored initially
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
-    expect(callbacks.currentContextFilePaths[projPath], isEmpty);
+    expect(callbacks.currentFilePaths, isEmpty);
     // "packages" files are ignored during watch
     String filePath2 = path.posix.join(projPath, 'packages', 'file2.dart');
     resourceProvider.newFile(filePath2, 'contents');
     return pumpEventQueue().then((_) {
-      expect(callbacks.currentContextFilePaths[projPath], isEmpty);
+      expect(callbacks.currentFilePaths, isEmpty);
     });
   }
 
@@ -224,7 +255,7 @@
     // Setup context.
     Folder root = resourceProvider.newFolder(projPath);
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
-    expect(callbacks.currentContextFilePaths[projPath], isEmpty);
+    expect(callbacks.currentFilePaths, isEmpty);
     // Set ignore patterns for context.
     ContextInfo rootInfo = manager.getContextInfoFor(root);
     manager.setIgnorePatternsForContext(
@@ -241,12 +272,9 @@
     // Pump event loop so new files are discovered and added to context.
     await pumpEventQueue();
     // Verify that ignored files were ignored.
-    Map<String, int> fileTimestamps =
-        callbacks.currentContextFilePaths[projPath];
-    expect(fileTimestamps, isNotEmpty);
-    List<String> files = fileTimestamps.keys.toList();
-    expect(files.length, equals(1));
-    expect(files[0], equals('/my/proj/lib/main.dart'));
+    Iterable<String> filePaths = callbacks.currentFilePaths;
+    expect(filePaths, hasLength(1));
+    expect(filePaths, contains('/my/proj/lib/main.dart'));
   }
 
   test_refresh_folder_with_packagespec() {
@@ -255,11 +283,11 @@
     resourceProvider.newFile(packagespecFile, '');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     return pumpEventQueue().then((_) {
-      expect(callbacks.currentContextPaths.toList(), [projPath]);
+      expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
       callbacks.now++;
       manager.refresh(null);
       return pumpEventQueue().then((_) {
-        expect(callbacks.currentContextPaths.toList(), [projPath]);
+        expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
         expect(callbacks.currentContextTimestamps[projPath], callbacks.now);
       });
     });
@@ -279,13 +307,13 @@
     resourceProvider.newFile(packagespec2Path, '');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     return pumpEventQueue().then((_) {
-      expect(callbacks.currentContextPaths.toSet(),
-          [subdir1Path, subdir2Path, projPath].toSet());
+      expect(callbacks.currentContextRoots,
+          unorderedEquals([subdir1Path, subdir2Path, projPath]));
       callbacks.now++;
       manager.refresh(null);
       return pumpEventQueue().then((_) {
-        expect(callbacks.currentContextPaths.toSet(),
-            [subdir1Path, subdir2Path, projPath].toSet());
+        expect(callbacks.currentContextRoots,
+            unorderedEquals([subdir1Path, subdir2Path, projPath]));
         expect(callbacks.currentContextTimestamps[projPath], callbacks.now);
         expect(callbacks.currentContextTimestamps[subdir1Path], callbacks.now);
         expect(callbacks.currentContextTimestamps[subdir2Path], callbacks.now);
@@ -299,11 +327,11 @@
     resourceProvider.newFile(pubspecPath, 'pubspec');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     return pumpEventQueue().then((_) {
-      expect(callbacks.currentContextPaths.toList(), [projPath]);
+      expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
       callbacks.now++;
       manager.refresh(null);
       return pumpEventQueue().then((_) {
-        expect(callbacks.currentContextPaths.toList(), [projPath]);
+        expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
         expect(callbacks.currentContextTimestamps[projPath], callbacks.now);
       });
     });
@@ -320,13 +348,13 @@
     resourceProvider.newFile(pubspec2Path, 'pubspec');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     return pumpEventQueue().then((_) {
-      expect(callbacks.currentContextPaths.toSet(),
-          [subdir1Path, subdir2Path, projPath].toSet());
+      expect(callbacks.currentContextRoots,
+          unorderedEquals([subdir1Path, subdir2Path, projPath]));
       callbacks.now++;
       manager.refresh(null);
       return pumpEventQueue().then((_) {
-        expect(callbacks.currentContextPaths.toSet(),
-            [subdir1Path, subdir2Path, projPath].toSet());
+        expect(callbacks.currentContextRoots,
+            unorderedEquals([subdir1Path, subdir2Path, projPath]));
         expect(callbacks.currentContextTimestamps[projPath], callbacks.now);
         expect(callbacks.currentContextTimestamps[subdir1Path], callbacks.now);
         expect(callbacks.currentContextTimestamps[subdir2Path], callbacks.now);
@@ -347,12 +375,12 @@
     List<String> roots = <String>[projPath, proj2Path];
     manager.setRoots(roots, <String>[], <String, String>{});
     return pumpEventQueue().then((_) {
-      expect(callbacks.currentContextPaths.toList(), unorderedEquals(roots));
+      expect(callbacks.currentContextRoots, unorderedEquals(roots));
       int then = callbacks.now;
       callbacks.now++;
       manager.refresh([resourceProvider.getResource(proj2Path)]);
       return pumpEventQueue().then((_) {
-        expect(callbacks.currentContextPaths.toList(), unorderedEquals(roots));
+        expect(callbacks.currentContextRoots, unorderedEquals(roots));
         expect(callbacks.currentContextTimestamps[projPath], then);
         expect(callbacks.currentContextTimestamps[proj2Path], callbacks.now);
       });
@@ -388,8 +416,7 @@
         manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
     expect(contexts, isNotNull);
     expect(contexts.length, equals(1));
-    var context = contexts[0];
-    var source = context.sourceFactory.forUri('dart:foobar');
+    var source = sourceFactory.forUri('dart:foobar');
     expect(source.fullName, equals('/my/proj/sdk_ext/entry.dart'));
   }
 
@@ -398,15 +425,21 @@
     resourceProvider.newFile(filePath, 'contents');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // verify
-    var filePaths = callbacks.currentContextFilePaths[projPath];
+    Iterable<String> filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
     expect(filePaths, contains(filePath));
-    List<AnalysisContext> contextsInAnalysisRoot =
-        manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
-    expect(contextsInAnalysisRoot, hasLength(1));
-    AnalysisContext context = contextsInAnalysisRoot[0];
-    expect(context, isNotNull);
-    Source result = context.sourceFactory.forUri('package:foo/foo.dart');
+    if (enableAnalysisDriver) {
+      List<AnalysisDriver> drivers = manager
+          .getDriversInAnalysisRoot(resourceProvider.newFolder(projPath));
+      expect(drivers, hasLength(1));
+      expect(drivers[0], isNotNull);
+    } else {
+      List<AnalysisContext> contextsInAnalysisRoot =
+          manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
+      expect(contextsInAnalysisRoot, hasLength(1));
+      expect(contextsInAnalysisRoot[0], isNotNull);
+    }
+    Source result = sourceFactory.forUri('package:foo/foo.dart');
     expect(result, isNotNull);
     expect(result.exists(), isFalse);
   }
@@ -416,7 +449,7 @@
     resourceProvider.newFile(filePath, 'contents');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // verify
-    var filePaths = callbacks.currentContextFilePaths[projPath];
+    Iterable<String> filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
     expect(filePaths, contains(filePath));
   }
@@ -426,8 +459,7 @@
     resourceProvider.newDummyLink(filePath);
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // verify
-    var filePaths = callbacks.currentContextFilePaths[projPath];
-    expect(filePaths, isEmpty);
+    expect(callbacks.currentFilePaths, isEmpty);
   }
 
   void test_setRoots_addFolderWithNestedPackageSpec() {
@@ -445,15 +477,15 @@
 
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
 
-    expect(callbacks.currentContextPaths, hasLength(2));
+    expect(callbacks.currentContextRoots, hasLength(2));
 
-    expect(callbacks.currentContextPaths, contains(projPath));
-    Set<Source> projSources = callbacks.currentContextSources[projPath];
+    expect(callbacks.currentContextRoots, contains(projPath));
+    Iterable<Source> projSources = callbacks.currentFileSources(projPath);
     expect(projSources, hasLength(1));
     expect(projSources.first.uri.toString(), 'file:///my/proj/lib/main.dart');
 
-    expect(callbacks.currentContextPaths, contains(examplePath));
-    Set<Source> exampleSources = callbacks.currentContextSources[examplePath];
+    expect(callbacks.currentContextRoots, contains(examplePath));
+    Iterable<Source> exampleSources = callbacks.currentFileSources(examplePath);
     expect(exampleSources, hasLength(1));
     expect(exampleSources.first.uri.toString(),
         'file:///my/proj/example/example.dart');
@@ -471,15 +503,15 @@
 
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
 
-    expect(callbacks.currentContextPaths, hasLength(2));
+    expect(callbacks.currentContextRoots, hasLength(2));
 
-    expect(callbacks.currentContextPaths, contains(projPath));
-    Set<Source> projSources = callbacks.currentContextSources[projPath];
+    expect(callbacks.currentContextRoots, contains(projPath));
+    Iterable<Source> projSources = callbacks.currentFileSources(projPath);
     expect(projSources, hasLength(1));
     expect(projSources.first.uri.toString(), 'package:proj/main.dart');
 
-    expect(callbacks.currentContextPaths, contains(examplePath));
-    Set<Source> exampleSources = callbacks.currentContextSources[examplePath];
+    expect(callbacks.currentContextRoots, contains(examplePath));
+    Iterable<Source> exampleSources = callbacks.currentFileSources(examplePath);
     expect(exampleSources, hasLength(1));
     expect(exampleSources.first.uri.toString(),
         'file:///my/proj/example/example.dart');
@@ -489,9 +521,8 @@
     packageMapProvider.packageMap = null;
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // verify
-    expect(callbacks.currentContextPaths, hasLength(1));
-    expect(callbacks.currentContextPaths, contains(projPath));
-    expect(callbacks.currentContextFilePaths[projPath], hasLength(0));
+    expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
+    expect(callbacks.currentFilePaths, hasLength(0));
   }
 
   void test_setRoots_addFolderWithPackagespec() {
@@ -506,12 +537,10 @@
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
 
     // verify
-    expect(callbacks.currentContextPaths, hasLength(1));
-    expect(callbacks.currentContextPaths, contains(projPath));
-    expect(callbacks.currentContextFilePaths[projPath], hasLength(1));
+    expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
+    expect(callbacks.currentFilePaths, hasLength(1));
 
     // smoketest resolution
-    SourceFactory sourceFactory = callbacks.currentContext.sourceFactory;
     Source resolvedSource =
         sourceFactory.resolveUri(source, 'package:unittest/unittest.dart');
     expect(resolvedSource, isNotNull);
@@ -527,8 +556,7 @@
     String packageRootPath = '/package/root/';
     manager.setRoots(<String>[projPath], <String>[],
         <String, String>{projPath: packageRootPath});
-    expect(callbacks.currentContextPaths, hasLength(1));
-    expect(callbacks.currentContextPaths, contains(projPath));
+    expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
     _checkPackageRoot(projPath, packageRootPath);
   }
 
@@ -537,9 +565,8 @@
     resourceProvider.newFile(pubspecPath, 'pubspec');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // verify
-    expect(callbacks.currentContextPaths, hasLength(1));
-    expect(callbacks.currentContextPaths, contains(projPath));
-    expect(callbacks.currentContextFilePaths[projPath], hasLength(0));
+    expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
+    expect(callbacks.currentFilePaths, hasLength(0));
   }
 
   void test_setRoots_addFolderWithPubspec_andPackagespec() {
@@ -566,10 +593,9 @@
     String testFilePath = newFile([testPath, 'main_test.dart']);
 
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
-    Set<Source> sources = callbacks.currentContextSources[projPath];
+    Iterable<Source> sources = callbacks.currentFileSources(projPath);
 
-    expect(callbacks.currentContextPaths, hasLength(1));
-    expect(callbacks.currentContextPaths, contains(projPath));
+    expect(callbacks.currentContextRoots, unorderedEquals([projPath]));
     expect(sources, hasLength(4));
     List<String> uris =
         sources.map((Source source) => source.uri.toString()).toList();
@@ -839,8 +865,7 @@
         }
       }
     }
-    expect(callbacks.currentContextPaths, hasLength(2));
-    expect(callbacks.currentContextPaths, unorderedEquals([project, example]));
+    expect(callbacks.currentContextRoots, unorderedEquals([project, example]));
   }
 
   void test_setRoots_nested_includedByOuter_outerPubspec() {
@@ -862,8 +887,7 @@
         expect(projectInfo.children, isEmpty);
       }
     }
-    expect(callbacks.currentContextPaths, hasLength(1));
-    expect(callbacks.currentContextPaths, unorderedEquals([project]));
+    expect(callbacks.currentContextRoots, unorderedEquals([project]));
   }
 
   void test_setRoots_nested_includedByOuter_twoPubspecs() {
@@ -891,8 +915,7 @@
         }
       }
     }
-    expect(callbacks.currentContextPaths, hasLength(2));
-    expect(callbacks.currentContextPaths, unorderedEquals([project, example]));
+    expect(callbacks.currentContextRoots, unorderedEquals([project, example]));
   }
 
   void test_setRoots_newFolderWithPackageRoot() {
@@ -933,9 +956,9 @@
     resourceProvider.newFile(pubspecPath, 'name: test');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // verify
-    expect(callbacks.currentContextPaths, hasLength(1));
-    expect(callbacks.currentContextPaths, contains(projPath));
-    expect(callbacks.currentContextFilePaths[projPath], hasLength(0));
+    expect(callbacks.currentContextRoots, hasLength(1));
+    expect(callbacks.currentContextRoots, contains(projPath));
+    expect(callbacks.currentFilePaths, hasLength(0));
   }
 
   void test_setRoots_noContext_inPackagesFolder() {
@@ -943,9 +966,9 @@
     resourceProvider.newFile(pubspecPath, 'name: test');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // verify
-    expect(callbacks.currentContextPaths, hasLength(1));
-    expect(callbacks.currentContextPaths, contains(projPath));
-    expect(callbacks.currentContextFilePaths[projPath], hasLength(0));
+    expect(callbacks.currentContextRoots, hasLength(1));
+    expect(callbacks.currentContextRoots, contains(projPath));
+    expect(callbacks.currentFilePaths, hasLength(0));
   }
 
   void test_setRoots_packageResolver() {
@@ -954,12 +977,18 @@
     resourceProvider.newFile(filePath, 'contents');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
 
-    List<AnalysisContext> contextsInAnalysisRoot =
-        manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
-    expect(contextsInAnalysisRoot, hasLength(1));
-    AnalysisContext context = contextsInAnalysisRoot[0];
-    expect(context, isNotNull);
-    Source result = context.sourceFactory.forUri('package:foo/foo.dart');
+    if (enableAnalysisDriver) {
+      var drivers = manager
+          .getDriversInAnalysisRoot(resourceProvider.newFolder(projPath));
+      expect(drivers, hasLength(1));
+      expect(drivers[0], isNotNull);
+    } else {
+      List<AnalysisContext> contextsInAnalysisRoot =
+          manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
+      expect(contextsInAnalysisRoot, hasLength(1));
+      expect(contextsInAnalysisRoot[0], isNotNull);
+    }
+    Source result = sourceFactory.forUri('package:foo/foo.dart');
     expect(result.fullName, filePath);
   }
 
@@ -980,11 +1009,11 @@
     packageMapProvider.packageMap = null;
     // add one root - there is a context
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
-    expect(callbacks.currentContextPaths, hasLength(1));
+    expect(callbacks.currentContextRoots, hasLength(1));
     // set empty roots - no contexts
     manager.setRoots(<String>[], <String>[], <String, String>{});
-    expect(callbacks.currentContextPaths, hasLength(0));
-    expect(callbacks.currentContextFilePaths, hasLength(0));
+    expect(callbacks.currentContextRoots, hasLength(0));
+    expect(callbacks.currentFilePaths, hasLength(0));
   }
 
   void test_setRoots_removeFolderWithPackagespec() {
@@ -994,12 +1023,12 @@
     // add one root - there is a context
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     expect(manager.changeSubscriptions, hasLength(1));
-    expect(callbacks.currentContextPaths, hasLength(1));
+    expect(callbacks.currentContextRoots, hasLength(1));
     // set empty roots - no contexts
     manager.setRoots(<String>[], <String>[], <String, String>{});
     expect(manager.changeSubscriptions, hasLength(0));
-    expect(callbacks.currentContextPaths, hasLength(0));
-    expect(callbacks.currentContextFilePaths, hasLength(0));
+    expect(callbacks.currentContextRoots, hasLength(0));
+    expect(callbacks.currentFilePaths, hasLength(0));
   }
 
   void test_setRoots_removeFolderWithPackagespecFolder() {
@@ -1043,11 +1072,11 @@
     resourceProvider.newFile(pubspecPath, 'pubspec');
     // add one root - there is a context
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
-    expect(callbacks.currentContextPaths, hasLength(1));
+    expect(callbacks.currentContextRoots, hasLength(1));
     // set empty roots - no contexts
     manager.setRoots(<String>[], <String>[], <String, String>{});
-    expect(callbacks.currentContextPaths, hasLength(0));
-    expect(callbacks.currentContextFilePaths, hasLength(0));
+    expect(callbacks.currentContextRoots, hasLength(0));
+    expect(callbacks.currentFilePaths, hasLength(0));
   }
 
   void test_setRoots_removeFolderWithPubspecFolder() {
@@ -1119,27 +1148,26 @@
   test_watch_addDummyLink() {
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // empty folder initially
-    Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
-    expect(filePaths, isEmpty);
+    expect(callbacks.currentFilePaths, isEmpty);
     // add link
     String filePath = path.posix.join(projPath, 'foo.dart');
     resourceProvider.newDummyLink(filePath);
     // the link was ignored
     return pumpEventQueue().then((_) {
-      expect(filePaths, isEmpty);
+      expect(callbacks.currentFilePaths, isEmpty);
     });
   }
 
   test_watch_addFile() {
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // empty folder initially
-    Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
-    expect(filePaths, hasLength(0));
+    expect(callbacks.currentFilePaths, hasLength(0));
     // add file
     String filePath = path.posix.join(projPath, 'foo.dart');
     resourceProvider.newFile(filePath, 'contents');
     // the file was added
     return pumpEventQueue().then((_) {
+      Iterable<String> filePaths = callbacks.currentFilePaths;
       expect(filePaths, hasLength(1));
       expect(filePaths, contains(filePath));
     });
@@ -1239,13 +1267,13 @@
   test_watch_addFileInSubfolder() {
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // empty folder initially
-    Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
-    expect(filePaths, hasLength(0));
+    expect(callbacks.currentFilePaths, hasLength(0));
     // add file in subfolder
     String filePath = path.posix.join(projPath, 'foo', 'bar.dart');
     resourceProvider.newFile(filePath, 'contents');
     // the file was added
     return pumpEventQueue().then((_) {
+      Iterable<String> filePaths = callbacks.currentFilePaths;
       expect(filePaths, hasLength(1));
       expect(filePaths, contains(filePath));
     });
@@ -1429,7 +1457,7 @@
     Folder projFolder = file.parent;
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // the file was added
-    Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
+    Iterable<String> filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
     expect(filePaths, contains(filePath));
     expect(file.exists, isTrue);
@@ -1439,7 +1467,7 @@
     return pumpEventQueue().then((_) {
       expect(file.exists, isFalse);
       expect(projFolder.exists, isTrue);
-      return expect(filePaths, hasLength(0));
+      return expect(callbacks.currentFilePaths, hasLength(0));
     });
   }
 
@@ -1450,7 +1478,7 @@
     Folder projFolder = file.parent;
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // the file was added
-    Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
+    Iterable<String> filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
     expect(filePaths, contains(filePath));
     expect(file.exists, isTrue);
@@ -1460,7 +1488,7 @@
     return pumpEventQueue().then((_) {
       expect(file.exists, isFalse);
       expect(projFolder.exists, isFalse);
-      return expect(filePaths, hasLength(0));
+      return expect(callbacks.currentFilePaths, hasLength(0));
     });
   }
 
@@ -1598,14 +1626,26 @@
     resourceProvider.newFile(filePath, 'contents');
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // the file was added
-    Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
-    expect(filePaths, hasLength(1));
-    expect(filePaths, contains(filePath));
-    expect(filePaths[filePath], equals(callbacks.now));
+    if (enableAnalysisDriver) {
+      Iterable<String> filePaths = callbacks.currentFilePaths;
+      expect(filePaths, hasLength(1));
+      expect(filePaths, contains(filePath));
+      // TODO(brianwilkerson) Test when the file was modified
+    } else {
+      Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
+      expect(filePaths, hasLength(1));
+      expect(filePaths, contains(filePath));
+      expect(filePaths[filePath], equals(callbacks.now));
+    }
     // update the file
     callbacks.now++;
     resourceProvider.modifyFile(filePath, 'new contents');
     return pumpEventQueue().then((_) {
+      if (enableAnalysisDriver) {
+        // TODO(brianwilkerson) Test when the file was modified
+        return null;
+      }
+      Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
       return expect(filePaths[filePath], equals(callbacks.now));
     });
   }
@@ -1639,7 +1679,7 @@
 
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
 
-    Map<String, int> filePaths = callbacks.currentContextFilePaths[projPath];
+    Iterable<String> filePaths = callbacks.currentFilePaths;
     expect(filePaths, hasLength(1));
     expect(filePaths, contains(filePath));
     expect(_currentPackageMap, isEmpty);
@@ -1666,11 +1706,6 @@
     // TODO(paulberry): we should also verify that the package map itself is
     // correct.  See dartbug.com/23909.
   }
-
-  Map<String, List<Folder>> _packageMap(String contextPath) {
-    Folder folder = resourceProvider.getFolder(contextPath);
-    return manager.folderMap[folder]?.sourceFactory?.packageMap;
-  }
 }
 
 abstract class ContextManagerTest {
@@ -1745,12 +1780,15 @@
         .toList();
   }
 
-  List<ErrorProcessor> get errorProcessors =>
-      callbacks.currentContext.analysisOptions.errorProcessors;
+  AnalysisOptions get analysisOptions => callbacks.analysisOptions;
 
-  List<Linter> get lints => getLints(callbacks.currentContext);
+  bool get enableAnalysisDriver => false;
 
-  AnalysisOptions get options => callbacks.currentContext.analysisOptions;
+  List<ErrorProcessor> get errorProcessors => analysisOptions.errorProcessors;
+
+  List<Linter> get lints => analysisOptions.lintRules;
+
+  SourceFactory get sourceFactory => callbacks.sourceFactory;
 
   Map<String, List<Folder>> get _currentPackageMap => _packageMap(projPath);
 
@@ -1759,8 +1797,16 @@
     resourceProvider.deleteFile(filePath);
   }
 
+  /**
+   * TODO(brianwilkerson) This doesn't add the strong mode processor when using
+   * the new analysis driver.
+   */
   ErrorProcessor getProcessor(AnalysisError error) =>
-      ErrorProcessor.getProcessor(callbacks.currentContext, error);
+      callbacks.currentDriver == null
+          ? ErrorProcessor.getProcessor(
+              callbacks.currentContext.analysisOptions, error)
+          : errorProcessors.firstWhere((ErrorProcessor p) => p.appliesTo(error),
+              orElse: () => null);
 
   String newFile(List<String> pathComponents, [String content = '']) {
     String filePath = path.posix.joinAll(pathComponents);
@@ -1768,6 +1814,12 @@
     return filePath;
   }
 
+  String newFileFromBytes(List<String> pathComponents, List<int> bytes) {
+    String filePath = path.posix.joinAll(pathComponents);
+    resourceProvider.newFileWithBytes(filePath, bytes);
+    return filePath;
+  }
+
   String newFolder(List<String> pathComponents) {
     String folderPath = path.posix.joinAll(pathComponents);
     resourceProvider.newFolder(folderPath);
@@ -1777,11 +1829,10 @@
   void processRequiredPlugins() {
     List<Plugin> plugins = <Plugin>[];
     plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-    plugins.add(AnalysisEngine.instance.commandLinePlugin);
-    plugins.add(AnalysisEngine.instance.optionsPlugin);
-    plugins.add(linterPlugin);
     ExtensionManager manager = new ExtensionManager();
     manager.processPlugins(plugins);
+
+    registerLintRules();
   }
 
   UriResolver providePackageResolver(Folder folder) => packageResolver;
@@ -1789,10 +1840,11 @@
   void setUp() {
     processRequiredPlugins();
     resourceProvider = new MemoryResourceProvider();
+    resourceProvider.newFolder(projPath);
     packageMapProvider = new MockPackageMapProvider();
     // Create an SDK in the mock file system.
-    new MockSdk(resourceProvider: resourceProvider);
-    DartSdkManager sdkManager = new DartSdkManager('/', false);
+    new MockSdk(generateSummaryFiles: true, resourceProvider: resourceProvider);
+    DartSdkManager sdkManager = new DartSdkManager('/', true);
     manager = new ContextManagerImpl(
         resourceProvider,
         sdkManager,
@@ -1801,10 +1853,12 @@
         analysisFilesGlobs,
         InstrumentationService.NULL_SERVICE,
         new AnalysisOptionsImpl(),
-        false);
-    callbacks = new TestContextManagerCallbacks(resourceProvider);
+        enableAnalysisDriver);
+    PerformanceLog logger = new PerformanceLog(new NullStringSink());
+    AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(logger);
+    callbacks = new TestContextManagerCallbacks(
+        resourceProvider, sdkManager, logger, scheduler);
     manager.callbacks = callbacks;
-    resourceProvider.newFolder(projPath);
   }
 
   /**
@@ -1823,7 +1877,12 @@
 
   Map<String, List<Folder>> _packageMap(String contextPath) {
     Folder folder = resourceProvider.getFolder(contextPath);
-    return manager.folderMap[folder]?.sourceFactory?.packageMap;
+    if (enableAnalysisDriver) {
+      ContextInfo info = manager.getContextInfoFor(folder);
+      return info.analysisDriver.sourceFactory?.packageMap;
+    } else {
+      return manager.folderMap[folder]?.sourceFactory?.packageMap;
+    }
   }
 }
 
@@ -1864,7 +1923,7 @@
     // Verify options were set.
     expect(errorProcessors, hasLength(1));
     expect(lints, hasLength(1));
-    expect(options.enableStrictCallChecks, isTrue);
+    expect(analysisOptions.enableStrictCallChecks, isTrue);
 
     // Remove options.
     deleteFile([projPath, optionsFileName]);
@@ -1873,7 +1932,7 @@
     // Verify defaults restored.
     expect(errorProcessors, isEmpty);
     expect(lints, isEmpty);
-    expect(options.enableStrictCallChecks, isFalse);
+    expect(analysisOptions.enableStrictCallChecks, isFalse);
   }
 
   test_analysis_options_file_delete_with_embedder() async {
@@ -1916,8 +1975,8 @@
     await pumpEventQueue();
 
     // Verify options were set.
-    expect(options.enableStrictCallChecks, isTrue);
-    expect(options.strongMode, isTrue);
+    expect(analysisOptions.enableStrictCallChecks, isTrue);
+    expect(analysisOptions.strongMode, isTrue);
     expect(errorProcessors, hasLength(2));
     expect(lints, hasLength(2));
 
@@ -1926,7 +1985,7 @@
     await pumpEventQueue();
 
     // Verify defaults restored.
-    expect(options.enableStrictCallChecks, isFalse);
+    expect(analysisOptions.enableStrictCallChecks, isFalse);
     expect(lints, hasLength(1));
     expect(lints.first, new isInstanceOf<AvoidAs>());
     expect(errorProcessors, hasLength(1));
@@ -1963,7 +2022,47 @@
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     await pumpEventQueue();
     // Verify options were set.
-    expect(options.enableStrictCallChecks, isTrue);
+    expect(analysisOptions.enableStrictCallChecks, isTrue);
+    expect(errorProcessors, hasLength(1));
+    expect(lints, hasLength(1));
+    expect(lints[0].name, 'camel_case_types');
+  }
+
+  test_analysis_options_include_package() async {
+    // Create files.
+    String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]);
+    newFile([libPath, 'main.dart']);
+    String sdkExtPath = newFolder([projPath, 'sdk_ext']);
+    newFile([sdkExtPath, 'entry.dart']);
+    String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']);
+    newFile([sdkExtSrcPath, 'part.dart']);
+    // Setup package
+    String booLibPosixPath = '/my/pkg/boo/lib';
+    newFile(
+        [booLibPosixPath, 'other_options.yaml'],
+        r'''
+analyzer:
+  language:
+    enableStrictCallChecks: true
+  errors:
+    unused_local_variable: false
+linter:
+  rules:
+    - camel_case_types
+''');
+    // Setup analysis options file which includes another options file.
+    newFile([projPath, ContextManagerImpl.PACKAGE_SPEC_NAME],
+        'boo:$booLibPosixPath\n');
+    newFile(
+        [projPath, optionsFileName],
+        r'''
+include: package:boo/other_options.yaml
+''');
+    // Setup context.
+    manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+    await pumpEventQueue();
+    // Verify options were set.
+    expect(analysisOptions.enableStrictCallChecks, isTrue);
     expect(errorProcessors, hasLength(1));
     expect(lints, hasLength(1));
     expect(lints[0].name, 'camel_case_types');
@@ -1995,6 +2094,8 @@
     String sdkExtPath = newFolder([projPath, 'sdk_ext']);
     newFile([projPath, 'test', 'test.dart']);
     newFile([sdkExtPath, 'entry.dart']);
+    List<int> bytes = new SummaryBuilder([], null, true).build();
+    newFileFromBytes([projPath, 'sdk.ds'], bytes);
     // Setup _embedder.yaml.
     newFile(
         [libPath, '_embedder.yaml'],
@@ -2042,14 +2143,13 @@
         manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
     expect(contexts, isNotNull);
     expect(contexts, hasLength(1));
-    var context = contexts[0];
 
     // Verify options.
     // * from `_embedder.yaml`:
-    expect(context.analysisOptions.strongMode, isTrue);
-    expect(context.analysisOptions.enableSuperMixins, isTrue);
+    expect(analysisOptions.strongMode, isTrue);
+    expect(analysisOptions.enableSuperMixins, isTrue);
     // * from analysis options:
-    expect(context.analysisOptions.enableStrictCallChecks, isTrue);
+    expect(analysisOptions.enableStrictCallChecks, isTrue);
 
     // * verify tests are excluded
     expect(
@@ -2075,7 +2175,7 @@
             ['avoid_as' /* embedder */, 'camel_case_types' /* options */]));
 
     // Sanity check embedder libs.
-    var source = context.sourceFactory.forUri('dart:foobar');
+    var source = sourceFactory.forUri('dart:foobar');
     expect(source, isNotNull);
     expect(source.fullName, '/my/proj/sdk_ext/entry.dart');
   }
@@ -2171,13 +2271,22 @@
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     await pumpEventQueue();
 
-    AnalysisContext context = manager.getContextFor(projPath);
-    Source testSource = context.getSourcesWithFullName(file.path).single;
+    if (enableAnalysisDriver) {
+      AnalysisResult result =
+          await callbacks.currentDriver.getResult(file.path);
 
-    // Not strong mode - both in the context and the SDK context.
-    {
-      AnalysisContext sdkContext = context.sourceFactory.dartSdk.context;
-      expect(context.analysisOptions.strongMode, isFalse);
+      // Not strong mode - both in the context and the SDK context.
+      AnalysisContext sdkContext = sourceFactory.dartSdk.context;
+      expect(analysisOptions.strongMode, isFalse);
+      expect(sdkContext.analysisOptions.strongMode, isFalse);
+      expect(result.errors, isEmpty);
+    } else {
+      AnalysisContext context = manager.getContextFor(projPath);
+      Source testSource = context.getSourcesWithFullName(file.path).single;
+
+      // Not strong mode - both in the context and the SDK context.
+      AnalysisContext sdkContext = sourceFactory.dartSdk.context;
+      expect(analysisOptions.strongMode, isFalse);
       expect(sdkContext.analysisOptions.strongMode, isFalse);
       expect(context.computeErrors(testSource), isEmpty);
     }
@@ -2192,14 +2301,27 @@
     await pumpEventQueue();
 
     // Strong mode - both in the context and the SDK context.
-    {
-      AnalysisContext context = manager.getContextFor(projPath);
-      AnalysisContext sdkContext = context.sourceFactory.dartSdk.context;
-      expect(context.analysisOptions.strongMode, isTrue);
+    if (enableAnalysisDriver) {
+      AnalysisResult result =
+          await callbacks.currentDriver.getResult(file.path);
+
+      // Not strong mode - both in the context and the SDK context.
+      AnalysisContext sdkContext = sourceFactory.dartSdk.context;
+      expect(analysisOptions.strongMode, isTrue);
       expect(sdkContext.analysisOptions.strongMode, isTrue);
       // The code is strong-mode clean.
       // Verify that TypeSystem was reset.
-      expect(context.computeErrors(testSource), isEmpty);
+      expect(result.errors, isEmpty);
+    } else {
+      AnalysisContext context = manager.getContextFor(projPath);
+      Source testSource = context.getSourcesWithFullName(file.path).single;
+      AnalysisContext sdkContext = sourceFactory.dartSdk.context;
+      expect(analysisOptions.strongMode, isTrue);
+      expect(sdkContext.analysisOptions.strongMode, isTrue);
+      // The code is strong-mode clean, but we're using a Mock SDK that isn't
+      // configured correctly for strong mode so we get an error.
+      // Verify that TypeSystem was reset.
+      expect(context.computeErrors(testSource), hasLength(1));
     }
   }
 
@@ -2223,15 +2345,27 @@
 ''');
     // Setup context.
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+
     // Verify that analysis options was parsed and the ignore patterns applied.
-    Map<String, int> fileTimestamps =
-        callbacks.currentContextFilePaths[projPath];
-    expect(fileTimestamps, isNotEmpty);
-    List<String> files = fileTimestamps.keys.toList();
-    expect(
-        files,
-        unorderedEquals(
-            ['/my/proj/lib/main.dart', '/my/proj/$optionsFileName']));
+    Folder projectFolder = resourceProvider.newFolder(projPath);
+    if (enableAnalysisDriver) {
+      var drivers = manager.getDriversInAnalysisRoot(projectFolder);
+      expect(drivers, hasLength(1));
+      AnalysisDriver driver = drivers[0];
+      expect(
+          driver.addedFiles,
+          unorderedEquals(
+              ['/my/proj/lib/main.dart', '/my/proj/$optionsFileName']));
+    } else {
+      Map<String, int> fileTimestamps =
+          callbacks.currentContextFilePaths[projPath];
+      expect(fileTimestamps, isNotEmpty);
+      List<String> files = fileTimestamps.keys.toList();
+      expect(
+          files,
+          unorderedEquals(
+              ['/my/proj/lib/main.dart', '/my/proj/$optionsFileName']));
+    }
   }
 
   test_path_filter_child_contexts_option() async {
@@ -2263,11 +2397,19 @@
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // Verify that the context in other_lib wasn't created and that the
     // context in lib was created.
-    var contexts =
-        manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
-    expect(contexts.length, 2);
-    expect(contexts[0].name, equals('/my/proj'));
-    expect(contexts[1].name, equals('/my/proj/lib'));
+    Folder projectFolder = resourceProvider.newFolder(projPath);
+    if (enableAnalysisDriver) {
+      var drivers = manager.getDriversInAnalysisRoot(projectFolder);
+      expect(drivers, hasLength(2));
+      expect(drivers[0].name, equals('/my/proj'));
+      expect(drivers[1].name, equals('/my/proj/lib'));
+    } else {
+      var contexts =
+          manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
+      expect(contexts.length, 2);
+      expect(contexts[0].name, equals('/my/proj'));
+      expect(contexts[1].name, equals('/my/proj/lib'));
+    }
   }
 
   test_path_filter_recursive_wildcard_child_contexts_option() async {
@@ -2297,13 +2439,21 @@
   ''');
     // Setup context.
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+
     // Verify that the context in other_lib wasn't created and that the
     // context in lib was created.
-    var contexts =
-        manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
-    expect(contexts.length, 2);
-    expect(contexts[0].name, equals('/my/proj'));
-    expect(contexts[1].name, equals('/my/proj/lib'));
+    Folder projectFolder = resourceProvider.newFolder(projPath);
+    if (enableAnalysisDriver) {
+      var drivers = manager.getDriversInAnalysisRoot(projectFolder);
+      expect(drivers, hasLength(2));
+      expect(drivers[0].name, equals('/my/proj'));
+      expect(drivers[1].name, equals('/my/proj/lib'));
+    } else {
+      var contexts = manager.contextsInAnalysisRoot(projectFolder);
+      expect(contexts.length, 2);
+      expect(contexts[0].name, equals('/my/proj'));
+      expect(contexts[1].name, equals('/my/proj/lib'));
+    }
   }
 
   test_path_filter_wildcard_child_contexts_option() async {
@@ -2331,15 +2481,23 @@
   exclude:
     - 'other_lib/*'
 ''');
-    // Setup context.
+    // Setup context / driver.
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
-    // Verify that the context in other_lib wasn't created and that the
-    // context in lib was created.
-    var contexts =
-        manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
-    expect(contexts.length, 2);
-    expect(contexts[0].name, equals('/my/proj'));
-    expect(contexts[1].name, equals('/my/proj/lib'));
+
+    Folder projectFolder = resourceProvider.newFolder(projPath);
+    if (enableAnalysisDriver) {
+      var drivers = manager.getDriversInAnalysisRoot(projectFolder);
+      expect(drivers, hasLength(2));
+      expect(drivers[0].name, equals('/my/proj'));
+      expect(drivers[1].name, equals('/my/proj/lib'));
+    } else {
+      // Verify that the context in other_lib wasn't created and that the
+      // context in lib was created.
+      var contexts = manager.contextsInAnalysisRoot(projectFolder);
+      expect(contexts, hasLength(2));
+      expect(contexts[0].name, equals('/my/proj'));
+      expect(contexts[1].name, equals('/my/proj/lib'));
+    }
   }
 
   void test_setRoots_nested_excludedByOuter() {
@@ -2374,8 +2532,8 @@
         }
       }
     }
-    expect(callbacks.currentContextPaths, hasLength(2));
-    expect(callbacks.currentContextPaths, unorderedEquals([project, example]));
+    expect(callbacks.currentContextRoots, hasLength(2));
+    expect(callbacks.currentContextRoots, unorderedEquals([project, example]));
   }
 
   void test_setRoots_nested_excludedByOuter_deep() {
@@ -2409,8 +2567,8 @@
         }
       }
     }
-    expect(callbacks.currentContextPaths, hasLength(2));
-    expect(callbacks.currentContextPaths, unorderedEquals([a, c]));
+    expect(callbacks.currentContextRoots, hasLength(2));
+    expect(callbacks.currentContextRoots, unorderedEquals([a, c]));
   }
 
   test_strong_mode_analysis_option() async {
@@ -2426,10 +2584,7 @@
     // Setup context.
     manager.setRoots(<String>[projPath], <String>[], <String, String>{});
     // Verify that analysis options was parsed and strong-mode set.
-    Map<String, int> fileTimestamps =
-        callbacks.currentContextFilePaths[projPath];
-    expect(fileTimestamps, isNotEmpty);
-    expect(callbacks.currentContext.analysisOptions.strongMode, true);
+    expect(analysisOptions.strongMode, true);
   }
 }
 
@@ -2445,6 +2600,16 @@
   AnalysisContext currentContext;
 
   /**
+   * The analysis driver that was created.
+   */
+  AnalysisDriver currentDriver;
+
+  /**
+   * A table mapping paths to the analysis driver associated with that path.
+   */
+  Map<String, AnalysisDriver> driverMap = <String, AnalysisDriver>{};
+
+  /**
    * Map from context to the timestamp when the context was created.
    */
   Map<String, int> currentContextTimestamps = <String, int>{};
@@ -2468,66 +2633,157 @@
   final ResourceProvider resourceProvider;
 
   /**
+   * The manager managing the SDKs.
+   */
+  final DartSdkManager sdkManager;
+
+  /**
+   * The logger used by the scheduler and the driver.
+   */
+  final PerformanceLog logger;
+
+  /**
+   * The scheduler used by the driver.
+   */
+  final AnalysisDriverScheduler scheduler;
+
+  /**
    * The list of `flushedFiles` in the last [removeContext] invocation.
    */
   List<String> lastFlushedFiles;
 
-  TestContextManagerCallbacks(this.resourceProvider);
+  TestContextManagerCallbacks(
+      this.resourceProvider, this.sdkManager, this.logger, this.scheduler);
 
   /**
-   * Iterable of the paths to contexts that currently exist.
+   * Return the current set of analysis options.
    */
-  Iterable<String> get currentContextPaths => currentContextTimestamps.keys;
+  AnalysisOptions get analysisOptions => currentDriver == null
+      ? currentContext.analysisOptions
+      : currentDriver.analysisOptions;
+
+  /**
+   * Return the paths to the context roots that currently exist.
+   */
+  Iterable<String> get currentContextRoots {
+    return currentContextTimestamps.keys;
+  }
+
+  /**
+   * Return the paths to the files being analyzed in the current context root.
+   */
+  Iterable<String> get currentFilePaths {
+    if (currentDriver == null) {
+      if (currentContext == null) {
+        return <String>[];
+      }
+      Map<String, int> fileMap = currentContextFilePaths[currentContext.name];
+      if (fileMap == null) {
+        return <String>[];
+      }
+      return fileMap.keys;
+    }
+    return currentDriver.addedFiles;
+  }
+
+  /**
+   * Return the current source factory.
+   */
+  SourceFactory get sourceFactory => currentDriver == null
+      ? currentContext.sourceFactory
+      : currentDriver.sourceFactory;
 
   @override
   AnalysisDriver addAnalysisDriver(Folder folder, AnalysisOptions options) {
-    // TODO: implement addAnalysisDriver
-    throw new UnimplementedError();
+    String path = folder.path;
+    expect(currentContextRoots, isNot(contains(path)));
+    currentContextTimestamps[path] = now;
+
+    ContextBuilder builder =
+        createContextBuilder(folder, options, useSummaries: true);
+    AnalysisContext context = builder.buildContext(folder.path);
+    SourceFactory sourceFactory = context.sourceFactory;
+    AnalysisOptions analysisOptions = context.analysisOptions;
+    context.dispose();
+
+    currentDriver = new AnalysisDriver(
+        scheduler,
+        logger,
+        resourceProvider,
+        new MemoryByteStore(),
+        new FileContentOverlay(),
+        path,
+        sourceFactory,
+        analysisOptions);
+    driverMap[path] = currentDriver;
+    currentDriver.exceptions.listen((ExceptionResult result) {
+      AnalysisEngine.instance.logger
+          .logError('Analysis failed: ${result.path}', result.exception);
+    });
+    return currentDriver;
   }
 
   @override
   AnalysisContext addContext(Folder folder, AnalysisOptions options) {
     String path = folder.path;
-    expect(currentContextPaths, isNot(contains(path)));
+    expect(currentContextRoots, isNot(contains(path)));
     currentContextTimestamps[path] = now;
     currentContextFilePaths[path] = <String, int>{};
     currentContextSources[path] = new HashSet<Source>();
 
     ContextBuilder builder = createContextBuilder(folder, options);
-    currentContext = builder.buildContext(folder.path);
+    currentContext = builder.buildContext(path);
+    currentContext.name = path;
     return currentContext;
   }
 
   @override
   void applyChangesToContext(Folder contextFolder, ChangeSet changeSet) {
-    Map<String, int> filePaths = currentContextFilePaths[contextFolder.path];
-    Set<Source> sources = currentContextSources[contextFolder.path];
+    AnalysisDriver driver = driverMap[contextFolder.path];
+    if (driver != null) {
+      changeSet.addedSources.forEach((source) {
+        driver.addFile(source.fullName);
+      });
+      changeSet.changedSources.forEach((source) {
+        driver.changeFile(source.fullName);
+      });
+      changeSet.removedSources.forEach((source) {
+        driver.removeFile(source.fullName);
+      });
+    } else {
+      Map<String, int> filePaths = currentContextFilePaths[contextFolder.path];
+      Set<Source> sources = currentContextSources[contextFolder.path];
 
-    for (Source source in changeSet.addedSources) {
-      expect(filePaths, isNot(contains(source.fullName)));
-      filePaths[source.fullName] = now;
-      sources.add(source);
-    }
-    for (Source source in changeSet.removedSources) {
-      expect(filePaths, contains(source.fullName));
-      filePaths.remove(source.fullName);
-      sources.remove(source);
-    }
-    for (Source source in changeSet.changedSources) {
-      expect(filePaths, contains(source.fullName));
-      filePaths[source.fullName] = now;
-    }
+      for (Source source in changeSet.addedSources) {
+        expect(filePaths, isNot(contains(source.fullName)));
+        filePaths[source.fullName] = now;
+        sources.add(source);
+      }
+      for (Source source in changeSet.removedSources) {
+        expect(filePaths, contains(source.fullName));
+        filePaths.remove(source.fullName);
+        sources.remove(source);
+      }
+      for (Source source in changeSet.changedSources) {
+        expect(filePaths, contains(source.fullName));
+        filePaths[source.fullName] = now;
+      }
 
-    currentContext.applyChanges(changeSet);
+      currentContext.applyChanges(changeSet);
+    }
+  }
+
+  @override
+  void applyFileRemoved(AnalysisDriver driver, String file) {
+    driver.removeFile(file);
   }
 
   void assertContextFiles(String contextPath, List<String> expectedFiles) {
-    var actualFiles = currentContextFilePaths[contextPath].keys;
-    expect(actualFiles, unorderedEquals(expectedFiles));
+    expect(getCurrentFilePaths(contextPath), unorderedEquals(expectedFiles));
   }
 
   void assertContextPaths(List<String> expected) {
-    expect(currentContextPaths, unorderedEquals(expected));
+    expect(currentContextRoots, unorderedEquals(expected));
   }
 
   @override
@@ -2536,8 +2792,8 @@
   }
 
   @override
-  ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options) {
-    DartSdkManager sdkManager = new DartSdkManager('/', false);
+  ContextBuilder createContextBuilder(Folder folder, AnalysisOptions options,
+      {bool useSummaries = false}) {
     ContextBuilderOptions builderOptions = new ContextBuilderOptions();
     builderOptions.defaultOptions = options;
     ContextBuilder builder = new ContextBuilder(
@@ -2546,6 +2802,44 @@
     return builder;
   }
 
+  /**
+   * Return the paths to the files being analyzed in the current context root.
+   */
+  Iterable<Source> currentFileSources(String contextPath) {
+    if (currentDriver == null) {
+      if (currentContext == null) {
+        return <Source>[];
+      }
+      Set<Source> sources = currentContextSources[contextPath];
+      return sources ?? <Source>[];
+    }
+    AnalysisDriver driver = driverMap[contextPath];
+    SourceFactory sourceFactory = driver.sourceFactory;
+    return driver.addedFiles.map((String path) {
+      File file = resourceProvider.getFile(path);
+      Source source = file.createSource();
+      Uri uri = sourceFactory.restoreUri(source);
+      return file.createSource(uri);
+    });
+  }
+
+  /**
+   * Return the paths to the files being analyzed in the current context root.
+   */
+  Iterable<String> getCurrentFilePaths(String contextPath) {
+    if (currentDriver == null) {
+      if (currentContext == null) {
+        return <String>[];
+      }
+      Map<String, int> fileMap = currentContextFilePaths[contextPath];
+      if (fileMap == null) {
+        return <String>[];
+      }
+      return fileMap.keys;
+    }
+    return driverMap[contextPath].addedFiles;
+  }
+
   @override
   void moveContext(Folder from, Folder to) {
     String path = from.path;
@@ -2564,7 +2858,7 @@
   @override
   void removeContext(Folder folder, List<String> flushedFiles) {
     String path = folder.path;
-    expect(currentContextPaths, contains(path));
+    expect(currentContextRoots, contains(path));
     currentContextTimestamps.remove(path);
     currentContextFilePaths.remove(path);
     currentContextSources.remove(path);
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index 9230d23..24c5788 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -13,8 +13,10 @@
 import 'package:analysis_server/src/plugin/server_plugin.dart';
 import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/instrumentation/instrumentation.dart';
+import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:plugin/manager.dart';
+import 'package:plugin/plugin.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -33,12 +35,20 @@
   AnalysisServer server;
   AnalysisDomainHandler handler;
 
+  void processRequiredPlugins(ServerPlugin serverPlugin) {
+    List<Plugin> plugins = <Plugin>[];
+    plugins.addAll(AnalysisEngine.instance.requiredPlugins);
+    plugins.add(serverPlugin);
+
+    ExtensionManager manager = new ExtensionManager();
+    manager.processPlugins(plugins);
+  }
+
   setUp(() {
     serverChannel = new MockServerChannel();
     resourceProvider = new MemoryResourceProvider();
-    ExtensionManager manager = new ExtensionManager();
     ServerPlugin serverPlugin = new ServerPlugin();
-    manager.processPlugins([serverPlugin]);
+    processRequiredPlugins(serverPlugin);
     // Create an SDK in the mock file system.
     new MockSdk(resourceProvider: resourceProvider);
     server = new AnalysisServer(
@@ -429,11 +439,10 @@
   String testCode;
 
   AnalysisTestHelper() {
+    ServerPlugin serverPlugin = new ServerPlugin();
+    processRequiredPlugins(serverPlugin);
     serverChannel = new MockServerChannel();
     resourceProvider = new MemoryResourceProvider();
-    ExtensionManager manager = new ExtensionManager();
-    ServerPlugin serverPlugin = new ServerPlugin();
-    manager.processPlugins([serverPlugin]);
     // Create an SDK in the mock file system.
     new MockSdk(resourceProvider: resourceProvider);
     server = new AnalysisServer(
@@ -597,6 +606,15 @@
     expect(response, isResponseSuccess('0'));
   }
 
+  void processRequiredPlugins(ServerPlugin serverPlugin) {
+    List<Plugin> plugins = <Plugin>[];
+    plugins.addAll(AnalysisEngine.instance.requiredPlugins);
+    plugins.add(serverPlugin);
+
+    ExtensionManager manager = new ExtensionManager();
+    manager.processPlugins(plugins);
+  }
+
   /**
    * Send an `updateContent` request for [testFile].
    */
diff --git a/pkg/analysis_server/test/domain_diagnostic_test.dart b/pkg/analysis_server/test/domain_diagnostic_test.dart
index 78080e8..3bd5429 100644
--- a/pkg/analysis_server/test/domain_diagnostic_test.dart
+++ b/pkg/analysis_server/test/domain_diagnostic_test.dart
@@ -5,89 +5,66 @@
 library test.domain.diagnostic;
 
 import 'package:analysis_server/plugin/protocol/protocol.dart';
-import 'package:analysis_server/src/analysis_server.dart';
 import 'package:analysis_server/src/domain_diagnostic.dart';
-import 'package:analysis_server/src/plugin/server_plugin.dart';
-import 'package:analyzer/file_system/memory_file_system.dart';
-import 'package:analyzer/instrumentation/instrumentation.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/sdk.dart';
-import 'package:plugin/manager.dart';
-import 'package:plugin/plugin.dart';
 import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
 
-import 'mock_sdk.dart';
-import 'mocks.dart';
+import 'analysis_abstract.dart';
 
 main() {
-  AnalysisServer server;
-  DiagnosticDomainHandler handler;
-  MemoryResourceProvider resourceProvider;
+  defineReflectiveSuite(() {
+    defineReflectiveTests(DiagnosticDomainTest);
+    defineReflectiveTests(DiagnosticDomainTest_Driver);
+  });
+}
 
-  setUp(() {
-    //
-    // Collect plugins
-    //
-    ServerPlugin serverPlugin = new ServerPlugin();
-    List<Plugin> plugins = <Plugin>[];
-    plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-    plugins.add(AnalysisEngine.instance.commandLinePlugin);
-    plugins.add(AnalysisEngine.instance.optionsPlugin);
-    plugins.add(serverPlugin);
-    //
-    // Process plugins
-    //
-    ExtensionManager manager = new ExtensionManager();
-    manager.processPlugins(plugins);
-    //
-    // Create the server
-    //
-    var serverChannel = new MockServerChannel();
-    resourceProvider = new MemoryResourceProvider();
-    // Create an SDK in the mock file system.
-    new MockSdk(resourceProvider: resourceProvider);
-    server = new AnalysisServer(
-        serverChannel,
-        resourceProvider,
-        new MockPackageMapProvider(),
-        null,
-        serverPlugin,
-        new AnalysisServerOptions(),
-        new DartSdkManager('/', false),
-        InstrumentationService.NULL_SERVICE);
+@reflectiveTest
+class DiagnosticDomainTest extends AbstractAnalysisTest {
+  @override
+  void setUp() {
+    super.setUp();
     handler = new DiagnosticDomainHandler(server);
-  });
+    server.handlers = [handler];
+  }
 
-  group('DiagnosticDomainHandler', () {
-    test('getDiagnostics', () async {
-      String file = '/project/bin/test.dart';
-      resourceProvider.newFile('/project/pubspec.yaml', 'name: project');
-      resourceProvider.newFile(file, 'main() {}');
+  test_getDiagnostics() async {
+    String file = '/project/bin/test.dart';
+    resourceProvider.newFile('/project/pubspec.yaml', 'name: project');
+    resourceProvider.newFile(file, 'main() {}');
 
-      server.setAnalysisRoots('0', ['/project/'], [], {});
+    server.setAnalysisRoots('0', ['/project/'], [], {});
 
-      await server.onAnalysisComplete;
+    await server.onAnalysisComplete;
 
-      var request = new DiagnosticGetDiagnosticsParams().toRequest('0');
-      var response = handler.handleRequest(request);
+    var request = new DiagnosticGetDiagnosticsParams().toRequest('0');
+    var response = handler.handleRequest(request);
+    var result = new DiagnosticGetDiagnosticsResult.fromResponse(response);
 
-      int fileCount = 1 /* test.dart */;
+    expect(result.contexts, hasLength(1));
 
-      Map json = response.toJson()[Response.RESULT];
-      expect(json['contexts'], hasLength(1));
-      var context = json['contexts'][0];
-      expect(context['name'], '/project');
-      expect(context['explicitFileCount'], fileCount);
-      // dart:core dart:async dart:math dart:_internal
-      expect(context['implicitFileCount'], 4);
-      expect(context['workItemQueueLength'], isNotNull);
-    });
+    ContextData context = result.contexts[0];
+    expect(context.name, '/project');
+    expect(context.explicitFileCount, 1); /* test.dart */
 
-    test('getDiagnostics - (no root)', () async {
-      var request = new DiagnosticGetDiagnosticsParams().toRequest('0');
-      var response = handler.handleRequest(request);
-      Map json = response.toJson()[Response.RESULT];
-      expect(json['contexts'], hasLength(0));
-    });
-  });
+    expect(context.implicitFileCount, 4);
+
+    expect(context.workItemQueueLength, isNotNull);
+  }
+
+  test_getDiagnostics_noRoot() async {
+    var request = new DiagnosticGetDiagnosticsParams().toRequest('0');
+    var response = handler.handleRequest(request);
+    var result = new DiagnosticGetDiagnosticsResult.fromResponse(response);
+    expect(result.contexts, isEmpty);
+  }
+}
+
+@reflectiveTest
+class DiagnosticDomainTest_Driver extends DiagnosticDomainTest {
+  @override
+  void setUp() {
+    enableNewAnalysisDriver = true;
+    generateSummaryFiles = true;
+    super.setUp();
+  }
 }
diff --git a/pkg/analysis_server/test/edit/sort_members_test.dart b/pkg/analysis_server/test/edit/sort_members_test.dart
index b246d82..b5d67f6 100644
--- a/pkg/analysis_server/test/edit/sort_members_test.dart
+++ b/pkg/analysis_server/test/edit/sort_members_test.dart
@@ -178,6 +178,60 @@
 ''');
   }
 
+  @failingTest
+  test_OK_genericFunctionTypeInComments() async {
+    addFile(
+        projectPath + '/analysis_options.yaml',
+        '''
+analyzer:
+  strong-mode: true
+''');
+    addTestFile('''
+class C {
+  void caller() {
+    Super s = new Super();
+    takesSub(s); // <- No warning
+  }
+
+  void takesSub(Sub s) {}
+}
+
+class Sub extends Super {}
+
+class Super {}
+
+typedef dynamic Func(String x, String y);
+
+Function/*=F*/ allowInterop/*<F extends Function>*/(Function/*=F*/ f) => null;
+
+Func bar(Func f) {
+  return allowInterop(f);
+}
+''');
+    return _assertSorted('''
+Function/*=F*/ allowInterop/*<F extends Function>*/(Function/*=F*/ f) => null;
+
+Func bar(Func f) {
+  return allowInterop(f);
+}
+
+typedef dynamic Func(String x, String y);
+
+class C {
+  void caller() {
+    Super s = new Super();
+    takesSub(s); // <- No warning
+  }
+
+  void takesSub(Sub s) {}
+}
+
+class Sub extends Super {}
+
+class Super {}
+''');
+  }
+
   test_OK_unitMembers_class() async {
     addTestFile('''
 class C {}
diff --git a/pkg/analysis_server/test/integration/analysis/analysis_options_test.dart b/pkg/analysis_server/test/integration/analysis/analysis_options_test.dart
index a2ea8e7..3216977 100644
--- a/pkg/analysis_server/test/integration/analysis/analysis_options_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/analysis_options_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.analysis_options_test;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:test/test.dart';
@@ -14,11 +12,12 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(OptionsIntegrationTest);
+    defineReflectiveTests(OptionsIntegrationTest_Driver);
   });
 }
 
-@reflectiveTest
-class OptionsIntegrationTest extends AbstractAnalysisServerIntegrationTest {
+class AbstractOptionsIntegrationTest
+    extends AbstractAnalysisServerIntegrationTest {
   test_option_warning_newOptionFile() async {
     String options = sourcePath(AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
     writeFile(
@@ -73,3 +72,26 @@
     expect(error.location.startColumn, 7);
   }
 }
+
+@reflectiveTest
+class OptionsIntegrationTest extends AbstractOptionsIntegrationTest {}
+
+@reflectiveTest
+class OptionsIntegrationTest_Driver extends AbstractOptionsIntegrationTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  @failingTest
+  test_option_warning_newOptionFile() async {
+    //   TimeoutException after 0:00:30.000000: Test timed out after 30 seconds.
+    //return super.test_option_warning_newOptionFile();
+    fail('Test timed out');
+  }
+
+  @failingTest
+  test_option_warning_oldOptionFile() async {
+    //   TimeoutException after 0:00:30.000000: Test timed out after 30 seconds.
+    //return super.test_option_warning_oldOptionFile();
+    fail('Test timed out');
+  }
+}
diff --git a/pkg/analysis_server/test/integration/analysis/error_driver_test.dart b/pkg/analysis_server/test/integration/analysis/error_driver_test.dart
new file mode 100644
index 0000000..9f18a12
--- /dev/null
+++ b/pkg/analysis_server/test/integration/analysis/error_driver_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'error_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(AnalysisErrorIntegrationTest_Driver);
+  });
+}
+
+@reflectiveTest
+class AnalysisErrorIntegrationTest_Driver
+    extends AbstractAnalysisErrorIntegrationTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  @failingTest
+  test_super_mixins_enabled() async {
+    //  Expected: empty
+    //    Actual: [
+    //    AnalysisError:{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"/var/folders/00/0w95r000h01000cxqpysvccm003j4q/T/analysisServerfbuOQb/test.dart","offset":31,"length":1,"startLine":1,"startColumn":32},"message":"The class 'C' can't be used as a mixin because it extends a class other than Object.","correction":"","code":"mixin_inherits_from_not_object","hasFix":false},
+    //    AnalysisError:{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"/var/folders/00/0w95r000h01000cxqpysvccm003j4q/T/analysisServerfbuOQb/test.dart","offset":31,"length":1,"startLine":1,"startColumn":32},"message":"The class 'C' can't be used as a mixin because it references 'super'.","correction":"","code":"mixin_references_super","hasFix":false}
+    //  ]
+    return super.test_super_mixins_enabled();
+  }
+}
diff --git a/pkg/analysis_server/test/integration/analysis/error_test.dart b/pkg/analysis_server/test/integration/analysis/error_test.dart
index f2abb51..5c4bea4 100644
--- a/pkg/analysis_server/test/integration/analysis/error_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/error_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.error;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -16,8 +14,7 @@
   });
 }
 
-@reflectiveTest
-class AnalysisErrorIntegrationTest
+class AbstractAnalysisErrorIntegrationTest
     extends AbstractAnalysisServerIntegrationTest {
   test_detect_simple_error() {
     String pathname = sourcePath('test.dart');
@@ -96,3 +93,7 @@
     expect(errors, isEmpty);
   }
 }
+
+@reflectiveTest
+class AnalysisErrorIntegrationTest
+    extends AbstractAnalysisErrorIntegrationTest {}
diff --git a/pkg/analysis_server/test/integration/analysis/get_errors_after_analysis_test.dart b/pkg/analysis_server/test/integration/analysis/get_errors_after_analysis_test.dart
index 37caf81..81ab905 100644
--- a/pkg/analysis_server/test/integration/analysis/get_errors_after_analysis_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_errors_after_analysis_test.dart
@@ -2,19 +2,26 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-library test.integration.analysis.get.errors.after.analysis;
-
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import 'get_errors.dart';
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(GetErrorsAfterTest);
+    defineReflectiveTests(GetErrorsAfterTest_Driver);
   });
 }
 
+class AbstractGetErrorsAfterTest extends AnalysisDomainGetErrorsTest {
+  AbstractGetErrorsAfterTest() : super(true);
+}
+
 @reflectiveTest
-class Test extends AnalysisDomainGetErrorsTest {
-  Test() : super(true);
+class GetErrorsAfterTest extends AbstractGetErrorsAfterTest {}
+
+@reflectiveTest
+class GetErrorsAfterTest_Driver extends AbstractGetErrorsAfterTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
 }
diff --git a/pkg/analysis_server/test/integration/analysis/get_errors_before_analysis_test.dart b/pkg/analysis_server/test/integration/analysis/get_errors_before_analysis_test.dart
index 4863a8d..2c5d5b8 100644
--- a/pkg/analysis_server/test/integration/analysis/get_errors_before_analysis_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_errors_before_analysis_test.dart
@@ -2,19 +2,26 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-library test.integration.analysis.get.errors.before.analysis;
-
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import 'get_errors.dart';
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(GetErrorsBeforeTest);
+    defineReflectiveTests(GetErrorsBeforeTest_Driver);
   });
 }
 
+class AbstractGetErrorsBeforeTest extends AnalysisDomainGetErrorsTest {
+  AbstractGetErrorsBeforeTest() : super(false);
+}
+
 @reflectiveTest
-class Test extends AnalysisDomainGetErrorsTest {
-  Test() : super(false);
+class GetErrorsBeforeTest extends AbstractGetErrorsBeforeTest {}
+
+@reflectiveTest
+class GetErrorsBeforeTest_Driver extends AbstractGetErrorsBeforeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
 }
diff --git a/pkg/analysis_server/test/integration/analysis/get_errors_nonStandard_sdk.dart b/pkg/analysis_server/test/integration/analysis/get_errors_nonStandard_sdk.dart
index 9d34855..6c91c80 100644
--- a/pkg/analysis_server/test/integration/analysis/get_errors_nonStandard_sdk.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_errors_nonStandard_sdk.dart
@@ -2,8 +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.
 
-library test.integration.analysis.get.errors;
-
 import 'dart:async';
 import 'dart:io';
 
@@ -19,6 +17,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AnalysisDomainGetErrorsTest);
+    defineReflectiveTests(AnalysisDomainGetErrorsTest_Driver);
   });
 }
 
@@ -26,11 +25,8 @@
  * Tests that when an SDK path is specified on the command-line (via the `--sdk`
  * argument) that the specified SDK is used.
  */
-@reflectiveTest
-class AnalysisDomainGetErrorsTest
+class AbstractAnalysisDomainGetErrorsTest
     extends AbstractAnalysisServerIntegrationTest {
-  AnalysisDomainGetErrorsTest();
-
   String createNonStandardSdk() {
     MockSdkLibrary fakeLibrary =
         new MockSdkLibrary('dart:fake', '/lib/fake/fake.dart', '');
@@ -97,3 +93,13 @@
     expect(errors[0].code, 'unused_import');
   }
 }
+
+@reflectiveTest
+class AnalysisDomainGetErrorsTest extends AbstractAnalysisDomainGetErrorsTest {}
+
+@reflectiveTest
+class AnalysisDomainGetErrorsTest_Driver
+    extends AbstractAnalysisDomainGetErrorsTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/get_hover_test.dart b/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
index 7c6a742..cf293bf 100644
--- a/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.get.hover;
-
 import 'dart:async';
 
 import 'package:analysis_server/plugin/protocol/protocol.dart';
@@ -16,11 +14,11 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AnalysisGetHoverIntegrationTest);
+    defineReflectiveTests(AnalysisGetHoverIntegrationTest_Driver);
   });
 }
 
-@reflectiveTest
-class AnalysisGetHoverIntegrationTest
+class AbstractAnalysisGetHoverIntegrationTest
     extends AbstractAnalysisServerIntegrationTest {
   /**
    * Pathname of the file containing Dart code.
@@ -189,3 +187,14 @@
     });
   }
 }
+
+@reflectiveTest
+class AnalysisGetHoverIntegrationTest
+    extends AbstractAnalysisGetHoverIntegrationTest {}
+
+@reflectiveTest
+class AnalysisGetHoverIntegrationTest_Driver
+    extends AbstractAnalysisGetHoverIntegrationTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/highlights_test.dart b/pkg/analysis_server/test/integration/analysis/highlights_test.dart
index bc20497..ca6e425 100644
--- a/pkg/analysis_server/test/integration/analysis/highlights_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/highlights_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.highlights;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -13,11 +11,12 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AnalysisHighlightsTest);
+    defineReflectiveTests(AnalysisHighlightsTest_Driver);
   });
 }
 
-@reflectiveTest
-class AnalysisHighlightsTest extends AbstractAnalysisServerIntegrationTest {
+class AbstractAnalysisHighlightsTest
+    extends AbstractAnalysisServerIntegrationTest {
   test_highlights() {
     String pathname = sourcePath('test.dart');
     String text = r'''
@@ -145,3 +144,12 @@
     });
   }
 }
+
+@reflectiveTest
+class AnalysisHighlightsTest extends AbstractAnalysisHighlightsTest {}
+
+@reflectiveTest
+class AnalysisHighlightsTest_Driver extends AbstractAnalysisHighlightsTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/highlights_test2.dart b/pkg/analysis_server/test/integration/analysis/highlights_test2.dart
index b1a70c5..b05aa1f 100644
--- a/pkg/analysis_server/test/integration/analysis/highlights_test2.dart
+++ b/pkg/analysis_server/test/integration/analysis/highlights_test2.dart
@@ -2,8 +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.
 
-library test.integration.analysis.highlights2;
-
 import 'dart:async';
 
 import 'package:analysis_server/plugin/protocol/protocol.dart';
@@ -15,11 +13,12 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AnalysisHighlightsTest);
+    defineReflectiveTests(AnalysisHighlightsTest_Driver);
   });
 }
 
-@reflectiveTest
-class AnalysisHighlightsTest extends AbstractAnalysisServerIntegrationTest {
+class AbstractAnalysisHighlightsTest
+    extends AbstractAnalysisServerIntegrationTest {
   Future startServer(
       {bool checked: true, int diagnosticPort, int servicesPort}) {
     return server.start(
@@ -160,3 +159,12 @@
     });
   }
 }
+
+@reflectiveTest
+class AnalysisHighlightsTest extends AbstractAnalysisHighlightsTest {}
+
+@reflectiveTest
+class AnalysisHighlightsTest_Driver extends AbstractAnalysisHighlightsTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/lint_driver_test.dart b/pkg/analysis_server/test/integration/analysis/lint_driver_test.dart
new file mode 100644
index 0000000..80d2255
--- /dev/null
+++ b/pkg/analysis_server/test/integration/analysis/lint_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'lint_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(LintIntegrationTest_Driver);
+  });
+}
+
+@reflectiveTest
+class LintIntegrationTest_Driver extends AbstractLintIntegrationTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/lint_test.dart b/pkg/analysis_server/test/integration/analysis/lint_test.dart
index b8d212e..8a76f0f 100644
--- a/pkg/analysis_server/test/integration/analysis/lint_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/lint_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.lint;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:test/test.dart';
@@ -17,8 +15,8 @@
   });
 }
 
-@reflectiveTest
-class LintIntegrationTest extends AbstractAnalysisServerIntegrationTest {
+class AbstractLintIntegrationTest
+    extends AbstractAnalysisServerIntegrationTest {
   test_no_lints_when_not_specified() async {
     String source = sourcePath('test.dart');
     writeFile(
@@ -93,3 +91,6 @@
     expect(error.type, AnalysisErrorType.LINT);
   }
 }
+
+@reflectiveTest
+class LintIntegrationTest extends AbstractLintIntegrationTest {}
diff --git a/pkg/analysis_server/test/integration/analysis/navigation_test.dart b/pkg/analysis_server/test/integration/analysis/navigation_test.dart
index d6ea41c..2dcb074 100644
--- a/pkg/analysis_server/test/integration/analysis/navigation_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/navigation_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.navigation;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -13,11 +11,12 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AnalysisNavigationTest);
+    defineReflectiveTests(AnalysisNavigationTest_Driver);
   });
 }
 
-@reflectiveTest
-class AnalysisNavigationTest extends AbstractAnalysisServerIntegrationTest {
+class AbstractAnalysisNavigationTest
+    extends AbstractAnalysisServerIntegrationTest {
   test_navigation() {
     String pathname1 = sourcePath('test1.dart');
     String text1 = r'''
@@ -135,3 +134,12 @@
     });
   }
 }
+
+@reflectiveTest
+class AnalysisNavigationTest extends AbstractAnalysisNavigationTest {}
+
+@reflectiveTest
+class AnalysisNavigationTest_Driver extends AbstractAnalysisNavigationTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/occurrences_test.dart b/pkg/analysis_server/test/integration/analysis/occurrences_test.dart
index 2234205..88fe209 100644
--- a/pkg/analysis_server/test/integration/analysis/occurrences_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/occurrences_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.occurrences;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -12,12 +10,12 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(OccurrencesTest);
+    defineReflectiveTests(OccurrencesTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractOccurrencesTest extends AbstractAnalysisServerIntegrationTest {
   test_occurrences() {
     String pathname = sourcePath('test.dart');
     String text = r'''
@@ -67,3 +65,12 @@
     });
   }
 }
+
+@reflectiveTest
+class OccurrencesTest extends AbstractOccurrencesTest {}
+
+@reflectiveTest
+class OccurrencesTest_Driver extends AbstractOccurrencesTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/outline_test.dart b/pkg/analysis_server/test/integration/analysis/outline_test.dart
index 23f2cbd..92865ff 100644
--- a/pkg/analysis_server/test/integration/analysis/outline_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/outline_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.outline;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -12,12 +10,12 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(OutlineTest);
+    defineReflectiveTests(OutlineTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractOutlineTest extends AbstractAnalysisServerIntegrationTest {
   /**
    * Verify that the range of source text covered by the given outline objects
    * is connected (the end of each object in the list corresponds to the start
@@ -83,3 +81,12 @@
     });
   }
 }
+
+@reflectiveTest
+class OutlineTest extends AbstractOutlineTest {}
+
+@reflectiveTest
+class OutlineTest_Driver extends AbstractOutlineTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/overrides_test.dart b/pkg/analysis_server/test/integration/analysis/overrides_test.dart
index 74c179f..595d24d 100644
--- a/pkg/analysis_server/test/integration/analysis/overrides_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/overrides_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.overrides;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -12,12 +10,12 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(OverridesTest);
+    defineReflectiveTests(OverridesTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractOverridesTest extends AbstractAnalysisServerIntegrationTest {
   test_overrides() {
     String pathname = sourcePath('test.dart');
     String text = r'''
@@ -122,3 +120,12 @@
     });
   }
 }
+
+@reflectiveTest
+class OverridesTest extends AbstractOverridesTest {}
+
+@reflectiveTest
+class OverridesTest_Driver extends AbstractOverridesTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/package_root_test.dart b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
index 5ad9c38..f5a2cfd 100644
--- a/pkg/analysis_server/test/integration/analysis/package_root_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.packageRoot;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:path/path.dart' as path;
 import 'package:test/test.dart';
@@ -13,12 +11,13 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(SetAnalysisRootsTest);
+    defineReflectiveTests(SetAnalysisRootsTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractSetAnalysisRootsTest
+    extends AbstractAnalysisServerIntegrationTest {
   test_package_root() {
     String projPath = sourcePath('project');
     String mainPath = path.join(projPath, 'main.dart');
@@ -55,6 +54,7 @@
     });
     sendAnalysisSetAnalysisRoots([projPath], [],
         packageRoots: {projPath: packagesPath});
+    sendAnalysisSetPriorityFiles([mainPath]);
     return analysisFinished.then((_) {
       // Verify that fooBarPath was properly resolved by checking that f()
       // refers to it.
@@ -77,3 +77,12 @@
     });
   }
 }
+
+@reflectiveTest
+class SetAnalysisRootsTest extends AbstractSetAnalysisRootsTest {}
+
+@reflectiveTest
+class SetAnalysisRootsTest_Driver extends AbstractSetAnalysisRootsTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart b/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
index abf05cf..adc6984 100644
--- a/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
@@ -8,8 +8,6 @@
  *
  * See dartbug.com/21448.
  */
-library test.integration.analysis.reanalyze_concurrent;
-
 import 'dart:async';
 
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -18,12 +16,12 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(ReanalyzeTest);
+    defineReflectiveTests(ReanalyzeTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractReanalyzeTest extends AbstractAnalysisServerIntegrationTest {
   test_reanalyze_concurrent() {
     String pathname = sourcePath('test.dart');
     String text = '''
@@ -49,3 +47,12 @@
     });
   }
 }
+
+@reflectiveTest
+class ReanalyzeTest extends AbstractReanalyzeTest {}
+
+@reflectiveTest
+class ReanalyzeTest_Driver extends AbstractReanalyzeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart b/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart
index ac5b889..fbd17ab 100644
--- a/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.reanalyze;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -12,12 +10,12 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(ReanalyzeTest);
+    defineReflectiveTests(ReanalyzeTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractReanalyzeTest extends AbstractAnalysisServerIntegrationTest {
   test_reanalyze() {
     String pathname = sourcePath('test.dart');
     String text = 'main() {}';
@@ -40,3 +38,12 @@
     });
   }
 }
+
+@reflectiveTest
+class ReanalyzeTest extends AbstractReanalyzeTest {}
+
+@reflectiveTest
+class ReanalyzeTest_Driver extends AbstractReanalyzeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/test_all.dart b/pkg/analysis_server/test/integration/analysis/test_all.dart
index dcdc7c8..9937146 100644
--- a/pkg/analysis_server/test/integration/analysis/test_all.dart
+++ b/pkg/analysis_server/test/integration/analysis/test_all.dart
@@ -7,6 +7,7 @@
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import 'analysis_options_test.dart' as analysis_options_test;
+import 'error_driver_test.dart' as error_driver_test;
 import 'error_test.dart' as error_test;
 import 'get_errors_after_analysis_test.dart' as get_errors_after_analysis_test;
 import 'get_errors_before_analysis_test.dart'
@@ -15,6 +16,7 @@
 import 'get_hover_test.dart' as get_hover_test;
 import 'highlights_test.dart' as highlights_test;
 import 'highlights_test2.dart' as highlights_test2;
+import 'lint_driver_test.dart' as lint_driver_test;
 import 'lint_test.dart' as lint_test;
 import 'navigation_test.dart' as navigation_test;
 import 'occurrences_test.dart' as occurrences_test;
@@ -23,6 +25,7 @@
 import 'package_root_test.dart' as package_root_test;
 import 'reanalyze_concurrent_test.dart' as reanalyze_concurrent_test;
 import 'reanalyze_test.dart' as reanalyze_test;
+import 'update_content_driver_test.dart' as update_content_driver_test;
 import 'update_content_list_test.dart' as update_content_list_test;
 import 'update_content_test.dart' as update_content_test;
 
@@ -32,6 +35,7 @@
 main() {
   defineReflectiveSuite(() {
     analysis_options_test.main();
+    error_driver_test.main();
     error_test.main();
     get_errors_after_analysis_test.main();
     get_errors_before_analysis_test.main();
@@ -39,6 +43,7 @@
     get_hover_test.main();
     highlights_test.main();
     highlights_test2.main();
+    lint_driver_test.main();
     lint_test.main();
     navigation_test.main();
     occurrences_test.main();
@@ -47,6 +52,7 @@
     package_root_test.main();
     reanalyze_concurrent_test.main();
     reanalyze_test.main();
+    update_content_driver_test.main();
     update_content_test.main();
     update_content_list_test.main();
   }, name: 'analysis');
diff --git a/pkg/analysis_server/test/integration/analysis/update_content_driver_test.dart b/pkg/analysis_server/test/integration/analysis/update_content_driver_test.dart
new file mode 100644
index 0000000..1542356
--- /dev/null
+++ b/pkg/analysis_server/test/integration/analysis/update_content_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'update_content_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(UpdateContentTest_Driver);
+  });
+}
+
+@reflectiveTest
+class UpdateContentTest_Driver extends AbstractUpdateContentTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart b/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart
index b235a39..5ca5c08 100644
--- a/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.update.content.list;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -12,12 +10,12 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(UpdateContentTest);
+    defineReflectiveTests(UpdateContentTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractUpdateContentTest extends AbstractAnalysisServerIntegrationTest {
   test_updateContent_list() {
     String pathname = sourcePath('test.dart');
     String goodText = r'''
@@ -52,3 +50,12 @@
     });
   }
 }
+
+@reflectiveTest
+class UpdateContentTest extends AbstractUpdateContentTest {}
+
+@reflectiveTest
+class UpdateContentTest_Driver extends AbstractUpdateContentTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/update_content_test.dart b/pkg/analysis_server/test/integration/analysis/update_content_test.dart
index 1d275ce2..b853209 100644
--- a/pkg/analysis_server/test/integration/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/update_content_test.dart
@@ -2,8 +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.
 
-library test.integration.analysis.update.content;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -12,59 +10,102 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(UpdateContentTest);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
-  test_updateContent() {
-    String pathname = sourcePath('test.dart');
+class AbstractUpdateContentTest extends AbstractAnalysisServerIntegrationTest {
+  test_updateContent() async {
+    String path = sourcePath('test.dart');
     String goodText = r'''
 main() {
   print("Hello, world!");
 }''';
+
     String badText = goodText.replaceAll(';', '');
-    writeFile(pathname, badText);
+    writeFile(path, badText);
     standardAnalysisSetup();
-    return analysisFinished
-        .then((_) {
-          // The contents on disk (badText) are missing a semicolon.
-          expect(currentAnalysisErrors[pathname], isNotEmpty);
-        })
-        .then((_) => sendAnalysisUpdateContent(
-            {pathname: new AddContentOverlay(goodText)}))
-        .then((result) => analysisFinished)
-        .then((_) {
-          // There should be no errors now because the contents on disk have been
-          // overridden with goodText.
-          expect(currentAnalysisErrors[pathname], isEmpty);
-          return sendAnalysisUpdateContent({
-            pathname: new ChangeContentOverlay(
-                [new SourceEdit(goodText.indexOf(';'), 1, '')])
-          });
-        })
-        .then((result) => analysisFinished)
-        .then((_) {
-          // There should be errors now because we've removed the semicolon.
-          expect(currentAnalysisErrors[pathname], isNotEmpty);
-          return sendAnalysisUpdateContent({
-            pathname: new ChangeContentOverlay(
-                [new SourceEdit(goodText.indexOf(';'), 0, ';')])
-          });
-        })
-        .then((result) => analysisFinished)
-        .then((_) {
-          // There should be no errors now because we've added the semicolon back.
-          expect(currentAnalysisErrors[pathname], isEmpty);
-          return sendAnalysisUpdateContent(
-              {pathname: new RemoveContentOverlay()});
-        })
-        .then((result) => analysisFinished)
-        .then((_) {
-          // Now there should be errors again, because the contents on disk are no
-          // longer overridden.
-          expect(currentAnalysisErrors[pathname], isNotEmpty);
-        });
+
+    // The contents on disk (badText) are missing a semicolon.
+    await analysisFinished;
+    expect(currentAnalysisErrors[path], isNotEmpty);
+
+    // There should be no errors now because the contents on disk have been
+    // overridden with goodText.
+    sendAnalysisUpdateContent({path: new AddContentOverlay(goodText)});
+    await analysisFinished;
+    expect(currentAnalysisErrors[path], isEmpty);
+
+    // There should be errors now because we've removed the semicolon.
+    sendAnalysisUpdateContent({
+      path: new ChangeContentOverlay(
+          [new SourceEdit(goodText.indexOf(';'), 1, '')])
+    });
+    await analysisFinished;
+    expect(currentAnalysisErrors[path], isNotEmpty);
+
+    // There should be no errors now because we've added the semicolon back.
+    sendAnalysisUpdateContent({
+      path: new ChangeContentOverlay(
+          [new SourceEdit(goodText.indexOf(';'), 0, ';')])
+    });
+    await analysisFinished;
+    expect(currentAnalysisErrors[path], isEmpty);
+
+    // Now there should be errors again, because the contents on disk are no
+    // longer overridden.
+    sendAnalysisUpdateContent({path: new RemoveContentOverlay()});
+    await analysisFinished;
+    expect(currentAnalysisErrors[path], isNotEmpty);
+  }
+
+  @failingTest
+  test_updateContent_multipleAdds() async {
+    String pathname = sourcePath('test.dart');
+    writeFile(
+        pathname,
+        r'''
+class Person {
+  String _name;
+  Person(this._name);
+  String get name => this._name;
+  String toString() => "Name: ${name}";
+}
+void main() {
+  var p = new Person("Skeletor");
+  p.xname = "Faker";
+  print(p);
+}
+''');
+    standardAnalysisSetup();
+    await analysisFinished;
+    expect(currentAnalysisErrors[pathname], isList);
+    List<AnalysisError> errors1 = currentAnalysisErrors[pathname];
+    expect(errors1, hasLength(1));
+    expect(errors1[0].location.file, equals(pathname));
+
+    await sendAnalysisUpdateContent({
+      pathname: new AddContentOverlay(r'''
+class Person {
+  String _name;
+  Person(this._name);
+  String get name => this._name;
+  String toString() => "Name: ${name}";
+}
+void main() {
+  var p = new Person("Skeletor");
+  p.name = "Faker";
+  print(p);
+}
+''')
+    });
+    await analysisFinished;
+    expect(currentAnalysisErrors[pathname], isList);
+    List<AnalysisError> errors2 = currentAnalysisErrors[pathname];
+    expect(errors2, hasLength(1));
+    expect(errors2[0].location.file, equals(pathname));
   }
 }
+
+@reflectiveTest
+class UpdateContentTest extends AbstractUpdateContentTest {}
diff --git a/pkg/analysis_server/test/integration/completion/get_suggestions_driver_test.dart b/pkg/analysis_server/test/integration/completion/get_suggestions_driver_test.dart
new file mode 100644
index 0000000..0e77363
--- /dev/null
+++ b/pkg/analysis_server/test/integration/completion/get_suggestions_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'get_suggestions_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(GetSuggestionsTest_Driver);
+  });
+}
+
+@reflectiveTest
+class GetSuggestionsTest_Driver extends AbstractGetSuggestionsTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart b/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
index 653711f..8c1c4a2 100644
--- a/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
+++ b/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
@@ -2,8 +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.
 
-library test.integration.completion.get.suggestions;
-
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -12,12 +10,11 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(GetSuggestionsTest);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractGetSuggestionsTest extends AbstractAnalysisServerIntegrationTest {
   String path;
   String content;
   int completionOffset;
@@ -123,3 +120,6 @@
     });
   }
 }
+
+@reflectiveTest
+class GetSuggestionsTest extends AbstractGetSuggestionsTest {}
diff --git a/pkg/analysis_server/test/integration/completion/test_all.dart b/pkg/analysis_server/test/integration/completion/test_all.dart
index 580ffca..0da4272 100644
--- a/pkg/analysis_server/test/integration/completion/test_all.dart
+++ b/pkg/analysis_server/test/integration/completion/test_all.dart
@@ -6,6 +6,7 @@
 
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
+import 'get_suggestions_driver_test.dart' as get_suggestions_driver_test;
 import 'get_suggestions_test.dart' as get_suggestions_test;
 
 /**
@@ -13,6 +14,7 @@
  */
 main() {
   defineReflectiveSuite(() {
+    get_suggestions_driver_test.main();
     get_suggestions_test.main();
   }, name: 'completion');
 }
diff --git a/pkg/analysis_server/test/integration/integration_tests.dart b/pkg/analysis_server/test/integration/integration_tests.dart
index 71b5378..b278c96 100644
--- a/pkg/analysis_server/test/integration/integration_tests.dart
+++ b/pkg/analysis_server/test/integration/integration_tests.dart
@@ -154,6 +154,11 @@
   }
 
   /**
+   * Return `true` if the new analysis driver should be used by these tests.
+   */
+  bool get enableNewAnalysisDriver => false;
+
+  /**
    * Print out any messages exchanged with the server.  If some messages have
    * already been exchanged with the server, they are printed out immediately.
    */
@@ -242,6 +247,7 @@
       server.start(
           checked: checked,
           diagnosticPort: diagnosticPort,
+          enableNewAnalysisDriver: enableNewAnalysisDriver,
           servicesPort: servicesPort);
 
   /**
@@ -636,6 +642,7 @@
       {bool checked: true,
       bool debugServer: false,
       int diagnosticPort,
+      bool enableNewAnalysisDriver: false,
       bool profileServer: false,
       String sdkPath,
       int servicesPort,
@@ -691,6 +698,9 @@
     if (useAnalysisHighlight2) {
       arguments.add('--useAnalysisHighlight2');
     }
+    if (enableNewAnalysisDriver) {
+      arguments.add('--enable-new-analysis-driver');
+    }
 //    print('Launching $serverPath');
 //    print('$dartBinary ${arguments.join(' ')}');
     return Process.start(dartBinary, arguments).then((Process process) {
diff --git a/pkg/analysis_server/test/integration/search/get_type_hierarchy_test.dart b/pkg/analysis_server/test/integration/search/get_type_hierarchy_test.dart
index bcfa73e..2e1e778 100644
--- a/pkg/analysis_server/test/integration/search/get_type_hierarchy_test.dart
+++ b/pkg/analysis_server/test/integration/search/get_type_hierarchy_test.dart
@@ -2,8 +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.
 
-library test.integration.search.domain;
-
 import 'dart:async';
 
 import 'package:analysis_server/plugin/protocol/protocol.dart';
@@ -14,57 +12,13 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(GetTypeHierarchyTest);
+    defineReflectiveTests(GetTypeHierarchyTest_Driver);
   });
 }
 
-/**
- * Results of a getTypeHierarchy request, processed for easier testing.
- */
-class HierarchyResults {
-  /**
-   * The list of hierarchy items from the result.
-   */
-  List<TypeHierarchyItem> items;
-
-  /**
-   * The first hierarchy item from the result, which represents the pivot
-   * class.
-   */
-  TypeHierarchyItem pivot;
-
-  /**
-   * A map from element name to item index.
-   */
-  Map<String, int> nameToIndex;
-
-  /**
-   * Create a [HierarchyResults] object based on the result from a
-   * getTypeHierarchy request.
-   */
-  HierarchyResults(this.items) {
-    pivot = items[0];
-    nameToIndex = <String, int>{};
-    for (int i = 0; i < items.length; i++) {
-      nameToIndex[items[i].classElement.name] = i;
-    }
-  }
-
-  /**
-   * Get an item by class name.
-   */
-  TypeHierarchyItem getItem(String name) {
-    if (nameToIndex.containsKey(name)) {
-      return items[nameToIndex[name]];
-    } else {
-      fail('Class $name not found in hierarchy results');
-      return null;
-    }
-  }
-}
-
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractGetTypeHierarchyTest
+    extends AbstractAnalysisServerIntegrationTest {
   /**
    * Pathname of the main file to run tests in.
    */
@@ -274,3 +228,57 @@
     }
   }
 }
+
+@reflectiveTest
+class GetTypeHierarchyTest extends AbstractGetTypeHierarchyTest {}
+
+@reflectiveTest
+class GetTypeHierarchyTest_Driver extends AbstractGetTypeHierarchyTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
+
+/**
+ * Results of a getTypeHierarchy request, processed for easier testing.
+ */
+class HierarchyResults {
+  /**
+   * The list of hierarchy items from the result.
+   */
+  List<TypeHierarchyItem> items;
+
+  /**
+   * The first hierarchy item from the result, which represents the pivot
+   * class.
+   */
+  TypeHierarchyItem pivot;
+
+  /**
+   * A map from element name to item index.
+   */
+  Map<String, int> nameToIndex;
+
+  /**
+   * Create a [HierarchyResults] object based on the result from a
+   * getTypeHierarchy request.
+   */
+  HierarchyResults(this.items) {
+    pivot = items[0];
+    nameToIndex = <String, int>{};
+    for (int i = 0; i < items.length; i++) {
+      nameToIndex[items[i].classElement.name] = i;
+    }
+  }
+
+  /**
+   * Get an item by class name.
+   */
+  TypeHierarchyItem getItem(String name) {
+    if (nameToIndex.containsKey(name)) {
+      return items[nameToIndex[name]];
+    } else {
+      fail('Class $name not found in hierarchy results');
+      return null;
+    }
+  }
+}
diff --git a/pkg/analysis_server/test/integration/server/get_version_test.dart b/pkg/analysis_server/test/integration/server/get_version_test.dart
index 223957b..4da351c 100644
--- a/pkg/analysis_server/test/integration/server/get_version_test.dart
+++ b/pkg/analysis_server/test/integration/server/get_version_test.dart
@@ -2,21 +2,28 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-library test.integration.server.get.version;
-
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import '../integration_tests.dart';
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(GetVersionTest);
+    defineReflectiveTests(GetVersionTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractGetVersionTest extends AbstractAnalysisServerIntegrationTest {
   test_getVersion() {
     return sendServerGetVersion();
   }
 }
+
+@reflectiveTest
+class GetVersionTest extends AbstractGetVersionTest {}
+
+@reflectiveTest
+class GetVersionTest_Driver extends AbstractGetVersionTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/server/set_subscriptions_invalid_service_test.dart b/pkg/analysis_server/test/integration/server/set_subscriptions_invalid_service_test.dart
index 2460ad9..d2a996d 100644
--- a/pkg/analysis_server/test/integration/server/set_subscriptions_invalid_service_test.dart
+++ b/pkg/analysis_server/test/integration/server/set_subscriptions_invalid_service_test.dart
@@ -2,8 +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.
 
-library test.integration.server.set.subscriptions.invalid.service;
-
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -11,12 +9,13 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(SetSubscriptionsTest);
+    defineReflectiveTests(SetSubscriptionsTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractSetSubscriptionsTest
+    extends AbstractAnalysisServerIntegrationTest {
   test_setSubscriptions_invalidService() {
     // TODO(paulberry): verify that if an invalid service is specified, the
     // current subscriptions are unchanged.
@@ -29,3 +28,12 @@
     });
   }
 }
+
+@reflectiveTest
+class SetSubscriptionsTest extends AbstractSetSubscriptionsTest {}
+
+@reflectiveTest
+class SetSubscriptionsTest_Driver extends AbstractSetSubscriptionsTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/server/set_subscriptions_test.dart b/pkg/analysis_server/test/integration/server/set_subscriptions_test.dart
index b88618c..9ec4f3f 100644
--- a/pkg/analysis_server/test/integration/server/set_subscriptions_test.dart
+++ b/pkg/analysis_server/test/integration/server/set_subscriptions_test.dart
@@ -2,8 +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.
 
-library test.integration.server.set.subscriptions;
-
 import 'dart:async';
 
 import 'package:analysis_server/plugin/protocol/protocol.dart';
@@ -14,12 +12,13 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(SetSubscriptionsTest);
+    defineReflectiveTests(SetSubscriptionsTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractSetSubscriptionsTest
+    extends AbstractAnalysisServerIntegrationTest {
   test_setSubscriptions() {
     bool statusReceived = false;
     Completer analysisBegun = new Completer();
@@ -60,3 +59,20 @@
     });
   }
 }
+
+@reflectiveTest
+class SetSubscriptionsTest extends AbstractSetSubscriptionsTest {}
+
+@reflectiveTest
+class SetSubscriptionsTest_Driver extends AbstractSetSubscriptionsTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  @failingTest
+  @override
+  test_setSubscriptions() {
+    // This test times out on the bots and has been disabled to keep them green.
+    // We need to discover the cause and re-enable it.
+    fail('Timed out');
+  }
+}
diff --git a/pkg/analysis_server/test/integration/server/shutdown_test.dart b/pkg/analysis_server/test/integration/server/shutdown_test.dart
index c919d4e..53a01a9 100644
--- a/pkg/analysis_server/test/integration/server/shutdown_test.dart
+++ b/pkg/analysis_server/test/integration/server/shutdown_test.dart
@@ -2,8 +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.
 
-library test.integration.server.shutdown;
-
 import 'dart:async';
 
 import 'package:test/test.dart';
@@ -13,12 +11,12 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(ShutdownTest);
+    defineReflectiveTests(ShutdownTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractShutdownTest extends AbstractAnalysisServerIntegrationTest {
   test_shutdown() {
     return sendServerShutdown().then((_) {
       return new Future.delayed(new Duration(seconds: 1)).then((_) {
@@ -31,3 +29,12 @@
     });
   }
 }
+
+@reflectiveTest
+class ShutdownTest extends AbstractShutdownTest {}
+
+@reflectiveTest
+class ShutdownTest_Driver extends AbstractShutdownTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/integration/server/status_test.dart b/pkg/analysis_server/test/integration/server/status_test.dart
index 9222934..6f33a10 100644
--- a/pkg/analysis_server/test/integration/server/status_test.dart
+++ b/pkg/analysis_server/test/integration/server/status_test.dart
@@ -2,8 +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.
 
-library test.integration.server.status;
-
 import 'dart:async';
 
 import 'package:analysis_server/plugin/protocol/protocol.dart';
@@ -14,12 +12,12 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(Test);
+    defineReflectiveTests(StatusTest);
+    defineReflectiveTests(StatusTest_Driver);
   });
 }
 
-@reflectiveTest
-class Test extends AbstractAnalysisServerIntegrationTest {
+class AbstractStatusTest extends AbstractAnalysisServerIntegrationTest {
   test_status() {
     // After we kick off analysis, we should get one server.status message with
     // analyzing=true, and another server.status message after that with
@@ -52,3 +50,12 @@
     });
   }
 }
+
+@reflectiveTest
+class StatusTest extends AbstractStatusTest {}
+
+@reflectiveTest
+class StatusTest_Driver extends AbstractStatusTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/mock_sdk.dart b/pkg/analysis_server/test/mock_sdk.dart
index acb2095..ab40d91 100644
--- a/pkg/analysis_server/test/mock_sdk.dart
+++ b/pkg/analysis_server/test/mock_sdk.dart
@@ -24,9 +24,12 @@
 import 'dart:_internal';
 
 class Object {
+  const Object() {}
   bool operator ==(other) => identical(this, other);
   String toString() => 'a string';
   int get hashCode => 0;
+  Type get runtimeType => null;
+  dynamic noSuchMethod(Invocation invocation) => null;
 }
 
 class Function {}
@@ -130,13 +133,24 @@
   Iterable/*<R>*/ map/*<R>*/(/*=R*/ f(E e));
 }
 
-abstract class List<E> implements Iterable<E> {
-  void add(E value);
+class List<E> implements Iterable<E> {
+  List();
+  void add(E value) {}
   void addAll(Iterable<E> iterable) {}
-  E operator [](int index);
-  void operator []=(int index, E value);
+  E operator [](int index) => null;
+  void operator []=(int index, E value) {}
   Iterator<E> get iterator => null;
-  void clear();
+  void clear() {}
+
+  bool get isEmpty => false;
+  E get first => null;
+  E get last => null;
+
+  Iterable/*<R>*/ map/*<R>*/(/*=R*/ f(E e)) => null;
+
+  /*=R*/ fold/*<R>*/(/*=R*/ initialValue,
+      /*=R*/ combine(/*=R*/ previousValue, E element)) => null;
+
 }
 
 abstract class Map<K, V> extends Object {
@@ -173,6 +187,8 @@
   static Future wait(List<Future> futures) => null;
 }
 
+class FutureOr<T> {}
+
 class Stream<T> {}
 abstract class StreamTransformer<S, T> {}
 ''');
@@ -206,8 +222,8 @@
 const double E = 2.718281828459045;
 const double PI = 3.1415926535897932;
 const double LN10 =  2.302585092994046;
-num min(num a, num b) => 0;
-num max(num a, num b) => 0;
+T min<T extends num>(T a, T b) => null;
+T max<T extends num>(T a, T b) => null;
 external double cos(num x);
 external num pow(num x, num exponent);
 external double sin(num x);
@@ -269,13 +285,24 @@
    */
   PackageBundle _bundle;
 
-  MockSdk({resource.ResourceProvider resourceProvider})
+  MockSdk(
+      {bool generateSummaryFiles: false,
+      resource.ResourceProvider resourceProvider})
       : provider = resourceProvider ?? new resource.MemoryResourceProvider() {
     LIBRARIES.forEach((SdkLibrary library) {
       provider.newFile(library.path, (library as MockSdkLibrary).content);
     });
-    provider.newFile('/lib/_internal/sdk_library_metadata/lib/libraries.dart',
+    provider.newFile(
+        provider.convertPath(
+            '/lib/_internal/sdk_library_metadata/lib/libraries.dart'),
         librariesContent);
+    if (generateSummaryFiles) {
+      List<int> bytes = _computeLinkedBundleBytes();
+      provider.newFileWithBytes(
+          provider.convertPath('/lib/_internal/spec.sum'), bytes);
+      provider.newFileWithBytes(
+          provider.convertPath('/lib/_internal/strong.sum'), bytes);
+    }
   }
 
   @override
@@ -307,28 +334,26 @@
 
   @override
   Source fromFileUri(Uri uri) {
-    String filePath = uri.path;
-    String libPath = '/lib';
-    if (!filePath.startsWith("$libPath/")) {
-      return null;
-    }
-    for (SdkLibrary library in LIBRARIES) {
-      String libraryPath = library.path;
-      if (filePath.replaceAll('\\', '/') == libraryPath) {
+    String filePath = provider.pathContext.fromUri(uri);
+    for (SdkLibrary library in sdkLibraries) {
+      String libraryPath = provider.convertPath(library.path);
+      if (filePath == libraryPath) {
         try {
-          resource.File file = provider.getResource(uri.path);
+          resource.File file = provider.getResource(filePath);
           Uri dartUri = Uri.parse(library.shortName);
           return file.createSource(dartUri);
         } catch (exception) {
           return null;
         }
       }
-      if (filePath.startsWith("$libraryPath/")) {
-        String pathInLibrary = filePath.substring(libraryPath.length + 1);
-        String path = '${library.shortName}/$pathInLibrary';
+      String libraryRootPath = provider.pathContext.dirname(libraryPath) +
+          provider.pathContext.separator;
+      if (filePath.startsWith(libraryRootPath)) {
+        String pathInLibrary = filePath.substring(libraryRootPath.length);
+        String uriStr = '${library.shortName}/$pathInLibrary';
         try {
-          resource.File file = provider.getResource(uri.path);
-          Uri dartUri = new Uri(scheme: 'dart', path: path);
+          resource.File file = provider.getResource(filePath);
+          Uri dartUri = Uri.parse(uriStr);
           return file.createSource(dartUri);
         } catch (exception) {
           return null;
@@ -341,12 +366,14 @@
   @override
   PackageBundle getLinkedBundle() {
     if (_bundle == null) {
-      List<Source> librarySources = sdkLibraries
-          .map((SdkLibrary library) => mapDartUri(library.shortName))
-          .toList();
-      List<int> bytes = new SummaryBuilder(
-              librarySources, context, context.analysisOptions.strongMode)
-          .build();
+      resource.File summaryFile =
+          provider.getFile(provider.convertPath('/lib/_internal/spec.sum'));
+      List<int> bytes;
+      if (summaryFile.exists) {
+        bytes = summaryFile.readAsBytesSync();
+      } else {
+        bytes = _computeLinkedBundleBytes();
+      }
       _bundle = new PackageBundle.fromBuffer(bytes);
     }
     return _bundle;
@@ -383,6 +410,18 @@
     // table above.
     return null;
   }
+
+  /**
+   * Compute the bytes of the linked bundle associated with this SDK.
+   */
+  List<int> _computeLinkedBundleBytes() {
+    List<Source> librarySources = sdkLibraries
+        .map((SdkLibrary library) => mapDartUri(library.shortName))
+        .toList();
+    return new SummaryBuilder(
+            librarySources, context, context.analysisOptions.strongMode)
+        .build();
+  }
 }
 
 class MockSdkLibrary implements SdkLibrary {
@@ -414,7 +453,4 @@
   bool get isVmLibrary => throw unimplemented;
 
   UnimplementedError get unimplemented => new UnimplementedError();
-
-  @override
-  List<String> getPatches(int platform) => const <String>[];
 }
diff --git a/pkg/analysis_server/test/plugin/protocol_dart_test.dart b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
index 5f45220..a08ff88 100644
--- a/pkg/analysis_server/test/plugin/protocol_dart_test.dart
+++ b/pkg/analysis_server/test/plugin/protocol_dart_test.dart
@@ -102,14 +102,14 @@
     return findChildElement(unit.element, name, kind);
   }
 
-  void test_fromElement_CLASS() {
+  test_fromElement_CLASS() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
 @deprecated
 abstract class _A {}
 class B<K, V> {}''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     {
       engine.ClassElement engineElement = findElementInUnit(unit, '_A');
       // create notification Element
@@ -143,14 +143,14 @@
     }
   }
 
-  void test_fromElement_CONSTRUCTOR() {
+  test_fromElement_CONSTRUCTOR() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
 class A {
   const A.myConstructor(int a, [String b]);
 }''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     engine.ConstructorElement engineElement =
         findElementInUnit(unit, 'myConstructor');
     // create notification Element
@@ -183,14 +183,14 @@
     expect(element.flags, 0);
   }
 
-  void test_fromElement_ENUM() {
+  test_fromElement_ENUM() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
 @deprecated
 enum _E1 { one, two }
 enum E2 { three, four }''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     {
       engine.ClassElement engineElement = findElementInUnit(unit, '_E1');
       expect(engineElement.isDeprecated, isTrue);
@@ -224,14 +224,14 @@
     }
   }
 
-  void test_fromElement_ENUM_CONSTANT() {
+  test_fromElement_ENUM_CONSTANT() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
 @deprecated
 enum _E1 { one, two }
 enum E2 { three, four }''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     {
       engine.FieldElement engineElement = findElementInUnit(unit, 'one');
       // create notification Element
@@ -312,14 +312,14 @@
     }
   }
 
-  void test_fromElement_FIELD() {
+  test_fromElement_FIELD() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
 class A {
   static const myField = 42;
 }''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     engine.FieldElement engineElement = findElementInUnit(unit, 'myField');
     // create notification Element
     Element element = convertElement(engineElement);
@@ -338,13 +338,13 @@
     expect(element.flags, Element.FLAG_CONST | Element.FLAG_STATIC);
   }
 
-  void test_fromElement_FUNCTION_TYPE_ALIAS() {
+  test_fromElement_FUNCTION_TYPE_ALIAS() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
 typedef int F<T>(String x);
 ''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     engine.FunctionTypeAliasElement engineElement =
         findElementInUnit(unit, 'F');
     // create notification Element
@@ -365,14 +365,14 @@
     expect(element.flags, 0);
   }
 
-  void test_fromElement_GETTER() {
+  test_fromElement_GETTER() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
 class A {
   String get myGetter => 42;
 }''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     engine.PropertyAccessorElement engineElement =
         findElementInUnit(unit, 'myGetter', engine.ElementKind.GETTER);
     // create notification Element
@@ -392,7 +392,7 @@
     expect(element.flags, 0);
   }
 
-  void test_fromElement_LABEL() {
+  test_fromElement_LABEL() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
@@ -402,7 +402,7 @@
     break myLabel;
   }
 }''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     engine.LabelElement engineElement = findElementInUnit(unit, 'myLabel');
     // create notification Element
     Element element = convertElement(engineElement);
@@ -421,7 +421,7 @@
     expect(element.flags, 0);
   }
 
-  void test_fromElement_METHOD() {
+  test_fromElement_METHOD() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
@@ -430,7 +430,7 @@
     return null;
   }
 }''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     engine.MethodElement engineElement = findElementInUnit(unit, 'myMethod');
     // create notification Element
     Element element = convertElement(engineElement);
@@ -449,14 +449,14 @@
     expect(element.flags, Element.FLAG_STATIC);
   }
 
-  void test_fromElement_SETTER() {
+  test_fromElement_SETTER() async {
     engine.Source source = addSource(
         '/test.dart',
         '''
 class A {
   set mySetter(String x) {}
 }''');
-    engine.CompilationUnit unit = resolveLibraryUnit(source);
+    engine.CompilationUnit unit = await resolveLibraryUnit(source);
     engine.FieldElement engineFieldElement =
         findElementInUnit(unit, 'mySetter', engine.ElementKind.FIELD);
     engine.PropertyAccessorElement engineElement = engineFieldElement.setter;
diff --git a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
index 78a6f4e..5d7c085 100644
--- a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
@@ -15,6 +15,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(ArgListContributorTest);
+    defineReflectiveTests(ArgListContributorTest_Driver);
   });
 }
 
@@ -631,3 +632,9 @@
     assertSuggestArgumentList(['arg', 'blat'], ['dynamic', 'int']);
   }
 }
+
+@reflectiveTest
+class ArgListContributorTest_Driver extends ArgListContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
index 7b4774c..4290b2f 100644
--- a/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/combinator_contributor_test.dart
@@ -15,6 +15,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(CombinatorContributorTest);
+    defineReflectiveTests(CombinatorContributorTest_Driver);
   });
 }
 
@@ -64,7 +65,9 @@
       class X {}''');
 
     // Assume that imported libraries have been resolved
-    context.resolveCompilationUnit2(importedLibSource, importedLibSource);
+    if (!enableNewAnalysisDriver) {
+      context.resolveCompilationUnit2(importedLibSource, importedLibSource);
+    }
 
     await computeSuggestions();
     assertSuggestClass('A',
@@ -116,7 +119,9 @@
       class X {}''');
 
     // Assume that imported libraries have been resolved
-    context.resolveCompilationUnit2(importedLibSource, importedLibSource);
+    if (!enableNewAnalysisDriver) {
+      context.resolveCompilationUnit2(importedLibSource, importedLibSource);
+    }
 
     await computeSuggestions();
     assertSuggestClass('A',
@@ -151,3 +156,9 @@
         kind: CompletionSuggestionKind.IDENTIFIER);
   }
 }
+
+@reflectiveTest
+class CombinatorContributorTest_Driver extends CombinatorContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
index 1a5fac8..6d85584 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
@@ -18,6 +18,7 @@
     show DartCompletionRequestImpl, ReplacementRange;
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analysis_server/src/services/search/search_engine_internal.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/task/dart.dart';
 import 'package:test/test.dart';
@@ -217,8 +218,8 @@
 
   CompletionSuggestion assertSuggestEnumConst(String completion,
       {int relevance: DART_RELEVANCE_DEFAULT, bool isDeprecated: false}) {
-    CompletionSuggestion suggestion =
-        assertSuggest(completion, relevance: relevance, isDeprecated: isDeprecated);
+    CompletionSuggestion suggestion = assertSuggest(completion,
+        relevance: relevance, isDeprecated: isDeprecated);
     expect(suggestion.completion, completion);
     expect(suggestion.isDeprecated, isDeprecated);
     expect(suggestion.element.kind, protocol.ElementKind.ENUM_CONSTANT);
@@ -434,10 +435,13 @@
    * Return a [Future] that completes with the containing library information
    * after it is accessible via [context.getLibrariesContaining].
    */
-  Future computeLibrariesContaining([int times = 200]) {
+  Future<Null> computeLibrariesContaining([int times = 200]) {
+    if (enableNewAnalysisDriver) {
+      return driver.getResult(testFile).then((result) => null);
+    }
     List<Source> libraries = context.getLibrariesContaining(testSource);
     if (libraries.isNotEmpty) {
-      return new Future.value(libraries);
+      return new Future.value(null);
     }
     if (times == 0) {
       fail('failed to determine libraries containing $testSource');
@@ -452,10 +456,16 @@
   }
 
   Future computeSuggestions([int times = 200]) async {
-    context.analysisPriorityOrder = [testSource];
+    AnalysisResult analysisResult = null;
+    if (enableNewAnalysisDriver) {
+      analysisResult = await driver.getResult(testFile);
+      testSource = analysisResult.unit.element.source;
+    } else {
+      context.analysisPriorityOrder = [testSource];
+    }
     CompletionRequestImpl baseRequest = new CompletionRequestImpl(
-        null,
-        context,
+        analysisResult,
+        enableNewAnalysisDriver ? null: context,
         provider,
         searchEngine,
         testSource,
@@ -537,14 +547,18 @@
     return cs;
   }
 
-  Future/*<E>*/ performAnalysis/*<E>*/(int times, Completer/*<E>*/ completer) {
+  Future/*<E>*/ performAnalysis/*<E>*/(int times, Completer/*<E>*/ completer) async {
     if (completer.isCompleted) {
       return completer.future;
     }
-    if (times == 0 || context == null) {
-      return new Future.value();
+    if (enableNewAnalysisDriver) {
+      // Just wait.
+    } else {
+      if (times == 0 || context == null) {
+        return new Future.value();
+      }
+      context.performAnalysisTask();
     }
-    context.performAnalysisTask();
     // We use a delayed future to allow microtask events to finish. The
     // Future.value or Future() constructors use scheduleMicrotask themselves and
     // would therefore not wait for microtask callbacks that are scheduled after
@@ -555,8 +569,10 @@
 
   void resolveSource(String path, String content) {
     Source libSource = addSource(path, content);
-    var target = new LibrarySpecificUnit(libSource, libSource);
-    context.computeResult(target, RESOLVED_UNIT);
+    if (!enableNewAnalysisDriver) {
+      var target = new LibrarySpecificUnit(libSource, libSource);
+      context.computeResult(target, RESOLVED_UNIT);
+    }
   }
 
   @override
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart b/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
index 67e691a..055cfa0 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_manager_test.dart
@@ -11,6 +11,7 @@
 import 'package:analysis_server/src/services/completion/completion_performance.dart';
 import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
 import 'package:analysis_server/src/services/completion/dart/imported_reference_contributor.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/task/dart.dart';
 import 'package:test/test.dart';
@@ -21,6 +22,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(CompletionManagerTest);
+    defineReflectiveTests(CompletionManagerTest_Driver);
   });
 }
 
@@ -52,12 +54,14 @@
     addTestSource('part of libB; main() {^}');
 
     // Associate part with library
-    context.computeResult(libSource, LIBRARY_CYCLE_UNITS);
+    if (!enableNewAnalysisDriver) {
+      context.computeResult(libSource, LIBRARY_CYCLE_UNITS);
+    }
 
     // Build the request
     CompletionRequestImpl baseRequest = new CompletionRequestImpl(
-        null,
-        context,
+        enableNewAnalysisDriver ? await driver.getResult(testFile) : null,
+        enableNewAnalysisDriver ? null : context,
         provider,
         searchEngine,
         testSource,
@@ -76,7 +80,10 @@
     var directives = request.target.unit.directives;
 
     // Assert that the import does not have an export namespace
-    expect(directives[0].element?.library?.exportNamespace, isNull);
+    if (!enableNewAnalysisDriver) {
+      Element element = resolutionMap.elementDeclaredByDirective(directives[0]);
+      expect(element?.library?.exportNamespace, isNull);
+    }
 
     // Resolve directives
     var importCompleter = new Completer<List<ImportElement>>();
@@ -103,3 +110,9 @@
     assertImportedLib('/libA.dart');
   }
 }
+
+@reflectiveTest
+class CompletionManagerTest_Driver extends CompletionManagerTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/field_formal_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/field_formal_contributor_test.dart
index 18da62c..9583d5f 100644
--- a/pkg/analysis_server/test/services/completion/dart/field_formal_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/field_formal_contributor_test.dart
@@ -14,6 +14,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(FieldFormalContributorTest);
+    defineReflectiveTests(FieldFormalContributorTest_Driver);
   });
 }
 
@@ -197,3 +198,9 @@
     assertNotSuggested('x');
   }
 }
+
+@reflectiveTest
+class FieldFormalContributorTest_Driver extends FieldFormalContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index 7d3acd8..7c91fe8 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -15,12 +15,12 @@
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
-import '../../../abstract_context.dart';
 import 'completion_contributor_util.dart';
 
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(ImportedReferenceContributorTest);
+    defineReflectiveTests(ImportedReferenceContributorTest_Driver);
   });
 }
 
@@ -34,17 +34,6 @@
     return new ImportedReferenceContributor();
   }
 
-  fail_enum_deprecated() async {
-    addSource('/libA.dart', 'library A; @deprecated enum E { one, two }');
-    addTestSource('import "/libA.dart"; main() {^}');
-    await computeSuggestions();
-    // TODO(danrube) investigate why suggestion/element is not deprecated
-    // when AST node has correct @deprecated annotation
-    assertSuggestEnum('E', isDeprecated: true);
-    assertNotSuggested('one');
-    assertNotSuggested('two');
-  }
-
   test_ArgumentList() async {
     // ArgumentList  MethodInvocation  ExpressionStatement  Block
     resolveSource(
@@ -666,7 +655,7 @@
     assertNotSuggested('G');
     //assertSuggestClass('H', COMPLETION_RELEVANCE_LOW);
     assertSuggestClass('Object');
-    assertSuggestFunction('min', 'num');
+//    assertSuggestFunction('min', 'T');
     //assertSuggestFunction(
     //    'max',
     //    'num',
@@ -1968,6 +1957,18 @@
     assertNotSuggested('two');
   }
 
+  @failingTest
+  test_enum_deprecated() async {
+    addSource('/libA.dart', 'library A; @deprecated enum E { one, two }');
+    addTestSource('import "/libA.dart"; main() {^}');
+    await computeSuggestions();
+    // TODO(danrube) investigate why suggestion/element is not deprecated
+    // when AST node has correct @deprecated annotation
+    assertSuggestEnum('E', isDeprecated: true);
+    assertNotSuggested('one');
+    assertNotSuggested('two');
+  }
+
   test_ExpressionStatement_identifier() async {
     // SimpleIdentifier  ExpressionStatement  Block
     resolveSource(
@@ -3498,7 +3499,7 @@
     // Create a 2nd context with source
     var context2 = AnalysisEngine.instance.createAnalysisContext();
     context2.sourceFactory =
-        new SourceFactory([AbstractContextTest.SDK_RESOLVER, resourceResolver]);
+        new SourceFactory([new DartUriResolver(sdk), resourceResolver]);
     String content2 = 'class ClassFromAnotherContext { }';
     Source source2 =
         provider.newFile('/context2/foo.dart', content2).createSource();
@@ -4509,3 +4510,15 @@
     assertNotSuggested('e');
   }
 }
+
+@reflectiveTest
+class ImportedReferenceContributorTest_Driver
+    extends ImportedReferenceContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  @override
+  test_enum_deprecated() {
+    // TODO(scheglov) remove it?
+  }
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/inherited_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/inherited_reference_contributor_test.dart
index afed832..8e564c7 100644
--- a/pkg/analysis_server/test/services/completion/dart/inherited_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/inherited_reference_contributor_test.dart
@@ -15,6 +15,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(InheritedContributorTest);
+    defineReflectiveTests(InheritedContributorTest_Driver);
   });
 }
 
@@ -617,3 +618,9 @@
     assertNotSuggested('y2');
   }
 }
+
+@reflectiveTest
+class InheritedContributorTest_Driver extends InheritedContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
index 1667140..4f05941 100644
--- a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
@@ -16,6 +16,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(KeywordContributorTest);
+    defineReflectiveTests(KeywordContributorTest_Driver);
   });
 }
 
@@ -1587,3 +1588,9 @@
     return true;
   }
 }
+
+@reflectiveTest
+class KeywordContributorTest_Driver extends KeywordContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/label_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/label_contributor_test.dart
index 3968e24..a4d7b73 100644
--- a/pkg/analysis_server/test/services/completion/dart/label_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/label_contributor_test.dart
@@ -19,6 +19,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(LabelContributorTest);
+    defineReflectiveTests(LabelContributorTest_Driver);
   });
 }
 
@@ -324,3 +325,9 @@
     assertSuggestLabel('foo');
   }
 }
+
+@reflectiveTest
+class LabelContributorTest_Driver extends LabelContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
index be8318e..fe1e24b 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_member_contributor_test.dart
@@ -14,6 +14,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(LibraryMemberContributorTest);
+    defineReflectiveTests(LibraryMemberContributorTest_Driver);
   });
 }
 
@@ -60,7 +61,7 @@
     import "dart:math" as math;
     main() {math.^.}''');
     await computeSuggestions();
-    assertSuggestFunction('min', 'num');
+    assertSuggestFunction('min', 'T');
   }
 
   test_libraryPrefix_cascade3() async {
@@ -76,7 +77,7 @@
     import "dart:math" as math;
     main() {math.^.a}''');
     await computeSuggestions();
-    assertSuggestFunction('min', 'num');
+    assertSuggestFunction('min', 'T');
   }
 
   test_libraryPrefix_deferred() async {
@@ -269,3 +270,9 @@
     assertNoSuggestions();
   }
 }
+
+@reflectiveTest
+class LibraryMemberContributorTest_Driver extends LibraryMemberContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
index 45d26da..78bd338 100644
--- a/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/library_prefix_contributor_test.dart
@@ -15,6 +15,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(LibraryPrefixContributorTest);
+    defineReflectiveTests(LibraryPrefixContributorTest_Driver);
   });
 }
 
@@ -375,3 +376,9 @@
     assertNoSuggestions();
   }
 }
+
+@reflectiveTest
+class LibraryPrefixContributorTest_Driver extends LibraryPrefixContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
index 4977151..7ee4457 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_constructor_contributor_test.dart
@@ -19,6 +19,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(LocalConstructorContributorTest);
+    defineReflectiveTests(LocalConstructorContributorTest_Driver);
   });
 }
 
@@ -4146,3 +4147,10 @@
     assertNotSuggested('e');
   }
 }
+
+@reflectiveTest
+class LocalConstructorContributorTest_Driver
+    extends LocalConstructorContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/local_declaration_visitor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_declaration_visitor_test.dart
index fe3456d..4e4e727 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_declaration_visitor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_declaration_visitor_test.dart
@@ -73,7 +73,7 @@
   void declaredLabel(Label label, bool isCaseLabel) {}
 
   @override
-  void declaredLocalVar(SimpleIdentifier name, TypeName type) {
+  void declaredLocalVar(SimpleIdentifier name, TypeAnnotation type) {
     expect(name, isNotNull);
   }
 
@@ -81,7 +81,7 @@
   void declaredMethod(MethodDeclaration declaration) {}
 
   @override
-  void declaredParam(SimpleIdentifier name, TypeName type) {}
+  void declaredParam(SimpleIdentifier name, TypeAnnotation type) {}
 
   @override
   void declaredTopLevelVar(
diff --git a/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
index b5758fd..6a49e95 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_library_contributor_test.dart
@@ -14,6 +14,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(LocalLibraryContributorTest);
+    defineReflectiveTests(LocalLibraryContributorTest_Driver);
   });
 }
 
@@ -306,3 +307,9 @@
     assertNotSuggested('m');
   }
 }
+
+@reflectiveTest
+class LocalLibraryContributorTest_Driver extends LocalLibraryContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 7e1cb94..20cf6ef 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -19,6 +19,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(LocalReferenceContributorTest);
+    defineReflectiveTests(LocalReferenceContributorTest_Driver);
   });
 }
 
@@ -4551,3 +4552,10 @@
     assertNotSuggested('e');
   }
 }
+
+@reflectiveTest
+class LocalReferenceContributorTest_Driver
+    extends LocalReferenceContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
index fd14593..e938523 100644
--- a/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/named_constructor_contributor_test.dart
@@ -16,6 +16,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(NamedConstructorContributorTest);
+    defineReflectiveTests(NamedConstructorContributorTest_Driver);
   });
 }
 
@@ -60,7 +61,9 @@
         var m;
         main() {new X.^}''');
     // Assume that imported libraries are resolved
-    await resolveLibraryUnit(libSource);
+    if (!enableNewAnalysisDriver) {
+      await resolveLibraryUnit(libSource);
+    }
     await computeSuggestions();
     expect(replacementOffset, completionOffset);
     expect(replacementLength, 0);
@@ -114,7 +117,9 @@
         var m;
         main() {new X.^}''');
     // Assume that imported libraries are resolved
-    await resolveLibraryUnit(libSource);
+    if (!enableNewAnalysisDriver) {
+      await resolveLibraryUnit(libSource);
+    }
     await computeSuggestions();
     expect(replacementOffset, completionOffset);
     expect(replacementLength, 0);
@@ -180,3 +185,10 @@
     assertNotSuggested('m');
   }
 }
+
+@reflectiveTest
+class NamedConstructorContributorTest_Driver
+    extends NamedConstructorContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/optype_test.dart b/pkg/analysis_server/test/services/completion/dart/optype_test.dart
index f285173..17cf6c4 100644
--- a/pkg/analysis_server/test/services/completion/dart/optype_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/optype_test.dart
@@ -8,13 +8,15 @@
 import 'package:analysis_server/src/provisional/completion/dart/completion_target.dart';
 import 'package:analysis_server/src/services/completion/dart/optype.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:plugin/manager.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
-import '../../../abstract_context.dart';
+import '../../../mock_sdk.dart';
 
 main() {
   defineReflectiveSuite(() {
@@ -27,6 +29,9 @@
   OpType visitor;
 
   void addTestSource(String content, {bool resolved: false}) {
+    MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
+    DartSdk sdk = new MockSdk(resourceProvider: resourceProvider);
+
     int offset = content.indexOf('^');
     expect(offset, isNot(equals(-1)), reason: 'missing ^');
     int nextOffset = content.indexOf('^', offset + 1);
@@ -34,8 +39,7 @@
     content = content.substring(0, offset) + content.substring(offset + 1);
     Source source = new _TestSource('/completionTest.dart');
     AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
-    context.sourceFactory =
-        new SourceFactory([AbstractContextTest.SDK_RESOLVER]);
+    context.sourceFactory = new SourceFactory([new DartUriResolver(sdk)]);
     context.setContents(source, content);
     CompilationUnit unit = resolved
         ? context.resolveCompilationUnit2(source, source)
diff --git a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
index 342dcc3..fa7529f 100644
--- a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
@@ -14,6 +14,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(StaticMemberContributorTest);
+    defineReflectiveTests(StaticMemberContributorTest_Driver);
   });
 }
 
@@ -287,3 +288,9 @@
     assertNotSuggested('==');
   }
 }
+
+@reflectiveTest
+class StaticMemberContributorTest_Driver extends StaticMemberContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
index 1915011..9801e82 100644
--- a/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/type_member_contributor_test.dart
@@ -17,6 +17,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(TypeMemberContributorTest);
+    defineReflectiveTests(TypeMemberContributorTest_Driver);
   });
 }
 
@@ -4157,3 +4158,9 @@
     assertNotSuggested('e');
   }
 }
+
+@reflectiveTest
+class TypeMemberContributorTest_Driver extends TypeMemberContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
index 705b0e3..2df2669 100644
--- a/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/uri_contributor_test.dart
@@ -18,6 +18,8 @@
   defineReflectiveSuite(() {
     defineReflectiveTests(UriContributorTest);
     defineReflectiveTests(UriContributorWindowsTest);
+    defineReflectiveTests(UriContributorTest_Driver);
+    defineReflectiveTests(UriContributorWindowsTest_Driver);
   });
 }
 
@@ -463,6 +465,12 @@
 }
 
 @reflectiveTest
+class UriContributorTest_Driver extends UriContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
+
+@reflectiveTest
 class UriContributorWindowsTest extends DartCompletionContributorTest {
   @override
   DartCompletionContributor createContributor() {
@@ -628,6 +636,12 @@
   }
 }
 
+@reflectiveTest
+class UriContributorWindowsTest_Driver extends UriContributorWindowsTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
+
 class _TestWinResourceProvider extends MemoryResourceProvider {
   @override
   Context get pathContext => windows;
diff --git a/pkg/analysis_server/test/services/completion/dart/variable_name_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/variable_name_contributor_test.dart
index a5c4446..316e1d8 100644
--- a/pkg/analysis_server/test/services/completion/dart/variable_name_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/variable_name_contributor_test.dart
@@ -14,6 +14,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(VariableNameContributorTest);
+    defineReflectiveTests(VariableNameContributorTest_Driver);
   });
 }
 
@@ -244,3 +245,9 @@
     assertSuggestName('a');
   }
 }
+
+@reflectiveTest
+class VariableNameContributorTest_Driver extends VariableNameContributorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/correction/assist_test.dart b/pkg/analysis_server/test/services/correction/assist_test.dart
index a2abeee..30ba490 100644
--- a/pkg/analysis_server/test/services/correction/assist_test.dart
+++ b/pkg/analysis_server/test/services/correction/assist_test.dart
@@ -7,9 +7,14 @@
 import 'dart:async';
 
 import 'package:analysis_server/plugin/edit/assist/assist_core.dart';
+import 'package:analysis_server/plugin/edit/assist/assist_dart.dart';
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:analysis_server/src/plugin/server_plugin.dart';
 import 'package:analysis_server/src/services/correction/assist.dart';
+import 'package:analysis_server/src/services/correction/assist_internal.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
+import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:plugin/manager.dart';
@@ -22,6 +27,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(AssistProcessorTest);
+    defineReflectiveTests(AssistProcessorTest_Driver);
   });
 }
 
@@ -64,8 +70,7 @@
    * Asserts that there is no [Assist] of the given [kind] at [offset].
    */
   assertNoAssist(AssistKind kind) async {
-    List<Assist> assists = await computeAssists(
-        plugin, context, testUnit.element.source, offset, length);
+    List<Assist> assists = await _computeAssists();
     for (Assist assist in assists) {
       if (assist.kind == kind) {
         throw fail('Unexpected assist $kind in\n${assists.join('\n')}');
@@ -127,7 +132,7 @@
 class _B extends A {}
 foo(f(_B p)) {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'my_lib.dart';
 main() {
   foo((test) {});
@@ -145,7 +150,7 @@
 class _B extends A {}
 List<_B> getValues() => [];
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'my_lib.dart';
 class A<T> {
   main() {
@@ -166,7 +171,7 @@
 class _B extends A {}
 List<_B> getValues() => [];
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'my_lib.dart';
 main() {
   var v = getValues();
@@ -184,7 +189,7 @@
 class _B extends A {}
 _B getValue() => new _B();
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'my_lib.dart';
 main() {
   var v = getValue();
@@ -194,7 +199,7 @@
   }
 
   test_addTypeAnnotation_classField_OK_final() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   final f = 0;
 }
@@ -210,7 +215,7 @@
   }
 
   test_addTypeAnnotation_classField_OK_int() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   var f = 0;
 }
@@ -226,7 +231,7 @@
   }
 
   test_addTypeAnnotation_declaredIdentifier_BAD_hasTypeAnnotation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (String item in items) {
   }
@@ -236,7 +241,7 @@
   }
 
   test_addTypeAnnotation_declaredIdentifier_BAD_inForEachBody() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (var item in items) {
     42;
@@ -248,7 +253,7 @@
 
   test_addTypeAnnotation_declaredIdentifier_BAD_unknownType() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   for (var item in unknownList) {
   }
@@ -258,7 +263,7 @@
   }
 
   test_addTypeAnnotation_declaredIdentifier_generic_OK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A<T> {
   main(List<List<T>> items) {
     for (var item in items) {
@@ -280,7 +285,7 @@
   }
 
   test_addTypeAnnotation_declaredIdentifier_OK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (var item in items) {
   }
@@ -315,7 +320,7 @@
 import 'dart:async';
 List<Future<int>> getFutures() => null;
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'my_lib.dart';
 main() {
   for (var future in getFutures()) {
@@ -336,7 +341,7 @@
   }
 
   test_addTypeAnnotation_declaredIdentifier_OK_final() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (final item in items) {
   }
@@ -353,8 +358,17 @@
 ''');
   }
 
+  test_addTypeAnnotation_local_BAD_bottom() async {
+    await resolveTestUnit('''
+main() {
+  var v = throw 42;
+}
+''');
+    await assertNoAssistAt('var ', DartAssistKind.ADD_TYPE_ANNOTATION);
+  }
+
   test_addTypeAnnotation_local_BAD_hasTypeAnnotation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int v = 42;
 }
@@ -363,7 +377,7 @@
   }
 
   test_addTypeAnnotation_local_BAD_multiple() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var a = 1, b = '';
 }
@@ -373,7 +387,7 @@
 
   test_addTypeAnnotation_local_BAD_noValue() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
 }
@@ -382,7 +396,7 @@
   }
 
   test_addTypeAnnotation_local_BAD_null() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = null;
 }
@@ -391,7 +405,7 @@
   }
 
   test_addTypeAnnotation_local_BAD_onInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var abc = 0;
 }
@@ -401,7 +415,7 @@
 
   test_addTypeAnnotation_local_BAD_unknown() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = unknownVar;
 }
@@ -410,7 +424,7 @@
   }
 
   test_addTypeAnnotation_local_generic_OK_literal() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main(List<int> items) {
     var v = items;
@@ -430,7 +444,7 @@
   }
 
   test_addTypeAnnotation_local_generic_OK_local() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A<T> {
   main(List<T> items) {
     var v = items;
@@ -456,7 +470,7 @@
 import 'dart:async';
 Future<int> getFutureInt() => null;
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'my_lib.dart';
 main() {
   var v = getFutureInt();
@@ -498,11 +512,14 @@
     Source appSource = addSource('/app.dart', appCode);
     testSource = addSource('/test.dart', testCode);
     // resolve
-    context.resolveCompilationUnit2(appSource, appSource);
-    testUnit = context.resolveCompilationUnit2(testSource, appSource);
-    assertNoErrorsInSource(testSource);
-    testUnitElement = testUnit.element;
-    testLibraryElement = testUnitElement.library;
+    if (enableNewAnalysisDriver) {
+      await resolveTestUnit(testCode);
+    } else {
+      context.resolveCompilationUnit2(appSource, appSource);
+      testUnit = context.resolveCompilationUnit2(testSource, appSource);
+      testUnitElement = testUnit.element;
+      testLibraryElement = testUnitElement.library;
+    }
     // prepare the assist
     offset = findOffset('v = ');
     assist = await _assertHasAssist(DartAssistKind.ADD_TYPE_ANNOTATION);
@@ -546,7 +563,7 @@
 import '../aa/bbb/lib_a.dart';
 MyClass newMyClass() => null;
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'ccc/lib_b.dart';
 main() {
   var v = newMyClass();
@@ -565,7 +582,7 @@
   }
 
   test_addTypeAnnotation_local_OK_Function() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = () => 1;
 }
@@ -581,7 +598,7 @@
   }
 
   test_addTypeAnnotation_local_OK_int() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = 0;
 }
@@ -597,7 +614,7 @@
   }
 
   test_addTypeAnnotation_local_OK_List() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = <String>[];
 }
@@ -613,7 +630,7 @@
   }
 
   test_addTypeAnnotation_local_OK_localType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class C {}
 C f() => null;
 main() {
@@ -633,7 +650,7 @@
   }
 
   test_addTypeAnnotation_local_OK_onName() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var abc = 0;
 }
@@ -649,7 +666,7 @@
   }
 
   test_addTypeAnnotation_local_OK_onVar() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = 0;
 }
@@ -665,7 +682,7 @@
   }
 
   test_addTypeAnnotation_OK_privateType_sameLibrary() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class _A {}
 _A getValue() => new _A();
 main() {
@@ -685,7 +702,7 @@
   }
 
   test_addTypeAnnotation_parameter_BAD_hasExplicitType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo(f(int p)) {}
 main() {
   foo((num test) {});
@@ -695,7 +712,7 @@
   }
 
   test_addTypeAnnotation_parameter_BAD_noPropagatedType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo(f(p)) {}
 main() {
   foo((test) {});
@@ -705,7 +722,7 @@
   }
 
   test_addTypeAnnotation_parameter_OK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo(f(int p)) {}
 main() {
   foo((test) {});
@@ -723,21 +740,21 @@
   }
 
   test_addTypeAnnotation_topLevelField_BAD_multiple() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 var A = 1, V = '';
 ''');
     await assertNoAssistAt('var ', DartAssistKind.ADD_TYPE_ANNOTATION);
   }
 
   test_addTypeAnnotation_topLevelField_BAD_noValue() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 var V;
 ''');
     await assertNoAssistAt('var ', DartAssistKind.ADD_TYPE_ANNOTATION);
   }
 
   test_addTypeAnnotation_topLevelField_OK_int() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 var V = 0;
 ''');
     await assertHasAssistAt(
@@ -749,7 +766,7 @@
   }
 
   test_assignToLocalVariable() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   List<int> bytes;
   readBytes();
@@ -774,7 +791,7 @@
   }
 
   test_assignToLocalVariable_alreadyAssignment() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var vvv;
   vvv = 42;
@@ -784,7 +801,7 @@
   }
 
   test_assignToLocalVariable_inClosure() async {
-    resolveTestUnit(r'''
+    await resolveTestUnit(r'''
 main() {
   print(() {
     12345;
@@ -804,17 +821,17 @@
   }
 
   test_assignToLocalVariable_invocationArgument() async {
-    resolveTestUnit(r'''
+    await resolveTestUnit(r'''
 main() {
   f(12345);
 }
-int f(p) {}
+void f(p) {}
 ''');
     await assertNoAssistAt('345', DartAssistKind.ASSIGN_TO_LOCAL_VARIABLE);
   }
 
   test_assignToLocalVariable_throw() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   throw 42;
 }
@@ -823,7 +840,7 @@
   }
 
   test_assignToLocalVariable_void() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   f();
 }
@@ -833,7 +850,7 @@
   }
 
   test_convertDocumentationIntoBlock_BAD_alreadyBlock() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 /**
  * AAAAAAA
  */
@@ -844,7 +861,7 @@
   }
 
   test_convertDocumentationIntoBlock_BAD_notDocumentation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 // AAAA
 class A {}
 ''');
@@ -853,7 +870,7 @@
   }
 
   test_convertDocumentationIntoBlock_OK_noSpaceBeforeText() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   /// AAAAA
   ///BBBBB
@@ -879,7 +896,7 @@
   }
 
   test_convertDocumentationIntoBlock_OK_onReference() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 /// AAAAAAA [int] AAAAAAA
 class A {}
 ''');
@@ -895,7 +912,7 @@
   }
 
   test_convertDocumentationIntoBlock_OK_onText() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   /// AAAAAAA [int] AAAAAAA
   /// BBBBBBBB BBBB BBBB
@@ -919,7 +936,7 @@
   }
 
   test_convertDocumentationIntoLine_BAD_alreadyLine() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 /// AAAAAAA
 class A {}
 ''');
@@ -928,7 +945,7 @@
   }
 
   test_convertDocumentationIntoLine_BAD_notDocumentation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 /* AAAA */
 class A {}
 ''');
@@ -937,7 +954,7 @@
   }
 
   test_convertDocumentationIntoLine_OK_onReference() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 /**
  * AAAAAAA [int] AAAAAAA
  */
@@ -953,7 +970,7 @@
   }
 
   test_convertDocumentationIntoLine_OK_onText() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   /**
    * AAAAAAA [int] AAAAAAA
@@ -977,7 +994,7 @@
   }
 
   test_convertDocumentationIntoLine_OK_onText_hasFirstLine() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   /** AAAAAAA [int] AAAAAAA
    * BBBBBBBB BBBB BBBB
@@ -1000,14 +1017,14 @@
   }
 
   test_convertToBlockBody_BAD_noEnclosingFunction() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 var v = 123;
 ''');
     await assertNoAssistAt('v =', DartAssistKind.CONVERT_INTO_BLOCK_BODY);
   }
 
   test_convertToBlockBody_BAD_notExpressionBlock() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() {
   return 123;
 }
@@ -1016,7 +1033,7 @@
   }
 
   test_convertToBlockBody_OK_async() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   mmm() async => 123;
 }
@@ -1034,7 +1051,7 @@
   }
 
   test_convertToBlockBody_OK_closure() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 setup(x) {}
 main() {
   setup(() => 42);
@@ -1060,7 +1077,7 @@
   }
 
   test_convertToBlockBody_OK_closure_voidExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 setup(x) {}
 main() {
   setup(() => print('done'));
@@ -1086,7 +1103,7 @@
   }
 
   test_convertToBlockBody_OK_constructor() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   factory A() => null;
 }
@@ -1104,7 +1121,7 @@
   }
 
   test_convertToBlockBody_OK_method() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   mmm() => 123;
 }
@@ -1122,7 +1139,7 @@
   }
 
   test_convertToBlockBody_OK_onName() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() => 123;
 ''');
     await assertHasAssistAt(
@@ -1136,7 +1153,7 @@
   }
 
   test_convertToBlockBody_OK_onValue() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() => 123;
 ''');
     await assertHasAssistAt(
@@ -1150,7 +1167,7 @@
   }
 
   test_convertToExpressionBody_BAD_already() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() => 42;
 ''');
     await assertNoAssistAt(
@@ -1158,7 +1175,7 @@
   }
 
   test_convertToExpressionBody_BAD_moreThanOneStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() {
   var v = 42;
   return v;
@@ -1169,14 +1186,14 @@
   }
 
   test_convertToExpressionBody_BAD_noEnclosingFunction() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 var V = 42;
 ''');
     await assertNoAssistAt('V = ', DartAssistKind.CONVERT_INTO_EXPRESSION_BODY);
   }
 
   test_convertToExpressionBody_BAD_noReturn() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() {
   var v = 42;
 }
@@ -1186,7 +1203,7 @@
   }
 
   test_convertToExpressionBody_BAD_noReturnValue() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() {
   return;
 }
@@ -1196,7 +1213,7 @@
   }
 
   test_convertToExpressionBody_OK_async() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   mmm() async {
     return 42;
@@ -1214,7 +1231,7 @@
   }
 
   test_convertToExpressionBody_OK_closure() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 setup(x) {}
 main() {
   setup(() {
@@ -1234,7 +1251,7 @@
   }
 
   test_convertToExpressionBody_OK_closure_voidExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 setup(x) {}
 main() {
   setup(() {
@@ -1254,7 +1271,7 @@
   }
 
   test_convertToExpressionBody_OK_constructor() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   factory A() {
     return null;
@@ -1272,7 +1289,7 @@
   }
 
   test_convertToExpressionBody_OK_function_onBlock() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() {
   return 42;
 }
@@ -1286,7 +1303,7 @@
   }
 
   test_convertToExpressionBody_OK_function_onName() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() {
   return 42;
 }
@@ -1300,7 +1317,7 @@
   }
 
   test_convertToExpressionBody_OK_method_onBlock() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   m() { // marker
     return 42;
@@ -1318,7 +1335,7 @@
   }
 
   test_convertToExpressionBody_OK_topFunction_onReturnStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 fff() {
   return 42;
 }
@@ -1332,7 +1349,7 @@
   }
 
   test_convertToFieldParameter_BAD_additionalUse() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int aaa2;
   int bbb2;
@@ -1343,7 +1360,7 @@
   }
 
   test_convertToFieldParameter_BAD_notPureAssignment() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int aaa2;
   A(int aaa) : aaa2 = aaa * 2;
@@ -1353,9 +1370,9 @@
   }
 
   test_convertToFieldParameter_OK_firstInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
-  double aaa2;
+  int aaa2;
   int bbb2;
   A(int aaa, int bbb) : aaa2 = aaa, bbb2 = bbb;
 }
@@ -1365,7 +1382,7 @@
         DartAssistKind.CONVERT_TO_FIELD_PARAMETER,
         '''
 class A {
-  double aaa2;
+  int aaa2;
   int bbb2;
   A(this.aaa2, int bbb) : bbb2 = bbb;
 }
@@ -1373,7 +1390,7 @@
   }
 
   test_convertToFieldParameter_OK_onParameterName_inInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int test2;
   A(int test) : test2 = test {
@@ -1393,7 +1410,7 @@
   }
 
   test_convertToFieldParameter_OK_onParameterName_inParameters() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int test;
   A(int test) : test = test {
@@ -1413,9 +1430,9 @@
   }
 
   test_convertToFieldParameter_OK_secondInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
-  double aaa2;
+  int aaa2;
   int bbb2;
   A(int aaa, int bbb) : aaa2 = aaa, bbb2 = bbb;
 }
@@ -1425,7 +1442,7 @@
         DartAssistKind.CONVERT_TO_FIELD_PARAMETER,
         '''
 class A {
-  double aaa2;
+  int aaa2;
   int bbb2;
   A(int aaa, this.bbb2) : aaa2 = aaa;
 }
@@ -1433,7 +1450,7 @@
   }
 
   test_convertToFinalField_BAD_hasSetter_inThisClass() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int get foo => null;
   void set foo(_) {}
@@ -1443,7 +1460,7 @@
   }
 
   test_convertToFinalField_BAD_notExpressionBody() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int get foo {
     int v = 1 + 2;
@@ -1455,7 +1472,7 @@
   }
 
   test_convertToFinalField_BAD_notGetter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int foo() => 42;
 }
@@ -1464,7 +1481,7 @@
   }
 
   test_convertToFinalField_OK_blockBody_onlyReturnStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int get foo {
     return 1 + 2;
@@ -1482,7 +1499,7 @@
   }
 
   test_convertToFinalField_OK_hasOverride() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 const myAnnotation = const Object();
 class A {
   @myAnnotation
@@ -1502,7 +1519,7 @@
   }
 
   test_convertToFinalField_OK_hasSetter_inSuper() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   void set foo(_) {}
 }
@@ -1524,7 +1541,7 @@
   }
 
   test_convertToFinalField_OK_notNull() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int get foo => 1 + 2;
 }
@@ -1540,7 +1557,7 @@
   }
 
   test_convertToFinalField_OK_null() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int get foo => null;
 }
@@ -1556,7 +1573,7 @@
   }
 
   test_convertToFinalField_OK_onName() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int get foo => 42;
 }
@@ -1572,7 +1589,7 @@
   }
 
   test_convertToFinalField_OK_onReturnType_parameterized() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   List<int> get foo => null;
 }
@@ -1588,7 +1605,7 @@
   }
 
   test_convertToFinalField_OK_onReturnType_simple() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int get foo => 42;
 }
@@ -1604,7 +1621,7 @@
   }
 
   test_convertToForIndex_BAD_bodyNotBlock() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (String item in items) print(item);
 }
@@ -1614,7 +1631,7 @@
   }
 
   test_convertToForIndex_BAD_doesNotDeclareVariable() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   String item;
   for (item in items) {
@@ -1626,7 +1643,7 @@
   }
 
   test_convertToForIndex_BAD_iterableIsNotVariable() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   for (String item in ['a', 'b', 'c']) {
     print(item);
@@ -1638,7 +1655,7 @@
   }
 
   test_convertToForIndex_BAD_iterableNotList() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(Iterable<String> items) {
   for (String item in items) {
     print(item);
@@ -1650,7 +1667,7 @@
   }
 
   test_convertToForIndex_BAD_usesIJK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (String item in items) {
     print(item);
@@ -1663,7 +1680,7 @@
   }
 
   test_convertToForIndex_OK_onDeclaredIdentifier_name() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (String item in items) {
     print(item);
@@ -1684,7 +1701,7 @@
   }
 
   test_convertToForIndex_OK_onDeclaredIdentifier_type() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (String item in items) {
     print(item);
@@ -1705,7 +1722,7 @@
   }
 
   test_convertToForIndex_OK_onFor() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (String item in items) {
     print(item);
@@ -1726,7 +1743,7 @@
   }
 
   test_convertToForIndex_OK_usesI() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (String item in items) {
     int i = 0;
@@ -1747,7 +1764,7 @@
   }
 
   test_convertToForIndex_OK_usesIJ() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List<String> items) {
   for (String item in items) {
     print(item);
@@ -1770,7 +1787,8 @@
   }
 
   test_convertToGetter_BAD_noInitializer() async {
-    resolveTestUnit('''
+    verifyNoTestUnitErrors = false;
+    await resolveTestUnit('''
 class A {
   final int foo;
 }
@@ -1779,7 +1797,7 @@
   }
 
   test_convertToGetter_BAD_notFinal() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int foo = 1;
 }
@@ -1788,7 +1806,7 @@
   }
 
   test_convertToGetter_BAD_notSingleField() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   final int foo = 1, bar = 2;
 }
@@ -1797,7 +1815,7 @@
   }
 
   test_convertToGetter_OK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 const myAnnotation = const Object();
 class A {
   @myAnnotation
@@ -1817,7 +1835,7 @@
   }
 
   test_convertToGetter_OK_noType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   final foo = 42;
 }
@@ -1833,7 +1851,7 @@
   }
 
   test_convertToIsNot_BAD_is_alreadyIsNot() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   p is! String;
 }
@@ -1842,7 +1860,7 @@
   }
 
   test_convertToIsNot_BAD_is_noEnclosingParenthesis() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   p is String;
 }
@@ -1851,7 +1869,7 @@
   }
 
   test_convertToIsNot_BAD_is_noPrefix() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   (p is String);
 }
@@ -1860,7 +1878,7 @@
   }
 
   test_convertToIsNot_BAD_is_notIsExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   123 + 456;
 }
@@ -1870,7 +1888,7 @@
 
   test_convertToIsNot_BAD_is_notTheNotOperator() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   ++(p is String);
 }
@@ -1879,7 +1897,7 @@
   }
 
   test_convertToIsNot_BAD_not_alreadyIsNot() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !(p is! String);
 }
@@ -1888,7 +1906,7 @@
   }
 
   test_convertToIsNot_BAD_not_noEnclosingParenthesis() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !p;
 }
@@ -1897,7 +1915,7 @@
   }
 
   test_convertToIsNot_BAD_not_notIsExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !(p == null);
 }
@@ -1907,7 +1925,7 @@
 
   test_convertToIsNot_BAD_not_notTheNotOperator() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   ++(p is String);
 }
@@ -1916,7 +1934,7 @@
   }
 
   test_convertToIsNot_OK_childOfIs_left() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !(p is String);
 }
@@ -1932,7 +1950,7 @@
   }
 
   test_convertToIsNot_OK_childOfIs_right() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !(p is String);
 }
@@ -1948,7 +1966,7 @@
   }
 
   test_convertToIsNot_OK_is() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !(p is String);
 }
@@ -1964,7 +1982,7 @@
   }
 
   test_convertToIsNot_OK_is_higherPrecedencePrefix() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !!(p is String);
 }
@@ -1980,7 +1998,7 @@
   }
 
   test_convertToIsNot_OK_is_not_higherPrecedencePrefix() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !!(p is String);
 }
@@ -1996,7 +2014,7 @@
   }
 
   test_convertToIsNot_OK_not() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !(p is String);
 }
@@ -2012,7 +2030,7 @@
   }
 
   test_convertToIsNot_OK_parentheses() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   !(p is String);
 }
@@ -2029,7 +2047,7 @@
 
   test_convertToIsNotEmpty_BAD_noBang() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(String str) {
   ~str.isEmpty;
 }
@@ -2039,7 +2057,7 @@
   }
 
   test_convertToIsNotEmpty_BAD_noIsNotEmpty() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   bool get isEmpty => false;
 }
@@ -2052,7 +2070,7 @@
   }
 
   test_convertToIsNotEmpty_BAD_notInPrefixExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(String str) {
   str.isEmpty;
 }
@@ -2062,7 +2080,7 @@
   }
 
   test_convertToIsNotEmpty_BAD_notIsEmpty() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(int p) {
   !p.isEven;
 }
@@ -2071,7 +2089,7 @@
   }
 
   test_convertToIsNotEmpty_OK_on_isEmpty() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(String str) {
   !str.isEmpty;
 }
@@ -2087,7 +2105,7 @@
   }
 
   test_convertToIsNotEmpty_OK_on_str() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(String str) {
   !str.isEmpty;
 }
@@ -2103,7 +2121,7 @@
   }
 
   test_convertToIsNotEmpty_OK_propertyAccess() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(String str) {
   !'text'.isEmpty;
 }
@@ -2119,7 +2137,7 @@
   }
 
   test_convertToNormalParameter_OK_dynamic() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   var test;
   A(this.test) {
@@ -2139,7 +2157,7 @@
   }
 
   test_convertToNormalParameter_OK_firstInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int test;
   A(this.test) {
@@ -2159,7 +2177,7 @@
   }
 
   test_convertToNormalParameter_OK_secondInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   double aaa;
   int bbb;
@@ -2179,7 +2197,7 @@
   }
 
   test_encapsulateField_BAD_alreadyPrivate() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int _test = 42;
 }
@@ -2191,7 +2209,7 @@
   }
 
   test_encapsulateField_BAD_final() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   final int test = 42;
 }
@@ -2200,7 +2218,7 @@
   }
 
   test_encapsulateField_BAD_multipleFields() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int aaa, bbb, ccc;
 }
@@ -2212,7 +2230,7 @@
   }
 
   test_encapsulateField_BAD_notOnName() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int test = 1 + 2 + 3;
 }
@@ -2222,7 +2240,7 @@
 
   test_encapsulateField_BAD_parseError() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int; // marker
 }
@@ -2234,7 +2252,7 @@
   }
 
   test_encapsulateField_BAD_static() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   static int test = 42;
 }
@@ -2243,7 +2261,7 @@
   }
 
   test_encapsulateField_OK_hasType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int test = 42;
   A(this.test);
@@ -2273,7 +2291,7 @@
   }
 
   test_encapsulateField_OK_noType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   var test = 42;
 }
@@ -2301,7 +2319,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_BAD_extraLength() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   111 + 222;
 }
@@ -2311,7 +2329,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_BAD_onOperand() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   111 + 222;
 }
@@ -2321,7 +2339,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_BAD_selectionWithBinary() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   1 + 2 + 3;
 }
@@ -2336,7 +2354,7 @@
     for (int i = 0; i <= 0; i++) {
       String initialOperator = initialOperators[i];
       String resultOperator = resultOperators[i];
-      resolveTestUnit('''
+      await resolveTestUnit('''
 bool main(int a, int b) {
   return a $initialOperator b;
 }
@@ -2353,7 +2371,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_OK_extended_mixOperator_1() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   1 * 2 * 3 + 4;
 }
@@ -2369,7 +2387,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_OK_extended_mixOperator_2() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   1 + 2 - 3 + 4;
 }
@@ -2385,7 +2403,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_OK_extended_sameOperator_afterFirst() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   1 + 2 + 3;
 }
@@ -2401,7 +2419,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_OK_extended_sameOperator_afterSecond() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   1 + 2 + 3;
 }
@@ -2417,7 +2435,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_OK_simple_afterOperator() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   1 + 2;
 }
@@ -2433,7 +2451,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_OK_simple_beforeOperator() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   1 + 2;
 }
@@ -2449,7 +2467,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_OK_simple_fullSelection() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   1 + 2;
 }
@@ -2466,7 +2484,7 @@
   }
 
   test_exchangeBinaryExpressionArguments_OK_simple_withLength() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   1 + 2;
 }
@@ -2483,7 +2501,7 @@
   }
 
   test_importAddShow_BAD_hasShow() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:math' show PI;
 main() {
   PI;
@@ -2493,21 +2511,22 @@
   }
 
   test_importAddShow_BAD_unresolvedUri() async {
-    resolveTestUnit('''
+    verifyNoTestUnitErrors = false;
+    await resolveTestUnit('''
 import '/no/such/lib.dart';
 ''');
     await assertNoAssistAt('import ', DartAssistKind.IMPORT_ADD_SHOW);
   }
 
   test_importAddShow_BAD_unused() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:math';
 ''');
     await assertNoAssistAt('import ', DartAssistKind.IMPORT_ADD_SHOW);
   }
 
   test_importAddShow_OK_hasUnresolvedIdentifier() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:math';
 main(x) {
   PI;
@@ -2527,7 +2546,7 @@
   }
 
   test_importAddShow_OK_onDirective() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:math';
 main() {
   PI;
@@ -2549,7 +2568,7 @@
   }
 
   test_importAddShow_OK_onUri() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:math';
 main() {
   PI;
@@ -2571,7 +2590,7 @@
   }
 
   test_introduceLocalTestedType_BAD_notBlock() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   if (p is String)
     print('not a block');
@@ -2581,7 +2600,7 @@
   }
 
   test_introduceLocalTestedType_BAD_notIsExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   if (p == null) {
   }
@@ -2591,7 +2610,7 @@
   }
 
   test_introduceLocalTestedType_BAD_notStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class C {
   bool b;
   C(v) : b = v is int;
@@ -2600,7 +2619,7 @@
   }
 
   test_introduceLocalTestedType_OK_if_is() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class MyTypeName {}
 main(p) {
   if (p is MyTypeName) {
@@ -2630,7 +2649,7 @@
   }
 
   test_introduceLocalTestedType_OK_if_isNot() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class MyTypeName {}
 main(p) {
   if (p is! MyTypeName) {
@@ -2660,7 +2679,7 @@
   }
 
   test_introduceLocalTestedType_OK_while() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   while (p is String) {
   }
@@ -2682,14 +2701,15 @@
   }
 
   test_invalidSelection() async {
-    resolveTestUnit('');
-    List<Assist> assists =
-        await computeAssists(plugin, context, testUnit.element.source, -1, 0);
+    await resolveTestUnit('');
+    offset = -1;
+    length = 0;
+    List<Assist> assists = await _computeAssists();
     expect(assists, isEmpty);
   }
 
   test_invertIfStatement_blocks() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (true) {
     0;
@@ -2713,7 +2733,7 @@
   }
 
   test_invertIfStatement_statements() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (true)
     0;
@@ -2735,7 +2755,7 @@
   }
 
   test_joinIfStatementInner_BAD_innerNotIf() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     print(0);
@@ -2746,7 +2766,7 @@
   }
 
   test_joinIfStatementInner_BAD_innerWithElse() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -2761,7 +2781,7 @@
   }
 
   test_joinIfStatementInner_BAD_statementAfterInner() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -2775,7 +2795,7 @@
   }
 
   test_joinIfStatementInner_BAD_statementBeforeInner() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     print(1);
@@ -2789,7 +2809,7 @@
   }
 
   test_joinIfStatementInner_BAD_targetNotIf() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   print(0);
 }
@@ -2798,7 +2818,7 @@
   }
 
   test_joinIfStatementInner_BAD_targetWithElse() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -2813,7 +2833,7 @@
   }
 
   test_joinIfStatementInner_OK_conditionAndOr() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2 || 3 == 3) {
@@ -2835,7 +2855,7 @@
   }
 
   test_joinIfStatementInner_OK_conditionInvocation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (isCheck()) {
     if (2 == 2) {
@@ -2859,7 +2879,7 @@
   }
 
   test_joinIfStatementInner_OK_conditionOrAnd() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1 || 2 == 2) {
     if (3 == 3) {
@@ -2881,7 +2901,7 @@
   }
 
   test_joinIfStatementInner_OK_onCondition() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -2903,7 +2923,7 @@
   }
 
   test_joinIfStatementInner_OK_simpleConditions_block_block() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -2925,7 +2945,7 @@
   }
 
   test_joinIfStatementInner_OK_simpleConditions_block_single() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2)
@@ -2946,7 +2966,7 @@
   }
 
   test_joinIfStatementInner_OK_simpleConditions_single_blockMulti() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -2972,7 +2992,7 @@
   }
 
   test_joinIfStatementInner_OK_simpleConditions_single_blockOne() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1)
     if (2 == 2) {
@@ -2993,7 +3013,7 @@
   }
 
   test_joinIfStatementOuter_BAD_outerNotIf() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     print(0);
@@ -3004,7 +3024,7 @@
   }
 
   test_joinIfStatementOuter_BAD_outerWithElse() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -3019,7 +3039,7 @@
   }
 
   test_joinIfStatementOuter_BAD_statementAfterInner() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -3033,7 +3053,7 @@
   }
 
   test_joinIfStatementOuter_BAD_statementBeforeInner() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     print(1);
@@ -3047,7 +3067,7 @@
   }
 
   test_joinIfStatementOuter_BAD_targetNotIf() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   print(0);
 }
@@ -3056,7 +3076,7 @@
   }
 
   test_joinIfStatementOuter_BAD_targetWithElse() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -3071,7 +3091,7 @@
   }
 
   test_joinIfStatementOuter_OK_conditionAndOr() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2 || 3 == 3) {
@@ -3093,7 +3113,7 @@
   }
 
   test_joinIfStatementOuter_OK_conditionInvocation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (isCheck()) {
@@ -3117,7 +3137,7 @@
   }
 
   test_joinIfStatementOuter_OK_conditionOrAnd() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1 || 2 == 2) {
     if (3 == 3) {
@@ -3139,7 +3159,7 @@
   }
 
   test_joinIfStatementOuter_OK_onCondition() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -3161,7 +3181,7 @@
   }
 
   test_joinIfStatementOuter_OK_simpleConditions_block_block() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -3183,7 +3203,7 @@
   }
 
   test_joinIfStatementOuter_OK_simpleConditions_block_single() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2)
@@ -3204,7 +3224,7 @@
   }
 
   test_joinIfStatementOuter_OK_simpleConditions_single_blockMulti() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1) {
     if (2 == 2) {
@@ -3230,7 +3250,7 @@
   }
 
   test_joinIfStatementOuter_OK_simpleConditions_single_blockOne() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1)
     if (2 == 2) {
@@ -3251,7 +3271,7 @@
   }
 
   test_joinVariableDeclaration_onAssignment_BAD_hasInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = 1;
   v = 2;
@@ -3261,7 +3281,7 @@
   }
 
   test_joinVariableDeclaration_onAssignment_BAD_notAdjacent() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   var bar;
@@ -3272,7 +3292,7 @@
   }
 
   test_joinVariableDeclaration_onAssignment_BAD_notAssignment() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   v += 1;
@@ -3282,7 +3302,7 @@
   }
 
   test_joinVariableDeclaration_onAssignment_BAD_notDeclaration() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(var v) {
   v = 1;
 }
@@ -3291,7 +3311,7 @@
   }
 
   test_joinVariableDeclaration_onAssignment_BAD_notLeftArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   1 + v; // marker
@@ -3302,7 +3322,7 @@
   }
 
   test_joinVariableDeclaration_onAssignment_BAD_notOneVariable() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v, v2;
   v = 1;
@@ -3313,7 +3333,7 @@
 
   test_joinVariableDeclaration_onAssignment_BAD_notResolved() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   x = 1;
@@ -3323,7 +3343,7 @@
   }
 
   test_joinVariableDeclaration_onAssignment_BAD_notSameBlock() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   {
@@ -3335,7 +3355,7 @@
   }
 
   test_joinVariableDeclaration_onAssignment_OK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   v = 1;
@@ -3352,7 +3372,7 @@
   }
 
   test_joinVariableDeclaration_onDeclaration_BAD_hasInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = 1;
   v = 2;
@@ -3362,7 +3382,7 @@
   }
 
   test_joinVariableDeclaration_onDeclaration_BAD_lastStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (true)
     var v;
@@ -3372,7 +3392,7 @@
   }
 
   test_joinVariableDeclaration_onDeclaration_BAD_nextNotAssignmentExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   42;
@@ -3382,7 +3402,7 @@
   }
 
   test_joinVariableDeclaration_onDeclaration_BAD_nextNotExpressionStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   if (true) return;
@@ -3392,7 +3412,7 @@
   }
 
   test_joinVariableDeclaration_onDeclaration_BAD_nextNotPureAssignment() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   v += 1;
@@ -3402,7 +3422,7 @@
   }
 
   test_joinVariableDeclaration_onDeclaration_BAD_notOneVariable() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v, v2;
   v = 1;
@@ -3412,7 +3432,7 @@
   }
 
   test_joinVariableDeclaration_onDeclaration_OK_onName() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   v = 1;
@@ -3429,7 +3449,7 @@
   }
 
   test_joinVariableDeclaration_onDeclaration_OK_onType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int v;
   v = 1;
@@ -3446,7 +3466,7 @@
   }
 
   test_joinVariableDeclaration_onDeclaration_OK_onVar() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   v = 1;
@@ -3463,7 +3483,7 @@
   }
 
   test_removeTypeAnnotation_classField_OK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int v = 1;
 }
@@ -3479,7 +3499,7 @@
   }
 
   test_removeTypeAnnotation_classField_OK_final() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   final int v = 1;
 }
@@ -3495,7 +3515,7 @@
   }
 
   test_removeTypeAnnotation_localVariable_BAD_onInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   final int v = 1;
 }
@@ -3504,7 +3524,7 @@
   }
 
   test_removeTypeAnnotation_localVariable_OK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int a = 1, b = 2;
 }
@@ -3520,7 +3540,7 @@
   }
 
   test_removeTypeAnnotation_localVariable_OK_const() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   const int v = 1;
 }
@@ -3536,7 +3556,7 @@
   }
 
   test_removeTypeAnnotation_localVariable_OK_final() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   final int v = 1;
 }
@@ -3553,14 +3573,14 @@
 
   test_removeTypeAnnotation_topLevelVariable_BAD_syntheticName() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 MyType
 ''');
     await assertNoAssistAt('MyType', DartAssistKind.REMOVE_TYPE_ANNOTATION);
   }
 
   test_removeTypeAnnotation_topLevelVariable_OK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 int V = 1;
 ''');
     await assertHasAssistAt(
@@ -3572,7 +3592,7 @@
   }
 
   test_removeTypeAnnotation_topLevelVariable_OK_final() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 final int V = 1;
 ''');
     await assertHasAssistAt(
@@ -3584,7 +3604,7 @@
   }
 
   test_replaceConditionalWithIfElse_BAD_noEnclosingStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 var v = true ? 111 : 222;
 ''');
     await assertNoAssistAt(
@@ -3592,7 +3612,7 @@
   }
 
   test_replaceConditionalWithIfElse_BAD_notConditional() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = 42;
 }
@@ -3602,7 +3622,7 @@
   }
 
   test_replaceConditionalWithIfElse_OK_assignment() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v;
   v = true ? 111 : 222;
@@ -3639,7 +3659,7 @@
   }
 
   test_replaceConditionalWithIfElse_OK_return() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   return true ? 111 : 222;
 }
@@ -3659,7 +3679,7 @@
   }
 
   test_replaceConditionalWithIfElse_OK_variableDeclaration() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int a = 1, vvv = true ? 111 : 222, b = 2;
 }
@@ -3680,7 +3700,7 @@
   }
 
   test_replaceIfElseWithConditional_BAD_expressionVsReturn() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (true) {
     print(42);
@@ -3694,7 +3714,7 @@
   }
 
   test_replaceIfElseWithConditional_BAD_notIfStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   print(0);
 }
@@ -3704,7 +3724,7 @@
   }
 
   test_replaceIfElseWithConditional_BAD_notSingleStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int vvv;
   if (true) {
@@ -3721,7 +3741,7 @@
   }
 
   test_replaceIfElseWithConditional_OK_assignment() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int vvv;
   if (true) {
@@ -3743,7 +3763,7 @@
   }
 
   test_replaceIfElseWithConditional_OK_return() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (true) {
     return 111;
@@ -3763,7 +3783,7 @@
   }
 
   test_splitAndCondition_BAD_hasElse() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1 && 2 == 2) {
     print(1);
@@ -3776,7 +3796,7 @@
   }
 
   test_splitAndCondition_BAD_notAnd() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1 || 2 == 2) {
     print(0);
@@ -3787,7 +3807,7 @@
   }
 
   test_splitAndCondition_BAD_notPartOfIf() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   print(1 == 1 && 2 == 2);
 }
@@ -3796,7 +3816,7 @@
   }
 
   test_splitAndCondition_BAD_notTopLevelAnd() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (true || (1 == 1 && 2 == 2)) {
     print(0);
@@ -3811,7 +3831,7 @@
   }
 
   test_splitAndCondition_OK_innerAndExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1 && 2 == 2 && 3 == 3) {
     print(0);
@@ -3833,7 +3853,7 @@
   }
 
   test_splitAndCondition_OK_thenBlock() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (true && false) {
     print(0);
@@ -3861,7 +3881,7 @@
   }
 
   test_splitAndCondition_OK_thenStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (true && false)
     print(0);
@@ -3880,7 +3900,7 @@
   }
 
   test_splitAndCondition_wrong() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (1 == 1 && 2 == 2) {
     print(0);
@@ -3898,7 +3918,7 @@
   }
 
   test_splitVariableDeclaration_BAD_notOneVariable() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = 1, v2;
 }
@@ -3907,7 +3927,7 @@
   }
 
   test_splitVariableDeclaration_OK_onName() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = 1;
 }
@@ -3924,7 +3944,7 @@
   }
 
   test_splitVariableDeclaration_OK_onType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int v = 1;
 }
@@ -3941,7 +3961,7 @@
   }
 
   test_splitVariableDeclaration_OK_onVar() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var v = 1;
 }
@@ -3958,7 +3978,7 @@
   }
 
   test_surroundWith_block() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
 // start
   print(0);
@@ -3982,7 +4002,7 @@
   }
 
   test_surroundWith_doWhile() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
 // start
   print(0);
@@ -4006,7 +4026,7 @@
   }
 
   test_surroundWith_for() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
 // start
   print(0);
@@ -4030,7 +4050,7 @@
   }
 
   test_surroundWith_forIn() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
 // start
   print(0);
@@ -4054,7 +4074,7 @@
   }
 
   test_surroundWith_if() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
 // start
   print(0);
@@ -4078,7 +4098,7 @@
   }
 
   test_surroundWith_tryCatch() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
 // start
   print(0);
@@ -4104,7 +4124,7 @@
   }
 
   test_surroundWith_tryFinally() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
 // start
   print(0);
@@ -4130,7 +4150,7 @@
   }
 
   test_surroundWith_while() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
 // start
   print(0);
@@ -4157,8 +4177,7 @@
    * Computes assists and verifies that there is an assist of the given kind.
    */
   Future<Assist> _assertHasAssist(AssistKind kind) async {
-    List<Assist> assists = await computeAssists(
-        plugin, context, testUnit.element.source, offset, length);
+    List<Assist> assists = await _computeAssists();
     for (Assist assist in assists) {
       if (assist.kind == kind) {
         return assist;
@@ -4176,6 +4195,19 @@
     }
   }
 
+  Future<List<Assist>> _computeAssists() async {
+    CompilationUnitElement testUnitElement =
+        resolutionMap.elementDeclaredByCompilationUnit(testUnit);
+    DartAssistContext assistContext = new _DartAssistContextForValues(
+        testUnitElement.source,
+        offset,
+        length,
+        testUnitElement.context,
+        testUnit);
+    AssistProcessor processor = new AssistProcessor(assistContext);
+    return await processor.compute();
+  }
+
   List<Position> _findResultPositions(List<String> searchStrings) {
     List<Position> positions = <Position>[];
     for (String search in searchStrings) {
@@ -4190,3 +4222,29 @@
     length = findOffset('// end') - offset;
   }
 }
+
+@reflectiveTest
+class AssistProcessorTest_Driver extends AssistProcessorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
+
+class _DartAssistContextForValues implements DartAssistContext {
+  @override
+  final Source source;
+
+  @override
+  final int selectionOffset;
+
+  @override
+  final int selectionLength;
+
+  @override
+  final AnalysisContext analysisContext;
+
+  @override
+  final CompilationUnit unit;
+
+  _DartAssistContextForValues(this.source, this.selectionOffset,
+      this.selectionLength, this.analysisContext, this.unit);
+}
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index dc65a97..2f0e0bc 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -12,22 +12,26 @@
     hide AnalysisError;
 import 'package:analysis_server/src/services/correction/fix.dart';
 import 'package:analysis_server/src/services/correction/fix_internal.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/source/package_map_resolver.dart';
 import 'package:analyzer/src/error/codes.dart';
+import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/parser.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
-import '../../abstract_context.dart';
 import '../../abstract_single_unit.dart';
 
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(FixProcessorTest);
     defineReflectiveTests(LintFixTest);
+    defineReflectiveTests(FixProcessorTest_Driver);
+    defineReflectiveTests(LintFixTest_Driver);
   });
 }
 
@@ -45,12 +49,14 @@
         error.errorCode != HintCode.UNUSED_LOCAL_VARIABLE;
   };
 
+  String myPkgLibPath = '/packages/my_pkg/lib';
+
   Fix fix;
   SourceChange change;
   String resultCode;
 
   assert_undefinedFunction_create_returnType_bool(String lineWithTest) async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   bool b = true;
   $lineWithTest
@@ -70,7 +76,7 @@
   }
 
   assertHasFix(FixKind kind, String expected) async {
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     fix = await _assertHasFix(kind, error);
     change = fix.change;
     // apply to "file"
@@ -82,7 +88,7 @@
   }
 
   assertNoFix(FixKind kind) async {
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     List<Fix> fixes = await _computeFixes(error);
     for (Fix fix in fixes) {
       if (fix.kind == kind) {
@@ -138,14 +144,31 @@
     }
   }
 
+  Future<List<AnalysisError>> _computeErrors() async {
+    if (enableNewAnalysisDriver) {
+      return (await driver.getResult(testFile)).errors;
+    } else {
+      return context.computeErrors(testSource);
+    }
+  }
+
   /**
    * Computes fixes for the given [error] in [testUnit].
    */
   Future<List<Fix>> _computeFixes(AnalysisError error) async {
-    DartFixContext dartContext = new DartFixContextImpl(
-        new FixContextImpl(provider, context, error), testUnit);
-    FixProcessor processor = new FixProcessor(dartContext);
-    return processor.compute();
+    if (enableNewAnalysisDriver) {
+      DartFixContext fixContext = new _DartFixContextImpl(
+          provider,
+          driver.getTopLevelNameDeclarations,
+          resolutionMap.elementDeclaredByCompilationUnit(testUnit).context,
+          testUnit,
+          error);
+      return await new DefaultFixContributor().internalComputeFixes(fixContext);
+    } else {
+      FixContextImpl fixContext = new FixContextImpl(provider, context, error);
+      DefaultFixContributor contributor = new DefaultFixContributor();
+      return contributor.computeFixes(fixContext);
+    }
   }
 
   /**
@@ -154,15 +177,20 @@
    */
   void _configureMyPkg(Map<String, String> pathToCode) {
     pathToCode.forEach((path, code) {
-      provider.newFile('/packages/my_pkg/lib/$path', code);
+      provider.newFile('$myPkgLibPath/$path', code);
     });
     // configure SourceFactory
-    Folder myPkgFolder = provider.getResource('/packages/my_pkg/lib');
+    Folder myPkgFolder = provider.getResource(myPkgLibPath);
     UriResolver pkgResolver = new PackageMapUriResolver(provider, {
       'my_pkg': [myPkgFolder]
     });
-    context.sourceFactory = new SourceFactory(
-        [AbstractContextTest.SDK_RESOLVER, pkgResolver, resourceResolver]);
+    SourceFactory sourceFactory = new SourceFactory(
+        [new DartUriResolver(sdk), pkgResolver, resourceResolver]);
+    if (enableNewAnalysisDriver) {
+      driver.configure(sourceFactory: sourceFactory);
+    } else {
+      context.sourceFactory = sourceFactory;
+    }
     // force 'my_pkg' resolution
     addSource(
         '/tmp/other.dart',
@@ -171,8 +199,8 @@
             .join('\n'));
   }
 
-  AnalysisError _findErrorToFix() {
-    List<AnalysisError> errors = context.computeErrors(testSource);
+  Future<AnalysisError> _findErrorToFix() async {
+    List<AnalysisError> errors = await _computeErrors();
     if (errorFilter != null) {
       errors = errors.where(errorFilter).toList();
     }
@@ -188,16 +216,12 @@
     }
     return positions;
   }
-
-  void _performAnalysis() {
-    while (context.performAnalysisTask().hasMoreWork);
-  }
 }
 
 @reflectiveTest
 class FixProcessorTest extends BaseFixProcessorTest {
   test_addFieldFormalParameters_hasRequiredParameter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class Test {
   final int a;
   final int b;
@@ -218,7 +242,7 @@
   }
 
   test_addFieldFormalParameters_noParameters() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class Test {
   final int a;
   final int b;
@@ -239,7 +263,7 @@
   }
 
   test_addFieldFormalParameters_noRequiredParameter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class Test {
   final int a;
   final int b;
@@ -260,7 +284,7 @@
   }
 
   test_addMissingParameter_function_positional_hasNamed() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 test({int a}) {}
 main() {
   test(1);
@@ -270,7 +294,7 @@
   }
 
   test_addMissingParameter_function_positional_hasZero() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 test() {}
 main() {
   test(1);
@@ -287,7 +311,7 @@
   }
 
   test_addMissingParameter_function_required_hasNamed() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 test({int a}) {}
 main() {
   test(1);
@@ -304,7 +328,7 @@
   }
 
   test_addMissingParameter_function_required_hasOne() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 test(int a) {}
 main() {
   test(1, 2.0);
@@ -321,7 +345,7 @@
   }
 
   test_addMissingParameter_function_required_hasZero() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 test() {}
 main() {
   test(1);
@@ -338,7 +362,7 @@
   }
 
   test_addMissingParameter_method_positional_hasOne() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   test(int a) {}
   main() {
@@ -359,7 +383,7 @@
   }
 
   test_addMissingParameter_method_required_hasOne() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   test(int a) {}
   main() {
@@ -380,7 +404,7 @@
   }
 
   test_addMissingParameter_method_required_hasZero() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   test() {}
   main() {
@@ -400,41 +424,8 @@
 ''');
   }
 
-  test_addPartOfDirective() async {
-    String partCode = r'''
-// Comment first.
-// Comment second.
-
-class A {}
-''';
-    addSource('/part.dart', partCode);
-    resolveTestUnit('''
-library my.lib;
-part 'part.dart';
-''');
-    _performAnalysis();
-    AnalysisError error = _findErrorToFix();
-    fix = await _assertHasFix(DartFixKind.ADD_PART_OF, error);
-    change = fix.change;
-    // apply to "file"
-    List<SourceFileEdit> fileEdits = change.edits;
-    expect(fileEdits, hasLength(1));
-    SourceFileEdit fileEdit = change.edits[0];
-    expect(fileEdit.file, '/part.dart');
-    expect(
-        SourceEdit.applySequence(partCode, fileEdit.edits),
-        r'''
-// Comment first.
-// Comment second.
-
-part of my.lib;
-
-class A {}
-''');
-  }
-
   test_addSync_asyncFor() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async';
 void main(Stream<String> names) {
   await for (String name in names) {
@@ -455,20 +446,20 @@
   }
 
   test_addSync_BAD_nullFunctionBody() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 var F = await;
 ''');
     await assertNoFix(DartFixKind.ADD_ASYNC);
   }
 
   test_addSync_blockFunctionBody() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo() {}
 main() {
   await foo();
 }
 ''');
-    List<AnalysisError> errors = context.computeErrors(testSource);
+    List<AnalysisError> errors = await _computeErrors();
     expect(errors, hasLength(2));
     errors.sort((a, b) => a.message.compareTo(b.message));
     // No fix for ";".
@@ -507,7 +498,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo() {}
 main() => await foo();
 ''');
@@ -523,7 +514,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo() {}
 int main() {
   await foo();
@@ -547,7 +538,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async';
 foo() {}
 Future<int> main() {
@@ -571,7 +562,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo() {}
 dynamic main() {
   await foo();
@@ -593,7 +584,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo() {}
 main() {
   await foo();
@@ -612,7 +603,7 @@
   }
 
   test_boolean() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   boolean v;
 }
@@ -627,7 +618,7 @@
   }
 
   test_canBeNullAfterNullAware_chain() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(x) {
   x?.a.b.c;
 }
@@ -642,7 +633,7 @@
   }
 
   test_canBeNullAfterNullAware_methodInvocation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(x) {
   x?.a.b();
 }
@@ -657,7 +648,7 @@
   }
 
   test_canBeNullAfterNullAware_propertyAccess() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(x) {
   x?.a().b;
 }
@@ -672,7 +663,7 @@
   }
 
   test_changeToStaticAccess_method() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   static foo() {}
 }
@@ -708,7 +699,7 @@
 import 'libA.dart';
 class B extends A {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'libB.dart';
 main(B b) {
   b.foo();
@@ -726,7 +717,7 @@
   }
 
   test_changeToStaticAccess_method_prefixLibrary() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async' as pref;
 main(pref.Future f) {
   f.wait([]);
@@ -743,7 +734,7 @@
   }
 
   test_changeToStaticAccess_property() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   static get foo => 42;
 }
@@ -779,7 +770,7 @@
 import 'libA.dart';
 class B extends A {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'libB.dart';
 main(B b) {
   b.foo;
@@ -797,7 +788,7 @@
   }
 
   test_changeTypeAnnotation_BAD_multipleVariables() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   String a, b = 42;
 }
@@ -806,7 +797,7 @@
   }
 
   test_changeTypeAnnotation_BAD_notVariableDeclaration() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   String v;
   v = 42;
@@ -816,7 +807,7 @@
   }
 
   test_changeTypeAnnotation_OK_generic() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   String v = <int>[];
 }
@@ -831,7 +822,7 @@
   }
 
   test_changeTypeAnnotation_OK_simple() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   String v = 'abc'.length;
 }
@@ -846,7 +837,7 @@
   }
 
   test_createClass() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   Test v = null;
 }
@@ -865,7 +856,7 @@
   }
 
   test_createClass_BAD_hasUnresolvedPrefix() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   prefix.Test v = null;
 }
@@ -880,7 +871,7 @@
 class A {}
 ''';
     addSource('/lib.dart', libCode);
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'lib.dart' as lib;
 
 main() {
@@ -888,7 +879,7 @@
   lib.Test t = null;
 }
 ''');
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     fix = await _assertHasFix(DartFixKind.CREATE_CLASS, error);
     change = fix.change;
     // apply to "lib.dart"
@@ -910,7 +901,7 @@
   }
 
   test_createClass_innerLocalFunction() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 f() {
   g() {
     Test v = null;
@@ -933,7 +924,7 @@
   }
 
   test_createClass_itemOfList() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var a = [Test];
 }
@@ -955,7 +946,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class MyAnnotation {
   const MyAnnotation(a, b);
 }
@@ -981,7 +972,7 @@
     errorFilter = (AnalysisError error) {
       return error.message.contains("'a'");
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class Test {
   final int a;
   final int b = 2;
@@ -1002,7 +993,7 @@
   }
 
   test_createConstructor_insteadOfSyntheticDefault() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int field;
 
@@ -1029,7 +1020,7 @@
   }
 
   test_createConstructor_named() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   method() {}
 }
@@ -1053,7 +1044,7 @@
   }
 
   test_createConstructor_named_emptyClassBody() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {}
 main() {
   new A.named(1);
@@ -1073,7 +1064,7 @@
   }
 
   test_createConstructorForFinalFields_inTopLevelMethod() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   final int v;
 }
@@ -1082,14 +1073,14 @@
   }
 
   test_createConstructorForFinalFields_topLevelField() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 final int v;
 ''');
     await assertNoFix(DartFixKind.CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS);
   }
 
   test_createConstructorSuperExplicit() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   A(bool p1, int p2, double p3, String p4, {p5});
 }
@@ -1110,7 +1101,7 @@
   }
 
   test_createConstructorSuperExplicit_hasInitializers() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   A(int p);
 }
@@ -1133,7 +1124,7 @@
   }
 
   test_createConstructorSuperExplicit_named() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   A.named(int p);
 }
@@ -1154,7 +1145,7 @@
   }
 
   test_createConstructorSuperExplicit_named_private() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   A._named(int p);
 }
@@ -1166,7 +1157,7 @@
   }
 
   test_createConstructorSuperExplicit_typeArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A<T> {
   A(T p);
 }
@@ -1187,7 +1178,7 @@
   }
 
   test_createConstructorSuperImplicit() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   A(p1, int p2, List<String> p3, [int p4]);
 }
@@ -1214,7 +1205,7 @@
   }
 
   test_createConstructorSuperImplicit_fieldInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int _field;
   A(this._field);
@@ -1258,7 +1249,7 @@
   B(A a);
 }
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'libB.dart';
 class C extends B {
 }
@@ -1275,7 +1266,7 @@
   }
 
   test_createConstructorSuperImplicit_named() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   A.named(p1, int p2);
 }
@@ -1302,7 +1293,7 @@
   }
 
   test_createConstructorSuperImplicit_private() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   A._named(p);
 }
@@ -1313,7 +1304,7 @@
   }
 
   test_createConstructorSuperImplicit_typeArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class C<T> {
   final T x;
   C(this.x);
@@ -1333,7 +1324,7 @@
   }
 
   test_createField_BAD_inEnum() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 enum MyEnum {
   AAA, BBB
 }
@@ -1345,7 +1336,7 @@
   }
 
   test_createField_BAD_inSDK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List p) {
   p.foo = 1;
 }
@@ -1354,7 +1345,7 @@
   }
 
   test_createField_getter_multiLevel() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 class B {
@@ -1386,7 +1377,7 @@
   }
 
   test_createField_getter_qualified_instance() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main(A a) {
@@ -1406,7 +1397,7 @@
   }
 
   test_createField_getter_qualified_instance_dynamicType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   B b;
   void f(Object p) {
@@ -1432,7 +1423,7 @@
   }
 
   test_createField_getter_qualified_propagatedType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   A get self => this;
 }
@@ -1457,7 +1448,7 @@
   }
 
   test_createField_getter_unqualified_instance_asInvocationArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     f(test);
@@ -1480,7 +1471,7 @@
   }
 
   test_createField_getter_unqualified_instance_assignmentRhs() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     int v = test;
@@ -1501,7 +1492,7 @@
   }
 
   test_createField_getter_unqualified_instance_asStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     test;
@@ -1522,7 +1513,7 @@
   }
 
   test_createField_hint() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main(A a) {
@@ -1544,7 +1535,7 @@
   }
 
   test_createField_hint_setter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main(A a) {
@@ -1579,7 +1570,7 @@
 import 'libA.dart';
 A getA() => null;
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'libB.dart';
 class C {
 }
@@ -1602,7 +1593,7 @@
   }
 
   test_createField_setter_generic_BAD() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 class B<T> {
@@ -1628,7 +1619,7 @@
   }
 
   test_createField_setter_generic_OK_local() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A<T> {
   List<T> items;
 
@@ -1653,7 +1644,7 @@
   }
 
   test_createField_setter_qualified_instance_hasField() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int aaa;
   int zzz;
@@ -1682,7 +1673,7 @@
   }
 
   test_createField_setter_qualified_instance_hasMethod() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   existingMethod() {}
 }
@@ -1705,7 +1696,7 @@
   }
 
   test_createField_setter_qualified_static() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main() {
@@ -1725,7 +1716,7 @@
   }
 
   test_createField_setter_unqualified_instance() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     test = 5;
@@ -1746,7 +1737,7 @@
   }
 
   test_createField_setter_unqualified_static() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   static main() {
     test = 5;
@@ -1768,10 +1759,10 @@
 
   test_createFile_forImport() async {
     testFile = '/my/project/bin/test.dart';
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'my_file.dart';
 ''');
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     fix = await _assertHasFix(DartFixKind.CREATE_FILE, error);
     change = fix.change;
     // validate change
@@ -1787,7 +1778,7 @@
   test_createFile_forImport_BAD_inPackage_lib_justLib() async {
     provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package');
     testFile = '/projects/my_package/test.dart';
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'lib';
 ''');
     await assertNoFix(DartFixKind.CREATE_FILE);
@@ -1795,7 +1786,7 @@
 
   test_createFile_forImport_BAD_notDart() async {
     testFile = '/my/project/bin/test.dart';
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'my_file.txt';
 ''');
     await assertNoFix(DartFixKind.CREATE_FILE);
@@ -1805,10 +1796,10 @@
     provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package');
     testFile = '/projects/my_package/lib/test.dart';
     provider.newFolder('/projects/my_package/lib');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'a/bb/c_cc/my_lib.dart';
 ''');
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     fix = await _assertHasFix(DartFixKind.CREATE_FILE, error);
     change = fix.change;
     // validate change
@@ -1825,10 +1816,10 @@
   test_createFile_forImport_inPackage_test() async {
     provider.newFile('/projects/my_package/pubspec.yaml', 'name: my_package');
     testFile = '/projects/my_package/test/misc/test_all.dart';
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'a/bb/my_lib.dart';
 ''');
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     fix = await _assertHasFix(DartFixKind.CREATE_FILE, error);
     change = fix.change;
     // validate change
@@ -1844,11 +1835,11 @@
 
   test_createFile_forPart() async {
     testFile = '/my/project/bin/test.dart';
-    resolveTestUnit('''
+    await resolveTestUnit('''
 library my.lib;
 part 'my_part.dart';
 ''');
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     fix = await _assertHasFix(DartFixKind.CREATE_FILE, error);
     change = fix.change;
     // validate change
@@ -1878,11 +1869,17 @@
     UriResolver pkgResolver = new PackageMapUriResolver(provider, {
       'my': <Folder>[provider.getResource('/my/lib')],
     });
-    context.sourceFactory = new SourceFactory(
-        [AbstractContextTest.SDK_RESOLVER, pkgResolver, resourceResolver]);
+    SourceFactory sourceFactory = new SourceFactory(
+        [new DartUriResolver(sdk), pkgResolver, resourceResolver]);
+    if (enableNewAnalysisDriver) {
+      driver.configure(sourceFactory: sourceFactory);
+      testUnit = (await driver.getResult(testFile)).unit;
+    } else {
+      context.sourceFactory = sourceFactory;
+      testUnit = await resolveLibraryUnit(testSource);
+    }
     // prepare fix
-    testUnit = resolveLibraryUnit(testSource);
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     fix = await _assertHasFix(DartFixKind.CREATE_FILE, error);
     change = fix.change;
     // validate change
@@ -1896,7 +1893,7 @@
   }
 
   test_createGetter_BAD_inSDK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(List p) {
   int v = p.foo;
 }
@@ -1905,7 +1902,7 @@
   }
 
   test_createGetter_hint_getter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main(A a) {
@@ -1927,7 +1924,7 @@
   }
 
   test_createGetter_location_afterLastGetter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int existingField;
 
@@ -1958,7 +1955,7 @@
   }
 
   test_createGetter_multiLevel() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 class B {
@@ -1990,7 +1987,7 @@
   }
 
   test_createGetter_qualified_instance() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main(A a) {
@@ -2010,7 +2007,7 @@
   }
 
   test_createGetter_qualified_instance_dynamicType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   B b;
   void f(Object p) {
@@ -2036,7 +2033,7 @@
   }
 
   test_createGetter_qualified_propagatedType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   A get self => this;
 }
@@ -2061,7 +2058,7 @@
   }
 
   test_createGetter_setterContext() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main(A a) {
@@ -2072,7 +2069,7 @@
   }
 
   test_createGetter_unqualified_instance_asInvocationArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     f(test);
@@ -2095,7 +2092,7 @@
   }
 
   test_createGetter_unqualified_instance_assignmentLhs() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     test = 42;
@@ -2106,7 +2103,7 @@
   }
 
   test_createGetter_unqualified_instance_assignmentRhs() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     int v = test;
@@ -2127,7 +2124,7 @@
   }
 
   test_createGetter_unqualified_instance_asStatement() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     test;
@@ -2148,7 +2145,7 @@
   }
 
   test_createLocalVariable_functionType_named() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 typedef MY_FUNCTION(int p);
 foo(MY_FUNCTION f) {}
 main() {
@@ -2168,7 +2165,7 @@
   }
 
   test_createLocalVariable_functionType_synthetic() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo(f(int p)) {}
 main() {
   foo(bar);
@@ -2178,7 +2175,7 @@
   }
 
   test_createLocalVariable_read_typeAssignment() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int a = test;
 }
@@ -2194,7 +2191,7 @@
   }
 
   test_createLocalVariable_read_typeCondition() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   if (!test) {
     print(42);
@@ -2214,7 +2211,7 @@
   }
 
   test_createLocalVariable_read_typeInvocationArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   f(test);
 }
@@ -2234,7 +2231,7 @@
   }
 
   test_createLocalVariable_read_typeInvocationTarget() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   test.add('hello');
 }
@@ -2251,7 +2248,7 @@
   }
 
   test_createLocalVariable_write_assignment() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   test = 42;
 }
@@ -2266,7 +2263,7 @@
   }
 
   test_createLocalVariable_write_assignment_compound() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   test += 42;
 }
@@ -2282,7 +2279,7 @@
   }
 
   test_createMissingMethodCall() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class C implements Function {
 }
 ''');
@@ -2298,7 +2295,7 @@
   }
 
   test_createMissingOverrides_field_untyped() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   var f;
 }
@@ -2321,7 +2318,7 @@
   }
 
   test_createMissingOverrides_functionTypeAlias() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 typedef int Binary(int left, int right);
 
 abstract class Emulator {
@@ -2350,7 +2347,7 @@
   }
 
   test_createMissingOverrides_functionTypedParameter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 abstract class A {
   forEach(int f(double p1, String p2));
 }
@@ -2375,7 +2372,7 @@
   }
 
   test_createMissingOverrides_generics_typeArguments() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class Iterator<T> {
 }
 
@@ -2405,7 +2402,7 @@
   }
 
   test_createMissingOverrides_generics_typeParameters() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 abstract class ItemProvider<T> {
   List<T> getItems();
 }
@@ -2430,7 +2427,7 @@
   }
 
   test_createMissingOverrides_getter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 abstract class A {
   get g1;
   int get g2;
@@ -2460,7 +2457,7 @@
   }
 
   test_createMissingOverrides_importPrefix() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async' as aaa;
 abstract class A {
   Map<aaa.Future, List<aaa.Future>> g(aaa.Future p);
@@ -2487,7 +2484,7 @@
   }
 
   test_createMissingOverrides_mergeToField_getterSetter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int ma;
   void mb() {}
@@ -2522,7 +2519,7 @@
   }
 
   test_createMissingOverrides_method() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 abstract class A {
   m1();
   int m2();
@@ -2595,7 +2592,7 @@
   }
 
   test_createMissingOverrides_method_emptyClassBody() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 abstract class A {
   void foo();
 }
@@ -2618,8 +2615,39 @@
 ''');
   }
 
+  test_createMissingOverrides_method_generic() async {
+    await resolveTestUnit('''
+class C<T> {}
+class V<E> {}
+
+abstract class A {
+  E1 foo<E1, E2 extends C<int>>(V<E2> v);
+}
+
+class B implements A {
+}
+''');
+    await assertHasFix(
+        DartFixKind.CREATE_MISSING_OVERRIDES,
+        '''
+class C<T> {}
+class V<E> {}
+
+abstract class A {
+  E1 foo<E1, E2 extends C<int>>(V<E2> v);
+}
+
+class B implements A {
+  @override
+  E1 foo<E1, E2 extends C<int>>(V<E2> v) {
+    // TODO: implement foo
+  }
+}
+''');
+  }
+
   test_createMissingOverrides_operator() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 abstract class A {
   int operator [](int index);
   void operator []=(int index, String value);
@@ -2651,7 +2679,7 @@
   }
 
   test_createMissingOverrides_setter() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 abstract class A {
   set s1(x);
   set s2(int x);
@@ -2690,7 +2718,7 @@
   }
 
   test_createNoSuchMethod() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 abstract class A {
   m1();
   int m2();
@@ -2717,7 +2745,7 @@
   }
 
   test_creationFunction_forFunctionType_cascadeSecond() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   B ma() => null;
 }
@@ -2751,7 +2779,7 @@
   }
 
   test_creationFunction_forFunctionType_coreFunction() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   useFunction(g: test);
 }
@@ -2771,7 +2799,7 @@
   }
 
   test_creationFunction_forFunctionType_dynamicArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   useFunction(test);
 }
@@ -2791,7 +2819,7 @@
   }
 
   test_creationFunction_forFunctionType_function() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   useFunction(test);
 }
@@ -2811,7 +2839,7 @@
   }
 
   test_creationFunction_forFunctionType_function_namedArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   useFunction(g: test);
 }
@@ -2844,7 +2872,7 @@
 import 'libA.dart';
 useFunction(int g(A a)) {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'libB.dart';
 main() {
   useFunction(test);
@@ -2865,7 +2893,7 @@
   }
 
   test_creationFunction_forFunctionType_method_enclosingClass_static() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   static foo() {
     useFunction(test);
@@ -2889,7 +2917,7 @@
   }
 
   test_creationFunction_forFunctionType_method_enclosingClass_static2() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   var f;
   A() : f = useFunction(test);
@@ -2911,7 +2939,7 @@
   }
 
   test_creationFunction_forFunctionType_method_targetClass() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(A a) {
   useFunction(a.test);
 }
@@ -2934,7 +2962,7 @@
   }
 
   test_creationFunction_forFunctionType_method_targetClass_hasOtherMember() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(A a) {
   useFunction(a.test);
 }
@@ -2960,7 +2988,7 @@
   }
 
   test_creationFunction_forFunctionType_notFunctionType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(A a) {
   useFunction(a.test);
 }
@@ -2972,7 +3000,7 @@
   }
 
   test_creationFunction_forFunctionType_unknownTarget() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(A a) {
   useFunction(a.test);
 }
@@ -2984,7 +3012,7 @@
   }
 
   test_expectedToken_semicolon() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   print(0)
 }
@@ -3002,7 +3030,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async';
 var v;int main() async => 0;
 ''');
@@ -3018,7 +3046,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 library main;
 int main() async {
 }
@@ -3038,7 +3066,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async' as al;
 int main() async {
 }
@@ -3056,7 +3084,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async';
 List<int> main() async {
 }
@@ -3074,7 +3102,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async';
 void main() async {
 }
@@ -3090,7 +3118,36 @@
 
   test_importLibraryPackage_preferDirectOverExport() async {
     _configureMyPkg({'b.dart': 'class Test {}', 'a.dart': "export 'b.dart';"});
-    resolveTestUnit('''
+    await resolveTestUnit('''
+main() {
+  Test test = null;
+}
+''');
+    performAllAnalysisTasks();
+    await assertHasFix(
+        DartFixKind.IMPORT_LIBRARY_PROJECT1,
+        '''
+import 'package:my_pkg/b.dart';
+
+main() {
+  Test test = null;
+}
+''');
+    await assertHasFix(
+        DartFixKind.IMPORT_LIBRARY_PROJECT2,
+        '''
+import 'package:my_pkg/a.dart';
+
+main() {
+  Test test = null;
+}
+''');
+  }
+
+  test_importLibraryPackage_preferDirectOverExport_src() async {
+    myPkgLibPath = '/my/src/packages/my_pkg/lib';
+    _configureMyPkg({'b.dart': 'class Test {}', 'a.dart': "export 'b.dart';"});
+    await resolveTestUnit('''
 main() {
   Test test = null;
 }
@@ -3119,7 +3176,7 @@
   test_importLibraryPackage_preferPublicOverPrivate() async {
     _configureMyPkg(
         {'src/a.dart': 'class Test {}', 'b.dart': "export 'src/a.dart';"});
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   Test test = null;
 }
@@ -3154,7 +3211,7 @@
   const Test(int p);
 }
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 @Test(0)
 main() {
 }
@@ -3171,6 +3228,31 @@
 ''');
   }
 
+  test_importLibraryProject_withClass_constInstanceCreation() async {
+    addSource(
+        '/lib.dart',
+        '''
+class Test {
+  const Test();
+}
+''');
+    await resolveTestUnit('''
+main() {
+  const Test();
+}
+''');
+    performAllAnalysisTasks();
+    await assertHasFix(
+        DartFixKind.IMPORT_LIBRARY_PROJECT1,
+        '''
+import 'lib.dart';
+
+main() {
+  const Test();
+}
+''');
+  }
+
   test_importLibraryProject_withClass_hasOtherLibraryWithPrefix() async {
     testFile = '/project/bin/test.dart';
     addSource(
@@ -3186,7 +3268,7 @@
 class One {}
 class Two {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'b.dart' show Two;
 main () {
   new Two();
@@ -3214,7 +3296,7 @@
 library lib;
 class Test {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   Test t = null;
 }
@@ -3239,7 +3321,7 @@
 library lib;
 class Test {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   Test t = null;
 }
@@ -3264,7 +3346,7 @@
 library lib;
 class Test {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   Test t = null;
 }
@@ -3288,7 +3370,7 @@
 library lib;
 myFunction() {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   myFunction();
 }
@@ -3312,7 +3394,7 @@
 library lib;
 myFunction() {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     myFunction();
@@ -3341,7 +3423,7 @@
 library lib;
 typedef MyFunction();
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   MyFunction t = null;
 }
@@ -3365,7 +3447,7 @@
 library lib;
 int MY_VAR = 42;
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   print(MY_VAR);
 }
@@ -3383,7 +3465,7 @@
   }
 
   test_importLibrarySdk_withClass_AsExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   p as Future;
 }
@@ -3400,7 +3482,7 @@
   }
 
   test_importLibrarySdk_withClass_invocationTarget() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   Future.wait(null);
 }
@@ -3417,7 +3499,7 @@
   }
 
   test_importLibrarySdk_withClass_IsExpression() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   p is Future;
 }
@@ -3434,7 +3516,7 @@
   }
 
   test_importLibrarySdk_withClass_itemOfList() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var a = [Future];
 }
@@ -3455,7 +3537,7 @@
     errorFilter = (AnalysisError error) {
       return error.errorCode == StaticWarningCode.UNDEFINED_IDENTIFIER;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class MyAnnotation {
   const MyAnnotation(a, b);
 }
@@ -3476,7 +3558,7 @@
   }
 
   test_importLibrarySdk_withClass_typeAnnotation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   Future f = null;
 }
@@ -3493,7 +3575,7 @@
   }
 
   test_importLibrarySdk_withClass_typeAnnotation_PrefixedIdentifier() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   Future.wait;
 }
@@ -3510,7 +3592,7 @@
   }
 
   test_importLibrarySdk_withClass_typeArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   List<Future> futures = [];
 }
@@ -3527,7 +3609,7 @@
   }
 
   test_importLibrarySdk_withTopLevelVariable() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   print(PI);
 }
@@ -3545,7 +3627,7 @@
   }
 
   test_importLibrarySdk_withTopLevelVariable_annotation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 @PI
 main() {
 }
@@ -3570,7 +3652,7 @@
 class A {}
 class B {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'lib.dart' show A;
 main() {
   A a;
@@ -3591,7 +3673,7 @@
   }
 
   test_importLibraryShow_sdk() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async' show Stream;
 main() {
   Stream s = null;
@@ -3611,7 +3693,7 @@
   }
 
   test_isNotNull() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   p is! Null;
 }
@@ -3626,7 +3708,7 @@
   }
 
   test_isNull() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   p is Null;
 }
@@ -3641,7 +3723,7 @@
   }
 
   test_makeEnclosingClassAbstract_declaresAbstractMethod() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   m();
 }
@@ -3656,7 +3738,7 @@
   }
 
   test_makeEnclosingClassAbstract_inheritsAbstractMethod() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 abstract class A {
   m();
 }
@@ -3675,7 +3757,7 @@
   }
 
   test_makeFieldNotFinal_hasType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   final int fff = 1;
   main() {
@@ -3696,7 +3778,7 @@
   }
 
   test_makeFieldNotFinal_noType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   final fff = 1;
   main() {
@@ -3717,18 +3799,18 @@
   }
 
   test_noException_1() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(p) {
   p i s Null;
 }''');
-    List<AnalysisError> errors = context.computeErrors(testSource);
+    List<AnalysisError> errors = await _computeErrors();
     for (var error in errors) {
       await _computeFixes(error);
     }
   }
 
   test_nonBoolCondition_addNotNull() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(String p) {
   if (p) {
     print(p);
@@ -3747,7 +3829,7 @@
   }
 
   test_removeDeadCode_condition() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(int p) {
   if (true || p > 5) {
     print(1);
@@ -3766,7 +3848,7 @@
   }
 
   test_removeDeadCode_statements_one() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 int main() {
   print(0);
   return 42;
@@ -3784,7 +3866,7 @@
   }
 
   test_removeDeadCode_statements_two() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 int main() {
   print(0);
   return 42;
@@ -3803,7 +3885,7 @@
   }
 
   test_removeParentheses_inGetterDeclaration() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int get foo() => 0;
 }
@@ -3818,7 +3900,7 @@
   }
 
   test_removeParentheses_inGetterInvocation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int get foo => 0;
 }
@@ -3839,7 +3921,7 @@
   }
 
   test_removeUnnecessaryCast_assignment() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(Object p) {
   if (p is String) {
     String v = ((p as String));
@@ -3859,7 +3941,7 @@
 
   test_removeUnusedCatchClause() async {
     errorFilter = (AnalysisError error) => true;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   try {
     throw 42;
@@ -3881,7 +3963,7 @@
 
   test_removeUnusedCatchStack() async {
     errorFilter = (AnalysisError error) => true;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   try {
     throw 42;
@@ -3902,7 +3984,7 @@
   }
 
   test_removeUnusedImport() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:math';
 main() {
 }
@@ -3916,7 +3998,7 @@
   }
 
   test_removeUnusedImport_anotherImportOnLine() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:math'; import 'dart:async';
 
 main() {
@@ -3935,7 +4017,7 @@
   }
 
   test_removeUnusedImport_severalLines() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import
   'dart:math';
 main() {
@@ -3949,38 +4031,11 @@
 ''');
   }
 
-  test_replaceImportUri_inProject() async {
-    testFile = '/project/bin/test.dart';
-    addSource('/project/foo/bar/lib.dart', '');
-    resolveTestUnit('''
-import 'no/matter/lib.dart';
-''');
-    performAllAnalysisTasks();
-    await assertHasFix(
-        DartFixKind.REPLACE_IMPORT_URI,
-        '''
-import '../foo/bar/lib.dart';
-''');
-  }
-
-  test_replaceImportUri_package() async {
-    _configureMyPkg({'my_lib.dart': ''});
-    resolveTestUnit('''
-import 'no/matter/my_lib.dart';
-''');
-    performAllAnalysisTasks();
-    await assertHasFix(
-        DartFixKind.REPLACE_IMPORT_URI,
-        '''
-import 'package:my_pkg/my_lib.dart';
-''');
-  }
-
   test_replaceVarWithDynamic() async {
     errorFilter = (AnalysisError error) {
       return error.errorCode == ParserErrorCode.VAR_AS_TYPE_NAME;
     };
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   Map<String, var> m;
 }
@@ -3995,7 +4050,7 @@
   }
 
   test_replaceWithConstInstanceCreation() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   const A();
 }
@@ -4012,7 +4067,7 @@
   }
 
   test_undefinedClass_useSimilar_BAD_prefixed() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async' as c;
 main() {
   c.Fture v = null;
@@ -4029,7 +4084,7 @@
   }
 
   test_undefinedClass_useSimilar_fromImport() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   Stirng s = 'abc';
 }
@@ -4044,7 +4099,7 @@
   }
 
   test_undefinedClass_useSimilar_fromThisLibrary() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class MyClass {}
 main() {
   MyCalss v = null;
@@ -4060,8 +4115,26 @@
 ''');
   }
 
+  test_undefinedFunction_create_bottomArgument() async {
+    await resolveTestUnit('''
+main() {
+  test(throw 42);
+}
+''');
+    await assertHasFix(
+        DartFixKind.CREATE_FUNCTION,
+        '''
+main() {
+  test(throw 42);
+}
+
+void test(arg0) {
+}
+''');
+  }
+
   test_undefinedFunction_create_duplicateArgumentNames() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class C {
   int x;
 }
@@ -4087,7 +4160,7 @@
   }
 
   test_undefinedFunction_create_dynamicArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   dynamic v;
   test(v);
@@ -4107,7 +4180,7 @@
   }
 
   test_undefinedFunction_create_dynamicReturnType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   dynamic v = test();
 }
@@ -4125,7 +4198,7 @@
   }
 
   test_undefinedFunction_create_fromFunction() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int v = myUndefinedFunction(1, 2.0, '3');
 }
@@ -4143,7 +4216,7 @@
   }
 
   test_undefinedFunction_create_fromMethod() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     int v = myUndefinedFunction(1, 2.0, '3');
@@ -4165,7 +4238,7 @@
   }
 
   test_undefinedFunction_create_generic_BAD() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A<T> {
   Map<int, T> items;
   main() {
@@ -4189,7 +4262,7 @@
   }
 
   test_undefinedFunction_create_generic_OK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   List<int> items;
   main() {
@@ -4225,7 +4298,7 @@
 import 'dart:async';
 Future getFuture() => null;
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'lib.dart';
 main() {
   test(getFuture());
@@ -4246,7 +4319,7 @@
   }
 
   test_undefinedFunction_create_nullArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   test(null);
 }
@@ -4281,7 +4354,7 @@
   }
 
   test_undefinedFunction_create_returnType_fromAssignment_eq() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int v;
   v = myUndefinedFunction();
@@ -4301,7 +4374,7 @@
   }
 
   test_undefinedFunction_create_returnType_fromAssignment_plusEq() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int v;
   v += myUndefinedFunction();
@@ -4321,7 +4394,7 @@
   }
 
   test_undefinedFunction_create_returnType_fromBinary_right() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   0 + myUndefinedFunction();
 }
@@ -4339,7 +4412,7 @@
   }
 
   test_undefinedFunction_create_returnType_fromInitializer() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   int v = myUndefinedFunction();
 }
@@ -4357,7 +4430,7 @@
   }
 
   test_undefinedFunction_create_returnType_fromInvocationArgument() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 foo(int p) {}
 main() {
   foo( myUndefinedFunction() );
@@ -4377,7 +4450,7 @@
   }
 
   test_undefinedFunction_create_returnType_fromReturn() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 int main() {
   return myUndefinedFunction();
 }
@@ -4395,7 +4468,7 @@
   }
 
   test_undefinedFunction_create_returnType_void() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   myUndefinedFunction();
 }
@@ -4413,7 +4486,7 @@
   }
 
   test_undefinedFunction_useSimilar_fromImport() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   pritn(0);
 }
@@ -4428,7 +4501,7 @@
   }
 
   test_undefinedFunction_useSimilar_prefixed_fromImport() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:core' as c;
 main() {
   c.prnt(42);
@@ -4445,7 +4518,7 @@
   }
 
   test_undefinedFunction_useSimilar_prefixed_ignoreLocal() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async' as c;
 main() {
   c.main();
@@ -4455,7 +4528,7 @@
   }
 
   test_undefinedFunction_useSimilar_thisLibrary() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 myFunction() {}
 main() {
   myFuntcion();
@@ -4472,7 +4545,7 @@
   }
 
   test_undefinedGetter_useSimilar_hint() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int myField;
 }
@@ -4495,7 +4568,7 @@
   }
 
   test_undefinedGetter_useSimilar_qualified() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int myField;
 }
@@ -4516,7 +4589,7 @@
   }
 
   test_undefinedGetter_useSimilar_qualified_static() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   static int MY_NAME = 1;
 }
@@ -4537,7 +4610,7 @@
   }
 
   test_undefinedGetter_useSimilar_unqualified() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int myField;
   main() {
@@ -4558,7 +4631,7 @@
   }
 
   test_undefinedMethod_create_BAD_inSDK() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   List.foo();
 }
@@ -4567,7 +4640,7 @@
   }
 
   test_undefinedMethod_create_BAD_targetIsEnum() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 enum MyEnum {A, B}
 main() {
   MyEnum.foo();
@@ -4577,7 +4650,7 @@
   }
 
   test_undefinedMethod_create_generic_BAD_argumentType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A<T> {
   B b;
   Map<int, T> items;
@@ -4601,14 +4674,13 @@
 }
 
 class B {
-  void process(Map items) {
-  }
+  void process(Map items) {}
 }
 ''');
   }
 
   test_undefinedMethod_create_generic_BAD_returnType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A<T> {
   main() {
     T t = new B().compute();
@@ -4628,14 +4700,13 @@
 }
 
 class B {
-  dynamic compute() {
-  }
+  dynamic compute() {}
 }
 ''');
   }
 
   test_undefinedMethod_create_generic_OK_literal() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   B b;
   List<int> items;
@@ -4644,8 +4715,7 @@
   }
 }
 
-class B {
-}
+class B {}
 ''');
     await assertHasFix(
         DartFixKind.CREATE_METHOD,
@@ -4659,14 +4729,13 @@
 }
 
 class B {
-  void process(List<int> items) {
-  }
+  void process(List<int> items) {}
 }
 ''');
   }
 
   test_undefinedMethod_create_generic_OK_local() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A<T> {
   List<T> items;
   main() {
@@ -4683,14 +4752,32 @@
     process(items);
   }
 
-  void process(List<T> items) {
+  void process(List<T> items) {}
+}
+''');
   }
+
+  test_undefinedMethod_createQualified_emptyClassBody() async {
+    await resolveTestUnit('''
+class A {}
+main() {
+  A.myUndefinedMethod();
+}
+''');
+    await assertHasFix(
+        DartFixKind.CREATE_METHOD,
+        '''
+class A {
+  static void myUndefinedMethod() {}
+}
+main() {
+  A.myUndefinedMethod();
 }
 ''');
   }
 
   test_undefinedMethod_createQualified_fromClass() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main() {
@@ -4701,8 +4788,7 @@
         DartFixKind.CREATE_METHOD,
         '''
 class A {
-  static void myUndefinedMethod() {
-  }
+  static void myUndefinedMethod() {}
 }
 main() {
   A.myUndefinedMethod();
@@ -4711,7 +4797,7 @@
   }
 
   test_undefinedMethod_createQualified_fromClass_hasOtherMember() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   foo() {}
 }
@@ -4725,8 +4811,7 @@
 class A {
   foo() {}
 
-  static void myUndefinedMethod() {
-  }
+  static void myUndefinedMethod() {}
 }
 main() {
   A.myUndefinedMethod();
@@ -4735,7 +4820,7 @@
   }
 
   test_undefinedMethod_createQualified_fromInstance() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main(A a) {
@@ -4746,8 +4831,7 @@
         DartFixKind.CREATE_METHOD,
         '''
 class A {
-  void myUndefinedMethod() {
-  }
+  void myUndefinedMethod() {}
 }
 main(A a) {
   a.myUndefinedMethod();
@@ -4756,7 +4840,7 @@
   }
 
   test_undefinedMethod_createQualified_targetIsFunctionType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 typedef A();
 main() {
   A.myUndefinedMethod();
@@ -4766,7 +4850,7 @@
   }
 
   test_undefinedMethod_createQualified_targetIsUnresolved() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   NoSuchClass.myUndefinedMethod();
 }
@@ -4775,7 +4859,7 @@
   }
 
   test_undefinedMethod_createUnqualified_duplicateArgumentNames() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class C {
   int x;
 }
@@ -4797,13 +4881,12 @@
     bar(c1.x, c2.x);
   }
 
-  void bar(int x, int x2) {
-  }
+  void bar(int x, int x2) {}
 }''');
   }
 
   test_undefinedMethod_createUnqualified_parameters() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     myUndefinedMethod(0, 1.0, '3');
@@ -4818,8 +4901,7 @@
     myUndefinedMethod(0, 1.0, '3');
   }
 
-  void myUndefinedMethod(int i, double d, String s) {
-  }
+  void myUndefinedMethod(int i, double d, String s) {}
 }
 ''');
     // linked positions
@@ -4849,7 +4931,7 @@
   }
 
   test_undefinedMethod_createUnqualified_parameters_named() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     myUndefinedMethod(0, bbb: 1.0, ccc: '2');
@@ -4864,8 +4946,7 @@
     myUndefinedMethod(0, bbb: 1.0, ccc: '2');
   }
 
-  void myUndefinedMethod(int i, {double bbb, String ccc}) {
-  }
+  void myUndefinedMethod(int i, {double bbb, String ccc}) {}
 }
 ''');
     // linked positions
@@ -4893,7 +4974,7 @@
   }
 
   test_undefinedMethod_createUnqualified_returnType() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   main() {
     int v = myUndefinedMethod();
@@ -4908,8 +4989,7 @@
     int v = myUndefinedMethod();
   }
 
-  int myUndefinedMethod() {
-  }
+  int myUndefinedMethod() {}
 }
 ''');
     // linked positions
@@ -4919,7 +4999,7 @@
   }
 
   test_undefinedMethod_createUnqualified_staticFromField() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   static var f = myUndefinedMethod();
 }
@@ -4930,14 +5010,13 @@
 class A {
   static var f = myUndefinedMethod();
 
-  static myUndefinedMethod() {
-  }
+  static myUndefinedMethod() {}
 }
 ''');
   }
 
   test_undefinedMethod_createUnqualified_staticFromMethod() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   static main() {
     myUndefinedMethod();
@@ -4952,14 +5031,13 @@
     myUndefinedMethod();
   }
 
-  static void myUndefinedMethod() {
-  }
+  static void myUndefinedMethod() {}
 }
 ''');
   }
 
   test_undefinedMethod_hint_createQualified_fromInstance() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
 }
 main() {
@@ -4971,8 +5049,7 @@
         DartFixKind.CREATE_METHOD,
         '''
 class A {
-  void myUndefinedMethod() {
-  }
+  void myUndefinedMethod() {}
 }
 main() {
   var a = new A();
@@ -4996,14 +5073,14 @@
 library test3;
 class E {}
 ''');
-    resolveTestUnit('''
+    await resolveTestUnit('''
 library test;
 import 'test2.dart' as aaa;
 main(aaa.D d, aaa.E e) {
   d.foo(e);
 }
 ''');
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     fix = await _assertHasFix(DartFixKind.CREATE_METHOD, error);
     change = fix.change;
     // apply to "test2.dart"
@@ -5018,8 +5095,7 @@
 import 'test3.dart' as bbb;
 export 'test3.dart';
 class D {
-  void foo(bbb.E e) {
-  }
+  void foo(bbb.E e) {}
 }
 ''');
   }
@@ -5032,14 +5108,14 @@
 class E {}
 ''';
     addSource('/test2.dart', code2);
-    resolveTestUnit('''
+    await resolveTestUnit('''
 library test;
 import 'test2.dart' as test2;
 main(test2.D d, test2.E e) {
   d.foo(e);
 }
 ''');
-    AnalysisError error = _findErrorToFix();
+    AnalysisError error = await _findErrorToFix();
     fix = await _assertHasFix(DartFixKind.CREATE_METHOD, error);
     change = fix.change;
     // apply to "test2.dart"
@@ -5052,15 +5128,14 @@
         r'''
 library test2;
 class D {
-  void foo(E e) {
-  }
+  void foo(E e) {}
 }
 class E {}
 ''');
   }
 
   test_undefinedMethod_useSimilar_ignoreOperators() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main(Object object) {
   object.then();
 }
@@ -5069,7 +5144,7 @@
   }
 
   test_undefinedMethod_useSimilar_qualified() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   myMethod() {}
 }
@@ -5092,7 +5167,7 @@
   }
 
   test_undefinedMethod_useSimilar_unqualified_superClass() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   myMethod() {}
 }
@@ -5117,7 +5192,7 @@
   }
 
   test_undefinedMethod_useSimilar_unqualified_thisClass() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   myMethod() {}
   main() {
@@ -5138,7 +5213,7 @@
   }
 
   test_undefinedSetter_useSimilar_hint() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int myField;
 }
@@ -5161,7 +5236,7 @@
   }
 
   test_undefinedSetter_useSimilar_qualified() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int myField;
 }
@@ -5182,7 +5257,7 @@
   }
 
   test_undefinedSetter_useSimilar_unqualified() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 class A {
   int myField;
   main() {
@@ -5203,7 +5278,7 @@
   }
 
   test_useEffectiveIntegerDivision() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 main() {
   var a = 5;
   var b = 2;
@@ -5222,7 +5297,7 @@
   }
 
   test_useImportPrefix_withClass() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:async' as pref;
 main() {
   pref.Stream s = null;
@@ -5241,7 +5316,7 @@
   }
 
   test_useImportPrefix_withTopLevelVariable() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:math' as pref;
 main() {
   print(pref.E);
@@ -5261,6 +5336,73 @@
 }
 
 @reflectiveTest
+class FixProcessorTest_Driver extends FixProcessorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withClass_AsExpression() {
+    return super.test_importLibrarySdk_withClass_AsExpression();
+  }
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withClass_invocationTarget() {
+    return super.test_importLibrarySdk_withClass_invocationTarget();
+  }
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withClass_IsExpression() {
+    return super.test_importLibrarySdk_withClass_IsExpression();
+  }
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withClass_itemOfList() {
+    return super.test_importLibrarySdk_withClass_itemOfList();
+  }
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withClass_itemOfList_inAnnotation() {
+    return super.test_importLibrarySdk_withClass_itemOfList_inAnnotation();
+  }
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withClass_typeAnnotation() {
+    return super.test_importLibrarySdk_withClass_typeAnnotation();
+  }
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withClass_typeAnnotation_PrefixedIdentifier() {
+    return super
+        .test_importLibrarySdk_withClass_typeAnnotation_PrefixedIdentifier();
+  }
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withClass_typeArgument() {
+    return super.test_importLibrarySdk_withClass_typeArgument();
+  }
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withTopLevelVariable() {
+    return super.test_importLibrarySdk_withTopLevelVariable();
+  }
+
+  @failingTest
+  @override
+  test_importLibrarySdk_withTopLevelVariable_annotation() {
+    return super.test_importLibrarySdk_withTopLevelVariable_annotation();
+  }
+}
+
+@reflectiveTest
 class LintFixTest extends BaseFixProcessorTest {
   AnalysisError error;
 
@@ -5273,10 +5415,13 @@
     resultCode = SourceEdit.applySequence(testCode, change.edits[0].edits);
   }
 
-  void findLint(String src, String lintCode, {int length: 1}) {
+  Future<Null> findLint(String src, String lintCode, {int length: 1}) async {
     int errorOffset = src.indexOf('/*LINT*/');
-    resolveTestUnit(src.replaceAll('/*LINT*/', ''));
-    error = new AnalysisError(testUnit.element.source, errorOffset, length,
+    await resolveTestUnit(src.replaceAll('/*LINT*/', ''));
+    error = new AnalysisError(
+        resolutionMap.elementDeclaredByCompilationUnit(testUnit).source,
+        errorOffset,
+        length,
         new LintCode(lintCode, '<ignored>'));
   }
 
@@ -5289,7 +5434,7 @@
   int /*LINT*/t = 42;
 }
 ''';
-    findLint(src, LintNames.annotate_overrides);
+    await findLint(src, LintNames.annotate_overrides);
 
     await applyFix(DartFixKind.LINT_ADD_OVERRIDE);
 
@@ -5313,7 +5458,7 @@
   int get /*LINT*/t => null;
 }
 ''';
-    findLint(src, LintNames.annotate_overrides);
+    await findLint(src, LintNames.annotate_overrides);
 
     await applyFix(DartFixKind.LINT_ADD_OVERRIDE);
 
@@ -5337,7 +5482,7 @@
   void /*LINT*/t() { }
 }
 ''';
-    findLint(src, LintNames.annotate_overrides);
+    await findLint(src, LintNames.annotate_overrides);
 
     await applyFix(DartFixKind.LINT_ADD_OVERRIDE);
 
@@ -5362,7 +5507,7 @@
   void /*LINT*/t() { }
 }
 ''';
-    findLint(src, LintNames.annotate_overrides);
+    await findLint(src, LintNames.annotate_overrides);
 
     await applyFix(DartFixKind.LINT_ADD_OVERRIDE);
 
@@ -5390,7 +5535,7 @@
   void /*LINT*/t() { }
 }
 ''';
-    findLint(src, LintNames.annotate_overrides);
+    await findLint(src, LintNames.annotate_overrides);
 
     await applyFix(DartFixKind.LINT_ADD_OVERRIDE);
 
@@ -5419,7 +5564,7 @@
   void /*LINT*/t() { }
 }
 ''';
-    findLint(src, LintNames.annotate_overrides);
+    await findLint(src, LintNames.annotate_overrides);
 
     await applyFix(DartFixKind.LINT_ADD_OVERRIDE);
 
@@ -5446,7 +5591,7 @@
   void /*LINT*/t() { }
 }
 ''';
-    findLint(src, LintNames.annotate_overrides);
+    await findLint(src, LintNames.annotate_overrides);
 
     await applyFix(DartFixKind.LINT_ADD_OVERRIDE);
 
@@ -5469,7 +5614,8 @@
   print('v: /*LINT*/${ v}');
 }
 ''';
-    findLint(src, LintNames.unnecessary_brace_in_string_interp, length: 4);
+    await findLint(src, LintNames.unnecessary_brace_in_string_interp,
+        length: 4);
     await applyFix(DartFixKind.LINT_REMOVE_INTERPOLATION_BRACES);
     verifyResult(r'''
 main() {
@@ -5483,3 +5629,29 @@
     expect(resultCode, expectedResult);
   }
 }
+
+@reflectiveTest
+class LintFixTest_Driver extends LintFixTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
+
+class _DartFixContextImpl implements DartFixContext {
+  @override
+  final ResourceProvider resourceProvider;
+
+  @override
+  final GetTopLevelDeclarations getTopLevelDeclarations;
+
+  @override
+  final AnalysisContext analysisContext;
+
+  @override
+  final CompilationUnit unit;
+
+  @override
+  final AnalysisError error;
+
+  _DartFixContextImpl(this.resourceProvider, this.getTopLevelDeclarations,
+      this.analysisContext, this.unit, this.error);
+}
diff --git a/pkg/analysis_server/test/services/correction/name_suggestion_test.dart b/pkg/analysis_server/test/services/correction/name_suggestion_test.dart
index fdd914e..c33dc66 100644
--- a/pkg/analysis_server/test/services/correction/name_suggestion_test.dart
+++ b/pkg/analysis_server/test/services/correction/name_suggestion_test.dart
@@ -21,8 +21,8 @@
 
 @reflectiveTest
 class VariableNameSuggestionTest extends AbstractSingleUnitTest {
-  void test_forExpression_cast() {
-    resolveTestUnit('''
+  test_forExpression_cast() async {
+    await resolveTestUnit('''
 main() {
   var sortedNodes;
   var res = sortedNodes as String;
@@ -34,8 +34,8 @@
         unorderedEquals(['sortedNodes', 'nodes']));
   }
 
-  void test_forExpression_expectedType() {
-    resolveTestUnit('''
+  test_forExpression_expectedType() async {
+    await resolveTestUnit('''
 class TreeNode {}
 main() {
   TreeNode node = null;
@@ -50,8 +50,8 @@
     expect(suggestions, unorderedEquals(['treeNode', 'node']));
   }
 
-  void test_forExpression_expectedType_double() {
-    resolveTestUnit('''
+  test_forExpression_expectedType_double() async {
+    await resolveTestUnit('''
 main() {
   double res = 0.0;
 }
@@ -70,8 +70,8 @@
         unorderedEquals(['f']));
   }
 
-  void test_forExpression_expectedType_int() {
-    resolveTestUnit('''
+  test_forExpression_expectedType_int() async {
+    await resolveTestUnit('''
 main() {
   int res = 0;
 }
@@ -90,8 +90,8 @@
         unorderedEquals(['k']));
   }
 
-  void test_forExpression_expectedType_String() {
-    resolveTestUnit('''
+  test_forExpression_expectedType_String() async {
+    await resolveTestUnit('''
 main() {
   String res = 'abc';
 }
@@ -105,9 +105,9 @@
         unorderedEquals(['s']));
   }
 
-  void test_forExpression_instanceCreation() {
+  test_forExpression_instanceCreation() async {
     verifyNoTestUnitErrors = false;
-    resolveTestUnit('''
+    await resolveTestUnit('''
 import 'dart:math' as p;
 main(p) {
   new NoSuchClass();
@@ -134,8 +134,8 @@
 //        unorderedEquals(['noSuchClass', 'suchClass', 'class']));
   }
 
-  void test_forExpression_invocationArgument_named() {
-    resolveTestUnit('''
+  test_forExpression_invocationArgument_named() async {
+    await resolveTestUnit('''
 foo({a, b, c}) {}
 main() {
   foo(a: 111, c: 333, b: 222);
@@ -159,8 +159,8 @@
     }
   }
 
-  void test_forExpression_invocationArgument_optional() {
-    resolveTestUnit('''
+  test_forExpression_invocationArgument_optional() async {
+    await resolveTestUnit('''
 foo(a, [b = 2, c = 3]) {}
 main() {
   foo(111, 222, 333);
@@ -184,8 +184,8 @@
     }
   }
 
-  void test_forExpression_invocationArgument_positional() {
-    resolveTestUnit('''
+  test_forExpression_invocationArgument_positional() async {
+    await resolveTestUnit('''
 foo(a, b) {}
 main() {
   foo(111, 222);
@@ -204,8 +204,8 @@
     }
   }
 
-  void test_forExpression_methodInvocation() {
-    resolveTestUnit('''
+  test_forExpression_methodInvocation() async {
+    await resolveTestUnit('''
 main(p) {
   var res = p.getSortedNodes();
 }
@@ -216,8 +216,8 @@
         unorderedEquals(['sortedNodes', 'nodes']));
   }
 
-  void test_forExpression_methodInvocation_noPrefix() {
-    resolveTestUnit('''
+  test_forExpression_methodInvocation_noPrefix() async {
+    await resolveTestUnit('''
 main(p) {
   var res = p.sortedNodes();
 }
@@ -228,8 +228,8 @@
         unorderedEquals(['sortedNodes', 'nodes']));
   }
 
-  void test_forExpression_name_get() {
-    resolveTestUnit('''
+  test_forExpression_name_get() async {
+    await resolveTestUnit('''
 main(p) {
   var res = p.get();
 }
@@ -240,8 +240,8 @@
         unorderedEquals([]));
   }
 
-  void test_forExpression_prefixedIdentifier() {
-    resolveTestUnit('''
+  test_forExpression_prefixedIdentifier() async {
+    await resolveTestUnit('''
 main(p) {
   var res = p.sortedNodes;
 }
@@ -255,8 +255,8 @@
         unorderedEquals(['sortedNodes', 'nodes']));
   }
 
-  void test_forExpression_privateName() {
-    resolveTestUnit('''
+  test_forExpression_privateName() async {
+    await resolveTestUnit('''
 main(p) {
   p._name;
   p._computeSuffix();
@@ -277,8 +277,8 @@
         unorderedEquals(['computeSuffix', 'suffix']));
   }
 
-  void test_forExpression_propertyAccess() {
-    resolveTestUnit('''
+  test_forExpression_propertyAccess() async {
+    await resolveTestUnit('''
 main(p) {
   var res = p.q.sortedNodes;
 }
@@ -290,8 +290,8 @@
         unorderedEquals(['sortedNodes', 'nodes']));
   }
 
-  void test_forExpression_simpleName() {
-    resolveTestUnit('''
+  test_forExpression_simpleName() async {
+    await resolveTestUnit('''
 main(p) {
   var sortedNodes = null;
   var res = sortedNodes;
@@ -303,8 +303,8 @@
         unorderedEquals(['sortedNodes', 'nodes']));
   }
 
-  void test_forExpression_unqualifiedInvocation() {
-    resolveTestUnit('''
+  test_forExpression_unqualifiedInvocation() async {
+    await resolveTestUnit('''
 getSortedNodes() => [];
 main(p) {
   var res = getSortedNodes();
diff --git a/pkg/analysis_server/test/services/correction/source_range_test.dart b/pkg/analysis_server/test/services/correction/source_range_test.dart
index 28779ac..86ca72d 100644
--- a/pkg/analysis_server/test/services/correction/source_range_test.dart
+++ b/pkg/analysis_server/test/services/correction/source_range_test.dart
@@ -23,22 +23,22 @@
 
 @reflectiveTest
 class SourceRangesTest extends AbstractSingleUnitTest {
-  void test_rangeElementName() {
-    resolveTestUnit('class ABC {}');
+  test_rangeElementName() async {
+    await resolveTestUnit('class ABC {}');
     Element element = findElement('ABC');
     expect(rangeElementName(element), new SourceRange(6, 3));
   }
 
-  void test_rangeEndEnd_nodeNode() {
-    resolveTestUnit('main() {}');
+  test_rangeEndEnd_nodeNode() async {
+    await resolveTestUnit('main() {}');
     FunctionDeclaration mainFunction = testUnit.declarations[0];
     SimpleIdentifier mainName = mainFunction.name;
     FunctionBody mainBody = mainFunction.functionExpression.body;
     expect(rangeEndEnd(mainName, mainBody), new SourceRange(4, 5));
   }
 
-  void test_rangeEndStart_nodeNode() {
-    resolveTestUnit('main() {}');
+  test_rangeEndStart_nodeNode() async {
+    await resolveTestUnit('main() {}');
     FunctionDeclaration mainFunction = testUnit.declarations[0];
     SimpleIdentifier mainName = mainFunction.name;
     FunctionBody mainBody = mainFunction.functionExpression.body;
@@ -51,23 +51,23 @@
     expect(rangeError(error), new SourceRange(10, 5));
   }
 
-  void test_rangeNode() {
-    resolveTestUnit('main() {}');
+  test_rangeNode() async {
+    await resolveTestUnit('main() {}');
     FunctionDeclaration mainFunction = testUnit.declarations[0];
     SimpleIdentifier mainName = mainFunction.name;
     expect(rangeNode(mainName), new SourceRange(0, 4));
   }
 
-  void test_rangeNodes() {
-    resolveTestUnit(' main() {}');
+  test_rangeNodes() async {
+    await resolveTestUnit(' main() {}');
     FunctionDeclaration mainFunction = testUnit.declarations[0];
     SimpleIdentifier mainName = mainFunction.name;
     FunctionBody mainBody = mainFunction.functionExpression.body;
     expect(rangeNodes([mainName, mainBody]), new SourceRange(1, 9));
   }
 
-  void test_rangeNodes_empty() {
-    resolveTestUnit('main() {}');
+  test_rangeNodes_empty() async {
+    await resolveTestUnit('main() {}');
     expect(rangeNodes([]), new SourceRange(0, 0));
   }
 
@@ -75,8 +75,8 @@
     expect(rangeStartEnd(10, 25), new SourceRange(10, 15));
   }
 
-  void test_rangeStartEnd_nodeNode() {
-    resolveTestUnit(' main() {}');
+  test_rangeStartEnd_nodeNode() async {
+    await resolveTestUnit(' main() {}');
     FunctionDeclaration mainFunction = testUnit.declarations[0];
     SimpleIdentifier mainName = mainFunction.name;
     FunctionBody mainBody = mainFunction.functionExpression.body;
@@ -87,8 +87,8 @@
     expect(rangeStartLength(5, 10), new SourceRange(5, 10));
   }
 
-  void test_rangeStartLength_node() {
-    resolveTestUnit(' main() {}');
+  test_rangeStartLength_node() async {
+    await resolveTestUnit(' main() {}');
     FunctionDeclaration mainFunction = testUnit.declarations[0];
     SimpleIdentifier mainName = mainFunction.name;
     expect(rangeStartLength(mainName, 10), new SourceRange(1, 10));
@@ -98,16 +98,16 @@
     expect(rangeStartStart(10, 25), new SourceRange(10, 15));
   }
 
-  void test_rangeStartStart_nodeNode() {
-    resolveTestUnit('main() {}');
+  test_rangeStartStart_nodeNode() async {
+    await resolveTestUnit('main() {}');
     FunctionDeclaration mainFunction = testUnit.declarations[0];
     SimpleIdentifier mainName = mainFunction.name;
     FunctionBody mainBody = mainFunction.functionExpression.body;
     expect(rangeStartStart(mainName, mainBody), new SourceRange(0, 7));
   }
 
-  void test_rangeToken() {
-    resolveTestUnit(' main() {}');
+  test_rangeToken() async {
+    await resolveTestUnit(' main() {}');
     FunctionDeclaration mainFunction = testUnit.declarations[0];
     SimpleIdentifier mainName = mainFunction.name;
     expect(rangeToken(mainName.beginToken), new SourceRange(1, 4));
diff --git a/pkg/analysis_server/test/services/correction/status_test.dart b/pkg/analysis_server/test/services/correction/status_test.dart
index 9c9169e..1775987 100644
--- a/pkg/analysis_server/test/services/correction/status_test.dart
+++ b/pkg/analysis_server/test/services/correction/status_test.dart
@@ -26,8 +26,8 @@
 
 @reflectiveTest
 class RefactoringLocationTest extends AbstractSingleUnitTest {
-  void test_createLocation_forElement() {
-    resolveTestUnit('class MyClass {}');
+  test_createLocation_forElement() async {
+    await resolveTestUnit('class MyClass {}');
     Element element = findElement('MyClass');
     // check
     Location location = newLocation_fromElement(element);
@@ -38,8 +38,8 @@
     expect(location.startColumn, 7);
   }
 
-  void test_createLocation_forMatch() {
-    resolveTestUnit('class MyClass {}');
+  test_createLocation_forMatch() async {
+    await resolveTestUnit('class MyClass {}');
     Element element = findElement('MyClass');
     SourceRange range = rangeElementName(element);
     SearchMatch match = new SearchMatchImpl(
@@ -57,8 +57,8 @@
     expect(location.length, range.length);
   }
 
-  void test_createLocation_forNode() {
-    resolveTestUnit('''
+  test_createLocation_forNode() async {
+    await resolveTestUnit('''
 main() {
 }
 ''');
@@ -70,8 +70,8 @@
     expect(location.length, node.length);
   }
 
-  void test_createLocation_forUnit() {
-    resolveTestUnit('');
+  test_createLocation_forUnit() async {
+    await resolveTestUnit('');
     SourceRange range = rangeStartLength(10, 20);
     // check
     Location location = newLocation_fromUnit(testUnit, range);
diff --git a/pkg/analysis_server/test/services/correction/util_test.dart b/pkg/analysis_server/test/services/correction/util_test.dart
index 2eb68bb..8639a6b 100644
--- a/pkg/analysis_server/test/services/correction/util_test.dart
+++ b/pkg/analysis_server/test/services/correction/util_test.dart
@@ -7,7 +7,6 @@
 import 'package:analysis_server/plugin/protocol/protocol.dart';
 import 'package:analysis_server/src/services/correction/strings.dart';
 import 'package:analysis_server/src/services/correction/util.dart';
-import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -22,14 +21,14 @@
 
 @reflectiveTest
 class UtilTest extends AbstractSingleUnitTest {
-  test_addLibraryImports_dart_hasImports_between() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_hasImports_between() async {
+    await resolveTestUnit('''
 import 'dart:async';
 import 'dart:math';
 ''');
-    LibraryElement newLibrary = _getDartLibrary('dart:collection');
+    Source newLibrary = _getDartSource('dart:collection');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary],
+        <Source>[newLibrary],
         '''
 import 'dart:async';
 import 'dart:collection';
@@ -37,14 +36,14 @@
 ''');
   }
 
-  test_addLibraryImports_dart_hasImports_first() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_hasImports_first() async {
+    await resolveTestUnit('''
 import 'dart:collection';
 import 'dart:math';
 ''');
-    LibraryElement newLibrary = _getDartLibrary('dart:async');
+    Source newLibrary = _getDartSource('dart:async');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary],
+        <Source>[newLibrary],
         '''
 import 'dart:async';
 import 'dart:collection';
@@ -52,14 +51,14 @@
 ''');
   }
 
-  test_addLibraryImports_dart_hasImports_last() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_hasImports_last() async {
+    await resolveTestUnit('''
 import 'dart:async';
 import 'dart:collection';
 ''');
-    LibraryElement newLibrary = _getDartLibrary('dart:math');
+    Source newLibrary = _getDartSource('dart:math');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary],
+        <Source>[newLibrary],
         '''
 import 'dart:async';
 import 'dart:collection';
@@ -67,15 +66,15 @@
 ''');
   }
 
-  test_addLibraryImports_dart_hasImports_multiple() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_hasImports_multiple() async {
+    await resolveTestUnit('''
 import 'dart:collection';
 import 'dart:math';
 ''');
-    LibraryElement newLibrary1 = _getDartLibrary('dart:async');
-    LibraryElement newLibrary2 = _getDartLibrary('dart:html');
+    Source newLibrary1 = _getDartSource('dart:async');
+    Source newLibrary2 = _getDartSource('dart:html');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary1, newLibrary2],
+        <Source>[newLibrary1, newLibrary2],
         '''
 import 'dart:async';
 import 'dart:collection';
@@ -84,15 +83,15 @@
 ''');
   }
 
-  test_addLibraryImports_dart_hasImports_multiple_first() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_hasImports_multiple_first() async {
+    await resolveTestUnit('''
 import 'dart:html';
 import 'dart:math';
 ''');
-    LibraryElement newLibrary1 = _getDartLibrary('dart:async');
-    LibraryElement newLibrary2 = _getDartLibrary('dart:collection');
+    Source newLibrary1 = _getDartSource('dart:async');
+    Source newLibrary2 = _getDartSource('dart:collection');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary1, newLibrary2],
+        <Source>[newLibrary1, newLibrary2],
         '''
 import 'dart:async';
 import 'dart:collection';
@@ -101,15 +100,15 @@
 ''');
   }
 
-  test_addLibraryImports_dart_hasImports_multiple_last() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_hasImports_multiple_last() async {
+    await resolveTestUnit('''
 import 'dart:async';
 import 'dart:collection';
 ''');
-    LibraryElement newLibrary1 = _getDartLibrary('dart:html');
-    LibraryElement newLibrary2 = _getDartLibrary('dart:math');
+    Source newLibrary1 = _getDartSource('dart:html');
+    Source newLibrary2 = _getDartSource('dart:math');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary1, newLibrary2],
+        <Source>[newLibrary1, newLibrary2],
         '''
 import 'dart:async';
 import 'dart:collection';
@@ -118,16 +117,16 @@
 ''');
   }
 
-  test_addLibraryImports_dart_hasLibraryDirective() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_hasLibraryDirective() async {
+    await resolveTestUnit('''
 library test;
 
 class A {}
 ''');
-    LibraryElement newLibrary1 = _getDartLibrary('dart:math');
-    LibraryElement newLibrary2 = _getDartLibrary('dart:async');
+    Source newLibrary1 = _getDartSource('dart:math');
+    Source newLibrary2 = _getDartSource('dart:async');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary1, newLibrary2],
+        <Source>[newLibrary1, newLibrary2],
         '''
 library test;
 
@@ -138,16 +137,16 @@
 ''');
   }
 
-  test_addLibraryImports_dart_noDirectives_hasComment() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_noDirectives_hasComment() async {
+    await resolveTestUnit('''
 /// Comment.
 
 class A {}
 ''');
-    LibraryElement newLibrary1 = _getDartLibrary('dart:math');
-    LibraryElement newLibrary2 = _getDartLibrary('dart:async');
+    Source newLibrary1 = _getDartSource('dart:math');
+    Source newLibrary2 = _getDartSource('dart:async');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary1, newLibrary2],
+        <Source>[newLibrary1, newLibrary2],
         '''
 /// Comment.
 
@@ -158,16 +157,16 @@
 ''');
   }
 
-  test_addLibraryImports_dart_noDirectives_hasShebang() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_noDirectives_hasShebang() async {
+    await resolveTestUnit('''
 #!/bin/dart
 
 class A {}
 ''');
-    LibraryElement newLibrary1 = _getDartLibrary('dart:math');
-    LibraryElement newLibrary2 = _getDartLibrary('dart:async');
+    Source newLibrary1 = _getDartSource('dart:math');
+    Source newLibrary2 = _getDartSource('dart:async');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary1, newLibrary2],
+        <Source>[newLibrary1, newLibrary2],
         '''
 #!/bin/dart
 
@@ -178,14 +177,14 @@
 ''');
   }
 
-  test_addLibraryImports_dart_noDirectives_noShebang() {
-    resolveTestUnit('''
+  test_addLibraryImports_dart_noDirectives_noShebang() async {
+    await resolveTestUnit('''
 class A {}
 ''');
-    LibraryElement newLibrary1 = _getDartLibrary('dart:math');
-    LibraryElement newLibrary2 = _getDartLibrary('dart:async');
+    Source newLibrary1 = _getDartSource('dart:math');
+    Source newLibrary2 = _getDartSource('dart:async');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary1, newLibrary2],
+        <Source>[newLibrary1, newLibrary2],
         '''
 import 'dart:async';
 import 'dart:math';
@@ -194,16 +193,15 @@
 ''');
   }
 
-  test_addLibraryImports_package_hasDart_hasPackages_insertAfter() {
-    resolveTestUnit('''
+  test_addLibraryImports_package_hasDart_hasPackages_insertAfter() async {
+    await resolveTestUnit('''
 import 'dart:async';
 
 import 'package:aaa/aaa.dart';
 ''');
-    LibraryElement newLibrary =
-        _mockLibraryElement('/lib/bbb.dart', 'package:bbb/bbb.dart');
+    Source newLibrary = _getSource('/lib/bbb.dart', 'package:bbb/bbb.dart');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary],
+        <Source>[newLibrary],
         '''
 import 'dart:async';
 
@@ -212,16 +210,15 @@
 ''');
   }
 
-  test_addLibraryImports_package_hasDart_hasPackages_insertBefore() {
-    resolveTestUnit('''
+  test_addLibraryImports_package_hasDart_hasPackages_insertBefore() async {
+    await resolveTestUnit('''
 import 'dart:async';
 
 import 'package:bbb/bbb.dart';
 ''');
-    LibraryElement newLibrary =
-        _mockLibraryElement('/lib/aaa.dart', 'package:aaa/aaa.dart');
+    Source newLibrary = _getSource('/lib/aaa.dart', 'package:aaa/aaa.dart');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary],
+        <Source>[newLibrary],
         '''
 import 'dart:async';
 
@@ -230,17 +227,15 @@
 ''');
   }
 
-  test_addLibraryImports_package_hasImports_between() {
-    resolveTestUnit('''
+  test_addLibraryImports_package_hasImports_between() async {
+    await resolveTestUnit('''
 import 'package:aaa/aaa.dart';
 import 'package:ddd/ddd.dart';
 ''');
-    LibraryElement newLibrary1 =
-        _mockLibraryElement('/lib/bbb.dart', 'package:bbb/bbb.dart');
-    LibraryElement newLibrary2 =
-        _mockLibraryElement('/lib/ccc.dart', 'package:ccc/ccc.dart');
+    Source newLibrary1 = _getSource('/lib/bbb.dart', 'package:bbb/bbb.dart');
+    Source newLibrary2 = _getSource('/lib/ccc.dart', 'package:ccc/ccc.dart');
     _assertAddLibraryImport(
-        <LibraryElement>[newLibrary1, newLibrary2],
+        <Source>[newLibrary1, newLibrary2],
         '''
 import 'package:aaa/aaa.dart';
 import 'package:bbb/bbb.dart';
@@ -249,8 +244,7 @@
 ''');
   }
 
-  void _assertAddLibraryImport(
-      List<LibraryElement> newLibraries, String expectedCode) {
+  void _assertAddLibraryImport(List<Source> newLibraries, String expectedCode) {
     SourceChange change = new SourceChange('');
     addLibraryImports(change, testLibraryElement, newLibraries.toSet());
     SourceFileEdit testEdit = change.getFileEdit(testFile);
@@ -259,27 +253,16 @@
     expect(resultCode, expectedCode);
   }
 
-  LibraryElement _getDartLibrary(String uri) {
+  Source _getDartSource(String uri) {
     String path = removeStart(uri, 'dart:');
-    Source newSource = new _SourceMock('/sdk/lib/$path.dart', Uri.parse(uri));
-    return new _LibraryElementMock(newSource);
+    return new _SourceMock('/sdk/lib/$path.dart', Uri.parse(uri));
   }
 
-  LibraryElement _mockLibraryElement(String path, String uri) {
-    Source newSource = new _SourceMock(path, Uri.parse(uri));
-    return new _LibraryElementMock(newSource);
+  Source _getSource(String path, String uri) {
+    return new _SourceMock(path, Uri.parse(uri));
   }
 }
 
-class _LibraryElementMock implements LibraryElement {
-  @override
-  final Source source;
-
-  _LibraryElementMock(this.source);
-
-  noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
-}
-
 class _SourceMock implements Source {
   @override
   final String fullName;
diff --git a/pkg/analysis_server/test/services/dependencies/reachable_source_collector_test.dart b/pkg/analysis_server/test/services/dependencies/reachable_source_collector_test.dart
index 23eaf32..a854280 100644
--- a/pkg/analysis_server/test/services/dependencies/reachable_source_collector_test.dart
+++ b/pkg/analysis_server/test/services/dependencies/reachable_source_collector_test.dart
@@ -5,7 +5,6 @@
 library test.services.dependencies.import_collector;
 
 import 'package:analysis_server/src/services/dependencies/reachable_source_collector.dart';
-import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -20,9 +19,6 @@
 
 @reflectiveTest
 class ReachableSourceCollectorTest extends AbstractContextTest {
-  CompilationUnit addLibrary(String path, String contents) =>
-      resolveLibraryUnit(addSource(path, contents));
-
   Map<String, List<String>> importsFor(Source source) =>
       new ReachableSourceCollector(source, context).collectSources();
 
diff --git a/pkg/analysis_server/test/services/index/index_test.dart b/pkg/analysis_server/test/services/index/index_test.dart
index 2d78865..14aae6d 100644
--- a/pkg/analysis_server/test/services/index/index_test.dart
+++ b/pkg/analysis_server/test/services/index/index_test.dart
@@ -2,6 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import 'dart:async';
+
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -79,7 +81,7 @@
   }
 
   test_getDefinedNames_classMember() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   test() {}
 }
@@ -100,7 +102,7 @@
   }
 
   test_getDefinedNames_topLevel() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {} // A
 class B = Object with A;
 typedef C();
@@ -124,7 +126,7 @@
   }
 
   test_getDefinedNames_topLevel2() async {
-    _indexTestUnit(
+    await _indexTestUnit(
         '''
 class A {} // A
 class B = Object with A;
@@ -141,11 +143,11 @@
   }
 
   test_getRelations_isExtendedBy() async {
-    _indexTestUnit(r'''
+    await _indexTestUnit(r'''
 class A {}
 class B extends A {} // B
 ''');
-    Source source2 = _indexUnit(
+    Source source2 = await _indexUnit(
         '/test2.dart',
         r'''
 import 'test.dart';
@@ -159,7 +161,7 @@
   }
 
   test_getRelations_isReferencedBy() async {
-    _indexTestUnit(r'''
+    await _indexTestUnit(r'''
 main(int a, int b) {
 }
 ''');
@@ -171,7 +173,7 @@
   }
 
   test_getUnresolvedMemberReferences_qualified_resolved() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   var test; // A
 }
@@ -188,7 +190,7 @@
   }
 
   test_getUnresolvedMemberReferences_qualified_unresolved() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   var test; // A
 }
@@ -210,7 +212,7 @@
   }
 
   test_getUnresolvedMemberReferences_unqualified_resolved() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   var test;
   m() {
@@ -228,7 +230,7 @@
 
   test_getUnresolvedMemberReferences_unqualified_unresolved() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   m() {
     print(test);
@@ -249,7 +251,7 @@
   }
 
   test_indexDeclarations_afterIndexUnit() async {
-    resolveTestUnit('''
+    await resolveTestUnit('''
 var a = 0;
 var b = a + 1;
 ''');
@@ -275,13 +277,13 @@
   }
 
   test_indexDeclarations_nullUnitElement() async {
-    resolveTestUnit('');
+    await resolveTestUnit('');
     testUnit.element = null;
     index.indexDeclarations(testUnit);
   }
 
   test_indexUnit_nullLibraryElement() async {
-    resolveTestUnit('');
+    await resolveTestUnit('');
     CompilationUnitElement unitElement = new _CompilationUnitElementMock();
     expect(unitElement.library, isNull);
     testUnit.element = unitElement;
@@ -293,13 +295,13 @@
   }
 
   test_indexUnit_nullUnitElement() async {
-    resolveTestUnit('');
+    await resolveTestUnit('');
     testUnit.element = null;
     index.indexUnit(testUnit);
   }
 
   test_removeContext() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {}
 ''');
     RegExp regExp = new RegExp(r'^A$');
@@ -315,8 +317,8 @@
     RegExp regExp = new RegExp(r'^[AB]$');
     Source sourceA = addSource('/a.dart', 'class A {}');
     Source sourceB = addSource('/b.dart', 'class B {}');
-    CompilationUnit unitA = resolveLibraryUnit(sourceA);
-    CompilationUnit unitB = resolveLibraryUnit(sourceB);
+    CompilationUnit unitA = await resolveLibraryUnit(sourceA);
+    CompilationUnit unitB = await resolveLibraryUnit(sourceB);
     index.indexUnit(unitA);
     index.indexUnit(unitB);
     {
@@ -356,8 +358,8 @@
         '${locations.join('\n')}');
   }
 
-  void _indexTestUnit(String code, {bool declOnly: false}) {
-    resolveTestUnit(code);
+  Future<Null> _indexTestUnit(String code, {bool declOnly: false}) async {
+    await resolveTestUnit(code);
     if (declOnly) {
       index.indexDeclarations(testUnit);
     } else {
@@ -365,9 +367,9 @@
     }
   }
 
-  Source _indexUnit(String path, String code) {
+  Future<Source> _indexUnit(String path, String code) async {
     Source source = addSource(path, code);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     index.indexUnit(unit);
     return source;
   }
diff --git a/pkg/analysis_server/test/services/index/index_unit_test.dart b/pkg/analysis_server/test/services/index/index_unit_test.dart
index 046bdfa..c225411 100644
--- a/pkg/analysis_server/test/services/index/index_unit_test.dart
+++ b/pkg/analysis_server/test/services/index/index_unit_test.dart
@@ -2,6 +2,7 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import 'dart:async';
 import 'dart:convert';
 
 import 'package:analysis_server/src/services/index/index_unit.dart';
@@ -55,99 +56,99 @@
     return imports[index].importedLibrary.definingCompilationUnit;
   }
 
-  void test_definedName_classMember_field() {
-    _indexTestUnit('''
+  test_definedName_classMember_field() async {
+    await _indexTestUnit('''
 class A {
   int f;
 }''');
     _assertDefinedName('f', IndexNameKind.classMember, 'f;');
   }
 
-  void test_definedName_classMember_getter() {
-    _indexTestUnit('''
+  test_definedName_classMember_getter() async {
+    await _indexTestUnit('''
 class A {
   int get g => 0;
 }''');
     _assertDefinedName('g', IndexNameKind.classMember, 'g => 0;');
   }
 
-  void test_definedName_classMember_method() {
-    _indexTestUnit('''
+  test_definedName_classMember_method() async {
+    await _indexTestUnit('''
 class A {
   m() {}
 }''');
     _assertDefinedName('m', IndexNameKind.classMember, 'm() {}');
   }
 
-  void test_definedName_classMember_operator() {
-    _indexTestUnit('''
+  test_definedName_classMember_operator() async {
+    await _indexTestUnit('''
 class A {
   operator +(o) {}
 }''');
     _assertDefinedName('+', IndexNameKind.classMember, '+(o) {}');
   }
 
-  void test_definedName_classMember_setter() {
-    _indexTestUnit('''
+  test_definedName_classMember_setter() async {
+    await _indexTestUnit('''
 class A {
   int set s (_) {}
 }''');
     _assertDefinedName('s', IndexNameKind.classMember, 's (_) {}');
   }
 
-  void test_definedName_topLevel_class() {
-    _indexTestUnit('class A {}');
+  test_definedName_topLevel_class() async {
+    await _indexTestUnit('class A {}');
     _assertDefinedName('A', IndexNameKind.topLevel, 'A {}');
   }
 
-  void test_definedName_topLevel_class2() {
-    _indexTestUnit('class A {}', declOnly: true);
+  test_definedName_topLevel_class2() async {
+    await _indexTestUnit('class A {}', declOnly: true);
     _assertDefinedName('A', IndexNameKind.topLevel, 'A {}');
   }
 
-  void test_definedName_topLevel_classAlias() {
-    _indexTestUnit('''
+  test_definedName_topLevel_classAlias() async {
+    await _indexTestUnit('''
 class M {}
 class C = Object with M;''');
     _assertDefinedName('C', IndexNameKind.topLevel, 'C =');
   }
 
-  void test_definedName_topLevel_enum() {
-    _indexTestUnit('enum E {a, b, c}');
+  test_definedName_topLevel_enum() async {
+    await _indexTestUnit('enum E {a, b, c}');
     _assertDefinedName('E', IndexNameKind.topLevel, 'E {');
   }
 
-  void test_definedName_topLevel_function() {
-    _indexTestUnit('foo() {}');
+  test_definedName_topLevel_function() async {
+    await _indexTestUnit('foo() {}');
     _assertDefinedName('foo', IndexNameKind.topLevel, 'foo() {}');
   }
 
-  void test_definedName_topLevel_functionTypeAlias() {
-    _indexTestUnit('typedef F(int p);');
+  test_definedName_topLevel_functionTypeAlias() async {
+    await _indexTestUnit('typedef F(int p);');
     _assertDefinedName('F', IndexNameKind.topLevel, 'F(int p);');
   }
 
-  void test_definedName_topLevel_getter() {
-    _indexTestUnit('''
+  test_definedName_topLevel_getter() async {
+    await _indexTestUnit('''
 int get g => 0;
 ''');
     _assertDefinedName('g', IndexNameKind.topLevel, 'g => 0;');
   }
 
-  void test_definedName_topLevel_setter() {
-    _indexTestUnit('''
+  test_definedName_topLevel_setter() async {
+    await _indexTestUnit('''
 int set s (_) {}
 ''');
     _assertDefinedName('s', IndexNameKind.topLevel, 's (_) {}');
   }
 
-  void test_definedName_topLevel_topLevelVariable() {
-    _indexTestUnit('var V = 42;');
+  test_definedName_topLevel_topLevelVariable() async {
+    await _indexTestUnit('var V = 42;');
     _assertDefinedName('V', IndexNameKind.topLevel, 'V = 42;');
   }
 
-  void test_hasAncestor_ClassDeclaration() {
-    _indexTestUnit('''
+  test_hasAncestor_ClassDeclaration() async {
+    await _indexTestUnit('''
 class A {}
 class B1 extends A {}
 class B2 implements A {}
@@ -168,8 +169,8 @@
       ..isAncestorOf('M extends Object with A');
   }
 
-  void test_hasAncestor_ClassTypeAlias() {
-    _indexTestUnit('''
+  test_hasAncestor_ClassTypeAlias() async {
+    await _indexTestUnit('''
 class A {}
 class B extends A {}
 class C1 = Object with A;
@@ -183,8 +184,8 @@
     assertThat(classElementB)..isAncestorOf('C2 = Object with B');
   }
 
-  void test_isExtendedBy_ClassDeclaration() {
-    _indexTestUnit('''
+  test_isExtendedBy_ClassDeclaration() async {
+    await _indexTestUnit('''
 class A {} // 1
 class B extends A {} // 2
 ''');
@@ -194,13 +195,13 @@
       ..isReferencedAt('A {} // 2', false);
   }
 
-  void test_isExtendedBy_ClassDeclaration_isQualified() {
+  test_isExtendedBy_ClassDeclaration_isQualified() async {
     addSource(
         '/lib.dart',
         '''
 class A {}
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart' as p;
 class B extends p.A {} // 2
 ''');
@@ -208,8 +209,8 @@
     assertThat(elementA).isExtendedAt('A {} // 2', true);
   }
 
-  void test_isExtendedBy_ClassDeclaration_Object() {
-    _indexTestUnit('''
+  test_isExtendedBy_ClassDeclaration_Object() async {
+    await _indexTestUnit('''
 class A {}
 ''');
     ClassElement elementA = findElement('A');
@@ -217,8 +218,8 @@
     assertThat(elementObject).isExtendedAt('A {}', true, length: 0);
   }
 
-  void test_isExtendedBy_ClassTypeAlias() {
-    _indexTestUnit('''
+  test_isExtendedBy_ClassTypeAlias() async {
+    await _indexTestUnit('''
 class A {}
 class B {}
 class C = A with B;
@@ -229,13 +230,13 @@
       ..isReferencedAt('A with', false);
   }
 
-  void test_isExtendedBy_ClassTypeAlias_isQualified() {
+  test_isExtendedBy_ClassTypeAlias_isQualified() async {
     addSource(
         '/lib.dart',
         '''
 class A {}
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart' as p;
 class B {}
 class C = p.A with B;
@@ -246,8 +247,8 @@
       ..isReferencedAt('A with', true);
   }
 
-  void test_isImplementedBy_ClassDeclaration() {
-    _indexTestUnit('''
+  test_isImplementedBy_ClassDeclaration() async {
+    await _indexTestUnit('''
 class A {} // 1
 class B implements A {} // 2
 ''');
@@ -257,13 +258,13 @@
       ..isReferencedAt('A {} // 2', false);
   }
 
-  void test_isImplementedBy_ClassDeclaration_isQualified() {
+  test_isImplementedBy_ClassDeclaration_isQualified() async {
     addSource(
         '/lib.dart',
         '''
 class A {}
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart' as p;
 class B implements p.A {} // 2
 ''');
@@ -273,8 +274,8 @@
       ..isReferencedAt('A {} // 2', true);
   }
 
-  void test_isImplementedBy_ClassTypeAlias() {
-    _indexTestUnit('''
+  test_isImplementedBy_ClassTypeAlias() async {
+    await _indexTestUnit('''
 class A {} // 1
 class B {} // 2
 class C = Object with A implements B; // 3
@@ -285,8 +286,8 @@
       ..isReferencedAt('B; // 3', false);
   }
 
-  void test_isInvokedBy_FieldElement() {
-    _indexTestUnit('''
+  test_isInvokedBy_FieldElement() async {
+    await _indexTestUnit('''
 class A {
   var field;
   main() {
@@ -300,14 +301,14 @@
       ..isInvokedAt('field(); // nq', false);
   }
 
-  void test_isInvokedBy_FunctionElement() {
+  test_isInvokedBy_FunctionElement() async {
     addSource(
         '/lib.dart',
         '''
 library lib;
 foo() {}
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart';
 import 'lib.dart' as pref;
 main() {
@@ -320,9 +321,9 @@
       ..isInvokedAt('foo(); // nq', false);
   }
 
-  void test_isInvokedBy_FunctionElement_synthetic_loadLibrary() {
+  test_isInvokedBy_FunctionElement_synthetic_loadLibrary() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'dart:math' deferred as math;
 main() {
   math.loadLibrary(); // 1
@@ -335,8 +336,8 @@
     assertThat(element).isInvokedAt('loadLibrary(); // 2', true);
   }
 
-  void test_isInvokedBy_MethodElement() {
-    _indexTestUnit('''
+  test_isInvokedBy_MethodElement() async {
+    await _indexTestUnit('''
 class A {
   foo() {}
   main() {
@@ -350,8 +351,8 @@
       ..isInvokedAt('foo(); // nq', false);
   }
 
-  void test_isInvokedBy_MethodElement_propagatedType() {
-    _indexTestUnit('''
+  test_isInvokedBy_MethodElement_propagatedType() async {
+    await _indexTestUnit('''
 class A {
   foo() {}
 }
@@ -364,8 +365,8 @@
     assertThat(element).isInvokedAt('foo();', true);
   }
 
-  void test_isInvokedBy_operator_binary() {
-    _indexTestUnit('''
+  test_isInvokedBy_operator_binary() async {
+    await _indexTestUnit('''
 class A {
   operator +(other) => this;
 }
@@ -384,8 +385,8 @@
       ..isInvokedAt('++;', true, length: 2);
   }
 
-  void test_isInvokedBy_operator_index() {
-    _indexTestUnit('''
+  test_isInvokedBy_operator_index() async {
+    await _indexTestUnit('''
 class A {
   operator [](i) => null;
   operator []=(i, v) {}
@@ -401,8 +402,8 @@
     assertThat(writeElement).isInvokedAt('[1]', true, length: 1);
   }
 
-  void test_isInvokedBy_operator_prefix() {
-    _indexTestUnit('''
+  test_isInvokedBy_operator_prefix() async {
+    await _indexTestUnit('''
 class A {
   A operator ~() => this;
 }
@@ -414,8 +415,8 @@
     assertThat(element).isInvokedAt('~a', true, length: 1);
   }
 
-  void test_isInvokedBy_PropertyAccessorElement_getter() {
-    _indexTestUnit('''
+  test_isInvokedBy_PropertyAccessorElement_getter() async {
+    await _indexTestUnit('''
 class A {
   get ggg => null;
   main() {
@@ -429,8 +430,8 @@
       ..isInvokedAt('ggg(); // nq', false);
   }
 
-  void test_isMixedInBy_ClassDeclaration() {
-    _indexTestUnit('''
+  test_isMixedInBy_ClassDeclaration() async {
+    await _indexTestUnit('''
 class A {} // 1
 class B extends Object with A {} // 2
 ''');
@@ -440,13 +441,13 @@
       ..isReferencedAt('A {} // 2', false);
   }
 
-  void test_isMixedInBy_ClassDeclaration_isQualified() {
+  test_isMixedInBy_ClassDeclaration_isQualified() async {
     addSource(
         '/lib.dart',
         '''
 class A {}
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart' as p;
 class B extends Object with p.A {} // 2
 ''');
@@ -454,8 +455,8 @@
     assertThat(elementA).isMixedInAt('A {} // 2', true);
   }
 
-  void test_isMixedInBy_ClassTypeAlias() {
-    _indexTestUnit('''
+  test_isMixedInBy_ClassTypeAlias() async {
+    await _indexTestUnit('''
 class A {} // 1
 class B = Object with A; // 2
 ''');
@@ -463,8 +464,8 @@
     assertThat(elementA).isMixedInAt('A; // 2', false);
   }
 
-  void test_isReferencedBy_ClassElement() {
-    _indexTestUnit('''
+  test_isReferencedBy_ClassElement() async {
+    await _indexTestUnit('''
 class A {
   static var field;
 }
@@ -484,9 +485,9 @@
       ..isReferencedAt('A.field); // 3', false);
   }
 
-  void test_isReferencedBy_ClassElement_invocation() {
+  test_isReferencedBy_ClassElement_invocation() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {}
 main() {
   A(); // invalid code, but still a reference
@@ -495,14 +496,14 @@
     assertThat(element).isReferencedAt('A();', false);
   }
 
-  void test_isReferencedBy_ClassElement_invocation_isQualified() {
+  test_isReferencedBy_ClassElement_invocation_isQualified() async {
     verifyNoTestUnitErrors = false;
     addSource(
         '/lib.dart',
         '''
 class A {}
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart' as p;
 main() {
   p.A(); // invalid code, but still a reference
@@ -511,8 +512,8 @@
     assertThat(element).isReferencedAt('A();', true);
   }
 
-  void test_isReferencedBy_ClassTypeAlias() {
-    _indexTestUnit('''
+  test_isReferencedBy_ClassTypeAlias() async {
+    await _indexTestUnit('''
 class A {}
 class B = Object with A;
 main(B p) {
@@ -525,35 +526,35 @@
       ..isReferencedAt('B v;', false);
   }
 
-  void test_isReferencedBy_CompilationUnitElement_export() {
+  test_isReferencedBy_CompilationUnitElement_export() async {
     addSource(
         '/lib.dart',
         '''
 library lib;
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 export 'lib.dart';
 ''');
     LibraryElement element = testLibraryElement.exports[0].exportedLibrary;
     assertThat(element)..isReferencedAt("'lib.dart'", true, length: 10);
   }
 
-  void test_isReferencedBy_CompilationUnitElement_import() {
+  test_isReferencedBy_CompilationUnitElement_import() async {
     addSource(
         '/lib.dart',
         '''
 library lib;
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart';
 ''');
     LibraryElement element = testLibraryElement.imports[0].importedLibrary;
     assertThat(element)..isReferencedAt("'lib.dart'", true, length: 10);
   }
 
-  void test_isReferencedBy_CompilationUnitElement_part() {
+  test_isReferencedBy_CompilationUnitElement_part() async {
     addSource('/my_unit.dart', 'part of my_lib;');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 library my_lib;
 part 'my_unit.dart';
 ''');
@@ -561,8 +562,8 @@
     assertThat(element)..isReferencedAt("'my_unit.dart';", true, length: 14);
   }
 
-  void test_isReferencedBy_ConstructorElement() {
-    _indexTestUnit('''
+  test_isReferencedBy_ConstructorElement() async {
+    await _indexTestUnit('''
 class A implements B {
   A() {}
   A.foo() {}
@@ -593,8 +594,8 @@
       ..isReferencedAt('.foo(); // 5', true, length: 4);
   }
 
-  void test_isReferencedBy_ConstructorElement_classTypeAlias() {
-    _indexTestUnit('''
+  test_isReferencedBy_ConstructorElement_classTypeAlias() async {
+    await _indexTestUnit('''
 class M {}
 class A implements B {
   A() {}
@@ -620,8 +621,8 @@
       ..isReferencedAt('.named(); // C2', true, length: 6);
   }
 
-  void test_isReferencedBy_ConstructorElement_classTypeAlias_cycle() {
-    _indexTestUnit('''
+  test_isReferencedBy_ConstructorElement_classTypeAlias_cycle() async {
+    await _indexTestUnit('''
 class M {}
 class A = B with M;
 class B = A with M;
@@ -633,8 +634,8 @@
     // No additional validation, but it should not fail with stack overflow.
   }
 
-  void test_isReferencedBy_ConstructorElement_namedOnlyWithDot() {
-    _indexTestUnit('''
+  test_isReferencedBy_ConstructorElement_namedOnlyWithDot() async {
+    await _indexTestUnit('''
 class A {
   A.named() {}
 }
@@ -649,8 +650,8 @@
     expect(unitIndex.usedElementOffsets, contains(offsetWithDot));
   }
 
-  void test_isReferencedBy_ConstructorElement_redirection() {
-    _indexTestUnit('''
+  test_isReferencedBy_ConstructorElement_redirection() async {
+    await _indexTestUnit('''
 class A {
   A() : this.bar(); // 1
   A.foo() : this(); // 2
@@ -664,8 +665,8 @@
     assertThat(constA_bar).isReferencedAt('.bar(); // 1', true, length: 4);
   }
 
-  void test_isReferencedBy_ConstructorElement_synthetic() {
-    _indexTestUnit('''
+  test_isReferencedBy_ConstructorElement_synthetic() async {
+    await _indexTestUnit('''
 class A {}
 main() {
   new A(); // 1
@@ -677,15 +678,15 @@
     assertThat(constA)..isReferencedAt('(); // 1', true, length: 0);
   }
 
-  void test_isReferencedBy_DynamicElement() {
-    _indexTestUnit('''
+  test_isReferencedBy_DynamicElement() async {
+    await _indexTestUnit('''
 dynamic f() {
 }''');
     expect(unitIndex.usedElementOffsets, isEmpty);
   }
 
-  void test_isReferencedBy_FieldElement() {
-    _indexTestUnit('''
+  test_isReferencedBy_FieldElement() async {
+    await _indexTestUnit('''
 class A {
   var field;
   A({this.field});
@@ -714,8 +715,8 @@
     assertThat(field)..isReferencedAt('field: 4', true);
   }
 
-  void test_isReferencedBy_FieldElement_multiple() {
-    _indexTestUnit('''
+  test_isReferencedBy_FieldElement_multiple() async {
+    await _indexTestUnit('''
 class A {
   var aaa;
   var bbb;
@@ -748,9 +749,9 @@
     }
   }
 
-  void test_isReferencedBy_FieldElement_ofEnum() {
+  test_isReferencedBy_FieldElement_ofEnum() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 enum MyEnum {
   A, B, C
 }
@@ -769,9 +770,9 @@
     assertThat(enumElement.getGetter('B'))..isReferencedAt('B);', true);
   }
 
-  void test_isReferencedBy_FieldElement_synthetic_hasGetter() {
+  test_isReferencedBy_FieldElement_synthetic_hasGetter() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   A() : f = 42;
   int get f => 0;
@@ -781,9 +782,9 @@
     assertThat(element2.getField('f')).isWrittenAt('f = 42', true);
   }
 
-  void test_isReferencedBy_FieldElement_synthetic_hasGetterSetter() {
+  test_isReferencedBy_FieldElement_synthetic_hasGetterSetter() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   A() : f = 42;
   int get f => 0;
@@ -794,9 +795,9 @@
     assertThat(element2.getField('f')).isWrittenAt('f = 42', true);
   }
 
-  void test_isReferencedBy_FieldElement_synthetic_hasSetter() {
+  test_isReferencedBy_FieldElement_synthetic_hasSetter() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   A() : f = 42;
   set f(_) {}
@@ -806,8 +807,8 @@
     assertThat(element2.getField('f')).isWrittenAt('f = 42', true);
   }
 
-  void test_isReferencedBy_FunctionElement() {
-    _indexTestUnit('''
+  test_isReferencedBy_FunctionElement() async {
+    await _indexTestUnit('''
 foo() {}
 main() {
   print(foo);
@@ -820,13 +821,13 @@
       ..isInvokedAt('foo());', false);
   }
 
-  void test_isReferencedBy_FunctionElement_with_LibraryElement() {
+  test_isReferencedBy_FunctionElement_with_LibraryElement() async {
     addSource(
         '/foo.dart',
         r'''
 bar() {}
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import "foo.dart";
 main() {
   bar();
@@ -840,8 +841,8 @@
     }
   }
 
-  void test_isReferencedBy_FunctionTypeAliasElement() {
-    _indexTestUnit('''
+  test_isReferencedBy_FunctionTypeAliasElement() async {
+    await _indexTestUnit('''
 typedef A();
 main(A p) {
 }
@@ -857,8 +858,8 @@
    * This caused duplicate indexing.
    * Here we test that the problem is fixed one way or another.
    */
-  void test_isReferencedBy_identifierInComment() {
-    _indexTestUnit('''
+  test_isReferencedBy_identifierInComment() async {
+    await _indexTestUnit('''
 class A {}
 /// [A] text
 var myVariable = null;
@@ -867,8 +868,8 @@
     assertThat(element)..isReferencedAt('A] text', false);
   }
 
-  void test_isReferencedBy_MethodElement() {
-    _indexTestUnit('''
+  test_isReferencedBy_MethodElement() async {
+    await _indexTestUnit('''
 class A {
   method() {}
   main() {
@@ -882,8 +883,8 @@
       ..isReferencedAt('method); // nq', false);
   }
 
-  void test_isReferencedBy_ParameterElement() {
-    _indexTestUnit('''
+  test_isReferencedBy_ParameterElement() async {
+    await _indexTestUnit('''
 foo({var p}) {}
 main() {
   foo(p: 1);
@@ -893,14 +894,14 @@
     assertThat(element)..isReferencedAt('p: 1', true);
   }
 
-  void test_isReferencedBy_TopLevelVariableElement() {
+  test_isReferencedBy_TopLevelVariableElement() async {
     addSource(
         '/lib.dart',
         '''
 library lib;
 var V;
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart' show V; // imp
 import 'lib.dart' as pref;
 main() {
@@ -919,7 +920,7 @@
       ..isReferencedAt('V = 5; // nq', false);
   }
 
-  void test_isReferencedBy_TopLevelVariableElement_synthetic_hasGetterSetter() {
+  test_isReferencedBy_TopLevelVariableElement_synthetic_hasGetterSetter() async {
     verifyNoTestUnitErrors = false;
     addSource(
         '/lib.dart',
@@ -927,29 +928,29 @@
 int get V => 0;
 void set V(_) {}
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart' show V;
 ''');
     TopLevelVariableElement element = importedUnit().topLevelVariables[0];
     assertThat(element).isReferencedAt('V;', true);
   }
 
-  void test_isReferencedBy_TopLevelVariableElement_synthetic_hasSetter() {
+  test_isReferencedBy_TopLevelVariableElement_synthetic_hasSetter() async {
     verifyNoTestUnitErrors = false;
     addSource(
         '/lib.dart',
         '''
 void set V(_) {}
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart' show V;
 ''');
     TopLevelVariableElement element = importedUnit().topLevelVariables[0];
     assertThat(element).isReferencedAt('V;', true);
   }
 
-  void test_isReferencedBy_typeInVariableList() {
-    _indexTestUnit('''
+  test_isReferencedBy_typeInVariableList() async {
+    await _indexTestUnit('''
 class A {}
 A myVariable = null;
 ''');
@@ -957,8 +958,8 @@
     assertThat(element).isReferencedAt('A myVariable', false);
   }
 
-  void test_isWrittenBy_FieldElement() {
-    _indexTestUnit('''
+  test_isWrittenBy_FieldElement() async {
+    await _indexTestUnit('''
 class A {
   int field;
   A.foo({this.field});
@@ -971,9 +972,9 @@
       ..isWrittenAt('field = 5', true);
   }
 
-  void test_usedName_inLibraryIdentifier() {
+  test_usedName_inLibraryIdentifier() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 library aaa.bbb.ccc;
 class C {
   var bbb;
@@ -987,9 +988,9 @@
       ..isUsedQ('bbb = 1;', IndexRelationKind.IS_WRITTEN_BY);
   }
 
-  void test_usedName_qualified_resolved() {
+  test_usedName_qualified_resolved() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class C {
   var x;
 }
@@ -1007,9 +1008,9 @@
       ..isNotUsedQ('x();', IndexRelationKind.IS_INVOKED_BY);
   }
 
-  void test_usedName_qualified_unresolved() {
+  test_usedName_qualified_unresolved() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 main(p) {
   p.x;
   p.x = 1;
@@ -1024,9 +1025,9 @@
       ..isUsedQ('x();', IndexRelationKind.IS_INVOKED_BY);
   }
 
-  void test_usedName_unqualified_resolved() {
+  test_usedName_unqualified_resolved() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class C {
   var x;
   m() {
@@ -1044,9 +1045,9 @@
       ..isNotUsedQ('x();', IndexRelationKind.IS_INVOKED_BY);
   }
 
-  void test_usedName_unqualified_unresolved() {
+  test_usedName_unqualified_unresolved() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 main() {
   x;
   x = 1;
@@ -1217,8 +1218,8 @@
     return _getStringId(str);
   }
 
-  void _indexTestUnit(String code, {bool declOnly: false}) {
-    resolveTestUnit(code);
+  Future<Null> _indexTestUnit(String code, {bool declOnly: false}) async {
+    await resolveTestUnit(code);
     PackageIndexAssembler assembler = new PackageIndexAssembler();
     if (declOnly) {
       assembler.indexDeclarations(testUnit);
diff --git a/pkg/analysis_server/test/services/linter/linter_test.dart b/pkg/analysis_server/test/services/linter/linter_test.dart
index 5ac13392..f0dd92d 100644
--- a/pkg/analysis_server/test/services/linter/linter_test.dart
+++ b/pkg/analysis_server/test/services/linter/linter_test.dart
@@ -4,11 +4,12 @@
 
 library test.services.linter;
 
-import 'package:analysis_server/src/services/linter/linter.dart';
 import 'package:analyzer/analyzer.dart';
 import 'package:analyzer/source/analysis_options_provider.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/lint/options_rule_validator.dart';
+import 'package:linter/src/rules.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -29,6 +30,7 @@
   List<AnalysisError> get errors => recorder.errors;
 
   setUp() {
+    registerLintRules();
     recorder = new RecordingErrorListener();
     reporter = new ErrorReporter(recorder, new _TestSource());
   }
diff --git a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
index 2ee99d1..a57c988 100644
--- a/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
+++ b/pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart
@@ -6,12 +6,21 @@
 
 import 'dart:async';
 
-import 'package:analysis_server/plugin/protocol/protocol.dart';
+import 'package:analysis_server/plugin/protocol/protocol.dart'
+    show
+        RefactoringProblem,
+        RefactoringProblemSeverity,
+        SourceChange,
+        SourceEdit,
+        SourceFileEdit;
 import 'package:analysis_server/src/services/correction/status.dart';
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
+import 'package:analysis_server/src/services/search/search_engine.dart';
 import 'package:analysis_server/src/services/search/search_engine_internal.dart';
+import 'package:analysis_server/src/services/search/search_engine_internal2.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart' show Element;
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:test/test.dart';
@@ -37,7 +46,7 @@
  */
 abstract class RefactoringTest extends AbstractSingleUnitTest {
   Index index;
-  SearchEngineImpl searchEngine;
+  SearchEngine searchEngine;
 
   SourceChange refactoringChange;
 
@@ -53,8 +62,7 @@
     expect(fileEdit, isNotNull, reason: 'No file edit for $path');
     // validate resulting code
     File file = provider.getResource(path);
-    Source source = file.createSource();
-    String ini = context.getContents(source).data;
+    String ini = file.readAsStringSync();
     String actualCode = SourceEdit.applySequence(ini, fileEdit.edits);
     expect(actualCode, expectedCode);
   }
@@ -145,20 +153,36 @@
     expect(actualCode, expectedCode);
   }
 
-  void indexTestUnit(String code) {
-    resolveTestUnit(code);
-    index.indexUnit(testUnit);
+  /**
+   * Completes with a fully resolved unit that contains the [element].
+   */
+  Future<CompilationUnit> getResolvedUnitWithElement(Element element) async {
+    return element.context
+        .resolveCompilationUnit(element.source, element.library);
   }
 
-  void indexUnit(String file, String code) {
+  Future<Null> indexTestUnit(String code) async {
+    await resolveTestUnit(code);
+    if (!enableNewAnalysisDriver) {
+      index.indexUnit(testUnit);
+    }
+  }
+
+  Future<Null> indexUnit(String file, String code) async {
     Source source = addSource(file, code);
-    CompilationUnit unit = resolveLibraryUnit(source);
-    index.indexUnit(unit);
+    if (!enableNewAnalysisDriver) {
+      CompilationUnit unit = await resolveLibraryUnit(source);
+      index.indexUnit(unit);
+    }
   }
 
   void setUp() {
     super.setUp();
-    index = createMemoryIndex();
-    searchEngine = new SearchEngineImpl(index);
+    if (enableNewAnalysisDriver) {
+      searchEngine = new SearchEngineImpl2([driver]);
+    } else {
+      index = createMemoryIndex();
+      searchEngine = new SearchEngineImpl(index);
+    }
   }
 }
diff --git a/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart b/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart
index 9b74f44..9fb67da 100644
--- a/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/convert_getter_to_method_test.dart
@@ -17,6 +17,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(ConvertGetterToMethodTest);
+    defineReflectiveTests(ConvertGetterToMethodTest_Driver);
   });
 }
 
@@ -24,8 +25,8 @@
 class ConvertGetterToMethodTest extends RefactoringTest {
   ConvertGetterToMethodRefactoring refactoring;
 
-  test_change_function() {
-    indexTestUnit('''
+  test_change_function() async {
+    await indexTestUnit('''
 int get test => 42;
 main() {
   var a = test;
@@ -43,8 +44,8 @@
 ''');
   }
 
-  test_change_method() {
-    indexTestUnit('''
+  test_change_method() async {
+    await indexTestUnit('''
 class A {
   int get test => 1;
 }
@@ -88,15 +89,15 @@
 ''');
   }
 
-  test_change_multipleFiles() {
-    indexUnit(
+  test_change_multipleFiles() async {
+    await indexUnit(
         '/other.dart',
         r'''
 class A {
   int get test => 1;
 }
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 import 'other.dart';
 class B extends A {
   int get test => 2;
@@ -120,8 +121,8 @@
 ''');
   }
 
-  test_checkInitialConditions_syntheticGetter() {
-    indexTestUnit('''
+  test_checkInitialConditions_syntheticGetter() async {
+    await indexTestUnit('''
 int test = 42;
 main() {
 }
@@ -164,3 +165,9 @@
     _createRefactoringForElement(element);
   }
 }
+
+@reflectiveTest
+class ConvertGetterToMethodTest_Driver extends ConvertGetterToMethodTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart b/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart
index accf182..313fe30 100644
--- a/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/convert_method_to_getter_test.dart
@@ -6,7 +6,8 @@
 
 import 'dart:async';
 
-import 'package:analysis_server/plugin/protocol/protocol.dart' hide ElementKind;
+import 'package:analysis_server/plugin/protocol/protocol.dart'
+    show RefactoringProblemSeverity, SourceChange;
 import 'package:analysis_server/src/services/correction/status.dart';
 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -17,6 +18,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(ConvertMethodToGetterTest);
+    defineReflectiveTests(ConvertMethodToGetterTest_Driver);
   });
 }
 
@@ -24,8 +26,8 @@
 class ConvertMethodToGetterTest extends RefactoringTest {
   ConvertMethodToGetterRefactoring refactoring;
 
-  test_change_function() {
-    indexTestUnit('''
+  test_change_function() async {
+    await indexTestUnit('''
 int test() => 42;
 main() {
   var a = test();
@@ -43,8 +45,8 @@
 ''');
   }
 
-  test_change_method() {
-    indexTestUnit('''
+  test_change_method() async {
+    await indexTestUnit('''
 class A {
   int test() => 1;
 }
@@ -88,15 +90,15 @@
 ''');
   }
 
-  test_change_multipleFiles() {
-    indexUnit(
+  test_change_multipleFiles() async {
+    await indexUnit(
         '/other.dart',
         r'''
 class A {
   int test() => 1;
 }
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 import 'other.dart';
 class B extends A {
   int test() => 2;
@@ -120,8 +122,8 @@
 ''');
   }
 
-  test_checkInitialConditions_alreadyGetter() {
-    indexTestUnit('''
+  test_checkInitialConditions_alreadyGetter() async {
+    await indexTestUnit('''
 int get test => 42;
 main() {
   var a = test;
@@ -135,8 +137,8 @@
         'Only class methods or top-level functions can be converted to getters.');
   }
 
-  test_checkInitialConditions_hasParameters() {
-    indexTestUnit('''
+  test_checkInitialConditions_hasParameters() async {
+    await indexTestUnit('''
 int test(x) => x * 2;
 main() {
   var v = test(1);
@@ -148,8 +150,8 @@
         'Only methods without parameters can be converted to getters.');
   }
 
-  test_checkInitialConditions_localFunction() {
-    indexTestUnit('''
+  test_checkInitialConditions_localFunction() async {
+    await indexTestUnit('''
 main() {
   test() {}
   var v = test();
@@ -161,8 +163,8 @@
         'Only top-level functions can be converted to getters.');
   }
 
-  test_checkInitialConditions_notFunctionOrMethod() {
-    indexTestUnit('''
+  test_checkInitialConditions_notFunctionOrMethod() async {
+    await indexTestUnit('''
 class A {
   A.test();
 }
@@ -173,8 +175,8 @@
         'Only class methods or top-level functions can be converted to getters.');
   }
 
-  test_checkInitialConditions_returnTypeVoid() {
-    indexTestUnit('''
+  test_checkInitialConditions_returnTypeVoid() async {
+    await indexTestUnit('''
 void test() {}
 ''');
     _createRefactoring('test');
@@ -205,7 +207,8 @@
   }
 
   void _createRefactoringForElement(ExecutableElement element) {
-    refactoring = new ConvertMethodToGetterRefactoring(searchEngine, element);
+    refactoring = new ConvertMethodToGetterRefactoring(
+        searchEngine, getResolvedUnitWithElement, element);
   }
 
   void _createRefactoringForString(String search) {
@@ -213,3 +216,9 @@
     _createRefactoringForElement(element);
   }
 }
+
+@reflectiveTest
+class ConvertMethodToGetterTest_Driver extends ConvertMethodToGetterTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
index 976e77d..9658c09 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
@@ -19,6 +19,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(ExtractLocalTest);
+    defineReflectiveTests(ExtractLocalTest_Driver);
   });
 }
 
@@ -27,7 +28,7 @@
   ExtractLocalRefactoringImpl refactoring;
 
   test_checkFinalConditions_sameVariable_after() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
   var res;
@@ -41,7 +42,7 @@
   }
 
   test_checkFinalConditions_sameVariable_before() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var res;
   int a = 1 + 2;
@@ -55,7 +56,7 @@
   }
 
   test_checkInitialConditions_assignmentLeftHandSize() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var v = 0;
   v = 1;
@@ -69,7 +70,7 @@
   }
 
   test_checkInitialConditions_namePartOfDeclaration_function() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
 }
 ''');
@@ -81,7 +82,7 @@
   }
 
   test_checkInitialConditions_namePartOfDeclaration_variable() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int vvv = 0;
 }
@@ -94,7 +95,7 @@
   }
 
   test_checkInitialConditions_noExpression() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   // abc
 }
@@ -105,7 +106,7 @@
   }
 
   test_checkInitialConditions_notPartOfFunction() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 int a = 1 + 2;
 ''');
     _createRefactoringForString('1 + 2');
@@ -117,7 +118,7 @@
   }
 
   test_checkInitialConditions_stringSelection_leadingQuote() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var vvv = 'abc';
 }
@@ -133,7 +134,7 @@
   }
 
   test_checkInitialConditions_stringSelection_trailingQuote() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var vvv = 'abc';
 }
@@ -149,7 +150,7 @@
   }
 
   test_checkInitialConditions_voidExpression() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   print(42);
 }
@@ -161,8 +162,8 @@
         expectedMessage: 'Cannot extract the void expression.');
   }
 
-  test_checkName() {
-    indexTestUnit('''
+  test_checkName() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
 }
@@ -185,7 +186,7 @@
   }
 
   test_checkName_conflict_withInvokedFunction() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
   res();
@@ -202,7 +203,7 @@
   }
 
   test_checkName_conflict_withOtherLocal() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var res;
   int a = 1 + 2;
@@ -217,7 +218,7 @@
   }
 
   test_checkName_conflict_withTypeName() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
   Res b = null;
@@ -233,8 +234,8 @@
         expectedMessage: "The name 'Res' is already used in the scope.");
   }
 
-  test_completeStatementExpression() {
-    indexTestUnit('''
+  test_completeStatementExpression() async {
+    await indexTestUnit('''
 main(p) {
   p.toString();
 }
@@ -248,8 +249,8 @@
 ''');
   }
 
-  test_const_argument_inConstInstanceCreation() {
-    indexTestUnit('''
+  test_const_argument_inConstInstanceCreation() async {
+    await indexTestUnit('''
 class A {
   const A(int a, int b);
 }
@@ -270,8 +271,8 @@
 ''');
   }
 
-  test_const_inList() {
-    indexTestUnit('''
+  test_const_inList() async {
+    await indexTestUnit('''
 main() {
   const [1, 2];
 }
@@ -286,8 +287,8 @@
 ''');
   }
 
-  test_const_inList_inBinaryExpression() {
-    indexTestUnit('''
+  test_const_inList_inBinaryExpression() async {
+    await indexTestUnit('''
 main() {
   const [1 + 2, 3];
 }
@@ -302,8 +303,8 @@
 ''');
   }
 
-  test_const_inList_inConditionalExpression() {
-    indexTestUnit('''
+  test_const_inList_inConditionalExpression() async {
+    await indexTestUnit('''
 main() {
   const [true ? 1 : 2, 3];
 }
@@ -318,8 +319,8 @@
 ''');
   }
 
-  test_const_inList_inParenthesis() {
-    indexTestUnit('''
+  test_const_inList_inParenthesis() async {
+    await indexTestUnit('''
 main() {
   const [(1), 2];
 }
@@ -334,8 +335,8 @@
 ''');
   }
 
-  test_const_inList_inPrefixExpression() {
-    indexTestUnit('''
+  test_const_inList_inPrefixExpression() async {
+    await indexTestUnit('''
 main() {
   const [!true, 2];
 }
@@ -350,8 +351,8 @@
 ''');
   }
 
-  test_const_inMap_key() {
-    indexTestUnit('''
+  test_const_inMap_key() async {
+    await indexTestUnit('''
 main() {
   const {1: 2};
 }
@@ -366,8 +367,8 @@
 ''');
   }
 
-  test_const_inMap_value() {
-    indexTestUnit('''
+  test_const_inMap_value() async {
+    await indexTestUnit('''
 main() {
   const {1: 2};
 }
@@ -383,7 +384,7 @@
   }
 
   test_coveringExpressions() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int aaa = 1;
   int bbb = 2;
@@ -399,7 +400,7 @@
   }
 
   test_coveringExpressions_inArgumentList() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   foo(111 + 222);
 }
@@ -413,7 +414,7 @@
   }
 
   test_coveringExpressions_inInvocationOfVoidFunction() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   foo(111 + 222);
 }
@@ -427,7 +428,7 @@
   }
 
   test_coveringExpressions_namedExpression_value() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   foo(ppp: 42);
 }
@@ -441,7 +442,7 @@
   }
 
   test_coveringExpressions_skip_assignment() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int v;
   foo(v = 111 + 222);
@@ -456,12 +457,12 @@
   }
 
   test_coveringExpressions_skip_constructorName() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class AAA {
   AAA.name() {}
 }
 main() {
-  int v = new AAA.name();
+  var v = new AAA.name();
 }
 ''');
     _createRefactoring(testCode.indexOf('AA.name();'), 5);
@@ -472,12 +473,12 @@
   }
 
   test_coveringExpressions_skip_constructorName_name() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   A.name() {}
 }
 main() {
-  int v = new A.name();
+  var v = new A.name();
 }
 ''');
     _createRefactoring(testCode.indexOf('ame();'), 0);
@@ -488,10 +489,10 @@
   }
 
   test_coveringExpressions_skip_constructorName_type() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {}
 main() {
-  int v = new A();
+  var v = new A();
 }
 ''');
     _createRefactoring(testCode.indexOf('A();'), 0);
@@ -502,10 +503,10 @@
   }
 
   test_coveringExpressions_skip_constructorName_typeArgument() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A<T> {}
 main() {
-  int v = new A<String>();
+  var v = new A<String>();
 }
 ''');
     _createRefactoring(testCode.indexOf('ring>'), 0);
@@ -516,7 +517,7 @@
   }
 
   test_coveringExpressions_skip_namedExpression() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   foo(ppp: 42);
 }
@@ -529,8 +530,8 @@
     expect(subExpressions, ['foo(ppp: 42)']);
   }
 
-  test_fragmentExpression() {
-    indexTestUnit('''
+  test_fragmentExpression() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2 + 3 + 4;
 }
@@ -545,8 +546,8 @@
 ''');
   }
 
-  test_fragmentExpression_leadingNotWhitespace() {
-    indexTestUnit('''
+  test_fragmentExpression_leadingNotWhitespace() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2 + 3 + 4;
 }
@@ -561,8 +562,8 @@
 ''');
   }
 
-  test_fragmentExpression_leadingPartialSelection() {
-    indexTestUnit('''
+  test_fragmentExpression_leadingPartialSelection() async {
+    await indexTestUnit('''
 main() {
   int a = 111 + 2 + 3 + 4;
 }
@@ -577,8 +578,8 @@
 ''');
   }
 
-  test_fragmentExpression_leadingWhitespace() {
-    indexTestUnit('''
+  test_fragmentExpression_leadingWhitespace() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2 + 3 + 4;
 }
@@ -593,8 +594,8 @@
 ''');
   }
 
-  test_fragmentExpression_notAssociativeOperator() {
-    indexTestUnit('''
+  test_fragmentExpression_notAssociativeOperator() async {
+    await indexTestUnit('''
 main() {
   int a = 1 - 2 - 3 - 4;
 }
@@ -609,8 +610,8 @@
 ''');
   }
 
-  test_fragmentExpression_trailingNotWhitespace() {
-    indexTestUnit('''
+  test_fragmentExpression_trailingNotWhitespace() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2 + 3 + 4;
 }
@@ -625,8 +626,8 @@
 ''');
   }
 
-  test_fragmentExpression_trailingPartialSelection() {
-    indexTestUnit('''
+  test_fragmentExpression_trailingPartialSelection() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2 + 333 + 4;
 }
@@ -641,8 +642,8 @@
 ''');
   }
 
-  test_fragmentExpression_trailingWhitespace() {
-    indexTestUnit('''
+  test_fragmentExpression_trailingWhitespace() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2 + 3 + 4;
 }
@@ -658,7 +659,7 @@
   }
 
   test_guessNames_fragmentExpression() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var a = 111 + 222 + 333 + 444;
 }
@@ -670,7 +671,7 @@
   }
 
   test_guessNames_singleExpression() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class TreeItem {}
 TreeItem getSelectedItem() => null;
 process(my) {}
@@ -686,7 +687,7 @@
   }
 
   test_guessNames_stringPart() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var s = 'Hello Bob... welcome to Dart!';
 }
@@ -698,7 +699,7 @@
   }
 
   test_occurrences_differentVariable() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   {
     int v = 1;
@@ -731,8 +732,8 @@
         length: 3, offsets: [36, 59, 85], names: ['object', 'i']);
   }
 
-  test_occurrences_disableOccurrences() {
-    indexTestUnit('''
+  test_occurrences_disableOccurrences() async {
+    await indexTestUnit('''
 int foo() => 42;
 main() {
   int a = 1 + foo();
@@ -752,8 +753,8 @@
 ''');
   }
 
-  test_occurrences_ignore_assignmentLeftHandSize() {
-    indexTestUnit('''
+  test_occurrences_ignore_assignmentLeftHandSize() async {
+    await indexTestUnit('''
 main() {
   int v = 1;
   v = 2;
@@ -776,8 +777,8 @@
 ''');
   }
 
-  test_occurrences_ignore_nameOfVariableDeclaration() {
-    indexTestUnit('''
+  test_occurrences_ignore_nameOfVariableDeclaration() async {
+    await indexTestUnit('''
 main() {
   int v = 1;
   print(v); // marker
@@ -794,8 +795,8 @@
 ''');
   }
 
-  test_occurrences_singleExpression() {
-    indexTestUnit('''
+  test_occurrences_singleExpression() async {
+    await indexTestUnit('''
 int foo() => 42;
 main() {
   int a = 1 + foo();
@@ -814,8 +815,8 @@
 ''');
   }
 
-  test_occurrences_useDominator() {
-    indexTestUnit('''
+  test_occurrences_useDominator() async {
+    await indexTestUnit('''
 main() {
   if (true) {
     print(42);
@@ -838,8 +839,8 @@
 ''');
   }
 
-  test_occurrences_whenComment() {
-    indexTestUnit('''
+  test_occurrences_whenComment() async {
+    await indexTestUnit('''
 int foo() => 42;
 main() {
   /*int a = 1 + foo();*/
@@ -858,8 +859,8 @@
 ''');
   }
 
-  test_occurrences_withSpace() {
-    indexTestUnit('''
+  test_occurrences_withSpace() async {
+    await indexTestUnit('''
 int foo(String s) => 42;
 main() {
   int a = 1 + foo('has space');
@@ -879,7 +880,7 @@
   }
 
   test_offsets_lengths() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 int foo() => 42;
 main() {
   int a = 1 + foo(); // marker
@@ -894,8 +895,8 @@
     expect(refactoring.lengths, unorderedEquals([5, 6]));
   }
 
-  test_singleExpression() {
-    indexTestUnit('''
+  test_singleExpression() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
 }
@@ -910,8 +911,8 @@
 ''');
   }
 
-  test_singleExpression_getter() {
-    indexTestUnit('''
+  test_singleExpression_getter() async {
+    await indexTestUnit('''
 class A {
   int get foo => 42;
 }
@@ -934,9 +935,9 @@
 ''');
   }
 
-  test_singleExpression_hasParseError_expectedSemicolon() {
+  test_singleExpression_hasParseError_expectedSemicolon() async {
     verifyNoTestUnitErrors = false;
-    indexTestUnit('''
+    await indexTestUnit('''
 main(p) {
   foo
   p.bar.baz;
@@ -954,7 +955,7 @@
   }
 
   test_singleExpression_inExpressionBody_ofClosure() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   print((x) => x.y * x.y + 1);
 }
@@ -974,7 +975,7 @@
   }
 
   test_singleExpression_inExpressionBody_ofFunction() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 foo(Point p) => p.x * p.x + p.y * p.y;
 class Point {int x; int y;}
 ''');
@@ -992,7 +993,7 @@
   }
 
   test_singleExpression_inExpressionBody_ofMethod() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   foo(Point p) => p.x * p.x + p.y * p.y;
 }
@@ -1013,8 +1014,8 @@
         length: 3, offsets: [35, 57, 63], names: ['x', 'i']);
   }
 
-  test_singleExpression_inIfElseIf() {
-    indexTestUnit('''
+  test_singleExpression_inIfElseIf() async {
+    await indexTestUnit('''
 main(int p) {
   if (p == 1) {
     print(1);
@@ -1037,8 +1038,8 @@
 ''');
   }
 
-  test_singleExpression_inMethod() {
-    indexTestUnit('''
+  test_singleExpression_inMethod() async {
+    await indexTestUnit('''
 class A {
   main() {
     print(1 + 2);
@@ -1057,8 +1058,8 @@
 ''');
   }
 
-  test_singleExpression_leadingNotWhitespace() {
-    indexTestUnit('''
+  test_singleExpression_leadingNotWhitespace() async {
+    await indexTestUnit('''
 main() {
   int a = 12 + 345;
 }
@@ -1073,8 +1074,8 @@
 ''');
   }
 
-  test_singleExpression_leadingWhitespace() {
-    indexTestUnit('''
+  test_singleExpression_leadingWhitespace() async {
+    await indexTestUnit('''
 main() {
   int a = 1 /*abc*/ + 2 + 345;
 }
@@ -1090,7 +1091,7 @@
   }
 
   test_singleExpression_methodName_reference() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var v = foo().length;
 }
@@ -1108,7 +1109,7 @@
   }
 
   test_singleExpression_nameOfProperty_prefixedIdentifier() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main(p) {
   var v = p.value; // marker
 }
@@ -1124,7 +1125,7 @@
   }
 
   test_singleExpression_nameOfProperty_propertyAccess() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var v = foo().length; // marker
 }
@@ -1146,8 +1147,8 @@
    * `1 + 2` will be a separate and complete binary expression, so it can be
    * handled as a single expression.
    */
-  test_singleExpression_partOfBinaryExpression() {
-    indexTestUnit('''
+  test_singleExpression_partOfBinaryExpression() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2 + 3 + 4;
 }
@@ -1162,8 +1163,8 @@
 ''');
   }
 
-  test_singleExpression_string() {
-    indexTestUnit('''
+  test_singleExpression_string() async {
+    await indexTestUnit('''
 void main() {
   print("1234");
 }
@@ -1178,8 +1179,8 @@
 ''');
   }
 
-  test_singleExpression_trailingNotWhitespace() {
-    indexTestUnit('''
+  test_singleExpression_trailingNotWhitespace() async {
+    await indexTestUnit('''
 main() {
   int a = 12 + 345;
 }
@@ -1194,8 +1195,8 @@
 ''');
   }
 
-  test_singleExpression_trailingWhitespace() {
-    indexTestUnit('''
+  test_singleExpression_trailingWhitespace() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2 ;
 }
@@ -1211,7 +1212,7 @@
   }
 
   test_stringLiteral_part() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   print('abcdefgh');
 }
@@ -1228,7 +1229,7 @@
   }
 
   test_stringLiteral_whole() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   print('abc');
 }
@@ -1246,7 +1247,7 @@
   }
 
   test_stringLiteralPart() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 main() {
   int x = 1;
   int y = 2;
@@ -1346,3 +1347,9 @@
     return subExpressions;
   }
 }
+
+@reflectiveTest
+class ExtractLocalTest_Driver extends ExtractLocalTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
index 6154170..55dfe5e 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
@@ -18,6 +18,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(ExtractMethodTest);
+    defineReflectiveTests(ExtractMethodTest_Driver);
   });
 }
 
@@ -25,8 +26,8 @@
 class ExtractMethodTest extends RefactoringTest {
   ExtractMethodRefactoringImpl refactoring;
 
-  test_bad_assignmentLeftHandSide() {
-    indexTestUnit('''
+  test_bad_assignmentLeftHandSide() async {
+    await indexTestUnit('''
 main() {
   int aaa;
   aaa = 0;
@@ -37,8 +38,8 @@
         'Cannot extract the left-hand side of an assignment.');
   }
 
-  test_bad_comment_selectionEndsInside() {
-    indexTestUnit('''
+  test_bad_comment_selectionEndsInside() async {
+    await indexTestUnit('''
 main() {
 // start
   print(0);
@@ -51,8 +52,8 @@
     return _assertConditionsFatal('Selection ends inside a comment.');
   }
 
-  test_bad_comment_selectionStartsInside() {
-    indexTestUnit('''
+  test_bad_comment_selectionStartsInside() async {
+    await indexTestUnit('''
 main() {
 /*
 // start
@@ -65,8 +66,8 @@
     return _assertConditionsFatal('Selection begins inside a comment.');
   }
 
-  test_bad_conflict_method_alreadyDeclaresMethod() {
-    indexTestUnit('''
+  test_bad_conflict_method_alreadyDeclaresMethod() async {
+    await indexTestUnit('''
 class A {
   void res() {}
   main() {
@@ -81,8 +82,8 @@
         "Class 'A' already declares method with name 'res'.");
   }
 
-  test_bad_conflict_method_shadowsSuperDeclaration() {
-    indexTestUnit('''
+  test_bad_conflict_method_shadowsSuperDeclaration() async {
+    await indexTestUnit('''
 class A {
   void res() {} // marker
 }
@@ -99,8 +100,8 @@
     return _assertConditionsError("Created method will shadow method 'A.res'.");
   }
 
-  test_bad_conflict_topLevel_alreadyDeclaresFunction() {
-    indexTestUnit('''
+  test_bad_conflict_topLevel_alreadyDeclaresFunction() async {
+    await indexTestUnit('''
 library my.lib;
 
 void res() {}
@@ -115,8 +116,8 @@
         "Library already declares function with name 'res'.");
   }
 
-  test_bad_conflict_topLevel_willHideInheritedMemberUsage() {
-    indexTestUnit('''
+  test_bad_conflict_topLevel_willHideInheritedMemberUsage() async {
+    await indexTestUnit('''
 class A {
   void res() {}
 }
@@ -136,8 +137,8 @@
         "Created function will shadow method 'A.res'.");
   }
 
-  test_bad_constructor_initializer() {
-    indexTestUnit('''
+  test_bad_constructor_initializer() async {
+    await indexTestUnit('''
 class A {
   int f;
   A() : f = 0 {}
@@ -148,8 +149,8 @@
         'Cannot extract a constructor initializer. Select expression part of initializer.');
   }
 
-  test_bad_constructor_redirectingConstructor() {
-    indexTestUnit('''
+  test_bad_constructor_redirectingConstructor() async {
+    await indexTestUnit('''
 class A {
   A() : this.named();
   A.named() {}
@@ -160,8 +161,8 @@
         'Cannot extract a constructor initializer. Select expression part of initializer.');
   }
 
-  test_bad_constructor_superConstructor() {
-    indexTestUnit('''
+  test_bad_constructor_superConstructor() async {
+    await indexTestUnit('''
 class A {}
 class B extends A {
   B() : super();
@@ -172,8 +173,8 @@
         'Cannot extract a constructor initializer. Select expression part of initializer.');
   }
 
-  test_bad_doWhile_body() {
-    indexTestUnit('''
+  test_bad_doWhile_body() async {
+    await indexTestUnit('''
 main() {
   do
 // start
@@ -188,8 +189,8 @@
         "Operation not applicable to a 'do' statement's body and expression.");
   }
 
-  test_bad_emptySelection() {
-    indexTestUnit('''
+  test_bad_emptySelection() async {
+    await indexTestUnit('''
 main() {
 // start
 // end
@@ -201,8 +202,8 @@
         "Can only extract a single expression or a set of statements.");
   }
 
-  test_bad_forLoop_conditionAndUpdaters() {
-    indexTestUnit('''
+  test_bad_forLoop_conditionAndUpdaters() async {
+    await indexTestUnit('''
 main() {
   for (
     int i = 0;
@@ -218,8 +219,8 @@
         "Operation not applicable to a 'for' statement's condition and updaters.");
   }
 
-  test_bad_forLoop_init() {
-    indexTestUnit('''
+  test_bad_forLoop_init() async {
+    await indexTestUnit('''
 main() {
   for (
 // start
@@ -235,8 +236,8 @@
         "Cannot extract initialization part of a 'for' statement.");
   }
 
-  test_bad_forLoop_initAndCondition() {
-    indexTestUnit('''
+  test_bad_forLoop_initAndCondition() async {
+    await indexTestUnit('''
 main() {
   for (
 // start
@@ -252,8 +253,8 @@
         "Operation not applicable to a 'for' statement's initializer and condition.");
   }
 
-  test_bad_forLoop_updaters() {
-    indexTestUnit('''
+  test_bad_forLoop_updaters() async {
+    await indexTestUnit('''
 main() {
   for (
     int i = 0;
@@ -269,8 +270,8 @@
         "Cannot extract increment part of a 'for' statement.");
   }
 
-  test_bad_forLoop_updatersAndBody() {
-    indexTestUnit('''
+  test_bad_forLoop_updatersAndBody() async {
+    await indexTestUnit('''
 main() {
   for (
     int i = 0;
@@ -286,8 +287,8 @@
         "Operation not applicable to a 'for' statement's updaters and body.");
   }
 
-  test_bad_methodName_reference() {
-    indexTestUnit('''
+  test_bad_methodName_reference() async {
+    await indexTestUnit('''
 main() {
   main();
 }
@@ -296,8 +297,8 @@
     return _assertConditionsFatal("Cannot extract a single method name.");
   }
 
-  test_bad_namePartOfDeclaration_function() {
-    indexTestUnit('''
+  test_bad_namePartOfDeclaration_function() async {
+    await indexTestUnit('''
 main() {
 }
 ''');
@@ -306,8 +307,8 @@
         "Cannot extract the name part of a declaration.");
   }
 
-  test_bad_namePartOfDeclaration_variable() {
-    indexTestUnit('''
+  test_bad_namePartOfDeclaration_variable() async {
+    await indexTestUnit('''
 main() {
   int vvv = 0;
 }
@@ -317,8 +318,8 @@
         "Cannot extract the name part of a declaration.");
   }
 
-  test_bad_namePartOfQualified() {
-    indexTestUnit('''
+  test_bad_namePartOfQualified() async {
+    await indexTestUnit('''
 class A {
   var fff;
 }
@@ -332,8 +333,8 @@
         "Can not extract name part of a property access.");
   }
 
-  test_bad_newMethodName_notIdentifier() {
-    indexTestUnit('''
+  test_bad_newMethodName_notIdentifier() async {
+    await indexTestUnit('''
 main() {
 // start
   print(0);
@@ -346,8 +347,8 @@
     return _assertConditionsFatal("Method name must not contain '-'.");
   }
 
-  test_bad_notSameParent() {
-    indexTestUnit('''
+  test_bad_notSameParent() async {
+    await indexTestUnit('''
 main() {
   while (false)
 // start
@@ -363,7 +364,7 @@
   }
 
   test_bad_parameterName_duplicate() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -386,7 +387,7 @@
   }
 
   test_bad_parameterName_inUse_function() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -410,7 +411,7 @@
   }
 
   test_bad_parameterName_inUse_localVariable() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -433,7 +434,7 @@
   }
 
   test_bad_parameterName_inUse_method() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   main() {
     int v1 = 1;
@@ -458,8 +459,8 @@
         "'m' is already used as a name in the selected code");
   }
 
-  test_bad_selectionEndsInSomeNode() {
-    indexTestUnit('''
+  test_bad_selectionEndsInSomeNode() async {
+    await indexTestUnit('''
 main() {
 // start
   print(0);
@@ -473,8 +474,8 @@
         "Extend selection to a valid range.");
   }
 
-  test_bad_statements_exit_notAllExecutionFlows() {
-    indexTestUnit('''
+  test_bad_statements_exit_notAllExecutionFlows() async {
+    await indexTestUnit('''
 main(int p) {
 // start
   if (p == 0) {
@@ -488,8 +489,8 @@
     return _assertConditionsError(ExtractMethodRefactoringImpl.ERROR_EXITS);
   }
 
-  test_bad_statements_return_andAssignsVariable() {
-    indexTestUnit('''
+  test_bad_statements_return_andAssignsVariable() async {
+    await indexTestUnit('''
 main() {
 // start
   var v = 0;
@@ -504,8 +505,8 @@
         "local variables and return statement.");
   }
 
-  test_bad_switchCase() {
-    indexTestUnit('''
+  test_bad_switchCase() async {
+    await indexTestUnit('''
 main() {
   switch (1) {
 // start
@@ -520,8 +521,8 @@
         "or parts of a single case block.");
   }
 
-  test_bad_tokensBetweenLastNodeAndSelectionEnd() {
-    indexTestUnit('''
+  test_bad_tokensBetweenLastNodeAndSelectionEnd() async {
+    await indexTestUnit('''
 main() {
 // start
   print(0);
@@ -534,8 +535,8 @@
         "The end of the selection contains characters that do not belong to a statement.");
   }
 
-  test_bad_tokensBetweenSelectionStartAndFirstNode() {
-    indexTestUnit('''
+  test_bad_tokensBetweenSelectionStartAndFirstNode() async {
+    await indexTestUnit('''
 main() {
 // start
   print(0); // marker
@@ -548,8 +549,8 @@
         "The beginning of the selection contains characters that do not belong to a statement.");
   }
 
-  test_bad_try_catchBlock_block() {
-    indexTestUnit('''
+  test_bad_try_catchBlock_block() async {
+    await indexTestUnit('''
 main() {
   try
   {}
@@ -565,8 +566,8 @@
         "parts of try, catch, or finally block.");
   }
 
-  test_bad_try_catchBlock_complete() {
-    indexTestUnit('''
+  test_bad_try_catchBlock_complete() async {
+    await indexTestUnit('''
 main() {
   try
   {}
@@ -582,8 +583,8 @@
         "parts of try, catch, or finally block.");
   }
 
-  test_bad_try_catchBlock_exception() {
-    indexTestUnit('''
+  test_bad_try_catchBlock_exception() async {
+    await indexTestUnit('''
 main() {
   try {
   } catch (
@@ -599,8 +600,8 @@
         'Cannot extract the name part of a declaration.');
   }
 
-  test_bad_try_finallyBlock() {
-    indexTestUnit('''
+  test_bad_try_finallyBlock() async {
+    await indexTestUnit('''
 main() {
   try
   {}
@@ -616,8 +617,8 @@
         "parts of try, catch, or finally block.");
   }
 
-  test_bad_try_tryBlock() {
-    indexTestUnit('''
+  test_bad_try_tryBlock() async {
+    await indexTestUnit('''
 main() {
   try
 // start
@@ -633,8 +634,8 @@
         "parts of try, catch, or finally block.");
   }
 
-  test_bad_typeReference() {
-    indexTestUnit('''
+  test_bad_typeReference() async {
+    await indexTestUnit('''
 main() {
   int a = 0;
 }
@@ -643,8 +644,8 @@
     return _assertConditionsFatal("Cannot extract a single type reference.");
   }
 
-  test_bad_variableDeclarationFragment() {
-    indexTestUnit('''
+  test_bad_variableDeclarationFragment() async {
+    await indexTestUnit('''
 main() {
   int
 // start
@@ -658,8 +659,8 @@
         "Cannot extract a variable declaration fragment. Select whole declaration statement.");
   }
 
-  test_bad_while_conditionAndBody() {
-    indexTestUnit('''
+  test_bad_while_conditionAndBody() async {
+    await indexTestUnit('''
 main() {
   while
 // start
@@ -675,7 +676,7 @@
   }
 
   test_canExtractGetter_false_closure() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   useFunction((_) => true);
 }
@@ -689,7 +690,7 @@
   }
 
   test_canExtractGetter_false_fieldAssignment() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   var f;
   main() {
@@ -707,7 +708,7 @@
   }
 
   test_canExtractGetter_false_hasParameters() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main(int p) {
   int a = p + 1;
 }
@@ -720,7 +721,7 @@
   }
 
   test_canExtractGetter_false_returnNotUsed_assignment() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 var topVar = 0;
 f(int p) {
   topVar = 5;
@@ -734,7 +735,7 @@
   }
 
   test_canExtractGetter_false_returnNotUsed_noReturn() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 var topVar = 0;
 main() {
 // start
@@ -752,7 +753,7 @@
   }
 
   test_canExtractGetter_true() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
 }
@@ -764,8 +765,8 @@
     expect(refactoring.createGetter, true);
   }
 
-  test_checkName() {
-    indexTestUnit('''
+  test_checkName() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
 }
@@ -786,8 +787,8 @@
     assertRefactoringStatusOK(refactoring.checkName());
   }
 
-  test_closure_asFunction_singleExpression() {
-    indexTestUnit('''
+  test_closure_asFunction_singleExpression() async {
+    await indexTestUnit('''
 process(f(x)) {}
 main() {
   process((x) => x * 2);
@@ -805,8 +806,8 @@
 ''');
   }
 
-  test_closure_asFunction_statements() {
-    indexTestUnit('''
+  test_closure_asFunction_statements() async {
+    await indexTestUnit('''
 process(f(x)) {}
 main() {
   process((x) {
@@ -830,8 +831,8 @@
 ''');
   }
 
-  test_closure_asMethod_statements() {
-    indexTestUnit('''
+  test_closure_asMethod_statements() async {
+    await indexTestUnit('''
 process(f(x)) {}
 class A {
   int k = 2;
@@ -862,7 +863,7 @@
   }
 
   test_closure_bad_referencesLocalVariable() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 process(f(x)) {}
 main() {
   int k = 2;
@@ -878,7 +879,7 @@
   }
 
   test_closure_bad_referencesParameter() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 process(f(x)) {}
 main(int k) {
   process((x) => x * k);
@@ -892,8 +893,8 @@
             'Cannot extract closure as method, it references 1 external variable(s).');
   }
 
-  test_fromTopLevelVariableInitializerClosure() {
-    indexTestUnit('''
+  test_fromTopLevelVariableInitializerClosure() async {
+    await indexTestUnit('''
 var X = 1;
 
 var Y = () {
@@ -914,7 +915,7 @@
   }
 
   test_getExtractGetter_expression_true_binaryExpression() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   print(1 + 2);
 }
@@ -926,7 +927,7 @@
   }
 
   test_getExtractGetter_expression_true_literal() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   print(42);
 }
@@ -938,7 +939,7 @@
   }
 
   test_getExtractGetter_expression_true_prefixedExpression() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   print(!true);
 }
@@ -950,7 +951,7 @@
   }
 
   test_getExtractGetter_expression_true_prefixedIdentifier() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   print(myValue.isEven);
 }
@@ -963,7 +964,7 @@
   }
 
   test_getExtractGetter_expression_true_propertyAccess() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   print(1.isEven);
 }
@@ -975,7 +976,7 @@
   }
 
   test_getExtractGetter_statements() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
 // start
   int v = 0;
@@ -989,8 +990,8 @@
     expect(refactoring.createGetter, false);
   }
 
-  test_getRefactoringName_function() {
-    indexTestUnit('''
+  test_getRefactoringName_function() async {
+    await indexTestUnit('''
 main() {
   print(1 + 2);
 }
@@ -999,8 +1000,8 @@
     expect(refactoring.refactoringName, 'Extract Function');
   }
 
-  test_getRefactoringName_method() {
-    indexTestUnit('''
+  test_getRefactoringName_method() async {
+    await indexTestUnit('''
 class A {
   main() {
     print(1 + 2);
@@ -1012,7 +1013,7 @@
   }
 
   test_names_singleExpression() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class TreeItem {}
 TreeItem getSelectedItem() => null;
 process(my) {}
@@ -1029,7 +1030,7 @@
   }
 
   test_offsets_lengths() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
   int b = 1 +  2;
@@ -1044,7 +1045,7 @@
   }
 
   test_returnType_closure() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 process(f(x)) {}
 main() {
   process((x) => x * 2);
@@ -1057,7 +1058,7 @@
   }
 
   test_returnType_expression() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
 }
@@ -1069,7 +1070,7 @@
   }
 
   test_returnType_mixInterfaceFunction() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
 // start
   if (true) {
@@ -1087,7 +1088,7 @@
   }
 
   test_returnType_statements() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
 // start
   double v = 5.0;
@@ -1102,7 +1103,7 @@
   }
 
   test_returnType_statements_nullMix() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main(bool p) {
 // start
   if (p) {
@@ -1119,7 +1120,7 @@
   }
 
   test_returnType_statements_void() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
 // start
   print(42);
@@ -1133,7 +1134,7 @@
   }
 
   test_setExtractGetter() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
 }
@@ -1153,8 +1154,8 @@
 ''');
   }
 
-  test_singleExpression() {
-    indexTestUnit('''
+  test_singleExpression() async {
+    await indexTestUnit('''
 main() {
   int a = 1 + 2;
 }
@@ -1170,8 +1171,8 @@
 ''');
   }
 
-  test_singleExpression_cascade() {
-    indexTestUnit('''
+  test_singleExpression_cascade() async {
+    await indexTestUnit('''
 main() {
   String s = '';
   var v = s..length;
@@ -1189,8 +1190,8 @@
 ''');
   }
 
-  test_singleExpression_dynamic() {
-    indexTestUnit('''
+  test_singleExpression_dynamic() async {
+    await indexTestUnit('''
 dynaFunction() {}
 main() {
   var v = dynaFunction(); // marker
@@ -1208,10 +1209,10 @@
 ''');
   }
 
-  test_singleExpression_hasAwait() {
-    indexTestUnit('''
+  test_singleExpression_hasAwait() async {
+    await indexTestUnit('''
 import 'dart:async';
-Future<int> getValue() => 42;
+Future<int> getValue() async => 42;
 main() async {
   int v = await getValue();
   print(v);
@@ -1221,7 +1222,7 @@
     // apply refactoring
     return _assertSuccessfulRefactoring('''
 import 'dart:async';
-Future<int> getValue() => 42;
+Future<int> getValue() async => 42;
 main() async {
   int v = await res();
   print(v);
@@ -1231,8 +1232,8 @@
 ''');
   }
 
-  test_singleExpression_ignore_assignmentLeftHandSize() {
-    indexTestUnit('''
+  test_singleExpression_ignore_assignmentLeftHandSize() async {
+    await indexTestUnit('''
 main() {
   getButton().text = 'txt';
   print(getButton().text); // marker
@@ -1252,8 +1253,8 @@
 ''');
   }
 
-  test_singleExpression_occurrences() {
-    indexTestUnit('''
+  test_singleExpression_occurrences() async {
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -1289,8 +1290,8 @@
 ''');
   }
 
-  test_singleExpression_occurrences_disabled() {
-    indexTestUnit('''
+  test_singleExpression_occurrences_disabled() async {
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -1315,8 +1316,8 @@
 ''');
   }
 
-  test_singleExpression_occurrences_inClassOnly() {
-    indexTestUnit('''
+  test_singleExpression_occurrences_inClassOnly() async {
+    await indexTestUnit('''
 class A {
   myMethod() {
     int v1 = 1;
@@ -1350,8 +1351,8 @@
 ''');
   }
 
-  test_singleExpression_occurrences_incompatibleTypes() {
-    indexTestUnit('''
+  test_singleExpression_occurrences_incompatibleTypes() async {
+    await indexTestUnit('''
 main() {
   int x = 1;
   String y = 'foo';
@@ -1373,8 +1374,8 @@
 ''');
   }
 
-  test_singleExpression_occurrences_inWholeUnit() {
-    indexTestUnit('''
+  test_singleExpression_occurrences_inWholeUnit() async {
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -1408,8 +1409,8 @@
 ''');
   }
 
-  test_singleExpression_parameter_functionTypeAlias() {
-    indexTestUnit('''
+  test_singleExpression_parameter_functionTypeAlias() async {
+    await indexTestUnit('''
 typedef R Foo<S, R>(S s);
 void main(Foo<String, int> foo, String s) {
   int a = foo(s);
@@ -1429,7 +1430,7 @@
 
   test_singleExpression_returnType_importLibrary() async {
     _addLibraryReturningAsync();
-    indexTestUnit('''
+    await indexTestUnit('''
 import 'asyncLib.dart';
 main() {
   var a = newFuture();
@@ -1448,8 +1449,8 @@
 ''');
   }
 
-  test_singleExpression_returnTypeGeneric() {
-    indexTestUnit('''
+  test_singleExpression_returnTypeGeneric() async {
+    await indexTestUnit('''
 main() {
   var v = new List<String>();
 }
@@ -1465,8 +1466,8 @@
 ''');
   }
 
-  test_singleExpression_returnTypePrefix() {
-    indexTestUnit('''
+  test_singleExpression_returnTypePrefix() async {
+    await indexTestUnit('''
 import 'dart:math' as pref;
 main() {
   var v = new pref.Random();
@@ -1484,8 +1485,8 @@
 ''');
   }
 
-  test_singleExpression_staticContext_extractFromInitializer() {
-    indexTestUnit('''
+  test_singleExpression_staticContext_extractFromInitializer() async {
+    await indexTestUnit('''
 class A {
   A(int v) {}
 }
@@ -1507,8 +1508,8 @@
 ''');
   }
 
-  test_singleExpression_staticContext_extractFromInstance() {
-    indexTestUnit('''
+  test_singleExpression_staticContext_extractFromInstance() async {
+    await indexTestUnit('''
 class A {
   instanceMethodA() {
     int v1 = 1;
@@ -1552,8 +1553,8 @@
 ''');
   }
 
-  test_singleExpression_staticContext_extractFromStatic() {
-    indexTestUnit('''
+  test_singleExpression_staticContext_extractFromStatic() async {
+    await indexTestUnit('''
 class A {
   static staticMethodA() {
     int v1 = 1;
@@ -1597,8 +1598,8 @@
 ''');
   }
 
-  test_singleExpression_staticContext_hasInInitializer() {
-    indexTestUnit('''
+  test_singleExpression_staticContext_hasInInitializer() async {
+    await indexTestUnit('''
 class A {
   A(int v) {}
 }
@@ -1626,8 +1627,8 @@
 ''');
   }
 
-  test_singleExpression_usesParameter() {
-    indexTestUnit('''
+  test_singleExpression_usesParameter() async {
+    await indexTestUnit('''
 fooA(int a1) {
   int a2 = 2;
   int a = a1 + a2;
@@ -1653,8 +1654,8 @@
 ''');
   }
 
-  test_singleExpression_withVariables() {
-    indexTestUnit('''
+  test_singleExpression_withVariables() async {
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -1675,7 +1676,7 @@
   }
 
   test_singleExpression_withVariables_doRename() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -1712,7 +1713,7 @@
   }
 
   test_singleExpression_withVariables_doReorder() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -1748,8 +1749,8 @@
 ''');
   }
 
-  test_singleExpression_withVariables_namedExpression() {
-    indexTestUnit('''
+  test_singleExpression_withVariables_namedExpression() async {
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -1772,7 +1773,7 @@
   }
 
   test_singleExpression_withVariables_newType() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int v1 = 1;
   int v2 = 2;
@@ -1808,8 +1809,8 @@
 ''');
   }
 
-  test_singleExpression_withVariables_useBestType() {
-    indexTestUnit('''
+  test_singleExpression_withVariables_useBestType() async {
+    await indexTestUnit('''
 main() {
   var v1 = 1;
   var v2 = 2;
@@ -1829,8 +1830,8 @@
 ''');
   }
 
-  test_statements_assignment() {
-    indexTestUnit('''
+  test_statements_assignment() async {
+    await indexTestUnit('''
 main() {
   int v;
 // start
@@ -1857,8 +1858,8 @@
 ''');
   }
 
-  test_statements_changeIndentation() {
-    indexTestUnit('''
+  test_statements_changeIndentation() async {
+    await indexTestUnit('''
 main() {
   {
 // start
@@ -1888,8 +1889,8 @@
 ''');
   }
 
-  test_statements_changeIndentation_multilineString() {
-    indexTestUnit('''
+  test_statements_changeIndentation_multilineString() async {
+    await indexTestUnit('''
 main() {
   {
 // start
@@ -1921,8 +1922,8 @@
 ''');
   }
 
-  test_statements_definesVariable_notUsedOutside() {
-    indexTestUnit('''
+  test_statements_definesVariable_notUsedOutside() async {
+    await indexTestUnit('''
 main() {
   int a = 1;
   int b = 1;
@@ -1950,8 +1951,8 @@
 ''');
   }
 
-  test_statements_definesVariable_oneUsedOutside_assignment() {
-    indexTestUnit('''
+  test_statements_definesVariable_oneUsedOutside_assignment() async {
+    await indexTestUnit('''
 myFunctionA() {
   int a = 1;
 // start
@@ -1988,8 +1989,8 @@
 ''');
   }
 
-  test_statements_definesVariable_oneUsedOutside_declaration() {
-    indexTestUnit('''
+  test_statements_definesVariable_oneUsedOutside_declaration() async {
+    await indexTestUnit('''
 myFunctionA() {
   int a = 1;
   int b = 2;
@@ -2031,7 +2032,7 @@
   }
 
   test_statements_definesVariable_twoUsedOutside() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
 // start
   int varA = 1;
@@ -2046,8 +2047,8 @@
     assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL);
   }
 
-  test_statements_duplicate_absolutelySame() {
-    indexTestUnit('''
+  test_statements_duplicate_absolutelySame() async {
+    await indexTestUnit('''
 myFunctionA() {
   print(0);
   print(1);
@@ -2078,8 +2079,8 @@
 ''');
   }
 
-  test_statements_duplicate_declaresDifferentlyNamedVariable() {
-    indexTestUnit('''
+  test_statements_duplicate_declaresDifferentlyNamedVariable() async {
+    await indexTestUnit('''
 myFunctionA() {
   int varA = 1;
   print(varA);
@@ -2110,8 +2111,8 @@
 ''');
   }
 
-  test_statements_dynamic() {
-    indexTestUnit('''
+  test_statements_dynamic() async {
+    await indexTestUnit('''
 dynaFunction(p) => 0;
 main() {
 // start
@@ -2143,8 +2144,8 @@
   /**
    * We should always add ";" when invoke method with extracted statements.
    */
-  test_statements_endsWithBlock() {
-    indexTestUnit('''
+  test_statements_endsWithBlock() async {
+    await indexTestUnit('''
 main() {
 // start
   if (true) {
@@ -2171,7 +2172,7 @@
   }
 
   test_statements_exit_throws() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main(int p) {
 // start
   if (p == 0) {
@@ -2185,10 +2186,10 @@
     await assertRefactoringConditionsOK();
   }
 
-  test_statements_hasAwait_dynamicReturnType() {
-    indexTestUnit('''
+  test_statements_hasAwait_dynamicReturnType() async {
+    await indexTestUnit('''
 import 'dart:async';
-Future getValue() => 42;
+Future getValue() async => 42;
 main() async {
 // start
   var v = await getValue();
@@ -2200,7 +2201,7 @@
     // apply refactoring
     return _assertSuccessfulRefactoring('''
 import 'dart:async';
-Future getValue() => 42;
+Future getValue() async => 42;
 main() async {
 // start
   var v = await res();
@@ -2215,10 +2216,10 @@
 ''');
   }
 
-  test_statements_hasAwait_expression() {
-    indexTestUnit('''
+  test_statements_hasAwait_expression() async {
+    await indexTestUnit('''
 import 'dart:async';
-Future<int> getValue() => 42;
+Future<int> getValue() async => 42;
 main() async {
 // start
   int v = await getValue();
@@ -2231,7 +2232,7 @@
     // apply refactoring
     return _assertSuccessfulRefactoring('''
 import 'dart:async';
-Future<int> getValue() => 42;
+Future<int> getValue() async => 42;
 main() async {
 // start
   int v = await res();
@@ -2247,8 +2248,8 @@
 ''');
   }
 
-  test_statements_hasAwait_forEach() {
-    indexTestUnit('''
+  test_statements_hasAwait_forEach() async {
+    await indexTestUnit('''
 import 'dart:async';
 Stream<int> getValueStream() => null;
 main() async {
@@ -2283,10 +2284,10 @@
 ''');
   }
 
-  test_statements_hasAwait_voidReturnType() {
-    indexTestUnit('''
+  test_statements_hasAwait_voidReturnType() async {
+    await indexTestUnit('''
 import 'dart:async';
-Future<int> getValue() => 42;
+Future<int> getValue() async => 42;
 main() async {
 // start
   int v = await getValue();
@@ -2298,7 +2299,7 @@
     // apply refactoring
     return _assertSuccessfulRefactoring('''
 import 'dart:async';
-Future<int> getValue() => 42;
+Future<int> getValue() async => 42;
 main() async {
 // start
   await res();
@@ -2312,8 +2313,8 @@
 ''');
   }
 
-  test_statements_inSwitchMember() {
-    indexTestUnit('''
+  test_statements_inSwitchMember() async {
+    await indexTestUnit('''
 class A {
   foo(int p) {
     switch (p) {
@@ -2351,8 +2352,8 @@
 ''');
   }
 
-  test_statements_method() {
-    indexTestUnit('''
+  test_statements_method() async {
+    await indexTestUnit('''
 class A {
   foo() {
 // start
@@ -2378,8 +2379,8 @@
 ''');
   }
 
-  test_statements_noDuplicates() {
-    indexTestUnit('''
+  test_statements_noDuplicates() async {
+    await indexTestUnit('''
 main() {
   int a = 1;
   int b = 1;
@@ -2406,7 +2407,7 @@
   }
 
   test_statements_parameters_ignoreInnerPropagatedType() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main(Object x) {
 // start
   if (x is int) {
@@ -2438,9 +2439,9 @@
 ''');
   }
 
-  test_statements_parameters_importType() {
+  test_statements_parameters_importType() async {
     _addLibraryReturningAsync();
-    indexTestUnit('''
+    await indexTestUnit('''
 import 'asyncLib.dart';
 main() {
   var v = newFuture();
@@ -2467,9 +2468,9 @@
 ''');
   }
 
-  test_statements_parameters_localFunction() {
+  test_statements_parameters_localFunction() async {
     _addLibraryReturningAsync();
-    indexTestUnit('''
+    await indexTestUnit('''
 class C {
   int f(int a) {
     int callback(int x, int y) => x + a;
@@ -2503,7 +2504,7 @@
   }
 
   test_statements_parameters_noLocalVariableConflict() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 int f(int x) {
   int y = x + 1;
 // start
@@ -2520,8 +2521,8 @@
     await assertRefactoringConditionsOK();
   }
 
-  test_statements_return_last() {
-    indexTestUnit('''
+  test_statements_return_last() async {
+    await indexTestUnit('''
 main() {
 // start
   int v = 5;
@@ -2545,8 +2546,8 @@
 ''');
   }
 
-  test_statements_return_multiple_ifElse() {
-    indexTestUnit('''
+  test_statements_return_multiple_ifElse() async {
+    await indexTestUnit('''
 num main(bool b) {
 // start
   if (b) {
@@ -2576,8 +2577,8 @@
 ''');
   }
 
-  test_statements_return_multiple_ifThen() {
-    indexTestUnit('''
+  test_statements_return_multiple_ifThen() async {
+    await indexTestUnit('''
 num main(bool b) {
 // start
   if (b) {
@@ -2605,8 +2606,8 @@
 ''');
   }
 
-  test_statements_return_multiple_ignoreInFunction() {
-    indexTestUnit('''
+  test_statements_return_multiple_ignoreInFunction() async {
+    await indexTestUnit('''
 int main() {
 // start
   localFunction() {
@@ -2634,8 +2635,8 @@
 ''');
   }
 
-  test_statements_return_multiple_interfaceFunction() {
-    indexTestUnit('''
+  test_statements_return_multiple_interfaceFunction() async {
+    await indexTestUnit('''
 main(bool b) {
 // start
   if (b) {
@@ -2663,8 +2664,8 @@
 ''');
   }
 
-  test_statements_return_multiple_sameElementDifferentTypeArgs() {
-    indexTestUnit('''
+  test_statements_return_multiple_sameElementDifferentTypeArgs() async {
+    await indexTestUnit('''
 main(bool b) {
 // start
   if (b) {
@@ -2698,8 +2699,8 @@
 ''');
   }
 
-  test_statements_return_single() {
-    indexTestUnit('''
+  test_statements_return_single() async {
+    await indexTestUnit('''
 main() {
 // start
   return 42;
@@ -2725,8 +2726,8 @@
    * We have 3 identical statements, but select only 2.
    * This should not cause problems.
    */
-  test_statements_twoOfThree() {
-    indexTestUnit('''
+  test_statements_twoOfThree() async {
+    await indexTestUnit('''
 main() {
 // start
   print(0);
@@ -2842,3 +2843,9 @@
     }).toList();
   }
 }
+
+@reflectiveTest
+class ExtractMethodTest_Driver extends ExtractMethodTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/inline_local_test.dart b/pkg/analysis_server/test/services/refactoring/inline_local_test.dart
index e3ccaa1..674b5a7 100644
--- a/pkg/analysis_server/test/services/refactoring/inline_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/inline_local_test.dart
@@ -16,6 +16,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(InlineLocalTest);
+    defineReflectiveTests(InlineLocalTest_Driver);
   });
 }
 
@@ -24,7 +25,7 @@
   InlineLocalRefactoringImpl refactoring;
 
   test_access() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int test = 1 + 2;
   print(test);
@@ -40,7 +41,7 @@
   }
 
   test_bad_selectionMethod() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 main() {
 }
 ''');
@@ -50,7 +51,7 @@
   }
 
   test_bad_selectionParameter() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 main(int test) {
 }
 ''');
@@ -60,7 +61,7 @@
   }
 
   test_bad_selectionVariable_hasAssignments_1() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 main() {
   int test = 0;
   test = 1;
@@ -73,7 +74,7 @@
   }
 
   test_bad_selectionVariable_hasAssignments_2() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 main() {
   int test = 0;
   test += 1;
@@ -86,7 +87,7 @@
   }
 
   test_bad_selectionVariable_notInBlock() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 main() {
   if (true)
     int test = 0;
@@ -98,7 +99,7 @@
   }
 
   test_bad_selectionVariable_notInitialized() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 main() {
   int test;
 }
@@ -108,8 +109,8 @@
     assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL);
   }
 
-  test_OK_cascade_intoCascade() {
-    indexTestUnit(r'''
+  test_OK_cascade_intoCascade() async {
+    await indexTestUnit(r'''
 class A {
   foo() {}
   bar() {}
@@ -132,8 +133,8 @@
 ''');
   }
 
-  test_OK_cascade_intoNotCascade() {
-    indexTestUnit(r'''
+  test_OK_cascade_intoNotCascade() async {
+    await indexTestUnit(r'''
 class A {
   foo() {}
   bar() {}
@@ -156,8 +157,8 @@
 ''');
   }
 
-  test_OK_inSwitchCase() {
-    indexTestUnit('''
+  test_OK_inSwitchCase() async {
+    await indexTestUnit('''
 main(int p) {
   switch (p) {
     case 0:
@@ -180,8 +181,8 @@
 ''');
   }
 
-  test_OK_intoStringInterpolation_binaryExpression() {
-    indexTestUnit(r'''
+  test_OK_intoStringInterpolation_binaryExpression() async {
+    await indexTestUnit(r'''
 main() {
   int test = 1 + 2;
   print('test = $test');
@@ -202,8 +203,8 @@
 ''');
   }
 
-  test_OK_intoStringInterpolation_simpleIdentifier() {
-    indexTestUnit(r'''
+  test_OK_intoStringInterpolation_simpleIdentifier() async {
+    await indexTestUnit(r'''
 main() {
   int foo = 1 + 2;
   int test = foo;
@@ -226,8 +227,8 @@
 ''');
   }
 
-  test_OK_intoStringInterpolation_string_differentQuotes() {
-    indexTestUnit(r'''
+  test_OK_intoStringInterpolation_string_differentQuotes() async {
+    await indexTestUnit(r'''
 main() {
   String a = "aaa";
   String b = '$a bbb';
@@ -242,8 +243,8 @@
 ''');
   }
 
-  test_OK_intoStringInterpolation_string_doubleQuotes() {
-    indexTestUnit(r'''
+  test_OK_intoStringInterpolation_string_doubleQuotes() async {
+    await indexTestUnit(r'''
 main() {
   String a = "aaa";
   String b = "$a bbb";
@@ -258,8 +259,8 @@
 ''');
   }
 
-  test_OK_intoStringInterpolation_string_multiLineIntoMulti_leadingSpaces() {
-    indexTestUnit(r"""
+  test_OK_intoStringInterpolation_string_multiLineIntoMulti_leadingSpaces() async {
+    await indexTestUnit(r"""
 main() {
   String a = '''\ \
 a
@@ -281,8 +282,8 @@
 """);
   }
 
-  test_OK_intoStringInterpolation_string_multiLineIntoMulti_unixEOL() {
-    indexTestUnit(r"""
+  test_OK_intoStringInterpolation_string_multiLineIntoMulti_unixEOL() async {
+    await indexTestUnit(r"""
 main() {
   String a = '''
 a
@@ -306,8 +307,8 @@
 """);
   }
 
-  test_OK_intoStringInterpolation_string_multiLineIntoMulti_windowsEOL() {
-    indexTestUnit(r"""
+  test_OK_intoStringInterpolation_string_multiLineIntoMulti_windowsEOL() async {
+    await indexTestUnit(r"""
 main() {
   String a = '''
 a
@@ -333,8 +334,8 @@
         .replaceAll('\n', '\r\n'));
   }
 
-  test_OK_intoStringInterpolation_string_multiLineIntoSingle() {
-    indexTestUnit(r'''
+  test_OK_intoStringInterpolation_string_multiLineIntoSingle() async {
+    await indexTestUnit(r'''
 main() {
   String a = """aaa""";
   String b = "$a bbb";
@@ -349,8 +350,8 @@
 ''');
   }
 
-  test_OK_intoStringInterpolation_string_raw() {
-    indexTestUnit(r'''
+  test_OK_intoStringInterpolation_string_raw() async {
+    await indexTestUnit(r'''
 main() {
   String a = r'an $ignored interpolation';
   String b = '$a bbb';
@@ -365,8 +366,8 @@
 ''');
   }
 
-  test_OK_intoStringInterpolation_string_singleLineIntoMulti_doubleQuotes() {
-    indexTestUnit(r'''
+  test_OK_intoStringInterpolation_string_singleLineIntoMulti_doubleQuotes() async {
+    await indexTestUnit(r'''
 main() {
   String a = "aaa";
   String b = """$a bbb""";
@@ -381,8 +382,8 @@
 ''');
   }
 
-  test_OK_intoStringInterpolation_string_singleLineIntoMulti_singleQuotes() {
-    indexTestUnit(r"""
+  test_OK_intoStringInterpolation_string_singleLineIntoMulti_singleQuotes() async {
+    await indexTestUnit(r"""
 main() {
   String a = 'aaa';
   String b = '''$a bbb''';
@@ -397,8 +398,8 @@
 """);
   }
 
-  test_OK_intoStringInterpolation_string_singleQuotes() {
-    indexTestUnit(r'''
+  test_OK_intoStringInterpolation_string_singleQuotes() async {
+    await indexTestUnit(r'''
 main() {
   String a = 'aaa';
   String b = '$a bbb';
@@ -413,8 +414,8 @@
 ''');
   }
 
-  test_OK_intoStringInterpolation_stringInterpolation() {
-    indexTestUnit(r'''
+  test_OK_intoStringInterpolation_stringInterpolation() async {
+    await indexTestUnit(r'''
 main() {
   String a = 'aaa';
   String b = '$a bbb';
@@ -435,8 +436,8 @@
    * <p>
    * https://code.google.com/p/dart/issues/detail?id=18587
    */
-  test_OK_keepNextCommentedLine() {
-    indexTestUnit('''
+  test_OK_keepNextCommentedLine() async {
+    await indexTestUnit('''
 main() {
   int test = 1 + 2;
   // foo
@@ -455,8 +456,8 @@
 ''');
   }
 
-  test_OK_noUsages_1() {
-    indexTestUnit('''
+  test_OK_noUsages_1() async {
+    await indexTestUnit('''
 main() {
   int test = 1 + 2;
   print(0);
@@ -471,8 +472,8 @@
 ''');
   }
 
-  test_OK_noUsages_2() {
-    indexTestUnit('''
+  test_OK_noUsages_2() async {
+    await indexTestUnit('''
 main() {
   int test = 1 + 2;
 }
@@ -485,8 +486,8 @@
 ''');
   }
 
-  test_OK_oneUsage() {
-    indexTestUnit('''
+  test_OK_oneUsage() async {
+    await indexTestUnit('''
 main() {
   int test = 1 + 2;
   print(test);
@@ -501,8 +502,8 @@
 ''');
   }
 
-  test_OK_parenthesis_decrement_intoNegate() {
-    indexTestUnit('''
+  test_OK_parenthesis_decrement_intoNegate() async {
+    await indexTestUnit('''
 main() {
   var a = 1;
   var test = --a;
@@ -519,8 +520,8 @@
 ''');
   }
 
-  test_OK_parenthesis_instanceCreation_intoList() {
-    indexTestUnit('''
+  test_OK_parenthesis_instanceCreation_intoList() async {
+    await indexTestUnit('''
 class A {}
 main() {
   var test = new A();
@@ -537,8 +538,8 @@
 ''');
   }
 
-  test_OK_parenthesis_intoIndexExpression_index() {
-    indexTestUnit('''
+  test_OK_parenthesis_intoIndexExpression_index() async {
+    await indexTestUnit('''
 main() {
   var items = [];
   var test = 1 + 2;
@@ -555,8 +556,8 @@
 ''');
   }
 
-  test_OK_parenthesis_intoParenthesizedExpression() {
-    indexTestUnit('''
+  test_OK_parenthesis_intoParenthesizedExpression() async {
+    await indexTestUnit('''
 f(m, x, y) {
   int test = x as int;
   m[test] = y;
@@ -573,8 +574,8 @@
 ''');
   }
 
-  test_OK_parenthesis_negate_intoNegate() {
-    indexTestUnit('''
+  test_OK_parenthesis_negate_intoNegate() async {
+    await indexTestUnit('''
 main() {
   var a = 1;
   var test = -a;
@@ -591,8 +592,8 @@
 ''');
   }
 
-  test_OK_parenthesis_plus_intoMultiply() {
-    indexTestUnit('''
+  test_OK_parenthesis_plus_intoMultiply() async {
+    await indexTestUnit('''
 main() {
   var test = 1 + 2;
   print(test * 3);
@@ -607,8 +608,8 @@
 ''');
   }
 
-  test_OK_twoUsages() {
-    indexTestUnit('''
+  test_OK_twoUsages() async {
+    await indexTestUnit('''
 main() {
   int test = 1 + 2;
   print(test);
@@ -638,3 +639,9 @@
     refactoring = new InlineLocalRefactoring(searchEngine, testUnit, offset);
   }
 }
+
+@reflectiveTest
+class InlineLocalTest_Driver extends InlineLocalTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
index c629f93..19fead0 100644
--- a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
@@ -19,6 +19,7 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(InlineMethodTest);
+    defineReflectiveTests(InlineMethodTest_Driver);
   });
 }
 
@@ -29,7 +30,7 @@
   bool inlineAll;
 
   test_access_FunctionElement() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 test(a, b) {
   return a + b;
 }
@@ -47,7 +48,7 @@
   }
 
   test_access_MethodElement() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 class A {
   test(a, b) {
     return a + b;
@@ -66,8 +67,8 @@
     expect(refactoring.isDeclaration, isTrue);
   }
 
-  test_bad_async_intoSyncStar() {
-    indexTestUnit(r'''
+  test_bad_async_intoSyncStar() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 class A {
   Future<int> get test async => 42;
@@ -81,8 +82,8 @@
     return _assertConditionsFatal('Cannot inline async into sync*.');
   }
 
-  test_bad_async_targetIsSync_doesNotReturnFuture() {
-    indexTestUnit(r'''
+  test_bad_async_targetIsSync_doesNotReturnFuture() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 class A {
   Future<int> get test async => 42;
@@ -98,8 +99,8 @@
         'Cannot inline async into a function that does not return a Future.');
   }
 
-  test_bad_asyncStar() {
-    indexTestUnit(r'''
+  test_bad_asyncStar() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 class A {
   Stream<int> test() async* {
@@ -117,7 +118,7 @@
   }
 
   test_bad_cascadeInvocation() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 class A {
   foo() {}
   bar() {}
@@ -137,8 +138,8 @@
         expectedContextRange: location);
   }
 
-  test_bad_constructor() {
-    indexTestUnit(r'''
+  test_bad_constructor() async {
+    await indexTestUnit(r'''
 class A {
   A.named() {}
 }
@@ -149,7 +150,7 @@
   }
 
   test_bad_deleteSource_inlineOne() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 test(a, b) {
   return a + b;
 }
@@ -171,8 +172,8 @@
             'All references must be inlined to remove the source.');
   }
 
-  test_bad_notExecutableElement() {
-    indexTestUnit(r'''
+  test_bad_notExecutableElement() async {
+    await indexTestUnit(r'''
 main() {
 }
 ''');
@@ -181,8 +182,8 @@
     return _assertInvalidSelection();
   }
 
-  test_bad_notSimpleIdentifier() {
-    indexTestUnit(r'''
+  test_bad_notSimpleIdentifier() async {
+    await indexTestUnit(r'''
 main() {
   var test = 42;
   var res = test;
@@ -193,8 +194,8 @@
     return _assertInvalidSelection();
   }
 
-  test_bad_operator() {
-    indexTestUnit(r'''
+  test_bad_operator() async {
+    await indexTestUnit(r'''
 class A {
   operator -(other) => this;
 }
@@ -204,8 +205,8 @@
     return _assertConditionsFatal('Cannot inline operator.');
   }
 
-  test_bad_propertyAccessor_synthetic() {
-    indexTestUnit(r'''
+  test_bad_propertyAccessor_synthetic() async {
+    await indexTestUnit(r'''
 class A {
   int fff;
 }
@@ -219,8 +220,8 @@
     return _assertInvalidSelection();
   }
 
-  test_bad_reference_toClassMethod() {
-    indexTestUnit(r'''
+  test_bad_reference_toClassMethod() async {
+    await indexTestUnit(r'''
 class A {
   test(a, b) {
     print(a);
@@ -236,8 +237,8 @@
     return _assertConditionsFatal('Cannot inline class method reference.');
   }
 
-  test_bad_severalReturns() {
-    indexTestUnit(r'''
+  test_bad_severalReturns() async {
+    await indexTestUnit(r'''
 test() {
   if (true) {
     return 1;
@@ -253,8 +254,8 @@
     return _assertConditionsError('Ambiguous return value.');
   }
 
-  test_fieldAccessor_getter() {
-    indexTestUnit(r'''
+  test_fieldAccessor_getter() async {
+    await indexTestUnit(r'''
 class A {
   var f;
   get foo {
@@ -279,8 +280,8 @@
 ''');
   }
 
-  test_fieldAccessor_getter_PropertyAccess() {
-    indexTestUnit(r'''
+  test_fieldAccessor_getter_PropertyAccess() async {
+    await indexTestUnit(r'''
 class A {
   var f;
   get foo {
@@ -311,8 +312,8 @@
 ''');
   }
 
-  test_fieldAccessor_setter() {
-    indexTestUnit(r'''
+  test_fieldAccessor_setter() async {
+    await indexTestUnit(r'''
 class A {
   var f;
   set foo(x) {
@@ -337,8 +338,8 @@
 ''');
   }
 
-  test_fieldAccessor_setter_PropertyAccess() {
-    indexTestUnit(r'''
+  test_fieldAccessor_setter_PropertyAccess() async {
+    await indexTestUnit(r'''
 class A {
   var f;
   set foo(x) {
@@ -369,8 +370,8 @@
 ''');
   }
 
-  test_function_expressionFunctionBody() {
-    indexTestUnit(r'''
+  test_function_expressionFunctionBody() async {
+    await indexTestUnit(r'''
 test(a, b) => a + b;
 main() {
   print(test(1, 2));
@@ -385,8 +386,8 @@
 ''');
   }
 
-  test_function_hasReturn_assign() {
-    indexTestUnit(r'''
+  test_function_hasReturn_assign() async {
+    await indexTestUnit(r'''
 test(a, b) {
   print(a);
   print(b);
@@ -409,8 +410,8 @@
 ''');
   }
 
-  test_function_hasReturn_hasReturnType() {
-    indexTestUnit(r'''
+  test_function_hasReturn_hasReturnType() async {
+    await indexTestUnit(r'''
 int test(a, b) {
   return a + b;
 }
@@ -427,8 +428,8 @@
 ''');
   }
 
-  test_function_hasReturn_noVars_oneUsage() {
-    indexTestUnit(r'''
+  test_function_hasReturn_noVars_oneUsage() async {
+    await indexTestUnit(r'''
 test(a, b) {
   print(a);
   print(b);
@@ -449,8 +450,8 @@
 ''');
   }
 
-  test_function_multilineString() {
-    indexTestUnit(r"""
+  test_function_multilineString() async {
+    await indexTestUnit(r"""
 main() {
   {
     test();
@@ -477,8 +478,8 @@
 """);
   }
 
-  test_function_noReturn_hasVars_hasConflict_fieldSuperClass() {
-    indexTestUnit(r'''
+  test_function_noReturn_hasVars_hasConflict_fieldSuperClass() async {
+    await indexTestUnit(r'''
 class A {
   var c;
 }
@@ -507,8 +508,8 @@
 ''');
   }
 
-  test_function_noReturn_hasVars_hasConflict_fieldThisClass() {
-    indexTestUnit(r'''
+  test_function_noReturn_hasVars_hasConflict_fieldThisClass() async {
+    await indexTestUnit(r'''
 class A {
   var c;
   foo() {
@@ -533,8 +534,8 @@
 ''');
   }
 
-  test_function_noReturn_hasVars_hasConflict_localAfter() {
-    indexTestUnit(r'''
+  test_function_noReturn_hasVars_hasConflict_localAfter() async {
+    await indexTestUnit(r'''
 test(a, b) {
   var c = a + b;
   print(c);
@@ -555,8 +556,8 @@
 ''');
   }
 
-  test_function_noReturn_hasVars_hasConflict_localBefore() {
-    indexTestUnit(r'''
+  test_function_noReturn_hasVars_hasConflict_localBefore() async {
+    await indexTestUnit(r'''
 test(a, b) {
   var c = a + b;
   print(c);
@@ -577,8 +578,8 @@
 ''');
   }
 
-  test_function_noReturn_hasVars_noConflict() {
-    indexTestUnit(r'''
+  test_function_noReturn_hasVars_noConflict() async {
+    await indexTestUnit(r'''
 test(a, b) {
   var c = a + b;
   print(c);
@@ -597,8 +598,8 @@
 ''');
   }
 
-  test_function_noReturn_noVars_oneUsage() {
-    indexTestUnit(r'''
+  test_function_noReturn_noVars_oneUsage() async {
+    await indexTestUnit(r'''
 test(a, b) {
   print(a);
   print(b);
@@ -617,8 +618,8 @@
 ''');
   }
 
-  test_function_noReturn_noVars_useIndentation() {
-    indexTestUnit(r'''
+  test_function_noReturn_noVars_useIndentation() async {
+    await indexTestUnit(r'''
 test(a, b) {
   print(a);
   print(b);
@@ -641,8 +642,8 @@
 ''');
   }
 
-  test_function_noReturn_voidReturnType() {
-    indexTestUnit(r'''
+  test_function_noReturn_voidReturnType() async {
+    await indexTestUnit(r'''
 void test(a, b) {
   print(a + b);
 }
@@ -659,8 +660,8 @@
 ''');
   }
 
-  test_function_notStatement_oneStatement_assign() {
-    indexTestUnit(r'''
+  test_function_notStatement_oneStatement_assign() async {
+    await indexTestUnit(r'''
 test(int p) {
   print(p * 2);
 }
@@ -681,8 +682,8 @@
 ''');
   }
 
-  test_function_notStatement_oneStatement_variableDeclaration() {
-    indexTestUnit(r'''
+  test_function_notStatement_oneStatement_variableDeclaration() async {
+    await indexTestUnit(r'''
 test(int p) {
   print(p * 2);
 }
@@ -701,8 +702,8 @@
 ''');
   }
 
-  test_function_notStatement_severalStatements() {
-    indexTestUnit(r'''
+  test_function_notStatement_severalStatements() async {
+    await indexTestUnit(r'''
 test(int p) {
   print(p);
   print(p * 2);
@@ -723,8 +724,8 @@
 ''');
   }
 
-  test_function_notStatement_zeroStatements() {
-    indexTestUnit(r'''
+  test_function_notStatement_zeroStatements() async {
+    await indexTestUnit(r'''
 test(int p) {
 }
 main() {
@@ -741,8 +742,8 @@
 ''');
   }
 
-  test_function_singleStatement() {
-    indexTestUnit(r'''
+  test_function_singleStatement() async {
+    await indexTestUnit(r'''
 var topLevelField = 0;
 test() {
   print(topLevelField);
@@ -761,8 +762,8 @@
 ''');
   }
 
-  test_getter_async_targetIsAsync() {
-    indexTestUnit(r'''
+  test_getter_async_targetIsAsync() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 class A {
   Future<int> get test async => 42;
@@ -783,13 +784,13 @@
 ''');
   }
 
-  test_getter_async_targetIsAsyncStar() {
-    indexTestUnit(r'''
+  test_getter_async_targetIsAsyncStar() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 class A {
   Future<int> get test async => 42;
-  Stream<int> foo() async {
-    return await test;
+  Stream<int> foo() async* {
+    yield await test;
   }
 }
 ''');
@@ -798,15 +799,15 @@
     return _assertSuccessfulRefactoring(r'''
 import 'dart:async';
 class A {
-  Stream<int> foo() async {
-    return await 42;
+  Stream<int> foo() async* {
+    yield await 42;
   }
 }
 ''');
   }
 
-  test_getter_async_targetIsSync() {
-    indexTestUnit(r'''
+  test_getter_async_targetIsSync() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 class A {
   Future<int> get test async => 42;
@@ -827,8 +828,8 @@
 ''');
   }
 
-  test_getter_async_targetIsSync2() {
-    indexTestUnit(r'''
+  test_getter_async_targetIsSync2() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 class A {
   Future<int> get test async => 42;
@@ -855,8 +856,8 @@
 ''');
   }
 
-  test_getter_classMember_instance() {
-    indexTestUnit(r'''
+  test_getter_classMember_instance() async {
+    await indexTestUnit(r'''
 class A {
   int f;
   int get result => f + 1;
@@ -877,8 +878,8 @@
 ''');
   }
 
-  test_getter_classMember_static() {
-    indexTestUnit(r'''
+  test_getter_classMember_static() async {
+    await indexTestUnit(r'''
 class A {
   static int get result => 1 + 2;
 }
@@ -897,8 +898,8 @@
 ''');
   }
 
-  test_getter_topLevel() {
-    indexTestUnit(r'''
+  test_getter_topLevel() async {
+    await indexTestUnit(r'''
 String get message => 'Hello, World!';
 main() {
   print(message);
@@ -914,7 +915,7 @@
   }
 
   test_initialMode_all() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 test(a, b) {
   return a + b;
 }
@@ -930,7 +931,7 @@
   }
 
   test_initialMode_single() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 test(a, b) {
   return a + b;
 }
@@ -947,8 +948,8 @@
     expect(refactoring.inlineAll, false);
   }
 
-  test_method_async() {
-    indexTestUnit(r'''
+  test_method_async() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 class A {
   Future<int> test() async => 42;
@@ -969,13 +970,14 @@
 ''');
   }
 
-  test_method_async2() {
-    indexTestUnit(r'''
+  test_method_async2() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 class A {
-  Future<int> test() async => 42;
-  Future foo() {
-    return [test(), test()];
+  Future<int> foo() async => 42;
+  Future<int> test() async => await foo();
+  Future bar() {
+    return new Future.value([test(), test()]);
   }
 }
 ''');
@@ -984,15 +986,16 @@
     return _assertSuccessfulRefactoring(r'''
 import 'dart:async';
 class A {
-  Future foo() async {
-    return [42, 42];
+  Future<int> foo() async => 42;
+  Future bar() async {
+    return new Future.value([(await foo()), (await foo())]);
   }
 }
 ''');
   }
 
-  test_method_emptyBody() {
-    indexTestUnit(r'''
+  test_method_emptyBody() async {
+    await indexTestUnit(r'''
 abstract class A {
   test();
 }
@@ -1005,8 +1008,8 @@
     return _assertConditionsFatal('Cannot inline method without body.');
   }
 
-  test_method_fieldInstance() {
-    indexTestUnit(r'''
+  test_method_fieldInstance() async {
+    await indexTestUnit(r'''
 class A {
   var fA;
 }
@@ -1043,15 +1046,14 @@
 ''');
   }
 
-  test_method_fieldStatic() {
-    indexTestUnit(r'''
+  test_method_fieldStatic() async {
+    await indexTestUnit(r'''
 class A {
   static var FA = 1;
 }
 class B extends A {
   static var FB = 2;
   test() {
-    print(FA);
     print(FB);
     print(A.FA);
     print(B.FB);
@@ -1073,7 +1075,6 @@
 }
 main() {
   B b = new B();
-  print(A.FA);
   print(B.FB);
   print(A.FA);
   print(B.FB);
@@ -1081,8 +1082,8 @@
 ''');
   }
 
-  test_method_fieldStatic_sameClass() {
-    indexTestUnit(r'''
+  test_method_fieldStatic_sameClass() async {
+    await indexTestUnit(r'''
 class A {
   static var F = 1;
   foo() {
@@ -1105,8 +1106,8 @@
 ''');
   }
 
-  test_method_methodInstance() {
-    indexTestUnit(r'''
+  test_method_methodInstance() async {
+    await indexTestUnit(r'''
 class A {
   ma() {}
 }
@@ -1141,8 +1142,8 @@
 ''');
   }
 
-  test_method_methodStatic() {
-    indexTestUnit(r'''
+  test_method_methodStatic() async {
+    await indexTestUnit(r'''
 class A {
   static ma() {}
 }
@@ -1180,8 +1181,8 @@
 ''');
   }
 
-  test_method_singleStatement() {
-    indexTestUnit(r'''
+  test_method_singleStatement() async {
+    await indexTestUnit(r'''
 class A {
   test() {
     print(0);
@@ -1202,8 +1203,8 @@
 ''');
   }
 
-  test_method_this() {
-    indexTestUnit(r'''
+  test_method_this() async {
+    await indexTestUnit(r'''
 class A {
   accept(B b) {}
 }
@@ -1236,8 +1237,8 @@
 ''');
   }
 
-  test_method_unqualifiedInvocation() {
-    indexTestUnit(r'''
+  test_method_unqualifiedInvocation() async {
+    await indexTestUnit(r'''
 class A {
   test(a, b) {
     print(a);
@@ -1262,8 +1263,8 @@
 ''');
   }
 
-  test_namedArgument_inBody() {
-    indexTestUnit(r'''
+  test_namedArgument_inBody() async {
+    await indexTestUnit(r'''
 fa(pa) => fb(pb: true);
 fb({pb: false}) {}
 main() {
@@ -1281,8 +1282,8 @@
 ''');
   }
 
-  test_namedArguments() {
-    indexTestUnit(r'''
+  test_namedArguments() async {
+    await indexTestUnit(r'''
 test({a: 0, b: 2}) {
   print(a + b);
 }
@@ -1301,9 +1302,9 @@
 ''');
   }
 
-  test_noArgument_named_hasDefault() {
+  test_noArgument_named_hasDefault() async {
     verifyNoTestUnitErrors = false;
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 test({a: 42}) {
   print(a);
 }
@@ -1320,9 +1321,9 @@
 ''');
   }
 
-  test_noArgument_positional_hasDefault() {
+  test_noArgument_positional_hasDefault() async {
     verifyNoTestUnitErrors = false;
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 test([a = 42]) {
   print(a);
 }
@@ -1339,9 +1340,9 @@
 ''');
   }
 
-  test_noArgument_positional_noDefault() {
+  test_noArgument_positional_noDefault() async {
     verifyNoTestUnitErrors = false;
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 test([a]) {
   print(a);
 }
@@ -1360,7 +1361,7 @@
 
   test_noArgument_required() async {
     verifyNoTestUnitErrors = false;
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 test(a) {
   print(a);
 }
@@ -1377,8 +1378,8 @@
         expectedContextRange: location);
   }
 
-  test_reference_expressionBody() {
-    indexTestUnit(r'''
+  test_reference_expressionBody() async {
+    await indexTestUnit(r'''
 String message() => 'Hello, World!';
 main() {
   print(message);
@@ -1393,8 +1394,8 @@
 ''');
   }
 
-  test_reference_noStatement() {
-    indexTestUnit(r'''
+  test_reference_noStatement() async {
+    await indexTestUnit(r'''
 test(a, b) {
   return a || b;
 }
@@ -1417,8 +1418,8 @@
 ''');
   }
 
-  test_reference_toLocal() {
-    indexTestUnit(r'''
+  test_reference_toLocal() async {
+    await indexTestUnit(r'''
 main() {
   test(a, b) {
     print(a);
@@ -1439,8 +1440,8 @@
 ''');
   }
 
-  test_reference_toTopLevel() {
-    indexTestUnit(r'''
+  test_reference_toTopLevel() async {
+    await indexTestUnit(r'''
 test(a, b) {
   print(a);
   print(b);
@@ -1461,8 +1462,8 @@
 ''');
   }
 
-  test_removeEmptyLinesBefore_method() {
-    indexTestUnit(r'''
+  test_removeEmptyLinesBefore_method() async {
+    await indexTestUnit(r'''
 class A {
   before() {
   }
@@ -1491,8 +1492,8 @@
 ''');
   }
 
-  test_setter_classMember_instance() {
-    indexTestUnit(r'''
+  test_setter_classMember_instance() async {
+    await indexTestUnit(r'''
 class A {
   int f;
   void set result(x) {
@@ -1515,8 +1516,8 @@
 ''');
   }
 
-  test_setter_topLevel() {
-    indexTestUnit(r'''
+  test_setter_topLevel() async {
+    await indexTestUnit(r'''
 void set result(x) {
   print(x + 1);
 }
@@ -1533,8 +1534,8 @@
 ''');
   }
 
-  test_singleExpression_oneUsage() {
-    indexTestUnit(r'''
+  test_singleExpression_oneUsage() async {
+    await indexTestUnit(r'''
 test(a, b) {
   return a + b;
 }
@@ -1551,8 +1552,8 @@
 ''');
   }
 
-  test_singleExpression_oneUsage_keepMethod() {
-    indexTestUnit(r'''
+  test_singleExpression_oneUsage_keepMethod() async {
+    await indexTestUnit(r'''
 test(a, b) {
   return a + b;
 }
@@ -1573,8 +1574,8 @@
 ''');
   }
 
-  test_singleExpression_twoUsages() {
-    indexTestUnit(r'''
+  test_singleExpression_twoUsages() async {
+    await indexTestUnit(r'''
 test(a, b) {
   return a + b;
 }
@@ -1593,8 +1594,8 @@
 ''');
   }
 
-  test_singleExpression_twoUsages_inlineOne() {
-    indexTestUnit(r'''
+  test_singleExpression_twoUsages_inlineOne() async {
+    await indexTestUnit(r'''
 test(a, b) {
   return a + b;
 }
@@ -1616,8 +1617,8 @@
 ''');
   }
 
-  test_singleExpression_wrapIntoParenthesized_alreadyInMethod() {
-    indexTestUnit(r'''
+  test_singleExpression_wrapIntoParenthesized_alreadyInMethod() async {
+    await indexTestUnit(r'''
 test(a, b) {
   return a * (b);
 }
@@ -1634,8 +1635,8 @@
 ''');
   }
 
-  test_singleExpression_wrapIntoParenthesized_asNeeded() {
-    indexTestUnit(r'''
+  test_singleExpression_wrapIntoParenthesized_asNeeded() async {
+    await indexTestUnit(r'''
 test(a, b) {
   return a * b;
 }
@@ -1654,8 +1655,8 @@
 ''');
   }
 
-  test_singleExpression_wrapIntoParenthesized_bool() {
-    indexTestUnit(r'''
+  test_singleExpression_wrapIntoParenthesized_bool() async {
+    await indexTestUnit(r'''
 test(bool a, bool b) {
   return a || b;
 }
@@ -1713,6 +1714,12 @@
   void _createRefactoring(String search) {
     int offset = findOffset(search);
     refactoring = new InlineMethodRefactoring(
-        searchEngine, (element) async => element.unit, testUnit, offset);
+        searchEngine, getResolvedUnitWithElement, testUnit, offset);
   }
 }
+
+@reflectiveTest
+class InlineMethodTest_Driver extends InlineMethodTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/move_file_test.dart b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
index c0cecec..a421d21 100644
--- a/pkg/analysis_server/test/services/refactoring/move_file_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
@@ -13,7 +13,6 @@
 import 'package:analyzer/src/generated/source.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
-import '../../abstract_context.dart';
 import 'abstract_refactoring.dart';
 
 main() {
@@ -114,7 +113,7 @@
       'my_pkg': <Folder>[provider.getResource('/packages/my_pkg/lib')]
     };
     context.sourceFactory = new SourceFactory([
-      AbstractContextTest.SDK_RESOLVER,
+      new DartUriResolver(sdk),
       new PackageMapUriResolver(provider, packageMap),
       resourceResolver
     ]);
@@ -241,7 +240,7 @@
 ''');
     // configure Uri resolves
     context.sourceFactory = new SourceFactory([
-      AbstractContextTest.SDK_RESOLVER,
+      new DartUriResolver(sdk),
       new PackageMapUriResolver(provider, <String, List<Folder>>{
         'testName': <Folder>[provider.getResource('/testName/lib')]
       }),
diff --git a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
index e65a6e0..3997aee 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_class_member_test.dart
@@ -15,13 +15,14 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(RenameClassMemberTest);
+    defineReflectiveTests(RenameClassMemberTest_Driver);
   });
 }
 
 @reflectiveTest
 class RenameClassMemberTest extends RenameRefactoringTest {
   test_checkFinalConditions_classNameConflict_sameClass() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class NewName {
   void test() {}
 }
@@ -37,7 +38,7 @@
   }
 
   test_checkFinalConditions_classNameConflict_subClass() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   void test() {} // 1
 }
@@ -56,7 +57,7 @@
   }
 
   test_checkFinalConditions_classNameConflict_superClass() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class NewName {
   void test() {} // 1
 }
@@ -75,7 +76,7 @@
   }
 
   test_checkFinalConditions_hasMember_MethodElement() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
   newName() {} // existing
@@ -92,7 +93,7 @@
   }
 
   test_checkFinalConditions_OK_dropSuffix() async {
-    indexTestUnit(r'''
+    await indexTestUnit(r'''
 abstract class A {
   void testOld();
 }
@@ -108,7 +109,7 @@
   }
 
   test_checkFinalConditions_OK_noShadow() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   int newName;
 }
@@ -129,12 +130,12 @@
   }
 
   test_checkFinalConditions_publicToPrivate_usedInOtherLibrary() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
 }
 ''');
-    indexUnit(
+    await indexUnit(
         '/lib.dart',
         '''
 library my.lib;
@@ -153,7 +154,7 @@
   }
 
   test_checkFinalConditions_shadowed_byLocalFunction_inSameClass() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
   main() {
@@ -173,7 +174,7 @@
   }
 
   test_checkFinalConditions_shadowed_byLocalVariable_inSameClass() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
   main() {
@@ -193,7 +194,7 @@
   }
 
   test_checkFinalConditions_shadowed_byLocalVariable_inSubClass() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
 }
@@ -215,7 +216,7 @@
   }
 
   test_checkFinalConditions_shadowed_byLocalVariable_OK_qualifiedReference() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
   main() {
@@ -232,7 +233,7 @@
   }
 
   test_checkFinalConditions_shadowed_byLocalVariable_OK_renamedNotUsed() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
   main() {
@@ -248,7 +249,7 @@
   }
 
   test_checkFinalConditions_shadowed_byParameter_inSameClass() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
   main(newName) {
@@ -267,7 +268,7 @@
   }
 
   test_checkFinalConditions_shadowedBySub_MethodElement() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
 }
@@ -289,7 +290,7 @@
   }
 
   test_checkFinalConditions_shadowsSuper_FieldElement() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   int newName; // marker
 }
@@ -312,7 +313,7 @@
   }
 
   test_checkFinalConditions_shadowsSuper_MethodElement() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   newName() {} // marker
 }
@@ -335,8 +336,8 @@
   newName() {} // marker
 }
 ''';
-    indexUnit('/lib.dart', libCode);
-    indexTestUnit('''
+    await indexUnit('/lib.dart', libCode);
+    await indexTestUnit('''
 import 'lib.dart';
 class B extends A {
   test() {}
@@ -353,7 +354,7 @@
   }
 
   test_checkInitialConditions_inSDK() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   'abc'.toUpperCase();
 }
@@ -368,7 +369,7 @@
   }
 
   test_checkInitialConditions_operator() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   operator -(other) => this;
 }
@@ -380,8 +381,8 @@
     assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL);
   }
 
-  test_checkNewName_FieldElement() {
-    indexTestUnit('''
+  test_checkNewName_FieldElement() async {
+    await indexTestUnit('''
 class A {
   int test;
 }
@@ -397,8 +398,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_checkNewName_MethodElement() {
-    indexTestUnit('''
+  test_checkNewName_MethodElement() async {
+    await indexTestUnit('''
 class A {
   test() {}
 }
@@ -425,8 +426,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_createChange_FieldElement() {
-    indexTestUnit('''
+  test_createChange_FieldElement() async {
+    await indexTestUnit('''
 class A {
   int test; // marker
   main() {
@@ -491,8 +492,8 @@
 ''');
   }
 
-  test_createChange_FieldElement_constructorFieldInitializer() {
-    indexTestUnit('''
+  test_createChange_FieldElement_constructorFieldInitializer() async {
+    await indexTestUnit('''
 class A {
   final test;
   A() : test = 5;
@@ -512,8 +513,8 @@
 ''');
   }
 
-  test_createChange_FieldElement_fieldFormalParameter() {
-    indexTestUnit('''
+  test_createChange_FieldElement_fieldFormalParameter() async {
+    await indexTestUnit('''
 class A {
   final test;
   A(this.test);
@@ -533,8 +534,8 @@
 ''');
   }
 
-  test_createChange_FieldElement_fieldFormalParameter_named() {
-    indexTestUnit('''
+  test_createChange_FieldElement_fieldFormalParameter_named() async {
+    await indexTestUnit('''
 class A {
   final test;
   A({this.test});
@@ -560,8 +561,8 @@
 ''');
   }
 
-  test_createChange_FieldElement_invocation() {
-    indexTestUnit('''
+  test_createChange_FieldElement_invocation() async {
+    await indexTestUnit('''
 typedef F(a);
 class A {
   F test;
@@ -595,8 +596,8 @@
 ''');
   }
 
-  test_createChange_MethodElement() {
-    indexTestUnit('''
+  test_createChange_MethodElement() async {
+    await indexTestUnit('''
 class A {
   test() {}
 }
@@ -664,7 +665,7 @@
   }
 
   test_createChange_MethodElement_potential() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   test() {}
 }
@@ -695,14 +696,14 @@
 
   test_createChange_MethodElement_potential_inPubCache() async {
     String pkgLib = '/.pub-cache/lib.dart';
-    indexUnit(
+    await indexUnit(
         pkgLib,
         r'''
 processObj(p) {
   p.test();
 }
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 import '$pkgLib';
 class A {
   test() {}
@@ -731,7 +732,7 @@
   }
 
   test_createChange_MethodElement_potential_private_otherLibrary() async {
-    indexUnit(
+    await indexUnit(
         '/lib.dart',
         '''
 library lib;
@@ -739,7 +740,7 @@
   p._test();
 }
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   _test() {}
 }
@@ -766,8 +767,8 @@
     assertNoFileChange('/lib.dart');
   }
 
-  test_createChange_PropertyAccessorElement_getter() {
-    indexTestUnit('''
+  test_createChange_PropertyAccessorElement_getter() async {
+    await indexTestUnit('''
 class A {
   get test {} // marker
   set test(x) {}
@@ -821,8 +822,8 @@
 ''');
   }
 
-  test_createChange_PropertyAccessorElement_setter() {
-    indexTestUnit('''
+  test_createChange_PropertyAccessorElement_setter() async {
+    await indexTestUnit('''
 class A {
   get test {}
   set test(x) {} // marker
@@ -876,8 +877,8 @@
 ''');
   }
 
-  test_createChange_TypeParameterElement() {
-    indexTestUnit('''
+  test_createChange_TypeParameterElement() async {
+    await indexTestUnit('''
 class A<Test> {
   Test field;
   List<Test> items;
@@ -900,3 +901,27 @@
 ''');
   }
 }
+
+@reflectiveTest
+class RenameClassMemberTest_Driver extends RenameClassMemberTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  @failingTest
+  @override
+  test_checkFinalConditions_shadowed_byLocalFunction_inSameClass() {
+    return super.test_checkFinalConditions_shadowed_byLocalFunction_inSameClass();
+  }
+
+  @failingTest
+  @override
+  test_checkFinalConditions_shadowed_byLocalVariable_inSameClass() {
+    return super.test_checkFinalConditions_shadowed_byLocalVariable_inSameClass();
+  }
+
+  @failingTest
+  @override
+  test_checkFinalConditions_shadowed_byLocalVariable_inSubClass() {
+    return super.test_checkFinalConditions_shadowed_byLocalVariable_inSubClass();
+  }
+}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
index afc7782..b018389 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart
@@ -17,13 +17,14 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(RenameConstructorTest);
+    defineReflectiveTests(RenameConstructorTest_Driver);
   });
 }
 
 @reflectiveTest
 class RenameConstructorTest extends RenameRefactoringTest {
   test_checkInitialConditions_inSDK() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   new String.fromCharCodes([]);
 }
@@ -37,8 +38,8 @@
             "The constructor 'String.fromCharCodes' is defined in the SDK, so cannot be renamed.");
   }
 
-  test_checkNewName() {
-    indexTestUnit('''
+  test_checkNewName() async {
+    await indexTestUnit('''
 class A {
   A.test() {}
 }
@@ -65,7 +66,7 @@
   }
 
   test_checkNewName_hasMember_constructor() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   A.test() {}
   A.newName() {} // existing
@@ -82,7 +83,7 @@
   }
 
   test_checkNewName_hasMember_method() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   A.test() {}
   newName() {} // existing
@@ -98,8 +99,8 @@
         expectedContextSearch: 'newName() {} // existing');
   }
 
-  test_createChange_add() {
-    indexTestUnit('''
+  test_createChange_add() async {
+    await indexTestUnit('''
 class A {
   A() {} // marker
 }
@@ -132,8 +133,8 @@
 ''');
   }
 
-  test_createChange_add_toSynthetic() {
-    indexTestUnit('''
+  test_createChange_add_toSynthetic() async {
+    await indexTestUnit('''
 class A {
 }
 class B extends A {
@@ -165,8 +166,8 @@
 ''');
   }
 
-  test_createChange_change() {
-    indexTestUnit('''
+  test_createChange_change() async {
+    await indexTestUnit('''
 class A {
   A.test() {} // marker
 }
@@ -199,8 +200,8 @@
 ''');
   }
 
-  test_createChange_remove() {
-    indexTestUnit('''
+  test_createChange_remove() async {
+    await indexTestUnit('''
 class A {
   A.test() {} // marker
 }
@@ -233,7 +234,7 @@
 ''');
   }
 
-  void test_newInstance_nullElement() {
+  test_newInstance_nullElement() async {
     RenameRefactoring refactoring = new RenameRefactoring(searchEngine, null);
     expect(refactoring, isNull);
   }
@@ -250,3 +251,9 @@
     createRenameRefactoringForElement(element);
   }
 }
+
+@reflectiveTest
+class RenameConstructorTest_Driver extends RenameConstructorTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_import_test.dart b/pkg/analysis_server/test/services/refactoring/rename_import_test.dart
index f2df10b..5f13597 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_import_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_import_test.dart
@@ -14,13 +14,14 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(RenameImportTest);
+    defineReflectiveTests(RenameImportTest_Driver);
   });
 }
 
 @reflectiveTest
 class RenameImportTest extends RenameRefactoringTest {
-  test_checkNewName() {
-    indexTestUnit("import 'dart:async' as test;");
+  test_checkNewName() async {
+    await indexTestUnit("import 'dart:async' as test;");
     _createRefactoring("import 'dart:");
     expect(refactoring.oldName, 'test');
     // null
@@ -42,8 +43,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_createChange_add() {
-    indexTestUnit('''
+  test_createChange_add() async {
+    await indexTestUnit('''
 import 'dart:async';
 import 'dart:math' show Random, min hide max;
 main() {
@@ -68,8 +69,8 @@
 ''');
   }
 
-  test_createChange_add_interpolationExpression_hasCurlyBrackets() {
-    indexTestUnit(r'''
+  test_createChange_add_interpolationExpression_hasCurlyBrackets() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 main() {
   Future f;
@@ -90,8 +91,8 @@
 ''');
   }
 
-  test_createChange_add_interpolationExpression_noCurlyBrackets() {
-    indexTestUnit(r'''
+  test_createChange_add_interpolationExpression_noCurlyBrackets() async {
+    await indexTestUnit(r'''
 import 'dart:async';
 main() {
   Future f;
@@ -112,8 +113,8 @@
 ''');
   }
 
-  test_createChange_change_className() {
-    indexTestUnit('''
+  test_createChange_change_className() async {
+    await indexTestUnit('''
 import 'dart:math' as test;
 import 'dart:async' as test;
 main() {
@@ -135,8 +136,8 @@
 ''');
   }
 
-  test_createChange_change_function() {
-    indexTestUnit('''
+  test_createChange_change_function() async {
+    await indexTestUnit('''
 import 'dart:math' as test;
 import 'dart:async' as test;
 main() {
@@ -160,8 +161,8 @@
 ''');
   }
 
-  test_createChange_change_onPrefixElement() {
-    indexTestUnit('''
+  test_createChange_change_onPrefixElement() async {
+    await indexTestUnit('''
 import 'dart:async' as test;
 import 'dart:math' as test;
 main() {
@@ -187,8 +188,8 @@
 ''');
   }
 
-  test_createChange_remove() {
-    indexTestUnit('''
+  test_createChange_remove() async {
+    await indexTestUnit('''
 import 'dart:math' as test;
 import 'dart:async' as test;
 main() {
@@ -210,8 +211,8 @@
 ''');
   }
 
-  test_oldName_empty() {
-    indexTestUnit('''
+  test_oldName_empty() async {
+    await indexTestUnit('''
 import 'dart:math';
 import 'dart:async';
 main() {
@@ -230,3 +231,9 @@
     createRenameRefactoringForElement(directive.element);
   }
 }
+
+@reflectiveTest
+class RenameImportTest_Driver extends RenameImportTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_label_test.dart b/pkg/analysis_server/test/services/refactoring/rename_label_test.dart
index c1e995f..8d5d17b 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_label_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_label_test.dart
@@ -13,13 +13,14 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(RenameLabelTest);
+    defineReflectiveTests(RenameLabelTest_Driver);
   });
 }
 
 @reflectiveTest
 class RenameLabelTest extends RenameRefactoringTest {
-  test_checkNewName_LocalVariableElement() {
-    indexTestUnit('''
+  test_checkNewName_LocalVariableElement() async {
+    await indexTestUnit('''
 main() {
 test:
   while (true) {
@@ -43,8 +44,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_createChange() {
-    indexTestUnit('''
+  test_createChange() async {
+    await indexTestUnit('''
 main() {
 test:
   while (true) {
@@ -68,8 +69,8 @@
 ''');
   }
 
-  test_oldName() {
-    indexTestUnit('''
+  test_oldName() async {
+    await indexTestUnit('''
 main() {
 test:
   while (true) {
@@ -83,3 +84,9 @@
     expect(refactoring.oldName, 'test');
   }
 }
+
+@reflectiveTest
+class RenameLabelTest_Driver extends RenameLabelTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_library_test.dart b/pkg/analysis_server/test/services/refactoring/rename_library_test.dart
index fd58cc2..e49de69 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_library_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_library_test.dart
@@ -14,13 +14,14 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(RenameLibraryTest);
+    defineReflectiveTests(RenameLibraryTest_Driver);
   });
 }
 
 @reflectiveTest
 class RenameLibraryTest extends RenameRefactoringTest {
-  void test_checkNewName() {
-    indexTestUnit('''
+  test_checkNewName() async {
+    await indexTestUnit('''
 library my.app;
 ''');
     _createRenameRefactoring();
@@ -48,11 +49,13 @@
         '''
 part of my.app;
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 library my.app;
 part 'part.dart';
 ''');
-    index.indexUnit(context.resolveCompilationUnit2(unitSource, testSource));
+    if (!enableNewAnalysisDriver) {
+      index.indexUnit(context.resolveCompilationUnit2(unitSource, testSource));
+    }
     // configure refactoring
     _createRenameRefactoring();
     expect(refactoring.refactoringName, 'Rename Library');
@@ -76,11 +79,13 @@
         '''
 part of my .  app;
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 library my    . app;
 part 'part.dart';
 ''');
-    index.indexUnit(context.resolveCompilationUnit2(unitSource, testSource));
+    if (!enableNewAnalysisDriver) {
+      index.indexUnit(context.resolveCompilationUnit2(unitSource, testSource));
+    }
     // configure refactoring
     _createRenameRefactoring();
     expect(refactoring.refactoringName, 'Rename Library');
@@ -102,3 +107,9 @@
     createRenameRefactoringForElement(testUnitElement.library);
   }
 }
+
+@reflectiveTest
+class RenameLibraryTest_Driver extends RenameLibraryTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
index 7cc5811..4879c76 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_local_test.dart
@@ -14,13 +14,14 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(RenameLocalTest);
+    defineReflectiveTests(RenameLocalTest_Driver);
   });
 }
 
 @reflectiveTest
 class RenameLocalTest extends RenameRefactoringTest {
   test_checkFinalConditions_hasLocalFunction_after() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int test = 0;
   newName() => 1;
@@ -36,7 +37,7 @@
   }
 
   test_checkFinalConditions_hasLocalFunction_before() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   newName() => 1;
   int test = 0;
@@ -51,7 +52,7 @@
   }
 
   test_checkFinalConditions_hasLocalVariable_after() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   int test = 0;
   var newName = 1;
@@ -69,7 +70,7 @@
   }
 
   test_checkFinalConditions_hasLocalVariable_before() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   var newName = 1;
   int test = 0;
@@ -84,8 +85,8 @@
         expectedContextSearch: 'newName = 1;');
   }
 
-  test_checkFinalConditions_hasLocalVariable_otherBlock() {
-    indexTestUnit('''
+  test_checkFinalConditions_hasLocalVariable_otherBlock() async {
+    await indexTestUnit('''
 main() {
   {
     var newName = 1;
@@ -101,8 +102,8 @@
     return assertRefactoringConditionsOK();
   }
 
-  test_checkFinalConditions_hasLocalVariable_otherForEachLoop() {
-    indexTestUnit('''
+  test_checkFinalConditions_hasLocalVariable_otherForEachLoop() async {
+    await indexTestUnit('''
 main() {
   for (int newName in []) {}
   for (int test in []) {}
@@ -114,8 +115,8 @@
     return assertRefactoringConditionsOK();
   }
 
-  test_checkFinalConditions_hasLocalVariable_otherForLoop() {
-    indexTestUnit('''
+  test_checkFinalConditions_hasLocalVariable_otherForLoop() async {
+    await indexTestUnit('''
 main() {
   for (int newName = 0; newName < 10; newName++) {}
   for (int test = 0; test < 10; test++) {}
@@ -127,8 +128,8 @@
     return assertRefactoringConditionsOK();
   }
 
-  test_checkFinalConditions_hasLocalVariable_otherFunction() {
-    indexTestUnit('''
+  test_checkFinalConditions_hasLocalVariable_otherFunction() async {
+    await indexTestUnit('''
 main() {
   int test = 0;
 }
@@ -143,7 +144,7 @@
   }
 
   test_checkFinalConditions_shadows_classMember() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   var newName = 1;
   main() {
@@ -163,19 +164,19 @@
   }
 
   test_checkFinalConditions_shadows_classMember_namedParameter() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
-  foo({test: 1}) {
+  foo({test: 1}) { // in A
   }
 }
 class B extends A {
   var newName = 1;
-  foo({test: 2}) {
+  foo({test: 1}) {
     print(newName);
   }
 }
 ''');
-    createRenameRefactoringAtString('test: 1}');
+    createRenameRefactoringAtString('test: 1}) { // in A');
     // check status
     refactoring.newName = 'newName';
     RefactoringStatus status = await refactoring.checkFinalConditions();
@@ -185,8 +186,8 @@
         expectedContextSearch: 'newName);');
   }
 
-  test_checkFinalConditions_shadows_classMemberOK_qualifiedReference() {
-    indexTestUnit('''
+  test_checkFinalConditions_shadows_classMemberOK_qualifiedReference() async {
+    await indexTestUnit('''
 class A {
   var newName = 1;
   main() {
@@ -201,8 +202,8 @@
     return assertRefactoringConditionsOK();
   }
 
-  test_checkFinalConditions_shadows_OK_namedParameterReference() {
-    indexTestUnit('''
+  test_checkFinalConditions_shadows_OK_namedParameterReference() async {
+    await indexTestUnit('''
 void f({newName}) {}
 main() {
   var test = 0;
@@ -216,7 +217,7 @@
   }
 
   test_checkFinalConditions_shadows_topLevelFunction() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 newName() {}
 main() {
   var test = 0;
@@ -231,13 +232,13 @@
         expectedContextSearch: 'newName(); // ref');
   }
 
-  test_checkNewName_FunctionElement() {
-    indexTestUnit('''
+  test_checkNewName_FunctionElement() async {
+    await indexTestUnit('''
 main() {
-  int test() {}
+  int test() => 0;
 }
 ''');
-    createRenameRefactoringAtString('test() {}');
+    createRenameRefactoringAtString('test() => 0;');
     // null
     refactoring.newName = null;
     assertRefactoringStatus(
@@ -248,8 +249,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_checkNewName_LocalVariableElement() {
-    indexTestUnit('''
+  test_checkNewName_LocalVariableElement() async {
+    await indexTestUnit('''
 main() {
   int test = 0;
 }
@@ -270,8 +271,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_checkNewName_ParameterElement() {
-    indexTestUnit('''
+  test_checkNewName_ParameterElement() async {
+    await indexTestUnit('''
 main(test) {
 }
 ''');
@@ -286,8 +287,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_createChange_localFunction() {
-    indexTestUnit('''
+  test_createChange_localFunction() async {
+    await indexTestUnit('''
 main() {
   int test() => 0;
   print(test);
@@ -309,8 +310,8 @@
 ''');
   }
 
-  test_createChange_localFunction_sameNameDifferenceScopes() {
-    indexTestUnit('''
+  test_createChange_localFunction_sameNameDifferenceScopes() async {
+    await indexTestUnit('''
 main() {
   {
     int test() => 0;
@@ -349,8 +350,8 @@
 ''');
   }
 
-  test_createChange_localVariable() {
-    indexTestUnit('''
+  test_createChange_localVariable() async {
+    await indexTestUnit('''
 main() {
   int test = 0;
   test = 1;
@@ -374,8 +375,8 @@
 ''');
   }
 
-  test_createChange_localVariable_sameNameDifferenceScopes() {
-    indexTestUnit('''
+  test_createChange_localVariable_sameNameDifferenceScopes() async {
+    await indexTestUnit('''
 main() {
   {
     int test = 0;
@@ -414,8 +415,8 @@
 ''');
   }
 
-  test_createChange_parameter() {
-    indexTestUnit('''
+  test_createChange_parameter() async {
+    await indexTestUnit('''
 myFunction({int test}) {
   test = 1;
   test += 2;
@@ -444,12 +445,12 @@
   }
 
   test_createChange_parameter_named_inOtherFile() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class A {
   A({test});
 }
 ''');
-    indexUnit(
+    await indexUnit(
         '/test2.dart',
         '''
 import 'test.dart';
@@ -478,7 +479,7 @@
   }
 
   test_createChange_parameter_named_updateHierarchy() async {
-    indexUnit(
+    await indexUnit(
         '/test2.dart',
         '''
 library test2;
@@ -493,7 +494,7 @@
   }
 }
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 import 'test2.dart';
 main() {
   new A().foo(test: 10);
@@ -541,8 +542,8 @@
 ''');
   }
 
-  test_oldName() {
-    indexTestUnit('''
+  test_oldName() async {
+    await indexTestUnit('''
 main() {
   int test = 0;
 }
@@ -553,3 +554,9 @@
     expect(refactoring.oldName, 'test');
   }
 }
+
+@reflectiveTest
+class RenameLocalTest_Driver extends RenameLocalTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
index 1ce560d..3e0fc83 100644
--- a/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/rename_unit_member_test.dart
@@ -14,13 +14,14 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(RenameUnitMemberTest);
+    defineReflectiveTests(RenameUnitMemberTest_Driver);
   });
 }
 
 @reflectiveTest
 class RenameUnitMemberTest extends RenameRefactoringTest {
   test_checkFinalConditions_hasTopLevel_ClassElement() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 class NewName {} // existing
 ''');
@@ -34,7 +35,7 @@
   }
 
   test_checkFinalConditions_hasTopLevel_FunctionTypeAliasElement() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 typedef NewName(); // existing
 ''');
@@ -49,7 +50,7 @@
   }
 
   test_checkFinalConditions_OK_qualifiedSuper_MethodElement() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 class A {
   NewName() {}
@@ -68,10 +69,10 @@
   }
 
   test_checkFinalConditions_publicToPrivate_usedInOtherLibrary() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 ''');
-    indexUnit(
+    await indexUnit(
         '/lib.dart',
         '''
 library my.lib;
@@ -90,7 +91,7 @@
   }
 
   test_checkFinalConditions_shadowedBy_MethodElement() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 class A {
   void NewName() {}
@@ -110,10 +111,10 @@
   }
 
   test_checkFinalConditions_shadowsInSubClass_importedLib() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 ''');
-    indexUnit(
+    await indexUnit(
         '/lib.dart',
         '''
 library my.lib;
@@ -136,10 +137,10 @@
   }
 
   test_checkFinalConditions_shadowsInSubClass_importedLib_hideCombinator() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 ''');
-    indexUnit(
+    await indexUnit(
         '/lib.dart',
         '''
 library my.lib;
@@ -161,7 +162,7 @@
   }
 
   test_checkFinalConditions_shadowsInSubClass_MethodElement() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 class A {
   NewName() {}
@@ -182,7 +183,7 @@
   }
 
   test_checkFinalConditions_shadowsInSubClass_notImportedLib() async {
-    indexUnit(
+    await indexUnit(
         '/lib.dart',
         '''
 library my.lib;
@@ -195,7 +196,7 @@
   }",
 }
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 ''');
     createRenameRefactoringAtString('Test {}');
@@ -206,7 +207,7 @@
   }
 
   test_checkFinalConditions_shadowsInSubClass_notSubClass() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {}
 class A {
   NewName() {}
@@ -230,7 +231,7 @@
         r'''
 class A {}
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 import '/.pub-cache/lib.dart';
 main() {
   A a;
@@ -251,7 +252,7 @@
         r'''
 class A {}
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 import '/Pub/Cache/lib.dart';
 main() {
   A a;
@@ -267,7 +268,7 @@
   }
 
   test_checkInitialConditions_inSDK() async {
-    indexTestUnit('''
+    await indexTestUnit('''
 main() {
   String s;
 }
@@ -281,8 +282,8 @@
             "The class 'String' is defined in the SDK, so cannot be renamed.");
   }
 
-  test_checkNewName_ClassElement() {
-    indexTestUnit('''
+  test_checkNewName_ClassElement() async {
+    await indexTestUnit('''
 class Test {}
 ''');
     createRenameRefactoringAtString('Test {}');
@@ -307,8 +308,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_checkNewName_FunctionElement() {
-    indexTestUnit('''
+  test_checkNewName_FunctionElement() async {
+    await indexTestUnit('''
 test() {}
 ''');
     createRenameRefactoringAtString('test() {}');
@@ -327,8 +328,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_checkNewName_FunctionTypeAliasElement() {
-    indexTestUnit('''
+  test_checkNewName_FunctionTypeAliasElement() async {
+    await indexTestUnit('''
 typedef Test();
 ''');
     createRenameRefactoringAtString('Test();');
@@ -342,8 +343,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_checkNewName_TopLevelVariableElement() {
-    indexTestUnit('''
+  test_checkNewName_TopLevelVariableElement() async {
+    await indexTestUnit('''
 var test;
 ''');
     createRenameRefactoringAtString('test;');
@@ -362,8 +363,8 @@
     assertRefactoringStatusOK(refactoring.checkNewName());
   }
 
-  test_createChange_ClassElement() {
-    indexTestUnit('''
+  test_createChange_ClassElement() async {
+    await indexTestUnit('''
 class Test implements Other {
   Test() {}
   Test.named() {}
@@ -400,9 +401,9 @@
 ''');
   }
 
-  test_createChange_ClassElement_invocation() {
+  test_createChange_ClassElement_invocation() async {
     verifyNoTestUnitErrors = false;
-    indexTestUnit('''
+    await indexTestUnit('''
 class Test {
 }
 main() {
@@ -425,8 +426,8 @@
 ''');
   }
 
-  test_createChange_ClassElement_parameterTypeNested() {
-    indexTestUnit('''
+  test_createChange_ClassElement_parameterTypeNested() async {
+    await indexTestUnit('''
 class Test {
 }
 main(f(Test p)) {
@@ -446,8 +447,8 @@
 ''');
   }
 
-  test_createChange_ClassElement_typeAlias() {
-    indexTestUnit('''
+  test_createChange_ClassElement_typeAlias() async {
+    await indexTestUnit('''
 class A {}
 class Test = Object with A;
 main(Test t) {
@@ -468,8 +469,8 @@
 ''');
   }
 
-  test_createChange_FunctionElement() {
-    indexTestUnit('''
+  test_createChange_FunctionElement() async {
+    await indexTestUnit('''
 test() {}
 foo() {}
 main() {
@@ -497,13 +498,13 @@
   }
 
   test_createChange_FunctionElement_imported() async {
-    indexUnit(
+    await indexUnit(
         '/foo.dart',
         r'''
 test() {}
 foo() {}
 ''');
-    indexTestUnit('''
+    await indexTestUnit('''
 import 'foo.dart';
 main() {
   print(test);
@@ -534,44 +535,44 @@
 ''');
   }
 
-  test_createChange_PropertyAccessorElement_getter_declaration() {
-    return _test_createChange_PropertyAccessorElement("test {}");
+  test_createChange_PropertyAccessorElement_getter_declaration() async {
+    await _test_createChange_PropertyAccessorElement("test {}");
   }
 
-  test_createChange_PropertyAccessorElement_getter_usage() {
-    return _test_createChange_PropertyAccessorElement("test);");
+  test_createChange_PropertyAccessorElement_getter_usage() async {
+    await _test_createChange_PropertyAccessorElement("test);");
   }
 
-  test_createChange_PropertyAccessorElement_mix() {
-    return _test_createChange_PropertyAccessorElement("test += 2");
+  test_createChange_PropertyAccessorElement_mix() async {
+    await _test_createChange_PropertyAccessorElement("test += 2");
   }
 
-  test_createChange_PropertyAccessorElement_setter_declaration() {
-    return _test_createChange_PropertyAccessorElement("test(x) {}");
+  test_createChange_PropertyAccessorElement_setter_declaration() async {
+    await _test_createChange_PropertyAccessorElement("test(x) {}");
   }
 
-  test_createChange_PropertyAccessorElement_setter_usage() {
-    return _test_createChange_PropertyAccessorElement("test = 1");
+  test_createChange_PropertyAccessorElement_setter_usage() async {
+    await _test_createChange_PropertyAccessorElement("test = 1");
   }
 
-  test_createChange_TopLevelVariableElement_field() {
-    return _test_createChange_TopLevelVariableElement("test = 0");
+  test_createChange_TopLevelVariableElement_field() async {
+    await _test_createChange_TopLevelVariableElement("test = 0");
   }
 
-  test_createChange_TopLevelVariableElement_getter() {
-    return _test_createChange_TopLevelVariableElement("test);");
+  test_createChange_TopLevelVariableElement_getter() async {
+    await _test_createChange_TopLevelVariableElement("test);");
   }
 
-  test_createChange_TopLevelVariableElement_mix() {
-    return _test_createChange_TopLevelVariableElement("test += 2");
+  test_createChange_TopLevelVariableElement_mix() async {
+    await _test_createChange_TopLevelVariableElement("test += 2");
   }
 
-  test_createChange_TopLevelVariableElement_setter() {
-    return _test_createChange_TopLevelVariableElement("test = 1");
+  test_createChange_TopLevelVariableElement_setter() async {
+    await _test_createChange_TopLevelVariableElement("test = 1");
   }
 
-  _test_createChange_PropertyAccessorElement(String search) {
-    indexTestUnit('''
+  _test_createChange_PropertyAccessorElement(String search) async {
+    await indexTestUnit('''
 get test {}
 set test(x) {}
 main() {
@@ -597,8 +598,8 @@
 ''');
   }
 
-  _test_createChange_TopLevelVariableElement(String search) {
-    indexTestUnit('''
+  _test_createChange_TopLevelVariableElement(String search) async {
+    await indexTestUnit('''
 int test = 0;
 main() {
   print(test);
@@ -623,3 +624,9 @@
 ''');
   }
 }
+
+@reflectiveTest
+class RenameUnitMemberTest_Driver extends RenameUnitMemberTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analysis_server/test/services/search/hierarchy_test.dart b/pkg/analysis_server/test/services/search/hierarchy_test.dart
index 618b868..e8638dc 100644
--- a/pkg/analysis_server/test/services/search/hierarchy_test.dart
+++ b/pkg/analysis_server/test/services/search/hierarchy_test.dart
@@ -8,7 +8,9 @@
 
 import 'package:analysis_server/src/services/index/index.dart';
 import 'package:analysis_server/src/services/search/hierarchy.dart';
+import 'package:analysis_server/src/services/search/search_engine.dart';
 import 'package:analysis_server/src/services/search/search_engine_internal.dart';
+import 'package:analysis_server/src/services/search/search_engine_internal2.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -18,22 +20,16 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(HierarchyTest);
+    defineReflectiveTests(HierarchyTest_Driver);
   });
 }
 
 @reflectiveTest
-class HierarchyTest extends AbstractSingleUnitTest {
-  Index index;
-  SearchEngineImpl searchEngine;
+abstract class AbstractHierarchyTest extends AbstractSingleUnitTest {
+  SearchEngine get searchEngine;
 
-  void setUp() {
-    super.setUp();
-    index = createMemoryIndex();
-    searchEngine = new SearchEngineImpl(index);
-  }
-
-  void test_getClassMembers() {
-    _indexTestUnit('''
+  test_getClassMembers() async {
+    await _indexTestUnit('''
 class A {
   A() {}
   var ma1;
@@ -58,8 +54,8 @@
     }
   }
 
-  Future test_getHierarchyMembers_constructors() {
-    _indexTestUnit('''
+  test_getHierarchyMembers_constructors() async {
+    await _indexTestUnit('''
 class A {
   A() {}
 }
@@ -80,8 +76,8 @@
     return Future.wait([futureA, futureB]);
   }
 
-  Future test_getHierarchyMembers_fields() {
-    _indexTestUnit('''
+  test_getHierarchyMembers_fields() async {
+    await _indexTestUnit('''
 class A {
   int foo;
 }
@@ -118,8 +114,8 @@
     return Future.wait([futureA, futureB, futureC, futureD]);
   }
 
-  Future test_getHierarchyMembers_fields_static() async {
-    _indexTestUnit('''
+  test_getHierarchyMembers_fields_static() async {
+    await _indexTestUnit('''
 class A {
   static int foo;
 }
@@ -153,8 +149,8 @@
     }
   }
 
-  Future test_getHierarchyMembers_methods() {
-    _indexTestUnit('''
+  test_getHierarchyMembers_methods() async {
+    await _indexTestUnit('''
 class A {
   foo() {}
 }
@@ -199,8 +195,8 @@
     return Future.wait([futureA, futureB, futureC, futureD, futureE]);
   }
 
-  Future test_getHierarchyMembers_methods_static() async {
-    _indexTestUnit('''
+  test_getHierarchyMembers_methods_static() async {
+    await _indexTestUnit('''
 class A {
   static foo() {}
 }
@@ -224,8 +220,8 @@
     }
   }
 
-  Future test_getHierarchyMembers_withInterfaces() {
-    _indexTestUnit('''
+  test_getHierarchyMembers_withInterfaces() async {
+    await _indexTestUnit('''
 class A {
   foo() {}
 }
@@ -259,8 +255,8 @@
     return Future.wait([futureA, futureB, futureD]);
   }
 
-  void test_getMembers() {
-    _indexTestUnit('''
+  test_getMembers() async {
+    await _indexTestUnit('''
 class A {
   A() {}
   var ma1;
@@ -276,51 +272,39 @@
     {
       ClassElement classA = findElement('A');
       List<Element> members = getMembers(classA);
-      expect(members.map((e) => e.name),
-          unorderedEquals(['ma1', 'ma2', '==', 'toString', 'hashCode']));
+      expect(
+          members.map((e) => e.name),
+          unorderedEquals([
+            'ma1',
+            'ma2',
+            '==',
+            'toString',
+            'hashCode',
+            'noSuchMethod',
+            'runtimeType'
+          ]));
     }
     {
       ClassElement classB = findElement('B');
       List<Element> members = getMembers(classB);
       expect(
           members.map((e) => e.name),
-          unorderedEquals(
-              ['mb1', 'mb2', 'ma1', 'ma2', '==', 'toString', 'hashCode']));
+          unorderedEquals([
+            'mb1',
+            'mb2',
+            'ma1',
+            'ma2',
+            '==',
+            'toString',
+            'hashCode',
+            'noSuchMethod',
+            'runtimeType'
+          ]));
     }
   }
 
-  Future test_getSubClasses() {
-    _indexTestUnit('''
-class A {}
-class B extends A {}
-class C extends B {}
-class D extends B implements A {}
-class M {}
-class E extends A with M {}
-''');
-    ClassElement classA = findElement("A");
-    ClassElement classB = findElement("B");
-    ClassElement classC = findElement("C");
-    ClassElement classD = findElement("D");
-    ClassElement classM = findElement("M");
-    ClassElement classE = findElement("E");
-    var futureA = getSubClasses(searchEngine, classA).then((subs) {
-      expect(subs, unorderedEquals([classB, classC, classD, classE]));
-    });
-    var futureB = getSubClasses(searchEngine, classB).then((subs) {
-      expect(subs, unorderedEquals([classC, classD]));
-    });
-    var futureC = getSubClasses(searchEngine, classC).then((subs) {
-      expect(subs, isEmpty);
-    });
-    var futureM = getSubClasses(searchEngine, classM).then((subs) {
-      expect(subs, unorderedEquals([classE]));
-    });
-    return Future.wait([futureA, futureB, futureC, futureM]);
-  }
-
-  void test_getSuperClasses() {
-    _indexTestUnit('''
+  test_getSuperClasses() async {
+    await _indexTestUnit('''
 class A {}
 class B extends A {}
 class C extends B {}
@@ -373,8 +357,40 @@
     }
   }
 
-  void _indexTestUnit(String code) {
-    resolveTestUnit(code);
+  Future<Null> _indexTestUnit(String code);
+}
+
+@reflectiveTest
+class HierarchyTest extends AbstractHierarchyTest {
+  Index index;
+  SearchEngineImpl searchEngine;
+
+  void setUp() {
+    super.setUp();
+    index = createMemoryIndex();
+    searchEngine = new SearchEngineImpl(index);
+  }
+
+  Future<Null> _indexTestUnit(String code) async {
+    await resolveTestUnit(code);
     index.indexUnit(testUnit);
   }
 }
+
+@reflectiveTest
+class HierarchyTest_Driver extends AbstractHierarchyTest {
+  SearchEngineImpl2 searchEngine;
+
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  void setUp() {
+    super.setUp();
+    searchEngine = new SearchEngineImpl2([driver]);
+  }
+
+  @override
+  Future<Null> _indexTestUnit(String code) async {
+    await resolveTestUnit(code);
+  }
+}
diff --git a/pkg/analysis_server/test/services/search/search_engine2_test.dart b/pkg/analysis_server/test/services/search/search_engine2_test.dart
new file mode 100644
index 0000000..572790e
--- /dev/null
+++ b/pkg/analysis_server/test/services/search/search_engine2_test.dart
@@ -0,0 +1,296 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:analysis_server/src/services/search/search_engine.dart';
+import 'package:analysis_server/src/services/search/search_engine_internal2.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/src/dart/analysis/file_state.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../mock_sdk.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(SearchEngineImpl2Test);
+  });
+}
+
+@reflectiveTest
+class SearchEngineImpl2Test {
+  final MemoryResourceProvider provider = new MemoryResourceProvider();
+  DartSdk sdk;
+  final ByteStore byteStore = new MemoryByteStore();
+  final FileContentOverlay contentOverlay = new FileContentOverlay();
+
+  final StringBuffer logBuffer = new StringBuffer();
+  PerformanceLog logger;
+
+  AnalysisDriverScheduler scheduler;
+
+  void setUp() {
+    sdk = new MockSdk(resourceProvider: provider);
+    logger = new PerformanceLog(logBuffer);
+    scheduler = new AnalysisDriverScheduler(logger);
+    scheduler.start();
+  }
+
+  test_searchAllSubtypes() async {
+    var p = _p('/test.dart');
+
+    provider.newFile(
+        p,
+        '''
+class T {}
+class A extends T {}
+class B extends A {}
+class C implements B {}
+''');
+
+    var driver = _newDriver();
+    driver.addFile(p);
+
+    var resultA = await driver.getResult(p);
+    ClassElement element = resultA.unit.element.types[0];
+
+    var searchEngine = new SearchEngineImpl2([driver]);
+    Set<ClassElement> subtypes = await searchEngine.searchAllSubtypes(element);
+    expect(subtypes, hasLength(3));
+    expect(subtypes, contains(predicate((ClassElement e) => e.name == 'A')));
+    expect(subtypes, contains(predicate((ClassElement e) => e.name == 'B')));
+    expect(subtypes, contains(predicate((ClassElement e) => e.name == 'C')));
+  }
+
+  test_searchAllSubtypes_acrossDrivers() async {
+    var a = _p('/test/a.dart');
+    var b = _p('/test/b.dart');
+
+    provider.newFile(
+        a,
+        '''
+class T {}
+class A extends T {}
+''');
+    provider.newFile(
+        b,
+        '''
+import 'a.dart';
+class B extends A {}
+class C extends B {}
+''');
+
+    var driver1 = _newDriver();
+    var driver2 = _newDriver();
+
+    driver1.addFile(a);
+    driver2.addFile(b);
+
+    var resultA = await driver1.getResult(a);
+    ClassElement element = resultA.unit.element.types[0];
+
+    var searchEngine = new SearchEngineImpl2([driver1, driver2]);
+    Set<ClassElement> subtypes = await searchEngine.searchAllSubtypes(element);
+    expect(subtypes, hasLength(3));
+    expect(subtypes, contains(predicate((ClassElement e) => e.name == 'A')));
+    expect(subtypes, contains(predicate((ClassElement e) => e.name == 'B')));
+    expect(subtypes, contains(predicate((ClassElement e) => e.name == 'C')));
+  }
+
+  test_searchMemberDeclarations() async {
+    var a = _p('/test/a.dart');
+    var b = _p('/test/b.dart');
+
+    var codeA = '''
+class A {
+  int test; // 1
+  int testTwo;
+}
+''';
+    var codeB = '''
+class B {
+  void test() {} // 2
+  void testTwo() {}
+}
+int test;
+''';
+
+    provider.newFile(a, codeA);
+    provider.newFile(b, codeB);
+
+    var driver1 = _newDriver();
+    var driver2 = _newDriver();
+
+    driver1.addFile(a);
+    driver2.addFile(b);
+
+    while (scheduler.isAnalyzing) {
+      await new Future.delayed(new Duration(milliseconds: 1));
+    }
+
+    var searchEngine = new SearchEngineImpl2([driver1, driver2]);
+    List<SearchMatch> matches =
+        await searchEngine.searchMemberDeclarations('test');
+    expect(matches, hasLength(2));
+
+    void assertHasElement(String name, int nameOffset) {
+      expect(
+          matches,
+          contains(predicate((SearchMatch m) =>
+              m.kind == MatchKind.DECLARATION &&
+              m.element.name == name &&
+              m.element.nameOffset == nameOffset)));
+    }
+
+    assertHasElement('test', codeA.indexOf('test; // 1'));
+    assertHasElement('test', codeB.indexOf('test() {} // 2'));
+  }
+
+  test_searchMemberReferences() async {
+    var a = _p('/test/a.dart');
+    var b = _p('/test/b.dart');
+
+    provider.newFile(
+        a,
+        '''
+class A {
+  int test;
+}
+foo(p) {
+  p.test;
+}
+''');
+    provider.newFile(
+        b,
+        '''
+import 'a.dart';
+bar(p) {
+  p.test = 1;
+}
+''');
+
+    var driver1 = _newDriver();
+    var driver2 = _newDriver();
+
+    driver1.addFile(a);
+    driver2.addFile(b);
+
+    var searchEngine = new SearchEngineImpl2([driver1, driver2]);
+    List<SearchMatch> matches =
+        await searchEngine.searchMemberReferences('test');
+    expect(matches, hasLength(2));
+    expect(
+        matches,
+        contains(predicate((SearchMatch m) =>
+            m.element.name == 'foo' || m.kind == MatchKind.READ)));
+    expect(
+        matches,
+        contains(predicate((SearchMatch m) =>
+            m.element.name == 'bar' || m.kind == MatchKind.WRITE)));
+  }
+
+  test_searchReferences() async {
+    var a = _p('/test/a.dart');
+    var b = _p('/test/b.dart');
+
+    provider.newFile(
+        a,
+        '''
+class T {}
+T a;
+''');
+    provider.newFile(
+        b,
+        '''
+import 'a.dart';
+T b;
+''');
+
+    var driver1 = _newDriver();
+    var driver2 = _newDriver();
+
+    driver1.addFile(a);
+    driver2.addFile(b);
+
+    var resultA = await driver1.getResult(a);
+    ClassElement element = resultA.unit.element.types[0];
+
+    var searchEngine = new SearchEngineImpl2([driver1, driver2]);
+    List<SearchMatch> matches = await searchEngine.searchReferences(element);
+    expect(matches, hasLength(2));
+    expect(
+        matches, contains(predicate((SearchMatch m) => m.element.name == 'a')));
+    expect(
+        matches, contains(predicate((SearchMatch m) => m.element.name == 'b')));
+  }
+
+  test_searchTopLevelDeclarations() async {
+    var a = _p('/test/a.dart');
+    var b = _p('/test/b.dart');
+
+    provider.newFile(
+        a,
+        '''
+class A {}
+int a;
+''');
+    provider.newFile(
+        b,
+        '''
+class B {}
+get b => 42;
+''');
+
+    var driver1 = _newDriver();
+    var driver2 = _newDriver();
+
+    driver1.addFile(a);
+    driver2.addFile(b);
+
+    while (scheduler.isAnalyzing) {
+      await new Future.delayed(new Duration(milliseconds: 1));
+    }
+
+    var searchEngine = new SearchEngineImpl2([driver1, driver2]);
+    List<SearchMatch> matches =
+        await searchEngine.searchTopLevelDeclarations('.*');
+    expect(
+        matches.where((match) => !match.libraryElement.isInSdk), hasLength(4));
+
+    void assertHasElement(String name) {
+      expect(
+          matches,
+          contains(predicate((SearchMatch m) =>
+              m.kind == MatchKind.DECLARATION && m.element.name == name)));
+    }
+
+    assertHasElement('A');
+    assertHasElement('a');
+    assertHasElement('B');
+    assertHasElement('b');
+  }
+
+  AnalysisDriver _newDriver() => new AnalysisDriver(
+      scheduler,
+      logger,
+      provider,
+      byteStore,
+      contentOverlay,
+      'test',
+      new SourceFactory(
+          [new DartUriResolver(sdk), new ResourceUriResolver(provider)],
+          null,
+          provider),
+      new AnalysisOptionsImpl()..strongMode = true);
+
+  String _p(String path) => provider.convertPath(path);
+}
diff --git a/pkg/analysis_server/test/services/search/search_engine_test.dart b/pkg/analysis_server/test/services/search/search_engine_test.dart
index 8072301..152364d 100644
--- a/pkg/analysis_server/test/services/search/search_engine_test.dart
+++ b/pkg/analysis_server/test/services/search/search_engine_test.dart
@@ -75,27 +75,22 @@
   }
 
   test_searchAllSubtypes() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class T {}
 class A extends T {}
 class B extends A {}
 class C implements B {}
 ''');
     ClassElement element = findElement('T');
-    ClassElement elementA = findElement('A');
-    ClassElement elementB = findElement('B');
-    ClassElement elementC = findElement('C');
-    var expected = [
-      _expectId(elementA, MatchKind.DECLARATION, 'A extends T'),
-      _expectId(elementB, MatchKind.DECLARATION, 'B extends A'),
-      _expectId(elementC, MatchKind.DECLARATION, 'C implements B')
-    ];
-    List<SearchMatch> matches = await searchEngine.searchAllSubtypes(element);
-    _assertMatches(matches, expected);
+    Set<ClassElement> subtypes = await searchEngine.searchAllSubtypes(element);
+    expect(subtypes, hasLength(3));
+    expect(subtypes, contains(predicate((ClassElement e) => e.name == 'A')));
+    expect(subtypes, contains(predicate((ClassElement e) => e.name == 'B')));
+    expect(subtypes, contains(predicate((ClassElement e) => e.name == 'C')));
   }
 
   test_searchMemberDeclarations() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   test() {}
 }
@@ -119,7 +114,7 @@
   }
 
   test_searchMemberReferences_qualified_resolved() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class C {
   var test;
 }
@@ -136,7 +131,7 @@
   }
 
   test_searchMemberReferences_qualified_unresolved() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 main(p) {
   print(p.test);
   p.test = 1;
@@ -157,7 +152,7 @@
   }
 
   test_searchMemberReferences_unqualified_resolved() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class C {
   var test;
   main() {
@@ -175,7 +170,7 @@
 
   test_searchMemberReferences_unqualified_unresolved() async {
     verifyNoTestUnitErrors = false;
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class C {
   main() {
     print(test);
@@ -198,7 +193,7 @@
   }
 
   test_searchReferences_ClassElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {}
 main(A p) {
   A v;
@@ -220,7 +215,7 @@
         '''
 part of lib;
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 library lib;
 part 'my_part.dart';
 ''');
@@ -233,7 +228,7 @@
   }
 
   test_searchReferences_ConstructorElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   A.named() {}
 }
@@ -250,7 +245,7 @@
   }
 
   test_searchReferences_ConstructorElement_synthetic() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
 }
 main() {
@@ -271,7 +266,7 @@
   }
 
   test_searchReferences_FieldElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   var field;
   A({this.field});
@@ -305,7 +300,7 @@
   }
 
   test_searchReferences_FieldElement_ofEnum() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 enum MyEnum {
   A, B, C
 }
@@ -331,7 +326,7 @@
   }
 
   test_searchReferences_FieldElement_synthetic() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   get field => null;
   set field(x) {}
@@ -361,7 +356,7 @@
   }
 
   test_searchReferences_FunctionElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 test() {}
 main() {
   test();
@@ -378,7 +373,7 @@
   }
 
   test_searchReferences_FunctionElement_local() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 main() {
   test() {}
   test();
@@ -395,7 +390,7 @@
   }
 
   test_searchReferences_FunctionTypeAliasElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 typedef Test();
 main() {
   Test a;
@@ -413,7 +408,7 @@
   }
 
   test_searchReferences_ImportElement_noPrefix() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'dart:math' show max, PI, Random hide min;
 export 'dart:math' show max, PI, Random hide min;
 main() {
@@ -437,7 +432,7 @@
   }
 
   test_searchReferences_ImportElement_withPrefix() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'dart:math' as math show max, PI, Random hide min;
 export 'dart:math' show max, PI, Random hide min;
 main() {
@@ -462,7 +457,7 @@
   }
 
   test_searchReferences_ImportElement_withPrefix_forMultipleImports() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'dart:async' as p;
 import 'dart:math' as p;
 main() {
@@ -490,7 +485,7 @@
   }
 
   test_searchReferences_LabelElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 main() {
 label:
   while (true) {
@@ -515,7 +510,7 @@
     var codeB = 'part of lib; // B';
     addSource('/unitA.dart', codeA);
     addSource('/unitB.dart', codeB);
-    _indexTestUnit('''
+    await _indexTestUnit('''
 library lib;
 part 'unitA.dart';
 part 'unitB.dart';
@@ -535,7 +530,7 @@
   }
 
   test_searchReferences_LocalVariableElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 main() {
   var v;
   v = 1;
@@ -556,7 +551,7 @@
   }
 
   test_searchReferences_LocalVariableElement_inForEachLoop() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 main() {
   for (var v in []) {
     v = 1;
@@ -578,7 +573,7 @@
   }
 
   test_searchReferences_MethodElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   m() {}
   main() {
@@ -601,7 +596,7 @@
   }
 
   test_searchReferences_MethodMember() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A<T> {
   T m() => null;
 }
@@ -618,7 +613,7 @@
   }
 
   test_searchReferences_null_noUnitElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   m() {}
 }
@@ -635,7 +630,7 @@
   }
 
   test_searchReferences_ParameterElement_ofConstructor() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class C {
   var f;
   C({p}) : f = p + 1 {
@@ -665,7 +660,7 @@
   }
 
   test_searchReferences_ParameterElement_ofLocalFunction() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 main() {
   foo({p}) {
     p = 1;
@@ -690,7 +685,7 @@
   }
 
   test_searchReferences_ParameterElement_ofMethod() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class C {
   foo({p}) {
     p = 1;
@@ -717,7 +712,7 @@
   }
 
   test_searchReferences_ParameterElement_ofTopLevelFunction() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 foo({p}) {
   p = 1;
   p += 2;
@@ -742,7 +737,7 @@
   }
 
   test_searchReferences_PrefixElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'dart:async' as ppp;
 main() {
   ppp.Future a;
@@ -760,7 +755,7 @@
   }
 
   test_searchReferences_PropertyAccessorElement_getter() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   get ggg => null;
   main() {
@@ -783,7 +778,7 @@
   }
 
   test_searchReferences_PropertyAccessorElement_setter() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {
   set s(x) {}
   main() {
@@ -808,7 +803,7 @@
 library lib;
 var V;
 ''');
-    _indexTestUnit('''
+    await _indexTestUnit('''
 import 'lib.dart' show V; // imp
 import 'lib.dart' as pref;
 main() {
@@ -838,7 +833,7 @@
   }
 
   test_searchReferences_TypeParameterElement() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A<T> {
   main(T a, T b) {}
 }
@@ -854,7 +849,7 @@
   }
 
   test_searchSubtypes() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class T {}
 class A extends T {} // A
 class B = Object with T; // B
@@ -874,7 +869,7 @@
   }
 
   test_searchTopLevelDeclarations() async {
-    _indexTestUnit('''
+    await _indexTestUnit('''
 class A {} // A
 class B = Object with A;
 typedef C();
@@ -935,8 +930,8 @@
         isQualified: false, isResolved: false, length: length);
   }
 
-  void _indexTestUnit(String code) {
-    resolveTestUnit(code);
+  Future<Null> _indexTestUnit(String code) async {
+    await resolveTestUnit(code);
     index.indexUnit(testUnit);
   }
 
diff --git a/pkg/analysis_server/test/services/search/test_all.dart b/pkg/analysis_server/test/services/search/test_all.dart
index 39251a5..c12c736 100644
--- a/pkg/analysis_server/test/services/search/test_all.dart
+++ b/pkg/analysis_server/test/services/search/test_all.dart
@@ -7,6 +7,7 @@
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import 'hierarchy_test.dart' as hierarchy_test;
+import 'search_engine2_test.dart' as search_engine2_test;
 import 'search_engine_test.dart' as search_engine_test;
 
 /**
@@ -15,6 +16,7 @@
 main() {
   defineReflectiveSuite(() {
     hierarchy_test.main();
+    search_engine2_test.main();
     search_engine_test.main();
   }, name: 'search');
 }
diff --git a/pkg/analysis_server/test/single_context_manager_test.dart b/pkg/analysis_server/test/single_context_manager_test.dart
index eafa488..33bbd6f 100644
--- a/pkg/analysis_server/test/single_context_manager_test.dart
+++ b/pkg/analysis_server/test/single_context_manager_test.dart
@@ -7,13 +7,14 @@
 import 'dart:core';
 
 import 'package:analysis_server/src/single_context_manager.dart';
+import 'package:analysis_server/src/utilities/null_string_sink.dart';
 import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/util/glob.dart';
-import 'package:linter/src/plugin/linter_plugin.dart';
 import 'package:path/path.dart' as path;
 import 'package:plugin/manager.dart';
 import 'package:plugin/plugin.dart';
@@ -63,10 +64,13 @@
     packageResolver = new TestUriResolver();
 
     _processRequiredPlugins();
-    DartSdkManager sdkManager = new DartSdkManager('', false);
+    DartSdkManager sdkManager = new DartSdkManager('/', false);
     manager = new SingleContextManager(resourceProvider, sdkManager,
         (_) => packageResolver, analysisFilesGlobs, new AnalysisOptionsImpl());
-    callbacks = new TestContextManagerCallbacks(resourceProvider);
+    PerformanceLog logger = new PerformanceLog(new NullStringSink());
+    AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(logger);
+    callbacks = new TestContextManagerCallbacks(
+        resourceProvider, sdkManager, logger, scheduler);
     manager.callbacks = callbacks;
   }
 
@@ -532,9 +536,6 @@
   void _processRequiredPlugins() {
     List<Plugin> plugins = <Plugin>[];
     plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-    plugins.add(AnalysisEngine.instance.commandLinePlugin);
-    plugins.add(AnalysisEngine.instance.optionsPlugin);
-    plugins.add(linterPlugin);
     ExtensionManager manager = new ExtensionManager();
     manager.processPlugins(plugins);
   }
diff --git a/pkg/analysis_server/test/src/utilities/change_builder_dart_test.dart b/pkg/analysis_server/test/src/utilities/change_builder_dart_test.dart
index a221d9b..4e88aec 100644
--- a/pkg/analysis_server/test/src/utilities/change_builder_dart_test.dart
+++ b/pkg/analysis_server/test/src/utilities/change_builder_dart_test.dart
@@ -9,6 +9,7 @@
 import 'package:analysis_server/src/provisional/edit/utilities/change_builder_dart.dart';
 import 'package:analysis_server/src/utilities/change_builder_dart.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:test/test.dart';
@@ -26,9 +27,9 @@
 
 @reflectiveTest
 class DartChangeBuilderImplTest extends AbstractContextTest {
-  void test_createFileEditBuilder() {
+  test_createFileEditBuilder() async {
     Source source = addSource('/test.dart', 'library test;');
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
     int timeStamp = 54;
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     DartFileEditBuilderImpl fileEditBuilder =
@@ -54,16 +55,17 @@
     return edits[0];
   }
 
-  void test_writeClassDeclaration_interfaces() {
+  test_writeClassDeclaration_interfaces() async {
     Source source = addSource('/test.dart', 'class A {}');
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration declaration = unit.declarations[0];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(0, (EditBuilder builder) {
-        (builder as DartEditBuilder)
-            .writeClassDeclaration('C', interfaces: [declaration.element.type]);
+        (builder as DartEditBuilder).writeClassDeclaration('C', interfaces: [
+          resolutionMap.elementDeclaredByClassDeclaration(declaration).type
+        ]);
       });
     });
     SourceEdit edit = getEdit(builder);
@@ -71,9 +73,9 @@
         edit.replacement, equalsIgnoringWhitespace('class C implements A { }'));
   }
 
-  void test_writeClassDeclaration_isAbstract() {
+  test_writeClassDeclaration_isAbstract() async {
     Source source = addSource('/test.dart', '');
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -86,9 +88,9 @@
     expect(edit.replacement, equalsIgnoringWhitespace('abstract class C { }'));
   }
 
-  void test_writeClassDeclaration_memberWriter() {
+  test_writeClassDeclaration_memberWriter() async {
     Source source = addSource('/test.dart', '');
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -103,16 +105,17 @@
     expect(edit.replacement, equalsIgnoringWhitespace('class C { /**/ }'));
   }
 
-  void test_writeClassDeclaration_mixins_noSuperclass() {
+  test_writeClassDeclaration_mixins_noSuperclass() async {
     Source source = addSource('/test.dart', 'class A {}');
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classA = unit.declarations[0];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(0, (EditBuilder builder) {
-        (builder as DartEditBuilder)
-            .writeClassDeclaration('C', mixins: [classA.element.type]);
+        (builder as DartEditBuilder).writeClassDeclaration('C', mixins: [
+          resolutionMap.elementDeclaredByClassDeclaration(classA).type
+        ]);
       });
     });
     SourceEdit edit = getEdit(builder);
@@ -120,9 +123,9 @@
         equalsIgnoringWhitespace('class C extends Object with A { }'));
   }
 
-  void test_writeClassDeclaration_mixins_superclass() {
+  test_writeClassDeclaration_mixins_superclass() async {
     Source source = addSource('/test.dart', 'class A {} class B {}');
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classA = unit.declarations[0];
     ClassDeclaration classB = unit.declarations[1];
 
@@ -130,7 +133,11 @@
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(0, (EditBuilder builder) {
         (builder as DartEditBuilder).writeClassDeclaration('C',
-            mixins: [classB.element.type], superclass: classA.element.type);
+            mixins: [
+              resolutionMap.elementDeclaredByClassDeclaration(classB).type
+            ],
+            superclass:
+                resolutionMap.elementDeclaredByClassDeclaration(classA).type);
       });
     });
     SourceEdit edit = getEdit(builder);
@@ -138,9 +145,9 @@
         equalsIgnoringWhitespace('class C extends A with B { }'));
   }
 
-  void test_writeClassDeclaration_nameGroupName() {
+  test_writeClassDeclaration_nameGroupName() async {
     Source source = addSource('/test.dart', '');
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -160,26 +167,28 @@
     expect(group.positions, hasLength(1));
   }
 
-  void test_writeClassDeclaration_superclass() {
+  test_writeClassDeclaration_superclass() async {
     Source source = addSource('/test.dart', 'class B {}');
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration declaration = unit.declarations[0];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(0, (EditBuilder builder) {
-        (builder as DartEditBuilder)
-            .writeClassDeclaration('C', superclass: declaration.element.type);
+        (builder as DartEditBuilder).writeClassDeclaration('C',
+            superclass: resolutionMap
+                .elementDeclaredByClassDeclaration(declaration)
+                .type);
       });
     });
     SourceEdit edit = getEdit(builder);
     expect(edit.replacement, equalsIgnoringWhitespace('class C extends B { }'));
   }
 
-  void test_writeFieldDeclaration_initializerWriter() {
+  test_writeFieldDeclaration_initializerWriter() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -194,10 +203,10 @@
     expect(edit.replacement, equalsIgnoringWhitespace('var f = e;'));
   }
 
-  void test_writeFieldDeclaration_isConst() {
+  test_writeFieldDeclaration_isConst() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -209,10 +218,10 @@
     expect(edit.replacement, equalsIgnoringWhitespace('const f;'));
   }
 
-  void test_writeFieldDeclaration_isConst_isFinal() {
+  test_writeFieldDeclaration_isConst_isFinal() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -225,10 +234,10 @@
     expect(edit.replacement, equalsIgnoringWhitespace('const f;'));
   }
 
-  void test_writeFieldDeclaration_isFinal() {
+  test_writeFieldDeclaration_isFinal() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -240,10 +249,10 @@
     expect(edit.replacement, equalsIgnoringWhitespace('final f;'));
   }
 
-  void test_writeFieldDeclaration_isStatic() {
+  test_writeFieldDeclaration_isStatic() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -255,10 +264,10 @@
     expect(edit.replacement, equalsIgnoringWhitespace('static var f;'));
   }
 
-  void test_writeFieldDeclaration_nameGroupName() {
+  test_writeFieldDeclaration_nameGroupName() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -280,17 +289,20 @@
     expect(position.offset, equals(13));
   }
 
-  void test_writeFieldDeclaration_type_typeGroupName() {
+  test_writeFieldDeclaration_type_typeGroupName() async {
     String content = 'class A {} class B {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration declaration = unit.declarations[0];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
         (builder as DartEditBuilder).writeFieldDeclaration('f',
-            type: declaration.element.type, typeGroupName: 'type');
+            type: resolutionMap
+                .elementDeclaredByClassDeclaration(declaration)
+                .type,
+            typeGroupName: 'type');
       });
     });
     SourceEdit edit = getEdit(builder);
@@ -306,10 +318,10 @@
     expect(position.offset, equals(20));
   }
 
-  void test_writeGetterDeclaration_bodyWriter() {
+  test_writeGetterDeclaration_bodyWriter() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -324,10 +336,10 @@
     expect(edit.replacement, equalsIgnoringWhitespace('get g {}'));
   }
 
-  void test_writeGetterDeclaration_isStatic() {
+  test_writeGetterDeclaration_isStatic() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -340,10 +352,10 @@
     expect(edit.replacement, equalsIgnoringWhitespace('static get g => null;'));
   }
 
-  void test_writeGetterDeclaration_nameGroupName() {
+  test_writeGetterDeclaration_nameGroupName() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -365,17 +377,19 @@
     expect(position.offset, equals(13));
   }
 
-  void test_writeGetterDeclaration_returnType() {
+  test_writeGetterDeclaration_returnType() async {
     String content = 'class A {} class B {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classA = unit.declarations[0];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
         (builder as DartEditBuilder).writeGetterDeclaration('g',
-            returnType: classA.element.type, returnTypeGroupName: 'returnType');
+            returnType:
+                resolutionMap.elementDeclaredByClassDeclaration(classA).type,
+            returnTypeGroupName: 'returnType');
       });
     });
     SourceEdit edit = getEdit(builder);
@@ -391,7 +405,7 @@
     expect(position.offset, equals(20));
   }
 
-  void test_writeOverrideOfInheritedMember() {
+  test_writeOverrideOfInheritedMember() async {
     String content = '''
 class A {
   A add(A a) => null;
@@ -399,14 +413,16 @@
 class B extends A {
 }''';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration declaration = unit.declarations[0];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilder)
-            .writeOverrideOfInheritedMember(declaration.element.methods[0]);
+        (builder as DartEditBuilder).writeOverrideOfInheritedMember(
+            resolutionMap
+                .elementDeclaredByClassDeclaration(declaration)
+                .methods[0]);
       });
     });
     SourceEdit edit = getEdit(builder);
@@ -418,14 +434,14 @@
 }'''));
   }
 
-  void test_writeParameters_named() {
+  test_writeParameters_named() async {
     String content = 'f(int i, {String s}) {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     FunctionDeclaration f = unit.declarations[0];
     FormalParameterList parameters = f.functionExpression.parameters;
     Iterable<ParameterElement> elements = parameters.parameters
-        .map((FormalParameter parameter) => parameter.element);
+        .map(resolutionMap.elementDeclaredByFormalParameter);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -437,14 +453,14 @@
     expect(edit.replacement, equalsIgnoringWhitespace('(int i, {String s})'));
   }
 
-  void test_writeParameters_positional() {
+  test_writeParameters_positional() async {
     String content = 'f(int i, [String s]) {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     FunctionDeclaration f = unit.declarations[0];
     FormalParameterList parameters = f.functionExpression.parameters;
     Iterable<ParameterElement> elements = parameters.parameters
-        .map((FormalParameter parameter) => parameter.element);
+        .map(resolutionMap.elementDeclaredByFormalParameter);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -456,14 +472,14 @@
     expect(edit.replacement, equalsIgnoringWhitespace('(int i, [String s])'));
   }
 
-  void test_writeParameters_required() {
+  test_writeParameters_required() async {
     String content = 'f(int i, String s) {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     FunctionDeclaration f = unit.declarations[0];
     FormalParameterList parameters = f.functionExpression.parameters;
     Iterable<ParameterElement> elements = parameters.parameters
-        .map((FormalParameter parameter) => parameter.element);
+        .map(resolutionMap.elementDeclaredByFormalParameter);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -475,13 +491,13 @@
     expect(edit.replacement, equalsIgnoringWhitespace('(int i, String s)'));
   }
 
-  void test_writeParametersMatchingArguments_named() {
+  test_writeParametersMatchingArguments_named() async {
     String content = '''
 f(int i, String s) {
   g(s, index: i);
 }''';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     FunctionDeclaration f = unit.declarations[0];
     BlockFunctionBody body = f.functionExpression.body;
     ExpressionStatement statement = body.block.statements[0];
@@ -499,13 +515,13 @@
         edit.replacement, equalsIgnoringWhitespace('(String s, [int index])'));
   }
 
-  void test_writeParametersMatchingArguments_required() {
+  test_writeParametersMatchingArguments_required() async {
     String content = '''
 f(int i, String s) {
   g(s, i);
 }''';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     FunctionDeclaration f = unit.declarations[0];
     BlockFunctionBody body = f.functionExpression.body;
     ExpressionStatement statement = body.block.statements[0];
@@ -522,68 +538,76 @@
     expect(edit.replacement, equalsIgnoringWhitespace('(String s, int i)'));
   }
 
-  void test_writeParameterSource() {
+  test_writeParameterSource() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classA = unit.declarations[0];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilder)
-            .writeParameterSource(classA.element.type, 'a');
+        (builder as DartEditBuilder).writeParameterSource(
+            resolutionMap.elementDeclaredByClassDeclaration(classA).type, 'a');
       });
     });
     SourceEdit edit = getEdit(builder);
     expect(edit.replacement, equalsIgnoringWhitespace('A a'));
   }
 
-  void test_writeType_dymanic() {
+  test_writeType_dynamic() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilder)
-            .writeType(unit.element.context.typeProvider.dynamicType);
+        (builder as DartEditBuilder).writeType(resolutionMap
+            .elementDeclaredByCompilationUnit(unit)
+            .context
+            .typeProvider
+            .dynamicType);
       });
     });
     SourceEdit edit = getEdit(builder);
     expect(edit.replacement, equalsIgnoringWhitespace(''));
   }
 
-  void test_writeType_genericType() {
+  test_writeType_genericType() async {
     String content = 'class A {} class B<E> {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classA = unit.declarations[0];
     ClassDeclaration classB = unit.declarations[1];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilder)
-            .writeType(classB.element.type.instantiate([classA.element.type]));
+        (builder as DartEditBuilder).writeType(resolutionMap
+            .elementDeclaredByClassDeclaration(classB)
+            .type
+            .instantiate([
+          resolutionMap.elementDeclaredByClassDeclaration(classA).type
+        ]));
       });
     });
     SourceEdit edit = getEdit(builder);
     expect(edit.replacement, equalsIgnoringWhitespace('B<A>'));
   }
 
-  void test_writeType_groupName() {
+  test_writeType_groupName() async {
     String content = 'class A {} class B extends A {} class C extends B {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classC = unit.declarations[2];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilder)
-            .writeType(classC.element.type, groupName: 'type');
+        (builder as DartEditBuilder).writeType(
+            resolutionMap.elementDeclaredByClassDeclaration(classC).type,
+            groupName: 'type');
       });
     });
     SourceEdit edit = getEdit(builder);
@@ -596,17 +620,19 @@
     expect(group, isNotNull);
   }
 
-  void test_writeType_groupName_addSupertypeProposals() {
+  test_writeType_groupName_addSupertypeProposals() async {
     String content = 'class A {} class B extends A {} class C extends B {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classC = unit.declarations[2];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilder).writeType(classC.element.type,
-            addSupertypeProposals: true, groupName: 'type');
+        (builder as DartEditBuilder).writeType(
+            resolutionMap.elementDeclaredByClassDeclaration(classC).type,
+            addSupertypeProposals: true,
+            groupName: 'type');
       });
     });
     SourceEdit edit = getEdit(builder);
@@ -629,10 +655,10 @@
     expect(values, contains('C'));
   }
 
-  void test_writeType_null() {
+  test_writeType_null() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -644,16 +670,20 @@
     expect(edit.replacement, equalsIgnoringWhitespace(''));
   }
 
-  void test_writeType_required_dymanic() {
+  test_writeType_required_dynamic() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
         (builder as DartEditBuilder).writeType(
-            unit.element.context.typeProvider.dynamicType,
+            resolutionMap
+                .elementDeclaredByCompilationUnit(unit)
+                .context
+                .typeProvider
+                .dynamicType,
             required: true);
       });
     });
@@ -661,27 +691,28 @@
     expect(edit.replacement, equalsIgnoringWhitespace('var'));
   }
 
-  void test_writeType_required_notNull() {
+  test_writeType_required_notNull() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classA = unit.declarations[0];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilder)
-            .writeType(classA.element.type, required: true);
+        (builder as DartEditBuilder).writeType(
+            resolutionMap.elementDeclaredByClassDeclaration(classA).type,
+            required: true);
       });
     });
     SourceEdit edit = getEdit(builder);
     expect(edit.replacement, equalsIgnoringWhitespace('A'));
   }
 
-  void test_writeType_required_null() {
+  test_writeType_required_null() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -693,26 +724,27 @@
     expect(edit.replacement, equalsIgnoringWhitespace('var'));
   }
 
-  void test_writeType_simpleType() {
+  test_writeType_simpleType() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classA = unit.declarations[0];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilder).writeType(classA.element.type);
+        (builder as DartEditBuilder).writeType(
+            resolutionMap.elementDeclaredByClassDeclaration(classA).type);
       });
     });
     SourceEdit edit = getEdit(builder);
     expect(edit.replacement, equalsIgnoringWhitespace('A'));
   }
 
-  void test_writeTypes_empty() {
+  test_writeTypes_empty() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -724,28 +756,30 @@
     expect(edit.replacement, isEmpty);
   }
 
-  void test_writeTypes_noPrefix() {
+  test_writeTypes_noPrefix() async {
     String content = 'class A {} class B {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classA = unit.declarations[0];
     ClassDeclaration classB = unit.declarations[1];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilderImpl)
-            .writeTypes([classA.element.type, classB.element.type]);
+        (builder as DartEditBuilderImpl).writeTypes([
+          resolutionMap.elementDeclaredByClassDeclaration(classA).type,
+          resolutionMap.elementDeclaredByClassDeclaration(classB).type
+        ]);
       });
     });
     SourceEdit edit = getEdit(builder);
     expect(edit.replacement, equalsIgnoringWhitespace('A, B'));
   }
 
-  void test_writeTypes_null() {
+  test_writeTypes_null() async {
     String content = 'class A {}';
     Source source = addSource('/test.dart', content);
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
@@ -757,19 +791,20 @@
     expect(edit.replacement, isEmpty);
   }
 
-  void test_writeTypes_prefix() {
+  test_writeTypes_prefix() async {
     String content = 'class A {} class B {}';
     Source source = addSource('/test.dart', content);
-    CompilationUnit unit = resolveLibraryUnit(source);
+    CompilationUnit unit = await resolveLibraryUnit(source);
     ClassDeclaration classA = unit.declarations[0];
     ClassDeclaration classB = unit.declarations[1];
 
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, 1, (FileEditBuilder builder) {
       builder.addInsertion(content.length - 1, (EditBuilder builder) {
-        (builder as DartEditBuilderImpl).writeTypes(
-            [classA.element.type, classB.element.type],
-            prefix: 'implements ');
+        (builder as DartEditBuilderImpl).writeTypes([
+          resolutionMap.elementDeclaredByClassDeclaration(classA).type,
+          resolutionMap.elementDeclaredByClassDeclaration(classB).type
+        ], prefix: 'implements ');
       });
     });
     SourceEdit edit = getEdit(builder);
@@ -779,9 +814,9 @@
 
 @reflectiveTest
 class DartFileEditBuilderImplTest extends AbstractContextTest {
-  void test_createEditBuilder() {
+  test_createEditBuilder() async {
     Source source = addSource('/test.dart', 'library test;');
-    resolveLibraryUnit(source);
+    await resolveLibraryUnit(source);
     int timeStamp = 65;
     DartChangeBuilderImpl builder = new DartChangeBuilderImpl(context);
     builder.addFileEdit(source, timeStamp, (FileEditBuilder builder) {
diff --git a/pkg/analysis_server/test/stress/replay/replay.dart b/pkg/analysis_server/test/stress/replay/replay.dart
index e5525e7..2ca74e4 100644
--- a/pkg/analysis_server/test/stress/replay/replay.dart
+++ b/pkg/analysis_server/test/stress/replay/replay.dart
@@ -5,8 +5,6 @@
 /**
  * A stress test for the analysis server.
  */
-library analysis_server.test.stress.replay.replay;
-
 import 'dart:async';
 import 'dart:io';
 import 'dart:math' as math;
@@ -23,13 +21,14 @@
 import 'package:path/path.dart' as path;
 
 import '../utilities/git.dart';
+import '../utilities/logger.dart';
 import '../utilities/server.dart';
 import 'operation.dart';
 
 /**
  * Run the simulation based on the given command-line [arguments].
  */
-Future main(List<String> arguments) async {
+Future<Null> main(List<String> arguments) async {
   Driver driver = new Driver();
   await driver.run(arguments);
 }
@@ -74,6 +73,12 @@
   static const String TEMP_BRANCH_NAME = 'temp';
 
   /**
+   * The name of the command-line flag that will cause verbose output to be
+   * produced.
+   */
+  static String VERBOSE_FLAG_NAME = 'verbose';
+
+  /**
    * The style of interaction to use for analysis.updateContent requests.
    */
   OverlayStyle overlayStyle;
@@ -96,7 +101,7 @@
   /**
    * The connection to the analysis server.
    */
-  Server server = new Server();
+  Server server;
 
   /**
    * A list of the glob patterns used to identify the files being analyzed by
@@ -110,6 +115,16 @@
   Statistics statistics;
 
   /**
+   * A flag indicating whether verbose output should be provided.
+   */
+  bool verbose = false;
+
+  /**
+   * The logger to which verbose logging data will be written.
+   */
+  Logger logger;
+
+  /**
    * Initialize a newly created driver.
    */
   Driver() {
@@ -117,15 +132,27 @@
   }
 
   /**
+   * Allow the output from the server to be read and processed.
+   */
+  Future<Null> readServerOutput() async {
+    await new Future.delayed(new Duration(milliseconds: 2));
+  }
+
+  /**
    * Run the simulation based on the given command-line arguments ([args]).
    */
-  Future run(List<String> args) async {
+  Future<Null> run(List<String> args) async {
     //
     // Process the command-line arguments.
     //
     if (!_processCommandLine(args)) {
       return null;
     }
+    if (verbose) {
+      stdout.writeln();
+      stdout.writeln('-' * 80);
+      stdout.writeln();
+    }
     //
     // Simulate interactions with the server.
     //
@@ -133,7 +160,16 @@
     //
     // Print out statistics gathered while performing the simulation.
     //
+    if (verbose) {
+      stdout.writeln();
+      stdout.writeln('-' * 80);
+    }
+    stdout.writeln();
     statistics.print();
+    if (verbose) {
+      stdout.writeln();
+      server.printStatistics();
+    }
     exit(0);
     return null;
   }
@@ -149,7 +185,6 @@
         help: 'Print usage information',
         defaultsTo: false,
         negatable: false);
-
     parser.addOption(OVERLAY_STYLE_OPTION_NAME,
         help:
             'The style of interaction to use for analysis.updateContent requests',
@@ -159,6 +194,11 @@
           MULTIPLE_ADD_OVERLAY_STYLE: '<add>+ <remove>'
         },
         defaultsTo: 'change');
+    parser.addFlag(VERBOSE_FLAG_NAME,
+        abbr: 'v',
+        help: 'Produce verbose output for debugging',
+        defaultsTo: false,
+        negatable: false);
     return parser;
   }
 
@@ -286,13 +326,18 @@
       overlayStyle = OverlayStyle.multipleAdd;
     }
 
-    List<String> arguments = results.arguments;
+    if (results[VERBOSE_FLAG_NAME]) {
+      verbose = true;
+      logger = new Logger(stdout);
+    }
+
+    List<String> arguments = results.rest;
     if (arguments.length < 2) {
       _showUsage(parser);
       return false;
     }
     repositoryPath = path.normalize(arguments[0]);
-    repository = new GitRepository(repositoryPath);
+    repository = new GitRepository(repositoryPath, logger: logger);
 
     analysisRoots = arguments
         .sublist(1)
@@ -312,66 +357,69 @@
   /**
    * Replay the changes in each commit.
    */
-  Future _replayChanges() async {
+  Future<Null> _replayChanges() async {
     //
     // Get the revision history of the repo.
     //
     LinearCommitHistory history = repository.getCommitHistory();
     statistics.commitCount = history.commitIds.length;
     LinearCommitHistoryIterator iterator = history.iterator();
-    //
-    // Iterate over the history, applying changes.
-    //
-    int dotCount = 0;
-    bool firstCheckout = true;
-    ErrorMap expectedErrors = null;
-    Iterable<String> changedPubspecs;
-    while (iterator.moveNext()) {
+    try {
       //
-      // Checkout the commit on which the changes are based.
+      // Iterate over the history, applying changes.
       //
-      String commit = iterator.srcCommit;
-      repository.checkout(commit);
-      if (expectedErrors != null) {
-        ErrorMap actualErrors =
-            await server.computeErrorMap(server.analyzedDartFiles);
-        String difference = expectedErrors.expectErrorMap(actualErrors);
-        if (difference != null) {
-          stdout.write('Mismatched errors after commit ');
-          stdout.writeln(commit);
-          stdout.writeln();
-          stdout.writeln(difference);
-          return;
+      bool firstCheckout = true;
+      ErrorMap expectedErrors = null;
+      Iterable<String> changedPubspecs;
+      while (iterator.moveNext()) {
+        //
+        // Checkout the commit on which the changes are based.
+        //
+        String commit = iterator.srcCommit;
+        repository.checkout(commit);
+        if (expectedErrors != null) {
+//          ErrorMap actualErrors =
+          await server.computeErrorMap(server.analyzedDartFiles);
+//          String difference = expectedErrors.expectErrorMap(actualErrors);
+//          if (difference != null) {
+//            stdout.write('Mismatched errors after commit ');
+//            stdout.writeln(commit);
+//            stdout.writeln();
+//            stdout.writeln(difference);
+//            return;
+//          }
         }
+        if (firstCheckout) {
+          changedPubspecs = _findPubspecsInAnalysisRoots();
+          server.sendAnalysisSetAnalysisRoots(analysisRoots, []);
+          firstCheckout = false;
+        } else {
+          server.removeAllOverlays();
+        }
+        await readServerOutput();
+        expectedErrors = await server.computeErrorMap(server.analyzedDartFiles);
+        for (String filePath in changedPubspecs) {
+          _runPub(filePath);
+        }
+        //
+        // Apply the changes.
+        //
+        CommitDelta commitDelta = iterator.next();
+        commitDelta.filterDiffs(analysisRoots, fileGlobs);
+        if (commitDelta.hasDiffs) {
+          statistics.commitsWithChangeInRootCount++;
+          await _replayDiff(commitDelta);
+        }
+        changedPubspecs = commitDelta.filesMatching(PUBSPEC_FILE_NAME);
       }
-      if (firstCheckout) {
-        changedPubspecs = _findPubspecsInAnalysisRoots();
-        server.sendAnalysisSetAnalysisRoots(analysisRoots, []);
-        firstCheckout = false;
-      } else {
-        server.removeAllOverlays();
-      }
-      expectedErrors = await server.computeErrorMap(server.analyzedDartFiles);
-      for (String filePath in changedPubspecs) {
-        _runPub(filePath);
-      }
-      //
-      // Apply the changes.
-      //
-      CommitDelta commitDelta = iterator.next();
-      commitDelta.filterDiffs(analysisRoots, fileGlobs);
-      if (commitDelta.hasDiffs) {
-        statistics.commitsWithChangeInRootCount++;
-        _replayDiff(commitDelta);
-      }
-      changedPubspecs = commitDelta.filesMatching(PUBSPEC_FILE_NAME);
-      stdout.write('.');
-      if (dotCount++ > 100) {
-        stdout.writeln();
-        dotCount = 0;
+    } finally {
+      // Ensure that the repository is left at the most recent commit.
+      if (history.commitIds.length > 0) {
+        repository.checkout(history.commitIds[0]);
       }
     }
     server.removeAllOverlays();
+    await readServerOutput();
     stdout.writeln();
   }
 
@@ -379,7 +427,7 @@
    * Replay the changes between two commits, as represented by the given
    * [commitDelta].
    */
-  void _replayDiff(CommitDelta commitDelta) {
+  Future<Null> _replayDiff(CommitDelta commitDelta) async {
     List<FileEdit> editList = <FileEdit>[];
     for (DiffRecord record in commitDelta.diffRecords) {
       FileEdit edit = new FileEdit(overlayStyle, record);
@@ -404,7 +452,9 @@
         AnalysisService.OVERRIDES: currentFile
       });
       for (ServerOperation operation in edit.getOperations()) {
+        statistics.editCount++;
         operation.perform(server);
+        await readServerOutput();
       }
     }
   }
@@ -424,7 +474,8 @@
   /**
    * Run the simulation by starting up a server and sending it requests.
    */
-  Future _runSimulation() async {
+  Future<Null> _runSimulation() async {
+    server = new Server(logger: logger);
     Stopwatch stopwatch = new Stopwatch();
     statistics.stopwatch = stopwatch;
     stopwatch.start();
@@ -443,6 +494,8 @@
     try {
       await _replayChanges();
     } finally {
+      // TODO(brianwilkerson) This needs to be moved into a Zone in order to
+      // ensure that it is always run.
       server.sendServerShutdown();
       repository.checkout('master');
     }
@@ -450,7 +503,7 @@
   }
 
   /**
-   * Display usage information, preceeded by the [errorMessage] if one is given.
+   * Display usage information, preceded by the [errorMessage] if one is given.
    */
   void _showUsage(ArgParser parser, [String errorMessage = null]) {
     if (errorMessage != null) {
@@ -469,7 +522,7 @@
 
 There must be at least one analysis root, and all of the analysis roots must be
 the absolute path of a directory contained within the repository directory. The
-analysis roots represent the portion of the repository that will be analyzed by
+analysis roots represent the portions of the repository that will be analyzed by
 the analysis server.
 
 OPTIONS:''');
@@ -604,6 +657,11 @@
   int commitsWithChangeInRootCount = 0;
 
   /**
+   * The total number of edits that were applied.
+   */
+  int editCount = 0;
+
+  /**
    * Initialize a newly created set of statistics.
    */
   Statistics(this.driver);
@@ -622,6 +680,8 @@
     stdout.writeln(commitCount);
     stdout.write('  number of commits with a change in an analysis root = ');
     stdout.writeln(commitsWithChangeInRootCount);
+    stdout.write('  number of edits = ');
+    stdout.writeln(editCount);
   }
 
   /**
diff --git a/pkg/analysis_server/test/stress/utilities/git.dart b/pkg/analysis_server/test/stress/utilities/git.dart
index 32c7e9b..cfcef4f 100644
--- a/pkg/analysis_server/test/stress/utilities/git.dart
+++ b/pkg/analysis_server/test/stress/utilities/git.dart
@@ -5,14 +5,14 @@
 /**
  * Support for interacting with a git repository.
  */
-library analysis_server.test.stress.utilities.git;
-
 import 'dart:convert';
 import 'dart:io';
 
 import 'package:analyzer/src/util/glob.dart';
 import 'package:path/path.dart' as path;
 
+import 'logger.dart';
+
 /**
  * A representation of the differences between two blobs.
  */
@@ -395,10 +395,18 @@
   final String path;
 
   /**
+   * The logger to which git commands should be written, or `null` if the
+   * commands should not be written.
+   */
+  final Logger logger;
+
+  /**
    * Initialize a newly created repository to represent the git repository at
    * the given [path].
+   *
+   * If a [commandSink] is provided, any calls to git will be written to it.
    */
-  GitRepository(this.path);
+  GitRepository(this.path, {this.logger = null});
 
   /**
    * Checkout the given [commit] from the repository. This is done by running
@@ -454,6 +462,7 @@
    * the result of running the process.
    */
   ProcessResult _run(List<String> arguments) {
+    logger?.log('git', 'git', arguments: arguments);
     return Process.runSync('git', arguments,
         stderrEncoding: UTF8, stdoutEncoding: UTF8, workingDirectory: path);
   }
diff --git a/pkg/analysis_server/test/stress/utilities/logger.dart b/pkg/analysis_server/test/stress/utilities/logger.dart
new file mode 100644
index 0000000..acf7a74
--- /dev/null
+++ b/pkg/analysis_server/test/stress/utilities/logger.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * A utility class used to write logging information during a test.
+ */
+class Logger {
+  /**
+   * The width of the field in which labels are printed.
+   */
+  static const int _labelWidth = 8;
+
+  /**
+   * The separator used to separate the label from the content.
+   */
+  static const String _separator = ' : ';
+
+  /**
+   * The sink to which the logged information should be written.
+   */
+  final StringSink sink;
+
+  /**
+   * Initialize a newly created logger to write to the given [sink].
+   */
+  Logger(this.sink);
+
+  /**
+   * Log the given information.
+   *
+   * The [label] is used to indicate the kind of information being logged, while
+   * the [content] contains the actual information. If a list of [arguments] is
+   * provided, then they will be written after the content.
+   */
+  void log(String label, String content, {List<String> arguments = null}) {
+    for (int i = _labelWidth - label.length; i > 0; i--) {
+      sink.write(' ');
+    }
+    sink.write(label);
+    sink.write(_separator);
+    sink.write(content);
+    arguments?.forEach((String argument) {
+      sink.write(' ');
+      sink.write(argument);
+    });
+    sink.writeln();
+  }
+}
diff --git a/pkg/analysis_server/test/stress/utilities/server.dart b/pkg/analysis_server/test/stress/utilities/server.dart
index ee52fdd..cc96aca 100644
--- a/pkg/analysis_server/test/stress/utilities/server.dart
+++ b/pkg/analysis_server/test/stress/utilities/server.dart
@@ -3,18 +3,24 @@
 // BSD-style license that can be found in the LICENSE file.
 
 /**
- * Support for interacting with an analysis server running in a separate
+ * Support for interacting with an analysis server that is running in a separate
  * process.
  */
-library analysis_server.test.stress.utilities.server;
-
 import 'dart:async';
 import 'dart:collection';
+import 'dart:convert' hide JsonDecoder;
+import 'dart:io';
+import 'dart:math' as math;
 
 import 'package:analysis_server/plugin/protocol/protocol.dart';
+import 'package:path/path.dart' as path;
 
-import '../../integration/integration_test_methods.dart';
-import '../../integration/integration_tests.dart' as base;
+import 'logger.dart';
+
+/**
+ * Return the current time expressed as milliseconds since the epoch.
+ */
+int get currentTime => new DateTime.now().millisecondsSinceEpoch;
 
 /**
  * ???
@@ -59,36 +65,222 @@
 }
 
 /**
- * An interface for starting and communicating with an analysis server running
- * in a separate process.
+ * Data that has been collected about a request sent to the server.
  */
-class Server extends base.Server with IntegrationTestMixin {
+class RequestData {
+  /**
+   * The unique id of the request.
+   */
+  final String id;
+
+  /**
+   * The method that was requested.
+   */
+  final String method;
+
+  /**
+   * The request parameters.
+   */
+  final Map<String, dynamic> params;
+
+  /**
+   * The time at which the request was sent.
+   */
+  final int requestTime;
+
+  /**
+   * The time at which the response was received, or `null` if no response has
+   * been received.
+   */
+  int responseTime = null;
+
+  /**
+   * The response that was received.
+   */
+  Response _response;
+
+  /**
+   * The completer that will be completed when a response is received.
+   */
+  Completer<Response> _responseCompleter;
+
+  /**
+   * Initialize a newly created set of request data.
+   */
+  RequestData(this.id, this.method, this.params, this.requestTime);
+
+  /**
+   * Return the number of milliseconds that elapsed betwee the request and the
+   * response. This getter assumes that the response was received.
+   */
+  int get elapsedTime => responseTime - requestTime;
+
+  /**
+   * Return a future that will complete when a response is received.
+   */
+  Future<Response> get respondedTo {
+    if (_response != null) {
+      return new Future.value(_response);
+    }
+    if (_responseCompleter == null) {
+      _responseCompleter = new Completer<Response>();
+    }
+    return _responseCompleter.future;
+  }
+
+  /**
+   * Record that the given [response] was received.
+   */
+  void recordResponse(Response response) {
+    if (_response != null) {
+      stdout.writeln(
+          'Received a second response to a $method request (id = $id)');
+      return;
+    }
+    responseTime = currentTime;
+    _response = response;
+    if (_responseCompleter != null) {
+      _responseCompleter.complete(response);
+      _responseCompleter = null;
+    }
+  }
+}
+
+/**
+ * A utility for starting and communicating with an analysis server that is
+ * running in a separate process.
+ */
+class Server {
+  /**
+   * The label used for communications from the client.
+   */
+  static const String fromClient = 'client';
+
+  /**
+   * The label used for normal communications from the server.
+   */
+  static const String fromServer = 'server';
+
+  /**
+   * The label used for output written by the server on [fromStderr].
+   */
+  static const String fromStderr = 'stderr';
+
+  /**
+   * The logger to which the communications log should be written, or `null` if
+   * the log should not be written.
+   */
+  final Logger logger;
+
+  /**
+   * The process in which the server is running, or `null` if the server hasn't
+   * been started yet.
+   */
+  Process _process = null;
+
+  /**
+   * Number that should be used to compute the 'id' to send in the next command
+   * sent to the server.
+   */
+  int _nextId = 0;
+
+  /**
+   * The analysis roots that are included.
+   */
+  List<String> _analysisRootIncludes = <String>[];
+
+  /**
+   * The analysis roots that are excluded.
+   */
+  List<String> _analysisRootExcludes = <String>[];
+
   /**
    * A list containing the paths of files for which an overlay has been created.
    */
   List<String> filesWithOverlays = <String>[];
 
   /**
+   * The files that the server reported as being analyzed.
+   */
+  List<String> _analyzedFiles = <String>[];
+
+  /**
    * A mapping from the absolute paths of files to the most recent set of errors
    * received for that file.
    */
   ErrorMap _errorMap = new ErrorMap();
 
   /**
+   * The completer that will be completed the next time a 'server.status'
+   * notification is received from the server with 'analyzing' set to false.
+   */
+  Completer<Null> _analysisFinishedCompleter;
+
+  /**
+   * The completer that will be completed the next time a 'server.connected'
+   * notification is received from the server.
+   */
+  Completer<Null> _serverConnectedCompleter;
+
+  /**
+   * A table mapping the ids of requests that have been sent to the server to
+   * data about those requests.
+   */
+  final Map<String, RequestData> _requestDataMap = <String, RequestData>{};
+
+  /**
+   * A table mapping the number of times a request whose 'event' is equal to the
+   * key was sent to the server.
+   */
+  final Map<String, int> _notificationCountMap = <String, int>{};
+
+  /**
    * Initialize a new analysis server. The analysis server is not running and
    * must be started using [start].
+   *
+   * If a [logger] is provided, the communications between the client (this
+   * test) and the server will be written to it.
    */
-  Server() {
-    initializeInttestMixin();
-    onAnalysisErrors.listen(_recordErrors);
+  Server({this.logger = null});
+
+  /**
+   * Return a future that will complete when a 'server.status' notification is
+   * received from the server with 'analyzing' set to false.
+   *
+   * The future will only be completed by 'server.status' notifications that are
+   * received after this function call, so it is safe to use this getter
+   * multiple times in one test; each time it is used it will wait afresh for
+   * analysis to finish.
+   */
+  Future get analysisFinished {
+    if (_analysisFinishedCompleter == null) {
+      _analysisFinishedCompleter = new Completer();
+    }
+    return _analysisFinishedCompleter.future;
   }
 
   /**
    * Return a list of the paths of files that are currently being analyzed.
    */
   List<String> get analyzedDartFiles {
-    // TODO(brianwilkerson) Implement this.
-    return <String>[];
+    bool isAnalyzed(String filePath) {
+      // TODO(brianwilkerson) This should use the path package to determine
+      // inclusion, and needs to take exclusions into account.
+      for (String includedRoot in _analysisRootIncludes) {
+        if (filePath.startsWith(includedRoot)) {
+          return true;
+        }
+      }
+      return false;
+    }
+
+    List<String> analyzedFiles = <String>[];
+    for (String filePath in _analyzedFiles) {
+      if (filePath.endsWith('.dart') && isAnalyzed(filePath)) {
+        analyzedFiles.add(filePath);
+      }
+    }
+    return analyzedFiles;
   }
 
   /**
@@ -98,9 +290,6 @@
    */
   ErrorMap get errorMap => new ErrorMap.from(_errorMap);
 
-  @override
-  base.Server get server => this;
-
   /**
    * Compute a mapping from each of the file paths in the given list of
    * [filePaths] to the list of errors in the file at that path.
@@ -109,9 +298,13 @@
     ErrorMap errorMap = new ErrorMap();
     List<Future> futures = <Future>[];
     for (String filePath in filePaths) {
-      futures.add(sendAnalysisGetErrors(filePath)
-          .then((AnalysisGetErrorsResult result) {
-        errorMap[filePath] = result.errors;
+      RequestData requestData = sendAnalysisGetErrors(filePath);
+      futures.add(requestData.respondedTo.then((Response response) {
+        if (response.result != null) {
+          AnalysisGetErrorsResult result =
+              new AnalysisGetErrorsResult.fromResponse(response);
+          errorMap[filePath] = result.errors;
+        }
       }));
     }
     await Future.wait(futures);
@@ -119,19 +312,168 @@
   }
 
   /**
+   * Print information about the communications with the server.
+   */
+  void printStatistics() {
+    void writeSpaces(int count) {
+      for (int i = 0; i < count; i++) {
+        stdout.write(' ');
+      }
+    }
+
+    //
+    // Print information about the requests that were sent.
+    //
+    stdout.writeln('Request Counts');
+    if (_requestDataMap.isEmpty) {
+      stdout.writeln('  none');
+    } else {
+      Map<String, List<RequestData>> requestsByMethod =
+          <String, List<RequestData>>{};
+      _requestDataMap.values.forEach((RequestData requestData) {
+        requestsByMethod
+            .putIfAbsent(requestData.method, () => <RequestData>[])
+            .add(requestData);
+      });
+      List<String> keys = requestsByMethod.keys.toList();
+      keys.sort();
+      int maxCount = requestsByMethod.values
+          .fold(0, (int count, List<RequestData> list) => count + list.length);
+      int countWidth = maxCount.toString().length;
+      for (String key in keys) {
+        List<RequestData> requests = requestsByMethod[key];
+        int noResponseCount = 0;
+        int responseCount = 0;
+        int minTime = -1;
+        int maxTime = -1;
+        int totalTime = 0;
+        requests.forEach((RequestData data) {
+          if (data.responseTime == null) {
+            noResponseCount++;
+          } else {
+            responseCount++;
+            int time = data.elapsedTime;
+            minTime = minTime < 0 ? time : math.min(minTime, time);
+            maxTime = math.max(maxTime, time);
+            totalTime += time;
+          }
+        });
+        String count = requests.length.toString();
+        writeSpaces(countWidth - count.length);
+        stdout.write('  ');
+        stdout.write(count);
+        stdout.write(' - ');
+        stdout.write(key);
+        if (noResponseCount > 0) {
+          stdout.write(', ');
+          stdout.write(noResponseCount);
+          stdout.write(' with no response');
+        }
+        if (maxTime >= 0) {
+          stdout.write(' (');
+          stdout.write(minTime);
+          stdout.write(', ');
+          stdout.write(totalTime / responseCount);
+          stdout.write(', ');
+          stdout.write(maxTime);
+          stdout.write(')');
+        }
+        stdout.writeln();
+      }
+    }
+    //
+    // Print information about the notifications that were received.
+    //
+    stdout.writeln();
+    stdout.writeln('Notification Counts');
+    if (_notificationCountMap.isEmpty) {
+      stdout.writeln('  none');
+    } else {
+      List<String> keys = _notificationCountMap.keys.toList();
+      keys.sort();
+      int maxCount = _notificationCountMap.values.fold(0, math.max);
+      int countWidth = maxCount.toString().length;
+      for (String key in keys) {
+        String count = _notificationCountMap[key].toString();
+        writeSpaces(countWidth - count.length);
+        stdout.write('  ');
+        stdout.write(count);
+        stdout.write(' - ');
+        stdout.writeln(key);
+      }
+    }
+  }
+
+  /**
    * Remove any existing overlays.
    */
-  Future<AnalysisUpdateContentResult> removeAllOverlays() {
+  void removeAllOverlays() {
     Map<String, dynamic> files = new HashMap<String, dynamic>();
     for (String path in filesWithOverlays) {
       files[path] = new RemoveContentOverlay();
     }
-    return sendAnalysisUpdateContent(files);
+    sendAnalysisUpdateContent(files);
   }
 
-  @override
-  Future<AnalysisUpdateContentResult> sendAnalysisUpdateContent(
-      Map<String, dynamic> files) {
+  RequestData sendAnalysisGetErrors(String file) {
+    var params = new AnalysisGetErrorsParams(file).toJson();
+    return _send("analysis.getErrors", params);
+  }
+
+  RequestData sendAnalysisGetHover(String file, int offset) {
+    var params = new AnalysisGetHoverParams(file, offset).toJson();
+    return _send("analysis.getHover", params);
+  }
+
+  RequestData sendAnalysisGetLibraryDependencies() {
+    return _send("analysis.getLibraryDependencies", null);
+  }
+
+  RequestData sendAnalysisGetNavigation(String file, int offset, int length) {
+    var params = new AnalysisGetNavigationParams(file, offset, length).toJson();
+    return _send("analysis.getNavigation", params);
+  }
+
+  RequestData sendAnalysisGetReachableSources(String file) {
+    var params = new AnalysisGetReachableSourcesParams(file).toJson();
+    return _send("analysis.getReachableSources", params);
+  }
+
+  void sendAnalysisReanalyze({List<String> roots}) {
+    var params = new AnalysisReanalyzeParams(roots: roots).toJson();
+    _send("analysis.reanalyze", params);
+  }
+
+  void sendAnalysisSetAnalysisRoots(
+      List<String> included, List<String> excluded,
+      {Map<String, String> packageRoots}) {
+    _analysisRootIncludes = included;
+    _analysisRootExcludes = excluded;
+    var params = new AnalysisSetAnalysisRootsParams(included, excluded,
+            packageRoots: packageRoots)
+        .toJson();
+    _send("analysis.setAnalysisRoots", params);
+  }
+
+  void sendAnalysisSetGeneralSubscriptions(
+      List<GeneralAnalysisService> subscriptions) {
+    var params =
+        new AnalysisSetGeneralSubscriptionsParams(subscriptions).toJson();
+    _send("analysis.setGeneralSubscriptions", params);
+  }
+
+  void sendAnalysisSetPriorityFiles(List<String> files) {
+    var params = new AnalysisSetPriorityFilesParams(files).toJson();
+    _send("analysis.setPriorityFiles", params);
+  }
+
+  void sendAnalysisSetSubscriptions(
+      Map<AnalysisService, List<String>> subscriptions) {
+    var params = new AnalysisSetSubscriptionsParams(subscriptions).toJson();
+    _send("analysis.setSubscriptions", params);
+  }
+
+  void sendAnalysisUpdateContent(Map<String, dynamic> files) {
     files.forEach((String path, dynamic overlay) {
       if (overlay is AddContentOverlay) {
         filesWithOverlays.add(path);
@@ -139,14 +481,482 @@
         filesWithOverlays.remove(path);
       }
     });
-    return super.sendAnalysisUpdateContent(files);
+    var params = new AnalysisUpdateContentParams(files).toJson();
+    _send('analysis.updateContent', params);
+  }
+
+  void sendAnalysisUpdateOptions(AnalysisOptions options) {
+    var params = new AnalysisUpdateOptionsParams(options).toJson();
+    _send("analysis.updateOptions", params);
+  }
+
+  void sendCompletionGetSuggestions(String file, int offset) {
+    var params = new CompletionGetSuggestionsParams(file, offset).toJson();
+    _send("completion.getSuggestions", params);
+  }
+
+  RequestData sendDiagnosticGetDiagnostics() {
+    return _send("diagnostic.getDiagnostics", null);
+  }
+
+  RequestData sendEditFormat(
+      String file, int selectionOffset, int selectionLength,
+      {int lineLength}) {
+    var params = new EditFormatParams(file, selectionOffset, selectionLength,
+            lineLength: lineLength)
+        .toJson();
+    return _send("edit.format", params);
+  }
+
+  RequestData sendEditGetAssists(String file, int offset, int length) {
+    var params = new EditGetAssistsParams(file, offset, length).toJson();
+    return _send("edit.getAssists", params);
+  }
+
+  RequestData sendEditGetAvailableRefactorings(
+      String file, int offset, int length) {
+    var params =
+        new EditGetAvailableRefactoringsParams(file, offset, length).toJson();
+    return _send("edit.getAvailableRefactorings", params);
+  }
+
+  RequestData sendEditGetFixes(String file, int offset) {
+    var params = new EditGetFixesParams(file, offset).toJson();
+    return _send("edit.getFixes", params);
+  }
+
+  RequestData sendEditGetRefactoring(RefactoringKind kind, String file,
+      int offset, int length, bool validateOnly,
+      {RefactoringOptions options}) {
+    var params = new EditGetRefactoringParams(
+            kind, file, offset, length, validateOnly,
+            options: options)
+        .toJson();
+    return _send("edit.getRefactoring", params);
+  }
+
+  RequestData sendEditOrganizeDirectives(String file) {
+    var params = new EditOrganizeDirectivesParams(file).toJson();
+    return _send("edit.organizeDirectives", params);
+  }
+
+  RequestData sendEditSortMembers(String file) {
+    var params = new EditSortMembersParams(file).toJson();
+    return _send("edit.sortMembers", params);
+  }
+
+  RequestData sendExecutionCreateContext(String contextRoot) {
+    var params = new ExecutionCreateContextParams(contextRoot).toJson();
+    return _send("execution.createContext", params);
+  }
+
+  RequestData sendExecutionDeleteContext(String id) {
+    var params = new ExecutionDeleteContextParams(id).toJson();
+    return _send("execution.deleteContext", params);
+  }
+
+  RequestData sendExecutionMapUri(String id, {String file, String uri}) {
+    var params = new ExecutionMapUriParams(id, file: file, uri: uri).toJson();
+    return _send("execution.mapUri", params);
+  }
+
+  RequestData sendExecutionSetSubscriptions(
+      List<ExecutionService> subscriptions) {
+    var params = new ExecutionSetSubscriptionsParams(subscriptions).toJson();
+    return _send("execution.setSubscriptions", params);
+  }
+
+  void sendSearchFindElementReferences(
+      String file, int offset, bool includePotential) {
+    var params =
+        new SearchFindElementReferencesParams(file, offset, includePotential)
+            .toJson();
+    _send("search.findElementReferences", params);
+  }
+
+  void sendSearchFindMemberDeclarations(String name) {
+    var params = new SearchFindMemberDeclarationsParams(name).toJson();
+    _send("search.findMemberDeclarations", params);
+  }
+
+  void sendSearchFindMemberReferences(String name) {
+    var params = new SearchFindMemberReferencesParams(name).toJson();
+    _send("search.findMemberReferences", params);
+  }
+
+  void sendSearchFindTopLevelDeclarations(String pattern) {
+    var params = new SearchFindTopLevelDeclarationsParams(pattern).toJson();
+    _send("search.findTopLevelDeclarations", params);
+  }
+
+  void sendSearchGetTypeHierarchy(String file, int offset, {bool superOnly}) {
+    var params =
+        new SearchGetTypeHierarchyParams(file, offset, superOnly: superOnly)
+            .toJson();
+    _send("search.getTypeHierarchy", params);
+  }
+
+  RequestData sendServerGetVersion() {
+    return _send("server.getVersion", null);
+  }
+
+  void sendServerSetSubscriptions(List<ServerService> subscriptions) {
+    var params = new ServerSetSubscriptionsParams(subscriptions).toJson();
+    _send("server.setSubscriptions", params);
+  }
+
+  void sendServerShutdown() {
+    _send("server.shutdown", null);
   }
 
   /**
-   * Record the errors in the given [params].
+   * Start the server and listen for communications from it.
+   *
+   * If [checked] is `true`, the server's VM will be running in checked mode.
+   *
+   * If [debugServer] is `true`, the server will be started with "--debug",
+   * allowing a debugger to be attached.
+   *
+   * If [diagnosticPort] is not `null`, the server will serve status pages to
+   * the specified port.
+   *
+   * If [enableNewAnalysisDriver] is `true`, the server will use the new
+   * analysis driver.
+   *
+   * If [profileServer] is `true`, the server will be started with "--observe"
+   * and "--pause-isolates-on-exit", allowing the observatory to be used.
+   *
+   * If [useAnalysisHighlight2] is `true`, the server will use the new highlight
+   * APIs.
    */
-  void _recordErrors(AnalysisErrorsParams params) {
-    _errorMap[params.file] = params.errors;
+  Future<Null> start(
+      {bool checked: true,
+      bool debugServer: false,
+      int diagnosticPort,
+      bool enableNewAnalysisDriver: false,
+      bool profileServer: false,
+      String sdkPath,
+      int servicesPort,
+      bool useAnalysisHighlight2: false}) async {
+    if (_process != null) {
+      throw new Exception('Process already started');
+    }
+    String dartBinary = Platform.executable;
+    String rootDir =
+        _findRoot(Platform.script.toFilePath(windows: Platform.isWindows));
+    String serverPath =
+        path.normalize(path.join(rootDir, 'bin', 'server.dart'));
+    List<String> arguments = [];
+    //
+    // Add VM arguments.
+    //
+    if (debugServer) {
+      arguments.add('--debug');
+    }
+    if (profileServer) {
+      if (servicesPort == null) {
+        arguments.add('--observe');
+      } else {
+        arguments.add('--observe=$servicesPort');
+      }
+      arguments.add('--pause-isolates-on-exit');
+    } else if (servicesPort != null) {
+      arguments.add('--enable-vm-service=$servicesPort');
+    }
+    if (Platform.packageRoot != null) {
+      arguments.add('--package-root=${Platform.packageRoot}');
+    }
+    if (Platform.packageConfig != null) {
+      arguments.add('--packages=${Platform.packageConfig}');
+    }
+    if (checked) {
+      arguments.add('--checked');
+    }
+    //
+    // Add the server executable.
+    //
+    arguments.add(serverPath);
+    //
+    // Add server arguments.
+    //
+    if (diagnosticPort != null) {
+      arguments.add('--port');
+      arguments.add(diagnosticPort.toString());
+    }
+    if (sdkPath != null) {
+      arguments.add('--sdk=$sdkPath');
+    }
+    if (useAnalysisHighlight2) {
+      arguments.add('--useAnalysisHighlight2');
+    }
+    if (enableNewAnalysisDriver) {
+      arguments.add('--enable-new-analysis-driver');
+    }
+//    stdout.writeln('Launching $serverPath');
+//    stdout.writeln('$dartBinary ${arguments.join(' ')}');
+    _process = await Process.start(dartBinary, arguments);
+    _process.exitCode.then((int code) {
+      if (code != 0) {
+        throw new StateError('Server terminated with exit code $code');
+      }
+    });
+    _listenToOutput();
+    _serverConnectedCompleter = new Completer();
+    return _serverConnectedCompleter.future;
+  }
+
+  /**
+   * Find the root directory of the analysis_server package by proceeding
+   * upward to the 'test' dir, and then going up one more directory.
+   */
+  String _findRoot(String pathname) {
+    while (!['benchmark', 'test'].contains(path.basename(pathname))) {
+      String parent = path.dirname(pathname);
+      if (parent.length >= pathname.length) {
+        throw new Exception("Can't find root directory");
+      }
+      pathname = parent;
+    }
+    return path.dirname(pathname);
+  }
+
+  /**
+   * Handle a [notification] received from the server.
+   */
+  void _handleNotification(Notification notification) {
+    switch (notification.event) {
+      case "server.connected":
+//        new ServerConnectedParams.fromNotification(notification);
+        _serverConnectedCompleter.complete(null);
+        break;
+      case "server.error":
+//        new ServerErrorParams.fromNotification(notification);
+        throw new StateError('Server error: ${notification.toJson()}');
+        break;
+      case "server.status":
+        if (_analysisFinishedCompleter != null) {
+          ServerStatusParams params =
+              new ServerStatusParams.fromNotification(notification);
+          var analysis = params.analysis;
+          if (analysis != null && !analysis.isAnalyzing) {
+            _analysisFinishedCompleter.complete(null);
+          }
+        }
+        break;
+      case "analysis.analyzedFiles":
+        AnalysisAnalyzedFilesParams params =
+            new AnalysisAnalyzedFilesParams.fromNotification(notification);
+        _analyzedFiles = params.directories;
+        break;
+      case "analysis.errors":
+        AnalysisErrorsParams params =
+            new AnalysisErrorsParams.fromNotification(notification);
+        _errorMap.pathMap[params.file] = params.errors;
+        break;
+      case "analysis.flushResults":
+//        new AnalysisFlushResultsParams.fromNotification(notification);
+        _errorMap.pathMap.clear();
+        break;
+      case "analysis.folding":
+//        new AnalysisFoldingParams.fromNotification(notification);
+        break;
+      case "analysis.highlights":
+//        new AnalysisHighlightsParams.fromNotification(notification);
+        break;
+      case "analysis.implemented":
+//        new AnalysisImplementedParams.fromNotification(notification);
+        break;
+      case "analysis.invalidate":
+//        new AnalysisInvalidateParams.fromNotification(notification);
+        break;
+      case "analysis.navigation":
+//        new AnalysisNavigationParams.fromNotification(notification);
+        break;
+      case "analysis.occurrences":
+//        new AnalysisOccurrencesParams.fromNotification(notification);
+        break;
+      case "analysis.outline":
+//        new AnalysisOutlineParams.fromNotification(notification);
+        break;
+      case "analysis.overrides":
+//        new AnalysisOverridesParams.fromNotification(notification);
+        break;
+      case "completion.results":
+//        new CompletionResultsParams.fromNotification(notification);
+        break;
+      case "search.results":
+//        new SearchResultsParams.fromNotification(notification);
+        break;
+      case "execution.launchData":
+//        new ExecutionLaunchDataParams.fromNotification(notification);
+        break;
+      default:
+        throw new StateError(
+            'Unhandled notification: ${notification.toJson()}');
+    }
+  }
+
+  /**
+   * Handle a [response] received from the server.
+   */
+  void _handleResponse(Response response) {
+    String id = response.id.toString();
+    RequestData requestData = _requestDataMap[id];
+    requestData.recordResponse(response);
+//    switch (requestData.method) {
+//      case "analysis.getErrors":
+//        break;
+//      case "analysis.getHover":
+//        break;
+//      case "analysis.getLibraryDependencies":
+//        break;
+//      case "analysis.getNavigation":
+//        break;
+//      case "analysis.getReachableSources":
+//        break;
+//      case "analysis.reanalyze":
+//        break;
+//      case "analysis.setAnalysisRoots":
+//        break;
+//      case "analysis.setGeneralSubscriptions":
+//        break;
+//      case "analysis.setPriorityFiles":
+//        break;
+//      case "analysis.setSubscriptions":
+//        break;
+//      case 'analysis.updateContent':
+//        break;
+//      case "analysis.updateOptions":
+//        break;
+//      case "completion.getSuggestions":
+//        break;
+//      case "diagnostic.getDiagnostics":
+//        break;
+//      case "edit.format":
+//        break;
+//      case "edit.getAssists":
+//        break;
+//      case "edit.getAvailableRefactorings":
+//        break;
+//      case "edit.getFixes":
+//        break;
+//      case "edit.getRefactoring":
+//        break;
+//      case "edit.organizeDirectives":
+//        break;
+//      case "edit.sortMembers":
+//        break;
+//      case "execution.createContext":
+//        break;
+//      case "execution.deleteContext":
+//        break;
+//      case "execution.mapUri":
+//        break;
+//      case "execution.setSubscriptions":
+//        break;
+//      case "search.findElementReferences":
+//        break;
+//      case "search.findMemberDeclarations":
+//        break;
+//      case "search.findMemberReferences":
+//        break;
+//      case "search.findTopLevelDeclarations":
+//        break;
+//      case "search.getTypeHierarchy":
+//        break;
+//      case "server.getVersion":
+//        break;
+//      case "server.setSubscriptions":
+//        break;
+//      case "server.shutdown":
+//        break;
+//      default:
+//        throw new StateError('Unhandled response: ${response.toJson()}');
+//    }
+  }
+
+  /**
+   * Handle a [line] of input read from stderr.
+   */
+  void _handleStdErr(String line) {
+    String trimmedLine = line.trim();
+    logger?.log(fromStderr, '$trimmedLine');
+    throw new StateError('Message received on stderr: "$trimmedLine"');
+  }
+
+  /**
+   * Handle a [line] of input read from stdout.
+   */
+  void _handleStdOut(String line) {
+    /**
+     * Cast the given [value] to a Map, or throw an [ArgumentError] if the value
+     * cannot be cast.
+     */
+    Map asMap(Object value) {
+      if (value is Map) {
+        return value;
+      }
+      throw new ArgumentError('Expected a Map, found a ${value.runtimeType}');
+    }
+
+    String trimmedLine = line.trim();
+    if (trimmedLine.isEmpty ||
+        trimmedLine.startsWith('Observatory listening on ')) {
+      return;
+    }
+    logger?.log(fromServer, '$trimmedLine');
+    Map message = asMap(JSON.decoder.convert(trimmedLine));
+    if (message.containsKey('id')) {
+      // The message is a response.
+      Response response = new Response.fromJson(message);
+      _handleResponse(response);
+    } else {
+      // The message is a notification.
+      Notification notification = new Notification.fromJson(message);
+      String event = notification.event;
+      _notificationCountMap[event] = (_notificationCountMap[event] ?? 0) + 1;
+      _handleNotification(notification);
+    }
+  }
+
+  /**
+   * Start listening to output from the server.
+   */
+  void _listenToOutput() {
+    /**
+     * Install the given [handler] to listen to transformed output from the
+     * given [stream].
+     */
+    void installHandler(Stream<List<int>> stream, handler(String line)) {
+      stream
+          .transform((new Utf8Codec()).decoder)
+          .transform(new LineSplitter())
+          .listen(handler);
+    }
+
+    installHandler(_process.stdout, _handleStdOut);
+    installHandler(_process.stderr, _handleStdErr);
+  }
+
+  /**
+   * Send a command to the server. An 'id' will be automatically assigned.
+   */
+  RequestData _send(String method, Map<String, dynamic> params,
+      {void onResponse(Response response)}) {
+    String id = '${_nextId++}';
+    RequestData requestData = new RequestData(id, method, params, currentTime);
+    _requestDataMap[id] = requestData;
+    Map<String, dynamic> command = <String, dynamic>{
+      'id': id,
+      'method': method
+    };
+    if (params != null) {
+      command['params'] = params;
+    }
+    String line = JSON.encode(command);
+    _process.stdin.add(UTF8.encoder.convert('$line\n'));
+    logger?.log(fromClient, '$line');
+    return requestData;
   }
 }
 
@@ -284,6 +1094,6 @@
     buffer.writeln(filePath);
     _writeErrors('  Expected ', expectedErrors);
     buffer.writeln();
-    _writeErrors('  Found ', expectedErrors);
+    _writeErrors('  Found ', actualErrors);
   }
 }
diff --git a/pkg/analysis_server/test/test_all.dart b/pkg/analysis_server/test/test_all.dart
index 50dbfaa..0f7942f 100644
--- a/pkg/analysis_server/test/test_all.dart
+++ b/pkg/analysis_server/test/test_all.dart
@@ -8,6 +8,7 @@
 import 'analysis_server_test.dart' as analysis_server_test;
 import 'channel/test_all.dart' as channel_test;
 import 'completion_test.dart' as completion_test;
+import 'context_manager_driver_test.dart' as context_manager_driver_test;
 import 'context_manager_test.dart' as context_manager_test;
 import 'domain_analysis_test.dart' as domain_analysis_test;
 import 'domain_completion_test.dart' as domain_completion_test;
@@ -36,6 +37,7 @@
     analysis_server_test.main();
     channel_test.main();
     completion_test.main();
+    context_manager_driver_test.main();
     context_manager_test.main();
     domain_analysis_test.main();
     domain_completion_test.main();
@@ -54,5 +56,5 @@
     socket_server_test.main();
     source_all.main();
     src_all.main();
-  }, name: 'analisys_server');
+  }, name: 'analysis_server');
 }
diff --git a/pkg/analyzer/CHANGELOG.md b/pkg/analyzer/CHANGELOG.md
index e7a9e48..8449bf0 100644
--- a/pkg/analyzer/CHANGELOG.md
+++ b/pkg/analyzer/CHANGELOG.md
@@ -2,6 +2,7 @@
 * Changed the API for creating BazelWorkspace.  It should now be constructed using BazelWorkspace.find().  Note that this might return `null` in the event that the given path is not part of a BazelWorkspace.
 * Added an AST structure to support asserts in constructor initializers (AssertInitializer).  AstVisitor classes must now implement visitAssertInitializer().
 * Changed the API for creating PartOfDirective.  It now accepts a StringLiteral URI, to accomodate "part of" declarations with a URI string rather than a library name.
+* Removed AST constructors.  AST nodes should now be created using `astFactory`, located in `package:analyzer/dart/ast/standard_ast_factory.dart`.
 
 ## 0.29.0-alpha.0
 * Removed `Element.docRange`.
diff --git a/pkg/analyzer/benchmark/errors_in_all_libraries.dart b/pkg/analyzer/benchmark/errors_in_all_libraries.dart
index ad004bf..d46edba 100644
--- a/pkg/analyzer/benchmark/errors_in_all_libraries.dart
+++ b/pkg/analyzer/benchmark/errors_in_all_libraries.dart
@@ -9,6 +9,7 @@
 /// it easier to connect to this with observatory.
 import 'dart:io';
 
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/physical_file_system.dart';
@@ -61,7 +62,8 @@
 
     // Walk all of the transitively referenced libraries and compute errors.
     var errorCount = 0;
-    var allLibraries = _reachableLibraries(initialLibrary.element.library);
+    var allLibraries = _reachableLibraries(
+        resolutionMap.elementDeclaredByCompilationUnit(initialLibrary).library);
     for (var lib in allLibraries) {
       for (var unit in lib.units) {
         var source = unit.source;
diff --git a/pkg/analyzer/doc/tasks.html b/pkg/analyzer/doc/tasks.html
index df31e7a..344f26d 100644
--- a/pkg/analyzer/doc/tasks.html
+++ b/pkg/analyzer/doc/tasks.html
@@ -90,6 +90,7 @@
   EXPORTED_LIBRARIES -> ReadyLibraryElement2Task
   EXPORTED_LIBRARIES -> ReadyLibraryElement5Task
   EXPORTED_LIBRARIES -> ReadyLibraryElement7Task
+  EXPORTED_LIBRARIES -> ResolveDirectiveElementsTask
   EXPORTED_LIBRARIES -> ResolveTopLevelLibraryTypeBoundsTask
   EXPORTED_LIBRARIES [shape=box]
   EXPORT_SOURCE_CLOSURE -> BuildExportNamespaceTask
@@ -109,6 +110,7 @@
   IMPORTED_LIBRARIES -> ReadyLibraryElement2Task
   IMPORTED_LIBRARIES -> ReadyLibraryElement5Task
   IMPORTED_LIBRARIES -> ReadyLibraryElement7Task
+  IMPORTED_LIBRARIES -> ResolveDirectiveElementsTask
   IMPORTED_LIBRARIES -> ResolveTopLevelLibraryTypeBoundsTask
   IMPORTED_LIBRARIES -> ResolveTopLevelUnitTypeBoundsTask
   IMPORTED_LIBRARIES [shape=box]
@@ -194,6 +196,7 @@
   MODIFICATION_TIME -> BuildDirectiveElementsTask
   MODIFICATION_TIME -> BuildLibraryElementTask
   MODIFICATION_TIME -> ParseDartTask
+  MODIFICATION_TIME -> ResolveDirectiveElementsTask
   MODIFICATION_TIME -> ScanDartTask
   MODIFICATION_TIME -> VerifyUnitTask
   MODIFICATION_TIME [shape=box]
@@ -231,6 +234,7 @@
   READY_RESOLVED_UNIT [shape=box]
   REFERENCED_NAMES [shape=box]
   REFERENCED_SOURCES -> BuildDirectiveElementsTask
+  REFERENCED_SOURCES -> ResolveDirectiveElementsTask
   REFERENCED_SOURCES -> VerifyUnitTask
   REFERENCED_SOURCES [shape=box]
   REQUIRED_CONSTANTS -> VerifyUnitTask
@@ -275,6 +279,8 @@
   RESOLVED_UNIT8 [shape=box]
   RESOLVED_UNIT9 -> InferInstanceMembersInUnitTask
   RESOLVED_UNIT9 [shape=box]
+  RESOLVE_DIRECTIVES_ERRORS -> LibraryUnitErrorsTask
+  RESOLVE_DIRECTIVES_ERRORS [shape=box]
   RESOLVE_TYPE_BOUNDS_ERRORS -> LibraryUnitErrorsTask
   RESOLVE_TYPE_BOUNDS_ERRORS [shape=box]
   RESOLVE_TYPE_NAMES_ERRORS -> LibraryUnitErrorsTask
@@ -288,6 +294,7 @@
   ResolveConstantExpressionTask -> CONSTANT_EXPRESSION_RESOLVED
   ResolveDirectiveElementsTask -> CREATED_RESOLVED_UNIT2
   ResolveDirectiveElementsTask -> RESOLVED_UNIT2
+  ResolveDirectiveElementsTask -> RESOLVE_DIRECTIVES_ERRORS
   ResolveInstanceFieldsInUnitTask -> CREATED_RESOLVED_UNIT9
   ResolveInstanceFieldsInUnitTask -> RESOLVED_UNIT9
   ResolveLibraryReferencesTask -> LIBRARY_ELEMENT9
@@ -312,6 +319,7 @@
   SCAN_ERRORS -> dartErrorsForSource
   SCAN_ERRORS [shape=box]
   SOURCE_KIND -> BuildDirectiveElementsTask
+  SOURCE_KIND -> ResolveDirectiveElementsTask
   SOURCE_KIND [shape=box]
   STATIC_VARIABLE_RESOLUTION_ERRORS -> InferStaticVariableTypesInUnitTask
   STATIC_VARIABLE_RESOLUTION_ERRORS [shape=box]
diff --git a/pkg/analyzer/lib/context/declared_variables.dart b/pkg/analyzer/lib/context/declared_variables.dart
index 50c47dd..5f6d6f1 100644
--- a/pkg/analyzer/lib/context/declared_variables.dart
+++ b/pkg/analyzer/lib/context/declared_variables.dart
@@ -28,6 +28,13 @@
   Iterable<String> get variableNames => _declaredVariables.keys;
 
   /**
+   * Add all variables of [other] to this object.
+   */
+  void addAll(DeclaredVariables other) {
+    _declaredVariables.addAll(other._declaredVariables);
+  }
+
+  /**
    * Define a variable with the given [name] to have the given [value].
    */
   void define(String name, String value) {
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index c36925f..38e477f 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -40,7 +40,6 @@
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
-import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/element/element.dart' show AuxiliaryElements;
 import 'package:analyzer/src/generated/java_engine.dart';
 import 'package:analyzer/src/generated/source.dart' show LineInfo, Source;
@@ -61,12 +60,6 @@
  */
 abstract class AdjacentStrings extends StringLiteral {
   /**
-   * Initialize a newly created list of adjacent strings. To be syntactically
-   * valid, the list of [strings] must contain at least two elements.
-   */
-  factory AdjacentStrings(List<StringLiteral> strings) = AdjacentStringsImpl;
-
-  /**
    * Return the strings that are implicitly concatenated.
    */
   NodeList<StringLiteral> get strings;
@@ -121,16 +114,6 @@
  */
 abstract class Annotation extends AstNode {
   /**
-   * Initialize a newly created annotation. Both the [period] and the
-   * [constructorName] can be `null` if the annotation is not referencing a
-   * named constructor. The [arguments] can be `null` if the annotation is not
-   * referencing a constructor.
-   */
-  factory Annotation(Token atSign, Identifier name, Token period,
-          SimpleIdentifier constructorName, ArgumentList arguments) =>
-      new AnnotationImpl(atSign, name, period, constructorName, arguments);
-
-  /**
    * Return the arguments to the constructor being invoked, or `null` if this
    * annotation is not the invocation of a constructor.
    */
@@ -224,13 +207,6 @@
  */
 abstract class ArgumentList extends AstNode {
   /**
-   * Initialize a newly created list of arguments. The list of [arguments] can
-   * be `null` if there are no arguments.
-   */
-  factory ArgumentList(Token leftParenthesis, List<Expression> arguments,
-      Token rightParenthesis) = ArgumentListImpl;
-
-  /**
    * Return the expressions producing the values of the arguments. Although the
    * language requires that positional arguments appear before named arguments,
    * this class allows them to be intermixed.
@@ -278,19 +254,12 @@
  * An as expression.
  *
  *    asExpression ::=
- *        [Expression] 'as' [TypeName]
+ *        [Expression] 'as' [TypeAnnotation]
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class AsExpression extends Expression {
   /**
-   * Initialize a newly created as expression.
-   */
-  factory AsExpression(
-          Expression expression, Token asOperator, TypeName type) =>
-      new AsExpressionImpl(expression, asOperator, type);
-
-  /**
    * Return the 'as' operator.
    */
   Token get asOperator;
@@ -312,14 +281,14 @@
   void set expression(Expression expression);
 
   /**
-   * Return the name of the type being cast to.
+   * Return the type being cast to.
    */
-  TypeName get type;
+  TypeAnnotation get type;
 
   /**
-   * Set the name of the type being cast to to the given [name].
+   * Set the type being cast to to the given [type].
    */
-  void set type(TypeName name);
+  void set type(TypeAnnotation type);
 }
 
 /**
@@ -330,21 +299,7 @@
  *
  * Clients may not extend, implement or mix-in this class.
  */
-abstract class AssertInitializer implements Assertion, ConstructorInitializer {
-  /**
-   * Initialize a newly created assert initializer. The [comma] and [message]
-   * can be `null` if there is no message.
-   */
-  factory AssertInitializer(
-          Token assertKeyword,
-          Token leftParenthesis,
-          Expression condition,
-          Token comma,
-          Expression message,
-          Token rightParenthesis) =>
-      new AssertInitializerImpl(assertKeyword, leftParenthesis, condition,
-          comma, message, rightParenthesis);
-}
+abstract class AssertInitializer implements Assertion, ConstructorInitializer {}
 
 /**
  * An assertion, either in a block or in the initializer list of a constructor.
@@ -428,21 +383,6 @@
  */
 abstract class AssertStatement implements Assertion, Statement {
   /**
-   * Initialize a newly created assert statement. The [comma] and [message] can
-   * be `null` if there is no message.
-   */
-  factory AssertStatement(
-          Token assertKeyword,
-          Token leftParenthesis,
-          Expression condition,
-          Token comma,
-          Expression message,
-          Token rightParenthesis,
-          Token semicolon) =>
-      new AssertStatementImpl(assertKeyword, leftParenthesis, condition, comma,
-          message, rightParenthesis, semicolon);
-
-  /**
    * Return the semicolon terminating the statement.
    */
   Token get semicolon;
@@ -464,13 +404,6 @@
 abstract class AssignmentExpression extends Expression
     implements MethodReferenceExpression {
   /**
-   * Initialize a newly created assignment expression.
-   */
-  factory AssignmentExpression(
-          Expression leftHandSide, Token operator, Expression rightHandSide) =>
-      new AssignmentExpressionImpl(leftHandSide, operator, rightHandSide);
-
-  /**
    * Return the expression used to compute the left hand side.
    */
   Expression get leftHandSide;
@@ -623,7 +556,14 @@
 /**
  * An object that can be used to visit an AST structure.
  *
- * Clients may extend or implement this class.
+ * Clients may not extend, implement or mix-in this class. There are classes
+ * that implement this interface that provide useful default behaviors in
+ * `package:analyzer/dart/ast/visitor.dart`. A couple of the most useful include
+ * * SimpleAstVisitor which implements every visit method by doing nothing,
+ * * RecursiveAstVisitor which will cause every node in a structure to be
+ *   visited, and
+ * * ThrowingAstVisitor which implements every visit method by throwing an
+ *   exception.
  */
 abstract class AstVisitor<R> {
   R visitAdjacentStrings(AdjacentStrings node);
@@ -726,6 +666,10 @@
 
   R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node);
 
+  R visitGenericFunctionType(GenericFunctionType node);
+
+  R visitGenericTypeAlias(GenericTypeAlias node);
+
   R visitHideCombinator(HideCombinator node);
 
   R visitIfStatement(IfStatement node);
@@ -856,12 +800,6 @@
  */
 abstract class AwaitExpression extends Expression {
   /**
-   * Initialize a newly created await expression.
-   */
-  factory AwaitExpression(Token awaitKeyword, Expression expression) =>
-      new AwaitExpressionImpl(awaitKeyword, expression);
-
-  /**
    * Return the 'await' keyword.
    */
   Token get awaitKeyword;
@@ -893,13 +831,6 @@
 abstract class BinaryExpression extends Expression
     implements MethodReferenceExpression {
   /**
-   * Initialize a newly created binary expression.
-   */
-  factory BinaryExpression(
-          Expression leftOperand, Token operator, Expression rightOperand) =>
-      new BinaryExpressionImpl(leftOperand, operator, rightOperand);
-
-  /**
    * Return the expression used to compute the left operand.
    */
   Expression get leftOperand;
@@ -942,13 +873,6 @@
  */
 abstract class Block extends Statement {
   /**
-   * Initialize a newly created block of code.
-   */
-  factory Block(
-          Token leftBracket, List<Statement> statements, Token rightBracket) =>
-      new BlockImpl(leftBracket, statements, rightBracket);
-
-  /**
    * Return the left curly bracket.
    */
   Token get leftBracket;
@@ -984,15 +908,6 @@
  */
 abstract class BlockFunctionBody extends FunctionBody {
   /**
-   * Initialize a newly created function body consisting of a block of
-   * statements. The [keyword] can be `null` if there is no keyword specified
-   * for the block. The [star] can be `null` if there is no star following the
-   * keyword (and must be `null` if there is no keyword).
-   */
-  factory BlockFunctionBody(Token keyword, Token star, Block block) =>
-      new BlockFunctionBodyImpl(keyword, star, block);
-
-  /**
    * Return the block representing the body of the function.
    */
   Block get block;
@@ -1023,11 +938,6 @@
  */
 abstract class BooleanLiteral extends Literal {
   /**
-   * Initialize a newly created boolean literal.
-   */
-  factory BooleanLiteral(Token literal, bool value) = BooleanLiteralImpl;
-
-  /**
    * Return the token representing the literal.
    */
   Token get literal;
@@ -1053,14 +963,6 @@
  */
 abstract class BreakStatement extends Statement {
   /**
-   * Initialize a newly created break statement. The [label] can be `null` if
-   * there is no label associated with the statement.
-   */
-  factory BreakStatement(
-          Token breakKeyword, SimpleIdentifier label, Token semicolon) =>
-      new BreakStatementImpl(breakKeyword, label, semicolon);
-
-  /**
    * Return the token representing the 'break' keyword.
    */
   Token get breakKeyword;
@@ -1129,14 +1031,6 @@
  */
 abstract class CascadeExpression extends Expression {
   /**
-   * Initialize a newly created cascade expression. The list of
-   * [cascadeSections] must contain at least one element.
-   */
-  factory CascadeExpression(
-          Expression target, List<Expression> cascadeSections) =>
-      new CascadeExpressionImpl(target, cascadeSections);
-
-  /**
    * Return the cascade sections sharing the common target.
    */
   NodeList<Expression> get cascadeSections;
@@ -1166,33 +1060,6 @@
  */
 abstract class CatchClause extends AstNode {
   /**
-   * Initialize a newly created catch clause. The [onKeyword] and
-   * [exceptionType] can be `null` if the clause will catch all exceptions. The
-   * [comma] and [stackTraceParameter] can be `null` if the stack trace
-   * parameter is not defined.
-   */
-  factory CatchClause(
-          Token onKeyword,
-          TypeName exceptionType,
-          Token catchKeyword,
-          Token leftParenthesis,
-          SimpleIdentifier exceptionParameter,
-          Token comma,
-          SimpleIdentifier stackTraceParameter,
-          Token rightParenthesis,
-          Block body) =>
-      new CatchClauseImpl(
-          onKeyword,
-          exceptionType,
-          catchKeyword,
-          leftParenthesis,
-          exceptionParameter,
-          comma,
-          stackTraceParameter,
-          rightParenthesis,
-          body);
-
-  /**
    * Return the body of the catch block.
    */
   Block get body;
@@ -1241,13 +1108,13 @@
    * Return the type of exceptions caught by this catch clause, or `null` if
    * this catch clause catches every type of exception.
    */
-  TypeName get exceptionType;
+  TypeAnnotation get exceptionType;
 
   /**
    * Set the type of exceptions caught by this catch clause to the given
    * [exceptionType].
    */
-  void set exceptionType(TypeName exceptionType);
+  void set exceptionType(TypeAnnotation exceptionType);
 
   /**
    * Return the left parenthesis, or `null` if there is no 'catch' keyword.
@@ -1306,43 +1173,6 @@
  */
 abstract class ClassDeclaration extends NamedCompilationUnitMember {
   /**
-   * Initialize a newly created class declaration. Either or both of the
-   * [comment] and [metadata] can be `null` if the class does not have the
-   * corresponding attribute. The [abstractKeyword] can be `null` if the class
-   * is not abstract. The [typeParameters] can be `null` if the class does not
-   * have any type parameters. Any or all of the [extendsClause], [withClause],
-   * and [implementsClause] can be `null` if the class does not have the
-   * corresponding clause. The list of [members] can be `null` if the class does
-   * not have any members.
-   */
-  factory ClassDeclaration(
-          Comment comment,
-          List<Annotation> metadata,
-          Token abstractKeyword,
-          Token classKeyword,
-          SimpleIdentifier name,
-          TypeParameterList typeParameters,
-          ExtendsClause extendsClause,
-          WithClause withClause,
-          ImplementsClause implementsClause,
-          Token leftBracket,
-          List<ClassMember> members,
-          Token rightBracket) =>
-      new ClassDeclarationImpl(
-          comment,
-          metadata,
-          abstractKeyword,
-          classKeyword,
-          name,
-          typeParameters,
-          extendsClause,
-          withClause,
-          implementsClause,
-          leftBracket,
-          members,
-          rightBracket);
-
-  /**
    * Return the 'abstract' keyword, or `null` if the keyword was absent.
    */
   Token get abstractKeyword;
@@ -1490,39 +1320,6 @@
  */
 abstract class ClassTypeAlias extends TypeAlias {
   /**
-   * Initialize a newly created class type alias. Either or both of the
-   * [comment] and [metadata] can be `null` if the class type alias does not
-   * have the corresponding attribute. The [typeParameters] can be `null` if the
-   * class does not have any type parameters. The [abstractKeyword] can be
-   * `null` if the class is not abstract. The [implementsClause] can be `null`
-   * if the class does not implement any interfaces.
-   */
-  factory ClassTypeAlias(
-          Comment comment,
-          List<Annotation> metadata,
-          Token keyword,
-          SimpleIdentifier name,
-          TypeParameterList typeParameters,
-          Token equals,
-          Token abstractKeyword,
-          TypeName superclass,
-          WithClause withClause,
-          ImplementsClause implementsClause,
-          Token semicolon) =>
-      new ClassTypeAliasImpl(
-          comment,
-          metadata,
-          keyword,
-          name,
-          typeParameters,
-          equals,
-          abstractKeyword,
-          superclass,
-          withClause,
-          implementsClause,
-          semicolon);
-
-  /**
    * Return the token for the 'abstract' keyword, or `null` if this is not
    * defining an abstract class.
    */
@@ -1638,15 +1435,6 @@
  */
 abstract class Comment extends AstNode {
   /**
-   * Initialize a newly created comment. The list of [tokens] must contain at
-   * least one token. The [type] is the type of the comment. The list of
-   * [references] can be empty if the comment does not contain any embedded
-   * references.
-   */
-  factory Comment(List<Token> tokens, CommentType type,
-      List<CommentReference> references) = CommentImpl;
-
-  /**
    * Return `true` if this is a block comment.
    */
   bool get isBlock;
@@ -1670,32 +1458,6 @@
    * Return the tokens representing the comment.
    */
   List<Token> get tokens;
-
-  /**
-   * Create a block comment consisting of the given [tokens].
-   */
-  static Comment createBlockComment(List<Token> tokens) =>
-      CommentImpl.createBlockComment(tokens);
-
-  /**
-   * Create a documentation comment consisting of the given [tokens].
-   */
-  static Comment createDocumentationComment(List<Token> tokens) =>
-      CommentImpl.createDocumentationComment(tokens);
-
-  /**
-   * Create a documentation comment consisting of the given [tokens] and having
-   * the given [references] embedded within it.
-   */
-  static Comment createDocumentationCommentWithReferences(
-          List<Token> tokens, List<CommentReference> references) =>
-      CommentImpl.createDocumentationCommentWithReferences(tokens, references);
-
-  /**
-   * Create an end-of-line comment consisting of the given [tokens].
-   */
-  static Comment createEndOfLineComment(List<Token> tokens) =>
-      CommentImpl.createEndOfLineComment(tokens);
 }
 
 /**
@@ -1708,13 +1470,6 @@
  */
 abstract class CommentReference extends AstNode {
   /**
-   * Initialize a newly created reference to a Dart element. The [newKeyword]
-   * can be `null` if the reference is not to a constructor.
-   */
-  factory CommentReference(Token newKeyword, Identifier identifier) =>
-      new CommentReferenceImpl(newKeyword, identifier);
-
-  /**
    * Return the identifier being referenced.
    */
   Identifier get identifier;
@@ -1763,22 +1518,6 @@
  */
 abstract class CompilationUnit extends AstNode {
   /**
-   * Initialize a newly created compilation unit to have the given directives
-   * and declarations. The [scriptTag] can be `null` if there is no script tag
-   * in the compilation unit. The list of [directives] can be `null` if there
-   * are no directives in the compilation unit. The list of [declarations] can
-   * be `null` if there are no declarations in the compilation unit.
-   */
-  factory CompilationUnit(
-          Token beginToken,
-          ScriptTag scriptTag,
-          List<Directive> directives,
-          List<CompilationUnitMember> declarations,
-          Token endToken) =>
-      new CompilationUnitImpl(
-          beginToken, scriptTag, directives, declarations, endToken);
-
-  /**
    * Set the first token included in this node's source range to the given
    * [token].
    */
@@ -1867,14 +1606,6 @@
  */
 abstract class ConditionalExpression extends Expression {
   /**
-   * Initialize a newly created conditional expression.
-   */
-  factory ConditionalExpression(Expression condition, Token question,
-          Expression thenExpression, Token colon, Expression elseExpression) =>
-      new ConditionalExpressionImpl(
-          condition, question, thenExpression, colon, elseExpression);
-
-  /**
    * Return the token used to separate the then expression from the else
    * expression.
    */
@@ -1950,20 +1681,6 @@
  */
 abstract class Configuration extends AstNode {
   /**
-   * Initialize a newly created configuration.
-   */
-  factory Configuration(
-          Token ifKeyword,
-          Token leftParenthesis,
-          DottedName name,
-          Token equalToken,
-          StringLiteral value,
-          Token rightParenthesis,
-          StringLiteral libraryUri) =>
-      new ConfigurationImpl(ifKeyword, leftParenthesis, name, equalToken, value,
-          rightParenthesis, libraryUri);
-
-  /**
    * Return the token for the equal operator, or `null` if the condition does
    * not include an equality test.
    */
@@ -2090,50 +1807,6 @@
  */
 abstract class ConstructorDeclaration extends ClassMember {
   /**
-   * Initialize a newly created constructor declaration. The [externalKeyword]
-   * can be `null` if the constructor is not external. Either or both of the
-   * [comment] and [metadata] can be `null` if the constructor does not have the
-   * corresponding attribute. The [constKeyword] can be `null` if the
-   * constructor cannot be used to create a constant. The [factoryKeyword] can
-   * be `null` if the constructor is not a factory. The [period] and [name] can
-   * both be `null` if the constructor is not a named constructor. The
-   * [separator] can be `null` if the constructor does not have any initializers
-   * and does not redirect to a different constructor. The list of
-   * [initializers] can be `null` if the constructor does not have any
-   * initializers. The [redirectedConstructor] can be `null` if the constructor
-   * does not redirect to a different constructor. The [body] can be `null` if
-   * the constructor does not have a body.
-   */
-  factory ConstructorDeclaration(
-          Comment comment,
-          List<Annotation> metadata,
-          Token externalKeyword,
-          Token constKeyword,
-          Token factoryKeyword,
-          Identifier returnType,
-          Token period,
-          SimpleIdentifier name,
-          FormalParameterList parameters,
-          Token separator,
-          List<ConstructorInitializer> initializers,
-          ConstructorName redirectedConstructor,
-          FunctionBody body) =>
-      new ConstructorDeclarationImpl(
-          comment,
-          metadata,
-          externalKeyword,
-          constKeyword,
-          factoryKeyword,
-          returnType,
-          period,
-          name,
-          parameters,
-          separator,
-          initializers,
-          redirectedConstructor,
-          body);
-
-  /**
    * Return the body of the constructor, or `null` if the constructor does not
    * have a body.
    */
@@ -2271,16 +1944,6 @@
  */
 abstract class ConstructorFieldInitializer extends ConstructorInitializer {
   /**
-   * Initialize a newly created field initializer to initialize the field with
-   * the given name to the value of the given expression. The [thisKeyword] and
-   * [period] can be `null` if the 'this' keyword was not specified.
-   */
-  factory ConstructorFieldInitializer(Token thisKeyword, Token period,
-          SimpleIdentifier fieldName, Token equals, Expression expression) =>
-      new ConstructorFieldInitializerImpl(
-          thisKeyword, period, fieldName, equals, expression);
-
-  /**
    * Return the token for the equal sign between the field name and the
    * expression.
    */
@@ -2360,13 +2023,6 @@
 abstract class ConstructorName extends AstNode
     implements ConstructorReferenceNode {
   /**
-   * Initialize a newly created constructor name. The [period] and [name] can be
-   * `null` if the constructor being named is the unnamed constructor.
-   */
-  factory ConstructorName(TypeName type, Token period, SimpleIdentifier name) =>
-      new ConstructorNameImpl(type, period, name);
-
-  /**
    * Return the name of the constructor, or `null` if the specified constructor
    * is the unnamed constructor.
    */
@@ -2430,14 +2086,6 @@
  */
 abstract class ContinueStatement extends Statement {
   /**
-   * Initialize a newly created continue statement. The [label] can be `null` if
-   * there is no label associated with the statement.
-   */
-  factory ContinueStatement(
-          Token continueKeyword, SimpleIdentifier label, Token semicolon) =>
-      new ContinueStatementImpl(continueKeyword, label, semicolon);
-
-  /**
    * Return the token representing the 'continue' keyword.
    */
   Token get continueKeyword;
@@ -2509,16 +2157,6 @@
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class DeclaredIdentifier extends Declaration {
-  /**
-   * Initialize a newly created formal parameter. Either or both of the
-   * [comment] and [metadata] can be `null` if the declaration does not have the
-   * corresponding attribute. The [keyword] can be `null` if a type name is
-   * given. The [type] must be `null` if the keyword is 'var'.
-   */
-  factory DeclaredIdentifier(Comment comment, List<Annotation> metadata,
-          Token keyword, TypeName type, SimpleIdentifier identifier) =>
-      new DeclaredIdentifierImpl(comment, metadata, keyword, type, identifier);
-
   @override
   LocalVariableElement get element;
 
@@ -2560,12 +2198,12 @@
    * Return the name of the declared type of the parameter, or `null` if the
    * parameter does not have a declared type.
    */
-  TypeName get type;
+  TypeAnnotation get type;
 
   /**
-   * Set the name of the declared type of the parameter to the given [typeName].
+   * Set the declared type of the parameter to the given [type].
    */
-  void set type(TypeName typeName);
+  void set type(TypeAnnotation type);
 }
 
 /**
@@ -2583,14 +2221,6 @@
  */
 abstract class DefaultFormalParameter extends FormalParameter {
   /**
-   * Initialize a newly created default formal parameter. The [separator] and
-   * [defaultValue] can be `null` if there is no default value.
-   */
-  factory DefaultFormalParameter(NormalFormalParameter parameter,
-          ParameterKind kind, Token separator, Expression defaultValue) =>
-      new DefaultFormalParameterImpl(parameter, kind, separator, defaultValue);
-
-  /**
    * Return the expression computing the default value for the parameter, or
    * `null` if there is no default value.
    */
@@ -2672,20 +2302,6 @@
  */
 abstract class DoStatement extends Statement {
   /**
-   * Initialize a newly created do loop.
-   */
-  factory DoStatement(
-          Token doKeyword,
-          Statement body,
-          Token whileKeyword,
-          Token leftParenthesis,
-          Expression condition,
-          Token rightParenthesis,
-          Token semicolon) =>
-      new DoStatementImpl(doKeyword, body, whileKeyword, leftParenthesis,
-          condition, rightParenthesis, semicolon);
-
-  /**
    * Return the body of the loop.
    */
   Statement get body;
@@ -2767,11 +2383,6 @@
  */
 abstract class DottedName extends AstNode {
   /**
-   * Initialize a newly created dotted name.
-   */
-  factory DottedName(List<SimpleIdentifier> components) = DottedNameImpl;
-
-  /**
    * Return the components of the identifier.
    */
   NodeList<SimpleIdentifier> get components;
@@ -2791,11 +2402,6 @@
  */
 abstract class DoubleLiteral extends Literal {
   /**
-   * Initialize a newly created floating point literal.
-   */
-  factory DoubleLiteral(Token literal, double value) = DoubleLiteralImpl;
-
-  /**
    * Return the token representing the literal.
    */
   Token get literal;
@@ -2827,11 +2433,6 @@
  */
 abstract class EmptyFunctionBody extends FunctionBody {
   /**
-   * Initialize a newly created function body.
-   */
-  factory EmptyFunctionBody(Token semicolon) = EmptyFunctionBodyImpl;
-
-  /**
    * Return the token representing the semicolon that marks the end of the
    * function body.
    */
@@ -2854,11 +2455,6 @@
  */
 abstract class EmptyStatement extends Statement {
   /**
-   * Initialize a newly created empty statement.
-   */
-  factory EmptyStatement(Token semicolon) = EmptyStatementImpl;
-
-  /**
    * Return the semicolon terminating the statement.
    */
   Token get semicolon;
@@ -2876,16 +2472,6 @@
  */
 abstract class EnumConstantDeclaration extends Declaration {
   /**
-   * Initialize a newly created enum constant declaration. Either or both of the
-   * [comment] and [metadata] can be `null` if the constant does not have the
-   * corresponding attribute. (Technically, enum constants cannot have metadata,
-   * but we allow it for consistency.)
-   */
-  factory EnumConstantDeclaration(
-          Comment comment, List<Annotation> metadata, SimpleIdentifier name) =>
-      new EnumConstantDeclarationImpl(comment, metadata, name);
-
-  /**
    * Return the name of the constant.
    */
   SimpleIdentifier get name;
@@ -2906,23 +2492,6 @@
  */
 abstract class EnumDeclaration extends NamedCompilationUnitMember {
   /**
-   * Initialize a newly created enumeration declaration. Either or both of the
-   * [comment] and [metadata] can be `null` if the declaration does not have the
-   * corresponding attribute. The list of [constants] must contain at least one
-   * value.
-   */
-  factory EnumDeclaration(
-          Comment comment,
-          List<Annotation> metadata,
-          Token enumKeyword,
-          SimpleIdentifier name,
-          Token leftBracket,
-          List<EnumConstantDeclaration> constants,
-          Token rightBracket) =>
-      new EnumDeclarationImpl(comment, metadata, enumKeyword, name, leftBracket,
-          constants, rightBracket);
-
-  /**
    * Return the enumeration constants being declared.
    */
   NodeList<EnumConstantDeclaration> get constants;
@@ -2969,24 +2538,7 @@
  *
  * Clients may not extend, implement or mix-in this class.
  */
-abstract class ExportDirective extends NamespaceDirective {
-  /**
-   * Initialize a newly created export directive. Either or both of the
-   * [comment] and [metadata] can be `null` if the directive does not have the
-   * corresponding attribute. The list of [combinators] can be `null` if there
-   * are no combinators.
-   */
-  factory ExportDirective(
-          Comment comment,
-          List<Annotation> metadata,
-          Token keyword,
-          StringLiteral libraryUri,
-          List<Configuration> configurations,
-          List<Combinator> combinators,
-          Token semicolon) =>
-      new ExportDirectiveImpl(comment, metadata, keyword, libraryUri,
-          configurations, combinators, semicolon);
-}
+abstract class ExportDirective extends NamespaceDirective {}
 
 /**
  * A node that represents an expression.
@@ -3099,16 +2651,6 @@
  */
 abstract class ExpressionFunctionBody extends FunctionBody {
   /**
-   * Initialize a newly created function body consisting of a block of
-   * statements. The [keyword] can be `null` if the function body is not an
-   * async function body.
-   */
-  factory ExpressionFunctionBody(Token keyword, Token functionDefinition,
-          Expression expression, Token semicolon) =>
-      new ExpressionFunctionBodyImpl(
-          keyword, functionDefinition, expression, semicolon);
-
-  /**
    * Return the expression representing the body of the function.
    */
   Expression get expression;
@@ -3157,12 +2699,6 @@
  */
 abstract class ExpressionStatement extends Statement {
   /**
-   * Initialize a newly created expression statement.
-   */
-  factory ExpressionStatement(Expression expression, Token semicolon) =>
-      new ExpressionStatementImpl(expression, semicolon);
-
-  /**
    * Return the expression that comprises the statement.
    */
   Expression get expression;
@@ -3194,12 +2730,6 @@
  */
 abstract class ExtendsClause extends AstNode {
   /**
-   * Initialize a newly created extends clause.
-   */
-  factory ExtendsClause(Token extendsKeyword, TypeName superclass) =>
-      new ExtendsClauseImpl(extendsKeyword, superclass);
-
-  /**
    * Return the token representing the 'extends' keyword.
    */
   Token get extendsKeyword;
@@ -3230,19 +2760,9 @@
  */
 abstract class FieldDeclaration extends ClassMember {
   /**
-   * Initialize a newly created field declaration. Either or both of the
-   * [comment] and [metadata] can be `null` if the declaration does not have the
-   * corresponding attribute. The [staticKeyword] can be `null` if the field is
-   * not a static field.
+   * The 'covariant' keyword, or `null` if the keyword was not used.
    */
-  factory FieldDeclaration(
-          Comment comment,
-          List<Annotation> metadata,
-          Token staticKeyword,
-          VariableDeclarationList fieldList,
-          Token semicolon) =>
-      new FieldDeclarationImpl(
-          comment, metadata, staticKeyword, fieldList, semicolon);
+  Token get covariantKeyword;
 
   /**
    * Return the fields being declared.
@@ -3285,35 +2805,13 @@
  * A field formal parameter.
  *
  *    fieldFormalParameter ::=
- *        ('final' [TypeName] | 'const' [TypeName] | 'var' | [TypeName])?
+ *        ('final' [TypeAnnotation] | 'const' [TypeAnnotation] | 'var' | [TypeAnnotation])?
  *        'this' '.' [SimpleIdentifier] ([TypeParameterList]? [FormalParameterList])?
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class FieldFormalParameter extends NormalFormalParameter {
   /**
-   * Initialize a newly created formal parameter. Either or both of the
-   * [comment] and [metadata] can be `null` if the parameter does not have the
-   * corresponding attribute. The [keyword] can be `null` if there is a type.
-   * The [type] must be `null` if the keyword is 'var'. The [thisKeyword] and
-   * [period] can be `null` if the keyword 'this' was not provided.  The
-   * [parameters] can be `null` if this is not a function-typed field formal
-   * parameter.
-   */
-  factory FieldFormalParameter(
-          Comment comment,
-          List<Annotation> metadata,
-          Token keyword,
-          TypeName type,
-          Token thisKeyword,
-          Token period,
-          SimpleIdentifier identifier,
-          TypeParameterList typeParameters,
-          FormalParameterList parameters) =>
-      new FieldFormalParameterImpl(comment, metadata, keyword, type,
-          thisKeyword, period, identifier, typeParameters, parameters);
-
-  /**
    * Return the token representing either the 'final', 'const' or 'var' keyword,
    * or `null` if no keyword was used.
    */
@@ -3358,17 +2856,16 @@
   void set thisKeyword(Token token);
 
   /**
-   * Return the name of the declared type of the parameter, or `null` if the
-   * parameter does not have a declared type. Note that if this is a
-   * function-typed field formal parameter this is the return type of the
-   * function.
+   * Return the declared type of the parameter, or `null` if the parameter does
+   * not have a declared type. Note that if this is a function-typed field
+   * formal parameter this is the return type of the function.
    */
-  TypeName get type;
+  TypeAnnotation get type;
 
   /**
-   * Set the name of the declared type of the parameter to the given [typeName].
+   * Set the declared type of the parameter to the given [type].
    */
-  void set type(TypeName typeName);
+  void set type(TypeAnnotation type);
 
   /**
    * Return the type parameters associated with this method, or `null` if this
@@ -3394,54 +2891,6 @@
  */
 abstract class ForEachStatement extends Statement {
   /**
-   * Initialize a newly created for-each statement whose loop control variable
-   * is declared internally (in the for-loop part). The [awaitKeyword] can be
-   * `null` if this is not an asynchronous for loop.
-   */
-  factory ForEachStatement.withDeclaration(
-          Token awaitKeyword,
-          Token forKeyword,
-          Token leftParenthesis,
-          DeclaredIdentifier loopVariable,
-          Token inKeyword,
-          Expression iterator,
-          Token rightParenthesis,
-          Statement body) =>
-      new ForEachStatementImpl.withDeclaration(
-          awaitKeyword,
-          forKeyword,
-          leftParenthesis,
-          loopVariable,
-          inKeyword,
-          iterator,
-          rightParenthesis,
-          body);
-
-  /**
-   * Initialize a newly created for-each statement whose loop control variable
-   * is declared outside the for loop. The [awaitKeyword] can be `null` if this
-   * is not an asynchronous for loop.
-   */
-  factory ForEachStatement.withReference(
-          Token awaitKeyword,
-          Token forKeyword,
-          Token leftParenthesis,
-          SimpleIdentifier identifier,
-          Token inKeyword,
-          Expression iterator,
-          Token rightParenthesis,
-          Statement body) =>
-      new ForEachStatementImpl.withReference(
-          awaitKeyword,
-          forKeyword,
-          leftParenthesis,
-          identifier,
-          inKeyword,
-          iterator,
-          rightParenthesis,
-          body);
-
-  /**
    * Return the token representing the 'await' keyword, or `null` if there is no
    * 'await' keyword.
    */
@@ -3547,6 +2996,11 @@
  */
 abstract class FormalParameter extends AstNode {
   /**
+   * The 'covariant' keyword, or `null` if the keyword was not used.
+   */
+  Token get covariantKeyword;
+
+  /**
    * Return the element representing this parameter, or `null` if this parameter
    * has not been resolved.
    */
@@ -3612,18 +3066,6 @@
  */
 abstract class FormalParameterList extends AstNode {
   /**
-   * Initialize a newly created parameter list. The list of [parameters] can be
-   * `null` if there are no parameters. The [leftDelimiter] and [rightDelimiter]
-   * can be `null` if there are no optional parameters.
-   */
-  factory FormalParameterList(
-      Token leftParenthesis,
-      List<FormalParameter> parameters,
-      Token leftDelimiter,
-      Token rightDelimiter,
-      Token rightParenthesis) = FormalParameterListImpl;
-
-  /**
    * Return the left square bracket ('[') or left curly brace ('{') introducing
    * the optional parameters, or `null` if there are no optional parameters.
    */
@@ -3697,35 +3139,6 @@
  */
 abstract class ForStatement extends Statement {
   /**
-   * Initialize a newly created for statement. Either the [variableList] or the
-   * [initialization] must be `null`. Either the [condition] and the list of
-   * [updaters] can be `null` if the loop does not have the corresponding
-   * attribute.
-   */
-  factory ForStatement(
-          Token forKeyword,
-          Token leftParenthesis,
-          VariableDeclarationList variableList,
-          Expression initialization,
-          Token leftSeparator,
-          Expression condition,
-          Token rightSeparator,
-          List<Expression> updaters,
-          Token rightParenthesis,
-          Statement body) =>
-      new ForStatementImpl(
-          forKeyword,
-          leftParenthesis,
-          variableList,
-          initialization,
-          leftSeparator,
-          condition,
-          rightSeparator,
-          updaters,
-          rightParenthesis,
-          body);
-
-  /**
    * Return the body of the loop.
    */
   Statement get body;
@@ -3905,25 +3318,6 @@
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class FunctionDeclaration extends NamedCompilationUnitMember {
-  /**
-   * Initialize a newly created function declaration. Either or both of the
-   * [comment] and [metadata] can be `null` if the function does not have the
-   * corresponding attribute. The [externalKeyword] can be `null` if the
-   * function is not an external function. The [returnType] can be `null` if no
-   * return type was specified. The [propertyKeyword] can be `null` if the
-   * function is neither a getter or a setter.
-   */
-  factory FunctionDeclaration(
-          Comment comment,
-          List<Annotation> metadata,
-          Token externalKeyword,
-          TypeName returnType,
-          Token propertyKeyword,
-          SimpleIdentifier name,
-          FunctionExpression functionExpression) =>
-      new FunctionDeclarationImpl(comment, metadata, externalKeyword,
-          returnType, propertyKeyword, name, functionExpression);
-
   @override
   ExecutableElement get element;
 
@@ -3974,12 +3368,12 @@
    * Return the return type of the function, or `null` if no return type was
    * declared.
    */
-  TypeName get returnType;
+  TypeAnnotation get returnType;
 
   /**
-   * Set the return type of the function to the given [returnType].
+   * Set the return type of the function to the given [type].
    */
-  void set returnType(TypeName returnType);
+  void set returnType(TypeAnnotation type);
 }
 
 /**
@@ -3989,13 +3383,6 @@
  */
 abstract class FunctionDeclarationStatement extends Statement {
   /**
-   * Initialize a newly created function declaration statement.
-   */
-  factory FunctionDeclarationStatement(
-          FunctionDeclaration functionDeclaration) =
-      FunctionDeclarationStatementImpl;
-
-  /**
    * Return the function declaration being wrapped.
    */
   FunctionDeclaration get functionDeclaration;
@@ -4017,13 +3404,6 @@
  */
 abstract class FunctionExpression extends Expression {
   /**
-   * Initialize a newly created function declaration.
-   */
-  factory FunctionExpression(TypeParameterList typeParameters,
-          FormalParameterList parameters, FunctionBody body) =>
-      new FunctionExpressionImpl(typeParameters, parameters, body);
-
-  /**
    * Return the body of the function, or `null` if this is an external function.
    */
   FunctionBody get body;
@@ -4081,14 +3461,6 @@
  */
 abstract class FunctionExpressionInvocation extends InvocationExpression {
   /**
-   * Initialize a newly created function expression invocation.
-   */
-  factory FunctionExpressionInvocation(Expression function,
-          TypeArgumentList typeArguments, ArgumentList argumentList) =>
-      new FunctionExpressionInvocationImpl(
-          function, typeArguments, argumentList);
-
-  /**
    * Set the list of arguments to the method to the given [argumentList].
    */
   void set argumentList(ArgumentList argumentList);
@@ -4154,31 +3526,12 @@
  *        functionPrefix [TypeParameterList]? [FormalParameterList] ';'
  *
  *    functionPrefix ::=
- *        [TypeName]? [SimpleIdentifier]
+ *        [TypeAnnotation]? [SimpleIdentifier]
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class FunctionTypeAlias extends TypeAlias {
   /**
-   * Initialize a newly created function type alias. Either or both of the
-   * [comment] and [metadata] can be `null` if the function does not have the
-   * corresponding attribute. The [returnType] can be `null` if no return type
-   * was specified. The [typeParameters] can be `null` if the function has no
-   * type parameters.
-   */
-  factory FunctionTypeAlias(
-          Comment comment,
-          List<Annotation> metadata,
-          Token keyword,
-          TypeName returnType,
-          SimpleIdentifier name,
-          TypeParameterList typeParameters,
-          FormalParameterList parameters,
-          Token semicolon) =>
-      new FunctionTypeAliasImpl(comment, metadata, keyword, returnType, name,
-          typeParameters, parameters, semicolon);
-
-  /**
    * Return the parameters associated with the function type.
    */
   FormalParameterList get parameters;
@@ -4190,16 +3543,15 @@
   void set parameters(FormalParameterList parameters);
 
   /**
-   * Return the name of the return type of the function type being defined, or
-   * `null` if no return type was given.
+   * Return the return type of the function type being defined, or `null` if no
+   * return type was given.
    */
-  TypeName get returnType;
+  TypeAnnotation get returnType;
 
   /**
-   * Set the name of the return type of the function type being defined to the
-   * given [typeName].
+   * Set the return type of the function type being defined to the given [type].
    */
-  void set returnType(TypeName typeName);
+  void set returnType(TypeAnnotation type);
 
   /**
    * Return the type parameters for the function type, or `null` if the function
@@ -4218,29 +3570,12 @@
  * A function-typed formal parameter.
  *
  *    functionSignature ::=
- *        [TypeName]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterList]
+ *        [TypeAnnotation]? [SimpleIdentifier] [TypeParameterList]? [FormalParameterList]
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class FunctionTypedFormalParameter extends NormalFormalParameter {
   /**
-   * Initialize a newly created formal parameter. Either or both of the
-   * [comment] and [metadata] can be `null` if the parameter does not have the
-   * corresponding attribute. The [returnType] can be `null` if no return type
-   * was specified.
-   */
-  factory FunctionTypedFormalParameter(
-          Comment comment,
-          List<Annotation> metadata,
-          TypeName returnType,
-          SimpleIdentifier identifier,
-          TypeParameterList typeParameters,
-          FormalParameterList parameters,
-          {Token question: null}) =>
-      new FunctionTypedFormalParameterImpl(comment, metadata, returnType,
-          identifier, typeParameters, parameters, question);
-
-  /**
    * Return the parameters of the function-typed parameter.
    */
   FormalParameterList get parameters;
@@ -4267,12 +3602,12 @@
    * Return the return type of the function, or `null` if the function does not
    * have a return type.
    */
-  TypeName get returnType;
+  TypeAnnotation get returnType;
 
   /**
    * Set the return type of the function to the given [type].
    */
-  void set returnType(TypeName type);
+  void set returnType(TypeAnnotation type);
 
   /**
    * Return the type parameters associated with this function, or `null` if
@@ -4288,6 +3623,128 @@
 }
 
 /**
+ * An anonymous function type.
+ *
+ *    functionType ::=
+ *        [TypeAnnotation]? 'Function' [TypeParameterList]? [FormalParameterList]
+ *
+ * where the FormalParameterList is being used to represent the following
+ * grammar, despite the fact that FormalParameterList can represent a much
+ * larger grammar than the one below. This is done in order to simplify the
+ * implementation.
+ *
+ *    parameterTypeList ::=
+ *        () |
+ *        ( normalParameterTypes ,? ) |
+ *        ( normalParameterTypes , optionalParameterTypes ) |
+ *        ( optionalParameterTypes )
+ *    namedParameterTypes ::=
+ *        { namedParameterType (, namedParameterType)* ,? }
+ *    namedParameterType ::=
+ *        [TypeAnnotation]? [SimpleIdentifier]
+ *    normalParameterTypes ::=
+ *        normalParameterType (, normalParameterType)*
+ *    normalParameterType ::=
+ *        [TypeAnnotation] [SimpleIdentifier]?
+ *    optionalParameterTypes ::=
+ *        optionalPositionalParameterTypes | namedParameterTypes
+ *    optionalPositionalParameterTypes ::=
+ *        [ normalParameterTypes ,? ]
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class GenericFunctionType extends TypeAnnotation {
+  /**
+   * Return the keyword 'Function'.
+   */
+  Token get functionKeyword;
+
+  /**
+   * Set the keyword 'Function' to the given [token].
+   */
+  void set functionKeyword(Token token);
+
+  /**
+   * Return the parameters associated with the function type.
+   */
+  FormalParameterList get parameters;
+
+  /**
+   * Set the parameters associated with the function type to the given list of
+   * [parameters].
+   */
+  void set parameters(FormalParameterList parameters);
+
+  /**
+   * Return the return type of the function type being defined, or `null` if
+   * no return type was given.
+   */
+  TypeAnnotation get returnType;
+
+  /**
+   * Set the return type of the function type being defined to the given[type].
+   */
+  void set returnType(TypeAnnotation type);
+
+  /**
+   * Return the type parameters for the function type, or `null` if the function
+   * type does not have any type parameters.
+   */
+  TypeParameterList get typeParameters;
+
+  /**
+   * Set the type parameters for the function type to the given list of
+   * [typeParameters].
+   */
+  void set typeParameters(TypeParameterList typeParameters);
+}
+
+/**
+ * A generic type alias.
+ *
+ *    functionTypeAlias ::=
+ *        metadata 'typedef' [SimpleIdentifier] [TypeParameterList]? = [FunctionType] ';'
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class GenericTypeAlias extends TypeAlias {
+  /**
+     * Return the equal sign separating the name being defined from the function
+     * type.
+     */
+  Token get equals;
+
+  /**
+     * Set the equal sign separating the name being defined from the function type
+     * to the given [token].
+     */
+  void set equals(Token token);
+
+  /**
+     * Return the type of function being defined by the alias.
+     */
+  GenericFunctionType get functionType;
+
+  /**
+     * Set the type of function being defined by the alias to the given
+     * [functionType].
+     */
+  void set functionType(GenericFunctionType functionType);
+
+  /**
+     * Return the type parameters for the function type, or `null` if the function
+     * type does not have any type parameters.
+     */
+  TypeParameterList get typeParameters;
+
+  /**
+     * Set the type parameters for the function type to the given list of
+     * [typeParameters].
+     */
+  void set typeParameters(TypeParameterList typeParameters);
+}
+
+/**
  * A combinator that restricts the names being imported to those that are not in
  * a given list.
  *
@@ -4298,12 +3755,6 @@
  */
 abstract class HideCombinator extends Combinator {
   /**
-   * Initialize a newly created import show combinator.
-   */
-  factory HideCombinator(Token keyword, List<SimpleIdentifier> hiddenNames) =
-      HideCombinatorImpl;
-
-  /**
    * Return the list of names from the library that are hidden by this
    * combinator.
    */
@@ -4368,21 +3819,6 @@
  */
 abstract class IfStatement extends Statement {
   /**
-   * Initialize a newly created if statement. The [elseKeyword] and
-   * [elseStatement] can be `null` if there is no else clause.
-   */
-  factory IfStatement(
-          Token ifKeyword,
-          Token leftParenthesis,
-          Expression condition,
-          Token rightParenthesis,
-          Statement thenStatement,
-          Token elseKeyword,
-          Statement elseStatement) =>
-      new IfStatementImpl(ifKeyword, leftParenthesis, condition,
-          rightParenthesis, thenStatement, elseKeyword, elseStatement);
-
-  /**
    * Return the condition used to determine which of the statements is executed
    * next.
    */
@@ -4469,12 +3905,6 @@
  */
 abstract class ImplementsClause extends AstNode {
   /**
-   * Initialize a newly created implements clause.
-   */
-  factory ImplementsClause(Token implementsKeyword, List<TypeName> interfaces) =
-      ImplementsClauseImpl;
-
-  /**
    * Return the token representing the 'implements' keyword.
    */
   Token get implementsKeyword;
@@ -4605,38 +4035,6 @@
     }
     return 0;
   };
-
-  /**
-   * Initialize a newly created import directive. Either or both of the
-   * [comment] and [metadata] can be `null` if the function does not have the
-   * corresponding attribute. The [deferredKeyword] can be `null` if the import
-   * is not deferred. The [asKeyword] and [prefix] can be `null` if the import
-   * does not specify a prefix. The list of [combinators] can be `null` if there
-   * are no combinators.
-   */
-  factory ImportDirective(
-          Comment comment,
-          List<Annotation> metadata,
-          Token keyword,
-          StringLiteral libraryUri,
-          List<Configuration> configurations,
-          Token deferredKeyword,
-          Token asKeyword,
-          SimpleIdentifier prefix,
-          List<Combinator> combinators,
-          Token semicolon) =>
-      new ImportDirectiveImpl(
-          comment,
-          metadata,
-          keyword,
-          libraryUri,
-          configurations,
-          deferredKeyword,
-          asKeyword,
-          prefix,
-          combinators,
-          semicolon);
-
   /**
    * Return the token representing the 'as' keyword, or `null` if the imported
    * names are not prefixed.
@@ -4682,22 +4080,6 @@
 abstract class IndexExpression extends Expression
     implements MethodReferenceExpression {
   /**
-   * Initialize a newly created index expression.
-   */
-  factory IndexExpression.forCascade(Token period, Token leftBracket,
-          Expression index, Token rightBracket) =>
-      new IndexExpressionImpl.forCascade(
-          period, leftBracket, index, rightBracket);
-
-  /**
-   * Initialize a newly created index expression.
-   */
-  factory IndexExpression.forTarget(Expression target, Token leftBracket,
-          Expression index, Token rightBracket) =>
-      new IndexExpressionImpl.forTarget(
-          target, leftBracket, index, rightBracket);
-
-  /**
    * Return the auxiliary elements associated with this identifier, or `null` if
    * this identifier is not in both a getter and setter context. The auxiliary
    * elements hold the static and propagated elements associated with the getter
@@ -4816,14 +4198,6 @@
 abstract class InstanceCreationExpression extends Expression
     implements ConstructorReferenceNode {
   /**
-   * Initialize a newly created instance creation expression.
-   */
-  factory InstanceCreationExpression(Token keyword,
-          ConstructorName constructorName, ArgumentList argumentList) =>
-      new InstanceCreationExpressionImpl(
-          keyword, constructorName, argumentList);
-
-  /**
    * Return the list of arguments to the constructor.
    */
   ArgumentList get argumentList;
@@ -4880,11 +4254,6 @@
  */
 abstract class IntegerLiteral extends Literal {
   /**
-   * Initialize a newly created integer literal.
-   */
-  factory IntegerLiteral(Token literal, int value) = IntegerLiteralImpl;
-
-  /**
    * Return the token representing the literal.
    */
   Token get literal;
@@ -4927,13 +4296,6 @@
  */
 abstract class InterpolationExpression extends InterpolationElement {
   /**
-   * Initialize a newly created interpolation expression.
-   */
-  factory InterpolationExpression(
-          Token leftBracket, Expression expression, Token rightBracket) =>
-      new InterpolationExpressionImpl(leftBracket, expression, rightBracket);
-
-  /**
    * Return the expression to be evaluated for the value to be converted into a
    * string.
    */
@@ -4981,13 +4343,6 @@
  */
 abstract class InterpolationString extends InterpolationElement {
   /**
-   * Initialize a newly created string of characters that are part of a string
-   * interpolation.
-   */
-  factory InterpolationString(Token contents, String value) =
-      InterpolationStringImpl;
-
-  /**
    * Return the characters that will be added to the string.
    */
   Token get contents;
@@ -5089,20 +4444,12 @@
  * An is expression.
  *
  *    isExpression ::=
- *        [Expression] 'is' '!'? [TypeName]
+ *        [Expression] 'is' '!'? [TypeAnnotation]
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class IsExpression extends Expression {
   /**
-   * Initialize a newly created is expression. The [notOperator] can be `null`
-   * if the sense of the test is not negated.
-   */
-  factory IsExpression(Expression expression, Token isOperator,
-          Token notOperator, TypeName type) =>
-      new IsExpressionImpl(expression, isOperator, notOperator, type);
-
-  /**
    * Return the expression used to compute the value whose type is being tested.
    */
   Expression get expression;
@@ -5134,14 +4481,14 @@
   void set notOperator(Token token);
 
   /**
-   * Return the name of the type being tested for.
+   * Return the type being tested for.
    */
-  TypeName get type;
+  TypeAnnotation get type;
 
   /**
-   * Set the name of the type being tested for to the given [name].
+   * Set the type being tested for to the given [type].
    */
-  void set type(TypeName name);
+  void set type(TypeAnnotation type);
 }
 
 /**
@@ -5154,12 +4501,6 @@
  */
 abstract class Label extends AstNode {
   /**
-   * Initialize a newly created label.
-   */
-  factory Label(SimpleIdentifier label, Token colon) =>
-      new LabelImpl(label, colon);
-
-  /**
    * Return the colon that separates the label from the statement.
    */
   Token get colon;
@@ -5191,12 +4532,6 @@
  */
 abstract class LabeledStatement extends Statement {
   /**
-   * Initialize a newly created labeled statement.
-   */
-  factory LabeledStatement(List<Label> labels, Statement statement) =>
-      new LabeledStatementImpl(labels, statement);
-
-  /**
    * Return the labels being associated with the statement.
    */
   NodeList<Label> get labels;
@@ -5223,16 +4558,6 @@
  */
 abstract class LibraryDirective extends Directive {
   /**
-   * Initialize a newly created library directive. Either or both of the
-   * [comment] and [metadata] can be `null` if the directive does not have the
-   * corresponding attribute.
-   */
-  factory LibraryDirective(Comment comment, List<Annotation> metadata,
-          Token libraryKeyword, LibraryIdentifier name, Token semicolon) =>
-      new LibraryDirectiveImpl(
-          comment, metadata, libraryKeyword, name, semicolon);
-
-  /**
    * Return the token representing the 'library' keyword.
    */
   Token get libraryKeyword;
@@ -5273,12 +4598,6 @@
  */
 abstract class LibraryIdentifier extends Identifier {
   /**
-   * Initialize a newly created prefixed identifier.
-   */
-  factory LibraryIdentifier(List<SimpleIdentifier> components) =
-      LibraryIdentifierImpl;
-
-  /**
    * Return the components of the identifier.
    */
   NodeList<SimpleIdentifier> get components;
@@ -5288,25 +4607,12 @@
  * A list literal.
  *
  *    listLiteral ::=
- *        'const'? ('<' [TypeName] '>')? '[' ([Expression] ','?)? ']'
+ *        'const'? ('<' [TypeAnnotation] '>')? '[' ([Expression] ','?)? ']'
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class ListLiteral extends TypedLiteral {
   /**
-   * Initialize a newly created list literal. The [constKeyword] can be `null`
-   * if the literal is not a constant. The [typeArguments] can be `null` if no
-   * type arguments were declared. The list of [elements] can be `null` if the
-   * list is empty.
-   */
-  factory ListLiteral(
-      Token constKeyword,
-      TypeArgumentList typeArguments,
-      Token leftBracket,
-      List<Expression> elements,
-      Token rightBracket) = ListLiteralImpl;
-
-  /**
    * Return the expressions used to compute the elements of the list.
    */
   NodeList<Expression> get elements;
@@ -5352,25 +4658,13 @@
  * A literal map.
  *
  *    mapLiteral ::=
- *        'const'? ('<' [TypeName] (',' [TypeName])* '>')?
+ *        'const'? ('<' [TypeAnnotation] (',' [TypeAnnotation])* '>')?
  *        '{' ([MapLiteralEntry] (',' [MapLiteralEntry])* ','?)? '}'
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class MapLiteral extends TypedLiteral {
   /**
-   * Initialize a newly created map literal. The [constKeyword] can be `null` if
-   * the literal is not a constant. The [typeArguments] can be `null` if no type
-   * arguments were declared. The [entries] can be `null` if the map is empty.
-   */
-  factory MapLiteral(
-      Token constKeyword,
-      TypeArgumentList typeArguments,
-      Token leftBracket,
-      List<MapLiteralEntry> entries,
-      Token rightBracket) = MapLiteralImpl;
-
-  /**
    * Return the entries in the map.
    */
   NodeList<MapLiteralEntry> get entries;
@@ -5406,12 +4700,6 @@
  */
 abstract class MapLiteralEntry extends AstNode {
   /**
-   * Initialize a newly created map literal entry.
-   */
-  factory MapLiteralEntry(Expression key, Token separator, Expression value) =>
-      new MapLiteralEntryImpl(key, separator, value);
-
-  /**
    * Return the expression computing the key with which the value will be
    * associated.
    */
@@ -5464,42 +4752,6 @@
  */
 abstract class MethodDeclaration extends ClassMember {
   /**
-   * Initialize a newly created method declaration. Either or both of the
-   * [comment] and [metadata] can be `null` if the declaration does not have the
-   * corresponding attribute. The [externalKeyword] can be `null` if the method
-   * is not external. The [modifierKeyword] can be `null` if the method is
-   * neither abstract nor static. The [returnType] can be `null` if no return
-   * type was specified. The [propertyKeyword] can be `null` if the method is
-   * neither a getter or a setter. The [operatorKeyword] can be `null` if the
-   * method does not implement an operator. The [parameters] must be `null` if
-   * this method declares a getter.
-   */
-  factory MethodDeclaration(
-          Comment comment,
-          List<Annotation> metadata,
-          Token externalKeyword,
-          Token modifierKeyword,
-          TypeName returnType,
-          Token propertyKeyword,
-          Token operatorKeyword,
-          SimpleIdentifier name,
-          TypeParameterList typeParameters,
-          FormalParameterList parameters,
-          FunctionBody body) =>
-      new MethodDeclarationImpl(
-          comment,
-          metadata,
-          externalKeyword,
-          modifierKeyword,
-          returnType,
-          propertyKeyword,
-          operatorKeyword,
-          name,
-          typeParameters,
-          parameters,
-          body);
-
-  /**
    * Return the body of the method.
    */
   FunctionBody get body;
@@ -5608,12 +4860,12 @@
    * Return the return type of the method, or `null` if no return type was
    * declared.
    */
-  TypeName get returnType;
+  TypeAnnotation get returnType;
 
   /**
-   * Set the return type of the method to the given [typeName].
+   * Set the return type of the method to the given [type].
    */
-  void set returnType(TypeName typeName);
+  void set returnType(TypeAnnotation type);
 
   /**
    * Return the type parameters associated with this method, or `null` if this
@@ -5641,19 +4893,6 @@
  */
 abstract class MethodInvocation extends InvocationExpression {
   /**
-   * Initialize a newly created method invocation. The [target] and [operator]
-   * can be `null` if there is no target.
-   */
-  factory MethodInvocation(
-          Expression target,
-          Token operator,
-          SimpleIdentifier methodName,
-          TypeArgumentList typeArguments,
-          ArgumentList argumentList) =>
-      new MethodInvocationImpl(
-          target, operator, methodName, typeArguments, argumentList);
-
-  /**
    * Set the list of arguments to the method to the given [argumentList].
    */
   void set argumentList(ArgumentList argumentList);
@@ -5794,12 +5033,6 @@
  */
 abstract class NamedExpression extends Expression {
   /**
-   * Initialize a newly created named expression..
-   */
-  factory NamedExpression(Label name, Expression expression) =>
-      new NamedExpressionImpl(name, expression);
-
-  /**
    * Return the element representing the parameter being named by this
    * expression, or `null` if the AST structure has not been resolved or if
    * there is no parameter with the same name as this expression.
@@ -5829,6 +5062,63 @@
 }
 
 /**
+ * A named type, which can optionally include type arguments.
+ *
+ *    namedType ::=
+ *        [Identifier] typeArguments?
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class NamedType extends TypeAnnotation {
+  /**
+   * Return `true` if this type is a deferred type.
+   *
+   * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form
+   * </i>p.T</i> where <i>p</i> is a deferred prefix.
+   */
+  bool get isDeferred;
+
+  /**
+   * Return the name of the type.
+   */
+  Identifier get name;
+
+  /**
+   * Set the name of the type to the given [identifier].
+   */
+  void set name(Identifier identifier);
+
+  /**
+   * Return the question mark marking this as a nullable type, or `null` if
+   * the type is non-nullable.
+   */
+  Token get question;
+
+  /**
+   * Return the question mark marking this as a nullable type to the given
+   * [question].
+   */
+  void set question(Token question);
+
+  /**
+   * Set the type being named to the given [type].
+   */
+  void set type(DartType type);
+
+  /**
+   * Return the type arguments associated with the type, or `null` if there are
+   * no type arguments.
+   */
+  TypeArgumentList get typeArguments;
+
+  /**
+   * Set the type arguments associated with the type to the given
+   * [typeArguments].
+   */
+  void set typeArguments(TypeArgumentList typeArguments);
+}
+
+/**
  * A node that represents a directive that impacts the namespace of a library.
  *
  *    directive ::=
@@ -5892,12 +5182,6 @@
  */
 abstract class NativeClause extends AstNode {
   /**
-   * Initialize a newly created native clause.
-   */
-  factory NativeClause(Token nativeKeyword, StringLiteral name) =>
-      new NativeClauseImpl(nativeKeyword, name);
-
-  /**
    * Return the name of the native object that implements the class.
    */
   StringLiteral get name;
@@ -5930,14 +5214,6 @@
  */
 abstract class NativeFunctionBody extends FunctionBody {
   /**
-   * Initialize a newly created function body consisting of the 'native' token,
-   * a string literal, and a semicolon.
-   */
-  factory NativeFunctionBody(
-          Token nativeKeyword, StringLiteral stringLiteral, Token semicolon) =>
-      new NativeFunctionBodyImpl(nativeKeyword, stringLiteral, semicolon);
-
-  /**
    * Return the token representing 'native' that marks the start of the function
    * body.
    */
@@ -5980,14 +5256,6 @@
  */
 abstract class NodeList<E extends AstNode> implements List<E> {
   /**
-   * Initialize a newly created list of nodes such that all of the nodes that
-   * are added to the list will have their parent set to the given [owner]. The
-   * list will initially be populated with the given [elements].
-   */
-  factory NodeList(AstNode owner, [List<E> elements]) =>
-      new NodeListImpl<E>(owner as AstNodeImpl, elements);
-
-  /**
    * Return the first token included in this node list's source range, or `null`
    * if the list is empty.
    */
@@ -6081,11 +5349,6 @@
  */
 abstract class NullLiteral extends Literal {
   /**
-   * Initialize a newly created null literal.
-   */
-  factory NullLiteral(Token literal) = NullLiteralImpl;
-
-  /**
    * Return the token representing the literal.
    */
   Token get literal;
@@ -6106,14 +5369,6 @@
  */
 abstract class ParenthesizedExpression extends Expression {
   /**
-   * Initialize a newly created parenthesized expression.
-   */
-  factory ParenthesizedExpression(Token leftParenthesis, Expression expression,
-          Token rightParenthesis) =>
-      new ParenthesizedExpressionImpl(
-          leftParenthesis, expression, rightParenthesis);
-
-  /**
    * Return the expression within the parentheses.
    */
   Expression get expression;
@@ -6154,18 +5409,6 @@
  */
 abstract class PartDirective extends UriBasedDirective {
   /**
-   * Initialize a newly created part directive. Either or both of the [comment]
-   * and [metadata] can be `null` if the directive does not have the
-   * corresponding attribute.
-   */
-  factory PartDirective(
-      Comment comment,
-      List<Annotation> metadata,
-      Token partKeyword,
-      StringLiteral partUri,
-      Token semicolon) = PartDirectiveImpl;
-
-  /**
    * Return the token representing the 'part' keyword.
    */
   Token get partKeyword;
@@ -6196,23 +5439,6 @@
  */
 abstract class PartOfDirective extends Directive {
   /**
-   * Initialize a newly created part-of directive. Either or both of the
-   * [comment] and [metadata] can be `null` if the directive does not have the
-   * corresponding attribute. Only one of the [uri] and [libraryName] should be
-   * provided.
-   */
-  factory PartOfDirective(
-          Comment comment,
-          List<Annotation> metadata,
-          Token partKeyword,
-          Token ofKeyword,
-          StringLiteral uri,
-          LibraryIdentifier libraryName,
-          Token semicolon) =>
-      new PartOfDirectiveImpl(comment, metadata, partKeyword, ofKeyword, uri,
-          libraryName, semicolon);
-
-  /**
    * Return the name of the library that the containing compilation unit is part
    * of.
    */
@@ -6280,12 +5506,6 @@
 abstract class PostfixExpression extends Expression
     implements MethodReferenceExpression {
   /**
-   * Initialize a newly created postfix expression.
-   */
-  factory PostfixExpression(Expression operand, Token operator) =>
-      new PostfixExpressionImpl(operand, operator);
-
-  /**
    * Return the expression computing the operand for the operator.
    */
   Expression get operand;
@@ -6318,13 +5538,6 @@
  */
 abstract class PrefixedIdentifier extends Identifier {
   /**
-   * Initialize a newly created prefixed identifier.
-   */
-  factory PrefixedIdentifier(
-          SimpleIdentifier prefix, Token period, SimpleIdentifier identifier) =>
-      new PrefixedIdentifierImpl(prefix, period, identifier);
-
-  /**
    * Return the identifier being prefixed.
    */
   SimpleIdentifier get identifier;
@@ -6378,12 +5591,6 @@
 abstract class PrefixExpression extends Expression
     implements MethodReferenceExpression {
   /**
-   * Initialize a newly created prefix expression.
-   */
-  factory PrefixExpression(Token operator, Expression operand) =>
-      new PrefixExpressionImpl(operator, operand);
-
-  /**
    * Return the expression computing the operand for the operator.
    */
   Expression get operand;
@@ -6419,13 +5626,6 @@
  */
 abstract class PropertyAccess extends Expression {
   /**
-   * Initialize a newly created property access expression.
-   */
-  factory PropertyAccess(
-          Expression target, Token operator, SimpleIdentifier propertyName) =>
-      new PropertyAccessImpl(target, operator, propertyName);
-
-  /**
    * Return `true` if this expression is cascaded. If it is, then the target of
    * this expression is not stored locally but is stored in the nearest ancestor
    * that is a [CascadeExpression].
@@ -6488,16 +5688,6 @@
 abstract class RedirectingConstructorInvocation extends ConstructorInitializer
     implements ConstructorReferenceNode {
   /**
-   * Initialize a newly created redirecting invocation to invoke the constructor
-   * with the given name with the given arguments. The [constructorName] can be
-   * `null` if the constructor being invoked is the unnamed constructor.
-   */
-  factory RedirectingConstructorInvocation(Token thisKeyword, Token period,
-          SimpleIdentifier constructorName, ArgumentList argumentList) =>
-      new RedirectingConstructorInvocationImpl(
-          thisKeyword, period, constructorName, argumentList);
-
-  /**
    * Return the list of arguments to the constructor.
    */
   ArgumentList get argumentList;
@@ -6552,11 +5742,6 @@
  */
 abstract class RethrowExpression extends Expression {
   /**
-   * Initialize a newly created rethrow expression.
-   */
-  factory RethrowExpression(Token rethrowKeyword) = RethrowExpressionImpl;
-
-  /**
    * Return the token representing the 'rethrow' keyword.
    */
   Token get rethrowKeyword;
@@ -6577,14 +5762,6 @@
  */
 abstract class ReturnStatement extends Statement {
   /**
-   * Initialize a newly created return statement. The [expression] can be `null`
-   * if no explicit value was provided.
-   */
-  factory ReturnStatement(
-          Token returnKeyword, Expression expression, Token semicolon) =>
-      new ReturnStatementImpl(returnKeyword, expression, semicolon);
-
-  /**
    * Return the expression computing the value to be returned, or `null` if no
    * explicit value was provided.
    */
@@ -6627,11 +5804,6 @@
  */
 abstract class ScriptTag extends AstNode {
   /**
-   * Initialize a newly created script tag.
-   */
-  factory ScriptTag(Token scriptTag) = ScriptTagImpl;
-
-  /**
    * Return the token representing this script tag.
    */
   Token get scriptTag;
@@ -6652,12 +5824,6 @@
  */
 abstract class ShowCombinator extends Combinator {
   /**
-   * Initialize a newly created import show combinator.
-   */
-  factory ShowCombinator(Token keyword, List<SimpleIdentifier> shownNames) =
-      ShowCombinatorImpl;
-
-  /**
    * Return the list of names from the library that are made visible by this
    * combinator.
    */
@@ -6668,23 +5834,12 @@
  * A simple formal parameter.
  *
  *    simpleFormalParameter ::=
- *        ('final' [TypeName] | 'var' | [TypeName])? [SimpleIdentifier]
+ *        ('final' [TypeAnnotation] | 'var' | [TypeAnnotation])? [SimpleIdentifier]
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class SimpleFormalParameter extends NormalFormalParameter {
   /**
-   * Initialize a newly created formal parameter. Either or both of the
-   * [comment] and [metadata] can be `null` if the parameter does not have the
-   * corresponding attribute. The [keyword] can be `null` if a type was
-   * specified. The [type] must be `null` if the keyword is 'var'.
-   */
-  factory SimpleFormalParameter(Comment comment, List<Annotation> metadata,
-          Token keyword, TypeName type, SimpleIdentifier identifier) =>
-      new SimpleFormalParameterImpl(
-          comment, metadata, keyword, type, identifier);
-
-  /**
    * Return the token representing either the 'final', 'const' or 'var' keyword,
    * or `null` if no keyword was used.
    */
@@ -6697,15 +5852,15 @@
   void set keyword(Token token);
 
   /**
-   * Return the name of the declared type of the parameter, or `null` if the
-   * parameter does not have a declared type.
+   * Return the declared type of the parameter, or `null` if the parameter does
+   * not have a declared type.
    */
-  TypeName get type;
+  TypeAnnotation get type;
 
   /**
-   * Set the name of the declared type of the parameter to the given [typeName].
+   * Set the declared type of the parameter to the given [type].
    */
-  void set type(TypeName typeName);
+  void set type(TypeAnnotation type);
 }
 
 /**
@@ -6722,16 +5877,6 @@
  */
 abstract class SimpleIdentifier extends Identifier {
   /**
-   * Initialize a newly created identifier.
-   */
-  factory SimpleIdentifier(Token token, {bool isDeclaration: false}) {
-    if (isDeclaration) {
-      return new DeclaredSimpleIdentifier(token);
-    }
-    return new SimpleIdentifierImpl(token);
-  }
-
-  /**
    * Return the auxiliary elements associated with this identifier, or `null` if
    * this identifier is not in both a getter and setter context. The auxiliary
    * elements hold the static and propagated elements associated with the getter
@@ -6829,12 +5974,6 @@
  */
 abstract class SimpleStringLiteral extends SingleStringLiteral {
   /**
-   * Initialize a newly created simple string literal.
-   */
-  factory SimpleStringLiteral(Token literal, String value) =
-      SimpleStringLiteralImpl;
-
-  /**
    * Return the token representing the literal.
    */
   Token get literal;
@@ -6933,12 +6072,6 @@
  */
 abstract class StringInterpolation extends SingleStringLiteral {
   /**
-   * Initialize a newly created string interpolation expression.
-   */
-  factory StringInterpolation(List<InterpolationElement> elements) =
-      StringInterpolationImpl;
-
-  /**
    * Return the elements that will be composed to produce the resulting string.
    */
   NodeList<InterpolationElement> get elements;
@@ -6974,17 +6107,6 @@
 abstract class SuperConstructorInvocation extends ConstructorInitializer
     implements ConstructorReferenceNode {
   /**
-   * Initialize a newly created super invocation to invoke the inherited
-   * constructor with the given name with the given arguments. The [period] and
-   * [constructorName] can be `null` if the constructor being invoked is the
-   * unnamed constructor.
-   */
-  factory SuperConstructorInvocation(Token superKeyword, Token period,
-          SimpleIdentifier constructorName, ArgumentList argumentList) =>
-      new SuperConstructorInvocationImpl(
-          superKeyword, period, constructorName, argumentList);
-
-  /**
    * Return the list of arguments to the constructor.
    */
   ArgumentList get argumentList;
@@ -7039,11 +6161,6 @@
  */
 abstract class SuperExpression extends Expression {
   /**
-   * Initialize a newly created super expression.
-   */
-  factory SuperExpression(Token superKeyword) = SuperExpressionImpl;
-
-  /**
    * Return the token representing the 'super' keyword.
    */
   Token get superKeyword;
@@ -7064,14 +6181,6 @@
  */
 abstract class SwitchCase extends SwitchMember {
   /**
-   * Initialize a newly created switch case. The list of [labels] can be `null`
-   * if there are no labels.
-   */
-  factory SwitchCase(List<Label> labels, Token keyword, Expression expression,
-          Token colon, List<Statement> statements) =>
-      new SwitchCaseImpl(labels, keyword, expression, colon, statements);
-
-  /**
    * Return the expression controlling whether the statements will be executed.
    */
   Expression get expression;
@@ -7091,14 +6200,7 @@
  *
  * Clients may not extend, implement or mix-in this class.
  */
-abstract class SwitchDefault extends SwitchMember {
-  /**
-   * Initialize a newly created switch default. The list of [labels] can be
-   * `null` if there are no labels.
-   */
-  factory SwitchDefault(List<Label> labels, Token keyword, Token colon,
-      List<Statement> statements) = SwitchDefaultImpl;
-}
+abstract class SwitchDefault extends SwitchMember {}
 
 /**
  * An element within a switch statement.
@@ -7155,21 +6257,6 @@
  */
 abstract class SwitchStatement extends Statement {
   /**
-   * Initialize a newly created switch statement. The list of [members] can be
-   * `null` if there are no switch members.
-   */
-  factory SwitchStatement(
-          Token switchKeyword,
-          Token leftParenthesis,
-          Expression expression,
-          Token rightParenthesis,
-          Token leftBracket,
-          List<SwitchMember> members,
-          Token rightBracket) =>
-      new SwitchStatementImpl(switchKeyword, leftParenthesis, expression,
-          rightParenthesis, leftBracket, members, rightBracket);
-
-  /**
    * Return the expression used to determine which of the switch members will be
    * selected.
    */
@@ -7247,12 +6334,6 @@
  */
 abstract class SymbolLiteral extends Literal {
   /**
-   * Initialize a newly created symbol literal.
-   */
-  factory SymbolLiteral(Token poundSign, List<Token> components) =
-      SymbolLiteralImpl;
-
-  /**
    * Return the components of the literal.
    */
   List<Token> get components;
@@ -7278,11 +6359,6 @@
  */
 abstract class ThisExpression extends Expression {
   /**
-   * Initialize a newly created this expression.
-   */
-  factory ThisExpression(Token thisKeyword) = ThisExpressionImpl;
-
-  /**
    * Return the token representing the 'this' keyword.
    */
   Token get thisKeyword;
@@ -7303,12 +6379,6 @@
  */
 abstract class ThrowExpression extends Expression {
   /**
-   * Initialize a newly created throw expression.
-   */
-  factory ThrowExpression(Token throwKeyword, Expression expression) =>
-      new ThrowExpressionImpl(throwKeyword, expression);
-
-  /**
    * Return the expression computing the exception to be thrown.
    */
   Expression get expression;
@@ -7341,19 +6411,6 @@
  */
 abstract class TopLevelVariableDeclaration extends CompilationUnitMember {
   /**
-   * Initialize a newly created top-level variable declaration. Either or both
-   * of the [comment] and [metadata] can be `null` if the variable does not have
-   * the corresponding attribute.
-   */
-  factory TopLevelVariableDeclaration(
-          Comment comment,
-          List<Annotation> metadata,
-          VariableDeclarationList variableList,
-          Token semicolon) =>
-      new TopLevelVariableDeclarationImpl(
-          comment, metadata, variableList, semicolon);
-
-  /**
    * Return the semicolon terminating the declaration.
    */
   Token get semicolon;
@@ -7388,20 +6445,6 @@
  */
 abstract class TryStatement extends Statement {
   /**
-   * Initialize a newly created try statement. The list of [catchClauses] can be
-   * `null` if there are no catch clauses. The [finallyKeyword] and
-   * [finallyBlock] can be `null` if there is no finally clause.
-   */
-  factory TryStatement(
-          Token tryKeyword,
-          Block body,
-          List<CatchClause> catchClauses,
-          Token finallyKeyword,
-          Block finallyBlock) =>
-      new TryStatementImpl(
-          tryKeyword, body, catchClauses, finallyKeyword, finallyBlock);
-
-  /**
    * Return the body of the statement.
    */
   Block get body;
@@ -7484,6 +6527,23 @@
 }
 
 /**
+ * A type annotation.
+ *
+ *    type ::=
+ *        [NamedType]
+ *      | [GenericFunctionType]
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class TypeAnnotation extends AstNode {
+  /**
+   * Return the type being named, or `null` if the AST structure has not been
+   * resolved.
+   */
+  DartType get type;
+}
+
+/**
  * A list of type arguments.
  *
  *    typeArguments ::=
@@ -7493,16 +6553,9 @@
  */
 abstract class TypeArgumentList extends AstNode {
   /**
-   * Initialize a newly created list of type arguments.
-   */
-  factory TypeArgumentList(
-          Token leftBracket, List<TypeName> arguments, Token rightBracket) =
-      TypeArgumentListImpl;
-
-  /**
    * Return the type arguments associated with the type.
    */
-  NodeList<TypeName> get arguments;
+  NodeList<TypeAnnotation> get arguments;
 
   /**
    * Return the left bracket.
@@ -7567,99 +6620,27 @@
  *
  * Clients may not extend, implement or mix-in this class.
  */
-abstract class TypeName extends AstNode {
-  /**
-   * Initialize a newly created type name. The [typeArguments] can be `null` if
-   * there are no type arguments.
-   */
-  factory TypeName(Identifier name, TypeArgumentList typeArguments,
-          {Token question: null}) =>
-      new TypeNameImpl(name, typeArguments, question);
-
-  /**
-   * Return `true` if this type is a deferred type.
-   *
-   * 15.1 Static Types: A type <i>T</i> is deferred iff it is of the form
-   * </i>p.T</i> where <i>p</i> is a deferred prefix.
-   */
-  bool get isDeferred;
-
-  /**
-   * Return the name of the type.
-   */
-  Identifier get name;
-
-  /**
-   * Set the name of the type to the given [identifier].
-   */
-  void set name(Identifier identifier);
-
-  /**
-   * Return the question mark marking this as a nullable type, or `null` if
-   * the type is non-nullable.
-   */
-  Token get question;
-
-  /**
-   * Return the question mark marking this as a nullable type to the given
-   * [question].
-   */
-  void set question(Token question);
-
-  /**
-   * Return the type being named, or `null` if the AST structure has not been
-   * resolved.
-   */
-  DartType get type;
-
-  /**
-   * Set the type being named to the given [type].
-   */
-  void set type(DartType type);
-
-  /**
-   * Return the type arguments associated with the type, or `null` if there are
-   * no type arguments.
-   */
-  TypeArgumentList get typeArguments;
-
-  /**
-   * Set the type arguments associated with the type to the given
-   * [typeArguments].
-   */
-  void set typeArguments(TypeArgumentList typeArguments);
-}
+abstract class TypeName extends NamedType {}
 
 /**
  * A type parameter.
  *
  *    typeParameter ::=
- *        [SimpleIdentifier] ('extends' [TypeName])?
+ *        [SimpleIdentifier] ('extends' [TypeAnnotation])?
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class TypeParameter extends Declaration {
   /**
-   * Initialize a newly created type parameter. Either or both of the [comment]
-   * and [metadata] can be `null` if the parameter does not have the
-   * corresponding attribute. The [extendsKeyword] and [bound] can be `null` if
-   * the parameter does not have an upper bound.
+   * Return the upper bound for legal arguments, or `null` if there is no
+   * explicit upper bound.
    */
-  factory TypeParameter(Comment comment, List<Annotation> metadata,
-          SimpleIdentifier name, Token extendsKeyword, TypeName bound) =>
-      new TypeParameterImpl(comment, metadata, name, extendsKeyword, bound);
+  TypeAnnotation get bound;
 
   /**
-   * Return the name of the upper bound for legal arguments, or `null` if there
-   * is no explicit upper bound.
+   * Set the upper bound for legal arguments to the given [type].
    */
-  TypeName get bound;
-
-  /**
-   * Set the name of the upper bound for legal arguments to the given
-   * [typeName].
-   */
-  void set bound(TypeName typeName);
+  void set bound(TypeAnnotation type);
 
   /**
    * Return the token representing the 'extends' keyword, or `null` if there is
@@ -7693,14 +6674,6 @@
  */
 abstract class TypeParameterList extends AstNode {
   /**
-   * Initialize a newly created list of type parameters.
-   */
-  factory TypeParameterList(
-      Token leftBracket,
-      List<TypeParameter> typeParameters,
-      Token rightBracket) = TypeParameterListImpl;
-
-  /**
    * Return the left angle bracket.
    */
   Token get leftBracket;
@@ -7793,14 +6766,6 @@
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class VariableDeclaration extends Declaration {
-  /**
-   * Initialize a newly created variable declaration. The [equals] and
-   * [initializer] can be `null` if there is no initializer.
-   */
-  factory VariableDeclaration(
-          SimpleIdentifier name, Token equals, Expression initializer) =>
-      new VariableDeclarationImpl(name, equals, initializer);
-
   @override
   VariableElement get element;
 
@@ -7858,26 +6823,15 @@
  *        finalConstVarOrType [VariableDeclaration] (',' [VariableDeclaration])*
  *
  *    finalConstVarOrType ::=
- *      | 'final' [TypeName]?
- *      | 'const' [TypeName]?
+ *      | 'final' [TypeAnnotation]?
+ *      | 'const' [TypeAnnotation]?
  *      | 'var'
- *      | [TypeName]
+ *      | [TypeAnnotation]
  *
  * Clients may not extend, implement or mix-in this class.
  */
 abstract class VariableDeclarationList extends AnnotatedNode {
   /**
-   * Initialize a newly created variable declaration list. Either or both of the
-   * [comment] and [metadata] can be `null` if the variable list does not have
-   * the corresponding attribute. The [keyword] can be `null` if a type was
-   * specified. The [type] must be `null` if the keyword is 'var'.
-   */
-  factory VariableDeclarationList(Comment comment, List<Annotation> metadata,
-          Token keyword, TypeName type, List<VariableDeclaration> variables) =>
-      new VariableDeclarationListImpl(
-          comment, metadata, keyword, type, variables);
-
-  /**
    * Return `true` if the variables in this list were declared with the 'const'
    * modifier.
    */
@@ -7907,12 +6861,12 @@
    * Return the type of the variables being declared, or `null` if no type was
    * provided.
    */
-  TypeName get type;
+  TypeAnnotation get type;
 
   /**
-   * Set the type of the variables being declared to the given [typeName].
+   * Set the type of the variables being declared to the given [type].
    */
-  void set type(TypeName typeName);
+  void set type(TypeAnnotation type);
 
   /**
    * Return a list containing the individual variables being declared.
@@ -7931,13 +6885,6 @@
  */
 abstract class VariableDeclarationStatement extends Statement {
   /**
-   * Initialize a newly created variable declaration statement.
-   */
-  factory VariableDeclarationStatement(
-          VariableDeclarationList variableList, Token semicolon) =>
-      new VariableDeclarationStatementImpl(variableList, semicolon);
-
-  /**
    * Return the semicolon terminating the statement.
    */
   Token get semicolon;
@@ -7968,14 +6915,6 @@
  */
 abstract class WhileStatement extends Statement {
   /**
-   * Initialize a newly created while statement.
-   */
-  factory WhileStatement(Token whileKeyword, Token leftParenthesis,
-          Expression condition, Token rightParenthesis, Statement body) =>
-      new WhileStatementImpl(
-          whileKeyword, leftParenthesis, condition, rightParenthesis, body);
-
-  /**
    * Return the body of the loop.
    */
   Statement get body;
@@ -8038,12 +6977,6 @@
  */
 abstract class WithClause extends AstNode {
   /**
-   * Initialize a newly created with clause.
-   */
-  factory WithClause(Token withKeyword, List<TypeName> mixinTypes) =
-      WithClauseImpl;
-
-  /**
    * Return the names of the mixins that were specified.
    */
   NodeList<TypeName> get mixinTypes;
@@ -8069,14 +7002,6 @@
  */
 abstract class YieldStatement extends Statement {
   /**
-   * Initialize a newly created yield expression. The [star] can be `null` if no
-   * star was provided.
-   */
-  factory YieldStatement(Token yieldKeyword, Token star, Expression expression,
-          Token semicolon) =>
-      new YieldStatementImpl(yieldKeyword, star, expression, semicolon);
-
-  /**
    * Return the expression whose value will be yielded.
    */
   Expression get expression;
diff --git a/pkg/analyzer/lib/dart/ast/ast_factory.dart b/pkg/analyzer/lib/dart/ast/ast_factory.dart
index ffaf90e..48b918d 100644
--- a/pkg/analyzer/lib/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/dart/ast/ast_factory.dart
@@ -39,7 +39,7 @@
    * Returns a newly created as expression.
    */
   AsExpression asExpression(
-      Expression expression, Token asOperator, TypeName type);
+      Expression expression, Token asOperator, TypeAnnotation type);
 
   /**
    * Returns a newly created assert initializer. The [comma] and [message]
@@ -128,7 +128,7 @@
    */
   CatchClause catchClause(
       Token onKeyword,
-      TypeName exceptionType,
+      TypeAnnotation exceptionType,
       Token catchKeyword,
       Token leftParenthesis,
       SimpleIdentifier exceptionParameter,
@@ -290,7 +290,7 @@
       Comment comment,
       List<Annotation> metadata,
       Token keyword,
-      TypeName type,
+      TypeAnnotation type,
       SimpleIdentifier identifier);
 
   /**
@@ -423,7 +423,7 @@
       Comment comment,
       List<Annotation> metadata,
       Token keyword,
-      TypeName type,
+      TypeAnnotation type,
       Token thisKeyword,
       Token period,
       SimpleIdentifier identifier,
@@ -502,7 +502,7 @@
       Comment comment,
       List<Annotation> metadata,
       Token externalKeyword,
-      TypeName returnType,
+      TypeAnnotation returnType,
       Token propertyKeyword,
       SimpleIdentifier name,
       FunctionExpression functionExpression);
@@ -536,7 +536,7 @@
       Comment comment,
       List<Annotation> metadata,
       Token keyword,
-      TypeName returnType,
+      TypeAnnotation returnType,
       SimpleIdentifier name,
       TypeParameterList typeParameters,
       FormalParameterList parameters,
@@ -551,7 +551,7 @@
   FunctionTypedFormalParameter functionTypedFormalParameter(
       Comment comment,
       List<Annotation> metadata,
-      TypeName returnType,
+      TypeAnnotation returnType,
       SimpleIdentifier identifier,
       TypeParameterList typeParameters,
       FormalParameterList parameters,
@@ -642,7 +642,7 @@
    * if the sense of the test is not negated.
    */
   IsExpression isExpression(Expression expression, Token isOperator,
-      Token notOperator, TypeName type);
+      Token notOperator, TypeAnnotation type);
 
   /**
    * Returns a newly created label.
@@ -706,7 +706,7 @@
       List<Annotation> metadata,
       Token externalKeyword,
       Token modifierKeyword,
-      TypeName returnType,
+      TypeAnnotation returnType,
       Token propertyKeyword,
       Token operatorKeyword,
       SimpleIdentifier name,
@@ -849,7 +849,7 @@
       Comment comment,
       List<Annotation> metadata,
       Token keyword,
-      TypeName type,
+      TypeAnnotation type,
       SimpleIdentifier identifier);
 
   /**
@@ -948,7 +948,7 @@
    * Returns a newly created list of type arguments.
    */
   TypeArgumentList typeArgumentList(
-      Token leftBracket, List<TypeName> arguments, Token rightBracket);
+      Token leftBracket, List<TypeAnnotation> arguments, Token rightBracket);
 
   /**
    * Returns a newly created type name. The [typeArguments] can be `null` if
@@ -964,7 +964,7 @@
    * the parameter does not have an upper bound.
    */
   TypeParameter typeParameter(Comment comment, List<Annotation> metadata,
-      SimpleIdentifier name, Token extendsKeyword, TypeName bound);
+      SimpleIdentifier name, Token extendsKeyword, TypeAnnotation bound);
 
   /**
    * Returns a newly created list of type parameters.
@@ -989,10 +989,23 @@
       Comment comment,
       List<Annotation> metadata,
       Token keyword,
-      TypeName type,
+      TypeAnnotation type,
       List<VariableDeclaration> variables);
 
   /**
+   * Returns a newly created generic type alias. Either or both of the
+   * [comment] and [metadata] can be `null` if the variable list does not have
+   * the corresponding attribute. The [typeParameters] can be `null` if there
+   * are no type parameters.
+   */
+  GenericTypeAlias genericTypeAlias(Comment comment, List<Annotation> metadata, Token typedefKeyword, SimpleIdentifier name, TypeParameterList typeParameters, Token equals, GenericFunctionType functionType, Token semicolon);
+
+  /**
+   * Initialize a newly created generic function type.
+   */
+  GenericFunctionType genericFunctionType(TypeAnnotation returnType, Token functionKeyword, TypeParameterList typeParameters, FormalParameterList _parameters);
+
+  /**
    * Returns a newly created variable declaration statement.
    */
   VariableDeclarationStatement variableDeclarationStatement(
diff --git a/pkg/analyzer/lib/dart/ast/resolution_base_classes.dart b/pkg/analyzer/lib/dart/ast/resolution_base_classes.dart
new file mode 100644
index 0000000..54ca0d8
--- /dev/null
+++ b/pkg/analyzer/lib/dart/ast/resolution_base_classes.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * Abstract base class for a resolved element maintained in an AST data
+ * structure.
+ *
+ * This abstract type decouples the AST representation from depending on the
+ * element model.
+ */
+abstract class ResolutionTarget {}
+
+/**
+ * Abstract base class for a resolved type maintained in AST data structure.
+ *
+ * This abstract type decouples the AST representation from depending on the
+ * type model.
+ */
+abstract class ResolutionType {}
diff --git a/pkg/analyzer/lib/dart/ast/resolution_map.dart b/pkg/analyzer/lib/dart/ast/resolution_map.dart
new file mode 100644
index 0000000..a9e59ff
--- /dev/null
+++ b/pkg/analyzer/lib/dart/ast/resolution_map.dart
@@ -0,0 +1,291 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
+
+/**
+ * A collection of methods which may be used to map from nodes in a resolved AST
+ * to elements and types in the element model.
+ *
+ * Clients should not extend, implement or mix-in this class.
+ */
+abstract class ResolutionMap {
+  /**
+   * Return the best element available for the function being invoked at [node].
+   * If resolution was able to find a better element based on type propagation,
+   * that element will be returned. Otherwise, the element found using the
+   * result of static analysis will be returned. If resolution has not been
+   * performed, then `null` will be returned.
+   */
+  ExecutableElement bestElementForFunctionExpressionInvocation(
+      FunctionExpressionInvocation node);
+
+  /**
+   * Return the best element available for the identifier [node]. If resolution
+   * was able to find a better element based on type propagation, that element
+   * will be returned. Otherwise, the element found using the result of static
+   * analysis will be returned. If resolution has not been performed, then
+   * `null` will be returned.
+   */
+  Element bestElementForIdentifier(Identifier node);
+
+  /**
+   * Return the best element available for the expression [node]. If resolution
+   * was able to find a better element based on type propagation, that element
+   * will be returned. Otherwise, the element found using the result of static
+   * analysis will be returned. If resolution has not been performed, then
+   * `null` will be returned.
+   */
+  MethodElement bestElementForMethodReference(MethodReferenceExpression node);
+
+  /**
+   * Return the best parameter element information available for the expression
+   * [node]. If type propagation was able to find a better parameter element
+   * than static analysis, that type will be returned. Otherwise, the result of
+   * static analysis will be returned.
+   */
+  ParameterElement bestParameterElementForExpression(Expression node);
+
+  /**
+   * Return the best type information available for the expression [node]. If
+   * type propagation was able to find a better type than static analysis, that
+   * type will be returned. Otherwise, the result of static analysis will be
+   * returned. If no type analysis has been performed, then the type 'dynamic'
+   * will be returned.
+   */
+  DartType bestTypeForExpression(Expression node);
+
+  /**
+   * Return the element annotation representing the annotation [node] in the
+   * element model.
+   */
+  ElementAnnotation elementAnnotationForAnnotation(Annotation node);
+
+  /**
+   * Return the element associated with the declaration [node], or `null` if
+   * either this node corresponds to a list of declarations or if the AST
+   * structure has not been resolved.
+   */
+  ClassElement elementDeclaredByClassDeclaration(ClassDeclaration node);
+
+  /**
+   * Return the element associated with the compilation unit [node], or `null`
+   * if the AST structure has not been resolved.
+   */
+  CompilationUnitElement elementDeclaredByCompilationUnit(CompilationUnit node);
+
+  /**
+   * Return the element associated with the declaration [node], or `null` if
+   * either this node corresponds to a list of declarations or if the AST
+   * structure has not been resolved.
+   */
+  ConstructorElement elementDeclaredByConstructorDeclaration(
+      ConstructorDeclaration node);
+
+  /**
+   * Return the element associated with the declaration [node], or `null` if
+   * either this node corresponds to a list of declarations or if the AST
+   * structure has not been resolved.
+   */
+  Element elementDeclaredByDeclaration(Declaration node);
+
+  /**
+   * Return the element associated with the declaration [node], or `null` if
+   * either this node corresponds to a list of declarations or if the AST
+   * structure has not been resolved.
+   */
+  LocalVariableElement elementDeclaredByDeclaredIdentifier(
+      DeclaredIdentifier node);
+
+  /**
+   * Return the element associated with the directive [node], or `null` if the
+   * AST structure has not been resolved or if this directive could not be
+   * resolved.
+   */
+  Element elementDeclaredByDirective(Directive node);
+
+  /**
+   * Return the element associated with the declaration [node], or `null` if
+   * either this node corresponds to a list of declarations or if the AST
+   * structure has not been resolved.
+   */
+  ClassElement elementDeclaredByEnumDeclaration(EnumDeclaration node);
+
+  /**
+   * Return the element representing the parameter [node], or `null` if this
+   * parameter has not been resolved.
+   */
+  ParameterElement elementDeclaredByFormalParameter(FormalParameter node);
+
+  /**
+   * Return the element associated with the declaration [node], or `null` if
+   * either this node corresponds to a list of declarations or if the AST
+   * structure has not been resolved.
+   */
+  ExecutableElement elementDeclaredByFunctionDeclaration(
+      FunctionDeclaration node);
+
+  /**
+   * Return the element associated with the function expression [node], or
+   * `null` if the AST structure has not been resolved.
+   */
+  ExecutableElement elementDeclaredByFunctionExpression(
+      FunctionExpression node);
+
+  /**
+   * Return the element associated with the declaration [node], or `null` if
+   * either this node corresponds to a list of declarations or if the AST
+   * structure has not been resolved.
+   */
+  ExecutableElement elementDeclaredByMethodDeclaration(MethodDeclaration node);
+
+  /**
+   * Return the element associated with the declaration [node], or `null` if
+   * either this node corresponds to a list of declarations or if the AST
+   * structure has not been resolved.
+   */
+  VariableElement elementDeclaredByVariableDeclaration(
+      VariableDeclaration node);
+
+  /**
+   * Return the element associated with the annotation [node], or `null` if the
+   * AST structure has not been resolved or if this annotation could not be
+   * resolved.
+   */
+  Element elementForAnnotation(Annotation node);
+
+  /**
+   * Return the element representing the parameter being named by the
+   * expression [node], or `null` if the AST structure has not been resolved or
+   * if there is no parameter with the same name as this expression.
+   */
+  ParameterElement elementForNamedExpression(NamedExpression node);
+
+  /**
+   * Return a list containing the elements representing the parameters in the
+   * list [node]. The list will contain `null`s if the parameters in this list
+   * have not been resolved.
+   */
+  List<ParameterElement> parameterElementsForFormalParameterList(
+      FormalParameterList node);
+
+  /**
+   * Return the element associated with the function being invoked at [node]
+   * based on propagated type information, or `null` if the AST structure has
+   * not been resolved or the function could not be resolved.
+   */
+  ExecutableElement propagatedElementForFunctionExpressionInvocation(
+      FunctionExpressionInvocation node);
+
+  /**
+   * Return the element associated with the identifier [node] based on
+   * propagated type information, or `null` if the AST structure has not been
+   * resolved or if this identifier could not be resolved. One example of the
+   * latter case is an identifier that is not defined within the scope in which
+   * it appears.
+   */
+  Element propagatedElementForIdentifier(Identifier node);
+
+  /**
+   * Return the element associated with the expression [node] based on
+   * propagated types, or `null` if the AST structure has not been resolved, or
+   * there is no meaningful propagated element to return (e.g. because this is a
+   * non-compound assignment expression, or because the method referred to could
+   * not be resolved).
+   */
+  MethodElement propagatedElementForMethodReference(
+      MethodReferenceExpression node);
+
+  /**
+   * If the expression [node] is an argument to an invocation, and the AST
+   * structure has been resolved, and the function being invoked is known based
+   * on propagated type information, and [node] corresponds to one of the
+   * parameters of the function being invoked, then return the parameter element
+   * representing the parameter to which the value of [node] will be
+   * bound. Otherwise, return `null`.
+   */
+  ParameterElement propagatedParameterElementForExpression(Expression node);
+
+  /**
+   * Return the propagated type of the expression [node], or `null` if type
+   * propagation has not been performed on the AST structure.
+   */
+  DartType propagatedTypeForExpression(Expression node);
+
+  /**
+   * Return the element associated with the constructor referenced by [node]
+   * based on static type information, or `null` if the AST structure has not
+   * been resolved or if the constructor could not be resolved.
+   */
+  ConstructorElement staticElementForConstructorReference(
+      ConstructorReferenceNode node);
+
+  /**
+   * Return the element associated with the function being invoked at [node]
+   * based on static type information, or `null` if the AST structure has not
+   * been resolved or the function could not be resolved.
+   */
+  ExecutableElement staticElementForFunctionExpressionInvocation(
+      FunctionExpressionInvocation node);
+
+  /**
+   * Return the element associated with the identifier [node] based on static
+   * type information, or `null` if the AST structure has not been resolved or
+   * if this identifier could not be resolved. One example of the latter case is
+   * an identifier that is not defined within the scope in which it appears
+   */
+  Element staticElementForIdentifier(Identifier node);
+
+  /**
+   * Return the element associated with the expression [node] based on the
+   * static types, or `null` if the AST structure has not been resolved, or
+   * there is no meaningful static element to return (e.g. because this is a
+   * non-compound assignment expression, or because the method referred to could
+   * not be resolved).
+   */
+  MethodElement staticElementForMethodReference(MethodReferenceExpression node);
+
+  /**
+   * Return the function type of the invocation [node] based on the static type
+   * information, or `null` if the AST structure has not been resolved, or if
+   * the invoke could not be resolved.
+   *
+   * This will usually be a [FunctionType], but it can also be an
+   * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
+   * interface type that implements `Function`.
+   */
+  DartType staticInvokeTypeForInvocationExpression(InvocationExpression node);
+
+  /**
+   * If the expression [node] is an argument to an invocation, and the AST
+   * structure has been resolved, and the function being invoked is known based
+   * on static type information, and [node] corresponds to one of the parameters
+   * of the function being invoked, then return the parameter element
+   * representing the parameter to which the value of [node] will be
+   * bound. Otherwise, return `null`.
+   */
+  ParameterElement staticParameterElementForExpression(Expression node);
+
+  /**
+   * Return the static type of the expression [node], or `null` if the AST
+   * structure has not been resolved.
+   */
+  DartType staticTypeForExpression(Expression node);
+
+  /**
+   * Return the type being named by [node], or `null` if the AST structure has
+   * not been resolved.
+   */
+  DartType typeForTypeName(TypeAnnotation node);
+
+  /**
+   * Return the element associated with the uri of the directive [node], or
+   * `null` if the AST structure has not been resolved or if the URI could not
+   * be resolved. Examples of the latter case include a directive that contains
+   * an invalid URL or a URL that does not exist.
+   */
+  Element uriElementForDirective(UriBasedDirective node);
+}
diff --git a/pkg/analyzer/lib/dart/ast/standard_resolution_map.dart b/pkg/analyzer/lib/dart/ast/standard_resolution_map.dart
new file mode 100644
index 0000000..c778063
--- /dev/null
+++ b/pkg/analyzer/lib/dart/ast/standard_resolution_map.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/resolution_map.dart';
+import 'package:analyzer/src/dart/ast/resolution_map.dart';
+
+/**
+ * Gets an instance of [ResolutionMap] based on the standard AST implementation.
+ */
+final ResolutionMap resolutionMap = new ResolutionMapImpl();
diff --git a/pkg/analyzer/lib/dart/ast/visitor.dart b/pkg/analyzer/lib/dart/ast/visitor.dart
index ad96bed..79f3bfb 100644
--- a/pkg/analyzer/lib/dart/ast/visitor.dart
+++ b/pkg/analyzer/lib/dart/ast/visitor.dart
@@ -50,7 +50,7 @@
  *
  *     visitor.visitAllNodes(rootNode);
  *
- * Clients may extend or implement this class.
+ * Clients may extend this class.
  */
 class BreadthFirstVisitor<R> extends GeneralizingAstVisitor<R> {
   /**
@@ -147,7 +147,7 @@
  * do so will cause the visit methods for superclasses of the node to not be
  * invoked and will cause the children of the visited node to not be visited.
  *
- * Clients may extend or implement this class.
+ * Clients may extend this class.
  */
 class GeneralizingAstVisitor<R> implements AstVisitor<R> {
   @override
@@ -336,6 +336,13 @@
       visitNormalFormalParameter(node);
 
   @override
+  R visitGenericFunctionType(GenericFunctionType node) =>
+      visitTypeAnnotation(node);
+
+  @override
+  R visitGenericTypeAlias(GenericTypeAlias node) => visitTypeAlias(node);
+
+  @override
   R visitHideCombinator(HideCombinator node) => visitCombinator(node);
 
   R visitIdentifier(Identifier node) => visitExpression(node);
@@ -528,6 +535,8 @@
 
   R visitTypeAlias(TypeAlias node) => visitNamedCompilationUnitMember(node);
 
+  R visitTypeAnnotation(TypeAnnotation node) => visitNode(node);
+
   @override
   R visitTypeArgumentList(TypeArgumentList node) => visitNode(node);
 
@@ -576,7 +585,7 @@
  * Failure to do so will cause the children of the visited node to not be
  * visited.
  *
- * Clients may extend or implement this class.
+ * Clients may extend this class.
  */
 class RecursiveAstVisitor<R> implements AstVisitor<R> {
   @override
@@ -880,6 +889,18 @@
   }
 
   @override
+  R visitGenericFunctionType(GenericFunctionType node) {
+    node.visitChildren(this);
+    return null;
+  }
+
+  @override
+  R visitGenericTypeAlias(GenericTypeAlias node) {
+    node.visitChildren(this);
+    return null;
+  }
+
+  @override
   R visitHideCombinator(HideCombinator node) {
     node.visitChildren(this);
     return null;
@@ -1241,7 +1262,7 @@
  * dispatch mechanism (and hence don't need to recursively visit a whole
  * structure) and that only need to visit a small number of node types.
  *
- * Clients may extend or implement this class.
+ * Clients may extend this class.
  */
 class SimpleAstVisitor<R> implements AstVisitor<R> {
   @override
@@ -1398,6 +1419,12 @@
       null;
 
   @override
+  R visitGenericFunctionType(GenericFunctionType node) => null;
+
+  @override
+  R visitGenericTypeAlias(GenericTypeAlias node) => null;
+
+  @override
   R visitHideCombinator(HideCombinator node) => null;
 
   @override
@@ -1579,7 +1606,366 @@
 }
 
 /**
- * An AST Visitor that captures visit call timings.
+ * An AST visitor that will throw an exception if any of the visit methods that
+ * are invoked have not been overridden. It is intended to be a superclass for
+ * classes that implement the visitor pattern and need to (a) override all of
+ * the visit methods or (b) need to override a subset of the visit method and
+ * want to catch when any other visit methods have been invoked.
+ *
+ * Clients may extend this class.
+ */
+class ThrowingAstVisitor<R> implements AstVisitor<R> {
+  @override
+  R visitAdjacentStrings(AdjacentStrings node) => _throw(node);
+
+  @override
+  R visitAnnotation(Annotation node) => _throw(node);
+
+  @override
+  R visitArgumentList(ArgumentList node) => _throw(node);
+
+  @override
+  R visitAsExpression(AsExpression node) => _throw(node);
+
+  @override
+  R visitAssertInitializer(AssertInitializer node) => _throw(node);
+
+  @override
+  R visitAssertStatement(AssertStatement node) => _throw(node);
+
+  @override
+  R visitAssignmentExpression(AssignmentExpression node) => _throw(node);
+
+  @override
+  R visitAwaitExpression(AwaitExpression node) => _throw(node);
+
+  @override
+  R visitBinaryExpression(BinaryExpression node) => _throw(node);
+
+  @override
+  R visitBlock(Block node) => _throw(node);
+
+  @override
+  R visitBlockFunctionBody(BlockFunctionBody node) => _throw(node);
+
+  @override
+  R visitBooleanLiteral(BooleanLiteral node) => _throw(node);
+
+  @override
+  R visitBreakStatement(BreakStatement node) => _throw(node);
+
+  @override
+  R visitCascadeExpression(CascadeExpression node) => _throw(node);
+
+  @override
+  R visitCatchClause(CatchClause node) => _throw(node);
+
+  @override
+  R visitClassDeclaration(ClassDeclaration node) => _throw(node);
+
+  @override
+  R visitClassTypeAlias(ClassTypeAlias node) => _throw(node);
+
+  @override
+  R visitComment(Comment node) => _throw(node);
+
+  @override
+  R visitCommentReference(CommentReference node) => _throw(node);
+
+  @override
+  R visitCompilationUnit(CompilationUnit node) => _throw(node);
+
+  @override
+  R visitConditionalExpression(ConditionalExpression node) => _throw(node);
+
+  @override
+  R visitConfiguration(Configuration node) => _throw(node);
+
+  @override
+  R visitConstructorDeclaration(ConstructorDeclaration node) => _throw(node);
+
+  @override
+  R visitConstructorFieldInitializer(ConstructorFieldInitializer node) =>
+      _throw(node);
+
+  @override
+  R visitConstructorName(ConstructorName node) => _throw(node);
+
+  @override
+  R visitContinueStatement(ContinueStatement node) => _throw(node);
+
+  @override
+  R visitDeclaredIdentifier(DeclaredIdentifier node) => _throw(node);
+
+  @override
+  R visitDefaultFormalParameter(DefaultFormalParameter node) => _throw(node);
+
+  @override
+  R visitDoStatement(DoStatement node) => _throw(node);
+
+  @override
+  R visitDottedName(DottedName node) => _throw(node);
+
+  @override
+  R visitDoubleLiteral(DoubleLiteral node) => _throw(node);
+
+  @override
+  R visitEmptyFunctionBody(EmptyFunctionBody node) => _throw(node);
+
+  @override
+  R visitEmptyStatement(EmptyStatement node) => _throw(node);
+
+  @override
+  R visitEnumConstantDeclaration(EnumConstantDeclaration node) => _throw(node);
+
+  @override
+  R visitEnumDeclaration(EnumDeclaration node) => _throw(node);
+
+  @override
+  R visitExportDirective(ExportDirective node) => _throw(node);
+
+  @override
+  R visitExpressionFunctionBody(ExpressionFunctionBody node) => _throw(node);
+
+  @override
+  R visitExpressionStatement(ExpressionStatement node) => _throw(node);
+
+  @override
+  R visitExtendsClause(ExtendsClause node) => _throw(node);
+
+  @override
+  R visitFieldDeclaration(FieldDeclaration node) => _throw(node);
+
+  @override
+  R visitFieldFormalParameter(FieldFormalParameter node) => _throw(node);
+
+  @override
+  R visitForEachStatement(ForEachStatement node) => _throw(node);
+
+  @override
+  R visitFormalParameterList(FormalParameterList node) => _throw(node);
+
+  @override
+  R visitForStatement(ForStatement node) => _throw(node);
+
+  @override
+  R visitFunctionDeclaration(FunctionDeclaration node) => _throw(node);
+
+  @override
+  R visitFunctionDeclarationStatement(FunctionDeclarationStatement node) =>
+      _throw(node);
+
+  @override
+  R visitFunctionExpression(FunctionExpression node) => _throw(node);
+
+  @override
+  R visitFunctionExpressionInvocation(FunctionExpressionInvocation node) =>
+      _throw(node);
+
+  @override
+  R visitFunctionTypeAlias(FunctionTypeAlias node) => _throw(node);
+
+  @override
+  R visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) =>
+      _throw(node);
+
+  @override
+  R visitGenericFunctionType(GenericFunctionType node) => _throw(node);
+
+  @override
+  R visitGenericTypeAlias(GenericTypeAlias node) => _throw(node);
+
+  @override
+  R visitHideCombinator(HideCombinator node) => _throw(node);
+
+  @override
+  R visitIfStatement(IfStatement node) => _throw(node);
+
+  @override
+  R visitImplementsClause(ImplementsClause node) => _throw(node);
+
+  @override
+  R visitImportDirective(ImportDirective node) => _throw(node);
+
+  @override
+  R visitIndexExpression(IndexExpression node) => _throw(node);
+
+  @override
+  R visitInstanceCreationExpression(InstanceCreationExpression node) =>
+      _throw(node);
+
+  @override
+  R visitIntegerLiteral(IntegerLiteral node) => _throw(node);
+
+  @override
+  R visitInterpolationExpression(InterpolationExpression node) => _throw(node);
+
+  @override
+  R visitInterpolationString(InterpolationString node) => _throw(node);
+
+  @override
+  R visitIsExpression(IsExpression node) => _throw(node);
+
+  @override
+  R visitLabel(Label node) => _throw(node);
+
+  @override
+  R visitLabeledStatement(LabeledStatement node) => _throw(node);
+
+  @override
+  R visitLibraryDirective(LibraryDirective node) => _throw(node);
+
+  @override
+  R visitLibraryIdentifier(LibraryIdentifier node) => _throw(node);
+
+  @override
+  R visitListLiteral(ListLiteral node) => _throw(node);
+
+  @override
+  R visitMapLiteral(MapLiteral node) => _throw(node);
+
+  @override
+  R visitMapLiteralEntry(MapLiteralEntry node) => _throw(node);
+
+  @override
+  R visitMethodDeclaration(MethodDeclaration node) => _throw(node);
+
+  @override
+  R visitMethodInvocation(MethodInvocation node) => _throw(node);
+
+  @override
+  R visitNamedExpression(NamedExpression node) => _throw(node);
+
+  @override
+  R visitNativeClause(NativeClause node) => _throw(node);
+
+  @override
+  R visitNativeFunctionBody(NativeFunctionBody node) => _throw(node);
+
+  @override
+  R visitNullLiteral(NullLiteral node) => _throw(node);
+
+  @override
+  R visitParenthesizedExpression(ParenthesizedExpression node) => _throw(node);
+
+  @override
+  R visitPartDirective(PartDirective node) => _throw(node);
+
+  @override
+  R visitPartOfDirective(PartOfDirective node) => _throw(node);
+
+  @override
+  R visitPostfixExpression(PostfixExpression node) => _throw(node);
+
+  @override
+  R visitPrefixedIdentifier(PrefixedIdentifier node) => _throw(node);
+
+  @override
+  R visitPrefixExpression(PrefixExpression node) => _throw(node);
+
+  @override
+  R visitPropertyAccess(PropertyAccess node) => _throw(node);
+
+  @override
+  R visitRedirectingConstructorInvocation(
+          RedirectingConstructorInvocation node) =>
+      _throw(node);
+
+  @override
+  R visitRethrowExpression(RethrowExpression node) => _throw(node);
+
+  @override
+  R visitReturnStatement(ReturnStatement node) => _throw(node);
+
+  @override
+  R visitScriptTag(ScriptTag node) => _throw(node);
+
+  @override
+  R visitShowCombinator(ShowCombinator node) => _throw(node);
+
+  @override
+  R visitSimpleFormalParameter(SimpleFormalParameter node) => _throw(node);
+
+  @override
+  R visitSimpleIdentifier(SimpleIdentifier node) => _throw(node);
+
+  @override
+  R visitSimpleStringLiteral(SimpleStringLiteral node) => _throw(node);
+
+  @override
+  R visitStringInterpolation(StringInterpolation node) => _throw(node);
+
+  @override
+  R visitSuperConstructorInvocation(SuperConstructorInvocation node) =>
+      _throw(node);
+
+  @override
+  R visitSuperExpression(SuperExpression node) => _throw(node);
+
+  @override
+  R visitSwitchCase(SwitchCase node) => _throw(node);
+
+  @override
+  R visitSwitchDefault(SwitchDefault node) => _throw(node);
+
+  @override
+  R visitSwitchStatement(SwitchStatement node) => _throw(node);
+
+  @override
+  R visitSymbolLiteral(SymbolLiteral node) => _throw(node);
+
+  @override
+  R visitThisExpression(ThisExpression node) => _throw(node);
+
+  @override
+  R visitThrowExpression(ThrowExpression node) => _throw(node);
+
+  @override
+  R visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) =>
+      _throw(node);
+
+  @override
+  R visitTryStatement(TryStatement node) => _throw(node);
+
+  @override
+  R visitTypeArgumentList(TypeArgumentList node) => _throw(node);
+
+  @override
+  R visitTypeName(TypeName node) => _throw(node);
+
+  @override
+  R visitTypeParameter(TypeParameter node) => _throw(node);
+
+  @override
+  R visitTypeParameterList(TypeParameterList node) => _throw(node);
+
+  @override
+  R visitVariableDeclaration(VariableDeclaration node) => _throw(node);
+
+  @override
+  R visitVariableDeclarationList(VariableDeclarationList node) => _throw(node);
+
+  @override
+  R visitVariableDeclarationStatement(VariableDeclarationStatement node) =>
+      _throw(node);
+
+  @override
+  R visitWhileStatement(WhileStatement node) => _throw(node);
+
+  @override
+  R visitWithClause(WithClause node) => _throw(node);
+  @override
+  R visitYieldStatement(YieldStatement node) => _throw(node);
+
+  R _throw(AstNode node) {
+    throw new Exception('Missing implementation of visit${node.runtimeType}');
+  }
+}
+
+/**
+ * An AST visitor that captures visit call timings.
+ *
+ * Clients may not extend, implement or mix-in this class.
  */
 class TimedAstVisitor<T> implements AstVisitor<T> {
   /**
@@ -2000,6 +2386,22 @@
   }
 
   @override
+  T visitGenericFunctionType(GenericFunctionType node) {
+    stopwatch.start();
+    T result = _baseVisitor.visitGenericFunctionType(node);
+    stopwatch.stop();
+    return result;
+  }
+
+  @override
+  T visitGenericTypeAlias(GenericTypeAlias node) {
+    stopwatch.start();
+    T result = _baseVisitor.visitGenericTypeAlias(node);
+    stopwatch.stop();
+    return result;
+  }
+
+  @override
   T visitHideCombinator(HideCombinator node) {
     stopwatch.start();
     T result = _baseVisitor.visitHideCombinator(node);
@@ -2483,7 +2885,7 @@
  * Failure to do so will cause the children of the visited node to not be
  * visited.
  *
- * Clients may extend or implement this class.
+ * Clients may extend this class.
  */
 class UnifyingAstVisitor<R> implements AstVisitor<R> {
   @override
@@ -2642,6 +3044,12 @@
       visitNode(node);
 
   @override
+  R visitGenericFunctionType(GenericFunctionType node) => visitNode(node);
+
+  @override
+  R visitGenericTypeAlias(GenericTypeAlias node) => visitNode(node);
+
+  @override
   R visitHideCombinator(HideCombinator node) => visitNode(node);
 
   @override
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index cee76da..f7dbe75 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -37,6 +37,7 @@
 library analyzer.dart.element.element;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/resolution_base_classes.dart';
 import 'package:analyzer/dart/constant/value.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
@@ -563,7 +564,7 @@
  *
  * Clients may not extend, implement or mix-in this class.
  */
-abstract class Element implements AnalysisTarget {
+abstract class Element implements AnalysisTarget, ResolutionTarget {
   /**
    * A comparator that can be used to sort elements by their name offset.
    * Elements with a smaller offset will be sorted to be before elements with a
@@ -718,7 +719,7 @@
    * Use the given [visitor] to visit this element. Return the value returned by
    * the visitor as a result of visiting this element.
    */
-  accept(ElementVisitor visitor);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/> visitor);
 
   /**
    * Return the documentation comment for this element as it appears in the
@@ -787,7 +788,8 @@
  *
  * Clients may not extend, implement or mix-in this class.
  */
-abstract class ElementAnnotation implements ConstantEvaluationTarget {
+abstract class ElementAnnotation
+    implements ConstantEvaluationTarget, ResolutionTarget {
   /**
    * An empty list of annotations.
    */
@@ -1015,7 +1017,14 @@
 /**
  * An object that can be used to visit an element structure.
  *
- * Clients may implement this class.
+ * Clients may not extend, implement or mix-in this class. There are classes
+ * that implement this interface that provide useful default behaviors in
+ * `package:analyzer/dart/ast/visitor.dart`. A couple of the most useful include
+ * * SimpleElementVisitor which implements every visit method by doing nothing,
+ * * RecursiveElementVisitor which will cause every node in a structure to be
+ *   visited, and
+ * * ThrowingElementVisitor which implements every visit method by throwing an
+ *   exception.
  */
 abstract class ElementVisitor<R> {
   R visitClassElement(ClassElement element);
@@ -1565,6 +1574,15 @@
 
   @override
   MethodDeclaration computeNode();
+
+  /**
+   * Gets the reified type of a tear-off of this method.
+   *
+   * If any of the parameters in the method are covariant, they are replaced
+   * with Object in the returned type. If no covariant parameters are present,
+   * returns `this`.
+   */
+  FunctionType getReifiedType(DartType objectType);
 }
 
 /**
diff --git a/pkg/analyzer/lib/dart/element/type.dart b/pkg/analyzer/lib/dart/element/type.dart
index b6923a0..4f0729c 100644
--- a/pkg/analyzer/lib/dart/element/type.dart
+++ b/pkg/analyzer/lib/dart/element/type.dart
@@ -22,6 +22,7 @@
  */
 library analyzer.dart.element.type;
 
+import 'package:analyzer/dart/ast/resolution_base_classes.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/type.dart' show InterfaceTypeImpl;
 import 'package:analyzer/src/generated/type_system.dart' show TypeSystem;
@@ -31,7 +32,7 @@
  *
  * Clients may not extend, implement or mix-in this class.
  */
-abstract class DartType {
+abstract class DartType implements ResolutionType {
   /**
    * An empty list of types.
    */
@@ -63,12 +64,24 @@
   bool get isDartAsyncFuture;
 
   /**
+   * Return `true` if this type represents the type 'FutureOr<T>' defined in the
+   * dart:async library.
+   */
+  bool get isDartAsyncFutureOr;
+
+  /**
    * Return `true` if this type represents the type 'Function' defined in the
    * dart:core library.
    */
   bool get isDartCoreFunction;
 
   /**
+   * Return `true` if this type represents the type 'Null' defined in the
+   * dart:core library.
+   */
+  bool get isDartCoreNull;
+
+  /**
    * Return `true` if this type represents the type 'dynamic'.
    */
   bool get isDynamic;
@@ -698,9 +711,6 @@
    */
   static const List<TypeParameterType> EMPTY_LIST = const <TypeParameterType>[];
 
-  @override
-  TypeParameterElement get element;
-
   /**
    * Return the type representing the bound associated with this parameter,
    * or `dynamic` if there was no explicit bound.
@@ -715,4 +725,7 @@
    * Always consult the bound if that could be relevant.
    */
   ElementLocation get definition;
+
+  @override
+  TypeParameterElement get element;
 }
diff --git a/pkg/analyzer/lib/dart/element/visitor.dart b/pkg/analyzer/lib/dart/element/visitor.dart
index 185357d..c34c771 100644
--- a/pkg/analyzer/lib/dart/element/visitor.dart
+++ b/pkg/analyzer/lib/dart/element/visitor.dart
@@ -82,7 +82,7 @@
  * do so will cause the visit methods for superclasses of the element to not be
  * invoked and will cause the children of the visited node to not be visited.
  *
- * Clients may extend or implement this class.
+ * Clients may extend this class.
  */
 class GeneralizingElementVisitor<R> implements ElementVisitor<R> {
   @override
@@ -189,7 +189,7 @@
  * children. Failure to do so will cause the children of the visited element to
  * not be visited.
  *
- * Clients may extend or implement this class.
+ * Clients may extend this class.
  */
 class RecursiveElementVisitor<R> implements ElementVisitor<R> {
   @override
@@ -313,7 +313,7 @@
  * mechanism (and hence don't need to recursively visit a whole structure) and
  * that only need to visit a small number of element types.
  *
- * Clients may extend or implement this class.
+ * Clients may extend this class.
  */
 class SimpleElementVisitor<R> implements ElementVisitor<R> {
   @override
@@ -374,3 +374,82 @@
   @override
   R visitTypeParameterElement(TypeParameterElement element) => null;
 }
+
+/**
+ * An AST visitor that will throw an exception if any of the visit methods that
+ * are invoked have not been overridden. It is intended to be a superclass for
+ * classes that implement the visitor pattern and need to (a) override all of
+ * the visit methods or (b) need to override a subset of the visit method and
+ * want to catch when any other visit methods have been invoked.
+ *
+ * Clients may extend this class.
+ */
+class ThrowingElementVisitor<R> implements ElementVisitor<R> {
+  @override
+  R visitClassElement(ClassElement element) => _throw(element);
+
+  @override
+  R visitCompilationUnitElement(CompilationUnitElement element) =>
+      _throw(element);
+
+  @override
+  R visitConstructorElement(ConstructorElement element) => _throw(element);
+
+  @override
+  R visitExportElement(ExportElement element) => _throw(element);
+
+  @override
+  R visitFieldElement(FieldElement element) => _throw(element);
+
+  @override
+  R visitFieldFormalParameterElement(FieldFormalParameterElement element) =>
+      _throw(element);
+
+  @override
+  R visitFunctionElement(FunctionElement element) => _throw(element);
+
+  @override
+  R visitFunctionTypeAliasElement(FunctionTypeAliasElement element) =>
+      _throw(element);
+
+  @override
+  R visitImportElement(ImportElement element) => _throw(element);
+
+  @override
+  R visitLabelElement(LabelElement element) => _throw(element);
+
+  @override
+  R visitLibraryElement(LibraryElement element) => _throw(element);
+
+  @override
+  R visitLocalVariableElement(LocalVariableElement element) => _throw(element);
+
+  @override
+  R visitMethodElement(MethodElement element) => _throw(element);
+
+  @override
+  R visitMultiplyDefinedElement(MultiplyDefinedElement element) =>
+      _throw(element);
+
+  @override
+  R visitParameterElement(ParameterElement element) => _throw(element);
+
+  @override
+  R visitPrefixElement(PrefixElement element) => _throw(element);
+
+  @override
+  R visitPropertyAccessorElement(PropertyAccessorElement element) =>
+      _throw(element);
+
+  @override
+  R visitTopLevelVariableElement(TopLevelVariableElement element) =>
+      _throw(element);
+
+  @override
+  R visitTypeParameterElement(TypeParameterElement element) => _throw(element);
+
+  R _throw(Element element) {
+    throw new Exception(
+        'Missing implementation of visit${element.runtimeType}');
+  }
+}
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 8a4f9e8..1cabe11 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -6,12 +6,12 @@
 
 import 'dart:collection';
 
-import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/listener.dart';
 import 'package:analyzer/src/dart/scanner/scanner.dart' show ScannerErrorCode;
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/generated/java_core.dart';
 import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
+import 'package:analyzer/src/generated/resolver.dart' show ResolverErrorCode;
 import 'package:analyzer/src/generated/source.dart';
 import 'package:front_end/src/base/errors.dart';
 import 'package:front_end/src/scanner/errors.dart';
@@ -111,7 +111,6 @@
   CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
   CompileTimeErrorCode.EXTENDS_ENUM,
   CompileTimeErrorCode.EXTENDS_NON_CLASS,
-  CompileTimeErrorCode.EXTRA_ARGUMENT_TO_ASSERT,
   CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS,
   CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
   CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER,
@@ -150,6 +149,7 @@
   CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST,
   CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP,
   CompileTimeErrorCode.INVALID_URI,
+  CompileTimeErrorCode.INVALID_USE_OF_COVARIANT,
   CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE,
   CompileTimeErrorCode.LABEL_UNDEFINED,
   CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME,
@@ -233,6 +233,9 @@
   HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH,
   HintCode.DEAD_CODE_ON_CATCH_SUBTYPE,
   HintCode.DEPRECATED_MEMBER_USE,
+  HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION,
+  HintCode.DEPRECATED_EXTENDS_FUNCTION,
+  HintCode.DEPRECATED_MIXIN_FUNCTION,
   HintCode.DIVISION_OPTIMIZATION,
   HintCode.DUPLICATE_IMPORT,
   HintCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE,
@@ -297,6 +300,7 @@
   ParserErrorCode.CLASS_IN_CLASS,
   ParserErrorCode.COLON_IN_PLACE_OF_IN,
   ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE,
+  ParserErrorCode.CONST_AND_COVARIANT,
   ParserErrorCode.CONST_AND_FINAL,
   ParserErrorCode.CONST_AND_VAR,
   ParserErrorCode.CONST_CLASS,
@@ -307,7 +311,12 @@
   ParserErrorCode.CONST_TYPEDEF,
   ParserErrorCode.CONTINUE_OUTSIDE_OF_LOOP,
   ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE,
-  ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS,
+  ParserErrorCode.COVARIANT_AFTER_VAR,
+  ParserErrorCode.COVARIANT_AND_STATIC,
+  ParserErrorCode.COVARIANT_CONSTRUCTOR,
+  ParserErrorCode.COVARIANT_MEMBER,
+  ParserErrorCode.COVARIANT_TOP_LEVEL_DECLARATION,
+  ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE,
   ParserErrorCode.DIRECTIVE_AFTER_DECLARATION,
   ParserErrorCode.DUPLICATED_MODIFIER,
   ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT,
@@ -338,6 +347,7 @@
   ParserErrorCode.FACTORY_WITHOUT_BODY,
   ParserErrorCode.FACTORY_WITH_INITIALIZERS,
   ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR,
+  ParserErrorCode.FINAL_AND_COVARIANT,
   ParserErrorCode.FINAL_AND_VAR,
   ParserErrorCode.FINAL_CLASS,
   ParserErrorCode.FINAL_CONSTRUCTOR,
@@ -374,12 +384,14 @@
   ParserErrorCode.MISSING_EXPRESSION_IN_INITIALIZER,
   ParserErrorCode.MISSING_EXPRESSION_IN_THROW,
   ParserErrorCode.MISSING_FUNCTION_BODY,
+  ParserErrorCode.MISSING_FUNCTION_KEYWORD,
   ParserErrorCode.MISSING_FUNCTION_PARAMETERS,
   ParserErrorCode.MISSING_GET,
   ParserErrorCode.MISSING_IDENTIFIER,
   ParserErrorCode.MISSING_INITIALIZER,
   ParserErrorCode.MISSING_KEYWORD_OPERATOR,
   ParserErrorCode.MISSING_METHOD_PARAMETERS,
+  ParserErrorCode.MISSING_NAME_FOR_NAMED_PARAMETER,
   ParserErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE,
   ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE,
   ParserErrorCode.MISSING_PREFIX_IN_DEFERRED_IMPORT,
@@ -398,6 +410,7 @@
   ParserErrorCode.MULTIPLE_VARIABLES_IN_FOR_EACH,
   ParserErrorCode.MULTIPLE_WITH_CLAUSES,
   ParserErrorCode.NAMED_FUNCTION_EXPRESSION,
+  ParserErrorCode.NAMED_FUNCTION_TYPE,
   ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP,
   ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE,
   ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE,
@@ -442,6 +455,9 @@
   ParserErrorCode.WITH_WITHOUT_EXTENDS,
   ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER,
   ParserErrorCode.WRONG_TERMINATOR_FOR_PARAMETER_GROUP,
+  ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER,
+  ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH,
+  ResolverErrorCode.MISSING_LIBRARY_DIRECTIVE_WITH_PART,
   ScannerErrorCode.ILLEGAL_CHARACTER,
   ScannerErrorCode.MISSING_DIGIT,
   ScannerErrorCode.MISSING_HEX_DIGIT,
@@ -564,6 +580,7 @@
   StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER,
   StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE,
   StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS,
+  StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER,
   StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC,
   StaticWarningCode.TYPE_TEST_WITH_NON_TYPE,
   StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME,
@@ -612,7 +629,9 @@
   StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_MIXIN,
   StrongModeCode.INVALID_PARAMETER_DECLARATION,
   StrongModeCode.INVALID_SUPER_INVOCATION,
+  StrongModeCode.NO_DEFAULT_BOUNDS,
   StrongModeCode.NON_GROUND_TYPE_CHECK_INFO,
+  StrongModeCode.NOT_INSTANTIATED_BOUND,
   StrongModeCode.UNSAFE_BLOCK_CLOSURE_INFERENCE,
   TodoCode.TODO,
 ];
@@ -858,13 +877,6 @@
  */
 class ErrorProperty<V> implements Comparable<ErrorProperty> {
   /**
-   * A property whose value is a list of [FieldElement]s that are final, but
-   * not initialized by a constructor.
-   */
-  static const ErrorProperty<List<FieldElement>> NOT_INITIALIZED_FIELDS =
-      const ErrorProperty<List<FieldElement>>('NOT_INITIALIZED_FIELDS', 0);
-
-  /**
    * A property whose value is the name of the library that is used by all
    * of the "part of" directives, so should be used in the "library" directive.
    * Is `null` if there is no a single name used by all of the parts.
@@ -872,17 +884,8 @@
   static const ErrorProperty<String> PARTS_LIBRARY_NAME =
       const ErrorProperty<String>('PARTS_LIBRARY_NAME', 1);
 
-  /**
-   * A property whose value is a list of [ExecutableElement] that should
-   * be but are not implemented by a concrete class.
-   */
-  static const ErrorProperty<List<ExecutableElement>> UNIMPLEMENTED_METHODS =
-      const ErrorProperty<List<ExecutableElement>>('UNIMPLEMENTED_METHODS', 2);
-
   static const List<ErrorProperty> values = const [
-    NOT_INITIALIZED_FIELDS,
     PARTS_LIBRARY_NAME,
-    UNIMPLEMENTED_METHODS
   ];
 
   /**
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index 42731be..20f69e7 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -50,10 +50,11 @@
    * this class are never converted automatically.
    */
   String convertPath(String path) {
-    if (pathContext.style == pathos.windows.style &&
-        path.startsWith(pathos.posix.separator)) {
-      path = r'C:' +
-          path.replaceAll(pathos.posix.separator, pathos.windows.separator);
+    if (pathContext.style == pathos.windows.style) {
+      if (path.startsWith(pathos.posix.separator)) {
+        path = r'C:' + path;
+      }
+      path = path.replaceAll(pathos.posix.separator, pathos.windows.separator);
     }
     return path;
   }
diff --git a/pkg/analyzer/lib/plugin/command_line.dart b/pkg/analyzer/lib/plugin/command_line.dart
deleted file mode 100644
index 7a6fbd8..0000000
--- a/pkg/analyzer/lib/plugin/command_line.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/**
- * Support for client code that extends command-line tools that use the analysis
- * engine by adding new command-line arguments.
- */
-library analyzer.plugin.command_line;
-
-import 'package:analyzer/src/plugin/command_line_plugin.dart';
-import 'package:args/args.dart';
-import 'package:plugin/plugin.dart';
-
-/**
- * The identifier of the extension point that allows plugins to add new flags
- * and options to the command-line parser before the parser is used to parse
- * the command-line. The object used as an extension must be an
- * [ArgParserContributor].
- */
-final String PARSER_CONTRIBUTOR_EXTENSION_POINT_ID = Plugin.join(
-    CommandLinePlugin.UNIQUE_IDENTIFIER,
-    CommandLinePlugin.PARSER_CONTRIBUTOR_EXTENSION_POINT);
-
-/**
- * The identifier of the extension point that allows plugins to access the
- * result of parsing the command-line. The object used as an extension must be
- * an [ArgResultsProcessor].
- */
-final String RESULT_PROCESSOR_EXTENSION_POINT_ID = Plugin.join(
-    CommandLinePlugin.UNIQUE_IDENTIFIER,
-    CommandLinePlugin.RESULT_PROCESSOR_EXTENSION_POINT);
-
-/**
- * A function that will contribute flags and options to the command-line parser.
- */
-typedef void ArgParserContributor(ArgParser parser);
-
-/**
- * A function that will process the results of parsing the command-line.
- */
-typedef void ArgResultsProcessor(ArgResults results);
diff --git a/pkg/analyzer/lib/plugin/options.dart b/pkg/analyzer/lib/plugin/options.dart
index 632c4d9..f884df5 100644
--- a/pkg/analyzer/lib/plugin/options.dart
+++ b/pkg/analyzer/lib/plugin/options.dart
@@ -7,28 +7,9 @@
 library analyzer.plugin.options;
 
 import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/plugin/options_plugin.dart';
-import 'package:plugin/plugin.dart';
 import 'package:yaml/yaml.dart';
 
-/// The identifier of the extension point that allows plugins to access
-/// options defined in the analysis options file. The object used as an
-/// extension must be an [OptionsProcessor].
-final String OPTIONS_PROCESSOR_EXTENSION_POINT_ID = Plugin.join(
-    OptionsPlugin.UNIQUE_IDENTIFIER,
-    OptionsPlugin.OPTIONS_PROCESSOR_EXTENSION_POINT);
-
-/// The identifier of the extension point that allows plugins to validate
-/// options defined in the analysis options file. The object used as an
-/// extension must be an [OptionsValidator].
-final String OPTIONS_VALIDATOR_EXTENSION_POINT_ID = Plugin.join(
-    OptionsPlugin.UNIQUE_IDENTIFIER,
-    OptionsPlugin.OPTIONS_VALIDATOR_EXTENSION_POINT);
-
-/// Processes options defined in the analysis options file.
-///
-/// Clients may implement this class when implementing plugins.
+/// Validates options as defined in an analysis options file.
 ///
 /// The options file format is intentionally very open-ended, giving clients
 /// utmost flexibility in defining their own options.  The only hardfast
@@ -55,29 +36,9 @@
 ///
 ///     bool useMultiPackage =
 ///         options['compiler']['resolver']['useMultiPackage'];
-abstract class OptionsProcessor {
-  /// Called when an error occurs in processing options.
-  void onError(Exception exception);
-
-  /// Called when an options file is processed.
-  ///
-  /// The options file is processed on analyzer initialization and
-  /// subsequently when the file is changed on disk.  In the event of a
-  /// change notification, note that the notification simply indicates
-  /// a change on disk. Content in specific option scopes may or may not
-  /// be different. It is up to the implementer to check whether specific
-  /// options have changed and to handle those changes appropriately. In
-  /// addition to the [options] map, the associated analysis [context] is
-  /// provided as well to allow for context-specific configuration.
-  void optionsProcessed(AnalysisContext context, Map<String, Object> options);
-}
-
-/// Validates options as defined in an analysis options file.
 ///
 /// Clients may implement this class when implementing plugins.
 ///
-/// See [OptionsProcessor] for a description of the options file format.
-///
 abstract class OptionsValidator {
   /// Validate [options], reporting any errors to the given [reporter].
   void validate(ErrorReporter reporter, Map<String, YamlNode> options);
diff --git a/pkg/analyzer/lib/plugin/task.dart b/pkg/analyzer/lib/plugin/task.dart
index 2a242de..a9059af 100644
--- a/pkg/analyzer/lib/plugin/task.dart
+++ b/pkg/analyzer/lib/plugin/task.dart
@@ -41,20 +41,6 @@
 
 /**
  * The identifier of the extension point that allows plugins to register new
- * analysis tasks with the analysis engine. The object used as an extension must
- * be a [TaskDescriptor].
- *
- * Contributed tasks should never extract information from Dart elements or AST
- * (e.g. offsets) of a source and put it into results for targets in other
- * sources. Dart elements and ASTs are updated during incremental resolution,
- * and invalidation of results is intentionally limited by the source bounds
- * for performance reasons.
- */
-final String TASK_EXTENSION_POINT_ID = Plugin.join(
-    EnginePlugin.UNIQUE_IDENTIFIER, EnginePlugin.TASK_EXTENSION_POINT);
-
-/**
- * The identifier of the extension point that allows plugins to register new
  * work managers with the analysis engine. The object used as an extension must
  * be a [WorkManagerFactory].
  */
diff --git a/pkg/analyzer/lib/source/error_processor.dart b/pkg/analyzer/lib/source/error_processor.dart
index 9b09559..1d8d0f8 100644
--- a/pkg/analyzer/lib/source/error_processor.dart
+++ b/pkg/analyzer/lib/source/error_processor.dart
@@ -84,22 +84,25 @@
   /// Create an error processor that ignores the given error by [code].
   factory ErrorProcessor.ignore(String code) => new ErrorProcessor(code);
 
+  /// The string that unique describes the processor.
+  String get description => '$code -> ${severity?.name}';
+
   /// Check if this processor applies to the given [error].
   bool appliesTo(AnalysisError error) => code == error.errorCode.name;
 
-  /// Return an error processor associated with this [context] for the given
-  /// [error], or `null` if none is found.
+  /// Return an error processor associated in the [analysisOptions] for the
+  /// given [error], or `null` if none is found.
   static ErrorProcessor getProcessor(
-      AnalysisContext context, AnalysisError error) {
-    if (context == null) {
+      AnalysisOptions analysisOptions, AnalysisError error) {
+    if (analysisOptions == null) {
       return null;
     }
 
     // Let the user configure how specific errors are processed.
-    List<ErrorProcessor> processors = context.analysisOptions.errorProcessors;
+    List<ErrorProcessor> processors = analysisOptions.errorProcessors;
 
     // Give strong mode a chance to upgrade it.
-    if (context.analysisOptions.strongMode) {
+    if (analysisOptions.strongMode) {
       processors = processors.toList();
       processors.add(_StrongModeTypeErrorProcessor.instance);
     }
@@ -117,6 +120,9 @@
   String get code => throw new UnsupportedError(
       "_StrongModeTypeErrorProcessor is not specific to an error code.");
 
+  @override
+  String get description => 'allStrongWarnings -> ERROR';
+
   /// In strong mode, type warnings are upgraded to errors.
   ErrorSeverity get severity => ErrorSeverity.ERROR;
 
diff --git a/pkg/analyzer/lib/src/codegen/tools.dart b/pkg/analyzer/lib/src/codegen/tools.dart
index cccab10..da71812 100644
--- a/pkg/analyzer/lib/src/codegen/tools.dart
+++ b/pkg/analyzer/lib/src/codegen/tools.dart
@@ -155,12 +155,12 @@
     });
   }
 
-  void outputHeader({bool javaStyle: false}) {
+  void outputHeader({bool javaStyle: false, String year = null}) {
     String header;
     if (codeGeneratorSettings.languageName == 'java') {
       header = '''
 /*
- * Copyright (c) 2015, the Dart project authors.
+ * Copyright (c) ${year ?? '2015'}, the Dart project authors.
  *
  * Licensed under the Eclipse Public License v1.0 (the "License"); you may not use this file except
  * in compliance with the License. You may obtain a copy of the License at
@@ -177,7 +177,7 @@
  */''';
     } else if (codeGeneratorSettings.languageName == 'python') {
       header = '''
-# Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
+# Copyright (c) ${year ?? '2014'}, the Dart project authors.  Please see the AUTHORS file
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 #
@@ -187,7 +187,7 @@
 ''';
     } else {
       header = '''
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
+// Copyright (c) ${year ?? '2014'}, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 //
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index 939623d..1871625 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -18,8 +18,8 @@
 const String defineVariableOption = 'D';
 const String enableInitializingFormalAccessFlag = 'initializing-formal-access';
 const String enableStrictCallChecksFlag = 'enable-strict-call-checks';
-const String enableSuperInMixinFlag = 'supermixin';
-const String ignoreUnrecognizedFlagsFlag = 'ignore_unrecognized_flags';
+const String enableSuperMixinFlag = 'supermixin';
+const String ignoreUnrecognizedFlagsFlag = 'ignore-unrecognized-flags';
 const String noImplicitCastsFlag = 'no-implicit-casts';
 const String noImplicitDynamicFlag = 'no-implicit-dynamic';
 const String packageRootOption = 'package-root';
@@ -29,11 +29,34 @@
 const String strongModeFlag = 'strong';
 
 /**
+ * Update [options] with the value of each analysis option command line flag.
+ */
+void applyAnalysisOptionFlags(AnalysisOptionsImpl options, ArgResults args) {
+  if (args.wasParsed(enableStrictCallChecksFlag)) {
+    options.enableStrictCallChecks = args[enableStrictCallChecksFlag];
+  }
+  if (args.wasParsed(enableSuperMixinFlag)) {
+    options.enableSuperMixins = args[enableSuperMixinFlag];
+  }
+  if (args.wasParsed(noImplicitCastsFlag)) {
+    options.implicitCasts = !args[noImplicitCastsFlag];
+  }
+  if (args.wasParsed(noImplicitDynamicFlag)) {
+    options.implicitDynamic = !args[noImplicitDynamicFlag];
+  }
+  if (args.wasParsed(strongModeFlag)) {
+    options.strongMode = args[strongModeFlag];
+  }
+}
+
+/**
  * Use the given [resourceProvider], [contentCache] and command-line [args] to
  * create a context builder.
  */
-ContextBuilderOptions createContextBuilderOptions(ArgResults args) {
+ContextBuilderOptions createContextBuilderOptions(ArgResults args,
+    {bool strongMode, bool trackCacheDependencies}) {
   ContextBuilderOptions builderOptions = new ContextBuilderOptions();
+  builderOptions.argResults = args;
   //
   // File locations.
   //
@@ -46,11 +69,13 @@
   // Analysis options.
   //
   AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
-  defaultOptions.enableStrictCallChecks = args[enableStrictCallChecksFlag];
-  defaultOptions.enableSuperMixins = args[enableSuperInMixinFlag];
-  defaultOptions.implicitCasts = !args[noImplicitCastsFlag];
-  defaultOptions.implicitDynamic = !args[noImplicitDynamicFlag];
-  defaultOptions.strongMode = args[strongModeFlag];
+  applyAnalysisOptionFlags(defaultOptions, args);
+  if (strongMode != null) {
+    defaultOptions.strongMode = strongMode;
+  }
+  if (trackCacheDependencies != null) {
+    defaultOptions.trackCacheDependencies = trackCacheDependencies;
+  }
   builderOptions.defaultOptions = defaultOptions;
   //
   // Declared variables.
@@ -103,29 +128,37 @@
  * Add the standard flags and options to the given [parser]. The standard flags
  * are those that are typically used to control the way in which the code is
  * analyzed.
+ *
+ * TODO(danrubel) Update DDC to support all the options defined in this method
+ * then remove the [ddc] named argument from this method.
  */
-void defineAnalysisArguments(ArgParser parser) {
+void defineAnalysisArguments(ArgParser parser, {bool hide: true, ddc: false}) {
   parser.addOption(defineVariableOption,
       abbr: 'D',
       allowMultiple: true,
       help: 'Define environment variables. For example, "-Dfoo=bar" defines an '
           'environment variable named "foo" whose value is "bar".');
+
   parser.addOption(sdkPathOption, help: 'The path to the Dart SDK.');
   parser.addOption(sdkSummaryPathOption,
-      help: 'The path to the Dart SDK summary file.', hide: true);
+      help: 'The path to the Dart SDK summary file.', hide: hide);
+
   parser.addOption(analysisOptionsFileOption,
       help: 'Path to an analysis options file.');
+
+  parser.addOption(packageRootOption,
+      abbr: 'p',
+      help: 'The path to a package root directory (deprecated). '
+          'This option cannot be used with --packages.');
   parser.addOption(packagesOption,
       help: 'The path to the package resolution configuration file, which '
           'supplies a mapping of package names to paths. This option cannot be '
-          'used with --package-root.');
-  parser.addOption(packageRootOption,
-      abbr: 'p',
-      help: 'The path to a package root directory (deprecated). This option '
-          'cannot be used with --packages.');
+          'used with --package-root.',
+      hide: ddc);
 
   parser.addFlag(strongModeFlag,
-      help: 'Enable strong static checks (https://goo.gl/DqcBsw)');
+      help: 'Enable strong static checks (https://goo.gl/DqcBsw)',
+      defaultsTo: ddc);
   parser.addFlag(noImplicitCastsFlag,
       negatable: false,
       help: 'Disable implicit casts in strong mode (https://goo.gl/cTLz40)');
@@ -139,29 +172,64 @@
 //      help: 'Enable support for null-aware operators (DEP 9).',
 //      defaultsTo: false,
 //      negatable: false,
-//      hide: true);
+//      hide: hide || ddc);
   parser.addFlag(enableStrictCallChecksFlag,
       help: 'Fix issue 21938.',
       defaultsTo: false,
       negatable: false,
-      hide: true);
+      hide: hide);
   parser.addFlag(enableInitializingFormalAccessFlag,
       help:
           'Enable support for allowing access to field formal parameters in a '
           'constructor\'s initializer list',
       defaultsTo: false,
       negatable: false,
-      hide: true);
-  parser.addFlag(enableSuperInMixinFlag,
+      hide: hide || ddc);
+  parser.addFlag(enableSuperMixinFlag,
       help: 'Relax restrictions on mixins (DEP 34).',
       defaultsTo: false,
       negatable: false,
-      hide: true);
+      hide: hide);
 //  parser.addFlag('enable_type_checks',
 //      help: 'Check types in constant evaluation.',
 //      defaultsTo: false,
 //      negatable: false,
-//      hide: true);
+//      hide: hide || ddc);
+}
+
+/**
+ * Find arguments of the form -Dkey=value
+ * or argument pairs of the form -Dkey value
+ * and place those key/value pairs into [definedVariables].
+ * Return a list of arguments with the key/value arguments removed.
+ */
+List<String> extractDefinedVariables(
+    List<String> args, Map<String, String> definedVariables) {
+  //TODO(danrubel) extracting defined variables is already handled by the
+  // createContextBuilderOptions method.
+  // Long term we should switch to using that instead.
+  int count = args.length;
+  List<String> remainingArgs = <String>[];
+  for (int i = 0; i < count; i++) {
+    String arg = args[i];
+    if (arg == '--') {
+      while (i < count) {
+        remainingArgs.add(args[i++]);
+      }
+    } else if (arg.startsWith("-D")) {
+      int end = arg.indexOf('=');
+      if (end > 2) {
+        definedVariables[arg.substring(2, end)] = arg.substring(end + 1);
+      } else if (i + 1 < count) {
+        definedVariables[arg.substring(2)] = args[++i];
+      } else {
+        remainingArgs.add(arg);
+      }
+    } else {
+      remainingArgs.add(arg);
+    }
+  }
+  return remainingArgs;
 }
 
 /**
@@ -175,7 +243,7 @@
  * - it starts with something other than '--' or '-'.
  *
  * This function allows command-line tools to implement the
- * '--ignore_unrecognized_flags' option.
+ * '--ignore-unrecognized-flags' option.
  */
 List<String> filterUnknownArguments(List<String> args, ArgParser parser) {
   Set<String> knownOptions = new HashSet<String>();
@@ -227,10 +295,13 @@
 }
 
 /**
- * Preprocess the given list of command line [args] by checking whether the real
- * arguments are in a file (Bazel worker mode).
+ * Preprocess the given list of command line [args].
+ * If the final arg is `@file_path` (Bazel worker mode),
+ * then read in all the lines of that file and add those as args.
+ * Always returns a new modifiable list.
  */
 List<String> preprocessArgs(ResourceProvider provider, List<String> args) {
+  args = new List.from(args);
   if (args.isEmpty) {
     return args;
   }
@@ -238,16 +309,15 @@
   if (lastArg.startsWith('@')) {
     File argsFile = provider.getFile(lastArg.substring(1));
     try {
-      List<String> newArgs = args.sublist(0, args.length - 1).toList();
-      newArgs.addAll(argsFile
+      args.removeLast();
+      args.addAll(argsFile
           .readAsStringSync()
           .replaceAll('\r\n', '\n')
           .replaceAll('\r', '\n')
           .split('\n')
           .where((String line) => line.isNotEmpty));
-      return newArgs;
-    } on FileSystemException {
-      // Don't modify args if the file does not exist or cannot be read.
+    } on FileSystemException catch (e) {
+      throw new Exception('Failed to read file specified by $lastArg : $e');
     }
   }
   return args;
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index 5037995..58301b7 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -9,19 +9,26 @@
 
 import 'package:analyzer/context/declared_variables.dart';
 import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/plugin/options.dart';
 import 'package:analyzer/plugin/resolver_provider.dart';
 import 'package:analyzer/source/analysis_options_provider.dart';
 import 'package:analyzer/source/package_map_resolver.dart';
+import 'package:analyzer/src/command_line/arguments.dart'
+    show applyAnalysisOptionFlags;
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart'
+    show AnalysisDriver, AnalysisDriverScheduler, PerformanceLog;
+import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/dart/sdk/sdk.dart';
 import 'package:analyzer/src/generated/bazel.dart';
 import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/gn.dart';
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/summary/package_bundle_reader.dart';
 import 'package:analyzer/src/summary/pub_summary.dart';
 import 'package:analyzer/src/summary/summary_sdk.dart';
 import 'package:analyzer/src/task/options.dart';
+import 'package:args/args.dart';
 import 'package:package_config/packages.dart';
 import 'package:package_config/packages_file.dart';
 import 'package:package_config/src/packages_impl.dart';
@@ -64,7 +71,8 @@
   final DartSdkManager sdkManager;
 
   /**
-   * The cache containing the contents of overlaid files.
+   * The cache containing the contents of overlaid files. If this builder will
+   * be used to build analysis drivers, set the [fileContentOverlay] instead.
    */
   final ContentCache contentCache;
 
@@ -86,6 +94,28 @@
   ResolverProvider fileResolverProvider;
 
   /**
+   * The scheduler used by any analysis drivers created through this interface.
+   */
+  AnalysisDriverScheduler analysisDriverScheduler;
+
+  /**
+   * The performance log used by any analysis drivers created through this
+   * interface.
+   */
+  PerformanceLog performanceLog;
+
+  /**
+   * The byte store used by any analysis drivers created through this interface.
+   */
+  ByteStore byteStore;
+
+  /**
+   * The file content overlay used by analysis drivers. If this builder will be
+   * used to build analysis contexts, set the [contentCache] instead.
+   */
+  FileContentOverlay fileContentOverlay;
+
+  /**
    * Initialize a newly created builder to be ready to build a context rooted in
    * the directory with the given [rootDirectoryPath].
    */
@@ -102,7 +132,7 @@
   AnalysisContext buildContext(String path) {
     InternalAnalysisContext context =
         AnalysisEngine.instance.createAnalysisContext();
-    AnalysisOptions options = getAnalysisOptions(context, path);
+    AnalysisOptions options = getAnalysisOptions(path);
     context.contentCache = contentCache;
     context.sourceFactory = createSourceFactory(path, options);
     context.analysisOptions = options;
@@ -114,6 +144,26 @@
   }
 
   /**
+   * Return an analysis driver that is configured correctly to analyze code in
+   * the directory with the given [path].
+   */
+  AnalysisDriver buildDriver(String path) {
+    AnalysisOptions options = getAnalysisOptions(path);
+    //_processAnalysisOptions(context, optionMap);
+    AnalysisDriver driver = new AnalysisDriver(
+        analysisDriverScheduler,
+        performanceLog,
+        resourceProvider,
+        byteStore,
+        fileContentOverlay,
+        path,
+        createSourceFactory(path, options),
+        options);
+    declareVariablesInDriver(driver);
+    return driver;
+  }
+
+  /**
    * Configure the context to make use of summaries.
    */
   void configureSummaries(InternalAnalysisContext context) {
@@ -206,6 +256,17 @@
       return new SourceFactory(resolvers, null, resourceProvider);
     }
 
+    GnWorkspace gnWorkspace = GnWorkspace.find(resourceProvider, rootPath);
+    if (gnWorkspace != null) {
+      DartSdk sdk = findSdk(gnWorkspace.packageMap, options);
+      List<UriResolver> resolvers = <UriResolver>[
+        new DartUriResolver(sdk),
+        new GnPackageUriResolver(gnWorkspace),
+        new GnFileUriResolver(gnWorkspace)
+      ];
+      return new SourceFactory(resolvers, null, resourceProvider);
+    }
+
     Packages packages = createPackageMap(rootPath);
     Map<String, List<Folder>> packageMap = convertPackagesToMap(packages);
     List<UriResolver> resolvers = <UriResolver>[
@@ -231,6 +292,20 @@
   }
 
   /**
+   * Add any [declaredVariables] to the list of declared variables used by the
+   * given analysis [driver].
+   */
+  void declareVariablesInDriver(AnalysisDriver driver) {
+    Map<String, String> variables = builderOptions.declaredVariables;
+    if (variables != null && variables.isNotEmpty) {
+      DeclaredVariables contextVariables = driver.declaredVariables;
+      variables.forEach((String variableName, String value) {
+        contextVariables.define(variableName, value);
+      });
+    }
+  }
+
+  /**
    * Finds a package resolution strategy for the directory at the given absolute
    * [path].
    *
@@ -325,15 +400,13 @@
   }
 
   /**
-   * Return the analysis options that should be used when the given [context] is
-   * used to analyze code in the directory with the given [path].
+   * Return the analysis options that should be used to analyze code in the
+   * directory with the given [path].
    */
-  AnalysisOptions getAnalysisOptions(AnalysisContext context, String path) {
+  AnalysisOptions getAnalysisOptions(String path) {
     AnalysisOptionsImpl options = createDefaultOptions();
     File optionsFile = getOptionsFile(path);
     if (optionsFile != null) {
-      List<OptionsProcessor> optionsProcessors =
-          AnalysisEngine.instance.optionsPlugin.optionsProcessors;
       // TODO(danrubel) restructure so that we don't recalculate the package map
       // more than once per path.
       Packages packages = createPackageMap(path);
@@ -348,11 +421,12 @@
         Map<String, YamlNode> optionMap =
             new AnalysisOptionsProvider(sourceFactory)
                 .getOptionsFromFile(optionsFile);
-        optionsProcessors.forEach(
-            (OptionsProcessor p) => p.optionsProcessed(context, optionMap));
         applyToAnalysisOptions(options, optionMap);
-      } on Exception catch (exception) {
-        optionsProcessors.forEach((OptionsProcessor p) => p.onError(exception));
+      } catch (_) {
+        // Ignore exceptions thrown while trying to load the options file.
+      }
+      if (builderOptions.argResults != null) {
+        applyAnalysisOptionFlags(options, builderOptions.argResults);
       }
     }
     return options;
@@ -486,6 +560,12 @@
  */
 class ContextBuilderOptions {
   /**
+   * The results of parsing the command line arguments as defined by
+   * [defineAnalysisArguments] or `null` if none.
+   */
+  ArgResults argResults;
+
+  /**
    * The file path of the file containing the summary of the SDK that should be
    * used to "analyze" the SDK. This option should only be specified by
    * command-line tools such as 'dartanalyzer' or 'ddc'.
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index 30d48e2..5c20e0b 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -8,6 +8,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/exception/exception.dart';
@@ -203,6 +204,15 @@
    */
   List<AnalysisListener> _listeners = new List<AnalysisListener>();
 
+  /**
+   * Determines whether this context should attempt to make use of the global
+   * SDK cache partition. Note that if this context is responsible for
+   * resynthesizing the SDK element model, this flag should be set to `false`,
+   * so that resynthesized elements belonging to this context won't leak into
+   * the global SDK cache partition.
+   */
+  bool useSdkCachePartition = true;
+
   @override
   ResultProvider resultProvider;
 
@@ -239,6 +249,7 @@
    * Initialize a newly created analysis context.
    */
   AnalysisContextImpl() {
+    AnalysisEngine.instance.processRequiredPlugins();
     _privatePartition = new UniversalCachePartition(this);
     _cache = createCacheFromSourceFactory(null);
     _taskManager = AnalysisEngine.instance.taskManager;
@@ -282,7 +293,6 @@
         this._options.strongMode != options.strongMode ||
         this._options.enableAssertInitializer !=
             options.enableAssertInitializer ||
-        this._options.enableAssertMessage != options.enableAssertMessage ||
         this._options.enableLazyAssignmentOperators !=
             options.enableLazyAssignmentOperators ||
         ((options is AnalysisOptionsImpl)
@@ -300,14 +310,13 @@
         this._options.enableStrictCallChecks !=
             options.enableStrictCallChecks ||
         this._options.enableSuperMixins != options.enableSuperMixins ||
-        this._options.patchPlatform != options.patchPlatform;
+        !_samePatchPaths(this._options.patchPaths, options.patchPaths);
     this._options.analyzeFunctionBodiesPredicate =
         options.analyzeFunctionBodiesPredicate;
     this._options.generateImplicitErrors = options.generateImplicitErrors;
     this._options.generateSdkErrors = options.generateSdkErrors;
     this._options.dart2jsHint = options.dart2jsHint;
     this._options.enableAssertInitializer = options.enableAssertInitializer;
-    this._options.enableAssertMessage = options.enableAssertMessage;
     this._options.enableStrictCallChecks = options.enableStrictCallChecks;
     this._options.enableLazyAssignmentOperators =
         options.enableLazyAssignmentOperators;
@@ -329,7 +338,7 @@
     this._options.trackCacheDependencies = options.trackCacheDependencies;
     this._options.disableCacheFlushing = options.disableCacheFlushing;
     this._options.finerGrainedInvalidation = options.finerGrainedInvalidation;
-    this._options.patchPlatform = options.patchPlatform;
+    this._options.patchPaths = options.patchPaths;
     if (options is AnalysisOptionsImpl) {
       this._options.strongModeHints = options.strongModeHints;
       this._options.implicitCasts = options.implicitCasts;
@@ -739,6 +748,9 @@
       if (factory == null) {
         return new AnalysisCache(<CachePartition>[_privatePartition]);
       }
+      if (!useSdkCachePartition) {
+        return new AnalysisCache(<CachePartition>[_privatePartition]);
+      }
       DartSdk sdk = factory.dartSdk;
       if (sdk == null) {
         return new AnalysisCache(<CachePartition>[_privatePartition]);
@@ -810,8 +822,9 @@
     if (source == null) {
       return false;
     }
-    if (_contentCache.getContents(source) != null) {
-      return true;
+    bool overriddenExists = _contentCache.getExists(source);
+    if (overriddenExists != null) {
+      return overriddenExists;
     }
     return source.exists();
   }
@@ -1246,6 +1259,7 @@
       setValue(HINTS, AnalysisError.NO_ERRORS);
       setValue(LINTS, AnalysisError.NO_ERRORS);
       setValue(LIBRARY_UNIT_ERRORS, AnalysisError.NO_ERRORS);
+      setValue(RESOLVE_DIRECTIVES_ERRORS, AnalysisError.NO_ERRORS);
       setValue(RESOLVE_TYPE_NAMES_ERRORS, AnalysisError.NO_ERRORS);
       setValue(RESOLVE_UNIT_ERRORS, AnalysisError.NO_ERRORS);
       entry.setState(RESOLVED_UNIT, CacheState.FLUSHED);
@@ -1944,9 +1958,12 @@
       }
       // if validation, remember the result, but throw it away
       if (analysisOptions.incrementalValidation) {
-        incrementalResolutionValidation_lastUnitSource = oldUnit.element.source;
+        CompilationUnitElement compilationUnitElement =
+            resolutionMap.elementDeclaredByCompilationUnit(oldUnit);
+        incrementalResolutionValidation_lastUnitSource =
+            compilationUnitElement.source;
         incrementalResolutionValidation_lastLibrarySource =
-            oldUnit.element.library.source;
+            compilationUnitElement.library.source;
         incrementalResolutionValidation_lastUnit = oldUnit;
         return false;
       }
@@ -1964,6 +1981,21 @@
       return true;
     });
   }
+
+  static bool _samePatchPaths(
+      Map<String, List<String>> a, Map<String, List<String>> b) {
+    if (a.length != b.length) return false;
+    for (var key in a.keys) {
+      if (!b.containsKey(key)) return false;
+      var aValue = a[key];
+      var bValue = b[key];
+      if (aValue.length != bValue.length) return false;
+      for (var i = 0; i < aValue.length; i++) {
+        if (aValue[i] != bValue[i]) return false;
+      }
+    }
+    return true;
+  }
 }
 
 /**
diff --git a/pkg/analyzer/lib/src/dart/analysis/byte_store.dart b/pkg/analyzer/lib/src/dart/analysis/byte_store.dart
index 3f3f5db..2f151f9 100644
--- a/pkg/analyzer/lib/src/dart/analysis/byte_store.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/byte_store.dart
@@ -98,3 +98,14 @@
     }
   }
 }
+
+/**
+ * [ByteStore] which does not store any data.
+ */
+class NullByteStore implements ByteStore {
+  @override
+  List<int> get(String key) => null;
+
+  @override
+  void put(String key, List<int> bytes) {}
+}
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index a903243..18c8124 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -6,10 +6,12 @@
 import 'dart:collection';
 import 'dart:typed_data';
 
+import 'package:analyzer/context/declared_variables.dart';
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart' show CompilationUnitElement;
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/exception/exception.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/src/context/context.dart';
 import 'package:analyzer/src/dart/analysis/byte_store.dart';
@@ -17,9 +19,11 @@
 import 'package:analyzer/src/dart/analysis/index.dart';
 import 'package:analyzer/src/dart/analysis/search.dart';
 import 'package:analyzer/src/dart/analysis/status.dart';
+import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
 import 'package:analyzer/src/generated/engine.dart'
-    show AnalysisContext, AnalysisEngine, AnalysisOptions, ChangeSet;
+    show AnalysisContext, AnalysisEngine, AnalysisOptions;
 import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/services/lint.dart';
 import 'package:analyzer/src/summary/api_signature.dart';
 import 'package:analyzer/src/summary/format.dart';
 import 'package:analyzer/src/summary/idl.dart';
@@ -27,6 +31,7 @@
 import 'package:analyzer/src/summary/package_bundle_reader.dart';
 import 'package:analyzer/src/task/dart.dart' show COMPILATION_UNIT_ELEMENT;
 import 'package:analyzer/task/dart.dart' show LibrarySpecificUnit;
+import 'package:meta/meta.dart';
 
 /**
  * This class computes [AnalysisResult]s for Dart files.
@@ -64,19 +69,17 @@
  *
  *
  * TODO(scheglov) Clean up the list of implicitly analyzed files.
- *
- * TODO(scheglov) Handle not existing 'dart:x' URIs (while user is typing).
  */
 class AnalysisDriver {
   /**
    * The version of data format, should be incremented on every format change.
    */
-  static const int DATA_VERSION = 9;
+  static const int DATA_VERSION = 13;
 
   /**
    * The name of the driver, e.g. the name of the folder.
    */
-  String name;
+  final String name;
 
   /**
    * The scheduler that schedules analysis work in this, and possibly other
@@ -108,21 +111,30 @@
   final FileContentOverlay _contentOverlay;
 
   /**
+   * The analysis options to analyze with.
+   */
+  AnalysisOptions _analysisOptions;
+
+  /**
+   * The optional SDK bundle, used when the client cannot read SDK files.
+   */
+  final PackageBundle _sdkBundle;
+
+  /**
    * The [SourceFactory] is used to resolve URIs to paths and restore URIs
    * from file paths.
    */
-  final SourceFactory sourceFactory;
+  SourceFactory _sourceFactory;
 
   /**
-   * The analysis options to analyze with.
+   * The declared environment variables.
    */
-  final AnalysisOptions analysisOptions;
+  final DeclaredVariables declaredVariables = new DeclaredVariables();
 
   /**
    * The salt to mix into all hashes used as keys for serialized data.
    */
-  final Uint32List _salt =
-      new Uint32List(1 + AnalysisOptions.crossContextOptionsLength);
+  final Uint32List _salt = new Uint32List(1 + AnalysisOptions.signatureLength);
 
   /**
    * The current file system state.
@@ -130,15 +142,9 @@
   FileSystemState _fsState;
 
   /**
-   * The combined unlinked and linked package for the SDK, extracted from
-   * the given [_sourceFactory].
+   * The set of added files.
    */
-  PackageBundle _sdkBundle;
-
-  /**
-   * The set of explicitly analyzed files.
-   */
-  final _explicitFiles = new LinkedHashSet<String>();
+  final _addedFiles = new LinkedHashSet<String>();
 
   /**
    * The set of priority files, that should be analyzed sooner.
@@ -157,10 +163,23 @@
   final _referencingNameTasks = <_FilesReferencingNameTask>[];
 
   /**
+   * The list of tasks to compute top-level declarations of a name.
+   */
+  final _topLevelNameDeclarationsTasks = <_TopLevelNameDeclarationsTask>[];
+
+  /**
    * The mapping from the files for which the index was requested using
    * [getIndex] to the [Completer]s to report the result.
    */
-  final _indexRequestedFiles = <String, List<Completer<IndexResult>>>{};
+  final _indexRequestedFiles =
+      <String, List<Completer<AnalysisDriverUnitIndex>>>{};
+
+  /**
+   * The mapping from the files for which the index was requested using
+   * [getIndex] to the [Completer]s to report the result.
+   */
+  final _unitElementRequestedFiles =
+      <String, List<Completer<CompilationUnitElement>>>{};
 
   /**
    * The set of files were reported as changed through [changeFile] and not
@@ -191,15 +210,28 @@
   final _resultController = new StreamController<AnalysisResult>();
 
   /**
+   * Cached results for [_priorityFiles].
+   */
+  final Map<String, AnalysisResult> _priorityResults = {};
+
+  /**
    * The instance of the status helper.
    */
   final StatusSupport _statusSupport = new StatusSupport();
 
   /**
+   * The controller for the [exceptions] stream.
+   */
+  final StreamController<ExceptionResult> _exceptionController =
+      new StreamController<ExceptionResult>();
+
+  /**
    * The instance of the [Search] helper.
    */
   Search _search;
 
+  AnalysisDriverTestView _testView;
+
   /**
    * Create a new instance of [AnalysisDriver].
    *
@@ -212,33 +244,67 @@
       this._resourceProvider,
       this._byteStore,
       this._contentOverlay,
+      this.name,
       SourceFactory sourceFactory,
-      this.analysisOptions)
-      : sourceFactory = sourceFactory.clone() {
+      this._analysisOptions,
+      {PackageBundle sdkBundle})
+      : _sourceFactory = sourceFactory.clone(),
+        _sdkBundle = sdkBundle {
+    _testView = new AnalysisDriverTestView(this);
     _fillSalt();
-    _sdkBundle = sourceFactory.dartSdk.getLinkedBundle();
-    _fsState = new FileSystemState(
-        _logger,
-        _byteStore,
-        _contentOverlay,
-        _resourceProvider,
-        sourceFactory,
-        analysisOptions,
-        _salt,
-        _sdkBundle.apiSignature);
+    _fsState = new FileSystemState(_logger, _byteStore, _contentOverlay,
+        _resourceProvider, sourceFactory, _analysisOptions, _salt);
     _scheduler._add(this);
     _search = new Search(this);
   }
 
   /**
-   * Return the set of files added to analysis using [addFile].
+   * Return the set of files explicitly added to analysis using [addFile].
    */
-  Set<String> get addedFiles => _explicitFiles;
+  Set<String> get addedFiles => _addedFiles;
 
   /**
-   * Return the set of files that are known, i.e. added or used implicitly.
+   * Return the analysis options used to control analysis.
    */
-  Set<String> get knownFiles => _fsState.knownFiles;
+  AnalysisOptions get analysisOptions => _analysisOptions;
+
+  /**
+   * Return the stream that produces [ExceptionResult]s.
+   */
+  Stream<ExceptionResult> get exceptions => _exceptionController.stream;
+
+  /**
+   * The current file system state.
+   */
+  FileSystemState get fsState => _fsState;
+
+  /**
+   * Return `true` if the driver has a file to analyze.
+   */
+  bool get hasFilesToAnalyze {
+    return _changedFiles.isNotEmpty ||
+        _requestedFiles.isNotEmpty ||
+        _requestedParts.isNotEmpty ||
+        _filesToAnalyze.isNotEmpty ||
+        _partsToAnalyze.isNotEmpty;
+  }
+
+  /**
+   * Return the set of files that are known at this moment. This set does not
+   * always include all added files or all implicitly used file. If a file has
+   * not been processed yet, it might be missing.
+   */
+  Set<String> get knownFiles => _fsState.knownFilePaths;
+
+  /**
+   * Return the number of files scheduled for analysis.
+   */
+  int get numberOfFilesToAnalyze => _filesToAnalyze.length;
+
+  /**
+   * Return the list of files that the driver should try to analyze sooner.
+   */
+  List<String> get priorityFiles => _priorityFiles.toList(growable: false);
 
   /**
    * Set the list of files that the driver should try to analyze sooner.
@@ -250,6 +316,10 @@
    * between priority files, nor between priority and non-priority files.
    */
   void set priorityFiles(List<String> priorityPaths) {
+    _priorityResults.keys
+        .toSet()
+        .difference(priorityPaths.toSet())
+        .forEach(_priorityResults.remove);
     _priorityFiles.clear();
     _priorityFiles.addAll(priorityPaths);
     _statusSupport.transitionToAnalyzing();
@@ -286,10 +356,19 @@
   Search get search => _search;
 
   /**
+   * Return the source factory used to resolve URIs to paths and restore URIs
+   * from file paths.
+   */
+  SourceFactory get sourceFactory => _sourceFactory;
+
+  /**
    * Return the stream that produces [AnalysisStatus] events.
    */
   Stream<AnalysisStatus> get status => _statusSupport.stream;
 
+  @visibleForTesting
+  AnalysisDriverTestView get test => _testView;
+
   /**
    * Return the priority of work that the driver needs to perform.
    */
@@ -298,10 +377,16 @@
       return AnalysisDriverPriority.interactive;
     }
     if (_referencingNameTasks.isNotEmpty) {
-      return AnalysisDriverPriority.referencingName;
+      return AnalysisDriverPriority.interactive;
     }
     if (_indexRequestedFiles.isNotEmpty) {
-      return AnalysisDriverPriority.getIndex;
+      return AnalysisDriverPriority.interactive;
+    }
+    if (_unitElementRequestedFiles.isNotEmpty) {
+      return AnalysisDriverPriority.interactive;
+    }
+    if (_topLevelNameDeclarationsTasks.isNotEmpty) {
+      return AnalysisDriverPriority.interactive;
     }
     if (_priorityFiles.isNotEmpty) {
       for (String path in _priorityFiles) {
@@ -332,8 +417,9 @@
    */
   void addFile(String path) {
     if (AnalysisEngine.isDartFileName(path)) {
-      _explicitFiles.add(path);
+      _addedFiles.add(path);
       _filesToAnalyze.add(path);
+      _priorityResults.clear();
     }
     _statusSupport.transitionToAnalyzing();
     _scheduler._notify(this);
@@ -358,12 +444,34 @@
    * [changeFile] invocation.
    */
   void changeFile(String path) {
-    if (AnalysisEngine.isDartFileName(path)) {
-      _changedFiles.add(path);
-      if (_explicitFiles.contains(path)) {
-        _filesToAnalyze.add(path);
-      }
+    _changedFiles.add(path);
+    if (_addedFiles.contains(path)) {
+      _filesToAnalyze.add(path);
     }
+    _priorityResults.clear();
+    _statusSupport.transitionToAnalyzing();
+    _scheduler._notify(this);
+  }
+
+  /**
+   * Some state on which analysis depends has changed, so the driver needs to be
+   * re-configured with the new state.
+   *
+   * At least one of the optional parameters should be provided, but only those
+   * that represent state that has actually changed need be provided.
+   */
+  void configure(
+      {AnalysisOptions analysisOptions, SourceFactory sourceFactory}) {
+    if (analysisOptions != null) {
+      _analysisOptions = analysisOptions;
+    }
+    if (sourceFactory != null) {
+      _sourceFactory = sourceFactory;
+    }
+    _fillSalt();
+    _fsState = new FileSystemState(_logger, _byteStore, _contentOverlay,
+        _resourceProvider, _sourceFactory, _analysisOptions, _salt);
+    _filesToAnalyze.addAll(_addedFiles);
     _statusSupport.transitionToAnalyzing();
     _scheduler._notify(this);
   }
@@ -388,20 +496,17 @@
   }
 
   /**
-   * Return a [Future] that completes with the [IndexResult] for the file with
-   * the given [path].
+   * Return a [Future] that completes with the [AnalysisDriverUnitIndex] for
+   * the file with the given [path].
    */
-  Future<IndexResult> getIndex(String path) {
-    if (AnalysisEngine.isDartFileName(path)) {
-      var completer = new Completer<IndexResult>();
-      _indexRequestedFiles
-          .putIfAbsent(path, () => <Completer<IndexResult>>[])
-          .add(completer);
-      _statusSupport.transitionToAnalyzing();
-      _scheduler._notify(this);
-      return completer.future;
-    }
-    return new Future.value();
+  Future<AnalysisDriverUnitIndex> getIndex(String path) {
+    var completer = new Completer<AnalysisDriverUnitIndex>();
+    _indexRequestedFiles
+        .putIfAbsent(path, () => <Completer<AnalysisDriverUnitIndex>>[])
+        .add(completer);
+    _statusSupport.transitionToAnalyzing();
+    _scheduler._notify(this);
+    return completer.future;
   }
 
   /**
@@ -413,23 +518,58 @@
    *
    * The [path] can be any file - explicitly or implicitly analyzed, or neither.
    *
-   * Causes the analysis state to transition to "analyzing" (if it is not in
-   * that state already), the driver will read the file and produce the analysis
-   * result for it, which is consistent with the current file state (including
-   * the new state of the file), prior to the next time the analysis state
-   * transitions to "idle".
+   * If the driver has the cached analysis result for the file, it is returned.
+   *
+   * Otherwise causes the analysis state to transition to "analyzing" (if it is
+   * not in that state already), the driver will read the file and produce the
+   * analysis result for it, which is consistent with the current file state
+   * (including the new state of the file), prior to the next time the analysis
+   * state transitions to "idle".
    */
   Future<AnalysisResult> getResult(String path) {
-    if (AnalysisEngine.isDartFileName(path)) {
-      var completer = new Completer<AnalysisResult>();
-      _requestedFiles
-          .putIfAbsent(path, () => <Completer<AnalysisResult>>[])
-          .add(completer);
-      _statusSupport.transitionToAnalyzing();
-      _scheduler._notify(this);
-      return completer.future;
+    // Return the cached result.
+    {
+      AnalysisResult result = _priorityResults[path];
+      if (result != null) {
+        return new Future.value(result);
+      }
     }
-    return new Future.value();
+
+    // Schedule analysis.
+    var completer = new Completer<AnalysisResult>();
+    _requestedFiles
+        .putIfAbsent(path, () => <Completer<AnalysisResult>>[])
+        .add(completer);
+    _statusSupport.transitionToAnalyzing();
+    _scheduler._notify(this);
+    return completer.future;
+  }
+
+  /**
+   * Return a [Future] that completes with top-level declarations with the
+   * given [name] in all known libraries.
+   */
+  Future<List<TopLevelDeclarationInSource>> getTopLevelNameDeclarations(
+      String name) {
+    var task = new _TopLevelNameDeclarationsTask(this, name);
+    _topLevelNameDeclarationsTasks.add(task);
+    _statusSupport.transitionToAnalyzing();
+    _scheduler._notify(this);
+    return task.completer.future;
+  }
+
+  /**
+   * Return a [Future] that completes with the [CompilationUnitElement] for the
+   * file with the given [path].
+   */
+  Future<CompilationUnitElement> getUnitElement(String path) {
+    var completer = new Completer<CompilationUnitElement>();
+    _unitElementRequestedFiles
+        .putIfAbsent(path, () => <Completer<CompilationUnitElement>>[])
+        .add(completer);
+    _statusSupport.transitionToAnalyzing();
+    _scheduler._notify(this);
+    return completer.future;
   }
 
   /**
@@ -445,7 +585,7 @@
    * resolved unit).
    */
   Future<ParseResult> parseFile(String path) async {
-    FileState file = _fsState.getFileForPath(path);
+    FileState file = _verifyApiSignature(path);
     RecordingErrorListener listener = new RecordingErrorListener();
     CompilationUnit unit = file.parse(listener);
     return new ParseResult(file.path, file.uri, file.content, file.contentHash,
@@ -462,32 +602,22 @@
    * but does not guarantee this.
    */
   void removeFile(String path) {
-    _explicitFiles.remove(path);
+    _addedFiles.remove(path);
     _filesToAnalyze.remove(path);
+    _fsState.removeFile(path);
+    _filesToAnalyze.addAll(_addedFiles);
+    _priorityResults.clear();
+    _statusSupport.transitionToAnalyzing();
+    _scheduler._notify(this);
   }
 
   /**
-   * TODO(scheglov) see [_addToStoreUnlinked]
-   */
-  void _addToStoreLinked(
-      SummaryDataStore store, String uri, LinkedLibrary linked) {
-    store.linkedMap[uri] = linked;
-  }
-
-  /**
-   * TODO(scheglov) The existing [SummaryDataStore.addBundle] uses
-   * [PackageBundle.unlinkedUnitUris] to add [PackageBundle.unlinkedUnits].
-   * But we store unlinked bundles with the hash of the file content. This
-   * means that when two files are the same, but have different URIs, we
-   * add [UnlinkedUnit] with wrong URI.
+   * Return a future that will be completed the next time the status is idle.
    *
-   * We need to clean this up.
+   * If the status is currently idle, the returned future will be signaled
+   * immediately.
    */
-  void _addToStoreUnlinked(
-      SummaryDataStore store, Uri uri, UnlinkedUnit unlinked) {
-    String uriStr = uri.toString();
-    store.unlinkedMap[uriStr] = unlinked;
-  }
+  Future<Null> waitForIdle() => _statusSupport.waitForIdle();
 
   /**
    * Return the cached or newly computed analysis result of the file with the
@@ -529,7 +659,7 @@
       String key = _getResolvedUnitKey(libraryFile, file);
       List<int> bytes = _byteStore.get(key);
       if (bytes != null) {
-        return _getAnalysisResultFromBytes(libraryFile, file, bytes);
+        return _getAnalysisResultFromBytes(file, bytes);
       }
     }
 
@@ -546,7 +676,6 @@
       _LibraryContext libraryContext = _createLibraryContext(libraryFile);
       AnalysisContext analysisContext = _createAnalysisContext(libraryContext);
       try {
-        analysisContext.setContents(file.source, file.content);
         CompilationUnit resolvedUnit = analysisContext.resolveCompilationUnit2(
             file.source, libraryFile.source);
         List<AnalysisError> errors = analysisContext.computeErrors(file.source);
@@ -572,49 +701,54 @@
 
         // Return the result, full or partial.
         _logger.writeln('Computed new analysis result.');
-        return _getAnalysisResultFromBytes(libraryFile, file, bytes,
+        AnalysisResult result = _getAnalysisResultFromBytes(file, bytes,
             content: withUnit ? file.content : null,
+            withErrors: _addedFiles.contains(path),
             resolvedUnit: withUnit ? resolvedUnit : null);
+        if (withUnit && _priorityFiles.contains(path)) {
+          _priorityResults[path] = result;
+        }
+        return result;
       } finally {
         analysisContext.dispose();
       }
     });
   }
 
-  IndexResult _computeIndexResult(String path) {
+  AnalysisDriverUnitIndex _computeIndex(String path) {
     AnalysisResult analysisResult = _computeAnalysisResult(path,
         withUnit: false, asIsIfPartWithoutLibrary: true);
-    FileState libraryFile = analysisResult._libraryFile;
-    FileState file = analysisResult._file;
+    return analysisResult._index;
+  }
+
+  CompilationUnitElement _computeUnitElement(String path) {
+    FileState file = _fsState.getFileForPath(path);
+    FileState libraryFile = file.library ?? file;
 
     // Create the AnalysisContext to resynthesize elements in.
     _LibraryContext libraryContext = _createLibraryContext(libraryFile);
     AnalysisContext analysisContext = _createAnalysisContext(libraryContext);
 
     // Resynthesize the CompilationUnitElement in the context.
-    CompilationUnitElement unitElement;
     try {
-      unitElement = analysisContext.computeResult(
+      return analysisContext.computeResult(
           new LibrarySpecificUnit(libraryFile.source, file.source),
           COMPILATION_UNIT_ELEMENT);
     } finally {
       analysisContext.dispose();
     }
-
-    // Return as IndexResult.
-    return new IndexResult(unitElement, analysisResult._index);
   }
 
   AnalysisContext _createAnalysisContext(_LibraryContext libraryContext) {
     AnalysisContextImpl analysisContext =
         AnalysisEngine.instance.createAnalysisContext();
-    analysisContext.analysisOptions = analysisOptions;
-
-    analysisContext.sourceFactory = sourceFactory.clone();
+    analysisContext.useSdkCachePartition = false;
+    analysisContext.analysisOptions = _analysisOptions;
+    analysisContext.declaredVariables.addAll(declaredVariables);
+    analysisContext.sourceFactory = _sourceFactory.clone();
+    analysisContext.contentCache = new _ContentCacheWrapper(_fsState);
     analysisContext.resultProvider =
         new InputPackagesResultProvider(analysisContext, libraryContext.store);
-    analysisContext
-        .applyChanges(new ChangeSet()..addedSource(libraryContext.file.source));
     return analysisContext;
   }
 
@@ -625,27 +759,26 @@
     return _logger.run('Create library context', () {
       Map<String, FileState> libraries = <String, FileState>{};
       SummaryDataStore store = new SummaryDataStore(const <String>[]);
-      store.addBundle(null, _sdkBundle);
+
+      if (_sdkBundle != null) {
+        store.addBundle(null, _sdkBundle);
+      }
 
       void appendLibraryFiles(FileState library) {
-        // URIs with the 'dart:' scheme are served from the SDK bundle.
-        if (library.uri.scheme == 'dart') {
-          return null;
-        }
-
         if (!libraries.containsKey(library.uriStr)) {
+          // Serve 'dart:' URIs from the SDK bundle.
+          if (_sdkBundle != null && library.uri.scheme == 'dart') {
+            return;
+          }
+
           libraries[library.uriStr] = library;
 
           // Append the defining unit.
-          {
-            UnlinkedUnit unlinked = library.unlinked;
-            _addToStoreUnlinked(store, library.uri, unlinked);
-          }
+          store.addUnlinkedUnit(library.uriStr, library.unlinked);
 
           // Append parts.
           for (FileState part in library.partedFiles) {
-            UnlinkedUnit unlinked = part.unlinked;
-            _addToStoreUnlinked(store, part.uri, unlinked);
+            store.addUnlinkedUnit(part.uriStr, part.unlinked);
           }
 
           // Append referenced libraries.
@@ -661,13 +794,15 @@
       Set<String> libraryUrisToLink = new Set<String>();
       _logger.run('Load linked bundles', () {
         for (FileState library in libraries.values) {
-          String key = '${library.transitiveSignature}.linked';
-          List<int> bytes = _byteStore.get(key);
-          if (bytes != null) {
-            LinkedLibrary linked = new LinkedLibrary.fromBuffer(bytes);
-            _addToStoreLinked(store, library.uriStr, linked);
-          } else {
-            libraryUrisToLink.add(library.uriStr);
+          if (library.exists) {
+            String key = '${library.transitiveSignature}.linked';
+            List<int> bytes = _byteStore.get(key);
+            if (bytes != null) {
+              LinkedLibrary linked = new LinkedLibrary.fromBuffer(bytes);
+              store.addLinkedLibrary(library.uriStr, linked);
+            } else {
+              libraryUrisToLink.add(library.uriStr);
+            }
           }
         }
         int numOfLoaded = libraries.length - libraryUrisToLink.length;
@@ -682,7 +817,7 @@
         }, (String uri) {
           UnlinkedUnit unlinkedUnit = store.unlinkedMap[uri];
           return unlinkedUnit;
-        }, (_) => null, analysisOptions.strongMode);
+        }, (_) => null, _analysisOptions.strongMode);
         _logger.writeln('Linked ${linkedLibraries.length} bundles.');
       });
 
@@ -691,7 +826,7 @@
         String key = '${library.transitiveSignature}.linked';
         List<int> bytes = linkedBuilder.toBuffer();
         LinkedLibrary linked = new LinkedLibrary.fromBuffer(bytes);
-        _addToStoreLinked(store, uri, linked);
+        store.addLinkedLibrary(uri, linked);
         _byteStore.put(key, bytes);
       });
 
@@ -704,9 +839,8 @@
    */
   void _fillSalt() {
     _salt[0] = DATA_VERSION;
-    List<int> crossContextOptions = analysisOptions.encodeCrossContextOptions();
-    assert(crossContextOptions.length ==
-        AnalysisOptions.crossContextOptionsLength);
+    List<int> crossContextOptions = _analysisOptions.signature;
+    assert(crossContextOptions.length == AnalysisOptions.signatureLength);
     for (int i = 0; i < crossContextOptions.length; i++) {
       _salt[i + 1] = crossContextOptions[i];
     }
@@ -716,25 +850,18 @@
    * Load the [AnalysisResult] for the given [file] from the [bytes]. Set
    * optional [content] and [resolvedUnit].
    */
-  AnalysisResult _getAnalysisResultFromBytes(
-      FileState libraryFile, FileState file, List<int> bytes,
-      {String content, CompilationUnit resolvedUnit}) {
+  AnalysisResult _getAnalysisResultFromBytes(FileState file, List<int> bytes,
+      {String content, bool withErrors: true, CompilationUnit resolvedUnit}) {
     var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes);
-    List<AnalysisError> errors = unit.errors.map((error) {
-      String errorName = error.uniqueName;
-      ErrorCode errorCode = errorCodeByUniqueName(errorName);
-      if (errorCode == null) {
-        throw new StateError('No ErrorCode for $errorName in $file');
-      }
-      return new AnalysisError.forValues(file.source, error.offset,
-          error.length, errorCode, error.message, error.correction);
-    }).toList();
+    List<AnalysisError> errors = withErrors
+        ? _getErrorsFromSerialized(file, unit.errors)
+        : const <AnalysisError>[];
     return new AnalysisResult(
-        libraryFile,
-        file,
-        sourceFactory,
+        this,
+        _sourceFactory,
         file.path,
         file.uri,
+        file.exists,
         content,
         file.contentHash,
         file.lineInfo,
@@ -744,6 +871,26 @@
   }
 
   /**
+   * Return [AnalysisError]s for the given [serialized] errors.
+   */
+  List<AnalysisError> _getErrorsFromSerialized(
+      FileState file, List<AnalysisDriverUnitError> serialized) {
+    return serialized.map((error) {
+      String errorName = error.uniqueName;
+      ErrorCode errorCode =
+          errorCodeByUniqueName(errorName) ?? _lintCodeByUniqueName(errorName);
+      if (errorCode == null) {
+        // This could fail because the error code is no longer defined, or, in
+        // the case of a lint rule, if the lint rule has been disabled since the
+        // errors were written.
+        throw new StateError('No ErrorCode for $errorName in $file');
+      }
+      return new AnalysisError.forValues(file.source, error.offset,
+          error.length, errorCode, error.message, error.correction);
+    }).toList();
+  }
+
+  /**
    * Return the key to store fully resolved results for the [file] in the
    * [library] into the cache. Return `null` if the dependency signature is
    * not known yet.
@@ -757,43 +904,82 @@
   }
 
   /**
+   * Return the lint code with the given [errorName], or `null` if there is no
+   * lint registered with that name or the lint is not enabled in the analysis
+   * options.
+   */
+  ErrorCode _lintCodeByUniqueName(String errorName) {
+    if (errorName.startsWith('_LintCode.')) {
+      String lintName = errorName.substring(10);
+      List<Linter> lintRules = _analysisOptions.lintRules;
+      for (Linter linter in lintRules) {
+        if (linter.name == lintName) {
+          return linter.lintCode;
+        }
+      }
+    }
+    return null;
+  }
+
+  /**
    * Perform a single chunk of work and produce [results].
    */
   Future<Null> _performWork() async {
     // Verify all changed files one at a time.
     if (_changedFiles.isNotEmpty) {
       String path = _removeFirst(_changedFiles);
-      _verifyApiSignature(path);
+      // If the file has not been accessed yet, we either will eventually read
+      // it later while analyzing one of the added files, or don't need it.
+      if (_fsState.knownFilePaths.contains(path)) {
+        _verifyApiSignature(path);
+      }
       return;
     }
 
     // Analyze a requested file.
     if (_requestedFiles.isNotEmpty) {
       String path = _requestedFiles.keys.first;
-      AnalysisResult result = _computeAnalysisResult(path, withUnit: true);
-      // If a part without a library, delay its analysis.
-      if (result == null) {
-        _requestedParts
-            .putIfAbsent(path, () => [])
-            .addAll(_requestedFiles.remove(path));
-        return;
+      try {
+        AnalysisResult result = _computeAnalysisResult(path, withUnit: true);
+        // If a part without a library, delay its analysis.
+        if (result == null) {
+          _requestedParts
+              .putIfAbsent(path, () => [])
+              .addAll(_requestedFiles.remove(path));
+          return;
+        }
+        // Notify the completers.
+        _requestedFiles.remove(path).forEach((completer) {
+          completer.complete(result);
+        });
+        // Remove from to be analyzed and produce it now.
+        _filesToAnalyze.remove(path);
+        _resultController.add(result);
+      } catch (exception, stackTrace) {
+        _filesToAnalyze.remove(path);
+        _requestedFiles.remove(path).forEach((completer) {
+          completer.completeError(exception, stackTrace);
+        });
       }
-      // Notify the completers.
-      _requestedFiles.remove(path).forEach((completer) {
-        completer.complete(result);
-      });
-      // Remove from to be analyzed and produce it now.
-      _filesToAnalyze.remove(path);
-      _resultController.add(result);
       return;
     }
 
     // Process an index request.
     if (_indexRequestedFiles.isNotEmpty) {
       String path = _indexRequestedFiles.keys.first;
-      IndexResult result = _computeIndexResult(path);
+      AnalysisDriverUnitIndex index = _computeIndex(path);
       _indexRequestedFiles.remove(path).forEach((completer) {
-        completer.complete(result);
+        completer.complete(index);
+      });
+      return;
+    }
+
+    // Process a unit request.
+    if (_unitElementRequestedFiles.isNotEmpty) {
+      String path = _unitElementRequestedFiles.keys.first;
+      CompilationUnitElement unitElement = _computeUnitElement(path);
+      _unitElementRequestedFiles.remove(path).forEach((completer) {
+        completer.complete(unitElement);
       });
       return;
     }
@@ -808,15 +994,30 @@
       return;
     }
 
+    // Compute top-level declarations.
+    if (_topLevelNameDeclarationsTasks.isNotEmpty) {
+      _TopLevelNameDeclarationsTask task = _topLevelNameDeclarationsTasks.first;
+      bool isDone = await task.perform();
+      if (isDone) {
+        _topLevelNameDeclarationsTasks.remove(task);
+      }
+      return;
+    }
+
     // Analyze a priority file.
     if (_priorityFiles.isNotEmpty) {
       for (String path in _priorityFiles) {
         if (_filesToAnalyze.remove(path)) {
-          AnalysisResult result = _computeAnalysisResult(path, withUnit: true);
-          if (result == null) {
-            _partsToAnalyze.add(path);
-          } else {
-            _resultController.add(result);
+          try {
+            AnalysisResult result =
+                _computeAnalysisResult(path, withUnit: true);
+            if (result == null) {
+              _partsToAnalyze.add(path);
+            } else {
+              _resultController.add(result);
+            }
+          } catch (exception, stackTrace) {
+            _reportError(path, exception, stackTrace);
           }
           return;
         }
@@ -826,11 +1027,15 @@
     // Analyze a general file.
     if (_filesToAnalyze.isNotEmpty) {
       String path = _removeFirst(_filesToAnalyze);
-      AnalysisResult result = _computeAnalysisResult(path, withUnit: false);
-      if (result == null) {
-        _partsToAnalyze.add(path);
-      } else {
-        _resultController.add(result);
+      try {
+        AnalysisResult result = _computeAnalysisResult(path, withUnit: false);
+        if (result == null) {
+          _partsToAnalyze.add(path);
+        } else {
+          _resultController.add(result);
+        }
+      } catch (exception, stackTrace) {
+        _reportError(path, exception, stackTrace);
       }
       return;
     }
@@ -838,29 +1043,45 @@
     // Analyze a requested part file.
     if (_requestedParts.isNotEmpty) {
       String path = _requestedParts.keys.first;
-      AnalysisResult result = _computeAnalysisResult(path,
-          withUnit: true, asIsIfPartWithoutLibrary: true);
-      // Notify the completers.
-      _requestedParts.remove(path).forEach((completer) {
-        completer.complete(result);
-      });
-      // Remove from to be analyzed and produce it now.
-      _filesToAnalyze.remove(path);
-      _resultController.add(result);
+      try {
+        AnalysisResult result = _computeAnalysisResult(path,
+            withUnit: true, asIsIfPartWithoutLibrary: true);
+        // Notify the completers.
+        _requestedParts.remove(path).forEach((completer) {
+          completer.complete(result);
+        });
+        // Remove from to be analyzed and produce it now.
+        _partsToAnalyze.remove(path);
+        _resultController.add(result);
+      } catch (exception, stackTrace) {
+        _partsToAnalyze.remove(path);
+        _requestedParts.remove(path).forEach((completer) {
+          completer.completeError(exception, stackTrace);
+        });
+      }
       return;
     }
 
     // Analyze a general part.
     if (_partsToAnalyze.isNotEmpty) {
       String path = _removeFirst(_partsToAnalyze);
-      AnalysisResult result = _computeAnalysisResult(path,
-          withUnit: _priorityFiles.contains(path),
-          asIsIfPartWithoutLibrary: true);
-      _resultController.add(result);
+      try {
+        AnalysisResult result = _computeAnalysisResult(path,
+            withUnit: _priorityFiles.contains(path),
+            asIsIfPartWithoutLibrary: true);
+        _resultController.add(result);
+      } catch (exception, stackTrace) {
+        _reportError(path, exception, stackTrace);
+      }
       return;
     }
   }
 
+  void _reportError(String path, exception, StackTrace stackTrace) {
+    CaughtException caught = new CaughtException(exception, stackTrace);
+    _exceptionController.add(new ExceptionResult(path, caught));
+  }
+
   /**
    * Verify the API signature for the file with the given [path], and decide
    * which linked libraries should be invalidated, and files reanalyzed.
@@ -878,7 +1099,7 @@
       if (anyApiChanged) {
         _logger.writeln('API signatures mismatch found for $path');
         // TODO(scheglov) schedule analysis of only affected files
-        _filesToAnalyze.addAll(_explicitFiles);
+        _filesToAnalyze.addAll(_addedFiles);
       }
       return files[0];
     });
@@ -899,20 +1120,34 @@
  * of the list, the earlier the corresponding [AnalysisDriver] should be asked
  * to perform work.
  */
-enum AnalysisDriverPriority {
-  nothing,
-  general,
-  priority,
-  referencingName,
-  getIndex,
-  interactive
-}
+enum AnalysisDriverPriority { nothing, general, priority, interactive }
 
 /**
  * Instances of this class schedule work in multiple [AnalysisDriver]s so that
  * work with the highest priority is performed first.
  */
 class AnalysisDriverScheduler {
+  /**
+   * Time interval in milliseconds before pumping the event queue.
+   *
+   * Relinquishing execution flow and running the event loop after every task
+   * has too much overhead. Instead we use a fixed length of time, so we can
+   * spend less time overall and still respond quickly enough.
+   */
+  static const int _MS_BEFORE_PUMPING_EVENT_QUEUE = 2;
+
+  /**
+   * Event queue pumping is required to allow IO and other asynchronous data
+   * processing while analysis is active. For example Analysis Server needs to
+   * be able to process `updateContent` or `setPriorityFiles` requests while
+   * background analysis is in progress.
+   *
+   * The number of pumpings is arbitrary, might be changed if we see that
+   * analysis or other data processing tasks are starving. Ideally we would
+   * need to run all asynchronous operations using a single global scheduler.
+   */
+  static const int _NUMBER_OF_EVENT_QUEUE_PUMPINGS = 128;
+
   final PerformanceLog _logger;
   final List<AnalysisDriver> _drivers = [];
   final Monitor _hasWork = new Monitor();
@@ -923,11 +1158,28 @@
   AnalysisDriverScheduler(this._logger);
 
   /**
+   * Return `true` if we are currently analyzing code.
+   */
+  bool get isAnalyzing => _hasFilesToAnalyze;
+
+  /**
    * Return the stream that produces [AnalysisStatus] events.
    */
   Stream<AnalysisStatus> get status => _statusSupport.stream;
 
   /**
+   * Return `true` if there is a driver with a file to analyze.
+   */
+  bool get _hasFilesToAnalyze {
+    for (AnalysisDriver driver in _drivers) {
+      if (driver.hasFilesToAnalyze) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
    * Start the scheduler, so that any [AnalysisDriver] created before or
    * after will be asked to perform work.
    */
@@ -944,7 +1196,6 @@
    */
   void _add(AnalysisDriver driver) {
     _drivers.add(driver);
-    _statusSupport.transitionToAnalyzing();
     _hasWork.notify();
   }
 
@@ -953,7 +1204,6 @@
    * perform some work.
    */
   void _notify(AnalysisDriver driver) {
-    _statusSupport.transitionToAnalyzing();
     _hasWork.notify();
   }
 
@@ -963,7 +1213,6 @@
    */
   void _remove(AnalysisDriver driver) {
     _drivers.remove(driver);
-    _statusSupport.transitionToAnalyzing();
     _hasWork.notify();
   }
 
@@ -972,23 +1221,21 @@
    * priority first.
    */
   Future<Null> _run() async {
+    Stopwatch timer = new Stopwatch()..start();
     PerformanceLogSection analysisSection;
     while (true) {
-      // Pump the event queue to allow IO and other asynchronous data
-      // processing while analysis is active. For example Analysis Server
-      // needs to be able to process `updateContent` or `setPriorityFiles`
-      // requests while background analysis is in progress.
-      //
-      // The number of pumpings is arbitrary, might be changed if we see that
-      // analysis or other data processing tasks are starving. Ideally we
-      // would need to be able to set priority of (continuous) asynchronous
-      // tasks.
-      await _pumpEventQueue(128);
+      // Pump the event queue.
+      if (timer.elapsedMilliseconds > _MS_BEFORE_PUMPING_EVENT_QUEUE) {
+        await _pumpEventQueue(_NUMBER_OF_EVENT_QUEUE_PUMPINGS);
+        timer.reset();
+      }
 
       await _hasWork.signal;
 
-      if (analysisSection == null) {
-        analysisSection = _logger.enter('Analyzing');
+      // Transition to analyzing if there are files to analyze.
+      if (_hasFilesToAnalyze) {
+        _statusSupport.transitionToAnalyzing();
+        analysisSection ??= _logger.enter('Analyzing');
       }
 
       // Find the driver with the highest priority.
@@ -1002,11 +1249,15 @@
         }
       }
 
+      // Transition to idle if no files to analyze.
+      if (!_hasFilesToAnalyze) {
+        _statusSupport.transitionToIdle();
+        analysisSection?.exit();
+        analysisSection = null;
+      }
+
       // Continue to sleep if no work to do.
       if (bestPriority == AnalysisDriverPriority.nothing) {
-        analysisSection.exit();
-        analysisSection = null;
-        _statusSupport.transitionToIdle();
         continue;
       }
 
@@ -1030,6 +1281,17 @@
   }
 }
 
+@visibleForTesting
+class AnalysisDriverTestView {
+  final AnalysisDriver driver;
+
+  AnalysisDriverTestView(this.driver);
+
+  Set<String> get filesToAnalyze => driver._filesToAnalyze;
+
+  Map<String, AnalysisResult> get priorityResults => driver._priorityResults;
+}
+
 /**
  * The result of analyzing of a single file.
  *
@@ -1042,8 +1304,10 @@
  * any previously returned result, even inside of the same library.
  */
 class AnalysisResult {
-  final FileState _libraryFile;
-  final FileState _file;
+  /**
+   * The [AnalysisDriver] that produced this result.
+   */
+  final AnalysisDriver driver;
 
   /**
    * The [SourceFactory] with which the file was analyzed.
@@ -1063,6 +1327,11 @@
   final Uri uri;
 
   /**
+   * Return `true` if the file exists.
+   */
+  final bool exists;
+
+  /**
    * The content of the file that was scanned, parsed and resolved.
    */
   final String content;
@@ -1093,11 +1362,11 @@
   final AnalysisDriverUnitIndex _index;
 
   AnalysisResult(
-      this._libraryFile,
-      this._file,
+      this.driver,
       this.sourceFactory,
       this.path,
       this.uri,
+      this.exists,
       this.content,
       this.contentHash,
       this.lineInfo,
@@ -1107,20 +1376,22 @@
 }
 
 /**
- * The result of indexing of a single file.
+ * Exception that happened during analysis.
  */
-class IndexResult {
+class ExceptionResult {
   /**
-   * The element of the file.
+   * The path of the file being analyzed when the [exception] happened.
+   *
+   * Absolute and normalized.
    */
-  final CompilationUnitElement unitElement;
+  final String path;
 
   /**
-   * The index of the file.
+   * The exception during analysis of the file with the [path].
    */
-  final AnalysisDriverUnitIndex index;
+  final CaughtException exception;
 
-  IndexResult(this.unitElement, this.index);
+  ExceptionResult(this.path, this.exception);
 }
 
 /**
@@ -1212,11 +1483,13 @@
   }
 
   /**
-   * Write a new line into the log
+   * Write a new line into the log.
    */
   void writeln(String msg) {
-    String indent = '\t' * _level;
-    sink.writeln('$indent$msg');
+    if (sink != null) {
+      String indent = '\t' * _level;
+      sink.writeln('$indent$msg');
+    }
   }
 }
 
@@ -1245,11 +1518,58 @@
 }
 
 /**
+ * [ContentCache] wrapper around [FileContentOverlay].
+ */
+class _ContentCacheWrapper implements ContentCache {
+  final FileSystemState fsState;
+
+  _ContentCacheWrapper(this.fsState);
+
+  @override
+  void accept(ContentCacheVisitor visitor) {
+    throw new UnimplementedError();
+  }
+
+  @override
+  String getContents(Source source) {
+    return _getFileForSource(source).content;
+  }
+
+  @override
+  bool getExists(Source source) {
+    if (source.isInSystemLibrary) {
+      return true;
+    }
+    return _getFileForSource(source).exists;
+  }
+
+  @override
+  int getModificationStamp(Source source) {
+    if (source.isInSystemLibrary) {
+      return 0;
+    }
+    return _getFileForSource(source).exists ? 0 : -1;
+  }
+
+  @override
+  String setContents(Source source, String contents) {
+    throw new UnimplementedError();
+  }
+
+  FileState _getFileForSource(Source source) {
+    String path = source.fullName;
+    return fsState.getFileForPath(path);
+  }
+}
+
+/**
  * Task that computes the list of files that were added to the driver and
  * have at least one reference to an identifier [name] defined outside of the
  * file.
  */
 class _FilesReferencingNameTask {
+  static const int _MS_WORK_INTERVAL = 5;
+
   final AnalysisDriver driver;
   final String name;
   final Completer<List<String>> completer = new Completer<List<String>>();
@@ -1261,17 +1581,18 @@
   _FilesReferencingNameTask(this.driver, this.name);
 
   /**
-   * Perform work for a fixed length of time, and either complete the
-   * [completer] and return `true` to indicate that the task is done, return
-   * `false` to indicate that the task should continue to be run.
+   * Perform work for a fixed length of time, and complete the [completer] to
+   * either return `true` to indicate that the task is done, or return `false`
+   * to indicate that the task should continue to be run.
    *
-   * Relinquishing execution flow and running event loop after every file
-   * works, but has too much overhead. Instead we use a fixed length of time,
-   * so we can spend less time overall and keep quick enough response time.
+   * Each invocation of an asynchronous method has overhead, which looks as
+   * `_SyncCompleter.complete` invocation, we see as much as 62% in some
+   * scenarios. Instead we use a fixed length of time, so we can spend less time
+   * overall and keep quick enough response time.
    */
   Future<bool> perform() async {
     Stopwatch timer = new Stopwatch()..start();
-    while (timer.elapsedMilliseconds < 5) {
+    while (timer.elapsedMilliseconds < _MS_WORK_INTERVAL) {
       // Prepare files to check.
       if (filesToCheck.isEmpty) {
         Set<String> newFiles = driver.addedFiles.difference(checkedFiles);
@@ -1306,3 +1627,64 @@
   final SummaryDataStore store;
   _LibraryContext(this.file, this.store);
 }
+
+/**
+ * Task that computes top-level declarations for a certain name in all
+ * known libraries.
+ */
+class _TopLevelNameDeclarationsTask {
+  final AnalysisDriver driver;
+  final String name;
+  final Completer<List<TopLevelDeclarationInSource>> completer =
+      new Completer<List<TopLevelDeclarationInSource>>();
+
+  final List<TopLevelDeclarationInSource> libraryDeclarations =
+      <TopLevelDeclarationInSource>[];
+  final Set<String> checkedFiles = new Set<String>();
+  final List<String> filesToCheck = <String>[];
+
+  _TopLevelNameDeclarationsTask(this.driver, this.name);
+
+  /**
+   * Perform a single piece of work, and either complete the [completer] and
+   * return `true` to indicate that the task is done, return `false` to indicate
+   * that the task should continue to be run.
+   */
+  Future<bool> perform() async {
+    // Prepare files to check.
+    if (filesToCheck.isEmpty) {
+      filesToCheck.addAll(driver.addedFiles.difference(checkedFiles));
+      filesToCheck.addAll(driver.knownFiles.difference(checkedFiles));
+    }
+
+    // If no more files to check, complete and done.
+    if (filesToCheck.isEmpty) {
+      completer.complete(libraryDeclarations);
+      return true;
+    }
+
+    // Check the next file.
+    String path = filesToCheck.removeLast();
+    if (checkedFiles.add(path)) {
+      FileState file = driver._fsState.getFileForPath(path);
+      if (!file.isPart) {
+        bool isExported = false;
+        TopLevelDeclaration declaration = file.topLevelDeclarations[name];
+        for (FileState part in file.partedFiles) {
+          declaration ??= part.topLevelDeclarations[name];
+        }
+        if (declaration == null) {
+          declaration = file.exportedTopLevelDeclarations[name];
+          isExported = true;
+        }
+        if (declaration != null) {
+          libraryDeclarations.add(new TopLevelDeclarationInSource(
+              file.source, declaration, isExported));
+        }
+      }
+    }
+
+    // We're not done yet.
+    return false;
+  }
+}
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index 3a88ed6..eeb734a 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -12,6 +12,7 @@
 import 'package:analyzer/src/dart/analysis/byte_store.dart';
 import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/dart/analysis/referenced_names.dart';
+import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
 import 'package:analyzer/src/dart/scanner/reader.dart';
 import 'package:analyzer/src/dart/scanner/scanner.dart';
 import 'package:analyzer/src/generated/engine.dart';
@@ -22,6 +23,7 @@
 import 'package:analyzer/src/summary/api_signature.dart';
 import 'package:analyzer/src/summary/format.dart';
 import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary/name_filter.dart';
 import 'package:analyzer/src/summary/summarize_ast.dart';
 import 'package:analyzer/src/util/fast_uri.dart';
 import 'package:convert/convert.dart';
@@ -83,6 +85,7 @@
    */
   Source source;
 
+  bool _exists;
   String _content;
   String _contentHash;
   LineInfo _lineInfo;
@@ -93,10 +96,15 @@
   List<FileState> _importedFiles;
   List<FileState> _exportedFiles;
   List<FileState> _partedFiles;
+  List<NameFilter> _exportFilters;
+
   Set<FileState> _directReferencedFiles = new Set<FileState>();
   Set<FileState> _transitiveFiles;
   String _transitiveSignature;
 
+  Map<String, TopLevelDeclaration> _topLevelDeclarations;
+  Map<String, TopLevelDeclaration> _exportedTopLevelDeclarations;
+
   FileState._(this._fsState, this.path, this.uri, this.source);
 
   /**
@@ -121,10 +129,60 @@
   Set<FileState> get directReferencedFiles => _directReferencedFiles;
 
   /**
+   * Return `true` if the file exists.
+   */
+  bool get exists => _exists;
+
+  /**
    * The list of files this file exports.
    */
   List<FileState> get exportedFiles => _exportedFiles;
 
+  /**
+   * Return [TopLevelDeclaration]s exported from the this library file. The
+   * keys to the map are names of declarations.
+   */
+  Map<String, TopLevelDeclaration> get exportedTopLevelDeclarations {
+    if (_exportedTopLevelDeclarations == null) {
+      _exportedTopLevelDeclarations = <String, TopLevelDeclaration>{};
+
+      Set<FileState> seenLibraries = new Set<FileState>();
+
+      /**
+       * Compute [TopLevelDeclaration]s exported from the [library].
+       */
+      Map<String, TopLevelDeclaration> computeExported(FileState library) {
+        var declarations = <String, TopLevelDeclaration>{};
+        if (seenLibraries.add(library)) {
+          // Append the exported declarations.
+          for (int i = 0; i < library._exportedFiles.length; i++) {
+            Map<String, TopLevelDeclaration> exported =
+                computeExported(library._exportedFiles[i]);
+            for (TopLevelDeclaration t in exported.values) {
+              if (library._exportFilters[i].accepts(t.name)) {
+                declarations[t.name] = t;
+              }
+            }
+          }
+
+          // Append the library declarations.
+          declarations.addAll(library.topLevelDeclarations);
+          for (FileState part in library.partedFiles) {
+            declarations.addAll(part.topLevelDeclarations);
+          }
+
+          // We're done with this library.
+          seenLibraries.remove(library);
+        }
+
+        return declarations;
+      }
+
+      _exportedTopLevelDeclarations = computeExported(this);
+    }
+    return _exportedTopLevelDeclarations;
+  }
+
   @override
   int get hashCode => uri.hashCode;
 
@@ -168,6 +226,56 @@
   Set<String> get referencedNames => _referencedNames;
 
   /**
+   * Return public top-level declarations declared in the file. The keys to the
+   * map are names of declarations.
+   */
+  Map<String, TopLevelDeclaration> get topLevelDeclarations {
+    if (_topLevelDeclarations == null) {
+      _topLevelDeclarations = <String, TopLevelDeclaration>{};
+
+      void addDeclaration(TopLevelDeclarationKind kind, String name) {
+        if (!name.startsWith('_')) {
+          _topLevelDeclarations[name] = new TopLevelDeclaration(kind, name);
+        }
+      }
+
+      // Add types.
+      for (UnlinkedClass type in unlinked.classes) {
+        addDeclaration(TopLevelDeclarationKind.type, type.name);
+      }
+      for (UnlinkedEnum type in unlinked.enums) {
+        addDeclaration(TopLevelDeclarationKind.type, type.name);
+      }
+      for (UnlinkedTypedef type in unlinked.typedefs) {
+        addDeclaration(TopLevelDeclarationKind.type, type.name);
+      }
+      // Add functions and variables.
+      Set<String> addedVariableNames = new Set<String>();
+      for (UnlinkedExecutable executable in unlinked.executables) {
+        String name = executable.name;
+        if (executable.kind == UnlinkedExecutableKind.functionOrMethod) {
+          addDeclaration(TopLevelDeclarationKind.function, name);
+        } else if (executable.kind == UnlinkedExecutableKind.getter ||
+            executable.kind == UnlinkedExecutableKind.setter) {
+          if (executable.kind == UnlinkedExecutableKind.setter) {
+            name = name.substring(0, name.length - 1);
+          }
+          if (addedVariableNames.add(name)) {
+            addDeclaration(TopLevelDeclarationKind.variable, name);
+          }
+        }
+      }
+      for (UnlinkedVariable variable in unlinked.variables) {
+        String name = variable.name;
+        if (addedVariableNames.add(name)) {
+          addDeclaration(TopLevelDeclarationKind.variable, name);
+        }
+      }
+    }
+    return _topLevelDeclarations;
+  }
+
+  /**
    * Return the set of transitive files - the file itself and all of the
    * directly or indirectly referenced files.
    */
@@ -193,7 +301,6 @@
     if (_transitiveSignature == null) {
       ApiSignature signature = new ApiSignature();
       signature.addUint32List(_fsState._salt);
-      signature.addString(_fsState._sdkApiSignature);
       signature.addInt(transitiveFiles.length);
       transitiveFiles
           .map((file) => file.apiSignature)
@@ -232,6 +339,7 @@
     LineInfo lineInfo = new LineInfo(scanner.lineStarts);
 
     Parser parser = new Parser(source, errorListener);
+    parser.enableAssertInitializer = analysisOptions.enableAssertInitializer;
     parser.parseGenericMethodComments = analysisOptions.strongMode;
     CompilationUnit unit = parser.parseCompilationUnit(token);
     unit.lineInfo = lineInfo;
@@ -249,15 +357,10 @@
     try {
       _content = _fsState._contentOverlay[path];
       _content ??= _fsState._resourceProvider.getFile(path).readAsStringSync();
+      _exists = true;
     } catch (_) {
       _content = '';
-      // TODO(scheglov) We fail to report URI_DOES_NOT_EXIST.
-      // On one hand we need to provide an unlinked bundle to prevent
-      // analysis context from reading the file (we want it to work
-      // hermetically and handle one one file at a time). OTOH,
-      // ResynthesizerResultProvider happily reports that any source in the
-      // SummaryDataStore has MODIFICATION_TIME `0`. We need to return `-1`
-      // for missing files. Maybe add this feature to SummaryDataStore?
+      _exists = false;
     }
 
     // Compute the content hash.
@@ -298,18 +401,24 @@
     _referencedNames = new Set<String>.from(driverUnlinkedUnit.referencedNames);
     _unlinked = driverUnlinkedUnit.unit;
     _lineInfo = new LineInfo(_unlinked.lineStarts);
+    _topLevelDeclarations = null;
+
+    // Prepare API signature.
     List<int> newApiSignature = _unlinked.apiSignature;
     bool apiSignatureChanged = _apiSignature != null &&
         !_equalByteLists(_apiSignature, newApiSignature);
     _apiSignature = newApiSignature;
 
-    // If the API signature changed, flush transitive signatures.
+    // The API signature changed.
+    //   Flush transitive signatures of affected files.
+    //   Flush exported top-level declarations of all files.
     if (apiSignatureChanged) {
       for (FileState file in _fsState._uriToFile.values) {
         if (file._transitiveFiles != null &&
             file._transitiveFiles.contains(this)) {
           file._transitiveSignature = null;
         }
+        file._exportedTopLevelDeclarations = null;
       }
     }
 
@@ -324,36 +433,31 @@
     _importedFiles = <FileState>[];
     _exportedFiles = <FileState>[];
     _partedFiles = <FileState>[];
+    _exportFilters = <NameFilter>[];
     for (UnlinkedImport import in _unlinked.imports) {
-      if (!import.isImplicit) {
-        String uri = import.uri;
-        if (!_isDartUri(uri)) {
-          FileState file = _fileForRelativeUri(uri);
-          if (file != null) {
-            _importedFiles.add(file);
-          }
-        }
+      String uri = import.isImplicit ? 'dart:core' : import.uri;
+      FileState file = _fileForRelativeUri(uri);
+      if (file != null) {
+        _importedFiles.add(file);
       }
     }
     for (UnlinkedExportPublic export in _unlinked.publicNamespace.exports) {
       String uri = export.uri;
-      if (!_isDartUri(uri)) {
-        FileState file = _fileForRelativeUri(uri);
-        if (file != null) {
-          _exportedFiles.add(file);
-        }
+      FileState file = _fileForRelativeUri(uri);
+      if (file != null) {
+        _exportedFiles.add(file);
+        _exportFilters
+            .add(new NameFilter.forUnlinkedCombinators(export.combinators));
       }
     }
     for (String uri in _unlinked.publicNamespace.parts) {
-      if (!_isDartUri(uri)) {
-        FileState file = _fileForRelativeUri(uri);
-        if (file != null) {
-          _partedFiles.add(file);
-          // TODO(scheglov) Sort for stable results?
-          _fsState._partToLibraries
-              .putIfAbsent(file, () => <FileState>[])
-              .add(this);
-        }
+      FileState file = _fileForRelativeUri(uri);
+      if (file != null) {
+        _partedFiles.add(file);
+        // TODO(scheglov) Sort for stable results?
+        _fsState._partToLibraries
+            .putIfAbsent(file, () => <FileState>[])
+            .add(this);
       }
     }
 
@@ -411,10 +515,6 @@
     }
     return true;
   }
-
-  static bool _isDartUri(String uri) {
-    return uri.startsWith('dart:');
-  }
 }
 
 /**
@@ -428,7 +528,6 @@
   final SourceFactory _sourceFactory;
   final AnalysisOptions _analysisOptions;
   final Uint32List _salt;
-  final String _sdkApiSignature;
 
   /**
    * Mapping from a URI to the corresponding [FileState].
@@ -436,6 +535,11 @@
   final Map<Uri, FileState> _uriToFile = {};
 
   /**
+   * All known file paths.
+   */
+  final Set<String> knownFilePaths = new Set<String>();
+
+  /**
    * Mapping from a path to the corresponding [FileState]s, canonical or not.
    */
   final Map<String, List<FileState>> _pathToFiles = {};
@@ -459,15 +563,15 @@
       this._resourceProvider,
       this._sourceFactory,
       this._analysisOptions,
-      this._salt,
-      this._sdkApiSignature) {
+      this._salt) {
     _testView = new FileSystemStateTestView(this);
   }
 
   /**
-   * Return the set of known files.
+   * Return the known files.
    */
-  Set<String> get knownFiles => _pathToFiles.keys.toSet();
+  Iterable<FileState> get knownFiles =>
+      _pathToFiles.values.map((files) => files.first);
 
   @visibleForTesting
   FileSystemStateTestView get test => _testView;
@@ -488,7 +592,7 @@
       // Try to get the existing instance.
       file = _uriToFile[uri];
       // If we have a file, call it the canonical one and return it.
-      if (file != null) {
+      if (file != null && file.path == path) {
         _pathToCanonicalFile[path] = file;
         return file;
       }
@@ -496,7 +600,7 @@
       FileSource uriSource = new FileSource(resource, uri);
       file = new FileState._(this, path, uri, uriSource);
       _uriToFile[uri] = file;
-      _pathToFiles.putIfAbsent(path, () => <FileState>[]).add(file);
+      _addFileWithPath(path, file);
       _pathToCanonicalFile[path] = file;
       file.refresh();
     }
@@ -522,7 +626,7 @@
       FileSource source = new FileSource(resource, uri);
       file = new FileState._(this, path, uri, source);
       _uriToFile[uri] = file;
-      _pathToFiles.putIfAbsent(path, () => <FileState>[]).add(file);
+      _addFileWithPath(path, file);
       file.refresh();
     }
     return file;
@@ -542,6 +646,27 @@
       ..remove(canonicalFile)
       ..insert(0, canonicalFile);
   }
+
+  /**
+   * Remove the file with the given [path].
+   */
+  void removeFile(String path) {
+    _uriToFile.clear();
+    knownFilePaths.clear();
+    _pathToFiles.clear();
+    _pathToCanonicalFile.clear();
+    _partToLibraries.clear();
+  }
+
+  void _addFileWithPath(String path, FileState file) {
+    var files = _pathToFiles[path];
+    if (files == null) {
+      knownFilePaths.add(path);
+      files = <FileState>[];
+      _pathToFiles[path] = files;
+    }
+    files.add(file);
+  }
 }
 
 @visibleForTesting
diff --git a/pkg/analyzer/lib/src/dart/analysis/index.dart b/pkg/analyzer/lib/src/dart/analysis/index.dart
index 8c8c132..04d3359 100644
--- a/pkg/analyzer/lib/src/dart/analysis/index.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/index.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -505,7 +506,10 @@
   @override
   visitClassDeclaration(ClassDeclaration node) {
     if (node.extendsClause == null) {
-      ClassElement objectElement = node.element.supertype?.element;
+      ClassElement objectElement = resolutionMap
+          .elementDeclaredByClassDeclaration(node)
+          .supertype
+          ?.element;
       recordRelationOffset(objectElement, IndexRelationKind.IS_EXTENDED_BY,
           node.name.offset, 0, true);
     }
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index 8ca2f31..b733e19 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -9,10 +9,13 @@
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/visitor.dart';
 import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/dart/analysis/index.dart';
 import 'package:analyzer/src/dart/ast/utilities.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/member.dart';
+import 'package:analyzer/src/dart/resolver/scope.dart' show NamespaceBuilder;
+import 'package:analyzer/src/generated/utilities_dart.dart';
 import 'package:analyzer/src/summary/idl.dart';
 import 'package:collection/collection.dart';
 
@@ -31,6 +34,30 @@
   Search(this._driver);
 
   /**
+   * Returns class members with names matching the given [regExp].
+   */
+  Future<List<Element>> classMembers(RegExp regExp) async {
+    List<Element> elements = <Element>[];
+
+    void addElement(Element element) {
+      if (!element.isSynthetic && regExp.hasMatch(element.displayName)) {
+        elements.add(element);
+      }
+    }
+
+    for (FileState file in _driver.fsState.knownFiles) {
+      CompilationUnitElement unitElement =
+          await _driver.getUnitElement(file.path);
+      for (ClassElement clazz in unitElement.types) {
+        clazz.accessors.forEach(addElement);
+        clazz.fields.forEach(addElement);
+        clazz.methods.forEach(addElement);
+      }
+    }
+    return elements;
+  }
+
+  /**
    * Returns references to the [element].
    */
   Future<List<SearchResult>> references(Element element) async {
@@ -40,11 +67,12 @@
 
     ElementKind kind = element.kind;
     if (kind == ElementKind.CLASS ||
-        kind == ElementKind.COMPILATION_UNIT ||
         kind == ElementKind.CONSTRUCTOR ||
         kind == ElementKind.FUNCTION_TYPE_ALIAS ||
         kind == ElementKind.SETTER) {
       return _searchReferences(element);
+    } else if (kind == ElementKind.COMPILATION_UNIT) {
+      return _searchReferences_CompilationUnit(element);
     } else if (kind == ElementKind.GETTER) {
       return _searchReferences_Getter(element);
     } else if (kind == ElementKind.FIELD ||
@@ -55,9 +83,13 @@
         return _searchReferences_Local(element, (n) => n is Block);
       }
       return _searchReferences_Function(element);
+    } else if (kind == ElementKind.IMPORT) {
+      return _searchReferences_Import(element);
     } else if (kind == ElementKind.LABEL ||
         kind == ElementKind.LOCAL_VARIABLE) {
       return _searchReferences_Local(element, (n) => n is Block);
+    } else if (kind == ElementKind.LIBRARY) {
+      return _searchReferences_Library(element);
     } else if (kind == ElementKind.PARAMETER) {
       return _searchReferences_Parameter(element);
     } else if (kind == ElementKind.PREFIX) {
@@ -66,46 +98,165 @@
       return _searchReferences_Local(
           element, (n) => n.parent is CompilationUnit);
     }
-    // TODO(scheglov) support other kinds
     return const <SearchResult>[];
   }
 
+  /**
+   * Returns subtypes of the given [type].
+   */
+  Future<List<SearchResult>> subTypes(ClassElement type) async {
+    if (type == null) {
+      return const <SearchResult>[];
+    }
+    List<SearchResult> results = <SearchResult>[];
+    await _addResults(results, type, const {
+      IndexRelationKind.IS_EXTENDED_BY: SearchResultKind.REFERENCE,
+      IndexRelationKind.IS_MIXED_IN_BY: SearchResultKind.REFERENCE,
+      IndexRelationKind.IS_IMPLEMENTED_BY: SearchResultKind.REFERENCE
+    });
+    return results;
+  }
+
+  /**
+   * Returns top-level elements with names matching the given [regExp].
+   */
+  Future<List<Element>> topLevelElements(RegExp regExp) async {
+    List<Element> elements = <Element>[];
+
+    void addElement(Element element) {
+      if (!element.isSynthetic && regExp.hasMatch(element.displayName)) {
+        elements.add(element);
+      }
+    }
+
+    for (FileState file in _driver.fsState.knownFiles) {
+      CompilationUnitElement unitElement =
+          await _driver.getUnitElement(file.path);
+      unitElement.accessors.forEach(addElement);
+      unitElement.enums.forEach(addElement);
+      unitElement.functions.forEach(addElement);
+      unitElement.functionTypeAliases.forEach(addElement);
+      unitElement.topLevelVariables.forEach(addElement);
+      unitElement.types.forEach(addElement);
+    }
+    return elements;
+  }
+
+  /**
+   * Returns unresolved references to the given [name].
+   */
+  Future<List<SearchResult>> unresolvedMemberReferences(String name) async {
+    if (name == null) {
+      return const <SearchResult>[];
+    }
+
+    // Prepare the list of files that reference the name.
+    List<String> files = await _driver.getFilesReferencingName(name);
+
+    // Check the index of every file that references the element name.
+    List<SearchResult> results = [];
+    for (String file in files) {
+      AnalysisDriverUnitIndex index = await _driver.getIndex(file);
+      _IndexRequest request = new _IndexRequest(index);
+      var fileResults = await request.getUnresolvedMemberReferences(
+          name,
+          const {
+            IndexRelationKind.IS_READ_BY: SearchResultKind.READ,
+            IndexRelationKind.IS_WRITTEN_BY: SearchResultKind.WRITE,
+            IndexRelationKind.IS_READ_WRITTEN_BY: SearchResultKind.READ_WRITE,
+            IndexRelationKind.IS_INVOKED_BY: SearchResultKind.INVOCATION
+          },
+          () => _driver.getUnitElement(file));
+      results.addAll(fileResults);
+    }
+
+    return results;
+  }
+
   Future<Null> _addResults(List<SearchResult> results, Element element,
       Map<IndexRelationKind, SearchResultKind> relationToResultKind) async {
-    String path = element.source.fullName;
-
-    // If the file with the element is not known, then the element is not used.
-    if (!_driver.knownFiles.contains(path)) {
-      return;
+    // Prepare the element name.
+    String name = element.displayName;
+    if (element is ConstructorElement) {
+      name = element.enclosingElement.displayName;
     }
 
-    // TODO(scheglov) optimize for private elements
-    String name = element.displayName;
-
     // Prepare the list of files that reference the element name.
-    List<String> files = await _driver.getFilesReferencingName(name);
-    if (!files.contains(path) && _driver.addedFiles.contains(path)) {
-      files.add(path);
+    List<String> files = <String>[];
+    String path = element.source.fullName;
+    if (name.startsWith('_')) {
+      String libraryPath = element.library.source.fullName;
+      if (_driver.addedFiles.contains(libraryPath)) {
+        FileState library = _driver.fsState.getFileForPath(libraryPath);
+        List<FileState> candidates = [library]..addAll(library.partedFiles);
+        for (FileState file in candidates) {
+          if (file.path == path || file.referencedNames.contains(name)) {
+            files.add(file.path);
+          }
+        }
+      }
+    } else {
+      files = await _driver.getFilesReferencingName(name);
+      if (!files.contains(path) && _driver.addedFiles.contains(path)) {
+        files.add(path);
+      }
     }
 
     // Check the index of every file that references the element name.
     for (String file in files) {
-      IndexResult result = await _driver.getIndex(file);
-      _IndexRequest request = new _IndexRequest(result.index);
-      int elementId = request.findElementId(element);
-      if (elementId != -1) {
-        CompilationUnitElement unitElement = result.unitElement;
-        List<SearchResult> fileResults =
-            request.getRelations(elementId, relationToResultKind, unitElement);
-        results.addAll(fileResults);
-      }
+      await _addResultsInFile(results, element, relationToResultKind, file);
+    }
+  }
+
+  /**
+   * Add results for [element] usage in the given [file].
+   */
+  Future<Null> _addResultsInFile(
+      List<SearchResult> results,
+      Element element,
+      Map<IndexRelationKind, SearchResultKind> relationToResultKind,
+      String file) async {
+    AnalysisDriverUnitIndex index = await _driver.getIndex(file);
+    _IndexRequest request = new _IndexRequest(index);
+    int elementId = request.findElementId(element);
+    if (elementId != -1) {
+      List<SearchResult> fileResults = await request.getRelations(
+          elementId, relationToResultKind, () => _driver.getUnitElement(file));
+      results.addAll(fileResults);
     }
   }
 
   Future<List<SearchResult>> _searchReferences(Element element) async {
     List<SearchResult> results = <SearchResult>[];
     await _addResults(results, element,
-        {IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE});
+        const {IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE});
+    return results;
+  }
+
+  Future<List<SearchResult>> _searchReferences_CompilationUnit(
+      CompilationUnitElement element) async {
+    String path = element.source.fullName;
+
+    // If the path is not known, then the file is not referenced.
+    if (!_driver.fsState.knownFilePaths.contains(path)) {
+      return const <SearchResult>[];
+    }
+
+    // Check every file that references the given path.
+    List<SearchResult> results = <SearchResult>[];
+    for (FileState file in _driver.fsState.knownFiles) {
+      for (FileState referencedFile in file.directReferencedFiles) {
+        if (referencedFile.path == path) {
+          await _addResultsInFile(
+              results,
+              element,
+              const {
+                IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE
+              },
+              file.path);
+        }
+      }
+    }
     return results;
   }
 
@@ -115,20 +266,20 @@
     PropertyAccessorElement getter = field.getter;
     PropertyAccessorElement setter = field.setter;
     if (!field.isSynthetic) {
-      await _addResults(results, field, {
+      await _addResults(results, field, const {
         IndexRelationKind.IS_WRITTEN_BY: SearchResultKind.WRITE,
         IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE
       });
     }
     if (getter != null) {
-      await _addResults(results, getter, {
+      await _addResults(results, getter, const {
         IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.READ,
         IndexRelationKind.IS_INVOKED_BY: SearchResultKind.INVOCATION
       });
     }
     if (setter != null) {
       await _addResults(results, setter,
-          {IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.WRITE});
+          const {IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.WRITE});
     }
     return results;
   }
@@ -138,7 +289,7 @@
       element = (element as Member).baseElement;
     }
     List<SearchResult> results = <SearchResult>[];
-    await _addResults(results, element, {
+    await _addResults(results, element, const {
       IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE,
       IndexRelationKind.IS_INVOKED_BY: SearchResultKind.INVOCATION
     });
@@ -148,13 +299,62 @@
   Future<List<SearchResult>> _searchReferences_Getter(
       PropertyAccessorElement getter) async {
     List<SearchResult> results = <SearchResult>[];
-    await _addResults(results, getter, {
+    await _addResults(results, getter, const {
       IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE,
       IndexRelationKind.IS_INVOKED_BY: SearchResultKind.INVOCATION
     });
     return results;
   }
 
+  Future<List<SearchResult>> _searchReferences_Import(
+      ImportElement element) async {
+    // Search only in drivers to which the library was added.
+    String path = element.source.fullName;
+    if (!_driver.addedFiles.contains(path)) {
+      return const <SearchResult>[];
+    }
+
+    List<SearchResult> results = <SearchResult>[];
+    LibraryElement libraryElement = element.library;
+    for (CompilationUnitElement unitElement in libraryElement.units) {
+      String unitPath = unitElement.source.fullName;
+      AnalysisResult unitAnalysisResult = await _driver.getResult(unitPath);
+      _ImportElementReferencesVisitor visitor =
+          new _ImportElementReferencesVisitor(element, unitElement);
+      unitAnalysisResult.unit.accept(visitor);
+      results.addAll(visitor.results);
+    }
+    return results;
+  }
+
+  Future<List<SearchResult>> _searchReferences_Library(
+      LibraryElement element) async {
+    // Search only in drivers to which the library with the prefix was added.
+    String path = element.source.fullName;
+    if (!_driver.addedFiles.contains(path)) {
+      return const <SearchResult>[];
+    }
+
+    List<SearchResult> results = <SearchResult>[];
+    for (CompilationUnitElement unitElement in element.units) {
+      String unitPath = unitElement.source.fullName;
+      AnalysisResult unitAnalysisResult = await _driver.getResult(unitPath);
+      CompilationUnit unit = unitAnalysisResult.unit;
+      for (Directive directive in unit.directives) {
+        if (directive is PartOfDirective && directive.element == element) {
+          results.add(new SearchResult._(
+              unit.element,
+              SearchResultKind.REFERENCE,
+              directive.libraryName.offset,
+              directive.libraryName.length,
+              true,
+              false));
+        }
+      }
+    }
+    return results;
+  }
+
   Future<List<SearchResult>> _searchReferences_Local(
       Element element, bool isRootNode(AstNode n)) async {
     String path = element.source.fullName;
@@ -191,11 +391,13 @@
   Future<List<SearchResult>> _searchReferences_Parameter(
       ParameterElement parameter) async {
     List<SearchResult> results = <SearchResult>[];
-    results.addAll(await _searchReferences(parameter));
     results.addAll(await _searchReferences_Local(parameter, (AstNode node) {
       AstNode parent = node.parent;
       return parent is ClassDeclaration || parent is CompilationUnit;
     }));
+    if (parameter.parameterKind == ParameterKind.NAMED) {
+      results.addAll(await _searchReferences(parameter));
+    }
     return results;
   }
 
@@ -226,11 +428,6 @@
  */
 class SearchResult {
   /**
-   * The element that is used at this result.
-   */
-  final Element element;
-
-  /**
    * The deep most element that contains this result.
    */
   final Element enclosingElement;
@@ -260,8 +457,8 @@
    */
   final bool isQualified;
 
-  SearchResult._(this.element, this.enclosingElement, this.kind, this.offset,
-      this.length, this.isResolved, this.isQualified);
+  SearchResult._(this.enclosingElement, this.kind, this.offset, this.length,
+      this.isResolved, this.isQualified);
 
   @override
   String toString() {
@@ -309,6 +506,72 @@
   }
 }
 
+/**
+ * Visitor that adds [SearchResult]s for references to the [importElement].
+ */
+class _ImportElementReferencesVisitor extends RecursiveAstVisitor {
+  final List<SearchResult> results = <SearchResult>[];
+
+  final ImportElement importElement;
+  final CompilationUnitElement enclosingUnitElement;
+
+  Set<Element> importedElements;
+
+  _ImportElementReferencesVisitor(
+      ImportElement element, this.enclosingUnitElement)
+      : importElement = element {
+    importedElements = new NamespaceBuilder()
+        .createImportNamespaceForDirective(element)
+        .definedNames
+        .values
+        .toSet();
+  }
+
+  @override
+  visitExportDirective(ExportDirective node) {}
+
+  @override
+  visitImportDirective(ImportDirective node) {}
+
+  @override
+  visitSimpleIdentifier(SimpleIdentifier node) {
+    if (node.inDeclarationContext()) {
+      return;
+    }
+    if (importElement.prefix != null) {
+      if (node.staticElement == importElement.prefix) {
+        AstNode parent = node.parent;
+        if (parent is PrefixedIdentifier && parent.prefix == node) {
+          if (importedElements.contains(parent.staticElement)) {
+            _addResultForPrefix(node, parent.identifier);
+          }
+        }
+        if (parent is MethodInvocation && parent.target == node) {
+          if (importedElements.contains(parent.methodName.staticElement)) {
+            _addResultForPrefix(node, parent.methodName);
+          }
+        }
+      }
+    } else {
+      if (importedElements.contains(node.staticElement)) {
+        _addResult(node.offset, 0);
+      }
+    }
+  }
+
+  void _addResult(int offset, int length) {
+    Element enclosingElement =
+        _getEnclosingElement(enclosingUnitElement, offset);
+    results.add(new SearchResult._(enclosingElement, SearchResultKind.REFERENCE,
+        offset, length, true, false));
+  }
+
+  void _addResultForPrefix(SimpleIdentifier prefixNode, AstNode nextNode) {
+    int prefixOffset = prefixNode.offset;
+    _addResult(prefixOffset, nextNode.offset - prefixOffset);
+  }
+}
+
 class _IndexRequest {
   final AnalysisDriverUnitIndex index;
 
@@ -401,11 +664,15 @@
   /**
    * Return a list of results where an element with the given [elementId] has
    * a relation with the kind from [relationToResultKind].
+   *
+   * The function [getEnclosingUnitElement] is used to lazily compute the
+   * enclosing [CompilationUnitElement] if there is a relation of an
+   * interesting kind.
    */
-  List<SearchResult> getRelations(
+  Future<List<SearchResult>> getRelations(
       int elementId,
       Map<IndexRelationKind, SearchResultKind> relationToResultKind,
-      CompilationUnitElement enclosingUnitElement) {
+      Future<CompilationUnitElement> getEnclosingUnitElement()) async {
     // Find the first usage of the element.
     int i = _findFirstOccurrence(index.usedElements, elementId);
     if (i == -1) {
@@ -413,6 +680,7 @@
     }
     // Create locations for every usage of the element.
     List<SearchResult> results = <SearchResult>[];
+    CompilationUnitElement enclosingUnitElement = null;
     for (;
         i < index.usedElements.length && index.usedElements[i] == elementId;
         i++) {
@@ -420,10 +688,10 @@
       SearchResultKind resultKind = relationToResultKind[relationKind];
       if (resultKind != null) {
         int offset = index.usedElementOffsets[i];
+        enclosingUnitElement ??= await getEnclosingUnitElement();
         Element enclosingElement =
             _getEnclosingElement(enclosingUnitElement, offset);
         results.add(new SearchResult._(
-            null,
             enclosingElement,
             resultKind,
             offset,
@@ -467,6 +735,45 @@
   }
 
   /**
+   * Return a list of results where a class members with the given [name] is
+   * referenced with a qualifier, but is not resolved.
+   */
+  Future<List<SearchResult>> getUnresolvedMemberReferences(
+      String name,
+      Map<IndexRelationKind, SearchResultKind> relationToResultKind,
+      Future<CompilationUnitElement> getEnclosingUnitElement()) async {
+    // Find the name identifier.
+    int nameId = getStringId(name);
+    if (nameId == -1) {
+      return const <SearchResult>[];
+    }
+
+    // Find the first usage of the name.
+    int i = _findFirstOccurrence(index.usedNames, nameId);
+    if (i == -1) {
+      return const <SearchResult>[];
+    }
+
+    // Create results for every usage of the name.
+    List<SearchResult> results = <SearchResult>[];
+    CompilationUnitElement enclosingUnitElement = null;
+    for (; i < index.usedNames.length && index.usedNames[i] == nameId; i++) {
+      IndexRelationKind relationKind = index.usedNameKinds[i];
+      SearchResultKind resultKind = relationToResultKind[relationKind];
+      if (resultKind != null) {
+        int offset = index.usedNameOffsets[i];
+        enclosingUnitElement ??= await getEnclosingUnitElement();
+        Element enclosingElement =
+            _getEnclosingElement(enclosingUnitElement, offset);
+        results.add(new SearchResult._(enclosingElement, resultKind, offset,
+            name.length, false, index.usedNameIsQualifiedFlags[i]));
+      }
+    }
+
+    return results;
+  }
+
+  /**
    * Return the identifier of the [uri] in the [index] or `-1` if the [uri] is
    * not used in the [index].
    */
@@ -541,7 +848,7 @@
     bool isQualified = node.parent is Label;
     Element enclosingElement =
         _getEnclosingElement(enclosingUnitElement, node.offset);
-    results.add(new SearchResult._(element, enclosingElement, kind, node.offset,
-        node.length, true, isQualified));
+    results.add(new SearchResult._(
+        enclosingElement, kind, node.offset, node.length, true, isQualified));
   }
 }
diff --git a/pkg/analyzer/lib/src/dart/analysis/status.dart b/pkg/analyzer/lib/src/dart/analysis/status.dart
index 3e2d79c..e70de68 100644
--- a/pkg/analyzer/lib/src/dart/analysis/status.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/status.dart
@@ -24,6 +24,9 @@
    * Return `true` is the driver is idle.
    */
   bool get isIdle => !_analyzing;
+
+  @override
+  String toString() => _analyzing ? 'analyzing' : 'idle';
 }
 
 /**
@@ -70,6 +73,17 @@
   AnalysisStatus _currentStatus = AnalysisStatus.IDLE;
 
   /**
+   * If non-null, a completer which should be completed on the next transition
+   * to idle.
+   */
+  Completer<Null> _idleCompleter;
+
+  /**
+   * Return the last status sent to the [stream].
+   */
+  AnalysisStatus get currentStatus => _currentStatus;
+
+  /**
    * Return the stream that produces [AnalysisStatus] events.
    */
   Stream<AnalysisStatus> get stream => _statusController.stream;
@@ -91,6 +105,23 @@
     if (_currentStatus != AnalysisStatus.IDLE) {
       _currentStatus = AnalysisStatus.IDLE;
       _statusController.add(AnalysisStatus.IDLE);
+      _idleCompleter?.complete();
+      _idleCompleter = null;
+    }
+  }
+
+  /**
+   * Return a future that will be completed the next time the status is idle.
+   *
+   * If the status is currently idle, the returned future will be signaled
+   * immediately.
+   */
+  Future<Null> waitForIdle() {
+    if (_currentStatus == AnalysisStatus.IDLE) {
+      return new Future.value();
+    } else {
+      _idleCompleter ??= new Completer<Null>();
+      return _idleCompleter.future;
     }
   }
 }
diff --git a/pkg/analyzer/lib/src/dart/analysis/top_level_declaration.dart b/pkg/analyzer/lib/src/dart/analysis/top_level_declaration.dart
new file mode 100644
index 0000000..8f1d640
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/analysis/top_level_declaration.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/base/source.dart';
+
+/**
+ * Information about a single top-level declaration.
+ */
+class TopLevelDeclaration {
+  final TopLevelDeclarationKind kind;
+  final String name;
+
+  TopLevelDeclaration(this.kind, this.name);
+
+  @override
+  String toString() => '($kind, $name)';
+}
+
+/**
+ * A declaration in a source.
+ */
+class TopLevelDeclarationInSource {
+  /**
+   * The declaring source.
+   */
+  final Source source;
+
+  /**
+   * The declaration.
+   */
+  final TopLevelDeclaration declaration;
+
+  /**
+   * Is `true` if the [declaration] is exported, not declared in the [source].
+   */
+  final bool isExported;
+
+  TopLevelDeclarationInSource(this.source, this.declaration, this.isExported);
+
+  @override
+  String toString() => '($source, $declaration, $isExported)';
+}
+
+/**
+ * Kind of a top-level declaration.
+ *
+ * We don't need it to be precise, just enough to support quick fixes.
+ */
+enum TopLevelDeclarationKind { type, function, variable }
diff --git a/pkg/analyzer/lib/src/dart/ast/ast.dart b/pkg/analyzer/lib/src/dart/ast/ast.dart
index 3238aed..8722aa4 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast.dart
@@ -504,15 +504,15 @@
   Token asOperator;
 
   /**
-   * The name of the type being cast to.
+   * The type being cast to.
    */
-  TypeName _type;
+  TypeAnnotation _type;
 
   /**
    * Initialize a newly created as expression.
    */
   AsExpressionImpl(
-      ExpressionImpl expression, this.asOperator, TypeNameImpl type) {
+      ExpressionImpl expression, this.asOperator, TypeAnnotationImpl type) {
     _expression = _becomeParentOf(expression);
     _type = _becomeParentOf(type);
   }
@@ -539,11 +539,11 @@
   int get precedence => 7;
 
   @override
-  TypeName get type => _type;
+  TypeAnnotation get type => _type;
 
   @override
-  void set type(TypeName name) {
-    _type = _becomeParentOf(name as AstNodeImpl);
+  void set type(TypeAnnotation type) {
+    _type = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
@@ -1575,7 +1575,7 @@
    * The type of exceptions caught by this catch clause, or `null` if this catch
    * clause catches every type of exception.
    */
-  TypeName _exceptionType;
+  TypeAnnotation _exceptionType;
 
   /**
    * The token representing the 'catch' keyword, or `null` if there is no
@@ -1628,7 +1628,7 @@
    */
   CatchClauseImpl(
       this.onKeyword,
-      TypeNameImpl exceptionType,
+      TypeAnnotationImpl exceptionType,
       this.catchKeyword,
       this.leftParenthesis,
       SimpleIdentifierImpl exceptionParameter,
@@ -1682,10 +1682,10 @@
   }
 
   @override
-  TypeName get exceptionType => _exceptionType;
+  TypeAnnotation get exceptionType => _exceptionType;
 
   @override
-  void set exceptionType(TypeName exceptionType) {
+  void set exceptionType(TypeAnnotation exceptionType) {
     _exceptionType = _becomeParentOf(exceptionType as AstNodeImpl);
   }
 
@@ -2522,9 +2522,10 @@
       _directives.accept(visitor);
       _declarations.accept(visitor);
     } else {
-      int length = sortedDirectivesAndDeclarations.length;
+      List<AstNode> sortedMembers = sortedDirectivesAndDeclarations;
+      int length = sortedMembers.length;
       for (int i = 0; i < length; i++) {
-        AstNode child = sortedDirectivesAndDeclarations[i];
+        AstNode child = sortedMembers[i];
         child.accept(visitor);
       }
     }
@@ -3294,7 +3295,7 @@
    * The name of the declared type of the parameter, or `null` if the parameter
    * does not have a declared type.
    */
-  TypeName _type;
+  TypeAnnotation _type;
 
   /**
    * The name of the variable being declared.
@@ -3308,7 +3309,7 @@
    * given. The [type] must be `null` if the keyword is 'var'.
    */
   DeclaredIdentifierImpl(CommentImpl comment, List<Annotation> metadata,
-      this.keyword, TypeNameImpl type, SimpleIdentifierImpl identifier)
+      this.keyword, TypeAnnotationImpl type, SimpleIdentifierImpl identifier)
       : super(comment, metadata) {
     _type = _becomeParentOf(type);
     _identifier = _becomeParentOf(identifier);
@@ -3354,11 +3355,11 @@
   bool get isFinal => keyword?.keyword == Keyword.FINAL;
 
   @override
-  TypeName get type => _type;
+  TypeAnnotation get type => _type;
 
   @override
-  void set type(TypeName typeName) {
-    _type = _becomeParentOf(typeName as AstNodeImpl);
+  void set type(TypeAnnotation type) {
+    _type = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
@@ -3446,6 +3447,9 @@
       new ChildEntities()..add(_parameter)..add(separator)..add(_defaultValue);
 
   @override
+  Token get covariantKeyword => null;
+
+  @override
   Expression get defaultValue => _defaultValue;
 
   @override
@@ -4319,6 +4323,11 @@
  */
 class FieldDeclarationImpl extends ClassMemberImpl implements FieldDeclaration {
   /**
+   * The 'covariant' keyword, or `null` if the keyword was not used.
+   */
+  Token covariantKeyword;
+
+  /**
    * The token representing the 'static' keyword, or `null` if the fields are
    * not static.
    */
@@ -4368,7 +4377,9 @@
 
   @override
   Token get firstTokenAfterCommentAndMetadata {
-    if (staticKeyword != null) {
+    if (covariantKeyword != null) {
+      return covariantKeyword;
+    } else if (staticKeyword != null) {
       return staticKeyword;
     }
     return _fieldList.beginToken;
@@ -4408,7 +4419,7 @@
    * The name of the declared type of the parameter, or `null` if the parameter
    * does not have a declared type.
    */
-  TypeName _type;
+  TypeAnnotation _type;
 
   /**
    * The token representing the 'this' keyword.
@@ -4447,7 +4458,7 @@
       CommentImpl comment,
       List<Annotation> metadata,
       this.keyword,
-      TypeNameImpl type,
+      TypeAnnotationImpl type,
       this.thisKeyword,
       this.period,
       SimpleIdentifierImpl identifier,
@@ -4461,7 +4472,12 @@
 
   @override
   Token get beginToken {
-    if (keyword != null) {
+    NodeList<Annotation> metadata = this.metadata;
+    if (!metadata.isEmpty) {
+      return metadata.beginToken;
+    } else if (covariantKeyword != null) {
+      return covariantKeyword;
+    } else if (keyword != null) {
       return keyword;
     } else if (_type != null) {
       return _type.beginToken;
@@ -4501,11 +4517,11 @@
   }
 
   @override
-  TypeName get type => _type;
+  TypeAnnotation get type => _type;
 
   @override
-  void set type(TypeName typeName) {
-    _type = _becomeParentOf(typeName as AstNodeImpl);
+  void set type(TypeAnnotation type) {
+    _type = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
@@ -5084,7 +5100,7 @@
   /**
    * The return type of the function, or `null` if no return type was declared.
    */
-  TypeName _returnType;
+  TypeAnnotation _returnType;
 
   /**
    * The token representing the 'get' or 'set' keyword, or `null` if this is a
@@ -5110,7 +5126,7 @@
       CommentImpl comment,
       List<Annotation> metadata,
       this.externalKeyword,
-      TypeNameImpl returnType,
+      TypeAnnotationImpl returnType,
       this.propertyKeyword,
       SimpleIdentifierImpl name,
       FunctionExpressionImpl functionExpression)
@@ -5162,11 +5178,11 @@
   bool get isSetter => propertyKeyword?.keyword == Keyword.SET;
 
   @override
-  TypeName get returnType => _returnType;
+  TypeAnnotation get returnType => _returnType;
 
   @override
-  void set returnType(TypeName returnType) {
-    _returnType = _becomeParentOf(returnType as AstNodeImpl);
+  void set returnType(TypeAnnotation type) {
+    _returnType = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
@@ -5195,8 +5211,9 @@
   /**
    * Initialize a newly created function declaration statement.
    */
-  FunctionDeclarationStatementImpl(FunctionDeclaration functionDeclaration) {
-    _functionDeclaration = _becomeParentOf(functionDeclaration as AstNodeImpl);
+  FunctionDeclarationStatementImpl(
+      FunctionDeclarationImpl functionDeclaration) {
+    _functionDeclaration = _becomeParentOf(functionDeclaration);
   }
 
   @override
@@ -5434,7 +5451,7 @@
    * The name of the return type of the function type being defined, or `null`
    * if no return type was given.
    */
-  TypeName _returnType;
+  TypeAnnotation _returnType;
 
   /**
    * The type parameters for the function type, or `null` if the function type
@@ -5458,7 +5475,7 @@
       CommentImpl comment,
       List<Annotation> metadata,
       Token keyword,
-      TypeNameImpl returnType,
+      TypeAnnotationImpl returnType,
       SimpleIdentifierImpl name,
       TypeParameterListImpl typeParameters,
       FormalParameterListImpl parameters,
@@ -5491,11 +5508,11 @@
   }
 
   @override
-  TypeName get returnType => _returnType;
+  TypeAnnotation get returnType => _returnType;
 
   @override
-  void set returnType(TypeName typeName) {
-    _returnType = _becomeParentOf(typeName as AstNodeImpl);
+  void set returnType(TypeAnnotation type) {
+    _returnType = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
@@ -5532,7 +5549,7 @@
    * The return type of the function, or `null` if the function does not have a
    * return type.
    */
-  TypeName _returnType;
+  TypeAnnotation _returnType;
 
   /**
    * The type parameters associated with the function, or `null` if the function
@@ -5557,7 +5574,7 @@
   FunctionTypedFormalParameterImpl(
       CommentImpl comment,
       List<Annotation> metadata,
-      TypeNameImpl returnType,
+      TypeAnnotationImpl returnType,
       SimpleIdentifierImpl identifier,
       TypeParameterListImpl typeParameters,
       FormalParameterListImpl parameters,
@@ -5570,7 +5587,12 @@
 
   @override
   Token get beginToken {
-    if (_returnType != null) {
+    NodeList<Annotation> metadata = this.metadata;
+    if (!metadata.isEmpty) {
+      return metadata.beginToken;
+    } else if (covariantKeyword != null) {
+      return covariantKeyword;
+    } else if (_returnType != null) {
       return _returnType.beginToken;
     }
     return identifier.beginToken;
@@ -5598,10 +5620,10 @@
   }
 
   @override
-  TypeName get returnType => _returnType;
+  TypeAnnotation get returnType => _returnType;
 
   @override
-  void set returnType(TypeName type) {
+  void set returnType(TypeAnnotation type) {
     _returnType = _becomeParentOf(type as AstNodeImpl);
   }
 
@@ -5628,6 +5650,214 @@
 }
 
 /**
+ * An anonymous function type.
+ *
+ *    functionType ::=
+ *        [TypeAnnotation]? 'Function' [TypeParameterList]? [FormalParameterList]
+ *
+ * where the FormalParameterList is being used to represent the following
+ * grammar, despite the fact that FormalParameterList can represent a much
+ * larger grammar than the one below. This is done in order to simplify the
+ * implementation.
+ *
+ *    parameterTypeList ::=
+ *        () |
+ *        ( normalParameterTypes ,? ) |
+ *        ( normalParameterTypes , optionalParameterTypes ) |
+ *        ( optionalParameterTypes )
+ *    namedParameterTypes ::=
+ *        { namedParameterType (, namedParameterType)* ,? }
+ *    namedParameterType ::=
+ *        [TypeAnnotation]? [SimpleIdentifier]
+ *    normalParameterTypes ::=
+ *        normalParameterType (, normalParameterType)*
+ *    normalParameterType ::=
+ *        [TypeAnnotation] [SimpleIdentifier]?
+ *    optionalParameterTypes ::=
+ *        optionalPositionalParameterTypes | namedParameterTypes
+ *    optionalPositionalParameterTypes ::=
+ *        [ normalParameterTypes ,? ]
+ */
+class GenericFunctionTypeImpl extends TypeAnnotationImpl
+    implements GenericFunctionType {
+  /**
+   * The name of the return type of the function type being defined, or
+   * `null` if no return type was given.
+   */
+  TypeAnnotation _returnType;
+
+  @override
+  Token functionKeyword;
+
+  /**
+   * The type parameters for the function type, or `null` if the function type
+   * does not have any type parameters.
+   */
+  TypeParameterList _typeParameters;
+
+  /**
+   * The parameters associated with the function type.
+   */
+  FormalParameterList _parameters;
+
+  /**
+   * Initialize a newly created generic function type.
+   */
+  GenericFunctionTypeImpl(
+      TypeAnnotationImpl returnType,
+      this.functionKeyword,
+      TypeParameterListImpl typeParameters,
+      FormalParameterListImpl parameters) {
+    _returnType = _becomeParentOf(returnType);
+    _typeParameters = _becomeParentOf(typeParameters);
+    _parameters = _becomeParentOf(parameters);
+  }
+
+  @override
+  Token get beginToken =>
+      _returnType == null ? functionKeyword : _returnType.beginToken;
+
+  @override
+  Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+    ..add(_returnType)
+    ..add(functionKeyword)
+    ..add(_typeParameters)
+    ..add(_parameters);
+
+  @override
+  Token get endToken => _parameters.endToken;
+
+  @override
+  FormalParameterList get parameters => _parameters;
+
+  @override
+  void set parameters(FormalParameterList parameters) {
+    _parameters = _becomeParentOf(parameters as AstNodeImpl);
+  }
+
+  @override
+  TypeAnnotation get returnType => _returnType;
+
+  @override
+  void set returnType(TypeAnnotation type) {
+    _returnType = _becomeParentOf(type as AstNodeImpl);
+  }
+
+  @override
+  DartType get type => null;
+
+  /**
+   * Return the type parameters for the function type, or `null` if the function
+   * type does not have any type parameters.
+   */
+  TypeParameterList get typeParameters => _typeParameters;
+
+  /**
+   * Set the type parameters for the function type to the given list of
+   * [typeParameters].
+   */
+  void set typeParameters(TypeParameterList typeParameters) {
+    _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
+  }
+
+  // TODO: implement type
+  @override
+  dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) {
+    return visitor.visitGenericFunctionType(this);
+  }
+
+  @override
+  void visitChildren(AstVisitor visitor) {
+    _returnType?.accept(visitor);
+    _typeParameters?.accept(visitor);
+    _parameters?.accept(visitor);
+  }
+}
+
+/**
+ * A generic type alias.
+ *
+ *    functionTypeAlias ::=
+ *        metadata 'typedef' [SimpleIdentifier] [TypeParameterList]? = [FunctionType] ';'
+ */
+class GenericTypeAliasImpl extends TypeAliasImpl implements GenericTypeAlias {
+  /**
+   * The type parameters for the function type, or `null` if the function
+   * type does not have any type parameters.
+   */
+  TypeParameterList _typeParameters;
+
+  @override
+  Token equals;
+
+  /**
+   * The type of function being defined by the alias.
+   */
+  GenericFunctionType _functionType;
+
+  /**
+   * Returns a newly created generic type alias. Either or both of the
+   * [comment] and [metadata] can be `null` if the variable list does not have
+   * the corresponding attribute. The [typeParameters] can be `null` if there
+   * are no type parameters.
+   */
+  GenericTypeAliasImpl(
+      Comment comment,
+      List<Annotation> metadata,
+      Token typedefToken,
+      SimpleIdentifier name,
+      TypeParameterListImpl typeParameters,
+      this.equals,
+      GenericFunctionTypeImpl functionType,
+      Token semicolon)
+      : super(comment, metadata, typedefToken, name, semicolon) {
+    _typeParameters = _becomeParentOf(typeParameters);
+    _functionType = _becomeParentOf(functionType);
+  }
+
+  @override
+  Iterable<SyntacticEntity> get childEntities => new ChildEntities()
+    ..addAll(metadata)
+    ..add(typedefKeyword)
+    ..add(name)
+    ..add(_typeParameters)
+    ..add(equals)
+    ..add(_functionType);
+  @override
+  Element get element => null;
+
+  @override
+  GenericFunctionType get functionType => _functionType;
+
+  @override
+  void set functionType(GenericFunctionType functionType) {
+    _functionType = _becomeParentOf(functionType as AstNodeImpl);
+  }
+
+  @override
+  TypeParameterList get typeParameters => _typeParameters;
+
+  @override
+  void set typeParameters(TypeParameterList typeParameters) {
+    _typeParameters = _becomeParentOf(typeParameters as AstNodeImpl);
+  }
+
+  @override
+  dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) {
+    return visitor.visitGenericTypeAlias(this);
+  }
+
+  // TODO: implement element
+  @override
+  void visitChildren(AstVisitor visitor) {
+    super.visitChildren(visitor);
+    name?.accept(visitor);
+    _typeParameters?.accept(visitor);
+    _functionType?.accept(visitor);
+  }
+}
+
+/**
  * A combinator that restricts the names being imported to those that are not in
  * a given list.
  *
@@ -6527,14 +6757,14 @@
   /**
    * The name of the type being tested for.
    */
-  TypeName _type;
+  TypeAnnotation _type;
 
   /**
    * Initialize a newly created is expression. The [notOperator] can be `null`
    * if the sense of the test is not negated.
    */
   IsExpressionImpl(ExpressionImpl expression, this.isOperator, this.notOperator,
-      TypeNameImpl type) {
+      TypeAnnotationImpl type) {
     _expression = _becomeParentOf(expression);
     _type = _becomeParentOf(type);
   }
@@ -6564,11 +6794,11 @@
   int get precedence => 7;
 
   @override
-  TypeName get type => _type;
+  TypeAnnotation get type => _type;
 
   @override
-  void set type(TypeName name) {
-    _type = _becomeParentOf(name as AstNodeImpl);
+  void set type(TypeAnnotation type) {
+    _type = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
@@ -7124,7 +7354,7 @@
   /**
    * The return type of the method, or `null` if no return type was declared.
    */
-  TypeName _returnType;
+  TypeAnnotation _returnType;
 
   /**
    * The token representing the 'get' or 'set' keyword, or `null` if this is a
@@ -7178,7 +7408,7 @@
       List<Annotation> metadata,
       this.externalKeyword,
       this.modifierKeyword,
-      TypeNameImpl returnType,
+      TypeAnnotationImpl returnType,
       this.propertyKeyword,
       this.operatorKeyword,
       SimpleIdentifierImpl name,
@@ -7277,11 +7507,11 @@
   }
 
   @override
-  TypeName get returnType => _returnType;
+  TypeAnnotation get returnType => _returnType;
 
   @override
-  void set returnType(TypeName typeName) {
-    _returnType = _becomeParentOf(typeName as AstNodeImpl);
+  void set returnType(TypeAnnotation type) {
+    _returnType = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
@@ -7893,6 +8123,11 @@
   NodeList<Annotation> _metadata;
 
   /**
+   * The 'covariant' keyword, or `null` if the keyword was not used.
+   */
+  Token covariantKeyword;
+
+  /**
    * The name of the parameter being declared.
    */
   SimpleIdentifier _identifier;
@@ -7960,6 +8195,9 @@
     } else {
       result.addAll(sortedCommentAndAnnotations);
     }
+    if (covariantKeyword != null) {
+      result.add(covariantKeyword);
+    }
     return result;
   }
 
@@ -8991,7 +9229,7 @@
    * The name of the declared type of the parameter, or `null` if the parameter
    * does not have a declared type.
    */
-  TypeName _type;
+  TypeAnnotation _type;
 
   /**
    * Initialize a newly created formal parameter. Either or both of the
@@ -9000,7 +9238,7 @@
    * specified. The [type] must be `null` if the keyword is 'var'.
    */
   SimpleFormalParameterImpl(CommentImpl comment, List<Annotation> metadata,
-      this.keyword, TypeNameImpl type, SimpleIdentifierImpl identifier)
+      this.keyword, TypeAnnotationImpl type, SimpleIdentifierImpl identifier)
       : super(comment, metadata, identifier) {
     _type = _becomeParentOf(type);
   }
@@ -9010,6 +9248,8 @@
     NodeList<Annotation> metadata = this.metadata;
     if (!metadata.isEmpty) {
       return metadata.beginToken;
+    } else if (covariantKeyword != null) {
+      return covariantKeyword;
     } else if (keyword != null) {
       return keyword;
     } else if (_type != null) {
@@ -9032,11 +9272,11 @@
   bool get isFinal => keyword?.keyword == Keyword.FINAL;
 
   @override
-  TypeName get type => _type;
+  TypeAnnotation get type => _type;
 
   @override
-  void set type(TypeName typeName) {
-    _type = _becomeParentOf(typeName as AstNodeImpl);
+  void set type(TypeAnnotation type) {
+    _type = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
@@ -10299,6 +10539,16 @@
 }
 
 /**
+ * A type annotation.
+ *
+ *    type ::=
+ *        [NamedType]
+ *      | [GenericFunctionType]
+ */
+abstract class TypeAnnotationImpl extends AstNodeImpl
+    implements TypeAnnotation {}
+
+/**
  * A list of type arguments.
  *
  *    typeArguments ::=
@@ -10313,7 +10563,7 @@
   /**
    * The type arguments associated with the type.
    */
-  NodeList<TypeName> _arguments;
+  NodeList<TypeAnnotation> _arguments;
 
   /**
    * The right bracket.
@@ -10324,12 +10574,12 @@
    * Initialize a newly created list of type arguments.
    */
   TypeArgumentListImpl(
-      this.leftBracket, List<TypeName> arguments, this.rightBracket) {
-    _arguments = new NodeListImpl<TypeName>(this, arguments);
+      this.leftBracket, List<TypeAnnotation> arguments, this.rightBracket) {
+    _arguments = new NodeListImpl<TypeAnnotation>(this, arguments);
   }
 
   @override
-  NodeList<TypeName> get arguments => _arguments;
+  NodeList<TypeAnnotation> get arguments => _arguments;
 
   @override
   Token get beginToken => leftBracket;
@@ -10406,7 +10656,7 @@
  *    typeName ::=
  *        [Identifier] typeArguments?
  */
-class TypeNameImpl extends AstNodeImpl implements TypeName {
+class TypeNameImpl extends TypeAnnotationImpl implements TypeName {
   /**
    * The name of the type.
    */
@@ -10512,7 +10762,7 @@
    * The name of the upper bound for legal arguments, or `null` if there is no
    * explicit upper bound.
    */
-  TypeName _bound;
+  TypeAnnotation _bound;
 
   /**
    * Initialize a newly created type parameter. Either or both of the [comment]
@@ -10521,18 +10771,18 @@
    * the parameter does not have an upper bound.
    */
   TypeParameterImpl(CommentImpl comment, List<Annotation> metadata,
-      SimpleIdentifierImpl name, this.extendsKeyword, TypeNameImpl bound)
+      SimpleIdentifierImpl name, this.extendsKeyword, TypeAnnotationImpl bound)
       : super(comment, metadata) {
     _name = _becomeParentOf(name);
     _bound = _becomeParentOf(bound);
   }
 
   @override
-  TypeName get bound => _bound;
+  TypeAnnotation get bound => _bound;
 
   @override
-  void set bound(TypeName typeName) {
-    _bound = _becomeParentOf(typeName as AstNodeImpl);
+  void set bound(TypeAnnotation type) {
+    _bound = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
@@ -10890,7 +11140,7 @@
   /**
    * The type of the variables being declared, or `null` if no type was provided.
    */
-  TypeName _type;
+  TypeAnnotation _type;
 
   /**
    * A list containing the individual variables being declared.
@@ -10903,8 +11153,12 @@
    * the corresponding attribute. The [keyword] can be `null` if a type was
    * specified. The [type] must be `null` if the keyword is 'var'.
    */
-  VariableDeclarationListImpl(CommentImpl comment, List<Annotation> metadata,
-      this.keyword, TypeNameImpl type, List<VariableDeclaration> variables)
+  VariableDeclarationListImpl(
+      CommentImpl comment,
+      List<Annotation> metadata,
+      this.keyword,
+      TypeAnnotationImpl type,
+      List<VariableDeclaration> variables)
       : super(comment, metadata) {
     _type = _becomeParentOf(type);
     _variables = new NodeListImpl<VariableDeclaration>(this, variables);
@@ -10937,11 +11191,11 @@
   bool get isFinal => keyword?.keyword == Keyword.FINAL;
 
   @override
-  TypeName get type => _type;
+  TypeAnnotation get type => _type;
 
   @override
-  void set type(TypeName typeName) {
-    _type = _becomeParentOf(typeName as AstNodeImpl);
+  void set type(TypeAnnotation type) {
+    _type = _becomeParentOf(type as AstNodeImpl);
   }
 
   @override
diff --git a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
index 72079b6..482ae01 100644
--- a/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
+++ b/pkg/analyzer/lib/src/dart/ast/ast_factory.dart
@@ -29,7 +29,7 @@
 
   @override
   AsExpression asExpression(
-          Expression expression, Token asOperator, TypeName type) =>
+          Expression expression, Token asOperator, TypeAnnotation type) =>
       new AsExpressionImpl(expression, asOperator, type);
 
   @override
@@ -98,7 +98,7 @@
   @override
   CatchClause catchClause(
           Token onKeyword,
-          TypeName exceptionType,
+          TypeAnnotation exceptionType,
           Token catchKeyword,
           Token leftParenthesis,
           SimpleIdentifier exceptionParameter,
@@ -262,7 +262,7 @@
           Comment comment,
           List<Annotation> metadata,
           Token keyword,
-          TypeName type,
+          TypeAnnotation type,
           SimpleIdentifier identifier) =>
       new DeclaredIdentifierImpl(comment, metadata, keyword, type, identifier);
 
@@ -367,7 +367,7 @@
           Comment comment,
           List<Annotation> metadata,
           Token keyword,
-          TypeName type,
+          TypeAnnotation type,
           Token thisKeyword,
           Token period,
           SimpleIdentifier identifier,
@@ -455,7 +455,7 @@
           Comment comment,
           List<Annotation> metadata,
           Token externalKeyword,
-          TypeName returnType,
+          TypeAnnotation returnType,
           Token propertyKeyword,
           SimpleIdentifier name,
           FunctionExpression functionExpression) =>
@@ -483,7 +483,7 @@
           Comment comment,
           List<Annotation> metadata,
           Token keyword,
-          TypeName returnType,
+          TypeAnnotation returnType,
           SimpleIdentifier name,
           TypeParameterList typeParameters,
           FormalParameterList parameters,
@@ -495,7 +495,7 @@
   FunctionTypedFormalParameter functionTypedFormalParameter(
           Comment comment,
           List<Annotation> metadata,
-          TypeName returnType,
+          TypeAnnotation returnType,
           SimpleIdentifier identifier,
           TypeParameterList typeParameters,
           FormalParameterList parameters,
@@ -504,6 +504,28 @@
           identifier, typeParameters, parameters, question);
 
   @override
+  GenericFunctionType genericFunctionType(
+          TypeAnnotation returnType,
+          Token functionKeyword,
+          TypeParameterList typeParameters,
+          FormalParameterList _parameters) =>
+      new GenericFunctionTypeImpl(
+          returnType, functionKeyword, typeParameters, _parameters);
+
+  @override
+  GenericTypeAlias genericTypeAlias(
+          Comment comment,
+          List<Annotation> metadata,
+          Token typedefKeyword,
+          SimpleIdentifier name,
+          TypeParameterList typeParameters,
+          Token equals,
+          GenericFunctionType functionType,
+          Token semicolon) =>
+      new GenericTypeAliasImpl(comment, metadata, typedefKeyword, name,
+          typeParameters, equals, functionType, semicolon);
+
+  @override
   HideCombinator hideCombinator(
           Token keyword, List<SimpleIdentifier> hiddenNames) =>
       new HideCombinatorImpl(keyword, hiddenNames);
@@ -582,7 +604,7 @@
 
   @override
   IsExpression isExpression(Expression expression, Token isOperator,
-          Token notOperator, TypeName type) =>
+          Token notOperator, TypeAnnotation type) =>
       new IsExpressionImpl(expression, isOperator, notOperator, type);
 
   @override
@@ -630,7 +652,7 @@
           List<Annotation> metadata,
           Token externalKeyword,
           Token modifierKeyword,
-          TypeName returnType,
+          TypeAnnotation returnType,
           Token propertyKeyword,
           Token operatorKeyword,
           SimpleIdentifier name,
@@ -753,7 +775,7 @@
           Comment comment,
           List<Annotation> metadata,
           Token keyword,
-          TypeName type,
+          TypeAnnotation type,
           SimpleIdentifier identifier) =>
       new SimpleFormalParameterImpl(
           comment, metadata, keyword, type, identifier);
@@ -787,7 +809,6 @@
   @override
   SuperExpression superExpression(Token superKeyword) =>
       new SuperExpressionImpl(superKeyword);
-
   @override
   SwitchCase switchCase(List<Label> labels, Token keyword,
           Expression expression, Token colon, List<Statement> statements) =>
@@ -797,6 +818,7 @@
   SwitchDefault switchDefault(List<Label> labels, Token keyword, Token colon,
           List<Statement> statements) =>
       new SwitchDefaultImpl(labels, keyword, colon, statements);
+
   @override
   SwitchStatement switchStatement(
           Token switchKeyword,
@@ -841,8 +863,8 @@
           tryKeyword, body, catchClauses, finallyKeyword, finallyBlock);
 
   @override
-  TypeArgumentList typeArgumentList(
-          Token leftBracket, List<TypeName> arguments, Token rightBracket) =>
+  TypeArgumentList typeArgumentList(Token leftBracket,
+          List<TypeAnnotation> arguments, Token rightBracket) =>
       new TypeArgumentListImpl(leftBracket, arguments, rightBracket);
 
   @override
@@ -852,7 +874,7 @@
 
   @override
   TypeParameter typeParameter(Comment comment, List<Annotation> metadata,
-          SimpleIdentifier name, Token extendsKeyword, TypeName bound) =>
+          SimpleIdentifier name, Token extendsKeyword, TypeAnnotation bound) =>
       new TypeParameterImpl(comment, metadata, name, extendsKeyword, bound);
 
   @override
@@ -870,7 +892,7 @@
           Comment comment,
           List<Annotation> metadata,
           Token keyword,
-          TypeName type,
+          TypeAnnotation type,
           List<VariableDeclaration> variables) =>
       new VariableDeclarationListImpl(
           comment, metadata, keyword, type, variables);
diff --git a/pkg/analyzer/lib/src/dart/ast/resolution_map.dart b/pkg/analyzer/lib/src/dart/ast/resolution_map.dart
new file mode 100644
index 0000000..3fe5d0f
--- /dev/null
+++ b/pkg/analyzer/lib/src/dart/ast/resolution_map.dart
@@ -0,0 +1,158 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/resolution_map.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
+
+/**
+ * Concrete implementation of [ResolutionMap] based on the standard AST
+ * implementation.
+ */
+class ResolutionMapImpl implements ResolutionMap {
+  @override
+  ExecutableElement bestElementForFunctionExpressionInvocation(
+          FunctionExpressionInvocation node) =>
+      node.bestElement;
+
+  @override
+  Element bestElementForIdentifier(Identifier node) => node.bestElement;
+
+  @override
+  MethodElement bestElementForMethodReference(MethodReferenceExpression node) =>
+      node.bestElement;
+
+  @override
+  ParameterElement bestParameterElementForExpression(Expression node) =>
+      node.bestParameterElement;
+
+  @override
+  DartType bestTypeForExpression(Expression node) => node.bestType;
+
+  @override
+  ElementAnnotation elementAnnotationForAnnotation(Annotation node) =>
+      node.elementAnnotation;
+
+  @override
+  ClassElement elementDeclaredByClassDeclaration(ClassDeclaration node) =>
+      node.element;
+
+  @override
+  CompilationUnitElement elementDeclaredByCompilationUnit(
+          CompilationUnit node) =>
+      node.element;
+
+  @override
+  ConstructorElement elementDeclaredByConstructorDeclaration(
+          ConstructorDeclaration node) =>
+      node.element;
+
+  @override
+  Element elementDeclaredByDeclaration(Declaration node) => node.element;
+
+  @override
+  LocalVariableElement elementDeclaredByDeclaredIdentifier(
+          DeclaredIdentifier node) =>
+      node.element;
+
+  @override
+  Element elementDeclaredByDirective(Directive node) => node.element;
+
+  @override
+  ClassElement elementDeclaredByEnumDeclaration(EnumDeclaration node) =>
+      node.element;
+
+  @override
+  ParameterElement elementDeclaredByFormalParameter(FormalParameter node) =>
+      node.element;
+
+  @override
+  ExecutableElement elementDeclaredByFunctionDeclaration(
+          FunctionDeclaration node) =>
+      node.element;
+
+  @override
+  ExecutableElement elementDeclaredByFunctionExpression(
+          FunctionExpression node) =>
+      node.element;
+
+  @override
+  ExecutableElement elementDeclaredByMethodDeclaration(
+          MethodDeclaration node) =>
+      node.element;
+
+  @override
+  VariableElement elementDeclaredByVariableDeclaration(
+          VariableDeclaration node) =>
+      node.element;
+
+  @override
+  Element elementForAnnotation(Annotation node) => node.element;
+
+  @override
+  ParameterElement elementForNamedExpression(NamedExpression node) =>
+      node.element;
+
+  @override
+  List<ParameterElement> parameterElementsForFormalParameterList(
+          FormalParameterList node) =>
+      node.parameterElements;
+
+  @override
+  ExecutableElement propagatedElementForFunctionExpressionInvocation(
+          FunctionExpressionInvocation node) =>
+      node.propagatedElement;
+
+  @override
+  Element propagatedElementForIdentifier(Identifier node) =>
+      node.propagatedElement;
+
+  @override
+  MethodElement propagatedElementForMethodReference(
+          MethodReferenceExpression node) =>
+      node.propagatedElement;
+
+  @override
+  ParameterElement propagatedParameterElementForExpression(Expression node) =>
+      node.propagatedParameterElement;
+
+  @override
+  DartType propagatedTypeForExpression(Expression node) => node.propagatedType;
+
+  @override
+  ConstructorElement staticElementForConstructorReference(
+          ConstructorReferenceNode node) =>
+      node.staticElement;
+
+  @override
+  ExecutableElement staticElementForFunctionExpressionInvocation(
+          FunctionExpressionInvocation node) =>
+      node.staticElement;
+
+  @override
+  Element staticElementForIdentifier(Identifier node) => node.staticElement;
+
+  @override
+  MethodElement staticElementForMethodReference(
+          MethodReferenceExpression node) =>
+      node.staticElement;
+
+  @override
+  DartType staticInvokeTypeForInvocationExpression(InvocationExpression node) =>
+      node.staticInvokeType;
+
+  @override
+  ParameterElement staticParameterElementForExpression(Expression node) =>
+      node.staticParameterElement;
+
+  @override
+  DartType staticTypeForExpression(Expression node) => node.staticType;
+
+  @override
+  DartType typeForTypeName(TypeAnnotation node) => node.type;
+
+  @override
+  Element uriElementForDirective(UriBasedDirective node) => node.uriElement;
+}
diff --git a/pkg/analyzer/lib/src/dart/ast/utilities.dart b/pkg/analyzer/lib/src/dart/ast/utilities.dart
index 7dd0e48..4d709d5 100644
--- a/pkg/analyzer/lib/src/dart/ast/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/ast/utilities.dart
@@ -7,6 +7,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -120,10 +121,10 @@
 
   @override
   AdjacentStrings visitAdjacentStrings(AdjacentStrings node) =>
-      new AdjacentStrings(cloneNodeList(node.strings));
+      astFactory.adjacentStrings(cloneNodeList(node.strings));
 
   @override
-  Annotation visitAnnotation(Annotation node) => new Annotation(
+  Annotation visitAnnotation(Annotation node) => astFactory.annotation(
       cloneToken(node.atSign),
       cloneNode(node.name),
       cloneToken(node.period),
@@ -131,20 +132,20 @@
       cloneNode(node.arguments));
 
   @override
-  ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList(
+  ArgumentList visitArgumentList(ArgumentList node) => astFactory.argumentList(
       cloneToken(node.leftParenthesis),
       cloneNodeList(node.arguments),
       cloneToken(node.rightParenthesis));
 
   @override
-  AsExpression visitAsExpression(AsExpression node) => new AsExpression(
+  AsExpression visitAsExpression(AsExpression node) => astFactory.asExpression(
       cloneNode(node.expression),
       cloneToken(node.asOperator),
       cloneNode(node.type));
 
   @override
   AstNode visitAssertInitializer(AssertInitializer node) =>
-      new AssertInitializer(
+      astFactory.assertInitializer(
           cloneToken(node.assertKeyword),
           cloneToken(node.leftParenthesis),
           cloneNode(node.condition),
@@ -153,56 +154,56 @@
           cloneToken(node.rightParenthesis));
 
   @override
-  AstNode visitAssertStatement(AssertStatement node) => new AssertStatement(
-      cloneToken(node.assertKeyword),
-      cloneToken(node.leftParenthesis),
-      cloneNode(node.condition),
-      cloneToken(node.comma),
-      cloneNode(node.message),
-      cloneToken(node.rightParenthesis),
-      cloneToken(node.semicolon));
+  AstNode visitAssertStatement(AssertStatement node) =>
+      astFactory.assertStatement(
+          cloneToken(node.assertKeyword),
+          cloneToken(node.leftParenthesis),
+          cloneNode(node.condition),
+          cloneToken(node.comma),
+          cloneNode(node.message),
+          cloneToken(node.rightParenthesis),
+          cloneToken(node.semicolon));
 
   @override
   AssignmentExpression visitAssignmentExpression(AssignmentExpression node) =>
-      new AssignmentExpression(cloneNode(node.leftHandSide),
+      astFactory.assignmentExpression(cloneNode(node.leftHandSide),
           cloneToken(node.operator), cloneNode(node.rightHandSide));
 
   @override
   AwaitExpression visitAwaitExpression(AwaitExpression node) =>
-      new AwaitExpression(
+      astFactory.awaitExpression(
           cloneToken(node.awaitKeyword), cloneNode(node.expression));
 
   @override
   BinaryExpression visitBinaryExpression(BinaryExpression node) =>
-      new BinaryExpression(cloneNode(node.leftOperand),
+      astFactory.binaryExpression(cloneNode(node.leftOperand),
           cloneToken(node.operator), cloneNode(node.rightOperand));
 
   @override
-  Block visitBlock(Block node) => new Block(cloneToken(node.leftBracket),
+  Block visitBlock(Block node) => astFactory.block(cloneToken(node.leftBracket),
       cloneNodeList(node.statements), cloneToken(node.rightBracket));
 
   @override
   BlockFunctionBody visitBlockFunctionBody(BlockFunctionBody node) =>
-      new BlockFunctionBody(cloneToken(node.keyword), cloneToken(node.star),
-          cloneNode(node.block));
+      astFactory.blockFunctionBody(cloneToken(node.keyword),
+          cloneToken(node.star), cloneNode(node.block));
 
   @override
   BooleanLiteral visitBooleanLiteral(BooleanLiteral node) =>
-      new BooleanLiteral(cloneToken(node.literal), node.value);
+      astFactory.booleanLiteral(cloneToken(node.literal), node.value);
 
   @override
-  BreakStatement visitBreakStatement(BreakStatement node) => new BreakStatement(
-      cloneToken(node.breakKeyword),
-      cloneNode(node.label),
-      cloneToken(node.semicolon));
+  BreakStatement visitBreakStatement(BreakStatement node) =>
+      astFactory.breakStatement(cloneToken(node.breakKeyword),
+          cloneNode(node.label), cloneToken(node.semicolon));
 
   @override
   CascadeExpression visitCascadeExpression(CascadeExpression node) =>
-      new CascadeExpression(
+      astFactory.cascadeExpression(
           cloneNode(node.target), cloneNodeList(node.cascadeSections));
 
   @override
-  CatchClause visitCatchClause(CatchClause node) => new CatchClause(
+  CatchClause visitCatchClause(CatchClause node) => astFactory.catchClause(
       cloneToken(node.onKeyword),
       cloneNode(node.exceptionType),
       cloneToken(node.catchKeyword),
@@ -215,7 +216,7 @@
 
   @override
   ClassDeclaration visitClassDeclaration(ClassDeclaration node) {
-    ClassDeclaration copy = new ClassDeclaration(
+    ClassDeclaration copy = astFactory.classDeclaration(
         cloneNode(node.documentationComment),
         cloneNodeList(node.metadata),
         cloneToken(node.abstractKeyword),
@@ -235,7 +236,7 @@
   @override
   ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) {
     cloneToken(node.abstractKeyword);
-    return new ClassTypeAlias(
+    return astFactory.classTypeAlias(
         cloneNode(node.documentationComment),
         cloneNodeList(node.metadata),
         cloneToken(node.typedefKeyword),
@@ -252,22 +253,22 @@
   @override
   Comment visitComment(Comment node) {
     if (node.isDocumentation) {
-      return Comment.createDocumentationCommentWithReferences(
+      return astFactory.documentationComment(
           cloneTokenList(node.tokens), cloneNodeList(node.references));
     } else if (node.isBlock) {
-      return Comment.createBlockComment(cloneTokenList(node.tokens));
+      return astFactory.blockComment(cloneTokenList(node.tokens));
     }
-    return Comment.createEndOfLineComment(cloneTokenList(node.tokens));
+    return astFactory.endOfLineComment(cloneTokenList(node.tokens));
   }
 
   @override
   CommentReference visitCommentReference(CommentReference node) =>
-      new CommentReference(
+      astFactory.commentReference(
           cloneToken(node.newKeyword), cloneNode(node.identifier));
 
   @override
   CompilationUnit visitCompilationUnit(CompilationUnit node) {
-    CompilationUnit clone = new CompilationUnit(
+    CompilationUnit clone = astFactory.compilationUnit(
         cloneToken(node.beginToken),
         cloneNode(node.scriptTag),
         cloneNodeList(node.directives),
@@ -280,7 +281,7 @@
   @override
   ConditionalExpression visitConditionalExpression(
           ConditionalExpression node) =>
-      new ConditionalExpression(
+      astFactory.conditionalExpression(
           cloneNode(node.condition),
           cloneToken(node.question),
           cloneNode(node.thenExpression),
@@ -288,19 +289,20 @@
           cloneNode(node.elseExpression));
 
   @override
-  Configuration visitConfiguration(Configuration node) => new Configuration(
-      cloneToken(node.ifKeyword),
-      cloneToken(node.leftParenthesis),
-      cloneNode(node.name),
-      cloneToken(node.equalToken),
-      cloneNode(node.value),
-      cloneToken(node.rightParenthesis),
-      cloneNode(node.uri));
+  Configuration visitConfiguration(Configuration node) =>
+      astFactory.configuration(
+          cloneToken(node.ifKeyword),
+          cloneToken(node.leftParenthesis),
+          cloneNode(node.name),
+          cloneToken(node.equalToken),
+          cloneNode(node.value),
+          cloneToken(node.rightParenthesis),
+          cloneNode(node.uri));
 
   @override
   ConstructorDeclaration visitConstructorDeclaration(
           ConstructorDeclaration node) =>
-      new ConstructorDeclaration(
+      astFactory.constructorDeclaration(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.externalKeyword),
@@ -318,7 +320,7 @@
   @override
   ConstructorFieldInitializer visitConstructorFieldInitializer(
           ConstructorFieldInitializer node) =>
-      new ConstructorFieldInitializer(
+      astFactory.constructorFieldInitializer(
           cloneToken(node.thisKeyword),
           cloneToken(node.period),
           cloneNode(node.fieldName),
@@ -327,17 +329,17 @@
 
   @override
   ConstructorName visitConstructorName(ConstructorName node) =>
-      new ConstructorName(
+      astFactory.constructorName(
           cloneNode(node.type), cloneToken(node.period), cloneNode(node.name));
 
   @override
   ContinueStatement visitContinueStatement(ContinueStatement node) =>
-      new ContinueStatement(cloneToken(node.continueKeyword),
+      astFactory.continueStatement(cloneToken(node.continueKeyword),
           cloneNode(node.label), cloneToken(node.semicolon));
 
   @override
   DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) =>
-      new DeclaredIdentifier(
+      astFactory.declaredIdentifier(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.keyword),
@@ -347,11 +349,11 @@
   @override
   DefaultFormalParameter visitDefaultFormalParameter(
           DefaultFormalParameter node) =>
-      new DefaultFormalParameter(cloneNode(node.parameter), node.kind,
+      astFactory.defaultFormalParameter(cloneNode(node.parameter), node.kind,
           cloneToken(node.separator), cloneNode(node.defaultValue));
 
   @override
-  DoStatement visitDoStatement(DoStatement node) => new DoStatement(
+  DoStatement visitDoStatement(DoStatement node) => astFactory.doStatement(
       cloneToken(node.doKeyword),
       cloneNode(node.body),
       cloneToken(node.whileKeyword),
@@ -362,28 +364,28 @@
 
   @override
   DottedName visitDottedName(DottedName node) =>
-      new DottedName(cloneNodeList(node.components));
+      astFactory.dottedName(cloneNodeList(node.components));
 
   @override
   DoubleLiteral visitDoubleLiteral(DoubleLiteral node) =>
-      new DoubleLiteral(cloneToken(node.literal), node.value);
+      astFactory.doubleLiteral(cloneToken(node.literal), node.value);
 
   @override
   EmptyFunctionBody visitEmptyFunctionBody(EmptyFunctionBody node) =>
-      new EmptyFunctionBody(cloneToken(node.semicolon));
+      astFactory.emptyFunctionBody(cloneToken(node.semicolon));
 
   @override
   EmptyStatement visitEmptyStatement(EmptyStatement node) =>
-      new EmptyStatement(cloneToken(node.semicolon));
+      astFactory.emptyStatement(cloneToken(node.semicolon));
 
   @override
   AstNode visitEnumConstantDeclaration(EnumConstantDeclaration node) =>
-      new EnumConstantDeclaration(cloneNode(node.documentationComment),
+      astFactory.enumConstantDeclaration(cloneNode(node.documentationComment),
           cloneNodeList(node.metadata), cloneNode(node.name));
 
   @override
   EnumDeclaration visitEnumDeclaration(EnumDeclaration node) =>
-      new EnumDeclaration(
+      astFactory.enumDeclaration(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.enumKeyword),
@@ -394,7 +396,7 @@
 
   @override
   ExportDirective visitExportDirective(ExportDirective node) {
-    ExportDirectiveImpl directive = new ExportDirective(
+    ExportDirectiveImpl directive = astFactory.exportDirective(
         cloneNode(node.documentationComment),
         cloneNodeList(node.metadata),
         cloneToken(node.keyword),
@@ -412,7 +414,7 @@
   @override
   ExpressionFunctionBody visitExpressionFunctionBody(
           ExpressionFunctionBody node) =>
-      new ExpressionFunctionBody(
+      astFactory.expressionFunctionBody(
           cloneToken(node.keyword),
           cloneToken(node.functionDefinition),
           cloneNode(node.expression),
@@ -420,16 +422,17 @@
 
   @override
   ExpressionStatement visitExpressionStatement(ExpressionStatement node) =>
-      new ExpressionStatement(
+      astFactory.expressionStatement(
           cloneNode(node.expression), cloneToken(node.semicolon));
 
   @override
-  ExtendsClause visitExtendsClause(ExtendsClause node) => new ExtendsClause(
-      cloneToken(node.extendsKeyword), cloneNode(node.superclass));
+  ExtendsClause visitExtendsClause(ExtendsClause node) =>
+      astFactory.extendsClause(
+          cloneToken(node.extendsKeyword), cloneNode(node.superclass));
 
   @override
   FieldDeclaration visitFieldDeclaration(FieldDeclaration node) =>
-      new FieldDeclaration(
+      astFactory.fieldDeclaration(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.staticKeyword),
@@ -438,7 +441,7 @@
 
   @override
   FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) =>
-      new FieldFormalParameter(
+      astFactory.fieldFormalParameter(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.keyword),
@@ -453,7 +456,7 @@
   ForEachStatement visitForEachStatement(ForEachStatement node) {
     DeclaredIdentifier loopVariable = node.loopVariable;
     if (loopVariable == null) {
-      return new ForEachStatement.withReference(
+      return astFactory.forEachStatementWithReference(
           cloneToken(node.awaitKeyword),
           cloneToken(node.forKeyword),
           cloneToken(node.leftParenthesis),
@@ -463,7 +466,7 @@
           cloneToken(node.rightParenthesis),
           cloneNode(node.body));
     }
-    return new ForEachStatement.withDeclaration(
+    return astFactory.forEachStatementWithDeclaration(
         cloneToken(node.awaitKeyword),
         cloneToken(node.forKeyword),
         cloneToken(node.leftParenthesis),
@@ -476,7 +479,7 @@
 
   @override
   FormalParameterList visitFormalParameterList(FormalParameterList node) =>
-      new FormalParameterList(
+      astFactory.formalParameterList(
           cloneToken(node.leftParenthesis),
           cloneNodeList(node.parameters),
           cloneToken(node.leftDelimiter),
@@ -484,7 +487,7 @@
           cloneToken(node.rightParenthesis));
 
   @override
-  ForStatement visitForStatement(ForStatement node) => new ForStatement(
+  ForStatement visitForStatement(ForStatement node) => astFactory.forStatement(
       cloneToken(node.forKeyword),
       cloneToken(node.leftParenthesis),
       cloneNode(node.variables),
@@ -498,7 +501,7 @@
 
   @override
   FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) =>
-      new FunctionDeclaration(
+      astFactory.functionDeclaration(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.externalKeyword),
@@ -510,22 +513,23 @@
   @override
   FunctionDeclarationStatement visitFunctionDeclarationStatement(
           FunctionDeclarationStatement node) =>
-      new FunctionDeclarationStatement(cloneNode(node.functionDeclaration));
+      astFactory
+          .functionDeclarationStatement(cloneNode(node.functionDeclaration));
 
   @override
   FunctionExpression visitFunctionExpression(FunctionExpression node) =>
-      new FunctionExpression(cloneNode(node.typeParameters),
+      astFactory.functionExpression(cloneNode(node.typeParameters),
           cloneNode(node.parameters), cloneNode(node.body));
 
   @override
   FunctionExpressionInvocation visitFunctionExpressionInvocation(
           FunctionExpressionInvocation node) =>
-      new FunctionExpressionInvocation(cloneNode(node.function),
+      astFactory.functionExpressionInvocation(cloneNode(node.function),
           cloneNode(node.typeArguments), cloneNode(node.argumentList));
 
   @override
   FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) =>
-      new FunctionTypeAlias(
+      astFactory.functionTypeAlias(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.typedefKeyword),
@@ -538,7 +542,7 @@
   @override
   FunctionTypedFormalParameter visitFunctionTypedFormalParameter(
           FunctionTypedFormalParameter node) =>
-      new FunctionTypedFormalParameter(
+      astFactory.functionTypedFormalParameter(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneNode(node.returnType),
@@ -547,11 +551,32 @@
           cloneNode(node.parameters));
 
   @override
-  HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator(
-      cloneToken(node.keyword), cloneNodeList(node.hiddenNames));
+  AstNode visitGenericFunctionType(GenericFunctionType node) =>
+      astFactory.genericFunctionType(
+          cloneNode(node.returnType),
+          cloneToken(node.functionKeyword),
+          cloneNode(node.typeParameters),
+          cloneNode(node.parameters));
 
   @override
-  IfStatement visitIfStatement(IfStatement node) => new IfStatement(
+  AstNode visitGenericTypeAlias(GenericTypeAlias node) =>
+      astFactory.genericTypeAlias(
+          cloneNode(node.documentationComment),
+          cloneNodeList(node.metadata),
+          cloneToken(node.typedefKeyword),
+          cloneNode(node.name),
+          cloneNode(node.typeParameters),
+          cloneToken(node.equals),
+          cloneNode(node.functionType),
+          cloneToken(node.semicolon));
+
+  @override
+  HideCombinator visitHideCombinator(HideCombinator node) =>
+      astFactory.hideCombinator(
+          cloneToken(node.keyword), cloneNodeList(node.hiddenNames));
+
+  @override
+  IfStatement visitIfStatement(IfStatement node) => astFactory.ifStatement(
       cloneToken(node.ifKeyword),
       cloneToken(node.leftParenthesis),
       cloneNode(node.condition),
@@ -562,12 +587,12 @@
 
   @override
   ImplementsClause visitImplementsClause(ImplementsClause node) =>
-      new ImplementsClause(
+      astFactory.implementsClause(
           cloneToken(node.implementsKeyword), cloneNodeList(node.interfaces));
 
   @override
   ImportDirective visitImportDirective(ImportDirective node) {
-    ImportDirectiveImpl directive = new ImportDirective(
+    ImportDirectiveImpl directive = astFactory.importDirective(
         cloneNode(node.documentationComment),
         cloneNodeList(node.metadata),
         cloneToken(node.keyword),
@@ -589,13 +614,13 @@
   IndexExpression visitIndexExpression(IndexExpression node) {
     Token period = node.period;
     if (period == null) {
-      return new IndexExpression.forTarget(
+      return astFactory.indexExpressionForTarget(
           cloneNode(node.target),
           cloneToken(node.leftBracket),
           cloneNode(node.index),
           cloneToken(node.rightBracket));
     } else {
-      return new IndexExpression.forCascade(
+      return astFactory.indexExpressionForCascade(
           cloneToken(period),
           cloneToken(node.leftBracket),
           cloneNode(node.index),
@@ -606,25 +631,25 @@
   @override
   InstanceCreationExpression visitInstanceCreationExpression(
           InstanceCreationExpression node) =>
-      new InstanceCreationExpression(cloneToken(node.keyword),
+      astFactory.instanceCreationExpression(cloneToken(node.keyword),
           cloneNode(node.constructorName), cloneNode(node.argumentList));
 
   @override
   IntegerLiteral visitIntegerLiteral(IntegerLiteral node) =>
-      new IntegerLiteral(cloneToken(node.literal), node.value);
+      astFactory.integerLiteral(cloneToken(node.literal), node.value);
 
   @override
   InterpolationExpression visitInterpolationExpression(
           InterpolationExpression node) =>
-      new InterpolationExpression(cloneToken(node.leftBracket),
+      astFactory.interpolationExpression(cloneToken(node.leftBracket),
           cloneNode(node.expression), cloneToken(node.rightBracket));
 
   @override
   InterpolationString visitInterpolationString(InterpolationString node) =>
-      new InterpolationString(cloneToken(node.contents), node.value);
+      astFactory.interpolationString(cloneToken(node.contents), node.value);
 
   @override
-  IsExpression visitIsExpression(IsExpression node) => new IsExpression(
+  IsExpression visitIsExpression(IsExpression node) => astFactory.isExpression(
       cloneNode(node.expression),
       cloneToken(node.isOperator),
       cloneToken(node.notOperator),
@@ -632,16 +657,15 @@
 
   @override
   Label visitLabel(Label node) =>
-      new Label(cloneNode(node.label), cloneToken(node.colon));
+      astFactory.label(cloneNode(node.label), cloneToken(node.colon));
 
   @override
-  LabeledStatement visitLabeledStatement(LabeledStatement node) =>
-      new LabeledStatement(
-          cloneNodeList(node.labels), cloneNode(node.statement));
+  LabeledStatement visitLabeledStatement(LabeledStatement node) => astFactory
+      .labeledStatement(cloneNodeList(node.labels), cloneNode(node.statement));
 
   @override
   LibraryDirective visitLibraryDirective(LibraryDirective node) =>
-      new LibraryDirective(
+      astFactory.libraryDirective(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.libraryKeyword),
@@ -650,10 +674,10 @@
 
   @override
   LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node) =>
-      new LibraryIdentifier(cloneNodeList(node.components));
+      astFactory.libraryIdentifier(cloneNodeList(node.components));
 
   @override
-  ListLiteral visitListLiteral(ListLiteral node) => new ListLiteral(
+  ListLiteral visitListLiteral(ListLiteral node) => astFactory.listLiteral(
       cloneToken(node.constKeyword),
       cloneNode(node.typeArguments),
       cloneToken(node.leftBracket),
@@ -661,7 +685,7 @@
       cloneToken(node.rightBracket));
 
   @override
-  MapLiteral visitMapLiteral(MapLiteral node) => new MapLiteral(
+  MapLiteral visitMapLiteral(MapLiteral node) => astFactory.mapLiteral(
       cloneToken(node.constKeyword),
       cloneNode(node.typeArguments),
       cloneToken(node.leftBracket),
@@ -670,12 +694,12 @@
 
   @override
   MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) =>
-      new MapLiteralEntry(cloneNode(node.key), cloneToken(node.separator),
-          cloneNode(node.value));
+      astFactory.mapLiteralEntry(cloneNode(node.key),
+          cloneToken(node.separator), cloneNode(node.value));
 
   @override
   MethodDeclaration visitMethodDeclaration(MethodDeclaration node) =>
-      new MethodDeclaration(
+      astFactory.methodDeclaration(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.externalKeyword),
@@ -690,7 +714,7 @@
 
   @override
   MethodInvocation visitMethodInvocation(MethodInvocation node) =>
-      new MethodInvocation(
+      astFactory.methodInvocation(
           cloneNode(node.target),
           cloneToken(node.operator),
           cloneNode(node.methodName),
@@ -698,31 +722,31 @@
           cloneNode(node.argumentList));
 
   @override
-  NamedExpression visitNamedExpression(NamedExpression node) =>
-      new NamedExpression(cloneNode(node.name), cloneNode(node.expression));
+  NamedExpression visitNamedExpression(NamedExpression node) => astFactory
+      .namedExpression(cloneNode(node.name), cloneNode(node.expression));
 
   @override
-  AstNode visitNativeClause(NativeClause node) =>
-      new NativeClause(cloneToken(node.nativeKeyword), cloneNode(node.name));
+  AstNode visitNativeClause(NativeClause node) => astFactory.nativeClause(
+      cloneToken(node.nativeKeyword), cloneNode(node.name));
 
   @override
   NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) =>
-      new NativeFunctionBody(cloneToken(node.nativeKeyword),
+      astFactory.nativeFunctionBody(cloneToken(node.nativeKeyword),
           cloneNode(node.stringLiteral), cloneToken(node.semicolon));
 
   @override
   NullLiteral visitNullLiteral(NullLiteral node) =>
-      new NullLiteral(cloneToken(node.literal));
+      astFactory.nullLiteral(cloneToken(node.literal));
 
   @override
   ParenthesizedExpression visitParenthesizedExpression(
           ParenthesizedExpression node) =>
-      new ParenthesizedExpression(cloneToken(node.leftParenthesis),
+      astFactory.parenthesizedExpression(cloneToken(node.leftParenthesis),
           cloneNode(node.expression), cloneToken(node.rightParenthesis));
 
   @override
   PartDirective visitPartDirective(PartDirective node) {
-    PartDirective directive = new PartDirective(
+    PartDirective directive = astFactory.partDirective(
         cloneNode(node.documentationComment),
         cloneNodeList(node.metadata),
         cloneToken(node.partKeyword),
@@ -735,7 +759,7 @@
 
   @override
   PartOfDirective visitPartOfDirective(PartOfDirective node) =>
-      new PartOfDirective(
+      astFactory.partOfDirective(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.partKeyword),
@@ -745,28 +769,27 @@
           cloneToken(node.semicolon));
 
   @override
-  PostfixExpression visitPostfixExpression(PostfixExpression node) =>
-      new PostfixExpression(cloneNode(node.operand), cloneToken(node.operator));
+  PostfixExpression visitPostfixExpression(PostfixExpression node) => astFactory
+      .postfixExpression(cloneNode(node.operand), cloneToken(node.operator));
 
   @override
   PrefixedIdentifier visitPrefixedIdentifier(PrefixedIdentifier node) =>
-      new PrefixedIdentifier(cloneNode(node.prefix), cloneToken(node.period),
-          cloneNode(node.identifier));
+      astFactory.prefixedIdentifier(cloneNode(node.prefix),
+          cloneToken(node.period), cloneNode(node.identifier));
 
   @override
-  PrefixExpression visitPrefixExpression(PrefixExpression node) =>
-      new PrefixExpression(cloneToken(node.operator), cloneNode(node.operand));
+  PrefixExpression visitPrefixExpression(PrefixExpression node) => astFactory
+      .prefixExpression(cloneToken(node.operator), cloneNode(node.operand));
 
   @override
-  PropertyAccess visitPropertyAccess(PropertyAccess node) => new PropertyAccess(
-      cloneNode(node.target),
-      cloneToken(node.operator),
-      cloneNode(node.propertyName));
+  PropertyAccess visitPropertyAccess(PropertyAccess node) =>
+      astFactory.propertyAccess(cloneNode(node.target),
+          cloneToken(node.operator), cloneNode(node.propertyName));
 
   @override
   RedirectingConstructorInvocation visitRedirectingConstructorInvocation(
           RedirectingConstructorInvocation node) =>
-      new RedirectingConstructorInvocation(
+      astFactory.redirectingConstructorInvocation(
           cloneToken(node.thisKeyword),
           cloneToken(node.period),
           cloneNode(node.constructorName),
@@ -774,25 +797,25 @@
 
   @override
   RethrowExpression visitRethrowExpression(RethrowExpression node) =>
-      new RethrowExpression(cloneToken(node.rethrowKeyword));
+      astFactory.rethrowExpression(cloneToken(node.rethrowKeyword));
 
   @override
   ReturnStatement visitReturnStatement(ReturnStatement node) =>
-      new ReturnStatement(cloneToken(node.returnKeyword),
+      astFactory.returnStatement(cloneToken(node.returnKeyword),
           cloneNode(node.expression), cloneToken(node.semicolon));
 
   @override
   ScriptTag visitScriptTag(ScriptTag node) =>
-      new ScriptTag(cloneToken(node.scriptTag));
+      astFactory.scriptTag(cloneToken(node.scriptTag));
 
   @override
-  ShowCombinator visitShowCombinator(ShowCombinator node) => new ShowCombinator(
-      cloneToken(node.keyword), cloneNodeList(node.shownNames));
+  ShowCombinator visitShowCombinator(ShowCombinator node) => astFactory
+      .showCombinator(cloneToken(node.keyword), cloneNodeList(node.shownNames));
 
   @override
   SimpleFormalParameter visitSimpleFormalParameter(
           SimpleFormalParameter node) =>
-      new SimpleFormalParameter(
+      astFactory.simpleFormalParameter(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.keyword),
@@ -801,21 +824,21 @@
 
   @override
   SimpleIdentifier visitSimpleIdentifier(SimpleIdentifier node) =>
-      new SimpleIdentifier(cloneToken(node.token),
+      astFactory.simpleIdentifier(cloneToken(node.token),
           isDeclaration: node.inDeclarationContext());
 
   @override
   SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) =>
-      new SimpleStringLiteral(cloneToken(node.literal), node.value);
+      astFactory.simpleStringLiteral(cloneToken(node.literal), node.value);
 
   @override
   StringInterpolation visitStringInterpolation(StringInterpolation node) =>
-      new StringInterpolation(cloneNodeList(node.elements));
+      astFactory.stringInterpolation(cloneNodeList(node.elements));
 
   @override
   SuperConstructorInvocation visitSuperConstructorInvocation(
           SuperConstructorInvocation node) =>
-      new SuperConstructorInvocation(
+      astFactory.superConstructorInvocation(
           cloneToken(node.superKeyword),
           cloneToken(node.period),
           cloneNode(node.constructorName),
@@ -823,10 +846,10 @@
 
   @override
   SuperExpression visitSuperExpression(SuperExpression node) =>
-      new SuperExpression(cloneToken(node.superKeyword));
+      astFactory.superExpression(cloneToken(node.superKeyword));
 
   @override
-  SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase(
+  SwitchCase visitSwitchCase(SwitchCase node) => astFactory.switchCase(
       cloneNodeList(node.labels),
       cloneToken(node.keyword),
       cloneNode(node.expression),
@@ -834,15 +857,16 @@
       cloneNodeList(node.statements));
 
   @override
-  SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault(
-      cloneNodeList(node.labels),
-      cloneToken(node.keyword),
-      cloneToken(node.colon),
-      cloneNodeList(node.statements));
+  SwitchDefault visitSwitchDefault(SwitchDefault node) =>
+      astFactory.switchDefault(
+          cloneNodeList(node.labels),
+          cloneToken(node.keyword),
+          cloneToken(node.colon),
+          cloneNodeList(node.statements));
 
   @override
   SwitchStatement visitSwitchStatement(SwitchStatement node) =>
-      new SwitchStatement(
+      astFactory.switchStatement(
           cloneToken(node.switchKeyword),
           cloneToken(node.leftParenthesis),
           cloneNode(node.expression),
@@ -852,29 +876,30 @@
           cloneToken(node.rightBracket));
 
   @override
-  SymbolLiteral visitSymbolLiteral(SymbolLiteral node) => new SymbolLiteral(
-      cloneToken(node.poundSign), cloneTokenList(node.components));
+  SymbolLiteral visitSymbolLiteral(SymbolLiteral node) =>
+      astFactory.symbolLiteral(
+          cloneToken(node.poundSign), cloneTokenList(node.components));
 
   @override
   ThisExpression visitThisExpression(ThisExpression node) =>
-      new ThisExpression(cloneToken(node.thisKeyword));
+      astFactory.thisExpression(cloneToken(node.thisKeyword));
 
   @override
   ThrowExpression visitThrowExpression(ThrowExpression node) =>
-      new ThrowExpression(
+      astFactory.throwExpression(
           cloneToken(node.throwKeyword), cloneNode(node.expression));
 
   @override
   TopLevelVariableDeclaration visitTopLevelVariableDeclaration(
           TopLevelVariableDeclaration node) =>
-      new TopLevelVariableDeclaration(
+      astFactory.topLevelVariableDeclaration(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneNode(node.variables),
           cloneToken(node.semicolon));
 
   @override
-  TryStatement visitTryStatement(TryStatement node) => new TryStatement(
+  TryStatement visitTryStatement(TryStatement node) => astFactory.tryStatement(
       cloneToken(node.tryKeyword),
       cloneNode(node.body),
       cloneNodeList(node.catchClauses),
@@ -883,35 +908,36 @@
 
   @override
   TypeArgumentList visitTypeArgumentList(TypeArgumentList node) =>
-      new TypeArgumentList(cloneToken(node.leftBracket),
+      astFactory.typeArgumentList(cloneToken(node.leftBracket),
           cloneNodeList(node.arguments), cloneToken(node.rightBracket));
 
   @override
   TypeName visitTypeName(TypeName node) =>
-      new TypeName(cloneNode(node.name), cloneNode(node.typeArguments));
+      astFactory.typeName(cloneNode(node.name), cloneNode(node.typeArguments));
 
   @override
-  TypeParameter visitTypeParameter(TypeParameter node) => new TypeParameter(
-      cloneNode(node.documentationComment),
-      cloneNodeList(node.metadata),
-      cloneNode(node.name),
-      cloneToken(node.extendsKeyword),
-      cloneNode(node.bound));
+  TypeParameter visitTypeParameter(TypeParameter node) =>
+      astFactory.typeParameter(
+          cloneNode(node.documentationComment),
+          cloneNodeList(node.metadata),
+          cloneNode(node.name),
+          cloneToken(node.extendsKeyword),
+          cloneNode(node.bound));
 
   @override
   TypeParameterList visitTypeParameterList(TypeParameterList node) =>
-      new TypeParameterList(cloneToken(node.leftBracket),
+      astFactory.typeParameterList(cloneToken(node.leftBracket),
           cloneNodeList(node.typeParameters), cloneToken(node.rightBracket));
 
   @override
   VariableDeclaration visitVariableDeclaration(VariableDeclaration node) =>
-      new VariableDeclaration(cloneNode(node.name), cloneToken(node.equals),
-          cloneNode(node.initializer));
+      astFactory.variableDeclaration(cloneNode(node.name),
+          cloneToken(node.equals), cloneNode(node.initializer));
 
   @override
   VariableDeclarationList visitVariableDeclarationList(
           VariableDeclarationList node) =>
-      new VariableDeclarationList(
+      astFactory.variableDeclarationList(
           cloneNode(node.documentationComment),
           cloneNodeList(node.metadata),
           cloneToken(node.keyword),
@@ -921,27 +947,29 @@
   @override
   VariableDeclarationStatement visitVariableDeclarationStatement(
           VariableDeclarationStatement node) =>
-      new VariableDeclarationStatement(
+      astFactory.variableDeclarationStatement(
           cloneNode(node.variables), cloneToken(node.semicolon));
 
   @override
-  WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement(
-      cloneToken(node.whileKeyword),
-      cloneToken(node.leftParenthesis),
-      cloneNode(node.condition),
-      cloneToken(node.rightParenthesis),
-      cloneNode(node.body));
+  WhileStatement visitWhileStatement(WhileStatement node) =>
+      astFactory.whileStatement(
+          cloneToken(node.whileKeyword),
+          cloneToken(node.leftParenthesis),
+          cloneNode(node.condition),
+          cloneToken(node.rightParenthesis),
+          cloneNode(node.body));
 
   @override
-  WithClause visitWithClause(WithClause node) => new WithClause(
+  WithClause visitWithClause(WithClause node) => astFactory.withClause(
       cloneToken(node.withKeyword), cloneNodeList(node.mixinTypes));
 
   @override
-  YieldStatement visitYieldStatement(YieldStatement node) => new YieldStatement(
-      cloneToken(node.yieldKeyword),
-      cloneToken(node.star),
-      cloneNode(node.expression),
-      cloneToken(node.semicolon));
+  YieldStatement visitYieldStatement(YieldStatement node) =>
+      astFactory.yieldStatement(
+          cloneToken(node.yieldKeyword),
+          cloneToken(node.star),
+          cloneNode(node.expression),
+          cloneToken(node.semicolon));
 
   /**
    * Clone all token starting from the given [token] up to a token that has
@@ -1580,6 +1608,28 @@
   }
 
   @override
+  bool visitGenericFunctionType(GenericFunctionType node) {
+    GenericFunctionType other = _other as GenericFunctionType;
+    return isEqualNodes(node.returnType, other.returnType) &&
+        isEqualTokens(node.functionKeyword, other.functionKeyword) &&
+        isEqualNodes(node.typeParameters, other.typeParameters) &&
+        isEqualNodes(node.parameters, other.parameters);
+  }
+
+  @override
+  bool visitGenericTypeAlias(GenericTypeAlias node) {
+    GenericTypeAlias other = _other as GenericTypeAlias;
+    return isEqualNodes(
+            node.documentationComment, other.documentationComment) &&
+        _isEqualNodeLists(node.metadata, other.metadata) &&
+        isEqualTokens(node.typedefKeyword, other.typedefKeyword) &&
+        isEqualNodes(node.name, other.name) &&
+        isEqualNodes(node.typeParameters, other.typeParameters) &&
+        isEqualTokens(node.equals, other.equals) &&
+        isEqualNodes(node.functionType, other.functionType);
+  }
+
+  @override
   bool visitHideCombinator(HideCombinator node) {
     HideCombinator other = _other as HideCombinator;
     return isEqualTokens(node.keyword, other.keyword) &&
@@ -2182,16 +2232,21 @@
  * >   expressions that evaluate to an integer value or to <b>null</b>.
  * >   </span>
  * > * <span>
- * >   An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub> +
- * >   e<sub>2</sub></i>, <i>e<sub>1</sub> -e<sub>2</sub></i>,
- * >   <i>e<sub>1</sub> * e<sub>2</sub></i>, <i>e<sub>1</sub> /
- * >   e<sub>2</sub></i>, <i>e<sub>1</sub> ~/ e<sub>2</sub></i>,
- * >   <i>e<sub>1</sub> &gt; e<sub>2</sub></i>, <i>e<sub>1</sub> &lt;
- * >   e<sub>2</sub></i>, <i>e<sub>1</sub> &gt;= e<sub>2</sub></i>,
- * >   <i>e<sub>1</sub> &lt;= e<sub>2</sub></i> or <i>e<sub>1</sub> %
- * >   e<sub>2</sub></i>, where <i>e</i>, <i>e<sub>1</sub></i> and
- * >   <i>e<sub>2</sub></i> are constant expressions that evaluate to a numeric
- * >   value or to <b>null</b>.
+ * >   An expression of one of the forms <i>-e</i>, <i>e<sub>1</sub>
+ * >   -e<sub>2</sub></i>, <i>e<sub>1</sub> * e<sub>2</sub></i>,
+ * >   <i>e<sub>1</sub> / e<sub>2</sub></i>, <i>e<sub>1</sub> ~/
+ * >   e<sub>2</sub></i>, <i>e<sub>1</sub> &gt; e<sub>2</sub></i>,
+ * >   <i>e<sub>1</sub> &lt; e<sub>2</sub></i>, <i>e<sub>1</sub> &gt;=
+ * >   e<sub>2</sub></i>, <i>e<sub>1</sub> &lt;= e<sub>2</sub></i> or
+ * >   <i>e<sub>1</sub> % e<sub>2</sub></i>, where <i>e</i>,
+ * >   <i>e<sub>1</sub></i> and <i>e<sub>2</sub></i> are constant expressions
+ * >   that evaluate to a numeric value or to <b>null</b>.
+ * >   </span>
+ * > * <span>
+ * >   An expression of one the form <i>e<sub>1</sub> + e<sub>2</sub></i>,
+ * >   <i>e<sub>1</sub> -e<sub>2</sub></i> where <i>e<sub>1</sub> and
+ * >   e<sub>2</sub></i> are constant expressions that evaluate to a numeric or
+ * >   string value or to <b>null</b>.
  * >   </span>
  * > * <span>
  * >   An expression of the form <i>e<sub>1</sub> ? e<sub>2</sub> :
@@ -2200,6 +2255,8 @@
  * >   evaluates to a boolean value.
  * >   </span>
  *
+ * However, this comment is now at least a little bit out of sync with the spec.
+ *
  * The values returned by instances of this class are therefore `null` and
  * instances of the classes `Boolean`, `BigInteger`, `Double`, `String`, and
  * `DartObject`.
@@ -2327,6 +2384,9 @@
         if (leftOperand is num && rightOperand is num) {
           return leftOperand + rightOperand;
         }
+        if (leftOperand is String && rightOperand is String) {
+          return leftOperand + rightOperand;
+        }
       } else if (node.operator.type == TokenType.STAR) {
         // numeric or {@code null}
         if (leftOperand is num && rightOperand is num) {
@@ -2755,11 +2815,11 @@
 
   @override
   AdjacentStrings visitAdjacentStrings(AdjacentStrings node) =>
-      new AdjacentStrings(_cloneNodeList(node.strings));
+      astFactory.adjacentStrings(_cloneNodeList(node.strings));
 
   @override
   Annotation visitAnnotation(Annotation node) {
-    Annotation copy = new Annotation(
+    Annotation copy = astFactory.annotation(
         _mapToken(node.atSign),
         _cloneNode(node.name),
         _mapToken(node.period),
@@ -2770,14 +2830,14 @@
   }
 
   @override
-  ArgumentList visitArgumentList(ArgumentList node) => new ArgumentList(
+  ArgumentList visitArgumentList(ArgumentList node) => astFactory.argumentList(
       _mapToken(node.leftParenthesis),
       _cloneNodeList(node.arguments),
       _mapToken(node.rightParenthesis));
 
   @override
   AsExpression visitAsExpression(AsExpression node) {
-    AsExpression copy = new AsExpression(_cloneNode(node.expression),
+    AsExpression copy = astFactory.asExpression(_cloneNode(node.expression),
         _mapToken(node.asOperator), _cloneNode(node.type));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
@@ -2786,7 +2846,7 @@
 
   @override
   AstNode visitAssertInitializer(AssertInitializer node) =>
-      new AssertInitializer(
+      astFactory.assertInitializer(
           _mapToken(node.assertKeyword),
           _mapToken(node.leftParenthesis),
           _cloneNode(node.condition),
@@ -2795,18 +2855,19 @@
           _mapToken(node.rightParenthesis));
 
   @override
-  AstNode visitAssertStatement(AssertStatement node) => new AssertStatement(
-      _mapToken(node.assertKeyword),
-      _mapToken(node.leftParenthesis),
-      _cloneNode(node.condition),
-      _mapToken(node.comma),
-      _cloneNode(node.message),
-      _mapToken(node.rightParenthesis),
-      _mapToken(node.semicolon));
+  AstNode visitAssertStatement(AssertStatement node) =>
+      astFactory.assertStatement(
+          _mapToken(node.assertKeyword),
+          _mapToken(node.leftParenthesis),
+          _cloneNode(node.condition),
+          _mapToken(node.comma),
+          _cloneNode(node.message),
+          _mapToken(node.rightParenthesis),
+          _mapToken(node.semicolon));
 
   @override
   AssignmentExpression visitAssignmentExpression(AssignmentExpression node) {
-    AssignmentExpression copy = new AssignmentExpression(
+    AssignmentExpression copy = astFactory.assignmentExpression(
         _cloneNode(node.leftHandSide),
         _mapToken(node.operator),
         _cloneNode(node.rightHandSide));
@@ -2819,13 +2880,15 @@
 
   @override
   AwaitExpression visitAwaitExpression(AwaitExpression node) =>
-      new AwaitExpression(
+      astFactory.awaitExpression(
           _mapToken(node.awaitKeyword), _cloneNode(node.expression));
 
   @override
   BinaryExpression visitBinaryExpression(BinaryExpression node) {
-    BinaryExpression copy = new BinaryExpression(_cloneNode(node.leftOperand),
-        _mapToken(node.operator), _cloneNode(node.rightOperand));
+    BinaryExpression copy = astFactory.binaryExpression(
+        _cloneNode(node.leftOperand),
+        _mapToken(node.operator),
+        _cloneNode(node.rightOperand));
     copy.propagatedElement = node.propagatedElement;
     copy.propagatedType = node.propagatedType;
     copy.staticElement = node.staticElement;
@@ -2834,32 +2897,31 @@
   }
 
   @override
-  Block visitBlock(Block node) => new Block(_mapToken(node.leftBracket),
+  Block visitBlock(Block node) => astFactory.block(_mapToken(node.leftBracket),
       _cloneNodeList(node.statements), _mapToken(node.rightBracket));
 
   @override
   BlockFunctionBody visitBlockFunctionBody(BlockFunctionBody node) =>
-      new BlockFunctionBody(_mapToken(node.keyword), _mapToken(node.star),
-          _cloneNode(node.block));
+      astFactory.blockFunctionBody(_mapToken(node.keyword),
+          _mapToken(node.star), _cloneNode(node.block));
 
   @override
   BooleanLiteral visitBooleanLiteral(BooleanLiteral node) {
     BooleanLiteral copy =
-        new BooleanLiteral(_mapToken(node.literal), node.value);
+        astFactory.booleanLiteral(_mapToken(node.literal), node.value);
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
   }
 
   @override
-  BreakStatement visitBreakStatement(BreakStatement node) => new BreakStatement(
-      _mapToken(node.breakKeyword),
-      _cloneNode(node.label),
-      _mapToken(node.semicolon));
+  BreakStatement visitBreakStatement(BreakStatement node) =>
+      astFactory.breakStatement(_mapToken(node.breakKeyword),
+          _cloneNode(node.label), _mapToken(node.semicolon));
 
   @override
   CascadeExpression visitCascadeExpression(CascadeExpression node) {
-    CascadeExpression copy = new CascadeExpression(
+    CascadeExpression copy = astFactory.cascadeExpression(
         _cloneNode(node.target), _cloneNodeList(node.cascadeSections));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
@@ -2867,7 +2929,7 @@
   }
 
   @override
-  CatchClause visitCatchClause(CatchClause node) => new CatchClause(
+  CatchClause visitCatchClause(CatchClause node) => astFactory.catchClause(
       _mapToken(node.onKeyword),
       _cloneNode(node.exceptionType),
       _mapToken(node.catchKeyword),
@@ -2880,7 +2942,7 @@
 
   @override
   ClassDeclaration visitClassDeclaration(ClassDeclaration node) {
-    ClassDeclaration copy = new ClassDeclaration(
+    ClassDeclaration copy = astFactory.classDeclaration(
         _cloneNode(node.documentationComment),
         _cloneNodeList(node.metadata),
         _mapToken(node.abstractKeyword),
@@ -2898,38 +2960,39 @@
   }
 
   @override
-  ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) => new ClassTypeAlias(
-      _cloneNode(node.documentationComment),
-      _cloneNodeList(node.metadata),
-      _mapToken(node.typedefKeyword),
-      _cloneNode(node.name),
-      _cloneNode(node.typeParameters),
-      _mapToken(node.equals),
-      _mapToken(node.abstractKeyword),
-      _cloneNode(node.superclass),
-      _cloneNode(node.withClause),
-      _cloneNode(node.implementsClause),
-      _mapToken(node.semicolon));
+  ClassTypeAlias visitClassTypeAlias(ClassTypeAlias node) =>
+      astFactory.classTypeAlias(
+          _cloneNode(node.documentationComment),
+          _cloneNodeList(node.metadata),
+          _mapToken(node.typedefKeyword),
+          _cloneNode(node.name),
+          _cloneNode(node.typeParameters),
+          _mapToken(node.equals),
+          _mapToken(node.abstractKeyword),
+          _cloneNode(node.superclass),
+          _cloneNode(node.withClause),
+          _cloneNode(node.implementsClause),
+          _mapToken(node.semicolon));
 
   @override
   Comment visitComment(Comment node) {
     if (node.isDocumentation) {
-      return Comment.createDocumentationCommentWithReferences(
+      return astFactory.documentationComment(
           _mapTokens(node.tokens), _cloneNodeList(node.references));
     } else if (node.isBlock) {
-      return Comment.createBlockComment(_mapTokens(node.tokens));
+      return astFactory.blockComment(_mapTokens(node.tokens));
     }
-    return Comment.createEndOfLineComment(_mapTokens(node.tokens));
+    return astFactory.endOfLineComment(_mapTokens(node.tokens));
   }
 
   @override
   CommentReference visitCommentReference(CommentReference node) =>
-      new CommentReference(
+      astFactory.commentReference(
           _mapToken(node.newKeyword), _cloneNode(node.identifier));
 
   @override
   CompilationUnit visitCompilationUnit(CompilationUnit node) {
-    CompilationUnit copy = new CompilationUnit(
+    CompilationUnit copy = astFactory.compilationUnit(
         _mapToken(node.beginToken),
         _cloneNode(node.scriptTag),
         _cloneNodeList(node.directives),
@@ -2942,7 +3005,7 @@
 
   @override
   ConditionalExpression visitConditionalExpression(ConditionalExpression node) {
-    ConditionalExpression copy = new ConditionalExpression(
+    ConditionalExpression copy = astFactory.conditionalExpression(
         _cloneNode(node.condition),
         _mapToken(node.question),
         _cloneNode(node.thenExpression),
@@ -2954,19 +3017,20 @@
   }
 
   @override
-  Configuration visitConfiguration(Configuration node) => new Configuration(
-      _mapToken(node.ifKeyword),
-      _mapToken(node.leftParenthesis),
-      _cloneNode(node.name),
-      _mapToken(node.equalToken),
-      _cloneNode(node.value),
-      _mapToken(node.rightParenthesis),
-      _cloneNode(node.uri));
+  Configuration visitConfiguration(Configuration node) =>
+      astFactory.configuration(
+          _mapToken(node.ifKeyword),
+          _mapToken(node.leftParenthesis),
+          _cloneNode(node.name),
+          _mapToken(node.equalToken),
+          _cloneNode(node.value),
+          _mapToken(node.rightParenthesis),
+          _cloneNode(node.uri));
 
   @override
   ConstructorDeclaration visitConstructorDeclaration(
       ConstructorDeclaration node) {
-    ConstructorDeclaration copy = new ConstructorDeclaration(
+    ConstructorDeclaration copy = astFactory.constructorDeclaration(
         _cloneNode(node.documentationComment),
         _cloneNodeList(node.metadata),
         _mapToken(node.externalKeyword),
@@ -2987,7 +3051,7 @@
   @override
   ConstructorFieldInitializer visitConstructorFieldInitializer(
           ConstructorFieldInitializer node) =>
-      new ConstructorFieldInitializer(
+      astFactory.constructorFieldInitializer(
           _mapToken(node.thisKeyword),
           _mapToken(node.period),
           _cloneNode(node.fieldName),
@@ -2996,7 +3060,7 @@
 
   @override
   ConstructorName visitConstructorName(ConstructorName node) {
-    ConstructorName copy = new ConstructorName(
+    ConstructorName copy = astFactory.constructorName(
         _cloneNode(node.type), _mapToken(node.period), _cloneNode(node.name));
     copy.staticElement = node.staticElement;
     return copy;
@@ -3004,12 +3068,12 @@
 
   @override
   ContinueStatement visitContinueStatement(ContinueStatement node) =>
-      new ContinueStatement(_mapToken(node.continueKeyword),
+      astFactory.continueStatement(_mapToken(node.continueKeyword),
           _cloneNode(node.label), _mapToken(node.semicolon));
 
   @override
   DeclaredIdentifier visitDeclaredIdentifier(DeclaredIdentifier node) =>
-      new DeclaredIdentifier(
+      astFactory.declaredIdentifier(
           _cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata),
           _mapToken(node.keyword),
@@ -3019,11 +3083,11 @@
   @override
   DefaultFormalParameter visitDefaultFormalParameter(
           DefaultFormalParameter node) =>
-      new DefaultFormalParameter(_cloneNode(node.parameter), node.kind,
+      astFactory.defaultFormalParameter(_cloneNode(node.parameter), node.kind,
           _mapToken(node.separator), _cloneNode(node.defaultValue));
 
   @override
-  DoStatement visitDoStatement(DoStatement node) => new DoStatement(
+  DoStatement visitDoStatement(DoStatement node) => astFactory.doStatement(
       _mapToken(node.doKeyword),
       _cloneNode(node.body),
       _mapToken(node.whileKeyword),
@@ -3034,11 +3098,12 @@
 
   @override
   DottedName visitDottedName(DottedName node) =>
-      new DottedName(_cloneNodeList(node.components));
+      astFactory.dottedName(_cloneNodeList(node.components));
 
   @override
   DoubleLiteral visitDoubleLiteral(DoubleLiteral node) {
-    DoubleLiteral copy = new DoubleLiteral(_mapToken(node.literal), node.value);
+    DoubleLiteral copy =
+        astFactory.doubleLiteral(_mapToken(node.literal), node.value);
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
@@ -3046,30 +3111,31 @@
 
   @override
   EmptyFunctionBody visitEmptyFunctionBody(EmptyFunctionBody node) =>
-      new EmptyFunctionBody(_mapToken(node.semicolon));
+      astFactory.emptyFunctionBody(_mapToken(node.semicolon));
 
   @override
   EmptyStatement visitEmptyStatement(EmptyStatement node) =>
-      new EmptyStatement(_mapToken(node.semicolon));
+      astFactory.emptyStatement(_mapToken(node.semicolon));
 
   @override
   AstNode visitEnumConstantDeclaration(EnumConstantDeclaration node) =>
-      new EnumConstantDeclaration(_cloneNode(node.documentationComment),
+      astFactory.enumConstantDeclaration(_cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata), _cloneNode(node.name));
 
   @override
-  AstNode visitEnumDeclaration(EnumDeclaration node) => new EnumDeclaration(
-      _cloneNode(node.documentationComment),
-      _cloneNodeList(node.metadata),
-      _mapToken(node.enumKeyword),
-      _cloneNode(node.name),
-      _mapToken(node.leftBracket),
-      _cloneNodeList(node.constants),
-      _mapToken(node.rightBracket));
+  AstNode visitEnumDeclaration(EnumDeclaration node) =>
+      astFactory.enumDeclaration(
+          _cloneNode(node.documentationComment),
+          _cloneNodeList(node.metadata),
+          _mapToken(node.enumKeyword),
+          _cloneNode(node.name),
+          _mapToken(node.leftBracket),
+          _cloneNodeList(node.constants),
+          _mapToken(node.rightBracket));
 
   @override
   ExportDirective visitExportDirective(ExportDirective node) {
-    ExportDirective copy = new ExportDirective(
+    ExportDirective copy = astFactory.exportDirective(
         _cloneNode(node.documentationComment),
         _cloneNodeList(node.metadata),
         _mapToken(node.keyword),
@@ -3084,7 +3150,7 @@
   @override
   ExpressionFunctionBody visitExpressionFunctionBody(
           ExpressionFunctionBody node) =>
-      new ExpressionFunctionBody(
+      astFactory.expressionFunctionBody(
           _mapToken(node.keyword),
           _mapToken(node.functionDefinition),
           _cloneNode(node.expression),
@@ -3092,16 +3158,17 @@
 
   @override
   ExpressionStatement visitExpressionStatement(ExpressionStatement node) =>
-      new ExpressionStatement(
+      astFactory.expressionStatement(
           _cloneNode(node.expression), _mapToken(node.semicolon));
 
   @override
-  ExtendsClause visitExtendsClause(ExtendsClause node) => new ExtendsClause(
-      _mapToken(node.extendsKeyword), _cloneNode(node.superclass));
+  ExtendsClause visitExtendsClause(ExtendsClause node) =>
+      astFactory.extendsClause(
+          _mapToken(node.extendsKeyword), _cloneNode(node.superclass));
 
   @override
   FieldDeclaration visitFieldDeclaration(FieldDeclaration node) =>
-      new FieldDeclaration(
+      astFactory.fieldDeclaration(
           _cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata),
           _mapToken(node.staticKeyword),
@@ -3110,7 +3177,7 @@
 
   @override
   FieldFormalParameter visitFieldFormalParameter(FieldFormalParameter node) =>
-      new FieldFormalParameter(
+      astFactory.fieldFormalParameter(
           _cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata),
           _mapToken(node.keyword),
@@ -3125,7 +3192,7 @@
   ForEachStatement visitForEachStatement(ForEachStatement node) {
     DeclaredIdentifier loopVariable = node.loopVariable;
     if (loopVariable == null) {
-      return new ForEachStatement.withReference(
+      return astFactory.forEachStatementWithReference(
           _mapToken(node.awaitKeyword),
           _mapToken(node.forKeyword),
           _mapToken(node.leftParenthesis),
@@ -3135,7 +3202,7 @@
           _mapToken(node.rightParenthesis),
           _cloneNode(node.body));
     }
-    return new ForEachStatement.withDeclaration(
+    return astFactory.forEachStatementWithDeclaration(
         _mapToken(node.awaitKeyword),
         _mapToken(node.forKeyword),
         _mapToken(node.leftParenthesis),
@@ -3148,7 +3215,7 @@
 
   @override
   FormalParameterList visitFormalParameterList(FormalParameterList node) =>
-      new FormalParameterList(
+      astFactory.formalParameterList(
           _mapToken(node.leftParenthesis),
           _cloneNodeList(node.parameters),
           _mapToken(node.leftDelimiter),
@@ -3156,7 +3223,7 @@
           _mapToken(node.rightParenthesis));
 
   @override
-  ForStatement visitForStatement(ForStatement node) => new ForStatement(
+  ForStatement visitForStatement(ForStatement node) => astFactory.forStatement(
       _mapToken(node.forKeyword),
       _mapToken(node.leftParenthesis),
       _cloneNode(node.variables),
@@ -3170,7 +3237,7 @@
 
   @override
   FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) =>
-      new FunctionDeclaration(
+      astFactory.functionDeclaration(
           _cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata),
           _mapToken(node.externalKeyword),
@@ -3182,11 +3249,12 @@
   @override
   FunctionDeclarationStatement visitFunctionDeclarationStatement(
           FunctionDeclarationStatement node) =>
-      new FunctionDeclarationStatement(_cloneNode(node.functionDeclaration));
+      astFactory
+          .functionDeclarationStatement(_cloneNode(node.functionDeclaration));
 
   @override
   FunctionExpression visitFunctionExpression(FunctionExpression node) {
-    FunctionExpression copy = new FunctionExpression(
+    FunctionExpression copy = astFactory.functionExpression(
         _cloneNode(node.typeParameters),
         _cloneNode(node.parameters),
         _cloneNode(node.body));
@@ -3199,7 +3267,7 @@
   @override
   FunctionExpressionInvocation visitFunctionExpressionInvocation(
       FunctionExpressionInvocation node) {
-    FunctionExpressionInvocation copy = new FunctionExpressionInvocation(
+    FunctionExpressionInvocation copy = astFactory.functionExpressionInvocation(
         _cloneNode(node.function),
         _cloneNode(node.typeArguments),
         _cloneNode(node.argumentList));
@@ -3212,7 +3280,7 @@
 
   @override
   FunctionTypeAlias visitFunctionTypeAlias(FunctionTypeAlias node) =>
-      new FunctionTypeAlias(
+      astFactory.functionTypeAlias(
           _cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata),
           _mapToken(node.typedefKeyword),
@@ -3225,7 +3293,7 @@
   @override
   FunctionTypedFormalParameter visitFunctionTypedFormalParameter(
           FunctionTypedFormalParameter node) =>
-      new FunctionTypedFormalParameter(
+      astFactory.functionTypedFormalParameter(
           _cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata),
           _cloneNode(node.returnType),
@@ -3234,11 +3302,32 @@
           _cloneNode(node.parameters));
 
   @override
-  HideCombinator visitHideCombinator(HideCombinator node) => new HideCombinator(
-      _mapToken(node.keyword), _cloneNodeList(node.hiddenNames));
+  AstNode visitGenericFunctionType(GenericFunctionType node) =>
+      astFactory.genericFunctionType(
+          _cloneNode(node.returnType),
+          _mapToken(node.functionKeyword),
+          _cloneNode(node.typeParameters),
+          _cloneNode(node.parameters));
 
   @override
-  IfStatement visitIfStatement(IfStatement node) => new IfStatement(
+  AstNode visitGenericTypeAlias(GenericTypeAlias node) =>
+      astFactory.genericTypeAlias(
+          _cloneNode(node.documentationComment),
+          _cloneNodeList(node.metadata),
+          _mapToken(node.typedefKeyword),
+          _cloneNode(node.name),
+          _cloneNode(node.typeParameters),
+          _mapToken(node.equals),
+          _cloneNode(node.functionType),
+          _mapToken(node.semicolon));
+
+  @override
+  HideCombinator visitHideCombinator(HideCombinator node) =>
+      astFactory.hideCombinator(
+          _mapToken(node.keyword), _cloneNodeList(node.hiddenNames));
+
+  @override
+  IfStatement visitIfStatement(IfStatement node) => astFactory.ifStatement(
       _mapToken(node.ifKeyword),
       _mapToken(node.leftParenthesis),
       _cloneNode(node.condition),
@@ -3249,12 +3338,12 @@
 
   @override
   ImplementsClause visitImplementsClause(ImplementsClause node) =>
-      new ImplementsClause(
+      astFactory.implementsClause(
           _mapToken(node.implementsKeyword), _cloneNodeList(node.interfaces));
 
   @override
   ImportDirective visitImportDirective(ImportDirective node) {
-    ImportDirective copy = new ImportDirective(
+    ImportDirective copy = astFactory.importDirective(
         _cloneNode(node.documentationComment),
         _cloneNodeList(node.metadata),
         _mapToken(node.keyword),
@@ -3274,14 +3363,17 @@
     Token period = _mapToken(node.period);
     IndexExpression copy;
     if (period == null) {
-      copy = new IndexExpression.forTarget(
+      copy = astFactory.indexExpressionForTarget(
           _cloneNode(node.target),
           _mapToken(node.leftBracket),
           _cloneNode(node.index),
           _mapToken(node.rightBracket));
     } else {
-      copy = new IndexExpression.forCascade(period, _mapToken(node.leftBracket),
-          _cloneNode(node.index), _mapToken(node.rightBracket));
+      copy = astFactory.indexExpressionForCascade(
+          period,
+          _mapToken(node.leftBracket),
+          _cloneNode(node.index),
+          _mapToken(node.rightBracket));
     }
     copy.auxiliaryElements = node.auxiliaryElements;
     copy.propagatedElement = node.propagatedElement;
@@ -3294,7 +3386,7 @@
   @override
   InstanceCreationExpression visitInstanceCreationExpression(
       InstanceCreationExpression node) {
-    InstanceCreationExpression copy = new InstanceCreationExpression(
+    InstanceCreationExpression copy = astFactory.instanceCreationExpression(
         _mapToken(node.keyword),
         _cloneNode(node.constructorName),
         _cloneNode(node.argumentList));
@@ -3307,7 +3399,7 @@
   @override
   IntegerLiteral visitIntegerLiteral(IntegerLiteral node) {
     IntegerLiteral copy =
-        new IntegerLiteral(_mapToken(node.literal), node.value);
+        astFactory.integerLiteral(_mapToken(node.literal), node.value);
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
@@ -3316,16 +3408,16 @@
   @override
   InterpolationExpression visitInterpolationExpression(
           InterpolationExpression node) =>
-      new InterpolationExpression(_mapToken(node.leftBracket),
+      astFactory.interpolationExpression(_mapToken(node.leftBracket),
           _cloneNode(node.expression), _mapToken(node.rightBracket));
 
   @override
   InterpolationString visitInterpolationString(InterpolationString node) =>
-      new InterpolationString(_mapToken(node.contents), node.value);
+      astFactory.interpolationString(_mapToken(node.contents), node.value);
 
   @override
   IsExpression visitIsExpression(IsExpression node) {
-    IsExpression copy = new IsExpression(
+    IsExpression copy = astFactory.isExpression(
         _cloneNode(node.expression),
         _mapToken(node.isOperator),
         _mapToken(node.notOperator),
@@ -3337,16 +3429,16 @@
 
   @override
   Label visitLabel(Label node) =>
-      new Label(_cloneNode(node.label), _mapToken(node.colon));
+      astFactory.label(_cloneNode(node.label), _mapToken(node.colon));
 
   @override
   LabeledStatement visitLabeledStatement(LabeledStatement node) =>
-      new LabeledStatement(
+      astFactory.labeledStatement(
           _cloneNodeList(node.labels), _cloneNode(node.statement));
 
   @override
   LibraryDirective visitLibraryDirective(LibraryDirective node) {
-    LibraryDirective copy = new LibraryDirective(
+    LibraryDirective copy = astFactory.libraryDirective(
         _cloneNode(node.documentationComment),
         _cloneNodeList(node.metadata),
         _mapToken(node.libraryKeyword),
@@ -3359,7 +3451,7 @@
   @override
   LibraryIdentifier visitLibraryIdentifier(LibraryIdentifier node) {
     LibraryIdentifier copy =
-        new LibraryIdentifier(_cloneNodeList(node.components));
+        astFactory.libraryIdentifier(_cloneNodeList(node.components));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
@@ -3367,7 +3459,7 @@
 
   @override
   ListLiteral visitListLiteral(ListLiteral node) {
-    ListLiteral copy = new ListLiteral(
+    ListLiteral copy = astFactory.listLiteral(
         _mapToken(node.constKeyword),
         _cloneNode(node.typeArguments),
         _mapToken(node.leftBracket),
@@ -3380,7 +3472,7 @@
 
   @override
   MapLiteral visitMapLiteral(MapLiteral node) {
-    MapLiteral copy = new MapLiteral(
+    MapLiteral copy = astFactory.mapLiteral(
         _mapToken(node.constKeyword),
         _cloneNode(node.typeArguments),
         _mapToken(node.leftBracket),
@@ -3393,12 +3485,12 @@
 
   @override
   MapLiteralEntry visitMapLiteralEntry(MapLiteralEntry node) =>
-      new MapLiteralEntry(_cloneNode(node.key), _mapToken(node.separator),
-          _cloneNode(node.value));
+      astFactory.mapLiteralEntry(_cloneNode(node.key),
+          _mapToken(node.separator), _cloneNode(node.value));
 
   @override
   MethodDeclaration visitMethodDeclaration(MethodDeclaration node) =>
-      new MethodDeclaration(
+      astFactory.methodDeclaration(
           _cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata),
           _mapToken(node.externalKeyword),
@@ -3413,7 +3505,7 @@
 
   @override
   MethodInvocation visitMethodInvocation(MethodInvocation node) {
-    MethodInvocation copy = new MethodInvocation(
+    MethodInvocation copy = astFactory.methodInvocation(
         _cloneNode(node.target),
         _mapToken(node.operator),
         _cloneNode(node.methodName),
@@ -3426,25 +3518,25 @@
 
   @override
   NamedExpression visitNamedExpression(NamedExpression node) {
-    NamedExpression copy =
-        new NamedExpression(_cloneNode(node.name), _cloneNode(node.expression));
+    NamedExpression copy = astFactory.namedExpression(
+        _cloneNode(node.name), _cloneNode(node.expression));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
   }
 
   @override
-  AstNode visitNativeClause(NativeClause node) =>
-      new NativeClause(_mapToken(node.nativeKeyword), _cloneNode(node.name));
+  AstNode visitNativeClause(NativeClause node) => astFactory.nativeClause(
+      _mapToken(node.nativeKeyword), _cloneNode(node.name));
 
   @override
   NativeFunctionBody visitNativeFunctionBody(NativeFunctionBody node) =>
-      new NativeFunctionBody(_mapToken(node.nativeKeyword),
+      astFactory.nativeFunctionBody(_mapToken(node.nativeKeyword),
           _cloneNode(node.stringLiteral), _mapToken(node.semicolon));
 
   @override
   NullLiteral visitNullLiteral(NullLiteral node) {
-    NullLiteral copy = new NullLiteral(_mapToken(node.literal));
+    NullLiteral copy = astFactory.nullLiteral(_mapToken(node.literal));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
@@ -3453,7 +3545,7 @@
   @override
   ParenthesizedExpression visitParenthesizedExpression(
       ParenthesizedExpression node) {
-    ParenthesizedExpression copy = new ParenthesizedExpression(
+    ParenthesizedExpression copy = astFactory.parenthesizedExpression(
         _mapToken(node.leftParenthesis),
         _cloneNode(node.expression),
         _mapToken(node.rightParenthesis));
@@ -3464,7 +3556,7 @@
 
   @override
   PartDirective visitPartDirective(PartDirective node) {
-    PartDirective copy = new PartDirective(
+    PartDirective copy = astFactory.partDirective(
         _cloneNode(node.documentationComment),
         _cloneNodeList(node.metadata),
         _mapToken(node.partKeyword),
@@ -3476,7 +3568,7 @@
 
   @override
   PartOfDirective visitPartOfDirective(PartOfDirective node) {
-    PartOfDirective copy = new PartOfDirective(
+    PartOfDirective copy = astFactory.partOfDirective(
         _cloneNode(node.documentationComment),
         _cloneNodeList(node.metadata),
         _mapToken(node.partKeyword),
@@ -3490,7 +3582,7 @@
 
   @override
   PostfixExpression visitPostfixExpression(PostfixExpression node) {
-    PostfixExpression copy = new PostfixExpression(
+    PostfixExpression copy = astFactory.postfixExpression(
         _cloneNode(node.operand), _mapToken(node.operator));
     copy.propagatedElement = node.propagatedElement;
     copy.propagatedType = node.propagatedType;
@@ -3501,8 +3593,10 @@
 
   @override
   PrefixedIdentifier visitPrefixedIdentifier(PrefixedIdentifier node) {
-    PrefixedIdentifier copy = new PrefixedIdentifier(_cloneNode(node.prefix),
-        _mapToken(node.period), _cloneNode(node.identifier));
+    PrefixedIdentifier copy = astFactory.prefixedIdentifier(
+        _cloneNode(node.prefix),
+        _mapToken(node.period),
+        _cloneNode(node.identifier));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
@@ -3510,7 +3604,7 @@
 
   @override
   PrefixExpression visitPrefixExpression(PrefixExpression node) {
-    PrefixExpression copy = new PrefixExpression(
+    PrefixExpression copy = astFactory.prefixExpression(
         _mapToken(node.operator), _cloneNode(node.operand));
     copy.propagatedElement = node.propagatedElement;
     copy.propagatedType = node.propagatedType;
@@ -3521,7 +3615,7 @@
 
   @override
   PropertyAccess visitPropertyAccess(PropertyAccess node) {
-    PropertyAccess copy = new PropertyAccess(_cloneNode(node.target),
+    PropertyAccess copy = astFactory.propertyAccess(_cloneNode(node.target),
         _mapToken(node.operator), _cloneNode(node.propertyName));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
@@ -3532,7 +3626,7 @@
   RedirectingConstructorInvocation visitRedirectingConstructorInvocation(
       RedirectingConstructorInvocation node) {
     RedirectingConstructorInvocation copy =
-        new RedirectingConstructorInvocation(
+        astFactory.redirectingConstructorInvocation(
             _mapToken(node.thisKeyword),
             _mapToken(node.period),
             _cloneNode(node.constructorName),
@@ -3544,7 +3638,7 @@
   @override
   RethrowExpression visitRethrowExpression(RethrowExpression node) {
     RethrowExpression copy =
-        new RethrowExpression(_mapToken(node.rethrowKeyword));
+        astFactory.rethrowExpression(_mapToken(node.rethrowKeyword));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
@@ -3552,21 +3646,21 @@
 
   @override
   ReturnStatement visitReturnStatement(ReturnStatement node) =>
-      new ReturnStatement(_mapToken(node.returnKeyword),
+      astFactory.returnStatement(_mapToken(node.returnKeyword),
           _cloneNode(node.expression), _mapToken(node.semicolon));
 
   @override
   ScriptTag visitScriptTag(ScriptTag node) =>
-      new ScriptTag(_mapToken(node.scriptTag));
+      astFactory.scriptTag(_mapToken(node.scriptTag));
 
   @override
-  ShowCombinator visitShowCombinator(ShowCombinator node) => new ShowCombinator(
-      _mapToken(node.keyword), _cloneNodeList(node.shownNames));
+  ShowCombinator visitShowCombinator(ShowCombinator node) => astFactory
+      .showCombinator(_mapToken(node.keyword), _cloneNodeList(node.shownNames));
 
   @override
   SimpleFormalParameter visitSimpleFormalParameter(
           SimpleFormalParameter node) =>
-      new SimpleFormalParameter(
+      astFactory.simpleFormalParameter(
           _cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata),
           _mapToken(node.keyword),
@@ -3584,7 +3678,7 @@
       // documentation comments for the parser.
       mappedToken = node.token;
     }
-    SimpleIdentifier copy = new SimpleIdentifier(mappedToken,
+    SimpleIdentifier copy = astFactory.simpleIdentifier(mappedToken,
         isDeclaration: node.inDeclarationContext());
     copy.auxiliaryElements = node.auxiliaryElements;
     copy.propagatedElement = node.propagatedElement;
@@ -3597,7 +3691,7 @@
   @override
   SimpleStringLiteral visitSimpleStringLiteral(SimpleStringLiteral node) {
     SimpleStringLiteral copy =
-        new SimpleStringLiteral(_mapToken(node.literal), node.value);
+        astFactory.simpleStringLiteral(_mapToken(node.literal), node.value);
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
@@ -3606,7 +3700,7 @@
   @override
   StringInterpolation visitStringInterpolation(StringInterpolation node) {
     StringInterpolation copy =
-        new StringInterpolation(_cloneNodeList(node.elements));
+        astFactory.stringInterpolation(_cloneNodeList(node.elements));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
@@ -3615,7 +3709,7 @@
   @override
   SuperConstructorInvocation visitSuperConstructorInvocation(
       SuperConstructorInvocation node) {
-    SuperConstructorInvocation copy = new SuperConstructorInvocation(
+    SuperConstructorInvocation copy = astFactory.superConstructorInvocation(
         _mapToken(node.superKeyword),
         _mapToken(node.period),
         _cloneNode(node.constructorName),
@@ -3626,14 +3720,15 @@
 
   @override
   SuperExpression visitSuperExpression(SuperExpression node) {
-    SuperExpression copy = new SuperExpression(_mapToken(node.superKeyword));
+    SuperExpression copy =
+        astFactory.superExpression(_mapToken(node.superKeyword));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
   }
 
   @override
-  SwitchCase visitSwitchCase(SwitchCase node) => new SwitchCase(
+  SwitchCase visitSwitchCase(SwitchCase node) => astFactory.switchCase(
       _cloneNodeList(node.labels),
       _mapToken(node.keyword),
       _cloneNode(node.expression),
@@ -3641,15 +3736,16 @@
       _cloneNodeList(node.statements));
 
   @override
-  SwitchDefault visitSwitchDefault(SwitchDefault node) => new SwitchDefault(
-      _cloneNodeList(node.labels),
-      _mapToken(node.keyword),
-      _mapToken(node.colon),
-      _cloneNodeList(node.statements));
+  SwitchDefault visitSwitchDefault(SwitchDefault node) =>
+      astFactory.switchDefault(
+          _cloneNodeList(node.labels),
+          _mapToken(node.keyword),
+          _mapToken(node.colon),
+          _cloneNodeList(node.statements));
 
   @override
   SwitchStatement visitSwitchStatement(SwitchStatement node) =>
-      new SwitchStatement(
+      astFactory.switchStatement(
           _mapToken(node.switchKeyword),
           _mapToken(node.leftParenthesis),
           _cloneNode(node.expression),
@@ -3660,7 +3756,7 @@
 
   @override
   AstNode visitSymbolLiteral(SymbolLiteral node) {
-    SymbolLiteral copy = new SymbolLiteral(
+    SymbolLiteral copy = astFactory.symbolLiteral(
         _mapToken(node.poundSign), _mapTokens(node.components));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
@@ -3669,7 +3765,8 @@
 
   @override
   ThisExpression visitThisExpression(ThisExpression node) {
-    ThisExpression copy = new ThisExpression(_mapToken(node.thisKeyword));
+    ThisExpression copy =
+        astFactory.thisExpression(_mapToken(node.thisKeyword));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
     return copy;
@@ -3677,7 +3774,7 @@
 
   @override
   ThrowExpression visitThrowExpression(ThrowExpression node) {
-    ThrowExpression copy = new ThrowExpression(
+    ThrowExpression copy = astFactory.throwExpression(
         _mapToken(node.throwKeyword), _cloneNode(node.expression));
     copy.propagatedType = node.propagatedType;
     copy.staticType = node.staticType;
@@ -3687,14 +3784,14 @@
   @override
   TopLevelVariableDeclaration visitTopLevelVariableDeclaration(
           TopLevelVariableDeclaration node) =>
-      new TopLevelVariableDeclaration(
+      astFactory.topLevelVariableDeclaration(
           _cloneNode(node.documentationComment),
           _cloneNodeList(node.metadata),
           _cloneNode(node.variables),
           _mapToken(node.semicolon));
 
   @override
-  TryStatement visitTryStatement(TryStatement node) => new TryStatement(
+  TryStatement visitTryStatement(TryStatement node) => astFactory.tryStatement(
       _mapToken(node.tryKeyword),
       _cloneNode(node.body),
       _cloneNodeList(node.catchClauses),
@@ -3703,39 +3800,40 @@
 
   @override
   TypeArgumentList visitTypeArgumentList(TypeArgumentList node) =>
-      new TypeArgumentList(_mapToken(node.leftBracket),
+      astFactory.typeArgumentList(_mapToken(node.leftBracket),
           _cloneNodeList(node.arguments), _mapToken(node.rightBracket));
 
   @override
   TypeName visitTypeName(TypeName node) {
-    TypeName copy =
-        new TypeName(_cloneNode(node.name), _cloneNode(node.typeArguments));
+    TypeName copy = astFactory.typeName(
+        _cloneNode(node.name), _cloneNode(node.typeArguments));
     copy.type = node.type;
     return copy;
   }
 
   @override
-  TypeParameter visitTypeParameter(TypeParameter node) => new TypeParameter(
-      _cloneNode(node.documentationComment),
-      _cloneNodeList(node.metadata),
-      _cloneNode(node.name),
-      _mapToken(node.extendsKeyword),
-      _cloneNode(node.bound));
+  TypeParameter visitTypeParameter(TypeParameter node) =>
+      astFactory.typeParameter(
+          _cloneNode(node.documentationComment),
+          _cloneNodeList(node.metadata),
+          _cloneNode(node.name),
+          _mapToken(node.extendsKeyword),
+          _cloneNode(node.bound));
 
   @override
   TypeParameterList visitTypeParameterList(TypeParameterList node) =>
-      new TypeParameterList(_mapToken(node.leftBracket),
+      astFactory.typeParameterList(_mapToken(node.leftBracket),
           _cloneNodeList(node.typeParameters), _mapToken(node.rightBracket));
 
   @override
   VariableDeclaration visitVariableDeclaration(VariableDeclaration node) =>
-      new VariableDeclaration(_cloneNode(node.name), _mapToken(node.equals),
-          _cloneNode(node.initializer));
+      astFactory.variableDeclaration(_cloneNode(node.name),
+          _mapToken(node.equals), _cloneNode(node.initializer));
 
   @override
   VariableDeclarationList visitVariableDeclarationList(
           VariableDeclarationList node) =>
-      new VariableDeclarationList(
+      astFactory.variableDeclarationList(
           null,
           _cloneNodeList(node.metadata),
           _mapToken(node.keyword),
@@ -3745,27 +3843,29 @@
   @override
   VariableDeclarationStatement visitVariableDeclarationStatement(
           VariableDeclarationStatement node) =>
-      new VariableDeclarationStatement(
+      astFactory.variableDeclarationStatement(
           _cloneNode(node.variables), _mapToken(node.semicolon));
 
   @override
-  WhileStatement visitWhileStatement(WhileStatement node) => new WhileStatement(
-      _mapToken(node.whileKeyword),
-      _mapToken(node.leftParenthesis),
-      _cloneNode(node.condition),
-      _mapToken(node.rightParenthesis),
-      _cloneNode(node.body));
+  WhileStatement visitWhileStatement(WhileStatement node) =>
+      astFactory.whileStatement(
+          _mapToken(node.whileKeyword),
+          _mapToken(node.leftParenthesis),
+          _cloneNode(node.condition),
+          _mapToken(node.rightParenthesis),
+          _cloneNode(node.body));
 
   @override
-  WithClause visitWithClause(WithClause node) => new WithClause(
+  WithClause visitWithClause(WithClause node) => astFactory.withClause(
       _mapToken(node.withKeyword), _cloneNodeList(node.mixinTypes));
 
   @override
-  YieldStatement visitYieldStatement(YieldStatement node) => new YieldStatement(
-      _mapToken(node.yieldKeyword),
-      _mapToken(node.star),
-      _cloneNode(node.expression),
-      _mapToken(node.semicolon));
+  YieldStatement visitYieldStatement(YieldStatement node) =>
+      astFactory.yieldStatement(
+          _mapToken(node.yieldKeyword),
+          _mapToken(node.star),
+          _cloneNode(node.expression),
+          _mapToken(node.semicolon));
 
   AstNode/*=E*/ _cloneNode/*<E extends AstNode>*/(AstNode/*=E*/ node) {
     if (node == null) {
@@ -4069,7 +4169,7 @@
       node.expression = _newNode as Expression;
       return true;
     } else if (identical(node.type, _oldNode)) {
-      node.type = _newNode as TypeName;
+      node.type = _newNode as TypeAnnotation;
       return true;
     }
     return visitNode(node);
@@ -4177,7 +4277,7 @@
   @override
   bool visitCatchClause(CatchClause node) {
     if (identical(node.exceptionType, _oldNode)) {
-      node.exceptionType = _newNode as TypeName;
+      node.exceptionType = _newNode as TypeAnnotation;
       return true;
     } else if (identical(node.exceptionParameter, _oldNode)) {
       node.exceptionParameter = _newNode as SimpleIdentifier;
@@ -4355,7 +4455,7 @@
   @override
   bool visitDeclaredIdentifier(DeclaredIdentifier node) {
     if (identical(node.type, _oldNode)) {
-      node.type = _newNode as TypeName;
+      node.type = _newNode as TypeAnnotation;
       return true;
     } else if (identical(node.identifier, _oldNode)) {
       node.identifier = _newNode as SimpleIdentifier;
@@ -4468,7 +4568,7 @@
   @override
   bool visitFieldFormalParameter(FieldFormalParameter node) {
     if (identical(node.type, _oldNode)) {
-      node.type = _newNode as TypeName;
+      node.type = _newNode as TypeAnnotation;
       return true;
     } else if (identical(node.parameters, _oldNode)) {
       node.parameters = _newNode as FormalParameterList;
@@ -4526,7 +4626,7 @@
   @override
   bool visitFunctionDeclaration(FunctionDeclaration node) {
     if (identical(node.returnType, _oldNode)) {
-      node.returnType = _newNode as TypeName;
+      node.returnType = _newNode as TypeAnnotation;
       return true;
     } else if (identical(node.name, _oldNode)) {
       node.name = _newNode as SimpleIdentifier;
@@ -4574,7 +4674,7 @@
   @override
   bool visitFunctionTypeAlias(FunctionTypeAlias node) {
     if (identical(node.returnType, _oldNode)) {
-      node.returnType = _newNode as TypeName;
+      node.returnType = _newNode as TypeAnnotation;
       return true;
     } else if (identical(node.name, _oldNode)) {
       node.name = _newNode as SimpleIdentifier;
@@ -4592,7 +4692,7 @@
   @override
   bool visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
     if (identical(node.returnType, _oldNode)) {
-      node.returnType = _newNode as TypeName;
+      node.returnType = _newNode as TypeAnnotation;
       return true;
     } else if (identical(node.parameters, _oldNode)) {
       node.parameters = _newNode as FormalParameterList;
@@ -4602,6 +4702,38 @@
   }
 
   @override
+  bool visitGenericFunctionType(GenericFunctionType node) {
+    if (identical(node.returnType, _oldNode)) {
+      node.returnType = _newNode as TypeAnnotation;
+      return true;
+    } else if (identical(node.typeParameters, _oldNode)) {
+      node.typeParameters = _newNode as TypeParameterList;
+      return true;
+    } else if (identical(node.parameters, _oldNode)) {
+      node.parameters = _newNode as FormalParameterList;
+      return true;
+    }
+    return null;
+  }
+
+  @override
+  bool visitGenericTypeAlias(GenericTypeAlias node) {
+    if (identical(node.name, _oldNode)) {
+      node.name = _newNode as SimpleIdentifier;
+      return true;
+    } else if (identical(node.typeParameters, _oldNode)) {
+      node.typeParameters = _newNode as TypeParameterList;
+      return true;
+    } else if (identical(node.functionType, _oldNode)) {
+      node.functionType = _newNode as GenericFunctionType;
+      return true;
+    } else if (_replaceInList(node.metadata)) {
+      return true;
+    }
+    return visitNode(node);
+  }
+
+  @override
   bool visitHideCombinator(HideCombinator node) {
     if (_replaceInList(node.hiddenNames)) {
       return true;
@@ -4686,7 +4818,7 @@
       node.expression = _newNode as Expression;
       return true;
     } else if (identical(node.type, _oldNode)) {
-      node.type = _newNode as TypeName;
+      node.type = _newNode as TypeAnnotation;
       return true;
     }
     return visitNode(node);
@@ -4760,7 +4892,7 @@
   @override
   bool visitMethodDeclaration(MethodDeclaration node) {
     if (identical(node.returnType, _oldNode)) {
-      node.returnType = _newNode as TypeName;
+      node.returnType = _newNode as TypeAnnotation;
       return true;
     } else if (identical(node.name, _oldNode)) {
       node.name = _newNode as SimpleIdentifier;
@@ -4949,7 +5081,7 @@
   @override
   bool visitSimpleFormalParameter(SimpleFormalParameter node) {
     if (identical(node.type, _oldNode)) {
-      node.type = _newNode as TypeName;
+      node.type = _newNode as TypeAnnotation;
       return true;
     }
     return visitNormalFormalParameter(node);
@@ -5088,7 +5220,7 @@
       node.name = _newNode as SimpleIdentifier;
       return true;
     } else if (identical(node.bound, _oldNode)) {
-      node.bound = _newNode as TypeName;
+      node.bound = _newNode as TypeAnnotation;
       return true;
     }
     return visitNode(node);
@@ -5125,7 +5257,7 @@
   @override
   bool visitVariableDeclarationList(VariableDeclarationList node) {
     if (identical(node.type, _oldNode)) {
-      node.type = _newNode as TypeName;
+      node.type = _newNode as TypeAnnotation;
       return true;
     } else if (_replaceInList(node.variables)) {
       return true;
@@ -5714,6 +5846,7 @@
         _isEqualTokens(node.forKeyword, toNode.forKeyword),
         _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis),
         _isEqualNodes(node.loopVariable, toNode.loopVariable),
+        _isEqualNodes(node.identifier, toNode.identifier),
         _isEqualTokens(node.inKeyword, toNode.inKeyword),
         _isEqualNodes(node.iterable, toNode.iterable),
         _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis),
@@ -5826,6 +5959,38 @@
   }
 
   @override
+  bool visitGenericFunctionType(GenericFunctionType node) {
+    GenericFunctionType toNode = this._toNode as GenericFunctionType;
+    if (_and(
+        _isEqualNodes(node.returnType, toNode.returnType),
+        _isEqualTokens(node.functionKeyword, toNode.functionKeyword),
+        _isEqualNodes(node.typeParameters, toNode.typeParameters),
+        _isEqualNodes(node.parameters, toNode.parameters))) {
+      // TODO(brianwilkerson) Copy the type information.
+      return true;
+    }
+    return false;
+  }
+
+  @override
+  bool visitGenericTypeAlias(GenericTypeAlias node) {
+    GenericTypeAlias toNode = this._toNode as GenericTypeAlias;
+    if (_and(
+        _isEqualNodes(node.documentationComment, toNode.documentationComment),
+        _isEqualNodeLists(node.metadata, toNode.metadata),
+        _isEqualTokens(node.typedefKeyword, toNode.typedefKeyword),
+        _isEqualNodes(node.name, toNode.name),
+        _isEqualNodes(node.typeParameters, toNode.typeParameters),
+        _isEqualTokens(node.equals, toNode.equals),
+        _isEqualNodes(node.functionType, toNode.functionType),
+        _isEqualTokens(node.semicolon, toNode.semicolon))) {
+      // TODO(brianwilkerson) Copy the type and element information.
+      return true;
+    }
+    return false;
+  }
+
+  @override
   bool visitHideCombinator(HideCombinator node) {
     HideCombinator toNode = this._toNode as HideCombinator;
     return _and(_isEqualTokens(node.keyword, toNode.keyword),
@@ -7219,6 +7384,7 @@
   @override
   Object visitFieldFormalParameter(FieldFormalParameter node) {
     _visitNodeListWithSeparatorAndSuffix(node.metadata, ' ', ' ');
+    _visitTokenWithSuffix(node.covariantKeyword, ' ');
     _visitTokenWithSuffix(node.keyword, " ");
     _visitNodeWithSuffix(node.type, " ");
     _writer.print("this.");
@@ -7345,6 +7511,7 @@
   @override
   Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
     _visitNodeListWithSeparatorAndSuffix(node.metadata, ' ', ' ');
+    _visitTokenWithSuffix(node.covariantKeyword, ' ');
     _visitNodeWithSuffix(node.returnType, " ");
     _visitNode(node.identifier);
     _visitNode(node.typeParameters);
@@ -7356,6 +7523,26 @@
   }
 
   @override
+  Object visitGenericFunctionType(GenericFunctionType node) {
+    _visitNode(node.returnType);
+    _writer.print(' Function ');
+    _visitNode(node.typeParameters);
+    _visitNode(node.parameters);
+    return null;
+  }
+
+  @override
+  Object visitGenericTypeAlias(GenericTypeAlias node) {
+    _visitNodeListWithSeparatorAndSuffix(node.metadata, " ", " ");
+    _writer.print("typedef ");
+    _visitNode(node.name);
+    _visitNode(node.typeParameters);
+    _writer.print(" = ");
+    _visitNode(node.functionType);
+    return null;
+  }
+
+  @override
   Object visitHideCombinator(HideCombinator node) {
     _writer.print("hide ");
     _visitNodeListWithSeparator(node.hiddenNames, ", ");
@@ -7679,6 +7866,7 @@
   @override
   Object visitSimpleFormalParameter(SimpleFormalParameter node) {
     _visitNodeListWithSeparatorAndSuffix(node.metadata, ' ', ' ');
+    _visitTokenWithSuffix(node.covariantKeyword, ' ');
     _visitTokenWithSuffix(node.keyword, " ");
     _visitNodeWithSuffix(node.type, " ");
     _visitNode(node.identifier);
@@ -8506,6 +8694,7 @@
   @override
   Object visitFieldFormalParameter(FieldFormalParameter node) {
     safelyVisitNodeListWithSeparatorAndSuffix(node.metadata, ' ', ' ');
+    safelyVisitTokenWithSuffix(node.covariantKeyword, ' ');
     safelyVisitTokenWithSuffix(node.keyword, " ");
     safelyVisitNodeWithSuffix(node.type, " ");
     sink.write("this.");
@@ -8632,6 +8821,7 @@
   @override
   Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
     safelyVisitNodeListWithSeparatorAndSuffix(node.metadata, ' ', ' ');
+    safelyVisitTokenWithSuffix(node.covariantKeyword, ' ');
     safelyVisitNodeWithSuffix(node.returnType, " ");
     safelyVisitNode(node.identifier);
     safelyVisitNode(node.typeParameters);
@@ -8643,6 +8833,26 @@
   }
 
   @override
+  Object visitGenericFunctionType(GenericFunctionType node) {
+    safelyVisitNode(node.returnType);
+    sink.write(' Function ');
+    safelyVisitNode(node.typeParameters);
+    safelyVisitNode(node.parameters);
+    return null;
+  }
+
+  @override
+  Object visitGenericTypeAlias(GenericTypeAlias node) {
+    safelyVisitNodeListWithSeparatorAndSuffix(node.metadata, " ", " ");
+    sink.write("typedef ");
+    safelyVisitNode(node.name);
+    safelyVisitNode(node.typeParameters);
+    sink.write(" = ");
+    safelyVisitNode(node.functionType);
+    return null;
+  }
+
+  @override
   Object visitHideCombinator(HideCombinator node) {
     sink.write("hide ");
     safelyVisitNodeListWithSeparator(node.hiddenNames, ", ");
@@ -8966,6 +9176,7 @@
   @override
   Object visitSimpleFormalParameter(SimpleFormalParameter node) {
     safelyVisitNodeListWithSeparatorAndSuffix(node.metadata, ' ', ' ');
+    safelyVisitTokenWithSuffix(node.covariantKeyword, ' ');
     safelyVisitTokenWithSuffix(node.keyword, " ");
     safelyVisitNodeWithSuffix(node.type, " ");
     safelyVisitNode(node.identifier);
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index c335351..4718171 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -8,6 +8,7 @@
 
 import 'package:analyzer/context/declared_variables.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/constant/value.dart';
@@ -93,7 +94,7 @@
             typeProvider.objectType.element.context.analysisOptions.strongMode,
         validator =
             validator ?? new ConstantEvaluationValidator_ForProduction(),
-        typeSystem = typeSystem ?? new TypeSystemImpl();
+        typeSystem = typeSystem ?? new TypeSystemImpl(typeProvider);
 
   /**
    * Check that the arguments to a call to fromEnvironment() are correct. The
@@ -717,7 +718,7 @@
           superclass.lookUpConstructor(superName, constructor.library);
       if (superConstructor != null) {
         if (superArguments == null) {
-          superArguments = new NodeList<Expression>(null);
+          superArguments = astFactory.nodeList/*<Expression>*/(null);
         }
 
         evaluateSuperConstructorCall(node, fieldMap, superConstructor,
@@ -1291,9 +1292,8 @@
     }
     ParameterizedType thenType = thenResult.type;
     ParameterizedType elseType = elseResult.type;
-    return new DartObjectImpl.validWithUnknownValue(
-        _typeSystem.getLeastUpperBound(_typeProvider, thenType, elseType)
-        as InterfaceType);
+    return new DartObjectImpl.validWithUnknownValue(_typeSystem
+        .getLeastUpperBound(thenType, elseType) as ParameterizedType);
   }
 
   @override
@@ -1358,9 +1358,9 @@
       return null;
     }
     DartType elementType = _typeProvider.dynamicType;
-    NodeList<TypeName> typeArgs = node.typeArguments?.arguments;
+    NodeList<TypeAnnotation> typeArgs = node.typeArguments?.arguments;
     if (typeArgs?.length == 1) {
-      DartType type = visitTypeName(typeArgs[0])?.toTypeValue();
+      DartType type = visitTypeAnnotation(typeArgs[0])?.toTypeValue();
       if (type != null) {
         elementType = type;
       }
@@ -1393,13 +1393,15 @@
     }
     DartType keyType = _typeProvider.dynamicType;
     DartType valueType = _typeProvider.dynamicType;
-    NodeList<TypeName> typeArgs = node.typeArguments?.arguments;
+    NodeList<TypeAnnotation> typeArgs = node.typeArguments?.arguments;
     if (typeArgs?.length == 2) {
-      DartType keyTypeCandidate = visitTypeName(typeArgs[0])?.toTypeValue();
+      DartType keyTypeCandidate =
+          visitTypeAnnotation(typeArgs[0])?.toTypeValue();
       if (keyTypeCandidate != null) {
         keyType = keyTypeCandidate;
       }
-      DartType valueTypeCandidate = visitTypeName(typeArgs[1])?.toTypeValue();
+      DartType valueTypeCandidate =
+          visitTypeAnnotation(typeArgs[1])?.toTypeValue();
       if (valueTypeCandidate != null) {
         valueType = valueTypeCandidate;
       }
@@ -1549,8 +1551,7 @@
         _typeProvider.symbolType, new SymbolState(buffer.toString()));
   }
 
-  @override
-  DartObjectImpl visitTypeName(TypeName node) {
+  DartObjectImpl visitTypeAnnotation(TypeAnnotation node) {
     DartType type = evaluateType(node.type);
     if (type == null) {
       return super.visitTypeName(node);
@@ -1558,6 +1559,9 @@
     return typeConstant(type);
   }
 
+  @override
+  DartObjectImpl visitTypeName(TypeName node) => visitTypeAnnotation(node);
+
   /**
    * Create an error associated with the given [node]. The error will have the
    * given error [code].
diff --git a/pkg/analyzer/lib/src/dart/constant/utilities.dart b/pkg/analyzer/lib/src/dart/constant/utilities.dart
index d9ef263..b097c0e 100644
--- a/pkg/analyzer/lib/src/dart/constant/utilities.dart
+++ b/pkg/analyzer/lib/src/dart/constant/utilities.dart
@@ -7,6 +7,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/dart/ast/utilities.dart';
@@ -39,13 +40,6 @@
   ConstantAstCloner() : super(true);
 
   @override
-  ConstructorName visitConstructorName(ConstructorName node) {
-    ConstructorName name = super.visitConstructorName(node);
-    name.staticElement = node.staticElement;
-    return name;
-  }
-
-  @override
   Annotation visitAnnotation(Annotation node) {
     Annotation annotation = super.visitAnnotation(node);
     annotation.element = node.element;
@@ -53,6 +47,13 @@
   }
 
   @override
+  ConstructorName visitConstructorName(ConstructorName node) {
+    ConstructorName name = super.visitConstructorName(node);
+    name.staticElement = node.staticElement;
+    return name;
+  }
+
+  @override
   FunctionExpression visitFunctionExpression(FunctionExpression node) {
     FunctionExpression expression = super.visitFunctionExpression(node);
     expression.element = node.element;
@@ -191,7 +192,10 @@
   @override
   Object visitClassDeclaration(ClassDeclaration node) {
     bool prevTreatFinalInstanceVarAsConst = treatFinalInstanceVarAsConst;
-    if (node.element.constructors.any((ConstructorElement e) => e.isConst)) {
+    if (resolutionMap
+        .elementDeclaredByClassDeclaration(node)
+        .constructors
+        .any((ConstructorElement e) => e.isConst)) {
       // Instance vars marked "final" need to be included in the dependency
       // graph, since constant constructors implicitly use the values in their
       // initializers.
@@ -222,7 +226,8 @@
     super.visitDefaultFormalParameter(node);
     Expression defaultValue = node.defaultValue;
     if (defaultValue != null && node.element != null) {
-      constantsToCompute.add(node.element);
+      constantsToCompute
+          .add(resolutionMap.elementDeclaredByFormalParameter(node));
     }
     return null;
   }
diff --git a/pkg/analyzer/lib/src/dart/constant/value.dart b/pkg/analyzer/lib/src/dart/constant/value.dart
index db4de37..a927df6 100644
--- a/pkg/analyzer/lib/src/dart/constant/value.dart
+++ b/pkg/analyzer/lib/src/dart/constant/value.dart
@@ -144,9 +144,6 @@
    */
   static const List<DartObjectImpl> EMPTY_LIST = const <DartObjectImpl>[];
 
-  /**
-   * The run-time type of this object.
-   */
   @override
   final ParameterizedType type;
 
@@ -163,7 +160,7 @@
   /**
    * Create an object to represent an unknown value.
    */
-  factory DartObjectImpl.validWithUnknownValue(InterfaceType type) {
+  factory DartObjectImpl.validWithUnknownValue(ParameterizedType type) {
     if (type.element.library.isDartCore) {
       String typeName = type.name;
       if (typeName == "bool") {
diff --git a/pkg/analyzer/lib/src/dart/element/builder.dart b/pkg/analyzer/lib/src/dart/element/builder.dart
index 17af70d..17f98e9 100644
--- a/pkg/analyzer/lib/src/dart/element/builder.dart
+++ b/pkg/analyzer/lib/src/dart/element/builder.dart
@@ -236,6 +236,7 @@
           new FieldFormalParameterElementImpl.forNode(parameterName);
       _setCodeRange(parameter, node);
       parameter.isConst = node.isConst;
+      parameter.isExplicitlyCovariant = node.covariantKeyword != null;
       parameter.isFinal = node.isFinal;
       parameter.parameterKind = node.kind;
       if (field != null) {
@@ -621,6 +622,7 @@
         field = new FieldElementImpl.forNode(fieldName);
       }
       element = field;
+      field.isCovariant = fieldNode.covariantKeyword != null;
       field.isStatic = fieldNode.isStatic;
       _setCodeRange(element, node);
       setElementDocumentationComment(element, fieldNode);
@@ -653,6 +655,10 @@
       if (!isConst && !isFinal) {
         PropertyAccessorElementImpl_ImplicitSetter setter =
             new PropertyAccessorElementImpl_ImplicitSetter(element);
+        if (fieldNode != null) {
+          (setter.parameters[0] as ParameterElementImpl).isExplicitlyCovariant =
+              fieldNode.covariantKeyword != null;
+        }
         _currentHolder.addAccessor(setter);
       }
     }
@@ -1389,6 +1395,7 @@
     }
     _setCodeRange(parameter, node);
     parameter.isConst = node.isConst;
+    parameter.isExplicitlyCovariant = node.parameter.covariantKeyword != null;
     parameter.isFinal = node.isFinal;
     parameter.parameterKind = node.kind;
     // visible range
@@ -1410,6 +1417,9 @@
       ParameterElementImpl parameter =
           new ParameterElementImpl.forNode(parameterName);
       _setCodeRange(parameter, node);
+      parameter.isConst = node.isConst;
+      parameter.isExplicitlyCovariant = node.covariantKeyword != null;
+      parameter.isFinal = node.isFinal;
       parameter.parameterKind = node.kind;
       _setParameterVisibleRange(node, parameter);
       _currentHolder.addParameter(parameter);
@@ -1437,6 +1447,7 @@
           new ParameterElementImpl.forNode(parameterName);
       _setCodeRange(parameter, node);
       parameter.isConst = node.isConst;
+      parameter.isExplicitlyCovariant = node.covariantKeyword != null;
       parameter.isFinal = node.isFinal;
       parameter.parameterKind = node.kind;
       _setParameterVisibleRange(node, parameter);
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 22f961b..ac89153 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -116,7 +116,8 @@
   ElementKind get kind => ElementKind.CLASS;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitClassElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitClassElement(this);
 
   @override
   NamedCompilationUnitMember computeNode() {
@@ -1212,7 +1213,10 @@
         if (e.kind == UnlinkedExecutableKind.getter) {
           fieldType = accessor.returnType;
         } else {
-          fieldType = accessor.parameters[0].type;
+          List<ParameterElement> parameters = accessor.parameters;
+          fieldType = parameters.isNotEmpty
+              ? parameters[0].type
+              : DynamicTypeImpl.instance;
         }
         // Create or update the implicit field.
         String fieldName = accessor.displayName;
@@ -1621,7 +1625,8 @@
       object is CompilationUnitElementImpl && source == object.source;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitCompilationUnitElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitCompilationUnitElement(this);
 
   /**
    * This method is invoked after this unit was incrementally resolved.
@@ -1759,7 +1764,7 @@
   void visitChildren(ElementVisitor visitor) {
     super.visitChildren(visitor);
     safelyVisitChildren(accessors, visitor);
-    safelyVisitChildren(_enums, visitor);
+    safelyVisitChildren(enums, visitor);
     safelyVisitChildren(functions, visitor);
     safelyVisitChildren(functionTypeAliases, visitor);
     safelyVisitChildren(types, visitor);
@@ -2171,7 +2176,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitConstructorElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
@@ -2233,6 +2239,9 @@
                     .buildExpression(this, serialized.expression));
         initializer.fieldName.staticElement = enclosingElement.getField(name);
         return initializer;
+      case UnlinkedConstructorInitializerKind.assertInvocation:
+        return AstTestFactory.assertInitializer(
+            arguments[0], arguments.length > 1 ? arguments[1] : null);
       case UnlinkedConstructorInitializerKind.superInvocation:
         SuperConstructorInvocation initializer =
             AstTestFactory.superConstructorInvocation2(
@@ -2434,7 +2443,7 @@
   ElementKind get kind => ElementKind.DYNAMIC;
 
   @override
-  accept(ElementVisitor visitor) => null;
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) => null;
 }
 
 /**
@@ -4157,12 +4166,13 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitExportElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitExportElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
     buffer.write("export ");
-    (exportedLibrary as LibraryElementImpl).appendTo(buffer);
+    LibraryElementImpl.getImpl(exportedLibrary).appendTo(buffer);
   }
 }
 
@@ -4208,6 +4218,24 @@
   @override
   ClassElement get enclosingElement => super.enclosingElement as ClassElement;
 
+  /**
+   * Return `true` if this field was explicitly marked as being covariant.
+   */
+  bool get isCovariant {
+    if (_unlinkedVariable != null) {
+      return _unlinkedVariable.isCovariant;
+    }
+    return hasModifier(Modifier.COVARIANT);
+  }
+
+  /**
+   * Set whether this field is explicitly marked as being covariant.
+   */
+  void set isCovariant(bool isCovariant) {
+    _assertNotResynthesized(_unlinkedVariable);
+    setModifier(Modifier.COVARIANT, isCovariant);
+  }
+
   @override
   bool get isEnumConstant =>
       enclosingElement != null ? enclosingElement.isEnum : false;
@@ -4242,7 +4270,8 @@
   ElementKind get kind => ElementKind.FIELD;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitFieldElement(this);
 
   @override
   AstNode computeNode() {
@@ -4288,9 +4317,14 @@
   @override
   FieldElement get field {
     if (_unlinkedParam != null && _field == null) {
-      Element enclosingClass = enclosingElement?.enclosingElement;
-      if (enclosingClass is ClassElement) {
-        _field = enclosingClass.getField(_unlinkedParam.name);
+      Element enclosing = enclosingElement?.enclosingElement;
+      while (enclosing != null) {
+        if (enclosing is ClassElement) {
+          _field = enclosing.getField(_unlinkedParam.name);
+          break;
+        } else {
+          enclosing = enclosing.enclosingElement;
+        }
       }
     }
     return _field;
@@ -4319,7 +4353,7 @@
   }
 
   @override
-  accept(ElementVisitor visitor) =>
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
       visitor.visitFieldFormalParameterElement(this);
 }
 
@@ -4421,7 +4455,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitFunctionElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitFunctionElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
@@ -4764,7 +4799,8 @@
       _unlinkedTypedef.typeParameters;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitFunctionTypeAliasElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitFunctionTypeAliasElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
@@ -4782,12 +4818,13 @@
       buffer.write(">");
     }
     buffer.write("(");
-    int parameterCount = _parameters.length;
+    List<ParameterElement> parameterList = parameters;
+    int parameterCount = parameterList.length;
     for (int i = 0; i < parameterCount; i++) {
       if (i > 0) {
         buffer.write(", ");
       }
-      (_parameters[i] as ParameterElementImpl).appendTo(buffer);
+      (parameterList[i] as ParameterElementImpl).appendTo(buffer);
     }
     buffer.write(")");
     if (type != null) {
@@ -4824,7 +4861,7 @@
   void visitChildren(ElementVisitor visitor) {
     super.visitChildren(visitor);
     safelyVisitChildren(parameters, visitor);
-    safelyVisitChildren(_typeParameters, visitor);
+    safelyVisitChildren(typeParameters, visitor);
   }
 }
 
@@ -5109,12 +5146,13 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitImportElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitImportElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
     buffer.write("import ");
-    (importedLibrary as LibraryElementImpl).appendTo(buffer);
+    LibraryElementImpl.getImpl(importedLibrary).appendTo(buffer);
   }
 
   @override
@@ -5238,7 +5276,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitLabelElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitLabelElement(this);
 
   /**
    * Create and return [LabelElement]s for the given [unlinkedLabels].
@@ -5497,7 +5536,18 @@
   }
 
   @override
-  bool get hasExtUri => hasModifier(Modifier.HAS_EXT_URI);
+  bool get hasExtUri {
+    if (_unlinkedDefiningUnit != null) {
+      List<UnlinkedImport> unlinkedImports = _unlinkedDefiningUnit.imports;
+      for (UnlinkedImport import in unlinkedImports) {
+        if (DartUriResolver.isDartExtUri(import.uri)) {
+          return true;
+        }
+      }
+      return false;
+    }
+    return hasModifier(Modifier.HAS_EXT_URI);
+  }
 
   /**
    * Set whether this library has an import of a "dart-ext" URI.
@@ -5788,7 +5838,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitLibraryElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitLibraryElement(this);
 
   /**
    * Create the [FunctionElement] to be returned by [loadLibraryFunction],
@@ -5923,6 +5974,16 @@
   }
 
   /**
+   * Return the [LibraryElementImpl] of the given [element].
+   */
+  static LibraryElementImpl getImpl(LibraryElement element) {
+    if (element is LibraryElementHandle) {
+      return getImpl(element.actualElement);
+    }
+    return element as LibraryElementImpl;
+  }
+
+  /**
    * Return `true` if the [library] has the given [capability].
    */
   static bool hasResolutionCapability(
@@ -6078,7 +6139,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitLocalVariableElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitLocalVariableElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
@@ -6198,7 +6260,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitMethodElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
@@ -6209,6 +6272,33 @@
   @override
   MethodDeclaration computeNode() =>
       getNodeMatching((node) => node is MethodDeclaration);
+
+  @override
+  FunctionType getReifiedType(DartType objectType) {
+    // Collect the covariant parameters. Do this first so we don't allocate
+    // anything in the common case where there are none.
+    Set<String> covariantNames;
+    for (ParameterElement parameter in parameters) {
+      if (parameter.isCovariant) {
+        covariantNames ??= new Set();
+        covariantNames.add(parameter.name);
+      }
+    }
+
+    if (covariantNames == null) return type;
+
+    List<ParameterElement> covariantParameters = parameters.map((parameter) {
+      if (!covariantNames.contains(parameter.name)) {
+        return parameter;
+      }
+
+      return new ParameterElementImpl.synthetic(
+          parameter.name, objectType, parameter.parameterKind);
+    }).toList();
+
+    return new FunctionElementImpl.synthetic(covariantParameters, returnType)
+        .type;
+  }
 }
 
 /**
@@ -6235,76 +6325,81 @@
   static const Modifier CONST = const Modifier('CONST', 2);
 
   /**
+   * Indicates that the modifier 'covariant' was applied to the element.
+   */
+  static const Modifier COVARIANT = const Modifier('COVARIANT', 3);
+
+  /**
    * Indicates that the import element represents a deferred library.
    */
-  static const Modifier DEFERRED = const Modifier('DEFERRED', 3);
+  static const Modifier DEFERRED = const Modifier('DEFERRED', 4);
 
   /**
    * Indicates that a class element was defined by an enum declaration.
    */
-  static const Modifier ENUM = const Modifier('ENUM', 4);
+  static const Modifier ENUM = const Modifier('ENUM', 5);
 
   /**
    * Indicates that a class element was defined by an enum declaration.
    */
-  static const Modifier EXTERNAL = const Modifier('EXTERNAL', 5);
+  static const Modifier EXTERNAL = const Modifier('EXTERNAL', 6);
 
   /**
    * Indicates that the modifier 'factory' was applied to the element.
    */
-  static const Modifier FACTORY = const Modifier('FACTORY', 6);
+  static const Modifier FACTORY = const Modifier('FACTORY', 7);
 
   /**
    * Indicates that the modifier 'final' was applied to the element.
    */
-  static const Modifier FINAL = const Modifier('FINAL', 7);
+  static const Modifier FINAL = const Modifier('FINAL', 8);
 
   /**
    * Indicates that an executable element has a body marked as being a
    * generator.
    */
-  static const Modifier GENERATOR = const Modifier('GENERATOR', 8);
+  static const Modifier GENERATOR = const Modifier('GENERATOR', 9);
 
   /**
    * Indicates that the pseudo-modifier 'get' was applied to the element.
    */
-  static const Modifier GETTER = const Modifier('GETTER', 9);
+  static const Modifier GETTER = const Modifier('GETTER', 10);
 
   /**
    * A flag used for libraries indicating that the defining compilation unit
    * contains at least one import directive whose URI uses the "dart-ext"
    * scheme.
    */
-  static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 10);
+  static const Modifier HAS_EXT_URI = const Modifier('HAS_EXT_URI', 11);
 
   /**
    * Indicates that the associated element did not have an explicit type
    * associated with it. If the element is an [ExecutableElement], then the
    * type being referred to is the return type.
    */
-  static const Modifier IMPLICIT_TYPE = const Modifier('IMPLICIT_TYPE', 11);
+  static const Modifier IMPLICIT_TYPE = const Modifier('IMPLICIT_TYPE', 12);
 
   /**
    * Indicates that a class is a mixin application.
    */
   static const Modifier MIXIN_APPLICATION =
-      const Modifier('MIXIN_APPLICATION', 12);
+      const Modifier('MIXIN_APPLICATION', 13);
 
   /**
    * Indicates that a class contains an explicit reference to 'super'.
    */
   static const Modifier REFERENCES_SUPER =
-      const Modifier('REFERENCES_SUPER', 13);
+      const Modifier('REFERENCES_SUPER', 14);
 
   /**
    * Indicates that the pseudo-modifier 'set' was applied to the element.
    */
-  static const Modifier SETTER = const Modifier('SETTER', 14);
+  static const Modifier SETTER = const Modifier('SETTER', 15);
 
   /**
    * Indicates that the modifier 'static' was applied to the element.
    */
-  static const Modifier STATIC = const Modifier('STATIC', 15);
+  static const Modifier STATIC = const Modifier('STATIC', 16);
 
   /**
    * Indicates that the element does not appear in the source code but was
@@ -6312,12 +6407,13 @@
    * constructors, an implicit zero-argument constructor will be created and it
    * will be marked as being synthetic.
    */
-  static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 16);
+  static const Modifier SYNTHETIC = const Modifier('SYNTHETIC', 17);
 
   static const List<Modifier> values = const [
     ABSTRACT,
     ASYNCHRONOUS,
     CONST,
+    COVARIANT,
     DEFERRED,
     ENUM,
     EXTERNAL,
@@ -6489,7 +6585,8 @@
   CompilationUnit get unit => null;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitMultiplyDefinedElement(this);
 
   @override
   String computeDocumentationComment() => null;
@@ -7034,7 +7131,7 @@
 
   @override
   bool get isCovariant {
-    if (inheritsCovariant) {
+    if (isExplicitlyCovariant || inheritsCovariant) {
       return true;
     }
     for (ElementAnnotationImpl annotation in metadata) {
@@ -7045,10 +7142,28 @@
     return false;
   }
 
+  /**
+   * Return true if this parameter is explicitly marked as being covariant.
+   */
+  bool get isExplicitlyCovariant {
+    if (_unlinkedParam != null) {
+      return _unlinkedParam.isExplicitlyCovariant;
+    }
+    return hasModifier(Modifier.COVARIANT);
+  }
+
+  /**
+   * Set whether this variable parameter is explicitly marked as being covariant.
+   */
+  void set isExplicitlyCovariant(bool isCovariant) {
+    _assertNotResynthesized(_unlinkedParam);
+    setModifier(Modifier.COVARIANT, isCovariant);
+  }
+
   @override
   bool get isFinal {
     if (_unlinkedParam != null) {
-      return false;
+      return _unlinkedParam.isFinal;
     }
     return super.isFinal;
   }
@@ -7181,7 +7296,8 @@
   UnlinkedExpr get _unlinkedConst => _unlinkedParam?.initializer?.bodyExpr;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitParameterElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitParameterElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
@@ -7310,7 +7426,7 @@
 
   @override
   bool get isCovariant {
-    if (inheritsCovariant) {
+    if (isExplicitlyCovariant || inheritsCovariant) {
       return true;
     }
     for (ElementAnnotationImpl annotation in setter.variable.metadata) {
@@ -7322,6 +7438,15 @@
   }
 
   @override
+  bool get isExplicitlyCovariant {
+    PropertyInducingElement variable = setter.variable;
+    if (variable is FieldElementImpl) {
+      return variable.isCovariant;
+    }
+    return false;
+  }
+
+  @override
   DartType get type => setter.variable.type;
 
   @override
@@ -7421,7 +7546,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitPrefixElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitPrefixElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
@@ -7593,7 +7719,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitPropertyAccessorElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
@@ -7759,6 +7886,8 @@
  * The context in which elements are resynthesized.
  */
 abstract class ResynthesizerContext {
+  bool get isStrongMode;
+
   /**
    * Build [ElementAnnotationImpl] for the given [UnlinkedExpr].
    */
@@ -7933,7 +8062,8 @@
   ElementKind get kind => ElementKind.TOP_LEVEL_VARIABLE;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitTopLevelVariableElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitTopLevelVariableElement(this);
 
   @override
   VariableDeclaration computeNode() =>
@@ -8081,7 +8211,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitTypeParameterElement(this);
 
   @override
   void appendTo(StringBuffer buffer) {
diff --git a/pkg/analyzer/lib/src/dart/element/handle.dart b/pkg/analyzer/lib/src/dart/element/handle.dart
index 93edeca..f8ae4a9 100644
--- a/pkg/analyzer/lib/src/dart/element/handle.dart
+++ b/pkg/analyzer/lib/src/dart/element/handle.dart
@@ -409,7 +409,8 @@
       object is Element && object.location == _location;
 
   @override
-  accept(ElementVisitor visitor) => actualElement.accept(visitor);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      actualElement.accept(visitor);
 
   @override
   String computeDocumentationComment() => documentationComment;
@@ -874,6 +875,10 @@
 
   @override
   MethodDeclaration computeNode() => actualElement.computeNode();
+
+  @override
+  FunctionType getReifiedType(DartType objectType) =>
+      actualElement.getReifiedType(objectType);
 }
 
 /**
diff --git a/pkg/analyzer/lib/src/dart/element/member.dart b/pkg/analyzer/lib/src/dart/element/member.dart
index 6210e77..06be4db 100644
--- a/pkg/analyzer/lib/src/dart/element/member.dart
+++ b/pkg/analyzer/lib/src/dart/element/member.dart
@@ -60,7 +60,8 @@
       from(baseElement.redirectedConstructor, definingType);
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitConstructorElement(this);
 
   @override
   ConstructorDeclaration computeNode() => baseElement.computeNode();
@@ -243,7 +244,7 @@
   }
 
   @override
-  accept(ElementVisitor visitor) =>
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
       visitor.visitFieldFormalParameterElement(this);
 }
 
@@ -283,7 +284,8 @@
       PropertyAccessorMember.from(baseElement.setter, definingType);
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitFieldElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitFieldElement(this);
 
   @override
   VariableDeclaration computeNode() => baseElement.computeNode();
@@ -374,7 +376,8 @@
   SourceRange get visibleRange => baseElement.visibleRange;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitFunctionElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitFunctionElement(this);
 
   @override
   FunctionDeclaration computeNode() => baseElement.computeNode();
@@ -593,12 +596,17 @@
   ClassElement get enclosingElement => baseElement.enclosingElement;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitMethodElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitMethodElement(this);
 
   @override
   MethodDeclaration computeNode() => baseElement.computeNode();
 
   @override
+  FunctionType getReifiedType(DartType objectType) =>
+      substituteFor(baseElement.getReifiedType(objectType));
+
+  @override
   String toString() {
     MethodElement baseElement = this.baseElement;
     List<ParameterElement> parameters = this.parameters;
@@ -696,7 +704,8 @@
   SourceRange get visibleRange => baseElement.visibleRange;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitParameterElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitParameterElement(this);
 
   @override
   FormalParameter computeNode() => baseElement.computeNode();
@@ -792,7 +801,8 @@
   }
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitPropertyAccessorElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitPropertyAccessorElement(this);
 
   @override
   String toString() {
@@ -898,13 +908,11 @@
  * [FunctionType.returnType], and [ParameterMember].
  */
 class TypeParameterMember extends Member implements TypeParameterElement {
-  @override
-  final DartType bound;
-
+  DartType _bound;
   DartType _type;
 
   TypeParameterMember(
-      TypeParameterElement baseElement, DartType definingType, this.bound)
+      TypeParameterElement baseElement, DartType definingType, this._bound)
       : super(baseElement, definingType) {
     _type = new TypeParameterTypeImpl(this);
   }
@@ -914,6 +922,9 @@
       super.baseElement as TypeParameterElement;
 
   @override
+  DartType get bound => _bound;
+
+  @override
   Element get enclosingElement => baseElement.enclosingElement;
 
   @override
@@ -923,7 +934,8 @@
   TypeParameterType get type => _type;
 
   @override
-  accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this);
+  /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor) =>
+      visitor.visitTypeParameterElement(this);
 
   /**
    * If the given [parameter]'s type is different when any type parameters from
@@ -932,19 +944,41 @@
    * the given parameter. Return the member that was created, or the base
    * parameter if no member was created.
    */
-  static TypeParameterElement from(
-      TypeParameterElement parameter, ParameterizedType definingType) {
-    if (parameter?.bound == null || definingType.typeArguments.isEmpty) {
-      return parameter;
-    }
-
-    DartType bound = parameter.bound;
+  static List<TypeParameterElement> from(
+      List<TypeParameterElement> formals, FunctionType definingType) {
     List<DartType> argumentTypes = definingType.typeArguments;
+    if (argumentTypes.isEmpty) {
+      return formals;
+    }
     List<DartType> parameterTypes =
         TypeParameterTypeImpl.getTypes(definingType.typeParameters);
-    DartType substitutedBound =
-        bound.substitute2(argumentTypes, parameterTypes);
-    return new TypeParameterMember(parameter, definingType, substitutedBound);
+
+    // Create type formals with specialized bounds.
+    // For example `<U extends T>` where T comes from an outer scope.
+    var results = formals.toList(growable: false);
+    for (int i = 0; i < results.length; i++) {
+      var formal = results[i];
+      DartType bound = formal?.bound;
+      if (bound != null) {
+        // substitute type arguments from the function.
+        bound = bound.substitute2(argumentTypes, parameterTypes);
+        results[i] = new TypeParameterMember(formal, definingType, bound);
+      }
+    }
+    List<TypeParameterType> formalTypes =
+        TypeParameterTypeImpl.getTypes(formals);
+    for (var formal in results) {
+      if (formal is TypeParameterMember) {
+        // Recursive bounds are allowed too, so make sure these are updated
+        // to refer to any new TypeParameterMember we just made, rather than
+        // the original type parameter
+        // TODO(jmesserly): this is required so substituting for the
+        // type formal will work. Investigate if there's a better solution.
+        formal._bound = formal.bound
+            .substitute2(TypeParameterTypeImpl.getTypes(results), formalTypes);
+      }
+    }
+    return results;
   }
 }
 
diff --git a/pkg/analyzer/lib/src/dart/element/type.dart b/pkg/analyzer/lib/src/dart/element/type.dart
index bf898e0..b950803 100644
--- a/pkg/analyzer/lib/src/dart/element/type.dart
+++ b/pkg/analyzer/lib/src/dart/element/type.dart
@@ -602,13 +602,7 @@
 
     // Create type formals with specialized bounds.
     // For example `<U extends T>` where T comes from an outer scope.
-    List<TypeParameterElement> result =
-        new List<TypeParameterElement>(formalCount);
-
-    for (int i = 0; i < formalCount; i++) {
-      result[i] = TypeParameterMember.from(baseTypeFormals[i], this);
-    }
-    return result;
+    return TypeParameterMember.from(baseTypeFormals, this);
   }
 
   @override
@@ -828,16 +822,17 @@
         type,
         (DartType t, DartType s, _, __) =>
             (t as TypeImpl).isMoreSpecificThan(s, withDynamic),
-        new TypeSystemImpl().instantiateToBounds);
+        new TypeSystemImpl(null).instantiateToBounds);
   }
 
   @override
   bool isSubtypeOf(DartType type) {
+    var typeSystem = new TypeSystemImpl(null);
     return relate(
-        this,
-        type,
+        typeSystem.instantiateToBounds(this),
+        typeSystem.instantiateToBounds(type),
         (DartType t, DartType s, _, __) => t.isAssignableTo(s),
-        new TypeSystemImpl().instantiateToBounds);
+        typeSystem.instantiateToBounds);
   }
 
   @override
@@ -1026,16 +1021,12 @@
     // This type cast is safe, because we checked it above.
     FunctionType s = other as FunctionType;
     if (t.typeFormals.isNotEmpty) {
-      if (s.typeFormals.isEmpty) {
-        t = instantiateToBounds(t);
-      } else {
-        List<DartType> freshVariables = relateTypeFormals(t, s, returnRelation);
-        if (freshVariables == null) {
-          return false;
-        }
-        t = t.instantiate(freshVariables);
-        s = s.instantiate(freshVariables);
+      List<DartType> freshVariables = relateTypeFormals(t, s, returnRelation);
+      if (freshVariables == null) {
+        return false;
       }
+      t = t.instantiate(freshVariables);
+      s = s.instantiate(freshVariables);
     } else if (s.typeFormals.isNotEmpty) {
       return false;
     }
@@ -1390,6 +1381,15 @@
   }
 
   @override
+  bool get isDartAsyncFutureOr {
+    ClassElement element = this.element;
+    if (element == null) {
+      return false;
+    }
+    return element.name == "FutureOr" && element.library.isDartAsync;
+  }
+
+  @override
   bool get isDartCoreFunction {
     ClassElement element = this.element;
     if (element == null) {
@@ -1399,6 +1399,15 @@
   }
 
   @override
+  bool get isDartCoreNull {
+    ClassElement element = this.element;
+    if (element == null) {
+      return false;
+    }
+    return element.name == "Null" && element.library.isDartCore;
+  }
+
+  @override
   bool get isObject => element.supertype == null;
 
   @override
@@ -1592,6 +1601,12 @@
   bool isMoreSpecificThan(DartType type,
       [bool withDynamic = false, Set<Element> visitedElements]) {
     //
+    // T is Null and S is not Bottom.
+    //
+    if (isDartCoreNull && !type.isBottom) {
+      return true;
+    }
+
     // S is dynamic.
     // The test to determine whether S is dynamic is done here because dynamic
     // is not an instance of InterfaceType.
@@ -1949,7 +1964,7 @@
       //
       if (element.library.context.analysisOptions.strongMode) {
         TypeImpl t = newTypeArguments[0];
-        newTypeArguments[0] = t.flattenFutures(new StrongTypeSystemImpl());
+        newTypeArguments[0] = t.flattenFutures(new StrongTypeSystemImpl(null));
       }
     }
 
@@ -2152,8 +2167,7 @@
       return _leastUpperBound(first, second);
     }
     AnalysisContext context = first.element.context;
-    return context.typeSystem
-        .getLeastUpperBound(context.typeProvider, first, second);
+    return context.typeSystem.getLeastUpperBound(first, second);
   }
 
   /**
@@ -2372,9 +2386,15 @@
   bool get isDartAsyncFuture => false;
 
   @override
+  bool get isDartAsyncFutureOr => false;
+
+  @override
   bool get isDartCoreFunction => false;
 
   @override
+  bool get isDartCoreNull => false;
+
+  @override
   bool get isDynamic => false;
 
   @override
@@ -2555,10 +2575,10 @@
       : super(element, element.name);
 
   @override
-  ElementLocation get definition => element.location;
+  DartType get bound => element.bound ?? DynamicTypeImpl.instance;
 
   @override
-  DartType get bound => element.bound ?? DynamicTypeImpl.instance;
+  ElementLocation get definition => element.location;
 
   @override
   TypeParameterElement get element => super.element as TypeParameterElement;
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
index a81585b..72eb3ce 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
@@ -95,6 +95,30 @@
       "Try replacing the use of the deprecated member with the replacement.");
 
   /**
+   * Users should not create a class named `Function` anymore.
+   */
+  static const HintCode DEPRECATED_FUNCTION_CLASS_DECLARATION = const HintCode(
+      'DEPRECATED_FUNCTION_CLASS_DECLARATION',
+      "Declaring a class named 'Function' is deprecated.",
+      "Try renaming the class.");
+
+  /**
+   * `Function` should not be extended anymore.
+   */
+  static const HintCode DEPRECATED_EXTENDS_FUNCTION = const HintCode(
+      'DEPRECATED_EXTENDS_FUNCTION',
+      "Extending 'Function' is deprecated.",
+      "Try removing 'Function' from the 'extends' clause.");
+
+  /**
+   * `Function` should not be mixed in anymore.
+   */
+  static const HintCode DEPRECATED_MIXIN_FUNCTION = const HintCode(
+      'DEPRECATED_MIXIN_FUNCTION',
+      "Mixing in 'Function' is deprecated.",
+      "Try removing 'Function' from the 'with' clause.");
+
+  /**
    * Hint to use the ~/ operator.
    */
   static const HintCode DIVISION_OPTIMIZATION = const HintCode(
diff --git a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
index 74d54d7..70f1124 100644
--- a/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
+++ b/pkg/analyzer/lib/src/dart/error/syntactic_errors.dart
@@ -82,6 +82,11 @@
       "For-in loops use 'in' rather than a colon.",
       "Try replacing the colon with the keyword 'in'.");
 
+  static const ParserErrorCode CONST_AND_COVARIANT = const ParserErrorCode(
+      'CONST_AND_COVARIANT',
+      "Members can't be declared to be both 'const' and 'covariant'.",
+      "Try removing either the 'const' or 'covariant' keyword.");
+
   static const ParserErrorCode CONST_AND_FINAL = const ParserErrorCode(
       'CONST_AND_FINAL',
       "Members can't be declared to be both 'const' and 'final'.",
@@ -142,11 +147,37 @@
       "A continue statement in a switch statement must have a label as a target.",
       "Try adding a label associated with one of the case clauses to the continue statement.");
 
-  static const ParserErrorCode DEPRECATED_CLASS_TYPE_ALIAS =
+  static const ParserErrorCode COVARIANT_AFTER_VAR = const ParserErrorCode(
+      'COVARIANT_AFTER_VAR',
+      "The modifier 'covariant' should be before the modifier 'var'.",
+      "Try re-ordering the modifiers.");
+
+  static const ParserErrorCode COVARIANT_AND_STATIC = const ParserErrorCode(
+      'COVARIANT_AND_STATIC',
+      "Members can't be declared to be both 'covariant' and 'static'.",
+      "Try removing either the 'covariant' or 'static' keyword.");
+
+  static const ParserErrorCode COVARIANT_MEMBER = const ParserErrorCode(
+      'COVARIANT_MEMBER',
+      "Getters, setters and methods can't be declared to be 'covariant'.",
+      "Try removing the 'covariant' keyword.");
+
+  static const ParserErrorCode COVARIANT_TOP_LEVEL_DECLARATION =
       const ParserErrorCode(
-          'DEPRECATED_CLASS_TYPE_ALIAS',
-          "The 'typedef' mixin application was replaced with 'class'.",
-          "Try re-writing the typedef as 'class C = S with M'.");
+          'COVARIANT_TOP_LEVEL_DECLARATION',
+          "Top-level declarations can't be declared to be covariant.",
+          "Try removing the keyword 'covariant'.");
+
+  static const ParserErrorCode COVARIANT_CONSTRUCTOR = const ParserErrorCode(
+      'COVARIANT_CONSTRUCTOR',
+      "A constructor can't be declared to be 'covariant'.",
+      "Try removing the keyword 'covariant'.");
+
+  static const ParserErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE =
+      const ParserErrorCode(
+          'DEFAULT_VALUE_IN_FUNCTION_TYPE',
+          "Parameters in a function type cannot have default values",
+          "Try removing the default value.");
 
   static const ParserErrorCode DIRECTIVE_AFTER_DECLARATION =
       const ParserErrorCode(
@@ -322,6 +353,11 @@
           "Field formal parameters can only be used in a constructor.",
           "Try replacing the field formal parameter with a normal parameter.");
 
+  static const ParserErrorCode FINAL_AND_COVARIANT = const ParserErrorCode(
+      'FINAL_AND_COVARIANT',
+      "Members can't be declared to be both 'final' and 'covariant'.",
+      "Try removing either the 'final' or 'covariant' keyword.");
+
   static const ParserErrorCode FINAL_AND_VAR = const ParserErrorCode(
       'FINAL_AND_VAR',
       "Members can't be declared to be both 'final' and 'var'.",
@@ -446,7 +482,7 @@
 
   static const ParserErrorCode INVALID_SYNC = const ParserErrorCode(
       'INVALID_SYNC',
-      "The modifier 'sync' isn't allowed for an exrpression function body.",
+      "The modifier 'sync' isn't allowed for an expression function body.",
       "Try converting the body to a block.");
 
   static const ParserErrorCode INVALID_UNICODE_ESCAPE = const ParserErrorCode(
@@ -523,18 +559,17 @@
       "A function body must be provided.",
       "Try adding a function body.");
 
+  static const ParserErrorCode MISSING_FUNCTION_KEYWORD = const ParserErrorCode(
+      'MISSING_FUNCTION_KEYWORD',
+      "Function types must have the keyword 'Function' before the parameter list.",
+      "Try adding the keyword 'Function'.");
+
   static const ParserErrorCode MISSING_FUNCTION_PARAMETERS =
       const ParserErrorCode(
           'MISSING_FUNCTION_PARAMETERS',
           "Functions must have an explicit list of parameters.",
           "Try adding a parameter list.");
 
-  static const ParserErrorCode MISSING_METHOD_PARAMETERS =
-      const ParserErrorCode(
-          'MISSING_METHOD_PARAMETERS',
-          "Methods must have an explicit list of parameters.",
-          "Try adding a parameter list.");
-
   static const ParserErrorCode MISSING_GET = const ParserErrorCode(
       'MISSING_GET',
       "Getters must have the keyword 'get' before the getter name.",
@@ -551,6 +586,18 @@
       "Operator declarations must be preceeded by the keyword 'operator'.",
       "Try adding the keyword 'operator'.");
 
+  static const ParserErrorCode MISSING_METHOD_PARAMETERS =
+      const ParserErrorCode(
+          'MISSING_METHOD_PARAMETERS',
+          "Methods must have an explicit list of parameters.",
+          "Try adding a parameter list.");
+
+  static const ParserErrorCode MISSING_NAME_FOR_NAMED_PARAMETER =
+      const ParserErrorCode(
+          'MISSING_NAME_FOR_NAMED_PARAMETER',
+          "Named parameters in a function type must have a name",
+          "Try providing a name for the parameter or removing the curly braces.");
+
   static const ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE =
       const ParserErrorCode(
           'MISSING_NAME_IN_LIBRARY_DIRECTIVE',
@@ -661,6 +708,11 @@
       "Try removing the name, or "
       "moving the function expression to a function declaration statement.");
 
+  static const ParserErrorCode NAMED_FUNCTION_TYPE = const ParserErrorCode(
+      'NAMED_FUNCTION_TYPE',
+      "Function types can't be named.",
+      "Try replacing the name with the keyword 'Function'.");
+
   static const ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP =
       const ParserErrorCode(
           'NAMED_PARAMETER_OUTSIDE_GROUP',
diff --git a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
index 69d3948..f00cc35 100644
--- a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
@@ -5,6 +5,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
@@ -962,8 +963,8 @@
       int numOfPositionalParameters,
       List<String> namedParameters) {
     DynamicTypeImpl dynamicType = DynamicTypeImpl.instance;
-    SimpleIdentifier nameIdentifier =
-        new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, name, 0));
+    SimpleIdentifier nameIdentifier = astFactory
+        .simpleIdentifier(new StringToken(TokenType.IDENTIFIER, name, 0));
     ExecutableElementImpl executable;
     ExecutableElement elementToMerge = elementArrayToMerge[0];
     if (elementToMerge is MethodElement) {
diff --git a/pkg/analyzer/lib/src/dart/resolver/scope.dart b/pkg/analyzer/lib/src/dart/resolver/scope.dart
index 1fc385e..dcbcb04 100644
--- a/pkg/analyzer/lib/src/dart/resolver/scope.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/scope.dart
@@ -663,7 +663,7 @@
    * A table mapping names that are defined in this namespace to the element
    * representing the thing declared with that name.
    */
-  final HashMap<String, Element> _definedNames;
+  final Map<String, Element> _definedNames;
 
   /**
    * Initialize a newly created namespace to have the [_definedNames].
diff --git a/pkg/analyzer/lib/src/dart/sdk/patch.dart b/pkg/analyzer/lib/src/dart/sdk/patch.dart
index 88a122e..44f6765 100644
--- a/pkg/analyzer/lib/src/dart/sdk/patch.dart
+++ b/pkg/analyzer/lib/src/dart/sdk/patch.dart
@@ -10,12 +10,9 @@
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/src/dart/scanner/reader.dart';
 import 'package:analyzer/src/dart/scanner/scanner.dart';
-import 'package:analyzer/src/dart/sdk/sdk.dart';
 import 'package:analyzer/src/generated/parser.dart';
-import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:meta/meta.dart';
-import 'package:path/src/context.dart';
 
 /**
  * [SdkPatcher] applies patches to SDK [CompilationUnit].
@@ -28,12 +25,13 @@
 
   /**
    * Patch the given [unit] of a SDK [source] with the patches defined in
-   * the [sdk] for the given [platform].  Throw [ArgumentError] if a patch
+   * [allPatchPaths].  Throw [ArgumentError] if a patch
    * file cannot be read, or the contents violates rules for patch files.
    */
   void patch(
-      FolderBasedDartSdk sdk,
-      int platform,
+      ResourceProvider resourceProvider,
+      bool strongMode,
+      Map<String, List<String>> allPatchPaths,
       AnalysisErrorListener errorListener,
       Source source,
       CompilationUnit unit) {
@@ -53,21 +51,10 @@
       _allowNewPublicNames = libraryName == '_internal';
     }
     // Prepare the patch files to apply.
-    List<String> patchPaths;
-    {
-      SdkLibrary sdkLibrary = sdk.getSdkLibrary(libraryUriStr);
-      if (sdkLibrary == null) {
-        throw new ArgumentError(
-            'The library $libraryUriStr is not defined in the SDK.');
-      }
-      patchPaths = sdkLibrary.getPatches(platform);
-    }
+    List<String> patchPaths = allPatchPaths[libraryUriStr];
 
-    bool strongMode = sdk.analysisOptions.strongMode;
-    Context pathContext = sdk.resourceProvider.pathContext;
     for (String path in patchPaths) {
-      String pathInLib = pathContext.joinAll(path.split('/'));
-      File patchFile = sdk.libraryDirectory.getChildAssumingFile(pathInLib);
+      File patchFile = resourceProvider.getFile(path);
       if (!patchFile.exists) {
         throw new ArgumentError(
             'The patch file ${patchFile.path} for $source does not exist.');
@@ -112,6 +99,78 @@
     return 'the line ${location.lineNumber}';
   }
 
+  void _matchParameterLists(FormalParameterList baseParameters,
+      FormalParameterList patchParameters, String context()) {
+    if (baseParameters == null && patchParameters == null) return;
+    if (baseParameters == null || patchParameters == null) {
+      throw new ArgumentError("${context()}, parameter lists don't match");
+    }
+    if (baseParameters.parameters.length != patchParameters.parameters.length) {
+      throw new ArgumentError(
+          '${context()}, parameter lists have different lengths');
+    }
+    for (var i = 0; i < baseParameters.parameters.length; i++) {
+      _matchParameters(baseParameters.parameters[i],
+          patchParameters.parameters[i], () => '${context()}, parameter $i');
+    }
+  }
+
+  void _matchParameters(FormalParameter baseParameter,
+      FormalParameter patchParameter, String whichParameter()) {
+    if (baseParameter.identifier.name != patchParameter.identifier.name) {
+      throw new ArgumentError('${whichParameter()} has different name');
+    }
+    NormalFormalParameter baseParameterWithoutDefault =
+        _withoutDefault(baseParameter);
+    NormalFormalParameter patchParameterWithoutDefault =
+        _withoutDefault(patchParameter);
+    if (baseParameterWithoutDefault is SimpleFormalParameter &&
+        patchParameterWithoutDefault is SimpleFormalParameter) {
+      _matchTypes(baseParameterWithoutDefault.type,
+          patchParameterWithoutDefault.type, () => '${whichParameter()} type');
+    } else if (baseParameterWithoutDefault is FunctionTypedFormalParameter &&
+        patchParameterWithoutDefault is FunctionTypedFormalParameter) {
+      _matchTypes(
+          baseParameterWithoutDefault.returnType,
+          patchParameterWithoutDefault.returnType,
+          () => '${whichParameter()} return type');
+      _matchParameterLists(
+          baseParameterWithoutDefault.parameters,
+          patchParameterWithoutDefault.parameters,
+          () => '${whichParameter()} parameters');
+    } else if (baseParameterWithoutDefault is FieldFormalParameter &&
+        patchParameter is FieldFormalParameter) {
+      throw new ArgumentError(
+          '${whichParameter()} cannot be patched (field formal parameters are not supported)');
+    } else {
+      throw new ArgumentError(
+          '${whichParameter()} mismatch (different parameter kinds)');
+    }
+  }
+
+  void _matchTypes(TypeName baseType, TypeName patchType, String whichType()) {
+    error() => new ArgumentError("${whichType()} doesn't match");
+    if (baseType == null && patchType == null) return;
+    if (baseType == null || patchType == null) throw error();
+    // Match up the types token by token; this is more restrictive than strictly
+    // necessary, but it's easy and sufficient for patching purposes.
+    Token baseToken = baseType.beginToken;
+    Token patchToken = patchType.beginToken;
+    while (true) {
+      if (baseToken.lexeme != patchToken.lexeme) throw error();
+      if (identical(baseToken, baseType.endToken) &&
+          identical(patchToken, patchType.endToken)) {
+        break;
+      }
+      if (identical(baseToken, baseType.endToken) ||
+          identical(patchToken, patchType.endToken)) {
+        throw error();
+      }
+      baseToken = baseToken.next;
+      patchToken = patchToken.next;
+    }
+  }
+
   void _patchClassMembers(
       ClassDeclaration baseClass, ClassDeclaration patchClass) {
     String className = baseClass.name.name;
@@ -147,6 +206,12 @@
               } else {
                 _failExternalKeyword(name, baseMember.offset);
               }
+              _matchParameterLists(
+                  baseMember.parameters,
+                  patchMember.parameters,
+                  () => 'While patching $className.$name');
+              _matchTypes(baseMember.returnType, patchMember.returnType,
+                  () => 'While patching $className.$name, return type');
               // Replace the body.
               FunctionBody oldBody = baseMember.body;
               FunctionBody newBody = patchMember.body;
@@ -190,6 +255,11 @@
                     'Cannot patch external constructors with initializers '
                     'in $_baseDesc.');
               }
+              _matchParameterLists(
+                  baseMember.parameters, patchMember.parameters, () {
+                String nameSuffix = name == null ? '' : '.$name';
+                return 'While patching $className$nameSuffix';
+              });
               // Prepare nodes.
               FunctionBody baseBody = baseMember.body;
               FunctionBody patchBody = patchMember.body;
@@ -263,6 +333,14 @@
               } else {
                 _failExternalKeyword(name, baseDeclaration.offset);
               }
+              _matchParameterLists(
+                  baseDeclaration.functionExpression.parameters,
+                  patchDeclaration.functionExpression.parameters,
+                  () => 'While patching $name');
+              _matchTypes(
+                  baseDeclaration.returnType,
+                  patchDeclaration.returnType,
+                  () => 'While patching $name, return type');
               // Replace the body.
               FunctionExpression oldExpr = baseDeclaration.functionExpression;
               FunctionBody newBody = patchDeclaration.functionExpression.body;
@@ -294,6 +372,13 @@
           _failIfPublicName(patchDeclaration, patchDeclaration.name.name);
           declarationsToAppend.add(patchDeclaration);
         }
+      } else if (patchDeclaration is TopLevelVariableDeclaration &&
+          !_hasPatchAnnotation(patchDeclaration.metadata)) {
+        for (VariableDeclaration variable
+            in patchDeclaration.variables.variables) {
+          _failIfPublicName(patchDeclaration, variable.name.name);
+        }
+        declarationsToAppend.add(patchDeclaration);
       } else {
         _failInPatch('contains an unsupported top-level declaration',
             patchDeclaration.offset);
@@ -306,6 +391,18 @@
     }
   }
 
+  NormalFormalParameter _withoutDefault(FormalParameter parameter) {
+    if (parameter is NormalFormalParameter) {
+      return parameter;
+    } else if (parameter is DefaultFormalParameter) {
+      return parameter.parameter;
+    } else {
+      // Should not happen.
+      assert(false);
+      return null;
+    }
+  }
+
   /**
    * Parse the given [source] into AST.
    */
diff --git a/pkg/analyzer/lib/src/dart/sdk/sdk.dart b/pkg/analyzer/lib/src/dart/sdk/sdk.dart
index 303e6a4..11b7e9b 100644
--- a/pkg/analyzer/lib/src/dart/sdk/sdk.dart
+++ b/pkg/analyzer/lib/src/dart/sdk/sdk.dart
@@ -22,7 +22,7 @@
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
-import 'package:analyzer/src/summary/summary_sdk.dart';
+import 'package:analyzer/src/summary/package_bundle_reader.dart';
 import 'package:path/path.dart' as pathos;
 import 'package:yaml/yaml.dart';
 
@@ -89,11 +89,12 @@
       SourceFactory factory = new SourceFactory([new DartUriResolver(this)]);
       _analysisContext.sourceFactory = factory;
       if (_useSummary) {
-        bool strongMode = _analysisOptions?.strongMode ?? false;
         PackageBundle sdkBundle = getLinkedBundle();
         if (sdkBundle != null) {
-          _analysisContext.resultProvider = new SdkSummaryResultProvider(
-              _analysisContext, sdkBundle, strongMode);
+          SummaryDataStore dataStore = new SummaryDataStore([]);
+          dataStore.addBundle(null, sdkBundle);
+          _analysisContext.resultProvider =
+              new InputPackagesResultProvider(_analysisContext, dataStore);
         }
       }
     }
@@ -273,15 +274,14 @@
   static const String _EMBEDDED_LIB_MAP_KEY = 'embedded_libs';
   final Map<String, String> _urlMappings = new HashMap<String, String>();
 
-  PackageBundle _embedderBundle;
+  Folder _embedderYamlLibFolder;
 
   EmbedderSdk(
       ResourceProvider resourceProvider, Map<Folder, YamlMap> embedderYamls) {
     this.resourceProvider = resourceProvider;
     embedderYamls?.forEach(_processEmbedderYaml);
     if (embedderYamls?.length == 1) {
-      Folder libFolder = embedderYamls.keys.first;
-      _loadEmbedderBundle(libFolder);
+      _embedderYamlLibFolder = embedderYamls.keys.first;
     }
   }
 
@@ -299,8 +299,17 @@
 
   @override
   PackageBundle getSummarySdkBundle(bool strongMode) {
-    if (strongMode) {
-      return _embedderBundle;
+    String name = strongMode ? 'strong.sum' : 'spec.sum';
+    File file = _embedderYamlLibFolder.parent.getChildAssumingFile(name);
+    try {
+      if (file.exists) {
+        List<int> bytes = file.readAsBytesSync();
+        return new PackageBundle.fromBuffer(bytes);
+      }
+    } catch (exception, stackTrace) {
+      AnalysisEngine.instance.logger.logError(
+          'Failed to load SDK analysis summary from $file',
+          new CaughtException(exception, stackTrace));
     }
     return null;
   }
@@ -345,16 +354,6 @@
     }
   }
 
-  void _loadEmbedderBundle(Folder libFolder) {
-    File bundleFile = libFolder.parent.getChildAssumingFile('sdk.ds');
-    if (bundleFile.exists) {
-      try {
-        List<int> bytes = bundleFile.readAsBytesSync();
-        _embedderBundle = new PackageBundle.fromBuffer(bytes);
-      } on FileSystemException {}
-    }
-  }
-
   /**
    * Install the mapping from [name] to [libDir]/[file].
    */
@@ -698,7 +697,16 @@
     String outDir = pathContext.dirname(pathContext.dirname(exec));
     String sdkPath = pathContext.join(pathContext.dirname(outDir), "sdk");
     if (resourceProvider.getFolder(sdkPath).exists) {
-      return sdkPath;
+      // We are executing in the context of a test.  sdkPath is the path to the
+      // *source* files for the SDK.  But we want to test using the path to the
+      // *built* SDK if possible.
+      String builtSdkPath =
+          pathContext.join(pathContext.dirname(exec), 'dart-sdk');
+      if (resourceProvider.getFolder(builtSdkPath).exists) {
+        return builtSdkPath;
+      } else {
+        return sdkPath;
+      }
     }
     // probably be "dart-sdk/bin/dart"
     return pathContext.dirname(pathContext.dirname(exec));
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index c73de06..9b4b73d 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -953,17 +953,6 @@
           "removing the extends clause.");
 
   /**
-   * DEP 37 extends the syntax for assert() to allow a second "message"
-   * argument.  We issue this error if the user tries to supply a "message"
-   * argument but the DEP is not enabled.
-   */
-  static const CompileTimeErrorCode EXTRA_ARGUMENT_TO_ASSERT =
-      const CompileTimeErrorCode(
-          'EXTRA_ARGUMENT_TO_ASSERT',
-          "Assertions only accept a single argument.",
-          "Try removing the message, or enable messages in assert statements.");
-
-  /**
    * 12.14.2 Binding Actuals to Formals: It is a static warning if <i>m &lt;
    * h</i> or if <i>m &gt; n</i>.
    *
@@ -1468,6 +1457,16 @@
           "Try replacing the type parameter with a different type.");
 
   /**
+   * The 'covariant' keyword was found in an inappropriate location.
+   */
+  static const CompileTimeErrorCode INVALID_USE_OF_COVARIANT =
+      const CompileTimeErrorCode(
+          'INVALID_USE_OF_COVARIANT',
+          "The 'covariant' keyword can only be used for parameters in instance "
+          "methods or before non-final instance fields.",
+          "Try removing the 'covariant' keyword.");
+
+  /**
    * 14.2 Exports: It is a compile-time error if the compilation unit found at
    * the specified URI is not a library declaration.
    *
@@ -4899,6 +4898,18 @@
       "Missing type arguments for calling generic function type '{0}'.",
       _implicitDynamicCorrection);
 
+  static const StrongModeCode NO_DEFAULT_BOUNDS = const StrongModeCode(
+      ErrorType.COMPILE_TIME_ERROR,
+      'NO_DEFAULT_BOUNDS',
+      "Type has no default bounds",
+      "Try adding explicit type arguments to type");
+
+  static const StrongModeCode NOT_INSTANTIATED_BOUND = const StrongModeCode(
+      ErrorType.COMPILE_TIME_ERROR,
+      'NOT_INSTANTIATED_BOUND',
+      "Type parameter bound types must be instantiated.",
+      "Try adding type arguments.");
+
   static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE = const StrongModeCode(
       ErrorType.STATIC_WARNING,
       'UNSAFE_BLOCK_CLOSURE_INFERENCE',
diff --git a/pkg/analyzer/lib/src/generated/constant.dart b/pkg/analyzer/lib/src/generated/constant.dart
index db0eb79..dfa5310 100644
--- a/pkg/analyzer/lib/src/generated/constant.dart
+++ b/pkg/analyzer/lib/src/generated/constant.dart
@@ -118,8 +118,10 @@
    * [source]. The [typeProvider] is the type provider used to access known
    * types.
    */
-  ConstantEvaluator(this._source, this._typeProvider, {TypeSystem typeSystem})
-      : _typeSystem = typeSystem ?? new TypeSystemImpl();
+  ConstantEvaluator(this._source, TypeProvider typeProvider,
+      {TypeSystem typeSystem})
+      : _typeSystem = typeSystem ?? new TypeSystemImpl(typeProvider),
+        _typeProvider = typeProvider;
 
   EvaluationResult evaluate(Expression expression) {
     RecordingErrorListener errorListener = new RecordingErrorListener();
diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
index 5c44f86..4b1fd5c 100644
--- a/pkg/analyzer/lib/src/generated/element_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
@@ -1316,7 +1316,7 @@
               return null;
             }
             return StaticTypeWarningCode.UNDEFINED_FUNCTION;
-          } else if (!targetType.isDynamic && !targetType.isBottom) {
+          } else if (!targetType.isDynamic && target is! NullLiteral) {
             // Proxy-conditional warning, based on state of
             // targetType.getElement()
             return StaticTypeWarningCode.UNDEFINED_METHOD;
@@ -1561,7 +1561,7 @@
 
   DartType _getStaticTypeOrFunctionType(Expression expression) {
     if (expression is NullLiteral) {
-      return _resolver.typeProvider.bottomType;
+      return _resolver.typeProvider.nullType;
     }
     return _resolveTypeParameter(expression.staticType);
   }
@@ -1575,7 +1575,7 @@
     if (invokeType is FunctionType) {
       List<TypeParameterElement> parameters = invokeType.typeFormals;
 
-      NodeList<TypeName> arguments = typeArguments?.arguments;
+      NodeList<TypeAnnotation> arguments = typeArguments?.arguments;
       if (arguments != null && arguments.length != parameters.length) {
         if (_resolver.strongMode) {
           _resolver.errorReporter.reportErrorForNode(
@@ -2498,7 +2498,7 @@
    * [member] in the given [type] and not finding any member.
    */
   bool _shouldReportMissingMember(DartType type, Element member) {
-    return member == null && type != null && !type.isDynamic && !type.isBottom;
+    return member == null && type != null && !type.isDynamic && !type.isDartCoreNull;
   }
 
   /**
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 3860533..97b7250 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -6,6 +6,7 @@
 
 import 'dart:async';
 import 'dart:collection';
+import 'dart:typed_data';
 
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
@@ -24,11 +25,15 @@
 import 'package:analyzer/src/generated/resolver.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/utilities_general.dart';
-import 'package:analyzer/src/plugin/command_line_plugin.dart';
 import 'package:analyzer/src/plugin/engine_plugin.dart';
-import 'package:analyzer/src/plugin/options_plugin.dart';
 import 'package:analyzer/src/services/lint.dart';
+import 'package:analyzer/src/summary/api_signature.dart';
+import 'package:analyzer/src/task/dart.dart';
+import 'package:analyzer/src/task/general.dart';
+import 'package:analyzer/src/task/html.dart';
 import 'package:analyzer/src/task/manager.dart';
+import 'package:analyzer/src/task/options.dart';
+import 'package:analyzer/src/task/yaml.dart';
 import 'package:analyzer/task/dart.dart';
 import 'package:analyzer/task/model.dart';
 import 'package:front_end/src/base/timestamped_data.dart';
@@ -757,24 +762,11 @@
   Logger _logger = Logger.NULL;
 
   /**
-   * The plugin that defines the extension points and extensions that are defined by
-   * command-line applications using the analysis engine.
-   */
-  final CommandLinePlugin commandLinePlugin = new CommandLinePlugin();
-
-  /**
    * The plugin that defines the extension points and extensions that are
    * inherently defined by the analysis engine.
    */
   final EnginePlugin enginePlugin = new EnginePlugin();
 
-  /***
-   * The plugin that defines the extension points and extensions that are defined
-   * by applications that want to consume options defined in the analysis
-   * options file.
-   */
-  final OptionsPlugin optionsPlugin = new OptionsPlugin();
-
   /**
    * The instrumentation service that is to be used by this analysis engine.
    */
@@ -837,14 +829,9 @@
    */
   TaskManager get taskManager {
     if (_taskManager == null) {
-      if (enginePlugin.taskExtensionPoint == null) {
-        processRequiredPlugins();
-      }
       _taskManager = new TaskManager();
-      _taskManager.addTaskDescriptors(enginePlugin.taskDescriptors);
-      // TODO(brianwilkerson) Create a way to associate different results with
-      // different file suffixes, then make this pluggable.
-      _taskManager.addGeneralResult(DART_ERRORS);
+      _initializeTaskMap();
+      _initializeResults();
     }
     return _taskManager;
   }
@@ -870,8 +857,91 @@
    * process any other plugins.
    */
   void processRequiredPlugins() {
-    ExtensionManager manager = new ExtensionManager();
-    manager.processPlugins(requiredPlugins);
+    if (enginePlugin.workManagerFactoryExtensionPoint == null) {
+      ExtensionManager manager = new ExtensionManager();
+      manager.processPlugins(requiredPlugins);
+    }
+  }
+
+  void _initializeResults() {
+    _taskManager.addGeneralResult(DART_ERRORS);
+  }
+
+  void _initializeTaskMap() {
+    //
+    // Register general tasks.
+    //
+    _taskManager.addTaskDescriptor(GetContentTask.DESCRIPTOR);
+    //
+    // Register Dart tasks.
+    //
+    _taskManager.addTaskDescriptor(BuildCompilationUnitElementTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(BuildDirectiveElementsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(BuildEnumMemberElementsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(BuildExportNamespaceTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(BuildLibraryElementTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(BuildPublicNamespaceTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(BuildSourceExportClosureTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(BuildTypeProviderTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ComputeConstantDependenciesTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ComputeConstantValueTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(
+        ComputeInferableStaticVariableDependenciesTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ComputeLibraryCycleTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ComputeRequiredConstantsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ContainingLibrariesTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(DartErrorsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(EvaluateUnitConstantsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(GatherUsedImportedElementsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(GatherUsedLocalElementsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(GenerateHintsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(GenerateLintsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(InferInstanceMembersInUnitTask.DESCRIPTOR);
+    _taskManager
+        .addTaskDescriptor(InferStaticVariableTypesInUnitTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(InferStaticVariableTypeTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(LibraryErrorsReadyTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(LibraryUnitErrorsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ParseDartTask.DESCRIPTOR);
+    _taskManager
+        .addTaskDescriptor(PartiallyResolveUnitReferencesTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ReadyLibraryElement2Task.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ReadyLibraryElement5Task.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ReadyLibraryElement7Task.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ReadyResolvedUnitTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolveConstantExpressionTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolveDirectiveElementsTask.DESCRIPTOR);
+    _taskManager
+        .addTaskDescriptor(ResolvedUnit7InLibraryClosureTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolvedUnit7InLibraryTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolveInstanceFieldsInUnitTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolveLibraryReferencesTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolveLibraryTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolveLibraryTypeNamesTask.DESCRIPTOR);
+    _taskManager
+        .addTaskDescriptor(ResolveTopLevelLibraryTypeBoundsTask.DESCRIPTOR);
+    _taskManager
+        .addTaskDescriptor(ResolveTopLevelUnitTypeBoundsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolveUnitTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolveUnitTypeNamesTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ResolveVariableReferencesTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ScanDartTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(StrongModeVerifyUnitTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(VerifyUnitTask.DESCRIPTOR);
+    //
+    // Register HTML tasks.
+    //
+    _taskManager.addTaskDescriptor(DartScriptsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(HtmlErrorsTask.DESCRIPTOR);
+    _taskManager.addTaskDescriptor(ParseHtmlTask.DESCRIPTOR);
+    //
+    // Register YAML tasks.
+    //
+    _taskManager.addTaskDescriptor(ParseYamlTask.DESCRIPTOR);
+    //
+    // Register analysis option file tasks.
+    //
+    _taskManager.addTaskDescriptor(GenerateOptionsErrorsTask.DESCRIPTOR);
   }
 
   /**
@@ -1063,7 +1133,7 @@
   /**
    * The length of the list returned by [encodeCrossContextOptions].
    */
-  static const int crossContextOptionsLength = 2;
+  static const int signatureLength = 4;
 
   /**
    * Function that returns `true` if analysis is to parse and analyze function
@@ -1105,6 +1175,7 @@
   /**
    * Return `true` to enable custom assert messages (DEP 37).
    */
+  @deprecated
   bool get enableAssertMessage;
 
   /**
@@ -1227,10 +1298,10 @@
   List<Linter> get lintRules;
 
   /**
-   * Return the "platform" bit mask which should be used to apply patch files,
-   * or `0` if no patch files should be applied.
+   * A mapping from Dart SDK library name (e.g. "dart:core") to a list of paths
+   * to patch files that should be applied to the library.
    */
-  int get patchPlatform;
+  Map<String, List<String>> get patchPaths;
 
   /**
    * Return `true` if analysis is to parse comments.
@@ -1238,6 +1309,13 @@
   bool get preserveComments;
 
   /**
+   * Return the opaque signature of the options.
+   *
+   * The length of the list is guaranteed to equal [signatureLength].
+   */
+  Uint32List get signature;
+
+  /**
    * Return `true` if strong mode analysis should be used.
    */
   bool get strongMode;
@@ -1251,15 +1329,6 @@
   bool get trackCacheDependencies;
 
   /**
-   * Return a list of integers encoding of the values of the options that need
-   * to be the same across all of the contexts associated with partitions that
-   * are to be shared by a single analysis context.
-   *
-   * The length of the list is guaranteed to equal [crossContextOptionsLength].
-   */
-  List<int> encodeCrossContextOptions();
-
-  /**
    * Reset the state of this set of analysis options to its original state.
    */
   void resetToDefaults();
@@ -1271,12 +1340,11 @@
   void setCrossContextOptionsFrom(AnalysisOptions options);
 
   /**
-   * Determine whether two lists returned by [encodeCrossContextOptions] are
-   * equal.
+   * Determine whether two signatures returned by [signature] are equal.
    */
-  static bool crossContextOptionsEqual(List<int> a, List<int> b) {
-    assert(a.length == crossContextOptionsLength);
-    assert(b.length == crossContextOptionsLength);
+  static bool signaturesEqual(Uint32List a, Uint32List b) {
+    assert(a.length == signatureLength);
+    assert(b.length == signatureLength);
     if (a.length != b.length) {
       return false;
     }
@@ -1303,13 +1371,6 @@
   @deprecated
   static const int DEFAULT_CACHE_SIZE = 64;
 
-  static const int ENABLE_ASSERT_FLAG = 0x01;
-  static const int ENABLE_LAZY_ASSIGNMENT_OPERATORS = 0x02;
-  static const int ENABLE_STRICT_CALL_CHECKS_FLAG = 0x04;
-  static const int ENABLE_STRONG_MODE_FLAG = 0x08;
-  static const int ENABLE_STRONG_MODE_HINTS_FLAG = 0x10;
-  static const int ENABLE_SUPER_MIXINS_FLAG = 0x20;
-
   /**
    * The default list of non-nullable type names.
    */
@@ -1322,6 +1383,11 @@
   AnalyzeFunctionBodiesPredicate _analyzeFunctionBodiesPredicate =
       _analyzeAllFunctionBodies;
 
+  /**
+   * The cached [signature].
+   */
+  Uint32List _signature;
+
   @override
   @deprecated
   int cacheSize = 64;
@@ -1333,9 +1399,6 @@
   bool enableAssertInitializer = false;
 
   @override
-  bool enableAssertMessage = false;
-
-  @override
   bool enableLazyAssignmentOperators = false;
 
   @override
@@ -1388,8 +1451,7 @@
    */
   List<Linter> _lintRules;
 
-  @override
-  int patchPlatform = 0;
+  Map<String, List<String>> patchPaths = {};
 
   @override
   bool preserveComments = true;
@@ -1454,7 +1516,6 @@
     analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate;
     dart2jsHint = options.dart2jsHint;
     enableAssertInitializer = options.enableAssertInitializer;
-    enableAssertMessage = options.enableAssertMessage;
     enableStrictCallChecks = options.enableStrictCallChecks;
     enableLazyAssignmentOperators = options.enableLazyAssignmentOperators;
     enableSuperMixins = options.enableSuperMixins;
@@ -1480,7 +1541,7 @@
     trackCacheDependencies = options.trackCacheDependencies;
     disableCacheFlushing = options.disableCacheFlushing;
     finerGrainedInvalidation = options.finerGrainedInvalidation;
-    patchPlatform = options.patchPlatform;
+    patchPaths = options.patchPaths;
   }
 
   bool get analyzeFunctionBodies {
@@ -1513,6 +1574,13 @@
     _analyzeFunctionBodiesPredicate = value;
   }
 
+  @override
+  @deprecated
+  bool get enableAssertMessage => true;
+
+  @deprecated
+  void set enableAssertMessage(bool enable) {}
+
   @deprecated
   @override
   bool get enableAsync => true;
@@ -1577,14 +1645,36 @@
   }
 
   @override
-  List<int> encodeCrossContextOptions() {
-    int flags = (enableAssertMessage ? ENABLE_ASSERT_FLAG : 0) |
-        (enableLazyAssignmentOperators ? ENABLE_LAZY_ASSIGNMENT_OPERATORS : 0) |
-        (enableStrictCallChecks ? ENABLE_STRICT_CALL_CHECKS_FLAG : 0) |
-        (enableSuperMixins ? ENABLE_SUPER_MIXINS_FLAG : 0) |
-        (strongMode ? ENABLE_STRONG_MODE_FLAG : 0) |
-        (strongModeHints ? ENABLE_STRONG_MODE_HINTS_FLAG : 0);
-    return <int>[flags, patchPlatform];
+  Uint32List get signature {
+    if (_signature == null) {
+      ApiSignature buffer = new ApiSignature();
+
+      // Append boolean flags.
+      buffer.addBool(enableLazyAssignmentOperators);
+      buffer.addBool(enableStrictCallChecks);
+      buffer.addBool(enableSuperMixins);
+      buffer.addBool(implicitCasts);
+      buffer.addBool(implicitDynamic);
+      buffer.addBool(strongMode);
+      buffer.addBool(strongModeHints);
+
+      // Append error processors.
+      buffer.addInt(errorProcessors.length);
+      for (ErrorProcessor processor in errorProcessors) {
+        buffer.addString(processor.description);
+      }
+
+      // Append lints.
+      buffer.addInt(lintRules.length);
+      for (Linter lintRule in lintRules) {
+        buffer.addString(lintRule.lintCode.uniqueName);
+      }
+
+      // Hash and convert to Uint32List.
+      List<int> bytes = buffer.toByteList();
+      _signature = new Uint8List.fromList(bytes).buffer.asUint32List();
+    }
+    return _signature;
   }
 
   @override
@@ -1592,7 +1682,6 @@
     dart2jsHint = false;
     disableCacheFlushing = false;
     enableAssertInitializer = false;
-    enableAssertMessage = false;
     enableLazyAssignmentOperators = false;
     enableStrictCallChecks = false;
     enableSuperMixins = false;
@@ -1612,7 +1701,7 @@
     lint = false;
     _lintRules = null;
     nonnullableTypes = NONNULLABLE_TYPES;
-    patchPlatform = 0;
+    patchPaths = {};
     preserveComments = true;
     strongMode = false;
     strongModeHints = false;
@@ -1621,7 +1710,6 @@
 
   @override
   void setCrossContextOptionsFrom(AnalysisOptions options) {
-    enableAssertMessage = options.enableAssertMessage;
     enableLazyAssignmentOperators = options.enableLazyAssignmentOperators;
     enableStrictCallChecks = options.enableStrictCallChecks;
     enableSuperMixins = options.enableSuperMixins;
@@ -1629,44 +1717,6 @@
     if (options is AnalysisOptionsImpl) {
       strongModeHints = options.strongModeHints;
     }
-    patchPlatform = options.patchPlatform;
-  }
-
-  /**
-   * Produce a human readable list of option names corresponding to the options
-   * encoded in the given [encoding], presumably from invoking the method
-   * [encodeCrossContextOptions].
-   */
-  static String decodeCrossContextOptions(List<int> encoding) {
-    List<String> parts = [];
-    int flags = encoding[0];
-    if (flags & ENABLE_ASSERT_FLAG > 0) {
-      parts.add('assert');
-    }
-    if (flags & ENABLE_LAZY_ASSIGNMENT_OPERATORS > 0) {
-      parts.add('lazyAssignmentOperators');
-    }
-    if (flags & ENABLE_STRICT_CALL_CHECKS_FLAG > 0) {
-      parts.add('strictCallChecks');
-    }
-    if (flags & ENABLE_SUPER_MIXINS_FLAG > 0) {
-      parts.add('superMixins');
-    }
-    if (flags & ENABLE_STRONG_MODE_FLAG > 0) {
-      parts.add('strongMode');
-    }
-    if (flags & ENABLE_STRONG_MODE_HINTS_FLAG > 0) {
-      parts.add('strongModeHints');
-    }
-    int patchPlatform = encoding[1];
-    if (patchPlatform != 0) {
-      parts.add('patchPlatform=$patchPlatform');
-    }
-    if (parts.isEmpty) {
-      return 'none';
-    } else {
-      return parts.join(', ');
-    }
   }
 
   /**
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 30a50cc..800b6e3 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -8,6 +8,7 @@
 import "dart:math" as math;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -32,7 +33,7 @@
 import 'package:analyzer/src/generated/utilities_dart.dart';
 import 'package:analyzer/src/task/dart.dart';
 import 'package:analyzer/src/task/strong/checker.dart' as checker
-    show isKnownFunction;
+    show hasStrictArrow;
 
 /**
  * A visitor used to traverse an AST structure looking for additional errors and
@@ -296,21 +297,10 @@
   final bool enableSuperMixins;
 
   /**
-   * If `true`, asserts are allowed to take a second argument representing the
-   * assertion failure message (see DEP 37).
-   */
-  final bool enableAssertMessage;
-
-  /**
    * Initialize a newly created error verifier.
    */
-  ErrorVerifier(
-      this._errorReporter,
-      this._currentLibrary,
-      this._typeProvider,
-      this._inheritanceManager,
-      this.enableSuperMixins,
-      this.enableAssertMessage) {
+  ErrorVerifier(this._errorReporter, this._currentLibrary, this._typeProvider,
+      this._inheritanceManager, this.enableSuperMixins) {
     this._isInSystemLibrary = _currentLibrary.source.isInSystemLibrary;
     this._hasExtUri = _currentLibrary.hasExtUri;
     _isEnclosingConstructorConst = false;
@@ -349,14 +339,12 @@
   @override
   Object visitAssertInitializer(AssertInitializer node) {
     _checkForNonBoolExpression(node);
-    _checkAssertMessage(node);
     return super.visitAssertInitializer(node);
   }
 
   @override
   Object visitAssertStatement(AssertStatement node) {
     _checkForNonBoolExpression(node);
-    _checkAssertMessage(node);
     return super.visitAssertStatement(node);
   }
 
@@ -504,6 +492,7 @@
       _checkForFinalNotInitializedInClass(node);
       _checkForDuplicateDefinitionInheritance();
       _checkForConflictingInstanceMethodSetter(node);
+      _checkForBadFunctionUse(node);
       return super.visitClassDeclaration(node);
     } finally {
       _isInNativeClass = false;
@@ -751,6 +740,7 @@
   @override
   Object visitFormalParameterList(FormalParameterList node) {
     _checkDuplicateDefinitionInParameterList(node);
+    _checkUseOfCovariantInParameters(node);
     return super.visitFormalParameterList(node);
   }
 
@@ -780,7 +770,7 @@
         methodName = identifier.name;
       }
       _enclosingFunction = functionElement;
-      TypeName returnType = node.returnType;
+      TypeAnnotation returnType = node.returnType;
       if (node.isSetter || node.isGetter) {
         _checkForMismatchedAccessorTypes(node, methodName);
         if (node.isSetter) {
@@ -798,7 +788,7 @@
       }
       _checkForTypeAnnotationDeferredClass(returnType);
       _checkForIllegalReturnType(returnType);
-      _checkForImplicitDynamicReturn(node, node.element);
+      _checkForImplicitDynamicReturn(node.name, node.element);
       return super.visitFunctionDeclaration(node);
     } finally {
       _enclosingFunction = outerFunction;
@@ -831,7 +821,7 @@
           StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION,
           functionExpression);
     } else if (expressionType is FunctionType) {
-      _checkTypeArguments(expressionType.element, node.typeArguments);
+      _checkTypeArguments(node);
     }
     _checkForImplicitDynamicInvoke(node);
     return super.visitFunctionExpressionInvocation(node);
@@ -857,11 +847,14 @@
       // we can get the function element via `node?.element?.type?.element` but
       // it doesn't have hasImplicitReturnType set correctly.
       if (!_options.implicitDynamic && node.returnType == null) {
-        DartType parameterType = node.element.type;
+        DartType parameterType =
+            resolutionMap.elementDeclaredByFormalParameter(node).type;
         if (parameterType is FunctionType &&
             parameterType.returnType.isDynamic) {
           _errorReporter.reportErrorForNode(
-              StrongModeCode.IMPLICIT_DYNAMIC_RETURN, node, [node.identifier]);
+              StrongModeCode.IMPLICIT_DYNAMIC_RETURN,
+              node.identifier,
+              [node.identifier]);
         }
       }
       return super.visitFunctionTypedFormalParameter(node);
@@ -871,6 +864,20 @@
   }
 
   @override
+  Object visitGenericFunctionType(GenericFunctionType node) {
+    throw new StateError(
+        'Support for generic function types is not yet implemented');
+//    return super.visitGenericFunctionType(node);
+  }
+
+  @override
+  Object visitGenericTypeAlias(GenericTypeAlias node) {
+    throw new StateError(
+        'Support for generic type aliases is not yet implemented');
+//    return super.visitGenericTypeAlias(node);
+  }
+
+  @override
   Object visitIfStatement(IfStatement node) {
     _checkForNonBoolCondition(node.condition);
     return super.visitIfStatement(node);
@@ -940,7 +947,7 @@
     TypeArgumentList typeArguments = node.typeArguments;
     if (typeArguments != null) {
       if (!_options.strongMode && node.constKeyword != null) {
-        NodeList<TypeName> arguments = typeArguments.arguments;
+        NodeList<TypeAnnotation> arguments = typeArguments.arguments;
         if (arguments.isNotEmpty) {
           _checkForInvalidTypeArgumentInConstTypedLiteral(arguments,
               CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST);
@@ -957,7 +964,7 @@
   Object visitMapLiteral(MapLiteral node) {
     TypeArgumentList typeArguments = node.typeArguments;
     if (typeArguments != null) {
-      NodeList<TypeName> arguments = typeArguments.arguments;
+      NodeList<TypeAnnotation> arguments = typeArguments.arguments;
       if (!_options.strongMode && arguments.isNotEmpty) {
         if (node.constKeyword != null) {
           _checkForInvalidTypeArgumentInConstTypedLiteral(arguments,
@@ -983,7 +990,7 @@
       if (identifier != null) {
         methodName = identifier.name;
       }
-      TypeName returnTypeName = node.returnType;
+      TypeAnnotation returnType = node.returnType;
       if (node.isSetter || node.isGetter) {
         _checkForMismatchedAccessorTypes(node, methodName);
       }
@@ -994,7 +1001,7 @@
         _checkForInvalidModifierOnBody(
             node.body, CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER);
         _checkForWrongNumberOfParametersForSetter(node.name, node.parameters);
-        _checkForNonVoidReturnTypeForSetter(returnTypeName);
+        _checkForNonVoidReturnTypeForSetter(returnType);
         _checkForConflictingStaticSetterAndInstanceMember(node);
       } else if (node.isOperator) {
         _checkForOptionalParameterInOperator(node);
@@ -1003,8 +1010,8 @@
       }
       _checkForConcreteClassWithAbstractMember(node);
       _checkForAllInvalidOverrideErrorCodesForMethod(node);
-      _checkForTypeAnnotationDeferredClass(returnTypeName);
-      _checkForIllegalReturnType(returnTypeName);
+      _checkForTypeAnnotationDeferredClass(returnType);
+      _checkForIllegalReturnType(returnType);
       _checkForImplicitDynamicReturn(node, node.element);
       _checkForMustCallSuper(node);
       return super.visitMethodDeclaration(node);
@@ -1025,8 +1032,7 @@
     } else {
       _checkForUnqualifiedReferenceToNonLocalStaticMember(methodName);
     }
-    _checkTypeArguments(
-        node.methodName.staticElement, node.typeArguments, target?.staticType);
+    _checkTypeArguments(node);
     _checkForImplicitDynamicInvoke(node);
     return super.visitMethodInvocation(node);
   }
@@ -1196,9 +1202,9 @@
 
   @override
   Object visitTypeArgumentList(TypeArgumentList node) {
-    NodeList<TypeName> list = node.arguments;
-    for (TypeName typeName in list) {
-      _checkForTypeAnnotationDeferredClass(typeName);
+    NodeList<TypeAnnotation> list = node.arguments;
+    for (TypeAnnotation type in list) {
+      _checkForTypeAnnotationDeferredClass(type);
     }
     return super.visitTypeArgumentList(node);
   }
@@ -1217,6 +1223,7 @@
     _checkForTypeParameterSupertypeOfItsBound(node);
     _checkForTypeAnnotationDeferredClass(node.bound);
     _checkForImplicitDynamicType(node.bound);
+    _checkForNotInstantiatedBound(node.bound);
     return super.visitTypeParameter(node);
   }
 
@@ -1302,18 +1309,6 @@
   }
 
   /**
-   * If the given [assertion] specifies a message, verify that support
-   * for assertions with messages is enabled.
-   */
-  void _checkAssertMessage(Assertion assertion) {
-    Expression expression = assertion.message;
-    if (expression != null && !enableAssertMessage) {
-      _errorReporter.reportErrorForNode(
-          CompileTimeErrorCode.EXTRA_ARGUMENT_TO_ASSERT, expression);
-    }
-  }
-
-  /**
    * Given a list of [directives] that have the same prefix, generate an error
    * if there is more than one import and any of those imports is deferred.
    *
@@ -1680,28 +1675,24 @@
     });
 
     if (notInitFinalFields.isNotEmpty) {
-      AnalysisErrorWithProperties analysisError;
       List<String> names = notInitFinalFields.map((item) => item.name).toList();
       names.sort();
       if (names.length == 1) {
-        analysisError = _errorReporter.newErrorWithProperties(
+        _errorReporter.reportErrorForNode(
             StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1,
             constructor.returnType,
             names);
       } else if (names.length == 2) {
-        analysisError = _errorReporter.newErrorWithProperties(
+        _errorReporter.reportErrorForNode(
             StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_2,
             constructor.returnType,
             names);
       } else {
-        analysisError = _errorReporter.newErrorWithProperties(
+        _errorReporter.reportErrorForNode(
             StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS,
             constructor.returnType,
             [names[0], names[1], names.length - 2]);
       }
-      analysisError.setProperty(
-          ErrorProperty.NOT_INITIALIZED_FIELDS, notInitFinalFields);
-      _errorReporter.reportError(analysisError);
     }
   }
 
@@ -2238,7 +2229,8 @@
     DartType redirectedReturnType = redirectedType.returnType;
 
     // Report specific problem when return type is incompatible
-    FunctionType constructorType = declaration.element.type;
+    FunctionType constructorType =
+        resolutionMap.elementDeclaredByConstructorDeclaration(declaration).type;
     DartType constructorReturnType = constructorType.returnType;
     if (!_typeSystem.isAssignableTo(
         redirectedReturnType, constructorReturnType)) {
@@ -2291,9 +2283,24 @@
     }
     // RETURN_WITHOUT_VALUE
     if (returnExpression == null) {
-      if (_inGenerator ||
-          _typeSystem.isAssignableTo(
-              _computeReturnTypeForMethod(null), expectedReturnType)) {
+      if (_inGenerator) {
+        return;
+      } else if (_inAsync) {
+        if (expectedReturnType.isDynamic) {
+          return;
+        }
+        if (expectedReturnType is InterfaceType &&
+            expectedReturnType.isDartAsyncFuture) {
+          DartType futureArgument = expectedReturnType.typeArguments[0];
+          if (futureArgument.isDynamic ||
+              futureArgument.isDartCoreNull ||
+              futureArgument.isObject) {
+            return;
+          }
+        }
+      } else if (expectedReturnType.isDynamic ||
+          expectedReturnType.isVoid ||
+          expectedReturnType.isDartCoreNull) {
         return;
       }
       _hasReturnWithoutValue = true;
@@ -2500,7 +2507,6 @@
       DartType actualStaticType,
       DartType expectedStaticType,
       ErrorCode errorCode) {
-    // TODO(leafp): Move the Downcast functionality here.
     if (!_expressionIsAssignableAtType(
         expression, actualStaticType, expectedStaticType)) {
       _errorReporter.reportTypeErrorForNode(
@@ -2716,8 +2722,8 @@
     if (constructorName != null &&
         constructorElement != null &&
         !constructorName.isSynthetic) {
-      if (classElement.getField(name) != null) {
-        // fields
+      FieldElement field = classElement.getField(name);
+      if (field != null && field.getter != null) {
         _errorReporter.reportErrorForNode(
             CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD,
             constructor,
@@ -2892,8 +2898,9 @@
           Element enclosingElementOfSetter = null;
           ClassMember conflictingSetter = memberHashMap[setterName];
           if (conflictingSetter != null) {
-            enclosingElementOfSetter =
-                conflictingSetter.element.enclosingElement;
+            enclosingElementOfSetter = resolutionMap
+                .elementDeclaredByDeclaration(conflictingSetter)
+                .enclosingElement;
           } else {
             ExecutableElement elementFromInheritance = _inheritanceManager
                 .lookupInheritance(_enclosingClass, setterName);
@@ -2937,6 +2944,40 @@
   }
 
   /**
+   * Verifies that the class is not named `Function` and that it doesn't
+   * extends/implements/mixes in `Function`.
+   */
+  void _checkForBadFunctionUse(ClassDeclaration node) {
+    ExtendsClause extendsClause = node.extendsClause;
+    ImplementsClause implementsClause = node.implementsClause;
+    WithClause withClause = node.withClause;
+
+    if (node.name.name == "Function") {
+      _errorReporter.reportErrorForNode(
+          HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION, node.name);
+    }
+
+    if (extendsClause != null) {
+      InterfaceType superclassType = _enclosingClass.supertype;
+      ClassElement superclassElement = superclassType?.element;
+      if (superclassElement != null && superclassElement.name == "Function") {
+        _errorReporter.reportErrorForNode(
+            HintCode.DEPRECATED_EXTENDS_FUNCTION, extendsClause.superclass);
+      }
+    }
+
+    if (withClause != null) {
+      for (TypeName type in withClause.mixinTypes) {
+        Element mixinElement = type.name.staticElement;
+        if (mixinElement != null && mixinElement.name == "Function") {
+          _errorReporter.reportErrorForNode(
+              HintCode.DEPRECATED_MIXIN_FUNCTION, type);
+        }
+      }
+    }
+  }
+
+  /**
    * Verify that the enclosing class does not have an instance member with the
    * same name as the given static [method] declaration.
    *
@@ -3243,15 +3284,16 @@
   }
 
   /**
-   * Verify that the given [typeName] does not reference any type parameters.
+   * Verify that the given [type] does not reference any type parameters.
    *
    * See [CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS].
    */
-  void _checkForConstWithTypeParameters(TypeName typeName) {
+  void _checkForConstWithTypeParameters(TypeAnnotation type) {
     // something wrong with AST
-    if (typeName == null) {
+    if (type is! TypeName) {
       return;
     }
+    TypeName typeName = type;
     Identifier name = typeName.name;
     if (name == null) {
       return;
@@ -3264,7 +3306,7 @@
     // check type arguments
     TypeArgumentList typeArguments = typeName.typeArguments;
     if (typeArguments != null) {
-      for (TypeName argument in typeArguments.arguments) {
+      for (TypeAnnotation argument in typeArguments.arguments) {
         _checkForConstWithTypeParameters(argument);
       }
     }
@@ -3829,7 +3871,7 @@
    * declared return type is assignable to Future, Stream, or Iterable,
    * respectively.  If not, report the error using [returnType].
    */
-  void _checkForIllegalReturnType(TypeName returnType) {
+  void _checkForIllegalReturnType(TypeAnnotation returnType) {
     if (returnType == null) {
       // No declared return type, so the return type must be dynamic, which is
       // assignable to everything.
@@ -3862,7 +3904,7 @@
    * the declared [returnTypeName] is assignable to the required [expectedType]
    * and if not report [errorCode].
    */
-  void _checkForIllegalReturnTypeCode(TypeName returnTypeName,
+  void _checkForIllegalReturnTypeCode(TypeAnnotation returnTypeName,
       DartType expectedType, StaticTypeWarningCode errorCode) {
     DartType returnType = _enclosingFunction.returnType;
     if (_options.strongMode) {
@@ -3993,7 +4035,8 @@
     }
   }
 
-  void _checkForImplicitDynamicReturn(AstNode node, ExecutableElement element) {
+  void _checkForImplicitDynamicReturn(
+      AstNode functionName, ExecutableElement element) {
     if (_options.implicitDynamic) {
       return;
     }
@@ -4003,15 +4046,15 @@
     if (element != null &&
         element.hasImplicitReturnType &&
         element.returnType.isDynamic) {
-      _errorReporter.reportErrorForNode(
-          StrongModeCode.IMPLICIT_DYNAMIC_RETURN, node, [element.displayName]);
+      _errorReporter.reportErrorForNode(StrongModeCode.IMPLICIT_DYNAMIC_RETURN,
+          functionName, [element.displayName]);
     }
   }
 
-  void _checkForImplicitDynamicType(TypeName node) {
+  void _checkForImplicitDynamicType(TypeAnnotation node) {
     if (_options.implicitDynamic ||
         node == null ||
-        node.typeArguments != null) {
+        (node is TypeName && node.typeArguments != null)) {
       return;
     }
     DartType type = node.type;
@@ -4479,10 +4522,10 @@
    * [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP].
    */
   void _checkForInvalidTypeArgumentInConstTypedLiteral(
-      NodeList<TypeName> arguments, ErrorCode errorCode) {
-    for (TypeName typeName in arguments) {
-      if (typeName.type is TypeParameterType) {
-        _errorReporter.reportErrorForNode(errorCode, typeName, [typeName.name]);
+      NodeList<TypeAnnotation> arguments, ErrorCode errorCode) {
+    for (TypeAnnotation type in arguments) {
+      if (type is TypeName && type.type is TypeParameterType) {
+        _errorReporter.reportErrorForNode(errorCode, type, [type.name]);
       }
     }
   }
@@ -4733,7 +4776,7 @@
   }
 
   void _checkForMissingJSLibAnnotation(Annotation node) {
-    if (node.elementAnnotation?.isJS ?? false) {
+    if (resolutionMap.elementAnnotationForAnnotation(node)?.isJS ?? false) {
       if (_currentLibrary.isJS != true) {
         _errorReporter.reportErrorForNode(
             HintCode.MISSING_JS_LIB_ANNOTATION, node);
@@ -4989,104 +5032,19 @@
     } else if (_enclosingClass.hasNoSuchMethod) {
       return;
     }
-    //
-    // Store in local sets the set of all method and accessor names
-    //
-    HashSet<ExecutableElement> missingOverrides =
-        new HashSet<ExecutableElement>();
-    //
-    // Loop through the set of all executable elements declared in the implicit
-    // interface.
-    //
-    Map<String, ExecutableElement> membersInheritedFromInterfaces =
-        _inheritanceManager.getMembersInheritedFromInterfaces(_enclosingClass);
-    Map<String, ExecutableElement> membersInheritedFromSuperclasses =
-        _inheritanceManager.getMembersInheritedFromClasses(_enclosingClass);
-    for (String memberName in membersInheritedFromInterfaces.keys) {
-      ExecutableElement executableElt =
-          membersInheritedFromInterfaces[memberName];
-      if (memberName == null) {
-        break;
-      }
-      // If the element is not synthetic and can be determined to be defined in
-      // Object, skip it.
-      if (executableElt.enclosingElement != null &&
-          (executableElt.enclosingElement as ClassElement).type.isObject) {
-        continue;
-      }
-      // Check to see if some element is in local enclosing class that matches
-      // the name of the required member.
-      if (_isMemberInClassOrMixin(executableElt, _enclosingClass)) {
-        // We do not have to verify that this implementation of the found method
-        // matches the required function type: the set of
-        // StaticWarningCode.INVALID_METHOD_OVERRIDE_* warnings break out the
-        // different specific situations.
-        continue;
-      }
-      // First check to see if this element was declared in the superclass
-      // chain, in which case there is already a concrete implementation.
-      ExecutableElement elt = membersInheritedFromSuperclasses[memberName];
-      // Check to see if an element was found in the superclass chain with the
-      // correct name.
-      if (elt != null) {
-        // Reference the types, if any are null then continue.
-        InterfaceType enclosingType = _enclosingClass.type;
-        FunctionType concreteType = elt.type;
-        FunctionType requiredMemberType = executableElt.type;
-        if (enclosingType == null ||
-            concreteType == null ||
-            requiredMemberType == null) {
-          continue;
-        }
-        // Some element was found in the superclass chain that matches the name
-        // of the required member.
-        // If it is not abstract and it is the correct one (types match- the
-        // version of this method that we have has the correct number of
-        // parameters, etc), then this class has a valid implementation of this
-        // method, so skip it.
-        if ((elt is MethodElement && !elt.isAbstract) ||
-            (elt is PropertyAccessorElement && !elt.isAbstract)) {
-          // Since we are comparing two function types, we need to do the
-          // appropriate type substitutions first ().
-          FunctionType foundConcreteFT = _inheritanceManager
-              .substituteTypeArgumentsInMemberFromInheritance(
-                  concreteType, memberName, enclosingType);
-          FunctionType requiredMemberFT = _inheritanceManager
-              .substituteTypeArgumentsInMemberFromInheritance(
-                  requiredMemberType, memberName, enclosingType);
-          foundConcreteFT = _typeSystem.functionTypeToConcreteType(
-              _typeProvider, foundConcreteFT);
-          requiredMemberFT = _typeSystem.functionTypeToConcreteType(
-              _typeProvider, requiredMemberFT);
 
-          // Strong mode does override checking for types in CodeChecker, so
-          // we can skip it here. Doing it here leads to unnecessary duplicate
-          // error messages in subclasses that inherit from one that has an
-          // override error.
-          //
-          // See: https://github.com/dart-lang/sdk/issues/25232
-          if (_options.strongMode ||
-              _typeSystem.isSubtypeOf(foundConcreteFT, requiredMemberFT)) {
-            continue;
-          }
-        }
-      }
-      // The not qualifying concrete executable element was found, add it to the
-      // list.
-      missingOverrides.add(executableElt);
-    }
-    // Now that we have the set of missing overrides, generate a warning on this
-    // class.
-    int missingOverridesSize = missingOverrides.length;
-    if (missingOverridesSize == 0) {
+    Set<ExecutableElement> missingOverrides = computeMissingOverrides(
+        _options.strongMode,
+        _typeProvider,
+        _typeSystem,
+        _inheritanceManager,
+        _enclosingClass);
+    if (missingOverrides.isEmpty) {
       return;
     }
-    List<ExecutableElement> missingOverridesArray =
-        new List.from(missingOverrides);
-    List<String> stringMembersArrayListSet = new List<String>();
-    for (int i = 0; i < missingOverridesArray.length; i++) {
-      String newStrMember;
-      ExecutableElement element = missingOverridesArray[i];
+
+    List<String> missingOverrideNames = <String>[];
+    for (ExecutableElement element in missingOverrides) {
       Element enclosingElement = element.enclosingElement;
       String prefix = StringUtilities.EMPTY;
       if (element is PropertyAccessorElement) {
@@ -5098,60 +5056,57 @@
           // "setter "
         }
       }
+      String newStrMember;
       if (enclosingElement != null) {
         newStrMember =
             "$prefix'${enclosingElement.displayName}.${element.displayName}'";
       } else {
         newStrMember = "$prefix'${element.displayName}'";
       }
-      stringMembersArrayListSet.add(newStrMember);
+      missingOverrideNames.add(newStrMember);
     }
-    List<String> stringMembersArray = new List.from(stringMembersArrayListSet);
-    stringMembersArray.sort();
-    AnalysisErrorWithProperties analysisError;
-    if (stringMembersArray.length == 1) {
-      analysisError = _errorReporter.newErrorWithProperties(
+    missingOverrideNames.sort();
+
+    if (missingOverrideNames.length == 1) {
+      _errorReporter.reportErrorForNode(
           StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE,
           classNameNode,
-          [stringMembersArray[0]]);
-    } else if (stringMembersArray.length == 2) {
-      analysisError = _errorReporter.newErrorWithProperties(
+          [missingOverrideNames[0]]);
+    } else if (missingOverrideNames.length == 2) {
+      _errorReporter.reportErrorForNode(
           StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO,
           classNameNode,
-          [stringMembersArray[0], stringMembersArray[1]]);
-    } else if (stringMembersArray.length == 3) {
-      analysisError = _errorReporter.newErrorWithProperties(
+          [missingOverrideNames[0], missingOverrideNames[1]]);
+    } else if (missingOverrideNames.length == 3) {
+      _errorReporter.reportErrorForNode(
           StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE,
           classNameNode, [
-        stringMembersArray[0],
-        stringMembersArray[1],
-        stringMembersArray[2]
+        missingOverrideNames[0],
+        missingOverrideNames[1],
+        missingOverrideNames[2]
       ]);
-    } else if (stringMembersArray.length == 4) {
-      analysisError = _errorReporter.newErrorWithProperties(
+    } else if (missingOverrideNames.length == 4) {
+      _errorReporter.reportErrorForNode(
           StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR,
           classNameNode, [
-        stringMembersArray[0],
-        stringMembersArray[1],
-        stringMembersArray[2],
-        stringMembersArray[3]
+        missingOverrideNames[0],
+        missingOverrideNames[1],
+        missingOverrideNames[2],
+        missingOverrideNames[3]
       ]);
     } else {
-      analysisError = _errorReporter.newErrorWithProperties(
+      _errorReporter.reportErrorForNode(
           StaticWarningCode
               .NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS,
           classNameNode,
           [
-            stringMembersArray[0],
-            stringMembersArray[1],
-            stringMembersArray[2],
-            stringMembersArray[3],
-            stringMembersArray.length - 4
+            missingOverrideNames[0],
+            missingOverrideNames[1],
+            missingOverrideNames[2],
+            missingOverrideNames[3],
+            missingOverrideNames.length - 4
           ]);
     }
-    analysisError.setProperty(
-        ErrorProperty.UNIMPLEMENTED_METHODS, missingOverridesArray);
-    _errorReporter.reportError(analysisError);
   }
 
   /**
@@ -5251,12 +5206,12 @@
       return;
     }
     // check return type
-    TypeName typeName = declaration.returnType;
-    if (typeName != null) {
-      DartType type = typeName.type;
+    TypeAnnotation annotation = declaration.returnType;
+    if (annotation != null) {
+      DartType type = annotation.type;
       if (type != null && !type.isVoid) {
         _errorReporter.reportErrorForNode(
-            StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR, typeName);
+            StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR, annotation);
       }
     }
   }
@@ -5267,7 +5222,7 @@
    *
    * See [StaticWarningCode.NON_VOID_RETURN_FOR_SETTER].
    */
-  void _checkForNonVoidReturnTypeForSetter(TypeName typeName) {
+  void _checkForNonVoidReturnTypeForSetter(TypeAnnotation typeName) {
     if (typeName != null) {
       DartType type = typeName.type;
       if (type != null && !type.isVoid) {
@@ -5277,6 +5232,30 @@
     }
   }
 
+  void _checkForNotInstantiatedBound(TypeAnnotation node) {
+    if (!_options.strongMode || node == null) {
+      return;
+    }
+
+    if (node is TypeName) {
+      if (node.typeArguments == null) {
+        DartType type = node.type;
+        if (type is ParameterizedType) {
+          Element element = type.element;
+          if (element is TypeParameterizedElement &&
+              element.typeParameters.any((p) => p.bound != null)) {
+            _errorReporter.reportErrorForNode(
+                StrongModeCode.NOT_INSTANTIATED_BOUND, node, [type]);
+          }
+        }
+      } else {
+        node.typeArguments.arguments.forEach(_checkForNotInstantiatedBound);
+      }
+    } else {
+      throw new UnimplementedError('${node.runtimeType}');
+    }
+  }
+
   /**
    * Verify the given operator-method [declaration], does not have an optional
    * parameter. This method assumes that the method declaration was tested to be
@@ -5571,7 +5550,8 @@
     if (expectedReturnType.isVoid) {
       if (staticReturnType.isVoid ||
           staticReturnType.isDynamic ||
-          staticReturnType.isBottom) {
+          staticReturnType.isBottom ||
+          staticReturnType.isDartCoreNull) {
         return;
       }
       _errorReporter.reportTypeErrorForNode(
@@ -5689,10 +5669,10 @@
    *
    * See [StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS].
    */
-  void _checkForTypeAnnotationDeferredClass(TypeName name) {
-    if (name != null && name.isDeferred) {
+  void _checkForTypeAnnotationDeferredClass(TypeAnnotation type) {
+    if (type is TypeName && type.isDeferred) {
       _errorReporter.reportErrorForNode(
-          StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS, name, [name.name]);
+          StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS, type, [type.name]);
     }
   }
 
@@ -5702,19 +5682,18 @@
    *
    * See [StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER].
    */
-  void _checkForTypeAnnotationGenericFunctionParameter(TypeName typeName) {
-    if (typeName == null) {
-      return;
-    }
-    Identifier name = typeName.name;
-    if (name is SimpleIdentifier) {
-      Element element = name.staticElement;
-      if (element is TypeParameterElement &&
-          element.enclosingElement is ExecutableElement) {
-        _errorReporter.reportErrorForNode(
-            StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER,
-            name,
-            [name.name]);
+  void _checkForTypeAnnotationGenericFunctionParameter(TypeAnnotation type) {
+    if (type is TypeName) {
+      Identifier name = type.name;
+      if (name is SimpleIdentifier) {
+        Element element = name.staticElement;
+        if (element is TypeParameterElement &&
+            element.enclosingElement is ExecutableElement) {
+          _errorReporter.reportErrorForNode(
+              StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER,
+              name,
+              [name.name]);
+        }
       }
     }
   }
@@ -5741,14 +5720,14 @@
       List<DartType> parameterTypes = element.type.typeArguments;
       List<DartType> arguments = (type as ParameterizedType).typeArguments;
       // iterate over each bounded type parameter and corresponding argument
-      NodeList<TypeName> typeNameArgList = typeName.typeArguments.arguments;
+      NodeList<TypeAnnotation> argumentNodes = typeName.typeArguments.arguments;
       int loopThroughIndex =
-          math.min(typeNameArgList.length, parameterElements.length);
+          math.min(argumentNodes.length, parameterElements.length);
       bool shouldSubstitute =
           arguments.length != 0 && arguments.length == parameterTypes.length;
       for (int i = 0; i < loopThroughIndex; i++) {
-        TypeName argTypeName = typeNameArgList[i];
-        DartType argType = argTypeName.type;
+        TypeAnnotation argumentNode = argumentNodes[i];
+        DartType argType = argumentNode.type;
         DartType boundType = parameterElements[i].bound;
         if (argType != null && boundType != null) {
           if (shouldSubstitute) {
@@ -5764,7 +5743,7 @@
                   StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS;
             }
             _errorReporter.reportTypeErrorForNode(
-                errorCode, argTypeName, [argType, boundType]);
+                errorCode, argumentNode, [argType, boundType]);
           }
         }
       }
@@ -5974,12 +5953,11 @@
    * See [StaticWarningCode.VOID_RETURN_FOR_GETTER].
    */
   void _checkForVoidReturnType(MethodDeclaration getter) {
-    TypeName returnType = getter.returnType;
-    if (returnType == null || returnType.name.name != "void") {
-      return;
+    TypeAnnotation returnType = getter.returnType;
+    if (returnType is TypeName && returnType.name.name == "void") {
+      _errorReporter.reportErrorForNode(
+          StaticWarningCode.VOID_RETURN_FOR_GETTER, returnType);
     }
-    _errorReporter.reportErrorForNode(
-        StaticWarningCode.VOID_RETURN_FOR_GETTER, returnType);
   }
 
   /**
@@ -6182,73 +6160,56 @@
    *
    * See [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS].
    */
-  void _checkTypeArguments(Element element, TypeArgumentList typeArguments,
-      [DartType targetType]) {
-    if (element == null || typeArguments == null) {
+  void _checkTypeArguments(InvocationExpression node) {
+    NodeList<TypeAnnotation> typeArgumentList = node.typeArguments?.arguments;
+    if (typeArgumentList == null) {
       return;
     }
-    void reportError(
-        TypeName argument, DartType argumentType, DartType parameterType) {
-      _errorReporter.reportTypeErrorForNode(
-          StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
-          argument,
-          [argumentType, parameterType]);
-    }
 
-    if (element is FunctionTypedElement) {
-      _checkTypeArgumentsAgainstBounds(
-          element.typeParameters, typeArguments, targetType, reportError);
-    } else if (element is ClassElement) {
-      _checkTypeArgumentsAgainstBounds(
-          element.typeParameters, typeArguments, targetType, reportError);
-    } else if (element is ParameterElement || element is LocalVariableElement) {
-      // TODO(brianwilkerson) Implement this case
-    } else {
-      print('Unhandled element type: ${element.runtimeType}');
+    var genericType = node.function.staticType;
+    var instantiatedType = node.staticInvokeType;
+    if (genericType is FunctionType && instantiatedType is FunctionType) {
+      var fnTypeParams =
+          TypeParameterTypeImpl.getTypes(genericType.typeFormals);
+      var typeArgs = typeArgumentList.map((t) => t.type).toList();
+
+      for (int i = 0, len = math.min(typeArgs.length, fnTypeParams.length);
+          i < len;
+          i++) {
+        // Check the `extends` clause for the type parameter, if any.
+        //
+        // Also substitute to handle cases like this:
+        //
+        //     <TFrom, TTo extends TFrom>
+        //     <TFrom, TTo extends Iterable<TFrom>>
+        //     <T extends Clonable<T>>
+        //
+        DartType argType = typeArgs[i];
+        DartType bound =
+            fnTypeParams[i].bound.substitute2(typeArgs, fnTypeParams);
+        if (!_typeSystem.isSubtypeOf(argType, bound)) {
+          _errorReporter.reportTypeErrorForNode(
+              StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
+              typeArgumentList[i],
+              [argType, bound]);
+        }
+      }
     }
   }
 
-  void _checkTypeArgumentsAgainstBounds(
-      List<TypeParameterElement> typeParameters,
-      TypeArgumentList typeArgumentList,
-      DartType targetType,
-      void reportError(
-          TypeName argument, DartType argumentType, DartType parameterType)) {
-    NodeList<TypeName> typeArguments = typeArgumentList.arguments;
-    int argumentsLength = typeArguments.length;
-    int maxIndex = math.min(typeParameters.length, argumentsLength);
-
-    bool shouldSubstitute =
-        argumentsLength != 0 && argumentsLength == typeParameters.length;
-    List<DartType> argumentTypes = shouldSubstitute
-        ? typeArguments.map((TypeName typeName) => typeName.type).toList()
-        : null;
-    List<DartType> parameterTypes = shouldSubstitute
-        ? typeParameters
-            .map((TypeParameterElement element) => element.type)
-            .toList()
-        : null;
-    List<DartType> targetTypeParameterTypes = null;
-    for (int i = 0; i < maxIndex; i++) {
-      TypeName argTypeName = typeArguments[i];
-      DartType argType = argTypeName.type;
-      DartType boundType = typeParameters[i].bound;
-      if (argType != null && boundType != null) {
-        if (targetType is ParameterizedType) {
-          if (targetTypeParameterTypes == null) {
-            targetTypeParameterTypes = targetType.typeParameters
-                .map((TypeParameterElement element) => element.type)
-                .toList();
-          }
-          boundType = boundType.substitute2(
-              targetType.typeArguments, targetTypeParameterTypes);
-        }
-        if (shouldSubstitute) {
-          boundType = boundType.substitute2(argumentTypes, parameterTypes);
-        }
-        if (!_typeSystem.isSubtypeOf(argType, boundType)) {
-          reportError(argTypeName, argType, boundType);
-        }
+  void _checkUseOfCovariantInParameters(FormalParameterList node) {
+    AstNode parent = node.parent;
+    if (parent is MethodDeclaration && !parent.isStatic) {
+      return;
+    }
+    NodeList<FormalParameter> parameters = node.parameters;
+    int length = parameters.length;
+    for (int i = 0; i < length; i++) {
+      FormalParameter parameter = parameters[i];
+      Token keyword = parameter.covariantKeyword;
+      if (keyword != null) {
+        _errorReporter.reportErrorForToken(
+            CompileTimeErrorCode.INVALID_USE_OF_COVARIANT, keyword);
       }
     }
   }
@@ -6274,11 +6235,10 @@
 
   bool _expressionIsAssignableAtType(Expression expression,
       DartType actualStaticType, DartType expectedStaticType) {
-    bool concrete = _options.strongMode && checker.isKnownFunction(expression);
+    bool concrete = _options.strongMode && checker.hasStrictArrow(expression);
     if (concrete && actualStaticType is FunctionType) {
-      actualStaticType = _typeSystem.functionTypeToConcreteType(
-          _typeProvider, actualStaticType);
-      // TODO(leafp): Move the Downcast functionality here.
+      actualStaticType =
+          _typeSystem.functionTypeToConcreteType(actualStaticType);
     }
     return _typeSystem.isAssignableTo(actualStaticType, expectedStaticType);
   }
@@ -6524,7 +6484,7 @@
   }
 
   bool _isFunctionType(DartType type) {
-    if (type.isDynamic || type.isBottom) {
+    if (type.isDynamic || type.isDartCoreNull) {
       return true;
     } else if (type is FunctionType || type.isDartCoreFunction) {
       return true;
@@ -6537,57 +6497,6 @@
   }
 
   /**
-   * Return `true` iff the given [classElement] has a concrete method, getter or
-   * setter that matches the name of the given [executableElement] in either the
-   * class itself, or one of its' mixins.
-   *
-   * By "match", only the name of the member is tested to match, it does not
-   * have to equal or be a subtype of the given executable element, this is due
-   * to the specific use where this method is used in
-   * [_checkForNonAbstractClassInheritsAbstractMember].
-   */
-  bool _isMemberInClassOrMixin(
-      ExecutableElement executableElement, ClassElement classElement) {
-    ExecutableElement foundElt = null;
-    String executableName = executableElement.name;
-    if (executableElement is MethodElement) {
-      foundElt = classElement.getMethod(executableName);
-      if (foundElt != null && !foundElt.isAbstract) {
-        return true;
-      }
-      List<InterfaceType> mixins = classElement.mixins;
-      for (int i = 0; i < mixins.length && foundElt == null; i++) {
-        foundElt = mixins[i].getMethod(executableName);
-      }
-      if (foundElt != null && !foundElt.isAbstract) {
-        return true;
-      }
-    } else if (executableElement is PropertyAccessorElement) {
-      if (executableElement.isGetter) {
-        foundElt = classElement.getGetter(executableName);
-      }
-      if (foundElt == null && executableElement.isSetter) {
-        foundElt = classElement.getSetter(executableName);
-      }
-      if (foundElt != null &&
-          !(foundElt as PropertyAccessorElement).isAbstract) {
-        return true;
-      }
-      List<InterfaceType> mixins = classElement.mixins;
-      for (int i = 0; i < mixins.length && foundElt == null; i++) {
-        foundElt = mixins[i].getGetter(executableName);
-        if (foundElt == null) {
-          foundElt = mixins[i].getSetter(executableName);
-        }
-      }
-      if (foundElt != null && !foundElt.isAbstract) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
    * Return `true` if the given 'this' [expression] is in a valid context.
    */
   bool _isThisInValidContext(ThisExpression expression) {
@@ -6712,6 +6621,145 @@
   }
 
   /**
+   * Returns [ExecutableElement]s that are declared in interfaces implemented
+   * by the [classElement], but not implemented by the [classElement] or its
+   * superclasses.
+   */
+  static Set<ExecutableElement> computeMissingOverrides(
+      bool strongMode,
+      TypeProvider typeProvider,
+      TypeSystem typeSystem,
+      InheritanceManager inheritanceManager,
+      ClassElement classElement) {
+    //
+    // Store in local sets the set of all method and accessor names
+    //
+    HashSet<ExecutableElement> missingOverrides =
+        new HashSet<ExecutableElement>();
+    //
+    // Loop through the set of all executable elements declared in the implicit
+    // interface.
+    //
+    Map<String, ExecutableElement> membersInheritedFromInterfaces =
+        inheritanceManager.getMembersInheritedFromInterfaces(classElement);
+    Map<String, ExecutableElement> membersInheritedFromSuperclasses =
+        inheritanceManager.getMembersInheritedFromClasses(classElement);
+    for (String memberName in membersInheritedFromInterfaces.keys) {
+      ExecutableElement executableElt =
+          membersInheritedFromInterfaces[memberName];
+      if (memberName == null) {
+        break;
+      }
+      // If the element is not synthetic and can be determined to be defined in
+      // Object, skip it.
+      if (executableElt.enclosingElement != null &&
+          (executableElt.enclosingElement as ClassElement).type.isObject) {
+        continue;
+      }
+      // Check to see if some element is in local enclosing class that matches
+      // the name of the required member.
+      if (_isMemberInClassOrMixin(executableElt, classElement)) {
+        // We do not have to verify that this implementation of the found method
+        // matches the required function type: the set of
+        // StaticWarningCode.INVALID_METHOD_OVERRIDE_* warnings break out the
+        // different specific situations.
+        continue;
+      }
+      // First check to see if this element was declared in the superclass
+      // chain, in which case there is already a concrete implementation.
+      ExecutableElement elt = membersInheritedFromSuperclasses[memberName];
+      // Check to see if an element was found in the superclass chain with the
+      // correct name.
+      if (elt != null) {
+        // Reference the types, if any are null then continue.
+        InterfaceType enclosingType = classElement.type;
+        FunctionType concreteType = elt.type;
+        FunctionType requiredMemberType = executableElt.type;
+        if (enclosingType == null ||
+            concreteType == null ||
+            requiredMemberType == null) {
+          continue;
+        }
+        // Some element was found in the superclass chain that matches the name
+        // of the required member.
+        // If it is not abstract and it is the correct one (types match- the
+        // version of this method that we have has the correct number of
+        // parameters, etc), then this class has a valid implementation of this
+        // method, so skip it.
+        if ((elt is MethodElement && !elt.isAbstract) ||
+            (elt is PropertyAccessorElement && !elt.isAbstract)) {
+          // Since we are comparing two function types, we need to do the
+          // appropriate type substitutions first ().
+          FunctionType foundConcreteFT =
+              inheritanceManager.substituteTypeArgumentsInMemberFromInheritance(
+                  concreteType, memberName, enclosingType);
+          FunctionType requiredMemberFT =
+              inheritanceManager.substituteTypeArgumentsInMemberFromInheritance(
+                  requiredMemberType, memberName, enclosingType);
+          foundConcreteFT =
+              typeSystem.functionTypeToConcreteType(foundConcreteFT);
+          requiredMemberFT =
+              typeSystem.functionTypeToConcreteType(requiredMemberFT);
+
+          // Strong mode does override checking for types in CodeChecker, so
+          // we can skip it here. Doing it here leads to unnecessary duplicate
+          // error messages in subclasses that inherit from one that has an
+          // override error.
+          //
+          // See: https://github.com/dart-lang/sdk/issues/25232
+          if (strongMode ||
+              typeSystem.isSubtypeOf(foundConcreteFT, requiredMemberFT)) {
+            continue;
+          }
+        }
+      }
+      // The not qualifying concrete executable element was found, add it to the
+      // list.
+      missingOverrides.add(executableElt);
+    }
+    return missingOverrides;
+  }
+
+  /**
+   * Return [FieldElement]s that are declared in the [ClassDeclaration] with
+   * the given [constructor], but are not initialized.
+   */
+  static List<FieldElement> computeNotInitializedFields(
+      ConstructorDeclaration constructor) {
+    Set<FieldElement> fields = new Set<FieldElement>();
+    var classDeclaration = constructor.parent as ClassDeclaration;
+    for (ClassMember fieldDeclaration in classDeclaration.members) {
+      if (fieldDeclaration is FieldDeclaration) {
+        for (VariableDeclaration field in fieldDeclaration.fields.variables) {
+          if (field.initializer == null) {
+            fields.add(field.element);
+          }
+        }
+      }
+    }
+
+    List<FormalParameter> parameters = constructor.parameters?.parameters ?? [];
+    for (FormalParameter parameter in parameters) {
+      if (parameter is DefaultFormalParameter) {
+        parameter = (parameter as DefaultFormalParameter).parameter;
+      }
+      if (parameter is FieldFormalParameter) {
+        FieldFormalParameterElement element =
+            parameter.identifier.staticElement as FieldFormalParameterElement;
+        fields.remove(element.field);
+      }
+    }
+
+    for (ConstructorInitializer initializer in constructor.initializers) {
+      if (initializer is ConstructorFieldInitializer) {
+        fields.remove(initializer.fieldName.staticElement);
+      }
+    }
+
+    return fields.toList();
+  }
+
+  /**
    * Return the static type of the given [expression] that is to be used for
    * type analysis.
    */
@@ -6737,6 +6785,57 @@
     }
     return null;
   }
+
+  /**
+   * Return `true` iff the given [classElement] has a concrete method, getter or
+   * setter that matches the name of the given [executableElement] in either the
+   * class itself, or one of its' mixins.
+   *
+   * By "match", only the name of the member is tested to match, it does not
+   * have to equal or be a subtype of the given executable element, this is due
+   * to the specific use where this method is used in
+   * [_checkForNonAbstractClassInheritsAbstractMember].
+   */
+  static bool _isMemberInClassOrMixin(
+      ExecutableElement executableElement, ClassElement classElement) {
+    ExecutableElement foundElt = null;
+    String executableName = executableElement.name;
+    if (executableElement is MethodElement) {
+      foundElt = classElement.getMethod(executableName);
+      if (foundElt != null && !foundElt.isAbstract) {
+        return true;
+      }
+      List<InterfaceType> mixins = classElement.mixins;
+      for (int i = 0; i < mixins.length && foundElt == null; i++) {
+        foundElt = mixins[i].getMethod(executableName);
+      }
+      if (foundElt != null && !foundElt.isAbstract) {
+        return true;
+      }
+    } else if (executableElement is PropertyAccessorElement) {
+      if (executableElement.isGetter) {
+        foundElt = classElement.getGetter(executableName);
+      }
+      if (foundElt == null && executableElement.isSetter) {
+        foundElt = classElement.getSetter(executableName);
+      }
+      if (foundElt != null &&
+          !(foundElt as PropertyAccessorElement).isAbstract) {
+        return true;
+      }
+      List<InterfaceType> mixins = classElement.mixins;
+      for (int i = 0; i < mixins.length && foundElt == null; i++) {
+        foundElt = mixins[i].getGetter(executableName);
+        if (foundElt == null) {
+          foundElt = mixins[i].getSetter(executableName);
+        }
+      }
+      if (foundElt != null && !foundElt.isAbstract) {
+        return true;
+      }
+    }
+    return false;
+  }
 }
 
 class GeneralizingElementVisitor_ErrorVerifier_hasTypedefSelfReference
@@ -6886,7 +6985,9 @@
     DartType type = node.constructorName.type.type;
     if (type is InterfaceType) {
       _checkForMissingRequiredParam(
-          node.staticElement?.type, node.argumentList, node.constructorName);
+          resolutionMap.staticElementForConstructorReference(node)?.type,
+          node.argumentList,
+          node.constructorName);
     }
     return super.visitInstanceCreationExpression(node);
   }
@@ -6901,7 +7002,8 @@
   @override
   Object visitRedirectingConstructorInvocation(
       RedirectingConstructorInvocation node) {
-    DartType type = node.staticElement?.type;
+    DartType type =
+        resolutionMap.staticElementForConstructorReference(node)?.type;
     if (type != null) {
       _checkForMissingRequiredParam(type, node.argumentList, node);
     }
@@ -6910,7 +7012,8 @@
 
   @override
   Object visitSuperConstructorInvocation(SuperConstructorInvocation node) {
-    DartType type = node.staticElement?.type;
+    DartType type =
+        resolutionMap.staticElementForConstructorReference(node)?.type;
     if (type != null) {
       _checkForMissingRequiredParam(type, node.argumentList, node);
     }
diff --git a/pkg/analyzer/lib/src/generated/gn.dart b/pkg/analyzer/lib/src/generated/gn.dart
new file mode 100644
index 0000000..ea19833
--- /dev/null
+++ b/pkg/analyzer/lib/src/generated/gn.dart
@@ -0,0 +1,255 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library analyzer.src.generated.gn;
+
+import 'dart:collection';
+import 'dart:core';
+
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/util/fast_uri.dart';
+import 'package:path/path.dart';
+
+/**
+ * The [UriResolver] used to resolve `file` URIs in a [GnWorkspace].
+ */
+class GnFileUriResolver extends ResourceUriResolver {
+  /**
+   * The workspace associated with this resolver.
+   */
+  final GnWorkspace workspace;
+
+  /**
+   * Initialize a newly created resolver to be associated with the given
+   * [workspace].
+   */
+  GnFileUriResolver(GnWorkspace workspace)
+      : workspace = workspace,
+        super(workspace.provider);
+
+  @override
+  Source resolveAbsolute(Uri uri, [Uri actualUri]) {
+    if (!ResourceUriResolver.isFileUri(uri)) {
+      return null;
+    }
+    String path = provider.pathContext.fromUri(uri);
+    File file = workspace.findFile(path);
+    if (file != null) {
+      return file.createSource(actualUri ?? uri);
+    }
+    return null;
+  }
+}
+
+/**
+ * The [UriResolver] used to resolve `package` URIs in a [GnWorkspace].
+ */
+class GnPackageUriResolver extends UriResolver {
+  /**
+   * The workspace associated with this resolver.
+   */
+  final GnWorkspace workspace;
+
+  /**
+   * The path context that should be used to manipulate file system paths.
+   */
+  final Context pathContext;
+
+  /**
+   * The map of package sources indexed by package name.
+   */
+  final Map<String, String> _packages;
+
+  /**
+   * The cache of absolute [Uri]s to [Source]s mappings.
+   */
+  final Map<Uri, Source> _sourceCache = new HashMap<Uri, Source>();
+
+  /**
+   * Initialize a newly created resolver to be associated with the given
+   * [workspace].
+   */
+  GnPackageUriResolver(GnWorkspace workspace)
+      : workspace = workspace,
+        pathContext = workspace.provider.pathContext,
+        _packages = workspace.packages;
+
+  @override
+  Source resolveAbsolute(Uri uri, [Uri actualUri]) {
+    return _sourceCache.putIfAbsent(uri, () {
+      if (uri.scheme != 'package') {
+        return null;
+      }
+
+      String uriPath = uri.path;
+      int slash = uriPath.indexOf('/');
+
+      // If the path either starts with a slash or has no slash, it is invalid.
+      if (slash < 1) {
+        return null;
+      }
+
+      String packageName = uriPath.substring(0, slash);
+      String fileUriPart = uriPath.substring(slash + 1);
+      String filePath = fileUriPart.replaceAll('/', pathContext.separator);
+
+      if (!_packages.containsKey(packageName)) {
+        return null;
+      }
+      String packageBase = _packages[packageName];
+      String path = pathContext.join(packageBase, filePath);
+      File file = workspace.findFile(path);
+      return file?.createSource(uri);
+    });
+  }
+
+  @override
+  Uri restoreAbsolute(Source source) {
+    Context context = workspace.provider.pathContext;
+    String path = source.fullName;
+
+    if (!context.isWithin(workspace.root, path)) {
+      return null;
+    }
+
+    String package = _packages.keys.firstWhere(
+        (key) => context.isWithin(_packages[key], path),
+        orElse: () => null);
+
+    if (package == null) {
+      return null;
+    }
+
+    String sourcePath = context.relative(path, from: _packages[package]);
+
+    return FastUri.parse('package:$package/$sourcePath');
+  }
+}
+
+/**
+ * Information about a Gn workspace.
+ */
+class GnWorkspace {
+  /**
+   * The name of the directory that identifies the root of the workspace.
+   */
+  static const String _jiriRootName = '.jiri_root';
+
+  /**
+   * The resource provider used to access the file system.
+   */
+  final ResourceProvider provider;
+
+  /**
+   * The absolute workspace root path (the directory containing the `.jiri_root`
+   * directory).
+   */
+  final String root;
+
+  /**
+   * The map of package sources indexed by package name.
+   */
+  final Map<String, String> packages;
+
+  GnWorkspace._(this.provider, this.root, this.packages);
+
+  /**
+   * Return a map of package sources.
+   */
+  Map<String, List<Folder>> get packageMap {
+    Map<String, List<Folder>> result = new HashMap<String, List<Folder>>();
+    packages.forEach((package, sourceDir) {
+      result[package] = [provider.getFolder(sourceDir)];
+    });
+    return result;
+  }
+
+  /**
+   * Return the file with the given [absolutePath].
+   *
+   * Return `null` if the given [absolutePath] is not in the workspace [root].
+   */
+  File findFile(String absolutePath) {
+    try {
+      File writableFile = provider.getFile(absolutePath);
+      return writableFile;
+    } catch (_) {
+      return null;
+    }
+  }
+
+  /**
+   * Locate the output directory.
+   *
+   * Return `null` if it could not be found.
+   */
+  static String _getOutDirectory(ResourceProvider provider, String root) =>
+      provider
+          .getFolder('$root/out')
+          .getChildren()
+          .where((resource) => resource is Folder)
+          .map((resource) => resource as Folder)
+          .firstWhere((Folder folder) {
+        String baseName = basename(folder.path);
+        // TODO(pylaligand): find a better way to locate the proper directory.
+        return baseName.startsWith('debug') || baseName.startsWith('release');
+      }, orElse: () => null)?.path;
+
+  /**
+   * Return a map of package source locations indexed by package name.
+   */
+  static Map<String, String> _getPackages(
+      ResourceProvider provider, String outDirectory) {
+    String packagesDir = '$outDirectory/gen/dart.sources';
+    Map<String, String> result = new HashMap<String, String>();
+    provider
+        .getFolder(packagesDir)
+        .getChildren()
+        .where((resource) => resource is File)
+        .map((resource) => resource as File)
+        .forEach((file) {
+      String packageName = basename(file.path);
+      String source = file.readAsStringSync();
+      result[packageName] = source;
+    });
+    return result;
+  }
+
+  /**
+   * Find the Gn workspace that contains the given [path].
+   *
+   * Return `null` if a workspace markers, such as the `.jiri_root` directory
+   * cannot be found.
+   */
+  static GnWorkspace find(ResourceProvider provider, String path) {
+    Context context = provider.pathContext;
+
+    // Ensure that the path is absolute and normalized.
+    if (!context.isAbsolute(path)) {
+      throw new ArgumentError('not absolute: $path');
+    }
+    path = context.normalize(path);
+
+    Folder folder = provider.getFolder(path);
+    while (true) {
+      Folder parent = folder.parent;
+      if (parent == null) {
+        return null;
+      }
+
+      // Found the .jiri_root file, must be a non-git workspace.
+      if (folder.getChildAssumingFolder(_jiriRootName).exists) {
+        String root = folder.path;
+        String outDirectory = _getOutDirectory(provider, root);
+        Map<String, String> packages = _getPackages(provider, outDirectory);
+        return new GnWorkspace._(provider, root, packages);
+      }
+
+      // Go up the folder.
+      folder = parent;
+    }
+  }
+}
diff --git a/pkg/analyzer/lib/src/generated/incremental_resolver.dart b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
index 1787b4a..b26d939 100644
--- a/pkg/analyzer/lib/src/generated/incremental_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/incremental_resolver.dart
@@ -482,8 +482,7 @@
           _definingLibrary,
           _typeProvider,
           new InheritanceManager(_definingLibrary),
-          _context.analysisOptions.enableSuperMixins,
-          _context.analysisOptions.enableAssertMessage);
+          _context.analysisOptions.enableSuperMixins);
       if (_resolutionContext.enclosingClassDeclaration != null) {
         errorVerifier.visitClassDeclarationIncrementally(
             _resolutionContext.enclosingClassDeclaration);
diff --git a/pkg/analyzer/lib/src/generated/java_core.dart b/pkg/analyzer/lib/src/generated/java_core.dart
index 994f553..51eead8 100644
--- a/pkg/analyzer/lib/src/generated/java_core.dart
+++ b/pkg/analyzer/lib/src/generated/java_core.dart
@@ -126,7 +126,7 @@
 }
 
 @deprecated
-abstract class Enum<E extends Enum> implements Comparable<E> {
+abstract class Enum<E extends Enum<E>> implements Comparable<E> {
   /// The name of this enum constant, as declared in the enum declaration.
   final String name;
 
diff --git a/pkg/analyzer/lib/src/generated/package.dart b/pkg/analyzer/lib/src/generated/package.dart
index dddce5a..5983dd3 100644
--- a/pkg/analyzer/lib/src/generated/package.dart
+++ b/pkg/analyzer/lib/src/generated/package.dart
@@ -158,7 +158,7 @@
   @override
   int get hashCode {
     int hashCode = 0;
-    for (int value in options.encodeCrossContextOptions()) {
+    for (int value in options.signature) {
       hashCode = JenkinsSmiHash.combine(hashCode, value);
     }
     hashCode = JenkinsSmiHash.combine(hashCode, id.hashCode);
@@ -170,9 +170,8 @@
   bool operator ==(Object other) {
     return other is PackageDescription &&
         other.sdk == sdk &&
-        AnalysisOptions.crossContextOptionsEqual(
-            other.options.encodeCrossContextOptions(),
-            options.encodeCrossContextOptions()) &&
+        AnalysisOptions.signaturesEqual(
+            other.options.signature, options.signature) &&
         other.id == id;
   }
 }
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index 58b4ba0..b8906c1 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -8,6 +8,7 @@
 import "dart:math" as math;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/error/listener.dart';
@@ -61,9 +62,9 @@
   final Token keyword;
 
   /**
-   * The type, of `null` if no type was specified.
+   * The type, or `null` if no type was specified.
    */
-  final TypeName type;
+  final TypeAnnotation type;
 
   /**
    * Initialize a newly created holder with the given [keyword] and [type].
@@ -88,6 +89,12 @@
   Token constKeyword;
 
   /**
+   * The token representing the keyword 'covariant', or `null` if the keyword
+   * was not found.
+   */
+  Token covariantKeyword;
+
+  /**
    * The token representing the keyword 'external', or `null` if the keyword was
    * not found.
    */
@@ -242,6 +249,12 @@
   bool _inInitializer = false;
 
   /**
+   * A flag indicating whether the parser is to parse generic function type
+   * syntax.
+   */
+  bool parseGenericFunctionTypes = false;
+
+  /**
    * A flag indicating whether the parser is to parse generic method syntax.
    */
   @deprecated
@@ -393,14 +406,15 @@
     } else {
       syntheticToken = _createSyntheticToken(TokenType.IDENTIFIER);
     }
-    return new SimpleIdentifier(syntheticToken, isDeclaration: isDeclaration);
+    return astFactory.simpleIdentifier(syntheticToken,
+        isDeclaration: isDeclaration);
   }
 
   /**
    * Return a synthetic string literal.
    */
-  SimpleStringLiteral createSyntheticStringLiteral() =>
-      new SimpleStringLiteral(_createSyntheticToken(TokenType.STRING), "");
+  SimpleStringLiteral createSyntheticStringLiteral() => astFactory
+      .simpleStringLiteral(_createSyntheticToken(TokenType.STRING), "");
 
   /**
    * Advance to the next token in the token stream, making it the new current
@@ -599,12 +613,12 @@
     Expression expression;
     if (_currentToken.keyword == Keyword.SUPER &&
         _currentToken.next.type.isAdditiveOperator) {
-      expression = new SuperExpression(getAndAdvance());
+      expression = astFactory.superExpression(getAndAdvance());
     } else {
       expression = parseMultiplicativeExpression();
     }
     while (_currentToken.type.isAdditiveOperator) {
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseMultiplicativeExpression());
     }
     return expression;
@@ -631,7 +645,8 @@
     if (_matches(TokenType.OPEN_PAREN)) {
       arguments = parseArgumentList();
     }
-    return new Annotation(atSign, name, period, constructorName, arguments);
+    return astFactory.annotation(
+        atSign, name, period, constructorName, arguments);
   }
 
   /**
@@ -653,7 +668,7 @@
     // namedArgument can have an identifier followed by a colon.
     //
     if (_matchesIdentifier() && _tokenMatches(_peek(), TokenType.COLON)) {
-      return new NamedExpression(parseLabel(), parseExpression2());
+      return astFactory.namedExpression(parseLabel(), parseExpression2());
     } else {
       return parseExpression2();
     }
@@ -674,7 +689,7 @@
   ArgumentList parseArgumentList() {
     Token leftParenthesis = getAndAdvance();
     if (_matches(TokenType.CLOSE_PAREN)) {
-      return new ArgumentList(leftParenthesis, null, getAndAdvance());
+      return astFactory.argumentList(leftParenthesis, null, getAndAdvance());
     }
     //
     // Even though unnamed arguments must all appear before any named arguments,
@@ -712,7 +727,8 @@
       // If there is, then we're more likely missing a comma and should go back
       // to parsing arguments.
       Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
-      return new ArgumentList(leftParenthesis, arguments, rightParenthesis);
+      return astFactory.argumentList(
+          leftParenthesis, arguments, rightParenthesis);
     } finally {
       _inInitializer = wasInInitializer;
     }
@@ -738,7 +754,7 @@
     }
     Token rightParen = _expect(TokenType.CLOSE_PAREN);
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new AssertStatement(
+    return astFactory.assertStatement(
         keyword, leftParen, expression, comma, message, rightParen, semicolon);
   }
 
@@ -755,7 +771,7 @@
   Expression parseAssignableExpression(bool primaryAllowed) {
     if (_matchesKeyword(Keyword.SUPER)) {
       return parseAssignableSelector(
-          new SuperExpression(getAndAdvance()), false,
+          astFactory.superExpression(getAndAdvance()), false,
           allowConditional: false);
     }
     return _parseAssignableExpressionNotStartingWithSuper(primaryAllowed);
@@ -786,7 +802,7 @@
       try {
         Expression index = parseExpression2();
         Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET);
-        return new IndexExpression.forTarget(
+        return astFactory.indexExpressionForTarget(
             prefix, leftBracket, index, rightBracket);
       } finally {
         _inInitializer = wasInInitializer;
@@ -800,13 +816,14 @@
               [_currentToken.lexeme]);
         }
         Token operator = getAndAdvance();
-        return new PropertyAccess(prefix, operator, parseSimpleIdentifier());
+        return astFactory.propertyAccess(
+            prefix, operator, parseSimpleIdentifier());
       } else if (type == TokenType.INDEX) {
         _splitIndex();
         Token leftBracket = getAndAdvance();
         Expression index = parseSimpleIdentifier();
         Token rightBracket = getAndAdvance();
-        return new IndexExpression.forTarget(
+        return astFactory.indexExpressionForTarget(
             prefix, leftBracket, index, rightBracket);
       } else {
         if (!optional) {
@@ -830,7 +847,7 @@
   AwaitExpression parseAwaitExpression() {
     Token awaitToken = getAndAdvance();
     Expression expression = parseUnaryExpression();
-    return new AwaitExpression(awaitToken, expression);
+    return astFactory.awaitExpression(awaitToken, expression);
   }
 
   /**
@@ -845,12 +862,12 @@
     Expression expression;
     if (_currentToken.keyword == Keyword.SUPER &&
         _currentToken.next.type == TokenType.AMPERSAND) {
-      expression = new SuperExpression(getAndAdvance());
+      expression = astFactory.superExpression(getAndAdvance());
     } else {
       expression = parseShiftExpression();
     }
     while (_currentToken.type == TokenType.AMPERSAND) {
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseShiftExpression());
     }
     return expression;
@@ -868,12 +885,12 @@
     Expression expression;
     if (_currentToken.keyword == Keyword.SUPER &&
         _currentToken.next.type == TokenType.BAR) {
-      expression = new SuperExpression(getAndAdvance());
+      expression = astFactory.superExpression(getAndAdvance());
     } else {
       expression = parseBitwiseXorExpression();
     }
     while (_currentToken.type == TokenType.BAR) {
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseBitwiseXorExpression());
     }
     return expression;
@@ -891,12 +908,12 @@
     Expression expression;
     if (_currentToken.keyword == Keyword.SUPER &&
         _currentToken.next.type == TokenType.CARET) {
-      expression = new SuperExpression(getAndAdvance());
+      expression = astFactory.superExpression(getAndAdvance());
     } else {
       expression = parseBitwiseAndExpression();
     }
     while (_currentToken.type == TokenType.CARET) {
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseBitwiseAndExpression());
     }
     return expression;
@@ -937,7 +954,7 @@
     // there is, then we're more likely missing a semi-colon and should go back
     // to parsing statements.
     Token rightBracket = _expect(TokenType.CLOSE_CURLY_BRACKET);
-    return new Block(leftBracket, statements, rightBracket);
+    return astFactory.block(leftBracket, statements, rightBracket);
   }
 
   /**
@@ -958,7 +975,7 @@
       _reportErrorForToken(ParserErrorCode.BREAK_OUTSIDE_OF_LOOP, breakKeyword);
     }
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new BreakStatement(breakKeyword, label, semicolon);
+    return astFactory.breakStatement(breakKeyword, label, semicolon);
   }
 
   /**
@@ -992,7 +1009,7 @@
       try {
         Expression index = parseExpression2();
         Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET);
-        expression = new IndexExpression.forCascade(
+        expression = astFactory.indexExpressionForCascade(
             period, leftBracket, index, rightBracket);
         period = null;
       } finally {
@@ -1009,21 +1026,21 @@
       do {
         TypeArgumentList typeArguments = _parseOptionalTypeArguments();
         if (functionName != null) {
-          expression = new MethodInvocation(expression, period, functionName,
-              typeArguments, parseArgumentList());
+          expression = astFactory.methodInvocation(expression, period,
+              functionName, typeArguments, parseArgumentList());
           period = null;
           functionName = null;
         } else if (expression == null) {
           // It should not be possible to get here.
-          expression = new MethodInvocation(expression, period,
+          expression = astFactory.methodInvocation(expression, period,
               createSyntheticIdentifier(), typeArguments, parseArgumentList());
         } else {
-          expression = new FunctionExpressionInvocation(
+          expression = astFactory.functionExpressionInvocation(
               expression, typeArguments, parseArgumentList());
         }
       } while (_isLikelyArgumentList());
     } else if (functionName != null) {
-      expression = new PropertyAccess(expression, period, functionName);
+      expression = astFactory.propertyAccess(expression, period, functionName);
       period = null;
     }
     assert(expression != null);
@@ -1038,14 +1055,14 @@
           TypeArgumentList typeArguments = _parseOptionalTypeArguments();
           Expression currentExpression = expression;
           if (currentExpression is PropertyAccess) {
-            expression = new MethodInvocation(
+            expression = astFactory.methodInvocation(
                 currentExpression.target,
                 currentExpression.operator,
                 currentExpression.propertyName,
                 typeArguments,
                 parseArgumentList());
           } else {
-            expression = new FunctionExpressionInvocation(
+            expression = astFactory.functionExpressionInvocation(
                 expression, typeArguments, parseArgumentList());
           }
         }
@@ -1054,7 +1071,7 @@
     if (_currentToken.type.isAssignmentOperator) {
       Token operator = getAndAdvance();
       _ensureAssignable(expression);
-      expression = new AssignmentExpression(
+      expression = astFactory.assignmentExpression(
           expression, operator, parseExpressionWithoutCascade());
     }
     return expression;
@@ -1176,7 +1193,7 @@
       rightBracket = _createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET);
       _reportErrorForCurrentToken(ParserErrorCode.MISSING_CLASS_BODY);
     }
-    ClassDeclaration classDeclaration = new ClassDeclaration(
+    ClassDeclaration classDeclaration = astFactory.classDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         abstractKeyword,
@@ -1207,8 +1224,8 @@
     Modifiers modifiers = parseModifiers();
     Keyword keyword = _currentToken.keyword;
     if (keyword == Keyword.VOID) {
-      TypeName returnType =
-          new TypeName(new SimpleIdentifier(getAndAdvance()), null);
+      TypeName returnType = astFactory.typeName(
+          astFactory.simpleIdentifier(getAndAdvance()), null);
       keyword = _currentToken.keyword;
       Token next = _peek();
       bool isFollowedByIdentifier = _tokenMatchesIdentifier(next);
@@ -1251,6 +1268,7 @@
             return parseInitializedIdentifierList(
                 commentAndMetadata,
                 modifiers.staticKeyword,
+                modifiers.covariantKeyword,
                 _validateModifiersForField(modifiers),
                 returnType);
           }
@@ -1315,27 +1333,26 @@
         return parseOperator(
             commentAndMetadata, modifiers.externalKeyword, null);
       }
-      Token keyword = modifiers.varKeyword;
-      if (keyword == null) {
-        keyword = modifiers.finalKeyword;
-      }
-      if (keyword == null) {
-        keyword = modifiers.constKeyword;
-      }
+      Token keyword = modifiers.varKeyword ??
+          modifiers.finalKeyword ??
+          modifiers.constKeyword;
       if (keyword != null) {
         //
         // We appear to have found an incomplete field declaration.
         //
         _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER);
-        VariableDeclaration variable =
-            new VariableDeclaration(createSyntheticIdentifier(), null, null);
+        VariableDeclaration variable = astFactory.variableDeclaration(
+            createSyntheticIdentifier(), null, null);
         List<VariableDeclaration> variables = <VariableDeclaration>[variable];
-        return new FieldDeclaration(
+        FieldDeclarationImpl field = astFactory.fieldDeclaration(
             commentAndMetadata.comment,
             commentAndMetadata.metadata,
             null,
-            new VariableDeclarationList(null, null, keyword, null, variables),
+            astFactory.variableDeclarationList(
+                null, null, keyword, null, variables),
             _expect(TokenType.SEMICOLON));
+        field.covariantKeyword = modifiers.covariantKeyword;
+        return field;
       }
       _reportErrorForToken(
           ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken);
@@ -1347,7 +1364,7 @@
         // to loose, so we'll treat it as a method declaration with a missing
         // name, parameters and empty body.
         //
-        return new MethodDeclaration(
+        return astFactory.methodDeclaration(
             commentAndMetadata.comment,
             commentAndMetadata.metadata,
             null,
@@ -1357,9 +1374,14 @@
             null,
             createSyntheticIdentifier(isDeclaration: true),
             null,
-            new FormalParameterList(
-                null, <FormalParameter>[], null, null, null),
-            new EmptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON)));
+            astFactory.formalParameterList(
+                _createSyntheticToken(TokenType.OPEN_PAREN),
+                <FormalParameter>[],
+                null,
+                null,
+                _createSyntheticToken(TokenType.CLOSE_PAREN)),
+            astFactory
+                .emptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON)));
       }
       return null;
     } else if (_tokenMatches(next, TokenType.PERIOD) &&
@@ -1387,7 +1409,7 @@
             modifiers.externalKeyword,
             _validateModifiersForConstructor(modifiers),
             modifiers.factoryKeyword,
-            new SimpleIdentifier(methodName.token, isDeclaration: false),
+            astFactory.simpleIdentifier(methodName.token, isDeclaration: false),
             null,
             null,
             parameters);
@@ -1413,8 +1435,12 @@
         _reportErrorForCurrentToken(
             ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE);
       }
-      return parseInitializedIdentifierList(commentAndMetadata,
-          modifiers.staticKeyword, _validateModifiersForField(modifiers), null);
+      return parseInitializedIdentifierList(
+          commentAndMetadata,
+          modifiers.staticKeyword,
+          modifiers.covariantKeyword,
+          _validateModifiersForField(modifiers),
+          null);
     } else if (keyword == Keyword.TYPEDEF) {
       _reportErrorForCurrentToken(ParserErrorCode.TYPEDEF_IN_CLASS);
       // TODO(brianwilkerson) We don't currently have any way to capture the
@@ -1428,7 +1454,7 @@
             modifiers.externalKeyword, modifiers.staticKeyword, null);
       }
     }
-    TypeName type = _parseTypeNameAfterIdentifier();
+    TypeAnnotation type = _parseTypeAnnotationAfterIdentifier();
     keyword = _currentToken.keyword;
     next = _peek();
     isFollowedByIdentifier = _tokenMatchesIdentifier(next);
@@ -1454,6 +1480,7 @@
         return parseInitializedIdentifierList(
             commentAndMetadata,
             modifiers.staticKeyword,
+            modifiers.covariantKeyword,
             _validateModifiersForField(modifiers),
             type);
       }
@@ -1478,6 +1505,7 @@
         return parseInitializedIdentifierList(
             commentAndMetadata,
             modifiers.staticKeyword,
+            modifiers.covariantKeyword,
             _validateModifiersForField(modifiers),
             type);
       } finally {
@@ -1495,7 +1523,7 @@
             modifiers.externalKeyword,
             _validateModifiersForConstructor(modifiers),
             modifiers.factoryKeyword,
-            new SimpleIdentifier(methodName.token, isDeclaration: true),
+            astFactory.simpleIdentifier(methodName.token, isDeclaration: true),
             null,
             null,
             parameters);
@@ -1523,34 +1551,12 @@
       return parseGetter(commentAndMetadata, modifiers.externalKeyword,
           modifiers.staticKeyword, type);
     }
-    return parseInitializedIdentifierList(commentAndMetadata,
-        modifiers.staticKeyword, _validateModifiersForField(modifiers), type);
-  }
-
-  /**
-   * Parse a class type alias. The [commentAndMetadata] is the metadata to be
-   * associated with the member. The [abstractKeyword] is the token representing
-   * the 'abstract' keyword. The [classKeyword] is the token representing the
-   * 'class' keyword. Return the class type alias that was parsed.
-   *
-   * This method assumes that the current token matches an identifier.
-   *
-   *     classTypeAlias ::=
-   *         identifier typeParameters? '=' 'abstract'? mixinApplication
-   *
-   *     mixinApplication ::=
-   *         type withClause implementsClause? ';'
-   */
-  ClassTypeAlias parseClassTypeAlias(CommentAndMetadata commentAndMetadata,
-      Token abstractKeyword, Token classKeyword) {
-    SimpleIdentifier className =
-        _parseSimpleIdentifierUnchecked(isDeclaration: true);
-    TypeParameterList typeParameters = null;
-    if (_matches(TokenType.LT)) {
-      typeParameters = parseTypeParameterList();
-    }
-    return _parseClassTypeAliasAfterName(commentAndMetadata, abstractKeyword,
-        classKeyword, className, typeParameters);
+    return parseInitializedIdentifierList(
+        commentAndMetadata,
+        modifiers.staticKeyword,
+        modifiers.covariantKeyword,
+        _validateModifiersForField(modifiers),
+        type);
   }
 
   /**
@@ -1563,9 +1569,9 @@
    */
   Combinator parseCombinator() {
     if (_matchesString(_SHOW)) {
-      return new ShowCombinator(getAndAdvance(), parseIdentifierList());
+      return astFactory.showCombinator(getAndAdvance(), parseIdentifierList());
     } else if (_matchesString(_HIDE)) {
-      return new HideCombinator(getAndAdvance(), parseIdentifierList());
+      return astFactory.hideCombinator(getAndAdvance(), parseIdentifierList());
     }
     return null;
   }
@@ -1645,7 +1651,8 @@
         Token syntheticToken =
             new SyntheticStringToken(TokenType.IDENTIFIER, "", sourceOffset);
         syntheticToken.setNext(firstToken);
-        return new CommentReference(null, new SimpleIdentifier(syntheticToken));
+        return astFactory.commentReference(
+            null, astFactory.simpleIdentifier(syntheticToken));
       }
       Token newKeyword = null;
       if (_tokenMatchesKeyword(firstToken, Keyword.NEW)) {
@@ -1656,16 +1663,16 @@
         if (firstToken.next.type != TokenType.EOF) {
           return null;
         }
-        Identifier identifier = new SimpleIdentifier(firstToken);
-        return new CommentReference(null, identifier);
+        Identifier identifier = astFactory.simpleIdentifier(firstToken);
+        return astFactory.commentReference(null, identifier);
       } else if (_tokenMatchesKeyword(firstToken, Keyword.OPERATOR)) {
         Token secondToken = firstToken.next;
         if (secondToken.isUserDefinableOperator) {
           if (secondToken.next.type != TokenType.EOF) {
             return null;
           }
-          Identifier identifier = new SimpleIdentifier(secondToken);
-          return new CommentReference(null, identifier);
+          Identifier identifier = astFactory.simpleIdentifier(secondToken);
+          return astFactory.commentReference(null, identifier);
         }
         return null;
       } else if (_tokenMatchesIdentifier(firstToken)) {
@@ -1675,37 +1682,37 @@
         Identifier identifier;
         if (_tokenMatches(secondToken, TokenType.PERIOD)) {
           if (thirdToken.isUserDefinableOperator) {
-            identifier = new PrefixedIdentifier(
-                new SimpleIdentifier(firstToken),
+            identifier = astFactory.prefixedIdentifier(
+                astFactory.simpleIdentifier(firstToken),
                 secondToken,
-                new SimpleIdentifier(thirdToken));
+                astFactory.simpleIdentifier(thirdToken));
             nextToken = thirdToken.next;
           } else if (_tokenMatchesKeyword(thirdToken, Keyword.OPERATOR)) {
             Token fourthToken = thirdToken.next;
             if (fourthToken.isUserDefinableOperator) {
-              identifier = new PrefixedIdentifier(
-                  new SimpleIdentifier(firstToken),
+              identifier = astFactory.prefixedIdentifier(
+                  astFactory.simpleIdentifier(firstToken),
                   secondToken,
-                  new SimpleIdentifier(fourthToken));
+                  astFactory.simpleIdentifier(fourthToken));
               nextToken = fourthToken.next;
             } else {
               return null;
             }
           } else if (_tokenMatchesIdentifier(thirdToken)) {
-            identifier = new PrefixedIdentifier(
-                new SimpleIdentifier(firstToken),
+            identifier = astFactory.prefixedIdentifier(
+                astFactory.simpleIdentifier(firstToken),
                 secondToken,
-                new SimpleIdentifier(thirdToken));
+                astFactory.simpleIdentifier(thirdToken));
             nextToken = thirdToken.next;
           }
         } else {
-          identifier = new SimpleIdentifier(firstToken);
+          identifier = astFactory.simpleIdentifier(firstToken);
           nextToken = firstToken.next;
         }
         if (nextToken.type != TokenType.EOF) {
           return null;
         }
-        return new CommentReference(newKeyword, identifier);
+        return astFactory.commentReference(newKeyword, identifier);
       } else {
         Keyword keyword = firstToken.keyword;
         if (keyword == Keyword.THIS ||
@@ -1795,8 +1802,8 @@
                   TokenType.IDENTIFIER, '', nameOffset);
             }
             nameToken.setNext(new SimpleToken(TokenType.EOF, nameToken.end));
-            references.add(
-                new CommentReference(null, new SimpleIdentifier(nameToken)));
+            references.add(astFactory.commentReference(
+                null, astFactory.simpleIdentifier(nameToken)));
             token.references.add(nameToken);
             // next character
             rightIndex = leftIndex + 1;
@@ -1840,7 +1847,7 @@
     Token firstToken = _currentToken;
     ScriptTag scriptTag = null;
     if (_matches(TokenType.SCRIPT_TAG)) {
-      scriptTag = new ScriptTag(getAndAdvance());
+      scriptTag = astFactory.scriptTag(getAndAdvance());
     }
     //
     // Even though all directives must appear before declarations and must occur
@@ -1971,7 +1978,7 @@
 //        }
       }
     }
-    return new CompilationUnit(
+    return astFactory.compilationUnit(
         firstToken, scriptTag, directives, declarations, _currentToken);
   }
 
@@ -2012,8 +2019,8 @@
       _validateModifiersForEnum(modifiers);
       return parseEnumDeclaration(commentAndMetadata);
     } else if (keyword == Keyword.VOID) {
-      TypeName returnType =
-          new TypeName(new SimpleIdentifier(getAndAdvance()), null);
+      TypeName returnType = astFactory.typeName(
+          astFactory.simpleIdentifier(getAndAdvance()), null);
       keyword = _currentToken.keyword;
       next = _peek();
       if ((keyword == Keyword.GET || keyword == Keyword.SET) &&
@@ -2052,7 +2059,7 @@
             // We appear to have a variable declaration with a type of "void".
             //
             _reportErrorForNode(ParserErrorCode.VOID_VARIABLE, returnType);
-            return new TopLevelVariableDeclaration(
+            return astFactory.topLevelVariableDeclaration(
                 commentAndMetadata.comment,
                 commentAndMetadata.metadata,
                 parseVariableDeclarationListAfterType(null,
@@ -2089,13 +2096,14 @@
         // We appear to have found an incomplete top-level variable declaration.
         //
         _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER);
-        VariableDeclaration variable =
-            new VariableDeclaration(createSyntheticIdentifier(), null, null);
+        VariableDeclaration variable = astFactory.variableDeclaration(
+            createSyntheticIdentifier(), null, null);
         List<VariableDeclaration> variables = <VariableDeclaration>[variable];
-        return new TopLevelVariableDeclaration(
+        return astFactory.topLevelVariableDeclaration(
             commentAndMetadata.comment,
             commentAndMetadata.metadata,
-            new VariableDeclarationList(null, null, keyword, null, variables),
+            astFactory.variableDeclarationList(
+                null, null, keyword, null, variables),
             _expect(TokenType.SEMICOLON));
       }
       _reportErrorForToken(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken);
@@ -2119,14 +2127,14 @@
         _reportErrorForCurrentToken(
             ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE);
       }
-      return new TopLevelVariableDeclaration(
+      return astFactory.topLevelVariableDeclaration(
           commentAndMetadata.comment,
           commentAndMetadata.metadata,
           parseVariableDeclarationListAfterType(
               null, _validateModifiersForTopLevelVariable(modifiers), null),
           _expect(TokenType.SEMICOLON));
     }
-    TypeName returnType = parseReturnType();
+    TypeAnnotation returnType = parseReturnType(false);
     keyword = _currentToken.keyword;
     next = _peek();
     if ((keyword == Keyword.GET || keyword == Keyword.SET) &&
@@ -2142,7 +2150,7 @@
           returnType,
           getAndAdvance()));
     } else if (_matches(TokenType.AT)) {
-      return new TopLevelVariableDeclaration(
+      return astFactory.topLevelVariableDeclaration(
           commentAndMetadata.comment,
           commentAndMetadata.metadata,
           parseVariableDeclarationListAfterType(null,
@@ -2158,13 +2166,14 @@
       } else {
         semicolon = _createSyntheticToken(TokenType.SEMICOLON);
       }
-      VariableDeclaration variable =
-          new VariableDeclaration(createSyntheticIdentifier(), null, null);
+      VariableDeclaration variable = astFactory.variableDeclaration(
+          createSyntheticIdentifier(), null, null);
       List<VariableDeclaration> variables = <VariableDeclaration>[variable];
-      return new TopLevelVariableDeclaration(
+      return astFactory.topLevelVariableDeclaration(
           commentAndMetadata.comment,
           commentAndMetadata.metadata,
-          new VariableDeclarationList(null, null, null, returnType, variables),
+          astFactory.variableDeclarationList(
+              null, null, null, returnType, variables),
           semicolon);
     } else if (next.matchesAny(const <TokenType>[
       TokenType.OPEN_PAREN,
@@ -2176,7 +2185,7 @@
       return parseFunctionDeclaration(
           commentAndMetadata, modifiers.externalKeyword, returnType);
     }
-    return new TopLevelVariableDeclaration(
+    return astFactory.topLevelVariableDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         parseVariableDeclarationListAfterType(
@@ -2200,7 +2209,7 @@
     Expression thenExpression = parseExpressionWithoutCascade();
     Token colon = _expect(TokenType.COLON);
     Expression elseExpression = parseExpressionWithoutCascade();
-    return new ConditionalExpression(
+    return astFactory.conditionalExpression(
         condition, question, thenExpression, colon, elseExpression);
   }
 
@@ -2234,8 +2243,8 @@
     }
     Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
     StringLiteral libraryUri = _parseUri();
-    return new Configuration(ifKeyword, leftParenthesis, name, equalToken,
-        value, rightParenthesis, libraryUri);
+    return astFactory.configuration(ifKeyword, leftParenthesis, name,
+        equalToken, value, rightParenthesis, libraryUri);
   }
 
   /**
@@ -2292,8 +2301,12 @@
           type != TokenType.FUNCTION) {
         equals = _createSyntheticToken(TokenType.EQ);
       } else {
-        return new ConstructorFieldInitializer(keywordToken, period, fieldName,
-            _createSyntheticToken(TokenType.EQ), createSyntheticIdentifier());
+        return astFactory.constructorFieldInitializer(
+            keywordToken,
+            period,
+            fieldName,
+            _createSyntheticToken(TokenType.EQ),
+            createSyntheticIdentifier());
       }
     }
     bool wasInInitializer = _inInitializer;
@@ -2308,9 +2321,9 @@
             cascadeSections.add(section);
           }
         } while (_matches(TokenType.PERIOD_PERIOD));
-        expression = new CascadeExpression(expression, cascadeSections);
+        expression = astFactory.cascadeExpression(expression, cascadeSections);
       }
-      return new ConstructorFieldInitializer(
+      return astFactory.constructorFieldInitializer(
           keywordToken, period, fieldName, equals, expression);
     } finally {
       _inInitializer = wasInInitializer;
@@ -2332,7 +2345,7 @@
       period = getAndAdvance();
       name = parseSimpleIdentifier();
     }
-    return new ConstructorName(type, period, name);
+    return astFactory.constructorName(type, period, name);
   }
 
   /**
@@ -2358,7 +2371,7 @@
           ParserErrorCode.CONTINUE_WITHOUT_LABEL_IN_CASE, continueKeyword);
     }
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new ContinueStatement(continueKeyword, label, semicolon);
+    return astFactory.continueStatement(continueKeyword, label, semicolon);
   }
 
   /**
@@ -2411,7 +2424,7 @@
     Token firstToken = _currentToken;
     ScriptTag scriptTag = null;
     if (_matches(TokenType.SCRIPT_TAG)) {
-      scriptTag = new ScriptTag(getAndAdvance());
+      scriptTag = astFactory.scriptTag(getAndAdvance());
     }
     List<Directive> directives = <Directive>[];
     while (!_matches(TokenType.EOF)) {
@@ -2432,11 +2445,11 @@
         while (!_matches(TokenType.EOF)) {
           _advance();
         }
-        return new CompilationUnit(
+        return astFactory.compilationUnit(
             firstToken, scriptTag, directives, null, _currentToken);
       }
     }
-    return new CompilationUnit(
+    return astFactory.compilationUnit(
         firstToken, scriptTag, directives, null, _currentToken);
   }
 
@@ -2454,7 +2467,7 @@
       return null;
     }
     List<CommentReference> references = parseCommentReferences(tokens);
-    return Comment.createDocumentationCommentWithReferences(tokens, references);
+    return astFactory.documentationComment(tokens, references);
   }
 
   /**
@@ -2505,8 +2518,8 @@
       Expression condition = parseExpression2();
       Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
       Token semicolon = _expect(TokenType.SEMICOLON);
-      return new DoStatement(doKeyword, body, whileKeyword, leftParenthesis,
-          condition, rightParenthesis, semicolon);
+      return astFactory.doStatement(doKeyword, body, whileKeyword,
+          leftParenthesis, condition, rightParenthesis, semicolon);
     } finally {
       _inLoop = wasInLoop;
     }
@@ -2525,7 +2538,7 @@
     while (_optional(TokenType.PERIOD)) {
       components.add(parseSimpleIdentifier());
     }
-    return new DottedName(components);
+    return astFactory.dottedName(components);
   }
 
   /**
@@ -2536,7 +2549,7 @@
    *     emptyStatement ::=
    *         ';'
    */
-  Statement parseEmptyStatement() => new EmptyStatement(getAndAdvance());
+  Statement parseEmptyStatement() => astFactory.emptyStatement(getAndAdvance());
 
   /**
    * Parse an enum declaration. The [commentAndMetadata] is the metadata to be
@@ -2577,7 +2590,7 @@
       rightBracket = _createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET);
       _reportErrorForCurrentToken(ParserErrorCode.MISSING_ENUM_BODY);
     }
-    return new EnumDeclaration(
+    return astFactory.enumDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         keyword,
@@ -2599,7 +2612,7 @@
     Expression expression;
     if (_currentToken.keyword == Keyword.SUPER &&
         _currentToken.next.type.isEqualityOperator) {
-      expression = new SuperExpression(getAndAdvance());
+      expression = astFactory.superExpression(getAndAdvance());
     } else {
       expression = parseRelationalExpression();
     }
@@ -2609,7 +2622,7 @@
         _reportErrorForNode(
             ParserErrorCode.EQUALITY_CANNOT_BE_EQUALITY_OPERAND, expression);
       }
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseRelationalExpression());
       leftEqualityExpression = true;
     }
@@ -2631,7 +2644,7 @@
     List<Configuration> configurations = _parseConfigurations();
     List<Combinator> combinators = parseCombinators();
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new ExportDirective(
+    return astFactory.exportDirective(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         exportKeyword,
@@ -2684,11 +2697,12 @@
           cascadeSections.add(section);
         }
       } while (_currentToken.type == TokenType.PERIOD_PERIOD);
-      return new CascadeExpression(expression, cascadeSections);
+      return astFactory.cascadeExpression(expression, cascadeSections);
     } else if (type.isAssignmentOperator) {
       Token operator = getAndAdvance();
       _ensureAssignable(expression);
-      return new AssignmentExpression(expression, operator, parseExpression2());
+      return astFactory.assignmentExpression(
+          expression, operator, parseExpression2());
     }
     return expression;
   }
@@ -2732,7 +2746,7 @@
     if (_currentToken.type.isAssignmentOperator) {
       Token operator = getAndAdvance();
       _ensureAssignable(expression);
-      expression = new AssignmentExpression(
+      expression = astFactory.assignmentExpression(
           expression, operator, parseExpressionWithoutCascade());
     }
     return expression;
@@ -2751,7 +2765,7 @@
     Token keyword = getAndAdvance();
     TypeName superclass = parseTypeName(false);
     _mustNotBeNullable(superclass, ParserErrorCode.NULLABLE_TYPE_IN_EXTENDS);
-    return new ExtendsClause(keyword, superclass);
+    return astFactory.extendsClause(keyword, superclass);
   }
 
   /**
@@ -2765,14 +2779,15 @@
    *       | 'var'
    *       | type
    */
-  FinalConstVarOrType parseFinalConstVarOrType(bool optional) {
+  FinalConstVarOrType parseFinalConstVarOrType(bool optional,
+      {bool inFunctionType: false}) {
     Token keywordToken = null;
-    TypeName type = null;
+    TypeAnnotation type = null;
     Keyword keyword = _currentToken.keyword;
     if (keyword == Keyword.FINAL || keyword == Keyword.CONST) {
       keywordToken = getAndAdvance();
       if (_isTypedIdentifier(_currentToken)) {
-        type = parseTypeName(false);
+        type = parseTypeAnnotation(false);
       } else {
         // Support `final/*=T*/ x;`
         type = _parseOptionalTypeNameComment();
@@ -2786,7 +2801,9 @@
         keywordToken = null;
       }
     } else if (_isTypedIdentifier(_currentToken)) {
-      type = parseReturnType();
+      type = parseReturnType(false);
+    } else if (inFunctionType && _matchesIdentifier()) {
+      type = parseTypeAnnotation(false);
     } else if (!optional) {
       _reportErrorForCurrentToken(
           ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE);
@@ -2811,35 +2828,61 @@
    *         normalFormalParameter ('=' expression)?
    *         normalFormalParameter (':' expression)?
    */
-  FormalParameter parseFormalParameter(ParameterKind kind) {
-    NormalFormalParameter parameter = parseNormalFormalParameter();
+  FormalParameter parseFormalParameter(ParameterKind kind,
+      {bool inFunctionType: false}) {
+    NormalFormalParameter parameter =
+        parseNormalFormalParameter(inFunctionType: inFunctionType);
     TokenType type = _currentToken.type;
     if (type == TokenType.EQ) {
+      if (inFunctionType) {
+        _reportErrorForCurrentToken(
+            ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE);
+      }
       Token separator = getAndAdvance();
       Expression defaultValue = parseExpression2();
       if (kind == ParameterKind.REQUIRED) {
         _reportErrorForNode(
             ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, parameter);
         kind = ParameterKind.POSITIONAL;
+      } else if (kind == ParameterKind.NAMED &&
+          inFunctionType &&
+          parameter.identifier == null) {
+        _reportErrorForCurrentToken(
+            ParserErrorCode.MISSING_NAME_FOR_NAMED_PARAMETER);
       }
-      return new DefaultFormalParameter(
+      return astFactory.defaultFormalParameter(
           parameter, kind, separator, defaultValue);
     } else if (type == TokenType.COLON) {
+      if (inFunctionType) {
+        _reportErrorForCurrentToken(
+            ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE);
+      }
       Token separator = getAndAdvance();
       Expression defaultValue = parseExpression2();
-      if (kind == ParameterKind.POSITIONAL) {
-        _reportErrorForToken(
-            ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER,
-            separator);
-      } else if (kind == ParameterKind.REQUIRED) {
+      if (kind == ParameterKind.REQUIRED) {
         _reportErrorForNode(
             ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, parameter);
         kind = ParameterKind.NAMED;
+      } else if (kind == ParameterKind.POSITIONAL) {
+        _reportErrorForToken(
+            ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER,
+            separator);
+      } else if (kind == ParameterKind.NAMED &&
+          inFunctionType &&
+          parameter.identifier == null) {
+        _reportErrorForCurrentToken(
+            ParserErrorCode.MISSING_NAME_FOR_NAMED_PARAMETER);
       }
-      return new DefaultFormalParameter(
+      return astFactory.defaultFormalParameter(
           parameter, kind, separator, defaultValue);
     } else if (kind != ParameterKind.REQUIRED) {
-      return new DefaultFormalParameter(parameter, kind, null, null);
+      if (kind == ParameterKind.NAMED &&
+          inFunctionType &&
+          parameter.identifier == null) {
+        _reportErrorForCurrentToken(
+            ParserErrorCode.MISSING_NAME_FOR_NAMED_PARAMETER);
+      }
+      return astFactory.defaultFormalParameter(parameter, kind, null, null);
     }
     return parameter;
   }
@@ -2866,9 +2909,9 @@
    *     namedFormalParameters ::=
    *         '{' defaultNamedParameter (',' defaultNamedParameter)* '}'
    */
-  FormalParameterList parseFormalParameterList() {
+  FormalParameterList parseFormalParameterList({bool inFunctionType: false}) {
     if (_matches(TokenType.OPEN_PAREN)) {
-      return _parseFormalParameterListUnchecked();
+      return _parseFormalParameterListUnchecked(inFunctionType: inFunctionType);
     }
     // TODO(brianwilkerson) Improve the error message.
     _reportErrorForCurrentToken(
@@ -2912,9 +2955,12 @@
             (_tokenMatchesKeyword(_peek(), Keyword.IN) ||
                 _tokenMatches(_peek(), TokenType.COLON))) {
           SimpleIdentifier variableName = _parseSimpleIdentifierUnchecked();
-          variableList = new VariableDeclarationList(commentAndMetadata.comment,
-              commentAndMetadata.metadata, null, null, <VariableDeclaration>[
-            new VariableDeclaration(variableName, null, null)
+          variableList = astFactory.variableDeclarationList(
+              commentAndMetadata.comment,
+              commentAndMetadata.metadata,
+              null,
+              null, <VariableDeclaration>[
+            astFactory.variableDeclaration(variableName, null, null)
           ]);
         } else if (isInitializedVariableDeclaration()) {
           variableList =
@@ -2946,14 +2992,14 @@
                   ParserErrorCode.INITIALIZED_VARIABLE_IN_FOR_EACH);
             }
             Token keyword = variableList.keyword;
-            TypeName type = variableList.type;
+            TypeAnnotation type = variableList.type;
             if (keyword != null || type != null) {
-              loopVariable = new DeclaredIdentifier(
+              loopVariable = astFactory.declaredIdentifier(
                   commentAndMetadata.comment,
                   commentAndMetadata.metadata,
                   keyword,
                   type,
-                  new SimpleIdentifier(variable.name.token,
+                  astFactory.simpleIdentifier(variable.name.token,
                       isDeclaration: true));
             } else {
               if (commentAndMetadata.hasMetadata) {
@@ -2969,7 +3015,7 @@
           Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
           Statement body = parseStatement2();
           if (loopVariable == null) {
-            return new ForEachStatement.withReference(
+            return astFactory.forEachStatementWithReference(
                 awaitKeyword,
                 forKeyword,
                 leftParenthesis,
@@ -2979,7 +3025,7 @@
                 rightParenthesis,
                 body);
           }
-          return new ForEachStatement.withDeclaration(
+          return astFactory.forEachStatementWithDeclaration(
               awaitKeyword,
               forKeyword,
               leftParenthesis,
@@ -3006,7 +3052,7 @@
       }
       Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
       Statement body = parseStatement2();
-      return new ForStatement(
+      return astFactory.forStatement(
           forKeyword,
           leftParenthesis,
           variableList,
@@ -3053,7 +3099,7 @@
         if (!mayBeEmpty) {
           _reportErrorForCurrentToken(emptyErrorCode);
         }
-        return new EmptyFunctionBody(getAndAdvance());
+        return astFactory.emptyFunctionBody(getAndAdvance());
       }
       Token keyword = null;
       Token star = null;
@@ -3102,10 +3148,10 @@
           semicolon = _expect(TokenType.SEMICOLON);
         }
         if (!_parseFunctionBodies) {
-          return new EmptyFunctionBody(
-              _createSyntheticToken(TokenType.SEMICOLON));
+          return astFactory
+              .emptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON));
         }
-        return new ExpressionFunctionBody(
+        return astFactory.expressionFunctionBody(
             keyword, functionDefinition, expression, semicolon);
       } else if (type == TokenType.OPEN_CURLY_BRACKET) {
         if (keyword != null) {
@@ -3116,23 +3162,23 @@
         }
         if (!_parseFunctionBodies) {
           _skipBlock();
-          return new EmptyFunctionBody(
-              _createSyntheticToken(TokenType.SEMICOLON));
+          return astFactory
+              .emptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON));
         }
-        return new BlockFunctionBody(keyword, star, parseBlock());
+        return astFactory.blockFunctionBody(keyword, star, parseBlock());
       } else if (_matchesString(_NATIVE)) {
         Token nativeToken = getAndAdvance();
         StringLiteral stringLiteral = null;
         if (_matches(TokenType.STRING)) {
           stringLiteral = _parseStringLiteralUnchecked();
         }
-        return new NativeFunctionBody(
+        return astFactory.nativeFunctionBody(
             nativeToken, stringLiteral, _expect(TokenType.SEMICOLON));
       } else {
         // Invalid function body
         _reportErrorForCurrentToken(emptyErrorCode);
-        return new EmptyFunctionBody(
-            _createSyntheticToken(TokenType.SEMICOLON));
+        return astFactory
+            .emptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON));
       }
     } finally {
       _inAsync = wasInAsync;
@@ -3158,7 +3204,7 @@
   FunctionDeclaration parseFunctionDeclaration(
       CommentAndMetadata commentAndMetadata,
       Token externalKeyword,
-      TypeName returnType) {
+      TypeAnnotation returnType) {
     Token keywordToken = null;
     bool isGetter = false;
     Keyword keyword = _currentToken.keyword;
@@ -3170,7 +3216,7 @@
       keywordToken = getAndAdvance();
     }
     if (keywordToken != null && _matches(TokenType.OPEN_PAREN)) {
-      name = new SimpleIdentifier(keywordToken, isDeclaration: true);
+      name = astFactory.simpleIdentifier(keywordToken, isDeclaration: true);
       keywordToken = null;
       isGetter = false;
     } else {
@@ -3185,7 +3231,7 @@
       } else {
         _reportErrorForCurrentToken(
             ParserErrorCode.MISSING_FUNCTION_PARAMETERS);
-        parameters = new FormalParameterList(
+        parameters = astFactory.formalParameterList(
             _createSyntheticToken(TokenType.OPEN_PAREN),
             null,
             null,
@@ -3201,21 +3247,21 @@
       body = parseFunctionBody(
           false, ParserErrorCode.MISSING_FUNCTION_BODY, false);
     } else {
-      body = new EmptyFunctionBody(_expect(TokenType.SEMICOLON));
+      body = astFactory.emptyFunctionBody(_expect(TokenType.SEMICOLON));
     }
 //        if (!isStatement && matches(TokenType.SEMICOLON)) {
 //          // TODO(brianwilkerson) Improve this error message.
 //          reportError(ParserErrorCode.UNEXPECTED_TOKEN, currentToken.getLexeme());
 //          advance();
 //        }
-    return new FunctionDeclaration(
+    return astFactory.functionDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         externalKeyword,
         returnType,
         keywordToken,
         name,
-        new FunctionExpression(typeParameters, parameters, body));
+        astFactory.functionExpression(typeParameters, parameters, body));
   }
 
   /**
@@ -3245,7 +3291,91 @@
     _validateFormalParameterList(parameters);
     FunctionBody body =
         parseFunctionBody(false, ParserErrorCode.MISSING_FUNCTION_BODY, true);
-    return new FunctionExpression(typeParameters, parameters, body);
+    return astFactory.functionExpression(typeParameters, parameters, body);
+  }
+
+  /**
+   * Parse the portion of a generic function type following the [returnType].
+   *
+   *     functionType ::=
+   *         returnType? 'Function' typeParameters? parameterTypeList
+   *     parameterTypeList ::=
+   *         '(' ')' |
+   *       | '(' normalParameterTypes ','? ')' |
+   *       | '(' normalParameterTypes ',' optionalParameterTypes ')' |
+   *       | '(' optionalParameterTypes ')'
+   *     normalParameterTypes ::=
+   *     normalParameterType (',' normalParameterType)*
+   *     normalParameterType ::=
+   *         type | typedIdentifier
+   *     optionalParameterTypes ::=
+   *         optionalPositionalParameterTypes | namedParameterTypes
+   *     optionalPositionalParameterTypes ::=
+   *         '[' normalParameterTypes ','? ']'
+   *     namedParameterTypes ::=
+   *         '{' typedIdentifier (',' typedIdentifier)* ','? '}'
+   *     typedIdentifier ::=
+   *         type identifier
+   */
+  GenericFunctionType parseGenericFunctionTypeAfterReturnType(
+      TypeAnnotation returnType) {
+    Token functionKeyword = null;
+    if (_matchesString('Function')) {
+      functionKeyword = getAndAdvance();
+    } else if (_matchesIdentifier()) {
+      _reportErrorForCurrentToken(ParserErrorCode.NAMED_FUNCTION_TYPE);
+    } else {
+      _reportErrorForCurrentToken(ParserErrorCode.MISSING_FUNCTION_KEYWORD);
+    }
+    TypeParameterList typeParameters = null;
+    if (_matches(TokenType.LT)) {
+      typeParameters = parseTypeParameterList();
+    }
+    FormalParameterList parameters =
+        parseFormalParameterList(inFunctionType: true);
+    return astFactory.genericFunctionType(
+        returnType, functionKeyword, typeParameters, parameters);
+  }
+
+  /**
+   * Parse a generic function type alias.
+   *
+   * This method assumes that the current token is an identifier.
+   *
+   *     genericTypeAlias ::=
+   *         'typedef' identifier typeParameterList? '=' functionType ';'
+   */
+  GenericTypeAlias parseGenericTypeAlias(
+      CommentAndMetadata commentAndMetadata, Token keyword) {
+    Identifier name = _parseSimpleIdentifierUnchecked(isDeclaration: true);
+    TypeParameterList typeParameters = null;
+    if (_matches(TokenType.LT)) {
+      typeParameters = parseTypeParameterList();
+    }
+    Token equals = _expect(TokenType.EQ);
+    TypeAnnotation functionType = parseTypeAnnotation(false);
+    Token semicolon = _expect(TokenType.SEMICOLON);
+    if (functionType is! GenericFunctionType) {
+      // TODO(brianwilkerson) Generate an error and recover (better than this).
+      return astFactory.genericTypeAlias(
+          commentAndMetadata.comment,
+          commentAndMetadata.metadata,
+          keyword,
+          name,
+          typeParameters,
+          equals,
+          null,
+          semicolon);
+    }
+    return astFactory.genericTypeAlias(
+        commentAndMetadata.comment,
+        commentAndMetadata.metadata,
+        keyword,
+        name,
+        typeParameters,
+        equals,
+        functionType,
+        semicolon);
   }
 
   /**
@@ -3265,7 +3395,7 @@
    *         'external'? 'static'? returnType? 'get' identifier
    */
   MethodDeclaration parseGetter(CommentAndMetadata commentAndMetadata,
-      Token externalKeyword, Token staticKeyword, TypeName returnType) {
+      Token externalKeyword, Token staticKeyword, TypeAnnotation returnType) {
     Token propertyKeyword = getAndAdvance();
     SimpleIdentifier name = parseSimpleIdentifier(isDeclaration: true);
     if (_matches(TokenType.OPEN_PAREN) &&
@@ -3281,7 +3411,7 @@
     if (externalKeyword != null && body is! EmptyFunctionBody) {
       _reportErrorForCurrentToken(ParserErrorCode.EXTERNAL_GETTER_WITH_BODY);
     }
-    return new MethodDeclaration(
+    return astFactory.methodDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         externalKeyword,
@@ -3321,7 +3451,7 @@
   Expression parseIfNullExpression() {
     Expression expression = parseLogicalOrExpression();
     while (_currentToken.type == TokenType.QUESTION_QUESTION) {
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseLogicalOrExpression());
     }
     return expression;
@@ -3347,7 +3477,7 @@
       elseKeyword = getAndAdvance();
       elseStatement = parseStatement2();
     }
-    return new IfStatement(ifKeyword, leftParenthesis, condition,
+    return astFactory.ifStatement(ifKeyword, leftParenthesis, condition,
         rightParenthesis, thenStatement, elseKeyword, elseStatement);
   }
 
@@ -3367,7 +3497,7 @@
       _mustNotBeNullable(typeName, ParserErrorCode.NULLABLE_TYPE_IN_IMPLEMENTS);
       interfaces.add(typeName);
     } while (_optional(TokenType.COMMA));
-    return new ImplementsClause(keyword, interfaces);
+    return astFactory.implementsClause(keyword, interfaces);
   }
 
   /**
@@ -3413,7 +3543,7 @@
     }
     List<Combinator> combinators = parseCombinators();
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new ImportDirective(
+    return astFactory.importDirective(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         importKeyword,
@@ -3435,8 +3565,8 @@
    * that has already been parsed, or `null` if 'var' was provided. Return the
    * getter that was parsed.
    *
-   *     ?? ::=
-   *         'static'? ('var' | type) initializedIdentifierList ';'
+   *     declaration ::=
+   *         ('static' | 'covariant')? ('var' | type) initializedIdentifierList ';'
    *       | 'final' type? initializedIdentifierList ';'
    *
    *     initializedIdentifierList ::=
@@ -3448,16 +3578,19 @@
   FieldDeclaration parseInitializedIdentifierList(
       CommentAndMetadata commentAndMetadata,
       Token staticKeyword,
+      Token covariantKeyword,
       Token keyword,
-      TypeName type) {
+      TypeAnnotation type) {
     VariableDeclarationList fieldList =
         parseVariableDeclarationListAfterType(null, keyword, type);
-    return new FieldDeclaration(
+    FieldDeclarationImpl field = astFactory.fieldDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         staticKeyword,
         fieldList,
         _expect(TokenType.SEMICOLON));
+    field.covariantKeyword = covariantKeyword;
+    return field;
   }
 
   /**
@@ -3471,7 +3604,7 @@
   InstanceCreationExpression parseInstanceCreationExpression(Token keyword) {
     ConstructorName constructorName = parseConstructorName();
     ArgumentList argumentList = _parseArgumentListChecked();
-    return new InstanceCreationExpression(
+    return astFactory.instanceCreationExpression(
         keyword, constructorName, argumentList);
   }
 
@@ -3488,7 +3621,7 @@
     SimpleIdentifier label =
         _parseSimpleIdentifierUnchecked(isDeclaration: isDeclaration);
     Token colon = getAndAdvance();
-    return new Label(label, colon);
+    return astFactory.label(label, colon);
   }
 
   /**
@@ -3507,7 +3640,7 @@
     LibraryIdentifier libraryName = _parseLibraryName(
         ParserErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE, keyword);
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new LibraryDirective(commentAndMetadata.comment,
+    return astFactory.libraryDirective(commentAndMetadata.comment,
         commentAndMetadata.metadata, keyword, libraryName, semicolon);
   }
 
@@ -3523,7 +3656,7 @@
     while (_optional(TokenType.PERIOD)) {
       components.add(parseSimpleIdentifier());
     }
-    return new LibraryIdentifier(components);
+    return astFactory.libraryIdentifier(components);
   }
 
   /**
@@ -3541,12 +3674,12 @@
   ListLiteral parseListLiteral(Token modifier, TypeArgumentList typeArguments) {
     if (_matches(TokenType.INDEX)) {
       _splitIndex();
-      return new ListLiteral(
+      return astFactory.listLiteral(
           modifier, typeArguments, getAndAdvance(), null, getAndAdvance());
     }
     Token leftBracket = getAndAdvance();
     if (_matches(TokenType.CLOSE_SQUARE_BRACKET)) {
-      return new ListLiteral(
+      return astFactory.listLiteral(
           modifier, typeArguments, leftBracket, null, getAndAdvance());
     }
     bool wasInInitializer = _inInitializer;
@@ -3555,13 +3688,13 @@
       List<Expression> elements = <Expression>[parseExpression2()];
       while (_optional(TokenType.COMMA)) {
         if (_matches(TokenType.CLOSE_SQUARE_BRACKET)) {
-          return new ListLiteral(
+          return astFactory.listLiteral(
               modifier, typeArguments, leftBracket, elements, getAndAdvance());
         }
         elements.add(parseExpression2());
       }
       Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET);
-      return new ListLiteral(
+      return astFactory.listLiteral(
           modifier, typeArguments, leftBracket, elements, rightBracket);
     } finally {
       _inInitializer = wasInInitializer;
@@ -3586,7 +3719,7 @@
       return parseListLiteral(modifier, typeArguments);
     }
     _reportErrorForCurrentToken(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL);
-    return new ListLiteral(
+    return astFactory.listLiteral(
         modifier,
         typeArguments,
         _createSyntheticToken(TokenType.OPEN_SQUARE_BRACKET),
@@ -3604,7 +3737,7 @@
   Expression parseLogicalAndExpression() {
     Expression expression = parseEqualityExpression();
     while (_currentToken.type == TokenType.AMPERSAND_AMPERSAND) {
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseEqualityExpression());
     }
     return expression;
@@ -3620,7 +3753,7 @@
   Expression parseLogicalOrExpression() {
     Expression expression = parseLogicalAndExpression();
     while (_currentToken.type == TokenType.BAR_BAR) {
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseLogicalAndExpression());
     }
     return expression;
@@ -3641,7 +3774,7 @@
   MapLiteral parseMapLiteral(Token modifier, TypeArgumentList typeArguments) {
     Token leftBracket = getAndAdvance();
     if (_matches(TokenType.CLOSE_CURLY_BRACKET)) {
-      return new MapLiteral(
+      return astFactory.mapLiteral(
           modifier, typeArguments, leftBracket, null, getAndAdvance());
     }
     bool wasInInitializer = _inInitializer;
@@ -3650,13 +3783,13 @@
       List<MapLiteralEntry> entries = <MapLiteralEntry>[parseMapLiteralEntry()];
       while (_optional(TokenType.COMMA)) {
         if (_matches(TokenType.CLOSE_CURLY_BRACKET)) {
-          return new MapLiteral(
+          return astFactory.mapLiteral(
               modifier, typeArguments, leftBracket, entries, getAndAdvance());
         }
         entries.add(parseMapLiteralEntry());
       }
       Token rightBracket = _expect(TokenType.CLOSE_CURLY_BRACKET);
-      return new MapLiteral(
+      return astFactory.mapLiteral(
           modifier, typeArguments, leftBracket, entries, rightBracket);
     } finally {
       _inInitializer = wasInInitializer;
@@ -3673,7 +3806,7 @@
     Expression key = parseExpression2();
     Token separator = _expect(TokenType.COLON);
     Expression value = parseExpression2();
-    return new MapLiteralEntry(key, separator, value);
+    return astFactory.mapLiteralEntry(key, separator, value);
   }
 
   /**
@@ -3714,6 +3847,14 @@
         } else {
           modifiers.constKeyword = getAndAdvance();
         }
+      } else if (keyword == Keyword.COVARIANT) {
+        if (modifiers.covariantKeyword != null) {
+          _reportErrorForCurrentToken(
+              ParserErrorCode.DUPLICATED_MODIFIER, [_currentToken.lexeme]);
+          _advance();
+        } else {
+          modifiers.covariantKeyword = getAndAdvance();
+        }
       } else if (keyword == Keyword.EXTERNAL) {
         if (modifiers.externalKeyword != null) {
           _reportErrorForCurrentToken(
@@ -3773,12 +3914,12 @@
     Expression expression;
     if (_currentToken.keyword == Keyword.SUPER &&
         _currentToken.next.type.isMultiplicativeOperator) {
-      expression = new SuperExpression(getAndAdvance());
+      expression = astFactory.superExpression(getAndAdvance());
     } else {
       expression = parseUnaryExpression();
     }
     while (_currentToken.type.isMultiplicativeOperator) {
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseUnaryExpression());
     }
     return expression;
@@ -3823,7 +3964,7 @@
       if (_tokenMatches(_peek(), TokenType.STRING)) {
         Token afterString = skipStringLiteral(_currentToken.next);
         if (afterString != null && afterString.type == TokenType.COLON) {
-          return new ExpressionStatement(
+          return astFactory.expressionStatement(
               parseExpression2(), _expect(TokenType.SEMICOLON));
         }
       }
@@ -3846,14 +3987,14 @@
       } else if (keyword == Keyword.IF) {
         return parseIfStatement();
       } else if (keyword == Keyword.RETHROW) {
-        return new ExpressionStatement(
+        return astFactory.expressionStatement(
             parseRethrowExpression(), _expect(TokenType.SEMICOLON));
       } else if (keyword == Keyword.RETURN) {
         return parseReturnStatement();
       } else if (keyword == Keyword.SWITCH) {
         return parseSwitchStatement();
       } else if (keyword == Keyword.THROW) {
-        return new ExpressionStatement(
+        return astFactory.expressionStatement(
             parseThrowExpression(), _expect(TokenType.SEMICOLON));
       } else if (keyword == Keyword.TRY) {
         return parseTryStatement();
@@ -3863,8 +4004,8 @@
         return parseVariableDeclarationStatementAfterMetadata(
             commentAndMetadata);
       } else if (keyword == Keyword.VOID) {
-        TypeName returnType =
-            new TypeName(new SimpleIdentifier(getAndAdvance()), null);
+        TypeName returnType = astFactory.typeName(
+            astFactory.simpleIdentifier(getAndAdvance()), null);
         Token next = _currentToken.next;
         if (_matchesIdentifier() &&
             next.matchesAny(const <TokenType>[
@@ -3902,7 +4043,8 @@
           }
           _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT);
           // TODO(brianwilkerson) Recover from this error.
-          return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
+          return astFactory
+              .emptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
         }
       } else if (keyword == Keyword.CONST) {
         Token next = _currentToken.next;
@@ -3912,7 +4054,7 @@
           TokenType.OPEN_SQUARE_BRACKET,
           TokenType.INDEX
         ])) {
-          return new ExpressionStatement(
+          return astFactory.expressionStatement(
               parseExpression2(), _expect(TokenType.SEMICOLON));
         } else if (_tokenMatches(next, TokenType.IDENTIFIER)) {
           Token afterType = skipTypeName(next);
@@ -3921,7 +4063,7 @@
                 (_tokenMatches(afterType, TokenType.PERIOD) &&
                     _tokenMatches(afterType.next, TokenType.IDENTIFIER) &&
                     _tokenMatches(afterType.next.next, TokenType.OPEN_PAREN))) {
-              return new ExpressionStatement(
+              return astFactory.expressionStatement(
                   parseExpression2(), _expect(TokenType.SEMICOLON));
             }
           }
@@ -3934,14 +4076,15 @@
           keyword == Keyword.NULL ||
           keyword == Keyword.SUPER ||
           keyword == Keyword.THIS) {
-        return new ExpressionStatement(
+        return astFactory.expressionStatement(
             parseExpression2(), _expect(TokenType.SEMICOLON));
       } else {
         //
         // We have found an error of some kind. Try to recover.
         //
         _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT);
-        return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
+        return astFactory
+            .emptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
       }
     } else if (_inGenerator && _matchesString(_YIELD)) {
       return parseYieldStatement();
@@ -3949,7 +4092,7 @@
       if (_tokenMatchesKeyword(_peek(), Keyword.FOR)) {
         return parseForStatement();
       }
-      return new ExpressionStatement(
+      return astFactory.expressionStatement(
           parseExpression2(), _expect(TokenType.SEMICOLON));
     } else if (_matchesString(_AWAIT) &&
         _tokenMatchesKeyword(_peek(), Keyword.FOR)) {
@@ -3968,9 +4111,10 @@
       return parseFunctionDeclarationStatement();
     } else if (type == TokenType.CLOSE_CURLY_BRACKET) {
       _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT);
-      return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
+      return astFactory
+          .emptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
     } else {
-      return new ExpressionStatement(
+      return astFactory.expressionStatement(
           parseExpression2(), _expect(TokenType.SEMICOLON));
     }
   }
@@ -3994,15 +4138,39 @@
    *         declaredIdentifier
    *       | metadata identifier
    */
-  NormalFormalParameter parseNormalFormalParameter() {
+  NormalFormalParameter parseNormalFormalParameter(
+      {bool inFunctionType: false}) {
+    Token covariantKeyword;
     CommentAndMetadata commentAndMetadata = parseCommentAndMetadata();
-    FinalConstVarOrType holder = parseFinalConstVarOrType(true);
+    if (_matchesKeyword(Keyword.COVARIANT)) {
+      // Check to ensure that 'covariant' isn't being used as the parameter name.
+      Token next = _peek();
+      if (_tokenMatchesKeyword(next, Keyword.FINAL) ||
+          _tokenMatchesKeyword(next, Keyword.CONST) ||
+          _tokenMatchesKeyword(next, Keyword.VAR) ||
+          _tokenMatchesKeyword(next, Keyword.THIS) ||
+          _tokenMatchesIdentifier(next)) {
+        covariantKeyword = getAndAdvance();
+      }
+    }
+    FinalConstVarOrType holder = parseFinalConstVarOrType(!inFunctionType,
+        inFunctionType: inFunctionType);
     Token thisKeyword = null;
     Token period = null;
     if (_matchesKeyword(Keyword.THIS)) {
       thisKeyword = getAndAdvance();
       period = _expect(TokenType.PERIOD);
     }
+    if (!_matchesIdentifier() && inFunctionType) {
+      SimpleFormalParameterImpl parameter = astFactory.simpleFormalParameter(
+          commentAndMetadata.comment,
+          commentAndMetadata.metadata,
+          holder.keyword,
+          holder.type,
+          null);
+      parameter.covariantKeyword = covariantKeyword;
+      return parameter;
+    }
     SimpleIdentifier identifier = parseSimpleIdentifier();
     TypeParameterList typeParameters = _parseGenericMethodTypeParameters();
     if (_matches(TokenType.OPEN_PAREN)) {
@@ -4016,16 +4184,20 @@
         if (enableNnbd && _matches(TokenType.QUESTION)) {
           question = getAndAdvance();
         }
-        return new FunctionTypedFormalParameter(
-            commentAndMetadata.comment,
-            commentAndMetadata.metadata,
-            holder.type,
-            new SimpleIdentifier(identifier.token, isDeclaration: true),
-            typeParameters,
-            parameters,
-            question: question);
+        FunctionTypedFormalParameterImpl parameter =
+            astFactory.functionTypedFormalParameter(
+                commentAndMetadata.comment,
+                commentAndMetadata.metadata,
+                holder.type,
+                astFactory.simpleIdentifier(identifier.token,
+                    isDeclaration: true),
+                typeParameters,
+                parameters,
+                question: question);
+        parameter.covariantKeyword = covariantKeyword;
+        return parameter;
       } else {
-        return new FieldFormalParameter(
+        FieldFormalParameterImpl parameter = astFactory.fieldFormalParameter(
             commentAndMetadata.comment,
             commentAndMetadata.metadata,
             holder.keyword,
@@ -4035,15 +4207,18 @@
             identifier,
             typeParameters,
             parameters);
+        parameter.covariantKeyword = covariantKeyword;
+        return parameter;
       }
     } else if (typeParameters != null) {
       // TODO(brianwilkerson) Report an error. It looks like a function-typed
       // parameter with no parameter list.
       //_reportErrorForToken(ParserErrorCode.MISSING_PARAMETERS, typeParameters.endToken);
     }
-    TypeName type = holder.type;
+    TypeAnnotation type = holder.type;
     if (type != null) {
-      if (_tokenMatchesKeyword(type.name.beginToken, Keyword.VOID)) {
+      if (type is TypeName &&
+          _tokenMatchesKeyword(type.name.beginToken, Keyword.VOID)) {
         _reportErrorForToken(
             ParserErrorCode.VOID_PARAMETER, type.name.beginToken);
       } else if (holder.keyword != null &&
@@ -4055,23 +4230,27 @@
       // TODO(brianwilkerson) If there are type parameters but no parameters,
       // should we create a synthetic empty parameter list here so we can
       // capture the type parameters?
-      return new FieldFormalParameter(
+      FieldFormalParameterImpl parameter = astFactory.fieldFormalParameter(
           commentAndMetadata.comment,
           commentAndMetadata.metadata,
           holder.keyword,
-          holder.type,
+          type,
           thisKeyword,
           period,
           identifier,
           null,
           null);
+      parameter.covariantKeyword = covariantKeyword;
+      return parameter;
     }
-    return new SimpleFormalParameter(
+    SimpleFormalParameterImpl parameter = astFactory.simpleFormalParameter(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         holder.keyword,
-        holder.type,
-        new SimpleIdentifier(identifier.token, isDeclaration: true));
+        type,
+        astFactory.simpleIdentifier(identifier.token, isDeclaration: true));
+    parameter.covariantKeyword = covariantKeyword;
+    return parameter;
   }
 
   /**
@@ -4147,14 +4326,14 @@
           ArgumentList argumentList = parseArgumentList();
           Expression currentOperand = operand;
           if (currentOperand is PropertyAccess) {
-            operand = new MethodInvocation(
+            operand = astFactory.methodInvocation(
                 currentOperand.target,
                 currentOperand.operator,
                 currentOperand.propertyName,
                 typeArguments,
                 argumentList);
           } else {
-            operand = new FunctionExpressionInvocation(
+            operand = astFactory.functionExpressionInvocation(
                 operand, typeArguments, argumentList);
           }
         } else {
@@ -4173,7 +4352,7 @@
     }
     _ensureAssignable(operand);
     Token operator = getAndAdvance();
-    return new PostfixExpression(operand, operator);
+    return astFactory.postfixExpression(operand, operator);
   }
 
   /**
@@ -4236,25 +4415,25 @@
       } on FormatException {
         // The invalid format should have been reported by the scanner.
       }
-      return new IntegerLiteral(token, value);
+      return astFactory.integerLiteral(token, value);
     }
     Keyword keyword = _currentToken.keyword;
     if (keyword == Keyword.NULL) {
-      return new NullLiteral(getAndAdvance());
+      return astFactory.nullLiteral(getAndAdvance());
     } else if (keyword == Keyword.NEW) {
       return parseNewExpression();
     } else if (keyword == Keyword.THIS) {
-      return new ThisExpression(getAndAdvance());
+      return astFactory.thisExpression(getAndAdvance());
     } else if (keyword == Keyword.SUPER) {
       // TODO(paulberry): verify with Gilad that "super" must be followed by
       // unconditionalAssignableSelector in this case.
       return parseAssignableSelector(
-          new SuperExpression(getAndAdvance()), false,
+          astFactory.superExpression(getAndAdvance()), false,
           allowConditional: false);
     } else if (keyword == Keyword.FALSE) {
-      return new BooleanLiteral(getAndAdvance(), false);
+      return astFactory.booleanLiteral(getAndAdvance(), false);
     } else if (keyword == Keyword.TRUE) {
-      return new BooleanLiteral(getAndAdvance(), true);
+      return astFactory.booleanLiteral(getAndAdvance(), true);
     }
     if (type == TokenType.DOUBLE) {
       Token token = getAndAdvance();
@@ -4264,7 +4443,7 @@
       } on FormatException {
         // The invalid format should have been reported by the scanner.
       }
-      return new DoubleLiteral(token, value);
+      return astFactory.doubleLiteral(token, value);
     } else if (type == TokenType.HEXADECIMAL) {
       Token token = getAndAdvance();
       int value = null;
@@ -4273,7 +4452,7 @@
       } on FormatException {
         // The invalid format should have been reported by the scanner.
       }
-      return new IntegerLiteral(token, value);
+      return astFactory.integerLiteral(token, value);
     } else if (keyword == Keyword.CONST) {
       return parseConstExpression();
     } else if (type == TokenType.OPEN_PAREN) {
@@ -4286,7 +4465,7 @@
       try {
         Expression expression = parseExpression2();
         Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
-        return new ParenthesizedExpression(
+        return astFactory.parenthesizedExpression(
             leftParenthesis, expression, rightParenthesis);
       } finally {
         _inInitializer = wasInInitializer;
@@ -4351,7 +4530,7 @@
       }
     }
     ArgumentList argumentList = _parseArgumentListChecked();
-    return new RedirectingConstructorInvocation(
+    return astFactory.redirectingConstructorInvocation(
         keyword, period, constructorName, argumentList);
   }
 
@@ -4366,27 +4545,28 @@
   Expression parseRelationalExpression() {
     if (_currentToken.keyword == Keyword.SUPER &&
         _currentToken.next.type.isRelationalOperator) {
-      Expression expression = new SuperExpression(getAndAdvance());
+      Expression expression = astFactory.superExpression(getAndAdvance());
       Token operator = getAndAdvance();
-      return new BinaryExpression(
+      return astFactory.binaryExpression(
           expression, operator, parseBitwiseOrExpression());
     }
     Expression expression = parseBitwiseOrExpression();
     Keyword keyword = _currentToken.keyword;
     if (keyword == Keyword.AS) {
       Token asOperator = getAndAdvance();
-      return new AsExpression(expression, asOperator, parseTypeName(true));
+      return astFactory.asExpression(
+          expression, asOperator, parseTypeAnnotation(true));
     } else if (keyword == Keyword.IS) {
       Token isOperator = getAndAdvance();
       Token notOperator = null;
       if (_matches(TokenType.BANG)) {
         notOperator = getAndAdvance();
       }
-      return new IsExpression(
-          expression, isOperator, notOperator, parseTypeName(true));
+      TypeAnnotation type = parseTypeAnnotation(true);
+      return astFactory.isExpression(expression, isOperator, notOperator, type);
     } else if (_currentToken.type.isRelationalOperator) {
       Token operator = getAndAdvance();
-      return new BinaryExpression(
+      return astFactory.binaryExpression(
           expression, operator, parseBitwiseOrExpression());
     }
     return expression;
@@ -4400,7 +4580,8 @@
    *     rethrowExpression ::=
    *         'rethrow'
    */
-  Expression parseRethrowExpression() => new RethrowExpression(getAndAdvance());
+  Expression parseRethrowExpression() =>
+      astFactory.rethrowExpression(getAndAdvance());
 
   /**
    * Parse a return statement. Return the return statement that was parsed.
@@ -4413,11 +4594,11 @@
   Statement parseReturnStatement() {
     Token returnKeyword = getAndAdvance();
     if (_matches(TokenType.SEMICOLON)) {
-      return new ReturnStatement(returnKeyword, null, getAndAdvance());
+      return astFactory.returnStatement(returnKeyword, null, getAndAdvance());
     }
     Expression expression = parseExpression2();
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new ReturnStatement(returnKeyword, expression, semicolon);
+    return astFactory.returnStatement(returnKeyword, expression, semicolon);
   }
 
   /**
@@ -4427,11 +4608,12 @@
    *         'void'
    *       | type
    */
-  TypeName parseReturnType() {
+  TypeAnnotation parseReturnType(bool inExpression) {
     if (_currentToken.keyword == Keyword.VOID) {
-      return new TypeName(new SimpleIdentifier(getAndAdvance()), null);
+      return astFactory.typeName(
+          astFactory.simpleIdentifier(getAndAdvance()), null);
     } else {
-      return parseTypeName(false);
+      return parseTypeAnnotation(inExpression);
     }
   }
 
@@ -4452,7 +4634,7 @@
    *         'external'? 'static'? returnType? 'set' identifier formalParameterList
    */
   MethodDeclaration parseSetter(CommentAndMetadata commentAndMetadata,
-      Token externalKeyword, Token staticKeyword, TypeName returnType) {
+      Token externalKeyword, Token staticKeyword, TypeAnnotation returnType) {
     Token propertyKeyword = getAndAdvance();
     SimpleIdentifier name = parseSimpleIdentifier(isDeclaration: true);
     FormalParameterList parameters = parseFormalParameterList();
@@ -4464,7 +4646,7 @@
     if (externalKeyword != null && body is! EmptyFunctionBody) {
       _reportErrorForCurrentToken(ParserErrorCode.EXTERNAL_SETTER_WITH_BODY);
     }
-    return new MethodDeclaration(
+    return astFactory.methodDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         externalKeyword,
@@ -4489,12 +4671,12 @@
     Expression expression;
     if (_currentToken.keyword == Keyword.SUPER &&
         _currentToken.next.type.isShiftOperator) {
-      expression = new SuperExpression(getAndAdvance());
+      expression = astFactory.superExpression(getAndAdvance());
     } else {
       expression = parseAdditiveExpression();
     }
     while (_currentToken.type.isShiftOperator) {
-      expression = new BinaryExpression(
+      expression = astFactory.binaryExpression(
           expression, getAndAdvance(), parseAdditiveExpression());
     }
     return expression;
@@ -4544,7 +4726,7 @@
     if (labels == null) {
       return statement;
     }
-    return new LabeledStatement(labels, statement);
+    return astFactory.labeledStatement(labels, statement);
   }
 
   /**
@@ -4590,7 +4772,7 @@
       constructorName = parseSimpleIdentifier();
     }
     ArgumentList argumentList = _parseArgumentListChecked();
-    return new SuperConstructorInvocation(
+    return astFactory.superConstructorInvocation(
         keyword, period, constructorName, argumentList);
   }
 
@@ -4635,15 +4817,15 @@
             definedLabels.add(label);
           }
           Token colon = getAndAdvance();
-          labels.add(new Label(identifier, colon));
+          labels.add(astFactory.label(identifier, colon));
         }
         Keyword keyword = _currentToken.keyword;
         if (keyword == Keyword.CASE) {
           Token caseKeyword = getAndAdvance();
           Expression caseExpression = parseExpression2();
           Token colon = _expect(TokenType.COLON);
-          members.add(new SwitchCase(labels, caseKeyword, caseExpression, colon,
-              _parseStatementList()));
+          members.add(astFactory.switchCase(labels, caseKeyword, caseExpression,
+              colon, _parseStatementList()));
           if (defaultKeyword != null) {
             _reportErrorForToken(
                 ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE,
@@ -4656,7 +4838,7 @@
           }
           defaultKeyword = getAndAdvance();
           Token colon = _expect(TokenType.COLON);
-          members.add(new SwitchDefault(
+          members.add(astFactory.switchDefault(
               labels, defaultKeyword, colon, _parseStatementList()));
         } else {
           // We need to advance, otherwise we could end up in an infinite loop,
@@ -4679,7 +4861,7 @@
         type = _currentToken.type;
       }
       Token rightBracket = _expect(TokenType.CLOSE_CURLY_BRACKET);
-      return new SwitchStatement(keyword, leftParenthesis, expression,
+      return astFactory.switchStatement(keyword, leftParenthesis, expression,
           rightParenthesis, leftBracket, members, rightBracket);
     } finally {
       _inSwitch = wasInSwitch;
@@ -4716,7 +4898,7 @@
       _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER);
       components.add(_createSyntheticToken(TokenType.IDENTIFIER));
     }
-    return new SymbolLiteral(poundSign, components);
+    return astFactory.symbolLiteral(poundSign, components);
   }
 
   /**
@@ -4733,10 +4915,10 @@
     if (type == TokenType.SEMICOLON || type == TokenType.CLOSE_PAREN) {
       _reportErrorForToken(
           ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken);
-      return new ThrowExpression(keyword, createSyntheticIdentifier());
+      return astFactory.throwExpression(keyword, createSyntheticIdentifier());
     }
     Expression expression = parseExpression2();
-    return new ThrowExpression(keyword, expression);
+    return astFactory.throwExpression(keyword, expression);
   }
 
   /**
@@ -4753,10 +4935,10 @@
     if (type == TokenType.SEMICOLON || type == TokenType.CLOSE_PAREN) {
       _reportErrorForToken(
           ParserErrorCode.MISSING_EXPRESSION_IN_THROW, _currentToken);
-      return new ThrowExpression(keyword, createSyntheticIdentifier());
+      return astFactory.throwExpression(keyword, createSyntheticIdentifier());
     }
     Expression expression = parseExpressionWithoutCascade();
-    return new ThrowExpression(keyword, expression);
+    return astFactory.throwExpression(keyword, expression);
   }
 
   /**
@@ -4787,7 +4969,7 @@
       TypeName exceptionType = null;
       if (_matchesString(_ON)) {
         onKeyword = getAndAdvance();
-        exceptionType = parseTypeName(false);
+        exceptionType = parseTypeAnnotation(false);
       }
       Token catchKeyword = null;
       Token leftParenthesis = null;
@@ -4806,7 +4988,7 @@
         rightParenthesis = _expect(TokenType.CLOSE_PAREN);
       }
       Block catchBody = _parseBlockChecked();
-      catchClauses.add(new CatchClause(
+      catchClauses.add(astFactory.catchClause(
           onKeyword,
           exceptionType,
           catchKeyword,
@@ -4824,7 +5006,7 @@
     } else if (catchClauses.isEmpty) {
       _reportErrorForCurrentToken(ParserErrorCode.MISSING_CATCH_OR_FINALLY);
     }
-    return new TryStatement(
+    return astFactory.tryStatement(
         tryKeyword, body, catchClauses, finallyKeyword, finallyClause);
   }
 
@@ -4836,16 +5018,10 @@
    *
    *     typeAlias ::=
    *         'typedef' typeAliasBody
+   *       | genericTypeAlias
    *
    *     typeAliasBody ::=
-   *         classTypeAlias
-   *       | functionTypeAlias
-   *
-   *     classTypeAlias ::=
-   *         identifier typeParameters? '=' 'abstract'? mixinApplication
-   *
-   *     mixinApplication ::=
-   *         qualified withClause implementsClause? ';'
+   *         functionTypeAlias
    *
    *     functionTypeAlias ::=
    *         functionPrefix typeParameterList? formalParameterList ';'
@@ -4861,16 +5037,12 @@
         next = _skipTypeParameterList(next);
         if (next != null && _tokenMatches(next, TokenType.EQ)) {
           TypeAlias typeAlias =
-              parseClassTypeAlias(commentAndMetadata, null, keyword);
-          _reportErrorForToken(
-              ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword);
+              parseGenericTypeAlias(commentAndMetadata, keyword);
           return typeAlias;
         }
       } else if (_tokenMatches(next, TokenType.EQ)) {
         TypeAlias typeAlias =
-            parseClassTypeAlias(commentAndMetadata, null, keyword);
-        _reportErrorForToken(
-            ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS, keyword);
+            parseGenericTypeAlias(commentAndMetadata, keyword);
         return typeAlias;
       }
     }
@@ -4878,6 +5050,34 @@
   }
 
   /**
+   * Parse a type.
+   *
+   *     type ::=
+   *         typeWithoutFunction
+   *       | functionType
+   */
+  TypeAnnotation parseTypeAnnotation(bool inExpression) {
+    if (parseGenericFunctionTypes) {
+      TypeAnnotation type = null;
+      if (_atGenericFunctionTypeAfterReturnType(_currentToken)) {
+        // Generic function type with no return type.
+        type = parseGenericFunctionTypeAfterReturnType(null);
+      } else if (_currentToken.keyword == Keyword.VOID &&
+          _atGenericFunctionTypeAfterReturnType(_currentToken.next)) {
+        type = astFactory.typeName(
+            astFactory.simpleIdentifier(getAndAdvance()), null);
+      } else {
+        type = parseTypeName(inExpression);
+      }
+      while (_atGenericFunctionTypeAfterReturnType(_currentToken)) {
+        type = parseGenericFunctionTypeAfterReturnType(type);
+      }
+      return type;
+    }
+    return parseTypeName(inExpression);
+  }
+
+  /**
    * Parse a list of type arguments. Return the type argument list that was
    * parsed.
    *
@@ -4891,12 +5091,14 @@
    */
   TypeArgumentList parseTypeArgumentList() {
     Token leftBracket = getAndAdvance();
-    List<TypeName> arguments = <TypeName>[parseTypeName(false)];
+    List<TypeAnnotation> arguments = <TypeAnnotation>[
+      parseTypeAnnotation(false)
+    ];
     while (_optional(TokenType.COMMA)) {
-      arguments.add(parseTypeName(false));
+      arguments.add(parseTypeAnnotation(false));
     }
     Token rightBracket = _expectGt();
-    return new TypeArgumentList(leftBracket, arguments, rightBracket);
+    return astFactory.typeArgumentList(leftBracket, arguments, rightBracket);
   }
 
   /**
@@ -4930,11 +5132,11 @@
     }
     if (_matchesKeyword(Keyword.EXTENDS)) {
       Token keyword = getAndAdvance();
-      TypeName bound = parseTypeName(false);
-      return new TypeParameter(commentAndMetadata.comment,
+      TypeAnnotation bound = parseTypeAnnotation(false);
+      return astFactory.typeParameter(commentAndMetadata.comment,
           commentAndMetadata.metadata, name, keyword, bound);
     }
-    return new TypeParameter(commentAndMetadata.comment,
+    return astFactory.typeParameter(commentAndMetadata.comment,
         commentAndMetadata.metadata, name, null, null);
   }
 
@@ -4954,7 +5156,8 @@
       typeParameters.add(parseTypeParameter());
     }
     Token rightBracket = _expectGt();
-    return new TypeParameterList(leftBracket, typeParameters, rightBracket);
+    return astFactory.typeParameterList(
+        leftBracket, typeParameters, rightBracket);
   }
 
   /**
@@ -4982,12 +5185,12 @@
           // --> "prefixOperator postfixExpression"
           // --> "prefixOperator primary                    selector*"
           // --> "prefixOperator 'super' assignableSelector selector*"
-          return new PrefixExpression(operator, parseUnaryExpression());
+          return astFactory.prefixExpression(operator, parseUnaryExpression());
         }
-        return new PrefixExpression(
-            operator, new SuperExpression(getAndAdvance()));
+        return astFactory.prefixExpression(
+            operator, astFactory.superExpression(getAndAdvance()));
       }
-      return new PrefixExpression(operator, parseUnaryExpression());
+      return astFactory.prefixExpression(operator, parseUnaryExpression());
     } else if (_currentToken.type.isIncrementOperator) {
       Token operator = getAndAdvance();
       if (_matchesKeyword(Keyword.SUPER)) {
@@ -4995,7 +5198,7 @@
         if (nextType == TokenType.OPEN_SQUARE_BRACKET ||
             nextType == TokenType.PERIOD) {
           // --> "prefixOperator 'super' assignableSelector selector*"
-          return new PrefixExpression(operator, parseUnaryExpression());
+          return astFactory.prefixExpression(operator, parseUnaryExpression());
         }
         //
         // Even though it is not valid to use an incrementing operator
@@ -5011,18 +5214,18 @@
           secondOperator.setNext(_currentToken);
           firstOperator.setNext(secondOperator);
           operator.previous.setNext(firstOperator);
-          return new PrefixExpression(
+          return astFactory.prefixExpression(
               firstOperator,
-              new PrefixExpression(
-                  secondOperator, new SuperExpression(getAndAdvance())));
+              astFactory.prefixExpression(
+                  secondOperator, astFactory.superExpression(getAndAdvance())));
         }
         // Invalid operator before 'super'
         _reportErrorForCurrentToken(
             ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, [operator.lexeme]);
-        return new PrefixExpression(
-            operator, new SuperExpression(getAndAdvance()));
+        return astFactory.prefixExpression(
+            operator, astFactory.superExpression(getAndAdvance()));
       }
-      return new PrefixExpression(
+      return astFactory.prefixExpression(
           operator, _parseAssignableExpressionNotStartingWithSuper(false));
     } else if (type == TokenType.PLUS) {
       _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER);
@@ -5057,7 +5260,7 @@
       equals = getAndAdvance();
       initializer = parseExpression2();
     }
-    return new VariableDeclaration(name, equals, initializer);
+    return astFactory.variableDeclaration(name, equals, initializer);
   }
 
   /**
@@ -5087,7 +5290,9 @@
    *         finalConstVarOrType variableDeclaration (',' variableDeclaration)*
    */
   VariableDeclarationList parseVariableDeclarationListAfterType(
-      CommentAndMetadata commentAndMetadata, Token keyword, TypeName type) {
+      CommentAndMetadata commentAndMetadata,
+      Token keyword,
+      TypeAnnotation type) {
     if (type != null &&
         keyword != null &&
         _tokenMatchesKeyword(keyword, Keyword.VAR)) {
@@ -5099,7 +5304,7 @@
     while (_optional(TokenType.COMMA)) {
       variables.add(parseVariableDeclaration());
     }
-    return new VariableDeclarationList(commentAndMetadata?.comment,
+    return astFactory.variableDeclarationList(commentAndMetadata?.comment,
         commentAndMetadata?.metadata, keyword, type, variables);
   }
 
@@ -5124,7 +5329,7 @@
 //          }
 //        }
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new VariableDeclarationStatement(variableList, semicolon);
+    return astFactory.variableDeclarationStatement(variableList, semicolon);
   }
 
   /**
@@ -5144,7 +5349,7 @@
       Expression condition = parseExpression2();
       Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
       Statement body = parseStatement2();
-      return new WhileStatement(
+      return astFactory.whileStatement(
           keyword, leftParenthesis, condition, rightParenthesis, body);
     } finally {
       _inLoop = wasInLoop;
@@ -5167,7 +5372,7 @@
       _mustNotBeNullable(typeName, ParserErrorCode.NULLABLE_TYPE_IN_WITH);
       types.add(typeName);
     } while (_optional(TokenType.COMMA));
-    return new WithClause(withKeyword, types);
+    return astFactory.withClause(withKeyword, types);
   }
 
   /**
@@ -5186,7 +5391,40 @@
     }
     Expression expression = parseExpression2();
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new YieldStatement(yieldToken, star, expression, semicolon);
+    return astFactory.yieldStatement(yieldToken, star, expression, semicolon);
+  }
+
+  /**
+   * Parse a formal parameter list, starting at the [startToken], without
+   * actually creating a formal parameter list or changing the current token.
+   * Return the token following the parameter list that was parsed, or `null`
+   * if the given token is not the first token in a valid parameter list.
+   *
+   * This method must be kept in sync with [parseFormalParameterList].
+   */
+  Token skipFormalParameterList(Token startToken) {
+    if (!_tokenMatches(startToken, TokenType.OPEN_PAREN)) {
+      return null;
+    }
+    return (startToken as BeginToken).endToken;
+  }
+
+  /**
+   * Parse the portion of a generic function type after the return type,
+   * starting at the [startToken], without actually creating a generic function
+   * type or changing the current token. Return the token following the generic
+   * function type that was parsed, or `null` if the given token is not the
+   * first token in a valid generic function type.
+   *
+   * This method must be kept in sync with
+   * [parseGenericFunctionTypeAfterReturnType].
+   */
+  Token skipGenericFunctionTypeAfterReturnType(Token startToken) {
+    Token next = startToken.next; // Skip 'Function'
+    if (_tokenMatches(next, TokenType.LT)) {
+      next = skipTypeParameterList(next);
+    }
+    return skipFormalParameterList(next);
   }
 
   /**
@@ -5237,7 +5475,7 @@
     if (_tokenMatchesKeyword(startToken, Keyword.VOID)) {
       return startToken.next;
     } else {
-      return skipTypeName(startToken);
+      return skipTypeAnnotation(startToken);
     }
   }
 
@@ -5289,6 +5527,33 @@
   }
 
   /**
+   * Parse a type annotation, starting at the [startToken], without actually
+   * creating a type annotation or changing the current token. Return the token
+   * following the type annotation that was parsed, or `null` if the given token
+   * is not the first token in a valid type annotation.
+   *
+   * This method must be kept in sync with [parseTypeAnnotation].
+   */
+  Token skipTypeAnnotation(Token startToken) {
+    if (parseGenericFunctionTypes) {
+      Token next = null;
+      if (_atGenericFunctionTypeAfterReturnType(startToken)) {
+        next = skipGenericFunctionTypeAfterReturnType(startToken);
+      } else if (_currentToken.keyword == Keyword.VOID &&
+          _atGenericFunctionTypeAfterReturnType(_currentToken.next)) {
+        next = next.next;
+      } else {
+        next = skipTypeName(startToken);
+      }
+      while (next != null && _tokenMatchesString(next, 'Function')) {
+        next = skipGenericFunctionTypeAfterReturnType(next);
+      }
+      return next;
+    }
+    return skipTypeName(startToken);
+  }
+
+  /**
    * Parse a list of type arguments, starting at the [startToken], without
    * actually creating a type argument list or changing the current token.
    * Return the token following the type argument list that was parsed, or
@@ -5358,6 +5623,36 @@
   }
 
   /**
+   * Parse a type parameter list, starting at the [startToken], without actually
+   * creating a type parameter list or changing the current token. Return the
+   * token following the type parameter list that was parsed, or `null` if the
+   * given token is not the first token in a valid type parameter list.
+   *
+   * This method must be kept in sync with [parseTypeParameterList].
+   */
+  Token skipTypeParameterList(Token startToken) {
+    if (!_tokenMatches(startToken, TokenType.LT)) {
+      return null;
+    }
+    int depth = 1;
+    Token previous = startToken;
+    Token next = startToken.next;
+    while (next != previous) {
+      if (_tokenMatches(startToken, TokenType.LT)) {
+        depth++;
+      } else if (_tokenMatches(next, TokenType.GT)) {
+        depth--;
+        if (depth == 0) {
+          return next;
+        }
+      }
+      previous = next;
+      next = next.next;
+    }
+    return null;
+  }
+
+  /**
    * Advance to the next token in the token stream.
    */
   void _advance() {
@@ -5387,6 +5682,22 @@
   }
 
   /**
+   * Return `true` if we are positioned at the keyword 'Function' in a generic
+   * function type alias.
+   */
+  bool _atGenericFunctionTypeAfterReturnType(Token startToken) {
+    if (_tokenMatchesString(startToken, 'Function')) {
+      Token next = startToken.next;
+      if (next != null &&
+          (_tokenMatches(next, TokenType.OPEN_PAREN) ||
+              _tokenMatches(next, TokenType.LT))) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  /**
    * Clone all token starting from the given [token] up to the end of the token
    * stream, and return the first token in the new token stream.
    */
@@ -5416,14 +5727,14 @@
    * captures the components of the given method declaration).
    */
   FunctionDeclaration _convertToFunctionDeclaration(MethodDeclaration method) =>
-      new FunctionDeclaration(
+      astFactory.functionDeclaration(
           method.documentationComment,
           method.metadata,
           method.externalKeyword,
           method.returnType,
           method.propertyKeyword,
           method.name,
-          new FunctionExpression(
+          astFactory.functionExpression(
               method.typeParameters, method.parameters, method.body));
 
   /**
@@ -5984,8 +6295,8 @@
         ParserErrorCode.EXPECTED_TOKEN, [TokenType.OPEN_PAREN.lexeme]);
     // Recovery: Look to see whether there is a close paren that isn't matched
     // to an open paren and if so parse the list of arguments as normal.
-    return new ArgumentList(_createSyntheticToken(TokenType.OPEN_PAREN), null,
-        _createSyntheticToken(TokenType.CLOSE_PAREN));
+    return astFactory.argumentList(_createSyntheticToken(TokenType.OPEN_PAREN),
+        null, _createSyntheticToken(TokenType.CLOSE_PAREN));
   }
 
   /**
@@ -6007,7 +6318,7 @@
       message = parseExpression2();
     }
     Token rightParen = _expect(TokenType.CLOSE_PAREN);
-    return new AssertInitializer(
+    return astFactory.assertInitializer(
         keyword, leftParen, expression, comma, message, rightParen);
   }
 
@@ -6032,24 +6343,24 @@
         ArgumentList argumentList = parseArgumentList();
         Expression currentExpression = expression;
         if (currentExpression is SimpleIdentifier) {
-          expression = new MethodInvocation(
+          expression = astFactory.methodInvocation(
               null, null, currentExpression, typeArguments, argumentList);
         } else if (currentExpression is PrefixedIdentifier) {
-          expression = new MethodInvocation(
+          expression = astFactory.methodInvocation(
               currentExpression.prefix,
               currentExpression.period,
               currentExpression.identifier,
               typeArguments,
               argumentList);
         } else if (currentExpression is PropertyAccess) {
-          expression = new MethodInvocation(
+          expression = astFactory.methodInvocation(
               currentExpression.target,
               currentExpression.operator,
               currentExpression.propertyName,
               typeArguments,
               argumentList);
         } else {
-          expression = new FunctionExpressionInvocation(
+          expression = astFactory.functionExpressionInvocation(
               expression, typeArguments, argumentList);
         }
         if (!primaryAllowed) {
@@ -6061,7 +6372,7 @@
       if (identical(selectorExpression, expression)) {
         if (!isOptional && (expression is PrefixedIdentifier)) {
           PrefixedIdentifier identifier = expression as PrefixedIdentifier;
-          expression = new PropertyAccess(
+          expression = astFactory.propertyAccess(
               identifier.prefix, identifier.period, identifier.identifier);
         }
         return expression;
@@ -6087,8 +6398,8 @@
         ParserErrorCode.EXPECTED_TOKEN, [TokenType.OPEN_CURLY_BRACKET.lexeme]);
     // Recovery: Check for an unmatched closing curly bracket and parse
     // statements until it is reached.
-    return new Block(_createSyntheticToken(TokenType.OPEN_CURLY_BRACKET), null,
-        _createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET));
+    return astFactory.block(_createSyntheticToken(TokenType.OPEN_CURLY_BRACKET),
+        null, _createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET));
   }
 
   /**
@@ -6180,7 +6491,7 @@
       }
       semicolon = _createSyntheticToken(TokenType.SEMICOLON);
     }
-    return new ClassTypeAlias(
+    return astFactory.classTypeAlias(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         classKeyword,
@@ -6258,7 +6569,7 @@
     if (_matches(TokenType.EQ)) {
       separator = getAndAdvance();
       redirectedConstructor = parseConstructorName();
-      body = new EmptyFunctionBody(_expect(TokenType.SEMICOLON));
+      body = astFactory.emptyFunctionBody(_expect(TokenType.SEMICOLON));
       if (factoryKeyword == null) {
         _reportErrorForNode(
             ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR,
@@ -6292,7 +6603,7 @@
         }
       }
     }
-    return new ConstructorDeclaration(
+    return astFactory.constructorDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         externalKeyword,
@@ -6334,7 +6645,7 @@
       _reportErrorForNode(ParserErrorCode.ANNOTATION_ON_ENUM_CONSTANT,
           commentAndMetadata.metadata[0]);
     }
-    return new EnumConstantDeclaration(
+    return astFactory.enumConstantDeclaration(
         commentAndMetadata.comment, commentAndMetadata.metadata, name);
   }
 
@@ -6342,10 +6653,10 @@
    * Parse a list of formal parameters given that the list starts with the given
    * [leftParenthesis]. Return the formal parameters that were parsed.
    */
-  FormalParameterList _parseFormalParameterListAfterParen(
-      Token leftParenthesis) {
+  FormalParameterList _parseFormalParameterListAfterParen(Token leftParenthesis,
+      {bool inFunctionType: false}) {
     if (_matches(TokenType.CLOSE_PAREN)) {
-      return new FormalParameterList(
+      return astFactory.formalParameterList(
           leftParenthesis, null, null, null, getAndAdvance());
     }
     //
@@ -6416,7 +6727,8 @@
       //
       // Parse and record the parameter.
       //
-      FormalParameter parameter = parseFormalParameter(kind);
+      FormalParameter parameter =
+          parseFormalParameter(kind, inFunctionType: inFunctionType);
       parameters.add(parameter);
       if (kind == ParameterKind.REQUIRED && wasOptionalParameter) {
         _reportErrorForNode(
@@ -6495,7 +6807,7 @@
     //
     leftSquareBracket ??= leftCurlyBracket;
     rightSquareBracket ??= rightCurlyBracket;
-    return new FormalParameterList(leftParenthesis, parameters,
+    return astFactory.formalParameterList(leftParenthesis, parameters,
         leftSquareBracket, rightSquareBracket, rightParenthesis);
   }
 
@@ -6505,8 +6817,10 @@
    *
    * This method assumes that the current token matches `TokenType.OPEN_PAREN`.
    */
-  FormalParameterList _parseFormalParameterListUnchecked() {
-    return _parseFormalParameterListAfterParen(getAndAdvance());
+  FormalParameterList _parseFormalParameterListUnchecked(
+      {bool inFunctionType: false}) {
+    return _parseFormalParameterListAfterParen(getAndAdvance(),
+        inFunctionType: inFunctionType);
   }
 
   /**
@@ -6519,7 +6833,7 @@
    *         functionSignature functionBody
    */
   Statement _parseFunctionDeclarationStatementAfterReturnType(
-      CommentAndMetadata commentAndMetadata, TypeName returnType) {
+      CommentAndMetadata commentAndMetadata, TypeAnnotation returnType) {
     FunctionDeclaration declaration =
         parseFunctionDeclaration(commentAndMetadata, null, returnType);
     Token propertyKeyword = declaration.propertyKeyword;
@@ -6532,7 +6846,7 @@
             ParserErrorCode.SETTER_IN_FUNCTION, propertyKeyword);
       }
     }
-    return new FunctionDeclarationStatement(declaration);
+    return astFactory.functionDeclarationStatement(declaration);
   }
 
   /**
@@ -6548,9 +6862,9 @@
    */
   FunctionTypeAlias _parseFunctionTypeAlias(
       CommentAndMetadata commentAndMetadata, Token keyword) {
-    TypeName returnType = null;
+    TypeAnnotation returnType = null;
     if (hasReturnTypeInTypeAlias) {
-      returnType = parseReturnType();
+      returnType = parseReturnType(false);
     }
     SimpleIdentifier name = parseSimpleIdentifier(isDeclaration: true);
     TypeParameterList typeParameters = null;
@@ -6560,14 +6874,14 @@
     TokenType type = _currentToken.type;
     if (type == TokenType.SEMICOLON || type == TokenType.EOF) {
       _reportErrorForCurrentToken(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS);
-      FormalParameterList parameters = new FormalParameterList(
+      FormalParameterList parameters = astFactory.formalParameterList(
           _createSyntheticToken(TokenType.OPEN_PAREN),
           null,
           null,
           null,
           _createSyntheticToken(TokenType.CLOSE_PAREN));
       Token semicolon = _expect(TokenType.SEMICOLON);
-      return new FunctionTypeAlias(
+      return astFactory.functionTypeAlias(
           commentAndMetadata.comment,
           commentAndMetadata.metadata,
           keyword,
@@ -6580,7 +6894,7 @@
       FormalParameterList parameters = _parseFormalParameterListUnchecked();
       _validateFormalParameterList(parameters);
       Token semicolon = _expect(TokenType.SEMICOLON);
-      return new FunctionTypeAlias(
+      return astFactory.functionTypeAlias(
           commentAndMetadata.comment,
           commentAndMetadata.metadata,
           keyword,
@@ -6594,15 +6908,19 @@
       // Recovery: At the very least we should skip to the start of the next
       // valid compilation unit member, allowing for the possibility of finding
       // the typedef parameters before that point.
-      return new FunctionTypeAlias(
+      return astFactory.functionTypeAlias(
           commentAndMetadata.comment,
           commentAndMetadata.metadata,
           keyword,
           returnType,
           name,
           typeParameters,
-          new FormalParameterList(_createSyntheticToken(TokenType.OPEN_PAREN),
-              null, null, null, _createSyntheticToken(TokenType.CLOSE_PAREN)),
+          astFactory.formalParameterList(
+              _createSyntheticToken(TokenType.OPEN_PAREN),
+              null,
+              null,
+              null,
+              _createSyntheticToken(TokenType.CLOSE_PAREN)),
           _createSyntheticToken(TokenType.SEMICOLON));
     }
   }
@@ -6658,8 +6976,8 @@
     } else {
       _reportErrorForToken(missingNameError, missingNameToken);
     }
-    return new LibraryIdentifier(
-        <SimpleIdentifier>[createSyntheticIdentifier()]);
+    return astFactory
+        .libraryIdentifier(<SimpleIdentifier>[createSyntheticIdentifier()]);
   }
 
   /**
@@ -6679,7 +6997,7 @@
       CommentAndMetadata commentAndMetadata,
       Token externalKeyword,
       Token staticKeyword,
-      TypeName returnType,
+      TypeAnnotation returnType,
       SimpleIdentifier name,
       TypeParameterList typeParameters,
       FormalParameterList parameters) {
@@ -6696,7 +7014,7 @@
         _reportErrorForNode(ParserErrorCode.ABSTRACT_STATIC_METHOD, body);
       }
     }
-    return new MethodDeclaration(
+    return astFactory.methodDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         externalKeyword,
@@ -6726,7 +7044,7 @@
       CommentAndMetadata commentAndMetadata,
       Token externalKeyword,
       Token staticKeyword,
-      TypeName returnType) {
+      TypeAnnotation returnType) {
     SimpleIdentifier methodName = parseSimpleIdentifier(isDeclaration: true);
     TypeParameterList typeParameters = _parseGenericMethodTypeParameters();
     FormalParameterList parameters;
@@ -6737,7 +7055,7 @@
         (type == TokenType.OPEN_CURLY_BRACKET || type == TokenType.FUNCTION)) {
       _reportErrorForToken(
           ParserErrorCode.MISSING_METHOD_PARAMETERS, _currentToken.previous);
-      parameters = new FormalParameterList(
+      parameters = astFactory.formalParameterList(
           _createSyntheticToken(TokenType.OPEN_PAREN),
           null,
           null,
@@ -6768,7 +7086,7 @@
   NativeClause _parseNativeClause() {
     Token keyword = getAndAdvance();
     StringLiteral name = parseStringLiteral();
-    return new NativeClause(keyword, name);
+    return astFactory.nativeClause(keyword, name);
   }
 
   /**
@@ -6788,14 +7106,14 @@
   MethodDeclaration _parseOperatorAfterKeyword(
       CommentAndMetadata commentAndMetadata,
       Token externalKeyword,
-      TypeName returnType,
+      TypeAnnotation returnType,
       Token operatorKeyword) {
     if (!_currentToken.isUserDefinableOperator) {
       _reportErrorForCurrentToken(
           ParserErrorCode.NON_USER_DEFINABLE_OPERATOR, [_currentToken.lexeme]);
     }
     SimpleIdentifier name =
-        new SimpleIdentifier(getAndAdvance(), isDeclaration: true);
+        astFactory.simpleIdentifier(getAndAdvance(), isDeclaration: true);
     if (_matches(TokenType.EQ)) {
       Token previous = _currentToken.previous;
       if ((_tokenMatches(previous, TokenType.EQ_EQ) ||
@@ -6813,7 +7131,7 @@
     if (externalKeyword != null && body is! EmptyFunctionBody) {
       _reportErrorForCurrentToken(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY);
     }
-    return new MethodDeclaration(
+    return astFactory.methodDeclaration(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         externalKeyword,
@@ -6831,14 +7149,15 @@
    * Parse a return type if one is given, otherwise return `null` without
    * advancing. Return the return type that was parsed.
    */
-  TypeName _parseOptionalReturnType() {
+  TypeAnnotation _parseOptionalReturnType() {
     TypeName typeComment = _parseOptionalTypeNameComment();
     if (typeComment != null) {
       return typeComment;
     }
     Keyword keyword = _currentToken.keyword;
     if (keyword == Keyword.VOID) {
-      return new TypeName(new SimpleIdentifier(getAndAdvance()), null);
+      return astFactory.typeName(
+          astFactory.simpleIdentifier(getAndAdvance()), null);
     } else if (_matchesIdentifier()) {
       Token next = _peek();
       if (keyword != Keyword.GET &&
@@ -6854,7 +7173,7 @@
           // type.
           return null;
         }
-        return parseReturnType();
+        return parseReturnType(false);
       }
       Token next2 = next.next;
       Token next3 = next2.next;
@@ -6862,7 +7181,7 @@
           _tokenMatchesIdentifier(next2) &&
           (_tokenMatchesIdentifier(next3) ||
               _tokenMatches(next3, TokenType.LT))) {
-        return parseReturnType();
+        return parseReturnType(false);
       }
     }
     return null;
@@ -6900,7 +7219,7 @@
     Token partKeyword = getAndAdvance();
     StringLiteral partUri = _parseUri();
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new PartDirective(commentAndMetadata.comment,
+    return astFactory.partDirective(commentAndMetadata.comment,
         commentAndMetadata.metadata, partKeyword, partUri, semicolon);
   }
 
@@ -6921,7 +7240,7 @@
     if (enableUriInPartOf && _matches(TokenType.STRING)) {
       StringLiteral libraryUri = _parseUri();
       Token semicolon = _expect(TokenType.SEMICOLON);
-      return new PartOfDirective(
+      return astFactory.partOfDirective(
           commentAndMetadata.comment,
           commentAndMetadata.metadata,
           partKeyword,
@@ -6933,7 +7252,7 @@
     LibraryIdentifier libraryName = _parseLibraryName(
         ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE, ofKeyword);
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new PartOfDirective(
+    return astFactory.partOfDirective(
         commentAndMetadata.comment,
         commentAndMetadata.metadata,
         partKeyword,
@@ -6957,7 +7276,7 @@
     }
     Token period = getAndAdvance();
     SimpleIdentifier qualified = parseSimpleIdentifier();
-    return new PrefixedIdentifier(qualifier, period, qualified);
+    return astFactory.prefixedIdentifier(qualifier, period, qualified);
   }
 
   /**
@@ -6990,7 +7309,8 @@
       _reportErrorForCurrentToken(
           ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER);
     }
-    return new SimpleIdentifier(getAndAdvance(), isDeclaration: isDeclaration);
+    return astFactory.simpleIdentifier(getAndAdvance(),
+        isDeclaration: isDeclaration);
   }
 
   /**
@@ -7029,7 +7349,7 @@
    */
   StringInterpolation _parseStringInterpolation(Token string) {
     List<InterpolationElement> elements = <InterpolationElement>[
-      new InterpolationString(
+      astFactory.interpolationString(
           string, computeStringValue(string.lexeme, true, false))
     ];
     bool hasMore = true;
@@ -7042,8 +7362,8 @@
         try {
           Expression expression = parseExpression2();
           Token rightBracket = _expect(TokenType.CLOSE_CURLY_BRACKET);
-          elements.add(
-              new InterpolationExpression(openToken, expression, rightBracket));
+          elements.add(astFactory.interpolationExpression(
+              openToken, expression, rightBracket));
         } finally {
           _inInitializer = wasInInitializer;
         }
@@ -7051,24 +7371,25 @@
         Token openToken = getAndAdvance();
         Expression expression = null;
         if (_matchesKeyword(Keyword.THIS)) {
-          expression = new ThisExpression(getAndAdvance());
+          expression = astFactory.thisExpression(getAndAdvance());
         } else {
           expression = parseSimpleIdentifier();
         }
-        elements.add(new InterpolationExpression(openToken, expression, null));
+        elements.add(
+            astFactory.interpolationExpression(openToken, expression, null));
       }
       if (_matches(TokenType.STRING)) {
         string = getAndAdvance();
         isExpression = _matches(TokenType.STRING_INTERPOLATION_EXPRESSION);
         hasMore =
             isExpression || _matches(TokenType.STRING_INTERPOLATION_IDENTIFIER);
-        elements.add(new InterpolationString(
+        elements.add(astFactory.interpolationString(
             string, computeStringValue(string.lexeme, false, !hasMore)));
       } else {
         hasMore = false;
       }
     }
-    return new StringInterpolation(elements);
+    return astFactory.stringInterpolation(elements);
   }
 
   /**
@@ -7088,11 +7409,30 @@
           _matches(TokenType.STRING_INTERPOLATION_IDENTIFIER)) {
         strings.add(_parseStringInterpolation(string));
       } else {
-        strings.add(new SimpleStringLiteral(
+        strings.add(astFactory.simpleStringLiteral(
             string, computeStringValue(string.lexeme, true, true)));
       }
     } while (_matches(TokenType.STRING));
-    return strings.length == 1 ? strings[0] : new AdjacentStrings(strings);
+    return strings.length == 1
+        ? strings[0]
+        : astFactory.adjacentStrings(strings);
+  }
+
+  /**
+   * Parse a type annotation, possibly superseded by a type name in a comment.
+   * Return the type name that was parsed.
+   *
+   * This method assumes that the current token is an identifier.
+   *
+   *     type ::=
+   *         qualified typeArguments?
+   */
+  TypeAnnotation _parseTypeAnnotationAfterIdentifier() {
+    TypeAnnotation type = parseTypeAnnotation(false);
+    // If this is followed by a generic method type comment, allow the comment
+    // type to replace the real type name.
+    TypeName typeFromComment = _parseOptionalTypeNameComment();
+    return typeFromComment ?? type;
   }
 
   TypeName _parseTypeName(bool inExpression) {
@@ -7101,7 +7441,7 @@
       typeName = _parsePrefixedIdentifierUnchecked();
     } else if (_matchesKeyword(Keyword.VAR)) {
       _reportErrorForCurrentToken(ParserErrorCode.VAR_AS_TYPE_NAME);
-      typeName = new SimpleIdentifier(getAndAdvance());
+      typeName = astFactory.simpleIdentifier(getAndAdvance());
     } else {
       typeName = createSyntheticIdentifier();
       _reportErrorForCurrentToken(ParserErrorCode.EXPECTED_TYPE_NAME);
@@ -7113,26 +7453,7 @@
         question = getAndAdvance();
       }
     }
-    return new TypeName(typeName, typeArguments, question: question);
-  }
-
-  /**
-   * Parse a type name. Return the type name that was parsed.
-   *
-   * This method assumes that the current token is an identifier.
-   *
-   *     type ::=
-   *         qualified typeArguments?
-   */
-  TypeName _parseTypeNameAfterIdentifier() {
-    Identifier typeName = _parsePrefixedIdentifierUnchecked();
-    TypeArgumentList typeArguments = _parseOptionalTypeArguments();
-    // If this is followed by a generic method type comment, allow the comment
-    // type to replace the real type name.
-    // TODO(jmesserly): this feels like a big hammer. Can we restrict it to
-    // only work inside generic methods?
-    TypeName typeFromComment = _parseOptionalTypeNameComment();
-    return typeFromComment ?? new TypeName(typeName, typeArguments);
+    return astFactory.typeName(typeName, typeArguments, question: question);
   }
 
   /**
@@ -7189,7 +7510,7 @@
         _reportErrorForToken(
             ParserErrorCode.NON_STRING_LITERAL_AS_URI, newToken);
         _currentToken = endToken.next;
-        return new SimpleStringLiteral(newToken, value);
+        return astFactory.simpleStringLiteral(newToken, value);
       }
     }
     return parseStringLiteral();
@@ -7212,7 +7533,7 @@
         parseVariableDeclarationListAfterType(
             commentAndMetadata, keyword, type);
     Token semicolon = _expect(TokenType.SEMICOLON);
-    return new VariableDeclarationStatement(variableList, semicolon);
+    return astFactory.variableDeclarationStatement(variableList, semicolon);
   }
 
   /**
@@ -7869,6 +8190,10 @@
       _reportErrorForToken(
           ParserErrorCode.ABSTRACT_CLASS_MEMBER, modifiers.abstractKeyword);
     }
+    if (modifiers.covariantKeyword != null) {
+      _reportErrorForToken(
+          ParserErrorCode.COVARIANT_CONSTRUCTOR, modifiers.covariantKeyword);
+    }
     if (modifiers.finalKeyword != null) {
       _reportErrorForToken(
           ParserErrorCode.FINAL_CONSTRUCTOR, modifiers.finalKeyword);
@@ -7941,10 +8266,15 @@
           ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword);
     }
     Token staticKeyword = modifiers.staticKeyword;
+    Token covariantKeyword = modifiers.covariantKeyword;
     Token constKeyword = modifiers.constKeyword;
     Token finalKeyword = modifiers.finalKeyword;
     Token varKeyword = modifiers.varKeyword;
     if (constKeyword != null) {
+      if (covariantKeyword != null) {
+        _reportErrorForToken(
+            ParserErrorCode.CONST_AND_COVARIANT, covariantKeyword);
+      }
       if (finalKeyword != null) {
         _reportErrorForToken(ParserErrorCode.CONST_AND_FINAL, finalKeyword);
       }
@@ -7955,16 +8285,28 @@
         _reportErrorForToken(ParserErrorCode.STATIC_AFTER_CONST, staticKeyword);
       }
     } else if (finalKeyword != null) {
+      if (covariantKeyword != null) {
+        _reportErrorForToken(
+            ParserErrorCode.FINAL_AND_COVARIANT, covariantKeyword);
+      }
       if (varKeyword != null) {
         _reportErrorForToken(ParserErrorCode.FINAL_AND_VAR, varKeyword);
       }
       if (staticKeyword != null && finalKeyword.offset < staticKeyword.offset) {
         _reportErrorForToken(ParserErrorCode.STATIC_AFTER_FINAL, staticKeyword);
       }
-    } else if (varKeyword != null &&
-        staticKeyword != null &&
-        varKeyword.offset < staticKeyword.offset) {
-      _reportErrorForToken(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword);
+    } else if (varKeyword != null) {
+      if (staticKeyword != null && varKeyword.offset < staticKeyword.offset) {
+        _reportErrorForToken(ParserErrorCode.STATIC_AFTER_VAR, staticKeyword);
+      }
+      if (covariantKeyword != null &&
+          varKeyword.offset < covariantKeyword.offset) {
+        _reportErrorForToken(
+            ParserErrorCode.COVARIANT_AFTER_VAR, covariantKeyword);
+      }
+    }
+    if (covariantKeyword != null && staticKeyword != null) {
+      _reportErrorForToken(ParserErrorCode.COVARIANT_AND_STATIC, staticKeyword);
     }
     return Token.lexicallyFirst([constKeyword, finalKeyword, varKeyword]);
   }
@@ -7998,6 +8340,10 @@
       _reportErrorForToken(
           ParserErrorCode.CONST_METHOD, modifiers.constKeyword);
     }
+    if (modifiers.covariantKeyword != null) {
+      _reportErrorForToken(
+          ParserErrorCode.COVARIANT_MEMBER, modifiers.covariantKeyword);
+    }
     if (modifiers.factoryKeyword != null) {
       _reportErrorForToken(
           ParserErrorCode.NON_CONSTRUCTOR_FACTORY, modifiers.factoryKeyword);
@@ -8055,6 +8401,10 @@
    * declaration.
    */
   void _validateModifiersForTopLevelDeclaration(Modifiers modifiers) {
+    if (modifiers.covariantKeyword != null) {
+      _reportErrorForToken(ParserErrorCode.COVARIANT_TOP_LEVEL_DECLARATION,
+          modifiers.covariantKeyword);
+    }
     if (modifiers.factoryKeyword != null) {
       _reportErrorForToken(ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION,
           modifiers.factoryKeyword);
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index df3ad03..56e59c5 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -7,6 +7,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -99,13 +100,13 @@
       {TypeSystem typeSystem})
       : _nullType = typeProvider.nullType,
         _futureNullType = typeProvider.futureNullType,
-        _typeSystem = typeSystem ?? new TypeSystemImpl() {
+        _typeSystem = typeSystem ?? new TypeSystemImpl(typeProvider) {
     inDeprecatedMember = _currentLibrary.isDeprecated;
   }
 
   @override
   Object visitAnnotation(Annotation node) {
-    if (node.elementAnnotation?.isFactory == true) {
+    if (resolutionMap.elementAnnotationForAnnotation(node)?.isFactory == true) {
       AstNode parent = node.parent;
       if (parent is MethodDeclaration) {
         _checkForInvalidFactory(parent);
@@ -193,7 +194,7 @@
 
   @override
   Object visitConstructorDeclaration(ConstructorDeclaration node) {
-    if (node.element.isFactory) {
+    if (resolutionMap.elementDeclaredByConstructorDeclaration(node).isFactory) {
       if (node.body is BlockFunctionBody) {
         // Check the block for a return statement, if not, create the hint.
         if (!ExitDetector.exits(node.body)) {
@@ -371,13 +372,13 @@
    */
   bool _checkAllTypeChecks(IsExpression node) {
     Expression expression = node.expression;
-    TypeName typeName = node.type;
+    TypeAnnotation typeName = node.type;
     DartType lhsType = expression.staticType;
     DartType rhsType = typeName.type;
     if (lhsType == null || rhsType == null) {
       return false;
     }
-    String rhsNameStr = typeName.name.name;
+    String rhsNameStr = typeName is TypeName ? typeName.name.name : null;
     // if x is dynamic
     if (rhsType.isDynamic && rhsNameStr == Keyword.DYNAMIC.syntax) {
       if (node.notOperator == null) {
@@ -648,7 +649,7 @@
           node is MethodInvocation &&
           node.staticInvokeType is InterfaceType) {
         displayName =
-            "${node.staticInvokeType.displayName}.${element.displayName}";
+            "${resolutionMap.staticInvokeTypeForInvocationExpression(node).displayName}.${element.displayName}";
       }
       _errorReporter.reportErrorForNode(
           HintCode.DEPRECATED_MEMBER_USE, node, [displayName]);
@@ -883,7 +884,7 @@
    * @return `true` if and only if a hint code is generated on the passed node
    * See [HintCode.MISSING_RETURN].
    */
-  void _checkForMissingReturn(TypeName returnType, FunctionBody body) {
+  void _checkForMissingReturn(TypeAnnotation returnType, FunctionBody body) {
     // Check that the method or function has a return type, and a function body
     if (returnType == null || body == null) {
       return;
@@ -899,11 +900,21 @@
       if (returnTypeType == null || returnTypeType.isVoid) {
         return;
       }
-      // For async, give no hint if Future<Null> is assignable to the return
-      // type.
-      if (body.isAsynchronous &&
-          _typeSystem.isAssignableTo(_futureNullType, returnTypeType)) {
-        return;
+      // For async, give no hint if the return type does not matter, i.e.
+      // dynamic, Future<Null> or Future<dynamic>.
+      if (body.isAsynchronous) {
+        if (returnTypeType.isDynamic) {
+          return;
+        }
+        if (returnTypeType is InterfaceType &&
+            returnTypeType.isDartAsyncFuture) {
+          DartType futureArgument = returnTypeType.typeArguments[0];
+          if (futureArgument.isDynamic ||
+              futureArgument.isDartCoreNull ||
+              futureArgument.isObject) {
+            return;
+          }
+        }
       }
       // Check the block for a return statement, if not, create the hint
       if (!ExitDetector.exits(body)) {
@@ -1846,8 +1857,7 @@
    * [HintCode.IS_NOT_INT].
    */
   bool _checkForIsDoubleHints(IsExpression node) {
-    TypeName typeName = node.type;
-    DartType type = typeName.type;
+    DartType type = node.type.type;
     Element element = type?.element;
     if (element != null) {
       String typeNameStr = element.name;
@@ -1897,7 +1907,7 @@
    * @param errorReporter the error reporter
    */
   DeadCodeVerifier(this._errorReporter, {TypeSystem typeSystem})
-      : this._typeSystem = typeSystem ?? new TypeSystemImpl();
+      : this._typeSystem = typeSystem ?? new TypeSystemImpl(null);
 
   @override
   Object visitBinaryExpression(BinaryExpression node) {
@@ -2283,11 +2293,20 @@
  * by a [DirectiveElementBuilder].
  */
 class DirectiveResolver extends SimpleAstVisitor {
+  final Map<Source, int> sourceModificationTimeMap;
+  final Map<Source, SourceKind> importSourceKindMap;
+  final Map<Source, SourceKind> exportSourceKindMap;
+  final List<AnalysisError> errors = <AnalysisError>[];
+
   LibraryElement _enclosingLibrary;
 
+  DirectiveResolver(this.sourceModificationTimeMap, this.importSourceKindMap,
+      this.exportSourceKindMap);
+
   @override
   void visitCompilationUnit(CompilationUnit node) {
-    _enclosingLibrary = node.element.library;
+    _enclosingLibrary =
+        resolutionMap.elementDeclaredByCompilationUnit(node).library;
     for (Directive directive in node.directives) {
       directive.accept(this);
     }
@@ -2300,6 +2319,19 @@
     for (ExportElement element in _enclosingLibrary.exports) {
       if (element.nameOffset == nodeOffset) {
         node.element = element;
+        // Verify the exported source kind.
+        Source exportedSource = element.exportedLibrary.source;
+        int exportedTime = sourceModificationTimeMap[exportedSource] ?? -1;
+        if (exportedTime >= 0 &&
+            exportSourceKindMap[exportedSource] != SourceKind.LIBRARY) {
+          StringLiteral uriLiteral = node.uri;
+          errors.add(new AnalysisError(
+              _enclosingLibrary.source,
+              uriLiteral.offset,
+              uriLiteral.length,
+              CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY,
+              [uriLiteral.toSource()]));
+        }
         break;
       }
     }
@@ -2312,6 +2344,22 @@
     for (ImportElement element in _enclosingLibrary.imports) {
       if (element.nameOffset == nodeOffset) {
         node.element = element;
+        // Verify the imported source kind.
+        Source importedSource = element.importedLibrary.source;
+        int importedTime = sourceModificationTimeMap[importedSource] ?? -1;
+        if (importedTime >= 0 &&
+            importSourceKindMap[importedSource] != SourceKind.LIBRARY) {
+          StringLiteral uriLiteral = node.uri;
+          ErrorCode errorCode = element.isDeferred
+              ? StaticWarningCode.IMPORT_OF_NON_LIBRARY
+              : CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY;
+          errors.add(new AnalysisError(
+              _enclosingLibrary.source,
+              uriLiteral.offset,
+              uriLiteral.length,
+              errorCode,
+              [uriLiteral.toSource()]));
+        }
         break;
       }
     }
@@ -3018,6 +3066,9 @@
   }
 
   @override
+  bool visitGenericFunctionType(GenericFunctionType node) => false;
+
+  @override
   bool visitIdentifier(Identifier node) => false;
 
   @override
@@ -3594,7 +3645,9 @@
   GatherUsedLocalElementsVisitor _usedLocalElementsVisitor;
 
   HintGenerator(this._compilationUnits, this._context, this._errorListener) {
-    _library = _compilationUnits[0].element.library;
+    _library = resolutionMap
+        .elementDeclaredByCompilationUnit(_compilationUnits[0])
+        .library;
     _usedImportedElementsVisitor =
         new GatherUsedImportedElementsVisitor(_library);
     _enableDart2JSHints = _context.analysisOptions.dart2jsHint;
@@ -3614,8 +3667,9 @@
         }
       }
       CompilationUnit definingUnit = _compilationUnits[0];
-      ErrorReporter definingUnitErrorReporter =
-          new ErrorReporter(_errorListener, definingUnit.element.source);
+      ErrorReporter definingUnitErrorReporter = new ErrorReporter(
+          _errorListener,
+          resolutionMap.elementDeclaredByCompilationUnit(definingUnit).source);
       {
         ImportsVerifier importsVerifier = new ImportsVerifier();
         importsVerifier.addImports(definingUnit);
@@ -4109,7 +4163,7 @@
     }
 
     DartType inferred = _inferredReturn.last;
-    inferred = _typeSystem.getLeastUpperBound(_typeProvider, type, inferred);
+    inferred = _typeSystem.getLeastUpperBound(type, inferred);
     _inferredReturn[_inferredReturn.length - 1] = inferred;
   }
 
@@ -4135,17 +4189,8 @@
     if (_returnStack.isNotEmpty && _inferredReturn.isNotEmpty) {
       DartType context = _returnStack.removeLast() ?? DynamicTypeImpl.instance;
       DartType inferred = _inferredReturn.removeLast();
-      if (inferred.isBottom) {
-        return;
-      }
 
-      if (context is FutureUnionType) {
-        // Try and match the Future type first.
-        if (_typeSystem.isSubtypeOf(inferred, context.futureOfType) ||
-            _typeSystem.isSubtypeOf(inferred, context.type)) {
-          setType(node, inferred);
-        }
-      } else if (_typeSystem.isSubtypeOf(inferred, context)) {
+      if (_typeSystem.isSubtypeOf(inferred, context)) {
         setType(node, inferred);
       }
     } else {
@@ -4158,7 +4203,7 @@
    */
   void pushReturnContext(BlockFunctionBody node) {
     _returnStack.add(getContext(node));
-    _inferredReturn.add(BottomTypeImpl.instance);
+    _inferredReturn.add(_typeProvider.nullType);
   }
 
   /**
@@ -4308,17 +4353,17 @@
   static DartType getContext(AstNode node) => node?.getProperty(_typeProperty);
 
   /**
-   * Look for a single contextual type attached to [node], and returns the type
-   * if found, otherwise null.
-   *
-   * If [node] has a contextual union type like `T | Future<T>` this will
-   * simplify it to only return `T`. If the caller can handle a union type,
-   * [getContext] should be used instead.
-   */
+    * Look for a single contextual type attached to [node], and returns the type
+    * if found, otherwise null.
+    *
+    * If [node] has a contextual union type like `T | Future<T>` this will
+    * simplify it to only return `T`. If the caller can handle a union type,
+    * [getContext] should be used instead.
+    */
   static DartType getType(AstNode node) {
     DartType t = getContext(node);
-    if (t is FutureUnionType) {
-      return t.type;
+    if (t is InterfaceType && t.isDartAsyncFutureOr) {
+      return t.typeArguments[0]; // The T in FutureOr<T>
     }
     return t;
   }
@@ -4326,15 +4371,19 @@
   /**
    * Like [getContext] but expands a union type into a list of types.
    */
-  static Iterable<DartType> getTypes(AstNode node) {
+  Iterable<DartType> getTypes(AstNode node) {
     DartType t = getContext(node);
     if (t == null) {
       return DartType.EMPTY_LIST;
     }
-    if (t is FutureUnionType) {
-      return t.types;
+    if (t is InterfaceType && t.isDartAsyncFutureOr) {
+      var tArg = t.typeArguments[0]; // The T in FutureOr<T>
+      return [
+        _typeProvider.futureType.instantiate([tArg]),
+        tArg
+      ];
     }
-    return <DartType>[t];
+    return [t];
   }
 
   /**
@@ -5170,6 +5219,7 @@
    * If so we will apply special typing rules in strong mode, to handle the
    * implicit union of `S | Future<S>`
    */
+  // TODO(leafp): Eliminate this when code is switched to using FutureOr
   bool isFutureThen(Element element) {
     // If we are a method named then
     if (element is MethodElement && element.name == 'then') {
@@ -5183,6 +5233,7 @@
   /**
    * Returns true if this type is any subtype of the built in Future type.
    */
+  // TODO(leafp): Eliminate this when code is switched to using FutureOr
   bool isSubtypeOfFuture(DartType type) =>
       typeSystem.isSubtypeOf(type, typeProvider.futureDynamicType);
 
@@ -5278,7 +5329,9 @@
       return null;
     }
 
-    if (potentialType == null || potentialType.isBottom) {
+    if (potentialType == null ||
+        potentialType.isBottom ||
+        potentialType.isDartCoreNull) {
       return null;
     }
     DartType currentType = _overrideManager.getBestType(element);
@@ -5336,7 +5389,11 @@
   void recordPropagatedTypeIfBetter(Expression expression, DartType type,
       [bool hasOldPropagatedType = false]) {
     // Ensure that propagated type invalid.
-    if (strongMode || type == null || type.isDynamic || type.isBottom) {
+    if (strongMode ||
+        type == null ||
+        type.isBottom ||
+        type.isDynamic ||
+        type.isDartCoreNull) {
       if (!hasOldPropagatedType) {
         expression.propagatedType = null;
       }
@@ -5476,8 +5533,7 @@
   Object visitAwaitExpression(AwaitExpression node) {
     DartType contextType = InferenceContext.getContext(node);
     if (contextType != null) {
-      var futureUnion =
-          FutureUnionType.from(contextType, typeProvider, typeSystem);
+      var futureUnion = _createFutureOr(contextType);
       InferenceContext.setType(node.expression, futureUnion);
     }
     return super.visitAwaitExpression(node);
@@ -5788,7 +5844,8 @@
 
   @override
   Object visitDefaultFormalParameter(DefaultFormalParameter node) {
-    InferenceContext.setType(node.defaultValue, node.parameter.element?.type);
+    InferenceContext.setType(node.defaultValue,
+        resolutionMap.elementDeclaredByFormalParameter(node.parameter)?.type);
     super.visitDefaultFormalParameter(node);
     ParameterElement element = node.element;
     if (element.initializer != null && node.defaultValue != null) {
@@ -5907,7 +5964,9 @@
           ? typeProvider.iterableType
           : typeProvider.streamType;
       InferenceContext.setType(
-          iterable, targetType.instantiate([loopVariable.type.type]));
+          iterable,
+          targetType
+              .instantiate([resolutionMap.typeForTypeName(loopVariable.type)]));
     }
     iterable?.accept(this);
     loopVariable?.accept(this);
@@ -6015,26 +6074,26 @@
               matchFunctionTypeParameters(node.typeParameters, functionType);
           if (functionType is FunctionType) {
             _inferFormalParameterList(node.parameters, functionType);
-
             DartType returnType;
-            if (isFutureThen(node.staticParameterElement?.enclosingElement)) {
+            ParameterElement parameterElement =
+                resolutionMap.staticParameterElementForExpression(node);
+            if (isFutureThen(parameterElement?.enclosingElement)) {
               var futureThenType =
                   InferenceContext.getContext(node.parent) as FunctionType;
 
-              // Pretend the return type of Future<T>.then<S> first parameter is
-              //
-              //     T -> (S | Future<S>)
-              //
-              // We can't represent this in Dart so we populate it here during
-              // inference.
-              var typeParamS =
-                  futureThenType.returnType.flattenFutures(typeSystem);
-              returnType =
-                  FutureUnionType.from(typeParamS, typeProvider, typeSystem);
-            } else {
-              returnType = _computeReturnOrYieldType(functionType.returnType);
+              // TODO(leafp): Get rid of this once code has been updated to use
+              // FutureOr
+              // Introduce FutureOr<T> for backwards compatibility if it was
+              // missing in old code.
+              if (futureThenType.parameters.isNotEmpty) {
+                if (!futureThenType.parameters[0].type.isDartAsyncFutureOr) {
+                  var typeParamS =
+                      futureThenType.returnType.flattenFutures(typeSystem);
+                  returnType = _createFutureOr(typeParamS);
+                }
+              }
             }
-
+            returnType ??= _computeReturnOrYieldType(functionType.returnType);
             InferenceContext.setType(node.body, returnType);
           }
         }
@@ -6082,6 +6141,9 @@
   }
 
   @override
+  Object visitGenericFunctionType(GenericFunctionType node) => null;
+
+  @override
   Object visitHideCombinator(HideCombinator node) => null;
 
   @override
@@ -6161,7 +6223,7 @@
       // TODO(jmesserly): if we support union types for real, `new C<Ti | Tj>`
       // will become a valid possibility. Right now the only allowed union is
       // `T | Future<T>` so we can take a simple approach.
-      for (var contextType in InferenceContext.getTypes(node)) {
+      for (var contextType in inferenceContext.getTypes(node)) {
         if (contextType is InterfaceType &&
             contextType.typeArguments != null &&
             contextType.typeArguments.isNotEmpty) {
@@ -6178,7 +6240,8 @@
           List<DartType> targs =
               inferenceContext.matchTypes(classTypeName.type, contextType);
           if (targs != null && targs.any((t) => !t.isDynamic)) {
-            ClassElement classElement = classTypeName.type.element;
+            ClassElement classElement =
+                resolutionMap.typeForTypeName(classTypeName).element;
             InterfaceType rawType = classElement.type;
             InterfaceType fullType =
                 rawType.substitute2(targs, rawType.typeArguments);
@@ -6191,7 +6254,9 @@
       }
     }
     node.constructorName?.accept(this);
-    FunctionType constructorType = node.constructorName.staticElement?.type;
+    FunctionType constructorType = resolutionMap
+        .staticElementForConstructorReference(node.constructorName)
+        ?.type;
     if (constructorType != null) {
       InferenceContext.setType(node.argumentList, constructorType);
     }
@@ -6350,7 +6415,8 @@
     // because it needs to be visited in the context of the constructor
     // invocation.
     //
-    InferenceContext.setType(node.argumentList, node.staticElement?.type);
+    InferenceContext.setType(node.argumentList,
+        resolutionMap.staticElementForConstructorReference(node)?.type);
     node.argumentList?.accept(this);
     node.accept(elementResolver);
     node.accept(typeAnalyzer);
@@ -6384,7 +6450,8 @@
     // because it needs to be visited in the context of the constructor
     // invocation.
     //
-    InferenceContext.setType(node.argumentList, node.staticElement?.type);
+    InferenceContext.setType(node.argumentList,
+        resolutionMap.staticElementForConstructorReference(node)?.type);
     node.argumentList?.accept(this);
     node.accept(elementResolver);
     node.accept(typeAnalyzer);
@@ -6457,7 +6524,9 @@
   @override
   visitVariableDeclarationList(VariableDeclarationList node) {
     for (VariableDeclaration decl in node.variables) {
-      InferenceContext.setType(decl, decl.element?.type);
+      VariableElement variableElement =
+          resolutionMap.elementDeclaredByVariableDeclaration(decl);
+      InferenceContext.setType(decl, variableElement?.type);
     }
     super.visitVariableDeclarationList(node);
   }
@@ -6590,12 +6659,23 @@
       }
       // async functions expect `Future<T> | T`
       var futureTypeParam = declaredType.flattenFutures(typeSystem);
-      return FutureUnionType.from(futureTypeParam, typeProvider, typeSystem);
+      return _createFutureOr(futureTypeParam);
     }
     return declaredType;
   }
 
   /**
+   * Creates a union of `T | Future<T>`, unless `T` is already a
+   * future-union, in which case it simply returns `T`.
+   */
+  DartType _createFutureOr(DartType type) {
+    if (type.isDartAsyncFutureOr) {
+      return type;
+    }
+    return typeProvider.futureOrType.instantiate([type]);
+  }
+
+  /**
    * The given expression is the expression used to compute the iterator for a
    * for-each statement. Attempt to compute the type of objects that will be
    * assigned to the loop variable and return that type. Return `null` if the
@@ -6692,7 +6772,6 @@
           originalType.typeFormals.isNotEmpty &&
           ts is StrongTypeSystemImpl) {
         contextType = ts.inferGenericFunctionCall(
-            typeProvider,
             originalType,
             DartType.EMPTY_LIST,
             DartType.EMPTY_LIST,
@@ -6744,14 +6823,15 @@
     FunctionType expectedClosureType = mayByFunctionType as FunctionType;
     // If the expectedClosureType is not more specific than the static type,
     // return.
-    DartType staticClosureType = closure.element?.type;
+    DartType staticClosureType =
+        resolutionMap.elementDeclaredByFunctionExpression(closure)?.type;
     if (staticClosureType != null &&
         !FunctionTypeImpl.relate(
             expectedClosureType,
             staticClosureType,
             (DartType t, DartType s, _, __) =>
                 (t as TypeImpl).isMoreSpecificThan(s),
-            new TypeSystemImpl().instantiateToBounds,
+            new TypeSystemImpl(typeProvider).instantiateToBounds,
             returnRelation: (s, t) => true)) {
       return;
     }
@@ -8008,7 +8088,7 @@
 }
 
 /**
- * Helper for resolving [TypeName]s.
+ * Helper for resolving types.
  *
  * The client must set [nameScope] before calling [resolveTypeName].
  */
@@ -8220,8 +8300,23 @@
     }
     DartType type = null;
     if (element is ClassElement) {
-      _setElement(typeName, element);
       type = element.type;
+      // In non-strong mode `FutureOr<T>` is treated as `dynamic`
+      if (!typeSystem.isStrong && type.isDartAsyncFutureOr) {
+        type = dynamicType;
+        _setElement(typeName, type.element);
+        typeName.staticType = type;
+        node.type = type;
+        if (argumentList != null) {
+          NodeList<TypeAnnotation> arguments = argumentList.arguments;
+          if (arguments.length != 1) {
+            reportErrorForNode(_getInvalidTypeParametersErrorCode(node), node,
+                [typeName.name, 1, arguments.length]);
+          }
+        }
+        return;
+      }
+      _setElement(typeName, element);
     } else if (element is FunctionTypeAliasElement) {
       _setElement(typeName, element);
       type = element.type;
@@ -8287,15 +8382,14 @@
       return;
     }
     if (argumentList != null) {
-      NodeList<TypeName> arguments = argumentList.arguments;
+      NodeList<TypeAnnotation> arguments = argumentList.arguments;
       int argumentCount = arguments.length;
       List<DartType> parameters = typeSystem.typeFormalsAsTypes(type);
       int parameterCount = parameters.length;
       List<DartType> typeArguments = new List<DartType>(parameterCount);
       if (argumentCount == parameterCount) {
         for (int i = 0; i < parameterCount; i++) {
-          TypeName argumentTypeName = arguments[i];
-          DartType argumentType = _getType(argumentTypeName);
+          DartType argumentType = _getType(arguments[i]);
           if (argumentType == null) {
             argumentType = dynamicType;
           }
@@ -8317,16 +8411,12 @@
   }
 
   /**
-   * The number of type arguments in the given type name does not match the number of parameters in
-   * the corresponding class element. Return the error code that should be used to report this
-   * error.
-   *
-   * @param node the type name with the wrong number of type arguments
-   * @return the error code that should be used to report that the wrong number of type arguments
-   *         were provided
+   * The number of type arguments in the given [typeName] does not match the
+   * number of parameters in the corresponding class element. Return the error
+   * code that should be used to report this error.
    */
-  ErrorCode _getInvalidTypeParametersErrorCode(TypeName node) {
-    AstNode parent = node.parent;
+  ErrorCode _getInvalidTypeParametersErrorCode(TypeName typeName) {
+    AstNode parent = typeName.parent;
     if (parent is ConstructorName) {
       parent = parent.parent;
       if (parent is InstanceCreationExpression) {
@@ -8341,11 +8431,7 @@
   }
 
   /**
-   * Checks if the given type name is the target in a redirected constructor.
-   *
-   * @param typeName the type name to analyze
-   * @return some [RedirectingConstructorKind] if the given type name is used as the type in a
-   *         redirected constructor, or `null` otherwise
+   * Checks if the given [typeName] is the target in a redirected constructor.
    */
   RedirectingConstructorKind _getRedirectingConstructorKind(TypeName typeName) {
     AstNode parent = typeName.parent;
@@ -8364,13 +8450,10 @@
   }
 
   /**
-   * Return the type represented by the given type name.
-   *
-   * @param typeName the type name representing the type to be returned
-   * @return the type represented by the type name
+   * Return the type represented by the given type [annotation].
    */
-  DartType _getType(TypeName typeName) {
-    DartType type = typeName.type;
+  DartType _getType(TypeAnnotation annotation) {
+    DartType type = annotation.type;
     if (type == null) {
       return undefinedType;
     }
@@ -8414,10 +8497,7 @@
   }
 
   /**
-   * Checks if the given type name is used as the type in an as expression.
-   *
-   * @param typeName the type name to analyzer
-   * @return `true` if the given type name is used as the type in an as expression
+   * Checks if the given [typeName] is used as the type in an as expression.
    */
   bool _isTypeNameInAsExpression(TypeName typeName) {
     AstNode parent = typeName.parent;
@@ -8428,10 +8508,8 @@
   }
 
   /**
-   * Checks if the given type name is used as the exception type in a catch clause.
-   *
-   * @param typeName the type name to analyzer
-   * @return `true` if the given type name is used as the exception type in a catch clause
+   * Checks if the given [typeName] is used as the exception type in a catch
+   * clause.
    */
   bool _isTypeNameInCatchClause(TypeName typeName) {
     AstNode parent = typeName.parent;
@@ -8442,11 +8520,8 @@
   }
 
   /**
-   * Checks if the given type name is used as the type in an instance creation expression.
-   *
-   * @param typeName the type name to analyzer
-   * @return `true` if the given type name is used as the type in an instance creation
-   *         expression
+   * Checks if the given [typeName] is used as the type in an instance creation
+   * expression.
    */
   bool _isTypeNameInInstanceCreationExpression(TypeName typeName) {
     AstNode parent = typeName.parent;
@@ -8458,10 +8533,7 @@
   }
 
   /**
-   * Checks if the given type name is used as the type in an is expression.
-   *
-   * @param typeName the type name to analyzer
-   * @return `true` if the given type name is used as the type in an is expression
+   * Checks if the given [typeName] is used as the type in an is expression.
    */
   bool _isTypeNameInIsExpression(TypeName typeName) {
     AstNode parent = typeName.parent;
@@ -8472,10 +8544,7 @@
   }
 
   /**
-   * Checks if the given type name used in a type argument list.
-   *
-   * @param typeName the type name to analyzer
-   * @return `true` if the given type name is in a type argument list
+   * Checks if the given [typeName] used in a type argument list.
    */
   bool _isTypeNameInTypeArgumentList(TypeName typeName) =>
       typeName.parent is TypeArgumentList;
@@ -8498,24 +8567,24 @@
   }
 
   /**
-   * @return `true` if the name of the given [TypeName] is an built-in identifier.
+   * Return `true` if the name of the given [typeName] is an built-in identifier.
    */
-  static bool _isBuiltInIdentifier(TypeName node) {
-    Token token = node.name.beginToken;
+  static bool _isBuiltInIdentifier(TypeName typeName) {
+    Token token = typeName.name.beginToken;
     return token.type == TokenType.KEYWORD;
   }
 
   /**
-   * @return `true` if given [TypeName] is used as a type annotation.
+   * @return `true` if given [typeName] is used as a type annotation.
    */
-  static bool _isTypeAnnotation(TypeName node) {
-    AstNode parent = node.parent;
+  static bool _isTypeAnnotation(TypeName typeName) {
+    AstNode parent = typeName.parent;
     if (parent is VariableDeclarationList) {
-      return identical(parent.type, node);
+      return identical(parent.type, typeName);
     } else if (parent is FieldFormalParameter) {
-      return identical(parent.type, node);
+      return identical(parent.type, typeName);
     } else if (parent is SimpleFormalParameter) {
-      return identical(parent.type, node);
+      return identical(parent.type, typeName);
     }
     return false;
   }
@@ -8783,10 +8852,15 @@
     }
   }
 
-  void _resolveTypeName(TypeName typeName) {
-    typeName.typeArguments?.arguments?.forEach(_resolveTypeName);
-    typeNameResolver.resolveTypeName(typeName);
-    // TODO(scheglov) report error when don't apply type bounds for type bounds
+  void _resolveTypeName(TypeAnnotation type) {
+    if (type is TypeName) {
+      type.typeArguments?.arguments?.forEach(_resolveTypeName);
+      typeNameResolver.resolveTypeName(type);
+      // TODO(scheglov) report error when don't apply type bounds for type bounds
+    } else {
+      // TODO(brianwilkerson) Add resolution of GenericFunctionType
+      throw new ArgumentError('Cannot resolve a ${type.runtimeType}');
+    }
   }
 
   void _resolveTypeParameters(
@@ -8794,18 +8868,28 @@
     if (typeParameters != null) {
       Scope typeParametersScope = null;
       for (TypeParameter typeParameter in typeParameters.typeParameters) {
-        TypeName bound = typeParameter.bound;
+        TypeAnnotation bound = typeParameter.bound;
         if (bound != null) {
           Element typeParameterElement = typeParameter.name.staticElement;
           if (typeParameterElement is TypeParameterElementImpl) {
             if (LibraryElementImpl.hasResolutionCapability(
                 library, LibraryResolutionCapability.resolvedTypeNames)) {
-              bound.type = typeParameterElement.bound;
+              if (bound is TypeName) {
+                bound.type = typeParameterElement.bound;
+              } else {
+                // TODO(brianwilkerson) Add resolution of GenericFunctionType
+                throw new ArgumentError(
+                    'Cannot resolve a ${bound.runtimeType}');
+              }
             } else {
               libraryScope ??= new LibraryScope(library);
               typeParametersScope ??= createTypeParametersScope();
-              typeNameResolver ??= new TypeNameResolver(new TypeSystemImpl(),
-                  typeProvider, library, source, errorListener);
+              typeNameResolver ??= new TypeNameResolver(
+                  new TypeSystemImpl(typeProvider),
+                  typeProvider,
+                  library,
+                  source,
+                  errorListener);
               typeNameResolver.nameScope = typeParametersScope;
               _resolveTypeName(bound);
               typeParameterElement.bound = bound.type;
@@ -8979,6 +9063,16 @@
   InterfaceType get futureNullType;
 
   /**
+   * Return the type representing 'FutureOr<Null>'.
+   */
+  InterfaceType get futureOrNullType;
+
+  /**
+   * Return the type representing the built-in type 'FutureOr'.
+   */
+  InterfaceType get futureOrType;
+
+  /**
    * Return the type representing the built-in type 'Future'.
    */
   InterfaceType get futureType;
@@ -9167,6 +9261,16 @@
   InterfaceType _futureNullType;
 
   /**
+   * The type representing 'FutureOr<Null>'.
+   */
+  InterfaceType _futureOrNullType;
+
+  /**
+   * The type representing the built-in type 'FutureOr'.
+   */
+  InterfaceType _futureOrType;
+
+  /**
    * The type representing the built-in type 'Future'.
    */
   InterfaceType _futureType;
@@ -9297,6 +9401,12 @@
   InterfaceType get futureNullType => _futureNullType;
 
   @override
+  InterfaceType get futureOrNullType => _futureOrNullType;
+
+  @override
+  InterfaceType get futureOrType => _futureOrType;
+
+  @override
   InterfaceType get futureType => _futureType;
 
   @override
@@ -9381,6 +9491,7 @@
     _doubleType = _getType(coreNamespace, "double");
     _dynamicType = DynamicTypeImpl.instance;
     _functionType = _getType(coreNamespace, "Function");
+    _futureOrType = _getType(asyncNamespace, "FutureOr");
     _futureType = _getType(asyncNamespace, "Future");
     _intType = _getType(coreNamespace, "int");
     _iterableType = _getType(coreNamespace, "Iterable");
@@ -9397,6 +9508,7 @@
     _undefinedType = UndefinedTypeImpl.instance;
     _futureDynamicType = _futureType.instantiate(<DartType>[_dynamicType]);
     _futureNullType = _futureType.instantiate(<DartType>[_nullType]);
+    _futureOrNullType = _futureOrType.instantiate(<DartType>[_nullType]);
     _iterableDynamicType = _iterableType.instantiate(<DartType>[_dynamicType]);
     _streamDynamicType = _streamType.instantiate(<DartType>[_dynamicType]);
   }
@@ -9460,7 +9572,7 @@
   TypeSystem _typeSystem;
 
   /**
-   * The helper to resolve [TypeName]s.
+   * The helper to resolve types.
    */
   TypeNameResolver _typeNameResolver;
 
@@ -9542,7 +9654,7 @@
       // If an 'on' clause is provided the type of the exception parameter is
       // the type in the 'on' clause. Otherwise, the type of the exception
       // parameter is 'Object'.
-      TypeName exceptionTypeName = node.exceptionType;
+      TypeAnnotation exceptionTypeName = node.exceptionType;
       DartType exceptionType;
       if (exceptionTypeName == null) {
         exceptionType = typeProvider.dynamicType;
@@ -9681,7 +9793,7 @@
   Object visitDeclaredIdentifier(DeclaredIdentifier node) {
     super.visitDeclaredIdentifier(node);
     DartType declaredType;
-    TypeName typeName = node.type;
+    TypeAnnotation typeName = node.type;
     if (typeName == null) {
       declaredType = _dynamicType;
     } else {
@@ -9700,7 +9812,7 @@
       FormalParameterList parameterList = node.parameters;
       if (parameterList == null) {
         DartType type;
-        TypeName typeName = node.type;
+        TypeAnnotation typeName = node.type;
         if (typeName == null) {
           element.hasImplicitType = true;
           if (element is FieldFormalParameterElement) {
@@ -9803,9 +9915,10 @@
         variable.declaredType = element.returnType;
       } else if (variable.type == null) {
         List<ParameterElement> parameters = element.parameters;
-        if (parameters != null && parameters.length > 0) {
-          variable.declaredType = parameters[0].type;
-        }
+        DartType type = parameters != null && parameters.length > 0
+            ? parameters[0].type
+            : _dynamicType;
+        variable.declaredType = type;
       }
     }
 
@@ -9922,7 +10035,7 @@
   Object visitSimpleFormalParameter(SimpleFormalParameter node) {
     super.visitSimpleFormalParameter(node);
     DartType declaredType;
-    TypeName typeName = node.type;
+    TypeAnnotation typeName = node.type;
     if (typeName == null) {
       declaredType = _dynamicType;
     } else {
@@ -9961,7 +10074,7 @@
       // Bounds of parameters of classes and function type aliases are
       // already resolved.
     } else {
-      TypeName bound = node.bound;
+      TypeAnnotation bound = node.bound;
       if (bound != null) {
         TypeParameterElementImpl typeParameter =
             node.name.staticElement as TypeParameterElementImpl;
@@ -9986,7 +10099,7 @@
     }
     // Resolve the type.
     DartType declaredType;
-    TypeName typeName = variableList.type;
+    TypeAnnotation typeName = variableList.type;
     if (typeName == null) {
       declaredType = _dynamicType;
     } else {
@@ -10000,13 +10113,10 @@
   }
 
   /**
-   * Given a type name representing the return type of a function, compute the return type of the
+   * Given the [returnType] of a function, compute the return type of the
    * function.
-   *
-   * @param returnType the type name representing the return type of the function
-   * @return the return type that was computed
    */
-  DartType _computeReturnType(TypeName returnType) {
+  DartType _computeReturnType(TypeAnnotation returnType) {
     if (returnType == null) {
       return _dynamicType;
     } else {
@@ -10088,13 +10198,8 @@
   }
 
   /**
-   * Resolve the types in the given with and implements clauses and associate those types with the
-   * given class element.
-   *
-   * @param classElement the class element with which the mixin and interface types are to be
-   *          associated
-   * @param withClause the with clause to be resolved
-   * @param implementsClause the implements clause to be resolved
+   * Resolve the types in the given [withClause] and [implementsClause] and
+   * associate those types with the given [classElement].
    */
   void _resolve(ClassElementImpl classElement, WithClause withClause,
       ImplementsClause implementsClause) {
@@ -10203,15 +10308,12 @@
   }
 
   /**
-   * Given a parameter element, create a function type based on the given return type and parameter
-   * list and associate the created type with the element.
-   *
-   * @param element the parameter element whose type is to be set
-   * @param returnType the (possibly `null`) return type of the function
-   * @param parameterList the list of parameters to the function
+   * Given a parameter [element], create a function type based on the given
+   * [returnType] and [parameterList] and associate the created type with the
+   * element.
    */
   void _setFunctionTypedParameterType(ParameterElementImpl element,
-      TypeName returnType, FormalParameterList parameterList) {
+      TypeAnnotation returnType, FormalParameterList parameterList) {
     List<ParameterElement> parameters = _getElements(parameterList);
     FunctionElementImpl functionElement = new FunctionElementImpl.forNode(null);
     functionElement.isSynthetic = true;
@@ -10663,7 +10765,7 @@
       this.parameterElements,
       DeclaredVariables declaredVariables,
       {TypeSystem typeSystem})
-      : _typeSystem = typeSystem ?? new TypeSystemImpl(),
+      : _typeSystem = typeSystem ?? new TypeSystemImpl(typeProvider),
         super(
             new ConstantEvaluationEngine(typeProvider, declaredVariables,
                 typeSystem: typeSystem),
diff --git a/pkg/analyzer/lib/src/generated/sdk.dart b/pkg/analyzer/lib/src/generated/sdk.dart
index 397fb9d..a81b50f 100644
--- a/pkg/analyzer/lib/src/generated/sdk.dart
+++ b/pkg/analyzer/lib/src/generated/sdk.dart
@@ -7,10 +7,9 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/src/generated/engine.dart'
-    show AnalysisContext, AnalysisOptions, AnalysisOptionsImpl;
+    show AnalysisContext, AnalysisOptions;
 import 'package:analyzer/src/generated/source.dart' show Source;
 import 'package:analyzer/src/generated/utilities_general.dart';
 import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
@@ -214,7 +213,7 @@
   @override
   int get hashCode {
     int hashCode = 0;
-    for (int value in options.encodeCrossContextOptions()) {
+    for (int value in options.signature) {
       hashCode = JenkinsSmiHash.combine(hashCode, value);
     }
     for (String path in paths) {
@@ -226,9 +225,8 @@
   @override
   bool operator ==(Object other) {
     if (other is SdkDescription) {
-      if (!AnalysisOptions.crossContextOptionsEqual(
-          options.encodeCrossContextOptions(),
-          other.options.encodeCrossContextOptions())) {
+      if (!AnalysisOptions.signaturesEqual(
+          options.signature, other.options.signature)) {
         return false;
       }
       int length = paths.length;
@@ -264,8 +262,7 @@
       buffer.write(' ');
     }
     buffer.write('(');
-    buffer.write(AnalysisOptionsImpl
-        .decodeCrossContextOptions(options.encodeCrossContextOptions()));
+    buffer.write(options.signature);
     buffer.write(')');
     return buffer.toString();
   }
@@ -291,11 +288,6 @@
   static String _DART2JS_PATH = "dart2jsPath";
 
   /**
-   * The name of the `dart2js` platform.
-   */
-  static String _DART2JS_PLATFORM = 'DART2JS_PLATFORM';
-
-  /**
    * The name of the optional parameter used to indicate whether the library is
    * documented.
    */
@@ -308,12 +300,6 @@
   static String _CATEGORIES = "categories";
 
   /**
-   * The name of the optional parameter used to specify the patches for
-   * the library.
-   */
-  static String _PATCHES = "patches";
-
-  /**
    * The name of the optional parameter used to specify the platforms on which
    * the library can be used.
    */
@@ -391,30 +377,6 @@
             library._implementation = (expression as BooleanLiteral).value;
           } else if (name == _DOCUMENTED) {
             library.documented = (expression as BooleanLiteral).value;
-          } else if (name == _PATCHES) {
-            if (expression is MapLiteral) {
-              expression.entries.forEach((MapLiteralEntry entry) {
-                int platforms = _convertPlatforms(entry.key);
-                Expression pathsListLiteral = entry.value;
-                if (pathsListLiteral is ListLiteral) {
-                  List<String> paths = <String>[];
-                  pathsListLiteral.elements.forEach((Expression pathExpr) {
-                    if (pathExpr is SimpleStringLiteral) {
-                      String path = pathExpr.value;
-                      _validatePatchPath(path);
-                      paths.add(path);
-                    } else {
-                      throw new ArgumentError(
-                          'The "patch" argument items must be simple strings.');
-                    }
-                  });
-                  library.setPatchPaths(platforms, paths);
-                } else {
-                  throw new ArgumentError(
-                      'The "patch" argument values must be list literals.');
-                }
-              });
-            }
           } else if (name == _PLATFORMS) {
             if (expression is SimpleIdentifier) {
               String identifier = expression.name;
@@ -435,61 +397,6 @@
     }
     return null;
   }
-
-  /**
-   * Validate the given [path] to a patch file. Throw [ArgumentError] if not a
-   * valid path: is absolute, or contains `..`.
-   */
-  void _validatePatchPath(String path) {
-    if (path.contains(r'\')) {
-      throw new ArgumentError('The path to a patch file must be posix: $path');
-    }
-    if (path.contains('..')) {
-      throw new ArgumentError(
-          'The path to a patch file cannot contain "..": $path');
-    }
-    if (path.startsWith('/')) {
-      throw new ArgumentError(
-          'The path to a patch file cannot be absolute: $path');
-    }
-  }
-
-  /**
-   * Return the platform constant value for the given [expr].
-   * Throw [ArgumentError] if not a valid platform name given.
-   */
-  static int _convertPlatform(Expression expr) {
-    if (expr is SimpleIdentifier) {
-      String name = expr.name;
-      if (name == _DART2JS_PLATFORM) {
-        return SdkLibraryImpl.DART2JS_PLATFORM;
-      }
-      if (name == _VM_PLATFORM) {
-        return SdkLibraryImpl.VM_PLATFORM;
-      }
-      throw new ArgumentError('Invalid platform name: $name');
-    }
-    throw new ArgumentError('Invalid platform type: ${expr.runtimeType}');
-  }
-
-  /**
-   * Return the platforms combination value for the [expr], which should be
-   * either `name1 | name2` or `name`.  Throw [ArgumentError] if any of the
-   * names is not a valid platform name.
-   */
-  static int _convertPlatforms(Expression expr) {
-    if (expr is BinaryExpression) {
-      TokenType operator = expr.operator?.type;
-      if (operator == TokenType.BAR) {
-        return _convertPlatforms(expr.leftOperand) |
-            _convertPlatforms(expr.rightOperand);
-      } else {
-        throw new ArgumentError('Invalid platforms combination: $operator');
-      }
-    } else {
-      return _convertPlatform(expr);
-    }
-  }
 }
 
 /**
@@ -542,12 +449,6 @@
    * including `dart:`.
    */
   String get shortName;
-
-  /**
-   * Return the list of paths to the patch files that should be applied
-   * to this library for the given [platform], not `null`.
-   */
-  List<String> getPatches(int platform);
 }
 
 /**
@@ -600,14 +501,6 @@
   int _platforms = 0;
 
   /**
-   * The mapping from the platform combination to the list of paths (relative
-   * to the `sdk/lib` folder) of patches that should be applied to this library
-   * on every platform in the combination.
-   */
-  final Map<int, List<String>> _platformsToPatchPaths =
-      new HashMap<int, List<String>>();
-
-  /**
    * Initialize a newly created library to represent the library with the given
    * [name].
    */
@@ -638,17 +531,6 @@
   @override
   bool get isVmLibrary => (_platforms & VM_PLATFORM) != 0;
 
-  @override
-  List<String> getPatches(int platform) {
-    List<String> paths = <String>[];
-    _platformsToPatchPaths.forEach((int platforms, List<String> value) {
-      if ((platforms & platform) != 0) {
-        paths.addAll(value);
-      }
-    });
-    return paths;
-  }
-
   /**
    * Record that this library can be compiled to JavaScript by dart2js.
    */
@@ -657,14 +539,6 @@
   }
 
   /**
-   * Add a new patch with the given [path] that should be applied for the
-   * given [platforms].
-   */
-  void setPatchPaths(int platforms, List<String> paths) {
-    _platformsToPatchPaths[platforms] = paths;
-  }
-
-  /**
    * Record that this library can be run on the VM.
    */
   void setVmLibrary() {
diff --git a/pkg/analyzer/lib/src/generated/sdk_io.dart b/pkg/analyzer/lib/src/generated/sdk_io.dart
index 9177b28..e46fe7d 100644
--- a/pkg/analyzer/lib/src/generated/sdk_io.dart
+++ b/pkg/analyzer/lib/src/generated/sdk_io.dart
@@ -21,7 +21,7 @@
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
-import 'package:analyzer/src/summary/summary_sdk.dart';
+import 'package:analyzer/src/summary/package_bundle_reader.dart';
 import 'package:path/path.dart' as pathos;
 
 /**
@@ -79,8 +79,10 @@
         bool strongMode = _analysisOptions?.strongMode ?? false;
         PackageBundle sdkBundle = getSummarySdkBundle(strongMode);
         if (sdkBundle != null) {
-          _analysisContext.resultProvider = new SdkSummaryResultProvider(
-              _analysisContext, sdkBundle, strongMode);
+          SummaryDataStore dataStore = new SummaryDataStore([]);
+          dataStore.addBundle(null, sdkBundle);
+          _analysisContext.resultProvider =
+              new InputPackagesResultProvider(_analysisContext, dataStore);
         }
       }
     }
diff --git a/pkg/analyzer/lib/src/generated/source.dart b/pkg/analyzer/lib/src/generated/source.dart
index e4ceae7..262bfe3 100644
--- a/pkg/analyzer/lib/src/generated/source.dart
+++ b/pkg/analyzer/lib/src/generated/source.dart
@@ -66,6 +66,17 @@
   String getContents(Source source) => _contentMap[source.fullName];
 
   /**
+   * Return `true` if the given [source] exists, `false` if it does not exist,
+   * or `null` if this cache does not override existence of the source.
+   *
+   * <b>Note:</b> This method is not intended to be used except by
+   * [AnalysisContext.exists].
+   */
+  bool getExists(Source source) {
+    return _contentMap.containsKey(source.fullName) ? true : null;
+  }
+
+  /**
    * Return the modification stamp of the given [source], or `null` if this
    * cache does not override the contents of the source.
    *
@@ -163,6 +174,12 @@
     return _sdk.mapDartUri(uri.toString());
   }
 
+  @override
+  Uri restoreAbsolute(Source source) {
+    Source dartSource = _sdk.fromFileUri(source.uri);
+    return dartSource?.uri;
+  }
+
   /**
    * Return `true` if the given URI is a `dart-ext:` URI.
    *
@@ -411,6 +428,9 @@
 
   @override
   bool exists() => false;
+
+  @override
+  String toString() => 'NonExistingSource($uri, $fullName)';
 }
 
 /**
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index 53745d2..b0d106c 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -7,6 +7,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -249,7 +250,6 @@
       ExecutableElement staticMethodElement = node.staticElement;
       DartType staticType = _computeStaticReturnType(staticMethodElement);
       staticType = _typeSystem.refineBinaryExpressionType(
-          _typeProvider,
           node.leftHandSide.staticType,
           operator,
           node.rightHandSide.staticType,
@@ -260,7 +260,6 @@
         DartType propagatedType =
             _computeStaticReturnType(propagatedMethodElement);
         propagatedType = _typeSystem.refineBinaryExpressionType(
-            _typeProvider,
             node.leftHandSide.propagatedType,
             operator,
             node.rightHandSide.propagatedType,
@@ -279,16 +278,19 @@
    */
   @override
   Object visitAwaitExpression(AwaitExpression node) {
-    DartType staticExpressionType = _getStaticType(node.expression);
-    if (staticExpressionType == null) {
-      // TODO(brianwilkerson) Determine whether this can still happen.
-      staticExpressionType = _dynamicType;
+    // Await the Future. This results in whatever type is (ultimately) returned.
+    DartType awaitType(DartType awaitedType) {
+      if (awaitedType == null) {
+        return null;
+      }
+      if (awaitedType.isDartAsyncFutureOr) {
+        return awaitType((awaitedType as InterfaceType).typeArguments[0]);
+      }
+      return awaitedType.flattenFutures(_typeSystem);
     }
-    DartType staticType = staticExpressionType.flattenFutures(_typeSystem);
-    _recordStaticType(node, staticType);
-    DartType propagatedExpressionType = node.expression.propagatedType;
-    DartType propagatedType =
-        propagatedExpressionType?.flattenFutures(_typeSystem);
+
+    _recordStaticType(node, awaitType(_getStaticType(node.expression)));
+    DartType propagatedType = awaitType(node.expression.propagatedType);
     _resolver.recordPropagatedTypeIfBetter(node, propagatedType);
     return null;
   }
@@ -343,7 +345,6 @@
     ExecutableElement staticMethodElement = node.staticElement;
     DartType staticType = _computeStaticReturnType(staticMethodElement);
     staticType = _typeSystem.refineBinaryExpressionType(
-        _typeProvider,
         node.leftOperand.staticType,
         node.operator.type,
         node.rightOperand.staticType,
@@ -354,7 +355,6 @@
       DartType propagatedType =
           _computeStaticReturnType(propagatedMethodElement);
       propagatedType = _typeSystem.refineBinaryExpressionType(
-          _typeProvider,
           node.leftOperand.bestType,
           node.operator.type,
           node.rightOperand.bestType,
@@ -610,10 +610,9 @@
     // If we have explicit arguments, use them
     if (typeArguments != null) {
       DartType staticType = _dynamicType;
-      NodeList<TypeName> arguments = typeArguments.arguments;
+      NodeList<TypeAnnotation> arguments = typeArguments.arguments;
       if (arguments != null && arguments.length == 1) {
-        TypeName argumentTypeName = arguments[0];
-        DartType argumentType = _getType(argumentTypeName);
+        DartType argumentType = _getType(arguments[0]);
         if (argumentType != null) {
           staticType = argumentType;
         }
@@ -640,7 +639,6 @@
       var listTypeParam = _typeProvider.listType.typeParameters[0].type;
 
       DartType inferred = ts.inferGenericFunctionCall(
-          _typeProvider,
           _typeProvider.listType,
           new List.filled(elementTypes.length, listTypeParam),
           elementTypes,
@@ -688,15 +686,13 @@
     if (typeArguments != null) {
       DartType staticKeyType = _dynamicType;
       DartType staticValueType = _dynamicType;
-      NodeList<TypeName> arguments = typeArguments.arguments;
+      NodeList<TypeAnnotation> arguments = typeArguments.arguments;
       if (arguments != null && arguments.length == 2) {
-        TypeName entryKeyTypeName = arguments[0];
-        DartType entryKeyType = _getType(entryKeyTypeName);
+        DartType entryKeyType = _getType(arguments[0]);
         if (entryKeyType != null) {
           staticKeyType = entryKeyType;
         }
-        TypeName entryValueTypeName = arguments[1];
-        DartType entryValueType = _getType(entryValueTypeName);
+        DartType entryValueType = _getType(arguments[1]);
         if (entryValueType != null) {
           staticValueType = entryValueType;
         }
@@ -723,7 +719,6 @@
       var valueTypeParam = _typeProvider.mapType.typeParameters[1].type;
 
       DartType inferred = ts.inferGenericFunctionCall(
-          _typeProvider,
           _typeProvider.mapType,
           new List.filled(keyTypes.length, keyTypeParam, growable: true)
             ..addAll(new List.filled(valueTypes.length, valueTypeParam)),
@@ -819,7 +814,7 @@
       Expression target = node.realTarget;
       if (target != null) {
         DartType targetType = target.bestType;
-        if (_isAsyncFutureType(targetType)) {
+        if (targetType.isDartAsyncFuture) {
           // Future.then(closure) return type is:
           // 1) the returned Future type, if the closure returns a Future;
           // 2) Future<valueType>, if the closure returns a value.
@@ -989,8 +984,7 @@
    */
   @override
   Object visitNullLiteral(NullLiteral node) {
-    // TODO(jmesserly): in strong mode, should we just use the context type?
-    _recordStaticType(node, _typeProvider.bottomType);
+    _recordStaticType(node, _typeProvider.nullType);
     return null;
   }
 
@@ -1078,10 +1072,8 @@
     } else if (staticElement is VariableElement) {
       staticType = staticElement.type;
     }
-    if (_strongMode) {
-      staticType = _inferGenericInstantiationFromContext(
-          InferenceContext.getType(node), staticType);
-    }
+    staticType = _inferGenericInstantiationFromContext(node, staticType);
+
     if (!(_strongMode &&
         _inferObjectAccess(node, staticType, prefixedIdentifier))) {
       _recordStaticType(prefixedIdentifier, staticType);
@@ -1211,10 +1203,8 @@
     } else {
       // TODO(brianwilkerson) Report this internal error.
     }
-    if (_strongMode) {
-      staticType = _inferGenericInstantiationFromContext(
-          InferenceContext.getType(node), staticType);
-    }
+    staticType = _inferGenericInstantiationFromContext(node, staticType);
+
     if (!(_strongMode && _inferObjectAccess(node, staticType, propertyName))) {
       _recordStaticType(propertyName, staticType);
       _recordStaticType(node, staticType);
@@ -1315,10 +1305,8 @@
     } else {
       staticType = _dynamicType;
     }
-    if (_strongMode) {
-      staticType = _inferGenericInstantiationFromContext(
-          InferenceContext.getType(node), staticType);
-    }
+    staticType = _inferGenericInstantiationFromContext(node, staticType);
+
     _recordStaticType(node, staticType);
     // TODO(brianwilkerson) I think we want to repeat the logic above using the
     // propagated element to get another candidate for the propagated type.
@@ -1433,11 +1421,11 @@
       // TODO(brianwilkerson) Determine whether this can still happen.
       staticType2 = _dynamicType;
     }
+
     DartType staticType =
-        _typeSystem.getLeastUpperBound(_typeProvider, staticType1, staticType2);
-    if (staticType == null) {
-      staticType = _dynamicType;
-    }
+        _typeSystem.getLeastUpperBound(staticType1, staticType2) ??
+            _dynamicType;
+
     _recordStaticType(node, staticType);
     DartType propagatedType1 = expr1.propagatedType;
     DartType propagatedType2 = expr2.propagatedType;
@@ -1448,8 +1436,8 @@
       if (propagatedType2 == null) {
         propagatedType2 = staticType2;
       }
-      DartType propagatedType = _typeSystem.getLeastUpperBound(
-          _typeProvider, propagatedType1, propagatedType2);
+      DartType propagatedType =
+          _typeSystem.getLeastUpperBound(propagatedType1, propagatedType2);
       _resolver.recordPropagatedTypeIfBetter(node, propagatedType);
     }
   }
@@ -1534,6 +1522,9 @@
           : _typeProvider.iterableType;
       return genericType.instantiate(<DartType>[type]);
     } else if (body.isAsynchronous) {
+      if (type.isDartAsyncFutureOr) {
+        type = (type as InterfaceType).typeArguments[0];
+      }
       return _typeProvider.futureType
           .instantiate(<DartType>[type.flattenFutures(_typeSystem)]);
     } else {
@@ -1576,7 +1567,7 @@
    */
   DartType _computeStaticReturnTypeOfFunctionDeclaration(
       FunctionDeclaration node) {
-    TypeName returnType = node.returnType;
+    TypeAnnotation returnType = node.returnType;
     if (returnType == null) {
       return _dynamicType;
     }
@@ -1833,13 +1824,10 @@
   }
 
   /**
-   * Return the type represented by the given type name.
-   *
-   * @param typeName the type name representing the type to be returned
-   * @return the type represented by the type name
+   * Return the type represented by the given type [annotation].
    */
-  DartType _getType(TypeName typeName) {
-    DartType type = typeName.type;
+  DartType _getType(TypeAnnotation annotation) {
+    DartType type = annotation.type;
     if (type == null) {
       //TODO(brianwilkerson) Determine the conditions for which the type is
       // null.
@@ -1911,13 +1899,19 @@
    * Given an uninstantiated generic function type, try to infer the
    * instantiated generic function type from the surrounding context.
    */
-  DartType _inferGenericInstantiationFromContext(
-      DartType context, DartType type) {
-    TypeSystem ts = _typeSystem;
-    if (context is FunctionType &&
-        type is FunctionType &&
-        ts is StrongTypeSystemImpl) {
-      return ts.inferFunctionTypeInstantiation(_typeProvider, context, type);
+  DartType _inferGenericInstantiationFromContext(AstNode node, DartType type) {
+    if (_strongMode) {
+      TypeSystem ts = _typeSystem;
+      DartType context = InferenceContext.getType(node);
+      if (context is FunctionType &&
+          type is FunctionType &&
+          ts is StrongTypeSystemImpl) {
+        return ts.inferFunctionTypeInstantiation(context, type);
+      }
+    } else if (type is FunctionType) {
+      // In Dart 1 mode we want to implicitly instantiate generic functions to
+      // their bounds always, so we don't get a universal function type.
+      return _typeSystem.instantiateToBounds(type);
     }
     return type;
   }
@@ -1974,6 +1968,8 @@
         }
       }
 
+      // TODO(leafp): remove this again after code has been updated to
+      // use FutureOr on classes that implement Future
       // Special case Future<T>.then upwards inference. It has signature:
       //
       //     <S>(T -> (S | Future<S>)) -> Future<S>
@@ -1986,19 +1982,17 @@
       // ... and finish the inference using that.
       if (argTypes.isNotEmpty && _resolver.isFutureThen(fnType.element)) {
         var firstArgType = argTypes[0];
-        var firstParamType = paramTypes[0] as FunctionType;
-        if (firstArgType is FunctionType) {
+        var firstParamType = paramTypes[0];
+        if (firstArgType is FunctionType &&
+            firstParamType is FunctionType &&
+            !firstParamType.returnType.isDartAsyncFutureOr) {
           var argReturnType = firstArgType.returnType;
           // Skip the inference if we have the top type. It can only lead to
           // worse inference. For example, this happens when the lambda returns
           // S or Future<S> in a conditional.
           if (!argReturnType.isObject && !argReturnType.isDynamic) {
-            DartType paramReturnType = fnType.typeFormals[0].type;
-            if (_resolver.isSubtypeOfFuture(argReturnType)) {
-              // Given an argument of (T) -> Future<S>, instantiate with <S>
-              paramReturnType =
-                  _typeProvider.futureType.instantiate([paramReturnType]);
-            }
+            DartType paramReturnType = _typeProvider.futureOrType
+                .instantiate([fnType.typeFormals[0].type]);
 
             // Adjust the expected parameter type to have this return type.
             var function = new FunctionElementImpl(firstParamType.name, -1)
@@ -2011,8 +2005,9 @@
           }
         }
       }
-      return ts.inferGenericFunctionCall(_typeProvider, fnType, paramTypes,
-          argTypes, fnType.returnType, InferenceContext.getContext(node),
+
+      return ts.inferGenericFunctionCall(fnType, paramTypes, argTypes,
+          fnType.returnType, InferenceContext.getContext(node),
           errorReporter: _resolver.errorReporter, errorNode: errorNode);
     }
     return null;
@@ -2090,14 +2085,10 @@
     // * ExpressionFunctionBody, when the surrounding context had a better type.
     // * BlockFunctionBody, if we inferred a type from yield/return.
     // * we also normalize bottom to dynamic here.
-    if (_strongMode && (computedType.isBottom || computedType.isDynamic)) {
+    if (_strongMode &&
+        (computedType.isDartCoreNull || computedType.isDynamic)) {
       DartType contextType = InferenceContext.getContext(body);
-      if (contextType is FutureUnionType) {
-        // TODO(jmesserly): can we do something better here?
-        computedType = body.isAsynchronous ? contextType.type : _dynamicType;
-      } else {
-        computedType = contextType ?? _dynamicType;
-      }
+      computedType = contextType ?? _dynamicType;
       recordInference = !computedType.isDynamic;
     }
 
@@ -2118,14 +2109,17 @@
    */
   void _inferLocalVariableType(
       VariableDeclaration node, Expression initializer) {
-    if (initializer != null &&
-        (node.parent as VariableDeclarationList).type == null &&
-        (initializer.staticType != null) &&
-        (!initializer.staticType.isBottom)) {
-      VariableElement element = node.element;
-      if (element is LocalVariableElementImpl) {
-        element.type = initializer.staticType;
-        node.name.staticType = initializer.staticType;
+    if (initializer != null) {
+      AstNode parent = node.parent;
+      if (parent is VariableDeclarationList && parent.type == null) {
+        DartType type = resolutionMap.staticTypeForExpression(initializer);
+        if (type != null && !type.isBottom && !type.isDartCoreNull) {
+          VariableElement element = node.element;
+          if (element is LocalVariableElementImpl) {
+            element.type = initializer.staticType;
+            node.name.staticType = initializer.staticType;
+          }
+        }
       }
     }
   }
@@ -2232,23 +2226,6 @@
   }
 
   /**
-   * Return `true` if the given [Type] is the `Future` form the 'dart:async'
-   * library.
-   */
-  bool _isAsyncFutureType(DartType type) =>
-      type is InterfaceType &&
-      type.name == "Future" &&
-      _isAsyncLibrary(type.element.library);
-
-  /**
-   * Return `true` if the given library is the 'dart:async' library.
-   *
-   * @param library the library being tested
-   * @return `true` if the library is 'dart:async'
-   */
-  bool _isAsyncLibrary(LibraryElement library) => library.name == "dart.async";
-
-  /**
    * Return `true` if the given library is the 'dart:html' library.
    *
    * @param library the library being tested
@@ -2258,10 +2235,7 @@
       library != null && "dart.dom.html" == library.name;
 
   /**
-   * Return `true` if the given node is not a type literal.
-   *
-   * @param node the node being tested
-   * @return `true` if the given node is not a type literal
+   * Return `true` if the given [node] is not a type literal.
    */
   bool _isNotTypeLiteral(Identifier node) {
     AstNode parent = node.parent;
@@ -2283,7 +2257,11 @@
    * @param type the propagated type of the node
    */
   void _recordPropagatedType(Expression expression, DartType type) {
-    if (!_strongMode && type != null && !type.isDynamic && !type.isBottom) {
+    if (!_strongMode &&
+        type != null &&
+        !type.isBottom &&
+        !type.isDynamic &&
+        !type.isDartCoreNull) {
       expression.propagatedType = type;
     }
   }
@@ -2307,8 +2285,8 @@
     if (propagatedReturnType == null) {
       return;
     }
-    // Ignore 'bottom' type.
-    if (propagatedReturnType.isBottom) {
+    // Ignore 'Bottom' and 'Null' types.
+    if (propagatedReturnType.isBottom || propagatedReturnType.isDartCoreNull) {
       return;
     }
     // Record only if we inferred more specific type.
@@ -2424,13 +2402,13 @@
     if (expression != null) {
       type = expression.bestType;
     } else {
-      type = BottomTypeImpl.instance;
+      type = _typeProvider.nullType;
     }
     // merge types
     if (result == null) {
       result = type;
     } else {
-      result = _typeSystem.getLeastUpperBound(_typeProvider, result, type);
+      result = _typeSystem.getLeastUpperBound(result, type);
     }
     return null;
   }
diff --git a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
index 4cb8cb6..2139d38 100644
--- a/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart
@@ -5,9 +5,9 @@
 library analyzer.src.generated.testing.ast_test_factory;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/generated/testing/token_factory.dart';
 import 'package:analyzer/src/generated/utilities_dart.dart';
 
@@ -25,14 +25,14 @@
  */
 class AstTestFactory {
   static AdjacentStrings adjacentStrings(List<StringLiteral> strings) =>
-      new AdjacentStrings(strings);
+      astFactory.adjacentStrings(strings);
 
-  static Annotation annotation(Identifier name) => new Annotation(
+  static Annotation annotation(Identifier name) => astFactory.annotation(
       TokenFactory.tokenFromType(TokenType.AT), name, null, null, null);
 
   static Annotation annotation2(Identifier name,
           SimpleIdentifier constructorName, ArgumentList arguments) =>
-      new Annotation(
+      astFactory.annotation(
           TokenFactory.tokenFromType(TokenType.AT),
           name,
           constructorName == null
@@ -42,16 +42,27 @@
           arguments);
 
   static ArgumentList argumentList([List<Expression> arguments]) =>
-      new ArgumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
+      astFactory.argumentList(TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
           arguments, TokenFactory.tokenFromType(TokenType.CLOSE_PAREN));
 
-  static AsExpression asExpression(Expression expression, TypeName type) =>
-      new AsExpression(
+  static AsExpression asExpression(
+          Expression expression, TypeAnnotation type) =>
+      astFactory.asExpression(
           expression, TokenFactory.tokenFromKeyword(Keyword.AS), type);
 
+  static AssertInitializer assertInitializer(
+          Expression condition, Expression message) =>
+      astFactory.assertInitializer(
+          TokenFactory.tokenFromKeyword(Keyword.ASSERT),
+          TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
+          condition,
+          TokenFactory.tokenFromType(TokenType.COMMA),
+          message,
+          TokenFactory.tokenFromType(TokenType.CLOSE_PAREN));
+
   static AssertStatement assertStatement(Expression condition,
           [Expression message]) =>
-      new AssertStatement(
+      astFactory.assertStatement(
           TokenFactory.tokenFromKeyword(Keyword.ASSERT),
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
           condition,
@@ -62,19 +73,19 @@
 
   static AssignmentExpression assignmentExpression(Expression leftHandSide,
           TokenType operator, Expression rightHandSide) =>
-      new AssignmentExpression(
+      astFactory.assignmentExpression(
           leftHandSide, TokenFactory.tokenFromType(operator), rightHandSide);
 
   static BlockFunctionBody asyncBlockFunctionBody(
           [List<Statement> statements]) =>
-      new BlockFunctionBody(
+      astFactory.blockFunctionBody(
           TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"),
           null,
           block(statements));
 
   static ExpressionFunctionBody asyncExpressionFunctionBody(
           Expression expression) =>
-      new ExpressionFunctionBody(
+      astFactory.expressionFunctionBody(
           TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"),
           TokenFactory.tokenFromType(TokenType.FUNCTION),
           expression,
@@ -82,50 +93,49 @@
 
   static BlockFunctionBody asyncGeneratorBlockFunctionBody(
           [List<Statement> statements]) =>
-      new BlockFunctionBody(
+      astFactory.blockFunctionBody(
           TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "async"),
           TokenFactory.tokenFromType(TokenType.STAR),
           block(statements));
 
   static AwaitExpression awaitExpression(Expression expression) =>
-      new AwaitExpression(
+      astFactory.awaitExpression(
           TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "await"),
           expression);
 
   static BinaryExpression binaryExpression(Expression leftOperand,
           TokenType operator, Expression rightOperand) =>
-      new BinaryExpression(
+      astFactory.binaryExpression(
           leftOperand, TokenFactory.tokenFromType(operator), rightOperand);
 
-  static Block block([List<Statement> statements]) => new Block(
+  static Block block([List<Statement> statements]) => astFactory.block(
       TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET),
       statements,
       TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET));
 
   static BlockFunctionBody blockFunctionBody(Block block) =>
-      new BlockFunctionBody(null, null, block);
+      astFactory.blockFunctionBody(null, null, block);
 
   static BlockFunctionBody blockFunctionBody2([List<Statement> statements]) =>
-      new BlockFunctionBody(null, null, block(statements));
+      astFactory.blockFunctionBody(null, null, block(statements));
 
-  static BooleanLiteral booleanLiteral(bool value) => new BooleanLiteral(
+  static BooleanLiteral booleanLiteral(bool value) => astFactory.booleanLiteral(
       value
           ? TokenFactory.tokenFromKeyword(Keyword.TRUE)
           : TokenFactory.tokenFromKeyword(Keyword.FALSE),
       value);
 
-  static BreakStatement breakStatement() => new BreakStatement(
+  static BreakStatement breakStatement() => astFactory.breakStatement(
       TokenFactory.tokenFromKeyword(Keyword.BREAK),
       null,
       TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
-  static BreakStatement breakStatement2(String label) => new BreakStatement(
-      TokenFactory.tokenFromKeyword(Keyword.BREAK),
-      identifier3(label),
-      TokenFactory.tokenFromType(TokenType.SEMICOLON));
+  static BreakStatement breakStatement2(String label) =>
+      astFactory.breakStatement(TokenFactory.tokenFromKeyword(Keyword.BREAK),
+          identifier3(label), TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
   static IndexExpression cascadedIndexExpression(Expression index) =>
-      new IndexExpression.forCascade(
+      astFactory.indexExpressionForCascade(
           TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD),
           TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET),
           index,
@@ -133,7 +143,7 @@
 
   static MethodInvocation cascadedMethodInvocation(String methodName,
           [List<Expression> arguments]) =>
-      new MethodInvocation(
+      astFactory.methodInvocation(
           null,
           TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD),
           identifier3(methodName),
@@ -141,14 +151,14 @@
           argumentList(arguments));
 
   static PropertyAccess cascadedPropertyAccess(String propertyName) =>
-      new PropertyAccess(
+      astFactory.propertyAccess(
           null,
           TokenFactory.tokenFromType(TokenType.PERIOD_PERIOD),
           identifier3(propertyName));
 
   static CascadeExpression cascadeExpression(Expression target,
           [List<Expression> cascadeSections]) =>
-      new CascadeExpression(target, cascadeSections);
+      astFactory.cascadeExpression(target, cascadeSections);
 
   static CatchClause catchClause(String exceptionParameter,
           [List<Statement> statements]) =>
@@ -159,19 +169,19 @@
           [List<Statement> statements]) =>
       catchClause5(null, exceptionParameter, stackTraceParameter, statements);
 
-  static CatchClause catchClause3(TypeName exceptionType,
+  static CatchClause catchClause3(TypeAnnotation exceptionType,
           [List<Statement> statements]) =>
       catchClause5(exceptionType, null, null, statements);
 
   static CatchClause catchClause4(
-          TypeName exceptionType, String exceptionParameter,
+          TypeAnnotation exceptionType, String exceptionParameter,
           [List<Statement> statements]) =>
       catchClause5(exceptionType, exceptionParameter, null, statements);
 
-  static CatchClause catchClause5(TypeName exceptionType,
+  static CatchClause catchClause5(TypeAnnotation exceptionType,
           String exceptionParameter, String stackTraceParameter,
           [List<Statement> statements]) =>
-      new CatchClause(
+      astFactory.catchClause(
           exceptionType == null
               ? null
               : TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "on"),
@@ -200,7 +210,7 @@
           WithClause withClause,
           ImplementsClause implementsClause,
           [List<ClassMember> members]) =>
-      new ClassDeclaration(
+      astFactory.classDeclaration(
           null,
           null,
           abstractKeyword == null
@@ -223,7 +233,7 @@
           TypeName superclass,
           WithClause withClause,
           ImplementsClause implementsClause) =>
-      new ClassTypeAlias(
+      astFactory.classTypeAlias(
           null,
           null,
           TokenFactory.tokenFromKeyword(Keyword.CLASS),
@@ -267,7 +277,7 @@
           String scriptTag,
           List<Directive> directives,
           List<CompilationUnitMember> declarations) =>
-      new CompilationUnit(
+      astFactory.compilationUnit(
           TokenFactory.tokenFromType(TokenType.EOF),
           scriptTag == null ? null : AstTestFactory.scriptTag(scriptTag),
           directives == null ? new List<Directive>() : directives,
@@ -278,7 +288,7 @@
 
   static ConditionalExpression conditionalExpression(Expression condition,
           Expression thenExpression, Expression elseExpression) =>
-      new ConditionalExpression(
+      astFactory.conditionalExpression(
           condition,
           TokenFactory.tokenFromType(TokenType.QUESTION),
           thenExpression,
@@ -290,7 +300,7 @@
           String name,
           FormalParameterList parameters,
           List<ConstructorInitializer> initializers) =>
-      new ConstructorDeclaration(
+      astFactory.constructorDeclaration(
           null,
           null,
           TokenFactory.tokenFromKeyword(Keyword.EXTERNAL),
@@ -317,7 +327,7 @@
           FormalParameterList parameters,
           List<ConstructorInitializer> initializers,
           FunctionBody body) =>
-      new ConstructorDeclaration(
+      astFactory.constructorDeclaration(
           null,
           null,
           null,
@@ -342,7 +352,7 @@
 
   static ConstructorFieldInitializer constructorFieldInitializer(
           bool prefixedWithThis, String fieldName, Expression expression) =>
-      new ConstructorFieldInitializer(
+      astFactory.constructorFieldInitializer(
           prefixedWithThis ? TokenFactory.tokenFromKeyword(Keyword.THIS) : null,
           prefixedWithThis
               ? TokenFactory.tokenFromType(TokenType.PERIOD)
@@ -352,13 +362,13 @@
           expression);
 
   static ConstructorName constructorName(TypeName type, String name) =>
-      new ConstructorName(
+      astFactory.constructorName(
           type,
           name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD),
           name == null ? null : identifier3(name));
 
   static ContinueStatement continueStatement([String label]) =>
-      new ContinueStatement(
+      astFactory.continueStatement(
           TokenFactory.tokenFromKeyword(Keyword.CONTINUE),
           label == null ? null : identifier3(label),
           TokenFactory.tokenFromType(TokenType.SEMICOLON));
@@ -368,8 +378,8 @@
       declaredIdentifier2(keyword, null, identifier);
 
   static DeclaredIdentifier declaredIdentifier2(
-          Keyword keyword, TypeName type, String identifier) =>
-      new DeclaredIdentifier(
+          Keyword keyword, TypeAnnotation type, String identifier) =>
+      astFactory.declaredIdentifier(
           null,
           null,
           keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
@@ -380,16 +390,16 @@
       declaredIdentifier2(Keyword.VAR, null, identifier);
 
   static DeclaredIdentifier declaredIdentifier4(
-          TypeName type, String identifier) =>
+          TypeAnnotation type, String identifier) =>
       declaredIdentifier2(null, type, identifier);
 
   static Comment documentationComment(
       List<Token> tokens, List<CommentReference> references) {
-    return new Comment(tokens, CommentType.DOCUMENTATION, references);
+    return astFactory.documentationComment(tokens, references);
   }
 
   static DoStatement doStatement(Statement body, Expression condition) =>
-      new DoStatement(
+      astFactory.doStatement(
           TokenFactory.tokenFromKeyword(Keyword.DO),
           body,
           TokenFactory.tokenFromKeyword(Keyword.WHILE),
@@ -398,18 +408,18 @@
           TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
           TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
-  static DoubleLiteral doubleLiteral(double value) =>
-      new DoubleLiteral(TokenFactory.tokenFromString(value.toString()), value);
+  static DoubleLiteral doubleLiteral(double value) => astFactory.doubleLiteral(
+      TokenFactory.tokenFromString(value.toString()), value);
 
-  static EmptyFunctionBody emptyFunctionBody() =>
-      new EmptyFunctionBody(TokenFactory.tokenFromType(TokenType.SEMICOLON));
+  static EmptyFunctionBody emptyFunctionBody() => astFactory
+      .emptyFunctionBody(TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
-  static EmptyStatement emptyStatement() =>
-      new EmptyStatement(TokenFactory.tokenFromType(TokenType.SEMICOLON));
+  static EmptyStatement emptyStatement() => astFactory
+      .emptyStatement(TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
   static EnumDeclaration enumDeclaration(
           SimpleIdentifier name, List<EnumConstantDeclaration> constants) =>
-      new EnumDeclaration(
+      astFactory.enumDeclaration(
           null,
           null,
           TokenFactory.tokenFromKeyword(Keyword.ENUM),
@@ -424,7 +434,7 @@
     List<EnumConstantDeclaration> constants =
         new List<EnumConstantDeclaration>(count);
     for (int i = 0; i < count; i++) {
-      constants[i] = new EnumConstantDeclaration(
+      constants[i] = astFactory.enumConstantDeclaration(
           null, null, identifier3(constantNames[i]));
     }
     return enumDeclaration(identifier3(name), constants);
@@ -432,7 +442,7 @@
 
   static ExportDirective exportDirective(List<Annotation> metadata, String uri,
           [List<Combinator> combinators]) =>
-      new ExportDirective(
+      astFactory.exportDirective(
           null,
           metadata,
           TokenFactory.tokenFromKeyword(Keyword.EXPORT),
@@ -446,22 +456,22 @@
       exportDirective(null, uri, combinators);
 
   static ExpressionFunctionBody expressionFunctionBody(Expression expression) =>
-      new ExpressionFunctionBody(
+      astFactory.expressionFunctionBody(
           null,
           TokenFactory.tokenFromType(TokenType.FUNCTION),
           expression,
           TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
   static ExpressionStatement expressionStatement(Expression expression) =>
-      new ExpressionStatement(
+      astFactory.expressionStatement(
           expression, TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
-  static ExtendsClause extendsClause(TypeName type) =>
-      new ExtendsClause(TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type);
+  static ExtendsClause extendsClause(TypeName type) => astFactory.extendsClause(
+      TokenFactory.tokenFromKeyword(Keyword.EXTENDS), type);
 
   static FieldDeclaration fieldDeclaration(bool isStatic, Keyword keyword,
-          TypeName type, List<VariableDeclaration> variables) =>
-      new FieldDeclaration(
+          TypeAnnotation type, List<VariableDeclaration> variables) =>
+      astFactory.fieldDeclaration(
           null,
           null,
           isStatic ? TokenFactory.tokenFromKeyword(Keyword.STATIC) : null,
@@ -473,9 +483,9 @@
       fieldDeclaration(isStatic, keyword, null, variables);
 
   static FieldFormalParameter fieldFormalParameter(
-          Keyword keyword, TypeName type, String identifier,
+          Keyword keyword, TypeAnnotation type, String identifier,
           [FormalParameterList parameterList]) =>
-      new FieldFormalParameter(
+      astFactory.fieldFormalParameter(
           null,
           null,
           keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
@@ -491,7 +501,7 @@
 
   static ForEachStatement forEachStatement(DeclaredIdentifier loopVariable,
           Expression iterator, Statement body) =>
-      new ForEachStatement.withDeclaration(
+      astFactory.forEachStatementWithDeclaration(
           null,
           TokenFactory.tokenFromKeyword(Keyword.FOR),
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
@@ -503,7 +513,7 @@
 
   static ForEachStatement forEachStatement2(
           SimpleIdentifier identifier, Expression iterator, Statement body) =>
-      new ForEachStatement.withReference(
+      astFactory.forEachStatementWithReference(
           null,
           TokenFactory.tokenFromKeyword(Keyword.FOR),
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
@@ -515,7 +525,7 @@
 
   static FormalParameterList formalParameterList(
           [List<FormalParameter> parameters]) =>
-      new FormalParameterList(
+      astFactory.formalParameterList(
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
           parameters,
           null,
@@ -524,7 +534,7 @@
 
   static ForStatement forStatement(Expression initialization,
           Expression condition, List<Expression> updaters, Statement body) =>
-      new ForStatement(
+      astFactory.forStatement(
           TokenFactory.tokenFromKeyword(Keyword.FOR),
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
           null,
@@ -538,7 +548,7 @@
 
   static ForStatement forStatement2(VariableDeclarationList variableList,
           Expression condition, List<Expression> updaters, Statement body) =>
-      new ForStatement(
+      astFactory.forStatement(
           TokenFactory.tokenFromKeyword(Keyword.FOR),
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
           variableList,
@@ -550,9 +560,12 @@
           TokenFactory.tokenFromType(TokenType.CLOSE_PAREN),
           body);
 
-  static FunctionDeclaration functionDeclaration(TypeName type, Keyword keyword,
-          String name, FunctionExpression functionExpression) =>
-      new FunctionDeclaration(
+  static FunctionDeclaration functionDeclaration(
+          TypeAnnotation type,
+          Keyword keyword,
+          String name,
+          FunctionExpression functionExpression) =>
+      astFactory.functionDeclaration(
           null,
           null,
           null,
@@ -562,25 +575,25 @@
           functionExpression);
 
   static FunctionDeclarationStatement functionDeclarationStatement(
-          TypeName type,
+          TypeAnnotation type,
           Keyword keyword,
           String name,
           FunctionExpression functionExpression) =>
-      new FunctionDeclarationStatement(
+      astFactory.functionDeclarationStatement(
           functionDeclaration(type, keyword, name, functionExpression));
 
-  static FunctionExpression functionExpression() =>
-      new FunctionExpression(null, formalParameterList(), blockFunctionBody2());
+  static FunctionExpression functionExpression() => astFactory
+      .functionExpression(null, formalParameterList(), blockFunctionBody2());
 
   static FunctionExpression functionExpression2(
           FormalParameterList parameters, FunctionBody body) =>
-      new FunctionExpression(null, parameters, body);
+      astFactory.functionExpression(null, parameters, body);
 
   static FunctionExpression functionExpression3(
           TypeParameterList typeParameters,
           FormalParameterList parameters,
           FunctionBody body) =>
-      new FunctionExpression(typeParameters, parameters, body);
+      astFactory.functionExpression(typeParameters, parameters, body);
 
   static FunctionExpressionInvocation functionExpressionInvocation(
           Expression function,
@@ -591,37 +604,39 @@
           Expression function,
           [TypeArgumentList typeArguments,
           List<Expression> arguments]) =>
-      new FunctionExpressionInvocation(
+      astFactory.functionExpressionInvocation(
           function, typeArguments, argumentList(arguments));
 
   static FunctionTypedFormalParameter functionTypedFormalParameter(
-          TypeName returnType, String identifier,
+          TypeAnnotation returnType, String identifier,
           [List<FormalParameter> parameters]) =>
-      new FunctionTypedFormalParameter(null, null, returnType,
+      astFactory.functionTypedFormalParameter(null, null, returnType,
           identifier3(identifier), null, formalParameterList(parameters));
 
   static HideCombinator hideCombinator(List<SimpleIdentifier> identifiers) =>
-      new HideCombinator(TokenFactory.tokenFromString("hide"), identifiers);
+      astFactory.hideCombinator(
+          TokenFactory.tokenFromString("hide"), identifiers);
 
   static HideCombinator hideCombinator2(List<String> identifiers) =>
-      new HideCombinator(
+      astFactory.hideCombinator(
           TokenFactory.tokenFromString("hide"), identifierList(identifiers));
 
   static PrefixedIdentifier identifier(
           SimpleIdentifier prefix, SimpleIdentifier identifier) =>
-      new PrefixedIdentifier(
+      astFactory.prefixedIdentifier(
           prefix, TokenFactory.tokenFromType(TokenType.PERIOD), identifier);
 
-  static SimpleIdentifier identifier3(String lexeme) => new SimpleIdentifier(
-      TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, lexeme));
+  static SimpleIdentifier identifier3(String lexeme) =>
+      astFactory.simpleIdentifier(
+          TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, lexeme));
 
   static PrefixedIdentifier identifier4(
           String prefix, SimpleIdentifier identifier) =>
-      new PrefixedIdentifier(identifier3(prefix),
+      astFactory.prefixedIdentifier(identifier3(prefix),
           TokenFactory.tokenFromType(TokenType.PERIOD), identifier);
 
   static PrefixedIdentifier identifier5(String prefix, String identifier) =>
-      new PrefixedIdentifier(
+      astFactory.prefixedIdentifier(
           identifier3(prefix),
           TokenFactory.tokenFromType(TokenType.PERIOD),
           identifier3(identifier));
@@ -641,7 +656,7 @@
 
   static IfStatement ifStatement2(Expression condition, Statement thenStatement,
           Statement elseStatement) =>
-      new IfStatement(
+      astFactory.ifStatement(
           TokenFactory.tokenFromKeyword(Keyword.IF),
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
           condition,
@@ -653,13 +668,13 @@
           elseStatement);
 
   static ImplementsClause implementsClause(List<TypeName> types) =>
-      new ImplementsClause(
+      astFactory.implementsClause(
           TokenFactory.tokenFromKeyword(Keyword.IMPLEMENTS), types);
 
   static ImportDirective importDirective(
           List<Annotation> metadata, String uri, bool isDeferred, String prefix,
           [List<Combinator> combinators]) =>
-      new ImportDirective(
+      astFactory.importDirective(
           null,
           metadata,
           TokenFactory.tokenFromKeyword(Keyword.IMPORT),
@@ -681,7 +696,7 @@
       importDirective(null, uri, false, prefix, combinators);
 
   static IndexExpression indexExpression(Expression array, Expression index) =>
-      new IndexExpression.forTarget(
+      astFactory.indexExpressionForTarget(
           array,
           TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET),
           index,
@@ -690,7 +705,7 @@
   static InstanceCreationExpression instanceCreationExpression(
           Keyword keyword, ConstructorName name,
           [List<Expression> arguments]) =>
-      new InstanceCreationExpression(
+      astFactory.instanceCreationExpression(
           keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
           name,
           argumentList(arguments));
@@ -705,7 +720,7 @@
           [List<Expression> arguments]) =>
       instanceCreationExpression(
           keyword,
-          new ConstructorName(
+          astFactory.constructorName(
               type,
               identifier == null
                   ? null
@@ -713,44 +728,48 @@
               identifier == null ? null : identifier3(identifier)),
           arguments);
 
-  static IntegerLiteral integer(int value) => new IntegerLiteral(
+  static IntegerLiteral integer(int value) => astFactory.integerLiteral(
       TokenFactory.tokenFromTypeAndString(TokenType.INT, value.toString()),
       value);
 
   static InterpolationExpression interpolationExpression(
           Expression expression) =>
-      new InterpolationExpression(
+      astFactory.interpolationExpression(
           TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_EXPRESSION),
           expression,
           TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET));
 
   static InterpolationExpression interpolationExpression2(String identifier) =>
-      new InterpolationExpression(
+      astFactory.interpolationExpression(
           TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_IDENTIFIER),
           identifier3(identifier),
           null);
 
   static InterpolationString interpolationString(
           String contents, String value) =>
-      new InterpolationString(TokenFactory.tokenFromString(contents), value);
+      astFactory.interpolationString(
+          TokenFactory.tokenFromString(contents), value);
 
   static IsExpression isExpression(
-          Expression expression, bool negated, TypeName type) =>
-      new IsExpression(expression, TokenFactory.tokenFromKeyword(Keyword.IS),
-          negated ? TokenFactory.tokenFromType(TokenType.BANG) : null, type);
+          Expression expression, bool negated, TypeAnnotation type) =>
+      astFactory.isExpression(
+          expression,
+          TokenFactory.tokenFromKeyword(Keyword.IS),
+          negated ? TokenFactory.tokenFromType(TokenType.BANG) : null,
+          type);
 
   static Label label(SimpleIdentifier label) =>
-      new Label(label, TokenFactory.tokenFromType(TokenType.COLON));
+      astFactory.label(label, TokenFactory.tokenFromType(TokenType.COLON));
 
   static Label label2(String label) => AstTestFactory.label(identifier3(label));
 
   static LabeledStatement labeledStatement(
           List<Label> labels, Statement statement) =>
-      new LabeledStatement(labels, statement);
+      astFactory.labeledStatement(labels, statement);
 
   static LibraryDirective libraryDirective(
           List<Annotation> metadata, LibraryIdentifier libraryName) =>
-      new LibraryDirective(
+      astFactory.libraryDirective(
           null,
           metadata,
           TokenFactory.tokenFromKeyword(Keyword.LIBRARY),
@@ -763,10 +782,10 @@
 
   static LibraryIdentifier libraryIdentifier(
           List<SimpleIdentifier> components) =>
-      new LibraryIdentifier(components);
+      astFactory.libraryIdentifier(components);
 
   static LibraryIdentifier libraryIdentifier2(List<String> components) {
-    return new LibraryIdentifier(identifierList(components));
+    return astFactory.libraryIdentifier(identifierList(components));
   }
 
   static List list(List<Object> elements) {
@@ -779,7 +798,7 @@
   static ListLiteral listLiteral2(
           Keyword keyword, TypeArgumentList typeArguments,
           [List<Expression> elements]) =>
-      new ListLiteral(
+      astFactory.listLiteral(
           keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
           typeArguments,
           TokenFactory.tokenFromType(TokenType.OPEN_SQUARE_BRACKET),
@@ -788,7 +807,7 @@
 
   static MapLiteral mapLiteral(Keyword keyword, TypeArgumentList typeArguments,
           [List<MapLiteralEntry> entries]) =>
-      new MapLiteral(
+      astFactory.mapLiteral(
           keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
           typeArguments,
           TokenFactory.tokenFromType(TokenType.OPEN_CURLY_BRACKET),
@@ -799,21 +818,21 @@
       mapLiteral(null, null, entries);
 
   static MapLiteralEntry mapLiteralEntry(String key, Expression value) =>
-      new MapLiteralEntry(
+      astFactory.mapLiteralEntry(
           string2(key), TokenFactory.tokenFromType(TokenType.COLON), value);
 
   static MapLiteralEntry mapLiteralEntry2(Expression key, Expression value) =>
-      new MapLiteralEntry(
+      astFactory.mapLiteralEntry(
           key, TokenFactory.tokenFromType(TokenType.COLON), value);
 
   static MethodDeclaration methodDeclaration(
           Keyword modifier,
-          TypeName returnType,
+          TypeAnnotation returnType,
           Keyword property,
           Keyword operator,
           SimpleIdentifier name,
           FormalParameterList parameters) =>
-      new MethodDeclaration(
+      astFactory.methodDeclaration(
           null,
           null,
           TokenFactory.tokenFromKeyword(Keyword.EXTERNAL),
@@ -828,13 +847,13 @@
 
   static MethodDeclaration methodDeclaration2(
           Keyword modifier,
-          TypeName returnType,
+          TypeAnnotation returnType,
           Keyword property,
           Keyword operator,
           SimpleIdentifier name,
           FormalParameterList parameters,
           FunctionBody body) =>
-      new MethodDeclaration(
+      astFactory.methodDeclaration(
           null,
           null,
           null,
@@ -849,14 +868,14 @@
 
   static MethodDeclaration methodDeclaration3(
           Keyword modifier,
-          TypeName returnType,
+          TypeAnnotation returnType,
           Keyword property,
           Keyword operator,
           SimpleIdentifier name,
           TypeParameterList typeParameters,
           FormalParameterList parameters,
           FunctionBody body) =>
-      new MethodDeclaration(
+      astFactory.methodDeclaration(
           null,
           null,
           null,
@@ -872,13 +891,13 @@
   static MethodDeclaration methodDeclaration4(
           {bool external: false,
           Keyword modifier,
-          TypeName returnType,
+          TypeAnnotation returnType,
           Keyword property,
           bool operator: false,
           String name,
           FormalParameterList parameters,
           FunctionBody body}) =>
-      new MethodDeclaration(
+      astFactory.methodDeclaration(
           null,
           null,
           external ? TokenFactory.tokenFromKeyword(Keyword.EXTERNAL) : null,
@@ -894,7 +913,7 @@
   static MethodInvocation methodInvocation(Expression target, String methodName,
           [List<Expression> arguments,
           TokenType operator = TokenType.PERIOD]) =>
-      new MethodInvocation(
+      astFactory.methodInvocation(
           target,
           target == null ? null : TokenFactory.tokenFromType(operator),
           identifier3(methodName),
@@ -909,7 +928,7 @@
           Expression target, String methodName, TypeArgumentList typeArguments,
           [List<Expression> arguments,
           TokenType operator = TokenType.PERIOD]) =>
-      new MethodInvocation(
+      astFactory.methodInvocation(
           target,
           target == null ? null : TokenFactory.tokenFromType(operator),
           identifier3(methodName),
@@ -917,7 +936,7 @@
           argumentList(arguments));
 
   static NamedExpression namedExpression(Label label, Expression expression) =>
-      new NamedExpression(label, expression);
+      astFactory.namedExpression(label, expression);
 
   static NamedExpression namedExpression2(
           String label, Expression expression) =>
@@ -925,7 +944,7 @@
 
   static DefaultFormalParameter namedFormalParameter(
           NormalFormalParameter parameter, Expression expression) =>
-      new DefaultFormalParameter(
+      astFactory.defaultFormalParameter(
           parameter,
           ParameterKind.NAMED,
           expression == null
@@ -933,27 +952,28 @@
               : TokenFactory.tokenFromType(TokenType.COLON),
           expression);
 
-  static NativeClause nativeClause(String nativeCode) => new NativeClause(
-      TokenFactory.tokenFromString("native"), string2(nativeCode));
+  static NativeClause nativeClause(String nativeCode) =>
+      astFactory.nativeClause(
+          TokenFactory.tokenFromString("native"), string2(nativeCode));
 
   static NativeFunctionBody nativeFunctionBody(String nativeMethodName) =>
-      new NativeFunctionBody(
+      astFactory.nativeFunctionBody(
           TokenFactory.tokenFromString("native"),
           string2(nativeMethodName),
           TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
   static NullLiteral nullLiteral() =>
-      new NullLiteral(TokenFactory.tokenFromKeyword(Keyword.NULL));
+      astFactory.nullLiteral(TokenFactory.tokenFromKeyword(Keyword.NULL));
 
   static ParenthesizedExpression parenthesizedExpression(
           Expression expression) =>
-      new ParenthesizedExpression(
+      astFactory.parenthesizedExpression(
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
           expression,
           TokenFactory.tokenFromType(TokenType.CLOSE_PAREN));
 
   static PartDirective partDirective(List<Annotation> metadata, String url) =>
-      new PartDirective(
+      astFactory.partDirective(
           null,
           metadata,
           TokenFactory.tokenFromKeyword(Keyword.PART),
@@ -968,7 +988,7 @@
 
   static PartOfDirective partOfDirective2(
           List<Annotation> metadata, LibraryIdentifier libraryName) =>
-      new PartOfDirective(
+      astFactory.partOfDirective(
           null,
           metadata,
           TokenFactory.tokenFromKeyword(Keyword.PART),
@@ -979,7 +999,7 @@
 
   static DefaultFormalParameter positionalFormalParameter(
           NormalFormalParameter parameter, Expression expression) =>
-      new DefaultFormalParameter(
+      astFactory.defaultFormalParameter(
           parameter,
           ParameterKind.POSITIONAL,
           expression == null ? null : TokenFactory.tokenFromType(TokenType.EQ),
@@ -987,20 +1007,22 @@
 
   static PostfixExpression postfixExpression(
           Expression expression, TokenType operator) =>
-      new PostfixExpression(expression, TokenFactory.tokenFromType(operator));
+      astFactory.postfixExpression(
+          expression, TokenFactory.tokenFromType(operator));
 
   static PrefixExpression prefixExpression(
           TokenType operator, Expression expression) =>
-      new PrefixExpression(TokenFactory.tokenFromType(operator), expression);
+      astFactory.prefixExpression(
+          TokenFactory.tokenFromType(operator), expression);
 
   static PropertyAccess propertyAccess(
           Expression target, SimpleIdentifier propertyName) =>
-      new PropertyAccess(
+      astFactory.propertyAccess(
           target, TokenFactory.tokenFromType(TokenType.PERIOD), propertyName);
 
   static PropertyAccess propertyAccess2(Expression target, String propertyName,
           [TokenType operator = TokenType.PERIOD]) =>
-      new PropertyAccess(target, TokenFactory.tokenFromType(operator),
+      astFactory.propertyAccess(target, TokenFactory.tokenFromType(operator),
           identifier3(propertyName));
 
   static RedirectingConstructorInvocation redirectingConstructorInvocation(
@@ -1010,7 +1032,7 @@
   static RedirectingConstructorInvocation redirectingConstructorInvocation2(
           String constructorName,
           [List<Expression> arguments]) =>
-      new RedirectingConstructorInvocation(
+      astFactory.redirectingConstructorInvocation(
           TokenFactory.tokenFromKeyword(Keyword.THIS),
           constructorName == null
               ? null
@@ -1018,23 +1040,24 @@
           constructorName == null ? null : identifier3(constructorName),
           argumentList(arguments));
 
-  static RethrowExpression rethrowExpression() =>
-      new RethrowExpression(TokenFactory.tokenFromKeyword(Keyword.RETHROW));
+  static RethrowExpression rethrowExpression() => astFactory
+      .rethrowExpression(TokenFactory.tokenFromKeyword(Keyword.RETHROW));
 
   static ReturnStatement returnStatement() => returnStatement2(null);
 
   static ReturnStatement returnStatement2(Expression expression) =>
-      new ReturnStatement(TokenFactory.tokenFromKeyword(Keyword.RETURN),
+      astFactory.returnStatement(TokenFactory.tokenFromKeyword(Keyword.RETURN),
           expression, TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
   static ScriptTag scriptTag(String scriptTag) =>
-      new ScriptTag(TokenFactory.tokenFromString(scriptTag));
+      astFactory.scriptTag(TokenFactory.tokenFromString(scriptTag));
 
   static ShowCombinator showCombinator(List<SimpleIdentifier> identifiers) =>
-      new ShowCombinator(TokenFactory.tokenFromString("show"), identifiers);
+      astFactory.showCombinator(
+          TokenFactory.tokenFromString("show"), identifiers);
 
   static ShowCombinator showCombinator2(List<String> identifiers) =>
-      new ShowCombinator(
+      astFactory.showCombinator(
           TokenFactory.tokenFromString("show"), identifierList(identifiers));
 
   static SimpleFormalParameter simpleFormalParameter(
@@ -1042,8 +1065,8 @@
       simpleFormalParameter2(keyword, null, parameterName);
 
   static SimpleFormalParameter simpleFormalParameter2(
-          Keyword keyword, TypeName type, String parameterName) =>
-      new SimpleFormalParameter(
+          Keyword keyword, TypeAnnotation type, String parameterName) =>
+      astFactory.simpleFormalParameter(
           null,
           null,
           keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
@@ -1054,14 +1077,14 @@
       simpleFormalParameter2(null, null, parameterName);
 
   static SimpleFormalParameter simpleFormalParameter4(
-          TypeName type, String parameterName) =>
+          TypeAnnotation type, String parameterName) =>
       simpleFormalParameter2(null, type, parameterName);
 
   static StringInterpolation string([List<InterpolationElement> elements]) =>
-      new StringInterpolation(elements);
+      astFactory.stringInterpolation(elements);
 
-  static SimpleStringLiteral string2(String content) => new SimpleStringLiteral(
-      TokenFactory.tokenFromString("'$content'"), content);
+  static SimpleStringLiteral string2(String content) => astFactory
+      .simpleStringLiteral(TokenFactory.tokenFromString("'$content'"), content);
 
   static SuperConstructorInvocation superConstructorInvocation(
           [List<Expression> arguments]) =>
@@ -1069,14 +1092,14 @@
 
   static SuperConstructorInvocation superConstructorInvocation2(String name,
           [List<Expression> arguments]) =>
-      new SuperConstructorInvocation(
+      astFactory.superConstructorInvocation(
           TokenFactory.tokenFromKeyword(Keyword.SUPER),
           name == null ? null : TokenFactory.tokenFromType(TokenType.PERIOD),
           name == null ? null : identifier3(name),
           argumentList(arguments));
 
   static SuperExpression superExpression() =>
-      new SuperExpression(TokenFactory.tokenFromKeyword(Keyword.SUPER));
+      astFactory.superExpression(TokenFactory.tokenFromKeyword(Keyword.SUPER));
 
   static SwitchCase switchCase(
           Expression expression, List<Statement> statements) =>
@@ -1084,20 +1107,23 @@
 
   static SwitchCase switchCase2(List<Label> labels, Expression expression,
           List<Statement> statements) =>
-      new SwitchCase(labels, TokenFactory.tokenFromKeyword(Keyword.CASE),
+      astFactory.switchCase(labels, TokenFactory.tokenFromKeyword(Keyword.CASE),
           expression, TokenFactory.tokenFromType(TokenType.COLON), statements);
 
   static SwitchDefault switchDefault(
           List<Label> labels, List<Statement> statements) =>
-      new SwitchDefault(labels, TokenFactory.tokenFromKeyword(Keyword.DEFAULT),
-          TokenFactory.tokenFromType(TokenType.COLON), statements);
+      astFactory.switchDefault(
+          labels,
+          TokenFactory.tokenFromKeyword(Keyword.DEFAULT),
+          TokenFactory.tokenFromType(TokenType.COLON),
+          statements);
 
   static SwitchDefault switchDefault2(List<Statement> statements) =>
       switchDefault(new List<Label>(), statements);
 
   static SwitchStatement switchStatement(
           Expression expression, List<SwitchMember> members) =>
-      new SwitchStatement(
+      astFactory.switchStatement(
           TokenFactory.tokenFromKeyword(Keyword.SWITCH),
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
           expression,
@@ -1112,38 +1138,38 @@
       identifierList.add(
           TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, component));
     }
-    return new SymbolLiteral(
+    return astFactory.symbolLiteral(
         TokenFactory.tokenFromType(TokenType.HASH), identifierList);
   }
 
   static BlockFunctionBody syncBlockFunctionBody(
           [List<Statement> statements]) =>
-      new BlockFunctionBody(
+      astFactory.blockFunctionBody(
           TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"),
           null,
           block(statements));
 
   static BlockFunctionBody syncGeneratorBlockFunctionBody(
           [List<Statement> statements]) =>
-      new BlockFunctionBody(
+      astFactory.blockFunctionBody(
           TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "sync"),
           TokenFactory.tokenFromType(TokenType.STAR),
           block(statements));
 
   static ThisExpression thisExpression() =>
-      new ThisExpression(TokenFactory.tokenFromKeyword(Keyword.THIS));
+      astFactory.thisExpression(TokenFactory.tokenFromKeyword(Keyword.THIS));
 
   static ThrowExpression throwExpression() => throwExpression2(null);
 
   static ThrowExpression throwExpression2(Expression expression) =>
-      new ThrowExpression(
+      astFactory.throwExpression(
           TokenFactory.tokenFromKeyword(Keyword.THROW), expression);
 
   static TopLevelVariableDeclaration topLevelVariableDeclaration(
           Keyword keyword,
-          TypeName type,
+          TypeAnnotation type,
           List<VariableDeclaration> variables) =>
-      new TopLevelVariableDeclaration(
+      astFactory.topLevelVariableDeclaration(
           null,
           null,
           variableDeclarationList(keyword, type, variables),
@@ -1151,7 +1177,7 @@
 
   static TopLevelVariableDeclaration topLevelVariableDeclaration2(
           Keyword keyword, List<VariableDeclaration> variables) =>
-      new TopLevelVariableDeclaration(
+      astFactory.topLevelVariableDeclaration(
           null,
           null,
           variableDeclarationList(keyword, null, variables),
@@ -1166,7 +1192,7 @@
 
   static TryStatement tryStatement3(
           Block body, List<CatchClause> catchClauses, Block finallyClause) =>
-      new TryStatement(
+      astFactory.tryStatement(
           TokenFactory.tokenFromKeyword(Keyword.TRY),
           body,
           catchClauses,
@@ -1175,9 +1201,9 @@
               : TokenFactory.tokenFromKeyword(Keyword.FINALLY),
           finallyClause);
 
-  static FunctionTypeAlias typeAlias(TypeName returnType, String name,
+  static FunctionTypeAlias typeAlias(TypeAnnotation returnType, String name,
           TypeParameterList typeParameters, FormalParameterList parameters) =>
-      new FunctionTypeAlias(
+      astFactory.functionTypeAlias(
           null,
           null,
           TokenFactory.tokenFromKeyword(Keyword.TYPEDEF),
@@ -1187,12 +1213,12 @@
           parameters,
           TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
-  static TypeArgumentList typeArgumentList(List<TypeName> typeNames) {
-    if (typeNames == null || typeNames.length == 0) {
+  static TypeArgumentList typeArgumentList(List<TypeAnnotation> types) {
+    if (types == null || types.length == 0) {
       return null;
     }
-    return new TypeArgumentList(TokenFactory.tokenFromType(TokenType.LT),
-        typeNames, TokenFactory.tokenFromType(TokenType.GT));
+    return astFactory.typeArgumentList(TokenFactory.tokenFromType(TokenType.LT),
+        types, TokenFactory.tokenFromType(TokenType.GT));
   }
 
   /**
@@ -1202,7 +1228,8 @@
    * <b>Note:</b> This method does not correctly handle class elements that have
    * type parameters.
    */
-  static TypeName typeName(ClassElement element, [List<TypeName> arguments]) {
+  static TypeName typeName(ClassElement element,
+      [List<TypeAnnotation> arguments]) {
     SimpleIdentifier name = identifier3(element.name);
     name.staticElement = element;
     TypeName typeName = typeName3(name, arguments);
@@ -1210,17 +1237,18 @@
     return typeName;
   }
 
-  static TypeName typeName3(Identifier name, [List<TypeName> arguments]) =>
-      new TypeName(name, typeArgumentList(arguments));
+  static TypeName typeName3(Identifier name,
+          [List<TypeAnnotation> arguments]) =>
+      astFactory.typeName(name, typeArgumentList(arguments));
 
-  static TypeName typeName4(String name, [List<TypeName> arguments]) =>
-      new TypeName(identifier3(name), typeArgumentList(arguments));
+  static TypeName typeName4(String name, [List<TypeAnnotation> arguments]) =>
+      astFactory.typeName(identifier3(name), typeArgumentList(arguments));
 
   static TypeParameter typeParameter(String name) =>
-      new TypeParameter(null, null, identifier3(name), null, null);
+      astFactory.typeParameter(null, null, identifier3(name), null, null);
 
-  static TypeParameter typeParameter2(String name, TypeName bound) =>
-      new TypeParameter(null, null, identifier3(name),
+  static TypeParameter typeParameter2(String name, TypeAnnotation bound) =>
+      astFactory.typeParameter(null, null, identifier3(name),
           TokenFactory.tokenFromKeyword(Keyword.EXTENDS), bound);
 
   static TypeParameterList typeParameterList([List<String> typeNames]) {
@@ -1231,21 +1259,23 @@
         typeParameters.add(typeParameter(typeName));
       }
     }
-    return new TypeParameterList(TokenFactory.tokenFromType(TokenType.LT),
-        typeParameters, TokenFactory.tokenFromType(TokenType.GT));
+    return astFactory.typeParameterList(
+        TokenFactory.tokenFromType(TokenType.LT),
+        typeParameters,
+        TokenFactory.tokenFromType(TokenType.GT));
   }
 
   static VariableDeclaration variableDeclaration(String name) =>
-      new VariableDeclaration(identifier3(name), null, null);
+      astFactory.variableDeclaration(identifier3(name), null, null);
 
   static VariableDeclaration variableDeclaration2(
           String name, Expression initializer) =>
-      new VariableDeclaration(identifier3(name),
+      astFactory.variableDeclaration(identifier3(name),
           TokenFactory.tokenFromType(TokenType.EQ), initializer);
 
   static VariableDeclarationList variableDeclarationList(Keyword keyword,
-          TypeName type, List<VariableDeclaration> variables) =>
-      new VariableDeclarationList(
+          TypeAnnotation type, List<VariableDeclaration> variables) =>
+      astFactory.variableDeclarationList(
           null,
           null,
           keyword == null ? null : TokenFactory.tokenFromKeyword(keyword),
@@ -1258,9 +1288,9 @@
 
   static VariableDeclarationStatement variableDeclarationStatement(
           Keyword keyword,
-          TypeName type,
+          TypeAnnotation type,
           List<VariableDeclaration> variables) =>
-      new VariableDeclarationStatement(
+      astFactory.variableDeclarationStatement(
           variableDeclarationList(keyword, type, variables),
           TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
@@ -1269,7 +1299,7 @@
       variableDeclarationStatement(keyword, null, variables);
 
   static WhileStatement whileStatement(Expression condition, Statement body) =>
-      new WhileStatement(
+      astFactory.whileStatement(
           TokenFactory.tokenFromKeyword(Keyword.WHILE),
           TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
           condition,
@@ -1277,17 +1307,17 @@
           body);
 
   static WithClause withClause(List<TypeName> types) =>
-      new WithClause(TokenFactory.tokenFromKeyword(Keyword.WITH), types);
+      astFactory.withClause(TokenFactory.tokenFromKeyword(Keyword.WITH), types);
 
   static YieldStatement yieldEachStatement(Expression expression) =>
-      new YieldStatement(
+      astFactory.yieldStatement(
           TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"),
           TokenFactory.tokenFromType(TokenType.STAR),
           expression,
           TokenFactory.tokenFromType(TokenType.SEMICOLON));
 
   static YieldStatement yieldStatement(Expression expression) =>
-      new YieldStatement(
+      astFactory.yieldStatement(
           TokenFactory.tokenFromTypeAndString(TokenType.IDENTIFIER, "yield"),
           null,
           expression,
diff --git a/pkg/analyzer/lib/src/generated/testing/element_factory.dart b/pkg/analyzer/lib/src/generated/testing/element_factory.dart
index 9069137..d6ad245 100644
--- a/pkg/analyzer/lib/src/generated/testing/element_factory.dart
+++ b/pkg/analyzer/lib/src/generated/testing/element_factory.dart
@@ -230,12 +230,12 @@
       functionElement4(functionName, null, null, null, null);
 
   static FunctionElementImpl functionElement2(
-          String functionName, TypeDefiningElement returnElement) =>
-      functionElement3(functionName, returnElement, null, null);
+          String functionName, DartType returnType) =>
+      functionElement3(functionName, returnType, null, null);
 
   static FunctionElementImpl functionElement3(
       String functionName,
-      TypeDefiningElement returnElement,
+      DartType returnType,
       List<TypeDefiningElement> normalParameters,
       List<TypeDefiningElement> optionalParameters) {
     // We don't create parameter elements because we don't have parameter names
@@ -243,12 +243,7 @@
         new FunctionElementImpl(functionName, 0);
     FunctionTypeImpl functionType = new FunctionTypeImpl(functionElement);
     functionElement.type = functionType;
-    // return type
-    if (returnElement == null) {
-      functionElement.returnType = VoidTypeImpl.instance;
-    } else {
-      functionElement.returnType = returnElement.type;
-    }
+    functionElement.returnType = returnType ?? VoidTypeImpl.instance;
     // parameters
     int normalCount = normalParameters == null ? 0 : normalParameters.length;
     int optionalCount =
diff --git a/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart b/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
index 953dcee..cb70a53 100644
--- a/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
+++ b/pkg/analyzer/lib/src/generated/testing/test_type_provider.dart
@@ -64,6 +64,16 @@
   InterfaceType _futureNullType;
 
   /**
+   * The type representing the built-in type 'FutureOr'
+   */
+  InterfaceType _futureOrNullType;
+
+  /**
+   * The type representing the built-in type 'FutureOr'
+   */
+  InterfaceType _futureOrType;
+
+  /**
    * The type representing the built-in type 'Future'
    */
   InterfaceType _futureType;
@@ -262,6 +272,34 @@
   }
 
   @override
+  InterfaceType get futureOrNullType {
+    if (_futureOrNullType == null) {
+      _futureOrNullType = futureOrType.instantiate(<DartType>[nullType]);
+    }
+    return _futureOrNullType;
+  }
+
+  @override
+  InterfaceType get futureOrType {
+    if (_futureOrType == null) {
+      Source asyncSource = _context.sourceFactory.forUri(DartSdk.DART_ASYNC);
+      _context.setContents(asyncSource, "");
+      CompilationUnitElementImpl asyncUnit =
+          new CompilationUnitElementImpl("async.dart");
+      LibraryElementImpl asyncLibrary = new LibraryElementImpl.forNode(
+          _context, AstTestFactory.libraryIdentifier2(["dart.async"]));
+      asyncLibrary.definingCompilationUnit = asyncUnit;
+      asyncUnit.librarySource = asyncUnit.source = asyncSource;
+
+      ClassElementImpl futureOr =
+          ElementFactory.classElement2("FutureOr", ["T"]);
+      _futureOrType = futureOr.type;
+      asyncUnit.types = <ClassElement>[futureOr];
+    }
+    return _futureOrType;
+  }
+
+  @override
   InterfaceType get futureType {
     if (_futureType == null) {
       Source asyncSource = _context.sourceFactory.forUri(DartSdk.DART_ASYNC);
@@ -551,6 +589,7 @@
     //
     objectType;
     boolType;
+    nullType;
     stringType;
     //
     // Add the methods.
diff --git a/pkg/analyzer/lib/src/generated/type_system.dart b/pkg/analyzer/lib/src/generated/type_system.dart
index 2f42296..1e1d182 100644
--- a/pkg/analyzer/lib/src/generated/type_system.dart
+++ b/pkg/analyzer/lib/src/generated/type_system.dart
@@ -20,132 +20,22 @@
     show AnalysisContext, AnalysisOptionsImpl;
 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
 import 'package:analyzer/src/generated/utilities_dart.dart' show ParameterKind;
-import 'package:analyzer/src/generated/utilities_general.dart'
-    show JenkinsSmiHash;
 
 bool _isBottom(DartType t, {bool dynamicIsBottom: false}) {
-  return (t.isDynamic && dynamicIsBottom) || t.isBottom;
+  return (t.isDynamic && dynamicIsBottom) || t.isBottom || t.isDartCoreNull;
 }
 
 bool _isTop(DartType t, {bool dynamicIsBottom: false}) {
   // TODO(leafp): Document the rules in play here
+  if (t.isDartAsyncFutureOr) {
+    return _isTop((t as InterfaceType).typeArguments[0]);
+  }
   return (t.isDynamic && !dynamicIsBottom) || t.isObject;
 }
 
 typedef bool _GuardedSubtypeChecker<T>(T t1, T t2, Set<Element> visited);
 
 /**
- * A special union type of `Future<T> | T` used for Strong Mode inference.
- */
-class FutureUnionType extends TypeImpl {
-  // TODO(jmesserly): a Set would be better.
-  //
-  // For now we know `Future<T> | T` is the only valid use, so we can rely on
-  // the order, which simplifies some things.
-  //
-  // This will need clean up before this can function as a real union type.
-  final List<DartType> _types;
-
-  /**
-   * Creates a union of `Future<T> | T`.
-   */
-  FutureUnionType._(DartType type, TypeProvider provider, TypeSystem system)
-      : _types = [
-          provider.futureType.instantiate([type]),
-          type
-        ],
-        super(null, null);
-
-  DartType get futureOfType => _types[0];
-
-  @override
-  int get hashCode {
-    int hash = 0;
-    for (var t in types) {
-      hash = JenkinsSmiHash.combine(hash, t.hashCode);
-    }
-    return JenkinsSmiHash.finish(hash);
-  }
-
-  DartType get type => _types[1];
-
-  Iterable<DartType> get types => _types;
-
-  @override
-  bool operator ==(Object obj) {
-    if (obj is FutureUnionType) {
-      if (identical(obj, this)) return true;
-      return types.length == obj.types.length &&
-          types.toSet().containsAll(obj.types);
-    }
-    return false;
-  }
-
-  @override
-  void appendTo(StringBuffer buffer) {
-    buffer.write('(');
-    for (int i = 0; i < _types.length; i++) {
-      if (i != 0) {
-        buffer.write(' | ');
-      }
-      (_types[i] as TypeImpl).appendTo(buffer);
-    }
-    buffer.write(')');
-  }
-
-  @override
-  bool isMoreSpecificThan(DartType type,
-          [bool withDynamic = false, Set<Element> visitedElements]) =>
-      throw new UnsupportedError(
-          'Future unions are not part of the Dart 1 type system');
-
-  @override
-  TypeImpl pruned(List<FunctionTypeAliasElement> prune) =>
-      throw new UnsupportedError('Future unions are not substituted');
-
-  @override
-  DartType substitute2(List<DartType> args, List<DartType> params,
-          [List<FunctionTypeAliasElement> prune]) =>
-      throw new UnsupportedError('Future unions are not used in typedefs');
-
-  /**
-   * Creates a union of `T | Future<T>`, unless `T` is already a future or a
-   * future-union, in which case it simply returns `T`.
-   *
-   * Conceptually this is used as the inverse of the `flatten(T)` operation,
-   * defined as:
-   *
-   * - `flatten(Future<T>) -> T`
-   * - `flatten(T) -> T`
-   *
-   * Thus the inverse will give us `T | Future<T>`.
-   *
-   * If [type] is top (dynamic or Object) then the resulting union type is
-   * equivalent to top, so we simply return it.
-   *
-   * For a similar reason `Future<T> | Future<Future<T>>` is equivalent to just
-   * `Future<T>`, so we return it. Note that it is not possible to get a
-   * `Future<T>` as a result of `flatten`, so a this case likely indicates a
-   * type error in the code, but it will be reported elsewhere.
-   */
-  static DartType from(
-      DartType type, TypeProvider provider, TypeSystem system) {
-    if (_isTop(type)) {
-      return type;
-    }
-    if (!identical(type, type.flattenFutures(system))) {
-      // As noted above, this most likely represents erroneous input.
-      return type;
-    }
-
-    if (type is FutureUnionType) {
-      return type;
-    }
-    return new FutureUnionType._(type, provider, system);
-  }
-}
-
-/**
  * Implementation of [TypeSystem] using the strong mode rules.
  * https://github.com/dart-lang/dev_compiler/blob/master/STRONG_MODE.md
  */
@@ -162,43 +52,21 @@
    */
   final List<String> nonnullableTypes;
 
-  StrongTypeSystemImpl(
+  final TypeProvider typeProvider;
+
+  StrongTypeSystemImpl(this.typeProvider,
       {this.implicitCasts: true,
       this.nonnullableTypes: AnalysisOptionsImpl.NONNULLABLE_TYPES});
 
+  @override
+  bool get isStrong => true;
+
   bool anyParameterType(FunctionType ft, bool predicate(DartType t)) {
     return ft.parameters.any((p) => predicate(p.type));
   }
 
   @override
-  DartType tryPromoteToType(DartType to, DartType from) {
-    // Allow promoting to a subtype, for example:
-    //
-    //     f(Base b) {
-    //       if (b is SubTypeOfBase) {
-    //         // promote `b` to SubTypeOfBase for this block
-    //       }
-    //     }
-    //
-    // This allows the variable to be used wherever the supertype (here `Base`)
-    // is expected, while gaining a more precise type.
-    if (isSubtypeOf(to, from)) {
-      return to;
-    }
-    // For a type parameter `T extends U`, allow promoting the upper bound
-    // `U` to `S` where `S <: U`, yielding a type parameter `T extends S`.
-    if (from is TypeParameterType) {
-      if (isSubtypeOf(to, from.resolveToBound(DynamicTypeImpl.instance))) {
-        return new TypeParameterMember(from.element, null, to).type;
-      }
-    }
-
-    return null;
-  }
-
-  @override
-  FunctionType functionTypeToConcreteType(
-      TypeProvider typeProvider, FunctionType t) {
+  FunctionType functionTypeToConcreteType(FunctionType t) {
     // TODO(jmesserly): should we use a real "fuzzyArrow" bit on the function
     // type? That would allow us to implement this in the subtype relation.
     // TODO(jmesserly): we'll need to factor this differently if we want to
@@ -228,6 +96,17 @@
 
   /**
    * Given a type t, if t is an interface type with a call method
+   * defined, return the definite function type for the call method,
+   * otherwise return null.
+   */
+  FunctionType getCallMethodDefiniteType(DartType t) {
+    var type = getCallMethodType(t);
+    if (type == null) return type;
+    return functionTypeToConcreteType(type);
+  }
+
+  /**
+   * Given a type t, if t is an interface type with a call method
    * defined, return the function type for the call method, otherwise
    * return null.
    */
@@ -239,8 +118,7 @@
   }
 
   /// Computes the greatest lower bound of [type1] and [type2].
-  DartType getGreatestLowerBound(
-      TypeProvider provider, DartType type1, DartType type2,
+  DartType getGreatestLowerBound(DartType type1, DartType type2,
       {dynamicIsBottom: false}) {
     // The greatest lower bound relation is reflexive.
     if (identical(type1, type2)) {
@@ -271,7 +149,7 @@
 
     // Function types have structural GLB.
     if (type1 is FunctionType && type2 is FunctionType) {
-      return _functionGreatestLowerBound(provider, type1, type2);
+      return _functionGreatestLowerBound(type1, type2);
     }
 
     // Otherwise, the GLB of two types is one of them it if it is a subtype of
@@ -285,7 +163,7 @@
     }
 
     // No subtype relation, so no known GLB.
-    return provider.bottomType;
+    return typeProvider.bottomType;
   }
 
   /**
@@ -308,8 +186,7 @@
    * Compute the least upper bound of two types.
    */
   @override
-  DartType getLeastUpperBound(
-      TypeProvider typeProvider, DartType type1, DartType type2,
+  DartType getLeastUpperBound(DartType type1, DartType type2,
       {bool dynamicIsBottom: false}) {
     if (isNullableType(type1) && isNonNullableType(type2)) {
       assert(type2 is InterfaceType);
@@ -319,8 +196,8 @@
       assert(type1 is InterfaceType);
       type1 = getLeastNullableSupertype(type1 as InterfaceType);
     }
-    return super.getLeastUpperBound(typeProvider, type1, type2,
-        dynamicIsBottom: dynamicIsBottom);
+    return super
+        .getLeastUpperBound(type1, type2, dynamicIsBottom: dynamicIsBottom);
   }
 
   /**
@@ -334,7 +211,7 @@
    * uninstantiated, or a [fnType] that is already instantiated, it will have
    * no effect and return [fnType].
    */
-  FunctionType inferFunctionTypeInstantiation(TypeProvider typeProvider,
+  FunctionType inferFunctionTypeInstantiation(
       FunctionType contextType, FunctionType fnType) {
     if (contextType.typeFormals.isNotEmpty || fnType.typeFormals.isEmpty) {
       return fnType;
@@ -388,7 +265,6 @@
   /// parameter Tj. Instead we track Uj and Lj where U is the upper bound and
   /// L is the lower bound of that type parameter.
   /*=T*/ inferGenericFunctionCall/*<T extends ParameterizedType>*/(
-      TypeProvider typeProvider,
       /*=T*/ genericType,
       List<DartType> declaredParameterTypes,
       List<DartType> argumentTypes,
@@ -429,42 +305,97 @@
   /**
    * Given a [DartType] [type], if [type] is an uninstantiated
    * parameterized type then instantiate the parameters to their
-   * bounds. Specifically, if [type] is of the form
-   * `<T0 extends B0, ... Tn extends Bn>.F` or
-   * `class C<T0 extends B0, ... Tn extends Bn> {...}`
-   * (where Bi is implicitly dynamic if absent),
-   * compute `{I0/T0, ..., In/Tn}F or C<I0, ..., In>` respectively
-   * where I_(i+1) = {I0/T0, ..., Ii/Ti, dynamic/T_(i+1)}B_(i+1).
-   * That is, we instantiate the generic with its bounds, replacing
-   * each Ti in Bi with dynamic to get Ii, and then replacing Ti with
-   * Ii in all of the remaining bounds.
+   * bounds. See the issue for the algorithm description.
+   *
+   * https://github.com/dart-lang/sdk/issues/27526#issuecomment-260021397
+   *
+   * TODO(scheglov) Move this method to elements for classes, typedefs,
+   * and generic functions; compute lazily and cache.
    */
-  DartType instantiateToBounds(DartType type) {
+  DartType instantiateToBounds(DartType type, {List<bool> hasError}) {
     List<TypeParameterElement> typeFormals = typeFormalsAsElements(type);
     int count = typeFormals.length;
     if (count == 0) {
       return type;
     }
 
-    // We build up a substitution replacing bound parameters with
-    // their instantiated bounds, {substituted/variables}
-    List<DartType> substituted = new List<DartType>();
-    List<DartType> variables = new List<DartType>();
-    for (int i = 0; i < count; i++) {
-      TypeParameterElement param = typeFormals[i];
-      DartType bound = param.bound ?? DynamicTypeImpl.instance;
-      DartType variable = param.type;
-      // For each Ti extends Bi, first compute Ii by replacing
-      // Ti in Bi with dynamic (simultaneously replacing all
-      // of the previous Tj (j < i) with their instantiated bounds.
-      substituted.add(DynamicTypeImpl.instance);
-      variables.add(variable);
-      // Now update the substitution to replace Ti with Ii instead
-      // of dynamic in subsequent rounds.
-      substituted[i] = bound.substitute2(substituted, variables);
+    Set<TypeParameterType> all = new Set<TypeParameterType>();
+    Map<TypeParameterType, DartType> defaults = {}; // all ground
+    Map<TypeParameterType, DartType> partials = {}; // not ground
+
+    for (TypeParameterElement typeParameterElement in typeFormals) {
+      TypeParameterType typeParameter = typeParameterElement.type;
+      all.add(typeParameter);
+      if (typeParameter.bound == null) {
+        defaults[typeParameter] = DynamicTypeImpl.instance;
+      } else {
+        partials[typeParameter] = typeParameter.bound;
+      }
     }
 
-    return instantiateType(type, substituted);
+    List<TypeParameterType> getFreeParameters(DartType type) {
+      List<TypeParameterType> parameters = null;
+
+      void appendParameters(DartType type) {
+        if (type is TypeParameterType && all.contains(type)) {
+          parameters ??= <TypeParameterType>[];
+          parameters.add(type);
+        } else if (type is ParameterizedType) {
+          type.typeArguments.forEach(appendParameters);
+        }
+      }
+
+      appendParameters(type);
+      return parameters;
+    }
+
+    bool hasProgress = true;
+    while (hasProgress) {
+      hasProgress = false;
+      for (TypeParameterType parameter in partials.keys) {
+        DartType value = partials[parameter];
+        List<TypeParameterType> freeParameters = getFreeParameters(value);
+        if (freeParameters == null) {
+          defaults[parameter] = value;
+          partials.remove(parameter);
+          hasProgress = true;
+          break;
+        } else if (freeParameters.every(defaults.containsKey)) {
+          defaults[parameter] = value.substitute2(
+              defaults.values.toList(), defaults.keys.toList());
+          partials.remove(parameter);
+          hasProgress = true;
+          break;
+        }
+      }
+    }
+
+    // If we stopped making progress, and not all types are ground,
+    // then the whole type is malbounded and an error should be reported
+    // if errors are requested, and a partially completed type should
+    // be returned.
+    if (partials.isNotEmpty) {
+      if (hasError != null) {
+        hasError[0] = true;
+      }
+      var domain = defaults.keys.toList();
+      var range = defaults.values.toList();
+      // Build a substitution Phi mapping each uncompleted type variable to
+      // dynamic, and each completed type variable to its default.
+      for (TypeParameterType parameter in partials.keys) {
+        domain.add(parameter);
+        range.add(DynamicTypeImpl.instance);
+      }
+      // Set the default for an uncompleted type variable (T extends B)
+      // to be Phi(B)
+      for (TypeParameterType parameter in partials.keys) {
+        defaults[parameter] = partials[parameter].substitute2(range, domain);
+      }
+    }
+
+    List<DartType> orderedArguments =
+        typeFormals.map((p) => defaults[p.type]).toList();
+    return instantiateType(type, orderedArguments);
   }
 
   @override
@@ -577,12 +508,8 @@
   }
 
   @override
-  DartType refineBinaryExpressionType(
-      TypeProvider typeProvider,
-      DartType leftType,
-      TokenType operator,
-      DartType rightType,
-      DartType currentType) {
+  DartType refineBinaryExpressionType(DartType leftType, TokenType operator,
+      DartType rightType, DartType currentType) {
     if (leftType is TypeParameterType &&
         leftType.element.bound == typeProvider.numType) {
       if (rightType == leftType || rightType == typeProvider.intType) {
@@ -605,14 +532,40 @@
       }
       return currentType;
     }
-    return super.refineBinaryExpressionType(
-        typeProvider, leftType, operator, rightType, currentType);
+    return super
+        .refineBinaryExpressionType(leftType, operator, rightType, currentType);
   }
 
   @override
-  DartType typeToConcreteType(TypeProvider typeProvider, DartType t) {
+  DartType tryPromoteToType(DartType to, DartType from) {
+    // Allow promoting to a subtype, for example:
+    //
+    //     f(Base b) {
+    //       if (b is SubTypeOfBase) {
+    //         // promote `b` to SubTypeOfBase for this block
+    //       }
+    //     }
+    //
+    // This allows the variable to be used wherever the supertype (here `Base`)
+    // is expected, while gaining a more precise type.
+    if (isSubtypeOf(to, from)) {
+      return to;
+    }
+    // For a type parameter `T extends U`, allow promoting the upper bound
+    // `U` to `S` where `S <: U`, yielding a type parameter `T extends S`.
+    if (from is TypeParameterType) {
+      if (isSubtypeOf(to, from.resolveToBound(DynamicTypeImpl.instance))) {
+        return new TypeParameterMember(from.element, null, to).type;
+      }
+    }
+
+    return null;
+  }
+
+  @override
+  DartType typeToConcreteType(DartType t) {
     if (t is FunctionType) {
-      return functionTypeToConcreteType(typeProvider, t);
+      return functionTypeToConcreteType(t);
     }
     return t;
   }
@@ -634,8 +587,7 @@
    *
    * - Use the GLB of their return types.
    */
-  DartType _functionGreatestLowerBound(
-      TypeProvider provider, FunctionType f, FunctionType g) {
+  DartType _functionGreatestLowerBound(FunctionType f, FunctionType g) {
     // Calculate the LUB of each corresponding pair of parameters.
     List<ParameterElement> parameters = [];
 
@@ -646,8 +598,7 @@
       DartType paramType;
       if (fType != null && gType != null) {
         // If both functions have this parameter, include both of their types.
-        paramType =
-            getLeastUpperBound(provider, fType, gType, dynamicIsBottom: true);
+        paramType = getLeastUpperBound(fType, gType, dynamicIsBottom: true);
       } else {
         paramType = fType ?? gType;
       }
@@ -720,18 +671,16 @@
 
     // Edge case. Dart does not support functions with both optional positional
     // and named parameters. If we would synthesize that, give up.
-    if (hasPositional && hasNamed) return provider.bottomType;
+    if (hasPositional && hasNamed) return typeProvider.bottomType;
 
     // Calculate the GLB of the return type.
-    DartType returnType =
-        getGreatestLowerBound(provider, f.returnType, g.returnType);
+    DartType returnType = getGreatestLowerBound(f.returnType, g.returnType);
     return new FunctionElementImpl.synthetic(parameters, returnType).type;
   }
 
   @override
-  DartType _functionParameterBound(
-          TypeProvider provider, DartType f, DartType g) =>
-      getGreatestLowerBound(provider, f, g, dynamicIsBottom: true);
+  DartType _functionParameterBound(DartType f, DartType g) =>
+      getGreatestLowerBound(f, g, dynamicIsBottom: true);
 
   /// Given a type return its name prepended with the URI to its containing
   /// library and separated by a comma.
@@ -760,14 +709,6 @@
     };
   }
 
-  /// If [t1] or [t2] is a type parameter we are inferring, update its bound.
-  /// Returns `true` if we could possibly find a compatible type,
-  /// otherwise `false`.
-  bool _inferTypeParameterSubtypeOf(
-      DartType t1, DartType t2, Set<Element> visited) {
-    return false;
-  }
-
   /**
    * This currently does not implement a very complete least upper bound
    * algorithm, but handles a couple of the very common cases that are
@@ -791,8 +732,7 @@
    * TODO(leafp): Figure out the right final algorithm and implement it.
    */
   @override
-  DartType _interfaceLeastUpperBound(
-      TypeProvider provider, InterfaceType type1, InterfaceType type2) {
+  DartType _interfaceLeastUpperBound(InterfaceType type1, InterfaceType type2) {
     if (isSubtypeOf(type1, type2)) {
       return type2;
     }
@@ -806,14 +746,14 @@
       assert(tArgs1.length == tArgs2.length);
       List<DartType> tArgs = new List(tArgs1.length);
       for (int i = 0; i < tArgs1.length; i++) {
-        tArgs[i] = getLeastUpperBound(provider, tArgs1[i], tArgs2[i]);
+        tArgs[i] = getLeastUpperBound(tArgs1[i], tArgs2[i]);
       }
       InterfaceTypeImpl lub = new InterfaceTypeImpl(type1.element);
       lub.typeArguments = tArgs;
       return lub;
     }
     return InterfaceTypeImpl.computeLeastUpperBound(type1, type2) ??
-        provider.dynamicType;
+        typeProvider.dynamicType;
   }
 
   /// Check that [f1] is a subtype of [f2].
@@ -891,12 +831,11 @@
 
     // Guard recursive calls
     _GuardedSubtypeChecker<DartType> guardedSubtype = _guard(_isSubtypeOf);
-    _GuardedSubtypeChecker<DartType> guardedInferTypeParameter =
-        _guard(_inferTypeParameterSubtypeOf);
 
     // The types are void, dynamic, bottom, interface types, function types,
-    // and type parameters. We proceed by eliminating these different classes
-    // from consideration.
+    // FutureOr<T> and type parameters.
+    //
+    // We proceed by eliminating these different classes from consideration.
 
     // Trivially true.
     if (_isTop(t2, dynamicIsBottom: dynamicIsBottom) ||
@@ -907,7 +846,30 @@
     // Trivially false.
     if (_isTop(t1, dynamicIsBottom: dynamicIsBottom) ||
         _isBottom(t2, dynamicIsBottom: dynamicIsBottom)) {
-      return guardedInferTypeParameter(t1, t2, visited);
+      return false;
+    }
+
+    // Handle FutureOr<T> union type.
+    if (t1 is InterfaceType && t1.isDartAsyncFutureOr) {
+      var t1TypeArg = t1.typeArguments[0];
+      if (t2 is InterfaceType && t2.isDartAsyncFutureOr) {
+        var t2TypeArg = t2.typeArguments[0];
+        // FutureOr<A> <: FutureOr<B> iff A <: B
+        return isSubtypeOf(t1TypeArg, t2TypeArg);
+      }
+
+      // given t1 is Future<A> | A, then:
+      // (Future<A> | A) <: t2 iff Future<A> <: t2 and A <: t2.
+      var t1Future = typeProvider.futureType.instantiate([t1TypeArg]);
+      return isSubtypeOf(t1Future, t2) && isSubtypeOf(t1TypeArg, t2);
+    }
+
+    if (t2 is InterfaceType && t2.isDartAsyncFutureOr) {
+      // given t2 is Future<A> | A, then:
+      // t1 <: (Future<A> | A) iff t1 <: Future<A> or t1 <: A
+      var t2TypeArg = t2.typeArguments[0];
+      var t2Future = typeProvider.futureType.instantiate([t2TypeArg]);
+      return isSubtypeOf(t1, t2Future) || isSubtypeOf(t1, t2TypeArg);
     }
 
     // S <: T where S is a type variable
@@ -920,28 +882,11 @@
           guardedSubtype(t1.bound, t2.bound, visited)) {
         return true;
       }
-      if (guardedInferTypeParameter(t1, t2, visited)) {
-        return true;
-      }
       DartType bound = t1.element.bound;
       return bound == null ? false : guardedSubtype(bound, t2, visited);
     }
-
     if (t2 is TypeParameterType) {
-      return guardedInferTypeParameter(t1, t2, visited);
-    }
-
-    if (t1 is FutureUnionType) {
-      // given t1 is Future<A> | A, then:
-      // (Future<A> | A) <: t2 iff t2 <: Future<A> and t2 <: A.
-      return guardedSubtype(t1.futureOfType, t2, visited) &&
-          guardedSubtype(t1.type, t2, visited);
-    }
-    if (t2 is FutureUnionType) {
-      // given t2 is Future<A> | A, then:
-      // t1 <: (Future<A> | A) iff t1 <: Future<A> or t1 <: A
-      return guardedSubtype(t1, t2.futureOfType, visited) ||
-          guardedSubtype(t1, t2.type, visited);
+      return false;
     }
 
     // Void only appears as the return type of a function, and we handle it
@@ -954,8 +899,8 @@
       return t1.isVoid && t2.isVoid;
     }
 
-    // We've eliminated void, dynamic, bottom, and type parameters.  The only
-    // cases are the combinations of interface type and function type.
+    // We've eliminated void, dynamic, bottom, type parameters, and FutureOr.
+    // The only cases are the combinations of interface type and function type.
 
     // A function type can only subtype an interface type if
     // the interface type is Function
@@ -967,7 +912,7 @@
     // the interface type declares a call method with a type
     // which is a super type of the function type.
     if (t1 is InterfaceType && t2 is FunctionType) {
-      var callType = getCallMethodType(t1);
+      var callType = getCallMethodDefiniteType(t1);
       return (callType != null) && _isFunctionSubtypeOf(callType, t2);
     }
 
@@ -1014,8 +959,7 @@
    * the "inheritance" chain extended by the bounds placed on the variables.
    */
   @override
-  DartType _typeParameterLeastUpperBound(
-      TypeProvider provider, DartType type1, DartType type2) {
+  DartType _typeParameterLeastUpperBound(DartType type1, DartType type2) {
     if (isSubtypeOf(type1, type2)) {
       return type2;
     }
@@ -1024,16 +968,16 @@
     }
     if (type1 is TypeParameterType) {
       type1 = type1
-          .resolveToBound(provider.objectType)
-          .substitute2([provider.objectType], [type1]);
-      return getLeastUpperBound(provider, type1, type2);
+          .resolveToBound(typeProvider.objectType)
+          .substitute2([typeProvider.objectType], [type1]);
+      return getLeastUpperBound(type1, type2);
     }
     // We should only be called when at least one of the types is a
     // TypeParameterType
     type2 = type2
-        .resolveToBound(provider.objectType)
-        .substitute2([provider.objectType], [type2]);
-    return getLeastUpperBound(provider, type1, type2);
+        .resolveToBound(typeProvider.objectType)
+        .substitute2([typeProvider.objectType], [type2]);
+    return getLeastUpperBound(type1, type2);
   }
 }
 
@@ -1046,18 +990,14 @@
  */
 abstract class TypeSystem {
   /**
-   * Tries to promote from the first type from the second type, and returns the
-   * promoted type if it succeeds, otherwise null.
-   *
-   * In the Dart 1 type system, it is not possible to promote from or to
-   * `dynamic`, and we must be promoting to a more specific type, see
-   * [isMoreSpecificThan]. Also it will always return the promote [to] type or
-   * null.
-   *
-   * In strong mode, this can potentially return a different type, see
-   * the override in [StrongTypeSystemImpl].
+   * Whether the type system is strong or not.
    */
-  DartType tryPromoteToType(DartType to, DartType from);
+  bool get isStrong;
+
+  /**
+   * The provider of types for the system
+   */
+  TypeProvider get typeProvider;
 
   /**
    * Make a function type concrete.
@@ -1075,14 +1015,12 @@
    * Only the outer-most arrow can be strict. Any others must be fuzzy, because
    * we don't know what function value will be passed there.
    */
-  FunctionType functionTypeToConcreteType(
-      TypeProvider typeProvider, FunctionType t);
+  FunctionType functionTypeToConcreteType(FunctionType t);
 
   /**
    * Compute the least upper bound of two types.
    */
-  DartType getLeastUpperBound(
-      TypeProvider typeProvider, DartType type1, DartType type2,
+  DartType getLeastUpperBound(DartType type1, DartType type2,
       {bool dynamicIsBottom: false}) {
     // The least upper bound relation is reflexive.
     if (identical(type1, type2)) {
@@ -1107,7 +1045,7 @@
     }
 
     if (type1 is TypeParameterType || type2 is TypeParameterType) {
-      return _typeParameterLeastUpperBound(typeProvider, type1, type2);
+      return _typeParameterLeastUpperBound(type1, type2);
     }
 
     // The least upper bound of a function type and an interface type T is the
@@ -1122,11 +1060,11 @@
     // At this point type1 and type2 should both either be interface types or
     // function types.
     if (type1 is InterfaceType && type2 is InterfaceType) {
-      return _interfaceLeastUpperBound(typeProvider, type1, type2);
+      return _interfaceLeastUpperBound(type1, type2);
     }
 
     if (type1 is FunctionType && type2 is FunctionType) {
-      return _functionLeastUpperBound(typeProvider, type1, type2);
+      return _functionLeastUpperBound(type1, type2);
     }
 
     // Should never happen. As a defensive measure, return the dynamic type.
@@ -1141,7 +1079,7 @@
    * classic Dart `dynamic` will be used for all type arguments, whereas
    * strong mode prefers the actual bound type if it was specified.
    */
-  DartType instantiateToBounds(DartType type);
+  DartType instantiateToBounds(DartType type, {List<bool> hasError});
 
   /**
    * Given a [DartType] [type] and a list of types
@@ -1222,12 +1160,8 @@
    * Attempts to make a better guess for the type of a binary with the given
    * [operator], given that resolution has so far produced the [currentType].
    */
-  DartType refineBinaryExpressionType(
-      TypeProvider typeProvider,
-      DartType leftType,
-      TokenType operator,
-      DartType rightType,
-      DartType currentType) {
+  DartType refineBinaryExpressionType(DartType leftType, TokenType operator,
+      DartType rightType, DartType currentType) {
     // bool
     if (operator == TokenType.AMPERSAND_AMPERSAND ||
         operator == TokenType.BAR_BAR ||
@@ -1272,6 +1206,20 @@
   }
 
   /**
+   * Tries to promote from the first type from the second type, and returns the
+   * promoted type if it succeeds, otherwise null.
+   *
+   * In the Dart 1 type system, it is not possible to promote from or to
+   * `dynamic`, and we must be promoting to a more specific type, see
+   * [isMoreSpecificThan]. Also it will always return the promote [to] type or
+   * null.
+   *
+   * In strong mode, this can potentially return a different type, see
+   * the override in [StrongTypeSystemImpl].
+   */
+  DartType tryPromoteToType(DartType to, DartType from);
+
+  /**
    * Given a [DartType] type, return the [TypeParameterElement]s corresponding
    * to its formal type parameters (if any).
    *
@@ -1304,7 +1252,7 @@
    * non-concrete function type is made concrete by replacing dynamic
    * parameters with Object.
    */
-  DartType typeToConcreteType(TypeProvider typeProvider, DartType t);
+  DartType typeToConcreteType(DartType t);
 
   /**
    * Compute the least upper bound of function types [f] and [g].
@@ -1321,8 +1269,7 @@
    * - Compute the LUB of each corresponding pair of parameter and return types.
    *   Return a function type with those types.
    */
-  DartType _functionLeastUpperBound(
-      TypeProvider provider, FunctionType f, FunctionType g) {
+  DartType _functionLeastUpperBound(FunctionType f, FunctionType g) {
     // TODO(rnystrom): Right now, this assumes f and g do not have any type
     // parameters. Revisit that in the presence of generic methods.
     List<DartType> fRequired = f.normalParameterTypes;
@@ -1336,7 +1283,7 @@
     // If F and G differ in their number of required parameters, then the
     // least upper bound of F and G is Function.
     if (fRequired.length != gRequired.length) {
-      return provider.functionType;
+      return typeProvider.functionType;
     }
 
     // Calculate the LUB of each corresponding pair of parameters.
@@ -1345,7 +1292,7 @@
     for (int i = 0; i < fRequired.length; i++) {
       parameters.add(new ParameterElementImpl.synthetic(
           fRequiredNames[i],
-          _functionParameterBound(provider, fRequired[i], gRequired[i]),
+          _functionParameterBound(fRequired[i], gRequired[i]),
           ParameterKind.REQUIRED));
     }
 
@@ -1358,7 +1305,7 @@
     for (int i = 0; i < length; i++) {
       parameters.add(new ParameterElementImpl.synthetic(
           fPositionalNames[i],
-          _functionParameterBound(provider, fPositional[i], gPositional[i]),
+          _functionParameterBound(fPositional[i], gPositional[i]),
           ParameterKind.POSITIONAL));
     }
 
@@ -1367,13 +1314,12 @@
     for (String name in fNamed.keys.toSet()..retainAll(gNamed.keys)) {
       parameters.add(new ParameterElementImpl.synthetic(
           name,
-          _functionParameterBound(provider, fNamed[name], gNamed[name]),
+          _functionParameterBound(fNamed[name], gNamed[name]),
           ParameterKind.NAMED));
     }
 
     // Calculate the LUB of the return type.
-    DartType returnType =
-        getLeastUpperBound(provider, f.returnType, g.returnType);
+    DartType returnType = getLeastUpperBound(f.returnType, g.returnType);
     return new FunctionElementImpl.synthetic(parameters, returnType).type;
   }
 
@@ -1384,24 +1330,21 @@
    * In spec mode, this uses least upper bound, which... doesn't really make
    * much sense. Strong mode overrides this to use greatest lower bound.
    */
-  DartType _functionParameterBound(
-          TypeProvider provider, DartType f, DartType g) =>
-      getLeastUpperBound(provider, f, g);
+  DartType _functionParameterBound(DartType f, DartType g) =>
+      getLeastUpperBound(f, g);
 
   /**
    * Given two [InterfaceType]s [type1] and [type2] return their least upper
    * bound in a type system specific manner.
    */
-  DartType _interfaceLeastUpperBound(
-      TypeProvider provider, InterfaceType type1, InterfaceType type2);
+  DartType _interfaceLeastUpperBound(InterfaceType type1, InterfaceType type2);
 
   /**
    * Given two [DartType]s [type1] and [type2] at least one of which is a
    * [TypeParameterType], return their least upper bound in a type system
    * specific manner.
    */
-  DartType _typeParameterLeastUpperBound(
-      TypeProvider provider, DartType type1, DartType type2);
+  DartType _typeParameterLeastUpperBound(DartType type1, DartType type2);
 
   /**
    * Create either a strong mode or regular type system based on context.
@@ -1409,10 +1352,10 @@
   static TypeSystem create(AnalysisContext context) {
     var options = context.analysisOptions as AnalysisOptionsImpl;
     return options.strongMode
-        ? new StrongTypeSystemImpl(
+        ? new StrongTypeSystemImpl(context.typeProvider,
             implicitCasts: options.implicitCasts,
             nonnullableTypes: options.nonnullableTypes)
-        : new TypeSystemImpl();
+        : new TypeSystemImpl(context.typeProvider);
   }
 }
 
@@ -1420,30 +1363,20 @@
  * Implementation of [TypeSystem] using the rules in the Dart specification.
  */
 class TypeSystemImpl extends TypeSystem {
-  TypeSystemImpl();
+  final TypeProvider typeProvider;
+
+  TypeSystemImpl(this.typeProvider);
 
   @override
-  DartType tryPromoteToType(DartType to, DartType from) {
-    // Declared type should not be "dynamic".
-    // Promoted type should not be "dynamic".
-    // Promoted type should be more specific than declared.
-    if (!from.isDynamic && !to.isDynamic && to.isMoreSpecificThan(from)) {
-      return to;
-    } else {
-      return null;
-    }
-  }
+  bool get isStrong => false;
 
-  @override
-  FunctionType functionTypeToConcreteType(
-          TypeProvider typeProvider, FunctionType t) =>
-      t;
+  FunctionType functionTypeToConcreteType(FunctionType t) => t;
 
   /**
    * Instantiate a parameterized type using `dynamic` for all generic
    * parameters.  Returns the type unchanged if there are no parameters.
    */
-  DartType instantiateToBounds(DartType type) {
+  DartType instantiateToBounds(DartType type, {List<bool> hasError}) {
     List<DartType> typeFormals = typeFormalsAsTypes(type);
     int count = typeFormals.length;
     if (count > 0) {
@@ -1469,22 +1402,32 @@
   }
 
   @override
-  DartType typeToConcreteType(TypeProvider typeProvider, DartType t) => t;
-
-  @override
-  DartType _interfaceLeastUpperBound(
-      TypeProvider provider, InterfaceType type1, InterfaceType type2) {
-    InterfaceType result =
-        InterfaceTypeImpl.computeLeastUpperBound(type1, type2);
-    return result ?? provider.dynamicType;
+  DartType tryPromoteToType(DartType to, DartType from) {
+    // Declared type should not be "dynamic".
+    // Promoted type should not be "dynamic".
+    // Promoted type should be more specific than declared.
+    if (!from.isDynamic && !to.isDynamic && to.isMoreSpecificThan(from)) {
+      return to;
+    } else {
+      return null;
+    }
   }
 
   @override
-  DartType _typeParameterLeastUpperBound(
-      TypeProvider provider, DartType type1, DartType type2) {
-    type1 = type1.resolveToBound(provider.objectType);
-    type2 = type2.resolveToBound(provider.objectType);
-    return getLeastUpperBound(provider, type1, type2);
+  DartType typeToConcreteType(DartType t) => t;
+
+  @override
+  DartType _interfaceLeastUpperBound(InterfaceType type1, InterfaceType type2) {
+    InterfaceType result =
+        InterfaceTypeImpl.computeLeastUpperBound(type1, type2);
+    return result ?? typeProvider.dynamicType;
+  }
+
+  @override
+  DartType _typeParameterLeastUpperBound(DartType type1, DartType type2) {
+    type1 = type1.resolveToBound(typeProvider.objectType);
+    type2 = type2.resolveToBound(typeProvider.objectType);
+    return getLeastUpperBound(type1, type2);
   }
 }
 
@@ -1512,17 +1455,16 @@
 /// As currently designed, an instance of this class should only be used to
 /// infer a single call and discarded immediately afterwards.
 class _StrongInferenceTypeSystem extends StrongTypeSystemImpl {
-  final TypeProvider _typeProvider;
-
   /// The outer strong mode type system, used for GLB and LUB, so we don't
   /// recurse into our constraint solving code.
   final StrongTypeSystemImpl _typeSystem;
   final Map<TypeParameterType, _TypeParameterBound> _bounds;
 
-  _StrongInferenceTypeSystem(this._typeProvider, this._typeSystem,
+  _StrongInferenceTypeSystem(TypeProvider typeProvider, this._typeSystem,
       Iterable<TypeParameterElement> typeFormals)
       : _bounds = new Map.fromIterable(typeFormals,
-            key: (t) => t.type, value: (t) => new _TypeParameterBound());
+            key: (t) => t.type, value: (t) => new _TypeParameterBound()),
+        super(typeProvider);
 
   /// Given the constraints that were given by calling [isSubtypeOf], find the
   /// instantiation of the generic function that satisfies these constraints.
@@ -1542,6 +1484,7 @@
 
     for (int i = 0; i < fnTypeParams.length; i++) {
       TypeParameterType typeParam = fnTypeParams[i];
+      _TypeParameterBound bound = _bounds[typeParam];
 
       // Apply the `extends` clause for the type parameter, if any.
       //
@@ -1563,8 +1506,10 @@
       DartType declaredUpperBound = typeParam.element.bound;
       if (declaredUpperBound != null) {
         // Assert that the type parameter is a subtype of its bound.
-        _inferTypeParameterSubtypeOf(typeParam,
-            declaredUpperBound.substitute2(inferredTypes, fnTypeParams), null);
+        // TODO(jmesserly): the order of calling GLB here matters, because of
+        // https://github.com/dart-lang/sdk/issues/28513
+        bound.upper = _typeSystem.getGreatestLowerBound(bound.upper,
+            declaredUpperBound.substitute2(inferredTypes, fnTypeParams));
       }
 
       // Now we've computed lower and upper bounds for each type parameter.
@@ -1579,43 +1524,9 @@
       _TypeParameterVariance variance =
           new _TypeParameterVariance.from(typeParam, declaredReturnType);
 
-      _TypeParameterBound bound = _bounds[typeParam];
       DartType lowerBound = bound.lower;
       DartType upperBound = bound.upper;
 
-      // Collapse future unions if we inferred them somehow.
-      //
-      // TODO(jmesserly): in our initial upward phase it would be fine to
-      // keep the FutureUnionType for the argument downward context.
-      //
-      // We need to track in `inferGenericFunctionCall` whether we are going up
-      // or down. This would also allow for an improved heuristic: if we are
-      // doing our final inference, the downward context can take priority.
-      if (lowerBound is FutureUnionType) {
-        // lowerBound <: T, where lowerBound is Future<A> | A.
-        // So we choose lowerBound as LUB(A, Future<A>).
-        //
-        // This will typically lead to top with the current rules, but it will
-        // work with `bottom` or if we remove Future flattening.
-        var f = lowerBound as FutureUnionType;
-        lowerBound = _typeSystem.getLeastUpperBound(
-            _typeProvider, f.futureOfType, f.type);
-      }
-      if (upperBound is FutureUnionType) {
-        // T <: upperBound, where upperBound is Future<A> | A.
-        // Therefore we need T <: Future<A> or T <: A.
-        //
-        // This is just an arbitrarily heuristic.
-        var f = upperBound as FutureUnionType;
-        if (_typeSystem.isSubtypeOf(lowerBound, f.type)) {
-          upperBound = f.type;
-        } else if (_typeSystem.isSubtypeOf(lowerBound, f.futureOfType)) {
-          upperBound = f.futureOfType;
-        } else {
-          upperBound = f.type;
-        }
-      }
-
       // See if the bounds can be satisfied.
       // TODO(jmesserly): also we should have an error for unconstrained type
       // parameters, rather than silently inferring dynamic.
@@ -1643,7 +1554,6 @@
         lowerBound = bound.upper;
         upperBound = bound.lower;
       }
-
       inferredTypes[i] =
           variance.passedIn && !upperBound.isDynamic || lowerBound.isBottom
               ? upperBound
@@ -1655,9 +1565,19 @@
   }
 
   @override
-  bool _inferTypeParameterSubtypeOf(
-      DartType t1, DartType t2, Set<Element> visited) {
+  bool _isSubtypeOf(DartType t1, DartType t2, Set<Element> visited,
+      {bool dynamicIsBottom: false}) {
+    // TODO(jmesserly): the trivial constraints are not treated as part of
+    // the constraint set here. This seems incorrect once we are able to pin the
+    // inferred type of a type parameter based on the downwards information.
+    if (identical(t1, t2) ||
+        _isTop(t2, dynamicIsBottom: dynamicIsBottom) ||
+        _isBottom(t1, dynamicIsBottom: dynamicIsBottom)) {
+      return true;
+    }
+
     if (t1 is TypeParameterType) {
+      // TODO(jmesserly): we ignore `dynamicIsBottom` here, is that correct?
       _TypeParameterBound bound = _bounds[t1];
       if (bound != null) {
         // Ensure T1 <: T2, where T1 is a type parameter we are inferring.
@@ -1666,8 +1586,7 @@
         // We already know T1 <: U, for some U.
         // So update U to reflect the new constraint T1 <: GLB(U, T2)
         //
-        bound.upper =
-            _typeSystem.getGreatestLowerBound(_typeProvider, bound.upper, t2);
+        bound.upper = _typeSystem.getGreatestLowerBound(bound.upper, t2);
         // Optimistically assume we will be able to satisfy the constraint.
         return true;
       }
@@ -1681,13 +1600,13 @@
         // We already know L <: T2, for some L.
         // So update L to reflect the new constraint LUB(L, T1) <: T2
         //
-        bound.lower =
-            _typeSystem.getLeastUpperBound(_typeProvider, bound.lower, t1);
+        bound.lower = _typeSystem.getLeastUpperBound(bound.lower, t1);
         // Optimistically assume we will be able to satisfy the constraint.
         return true;
       }
     }
-    return false;
+    return super
+        ._isSubtypeOf(t1, t2, visited, dynamicIsBottom: dynamicIsBottom);
   }
 }
 
diff --git a/pkg/analyzer/lib/src/lint/analysis.dart b/pkg/analyzer/lib/src/lint/analysis.dart
new file mode 100644
index 0000000..5949fd8
--- /dev/null
+++ b/pkg/analyzer/lib/src/lint/analysis.dart
@@ -0,0 +1,260 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:collection';
+import 'dart:io' as io;
+
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/file_system/file_system.dart'
+    show File, Folder, ResourceProvider, ResourceUriResolver;
+import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/source/package_map_resolver.dart';
+import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/dart/sdk/sdk.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/lint/io.dart';
+import 'package:analyzer/src/lint/linter.dart';
+import 'package:analyzer/src/lint/project.dart';
+import 'package:analyzer/src/lint/registry.dart';
+import 'package:analyzer/src/services/lint.dart';
+import 'package:cli_util/cli_util.dart' as cli_util;
+import 'package:package_config/packages.dart' show Packages;
+import 'package:package_config/packages_file.dart' as pkgfile show parse;
+import 'package:package_config/src/packages_impl.dart' show MapPackages;
+import 'package:path/path.dart' as p;
+import 'package:plugin/manager.dart';
+import 'package:plugin/plugin.dart';
+
+Source createSource(Uri sourceUri) {
+  return PhysicalResourceProvider.INSTANCE
+      .getFile(sourceUri.toFilePath())
+      .createSource(sourceUri);
+}
+
+/// Print the given message and exit with the given [exitCode]
+void printAndFail(String message, {int exitCode: 15}) {
+  print(message);
+  io.exit(exitCode);
+}
+
+AnalysisOptions _buildAnalyzerOptions(DriverOptions options) {
+  AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
+  analysisOptions.strongMode = options.strongMode;
+  analysisOptions.hint = false;
+  analysisOptions.lint = options.enableLints;
+  analysisOptions.generateSdkErrors = options.showSdkWarnings;
+  analysisOptions.enableTiming = options.enableTiming;
+  return analysisOptions;
+}
+
+class AnalysisDriver {
+  /// The sources which have been analyzed so far.  This is used to avoid
+  /// analyzing a source more than once, and to compute the total number of
+  /// sources analyzed for statistics.
+  Set<Source> _sourcesAnalyzed = new HashSet<Source>();
+
+  final LinterOptions options;
+
+  AnalysisDriver(this.options) {
+    _processPlugins();
+  }
+
+  /// Return the number of sources that have been analyzed so far.
+  int get numSourcesAnalyzed => _sourcesAnalyzed.length;
+
+  List<UriResolver> get resolvers {
+    // TODO(brianwilkerson) Use the context builder to compute all of the resolvers.
+    ResourceProvider resourceProvider = PhysicalResourceProvider.INSTANCE;
+    ContextBuilder builder = new ContextBuilder(resourceProvider, null, null);
+
+    DartSdk sdk = options.mockSdk ??
+        new FolderBasedDartSdk(
+            resourceProvider, resourceProvider.getFolder(sdkDir));
+
+    List<UriResolver> resolvers = [new DartUriResolver(sdk)];
+
+    if (options.packageRootPath != null) {
+      // TODO(brianwilkerson) After 0.30.0 is published, clean up the following.
+      try {
+        // Try to use the post 0.30.0 API.
+        (builder as dynamic).builderOptions.defaultPackagesDirectoryPath =
+            options.packageRootPath;
+      } catch (_) {
+        // If that fails, fall back to the pre 0.30.0 API.
+        (builder as dynamic).defaultPackagesDirectoryPath =
+            options.packageRootPath;
+      }
+      Map<String, List<Folder>> packageMap =
+          builder.convertPackagesToMap(builder.createPackageMap(null));
+      resolvers.add(new PackageMapUriResolver(resourceProvider, packageMap));
+    }
+
+    // File URI resolver must come last so that files inside "/lib" are
+    // are analyzed via "package:" URI's.
+    resolvers.add(new ResourceUriResolver(resourceProvider));
+    return resolvers;
+  }
+
+  String get sdkDir {
+    if (options.dartSdkPath != null) {
+      return options.dartSdkPath;
+    }
+    // In case no SDK has been specified, fall back to inferring it
+    // TODO: pass args to cli_util
+    return cli_util.getSdkDir().path;
+  }
+
+  List<AnalysisErrorInfo> analyze(Iterable<io.File> files) {
+    AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
+    context.analysisOptions = _buildAnalyzerOptions(options);
+    registerLinters(context);
+
+    Packages packages = _getPackageConfig();
+
+    context.sourceFactory = new SourceFactory(resolvers, packages);
+    AnalysisEngine.instance.logger = new StdLogger();
+
+    List<Source> sources = [];
+    ChangeSet changeSet = new ChangeSet();
+    for (io.File file in files) {
+      File sourceFile = PhysicalResourceProvider.INSTANCE
+          .getFile(p.normalize(file.absolute.path));
+      Source source = sourceFile.createSource();
+      Uri uri = context.sourceFactory.restoreUri(source);
+      if (uri != null) {
+        // Ensure that we analyze the file using its canonical URI (e.g. if
+        // it's in "/lib", analyze it using a "package:" URI).
+        source = sourceFile.createSource(uri);
+      }
+      sources.add(source);
+      changeSet.addedSource(source);
+    }
+    context.applyChanges(changeSet);
+
+    // Temporary location
+    var project = new DartProject(context, sources);
+    // This will get pushed into the generator (or somewhere comparable) when
+    // we have a proper plugin.
+    Registry.ruleRegistry.forEach((lint) {
+      if (lint is ProjectVisitor) {
+        (lint as ProjectVisitor).visit(project);
+      }
+    });
+
+    List<AnalysisErrorInfo> errors = [];
+
+    for (Source source in sources) {
+      context.computeErrors(source);
+      errors.add(context.getErrors(source));
+      _sourcesAnalyzed.add(source);
+    }
+
+    if (options.visitTransitiveClosure) {
+      // In the process of computing errors for all the sources in [sources],
+      // the analyzer has visited the transitive closure of all libraries
+      // referenced by those sources.  So now we simply need to visit all
+      // library sources known to the analysis context, and all parts they
+      // refer to.
+      for (Source librarySource in context.librarySources) {
+        for (Source source in _getAllUnitSources(context, librarySource)) {
+          if (!_sourcesAnalyzed.contains(source)) {
+            context.computeErrors(source);
+            errors.add(context.getErrors(source));
+            _sourcesAnalyzed.add(source);
+          }
+        }
+      }
+    }
+
+    return errors;
+  }
+
+  void registerLinters(AnalysisContext context) {
+    if (options.enableLints) {
+      setLints(context, options.enabledLints?.toList(growable: false));
+    }
+  }
+
+  /// Yield the sources for all the compilation units constituting
+  /// [librarySource] (including the defining compilation unit).
+  Iterable<Source> _getAllUnitSources(
+      AnalysisContext context, Source librarySource) {
+    List<Source> result = <Source>[librarySource];
+    result.addAll(context
+        .getLibraryElement(librarySource)
+        .parts
+        .map((CompilationUnitElement e) => e.source));
+    return result;
+  }
+
+  Packages _getPackageConfig() {
+    if (options.packageConfigPath != null) {
+      String packageConfigPath = options.packageConfigPath;
+      Uri fileUri = new Uri.file(packageConfigPath);
+      try {
+        io.File configFile = new io.File.fromUri(fileUri).absolute;
+        List<int> bytes = configFile.readAsBytesSync();
+        Map<String, Uri> map = pkgfile.parse(bytes, configFile.uri);
+        return new MapPackages(map);
+      } catch (e) {
+        printAndFail(
+            'Unable to read package config data from $packageConfigPath: $e');
+      }
+    }
+    return null;
+  }
+
+  void _processPlugins() {
+    List<Plugin> plugins = <Plugin>[];
+    plugins.addAll(AnalysisEngine.instance.requiredPlugins);
+    ExtensionManager manager = new ExtensionManager();
+    manager.processPlugins(plugins);
+  }
+}
+
+class DriverOptions {
+  /// The maximum number of sources for which AST structures should be kept
+  /// in the cache.  The default is 512.
+  int cacheSize = 512;
+
+  /// The path to the dart SDK.
+  String dartSdkPath;
+
+  /// Whether to show lint warnings.
+  bool enableLints = true;
+
+  /// Whether to gather timing data during analysis.
+  bool enableTiming = false;
+
+  /// The path to a `.packages` configuration file
+  String packageConfigPath;
+
+  /// The path to the package root.
+  String packageRootPath;
+
+  /// Whether to show SDK warnings.
+  bool showSdkWarnings = false;
+
+  /// Whether to use Dart's Strong Mode analyzer.
+  bool strongMode = true;
+
+  /// The mock SDK (to speed up testing) or `null` to use the actual SDK.
+  DartSdk mockSdk;
+
+  /// Whether to show lints for the transitive closure of imported and exported
+  /// libraries.
+  bool visitTransitiveClosure = false;
+}
+
+/// Prints logging information comments to the [outSink] and error messages to
+/// [errorSink].
+class StdLogger extends Logger {
+  @override
+  void logError(String message, [exception]) => errorSink.writeln(message);
+  @override
+  void logInformation(String message, [exception]) => outSink.writeln(message);
+}
diff --git a/pkg/analyzer/lib/src/lint/config.dart b/pkg/analyzer/lib/src/lint/config.dart
new file mode 100644
index 0000000..f33b3f3
--- /dev/null
+++ b/pkg/analyzer/lib/src/lint/config.dart
@@ -0,0 +1,243 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:yaml/yaml.dart';
+
+/**
+ * Parse the given map into a lint config.
+ */
+LintConfig parseConfig(Map optionsMap) {
+  if (optionsMap != null) {
+    var options = optionsMap['linter'];
+    // Quick check of basic contract.
+    if (options is Map) {
+      return new LintConfig.parseMap(options);
+    }
+  }
+  return null;
+}
+
+/**
+ * Process the given option [fileContents] and produce a corresponding
+ * [LintConfig].
+ */
+LintConfig processAnalysisOptionsFile(String fileContents, {String fileUrl}) {
+  var yaml = loadYamlNode(fileContents, sourceUrl: fileUrl);
+  if (yaml is YamlMap) {
+    return parseConfig(yaml);
+  }
+  return null;
+}
+
+/**
+ * The configuration of lint rules within an analysis options file.
+ */
+abstract class LintConfig {
+  factory LintConfig.parse(String source, {String sourceUrl}) =>
+      new _LintConfig().._parse(source, sourceUrl: sourceUrl);
+
+  factory LintConfig.parseMap(Map map) => new _LintConfig().._parseMap(map);
+
+  List<String> get fileExcludes;
+  List<String> get fileIncludes;
+  List<RuleConfig> get ruleConfigs;
+}
+
+/**
+ * The configuration of a single lint rule within an analysis options file.
+ */
+abstract class RuleConfig {
+  Map<String, dynamic> args = <String, dynamic>{};
+  String get group;
+  String get name;
+
+  // Provisional
+  bool disables(String ruleName) =>
+      ruleName == name && args['enabled'] == false;
+
+  bool enables(String ruleName) => ruleName == name && args['enabled'] == true;
+}
+
+class _LintConfig implements LintConfig {
+  @override
+  final fileIncludes = <String>[];
+  @override
+  final fileExcludes = <String>[];
+  @override
+  final ruleConfigs = <RuleConfig>[];
+
+  void addAsListOrString(value, List<String> list) {
+    if (value is List) {
+      value.forEach((v) => list.add(v));
+    } else if (value is String) {
+      list.add(value);
+    }
+  }
+
+  bool asBool(scalar) {
+    if (scalar is bool) {
+      return scalar;
+    }
+    if (scalar is String) {
+      if (scalar == 'true') {
+        return true;
+      }
+      if (scalar == 'false') {
+        return false;
+      }
+    }
+    return null;
+  }
+
+  String asString(scalar) {
+    if (scalar is String) {
+      return scalar;
+    }
+    return null;
+  }
+
+  Map<String, dynamic> parseArgs(args) {
+    bool enabled = asBool(args);
+    if (enabled != null) {
+      return {'enabled': enabled};
+    }
+    return null;
+  }
+
+  void _parse(String src, {String sourceUrl}) {
+    var yaml = loadYamlNode(src, sourceUrl: sourceUrl);
+    if (yaml is YamlMap) {
+      _parseYaml(yaml);
+    }
+  }
+
+  void _parseMap(Map options) {
+    //TODO(pq): unify map parsing.
+    if (options is YamlMap) {
+      _parseYaml(options);
+    } else {
+      _parseRawMap(options);
+    }
+  }
+
+  void _parseRawMap(Map options) {
+    options.forEach((k, v) {
+      if (k is! String) {
+        return;
+      }
+      String key = k;
+      switch (key) {
+        case 'files':
+          if (v is Map) {
+            addAsListOrString(v['include'], fileIncludes);
+            addAsListOrString(v['exclude'], fileExcludes);
+          }
+          break;
+
+        case 'rules':
+          // - unnecessary_getters
+          // - camel_case_types
+          if (v is List) {
+            v.forEach((rule) {
+              var config = new _RuleConfig();
+              config.name = asString(rule);
+              config.args = {'enabled': true};
+              ruleConfigs.add(config);
+            });
+          }
+
+          // {unnecessary_getters: false, camel_case_types: true}
+          if (v is Map) {
+            v.forEach((key, value) {
+              // style_guide: {unnecessary_getters: false, camel_case_types: true}
+              if (value is Map) {
+                value.forEach((rule, args) {
+                  // unnecessary_getters: false
+                  var config = new _RuleConfig();
+                  config.group = key;
+                  config.name = asString(rule);
+                  config.args = parseArgs(args);
+                  ruleConfigs.add(config);
+                });
+              } else {
+                //{unnecessary_getters: false}
+                value = asBool(value);
+                if (value != null) {
+                  var config = new _RuleConfig();
+                  config.name = asString(key);
+                  config.args = {'enabled': value};
+                  ruleConfigs.add(config);
+                }
+              }
+            });
+          }
+          break;
+      }
+    });
+  }
+
+  void _parseYaml(YamlMap yaml) {
+    yaml.nodes.forEach((k, v) {
+      if (k is! YamlScalar) {
+        return;
+      }
+      YamlScalar key = k;
+      switch (key.toString()) {
+        case 'files':
+          if (v is YamlMap) {
+            addAsListOrString(v['include'], fileIncludes);
+            addAsListOrString(v['exclude'], fileExcludes);
+          }
+          break;
+
+        case 'rules':
+
+          // - unnecessary_getters
+          // - camel_case_types
+          if (v is List) {
+            (v as List).forEach((rule) {
+              var config = new _RuleConfig();
+              config.name = asString(rule);
+              config.args = {'enabled': true};
+              ruleConfigs.add(config);
+            });
+          }
+
+          // style_guide: {unnecessary_getters: false, camel_case_types: true}
+          if (v is YamlMap) {
+            v.forEach((key, value) {
+              //{unnecessary_getters: false}
+              if (value is bool) {
+                var config = new _RuleConfig();
+                config.name = asString(key);
+                config.args = {'enabled': value};
+                ruleConfigs.add(config);
+              }
+
+              // style_guide: {unnecessary_getters: false, camel_case_types: true}
+              if (value is YamlMap) {
+                value.forEach((rule, args) {
+                  // TODO: verify format
+                  // unnecessary_getters: false
+                  var config = new _RuleConfig();
+                  config.group = key;
+                  config.name = asString(rule);
+                  config.args = parseArgs(args);
+                  ruleConfigs.add(config);
+                });
+              }
+            });
+          }
+          break;
+      }
+    });
+  }
+}
+
+class _RuleConfig extends RuleConfig {
+  @override
+  String group;
+  @override
+  String name;
+}
diff --git a/pkg/analyzer/lib/src/lint/io.dart b/pkg/analyzer/lib/src/lint/io.dart
new file mode 100644
index 0000000..762ee93
--- /dev/null
+++ b/pkg/analyzer/lib/src/lint/io.dart
@@ -0,0 +1,68 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:analyzer/src/lint/util.dart';
+import 'package:glob/glob.dart';
+import 'package:path/path.dart' as p;
+
+final dartMatcher = new Glob('**.dart');
+
+/// Shared IO sink for standard error reporting.
+/// Visible for testing
+IOSink errorSink = stderr;
+
+/// Shared IO sink for standard out reporting.
+/// Visible for testing
+IOSink outSink = stdout;
+
+/// Cached project package.
+String _projectPackageName;
+
+/// Cached project root.
+String _projectRoot;
+
+/// Collect all lintable files, recursively, under this [path] root, ignoring
+/// links.
+Iterable<File> collectFiles(String path) {
+  List<File> files = [];
+
+  var file = new File(path);
+  if (file.existsSync()) {
+    files.add(file);
+  } else {
+    var directory = new Directory(path);
+    if (directory.existsSync()) {
+      for (var entry
+          in directory.listSync(recursive: true, followLinks: false)) {
+        var relative = p.relative(entry.path, from: directory.path);
+
+        if (isLintable(entry) && !isInHiddenDir(relative)) {
+          files.add(entry);
+        }
+      }
+    }
+  }
+
+  return files;
+}
+
+/// Returns `true` if this [entry] is a Dart file.
+bool isDartFile(FileSystemEntity entry) => isDartFileName(entry.path);
+
+/// Returns `true` if this relative path is a hidden directory.
+bool isInHiddenDir(String relative) =>
+    p.split(relative).any((part) => part.startsWith("."));
+
+/// Returns `true` if this relative path is a hidden directory.
+bool isLintable(FileSystemEntity file) =>
+    file is File && (isDartFile(file) || isPubspecFile(file));
+
+/// Returns `true` if this [entry] is a pubspec file.
+bool isPubspecFile(FileSystemEntity entry) =>
+    isPubspecFileName(p.basename(entry.path));
+
+/// Synchronously read the contents of the file at the given [path] as a string.
+String readFile(String path) => new File(path).readAsStringSync();
diff --git a/pkg/analyzer/lib/src/lint/linter.dart b/pkg/analyzer/lib/src/lint/linter.dart
new file mode 100644
index 0000000..5706f35
--- /dev/null
+++ b/pkg/analyzer/lib/src/lint/linter.dart
@@ -0,0 +1,429 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:analyzer/analyzer.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/src/generated/engine.dart'
+    show AnalysisErrorInfo, AnalysisErrorInfoImpl, Logger;
+import 'package:analyzer/src/generated/java_engine.dart' show CaughtException;
+import 'package:analyzer/src/generated/source.dart' show LineInfo;
+import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/lint/analysis.dart';
+import 'package:analyzer/src/lint/config.dart';
+import 'package:analyzer/src/lint/io.dart';
+import 'package:analyzer/src/lint/project.dart';
+import 'package:analyzer/src/lint/pub.dart';
+import 'package:analyzer/src/lint/registry.dart';
+import 'package:analyzer/src/services/lint.dart' show Linter;
+import 'package:glob/glob.dart';
+import 'package:path/path.dart' as p;
+
+typedef Printer(String msg);
+
+/// Describes a String in valid camel case format.
+class CamelCaseString {
+  static final _camelCaseMatcher = new RegExp(r'[A-Z][a-z]*');
+  static final _camelCaseTester = new RegExp(r'^([_$]*)([A-Z?$]+[a-z0-9]*)+$');
+
+  final String value;
+  CamelCaseString(this.value) {
+    if (!isCamelCase(value)) {
+      throw new ArgumentError('$value is not CamelCase');
+    }
+  }
+
+  String get humanized => _humanize(value);
+
+  @override
+  String toString() => value;
+
+  static bool isCamelCase(String name) => _camelCaseTester.hasMatch(name);
+
+  static String _humanize(String camelCase) =>
+      _camelCaseMatcher.allMatches(camelCase).map((m) => m.group(0)).join(' ');
+}
+
+/// Dart source linter.
+class DartLinter implements AnalysisErrorListener {
+  final errors = <AnalysisError>[];
+
+  final LinterOptions options;
+  final Reporter reporter;
+
+  /// The total number of sources that were analyzed.  Only valid after
+  /// [lintFiles] has been called.
+  int numSourcesAnalyzed;
+
+  /// Creates a new linter.
+  DartLinter(this.options, {this.reporter: const PrintingReporter()});
+
+  Iterable<AnalysisErrorInfo> lintFiles(List<File> files) {
+    List<AnalysisErrorInfo> errors = [];
+    var analysisDriver = new AnalysisDriver(options);
+    errors.addAll(analysisDriver.analyze(files.where((f) => isDartFile(f))));
+    numSourcesAnalyzed = analysisDriver.numSourcesAnalyzed;
+    files.where((f) => isPubspecFile(f)).forEach((p) {
+      numSourcesAnalyzed++;
+      return errors.addAll(_lintPubspecFile(p));
+    });
+    return errors;
+  }
+
+  Iterable<AnalysisErrorInfo> lintPubspecSource(
+      {String contents, String sourcePath}) {
+    var results = <AnalysisErrorInfo>[];
+
+    Uri sourceUrl = sourcePath == null ? null : p.toUri(sourcePath);
+
+    var spec = new Pubspec.parse(contents, sourceUrl: sourceUrl);
+
+    for (Linter lint in options.enabledLints) {
+      if (lint is LintRule) {
+        LintRule rule = lint;
+        var visitor = rule.getPubspecVisitor();
+        if (visitor != null) {
+          // Analyzer sets reporters; if this file is not being analyzed,
+          // we need to set one ourselves.  (Needless to say, when pubspec
+          // processing gets pushed down, this hack can go away.)
+          if (rule.reporter == null && sourceUrl != null) {
+            var source = createSource(sourceUrl);
+            rule.reporter = new ErrorReporter(this, source);
+          }
+          try {
+            spec.accept(visitor);
+          } on Exception catch (e) {
+            reporter.exception(new LinterException(e.toString()));
+          }
+          if (rule._locationInfo != null && rule._locationInfo.isNotEmpty) {
+            results.addAll(rule._locationInfo);
+            rule._locationInfo.clear();
+          }
+        }
+      }
+    }
+
+    return results;
+  }
+
+  @override
+  onError(AnalysisError error) => errors.add(error);
+
+  Iterable<AnalysisErrorInfo> _lintPubspecFile(File sourceFile) =>
+      lintPubspecSource(
+          contents: sourceFile.readAsStringSync(), sourcePath: sourceFile.path);
+}
+
+class FileGlobFilter extends LintFilter {
+  Iterable<Glob> includes;
+  Iterable<Glob> excludes;
+
+  FileGlobFilter([Iterable<String> includeGlobs, Iterable<String> excludeGlobs])
+      : includes = includeGlobs.map((glob) => new Glob(glob)),
+        excludes = excludeGlobs.map((glob) => new Glob(glob));
+
+  @override
+  bool filter(AnalysisError lint) {
+    // TODO specify order
+    return excludes.any((glob) => glob.matches(lint.source.fullName)) &&
+        !includes.any((glob) => glob.matches(lint.source.fullName));
+  }
+}
+
+class Group implements Comparable<Group> {
+  /// Defined rule groups.
+  static const Group errors =
+      const Group._('errors', description: 'Possible coding errors.');
+  static const Group pub = const Group._('pub',
+      description: 'Pub-related rules.',
+      link: const Hyperlink('See the <strong>Pubspec Format</strong>',
+          'https://www.dartlang.org/tools/pub/pubspec.html'));
+  static const Group style = const Group._('style',
+      description:
+          'Matters of style, largely derived from the official Dart Style Guide.',
+      link: const Hyperlink('See the <strong>Style Guide</strong>',
+          'https://www.dartlang.org/articles/style-guide/'));
+
+  /// List of builtin groups in presentation order.
+  static const Iterable<Group> builtin = const [errors, style, pub];
+
+  final String name;
+  final bool custom;
+  final String description;
+  final Hyperlink link;
+
+  factory Group(String name, {String description: '', Hyperlink link}) {
+    var n = name.toLowerCase();
+    return builtin.firstWhere((g) => g.name == n,
+        orElse: () => new Group._(name,
+            custom: true, description: description, link: link));
+  }
+
+  const Group._(this.name, {this.custom: false, this.description, this.link});
+
+  @override
+  int compareTo(Group other) => name.compareTo(other.name);
+}
+
+class Hyperlink {
+  final String label;
+  final String href;
+  final bool bold;
+  const Hyperlink(this.label, this.href, {this.bold: false});
+  String get html => '<a href="$href">${_emph(label)}</a>';
+  String _emph(msg) => bold ? '<strong>$msg</strong>' : msg;
+}
+
+/// Thrown when an error occurs in linting.
+class LinterException implements Exception {
+  /// A message describing the error.
+  final String message;
+
+  /// Creates a new LinterException with an optional error [message].
+  const LinterException([this.message]);
+
+  @override
+  String toString() =>
+      message == null ? "LinterException" : "LinterException: $message";
+}
+
+/// Linter options.
+class LinterOptions extends DriverOptions {
+  Iterable<LintRule> enabledLints;
+  LintFilter filter;
+  LinterOptions([this.enabledLints]) {
+    enabledLints ??= Registry.ruleRegistry;
+  }
+  void configure(LintConfig config) {
+    // TODO(pquitslund): revisit these default-to-on semantics.
+    enabledLints = Registry.ruleRegistry.where((LintRule rule) =>
+        !config.ruleConfigs.any((rc) => rc.disables(rule.name)));
+    filter = new FileGlobFilter(config.fileIncludes, config.fileExcludes);
+  }
+}
+
+/// Filtered lints are ommitted from linter output.
+abstract class LintFilter {
+  bool filter(AnalysisError lint);
+}
+
+/// Describes a lint rule.
+abstract class LintRule extends Linter implements Comparable<LintRule> {
+  /// Description (in markdown format) suitable for display in a detailed lint
+  /// description.
+  final String details;
+
+  /// Short description suitable for display in console output.
+  final String description;
+
+  /// Lint group (for example, 'style').
+  final Group group;
+
+  /// Lint maturity (stable|experimental).
+  final Maturity maturity;
+
+  /// Lint name.
+  @override
+  final String name;
+
+  /// Until pubspec analysis is pushed into the analyzer proper, we need to
+  /// do some extra book-keeping to keep track of details that will help us
+  /// constitute AnalysisErrorInfos.
+  final List<AnalysisErrorInfo> _locationInfo = <AnalysisErrorInfo>[];
+
+  LintRule(
+      {this.name,
+      this.group,
+      this.description,
+      this.details,
+      this.maturity: Maturity.stable});
+
+  LintCode get lintCode => new _LintCode(name, description);
+
+  @override
+  int compareTo(LintRule other) {
+    var g = group.compareTo(other.group);
+    if (g != 0) {
+      return g;
+    }
+    return name.compareTo(other.name);
+  }
+
+  /// Return a visitor to be passed to provide access to Dart project context
+  /// and to perform project-level analyses.
+  ProjectVisitor getProjectVisitor() => null;
+
+  /// Return a visitor to be passed to pubspecs to perform lint
+  /// analysis.
+  /// Lint errors are reported via this [Linter]'s error [reporter].
+  PubspecVisitor getPubspecVisitor() => null;
+
+  @override
+  AstVisitor getVisitor() => null;
+
+  void reportLint(AstNode node, {bool ignoreSyntheticNodes: true}) {
+    if (node != null && (!node.isSynthetic || !ignoreSyntheticNodes)) {
+      reporter.reportErrorForNode(lintCode, node, []);
+    }
+  }
+
+  void reportLintForToken(Token token, {bool ignoreSyntheticTokens: true}) {
+    if (token != null && (!token.isSynthetic || !ignoreSyntheticTokens)) {
+      reporter.reportErrorForToken(lintCode, token, []);
+    }
+  }
+
+  void reportPubLint(PSNode node) {
+    Source source = createSource(node.span.sourceUrl);
+
+    // Cache error and location info for creating AnalysisErrorInfos
+    // Note that error columns are 1-based
+    AnalysisError error = new AnalysisError(
+        source, node.span.start.column + 1, node.span.length, lintCode);
+    LineInfo lineInfo = new LineInfo.fromContent(source.contents.data);
+
+    _locationInfo.add(new AnalysisErrorInfoImpl([error], lineInfo));
+
+    // Then do the reporting
+    reporter?.reportError(error);
+  }
+}
+
+class Maturity implements Comparable<Maturity> {
+  static const Maturity stable = const Maturity._('stable', ordinal: 0);
+  static const Maturity experimental = const Maturity._('stable', ordinal: 1);
+
+  final String name;
+  final int ordinal;
+
+  factory Maturity(String name, {int ordinal}) {
+    switch (name.toLowerCase()) {
+      case 'stable':
+        return stable;
+      case 'experimental':
+        return experimental;
+      default:
+        return new Maturity._(name, ordinal: ordinal);
+    }
+  }
+
+  const Maturity._(this.name, {this.ordinal});
+
+  @override
+  int compareTo(Maturity other) => this.ordinal - other.ordinal;
+}
+
+class PrintingReporter implements Reporter, Logger {
+  final Printer _print;
+
+  const PrintingReporter([this._print = print]);
+
+  @override
+  void exception(LinterException exception) {
+    _print('EXCEPTION: $exception');
+  }
+
+  @override
+  void logError(String message, [CaughtException exception]) {
+    _print('ERROR: $message');
+  }
+
+  @override
+  void logInformation(String message, [CaughtException exception]) {
+    _print('INFO: $message');
+  }
+
+  @override
+  void warn(String message) {
+    _print('WARN: $message');
+  }
+}
+
+abstract class Reporter {
+  void exception(LinterException exception);
+  void warn(String message);
+}
+
+/// Linter implementation.
+class SourceLinter implements DartLinter, AnalysisErrorListener {
+  @override
+  final errors = <AnalysisError>[];
+  @override
+  final LinterOptions options;
+  @override
+  final Reporter reporter;
+
+  @override
+  int numSourcesAnalyzed;
+
+  SourceLinter(this.options, {this.reporter: const PrintingReporter()});
+
+  @override
+  Iterable<AnalysisErrorInfo> lintFiles(List<File> files) {
+    List<AnalysisErrorInfo> errors = [];
+    var analysisDriver = new AnalysisDriver(options);
+    errors.addAll(analysisDriver.analyze(files.where((f) => isDartFile(f))));
+    numSourcesAnalyzed = analysisDriver.numSourcesAnalyzed;
+    files.where((f) => isPubspecFile(f)).forEach((p) {
+      numSourcesAnalyzed++;
+      return errors.addAll(_lintPubspecFile(p));
+    });
+    return errors;
+  }
+
+  @override
+  Iterable<AnalysisErrorInfo> lintPubspecSource(
+      {String contents, String sourcePath}) {
+    var results = <AnalysisErrorInfo>[];
+
+    Uri sourceUrl = sourcePath == null ? null : p.toUri(sourcePath);
+
+    var spec = new Pubspec.parse(contents, sourceUrl: sourceUrl);
+
+    for (Linter lint in options.enabledLints) {
+      if (lint is LintRule) {
+        LintRule rule = lint;
+        var visitor = rule.getPubspecVisitor();
+        if (visitor != null) {
+          // Analyzer sets reporters; if this file is not being analyzed,
+          // we need to set one ourselves.  (Needless to say, when pubspec
+          // processing gets pushed down, this hack can go away.)
+          if (rule.reporter == null && sourceUrl != null) {
+            var source = createSource(sourceUrl);
+            rule.reporter = new ErrorReporter(this, source);
+          }
+          try {
+            spec.accept(visitor);
+          } on Exception catch (e) {
+            reporter.exception(new LinterException(e.toString()));
+          }
+          if (rule._locationInfo != null && rule._locationInfo.isNotEmpty) {
+            results.addAll(rule._locationInfo);
+            rule._locationInfo.clear();
+          }
+        }
+      }
+    }
+
+    return results;
+  }
+
+  @override
+  onError(AnalysisError error) => errors.add(error);
+
+  @override
+  Iterable<AnalysisErrorInfo> _lintPubspecFile(File sourceFile) =>
+      lintPubspecSource(
+          contents: sourceFile.readAsStringSync(), sourcePath: sourceFile.path);
+}
+
+class _LintCode extends LintCode {
+  static final registry = <String, LintCode>{};
+
+  factory _LintCode(String name, String message) => registry.putIfAbsent(
+      name + message, () => new _LintCode._(name, message));
+
+  _LintCode._(String name, String message) : super(name, message);
+}
diff --git a/pkg/analysis_server/lib/src/services/linter/linter.dart b/pkg/analyzer/lib/src/lint/options_rule_validator.dart
similarity index 80%
rename from pkg/analysis_server/lib/src/services/linter/linter.dart
rename to pkg/analyzer/lib/src/lint/options_rule_validator.dart
index 964c238..109cdd2 100644
--- a/pkg/analysis_server/lib/src/services/linter/linter.dart
+++ b/pkg/analyzer/lib/src/lint/options_rule_validator.dart
@@ -1,12 +1,10 @@
-// Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-library services.src.linter;
-
 import 'package:analyzer/analyzer.dart';
 import 'package:analyzer/plugin/options.dart';
-import 'package:linter/src/rules.dart';
+import 'package:analyzer/src/lint/registry.dart';
 import 'package:yaml/yaml.dart';
 
 /**
@@ -19,7 +17,9 @@
     const AnalysisOptionsWarningCode(
         'UNDEFINED_LINT_WARNING', "'{0}' is not a recognized lint rule");
 
-/// Validates `linter` rule configurations.
+/**
+ * Validates `linter` rule configurations.
+ */
 class LinterRuleOptionsValidator extends OptionsValidator {
   static const linter = 'linter';
   static const rulesKey = 'rules';
@@ -37,8 +37,8 @@
 
   validateRules(dynamic rules, ErrorReporter reporter) {
     if (rules is YamlList) {
-      //TODO(pq): migrate this to a proper API once there is one.
-      Iterable<String> registeredLints = ruleRegistry.map((r) => r.name);
+      Iterable<String> registeredLints =
+          Registry.ruleRegistry.map((r) => r.name);
       rules.nodes.forEach((YamlNode ruleNode) {
         Object value = ruleNode.value;
         if (value != null && !registeredLints.contains(value)) {
diff --git a/pkg/analyzer/lib/src/lint/project.dart b/pkg/analyzer/lib/src/lint/project.dart
new file mode 100644
index 0000000..9b22294
--- /dev/null
+++ b/pkg/analyzer/lib/src/lint/project.dart
@@ -0,0 +1,129 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/lint/io.dart';
+import 'package:analyzer/src/lint/pub.dart';
+import 'package:path/path.dart' as p;
+
+Pubspec _findAndParsePubspec(Directory root) {
+  if (root.existsSync()) {
+    File pubspec = root
+        .listSync(followLinks: false)
+        .firstWhere((f) => isPubspecFile(f), orElse: () => null);
+    if (pubspec != null) {
+      return new Pubspec.parse(pubspec.readAsStringSync(),
+          sourceUrl: p.toUri(pubspec.path));
+    }
+  }
+  return null;
+}
+
+/// A semantic representation of a Dart project.
+///
+/// Projects provide a semantic model of a Dart project based on the
+/// [pub package layout conventions](https://www.dartlang.org/tools/pub/package-layout.html).
+/// This model allows clients to traverse project contents in a convenient and
+/// standardized way, access global information (such as whether elements are
+/// in the "public API") and resources that have special meanings in the
+/// context of pub package layout conventions.
+class DartProject {
+  _ApiModel _apiModel;
+  String _name;
+  Pubspec _pubspec;
+
+  /// Project root.
+  final Directory root;
+
+  /// Create a Dart project for the corresponding [context] and [sources].
+  /// If a [dir] is unspecified the current working directory will be
+  /// used.
+  DartProject(AnalysisContext context, List<Source> sources, {Directory dir})
+      : root = dir ?? Directory.current {
+    _pubspec = _findAndParsePubspec(root);
+    _apiModel = new _ApiModel(context, sources, root);
+  }
+
+  /// The project's name.
+  ///
+  /// Project names correspond to the package name as specified in the project's
+  /// [pubspec]. The pubspec is found relative to the project [root].  If no
+  /// pubspec can be found, the name defaults to the project root basename.
+  String get name => _name ??= _calculateName();
+
+  /// The project's pubspec.
+  Pubspec get pubspec => _pubspec;
+
+  /// Returns `true` if the given element is part of this project's public API.
+  ///
+  /// Public API elements are defined as all elements that are in the packages's
+  /// `lib` directory, *less* those in `lib/src` (which are treated as private
+  /// *implementation files*), plus elements having been explicitly exported
+  /// via an `export` directive.
+  bool isApi(Element element) => _apiModel.contains(element);
+
+  String _calculateName() {
+    if (pubspec != null) {
+      var nameEntry = pubspec.name;
+      if (nameEntry != null) {
+        return nameEntry.value.text;
+      }
+    }
+    return p.basename(root.path);
+  }
+}
+
+/// An object that can be used to visit Dart project structure.
+abstract class ProjectVisitor<T> {
+  T visit(DartProject project) => null;
+}
+
+/// Captures the project's API as defined by pub package layout standards.
+class _ApiModel {
+  final AnalysisContext context;
+  final List<Source> sources;
+  final Directory root;
+  final Set<LibraryElement> elements = new Set();
+
+  _ApiModel(this.context, this.sources, this.root) {
+    _calculate();
+  }
+
+  /// Return `true` if this element is part of the public API for this package.
+  bool contains(Element element) {
+    while (element != null) {
+      if (!element.isPrivate && elements.contains(element)) {
+        return true;
+      }
+      element = element.enclosingElement;
+    }
+    return false;
+  }
+
+  _calculate() {
+    if (sources == null || sources.isEmpty) {
+      return;
+    }
+
+    var libDir = root.path + '/lib';
+    var libSrcDir = libDir + '/src';
+
+    for (Source source in sources) {
+      var path = source.uri.path;
+      if (path.startsWith(libDir) && !path.startsWith(libSrcDir)) {
+        var library = context.computeLibraryElement(source);
+        var namespaceBuilder = new NamespaceBuilder();
+        var exports = namespaceBuilder.createExportNamespaceForLibrary(library);
+        var public = namespaceBuilder.createPublicNamespaceForLibrary(library);
+        elements.addAll(exports.definedNames.values);
+        elements.addAll(public.definedNames.values);
+      }
+    }
+  }
+}
diff --git a/pkg/analyzer/lib/src/lint/pub.dart b/pkg/analyzer/lib/src/lint/pub.dart
new file mode 100644
index 0000000..8d12e13
--- /dev/null
+++ b/pkg/analyzer/lib/src/lint/pub.dart
@@ -0,0 +1,430 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:collection';
+
+import 'package:source_span/source_span.dart';
+import 'package:yaml/yaml.dart';
+
+PSEntry _findEntry(YamlMap map, String key) {
+  PSEntry entry;
+  map.nodes.forEach((k, v) {
+    if (k is YamlScalar && key == k.toString()) {
+      entry = _processScalar(k, v);
+    }
+  });
+  return entry;
+}
+
+PSDependencyList _processDependencies(YamlScalar key, YamlNode v) {
+  if (v is! YamlMap) {
+    return null;
+  }
+  YamlMap depsMap = v;
+
+  _PSDependencyList deps = new _PSDependencyList(new _PSNode(key));
+  depsMap.nodes.forEach((k, v) => deps.add(new _PSDependency(k, v)));
+  return deps;
+}
+
+PSGitRepo _processGitRepo(YamlScalar key, YamlNode v) {
+  if (v is! YamlMap) {
+    return null;
+  }
+  YamlMap hostMap = v;
+  // url: git://github.com/munificent/kittens.git
+  // ref: some-branch
+  _PSGitRepo repo = new _PSGitRepo();
+  repo.token = new _PSNode(key);
+  repo.ref = _findEntry(hostMap, 'ref');
+  repo.url = _findEntry(hostMap, 'url');
+  return repo;
+}
+
+PSHost _processHost(YamlScalar key, YamlNode v) {
+  if (v is! YamlMap) {
+    return null;
+  }
+  YamlMap hostMap = v;
+  // name: transmogrify
+  // url: http://your-package-server.com
+  _PSHost host = new _PSHost();
+  host.token = new _PSNode(key);
+  host.name = _findEntry(hostMap, 'name');
+  host.url = _findEntry(hostMap, 'url');
+  return host;
+}
+
+PSNodeList _processList(YamlScalar key, YamlNode v) {
+  if (v is! YamlList) {
+    return null;
+  }
+  YamlList nodeList = v;
+
+  return new _PSNodeList(
+      new _PSNode(key), nodeList.nodes.map((n) => new _PSNode(n)));
+}
+
+PSEntry _processScalar(YamlScalar key, YamlNode value) {
+  if (value is! YamlScalar) {
+    return null;
+    //WARN?
+  }
+  return new PSEntry(new _PSNode(key), new _PSNode(value));
+}
+
+abstract class PSDependency {
+  PSGitRepo get git;
+  PSHost get host;
+  PSNode get name;
+  PSEntry get version;
+}
+
+abstract class PSDependencyList extends Object
+    with IterableMixin<PSDependency> {}
+
+class PSEntry {
+  final PSNode key;
+  final PSNode value;
+  PSEntry(this.key, this.value);
+
+  @override
+  String toString() => '${key != null ? (key.toString() + ': ') : ''}$value';
+}
+
+abstract class PSGitRepo {
+  PSEntry get ref;
+  PSNode get token;
+  PSEntry get url;
+}
+
+abstract class PSHost {
+  PSEntry get name;
+  PSNode get token;
+  PSEntry get url;
+}
+
+abstract class PSNode {
+  SourceSpan get span;
+  String get text;
+}
+
+abstract class PSNodeList extends Object with IterableMixin<PSNode> {
+  @override
+  Iterator<PSNode> get iterator;
+  PSNode get token;
+}
+
+abstract class Pubspec {
+  factory Pubspec.parse(String source, {Uri sourceUrl}) =>
+      new _Pubspec(source, sourceUrl: sourceUrl);
+  PSEntry get author;
+  PSNodeList get authors;
+  PSDependencyList get dependencies;
+  PSEntry get description;
+  PSDependencyList get devDependencies;
+  PSEntry get documentation;
+  PSEntry get homepage;
+  PSEntry get name;
+  PSEntry get version;
+  accept(PubspecVisitor visitor);
+}
+
+abstract class PubspecVisitor<T> {
+  T visitPackageAuthor(PSEntry author) => null;
+  T visitPackageAuthors(PSNodeList authors) => null;
+  T visitPackageDependencies(PSDependencyList dependencies) => null;
+  T visitPackageDependency(PSDependency dependency) => null;
+  T visitPackageDescription(PSEntry description) => null;
+  T visitPackageDevDependencies(PSDependencyList dependencies) => null;
+  T visitPackageDevDependency(PSDependency dependency) => null;
+  T visitPackageDocumentation(PSEntry documentation) => null;
+  T visitPackageHomepage(PSEntry homepage) => null;
+  T visitPackageName(PSEntry name) => null;
+  T visitPackageVersion(PSEntry version) => null;
+}
+
+class _PSDependency extends PSDependency {
+  @override
+  PSNode name;
+  @override
+  PSEntry version;
+  @override
+  PSHost host;
+  @override
+  PSGitRepo git;
+
+  factory _PSDependency(dynamic k, YamlNode v) {
+    if (k is! YamlScalar) {
+      return null;
+    }
+    YamlScalar key = k;
+
+    _PSDependency dep = new _PSDependency._();
+
+    dep.name = new _PSNode(key);
+
+    if (v is YamlScalar) {
+      // Simple version
+      dep.version = new PSEntry(null, new _PSNode(v));
+    } else if (v is YamlMap) {
+      // hosted:
+      //   name: transmogrify
+      //   url: http://your-package-server.com
+      //   version: '>=0.4.0 <1.0.0'
+      YamlMap details = v;
+      details.nodes.forEach((k, v) {
+        if (k is! YamlScalar) {
+          return;
+        }
+        YamlScalar key = k;
+        switch (key.toString()) {
+          case 'version':
+            dep.version = _processScalar(key, v);
+            break;
+          case 'hosted':
+            dep.host = _processHost(key, v);
+            break;
+          case 'git':
+            dep.git = _processGitRepo(key, v);
+            break;
+        }
+      });
+    }
+    return dep;
+  }
+
+  _PSDependency._();
+
+  @override
+  String toString() {
+    var sb = new StringBuffer();
+    if (name != null) {
+      sb.write('$name:');
+    }
+    var versionInfo = '';
+    if (version != null) {
+      if (version.key == null) {
+        versionInfo = ' $version';
+      } else {
+        versionInfo = '\n    $version';
+      }
+    }
+    sb.writeln(versionInfo);
+    if (host != null) {
+      sb.writeln(host);
+    }
+    if (git != null) {
+      sb.writeln(git);
+    }
+    return sb.toString();
+  }
+}
+
+class _PSDependencyList extends PSDependencyList {
+  final dependencies = <PSDependency>[];
+  final PSNode token;
+
+  _PSDependencyList(this.token);
+
+  @override
+  Iterator<PSDependency> get iterator => dependencies.iterator;
+
+  add(PSDependency dependency) {
+    if (dependency != null) {
+      dependencies.add(dependency);
+    }
+  }
+
+  @override
+  String toString() => '$token\n${dependencies.join('  ')}';
+}
+
+class _PSGitRepo implements PSGitRepo {
+  @override
+  PSNode token;
+  @override
+  PSEntry ref;
+  @override
+  PSEntry url;
+  @override
+  String toString() => '''
+    $token:
+      $url
+      $ref''';
+}
+
+class _PSHost implements PSHost {
+  @override
+  PSNode token;
+  @override
+  PSEntry name;
+  @override
+  PSEntry url;
+  @override
+  String toString() => '''
+    $token:
+      $name
+      $url''';
+}
+
+class _PSNode implements PSNode {
+  @override
+  final String text;
+  @override
+  final SourceSpan span;
+
+  _PSNode(YamlNode node)
+      : text = node.value?.toString(),
+        span = node.span;
+
+  @override
+  String toString() => '$text';
+}
+
+class _PSNodeList extends PSNodeList {
+  @override
+  final PSNode token;
+  final Iterable<PSNode> nodes;
+
+  _PSNodeList(this.token, this.nodes);
+
+  @override
+  Iterator<PSNode> get iterator => nodes.iterator;
+
+  @override
+  String toString() => '''
+$token:
+  - ${nodes.join('\n  - ')}''';
+}
+
+class _Pubspec implements Pubspec {
+  @override
+  PSEntry author;
+  @override
+  PSNodeList authors;
+  @override
+  PSEntry description;
+  @override
+  PSEntry documentation;
+  @override
+  PSEntry homepage;
+  @override
+  PSEntry name;
+  @override
+  PSEntry version;
+  @override
+  PSDependencyList dependencies;
+  @override
+  PSDependencyList devDependencies;
+
+  _Pubspec(String src, {Uri sourceUrl}) {
+    try {
+      _parse(src, sourceUrl: sourceUrl);
+    } on Exception {
+      // ignore
+    }
+  }
+
+  @override
+  void accept(PubspecVisitor visitor) {
+    if (author != null) {
+      visitor.visitPackageAuthor(author);
+    }
+    if (authors != null) {
+      visitor.visitPackageAuthors(authors);
+    }
+    if (description != null) {
+      visitor.visitPackageDescription(description);
+    }
+    if (documentation != null) {
+      visitor.visitPackageDocumentation(documentation);
+    }
+    if (homepage != null) {
+      visitor.visitPackageHomepage(homepage);
+    }
+    if (name != null) {
+      visitor.visitPackageName(name);
+    }
+    if (version != null) {
+      visitor.visitPackageVersion(version);
+    }
+    if (dependencies != null) {
+      visitor.visitPackageDependencies(dependencies);
+      dependencies.forEach((d) => visitor.visitPackageDependency(d));
+    }
+    if (devDependencies != null) {
+      visitor.visitPackageDevDependencies(devDependencies);
+      devDependencies.forEach((d) => visitor.visitPackageDevDependency(d));
+    }
+  }
+
+  @override
+  String toString() {
+    var sb = new _StringBuilder();
+    sb.writelin(name);
+    sb.writelin(version);
+    sb.writelin(author);
+    sb.writelin(authors);
+    sb.writelin(description);
+    sb.writelin(homepage);
+    sb.writelin(dependencies);
+    sb.writelin(devDependencies);
+    return sb.toString();
+  }
+
+  _parse(String src, {Uri sourceUrl}) {
+    var yaml = loadYamlNode(src, sourceUrl: sourceUrl);
+    if (yaml is! YamlMap) {
+      return;
+    }
+    YamlMap yamlMap = yaml;
+    yamlMap.nodes.forEach((k, v) {
+      if (k is! YamlScalar) {
+        return;
+      }
+      YamlScalar key = k;
+      switch (key.toString()) {
+        case 'author':
+          author = _processScalar(key, v);
+          break;
+        case 'authors':
+          authors = _processList(key, v);
+          break;
+        case 'homepage':
+          homepage = _processScalar(key, v);
+          break;
+        case 'name':
+          name = _processScalar(key, v);
+          break;
+        case 'description':
+          description = _processScalar(key, v);
+          break;
+        case 'documentation':
+          documentation = _processScalar(key, v);
+          break;
+        case 'dependencies':
+          dependencies = _processDependencies(key, v);
+          break;
+        case 'dev_dependencies':
+          devDependencies = _processDependencies(key, v);
+          break;
+        case 'version':
+          version = _processScalar(key, v);
+          break;
+      }
+    });
+  }
+}
+
+class _StringBuilder {
+  StringBuffer buffer = new StringBuffer();
+  @override
+  String toString() => buffer.toString();
+  writelin(Object value) {
+    if (value != null) {
+      buffer.writeln(value);
+    }
+  }
+}
diff --git a/pkg/analyzer/lib/src/lint/registry.dart b/pkg/analyzer/lib/src/lint/registry.dart
new file mode 100644
index 0000000..172767b
--- /dev/null
+++ b/pkg/analyzer/lib/src/lint/registry.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:collection';
+
+import 'package:analyzer/src/lint/config.dart';
+import 'package:analyzer/src/lint/linter.dart';
+
+/**
+ * Registry of lint rules.
+ */
+class Registry extends Object with IterableMixin<LintRule> {
+  /**
+   * The default registry to be used by clients.
+   */
+  static final Registry ruleRegistry = new Registry();
+
+  /**
+   * A table mapping rule names to rules.
+   */
+  Map<String, LintRule> _ruleMap = <String, LintRule>{};
+
+  /**
+   * A list of the default lint rules.
+   */
+  List<LintRule> _defaultRules = <LintRule>[];
+
+  /**
+   * Return a list of the default lint rules.
+   */
+  List<LintRule> get defaultRules => _defaultRules;
+
+  @override
+  Iterator<LintRule> get iterator => _ruleMap.values.iterator;
+
+  /**
+   * Return a list of the rules that are defined.
+   */
+  Iterable<LintRule> get rules => _ruleMap.values;
+
+  /**
+   * Return the lint rule with the given [name].
+   */
+  LintRule operator [](String name) => _ruleMap[name];
+
+  /**
+   * Return a list of the lint rules explicitly enabled by the given [config].
+   *
+   * For example:
+   *     my_rule: true
+   *
+   * enables `my_rule`.
+   *
+   * Unspecified rules are treated as disabled by default.
+   */
+  Iterable<LintRule> enabled(LintConfig config) => rules
+      .where((rule) => config.ruleConfigs.any((rc) => rc.enables(rule.name)));
+
+  /**
+   * Add the given lint [rule] to this registry.
+   */
+  void register(LintRule rule) {
+    _ruleMap[rule.name] = rule;
+  }
+
+  /**
+   * Add the given lint [rule] to this registry and mark it as being a default
+   * lint (one that will be run if lints are requested but no rules are enabled.
+   */
+  void registerDefault(LintRule rule) {
+    register(rule);
+    _defaultRules.add(rule);
+  }
+}
diff --git a/pkg/analyzer/lib/src/lint/util.dart b/pkg/analyzer/lib/src/lint/util.dart
new file mode 100644
index 0000000..e1c63af
--- /dev/null
+++ b/pkg/analyzer/lib/src/lint/util.dart
@@ -0,0 +1,172 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:analyzer/analyzer.dart';
+import 'package:analyzer/dart/ast/token.dart';
+import 'package:analyzer/src/dart/ast/token.dart';
+import 'package:analyzer/src/dart/scanner/reader.dart';
+import 'package:analyzer/src/dart/scanner/scanner.dart';
+import 'package:analyzer/src/generated/parser.dart' show Parser;
+import 'package:analyzer/src/string_source.dart' show StringSource;
+import 'package:path/path.dart' as p;
+
+final _identifier = new RegExp(r'^([(_|$)a-zA-Z]+([_a-zA-Z0-9])*)$');
+
+final _lowerCamelCase =
+    new RegExp(r'^(_)*[?$a-z][a-z0-9?$]*([A-Z][a-z0-9?$]*)*$');
+
+final _lowerCaseUnderScore = new RegExp(r'^([a-z]+([_]?[a-z0-9]+)*)+$');
+
+final _lowerCaseUnderScoreWithDots =
+    new RegExp(r'^[a-z][_a-z0-9]*(\.[a-z][_a-z0-9]*)*$');
+
+final _pubspec = new RegExp(r'^[_]?pubspec\.yaml$');
+
+final _underscores = new RegExp(r'^[_]+$');
+
+/// Create a library name prefix based on [libraryPath], [projectRoot] and
+/// current [packageName].
+String createLibraryNamePrefix(
+    {String libraryPath, String projectRoot, String packageName}) {
+  // Use the posix context to canonicalize separators (`\`).
+  var libraryDirectory = p.posix.dirname(libraryPath);
+  var path = p.posix.relative(libraryDirectory, from: projectRoot);
+  // Drop 'lib/'.
+  var segments = p.split(path);
+  if (segments[0] == 'lib') {
+    path = p.posix.joinAll(segments.sublist(1));
+  }
+  // Replace separators.
+  path = path.replaceAll('/', '.');
+  // Add separator if needed.
+  if (path.isNotEmpty) {
+    path = '.$path';
+  }
+
+  return '$packageName$path';
+}
+
+/// Returns `true` if this [fileName] is a Dart file.
+bool isDartFileName(String fileName) => fileName.endsWith('.dart');
+
+/// Returns `true` if this [name] is a legal Dart identifier.
+bool isIdentifier(String name) => _identifier.hasMatch(name);
+
+/// Returns `true` of the given [name] is composed only of `_`s.
+bool isJustUnderscores(String name) => _underscores.hasMatch(name);
+
+/// Returns `true` if this [id] is `lowerCamelCase`.
+bool isLowerCamelCase(String id) =>
+    id.length == 1 && isUpperCase(id.codeUnitAt(0)) ||
+    id == '_' ||
+    _lowerCamelCase.hasMatch(id);
+
+/// Returns `true` if this [id] is `lower_camel_case_with_underscores`.
+bool isLowerCaseUnderScore(String id) => _lowerCaseUnderScore.hasMatch(id);
+
+/// Returns `true` if this [id] is `lower_camel_case_with_underscores_or.dots`.
+bool isLowerCaseUnderScoreWithDots(String id) =>
+    _lowerCaseUnderScoreWithDots.hasMatch(id);
+
+/// Returns `true` if this [fileName] is a Pubspec file.
+bool isPubspecFileName(String fileName) => _pubspec.hasMatch(fileName);
+
+/// Returns `true` if the given code unit [c] is upper case.
+bool isUpperCase(int c) => c >= 0x40 && c <= 0x5A;
+
+class Spelunker {
+  final String path;
+  final IOSink sink;
+  Spelunker(this.path, {IOSink sink}) : this.sink = sink ?? stdout;
+
+  void spelunk() {
+    var contents = new File(path).readAsStringSync();
+
+    var errorListener = new _ErrorListener();
+
+    var reader = new CharSequenceReader(contents);
+    var stringSource = new StringSource(contents, path);
+    var scanner = new Scanner(stringSource, reader, errorListener);
+    var startToken = scanner.tokenize();
+
+    errorListener.throwIfErrors();
+
+    var parser = new Parser(stringSource, errorListener);
+    var node = parser.parseCompilationUnit(startToken);
+
+    errorListener.throwIfErrors();
+
+    var visitor = new _SourceVisitor(sink);
+    node.accept(visitor);
+  }
+}
+
+class _ErrorListener implements AnalysisErrorListener {
+  final errors = <AnalysisError>[];
+
+  @override
+  void onError(AnalysisError error) {
+    errors.add(error);
+  }
+
+  void throwIfErrors() {
+    if (errors.isNotEmpty) {
+      throw new Exception(errors);
+    }
+  }
+}
+
+class _SourceVisitor extends GeneralizingAstVisitor {
+  int indent = 0;
+
+  final IOSink sink;
+  _SourceVisitor(this.sink);
+
+  String asString(AstNode node) =>
+      typeInfo(node.runtimeType) + ' [${node.toString()}]';
+
+  List<CommentToken> getPrecedingComments(Token token) {
+    var comments = <CommentToken>[];
+    var comment = token.precedingComments;
+    while (comment is CommentToken) {
+      comments.add(comment);
+      comment = comment.next;
+    }
+    return comments;
+  }
+
+  String getTrailingComment(AstNode node) {
+    var successor = node.endToken.next;
+    if (successor != null) {
+      var precedingComments = successor.precedingComments;
+      if (precedingComments != null) {
+        return precedingComments.toString();
+      }
+    }
+    return '';
+  }
+
+  String typeInfo(Type type) => type.toString();
+
+  @override
+  visitNode(AstNode node) {
+    write(node);
+
+    ++indent;
+    node.visitChildren(this);
+    --indent;
+    return null;
+  }
+
+  write(AstNode node) {
+    //EOL comments
+    var comments = getPrecedingComments(node.beginToken);
+    comments.forEach((c) => sink.writeln('${"  " * indent}$c'));
+
+    sink.writeln(
+        '${"  " * indent}${asString(node)} ${getTrailingComment(node)}');
+  }
+}
diff --git a/pkg/analyzer/lib/src/plugin/command_line_plugin.dart b/pkg/analyzer/lib/src/plugin/command_line_plugin.dart
deleted file mode 100644
index b2f8c58..0000000
--- a/pkg/analyzer/lib/src/plugin/command_line_plugin.dart
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analyzer.src.plugin.command_line_plugin;
-
-import 'package:analyzer/plugin/command_line.dart';
-import 'package:plugin/plugin.dart';
-
-/**
- * A plugin that defines the extension points and extensions that are defined by
- * command-line applications using the analysis engine.
- */
-class CommandLinePlugin implements Plugin {
-  /**
-   * The simple identifier of the extension point that allows plugins to
-   * register new parser contributors.
-   */
-  static const String PARSER_CONTRIBUTOR_EXTENSION_POINT = 'parserContributor';
-
-  /**
-   * The simple identifier of the extension point that allows plugins to
-   * register new result processors.
-   */
-  static const String RESULT_PROCESSOR_EXTENSION_POINT = 'resultProcessor';
-
-  /**
-   * The unique identifier of this plugin.
-   */
-  static const String UNIQUE_IDENTIFIER = 'command_line.core';
-
-  /**
-   * The extension point that allows plugins to register new parser
-   * contributors.
-   */
-  ExtensionPoint<ArgParserContributor> parserContributorExtensionPoint;
-
-  /**
-   * The extension point that allows plugins to register new result processors.
-   */
-  ExtensionPoint<ArgResultsProcessor> resultProcessorExtensionPoint;
-
-  /**
-   * Initialize a newly created plugin.
-   */
-  CommandLinePlugin();
-
-  /**
-   * Return a list containing all of the parser contributors that were
-   * contributed.
-   */
-  List<ArgParserContributor> get parserContributors =>
-      parserContributorExtensionPoint.extensions;
-
-  /**
-   * Return a list containing all of the result processors that were
-   * contributed.
-   */
-  List<ArgResultsProcessor> get resultProcessors =>
-      resultProcessorExtensionPoint.extensions;
-
-  @override
-  String get uniqueIdentifier => UNIQUE_IDENTIFIER;
-
-  @override
-  void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
-    parserContributorExtensionPoint = new ExtensionPoint<ArgParserContributor>(
-        this, PARSER_CONTRIBUTOR_EXTENSION_POINT, null);
-    registerExtensionPoint(parserContributorExtensionPoint);
-    resultProcessorExtensionPoint = new ExtensionPoint<ArgResultsProcessor>(
-        this, RESULT_PROCESSOR_EXTENSION_POINT, null);
-    registerExtensionPoint(resultProcessorExtensionPoint);
-  }
-
-  @override
-  void registerExtensions(RegisterExtension registerExtension) {
-    // There are no default extensions.
-  }
-}
diff --git a/pkg/analyzer/lib/src/plugin/engine_plugin.dart b/pkg/analyzer/lib/src/plugin/engine_plugin.dart
index 8166178..fb0599db4 100644
--- a/pkg/analyzer/lib/src/plugin/engine_plugin.dart
+++ b/pkg/analyzer/lib/src/plugin/engine_plugin.dart
@@ -10,11 +10,9 @@
     show InternalAnalysisContext;
 import 'package:analyzer/src/task/dart.dart';
 import 'package:analyzer/src/task/dart_work_manager.dart';
-import 'package:analyzer/src/task/general.dart';
 import 'package:analyzer/src/task/html.dart';
 import 'package:analyzer/src/task/html_work_manager.dart';
 import 'package:analyzer/src/task/options_work_manager.dart';
-import 'package:analyzer/src/task/yaml.dart';
 import 'package:analyzer/task/model.dart';
 import 'package:plugin/plugin.dart';
 
@@ -46,12 +44,6 @@
 
   /**
    * The simple identifier of the extension point that allows plugins to
-   * register new analysis tasks with the analysis engine.
-   */
-  static const String TASK_EXTENSION_POINT = 'task';
-
-  /**
-   * The simple identifier of the extension point that allows plugins to
    * register new work manager factories with the analysis engine.
    */
   static const String WORK_MANAGER_FACTORY_EXTENSION_POINT =
@@ -83,12 +75,6 @@
   ExtensionPoint<ListResultDescriptor<AnalysisError>> htmlErrorsExtensionPoint;
 
   /**
-   * The extension point that allows plugins to register new analysis tasks with
-   * the analysis engine.
-   */
-  ExtensionPoint<TaskDescriptor> taskExtensionPoint;
-
-  /**
    * The extension point that allows plugins to register new work manager
    * factories with the analysis engine.
    */
@@ -122,11 +108,6 @@
   @ExtensionPointId('HTML_ERRORS_EXTENSION_POINT_ID')
   List<ResultDescriptor> get htmlErrors => htmlErrorsExtensionPoint.extensions;
 
-  /**
-   * Return a list containing all of the task descriptors that were contributed.
-   */
-  List<TaskDescriptor> get taskDescriptors => taskExtensionPoint.extensions;
-
   @override
   String get uniqueIdentifier => UNIQUE_IDENTIFIER;
 
@@ -151,9 +132,6 @@
         new ExtensionPoint<ListResultDescriptor<AnalysisError>>(
             this, HTML_ERRORS_EXTENSION_POINT, null);
     registerExtensionPoint(htmlErrorsExtensionPoint);
-    taskExtensionPoint =
-        new ExtensionPoint<TaskDescriptor>(this, TASK_EXTENSION_POINT, null);
-    registerExtensionPoint(taskExtensionPoint);
     workManagerFactoryExtensionPoint = new ExtensionPoint<WorkManagerFactory>(
         this, WORK_MANAGER_FACTORY_EXTENSION_POINT, null);
     registerExtensionPoint(workManagerFactoryExtensionPoint);
@@ -161,7 +139,6 @@
 
   @override
   void registerExtensions(RegisterExtension registerExtension) {
-    _registerTaskExtensions(registerExtension);
     _registerWorkManagerFactoryExtensions(registerExtension);
     _registerDartErrorsForSource(registerExtension);
     _registerDartErrorsForUnit(registerExtension);
@@ -182,75 +159,6 @@
     registerExtension(HTML_ERRORS_EXTENSION_POINT_ID, HTML_DOCUMENT_ERRORS);
   }
 
-  void _registerTaskExtensions(RegisterExtension registerExtension) {
-    String taskId = TASK_EXTENSION_POINT_ID;
-    //
-    // Register general tasks.
-    //
-    registerExtension(taskId, GetContentTask.DESCRIPTOR);
-    //
-    // Register Dart tasks.
-    //
-    registerExtension(taskId, BuildCompilationUnitElementTask.DESCRIPTOR);
-    registerExtension(taskId, BuildDirectiveElementsTask.DESCRIPTOR);
-    registerExtension(taskId, BuildEnumMemberElementsTask.DESCRIPTOR);
-    registerExtension(taskId, BuildExportNamespaceTask.DESCRIPTOR);
-    registerExtension(taskId, BuildLibraryElementTask.DESCRIPTOR);
-    registerExtension(taskId, BuildPublicNamespaceTask.DESCRIPTOR);
-    registerExtension(taskId, BuildSourceExportClosureTask.DESCRIPTOR);
-    registerExtension(taskId, BuildTypeProviderTask.DESCRIPTOR);
-    registerExtension(taskId, ComputeConstantDependenciesTask.DESCRIPTOR);
-    registerExtension(taskId, ComputeConstantValueTask.DESCRIPTOR);
-    registerExtension(
-        taskId, ComputeInferableStaticVariableDependenciesTask.DESCRIPTOR);
-    registerExtension(taskId, ComputeLibraryCycleTask.DESCRIPTOR);
-    registerExtension(taskId, ComputeRequiredConstantsTask.DESCRIPTOR);
-    registerExtension(taskId, ContainingLibrariesTask.DESCRIPTOR);
-    registerExtension(taskId, DartErrorsTask.DESCRIPTOR);
-    registerExtension(taskId, EvaluateUnitConstantsTask.DESCRIPTOR);
-    registerExtension(taskId, GatherUsedImportedElementsTask.DESCRIPTOR);
-    registerExtension(taskId, GatherUsedLocalElementsTask.DESCRIPTOR);
-    registerExtension(taskId, GenerateHintsTask.DESCRIPTOR);
-    registerExtension(taskId, GenerateLintsTask.DESCRIPTOR);
-    registerExtension(taskId, InferInstanceMembersInUnitTask.DESCRIPTOR);
-    registerExtension(taskId, InferStaticVariableTypesInUnitTask.DESCRIPTOR);
-    registerExtension(taskId, InferStaticVariableTypeTask.DESCRIPTOR);
-    registerExtension(taskId, LibraryErrorsReadyTask.DESCRIPTOR);
-    registerExtension(taskId, LibraryUnitErrorsTask.DESCRIPTOR);
-    registerExtension(taskId, ParseDartTask.DESCRIPTOR);
-    registerExtension(taskId, PartiallyResolveUnitReferencesTask.DESCRIPTOR);
-    registerExtension(taskId, ReadyLibraryElement2Task.DESCRIPTOR);
-    registerExtension(taskId, ReadyLibraryElement5Task.DESCRIPTOR);
-    registerExtension(taskId, ReadyLibraryElement7Task.DESCRIPTOR);
-    registerExtension(taskId, ReadyResolvedUnitTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveConstantExpressionTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveDirectiveElementsTask.DESCRIPTOR);
-    registerExtension(taskId, ResolvedUnit7InLibraryClosureTask.DESCRIPTOR);
-    registerExtension(taskId, ResolvedUnit7InLibraryTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveInstanceFieldsInUnitTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveLibraryReferencesTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveLibraryTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveLibraryTypeNamesTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveTopLevelLibraryTypeBoundsTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveTopLevelUnitTypeBoundsTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveUnitTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveUnitTypeNamesTask.DESCRIPTOR);
-    registerExtension(taskId, ResolveVariableReferencesTask.DESCRIPTOR);
-    registerExtension(taskId, ScanDartTask.DESCRIPTOR);
-    registerExtension(taskId, StrongModeVerifyUnitTask.DESCRIPTOR);
-    registerExtension(taskId, VerifyUnitTask.DESCRIPTOR);
-    //
-    // Register HTML tasks.
-    //
-    registerExtension(taskId, DartScriptsTask.DESCRIPTOR);
-    registerExtension(taskId, HtmlErrorsTask.DESCRIPTOR);
-    registerExtension(taskId, ParseHtmlTask.DESCRIPTOR);
-    //
-    // Register YAML tasks.
-    //
-    registerExtension(taskId, ParseYamlTask.DESCRIPTOR);
-  }
-
   void _registerWorkManagerFactoryExtensions(
       RegisterExtension registerExtension) {
     String taskId = WORK_MANAGER_EXTENSION_POINT_ID;
diff --git a/pkg/analyzer/lib/src/plugin/options_plugin.dart b/pkg/analyzer/lib/src/plugin/options_plugin.dart
deleted file mode 100644
index aceaf3b..0000000
--- a/pkg/analyzer/lib/src/plugin/options_plugin.dart
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analyzer.src.plugin.options_plugin;
-
-import 'package:analyzer/plugin/options.dart';
-import 'package:analyzer/plugin/task.dart';
-import 'package:analyzer/src/task/options.dart';
-import 'package:plugin/plugin.dart';
-
-/// A plugin that defines the extension points and extensions that are defined
-/// by applications that want to consume options defined in the analysis
-/// options file.
-class OptionsPlugin implements Plugin {
-  /// The simple identifier of the extension point that allows plugins to
-  /// register new options processors.
-  static const String OPTIONS_PROCESSOR_EXTENSION_POINT = 'optionsProcessor';
-
-  /// The simple identifier of the extension point that allows plugins to
-  /// register new options validators.
-  static const String OPTIONS_VALIDATOR_EXTENSION_POINT = 'optionsValidator';
-
-  /// The unique identifier of this plugin.
-  static const String UNIQUE_IDENTIFIER = 'options.core';
-
-  /// The extension point that allows plugins to register new options
-  /// processors.
-  ExtensionPoint<OptionsProcessor> optionsProcessorExtensionPoint;
-
-  /// The extension point that allows plugins to register new options
-  /// validators.
-  ExtensionPoint<OptionsValidator> optionsValidatorExtensionPoint;
-
-  /// All contributed options processors.
-  List<OptionsProcessor> get optionsProcessors =>
-      optionsProcessorExtensionPoint?.extensions ?? const <OptionsProcessor>[];
-
-  /// All contributed options validators.
-  List<OptionsValidator> get optionsValidators =>
-      optionsValidatorExtensionPoint?.extensions ?? const <OptionsValidator>[];
-
-  @override
-  String get uniqueIdentifier => UNIQUE_IDENTIFIER;
-
-  @override
-  void registerExtensionPoints(RegisterExtensionPoint registerExtensionPoint) {
-    optionsProcessorExtensionPoint = new ExtensionPoint<OptionsProcessor>(
-        this, OPTIONS_PROCESSOR_EXTENSION_POINT, null);
-    registerExtensionPoint(optionsProcessorExtensionPoint);
-    optionsValidatorExtensionPoint = new ExtensionPoint<OptionsValidator>(
-        this, OPTIONS_VALIDATOR_EXTENSION_POINT, null);
-    registerExtensionPoint(optionsValidatorExtensionPoint);
-  }
-
-  @override
-  void registerExtensions(RegisterExtension registerExtension) {
-    // Analyze options files.
-    registerExtension(
-        TASK_EXTENSION_POINT_ID, GenerateOptionsErrorsTask.DESCRIPTOR);
-    // Validate analyzer analysis options.
-    registerExtension(
-        OPTIONS_VALIDATOR_EXTENSION_POINT_ID, new AnalyzerOptionsValidator());
-  }
-}
diff --git a/pkg/analyzer/lib/src/plugin/plugin_configuration.dart b/pkg/analyzer/lib/src/plugin/plugin_configuration.dart
deleted file mode 100644
index 2137f11..0000000
--- a/pkg/analyzer/lib/src/plugin/plugin_configuration.dart
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analyzer.src.plugin.plugin_configuration;
-
-import 'package:analyzer/plugin/options.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:yaml/yaml.dart';
-
-const _analyzerOptionScope = 'analyzer';
-
-const _pluginOptionScope = 'plugins';
-
-/// Parse the given string into a plugin manifest.
-PluginManifest parsePluginManifestString(String manifestSource) {
-  var yaml = loadYaml(manifestSource);
-  if (yaml == null) {
-    return null;
-  }
-  _verifyMap(yaml, 'plugin manifest');
-  Iterable<String> pluginHost = _parseHosts(yaml['contributes_to']);
-  PluginInfo plugin = _parsePlugin(yaml);
-  return new PluginManifest(contributesTo: pluginHost, plugin: plugin);
-}
-
-String _asString(dynamic yaml) {
-  if (yaml != null && yaml is! String) {
-    throw new PluginConfigFormatException(
-        'Unable to parse pugin manifest, '
-        'expected `String`, got `${yaml.runtimeType}`',
-        yaml);
-  }
-  return yaml;
-}
-
-Iterable<String> _parseHosts(dynamic yaml) {
-  List<String> hosts = <String>[];
-  if (yaml is String) {
-    hosts.add(yaml);
-  } else if (yaml is YamlList) {
-    yaml.forEach((h) => hosts.add(_asString(h)));
-  }
-  return hosts;
-}
-
-PluginInfo _parsePlugin(dynamic yaml) {
-  if (yaml != null) {
-    _verifyMap(yaml, 'plugin manifest');
-    return new PluginInfo._fromYaml(details: yaml);
-  }
-  return null;
-}
-
-PluginInfo _processPluginMapping(dynamic name, dynamic details) {
-  if (name is String) {
-    if (details is String) {
-      return new PluginInfo(name: name, version: details);
-    }
-    if (details is YamlMap) {
-      return new PluginInfo._fromYaml(name: name, details: details);
-    }
-  }
-
-  return null;
-}
-
-_verifyMap(dynamic yaml, String context) {
-  if (yaml is! YamlMap) {
-    throw new PluginConfigFormatException(
-        'Unable to parse $context, '
-        'expected `YamlMap`, got `${yaml.runtimeType}`',
-        yaml);
-  }
-}
-
-/// A callback for error handling.
-typedef ErrorHandler(Exception e);
-
-/// Describes plugin configuration information as extracted from an
-/// analysis options map or plugin manifest.
-class PluginConfig {
-  final Iterable<PluginInfo> plugins;
-  PluginConfig(this.plugins);
-
-  /// Create a plugin configuration from an options map.
-  factory PluginConfig.fromOptions(Map<String, Object> options) {
-    List<PluginInfo> plugins = [];
-    var analyzerOptions = options[_analyzerOptionScope];
-    if (analyzerOptions != null) {
-      //TODO(pq): handle "raw" maps (https://github.com/dart-lang/sdk/issues/25126)
-      if (analyzerOptions is YamlMap) {
-        var pluginConfig = analyzerOptions[_pluginOptionScope];
-        if (pluginConfig is YamlMap) {
-          pluginConfig.forEach((name, details) {
-            var plugin = _processPluginMapping(name, details);
-            if (plugin != null) {
-              plugins.add(plugin);
-            }
-          });
-        } else {
-          // Anything but an empty list of plugins is treated as a format error.
-          if (pluginConfig != null) {
-            throw new PluginConfigFormatException(
-                'Unrecognized plugin config format, expected `YamlMap`, '
-                'got `${pluginConfig.runtimeType}`',
-                pluginConfig);
-          }
-        }
-      }
-    }
-
-    return new PluginConfig(plugins);
-  }
-}
-
-/// Thrown on bad plugin config format.
-class PluginConfigFormatException implements Exception {
-  /// Descriptive message.
-  final message;
-
-  /// The `plugin:` yaml node for generating detailed error feedback.
-  final yamlNode;
-  PluginConfigFormatException(this.message, this.yamlNode);
-}
-
-/// Extracts plugin config details from analysis options.
-class PluginConfigOptionsProcessor extends OptionsProcessor {
-  final ErrorHandler _errorHandler;
-
-  PluginConfig _config;
-
-  PluginConfigOptionsProcessor([this._errorHandler]);
-
-  /// The processed plugin config.
-  PluginConfig get config => _config;
-
-  @override
-  void onError(Exception exception) {
-    if (_errorHandler != null) {
-      _errorHandler(exception);
-    }
-  }
-
-  @override
-  void optionsProcessed(AnalysisContext context, Map<String, Object> options) {
-    _config = new PluginConfig.fromOptions(options);
-  }
-}
-
-/// Describes plugin information.
-class PluginInfo {
-  final String name;
-  final String className;
-  final String version;
-  final String libraryUri;
-  final String packageName;
-  final String path;
-  PluginInfo(
-      {this.name,
-      this.version,
-      this.className,
-      this.libraryUri,
-      this.packageName,
-      this.path});
-
-  factory PluginInfo._fromYaml({String name, YamlMap details}) =>
-      new PluginInfo(
-          name: name,
-          version: _asString(details['version']),
-          className: _asString(details['class_name']),
-          libraryUri: _asString(details['library_uri']),
-          packageName: _asString(details['package_name']),
-          path: _asString(details['path']));
-}
-
-/// Plugin manifests accompany plugin packages, providing
-/// configuration information for published plugins.
-///
-/// Provisionally, plugin manifests live in a file `plugin.yaml`
-/// at the root of the plugin package.
-///
-///     my_plugin/
-///       bin/
-///       lib/
-///       plugin.yaml
-///       pubspec.yaml
-///
-/// Provisional manifest file format:
-///
-///     class_name: MyAnalyzerPlugin
-///     library_uri: 'my_plugin/my_analyzer_plugin.dart'
-///     contributes_to: analyzer
-class PluginManifest {
-  PluginInfo plugin;
-  Iterable<String> contributesTo;
-  PluginManifest({this.plugin, this.contributesTo});
-}
diff --git a/pkg/analyzer/lib/src/services/lint.dart b/pkg/analyzer/lib/src/services/lint.dart
index 097a8df..af6a3ee 100644
--- a/pkg/analyzer/lib/src/services/lint.dart
+++ b/pkg/analyzer/lib/src/services/lint.dart
@@ -8,6 +8,7 @@
 
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/error/lint_codes.dart';
 import 'package:analyzer/src/generated/engine.dart';
 
 /// Shared lint registry.
@@ -32,6 +33,11 @@
   /// NOTE: this is set by the framework before visit begins.
   ErrorReporter reporter;
 
+  /**
+   * Return the lint code associated with this linter.
+   */
+  LintCode get lintCode => null;
+
   /// Linter name.
   String get name;
 
diff --git a/pkg/analyzer/lib/src/summary/bazel_summary.dart b/pkg/analyzer/lib/src/summary/bazel_summary.dart
deleted file mode 100644
index a7b9b88..0000000
--- a/pkg/analyzer/lib/src/summary/bazel_summary.dart
+++ /dev/null
@@ -1,561 +0,0 @@
-// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:convert';
-
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/utilities_collection.dart';
-import 'package:analyzer/src/summary/api_signature.dart';
-import 'package:analyzer/src/summary/format.dart';
-import 'package:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary/link.dart';
-import 'package:analyzer/src/summary/package_bundle_reader.dart';
-import 'package:analyzer/src/summary/summarize_elements.dart';
-import 'package:analyzer/src/util/fast_uri.dart';
-import 'package:convert/convert.dart';
-import 'package:crypto/crypto.dart';
-import 'package:meta/meta.dart';
-
-/**
- * Return the [Folder] where bundles for the given [absoluteUri] should be
- * looked for. This folder should contain corresponding `*.full.ds` files,
- * possibly more than one one.  Return `null` if the given [absoluteUri]
- * does not have the expected structure, so the output path cannot be computed.
- */
-typedef Folder GetOutputFolder(Uri absoluteUri);
-
-/**
- * Load linked packages on demand from [SummaryProvider].
- */
-class BazelResultProvider extends ResynthesizerResultProvider {
-  final SummaryDataStore dataStore;
-  final SummaryProvider summaryProvider;
-
-  final Map<Source, bool> sourceToSuccessMap = <Source, bool>{};
-  final Set<Package> addedPackages = new Set<Package>();
-
-  factory BazelResultProvider(SummaryProvider summaryProvider) {
-    SummaryDataStore dataStore = new SummaryDataStore(const <String>[]);
-    return new BazelResultProvider._(dataStore, summaryProvider);
-  }
-
-  BazelResultProvider._(
-      SummaryDataStore dataStore, SummaryProvider summaryProvider)
-      : dataStore = dataStore,
-        summaryProvider = summaryProvider,
-        super(summaryProvider.context, dataStore) {
-    AnalysisContext sdkContext = context.sourceFactory.dartSdk.context;
-    createResynthesizer(sdkContext, sdkContext.typeProvider);
-  }
-
-  @override
-  bool hasResultsForSource(Source source) {
-    return sourceToSuccessMap.putIfAbsent(source, () {
-      List<Package> packages = summaryProvider.getLinkedPackages(source);
-      if (packages == null) {
-        return false;
-      }
-      for (Package package in packages) {
-        if (addedPackages.add(package)) {
-          dataStore.addBundle(null, package.unlinked);
-          dataStore.addBundle(null, package.linked);
-        }
-      }
-      String uriString = source.uri.toString();
-      return resynthesizer.hasLibrarySummary(uriString);
-    });
-  }
-}
-
-/**
- * Information about a Dart package in Bazel.
- */
-class Package {
-  final File unlinkedFile;
-  final PackageBundle unlinked;
-  final Set<String> _unitUris = new Set<String>();
-
-  PackageBundle _linked;
-
-  Package(this.unlinkedFile, this.unlinked) {
-    _unitUris.addAll(unlinked.unlinkedUnitUris);
-  }
-
-  PackageBundle get linked => _linked;
-
-  @override
-  String toString() => '$unlinkedFile';
-}
-
-/**
- * Class that reads summaries of Bazel packages.
- *
- * When the client needs to produce a resolution result for a new [Source], it
- * should call [getLinkedPackages] to check whether there is the set of
- * packages to resynthesize resolution results.
- */
-class SummaryProvider {
-  final ResourceProvider provider;
-  final String tempFileName;
-  final GetOutputFolder getOutputFolder;
-  final Folder linkedCacheFolder;
-  final AnalysisContext context;
-  final PackageBundle sdkBundle;
-
-  /**
-   * If `true` (by default), then linking new bundles is allowed.
-   * Otherwise only using existing cached bundles can be used.
-   */
-  final bool allowLinking;
-
-  /**
-   * See [PackageBundleAssembler.currentMajorVersion].
-   */
-  final int majorVersion;
-
-  /**
-   * Mapping from bundle paths to corresponding [Package]s.  The packages in
-   * the map were consistent with their constituent sources at the moment when
-   * they were put into the map.
-   */
-  final Map<Folder, List<Package>> folderToPackagesMap = {};
-
-  /**
-   * Mapping from [Uri]s to corresponding [Package]s.
-   */
-  final Map<Uri, Package> uriToPackageMap = {};
-
-  /**
-   * Mapping from [Package]s to corresponding [_LinkNode]s.
-   */
-  final Map<Package, _LinkNode> packageToNodeMap = {};
-
-  SummaryProvider(
-      this.provider,
-      this.tempFileName,
-      this.getOutputFolder,
-      this.linkedCacheFolder,
-      AnalysisContext context,
-      {@visibleForTesting
-          this.allowLinking: true,
-      @visibleForTesting
-          this.majorVersion: PackageBundleAssembler.currentMajorVersion})
-      : context = context,
-        sdkBundle = context.sourceFactory.dartSdk?.getLinkedBundle();
-
-  /**
-   * Return the complete list of [Package]s that are required to provide all
-   * resolution results for the given [source].
-   *
-   * The same list of packages is returned for the same [Source], i.e. always
-   * the full list, not a difference with a previous request.  It is up to the
-   * client to decide whether some of the returned packages should be excluded
-   * as already mixed into a resynthesizer.
-   *
-   * If the full set of packages cannot be produced, for example because some
-   * bundles are not built, or out of date, etc, then `null` is returned.
-   */
-  List<Package> getLinkedPackages(Source source) {
-    // Find the node that contains the source.
-    _LinkNode node = _getLinkNodeForUri(source.uri);
-    if (node == null) {
-      return null;
-    }
-
-    // Compute all transitive dependencies.
-    node.computeTransitiveDependencies();
-    List<_LinkNode> nodes = node.transitiveDependencies.toList();
-    nodes.forEach((dependency) => dependency.computeTransitiveDependencies());
-
-    // Fail if any dependency cannot be resolved.
-    if (node.failed) {
-      return null;
-    }
-
-    // Read existing cached linked bundles.
-    for (_LinkNode node in nodes) {
-      _readLinked(node);
-    }
-
-    // Link new packages, if allowed.
-    if (allowLinking) {
-      _link(nodes);
-    }
-
-    // Create successfully linked packages.
-    return nodes
-        .map((node) => node.package)
-        .where((package) => package.linked != null)
-        .toList();
-  }
-
-  /**
-   * Return the [Package] that contains information about the source with
-   * the given [uri], or `null` if such package does not exist.
-   */
-  @visibleForTesting
-  Package getUnlinkedForUri(Uri uri) {
-    return uriToPackageMap.putIfAbsent(uri, () {
-      Folder outputFolder = getOutputFolder(uri);
-      if (outputFolder != null) {
-        String uriStr = uri.toString();
-        List<Package> packages = _getUnlinkedPackages(outputFolder);
-        for (Package package in packages) {
-          if (package._unitUris.contains(uriStr)) {
-            return package;
-          }
-        }
-      }
-      return null;
-    });
-  }
-
-  /**
-   * Return the hexadecimal string of the MD5 hash of the contents of the
-   * given [source] in [context].
-   */
-  String _computeSourceHashHex(Source source) {
-    String text = context.getContents(source).data;
-    List<int> bytes = UTF8.encode(text);
-    List<int> hashBytes = md5.convert(bytes).bytes;
-    return hex.encode(hashBytes);
-  }
-
-  /**
-   * Return the name of the file for a linked bundle, in strong or spec mode.
-   */
-  String _getLinkedName(String hash) {
-    if (context.analysisOptions.strongMode) {
-      return 'linked_$hash.ds';
-    } else {
-      return 'linked_spec_$hash.ds';
-    }
-  }
-
-  /**
-   * Return the node for the given [uri], or `null` if there is no unlinked
-   * bundle that contains [uri].
-   */
-  _LinkNode _getLinkNodeForUri(Uri uri) {
-    Package package = getUnlinkedForUri(uri);
-    return packageToNodeMap.putIfAbsent(package, () {
-      if (package == null) {
-        return null;
-      }
-      return new _LinkNode(this, package);
-    });
-  }
-
-  /**
-   * Return all consistent unlinked [Package]s in the given [folder].  Some of
-   * the returned packages might be already linked.
-   */
-  List<Package> _getUnlinkedPackages(Folder folder) {
-    List<Package> packages = folderToPackagesMap[folder];
-    if (packages == null) {
-      packages = <Package>[];
-      try {
-        List<Resource> children = folder.getChildren();
-        for (Resource child in children) {
-          if (child is File) {
-            String packagePath = child.path;
-            if (packagePath.toLowerCase().endsWith('.full.ds')) {
-              Package package = _readUnlinkedPackage(child);
-              if (package != null) {
-                packages.add(package);
-              }
-            }
-          }
-        }
-      } on FileSystemException {}
-      folderToPackagesMap[folder] = packages;
-    }
-    return packages;
-  }
-
-  /**
-   * Return `true` if the unlinked information of the [bundle] is consistent
-   * with its constituent sources in [context].
-   */
-  bool _isUnlinkedBundleConsistent(PackageBundle bundle) {
-    try {
-      // Compute hashes of the constituent sources.
-      List<String> actualHashes = <String>[];
-      for (String uri in bundle.unlinkedUnitUris) {
-        Source source = context.sourceFactory.resolveUri(null, uri);
-        if (source == null) {
-          return false;
-        }
-        String hash = _computeSourceHashHex(source);
-        actualHashes.add(hash);
-      }
-      // Compare sorted actual and bundle unit hashes.
-      List<String> bundleHashes = bundle.unlinkedUnitHashes.toList()..sort();
-      actualHashes.sort();
-      return listsEqual(actualHashes, bundleHashes);
-    } on FileSystemException {}
-    return false;
-  }
-
-  /**
-   * Link the given [nodes].
-   */
-  void _link(List<_LinkNode> nodes) {
-    // Fill the store with bundles.
-    // Append the linked SDK bundle.
-    // Append unlinked and (if read from a cache) linked package bundles.
-    SummaryDataStore store = new SummaryDataStore(const <String>[]);
-    store.addBundle(null, sdkBundle);
-    for (_LinkNode node in nodes) {
-      store.addBundle(null, node.package.unlinked);
-      if (node.package.linked != null) {
-        store.addBundle(null, node.package.linked);
-      }
-    }
-
-    // Prepare URIs to link.
-    Map<String, _LinkNode> uriToNode = <String, _LinkNode>{};
-    for (_LinkNode node in nodes) {
-      if (!node.isReady) {
-        for (String uri in node.package.unlinked.unlinkedUnitUris) {
-          uriToNode[uri] = node;
-        }
-      }
-    }
-    Set<String> libraryUris = uriToNode.keys.toSet();
-
-    // Perform linking.
-    Map<String, LinkedLibraryBuilder> linkedLibraries =
-        link(libraryUris, (String uri) {
-      return store.linkedMap[uri];
-    }, (String uri) {
-      return store.unlinkedMap[uri];
-    }, context.declaredVariables.get, context.analysisOptions.strongMode);
-
-    // Assemble newly linked bundles.
-    for (_LinkNode node in nodes) {
-      if (!node.isReady) {
-        PackageBundleAssembler assembler = new PackageBundleAssembler();
-        linkedLibraries.forEach((uri, linkedLibrary) {
-          if (identical(uriToNode[uri], node)) {
-            assembler.addLinkedLibrary(uri, linkedLibrary);
-          }
-        });
-        List<int> bytes = assembler.assemble().toBuffer();
-        node.package._linked = new PackageBundle.fromBuffer(bytes);
-        _writeLinked(node, bytes);
-      }
-    }
-  }
-
-  /**
-   * Attempt to read the linked bundle that corresponds to the given [node]
-   * with all its transitive dependencies.
-   */
-  void _readLinked(_LinkNode node) {
-    String hash = node.linkedHash;
-    if (!node.isReady && hash != null) {
-      String fileName = _getLinkedName(hash);
-      File file = linkedCacheFolder.getChildAssumingFile(fileName);
-      // Try to read from the file system.
-      if (file.exists) {
-        try {
-          List<int> bytes = file.readAsBytesSync();
-          node.package._linked = new PackageBundle.fromBuffer(bytes);
-        } on FileSystemException {
-          // Ignore file system exceptions.
-        }
-      }
-    }
-  }
-
-  /**
-   * Read the unlinked [Package] from the given [file], or return `null` if the
-   * file does not exist, or it cannot be read, or is not consistent with the
-   * constituent sources on the file system.
-   */
-  Package _readUnlinkedPackage(File file) {
-    try {
-      List<int> bytes = file.readAsBytesSync();
-      PackageBundle bundle = new PackageBundle.fromBuffer(bytes);
-      // Check the major version.
-      if (bundle.majorVersion != majorVersion) {
-        return null;
-      }
-      // Check for consistency, and fail if it's not.
-      if (!_isUnlinkedBundleConsistent(bundle)) {
-        return null;
-      }
-      // OK, use the bundle.
-      return new Package(file, bundle);
-    } on FileSystemException {}
-    return null;
-  }
-
-  /**
-   * Atomically write the given [bytes] into the file in the [folder].
-   */
-  void _writeAtomic(Folder folder, String fileName, List<int> bytes) {
-    String filePath = folder.getChildAssumingFile(fileName).path;
-    File tempFile = folder.getChildAssumingFile(tempFileName);
-    tempFile.writeAsBytesSync(bytes);
-    tempFile.renameSync(filePath);
-  }
-
-  /**
-   * If a new linked bundle was linked for the given [node], write the bundle
-   * into the memory cache and the file system.
-   */
-  void _writeLinked(_LinkNode node, List<int> bytes) {
-    String hash = node.linkedHash;
-    if (hash != null) {
-      String fileName = _getLinkedName(hash);
-      _writeAtomic(linkedCacheFolder, fileName, bytes);
-    }
-  }
-}
-
-/**
- * Information about a single [Package].
- */
-class _LinkNode {
-  final SummaryProvider linker;
-  final Package package;
-
-  bool failed = false;
-  Set<_LinkNode> transitiveDependencies;
-
-  List<_LinkNode> _dependencies;
-  String _linkedHash;
-
-  _LinkNode(this.linker, this.package);
-
-  /**
-   * Retrieve the dependencies of this node.
-   */
-  List<_LinkNode> get dependencies {
-    if (_dependencies == null) {
-      Set<_LinkNode> dependencies = new Set<_LinkNode>();
-
-      void appendDependency(String uriStr) {
-        Uri uri = FastUri.parse(uriStr);
-        if (!uri.hasScheme) {
-          // A relative path in this package, skip it.
-        } else if (uri.scheme == 'dart') {
-          // Dependency on the SDK is implicit and always added.
-          // The SDK linked bundle is precomputed before linking packages.
-        } else if (uri.scheme == 'package') {
-          _LinkNode packageNode = linker._getLinkNodeForUri(uri);
-          if (packageNode == null) {
-            failed = true;
-          }
-          if (packageNode != null) {
-            dependencies.add(packageNode);
-          }
-        } else {
-          failed = true;
-        }
-      }
-
-      for (UnlinkedUnit unit in package.unlinked.unlinkedUnits) {
-        for (UnlinkedImport import in unit.imports) {
-          if (!import.isImplicit) {
-            appendDependency(import.uri);
-          }
-        }
-        for (UnlinkedExportPublic export in unit.publicNamespace.exports) {
-          appendDependency(export.uri);
-        }
-      }
-
-      _dependencies = dependencies.toList();
-    }
-    return _dependencies;
-  }
-
-  /**
-   * Return `true` is the node is ready - has the linked bundle or failed (does
-   * not have all required dependencies).
-   */
-  bool get isReady => package.linked != null || failed;
-
-  /**
-   * Return the hash string that corresponds to this linked bundle in the
-   * context of its SDK bundle and transitive dependencies.  Return `null` if
-   * the hash computation fails, because for example the full transitive
-   * dependencies cannot computed.
-   */
-  String get linkedHash {
-    if (_linkedHash == null && transitiveDependencies != null && !failed) {
-      ApiSignature signature = new ApiSignature();
-      // Add all unlinked API signatures.
-      List<String> signatures = <String>[];
-      signatures.add(linker.sdkBundle.apiSignature);
-      transitiveDependencies
-          .map((node) => node.package.unlinked.apiSignature)
-          .forEach(signatures.add);
-      signatures.sort();
-      signatures.forEach(signature.addString);
-      // Combine into a single hash.
-      appendDeclaredVariables(signature);
-      _linkedHash = signature.toHex();
-    }
-    return _linkedHash;
-  }
-
-  /**
-   * Append names and values of all referenced declared variables (even the
-   * ones without actually declared values) to the given [signature].
-   */
-  void appendDeclaredVariables(ApiSignature signature) {
-    Set<String> nameSet = new Set<String>();
-    for (_LinkNode node in transitiveDependencies) {
-      for (UnlinkedUnit unit in node.package.unlinked.unlinkedUnits) {
-        for (UnlinkedImport import in unit.imports) {
-          for (UnlinkedConfiguration configuration in import.configurations) {
-            nameSet.add(configuration.name);
-          }
-        }
-        for (UnlinkedExportPublic export in unit.publicNamespace.exports) {
-          for (UnlinkedConfiguration configuration in export.configurations) {
-            nameSet.add(configuration.name);
-          }
-        }
-      }
-    }
-    List<String> sortedNameList = nameSet.toList()..sort();
-    signature.addInt(sortedNameList.length);
-    for (String name in sortedNameList) {
-      signature.addString(name);
-      signature.addString(linker.context.declaredVariables.get(name) ?? '');
-    }
-  }
-
-  /**
-   * Compute the set of existing transitive dependencies for this node.
-   * If any dependency cannot be resolved, then set [failed] to `true`.
-   * Only unlinked bundle is used, so this method can be called before linking.
-   */
-  void computeTransitiveDependencies() {
-    if (transitiveDependencies == null) {
-      transitiveDependencies = new Set<_LinkNode>();
-
-      void appendDependencies(_LinkNode node) {
-        if (transitiveDependencies.add(node)) {
-          node.dependencies.forEach(appendDependencies);
-        }
-      }
-
-      appendDependencies(this);
-      if (transitiveDependencies.any((node) => node.failed)) {
-        failed = true;
-      }
-    }
-  }
-
-  @override
-  String toString() => package.toString();
-}
diff --git a/pkg/analyzer/lib/src/summary/format.dart b/pkg/analyzer/lib/src/summary/format.dart
index c38e50b..95f7186 100644
--- a/pkg/analyzer/lib/src/summary/format.dart
+++ b/pkg/analyzer/lib/src/summary/format.dart
@@ -7925,6 +7925,8 @@
   int _inferredTypeSlot;
   int _inheritsCovariantSlot;
   UnlinkedExecutableBuilder _initializer;
+  bool _isExplicitlyCovariant;
+  bool _isFinal;
   bool _isFunctionTyped;
   bool _isInitializingFormal;
   idl.UnlinkedParamKind _kind;
@@ -8013,6 +8015,26 @@
   }
 
   @override
+  bool get isExplicitlyCovariant => _isExplicitlyCovariant ??= false;
+
+  /**
+   * Indicates whether this parameter is explicitly marked as being covariant.
+   */
+  void set isExplicitlyCovariant(bool value) {
+    this._isExplicitlyCovariant = value;
+  }
+
+  @override
+  bool get isFinal => _isFinal ??= false;
+
+  /**
+   * Indicates whether the parameter is declared using the `final` keyword.
+   */
+  void set isFinal(bool value) {
+    this._isFinal = value;
+  }
+
+  @override
   bool get isFunctionTyped => _isFunctionTyped ??= false;
 
   /**
@@ -8108,13 +8130,15 @@
     this._visibleOffset = value;
   }
 
-  UnlinkedParamBuilder({List<UnlinkedExprBuilder> annotations, CodeRangeBuilder codeRange, String defaultValueCode, int inferredTypeSlot, int inheritsCovariantSlot, UnlinkedExecutableBuilder initializer, bool isFunctionTyped, bool isInitializingFormal, idl.UnlinkedParamKind kind, String name, int nameOffset, List<UnlinkedParamBuilder> parameters, EntityRefBuilder type, int visibleLength, int visibleOffset})
+  UnlinkedParamBuilder({List<UnlinkedExprBuilder> annotations, CodeRangeBuilder codeRange, String defaultValueCode, int inferredTypeSlot, int inheritsCovariantSlot, UnlinkedExecutableBuilder initializer, bool isExplicitlyCovariant, bool isFinal, bool isFunctionTyped, bool isInitializingFormal, idl.UnlinkedParamKind kind, String name, int nameOffset, List<UnlinkedParamBuilder> parameters, EntityRefBuilder type, int visibleLength, int visibleOffset})
     : _annotations = annotations,
       _codeRange = codeRange,
       _defaultValueCode = defaultValueCode,
       _inferredTypeSlot = inferredTypeSlot,
       _inheritsCovariantSlot = inheritsCovariantSlot,
       _initializer = initializer,
+      _isExplicitlyCovariant = isExplicitlyCovariant,
+      _isFinal = isFinal,
       _isFunctionTyped = isFunctionTyped,
       _isInitializingFormal = isInitializingFormal,
       _kind = kind,
@@ -8170,6 +8194,8 @@
     signature.addBool(this._initializer != null);
     this._initializer?.collectApiSignature(signature);
     signature.addInt(this._inheritsCovariantSlot ?? 0);
+    signature.addBool(this._isExplicitlyCovariant == true);
+    signature.addBool(this._isFinal == true);
   }
 
   fb.Offset finish(fb.Builder fbBuilder) {
@@ -8220,6 +8246,12 @@
     if (offset_initializer != null) {
       fbBuilder.addOffset(12, offset_initializer);
     }
+    if (_isExplicitlyCovariant == true) {
+      fbBuilder.addBool(15, true);
+    }
+    if (_isFinal == true) {
+      fbBuilder.addBool(16, true);
+    }
     if (_isFunctionTyped == true) {
       fbBuilder.addBool(5, true);
     }
@@ -8270,6 +8302,8 @@
   int _inferredTypeSlot;
   int _inheritsCovariantSlot;
   idl.UnlinkedExecutable _initializer;
+  bool _isExplicitlyCovariant;
+  bool _isFinal;
   bool _isFunctionTyped;
   bool _isInitializingFormal;
   idl.UnlinkedParamKind _kind;
@@ -8317,6 +8351,18 @@
   }
 
   @override
+  bool get isExplicitlyCovariant {
+    _isExplicitlyCovariant ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 15, false);
+    return _isExplicitlyCovariant;
+  }
+
+  @override
+  bool get isFinal {
+    _isFinal ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 16, false);
+    return _isFinal;
+  }
+
+  @override
   bool get isFunctionTyped {
     _isFunctionTyped ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 5, false);
     return _isFunctionTyped;
@@ -8381,6 +8427,8 @@
     if (inferredTypeSlot != 0) _result["inferredTypeSlot"] = inferredTypeSlot;
     if (inheritsCovariantSlot != 0) _result["inheritsCovariantSlot"] = inheritsCovariantSlot;
     if (initializer != null) _result["initializer"] = initializer.toJson();
+    if (isExplicitlyCovariant != false) _result["isExplicitlyCovariant"] = isExplicitlyCovariant;
+    if (isFinal != false) _result["isFinal"] = isFinal;
     if (isFunctionTyped != false) _result["isFunctionTyped"] = isFunctionTyped;
     if (isInitializingFormal != false) _result["isInitializingFormal"] = isInitializingFormal;
     if (kind != idl.UnlinkedParamKind.required) _result["kind"] = kind.toString().split('.')[1];
@@ -8401,6 +8449,8 @@
     "inferredTypeSlot": inferredTypeSlot,
     "inheritsCovariantSlot": inheritsCovariantSlot,
     "initializer": initializer,
+    "isExplicitlyCovariant": isExplicitlyCovariant,
+    "isFinal": isFinal,
     "isFunctionTyped": isFunctionTyped,
     "isInitializingFormal": isInitializingFormal,
     "kind": kind,
@@ -10254,6 +10304,7 @@
   int _inferredTypeSlot;
   UnlinkedExecutableBuilder _initializer;
   bool _isConst;
+  bool _isCovariant;
   bool _isFinal;
   bool _isStatic;
   String _name;
@@ -10330,6 +10381,17 @@
   }
 
   @override
+  bool get isCovariant => _isCovariant ??= false;
+
+  /**
+   * Indicates whether this variable is declared using the `covariant` keyword.
+   * This should be false for everything except instance fields.
+   */
+  void set isCovariant(bool value) {
+    this._isCovariant = value;
+  }
+
+  @override
   bool get isFinal => _isFinal ??= false;
 
   /**
@@ -10422,13 +10484,14 @@
     this._visibleOffset = value;
   }
 
-  UnlinkedVariableBuilder({List<UnlinkedExprBuilder> annotations, CodeRangeBuilder codeRange, UnlinkedDocumentationCommentBuilder documentationComment, int inferredTypeSlot, UnlinkedExecutableBuilder initializer, bool isConst, bool isFinal, bool isStatic, String name, int nameOffset, int propagatedTypeSlot, EntityRefBuilder type, int visibleLength, int visibleOffset})
+  UnlinkedVariableBuilder({List<UnlinkedExprBuilder> annotations, CodeRangeBuilder codeRange, UnlinkedDocumentationCommentBuilder documentationComment, int inferredTypeSlot, UnlinkedExecutableBuilder initializer, bool isConst, bool isCovariant, bool isFinal, bool isStatic, String name, int nameOffset, int propagatedTypeSlot, EntityRefBuilder type, int visibleLength, int visibleOffset})
     : _annotations = annotations,
       _codeRange = codeRange,
       _documentationComment = documentationComment,
       _inferredTypeSlot = inferredTypeSlot,
       _initializer = initializer,
       _isConst = isConst,
+      _isCovariant = isCovariant,
       _isFinal = isFinal,
       _isStatic = isStatic,
       _name = name,
@@ -10474,6 +10537,7 @@
     signature.addInt(this._inferredTypeSlot ?? 0);
     signature.addBool(this._initializer != null);
     this._initializer?.collectApiSignature(signature);
+    signature.addBool(this._isCovariant == true);
   }
 
   fb.Offset finish(fb.Builder fbBuilder) {
@@ -10520,6 +10584,9 @@
     if (_isConst == true) {
       fbBuilder.addBool(6, true);
     }
+    if (_isCovariant == true) {
+      fbBuilder.addBool(14, true);
+    }
     if (_isFinal == true) {
       fbBuilder.addBool(7, true);
     }
@@ -10567,6 +10634,7 @@
   int _inferredTypeSlot;
   idl.UnlinkedExecutable _initializer;
   bool _isConst;
+  bool _isCovariant;
   bool _isFinal;
   bool _isStatic;
   String _name;
@@ -10613,6 +10681,12 @@
   }
 
   @override
+  bool get isCovariant {
+    _isCovariant ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 14, false);
+    return _isCovariant;
+  }
+
+  @override
   bool get isFinal {
     _isFinal ??= const fb.BoolReader().vTableGet(_bc, _bcOffset, 7, false);
     return _isFinal;
@@ -10671,6 +10745,7 @@
     if (inferredTypeSlot != 0) _result["inferredTypeSlot"] = inferredTypeSlot;
     if (initializer != null) _result["initializer"] = initializer.toJson();
     if (isConst != false) _result["isConst"] = isConst;
+    if (isCovariant != false) _result["isCovariant"] = isCovariant;
     if (isFinal != false) _result["isFinal"] = isFinal;
     if (isStatic != false) _result["isStatic"] = isStatic;
     if (name != '') _result["name"] = name;
@@ -10690,6 +10765,7 @@
     "inferredTypeSlot": inferredTypeSlot,
     "initializer": initializer,
     "isConst": isConst,
+    "isCovariant": isCovariant,
     "isFinal": isFinal,
     "isStatic": isStatic,
     "name": name,
diff --git a/pkg/analyzer/lib/src/summary/format.fbs b/pkg/analyzer/lib/src/summary/format.fbs
index de75fea..6a75528 100644
--- a/pkg/analyzer/lib/src/summary/format.fbs
+++ b/pkg/analyzer/lib/src/summary/format.fbs
@@ -226,7 +226,12 @@
   /**
    * Invocation of a superclass' constructor.
    */
-  superInvocation
+  superInvocation,
+
+  /**
+   * Invocation of `assert`.
+   */
+  assertInvocation
 }
 
 /**
@@ -771,7 +776,43 @@
    * Pop the top value from the stack.  Treat it as a Future and await its
    * completion.  Then push the awaited value onto the stack.
    */
-  await
+  await,
+
+  /**
+   * Push an abstract value onto the stack. Abstract values mark the presence of
+   * a value, but whose details are not included.
+   *
+   * This is not used by the summary generators today, but it will be used to
+   * experiment with prunning the initializer expression tree, so only
+   * information that is necessary gets included in the output summary file.
+   */
+  pushUntypedAbstract,
+
+  /**
+   * Get the next type reference from [UnlinkedExpr.references] and push an
+   * abstract value onto the stack that has that type.
+   *
+   * Like [pushUntypedAbstract], this is also not used by the summary generators
+   * today. The plan is to experiment with prunning the initializer expression
+   * tree, and include just enough type information to perform strong-mode type
+   * inference, but not all the details of how this type was obtained.
+   */
+  pushTypedAbstract,
+
+  /**
+   * Push an error onto the stack.
+   *
+   * Like [pushUntypedAbstract], this is not used by summary generators today.
+   * This will be used to experiment with prunning the const expression tree. If
+   * a constant has an error, we can omit the subexpression containing the error
+   * and only include a marker that an error was detected.
+   */
+  pushError,
+
+  /**
+   * Push `this` expression onto the stack.
+   */
+  pushThis
 }
 
 /**
@@ -2231,6 +2272,16 @@
   initializer:UnlinkedExecutable (id: 12);
 
   /**
+   * Indicates whether this parameter is explicitly marked as being covariant.
+   */
+  isExplicitlyCovariant:bool (id: 15);
+
+  /**
+   * Indicates whether the parameter is declared using the `final` keyword.
+   */
+  isFinal:bool (id: 16);
+
+  /**
    * Indicates whether this is a function-typed parameter.
    */
   isFunctionTyped:bool (id: 5);
@@ -2623,6 +2674,12 @@
   isConst:bool (id: 6);
 
   /**
+   * Indicates whether this variable is declared using the `covariant` keyword.
+   * This should be false for everything except instance fields.
+   */
+  isCovariant:bool (id: 14);
+
+  /**
    * Indicates whether the variable is declared using the `final` keyword.
    */
   isFinal:bool (id: 7);
diff --git a/pkg/analyzer/lib/src/summary/idl.dart b/pkg/analyzer/lib/src/summary/idl.dart
index 9c07aff..0d8ce5e 100644
--- a/pkg/analyzer/lib/src/summary/idl.dart
+++ b/pkg/analyzer/lib/src/summary/idl.dart
@@ -1347,7 +1347,12 @@
   /**
    * Invocation of a superclass' constructor.
    */
-  superInvocation
+  superInvocation,
+
+  /**
+   * Invocation of `assert`.
+   */
+  assertInvocation
 }
 
 /**
@@ -2347,6 +2352,42 @@
    * completion.  Then push the awaited value onto the stack.
    */
   await,
+
+  /**
+   * Push an abstract value onto the stack. Abstract values mark the presence of
+   * a value, but whose details are not included.
+   *
+   * This is not used by the summary generators today, but it will be used to
+   * experiment with prunning the initializer expression tree, so only
+   * information that is necessary gets included in the output summary file.
+   */
+  pushUntypedAbstract,
+
+  /**
+   * Get the next type reference from [UnlinkedExpr.references] and push an
+   * abstract value onto the stack that has that type.
+   *
+   * Like [pushUntypedAbstract], this is also not used by the summary generators
+   * today. The plan is to experiment with prunning the initializer expression
+   * tree, and include just enough type information to perform strong-mode type
+   * inference, but not all the details of how this type was obtained.
+   */
+  pushTypedAbstract,
+
+  /**
+   * Push an error onto the stack.
+   *
+   * Like [pushUntypedAbstract], this is not used by summary generators today.
+   * This will be used to experiment with prunning the const expression tree. If
+   * a constant has an error, we can omit the subexpression containing the error
+   * and only include a marker that an error was detected.
+   */
+  pushError,
+
+  /**
+   * Push `this` expression onto the stack.
+   */
+  pushThis,
 }
 
 /**
@@ -2521,6 +2562,18 @@
   UnlinkedExecutable get initializer;
 
   /**
+   * Indicates whether this parameter is explicitly marked as being covariant.
+   */
+  @Id(15)
+  bool get isExplicitlyCovariant;
+
+  /**
+   * Indicates whether the parameter is declared using the `final` keyword.
+   */
+  @Id(16)
+  bool get isFinal;
+
+  /**
    * Indicates whether this is a function-typed parameter.
    */
   @Id(5)
@@ -3019,6 +3072,13 @@
   bool get isConst;
 
   /**
+   * Indicates whether this variable is declared using the `covariant` keyword.
+   * This should be false for everything except instance fields.
+   */
+  @Id(14)
+  bool get isCovariant;
+
+  /**
    * Indicates whether the variable is declared using the `final` keyword.
    */
   @Id(7)
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index ec0806e..22725aa 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -72,6 +72,7 @@
 import 'package:analyzer/src/summary/idl.dart';
 import 'package:analyzer/src/summary/prelink.dart';
 import 'package:analyzer/src/task/strong_mode.dart';
+import 'package:front_end/src/dependency_walker.dart';
 
 bool isIncrementOrDecrement(UnlinkedExprAssignOperator operator) {
   switch (operator) {
@@ -246,7 +247,7 @@
 }
 
 DartType _dynamicIfNull(DartType type) {
-  if (type == null || type.isBottom || type.isVoid) {
+  if (type == null || type.isBottom || type.isDartCoreNull) {
     return DynamicTypeImpl.instance;
   }
   return type;
@@ -1752,132 +1753,6 @@
 }
 
 /**
- * An instance of [DependencyWalker] contains the core algorithms for
- * walking a dependency graph and evaluating nodes in a safe order.
- */
-abstract class DependencyWalker<NodeType extends Node<NodeType>> {
-  /**
-   * Called by [walk] to evaluate a single non-cyclical node, after
-   * all that node's dependencies have been evaluated.
-   */
-  void evaluate(NodeType v);
-
-  /**
-   * Called by [walk] to evaluate a strongly connected component
-   * containing one or more nodes.  All dependencies of the strongly
-   * connected component have been evaluated.
-   */
-  void evaluateScc(List<NodeType> scc);
-
-  /**
-   * Walk the dependency graph starting at [startingPoint], finding
-   * strongly connected components and evaluating them in a safe order
-   * by calling [evaluate] and [evaluateScc].
-   *
-   * This is an implementation of Tarjan's strongly connected
-   * components algorithm
-   * (https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm).
-   */
-  void walk(NodeType startingPoint) {
-    // TODO(paulberry): consider rewriting in a non-recursive way so
-    // that long dependency chains don't cause stack overflow.
-
-    // TODO(paulberry): in the event that an exception occurs during
-    // the walk, restore the state of the [Node] data structures so
-    // that further evaluation will be safe.
-
-    // The index which will be assigned to the next node that is
-    // freshly visited.
-    int index = 1;
-
-    // Stack of nodes which have been seen so far and whose strongly
-    // connected component is still being determined.  Nodes are only
-    // popped off the stack when they are evaluated, so sometimes the
-    // stack contains nodes that were visited after the current node.
-    List<NodeType> stack = <NodeType>[];
-
-    void strongConnect(NodeType node) {
-      bool hasTrivialCycle = false;
-
-      // Assign the current node an index and add it to the stack.  We
-      // haven't seen any of its dependencies yet, so set its lowLink
-      // to its index, indicating that so far it is the only node in
-      // its strongly connected component.
-      node.index = node.lowLink = index++;
-      stack.add(node);
-
-      // Consider the node's dependencies one at a time.
-      for (NodeType dependency in node.dependencies) {
-        // If the dependency has already been evaluated, it can't be
-        // part of this node's strongly connected component, so we can
-        // skip it.
-        if (dependency.isEvaluated) {
-          continue;
-        }
-        if (identical(node, dependency)) {
-          // If a node includes itself as a dependency, there is no need to
-          // explore the dependency further.
-          hasTrivialCycle = true;
-        } else if (dependency.index == 0) {
-          // The dependency hasn't been seen yet, so recurse on it.
-          strongConnect(dependency);
-          // If the dependency's lowLink refers to a node that was
-          // visited before the current node, that means that the
-          // current node, the dependency, and the node referred to by
-          // the dependency's lowLink are all part of the same
-          // strongly connected component, so we need to update the
-          // current node's lowLink accordingly.
-          if (dependency.lowLink < node.lowLink) {
-            node.lowLink = dependency.lowLink;
-          }
-        } else {
-          // The dependency has already been seen, so it is part of
-          // the current node's strongly connected component.  If it
-          // was visited earlier than the current node's lowLink, then
-          // it is a new addition to the current node's strongly
-          // connected component, so we need to update the current
-          // node's lowLink accordingly.
-          if (dependency.index < node.lowLink) {
-            node.lowLink = dependency.index;
-          }
-        }
-      }
-
-      // If the current node's lowLink is the same as its index, then
-      // we have finished visiting a strongly connected component, so
-      // pop the stack and evaluate it before moving on.
-      if (node.lowLink == node.index) {
-        // The strongly connected component has only one node.  If there is a
-        // cycle, it's a trivial one.
-        if (identical(stack.last, node)) {
-          stack.removeLast();
-          if (hasTrivialCycle) {
-            evaluateScc(<NodeType>[node]);
-          } else {
-            evaluate(node);
-          }
-        } else {
-          // There are multiple nodes in the strongly connected
-          // component.
-          List<NodeType> scc = <NodeType>[];
-          while (true) {
-            NodeType otherNode = stack.removeLast();
-            scc.add(otherNode);
-            if (identical(otherNode, node)) {
-              break;
-            }
-          }
-          evaluateScc(scc);
-        }
-      }
-    }
-
-    // Kick off the algorithm starting with the starting point.
-    strongConnect(startingPoint);
-  }
-}
-
-/**
  * Base class for executable elements resynthesized from a summary during
  * linking.
  */
@@ -2131,7 +2006,7 @@
           stack.add(typeProvider.symbolType);
           break;
         case UnlinkedExprOperation.pushNull:
-          stack.add(BottomTypeImpl.instance);
+          stack.add(typeProvider.nullType);
           break;
         case UnlinkedExprOperation.pushReference:
           _doPushReference();
@@ -2399,6 +2274,9 @@
 
   void _doExtractProperty() {
     DartType target = stack.removeLast();
+    if (target.isDynamic) {
+      target = typeProvider.objectType;
+    }
     String propertyName = _getNextString();
     stack.add(() {
       if (target is InterfaceType) {
@@ -2461,6 +2339,9 @@
     String methodName = _getNextString();
     List<DartType> typeArguments = _getTypeArguments();
     DartType target = stack.removeLast();
+    if (target.isDynamic) {
+      target = typeProvider.objectType;
+    }
     stack.add(() {
       if (target is InterfaceType) {
         MethodElement method =
@@ -2681,13 +2562,8 @@
           }
         });
         // Perform inference.
-        FunctionType inferred = ts.inferGenericFunctionCall(
-            typeProvider,
-            rawMethodType,
-            paramTypes,
-            argTypes,
-            rawMethodType.returnType,
-            null);
+        FunctionType inferred = ts.inferGenericFunctionCall(rawMethodType,
+            paramTypes, argTypes, rawMethodType.returnType, null);
         return inferred;
       }
     }
@@ -2696,7 +2572,7 @@
   }
 
   DartType _leastUpperBound(DartType s, DartType t) {
-    return linker.typeSystem.getLeastUpperBound(typeProvider, s, t);
+    return linker.typeSystem.getLeastUpperBound(s, t);
   }
 
   List<DartType> _popList(int n) {
@@ -2712,8 +2588,8 @@
           left.lookUpInheritedMethod(operator.lexeme, library: library);
       if (method != null) {
         DartType type = method.returnType;
-        type = linker.typeSystem.refineBinaryExpressionType(
-            typeProvider, left, operator, right, type);
+        type = linker.typeSystem
+            .refineBinaryExpressionType(left, operator, right, type);
         stack.add(type);
         return;
       }
@@ -2986,6 +2862,9 @@
   String get identifier => '';
 
   @override
+  bool get isAsynchronous => _unlinkedExecutable.isAsynchronous;
+
+  @override
   DartType get returnType {
     // If this is a variable whose type needs inferring, infer it.
     if (_variable.hasImplicitType) {
@@ -3121,6 +3000,9 @@
   }
 
   @override
+  bool get isAsynchronous => _unlinkedExecutable.isAsynchronous;
+
+  @override
   bool get _hasTypeBeenInferred => _inferredReturnType != null;
 
   @override
@@ -3779,8 +3661,9 @@
   /**
    * Get an instance of [TypeSystem] for use during linking.
    */
-  TypeSystem get typeSystem => _typeSystem ??=
-      strongMode ? new StrongTypeSystemImpl() : new TypeSystemImpl();
+  TypeSystem get typeSystem => _typeSystem ??= strongMode
+      ? new StrongTypeSystemImpl(typeProvider)
+      : new TypeSystemImpl(typeProvider);
 
   /**
    * Get the element representing `void`.
@@ -3856,45 +3739,6 @@
 }
 
 /**
- * Instances of [Node] represent nodes in a dependency graph.  The
- * type parameter, [NodeType], is the derived type (this affords some
- * extra type safety by making it difficult to accidentally construct
- * bridges between unrelated dependency graphs).
- */
-abstract class Node<NodeType> {
-  /**
-   * Index used by Tarjan's strongly connected components algorithm.
-   * Zero means the node has not been visited yet; a nonzero value
-   * counts the order in which the node was visited.
-   */
-  int index = 0;
-
-  /**
-   * Low link used by Tarjan's strongly connected components
-   * algorithm.  This represents the smallest [index] of all the nodes
-   * in the strongly connected component to which this node belongs.
-   */
-  int lowLink = 0;
-
-  List<NodeType> _dependencies;
-
-  /**
-   * Retrieve the dependencies of this node.
-   */
-  List<NodeType> get dependencies => _dependencies ??= computeDependencies();
-
-  /**
-   * Indicates whether this node has been evaluated yet.
-   */
-  bool get isEvaluated;
-
-  /**
-   * Compute the dependencies of this node.
-   */
-  List<NodeType> computeDependencies();
-}
-
-/**
  * Element used for references that result from trying to access a non-static
  * member of an element that is not a container (e.g. accessing the "length"
  * property of a constant).
@@ -3931,6 +3775,9 @@
   DartType get asStaticType {
     if (_library._linker.strongMode) {
       DartType targetType = _target.asStaticType;
+      if (targetType.isDynamic) {
+        targetType = _library._linker.typeProvider.objectType;
+      }
       if (targetType is InterfaceType) {
         ExecutableElement element =
             targetType.lookUpInheritedGetterOrMethod(_name, library: _library);
@@ -4027,7 +3874,7 @@
 
   @override
   bool get isCovariant {
-    if (inheritsCovariant) {
+    if (isExplicitlyCovariant || inheritsCovariant) {
       return true;
     }
     for (UnlinkedExpr annotation in _unlinkedParam.annotations) {
@@ -4046,6 +3893,9 @@
   }
 
   @override
+  bool get isExplicitlyCovariant => _unlinkedParam.isExplicitlyCovariant;
+
+  @override
   String get name => _unlinkedParam.name;
 
   @override
@@ -4123,7 +3973,10 @@
   ParameterElementForLink_VariableSetter(this.enclosingElement);
 
   @override
-  bool get isCovariant => false;
+  bool get isCovariant => isExplicitlyCovariant || inheritsCovariant;
+
+  @override
+  bool get isExplicitlyCovariant => enclosingElement.variable.isCovariant;
 
   @override
   bool get isSynthetic => true;
@@ -4171,7 +4024,7 @@
             unlinkedParam,
             typeParameterContext,
             typeParameterContext.enclosingUnit.resynthesizerContext
-            as CompilationUnitElementForLink,
+                as CompilationUnitElementForLink,
             i);
       }
     }
@@ -4802,8 +4655,18 @@
     if (inCycle) {
       functionElement._setInferredType(DynamicTypeImpl.instance);
     } else {
-      functionElement
-          ._setInferredType(new ExprTypeComputer(functionElement).compute());
+      var bodyType = new ExprTypeComputer(functionElement).compute();
+      if (functionElement.isAsynchronous) {
+        var linker = functionElement.compilationUnit.library._linker;
+        var typeProvider = linker.typeProvider;
+        var typeSystem = linker.typeSystem;
+        if (bodyType.isDartAsyncFutureOr) {
+          bodyType = (bodyType as InterfaceType).typeArguments[0];
+        }
+        bodyType = typeProvider.futureType
+            .instantiate([bodyType.flattenFutures(typeSystem)]);
+      }
+      functionElement._setInferredType(bodyType);
     }
   }
 
@@ -4820,6 +4683,8 @@
   InterfaceType _functionType;
   InterfaceType _futureDynamicType;
   InterfaceType _futureNullType;
+  InterfaceType _futureOrNullType;
+  InterfaceType _futureOrType;
   InterfaceType _futureType;
   InterfaceType _intType;
   InterfaceType _iterableDynamicType;
@@ -4869,6 +4734,14 @@
       _futureNullType ??= futureType.instantiate(<DartType>[nullType]);
 
   @override
+  InterfaceType get futureOrNullType =>
+      _futureOrNullType ??= futureOrType.instantiate(<DartType>[nullType]);
+
+  @override
+  InterfaceType get futureOrType =>
+      _futureOrType ??= _buildInterfaceType(_linker.asyncLibrary, 'FutureOr');
+
+  @override
   InterfaceType get futureType =>
       _futureType ??= _buildInterfaceType(_linker.asyncLibrary, 'Future');
 
@@ -5072,6 +4945,12 @@
   @override
   bool get isConst => unlinkedVariable.isConst;
 
+  /**
+   * Return `true` if this variable is a field that was explicitly marked as
+   * being covariant (in the setter's parameter).
+   */
+  bool get isCovariant => unlinkedVariable.isCovariant;
+
   @override
   bool get isFinal => unlinkedVariable.isFinal;
 
diff --git a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
index d178797..ff5ab7f 100644
--- a/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
+++ b/pkg/analyzer/lib/src/summary/package_bundle_reader.dart
@@ -6,7 +6,7 @@
 import 'package:analyzer/src/context/context.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/generated/utilities_dart.dart';
@@ -18,7 +18,7 @@
 import 'package:analyzer/task/dart.dart';
 import 'package:analyzer/task/general.dart';
 import 'package:analyzer/task/model.dart';
-import 'package:path/path.dart' as pathos;
+import 'package:front_end/src/base/source.dart';
 
 /**
  * The [ResultProvider] that provides results from input package summaries.
@@ -27,8 +27,8 @@
   InputPackagesResultProvider(
       InternalAnalysisContext context, SummaryDataStore dataStore)
       : super(context, dataStore) {
-    AnalysisContext sdkContext = context.sourceFactory.dartSdk.context;
-    createResynthesizer(sdkContext, sdkContext.typeProvider);
+    createResynthesizer();
+    context.typeProvider = resynthesizer.typeProvider;
   }
 
   @override
@@ -66,44 +66,24 @@
  * are served from its summary.  This source uses its URI as [fullName] and has
  * empty contents.
  */
-class InSummarySource extends Source {
-  final Uri uri;
-
+class InSummarySource extends BasicSource {
   /**
    * The summary file where this source was defined.
    */
   final String summaryPath;
 
-  InSummarySource(this.uri, this.summaryPath);
+  InSummarySource(Uri uri, this.summaryPath) : super(uri);
 
   @override
   TimestampedData<String> get contents => new TimestampedData<String>(0, '');
 
   @override
-  String get encoding => uri.toString();
-
-  @override
-  String get fullName => encoding;
-
-  @override
-  int get hashCode => uri.hashCode;
-
-  @override
-  bool get isInSystemLibrary => uri.scheme == DartUriResolver.DART_SCHEME;
-
-  @override
   int get modificationStamp => 0;
 
   @override
-  String get shortName => pathos.basename(fullName);
-
-  @override
   UriKind get uriKind => UriKind.PACKAGE_URI;
 
   @override
-  bool operator ==(Object object) => object is Source && object.uri == uri;
-
-  @override
   bool exists() => true;
 
   @override
@@ -141,7 +121,6 @@
   final SummaryDataStore _dataStore;
 
   _FileBasedSummaryResynthesizer _resynthesizer;
-  ResynthesizerResultProvider _sdkProvider;
 
   ResynthesizerResultProvider(this.context, this._dataStore);
 
@@ -156,10 +135,13 @@
 
   @override
   bool compute(CacheEntry entry, ResultDescriptor result) {
-    if (_sdkProvider != null && _sdkProvider.compute(entry, result)) {
+    AnalysisTarget target = entry.target;
+
+    if (result == TYPE_PROVIDER) {
+      entry.setValue(result as ResultDescriptor<TypeProvider>,
+          _resynthesizer.typeProvider, TargetedResult.EMPTY_LIST);
       return true;
     }
-    AnalysisTarget target = entry.target;
 
     // LINE_INFO can be provided using just the UnlinkedUnit.
     if (target is Source && result == LINE_INFO) {
@@ -218,14 +200,12 @@
             result as ResultDescriptor<int>, 0, TargetedResult.EMPTY_LIST);
         return true;
       } else if (result == SOURCE_KIND) {
-        if (_dataStore.linkedMap.containsKey(uriString)) {
-          entry.setValue(result as ResultDescriptor<SourceKind>,
-              SourceKind.LIBRARY, TargetedResult.EMPTY_LIST);
-          return true;
-        }
-        if (_dataStore.unlinkedMap.containsKey(uriString)) {
-          entry.setValue(result as ResultDescriptor<SourceKind>,
-              SourceKind.PART, TargetedResult.EMPTY_LIST);
+        UnlinkedUnit unlinked = _dataStore.unlinkedMap[uriString];
+        if (unlinked != null) {
+          entry.setValue(
+              result as ResultDescriptor<SourceKind>,
+              unlinked.isPartOf ? SourceKind.PART : SourceKind.LIBRARY,
+              TargetedResult.EMPTY_LIST);
           return true;
         }
         return false;
@@ -286,19 +266,9 @@
    *
    * Subclasses must call this method in their constructors.
    */
-  void createResynthesizer(
-      InternalAnalysisContext sdkContext, TypeProvider typeProvider) {
-    // Set the type provider to prevent the context from computing it.
-    context.typeProvider = typeProvider;
-    // Create a chained resynthesizer.
-    _sdkProvider = sdkContext?.resultProvider;
-    _resynthesizer = new _FileBasedSummaryResynthesizer(
-        _sdkProvider?.resynthesizer,
-        context,
-        typeProvider,
-        context.sourceFactory,
-        context.analysisOptions.strongMode,
-        _dataStore);
+  void createResynthesizer() {
+    _resynthesizer = new _FileBasedSummaryResynthesizer(context,
+        context.sourceFactory, context.analysisOptions.strongMode, _dataStore);
   }
 
   /**
@@ -389,15 +359,29 @@
     for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) {
       String uri = bundle.unlinkedUnitUris[i];
       uriToSummaryPath[uri] = path;
-      unlinkedMap[uri] = bundle.unlinkedUnits[i];
+      addUnlinkedUnit(uri, bundle.unlinkedUnits[i]);
     }
     for (int i = 0; i < bundle.linkedLibraryUris.length; i++) {
       String uri = bundle.linkedLibraryUris[i];
-      linkedMap[uri] = bundle.linkedLibraries[i];
+      addLinkedLibrary(uri, bundle.linkedLibraries[i]);
     }
   }
 
   /**
+   * Add the given [linkedLibrary] with the given [uri].
+   */
+  void addLinkedLibrary(String uri, LinkedLibrary linkedLibrary) {
+    linkedMap[uri] = linkedLibrary;
+  }
+
+  /**
+   * Add the given [unlinkedUnit] with the given [uri].
+   */
+  void addUnlinkedUnit(String uri, UnlinkedUnit unlinkedUnit) {
+    unlinkedMap[uri] = unlinkedUnit;
+  }
+
+  /**
    * Return a list of absolute URIs of the libraries that contain the unit with
    * the given [unitUriString], or `null` if no such library is in the store.
    */
@@ -436,14 +420,9 @@
 class _FileBasedSummaryResynthesizer extends SummaryResynthesizer {
   final SummaryDataStore _dataStore;
 
-  _FileBasedSummaryResynthesizer(
-      SummaryResynthesizer parent,
-      AnalysisContext context,
-      TypeProvider typeProvider,
-      SourceFactory sourceFactory,
-      bool strongMode,
-      this._dataStore)
-      : super(parent, context, typeProvider, sourceFactory, strongMode);
+  _FileBasedSummaryResynthesizer(AnalysisContext context,
+      SourceFactory sourceFactory, bool strongMode, this._dataStore)
+      : super(context, sourceFactory, strongMode);
 
   @override
   LinkedLibrary getLinkedSummary(String uri) {
diff --git a/pkg/analyzer/lib/src/summary/prelink.dart b/pkg/analyzer/lib/src/summary/prelink.dart
index 062676e..489bd35 100644
--- a/pkg/analyzer/lib/src/summary/prelink.dart
+++ b/pkg/analyzer/lib/src/summary/prelink.dart
@@ -351,6 +351,11 @@
   void filterExportNamespace(String relativeUri,
       List<UnlinkedCombinator> combinators, Map<String, _Meaning> result) {
     Map<String, _Meaning> exportNamespace = computeExportNamespace(relativeUri);
+    if (result == null) {
+      // This can happen if the import prefix was shadowed by a local name, so
+      // the imported symbols are inaccessible.
+      return;
+    }
     NameFilter filter = new NameFilter.forUnlinkedCombinators(combinators);
     exportNamespace.forEach((String name, _Meaning meaning) {
       if (filter.accepts(name) && !result.containsKey(name)) {
diff --git a/pkg/analyzer/lib/src/summary/public_namespace_computer.dart b/pkg/analyzer/lib/src/summary/public_namespace_computer.dart
index 9a8bd50..203043a 100644
--- a/pkg/analyzer/lib/src/summary/public_namespace_computer.dart
+++ b/pkg/analyzer/lib/src/summary/public_namespace_computer.dart
@@ -178,7 +178,7 @@
 
   @override
   visitPartDirective(PartDirective node) {
-    parts.add(node.uri.stringValue);
+    parts.add(node.uri.stringValue ?? '');
   }
 
   @override
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index bee1e9e..8fe29d9 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -7,6 +7,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
@@ -21,6 +22,7 @@
 import 'package:analyzer/src/generated/testing/token_factory.dart';
 import 'package:analyzer/src/summary/format.dart';
 import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary/summary_sdk.dart';
 
 /**
  * Implementation of [ElementResynthesizer] used when resynthesizing an element
@@ -28,13 +30,6 @@
  */
 abstract class SummaryResynthesizer extends ElementResynthesizer {
   /**
-   * The parent [SummaryResynthesizer] which is asked to resynthesize elements
-   * and get summaries before this resynthesizer attempts to do this.
-   * Can be `null`.
-   */
-  final SummaryResynthesizer parent;
-
-  /**
    * Source factory used to convert URIs to [Source] objects.
    */
   final SourceFactory sourceFactory;
@@ -45,10 +40,9 @@
   final Map<String, Source> _sources = <String, Source>{};
 
   /**
-   * The [TypeProvider] used to obtain core types (such as Object, int, List,
-   * and dynamic) during resynthesis.
+   * The [TypeProvider] used to obtain SDK types during resynthesis.
    */
-  final TypeProvider typeProvider;
+  TypeProvider _typeProvider;
 
   /**
    * Indicates whether the summary should be resynthesized assuming strong mode
@@ -79,9 +73,11 @@
   final Map<String, LibraryElement> _resynthesizedLibraries =
       <String, LibraryElement>{};
 
-  SummaryResynthesizer(this.parent, AnalysisContext context, this.typeProvider,
-      this.sourceFactory, this.strongMode)
-      : super(context);
+  SummaryResynthesizer(
+      AnalysisContext context, this.sourceFactory, this.strongMode)
+      : super(context) {
+    _buildTypeProvider();
+  }
 
   /**
    * Number of libraries that have been resynthesized so far.
@@ -89,23 +85,14 @@
   int get resynthesisCount => _resynthesizedLibraries.length;
 
   /**
-   * Perform delayed finalization of the `dart:core` and `dart:async` libraries.
+   * The [TypeProvider] used to obtain SDK types during resynthesis.
    */
-  void finalizeCoreAsyncLibraries() {
-    (_resynthesizedLibraries['dart:core'] as LibraryElementImpl)
-        .createLoadLibraryFunction(typeProvider);
-    (_resynthesizedLibraries['dart:async'] as LibraryElementImpl)
-        .createLoadLibraryFunction(typeProvider);
-  }
+  TypeProvider get typeProvider => _typeProvider;
 
   @override
   Element getElement(ElementLocation location) {
     List<String> components = location.components;
     String libraryUri = components[0];
-    // Ask the parent resynthesizer.
-    if (parent != null && parent._hasLibrarySummary(libraryUri)) {
-      return parent.getElement(location);
-    }
     // Resynthesize locally.
     if (components.length == 1) {
       return getLibraryElement(libraryUri);
@@ -202,11 +189,8 @@
    * hasn't been resynthesized already.
    */
   LibraryElement getLibraryElement(String uri) {
-    if (parent != null && parent._hasLibrarySummary(uri)) {
-      return parent.getLibraryElement(uri);
-    }
     return _resynthesizedLibraries.putIfAbsent(uri, () {
-      LinkedLibrary serializedLibrary = _getLinkedSummaryOrNull(uri);
+      LinkedLibrary serializedLibrary = getLinkedSummary(uri);
       Source librarySource = _getSource(uri);
       if (serializedLibrary == null) {
         LibraryElementImpl libraryElement =
@@ -217,18 +201,25 @@
         libraryElement.definingCompilationUnit = unitElement;
         unitElement.source = librarySource;
         unitElement.librarySource = librarySource;
-        return libraryElement..isSynthetic = true;
+        libraryElement.createLoadLibraryFunction(typeProvider);
+        libraryElement.publicNamespace = new Namespace({});
+        libraryElement.exportNamespace = new Namespace({});
+        return libraryElement;
       }
-      UnlinkedUnit unlinkedSummary = _getUnlinkedSummaryOrNull(uri);
+      UnlinkedUnit unlinkedSummary = getUnlinkedSummary(uri);
       if (unlinkedSummary == null) {
         throw new StateError('Unable to find unlinked summary: $uri');
       }
       List<UnlinkedUnit> serializedUnits = <UnlinkedUnit>[unlinkedSummary];
       for (String part in serializedUnits[0].publicNamespace.parts) {
         Source partSource = sourceFactory.resolveUri(librarySource, part);
-        String partAbsUri = partSource.uri.toString();
-        serializedUnits.add(_getUnlinkedSummaryOrNull(partAbsUri) ??
-            new UnlinkedUnitBuilder(codeRange: new CodeRangeBuilder()));
+        if (partSource == null) {
+          serializedUnits.add(null);
+        } else {
+          String partAbsUri = partSource.uri.toString();
+          serializedUnits.add(getUnlinkedSummary(partAbsUri) ??
+              new UnlinkedUnitBuilder(codeRange: new CodeRangeBuilder()));
+        }
       }
       _LibraryResynthesizer libraryResynthesizer = new _LibraryResynthesizer(
           this, serializedLibrary, serializedUnits, librarySource);
@@ -259,15 +250,15 @@
    */
   bool hasLibrarySummary(String uri);
 
-  /**
-   * Return the [LinkedLibrary] for the given [uri] or return `null` if it
-   * could not be found.
-   */
-  LinkedLibrary _getLinkedSummaryOrNull(String uri) {
-    if (parent != null && parent._hasLibrarySummary(uri)) {
-      return parent._getLinkedSummaryOrNull(uri);
-    }
-    return getLinkedSummary(uri);
+  void _buildTypeProvider() {
+    var coreLibrary = getLibraryElement('dart:core') as LibraryElementImpl;
+    var asyncLibrary = getLibraryElement('dart:async') as LibraryElementImpl;
+    SummaryTypeProvider summaryTypeProvider = new SummaryTypeProvider();
+    summaryTypeProvider.initializeCore(coreLibrary);
+    summaryTypeProvider.initializeAsync(asyncLibrary);
+    coreLibrary.createLoadLibraryFunction(summaryTypeProvider);
+    asyncLibrary.createLoadLibraryFunction(summaryTypeProvider);
+    _typeProvider = summaryTypeProvider;
   }
 
   /**
@@ -276,34 +267,14 @@
   Source _getSource(String uri) {
     return _sources.putIfAbsent(uri, () => sourceFactory.forUri(uri));
   }
-
-  /**
-   * Return the [UnlinkedUnit] for the given [uri] or return `null` if it
-   * could not be found.
-   */
-  UnlinkedUnit _getUnlinkedSummaryOrNull(String uri) {
-    if (parent != null && parent._hasLibrarySummary(uri)) {
-      return parent._getUnlinkedSummaryOrNull(uri);
-    }
-    return getUnlinkedSummary(uri);
-  }
-
-  /**
-   * Return `true` if this resynthesizer can provide summaries of the libraries
-   * with the given [uri].
-   */
-  bool _hasLibrarySummary(String uri) {
-    if (parent != null && parent._hasLibrarySummary(uri)) {
-      return true;
-    }
-    return hasLibrarySummary(uri);
-  }
 }
 
 /**
  * Builder of [Expression]s from [UnlinkedExpr]s.
  */
 class _ConstExprBuilder {
+  static const ARGUMENT_LIST = 'ARGUMENT_LIST';
+
   final _UnitResynthesizer resynthesizer;
   final ElementImpl context;
   final UnlinkedExpr uc;
@@ -467,17 +438,18 @@
           _pushList(null);
           break;
         case UnlinkedExprOperation.makeTypedList:
-          TypeName itemType = _newTypeName();
-          _pushList(AstTestFactory.typeArgumentList(<TypeName>[itemType]));
+          TypeAnnotation itemType = _newTypeName();
+          _pushList(
+              AstTestFactory.typeArgumentList(<TypeAnnotation>[itemType]));
           break;
         case UnlinkedExprOperation.makeUntypedMap:
           _pushMap(null);
           break;
         case UnlinkedExprOperation.makeTypedMap:
-          TypeName keyType = _newTypeName();
-          TypeName valueType = _newTypeName();
-          _pushMap(
-              AstTestFactory.typeArgumentList(<TypeName>[keyType, valueType]));
+          TypeAnnotation keyType = _newTypeName();
+          TypeAnnotation valueType = _newTypeName();
+          _pushMap(AstTestFactory
+              .typeArgumentList(<TypeAnnotation>[keyType, valueType]));
           break;
         case UnlinkedExprOperation.pushReference:
           _pushReference();
@@ -504,6 +476,9 @@
           Expression expression = _pop();
           _push(AstTestFactory.awaitExpression(expression));
           break;
+        case UnlinkedExprOperation.pushThis:
+          _push(AstTestFactory.thisExpression());
+          break;
         case UnlinkedExprOperation.assignToRef:
         case UnlinkedExprOperation.assignToProperty:
         case UnlinkedExprOperation.assignToIndex:
@@ -515,6 +490,9 @@
         case UnlinkedExprOperation.typeCheck:
         case UnlinkedExprOperation.throwException:
         case UnlinkedExprOperation.pushLocalFunctionReference:
+        case UnlinkedExprOperation.pushError:
+        case UnlinkedExprOperation.pushTypedAbstract:
+        case UnlinkedExprOperation.pushUntypedAbstract:
           throw new UnimplementedError(
               'Unexpected $operation in a constant expression.');
       }
@@ -566,8 +544,8 @@
     return AstTestFactory.propertyAccess(enclosing, property);
   }
 
-  TypeName _buildTypeAst(DartType type) {
-    List<TypeName> argumentNodes;
+  TypeAnnotation _buildTypeAst(DartType type) {
+    List<TypeAnnotation> argumentNodes;
     if (type is ParameterizedType) {
       if (!resynthesizer.libraryResynthesizer.typesWithImplicitTypeArguments
           .contains(type)) {
@@ -588,9 +566,9 @@
 
   InterpolationElement _newInterpolationElement(Expression expr) {
     if (expr is SimpleStringLiteral) {
-      return new InterpolationString(expr.literal, expr.value);
+      return astFactory.interpolationString(expr.literal, expr.value);
     } else {
-      return new InterpolationExpression(
+      return astFactory.interpolationExpression(
           TokenFactory.tokenFromType(TokenType.STRING_INTERPOLATION_EXPRESSION),
           expr,
           TokenFactory.tokenFromType(TokenType.CLOSE_CURLY_BRACKET));
@@ -601,7 +579,7 @@
    * Convert the next reference to the [DartType] and return the AST
    * corresponding to this type.
    */
-  TypeName _newTypeName() {
+  TypeAnnotation _newTypeName() {
     EntityRef typeRef = uc.references[refPtr++];
     DartType type =
         resynthesizer.buildType(typeRef, context?.typeParameterContext);
@@ -644,8 +622,12 @@
       } else if (info.element is ClassElement) {
         constructorName = null;
       } else {
-        throw new StateError('Unsupported element for invokeConstructor '
-            '${info.element?.runtimeType}');
+        List<Expression> arguments = _buildArguments();
+        SimpleIdentifier name = AstTestFactory.identifier3(info.name);
+        name.staticElement = info.element;
+        name.setProperty(ARGUMENT_LIST, AstTestFactory.argumentList(arguments));
+        _push(name);
+        return;
       }
       InterfaceType definingType = resynthesizer._createConstructorDefiningType(
           context?.typeParameterContext, info, ref.typeArguments);
@@ -707,14 +689,15 @@
     TypeArgumentList typeArguments;
     int numTypeArguments = uc.ints[intPtr++];
     if (numTypeArguments > 0) {
-      List<TypeName> typeNames = new List<TypeName>(numTypeArguments);
+      List<TypeAnnotation> typeNames =
+          new List<TypeAnnotation>(numTypeArguments);
       for (int i = 0; i < numTypeArguments; i++) {
         typeNames[i] = _newTypeName();
       }
       typeArguments = AstTestFactory.typeArgumentList(typeNames);
     }
     if (node is SimpleIdentifier) {
-      _push(new MethodInvocation(
+      _push(astFactory.methodInvocation(
           null,
           TokenFactory.tokenFromType(TokenType.PERIOD),
           node,
@@ -1021,7 +1004,9 @@
           unlinkedDefiningUnit.publicNamespace.parts[i - 1],
           unlinkedDefiningUnit.parts[i - 1],
           i);
-      partResynthesizers.add(partResynthesizer);
+      if (partResynthesizer != null) {
+        partResynthesizers.add(partResynthesizer);
+      }
     }
     library.parts = partResynthesizers.map((r) => r.unit).toList();
     // Populate units.
@@ -1042,13 +1027,16 @@
   }
 
   /**
-   * Create, but do not populate, the [CompilationUnitElement] for a part other
-   * than the defining compilation unit.
+   * Create a [_UnitResynthesizer] that will resynthesize the part with the
+   * given [uri]. Return `null` if the [uri] is invalid.
    */
   _UnitResynthesizer buildPart(_UnitResynthesizer definingUnitResynthesizer,
       String uri, UnlinkedPart partDecl, int unitNum) {
     Source unitSource =
         summaryResynthesizer.sourceFactory.resolveUri(librarySource, uri);
+    if (unitSource == null) {
+      return null;
+    }
     _UnitResynthesizer partResynthesizer =
         createUnitResynthesizer(unitNum, unitSource, partDecl);
     CompilationUnitElementImpl partUnit = partResynthesizer.unit;
@@ -1270,7 +1258,7 @@
   /**
    * If this reference refers to a type, build a [DartType].  Otherwise return
    * `null`.  If [numTypeArguments] is the same as the [numTypeParameters],
-   * the type in instantiated with type arguments returned by [getTypeArgument],
+   * the type is instantiated with type arguments returned by [getTypeArgument],
    * otherwise it is instantiated with type parameter bounds (if strong mode),
    * or with `dynamic` type arguments.
    *
@@ -1287,7 +1275,7 @@
       // If type arguments are specified, use them.
       // Otherwise, delay until they are requested.
       if (numTypeParameters == 0) {
-        typeArguments = const <DartType>[];
+        return element.type;
       } else if (numTypeArguments == numTypeParameters) {
         typeArguments = new List<DartType>(numTypeParameters);
         for (int i = 0; i < numTypeParameters; i++) {
@@ -1297,22 +1285,14 @@
       InterfaceTypeImpl type =
           new InterfaceTypeImpl.elementWithNameAndArgs(element, name, () {
         if (typeArguments == null) {
-          typeArguments = element.typeParameters
-              .map/*<DartType>*/((_) => DynamicTypeImpl.instance)
-              .toList();
+          typeArguments = new List<DartType>.filled(
+              element.typeParameters.length, DynamicTypeImpl.instance);
           if (libraryResynthesizer.summaryResynthesizer.strongMode &&
               instantiateToBoundsAllowed) {
-            List<DartType> typeParameterTypes;
-            for (int i = 0; i < typeArguments.length; i++) {
-              DartType bound = element.typeParameters[i].bound;
-              if (bound != null) {
-                typeParameterTypes ??= element.typeParameters
-                    .map/*<DartType>*/((TypeParameterElement e) => e.type)
-                    .toList();
-                typeArguments[i] =
-                    bound.substitute2(typeArguments, typeParameterTypes);
-              }
-            }
+            InterfaceType instantiatedToBounds = libraryResynthesizer
+                .summaryResynthesizer.context.typeSystem
+                .instantiateToBounds(element.type) as InterfaceType;
+            return instantiatedToBounds.typeArguments;
           }
         }
         return typeArguments;
@@ -1380,6 +1360,9 @@
   _ResynthesizerContext(this._unitResynthesizer);
 
   @override
+  bool get isStrongMode => _unitResynthesizer.summaryResynthesizer.strongMode;
+
+  @override
   ElementAnnotationImpl buildAnnotation(ElementImpl context, UnlinkedExpr uc) {
     return _unitResynthesizer.buildAnnotation(context, uc);
   }
@@ -1523,8 +1506,11 @@
     ElementAnnotationImpl elementAnnotation = new ElementAnnotationImpl(unit);
     Expression constExpr = _buildConstExpression(context, uc);
     if (constExpr is Identifier) {
+      ArgumentList arguments =
+          constExpr.getProperty(_ConstExprBuilder.ARGUMENT_LIST);
       elementAnnotation.element = constExpr.staticElement;
-      elementAnnotation.annotationAst = AstTestFactory.annotation(constExpr);
+      elementAnnotation.annotationAst =
+          AstTestFactory.annotation2(constExpr, null, arguments);
     } else if (constExpr is InstanceCreationExpression) {
       elementAnnotation.element = constExpr.staticElement;
       Identifier typeName = constExpr.constructorName.type.name;
@@ -1538,6 +1524,15 @@
       elementAnnotation.annotationAst = AstTestFactory.annotation2(
           typeName, constructorName, constExpr.argumentList)
         ..element = constExpr.staticElement;
+    } else if (constExpr is PropertyAccess) {
+      var target = constExpr.target as Identifier;
+      var propertyName = constExpr.propertyName;
+      ArgumentList arguments =
+          constExpr.getProperty(_ConstExprBuilder.ARGUMENT_LIST);
+      elementAnnotation.element = propertyName.staticElement;
+      elementAnnotation.annotationAst = AstTestFactory.annotation2(
+          target, propertyName, arguments)
+        ..element = propertyName.staticElement;
     } else {
       throw new StateError(
           'Unexpected annotation type: ${constExpr.runtimeType}');
@@ -1745,6 +1740,13 @@
               libraryResynthesizer.getReferencedLocationComponents(
                   linkedReference.dependency, linkedReference.unit, identifier);
         }
+        if (!_resynthesizerContext.isStrongMode &&
+            locationComponents.length == 3 &&
+            locationComponents[0] == 'dart:async' &&
+            locationComponents[2] == 'FutureOr') {
+          type = typeProvider.dynamicType;
+          numTypeParameters = 0;
+        }
         ElementLocation location =
             new ElementLocationImpl.con3(locationComponents);
         if (enclosingInfo != null) {
diff --git a/pkg/analyzer/lib/src/summary/summarize_ast.dart b/pkg/analyzer/lib/src/summary/summarize_ast.dart
index 5d35783..35b5029 100644
--- a/pkg/analyzer/lib/src/summary/summarize_ast.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_ast.dart
@@ -53,19 +53,19 @@
 
   @override
   void serializeAnnotation(Annotation annotation) {
-    if (annotation.arguments == null) {
-      assert(annotation.constructorName == null);
-      serialize(annotation.name);
+    Identifier name = annotation.name;
+    EntityRefBuilder constructor;
+    if (name is PrefixedIdentifier && annotation.constructorName == null) {
+      constructor =
+          serializeConstructorRef(null, name.prefix, null, name.identifier);
     } else {
-      Identifier name = annotation.name;
-      EntityRefBuilder constructor;
-      if (name is PrefixedIdentifier && annotation.constructorName == null) {
-        constructor =
-            serializeConstructorRef(null, name.prefix, null, name.identifier);
-      } else {
-        constructor = serializeConstructorRef(
-            null, annotation.name, null, annotation.constructorName);
-      }
+      constructor = serializeConstructorRef(
+          null, annotation.name, null, annotation.constructorName);
+    }
+    if (annotation.arguments == null) {
+      references.add(constructor);
+      operations.add(UnlinkedExprOperation.pushReference);
+    } else {
       serializeInstanceCreation(constructor, annotation.arguments);
     }
   }
@@ -567,7 +567,7 @@
       NodeList<Annotation> annotations,
       bool isFinal,
       bool isConst,
-      TypeName type,
+      TypeAnnotation type,
       bool assignPropagatedTypeSlot,
       SimpleIdentifier declaredIdentifier) {
     UnlinkedVariableBuilder b = new UnlinkedVariableBuilder();
@@ -597,7 +597,7 @@
     }
     String text = documentationComment.tokens
         .map((Token t) => t.toString())
-        .join()
+        .join('\n')
         .replaceAll('\r\n', '\n');
     return new UnlinkedDocumentationCommentBuilder(text: text);
   }
@@ -615,7 +615,7 @@
       int nameOffset,
       bool isGetter,
       bool isSetter,
-      TypeName returnType,
+      TypeAnnotation returnType,
       FormalParameterList formalParameters,
       FunctionBody body,
       bool isTopLevel,
@@ -764,7 +764,7 @@
    * parameter and store them in [b].
    */
   void serializeFunctionTypedParameterDetails(UnlinkedParamBuilder b,
-      TypeName returnType, FormalParameterList parameters) {
+      TypeAnnotation returnType, FormalParameterList parameters) {
     EntityRefBuilder serializedReturnType = serializeTypeName(returnType);
     if (serializedReturnType != null) {
       b.type = serializedReturnType;
@@ -807,6 +807,8 @@
     b.nameOffset = node.identifier.offset;
     b.annotations = serializeAnnotations(node.metadata);
     b.codeRange = serializeCodeRange(node);
+    b.isExplicitlyCovariant = node.covariantKeyword != null;
+    b.isFinal = node.isFinal;
     if (_parametersMayInheritCovariance) {
       b.inheritsCovariantSlot = assignSlot();
     }
@@ -933,8 +935,13 @@
    * a [EntityRef].  Note that this method does the right thing if the
    * name doesn't refer to an entity other than a type (e.g. a class member).
    */
-  EntityRefBuilder serializeTypeName(TypeName node) {
-    return serializeType(node?.name, node?.typeArguments);
+  EntityRefBuilder serializeTypeName(TypeAnnotation node) {
+    if (node is TypeName) {
+      return serializeType(node?.name, node?.typeArguments);
+    } else if (node != null) {
+      throw new ArgumentError('Cannot serialize a ${node.runtimeType}');
+    }
+    return null;
   }
 
   /**
@@ -966,10 +973,14 @@
       Comment documentationComment,
       NodeList<Annotation> annotations,
       bool isField) {
+    bool isCovariant = isField
+        ? (variables.parent as FieldDeclaration).covariantKeyword != null
+        : false;
     for (VariableDeclaration variable in variables.variables) {
       UnlinkedVariableBuilder b = new UnlinkedVariableBuilder();
-      b.isFinal = variables.isFinal;
       b.isConst = variables.isConst;
+      b.isCovariant = isCovariant;
+      b.isFinal = variables.isFinal;
       b.isStatic = isDeclaredStatic;
       b.name = variable.name.name;
       b.nameOffset = variable.name.offset;
@@ -1397,14 +1408,6 @@
   }
 
   /**
-   * Helper method to determine if a given [typeName] refers to `dynamic`.
-   */
-  static bool isDynamic(TypeName typeName) {
-    Identifier name = typeName.name;
-    return name is SimpleIdentifier && name.name == 'dynamic';
-  }
-
-  /**
    * Compute the API signature of the unit and record it.
    */
   static void _computeApiSignature(UnlinkedUnitBuilder b) {
diff --git a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
index 5a8702a..52ad3bc 100644
--- a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
@@ -36,6 +36,14 @@
     }
   }
 
+  if (node is AssertInitializer) {
+    serializeArguments(node.message != null
+        ? [node.condition, node.message]
+        : [node.condition]);
+    return new UnlinkedConstructorInitializerBuilder(
+        kind: UnlinkedConstructorInitializerKind.assertInvocation,
+        arguments: arguments);
+  }
   if (node is RedirectingConstructorInvocation) {
     serializeArguments(node.argumentList.arguments);
     return new UnlinkedConstructorInitializerBuilder(
@@ -178,8 +186,12 @@
   /**
    * Return [EntityRefBuilder] that corresponds to the given [type].
    */
-  EntityRefBuilder serializeTypeName(TypeName type) {
-    return serializeType(type?.type, type?.name, type?.typeArguments);
+  EntityRefBuilder serializeTypeName(TypeAnnotation type) {
+    if (type is TypeName) {
+      return serializeType(type?.type, type?.name, type?.typeArguments);
+    }
+    throw new ArgumentError(
+        'Cannot serialize an instance of ${type.runtimeType}');
   }
 
   /**
@@ -376,6 +388,8 @@
       _serialize(expr.expression);
       references.add(serializeTypeName(expr.type));
       operations.add(UnlinkedExprOperation.typeCheck);
+    } else if (expr is ThisExpression) {
+      operations.add(UnlinkedExprOperation.pushThis);
     } else if (expr is ThrowExpression) {
       isValidConst = false;
       _serialize(expr.expression);
@@ -649,8 +663,8 @@
       ints.add(0);
     } else {
       ints.add(typeArguments.arguments.length);
-      for (TypeName typeName in typeArguments.arguments) {
-        references.add(serializeTypeName(typeName));
+      for (TypeAnnotation type in typeArguments.arguments) {
+        references.add(serializeTypeName(type));
       }
     }
   }
diff --git a/pkg/analyzer/lib/src/summary/summary_sdk.dart b/pkg/analyzer/lib/src/summary/summary_sdk.dart
index 3142b29..fcdc232 100644
--- a/pkg/analyzer/lib/src/summary/summary_sdk.dart
+++ b/pkg/analyzer/lib/src/summary/summary_sdk.dart
@@ -7,7 +7,6 @@
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/file_system/file_system.dart' show ResourceProvider;
-import 'package:analyzer/src/context/cache.dart' show CacheEntry;
 import 'package:analyzer/src/context/context.dart';
 import 'package:analyzer/src/dart/element/type.dart';
 import 'package:analyzer/src/generated/constant.dart';
@@ -18,84 +17,6 @@
     show DartUriResolver, Source, SourceFactory;
 import 'package:analyzer/src/summary/idl.dart';
 import 'package:analyzer/src/summary/package_bundle_reader.dart';
-import 'package:analyzer/src/summary/resynthesize.dart';
-import 'package:analyzer/src/task/dart.dart';
-import 'package:analyzer/task/model.dart' show ResultDescriptor, TargetedResult;
-
-class SdkSummaryResultProvider extends ResynthesizerResultProvider {
-  final SummaryTypeProvider typeProvider = new SummaryTypeProvider();
-
-  SdkSummaryResultProvider(
-      InternalAnalysisContext context, PackageBundle bundle, bool strongMode)
-      : super(context, new SummaryDataStore(const <String>[])) {
-    addBundle(null, bundle);
-    createResynthesizer(null, typeProvider);
-    _buildCoreLibrary();
-    _buildAsyncLibrary();
-    resynthesizer.finalizeCoreAsyncLibraries();
-    context.typeProvider = typeProvider;
-  }
-
-  @override
-  bool compute(CacheEntry entry, ResultDescriptor result) {
-    if (result == TYPE_PROVIDER) {
-      entry.setValue(result as ResultDescriptor<TypeProvider>, typeProvider,
-          TargetedResult.EMPTY_LIST);
-      return true;
-    }
-    return super.compute(entry, result);
-  }
-
-  @override
-  bool hasResultsForSource(Source source) {
-    return source != null && source.isInSystemLibrary;
-  }
-
-  void _buildAsyncLibrary() {
-    LibraryElement library = resynthesizer.getLibraryElement('dart:async');
-    typeProvider.initializeAsync(library);
-  }
-
-  void _buildCoreLibrary() {
-    LibraryElement library = resynthesizer.getLibraryElement('dart:core');
-    typeProvider.initializeCore(library);
-  }
-}
-
-/**
- * The implementation of [SummaryResynthesizer] for Dart SDK.
- */
-class SdkSummaryResynthesizer extends SummaryResynthesizer {
-  final PackageBundle bundle;
-  final Map<String, UnlinkedUnit> unlinkedSummaries = <String, UnlinkedUnit>{};
-  final Map<String, LinkedLibrary> linkedSummaries = <String, LinkedLibrary>{};
-
-  SdkSummaryResynthesizer(AnalysisContext context, TypeProvider typeProvider,
-      SourceFactory sourceFactory, this.bundle, bool strongMode)
-      : super(null, context, typeProvider, sourceFactory, strongMode) {
-    for (int i = 0; i < bundle.unlinkedUnitUris.length; i++) {
-      unlinkedSummaries[bundle.unlinkedUnitUris[i]] = bundle.unlinkedUnits[i];
-    }
-    for (int i = 0; i < bundle.linkedLibraryUris.length; i++) {
-      linkedSummaries[bundle.linkedLibraryUris[i]] = bundle.linkedLibraries[i];
-    }
-  }
-
-  @override
-  LinkedLibrary getLinkedSummary(String uri) {
-    return linkedSummaries[uri];
-  }
-
-  @override
-  UnlinkedUnit getUnlinkedSummary(String uri) {
-    return unlinkedSummaries[uri];
-  }
-
-  @override
-  bool hasLibrarySummary(String uri) {
-    return uri.startsWith('dart:');
-  }
-}
 
 /**
  * An implementation of [DartSdk] which provides analysis results for `dart:`
@@ -143,8 +64,10 @@
       SourceFactory factory = new SourceFactory(
           [new DartUriResolver(this)], null, resourceProvider);
       _analysisContext.sourceFactory = factory;
+      SummaryDataStore dataStore = new SummaryDataStore([]);
+      dataStore.addBundle(null, _bundle);
       _analysisContext.resultProvider =
-          new SdkSummaryResultProvider(_analysisContext, _bundle, strongMode);
+          new InputPackagesResultProvider(_analysisContext, dataStore);
     }
     return _analysisContext;
   }
@@ -200,6 +123,8 @@
   InterfaceType _functionType;
   InterfaceType _futureDynamicType;
   InterfaceType _futureNullType;
+  InterfaceType _futureOrNullType;
+  InterfaceType _futureOrType;
   InterfaceType _futureType;
   InterfaceType _intType;
   InterfaceType _iterableDynamicType;
@@ -266,6 +191,20 @@
   }
 
   @override
+  InterfaceType get futureOrNullType {
+    assert(_asyncLibrary != null);
+    _futureOrNullType ??= futureOrType.instantiate(<DartType>[nullType]);
+    return _futureOrNullType;
+  }
+
+  @override
+  InterfaceType get futureOrType {
+    assert(_asyncLibrary != null);
+    _futureOrType ??= _getType(_asyncLibrary, "FutureOr");
+    return _futureOrType;
+  }
+
+  @override
   InterfaceType get futureType {
     assert(_asyncLibrary != null);
     _futureType ??= _getType(_asyncLibrary, "Future");
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index 9e3b31e..05528d7 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -7,6 +7,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -24,6 +25,7 @@
 import 'package:analyzer/src/dart/scanner/reader.dart';
 import 'package:analyzer/src/dart/scanner/scanner.dart';
 import 'package:analyzer/src/dart/sdk/patch.dart';
+import 'package:analyzer/src/dart/sdk/sdk.dart';
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/error/pending_error.dart';
 import 'package:analyzer/src/generated/constant.dart';
@@ -114,7 +116,7 @@
     const SimpleResultCachingPolicy(-1, -1);
 
 /**
- * The errors produced while resolving a library directives.
+ * The errors produced while building a library's directives.
  *
  * The list will be empty if there were no errors, but will not be `null`.
  *
@@ -123,7 +125,6 @@
 final ListResultDescriptor<AnalysisError> BUILD_DIRECTIVES_ERRORS =
     new ListResultDescriptor<AnalysisError>(
         'BUILD_DIRECTIVES_ERRORS', AnalysisError.NO_ERRORS);
-
 /**
  * The errors produced while building a library element.
  *
@@ -350,6 +351,7 @@
   HINTS,
   LIBRARY_UNIT_ERRORS,
   LINTS,
+  RESOLVE_DIRECTIVES_ERRORS,
   RESOLVE_TYPE_BOUNDS_ERRORS,
   RESOLVE_TYPE_NAMES_ERRORS,
   RESOLVE_UNIT_ERRORS,
@@ -703,6 +705,17 @@
         'REQUIRED_CONSTANTS', const <ConstantEvaluationTarget>[]);
 
 /**
+ * The errors produced while resolving a library's directives.
+ *
+ * The list will be empty if there were no errors, but will not be `null`.
+ *
+ * The result is only available for [Source]s representing a library.
+ */
+final ListResultDescriptor<AnalysisError> RESOLVE_DIRECTIVES_ERRORS =
+    new ListResultDescriptor<AnalysisError>(
+        'RESOLVE_DIRECTIVES_ERRORS', AnalysisError.NO_ERRORS);
+
+/**
  * The errors produced while resolving bounds of type parameters of classes,
  * class and function aliases.
  *
@@ -1230,8 +1243,10 @@
       libraryElement.invalidateLibraryCycles();
       errors = builder.errors;
     } else {
-      DirectiveResolver resolver = new DirectiveResolver();
+      DirectiveResolver resolver = new DirectiveResolver(
+          sourceModificationTimeMap, importSourceKindMap, exportSourceKindMap);
       libraryUnit.accept(resolver);
+      errors = resolver.errors;
     }
     //
     // Record outputs.
@@ -1328,7 +1343,11 @@
     }
 
     EnumDeclaration firstEnum = findFirstEnum();
-    if (firstEnum != null && firstEnum.element.accessors.isEmpty) {
+    if (firstEnum != null &&
+        resolutionMap
+            .elementDeclaredByEnumDeclaration(firstEnum)
+            .accessors
+            .isEmpty) {
       EnumMemberBuilder builder = new EnumMemberBuilder(typeProvider);
       unit.accept(builder);
     }
@@ -1503,7 +1522,8 @@
     int partLength = partUnits.length;
     for (int i = 0; i < partLength; i++) {
       CompilationUnit partUnit = partUnits[i];
-      Source partSource = partUnit.element.source;
+      Source partSource =
+          resolutionMap.elementDeclaredByCompilationUnit(partUnit).source;
       partUnitMap[partSource] = partUnit;
     }
     //
@@ -3446,7 +3466,9 @@
     //
     if (context.analysisOptions.strongMode) {
       InstanceMemberInferrer inferrer = new InstanceMemberInferrer(
-          typeProvider, new InheritanceManager(unit.element.library),
+          typeProvider,
+          new InheritanceManager(
+              resolutionMap.elementDeclaredByCompilationUnit(unit).library),
           typeSystem: context.typeSystem);
       inferrer.inferCompilationUnit(unit.element);
     }
@@ -3511,7 +3533,8 @@
     AstNode node = new NodeLocator2(offset).searchWithin(unit);
     if (node == null) {
       Source variableSource = variable.source;
-      Source unitSource = unit.element.source;
+      Source unitSource =
+          resolutionMap.elementDeclaredByCompilationUnit(unit).source;
       if (variableSource != unitSource) {
         throw new AnalysisException(
             "Failed to find the AST node for the variable "
@@ -3526,7 +3549,8 @@
         node.getAncestor((AstNode ancestor) => ancestor is VariableDeclaration);
     if (declaration == null || declaration.name != node) {
       Source variableSource = variable.source;
-      Source unitSource = unit.element.source;
+      Source unitSource =
+          resolutionMap.elementDeclaredByCompilationUnit(unit).source;
       if (variableSource != unitSource) {
         if (declaration == null) {
           throw new AnalysisException(
@@ -3721,7 +3745,7 @@
       // Record the type of the variable.
       //
       DartType newType = initializer.staticType;
-      if (newType == null || newType.isBottom) {
+      if (newType == null || newType.isBottom || newType.isDartCoreNull) {
         newType = typeProvider.dynamicType;
       }
       setFieldType(variable, newType);
@@ -3857,6 +3881,12 @@
       'STATIC_VARIABLE_RESOLUTION_ERRORS_INPUT';
 
   /**
+   * The name of the [RESOLVE_DIRECTIVES_ERRORS] input.
+   */
+  static const String RESOLVE_DIRECTIVES_ERRORS_INPUT =
+      'RESOLVE_DIRECTIVES_ERRORS';
+
+  /**
    * The name of the [STRONG_MODE_ERRORS] input.
    */
   static const String STRONG_MODE_ERRORS_INPUT = 'STRONG_MODE_ERRORS';
@@ -3914,6 +3944,7 @@
     errorLists.add(getRequiredInput(BUILD_LIBRARY_ERRORS_INPUT));
     errorLists.add(getRequiredInput(HINTS_INPUT));
     errorLists.add(getRequiredInput(LINTS_INPUT));
+    errorLists.add(getRequiredInput(RESOLVE_DIRECTIVES_ERRORS_INPUT));
     errorLists.add(getRequiredInput(RESOLVE_TYPE_NAMES_ERRORS_INPUT));
     errorLists.add(getRequiredInput(RESOLVE_TYPE_NAMES_ERRORS2_INPUT));
     errorLists.add(getRequiredInput(RESOLVE_UNIT_ERRORS_INPUT));
@@ -3937,6 +3968,7 @@
     Map<String, TaskInput> inputs = <String, TaskInput>{
       HINTS_INPUT: HINTS.of(unit),
       LINTS_INPUT: LINTS.of(unit),
+      RESOLVE_DIRECTIVES_ERRORS_INPUT: RESOLVE_DIRECTIVES_ERRORS.of(unit),
       RESOLVE_TYPE_NAMES_ERRORS_INPUT: RESOLVE_TYPE_NAMES_ERRORS.of(unit),
       RESOLVE_TYPE_NAMES_ERRORS2_INPUT: RESOLVE_TYPE_BOUNDS_ERRORS.of(unit),
       RESOLVE_UNIT_ERRORS_INPUT: RESOLVE_UNIT_ERRORS.of(unit),
@@ -4051,9 +4083,17 @@
     CompilationUnit unit = parser.parseCompilationUnit(tokenStream);
     unit.lineInfo = lineInfo;
 
-    if (options.patchPlatform != 0 && _source.uri.scheme == 'dart') {
-      new SdkPatcher().patch(context.sourceFactory.dartSdk,
-          options.patchPlatform, errorListener, _source, unit);
+    if (options.patchPaths.isNotEmpty && _source.uri.scheme == 'dart') {
+      var resourceProvider =
+          (context.sourceFactory.dartSdk as FolderBasedDartSdk)
+              .resourceProvider;
+      new SdkPatcher().patch(
+          resourceProvider,
+          context.analysisOptions.strongMode,
+          context.analysisOptions.patchPaths,
+          errorListener,
+          _source,
+          unit);
     }
 
     bool hasNonPartOfDirective = false;
@@ -4998,14 +5038,22 @@
    */
   static const String UNIT_INPUT = 'UNIT_INPUT';
 
+  static const String SOURCES_MODIFICATION_TIME_INPUT =
+      'SOURCES_MODIFICATION_TIME_INPUT';
+  static const String IMPORTS_SOURCE_KIND_INPUT = 'IMPORTS_SOURCE_KIND_INPUT';
+  static const String EXPORTS_SOURCE_KIND_INPUT = 'EXPORTS_SOURCE_KIND_INPUT';
+
   /**
    * The task descriptor describing this kind of task.
    */
   static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
       'ResolveDirectiveElementsTask',
       createTask,
-      buildInputs,
-      <ResultDescriptor>[CREATED_RESOLVED_UNIT2, RESOLVED_UNIT2]);
+      buildInputs, <ResultDescriptor>[
+    CREATED_RESOLVED_UNIT2,
+    RESOLVED_UNIT2,
+    RESOLVE_DIRECTIVES_ERRORS
+  ]);
 
   ResolveDirectiveElementsTask(
       InternalAnalysisContext context, AnalysisTarget target)
@@ -5021,18 +5069,28 @@
     // Prepare inputs.
     //
     CompilationUnit unit = getRequiredInput(UNIT_INPUT);
+    Map<Source, int> sourceModificationTimeMap =
+        getRequiredInput(SOURCES_MODIFICATION_TIME_INPUT);
+    Map<Source, SourceKind> importSourceKindMap =
+        getRequiredInput(IMPORTS_SOURCE_KIND_INPUT);
+    Map<Source, SourceKind> exportSourceKindMap =
+        getRequiredInput(EXPORTS_SOURCE_KIND_INPUT);
     //
     // Resolve directive AST nodes to elements.
     //
+    List<AnalysisError> errors = const <AnalysisError>[];
     if (targetUnit.unit == targetUnit.library) {
-      DirectiveResolver resolver = new DirectiveResolver();
+      DirectiveResolver resolver = new DirectiveResolver(
+          sourceModificationTimeMap, importSourceKindMap, exportSourceKindMap);
       unit.accept(resolver);
+      errors = resolver.errors;
     }
     //
     // Record outputs.
     //
     outputs[CREATED_RESOLVED_UNIT2] = true;
     outputs[RESOLVED_UNIT2] = unit;
+    outputs[RESOLVE_DIRECTIVES_ERRORS] = errors;
   }
 
   /**
@@ -5044,7 +5102,13 @@
     LibrarySpecificUnit unit = target;
     return <String, TaskInput>{
       LIBRARY_INPUT: LIBRARY_ELEMENT2.of(unit.library),
-      UNIT_INPUT: RESOLVED_UNIT1.of(unit)
+      UNIT_INPUT: RESOLVED_UNIT1.of(unit),
+      SOURCES_MODIFICATION_TIME_INPUT:
+          REFERENCED_SOURCES.of(unit.library).toMapOf(MODIFICATION_TIME),
+      IMPORTS_SOURCE_KIND_INPUT:
+          IMPORTED_LIBRARIES.of(unit.library).toMapOf(SOURCE_KIND),
+      EXPORTS_SOURCE_KIND_INPUT:
+          EXPORTED_LIBRARIES.of(unit.library).toMapOf(SOURCE_KIND)
     };
   }
 
@@ -6107,7 +6171,7 @@
     if (options.strongMode) {
       CodeChecker checker = new CodeChecker(
           typeProvider,
-          new StrongTypeSystemImpl(
+          new StrongTypeSystemImpl(typeProvider,
               implicitCasts: options.implicitCasts,
               nonnullableTypes: options.nonnullableTypes),
           errorListener,
@@ -6232,8 +6296,7 @@
         libraryElement,
         typeProvider,
         new InheritanceManager(libraryElement),
-        context.analysisOptions.enableSuperMixins,
-        context.analysisOptions.enableAssertMessage);
+        context.analysisOptions.enableSuperMixins);
     unit.accept(errorVerifier);
     //
     // Convert the pending errors into actual errors.
diff --git a/pkg/analyzer/lib/src/task/dart_work_manager.dart b/pkg/analyzer/lib/src/task/dart_work_manager.dart
index aecdba4..0a56cd8 100644
--- a/pkg/analyzer/lib/src/task/dart_work_manager.dart
+++ b/pkg/analyzer/lib/src/task/dart_work_manager.dart
@@ -40,6 +40,7 @@
     HINTS,
     LINTS,
     LIBRARY_UNIT_ERRORS,
+    RESOLVE_DIRECTIVES_ERRORS,
     RESOLVE_TYPE_NAMES_ERRORS,
     RESOLVE_TYPE_BOUNDS_ERRORS,
     RESOLVE_UNIT_ERRORS,
diff --git a/pkg/analyzer/lib/src/task/options.dart b/pkg/analyzer/lib/src/task/options.dart
index 4cf2afe..050d3bc 100644
--- a/pkg/analyzer/lib/src/task/options.dart
+++ b/pkg/analyzer/lib/src/task/options.dart
@@ -14,6 +14,10 @@
 import 'package:analyzer/src/generated/java_engine.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/utilities_general.dart';
+import 'package:analyzer/src/lint/config.dart';
+import 'package:analyzer/src/lint/linter.dart';
+import 'package:analyzer/src/lint/options_rule_validator.dart';
+import 'package:analyzer/src/lint/registry.dart';
 import 'package:analyzer/src/task/general.dart';
 import 'package:analyzer/src/util/yaml.dart';
 import 'package:analyzer/task/general.dart';
@@ -35,12 +39,6 @@
   _processor.applyToAnalysisOptions(options, optionMap);
 }
 
-/// Configure this [context] based on configuration details specified in
-/// the given [options].  If [options] is `null`, default values are applied.
-void configureContextOptions(
-        AnalysisContext context, Map<String, Object> options) =>
-    _processor.configure(context, options);
-
 /// `analyzer` analysis options constants.
 class AnalyzerOptions {
   static const String analyzer = 'analyzer';
@@ -393,16 +391,16 @@
 
 /// Validates options defined in an analysis options file.
 class OptionsFileValidator {
-  // TODO(pq): move to an extension point.
+  /// The source being validated.
+  final Source source;
+
   final List<OptionsValidator> _validators = [
     new AnalyzerOptionsValidator(),
-    new LinterOptionsValidator()
+    new LinterOptionsValidator(),
+    new LinterRuleOptionsValidator()
   ];
 
-  final Source source;
-  OptionsFileValidator(this.source) {
-    _validators.addAll(AnalysisEngine.instance.optionsPlugin.optionsValidators);
-  }
+  OptionsFileValidator(this.source);
 
   List<AnalysisError> validate(Map<String, YamlNode> options) {
     RecordingErrorListener recorder = new RecordingErrorListener();
@@ -513,109 +511,13 @@
       var excludes = analyzer[AnalyzerOptions.exclude];
       _applyExcludes(options, excludes);
     }
-  }
 
-  /// Configure [context] based on the given [options] (which can be `null`
-  /// to restore [defaults]).
-  void configure(AnalysisContext context, Map<String, Object> options) {
-    if (options == null) {
-      options = defaults;
-    }
-
-    var analyzer = options[AnalyzerOptions.analyzer];
-    if (analyzer is Map) {
-      // Set strong mode (default is false).
-      var strongMode = analyzer[AnalyzerOptions.strong_mode];
-      setStrongMode(context, strongMode);
-
-      // Set filters.
-      var filters = analyzer[AnalyzerOptions.errors];
-      setProcessors(context, filters);
-
-      // Process language options.
-      var language = analyzer[AnalyzerOptions.language];
-      setLanguageOptions(context, language);
-
-      // Process excludes.
-      var excludes = analyzer[AnalyzerOptions.exclude];
-      setExcludes(context, excludes);
-    }
-  }
-
-  void setExcludes(AnalysisContext context, Object excludes) {
-    if (excludes is YamlList) {
-      List<String> excludeList = toStringList(excludes);
-      if (excludeList != null) {
-        AnalysisOptionsImpl options =
-            new AnalysisOptionsImpl.from(context.analysisOptions);
-        options.excludePatterns = excludeList;
-        context.analysisOptions = options;
-      }
-    }
-  }
-
-  void setLanguageOption(
-      AnalysisContext context, Object feature, Object value) {
-    if (feature == AnalyzerOptions.enableAssertInitializer) {
-      if (isTrue(value)) {
-        AnalysisOptionsImpl options =
-            new AnalysisOptionsImpl.from(context.analysisOptions);
-        options.enableAssertInitializer = true;
-        context.analysisOptions = options;
-      }
-    }
-    if (feature == AnalyzerOptions.enableStrictCallChecks) {
-      if (isTrue(value)) {
-        AnalysisOptionsImpl options =
-            new AnalysisOptionsImpl.from(context.analysisOptions);
-        options.enableStrictCallChecks = true;
-        context.analysisOptions = options;
-      }
-    }
-    if (feature == AnalyzerOptions.enableSuperMixins) {
-      if (isTrue(value)) {
-        AnalysisOptionsImpl options =
-            new AnalysisOptionsImpl.from(context.analysisOptions);
-        options.enableSuperMixins = true;
-        context.analysisOptions = options;
-      }
-    }
-  }
-
-  void setLanguageOptions(AnalysisContext context, Object configs) {
-    if (configs is YamlMap) {
-      configs.nodes.forEach((k, v) {
-        if (k is YamlScalar && v is YamlScalar) {
-          String feature = k.value?.toString();
-          setLanguageOption(context, feature, v.value);
-        }
-      });
-    } else if (configs is Map) {
-      configs.forEach((k, v) => setLanguageOption(context, k, v));
-    }
-  }
-
-  void setProcessors(AnalysisContext context, Object codes) {
-    ErrorConfig config = new ErrorConfig(codes);
-    AnalysisOptionsImpl options =
-        new AnalysisOptionsImpl.from(context.analysisOptions);
-    options.errorProcessors = config.processors;
-    context.analysisOptions = options;
-  }
-
-  void setStrongMode(AnalysisContext context, Object strongMode) {
-    if (strongMode is Map) {
-      AnalysisOptionsImpl options =
-          new AnalysisOptionsImpl.from(context.analysisOptions);
-      _applyStrongOptions(options, strongMode);
-      context.analysisOptions = options;
-    } else {
-      strongMode = strongMode is bool ? strongMode : false;
-      if (context.analysisOptions.strongMode != strongMode) {
-        AnalysisOptionsImpl options =
-            new AnalysisOptionsImpl.from(context.analysisOptions);
-        options.strongMode = strongMode;
-        context.analysisOptions = options;
+    LintConfig config = parseConfig(optionMap);
+    if (config != null) {
+      Iterable<LintRule> lintRules = Registry.ruleRegistry.enabled(config);
+      if (lintRules.isNotEmpty) {
+        options.lint = true;
+        options.lintRules = lintRules.toList();
       }
     }
   }
@@ -635,6 +537,8 @@
     if (boolValue != null) {
       if (feature == AnalyzerOptions.enableAssertInitializer) {
         options.enableAssertInitializer = boolValue;
+      } else if (feature == AnalyzerOptions.enableStrictCallChecks) {
+        options.enableStrictCallChecks = boolValue;
       } else if (feature == AnalyzerOptions.enableSuperMixins) {
         options.enableSuperMixins = boolValue;
       }
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index 4e2a092..491b50a 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -8,6 +8,7 @@
 
 import 'package:analyzer/analyzer.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart' show TokenType;
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
@@ -35,21 +36,13 @@
   DartType type = expression.staticType ?? DynamicTypeImpl.instance;
   if (typeSystem is StrongTypeSystemImpl &&
       type is FunctionType &&
-      _hasStrictArrow(expression)) {
+      hasStrictArrow(expression)) {
     // Remove fuzzy arrow if possible.
-    return typeSystem.functionTypeToConcreteType(typeProvider, type);
+    return typeSystem.functionTypeToConcreteType(type);
   }
   return type;
 }
 
-bool isKnownFunction(Expression expression) {
-  var element = _getKnownElement(expression);
-  // First class functions and static methods, where we know the original
-  // declaration, will have an exact type, so we know a downcast will fail.
-  return element is FunctionElement ||
-      element is MethodElement && element.isStatic;
-}
-
 DartType _elementType(Element e) {
   if (e == null) {
     // Malformed code - just return dynamic.
@@ -60,9 +53,10 @@
 
 Element _getKnownElement(Expression expression) {
   if (expression is ParenthesizedExpression) {
-    expression = (expression as ParenthesizedExpression).expression;
-  }
-  if (expression is FunctionExpression) {
+    return _getKnownElement(expression.expression);
+  } else if (expression is NamedExpression) {
+    return _getKnownElement(expression.expression);
+  } else if (expression is FunctionExpression) {
     return expression.element;
   } else if (expression is PropertyAccess) {
     return expression.propertyName.staticElement;
@@ -104,7 +98,7 @@
 FunctionType _getMemberType(InterfaceType type, ExecutableElement member) =>
     _memberTypeGetter(member)(type);
 
-bool _hasStrictArrow(Expression expression) {
+bool hasStrictArrow(Expression expression) {
   var element = _getKnownElement(expression);
   return element is FunctionElement || element is MethodElement;
 }
@@ -216,8 +210,8 @@
     }
   }
 
-  DartType getType(TypeName name) {
-    return (name == null) ? DynamicTypeImpl.instance : name.type;
+  DartType getType(TypeAnnotation type) {
+    return type?.type ?? DynamicTypeImpl.instance;
   }
 
   void reset() {
@@ -491,7 +485,7 @@
   void visitListLiteral(ListLiteral node) {
     DartType type = DynamicTypeImpl.instance;
     if (node.typeArguments != null) {
-      NodeList<TypeName> targs = node.typeArguments.arguments;
+      NodeList<TypeAnnotation> targs = node.typeArguments.arguments;
       if (targs.length > 0) {
         type = targs[0].type;
       }
@@ -516,7 +510,7 @@
     DartType ktype = DynamicTypeImpl.instance;
     DartType vtype = DynamicTypeImpl.instance;
     if (node.typeArguments != null) {
-      NodeList<TypeName> targs = node.typeArguments.arguments;
+      NodeList<TypeAnnotation> targs = node.typeArguments.arguments;
       if (targs.length > 0) {
         ktype = targs[0].type;
       }
@@ -602,7 +596,7 @@
   @override
   void visitRedirectingConstructorInvocation(
       RedirectingConstructorInvocation node) {
-    var type = node.staticElement?.type;
+    var type = resolutionMap.staticElementForConstructorReference(node)?.type;
     // TODO(leafp): There's a TODO in visitRedirectingConstructorInvocation
     // in the element_resolver to handle the case that the element is null
     // and emit an error.  In the meantime, just be defensive here.
@@ -622,7 +616,7 @@
   void visitSuperConstructorInvocation(SuperConstructorInvocation node) {
     var element = node.staticElement;
     if (element != null) {
-      var type = node.staticElement.type;
+      var type = resolutionMap.staticElementForConstructorReference(node).type;
       checkArgumentList(node.argumentList, type);
     }
     node.visitChildren(this);
@@ -639,21 +633,24 @@
 
   @override
   Object visitVariableDeclaration(VariableDeclaration node) {
+    VariableElement variableElement = node == null
+        ? null
+        : resolutionMap.elementDeclaredByVariableDeclaration(node);
     if (!node.isConst &&
         !node.isFinal &&
         node.initializer == null &&
-        rules.isNonNullableType(node?.element?.type)) {
+        rules.isNonNullableType(variableElement?.type)) {
       _recordMessage(
           node,
           StaticTypeWarningCode.NON_NULLABLE_FIELD_NOT_INITIALIZED,
-          [node.name, node?.element?.type]);
+          [node.name, variableElement?.type]);
     }
     return super.visitVariableDeclaration(node);
   }
 
   @override
   void visitVariableDeclarationList(VariableDeclarationList node) {
-    TypeName type = node.type;
+    TypeAnnotation type = node.type;
     if (type == null) {
       // No checks are needed when the type is var. Although internally the
       // typing rules may have inferred a more precise type for the variable
@@ -684,7 +681,7 @@
   void _checkCompoundAssignment(AssignmentExpression expr) {
     var op = expr.operator.type;
     assert(op.isAssignmentOperator && op != TokenType.EQ);
-    var methodElement = expr.staticElement;
+    var methodElement = resolutionMap.staticElementForMethodReference(expr);
     if (methodElement == null) {
       // Dynamic invocation.
       _recordDynamicInvoke(expr, expr.leftHandSide);
@@ -701,7 +698,7 @@
       var rhsType = _getDefiniteType(expr.rightHandSide);
       var lhsType = _getDefiniteType(expr.leftHandSide);
       var returnType = rules.refineBinaryExpressionType(
-          typeProvider, lhsType, op, rhsType, functionType.returnType);
+          lhsType, op, rhsType, functionType.returnType);
 
       // Check the argument for an implicit cast.
       _checkImplicitCast(expr.rightHandSide, paramTypes[0], from: rhsType);
@@ -719,55 +716,6 @@
     }
   }
 
-  /// Returns true if we need an implicit cast of [expr] from [from] type to
-  /// [to] type, otherwise returns false.
-  ///
-  /// If [from] is omitted, uses the static type of [expr].
-  bool _needsImplicitCast(Expression expr, DartType to, {DartType from}) {
-    from ??= _getDefiniteType(expr);
-
-    if (!_checkNonNullAssignment(expr, to, from)) return false;
-
-    // We can use anything as void.
-    if (to.isVoid) return false;
-
-    // fromT <: toT, no coercion needed.
-    if (rules.isSubtypeOf(from, to)) return false;
-
-    // Note: a function type is never assignable to a class per the Dart
-    // spec - even if it has a compatible call method.  We disallow as
-    // well for consistency.
-    if (from is FunctionType && rules.getCallMethodType(to) != null) {
-      return false;
-    }
-
-    // Downcast if toT <: fromT
-    if (rules.isSubtypeOf(to, from)) {
-      return true;
-    }
-
-    // Anything else is an illegal sideways cast.
-    // However, these will have been reported already in error_verifier, so we
-    // don't need to report them again.
-    return false;
-  }
-
-  /// Checks if an implicit cast of [expr] from [from] type to [to] type is
-  /// needed, and if so records it.
-  ///
-  /// If [from] is omitted, uses the static type of [expr].
-  ///
-  /// If [expr] does not require an implicit cast because it is not related to
-  /// [to] or is already a subtype of it, does nothing.
-  void _checkImplicitCast(Expression expr, DartType to,
-      {DartType from, bool opAssign: false}) {
-    from ??= _getDefiniteType(expr);
-
-    if (_needsImplicitCast(expr, to, from: from)) {
-      _recordImplicitCast(expr, to, from: from, opAssign: opAssign);
-    }
-  }
-
   void _checkFieldAccess(AstNode node, AstNode target, SimpleIdentifier field) {
     if (field.staticElement == null &&
         !typeProvider.isObjectMember(field.name)) {
@@ -786,7 +734,10 @@
     if (node.body is! BlockFunctionBody) {
       return;
     }
-    if (node.element.returnType.isDynamic) {
+    if (resolutionMap
+        .elementDeclaredByFunctionExpression(node)
+        .returnType
+        .isDynamic) {
       return;
     }
     // Find the enclosing variable declaration whose inferred type might depend
@@ -875,6 +826,22 @@
         [declElement.name]);
   }
 
+  /// Checks if an implicit cast of [expr] from [from] type to [to] type is
+  /// needed, and if so records it.
+  ///
+  /// If [from] is omitted, uses the static type of [expr].
+  ///
+  /// If [expr] does not require an implicit cast because it is not related to
+  /// [to] or is already a subtype of it, does nothing.
+  void _checkImplicitCast(Expression expr, DartType to,
+      {DartType from, bool opAssign: false}) {
+    from ??= _getDefiniteType(expr);
+
+    if (_needsImplicitCast(expr, to, from: from)) {
+      _recordImplicitCast(expr, to, from: from, opAssign: opAssign);
+    }
+  }
+
   /// Checks if the assignment is valid with respect to non-nullable types.
   /// Returns `false` if a nullable expression is assigned to a variable of
   /// non-nullable type and `true` otherwise.
@@ -902,8 +869,8 @@
     if (expression != null) checkAssignment(expression, type);
   }
 
-  void _checkRuntimeTypeCheck(AstNode node, TypeName typeName) {
-    var type = getType(typeName);
+  void _checkRuntimeTypeCheck(AstNode node, TypeAnnotation annotation) {
+    var type = getType(annotation);
     if (!rules.isGroundType(type)) {
       _recordMessage(node, StrongModeCode.NON_GROUND_TYPE_CHECK_INFO, [type]);
     }
@@ -927,8 +894,8 @@
         var functionType = element.type;
         var rhsType = typeProvider.intType;
         var lhsType = _getDefiniteType(operand);
-        var returnType = rules.refineBinaryExpressionType(typeProvider, lhsType,
-            TokenType.PLUS, rhsType, functionType.returnType);
+        var returnType = rules.refineBinaryExpressionType(
+            lhsType, TokenType.PLUS, rhsType, functionType.returnType);
 
         // Skip the argument check - `int` cannot be downcast.
         //
@@ -1011,7 +978,7 @@
     if (type is FunctionType) {
       return type;
     } else if (type is InterfaceType) {
-      return rules.getCallMethodType(type);
+      return rules.getCallMethodDefiniteType(type);
     }
     return null;
   }
@@ -1028,12 +995,45 @@
     // a dynamic parameter type requires a dynamic call in general.
     // However, as an optimization, if we have an original definition, we know
     // dynamic is reified as Object - in this case a regular call is fine.
-    if (_hasStrictArrow(call.function)) {
+    if (hasStrictArrow(call.function)) {
       return false;
     }
     return rules.anyParameterType(ft, (pt) => pt.isDynamic);
   }
 
+  /// Returns true if we need an implicit cast of [expr] from [from] type to
+  /// [to] type, otherwise returns false.
+  ///
+  /// If [from] is omitted, uses the static type of [expr].
+  bool _needsImplicitCast(Expression expr, DartType to, {DartType from}) {
+    from ??= _getDefiniteType(expr);
+
+    if (!_checkNonNullAssignment(expr, to, from)) return false;
+
+    // We can use anything as void.
+    if (to.isVoid) return false;
+
+    // fromT <: toT, no coercion needed.
+    if (rules.isSubtypeOf(from, to)) return false;
+
+    // Note: a function type is never assignable to a class per the Dart
+    // spec - even if it has a compatible call method.  We disallow as
+    // well for consistency.
+    if (from is FunctionType && rules.getCallMethodType(to) != null) {
+      return false;
+    }
+
+    // Downcast if toT <: fromT
+    if (rules.isSubtypeOf(to, from)) {
+      return true;
+    }
+
+    // Anything else is an illegal sideways cast.
+    // However, these will have been reported already in error_verifier, so we
+    // don't need to report them again.
+    return false;
+  }
+
   void _recordDynamicInvoke(AstNode node, Expression target) {
     _recordMessage(node, StrongModeCode.DYNAMIC_INVOKE, [node]);
     // TODO(jmesserly): we may eventually want to record if the whole operation
@@ -1083,8 +1083,8 @@
       }
     }
 
-    if (isKnownFunction(expr)) {
-      Element e = _getKnownElement(expr);
+    Element e = _getKnownElement(expr);
+    if (e is FunctionElement || e is MethodElement && e.isStatic) {
       _recordMessage(
           expr,
           e is MethodElement
@@ -1141,7 +1141,9 @@
           ? node.firstTokenAfterCommentAndMetadata.offset
           : node.offset;
       int length = node.end - begin;
-      var source = (node.root as CompilationUnit).element.source;
+      var source = resolutionMap
+          .elementDeclaredByCompilationUnit(node.root as CompilationUnit)
+          .source;
       var error =
           new AnalysisError(source, begin, length, errorCode, arguments);
       reporter.onError(error);
@@ -1161,7 +1163,8 @@
         rules = checker.rules;
 
   void check(ClassDeclaration node) {
-    if (node.element.type.isObject) return;
+    if (resolutionMap.elementDeclaredByClassDeclaration(node).type.isObject)
+      return;
     _checkSuperOverrides(node);
     _checkMixinApplicationOverrides(node);
     _checkAllInterfaceOverrides(node);
@@ -1197,7 +1200,7 @@
     // Check all interfaces reachable from the `implements` clause in the
     // current class against definitions here and in superclasses.
     var localInterfaces = new Set<InterfaceType>();
-    var type = node.element.type;
+    var type = resolutionMap.elementDeclaredByClassDeclaration(node).type;
     type.interfaces.forEach((i) => find(i, localInterfaces));
     _checkInterfacesOverrides(node, localInterfaces, seen,
         includeParents: true);
@@ -1254,7 +1257,7 @@
         if (member.isStatic) {
           continue;
         }
-        var method = member.element;
+        var method = resolutionMap.elementDeclaredByMethodDeclaration(member);
         if (seen.contains(method.name)) {
           continue;
         }
@@ -1310,7 +1313,9 @@
       bool includeParents: true,
       AstNode errorLocation}) {
     var node = cls is ClassDeclaration ? cls : null;
-    var type = cls is InterfaceType ? cls : node.element.type;
+    var type = cls is InterfaceType
+        ? cls
+        : resolutionMap.elementDeclaredByClassDeclaration(node).type;
 
     if (visited == null) {
       visited = new Set<InterfaceType>();
@@ -1365,7 +1370,7 @@
   ///      B & E against B (equivalently how E overrides B)
   ///      B & E & F against B & E (equivalently how F overrides both B and E)
   void _checkMixinApplicationOverrides(ClassDeclaration node) {
-    var type = node.element.type;
+    var type = resolutionMap.elementDeclaredByClassDeclaration(node).type;
     var parent = type.superclass;
     var mixins = type.mixins;
 
@@ -1434,15 +1439,7 @@
         ]);
       }
     }
-    FunctionType concreteSubType = subType;
-    FunctionType concreteBaseType = baseType;
-    if (concreteSubType.typeFormals.isNotEmpty) {
-      if (concreteBaseType.typeFormals.isEmpty) {
-        concreteSubType = rules.instantiateToBounds(concreteSubType);
-      }
-    }
-
-    if (!rules.isOverrideSubtypeOf(concreteSubType, concreteBaseType)) {
+    if (!rules.isOverrideSubtypeOf(subType, baseType)) {
       ErrorCode errorCode;
       if (errorLocation is ExtendsClause) {
         errorCode = StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_BASE;
@@ -1492,7 +1489,7 @@
   ///     }
   void _checkSuperOverrides(ClassDeclaration node) {
     var seen = new Set<String>();
-    var current = node.element.type;
+    var current = resolutionMap.elementDeclaredByClassDeclaration(node).type;
     var visited = new Set<InterfaceType>();
     do {
       visited.add(current);
diff --git a/pkg/analyzer/lib/src/task/strong_mode.dart b/pkg/analyzer/lib/src/task/strong_mode.dart
index 37c91cf..866d17b 100644
--- a/pkg/analyzer/lib/src/task/strong_mode.dart
+++ b/pkg/analyzer/lib/src/task/strong_mode.dart
@@ -79,23 +79,26 @@
   /**
    * Initialize a newly create inferrer.
    */
-  InstanceMemberInferrer(this.typeProvider, this.inheritanceManager,
+  InstanceMemberInferrer(TypeProvider typeProvider, this.inheritanceManager,
       {TypeSystem typeSystem})
-      : typeSystem = (typeSystem != null) ? typeSystem : new TypeSystemImpl();
+      : typeSystem = (typeSystem != null)
+            ? typeSystem
+            : new TypeSystemImpl(typeProvider),
+        this.typeProvider = typeProvider;
 
   /**
    * Infer type information for all of the instance members in the given
    * compilation [unit].
    */
   void inferCompilationUnit(CompilationUnitElement unit) {
-    unit.types.forEach((ClassElement classElement) {
+    for (ClassElement classElement in unit.types) {
       try {
         _inferClass(classElement);
       } on _CycleException {
         // This is a short circuit return to prevent types that inherit from
         // types containing a circular reference from being inferred.
       }
-    });
+    }
   }
 
   /**
@@ -365,7 +368,7 @@
           newType = fieldElement.initializer.returnType;
         }
       }
-      if (newType == null || newType.isBottom) {
+      if (newType == null || newType.isBottom || newType.isDartCoreNull) {
         newType = typeProvider.dynamicType;
       }
       setFieldType(fieldElement, newType);
diff --git a/pkg/analyzer/pubspec.yaml b/pkg/analyzer/pubspec.yaml
index eebe9df..5232709 100644
--- a/pkg/analyzer/pubspec.yaml
+++ b/pkg/analyzer/pubspec.yaml
@@ -8,6 +8,7 @@
 dependencies:
   args: '>=0.12.1 <0.14.0'
   charcode: ^1.1.0
+  collection: ^1.10.1
   crypto: '>=1.1.1 <3.0.0'
   front_end: 0.1.0-alpha.0
   glob: ^1.0.3
@@ -19,6 +20,7 @@
   plugin: ^0.2.0
   watcher: '>=0.9.6 <0.10.0'
   yaml: ^2.1.2
+  cli_util: ^0.0.1
 dev_dependencies:
   test_reflective_loader: ^0.1.0
   typed_mock: '>=0.0.4 <1.0.0'
diff --git a/pkg/analyzer/test/dart/ast/ast_test.dart b/pkg/analyzer/test/dart/ast/ast_test.dart
index 3a887f8..494cb07 100644
--- a/pkg/analyzer/test/dart/ast/ast_test.dart
+++ b/pkg/analyzer/test/dart/ast/ast_test.dart
@@ -5,6 +5,7 @@
 library analyzer.test.dart.ast.ast_test;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/src/dart/ast/token.dart';
 import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
@@ -365,7 +366,7 @@
     AstNode parent = AstTestFactory.argumentList();
     AstNode firstNode = AstTestFactory.booleanLiteral(true);
     AstNode secondNode = AstTestFactory.booleanLiteral(false);
-    NodeList<AstNode> list = new NodeList<AstNode>(parent);
+    NodeList<AstNode> list = astFactory.nodeList/*<AstNode>*/(parent);
     list.insert(0, secondNode);
     list.insert(0, firstNode);
     expect(list, hasLength(2));
@@ -386,7 +387,7 @@
 
   void test_add_negative() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     try {
       list.insert(-1, AstTestFactory.booleanLiteral(true));
       fail("Expected IndexOutOfBoundsException");
@@ -397,7 +398,7 @@
 
   void test_add_tooBig() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     try {
       list.insert(1, AstTestFactory.booleanLiteral(true));
       fail("Expected IndexOutOfBoundsException");
@@ -413,7 +414,7 @@
     AstNode secondNode = AstTestFactory.booleanLiteral(false);
     firstNodes.add(firstNode);
     firstNodes.add(secondNode);
-    NodeList<AstNode> list = new NodeList<AstNode>(parent);
+    NodeList<AstNode> list = astFactory.nodeList/*<AstNode>*/(parent);
     list.addAll(firstNodes);
     expect(list, hasLength(2));
     expect(list[0], same(firstNode));
@@ -439,7 +440,7 @@
 
   void test_creation() {
     AstNode owner = AstTestFactory.argumentList();
-    NodeList<AstNode> list = new NodeList<AstNode>(owner);
+    NodeList<AstNode> list = astFactory.nodeList/*<AstNode>*/(owner);
     expect(list, isNotNull);
     expect(list, hasLength(0));
     expect(list.owner, same(owner));
@@ -447,7 +448,7 @@
 
   void test_get_negative() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     try {
       list[-1];
       fail("Expected IndexOutOfBoundsException");
@@ -458,7 +459,7 @@
 
   void test_get_tooBig() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     try {
       list[1];
       fail("Expected IndexOutOfBoundsException");
@@ -469,13 +470,13 @@
 
   void test_getBeginToken_empty() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     expect(list.beginToken, isNull);
   }
 
   void test_getBeginToken_nonEmpty() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     AstNode node = AstTestFactory
         .parenthesizedExpression(AstTestFactory.booleanLiteral(true));
     list.add(node);
@@ -484,13 +485,13 @@
 
   void test_getEndToken_empty() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     expect(list.endToken, isNull);
   }
 
   void test_getEndToken_nonEmpty() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     AstNode node = AstTestFactory
         .parenthesizedExpression(AstTestFactory.booleanLiteral(true));
     list.add(node);
@@ -507,7 +508,7 @@
     nodes.add(secondNode);
     nodes.add(thirdNode);
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     list.addAll(nodes);
     expect(list, hasLength(3));
     expect(list.indexOf(firstNode), 0);
@@ -526,7 +527,7 @@
     nodes.add(secondNode);
     nodes.add(thirdNode);
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     list.addAll(nodes);
     expect(list, hasLength(3));
     expect(list.removeAt(1), same(secondNode));
@@ -537,7 +538,7 @@
 
   void test_remove_negative() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     try {
       list.removeAt(-1);
       fail("Expected IndexOutOfBoundsException");
@@ -548,7 +549,7 @@
 
   void test_remove_tooBig() {
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     try {
       list.removeAt(1);
       fail("Expected IndexOutOfBoundsException");
@@ -566,7 +567,7 @@
     nodes.add(secondNode);
     nodes.add(thirdNode);
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     list.addAll(nodes);
     expect(list, hasLength(3));
     AstNode fourthNode = AstTestFactory.integer(0);
@@ -580,7 +581,7 @@
   void test_set_negative() {
     AstNode node = AstTestFactory.booleanLiteral(true);
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     try {
       list[-1] = node;
       fail("Expected IndexOutOfBoundsException");
@@ -592,7 +593,7 @@
   void test_set_tooBig() {
     AstNode node = AstTestFactory.booleanLiteral(true);
     NodeList<AstNode> list =
-        new NodeList<AstNode>(AstTestFactory.argumentList());
+        astFactory.nodeList/*<AstNode>*/(AstTestFactory.argumentList());
     try {
       list[1] = node;
       fail("Expected IndexOutOfBoundsException");
@@ -795,47 +796,57 @@
 class SimpleStringLiteralTest extends ParserTestCase {
   void test_contentsEnd() {
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
             .contentsEnd,
         2);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString('"X"'), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString('"X"'), "X")
             .contentsEnd,
         2);
 
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString('"""X"""'), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString('"""X"""'), "X")
             .contentsEnd,
         4);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
             .contentsEnd,
         4);
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString("'''  \nX'''"), "X")
             .contentsEnd,
         7);
 
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
             .contentsEnd,
         3);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString('r"X"'), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString('r"X"'), "X")
             .contentsEnd,
         3);
 
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString('r"""X"""'), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString('r"""X"""'), "X")
             .contentsEnd,
         5);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
             .contentsEnd,
         5);
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString("r'''  \nX'''"), "X")
             .contentsEnd,
         8);
@@ -843,47 +854,57 @@
 
   void test_contentsOffset() {
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
             .contentsOffset,
         1);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
             .contentsOffset,
         1);
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString("\"\"\"X\"\"\""), "X")
             .contentsOffset,
         3);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
             .contentsOffset,
         3);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
             .contentsOffset,
         2);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
             .contentsOffset,
         2);
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString("r\"\"\"X\"\"\""), "X")
             .contentsOffset,
         4);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
             .contentsOffset,
         4);
     // leading whitespace
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString("''' \ \nX''"), "X")
             .contentsOffset,
         6);
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString('r""" \ \nX"""'), "X")
             .contentsOffset,
         7);
@@ -891,36 +912,44 @@
 
   void test_isMultiline() {
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
             .isMultiline,
         isFalse);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
             .isMultiline,
         isFalse);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
             .isMultiline,
         isFalse);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
             .isMultiline,
         isFalse);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
             .isMultiline,
         isTrue);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
             .isMultiline,
         isTrue);
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString("\"\"\"X\"\"\""), "X")
             .isMultiline,
         isTrue);
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString("r\"\"\"X\"\"\""), "X")
             .isMultiline,
         isTrue);
@@ -928,36 +957,45 @@
 
   void test_isRaw() {
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X").isRaw,
-        isFalse);
-    expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("'X'"), "X")
             .isRaw,
         isFalse);
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("\"X\""), "X")
+            .isRaw,
+        isFalse);
+    expect(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString("\"\"\"X\"\"\""), "X")
             .isRaw,
         isFalse);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("'''X'''"), "X")
             .isRaw,
         isFalse);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r'X'"), "X")
             .isRaw,
         isTrue);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r\"X\""), "X")
             .isRaw,
         isTrue);
     expect(
-        new SimpleStringLiteral(
+        astFactory
+            .simpleStringLiteral(
                 TokenFactory.tokenFromString("r\"\"\"X\"\"\""), "X")
             .isRaw,
         isTrue);
     expect(
-        new SimpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
+        astFactory
+            .simpleStringLiteral(TokenFactory.tokenFromString("r'''X'''"), "X")
             .isRaw,
         isTrue);
   }
@@ -966,25 +1004,25 @@
     // '
     {
       var token = TokenFactory.tokenFromString("'X'");
-      var node = new SimpleStringLiteral(token, null);
+      var node = astFactory.simpleStringLiteral(token, null);
       expect(node.isSingleQuoted, isTrue);
     }
     // '''
     {
       var token = TokenFactory.tokenFromString("'''X'''");
-      var node = new SimpleStringLiteral(token, null);
+      var node = astFactory.simpleStringLiteral(token, null);
       expect(node.isSingleQuoted, isTrue);
     }
     // "
     {
       var token = TokenFactory.tokenFromString('"X"');
-      var node = new SimpleStringLiteral(token, null);
+      var node = astFactory.simpleStringLiteral(token, null);
       expect(node.isSingleQuoted, isFalse);
     }
     // """
     {
       var token = TokenFactory.tokenFromString('"""X"""');
-      var node = new SimpleStringLiteral(token, null);
+      var node = astFactory.simpleStringLiteral(token, null);
       expect(node.isSingleQuoted, isFalse);
     }
   }
@@ -993,32 +1031,33 @@
     // r'
     {
       var token = TokenFactory.tokenFromString("r'X'");
-      var node = new SimpleStringLiteral(token, null);
+      var node = astFactory.simpleStringLiteral(token, null);
       expect(node.isSingleQuoted, isTrue);
     }
     // r'''
     {
       var token = TokenFactory.tokenFromString("r'''X'''");
-      var node = new SimpleStringLiteral(token, null);
+      var node = astFactory.simpleStringLiteral(token, null);
       expect(node.isSingleQuoted, isTrue);
     }
     // r"
     {
       var token = TokenFactory.tokenFromString('r"X"');
-      var node = new SimpleStringLiteral(token, null);
+      var node = astFactory.simpleStringLiteral(token, null);
       expect(node.isSingleQuoted, isFalse);
     }
     // r"""
     {
       var token = TokenFactory.tokenFromString('r"""X"""');
-      var node = new SimpleStringLiteral(token, null);
+      var node = astFactory.simpleStringLiteral(token, null);
       expect(node.isSingleQuoted, isFalse);
     }
   }
 
   void test_simple() {
     Token token = TokenFactory.tokenFromString("'value'");
-    SimpleStringLiteral stringLiteral = new SimpleStringLiteral(token, "value");
+    SimpleStringLiteral stringLiteral =
+        astFactory.simpleStringLiteral(token, "value");
     expect(stringLiteral.literal, same(token));
     expect(stringLiteral.beginToken, same(token));
     expect(stringLiteral.endToken, same(token));
@@ -1034,7 +1073,7 @@
     {
       var ae = AstTestFactory.interpolationString("'a", "a");
       var cToken = new StringToken(TokenType.STRING, "ccc'", 10);
-      var cElement = new InterpolationString(cToken, 'ccc');
+      var cElement = astFactory.interpolationString(cToken, 'ccc');
       StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
       expect(node.contentsOffset, 1);
       expect(node.contentsEnd, 10 + 4 - 1);
@@ -1043,7 +1082,7 @@
     {
       var ae = AstTestFactory.interpolationString("'''a", "a");
       var cToken = new StringToken(TokenType.STRING, "ccc'''", 10);
-      var cElement = new InterpolationString(cToken, 'ccc');
+      var cElement = astFactory.interpolationString(cToken, 'ccc');
       StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
       expect(node.contentsOffset, 3);
       expect(node.contentsEnd, 10 + 4 - 1);
@@ -1052,7 +1091,7 @@
     {
       var ae = AstTestFactory.interpolationString('"""a', "a");
       var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10);
-      var cElement = new InterpolationString(cToken, 'ccc');
+      var cElement = astFactory.interpolationString(cToken, 'ccc');
       StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
       expect(node.contentsOffset, 3);
       expect(node.contentsEnd, 10 + 4 - 1);
@@ -1061,7 +1100,7 @@
     {
       var ae = AstTestFactory.interpolationString("r'a", "a");
       var cToken = new StringToken(TokenType.STRING, "ccc'", 10);
-      var cElement = new InterpolationString(cToken, 'ccc');
+      var cElement = astFactory.interpolationString(cToken, 'ccc');
       StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
       expect(node.contentsOffset, 2);
       expect(node.contentsEnd, 10 + 4 - 1);
@@ -1070,7 +1109,7 @@
     {
       var ae = AstTestFactory.interpolationString("r'''a", "a");
       var cToken = new StringToken(TokenType.STRING, "ccc'''", 10);
-      var cElement = new InterpolationString(cToken, 'ccc');
+      var cElement = astFactory.interpolationString(cToken, 'ccc');
       StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
       expect(node.contentsOffset, 4);
       expect(node.contentsEnd, 10 + 4 - 1);
@@ -1079,7 +1118,7 @@
     {
       var ae = AstTestFactory.interpolationString('r"""a', "a");
       var cToken = new StringToken(TokenType.STRING, 'ccc"""', 10);
-      var cElement = new InterpolationString(cToken, 'ccc');
+      var cElement = astFactory.interpolationString(cToken, 'ccc');
       StringInterpolation node = AstTestFactory.string([ae, ae, cElement]);
       expect(node.contentsOffset, 4);
       expect(node.contentsEnd, 10 + 4 - 1);
@@ -1164,7 +1203,7 @@
     VariableDeclaration varDecl = AstTestFactory.variableDeclaration("a");
     TopLevelVariableDeclaration decl =
         AstTestFactory.topLevelVariableDeclaration2(Keyword.VAR, [varDecl]);
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
     expect(varDecl.documentationComment, isNull);
     decl.documentationComment = comment;
     expect(varDecl.documentationComment, isNotNull);
@@ -1173,7 +1212,7 @@
 
   void test_getDocumentationComment_onNode() {
     VariableDeclaration decl = AstTestFactory.variableDeclaration("a");
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
     decl.documentationComment = comment;
     expect(decl.documentationComment, isNotNull);
   }
diff --git a/pkg/analyzer/test/dart/element/builder_test.dart b/pkg/analyzer/test/dart/element/builder_test.dart
index c9b22c9..b441823 100644
--- a/pkg/analyzer/test/dart/element/builder_test.dart
+++ b/pkg/analyzer/test/dart/element/builder_test.dart
@@ -5,6 +5,7 @@
 library analyzer.test.dart.element.builder_test;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/dart/ast/ast.dart';
@@ -251,7 +252,7 @@
     TopLevelVariableDeclaration topLevelVariableDeclaration = AstTestFactory
         .topLevelVariableDeclaration(null, AstTestFactory.typeName4('int'),
             [AstTestFactory.variableDeclaration('V')]);
-    CompilationUnit unit = new CompilationUnit(
+    CompilationUnit unit = astFactory.compilationUnit(
         topLevelVariableDeclaration.beginToken,
         null,
         [],
@@ -446,6 +447,30 @@
     _assertVisibleRange(parameter, 100, 110);
   }
 
+  void test_visitFunctionTypedFormalParameter_covariant() {
+    ElementHolder holder = new ElementHolder();
+    ElementBuilder builder = _makeBuilder(holder);
+    String parameterName = "p";
+    FunctionTypedFormalParameterImpl formalParameter =
+        AstTestFactory.functionTypedFormalParameter(null, parameterName);
+    formalParameter.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _useParameterInMethod(formalParameter, 100, 110);
+    formalParameter.accept(builder);
+    List<ParameterElement> parameters = holder.parameters;
+    expect(parameters, hasLength(1));
+    ParameterElementImpl parameter = parameters[0];
+    expect(parameter, isNotNull);
+    expect(parameter.name, parameterName);
+    expect(parameter.initializer, isNull);
+    expect(parameter.isConst, isFalse);
+    expect(parameter.isExplicitlyCovariant, isTrue);
+    expect(parameter.isFinal, isFalse);
+    expect(parameter.isSynthetic, isFalse);
+    expect(parameter.parameterKind, ParameterKind.REQUIRED);
+    _assertVisibleRange(parameter, 100, 110);
+  }
+
   void test_visitFunctionTypedFormalParameter_withTypeParameters() {
     ElementHolder holder = new ElementHolder();
     ElementBuilder builder = _makeBuilder(holder);
@@ -551,6 +576,39 @@
     expect(initializer.hasImplicitReturnType, isTrue);
   }
 
+  void test_visitNamedFormalParameter_covariant() {
+    ElementHolder holder = new ElementHolder();
+    ElementBuilder builder = _makeBuilder(holder);
+    String parameterName = "p";
+    DefaultFormalParameter formalParameter =
+        AstTestFactory.namedFormalParameter(
+            AstTestFactory.simpleFormalParameter3(parameterName),
+            AstTestFactory.identifier3("42"));
+    (formalParameter.parameter as NormalFormalParameterImpl).covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _useParameterInMethod(formalParameter, 100, 110);
+    formalParameter.beginToken.offset = 50;
+    formalParameter.endToken.offset = 80;
+    formalParameter.accept(builder);
+    List<ParameterElement> parameters = holder.parameters;
+    expect(parameters, hasLength(1));
+    ParameterElementImpl parameter = parameters[0];
+    expect(parameter, isNotNull);
+    assertHasCodeRange(parameter, 50, 32);
+    expect(parameter.name, parameterName);
+    expect(parameter.isConst, isFalse);
+    expect(parameter.isExplicitlyCovariant, isTrue);
+    expect(parameter.isFinal, isFalse);
+    expect(parameter.isSynthetic, isFalse);
+    expect(parameter.parameterKind, ParameterKind.NAMED);
+    _assertVisibleRange(parameter, 100, 110);
+    expect(parameter.defaultValueCode, "42");
+    FunctionElement initializer = parameter.initializer;
+    expect(initializer, isNotNull);
+    expect(initializer.isSynthetic, isTrue);
+    expect(initializer.hasImplicitReturnType, isTrue);
+  }
+
   void test_visitSimpleFormalParameter_noType() {
     // p
     ElementHolder holder = new ElementHolder();
@@ -574,6 +632,32 @@
     _assertVisibleRange(parameter, 100, 110);
   }
 
+  void test_visitSimpleFormalParameter_noType_covariant() {
+    // p
+    ElementHolder holder = new ElementHolder();
+    ElementBuilder builder = _makeBuilder(holder);
+    String parameterName = "p";
+    SimpleFormalParameterImpl formalParameter =
+        AstTestFactory.simpleFormalParameter3(parameterName);
+    formalParameter.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _useParameterInMethod(formalParameter, 100, 110);
+    formalParameter.accept(builder);
+    List<ParameterElement> parameters = holder.parameters;
+    expect(parameters, hasLength(1));
+    ParameterElementImpl parameter = parameters[0];
+    expect(parameter, isNotNull);
+    expect(parameter.hasImplicitType, isTrue);
+    expect(parameter.initializer, isNull);
+    expect(parameter.isConst, isFalse);
+    expect(parameter.isExplicitlyCovariant, isTrue);
+    expect(parameter.isFinal, isFalse);
+    expect(parameter.isSynthetic, isFalse);
+    expect(parameter.name, parameterName);
+    expect(parameter.parameterKind, ParameterKind.REQUIRED);
+    _assertVisibleRange(parameter, 100, 110);
+  }
+
   void test_visitSimpleFormalParameter_type() {
     // T p
     ElementHolder holder = new ElementHolder();
@@ -597,6 +681,57 @@
     _assertVisibleRange(parameter, 100, 110);
   }
 
+  void test_visitSimpleFormalParameter_type_covariant() {
+    // T p
+    ElementHolder holder = new ElementHolder();
+    ElementBuilder builder = _makeBuilder(holder);
+    String parameterName = "p";
+    SimpleFormalParameterImpl formalParameter = AstTestFactory
+        .simpleFormalParameter4(AstTestFactory.typeName4('T'), parameterName);
+    formalParameter.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _useParameterInMethod(formalParameter, 100, 110);
+    formalParameter.accept(builder);
+    List<ParameterElement> parameters = holder.parameters;
+    expect(parameters, hasLength(1));
+    ParameterElementImpl parameter = parameters[0];
+    expect(parameter, isNotNull);
+    expect(parameter.hasImplicitType, isFalse);
+    expect(parameter.initializer, isNull);
+    expect(parameter.isConst, isFalse);
+    expect(parameter.isExplicitlyCovariant, isTrue);
+    expect(parameter.isFinal, isFalse);
+    expect(parameter.isSynthetic, isFalse);
+    expect(parameter.name, parameterName);
+    expect(parameter.parameterKind, ParameterKind.REQUIRED);
+    _assertVisibleRange(parameter, 100, 110);
+  }
+
+  void test_visitVariableDeclaration_field_covariant() {
+    // covariant int f;
+    ElementHolder holder = new ElementHolder();
+    ElementBuilder builder = _makeBuilder(holder);
+    String fieldName = "f";
+    VariableDeclarationImpl variableDeclaration =
+        AstTestFactory.variableDeclaration2(fieldName, null);
+    FieldDeclarationImpl fieldDeclaration = AstTestFactory.fieldDeclaration(
+        false,
+        null,
+        AstTestFactory.typeName4('int'),
+        <VariableDeclaration>[variableDeclaration]);
+    fieldDeclaration.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    variableDeclaration.accept(builder);
+
+    List<FieldElement> fields = holder.fields;
+    expect(fields, hasLength(1));
+    FieldElementImpl field = fields[0];
+    expect(field, isNotNull);
+    PropertyAccessorElementImpl setter = field.setter;
+    expect(setter, isNotNull);
+    expect(setter.parameters[0].isCovariant, isTrue);
+  }
+
   void test_visitVariableDeclaration_inConstructor() {
     List<ConstructorElement> constructors =
         buildElementsForText('class C { C() { var v = 1; } }')
@@ -1093,8 +1228,9 @@
   void
       test_metadata_visitDefaultFormalParameter_functionTypedFormalParameter() {
     ParameterElement parameterElement =
-        buildElementsForText('f([@a g() = null]) {}').functions[0].parameters[
-            0];
+        buildElementsForText('f([@a g() = null]) {}')
+            .functions[0]
+            .parameters[0];
     checkMetadata(parameterElement);
   }
 
diff --git a/pkg/analyzer/test/dart/test_all.dart b/pkg/analyzer/test/dart/test_all.dart
index 7827a63..b1276fe 100644
--- a/pkg/analyzer/test/dart/test_all.dart
+++ b/pkg/analyzer/test/dart/test_all.dart
@@ -2,7 +2,7 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-library analyzer.test.generated.test_all;
+library analyzer.test.dart.test_all;
 
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index 6229305..5f11129 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -4,6 +4,8 @@
 
 library analyzer.test.generated.all_the_rest_test;
 
+import 'dart:async';
+
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -36,6 +38,7 @@
 import 'package:source_span/source_span.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
+import 'package:typed_mock/typed_mock.dart' show TypedMock, when;
 
 import 'parser_test.dart';
 import 'resolver_test_case.dart';
@@ -65,35 +68,9 @@
   });
 }
 
-/**
- * Create a tiny mock SDK for use in URI resolution tests.
- */
-DartSdk _createSdk() {
-  MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
-  String sdkFolderName =
-      resourceProvider.pathContext.separator == '/' ? '/sdk' : r'C:\sdk';
-  Folder sdkFolder = resourceProvider.newFolder(sdkFolderName);
-  expect(sdkFolder, isNotNull);
-  resourceProvider.newFile(
-      resourceProvider.pathContext.join(sdkFolderName, 'lib', '_internal',
-          'sdk_library_metadata', 'lib', 'libraries.dart'),
-      '''
-const Map<String, LibraryInfo> libraries = const {
-  "core": const LibraryInfo("core/core.dart")
-};
-''');
-  resourceProvider.newFile(
-      resourceProvider.pathContext
-          .join(sdkFolderName, 'lib', 'core', 'core.dart'),
-      '''
-library dart.core;
-''');
-  return new FolderBasedDartSdk(resourceProvider, sdkFolder);
-}
-
 @reflectiveTest
 class ContentCacheTest {
-  void test_setContents() {
+  test_setContents() async {
     Source source = new TestSource();
     ContentCache cache = new ContentCache();
     expect(cache.getContents(source), isNull);
@@ -138,9 +115,16 @@
 }
 
 @reflectiveTest
-class DartUriResolverTest {
+class DartUriResolverTest extends _SimpleDartSdkTest {
+  DartUriResolver resolver;
+
+  @override
+  setUp() {
+    super.setUp();
+    resolver = new DartUriResolver(sdk);
+  }
+
   void test_creation() {
-    DartSdk sdk = _createSdk();
     expect(new DartUriResolver(sdk), isNotNull);
   }
 
@@ -150,27 +134,42 @@
     expect(DartUriResolver.isDartUri(uri), isFalse);
   }
 
-  void test_resolve_dart() {
-    DartSdk sdk = _createSdk();
-    UriResolver resolver = new DartUriResolver(sdk);
-    Source result = resolver.resolveAbsolute(Uri.parse("dart:core"));
-    expect(result, isNotNull);
+  void test_resolve_dart_library() {
+    Source source = resolver.resolveAbsolute(Uri.parse('dart:core'));
+    expect(source, isNotNull);
   }
 
   void test_resolve_dart_nonExistingLibrary() {
-    DartSdk sdk = _createSdk();
-    UriResolver resolver = new DartUriResolver(sdk);
     Source result = resolver.resolveAbsolute(Uri.parse("dart:cor"));
     expect(result, isNull);
   }
 
+  void test_resolve_dart_part() {
+    Source source = resolver.resolveAbsolute(Uri.parse('dart:core/int.dart'));
+    expect(source, isNotNull);
+  }
+
   void test_resolve_nonDart() {
-    DartSdk sdk = _createSdk();
-    UriResolver resolver = new DartUriResolver(sdk);
     Source result =
         resolver.resolveAbsolute(Uri.parse("package:some/file.dart"));
     expect(result, isNull);
   }
+
+  void test_restoreAbsolute_library() {
+    Source source = new _SourceMock();
+    Uri fileUri = resourceProvider.pathContext.toUri(coreCorePath);
+    when(source.uri).thenReturn(fileUri);
+    Uri dartUri = resolver.restoreAbsolute(source);
+    expect(dartUri.toString(), 'dart:core');
+  }
+
+  void test_restoreAbsolute_part() {
+    Source source = new _SourceMock();
+    Uri fileUri = resourceProvider.pathContext.toUri(coreIntPath);
+    when(source.uri).thenReturn(fileUri);
+    Uri dartUri = resolver.restoreAbsolute(source);
+    expect(dartUri.toString(), 'dart:core/int.dart');
+  }
 }
 
 @deprecated
@@ -363,11 +362,11 @@
   void reset() {
     AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
     analysisOptions.hint = false;
-    resetWithOptions(analysisOptions);
+    resetWith(options: analysisOptions);
   }
 
-  void test_locate_AssignmentExpression() {
-    AstNode id = _findNodeIn(
+  test_locate_AssignmentExpression() async {
+    AstNode id = await _findNodeIn(
         "+=",
         r'''
 int x = 0;
@@ -379,29 +378,29 @@
         (obj) => obj is MethodElement, MethodElement, element);
   }
 
-  void test_locate_BinaryExpression() {
-    AstNode id = _findNodeIn("+", "var x = 3 + 4;");
+  test_locate_BinaryExpression() async {
+    AstNode id = await _findNodeIn("+", "var x = 3 + 4;");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is MethodElement, MethodElement, element);
   }
 
-  void test_locate_ClassDeclaration() {
-    AstNode id = _findNodeIn("class", "class A { }");
+  test_locate_ClassDeclaration() async {
+    AstNode id = await _findNodeIn("class", "class A { }");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is ClassElement, ClassElement, element);
   }
 
-  void test_locate_CompilationUnit() {
-    CompilationUnit cu = _resolveContents("// only comment");
+  test_locate_CompilationUnit() async {
+    CompilationUnit cu = await _resolveContents("// only comment");
     expect(cu.element, isNotNull);
     Element element = ElementLocator.locate(cu);
     expect(element, same(cu.element));
   }
 
-  void test_locate_ConstructorDeclaration() {
-    AstNode id = _findNodeIndexedIn(
+  test_locate_ConstructorDeclaration() async {
+    AstNode id = await _findNodeIndexedIn(
         "bar",
         0,
         r'''
@@ -415,15 +414,15 @@
         (obj) => obj is ConstructorElement, ConstructorElement, element);
   }
 
-  void test_locate_ExportDirective() {
-    AstNode id = _findNodeIn("export", "export 'dart:core';");
+  test_locate_ExportDirective() async {
+    AstNode id = await _findNodeIn("export", "export 'dart:core';");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is ExportElement, ExportElement, element);
   }
 
-  void test_locate_FunctionDeclaration() {
-    AstNode id = _findNodeIn("f", "int f() => 3;");
+  test_locate_FunctionDeclaration() async {
+    AstNode id = await _findNodeIn("f", "int f() => 3;");
     FunctionDeclaration declaration =
         id.getAncestor((node) => node is FunctionDeclaration);
     Element element = ElementLocator.locate(declaration);
@@ -431,9 +430,8 @@
         (obj) => obj is FunctionElement, FunctionElement, element);
   }
 
-  void
-      test_locate_Identifier_annotationClass_namedConstructor_forSimpleFormalParameter() {
-    AstNode id = _findNodeIndexedIn(
+  test_locate_Identifier_annotationClass_namedConstructor_forSimpleFormalParameter() async {
+    AstNode id = await _findNodeIndexedIn(
         "Class",
         2,
         r'''
@@ -447,9 +445,8 @@
         (obj) => obj is ClassElement, ClassElement, element);
   }
 
-  void
-      test_locate_Identifier_annotationClass_unnamedConstructor_forSimpleFormalParameter() {
-    AstNode id = _findNodeIndexedIn(
+  test_locate_Identifier_annotationClass_unnamedConstructor_forSimpleFormalParameter() async {
+    AstNode id = await _findNodeIndexedIn(
         "Class",
         2,
         r'''
@@ -463,15 +460,15 @@
         (obj) => obj is ConstructorElement, ConstructorElement, element);
   }
 
-  void test_locate_Identifier_className() {
-    AstNode id = _findNodeIn("A", "class A { }");
+  test_locate_Identifier_className() async {
+    AstNode id = await _findNodeIn("A", "class A { }");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is ClassElement, ClassElement, element);
   }
 
-  void test_locate_Identifier_constructor_named() {
-    AstNode id = _findNodeIndexedIn(
+  test_locate_Identifier_constructor_named() async {
+    AstNode id = await _findNodeIndexedIn(
         "bar",
         0,
         r'''
@@ -483,8 +480,8 @@
         (obj) => obj is ConstructorElement, ConstructorElement, element);
   }
 
-  void test_locate_Identifier_constructor_unnamed() {
-    AstNode id = _findNodeIndexedIn(
+  test_locate_Identifier_constructor_unnamed() async {
+    AstNode id = await _findNodeIndexedIn(
         "A",
         1,
         r'''
@@ -496,22 +493,22 @@
         (obj) => obj is ConstructorElement, ConstructorElement, element);
   }
 
-  void test_locate_Identifier_fieldName() {
-    AstNode id = _findNodeIn("x", "class A { var x; }");
+  test_locate_Identifier_fieldName() async {
+    AstNode id = await _findNodeIn("x", "class A { var x; }");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is FieldElement, FieldElement, element);
   }
 
-  void test_locate_Identifier_libraryDirective() {
-    AstNode id = _findNodeIn("foo", "library foo.bar;");
+  test_locate_Identifier_libraryDirective() async {
+    AstNode id = await _findNodeIn("foo", "library foo.bar;");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is LibraryElement, LibraryElement, element);
   }
 
-  void test_locate_Identifier_propertyAccess() {
-    AstNode id = _findNodeIn(
+  test_locate_Identifier_propertyAccess() async {
+    AstNode id = await _findNodeIn(
         "length",
         r'''
 void main() {
@@ -522,15 +519,15 @@
         PropertyAccessorElement, element);
   }
 
-  void test_locate_ImportDirective() {
-    AstNode id = _findNodeIn("import", "import 'dart:core';");
+  test_locate_ImportDirective() async {
+    AstNode id = await _findNodeIn("import", "import 'dart:core';");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is ImportElement, ImportElement, element);
   }
 
-  void test_locate_IndexExpression() {
-    AstNode id = _findNodeIndexedIn(
+  test_locate_IndexExpression() async {
+    AstNode id = await _findNodeIndexedIn(
         "\\[",
         1,
         r'''
@@ -543,8 +540,8 @@
         (obj) => obj is MethodElement, MethodElement, element);
   }
 
-  void test_locate_InstanceCreationExpression() {
-    AstNode node = _findNodeIndexedIn(
+  test_locate_InstanceCreationExpression() async {
+    AstNode node = await _findNodeIndexedIn(
         "A(",
         0,
         r'''
@@ -557,7 +554,7 @@
         (obj) => obj is ConstructorElement, ConstructorElement, element);
   }
 
-  void test_locate_InstanceCreationExpression_type_prefixedIdentifier() {
+  test_locate_InstanceCreationExpression_type_prefixedIdentifier() async {
     // prepare: new pref.A()
     SimpleIdentifier identifier = AstTestFactory.identifier3("A");
     PrefixedIdentifier prefixedIdentifier =
@@ -577,7 +574,7 @@
     expect(element, same(classElement));
   }
 
-  void test_locate_InstanceCreationExpression_type_simpleIdentifier() {
+  test_locate_InstanceCreationExpression_type_simpleIdentifier() async {
     // prepare: new A()
     SimpleIdentifier identifier = AstTestFactory.identifier3("A");
     InstanceCreationExpression creation =
@@ -595,15 +592,15 @@
     expect(element, same(classElement));
   }
 
-  void test_locate_LibraryDirective() {
-    AstNode id = _findNodeIn("library", "library foo;");
+  test_locate_LibraryDirective() async {
+    AstNode id = await _findNodeIn("library", "library foo;");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is LibraryElement, LibraryElement, element);
   }
 
-  void test_locate_MethodDeclaration() {
-    AstNode id = _findNodeIn(
+  test_locate_MethodDeclaration() async {
+    AstNode id = await _findNodeIn(
         "m",
         r'''
 class A {
@@ -616,8 +613,8 @@
         (obj) => obj is MethodElement, MethodElement, element);
   }
 
-  void test_locate_MethodInvocation_method() {
-    AstNode id = _findNodeIndexedIn(
+  test_locate_MethodInvocation_method() async {
+    AstNode id = await _findNodeIndexedIn(
         "bar",
         1,
         r'''
@@ -632,13 +629,13 @@
         (obj) => obj is MethodElement, MethodElement, element);
   }
 
-  void test_locate_MethodInvocation_topLevel() {
+  test_locate_MethodInvocation_topLevel() async {
     String code = r'''
 foo(x) {}
 void main() {
  foo(0);
 }''';
-    CompilationUnit cu = _resolveContents(code);
+    CompilationUnit cu = await _resolveContents(code);
     int offset = code.indexOf('foo(0)');
     AstNode node = new NodeLocator(offset).searchWithin(cu);
     MethodInvocation invocation =
@@ -648,7 +645,7 @@
         (obj) => obj is FunctionElement, FunctionElement, element);
   }
 
-  void test_locate_PartOfDirective() {
+  test_locate_PartOfDirective() async {
     Source librarySource = addNamedSource(
         '/lib.dart',
         '''
@@ -668,15 +665,15 @@
         (obj) => obj is LibraryElement, LibraryElement, element);
   }
 
-  void test_locate_PostfixExpression() {
-    AstNode id = _findNodeIn("++", "int addOne(int x) => x++;");
+  test_locate_PostfixExpression() async {
+    AstNode id = await _findNodeIn("++", "int addOne(int x) => x++;");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is MethodElement, MethodElement, element);
   }
 
-  void test_locate_PrefixedIdentifier() {
-    AstNode id = _findNodeIn(
+  test_locate_PrefixedIdentifier() async {
+    AstNode id = await _findNodeIn(
         "int",
         r'''
 import 'dart:core' as core;
@@ -688,46 +685,47 @@
         (obj) => obj is ClassElement, ClassElement, element);
   }
 
-  void test_locate_PrefixExpression() {
-    AstNode id = _findNodeIn("++", "int addOne(int x) => ++x;");
+  test_locate_PrefixExpression() async {
+    AstNode id = await _findNodeIn("++", "int addOne(int x) => ++x;");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is MethodElement, MethodElement, element);
   }
 
-  void test_locate_StringLiteral_exportUri() {
+  test_locate_StringLiteral_exportUri() async {
     addNamedSource("/foo.dart", "library foo;");
-    AstNode id = _findNodeIn("'foo.dart'", "export 'foo.dart';");
+    AstNode id = await _findNodeIn("'foo.dart'", "export 'foo.dart';");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is LibraryElement, LibraryElement, element);
   }
 
-  void test_locate_StringLiteral_expression() {
-    AstNode id = _findNodeIn("abc", "var x = 'abc';");
+  test_locate_StringLiteral_expression() async {
+    AstNode id = await _findNodeIn("abc", "var x = 'abc';");
     Element element = ElementLocator.locate(id);
     expect(element, isNull);
   }
 
-  void test_locate_StringLiteral_importUri() {
+  test_locate_StringLiteral_importUri() async {
     addNamedSource("/foo.dart", "library foo; class A {}");
-    AstNode id =
-        _findNodeIn("'foo.dart'", "import 'foo.dart'; class B extends A {}");
+    AstNode id = await _findNodeIn(
+        "'foo.dart'", "import 'foo.dart'; class B extends A {}");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf(
         (obj) => obj is LibraryElement, LibraryElement, element);
   }
 
-  void test_locate_StringLiteral_partUri() {
+  test_locate_StringLiteral_partUri() async {
     addNamedSource("/foo.dart", "part of app;");
-    AstNode id = _findNodeIn("'foo.dart'", "library app; part 'foo.dart';");
+    AstNode id =
+        await _findNodeIn("'foo.dart'", "library app; part 'foo.dart';");
     Element element = ElementLocator.locate(id);
     EngineTestCase.assertInstanceOf((obj) => obj is CompilationUnitElement,
         CompilationUnitElement, element);
   }
 
-  void test_locate_VariableDeclaration() {
-    AstNode id = _findNodeIn("x", "var x = 'abc';");
+  test_locate_VariableDeclaration() async {
+    AstNode id = await _findNodeIn("x", "var x = 'abc';");
     VariableDeclaration declaration =
         id.getAncestor((node) => node is VariableDeclaration);
     Element element = ElementLocator.locate(declaration);
@@ -742,8 +740,8 @@
    * [code] the code to resolve.
    * Returns the matched node in the resolved AST for the given source lines.
    */
-  AstNode _findNodeIn(String nodePattern, String code) {
-    return _findNodeIndexedIn(nodePattern, 0, code);
+  Future<AstNode> _findNodeIn(String nodePattern, String code) async {
+    return await _findNodeIndexedIn(nodePattern, 0, code);
   }
 
   /**
@@ -755,8 +753,9 @@
    * [code] the code to resolve.
    * Returns the matched node in the resolved AST for the given source lines
    */
-  AstNode _findNodeIndexedIn(String nodePattern, int index, String code) {
-    CompilationUnit cu = _resolveContents(code);
+  Future<AstNode> _findNodeIndexedIn(
+      String nodePattern, int index, String code) async {
+    CompilationUnit cu = await _resolveContents(code);
     int start = _getOffsetOfMatch(code, nodePattern, index);
     int end = start + nodePattern.length;
     return new NodeLocator(start, end).searchWithin(cu);
@@ -782,9 +781,10 @@
    *
    * Throws if source cannot be verified.
    */
-  CompilationUnit _resolveContents(String code) {
+  Future<CompilationUnit> _resolveContents(String code) async {
     Source source = addSource(code);
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     return analysisContext.resolveCompilationUnit(source, library);
@@ -793,7 +793,7 @@
 
 @reflectiveTest
 class EnumMemberBuilderTest extends EngineTestCase {
-  void test_visitEnumDeclaration_multiple() {
+  test_visitEnumDeclaration_multiple() async {
     String firstName = "ONE";
     String secondName = "TWO";
     String thirdName = "THREE";
@@ -826,7 +826,7 @@
     _assertGetter(constant);
   }
 
-  void test_visitEnumDeclaration_single() {
+  test_visitEnumDeclaration_single() async {
     String firstName = "ONE";
     EnumDeclaration enumDeclaration =
         AstTestFactory.enumDeclaration2("E", [firstName]);
@@ -901,13 +901,13 @@
     return element.type;
   }
 
-  void test_creation() {
+  test_creation() async {
     GatheringErrorListener listener = new GatheringErrorListener();
     TestSource source = new TestSource();
     expect(new ErrorReporter(listener, source), isNotNull);
   }
 
-  void test_reportErrorForElement_named() {
+  test_reportErrorForElement_named() async {
     DartType type = createType("/test1.dart", "A");
     ClassElement element = type.element;
     GatheringErrorListener listener = new GatheringErrorListener();
@@ -920,7 +920,7 @@
     expect(error.offset, element.nameOffset);
   }
 
-  void test_reportErrorForElement_unnamed() {
+  test_reportErrorForElement_unnamed() async {
     ImportElementImpl element =
         ElementFactory.importFor(ElementFactory.library(null, ''), null);
     GatheringErrorListener listener = new GatheringErrorListener();
@@ -936,7 +936,7 @@
     expect(error.offset, element.nameOffset);
   }
 
-  void test_reportErrorForSpan() {
+  test_reportErrorForSpan() async {
     GatheringErrorListener listener = new GatheringErrorListener();
     ErrorReporter reporter = new ErrorReporter(listener, new TestSource());
 
@@ -959,7 +959,7 @@
     expect(listener.errors.first.length, length);
   }
 
-  void test_reportTypeErrorForNode_differentNames() {
+  test_reportTypeErrorForNode_differentNames() async {
     DartType firstType = createType("/test1.dart", "A");
     DartType secondType = createType("/test2.dart", "B");
     GatheringErrorListener listener = new GatheringErrorListener();
@@ -973,7 +973,7 @@
     expect(error.message.indexOf("(") < 0, isTrue);
   }
 
-  void test_reportTypeErrorForNode_sameName() {
+  test_reportTypeErrorForNode_sameName() async {
     String typeName = "A";
     DartType firstType = createType("/test1.dart", typeName);
     DartType secondType = createType("/test2.dart", typeName);
@@ -991,47 +991,47 @@
 
 @reflectiveTest
 class ErrorSeverityTest extends EngineTestCase {
-  void test_max_error_error() {
+  test_max_error_error() async {
     expect(ErrorSeverity.ERROR.max(ErrorSeverity.ERROR),
         same(ErrorSeverity.ERROR));
   }
 
-  void test_max_error_none() {
+  test_max_error_none() async {
     expect(
         ErrorSeverity.ERROR.max(ErrorSeverity.NONE), same(ErrorSeverity.ERROR));
   }
 
-  void test_max_error_warning() {
+  test_max_error_warning() async {
     expect(ErrorSeverity.ERROR.max(ErrorSeverity.WARNING),
         same(ErrorSeverity.ERROR));
   }
 
-  void test_max_none_error() {
+  test_max_none_error() async {
     expect(
         ErrorSeverity.NONE.max(ErrorSeverity.ERROR), same(ErrorSeverity.ERROR));
   }
 
-  void test_max_none_none() {
+  test_max_none_none() async {
     expect(
         ErrorSeverity.NONE.max(ErrorSeverity.NONE), same(ErrorSeverity.NONE));
   }
 
-  void test_max_none_warning() {
+  test_max_none_warning() async {
     expect(ErrorSeverity.NONE.max(ErrorSeverity.WARNING),
         same(ErrorSeverity.WARNING));
   }
 
-  void test_max_warning_error() {
+  test_max_warning_error() async {
     expect(ErrorSeverity.WARNING.max(ErrorSeverity.ERROR),
         same(ErrorSeverity.ERROR));
   }
 
-  void test_max_warning_none() {
+  test_max_warning_none() async {
     expect(ErrorSeverity.WARNING.max(ErrorSeverity.NONE),
         same(ErrorSeverity.WARNING));
   }
 
-  void test_max_warning_warning() {
+  test_max_warning_warning() async {
     expect(ErrorSeverity.WARNING.max(ErrorSeverity.WARNING),
         same(ErrorSeverity.WARNING));
   }
@@ -1044,220 +1044,220 @@
  */
 @reflectiveTest
 class ExitDetectorTest extends ParserTestCase {
-  void test_asExpression() {
+  test_asExpression() async {
     _assertFalse("a as Object;");
   }
 
-  void test_asExpression_throw() {
+  test_asExpression_throw() async {
     _assertTrue("throw '' as Object;");
   }
 
-  void test_assertStatement() {
+  test_assertStatement() async {
     _assertFalse("assert(a);");
   }
 
-  void test_assertStatement_throw() {
+  test_assertStatement_throw() async {
     _assertFalse("assert((throw 0));");
   }
 
-  void test_assignmentExpression() {
+  test_assignmentExpression() async {
     _assertFalse("v = 1;");
   }
 
-  void test_assignmentExpression_compound_lazy() {
+  test_assignmentExpression_compound_lazy() async {
     enableLazyAssignmentOperators = true;
     _assertFalse("v ||= false;");
   }
 
-  void test_assignmentExpression_lhs_throw() {
+  test_assignmentExpression_lhs_throw() async {
     _assertTrue("a[throw ''] = 0;");
   }
 
-  void test_assignmentExpression_rhs_throw() {
+  test_assignmentExpression_rhs_throw() async {
     _assertTrue("v = throw '';");
   }
 
-  void test_await_false() {
+  test_await_false() async {
     _assertFalse("await x;");
   }
 
-  void test_await_throw_true() {
+  test_await_throw_true() async {
     _assertTrue("bool b = await (throw '' || true);");
   }
 
-  void test_binaryExpression_and() {
+  test_binaryExpression_and() async {
     _assertFalse("a && b;");
   }
 
-  void test_binaryExpression_and_lhs() {
+  test_binaryExpression_and_lhs() async {
     _assertTrue("throw '' && b;");
   }
 
-  void test_binaryExpression_and_rhs() {
+  test_binaryExpression_and_rhs() async {
     _assertFalse("a && (throw '');");
   }
 
-  void test_binaryExpression_and_rhs2() {
+  test_binaryExpression_and_rhs2() async {
     _assertFalse("false && (throw '');");
   }
 
-  void test_binaryExpression_and_rhs3() {
+  test_binaryExpression_and_rhs3() async {
     _assertTrue("true && (throw '');");
   }
 
-  void test_binaryExpression_ifNull() {
+  test_binaryExpression_ifNull() async {
     _assertFalse("a ?? b;");
   }
 
-  void test_binaryExpression_ifNull_lhs() {
+  test_binaryExpression_ifNull_lhs() async {
     _assertTrue("throw '' ?? b;");
   }
 
-  void test_binaryExpression_ifNull_rhs() {
+  test_binaryExpression_ifNull_rhs() async {
     _assertFalse("a ?? (throw '');");
   }
 
-  void test_binaryExpression_ifNull_rhs2() {
+  test_binaryExpression_ifNull_rhs2() async {
     _assertFalse("null ?? (throw '');");
   }
 
-  void test_binaryExpression_or() {
+  test_binaryExpression_or() async {
     _assertFalse("a || b;");
   }
 
-  void test_binaryExpression_or_lhs() {
+  test_binaryExpression_or_lhs() async {
     _assertTrue("throw '' || b;");
   }
 
-  void test_binaryExpression_or_rhs() {
+  test_binaryExpression_or_rhs() async {
     _assertFalse("a || (throw '');");
   }
 
-  void test_binaryExpression_or_rhs2() {
+  test_binaryExpression_or_rhs2() async {
     _assertFalse("true || (throw '');");
   }
 
-  void test_binaryExpression_or_rhs3() {
+  test_binaryExpression_or_rhs3() async {
     _assertTrue("false || (throw '');");
   }
 
-  void test_block_empty() {
+  test_block_empty() async {
     _assertFalse("{}");
   }
 
-  void test_block_noReturn() {
+  test_block_noReturn() async {
     _assertFalse("{ int i = 0; }");
   }
 
-  void test_block_return() {
+  test_block_return() async {
     _assertTrue("{ return 0; }");
   }
 
-  void test_block_returnNotLast() {
+  test_block_returnNotLast() async {
     _assertTrue("{ return 0; throw 'a'; }");
   }
 
-  void test_block_throwNotLast() {
+  test_block_throwNotLast() async {
     _assertTrue("{ throw 0; x = null; }");
   }
 
-  void test_cascadeExpression_argument() {
+  test_cascadeExpression_argument() async {
     _assertTrue("a..b(throw '');");
   }
 
-  void test_cascadeExpression_index() {
+  test_cascadeExpression_index() async {
     _assertTrue("a..[throw ''];");
   }
 
-  void test_cascadeExpression_target() {
+  test_cascadeExpression_target() async {
     _assertTrue("throw ''..b();");
   }
 
-  void test_conditional_ifElse_bothThrows() {
+  test_conditional_ifElse_bothThrows() async {
     _assertTrue("c ? throw '' : throw '';");
   }
 
-  void test_conditional_ifElse_elseThrows() {
+  test_conditional_ifElse_elseThrows() async {
     _assertFalse("c ? i : throw '';");
   }
 
-  void test_conditional_ifElse_noThrow() {
+  test_conditional_ifElse_noThrow() async {
     _assertFalse("c ? i : j;");
   }
 
-  void test_conditional_ifElse_thenThrow() {
+  test_conditional_ifElse_thenThrow() async {
     _assertFalse("c ? throw '' : j;");
   }
 
-  void test_conditionalAccess() {
+  test_conditionalAccess() async {
     _assertFalse("a?.b;");
   }
 
-  void test_conditionalAccess_lhs() {
+  test_conditionalAccess_lhs() async {
     _assertTrue("(throw '')?.b;");
   }
 
-  void test_conditionalAccessAssign() {
+  test_conditionalAccessAssign() async {
     _assertFalse("a?.b = c;");
   }
 
-  void test_conditionalAccessAssign_lhs() {
+  test_conditionalAccessAssign_lhs() async {
     _assertTrue("(throw '')?.b = c;");
   }
 
-  void test_conditionalAccessAssign_rhs() {
+  test_conditionalAccessAssign_rhs() async {
     _assertFalse("a?.b = throw '';");
   }
 
-  void test_conditionalAccessAssign_rhs2() {
+  test_conditionalAccessAssign_rhs2() async {
     _assertFalse("null?.b = throw '';");
   }
 
-  void test_conditionalAccessIfNullAssign() {
+  test_conditionalAccessIfNullAssign() async {
     _assertFalse("a?.b ??= c;");
   }
 
-  void test_conditionalAccessIfNullAssign_lhs() {
+  test_conditionalAccessIfNullAssign_lhs() async {
     _assertTrue("(throw '')?.b ??= c;");
   }
 
-  void test_conditionalAccessIfNullAssign_rhs() {
+  test_conditionalAccessIfNullAssign_rhs() async {
     _assertFalse("a?.b ??= throw '';");
   }
 
-  void test_conditionalAccessIfNullAssign_rhs2() {
+  test_conditionalAccessIfNullAssign_rhs2() async {
     _assertFalse("null?.b ??= throw '';");
   }
 
-  void test_conditionalCall() {
+  test_conditionalCall() async {
     _assertFalse("a?.b(c);");
   }
 
-  void test_conditionalCall_lhs() {
+  test_conditionalCall_lhs() async {
     _assertTrue("(throw '')?.b(c);");
   }
 
-  void test_conditionalCall_rhs() {
+  test_conditionalCall_rhs() async {
     _assertFalse("a?.b(throw '');");
   }
 
-  void test_conditionalCall_rhs2() {
+  test_conditionalCall_rhs2() async {
     _assertFalse("null?.b(throw '');");
   }
 
-  void test_creation() {
+  test_creation() async {
     expect(new ExitDetector(), isNotNull);
   }
 
-  void test_doStatement_break_and_throw() {
+  test_doStatement_break_and_throw() async {
     _assertFalse("{ do { if (1==1) break; throw 'T'; } while (0==1); }");
   }
 
-  void test_doStatement_continue_and_throw() {
+  test_doStatement_continue_and_throw() async {
     _assertFalse("{ do { if (1==1) continue; throw 'T'; } while (0==1); }");
   }
 
-  void test_doStatement_continueDoInSwitch_and_throw() {
+  test_doStatement_continueDoInSwitch_and_throw() async {
     _assertFalse('''
 {
   D: do {
@@ -1270,7 +1270,7 @@
 }''');
   }
 
-  void test_doStatement_continueInSwitch_and_throw() {
+  test_doStatement_continueInSwitch_and_throw() async {
     _assertFalse('''
 {
   do {
@@ -1283,287 +1283,287 @@
 }''');
   }
 
-  void test_doStatement_return() {
+  test_doStatement_return() async {
     _assertTrue("{ do { return null; } while (1 == 2); }");
   }
 
-  void test_doStatement_throwCondition() {
+  test_doStatement_throwCondition() async {
     _assertTrue("{ do {} while (throw ''); }");
   }
 
-  void test_doStatement_true_break() {
+  test_doStatement_true_break() async {
     _assertFalse("{ do { break; } while (true); }");
   }
 
-  void test_doStatement_true_continue() {
+  test_doStatement_true_continue() async {
     _assertTrue("{ do { continue; } while (true); }");
   }
 
-  void test_doStatement_true_continueWithLabel() {
+  test_doStatement_true_continueWithLabel() async {
     _assertTrue("{ x: do { continue x; } while (true); }");
   }
 
-  void test_doStatement_true_if_return() {
+  test_doStatement_true_if_return() async {
     _assertTrue("{ do { if (true) {return null;} } while (true); }");
   }
 
-  void test_doStatement_true_noBreak() {
+  test_doStatement_true_noBreak() async {
     _assertTrue("{ do {} while (true); }");
   }
 
-  void test_doStatement_true_return() {
+  test_doStatement_true_return() async {
     _assertTrue("{ do { return null; } while (true);  }");
   }
 
-  void test_emptyStatement() {
+  test_emptyStatement() async {
     _assertFalse(";");
   }
 
-  void test_forEachStatement() {
+  test_forEachStatement() async {
     _assertFalse("for (element in list) {}");
   }
 
-  void test_forEachStatement_throw() {
+  test_forEachStatement_throw() async {
     _assertTrue("for (element in throw '') {}");
   }
 
-  void test_forStatement_condition() {
+  test_forStatement_condition() async {
     _assertTrue("for (; throw 0;) {}");
   }
 
-  void test_forStatement_implicitTrue() {
+  test_forStatement_implicitTrue() async {
     _assertTrue("for (;;) {}");
   }
 
-  void test_forStatement_implicitTrue_break() {
+  test_forStatement_implicitTrue_break() async {
     _assertFalse("for (;;) { break; }");
   }
 
-  void test_forStatement_implicitTrue_if_break() {
+  test_forStatement_implicitTrue_if_break() async {
     _assertFalse("{ for (;;) { if (1==2) { var a = 1; } else { break; } } }");
   }
 
-  void test_forStatement_initialization() {
+  test_forStatement_initialization() async {
     _assertTrue("for (i = throw 0;;) {}");
   }
 
-  void test_forStatement_true() {
+  test_forStatement_true() async {
     _assertTrue("for (; true; ) {}");
   }
 
-  void test_forStatement_true_break() {
+  test_forStatement_true_break() async {
     _assertFalse("{ for (; true; ) { break; } }");
   }
 
-  void test_forStatement_true_continue() {
+  test_forStatement_true_continue() async {
     _assertTrue("{ for (; true; ) { continue; } }");
   }
 
-  void test_forStatement_true_if_return() {
+  test_forStatement_true_if_return() async {
     _assertTrue("{ for (; true; ) { if (true) {return null;} } }");
   }
 
-  void test_forStatement_true_noBreak() {
+  test_forStatement_true_noBreak() async {
     _assertTrue("{ for (; true; ) {} }");
   }
 
-  void test_forStatement_updaters() {
+  test_forStatement_updaters() async {
     _assertTrue("for (;; i++, throw 0) {}");
   }
 
-  void test_forStatement_variableDeclaration() {
+  test_forStatement_variableDeclaration() async {
     _assertTrue("for (int i = throw 0;;) {}");
   }
 
-  void test_functionExpression() {
+  test_functionExpression() async {
     _assertFalse("(){};");
   }
 
-  void test_functionExpression_bodyThrows() {
+  test_functionExpression_bodyThrows() async {
     _assertFalse("(int i) => throw '';");
   }
 
-  void test_functionExpressionInvocation() {
+  test_functionExpressionInvocation() async {
     _assertFalse("f(g);");
   }
 
-  void test_functionExpressionInvocation_argumentThrows() {
+  test_functionExpressionInvocation_argumentThrows() async {
     _assertTrue("f(throw '');");
   }
 
-  void test_functionExpressionInvocation_targetThrows() {
+  test_functionExpressionInvocation_targetThrows() async {
     _assertTrue("throw ''(g);");
   }
 
-  void test_identifier_prefixedIdentifier() {
+  test_identifier_prefixedIdentifier() async {
     _assertFalse("a.b;");
   }
 
-  void test_identifier_simpleIdentifier() {
+  test_identifier_simpleIdentifier() async {
     _assertFalse("a;");
   }
 
-  void test_if_false_else_return() {
+  test_if_false_else_return() async {
     _assertTrue("if (false) {} else { return 0; }");
   }
 
-  void test_if_false_noReturn() {
+  test_if_false_noReturn() async {
     _assertFalse("if (false) {}");
   }
 
-  void test_if_false_return() {
+  test_if_false_return() async {
     _assertFalse("if (false) { return 0; }");
   }
 
-  void test_if_noReturn() {
+  test_if_noReturn() async {
     _assertFalse("if (c) i++;");
   }
 
-  void test_if_return() {
+  test_if_return() async {
     _assertFalse("if (c) return 0;");
   }
 
-  void test_if_true_noReturn() {
+  test_if_true_noReturn() async {
     _assertFalse("if (true) {}");
   }
 
-  void test_if_true_return() {
+  test_if_true_return() async {
     _assertTrue("if (true) { return 0; }");
   }
 
-  void test_ifElse_bothReturn() {
+  test_ifElse_bothReturn() async {
     _assertTrue("if (c) return 0; else return 1;");
   }
 
-  void test_ifElse_elseReturn() {
+  test_ifElse_elseReturn() async {
     _assertFalse("if (c) i++; else return 1;");
   }
 
-  void test_ifElse_noReturn() {
+  test_ifElse_noReturn() async {
     _assertFalse("if (c) i++; else j++;");
   }
 
-  void test_ifElse_thenReturn() {
+  test_ifElse_thenReturn() async {
     _assertFalse("if (c) return 0; else j++;");
   }
 
-  void test_ifNullAssign() {
+  test_ifNullAssign() async {
     _assertFalse("a ??= b;");
   }
 
-  void test_ifNullAssign_rhs() {
+  test_ifNullAssign_rhs() async {
     _assertFalse("a ??= throw '';");
   }
 
-  void test_indexExpression() {
+  test_indexExpression() async {
     _assertFalse("a[b];");
   }
 
-  void test_indexExpression_index() {
+  test_indexExpression_index() async {
     _assertTrue("a[throw ''];");
   }
 
-  void test_indexExpression_target() {
+  test_indexExpression_target() async {
     _assertTrue("throw ''[b];");
   }
 
-  void test_instanceCreationExpression() {
+  test_instanceCreationExpression() async {
     _assertFalse("new A(b);");
   }
 
-  void test_instanceCreationExpression_argumentThrows() {
+  test_instanceCreationExpression_argumentThrows() async {
     _assertTrue("new A(throw '');");
   }
 
-  void test_isExpression() {
+  test_isExpression() async {
     _assertFalse("A is B;");
   }
 
-  void test_isExpression_throws() {
+  test_isExpression_throws() async {
     _assertTrue("throw '' is B;");
   }
 
-  void test_labeledStatement() {
+  test_labeledStatement() async {
     _assertFalse("label: a;");
   }
 
-  void test_labeledStatement_throws() {
+  test_labeledStatement_throws() async {
     _assertTrue("label: throw '';");
   }
 
-  void test_literal_boolean() {
+  test_literal_boolean() async {
     _assertFalse("true;");
   }
 
-  void test_literal_double() {
+  test_literal_double() async {
     _assertFalse("1.1;");
   }
 
-  void test_literal_integer() {
+  test_literal_integer() async {
     _assertFalse("1;");
   }
 
-  void test_literal_null() {
+  test_literal_null() async {
     _assertFalse("null;");
   }
 
-  void test_literal_String() {
+  test_literal_String() async {
     _assertFalse("'str';");
   }
 
-  void test_methodInvocation() {
+  test_methodInvocation() async {
     _assertFalse("a.b(c);");
   }
 
-  void test_methodInvocation_argument() {
+  test_methodInvocation_argument() async {
     _assertTrue("a.b(throw '');");
   }
 
-  void test_methodInvocation_target() {
+  test_methodInvocation_target() async {
     _assertTrue("throw ''.b(c);");
   }
 
-  void test_parenthesizedExpression() {
+  test_parenthesizedExpression() async {
     _assertFalse("(a);");
   }
 
-  void test_parenthesizedExpression_throw() {
+  test_parenthesizedExpression_throw() async {
     _assertTrue("(throw '');");
   }
 
-  void test_propertyAccess() {
+  test_propertyAccess() async {
     _assertFalse("new Object().a;");
   }
 
-  void test_propertyAccess_throws() {
+  test_propertyAccess_throws() async {
     _assertTrue("(throw '').a;");
   }
 
-  void test_rethrow() {
+  test_rethrow() async {
     _assertTrue("rethrow;");
   }
 
-  void test_return() {
+  test_return() async {
     _assertTrue("return 0;");
   }
 
-  void test_superExpression() {
+  test_superExpression() async {
     _assertFalse("super.a;");
   }
 
-  void test_switch_allReturn() {
+  test_switch_allReturn() async {
     _assertTrue("switch (i) { case 0: return 0; default: return 1; }");
   }
 
-  void test_switch_defaultWithNoStatements() {
+  test_switch_defaultWithNoStatements() async {
     _assertFalse("switch (i) { case 0: return 0; default: }");
   }
 
-  void test_switch_fallThroughToNotReturn() {
+  test_switch_fallThroughToNotReturn() async {
     _assertFalse("switch (i) { case 0: case 1: break; default: return 1; }");
   }
 
-  void test_switch_fallThroughToReturn() {
+  test_switch_fallThroughToReturn() async {
     _assertTrue("switch (i) { case 0: case 1: return 0; default: return 1; }");
   }
 
@@ -1571,7 +1571,7 @@
   // determine that `case 0` exits, `case 1` continues to an exiting case, and
   // `default` exits, so the switch exits.
   @failingTest
-  void test_switch_includesContinue() {
+  test_switch_includesContinue() async {
     _assertTrue('''
 switch (i) {
   zero: case 0: return 0;
@@ -1580,63 +1580,63 @@
 }''');
   }
 
-  void test_switch_noDefault() {
+  test_switch_noDefault() async {
     _assertFalse("switch (i) { case 0: return 0; }");
   }
 
-  void test_switch_nonReturn() {
+  test_switch_nonReturn() async {
     _assertFalse("switch (i) { case 0: i++; default: return 1; }");
   }
 
-  void test_thisExpression() {
+  test_thisExpression() async {
     _assertFalse("this.a;");
   }
 
-  void test_throwExpression() {
+  test_throwExpression() async {
     _assertTrue("throw new Object();");
   }
 
-  void test_tryStatement_noReturn() {
+  test_tryStatement_noReturn() async {
     _assertFalse("try {} catch (e, s) {} finally {}");
   }
 
-  void test_tryStatement_noReturn_noFinally() {
+  test_tryStatement_noReturn_noFinally() async {
     _assertFalse("try {} catch (e, s) {}");
   }
 
-  void test_tryStatement_return_catch() {
+  test_tryStatement_return_catch() async {
     _assertFalse("try {} catch (e, s) { return 1; } finally {}");
   }
 
-  void test_tryStatement_return_catch_noFinally() {
+  test_tryStatement_return_catch_noFinally() async {
     _assertFalse("try {} catch (e, s) { return 1; }");
   }
 
-  void test_tryStatement_return_finally() {
+  test_tryStatement_return_finally() async {
     _assertTrue("try {} catch (e, s) {} finally { return 1; }");
   }
 
-  void test_tryStatement_return_try_noCatch() {
+  test_tryStatement_return_try_noCatch() async {
     _assertTrue("try { return 1; } finally {}");
   }
 
-  void test_tryStatement_return_try_oneCatchDoesNotExit() {
+  test_tryStatement_return_try_oneCatchDoesNotExit() async {
     _assertFalse("try { return 1; } catch (e, s) {} finally {}");
   }
 
-  void test_tryStatement_return_try_oneCatchDoesNotExit_noFinally() {
+  test_tryStatement_return_try_oneCatchDoesNotExit_noFinally() async {
     _assertFalse("try { return 1; } catch (e, s) {}");
   }
 
-  void test_tryStatement_return_try_oneCatchExits() {
+  test_tryStatement_return_try_oneCatchExits() async {
     _assertTrue("try { return 1; } catch (e, s) { return 1; } finally {}");
   }
 
-  void test_tryStatement_return_try_oneCatchExits_noFinally() {
+  test_tryStatement_return_try_oneCatchExits_noFinally() async {
     _assertTrue("try { return 1; } catch (e, s) { return 1; }");
   }
 
-  void test_tryStatement_return_try_twoCatchesDoExit() {
+  test_tryStatement_return_try_twoCatchesDoExit() async {
     _assertTrue('''
 try { return 1; }
 on int catch (e, s) { return 1; }
@@ -1644,14 +1644,14 @@
 finally {}''');
   }
 
-  void test_tryStatement_return_try_twoCatchesDoExit_noFinally() {
+  test_tryStatement_return_try_twoCatchesDoExit_noFinally() async {
     _assertTrue('''
 try { return 1; }
 on int catch (e, s) { return 1; }
 on String catch (e, s) { return 1; }''');
   }
 
-  void test_tryStatement_return_try_twoCatchesDoNotExit() {
+  test_tryStatement_return_try_twoCatchesDoNotExit() async {
     _assertFalse('''
 try { return 1; }
 on int catch (e, s) {}
@@ -1659,14 +1659,14 @@
 finally {}''');
   }
 
-  void test_tryStatement_return_try_twoCatchesDoNotExit_noFinally() {
+  test_tryStatement_return_try_twoCatchesDoNotExit_noFinally() async {
     _assertFalse('''
 try { return 1; }
 on int catch (e, s) {}
 on String catch (e, s) {}''');
   }
 
-  void test_tryStatement_return_try_twoCatchesMixed() {
+  test_tryStatement_return_try_twoCatchesMixed() async {
     _assertFalse('''
 try { return 1; }
 on int catch (e, s) {}
@@ -1674,66 +1674,66 @@
 finally {}''');
   }
 
-  void test_tryStatement_return_try_twoCatchesMixed_noFinally() {
+  test_tryStatement_return_try_twoCatchesMixed_noFinally() async {
     _assertFalse('''
 try { return 1; }
 on int catch (e, s) {}
 on String catch (e, s) { return 1; }''');
   }
 
-  void test_variableDeclarationStatement_noInitializer() {
+  test_variableDeclarationStatement_noInitializer() async {
     _assertFalse("int i;");
   }
 
-  void test_variableDeclarationStatement_noThrow() {
+  test_variableDeclarationStatement_noThrow() async {
     _assertFalse("int i = 0;");
   }
 
-  void test_variableDeclarationStatement_throw() {
+  test_variableDeclarationStatement_throw() async {
     _assertTrue("int i = throw new Object();");
   }
 
-  void test_whileStatement_false_nonReturn() {
+  test_whileStatement_false_nonReturn() async {
     _assertFalse("{ while (false) {} }");
   }
 
-  void test_whileStatement_throwCondition() {
+  test_whileStatement_throwCondition() async {
     _assertTrue("{ while (throw '') {} }");
   }
 
-  void test_whileStatement_true_break() {
+  test_whileStatement_true_break() async {
     _assertFalse("{ while (true) { break; } }");
   }
 
-  void test_whileStatement_true_break_and_throw() {
+  test_whileStatement_true_break_and_throw() async {
     _assertFalse("{ while (true) { if (1==1) break; throw 'T'; } }");
   }
 
-  void test_whileStatement_true_continue() {
+  test_whileStatement_true_continue() async {
     _assertTrue("{ while (true) { continue; } }");
   }
 
-  void test_whileStatement_true_continueWithLabel() {
+  test_whileStatement_true_continueWithLabel() async {
     _assertTrue("{ x: while (true) { continue x; } }");
   }
 
-  void test_whileStatement_true_doStatement_scopeRequired() {
+  test_whileStatement_true_doStatement_scopeRequired() async {
     _assertTrue("{ while (true) { x: do { continue x; } while (true); } }");
   }
 
-  void test_whileStatement_true_if_return() {
+  test_whileStatement_true_if_return() async {
     _assertTrue("{ while (true) { if (true) {return null;} } }");
   }
 
-  void test_whileStatement_true_noBreak() {
+  test_whileStatement_true_noBreak() async {
     _assertTrue("{ while (true) {} }");
   }
 
-  void test_whileStatement_true_return() {
+  test_whileStatement_true_return() async {
     _assertTrue("{ while (true) { return null; } }");
   }
 
-  void test_whileStatement_true_throw() {
+  test_whileStatement_true_throw() async {
     _assertTrue("{ while (true) { throw ''; } }");
   }
 
@@ -1759,7 +1759,7 @@
  */
 @reflectiveTest
 class ExitDetectorTest2 extends ResolverTestCase {
-  void test_forStatement_implicitTrue_breakWithLabel() {
+  test_forStatement_implicitTrue_breakWithLabel() async {
     Source source = addSource(r'''
 void f() {
   x: for (;;) {
@@ -1773,7 +1773,7 @@
     _assertNthStatementDoesNotExit(source, 0);
   }
 
-  void test_switch_withEnum_false_noDefault() {
+  test_switch_withEnum_false_noDefault() async {
     Source source = addSource(r'''
 enum E { A, B }
 String f(E e) {
@@ -1790,7 +1790,7 @@
     _assertNthStatementDoesNotExit(source, 1);
   }
 
-  void test_switch_withEnum_false_withDefault() {
+  test_switch_withEnum_false_withDefault() async {
     Source source = addSource(r'''
 enum E { A, B }
 String f(E e) {
@@ -1807,7 +1807,7 @@
     _assertNthStatementDoesNotExit(source, 1);
   }
 
-  void test_switch_withEnum_true_noDefault() {
+  test_switch_withEnum_true_noDefault() async {
     Source source = addSource(r'''
 enum E { A, B }
 String f(E e) {
@@ -1822,7 +1822,7 @@
     _assertNthStatementDoesNotExit(source, 0);
   }
 
-  void test_switch_withEnum_true_withExitingDefault() {
+  test_switch_withEnum_true_withExitingDefault() async {
     Source source = addSource(r'''
 enum E { A, B }
 String f(E e) {
@@ -1837,7 +1837,7 @@
     _assertNthStatementExits(source, 0);
   }
 
-  void test_switch_withEnum_true_withNonExitingDefault() {
+  test_switch_withEnum_true_withNonExitingDefault() async {
     Source source = addSource(r'''
 enum E { A, B }
 String f(E e) {
@@ -1853,7 +1853,7 @@
     _assertNthStatementDoesNotExit(source, 1);
   }
 
-  void test_whileStatement_breakWithLabel() {
+  test_whileStatement_breakWithLabel() async {
     Source source = addSource(r'''
 void f() {
   x: while (true) {
@@ -1867,7 +1867,7 @@
     _assertNthStatementDoesNotExit(source, 0);
   }
 
-  void test_whileStatement_breakWithLabel_afterExiting() {
+  test_whileStatement_breakWithLabel_afterExiting() async {
     Source source = addSource(r'''
 void f() {
   x: while (true) {
@@ -1881,7 +1881,7 @@
     _assertNthStatementExits(source, 0);
   }
 
-  void test_whileStatement_switchWithBreakWithLabel() {
+  test_whileStatement_switchWithBreakWithLabel() async {
     Source source = addSource(r'''
 void f() {
   x: while (true) {
@@ -1895,7 +1895,7 @@
     _assertNthStatementDoesNotExit(source, 0);
   }
 
-  void test_yieldStatement_plain() {
+  test_yieldStatement_plain() async {
     Source source = addSource(r'''
 void f() sync* {
   yield 1;
@@ -1904,7 +1904,7 @@
     _assertNthStatementDoesNotExit(source, 0);
   }
 
-  void test_yieldStatement_star_plain() {
+  test_yieldStatement_star_plain() async {
     Source source = addSource(r'''
 void f() sync* {
   yield* 1;
@@ -1913,7 +1913,7 @@
     _assertNthStatementDoesNotExit(source, 0);
   }
 
-  void test_yieldStatement_star_throw() {
+  test_yieldStatement_star_throw() async {
     Source source = addSource(r'''
 void f() sync* {
   yield* throw '';
@@ -1922,7 +1922,7 @@
     _assertNthStatementExits(source, 0);
   }
 
-  void test_yieldStatement_throw() {
+  test_yieldStatement_throw() async {
     Source source = addSource(r'''
 void f() sync* {
   yield throw '';
@@ -1955,7 +1955,7 @@
 
 @reflectiveTest
 class FileBasedSourceTest {
-  void test_equals_false_differentFiles() {
+  test_equals_false_differentFiles() async {
     JavaFile file1 = FileUtilities2.createFile("/does/not/exist1.dart");
     JavaFile file2 = FileUtilities2.createFile("/does/not/exist2.dart");
     FileBasedSource source1 = new FileBasedSource(file1);
@@ -1963,13 +1963,13 @@
     expect(source1 == source2, isFalse);
   }
 
-  void test_equals_false_null() {
+  test_equals_false_null() async {
     JavaFile file = FileUtilities2.createFile("/does/not/exist1.dart");
     FileBasedSource source1 = new FileBasedSource(file);
     expect(source1 == null, isFalse);
   }
 
-  void test_equals_true() {
+  test_equals_true() async {
     JavaFile file1 = FileUtilities2.createFile("/does/not/exist.dart");
     JavaFile file2 = FileUtilities2.createFile("/does/not/exist.dart");
     FileBasedSource source1 = new FileBasedSource(file1);
@@ -1977,7 +1977,7 @@
     expect(source1 == source2, isTrue);
   }
 
-  void test_fileReadMode() {
+  test_fileReadMode() async {
     expect(FileBasedSource.fileReadMode('a'), 'a');
     expect(FileBasedSource.fileReadMode('a\n'), 'a\n');
     expect(FileBasedSource.fileReadMode('ab'), 'ab');
@@ -1987,7 +1987,7 @@
     expect(FileBasedSource.fileReadMode('a\r\nb'), 'a\r\nb');
   }
 
-  void test_fileReadMode_changed() {
+  test_fileReadMode_changed() async {
     FileBasedSource.fileReadMode = (String s) => s + 'xyz';
     expect(FileBasedSource.fileReadMode('a'), 'axyz');
     expect(FileBasedSource.fileReadMode('a\n'), 'a\nxyz');
@@ -1996,7 +1996,7 @@
     FileBasedSource.fileReadMode = (String s) => s;
   }
 
-  void test_fileReadMode_normalize_eol_always() {
+  test_fileReadMode_normalize_eol_always() async {
     FileBasedSource.fileReadMode =
         PhysicalResourceProvider.NORMALIZE_EOL_ALWAYS;
     expect(FileBasedSource.fileReadMode('a'), 'a');
@@ -2019,7 +2019,7 @@
     FileBasedSource.fileReadMode = (String s) => s;
   }
 
-  void test_getEncoding() {
+  test_getEncoding() async {
     SourceFactory factory = new SourceFactory(
         [new ResourceUriResolver(PhysicalResourceProvider.INSTANCE)]);
     String fullPath = "/does/not/exist.dart";
@@ -2028,20 +2028,20 @@
     expect(factory.fromEncoding(source.encoding), source);
   }
 
-  void test_getFullName() {
+  test_getFullName() async {
     String fullPath = "/does/not/exist.dart";
     JavaFile file = FileUtilities2.createFile(fullPath);
     FileBasedSource source = new FileBasedSource(file);
     expect(source.fullName, file.getAbsolutePath());
   }
 
-  void test_getShortName() {
+  test_getShortName() async {
     JavaFile file = FileUtilities2.createFile("/does/not/exist.dart");
     FileBasedSource source = new FileBasedSource(file);
     expect(source.shortName, "exist.dart");
   }
 
-  void test_hashCode() {
+  test_hashCode() async {
     JavaFile file1 = FileUtilities2.createFile("/does/not/exist.dart");
     JavaFile file2 = FileUtilities2.createFile("/does/not/exist.dart");
     FileBasedSource source1 = new FileBasedSource(file1);
@@ -2049,8 +2049,8 @@
     expect(source2.hashCode, source1.hashCode);
   }
 
-  void test_isInSystemLibrary_contagious() {
-    DartSdk sdk = _createSdk();
+  test_isInSystemLibrary_contagious() async {
+    DartSdk sdk = (new _SimpleDartSdkTest()..setUp()).sdk;
     UriResolver resolver = new DartUriResolver(sdk);
     SourceFactory factory = new SourceFactory([resolver]);
     // resolve dart:core
@@ -2063,7 +2063,7 @@
     expect(partSource.isInSystemLibrary, isTrue);
   }
 
-  void test_isInSystemLibrary_false() {
+  test_isInSystemLibrary_false() async {
     JavaFile file = FileUtilities2.createFile("/does/not/exist.dart");
     FileBasedSource source = new FileBasedSource(file);
     expect(source, isNotNull);
@@ -2071,7 +2071,7 @@
     expect(source.isInSystemLibrary, isFalse);
   }
 
-  void test_issue14500() {
+  test_issue14500() async {
     // see https://code.google.com/p/dart/issues/detail?id=14500
     FileBasedSource source = new FileBasedSource(
         FileUtilities2.createFile("/some/packages/foo:bar.dart"));
@@ -2079,7 +2079,7 @@
     expect(source.exists(), isFalse);
   }
 
-  void test_resolveRelative_file_fileName() {
+  test_resolveRelative_file_fileName() async {
     if (OSUtilities.isWindows()) {
       // On Windows, the URI that is produced includes a drive letter,
       // which I believe is not consistent across all machines that might run
@@ -2094,7 +2094,7 @@
     expect(relative.toString(), "file:///a/b/lib.dart");
   }
 
-  void test_resolveRelative_file_filePath() {
+  test_resolveRelative_file_filePath() async {
     if (OSUtilities.isWindows()) {
       // On Windows, the URI that is produced includes a drive letter,
       // which I believe is not consistent across all machines that might run
@@ -2109,7 +2109,7 @@
     expect(relative.toString(), "file:///a/b/c/lib.dart");
   }
 
-  void test_resolveRelative_file_filePathWithParent() {
+  test_resolveRelative_file_filePathWithParent() async {
     if (OSUtilities.isWindows()) {
       // On Windows, the URI that is produced includes a drive letter, which I
       // believe is not consistent across all machines that might run this test.
@@ -2123,7 +2123,7 @@
     expect(relative.toString(), "file:///a/c/lib.dart");
   }
 
-  void test_system() {
+  test_system() async {
     JavaFile file = FileUtilities2.createFile("/does/not/exist.dart");
     FileBasedSource source = new FileBasedSource(file, Uri.parse("dart:core"));
     expect(source, isNotNull);
@@ -2134,44 +2134,44 @@
 
 @reflectiveTest
 class ResolveRelativeUriTest {
-  void test_resolveRelative_dart_dartUri() {
+  test_resolveRelative_dart_dartUri() async {
     _assertResolve('dart:foo', 'dart:bar', 'dart:bar');
   }
 
-  void test_resolveRelative_dart_fileName() {
+  test_resolveRelative_dart_fileName() async {
     _assertResolve('dart:test', 'lib.dart', 'dart:test/lib.dart');
   }
 
-  void test_resolveRelative_dart_filePath() {
+  test_resolveRelative_dart_filePath() async {
     _assertResolve('dart:test', 'c/lib.dart', 'dart:test/c/lib.dart');
   }
 
-  void test_resolveRelative_dart_filePathWithParent() {
+  test_resolveRelative_dart_filePathWithParent() async {
     _assertResolve(
         'dart:test/b/test.dart', '../c/lib.dart', 'dart:test/c/lib.dart');
   }
 
-  void test_resolveRelative_package_dartUri() {
+  test_resolveRelative_package_dartUri() async {
     _assertResolve('package:foo/bar.dart', 'dart:test', 'dart:test');
   }
 
-  void test_resolveRelative_package_emptyPath() {
+  test_resolveRelative_package_emptyPath() async {
     _assertResolve('package:foo/bar.dart', '', 'package:foo/bar.dart');
   }
 
-  void test_resolveRelative_package_fileName() {
+  test_resolveRelative_package_fileName() async {
     _assertResolve('package:b/test.dart', 'lib.dart', 'package:b/lib.dart');
   }
 
-  void test_resolveRelative_package_fileNameWithoutPackageName() {
+  test_resolveRelative_package_fileNameWithoutPackageName() async {
     _assertResolve('package:test.dart', 'lib.dart', 'package:lib.dart');
   }
 
-  void test_resolveRelative_package_filePath() {
+  test_resolveRelative_package_filePath() async {
     _assertResolve('package:b/test.dart', 'c/lib.dart', 'package:b/c/lib.dart');
   }
 
-  void test_resolveRelative_package_filePathWithParent() {
+  test_resolveRelative_package_filePathWithParent() async {
     _assertResolve(
         'package:a/b/test.dart', '../c/lib.dart', 'package:a/c/lib.dart');
   }
@@ -2188,7 +2188,7 @@
 @deprecated
 @reflectiveTest
 class SDKLibrariesReaderTest extends EngineTestCase {
-  void test_readFrom_dart2js() {
+  test_readFrom_dart2js() async {
     LibraryMap libraryMap = new SdkLibrariesReader(true).readFromFile(
         FileUtilities2.createFile("/libs.dart"),
         r'''
@@ -2213,14 +2213,14 @@
     expect(first.isVmLibrary, true);
   }
 
-  void test_readFrom_empty() {
+  test_readFrom_empty() async {
     LibraryMap libraryMap = new SdkLibrariesReader(false)
         .readFromFile(FileUtilities2.createFile("/libs.dart"), "");
     expect(libraryMap, isNotNull);
     expect(libraryMap.size(), 0);
   }
 
-  void test_readFrom_normal() {
+  test_readFrom_normal() async {
     LibraryMap libraryMap = new SdkLibrariesReader(false).readFromFile(
         FileUtilities2.createFile("/libs.dart"),
         r'''
@@ -2263,16 +2263,52 @@
 
 @reflectiveTest
 class UriKindTest {
-  void test_fromEncoding() {
+  test_fromEncoding() async {
     expect(UriKind.fromEncoding(0x64), same(UriKind.DART_URI));
     expect(UriKind.fromEncoding(0x66), same(UriKind.FILE_URI));
     expect(UriKind.fromEncoding(0x70), same(UriKind.PACKAGE_URI));
     expect(UriKind.fromEncoding(0x58), same(null));
   }
 
-  void test_getEncoding() {
+  test_getEncoding() async {
     expect(UriKind.DART_URI.encoding, 0x64);
     expect(UriKind.FILE_URI.encoding, 0x66);
     expect(UriKind.PACKAGE_URI.encoding, 0x70);
   }
 }
+
+class _SimpleDartSdkTest {
+  MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
+  String coreCorePath;
+  String coreIntPath;
+  DartSdk sdk;
+
+  void setUp() {
+    Folder sdkFolder =
+        resourceProvider.newFolder(resourceProvider.convertPath('/sdk'));
+    resourceProvider.newFile(
+        resourceProvider.convertPath(
+            '/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart'),
+        '''
+const Map<String, LibraryInfo> libraries = const {
+  "core": const LibraryInfo("core/core.dart")
+};
+''');
+    coreCorePath = resourceProvider.convertPath('/sdk/lib/core/core.dart');
+    resourceProvider.newFile(
+        coreCorePath,
+        '''
+library dart.core;
+part 'int.dart';
+''');
+    coreIntPath = resourceProvider.convertPath('/sdk/lib/core/int.dart');
+    resourceProvider.newFile(
+        coreIntPath,
+        '''
+part of dart.core;
+''');
+    sdk = new FolderBasedDartSdk(resourceProvider, sdkFolder);
+  }
+}
+
+class _SourceMock extends TypedMock implements Source {}
diff --git a/pkg/analyzer/test/generated/analysis_context_factory.dart b/pkg/analyzer/test/generated/analysis_context_factory.dart
index ffbe349..236a5da 100644
--- a/pkg/analyzer/test/generated/analysis_context_factory.dart
+++ b/pkg/analyzer/test/generated/analysis_context_factory.dart
@@ -141,9 +141,9 @@
       provider.typeType.element
     ];
     coreUnit.functions = <FunctionElement>[
-      ElementFactory.functionElement3("identical", provider.boolType.element,
+      ElementFactory.functionElement3("identical", provider.boolType,
           <ClassElement>[objectClassElement, objectClassElement], null),
-      ElementFactory.functionElement3("print", VoidTypeImpl.instance.element,
+      ElementFactory.functionElement3("print", VoidTypeImpl.instance,
           <ClassElement>[objectClassElement], null)
     ];
     TopLevelVariableElement proxyTopLevelVariableElt = ElementFactory
@@ -190,9 +190,12 @@
     coreContext.setContents(asyncSource, "");
     asyncUnit.librarySource = asyncUnit.source = asyncSource;
     asyncLibrary.definingCompilationUnit = asyncUnit;
-    // Future
+    // Future<T>
     ClassElementImpl futureElement =
         ElementFactory.classElement2("Future", ["T"]);
+    // FutureOr<T>
+    ClassElementImpl futureOrElement =
+      ElementFactory.classElement2("FutureOr", ["T"]);
     futureElement.enclosingElement = asyncUnit;
     //   factory Future.value([value])
     ConstructorElementImpl futureConstructor =
@@ -202,13 +205,15 @@
     ];
     futureConstructor.factory = true;
     futureElement.constructors = <ConstructorElement>[futureConstructor];
-    //   Future then(onValue(T value), { Function onError });
+    //   Future<R> then<R>(FutureOr<R> onValue(T value), { Function onError });
     TypeDefiningElement futureThenR = DynamicElementImpl.instance;
+    DartType onValueReturnType = DynamicTypeImpl.instance;
     if (context.analysisOptions.strongMode) {
       futureThenR = ElementFactory.typeParameterWithType('R');
+      onValueReturnType = futureOrElement.type.instantiate([futureThenR.type]);
     }
     FunctionElementImpl thenOnValue = ElementFactory.functionElement3('onValue',
-        DynamicElementImpl.instance, [futureElement.typeParameters[0]], null);
+        onValueReturnType, [futureElement.typeParameters[0]], null);
     thenOnValue.isSynthetic = true;
 
     DartType futureRType = futureElement.type.instantiate([futureThenR.type]);
@@ -238,6 +243,7 @@
     // Stream
     ClassElementImpl streamElement =
         ElementFactory.classElement2("Stream", ["T"]);
+    streamElement.abstract = true;
     streamElement.constructors = <ConstructorElement>[
       ElementFactory.constructorElement2(streamElement, null)
     ];
@@ -245,7 +251,7 @@
         .instantiate(streamElement.type.typeArguments);
     FunctionElementImpl listenOnData = ElementFactory.functionElement3(
         'onData',
-        VoidTypeImpl.instance.element,
+        VoidTypeImpl.instance,
         <TypeDefiningElement>[streamElement.typeParameters[0]],
         null);
     listenOnData.isSynthetic = true;
@@ -267,6 +273,7 @@
     asyncUnit.types = <ClassElement>[
       completerElement,
       futureElement,
+      futureOrElement,
       streamElement,
       streamSubscriptionElement
     ];
@@ -320,7 +327,7 @@
       ElementFactory.classElement("SelectElement", elementType)
     ];
     htmlUnit.functions = <FunctionElement>[
-      ElementFactory.functionElement3("query", elementElement,
+      ElementFactory.functionElement3("query", elementElement.type,
           <ClassElement>[provider.stringType.element], ClassElement.EMPTY_LIST)
     ];
     TopLevelVariableElementImpl document =
@@ -341,7 +348,7 @@
     mathUnit.librarySource = mathUnit.source = mathSource;
     FunctionElement cosElement = ElementFactory.functionElement3(
         "cos",
-        provider.doubleType.element,
+        provider.doubleType,
         <ClassElement>[provider.numType.element],
         ClassElement.EMPTY_LIST);
     TopLevelVariableElement ln10Element = ElementFactory
@@ -349,7 +356,7 @@
     TypeParameterElement maxT =
         ElementFactory.typeParameterWithType('T', provider.numType);
     FunctionElementImpl maxElement = ElementFactory.functionElement3(
-        "max", maxT, [maxT, maxT], ClassElement.EMPTY_LIST);
+        "max", maxT.type, [maxT, maxT], ClassElement.EMPTY_LIST);
     maxElement.typeParameters = [maxT];
     maxElement.type = new FunctionTypeImpl(maxElement);
     TopLevelVariableElement piElement = ElementFactory.topLevelVariableElement3(
@@ -366,12 +373,12 @@
     randomElement.constructors = <ConstructorElement>[randomConstructor];
     FunctionElement sinElement = ElementFactory.functionElement3(
         "sin",
-        provider.doubleType.element,
+        provider.doubleType,
         <ClassElement>[provider.numType.element],
         ClassElement.EMPTY_LIST);
     FunctionElement sqrtElement = ElementFactory.functionElement3(
         "sqrt",
-        provider.doubleType.element,
+        provider.doubleType,
         <ClassElement>[provider.numType.element],
         ClassElement.EMPTY_LIST);
     mathUnit.accessors = <PropertyAccessorElement>[
diff --git a/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_driver_test.dart b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_driver_test.dart
new file mode 100644
index 0000000..b8d01e9
--- /dev/null
+++ b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_driver_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'checked_mode_compile_time_error_code_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(CheckedModeCompileTimeErrorCodeTest_Driver);
+  });
+}
+
+@reflectiveTest
+class CheckedModeCompileTimeErrorCodeTest_Driver
+    extends CheckedModeCompileTimeErrorCodeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart
index 7fa42f2..6a7256c 100644
--- a/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_test.dart
@@ -18,7 +18,7 @@
 
 @reflectiveTest
 class CheckedModeCompileTimeErrorCodeTest extends ResolverTestCase {
-  void test_fieldFormalParameterAssignableToField_extends() {
+  test_fieldFormalParameterAssignableToField_extends() async {
     // According to checked-mode type checking rules, a value of type B is
     // assignable to a field of type A, because B extends A (and hence is a
     // subtype of A).
@@ -34,12 +34,12 @@
   const C(this.a);
 }
 var v = const C(const B());''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_fieldType_unresolved_null() {
+  test_fieldFormalParameterAssignableToField_fieldType_unresolved_null() async {
     // Null always passes runtime type checks, even when the type is
     // unresolved.
     Source source = addSource(r'''
@@ -48,12 +48,12 @@
   const A(String this.x);
 }
 var v = const A(null);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_implements() {
+  test_fieldFormalParameterAssignableToField_implements() async {
     // According to checked-mode type checking rules, a value of type B is
     // assignable to a field of type A, because B implements A (and hence is a
     // subtype of A).
@@ -67,36 +67,36 @@
   const C(this.a);
 }
 var v = const C(const B());''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_list_dynamic() {
+  test_fieldFormalParameterAssignableToField_list_dynamic() async {
     // [1, 2, 3] has type List<dynamic>, which is a subtype of List<int>.
     Source source = addSource(r'''
 class A {
   const A(List<int> x);
 }
 var x = const A(const [1, 2, 3]);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_list_nonDynamic() {
+  test_fieldFormalParameterAssignableToField_list_nonDynamic() async {
     // <int>[1, 2, 3] has type List<int>, which is a subtype of List<num>.
     Source source = addSource(r'''
 class A {
   const A(List<num> x);
 }
 var x = const A(const <int>[1, 2, 3]);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_map_dynamic() {
+  test_fieldFormalParameterAssignableToField_map_dynamic() async {
     // {1: 2} has type Map<dynamic, dynamic>, which is a subtype of
     // Map<int, int>.
     Source source = addSource(r'''
@@ -104,12 +104,12 @@
   const A(Map<int, int> x);
 }
 var x = const A(const {1: 2});''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_map_keyDifferent() {
+  test_fieldFormalParameterAssignableToField_map_keyDifferent() async {
     // <int, int>{1: 2} has type Map<int, int>, which is a subtype of
     // Map<num, int>.
     Source source = addSource(r'''
@@ -117,12 +117,12 @@
   const A(Map<num, int> x);
 }
 var x = const A(const <int, int>{1: 2});''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_map_valueDifferent() {
+  test_fieldFormalParameterAssignableToField_map_valueDifferent() async {
     // <int, int>{1: 2} has type Map<int, int>, which is a subtype of
     // Map<int, num>.
     Source source = addSource(r'''
@@ -130,12 +130,12 @@
   const A(Map<int, num> x);
 }
 var x = const A(const <int, int>{1: 2});''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_notype() {
+  test_fieldFormalParameterAssignableToField_notype() async {
     // If a field is declared without a type, then any value may be assigned to
     // it.
     Source source = addSource(r'''
@@ -144,12 +144,12 @@
   const A(this.x);
 }
 var v = const A(5);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_null() {
+  test_fieldFormalParameterAssignableToField_null() async {
     // Null is assignable to anything.
     Source source = addSource(r'''
 class A {
@@ -157,12 +157,12 @@
   const A(this.x);
 }
 var v = const A(null);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_typedef() {
+  test_fieldFormalParameterAssignableToField_typedef() async {
     // foo has the runtime type dynamic -> dynamic, so it should be assignable
     // to A.f.
     Source source = addSource(r'''
@@ -173,12 +173,12 @@
 }
 foo(x) => 1;
 var v = const A(foo);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterAssignableToField_typeSubstitution() {
+  test_fieldFormalParameterAssignableToField_typeSubstitution() async {
     // foo has the runtime type dynamic -> dynamic, so it should be assignable
     // to A.f.
     Source source = addSource(r'''
@@ -187,19 +187,19 @@
   const A(this.x);
 }
 var v = const A<int>(3);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField() {
+  test_fieldFormalParameterNotAssignableToField() async {
     Source source = addSource(r'''
 class A {
   final int x;
   const A(this.x);
 }
 var v = const A('foo');''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
@@ -207,7 +207,7 @@
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField_extends() {
+  test_fieldFormalParameterNotAssignableToField_extends() async {
     // According to checked-mode type checking rules, a value of type A is not
     // assignable to a field of type B, because B extends A (the subtyping
     // relationship is in the wrong direction).
@@ -223,21 +223,21 @@
   const C(this.b);
 }
 var v = const C(const A());''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
     ]);
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField_fieldType() {
+  test_fieldFormalParameterNotAssignableToField_fieldType() async {
     Source source = addSource(r'''
 class A {
   final int x;
   const A(String this.x);
 }
 var v = const A('foo');''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
       StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE
@@ -245,14 +245,14 @@
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField_fieldType_unresolved() {
+  test_fieldFormalParameterNotAssignableToField_fieldType_unresolved() async {
     Source source = addSource(r'''
 class A {
   final Unresolved x;
   const A(String this.x);
 }
 var v = const A('foo');''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
       StaticWarningCode.UNDEFINED_CLASS
@@ -260,7 +260,7 @@
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField_implements() {
+  test_fieldFormalParameterNotAssignableToField_implements() async {
     // According to checked-mode type checking rules, a value of type A is not
     // assignable to a field of type B, because B implements A (the subtyping
     // relationship is in the wrong direction).
@@ -274,28 +274,28 @@
   const C(this.b);
 }
 var v = const C(const A());''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
     ]);
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField_list() {
+  test_fieldFormalParameterNotAssignableToField_list() async {
     // <num>[1, 2, 3] has type List<num>, which is not a subtype of List<int>.
     Source source = addSource(r'''
 class A {
   const A(List<int> x);
 }
 var x = const A(const <num>[1, 2, 3]);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
     ]);
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField_map_keyMismatch() {
+  test_fieldFormalParameterNotAssignableToField_map_keyMismatch() async {
     // <num, int>{1: 2} has type Map<num, int>, which is not a subtype of
     // Map<int, int>.
     Source source = addSource(r'''
@@ -303,14 +303,14 @@
   const A(Map<int, int> x);
 }
 var x = const A(const <num, int>{1: 2});''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
     ]);
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField_map_valueMismatch() {
+  test_fieldFormalParameterNotAssignableToField_map_valueMismatch() async {
     // <int, num>{1: 2} has type Map<int, num>, which is not a subtype of
     // Map<int, int>.
     Source source = addSource(r'''
@@ -318,21 +318,21 @@
   const A(Map<int, int> x);
 }
 var x = const A(const <int, num>{1: 2});''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
     ]);
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField_optional() {
+  test_fieldFormalParameterNotAssignableToField_optional() async {
     Source source = addSource(r'''
 class A {
   final int x;
   const A([this.x = 'foo']);
 }
 var v = const A();''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
       StaticTypeWarningCode.INVALID_ASSIGNMENT
@@ -340,7 +340,7 @@
     verify([source]);
   }
 
-  void test_fieldFormalParameterNotAssignableToField_typedef() {
+  test_fieldFormalParameterNotAssignableToField_typedef() async {
     // foo has the runtime type String -> int, so it should not be assignable
     // to A.f (A.f requires it to be int -> String).
     Source source = addSource(r'''
@@ -351,7 +351,7 @@
 }
 int foo(String x) => 1;
 var v = const A(foo);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
@@ -359,13 +359,13 @@
     verify([source]);
   }
 
-  void test_fieldInitializerNotAssignable() {
+  test_fieldInitializerNotAssignable() async {
     Source source = addSource(r'''
 class A {
   final int x;
   const A() : x = '';
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_FIELD_INITIALIZER_NOT_ASSIGNABLE,
       StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE
@@ -373,21 +373,21 @@
     verify([source]);
   }
 
-  void test_fieldTypeMismatch() {
+  test_fieldTypeMismatch() async {
     Source source = addSource(r'''
 class A {
   const A(x) : y = x;
   final int y;
 }
 var v = const A('foo');''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH
     ]);
     verify([source]);
   }
 
-  void test_fieldTypeMismatch_generic() {
+  test_fieldTypeMismatch_generic() async {
     Source source = addSource(r'''
 class C<T> {
   final T x = y;
@@ -396,7 +396,7 @@
 const int y = 1;
 var v = const C<String>();
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH,
       StaticTypeWarningCode.INVALID_ASSIGNMENT
@@ -404,14 +404,14 @@
     verify([source]);
   }
 
-  void test_fieldTypeMismatch_unresolved() {
+  test_fieldTypeMismatch_unresolved() async {
     Source source = addSource(r'''
 class A {
   const A(x) : y = x;
   final Unresolved y;
 }
 var v = const A('foo');''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH,
       StaticWarningCode.UNDEFINED_CLASS
@@ -419,7 +419,7 @@
     verify([source]);
   }
 
-  void test_fieldTypeOk_generic() {
+  test_fieldTypeOk_generic() async {
     Source source = addSource(r'''
 class C<T> {
   final T x = y;
@@ -428,24 +428,24 @@
 const int y = 1;
 var v = const C<int>();
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
     verify([source]);
   }
 
-  void test_fieldTypeOk_null() {
+  test_fieldTypeOk_null() async {
     Source source = addSource(r'''
 class A {
   const A(x) : y = x;
   final int y;
 }
 var v = const A(null);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldTypeOk_unresolved_null() {
+  test_fieldTypeOk_unresolved_null() async {
     // Null always passes runtime type checks, even when the type is
     // unresolved.
     Source source = addSource(r'''
@@ -454,14 +454,14 @@
   final Unresolved y;
 }
 var v = const A(null);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
     verify([source]);
   }
 
-  void test_listElementTypeNotAssignable() {
+  test_listElementTypeNotAssignable() async {
     Source source = addSource("var v = const <String> [42];");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE,
       StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE
@@ -469,9 +469,9 @@
     verify([source]);
   }
 
-  void test_mapKeyTypeNotAssignable() {
+  test_mapKeyTypeNotAssignable() async {
     Source source = addSource("var v = const <String, int > {1 : 2};");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE,
       StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE
@@ -479,9 +479,9 @@
     verify([source]);
   }
 
-  void test_mapValueTypeNotAssignable() {
+  test_mapValueTypeNotAssignable() async {
     Source source = addSource("var v = const <String, String> {'a' : 2};");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE,
       StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE
@@ -489,30 +489,30 @@
     verify([source]);
   }
 
-  void test_parameterAssignable_null() {
+  test_parameterAssignable_null() async {
     // Null is assignable to anything.
     Source source = addSource(r'''
 class A {
   const A(int x);
 }
 var v = const A(null);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_parameterAssignable_typeSubstitution() {
+  test_parameterAssignable_typeSubstitution() async {
     Source source = addSource(r'''
 class A<T> {
   const A(T x);
 }
 var v = const A<int>(3);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_parameterAssignable_undefined_null() {
+  test_parameterAssignable_undefined_null() async {
     // Null always passes runtime type checks, even when the type is
     // unresolved.
     Source source = addSource(r'''
@@ -520,18 +520,18 @@
   const A(Unresolved x);
 }
 var v = const A(null);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
     verify([source]);
   }
 
-  void test_parameterNotAssignable() {
+  test_parameterNotAssignable() async {
     Source source = addSource(r'''
 class A {
   const A(int x);
 }
 var v = const A('foo');''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
@@ -539,13 +539,13 @@
     verify([source]);
   }
 
-  void test_parameterNotAssignable_typeSubstitution() {
+  test_parameterNotAssignable_typeSubstitution() async {
     Source source = addSource(r'''
 class A<T> {
   const A(T x);
 }
 var v = const A<int>('foo');''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
@@ -553,13 +553,13 @@
     verify([source]);
   }
 
-  void test_parameterNotAssignable_undefined() {
+  test_parameterNotAssignable_undefined() async {
     Source source = addSource(r'''
 class A {
   const A(Unresolved x);
 }
 var v = const A('foo');''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
       StaticWarningCode.UNDEFINED_CLASS
@@ -567,39 +567,39 @@
     verify([source]);
   }
 
-  void test_redirectingConstructor_paramTypeMismatch() {
+  test_redirectingConstructor_paramTypeMismatch() async {
     Source source = addSource(r'''
 class A {
   const A.a1(x) : this.a2(x);
   const A.a2(String x);
 }
 var v = const A.a1(0);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
     ]);
     verify([source]);
   }
 
-  void test_topLevelVarAssignable_null() {
+  test_topLevelVarAssignable_null() async {
     Source source = addSource("const int x = null;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_topLevelVarAssignable_undefined_null() {
+  test_topLevelVarAssignable_undefined_null() async {
     // Null always passes runtime type checks, even when the type is
     // unresolved.
     Source source = addSource("const Unresolved x = null;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
     verify([source]);
   }
 
-  void test_topLevelVarNotAssignable() {
+  test_topLevelVarNotAssignable() async {
     Source source = addSource("const int x = 'foo';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH,
       StaticTypeWarningCode.INVALID_ASSIGNMENT
@@ -607,9 +607,9 @@
     verify([source]);
   }
 
-  void test_topLevelVarNotAssignable_undefined() {
+  test_topLevelVarNotAssignable_undefined() async {
     Source source = addSource("const Unresolved x = 'foo';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CheckedModeCompileTimeErrorCode.VARIABLE_TYPE_MISMATCH,
       StaticWarningCode.UNDEFINED_CLASS
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart
new file mode 100644
index 0000000..c901d70
--- /dev/null
+++ b/pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'compile_time_error_code_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(CompileTimeErrorCodeTest_Driver);
+  });
+}
+
+@reflectiveTest
+class CompileTimeErrorCodeTest_Driver extends CompileTimeErrorCodeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index 4b4bf3d..aabfe67 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -4,6 +4,8 @@
 
 library analyzer.test.generated.compile_time_error_code_test;
 
+import 'dart:async';
+
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/generated/engine.dart';
@@ -22,7 +24,7 @@
 
 @reflectiveTest
 class CompileTimeErrorCodeTest extends ResolverTestCase {
-  void fail_awaitInWrongContext_sync() {
+  fail_awaitInWrongContext_sync() async {
     // This test requires better error recovery than we currently have. In
     // particular, we need to be able to distinguish between an await expression
     // in the wrong context, and the use of 'await' as an identifier.
@@ -30,12 +32,12 @@
 f(x) {
   return await x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
     verify([source]);
   }
 
-  void fail_awaitInWrongContext_syncStar() {
+  fail_awaitInWrongContext_syncStar() async {
     // This test requires better error recovery than we currently have. In
     // particular, we need to be able to distinguish between an await expression
     // in the wrong context, and the use of 'await' as an identifier.
@@ -43,24 +45,24 @@
 f(x) sync* {
   yield await x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
     verify([source]);
   }
 
-  void fail_constEvalThrowsException() {
+  fail_constEvalThrowsException() async {
     Source source = addSource(r'''
 class C {
   const C();
 }
 f() { return const C(); }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]);
     verify([source]);
   }
 
-  void fail_invalidIdentifierInAsync_async() {
+  fail_invalidIdentifierInAsync_async() async {
     // TODO(brianwilkerson) Report this error.
     Source source = addSource(r'''
 class A {
@@ -68,12 +70,12 @@
     int async;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
     verify([source]);
   }
 
-  void fail_invalidIdentifierInAsync_await() {
+  fail_invalidIdentifierInAsync_await() async {
     // TODO(brianwilkerson) Report this error.
     Source source = addSource(r'''
 class A {
@@ -81,12 +83,12 @@
     int await;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
     verify([source]);
   }
 
-  void fail_invalidIdentifierInAsync_yield() {
+  fail_invalidIdentifierInAsync_yield() async {
     // TODO(brianwilkerson) Report this error.
     Source source = addSource(r'''
 class A {
@@ -94,109 +96,109 @@
     int yield;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
     verify([source]);
   }
 
-  void fail_mixinDeclaresConstructor() {
+  fail_mixinDeclaresConstructor() async {
     Source source = addSource(r'''
 class A {
   A() {}
 }
 class B extends Object mixin A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void fail_mixinOfNonClass() {
+  fail_mixinOfNonClass() async {
     // TODO(brianwilkerson) Compare with MIXIN_WITH_NON_CLASS_SUPERCLASS.
     Source source = addSource(r'''
 var A;
 class B extends Object mixin A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
     verify([source]);
   }
 
-  void fail_objectCannotExtendAnotherClass() {
+  fail_objectCannotExtendAnotherClass() async {
     Source source = addSource(r'''
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]);
     verify([source]);
   }
 
-  void fail_superInitializerInObject() {
+  fail_superInitializerInObject() async {
     Source source = addSource(r'''
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]);
     verify([source]);
   }
 
-  void fail_yieldEachInNonGenerator_async() {
+  fail_yieldEachInNonGenerator_async() async {
     // TODO(brianwilkerson) We are currently parsing the yield statement as a
     // binary expression.
     Source source = addSource(r'''
 f() async {
   yield* 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
     verify([source]);
   }
 
-  void fail_yieldEachInNonGenerator_sync() {
+  fail_yieldEachInNonGenerator_sync() async {
     // TODO(brianwilkerson) We are currently parsing the yield statement as a
     // binary expression.
     Source source = addSource(r'''
 f() {
   yield* 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
     verify([source]);
   }
 
-  void fail_yieldInNonGenerator_async() {
+  fail_yieldInNonGenerator_async() async {
     // TODO(brianwilkerson) We are currently trying to parse the yield statement
     // as a binary expression.
     Source source = addSource(r'''
 f() async {
   yield 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
     verify([source]);
   }
 
-  void fail_yieldInNonGenerator_sync() {
+  fail_yieldInNonGenerator_sync() async {
     // TODO(brianwilkerson) We are currently trying to parse the yield statement
     // as a binary expression.
     Source source = addSource(r'''
 f() {
   yield 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
     verify([source]);
   }
 
-  void test_accessPrivateEnumField() {
+  test_accessPrivateEnumField() async {
     Source source = addSource(r'''
 enum E { ONE }
 String name(E e) {
   return e._name;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.ACCESS_PRIVATE_ENUM_FIELD]);
     // Cannot verify because "_name" cannot be resolved.
   }
 
-  void test_ambiguousExport() {
+  test_ambiguousExport() async {
     Source source = addSource(r'''
 library L;
 export 'lib1.dart';
@@ -211,12 +213,12 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.AMBIGUOUS_EXPORT]);
     verify([source]);
   }
 
-  void test_annotationWithNotClass() {
+  test_annotationWithNotClass() async {
     Source source = addSource('''
 class Property {
   final int value;
@@ -229,12 +231,12 @@
 main() {
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
     verify([source]);
   }
 
-  void test_annotationWithNotClass_prefixed() {
+  test_annotationWithNotClass_prefixed() async {
     addNamedSource(
         "/annotations.dart",
         r'''
@@ -251,25 +253,12 @@
 main() {
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.ANNOTATION_WITH_NON_CLASS]);
     verify([source]);
   }
 
-  void test_assertWithExtraArgument() {
-    // TODO(paulberry): once DEP 37 is turned on by default, this test should
-    // be removed.
-    Source source = addSource('''
-f(bool x) {
-  assert(x, 'foo');
-}
-''');
-    computeLibrarySourceErrors(source);
-    assertErrors(source, [CompileTimeErrorCode.EXTRA_ARGUMENT_TO_ASSERT]);
-    verify([source]);
-  }
-
-  void test_async_used_as_identifier_in_annotation() {
+  test_async_used_as_identifier_in_annotation() async {
     Source source = addSource('''
 const int async = 0;
 f() async {
@@ -277,12 +266,12 @@
   g(0);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_argument_label() {
+  test_async_used_as_identifier_in_argument_label() async {
     Source source = addSource('''
 @proxy
 class C {}
@@ -290,35 +279,35 @@
   new C().g(async: 0);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     // Note: we don't call verify([source]) because verify() doesn't understand
     // about @proxy.
   }
 
-  void test_async_used_as_identifier_in_async_method() {
+  test_async_used_as_identifier_in_async_method() async {
     Source source = addSource('''
 f() async {
   var async = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_async_star_method() {
+  test_async_used_as_identifier_in_async_star_method() async {
     Source source = addSource('''
 f() async* {
   var async = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_break_statement() {
+  test_async_used_as_identifier_in_break_statement() async {
     Source source = addSource('''
 f() async {
   while (true) {
@@ -326,7 +315,7 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER,
       CompileTimeErrorCode.LABEL_UNDEFINED
@@ -335,7 +324,7 @@
     // "async" label is unresolved.
   }
 
-  void test_async_used_as_identifier_in_cascaded_invocation() {
+  test_async_used_as_identifier_in_cascaded_invocation() async {
     Source source = addSource('''
 class C {
   int async() => 1;
@@ -344,12 +333,12 @@
   return new C()..async();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_cascaded_setter_invocation() {
+  test_async_used_as_identifier_in_cascaded_setter_invocation() async {
     Source source = addSource('''
 class C {
   void set async(int i) {}
@@ -358,12 +347,12 @@
   return new C()..async = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_catch_exception_argument() {
+  test_async_used_as_identifier_in_catch_exception_argument() async {
     Source source = addSource('''
 g() {}
 f() async {
@@ -372,12 +361,12 @@
   } catch (async) { }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_catch_stacktrace_argument() {
+  test_async_used_as_identifier_in_catch_stacktrace_argument() async {
     Source source = addSource('''
 g() {}
 f() async {
@@ -386,12 +375,12 @@
   } catch (e, async) { }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_continue_statement() {
+  test_async_used_as_identifier_in_continue_statement() async {
     Source source = addSource('''
 f() async {
   while (true) {
@@ -399,7 +388,7 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER,
       CompileTimeErrorCode.LABEL_UNDEFINED
@@ -408,31 +397,31 @@
     // "async" label is unresolved.
   }
 
-  void test_async_used_as_identifier_in_for_statement() {
+  test_async_used_as_identifier_in_for_statement() async {
     Source source = addSource('''
 var async;
 f() async {
   for (async in []) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_formal_parameter_name() {
+  test_async_used_as_identifier_in_formal_parameter_name() async {
     Source source = addSource('''
 f() async {
   g(int async) {}
   g(0);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_getter_name() {
+  test_async_used_as_identifier_in_getter_name() async {
     Source source = addSource('''
 class C {
   int get async => 1;
@@ -441,12 +430,12 @@
   return new C().async;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_invocation() {
+  test_async_used_as_identifier_in_invocation() async {
     Source source = addSource('''
 class C {
   int async() => 1;
@@ -455,35 +444,35 @@
   return new C().async();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_local_function_name() {
+  test_async_used_as_identifier_in_local_function_name() async {
     Source source = addSource('''
 f() async {
   int async() => null;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_prefix() {
+  test_async_used_as_identifier_in_prefix() async {
     Source source = addSource('''
 import 'dart:async' as async;
 f() async {
   return new async.Future.value(0);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_setter_name() {
+  test_async_used_as_identifier_in_setter_name() async {
     Source source = addSource('''
 class C {
   void set async(int i) {}
@@ -492,36 +481,36 @@
   new C().async = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_statement_label() {
+  test_async_used_as_identifier_in_statement_label() async {
     Source source = addSource('''
 f() async {
   async: g();
 }
 g() {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_string_interpolation() {
+  test_async_used_as_identifier_in_string_interpolation() async {
     Source source = addSource(r'''
 int async = 1;
 f() async {
   return "$async";
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_suffix() {
+  test_async_used_as_identifier_in_suffix() async {
     addNamedSource(
         "/lib1.dart",
         r'''
@@ -534,12 +523,12 @@
   return l.async;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_switch_label() {
+  test_async_used_as_identifier_in_switch_label() async {
     Source source = addSource('''
 f() async {
   switch (0) {
@@ -547,67 +536,67 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_async_used_as_identifier_in_sync_star_method() {
+  test_async_used_as_identifier_in_sync_star_method() async {
     Source source = addSource('''
 f() sync* {
   var async = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_asyncForInWrongContext() {
+  test_asyncForInWrongContext() async {
     Source source = addSource(r'''
 f(list) {
   await for (var e in list) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.ASYNC_FOR_IN_WRONG_CONTEXT]);
     verify([source]);
   }
 
-  void test_await_used_as_identifier_in_async_method() {
+  test_await_used_as_identifier_in_async_method() async {
     Source source = addSource('''
 f() async {
   var await = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_await_used_as_identifier_in_async_star_method() {
+  test_await_used_as_identifier_in_async_star_method() async {
     Source source = addSource('''
 f() async* {
   var await = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_await_used_as_identifier_in_sync_star_method() {
+  test_await_used_as_identifier_in_sync_star_method() async {
     Source source = addSource('''
 f() sync* {
   var await = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_bug_23176() {
+  test_bug_23176() async {
     Source source = addSource('''
 class A {
   const A([x]);
@@ -616,7 +605,7 @@
   dynamic @A(const A()) x;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       ParserErrorCode.EXPECTED_CLASS_MEMBER,
       ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE
@@ -624,72 +613,72 @@
     verify([source]);
   }
 
-  void test_builtInIdentifierAsMixinName_classTypeAlias() {
+  test_builtInIdentifierAsMixinName_classTypeAlias() async {
     Source source = addSource(r'''
 class A {}
 class B {}
 class as = A with B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]);
     verify([source]);
   }
 
-  void test_builtInIdentifierAsType_formalParameter_field() {
+  test_builtInIdentifierAsType_formalParameter_field() async {
     Source source = addSource(r'''
 class A {
   var x;
   A(static this.x);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
     verify([source]);
   }
 
-  void test_builtInIdentifierAsType_formalParameter_simple() {
+  test_builtInIdentifierAsType_formalParameter_simple() async {
     Source source = addSource(r'''
 f(static x) {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
     verify([source]);
   }
 
-  void test_builtInIdentifierAsType_variableDeclaration() {
+  test_builtInIdentifierAsType_variableDeclaration() async {
     Source source = addSource(r'''
 f() {
   typedef x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE]);
     verify([source]);
   }
 
-  void test_builtInIdentifierAsTypedefName_functionTypeAlias() {
+  test_builtInIdentifierAsTypedefName_functionTypeAlias() async {
     Source source = addSource("typedef bool as();");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]);
     verify([source]);
   }
 
-  void test_builtInIdentifierAsTypeName() {
+  test_builtInIdentifierAsTypeName() async {
     Source source = addSource("class as {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]);
     verify([source]);
   }
 
-  void test_builtInIdentifierAsTypeParameterName() {
+  test_builtInIdentifierAsTypeParameterName() async {
     Source source = addSource("class A<as> {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME]);
     verify([source]);
   }
 
-  void test_caseExpressionTypeImplementsEquals() {
+  test_caseExpressionTypeImplementsEquals() async {
     Source source = addSource(r'''
 class IntWrapper {
   final int value;
@@ -706,37 +695,49 @@
     default: return 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
     verify([source]);
   }
 
-  void test_conflictingConstructorNameAndMember_field() {
+  test_conflictingConstructorNameAndMember_field() async {
     Source source = addSource(r'''
 class A {
   int x;
   A.x() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
     verify([source]);
   }
 
-  void test_conflictingConstructorNameAndMember_method() {
+  test_conflictingConstructorNameAndMember_getter() async {
+    Source source = addSource(r'''
+class A {
+  int get x => 42;
+  A.x() {}
+}''');
+    await computeAnalysisResult(source);
+    assertErrors(
+        source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD]);
+    verify([source]);
+  }
+
+  test_conflictingConstructorNameAndMember_method() async {
     Source source = addSource(r'''
 class A {
   const A.x();
   void x() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD]);
     verify([source]);
   }
 
-  void test_conflictingGetterAndMethod_field_method() {
+  test_conflictingGetterAndMethod_field_method() async {
     Source source = addSource(r'''
 class A {
   final int m = 0;
@@ -744,12 +745,12 @@
 class B extends A {
   m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
     verify([source]);
   }
 
-  void test_conflictingGetterAndMethod_getter_method() {
+  test_conflictingGetterAndMethod_getter_method() async {
     Source source = addSource(r'''
 class A {
   get m => 0;
@@ -757,12 +758,12 @@
 class B extends A {
   m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD]);
     verify([source]);
   }
 
-  void test_conflictingGetterAndMethod_method_field() {
+  test_conflictingGetterAndMethod_method_field() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -770,12 +771,12 @@
 class B extends A {
   int m;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
     verify([source]);
   }
 
-  void test_conflictingGetterAndMethod_method_getter() {
+  test_conflictingGetterAndMethod_method_getter() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -783,77 +784,77 @@
 class B extends A {
   get m => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER]);
     verify([source]);
   }
 
-  void test_conflictingTypeVariableAndClass() {
+  test_conflictingTypeVariableAndClass() async {
     Source source = addSource(r'''
 class T<T> {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS]);
     verify([source]);
   }
 
-  void test_conflictingTypeVariableAndMember_field() {
+  test_conflictingTypeVariableAndMember_field() async {
     Source source = addSource(r'''
 class A<T> {
   var T;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingTypeVariableAndMember_getter() {
+  test_conflictingTypeVariableAndMember_getter() async {
     Source source = addSource(r'''
 class A<T> {
   get T => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingTypeVariableAndMember_method() {
+  test_conflictingTypeVariableAndMember_method() async {
     Source source = addSource(r'''
 class A<T> {
   T() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingTypeVariableAndMember_method_static() {
+  test_conflictingTypeVariableAndMember_method_static() async {
     Source source = addSource(r'''
 class A<T> {
   static T() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingTypeVariableAndMember_setter() {
+  test_conflictingTypeVariableAndMember_setter() async {
     Source source = addSource(r'''
 class A<T> {
   set T(x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER]);
     verify([source]);
   }
 
-  void test_consistentCaseExpressionTypes_dynamic() {
+  test_consistentCaseExpressionTypes_dynamic() async {
     // Even though A.S and S have a static type of "dynamic", we should see
     // that they match 'abc', because they are constant strings.
     Source source = addSource(r'''
@@ -873,12 +874,12 @@
       break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constConstructorWithFieldInitializedByNonConst() {
+  test_constConstructorWithFieldInitializedByNonConst() async {
     Source source = addSource(r'''
 class A {
   final int i = f();
@@ -887,9 +888,9 @@
 int f() {
   return 3;
 }''');
-    computeLibrarySourceErrors(source);
     // TODO(paulberry): the error CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE is
     // redundant and ought to be suppressed.
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode
           .CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST,
@@ -898,7 +899,7 @@
     verify([source]);
   }
 
-  void test_constConstructorWithFieldInitializedByNonConst_static() {
+  test_constConstructorWithFieldInitializedByNonConst_static() async {
     Source source = addSource(r'''
 class A {
   static final int i = f();
@@ -907,24 +908,24 @@
 int f() {
   return 3;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constConstructorWithMixin() {
+  test_constConstructorWithMixin() async {
     Source source = addSource(r'''
 class M {
 }
 class A extends Object with M {
   const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN]);
     verify([source]);
   }
 
-  void test_constConstructorWithNonConstSuper_explicit() {
+  test_constConstructorWithNonConstSuper_explicit() async {
     Source source = addSource(r'''
 class A {
   A();
@@ -932,13 +933,13 @@
 class B extends A {
   const B(): super();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
     verify([source]);
   }
 
-  void test_constConstructorWithNonConstSuper_implicit() {
+  test_constConstructorWithNonConstSuper_implicit() async {
     Source source = addSource(r'''
 class A {
   A();
@@ -946,13 +947,13 @@
 class B extends A {
   const B();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER]);
     verify([source]);
   }
 
-  void test_constConstructorWithNonFinalField_mixin() {
+  test_constConstructorWithNonFinalField_mixin() async {
     Source source = addSource(r'''
 class A {
   var a;
@@ -960,7 +961,7 @@
 class B extends Object with A {
   const B();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN,
       CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD
@@ -968,7 +969,7 @@
     verify([source]);
   }
 
-  void test_constConstructorWithNonFinalField_super() {
+  test_constConstructorWithNonFinalField_super() async {
     Source source = addSource(r'''
 class A {
   var a;
@@ -976,7 +977,7 @@
 class B extends A {
   const B();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD,
       CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_CONST_SUPER
@@ -984,20 +985,20 @@
     verify([source]);
   }
 
-  void test_constConstructorWithNonFinalField_this() {
+  test_constConstructorWithNonFinalField_this() async {
     Source source = addSource(r'''
 class A {
   int x;
   const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD]);
     verify([source]);
   }
 
-  void test_constDeferredClass() {
-    resolveWithErrors(<String>[
+  test_constDeferredClass() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {
@@ -1014,8 +1015,8 @@
     ]);
   }
 
-  void test_constDeferredClass_namedConstructor() {
-    resolveWithErrors(<String>[
+  test_constDeferredClass_namedConstructor() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {
@@ -1032,19 +1033,19 @@
     ]);
   }
 
-  void test_constEval_newInstance_constConstructor() {
+  test_constEval_newInstance_constConstructor() async {
     Source source = addSource(r'''
 class A {
   const A();
 }
 const a = new A();''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
     verify([source]);
   }
 
-  void test_constEval_newInstance_externalFactoryConstConstructor() {
+  test_constEval_newInstance_externalFactoryConstConstructor() async {
     // We can't evaluate "const A()" because its constructor is external.  But
     // the code is correct--we shouldn't report an error.
     Source source = addSource(r'''
@@ -1052,12 +1053,12 @@
   external factory const A();
 }
 const x = const A();''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constEval_nonStaticField_inGenericClass() {
+  test_constEval_nonStaticField_inGenericClass() async {
     Source source = addSource('''
 class C<T> {
   const C();
@@ -1065,13 +1066,13 @@
 }
 
 const x = const C().t;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
     verify([source]);
   }
 
-  void test_constEval_propertyExtraction_targetNotConst() {
+  test_constEval_propertyExtraction_targetNotConst() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1079,30 +1080,30 @@
 }
 final a = const A();
 const C = a.m;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
     verify([source]);
   }
 
-  void test_constEvalThrowsException_binaryMinus_null() {
-    _check_constEvalThrowsException_binary_null("null - 5", false);
-    _check_constEvalThrowsException_binary_null("5 - null", true);
+  test_constEvalThrowsException_binaryMinus_null() async {
+    await _check_constEvalThrowsException_binary_null("null - 5", false);
+    await _check_constEvalThrowsException_binary_null("5 - null", true);
   }
 
-  void test_constEvalThrowsException_binaryPlus_null() {
-    _check_constEvalThrowsException_binary_null("null + 5", false);
-    _check_constEvalThrowsException_binary_null("5 + null", true);
+  test_constEvalThrowsException_binaryPlus_null() async {
+    await _check_constEvalThrowsException_binary_null("null + 5", false);
+    await _check_constEvalThrowsException_binary_null("5 + null", true);
   }
 
-  void test_constEvalThrowsException_divisionByZero() {
+  test_constEvalThrowsException_divisionByZero() async {
     Source source = addSource("const C = 1 ~/ 0;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE]);
     verify([source]);
   }
 
-  void test_constEvalThrowsException_finalAlreadySet_initializer() {
+  test_constEvalThrowsException_finalAlreadySet_initializer() async {
     // If a final variable has an initializer at the site of its declaration,
     // and at the site of the constructor, then invoking that constructor would
     // produce a runtime error; hence invoking that constructor via the "const"
@@ -1114,7 +1115,7 @@
 }
 var x = const C();
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
       StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION
@@ -1122,7 +1123,7 @@
     verify([source]);
   }
 
-  void test_constEvalThrowsException_finalAlreadySet_initializing_formal() {
+  test_constEvalThrowsException_finalAlreadySet_initializing_formal() async {
     // If a final variable has an initializer at the site of its declaration,
     // and it is initialized using an initializing formal at the site of the
     // constructor, then invoking that constructor would produce a runtime
@@ -1135,7 +1136,7 @@
 }
 var x = const C(2);
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
       StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR
@@ -1143,35 +1144,35 @@
     verify([source]);
   }
 
-  void test_constEvalThrowsException_unaryBitNot_null() {
+  test_constEvalThrowsException_unaryBitNot_null() async {
     Source source = addSource("const C = ~null;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
     // no verify(), '~null' is not resolved
   }
 
-  void test_constEvalThrowsException_unaryNegated_null() {
+  test_constEvalThrowsException_unaryNegated_null() async {
     Source source = addSource("const C = -null;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
     // no verify(), '-null' is not resolved
   }
 
-  void test_constEvalThrowsException_unaryNot_null() {
+  test_constEvalThrowsException_unaryNot_null() async {
     Source source = addSource("const C = !null;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
     verify([source]);
   }
 
-  void test_constEvalTypeBool_binary() {
-    _check_constEvalTypeBool_withParameter_binary("p && ''");
-    _check_constEvalTypeBool_withParameter_binary("p || ''");
+  test_constEvalTypeBool_binary() async {
+    await _check_constEvalTypeBool_withParameter_binary("p && ''");
+    await _check_constEvalTypeBool_withParameter_binary("p || ''");
   }
 
-  void test_constEvalTypeBool_binary_leftTrue() {
+  test_constEvalTypeBool_binary_leftTrue() async {
     Source source = addSource("const C = (true || 0);");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
       StaticTypeWarningCode.NON_BOOL_OPERAND,
@@ -1180,7 +1181,7 @@
     verify([source]);
   }
 
-  void test_constEvalTypeBoolNumString_equal() {
+  test_constEvalTypeBoolNumString_equal() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1189,13 +1190,13 @@
   final a;
   const B(num p) : a = p == const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]);
     verify([source]);
   }
 
-  void test_constEvalTypeBoolNumString_notEqual() {
+  test_constEvalTypeBoolNumString_notEqual() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1204,63 +1205,63 @@
   final a;
   const B(String p) : a = p != const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING]);
     verify([source]);
   }
 
-  void test_constEvalTypeInt_binary() {
-    _check_constEvalTypeInt_withParameter_binary("p ^ ''");
-    _check_constEvalTypeInt_withParameter_binary("p & ''");
-    _check_constEvalTypeInt_withParameter_binary("p | ''");
-    _check_constEvalTypeInt_withParameter_binary("p >> ''");
-    _check_constEvalTypeInt_withParameter_binary("p << ''");
+  test_constEvalTypeInt_binary() async {
+    await _check_constEvalTypeInt_withParameter_binary("p ^ ''");
+    await _check_constEvalTypeInt_withParameter_binary("p & ''");
+    await _check_constEvalTypeInt_withParameter_binary("p | ''");
+    await _check_constEvalTypeInt_withParameter_binary("p >> ''");
+    await _check_constEvalTypeInt_withParameter_binary("p << ''");
   }
 
-  void test_constEvalTypeNum_binary() {
-    _check_constEvalTypeNum_withParameter_binary("p + ''");
-    _check_constEvalTypeNum_withParameter_binary("p - ''");
-    _check_constEvalTypeNum_withParameter_binary("p * ''");
-    _check_constEvalTypeNum_withParameter_binary("p / ''");
-    _check_constEvalTypeNum_withParameter_binary("p ~/ ''");
-    _check_constEvalTypeNum_withParameter_binary("p > ''");
-    _check_constEvalTypeNum_withParameter_binary("p < ''");
-    _check_constEvalTypeNum_withParameter_binary("p >= ''");
-    _check_constEvalTypeNum_withParameter_binary("p <= ''");
-    _check_constEvalTypeNum_withParameter_binary("p % ''");
+  test_constEvalTypeNum_binary() async {
+    await _check_constEvalTypeNum_withParameter_binary("p + ''");
+    await _check_constEvalTypeNum_withParameter_binary("p - ''");
+    await _check_constEvalTypeNum_withParameter_binary("p * ''");
+    await _check_constEvalTypeNum_withParameter_binary("p / ''");
+    await _check_constEvalTypeNum_withParameter_binary("p ~/ ''");
+    await _check_constEvalTypeNum_withParameter_binary("p > ''");
+    await _check_constEvalTypeNum_withParameter_binary("p < ''");
+    await _check_constEvalTypeNum_withParameter_binary("p >= ''");
+    await _check_constEvalTypeNum_withParameter_binary("p <= ''");
+    await _check_constEvalTypeNum_withParameter_binary("p % ''");
   }
 
-  void test_constFormalParameter_fieldFormalParameter() {
+  test_constFormalParameter_fieldFormalParameter() async {
     Source source = addSource(r'''
 class A {
   var x;
   A(const this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
     verify([source]);
   }
 
-  void test_constFormalParameter_simpleFormalParameter() {
+  test_constFormalParameter_simpleFormalParameter() async {
     Source source = addSource("f(const x) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_FORMAL_PARAMETER]);
     verify([source]);
   }
 
-  void test_constInitializedWithNonConstValue() {
+  test_constInitializedWithNonConstValue() async {
     Source source = addSource(r'''
 f(p) {
   const C = p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
     verify([source]);
   }
 
-  void test_constInitializedWithNonConstValue_finalField() {
+  test_constInitializedWithNonConstValue_finalField() async {
     // Regression test for bug #25526 which previously
     // caused two errors to be reported.
     Source source = addSource(r'''
@@ -1269,29 +1270,29 @@
   foo([int x = field]) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
     verify([source]);
   }
 
-  void test_constInitializedWithNonConstValue_missingConstInListLiteral() {
+  test_constInitializedWithNonConstValue_missingConstInListLiteral() async {
     Source source = addSource("const List L = [0];");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
     verify([source]);
   }
 
-  void test_constInitializedWithNonConstValue_missingConstInMapLiteral() {
+  test_constInitializedWithNonConstValue_missingConstInMapLiteral() async {
     Source source = addSource("const Map M = {'a' : 0};");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
     verify([source]);
   }
 
-  void test_constInitializedWithNonConstValueFromDeferredClass() {
-    resolveWithErrors(<String>[
+  test_constInitializedWithNonConstValueFromDeferredClass() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const V = 1;''',
@@ -1305,8 +1306,8 @@
     ]);
   }
 
-  void test_constInitializedWithNonConstValueFromDeferredClass_nested() {
-    resolveWithErrors(<String>[
+  test_constInitializedWithNonConstValueFromDeferredClass_nested() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const V = 1;''',
@@ -1320,17 +1321,17 @@
     ]);
   }
 
-  void test_constInstanceField() {
+  test_constInstanceField() async {
     Source source = addSource(r'''
 class C {
   const int f = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_INSTANCE_FIELD]);
     verify([source]);
   }
 
-  void test_constMapKeyTypeImplementsEquals_direct() {
+  test_constMapKeyTypeImplementsEquals_direct() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1339,13 +1340,13 @@
 main() {
   const {const A() : 0};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
     verify([source]);
   }
 
-  void test_constMapKeyTypeImplementsEquals_dynamic() {
+  test_constMapKeyTypeImplementsEquals_dynamic() async {
     // Note: static type of B.a is "dynamic", but actual type of the const
     // object is A.  We need to make sure we examine the actual type when
     // deciding whether there is a problem with operator==.
@@ -1360,13 +1361,13 @@
 main() {
   const {B.a : 0};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
     verify([source]);
   }
 
-  void test_constMapKeyTypeImplementsEquals_factory() {
+  test_constMapKeyTypeImplementsEquals_factory() async {
     Source source = addSource(r'''
 class A { const factory A() = B; }
 
@@ -1379,13 +1380,13 @@
 main() {
   var m = const { const A(): 42 };
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
     verify([source]);
   }
 
-  void test_constMapKeyTypeImplementsEquals_super() {
+  test_constMapKeyTypeImplementsEquals_super() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1397,25 +1398,25 @@
 main() {
   const {const B() : 0};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
     verify([source]);
   }
 
-  void test_constWithInvalidTypeParameters() {
+  test_constWithInvalidTypeParameters() async {
     Source source = addSource(r'''
 class A {
   const A();
 }
 f() { return const A<A>(); }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
     verify([source]);
   }
 
-  void test_constWithInvalidTypeParameters_tooFew() {
+  test_constWithInvalidTypeParameters_tooFew() async {
     Source source = addSource(r'''
 class A {}
 class C<K, V> {
@@ -1424,13 +1425,13 @@
 f(p) {
   return const C<A>();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
     verify([source]);
   }
 
-  void test_constWithInvalidTypeParameters_tooMany() {
+  test_constWithInvalidTypeParameters_tooMany() async {
     Source source = addSource(r'''
 class A {}
 class C<E> {
@@ -1439,24 +1440,24 @@
 f(p) {
   return const C<A, A>();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_WITH_INVALID_TYPE_PARAMETERS]);
     verify([source]);
   }
 
-  void test_constWithNonConst() {
+  test_constWithNonConst() async {
     Source source = addSource(r'''
 class T {
   T(a, b, {c, d}) {}
 }
 f() { return const T(0, 1, c: 2, d: 3); }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
     verify([source]);
   }
 
-  void test_constWithNonConst_with() {
+  test_constWithNonConst_with() async {
     Source source = addSource(r'''
 class B {
   const B();
@@ -1468,12 +1469,12 @@
   print(x);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_CONST]);
     verify([source]);
   }
 
-  void test_constWithNonConstantArgument_annotation() {
+  test_constWithNonConstantArgument_annotation() async {
     Source source = addSource(r'''
 class A {
   const A(int p);
@@ -1482,21 +1483,21 @@
 @A(v)
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT]);
     verify([source]);
   }
 
-  void test_constWithNonConstantArgument_instanceCreation() {
+  test_constWithNonConstantArgument_instanceCreation() async {
     Source source = addSource(r'''
 class A {
   const A(a);
 }
 f(p) { return const A(p); }''');
-    computeLibrarySourceErrors(source);
     // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be
     // suppressed.
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT,
       CompileTimeErrorCode.INVALID_CONSTANT
@@ -1504,18 +1505,18 @@
     verify([source]);
   }
 
-  void test_constWithNonType() {
+  test_constWithNonType() async {
     Source source = addSource(r'''
 int A;
 f() {
   return const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
     verify([source]);
   }
 
-  void test_constWithNonType_fromLibrary() {
+  test_constWithNonType_fromLibrary() async {
     Source source1 = addNamedSource("/lib.dart", "");
     Source source2 = addNamedSource(
         "/lib2.dart",
@@ -1524,19 +1525,19 @@
 void f() {
   const lib.A();
 }''');
-    computeLibrarySourceErrors(source1);
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source1);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [CompileTimeErrorCode.CONST_WITH_NON_TYPE]);
     verify([source1]);
   }
 
-  void test_constWithTypeParameters_direct() {
+  test_constWithTypeParameters_direct() async {
     Source source = addSource(r'''
 class A<T> {
   static const V = const A<T>();
   const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
       StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
@@ -1544,13 +1545,13 @@
     verify([source]);
   }
 
-  void test_constWithTypeParameters_indirect() {
+  test_constWithTypeParameters_indirect() async {
     Source source = addSource(r'''
 class A<T> {
   static const V = const A<List<T>>();
   const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
       StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
@@ -1558,7 +1559,7 @@
     verify([source]);
   }
 
-  void test_constWithUndefinedConstructor() {
+  test_constWithUndefinedConstructor() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1566,13 +1567,13 @@
 f() {
   return const A.noSuchConstructor();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR]);
     // no verify(), 'noSuchConstructor' is not resolved
   }
 
-  void test_constWithUndefinedConstructorDefault() {
+  test_constWithUndefinedConstructorDefault() async {
     Source source = addSource(r'''
 class A {
   const A.name();
@@ -1580,37 +1581,37 @@
 f() {
   return const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]);
     verify([source]);
   }
 
-  void test_defaultValueInFunctionTypeAlias() {
+  test_defaultValueInFunctionTypeAlias() async {
     Source source = addSource("typedef F([x = 0]);");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS]);
     verify([source]);
   }
 
-  void test_defaultValueInFunctionTypedParameter_named() {
+  test_defaultValueInFunctionTypedParameter_named() async {
     Source source = addSource("f(g({p: null})) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
     verify([source]);
   }
 
-  void test_defaultValueInFunctionTypedParameter_optional() {
+  test_defaultValueInFunctionTypedParameter_optional() async {
     Source source = addSource("f(g([p = null])) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER]);
     verify([source]);
   }
 
-  void test_defaultValueInRedirectingFactoryConstructor() {
+  test_defaultValueInRedirectingFactoryConstructor() async {
     Source source = addSource(r'''
 class A {
   factory A([int x = 0]) = B;
@@ -1619,20 +1620,20 @@
 class B implements A {
   B([int x = 1]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR
     ]);
     verify([source]);
   }
 
-  void test_duplicateConstructorName_named() {
+  test_duplicateConstructorName_named() async {
     Source source = addSource(r'''
 class A {
   A.a() {}
   A.a() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME,
       CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_NAME
@@ -1640,13 +1641,13 @@
     verify([source]);
   }
 
-  void test_duplicateConstructorName_unnamed() {
+  test_duplicateConstructorName_unnamed() async {
     Source source = addSource(r'''
 class A {
   A() {}
   A() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT,
       CompileTimeErrorCode.DUPLICATE_CONSTRUCTOR_DEFAULT
@@ -1654,7 +1655,7 @@
     verify([source]);
   }
 
-  void test_duplicateDefinition_acrossLibraries() {
+  test_duplicateDefinition_acrossLibraries() async {
     Source librarySource = addNamedSource(
         "/lib.dart",
         r'''
@@ -1674,56 +1675,58 @@
 part of lib;
 
 class A {}''');
-    computeLibrarySourceErrors(librarySource);
-    assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
+    await computeAnalysisResult(librarySource);
+    await computeAnalysisResult(sourceA);
+    await computeAnalysisResult(sourceB);
     assertNoErrors(librarySource);
+    assertErrors(sourceB, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([librarySource, sourceA, sourceB]);
   }
 
-  void test_duplicateDefinition_catch() {
+  test_duplicateDefinition_catch() async {
     Source source = addSource(r'''
 main() {
   try {} catch (e, e) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_classMembers_fields() {
+  test_duplicateDefinition_classMembers_fields() async {
     Source source = addSource(r'''
 class A {
   int a;
   int a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_classMembers_fields_oneStatic() {
+  test_duplicateDefinition_classMembers_fields_oneStatic() async {
     Source source = addSource(r'''
 class A {
   int x;
   static int x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_classMembers_methods() {
+  test_duplicateDefinition_classMembers_methods() async {
     Source source = addSource(r'''
 class A {
   m() {}
   m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_inPart() {
+  test_duplicateDefinition_inPart() async {
     Source librarySource = addNamedSource(
         "/lib.dart",
         r'''
@@ -1735,13 +1738,14 @@
         r'''
 part of test;
 class A {}''');
-    computeLibrarySourceErrors(librarySource);
-    assertErrors(sourceA, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
+    await computeAnalysisResult(librarySource);
+    await computeAnalysisResult(sourceA);
     assertNoErrors(librarySource);
+    assertErrors(sourceA, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([librarySource, sourceA]);
   }
 
-  void test_duplicateDefinition_locals_inCase() {
+  test_duplicateDefinition_locals_inCase() async {
     Source source = addSource(r'''
 main() {
   switch(1) {
@@ -1750,23 +1754,23 @@
       var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_locals_inFunctionBlock() {
+  test_duplicateDefinition_locals_inFunctionBlock() async {
     Source source = addSource(r'''
 main() {
   int m = 0;
   m(a) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_locals_inIf() {
+  test_duplicateDefinition_locals_inIf() async {
     Source source = addSource(r'''
 main(int p) {
   if (p != 0) {
@@ -1774,12 +1778,12 @@
     var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_locals_inMethodBlock() {
+  test_duplicateDefinition_locals_inMethodBlock() async {
     Source source = addSource(r'''
 class A {
   m() {
@@ -1787,72 +1791,72 @@
     int a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_parameters_inConstructor() {
+  test_duplicateDefinition_parameters_inConstructor() async {
     Source source = addSource(r'''
 class A {
   int a;
   A(int a, this.a);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_parameters_inFunctionTypeAlias() {
+  test_duplicateDefinition_parameters_inFunctionTypeAlias() async {
     Source source = addSource(r'''
 typedef F(int a, double a);
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_parameters_inLocalFunction() {
+  test_duplicateDefinition_parameters_inLocalFunction() async {
     Source source = addSource(r'''
 main() {
   f(int a, double a) {
   };
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_parameters_inMethod() {
+  test_duplicateDefinition_parameters_inMethod() async {
     Source source = addSource(r'''
 class A {
   m(int a, double a) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_parameters_inTopLevelFunction() {
+  test_duplicateDefinition_parameters_inTopLevelFunction() async {
     Source source = addSource(r'''
 f(int a, double a) {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinition_typeParameters() {
+  test_duplicateDefinition_typeParameters() async {
     Source source = addSource(r'''
 class A<T, T> {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_DEFINITION]);
     verify([source]);
   }
 
-  void test_duplicateDefinitionInheritance_instanceGetter_staticGetter() {
+  test_duplicateDefinitionInheritance_instanceGetter_staticGetter() async {
     Source source = addSource(r'''
 class A {
   int get x => 0;
@@ -1860,14 +1864,13 @@
 class B extends A {
   static int get x => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
     verify([source]);
   }
 
-  void
-      test_duplicateDefinitionInheritance_instanceGetterAbstract_staticGetter() {
+  test_duplicateDefinitionInheritance_instanceGetterAbstract_staticGetter() async {
     Source source = addSource(r'''
 abstract class A {
   int get x;
@@ -1875,13 +1878,13 @@
 class B extends A {
   static int get x => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
     verify([source]);
   }
 
-  void test_duplicateDefinitionInheritance_instanceMethod_staticMethod() {
+  test_duplicateDefinitionInheritance_instanceMethod_staticMethod() async {
     Source source = addSource(r'''
 class A {
   x() {}
@@ -1889,14 +1892,13 @@
 class B extends A {
   static x() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
     verify([source]);
   }
 
-  void
-      test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod() {
+  test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod() async {
     Source source = addSource(r'''
 abstract class A {
   x();
@@ -1904,13 +1906,13 @@
 abstract class B extends A {
   static x() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
     verify([source]);
   }
 
-  void test_duplicateDefinitionInheritance_instanceSetter_staticSetter() {
+  test_duplicateDefinitionInheritance_instanceSetter_staticSetter() async {
     Source source = addSource(r'''
 class A {
   set x(value) {}
@@ -1918,14 +1920,13 @@
 class B extends A {
   static set x(value) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
     verify([source]);
   }
 
-  void
-      test_duplicateDefinitionInheritance_instanceSetterAbstract_staticSetter() {
+  test_duplicateDefinitionInheritance_instanceSetterAbstract_staticSetter() async {
     Source source = addSource(r'''
 abstract class A {
   set x(value);
@@ -1933,66 +1934,66 @@
 class B extends A {
   static set x(value) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE]);
     verify([source]);
   }
 
-  void test_duplicateNamedArgument() {
+  test_duplicateNamedArgument() async {
     Source source = addSource(r'''
 f({a, b}) {}
 main() {
   f(a: 1, a: 2);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_NAMED_ARGUMENT]);
     verify([source]);
   }
 
-  void test_duplicatePart_sameSource() {
+  test_duplicatePart_sameSource() async {
     addNamedSource('/part.dart', 'part of lib;');
     Source source = addSource(r'''
 library lib;
 part 'part.dart';
 part 'foo/../part.dart';
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
     verify([source]);
   }
 
-  void test_duplicatePart_sameUri() {
+  test_duplicatePart_sameUri() async {
     addNamedSource('/part.dart', 'part of lib;');
     Source source = addSource(r'''
 library lib;
 part 'part.dart';
 part 'part.dart';
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.DUPLICATE_PART]);
     verify([source]);
   }
 
-  void test_exportInternalLibrary() {
+  test_exportInternalLibrary() async {
     Source source = addSource("export 'dart:_interceptors';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY]);
     verify([source]);
   }
 
-  void test_exportOfNonLibrary() {
+  test_exportOfNonLibrary() async {
     Source source = addSource(r'''
 library L;
 export 'lib1.dart';''');
     addNamedSource("/lib1.dart", "part of lib;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXPORT_OF_NON_LIBRARY]);
     verify([source]);
   }
 
-  void test_extendsDeferredClass() {
-    resolveWithErrors(<String>[
+  test_extendsDeferredClass() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -2005,8 +2006,8 @@
     ]);
   }
 
-  void test_extendsDeferredClass_classTypeAlias() {
-    resolveWithErrors(<String>[
+  test_extendsDeferredClass_classTypeAlias() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -2020,9 +2021,9 @@
     ]);
   }
 
-  void test_extendsDisallowedClass_class_bool() {
+  test_extendsDisallowedClass_class_bool() async {
     Source source = addSource("class A extends bool {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
       CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
@@ -2030,16 +2031,16 @@
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_class_double() {
+  test_extendsDisallowedClass_class_double() async {
     Source source = addSource("class A extends double {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_class_int() {
+  test_extendsDisallowedClass_class_int() async {
     Source source = addSource("class A extends int {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
       CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
@@ -2047,9 +2048,9 @@
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_class_Null() {
+  test_extendsDisallowedClass_class_Null() async {
     Source source = addSource("class A extends Null {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
       CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
@@ -2057,16 +2058,16 @@
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_class_num() {
+  test_extendsDisallowedClass_class_num() async {
     Source source = addSource("class A extends num {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_class_String() {
+  test_extendsDisallowedClass_class_String() async {
     Source source = addSource("class A extends String {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS,
       CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT
@@ -2074,86 +2075,86 @@
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_classTypeAlias_bool() {
+  test_extendsDisallowedClass_classTypeAlias_bool() async {
     Source source = addSource(r'''
 class M {}
 class C = bool with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_classTypeAlias_double() {
+  test_extendsDisallowedClass_classTypeAlias_double() async {
     Source source = addSource(r'''
 class M {}
 class C = double with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_classTypeAlias_int() {
+  test_extendsDisallowedClass_classTypeAlias_int() async {
     Source source = addSource(r'''
 class M {}
 class C = int with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_classTypeAlias_Null() {
+  test_extendsDisallowedClass_classTypeAlias_Null() async {
     Source source = addSource(r'''
 class M {}
 class C = Null with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_classTypeAlias_num() {
+  test_extendsDisallowedClass_classTypeAlias_num() async {
     Source source = addSource(r'''
 class M {}
 class C = num with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_extendsDisallowedClass_classTypeAlias_String() {
+  test_extendsDisallowedClass_classTypeAlias_String() async {
     Source source = addSource(r'''
 class M {}
 class C = String with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_extendsEnum() {
+  test_extendsEnum() async {
     Source source = addSource(r'''
 enum E { ONE }
 class A extends E {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_ENUM]);
     verify([source]);
   }
 
-  void test_extendsNonClass_class() {
+  test_extendsNonClass_class() async {
     Source source = addSource(r'''
 int A;
 class B extends A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
     verify([source]);
   }
 
-  void test_extendsNonClass_dynamic() {
+  test_extendsNonClass_dynamic() async {
     Source source = addSource("class B extends dynamic {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTENDS_NON_CLASS]);
     verify([source]);
   }
 
-  void test_extraPositionalArguments_const() {
+  test_extraPositionalArguments_const() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -2161,12 +2162,12 @@
 main() {
   const A(0);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_extraPositionalArguments_const_super() {
+  test_extraPositionalArguments_const_super() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -2174,42 +2175,42 @@
 class B extends A {
   const B() : super(0);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.EXTRA_POSITIONAL_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_fieldFormalParameter_assignedInInitializer() {
+  test_fieldFormalParameter_assignedInInitializer() async {
     Source source = addSource(r'''
 class A {
   int x;
   A(this.x) : x = 3 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
     verify([source]);
   }
 
-  void test_fieldInitializedByMultipleInitializers() {
+  test_fieldInitializedByMultipleInitializers() async {
     Source source = addSource(r'''
 class A {
   int x;
   A() : x = 0, x = 1 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
     verify([source]);
   }
 
-  void test_fieldInitializedByMultipleInitializers_multipleInits() {
+  test_fieldInitializedByMultipleInitializers_multipleInits() async {
     Source source = addSource(r'''
 class A {
   int x;
   A() : x = 0, x = 1, x = 2 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
       CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
@@ -2217,14 +2218,14 @@
     verify([source]);
   }
 
-  void test_fieldInitializedByMultipleInitializers_multipleNames() {
+  test_fieldInitializedByMultipleInitializers_multipleNames() async {
     Source source = addSource(r'''
 class A {
   int x;
   int y;
   A() : x = 0, x = 1, y = 0, y = 1 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS,
       CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS
@@ -2232,38 +2233,38 @@
     verify([source]);
   }
 
-  void test_fieldInitializedInParameterAndInitializer() {
+  test_fieldInitializedInParameterAndInitializer() async {
     Source source = addSource(r'''
 class A {
   int x;
   A(this.x) : x = 1 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
     verify([source]);
   }
 
-  void test_fieldInitializerFactoryConstructor() {
+  test_fieldInitializerFactoryConstructor() async {
     Source source = addSource(r'''
 class A {
   int x;
   factory A(this.x) => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_fieldInitializerOutsideConstructor() {
+  test_fieldInitializerOutsideConstructor() async {
     // TODO(brianwilkerson) Fix the duplicate error messages.
     Source source = addSource(r'''
 class A {
   int x;
   m(this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR,
       CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR
@@ -2271,76 +2272,76 @@
     verify([source]);
   }
 
-  void test_fieldInitializerOutsideConstructor_defaultParameter() {
+  test_fieldInitializerOutsideConstructor_defaultParameter() async {
     Source source = addSource(r'''
 class A {
   int x;
   m([this.x]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_fieldInitializerOutsideConstructor_inFunctionTypeParameter() {
+  test_fieldInitializerOutsideConstructor_inFunctionTypeParameter() async {
     Source source = addSource(r'''
 class A {
   int x;
   A(int p(this.x));
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_fieldInitializerRedirectingConstructor_afterRedirection() {
+  test_fieldInitializerRedirectingConstructor_afterRedirection() async {
     Source source = addSource(r'''
 class A {
   int x;
   A.named() {}
   A() : this.named(), x = 42;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_fieldInitializerRedirectingConstructor_beforeRedirection() {
+  test_fieldInitializerRedirectingConstructor_beforeRedirection() async {
     Source source = addSource(r'''
 class A {
   int x;
   A.named() {}
   A() : x = 42, this.named();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_fieldInitializingFormalRedirectingConstructor() {
+  test_fieldInitializingFormalRedirectingConstructor() async {
     Source source = addSource(r'''
 class A {
   int x;
   A.named() {}
   A(this.x) : this.named();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.FIELD_INITIALIZER_REDIRECTING_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_finalInitializedMultipleTimes_initializers() {
+  test_finalInitializedMultipleTimes_initializers() async {
     Source source = addSource(r'''
 class A {
   final x;
   A() : x = 0, x = 0 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS]);
     verify([source]);
@@ -2354,26 +2355,26 @@
    * Note: FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER covers a subset of
    * FINAL_INITIALIZED_MULTIPLE_TIMES, since it more specific, we use it instead of the broader code
    */
-  void test_finalInitializedMultipleTimes_initializingFormal_initializer() {
+  test_finalInitializedMultipleTimes_initializingFormal_initializer() async {
     Source source = addSource(r'''
 class A {
   final x;
   A(this.x) : x = 0 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER]);
     verify([source]);
   }
 
-  void test_finalInitializedMultipleTimes_initializingFormals() {
+  test_finalInitializedMultipleTimes_initializingFormals() async {
     Source source = addSource(r'''
 class A {
   final x;
   A(this.x, this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
     // TODO(brianwilkerson) There should only be one error here.
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.DUPLICATE_DEFINITION,
       CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES
@@ -2381,38 +2382,38 @@
     verify([source]);
   }
 
-  void test_finalNotInitialized_instanceField_const_static() {
+  test_finalNotInitialized_instanceField_const_static() async {
     Source source = addSource(r'''
 class A {
   static const F;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_library_const() {
+  test_finalNotInitialized_library_const() async {
     Source source = addSource("const F;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_local_const() {
+  test_finalNotInitialized_local_const() async {
     Source source = addSource(r'''
 f() {
   const int x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_NOT_INITIALIZED]);
     verify([source]);
   }
 
-  void test_fromEnvironment_bool_badArgs() {
+  test_fromEnvironment_bool_badArgs() async {
     Source source = addSource(r'''
 var b1 = const bool.fromEnvironment(1);
 var b2 = const bool.fromEnvironment('x', defaultValue: 1);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
@@ -2422,13 +2423,17 @@
     verify([source]);
   }
 
-  void test_fromEnvironment_bool_badDefault_whenDefined() {
+  test_fromEnvironment_bool_badDefault_whenDefined() async {
     // The type of the defaultValue needs to be correct even when the default
     // value isn't used (because the variable is defined in the environment).
-    analysisContext2.declaredVariables.define("x", "true");
+    if (enableNewAnalysisDriver) {
+      driver.declaredVariables.define("x", "true");
+    } else {
+      analysisContext2.declaredVariables.define("x", "true");
+    }
     Source source =
         addSource("var b = const bool.fromEnvironment('x', defaultValue: 1);");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
@@ -2436,20 +2441,20 @@
     verify([source]);
   }
 
-  void test_getterAndMethodWithSameName() {
+  test_getterAndMethodWithSameName() async {
     Source source = addSource(r'''
 class A {
   x(y) {}
   get x => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.GETTER_AND_METHOD_WITH_SAME_NAME]);
     verify([source]);
   }
 
-  void test_implementsDeferredClass() {
-    resolveWithErrors(<String>[
+  test_implementsDeferredClass() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -2462,8 +2467,8 @@
     ]);
   }
 
-  void test_implementsDeferredClass_classTypeAlias() {
-    resolveWithErrors(<String>[
+  test_implementsDeferredClass_classTypeAlias() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -2478,51 +2483,51 @@
     ]);
   }
 
-  void test_implementsDisallowedClass_class_bool() {
+  test_implementsDisallowedClass_class_bool() async {
     Source source = addSource("class A implements bool {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_class_double() {
+  test_implementsDisallowedClass_class_double() async {
     Source source = addSource("class A implements double {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_class_int() {
+  test_implementsDisallowedClass_class_int() async {
     Source source = addSource("class A implements int {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_class_Null() {
+  test_implementsDisallowedClass_class_Null() async {
     Source source = addSource("class A implements Null {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_class_num() {
+  test_implementsDisallowedClass_class_num() async {
     Source source = addSource("class A implements num {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_class_String() {
+  test_implementsDisallowedClass_class_String() async {
     Source source = addSource("class A implements String {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_class_String_num() {
+  test_implementsDisallowedClass_class_String_num() async {
     Source source = addSource("class A implements String, num {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
       CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS
@@ -2530,72 +2535,72 @@
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_classTypeAlias_bool() {
+  test_implementsDisallowedClass_classTypeAlias_bool() async {
     Source source = addSource(r'''
 class A {}
 class M {}
 class C = A with M implements bool;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_classTypeAlias_double() {
+  test_implementsDisallowedClass_classTypeAlias_double() async {
     Source source = addSource(r'''
 class A {}
 class M {}
 class C = A with M implements double;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_classTypeAlias_int() {
+  test_implementsDisallowedClass_classTypeAlias_int() async {
     Source source = addSource(r'''
 class A {}
 class M {}
 class C = A with M implements int;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_classTypeAlias_Null() {
+  test_implementsDisallowedClass_classTypeAlias_Null() async {
     Source source = addSource(r'''
 class A {}
 class M {}
 class C = A with M implements Null;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_classTypeAlias_num() {
+  test_implementsDisallowedClass_classTypeAlias_num() async {
     Source source = addSource(r'''
 class A {}
 class M {}
 class C = A with M implements num;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_classTypeAlias_String() {
+  test_implementsDisallowedClass_classTypeAlias_String() async {
     Source source = addSource(r'''
 class A {}
 class M {}
 class C = A with M implements String;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_implementsDisallowedClass_classTypeAlias_String_num() {
+  test_implementsDisallowedClass_classTypeAlias_String_num() async {
     Source source = addSource(r'''
 class A {}
 class M {}
 class C = A with M implements String, num;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS,
       CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS
@@ -2603,56 +2608,56 @@
     verify([source]);
   }
 
-  void test_implementsDynamic() {
+  test_implementsDynamic() async {
     Source source = addSource("class A implements dynamic {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_DYNAMIC]);
     verify([source]);
   }
 
-  void test_implementsEnum() {
+  test_implementsEnum() async {
     Source source = addSource(r'''
 enum E { ONE }
 class A implements E {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_ENUM]);
     verify([source]);
   }
 
-  void test_implementsNonClass_class() {
+  test_implementsNonClass_class() async {
     Source source = addSource(r'''
 int A;
 class B implements A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
     verify([source]);
   }
 
-  void test_implementsNonClass_typeAlias() {
+  test_implementsNonClass_typeAlias() async {
     Source source = addSource(r'''
 class A {}
 class M {}
 int B;
 class C = A with M implements B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_NON_CLASS]);
     verify([source]);
   }
 
-  void test_implementsRepeated() {
+  test_implementsRepeated() async {
     Source source = addSource(r'''
 class A {}
 class B implements A, A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_REPEATED]);
     verify([source]);
   }
 
-  void test_implementsRepeated_3times() {
+  test_implementsRepeated_3times() async {
     Source source = addSource(r'''
 class A {} class C{}
 class B implements A, A, A, A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.IMPLEMENTS_REPEATED,
       CompileTimeErrorCode.IMPLEMENTS_REPEATED,
@@ -2661,87 +2666,86 @@
     verify([source]);
   }
 
-  void test_implementsSuperClass() {
+  test_implementsSuperClass() async {
     Source source = addSource(r'''
 class A {}
 class B extends A implements A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
     verify([source]);
   }
 
-  void test_implementsSuperClass_Object() {
+  test_implementsSuperClass_Object() async {
     Source source = addSource("class A implements Object {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS]);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_field() {
+  test_implicitThisReferenceInInitializer_field() async {
     Source source = addSource(r'''
 class A {
   var v;
   A() : v = f;
   var f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_field2() {
+  test_implicitThisReferenceInInitializer_field2() async {
     Source source = addSource(r'''
 class A {
   final x = 0;
   final y = x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_invocation() {
+  test_implicitThisReferenceInInitializer_invocation() async {
     Source source = addSource(r'''
 class A {
   var v;
   A() : v = f();
   f() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_invocationInStatic() {
+  test_implicitThisReferenceInInitializer_invocationInStatic() async {
     Source source = addSource(r'''
 class A {
   static var F = m();
   m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void
-      test_implicitThisReferenceInInitializer_redirectingConstructorInvocation() {
+  test_implicitThisReferenceInInitializer_redirectingConstructorInvocation() async {
     Source source = addSource(r'''
 class A {
   A(p) {}
   A.named() : this(f);
   var f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_superConstructorInvocation() {
+  test_implicitThisReferenceInInitializer_superConstructorInvocation() async {
     Source source = addSource(r'''
 class A {
   A(p) {}
@@ -2750,39 +2754,26 @@
   B() : super(f);
   var f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_importInternalLibrary() {
+  test_importInternalLibrary() async {
     Source source = addSource("import 'dart:_interceptors';");
-    computeLibrarySourceErrors(source);
     // Note, in these error cases we may generate an UNUSED_IMPORT hint, while
     // we could prevent the hint from being generated by testing the import
     // directive for the error, this is such a minor corner case that we don't
     // think we should add the additional computation time to figure out such
     // cases.
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, HintCode.UNUSED_IMPORT]);
     verify([source]);
   }
 
-  void test_importInternalLibrary_js_helper() {
-    Source source = addSource("import 'dart:_js_helper';");
-    computeLibrarySourceErrors(source);
-    // Note, in these error cases we may generate an UNUSED_IMPORT hint, while
-    // we could prevent the hint from being generated by testing the import
-    // directive for the error, this is such a minor corner case that we don't
-    // think we should add the additional computation time to figure out such
-    // cases.
-    assertErrors(source,
-        [CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, HintCode.UNUSED_IMPORT]);
-    verify([source]);
-  }
-
-  void test_importOfNonLibrary() {
+  test_importOfNonLibrary() async {
     Source source = addSource(r'''
 library lib;
 import 'part.dart';
@@ -2792,12 +2783,12 @@
         r'''
 part of lib;
 class A{}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY]);
     verify([source]);
   }
 
-  void test_inconsistentCaseExpressionTypes() {
+  test_inconsistentCaseExpressionTypes() async {
     Source source = addSource(r'''
 f(var p) {
   switch (p) {
@@ -2807,13 +2798,13 @@
       break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES]);
     verify([source]);
   }
 
-  void test_inconsistentCaseExpressionTypes_dynamic() {
+  test_inconsistentCaseExpressionTypes_dynamic() async {
     // Even though A.S and S have a static type of "dynamic", we should see
     // that they fail to match 3, because they are constant strings.
     Source source = addSource(r'''
@@ -2833,7 +2824,7 @@
       break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES,
       CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES
@@ -2841,7 +2832,7 @@
     verify([source]);
   }
 
-  void test_inconsistentCaseExpressionTypes_repeated() {
+  test_inconsistentCaseExpressionTypes_repeated() async {
     Source source = addSource(r'''
 f(var p) {
   switch (p) {
@@ -2853,7 +2844,7 @@
       break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES,
       CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES
@@ -2861,7 +2852,7 @@
     verify([source]);
   }
 
-  void test_initializerForNonExistent_const() {
+  test_initializerForNonExistent_const() async {
     // Check that the absence of a matching field doesn't cause a
     // crash during constant evaluation.
     Source source = addSource(r'''
@@ -2869,44 +2860,44 @@
   const A() : x = 'foo';
 }
 A a = const A();''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD]);
   }
 
-  void test_initializerForNonExistent_initializer() {
+  test_initializerForNonExistent_initializer() async {
     Source source = addSource(r'''
 class A {
   A() : x = 0 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD]);
   }
 
-  void test_initializerForStaticField() {
+  test_initializerForStaticField() async {
     Source source = addSource(r'''
 class A {
   static int x;
   A() : x = 0 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INITIALIZER_FOR_STATIC_FIELD]);
     verify([source]);
   }
 
-  void test_initializingFormalForNonExistentField() {
+  test_initializingFormalForNonExistentField() async {
     Source source = addSource(r'''
 class A {
   A(this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
     verify([source]);
   }
 
-  void test_initializingFormalForNonExistentField_notInEnclosingClass() {
+  test_initializingFormalForNonExistentField_notInEnclosingClass() async {
     Source source = addSource(r'''
 class A {
 int x;
@@ -2914,48 +2905,48 @@
 class B extends A {
   B(this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
     verify([source]);
   }
 
-  void test_initializingFormalForNonExistentField_optional() {
+  test_initializingFormalForNonExistentField_optional() async {
     Source source = addSource(r'''
 class A {
   A([this.x]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
     verify([source]);
   }
 
-  void test_initializingFormalForNonExistentField_synthetic() {
+  test_initializingFormalForNonExistentField_synthetic() async {
     Source source = addSource(r'''
 class A {
   int get x => 1;
   A(this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD]);
     verify([source]);
   }
 
-  void test_initializingFormalForStaticField() {
+  test_initializingFormalForStaticField() async {
     Source source = addSource(r'''
 class A {
   static int x;
   A([this.x]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD]);
     verify([source]);
   }
 
-  void test_instanceMemberAccessFromFactory_named() {
+  test_instanceMemberAccessFromFactory_named() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -2965,13 +2956,13 @@
     return new A();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY]);
     verify([source]);
   }
 
-  void test_instanceMemberAccessFromFactory_unnamed() {
+  test_instanceMemberAccessFromFactory_unnamed() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -2981,13 +2972,13 @@
     return new A._();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_FACTORY]);
     verify([source]);
   }
 
-  void test_instanceMemberAccessFromStatic_field() {
+  test_instanceMemberAccessFromStatic_field() async {
     Source source = addSource(r'''
 class A {
   int f;
@@ -2995,13 +2986,13 @@
     f;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
     verify([source]);
   }
 
-  void test_instanceMemberAccessFromStatic_getter() {
+  test_instanceMemberAccessFromStatic_getter() async {
     Source source = addSource(r'''
 class A {
   get g => null;
@@ -3009,13 +3000,13 @@
     g;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
     verify([source]);
   }
 
-  void test_instanceMemberAccessFromStatic_method() {
+  test_instanceMemberAccessFromStatic_method() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -3023,46 +3014,46 @@
     m();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INSTANCE_MEMBER_ACCESS_FROM_STATIC]);
     verify([source]);
   }
 
-  void test_instantiateEnum_const() {
+  test_instantiateEnum_const() async {
     Source source = addSource(r'''
 enum E { ONE }
 E e(String name) {
   return const E();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
     verify([source]);
   }
 
-  void test_instantiateEnum_new() {
+  test_instantiateEnum_new() async {
     Source source = addSource(r'''
 enum E { ONE }
 E e(String name) {
   return new E();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INSTANTIATE_ENUM]);
     verify([source]);
   }
 
-  void test_invalidAnnotation_getter() {
+  test_invalidAnnotation_getter() async {
     Source source = addSource(r'''
 get V => 0;
 @V
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
     verify([source]);
   }
 
-  void test_invalidAnnotation_importWithPrefix_getter() {
+  test_invalidAnnotation_importWithPrefix_getter() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -3073,12 +3064,12 @@
 @p.V
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
     verify([source]);
   }
 
-  void test_invalidAnnotation_importWithPrefix_notConstantVariable() {
+  test_invalidAnnotation_importWithPrefix_notConstantVariable() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -3089,13 +3080,12 @@
 @p.V
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
     verify([source]);
   }
 
-  void
-      test_invalidAnnotation_importWithPrefix_notVariableOrConstructorInvocation() {
+  test_invalidAnnotation_importWithPrefix_notVariableOrConstructorInvocation() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -3106,34 +3096,34 @@
 @p.V
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
     verify([source]);
   }
 
-  void test_invalidAnnotation_notConstantVariable() {
+  test_invalidAnnotation_notConstantVariable() async {
     Source source = addSource(r'''
 final V = 0;
 @V
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
     verify([source]);
   }
 
-  void test_invalidAnnotation_notVariableOrConstructorInvocation() {
+  test_invalidAnnotation_notVariableOrConstructorInvocation() async {
     Source source = addSource(r'''
 typedef V();
 @V
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
     verify([source]);
   }
 
-  void test_invalidAnnotation_staticMethodReference() {
+  test_invalidAnnotation_staticMethodReference() async {
     Source source = addSource(r'''
 class A {
   static f() {}
@@ -3141,52 +3131,52 @@
 @A.f
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
     verify([source]);
   }
 
-  void test_invalidAnnotation_unresolved_identifier() {
+  test_invalidAnnotation_unresolved_identifier() async {
     Source source = addSource(r'''
 @unresolved
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
   }
 
-  void test_invalidAnnotation_unresolved_invocation() {
+  test_invalidAnnotation_unresolved_invocation() async {
     Source source = addSource(r'''
 @Unresolved()
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
   }
 
-  void test_invalidAnnotation_unresolved_prefixedIdentifier() {
+  test_invalidAnnotation_unresolved_prefixedIdentifier() async {
     Source source = addSource(r'''
 import 'dart:math' as p;
 @p.unresolved
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
   }
 
-  void test_invalidAnnotation_useLibraryScope() {
+  test_invalidAnnotation_useLibraryScope() async {
     Source source = addSource(r'''
 @foo
 class A {
   static const foo = null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_ANNOTATION]);
   }
 
-  void test_invalidAnnotationFromDeferredLibrary() {
+  test_invalidAnnotationFromDeferredLibrary() async {
     // See test_invalidAnnotation_notConstantVariable
-    resolveWithErrors(<String>[
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class V { const V(); }
@@ -3200,9 +3190,9 @@
     ]);
   }
 
-  void test_invalidAnnotationFromDeferredLibrary_constructor() {
+  test_invalidAnnotationFromDeferredLibrary_constructor() async {
     // See test_invalidAnnotation_notConstantVariable
-    resolveWithErrors(<String>[
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class C { const C(); }''',
@@ -3215,9 +3205,9 @@
     ]);
   }
 
-  void test_invalidAnnotationFromDeferredLibrary_namedConstructor() {
+  test_invalidAnnotationFromDeferredLibrary_namedConstructor() async {
     // See test_invalidAnnotation_notConstantVariable
-    resolveWithErrors(<String>[
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class C { const C.name(); }''',
@@ -3230,186 +3220,186 @@
     ]);
   }
 
-  void test_invalidConstructorName_notEnclosingClassName_defined() {
+  test_invalidConstructorName_notEnclosingClassName_defined() async {
     Source source = addSource(r'''
 class A {
   B() : super();
 }
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
     // no verify() call, "B" is not resolved
   }
 
-  void test_invalidConstructorName_notEnclosingClassName_undefined() {
+  test_invalidConstructorName_notEnclosingClassName_undefined() async {
     Source source = addSource(r'''
 class A {
   B() : super();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_CONSTRUCTOR_NAME]);
     // no verify() call, "B" is not resolved
   }
 
-  void test_invalidFactoryNameNotAClass_notClassName() {
+  test_invalidFactoryNameNotAClass_notClassName() async {
     Source source = addSource(r'''
 int B;
 class A {
   factory B() => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]);
     verify([source]);
   }
 
-  void test_invalidFactoryNameNotAClass_notEnclosingClassName() {
+  test_invalidFactoryNameNotAClass_notEnclosingClassName() async {
     Source source = addSource(r'''
 class A {
   factory B() => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INVALID_FACTORY_NAME_NOT_A_CLASS]);
     // no verify() call, "B" is not resolved
   }
 
-  void test_invalidModifierOnConstructor_async() {
+  test_invalidModifierOnConstructor_async() async {
     Source source = addSource(r'''
 class A {
   A() async {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_invalidModifierOnConstructor_asyncStar() {
+  test_invalidModifierOnConstructor_asyncStar() async {
     Source source = addSource(r'''
 class A {
   A() async* {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_invalidModifierOnConstructor_syncStar() {
+  test_invalidModifierOnConstructor_syncStar() async {
     Source source = addSource(r'''
 class A {
   A() sync* {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_invalidModifierOnSetter_member_async() {
+  test_invalidModifierOnSetter_member_async() async {
     Source source = addSource(r'''
 class A {
   set x(v) async {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
     verify([source]);
   }
 
-  void test_invalidModifierOnSetter_member_asyncStar() {
+  test_invalidModifierOnSetter_member_asyncStar() async {
     Source source = addSource(r'''
 class A {
   set x(v) async* {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
     verify([source]);
   }
 
-  void test_invalidModifierOnSetter_member_syncStar() {
+  test_invalidModifierOnSetter_member_syncStar() async {
     Source source = addSource(r'''
 class A {
   set x(v) sync* {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
     verify([source]);
   }
 
-  void test_invalidModifierOnSetter_topLevel_async() {
+  test_invalidModifierOnSetter_topLevel_async() async {
     Source source = addSource("set x(v) async {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
     verify([source]);
   }
 
-  void test_invalidModifierOnSetter_topLevel_asyncStar() {
+  test_invalidModifierOnSetter_topLevel_asyncStar() async {
     Source source = addSource("set x(v) async* {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
     verify([source]);
   }
 
-  void test_invalidModifierOnSetter_topLevel_syncStar() {
+  test_invalidModifierOnSetter_topLevel_syncStar() async {
     Source source = addSource("set x(v) sync* {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER]);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_factoryConstructor() {
+  test_invalidReferenceToThis_factoryConstructor() async {
     Source source = addSource(r'''
 class A {
   factory A() { return this; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_instanceVariableInitializer_inConstructor() {
+  test_invalidReferenceToThis_instanceVariableInitializer_inConstructor() async {
     Source source = addSource(r'''
 class A {
   var f;
   A() : f = this;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_instanceVariableInitializer_inDeclaration() {
+  test_invalidReferenceToThis_instanceVariableInitializer_inDeclaration() async {
     Source source = addSource(r'''
 class A {
   var f = this;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_staticMethod() {
+  test_invalidReferenceToThis_staticMethod() async {
     Source source = addSource(r'''
 class A {
   static m() { return this; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_staticVariableInitializer() {
+  test_invalidReferenceToThis_staticVariableInitializer() async {
     Source source = addSource(r'''
 class A {
   static A f = this;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_superInitializer() {
+  test_invalidReferenceToThis_superInitializer() async {
     Source source = addSource(r'''
 class A {
   A(var x) {}
@@ -3417,72 +3407,72 @@
 class B extends A {
   B() : super(this);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_topLevelFunction() {
+  test_invalidReferenceToThis_topLevelFunction() async {
     Source source = addSource("f() { return this; }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_variableInitializer() {
+  test_invalidReferenceToThis_variableInitializer() async {
     Source source = addSource("int x = this;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS]);
     verify([source]);
   }
 
-  void test_invalidTypeArgumentInConstList() {
+  test_invalidTypeArgumentInConstList() async {
     Source source = addSource(r'''
 class A<E> {
   m() {
     return const <E>[];
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]);
     verify([source]);
   }
 
-  void test_invalidTypeArgumentInConstMap() {
+  test_invalidTypeArgumentInConstMap() async {
     Source source = addSource(r'''
 class A<E> {
   m() {
     return const <String, E>{};
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]);
     verify([source]);
   }
 
-  void test_invalidUri_export() {
+  test_invalidUri_export() async {
     Source source = addSource("export 'ht:';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
   }
 
-  void test_invalidUri_import() {
+  test_invalidUri_import() async {
     Source source = addSource("import 'ht:';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
   }
 
-  void test_invalidUri_part() {
+  test_invalidUri_part() async {
     Source source = addSource(r'''
 library lib;
 part 'ht:';''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.INVALID_URI]);
   }
 
-  void test_isInConstInstanceCreation_restored() {
+  test_isInConstInstanceCreation_restored() async {
     // If ErrorVerifier._isInConstInstanceCreation is not properly restored on
     // exit from visitInstanceCreationExpression, the error at (1) will be
     // treated as a warning rather than an error.
@@ -3493,13 +3483,13 @@
 const x = const Foo<int>(const Foo<int>(0, 1),
     const <Foo<String>>[]); // (1)
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
     verify([source]);
   }
 
-  void test_isInInstanceVariableInitializer_restored() {
+  test_isInInstanceVariableInitializer_restored() async {
     // If ErrorVerifier._isInInstanceVariableInitializer is not properly
     // restored on exit from visitVariableDeclaration, the error at (1)
     // won't be detected.
@@ -3515,13 +3505,13 @@
   _foo() {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_labelInOuterScope() {
+  test_labelInOuterScope() async {
     Source source = addSource(r'''
 class A {
   void m(int i) {
@@ -3532,40 +3522,40 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.LABEL_IN_OUTER_SCOPE]);
     // We cannot verify resolution with unresolvable labels
   }
 
-  void test_labelUndefined_break() {
+  test_labelUndefined_break() async {
     Source source = addSource(r'''
 f() {
   x: while (true) {
     break y;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
     // We cannot verify resolution with undefined labels
   }
 
-  void test_labelUndefined_continue() {
+  test_labelUndefined_continue() async {
     Source source = addSource(r'''
 f() {
   x: while (true) {
     continue y;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.LABEL_UNDEFINED]);
     // We cannot verify resolution with undefined labels
   }
 
-  void test_length_of_erroneous_constant() {
+  test_length_of_erroneous_constant() async {
     // Attempting to compute the length of constant that couldn't be evaluated
     // (due to an error) should not crash the analyzer (see dartbug.com/23383)
     Source source = addSource("const int i = (1 ? 'alpha' : 'beta').length;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE,
       CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
@@ -3574,76 +3564,76 @@
     verify([source]);
   }
 
-  void test_memberWithClassName_field() {
+  test_memberWithClassName_field() async {
     Source source = addSource(r'''
 class A {
   int A = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
     verify([source]);
   }
 
-  void test_memberWithClassName_field2() {
+  test_memberWithClassName_field2() async {
     Source source = addSource(r'''
 class A {
   int z, A, b = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
     verify([source]);
   }
 
-  void test_memberWithClassName_getter() {
+  test_memberWithClassName_getter() async {
     Source source = addSource(r'''
 class A {
   get A => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME]);
     verify([source]);
   }
 
-  void test_memberWithClassName_method() {
+  test_memberWithClassName_method() async {
     // no test because indistinguishable from constructor
   }
 
-  void test_methodAndGetterWithSameName() {
+  test_methodAndGetterWithSameName() async {
     Source source = addSource(r'''
 class A {
   get x => 0;
   x(y) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.METHOD_AND_GETTER_WITH_SAME_NAME]);
     verify([source]);
   }
 
-  void test_mixinDeclaresConstructor_classDeclaration() {
+  test_mixinDeclaresConstructor_classDeclaration() async {
     Source source = addSource(r'''
 class A {
   A() {}
 }
 class B extends Object with A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_mixinDeclaresConstructor_typeAlias() {
+  test_mixinDeclaresConstructor_typeAlias() async {
     Source source = addSource(r'''
 class A {
   A() {}
 }
 class B = Object with A;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_mixinDeferredClass() {
-    resolveWithErrors(<String>[
+  test_mixinDeferredClass() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3656,8 +3646,8 @@
     ]);
   }
 
-  void test_mixinDeferredClass_classTypeAlias() {
-    resolveWithErrors(<String>[
+  test_mixinDeferredClass_classTypeAlias() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3671,7 +3661,7 @@
     ]);
   }
 
-  void test_mixinHasNoConstructors_mixinApp() {
+  test_mixinHasNoConstructors_mixinApp() async {
     Source source = addSource(r'''
 class B {
   B({x});
@@ -3679,12 +3669,12 @@
 class M {}
 class C = B with M;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
     verify([source]);
   }
 
-  void test_mixinHasNoConstructors_mixinClass() {
+  test_mixinHasNoConstructors_mixinClass() async {
     Source source = addSource(r'''
 class B {
   B({x});
@@ -3696,12 +3686,12 @@
     // generate a further error (despite the fact that it's not forwarded),
     // since CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job
     // of explaining the probem to the user.
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
     verify([source]);
   }
 
-  void test_mixinHasNoConstructors_mixinClass_explicitSuperCall() {
+  test_mixinHasNoConstructors_mixinClass_explicitSuperCall() async {
     Source source = addSource(r'''
 class B {
   B({x});
@@ -3715,12 +3705,12 @@
     // error (despite the fact that it's not forwarded), since
     // CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job of
     // explaining the error to the user.
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
     verify([source]);
   }
 
-  void test_mixinHasNoConstructors_mixinClass_implicitSuperCall() {
+  test_mixinHasNoConstructors_mixinClass_implicitSuperCall() async {
     Source source = addSource(r'''
 class B {
   B({x});
@@ -3734,12 +3724,12 @@
     // error (despite the fact that it's not forwarded), since
     // CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job of
     // explaining the error to the user.
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
     verify([source]);
   }
 
-  void test_mixinHasNoConstructors_mixinClass_namedSuperCall() {
+  test_mixinHasNoConstructors_mixinClass_namedSuperCall() async {
     Source source = addSource(r'''
 class B {
   B.named({x});
@@ -3753,152 +3743,152 @@
     // further error (despite the fact that it's not forwarded), since
     // CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS does a better job of
     // explaining the error to the user.
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS]);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_classDeclaration_extends() {
+  test_mixinInheritsFromNotObject_classDeclaration_extends() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
 class C extends Object with B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_classDeclaration_with() {
+  test_mixinInheritsFromNotObject_classDeclaration_with() async {
     Source source = addSource(r'''
 class A {}
 class B extends Object with A {}
 class C extends Object with B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_typeAlias_extends() {
+  test_mixinInheritsFromNotObject_typeAlias_extends() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
 class C = Object with B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_typeAlias_with() {
+  test_mixinInheritsFromNotObject_typeAlias_with() async {
     Source source = addSource(r'''
 class A {}
 class B extends Object with A {}
 class C = Object with B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_class_bool() {
+  test_mixinOfDisallowedClass_class_bool() async {
     Source source = addSource("class A extends Object with bool {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_class_double() {
+  test_mixinOfDisallowedClass_class_double() async {
     Source source = addSource("class A extends Object with double {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_class_int() {
+  test_mixinOfDisallowedClass_class_int() async {
     Source source = addSource("class A extends Object with int {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_class_Null() {
+  test_mixinOfDisallowedClass_class_Null() async {
     Source source = addSource("class A extends Object with Null {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_class_num() {
+  test_mixinOfDisallowedClass_class_num() async {
     Source source = addSource("class A extends Object with num {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_class_String() {
+  test_mixinOfDisallowedClass_class_String() async {
     Source source = addSource("class A extends Object with String {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_classTypeAlias_bool() {
+  test_mixinOfDisallowedClass_classTypeAlias_bool() async {
     Source source = addSource(r'''
 class A {}
 class C = A with bool;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_classTypeAlias_double() {
+  test_mixinOfDisallowedClass_classTypeAlias_double() async {
     Source source = addSource(r'''
 class A {}
 class C = A with double;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_classTypeAlias_int() {
+  test_mixinOfDisallowedClass_classTypeAlias_int() async {
     Source source = addSource(r'''
 class A {}
 class C = A with int;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_classTypeAlias_Null() {
+  test_mixinOfDisallowedClass_classTypeAlias_Null() async {
     Source source = addSource(r'''
 class A {}
 class C = A with Null;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_classTypeAlias_num() {
+  test_mixinOfDisallowedClass_classTypeAlias_num() async {
     Source source = addSource(r'''
 class A {}
 class C = A with num;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_classTypeAlias_String() {
+  test_mixinOfDisallowedClass_classTypeAlias_String() async {
     Source source = addSource(r'''
 class A {}
 class C = A with String;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfDisallowedClass_classTypeAlias_String_num() {
+  test_mixinOfDisallowedClass_classTypeAlias_String_num() async {
     Source source = addSource(r'''
 class A {}
 class C = A with String, num;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS,
       CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS
@@ -3906,113 +3896,113 @@
     verify([source]);
   }
 
-  void test_mixinOfEnum() {
+  test_mixinOfEnum() async {
     Source source = addSource(r'''
 enum E { ONE }
 class A extends Object with E {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_ENUM]);
     verify([source]);
   }
 
-  void test_mixinOfNonClass_class() {
+  test_mixinOfNonClass_class() async {
     Source source = addSource(r'''
 int A;
 class B extends Object with A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
     verify([source]);
   }
 
-  void test_mixinOfNonClass_typeAlias() {
+  test_mixinOfNonClass_typeAlias() async {
     Source source = addSource(r'''
 class A {}
 int B;
 class C = A with B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
     verify([source]);
   }
 
-  void test_mixinReferencesSuper() {
+  test_mixinReferencesSuper() async {
     Source source = addSource(r'''
 class A {
   toString() => super.toString();
 }
 class B extends Object with A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]);
     verify([source]);
   }
 
-  void test_mixinWithNonClassSuperclass_class() {
+  test_mixinWithNonClassSuperclass_class() async {
     Source source = addSource(r'''
 int A;
 class B {}
 class C extends A with B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]);
     verify([source]);
   }
 
-  void test_mixinWithNonClassSuperclass_typeAlias() {
+  test_mixinWithNonClassSuperclass_typeAlias() async {
     Source source = addSource(r'''
 int A;
 class B {}
 class C = A with B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS]);
     verify([source]);
   }
 
-  void test_multipleRedirectingConstructorInvocations() {
+  test_multipleRedirectingConstructorInvocations() async {
     Source source = addSource(r'''
 class A {
   A() : this.a(), this.b();
   A.a() {}
   A.b() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.MULTIPLE_REDIRECTING_CONSTRUCTOR_INVOCATIONS]);
     verify([source]);
   }
 
-  void test_multipleSuperInitializers() {
+  test_multipleSuperInitializers() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
   B() : super(), super() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MULTIPLE_SUPER_INITIALIZERS]);
     verify([source]);
   }
 
-  void test_nativeClauseInNonSDKCode() {
+  test_nativeClauseInNonSDKCode() async {
     // TODO(jwren) Move this test somewhere else: This test verifies a parser
     // error code is generated through the ErrorVerifier, it is not a
     // CompileTimeErrorCode.
     Source source = addSource("class A native 'string' {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
     verify([source]);
   }
 
-  void test_nativeFunctionBodyInNonSDKCode_function() {
+  test_nativeFunctionBodyInNonSDKCode_function() async {
     // TODO(jwren) Move this test somewhere else: This test verifies a parser
     // error code is generated through the ErrorVerifier, it is not a
     // CompileTimeErrorCode.
     Source source = addSource("int m(a) native 'string';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]);
     verify([source]);
   }
 
-  void test_nativeFunctionBodyInNonSDKCode_method() {
+  test_nativeFunctionBodyInNonSDKCode_method() async {
     // TODO(jwren) Move this test somewhere else: This test verifies a parser
     // error code is generated through the ErrorVerifier, it is not a
     // CompileTimeErrorCode.
@@ -4020,13 +4010,13 @@
 class A{
   static int m(a) native 'string';
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE]);
     verify([source]);
   }
 
-  void test_noAnnotationConstructorArguments() {
+  test_noAnnotationConstructorArguments() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -4034,13 +4024,13 @@
 @A
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_ANNOTATION_CONSTRUCTOR_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorExplicit() {
+  test_noDefaultSuperConstructorExplicit() async {
     Source source = addSource(r'''
 class A {
   A(p);
@@ -4048,13 +4038,13 @@
 class B extends A {
   B() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorExplicit_MixinAppWithDirectSuperCall() {
+  test_noDefaultSuperConstructorExplicit_MixinAppWithDirectSuperCall() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4066,13 +4056,13 @@
   C(x) : super();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorExplicit_mixinAppWithNamedParam() {
+  test_noDefaultSuperConstructorExplicit_mixinAppWithNamedParam() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4084,13 +4074,13 @@
   C();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorExplicit_MixinAppWithNamedSuperCall() {
+  test_noDefaultSuperConstructorExplicit_MixinAppWithNamedSuperCall() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4102,13 +4092,13 @@
   C(x) : super.named();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]);
     // Don't verify since call to super.named() can't be resolved.
   }
 
-  void test_noDefaultSuperConstructorExplicit_mixinAppWithOptionalParam() {
+  test_noDefaultSuperConstructorExplicit_mixinAppWithOptionalParam() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4120,13 +4110,13 @@
   C();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorExplicit_MixinWithDirectSuperCall() {
+  test_noDefaultSuperConstructorExplicit_MixinWithDirectSuperCall() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4137,13 +4127,13 @@
   C(x) : super();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorExplicit_mixinWithNamedParam() {
+  test_noDefaultSuperConstructorExplicit_mixinWithNamedParam() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4154,13 +4144,13 @@
   C();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorExplicit_MixinWithNamedSuperCall() {
+  test_noDefaultSuperConstructorExplicit_MixinWithNamedSuperCall() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4171,13 +4161,13 @@
   C(x) : super.named();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]);
     // Don't verify since call to super.named() can't be resolved.
   }
 
-  void test_noDefaultSuperConstructorExplicit_mixinWithOptionalParam() {
+  test_noDefaultSuperConstructorExplicit_mixinWithOptionalParam() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4188,13 +4178,13 @@
   C();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorImplicit_mixinAppWithNamedParam() {
+  test_noDefaultSuperConstructorImplicit_mixinAppWithNamedParam() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4204,13 +4194,13 @@
 class Mixed = B with M;
 class C extends Mixed {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorImplicit_mixinAppWithOptionalParam() {
+  test_noDefaultSuperConstructorImplicit_mixinAppWithOptionalParam() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4220,13 +4210,13 @@
 class Mixed = B with M;
 class C extends Mixed {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorImplicit_mixinWithNamedParam() {
+  test_noDefaultSuperConstructorImplicit_mixinWithNamedParam() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4235,13 +4225,13 @@
 }
 class C extends B with M {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorImplicit_mixinWithOptionalParam() {
+  test_noDefaultSuperConstructorImplicit_mixinWithOptionalParam() async {
     Source source = addSource(r'''
 class M {}
 class B {
@@ -4250,36 +4240,36 @@
 }
 class C extends B with M {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorImplicit_superHasParameters() {
+  test_noDefaultSuperConstructorImplicit_superHasParameters() async {
     Source source = addSource(r'''
 class A {
   A(p);
 }
 class B extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
     verify([source]);
   }
 
-  void test_noDefaultSuperConstructorImplicit_superOnlyNamed() {
+  test_noDefaultSuperConstructorImplicit_superOnlyNamed() async {
     Source source = addSource(r'''
 class A { A.named() {} }
 class B extends A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT]);
     verify([source]);
   }
 
-  void test_nonConstantAnnotationConstructor_named() {
+  test_nonConstantAnnotationConstructor_named() async {
     Source source = addSource(r'''
 class A {
   A.fromInt() {}
@@ -4287,13 +4277,13 @@
 @A.fromInt()
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_nonConstantAnnotationConstructor_unnamed() {
+  test_nonConstantAnnotationConstructor_unnamed() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -4301,76 +4291,76 @@
 @A()
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NON_CONSTANT_ANNOTATION_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_function_named() {
+  test_nonConstantDefaultValue_function_named() async {
     Source source = addSource(r'''
 int y;
 f({x : y}) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_function_positional() {
+  test_nonConstantDefaultValue_function_positional() async {
     Source source = addSource(r'''
 int y;
 f([x = y]) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_inConstructor_named() {
+  test_nonConstantDefaultValue_inConstructor_named() async {
     Source source = addSource(r'''
 class A {
   int y;
   A({x : y}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_inConstructor_positional() {
+  test_nonConstantDefaultValue_inConstructor_positional() async {
     Source source = addSource(r'''
 class A {
   int y;
   A([x = y]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_method_named() {
+  test_nonConstantDefaultValue_method_named() async {
     Source source = addSource(r'''
 class A {
   int y;
   m({x : y}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_method_positional() {
+  test_nonConstantDefaultValue_method_positional() async {
     Source source = addSource(r'''
 class A {
   int y;
   m([x = y]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE]);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValueFromDeferredLibrary() {
-    resolveWithErrors(<String>[
+  test_nonConstantDefaultValueFromDeferredLibrary() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const V = 1;''',
@@ -4383,8 +4373,8 @@
     ]);
   }
 
-  void test_nonConstantDefaultValueFromDeferredLibrary_nested() {
-    resolveWithErrors(<String>[
+  test_nonConstantDefaultValueFromDeferredLibrary_nested() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const V = 1;''',
@@ -4397,7 +4387,7 @@
     ]);
   }
 
-  void test_nonConstCaseExpression() {
+  test_nonConstCaseExpression() async {
     Source source = addSource(r'''
 f(int p, int q) {
   switch (p) {
@@ -4405,13 +4395,13 @@
       break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION]);
     verify([source]);
   }
 
-  void test_nonConstCaseExpressionFromDeferredLibrary() {
-    resolveWithErrors(<String>[
+  test_nonConstCaseExpressionFromDeferredLibrary() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4429,8 +4419,8 @@
     ]);
   }
 
-  void test_nonConstCaseExpressionFromDeferredLibrary_nested() {
-    resolveWithErrors(<String>[
+  test_nonConstCaseExpressionFromDeferredLibrary_nested() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4448,18 +4438,18 @@
     ]);
   }
 
-  void test_nonConstListElement() {
+  test_nonConstListElement() async {
     Source source = addSource(r'''
 f(a) {
   return const [a];
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT]);
     verify([source]);
   }
 
-  void test_nonConstListElementFromDeferredLibrary() {
-    resolveWithErrors(<String>[
+  test_nonConstListElementFromDeferredLibrary() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4474,8 +4464,8 @@
     ]);
   }
 
-  void test_nonConstListElementFromDeferredLibrary_nested() {
-    resolveWithErrors(<String>[
+  test_nonConstListElementFromDeferredLibrary_nested() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4490,40 +4480,40 @@
     ]);
   }
 
-  void test_nonConstMapAsExpressionStatement_begin() {
+  test_nonConstMapAsExpressionStatement_begin() async {
     Source source = addSource(r'''
 f() {
   {'a' : 0, 'b' : 1}.length;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]);
     verify([source]);
   }
 
-  void test_nonConstMapAsExpressionStatement_only() {
+  test_nonConstMapAsExpressionStatement_only() async {
     Source source = addSource(r'''
 f() {
   {'a' : 0, 'b' : 1};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NON_CONST_MAP_AS_EXPRESSION_STATEMENT]);
     verify([source]);
   }
 
-  void test_nonConstMapKey() {
+  test_nonConstMapKey() async {
     Source source = addSource(r'''
 f(a) {
   return const {a : 0};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_KEY]);
     verify([source]);
   }
 
-  void test_nonConstMapKeyFromDeferredLibrary() {
-    resolveWithErrors(<String>[
+  test_nonConstMapKeyFromDeferredLibrary() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4538,8 +4528,8 @@
     ]);
   }
 
-  void test_nonConstMapKeyFromDeferredLibrary_nested() {
-    resolveWithErrors(<String>[
+  test_nonConstMapKeyFromDeferredLibrary_nested() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4554,18 +4544,18 @@
     ]);
   }
 
-  void test_nonConstMapValue() {
+  test_nonConstMapValue() async {
     Source source = addSource(r'''
 f(a) {
   return const {'a' : a};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE]);
     verify([source]);
   }
 
-  void test_nonConstMapValueFromDeferredLibrary() {
-    resolveWithErrors(<String>[
+  test_nonConstMapValueFromDeferredLibrary() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4580,8 +4570,8 @@
     ]);
   }
 
-  void test_nonConstMapValueFromDeferredLibrary_nested() {
-    resolveWithErrors(<String>[
+  test_nonConstMapValueFromDeferredLibrary_nested() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4596,39 +4586,39 @@
     ]);
   }
 
-  void test_nonConstValueInInitializer_assert_condition() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableAssertInitializer = true);
+  test_nonConstValueInInitializer_assert_condition() async {
+    resetWith(
+        options: new AnalysisOptionsImpl()..enableAssertInitializer = true);
     Source source = addSource(r'''
 class A {
   const A(int i) : assert(i.isNegative);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_assert_message() {
-    resetWithOptions(new AnalysisOptionsImpl()
-      ..enableAssertInitializer = true
-      ..enableAssertMessage = true);
+  test_nonConstValueInInitializer_assert_message() async {
+    resetWith(
+        options: new AnalysisOptionsImpl()..enableAssertInitializer = true);
     Source source = addSource(r'''
 class A {
   const A(int i) : assert(i < 0, 'isNegative = ${i.isNegative}');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_binary_notBool_left() {
+  test_nonConstValueInInitializer_binary_notBool_left() async {
     Source source = addSource(r'''
 class A {
   final bool a;
   const A(String p) : a = p && true;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
       StaticTypeWarningCode.NON_BOOL_OPERAND
@@ -4636,13 +4626,13 @@
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_binary_notBool_right() {
+  test_nonConstValueInInitializer_binary_notBool_right() async {
     Source source = addSource(r'''
 class A {
   final bool a;
   const A(String p) : a = true && p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
       StaticTypeWarningCode.NON_BOOL_OPERAND
@@ -4650,13 +4640,13 @@
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_binary_notInt() {
+  test_nonConstValueInInitializer_binary_notInt() async {
     Source source = addSource(r'''
 class A {
   final int a;
   const A(String p) : a = 5 & p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_TYPE_INT,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
@@ -4664,13 +4654,13 @@
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_binary_notNum() {
+  test_nonConstValueInInitializer_binary_notNum() async {
     Source source = addSource(r'''
 class A {
   final int a;
   const A(String p) : a = 5 + p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_TYPE_NUM,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
@@ -4678,20 +4668,20 @@
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_field() {
+  test_nonConstValueInInitializer_field() async {
     Source source = addSource(r'''
 class A {
   static int C;
   final int a;
   const A() : a = C;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_instanceCreation() {
+  test_nonConstValueInInitializer_instanceCreation() async {
     Source source = addSource(r'''
 class A {
   A();
@@ -4701,9 +4691,9 @@
   final a;
 }
 var b = const B();''');
-    computeLibrarySourceErrors(source);
     // TODO(paulberry): the error INVALID_CONSTAT is redundant and ought to be
     // suppressed.
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER,
       CompileTimeErrorCode.INVALID_CONSTANT
@@ -4711,20 +4701,20 @@
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_redirecting() {
+  test_nonConstValueInInitializer_redirecting() async {
     Source source = addSource(r'''
 class A {
   static var C;
   const A.named(p);
   const A() : this.named(C);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_super() {
+  test_nonConstValueInInitializer_super() async {
     Source source = addSource(r'''
 class A {
   const A(p);
@@ -4733,14 +4723,14 @@
   static var C;
   const B() : super(C);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER]);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializerFromDeferredLibrary_field() {
-    resolveWithErrors(<String>[
+  test_nonConstValueInInitializerFromDeferredLibrary_field() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4757,8 +4747,8 @@
     ]);
   }
 
-  void test_nonConstValueInInitializerFromDeferredLibrary_field_nested() {
-    resolveWithErrors(<String>[
+  test_nonConstValueInInitializerFromDeferredLibrary_field_nested() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4775,8 +4765,8 @@
     ]);
   }
 
-  void test_nonConstValueInInitializerFromDeferredLibrary_redirecting() {
-    resolveWithErrors(<String>[
+  test_nonConstValueInInitializerFromDeferredLibrary_redirecting() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4793,8 +4783,8 @@
     ]);
   }
 
-  void test_nonConstValueInInitializerFromDeferredLibrary_super() {
-    resolveWithErrors(<String>[
+  test_nonConstValueInInitializerFromDeferredLibrary_super() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 const int c = 1;''',
@@ -4813,7 +4803,7 @@
     ]);
   }
 
-  void test_nonGenerativeConstructor_explicit() {
+  test_nonGenerativeConstructor_explicit() async {
     Source source = addSource(r'''
 class A {
   factory A.named() => null;
@@ -4821,12 +4811,12 @@
 class B extends A {
   B() : super.named();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_nonGenerativeConstructor_implicit() {
+  test_nonGenerativeConstructor_implicit() async {
     Source source = addSource(r'''
 class A {
   factory A() => null;
@@ -4834,24 +4824,24 @@
 class B extends A {
   B();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_nonGenerativeConstructor_implicit2() {
+  test_nonGenerativeConstructor_implicit2() async {
     Source source = addSource(r'''
 class A {
   factory A() => null;
 }
 class B extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_notEnoughRequiredArguments_const() {
+  test_notEnoughRequiredArguments_const() async {
     Source source = addSource(r'''
 class A {
   const A(int p);
@@ -4859,12 +4849,12 @@
 main() {
   const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_notEnoughRequiredArguments_const_super() {
+  test_notEnoughRequiredArguments_const_super() async {
     Source source = addSource(r'''
 class A {
   const A(int p);
@@ -4872,51 +4862,51 @@
 class B extends A {
   const B() : super();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_optionalParameterInOperator_named() {
+  test_optionalParameterInOperator_named() async {
     Source source = addSource(r'''
 class A {
   operator +({p}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
     verify([source]);
   }
 
-  void test_optionalParameterInOperator_positional() {
+  test_optionalParameterInOperator_positional() async {
     Source source = addSource(r'''
 class A {
   operator +([p]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR]);
     verify([source]);
   }
 
-  void test_partOfNonPart() {
+  test_partOfNonPart() async {
     Source source = addSource(r'''
 library l1;
 part 'l2.dart';''');
     addNamedSource("/l2.dart", "library l2;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
     verify([source]);
   }
 
-  void test_partOfNonPart_self() {
+  test_partOfNonPart_self() async {
     Source source = addSource(r'''
 library lib;
 part 'test.dart';''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.PART_OF_NON_PART]);
     verify([source]);
   }
 
-  void test_prefix_assignment_compound_in_method() {
+  test_prefix_assignment_compound_in_method() async {
     addNamedSource('/lib.dart', 'library lib;');
     Source source = addSource('''
 import 'lib.dart' as p;
@@ -4926,13 +4916,13 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_assignment_compound_not_in_method() {
+  test_prefix_assignment_compound_not_in_method() async {
     addNamedSource('/lib.dart', 'library lib;');
     Source source = addSource('''
 import 'lib.dart' as p;
@@ -4940,13 +4930,13 @@
   p += 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_assignment_in_method() {
+  test_prefix_assignment_in_method() async {
     addNamedSource('/lib.dart', 'library lib;');
     Source source = addSource('''
 import 'lib.dart' as p;
@@ -4956,13 +4946,13 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_assignment_not_in_method() {
+  test_prefix_assignment_not_in_method() async {
     addNamedSource('/lib.dart', 'library lib;');
     Source source = addSource('''
 import 'lib.dart' as p;
@@ -4970,13 +4960,13 @@
   p = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_conditionalPropertyAccess_call() {
+  test_prefix_conditionalPropertyAccess_call() async {
     addNamedSource(
         '/lib.dart',
         '''
@@ -4989,13 +4979,13 @@
   p?.g();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_conditionalPropertyAccess_call_loadLibrary() {
+  test_prefix_conditionalPropertyAccess_call_loadLibrary() async {
     addNamedSource(
         '/lib.dart',
         '''
@@ -5007,13 +4997,13 @@
   p?.loadLibrary();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_conditionalPropertyAccess_get() {
+  test_prefix_conditionalPropertyAccess_get() async {
     addNamedSource(
         '/lib.dart',
         '''
@@ -5026,13 +5016,13 @@
   return p?.x;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_conditionalPropertyAccess_get_loadLibrary() {
+  test_prefix_conditionalPropertyAccess_get_loadLibrary() async {
     addNamedSource(
         '/lib.dart',
         '''
@@ -5044,13 +5034,13 @@
   return p?.loadLibrary;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_conditionalPropertyAccess_set() {
+  test_prefix_conditionalPropertyAccess_set() async {
     addNamedSource(
         '/lib.dart',
         '''
@@ -5063,13 +5053,13 @@
   p?.x = null;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_conditionalPropertyAccess_set_loadLibrary() {
+  test_prefix_conditionalPropertyAccess_set_loadLibrary() async {
     addNamedSource(
         '/lib.dart',
         '''
@@ -5081,13 +5071,13 @@
   p?.loadLibrary = null;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_unqualified_invocation_in_method() {
+  test_prefix_unqualified_invocation_in_method() async {
     addNamedSource('/lib.dart', 'librarylib;');
     Source source = addSource('''
 import 'lib.dart' as p;
@@ -5097,13 +5087,13 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefix_unqualified_invocation_not_in_method() {
+  test_prefix_unqualified_invocation_not_in_method() async {
     addNamedSource('/lib.dart', 'librarylib;');
     Source source = addSource('''
 import 'lib.dart' as p;
@@ -5111,13 +5101,13 @@
   p();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefixCollidesWithTopLevelMembers_functionTypeAlias() {
+  test_prefixCollidesWithTopLevelMembers_functionTypeAlias() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -5127,13 +5117,13 @@
 import 'lib.dart' as p;
 typedef p();
 p.A a;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
     verify([source]);
   }
 
-  void test_prefixCollidesWithTopLevelMembers_topLevelFunction() {
+  test_prefixCollidesWithTopLevelMembers_topLevelFunction() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -5143,13 +5133,13 @@
 import 'lib.dart' as p;
 p() {}
 p.A a;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
     verify([source]);
   }
 
-  void test_prefixCollidesWithTopLevelMembers_topLevelVariable() {
+  test_prefixCollidesWithTopLevelMembers_topLevelVariable() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -5159,13 +5149,13 @@
 import 'lib.dart' as p;
 var p = null;
 p.A a;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
     verify([source]);
   }
 
-  void test_prefixCollidesWithTopLevelMembers_type() {
+  test_prefixCollidesWithTopLevelMembers_type() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -5175,13 +5165,13 @@
 import 'lib.dart' as p;
 class p {}
 p.A a;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER]);
     verify([source]);
   }
 
-  void test_prefixNotFollowedByDot() {
+  test_prefixNotFollowedByDot() async {
     addNamedSource('/lib.dart', 'library lib;');
     Source source = addSource('''
 import 'lib.dart' as p;
@@ -5189,13 +5179,13 @@
   return p;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefixNotFollowedByDot_compoundAssignment() {
+  test_prefixNotFollowedByDot_compoundAssignment() async {
     addNamedSource('/lib.dart', 'library lib;');
     Source source = addSource('''
 import 'lib.dart' as p;
@@ -5203,13 +5193,13 @@
   p += 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_prefixNotFollowedByDot_conditionalMethodInvocation() {
+  test_prefixNotFollowedByDot_conditionalMethodInvocation() async {
     addNamedSource(
         '/lib.dart',
         '''
@@ -5222,54 +5212,54 @@
   p?.g();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.PREFIX_IDENTIFIER_NOT_FOLLOWED_BY_DOT]);
     verify([source]);
   }
 
-  void test_privateOptionalParameter() {
+  test_privateOptionalParameter() async {
     Source source = addSource("f({var _p}) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
     verify([source]);
   }
 
-  void test_privateOptionalParameter_fieldFormal() {
+  test_privateOptionalParameter_fieldFormal() async {
     Source source = addSource(r'''
 class A {
   var _p;
   A({this._p: 0});
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
     verify([source]);
   }
 
-  void test_privateOptionalParameter_withDefaultValue() {
+  test_privateOptionalParameter_withDefaultValue() async {
     Source source = addSource("f({_p : 0}) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER]);
     verify([source]);
   }
 
-  void test_recursiveCompileTimeConstant() {
+  test_recursiveCompileTimeConstant() async {
     Source source = addSource(r'''
 class A {
   const A();
   final m = const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
     verify([source]);
   }
 
-  void test_recursiveCompileTimeConstant_cycle() {
+  test_recursiveCompileTimeConstant_cycle() async {
     Source source = addSource(r'''
 const x = y + 1;
 const y = x + 1;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT,
       CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT
@@ -5277,7 +5267,7 @@
     verify([source]);
   }
 
-  void test_recursiveCompileTimeConstant_initializer_after_toplevel_var() {
+  test_recursiveCompileTimeConstant_initializer_after_toplevel_var() async {
     Source source = addSource('''
 const y = const C();
 class C {
@@ -5285,29 +5275,29 @@
   final x;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
     verify([source]);
   }
 
-  void test_recursiveCompileTimeConstant_singleVariable() {
+  test_recursiveCompileTimeConstant_singleVariable() async {
     Source source = addSource(r'''
 const x = x;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT]);
     verify([source]);
   }
 
-  void test_recursiveConstructorRedirect() {
+  test_recursiveConstructorRedirect() async {
     Source source = addSource(r'''
 class A {
   A.a() : this.b();
   A.b() : this.a();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT,
       CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT
@@ -5315,17 +5305,17 @@
     verify([source]);
   }
 
-  void test_recursiveConstructorRedirect_directSelfReference() {
+  test_recursiveConstructorRedirect_directSelfReference() async {
     Source source = addSource(r'''
 class A {
   A() : this();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT]);
     verify([source]);
   }
 
-  void test_recursiveFactoryRedirect() {
+  test_recursiveFactoryRedirect() async {
     Source source = addSource(r'''
 class A implements B {
   factory A() = C;
@@ -5336,7 +5326,7 @@
 class C implements A {
   factory C() = B;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
       CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
@@ -5348,17 +5338,17 @@
     verify([source]);
   }
 
-  void test_recursiveFactoryRedirect_directSelfReference() {
+  test_recursiveFactoryRedirect_directSelfReference() async {
     Source source = addSource(r'''
 class A {
   factory A() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
     verify([source]);
   }
 
-  void test_recursiveFactoryRedirect_diverging() {
+  test_recursiveFactoryRedirect_diverging() async {
     // Analysis should terminate even though the redirections don't reach a
     // fixed point.  (C<int> redirects to C<C<int>>, then to C<C<C<int>>>, and
     // so on).
@@ -5370,12 +5360,12 @@
   const C<int>();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT]);
     verify([source]);
   }
 
-  void test_recursiveFactoryRedirect_generic() {
+  test_recursiveFactoryRedirect_generic() async {
     Source source = addSource(r'''
 class A<T> implements B<T> {
   factory A() = C;
@@ -5386,7 +5376,7 @@
 class C<T> implements A<T> {
   factory C() = B;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
       CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
@@ -5398,7 +5388,7 @@
     verify([source]);
   }
 
-  void test_recursiveFactoryRedirect_named() {
+  test_recursiveFactoryRedirect_named() async {
     Source source = addSource(r'''
 class A implements B {
   factory A.nameA() = C.nameC;
@@ -5409,7 +5399,7 @@
 class C implements A {
   factory C.nameC() = B.nameB;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
       CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
@@ -5425,7 +5415,7 @@
    * "A" references "C" which has cycle with "B". But we should not report problem for "A" - it is
    * not the part of a cycle.
    */
-  void test_recursiveFactoryRedirect_outsideCycle() {
+  test_recursiveFactoryRedirect_outsideCycle() async {
     Source source = addSource(r'''
 class A {
   factory A() = C;
@@ -5436,7 +5426,7 @@
 class C implements A, B {
   factory C() = B;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
       CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT,
@@ -5446,11 +5436,11 @@
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritance_extends() {
+  test_recursiveInterfaceInheritance_extends() async {
     Source source = addSource(r'''
 class A extends B {}
 class B extends A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
@@ -5458,11 +5448,11 @@
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritance_extends_implements() {
+  test_recursiveInterfaceInheritance_extends_implements() async {
     Source source = addSource(r'''
 class A extends B {}
 class B implements A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
@@ -5470,11 +5460,11 @@
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritance_implements() {
+  test_recursiveInterfaceInheritance_implements() async {
     Source source = addSource(r'''
 class A implements B {}
 class B implements A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
@@ -5482,11 +5472,11 @@
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritance_mixin() {
+  test_recursiveInterfaceInheritance_mixin() async {
     Source source = addSource(r'''
 class M1 = Object with M2;
 class M2 = Object with M1;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
@@ -5494,7 +5484,7 @@
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritance_mixin_superclass() {
+  test_recursiveInterfaceInheritance_mixin_superclass() async {
     // Make sure we don't get CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS in
     // addition--that would just be confusing.
     Source source = addSource('''
@@ -5502,7 +5492,7 @@
 class D = C with M;
 class M {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
@@ -5510,23 +5500,23 @@
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritance_tail() {
+  test_recursiveInterfaceInheritance_tail() async {
     Source source = addSource(r'''
 abstract class A implements A {}
 class B implements A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
     ]);
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritance_tail2() {
+  test_recursiveInterfaceInheritance_tail2() async {
     Source source = addSource(r'''
 abstract class A implements B {}
 abstract class B implements A {}
 class C implements A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE
@@ -5534,13 +5524,13 @@
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritance_tail3() {
+  test_recursiveInterfaceInheritance_tail3() async {
     Source source = addSource(r'''
 abstract class A implements B {}
 abstract class B implements C {}
 abstract class C implements A {}
 class D implements A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE,
@@ -5549,23 +5539,23 @@
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritanceBaseCaseExtends() {
+  test_recursiveInterfaceInheritanceBaseCaseExtends() async {
     Source source = addSource("class A extends A {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS
     ]);
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritanceBaseCaseExtends_abstract() {
+  test_recursiveInterfaceInheritanceBaseCaseExtends_abstract() async {
     Source source = addSource(r'''
 class C extends C {
   var bar = 0;
   m();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS,
       StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER,
@@ -5574,59 +5564,59 @@
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritanceBaseCaseImplements() {
+  test_recursiveInterfaceInheritanceBaseCaseImplements() async {
     Source source = addSource("class A implements A {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
     ]);
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritanceBaseCaseImplements_typeAlias() {
+  test_recursiveInterfaceInheritanceBaseCaseImplements_typeAlias() async {
     Source source = addSource(r'''
 class A {}
 class M {}
 class B = A with M implements B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_IMPLEMENTS
     ]);
     verify([source]);
   }
 
-  void test_recursiveInterfaceInheritanceBaseCaseWith() {
+  test_recursiveInterfaceInheritanceBaseCaseWith() async {
     Source source = addSource("class M = Object with M;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_WITH]);
     verify([source]);
   }
 
-  void test_redirectGenerativeToMissingConstructor() {
+  test_redirectGenerativeToMissingConstructor() async {
     Source source = addSource(r'''
 class A {
   A() : this.noSuchConstructor();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR]);
   }
 
-  void test_redirectGenerativeToNonGenerativeConstructor() {
+  test_redirectGenerativeToNonGenerativeConstructor() async {
     Source source = addSource(r'''
 class A {
   A() : this.x();
   factory A.x() => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_NON_GENERATIVE_CONSTRUCTOR
     ]);
     verify([source]);
   }
 
-  void test_redirectToMissingConstructor_named() {
+  test_redirectToMissingConstructor_named() async {
     Source source = addSource(r'''
 class A implements B{
   A() {}
@@ -5634,12 +5624,12 @@
 class B {
   const factory B() = A.name;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
   }
 
-  void test_redirectToMissingConstructor_unnamed() {
+  test_redirectToMissingConstructor_unnamed() async {
     Source source = addSource(r'''
 class A implements B{
   A.name() {}
@@ -5647,45 +5637,45 @@
 class B {
   const factory B() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
   }
 
-  void test_redirectToNonClass_notAType() {
+  test_redirectToNonClass_notAType() async {
     Source source = addSource(r'''
 int A;
 class B {
   const factory B() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
     verify([source]);
   }
 
-  void test_redirectToNonClass_undefinedIdentifier() {
+  test_redirectToNonClass_undefinedIdentifier() async {
     Source source = addSource(r'''
 class B {
   const factory B() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.REDIRECT_TO_NON_CLASS]);
     verify([source]);
   }
 
-  void test_redirectToNonConstConstructor() {
+  test_redirectToNonConstConstructor() async {
     Source source = addSource(r'''
 class A {
   A.a() {}
   const factory A.b() = A.a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_referencedBeforeDeclaration_hideInBlock_function() {
+  test_referencedBeforeDeclaration_hideInBlock_function() async {
     Source source = addSource(r'''
 var v = 1;
 main() {
@@ -5693,11 +5683,11 @@
   v() {}
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
   }
 
-  void test_referencedBeforeDeclaration_hideInBlock_local() {
+  test_referencedBeforeDeclaration_hideInBlock_local() async {
     Source source = addSource(r'''
 var v = 1;
 main() {
@@ -5705,11 +5695,11 @@
   var v = 2;
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
   }
 
-  void test_referencedBeforeDeclaration_hideInBlock_subBlock() {
+  test_referencedBeforeDeclaration_hideInBlock_subBlock() async {
     Source source = addSource(r'''
 var v = 1;
 main() {
@@ -5719,104 +5709,104 @@
   var v = 2;
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
   }
 
-  void test_referencedBeforeDeclaration_inInitializer_closure() {
+  test_referencedBeforeDeclaration_inInitializer_closure() async {
     Source source = addSource(r'''
 main() {
   var v = () => v;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
   }
 
-  void test_referencedBeforeDeclaration_inInitializer_directly() {
+  test_referencedBeforeDeclaration_inInitializer_directly() async {
     Source source = addSource(r'''
 main() {
   var v = v;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
   }
 
-  void test_referencedBeforeDeclaration_type_localFunction() {
+  test_referencedBeforeDeclaration_type_localFunction() async {
     Source source = addSource(r'''
 void testTypeRef() {
   String s = '';
   int String(int x) => x + 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
   }
 
-  void test_referencedBeforeDeclaration_type_localVariable() {
+  test_referencedBeforeDeclaration_type_localVariable() async {
     Source source = addSource(r'''
 void testTypeRef() {
   String s = '';
   var String = '';
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
   }
 
-  void test_rethrowOutsideCatch() {
+  test_rethrowOutsideCatch() async {
     Source source = addSource(r'''
 f() {
   rethrow;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.RETHROW_OUTSIDE_CATCH]);
     verify([source]);
   }
 
-  void test_returnInGenerativeConstructor() {
+  test_returnInGenerativeConstructor() async {
     Source source = addSource(r'''
 class A {
   A() { return 0; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_returnInGenerativeConstructor_expressionFunctionBody() {
+  test_returnInGenerativeConstructor_expressionFunctionBody() async {
     Source source = addSource(r'''
 class A {
   A() => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.RETURN_IN_GENERATIVE_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_returnInGenerator_asyncStar() {
+  test_returnInGenerator_asyncStar() async {
     Source source = addSource(r'''
 f() async* {
   return 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
     verify([source]);
   }
 
-  void test_returnInGenerator_syncStar() {
+  test_returnInGenerator_syncStar() async {
     Source source = addSource(r'''
 f() sync* {
   return 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.RETURN_IN_GENERATOR]);
     verify([source]);
   }
 
-  void test_sharedDeferredPrefix() {
-    resolveWithErrors(<String>[
+  test_sharedDeferredPrefix() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 f1() {}''',
@@ -5833,14 +5823,14 @@
     ]);
   }
 
-  void test_superInInvalidContext_binaryExpression() {
+  test_superInInvalidContext_binaryExpression() async {
     Source source = addSource("var v = super + 0;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.v' is not resolved
   }
 
-  void test_superInInvalidContext_constructorFieldInitializer() {
+  test_superInInvalidContext_constructorFieldInitializer() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -5849,12 +5839,12 @@
   var f;
   B() : f = super.m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.m' is not resolved
   }
 
-  void test_superInInvalidContext_factoryConstructor() {
+  test_superInInvalidContext_factoryConstructor() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -5865,12 +5855,12 @@
     return null;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.m' is not resolved
   }
 
-  void test_superInInvalidContext_instanceVariableInitializer() {
+  test_superInInvalidContext_instanceVariableInitializer() async {
     Source source = addSource(r'''
 class A {
   var a;
@@ -5878,12 +5868,12 @@
 class B extends A {
  var b = super.a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.a' is not resolved
   }
 
-  void test_superInInvalidContext_staticMethod() {
+  test_superInInvalidContext_staticMethod() async {
     Source source = addSource(r'''
 class A {
   static m() {}
@@ -5891,12 +5881,12 @@
 class B extends A {
   static n() { return super.m(); }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.m' is not resolved
   }
 
-  void test_superInInvalidContext_staticVariableInitializer() {
+  test_superInInvalidContext_staticVariableInitializer() async {
     Source source = addSource(r'''
 class A {
   static int a = 0;
@@ -5904,62 +5894,62 @@
 class B extends A {
   static int b = super.a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.a' is not resolved
   }
 
-  void test_superInInvalidContext_topLevelFunction() {
+  test_superInInvalidContext_topLevelFunction() async {
     Source source = addSource(r'''
 f() {
   super.f();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.f' is not resolved
   }
 
-  void test_superInInvalidContext_topLevelVariableInitializer() {
+  test_superInInvalidContext_topLevelVariableInitializer() async {
     Source source = addSource("var v = super.y;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT]);
     // no verify(), 'super.y' is not resolved
   }
 
-  void test_superInRedirectingConstructor_redirectionSuper() {
+  test_superInRedirectingConstructor_redirectionSuper() async {
     Source source = addSource(r'''
 class A {}
 class B {
   B() : this.name(), super();
   B.name() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_superInRedirectingConstructor_superRedirection() {
+  test_superInRedirectingConstructor_superRedirection() async {
     Source source = addSource(r'''
 class A {}
 class B {
   B() : super(), this.name();
   B.name() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.SUPER_IN_REDIRECTING_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_symbol_constructor_badArgs() {
+  test_symbol_constructor_badArgs() async {
     Source source = addSource(r'''
 var s1 = const Symbol('3');
 var s2 = const Symbol(3);
 var s3 = const Symbol();
 var s4 = const Symbol('x', 'y');
 var s5 = const Symbol('x', foo: 'x');''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
       CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION,
@@ -5971,14 +5961,14 @@
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_11987() {
+  test_typeAliasCannotReferenceItself_11987() async {
     Source source = addSource(r'''
 typedef void F(List<G> l);
 typedef void G(List<F> l);
 main() {
   F foo(G g) => g;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
       CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF
@@ -5986,7 +5976,7 @@
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_19459() {
+  test_typeAliasCannotReferenceItself_19459() async {
     // A complex example involving multiple classes.  This is legal, since
     // typedef F references itself only via a class.
     Source source = addSource(r'''
@@ -5997,44 +5987,44 @@
 abstract class E extends A<dynamic, F> {}
 typedef D F();
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_parameterType_named() {
+  test_typeAliasCannotReferenceItself_parameterType_named() async {
     Source source = addSource("typedef A({A a});");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_parameterType_positional() {
+  test_typeAliasCannotReferenceItself_parameterType_positional() async {
     Source source = addSource("typedef A([A a]);");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_parameterType_required() {
+  test_typeAliasCannotReferenceItself_parameterType_required() async {
     Source source = addSource("typedef A(A a);");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_parameterType_typeArgument() {
+  test_typeAliasCannotReferenceItself_parameterType_typeArgument() async {
     Source source = addSource("typedef A(List<A> a);");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() {
+  test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() async {
     // A typedef is allowed to indirectly reference itself via a class.
     Source source = addSource(r'''
 typedef C A();
@@ -6042,24 +6032,24 @@
 class C {
   B a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_returnType() {
+  test_typeAliasCannotReferenceItself_returnType() async {
     Source source = addSource("typedef A A();");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_returnType_indirect() {
+  test_typeAliasCannotReferenceItself_returnType_indirect() async {
     Source source = addSource(r'''
 typedef B A();
 typedef A B();''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF,
       CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF
@@ -6067,15 +6057,15 @@
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_typeVariableBounds() {
+  test_typeAliasCannotReferenceItself_typeVariableBounds() async {
     Source source = addSource("typedef A<T extends A>();");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF]);
     verify([source]);
   }
 
-  void test_typeArgumentNotMatchingBounds_const() {
+  test_typeArgumentNotMatchingBounds_const() async {
     Source source = addSource(r'''
 class A {}
 class B {}
@@ -6083,35 +6073,35 @@
   const G();
 }
 f() { return const G<B>(); }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
     verify([source]);
   }
 
-  void test_undefinedClass_const() {
+  test_undefinedClass_const() async {
     Source source = addSource(r'''
 f() {
   return const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.UNDEFINED_CLASS]);
     verify([source]);
   }
 
-  void test_undefinedConstructorInInitializer_explicit_named() {
+  test_undefinedConstructorInInitializer_explicit_named() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
   B() : super.named();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER]);
     // no verify(), "super.named()" is not resolved
   }
 
-  void test_undefinedConstructorInInitializer_explicit_unnamed() {
+  test_undefinedConstructorInInitializer_explicit_unnamed() async {
     Source source = addSource(r'''
 class A {
   A.named() {}
@@ -6119,13 +6109,13 @@
 class B extends A {
   B() : super();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
     verify([source]);
   }
 
-  void test_undefinedConstructorInInitializer_implicit() {
+  test_undefinedConstructorInInitializer_implicit() async {
     Source source = addSource(r'''
 class A {
   A.named() {}
@@ -6133,13 +6123,13 @@
 class B extends A {
   B();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
     verify([source]);
   }
 
-  void test_undefinedNamedParameter() {
+  test_undefinedNamedParameter() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -6147,70 +6137,80 @@
 main() {
   const A(p: 0);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.UNDEFINED_NAMED_PARAMETER]);
     // no verify(), 'p' is not resolved
   }
 
-  void test_uriDoesNotExist_export() {
+  test_uriDoesNotExist_export() async {
     Source source = addSource("export 'unknown.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
   }
 
-  void test_uriDoesNotExist_import() {
+  test_uriDoesNotExist_import() async {
     Source source = addSource("import 'unknown.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
   }
 
-  void test_uriDoesNotExist_import_appears_after_deleting_target() {
+  test_uriDoesNotExist_import_appears_after_deleting_target() async {
     Source test = addSource("import 'target.dart';");
     Source target = addNamedSource("/target.dart", "");
-    computeLibrarySourceErrors(test);
+    await computeAnalysisResult(test);
     assertErrors(test, [HintCode.UNUSED_IMPORT]);
 
     // Remove the overlay in the same way as AnalysisServer.
-    analysisContext2.setContents(target, null);
-    ChangeSet changeSet = new ChangeSet()..removedSource(target);
-    analysisContext2.applyChanges(changeSet);
+    resourceProvider.deleteFile(target.fullName);
+    if (enableNewAnalysisDriver) {
+      driver.removeFile(target.fullName);
+    } else {
+      analysisContext2.setContents(target, null);
+      ChangeSet changeSet = new ChangeSet()..removedSource(target);
+      analysisContext2.applyChanges(changeSet);
+    }
 
-    computeLibrarySourceErrors(test);
+    await computeAnalysisResult(test);
     assertErrors(test, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
   }
 
-  void test_uriDoesNotExist_import_disappears_when_fixed() {
+  test_uriDoesNotExist_import_disappears_when_fixed() async {
     Source source = addSource("import 'target.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
 
-    // Check that the file is represented as missing.
-    Source target = analysisContext2
-        .getSourcesWithFullName(resourceProvider.convertPath("/target.dart"))
-        .first;
-    expect(analysisContext2.getModificationStamp(target), -1);
+    String targetPath = resourceProvider.convertPath('/target.dart');
+    if (enableNewAnalysisDriver) {
+      // Add an overlay in the same way as AnalysisServer.
+      fileContentOverlay[targetPath] = '';
+      driver.changeFile(targetPath);
+    } else {
+      // Check that the file is represented as missing.
+      Source target = analysisContext2.getSourcesWithFullName(targetPath).first;
+      expect(analysisContext2.getModificationStamp(target), -1);
 
-    // Add an overlay in the same way as AnalysisServer.
-    analysisContext2
-      ..setContents(target, "")
-      ..handleContentsChanged(target, null, "", true);
+      // Add an overlay in the same way as AnalysisServer.
+      analysisContext2
+        ..setContents(target, "")
+        ..handleContentsChanged(target, null, "", true);
+    }
 
     // Make sure the error goes away.
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_IMPORT]);
   }
 
-  void test_uriDoesNotExist_part() {
+  test_uriDoesNotExist_part() async {
     Source source = addSource(r'''
 library lib;
 part 'unknown.dart';''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
   }
 
-  void test_uriWithInterpolation_constant() {
+  test_uriWithInterpolation_constant() async {
     Source source = addSource("import 'stuff_\$platform.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.URI_WITH_INTERPOLATION,
       StaticWarningCode.UNDEFINED_IDENTIFIER
@@ -6219,179 +6219,182 @@
     // URI: 'stuff_$platform.dart'
   }
 
-  void test_uriWithInterpolation_nonConstant() {
+  test_uriWithInterpolation_nonConstant() async {
     Source source = addSource(r'''
 library lib;
 part '${'a'}.dart';''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.URI_WITH_INTERPOLATION]);
     // We cannot verify resolution with an unresolvable URI: '${'a'}.dart'
   }
 
-  void test_wrongNumberOfParametersForOperator1() {
-    _check_wrongNumberOfParametersForOperator1("<");
-    _check_wrongNumberOfParametersForOperator1(">");
-    _check_wrongNumberOfParametersForOperator1("<=");
-    _check_wrongNumberOfParametersForOperator1(">=");
-    _check_wrongNumberOfParametersForOperator1("+");
-    _check_wrongNumberOfParametersForOperator1("/");
-    _check_wrongNumberOfParametersForOperator1("~/");
-    _check_wrongNumberOfParametersForOperator1("*");
-    _check_wrongNumberOfParametersForOperator1("%");
-    _check_wrongNumberOfParametersForOperator1("|");
-    _check_wrongNumberOfParametersForOperator1("^");
-    _check_wrongNumberOfParametersForOperator1("&");
-    _check_wrongNumberOfParametersForOperator1("<<");
-    _check_wrongNumberOfParametersForOperator1(">>");
-    _check_wrongNumberOfParametersForOperator1("[]");
+  test_wrongNumberOfParametersForOperator1() async {
+    await _check_wrongNumberOfParametersForOperator1("<");
+    await _check_wrongNumberOfParametersForOperator1(">");
+    await _check_wrongNumberOfParametersForOperator1("<=");
+    await _check_wrongNumberOfParametersForOperator1(">=");
+    await _check_wrongNumberOfParametersForOperator1("+");
+    await _check_wrongNumberOfParametersForOperator1("/");
+    await _check_wrongNumberOfParametersForOperator1("~/");
+    await _check_wrongNumberOfParametersForOperator1("*");
+    await _check_wrongNumberOfParametersForOperator1("%");
+    await _check_wrongNumberOfParametersForOperator1("|");
+    await _check_wrongNumberOfParametersForOperator1("^");
+    await _check_wrongNumberOfParametersForOperator1("&");
+    await _check_wrongNumberOfParametersForOperator1("<<");
+    await _check_wrongNumberOfParametersForOperator1(">>");
+    await _check_wrongNumberOfParametersForOperator1("[]");
   }
 
-  void test_wrongNumberOfParametersForOperator_minus() {
+  test_wrongNumberOfParametersForOperator_minus() async {
     Source source = addSource(r'''
 class A {
   operator -(a, b) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS]);
     verify([source]);
     reset();
   }
 
-  void test_wrongNumberOfParametersForOperator_tilde() {
-    _check_wrongNumberOfParametersForOperator("~", "a");
-    _check_wrongNumberOfParametersForOperator("~", "a, b");
+  test_wrongNumberOfParametersForOperator_tilde() async {
+    await _check_wrongNumberOfParametersForOperator("~", "a");
+    await _check_wrongNumberOfParametersForOperator("~", "a, b");
   }
 
-  void test_wrongNumberOfParametersForSetter_function_named() {
+  test_wrongNumberOfParametersForSetter_function_named() async {
     Source source = addSource("set x({p}) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_wrongNumberOfParametersForSetter_function_optional() {
+  test_wrongNumberOfParametersForSetter_function_optional() async {
     Source source = addSource("set x([p]) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_wrongNumberOfParametersForSetter_function_tooFew() {
+  test_wrongNumberOfParametersForSetter_function_tooFew() async {
     Source source = addSource("set x() {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_wrongNumberOfParametersForSetter_function_tooMany() {
+  test_wrongNumberOfParametersForSetter_function_tooMany() async {
     Source source = addSource("set x(a, b) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_wrongNumberOfParametersForSetter_method_named() {
+  test_wrongNumberOfParametersForSetter_method_named() async {
     Source source = addSource(r'''
 class A {
   set x({p}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_wrongNumberOfParametersForSetter_method_optional() {
+  test_wrongNumberOfParametersForSetter_method_optional() async {
     Source source = addSource(r'''
 class A {
   set x([p]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_wrongNumberOfParametersForSetter_method_tooFew() {
+  test_wrongNumberOfParametersForSetter_method_tooFew() async {
     Source source = addSource(r'''
 class A {
   set x() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_wrongNumberOfParametersForSetter_method_tooMany() {
+  test_wrongNumberOfParametersForSetter_method_tooMany() async {
     Source source = addSource(r'''
 class A {
   set x(a, b) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_yield_used_as_identifier_in_async_method() {
+  test_yield_used_as_identifier_in_async_method() async {
     Source source = addSource('''
 f() async {
   var yield = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_yield_used_as_identifier_in_async_star_method() {
+  test_yield_used_as_identifier_in_async_star_method() async {
     Source source = addSource('''
 f() async* {
   var yield = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void test_yield_used_as_identifier_in_sync_star_method() {
+  test_yield_used_as_identifier_in_sync_star_method() async {
     Source source = addSource('''
 f() sync* {
   var yield = 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER]);
     verify([source]);
   }
 
-  void _check_constEvalThrowsException_binary_null(String expr, bool resolved) {
+  Future<Null> _check_constEvalThrowsException_binary_null(
+      String expr, bool resolved) async {
     Source source = addSource("const C = $expr;");
-    computeLibrarySourceErrors(source);
     if (resolved) {
+      await computeAnalysisResult(source);
       assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
       verify([source]);
     } else {
+      await computeAnalysisResult(source);
       assertErrors(source, [CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION]);
       // no verify(), 'null x' is not resolved
     }
     reset();
   }
 
-  void _check_constEvalTypeBool_withParameter_binary(String expr) {
+  Future<Null> _check_constEvalTypeBool_withParameter_binary(
+      String expr) async {
     Source source = addSource('''
 class A {
   final a;
   const A(bool p) : a = $expr;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL,
       StaticTypeWarningCode.NON_BOOL_OPERAND
@@ -6400,13 +6403,13 @@
     reset();
   }
 
-  void _check_constEvalTypeInt_withParameter_binary(String expr) {
+  Future<Null> _check_constEvalTypeInt_withParameter_binary(String expr) async {
     Source source = addSource('''
 class A {
   final a;
   const A(int p) : a = $expr;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_TYPE_INT,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
@@ -6415,13 +6418,13 @@
     reset();
   }
 
-  void _check_constEvalTypeNum_withParameter_binary(String expr) {
+  Future<Null> _check_constEvalTypeNum_withParameter_binary(String expr) async {
     Source source = addSource('''
 class A {
   final a;
   const A(num p) : a = $expr;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.CONST_EVAL_TYPE_NUM,
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE
@@ -6430,21 +6433,21 @@
     reset();
   }
 
-  void _check_wrongNumberOfParametersForOperator(
-      String name, String parameters) {
+  Future<Null> _check_wrongNumberOfParametersForOperator(
+      String name, String parameters) async {
     Source source = addSource('''
 class A {
   operator $name($parameters) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR]);
     verify([source]);
     reset();
   }
 
-  void _check_wrongNumberOfParametersForOperator1(String name) {
-    _check_wrongNumberOfParametersForOperator(name, "");
-    _check_wrongNumberOfParametersForOperator(name, "a, b");
+  Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
+    await _check_wrongNumberOfParametersForOperator(name, "");
+    await _check_wrongNumberOfParametersForOperator(name, "a, b");
   }
 }
diff --git a/pkg/analyzer/test/generated/declaration_resolver_test.dart b/pkg/analyzer/test/generated/declaration_resolver_test.dart
index eeaf82d..9ecac6a 100644
--- a/pkg/analyzer/test/generated/declaration_resolver_test.dart
+++ b/pkg/analyzer/test/generated/declaration_resolver_test.dart
@@ -4,6 +4,8 @@
 
 library engine.declaration_resolver_test;
 
+import 'dart:async';
+
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/dart/ast/ast.dart';
@@ -59,50 +61,50 @@
     }
   }
 
-  void setupCode(String code) {
+  Future<Null> setupCode(String code) async {
     this.code = code;
-    unit = resolveSource(code + ' const a = null;');
+    unit = await resolveSource(code + ' const a = null;');
     unit2 = _cloneResolveUnit(unit);
   }
 
-  void test_metadata_classDeclaration() {
-    setupCode('@a class C {}');
+  test_metadata_classDeclaration() async {
+    await setupCode('@a class C {}');
     checkMetadata('C');
   }
 
-  void test_metadata_classTypeAlias() {
-    setupCode('@a class C = D with E; class D {} class E {}');
+  test_metadata_classTypeAlias() async {
+    await setupCode('@a class C = D with E; class D {} class E {}');
     checkMetadata('C');
   }
 
-  void test_metadata_constructorDeclaration_named() {
-    setupCode('class C { @a C.x(); }');
+  test_metadata_constructorDeclaration_named() async {
+    await setupCode('class C { @a C.x(); }');
     checkMetadata('x');
   }
 
-  void test_metadata_constructorDeclaration_unnamed() {
-    setupCode('class C { @a C(); }');
+  test_metadata_constructorDeclaration_unnamed() async {
+    await setupCode('class C { @a C(); }');
     checkMetadata('C()');
   }
 
-  void test_metadata_declaredIdentifier() {
-    setupCode('f(x, y) { for (@a var x in y) {} }');
+  test_metadata_declaredIdentifier() async {
+    await setupCode('f(x, y) { for (@a var x in y) {} }');
     checkMetadata('var', expectDifferent: true);
   }
 
-  void test_metadata_enumDeclaration() {
-    setupCode('@a enum E { v }');
+  test_metadata_enumDeclaration() async {
+    await setupCode('@a enum E { v }');
     checkMetadata('E');
   }
 
-  void test_metadata_exportDirective() {
+  test_metadata_exportDirective() async {
     addNamedSource('/foo.dart', 'class C {}');
-    setupCode('@a export "foo.dart";');
+    await setupCode('@a export "foo.dart";');
     checkMetadata('export');
   }
 
-  void test_metadata_exportDirective_resynthesized() {
-    CompilationUnit unit = resolveSource(r'''
+  test_metadata_exportDirective_resynthesized() async {
+    CompilationUnit unit = await resolveSource(r'''
 @a
 export "dart:async";
 
@@ -128,58 +130,58 @@
     expect(unit.directives[1].metadata.single.name.name, 'b');
   }
 
-  void test_metadata_fieldDeclaration() {
-    setupCode('class C { @a int x; }');
+  test_metadata_fieldDeclaration() async {
+    await setupCode('class C { @a int x; }');
     checkMetadata('x');
   }
 
-  void test_metadata_fieldFormalParameter() {
-    setupCode('class C { var x; C(@a this.x); }');
+  test_metadata_fieldFormalParameter() async {
+    await setupCode('class C { var x; C(@a this.x); }');
     checkMetadata('this');
   }
 
-  void test_metadata_fieldFormalParameter_withDefault() {
-    setupCode('class C { var x; C([@a this.x = null]); }');
+  test_metadata_fieldFormalParameter_withDefault() async {
+    await setupCode('class C { var x; C([@a this.x = null]); }');
     checkMetadata('this');
   }
 
-  void test_metadata_functionDeclaration_function() {
-    setupCode('@a f() {}');
+  test_metadata_functionDeclaration_function() async {
+    await setupCode('@a f() {}');
     checkMetadata('f');
   }
 
-  void test_metadata_functionDeclaration_getter() {
-    setupCode('@a get f() => null;');
+  test_metadata_functionDeclaration_getter() async {
+    await setupCode('@a get f() => null;');
     checkMetadata('f');
   }
 
-  void test_metadata_functionDeclaration_setter() {
-    setupCode('@a set f(value) {}');
+  test_metadata_functionDeclaration_setter() async {
+    await setupCode('@a set f(value) {}');
     checkMetadata('f');
   }
 
-  void test_metadata_functionTypeAlias() {
-    setupCode('@a typedef F();');
+  test_metadata_functionTypeAlias() async {
+    await setupCode('@a typedef F();');
     checkMetadata('F');
   }
 
-  void test_metadata_functionTypedFormalParameter() {
-    setupCode('f(@a g()) {}');
+  test_metadata_functionTypedFormalParameter() async {
+    await setupCode('f(@a g()) {}');
     checkMetadata('g');
   }
 
-  void test_metadata_functionTypedFormalParameter_withDefault() {
-    setupCode('f([@a g() = null]) {}');
+  test_metadata_functionTypedFormalParameter_withDefault() async {
+    await setupCode('f([@a g() = null]) {}');
     checkMetadata('g');
   }
 
-  void test_metadata_importDirective() {
+  test_metadata_importDirective() async {
     addNamedSource('/foo.dart', 'class C {}');
-    setupCode('@a import "foo.dart";');
+    await setupCode('@a import "foo.dart";');
     checkMetadata('import');
   }
 
-  void test_metadata_importDirective_partiallyResolved() {
+  test_metadata_importDirective_partiallyResolved() async {
     addNamedSource('/foo.dart', 'class C {}');
     this.code = 'const a = null; @a import "foo.dart";';
     Source source = addNamedSource('/test.dart', code);
@@ -190,8 +192,8 @@
     checkMetadata('import');
   }
 
-  void test_metadata_importDirective_resynthesized() {
-    CompilationUnit unit = resolveSource(r'''
+  test_metadata_importDirective_resynthesized() async {
+    CompilationUnit unit = await resolveSource(r'''
 @a
 import "dart:async";
 
@@ -217,13 +219,14 @@
     expect(unit.directives[1].metadata.single.name.name, 'b');
   }
 
-  void test_metadata_libraryDirective() {
-    setupCode('@a library L;');
+  test_metadata_libraryDirective() async {
+    await setupCode('@a library L;');
     checkMetadata('L');
   }
 
-  void test_metadata_libraryDirective_resynthesized() {
-    CompilationUnit unit = resolveSource('@a library L; const a = null;');
+  test_metadata_libraryDirective_resynthesized() async {
+    CompilationUnit unit =
+        await resolveSource('@a library L; const a = null;');
     expect(unit.directives.single.metadata.single.name.name, 'a');
     var unitElement = unit.element as CompilationUnitElementImpl;
     // Damage the unit element - as if "setAnnotations" were not called.
@@ -236,8 +239,8 @@
     expect(clonedUnit.directives.single.metadata.single.name.name, 'a');
   }
 
-  void test_metadata_localFunctionDeclaration() {
-    setupCode('f() { @a g() {} }');
+  test_metadata_localFunctionDeclaration() async {
+    await setupCode('f() { @a g() {} }');
     // Note: metadata on local function declarations is ignored by the
     // analyzer.  TODO(paulberry): is this a bug?
     FunctionDeclaration node = EngineTestCase.findNode(
@@ -245,64 +248,64 @@
     expect((node as FunctionDeclarationImpl).metadata, isEmpty);
   }
 
-  void test_metadata_localVariableDeclaration() {
-    setupCode('f() { @a int x; }');
+  test_metadata_localVariableDeclaration() async {
+    await setupCode('f() { @a int x; }');
     checkMetadata('x', expectDifferent: true);
   }
 
-  void test_metadata_methodDeclaration_getter() {
-    setupCode('class C { @a get m => null; }');
+  test_metadata_methodDeclaration_getter() async {
+    await setupCode('class C { @a get m => null; }');
     checkMetadata('m');
   }
 
-  void test_metadata_methodDeclaration_method() {
-    setupCode('class C { @a m() {} }');
+  test_metadata_methodDeclaration_method() async {
+    await setupCode('class C { @a m() {} }');
     checkMetadata('m');
   }
 
-  void test_metadata_methodDeclaration_setter() {
-    setupCode('class C { @a set m(value) {} }');
+  test_metadata_methodDeclaration_setter() async {
+    await setupCode('class C { @a set m(value) {} }');
     checkMetadata('m');
   }
 
-  void test_metadata_partDirective() {
+  test_metadata_partDirective() async {
     addNamedSource('/foo.dart', 'part of L;');
-    setupCode('library L; @a part "foo.dart";');
+    await setupCode('library L; @a part "foo.dart";');
     checkMetadata('part');
   }
 
-  void test_metadata_simpleFormalParameter() {
-    setupCode('f(@a x) {}) {}');
+  test_metadata_simpleFormalParameter() async {
+    await setupCode('f(@a x) {}) {}');
     checkMetadata('x');
   }
 
-  void test_metadata_simpleFormalParameter_withDefault() {
-    setupCode('f([@a x = null]) {}');
+  test_metadata_simpleFormalParameter_withDefault() async {
+    await setupCode('f([@a x = null]) {}');
     checkMetadata('x');
   }
 
-  void test_metadata_topLevelVariableDeclaration() {
-    setupCode('@a int x;');
+  test_metadata_topLevelVariableDeclaration() async {
+    await setupCode('@a int x;');
     checkMetadata('x');
   }
 
-  void test_metadata_typeParameter_ofClass() {
-    setupCode('class C<@a T> {}');
+  test_metadata_typeParameter_ofClass() async {
+    await setupCode('class C<@a T> {}');
     checkMetadata('T');
   }
 
-  void test_metadata_typeParameter_ofClassTypeAlias() {
-    setupCode('class C<@a T> = D with E; class D {} class E {}');
+  test_metadata_typeParameter_ofClassTypeAlias() async {
+    await setupCode('class C<@a T> = D with E; class D {} class E {}');
     checkMetadata('T');
   }
 
-  void test_metadata_typeParameter_ofFunction() {
-    setupCode('f<@a T>() {}');
+  test_metadata_typeParameter_ofFunction() async {
+    await setupCode('f<@a T>() {}');
     checkMetadata('T');
   }
 
-  void test_metadata_typeParameter_ofTypedef() {
-    setupCode('typedef F<@a T>();');
+  test_metadata_typeParameter_ofTypedef() async {
+    await setupCode('typedef F<@a T>();');
     checkMetadata('T');
   }
 
@@ -330,7 +333,7 @@
     super.setUp();
   }
 
-  void test_closure_inside_catch_block() {
+  test_closure_inside_catch_block() async {
     String code = '''
 f() {
   try {
@@ -339,13 +342,13 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_closure_inside_labeled_statement() {
+  test_closure_inside_labeled_statement() async {
     String code = '''
 f(b) {
   foo: while (true) {
@@ -356,13 +359,13 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_closure_inside_switch_case() {
+  test_closure_inside_switch_case() async {
     String code = '''
 void f(k, m) {
   switch (k) {
@@ -372,13 +375,13 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_closure_inside_switch_default() {
+  test_closure_inside_switch_default() async {
     String code = '''
 void f(k, m) {
   switch (k) {
@@ -388,13 +391,13 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_enumConstant_partiallyResolved() {
+  test_enumConstant_partiallyResolved() async {
     String code = r'''
 enum Fruit {apple, pear}
 ''';
@@ -406,11 +409,11 @@
     _cloneResolveUnit(unit);
   }
 
-  void test_functionDeclaration_getter() {
+  test_functionDeclaration_getter() async {
     String code = r'''
 int get zzz => 42;
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     PropertyAccessorElement getterElement =
         _findSimpleIdentifier(unit, code, 'zzz =>').staticElement;
     expect(getterElement.isGetter, isTrue);
@@ -420,11 +423,11 @@
     expect(getterName.staticElement, same(getterElement));
   }
 
-  void test_functionDeclaration_setter() {
+  test_functionDeclaration_setter() async {
     String code = r'''
 void set zzz(_) {}
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     PropertyAccessorElement setterElement =
         _findSimpleIdentifier(unit, code, 'zzz(_)').staticElement;
     expect(setterElement.isSetter, isTrue);
@@ -434,7 +437,7 @@
     expect(getterName.staticElement, same(setterElement));
   }
 
-  void test_invalid_functionDeclaration_getter_inFunction() {
+  test_invalid_functionDeclaration_getter_inFunction() async {
     String code = r'''
 var v = (() {
   main() {
@@ -442,7 +445,7 @@
   }
 });
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     FunctionElement getterElement =
         _findSimpleIdentifier(unit, code, 'zzz =>').staticElement;
     // re-resolve
@@ -451,7 +454,7 @@
     expect(getterName.staticElement, same(getterElement));
   }
 
-  void test_invalid_functionDeclaration_setter_inFunction() {
+  test_invalid_functionDeclaration_setter_inFunction() async {
     String code = r'''
 var v = (() {
   main() {
@@ -459,7 +462,7 @@
   }
 });
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     FunctionElement setterElement =
         _findSimpleIdentifier(unit, code, 'zzz(x)').staticElement;
     // re-resolve
@@ -468,66 +471,66 @@
     expect(setterName.staticElement, same(setterElement));
   }
 
-  void test_visitExportDirective_notExistingSource() {
+  test_visitExportDirective_notExistingSource() async {
     String code = r'''
 export 'foo.dart';
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_visitExportDirective_unresolvedUri() {
+  test_visitExportDirective_unresolvedUri() async {
     String code = r'''
 export 'package:foo/bar.dart';
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_visitFunctionExpression() {
+  test_visitFunctionExpression() async {
     String code = r'''
 main(List<String> items) {
   items.forEach((item) {});
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_visitImportDirective_notExistingSource() {
+  test_visitImportDirective_notExistingSource() async {
     String code = r'''
 import 'foo.dart';
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_visitImportDirective_unresolvedUri() {
+  test_visitImportDirective_unresolvedUri() async {
     String code = r'''
 import 'package:foo/bar.dart';
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_visitMethodDeclaration_getter_duplicate() {
+  test_visitMethodDeclaration_getter_duplicate() async {
     String code = r'''
 class C {
   int get zzz => 1;
   String get zzz => null;
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     PropertyAccessorElement firstElement =
         _findSimpleIdentifier(unit, code, 'zzz => 1').staticElement;
     PropertyAccessorElement secondElement =
@@ -541,7 +544,7 @@
     expect(secondName.staticElement, same(secondElement));
   }
 
-  void test_visitMethodDeclaration_getterSetter() {
+  test_visitMethodDeclaration_getterSetter() async {
     String code = r'''
 class C {
   int _field = 0;
@@ -549,7 +552,7 @@
   void set field(value) {_field = value;}
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     FieldElement getterElement =
         _findSimpleIdentifier(unit, code, 'field =').staticElement;
     PropertyAccessorElement setterElement =
@@ -562,14 +565,14 @@
     expect(setterName.staticElement, same(setterElement));
   }
 
-  void test_visitMethodDeclaration_method_duplicate() {
+  test_visitMethodDeclaration_method_duplicate() async {
     String code = r'''
 class C {
   void zzz(x) {}
   void zzz(y) {}
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     MethodElement firstElement =
         _findSimpleIdentifier(unit, code, 'zzz(x)').staticElement;
     MethodElement secondElement =
@@ -582,7 +585,7 @@
     expect(secondName.staticElement, same(secondElement));
   }
 
-  void test_visitMethodDeclaration_setter_duplicate() {
+  test_visitMethodDeclaration_setter_duplicate() async {
     // https://github.com/dart-lang/sdk/issues/25601
     String code = r'''
 class C {
@@ -590,7 +593,7 @@
   set zzz(y) {}
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     PropertyAccessorElement firstElement =
         _findSimpleIdentifier(unit, code, 'zzz(x)').staticElement;
     PropertyAccessorElement secondElement =
@@ -603,24 +606,24 @@
     expect(secondName.staticElement, same(secondElement));
   }
 
-  void test_visitMethodDeclaration_unaryMinus() {
+  test_visitMethodDeclaration_unaryMinus() async {
     String code = r'''
 class C {
   C operator -() => null;
   C operator -(C other) => null;
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
   }
 
-  void test_visitPartDirective_notExistingSource() {
+  test_visitPartDirective_notExistingSource() async {
     String code = r'''
 part 'foo.bar';
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     // re-resolve
     _cloneResolveUnit(unit);
     // no other validations than built into DeclarationResolver
@@ -634,14 +637,14 @@
 class StrongModeDeclarationResolverTest extends ResolverTestCase {
   @override
   void setUp() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
   }
 
-  void test_genericFunction_typeParameter() {
+  test_genericFunction_typeParameter() async {
     String code = r'''
 /*=T*/ max/*<T>*/(/*=T*/ x, /*=T*/ y) => null;
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     FunctionDeclaration node = _findSimpleIdentifier(unit, code, 'max').parent;
     TypeParameter t = node.functionExpression.typeParameters.typeParameters[0];
 
@@ -659,13 +662,13 @@
     expect(t.element, same(tElement));
   }
 
-  void test_genericMethod_typeParameter() {
+  test_genericMethod_typeParameter() async {
     String code = r'''
 class C {
   /*=T*/ max/*<T>*/(/*=T*/ x, /*=T*/ y) => null;
 }
 ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     MethodDeclaration node = _findSimpleIdentifier(unit, code, 'max').parent;
     TypeParameter t = node.typeParameters.typeParameters[0];
 
diff --git a/pkg/analyzer/test/generated/element_resolver_test.dart b/pkg/analyzer/test/generated/element_resolver_test.dart
index 9824236..26c6ab0 100644
--- a/pkg/analyzer/test/generated/element_resolver_test.dart
+++ b/pkg/analyzer/test/generated/element_resolver_test.dart
@@ -4,7 +4,11 @@
 
 library analyzer.test.generated.element_resolver_test;
 
+import 'dart:async';
+
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
@@ -34,7 +38,7 @@
 
 @reflectiveTest
 class ElementResolverCodeTest extends ResolverTestCase {
-  void test_annotation_class_namedConstructor() {
+  test_annotation_class_namedConstructor() async {
     addNamedSource(
         '/a.dart',
         r'''
@@ -42,16 +46,17 @@
   const A.named();
 }
 ''');
-    _validateAnnotation('', '@A.named()', (SimpleIdentifier name1,
+    await _validateAnnotation('', '@A.named()', (SimpleIdentifier name1,
         SimpleIdentifier name2,
         SimpleIdentifier name3,
         Element annotationElement) {
       expect(name1, isNotNull);
       expect(name1.staticElement, new isInstanceOf<ClassElement>());
-      expect(name1.staticElement.displayName, 'A');
+      expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'A');
       expect(name2, isNotNull);
       expect(name2.staticElement, new isInstanceOf<ConstructorElement>());
-      expect(name2.staticElement.displayName, 'named');
+      expect(
+          resolutionMap.staticElementForIdentifier(name2).displayName, 'named');
       expect(name3, isNull);
       if (annotationElement is ConstructorElement) {
         expect(annotationElement, same(name2.staticElement));
@@ -65,7 +70,7 @@
     });
   }
 
-  void test_annotation_class_prefixed_namedConstructor() {
+  test_annotation_class_prefixed_namedConstructor() async {
     addNamedSource(
         '/a.dart',
         r'''
@@ -73,19 +78,20 @@
   const A.named();
 }
 ''');
-    _validateAnnotation('as p', '@p.A.named()', (SimpleIdentifier name1,
+    await _validateAnnotation('as p', '@p.A.named()', (SimpleIdentifier name1,
         SimpleIdentifier name2,
         SimpleIdentifier name3,
         Element annotationElement) {
       expect(name1, isNotNull);
       expect(name1.staticElement, new isInstanceOf<PrefixElement>());
-      expect(name1.staticElement.displayName, 'p');
+      expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'p');
       expect(name2, isNotNull);
       expect(name2.staticElement, new isInstanceOf<ClassElement>());
-      expect(name2.staticElement.displayName, 'A');
+      expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'A');
       expect(name3, isNotNull);
       expect(name3.staticElement, new isInstanceOf<ConstructorElement>());
-      expect(name3.staticElement.displayName, 'named');
+      expect(
+          resolutionMap.staticElementForIdentifier(name3).displayName, 'named');
       if (annotationElement is ConstructorElement) {
         expect(annotationElement, same(name3.staticElement));
         expect(annotationElement.enclosingElement, name2.staticElement);
@@ -98,7 +104,7 @@
     });
   }
 
-  void test_annotation_class_prefixed_staticConstField() {
+  test_annotation_class_prefixed_staticConstField() async {
     addNamedSource(
         '/a.dart',
         r'''
@@ -106,19 +112,19 @@
   static const V = 0;
 }
 ''');
-    _validateAnnotation('as p', '@p.A.V', (SimpleIdentifier name1,
+    await _validateAnnotation('as p', '@p.A.V', (SimpleIdentifier name1,
         SimpleIdentifier name2,
         SimpleIdentifier name3,
         Element annotationElement) {
       expect(name1, isNotNull);
       expect(name1.staticElement, new isInstanceOf<PrefixElement>());
-      expect(name1.staticElement.displayName, 'p');
+      expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'p');
       expect(name2, isNotNull);
       expect(name2.staticElement, new isInstanceOf<ClassElement>());
-      expect(name2.staticElement.displayName, 'A');
+      expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'A');
       expect(name3, isNotNull);
       expect(name3.staticElement, new isInstanceOf<PropertyAccessorElement>());
-      expect(name3.staticElement.displayName, 'V');
+      expect(resolutionMap.staticElementForIdentifier(name3).displayName, 'V');
       if (annotationElement is PropertyAccessorElement) {
         expect(annotationElement, same(name3.staticElement));
         expect(annotationElement.enclosingElement, name2.staticElement);
@@ -130,7 +136,7 @@
     });
   }
 
-  void test_annotation_class_prefixed_unnamedConstructor() {
+  test_annotation_class_prefixed_unnamedConstructor() async {
     addNamedSource(
         '/a.dart',
         r'''
@@ -138,16 +144,16 @@
   const A();
 }
 ''');
-    _validateAnnotation('as p', '@p.A', (SimpleIdentifier name1,
+    await _validateAnnotation('as p', '@p.A', (SimpleIdentifier name1,
         SimpleIdentifier name2,
         SimpleIdentifier name3,
         Element annotationElement) {
       expect(name1, isNotNull);
       expect(name1.staticElement, new isInstanceOf<PrefixElement>());
-      expect(name1.staticElement.displayName, 'p');
+      expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'p');
       expect(name2, isNotNull);
       expect(name2.staticElement, new isInstanceOf<ClassElement>());
-      expect(name2.staticElement.displayName, 'A');
+      expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'A');
       expect(name3, isNull);
       if (annotationElement is ConstructorElement) {
         expect(annotationElement.enclosingElement, name2.staticElement);
@@ -160,7 +166,7 @@
     });
   }
 
-  void test_annotation_class_staticConstField() {
+  test_annotation_class_staticConstField() async {
     addNamedSource(
         '/a.dart',
         r'''
@@ -168,16 +174,16 @@
   static const V = 0;
 }
 ''');
-    _validateAnnotation('', '@A.V', (SimpleIdentifier name1,
+    await _validateAnnotation('', '@A.V', (SimpleIdentifier name1,
         SimpleIdentifier name2,
         SimpleIdentifier name3,
         Element annotationElement) {
       expect(name1, isNotNull);
       expect(name1.staticElement, new isInstanceOf<ClassElement>());
-      expect(name1.staticElement.displayName, 'A');
+      expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'A');
       expect(name2, isNotNull);
       expect(name2.staticElement, new isInstanceOf<PropertyAccessorElement>());
-      expect(name2.staticElement.displayName, 'V');
+      expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'V');
       expect(name3, isNull);
       if (annotationElement is PropertyAccessorElement) {
         expect(annotationElement, same(name2.staticElement));
@@ -190,7 +196,7 @@
     });
   }
 
-  void test_annotation_class_unnamedConstructor() {
+  test_annotation_class_unnamedConstructor() async {
     addNamedSource(
         '/a.dart',
         r'''
@@ -198,13 +204,13 @@
   const A();
 }
 ''');
-    _validateAnnotation('', '@A', (SimpleIdentifier name1,
+    await _validateAnnotation('', '@A', (SimpleIdentifier name1,
         SimpleIdentifier name2,
         SimpleIdentifier name3,
         Element annotationElement) {
       expect(name1, isNotNull);
       expect(name1.staticElement, new isInstanceOf<ClassElement>());
-      expect(name1.staticElement.displayName, 'A');
+      expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'A');
       expect(name2, isNull);
       expect(name3, isNull);
       if (annotationElement is ConstructorElement) {
@@ -218,19 +224,19 @@
     });
   }
 
-  void test_annotation_topLevelVariable() {
+  test_annotation_topLevelVariable() async {
     addNamedSource(
         '/a.dart',
         r'''
 const V = 0;
 ''');
-    _validateAnnotation('', '@V', (SimpleIdentifier name1,
+    await _validateAnnotation('', '@V', (SimpleIdentifier name1,
         SimpleIdentifier name2,
         SimpleIdentifier name3,
         Element annotationElement) {
       expect(name1, isNotNull);
       expect(name1.staticElement, new isInstanceOf<PropertyAccessorElement>());
-      expect(name1.staticElement.displayName, 'V');
+      expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'V');
       expect(name2, isNull);
       expect(name3, isNull);
       if (annotationElement is PropertyAccessorElement) {
@@ -245,22 +251,22 @@
     });
   }
 
-  void test_annotation_topLevelVariable_prefixed() {
+  test_annotation_topLevelVariable_prefixed() async {
     addNamedSource(
         '/a.dart',
         r'''
 const V = 0;
 ''');
-    _validateAnnotation('as p', '@p.V', (SimpleIdentifier name1,
+    await _validateAnnotation('as p', '@p.V', (SimpleIdentifier name1,
         SimpleIdentifier name2,
         SimpleIdentifier name3,
         Element annotationElement) {
       expect(name1, isNotNull);
       expect(name1.staticElement, new isInstanceOf<PrefixElement>());
-      expect(name1.staticElement.displayName, 'p');
+      expect(resolutionMap.staticElementForIdentifier(name1).displayName, 'p');
       expect(name2, isNotNull);
       expect(name2.staticElement, new isInstanceOf<PropertyAccessorElement>());
-      expect(name2.staticElement.displayName, 'V');
+      expect(resolutionMap.staticElementForIdentifier(name2).displayName, 'V');
       expect(name3, isNull);
       if (annotationElement is PropertyAccessorElement) {
         expect(annotationElement, same(name2.staticElement));
@@ -274,12 +280,12 @@
     });
   }
 
-  void _validateAnnotation(
+  Future<Null> _validateAnnotation(
       String annotationPrefix,
       String annotationText,
       validator(SimpleIdentifier name1, SimpleIdentifier name2,
-          SimpleIdentifier name3, Element annotationElement)) {
-    CompilationUnit unit = resolveSource('''
+          SimpleIdentifier name3, Element annotationElement)) async {
+    CompilationUnit unit = await resolveSource('''
 import 'a.dart' $annotationPrefix;
 $annotationText
 class C {}
@@ -383,7 +389,7 @@
     _resolver = _createResolver();
   }
 
-  void test_lookUpMethodInInterfaces() {
+  test_lookUpMethodInInterfaces() async {
     InterfaceType intType = _typeProvider.intType;
     //
     // abstract class A { int operator[](int index); }
@@ -418,7 +424,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitAssignmentExpression_compound() {
+  test_visitAssignmentExpression_compound() async {
     InterfaceType intType = _typeProvider.intType;
     SimpleIdentifier leftHandSide = AstTestFactory.identifier3("a");
     leftHandSide.staticType = intType;
@@ -430,7 +436,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitAssignmentExpression_simple() {
+  test_visitAssignmentExpression_simple() async {
     AssignmentExpression expression = AstTestFactory.assignmentExpression(
         AstTestFactory.identifier3("x"),
         TokenType.EQ,
@@ -440,7 +446,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitBinaryExpression_bangEq() {
+  test_visitBinaryExpression_bangEq() async {
     // String i;
     // var j;
     // i == j
@@ -460,7 +466,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitBinaryExpression_eq() {
+  test_visitBinaryExpression_eq() async {
     // String i;
     // var j;
     // i == j
@@ -479,7 +485,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitBinaryExpression_plus() {
+  test_visitBinaryExpression_plus() async {
     // num i;
     // var j;
     // i + j
@@ -494,7 +500,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitBinaryExpression_plus_propagatedElement() {
+  test_visitBinaryExpression_plus_propagatedElement() async {
     // var i = 1;
     // var j;
     // i + j
@@ -509,7 +515,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitBreakStatement_withLabel() {
+  test_visitBreakStatement_withLabel() async {
     // loop: while (true) {
     //   break loop;
     // }
@@ -526,13 +532,13 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitBreakStatement_withoutLabel() {
+  test_visitBreakStatement_withoutLabel() async {
     BreakStatement statement = AstTestFactory.breakStatement();
     _resolveStatement(statement, null, null);
     _listener.assertNoErrors();
   }
 
-  void test_visitCommentReference_prefixedIdentifier_class_getter() {
+  test_visitCommentReference_prefixedIdentifier_class_getter() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     // set accessors
     String propName = "p";
@@ -546,7 +552,8 @@
       ..defineNameWithoutChecking('A', classA);
     // prepare "A.p"
     PrefixedIdentifier prefixed = AstTestFactory.identifier5('A', 'p');
-    CommentReference commentReference = new CommentReference(null, prefixed);
+    CommentReference commentReference =
+        astFactory.commentReference(null, prefixed);
     // resolve
     _resolveNode(commentReference);
     expect(prefixed.prefix.staticElement, classA);
@@ -554,7 +561,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitCommentReference_prefixedIdentifier_class_method() {
+  test_visitCommentReference_prefixedIdentifier_class_method() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     // set method
     MethodElement method =
@@ -565,7 +572,8 @@
       ..defineNameWithoutChecking('A', classA);
     // prepare "A.m"
     PrefixedIdentifier prefixed = AstTestFactory.identifier5('A', 'm');
-    CommentReference commentReference = new CommentReference(null, prefixed);
+    CommentReference commentReference =
+        astFactory.commentReference(null, prefixed);
     // resolve
     _resolveNode(commentReference);
     expect(prefixed.prefix.staticElement, classA);
@@ -573,7 +581,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitCommentReference_prefixedIdentifier_class_operator() {
+  test_visitCommentReference_prefixedIdentifier_class_operator() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     // set method
     MethodElement method =
@@ -584,7 +592,8 @@
       ..defineNameWithoutChecking('A', classA);
     // prepare "A.=="
     PrefixedIdentifier prefixed = AstTestFactory.identifier5('A', '==');
-    CommentReference commentReference = new CommentReference(null, prefixed);
+    CommentReference commentReference =
+        astFactory.commentReference(null, prefixed);
     // resolve
     _resolveNode(commentReference);
     expect(prefixed.prefix.staticElement, classA);
@@ -592,7 +601,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitConstructorName_named() {
+  test_visitConstructorName_named() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String constructorName = "a";
     ConstructorElement constructor =
@@ -605,7 +614,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitConstructorName_unnamed() {
+  test_visitConstructorName_unnamed() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String constructorName = null;
     ConstructorElement constructor =
@@ -618,7 +627,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitContinueStatement_withLabel() {
+  test_visitContinueStatement_withLabel() async {
     // loop: while (true) {
     //   continue loop;
     // }
@@ -636,13 +645,13 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitContinueStatement_withoutLabel() {
+  test_visitContinueStatement_withoutLabel() async {
     ContinueStatement statement = AstTestFactory.continueStatement();
     _resolveStatement(statement, null, null);
     _listener.assertNoErrors();
   }
 
-  void test_visitEnumDeclaration() {
+  test_visitEnumDeclaration() async {
     CompilationUnitElementImpl compilationUnitElement =
         ElementFactory.compilationUnit('foo.dart');
     EnumElementImpl enumElement =
@@ -663,7 +672,7 @@
     expect(metadata[0].element, annotationNode.element);
   }
 
-  void test_visitExportDirective_noCombinators() {
+  test_visitExportDirective_noCombinators() async {
     ExportDirective directive = AstTestFactory.exportDirective2(null);
     directive.element = ElementFactory
         .exportFor(ElementFactory.library(_definingLibrary.context, "lib"));
@@ -671,7 +680,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitFieldFormalParameter() {
+  test_visitFieldFormalParameter() async {
     String fieldName = "f";
     InterfaceType intType = _typeProvider.intType;
     FieldElementImpl fieldElement =
@@ -686,10 +695,11 @@
     parameterElement.type = intType;
     parameter.identifier.staticElement = parameterElement;
     _resolveInClass(parameter, classA);
-    expect(parameter.element.type, same(intType));
+    expect(resolutionMap.elementDeclaredByFormalParameter(parameter).type,
+        same(intType));
   }
 
-  void test_visitImportDirective_noCombinators_noPrefix() {
+  test_visitImportDirective_noCombinators_noPrefix() async {
     ImportDirective directive = AstTestFactory.importDirective3(null, null);
     directive.element = ElementFactory.importFor(
         ElementFactory.library(_definingLibrary.context, "lib"), null);
@@ -697,7 +707,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitImportDirective_noCombinators_prefix() {
+  test_visitImportDirective_noCombinators_prefix() async {
     String prefixName = "p";
     ImportElement importElement = ElementFactory.importFor(
         ElementFactory.library(_definingLibrary.context, "lib"),
@@ -710,7 +720,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitImportDirective_withCombinators() {
+  test_visitImportDirective_withCombinators() async {
     ShowCombinator combinator = AstTestFactory.showCombinator2(["A", "B", "C"]);
     ImportDirective directive =
         AstTestFactory.importDirective3(null, null, [combinator]);
@@ -739,7 +749,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitIndexExpression_get() {
+  test_visitIndexExpression_get() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     InterfaceType intType = _typeProvider.intType;
     MethodElement getter =
@@ -753,7 +763,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitIndexExpression_set() {
+  test_visitIndexExpression_set() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     InterfaceType intType = _typeProvider.intType;
     MethodElement setter =
@@ -769,7 +779,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitInstanceCreationExpression_named() {
+  test_visitInstanceCreationExpression_named() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String constructorName = "a";
     ConstructorElement constructor =
@@ -785,7 +795,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitInstanceCreationExpression_unnamed() {
+  test_visitInstanceCreationExpression_unnamed() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String constructorName = null;
     ConstructorElement constructor =
@@ -801,7 +811,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitInstanceCreationExpression_unnamed_namedParameter() {
+  test_visitInstanceCreationExpression_unnamed_namedParameter() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String constructorName = null;
     ConstructorElementImpl constructor =
@@ -828,7 +838,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitMethodInvocation() {
+  test_visitMethodInvocation() async {
     InterfaceType numType = _typeProvider.numType;
     SimpleIdentifier left = AstTestFactory.identifier3("i");
     left.staticType = numType;
@@ -841,7 +851,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitMethodInvocation_namedParameter() {
+  test_visitMethodInvocation_namedParameter() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String methodName = "m";
     String parameterName = "p";
@@ -866,7 +876,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPostfixExpression() {
+  test_visitPostfixExpression() async {
     InterfaceType numType = _typeProvider.numType;
     SimpleIdentifier operand = AstTestFactory.identifier3("i");
     operand.staticType = numType;
@@ -877,7 +887,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPrefixedIdentifier_dynamic() {
+  test_visitPrefixedIdentifier_dynamic() async {
     DartType dynamicType = _typeProvider.dynamicType;
     SimpleIdentifier target = AstTestFactory.identifier3("a");
     VariableElementImpl variable = ElementFactory.localVariableElement(target);
@@ -892,7 +902,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPrefixedIdentifier_nonDynamic() {
+  test_visitPrefixedIdentifier_nonDynamic() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String getterName = "b";
     PropertyAccessorElement getter =
@@ -911,7 +921,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPrefixedIdentifier_staticClassMember_getter() {
+  test_visitPrefixedIdentifier_staticClassMember_getter() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     // set accessors
     String propName = "b";
@@ -933,7 +943,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPrefixedIdentifier_staticClassMember_method() {
+  test_visitPrefixedIdentifier_staticClassMember_method() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     // set methods
     String propName = "m";
@@ -955,7 +965,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPrefixedIdentifier_staticClassMember_setter() {
+  test_visitPrefixedIdentifier_staticClassMember_setter() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     // set accessors
     String propName = "b";
@@ -979,7 +989,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPrefixExpression() {
+  test_visitPrefixExpression() async {
     InterfaceType numType = _typeProvider.numType;
     SimpleIdentifier operand = AstTestFactory.identifier3("i");
     operand.staticType = numType;
@@ -990,7 +1000,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPropertyAccess_getter_identifier() {
+  test_visitPropertyAccess_getter_identifier() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String getterName = "b";
     PropertyAccessorElement getter =
@@ -1004,7 +1014,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPropertyAccess_getter_super() {
+  test_visitPropertyAccess_getter_super() async {
     //
     // class A {
     //  int get b;
@@ -1034,7 +1044,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitPropertyAccess_setter_this() {
+  test_visitPropertyAccess_setter_this() async {
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String setterName = "b";
     PropertyAccessorElement setter =
@@ -1050,7 +1060,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitSimpleIdentifier_classScope() {
+  test_visitSimpleIdentifier_classScope() async {
     InterfaceType doubleType = _typeProvider.doubleType;
     String fieldName = "NAN";
     SimpleIdentifier node = AstTestFactory.identifier3(fieldName);
@@ -1059,7 +1069,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitSimpleIdentifier_dynamic() {
+  test_visitSimpleIdentifier_dynamic() async {
     SimpleIdentifier node = AstTestFactory.identifier3("dynamic");
     _resolveIdentifier(node);
     expect(node.staticElement, same(_typeProvider.dynamicType.element));
@@ -1067,14 +1077,14 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitSimpleIdentifier_lexicalScope() {
+  test_visitSimpleIdentifier_lexicalScope() async {
     SimpleIdentifier node = AstTestFactory.identifier3("i");
     VariableElementImpl element = ElementFactory.localVariableElement(node);
     expect(_resolveIdentifier(node, [element]), same(element));
     _listener.assertNoErrors();
   }
 
-  void test_visitSimpleIdentifier_lexicalScope_field_setter() {
+  test_visitSimpleIdentifier_lexicalScope_field_setter() async {
     InterfaceType intType = _typeProvider.intType;
     ClassElementImpl classA = ElementFactory.classElement2("A");
     String fieldName = "a";
@@ -1093,7 +1103,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitSuperConstructorInvocation() {
+  test_visitSuperConstructorInvocation() async {
     ClassElementImpl superclass = ElementFactory.classElement2("A");
     ConstructorElementImpl superConstructor =
         ElementFactory.constructorElement2(superclass, null);
@@ -1113,7 +1123,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitSuperConstructorInvocation_namedParameter() {
+  test_visitSuperConstructorInvocation_namedParameter() async {
     ClassElementImpl superclass = ElementFactory.classElement2("A");
     ConstructorElementImpl superConstructor =
         ElementFactory.constructorElement2(superclass, null);
diff --git a/pkg/analyzer/test/generated/engine_test.dart b/pkg/analyzer/test/generated/engine_test.dart
index 93b3108..954966d 100644
--- a/pkg/analyzer/test/generated/engine_test.dart
+++ b/pkg/analyzer/test/generated/engine_test.dart
@@ -42,7 +42,6 @@
     modifiedOptions.dart2jsHint = true;
     modifiedOptions.disableCacheFlushing = true;
     modifiedOptions.enableAssertInitializer = true;
-    modifiedOptions.enableAssertMessage = true;
     modifiedOptions.enableLazyAssignmentOperators = true;
     modifiedOptions.enableStrictCallChecks = true;
     modifiedOptions.enableSuperMixins = true;
@@ -59,7 +58,9 @@
     modifiedOptions.incrementalValidation = true;
     modifiedOptions.lint = true;
     modifiedOptions.lintRules = [null];
-    modifiedOptions.patchPlatform = 3;
+    modifiedOptions.patchPaths = {
+      'dart:core': ['/dart_core.patch.dart']
+    };
     modifiedOptions.preserveComments = false;
     modifiedOptions.strongMode = true;
     modifiedOptions.trackCacheDependencies = false;
@@ -71,8 +72,6 @@
         defaultOptions.disableCacheFlushing);
     expect(modifiedOptions.enableAssertInitializer,
         defaultOptions.enableAssertInitializer);
-    expect(modifiedOptions.enableAssertMessage,
-        defaultOptions.enableAssertMessage);
     expect(modifiedOptions.enableLazyAssignmentOperators,
         defaultOptions.enableLazyAssignmentOperators);
     expect(modifiedOptions.enableStrictCallChecks,
@@ -94,7 +93,7 @@
         defaultOptions.incrementalValidation);
     expect(modifiedOptions.lint, defaultOptions.lint);
     expect(modifiedOptions.lintRules, defaultOptions.lintRules);
-    expect(modifiedOptions.patchPlatform, defaultOptions.patchPlatform);
+    expect(modifiedOptions.patchPaths, defaultOptions.patchPaths);
     expect(modifiedOptions.preserveComments, defaultOptions.preserveComments);
     expect(modifiedOptions.strongMode, defaultOptions.strongMode);
     expect(modifiedOptions.trackCacheDependencies,
diff --git a/pkg/analyzer/test/generated/error_suppression_driver_test.dart b/pkg/analyzer/test/generated/error_suppression_driver_test.dart
new file mode 100644
index 0000000..9bc552e
--- /dev/null
+++ b/pkg/analyzer/test/generated/error_suppression_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'error_suppression_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(ErrorSuppressionTest_Driver);
+  });
+}
+
+@reflectiveTest
+class ErrorSuppressionTest_Driver extends ErrorSuppressionTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/error_suppression_test.dart b/pkg/analyzer/test/generated/error_suppression_test.dart
index 20a3312..62d525e 100644
--- a/pkg/analyzer/test/generated/error_suppression_test.dart
+++ b/pkg/analyzer/test/generated/error_suppression_test.dart
@@ -17,179 +17,179 @@
 
 @reflectiveTest
 class ErrorSuppressionTest extends ResolverTestCase {
-  void test_error_code_mismatch() {
+  test_error_code_mismatch() async {
     Source source = addSource('''
 // ignore: const_initialized_with_non_constant_value
 int x = '';
 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticTypeWarningCode.INVALID_ASSIGNMENT,
       CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
     ]);
   }
 
-  void test_ignore_first() {
+  test_ignore_first() async {
     Source source = addSource('''
 // ignore: invalid_assignment
 int x = '';
 // ... but no ignore here ...
 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
   }
 
-  void test_ignore_first_trailing() {
+  test_ignore_first_trailing() async {
     Source source = addSource('''
 int x = ''; // ignore: invalid_assignment
 // ... but no ignore here ...
 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE]);
   }
 
-  void test_ignore_only_trailing() {
+  test_ignore_only_trailing() async {
     Source source = addSource('''
 int x = ''; // ignore: invalid_assignment
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, []);
   }
 
-  void test_ignore_second() {
+  test_ignore_second() async {
     Source source = addSource('''
 //INVALID_ASSIGNMENT
 int x = '';
 // ignore: const_initialized_with_non_constant_value
 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_ignore_second_trailing() {
+  test_ignore_second_trailing() async {
     Source source = addSource('''
 //INVALID_ASSIGNMENT
 int x = '';
 const y = x; // ignore: const_initialized_with_non_constant_value
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_ignore_upper_case() {
+  test_ignore_upper_case() async {
     Source source = addSource('''
 int x = ''; // ignore: INVALID_ASSIGNMENT
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, []);
   }
 
-  void test_invalid_error_code() {
+  test_invalid_error_code() async {
     Source source = addSource('''
 // ignore: right_format_wrong_code
 int x = '';
 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticTypeWarningCode.INVALID_ASSIGNMENT,
       CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
     ]);
   }
 
-  void test_missing_error_codes() {
+  test_missing_error_codes() async {
     Source source = addSource('''
     int x = 3;
 // ignore:
 const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticTypeWarningCode.INVALID_ASSIGNMENT,
       CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
     ]);
   }
 
-  void test_missing_metadata_suffix() {
+  test_missing_metadata_suffix() async {
     Source source = addSource('''
 // ignore invalid_assignment
 String y = 3; //INVALID_ASSIGNMENT
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_multiple_comments() {
+  test_multiple_comments() async {
     Source source = addSource('''
 int x = ''; //This is the first comment...
 // ignore: const_initialized_with_non_constant_value
 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_multiple_ignores() {
+  test_multiple_ignores() async {
     Source source = addSource('''
 int x = 3;
 // ignore: invalid_assignment, const_initialized_with_non_constant_value
 const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, []);
   }
 
-  void test_multiple_ignores_traling() {
+  test_multiple_ignores_traling() async {
     Source source = addSource('''
 int x = 3;
 const String y = x; // ignore: invalid_assignment, const_initialized_with_non_constant_value
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, []);
   }
 
-  void test_multiple_ignores_whitespace_variant_1() {
+  test_multiple_ignores_whitespace_variant_1() async {
     Source source = addSource('''
 int x = 3;
 //ignore:invalid_assignment,const_initialized_with_non_constant_value
 const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, []);
   }
 
-  void test_multiple_ignores_whitespace_variant_2() {
+  test_multiple_ignores_whitespace_variant_2() async {
     Source source = addSource('''
 int x = 3;
 //ignore: invalid_assignment,const_initialized_with_non_constant_value
 const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, []);
   }
 
-  void test_multiple_ignores_whitespace_variant_3() {
+  test_multiple_ignores_whitespace_variant_3() async {
     Source source = addSource('''
 int x = 3;
 // ignore: invalid_assignment,const_initialized_with_non_constant_value
 const String y = x; //INVALID_ASSIGNMENT, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, []);
   }
 
-  void test_no_ignores() {
+  test_no_ignores() async {
     Source source = addSource('''
 int x = '';  //INVALID_ASSIGNMENT
 const y = x; //CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticTypeWarningCode.INVALID_ASSIGNMENT,
       CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
diff --git a/pkg/analyzer/test/generated/gn_test.dart b/pkg/analyzer/test/generated/gn_test.dart
new file mode 100644
index 0000000..060285a8
--- /dev/null
+++ b/pkg/analyzer/test/generated/gn_test.dart
@@ -0,0 +1,132 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library analyzer.test.generated.gn_test;
+
+import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/src/generated/gn.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(GnPackageUriResolverTest);
+    defineReflectiveTests(GnWorkspaceTest);
+  });
+}
+
+@reflectiveTest
+class GnPackageUriResolverTest extends _BaseTest {
+  GnWorkspace workspace;
+  GnPackageUriResolver resolver;
+
+  void test_resolve() {
+    _addResources([
+      '/workspace/.jiri_root/',
+      '/workspace/out/debug-x87_128/gen/dart.sources/',
+      '/workspace/some/code/',
+      '/workspace/a/source/code.dart',
+    ]);
+    provider.newFile(
+        _p('/workspace/out/debug-x87_128/gen/dart.sources/flutter'),
+        _p('/workspace/a/source'));
+    _setUp();
+    _assertResolve(
+        'package:flutter/code.dart', '/workspace/a/source/code.dart');
+  }
+
+  void test_resolveDoesNotExist() {
+    _addResources([
+      '/workspace/.jiri_root/',
+      '/workspace/out/debug-x87_128/gen/dart.sources/',
+      '/workspace/some/code/',
+      '/workspace/a/source/code.dart',
+    ]);
+    provider.newFile(
+        _p('/workspace/out/debug-x87_128/gen/dart.sources/flutter'),
+        _p('/workspace/a/source'));
+    _setUp();
+    expect(
+        resolver.resolveAbsolute(Uri.parse('package:bogus/code.dart')), null);
+  }
+
+  void _addResources(List<String> paths) {
+    for (String path in paths) {
+      if (path.endsWith('/')) {
+        provider.newFolder(_p(path.substring(0, path.length - 1)));
+      } else {
+        provider.newFile(_p(path), '');
+      }
+    }
+  }
+
+  void _setUp() {
+    workspace = GnWorkspace.find(provider, _p('/workspace'));
+    resolver = new GnPackageUriResolver(workspace);
+  }
+
+  void _assertResolve(String uriStr, String posixPath,
+      {bool exists: true, bool restore: true}) {
+    Uri uri = Uri.parse(uriStr);
+    Source source = resolver.resolveAbsolute(uri);
+    expect(source, isNotNull);
+    expect(source.fullName, _p(posixPath));
+    expect(source.uri, uri);
+    expect(source.exists(), exists);
+    // If enabled, test also "restoreAbsolute".
+    if (restore) {
+      Uri uri = resolver.restoreAbsolute(source);
+      expect(uri.toString(), uriStr);
+    }
+  }
+}
+
+@reflectiveTest
+class GnWorkspaceTest extends _BaseTest {
+  void test_find_notAbsolute() {
+    expect(() => GnWorkspace.find(provider, _p('not_absolute')),
+        throwsArgumentError);
+  }
+
+  void test_find_noJiriRoot() {
+    provider.newFolder(_p('/workspace'));
+    GnWorkspace workspace = GnWorkspace.find(provider, _p('/workspace'));
+    expect(workspace, isNull);
+  }
+
+  void test_find_withRoot() {
+    provider.newFolder(_p('/workspace/.jiri_root'));
+    provider.newFolder(_p('/workspace/out/debug-x87_128/gen/dart.sources'));
+    provider.newFolder(_p('/workspace/some/code'));
+    GnWorkspace workspace =
+        GnWorkspace.find(provider, _p('/workspace/some/code'));
+    expect(workspace, isNotNull);
+    expect(workspace.root, _p('/workspace'));
+  }
+
+  void test_packages() {
+    provider.newFolder(_p('/workspace/.jiri_root'));
+    provider.newFolder(_p('/workspace/out/debug-x87_128/gen/dart.sources'));
+    provider.newFile(
+        _p('/workspace/out/debug-x87_128/gen/dart.sources/flutter'),
+        '/path/to/source');
+    provider.newFolder(_p('/workspace/some/code'));
+    GnWorkspace workspace =
+        GnWorkspace.find(provider, _p('/workspace/some/code'));
+    expect(workspace, isNotNull);
+    expect(workspace.root, _p('/workspace'));
+    expect(workspace.packages.length, 1);
+    expect(workspace.packages['flutter'], '/path/to/source');
+  }
+}
+
+class _BaseTest {
+  final MemoryResourceProvider provider = new MemoryResourceProvider();
+
+  /**
+   * Return the [provider] specific path for the given Posix [path].
+   */
+  String _p(String path) => provider.convertPath(path);
+}
diff --git a/pkg/analyzer/test/generated/hint_code_driver_test.dart b/pkg/analyzer/test/generated/hint_code_driver_test.dart
new file mode 100644
index 0000000..c7a7758
--- /dev/null
+++ b/pkg/analyzer/test/generated/hint_code_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'hint_code_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(HintCodeTest_Driver);
+  });
+}
+
+@reflectiveTest
+class HintCodeTest_Driver extends HintCodeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
index 4e5009f..013ffe2 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -12,7 +12,6 @@
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
-import 'analysis_context_factory.dart';
 import 'resolver_test_case.dart';
 
 main() {
@@ -25,8 +24,10 @@
 class HintCodeTest extends ResolverTestCase {
   @override
   void reset() {
-    analysisContext2 = AnalysisContextFactory.contextWithCoreAndPackages({
-      'package:meta/meta.dart': r'''
+    super.resetWith(packages: [
+      [
+        'meta',
+        r'''
 library meta;
 
 const _Factory factory = const _Factory();
@@ -55,17 +56,21 @@
   final String reason;
   const _Required([this.reason]));
 }
-''',
-      'package:js/js.dart': r'''
+'''
+      ],
+      [
+        'js',
+        r'''
 library js;
 class JS {
   const JS([String js]) { }
 }
 '''
-    }, resourceProvider: resourceProvider);
+      ]
+    ]);
   }
 
-  void test_abstractSuperMemberReference_getter() {
+  test_abstractSuperMemberReference_getter() async {
     Source source = addSource(r'''
 abstract class A {
   int get test;
@@ -77,12 +82,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
     verify([source]);
   }
 
-  void test_abstractSuperMemberReference_method_invocation() {
+  test_abstractSuperMemberReference_method_invocation() async {
     Source source = addSource(r'''
 abstract class A {
   void test();
@@ -93,12 +98,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
     verify([source]);
   }
 
-  void test_abstractSuperMemberReference_method_reference() {
+  test_abstractSuperMemberReference_method_reference() async {
     Source source = addSource(r'''
 abstract class A {
   void test();
@@ -109,12 +114,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
     verify([source]);
   }
 
-  void test_abstractSuperMemberReference_setter() {
+  test_abstractSuperMemberReference_setter() async {
     Source source = addSource(r'''
 abstract class A {
   void set test(int v);
@@ -125,12 +130,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_functionType() {
+  test_argumentTypeNotAssignable_functionType() async {
     Source source = addSource(r'''
 m() {
   var a = new A();
@@ -139,42 +144,42 @@
 class A {
   n(void f(int i)) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_message() {
+  test_argumentTypeNotAssignable_message() async {
     // The implementation of HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE assumes that
     // StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE has the same message.
     expect(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE.message,
         HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE.message);
   }
 
-  void test_argumentTypeNotAssignable_type() {
+  test_argumentTypeNotAssignable_type() async {
     Source source = addSource(r'''
 m() {
   var i = '';
   n(i);
 }
 n(int i) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_canBeNullAfterNullAware_false_methodInvocation() {
+  test_canBeNullAfterNullAware_false_methodInvocation() async {
     Source source = addSource(r'''
 m(x) {
   x?.a()?.b();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_canBeNullAfterNullAware_false_null() {
+  test_canBeNullAfterNullAware_false_null() async {
     Source source = addSource(r'''
 m(x) {
   x?.a.hashCode;
@@ -185,217 +190,217 @@
   x?.b().toString();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_canBeNullAfterNullAware_false_propertyAccess() {
+  test_canBeNullAfterNullAware_false_propertyAccess() async {
     Source source = addSource(r'''
 m(x) {
   x?.a?.b;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_canBeNullAfterNullAware_methodInvocation() {
+  test_canBeNullAfterNullAware_methodInvocation() async {
     Source source = addSource(r'''
 m(x) {
   x?.a.b();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
     verify([source]);
   }
 
-  void test_canBeNullAfterNullAware_parenthesized() {
+  test_canBeNullAfterNullAware_parenthesized() async {
     Source source = addSource(r'''
 m(x) {
   (x?.a).b;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
     verify([source]);
   }
 
-  void test_canBeNullAfterNullAware_propertyAccess() {
+  test_canBeNullAfterNullAware_propertyAccess() async {
     Source source = addSource(r'''
 m(x) {
   x?.a.b;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.CAN_BE_NULL_AFTER_NULL_AWARE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_conditionalElse() {
+  test_deadCode_deadBlock_conditionalElse() async {
     Source source = addSource(r'''
 f() {
   true ? 1 : 2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_conditionalElse_nested() {
+  test_deadCode_deadBlock_conditionalElse_nested() async {
     // test that a dead else-statement can't generate additional violations
     Source source = addSource(r'''
 f() {
   true ? true : false && false;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_conditionalIf() {
+  test_deadCode_deadBlock_conditionalIf() async {
     Source source = addSource(r'''
 f() {
   false ? 1 : 2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_conditionalIf_nested() {
+  test_deadCode_deadBlock_conditionalIf_nested() async {
     // test that a dead then-statement can't generate additional violations
     Source source = addSource(r'''
 f() {
   false ? false && false : true;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_else() {
+  test_deadCode_deadBlock_else() async {
     Source source = addSource(r'''
 f() {
   if(true) {} else {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_else_nested() {
+  test_deadCode_deadBlock_else_nested() async {
     // test that a dead else-statement can't generate additional violations
     Source source = addSource(r'''
 f() {
   if(true) {} else {if (false) {}}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_if() {
+  test_deadCode_deadBlock_if() async {
     Source source = addSource(r'''
 f() {
   if(false) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_if_nested() {
+  test_deadCode_deadBlock_if_nested() async {
     // test that a dead then-statement can't generate additional violations
     Source source = addSource(r'''
 f() {
   if(false) {if(false) {}}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_while() {
+  test_deadCode_deadBlock_while() async {
     Source source = addSource(r'''
 f() {
   while(false) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_while_nested() {
+  test_deadCode_deadBlock_while_nested() async {
     // test that a dead while body can't generate additional violations
     Source source = addSource(r'''
 f() {
   while(false) {if(false) {}}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadCatch_catchFollowingCatch() {
+  test_deadCode_deadCatch_catchFollowingCatch() async {
     Source source = addSource(r'''
 class A {}
 f() {
   try {} catch (e) {} catch (e) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
     verify([source]);
   }
 
-  void test_deadCode_deadCatch_catchFollowingCatch_nested() {
+  test_deadCode_deadCatch_catchFollowingCatch_nested() async {
     // test that a dead catch clause can't generate additional violations
     Source source = addSource(r'''
 class A {}
 f() {
   try {} catch (e) {} catch (e) {if(false) {}}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
     verify([source]);
   }
 
-  void test_deadCode_deadCatch_catchFollowingCatch_object() {
+  test_deadCode_deadCatch_catchFollowingCatch_object() async {
     Source source = addSource(r'''
 f() {
   try {} on Object catch (e) {} catch (e) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
     verify([source]);
   }
 
-  void test_deadCode_deadCatch_catchFollowingCatch_object_nested() {
+  test_deadCode_deadCatch_catchFollowingCatch_object_nested() async {
     // test that a dead catch clause can't generate additional violations
     Source source = addSource(r'''
 f() {
   try {} on Object catch (e) {} catch (e) {if(false) {}}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE_CATCH_FOLLOWING_CATCH]);
     verify([source]);
   }
 
-  void test_deadCode_deadCatch_onCatchSubtype() {
+  test_deadCode_deadCatch_onCatchSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
 f() {
   try {} on A catch (e) {} on B catch (e) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]);
     verify([source]);
   }
 
-  void test_deadCode_deadCatch_onCatchSubtype_nested() {
+  test_deadCode_deadCatch_onCatchSubtype_nested() async {
     // test that a dead catch clause can't generate additional violations
     Source source = addSource(r'''
 class A {}
@@ -403,12 +408,12 @@
 f() {
   try {} on A catch (e) {} on B catch (e) {if(false) {}}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE_ON_CATCH_SUBTYPE]);
     verify([source]);
   }
 
-  void test_deadCode_deadFinalReturnInCase() {
+  test_deadCode_deadFinalReturnInCase() async {
     Source source = addSource(r'''
 f() {
   switch (true) {
@@ -423,12 +428,12 @@
     break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadFinalStatementInCase() {
+  test_deadCode_deadFinalStatementInCase() async {
     Source source = addSource(r'''
 f() {
   switch (true) {
@@ -443,55 +448,55 @@
     break;
   }
 }''');
-    computeLibrarySourceErrors(source);
     // A single dead statement at the end of a switch case that is not a
     // terminating statement will yield two errors.
+    await computeAnalysisResult(source);
     assertErrors(source,
         [HintCode.DEAD_CODE, StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]);
     verify([source]);
   }
 
-  void test_deadCode_deadOperandLHS_and() {
+  test_deadCode_deadOperandLHS_and() async {
     Source source = addSource(r'''
 f() {
   bool b = false && false;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadOperandLHS_and_nested() {
+  test_deadCode_deadOperandLHS_and_nested() async {
     Source source = addSource(r'''
 f() {
   bool b = false && (false && false);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadOperandLHS_or() {
+  test_deadCode_deadOperandLHS_or() async {
     Source source = addSource(r'''
 f() {
   bool b = true || true;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_deadOperandLHS_or_nested() {
+  test_deadCode_deadOperandLHS_or_nested() async {
     Source source = addSource(r'''
 f() {
   bool b = true || (false && false);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterBreak_inDefaultCase() {
+  test_deadCode_statementAfterBreak_inDefaultCase() async {
     Source source = addSource(r'''
 f(v) {
   switch(v) {
@@ -501,12 +506,12 @@
       var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterBreak_inForEachStatement() {
+  test_deadCode_statementAfterBreak_inForEachStatement() async {
     Source source = addSource(r'''
 f() {
   var list;
@@ -515,12 +520,12 @@
     var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterBreak_inForStatement() {
+  test_deadCode_statementAfterBreak_inForStatement() async {
     Source source = addSource(r'''
 f() {
   for(;;) {
@@ -528,12 +533,12 @@
     var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterBreak_inSwitchCase() {
+  test_deadCode_statementAfterBreak_inSwitchCase() async {
     Source source = addSource(r'''
 f(v) {
   switch(v) {
@@ -542,12 +547,12 @@
       var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterBreak_inWhileStatement() {
+  test_deadCode_statementAfterBreak_inWhileStatement() async {
     Source source = addSource(r'''
 f(v) {
   while(v) {
@@ -555,12 +560,12 @@
     var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterContinue_inForEachStatement() {
+  test_deadCode_statementAfterContinue_inForEachStatement() async {
     Source source = addSource(r'''
 f() {
   var list;
@@ -569,12 +574,12 @@
     var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterContinue_inForStatement() {
+  test_deadCode_statementAfterContinue_inForStatement() async {
     Source source = addSource(r'''
 f() {
   for(;;) {
@@ -582,12 +587,12 @@
     var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterContinue_inWhileStatement() {
+  test_deadCode_statementAfterContinue_inWhileStatement() async {
     Source source = addSource(r'''
 f(v) {
   while(v) {
@@ -595,12 +600,12 @@
     var a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterExitingIf_returns() {
+  test_deadCode_statementAfterExitingIf_returns() async {
     Source source = addSource(r'''
 f() {
   if (1 > 2) {
@@ -610,12 +615,12 @@
   }
   var one = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterRethrow() {
+  test_deadCode_statementAfterRethrow() async {
     Source source = addSource(r'''
 f() {
   try {
@@ -625,24 +630,24 @@
     var two = 2;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterReturn_function() {
+  test_deadCode_statementAfterReturn_function() async {
     Source source = addSource(r'''
 f() {
   var one = 1;
   return;
   var two = 2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterReturn_ifStatement() {
+  test_deadCode_statementAfterReturn_ifStatement() async {
     Source source = addSource(r'''
 f(bool b) {
   if(b) {
@@ -651,12 +656,12 @@
     var two = 2;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterReturn_method() {
+  test_deadCode_statementAfterReturn_method() async {
     Source source = addSource(r'''
 class A {
   m() {
@@ -665,24 +670,24 @@
     var two = 2;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterReturn_nested() {
+  test_deadCode_statementAfterReturn_nested() async {
     Source source = addSource(r'''
 f() {
   var one = 1;
   return;
   if(false) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterReturn_twoReturns() {
+  test_deadCode_statementAfterReturn_twoReturns() async {
     Source source = addSource(r'''
 f() {
   var one = 1;
@@ -691,24 +696,24 @@
   return;
   var three = 3;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterThrow() {
+  test_deadCode_statementAfterThrow() async {
     Source source = addSource(r'''
 f() {
   var one = 1;
   throw 'Stop here';
   var two = 2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_assignment() {
+  test_deprecatedAnnotationUse_assignment() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -718,12 +723,12 @@
   A b;
   a += b;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_call() {
+  test_deprecatedAnnotationUse_call() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -733,36 +738,36 @@
     a();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_deprecated() {
+  test_deprecatedAnnotationUse_deprecated() async {
     Source source = addSource(r'''
 class A {
   @deprecated
   m() {}
   n() {m();}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_Deprecated() {
+  test_deprecatedAnnotationUse_Deprecated() async {
     Source source = addSource(r'''
 class A {
   @Deprecated('0.9')
   m() {}
   n() {m();}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_export() {
+  test_deprecatedAnnotationUse_export() async {
     Source source = addSource("export 'deprecated_library.dart';");
     addNamedSource(
         "/deprecated_library.dart",
@@ -770,12 +775,12 @@
 @deprecated
 library deprecated_library;
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_field() {
+  test_deprecatedAnnotationUse_field() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -784,12 +789,12 @@
 f(A a) {
   return a.x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_getter() {
+  test_deprecatedAnnotationUse_getter() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -798,12 +803,12 @@
 f(A a) {
   return a.m;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_import() {
+  test_deprecatedAnnotationUse_import() async {
     Source source = addSource(r'''
 import 'deprecated_library.dart';
 f(A a) {}''');
@@ -813,12 +818,12 @@
 @deprecated
 library deprecated_library;
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_indexExpression() {
+  test_deprecatedAnnotationUse_indexExpression() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -827,12 +832,12 @@
 f(A a) {
   return a[1];
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_instanceCreation() {
+  test_deprecatedAnnotationUse_instanceCreation() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -841,12 +846,12 @@
 f() {
   A a = new A(1);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_instanceCreation_namedConstructor() {
+  test_deprecatedAnnotationUse_instanceCreation_namedConstructor() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -855,23 +860,23 @@
 f() {
   A a = new A.named(1);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_named() {
+  test_deprecatedAnnotationUse_named() async {
     Source source = addSource(r'''
 class A {
   m({@deprecated int x}) {}
   n() {m(x: 1);}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_operator() {
+  test_deprecatedAnnotationUse_operator() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -881,23 +886,23 @@
   A b;
   return a + b;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_positional() {
+  test_deprecatedAnnotationUse_positional() async {
     Source source = addSource(r'''
 class A {
   m([@deprecated int x]) {}
   n() {m(1);}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_setter() {
+  test_deprecatedAnnotationUse_setter() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -906,12 +911,12 @@
 f(A a) {
   return a.s = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_superConstructor() {
+  test_deprecatedAnnotationUse_superConstructor() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -920,12 +925,12 @@
 class B extends A {
   B() : super() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_deprecatedAnnotationUse_superConstructor_namedConstructor() {
+  test_deprecatedAnnotationUse_superConstructor_namedConstructor() async {
     Source source = addSource(r'''
 class A {
   @deprecated
@@ -934,32 +939,91 @@
 class B extends A {
   B() : super.named() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEPRECATED_MEMBER_USE]);
     verify([source]);
   }
 
-  void test_divisionOptimization_double() {
+  test_deprecatedFunction_class() async {
+    Source source = addSource(r'''
+class Function {}
+''');
+    await computeAnalysisResult(source);
+    assertErrors(source, [HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION]);
+    verify([source]);
+  }
+
+  test_deprecatedFunction_extends() async {
+    Source source = addSource(r'''
+class A extends Function {}
+''');
+    await computeAnalysisResult(source);
+    assertErrors(source, [
+      HintCode.DEPRECATED_EXTENDS_FUNCTION,
+      StaticWarningCode.FUNCTION_WITHOUT_CALL
+    ]);
+    verify([source]);
+  }
+
+  test_deprecatedFunction_extends2() async {
+    Source source = addSource(r'''
+class Function {}
+class A extends Function {}
+''');
+    await computeAnalysisResult(source);
+    assertErrors(source, [
+      HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION,
+      HintCode.DEPRECATED_EXTENDS_FUNCTION
+    ]);
+    verify([source]);
+  }
+
+  test_deprecatedFunction_mixin() async {
+    Source source = addSource(r'''
+class A extends Object with Function {}
+''');
+    await computeAnalysisResult(source);
+    assertErrors(source, [
+      HintCode.DEPRECATED_MIXIN_FUNCTION,
+      StaticWarningCode.FUNCTION_WITHOUT_CALL
+    ]);
+    verify([source]);
+  }
+
+  test_deprecatedFunction_mixin2() async {
+    Source source = addSource(r'''
+class Function {}
+class A extends Object with Function {}
+''');
+    await computeAnalysisResult(source);
+    assertErrors(source, [
+      HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION,
+      HintCode.DEPRECATED_MIXIN_FUNCTION
+    ]);
+    verify([source]);
+  }
+
+  test_divisionOptimization_double() async {
     Source source = addSource(r'''
 f(double x, double y) {
   var v = (x / y).toInt();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
     verify([source]);
   }
 
-  void test_divisionOptimization_int() {
+  test_divisionOptimization_int() async {
     Source source = addSource(r'''
 f(int x, int y) {
   var v = (x / y).toInt();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
     verify([source]);
   }
 
-  void test_divisionOptimization_propagatedType() {
+  test_divisionOptimization_propagatedType() async {
     // Tests the propagated type information of the '/' method
     Source source = addSource(r'''
 f(x, y) {
@@ -967,22 +1031,22 @@
   y = 1;
   var v = (x / y).toInt();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
     verify([source]);
   }
 
-  void test_divisionOptimization_wrappedBinaryExpression() {
+  test_divisionOptimization_wrappedBinaryExpression() async {
     Source source = addSource(r'''
 f(int x, int y) {
   var v = (((x / y))).toInt();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DIVISION_OPTIMIZATION]);
     verify([source]);
   }
 
-  void test_duplicateImport() {
+  test_duplicateImport() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -993,12 +1057,12 @@
         r'''
 library lib1;
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DUPLICATE_IMPORT]);
     verify([source]);
   }
 
-  void test_duplicateImport2() {
+  test_duplicateImport2() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -1010,13 +1074,13 @@
         r'''
 library lib1;
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [HintCode.DUPLICATE_IMPORT, HintCode.DUPLICATE_IMPORT]);
     verify([source]);
   }
 
-  void test_duplicateImport3() {
+  test_duplicateImport3() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' as M show A hide B;
@@ -1028,12 +1092,12 @@
 library lib1;
 class A {}
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DUPLICATE_IMPORT]);
     verify([source]);
   }
 
-  void test_factory__expr_return_null_OK() {
+  test_factory__expr_return_null_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1044,12 +1108,12 @@
 
 class State { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_factory_abstract_OK() {
+  test_factory_abstract_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1060,12 +1124,12 @@
 
 class State { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_factory_bad_return() {
+  test_factory_bad_return() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1078,12 +1142,12 @@
 
 class State { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.INVALID_FACTORY_METHOD_IMPL]);
     verify([source]);
   }
 
-  void test_factory_block_OK() {
+  test_factory_block_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1096,12 +1160,12 @@
 
 class State { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_factory_block_return_null_OK() {
+  test_factory_block_return_null_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1114,12 +1178,12 @@
 
 class State { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_factory_expr_OK() {
+  test_factory_expr_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1130,12 +1194,12 @@
 
 class State { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_factory_misplaced_annotation() {
+  test_factory_misplaced_annotation() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1148,7 +1212,7 @@
 @factory
 main() { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       HintCode.INVALID_FACTORY_ANNOTATION,
       HintCode.INVALID_FACTORY_ANNOTATION,
@@ -1157,7 +1221,7 @@
     verify([source]);
   }
 
-  void test_factory_no_return_type_OK() {
+  test_factory_no_return_type_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1168,13 +1232,13 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
     // Null return types will get flagged elsewhere, no need to pile-on here.
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_factory_subclass_OK() {
+  test_factory_subclass_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1194,12 +1258,12 @@
 class State { }
 class MyState extends State { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_factory_void_return() {
+  test_factory_void_return() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1208,13 +1272,13 @@
   void createState() {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.INVALID_FACTORY_METHOD_DECL]);
     verify([source]);
   }
 
-  void test_importDeferredLibraryWithLoadFunction() {
-    resolveWithErrors(<String>[
+  test_importDeferredLibraryWithLoadFunction() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 loadLibrary() {}
@@ -1228,7 +1292,7 @@
     ]);
   }
 
-  void test_invalidAssignment_instanceVariable() {
+  test_invalidAssignment_instanceVariable() async {
     Source source = addSource(r'''
 class A {
   int x;
@@ -1239,31 +1303,31 @@
     a.x = y;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
     verify([source]);
   }
 
-  void test_invalidAssignment_localVariable() {
+  test_invalidAssignment_localVariable() async {
     Source source = addSource(r'''
 f(var y) {
   if(y is String) {
     int x = y;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
     verify([source]);
   }
 
-  void test_invalidAssignment_message() {
+  test_invalidAssignment_message() async {
     // The implementation of HintCode.INVALID_ASSIGNMENT assumes that
     // StaticTypeWarningCode.INVALID_ASSIGNMENT has the same message.
     expect(StaticTypeWarningCode.INVALID_ASSIGNMENT.message,
         HintCode.INVALID_ASSIGNMENT.message);
   }
 
-  void test_invalidAssignment_staticVariable() {
+  test_invalidAssignment_staticVariable() async {
     Source source = addSource(r'''
 class A {
   static int x;
@@ -1273,12 +1337,12 @@
     A.x = y;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
     verify([source]);
   }
 
-  void test_invalidAssignment_variableDeclaration() {
+  test_invalidAssignment_variableDeclaration() async {
     // 17971
     Source source = addSource(r'''
 class Point {
@@ -1293,12 +1357,12 @@
   var p2 = new Point(10, 10);
   int n = p1 + p2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.INVALID_ASSIGNMENT]);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_closure() {
+  test_invalidUseOfProtectedMember_closure() async {
     Source source = addNamedSource(
         '/lib1.dart',
         r'''
@@ -1319,13 +1383,14 @@
   print(leak);
 }
 ''');
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
     assertNoErrors(source);
     verify([source, source2]);
   }
 
-  void test_invalidUseOfProtectedMember_field() {
+  test_invalidUseOfProtectedMember_field() async {
     Source source = addNamedSource(
         '/lib1.dart',
         r'''
@@ -1344,13 +1409,14 @@
   int b() => new A().a;
 }
 ''');
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
     assertNoErrors(source);
     verify([source, source2]);
   }
 
-  void test_invalidUseOfProtectedMember_field_OK() {
+  test_invalidUseOfProtectedMember_field_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1360,12 +1426,12 @@
 abstract class B implements A {
   int b() => a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_function() {
+  test_invalidUseOfProtectedMember_function() async {
     Source source = addNamedSource(
         '/lib1.dart',
         r'''
@@ -1384,13 +1450,14 @@
   new A().a();
 }
 ''');
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
     assertNoErrors(source);
     verify([source, source2]);
   }
 
-  void test_invalidUseOfProtectedMember_function_OK() {
+  test_invalidUseOfProtectedMember_function_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1401,12 +1468,12 @@
 abstract class B implements A {
   int b() => a();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_function_OK2() {
+  test_invalidUseOfProtectedMember_function_OK2() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1416,12 +1483,12 @@
 main() {
   new A().a();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_getter() {
+  test_invalidUseOfProtectedMember_getter() async {
     Source source = addNamedSource(
         '/lib1.dart',
         r'''
@@ -1441,13 +1508,14 @@
   int b() => a.a;
 }
 ''');
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
     assertNoErrors(source);
     verify([source, source2]);
   }
 
-  void test_invalidUseOfProtectedMember_getter_OK() {
+  test_invalidUseOfProtectedMember_getter_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1457,12 +1525,12 @@
 abstract class B implements A {
   int b() => a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_in_docs_OK() {
+  test_invalidUseOfProtectedMember_in_docs_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -1478,12 +1546,12 @@
 /// OK: [A.a], [A.b], [A.c].
 f() {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_message() {
+  test_invalidUseOfProtectedMember_message() async {
     Source source = addNamedSource(
         '/lib1.dart',
         r'''
@@ -1502,13 +1570,13 @@
   void b() => new A().a();
 }
 ''');
-    List<AnalysisError> errors = analysisContext2.computeErrors(source2);
-    expect(errors, hasLength(1));
-    expect(errors[0].errorCode, HintCode.INVALID_USE_OF_PROTECTED_MEMBER);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
+    assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
     verify([source, source2]);
   }
 
-  void test_invalidUseOfProtectedMember_method_1() {
+  test_invalidUseOfProtectedMember_method_1() async {
     Source source = addNamedSource(
         '/lib1.dart',
         r'''
@@ -1528,13 +1596,14 @@
 }
 ''');
 
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
     assertNoErrors(source);
     verify([source, source2]);
   }
 
-  void test_invalidUseOfProtectedMember_method_OK() {
+  test_invalidUseOfProtectedMember_method_OK() async {
     // https://github.com/dart-lang/linter/issues/257
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
@@ -1552,12 +1621,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_OK_1() {
+  test_invalidUseOfProtectedMember_OK_1() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1567,12 +1636,12 @@
 class B extends A {
   void b() => a();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_OK_2() {
+  test_invalidUseOfProtectedMember_OK_2() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1582,12 +1651,12 @@
 class B extends Object with A {
   void b() => a();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_OK_3() {
+  test_invalidUseOfProtectedMember_OK_3() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1596,12 +1665,12 @@
 class B extends A {
   static m2(A a) => a.m1();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_OK_4() {
+  test_invalidUseOfProtectedMember_OK_4() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1614,12 +1683,12 @@
 main() {
   new B().a();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_OK_field() {
+  test_invalidUseOfProtectedMember_OK_field() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1630,12 +1699,12 @@
   int b() => a;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_OK_getter() {
+  test_invalidUseOfProtectedMember_OK_getter() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1646,12 +1715,12 @@
   int b() => a;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_OK_setter() {
+  test_invalidUseOfProtectedMember_OK_setter() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1664,12 +1733,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_OK_setter_2() {
+  test_invalidUseOfProtectedMember_OK_setter_2() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1681,12 +1750,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_setter() {
+  test_invalidUseOfProtectedMember_setter() async {
     Source source = addNamedSource(
         '/lib1.dart',
         r'''
@@ -1708,13 +1777,14 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [HintCode.INVALID_USE_OF_PROTECTED_MEMBER]);
     assertNoErrors(source);
     verify([source, source2]);
   }
 
-  void test_invalidUseOfProtectedMember_setter_OK() {
+  test_invalidUseOfProtectedMember_setter_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1726,12 +1796,12 @@
     a = i;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidUseOfProtectedMember_topLevelVariable() {
+  test_invalidUseOfProtectedMember_topLevelVariable() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 @protected
@@ -1739,50 +1809,50 @@
 main() {
   print(x);
 }''');
-    computeLibrarySourceErrors(source);
     // TODO(brianwilkerson) This should produce a hint because the annotation is
     // being applied to the wrong kind of declaration.
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_isDouble() {
+  test_isDouble() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.dart2jsHint = true;
-    resetWithOptions(options);
+    resetWith(options: options);
     Source source = addSource("var v = 1 is double;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.IS_DOUBLE]);
     verify([source]);
   }
 
   @failingTest
-  void test_isInt() {
+  test_isInt() async {
     Source source = addSource("var v = 1 is int;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.IS_INT]);
     verify([source]);
   }
 
-  void test_isNotDouble() {
+  test_isNotDouble() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.dart2jsHint = true;
-    resetWithOptions(options);
+    resetWith(options: options);
     Source source = addSource("var v = 1 is! double;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.IS_NOT_DOUBLE]);
     verify([source]);
   }
 
   @failingTest
-  void test_isNotInt() {
+  test_isNotInt() async {
     Source source = addSource("var v = 1 is! int;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.IS_NOT_INT]);
     verify([source]);
   }
 
-  void test_js_lib_OK() {
+  test_js_lib_OK() async {
     Source source = addSource(r'''
 @JS()
 library foo;
@@ -1792,12 +1862,12 @@
 @JS()
 class A { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_missingJsLibAnnotation_class() {
+  test_missingJsLibAnnotation_class() async {
     Source source = addSource(r'''
 library foo;
 
@@ -1806,12 +1876,12 @@
 @JS()
 class A { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
     verify([source]);
   }
 
-  void test_missingJsLibAnnotation_externalField() {
+  test_missingJsLibAnnotation_externalField() async {
     // https://github.com/dart-lang/sdk/issues/26987
     Source source = addSource(r'''
 import 'package:js/js.dart';
@@ -1819,13 +1889,13 @@
 @JS()
 external dynamic exports;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [ParserErrorCode.EXTERNAL_FIELD, HintCode.MISSING_JS_LIB_ANNOTATION]);
     verify([source]);
   }
 
-  void test_missingJsLibAnnotation_function() {
+  test_missingJsLibAnnotation_function() async {
     Source source = addSource(r'''
 library foo;
 
@@ -1834,12 +1904,12 @@
 @JS('acxZIndex')
 set _currentZIndex(int value) { }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
     verify([source]);
   }
 
-  void test_missingJsLibAnnotation_method() {
+  test_missingJsLibAnnotation_method() async {
     Source source = addSource(r'''
 library foo;
 
@@ -1850,62 +1920,62 @@
   void a() { }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
     verify([source]);
   }
 
-  void test_missingJsLibAnnotation_variable() {
+  test_missingJsLibAnnotation_variable() async {
     Source source = addSource(r'''
 import 'package:js/js.dart';
 
 @JS()
 dynamic variable;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_JS_LIB_ANNOTATION]);
     verify([source]);
   }
 
-  void test_missingReturn_async() {
+  test_missingReturn_async() async {
     Source source = addSource('''
 import 'dart:async';
 Future<int> f() async {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_RETURN]);
     verify([source]);
   }
 
-  void test_missingReturn_factory() {
+  test_missingReturn_factory() async {
     Source source = addSource(r'''
 class A {
   factory A() {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_RETURN]);
     verify([source]);
   }
 
-  void test_missingReturn_function() {
+  test_missingReturn_function() async {
     Source source = addSource("int f() {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_RETURN]);
     verify([source]);
   }
 
-  void test_missingReturn_method() {
+  test_missingReturn_method() async {
     Source source = addSource(r'''
 class A {
   int m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_RETURN]);
     verify([source]);
   }
 
-  void test_mustCallSuper() {
+  test_mustCallSuper() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1918,12 +1988,12 @@
   {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MUST_CALL_SUPER]);
     verify([source]);
   }
 
-  void test_mustCallSuper_fromInterface() {
+  test_mustCallSuper_fromInterface() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1935,12 +2005,12 @@
   void a() {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, []);
     verify([source]);
   }
 
-  void test_mustCallSuper_indirect() {
+  test_mustCallSuper_indirect() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1958,12 +2028,12 @@
   void a() {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MUST_CALL_SUPER]);
     verify([source]);
   }
 
-  void test_mustCallSuper_overridden() {
+  test_mustCallSuper_overridden() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -1977,177 +2047,177 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, []);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_assert() {
+  test_nullAwareInCondition_assert() async {
     Source source = addSource(r'''
 m(x) {
   assert (x?.a);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_conditionalExpression() {
+  test_nullAwareInCondition_conditionalExpression() async {
     Source source = addSource(r'''
 m(x) {
   return x?.a ? 0 : 1;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_do() {
+  test_nullAwareInCondition_do() async {
     Source source = addSource(r'''
 m(x) {
   do {} while (x?.a);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_for() {
+  test_nullAwareInCondition_for() async {
     Source source = addSource(r'''
 m(x) {
   for (var v = x; v?.a; v = v.next) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if() {
+  test_nullAwareInCondition_if() async {
     Source source = addSource(r'''
 m(x) {
   if (x?.a) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if_conditionalAnd_first() {
+  test_nullAwareInCondition_if_conditionalAnd_first() async {
     Source source = addSource(r'''
 m(x) {
   if (x?.a && x.b) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if_conditionalAnd_second() {
+  test_nullAwareInCondition_if_conditionalAnd_second() async {
     Source source = addSource(r'''
 m(x) {
   if (x.a && x?.b) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if_conditionalAnd_third() {
+  test_nullAwareInCondition_if_conditionalAnd_third() async {
     Source source = addSource(r'''
 m(x) {
   if (x.a && x.b && x?.c) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if_conditionalOr_first() {
+  test_nullAwareInCondition_if_conditionalOr_first() async {
     Source source = addSource(r'''
 m(x) {
   if (x?.a || x.b) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if_conditionalOr_second() {
+  test_nullAwareInCondition_if_conditionalOr_second() async {
     Source source = addSource(r'''
 m(x) {
   if (x.a || x?.b) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if_conditionalOr_third() {
+  test_nullAwareInCondition_if_conditionalOr_third() async {
     Source source = addSource(r'''
 m(x) {
   if (x.a || x.b || x?.c) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if_not() {
+  test_nullAwareInCondition_if_not() async {
     Source source = addSource(r'''
 m(x) {
   if (!x?.a) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if_parenthesized() {
+  test_nullAwareInCondition_if_parenthesized() async {
     Source source = addSource(r'''
 m(x) {
   if ((x?.a)) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_while() {
+  test_nullAwareInCondition_while() async {
     Source source = addSource(r'''
 m(x) {
   while (x?.a) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.NULL_AWARE_IN_CONDITION]);
     verify([source]);
   }
 
   @failingTest
-  void test_overrideEqualsButNotHashCode() {
+  test_overrideEqualsButNotHashCode() async {
     Source source = addSource(r'''
 class A {
   bool operator ==(x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE]);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingField_invalid() {
+  test_overrideOnNonOverridingField_invalid() async {
     Source source = addSource(r'''
 class A {
 }
@@ -2155,12 +2225,12 @@
   @override
   final int m = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_FIELD]);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingGetter_invalid() {
+  test_overrideOnNonOverridingGetter_invalid() async {
     Source source = addSource(r'''
 class A {
 }
@@ -2168,12 +2238,12 @@
   @override
   int get m => 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER]);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingMethod_invalid() {
+  test_overrideOnNonOverridingMethod_invalid() async {
     Source source = addSource(r'''
 class A {
 }
@@ -2181,12 +2251,12 @@
   @override
   int m() => 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_METHOD]);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingSetter_invalid() {
+  test_overrideOnNonOverridingSetter_invalid() async {
     Source source = addSource(r'''
 class A {
 }
@@ -2194,12 +2264,12 @@
   @override
   set m(int x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_SETTER]);
     verify([source]);
   }
 
-  void test_required_constructor_param() {
+  test_required_constructor_param() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -2211,12 +2281,12 @@
   new C();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
     verify([source]);
   }
 
-  void test_required_constructor_param_no_reason() {
+  test_required_constructor_param_no_reason() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -2228,12 +2298,12 @@
   new C();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
     verify([source]);
   }
 
-  void test_required_constructor_param_null_reason() {
+  test_required_constructor_param_null_reason() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -2245,12 +2315,12 @@
   new C();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
     verify([source]);
   }
 
-  void test_required_constructor_param_OK() {
+  test_required_constructor_param_OK() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -2262,12 +2332,12 @@
   new C(a: 2);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_required_constructor_param_redirecting_cons_call() {
+  test_required_constructor_param_redirecting_cons_call() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -2276,12 +2346,12 @@
   C.named() : this();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
     verify([source]);
   }
 
-  void test_required_constructor_param_super_call() {
+  test_required_constructor_param_super_call() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -2293,12 +2363,12 @@
   D() : super();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
     verify([source]);
   }
 
-  void test_required_function_param() {
+  test_required_function_param() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -2308,12 +2378,12 @@
   f();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
     verify([source]);
   }
 
-  void test_required_method_param() {
+  test_required_method_param() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 class A {
@@ -2323,12 +2393,12 @@
   new A().m();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
     verify([source]);
   }
 
-  void test_required_method_param_in_other_lib() {
+  test_required_method_param_in_other_lib() async {
     addNamedSource(
         '/a_lib.dart',
         r'''
@@ -2346,12 +2416,12 @@
 }
 ''');
 
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM_WITH_DETAILS]);
     verify([source]);
   }
 
-  void test_required_typedef_function_param() {
+  test_required_typedef_function_param() async {
     Source source = addSource(r'''
 import 'package:meta/meta.dart';
 
@@ -2363,32 +2433,32 @@
   F m() => ({@required String x}) => null;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.MISSING_REQUIRED_PARAM]);
     verify([source]);
   }
 
-  void test_typeCheck_type_is_Null() {
+  test_typeCheck_type_is_Null() async {
     Source source = addSource(r'''
 m(i) {
   bool b = i is Null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.TYPE_CHECK_IS_NULL]);
     verify([source]);
   }
 
-  void test_typeCheck_type_not_Null() {
+  test_typeCheck_type_not_Null() async {
     Source source = addSource(r'''
 m(i) {
   bool b = i is! Null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.TYPE_CHECK_IS_NOT_NULL]);
     verify([source]);
   }
 
-  void test_undefinedGetter() {
+  test_undefinedGetter() async {
     Source source = addSource(r'''
 class A {}
 f(var a) {
@@ -2396,11 +2466,11 @@
     return a.m;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedGetter_message() {
+  test_undefinedGetter_message() async {
     // The implementation of HintCode.UNDEFINED_SETTER assumes that
     // UNDEFINED_SETTER in StaticTypeWarningCode and StaticWarningCode are the
     // same, this verifies that assumption.
@@ -2408,59 +2478,59 @@
         StaticTypeWarningCode.UNDEFINED_GETTER.message);
   }
 
-  void test_undefinedIdentifier_exportHide() {
+  test_undefinedIdentifier_exportHide() async {
     Source source = addSource(r'''
 library L;
 export 'lib1.dart' hide a;''');
     addNamedSource("/lib1.dart", "library lib1;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_HIDDEN_NAME]);
     verify([source]);
   }
 
-  void test_undefinedIdentifier_exportShow() {
+  test_undefinedIdentifier_exportShow() async {
     Source source = addSource(r'''
 library L;
 export 'lib1.dart' show a;''');
     addNamedSource("/lib1.dart", "library lib1;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_SHOWN_NAME]);
     verify([source]);
   }
 
-  void test_undefinedIdentifier_importHide() {
+  test_undefinedIdentifier_importHide() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' hide a;''');
     addNamedSource("/lib1.dart", "library lib1;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [HintCode.UNUSED_IMPORT, HintCode.UNDEFINED_HIDDEN_NAME]);
     verify([source]);
   }
 
-  void test_undefinedIdentifier_importShow() {
+  test_undefinedIdentifier_importShow() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' show a;''');
     addNamedSource("/lib1.dart", "library lib1;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [HintCode.UNUSED_IMPORT, HintCode.UNDEFINED_SHOWN_NAME]);
     verify([source]);
   }
 
-  void test_undefinedMethod() {
+  test_undefinedMethod() async {
     Source source = addSource(r'''
 f() {
   var a = 'str';
   a.notAMethodOnString();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_assignmentExpression() {
+  test_undefinedMethod_assignmentExpression() async {
     Source source = addSource(r'''
 class A {}
 class B {
@@ -2470,11 +2540,11 @@
     a += a2;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedOperator_binaryExpression() {
+  test_undefinedOperator_binaryExpression() async {
     Source source = addSource(r'''
 class A {}
 f(var a) {
@@ -2482,11 +2552,11 @@
     a + 1;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_indexBoth() {
+  test_undefinedOperator_indexBoth() async {
     Source source = addSource(r'''
 class A {}
 f(var a) {
@@ -2494,11 +2564,11 @@
     a[0]++;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_indexGetter() {
+  test_undefinedOperator_indexGetter() async {
     Source source = addSource(r'''
 class A {}
 f(var a) {
@@ -2506,11 +2576,11 @@
     a[0];
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_indexSetter() {
+  test_undefinedOperator_indexSetter() async {
     Source source = addSource(r'''
 class A {}
 f(var a) {
@@ -2518,11 +2588,11 @@
     a[0] = 1;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_postfixExpression() {
+  test_undefinedOperator_postfixExpression() async {
     Source source = addSource(r'''
 class A {}
 f(var a) {
@@ -2530,11 +2600,11 @@
     a++;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_prefixExpression() {
+  test_undefinedOperator_prefixExpression() async {
     Source source = addSource(r'''
 class A {}
 f(var a) {
@@ -2542,11 +2612,11 @@
     ++a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedSetter() {
+  test_undefinedSetter() async {
     Source source = addSource(r'''
 class A {}
 f(var a) {
@@ -2554,11 +2624,11 @@
     a.m = 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_SETTER]);
   }
 
-  void test_undefinedSetter_message() {
+  test_undefinedSetter_message() async {
     // The implementation of HintCode.UNDEFINED_SETTER assumes that
     // UNDEFINED_SETTER in StaticTypeWarningCode and StaticWarningCode are the
     // same, this verifies that assumption.
@@ -2566,27 +2636,27 @@
         StaticTypeWarningCode.UNDEFINED_SETTER.message);
   }
 
-  void test_unnecessaryCast_type_supertype() {
+  test_unnecessaryCast_type_supertype() async {
     Source source = addSource(r'''
 m(int i) {
   var b = i as Object;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_CAST]);
     verify([source]);
   }
 
-  void test_unnecessaryCast_type_type() {
+  test_unnecessaryCast_type_type() async {
     Source source = addSource(r'''
 m(num i) {
   var b = i as num;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_CAST]);
     verify([source]);
   }
 
-  void test_unnecessaryNoSuchMethod_blockBody() {
+  test_unnecessaryNoSuchMethod_blockBody() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(x) => super.noSuchMethod(x);
@@ -2597,12 +2667,12 @@
     return super.noSuchMethod(y);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_NO_SUCH_METHOD]);
     verify([source]);
   }
 
-  void test_unnecessaryNoSuchMethod_expressionBody() {
+  test_unnecessaryNoSuchMethod_expressionBody() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(x) => super.noSuchMethod(x);
@@ -2611,77 +2681,77 @@
   mmm();
   noSuchMethod(y) => super.noSuchMethod(y);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_NO_SUCH_METHOD]);
     verify([source]);
   }
 
-  void test_unnecessaryTypeCheck_null_is_Null() {
+  test_unnecessaryTypeCheck_null_is_Null() async {
     Source source = addSource("bool b = null is Null;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_TRUE]);
     verify([source]);
   }
 
-  void test_unnecessaryTypeCheck_null_not_Null() {
+  test_unnecessaryTypeCheck_null_not_Null() async {
     Source source = addSource("bool b = null is! Null;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_FALSE]);
     verify([source]);
   }
 
-  void test_unnecessaryTypeCheck_type_is_dynamic() {
+  test_unnecessaryTypeCheck_type_is_dynamic() async {
     Source source = addSource(r'''
 m(i) {
   bool b = i is dynamic;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_TRUE]);
     verify([source]);
   }
 
-  void test_unnecessaryTypeCheck_type_is_object() {
+  test_unnecessaryTypeCheck_type_is_object() async {
     Source source = addSource(r'''
 m(i) {
   bool b = i is Object;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_TRUE]);
     verify([source]);
   }
 
-  void test_unnecessaryTypeCheck_type_not_dynamic() {
+  test_unnecessaryTypeCheck_type_not_dynamic() async {
     Source source = addSource(r'''
 m(i) {
   bool b = i is! dynamic;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_FALSE]);
     verify([source]);
   }
 
-  void test_unnecessaryTypeCheck_type_not_object() {
+  test_unnecessaryTypeCheck_type_not_object() async {
     Source source = addSource(r'''
 m(i) {
   bool b = i is! Object;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNNECESSARY_TYPE_CHECK_FALSE]);
     verify([source]);
   }
 
-  void test_unusedElement_class_isUsed_extends() {
+  test_unusedElement_class_isUsed_extends() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {}
 class B extends _A {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_class_isUsed_fieldDeclaration() {
+  test_unusedElement_class_isUsed_fieldDeclaration() async {
     enableUnusedElement = true;
     var src = r'''
 class Foo {
@@ -2692,35 +2762,35 @@
 }
 ''';
     Source source = addSource(src);
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_class_isUsed_implements() {
+  test_unusedElement_class_isUsed_implements() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {}
 class B implements _A {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_class_isUsed_instanceCreation() {
+  test_unusedElement_class_isUsed_instanceCreation() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {}
 main() {
   new _A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_class_isUsed_staticFieldAccess() {
+  test_unusedElement_class_isUsed_staticFieldAccess() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {
@@ -2729,12 +2799,12 @@
 main() {
   _A.F;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_class_isUsed_staticMethodInvocation() {
+  test_unusedElement_class_isUsed_staticMethodInvocation() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {
@@ -2743,12 +2813,12 @@
 main() {
   _A.m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_class_isUsed_typeArgument() {
+  test_unusedElement_class_isUsed_typeArgument() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {}
@@ -2756,12 +2826,12 @@
   var v = new List<_A>();
   print(v);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_class_notUsed_inClassMember() {
+  test_unusedElement_class_notUsed_inClassMember() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {
@@ -2773,12 +2843,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_class_notUsed_inConstructorName() {
+  test_unusedElement_class_notUsed_inConstructorName() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {
@@ -2786,12 +2856,12 @@
   _A.named() {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_class_notUsed_isExpression() {
+  test_unusedElement_class_notUsed_isExpression() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {}
@@ -2800,23 +2870,23 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_class_notUsed_noReference() {
+  test_unusedElement_class_notUsed_noReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {}
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_class_notUsed_variableDeclaration() {
+  test_unusedElement_class_notUsed_variableDeclaration() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class _A {}
@@ -2826,35 +2896,35 @@
 }
 print(x) {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_enum_isUsed_fieldReference() {
+  test_unusedElement_enum_isUsed_fieldReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 enum _MyEnum {A, B, C}
 main() {
   print(_MyEnum.B);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_enum_notUsed_noReference() {
+  test_unusedElement_enum_notUsed_noReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 enum _MyEnum {A, B, C}
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_functionLocal_isUsed_closure() {
+  test_unusedElement_functionLocal_isUsed_closure() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 main() {
@@ -2862,24 +2932,24 @@
 }
 print(x) {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_functionLocal_isUsed_invocation() {
+  test_unusedElement_functionLocal_isUsed_invocation() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 main() {
   f() {}
   f();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_functionLocal_isUsed_reference() {
+  test_unusedElement_functionLocal_isUsed_reference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 main() {
@@ -2888,23 +2958,23 @@
 }
 print(x) {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_functionLocal_notUsed_noReference() {
+  test_unusedElement_functionLocal_notUsed_noReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 main() {
   f() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_functionLocal_notUsed_referenceFromItself() {
+  test_unusedElement_functionLocal_notUsed_referenceFromItself() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 main() {
@@ -2912,24 +2982,24 @@
     _f(p - 1);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_functionTop_isUsed_invocation() {
+  test_unusedElement_functionTop_isUsed_invocation() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 _f() {}
 main() {
   _f();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_functionTop_isUsed_reference() {
+  test_unusedElement_functionTop_isUsed_reference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 _f() {}
@@ -2938,23 +3008,23 @@
 }
 print(x) {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_functionTop_notUsed_noReference() {
+  test_unusedElement_functionTop_notUsed_noReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 _f() {}
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_functionTop_notUsed_referenceFromItself() {
+  test_unusedElement_functionTop_notUsed_referenceFromItself() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 _f(int p) {
@@ -2962,12 +3032,12 @@
 }
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_functionTypeAlias_isUsed_isExpression() {
+  test_unusedElement_functionTypeAlias_isUsed_isExpression() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 typedef _F(a, b);
@@ -2976,23 +3046,23 @@
     print('F');
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_functionTypeAlias_isUsed_reference() {
+  test_unusedElement_functionTypeAlias_isUsed_reference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 typedef _F(a, b);
 main(_F f) {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_functionTypeAlias_isUsed_typeArgument() {
+  test_unusedElement_functionTypeAlias_isUsed_typeArgument() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 typedef _F(a, b);
@@ -3000,35 +3070,35 @@
   var v = new List<_F>();
   print(v);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_functionTypeAlias_isUsed_variableDeclaration() {
+  test_unusedElement_functionTypeAlias_isUsed_variableDeclaration() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 typedef _F(a, b);
 class A {
   _F f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_functionTypeAlias_notUsed_noReference() {
+  test_unusedElement_functionTypeAlias_notUsed_noReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 typedef _F(a, b);
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_getter_isUsed_invocation_implicitThis() {
+  test_unusedElement_getter_isUsed_invocation_implicitThis() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3037,12 +3107,12 @@
     var v = _g;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_getter_isUsed_invocation_PrefixedIdentifier() {
+  test_unusedElement_getter_isUsed_invocation_PrefixedIdentifier() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3052,12 +3122,12 @@
   var v = a._g;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_getter_isUsed_invocation_PropertyAccess() {
+  test_unusedElement_getter_isUsed_invocation_PropertyAccess() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3067,23 +3137,23 @@
   var v = new A()._g;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_getter_notUsed_noReference() {
+  test_unusedElement_getter_notUsed_noReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
   get _g => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_getter_notUsed_referenceFromItself() {
+  test_unusedElement_getter_notUsed_referenceFromItself() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3091,12 +3161,12 @@
     return _g;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_hasReference_implicitThis() {
+  test_unusedElement_method_isUsed_hasReference_implicitThis() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3107,12 +3177,12 @@
 }
 print(x) {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_hasReference_implicitThis_subclass() {
+  test_unusedElement_method_isUsed_hasReference_implicitThis_subclass() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3126,12 +3196,12 @@
 }
 print(x) {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_hasReference_PrefixedIdentifier() {
+  test_unusedElement_method_isUsed_hasReference_PrefixedIdentifier() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3140,12 +3210,12 @@
 main(A a) {
   a._m;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_hasReference_PropertyAccess() {
+  test_unusedElement_method_isUsed_hasReference_PropertyAccess() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3154,12 +3224,12 @@
 main() {
   new A()._m;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_invocation_implicitThis() {
+  test_unusedElement_method_isUsed_invocation_implicitThis() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3168,12 +3238,12 @@
     _m();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_invocation_implicitThis_subclass() {
+  test_unusedElement_method_isUsed_invocation_implicitThis_subclass() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3185,12 +3255,12 @@
 class B extends A {
   _m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_invocation_MemberElement() {
+  test_unusedElement_method_isUsed_invocation_MemberElement() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A<T> {
@@ -3199,12 +3269,12 @@
 main(A<int> a) {
   a._m(0);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_invocation_propagated() {
+  test_unusedElement_method_isUsed_invocation_propagated() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3214,12 +3284,12 @@
   var a = new A();
   a._m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_invocation_static() {
+  test_unusedElement_method_isUsed_invocation_static() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3229,12 +3299,12 @@
   A a = new A();
   a._m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_invocation_subclass() {
+  test_unusedElement_method_isUsed_invocation_subclass() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3246,12 +3316,12 @@
 main(A a) {
   a._m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_notPrivate() {
+  test_unusedElement_method_isUsed_notPrivate() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3259,12 +3329,12 @@
 }
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_isUsed_staticInvocation() {
+  test_unusedElement_method_isUsed_staticInvocation() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3273,23 +3343,23 @@
 main() {
   A._m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_method_notUsed_noReference() {
+  test_unusedElement_method_notUsed_noReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
   static _m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_method_notUsed_referenceFromItself() {
+  test_unusedElement_method_notUsed_referenceFromItself() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3297,12 +3367,12 @@
     _m(p - 1);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_setter_isUsed_invocation_implicitThis() {
+  test_unusedElement_setter_isUsed_invocation_implicitThis() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3311,12 +3381,12 @@
     _s = 42;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_setter_isUsed_invocation_PrefixedIdentifier() {
+  test_unusedElement_setter_isUsed_invocation_PrefixedIdentifier() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3326,12 +3396,12 @@
   a._s = 42;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_setter_isUsed_invocation_PropertyAccess() {
+  test_unusedElement_setter_isUsed_invocation_PropertyAccess() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3341,23 +3411,23 @@
   new A()._s = 42;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedElement_setter_notUsed_noReference() {
+  test_unusedElement_setter_notUsed_noReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
   set _s(x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedElement_setter_notUsed_referenceFromItself() {
+  test_unusedElement_setter_notUsed_referenceFromItself() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3367,12 +3437,12 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_ELEMENT]);
     verify([source]);
   }
 
-  void test_unusedField_isUsed_argument() {
+  test_unusedField_isUsed_argument() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3382,12 +3452,12 @@
   }
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedField_isUsed_reference_implicitThis() {
+  test_unusedField_isUsed_reference_implicitThis() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3397,24 +3467,24 @@
   }
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedField_isUsed_reference_implicitThis_expressionFunctionBody() {
+  test_unusedField_isUsed_reference_implicitThis_expressionFunctionBody() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
   int _f;
   m() => _f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedField_isUsed_reference_implicitThis_subclass() {
+  test_unusedField_isUsed_reference_implicitThis_subclass() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3427,12 +3497,12 @@
   int _f;
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedField_isUsed_reference_qualified_propagatedElement() {
+  test_unusedField_isUsed_reference_qualified_propagatedElement() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3443,12 +3513,12 @@
   print(a._f);
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedField_isUsed_reference_qualified_staticElement() {
+  test_unusedField_isUsed_reference_qualified_staticElement() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3459,12 +3529,12 @@
   print(a._f);
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedField_isUsed_reference_qualified_unresolved() {
+  test_unusedField_isUsed_reference_qualified_unresolved() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3474,12 +3544,12 @@
   print(a._f);
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedField_notUsed_compoundAssign() {
+  test_unusedField_notUsed_compoundAssign() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3488,48 +3558,48 @@
     _f += 2;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_FIELD]);
     verify([source]);
   }
 
-  void test_unusedField_notUsed_constructorFieldInitializers() {
+  test_unusedField_notUsed_constructorFieldInitializers() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
   int _f;
   A() : _f = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_FIELD]);
     verify([source]);
   }
 
-  void test_unusedField_notUsed_fieldFormalParameter() {
+  test_unusedField_notUsed_fieldFormalParameter() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
   int _f;
   A(this._f);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_FIELD]);
     verify([source]);
   }
 
-  void test_unusedField_notUsed_noReference() {
+  test_unusedField_notUsed_noReference() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
   int _f;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_FIELD]);
     verify([source]);
   }
 
-  void test_unusedField_notUsed_postfixExpr() {
+  test_unusedField_notUsed_postfixExpr() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3538,12 +3608,12 @@
     _f++;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_FIELD]);
     verify([source]);
   }
 
-  void test_unusedField_notUsed_prefixExpr() {
+  test_unusedField_notUsed_prefixExpr() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3552,12 +3622,12 @@
     ++_f;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_FIELD]);
     verify([source]);
   }
 
-  void test_unusedField_notUsed_simpleAssignment() {
+  test_unusedField_notUsed_simpleAssignment() async {
     enableUnusedElement = true;
     Source source = addSource(r'''
 class A {
@@ -3570,23 +3640,24 @@
   a._f = 2;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_FIELD]);
     verify([source]);
   }
 
-  void test_unusedImport() {
+  test_unusedImport() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';''');
     Source source2 = addNamedSource("/lib1.dart", "library lib1;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source, [HintCode.UNUSED_IMPORT]);
     assertNoErrors(source2);
     verify([source, source2]);
   }
 
-  void test_unusedImport_as() {
+  test_unusedImport_as() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -3597,14 +3668,15 @@
         r'''
 library lib1;
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source, [HintCode.UNUSED_IMPORT]);
     assertNoErrors(source2);
     verify([source, source2]);
   }
 
   @failingTest
-  void test_unusedImport_as_equalPrefixes() {
+  test_unusedImport_as_equalPrefixes() async {
     // See todo at ImportsVerifier.prefixElementMap.
     Source source = addSource(r'''
 library L;
@@ -3621,14 +3693,16 @@
         r'''
 library lib2;
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
+    await computeAnalysisResult(source3);
     assertErrors(source, [HintCode.UNUSED_IMPORT]);
     assertNoErrors(source2);
     assertNoErrors(source3);
     verify([source, source2, source3]);
   }
 
-  void test_unusedImport_hide() {
+  test_unusedImport_hide() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -3639,22 +3713,24 @@
         r'''
 library lib1;
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source, [HintCode.UNUSED_IMPORT]);
     assertNoErrors(source2);
     verify([source, source2]);
   }
 
-  void test_unusedImport_inComment_libraryDirective() {
+  test_unusedImport_inComment_libraryDirective() async {
     Source source = addSource(r'''
 /// Use [Future] class.
 library L;
 import 'dart:async';
 ''');
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_unusedImport_show() {
+  test_unusedImport_show() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' show A;
@@ -3666,13 +3742,14 @@
 library lib1;
 class A {}
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source, [HintCode.UNUSED_IMPORT]);
     assertNoErrors(source2);
     verify([source, source2]);
   }
 
-  void test_unusedLocalVariable_inCatch_exception() {
+  test_unusedLocalVariable_inCatch_exception() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
@@ -3680,12 +3757,12 @@
   } on String catch (exception) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_CATCH_CLAUSE]);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_inCatch_exception_hasStack() {
+  test_unusedLocalVariable_inCatch_exception_hasStack() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
@@ -3694,12 +3771,12 @@
     print(stack);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_inCatch_exception_noOnClause() {
+  test_unusedLocalVariable_inCatch_exception_noOnClause() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
@@ -3707,12 +3784,12 @@
   } catch (exception) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_inCatch_stackTrace() {
+  test_unusedLocalVariable_inCatch_stackTrace() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
@@ -3720,12 +3797,12 @@
   } catch (exception, stackTrace) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_CATCH_STACK]);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_inCatch_stackTrace_used() {
+  test_unusedLocalVariable_inCatch_stackTrace_used() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
@@ -3735,12 +3812,12 @@
   }
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_inFor_underscore_ignored() {
+  test_unusedLocalVariable_inFor_underscore_ignored() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
@@ -3750,24 +3827,24 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_inFunction() {
+  test_unusedLocalVariable_inFunction() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
   var v = 1;
   v = 2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_inMethod() {
+  test_unusedLocalVariable_inMethod() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 class A {
@@ -3776,12 +3853,12 @@
     v = 2;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_isInvoked() {
+  test_unusedLocalVariable_isInvoked() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 typedef Foo();
@@ -3789,48 +3866,48 @@
   Foo foo;
   foo();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_isRead_notUsed_compoundAssign() {
+  test_unusedLocalVariable_isRead_notUsed_compoundAssign() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
   var v = 1;
   v += 2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_isRead_notUsed_postfixExpr() {
+  test_unusedLocalVariable_isRead_notUsed_postfixExpr() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
   var v = 1;
   v++;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_isRead_notUsed_prefixExpr() {
+  test_unusedLocalVariable_isRead_notUsed_prefixExpr() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
   var v = 1;
   ++v;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_LOCAL_VARIABLE]);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_isRead_usedArgument() {
+  test_unusedLocalVariable_isRead_usedArgument() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 main() {
@@ -3838,12 +3915,12 @@
   print(++v);
 }
 print(x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedLocalVariable_isRead_usedInvocationTarget() {
+  test_unusedLocalVariable_isRead_usedInvocationTarget() async {
     enableUnusedLocalVariable = true;
     Source source = addSource(r'''
 class A {
@@ -3854,12 +3931,12 @@
   a.foo();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_unusedShownName() {
+  test_unusedShownName() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' show A, B;
@@ -3870,13 +3947,14 @@
 library lib1;
 class A {}
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
     assertNoErrors(source2);
     verify([source, source2]);
   }
 
-  void test_unusedShownName_as() {
+  test_unusedShownName_as() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' as p show A, B;
@@ -3887,13 +3965,14 @@
 library lib1;
 class A {}
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
     assertNoErrors(source2);
     verify([source, source2]);
   }
 
-  void test_unusedShownName_duplicates() {
+  test_unusedShownName_duplicates() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' show A, B;
@@ -3908,14 +3987,15 @@
 class B {}
 class C {}
 class D {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(
         source, [HintCode.UNUSED_SHOWN_NAME, HintCode.UNUSED_SHOWN_NAME]);
     assertNoErrors(source2);
     verify([source, source2]);
   }
 
-  void test_unusedShownName_topLevelVariable() {
+  test_unusedShownName_topLevelVariable() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' show var1, var2;
@@ -3931,13 +4011,14 @@
 const int var2 = 2;
 const int var3 = 3;
 const int var4 = 4;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
     assertNoErrors(source2);
     verify([source, source2]);
   }
 
-  void test_useOfVoidResult_assignmentExpression_function() {
+  test_useOfVoidResult_assignmentExpression_function() async {
     Source source = addSource(r'''
 void f() {}
 class A {
@@ -3946,12 +4027,12 @@
     a = f();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
     verify([source]);
   }
 
-  void test_useOfVoidResult_assignmentExpression_method() {
+  test_useOfVoidResult_assignmentExpression_method() async {
     Source source = addSource(r'''
 class A {
   void m() {}
@@ -3960,12 +4041,12 @@
     a = m();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
     verify([source]);
   }
 
-  void test_useOfVoidResult_inForLoop() {
+  test_useOfVoidResult_inForLoop() async {
     Source source = addSource(r'''
 class A {
   void m() {}
@@ -3973,12 +4054,12 @@
     for(var a = m();;) {}
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
     verify([source]);
   }
 
-  void test_useOfVoidResult_variableDeclaration_function() {
+  test_useOfVoidResult_variableDeclaration_function() async {
     Source source = addSource(r'''
 void f() {}
 class A {
@@ -3986,12 +4067,12 @@
     var a = f();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
     verify([source]);
   }
 
-  void test_useOfVoidResult_variableDeclaration_method() {
+  test_useOfVoidResult_variableDeclaration_method() async {
     Source source = addSource(r'''
 class A {
   void m() {}
@@ -3999,12 +4080,12 @@
     var a = m();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.USE_OF_VOID_RESULT]);
     verify([source]);
   }
 
-  void test_useOfVoidResult_variableDeclaration_method2() {
+  test_useOfVoidResult_variableDeclaration_method2() async {
     Source source = addSource(r'''
 class A {
   void m() {}
@@ -4012,7 +4093,7 @@
     var a = m(), b = m();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [HintCode.USE_OF_VOID_RESULT, HintCode.USE_OF_VOID_RESULT]);
     verify([source]);
diff --git a/pkg/analyzer/test/generated/non_error_resolver_driver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_driver_test.dart
new file mode 100644
index 0000000..b18fe32
--- /dev/null
+++ b/pkg/analyzer/test/generated/non_error_resolver_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'non_error_resolver_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(NonErrorResolverTest_Driver);
+  });
+}
+
+@reflectiveTest
+class NonErrorResolverTest_Driver extends NonErrorResolverTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 067627d..52faa6d 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -4,7 +4,10 @@
 
 library analyzer.test.generated.non_error_resolver_test;
 
+import 'dart:async';
+
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/src/error/codes.dart';
@@ -25,19 +28,18 @@
 
 @reflectiveTest
 class NonErrorResolverTest extends ResolverTestCase {
-  void fail_undefinedEnumConstant() {
+  fail_undefinedEnumConstant() async {
     Source source = addSource(r'''
 enum E { ONE }
 E e() {
   return E.TWO;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_abstractSuperMemberReference_superHasConcrete_mixinHasAbstract_method() {
+  test_abstractSuperMemberReference_superHasConcrete_mixinHasAbstract_method() async {
     Source source = addSource('''
 class A {
   void method() {}
@@ -53,12 +55,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_abstractSuperMemberReference_superHasNoSuchMethod() {
+  test_abstractSuperMemberReference_superHasNoSuchMethod() async {
     Source source = addSource('''
 abstract class A {
   int m();
@@ -69,12 +71,12 @@
   int m() => super.m();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_abstractSuperMemberReference_superSuperHasConcrete_getter() {
+  test_abstractSuperMemberReference_superSuperHasConcrete_getter() async {
     Source source = addSource('''
 abstract class A {
   int get m => 0;
@@ -88,12 +90,12 @@
   int get m => super.m;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_abstractSuperMemberReference_superSuperHasConcrete_method() {
+  test_abstractSuperMemberReference_superSuperHasConcrete_method() async {
     Source source = addSource('''
 void main() {
   print(new C().m());
@@ -111,12 +113,12 @@
   int m() => super.m();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_abstractSuperMemberReference_superSuperHasConcrete_setter() {
+  test_abstractSuperMemberReference_superSuperHasConcrete_setter() async {
     Source source = addSource('''
 abstract class A {
   void set m(int v) {}
@@ -132,12 +134,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_ambiguousExport() {
+  test_ambiguousExport() async {
     Source source = addSource(r'''
 library L;
 export 'lib1.dart';
@@ -152,12 +154,12 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_ambiguousExport_combinators_hide() {
+  test_ambiguousExport_combinators_hide() async {
     Source source = addSource(r'''
 library L;
 export 'lib1.dart';
@@ -174,12 +176,12 @@
 library L2;
 class B {}
 class C {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_ambiguousExport_combinators_show() {
+  test_ambiguousExport_combinators_show() async {
     Source source = addSource(r'''
 library L;
 export 'lib1.dart';
@@ -196,12 +198,12 @@
 library L2;
 class B {}
 class C {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_ambiguousExport_sameDeclaration() {
+  test_ambiguousExport_sameDeclaration() async {
     Source source = addSource(r'''
 library L;
 export 'lib.dart';
@@ -211,12 +213,12 @@
         r'''
 library lib;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_ambiguousImport_hideCombinator() {
+  test_ambiguousImport_hideCombinator() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -244,11 +246,11 @@
 library lib3;
 class N {}
 class N3 {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_ambiguousImport_showCombinator() {
+  test_ambiguousImport_showCombinator() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart' show N, N2;
@@ -268,19 +270,19 @@
 library lib2;
 class N {}
 class N2 {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNUSED_SHOWN_NAME]);
   }
 
-  void test_annotated_partOfDeclaration() {
+  test_annotated_partOfDeclaration() async {
     Source source = addSource('library L; part "part.dart";');
     addNamedSource('/part.dart', '@deprecated part of L;');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_classWithCall_Function() {
+  test_argumentTypeNotAssignable_classWithCall_Function() async {
     Source source = addSource(r'''
   caller(Function callee) {
     callee();
@@ -293,12 +295,12 @@
   main() {
     caller(new CallMeBack());
   }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_fieldFormalParameterElement_member() {
+  test_argumentTypeNotAssignable_fieldFormalParameterElement_member() async {
     Source source = addSource(r'''
 class ObjectSink<T> {
   void sink(T object) {
@@ -309,46 +311,46 @@
   E object2;
   TimestampedObject(this.object2);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_functionParameter_generic() {
+  test_argumentTypeNotAssignable_invocation_functionParameter_generic() async {
     Source source = addSource(r'''
 class A<K> {
   m(f(K k), K v) {
     f(v);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_typedef_generic() {
+  test_argumentTypeNotAssignable_invocation_typedef_generic() async {
     Source source = addSource(r'''
 typedef A<T>(T p);
 f(A<int> a) {
   a(1);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_Object_Function() {
+  test_argumentTypeNotAssignable_Object_Function() async {
     Source source = addSource(r'''
 main() {
   process(() {});
 }
 process(Object x) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_typedef_local() {
+  test_argumentTypeNotAssignable_typedef_local() async {
     Source source = addSource(r'''
 typedef A(int p1, String p2);
 A getA() => null;
@@ -356,24 +358,23 @@
   A a = getA();
   a(1, '2');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_typedef_parameter() {
+  test_argumentTypeNotAssignable_typedef_parameter() async {
     Source source = addSource(r'''
 typedef A(int p1, String p2);
 f(A a) {
   a(1, '2');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assert_with_message_await() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true);
+  test_assert_with_message_await() async {
     Source source = addSource('''
 import 'dart:async';
 f() async {
@@ -381,74 +382,69 @@
 }
 Future<String> g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assert_with_message_dynamic() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true);
+  test_assert_with_message_dynamic() async {
     Source source = addSource('''
 f() {
   assert(false, g());
 }
 g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assert_with_message_non_string() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true);
+  test_assert_with_message_non_string() async {
     Source source = addSource('''
 f() {
   assert(false, 3);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assert_with_message_null() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true);
+  test_assert_with_message_null() async {
     Source source = addSource('''
 f() {
   assert(false, null);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assert_with_message_string() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true);
+  test_assert_with_message_string() async {
     Source source = addSource('''
 f() {
   assert(false, 'message');
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assert_with_message_suppresses_unused_var_hint() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true);
+  test_assert_with_message_suppresses_unused_var_hint() async {
     Source source = addSource('''
 f() {
   String message = 'msg';
   assert(true, message);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assignability_function_expr_rettype_from_typedef_cls() {
+  test_assignability_function_expr_rettype_from_typedef_cls() async {
     // In the code below, the type of (() => f()) has a return type which is
     // a class, and that class is inferred from the return type of the typedef
     // F.
@@ -460,12 +456,12 @@
   F f2 = (() => f());
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assignability_function_expr_rettype_from_typedef_typedef() {
+  test_assignability_function_expr_rettype_from_typedef_typedef() async {
     // In the code below, the type of (() => f()) has a return type which is
     // a typedef, and that typedef is inferred from the return type of the
     // typedef F.
@@ -477,23 +473,23 @@
   F f2 = (() => f());
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assignmentToFinal_prefixNegate() {
+  test_assignmentToFinal_prefixNegate() async {
     Source source = addSource(r'''
 f() {
   final x = 0;
   -x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assignmentToFinalNoSetter_prefixedIdentifier() {
+  test_assignmentToFinalNoSetter_prefixedIdentifier() async {
     Source source = addSource(r'''
 class A {
   int get x => 0;
@@ -503,12 +499,12 @@
   A a = new A();
   a.x = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assignmentToFinalNoSetter_propertyAccess() {
+  test_assignmentToFinalNoSetter_propertyAccess() async {
     Source source = addSource(r'''
 class A {
   int get x => 0;
@@ -520,12 +516,12 @@
 main() {
   B.a.x = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_assignmentToFinals_importWithPrefix() {
+  test_assignmentToFinals_importWithPrefix() async {
     Source source = addSource(r'''
 library lib;
 import 'lib1.dart' as foo;
@@ -537,43 +533,43 @@
         r'''
 library lib1;
 bool x = false;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_dynamic_with_return() {
+  test_async_dynamic_with_return() async {
     Source source = addSource('''
 dynamic f() async {
   return;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_dynamic_with_return_value() {
+  test_async_dynamic_with_return_value() async {
     Source source = addSource('''
 dynamic f() async {
   return 5;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_dynamic_without_return() {
+  test_async_dynamic_without_return() async {
     Source source = addSource('''
 dynamic f() async {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_expression_function_type() {
+  test_async_expression_function_type() async {
     Source source = addSource('''
 import 'dart:async';
 typedef Future<int> F(int i);
@@ -581,12 +577,12 @@
   F f = (int i) async => i;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_flattened() {
+  test_async_flattened() async {
     Source source = addSource('''
 import 'dart:async';
 typedef Future<int> CreatesFutureInt();
@@ -597,160 +593,150 @@
 }
 Future<int> f() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_dynamic_with_return() {
+  test_async_future_dynamic_with_return() async {
     Source source = addSource('''
 import 'dart:async';
 Future<dynamic> f() async {
   return;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_dynamic_with_return_value() {
+  test_async_future_dynamic_with_return_value() async {
     Source source = addSource('''
 import 'dart:async';
 Future<dynamic> f() async {
   return 5;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_dynamic_without_return() {
+  test_async_future_dynamic_without_return() async {
     Source source = addSource('''
 import 'dart:async';
 Future<dynamic> f() async {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_int_with_return_future_int() {
+  test_async_future_int_with_return_future_int() async {
     Source source = addSource('''
 import 'dart:async';
 Future<int> f() async {
   return new Future<int>.value(5);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_int_with_return_value() {
+  test_async_future_int_with_return_value() async {
     Source source = addSource('''
 import 'dart:async';
 Future<int> f() async {
   return 5;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_null_with_return() {
+  test_async_future_null_with_return() async {
     Source source = addSource('''
 import 'dart:async';
 Future<Null> f() async {
   return;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_null_without_return() {
+  test_async_future_null_without_return() async {
     Source source = addSource('''
 import 'dart:async';
 Future<Null> f() async {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_object_with_return() {
+  test_async_future_object_with_return() async {
     Source source = addSource('''
 import 'dart:async';
 Future<Object> f() async {
   return;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_object_with_return_value() {
+  test_async_future_object_with_return_value() async {
     Source source = addSource('''
 import 'dart:async';
 Future<Object> f() async {
   return 5;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_object_without_return() {
-    Source source = addSource('''
-import 'dart:async';
-Future<Object> f() async {}
-''');
-    computeLibrarySourceErrors(source);
-    assertNoErrors(source);
-    verify([source]);
-  }
-
-  void test_async_future_with_return() {
+  test_async_future_with_return() async {
     Source source = addSource('''
 import 'dart:async';
 Future f() async {
   return;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_with_return_value() {
+  test_async_future_with_return_value() async {
     Source source = addSource('''
 import 'dart:async';
 Future f() async {
   return 5;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_future_without_return() {
+  test_async_future_without_return() async {
     Source source = addSource('''
 import 'dart:async';
 Future f() async {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_return_flattens_futures() {
+  test_async_return_flattens_futures() async {
     Source source = addSource('''
 import 'dart:async';
 Future<int> f() async {
@@ -758,65 +744,65 @@
 }
 Future<Future<int>> g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_with_return() {
+  test_async_with_return() async {
     Source source = addSource('''
 f() async {
   return;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_with_return_value() {
+  test_async_with_return_value() async {
     Source source = addSource('''
 f() async {
   return 5;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_async_without_return() {
+  test_async_without_return() async {
     Source source = addSource('''
 f() async {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_asyncForInWrongContext_async() {
+  test_asyncForInWrongContext_async() async {
     Source source = addSource(r'''
 f(list) async {
   await for (var e in list) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_asyncForInWrongContext_asyncStar() {
+  test_asyncForInWrongContext_asyncStar() async {
     Source source = addSource(r'''
 f(list) async* {
   await for (var e in list) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_await_flattened() {
+  test_await_flattened() async {
     Source source = addSource('''
 import 'dart:async';
 Future<Future<int>> ffi() => null;
@@ -824,12 +810,12 @@
   int b = await ffi();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_await_simple() {
+  test_await_simple() async {
     Source source = addSource('''
 import 'dart:async';
 Future<int> fi() => null;
@@ -837,32 +823,32 @@
   int a = await fi();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_awaitInWrongContext_async() {
+  test_awaitInWrongContext_async() async {
     Source source = addSource(r'''
 f(x, y) async {
   return await x + await y;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_awaitInWrongContext_asyncStar() {
+  test_awaitInWrongContext_asyncStar() async {
     Source source = addSource(r'''
 f(x, y) async* {
   yield await x + await y;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_breakWithoutLabelInSwitch() {
+  test_breakWithoutLabelInSwitch() async {
     Source source = addSource(r'''
 class A {
   void m(int i) {
@@ -872,12 +858,12 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_bug_24539_getter() {
+  test_bug_24539_getter() async {
     Source source = addSource('''
 class C<T> {
   List<Foo> get x => null;
@@ -885,12 +871,12 @@
 
 typedef Foo(param);
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_bug_24539_setter() {
+  test_bug_24539_setter() async {
     Source source = addSource('''
 class C<T> {
   void set x(List<Foo> value) {}
@@ -898,22 +884,22 @@
 
 typedef Foo(param);
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_builtInIdentifierAsType_dynamic() {
+  test_builtInIdentifierAsType_dynamic() async {
     Source source = addSource(r'''
 f() {
   dynamic x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_caseBlockNotTerminated() {
+  test_caseBlockNotTerminated() async {
     Source source = addSource(r'''
 f(int p) {
   for (int i = 0; i < 10; i++) {
@@ -935,12 +921,12 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_caseBlockNotTerminated_lastCase() {
+  test_caseBlockNotTerminated_lastCase() async {
     Source source = addSource(r'''
 f(int p) {
   switch (p) {
@@ -948,12 +934,12 @@
       p = p + 1;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_caseExpressionTypeImplementsEquals() {
+  test_caseExpressionTypeImplementsEquals() async {
     Source source = addSource(r'''
 print(p) {}
 
@@ -975,12 +961,12 @@
   case const C(1): print('Switch: 1'); break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_caseExpressionTypeImplementsEquals_int() {
+  test_caseExpressionTypeImplementsEquals_int() async {
     Source source = addSource(r'''
 f(int i) {
   switch(i) {
@@ -988,12 +974,12 @@
     default: return 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_caseExpressionTypeImplementsEquals_Object() {
+  test_caseExpressionTypeImplementsEquals_Object() async {
     Source source = addSource(r'''
 class IntWrapper {
   final int value;
@@ -1006,12 +992,12 @@
     default: return 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_caseExpressionTypeImplementsEquals_String() {
+  test_caseExpressionTypeImplementsEquals_String() async {
     Source source = addSource(r'''
 f(String s) {
   switch(s) {
@@ -1019,12 +1005,12 @@
     default: return 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_class_type_alias_documentationComment() {
+  test_class_type_alias_documentationComment() async {
     Source source = addSource('''
 /**
  * Documentation
@@ -1033,26 +1019,26 @@
 
 class D {}
 class E {}''');
-    computeLibrarySourceErrors(source);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
-    ClassElement classC = unit.element.getType('C');
+    CompilationUnit unit = analysisResult.unit;
+    ClassElement classC =
+        resolutionMap.elementDeclaredByCompilationUnit(unit).getType('C');
     expect(classC.documentationComment, isNotNull);
   }
 
-  void test_commentReference_beforeConstructor() {
+  test_commentReference_beforeConstructor() async {
     String code = r'''
 abstract class A {
   /// [p]
   A(int p) {}
 }''';
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
+    CompilationUnit unit = analysisResult.unit;
     {
       SimpleIdentifier ref =
           EngineTestCase.findSimpleIdentifier(unit, code, "p]");
@@ -1060,7 +1046,7 @@
     }
   }
 
-  void test_commentReference_beforeEnum() {
+  test_commentReference_beforeEnum() async {
     String code = r'''
 /// This is the [Samurai] kind.
 enum Samurai {
@@ -1070,10 +1056,10 @@
   WITHOUT_SWORD
 }''';
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
+    CompilationUnit unit = analysisResult.unit;
     {
       SimpleIdentifier ref =
           EngineTestCase.findSimpleIdentifier(unit, code, 'Samurai]');
@@ -1097,61 +1083,61 @@
     }
   }
 
-  void test_commentReference_beforeFunction_blockBody() {
+  test_commentReference_beforeFunction_blockBody() async {
     String code = r'''
 /// [p]
 foo(int p) {
 }''';
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
+    CompilationUnit unit = analysisResult.unit;
     SimpleIdentifier ref =
         EngineTestCase.findSimpleIdentifier(unit, code, 'p]');
     expect(ref.staticElement, new isInstanceOf<ParameterElement>());
   }
 
-  void test_commentReference_beforeFunction_expressionBody() {
+  test_commentReference_beforeFunction_expressionBody() async {
     String code = r'''
 /// [p]
 foo(int p) => null;''';
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
+    CompilationUnit unit = analysisResult.unit;
     SimpleIdentifier ref =
         EngineTestCase.findSimpleIdentifier(unit, code, 'p]');
     expect(ref.staticElement, new isInstanceOf<ParameterElement>());
   }
 
-  void test_commentReference_beforeFunctionTypeAlias() {
+  test_commentReference_beforeFunctionTypeAlias() async {
     String code = r'''
 /// [p]
 typedef Foo(int p);
 ''';
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
+    CompilationUnit unit = analysisResult.unit;
     SimpleIdentifier ref =
         EngineTestCase.findSimpleIdentifier(unit, code, 'p]');
     expect(ref.staticElement, new isInstanceOf<ParameterElement>());
   }
 
-  void test_commentReference_beforeGetter() {
+  test_commentReference_beforeGetter() async {
     String code = r'''
 abstract class A {
   /// [int]
   get g => null;
 }''';
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
+    CompilationUnit unit = analysisResult.unit;
     {
       SimpleIdentifier ref =
           EngineTestCase.findSimpleIdentifier(unit, code, 'int]');
@@ -1159,7 +1145,7 @@
     }
   }
 
-  void test_commentReference_beforeMethod() {
+  test_commentReference_beforeMethod() async {
     String code = r'''
 abstract class A {
   /// [p1]
@@ -1172,10 +1158,10 @@
   md(int p5, {int p6});
 }''';
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
+    CompilationUnit unit = analysisResult.unit;
     assertIsParameter(String search) {
       SimpleIdentifier ref =
           EngineTestCase.findSimpleIdentifier(unit, code, search);
@@ -1190,23 +1176,23 @@
     assertIsParameter('p6');
   }
 
-  void test_commentReference_class() {
+  test_commentReference_class() async {
     String code = r'''
 /// [foo]
 class A {
   foo() {}
 }''';
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
+    CompilationUnit unit = analysisResult.unit;
     SimpleIdentifier ref =
         EngineTestCase.findSimpleIdentifier(unit, code, 'foo]');
     expect(ref.staticElement, new isInstanceOf<MethodElement>());
   }
 
-  void test_commentReference_setter() {
+  test_commentReference_setter() async {
     String code = r'''
 class A {
   /// [x] in A
@@ -1219,10 +1205,10 @@
 }
 ''';
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
-    CompilationUnit unit = _getResolvedLibraryUnit(source);
+    CompilationUnit unit = analysisResult.unit;
     {
       SimpleIdentifier ref =
           EngineTestCase.findSimpleIdentifier(unit, code, "x] in A");
@@ -1235,17 +1221,17 @@
     }
   }
 
-  void test_concreteClassWithAbstractMember() {
+  test_concreteClassWithAbstractMember() async {
     Source source = addSource(r'''
 abstract class A {
   m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_concreteClassWithAbstractMember_inherited() {
+  test_concreteClassWithAbstractMember_inherited() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -1253,12 +1239,23 @@
 class B extends A {
   m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_conflictingInstanceGetterAndSuperclassMember_instance() {
+  test_conflictingConstructorNameAndMember_setter() async {
+    Source source = addSource(r'''
+class A {
+A.x() {}
+set x(_) {}
+}''');
+    await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+  }
+
+  test_conflictingInstanceGetterAndSuperclassMember_instance() async {
     Source source = addSource(r'''
 class A {
   get v => 0;
@@ -1266,55 +1263,55 @@
 class B extends A {
   get v => 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_conflictingStaticGetterAndInstanceSetter_thisClass() {
+  test_conflictingStaticGetterAndInstanceSetter_thisClass() async {
     Source source = addSource(r'''
 class A {
   static get x => 0;
   static set x(int p) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_conflictingStaticSetterAndInstanceMember_thisClass_method() {
+  test_conflictingStaticSetterAndInstanceMember_thisClass_method() async {
     Source source = addSource(r'''
 class A {
   static x() {}
   static set x(int p) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_const_constructor_with_named_generic_parameter() {
+  test_const_constructor_with_named_generic_parameter() async {
     Source source = addSource('''
 class C<T> {
   const C({T t});
 }
 const c = const C(t: 1);
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_const_dynamic() {
+  test_const_dynamic() async {
     Source source = addSource('''
 const Type d = dynamic;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constConstructorWithNonConstSuper_explicit() {
+  test_constConstructorWithNonConstSuper_explicit() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1322,12 +1319,12 @@
 class B extends A {
   const B(): super();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constConstructorWithNonConstSuper_redirectingFactory() {
+  test_constConstructorWithNonConstSuper_redirectingFactory() async {
     Source source = addSource(r'''
 class A {
   A();
@@ -1338,12 +1335,12 @@
 class C extends A {
   const factory C() = B;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constConstructorWithNonConstSuper_unresolved() {
+  test_constConstructorWithNonConstSuper_unresolved() async {
     Source source = addSource(r'''
 class A {
   A.a();
@@ -1351,24 +1348,24 @@
 class B extends A {
   const B(): super();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT]);
     verify([source]);
   }
 
-  void test_constConstructorWithNonFinalField_finalInstanceVar() {
+  test_constConstructorWithNonFinalField_finalInstanceVar() async {
     Source source = addSource(r'''
 class A {
   final int x = 0;
   const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constConstructorWithNonFinalField_mixin() {
+  test_constConstructorWithNonFinalField_mixin() async {
     Source source = addSource(r'''
 class A {
   a() {}
@@ -1376,36 +1373,36 @@
 class B extends Object with A {
   const B();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN]);
     verify([source]);
   }
 
-  void test_constConstructorWithNonFinalField_static() {
+  test_constConstructorWithNonFinalField_static() async {
     Source source = addSource(r'''
 class A {
   static int x;
   const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constConstructorWithNonFinalField_syntheticField() {
+  test_constConstructorWithNonFinalField_syntheticField() async {
     Source source = addSource(r'''
 class A {
   const A();
   set x(value) {}
   get x {return 0;}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constDeferredClass_new() {
-    resolveWithErrors(<String>[
+  test_constDeferredClass_new() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {
@@ -1420,16 +1417,16 @@
     ], <ErrorCode>[]);
   }
 
-  void test_constEval_functionTypeLiteral() {
+  test_constEval_functionTypeLiteral() async {
     Source source = addSource(r'''
 typedef F();
 const C = F;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constEval_propertyExtraction_fieldStatic_targetType() {
+  test_constEval_propertyExtraction_fieldStatic_targetType() async {
     addNamedSource(
         "/math.dart",
         r'''
@@ -1438,24 +1435,24 @@
     Source source = addSource(r'''
 import 'math.dart' as math;
 const C = math.PI;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constEval_propertyExtraction_methodStatic_targetType() {
+  test_constEval_propertyExtraction_methodStatic_targetType() async {
     Source source = addSource(r'''
 class A {
   const A();
   static m() {}
 }
 const C = A.m;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constEval_symbol() {
+  test_constEval_symbol() async {
     addNamedSource(
         "/math.dart",
         r'''
@@ -1464,12 +1461,12 @@
     Source source = addSource(r'''
 const C = #foo;
 foo() {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constEvalTypeBoolNumString_equal() {
+  test_constEvalTypeBoolNumString_equal() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1494,11 +1491,11 @@
   const B.n1(num p) : v = p == null;
   const B.n2(num p) : v = null == p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_constEvalTypeBoolNumString_notEqual() {
+  test_constEvalTypeBoolNumString_notEqual() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1523,22 +1520,22 @@
   const B.n1(num p) : v = p != null;
   const B.n2(num p) : v = null != p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constEvelTypeNum_String() {
+  test_constEvelTypeNum_String() async {
     Source source = addSource(r'''
 const String A = 'a';
 const String B = A + 'b';
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constMapKeyExpressionTypeImplementsEquals_abstract() {
+  test_constMapKeyExpressionTypeImplementsEquals_abstract() async {
     Source source = addSource(r'''
 abstract class B {
   final id;
@@ -1555,32 +1552,32 @@
 Map getMap() {
   return const { const C(0): 'Map: 0' };
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constNotInitialized_field() {
+  test_constNotInitialized_field() async {
     Source source = addSource(r'''
 class A {
   static const int x = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constNotInitialized_local() {
+  test_constNotInitialized_local() async {
     Source source = addSource(r'''
 main() {
   const int x = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constRedirectSkipsSupertype() {
+  test_constRedirectSkipsSupertype() async {
     // Since C redirects to C.named, it doesn't implicitly refer to B's
     // unnamed constructor.  Therefore there is no cycle.
     Source source = addSource('''
@@ -1595,23 +1592,23 @@
 }
 const y = const C();
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constructorDeclaration_scope_signature() {
+  test_constructorDeclaration_scope_signature() async {
     Source source = addSource(r'''
 const app = 0;
 class A {
   A(@app int app) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constWithNonConstantArgument_constField() {
+  test_constWithNonConstantArgument_constField() async {
     Source source = addSource(r'''
 class A {
   const A(x);
@@ -1619,34 +1616,34 @@
 main() {
   const A(double.INFINITY);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constWithNonConstantArgument_literals() {
+  test_constWithNonConstantArgument_literals() async {
     Source source = addSource(r'''
 class A {
   const A(a, b, c, d);
 }
 f() { return const A(true, 0, 1.0, '2'); }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constWithTypeParameters_direct() {
+  test_constWithTypeParameters_direct() async {
     Source source = addSource(r'''
 class A<T> {
   static const V = const A<int>();
   const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constWithUndefinedConstructor() {
+  test_constWithUndefinedConstructor() async {
     Source source = addSource(r'''
 class A {
   const A.name();
@@ -1654,12 +1651,12 @@
 f() {
   return const A.name();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_constWithUndefinedConstructorDefault() {
+  test_constWithUndefinedConstructorDefault() async {
     Source source = addSource(r'''
 class A {
   const A();
@@ -1667,33 +1664,33 @@
 f() {
   return const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_defaultValueInFunctionTypeAlias() {
+  test_defaultValueInFunctionTypeAlias() async {
     Source source = addSource("typedef F([x]);");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_defaultValueInFunctionTypedParameter_named() {
+  test_defaultValueInFunctionTypedParameter_named() async {
     Source source = addSource("f(g({p})) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_defaultValueInFunctionTypedParameter_optional() {
+  test_defaultValueInFunctionTypedParameter_optional() async {
     Source source = addSource("f(g([p])) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deprecatedMemberUse_hide() {
+  test_deprecatedMemberUse_hide() async {
     Source source = addSource(r'''
 library lib;
 import 'lib1.dart' hide B;
@@ -1705,12 +1702,12 @@
 class A {}
 @deprecated
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_duplicateDefinition_emptyName() {
+  test_duplicateDefinition_emptyName() async {
     // Note: This code has two FunctionElements '() {}' with an empty name,
     // this tests that the empty string is not put into the scope
     // (more than once).
@@ -1719,19 +1716,19 @@
   'a' : () {},
   'b' : () {}
 };''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_duplicateDefinition_getter() {
+  test_duplicateDefinition_getter() async {
     Source source = addSource("bool get a => true;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_duplicatePart() {
+  test_duplicatePart() async {
     addNamedSource('/part1.dart', 'part of lib;');
     addNamedSource('/part2.dart', 'part of lib;');
     Source source = addSource(r'''
@@ -1739,116 +1736,116 @@
 part 'part1.dart';
 part 'part2.dart';
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_dynamicIdentifier() {
+  test_dynamicIdentifier() async {
     Source source = addSource(r'''
 main() {
   var v = dynamic;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_empty_generator_async() {
+  test_empty_generator_async() async {
     Source source = addSource('''
 import 'dart:async';
 Stream<int> f() async* {
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_empty_generator_sync() {
+  test_empty_generator_sync() async {
     Source source = addSource('''
 Iterable<int> f() sync* {
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_expectedOneListTypeArgument() {
+  test_expectedOneListTypeArgument() async {
     Source source = addSource(r'''
 main() {
   <int> [];
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_expectedTwoMapTypeArguments() {
+  test_expectedTwoMapTypeArguments() async {
     Source source = addSource(r'''
 main() {
   <int, int> {};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_exportDuplicatedLibraryUnnamed() {
+  test_exportDuplicatedLibraryUnnamed() async {
     Source source = addSource(r'''
 library test;
 export 'lib1.dart';
 export 'lib2.dart';''');
     addNamedSource("/lib1.dart", "");
     addNamedSource("/lib2.dart", "");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_exportOfNonLibrary_libraryDeclared() {
+  test_exportOfNonLibrary_libraryDeclared() async {
     Source source = addSource(r'''
 library L;
 export 'lib1.dart';''');
     addNamedSource("/lib1.dart", "library lib1;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_exportOfNonLibrary_libraryNotDeclared() {
+  test_exportOfNonLibrary_libraryNotDeclared() async {
     Source source = addSource(r'''
 library L;
 export 'lib1.dart';''');
     addNamedSource("/lib1.dart", "");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_extraPositionalArguments_function() {
+  test_extraPositionalArguments_function() async {
     Source source = addSource(r'''
 f(p1, p2) {}
 main() {
   f(1, 2);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_extraPositionalArguments_Function() {
+  test_extraPositionalArguments_Function() async {
     Source source = addSource(r'''
 f(Function a) {
   a(1, 2);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_extraPositionalArguments_implicitConstructor() {
+  test_extraPositionalArguments_implicitConstructor() async {
     Source source = addSource(r'''
 class A<E extends num> {
   A(E x, E y);
@@ -1858,12 +1855,12 @@
 void main() {
    B<int> x = new B<int>(0,0);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_extraPositionalArguments_typedef_local() {
+  test_extraPositionalArguments_typedef_local() async {
     Source source = addSource(r'''
 typedef A(p1, p2);
 A getA() => null;
@@ -1871,79 +1868,79 @@
   A a = getA();
   a(1, 2);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_extraPositionalArguments_typedef_parameter() {
+  test_extraPositionalArguments_typedef_parameter() async {
     Source source = addSource(r'''
 typedef A(p1, p2);
 f(A a) {
   a(1, 2);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldInitializedByMultipleInitializers() {
+  test_fieldInitializedByMultipleInitializers() async {
     Source source = addSource(r'''
 class A {
   int x;
   int y;
   A() : x = 0, y = 0 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal() {
+  test_fieldInitializedInInitializerAndDeclaration_fieldNotFinal() async {
     Source source = addSource(r'''
 class A {
   int x = 0;
   A() : x = 1 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSet() {
+  test_fieldInitializedInInitializerAndDeclaration_finalFieldNotSet() async {
     Source source = addSource(r'''
 class A {
   final int x;
   A() : x = 1 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldInitializerOutsideConstructor() {
+  test_fieldInitializerOutsideConstructor() async {
     Source source = addSource(r'''
 class A {
   int x;
   A(this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldInitializerOutsideConstructor_defaultParameters() {
+  test_fieldInitializerOutsideConstructor_defaultParameters() async {
     Source source = addSource(r'''
 class A {
   int x;
   A([this.x]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldInitializerRedirectingConstructor_super() {
+  test_fieldInitializerRedirectingConstructor_super() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -1952,143 +1949,143 @@
   int x;
   B(this.x) : super();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_finalInitializedInDeclarationAndConstructor_initializer() {
+  test_finalInitializedInDeclarationAndConstructor_initializer() async {
     Source source = addSource(r'''
 class A {
   final x;
   A() : x = 1 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_finalInitializedInDeclarationAndConstructor_initializingFormal() {
+  test_finalInitializedInDeclarationAndConstructor_initializingFormal() async {
     Source source = addSource(r'''
 class A {
   final x;
   A(this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_finalNotInitialized_atDeclaration() {
+  test_finalNotInitialized_atDeclaration() async {
     Source source = addSource(r'''
 class A {
   final int x = 0;
   A() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_finalNotInitialized_fieldFormal() {
+  test_finalNotInitialized_fieldFormal() async {
     Source source = addSource(r'''
 class A {
   final int x = 0;
   A() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_finalNotInitialized_functionTypedFieldFormal() {
+  test_finalNotInitialized_functionTypedFieldFormal() async {
     Source source = addSource(r'''
 class A {
   final Function x;
   A(int this.x(int p)) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_finalNotInitialized_hasNativeClause_hasConstructor() {
+  test_finalNotInitialized_hasNativeClause_hasConstructor() async {
     Source source = addSource(r'''
 class A native 'something' {
   final int x;
   A() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_hasNativeClause_noConstructor() {
+  test_finalNotInitialized_hasNativeClause_noConstructor() async {
     Source source = addSource(r'''
 class A native 'something' {
   final int x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_initializer() {
+  test_finalNotInitialized_initializer() async {
     Source source = addSource(r'''
 class A {
   final int x;
   A() : x = 0 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_finalNotInitialized_redirectingConstructor() {
+  test_finalNotInitialized_redirectingConstructor() async {
     Source source = addSource(r'''
 class A {
   final int x;
   A(this.x);
   A.named() : this (42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionDeclaration_scope_returnType() {
+  test_functionDeclaration_scope_returnType() async {
     Source source = addSource("int f(int) { return 0; }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionDeclaration_scope_signature() {
+  test_functionDeclaration_scope_signature() async {
     Source source = addSource(r'''
 const app = 0;
 f(@app int app) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionTypeAlias_scope_returnType() {
+  test_functionTypeAlias_scope_returnType() async {
     Source source = addSource("typedef int f(int);");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionTypeAlias_scope_signature() {
+  test_functionTypeAlias_scope_signature() async {
     Source source = addSource(r'''
 const app = 0;
 typedef int f(@app int app);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionWithoutCall() {
+  test_functionWithoutCall() async {
     Source source = addSource(r'''
 abstract class A implements Function {
 }
@@ -2100,31 +2097,31 @@
 }
 class D extends C {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionWithoutCall_doesNotImplementFunction() {
+  test_functionWithoutCall_doesNotImplementFunction() async {
     Source source = addSource("class A {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionWithoutCall_staticCallMethod() {
+  test_functionWithoutCall_staticCallMethod() async {
     Source source = addSource(r'''
 class A { }
 class B extends A {
   static call() { }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionWithoutCall_withNoSuchMethod() {
+  test_functionWithoutCall_withNoSuchMethod() async {
     // 16078
     Source source = addSource(r'''
 class A implements Function {
@@ -2132,36 +2129,36 @@
     return 42;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionWithoutCall_withNoSuchMethod_mixin() {
+  test_functionWithoutCall_withNoSuchMethod_mixin() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(inv) {}
 }
 class B extends Object with A implements Function {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionWithoutCall_withNoSuchMethod_superclass() {
+  test_functionWithoutCall_withNoSuchMethod_superclass() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(inv) {}
 }
 class B extends A implements Function {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitConstructorDependencies() {
+  test_implicitConstructorDependencies() async {
     // No warning should be generated for the code below; this requires that
     // implicit constructors are generated for C1 before C2, even though C1
     // follows C2 in the file.  See dartbug.com/21600.
@@ -2179,12 +2176,12 @@
   new C2(5);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_constructorName() {
+  test_implicitThisReferenceInInitializer_constructorName() async {
     Source source = addSource(r'''
 class A {
   A.named() {}
@@ -2193,23 +2190,23 @@
   var v;
   B() : v = new A.named();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_importPrefix() {
+  test_implicitThisReferenceInInitializer_importPrefix() async {
     Source source = addSource(r'''
 import 'dart:async' as abstract;
 class A {
   var v = new abstract.Completer();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_prefixedIdentifier() {
+  test_implicitThisReferenceInInitializer_prefixedIdentifier() async {
     Source source = addSource(r'''
 class A {
   var f;
@@ -2218,12 +2215,12 @@
   var v;
   B(A a) : v = a.f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_qualifiedMethodInvocation() {
+  test_implicitThisReferenceInInitializer_qualifiedMethodInvocation() async {
     Source source = addSource(r'''
 class A {
   f() {}
@@ -2232,12 +2229,12 @@
   var v;
   B() : v = new A().f();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_qualifiedPropertyAccess() {
+  test_implicitThisReferenceInInitializer_qualifiedPropertyAccess() async {
     Source source = addSource(r'''
 class A {
   var f;
@@ -2246,101 +2243,101 @@
   var v;
   B() : v = new A().f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_staticField_thisClass() {
+  test_implicitThisReferenceInInitializer_staticField_thisClass() async {
     Source source = addSource(r'''
 class A {
   var v;
   A() : v = f;
   static var f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_staticGetter() {
+  test_implicitThisReferenceInInitializer_staticGetter() async {
     Source source = addSource(r'''
 class A {
   var v;
   A() : v = f;
   static get f => 42;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_staticMethod() {
+  test_implicitThisReferenceInInitializer_staticMethod() async {
     Source source = addSource(r'''
 class A {
   var v;
   A() : v = f();
   static f() => 42;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_topLevelField() {
+  test_implicitThisReferenceInInitializer_topLevelField() async {
     Source source = addSource(r'''
 class A {
   var v;
   A() : v = f;
 }
 var f = 42;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_topLevelFunction() {
+  test_implicitThisReferenceInInitializer_topLevelFunction() async {
     Source source = addSource(r'''
 class A {
   var v;
   A() : v = f();
 }
 f() => 42;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_topLevelGetter() {
+  test_implicitThisReferenceInInitializer_topLevelGetter() async {
     Source source = addSource(r'''
 class A {
   var v;
   A() : v = f;
 }
 get f => 42;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_implicitThisReferenceInInitializer_typeParameter() {
+  test_implicitThisReferenceInInitializer_typeParameter() async {
     Source source = addSource(r'''
 class A<T> {
   var v;
   A(p) : v = (p is T);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_importDuplicatedLibraryName() {
+  test_importDuplicatedLibraryName() async {
     Source source = addSource(r'''
 library test;
 import 'lib.dart';
 import 'lib.dart';''');
     addNamedSource("/lib.dart", "library lib;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       HintCode.UNUSED_IMPORT,
       HintCode.UNUSED_IMPORT,
@@ -2349,14 +2346,14 @@
     verify([source]);
   }
 
-  void test_importDuplicatedLibraryUnnamed() {
+  test_importDuplicatedLibraryUnnamed() async {
     Source source = addSource(r'''
 library test;
 import 'lib1.dart';
 import 'lib2.dart';''');
     addNamedSource("/lib1.dart", "");
     addNamedSource("/lib2.dart", "");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       // No warning on duplicate import (https://github.com/dart-lang/sdk/issues/24156)
       HintCode.UNUSED_IMPORT,
@@ -2365,7 +2362,7 @@
     verify([source]);
   }
 
-  void test_importOfNonLibrary_libraryDeclared() {
+  test_importOfNonLibrary_libraryDeclared() async {
     Source source = addSource(r'''
 library lib;
 import 'part.dart';
@@ -2375,23 +2372,23 @@
         r'''
 library lib1;
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_importOfNonLibrary_libraryNotDeclared() {
+  test_importOfNonLibrary_libraryNotDeclared() async {
     Source source = addSource(r'''
 library lib;
 import 'part.dart';
 A a;''');
     addNamedSource("/part.dart", "class A {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_importPrefixes_withFirstLetterDifference() {
+  test_importPrefixes_withFirstLetterDifference() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' as math;
@@ -2410,12 +2407,12 @@
         r'''
 library lib2;
 test2() {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentCaseExpressionTypes() {
+  test_inconsistentCaseExpressionTypes() async {
     Source source = addSource(r'''
 f(var p) {
   switch (p) {
@@ -2425,12 +2422,12 @@
       break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentMethodInheritance_accessors_typeParameter2() {
+  test_inconsistentMethodInheritance_accessors_typeParameter2() async {
     Source source = addSource(r'''
 abstract class A<E> {
   E get x {return null;}
@@ -2439,12 +2436,12 @@
   E get x {return null;}
 }
 class C<E> extends A<E> implements B<E> {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentMethodInheritance_accessors_typeParameters1() {
+  test_inconsistentMethodInheritance_accessors_typeParameters1() async {
     Source source = addSource(r'''
 abstract class A<E> {
   E get x;
@@ -2455,12 +2452,12 @@
 class C<E> implements A<E>, B<E> {
   E get x => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentMethodInheritance_accessors_typeParameters_diamond() {
+  test_inconsistentMethodInheritance_accessors_typeParameters_diamond() async {
     Source source = addSource(r'''
 abstract class F<E> extends B<E> {}
 class D<E> extends F<E> {
@@ -2474,12 +2471,12 @@
 }
 class A<E> extends B<E> implements D<E> {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentMethodInheritance_methods_typeParameter2() {
+  test_inconsistentMethodInheritance_methods_typeParameter2() async {
     Source source = addSource(r'''
 class A<E> {
   x(E e) {}
@@ -2490,12 +2487,12 @@
 class C<E> extends A<E> implements B<E> {
   x(E e) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentMethodInheritance_methods_typeParameters1() {
+  test_inconsistentMethodInheritance_methods_typeParameters1() async {
     Source source = addSource(r'''
 class A<E> {
   x(E e) {}
@@ -2506,12 +2503,12 @@
 class C<E> implements A<E>, B<E> {
   x(E e) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentMethodInheritance_overrideTrumpsInherits_getter() {
+  test_inconsistentMethodInheritance_overrideTrumpsInherits_getter() async {
     // 16134
     Source source = addSource(r'''
 class B<S> {
@@ -2523,12 +2520,12 @@
 class C extends B<double> implements I<int> {
   num get g => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentMethodInheritance_overrideTrumpsInherits_method() {
+  test_inconsistentMethodInheritance_overrideTrumpsInherits_method() async {
     // 16134
     Source source = addSource(r'''
 class B<S> {
@@ -2540,12 +2537,12 @@
 class C extends B<double> implements I<int> {
   m(num n) => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentMethodInheritance_overrideTrumpsInherits_setter() {
+  test_inconsistentMethodInheritance_overrideTrumpsInherits_setter() async {
     // 16134
     Source source = addSource(r'''
 class B<S> {
@@ -2557,12 +2554,12 @@
 class C extends B<double> implements I<int> {
   set t(num n) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inconsistentMethodInheritance_simple() {
+  test_inconsistentMethodInheritance_simple() async {
     Source source = addSource(r'''
 abstract class A {
   x();
@@ -2573,23 +2570,23 @@
 class C implements A, B {
   x() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_initializingFormalForNonExistentField() {
+  test_initializingFormalForNonExistentField() async {
     Source source = addSource(r'''
 class A {
   int x;
   A(this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_instance_creation_inside_annotation() {
+  test_instance_creation_inside_annotation() async {
     Source source = addSource('''
 class C {
   const C();
@@ -2601,12 +2598,12 @@
 @D(const C())
 f() {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_instanceAccessToStaticMember_fromComment() {
+  test_instanceAccessToStaticMember_fromComment() async {
     Source source = addSource(r'''
 class A {
   static m() {}
@@ -2614,23 +2611,23 @@
 /// [A.m]
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_instanceAccessToStaticMember_topLevel() {
+  test_instanceAccessToStaticMember_topLevel() async {
     Source source = addSource(r'''
 m() {}
 main() {
   m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_instanceMemberAccessFromStatic_fromComment() {
+  test_instanceMemberAccessFromStatic_fromComment() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -2638,12 +2635,12 @@
   static foo() {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_field() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_field() async {
     Source source = addSource(r'''
 import 'lib.dart';
 class B extends A {
@@ -2656,12 +2653,12 @@
 class A {
   static var _m;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_method() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_method() async {
     Source source = addSource(r'''
 import 'lib.dart';
 class B extends A {
@@ -2674,23 +2671,23 @@
 class A {
   static _m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAnnotation_constantVariable_field() {
+  test_invalidAnnotation_constantVariable_field() async {
     Source source = addSource(r'''
 @A.C
 class A {
   static const C = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAnnotation_constantVariable_field_importWithPrefix() {
+  test_invalidAnnotation_constantVariable_field_importWithPrefix() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -2703,23 +2700,23 @@
 @p.A.C
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAnnotation_constantVariable_topLevel() {
+  test_invalidAnnotation_constantVariable_topLevel() async {
     Source source = addSource(r'''
 const C = 0;
 @C
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAnnotation_constantVariable_topLevel_importWithPrefix() {
+  test_invalidAnnotation_constantVariable_topLevel_importWithPrefix() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -2730,12 +2727,12 @@
 @p.C
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAnnotation_constConstructor_importWithPrefix() {
+  test_invalidAnnotation_constConstructor_importWithPrefix() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -2748,12 +2745,12 @@
 @p.A(42)
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAnnotation_constConstructor_named_importWithPrefix() {
+  test_invalidAnnotation_constConstructor_named_importWithPrefix() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -2766,24 +2763,24 @@
 @p.A.named(42)
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment() {
+  test_invalidAssignment() async {
     Source source = addSource(r'''
 f() {
   var x;
   var y;
   x = y;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_compoundAssignment() {
+  test_invalidAssignment_compoundAssignment() async {
     Source source = addSource(r'''
 class byte {
   int _value;
@@ -2795,54 +2792,54 @@
   byte b = new byte(52);
   b += 3;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_defaultValue_named() {
+  test_invalidAssignment_defaultValue_named() async {
     Source source = addSource(r'''
 f({String x: '0'}) {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_defaultValue_optional() {
+  test_invalidAssignment_defaultValue_optional() async {
     Source source = addSource(r'''
 f([String x = '0']) {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_ifNullAssignment_compatibleType() {
+  test_invalidAssignment_ifNullAssignment_compatibleType() async {
     Source source = addSource('''
 void f(int i) {
   num n;
   n ??= i;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_ifNullAssignment_sameType() {
+  test_invalidAssignment_ifNullAssignment_sameType() async {
     Source source = addSource('''
 void f(int i) {
   int j;
   j ??= i;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_implicitlyImplementFunctionViaCall_1() {
+  test_invalidAssignment_implicitlyImplementFunctionViaCall_1() async {
     // 18341
     //
     // This test and
@@ -2858,12 +2855,12 @@
 }
 typedef int IntToInt(int x);
 IntToInt f = new I();''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_implicitlyImplementFunctionViaCall_2() {
+  test_invalidAssignment_implicitlyImplementFunctionViaCall_2() async {
     // 18341
     //
     // Here 'C' checks as a subtype of 'I', but 'C' does not
@@ -2879,12 +2876,12 @@
 }
 typedef int IntToInt(int x);
 IntToInt f = new C();''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_implicitlyImplementFunctionViaCall_3() {
+  test_invalidAssignment_implicitlyImplementFunctionViaCall_3() async {
     // 18341
     //
     // Like 'test_invalidAssignment_implicitlyImplementFunctionViaCall_2()',
@@ -2898,12 +2895,12 @@
 }
 typedef int IntToInt(int x);
 Function f = new C();''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_implicitlyImplementFunctionViaCall_4() {
+  test_invalidAssignment_implicitlyImplementFunctionViaCall_4() async {
     // 18341
     //
     // Like 'test_invalidAssignment_implicitlyImplementFunctionViaCall_2()',
@@ -2924,33 +2921,33 @@
 }
 typedef int VoidToInt();
 VoidToInt f = new C();''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidAssignment_toDynamic() {
+  test_invalidAssignment_toDynamic() async {
     Source source = addSource(r'''
 f() {
   var g;
   g = () => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidFactoryNameNotAClass() {
+  test_invalidFactoryNameNotAClass() async {
     Source source = addSource(r'''
 class A {
   factory A() => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidIdentifierInAsync() {
+  test_invalidIdentifierInAsync() async {
     Source source = addSource(r'''
 class A {
   m() {
@@ -2959,12 +2956,12 @@
     int yield;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideNamedParamType() {
+  test_invalidMethodOverrideNamedParamType() async {
     Source source = addSource(r'''
 class A {
   m({int a}) {}
@@ -2972,12 +2969,12 @@
 class B implements A {
   m({int a, int b}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideDifferentDefaultValues_named() {
+  test_invalidOverrideDifferentDefaultValues_named() async {
     Source source = addSource(r'''
 class A {
   m({int p : 0}) {}
@@ -2985,12 +2982,12 @@
 class B extends A {
   m({int p : 0}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideDifferentDefaultValues_named_function() {
+  test_invalidOverrideDifferentDefaultValues_named_function() async {
     Source source = addSource(r'''
 nothing() => 'nothing';
 class A {
@@ -2999,12 +2996,12 @@
 class B extends A {
   thing(String a, {orElse : nothing}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideDifferentDefaultValues_positional() {
+  test_invalidOverrideDifferentDefaultValues_positional() async {
     Source source = addSource(r'''
 class A {
   m([int p = 0]) {}
@@ -3012,12 +3009,12 @@
 class B extends A {
   m([int p = 0]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideDifferentDefaultValues_positional_changedOrder() {
+  test_invalidOverrideDifferentDefaultValues_positional_changedOrder() async {
     Source source = addSource(r'''
 class A {
   m([int a = 0, String b = '0']) {}
@@ -3025,12 +3022,12 @@
 class B extends A {
   m([int b = 0, String a = '0']) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideDifferentDefaultValues_positional_function() {
+  test_invalidOverrideDifferentDefaultValues_positional_function() async {
     Source source = addSource(r'''
 nothing() => 'nothing';
 class A {
@@ -3039,12 +3036,12 @@
 class B extends A {
   thing(String a, [orElse = nothing]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideNamed_unorderedNamedParameter() {
+  test_invalidOverrideNamed_unorderedNamedParameter() async {
     Source source = addSource(r'''
 class A {
   m({a, b}) {}
@@ -3052,12 +3049,12 @@
 class B extends A {
   m({b, a}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideRequired_less() {
+  test_invalidOverrideRequired_less() async {
     Source source = addSource(r'''
 class A {
   m(a, b) {}
@@ -3065,12 +3062,12 @@
 class B extends A {
   m(a, [b]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideRequired_same() {
+  test_invalidOverrideRequired_same() async {
     Source source = addSource(r'''
 class A {
   m(a) {}
@@ -3078,12 +3075,12 @@
 class B extends A {
   m(a) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideReturnType_returnType_interface() {
+  test_invalidOverrideReturnType_returnType_interface() async {
     Source source = addNamedSource(
         "/test.dart",
         r'''
@@ -3093,12 +3090,12 @@
 class B implements A {
   int m() { return 1; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideReturnType_returnType_interface2() {
+  test_invalidOverrideReturnType_returnType_interface2() async {
     Source source = addNamedSource(
         "/test.dart",
         r'''
@@ -3110,12 +3107,12 @@
 class C implements B {
   int m() { return 1; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideReturnType_returnType_mixin() {
+  test_invalidOverrideReturnType_returnType_mixin() async {
     Source source = addNamedSource(
         "/test.dart",
         r'''
@@ -3125,12 +3122,12 @@
 class B extends Object with A {
   int m() { return 1; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideReturnType_returnType_parameterizedTypes() {
+  test_invalidOverrideReturnType_returnType_parameterizedTypes() async {
     Source source = addSource(r'''
 abstract class A<E> {
   List<E> m();
@@ -3138,12 +3135,12 @@
 class B extends A<dynamic> {
   List<dynamic> m() { return new List<dynamic>(); }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideReturnType_returnType_sameType() {
+  test_invalidOverrideReturnType_returnType_sameType() async {
     Source source = addNamedSource(
         "/test.dart",
         r'''
@@ -3153,12 +3150,12 @@
 class B extends A {
   int m() { return 1; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideReturnType_returnType_superclass() {
+  test_invalidOverrideReturnType_returnType_superclass() async {
     Source source = addNamedSource(
         "/test.dart",
         r'''
@@ -3168,12 +3165,12 @@
 class B extends A {
   int m() { return 1; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideReturnType_returnType_superclass2() {
+  test_invalidOverrideReturnType_returnType_superclass2() async {
     Source source = addNamedSource(
         "/test.dart",
         r'''
@@ -3185,12 +3182,12 @@
 class C extends B {
   int m() { return 1; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideReturnType_returnType_void() {
+  test_invalidOverrideReturnType_returnType_void() async {
     Source source = addSource(r'''
 class A {
   void m() {}
@@ -3198,72 +3195,72 @@
 class B extends A {
   int m() { return 0; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_constructor() {
+  test_invalidReferenceToThis_constructor() async {
     Source source = addSource(r'''
 class A {
   A() {
     var v = this;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidReferenceToThis_instanceMethod() {
+  test_invalidReferenceToThis_instanceMethod() async {
     Source source = addSource(r'''
 class A {
   m() {
     var v = this;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidTypeArgumentForKey() {
+  test_invalidTypeArgumentForKey() async {
     Source source = addSource(r'''
 class A {
   m() {
     return const <int, int>{};
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidTypeArgumentInConstList() {
+  test_invalidTypeArgumentInConstList() async {
     Source source = addSource(r'''
 class A<E> {
   m() {
     return <E>[];
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidTypeArgumentInConstMap() {
+  test_invalidTypeArgumentInConstMap() async {
     Source source = addSource(r'''
 class A<E> {
   m() {
     return <String, E>{};
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invocationOfNonFunction_dynamic() {
+  test_invocationOfNonFunction_dynamic() async {
     Source source = addSource(r'''
 class A {
   var f;
@@ -3273,12 +3270,12 @@
     f();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invocationOfNonFunction_functionTypeTypeParameter() {
+  test_invocationOfNonFunction_functionTypeTypeParameter() async {
     Source source = addSource(r'''
 typedef void Action<T>(T x);
 class C<T, U extends Action<T>> {
@@ -3290,12 +3287,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invocationOfNonFunction_getter() {
+  test_invocationOfNonFunction_getter() async {
     Source source = addSource(r'''
 class A {
   var g;
@@ -3304,35 +3301,35 @@
   A a;
   a.g();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invocationOfNonFunction_localVariable() {
+  test_invocationOfNonFunction_localVariable() async {
     Source source = addSource(r'''
 f() {
   var g;
   g();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invocationOfNonFunction_localVariable_dynamic() {
+  test_invocationOfNonFunction_localVariable_dynamic() async {
     Source source = addSource(r'''
 f() {}
 main() {
   var v = f;
   v();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invocationOfNonFunction_localVariable_dynamic2() {
+  test_invocationOfNonFunction_localVariable_dynamic2() async {
     Source source = addSource(r'''
 f() {}
 main() {
@@ -3340,23 +3337,23 @@
   v = 1;
   v();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invocationOfNonFunction_Object() {
+  test_invocationOfNonFunction_Object() async {
     Source source = addSource(r'''
 main() {
   Object v = null;
   v();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invocationOfNonFunction_proxyOnFunctionClass() {
+  test_invocationOfNonFunction_proxyOnFunctionClass() async {
     // 16078
     Source source = addSource(r'''
 @proxy
@@ -3369,38 +3366,38 @@
   Functor f = new Functor();
   f();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_issue_24191() {
+  test_issue_24191() async {
     Source source = addSource('''
 import 'dart:async';
 
-class S extends Stream {}
+abstract class S extends Stream {}
 f(S s) async {
   await for (var v in s) {
     print(v);
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_listElementTypeNotAssignable() {
+  test_listElementTypeNotAssignable() async {
     Source source = addSource(r'''
 var v1 = <int> [42];
 var v2 = const <int> [42];''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_loadLibraryDefined() {
-    resolveWithErrors(<String>[
+  test_loadLibraryDefined() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 foo() => 22;''',
@@ -3412,117 +3409,117 @@
     ], <ErrorCode>[]);
   }
 
-  void test_local_generator_async() {
+  test_local_generator_async() async {
     Source source = addSource('''
 f() {
   return () async* { yield 0; };
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_local_generator_sync() {
+  test_local_generator_sync() async {
     Source source = addSource('''
 f() {
   return () sync* { yield 0; };
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mapKeyTypeNotAssignable() {
+  test_mapKeyTypeNotAssignable() async {
     Source source = addSource("var v = <String, int > {'a' : 1};");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_memberWithClassName_setter() {
+  test_memberWithClassName_setter() async {
     Source source = addSource(r'''
 class A {
   set A(v) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_methodDeclaration_scope_signature() {
+  test_methodDeclaration_scope_signature() async {
     Source source = addSource(r'''
 const app = 0;
 class A {
   foo(@app int app) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_misMatchedGetterAndSetterTypes_instance_sameTypes() {
+  test_misMatchedGetterAndSetterTypes_instance_sameTypes() async {
     Source source = addSource(r'''
 class C {
   int get x => 0;
   set x(int v) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_misMatchedGetterAndSetterTypes_instance_unspecifiedGetter() {
+  test_misMatchedGetterAndSetterTypes_instance_unspecifiedGetter() async {
     Source source = addSource(r'''
 class C {
   get x => 0;
   set x(String v) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_misMatchedGetterAndSetterTypes_instance_unspecifiedSetter() {
+  test_misMatchedGetterAndSetterTypes_instance_unspecifiedSetter() async {
     Source source = addSource(r'''
 class C {
   int get x => 0;
   set x(v) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_misMatchedGetterAndSetterTypes_topLevel_sameTypes() {
+  test_misMatchedGetterAndSetterTypes_topLevel_sameTypes() async {
     Source source = addSource(r'''
 int get x => 0;
 set x(int v) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedGetter() {
+  test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedGetter() async {
     Source source = addSource(r'''
 get x => 0;
 set x(String v) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter() {
+  test_misMatchedGetterAndSetterTypes_topLevel_unspecifiedSetter() async {
     Source source = addSource(r'''
 int get x => 0;
 set x(v) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_missingEnumConstantInSwitch_all() {
+  test_missingEnumConstantInSwitch_all() async {
     Source source = addSource(r'''
 enum E { A, B, C }
 
@@ -3533,12 +3530,12 @@
     case E.C: break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_missingEnumConstantInSwitch_default() {
+  test_missingEnumConstantInSwitch_default() async {
     Source source = addSource(r'''
 enum E { A, B, C }
 
@@ -3548,12 +3545,12 @@
     default: break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixedReturnTypes_differentScopes() {
+  test_mixedReturnTypes_differentScopes() async {
     Source source = addSource(r'''
 class C {
   m(int x) {
@@ -3564,23 +3561,23 @@
     return 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixedReturnTypes_ignoreImplicit() {
+  test_mixedReturnTypes_ignoreImplicit() async {
     Source source = addSource(r'''
 f(bool p) {
   if (p) return 42;
   // implicit 'return;' is ignored
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixedReturnTypes_ignoreImplicit2() {
+  test_mixedReturnTypes_ignoreImplicit2() async {
     Source source = addSource(r'''
 f(bool p) {
   if (p) {
@@ -3590,12 +3587,12 @@
   }
   // implicit 'return;' is ignored
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixedReturnTypes_sameKind() {
+  test_mixedReturnTypes_sameKind() async {
     Source source = addSource(r'''
 class C {
   m(int x) {
@@ -3605,163 +3602,163 @@
     return 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixinDeclaresConstructor() {
+  test_mixinDeclaresConstructor() async {
     Source source = addSource(r'''
 class A {
   m() {}
 }
 class B extends Object with A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixinDeclaresConstructor_factory() {
+  test_mixinDeclaresConstructor_factory() async {
     Source source = addSource(r'''
 class A {
   factory A() => null;
 }
 class B extends Object with A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_classDeclaration_extends() {
+  test_mixinInheritsFromNotObject_classDeclaration_extends() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableSuperMixins = true;
-    resetWithOptions(options);
+    resetWith(options: options);
     Source source = addSource(r'''
 class A {}
 class B extends A {}
 class C extends Object with B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_classDeclaration_mixTypeAlias() {
+  test_mixinInheritsFromNotObject_classDeclaration_mixTypeAlias() async {
     Source source = addSource(r'''
 class A {}
 class B = Object with A;
 class C extends Object with B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_classDeclaration_with() {
+  test_mixinInheritsFromNotObject_classDeclaration_with() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableSuperMixins = true;
-    resetWithOptions(options);
+    resetWith(options: options);
     Source source = addSource(r'''
 class A {}
 class B extends Object with A {}
 class C extends Object with B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_typeAlias_extends() {
+  test_mixinInheritsFromNotObject_typeAlias_extends() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableSuperMixins = true;
-    resetWithOptions(options);
+    resetWith(options: options);
     Source source = addSource(r'''
 class A {}
 class B extends A {}
 class C = Object with B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_typeAlias_with() {
+  test_mixinInheritsFromNotObject_typeAlias_with() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableSuperMixins = true;
-    resetWithOptions(options);
+    resetWith(options: options);
     Source source = addSource(r'''
 class A {}
 class B extends Object with A {}
 class C = Object with B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixinInheritsFromNotObject_typedef_mixTypeAlias() {
+  test_mixinInheritsFromNotObject_typedef_mixTypeAlias() async {
     Source source = addSource(r'''
 class A {}
 class B = Object with A;
 class C = Object with B;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_mixinReferencesSuper() {
+  test_mixinReferencesSuper() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableSuperMixins = true;
-    resetWithOptions(options);
+    resetWith(options: options);
     Source source = addSource(r'''
 class A {
   toString() => super.toString();
 }
 class B extends Object with A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_multipleSuperInitializers_no() {
+  test_multipleSuperInitializers_no() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
   B() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_multipleSuperInitializers_single() {
+  test_multipleSuperInitializers_single() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
   B() : super() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nativeConstConstructor() {
+  test_nativeConstConstructor() async {
     Source source = addSource(r'''
 import 'dart-ext:x';
 class Foo {
   const Foo() native 'Foo_Foo';
   const factory Foo.foo() native 'Foo_Foo_foo';
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     // Cannot verify the AST because the import's URI cannot be resolved.
   }
 
-  void test_nativeFunctionBodyInNonSDKCode_function() {
+  test_nativeFunctionBodyInNonSDKCode_function() async {
     Source source = addSource(r'''
 import 'dart-ext:x';
 int m(a) native 'string';''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     // Cannot verify the AST because the import's URI cannot be resolved.
   }
 
-  void test_newWithAbstractClass_factory() {
+  test_newWithAbstractClass_factory() async {
     Source source = addSource(r'''
 abstract class A {
   factory A() { return new B(); }
@@ -3772,12 +3769,12 @@
 A f() {
   return new A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_newWithUndefinedConstructor() {
+  test_newWithUndefinedConstructor() async {
     Source source = addSource(r'''
 class A {
   A.name() {}
@@ -3785,12 +3782,12 @@
 f() {
   new A.name();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_newWithUndefinedConstructorDefault() {
+  test_newWithUndefinedConstructorDefault() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -3798,13 +3795,12 @@
 f() {
   new A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_abstractsDontOverrideConcretes_getter() {
+  test_nonAbstractClassInheritsAbstractMemberOne_abstractsDontOverrideConcretes_getter() async {
     Source source = addSource(r'''
 class A {
   int get g => 0;
@@ -3813,13 +3809,12 @@
   int get g;
 }
 class C extends B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_abstractsDontOverrideConcretes_method() {
+  test_nonAbstractClassInheritsAbstractMemberOne_abstractsDontOverrideConcretes_method() async {
     Source source = addSource(r'''
 class A {
   m(p) {}
@@ -3828,13 +3823,12 @@
   m(p);
 }
 class C extends B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_abstractsDontOverrideConcretes_setter() {
+  test_nonAbstractClassInheritsAbstractMemberOne_abstractsDontOverrideConcretes_setter() async {
     Source source = addSource(r'''
 class A {
   set s(v) {}
@@ -3843,13 +3837,12 @@
   set s(v);
 }
 class C extends B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_interface() {
+  test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_interface() async {
     // 15979
     Source source = addSource(r'''
 abstract class M {}
@@ -3858,12 +3851,12 @@
   m();
 }
 abstract class B = A with M implements I;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_mixin() {
+  test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_mixin() async {
     // 15979
     Source source = addSource(r'''
 abstract class M {
@@ -3871,13 +3864,12 @@
 }
 abstract class A {}
 abstract class B = A with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_superclass() {
+  test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_superclass() async {
     // 15979
     Source source = addSource(r'''
 class M {}
@@ -3885,12 +3877,12 @@
   m();
 }
 abstract class B = A with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_mixin_getter() {
+  test_nonAbstractClassInheritsAbstractMemberOne_mixin_getter() async {
     // 17034
     Source source = addSource(r'''
 class A {
@@ -3901,12 +3893,12 @@
 }
 class B extends A with M {}
 class C extends B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_mixin_method() {
+  test_nonAbstractClassInheritsAbstractMemberOne_mixin_method() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -3916,12 +3908,12 @@
 }
 class B extends A with M {}
 class C extends B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_mixin_setter() {
+  test_nonAbstractClassInheritsAbstractMemberOne_mixin_setter() async {
     Source source = addSource(r'''
 class A {
   var a;
@@ -3931,12 +3923,12 @@
 }
 class B extends A with M {}
 class C extends B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_accessor() {
+  test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_accessor() async {
     Source source = addSource(r'''
 abstract class A {
   int get g;
@@ -3944,12 +3936,12 @@
 class B extends A {
   noSuchMethod(v) => '';
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_method() {
+  test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_method() async {
     Source source = addSource(r'''
 abstract class A {
   m(p);
@@ -3957,12 +3949,12 @@
 class B extends A {
   noSuchMethod(v) => '';
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_mixin() {
+  test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_mixin() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(v) => '';
@@ -3970,13 +3962,12 @@
 class B extends Object with A {
   m(p);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_superclass() {
+  test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_superclass() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(v) => '';
@@ -3984,46 +3975,45 @@
 class B extends A {
   m(p);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_overridesMethodInObject() {
+  test_nonAbstractClassInheritsAbstractMemberOne_overridesMethodInObject() async {
     Source source = addSource(r'''
 class A {
   String toString([String prefix = '']) => '${prefix}Hello';
 }
 class C {}
 class B extends A with C {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonBoolExpression_functionType() {
+  test_nonBoolExpression_functionType() async {
     Source source = addSource(r'''
 bool makeAssertion() => true;
 f() {
   assert(makeAssertion);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonBoolExpression_interfaceType() {
+  test_nonBoolExpression_interfaceType() async {
     Source source = addSource(r'''
 f() {
   assert(true);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonBoolNegationExpression() {
+  test_nonBoolNegationExpression() async {
     Source source = addSource(r'''
 f(bool pb, pd) {
   !true;
@@ -4031,12 +4021,12 @@
   !pb;
   !pd;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonBoolNegationExpression_dynamic() {
+  test_nonBoolNegationExpression_dynamic() async {
     Source source = addSource(r'''
 f1(bool dynamic) {
   !dynamic;
@@ -4046,115 +4036,115 @@
   !dynamic;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonBoolOperand_and_bool() {
+  test_nonBoolOperand_and_bool() async {
     Source source = addSource(r'''
 bool f(bool left, bool right) {
   return left && right;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonBoolOperand_and_dynamic() {
+  test_nonBoolOperand_and_dynamic() async {
     Source source = addSource(r'''
 bool f(left, dynamic right) {
   return left && right;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonBoolOperand_or_bool() {
+  test_nonBoolOperand_or_bool() async {
     Source source = addSource(r'''
 bool f(bool left, bool right) {
   return left || right;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonBoolOperand_or_dynamic() {
+  test_nonBoolOperand_or_dynamic() async {
     Source source = addSource(r'''
 bool f(dynamic left, right) {
   return left || right;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_constField() {
+  test_nonConstantDefaultValue_constField() async {
     Source source = addSource(r'''
 f([a = double.INFINITY]) {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_function_named() {
+  test_nonConstantDefaultValue_function_named() async {
     Source source = addSource("f({x : 2 + 3}) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_function_positional() {
+  test_nonConstantDefaultValue_function_positional() async {
     Source source = addSource("f([x = 2 + 3]) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_inConstructor_named() {
+  test_nonConstantDefaultValue_inConstructor_named() async {
     Source source = addSource(r'''
 class A {
   A({x : 2 + 3}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_inConstructor_positional() {
+  test_nonConstantDefaultValue_inConstructor_positional() async {
     Source source = addSource(r'''
 class A {
   A([x = 2 + 3]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_method_named() {
+  test_nonConstantDefaultValue_method_named() async {
     Source source = addSource(r'''
 class A {
   m({x : 2 + 3}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_method_positional() {
+  test_nonConstantDefaultValue_method_positional() async {
     Source source = addSource(r'''
 class A {
   m([x = 2 + 3]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstantDefaultValue_typedConstList() {
+  test_nonConstantDefaultValue_typedConstList() async {
     Source source = addSource(r'''
 class A {
   m([p111 = const <String>[]]) {}
@@ -4162,12 +4152,12 @@
 class B extends A {
   m([p222 = const <String>[]]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstantValueInInitializer_namedArgument() {
+  test_nonConstantValueInInitializer_namedArgument() async {
     Source source = addSource(r'''
 class A {
   final a;
@@ -4176,12 +4166,12 @@
 class B extends A {
   const B({b}) : super(a: b);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstCaseExpression_constField() {
+  test_nonConstCaseExpression_constField() async {
     Source source = addSource(r'''
 f(double p) {
   switch (p) {
@@ -4191,13 +4181,13 @@
       return false;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
     verify([source]);
   }
 
-  void test_nonConstCaseExpression_typeLiteral() {
+  test_nonConstCaseExpression_typeLiteral() async {
     Source source = addSource(r'''
 f(Type t) {
   switch (t) {
@@ -4208,73 +4198,73 @@
       return false;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstListElement_constField() {
+  test_nonConstListElement_constField() async {
     Source source = addSource(r'''
 main() {
   const [double.INFINITY];
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstMapAsExpressionStatement_const() {
+  test_nonConstMapAsExpressionStatement_const() async {
     Source source = addSource(r'''
 f() {
   const {'a' : 0, 'b' : 1};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstMapAsExpressionStatement_notExpressionStatement() {
+  test_nonConstMapAsExpressionStatement_notExpressionStatement() async {
     Source source = addSource(r'''
 f() {
   var m = {'a' : 0, 'b' : 1};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstMapAsExpressionStatement_typeArguments() {
+  test_nonConstMapAsExpressionStatement_typeArguments() async {
     Source source = addSource(r'''
 f() {
   <String, int> {'a' : 0, 'b' : 1};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstMapKey_constField() {
+  test_nonConstMapKey_constField() async {
     Source source = addSource(r'''
 main() {
   const {double.INFINITY: 0};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS]);
     verify([source]);
   }
 
-  void test_nonConstMapValue_constField() {
+  test_nonConstMapValue_constField() async {
     Source source = addSource(r'''
 main() {
   const {0: double.INFINITY};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_binary_bool() {
+  test_nonConstValueInInitializer_binary_bool() async {
     Source source = addSource(r'''
 class A {
   final v;
@@ -4283,12 +4273,12 @@
   const A.b1(bool p) : v = p || true;
   const A.b2(bool p) : v = true || p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.DEAD_CODE]);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_binary_dynamic() {
+  test_nonConstValueInInitializer_binary_dynamic() async {
     Source source = addSource(r'''
 class A {
   final v;
@@ -4313,12 +4303,12 @@
   const A.j1(p) : v = p % 5;
   const A.j2(p) : v = 5 % p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     // operations on "p" are not resolved
   }
 
-  void test_nonConstValueInInitializer_binary_int() {
+  test_nonConstValueInInitializer_binary_int() async {
     Source source = addSource(r'''
 class A {
   final v;
@@ -4333,12 +4323,12 @@
   const A.e1(int p) : v = p << 5;
   const A.e2(int p) : v = 5 << p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_binary_num() {
+  test_nonConstValueInInitializer_binary_num() async {
     Source source = addSource(r'''
 class A {
   final v;
@@ -4363,34 +4353,34 @@
   const A.j1(num p) : v = p % 5;
   const A.j2(num p) : v = 5 % p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_field() {
+  test_nonConstValueInInitializer_field() async {
     Source source = addSource(r'''
 class A {
   final int a;
   const A() : a = 5;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_redirecting() {
+  test_nonConstValueInInitializer_redirecting() async {
     Source source = addSource(r'''
 class A {
   const A.named(p);
   const A() : this.named(42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_super() {
+  test_nonConstValueInInitializer_super() async {
     Source source = addSource(r'''
 class A {
   const A(p);
@@ -4398,12 +4388,12 @@
 class B extends A {
   const B() : super(42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonConstValueInInitializer_unary() {
+  test_nonConstValueInInitializer_unary() async {
     Source source = addSource(r'''
 class A {
   final v;
@@ -4411,12 +4401,12 @@
   const A.b(int p) : v = ~p;
   const A.c(num p) : v = -p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonGenerativeConstructor() {
+  test_nonGenerativeConstructor() async {
     Source source = addSource(r'''
 class A {
   A.named() {}
@@ -4425,24 +4415,24 @@
 class B extends A {
   B() : super.named();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonTypeInCatchClause_isClass() {
+  test_nonTypeInCatchClause_isClass() async {
     Source source = addSource(r'''
 f() {
   try {
   } on String catch (e) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonTypeInCatchClause_isFunctionTypeAlias() {
+  test_nonTypeInCatchClause_isFunctionTypeAlias() async {
     Source source = addSource(r'''
 typedef F();
 f() {
@@ -4450,12 +4440,12 @@
   } on F catch (e) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonTypeInCatchClause_isTypeParameter() {
+  test_nonTypeInCatchClause_isTypeParameter() async {
     Source source = addSource(r'''
 class A<T> {
   f() {
@@ -4464,117 +4454,117 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonTypeInCatchClause_noType() {
+  test_nonTypeInCatchClause_noType() async {
     Source source = addSource(r'''
 f() {
   try {
   } catch (e) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonVoidReturnForOperator_no() {
+  test_nonVoidReturnForOperator_no() async {
     Source source = addSource(r'''
 class A {
   operator []=(a, b) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonVoidReturnForOperator_void() {
+  test_nonVoidReturnForOperator_void() async {
     Source source = addSource(r'''
 class A {
   void operator []=(a, b) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonVoidReturnForSetter_function_no() {
+  test_nonVoidReturnForSetter_function_no() async {
     Source source = addSource("set x(v) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonVoidReturnForSetter_function_void() {
+  test_nonVoidReturnForSetter_function_void() async {
     Source source = addSource("void set x(v) {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonVoidReturnForSetter_method_no() {
+  test_nonVoidReturnForSetter_method_no() async {
     Source source = addSource(r'''
 class A {
   set x(v) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nonVoidReturnForSetter_method_void() {
+  test_nonVoidReturnForSetter_method_void() async {
     Source source = addSource(r'''
 class A {
   void set x(v) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_null_callMethod() {
+  test_null_callMethod() async {
     Source source = addSource(r'''
 main() {
   null.m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_null_callOperator() {
+  test_null_callOperator() async {
     Source source = addSource(r'''
 main() {
   null + 5;
   null == 5;
   null[0];
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_optionalParameterInOperator_required() {
+  test_optionalParameterInOperator_required() async {
     Source source = addSource(r'''
 class A {
   operator +(p) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_parameterDefaultDoesNotReferToParameterName() {
+  test_parameterDefaultDoesNotReferToParameterName() async {
     // The final "f" should refer to the toplevel function "f", not to the
     // parameter called "f".  See dartbug.com/13179.
     Source source = addSource('void f([void f([x]) = f]) {}');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_parameterScope_local() {
+  test_parameterScope_local() async {
     // Parameter names shouldn't conflict with the name of the function they
     // are enclosed in.
     Source source = addSource(r'''
@@ -4585,12 +4575,12 @@
 }
 h(x) {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_parameterScope_method() {
+  test_parameterScope_method() async {
     // Parameter names shouldn't conflict with the name of the function they
     // are enclosed in.
     Source source = addSource(r'''
@@ -4601,12 +4591,12 @@
 }
 h(x) {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_parameterScope_toplevel() {
+  test_parameterScope_toplevel() async {
     // Parameter names shouldn't conflict with the name of the function they
     // are enclosed in.
     Source source = addSource(r'''
@@ -4615,12 +4605,12 @@
 }
 h(x) {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_prefixCollidesWithTopLevelMembers() {
+  test_prefixCollidesWithTopLevelMembers() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -4633,23 +4623,23 @@
 var p3;
 class p4 {}
 p.A a;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_propagateTypeArgs_intoBounds() {
+  test_propagateTypeArgs_intoBounds() async {
     Source source = addSource(r'''
 abstract class A<E> {}
 abstract class B<F> implements A<F>{}
 abstract class C<G, H extends A<G>> {}
 class D<I> extends C<I, B<I>> {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_propagateTypeArgs_intoSupertype() {
+  test_propagateTypeArgs_intoSupertype() async {
     Source source = addSource(r'''
 class A<T> {
   A(T p);
@@ -4659,12 +4649,12 @@
   B(S p) : super(p);
   B.named(S p) : super.named(p);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_proxy_annotation_prefixed() {
+  test_proxy_annotation_prefixed() async {
     Source source = addSource(r'''
 library L;
 @proxy
@@ -4677,11 +4667,11 @@
   a++;
   ++a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_prefixed2() {
+  test_proxy_annotation_prefixed2() async {
     Source source = addSource(r'''
 library L;
 @proxy
@@ -4696,11 +4686,11 @@
     ++a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_prefixed3() {
+  test_proxy_annotation_prefixed3() async {
     Source source = addSource(r'''
 library L;
 class B {
@@ -4715,11 +4705,11 @@
 }
 @proxy
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_proxyHasPrefixedIdentifier() {
+  test_proxy_annotation_proxyHasPrefixedIdentifier() async {
     Source source = addSource(r'''
 library L;
 import 'dart:core' as core;
@@ -4728,11 +4718,11 @@
   new PrefixProxy().foo;
   new PrefixProxy().foo();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_simple() {
+  test_proxy_annotation_simple() async {
     Source source = addSource(r'''
 library L;
 @proxy
@@ -4744,11 +4734,11 @@
     var y = this + this;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_superclass() {
+  test_proxy_annotation_superclass() async {
     Source source = addSource(r'''
 library L;
 class B extends A {
@@ -4761,11 +4751,11 @@
 }
 @proxy
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_superclass_mixin() {
+  test_proxy_annotation_superclass_mixin() async {
     Source source = addSource(r'''
 library L;
 class B extends Object with A {
@@ -4778,11 +4768,11 @@
 }
 @proxy
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_superinterface() {
+  test_proxy_annotation_superinterface() async {
     Source source = addSource(r'''
 library L;
 class B implements A {
@@ -4795,12 +4785,12 @@
 }
 @proxy
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_superinterface_infiniteLoop() {
-    Source source = addSource(r'''
+  test_proxy_annotation_superinterface_infiniteLoop() async {
+    addSource(r'''
 library L;
 class C implements A {
   m() {
@@ -4812,24 +4802,23 @@
 }
 class B implements A{}
 class A implements B{}''');
-    computeLibrarySourceErrors(source);
     // Test is that a stack overflow isn't reached in resolution
     // (previous line), no need to assert error set.
   }
 
-  void test_recursiveConstructorRedirect() {
+  test_recursiveConstructorRedirect() async {
     Source source = addSource(r'''
 class A {
   A.a() : this.b();
   A.b() : this.c();
   A.c() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_recursiveFactoryRedirect() {
+  test_recursiveFactoryRedirect() async {
     Source source = addSource(r'''
 class A {
   factory A() = B;
@@ -4840,12 +4829,12 @@
 class C implements B {
   factory C() => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_redirectToInvalidFunctionType() {
+  test_redirectToInvalidFunctionType() async {
     Source source = addSource(r'''
 class A implements B {
   A(int p) {}
@@ -4853,12 +4842,12 @@
 class B {
   factory B(int p) = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_redirectToInvalidReturnType() {
+  test_redirectToInvalidReturnType() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -4866,23 +4855,23 @@
 class B extends A {
   factory B() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_redirectToNonConstConstructor() {
+  test_redirectToNonConstConstructor() async {
     Source source = addSource(r'''
 class A {
   const A.a();
   const factory A.b() = A.a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_referencedBeforeDeclaration_cascade() {
+  test_referencedBeforeDeclaration_cascade() async {
     Source source = addSource(r'''
 testRequestHandler() {}
 
@@ -4893,12 +4882,12 @@
   var stream = 123;
   print(stream);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_referenceToDeclaredVariableInInitializer_constructorName() {
+  test_referenceToDeclaredVariableInInitializer_constructorName() async {
     Source source = addSource(r'''
 class A {
   A.x() {}
@@ -4906,12 +4895,12 @@
 f() {
   var x = new A.x();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_referenceToDeclaredVariableInInitializer_methodName() {
+  test_referenceToDeclaredVariableInInitializer_methodName() async {
     Source source = addSource(r'''
 class A {
   x() {}
@@ -4919,12 +4908,12 @@
 f(A a) {
   var x = a.x();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_referenceToDeclaredVariableInInitializer_propertyName() {
+  test_referenceToDeclaredVariableInInitializer_propertyName() async {
     Source source = addSource(r'''
 class A {
   var x;
@@ -4932,77 +4921,77 @@
 f(A a) {
   var x = a.x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_rethrowOutsideCatch() {
+  test_rethrowOutsideCatch() async {
     Source source = addSource(r'''
 class A {
   void m() {
     try {} catch (e) {rethrow;}
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_return_in_generator_async() {
+  test_return_in_generator_async() async {
     Source source = addSource('''
 import 'dart:async';
 Stream<int> f() async* {
   return;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_return_in_generator_sync() {
+  test_return_in_generator_sync() async {
     Source source = addSource('''
 Iterable<int> f() sync* {
   return;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnInGenerativeConstructor() {
+  test_returnInGenerativeConstructor() async {
     Source source = addSource(r'''
 class A {
   A() { return; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnInGenerator_async() {
+  test_returnInGenerator_async() async {
     Source source = addSource(r'''
 f() async {
   return 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnInGenerator_sync() {
+  test_returnInGenerator_sync() async {
     Source source = addSource(r'''
 f() {
   return 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnOfInvalidType_async() {
+  test_returnOfInvalidType_async() async {
     Source source = addSource(r'''
 import 'dart:async';
 class A {
@@ -5010,12 +4999,24 @@
     return 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnOfInvalidType_dynamic() {
+  test_returnOfInvalidType_async_future_int_mismatches_future_null() async {
+    Source source = addSource(r'''
+import 'dart:async';
+Future<Null> f() async {
+  return 5;
+}
+''');
+    await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+  }
+
+  test_returnOfInvalidType_dynamic() async {
     Source source = addSource(r'''
 class TypeError {}
 class A {
@@ -5029,44 +5030,44 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnOfInvalidType_dynamicAsTypeArgument() {
+  test_returnOfInvalidType_dynamicAsTypeArgument() async {
     Source source = addSource(r'''
 class I<T> {
   factory I() => new A<T>();
 }
 class A<T> implements I {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnOfInvalidType_subtype() {
+  test_returnOfInvalidType_subtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
 A f(B b) { return b; }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnOfInvalidType_supertype() {
+  test_returnOfInvalidType_supertype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
 B f(A a) { return a; }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnOfInvalidType_typeParameter_18468() {
+  test_returnOfInvalidType_typeParameter_18468() async {
     // https://code.google.com/p/dart/issues/detail?id=18468
     //
     // This test verifies that the type of T is more specific than Type,
@@ -5081,41 +5082,42 @@
 class Foo<T> {
   Type get t => T;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source);
     verify([source]);
   }
 
-  void test_returnOfInvalidType_void() {
+  test_returnOfInvalidType_void() async {
     Source source = addSource(r'''
 void f1() {}
 void f2() { return; }
 void f3() { return null; }
 void f4() { return g1(); }
 void f5() { return g2(); }
+void f6() => throw 42;
 g1() {}
 void g2() {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnWithoutValue_noReturnType() {
+  test_returnWithoutValue_noReturnType() async {
     Source source = addSource("f() { return; }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_returnWithoutValue_void() {
+  test_returnWithoutValue_void() async {
     Source source = addSource("void f() { return; }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_reversedTypeArguments() {
+  test_reversedTypeArguments() async {
     Source source = addSource(r'''
 class Codec<S1, T1> {
   Codec<T1, S1> get inverted => new _InvertedCodec<T1, S1>(this);
@@ -5123,13 +5125,13 @@
 class _InvertedCodec<T2, S2> extends Codec<T2, S2> {
   _InvertedCodec(Codec<S2, T2> codec);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_sharedDeferredPrefix() {
-    resolveWithErrors(<String>[
+  test_sharedDeferredPrefix() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 f1() {}''',
@@ -5148,7 +5150,7 @@
     ], <ErrorCode>[]);
   }
 
-  void test_staticAccessToInstanceMember_annotation() {
+  test_staticAccessToInstanceMember_annotation() async {
     Source source = addSource(r'''
 class A {
   const A.name();
@@ -5156,12 +5158,12 @@
 @A.name()
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_staticAccessToInstanceMember_method() {
+  test_staticAccessToInstanceMember_method() async {
     Source source = addSource(r'''
 class A {
   static m() {}
@@ -5170,12 +5172,12 @@
   A.m;
   A.m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_staticAccessToInstanceMember_propertyAccess_field() {
+  test_staticAccessToInstanceMember_propertyAccess_field() async {
     Source source = addSource(r'''
 class A {
   static var f;
@@ -5184,12 +5186,12 @@
   A.f;
   A.f = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_staticAccessToInstanceMember_propertyAccess_propertyAccessor() {
+  test_staticAccessToInstanceMember_propertyAccess_propertyAccessor() async {
     Source source = addSource(r'''
 class A {
   static get f => 42;
@@ -5199,12 +5201,12 @@
   A.f;
   A.f = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_superInInvalidContext() {
+  test_superInInvalidContext() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -5217,23 +5219,23 @@
     var v = super.m();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() {
+  test_typeAliasCannotReferenceItself_returnClass_withTypeAlias() async {
     Source source = addSource(r'''
 typedef B A();
 class B {
   A a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeArgumentNotMatchingBounds_const() {
+  test_typeArgumentNotMatchingBounds_const() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
@@ -5241,23 +5243,23 @@
   const G();
 }
 f() { return const G<B>(); }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeArgumentNotMatchingBounds_new() {
+  test_typeArgumentNotMatchingBounds_new() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
 class G<E extends A> {}
 f() { return new G<B>(); }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_hasBound() {
+  test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_hasBound() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
@@ -5265,12 +5267,12 @@
 F<A> fa;
 F<B> fb;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_hasBound2() {
+  test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_hasBound2() async {
     Source source = addSource(r'''
 class MyClass<T> {}
 typedef MyFunction<T, P extends MyClass<T>>();
@@ -5278,67 +5280,66 @@
   MyFunction<T, P> f;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_noBound() {
+  test_typeArgumentNotMatchingBounds_ofFunctionTypeAlias_noBound() async {
     Source source = addSource(r'''
 typedef F<T>();
 F<int> f1;
 F<String> f2;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeArgumentNotMatchingBounds_typeArgumentList_0() {
+  test_typeArgumentNotMatchingBounds_typeArgumentList_0() async {
     Source source = addSource("abstract class A<T extends A>{}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeArgumentNotMatchingBounds_typeArgumentList_1() {
+  test_typeArgumentNotMatchingBounds_typeArgumentList_1() async {
     Source source = addSource("abstract class A<T extends A<A>>{}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeArgumentNotMatchingBounds_typeArgumentList_20() {
+  test_typeArgumentNotMatchingBounds_typeArgumentList_20() async {
     Source source = addSource(
         "abstract class A<T extends A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A>>>>>>>>>>>>>>>>>>>>>{}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_booleanAnd_useInRight() {
+  test_typePromotion_booleanAnd_useInRight() async {
     Source source = addSource(r'''
 main(Object p) {
   p is String && p.length != 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_noAssignment() {
+  test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_noAssignment() async {
     Source source = addSource(r'''
 callMe(f()) { f(); }
 main(Object p) {
   (p is String) && callMe(() { p.length; });
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_conditional_issue14655() {
+  test_typePromotion_conditional_issue14655() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
@@ -5349,34 +5350,33 @@
 main(A p) {
   (p is C) && (print(() => p) && (p is B)) ? p.mc() : p = null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_conditional_useInThen() {
+  test_typePromotion_conditional_useInThen() async {
     Source source = addSource(r'''
 main(Object p) {
   p is String ? p.length : 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void
-      test_typePromotion_conditional_useInThen_accessedInClosure_noAssignment() {
+  test_typePromotion_conditional_useInThen_accessedInClosure_noAssignment() async {
     Source source = addSource(r'''
 callMe(f()) { f(); }
 main(Object p) {
   p is String ? callMe(() { p.length; }) : 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_functionType_arg_ignoreIfNotMoreSpecific() {
+  test_typePromotion_functionType_arg_ignoreIfNotMoreSpecific() async {
     Source source = addSource(r'''
 typedef FuncB(B b);
 typedef FuncA(A a);
@@ -5387,12 +5387,12 @@
     f(new A());
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_functionType_return_ignoreIfNotMoreSpecific() {
+  test_typePromotion_functionType_return_ignoreIfNotMoreSpecific() async {
     Source source = addSource(r'''
 class A {}
 typedef FuncAtoDyn(A a);
@@ -5402,12 +5402,12 @@
     A a = f(new A());
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_functionType_return_voidToDynamic() {
+  test_typePromotion_functionType_return_voidToDynamic() async {
     Source source = addSource(r'''
 typedef FuncDynToDyn(x);
 typedef void FuncDynToVoid(x);
@@ -5417,12 +5417,12 @@
     A a = f(null);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_accessedInClosure_noAssignment() {
+  test_typePromotion_if_accessedInClosure_noAssignment() async {
     Source source = addSource(r'''
 callMe(f()) { f(); }
 main(Object p) {
@@ -5432,12 +5432,12 @@
     });
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_extends_moreSpecific() {
+  test_typePromotion_if_extends_moreSpecific() async {
     Source source = addSource(r'''
 class V {}
 class VP extends V {}
@@ -5451,12 +5451,12 @@
     p.b;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_hasAssignment_outsideAfter() {
+  test_typePromotion_if_hasAssignment_outsideAfter() async {
     Source source = addSource(r'''
 main(Object p) {
   if (p is String) {
@@ -5464,12 +5464,12 @@
   }
   p = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_hasAssignment_outsideBefore() {
+  test_typePromotion_if_hasAssignment_outsideBefore() async {
     Source source = addSource(r'''
 main(Object p, Object p2) {
   p = p2;
@@ -5477,12 +5477,12 @@
     p.length;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_implements_moreSpecific() {
+  test_typePromotion_if_implements_moreSpecific() async {
     Source source = addSource(r'''
 class V {}
 class VP extends V {}
@@ -5496,12 +5496,12 @@
     p.b;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_inClosure_assignedAfter_inSameFunction() {
+  test_typePromotion_if_inClosure_assignedAfter_inSameFunction() async {
     Source source = addSource(r'''
 main() {
   f(Object p) {
@@ -5511,12 +5511,12 @@
     p = 0;
   };
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_is_and_left() {
+  test_typePromotion_if_is_and_left() async {
     Source source = addSource(r'''
 bool tt() => true;
 main(Object p) {
@@ -5524,12 +5524,12 @@
     p.length;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_is_and_right() {
+  test_typePromotion_if_is_and_right() async {
     Source source = addSource(r'''
 bool tt() => true;
 main(Object p) {
@@ -5537,12 +5537,12 @@
     p.length;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_is_and_subThenSuper() {
+  test_typePromotion_if_is_and_subThenSuper() async {
     Source source = addSource(r'''
 class A {
   var a;
@@ -5556,36 +5556,36 @@
     p.b;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_is_parenthesized() {
+  test_typePromotion_if_is_parenthesized() async {
     Source source = addSource(r'''
 main(Object p) {
   if ((p is String)) {
     p.length;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_if_is_single() {
+  test_typePromotion_if_is_single() async {
     Source source = addSource(r'''
 main(Object p) {
   if (p is String) {
     p.length;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typePromotion_parentheses() {
+  test_typePromotion_parentheses() async {
     Source source = addSource(r'''
 main(Object p) {
   (p is String) ? p.length : 0;
@@ -5593,24 +5593,24 @@
   ((p)) is String ? p.length : 0;
   ((p) is String) ? p.length : 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeType_class() {
+  test_typeType_class() async {
     Source source = addSource(r'''
 class C {}
 f(Type t) {}
 main() {
   f(C);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeType_class_prefixed() {
+  test_typeType_class_prefixed() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -5622,24 +5622,24 @@
 main() {
   f(p.C);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeType_functionTypeAlias() {
+  test_typeType_functionTypeAlias() async {
     Source source = addSource(r'''
 typedef F();
 f(Type t) {}
 main() {
   f(F);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_typeType_functionTypeAlias_prefixed() {
+  test_typeType_functionTypeAlias_prefixed() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -5651,12 +5651,12 @@
 main() {
   f(p.F);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedConstructorInInitializer_explicit_named() {
+  test_undefinedConstructorInInitializer_explicit_named() async {
     Source source = addSource(r'''
 class A {
   A.named() {}
@@ -5664,12 +5664,12 @@
 class B extends A {
   B() : super.named();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedConstructorInInitializer_explicit_unnamed() {
+  test_undefinedConstructorInInitializer_explicit_unnamed() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -5677,12 +5677,12 @@
 class B extends A {
   B() : super();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedConstructorInInitializer_hasOptionalParameters() {
+  test_undefinedConstructorInInitializer_hasOptionalParameters() async {
     Source source = addSource(r'''
 class A {
   A([p]) {}
@@ -5690,12 +5690,12 @@
 class B extends A {
   B();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedConstructorInInitializer_implicit() {
+  test_undefinedConstructorInInitializer_implicit() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -5703,24 +5703,24 @@
 class B extends A {
   B();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedConstructorInInitializer_implicit_typeAlias() {
+  test_undefinedConstructorInInitializer_implicit_typeAlias() async {
     Source source = addSource(r'''
 class M {}
 class A = Object with M;
 class B extends A {
   B();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedConstructorInInitializer_redirecting() {
+  test_undefinedConstructorInInitializer_redirecting() async {
     Source source = addSource(r'''
 class Foo {
   Foo.ctor();
@@ -5729,12 +5729,12 @@
   Bar() : this.ctor();
   Bar.ctor() : super.ctor();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedGetter_static_conditionalAccess() {
+  test_undefinedGetter_static_conditionalAccess() async {
     // The conditional access operator '?.' can be used to access static
     // fields.
     Source source = addSource('''
@@ -5743,12 +5743,12 @@
 }
 var a = A?.x;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedGetter_typeSubstitution() {
+  test_undefinedGetter_typeSubstitution() async {
     Source source = addSource(r'''
 class A<E> {
   E element;
@@ -5758,52 +5758,52 @@
     element.last;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedIdentifier_synthetic_whenExpression() {
+  test_undefinedIdentifier_synthetic_whenExpression() async {
     Source source = addSource(r'''
 print(x) {}
 main() {
   print(is String);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.MISSING_IDENTIFIER]);
   }
 
-  void test_undefinedIdentifier_synthetic_whenMethodName() {
+  test_undefinedIdentifier_synthetic_whenMethodName() async {
     Source source = addSource(r'''
 print(x) {}
 main(int p) {
   p.();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.MISSING_IDENTIFIER]);
   }
 
-  void test_undefinedMethod_functionExpression_callMethod() {
+  test_undefinedMethod_functionExpression_callMethod() async {
     Source source = addSource(r'''
 main() {
   (() => null).call();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     // A call to verify(source) fails as '.call()' isn't resolved.
   }
 
-  void test_undefinedMethod_functionExpression_directCall() {
+  test_undefinedMethod_functionExpression_directCall() async {
     Source source = addSource(r'''
 main() {
   (() => null)();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     // A call to verify(source) fails as '(() => null)()' isn't resolved.
   }
 
-  void test_undefinedMethod_static_conditionalAccess() {
+  test_undefinedMethod_static_conditionalAccess() async {
     // The conditional access operator '?.' can be used to access static
     // methods.
     Source source = addSource('''
@@ -5812,12 +5812,12 @@
 }
 f() { A?.m(); }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedOperator_index() {
+  test_undefinedOperator_index() async {
     Source source = addSource(r'''
 class A {
   operator [](a) {}
@@ -5827,21 +5827,21 @@
   a[0];
   a[0] = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedOperator_tilde() {
+  test_undefinedOperator_tilde() async {
     Source source = addSource(r'''
 const A = 3;
 const B = ~((1 << A) - 1);''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedSetter_importWithPrefix() {
+  test_undefinedSetter_importWithPrefix() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -5852,12 +5852,12 @@
 main() {
   x.y = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedSetter_static_conditionalAccess() {
+  test_undefinedSetter_static_conditionalAccess() async {
     // The conditional access operator '?.' can be used to access static
     // fields.
     Source source = addSource('''
@@ -5866,12 +5866,12 @@
 }
 f() { A?.x = 1; }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedSuperMethod_field() {
+  test_undefinedSuperMethod_field() async {
     Source source = addSource(r'''
 class A {
   var m;
@@ -5881,12 +5881,12 @@
     super.m();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_undefinedSuperMethod_method() {
+  test_undefinedSuperMethod_method() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -5896,12 +5896,12 @@
     super.m();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unqualifiedReferenceToNonLocalStaticMember_fromComment_new() {
+  test_unqualifiedReferenceToNonLocalStaticMember_fromComment_new() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -5910,145 +5910,145 @@
 /// [new A] or [new A.named]
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedShownName_unresolved() {
+  test_unusedShownName_unresolved() async {
     Source source = addSource(r'''
 import 'dart:math' show max, FooBar;
 main() {
   print(max(1, 2));
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [HintCode.UNDEFINED_SHOWN_NAME]);
   }
 
-  void test_uriDoesNotExist_dll() {
+  test_uriDoesNotExist_dll() async {
     addNamedSource("/lib.dll", "");
     Source source = addSource("import 'dart-ext:lib';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_uriDoesNotExist_dylib() {
+  test_uriDoesNotExist_dylib() async {
     addNamedSource("/lib.dylib", "");
     Source source = addSource("import 'dart-ext:lib';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_uriDoesNotExist_so() {
+  test_uriDoesNotExist_so() async {
     addNamedSource("/lib.so", "");
     Source source = addSource("import 'dart-ext:lib';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_wrongNumberOfParametersForOperator1() {
-    _check_wrongNumberOfParametersForOperator1("<");
-    _check_wrongNumberOfParametersForOperator1(">");
-    _check_wrongNumberOfParametersForOperator1("<=");
-    _check_wrongNumberOfParametersForOperator1(">=");
-    _check_wrongNumberOfParametersForOperator1("+");
-    _check_wrongNumberOfParametersForOperator1("/");
-    _check_wrongNumberOfParametersForOperator1("~/");
-    _check_wrongNumberOfParametersForOperator1("*");
-    _check_wrongNumberOfParametersForOperator1("%");
-    _check_wrongNumberOfParametersForOperator1("|");
-    _check_wrongNumberOfParametersForOperator1("^");
-    _check_wrongNumberOfParametersForOperator1("&");
-    _check_wrongNumberOfParametersForOperator1("<<");
-    _check_wrongNumberOfParametersForOperator1(">>");
-    _check_wrongNumberOfParametersForOperator1("[]");
+  test_wrongNumberOfParametersForOperator1() async {
+    await _check_wrongNumberOfParametersForOperator1("<");
+    await _check_wrongNumberOfParametersForOperator1(">");
+    await _check_wrongNumberOfParametersForOperator1("<=");
+    await _check_wrongNumberOfParametersForOperator1(">=");
+    await _check_wrongNumberOfParametersForOperator1("+");
+    await _check_wrongNumberOfParametersForOperator1("/");
+    await _check_wrongNumberOfParametersForOperator1("~/");
+    await _check_wrongNumberOfParametersForOperator1("*");
+    await _check_wrongNumberOfParametersForOperator1("%");
+    await _check_wrongNumberOfParametersForOperator1("|");
+    await _check_wrongNumberOfParametersForOperator1("^");
+    await _check_wrongNumberOfParametersForOperator1("&");
+    await _check_wrongNumberOfParametersForOperator1("<<");
+    await _check_wrongNumberOfParametersForOperator1(">>");
+    await _check_wrongNumberOfParametersForOperator1("[]");
   }
 
-  void test_wrongNumberOfParametersForOperator_index() {
+  test_wrongNumberOfParametersForOperator_index() async {
     Source source = addSource(r'''
 class A {
   operator []=(a, b) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_wrongNumberOfParametersForOperator_minus() {
-    _check_wrongNumberOfParametersForOperator("-", "");
-    _check_wrongNumberOfParametersForOperator("-", "a");
+  test_wrongNumberOfParametersForOperator_minus() async {
+    await _check_wrongNumberOfParametersForOperator("-", "");
+    await _check_wrongNumberOfParametersForOperator("-", "a");
   }
 
-  void test_wrongNumberOfParametersForSetter() {
+  test_wrongNumberOfParametersForSetter() async {
     Source source = addSource(r'''
 class A {
   set x(a) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_async_to_dynamic_type() {
+  test_yield_async_to_dynamic_type() async {
     Source source = addSource('''
 dynamic f() async* {
   yield 3;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_async_to_generic_type() {
+  test_yield_async_to_generic_type() async {
     Source source = addSource('''
 import 'dart:async';
 Stream f() async* {
   yield 3;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_async_to_parameterized_type() {
+  test_yield_async_to_parameterized_type() async {
     Source source = addSource('''
 import 'dart:async';
 Stream<int> f() async* {
   yield 3;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_async_to_untyped() {
+  test_yield_async_to_untyped() async {
     Source source = addSource('''
 f() async* {
   yield 3;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_async_dynamic_to_dynamic() {
+  test_yield_each_async_dynamic_to_dynamic() async {
     Source source = addSource('''
 f() async* {
   yield* g();
 }
 g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_async_dynamic_to_stream() {
+  test_yield_each_async_dynamic_to_stream() async {
     Source source = addSource('''
 import 'dart:async';
 Stream f() async* {
@@ -6056,12 +6056,12 @@
 }
 g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_async_dynamic_to_typed_stream() {
+  test_yield_each_async_dynamic_to_typed_stream() async {
     Source source = addSource('''
 import 'dart:async';
 Stream<int> f() async* {
@@ -6069,12 +6069,12 @@
 }
 g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_async_stream_to_dynamic() {
+  test_yield_each_async_stream_to_dynamic() async {
     Source source = addSource('''
 import 'dart:async';
 f() async* {
@@ -6082,12 +6082,12 @@
 }
 Stream g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_async_typed_stream_to_dynamic() {
+  test_yield_each_async_typed_stream_to_dynamic() async {
     Source source = addSource('''
 import 'dart:async';
 f() async* {
@@ -6095,12 +6095,12 @@
 }
 Stream<int> g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_async_typed_stream_to_typed_stream() {
+  test_yield_each_async_typed_stream_to_typed_stream() async {
     Source source = addSource('''
 import 'dart:async';
 Stream<int> f() async* {
@@ -6108,163 +6108,164 @@
 }
 Stream<int> g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_sync_dynamic_to_dynamic() {
+  test_yield_each_sync_dynamic_to_dynamic() async {
     Source source = addSource('''
 f() sync* {
   yield* g();
 }
 g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_sync_dynamic_to_iterable() {
+  test_yield_each_sync_dynamic_to_iterable() async {
     Source source = addSource('''
 Iterable f() sync* {
   yield* g();
 }
 g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_sync_dynamic_to_typed_iterable() {
+  test_yield_each_sync_dynamic_to_typed_iterable() async {
     Source source = addSource('''
 Iterable<int> f() sync* {
   yield* g();
 }
 g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_sync_iterable_to_dynamic() {
+  test_yield_each_sync_iterable_to_dynamic() async {
     Source source = addSource('''
 f() sync* {
   yield* g();
 }
 Iterable g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_sync_typed_iterable_to_dynamic() {
+  test_yield_each_sync_typed_iterable_to_dynamic() async {
     Source source = addSource('''
 f() sync* {
   yield* g();
 }
 Iterable<int> g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_each_sync_typed_iterable_to_typed_iterable() {
+  test_yield_each_sync_typed_iterable_to_typed_iterable() async {
     Source source = addSource('''
 Iterable<int> f() sync* {
   yield* g();
 }
 Iterable<int> g() => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_sync_to_dynamic_type() {
+  test_yield_sync_to_dynamic_type() async {
     Source source = addSource('''
 dynamic f() sync* {
   yield 3;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_sync_to_generic_type() {
+  test_yield_sync_to_generic_type() async {
     Source source = addSource('''
 Iterable f() sync* {
   yield 3;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_sync_to_parameterized_type() {
+  test_yield_sync_to_parameterized_type() async {
     Source source = addSource('''
 Iterable<int> f() sync* {
   yield 3;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yield_sync_to_untyped() {
+  test_yield_sync_to_untyped() async {
     Source source = addSource('''
 f() sync* {
   yield 3;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yieldInNonGenerator_asyncStar() {
+  test_yieldInNonGenerator_asyncStar() async {
     Source source = addSource(r'''
 f() async* {
   yield 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_yieldInNonGenerator_syncStar() {
+  test_yieldInNonGenerator_syncStar() async {
     Source source = addSource(r'''
 f() sync* {
   yield 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void _check_wrongNumberOfParametersForOperator(
-      String name, String parameters) {
+  Future<Null> _check_wrongNumberOfParametersForOperator(
+      String name, String parameters) async {
     Source source = addSource("""
 class A {
   operator $name($parameters) {}
 }""");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     reset();
   }
 
-  void _check_wrongNumberOfParametersForOperator1(String name) {
-    _check_wrongNumberOfParametersForOperator(name, "a");
+  Future<Null> _check_wrongNumberOfParametersForOperator1(String name) async {
+    await _check_wrongNumberOfParametersForOperator(name, "a");
   }
 
-  CompilationUnit _getResolvedLibraryUnit(Source source) =>
-      analysisContext.getResolvedCompilationUnit2(source, source);
+  Future<CompilationUnit> _getResolvedLibraryUnit(Source source) async {
+    return analysisContext.getResolvedCompilationUnit2(source, source);
+  }
 }
diff --git a/pkg/analyzer/test/generated/non_hint_code_driver_test.dart b/pkg/analyzer/test/generated/non_hint_code_driver_test.dart
new file mode 100644
index 0000000..d13f558
--- /dev/null
+++ b/pkg/analyzer/test/generated/non_hint_code_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'non_hint_code_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(NonHintCodeTest_Driver);
+  });
+}
+
+@reflectiveTest
+class NonHintCodeTest_Driver extends NonHintCodeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/non_hint_code_test.dart b/pkg/analyzer/test/generated/non_hint_code_test.dart
index 2ef678b..c2539e5 100644
--- a/pkg/analyzer/test/generated/non_hint_code_test.dart
+++ b/pkg/analyzer/test/generated/non_hint_code_test.dart
@@ -20,24 +20,17 @@
 
 @reflectiveTest
 class NonHintCodeTest extends ResolverTestCase {
-  void test_() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
-    Source source = addSource(r'''
-abstract class A {
-  void test();
-}
-class B extends A {
-  void test() {
-    super.test;
-  }
-}
+  test_async_future_object_without_return() async {
+    Source source = addSource('''
+import 'dart:async';
+Future<Object> f() async {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_afterTryCatch() {
+  test_deadCode_afterTryCatch() async {
     Source source = addSource('''
 main() {
   try {
@@ -51,45 +44,45 @@
   throw 'foo';
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_conditionalElse_debugConst() {
+  test_deadCode_deadBlock_conditionalElse_debugConst() async {
     Source source = addSource(r'''
 const bool DEBUG = true;
 f() {
   DEBUG ? 1 : 2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_conditionalIf_debugConst() {
+  test_deadCode_deadBlock_conditionalIf_debugConst() async {
     Source source = addSource(r'''
 const bool DEBUG = false;
 f() {
   DEBUG ? 1 : 2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_else() {
+  test_deadCode_deadBlock_else() async {
     Source source = addSource(r'''
 const bool DEBUG = true;
 f() {
   if(DEBUG) {} else {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_if_debugConst_prefixedIdentifier() {
+  test_deadCode_deadBlock_if_debugConst_prefixedIdentifier() async {
     Source source = addSource(r'''
 class A {
   static const bool DEBUG = false;
@@ -97,12 +90,12 @@
 f() {
   if(A.DEBUG) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_if_debugConst_prefixedIdentifier2() {
+  test_deadCode_deadBlock_if_debugConst_prefixedIdentifier2() async {
     Source source = addSource(r'''
 library L;
 import 'lib2.dart';
@@ -116,12 +109,12 @@
 class A {
   static const bool DEBUG = false;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_if_debugConst_propertyAccessor() {
+  test_deadCode_deadBlock_if_debugConst_propertyAccessor() async {
     Source source = addSource(r'''
 library L;
 import 'lib2.dart' as LIB;
@@ -135,46 +128,46 @@
 class A {
   static const bool DEBUG = false;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_if_debugConst_simpleIdentifier() {
+  test_deadCode_deadBlock_if_debugConst_simpleIdentifier() async {
     Source source = addSource(r'''
 const bool DEBUG = false;
 f() {
   if(DEBUG) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadBlock_while_debugConst() {
+  test_deadCode_deadBlock_while_debugConst() async {
     Source source = addSource(r'''
 const bool DEBUG = false;
 f() {
   while(DEBUG) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadCatch_onCatchSubtype() {
+  test_deadCode_deadCatch_onCatchSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
 f() {
   try {} on B catch (e) {} on A catch (e) {} catch (e) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadFinalBreakInCase() {
+  test_deadCode_deadFinalBreakInCase() async {
     Source source = addSource(r'''
 f() {
   switch (true) {
@@ -189,34 +182,34 @@
     break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadOperandLHS_and_debugConst() {
+  test_deadCode_deadOperandLHS_and_debugConst() async {
     Source source = addSource(r'''
 const bool DEBUG = false;
 f() {
   bool b = DEBUG && false;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_deadOperandLHS_or_debugConst() {
+  test_deadCode_deadOperandLHS_or_debugConst() async {
     Source source = addSource(r'''
 const bool DEBUG = true;
 f() {
   bool b = DEBUG || true;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deadCode_statementAfterIfWithoutElse() {
+  test_deadCode_statementAfterIfWithoutElse() async {
     Source source = addSource(r'''
 f() {
   if (1 < 0) {
@@ -224,12 +217,12 @@
   }
   int a = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deprecatedMemberUse_inDeprecatedClass() {
+  test_deprecatedMemberUse_inDeprecatedClass() async {
     Source source = addSource(r'''
 @deprecated
 f() {}
@@ -241,12 +234,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deprecatedMemberUse_inDeprecatedFunction() {
+  test_deprecatedMemberUse_inDeprecatedFunction() async {
     Source source = addSource(r'''
 @deprecated
 f() {}
@@ -256,12 +249,12 @@
   f();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deprecatedMemberUse_inDeprecatedLibrary() {
+  test_deprecatedMemberUse_inDeprecatedLibrary() async {
     Source source = addSource(r'''
 @deprecated
 library lib;
@@ -275,12 +268,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deprecatedMemberUse_inDeprecatedMethod() {
+  test_deprecatedMemberUse_inDeprecatedMethod() async {
     Source source = addSource(r'''
 @deprecated
 f() {}
@@ -292,12 +285,12 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_deprecatedMemberUse_inDeprecatedMethod_inDeprecatedClass() {
+  test_deprecatedMemberUse_inDeprecatedMethod_inDeprecatedClass() async {
     Source source = addSource(r'''
 @deprecated
 f() {}
@@ -310,32 +303,32 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_divisionOptimization() {
+  test_divisionOptimization() async {
     Source source = addSource(r'''
 f(int x, int y) {
   var v = x / y.toInt();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_divisionOptimization_supressIfDivisionNotDefinedInCore() {
+  test_divisionOptimization_supressIfDivisionNotDefinedInCore() async {
     Source source = addSource(r'''
 f(x, y) {
   var v = (x / y).toInt();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_divisionOptimization_supressIfDivisionOverridden() {
+  test_divisionOptimization_supressIfDivisionOverridden() async {
     Source source = addSource(r'''
 class A {
   num operator /(x) { return x; }
@@ -343,12 +336,12 @@
 f(A x, A y) {
   var v = (x / y).toInt();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_duplicateImport_as() {
+  test_duplicateImport_as() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -360,12 +353,12 @@
         r'''
 library lib1;
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_duplicateImport_hide() {
+  test_duplicateImport_hide() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -378,12 +371,12 @@
 library lib1;
 class A {}
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_duplicateImport_show() {
+  test_duplicateImport_show() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -396,13 +389,13 @@
 library lib1;
 class A {}
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_importDeferredLibraryWithLoadFunction() {
-    resolveWithErrors(<String>[
+  test_importDeferredLibraryWithLoadFunction() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 f() {}''',
@@ -413,7 +406,7 @@
     ], const <ErrorCode>[]);
   }
 
-  void test_issue20904BuggyTypePromotionAtIfJoin_1() {
+  test_issue20904BuggyTypePromotionAtIfJoin_1() async {
     // https://code.google.com/p/dart/issues/detail?id=20904
     Source source = addSource(r'''
 f(var message, var dynamic_) {
@@ -422,12 +415,12 @@
   }
   int s = message;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_issue20904BuggyTypePromotionAtIfJoin_3() {
+  test_issue20904BuggyTypePromotionAtIfJoin_3() async {
     // https://code.google.com/p/dart/issues/detail?id=20904
     Source source = addSource(r'''
 f(var message) {
@@ -439,12 +432,12 @@
   }
   int s = message;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_issue20904BuggyTypePromotionAtIfJoin_4() {
+  test_issue20904BuggyTypePromotionAtIfJoin_4() async {
     // https://code.google.com/p/dart/issues/detail?id=20904
     Source source = addSource(r'''
 f(var message) {
@@ -455,76 +448,76 @@
   }
   String s = message;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_missingReturn_emptyFunctionBody() {
+  test_missingReturn_emptyFunctionBody() async {
     Source source = addSource(r'''
 abstract class A {
   int m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_missingReturn_expressionFunctionBody() {
+  test_missingReturn_expressionFunctionBody() async {
     Source source = addSource("int f() => 0;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_missingReturn_noReturnType() {
+  test_missingReturn_noReturnType() async {
     Source source = addSource("f() {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_missingReturn_voidReturnType() {
+  test_missingReturn_voidReturnType() async {
     Source source = addSource("void f() {}");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_for_noCondition() {
+  test_nullAwareInCondition_for_noCondition() async {
     Source source = addSource(r'''
 m(x) {
   for (var v = x; ; v++) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_nullAwareInCondition_if_notTopLevel() {
+  test_nullAwareInCondition_if_notTopLevel() async {
     Source source = addSource(r'''
 m(x) {
   if (x?.y == null) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideEqualsButNotHashCode() {
+  test_overrideEqualsButNotHashCode() async {
     Source source = addSource(r'''
 class A {
   bool operator ==(x) { return x; }
   get hashCode => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingField_inInterface() {
+  test_overrideOnNonOverridingField_inInterface() async {
     Source source = addSource(r'''
 class A {
   int get a => 0;
@@ -539,12 +532,12 @@
   @override
   int c;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingField_inSuperclass() {
+  test_overrideOnNonOverridingField_inSuperclass() async {
     Source source = addSource(r'''
 class A {
   int get a => 0;
@@ -559,12 +552,12 @@
   @override
   int c;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingGetter_inInterface() {
+  test_overrideOnNonOverridingGetter_inInterface() async {
     Source source = addSource(r'''
 class A {
   int get m => 0;
@@ -573,12 +566,12 @@
   @override
   int get m => 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingGetter_inSuperclass() {
+  test_overrideOnNonOverridingGetter_inSuperclass() async {
     Source source = addSource(r'''
 class A {
   int get m => 0;
@@ -587,12 +580,12 @@
   @override
   int get m => 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingMethod_inInterface() {
+  test_overrideOnNonOverridingMethod_inInterface() async {
     Source source = addSource(r'''
 class A {
   int m() => 0;
@@ -601,12 +594,12 @@
   @override
   int m() => 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingMethod_inSuperclass() {
+  test_overrideOnNonOverridingMethod_inSuperclass() async {
     Source source = addSource(r'''
 class A {
   int m() => 0;
@@ -615,12 +608,12 @@
   @override
   int m() => 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingMethod_inSuperclass_abstract() {
+  test_overrideOnNonOverridingMethod_inSuperclass_abstract() async {
     Source source = addSource(r'''
 abstract class A {
   int m();
@@ -629,12 +622,12 @@
   @override
   int m() => 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingSetter_inInterface() {
+  test_overrideOnNonOverridingSetter_inInterface() async {
     Source source = addSource(r'''
 class A {
   set m(int x) {}
@@ -643,12 +636,12 @@
   @override
   set m(int x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_overrideOnNonOverridingSetter_inSuperclass() {
+  test_overrideOnNonOverridingSetter_inSuperclass() async {
     Source source = addSource(r'''
 class A {
   set m(int x) {}
@@ -657,12 +650,12 @@
   @override
   set m(int x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_propagatedFieldType() {
+  test_propagatedFieldType() async {
     Source source = addSource(r'''
 class A { }
 class X<T> {
@@ -674,12 +667,12 @@
     y.x.add(new A());
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_proxy_annotation_prefixed() {
+  test_proxy_annotation_prefixed() async {
     Source source = addSource(r'''
 library L;
 @proxy
@@ -693,11 +686,11 @@
   a++;
   ++a;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_prefixed2() {
+  test_proxy_annotation_prefixed2() async {
     Source source = addSource(r'''
 library L;
 @proxy
@@ -713,11 +706,11 @@
     ++a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_proxy_annotation_prefixed3() {
+  test_proxy_annotation_prefixed3() async {
     Source source = addSource(r'''
 library L;
 class B {
@@ -733,11 +726,11 @@
 }
 @proxy
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedGetter_inSubtype() {
+  test_undefinedGetter_inSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -748,11 +741,11 @@
     return a.b;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedMethod_assignmentExpression_inSubtype() {
+  test_undefinedMethod_assignmentExpression_inSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -763,21 +756,21 @@
   a2 = new A();
   a += a2;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedMethod_dynamic() {
+  test_undefinedMethod_dynamic() async {
     Source source = addSource(r'''
 class D<T extends dynamic> {
   fieldAccess(T t) => t.abc;
   methodAccess(T t) => t.xyz(1, 2, 'three');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedMethod_inSubtype() {
+  test_undefinedMethod_inSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -787,11 +780,11 @@
   var a = new A();
   a.b();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedMethod_unionType_all() {
+  test_undefinedMethod_unionType_all() async {
     Source source = addSource(r'''
 class A {
   int m(int x) => 0;
@@ -808,11 +801,11 @@
   }
   ab.m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedMethod_unionType_some() {
+  test_undefinedMethod_unionType_some() async {
     Source source = addSource(r'''
 class A {
   int m(int x) => 0;
@@ -827,11 +820,11 @@
   }
   ab.m(0);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedOperator_binaryExpression_inSubtype() {
+  test_undefinedOperator_binaryExpression_inSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -842,11 +835,11 @@
     a + 1;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedOperator_indexBoth_inSubtype() {
+  test_undefinedOperator_indexBoth_inSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -857,11 +850,11 @@
     a[0]++;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedOperator_indexGetter_inSubtype() {
+  test_undefinedOperator_indexGetter_inSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -872,11 +865,11 @@
     a[0];
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedOperator_indexSetter_inSubtype() {
+  test_undefinedOperator_indexSetter_inSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -887,11 +880,11 @@
     a[0] = 1;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedOperator_postfixExpression() {
+  test_undefinedOperator_postfixExpression() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -902,11 +895,11 @@
     a++;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedOperator_prefixExpression() {
+  test_undefinedOperator_prefixExpression() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -917,11 +910,11 @@
     ++a;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_undefinedSetter_inSubtype() {
+  test_undefinedSetter_inSubtype() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -932,11 +925,11 @@
     a.b = 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_unnecessaryCast_13855_parameter_A() {
+  test_unnecessaryCast_13855_parameter_A() async {
     // dartbug.com/13855, dartbug.com/13732
     Source source = addSource(r'''
 class A{
@@ -948,12 +941,12 @@
     (e as A).a();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unnecessaryCast_conditionalExpression() {
+  test_unnecessaryCast_conditionalExpression() async {
     Source source = addSource(r'''
 abstract class I {}
 class A implements I {}
@@ -961,22 +954,22 @@
 I m(A a, B b) {
   return a == null ? b as I : a as I;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unnecessaryCast_dynamic_type() {
+  test_unnecessaryCast_dynamic_type() async {
     Source source = addSource(r'''
 m(v) {
   var b = v as Object;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unnecessaryCast_generics() {
+  test_unnecessaryCast_generics() async {
     // dartbug.com/18953
     Source source = addSource(r'''
 import 'dart:async';
@@ -984,22 +977,22 @@
 void g(bool c) {
   (c ? f(): new Future.value(0) as Future<int>).then((int value) {});
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unnecessaryCast_type_dynamic() {
+  test_unnecessaryCast_type_dynamic() async {
     Source source = addSource(r'''
 m(v) {
   var b = Object as dynamic;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unnecessaryNoSuchMethod_blockBody_notReturnStatement() {
+  test_unnecessaryNoSuchMethod_blockBody_notReturnStatement() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(x) => super.noSuchMethod(x);
@@ -1010,12 +1003,12 @@
     print(y);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unnecessaryNoSuchMethod_blockBody_notSingleStatement() {
+  test_unnecessaryNoSuchMethod_blockBody_notSingleStatement() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(x) => super.noSuchMethod(x);
@@ -1027,12 +1020,12 @@
     return super.noSuchMethod(y);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unnecessaryNoSuchMethod_expressionBody_notNoSuchMethod() {
+  test_unnecessaryNoSuchMethod_expressionBody_notNoSuchMethod() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(x) => super.noSuchMethod(x);
@@ -1041,12 +1034,12 @@
   mmm();
   noSuchMethod(y) => super.hashCode;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unnecessaryNoSuchMethod_expressionBody_notSuper() {
+  test_unnecessaryNoSuchMethod_expressionBody_notSuper() async {
     Source source = addSource(r'''
 class A {
   noSuchMethod(x) => super.noSuchMethod(x);
@@ -1055,12 +1048,12 @@
   mmm();
   noSuchMethod(y) => 42;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedImport_annotationOnDirective() {
+  test_unusedImport_annotationOnDirective() async {
     Source source = addSource(r'''
 library L;
 @A()
@@ -1072,12 +1065,13 @@
 class A {
   const A() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
     assertErrors(source);
     verify([source, source2]);
   }
 
-  void test_unusedImport_as_equalPrefixes() {
+  test_unusedImport_as_equalPrefixes() async {
     // 18818
     Source source = addSource(r'''
 library L;
@@ -1095,23 +1089,25 @@
         r'''
 library lib2;
 class B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(source2);
+    await computeAnalysisResult(source3);
     assertErrors(source);
     assertNoErrors(source2);
     assertNoErrors(source3);
     verify([source, source2, source3]);
   }
 
-  void test_unusedImport_core_library() {
+  test_unusedImport_core_library() async {
     Source source = addSource(r'''
 library L;
 import 'dart:core';''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedImport_export() {
+  test_unusedImport_export() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -1127,12 +1123,12 @@
         r'''
 library lib2;
 class Two {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedImport_export2() {
+  test_unusedImport_export2() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -1154,12 +1150,12 @@
         r'''
 library lib3;
 class Three {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedImport_export_infiniteLoop() {
+  test_unusedImport_export_infiniteLoop() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -1182,12 +1178,12 @@
 library lib3;
 export 'lib2.dart';
 class Three {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedImport_metadata() {
+  test_unusedImport_metadata() async {
     Source source = addSource(r'''
 library L;
 @A(x)
@@ -1201,12 +1197,12 @@
         r'''
 library lib1;
 const x = 0;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedImport_prefix_topLevelFunction() {
+  test_unusedImport_prefix_topLevelFunction() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' hide topLevelFunction;
@@ -1223,12 +1219,12 @@
 library lib1;
 class One {}
 topLevelFunction() {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_unusedImport_prefix_topLevelFunction2() {
+  test_unusedImport_prefix_topLevelFunction2() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart' hide topLevelFunction;
@@ -1247,12 +1243,12 @@
 library lib1;
 class One {}
 topLevelFunction() {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_useOfVoidResult_implicitReturnValue() {
+  test_useOfVoidResult_implicitReturnValue() async {
     Source source = addSource(r'''
 f() {}
 class A {
@@ -1260,108 +1256,125 @@
     var a = f();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_useOfVoidResult_nonVoidReturnValue() {
+  test_useOfVoidResult_nonVoidReturnValue() async {
     Source source = addSource(r'''
 int f() => 1;
 g() {
   var a = f();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+  }
+
+  test_withSuperMixin() async {
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
+    Source source = addSource(r'''
+abstract class A {
+  void test();
+}
+class B extends A {
+  void test() {
+    super.test;
+  }
+}
+''');
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 }
 
 class PubSuggestionCodeTest extends ResolverTestCase {
-  void test_import_package() {
+  test_import_package() async {
     Source source = addSource("import 'package:somepackage/other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
   }
 
-  void test_import_packageWithDotDot() {
+  test_import_packageWithDotDot() async {
     Source source = addSource("import 'package:somepackage/../other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.URI_DOES_NOT_EXIST,
       HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT
     ]);
   }
 
-  void test_import_packageWithLeadingDotDot() {
+  test_import_packageWithLeadingDotDot() async {
     Source source = addSource("import 'package:../other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       CompileTimeErrorCode.URI_DOES_NOT_EXIST,
       HintCode.PACKAGE_IMPORT_CONTAINS_DOT_DOT
     ]);
   }
 
-  void test_import_referenceIntoLibDirectory() {
-    cacheSource("/myproj/pubspec.yaml", "");
-    cacheSource("/myproj/lib/other.dart", "");
+  test_import_referenceIntoLibDirectory() async {
+    addNamedSource("/myproj/pubspec.yaml", "");
+    addNamedSource("/myproj/lib/other.dart", "");
     Source source =
         addNamedSource("/myproj/web/test.dart", "import '../lib/other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [HintCode.FILE_IMPORT_OUTSIDE_LIB_REFERENCES_FILE_INSIDE]);
   }
 
-  void test_import_referenceIntoLibDirectory_no_pubspec() {
-    cacheSource("/myproj/lib/other.dart", "");
+  test_import_referenceIntoLibDirectory_no_pubspec() async {
+    addNamedSource("/myproj/lib/other.dart", "");
     Source source =
         addNamedSource("/myproj/web/test.dart", "import '../lib/other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_import_referenceOutOfLibDirectory() {
-    cacheSource("/myproj/pubspec.yaml", "");
-    cacheSource("/myproj/web/other.dart", "");
+  test_import_referenceOutOfLibDirectory() async {
+    addNamedSource("/myproj/pubspec.yaml", "");
+    addNamedSource("/myproj/web/other.dart", "");
     Source source =
         addNamedSource("/myproj/lib/test.dart", "import '../web/other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [HintCode.FILE_IMPORT_INSIDE_LIB_REFERENCES_FILE_OUTSIDE]);
   }
 
-  void test_import_referenceOutOfLibDirectory_no_pubspec() {
-    cacheSource("/myproj/web/other.dart", "");
+  test_import_referenceOutOfLibDirectory_no_pubspec() async {
+    addNamedSource("/myproj/web/other.dart", "");
     Source source =
         addNamedSource("/myproj/lib/test.dart", "import '../web/other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_import_valid_inside_lib1() {
-    cacheSource("/myproj/pubspec.yaml", "");
-    cacheSource("/myproj/lib/other.dart", "");
+  test_import_valid_inside_lib1() async {
+    addNamedSource("/myproj/pubspec.yaml", "");
+    addNamedSource("/myproj/lib/other.dart", "");
     Source source =
         addNamedSource("/myproj/lib/test.dart", "import 'other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_import_valid_inside_lib2() {
-    cacheSource("/myproj/pubspec.yaml", "");
-    cacheSource("/myproj/lib/bar/other.dart", "");
+  test_import_valid_inside_lib2() async {
+    addNamedSource("/myproj/pubspec.yaml", "");
+    addNamedSource("/myproj/lib/bar/other.dart", "");
     Source source = addNamedSource(
         "/myproj/lib/foo/test.dart", "import '../bar/other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_import_valid_outside_lib() {
-    cacheSource("/myproj/pubspec.yaml", "");
-    cacheSource("/myproj/web/other.dart", "");
+  test_import_valid_outside_lib() async {
+    addNamedSource("/myproj/pubspec.yaml", "");
+    addNamedSource("/myproj/web/other.dart", "");
     Source source =
         addNamedSource("/myproj/lib2/test.dart", "import '../web/other.dart';");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 }
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 87feeb2..77f83b2 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -5,6 +5,7 @@
 library analyzer.test.generated.parser_test;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/error/error.dart';
@@ -732,6 +733,13 @@
         "for (var x : list) {}", [ParserErrorCode.COLON_IN_PLACE_OF_IN]);
   }
 
+  void test_constAndCovariant() {
+    createParser('covariant const C f;');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes([ParserErrorCode.CONST_AND_COVARIANT]);
+  }
+
   void test_constAndFinal() {
     createParser('const final int x;');
     ClassMember member = parser.parseClassMember('C');
@@ -865,14 +873,97 @@
     listener.assertNoErrors();
   }
 
-  void test_deprecatedClassTypeAlias() {
-    ParserTestCase.parseCompilationUnit(
-        "typedef C = S with M;", [ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]);
+  void test_covariantAfterVar() {
+    createParser('var covariant f;');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes([ParserErrorCode.COVARIANT_AFTER_VAR]);
   }
 
-  void test_deprecatedClassTypeAlias_withGeneric() {
-    ParserTestCase.parseCompilationUnit("typedef C<T> = S<T> with M;",
-        [ParserErrorCode.DEPRECATED_CLASS_TYPE_ALIAS]);
+  void test_covariantAndStatic() {
+    createParser('covariant static A f;');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes([ParserErrorCode.COVARIANT_AND_STATIC]);
+  }
+
+  void test_covariantConstructor() {
+    createParser('class C { covariant C(); }');
+    ClassDeclaration member =
+        parser.parseCompilationUnitMember(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes([ParserErrorCode.COVARIANT_CONSTRUCTOR]);
+  }
+
+  void test_covariantMember_getter_noReturnType() {
+    createParser('static covariant get x => 0;');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes([ParserErrorCode.COVARIANT_MEMBER]);
+  }
+
+  void test_covariantMember_getter_returnType() {
+    createParser('static covariant int get x => 0;');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes([ParserErrorCode.COVARIANT_MEMBER]);
+  }
+
+  void test_covariantMember_method() {
+    createParser('covariant int m() => 0;');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes([ParserErrorCode.COVARIANT_MEMBER]);
+  }
+
+  void test_covariantTopLevelDeclaration_class() {
+    createParser('covariant class C {}');
+    ClassDeclaration member =
+        parser.parseCompilationUnitMember(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes(
+        [ParserErrorCode.COVARIANT_TOP_LEVEL_DECLARATION]);
+  }
+
+  void test_covariantTopLevelDeclaration_enum() {
+    createParser('covariant enum E { v }');
+    EnumDeclaration member =
+        parser.parseCompilationUnitMember(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes(
+        [ParserErrorCode.COVARIANT_TOP_LEVEL_DECLARATION]);
+  }
+
+  void test_covariantTopLevelDeclaration_typedef() {
+    ParserTestCase.parseCompilationUnit("covariant typedef F();",
+        [ParserErrorCode.COVARIANT_TOP_LEVEL_DECLARATION]);
+  }
+
+  void test_defaultValueInFunctionType_named_colon() {
+    createParser('int x : 0');
+    FormalParameter parameter =
+        parser.parseFormalParameter(ParameterKind.NAMED, inFunctionType: true);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertErrorsWithCodes(
+        [ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE]);
+  }
+
+  void test_defaultValueInFunctionType_named_equal() {
+    createParser('int x = 0');
+    FormalParameter parameter =
+        parser.parseFormalParameter(ParameterKind.NAMED, inFunctionType: true);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertErrorsWithCodes(
+        [ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE]);
+  }
+
+  void test_defaultValueInFunctionType_positional() {
+    createParser('int x = 0');
+    FormalParameter parameter = parser
+        .parseFormalParameter(ParameterKind.POSITIONAL, inFunctionType: true);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertErrorsWithCodes(
+        [ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE]);
   }
 
   void test_directiveAfterDeclaration_classBeforeDirective() {
@@ -1089,15 +1180,6 @@
         [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER]);
   }
 
-  void test_expectedToken_semicolonAfterClass() {
-    Token token = TokenFactory.tokenFromKeyword(Keyword.CLASS);
-    createParser('A = B with C');
-    ClassTypeAlias declaration =
-        parser.parseClassTypeAlias(emptyCommentAndMetadata(), null, token);
-    expectNotNullIfNoErrors(declaration);
-    listener.assertErrorsWithCodes([ParserErrorCode.EXPECTED_TOKEN]);
-  }
-
   void test_expectedToken_semicolonMissingAfterExport() {
     CompilationUnit unit = ParserTestCase.parseCompilationUnit(
         "export '' class A {}", [ParserErrorCode.EXPECTED_TOKEN]);
@@ -1125,10 +1207,22 @@
         .parseStatement("do {} (x);", [ParserErrorCode.EXPECTED_TOKEN]);
   }
 
+  void test_expectedTypeName_as() {
+    parseExpression("x as", [ParserErrorCode.EXPECTED_TYPE_NAME]);
+  }
+
+  void test_expectedTypeName_as_void() {
+    parseExpression("x as void)", [ParserErrorCode.EXPECTED_TYPE_NAME]);
+  }
+
   void test_expectedTypeName_is() {
     parseExpression("x is", [ParserErrorCode.EXPECTED_TYPE_NAME]);
   }
 
+  void test_expectedTypeName_is_void() {
+    parseExpression("x is void)", [ParserErrorCode.EXPECTED_TYPE_NAME]);
+  }
+
   void test_exportDirectiveAfterPartDirective() {
     ParserTestCase.parseCompilationUnit("part 'a.dart'; export 'b.dart';",
         [ParserErrorCode.EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE]);
@@ -1290,6 +1384,11 @@
         "factory class C {}", [ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION]);
   }
 
+  void test_factoryTopLevelDeclaration_enum() {
+    ParserTestCase.parseCompilationUnit("factory enum E { v }",
+        [ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION]);
+  }
+
   void test_factoryTopLevelDeclaration_typedef() {
     ParserTestCase.parseCompilationUnit("factory typedef F();",
         [ParserErrorCode.FACTORY_TOP_LEVEL_DECLARATION]);
@@ -1317,6 +1416,13 @@
         [ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR]);
   }
 
+  void test_finalAndCovariant() {
+    createParser('covariant final f;');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertErrorsWithCodes([ParserErrorCode.FINAL_AND_COVARIANT]);
+  }
+
   void test_finalAndVar() {
     createParser('final var x;');
     ClassMember member = parser.parseClassMember('C');
@@ -2001,6 +2107,37 @@
     listener.assertErrorsWithCodes([ParserErrorCode.MISSING_METHOD_PARAMETERS]);
   }
 
+  void test_missingNameForNamedParameter_colon() {
+    createParser('int : 0');
+    FormalParameter parameter =
+        parser.parseFormalParameter(ParameterKind.NAMED, inFunctionType: true);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertErrorsWithCodes([
+      ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE,
+      ParserErrorCode.MISSING_NAME_FOR_NAMED_PARAMETER
+    ]);
+  }
+
+  void test_missingNameForNamedParameter_equals() {
+    createParser('int = 0');
+    FormalParameter parameter =
+        parser.parseFormalParameter(ParameterKind.NAMED, inFunctionType: true);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertErrorsWithCodes([
+      ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE,
+      ParserErrorCode.MISSING_NAME_FOR_NAMED_PARAMETER
+    ]);
+  }
+
+  void test_missingNameForNamedParameter_noDefault() {
+    createParser('int');
+    FormalParameter parameter =
+        parser.parseFormalParameter(ParameterKind.NAMED, inFunctionType: true);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertErrorsWithCodes(
+        [ParserErrorCode.MISSING_NAME_FOR_NAMED_PARAMETER]);
+  }
+
   void test_missingNameInLibraryDirective() {
     CompilationUnit unit = ParserTestCase.parseCompilationUnit(
         "library;", [ParserErrorCode.MISSING_NAME_IN_LIBRARY_DIRECTIVE]);
@@ -2383,6 +2520,11 @@
         "static class C {}", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
   }
 
+  void test_staticTopLevelDeclaration_enum() {
+    ParserTestCase.parseCompilationUnit(
+        "static enum E { v }", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
+  }
+
   void test_staticTopLevelDeclaration_function() {
     ParserTestCase.parseCompilationUnit(
         "static f() {}", [ParserErrorCode.STATIC_TOP_LEVEL_DECLARATION]);
@@ -3821,7 +3963,7 @@
     VariableDeclaration field = fields[0];
     expect(field.name.name, 'f');
     // validate the type
-    TypeArgumentList typeArguments = fieldList.type.typeArguments;
+    TypeArgumentList typeArguments = (fieldList.type as TypeName).typeArguments;
     expect(typeArguments.arguments, hasLength(1));
     // synthetic '>'
     Token token = typeArguments.endToken;
@@ -3868,9 +4010,9 @@
     expect(expression.expression, isNotNull);
     expect(expression.isOperator, isNotNull);
     expect(expression.notOperator, isNotNull);
-    TypeName type = expression.type;
+    TypeAnnotation type = expression.type;
     expect(type, isNotNull);
-    expect(type.name.isSynthetic, isTrue);
+    expect(type is TypeName && type.name.isSynthetic, isTrue);
     EngineTestCase.assertInstanceOf((obj) => obj is EmptyStatement,
         EmptyStatement, ifStatement.thenStatement);
   }
@@ -5059,7 +5201,7 @@
   void test_parseAssignableSelector_none() {
     createParser(';');
     Expression expression =
-        parser.parseAssignableSelector(new SimpleIdentifier(null), true);
+        parser.parseAssignableSelector(astFactory.simpleIdentifier(null), true);
     expectNotNullIfNoErrors(expression);
     listener.assertNoErrors();
     expect(expression, new isInstanceOf<SimpleIdentifier>());
@@ -5862,6 +6004,25 @@
     expect(constructor.initializers, hasLength(1));
   }
 
+  void test_parseClassMember_field_covariant() {
+    createParser('covariant T f;');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertNoErrors();
+    expect(member, new isInstanceOf<FieldDeclaration>());
+    FieldDeclaration field = member;
+    expect(field.covariantKeyword, isNotNull);
+    expect(field.documentationComment, isNull);
+    expect(field.metadata, hasLength(0));
+    expect(field.staticKeyword, isNull);
+    VariableDeclarationList list = field.fields;
+    expect(list, isNotNull);
+    NodeList<VariableDeclaration> variables = list.variables;
+    expect(variables, hasLength(1));
+    VariableDeclaration variable = variables[0];
+    expect(variable.name, isNotNull);
+  }
+
   void test_parseClassMember_field_instance_prefixedType() {
     createParser('p.A f;');
     ClassMember member = parser.parseClassMember('C');
@@ -5869,6 +6030,7 @@
     listener.assertNoErrors();
     expect(member, new isInstanceOf<FieldDeclaration>());
     FieldDeclaration field = member;
+    expect(field.covariantKeyword, isNull);
     expect(field.documentationComment, isNull);
     expect(field.metadata, hasLength(0));
     expect(field.staticKeyword, isNull);
@@ -5887,6 +6049,7 @@
     listener.assertNoErrors();
     expect(member, new isInstanceOf<FieldDeclaration>());
     FieldDeclaration field = member;
+    expect(field.covariantKeyword, isNull);
     expect(field.documentationComment, isNull);
     expect(field.metadata, hasLength(0));
     expect(field.staticKeyword, isNull);
@@ -5905,6 +6068,7 @@
     listener.assertNoErrors();
     expect(member, new isInstanceOf<FieldDeclaration>());
     FieldDeclaration field = member;
+    expect(field.covariantKeyword, isNull);
     expect(field.documentationComment, isNull);
     expect(field.metadata, hasLength(0));
     expect(field.staticKeyword, isNull);
@@ -5923,6 +6087,7 @@
     listener.assertNoErrors();
     expect(member, new isInstanceOf<FieldDeclaration>());
     FieldDeclaration field = member;
+    expect(field.covariantKeyword, isNull);
     expect(field.documentationComment, isNull);
     expect(field.metadata, hasLength(0));
     expect(field.staticKeyword, isNull);
@@ -5942,6 +6107,7 @@
     listener.assertNoErrors();
     expect(member, new isInstanceOf<FieldDeclaration>());
     FieldDeclaration field = member;
+    expect(field.covariantKeyword, isNull);
     expect(field.documentationComment, isNull);
     expect(field.metadata, hasLength(0));
     expect(field.staticKeyword, isNull);
@@ -5953,6 +6119,44 @@
     expect(variable.name, isNotNull);
   }
 
+  void test_parseClassMember_field_static() {
+    createParser('static A f;');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertNoErrors();
+    expect(member, new isInstanceOf<FieldDeclaration>());
+    FieldDeclaration field = member;
+    expect(field.covariantKeyword, isNull);
+    expect(field.documentationComment, isNull);
+    expect(field.metadata, hasLength(0));
+    expect(field.staticKeyword, isNotNull);
+    VariableDeclarationList list = field.fields;
+    expect(list, isNotNull);
+    NodeList<VariableDeclaration> variables = list.variables;
+    expect(variables, hasLength(1));
+    VariableDeclaration variable = variables[0];
+    expect(variable.name, isNotNull);
+  }
+
+  @failingTest
+  void test_parseClassMember_getter_functionType() {
+    createParser('int Function(int) get g {}');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertNoErrors();
+    expect(member, new isInstanceOf<MethodDeclaration>());
+    MethodDeclaration method = member;
+    expect(method.documentationComment, isNull);
+    expect(method.externalKeyword, isNull);
+    expect(method.modifierKeyword, isNull);
+    expect(method.propertyKeyword, isNotNull);
+    expect(method.returnType, isNotNull);
+    expect(method.name, isNotNull);
+    expect(method.operatorKeyword, isNull);
+    expect(method.body, isNotNull);
+    expect(method.parameters, isNull);
+  }
+
   void test_parseClassMember_getter_void() {
     createParser('void get g {}');
     ClassMember member = parser.parseClassMember('C');
@@ -6041,7 +6245,7 @@
     expect(method.externalKeyword, isNull);
     expect(method.modifierKeyword, isNull);
     expect(method.propertyKeyword, isNull);
-    expect(method.returnType.name.name, 'T');
+    expect((method.returnType as TypeName).name.name, 'T');
     expect(method.name, isNotNull);
     expect(method.operatorKeyword, isNull);
     expect(method.typeParameters, isNotNull);
@@ -6061,14 +6265,14 @@
     expect(method.externalKeyword, isNull);
     expect(method.modifierKeyword, isNull);
     expect(method.propertyKeyword, isNull);
-    expect(method.returnType.name.name, 'T');
+    expect((method.returnType as TypeName).name.name, 'T');
     expect(method.name, isNotNull);
     expect(method.operatorKeyword, isNull);
     expect(method.typeParameters, isNotNull);
     TypeParameter tp = method.typeParameters.typeParameters[0];
     expect(tp.name.name, 'T');
     expect(tp.extendsKeyword, isNotNull);
-    expect(tp.bound.name.name, 'num');
+    expect((tp.bound as TypeName).name.name, 'num');
     expect(method.parameters, isNotNull);
     expect(method.body, isNotNull);
   }
@@ -6264,6 +6468,27 @@
     expect(method.body, isNotNull);
   }
 
+  @failingTest
+  void test_parseClassMember_method_returnType_functionType() {
+    createParser('int Function(String) m() {}');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertNoErrors();
+    expect(member, new isInstanceOf<MethodDeclaration>());
+    MethodDeclaration method = member;
+    expect(method.documentationComment, isNull);
+    expect(method.externalKeyword, isNull);
+    expect(method.modifierKeyword, isNull);
+    expect(method.propertyKeyword, isNull);
+    expect(method.returnType, isNotNull);
+    expect(method.name, isNotNull);
+    expect(method.name.name, 'm');
+    expect(method.operatorKeyword, isNull);
+    expect(method.typeParameters, isNull);
+    expect(method.parameters, isNotNull);
+    expect(method.body, isNotNull);
+  }
+
   void test_parseClassMember_method_returnType_parameterized() {
     createParser('p.A m() {}');
     ClassMember member = parser.parseClassMember('C');
@@ -6359,6 +6584,30 @@
     expect(method.body, isNotNull);
   }
 
+  @failingTest
+  void test_parseClassMember_operator_functionType() {
+    createParser('int Function() operator +(int Function() f) {}');
+    ClassMember member = parser.parseClassMember('C');
+    expectNotNullIfNoErrors(member);
+    listener.assertNoErrors();
+    expect(member, new isInstanceOf<MethodDeclaration>());
+    MethodDeclaration method = member;
+    expect(method.documentationComment, isNull);
+    expect(method.externalKeyword, isNull);
+    expect(method.modifierKeyword, isNull);
+    expect(method.propertyKeyword, isNull);
+    expect(method.returnType, new isInstanceOf<GenericFunctionType>());
+    expect(method.name, isNotNull);
+    expect(method.operatorKeyword, isNotNull);
+    expect(method.typeParameters, isNull);
+    expect(method.parameters, isNotNull);
+    NodeList<FormalParameter> parameters = method.parameters.parameters;
+    expect(parameters, hasLength(1));
+    expect((parameters[0] as SimpleFormalParameter).type,
+        new isInstanceOf<GenericFunctionType>());
+    expect(method.body, isNotNull);
+  }
+
   void test_parseClassMember_operator_index() {
     createParser('int operator [](int i) {}');
     ClassMember member = parser.parseClassMember('C');
@@ -6437,75 +6686,6 @@
     expect(constructor.body, isNotNull);
   }
 
-  void test_parseClassTypeAlias_abstract() {
-    Token classToken = TokenFactory.tokenFromKeyword(Keyword.CLASS);
-    Token abstractToken = TokenFactory.tokenFromKeyword(Keyword.ABSTRACT);
-    createParser('A = B with C;');
-    ClassTypeAlias classTypeAlias = parser.parseClassTypeAlias(
-        emptyCommentAndMetadata(), abstractToken, classToken);
-    expectNotNullIfNoErrors(classTypeAlias);
-    listener.assertNoErrors();
-    expect(classTypeAlias.typedefKeyword, isNotNull);
-    expect(classTypeAlias.name.name, "A");
-    expect(classTypeAlias.equals, isNotNull);
-    expect(classTypeAlias.abstractKeyword, isNotNull);
-    expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B");
-    expect(classTypeAlias.withClause, isNotNull);
-    expect(classTypeAlias.implementsClause, isNull);
-    expect(classTypeAlias.semicolon, isNotNull);
-  }
-
-  void test_parseClassTypeAlias_implements() {
-    Token classToken = TokenFactory.tokenFromKeyword(Keyword.CLASS);
-    createParser('A = B with C implements D;');
-    ClassTypeAlias classTypeAlias =
-        parser.parseClassTypeAlias(emptyCommentAndMetadata(), null, classToken);
-    expectNotNullIfNoErrors(classTypeAlias);
-    listener.assertNoErrors();
-    expect(classTypeAlias.typedefKeyword, isNotNull);
-    expect(classTypeAlias.name.name, "A");
-    expect(classTypeAlias.equals, isNotNull);
-    expect(classTypeAlias.abstractKeyword, isNull);
-    expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B");
-    expect(classTypeAlias.withClause, isNotNull);
-    expect(classTypeAlias.implementsClause, isNotNull);
-    expect(classTypeAlias.semicolon, isNotNull);
-  }
-
-  void test_parseClassTypeAlias_with() {
-    Token classToken = TokenFactory.tokenFromKeyword(Keyword.CLASS);
-    createParser('A = B with C;');
-    ClassTypeAlias classTypeAlias =
-        parser.parseClassTypeAlias(emptyCommentAndMetadata(), null, classToken);
-    expectNotNullIfNoErrors(classTypeAlias);
-    listener.assertNoErrors();
-    expect(classTypeAlias.typedefKeyword, isNotNull);
-    expect(classTypeAlias.name.name, "A");
-    expect(classTypeAlias.equals, isNotNull);
-    expect(classTypeAlias.abstractKeyword, isNull);
-    expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B");
-    expect(classTypeAlias.withClause, isNotNull);
-    expect(classTypeAlias.implementsClause, isNull);
-    expect(classTypeAlias.semicolon, isNotNull);
-  }
-
-  void test_parseClassTypeAlias_with_implements() {
-    Token classToken = TokenFactory.tokenFromKeyword(Keyword.CLASS);
-    createParser('A = B with C implements D;');
-    ClassTypeAlias classTypeAlias =
-        parser.parseClassTypeAlias(emptyCommentAndMetadata(), null, classToken);
-    expectNotNullIfNoErrors(classTypeAlias);
-    listener.assertNoErrors();
-    expect(classTypeAlias.typedefKeyword, isNotNull);
-    expect(classTypeAlias.name.name, "A");
-    expect(classTypeAlias.equals, isNotNull);
-    expect(classTypeAlias.abstractKeyword, isNull);
-    expect(classTypeAlias.superclass.name.name, isNotNull, reason: "B");
-    expect(classTypeAlias.withClause, isNotNull);
-    expect(classTypeAlias.implementsClause, isNotNull);
-    expect(classTypeAlias.semicolon, isNotNull);
-  }
-
   void test_parseCombinator_hide() {
     createParser('hide a;');
     Combinator combinator = parser.parseCombinator();
@@ -8485,6 +8665,30 @@
     expect(clause.superclass, new isInstanceOf<TypeName>());
   }
 
+  void test_parseFinalConstVarOrType_const_functionType() {
+    createParser('const int Function(int) f');
+    FinalConstVarOrType result = parser.parseFinalConstVarOrType(false);
+    expectNotNullIfNoErrors(result);
+    listener.assertNoErrors();
+    Token keyword = result.keyword;
+    expect(keyword, isNotNull);
+    expect(keyword.type, TokenType.KEYWORD);
+    expect(keyword.keyword, Keyword.CONST);
+    expect(result.type, isNotNull);
+  }
+
+  void test_parseFinalConstVarOrType_const_namedType() {
+    createParser('const A a');
+    FinalConstVarOrType result = parser.parseFinalConstVarOrType(false);
+    expectNotNullIfNoErrors(result);
+    listener.assertNoErrors();
+    Token keyword = result.keyword;
+    expect(keyword, isNotNull);
+    expect(keyword.type, TokenType.KEYWORD);
+    expect(keyword.keyword, Keyword.CONST);
+    expect(result.type, isNotNull);
+  }
+
   void test_parseFinalConstVarOrType_const_noType() {
     createParser('const');
     FinalConstVarOrType result = parser.parseFinalConstVarOrType(false);
@@ -8497,15 +8701,27 @@
     expect(result.type, isNull);
   }
 
-  void test_parseFinalConstVarOrType_const_type() {
-    createParser('const A a');
+  void test_parseFinalConstVarOrType_final_functionType() {
+    createParser('final int Function(int) f');
     FinalConstVarOrType result = parser.parseFinalConstVarOrType(false);
     expectNotNullIfNoErrors(result);
     listener.assertNoErrors();
     Token keyword = result.keyword;
     expect(keyword, isNotNull);
     expect(keyword.type, TokenType.KEYWORD);
-    expect(keyword.keyword, Keyword.CONST);
+    expect(keyword.keyword, Keyword.FINAL);
+    expect(result.type, isNotNull);
+  }
+
+  void test_parseFinalConstVarOrType_final_namedType() {
+    createParser('final A a');
+    FinalConstVarOrType result = parser.parseFinalConstVarOrType(false);
+    expectNotNullIfNoErrors(result);
+    listener.assertNoErrors();
+    Token keyword = result.keyword;
+    expect(keyword, isNotNull);
+    expect(keyword.type, TokenType.KEYWORD);
+    expect(keyword.keyword, Keyword.FINAL);
     expect(result.type, isNotNull);
   }
 
@@ -8533,15 +8749,12 @@
     expect(result.type, isNotNull);
   }
 
-  void test_parseFinalConstVarOrType_final_type() {
-    createParser('final A a');
+  void test_parseFinalConstVarOrType_type_function() {
+    createParser('int Function(int) f');
     FinalConstVarOrType result = parser.parseFinalConstVarOrType(false);
     expectNotNullIfNoErrors(result);
     listener.assertNoErrors();
-    Token keyword = result.keyword;
-    expect(keyword, isNotNull);
-    expect(keyword.type, TokenType.KEYWORD);
-    expect(keyword.keyword, Keyword.FINAL);
+    expect(result.keyword, isNull);
     expect(result.type, isNotNull);
   }
 
@@ -8590,6 +8803,16 @@
     expect(result.type, isNotNull);
   }
 
+  void test_parseFinalConstVarOrType_type_simple_noIdentifier_inFunctionType() {
+    createParser('A,');
+    FinalConstVarOrType result =
+        parser.parseFinalConstVarOrType(false, inFunctionType: true);
+    expectNotNullIfNoErrors(result);
+    listener.assertNoErrors();
+    expect(result.keyword, isNull);
+    expect(result.type, isNotNull);
+  }
+
   void test_parseFinalConstVarOrType_var() {
     createParser('var');
     FinalConstVarOrType result = parser.parseFinalConstVarOrType(false);
@@ -8620,7 +8843,298 @@
     expect(result.type, isNotNull);
   }
 
-  void test_parseFormalParameter_final_withType_named() {
+  void test_parseFormalParameter_covariant_final_named() {
+    ParameterKind kind = ParameterKind.NAMED;
+    createParser('covariant final a : null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_final_normal() {
+    ParameterKind kind = ParameterKind.REQUIRED;
+    createParser('covariant final a');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_final_positional() {
+    ParameterKind kind = ParameterKind.POSITIONAL;
+    createParser('covariant final a = null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_final_type_named() {
+    ParameterKind kind = ParameterKind.NAMED;
+    createParser('covariant final A a : null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNotNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_final_type_normal() {
+    ParameterKind kind = ParameterKind.REQUIRED;
+    createParser('covariant final A a');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNotNull);
+    expect(simpleParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_final_type_positional() {
+    ParameterKind kind = ParameterKind.POSITIONAL;
+    createParser('covariant final A a = null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNotNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  @failingTest
+  void test_parseFormalParameter_covariant_type_function() {
+    ParameterKind kind = ParameterKind.REQUIRED;
+    createParser('covariant String Function(int) a');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNull);
+    expect(simpleParameter.type, new isInstanceOf<GenericFunctionType>());
+    expect(simpleParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_type_named() {
+    ParameterKind kind = ParameterKind.NAMED;
+    createParser('covariant A a : null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNull);
+    expect(simpleParameter.type, isNotNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_type_normal() {
+    ParameterKind kind = ParameterKind.REQUIRED;
+    createParser('covariant A<B<C>> a');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNull);
+    expect(simpleParameter.type, isNotNull);
+    expect(simpleParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_type_positional() {
+    ParameterKind kind = ParameterKind.POSITIONAL;
+    createParser('covariant A a = null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNull);
+    expect(simpleParameter.type, isNotNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_var_named() {
+    ParameterKind kind = ParameterKind.NAMED;
+    createParser('covariant var a : null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_var_normal() {
+    ParameterKind kind = ParameterKind.REQUIRED;
+    createParser('covariant var a');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_covariant_var_positional() {
+    ParameterKind kind = ParameterKind.POSITIONAL;
+    createParser('covariant var a = null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNotNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_final_named() {
+    ParameterKind kind = ParameterKind.NAMED;
+    createParser('final a : null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_final_normal() {
+    ParameterKind kind = ParameterKind.REQUIRED;
+    createParser('final a');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_final_positional() {
+    ParameterKind kind = ParameterKind.POSITIONAL;
+    createParser('final a = null');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter defaultParameter = parameter;
+    SimpleFormalParameter simpleParameter =
+        defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+    expect(defaultParameter.separator, isNotNull);
+    expect(defaultParameter.defaultValue, isNotNull);
+    expect(defaultParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_final_type_named() {
     ParameterKind kind = ParameterKind.NAMED;
     createParser('final A a : null');
     FormalParameter parameter = parser.parseFormalParameter(kind);
@@ -8630,6 +9144,7 @@
     DefaultFormalParameter defaultParameter = parameter;
     SimpleFormalParameter simpleParameter =
         defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNull);
     expect(simpleParameter.identifier, isNotNull);
     expect(simpleParameter.keyword, isNotNull);
     expect(simpleParameter.type, isNotNull);
@@ -8639,7 +9154,7 @@
     expect(defaultParameter.kind, kind);
   }
 
-  void test_parseFormalParameter_final_withType_normal() {
+  void test_parseFormalParameter_final_type_normal() {
     ParameterKind kind = ParameterKind.REQUIRED;
     createParser('final A a');
     FormalParameter parameter = parser.parseFormalParameter(kind);
@@ -8647,13 +9162,14 @@
     listener.assertNoErrors();
     expect(parameter, new isInstanceOf<SimpleFormalParameter>());
     SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNull);
     expect(simpleParameter.identifier, isNotNull);
     expect(simpleParameter.keyword, isNotNull);
     expect(simpleParameter.type, isNotNull);
     expect(simpleParameter.kind, kind);
   }
 
-  void test_parseFormalParameter_final_withType_positional() {
+  void test_parseFormalParameter_final_type_positional() {
     ParameterKind kind = ParameterKind.POSITIONAL;
     createParser('final A a = null');
     FormalParameter parameter = parser.parseFormalParameter(kind);
@@ -8663,6 +9179,7 @@
     DefaultFormalParameter defaultParameter = parameter;
     SimpleFormalParameter simpleParameter =
         defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNull);
     expect(simpleParameter.identifier, isNotNull);
     expect(simpleParameter.keyword, isNotNull);
     expect(simpleParameter.type, isNotNull);
@@ -8672,7 +9189,23 @@
     expect(defaultParameter.kind, kind);
   }
 
-  void test_parseFormalParameter_nonFinal_withType_named() {
+  @failingTest
+  void test_parseFormalParameter_type_function() {
+    ParameterKind kind = ParameterKind.REQUIRED;
+    createParser('String Function(int) a');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNull);
+    expect(simpleParameter.type, new isInstanceOf<GenericFunctionType>());
+    expect(simpleParameter.kind, kind);
+  }
+
+  void test_parseFormalParameter_type_named() {
     ParameterKind kind = ParameterKind.NAMED;
     createParser('A a : null');
     FormalParameter parameter = parser.parseFormalParameter(kind);
@@ -8682,6 +9215,7 @@
     DefaultFormalParameter defaultParameter = parameter;
     SimpleFormalParameter simpleParameter =
         defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNull);
     expect(simpleParameter.identifier, isNotNull);
     expect(simpleParameter.keyword, isNull);
     expect(simpleParameter.type, isNotNull);
@@ -8691,7 +9225,7 @@
     expect(defaultParameter.kind, kind);
   }
 
-  void test_parseFormalParameter_nonFinal_withType_normal() {
+  void test_parseFormalParameter_type_normal() {
     ParameterKind kind = ParameterKind.REQUIRED;
     createParser('A a');
     FormalParameter parameter = parser.parseFormalParameter(kind);
@@ -8699,13 +9233,14 @@
     listener.assertNoErrors();
     expect(parameter, new isInstanceOf<SimpleFormalParameter>());
     SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNull);
     expect(simpleParameter.identifier, isNotNull);
     expect(simpleParameter.keyword, isNull);
     expect(simpleParameter.type, isNotNull);
     expect(simpleParameter.kind, kind);
   }
 
-  void test_parseFormalParameter_nonFinal_withType_positional() {
+  void test_parseFormalParameter_type_positional() {
     ParameterKind kind = ParameterKind.POSITIONAL;
     createParser('A a = null');
     FormalParameter parameter = parser.parseFormalParameter(kind);
@@ -8715,6 +9250,7 @@
     DefaultFormalParameter defaultParameter = parameter;
     SimpleFormalParameter simpleParameter =
         defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNull);
     expect(simpleParameter.identifier, isNotNull);
     expect(simpleParameter.keyword, isNull);
     expect(simpleParameter.type, isNotNull);
@@ -8724,20 +9260,6 @@
     expect(defaultParameter.kind, kind);
   }
 
-  void test_parseFormalParameter_var() {
-    ParameterKind kind = ParameterKind.REQUIRED;
-    createParser('var a');
-    FormalParameter parameter = parser.parseFormalParameter(kind);
-    expectNotNullIfNoErrors(parameter);
-    listener.assertNoErrors();
-    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
-    SimpleFormalParameter simpleParameter = parameter;
-    expect(simpleParameter.identifier, isNotNull);
-    expect(simpleParameter.keyword, isNotNull);
-    expect(simpleParameter.type, isNull);
-    expect(simpleParameter.kind, kind);
-  }
-
   void test_parseFormalParameter_var_named() {
     ParameterKind kind = ParameterKind.NAMED;
     createParser('var a : null');
@@ -8748,6 +9270,7 @@
     DefaultFormalParameter defaultParameter = parameter;
     SimpleFormalParameter simpleParameter =
         defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNull);
     expect(simpleParameter.identifier, isNotNull);
     expect(simpleParameter.keyword, isNotNull);
     expect(simpleParameter.type, isNull);
@@ -8757,6 +9280,21 @@
     expect(defaultParameter.kind, kind);
   }
 
+  void test_parseFormalParameter_var_normal() {
+    ParameterKind kind = ParameterKind.REQUIRED;
+    createParser('var a');
+    FormalParameter parameter = parser.parseFormalParameter(kind);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNull);
+    expect(simpleParameter.identifier, isNotNull);
+    expect(simpleParameter.keyword, isNotNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.kind, kind);
+  }
+
   void test_parseFormalParameter_var_positional() {
     ParameterKind kind = ParameterKind.POSITIONAL;
     createParser('var a = null');
@@ -8767,6 +9305,7 @@
     DefaultFormalParameter defaultParameter = parameter;
     SimpleFormalParameter simpleParameter =
         defaultParameter.parameter as SimpleFormalParameter;
+    expect(simpleParameter.covariantKeyword, isNull);
     expect(simpleParameter.identifier, isNotNull);
     expect(simpleParameter.keyword, isNotNull);
     expect(simpleParameter.type, isNull);
@@ -8848,6 +9387,34 @@
     expect(list.rightParenthesis, isNotNull);
   }
 
+  void test_parseFormalParameterList_normal_named_inFunctionType() {
+    createParser('(A, {B b})');
+    FormalParameterList list =
+        parser.parseFormalParameterList(inFunctionType: true);
+    expectNotNullIfNoErrors(list);
+    listener.assertNoErrors();
+    expect(list.leftParenthesis, isNotNull);
+    expect(list.leftDelimiter, isNotNull);
+    expect(list.rightDelimiter, isNotNull);
+    expect(list.rightParenthesis, isNotNull);
+    NodeList<FormalParameter> parameters = list.parameters;
+    expect(parameters, hasLength(2));
+
+    expect(parameters[0], new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter required = parameters[0];
+    expect(required.identifier, isNull);
+    expect(required.type, new isInstanceOf<TypeName>());
+    expect((required.type as TypeName).name.name, 'A');
+
+    expect(parameters[1], new isInstanceOf<DefaultFormalParameter>());
+    DefaultFormalParameter named = parameters[1];
+    expect(named.identifier, isNotNull);
+    expect(named.parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simple = named.parameter;
+    expect(simple.type, new isInstanceOf<TypeName>());
+    expect((simple.type as TypeName).name.name, 'B');
+  }
+
   void test_parseFormalParameterList_normal_positional() {
     createParser('(A a, [B b])');
     FormalParameterList list = parser.parseFormalParameterList();
@@ -8872,6 +9439,18 @@
     expect(list.rightParenthesis, isNotNull);
   }
 
+  void test_parseFormalParameterList_normal_single_Function() {
+    createParser('(Function f)');
+    FormalParameterList list = parser.parseFormalParameterList();
+    expectNotNullIfNoErrors(list);
+    listener.assertNoErrors();
+    expect(list.leftParenthesis, isNotNull);
+    expect(list.leftDelimiter, isNull);
+    expect(list.parameters, hasLength(1));
+    expect(list.rightDelimiter, isNull);
+    expect(list.rightParenthesis, isNotNull);
+  }
+
   void test_parseFormalParameterList_normal_single_trailing_comma() {
     createParser('(A a,)');
     FormalParameterList list = parser.parseFormalParameterList();
@@ -9416,8 +9995,9 @@
   }
 
   void test_parseFunctionDeclaration_function() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('f() {}');
     FunctionDeclaration declaration = parser.parseFunctionDeclaration(
         commentAndMetadata(comment), null, returnType);
@@ -9435,8 +10015,9 @@
   }
 
   void test_parseFunctionDeclaration_functionWithTypeParameters() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('f<E>() {}');
     FunctionDeclaration declaration = parser.parseFunctionDeclaration(
         commentAndMetadata(comment), null, returnType);
@@ -9455,8 +10036,9 @@
 
   void test_parseFunctionDeclaration_functionWithTypeParameters_comment() {
     enableGenericMethodComments = true;
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('f/*<E>*/() {}');
     FunctionDeclaration declaration = parser.parseFunctionDeclaration(
         commentAndMetadata(comment), null, returnType);
@@ -9474,8 +10056,9 @@
   }
 
   void test_parseFunctionDeclaration_getter() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('get p => 0;');
     FunctionDeclaration declaration = parser.parseFunctionDeclaration(
         commentAndMetadata(comment), null, returnType);
@@ -9493,8 +10076,9 @@
   }
 
   void test_parseFunctionDeclaration_setter() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('set p(v) {}');
     FunctionDeclaration declaration = parser.parseFunctionDeclaration(
         commentAndMetadata(comment), null, returnType);
@@ -9593,9 +10177,40 @@
     expect((expression.body as ExpressionFunctionBody).semicolon, isNull);
   }
 
+  @failingTest
+  void test_parseGenericTypeAlias_noTypeParameters() {
+    createParser('F = int Function(int);');
+    GenericTypeAlias alias =
+        parser.parseGenericTypeAlias(emptyCommentAndMetadata(), null);
+    expectNotNullIfNoErrors(alias);
+    listener.assertNoErrors();
+    expect(alias.name, isNotNull);
+    expect(alias.name.name, 'F');
+    expect(alias.typeParameters, isNull);
+    expect(alias.equals, isNotNull);
+    expect(alias.functionType, isNotNull);
+    expect(alias.semicolon, isNotNull);
+  }
+
+  @failingTest
+  void test_parseGenericTypeAlias_typeParameters() {
+    createParser('F<T> = T Function(T);');
+    GenericTypeAlias alias =
+        parser.parseGenericTypeAlias(emptyCommentAndMetadata(), null);
+    expectNotNullIfNoErrors(alias);
+    listener.assertNoErrors();
+    expect(alias.name, isNotNull);
+    expect(alias.name.name, 'F');
+    expect(alias.typeParameters, isNotNull);
+    expect(alias.equals, isNotNull);
+    expect(alias.functionType, isNotNull);
+    expect(alias.semicolon, isNotNull);
+  }
+
   void test_parseGetter_nonStatic() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('get a;');
     MethodDeclaration method =
         parser.parseGetter(commentAndMetadata(comment), null, null, returnType);
@@ -9613,9 +10228,10 @@
   }
 
   void test_parseGetter_static() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
     Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('get a => 42;');
     MethodDeclaration method = parser.parseGetter(
         commentAndMetadata(comment), null, staticKeyword, returnType);
@@ -9864,12 +10480,13 @@
   }
 
   void test_parseInitializedIdentifierList_type() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
     Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
-    TypeName type = new TypeName(new SimpleIdentifier(null), null);
+    TypeName type =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser("a = 1, b, c = 3;");
     FieldDeclaration declaration = parser.parseInitializedIdentifierList(
-        commentAndMetadata(comment), staticKeyword, null, type);
+        commentAndMetadata(comment), staticKeyword, null, null, type);
     expectNotNullIfNoErrors(declaration);
     listener.assertNoErrors();
     expect(declaration.documentationComment, comment);
@@ -9883,12 +10500,12 @@
   }
 
   void test_parseInitializedIdentifierList_var() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
     Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
     Token varKeyword = TokenFactory.tokenFromKeyword(Keyword.VAR);
     createParser('a = 1, b, c = 3;');
     FieldDeclaration declaration = parser.parseInitializedIdentifierList(
-        commentAndMetadata(comment), staticKeyword, varKeyword, null);
+        commentAndMetadata(comment), staticKeyword, null, varKeyword, null);
     expectNotNullIfNoErrors(declaration);
     listener.assertNoErrors();
     expect(declaration.documentationComment, comment);
@@ -10141,9 +10758,9 @@
     expect(name.period, isNull);
     expect(name.name, isNull);
     expect(expression.argumentList, isNotNull);
-    NodeList<TypeName> arguments = type.typeArguments.arguments;
+    NodeList<TypeAnnotation> arguments = type.typeArguments.arguments;
     expect(arguments, hasLength(1));
-    expect(arguments[0].question, isNotNull);
+    expect((arguments[0] as TypeName).question, isNotNull);
   }
 
   void test_parseLibraryDirective() {
@@ -10406,6 +11023,14 @@
     expect(modifiers.constKeyword, isNotNull);
   }
 
+  void test_parseModifiers_covariant() {
+    createParser('covariant A');
+    Modifiers modifiers = parser.parseModifiers();
+    expectNotNullIfNoErrors(modifiers);
+    listener.assertNoErrors();
+    expect(modifiers.covariantKeyword, isNotNull);
+  }
+
   void test_parseModifiers_external() {
     createParser('external A');
     Modifiers modifiers = parser.parseModifiers();
@@ -11050,6 +11675,19 @@
     expect(simpleParameter.identifier, isNotNull);
   }
 
+  void test_parseNormalFormalParameter_simple_noName() {
+    createParser('a)');
+    NormalFormalParameter parameter =
+        parser.parseNormalFormalParameter(inFunctionType: true);
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.keyword, isNull);
+    expect(simpleParameter.type, isNotNull);
+    expect(simpleParameter.identifier, isNull);
+  }
+
   void test_parseNormalFormalParameter_simple_noType() {
     createParser('a)');
     NormalFormalParameter parameter = parser.parseNormalFormalParameter();
@@ -11062,6 +11700,19 @@
     expect(simpleParameter.identifier, isNotNull);
   }
 
+  void test_parseNormalFormalParameter_simple_noType_namedCovariant() {
+    createParser('covariant)');
+    NormalFormalParameter parameter = parser.parseNormalFormalParameter();
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter, new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter simpleParameter = parameter;
+    expect(simpleParameter.covariantKeyword, isNull);
+    expect(simpleParameter.keyword, isNull);
+    expect(simpleParameter.type, isNull);
+    expect(simpleParameter.identifier, isNotNull);
+  }
+
   void test_parseNormalFormalParameter_simple_type() {
     createParser('A a)');
     NormalFormalParameter parameter = parser.parseNormalFormalParameter();
@@ -11075,8 +11726,9 @@
   }
 
   void test_parseOperator() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('operator +(A a);');
     MethodDeclaration method =
         parser.parseOperator(commentAndMetadata(comment), null, returnType);
@@ -11595,8 +12247,9 @@
     expect(invocation.period, isNull);
   }
 
-  void test_parseRelationalExpression_as() {
-    createParser('x as Y');
+  @failingTest
+  void test_parseRelationalExpression_as_functionType_noReturnType() {
+    createParser('x as Function(int)');
     Expression expression = parser.parseRelationalExpression();
     expectNotNullIfNoErrors(expression);
     listener.assertNoErrors();
@@ -11604,7 +12257,32 @@
     AsExpression asExpression = expression;
     expect(asExpression.expression, isNotNull);
     expect(asExpression.asOperator, isNotNull);
-    expect(asExpression.type, isNotNull);
+    expect(asExpression.type, new isInstanceOf<GenericFunctionType>());
+  }
+
+  @failingTest
+  void test_parseRelationalExpression_as_functionType_returnType() {
+    createParser('x as String Function(int)');
+    Expression expression = parser.parseRelationalExpression();
+    expectNotNullIfNoErrors(expression);
+    listener.assertNoErrors();
+    expect(expression, new isInstanceOf<AsExpression>());
+    AsExpression asExpression = expression;
+    expect(asExpression.expression, isNotNull);
+    expect(asExpression.asOperator, isNotNull);
+    expect(asExpression.type, new isInstanceOf<GenericFunctionType>());
+  }
+
+  void test_parseRelationalExpression_as_generic() {
+    createParser('x as C<D>');
+    Expression expression = parser.parseRelationalExpression();
+    expectNotNullIfNoErrors(expression);
+    listener.assertNoErrors();
+    expect(expression, new isInstanceOf<AsExpression>());
+    AsExpression asExpression = expression;
+    expect(asExpression.expression, isNotNull);
+    expect(asExpression.asOperator, isNotNull);
+    expect(asExpression.type, new isInstanceOf<TypeName>());
   }
 
   void test_parseRelationalExpression_as_nullable() {
@@ -11617,7 +12295,31 @@
     AsExpression asExpression = expression;
     expect(asExpression.expression, isNotNull);
     expect(asExpression.asOperator, isNotNull);
-    expect(asExpression.type, isNotNull);
+    expect(asExpression.type, new isInstanceOf<TypeName>());
+  }
+
+  void test_parseRelationalExpression_as_simple() {
+    createParser('x as Y');
+    Expression expression = parser.parseRelationalExpression();
+    expectNotNullIfNoErrors(expression);
+    listener.assertNoErrors();
+    expect(expression, new isInstanceOf<AsExpression>());
+    AsExpression asExpression = expression;
+    expect(asExpression.expression, isNotNull);
+    expect(asExpression.asOperator, isNotNull);
+    expect(asExpression.type, new isInstanceOf<TypeName>());
+  }
+
+  void test_parseRelationalExpression_as_simple_function() {
+    createParser('x as Function');
+    Expression expression = parser.parseRelationalExpression();
+    expectNotNullIfNoErrors(expression);
+    listener.assertNoErrors();
+    expect(expression, new isInstanceOf<AsExpression>());
+    AsExpression asExpression = expression;
+    expect(asExpression.expression, isNotNull);
+    expect(asExpression.asOperator, isNotNull);
+    expect(asExpression.type, new isInstanceOf<TypeName>());
   }
 
   void test_parseRelationalExpression_is() {
@@ -11714,9 +12416,20 @@
     expect(statement.semicolon, isNotNull);
   }
 
-  void test_parseReturnType_nonVoid() {
+  @failingTest
+  void test_parseReturnType_function() {
+    createParser('A<B> Function<B>(B)');
+    GenericFunctionType type = parser.parseReturnType(false);
+    expectNotNullIfNoErrors(type);
+    listener.assertNoErrors();
+    expect(type.returnType, isNotNull);
+    expect(type.typeParameters, isNotNull);
+    expect(type.parameters, isNotNull);
+  }
+
+  void test_parseReturnType_named() {
     createParser('A<B>');
-    TypeName typeName = parser.parseReturnType();
+    TypeName typeName = parser.parseReturnType(false);
     expectNotNullIfNoErrors(typeName);
     listener.assertNoErrors();
     expect(typeName.name, isNotNull);
@@ -11725,7 +12438,7 @@
 
   void test_parseReturnType_void() {
     createParser('void');
-    TypeName typeName = parser.parseReturnType();
+    TypeName typeName = parser.parseReturnType(false);
     expectNotNullIfNoErrors(typeName);
     listener.assertNoErrors();
     expect(typeName.name, isNotNull);
@@ -11733,8 +12446,9 @@
   }
 
   void test_parseSetter_nonStatic() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('set a(var x);');
     MethodDeclaration method =
         parser.parseSetter(commentAndMetadata(comment), null, null, returnType);
@@ -11753,9 +12467,10 @@
   }
 
   void test_parseSetter_static() {
-    Comment comment = Comment.createDocumentationComment(new List<Token>(0));
+    Comment comment = astFactory.documentationComment(new List<Token>(0));
     Token staticKeyword = TokenFactory.tokenFromKeyword(Keyword.STATIC);
-    TypeName returnType = new TypeName(new SimpleIdentifier(null), null);
+    TypeName returnType =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('set a(var x) {}');
     MethodDeclaration method = parser.parseSetter(
         commentAndMetadata(comment), null, staticKeyword, returnType);
@@ -12628,6 +13343,414 @@
     expect(typeAlias.typeParameters, isNull);
   }
 
+  @failingTest
+  void test_parseTypeAlias_genericFunction_noParameters() {
+    createParser('typedef F = bool Function();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_noReturnType() {
+    createParser('typedef F = Function();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_parameterizedReturnType() {
+    createParser('typedef F = A<B> Function();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_parameters() {
+    createParser('typedef F = bool Function(Object value);');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_typeParameters() {
+    createParser('typedef F = bool Function<E>();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNotNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_typeParameters_noParameters() {
+    createParser('typedef F<T> = bool Function();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNotNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_typeParameters_noReturnType() {
+    createParser('typedef F<T> = Function();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNotNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void
+      test_parseTypeAlias_genericFunction_typeParameters_parameterizedReturnType() {
+    createParser('typedef F<T> = A<B> Function();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNotNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_typeParameters_parameters() {
+    createParser('typedef F<T> = bool Function(Object value);');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNotNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_typeParameters_typeParameters() {
+    createParser('typedef F<T> = bool Function<E>();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNotNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNotNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_typeParameters_voidReturnType() {
+    createParser('typedef F<T> = void Function();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNotNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void test_parseTypeAlias_genericFunction_voidReturnType() {
+    createParser('typedef F = void Function();');
+    GenericTypeAlias typeAlias =
+        parser.parseTypeAlias(emptyCommentAndMetadata());
+    expectNotNullIfNoErrors(typeAlias);
+    listener.assertNoErrors();
+    expect(typeAlias.typedefKeyword, isNotNull);
+    expect(typeAlias.name, isNotNull);
+    expect(typeAlias.typeParameters, isNull);
+    expect(typeAlias.semicolon, isNotNull);
+    GenericFunctionType functionType = typeAlias.functionType;
+    expect(functionType, isNotNull);
+    expect(functionType.parameters, isNotNull);
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.typeParameters, isNull);
+  }
+
+  @failingTest
+  void test_parseTypeAnnotation_function_noReturnType_noParameters() {
+    createParser('Function() v');
+    GenericFunctionType functionType = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+    expect(functionType.returnType, isNull);
+    expect(functionType.functionKeyword, isNotNull);
+    expect(functionType.typeParameters, isNull);
+    FormalParameterList parameterList = functionType.parameters;
+    expect(parameterList, isNotNull);
+    expect(parameterList.parameters, hasLength(0));
+  }
+
+  @failingTest
+  void test_parseTypeAnnotation_function_noReturnType_parameters() {
+    createParser('Function(int, int) v');
+    GenericFunctionType functionType = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+    expect(functionType.returnType, isNull);
+    expect(functionType.functionKeyword, isNotNull);
+    expect(functionType.typeParameters, isNull);
+    FormalParameterList parameterList = functionType.parameters;
+    expect(parameterList, isNotNull);
+    NodeList<FormalParameter> parameters = parameterList.parameters;
+    expect(parameters, hasLength(2));
+
+    expect(parameters[0], new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter parameter = parameters[0];
+    expect(parameter.identifier, isNull);
+    expect(parameter.type, new isInstanceOf<TypeName>());
+    expect((parameter.type as TypeName).name.name, 'int');
+
+    expect(parameters[1], new isInstanceOf<SimpleFormalParameter>());
+    parameter = parameters[1];
+    expect(parameter.identifier, isNull);
+    expect(parameter.type, new isInstanceOf<TypeName>());
+    expect((parameter.type as TypeName).name.name, 'int');
+  }
+
+  @failingTest
+  void test_parseTypeAnnotation_function_noReturnType_typeParameters() {
+    createParser('Function<S, T>()');
+    GenericFunctionType functionType = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+    expect(functionType.returnType, isNull);
+    expect(functionType.functionKeyword, isNotNull);
+    TypeParameterList typeParameters = functionType.typeParameters;
+    expect(typeParameters, isNotNull);
+    expect(typeParameters.typeParameters, hasLength(2));
+    FormalParameterList parameterList = functionType.parameters;
+    expect(parameterList, isNotNull);
+    expect(parameterList.parameters, hasLength(0));
+  }
+
+  @failingTest
+  void
+      test_parseTypeAnnotation_function_noReturnType_typeParameters_parameters() {
+    createParser('Function<T>(String, {T t})');
+    GenericFunctionType functionType = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+    expect(functionType.returnType, isNull);
+    expect(functionType.functionKeyword, isNotNull);
+    TypeParameterList typeParameters = functionType.typeParameters;
+    expect(typeParameters, isNotNull);
+    expect(typeParameters.typeParameters, hasLength(1));
+    FormalParameterList parameterList = functionType.parameters;
+    expect(parameterList, isNotNull);
+    expect(parameterList.parameters, hasLength(2));
+  }
+
+  void test_parseTypeAnnotation_function_returnType_classFunction() {
+    createParser('Function v');
+    TypeName functionType = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+  }
+
+  @failingTest
+  void test_parseTypeAnnotation_function_returnType_function() {
+    createParser('A Function(B, C) Function(D) v');
+    // TODO(scheglov) improve the test to verify also the node properties
+    var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType;
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+  }
+
+  @failingTest
+  void test_parseTypeAnnotation_function_returnType_noParameters() {
+    createParser('List<int> Function()');
+    GenericFunctionType functionType = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.functionKeyword, isNotNull);
+    expect(functionType.typeParameters, isNull);
+    FormalParameterList parameterList = functionType.parameters;
+    expect(parameterList, isNotNull);
+    expect(parameterList.parameters, hasLength(0));
+  }
+
+  @failingTest
+  void test_parseTypeAnnotation_function_returnType_parameters() {
+    createParser('List<int> Function(String s, int i)');
+    GenericFunctionType functionType = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.functionKeyword, isNotNull);
+    expect(functionType.typeParameters, isNull);
+    FormalParameterList parameterList = functionType.parameters;
+    expect(parameterList, isNotNull);
+    NodeList<FormalParameter> parameters = parameterList.parameters;
+    expect(parameters, hasLength(2));
+
+    expect(parameters[0], new isInstanceOf<SimpleFormalParameter>());
+    SimpleFormalParameter parameter = parameters[0];
+    expect(parameter.identifier, isNotNull);
+    expect(parameter.identifier.name, 's');
+    expect(parameter.type, new isInstanceOf<TypeName>());
+    expect((parameter.type as TypeName).name.name, 'String');
+
+    expect(parameters[1], new isInstanceOf<SimpleFormalParameter>());
+    parameter = parameters[1];
+    expect(parameter.identifier, isNotNull);
+    expect(parameter.identifier.name, 'i');
+    expect(parameter.type, new isInstanceOf<TypeName>());
+    expect((parameter.type as TypeName).name.name, 'int');
+  }
+
+  @failingTest
+  void test_parseTypeAnnotation_function_returnType_simple() {
+    createParser('A Function(B, C) v');
+    // TODO(scheglov) improve the test to verify also the node properties
+    var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType;
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+  }
+
+  @failingTest
+  void test_parseTypeAnnotation_function_returnType_typeParameters() {
+    createParser('List<T> Function<T>()');
+    GenericFunctionType functionType = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.functionKeyword, isNotNull);
+    TypeParameterList typeParameters = functionType.typeParameters;
+    expect(typeParameters, isNotNull);
+    expect(typeParameters.typeParameters, hasLength(1));
+    FormalParameterList parameterList = functionType.parameters;
+    expect(parameterList, isNotNull);
+    expect(parameterList.parameters, hasLength(0));
+  }
+
+  @failingTest
+  void
+      test_parseTypeAnnotation_function_returnType_typeParameters_parameters() {
+    createParser('List<T> Function<T>(String s, [T])');
+    GenericFunctionType functionType = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+    expect(functionType.returnType, isNotNull);
+    expect(functionType.functionKeyword, isNotNull);
+    TypeParameterList typeParameters = functionType.typeParameters;
+    expect(typeParameters, isNotNull);
+    expect(typeParameters.typeParameters, hasLength(1));
+    FormalParameterList parameterList = functionType.parameters;
+    expect(parameterList, isNotNull);
+    expect(parameterList.parameters, hasLength(2));
+  }
+
+  @failingTest
+  void test_parseTypeAnnotation_function_returnType_withArguments() {
+    createParser('A<B> Function(C) v');
+    // TODO(scheglov) improve this test to verify also the node properties
+    var functionType = parser.parseTypeAnnotation(false) as GenericFunctionType;
+    expectNotNullIfNoErrors(functionType);
+    listener.assertNoErrors();
+  }
+
+  void test_parseTypeAnnotation_named() {
+    createParser('A<B> v');
+    TypeName typeName = parser.parseTypeAnnotation(false);
+    expectNotNullIfNoErrors(typeName);
+    listener.assertNoErrors();
+  }
+
   void test_parseTypeArgumentList_empty() {
     createParser('<>');
     TypeArgumentList argumentList = parser.parseTypeArgumentList();
@@ -12764,12 +13887,34 @@
     expect(typeName.question, isNotNull);
   }
 
-  void test_parseTypeParameter_bounded() {
-    createParser('A extends B');
+  @failingTest
+  void test_parseTypeParameter_bounded_functionType_noReturn() {
+    createParser('A extends Function(int)');
     TypeParameter parameter = parser.parseTypeParameter();
     expectNotNullIfNoErrors(parameter);
     listener.assertNoErrors();
-    expect(parameter.bound, isNotNull);
+    expect(parameter.bound, new isInstanceOf<GenericFunctionType>());
+    expect(parameter.extendsKeyword, isNotNull);
+    expect(parameter.name, isNotNull);
+  }
+
+  @failingTest
+  void test_parseTypeParameter_bounded_functionType_return() {
+    createParser('A extends String Function(int)');
+    TypeParameter parameter = parser.parseTypeParameter();
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter.bound, new isInstanceOf<GenericFunctionType>());
+    expect(parameter.extendsKeyword, isNotNull);
+    expect(parameter.name, isNotNull);
+  }
+
+  void test_parseTypeParameter_bounded_generic() {
+    createParser('A extends B<C>');
+    TypeParameter parameter = parser.parseTypeParameter();
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter.bound, new isInstanceOf<TypeName>());
     expect(parameter.extendsKeyword, isNotNull);
     expect(parameter.name, isNotNull);
   }
@@ -12780,7 +13925,7 @@
     TypeParameter parameter = parser.parseTypeParameter();
     expectNotNullIfNoErrors(parameter);
     listener.assertNoErrors();
-    expect(parameter.bound, isNotNull);
+    expect(parameter.bound, new isInstanceOf<TypeName>());
     expect(parameter.extendsKeyword, isNotNull);
     expect(parameter.name, isNotNull);
     TypeName bound = parameter.bound;
@@ -12788,6 +13933,16 @@
     expect(bound.question, isNotNull);
   }
 
+  void test_parseTypeParameter_bounded_simple() {
+    createParser('A extends B');
+    TypeParameter parameter = parser.parseTypeParameter();
+    expectNotNullIfNoErrors(parameter);
+    listener.assertNoErrors();
+    expect(parameter.bound, new isInstanceOf<TypeName>());
+    expect(parameter.extendsKeyword, isNotNull);
+    expect(parameter.name, isNotNull);
+  }
+
   void test_parseTypeParameter_simple() {
     createParser('A');
     TypeParameter parameter = parser.parseTypeParameter();
@@ -13061,7 +14216,7 @@
         .parseVariableDeclarationListAfterMetadata(emptyCommentAndMetadata());
     expectNotNullIfNoErrors(declarationList);
     listener.assertNoErrors();
-    expect(declarationList.type.name.name, 'T');
+    expect((declarationList.type as TypeName).name.name, 'T');
     expect(declarationList.isFinal, true);
   }
 
@@ -13116,12 +14271,13 @@
         .parseVariableDeclarationListAfterMetadata(emptyCommentAndMetadata());
     expectNotNullIfNoErrors(declarationList);
     listener.assertNoErrors();
-    expect(declarationList.type.name.name, 'T');
+    expect((declarationList.type as TypeName).name.name, 'T');
     expect(declarationList.keyword, isNull);
   }
 
   void test_parseVariableDeclarationListAfterType_type() {
-    TypeName type = new TypeName(new SimpleIdentifier(null), null);
+    TypeName type =
+        astFactory.typeName(astFactory.simpleIdentifier(null), null);
     createParser('a');
     VariableDeclarationList declarationList =
         parser.parseVariableDeclarationListAfterType(
diff --git a/pkg/analyzer/test/generated/resolver_driver_test.dart b/pkg/analyzer/test/generated/resolver_driver_test.dart
new file mode 100644
index 0000000..74af34f
--- /dev/null
+++ b/pkg/analyzer/test/generated/resolver_driver_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'resolver_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(StrictModeTest_Driver);
+    defineReflectiveTests(TypePropagationTest_Driver);
+  });
+}
+
+@reflectiveTest
+class StrictModeTest_Driver extends StrictModeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
+
+@reflectiveTest
+class TypePropagationTest_Driver extends TypePropagationTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 416f980..957d94c 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -4,9 +4,12 @@
 
 library analyzer.test.generated.resolver_test;
 
+import 'dart:async';
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -144,7 +147,7 @@
 
 @reflectiveTest
 class EnclosedScopeTest extends ResolverTestCase {
-  void test_define_duplicate() {
+  test_define_duplicate() async {
     Scope rootScope = new _RootScope();
     EnclosedScope scope = new EnclosedScope(rootScope);
     SimpleIdentifier identifier = AstTestFactory.identifier3('v');
@@ -158,7 +161,7 @@
 
 @reflectiveTest
 class ErrorResolverTest extends ResolverTestCase {
-  void test_breakLabelOnSwitchMember() {
+  test_breakLabelOnSwitchMember() async {
     Source source = addSource(r'''
 class A {
   void m(int i) {
@@ -170,12 +173,12 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ResolverErrorCode.BREAK_LABEL_ON_SWITCH_MEMBER]);
     verify([source]);
   }
 
-  void test_continueLabelOnSwitch() {
+  test_continueLabelOnSwitch() async {
     Source source = addSource(r'''
 class A {
   void m(int i) {
@@ -185,12 +188,12 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [ResolverErrorCode.CONTINUE_LABEL_ON_SWITCH]);
     verify([source]);
   }
 
-  void test_enclosingElement_invalidLocalFunction() {
+  test_enclosingElement_invalidLocalFunction() async {
     Source source = addSource(r'''
 class C {
   C() {
@@ -215,6 +218,7 @@
     expect(functions, isNotNull);
     expect(functions, hasLength(1));
     expect(functions[0].enclosingElement, constructor);
+    await computeAnalysisResult(source);
     assertErrors(source, [ParserErrorCode.GETTER_IN_FUNCTION]);
   }
 }
@@ -224,7 +228,7 @@
  */
 @reflectiveTest
 class GenericMethodResolverTest extends StaticTypeAnalyzer2TestShared {
-  void test_genericMethod_propagatedType_promotion() {
+  test_genericMethod_propagatedType_promotion() async {
     // Regression test for:
     // https://github.com/dart-lang/sdk/issues/25340
     //
@@ -233,7 +237,7 @@
     // therefore discard the propagated type.
     //
     // So this test does not use strong mode.
-    resolveTestUnit(r'''
+    await resolveTestUnit(r'''
 abstract class Iter {
   List<S> map<S>(S f(x));
 }
@@ -407,9 +411,9 @@
   List<Expression> _invalidlyPropagatedExpressions = new List<Expression>();
 
   /**
-   * A list containing all of the AST TypeName nodes that were not resolved.
+   * The TypeAnnotation nodes that were not resolved.
    */
-  List<TypeName> _unresolvedTypes = new List<TypeName>();
+  List<TypeAnnotation> _unresolvedTypes = new List<TypeAnnotation>();
 
   /**
    * Counter for the number of Expression nodes visited that are resolved.
@@ -439,7 +443,7 @@
         buffer.write(" of ");
         buffer.write(_resolvedTypeCount + unresolvedTypeCount);
         buffer.writeln(" type names:");
-        for (TypeName identifier in _unresolvedTypes) {
+        for (TypeAnnotation identifier in _unresolvedTypes) {
           buffer.write("  ");
           buffer.write(identifier.toString());
           buffer.write(" (");
@@ -478,9 +482,12 @@
           buffer.write("  ");
           buffer.write(expression.toString());
           buffer.write(" [");
-          buffer.write(expression.staticType.displayName);
+          buffer.write(
+              resolutionMap.staticTypeForExpression(expression).displayName);
           buffer.write(", ");
-          buffer.write(expression.propagatedType.displayName);
+          buffer.write(resolutionMap
+              .propagatedTypeForExpression(expression)
+              .displayName);
           buffer.writeln("]");
           buffer.write("    ");
           buffer.write(_getFileName(expression));
@@ -537,7 +544,8 @@
   Object visitPrefixedIdentifier(PrefixedIdentifier node) {
     // In cases where we have a prefixed identifier where the prefix is dynamic,
     // we don't want to assert that the node will have a type.
-    if (node.staticType == null && node.prefix.staticType.isDynamic) {
+    if (node.staticType == null &&
+        resolutionMap.staticTypeForExpression(node.prefix).isDynamic) {
       return null;
     }
     return super.visitPrefixedIdentifier(node);
@@ -569,9 +577,21 @@
   }
 
   @override
+  Object visitTypeAnnotation(TypeAnnotation node) {
+    if (node.type == null) {
+      _unresolvedTypes.add(node);
+    } else {
+      _resolvedTypeCount++;
+    }
+    return super.visitTypeAnnotation(node);
+  }
+
+  @override
   Object visitTypeName(TypeName node) {
     // Note: do not visit children from this node, the child SimpleIdentifier in
     // TypeName (i.e. "String") does not have a static type defined.
+    // TODO(brianwilkerson) Not visiting the children means that we won't catch
+    // type arguments that were not resolved.
     if (node.type == null) {
       _unresolvedTypes.add(node);
     } else {
@@ -588,7 +608,10 @@
       if (root is CompilationUnit) {
         CompilationUnit rootCU = root;
         if (rootCU.element != null) {
-          return rootCU.element.source.fullName;
+          return resolutionMap
+              .elementDeclaredByCompilationUnit(rootCU)
+              .source
+              .fullName;
         } else {
           return "<unknown file- CompilationUnit.getElement() returned null>";
         }
@@ -606,7 +629,7 @@
  */
 @reflectiveTest
 class StrictModeTest extends ResolverTestCase {
-  void fail_for() {
+  fail_for() async {
     Source source = addSource(r'''
 int f(List<int> list) {
   num sum = 0;
@@ -614,7 +637,7 @@
     sum += list[i];
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
@@ -622,56 +645,56 @@
   void setUp() {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.hint = false;
-    resetWithOptions(options);
+    resetWith(options: options);
   }
 
-  void test_assert_is() {
+  test_assert_is() async {
     Source source = addSource(r'''
 int f(num n) {
   assert (n is int);
   return n & 0x0F;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_conditional_and_is() {
+  test_conditional_and_is() async {
     Source source = addSource(r'''
 int f(num n) {
   return (n is int && n > 0) ? n & 0x0F : 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_conditional_is() {
+  test_conditional_is() async {
     Source source = addSource(r'''
 int f(num n) {
   return (n is int) ? n & 0x0F : 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_conditional_isNot() {
+  test_conditional_isNot() async {
     Source source = addSource(r'''
 int f(num n) {
   return (n is! int) ? 0 : n & 0x0F;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_conditional_or_is() {
+  test_conditional_or_is() async {
     Source source = addSource(r'''
 int f(num n) {
   return (n is! int || n < 0) ? 0 : n & 0x0F;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_forEach() {
+  test_forEach() async {
     Source source = addSource(r'''
 int f(List<int> list) {
   num sum = 0;
@@ -679,11 +702,11 @@
     sum += n & 0x0F;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_if_and_is() {
+  test_if_and_is() async {
     Source source = addSource(r'''
 int f(num n) {
   if (n is int && n > 0) {
@@ -691,11 +714,11 @@
   }
   return 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_if_is() {
+  test_if_is() async {
     Source source = addSource(r'''
 int f(num n) {
   if (n is int) {
@@ -703,11 +726,11 @@
   }
   return 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_if_isNot() {
+  test_if_isNot() async {
     Source source = addSource(r'''
 int f(num n) {
   if (n is! int) {
@@ -716,11 +739,11 @@
     return n & 0x0F;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_if_isNot_abrupt() {
+  test_if_isNot_abrupt() async {
     Source source = addSource(r'''
 int f(num n) {
   if (n is! int) {
@@ -728,11 +751,11 @@
   }
   return n & 0x0F;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_if_or_is() {
+  test_if_or_is() async {
     Source source = addSource(r'''
 int f(num n) {
   if (n is! int || n < 0) {
@@ -741,17 +764,17 @@
     return n & 0x0F;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_localVar() {
+  test_localVar() async {
     Source source = addSource(r'''
 int f() {
   num n = 1234;
   return n & 0x0F;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 }
@@ -921,10 +944,9 @@
 
 @reflectiveTest
 class TypePropagationTest extends ResolverTestCase {
-  void fail_mergePropagatedTypesAtJoinPoint_1() {
+  fail_mergePropagatedTypesAtJoinPoint_1() async {
     // https://code.google.com/p/dart/issues/detail?id=19929
-    assertTypeOfMarkedExpression(
-        r'''
+    var code = r'''
 f1(x) {
   var y = [];
   if (x) {
@@ -935,15 +957,14 @@
   // Propagated type is [List] here: incorrect.
   // Best we can do is [Object]?
   return y; // marker
-}''',
-        null,
-        typeProvider.dynamicType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.dynamicType);
   }
 
-  void fail_mergePropagatedTypesAtJoinPoint_2() {
+  fail_mergePropagatedTypesAtJoinPoint_2() async {
     // https://code.google.com/p/dart/issues/detail?id=19929
-    assertTypeOfMarkedExpression(
-        r'''
+    var code = r'''
 f2(x) {
   var y = [];
   if (x) {
@@ -953,15 +974,14 @@
   // Propagated type is [List] here: incorrect.
   // Best we can do is [Object]?
   return y; // marker
-}''',
-        null,
-        typeProvider.dynamicType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.dynamicType);
   }
 
-  void fail_mergePropagatedTypesAtJoinPoint_3() {
+  fail_mergePropagatedTypesAtJoinPoint_3() async {
     // https://code.google.com/p/dart/issues/detail?id=19929
-    assertTypeOfMarkedExpression(
-        r'''
+    var code = r'''
 f4(x) {
   var y = [];
   if (x) {
@@ -973,15 +993,14 @@
   // A correct answer is the least upper bound of [int] and [double],
   // i.e. [num].
   return y; // marker
-}''',
-        null,
-        typeProvider.numType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.numType);
   }
 
-  void fail_mergePropagatedTypesAtJoinPoint_5() {
+  fail_mergePropagatedTypesAtJoinPoint_5() async {
     // https://code.google.com/p/dart/issues/detail?id=19929
-    assertTypeOfMarkedExpression(
-        r'''
+    var code = r'''
 f6(x,y) {
   var z = [];
   if (x || (z = y) < 0) {
@@ -991,12 +1010,12 @@
   // Propagated type is [List] here: incorrect.
   // Best we can do is [Object]?
   return z; // marker
-}''',
-        null,
-        typeProvider.dynamicType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.dynamicType);
   }
 
-  void fail_mergePropagatedTypesAtJoinPoint_7() {
+  fail_mergePropagatedTypesAtJoinPoint_7() async {
     // https://code.google.com/p/dart/issues/detail?id=19929
     //
     // In general [continue]s are unsafe for the purposes of
@@ -1020,12 +1039,14 @@
     x; // marker
   }
 }''';
-    DartType t = findMarkedIdentifier(code, "; // marker").propagatedType;
+    CompilationUnit unit = await resolveSource(code);
+    DartType t =
+        findMarkedIdentifier(code, unit, "; // marker").propagatedType;
     expect(typeProvider.intType.isSubtypeOf(t), isTrue);
     expect(typeProvider.stringType.isSubtypeOf(t), isTrue);
   }
 
-  void fail_mergePropagatedTypesAtJoinPoint_8() {
+  fail_mergePropagatedTypesAtJoinPoint_8() async {
     // https://code.google.com/p/dart/issues/detail?id=19929
     //
     // In nested loops [breaks]s are unsafe for the purposes of
@@ -1052,22 +1073,25 @@
     }
   }
 }''';
-    DartType t = findMarkedIdentifier(code, "; // marker").propagatedType;
+    CompilationUnit unit = await resolveSource(code);
+    DartType t =
+        findMarkedIdentifier(code, unit, "; // marker").propagatedType;
     expect(typeProvider.intType.isSubtypeOf(t), isTrue);
     expect(typeProvider.stringType.isSubtypeOf(t), isTrue);
   }
 
-  void fail_propagatedReturnType_functionExpression() {
+  fail_propagatedReturnType_functionExpression() async {
     // TODO(scheglov) disabled because we don't resolve function expression
     String code = r'''
 main() {
   var v = (() {return 42;})();
 }''';
+    CompilationUnit unit = await resolveSource(code);
     assertPropagatedAssignedType(
-        code, typeProvider.dynamicType, typeProvider.intType);
+        code, unit, typeProvider.dynamicType, typeProvider.intType);
   }
 
-  void test_as() {
+  test_as() async {
     Source source = addSource(r'''
 class A {
   bool get g => true;
@@ -1079,12 +1103,10 @@
     return null;
   }
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1095,19 +1117,17 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_assert() {
+  test_assert() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
   assert (p is A);
   return p;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1116,45 +1136,39 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_assignment() {
+  test_assignment() async {
     Source source = addSource(r'''
 f() {
   var v;
   v = 0;
   return v;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
     ReturnStatement statement = body.block.statements[2] as ReturnStatement;
     SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
-    expect(variableName.propagatedType, same(typeProvider.intType));
+    expect(variableName.propagatedType, typeProvider.intType);
   }
 
-  void test_assignment_afterInitializer() {
+  test_assignment_afterInitializer() async {
     Source source = addSource(r'''
 f() {
   var v = 0;
   v = 1.0;
   return v;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
     ReturnStatement statement = body.block.statements[2] as ReturnStatement;
     SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
-    expect(variableName.propagatedType, same(typeProvider.doubleType));
+    expect(variableName.propagatedType, typeProvider.doubleType);
   }
 
-  void test_assignment_null() {
+  test_assignment_null() async {
     String code = r'''
 main() {
   int v; // declare
@@ -1164,48 +1178,62 @@
     CompilationUnit unit;
     {
       Source source = addSource(code);
-      LibraryElement library = resolve2(source);
+      TestAnalysisResult analysisResult = await computeAnalysisResult(source);
       assertNoErrors(source);
       verify([source]);
-      unit = resolveCompilationUnit(source, library);
+      unit = analysisResult.unit;
     }
     {
       SimpleIdentifier identifier = EngineTestCase.findNode(
           unit, code, "v; // declare", (node) => node is SimpleIdentifier);
-      expect(identifier.staticType, same(typeProvider.intType));
-      expect(identifier.propagatedType, same(null));
+      expect(identifier.staticType, typeProvider.intType);
+      expect(identifier.propagatedType, isNull);
     }
     {
       SimpleIdentifier identifier = EngineTestCase.findNode(
           unit, code, "v = null;", (node) => node is SimpleIdentifier);
-      expect(identifier.staticType, same(typeProvider.intType));
-      expect(identifier.propagatedType, same(null));
+      expect(identifier.staticType, typeProvider.intType);
+      expect(identifier.propagatedType, isNull);
     }
     {
       SimpleIdentifier identifier = EngineTestCase.findNode(
           unit, code, "v; // return", (node) => node is SimpleIdentifier);
-      expect(identifier.staticType, same(typeProvider.intType));
-      expect(identifier.propagatedType, same(null));
+      expect(identifier.staticType, typeProvider.intType);
+      expect(identifier.propagatedType, isNull);
     }
   }
 
-  void test_CanvasElement_getContext() {
+  test_assignment_throwExpression() async {
+    Source source = addSource(r'''
+f() {
+  var v = 1;
+  v = throw 2;
+  return v;
+}''');
+    CompilationUnit unit = await _computeResolvedUnit(source, noErrors: false);
+    FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
+    BlockFunctionBody body =
+        function.functionExpression.body as BlockFunctionBody;
+    ReturnStatement statement = body.block.statements[2] as ReturnStatement;
+    SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
+    expect(variableName.propagatedType, typeProvider.intType);
+  }
+
+  test_CanvasElement_getContext() async {
     String code = r'''
 import 'dart:html';
 main(CanvasElement canvas) {
   var context = canvas.getContext('2d');
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     SimpleIdentifier identifier = EngineTestCase.findNode(
         unit, code, "context", (node) => node is SimpleIdentifier);
-    expect(identifier.propagatedType.name, "CanvasRenderingContext2D");
+    expect(resolutionMap.propagatedTypeForExpression(identifier).name,
+        "CanvasRenderingContext2D");
   }
 
-  void test_forEach() {
+  test_forEach() async {
     String code = r'''
 main() {
   var list = <String> [];
@@ -1214,26 +1242,22 @@
   }
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
-    InterfaceType stringType = typeProvider.stringType;
+    CompilationUnit unit = await _computeResolvedUnit(source);
     // in the declaration
     {
       SimpleIdentifier identifier = EngineTestCase.findNode(
           unit, code, "e in", (node) => node is SimpleIdentifier);
-      expect(identifier.propagatedType, same(stringType));
+      expect(identifier.propagatedType, typeProvider.stringType);
     }
     // in the loop body
     {
       SimpleIdentifier identifier = EngineTestCase.findNode(
           unit, code, "e;", (node) => node is SimpleIdentifier);
-      expect(identifier.propagatedType, same(stringType));
+      expect(identifier.propagatedType, typeProvider.stringType);
     }
   }
 
-  void test_forEach_async() {
+  test_forEach_async() async {
     String code = r'''
 import 'dart:async';
 f(Stream<String> stream) async {
@@ -1242,26 +1266,22 @@
   }
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
-    InterfaceType stringType = typeProvider.stringType;
+    CompilationUnit unit = await _computeResolvedUnit(source);
     // in the declaration
     {
       SimpleIdentifier identifier = EngineTestCase.findNode(
           unit, code, "e in", (node) => node is SimpleIdentifier);
-      expect(identifier.propagatedType, same(stringType));
+      expect(identifier.propagatedType, typeProvider.stringType);
     }
     // in the loop body
     {
       SimpleIdentifier identifier = EngineTestCase.findNode(
           unit, code, "e;", (node) => node is SimpleIdentifier);
-      expect(identifier.propagatedType, same(stringType));
+      expect(identifier.propagatedType, typeProvider.stringType);
     }
   }
 
-  void test_forEach_async_inheritedStream() {
+  test_forEach_async_inheritedStream() async {
     // From https://github.com/dart-lang/sdk/issues/24191, this ensures that
     // `await for` works for types where the generic parameter doesn't
     // correspond to the type of the Stream's data.
@@ -1274,10 +1294,7 @@
   }
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     InterfaceType listOfStringType =
         typeProvider.listType.instantiate([typeProvider.stringType]);
     // in the declaration
@@ -1294,7 +1311,7 @@
     }
   }
 
-  void test_functionExpression_asInvocationArgument() {
+  test_functionExpression_asInvocationArgument() async {
     String code = r'''
 class MyMap<K, V> {
   forEach(f(K key, V value)) {}
@@ -1306,31 +1323,26 @@
   });
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     // k
-    DartType intType = typeProvider.intType;
     FormalParameter kParameter = EngineTestCase.findNode(
         unit, code, "k, ", (node) => node is SimpleFormalParameter);
-    expect(kParameter.identifier.propagatedType, same(intType));
+    expect(kParameter.identifier.propagatedType, typeProvider.intType);
     SimpleIdentifier kIdentifier = EngineTestCase.findNode(
         unit, code, "k;", (node) => node is SimpleIdentifier);
-    expect(kIdentifier.propagatedType, same(intType));
-    expect(kIdentifier.staticType, same(typeProvider.dynamicType));
+    expect(kIdentifier.propagatedType, typeProvider.intType);
+    expect(kIdentifier.staticType, typeProvider.dynamicType);
     // v
-    DartType stringType = typeProvider.stringType;
     FormalParameter vParameter = EngineTestCase.findNode(
         unit, code, "v)", (node) => node is SimpleFormalParameter);
-    expect(vParameter.identifier.propagatedType, same(stringType));
+    expect(vParameter.identifier.propagatedType, typeProvider.stringType);
     SimpleIdentifier vIdentifier = EngineTestCase.findNode(
         unit, code, "v;", (node) => node is SimpleIdentifier);
-    expect(vIdentifier.propagatedType, same(stringType));
-    expect(vIdentifier.staticType, same(typeProvider.dynamicType));
+    expect(vIdentifier.propagatedType, typeProvider.stringType);
+    expect(vIdentifier.staticType, typeProvider.dynamicType);
   }
 
-  void test_functionExpression_asInvocationArgument_fromInferredInvocation() {
+  test_functionExpression_asInvocationArgument_fromInferredInvocation() async {
     String code = r'''
 class MyMap<K, V> {
   forEach(f(K key, V value)) {}
@@ -1340,24 +1352,18 @@
   m2.forEach((k, v) {});
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     // k
-    DartType intType = typeProvider.intType;
     FormalParameter kParameter = EngineTestCase.findNode(
         unit, code, "k, ", (node) => node is SimpleFormalParameter);
-    expect(kParameter.identifier.propagatedType, same(intType));
+    expect(kParameter.identifier.propagatedType, typeProvider.intType);
     // v
-    DartType stringType = typeProvider.stringType;
     FormalParameter vParameter = EngineTestCase.findNode(
         unit, code, "v)", (node) => node is SimpleFormalParameter);
-    expect(vParameter.identifier.propagatedType, same(stringType));
+    expect(vParameter.identifier.propagatedType, typeProvider.stringType);
   }
 
-  void
-      test_functionExpression_asInvocationArgument_functionExpressionInvocation() {
+  test_functionExpression_asInvocationArgument_functionExpressionInvocation() async {
     String code = r'''
 main() {
   (f(String value)) {} ((v) {
@@ -1365,24 +1371,19 @@
   });
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     // v
-    DartType dynamicType = typeProvider.dynamicType;
-    DartType stringType = typeProvider.stringType;
     FormalParameter vParameter = EngineTestCase.findNode(
         unit, code, "v)", (node) => node is FormalParameter);
-    expect(vParameter.identifier.propagatedType, same(stringType));
-    expect(vParameter.identifier.staticType, same(dynamicType));
+    expect(vParameter.identifier.propagatedType, typeProvider.stringType);
+    expect(vParameter.identifier.staticType, typeProvider.dynamicType);
     SimpleIdentifier vIdentifier = EngineTestCase.findNode(
         unit, code, "v;", (node) => node is SimpleIdentifier);
-    expect(vIdentifier.propagatedType, same(stringType));
-    expect(vIdentifier.staticType, same(dynamicType));
+    expect(vIdentifier.propagatedType, typeProvider.stringType);
+    expect(vIdentifier.staticType, typeProvider.dynamicType);
   }
 
-  void test_functionExpression_asInvocationArgument_keepIfLessSpecific() {
+  test_functionExpression_asInvocationArgument_keepIfLessSpecific() async {
     String code = r'''
 class MyList {
   forEach(f(Object value)) {}
@@ -1393,23 +1394,19 @@
   });
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     // v
-    DartType intType = typeProvider.intType;
     FormalParameter vParameter = EngineTestCase.findNode(
         unit, code, "v)", (node) => node is SimpleFormalParameter);
-    expect(vParameter.identifier.propagatedType, same(null));
-    expect(vParameter.identifier.staticType, same(intType));
+    expect(vParameter.identifier.propagatedType, isNull);
+    expect(vParameter.identifier.staticType, typeProvider.intType);
     SimpleIdentifier vIdentifier = EngineTestCase.findNode(
         unit, code, "v;", (node) => node is SimpleIdentifier);
-    expect(vIdentifier.staticType, same(intType));
-    expect(vIdentifier.propagatedType, same(null));
+    expect(vIdentifier.staticType, typeProvider.intType);
+    expect(vIdentifier.propagatedType, isNull);
   }
 
-  void test_functionExpression_asInvocationArgument_notSubtypeOfStaticType() {
+  test_functionExpression_asInvocationArgument_notSubtypeOfStaticType() async {
     String code = r'''
 class A {
   m(void f(int i)) {}
@@ -1419,19 +1416,17 @@
   a.m(() => 0);
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
+    CompilationUnit unit = await _computeResolvedUnit(source, noErrors: false);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
     // () => 0
     FunctionExpression functionExpression = EngineTestCase.findNode(
         unit, code, "() => 0)", (node) => node is FunctionExpression);
     expect((functionExpression.staticType as FunctionType).parameters.length,
         same(0));
-    expect(functionExpression.propagatedType, same(null));
+    expect(functionExpression.propagatedType, isNull);
   }
 
-  void test_functionExpression_asInvocationArgument_replaceIfMoreSpecific() {
+  test_functionExpression_asInvocationArgument_replaceIfMoreSpecific() async {
     String code = r'''
 class MyList<E> {
   forEach(f(E value)) {}
@@ -1442,22 +1437,18 @@
   });
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     // v
-    DartType stringType = typeProvider.stringType;
     FormalParameter vParameter = EngineTestCase.findNode(
         unit, code, "v)", (node) => node is SimpleFormalParameter);
-    expect(vParameter.identifier.propagatedType, same(stringType));
-    expect(vParameter.identifier.staticType, same(typeProvider.objectType));
+    expect(vParameter.identifier.propagatedType, typeProvider.stringType);
+    expect(vParameter.identifier.staticType, typeProvider.objectType);
     SimpleIdentifier vIdentifier = EngineTestCase.findNode(
         unit, code, "v;", (node) => node is SimpleIdentifier);
-    expect(vIdentifier.propagatedType, same(stringType));
+    expect(vIdentifier.propagatedType, typeProvider.stringType);
   }
 
-  void test_Future_then() {
+  test_Future_then() async {
     String code = r'''
 import 'dart:async';
 main(Future<int> firstFuture) {
@@ -1469,34 +1460,28 @@
   });
 }''';
     Source source = addSource(code);
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     // p1
     FormalParameter p1 = EngineTestCase.findNode(
         unit, code, "p1) {", (node) => node is SimpleFormalParameter);
-    expect(p1.identifier.propagatedType, same(typeProvider.intType));
+    expect(p1.identifier.propagatedType, typeProvider.intType);
     // p2
     FormalParameter p2 = EngineTestCase.findNode(
         unit, code, "p2) {", (node) => node is SimpleFormalParameter);
-    expect(p2.identifier.propagatedType, same(typeProvider.doubleType));
+    expect(p2.identifier.propagatedType, typeProvider.doubleType);
     // p3
     FormalParameter p3 = EngineTestCase.findNode(
         unit, code, "p3) {", (node) => node is SimpleFormalParameter);
-    expect(p3.identifier.propagatedType, same(typeProvider.stringType));
+    expect(p3.identifier.propagatedType, typeProvider.stringType);
   }
 
-  void test_initializer() {
+  test_initializer() async {
     Source source = addSource(r'''
 f() {
   var v = 0;
   return v;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1506,25 +1491,24 @@
       VariableDeclarationStatement statement =
           statements[0] as VariableDeclarationStatement;
       SimpleIdentifier variableName = statement.variables.variables[0].name;
-      expect(variableName.staticType, same(typeProvider.dynamicType));
-      expect(variableName.propagatedType, same(typeProvider.intType));
+      expect(variableName.staticType, typeProvider.dynamicType);
+      expect(variableName.propagatedType, typeProvider.intType);
     }
     // Type of 'v' in reference.
     {
       ReturnStatement statement = statements[1] as ReturnStatement;
       SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
-      expect(variableName.propagatedType, same(typeProvider.intType));
+      expect(variableName.propagatedType, typeProvider.intType);
     }
   }
 
-  void test_initializer_dereference() {
+  test_initializer_dereference() async {
     Source source = addSource(r'''
 f() {
   var v = 'String';
   v.
 }''');
-    LibraryElement library = resolve2(source);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source, noErrors: false);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1532,19 +1516,16 @@
         body.block.statements[1] as ExpressionStatement;
     PrefixedIdentifier invocation = statement.expression as PrefixedIdentifier;
     SimpleIdentifier variableName = invocation.prefix;
-    expect(variableName.propagatedType, same(typeProvider.stringType));
+    expect(variableName.propagatedType, typeProvider.stringType);
   }
 
-  void test_initializer_hasStaticType() {
+  test_initializer_hasStaticType() async {
     Source source = addSource(r'''
 f() {
   int v = 0;
   return v;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1554,28 +1535,25 @@
       VariableDeclarationStatement statement =
           statements[0] as VariableDeclarationStatement;
       SimpleIdentifier variableName = statement.variables.variables[0].name;
-      expect(variableName.staticType, same(typeProvider.intType));
+      expect(variableName.staticType, typeProvider.intType);
       expect(variableName.propagatedType, isNull);
     }
     // Type of 'v' in reference.
     {
       ReturnStatement statement = statements[1] as ReturnStatement;
       SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
-      expect(variableName.staticType, same(typeProvider.intType));
+      expect(variableName.staticType, typeProvider.intType);
       expect(variableName.propagatedType, isNull);
     }
   }
 
-  void test_initializer_hasStaticType_parameterized() {
+  test_initializer_hasStaticType_parameterized() async {
     Source source = addSource(r'''
 f() {
   List<int> v = <int>[];
   return v;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1597,7 +1575,7 @@
     }
   }
 
-  void test_initializer_null() {
+  test_initializer_null() async {
     String code = r'''
 main() {
   int v = null;
@@ -1606,26 +1584,38 @@
     CompilationUnit unit;
     {
       Source source = addSource(code);
-      LibraryElement library = resolve2(source);
-      assertNoErrors(source);
-      verify([source]);
-      unit = resolveCompilationUnit(source, library);
+      unit = await _computeResolvedUnit(source);
     }
     {
       SimpleIdentifier identifier = EngineTestCase.findNode(
           unit, code, "v = null;", (node) => node is SimpleIdentifier);
-      expect(identifier.staticType, same(typeProvider.intType));
-      expect(identifier.propagatedType, same(null));
+      expect(identifier.staticType, typeProvider.intType);
+      expect(identifier.propagatedType, isNull);
     }
     {
       SimpleIdentifier identifier = EngineTestCase.findNode(
           unit, code, "v; // marker", (node) => node is SimpleIdentifier);
-      expect(identifier.staticType, same(typeProvider.intType));
-      expect(identifier.propagatedType, same(null));
+      expect(identifier.staticType, typeProvider.intType);
+      expect(identifier.propagatedType, isNull);
     }
   }
 
-  void test_invocation_target_prefixed() {
+  test_initializer_throwExpression() async {
+    Source source = addSource(r'''
+f() {
+  var v = throw 2;
+  return v;
+}''');
+    CompilationUnit unit = await _computeResolvedUnit(source, noErrors: false);
+    FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
+    BlockFunctionBody body =
+        function.functionExpression.body as BlockFunctionBody;
+    var statement = body.block.statements[0] as VariableDeclarationStatement;
+    SimpleIdentifier variableName = statement.variables.variables[0].name;
+    expect(variableName.propagatedType, isNull);
+  }
+
+  test_invocation_target_prefixed() async {
     addNamedSource(
         '/helper.dart',
         '''
@@ -1637,25 +1627,24 @@
 main() {
   helper.max(10, 10); // marker
 }''';
+    CompilationUnit unit = await resolveSource(code);
     SimpleIdentifier methodName =
-        findMarkedIdentifier(code, "(10, 10); // marker");
+        findMarkedIdentifier(code, unit, "(10, 10); // marker");
     MethodInvocation methodInvoke = methodName.parent;
     expect(methodInvoke.methodName.staticElement, isNotNull);
     expect(methodInvoke.methodName.propagatedElement, isNull);
   }
 
-  void test_is_conditional() {
+  test_is_conditional() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
   return (p is A) ? p : null;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1667,7 +1656,7 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_is_if() {
+  test_is_if() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
@@ -1677,15 +1666,12 @@
     return null;
   }
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     // prepare A
     InterfaceType typeA;
     {
       ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-      typeA = classA.element.type;
+      typeA = resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     }
     // verify "f"
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
@@ -1707,7 +1693,7 @@
     }
   }
 
-  void test_is_if_lessSpecific() {
+  test_is_if_lessSpecific() async {
     Source source = addSource(r'''
 class A {}
 A f(A p) {
@@ -1717,12 +1703,7 @@
     return null;
   }
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
-//    ClassDeclaration classA = (ClassDeclaration) unit.getDeclarations().get(0);
-//    InterfaceType typeA = classA.getElement().getType();
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1730,10 +1711,10 @@
     ReturnStatement statement =
         (ifStatement.thenStatement as Block).statements[0] as ReturnStatement;
     SimpleIdentifier variableName = statement.expression as SimpleIdentifier;
-    expect(variableName.propagatedType, same(null));
+    expect(variableName.propagatedType, isNull);
   }
 
-  void test_is_if_logicalAnd() {
+  test_is_if_logicalAnd() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
@@ -1743,12 +1724,10 @@
     return null;
   }
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1759,19 +1738,17 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_is_postConditional() {
+  test_is_postConditional() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
   A a = (p is A) ? p : throw null;
   return p;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1780,7 +1757,7 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_is_postIf() {
+  test_is_postIf() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
@@ -1791,12 +1768,10 @@
   }
   return p;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1805,7 +1780,7 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_is_subclass() {
+  test_is_subclass() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {
@@ -1817,9 +1792,7 @@
   }
   return p;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[2] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1831,7 +1804,7 @@
     expect(invocation.methodName.propagatedElement, isNull);
   }
 
-  void test_is_while() {
+  test_is_while() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
@@ -1840,12 +1813,10 @@
   }
   return p;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1856,18 +1827,16 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_isNot_conditional() {
+  test_isNot_conditional() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
   return (p is! A) ? null : p;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1879,7 +1848,7 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_isNot_if() {
+  test_isNot_if() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
@@ -1889,12 +1858,10 @@
     return p;
   }
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1905,7 +1872,7 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_isNot_if_logicalOr() {
+  test_isNot_if_logicalOr() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
@@ -1915,11 +1882,10 @@
     return p;
   }
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source, noErrors: false);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1930,19 +1896,17 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_isNot_postConditional() {
+  test_isNot_postConditional() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
   A a = (p is! A) ? throw null : p;
   return p;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1951,7 +1915,7 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_isNot_postIf() {
+  test_isNot_postIf() async {
     Source source = addSource(r'''
 class A {}
 A f(var p) {
@@ -1960,12 +1924,10 @@
   }
   return p;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     ClassDeclaration classA = unit.declarations[0] as ClassDeclaration;
-    InterfaceType typeA = classA.element.type;
+    InterfaceType typeA =
+        resolutionMap.elementDeclaredByClassDeclaration(classA).type;
     FunctionDeclaration function = unit.declarations[1] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -1974,7 +1936,7 @@
     expect(variableName.propagatedType, same(typeA));
   }
 
-  void test_issue20904BuggyTypePromotionAtIfJoin_5() {
+  test_issue20904BuggyTypePromotionAtIfJoin_5() async {
     // https://code.google.com/p/dart/issues/detail?id=20904
     //
     // This is not an example of the 20904 bug, but rather,
@@ -2004,11 +1966,12 @@
     return a; // marker
   }
 }''';
-    DartType tB = findMarkedIdentifier(code, "; // B").propagatedType;
-    assertTypeOfMarkedExpression(code, null, tB);
+    CompilationUnit unit = await resolveSource(code);
+    DartType tB = findMarkedIdentifier(code, unit, "; // B").propagatedType;
+    assertTypeOfMarkedExpression(code, unit, null, tB);
   }
 
-  void test_issue20904BuggyTypePromotionAtIfJoin_6() {
+  test_issue20904BuggyTypePromotionAtIfJoin_6() async {
     // https://code.google.com/p/dart/issues/detail?id=20904
     //
     // The other half of the *_5() test.
@@ -2024,20 +1987,18 @@
     return b; // marker
   }
 }''';
-    DartType tB = findMarkedIdentifier(code, "; // B").propagatedType;
-    assertTypeOfMarkedExpression(code, null, tB);
+    CompilationUnit unit = await resolveSource(code);
+    DartType tB = findMarkedIdentifier(code, unit, "; // B").propagatedType;
+    assertTypeOfMarkedExpression(code, unit, null, tB);
   }
 
-  void test_listLiteral_different() {
+  test_listLiteral_different() async {
     Source source = addSource(r'''
 f() {
   var v = [0, '1', 2];
   return v[2];
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -2046,16 +2007,13 @@
     expect(indexExpression.propagatedType, isNull);
   }
 
-  void test_listLiteral_same() {
+  test_listLiteral_same() async {
     Source source = addSource(r'''
 f() {
   var v = [0, 1, 2];
   return v[2];
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
@@ -2064,59 +2022,53 @@
     expect(indexExpression.propagatedType, isNull);
     Expression v = indexExpression.target;
     InterfaceType propagatedType = v.propagatedType as InterfaceType;
-    expect(propagatedType.element, same(typeProvider.listType.element));
+    expect(propagatedType.element, typeProvider.listType.element);
     List<DartType> typeArguments = propagatedType.typeArguments;
     expect(typeArguments, hasLength(1));
-    expect(typeArguments[0], same(typeProvider.dynamicType));
+    expect(typeArguments[0], typeProvider.dynamicType);
   }
 
-  void test_mapLiteral_different() {
+  test_mapLiteral_different() async {
     Source source = addSource(r'''
 f() {
   var v = {'0' : 0, 1 : '1', '2' : 2};
   return v;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
     ReturnStatement statement = body.block.statements[1] as ReturnStatement;
     SimpleIdentifier identifier = statement.expression as SimpleIdentifier;
     InterfaceType propagatedType = identifier.propagatedType as InterfaceType;
-    expect(propagatedType.element, same(typeProvider.mapType.element));
+    expect(propagatedType.element, typeProvider.mapType.element);
     List<DartType> typeArguments = propagatedType.typeArguments;
     expect(typeArguments, hasLength(2));
-    expect(typeArguments[0], same(typeProvider.dynamicType));
-    expect(typeArguments[1], same(typeProvider.dynamicType));
+    expect(typeArguments[0], typeProvider.dynamicType);
+    expect(typeArguments[1], typeProvider.dynamicType);
   }
 
-  void test_mapLiteral_same() {
+  test_mapLiteral_same() async {
     Source source = addSource(r'''
 f() {
   var v = {'a' : 0, 'b' : 1, 'c' : 2};
   return v;
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration function = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body =
         function.functionExpression.body as BlockFunctionBody;
     ReturnStatement statement = body.block.statements[1] as ReturnStatement;
     SimpleIdentifier identifier = statement.expression as SimpleIdentifier;
     InterfaceType propagatedType = identifier.propagatedType as InterfaceType;
-    expect(propagatedType.element, same(typeProvider.mapType.element));
+    expect(propagatedType.element, typeProvider.mapType.element);
     List<DartType> typeArguments = propagatedType.typeArguments;
     expect(typeArguments, hasLength(2));
-    expect(typeArguments[0], same(typeProvider.dynamicType));
-    expect(typeArguments[1], same(typeProvider.dynamicType));
+    expect(typeArguments[0], typeProvider.dynamicType);
+    expect(typeArguments[1], typeProvider.dynamicType);
   }
 
-  void test_mergePropagatedTypes_afterIfThen_different() {
+  test_mergePropagatedTypes_afterIfThen_different() async {
     String code = r'''
 main() {
   var v = 0;
@@ -2125,33 +2077,33 @@
   }
   return v;
 }''';
+    CompilationUnit unit = await resolveSource(code);
     {
-      SimpleIdentifier identifier = findMarkedIdentifier(code, "v;");
+      SimpleIdentifier identifier = findMarkedIdentifier(code, unit, "v;");
       expect(identifier.propagatedType, null);
     }
     {
-      SimpleIdentifier identifier = findMarkedIdentifier(code, "v = '';");
+      SimpleIdentifier identifier =
+          findMarkedIdentifier(code, unit, "v = '';");
       expect(identifier.propagatedType, typeProvider.stringType);
     }
   }
 
-  void test_mergePropagatedTypes_afterIfThen_same() {
-    assertTypeOfMarkedExpression(
-        r'''
+  test_mergePropagatedTypes_afterIfThen_same() async {
+    var code = r'''
 main() {
   var v = 1;
   if (v != null) {
     v = 2;
   }
   return v; // marker
-}''',
-        null,
-        typeProvider.intType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.intType);
   }
 
-  void test_mergePropagatedTypes_afterIfThenElse_different() {
-    assertTypeOfMarkedExpression(
-        r'''
+  test_mergePropagatedTypes_afterIfThenElse_different() async {
+    var code = r'''
 main() {
   var v = 1;
   if (v != null) {
@@ -2160,14 +2112,13 @@
     v = '3';
   }
   return v; // marker
-}''',
-        null,
-        null);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, null);
   }
 
-  void test_mergePropagatedTypes_afterIfThenElse_same() {
-    assertTypeOfMarkedExpression(
-        r'''
+  test_mergePropagatedTypes_afterIfThenElse_same() async {
+    var code = r'''
 main() {
   var v = 1;
   if (v != null) {
@@ -2176,15 +2127,14 @@
     v = 3;
   }
   return v; // marker
-}''',
-        null,
-        typeProvider.intType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.intType);
   }
 
-  void test_mergePropagatedTypesAtJoinPoint_4() {
+  test_mergePropagatedTypesAtJoinPoint_4() async {
     // https://code.google.com/p/dart/issues/detail?id=19929
-    assertTypeOfMarkedExpression(
-        r'''
+    var code = r'''
 f5(x) {
   var y = [];
   if (x) {
@@ -2194,12 +2144,12 @@
   }
   // Propagated type is [int] here: correct.
   return y; // marker
-}''',
-        null,
-        typeProvider.intType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.intType);
   }
 
-  void test_mutatedOutsideScope() {
+  test_mutatedOutsideScope() async {
     // https://code.google.com/p/dart/issues/detail?id=22732
     Source source = addSource(r'''
 class Base {
@@ -2226,11 +2176,11 @@
   }
   x = null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_objectAccessInference_disabled_for_library_prefix() {
+  test_objectAccessInference_disabled_for_library_prefix() async {
     String name = 'hashCode';
     addNamedSource(
         '/helper.dart',
@@ -2244,13 +2194,14 @@
   helper.$name; // marker
 }''';
 
-    SimpleIdentifier id = findMarkedIdentifier(code, "; // marker");
+    CompilationUnit unit = await resolveSource(code);
+    SimpleIdentifier id = findMarkedIdentifier(code, unit, "; // marker");
     PrefixedIdentifier prefixedId = id.parent;
     expect(id.staticType, typeProvider.dynamicType);
     expect(prefixedId.staticType, typeProvider.dynamicType);
   }
 
-  void test_objectAccessInference_disabled_for_local_getter() {
+  test_objectAccessInference_disabled_for_local_getter() async {
     String name = 'hashCode';
     String code = '''
 dynamic get $name => null;
@@ -2258,23 +2209,26 @@
   $name; // marker
 }''';
 
-    SimpleIdentifier getter = findMarkedIdentifier(code, "; // marker");
+    CompilationUnit unit = await resolveSource(code);
+    SimpleIdentifier getter = findMarkedIdentifier(code, unit, "; // marker");
     expect(getter.staticType, typeProvider.dynamicType);
   }
 
-  void test_objectAccessInference_enabled_for_cascades() {
+  test_objectAccessInference_enabled_for_cascades() async {
     String name = 'hashCode';
     String code = '''
 main() {
   dynamic obj;
   obj..$name..$name; // marker
 }''';
-    PropertyAccess access = findMarkedIdentifier(code, "; // marker").parent;
+    CompilationUnit unit = await resolveSource(code);
+    PropertyAccess access =
+        findMarkedIdentifier(code, unit, "; // marker").parent;
     expect(access.staticType, typeProvider.dynamicType);
     expect(access.realTarget.staticType, typeProvider.dynamicType);
   }
 
-  void test_objectMethodInference_disabled_for_library_prefix() {
+  test_objectMethodInference_disabled_for_library_prefix() async {
     String name = 'toString';
     addNamedSource(
         '/helper.dart',
@@ -2287,106 +2241,110 @@
 main() {
   helper.$name(); // marker
 }''';
-    SimpleIdentifier methodName = findMarkedIdentifier(code, "(); // marker");
+    CompilationUnit unit = await resolveSource(code);
+    SimpleIdentifier methodName =
+        findMarkedIdentifier(code, unit, "(); // marker");
     MethodInvocation methodInvoke = methodName.parent;
     expect(methodName.staticType, typeProvider.dynamicType);
     expect(methodInvoke.staticType, typeProvider.dynamicType);
   }
 
-  void test_objectMethodInference_disabled_for_local_function() {
+  test_objectMethodInference_disabled_for_local_function() async {
     String name = 'toString';
     String code = '''
 main() {
   dynamic $name = () => null;
   $name(); // marker
 }''';
-    SimpleIdentifier identifier = findMarkedIdentifier(code, "$name = ");
+    CompilationUnit unit = await resolveSource(code);
+
+    SimpleIdentifier identifier = findMarkedIdentifier(code, unit, "$name = ");
     expect(identifier.staticType, typeProvider.dynamicType);
 
-    SimpleIdentifier methodName = findMarkedIdentifier(code, "(); // marker");
+    SimpleIdentifier methodName =
+        findMarkedIdentifier(code, unit, "(); // marker");
     MethodInvocation methodInvoke = methodName.parent;
     expect(methodName.staticType, typeProvider.dynamicType);
     expect(methodInvoke.staticType, typeProvider.dynamicType);
   }
 
-  void test_objectMethodInference_enabled_for_cascades() {
+  test_objectMethodInference_enabled_for_cascades() async {
     String name = 'toString';
     String code = '''
 main() {
   dynamic obj;
   obj..$name()..$name(); // marker
 }''';
-    SimpleIdentifier methodName = findMarkedIdentifier(code, "(); // marker");
+    CompilationUnit unit = await resolveSource(code);
+    SimpleIdentifier methodName =
+        findMarkedIdentifier(code, unit, "(); // marker");
     MethodInvocation methodInvoke = methodName.parent;
 
     expect(methodInvoke.staticType, typeProvider.dynamicType);
     expect(methodInvoke.realTarget.staticType, typeProvider.dynamicType);
   }
 
-  void test_objectMethodOnDynamicExpression_doubleEquals() {
+  test_objectMethodOnDynamicExpression_doubleEquals() async {
     // https://code.google.com/p/dart/issues/detail?id=20342
     //
     // This was not actually part of Issue 20342, since the spec specifies a
     // static type of [bool] for [==] comparison and the implementation
     // was already consistent with the spec there. But, it's another
     // [Object] method, so it's included here.
-    assertTypeOfMarkedExpression(
-        r'''
+    var code = r'''
 f1(x) {
   var v = (x == x);
   return v; // marker
-}''',
-        null,
-        typeProvider.boolType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.boolType);
   }
 
-  void test_objectMethodOnDynamicExpression_hashCode() {
+  test_objectMethodOnDynamicExpression_hashCode() async {
     // https://code.google.com/p/dart/issues/detail?id=20342
-    assertTypeOfMarkedExpression(
-        r'''
+    var code = r'''
 f1(x) {
   var v = x.hashCode;
   return v; // marker
-}''',
-        null,
-        typeProvider.intType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.intType);
   }
 
-  void test_objectMethodOnDynamicExpression_runtimeType() {
+  test_objectMethodOnDynamicExpression_runtimeType() async {
     // https://code.google.com/p/dart/issues/detail?id=20342
-    assertTypeOfMarkedExpression(
-        r'''
+    var code = r'''
 f1(x) {
   var v = x.runtimeType;
   return v; // marker
-}''',
-        null,
-        typeProvider.typeType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.typeType);
   }
 
-  void test_objectMethodOnDynamicExpression_toString() {
+  test_objectMethodOnDynamicExpression_toString() async {
     // https://code.google.com/p/dart/issues/detail?id=20342
-    assertTypeOfMarkedExpression(
-        r'''
+    var code = r'''
 f1(x) {
   var v = x.toString();
   return v; // marker
-}''',
-        null,
-        typeProvider.stringType);
+}''';
+    CompilationUnit unit = await resolveSource(code);
+    assertTypeOfMarkedExpression(code, unit, null, typeProvider.stringType);
   }
 
-  void test_propagatedReturnType_localFunction() {
+  test_propagatedReturnType_localFunction() async {
     String code = r'''
 main() {
   f() => 42;
   var v = f();
 }''';
+    CompilationUnit unit = await resolveSource(code);
     assertPropagatedAssignedType(
-        code, typeProvider.dynamicType, typeProvider.intType);
+        code, unit, typeProvider.dynamicType, typeProvider.intType);
   }
 
-  void test_query() {
+  test_query() async {
     Source source = addSource(r'''
 import 'dart:html';
 
@@ -2406,26 +2364,49 @@
   var b3 = query('body div');
   return [v1, v2, v3, v4, v5, v6, v7, m1, b1, b2, b3];
 }''');
-    LibraryElement library = resolve2(source);
-    assertNoErrors(source);
-    verify([source]);
-    CompilationUnit unit = resolveCompilationUnit(source, library);
+    CompilationUnit unit = await _computeResolvedUnit(source);
     FunctionDeclaration main = unit.declarations[0] as FunctionDeclaration;
     BlockFunctionBody body = main.functionExpression.body as BlockFunctionBody;
     ReturnStatement statement = body.block.statements[11] as ReturnStatement;
     NodeList<Expression> elements =
         (statement.expression as ListLiteral).elements;
-    expect(elements[0].propagatedType.name, "AnchorElement");
-    expect(elements[1].propagatedType.name, "AnchorElement");
-    expect(elements[2].propagatedType.name, "BodyElement");
-    expect(elements[3].propagatedType.name, "ButtonElement");
-    expect(elements[4].propagatedType.name, "DivElement");
-    expect(elements[5].propagatedType.name, "InputElement");
-    expect(elements[6].propagatedType.name, "SelectElement");
-    expect(elements[7].propagatedType.name, "DivElement");
-    expect(elements[8].propagatedType.name, "Element");
-    expect(elements[9].propagatedType.name, "Element");
-    expect(elements[10].propagatedType.name, "Element");
+    expect(resolutionMap.propagatedTypeForExpression(elements[0]).name,
+        "AnchorElement");
+    expect(resolutionMap.propagatedTypeForExpression(elements[1]).name,
+        "AnchorElement");
+    expect(resolutionMap.propagatedTypeForExpression(elements[2]).name,
+        "BodyElement");
+    expect(resolutionMap.propagatedTypeForExpression(elements[3]).name,
+        "ButtonElement");
+    expect(resolutionMap.propagatedTypeForExpression(elements[4]).name,
+        "DivElement");
+    expect(resolutionMap.propagatedTypeForExpression(elements[5]).name,
+        "InputElement");
+    expect(resolutionMap.propagatedTypeForExpression(elements[6]).name,
+        "SelectElement");
+    expect(resolutionMap.propagatedTypeForExpression(elements[7]).name,
+        "DivElement");
+    expect(
+        resolutionMap.propagatedTypeForExpression(elements[8]).name, "Element");
+    expect(
+        resolutionMap.propagatedTypeForExpression(elements[9]).name, "Element");
+    expect(resolutionMap.propagatedTypeForExpression(elements[10]).name,
+        "Element");
+  }
+
+  /**
+   * Return the resolved unit for the given [source].
+   *
+   * If [noErrors] is not specified or is not `true`, [assertNoErrors].
+   */
+  Future<CompilationUnit> _computeResolvedUnit(Source source,
+      {bool noErrors: true}) async {
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    if (noErrors) {
+      assertNoErrors(source);
+      verify([source]);
+    }
+    return analysisResult.unit;
   }
 }
 
@@ -2444,6 +2425,7 @@
     InterfaceType doubleType = _classElement("double", numType).type;
     InterfaceType functionType = _classElement("Function", objectType).type;
     InterfaceType futureType = _classElement("Future", objectType, ["T"]).type;
+    InterfaceType futureOrType = _classElement("FutureOr", objectType, ["T"]).type;
     InterfaceType intType = _classElement("int", numType).type;
     InterfaceType iterableType =
         _classElement("Iterable", objectType, ["T"]).type;
@@ -2472,7 +2454,7 @@
     ];
     CompilationUnitElementImpl asyncUnit =
         new CompilationUnitElementImpl("async.dart");
-    asyncUnit.types = <ClassElement>[futureType.element, streamType.element];
+    asyncUnit.types = <ClassElement>[futureType.element, futureOrType.element, streamType.element];
     AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
     LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode(
         context, AstTestFactory.libraryIdentifier2(["dart.core"]));
@@ -2490,6 +2472,7 @@
     expect(provider.dynamicType, isNotNull);
     expect(provider.functionType, same(functionType));
     expect(provider.futureType, same(futureType));
+    expect(provider.futureOrType, same(futureOrType));
     expect(provider.intType, same(intType));
     expect(provider.listType, same(listType));
     expect(provider.mapType, same(mapType));
@@ -2550,17 +2533,17 @@
    */
   TypeResolverVisitor _visitor;
 
-  void fail_visitConstructorDeclaration() {
+  fail_visitConstructorDeclaration() async {
     fail("Not yet tested");
     _listener.assertNoErrors();
   }
 
-  void fail_visitFunctionTypeAlias() {
+  fail_visitFunctionTypeAlias() async {
     fail("Not yet tested");
     _listener.assertNoErrors();
   }
 
-  void fail_visitVariableDeclaration() {
+  fail_visitVariableDeclaration() async {
     fail("Not yet tested");
     ClassElement type = ElementFactory.classElement2("A");
     VariableDeclaration node = AstTestFactory.variableDeclaration("a");
@@ -2589,7 +2572,7 @@
         nameScope: libraryScope);
   }
 
-  void test_modeApi() {
+  test_modeApi() async {
     CompilationUnit unit = ParserTestCase.parseCompilationUnit(r'''
 class C extends A with A implements A {
   A f = new A();
@@ -2690,7 +2673,7 @@
     }
   }
 
-  void test_modeLocal_noContext() {
+  test_modeLocal_noContext() async {
     CompilationUnit unit;
     _resolveTypeModeLocal(
         r'''
@@ -2804,7 +2787,7 @@
     }
   }
 
-  void test_modeLocal_withContext_bad_methodBody() {
+  test_modeLocal_withContext_bad_methodBody() async {
     expect(() {
       _resolveTypeModeLocal(
           r'''
@@ -2823,7 +2806,7 @@
     }, throwsStateError);
   }
 
-  void test_modeLocal_withContext_bad_topLevelVariable_declaration() {
+  test_modeLocal_withContext_bad_topLevelVariable_declaration() async {
     expect(() {
       _resolveTypeModeLocal(
           r'''
@@ -2835,7 +2818,7 @@
     }, throwsStateError);
   }
 
-  void test_modeLocal_withContext_bad_topLevelVariable_initializer() {
+  test_modeLocal_withContext_bad_topLevelVariable_initializer() async {
     expect(() {
       _resolveTypeModeLocal(
           r'''
@@ -2847,7 +2830,7 @@
     }, throwsStateError);
   }
 
-  void test_modeLocal_withContext_class() {
+  test_modeLocal_withContext_class() async {
     ClassDeclaration c;
     _resolveTypeModeLocal(
         r'''
@@ -2882,7 +2865,7 @@
     }
   }
 
-  void test_modeLocal_withContext_inClass_constructor() {
+  test_modeLocal_withContext_inClass_constructor() async {
     ConstructorDeclaration cc;
     _resolveTypeModeLocal(
         r'''
@@ -2907,7 +2890,7 @@
     }
   }
 
-  void test_modeLocal_withContext_inClass_method() {
+  test_modeLocal_withContext_inClass_method() async {
     MethodDeclaration m;
     _resolveTypeModeLocal(
         r'''
@@ -2942,7 +2925,7 @@
     }
   }
 
-  void test_modeLocal_withContext_topLevelFunction() {
+  test_modeLocal_withContext_topLevelFunction() async {
     FunctionDeclaration f;
     _resolveTypeModeLocal(
         r'''
@@ -2965,7 +2948,7 @@
     expect(vd.variables.type.type.toString(), 'T');
   }
 
-  void test_modeLocal_withContext_topLevelVariable() {
+  test_modeLocal_withContext_topLevelVariable() async {
     TopLevelVariableDeclaration v;
     _resolveTypeModeLocal(
         r'''
@@ -2983,7 +2966,7 @@
     expect(vi.constructorName.type.type.toString(), 'A');
   }
 
-  void test_visitCatchClause_exception() {
+  test_visitCatchClause_exception() async {
     // catch (e)
     CatchClause clause = AstTestFactory.catchClause("e");
     SimpleIdentifier exceptionParameter = clause.exceptionParameter;
@@ -2993,7 +2976,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitCatchClause_exception_stackTrace() {
+  test_visitCatchClause_exception_stackTrace() async {
     // catch (e, s)
     CatchClause clause = AstTestFactory.catchClause2("e", "s");
     SimpleIdentifier exceptionParameter = clause.exceptionParameter;
@@ -3007,7 +2990,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitCatchClause_on_exception() {
+  test_visitCatchClause_on_exception() async {
     // on E catch (e)
     ClassElement exceptionElement = ElementFactory.classElement2("E");
     TypeName exceptionType = AstTestFactory.typeName(exceptionElement);
@@ -3020,7 +3003,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitCatchClause_on_exception_stackTrace() {
+  test_visitCatchClause_on_exception_stackTrace() async {
     // on E catch (e, s)
     ClassElement exceptionElement = ElementFactory.classElement2("E");
     TypeName exceptionType = AstTestFactory.typeName(exceptionElement);
@@ -3037,7 +3020,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitClassDeclaration() {
+  test_visitClassDeclaration() async {
     // class A extends B with C implements D {}
     // class B {}
     // class C {}
@@ -3066,7 +3049,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitClassDeclaration_instanceMemberCollidesWithClass() {
+  test_visitClassDeclaration_instanceMemberCollidesWithClass() async {
     // class A {}
     // class B extends A {
     //   void A() {}
@@ -3086,7 +3069,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitClassTypeAlias() {
+  test_visitClassTypeAlias() async {
     // class A = B with C implements D;
     ClassElement elementA = ElementFactory.classElement2("A");
     ClassElement elementB = ElementFactory.classElement2("B");
@@ -3110,7 +3093,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitClassTypeAlias_constructorWithOptionalParams_ignored() {
+  test_visitClassTypeAlias_constructorWithOptionalParams_ignored() async {
     // class T {}
     // class B {
     //   B.c1();
@@ -3151,7 +3134,7 @@
     expect(constructor.parameters, isEmpty);
   }
 
-  void test_visitClassTypeAlias_constructorWithParams() {
+  test_visitClassTypeAlias_constructorWithParams() async {
     // class T {}
     // class B {
     //   B(T a0);
@@ -3185,7 +3168,7 @@
         equals(constructorB.parameters[0].name));
   }
 
-  void test_visitClassTypeAlias_defaultConstructor() {
+  test_visitClassTypeAlias_defaultConstructor() async {
     // class B {}
     // class M {}
     // class C = B with M
@@ -3213,7 +3196,7 @@
     expect(constructor.parameters, isEmpty);
   }
 
-  void test_visitFieldFormalParameter_functionType() {
+  test_visitFieldFormalParameter_functionType() async {
     InterfaceType intType = _typeProvider.intType;
     TypeName intTypeName = AstTestFactory.typeName4("int");
     String innerParameterName = "a";
@@ -3238,7 +3221,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitFieldFormalParameter_noType() {
+  test_visitFieldFormalParameter_noType() async {
     String parameterName = "p";
     FormalParameter node =
         AstTestFactory.fieldFormalParameter(Keyword.VAR, null, parameterName);
@@ -3248,7 +3231,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitFieldFormalParameter_type() {
+  test_visitFieldFormalParameter_type() async {
     InterfaceType intType = _typeProvider.intType;
     TypeName intTypeName = AstTestFactory.typeName4("int");
     String parameterName = "p";
@@ -3260,7 +3243,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitFunctionDeclaration() {
+  test_visitFunctionDeclaration() async {
     // R f(P p) {}
     // class R {}
     // class P {}
@@ -3286,7 +3269,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitFunctionDeclaration_typeParameter() {
+  test_visitFunctionDeclaration_typeParameter() async {
     // E f<E>(E e) {}
     TypeParameterElement elementE = ElementFactory.typeParameterElement('E');
     FunctionElementImpl elementF = ElementFactory.functionElement('f');
@@ -3310,7 +3293,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitFunctionTypedFormalParameter() {
+  test_visitFunctionTypedFormalParameter() async {
     // R f(R g(P p)) {}
     // class R {}
     // class P {}
@@ -3341,7 +3324,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitFunctionTypedFormalParameter_typeParameter() {
+  test_visitFunctionTypedFormalParameter_typeParameter() async {
     // R f(R g<E>(E e)) {}
     // class R {}
     ClassElement elementR = ElementFactory.classElement2('R');
@@ -3372,7 +3355,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitMethodDeclaration() {
+  test_visitMethodDeclaration() async {
     // class A {
     //   R m(P p) {}
     // }
@@ -3401,7 +3384,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitMethodDeclaration_typeParameter() {
+  test_visitMethodDeclaration_typeParameter() async {
     // class A {
     //   E m<E>(E e) {}
     // }
@@ -3428,7 +3411,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitSimpleFormalParameter_noType() {
+  test_visitSimpleFormalParameter_noType() async {
     // p
     FormalParameter node = AstTestFactory.simpleFormalParameter3("p");
     node.identifier.staticElement =
@@ -3437,7 +3420,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitSimpleFormalParameter_type() {
+  test_visitSimpleFormalParameter_type() async {
     // int p
     InterfaceType intType = _typeProvider.intType;
     ClassElement intElement = intType.element;
@@ -3450,7 +3433,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitTypeName_noParameters_noArguments() {
+  test_visitTypeName_noParameters_noArguments() async {
     ClassElement classA = ElementFactory.classElement2("A");
     TypeName typeName = AstTestFactory.typeName(classA);
     typeName.type = null;
@@ -3459,17 +3442,17 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitTypeName_noParameters_noArguments_undefined() {
+  test_visitTypeName_noParameters_noArguments_undefined() async {
     SimpleIdentifier id = AstTestFactory.identifier3("unknown")
       ..staticElement = new _StaleElement();
-    TypeName typeName = new TypeName(id, null);
+    TypeName typeName = astFactory.typeName(id, null);
     _resolveNode(typeName, []);
     expect(typeName.type, UndefinedTypeImpl.instance);
     expect(typeName.name.staticElement, null);
     _listener.assertErrorsWithCodes([StaticWarningCode.UNDEFINED_CLASS]);
   }
 
-  void test_visitTypeName_parameters_arguments() {
+  test_visitTypeName_parameters_arguments() async {
     ClassElement classA = ElementFactory.classElement2("A", ["E"]);
     ClassElement classB = ElementFactory.classElement2("B");
     TypeName typeName =
@@ -3484,7 +3467,7 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitTypeName_parameters_noArguments() {
+  test_visitTypeName_parameters_noArguments() async {
     ClassElement classA = ElementFactory.classElement2("A", ["E"]);
     TypeName typeName = AstTestFactory.typeName(classA);
     typeName.type = null;
@@ -3497,13 +3480,13 @@
     _listener.assertNoErrors();
   }
 
-  void test_visitTypeName_prefixed_noParameters_noArguments_undefined() {
+  test_visitTypeName_prefixed_noParameters_noArguments_undefined() async {
     SimpleIdentifier prefix = AstTestFactory.identifier3("unknownPrefix")
       ..staticElement = new _StaleElement();
     SimpleIdentifier suffix = AstTestFactory.identifier3("unknownSuffix")
       ..staticElement = new _StaleElement();
     TypeName typeName =
-        new TypeName(AstTestFactory.identifier(prefix, suffix), null);
+        astFactory.typeName(AstTestFactory.identifier(prefix, suffix), null);
     _resolveNode(typeName, []);
     expect(typeName.type, UndefinedTypeImpl.instance);
     expect(prefix.staticElement, null);
@@ -3511,7 +3494,7 @@
     _listener.assertErrorsWithCodes([StaticWarningCode.UNDEFINED_CLASS]);
   }
 
-  void test_visitTypeName_void() {
+  test_visitTypeName_void() async {
     ClassElement classA = ElementFactory.classElement2("A");
     TypeName typeName = AstTestFactory.typeName4("void");
     _resolveNode(typeName, [classA]);
@@ -3638,5 +3621,5 @@
   get kind => throw "_StaleElement's kind shouldn't be accessed";
 
   @override
-  accept(_) => throw "_StaleElement shouldn't be visited";
+  /*=T*/ accept/*<T>*/(_) => throw "_StaleElement shouldn't be visited";
 }
diff --git a/pkg/analyzer/test/generated/resolver_test_case.dart b/pkg/analyzer/test/generated/resolver_test_case.dart
index 5cd095d..68addea 100644
--- a/pkg/analyzer/test/generated/resolver_test_case.dart
+++ b/pkg/analyzer/test/generated/resolver_test_case.dart
@@ -4,23 +4,33 @@
 
 library analyzer.test.generated.resolver_test_case;
 
+import 'dart:async';
+
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/error/error.dart';
+import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/source/package_map_resolver.dart';
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/dart/element/type.dart';
 import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
 import 'package:analyzer/src/generated/java_engine.dart';
 import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
 import 'package:analyzer/src/generated/testing/element_factory.dart';
 import 'package:test/test.dart';
 
+import '../src/context/mock_sdk.dart';
 import 'analysis_context_factory.dart';
 import 'test_support.dart';
 
@@ -232,8 +242,8 @@
     if (node.name == "void") {
       return null;
     }
-    if (node.staticType != null &&
-        node.staticType.isDynamic &&
+    if (resolutionMap.staticTypeForExpression(node) != null &&
+        resolutionMap.staticTypeForExpression(node).isDynamic &&
         node.staticElement == null) {
       return null;
     }
@@ -273,7 +283,10 @@
       if (root is CompilationUnit) {
         CompilationUnit rootCU = root;
         if (rootCU.element != null) {
-          return rootCU.element.source.fullName;
+          return resolutionMap
+              .elementDeclaredByCompilationUnit(rootCU)
+              .source
+              .fullName;
         } else {
           return "<unknown file- CompilationUnit.getElement() returned null>";
         }
@@ -319,15 +332,32 @@
    */
   bool enableUnusedLocalVariable = false;
 
+  final Map<Source, TestAnalysisResult> analysisResults = {};
+
+  StringBuffer _logBuffer = new StringBuffer();
+  FileContentOverlay fileContentOverlay = new FileContentOverlay();
+  AnalysisDriver driver;
+
   AnalysisContext get analysisContext => analysisContext2;
 
+  bool get enableNewAnalysisDriver => false;
+
   /**
    * Return a type provider that can be used to test the results of resolution.
    *
    * @return a type provider
    * @throws AnalysisException if dart:core cannot be resolved
    */
-  TypeProvider get typeProvider => analysisContext2.typeProvider;
+  TypeProvider get typeProvider {
+    if (enableNewAnalysisDriver) {
+      if (analysisResults.isEmpty) {
+        fail('typeProvider can be called after computing an analysis result.');
+      }
+      return analysisResults.values.first.unit.element.context.typeProvider;
+    } else {
+      return analysisContext2.typeProvider;
+    }
+  }
 
   /**
    * Return a type system that can be used to test the results of resolution.
@@ -342,11 +372,17 @@
    * set in the content provider. Return the source representing the added file.
    */
   Source addNamedSource(String filePath, String contents) {
-    Source source =
-        cacheSource(resourceProvider.convertPath(filePath), contents);
-    ChangeSet changeSet = new ChangeSet();
-    changeSet.addedSource(source);
-    analysisContext2.applyChanges(changeSet);
+    filePath = resourceProvider.convertPath(filePath);
+    File file = resourceProvider.newFile(filePath, contents);
+    Source source = file.createSource();
+    if (enableNewAnalysisDriver) {
+      driver.addFile(filePath);
+    } else {
+      analysisContext2.setContents(source, contents);
+      ChangeSet changeSet = new ChangeSet();
+      changeSet.addedSource(source);
+      analysisContext2.applyChanges(changeSet);
+    }
     return source;
   }
 
@@ -358,20 +394,18 @@
   Source addSource(String contents) => addNamedSource("/test.dart", contents);
 
   /**
-   * Assert that the number of errors reported against the given source matches the number of errors
-   * that are given and that they have the expected error codes. The order in which the errors were
-   * gathered is ignored.
-   *
-   * @param source the source against which the errors should have been reported
-   * @param expectedErrorCodes the error codes of the errors that should have been reported
-   * @throws AnalysisException if the reported errors could not be computed
-   * @throws AssertionFailedError if a different number of errors have been reported than were
-   *           expected
+   * Assert that the number of errors reported against the given
+   * [source] matches the number of errors that are given and that they have
+   * the expected error codes. The order in which the errors were gathered is
+   * ignored.
    */
   void assertErrors(Source source,
       [List<ErrorCode> expectedErrorCodes = const <ErrorCode>[]]) {
+    TestAnalysisResult result = analysisResults[source];
+    expect(result, isNotNull);
+
     GatheringErrorListener errorListener = new GatheringErrorListener();
-    for (AnalysisError error in analysisContext2.computeErrors(source)) {
+    for (AnalysisError error in result.errors) {
       expect(error.source, source);
       ErrorCode errorCode = error.errorCode;
       if (!enableUnusedElement &&
@@ -396,9 +430,9 @@
    * Like [assertErrors], but takes a string of source code.
    */
   // TODO(rnystrom): Use this in more tests that have the same structure.
-  void assertErrorsInCode(String code, List<ErrorCode> errors) {
+  Future<Null> assertErrorsInCode(String code, List<ErrorCode> errors) async {
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, errors);
     verify([source]);
   }
@@ -408,9 +442,10 @@
    *
    * Like [assertErrors], but takes a string of source code.
    */
-  void assertErrorsInUnverifiedCode(String code, List<ErrorCode> errors) {
+  Future<Null> assertErrorsInUnverifiedCode(
+      String code, List<ErrorCode> errors) async {
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, errors);
   }
 
@@ -429,9 +464,9 @@
    * Asserts that [code] has no errors or warnings.
    */
   // TODO(rnystrom): Use this in more tests that have the same structure.
-  void assertNoErrorsInCode(String code) {
+  Future<Null> assertNoErrorsInCode(String code) async {
     Source source = addSource(code);
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
@@ -440,22 +475,22 @@
    * @param code the code that assigns the value to the variable "v", no matter how. We check that
    *          "v" has expected static and propagated type.
    */
-  void assertPropagatedAssignedType(String code, DartType expectedStaticType,
-      DartType expectedPropagatedType) {
-    SimpleIdentifier identifier = findMarkedIdentifier(code, "v = ");
-    expect(identifier.staticType, same(expectedStaticType));
-    expect(identifier.propagatedType, same(expectedPropagatedType));
+  void assertPropagatedAssignedType(String code, CompilationUnit unit,
+      DartType expectedStaticType, DartType expectedPropagatedType) {
+    SimpleIdentifier identifier = findMarkedIdentifier(code, unit, "v = ");
+    expect(identifier.staticType, expectedStaticType);
+    expect(identifier.propagatedType, expectedPropagatedType);
   }
 
   /**
    * @param code the code that iterates using variable "v". We check that
    *          "v" has expected static and propagated type.
    */
-  void assertPropagatedIterationType(String code, DartType expectedStaticType,
-      DartType expectedPropagatedType) {
-    SimpleIdentifier identifier = findMarkedIdentifier(code, "v in ");
-    expect(identifier.staticType, same(expectedStaticType));
-    expect(identifier.propagatedType, same(expectedPropagatedType));
+  void assertPropagatedIterationType(String code, CompilationUnit unit,
+      DartType expectedStaticType, DartType expectedPropagatedType) {
+    SimpleIdentifier identifier = findMarkedIdentifier(code, unit, "v in ");
+    expect(identifier.staticType, expectedStaticType);
+    expect(identifier.propagatedType, expectedPropagatedType);
   }
 
   /**
@@ -466,9 +501,10 @@
    * @param expectedPropagatedType if non-null, check actual static type is equal to this.
    * @throws Exception
    */
-  void assertTypeOfMarkedExpression(String code, DartType expectedStaticType,
-      DartType expectedPropagatedType) {
-    SimpleIdentifier identifier = findMarkedIdentifier(code, "; // marker");
+  void assertTypeOfMarkedExpression(String code, CompilationUnit unit,
+      DartType expectedStaticType, DartType expectedPropagatedType) {
+    SimpleIdentifier identifier =
+        findMarkedIdentifier(code, unit, "; // marker");
     if (expectedStaticType != null) {
       expect(identifier.staticType, expectedStaticType);
     }
@@ -476,16 +512,6 @@
   }
 
   /**
-   * Cache the [contents] for the file at the given [filePath] but don't add the
-   * source to the analysis context. The file path must be absolute.
-   */
-  Source cacheSource(String filePath, String contents) {
-    Source source = resourceProvider.getFile(filePath).createSource();
-    analysisContext2.setContents(source, contents);
-    return source;
-  }
-
-  /**
    * Change the contents of the given [source] to the given [contents].
    */
   void changeSource(Source source, String contents) {
@@ -495,13 +521,32 @@
     analysisContext2.applyChanges(changeSet);
   }
 
+  Future<TestAnalysisResult> computeAnalysisResult(Source source) async {
+    TestAnalysisResult analysisResult;
+    if (enableNewAnalysisDriver) {
+      AnalysisResult result = await driver.getResult(source.fullName);
+      analysisResult =
+          new TestAnalysisResult(source, result.unit, result.errors);
+    } else {
+      analysisContext2.computeKindOf(source);
+      List<Source> libraries = analysisContext2.getLibrariesContaining(source);
+      if (libraries.length > 0) {
+        CompilationUnit unit =
+            analysisContext.resolveCompilationUnit2(source, libraries.first);
+        List<AnalysisError> errors = analysisContext.computeErrors(source);
+        analysisResult = new TestAnalysisResult(source, unit, errors);
+      }
+    }
+    analysisResults[source] = analysisResult;
+    return analysisResult;
+  }
+
   /**
-   * Computes errors for the given [librarySource].
-   * This assumes that the given [librarySource] and its parts have already
-   * been added to the content provider using the method [addNamedSource].
+   * Compute the analysis result to the given [code] in '/test.dart'.
    */
-  void computeLibrarySourceErrors(Source librarySource) {
-    analysisContext.computeErrors(librarySource);
+  Future<TestAnalysisResult> computeTestAnalysisResult(String code) async {
+    Source source = addSource(code);
+    return await computeAnalysisResult(source);
   }
 
   /**
@@ -566,39 +611,18 @@
   }
 
   /**
-   * Return the `SimpleIdentifier` marked by `marker`. The source code must have no
-   * errors and be verifiable.
-   *
-   * @param code source code to analyze.
-   * @param marker marker identifying sought after expression in source code.
-   * @return expression marked by the marker.
-   * @throws Exception
+   * Return the [SimpleIdentifier] from [unit] marked by [marker] in [code].
+   * The source code must have no errors and be verifiable.
    */
-  SimpleIdentifier findMarkedIdentifier(String code, String marker) {
-    try {
-      Source source = addSource(code);
-      LibraryElement library = resolve2(source);
-      assertNoErrors(source);
-      verify([source]);
-      CompilationUnit unit = resolveCompilationUnit(source, library);
-      // Could generalize this further by making [SimpleIdentifier.class] a
-      // parameter.
-      return EngineTestCase.findNode(
-          unit, code, marker, (node) => node is SimpleIdentifier);
-    } catch (exception) {
-      // Is there a better exception to throw here? The point is that an
-      // assertion failure here should be a failure, in both "test_*" and
-      // "fail_*" tests. However, an assertion failure is success for the
-      // purpose of "fail_*" tests, so without catching them here "fail_*" tests
-      // can succeed by failing for the wrong reason.
-      throw new StateError("Unexpected assertion failure: $exception");
-    }
+  SimpleIdentifier findMarkedIdentifier(
+      String code, CompilationUnit unit, String marker) {
+    return EngineTestCase.findNode(
+        unit, code, marker, (node) => node is SimpleIdentifier);
   }
 
   Expression findTopLevelConstantExpression(
           CompilationUnit compilationUnit, String name) =>
       findTopLevelDeclaration(compilationUnit, name).initializer;
-
   VariableDeclaration findTopLevelDeclaration(
       CompilationUnit compilationUnit, String name) {
     for (CompilationUnitMember member in compilationUnit.declarations) {
@@ -618,17 +642,72 @@
    * Re-create the analysis context being used by the test case.
    */
   void reset() {
-    analysisContext2 = AnalysisContextFactory.contextWithCore(
-        resourceProvider: resourceProvider);
+    resetWith();
   }
 
   /**
-   * Re-create the analysis context being used by the test case and set the
-   * [options] in the newly created context to the given [options].
+   * Re-create the analysis context being used by the test with the either given
+   * [options] or [packages].
    */
-  void resetWithOptions(AnalysisOptions options) {
-    analysisContext2 = AnalysisContextFactory.contextWithCoreAndOptions(options,
-        resourceProvider: resourceProvider);
+  void resetWith({AnalysisOptions options, List<List<String>> packages}) {
+    if (options != null && packages != null) {
+      fail('Only packages or options can be specified.');
+    }
+    if (enableNewAnalysisDriver) {
+      options ??= new AnalysisOptionsImpl();
+      DartSdk sdk = new MockSdk(resourceProvider: resourceProvider)
+        ..context.analysisOptions = options;
+
+      List<UriResolver> resolvers = <UriResolver>[
+        new DartUriResolver(sdk),
+        new ResourceUriResolver(resourceProvider)
+      ];
+      if (packages != null) {
+        var packageMap = <String, List<Folder>>{};
+        packages.forEach((args) {
+          String name = args[0];
+          String path =
+              resourceProvider.convertPath('/packages/$name/$name.dart');
+          String content = args[1];
+          File file = resourceProvider.newFile(path, content);
+          packageMap[name] = <Folder>[file.parent];
+        });
+        resolvers.add(new PackageMapUriResolver(resourceProvider, packageMap));
+      }
+      SourceFactory sourceFactory = new SourceFactory(resolvers);
+
+      PerformanceLog log = new PerformanceLog(_logBuffer);
+      AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(log);
+      driver = new AnalysisDriver(
+          scheduler,
+          log,
+          resourceProvider,
+          new MemoryByteStore(),
+          fileContentOverlay,
+          'test',
+          sourceFactory,
+          options);
+      scheduler.start();
+    } else {
+      if (packages != null) {
+        var packageMap = <String, String>{};
+        packages.forEach((args) {
+          String name = args[0];
+          String content = args[1];
+          packageMap['package:$name/$name.dart'] = content;
+        });
+        analysisContext2 = AnalysisContextFactory.contextWithCoreAndPackages(
+            packageMap,
+            resourceProvider: resourceProvider);
+      } else if (options != null) {
+        analysisContext2 = AnalysisContextFactory.contextWithCoreAndOptions(
+            options,
+            resourceProvider: resourceProvider);
+      } else {
+        analysisContext2 = AnalysisContextFactory.contextWithCore(
+            resourceProvider: resourceProvider);
+      }
+    }
   }
 
   /**
@@ -655,50 +734,53 @@
           Source source, LibraryElement library) =>
       analysisContext2.resolveCompilationUnit(source, library);
 
-  CompilationUnit resolveSource(String sourceText) =>
-      resolveSource2("/test.dart", sourceText);
+  Future<CompilationUnit> resolveSource(String sourceText) =>
+      resolveSource2('/test.dart', sourceText);
 
-  CompilationUnit resolveSource2(String fileName, String sourceText) {
+  Future<CompilationUnit> resolveSource2(
+      String fileName, String sourceText) async {
     Source source = addNamedSource(fileName, sourceText);
-    LibraryElement library = analysisContext.computeLibraryElement(source);
-    return analysisContext.resolveCompilationUnit(source, library);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    return analysisResult.unit;
   }
 
-  Source resolveSources(List<String> sourceTexts) {
+  Future<Source> resolveSources(List<String> sourceTexts) async {
     for (int i = 0; i < sourceTexts.length; i++) {
-      CompilationUnit unit =
-          resolveSource2("/lib${i + 1}.dart", sourceTexts[i]);
+      Source source = addNamedSource('/lib${i + 1}.dart', sourceTexts[i]);
+      await computeAnalysisResult(source);
       // reference the source if this is the last source
       if (i + 1 == sourceTexts.length) {
-        return unit.element.source;
+        return source;
       }
     }
     return null;
   }
 
-  void resolveWithAndWithoutExperimental(
+  Future<Null> resolveWithAndWithoutExperimental(
       List<String> strSources,
       List<ErrorCode> codesWithoutExperimental,
-      List<ErrorCode> codesWithExperimental) {
+      List<ErrorCode> codesWithExperimental) async {
     // Setup analysis context as non-experimental
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
 //    options.enableDeferredLoading = false;
-    resetWithOptions(options);
+    resetWith(options: options);
     // Analysis and assertions
-    Source source = resolveSources(strSources);
+    Source source = await resolveSources(strSources);
+    await computeAnalysisResult(source);
     assertErrors(source, codesWithoutExperimental);
     verify([source]);
     // Setup analysis context as experimental
     reset();
     // Analysis and assertions
-    source = resolveSources(strSources);
+    source = await resolveSources(strSources);
+    await computeAnalysisResult(source);
     assertErrors(source, codesWithExperimental);
     verify([source]);
   }
 
-  void resolveWithErrors(List<String> strSources, List<ErrorCode> codes) {
-    // Analysis and assertions
-    Source source = resolveSources(strSources);
+  Future<Null> resolveWithErrors(
+      List<String> strSources, List<ErrorCode> codes) async {
+    Source source = await resolveSources(strSources);
     assertErrors(source, codes);
     verify([source]);
   }
@@ -713,6 +795,7 @@
   @override
   void tearDown() {
     analysisContext2 = null;
+    AnalysisEngine.instance.clearCaches();
     super.tearDown();
   }
 
@@ -723,12 +806,9 @@
   void verify(List<Source> sources) {
     ResolutionVerifier verifier = new ResolutionVerifier();
     for (Source source in sources) {
-      List<Source> libraries = analysisContext2.getLibrariesContaining(source);
-      for (Source library in libraries) {
-        analysisContext2
-            .resolveCompilationUnit2(source, library)
-            .accept(verifier);
-      }
+      TestAnalysisResult result = analysisResults[source];
+      expect(result, isNotNull);
+      result.unit.accept(verifier);
     }
     verifier.assertResolved();
   }
@@ -748,11 +828,14 @@
    * stringifies to [type] and that its generics match the given stringified
    * output.
    */
-  expectFunctionType(String name, String type,
+  FunctionTypeImpl expectFunctionType(String name, String type,
       {String elementTypeParams: '[]',
       String typeParams: '[]',
       String typeArgs: '[]',
-      String typeFormals: '[]'}) {
+      String typeFormals: '[]',
+      String identifierType}) {
+    identifierType ??= type;
+
     typeParameters(Element element) {
       if (element is ExecutableElement) {
         return element.typeParameters;
@@ -764,13 +847,15 @@
 
     SimpleIdentifier identifier = findIdentifier(name);
     // Element is either ExecutableElement or ParameterElement.
-    Element element = identifier.staticElement;
-    FunctionTypeImpl functionType = identifier.staticType;
+    var element = identifier.staticElement;
+    FunctionTypeImpl functionType = (element as dynamic).type;
     expect(functionType.toString(), type);
+    expect(identifier.staticType.toString(), identifierType);
     expect(typeParameters(element).toString(), elementTypeParams);
     expect(functionType.typeParameters.toString(), typeParams);
     expect(functionType.typeArguments.toString(), typeArgs);
     expect(functionType.typeFormals.toString(), typeFormals);
+    return functionType;
   }
 
   /**
@@ -819,13 +904,15 @@
     return identifier;
   }
 
-  void resolveTestUnit(String code) {
+  Future<Null> resolveTestUnit(String code, {bool noErrors: true}) async {
     testCode = code;
     testSource = addSource(testCode);
-    LibraryElement library = resolve2(testSource);
-    assertNoErrors(testSource);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(testSource);
+    if (noErrors) {
+      assertNoErrors(testSource);
+    }
     verify([testSource]);
-    testUnit = resolveCompilationUnit(testSource, library);
+    testUnit = analysisResult.unit;
   }
 
   /**
@@ -842,3 +929,10 @@
     }
   }
 }
+
+class TestAnalysisResult {
+  final Source source;
+  final CompilationUnit unit;
+  final List<AnalysisError> errors;
+  TestAnalysisResult(this.source, this.unit, this.errors);
+}
diff --git a/pkg/analyzer/test/generated/simple_resolver_test.dart b/pkg/analyzer/test/generated/simple_resolver_test.dart
index 4df27be..f8ce31e 100644
--- a/pkg/analyzer/test/generated/simple_resolver_test.dart
+++ b/pkg/analyzer/test/generated/simple_resolver_test.dart
@@ -5,6 +5,7 @@
 library analyzer.test.generated.simple_resolver_test;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
@@ -26,7 +27,7 @@
 
 @reflectiveTest
 class SimpleResolverTest extends ResolverTestCase {
-  void test_argumentResolution_required_matching() {
+  test_argumentResolution_required_matching() async {
     Source source = addSource(r'''
 class A {
   void f() {
@@ -37,7 +38,7 @@
     _validateArgumentResolution(source, [0, 1, 2]);
   }
 
-  void test_argumentResolution_required_tooFew() {
+  test_argumentResolution_required_tooFew() async {
     Source source = addSource(r'''
 class A {
   void f() {
@@ -48,7 +49,7 @@
     _validateArgumentResolution(source, [0, 1]);
   }
 
-  void test_argumentResolution_required_tooMany() {
+  test_argumentResolution_required_tooMany() async {
     Source source = addSource(r'''
 class A {
   void f() {
@@ -59,7 +60,7 @@
     _validateArgumentResolution(source, [0, 1, -1]);
   }
 
-  void test_argumentResolution_requiredAndNamed_extra() {
+  test_argumentResolution_requiredAndNamed_extra() async {
     Source source = addSource(r'''
 class A {
   void f() {
@@ -70,7 +71,7 @@
     _validateArgumentResolution(source, [0, 1, 2, -1]);
   }
 
-  void test_argumentResolution_requiredAndNamed_matching() {
+  test_argumentResolution_requiredAndNamed_matching() async {
     Source source = addSource(r'''
 class A {
   void f() {
@@ -81,7 +82,7 @@
     _validateArgumentResolution(source, [0, 1, 2]);
   }
 
-  void test_argumentResolution_requiredAndNamed_missing() {
+  test_argumentResolution_requiredAndNamed_missing() async {
     Source source = addSource(r'''
 class A {
   void f() {
@@ -92,7 +93,7 @@
     _validateArgumentResolution(source, [0, 1, 3]);
   }
 
-  void test_argumentResolution_requiredAndPositional_fewer() {
+  test_argumentResolution_requiredAndPositional_fewer() async {
     Source source = addSource(r'''
 class A {
   void f() {
@@ -103,7 +104,7 @@
     _validateArgumentResolution(source, [0, 1, 2]);
   }
 
-  void test_argumentResolution_requiredAndPositional_matching() {
+  test_argumentResolution_requiredAndPositional_matching() async {
     Source source = addSource(r'''
 class A {
   void f() {
@@ -114,7 +115,7 @@
     _validateArgumentResolution(source, [0, 1, 2, 3]);
   }
 
-  void test_argumentResolution_requiredAndPositional_more() {
+  test_argumentResolution_requiredAndPositional_more() async {
     Source source = addSource(r'''
 class A {
   void f() {
@@ -125,7 +126,7 @@
     _validateArgumentResolution(source, [0, 1, 2, -1]);
   }
 
-  void test_argumentResolution_setter_propagated() {
+  test_argumentResolution_setter_propagated() async {
     Source source = addSource(r'''
 main() {
   var a = new A();
@@ -158,7 +159,7 @@
     expect(setter.parameters[0], same(parameter));
   }
 
-  void test_argumentResolution_setter_propagated_propertyAccess() {
+  test_argumentResolution_setter_propagated_propertyAccess() async {
     Source source = addSource(r'''
 main() {
   var a = new A();
@@ -194,7 +195,7 @@
     expect(setter.parameters[0], same(parameter));
   }
 
-  void test_argumentResolution_setter_static() {
+  test_argumentResolution_setter_static() async {
     Source source = addSource(r'''
 main() {
   A a = new A();
@@ -226,7 +227,7 @@
     expect(setter.parameters[0], same(parameter));
   }
 
-  void test_argumentResolution_setter_static_propertyAccess() {
+  test_argumentResolution_setter_static_propertyAccess() async {
     Source source = addSource(r'''
 main() {
   A a = new A();
@@ -261,7 +262,7 @@
     expect(setter.parameters[0], same(parameter));
   }
 
-  void test_breakTarget_labeled() {
+  test_breakTarget_labeled() async {
     // Verify that the target of the label is correctly found and is recorded
     // as the unlabeled portion of the statement.
     String text = r'''
@@ -274,7 +275,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     WhileStatement whileStatement = EngineTestCase.findNode(
         unit, text, 'while (true)', (n) => n is WhileStatement);
     ForStatement forStatement =
@@ -287,7 +288,7 @@
     expect(break2.target, same(forStatement));
   }
 
-  void test_breakTarget_unlabeledBreakFromDo() {
+  test_breakTarget_unlabeledBreakFromDo() async {
     String text = r'''
 void f() {
   do {
@@ -295,7 +296,7 @@
   } while (true);
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     DoStatement doStatement =
         EngineTestCase.findNode(unit, text, 'do', (n) => n is DoStatement);
     BreakStatement breakStatement = EngineTestCase.findNode(
@@ -303,7 +304,7 @@
     expect(breakStatement.target, same(doStatement));
   }
 
-  void test_breakTarget_unlabeledBreakFromFor() {
+  test_breakTarget_unlabeledBreakFromFor() async {
     String text = r'''
 void f() {
   for (int i = 0; i < 10; i++) {
@@ -311,7 +312,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     ForStatement forStatement =
         EngineTestCase.findNode(unit, text, 'for', (n) => n is ForStatement);
     BreakStatement breakStatement = EngineTestCase.findNode(
@@ -319,7 +320,7 @@
     expect(breakStatement.target, same(forStatement));
   }
 
-  void test_breakTarget_unlabeledBreakFromForEach() {
+  test_breakTarget_unlabeledBreakFromForEach() async {
     String text = r'''
 void f() {
   for (x in []) {
@@ -327,7 +328,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     ForEachStatement forStatement = EngineTestCase.findNode(
         unit, text, 'for', (n) => n is ForEachStatement);
     BreakStatement breakStatement = EngineTestCase.findNode(
@@ -335,7 +336,7 @@
     expect(breakStatement.target, same(forStatement));
   }
 
-  void test_breakTarget_unlabeledBreakFromSwitch() {
+  test_breakTarget_unlabeledBreakFromSwitch() async {
     String text = r'''
 void f() {
   while (true) {
@@ -346,7 +347,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     SwitchStatement switchStatement = EngineTestCase.findNode(
         unit, text, 'switch', (n) => n is SwitchStatement);
     BreakStatement breakStatement = EngineTestCase.findNode(
@@ -354,7 +355,7 @@
     expect(breakStatement.target, same(switchStatement));
   }
 
-  void test_breakTarget_unlabeledBreakFromWhile() {
+  test_breakTarget_unlabeledBreakFromWhile() async {
     String text = r'''
 void f() {
   while (true) {
@@ -362,7 +363,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     WhileStatement whileStatement = EngineTestCase.findNode(
         unit, text, 'while', (n) => n is WhileStatement);
     BreakStatement breakStatement = EngineTestCase.findNode(
@@ -370,7 +371,7 @@
     expect(breakStatement.target, same(whileStatement));
   }
 
-  void test_breakTarget_unlabeledBreakToOuterFunction() {
+  test_breakTarget_unlabeledBreakToOuterFunction() async {
     // Verify that unlabeled break statements can't resolve to loops in an
     // outer function.
     String text = r'''
@@ -382,13 +383,13 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     BreakStatement breakStatement = EngineTestCase.findNode(
         unit, text, 'break', (n) => n is BreakStatement);
     expect(breakStatement.target, isNull);
   }
 
-  void test_class_definesCall() {
+  test_class_definesCall() async {
     Source source = addSource(r'''
 class A {
   int call(int x) { return x; }
@@ -396,22 +397,22 @@
 int f(A a) {
   return a(0);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_class_extends_implements() {
+  test_class_extends_implements() async {
     Source source = addSource(r'''
 class A extends B implements C {}
 class B {}
 class C {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_commentReference_class() {
+  test_commentReference_class() async {
     Source source = addSource(r'''
 f() {}
 /** [A] [new A] [A.n] [new A.n] [m] [f] */
@@ -420,12 +421,12 @@
   A.n() {}
   m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_commentReference_parameter() {
+  test_commentReference_parameter() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -433,21 +434,21 @@
   /** [e] [f] */
   m(e, f()) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_commentReference_singleLine() {
+  test_commentReference_singleLine() async {
     Source source = addSource(r'''
 /// [A]
 class A {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_continueTarget_labeled() {
+  test_continueTarget_labeled() async {
     // Verify that the target of the label is correctly found and is recorded
     // as the unlabeled portion of the statement.
     String text = r'''
@@ -460,7 +461,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     WhileStatement whileStatement = EngineTestCase.findNode(
         unit, text, 'while (true)', (n) => n is WhileStatement);
     ForStatement forStatement =
@@ -473,7 +474,7 @@
     expect(continue2.target, same(forStatement));
   }
 
-  void test_continueTarget_unlabeledContinueFromDo() {
+  test_continueTarget_unlabeledContinueFromDo() async {
     String text = r'''
 void f() {
   do {
@@ -481,7 +482,7 @@
   } while (true);
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     DoStatement doStatement =
         EngineTestCase.findNode(unit, text, 'do', (n) => n is DoStatement);
     ContinueStatement continueStatement = EngineTestCase.findNode(
@@ -489,7 +490,7 @@
     expect(continueStatement.target, same(doStatement));
   }
 
-  void test_continueTarget_unlabeledContinueFromFor() {
+  test_continueTarget_unlabeledContinueFromFor() async {
     String text = r'''
 void f() {
   for (int i = 0; i < 10; i++) {
@@ -497,7 +498,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     ForStatement forStatement =
         EngineTestCase.findNode(unit, text, 'for', (n) => n is ForStatement);
     ContinueStatement continueStatement = EngineTestCase.findNode(
@@ -505,7 +506,7 @@
     expect(continueStatement.target, same(forStatement));
   }
 
-  void test_continueTarget_unlabeledContinueFromForEach() {
+  test_continueTarget_unlabeledContinueFromForEach() async {
     String text = r'''
 void f() {
   for (x in []) {
@@ -513,7 +514,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     ForEachStatement forStatement = EngineTestCase.findNode(
         unit, text, 'for', (n) => n is ForEachStatement);
     ContinueStatement continueStatement = EngineTestCase.findNode(
@@ -521,7 +522,7 @@
     expect(continueStatement.target, same(forStatement));
   }
 
-  void test_continueTarget_unlabeledContinueFromWhile() {
+  test_continueTarget_unlabeledContinueFromWhile() async {
     String text = r'''
 void f() {
   while (true) {
@@ -529,7 +530,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     WhileStatement whileStatement = EngineTestCase.findNode(
         unit, text, 'while', (n) => n is WhileStatement);
     ContinueStatement continueStatement = EngineTestCase.findNode(
@@ -537,7 +538,7 @@
     expect(continueStatement.target, same(whileStatement));
   }
 
-  void test_continueTarget_unlabeledContinueSkipsSwitch() {
+  test_continueTarget_unlabeledContinueSkipsSwitch() async {
     String text = r'''
 void f() {
   while (true) {
@@ -548,7 +549,7 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     WhileStatement whileStatement = EngineTestCase.findNode(
         unit, text, 'while', (n) => n is WhileStatement);
     ContinueStatement continueStatement = EngineTestCase.findNode(
@@ -556,7 +557,7 @@
     expect(continueStatement.target, same(whileStatement));
   }
 
-  void test_continueTarget_unlabeledContinueToOuterFunction() {
+  test_continueTarget_unlabeledContinueToOuterFunction() async {
     // Verify that unlabeled continue statements can't resolve to loops in an
     // outer function.
     String text = r'''
@@ -568,20 +569,20 @@
   }
 }
 ''';
-    CompilationUnit unit = resolveSource(text);
+    CompilationUnit unit = await resolveSource(text);
     ContinueStatement continueStatement = EngineTestCase.findNode(
         unit, text, 'continue', (n) => n is ContinueStatement);
     expect(continueStatement.target, isNull);
   }
 
-  void test_empty() {
+  test_empty() async {
     Source source = addSource("");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_entryPoint_exported() {
+  test_entryPoint_exported() async {
     addNamedSource(
         "/two.dart",
         r'''
@@ -597,11 +598,12 @@
     FunctionElement main = library.entryPoint;
     expect(main, isNotNull);
     expect(main.library, isNot(same(library)));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_entryPoint_local() {
+  test_entryPoint_local() async {
     Source source = addNamedSource(
         "/one.dart",
         r'''
@@ -612,20 +614,22 @@
     FunctionElement main = library.entryPoint;
     expect(main, isNotNull);
     expect(main.library, same(library));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_entryPoint_none() {
+  test_entryPoint_none() async {
     Source source = addNamedSource("/one.dart", "library one;");
     LibraryElement library = resolve2(source);
     expect(library, isNotNull);
     expect(library.entryPoint, isNull);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_enum_externalLibrary() {
+  test_enum_externalLibrary() async {
     addNamedSource(
         "/my_lib.dart",
         r'''
@@ -636,12 +640,12 @@
 main() {
   EEE e = null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_extractedMethodAsConstant() {
+  test_extractedMethodAsConstant() async {
     Source source = addSource(r'''
 abstract class Comparable<T> {
   int compareTo(T other);
@@ -650,12 +654,12 @@
 class A {
   void sort([compare = Comparable.compare]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_fieldFormalParameter() {
+  test_fieldFormalParameter() async {
     Source source = addSource(r'''
 class A {
   int x;
@@ -676,24 +680,24 @@
     SimpleIdentifier identifierX = initializer.expression;
     expect(identifierX.staticElement, paramElement);
 
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_forEachLoops_nonConflicting() {
+  test_forEachLoops_nonConflicting() async {
     Source source = addSource(r'''
 f() {
   List list = [1,2,3];
   for (int x in list) {}
   for (int x in list) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_forLoops_nonConflicting() {
+  test_forLoops_nonConflicting() async {
     Source source = addSource(r'''
 f() {
   for (int i = 0; i < 3; i++) {
@@ -701,12 +705,12 @@
   for (int i = 0; i < 3; i++) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_functionTypeAlias() {
+  test_functionTypeAlias() async {
     Source source = addSource(r'''
 typedef bool P(e);
 class A {
@@ -715,12 +719,12 @@
     if (p(e)) {}
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_getter_and_setter_fromMixins_bare_identifier() {
+  test_getter_and_setter_fromMixins_bare_identifier() async {
     Source source = addSource('''
 class B {}
 class M1 {
@@ -738,6 +742,7 @@
 }
 ''');
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     // Verify that both the getter and setter for "x" in C.f() refer to the
@@ -748,13 +753,18 @@
     ExpressionStatement stmt = body.block.statements[0];
     AssignmentExpression assignment = stmt.expression;
     SimpleIdentifier leftHandSide = assignment.leftHandSide;
-    expect(leftHandSide.staticElement.enclosingElement.name, 'M2');
+    expect(
+        resolutionMap
+            .staticElementForIdentifier(leftHandSide)
+            .enclosingElement
+            .name,
+        'M2');
     expect(leftHandSide.auxiliaryElements.staticElement.enclosingElement.name,
         'M2');
   }
 
   @failingTest
-  void test_getter_and_setter_fromMixins_property_access() {
+  test_getter_and_setter_fromMixins_property_access() async {
     // TODO(paulberry): it appears that auxiliaryElements isn't properly set on
     // a SimpleIdentifier that's inside a property access.  This bug should be
     // fixed.
@@ -774,6 +784,7 @@
 }
 ''');
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     // Verify that both the getter and setter for "x" in "new C().x" refer to
@@ -785,14 +796,18 @@
     AssignmentExpression assignment = stmt.expression;
     PropertyAccess propertyAccess = assignment.leftHandSide;
     expect(
-        propertyAccess.propertyName.staticElement.enclosingElement.name, 'M2');
+        resolutionMap
+            .staticElementForIdentifier(propertyAccess.propertyName)
+            .enclosingElement
+            .name,
+        'M2');
     expect(
         propertyAccess
             .propertyName.auxiliaryElements.staticElement.enclosingElement.name,
         'M2');
   }
 
-  void test_getter_fromMixins_bare_identifier() {
+  test_getter_fromMixins_bare_identifier() async {
     Source source = addSource('''
 class B {}
 class M1 {
@@ -808,6 +823,7 @@
 }
 ''');
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     // Verify that the getter for "x" in C.f() refers to the getter defined in
@@ -817,10 +833,11 @@
     BlockFunctionBody body = f.body;
     ReturnStatement stmt = body.block.statements[0];
     SimpleIdentifier x = stmt.expression;
-    expect(x.staticElement.enclosingElement.name, 'M2');
+    expect(resolutionMap.staticElementForIdentifier(x).enclosingElement.name,
+        'M2');
   }
 
-  void test_getter_fromMixins_property_access() {
+  test_getter_fromMixins_property_access() async {
     Source source = addSource('''
 class B {}
 class M1 {
@@ -835,6 +852,7 @@
 }
 ''');
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     // Verify that the getter for "x" in "new C().x" refers to the getter
@@ -845,10 +863,14 @@
     VariableDeclarationStatement stmt = body.block.statements[0];
     PropertyAccess propertyAccess = stmt.variables.variables[0].initializer;
     expect(
-        propertyAccess.propertyName.staticElement.enclosingElement.name, 'M2');
+        resolutionMap
+            .staticElementForIdentifier(propertyAccess.propertyName)
+            .enclosingElement
+            .name,
+        'M2');
   }
 
-  void test_getterAndSetterWithDifferentTypes() {
+  test_getterAndSetterWithDifferentTypes() async {
     Source source = addSource(r'''
 class A {
   int get f => 0;
@@ -857,13 +879,13 @@
 g (A a) {
   a.f = a.f.toString();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]);
     verify([source]);
   }
 
-  void test_hasReferenceToSuper() {
+  test_hasReferenceToSuper() async {
     Source source = addSource(r'''
 class A {}
 class B {toString() => super.toString();}''');
@@ -875,11 +897,12 @@
     expect(classes, hasLength(2));
     expect(classes[0].hasReferenceToSuper, isFalse);
     expect(classes[1].hasReferenceToSuper, isTrue);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_import_hide() {
+  test_import_hide() async {
     addNamedSource(
         "/lib1.dart",
         r'''
@@ -901,12 +924,12 @@
   foo = 0;
 }
 A a;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_import_prefix() {
+  test_import_prefix() async {
     addNamedSource(
         "/two.dart",
         r'''
@@ -922,12 +945,12 @@
 main() {
   _two.f(0);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_import_prefix_doesNotExist() {
+  test_import_prefix_doesNotExist() async {
     //
     // The primary purpose of this test is to ensure that we are only getting a
     // single error generated when the only problem is that an imported file
@@ -952,12 +975,12 @@
   H(int i) : super(i);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
     verify([source]);
   }
 
-  void test_import_show_doesNotExist() {
+  test_import_show_doesNotExist() async {
     //
     // The primary purpose of this test is to ensure that we are only getting a
     // single error generated when the only problem is that an imported file
@@ -982,12 +1005,12 @@
   H(int i) : super(i);
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
     verify([source]);
   }
 
-  void test_import_spaceInUri() {
+  test_import_spaceInUri() async {
     addNamedSource(
         "/sub folder/lib.dart",
         r'''
@@ -1001,12 +1024,12 @@
 main() {
   foo();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_indexExpression_typeParameters() {
+  test_indexExpression_typeParameters() async {
     Source source = addSource(r'''
 f() {
   List<int> a;
@@ -1016,23 +1039,23 @@
   List<List<List<int>>> c;
   c[0][0][0];
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_indexExpression_typeParameters_invalidAssignmentWarning() {
+  test_indexExpression_typeParameters_invalidAssignmentWarning() async {
     Source source = addSource(r'''
 f() {
   List<List<int>> b;
   b[0][0] = 'hi';
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
     verify([source]);
   }
 
-  void test_indirectOperatorThroughCall() {
+  test_indirectOperatorThroughCall() async {
     Source source = addSource(r'''
 class A {
   B call() { return new B(); }
@@ -1049,12 +1072,12 @@
 main() {
   g(f()[0]);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invoke_dynamicThroughGetter() {
+  test_invoke_dynamicThroughGetter() async {
     Source source = addSource(r'''
 class A {
   List get X => [() => 0];
@@ -1062,12 +1085,12 @@
     X.last;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_isValidMixin_badSuperclass() {
+  test_isValidMixin_badSuperclass() async {
     Source source = addSource(r'''
 class A extends B {}
 class B {}
@@ -1078,12 +1101,13 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isFalse);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT]);
     verify([source]);
   }
 
-  void test_isValidMixin_badSuperclass_withSuperMixins() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+  test_isValidMixin_badSuperclass_withSuperMixins() async {
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
     Source source = addSource(r'''
 class A extends B {}
 class B {}
@@ -1094,11 +1118,12 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isTrue);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_isValidMixin_constructor() {
+  test_isValidMixin_constructor() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -1110,12 +1135,13 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isFalse);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_isValidMixin_constructor_withSuperMixins() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+  test_isValidMixin_constructor_withSuperMixins() async {
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
     Source source = addSource(r'''
 class A {
   A() {}
@@ -1127,11 +1153,12 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isFalse);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_isValidMixin_factoryConstructor() {
+  test_isValidMixin_factoryConstructor() async {
     Source source = addSource(r'''
 class A {
   factory A() => null;
@@ -1143,12 +1170,13 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isTrue);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_isValidMixin_factoryConstructor_withSuperMixins() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+  test_isValidMixin_factoryConstructor_withSuperMixins() async {
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
     Source source = addSource(r'''
 class A {
   factory A() => null;
@@ -1160,11 +1188,12 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isTrue);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_isValidMixin_super() {
+  test_isValidMixin_super() async {
     Source source = addSource(r'''
 class A {
   toString() {
@@ -1178,12 +1207,13 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isFalse);
+    await computeAnalysisResult(source);
     assertErrors(source, [CompileTimeErrorCode.MIXIN_REFERENCES_SUPER]);
     verify([source]);
   }
 
-  void test_isValidMixin_super_withSuperMixins() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+  test_isValidMixin_super_withSuperMixins() async {
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
     Source source = addSource(r'''
 class A {
   toString() {
@@ -1197,11 +1227,12 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isTrue);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_isValidMixin_valid() {
+  test_isValidMixin_valid() async {
     Source source = addSource('''
 class A {}
 class C = Object with A;''');
@@ -1211,12 +1242,13 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isTrue);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_isValidMixin_valid_withSuperMixins() {
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+  test_isValidMixin_valid_withSuperMixins() async {
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
     Source source = addSource('''
 class A {}
 class C = Object with A;''');
@@ -1226,11 +1258,12 @@
     expect(unit, isNotNull);
     ClassElement a = unit.getType('A');
     expect(a.isValidMixin, isTrue);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_labels_switch() {
+  test_labels_switch() async {
     Source source = addSource(r'''
 void doSwitch(int target) {
   switch (target) {
@@ -1244,11 +1277,12 @@
 }''');
     LibraryElement library = resolve2(source);
     expect(library, isNotNull);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_localVariable_types_invoked() {
+  test_localVariable_types_invoked() async {
     Source source = addSource(r'''
 const A = null;
 main() {
@@ -1271,7 +1305,7 @@
     expect(found[0], isTrue);
   }
 
-  void test_metadata_class() {
+  test_metadata_class() async {
     Source source = addSource(r'''
 const A = null;
 @A class C<A> {}''');
@@ -1283,6 +1317,7 @@
     expect(classes, hasLength(1));
     List<ElementAnnotation> annotations = classes[0].metadata;
     expect(annotations, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     CompilationUnit unit = resolveCompilationUnit(source, library);
@@ -1301,7 +1336,7 @@
     expect(actualElement, same(expectedElement));
   }
 
-  void test_metadata_field() {
+  test_metadata_field() async {
     Source source = addSource(r'''
 const A = null;
 class C {
@@ -1316,11 +1351,12 @@
     FieldElement field = classes[0].fields[0];
     List<ElementAnnotation> annotations = field.metadata;
     expect(annotations, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_metadata_fieldFormalParameter() {
+  test_metadata_fieldFormalParameter() async {
     Source source = addSource(r'''
 const A = null;
 class C {
@@ -1339,11 +1375,12 @@
     expect(parameters, hasLength(1));
     List<ElementAnnotation> annotations = parameters[0].metadata;
     expect(annotations, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_metadata_function() {
+  test_metadata_function() async {
     Source source = addSource(r'''
 const A = null;
 @A f() {}''');
@@ -1355,11 +1392,12 @@
     expect(functions, hasLength(1));
     List<ElementAnnotation> annotations = functions[0].metadata;
     expect(annotations, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_metadata_functionTypedParameter() {
+  test_metadata_functionTypedParameter() async {
     Source source = addSource(r'''
 const A = null;
 f(@A int p(int x)) {}''');
@@ -1373,11 +1411,12 @@
     expect(parameters, hasLength(1));
     List<ElementAnnotation> annotations1 = parameters[0].metadata;
     expect(annotations1, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_metadata_libraryDirective() {
+  test_metadata_libraryDirective() async {
     Source source = addSource(r'''
 @A library lib;
 const A = null;''');
@@ -1385,11 +1424,12 @@
     expect(library, isNotNull);
     List<ElementAnnotation> annotations = library.metadata;
     expect(annotations, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_metadata_method() {
+  test_metadata_method() async {
     Source source = addSource(r'''
 const A = null;
 class C {
@@ -1404,11 +1444,12 @@
     MethodElement method = classes[0].methods[0];
     List<ElementAnnotation> annotations = method.metadata;
     expect(annotations, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_metadata_namedParameter() {
+  test_metadata_namedParameter() async {
     Source source = addSource(r'''
 const A = null;
 f({@A int p : 0}) {}''');
@@ -1422,11 +1463,12 @@
     expect(parameters, hasLength(1));
     List<ElementAnnotation> annotations1 = parameters[0].metadata;
     expect(annotations1, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_metadata_positionalParameter() {
+  test_metadata_positionalParameter() async {
     Source source = addSource(r'''
 const A = null;
 f([@A int p = 0]) {}''');
@@ -1440,11 +1482,12 @@
     expect(parameters, hasLength(1));
     List<ElementAnnotation> annotations1 = parameters[0].metadata;
     expect(annotations1, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_metadata_simpleParameter() {
+  test_metadata_simpleParameter() async {
     Source source = addSource(r'''
 const A = null;
 f(@A p1, @A int p2) {}''');
@@ -1460,11 +1503,12 @@
     expect(annotations1, hasLength(1));
     List<ElementAnnotation> annotations2 = parameters[1].metadata;
     expect(annotations2, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_metadata_typedef() {
+  test_metadata_typedef() async {
     Source source = addSource(r'''
 const A = null;
 @A typedef F<A>();''');
@@ -1476,6 +1520,7 @@
     expect(aliases, hasLength(1));
     List<ElementAnnotation> annotations = aliases[0].metadata;
     expect(annotations, hasLength(1));
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     CompilationUnit unit = resolveCompilationUnit(source, library);
@@ -1494,7 +1539,7 @@
     expect(actualElement, same(expectedElement));
   }
 
-  void test_method_fromMixin() {
+  test_method_fromMixin() async {
     Source source = addSource(r'''
 class B {
   bar() => 1;
@@ -1507,12 +1552,12 @@
   bar() => super.bar();
   foo() => super.foo();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_method_fromMixins() {
+  test_method_fromMixins() async {
     Source source = addSource('''
 class B {}
 class M1 {
@@ -1527,6 +1572,7 @@
 }
 ''');
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     // Verify that the "f" in "new C().f()" refers to the "f" defined in M2.
@@ -1535,10 +1581,15 @@
     BlockFunctionBody body = main.functionExpression.body;
     ExpressionStatement stmt = body.block.statements[0];
     MethodInvocation expr = stmt.expression;
-    expect(expr.methodName.staticElement.enclosingElement.name, 'M2');
+    expect(
+        resolutionMap
+            .staticElementForIdentifier(expr.methodName)
+            .enclosingElement
+            .name,
+        'M2');
   }
 
-  void test_method_fromMixins_bare_identifier() {
+  test_method_fromMixins_bare_identifier() async {
     Source source = addSource('''
 class B {}
 class M1 {
@@ -1554,6 +1605,7 @@
 }
 ''');
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     // Verify that the call to f() in C.g() refers to the method defined in M2.
@@ -1563,10 +1615,15 @@
     ExpressionStatement stmt = body.block.statements[0];
     MethodInvocation invocation = stmt.expression;
     SimpleIdentifier methodName = invocation.methodName;
-    expect(methodName.staticElement.enclosingElement.name, 'M2');
+    expect(
+        resolutionMap
+            .staticElementForIdentifier(methodName)
+            .enclosingElement
+            .name,
+        'M2');
   }
 
-  void test_method_fromMixins_invked_from_outside_class() {
+  test_method_fromMixins_invked_from_outside_class() async {
     Source source = addSource('''
 class B {}
 class M1 {
@@ -1581,6 +1638,7 @@
 }
 ''');
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     // Verify that the call to f() in "new C().f()" refers to the method
@@ -1590,10 +1648,15 @@
     BlockFunctionBody body = main.functionExpression.body;
     ExpressionStatement stmt = body.block.statements[0];
     MethodInvocation invocation = stmt.expression;
-    expect(invocation.methodName.staticElement.enclosingElement.name, 'M2');
+    expect(
+        resolutionMap
+            .staticElementForIdentifier(invocation.methodName)
+            .enclosingElement
+            .name,
+        'M2');
   }
 
-  void test_method_fromSuperclassMixin() {
+  test_method_fromSuperclassMixin() async {
     Source source = addSource(r'''
 class A {
   void m1() {}
@@ -1605,12 +1668,12 @@
 f(C c) {
   c.m1();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_methodCascades() {
+  test_methodCascades() async {
     Source source = addSource(r'''
 class A {
   void m1() {}
@@ -1621,12 +1684,12 @@
      ..m2();
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_methodCascades_withSetter() {
+  test_methodCascades_withSetter() async {
     Source source = addSource(r'''
 class A {
   String name;
@@ -1639,22 +1702,22 @@
      ..m2();
   }
 }''');
-    computeLibrarySourceErrors(source);
     // failing with error code: INVOCATION_OF_NON_FUNCTION
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_resolveAgainstNull() {
+  test_resolveAgainstNull() async {
     Source source = addSource(r'''
 f(var p) {
   return null == p;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
   }
 
-  void test_setter_fromMixins_bare_identifier() {
+  test_setter_fromMixins_bare_identifier() async {
     Source source = addSource('''
 class B {}
 class M1 {
@@ -1670,6 +1733,7 @@
 }
 ''');
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     // Verify that the setter for "x" in C.f() refers to the setter defined in
@@ -1680,10 +1744,15 @@
     ExpressionStatement stmt = body.block.statements[0];
     AssignmentExpression assignment = stmt.expression;
     SimpleIdentifier leftHandSide = assignment.leftHandSide;
-    expect(leftHandSide.staticElement.enclosingElement.name, 'M2');
+    expect(
+        resolutionMap
+            .staticElementForIdentifier(leftHandSide)
+            .enclosingElement
+            .name,
+        'M2');
   }
 
-  void test_setter_fromMixins_property_access() {
+  test_setter_fromMixins_property_access() async {
     Source source = addSource('''
 class B {}
 class M1 {
@@ -1698,6 +1767,7 @@
 }
 ''');
     LibraryElement library = resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
     // Verify that the setter for "x" in "new C().x" refers to the setter
@@ -1709,10 +1779,14 @@
     AssignmentExpression assignment = stmt.expression;
     PropertyAccess propertyAccess = assignment.leftHandSide;
     expect(
-        propertyAccess.propertyName.staticElement.enclosingElement.name, 'M2');
+        resolutionMap
+            .staticElementForIdentifier(propertyAccess.propertyName)
+            .enclosingElement
+            .name,
+        'M2');
   }
 
-  void test_setter_inherited() {
+  test_setter_inherited() async {
     Source source = addSource(r'''
 class A {
   int get x => 0;
@@ -1722,12 +1796,12 @@
   int get x => super.x == null ? 0 : super.x;
   int f() => x = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_setter_static() {
+  test_setter_static() async {
     Source source = addSource(r'''
 set s(x) {
 }
@@ -1735,13 +1809,13 @@
 main() {
   s = 123;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
   @failingTest
-  void test_staticInvocation() {
+  test_staticInvocation() async {
     Source source = addSource(r'''
 class A {
   static int get g => (a,b) => 0;
@@ -1751,7 +1825,7 @@
     A.g(1,0);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
diff --git a/pkg/analyzer/test/generated/static_type_analyzer_driver_test.dart b/pkg/analyzer/test/generated/static_type_analyzer_driver_test.dart
new file mode 100644
index 0000000..9aa12df
--- /dev/null
+++ b/pkg/analyzer/test/generated/static_type_analyzer_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'static_type_analyzer_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(StaticTypeAnalyzer2Test_Driver);
+  });
+}
+
+@reflectiveTest
+class StaticTypeAnalyzer2Test_Driver extends StaticTypeAnalyzer2Test {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/static_type_analyzer_test.dart b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
index ae59f48..fc24a96 100644
--- a/pkg/analyzer/test/generated/static_type_analyzer_test.dart
+++ b/pkg/analyzer/test/generated/static_type_analyzer_test.dart
@@ -20,7 +20,6 @@
 import 'package:analyzer/src/generated/static_type_analyzer.dart';
 import 'package:analyzer/src/generated/testing/ast_test_factory.dart';
 import 'package:analyzer/src/generated/testing/element_factory.dart';
-import 'package:analyzer/src/generated/testing/test_type_provider.dart';
 import 'package:analyzer/src/generated/testing/token_factory.dart';
 import 'package:analyzer/src/source/source_resource.dart';
 import 'package:test/test.dart';
@@ -42,17 +41,17 @@
  */
 @reflectiveTest
 class StaticTypeAnalyzer2Test extends StaticTypeAnalyzer2TestShared {
-  void test_FunctionExpressionInvocation_block() {
+  test_FunctionExpressionInvocation_block() async {
     String code = r'''
 main() {
   var foo = (() { return 1; })();
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'dynamic', isNull);
   }
 
-  void test_FunctionExpressionInvocation_curried() {
+  test_FunctionExpressionInvocation_curried() async {
     String code = r'''
 typedef int F();
 F f() => null;
@@ -60,21 +59,21 @@
   var foo = f()();
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'int', isNull);
   }
 
-  void test_FunctionExpressionInvocation_expression() {
+  test_FunctionExpressionInvocation_expression() async {
     String code = r'''
 main() {
   var foo = (() => 1)();
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'int', isNull);
   }
 
-  void test_MethodInvocation_nameType_localVariable() {
+  test_MethodInvocation_nameType_localVariable() async {
     String code = r"""
 typedef Foo();
 main() {
@@ -82,24 +81,24 @@
   foo();
 }
 """;
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     // "foo" should be resolved to the "Foo" type
     expectIdentifierType("foo();", new isInstanceOf<FunctionType>());
   }
 
-  void test_MethodInvocation_nameType_parameter_FunctionTypeAlias() {
+  test_MethodInvocation_nameType_parameter_FunctionTypeAlias() async {
     String code = r"""
 typedef Foo();
 main(Foo foo) {
   foo();
 }
 """;
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     // "foo" should be resolved to the "Foo" type
     expectIdentifierType("foo();", new isInstanceOf<FunctionType>());
   }
 
-  void test_MethodInvocation_nameType_parameter_propagatedType() {
+  test_MethodInvocation_nameType_parameter_propagatedType() async {
     String code = r"""
 typedef Foo();
 main(p) {
@@ -108,12 +107,12 @@
   }
 }
 """;
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectIdentifierType("p()", DynamicTypeImpl.instance,
         predicate((type) => type.name == 'Foo'));
   }
 
-  void test_staticMethods_classTypeParameters() {
+  test_staticMethods_classTypeParameters() async {
     String code = r'''
 class C<T> {
   static void m() => null;
@@ -122,11 +121,11 @@
   print(C.m);
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectFunctionType('m);', '() → void');
   }
 
-  void test_staticMethods_classTypeParameters_genericMethod() {
+  test_staticMethods_classTypeParameters_genericMethod() async {
     String code = r'''
 class C<T> {
   static void m<S>(S s) {
@@ -138,14 +137,15 @@
   print(C.m);
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     // C - m
     TypeParameterType typeS;
     {
-      expectFunctionType('m);', '<S>(S) → void',
-          elementTypeParams: '[S]', typeFormals: '[S]');
+      FunctionTypeImpl type = expectFunctionType('m);', '<S>(S) → void',
+          elementTypeParams: '[S]',
+          typeFormals: '[S]',
+          identifierType: '(dynamic) → void');
 
-      FunctionTypeImpl type = findIdentifier('m);').staticType;
       typeS = type.typeFormals[0].type;
       type = type.instantiate([DynamicTypeImpl.instance]);
       expect(type.toString(), '(dynamic) → void');
@@ -155,13 +155,13 @@
     }
     // C - m - f
     {
-      expectFunctionType('f);', '<U>(S, U) → void',
+      FunctionTypeImpl type = expectFunctionType('f);', '<U>(S, U) → void',
           elementTypeParams: '[U]',
           typeParams: '[S]',
           typeArgs: '[S]',
-          typeFormals: '[U]');
+          typeFormals: '[U]',
+          identifierType: '(S, dynamic) → void');
 
-      FunctionTypeImpl type = findIdentifier('f);').staticType;
       type = type.instantiate([DynamicTypeImpl.instance]);
       expect(type.toString(), '(S, dynamic) → void');
       expect(type.typeParameters.toString(), '[S, U]');
@@ -191,7 +191,7 @@
   /**
    * The type provider used to access the types.
    */
-  TestTypeProvider _typeProvider;
+  TypeProvider _typeProvider;
 
   /**
    * The type system used to analyze the test cases.
@@ -1164,7 +1164,7 @@
   void test_visitNullLiteral() {
     // null
     Expression node = AstTestFactory.nullLiteral();
-    expect(_analyze(node), same(_typeProvider.bottomType));
+    expect(_analyze(node), same(_typeProvider.nullType));
     _listener.assertNoErrors();
   }
 
@@ -1551,7 +1551,7 @@
     LibraryElementImpl definingLibrary =
         new LibraryElementImpl.forNode(context, null);
     definingLibrary.definingCompilationUnit = definingCompilationUnit;
-    _typeProvider = new TestTypeProvider(context);
+    _typeProvider = context.typeProvider;
     _visitor = new ResolverVisitor(
         definingLibrary, source, _typeProvider, _listener,
         nameScope: new LibraryScope(definingLibrary));
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_driver_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_driver_test.dart
new file mode 100644
index 0000000..fcb17db
--- /dev/null
+++ b/pkg/analyzer/test/generated/static_type_warning_code_driver_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'static_type_warning_code_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(StaticTypeWarningCodeTest_Driver);
+    defineReflectiveTests(StrongModeStaticTypeWarningCodeTest_Driver);
+  });
+}
+
+@reflectiveTest
+class StaticTypeWarningCodeTest_Driver extends StaticTypeWarningCodeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
+
+@reflectiveTest
+class StrongModeStaticTypeWarningCodeTest_Driver
+    extends StrongModeStaticTypeWarningCodeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
index 82b972c..3165c76 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -23,10 +23,10 @@
 
 @reflectiveTest
 class StaticTypeWarningCodeTest extends ResolverTestCase {
-  void fail_method_lookup_mixin_of_extends() {
+  fail_method_lookup_mixin_of_extends() async {
     // See dartbug.com/25605
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
-    assertErrorsInUnverifiedCode(
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
+    await assertErrorsInUnverifiedCode(
         '''
 class A { a() => null; }
 class B {}
@@ -43,10 +43,10 @@
         ]);
   }
 
-  void fail_method_lookup_mixin_of_implements() {
+  fail_method_lookup_mixin_of_implements() async {
     // See dartbug.com/25605
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
-    assertErrorsInUnverifiedCode(
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
+    await assertErrorsInUnverifiedCode(
         '''
 class A { a() => null; }
 class B {}
@@ -62,10 +62,10 @@
         ]);
   }
 
-  void fail_method_lookup_mixin_of_mixin() {
+  fail_method_lookup_mixin_of_mixin() async {
     // See dartbug.com/25605
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
-    assertErrorsInUnverifiedCode(
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
+    await assertErrorsInUnverifiedCode(
         '''
 class A {}
 class B { b() => null; }
@@ -79,10 +79,10 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void fail_method_lookup_mixin_of_mixin_application() {
+  fail_method_lookup_mixin_of_mixin_application() async {
     // See dartbug.com/25605
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
-    assertErrorsInUnverifiedCode(
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
+    await assertErrorsInUnverifiedCode(
         '''
 class A { a() => null; }
 class B {}
@@ -96,8 +96,8 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void fail_typeArgumentNotMatchingBounds_ofFunctionTypeAlias() {
-    assertErrorsInCode(
+  fail_typeArgumentNotMatchingBounds_ofFunctionTypeAlias() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -107,9 +107,9 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void fail_undefinedEnumConstant() {
+  fail_undefinedEnumConstant() async {
     // We need a way to set the parseEnum flag in the parser to true.
-    assertErrorsInCode(
+    await assertErrorsInCode(
         r'''
 enum E { ONE }
 E e() {
@@ -118,7 +118,7 @@
         [StaticTypeWarningCode.UNDEFINED_ENUM_CONSTANT]);
   }
 
-  void test_ambiguousImport_function() {
+  test_ambiguousImport_function() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -133,18 +133,17 @@
         r'''
 library lib2;
 f() {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_assert_message_suppresses_type_promotion() {
+  test_assert_message_suppresses_type_promotion() async {
     // If a variable is assigned to inside the expression for an assert
     // message, type promotion should be suppressed, just as it would be if the
     // assignment occurred outside an assert statement.  (Note that it is a
     // dubious practice for the computation of an assert message to have side
     // effects, since it is only evaluated if the assert fails).
-    resetWithOptions(new AnalysisOptionsImpl()..enableAssertMessage = true);
-    assertErrorsInCode(
+    await assertErrorsInCode(
         '''
 class C {
   void foo() {}
@@ -161,8 +160,8 @@
     // Do not verify since `x.foo()` fails to resolve.
   }
 
-  void test_await_flattened() {
-    assertErrorsInCode(
+  test_await_flattened() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 Future<Future<int>> ffi() => null;
@@ -173,8 +172,8 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_await_simple() {
-    assertErrorsInCode(
+  test_await_simple() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 Future<int> fi() => null;
@@ -185,8 +184,8 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_awaitForIn_declaredVariableRightType() {
-    assertNoErrorsInCode('''
+  test_awaitForIn_declaredVariableRightType() async {
+    await assertNoErrorsInCode('''
 import 'dart:async';
 f() async {
   Stream<int> stream;
@@ -195,8 +194,8 @@
 ''');
   }
 
-  void test_awaitForIn_declaredVariableWrongType() {
-    assertErrorsInCode(
+  test_awaitForIn_declaredVariableWrongType() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 f() async {
@@ -207,8 +206,8 @@
         [StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE]);
   }
 
-  void test_awaitForIn_downcast() {
-    assertNoErrorsInCode('''
+  test_awaitForIn_downcast() async {
+    await assertNoErrorsInCode('''
 import 'dart:async';
 f() async {
   Stream<num> stream;
@@ -217,8 +216,8 @@
 ''');
   }
 
-  void test_awaitForIn_dynamicStream() {
-    assertNoErrorsInCode('''
+  test_awaitForIn_dynamicStream() async {
+    await assertNoErrorsInCode('''
 f() async {
   dynamic stream;
   await for (int i in stream) {}
@@ -226,8 +225,8 @@
 ''');
   }
 
-  void test_awaitForIn_dynamicVariable() {
-    assertNoErrorsInCode('''
+  test_awaitForIn_dynamicVariable() async {
+    await assertNoErrorsInCode('''
 import 'dart:async';
 f() async {
   Stream<int> stream;
@@ -236,8 +235,8 @@
 ''');
   }
 
-  void test_awaitForIn_existingVariableRightType() {
-    assertNoErrorsInCode('''
+  test_awaitForIn_existingVariableRightType() async {
+    await assertNoErrorsInCode('''
 import 'dart:async';
 f() async {
   Stream<int> stream;
@@ -247,8 +246,8 @@
 ''');
   }
 
-  void test_awaitForIn_existingVariableWrongType() {
-    assertErrorsInCode(
+  test_awaitForIn_existingVariableWrongType() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 f() async {
@@ -260,8 +259,8 @@
         [StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE]);
   }
 
-  void test_awaitForIn_notStream() {
-    assertErrorsInCode(
+  test_awaitForIn_notStream() async {
+    await assertErrorsInCode(
         '''
 f() async {
   await for (var i in true) {}
@@ -270,8 +269,8 @@
         [StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE]);
   }
 
-  void test_awaitForIn_streamOfDynamic() {
-    assertNoErrorsInCode('''
+  test_awaitForIn_streamOfDynamic() async {
+    await assertNoErrorsInCode('''
 import 'dart:async';
 f() async {
   Stream stream;
@@ -280,8 +279,8 @@
 ''');
   }
 
-  void test_awaitForIn_upcast() {
-    assertNoErrorsInCode('''
+  test_awaitForIn_upcast() async {
+    await assertNoErrorsInCode('''
 import 'dart:async';
 f() async {
   Stream<int> stream;
@@ -290,8 +289,8 @@
 ''');
   }
 
-  void test_bug21912() {
-    assertErrorsInCode(
+  test_bug21912() async {
+    await assertErrorsInCode(
         '''
 class A {}
 class B extends A {}
@@ -318,8 +317,8 @@
         ]);
   }
 
-  void test_expectedOneListTypeArgument() {
-    assertErrorsInCode(
+  test_expectedOneListTypeArgument() async {
+    await assertErrorsInCode(
         r'''
 main() {
   <int, int> [];
@@ -327,8 +326,8 @@
         [StaticTypeWarningCode.EXPECTED_ONE_LIST_TYPE_ARGUMENTS]);
   }
 
-  void test_expectedTwoMapTypeArguments_one() {
-    assertErrorsInCode(
+  test_expectedTwoMapTypeArguments_one() async {
+    await assertErrorsInCode(
         r'''
 main() {
   <int> {};
@@ -336,8 +335,8 @@
         [StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS]);
   }
 
-  void test_expectedTwoMapTypeArguments_three() {
-    assertErrorsInCode(
+  test_expectedTwoMapTypeArguments_three() async {
+    await assertErrorsInCode(
         r'''
 main() {
   <int, int, int> {};
@@ -345,16 +344,16 @@
         [StaticTypeWarningCode.EXPECTED_TWO_MAP_TYPE_ARGUMENTS]);
   }
 
-  void test_forIn_declaredVariableRightType() {
-    assertNoErrorsInCode('''
+  test_forIn_declaredVariableRightType() async {
+    await assertNoErrorsInCode('''
 f() {
   for (int i in <int>[]) {}
 }
 ''');
   }
 
-  void test_forIn_declaredVariableWrongType() {
-    assertErrorsInCode(
+  test_forIn_declaredVariableWrongType() async {
+    await assertErrorsInCode(
         '''
 f() {
   for (int i in <String>[]) {}
@@ -363,16 +362,16 @@
         [StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE]);
   }
 
-  void test_forIn_downcast() {
-    assertNoErrorsInCode('''
+  test_forIn_downcast() async {
+    await assertNoErrorsInCode('''
 f() {
   for (int i in <num>[]) {}
 }
 ''');
   }
 
-  void test_forIn_dynamic() {
-    assertNoErrorsInCode('''
+  test_forIn_dynamic() async {
+    await assertNoErrorsInCode('''
 f() {
   dynamic d; // Could be [].
   for (var i in d) {}
@@ -380,8 +379,8 @@
 ''');
   }
 
-  void test_forIn_dynamicIterable() {
-    assertNoErrorsInCode('''
+  test_forIn_dynamicIterable() async {
+    await assertNoErrorsInCode('''
 f() {
   dynamic iterable;
   for (int i in iterable) {}
@@ -389,16 +388,16 @@
 ''');
   }
 
-  void test_forIn_dynamicVariable() {
-    assertNoErrorsInCode('''
+  test_forIn_dynamicVariable() async {
+    await assertNoErrorsInCode('''
 f() {
   for (var i in <int>[]) {}
 }
 ''');
   }
 
-  void test_forIn_existingVariableRightType() {
-    assertNoErrorsInCode('''
+  test_forIn_existingVariableRightType() async {
+    await assertNoErrorsInCode('''
 f() {
   int i;
   for (i in <int>[]) {}
@@ -406,8 +405,8 @@
 ''');
   }
 
-  void test_forIn_existingVariableWrongType() {
-    assertErrorsInCode(
+  test_forIn_existingVariableWrongType() async {
+    await assertErrorsInCode(
         '''
 f() {
   int i;
@@ -417,16 +416,16 @@
         [StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE]);
   }
 
-  void test_forIn_iterableOfDynamic() {
-    assertNoErrorsInCode('''
+  test_forIn_iterableOfDynamic() async {
+    await assertNoErrorsInCode('''
 f() {
   for (int i in []) {}
 }
 ''');
   }
 
-  void test_forIn_notIterable() {
-    assertErrorsInCode(
+  test_forIn_notIterable() async {
+    await assertErrorsInCode(
         '''
 f() {
   for (var i in true) {}
@@ -435,8 +434,8 @@
         [StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE]);
   }
 
-  void test_forIn_object() {
-    assertNoErrorsInCode('''
+  test_forIn_object() async {
+    await assertNoErrorsInCode('''
 f() {
   Object o; // Could be [].
   for (var i in o) {}
@@ -444,8 +443,8 @@
 ''');
   }
 
-  void test_forIn_typeBoundBad() {
-    assertErrorsInCode(
+  test_forIn_typeBoundBad() async {
+    await assertErrorsInCode(
         '''
 class Foo<T extends Iterable<int>> {
   void method(T iterable) {
@@ -456,8 +455,8 @@
         [StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE]);
   }
 
-  void test_forIn_typeBoundGood() {
-    assertNoErrorsInCode('''
+  test_forIn_typeBoundGood() async {
+    await assertNoErrorsInCode('''
 class Foo<T extends Iterable<int>> {
   void method(T iterable) {
     for (var i in iterable) {}
@@ -466,25 +465,25 @@
 ''');
   }
 
-  void test_forIn_upcast() {
-    assertNoErrorsInCode('''
+  test_forIn_upcast() async {
+    await assertNoErrorsInCode('''
 f() {
   for (num i in <int>[]) {}
 }
 ''');
   }
 
-  void test_illegalAsyncGeneratorReturnType_function_nonStream() {
-    assertErrorsInCode(
+  test_illegalAsyncGeneratorReturnType_function_nonStream() async {
+    await assertErrorsInCode(
         '''
 int f() async* {}
 ''',
         [StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE]);
   }
 
-  void test_illegalAsyncGeneratorReturnType_function_subtypeOfStream() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
-    assertErrorsInCode(
+  test_illegalAsyncGeneratorReturnType_function_subtypeOfStream() async {
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 abstract class SubStream<T> implements Stream<T> {}
@@ -493,8 +492,8 @@
         [StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE]);
   }
 
-  void test_illegalAsyncGeneratorReturnType_method_nonStream() {
-    assertErrorsInCode(
+  test_illegalAsyncGeneratorReturnType_method_nonStream() async {
+    await assertErrorsInCode(
         '''
 class C {
   int f() async* {}
@@ -503,9 +502,9 @@
         [StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE]);
   }
 
-  void test_illegalAsyncGeneratorReturnType_method_subtypeOfStream() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
-    assertErrorsInCode(
+  test_illegalAsyncGeneratorReturnType_method_subtypeOfStream() async {
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 abstract class SubStream<T> implements Stream<T> {}
@@ -516,8 +515,8 @@
         [StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE]);
   }
 
-  void test_illegalAsyncReturnType_function_nonFuture() {
-    assertErrorsInCode(
+  test_illegalAsyncReturnType_function_nonFuture() async {
+    await assertErrorsInCode(
         '''
 int f() async {}
 ''',
@@ -527,9 +526,9 @@
         ]);
   }
 
-  void test_illegalAsyncReturnType_function_subtypeOfFuture() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
-    assertErrorsInCode(
+  test_illegalAsyncReturnType_function_subtypeOfFuture() async {
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 abstract class SubFuture<T> implements Future<T> {}
@@ -540,8 +539,8 @@
         [StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE]);
   }
 
-  void test_illegalAsyncReturnType_method_nonFuture() {
-    assertErrorsInCode(
+  test_illegalAsyncReturnType_method_nonFuture() async {
+    await assertErrorsInCode(
         '''
 class C {
   int m() async {}
@@ -553,9 +552,9 @@
         ]);
   }
 
-  void test_illegalAsyncReturnType_method_subtypeOfFuture() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
-    assertErrorsInCode(
+  test_illegalAsyncReturnType_method_subtypeOfFuture() async {
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 abstract class SubFuture<T> implements Future<T> {}
@@ -568,17 +567,17 @@
         [StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE]);
   }
 
-  void test_illegalSyncGeneratorReturnType_function_nonIterator() {
-    assertErrorsInCode(
+  test_illegalSyncGeneratorReturnType_function_nonIterator() async {
+    await assertErrorsInCode(
         '''
 int f() sync* {}
 ''',
         [StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE]);
   }
 
-  void test_illegalSyncGeneratorReturnType_function_subclassOfIterator() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
-    assertErrorsInCode(
+  test_illegalSyncGeneratorReturnType_function_subclassOfIterator() async {
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+    await assertErrorsInCode(
         '''
 abstract class SubIterator<T> implements Iterator<T> {}
 SubIterator<int> f() sync* {}
@@ -586,8 +585,8 @@
         [StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE]);
   }
 
-  void test_illegalSyncGeneratorReturnType_method_nonIterator() {
-    assertErrorsInCode(
+  test_illegalSyncGeneratorReturnType_method_nonIterator() async {
+    await assertErrorsInCode(
         '''
 class C {
   int f() sync* {}
@@ -596,9 +595,9 @@
         [StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE]);
   }
 
-  void test_illegalSyncGeneratorReturnType_method_subclassOfIterator() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
-    assertErrorsInCode(
+  test_illegalSyncGeneratorReturnType_method_subclassOfIterator() async {
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+    await assertErrorsInCode(
         '''
 abstract class SubIterator<T> implements Iterator<T> {}
 class C {
@@ -608,8 +607,8 @@
         [StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE]);
   }
 
-  void test_inconsistentMethodInheritance_paramCount() {
-    assertErrorsInCode(
+  test_inconsistentMethodInheritance_paramCount() async {
+    await assertErrorsInCode(
         r'''
 abstract class A {
   int x();
@@ -622,8 +621,8 @@
         [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
   }
 
-  void test_inconsistentMethodInheritance_paramType() {
-    assertErrorsInCode(
+  test_inconsistentMethodInheritance_paramType() async {
+    await assertErrorsInCode(
         r'''
 abstract class A {
   x(int i);
@@ -636,8 +635,8 @@
         [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
   }
 
-  void test_inconsistentMethodInheritance_returnType() {
-    assertErrorsInCode(
+  test_inconsistentMethodInheritance_returnType() async {
+    await assertErrorsInCode(
         r'''
 abstract class A {
   int x();
@@ -650,8 +649,8 @@
         [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
   }
 
-  void test_instanceAccessToStaticMember_method_invocation() {
-    assertErrorsInCode(
+  test_instanceAccessToStaticMember_method_invocation() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static m() {}
@@ -662,8 +661,8 @@
         [StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
   }
 
-  void test_instanceAccessToStaticMember_method_reference() {
-    assertErrorsInCode(
+  test_instanceAccessToStaticMember_method_reference() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static m() {}
@@ -674,8 +673,8 @@
         [StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
   }
 
-  void test_instanceAccessToStaticMember_propertyAccess_field() {
-    assertErrorsInCode(
+  test_instanceAccessToStaticMember_propertyAccess_field() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static var f;
@@ -686,8 +685,8 @@
         [StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
   }
 
-  void test_instanceAccessToStaticMember_propertyAccess_getter() {
-    assertErrorsInCode(
+  test_instanceAccessToStaticMember_propertyAccess_getter() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static get f => 42;
@@ -698,8 +697,8 @@
         [StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
   }
 
-  void test_instanceAccessToStaticMember_propertyAccess_setter() {
-    assertErrorsInCode(
+  test_instanceAccessToStaticMember_propertyAccess_setter() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static set f(x) {}
@@ -710,8 +709,8 @@
         [StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER]);
   }
 
-  void test_invalidAssignment_compoundAssignment() {
-    assertErrorsInCode(
+  test_invalidAssignment_compoundAssignment() async {
+    await assertErrorsInCode(
         r'''
 class byte {
   int _value;
@@ -726,24 +725,24 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_defaultValue_named() {
-    assertErrorsInCode(
+  test_invalidAssignment_defaultValue_named() async {
+    await assertErrorsInCode(
         r'''
 f({String x: 0}) {
 }''',
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_defaultValue_optional() {
-    assertErrorsInCode(
+  test_invalidAssignment_defaultValue_optional() async {
+    await assertErrorsInCode(
         r'''
 f([String x = 0]) {
 }''',
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_dynamic() {
-    assertErrorsInCode(
+  test_invalidAssignment_dynamic() async {
+    await assertErrorsInCode(
         r'''
 main() {
   dynamic = 1;
@@ -752,8 +751,8 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_functionExpressionInvocation() {
-    assertErrorsInCode(
+  test_invalidAssignment_functionExpressionInvocation() async {
+    await assertErrorsInCode(
         '''
 main() {
   String x = (() => 5)();
@@ -761,8 +760,8 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_ifNullAssignment() {
-    assertErrorsInCode(
+  test_invalidAssignment_ifNullAssignment() async {
+    await assertErrorsInCode(
         '''
 void f(int i) {
   double d;
@@ -772,8 +771,8 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_instanceVariable() {
-    assertErrorsInCode(
+  test_invalidAssignment_instanceVariable() async {
+    await assertErrorsInCode(
         r'''
 class A {
   int x;
@@ -785,8 +784,8 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_localVariable() {
-    assertErrorsInCode(
+  test_invalidAssignment_localVariable() async {
+    await assertErrorsInCode(
         r'''
 f() {
   int x;
@@ -795,9 +794,9 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_regressionInIssue18468Fix() {
+  test_invalidAssignment_regressionInIssue18468Fix() async {
     // https://code.google.com/p/dart/issues/detail?id=18628
-    assertErrorsInCode(
+    await assertErrorsInCode(
         r'''
 class C<T> {
   T t = int;
@@ -805,8 +804,8 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_staticVariable() {
-    assertErrorsInCode(
+  test_invalidAssignment_staticVariable() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static int x;
@@ -817,14 +816,14 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_topLevelVariableDeclaration() {
-    assertErrorsInCode(
+  test_invalidAssignment_topLevelVariableDeclaration() async {
+    await assertErrorsInCode(
         "int x = 'string';", [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_typeParameter() {
+  test_invalidAssignment_typeParameter() async {
     // 14221
-    assertErrorsInCode(
+    await assertErrorsInCode(
         r'''
 class B<T> {
   T value;
@@ -835,8 +834,8 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invalidAssignment_variableDeclaration() {
-    assertErrorsInCode(
+  test_invalidAssignment_variableDeclaration() async {
+    await assertErrorsInCode(
         r'''
 class A {
   int x = 'string';
@@ -844,8 +843,8 @@
         [StaticTypeWarningCode.INVALID_ASSIGNMENT]);
   }
 
-  void test_invocationOfNonFunction_class() {
-    assertErrorsInCode(
+  test_invocationOfNonFunction_class() async {
+    await assertErrorsInCode(
         r'''
 class A {
   void m() {
@@ -855,15 +854,15 @@
         [StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
   }
 
-  void test_invocationOfNonFunction_localGenericFunction() {
+  test_invocationOfNonFunction_localGenericFunction() async {
     // Objects having a specific function type may be invoked, but objects
     // having type Function may not, because type Function lacks a call method
     // (this is because it is impossible to know what signature the call should
     // have).
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableStrictCallChecks = true;
-    resetWithOptions(options);
-    assertErrorsInCode(
+    resetWith(options: options);
+    await assertErrorsInCode(
         '''
 f(Function f) {
   return f();
@@ -871,11 +870,11 @@
         [StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
   }
 
-  void test_invocationOfNonFunction_localObject() {
+  test_invocationOfNonFunction_localObject() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableStrictCallChecks = true;
-    resetWithOptions(options);
-    assertErrorsInCode(
+    resetWith(options: options);
+    await assertErrorsInCode(
         '''
 f(Object o) {
   return o();
@@ -883,8 +882,8 @@
         [StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
   }
 
-  void test_invocationOfNonFunction_localVariable() {
-    assertErrorsInCode(
+  test_invocationOfNonFunction_localVariable() async {
+    await assertErrorsInCode(
         r'''
 f() {
   int x;
@@ -893,8 +892,8 @@
         [StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
   }
 
-  void test_invocationOfNonFunction_ordinaryInvocation() {
-    assertErrorsInCode(
+  test_invocationOfNonFunction_ordinaryInvocation() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static int x;
@@ -908,8 +907,8 @@
     // A call to verify(source) fails as A.x() cannot be resolved.
   }
 
-  void test_invocationOfNonFunction_staticInvocation() {
-    assertErrorsInCode(
+  test_invocationOfNonFunction_staticInvocation() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static int get g => 0;
@@ -921,8 +920,8 @@
     // A call to verify(source) fails as g() cannot be resolved.
   }
 
-  void test_invocationOfNonFunction_superExpression() {
-    assertErrorsInCode(
+  test_invocationOfNonFunction_superExpression() async {
+    await assertErrorsInCode(
         r'''
 class A {
   int get g => 0;
@@ -935,8 +934,8 @@
         [StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION]);
   }
 
-  void test_invocationOfNonFunctionExpression_literal() {
-    assertErrorsInCode(
+  test_invocationOfNonFunctionExpression_literal() async {
+    await assertErrorsInCode(
         r'''
 f() {
   3(5);
@@ -944,13 +943,13 @@
         [StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION]);
   }
 
-  void test_nonBoolCondition_conditional() {
-    assertErrorsInCode("f() { return 3 ? 2 : 1; }",
+  test_nonBoolCondition_conditional() async {
+    await assertErrorsInCode("f() { return 3 ? 2 : 1; }",
         [StaticTypeWarningCode.NON_BOOL_CONDITION]);
   }
 
-  void test_nonBoolCondition_do() {
-    assertErrorsInCode(
+  test_nonBoolCondition_do() async {
+    await assertErrorsInCode(
         r'''
 f() {
   do {} while (3);
@@ -958,9 +957,9 @@
         [StaticTypeWarningCode.NON_BOOL_CONDITION]);
   }
 
-  void test_nonBoolCondition_for() {
+  test_nonBoolCondition_for() async {
     // https://github.com/dart-lang/sdk/issues/24713
-    assertErrorsInCode(
+    await assertErrorsInCode(
         r'''
 f() {
   for (;3;) {}
@@ -968,8 +967,8 @@
         [StaticTypeWarningCode.NON_BOOL_CONDITION]);
   }
 
-  void test_nonBoolCondition_if() {
-    assertErrorsInCode(
+  test_nonBoolCondition_if() async {
+    await assertErrorsInCode(
         r'''
 f() {
   if (3) return 2; else return 1;
@@ -977,8 +976,8 @@
         [StaticTypeWarningCode.NON_BOOL_CONDITION]);
   }
 
-  void test_nonBoolCondition_while() {
-    assertErrorsInCode(
+  test_nonBoolCondition_while() async {
+    await assertErrorsInCode(
         r'''
 f() {
   while (3) {}
@@ -986,8 +985,8 @@
         [StaticTypeWarningCode.NON_BOOL_CONDITION]);
   }
 
-  void test_nonBoolExpression_functionType() {
-    assertErrorsInCode(
+  test_nonBoolExpression_functionType() async {
+    await assertErrorsInCode(
         r'''
 int makeAssertion() => 1;
 f() {
@@ -996,8 +995,8 @@
         [StaticTypeWarningCode.NON_BOOL_EXPRESSION]);
   }
 
-  void test_nonBoolExpression_interfaceType() {
-    assertErrorsInCode(
+  test_nonBoolExpression_interfaceType() async {
+    await assertErrorsInCode(
         r'''
 f() {
   assert(0);
@@ -1005,8 +1004,8 @@
         [StaticTypeWarningCode.NON_BOOL_EXPRESSION]);
   }
 
-  void test_nonBoolNegationExpression() {
-    assertErrorsInCode(
+  test_nonBoolNegationExpression() async {
+    await assertErrorsInCode(
         r'''
 f() {
   !42;
@@ -1014,8 +1013,8 @@
         [StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION]);
   }
 
-  void test_nonBoolOperand_and_left() {
-    assertErrorsInCode(
+  test_nonBoolOperand_and_left() async {
+    await assertErrorsInCode(
         r'''
 bool f(int left, bool right) {
   return left && right;
@@ -1023,8 +1022,8 @@
         [StaticTypeWarningCode.NON_BOOL_OPERAND]);
   }
 
-  void test_nonBoolOperand_and_right() {
-    assertErrorsInCode(
+  test_nonBoolOperand_and_right() async {
+    await assertErrorsInCode(
         r'''
 bool f(bool left, String right) {
   return left && right;
@@ -1032,8 +1031,8 @@
         [StaticTypeWarningCode.NON_BOOL_OPERAND]);
   }
 
-  void test_nonBoolOperand_or_left() {
-    assertErrorsInCode(
+  test_nonBoolOperand_or_left() async {
+    await assertErrorsInCode(
         r'''
 bool f(List<int> left, bool right) {
   return left || right;
@@ -1041,8 +1040,8 @@
         [StaticTypeWarningCode.NON_BOOL_OPERAND]);
   }
 
-  void test_nonBoolOperand_or_right() {
-    assertErrorsInCode(
+  test_nonBoolOperand_or_right() async {
+    await assertErrorsInCode(
         r'''
 bool f(bool left, double right) {
   return left || right;
@@ -1050,8 +1049,8 @@
         [StaticTypeWarningCode.NON_BOOL_OPERAND]);
   }
 
-  void test_nonTypeAsTypeArgument_notAType() {
-    assertErrorsInCode(
+  test_nonTypeAsTypeArgument_notAType() async {
+    await assertErrorsInCode(
         r'''
 int A;
 class B<E> {}
@@ -1059,27 +1058,16 @@
         [StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT]);
   }
 
-  void test_nonTypeAsTypeArgument_undefinedIdentifier() {
-    assertErrorsInCode(
+  test_nonTypeAsTypeArgument_undefinedIdentifier() async {
+    await assertErrorsInCode(
         r'''
 class B<E> {}
 f(B<A> b) {}''',
         [StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT]);
   }
 
-  void test_returnOfInvalidType_async_future_int_mismatches_future_null() {
-    assertErrorsInCode(
-        '''
-import 'dart:async';
-Future<Null> f() async {
-  return 5;
-}
-''',
-        [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
-  }
-
-  void test_returnOfInvalidType_async_future_int_mismatches_future_string() {
-    assertErrorsInCode(
+  test_returnOfInvalidType_async_future_int_mismatches_future_string() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 Future<String> f() async {
@@ -1089,8 +1077,8 @@
         [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_async_future_int_mismatches_int() {
-    assertErrorsInCode(
+  test_returnOfInvalidType_async_future_int_mismatches_int() async {
+    await assertErrorsInCode(
         '''
 int f() async {
   return 5;
@@ -1102,18 +1090,18 @@
         ]);
   }
 
-  void test_returnOfInvalidType_expressionFunctionBody_function() {
-    assertErrorsInCode(
+  test_returnOfInvalidType_expressionFunctionBody_function() async {
+    await assertErrorsInCode(
         "int f() => '0';", [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_expressionFunctionBody_getter() {
-    assertErrorsInCode(
+  test_returnOfInvalidType_expressionFunctionBody_getter() async {
+    await assertErrorsInCode(
         "int get g => '0';", [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_expressionFunctionBody_localFunction() {
-    assertErrorsInCode(
+  test_returnOfInvalidType_expressionFunctionBody_localFunction() async {
+    await assertErrorsInCode(
         r'''
 class A {
   String m() {
@@ -1124,8 +1112,8 @@
         [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_expressionFunctionBody_method() {
-    assertErrorsInCode(
+  test_returnOfInvalidType_expressionFunctionBody_method() async {
+    await assertErrorsInCode(
         r'''
 class A {
   int f() => '0';
@@ -1133,23 +1121,23 @@
         [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_expressionFunctionBody_void() {
-    assertErrorsInCode(
+  test_returnOfInvalidType_expressionFunctionBody_void() async {
+    await assertErrorsInCode(
         "void f() => 42;", [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_function() {
-    assertErrorsInCode("int f() { return '0'; }",
+  test_returnOfInvalidType_function() async {
+    await assertErrorsInCode("int f() { return '0'; }",
         [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_getter() {
-    assertErrorsInCode("int get g { return '0'; }",
+  test_returnOfInvalidType_getter() async {
+    await assertErrorsInCode("int get g { return '0'; }",
         [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_localFunction() {
-    assertErrorsInCode(
+  test_returnOfInvalidType_localFunction() async {
+    await assertErrorsInCode(
         r'''
 class A {
   String m() {
@@ -1160,8 +1148,8 @@
         [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_method() {
-    assertErrorsInCode(
+  test_returnOfInvalidType_method() async {
+    await assertErrorsInCode(
         r'''
 class A {
   int f() { return '0'; }
@@ -1169,8 +1157,8 @@
         [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_returnOfInvalidType_not_issued_for_valid_generic_return() {
-    assertNoErrorsInCode(r'''
+  test_returnOfInvalidType_not_issued_for_valid_generic_return() async {
+    await assertNoErrorsInCode(r'''
 abstract class F<T, U>  {
   U get value;
 }
@@ -1186,13 +1174,13 @@
 void main() { }''');
   }
 
-  void test_returnOfInvalidType_void() {
-    assertErrorsInCode("void f() { return 42; }",
+  test_returnOfInvalidType_void() async {
+    await assertErrorsInCode("void f() { return 42; }",
         [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
   }
 
-  void test_typeArgumentNotMatchingBounds_classTypeAlias() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_classTypeAlias() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1203,8 +1191,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_extends() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_extends() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1214,9 +1202,9 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_extends_regressionInIssue18468Fix() {
+  test_typeArgumentNotMatchingBounds_extends_regressionInIssue18468Fix() async {
     // https://code.google.com/p/dart/issues/detail?id=18628
-    assertErrorsInCode(
+    await assertErrorsInCode(
         r'''
 class X<T extends Type> {}
 class Y<U> extends X<U> {}
@@ -1224,8 +1212,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_fieldFormalParameter() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_fieldFormalParameter() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1237,8 +1225,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_functionReturnType() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_functionReturnType() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1248,8 +1236,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_functionTypeAlias() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_functionTypeAlias() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1259,8 +1247,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_functionTypedFormalParameter() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_functionTypedFormalParameter() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1270,8 +1258,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_implements() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_implements() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1281,8 +1269,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_is() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_is() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1292,9 +1280,9 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_methodInvocation_localFunction() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_methodInvocation_localFunction() async {
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+    await assertErrorsInCode(
         r'''
 class Point<T extends num> {
   Point(T x, T y);
@@ -1310,9 +1298,9 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_methodInvocation_method() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_methodInvocation_method() async {
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+    await assertErrorsInCode(
         r'''
 class Point<T extends num> {
   Point(T x, T y);
@@ -1331,9 +1319,9 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_methodInvocation_topLevelFunction() {
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_methodInvocation_topLevelFunction() async {
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
+    await assertErrorsInCode(
         r'''
 class Point<T extends num> {
   Point(T x, T y);
@@ -1350,8 +1338,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_methodReturnType() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_methodReturnType() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1362,8 +1350,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_new() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_new() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1373,8 +1361,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_new_superTypeOfUpperBound() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_new_superTypeOfUpperBound() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B extends A {}
@@ -1385,8 +1373,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_parameter() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_parameter() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1396,8 +1384,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_redirectingConstructor() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_redirectingConstructor() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1411,8 +1399,8 @@
         ]);
   }
 
-  void test_typeArgumentNotMatchingBounds_typeArgumentList() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_typeArgumentList() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1423,8 +1411,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_typeParameter() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_typeParameter() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1435,8 +1423,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_variableDeclaration() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_variableDeclaration() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1446,8 +1434,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeArgumentNotMatchingBounds_with() {
-    assertErrorsInCode(
+  test_typeArgumentNotMatchingBounds_with() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {}
@@ -1457,8 +1445,8 @@
         [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
   }
 
-  void test_typeParameterSupertypeOfItsBound() {
-    assertErrorsInCode(
+  test_typeParameterSupertypeOfItsBound() async {
+    await assertErrorsInCode(
         r'''
 class A<T extends T> {
 }
@@ -1466,9 +1454,8 @@
         [StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND]);
   }
 
-  void
-      test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_mutated() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_mutated() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 callMe(f()) { f(); }
 main(Object p) {
@@ -1478,8 +1465,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_booleanAnd_useInRight_mutatedInLeft() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_booleanAnd_useInRight_mutatedInLeft() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   ((p is String) && ((p = 42) == 42)) && p.length != 0;
@@ -1487,8 +1474,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_booleanAnd_useInRight_mutatedInRight() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_booleanAnd_useInRight_mutatedInRight() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   (p is String) && (((p = 42) == 42) && p.length != 0);
@@ -1496,9 +1483,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void
-      test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_after() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_after() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 callMe(f()) { f(); }
 main(Object p) {
@@ -1508,9 +1494,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void
-      test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_before() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_before() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 callMe(f()) { f(); }
 main(Object p) {
@@ -1520,8 +1505,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_conditional_useInThen_hasAssignment() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_conditional_useInThen_hasAssignment() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   p is String ? (p.length + (p = 42)) : 0;
@@ -1529,8 +1514,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_accessedInClosure_hasAssignment() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_accessedInClosure_hasAssignment() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 callMe(f()) { f(); }
 main(Object p) {
@@ -1544,8 +1529,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_and_right_hasAssignment() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_and_right_hasAssignment() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   if (p is String && (p = null) == null) {
@@ -1555,8 +1540,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_extends_notMoreSpecific_dynamic() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_extends_notMoreSpecific_dynamic() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class V {}
 class A<T> {}
@@ -1572,8 +1557,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_extends_notMoreSpecific_notMoreSpecificTypeArg() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_extends_notMoreSpecific_notMoreSpecificTypeArg() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class V {}
 class A<T> {}
@@ -1589,8 +1574,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_hasAssignment_after() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_hasAssignment_after() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   if (p is String) {
@@ -1601,8 +1586,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_hasAssignment_before() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_hasAssignment_before() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   if (p is String) {
@@ -1613,8 +1598,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_hasAssignment_inClosure_anonymous_after() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_hasAssignment_inClosure_anonymous_after() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   if (p is String) {
@@ -1625,8 +1610,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_hasAssignment_inClosure_anonymous_before() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_hasAssignment_inClosure_anonymous_before() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   () {p = 0;};
@@ -1637,8 +1622,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_hasAssignment_inClosure_function_after() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_hasAssignment_inClosure_function_after() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   if (p is String) {
@@ -1649,8 +1634,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_hasAssignment_inClosure_function_before() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_hasAssignment_inClosure_function_before() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 main(Object p) {
   f() {p = 0;};
@@ -1661,8 +1646,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_implements_notMoreSpecific_dynamic() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_implements_notMoreSpecific_dynamic() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class V {}
 class A<T> {}
@@ -1678,8 +1663,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_typePromotion_if_with_notMoreSpecific_dynamic() {
-    assertErrorsInUnverifiedCode(
+  test_typePromotion_if_with_notMoreSpecific_dynamic() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class V {}
 class A<T> {}
@@ -1695,8 +1680,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedFunction() {
-    assertErrorsInCode(
+  test_undefinedFunction() async {
+    await assertErrorsInCode(
         r'''
 void f() {
   g();
@@ -1704,8 +1689,8 @@
         [StaticTypeWarningCode.UNDEFINED_FUNCTION]);
   }
 
-  void test_undefinedFunction_inCatch() {
-    assertErrorsInCode(
+  test_undefinedFunction_inCatch() async {
+    await assertErrorsInCode(
         r'''
 void f() {
   try {
@@ -1716,7 +1701,7 @@
         [StaticTypeWarningCode.UNDEFINED_FUNCTION]);
   }
 
-  void test_undefinedFunction_inImportedLib() {
+  test_undefinedFunction_inImportedLib() async {
     Source source = addSource(r'''
 import 'lib.dart' as f;
 main() { return f.g(); }''');
@@ -1725,26 +1710,26 @@
         r'''
 library lib;
 h() {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_FUNCTION]);
   }
 
-  void test_undefinedGetter() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedGetter() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class T {}
 f(T e) { return e.m; }''',
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedGetter_generic_function_call() {
+  test_undefinedGetter_generic_function_call() async {
     // Objects having a specific function type have a call() method, but
     // objects having type Function do not (this is because it is impossible to
     // know what signature the call should have).
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableStrictCallChecks = true;
-    resetWithOptions(options);
-    assertErrorsInUnverifiedCode(
+    resetWith(options: options);
+    await assertErrorsInUnverifiedCode(
         '''
 f(Function f) {
   return f.call;
@@ -1753,11 +1738,11 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedGetter_object_call() {
+  test_undefinedGetter_object_call() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableStrictCallChecks = true;
-    resetWithOptions(options);
-    assertErrorsInUnverifiedCode(
+    resetWith(options: options);
+    await assertErrorsInUnverifiedCode(
         '''
 f(Object o) {
   return o.call;
@@ -1766,8 +1751,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedGetter_proxy_annotation_fakeProxy() {
-    assertErrorsInCode(
+  test_undefinedGetter_proxy_annotation_fakeProxy() async {
+    await assertErrorsInCode(
         r'''
 library L;
 class Fake {
@@ -1781,16 +1766,16 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedGetter_static() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedGetter_static() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 var a = A.B;''',
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedGetter_typeLiteral_cascadeTarget() {
-    assertErrorsInCode(
+  test_undefinedGetter_typeLiteral_cascadeTarget() async {
+    await assertErrorsInCode(
         r'''
 class T {
   static int get foo => 42;
@@ -1801,10 +1786,10 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedGetter_typeLiteral_conditionalAccess() {
+  test_undefinedGetter_typeLiteral_conditionalAccess() async {
     // When applied to a type literal, the conditional access operator '?.'
     // cannot be used to access instance getters of Type.
-    assertErrorsInCode(
+    await assertErrorsInCode(
         '''
 class A {}
 f() => A?.hashCode;
@@ -1812,8 +1797,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedGetter_void() {
-    assertErrorsInCode(
+  test_undefinedGetter_void() async {
+    await assertErrorsInCode(
         r'''
 class T {
   void m() {}
@@ -1822,8 +1807,8 @@
         [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedGetter_wrongNumberOfTypeArguments_tooLittle() {
-    assertErrorsInCode(
+  test_undefinedGetter_wrongNumberOfTypeArguments_tooLittle() async {
+    await assertErrorsInCode(
         r'''
 class A<K, V> {
   K element;
@@ -1834,8 +1819,8 @@
         [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
   }
 
-  void test_undefinedGetter_wrongNumberOfTypeArguments_tooMany() {
-    assertErrorsInCode(
+  test_undefinedGetter_wrongNumberOfTypeArguments_tooMany() async {
+    await assertErrorsInCode(
         r'''
 class A<E> {
   E element;
@@ -1846,8 +1831,8 @@
         [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
   }
 
-  void test_undefinedGetter_wrongOfTypeArgument() {
-    assertErrorsInCode(
+  test_undefinedGetter_wrongOfTypeArgument() async {
+    await assertErrorsInCode(
         r'''
 class A<E> {
   E element;
@@ -1858,8 +1843,8 @@
         [StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT]);
   }
 
-  void test_undefinedMethod() {
-    assertErrorsInCode(
+  test_undefinedMethod() async {
+    await assertErrorsInCode(
         r'''
 class A {
   void m() {
@@ -1869,8 +1854,8 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_assignmentExpression() {
-    assertErrorsInCode(
+  test_undefinedMethod_assignmentExpression() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B {
@@ -1882,14 +1867,14 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_generic_function_call() {
+  test_undefinedMethod_generic_function_call() async {
     // Objects having a specific function type have a call() method, but
     // objects having type Function do not (this is because it is impossible to
     // know what signature the call should have).
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableStrictCallChecks = true;
-    resetWithOptions(options);
-    assertErrorsInCode(
+    resetWith(options: options);
+    await assertErrorsInCode(
         '''
 f(Function f) {
   f.call();
@@ -1898,8 +1883,8 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_ignoreTypePropagation() {
-    assertErrorsInCode(
+  test_undefinedMethod_ignoreTypePropagation() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B extends A {
@@ -1914,16 +1899,16 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_leastUpperBoundWithNull() {
-    assertErrorsInCode('f(bool b, int i) => (b ? null : i).foo();',
+  test_undefinedMethod_leastUpperBoundWithNull() async {
+    await assertErrorsInCode('f(bool b, int i) => (b ? null : i).foo();',
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_object_call() {
+  test_undefinedMethod_object_call() async {
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.enableStrictCallChecks = true;
-    resetWithOptions(options);
-    assertErrorsInCode(
+    resetWith(options: options);
+    await assertErrorsInCode(
         '''
 f(Object o) {
   o.call();
@@ -1932,7 +1917,20 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_private() {
+  test_undefinedMethod_ofNull() async {
+    // TODO(scheglov) Track https://github.com/dart-lang/sdk/issues/28430 to
+    // decide whether a warning should be reported here.
+    await assertErrorsInCode(
+        r'''
+Null f(int x) => null;
+main() {
+  f(42).abs();
+}
+''',
+        [StaticTypeWarningCode.UNDEFINED_METHOD]);
+  }
+
+  test_undefinedMethod_private() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -1940,7 +1938,7 @@
 class A {
   _foo() {}
 }''');
-    assertErrorsInCode(
+    await assertErrorsInCode(
         r'''
 import 'lib.dart';
 class B extends A {
@@ -1951,8 +1949,8 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_proxy_annotation_fakeProxy() {
-    assertErrorsInCode(
+  test_undefinedMethod_proxy_annotation_fakeProxy() async {
+    await assertErrorsInCode(
         r'''
 library L;
 class Fake {
@@ -1966,8 +1964,8 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_typeLiteral_cascadeTarget() {
-    assertErrorsInCode(
+  test_undefinedMethod_typeLiteral_cascadeTarget() async {
+    await assertErrorsInCode(
         '''
 class T {
   static void foo() {}
@@ -1979,10 +1977,10 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethod_typeLiteral_conditionalAccess() {
+  test_undefinedMethod_typeLiteral_conditionalAccess() async {
     // When applied to a type literal, the conditional access operator '?.'
     // cannot be used to access instance methods of Type.
-    assertErrorsInCode(
+    await assertErrorsInCode(
         '''
 class A {}
 f() => A?.toString();
@@ -1990,8 +1988,8 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedMethodWithConstructor() {
-    assertErrorsInCode(
+  test_undefinedMethodWithConstructor() async {
+    await assertErrorsInCode(
         r'''
 class C {
   C.m();
@@ -2002,8 +2000,8 @@
         [StaticTypeWarningCode.UNDEFINED_METHOD_WITH_CONSTRUCTOR]);
   }
 
-  void test_undefinedOperator_indexBoth() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedOperator_indexBoth() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 f(A a) {
@@ -2012,8 +2010,8 @@
         [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_indexGetter() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedOperator_indexGetter() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 f(A a) {
@@ -2022,8 +2020,8 @@
         [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_indexSetter() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedOperator_indexSetter() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 f(A a) {
@@ -2032,8 +2030,8 @@
         [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_plus() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedOperator_plus() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 f(A a) {
@@ -2042,8 +2040,8 @@
         [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_postfixExpression() {
-    assertErrorsInCode(
+  test_undefinedOperator_postfixExpression() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 f(A a) {
@@ -2052,8 +2050,8 @@
         [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedOperator_prefixExpression() {
-    assertErrorsInCode(
+  test_undefinedOperator_prefixExpression() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 f(A a) {
@@ -2062,24 +2060,24 @@
         [StaticTypeWarningCode.UNDEFINED_OPERATOR]);
   }
 
-  void test_undefinedSetter() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedSetter() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class T {}
 f(T e1) { e1.m = 0; }''',
         [StaticTypeWarningCode.UNDEFINED_SETTER]);
   }
 
-  void test_undefinedSetter_static() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedSetter_static() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 f() { A.B = 0;}''',
         [StaticTypeWarningCode.UNDEFINED_SETTER]);
   }
 
-  void test_undefinedSetter_typeLiteral_cascadeTarget() {
-    assertErrorsInCode(
+  test_undefinedSetter_typeLiteral_cascadeTarget() async {
+    await assertErrorsInCode(
         r'''
 class T {
   static void set foo(_) {}
@@ -2090,8 +2088,8 @@
         [StaticTypeWarningCode.UNDEFINED_SETTER]);
   }
 
-  void test_undefinedSetter_void() {
-    assertErrorsInCode(
+  test_undefinedSetter_void() async {
+    await assertErrorsInCode(
         r'''
 class T {
   void m() {}
@@ -2100,8 +2098,8 @@
         [StaticTypeWarningCode.UNDEFINED_SETTER]);
   }
 
-  void test_undefinedSuperGetter() {
-    assertErrorsInCode(
+  test_undefinedSuperGetter() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B extends A {
@@ -2112,8 +2110,8 @@
         [StaticTypeWarningCode.UNDEFINED_SUPER_GETTER]);
   }
 
-  void test_undefinedSuperMethod() {
-    assertErrorsInCode(
+  test_undefinedSuperMethod() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B extends A {
@@ -2122,8 +2120,8 @@
         [StaticTypeWarningCode.UNDEFINED_SUPER_METHOD]);
   }
 
-  void test_undefinedSuperOperator_binaryExpression() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedSuperOperator_binaryExpression() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 class B extends A {
@@ -2134,8 +2132,8 @@
         [StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR]);
   }
 
-  void test_undefinedSuperOperator_indexBoth() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedSuperOperator_indexBoth() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 class B extends A {
@@ -2146,8 +2144,8 @@
         [StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR]);
   }
 
-  void test_undefinedSuperOperator_indexGetter() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedSuperOperator_indexGetter() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 class B extends A {
@@ -2158,8 +2156,8 @@
         [StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR]);
   }
 
-  void test_undefinedSuperOperator_indexSetter() {
-    assertErrorsInUnverifiedCode(
+  test_undefinedSuperOperator_indexSetter() async {
+    await assertErrorsInUnverifiedCode(
         r'''
 class A {}
 class B extends A {
@@ -2170,8 +2168,8 @@
         [StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR]);
   }
 
-  void test_undefinedSuperSetter() {
-    assertErrorsInCode(
+  test_undefinedSuperSetter() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class B extends A {
@@ -2182,8 +2180,8 @@
         [StaticTypeWarningCode.UNDEFINED_SUPER_SETTER]);
   }
 
-  void test_unqualifiedReferenceToNonLocalStaticMember_getter() {
-    assertErrorsInCode(
+  test_unqualifiedReferenceToNonLocalStaticMember_getter() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static int get a => 0;
@@ -2198,8 +2196,8 @@
         ]);
   }
 
-  void test_unqualifiedReferenceToNonLocalStaticMember_getter_invokeTarget() {
-    assertErrorsInCode(
+  test_unqualifiedReferenceToNonLocalStaticMember_getter_invokeTarget() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static int foo;
@@ -2216,8 +2214,8 @@
         ]);
   }
 
-  void test_unqualifiedReferenceToNonLocalStaticMember_method() {
-    assertErrorsInCode(
+  test_unqualifiedReferenceToNonLocalStaticMember_method() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static void a() {}
@@ -2232,8 +2230,8 @@
         ]);
   }
 
-  void test_unqualifiedReferenceToNonLocalStaticMember_setter() {
-    assertErrorsInCode(
+  test_unqualifiedReferenceToNonLocalStaticMember_setter() async {
+    await assertErrorsInCode(
         r'''
 class A {
   static set a(x) {}
@@ -2248,8 +2246,8 @@
         ]);
   }
 
-  void test_wrongNumberOfTypeArguments_classAlias() {
-    assertErrorsInCode(
+  test_wrongNumberOfTypeArguments_classAlias() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class M {}
@@ -2257,24 +2255,24 @@
         [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
   }
 
-  void test_wrongNumberOfTypeArguments_tooFew() {
-    assertErrorsInCode(
+  test_wrongNumberOfTypeArguments_tooFew() async {
+    await assertErrorsInCode(
         r'''
 class A<E, F> {}
 A<A> a = null;''',
         [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
   }
 
-  void test_wrongNumberOfTypeArguments_tooMany() {
-    assertErrorsInCode(
+  test_wrongNumberOfTypeArguments_tooMany() async {
+    await assertErrorsInCode(
         r'''
 class A<E> {}
 A<A, A> a = null;''',
         [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
   }
 
-  void test_wrongNumberOfTypeArguments_typeTest_tooFew() {
-    assertErrorsInCode(
+  test_wrongNumberOfTypeArguments_typeTest_tooFew() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class C<K, V> {}
@@ -2284,8 +2282,8 @@
         [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
   }
 
-  void test_wrongNumberOfTypeArguments_typeTest_tooMany() {
-    assertErrorsInCode(
+  test_wrongNumberOfTypeArguments_typeTest_tooMany() async {
+    await assertErrorsInCode(
         r'''
 class A {}
 class C<E> {}
@@ -2295,8 +2293,8 @@
         [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS]);
   }
 
-  void test_yield_async_to_basic_type() {
-    assertErrorsInCode(
+  test_yield_async_to_basic_type() async {
+    await assertErrorsInCode(
         '''
 int f() async* {
   yield 3;
@@ -2308,8 +2306,8 @@
         ]);
   }
 
-  void test_yield_async_to_iterable() {
-    assertErrorsInCode(
+  test_yield_async_to_iterable() async {
+    await assertErrorsInCode(
         '''
 Iterable<int> f() async* {
   yield 3;
@@ -2321,8 +2319,8 @@
         ]);
   }
 
-  void test_yield_async_to_mistyped_stream() {
-    assertErrorsInCode(
+  test_yield_async_to_mistyped_stream() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 Stream<int> f() async* {
@@ -2332,8 +2330,8 @@
         [StaticTypeWarningCode.YIELD_OF_INVALID_TYPE]);
   }
 
-  void test_yield_each_async_non_stream() {
-    assertErrorsInCode(
+  test_yield_each_async_non_stream() async {
+    await assertErrorsInCode(
         '''
 f() async* {
   yield* 0;
@@ -2342,8 +2340,8 @@
         [StaticTypeWarningCode.YIELD_OF_INVALID_TYPE]);
   }
 
-  void test_yield_each_async_to_mistyped_stream() {
-    assertErrorsInCode(
+  test_yield_each_async_to_mistyped_stream() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 Stream<int> f() async* {
@@ -2354,8 +2352,8 @@
         [StaticTypeWarningCode.YIELD_OF_INVALID_TYPE]);
   }
 
-  void test_yield_each_sync_non_iterable() {
-    assertErrorsInCode(
+  test_yield_each_sync_non_iterable() async {
+    await assertErrorsInCode(
         '''
 f() sync* {
   yield* 0;
@@ -2364,8 +2362,8 @@
         [StaticTypeWarningCode.YIELD_OF_INVALID_TYPE]);
   }
 
-  void test_yield_each_sync_to_mistyped_iterable() {
-    assertErrorsInCode(
+  test_yield_each_sync_to_mistyped_iterable() async {
+    await assertErrorsInCode(
         '''
 Iterable<int> f() sync* {
   yield* g();
@@ -2375,8 +2373,8 @@
         [StaticTypeWarningCode.YIELD_OF_INVALID_TYPE]);
   }
 
-  void test_yield_sync_to_basic_type() {
-    assertErrorsInCode(
+  test_yield_sync_to_basic_type() async {
+    await assertErrorsInCode(
         '''
 int f() sync* {
   yield 3;
@@ -2388,8 +2386,8 @@
         ]);
   }
 
-  void test_yield_sync_to_mistyped_iterable() {
-    assertErrorsInCode(
+  test_yield_sync_to_mistyped_iterable() async {
+    await assertErrorsInCode(
         '''
 Iterable<int> f() sync* {
   yield "foo";
@@ -2398,8 +2396,8 @@
         [StaticTypeWarningCode.YIELD_OF_INVALID_TYPE]);
   }
 
-  void test_yield_sync_to_stream() {
-    assertErrorsInCode(
+  test_yield_sync_to_stream() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 Stream<int> f() sync* {
@@ -2419,20 +2417,20 @@
     super.setUp();
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.strongMode = true;
-    resetWithOptions(options);
+    resetWith(options: options);
   }
 
-  void test_genericMethodWrongNumberOfTypeArguments() {
+  test_genericMethodWrongNumberOfTypeArguments() async {
     Source source = addSource('''
 f() {}
 main() {
   f/*<int>*/();
 }
 ''');
-    computeLibrarySourceErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
     assertErrors(
         source, [StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD]);
-    for (AnalysisError error in analysisContext2.computeErrors(source)) {
+    for (AnalysisError error in analysisResult.errors) {
       if (error.errorCode ==
           StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS) {
         expect(error.message,
@@ -2442,8 +2440,8 @@
     verify([source]);
   }
 
-  void test_legalAsyncGeneratorReturnType_function_supertypeOfStream() {
-    assertErrorsInCode(
+  test_legalAsyncGeneratorReturnType_function_supertypeOfStream() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 f() async* { yield 42; }
@@ -2458,8 +2456,8 @@
         []);
   }
 
-  void test_legalAsyncReturnType_function_supertypeOfFuture() {
-    assertErrorsInCode(
+  test_legalAsyncReturnType_function_supertypeOfFuture() async {
+    await assertErrorsInCode(
         '''
 import 'dart:async';
 f() async { return 42; }
@@ -2474,8 +2472,8 @@
         []);
   }
 
-  void test_legalSyncGeneratorReturnType_function_supertypeOfIterable() {
-    assertErrorsInCode(
+  test_legalSyncGeneratorReturnType_function_supertypeOfIterable() async {
+    await assertErrorsInCode(
         '''
 f() sync* { yield 42; }
 dynamic f2() sync* { yield 42; }
diff --git a/pkg/analyzer/test/generated/static_warning_code_driver_test.dart b/pkg/analyzer/test/generated/static_warning_code_driver_test.dart
new file mode 100644
index 0000000..adf005d
--- /dev/null
+++ b/pkg/analyzer/test/generated/static_warning_code_driver_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'static_warning_code_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(StaticWarningCodeTest_Driver);
+  });
+}
+
+@reflectiveTest
+class StaticWarningCodeTest_Driver extends StaticWarningCodeTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/static_warning_code_test.dart b/pkg/analyzer/test/generated/static_warning_code_test.dart
index 1fc56f4..c196f21 100644
--- a/pkg/analyzer/test/generated/static_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_test.dart
@@ -21,7 +21,7 @@
 
 @reflectiveTest
 class StaticWarningCodeTest extends ResolverTestCase {
-  void fail_argumentTypeNotAssignable_tearOff_required() {
+  fail_argumentTypeNotAssignable_tearOff_required() async {
     Source source = addSource(r'''
 class C {
   Object/*=T*/ f/*<T>*/(Object/*=T*/ x) => x;
@@ -31,43 +31,43 @@
   print(h('s'));
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void fail_undefinedGetter() {
+  fail_undefinedGetter() async {
     Source source = addSource(r'''
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_GETTER]);
     verify([source]);
   }
 
-  void fail_undefinedIdentifier_commentReference() {
+  fail_undefinedIdentifier_commentReference() async {
     Source source = addSource(r'''
 /** [m] xxx [new B.c] */
 class A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.UNDEFINED_IDENTIFIER,
       StaticWarningCode.UNDEFINED_IDENTIFIER
     ]);
   }
 
-  void fail_undefinedSetter() {
+  fail_undefinedSetter() async {
     Source source = addSource(r'''
 class C {}
 f(var p) {
   C.m = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_SETTER]);
     verify([source]);
   }
 
-  void test_ambiguousImport_as() {
+  test_ambiguousImport_as() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -82,11 +82,11 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_ambiguousImport_extends() {
+  test_ambiguousImport_extends() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -101,14 +101,14 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.AMBIGUOUS_IMPORT,
       CompileTimeErrorCode.EXTENDS_NON_CLASS
     ]);
   }
 
-  void test_ambiguousImport_implements() {
+  test_ambiguousImport_implements() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -123,14 +123,14 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.AMBIGUOUS_IMPORT,
       CompileTimeErrorCode.IMPLEMENTS_NON_CLASS
     ]);
   }
 
-  void test_ambiguousImport_inPart() {
+  test_ambiguousImport_inPart() async {
     Source source = addSource(r'''
 library lib;
 import 'lib1.dart';
@@ -151,14 +151,16 @@
         r'''
 part of lib;
 class A extends N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
+    await computeAnalysisResult(partSource);
+    assertNoErrors(source);
     assertErrors(partSource, [
       StaticWarningCode.AMBIGUOUS_IMPORT,
       CompileTimeErrorCode.EXTENDS_NON_CLASS
     ]);
   }
 
-  void test_ambiguousImport_instanceCreation() {
+  test_ambiguousImport_instanceCreation() async {
     Source source = addSource(r'''
 library L;
 import 'lib1.dart';
@@ -174,11 +176,11 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_ambiguousImport_is() {
+  test_ambiguousImport_is() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -193,11 +195,11 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_ambiguousImport_qualifier() {
+  test_ambiguousImport_qualifier() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -212,11 +214,11 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_ambiguousImport_typeAnnotation() {
+  test_ambiguousImport_typeAnnotation() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -239,7 +241,7 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.AMBIGUOUS_IMPORT,
       StaticWarningCode.AMBIGUOUS_IMPORT,
@@ -251,7 +253,7 @@
     ]);
   }
 
-  void test_ambiguousImport_typeArgument_annotation() {
+  test_ambiguousImport_typeArgument_annotation() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -267,11 +269,11 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_ambiguousImport_typeArgument_instanceCreation() {
+  test_ambiguousImport_typeArgument_instanceCreation() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -287,11 +289,11 @@
         r'''
 library lib2;
 class N {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_ambiguousImport_varRead() {
+  test_ambiguousImport_varRead() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -307,11 +309,11 @@
         r'''
 library lib2;
 var v;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_ambiguousImport_varWrite() {
+  test_ambiguousImport_varWrite() async {
     Source source = addSource(r'''
 import 'lib1.dart';
 import 'lib2.dart';
@@ -326,11 +328,11 @@
         r'''
 library lib2;
 var v;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_ambiguousImport_withPrefix() {
+  test_ambiguousImport_withPrefix() async {
     Source source = addSource(r'''
 library test;
 import 'lib1.dart' as p;
@@ -348,11 +350,11 @@
         r'''
 library lib2;
 f() {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.AMBIGUOUS_IMPORT]);
   }
 
-  void test_argumentTypeNotAssignable_ambiguousClassName() {
+  test_argumentTypeNotAssignable_ambiguousClassName() async {
     // See dartbug.com/19624
     Source source = addNamedSource(
         "/lib1.dart",
@@ -369,11 +371,11 @@
 library lib2;
 class _A {}
 g(h(_A a)) {}''');
-    computeLibrarySourceErrors(source);
     // The name _A is private to the library it's defined in, so this is a type
     // mismatch. Furthermore, the error message should mention both _A and the
     // filenames so the user can figure out what's going on.
-    List<AnalysisError> errors = analysisContext2.computeErrors(source);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    List<AnalysisError> errors = analysisResult.errors;
     expect(errors, hasLength(1));
     AnalysisError error = errors[0];
     expect(StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, error.errorCode);
@@ -383,7 +385,7 @@
     expect(message.indexOf("lib2.dart") != -1, isTrue);
   }
 
-  void test_argumentTypeNotAssignable_annotation_namedConstructor() {
+  test_argumentTypeNotAssignable_annotation_namedConstructor() async {
     Source source = addSource(r'''
 class A {
   const A.fromInt(int p);
@@ -391,12 +393,12 @@
 @A.fromInt('0')
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_annotation_unnamedConstructor() {
+  test_argumentTypeNotAssignable_annotation_unnamedConstructor() async {
     Source source = addSource(r'''
 class A {
   const A(int p);
@@ -404,12 +406,12 @@
 @A('0')
 main() {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_binary() {
+  test_argumentTypeNotAssignable_binary() async {
     Source source = addSource(r'''
 class A {
   operator +(int p) {}
@@ -417,12 +419,12 @@
 f(A a) {
   a + '0';
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_cascadeSecond() {
+  test_argumentTypeNotAssignable_cascadeSecond() async {
     Source source = addSource(r'''
 // filler filler filler filler filler filler filler filler filler filler
 class A {
@@ -436,12 +438,12 @@
   A a = new A();
   a..  ma().mb(0);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_const() {
+  test_argumentTypeNotAssignable_const() async {
     Source source = addSource(r'''
 class A {
   const A(String p);
@@ -449,7 +451,7 @@
 main() {
   const A(42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
       CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH
@@ -457,7 +459,7 @@
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_const_super() {
+  test_argumentTypeNotAssignable_const_super() async {
     Source source = addSource(r'''
 class A {
   const A(String p);
@@ -465,22 +467,22 @@
 class B extends A {
   const B() : super(42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_functionExpressionInvocation_required() {
+  test_argumentTypeNotAssignable_functionExpressionInvocation_required() async {
     Source source = addSource(r'''
 main() {
   (int x) {} ('');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_index() {
+  test_argumentTypeNotAssignable_index() async {
     Source source = addSource(r'''
 class A {
   operator [](int index) {}
@@ -488,12 +490,12 @@
 f(A a) {
   a['0'];
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_callParameter() {
+  test_argumentTypeNotAssignable_invocation_callParameter() async {
     Source source = addSource(r'''
 class A {
   call(int p) {}
@@ -501,12 +503,12 @@
 f(A a) {
   a('0');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_callVariable() {
+  test_argumentTypeNotAssignable_invocation_callVariable() async {
     Source source = addSource(r'''
 class A {
   call(int p) {}
@@ -515,46 +517,46 @@
   A a = new A();
   a('0');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_functionParameter() {
+  test_argumentTypeNotAssignable_invocation_functionParameter() async {
     Source source = addSource(r'''
 a(b(int p)) {
   b('0');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_functionParameter_generic() {
+  test_argumentTypeNotAssignable_invocation_functionParameter_generic() async {
     Source source = addSource(r'''
 class A<K, V> {
   m(f(K k), V v) {
     f(v);
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_functionTypes_optional() {
+  test_argumentTypeNotAssignable_invocation_functionTypes_optional() async {
     Source source = addSource(r'''
 void acceptFunNumOptBool(void funNumOptBool([bool b])) {}
 void funNumBool(bool b) {}
 main() {
   acceptFunNumOptBool(funNumBool);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_generic() {
+  test_argumentTypeNotAssignable_invocation_generic() async {
     Source source = addSource(r'''
 class A<T> {
   m(T t) {}
@@ -562,56 +564,56 @@
 f(A<String> a) {
   a.m(1);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_named() {
+  test_argumentTypeNotAssignable_invocation_named() async {
     Source source = addSource(r'''
 f({String p}) {}
 main() {
   f(p: 42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_optional() {
+  test_argumentTypeNotAssignable_invocation_optional() async {
     Source source = addSource(r'''
 f([String p]) {}
 main() {
   f(42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_required() {
+  test_argumentTypeNotAssignable_invocation_required() async {
     Source source = addSource(r'''
 f(String p) {}
 main() {
   f(42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_typedef_generic() {
+  test_argumentTypeNotAssignable_invocation_typedef_generic() async {
     Source source = addSource(r'''
 typedef A<T>(T p);
 f(A<int> a) {
   a('1');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_typedef_local() {
+  test_argumentTypeNotAssignable_invocation_typedef_local() async {
     Source source = addSource(r'''
 typedef A(int p);
 A getA() => null;
@@ -619,23 +621,23 @@
   A a = getA();
   a('1');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_invocation_typedef_parameter() {
+  test_argumentTypeNotAssignable_invocation_typedef_parameter() async {
     Source source = addSource(r'''
 typedef A(int p);
 f(A a) {
   a('1');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_new_generic() {
+  test_argumentTypeNotAssignable_new_generic() async {
     Source source = addSource(r'''
 class A<T> {
   A(T p) {}
@@ -643,12 +645,12 @@
 main() {
   new A<String>(42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_new_optional() {
+  test_argumentTypeNotAssignable_new_optional() async {
     Source source = addSource(r'''
 class A {
   A([String p]) {}
@@ -656,12 +658,12 @@
 main() {
   new A(42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_argumentTypeNotAssignable_new_required() {
+  test_argumentTypeNotAssignable_new_required() async {
     Source source = addSource(r'''
 class A {
   A(String p) {}
@@ -669,23 +671,23 @@
 main() {
   new A(42);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_assignmentToClass() {
+  test_assignmentToClass() async {
     Source source = addSource('''
 class C {}
 main() {
   C = null;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_TYPE]);
   }
 
-  void test_assignmentToConst_instanceVariable() {
+  test_assignmentToConst_instanceVariable() async {
     Source source = addSource(r'''
 class A {
   static const v = 0;
@@ -693,12 +695,12 @@
 f() {
   A.v = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_CONST]);
     verify([source]);
   }
 
-  void test_assignmentToConst_instanceVariable_plusEq() {
+  test_assignmentToConst_instanceVariable_plusEq() async {
     Source source = addSource(r'''
 class A {
   static const v = 0;
@@ -706,45 +708,45 @@
 f() {
   A.v += 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_CONST]);
     verify([source]);
   }
 
-  void test_assignmentToConst_localVariable() {
+  test_assignmentToConst_localVariable() async {
     Source source = addSource(r'''
 f() {
   const x = 0;
   x = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_CONST]);
     verify([source]);
   }
 
-  void test_assignmentToConst_localVariable_plusEq() {
+  test_assignmentToConst_localVariable_plusEq() async {
     Source source = addSource(r'''
 f() {
   const x = 0;
   x += 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_CONST]);
     verify([source]);
   }
 
-  void test_assignmentToEnumType() {
+  test_assignmentToEnumType() async {
     Source source = addSource('''
 enum E { e }
 main() {
   E = null;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_TYPE]);
   }
 
-  void test_assignmentToFinal_instanceVariable() {
+  test_assignmentToFinal_instanceVariable() async {
     Source source = addSource(r'''
 class A {
   final v = 0;
@@ -753,12 +755,12 @@
   A a = new A();
   a.v = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_instanceVariable_plusEq() {
+  test_assignmentToFinal_instanceVariable_plusEq() async {
     Source source = addSource(r'''
 class A {
   final v = 0;
@@ -767,109 +769,119 @@
   A a = new A();
   a.v += 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_localVariable() {
+  test_assignmentToFinal_localVariable() async {
     Source source = addSource(r'''
 f() {
   final x = 0;
   x = 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_localVariable_plusEq() {
+  test_assignmentToFinal_localVariable_plusEq() async {
     Source source = addSource(r'''
 f() {
   final x = 0;
   x += 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_postfixMinusMinus() {
+  test_assignmentToFinal_parameter() async {
+    Source source = addSource(r'''
+f(final x) {
+  x = 1;
+}''');
+    await computeAnalysisResult(source);
+    assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+    verify([source]);
+  }
+
+  test_assignmentToFinal_postfixMinusMinus() async {
     Source source = addSource(r'''
 f() {
   final x = 0;
   x--;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_postfixPlusPlus() {
+  test_assignmentToFinal_postfixPlusPlus() async {
     Source source = addSource(r'''
 f() {
   final x = 0;
   x++;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_prefixMinusMinus() {
+  test_assignmentToFinal_prefixMinusMinus() async {
     Source source = addSource(r'''
 f() {
   final x = 0;
   --x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_prefixPlusPlus() {
+  test_assignmentToFinal_prefixPlusPlus() async {
     Source source = addSource(r'''
 f() {
   final x = 0;
   ++x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_suffixMinusMinus() {
+  test_assignmentToFinal_suffixMinusMinus() async {
     Source source = addSource(r'''
 f() {
   final x = 0;
   x--;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_suffixPlusPlus() {
+  test_assignmentToFinal_suffixPlusPlus() async {
     Source source = addSource(r'''
 f() {
   final x = 0;
   x++;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinal_topLevelVariable() {
+  test_assignmentToFinal_topLevelVariable() async {
     Source source = addSource(r'''
 final x = 0;
 f() { x = 1; }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
     verify([source]);
   }
 
-  void test_assignmentToFinalNoSetter_prefixedIdentifier() {
+  test_assignmentToFinalNoSetter_prefixedIdentifier() async {
     Source source = addSource(r'''
 class A {
   int get x => 0;
@@ -878,12 +890,12 @@
   A a = new A();
   a.x = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_NO_SETTER]);
     verify([source]);
   }
 
-  void test_assignmentToFinalNoSetter_propertyAccess() {
+  test_assignmentToFinalNoSetter_propertyAccess() async {
     Source source = addSource(r'''
 class A {
   int get x => 0;
@@ -894,23 +906,23 @@
 main() {
   B.a.x = 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_NO_SETTER]);
     verify([source]);
   }
 
-  void test_assignmentToFunction() {
+  test_assignmentToFunction() async {
     Source source = addSource(r'''
 f() {}
 main() {
   f = null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FUNCTION]);
     verify([source]);
   }
 
-  void test_assignmentToMethod() {
+  test_assignmentToMethod() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -918,23 +930,23 @@
 f(A a) {
   a.m = () {};
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_METHOD]);
     verify([source]);
   }
 
-  void test_assignmentToTypedef() {
+  test_assignmentToTypedef() async {
     Source source = addSource('''
 typedef void F();
 main() {
   F = null;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_TYPE]);
   }
 
-  void test_assignmentToTypeParameter() {
+  test_assignmentToTypeParameter() async {
     Source source = addSource('''
 class C<T> {
   f() {
@@ -942,11 +954,11 @@
   }
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_TYPE]);
   }
 
-  void test_caseBlockNotTerminated() {
+  test_caseBlockNotTerminated() async {
     Source source = addSource(r'''
 f(int p) {
   switch (p) {
@@ -956,32 +968,32 @@
       break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]);
     verify([source]);
   }
 
-  void test_castToNonType() {
+  test_castToNonType() async {
     Source source = addSource(r'''
 var A = 0;
 f(String s) { var x = s as A; }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.CAST_TO_NON_TYPE]);
     verify([source]);
   }
 
-  void test_concreteClassWithAbstractMember() {
+  test_concreteClassWithAbstractMember() async {
     Source source = addSource(r'''
 class A {
   m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER]);
     verify([source]);
   }
 
-  void test_concreteClassWithAbstractMember_noSuchMethod_interface() {
+  test_concreteClassWithAbstractMember_noSuchMethod_interface() async {
     Source source = addSource(r'''
 class I {
   noSuchMethod(v) => '';
@@ -989,13 +1001,13 @@
 class A implements I {
   m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingDartImport() {
+  test_conflictingDartImport() async {
     Source source = addSource(r'''
 import 'lib.dart';
 import 'dart:async';
@@ -1006,12 +1018,11 @@
         r'''
 library lib;
 class Future {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.CONFLICTING_DART_IMPORT]);
   }
 
-  void
-      test_conflictingInstanceGetterAndSuperclassMember_declField_direct_setter() {
+  test_conflictingInstanceGetterAndSuperclassMember_declField_direct_setter() async {
     Source source = addSource(r'''
 class A {
   static set v(x) {}
@@ -1019,14 +1030,13 @@
 class B extends A {
   var v;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER]);
     verify([source]);
   }
 
-  void
-      test_conflictingInstanceGetterAndSuperclassMember_declGetter_direct_getter() {
+  test_conflictingInstanceGetterAndSuperclassMember_declGetter_direct_getter() async {
     Source source = addSource(r'''
 class A {
   static get v => 0;
@@ -1034,14 +1044,13 @@
 class B extends A {
   get v => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER]);
     verify([source]);
   }
 
-  void
-      test_conflictingInstanceGetterAndSuperclassMember_declGetter_direct_method() {
+  test_conflictingInstanceGetterAndSuperclassMember_declGetter_direct_method() async {
     Source source = addSource(r'''
 class A {
   static v() {}
@@ -1049,14 +1058,13 @@
 class B extends A {
   get v => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER]);
     verify([source]);
   }
 
-  void
-      test_conflictingInstanceGetterAndSuperclassMember_declGetter_direct_setter() {
+  test_conflictingInstanceGetterAndSuperclassMember_declGetter_direct_setter() async {
     Source source = addSource(r'''
 class A {
   static set v(x) {}
@@ -1064,13 +1072,13 @@
 class B extends A {
   get v => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingInstanceGetterAndSuperclassMember_declGetter_indirect() {
+  test_conflictingInstanceGetterAndSuperclassMember_declGetter_indirect() async {
     Source source = addSource(r'''
 class A {
   static int v;
@@ -1079,13 +1087,13 @@
 class C extends B {
   get v => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingInstanceGetterAndSuperclassMember_declGetter_mixin() {
+  test_conflictingInstanceGetterAndSuperclassMember_declGetter_mixin() async {
     Source source = addSource(r'''
 class M {
   static int v;
@@ -1093,13 +1101,13 @@
 class B extends Object with M {
   get v => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingInstanceGetterAndSuperclassMember_direct_field() {
+  test_conflictingInstanceGetterAndSuperclassMember_direct_field() async {
     Source source = addSource(r'''
 class A {
   static int v;
@@ -1107,37 +1115,37 @@
 class B extends A {
   get v => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_INSTANCE_GETTER_AND_SUPERCLASS_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingInstanceMethodSetter2() {
+  test_conflictingInstanceMethodSetter2() async {
     Source source = addSource(r'''
 class A {
   foo() {}
   set foo(a) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER2]);
     verify([source]);
   }
 
-  void test_conflictingInstanceMethodSetter_sameClass() {
+  test_conflictingInstanceMethodSetter_sameClass() async {
     Source source = addSource(r'''
 class A {
   set foo(a) {}
   foo() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER]);
     verify([source]);
   }
 
-  void test_conflictingInstanceMethodSetter_setterInInterface() {
+  test_conflictingInstanceMethodSetter_setterInInterface() async {
     Source source = addSource(r'''
 abstract class A {
   set foo(a);
@@ -1145,13 +1153,13 @@
 abstract class B implements A {
   foo() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER]);
     verify([source]);
   }
 
-  void test_conflictingInstanceMethodSetter_setterInSuper() {
+  test_conflictingInstanceMethodSetter_setterInSuper() async {
     Source source = addSource(r'''
 class A {
   set foo(a) {}
@@ -1159,13 +1167,13 @@
 class B extends A {
   foo() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.CONFLICTING_INSTANCE_METHOD_SETTER]);
     verify([source]);
   }
 
-  void test_conflictingInstanceSetterAndSuperclassMember() {
+  test_conflictingInstanceSetterAndSuperclassMember() async {
     Source source = addSource(r'''
 class A {
   static int v;
@@ -1173,13 +1181,13 @@
 class B extends A {
   set v(x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_INSTANCE_SETTER_AND_SUPERCLASS_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingStaticGetterAndInstanceSetter_mixin() {
+  test_conflictingStaticGetterAndInstanceSetter_mixin() async {
     Source source = addSource(r'''
 class A {
   set x(int p) {}
@@ -1187,13 +1195,13 @@
 class B extends Object with A {
   static get x => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER]);
     verify([source]);
   }
 
-  void test_conflictingStaticGetterAndInstanceSetter_superClass() {
+  test_conflictingStaticGetterAndInstanceSetter_superClass() async {
     Source source = addSource(r'''
 class A {
   set x(int p) {}
@@ -1201,49 +1209,49 @@
 class B extends A {
   static get x => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER]);
     verify([source]);
   }
 
-  void test_conflictingStaticGetterAndInstanceSetter_thisClass() {
+  test_conflictingStaticGetterAndInstanceSetter_thisClass() async {
     Source source = addSource(r'''
 class A {
   static get x => 0;
   set x(int p) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_STATIC_GETTER_AND_INSTANCE_SETTER]);
     verify([source]);
   }
 
-  void test_conflictingStaticSetterAndInstanceMember_thisClass_getter() {
+  test_conflictingStaticSetterAndInstanceMember_thisClass_getter() async {
     Source source = addSource(r'''
 class A {
   get x => 0;
   static set x(int p) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER]);
     verify([source]);
   }
 
-  void test_conflictingStaticSetterAndInstanceMember_thisClass_method() {
+  test_conflictingStaticSetterAndInstanceMember_thisClass_method() async {
     Source source = addSource(r'''
 class A {
   x() {}
   static set x(int p) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.CONFLICTING_STATIC_SETTER_AND_INSTANCE_MEMBER]);
     verify([source]);
   }
 
-  void test_constWithAbstractClass() {
+  test_constWithAbstractClass() async {
     Source source = addSource(r'''
 abstract class A {
   const A();
@@ -1251,30 +1259,30 @@
 void f() {
   A a = const A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.CONST_WITH_ABSTRACT_CLASS]);
     verify([source]);
   }
 
-  void test_equalKeysInMap() {
+  test_equalKeysInMap() async {
     Source source = addSource("var m = {'a' : 0, 'b' : 1, 'a' : 2};");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.EQUAL_KEYS_IN_MAP]);
     verify([source]);
   }
 
-  void test_equalKeysInMap_withEqualTypeParams() {
+  test_equalKeysInMap_withEqualTypeParams() async {
     Source source = addSource(r'''
 class A<T> {
   const A();
 }
 var m = {const A<int>(): 0, const A<int>(): 1};''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.EQUAL_KEYS_IN_MAP]);
     verify([source]);
   }
 
-  void test_equalKeysInMap_withUnequalTypeParams() {
+  test_equalKeysInMap_withUnequalTypeParams() async {
     // No error should be produced because A<int> and A<num> are different
     // types.
     Source source = addSource(r'''
@@ -1282,74 +1290,74 @@
   const A();
 }
 var m = {const A<int>(): 0, const A<num>(): 1};''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_exportDuplicatedLibraryNamed() {
+  test_exportDuplicatedLibraryNamed() async {
     Source source = addSource(r'''
 library test;
 export 'lib1.dart';
 export 'lib2.dart';''');
     addNamedSource("/lib1.dart", "library lib;");
     addNamedSource("/lib2.dart", "library lib;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.EXPORT_DUPLICATED_LIBRARY_NAMED]);
     verify([source]);
   }
 
-  void test_extraPositionalArguments() {
+  test_extraPositionalArguments() async {
     Source source = addSource(r'''
 f() {}
 main() {
   f(0, 1, '2');
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_extraPositionalArguments_functionExpression() {
+  test_extraPositionalArguments_functionExpression() async {
     Source source = addSource(r'''
 main() {
   (int x) {} (0, 1);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.EXTRA_POSITIONAL_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_fieldInitializedInInitializerAndDeclaration_final() {
+  test_fieldInitializedInInitializerAndDeclaration_final() async {
     Source source = addSource(r'''
 class A {
   final int x = 0;
   A() : x = 1 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION]);
     verify([source]);
   }
 
-  void test_fieldInitializerNotAssignable() {
+  test_fieldInitializerNotAssignable() async {
     Source source = addSource(r'''
 class A {
   int x;
   A() : x = '';
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.FIELD_INITIALIZER_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_fieldInitializingFormalNotAssignable() {
+  test_fieldInitializingFormalNotAssignable() async {
     Source source = addSource(r'''
 class A {
   int x;
   A(String this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.FIELD_INITIALIZING_FORMAL_NOT_ASSIGNABLE]);
     verify([source]);
@@ -1364,56 +1372,56 @@
    * FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, since it more specific, we use it instead of
    * the broader code
    */
-  void test_finalInitializedInDeclarationAndConstructor_initializers() {
+  test_finalInitializedInDeclarationAndConstructor_initializers() async {
     Source source = addSource(r'''
 class A {
   final x = 0;
   A() : x = 0 {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION]);
     verify([source]);
   }
 
-  void test_finalInitializedInDeclarationAndConstructor_initializingFormal() {
+  test_finalInitializedInDeclarationAndConstructor_initializingFormal() async {
     Source source = addSource(r'''
 class A {
   final x = 0;
   A(this.x) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_inConstructor_1() {
+  test_finalNotInitialized_inConstructor_1() async {
     Source source = addSource(r'''
 class A {
   final int x;
   A() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_inConstructor_2() {
+  test_finalNotInitialized_inConstructor_2() async {
     Source source = addSource(r'''
 class A {
   final int a;
   final int b;
   A() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_2]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_inConstructor_3() {
+  test_finalNotInitialized_inConstructor_3() async {
     Source source = addSource(r'''
 class A {
   final int a;
@@ -1421,88 +1429,88 @@
   final int c;
   A() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_instanceField_final() {
+  test_finalNotInitialized_instanceField_final() async {
     Source source = addSource(r'''
 class A {
   final F;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.FINAL_NOT_INITIALIZED]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_instanceField_final_static() {
+  test_finalNotInitialized_instanceField_final_static() async {
     Source source = addSource(r'''
 class A {
   static final F;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.FINAL_NOT_INITIALIZED]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_library_final() {
+  test_finalNotInitialized_library_final() async {
     Source source = addSource("final F;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.FINAL_NOT_INITIALIZED]);
     verify([source]);
   }
 
-  void test_finalNotInitialized_local_final() {
+  test_finalNotInitialized_local_final() async {
     Source source = addSource(r'''
 f() {
   final int x;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.FINAL_NOT_INITIALIZED]);
     verify([source]);
   }
 
-  void test_functionWithoutCall_direct() {
+  test_functionWithoutCall_direct() async {
     Source source = addSource(r'''
 class A implements Function {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]);
     verify([source]);
   }
 
-  void test_functionWithoutCall_indirect_extends() {
+  test_functionWithoutCall_indirect_extends() async {
     Source source = addSource(r'''
 abstract class A implements Function {
 }
 class B extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]);
     verify([source]);
   }
 
-  void test_functionWithoutCall_indirect_implements() {
+  test_functionWithoutCall_indirect_implements() async {
     Source source = addSource(r'''
 abstract class A implements Function {
 }
 class B implements A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.FUNCTION_WITHOUT_CALL]);
     verify([source]);
   }
 
-  void test_importDuplicatedLibraryNamed() {
+  test_importDuplicatedLibraryNamed() async {
     Source source = addSource(r'''
 library test;
 import 'lib1.dart';
 import 'lib2.dart';''');
     addNamedSource("/lib1.dart", "library lib;");
     addNamedSource("/lib2.dart", "library lib;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.IMPORT_DUPLICATED_LIBRARY_NAMED,
       HintCode.UNUSED_IMPORT,
@@ -1511,8 +1519,8 @@
     verify([source]);
   }
 
-  void test_importOfNonLibrary() {
-    resolveWithErrors(<String>[
+  test_importOfNonLibrary() async {
+    await resolveWithErrors(<String>[
       r'''
 part of lib;
 class A {}''',
@@ -1525,7 +1533,7 @@
     ]);
   }
 
-  void test_inconsistentMethodInheritanceGetterAndMethod() {
+  test_inconsistentMethodInheritanceGetterAndMethod() async {
     Source source = addSource(r'''
 abstract class A {
   int x();
@@ -1535,13 +1543,13 @@
 }
 class C implements A, B {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_field() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_field() async {
     Source source = addSource(r'''
 class A {
   static var n;
@@ -1549,14 +1557,14 @@
 class B extends A {
   void n() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC
     ]);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_field2() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_field2() async {
     Source source = addSource(r'''
 class A {
   static var n;
@@ -1566,14 +1574,14 @@
 class C extends B {
   void n() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC
     ]);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_getter() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_getter() async {
     Source source = addSource(r'''
 class A {
   static get n {return 0;}
@@ -1581,14 +1589,14 @@
 class B extends A {
   void n() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC
     ]);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_getter2() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_getter2() async {
     Source source = addSource(r'''
 class A {
   static get n {return 0;}
@@ -1598,14 +1606,14 @@
 class C extends B {
   void n() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC
     ]);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_interface() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_interface() async {
     Source source = addSource(r'''
 class Base {
   static foo() {}
@@ -1617,14 +1625,14 @@
   foo() {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC
     ]);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_method() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_method() async {
     Source source = addSource(r'''
 class A {
   static n () {}
@@ -1632,14 +1640,14 @@
 class B extends A {
   void n() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC
     ]);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_method2() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_method2() async {
     Source source = addSource(r'''
 class A {
   static n () {}
@@ -1649,14 +1657,14 @@
 class C extends B {
   void n() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC
     ]);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_setter() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_setter() async {
     Source source = addSource(r'''
 class A {
   static set n(int x) {}
@@ -1664,14 +1672,14 @@
 class B extends A {
   void n() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC
     ]);
     verify([source]);
   }
 
-  void test_instanceMethodNameCollidesWithSuperclassStatic_setter2() {
+  test_instanceMethodNameCollidesWithSuperclassStatic_setter2() async {
     Source source = addSource(r'''
 class A {
   static set n(int x) {}
@@ -1681,14 +1689,14 @@
 class C extends B {
   void n() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INSTANCE_METHOD_NAME_COLLIDES_WITH_SUPERCLASS_STATIC
     ]);
     verify([source]);
   }
 
-  void test_invalidGetterOverrideReturnType() {
+  test_invalidGetterOverrideReturnType() async {
     Source source = addSource(r'''
 class A {
   int get g { return 0; }
@@ -1696,13 +1704,13 @@
 class B extends A {
   String get g { return 'a'; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_GETTER_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidGetterOverrideReturnType_implicit() {
+  test_invalidGetterOverrideReturnType_implicit() async {
     Source source = addSource(r'''
 class A {
   String f;
@@ -1710,7 +1718,7 @@
 class B extends A {
   int f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INVALID_GETTER_OVERRIDE_RETURN_TYPE,
       StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE
@@ -1718,7 +1726,7 @@
     verify([source]);
   }
 
-  void test_invalidGetterOverrideReturnType_twoInterfaces() {
+  test_invalidGetterOverrideReturnType_twoInterfaces() async {
     // test from language/override_inheritance_field_test_11.dart
     Source source = addSource(r'''
 abstract class I {
@@ -1731,13 +1739,13 @@
 class B extends A {
   String get getter => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_GETTER_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidGetterOverrideReturnType_twoInterfaces_conflicting() {
+  test_invalidGetterOverrideReturnType_twoInterfaces_conflicting() async {
     Source source = addSource(r'''
 abstract class I<U> {
   U get g => null;
@@ -1748,13 +1756,13 @@
 class B implements I<int>, J<String> {
   double get g => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_GETTER_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideNamedParamType() {
+  test_invalidMethodOverrideNamedParamType() async {
     Source source = addSource(r'''
 class A {
   m({int a}) {}
@@ -1762,13 +1770,13 @@
 class B implements A {
   m({String a}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_NAMED_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideNormalParamType_interface() {
+  test_invalidMethodOverrideNormalParamType_interface() async {
     Source source = addSource(r'''
 class A {
   m(int a) {}
@@ -1776,13 +1784,13 @@
 class B implements A {
   m(String a) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideNormalParamType_superclass() {
+  test_invalidMethodOverrideNormalParamType_superclass() async {
     Source source = addSource(r'''
 class A {
   m(int a) {}
@@ -1790,13 +1798,13 @@
 class B extends A {
   m(String a) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideNormalParamType_superclass_interface() {
+  test_invalidMethodOverrideNormalParamType_superclass_interface() async {
     Source source = addSource(r'''
 abstract class I<U> {
   m(U u) => null;
@@ -1807,13 +1815,13 @@
 class B extends I<int> implements J<String> {
   m(double d) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideNormalParamType_twoInterfaces() {
+  test_invalidMethodOverrideNormalParamType_twoInterfaces() async {
     Source source = addSource(r'''
 abstract class I {
   m(int n);
@@ -1825,13 +1833,13 @@
 class B extends A {
   m(String n) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideNormalParamType_twoInterfaces_conflicting() {
+  test_invalidMethodOverrideNormalParamType_twoInterfaces_conflicting() async {
     // language/override_inheritance_generic_test/08
     Source source = addSource(r'''
 abstract class I<U> {
@@ -1843,13 +1851,13 @@
 class B implements I<int>, J<String> {
   m(double d) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_NORMAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideOptionalParamType() {
+  test_invalidMethodOverrideOptionalParamType() async {
     Source source = addSource(r'''
 class A {
   m([int a]) {}
@@ -1857,13 +1865,13 @@
 class B implements A {
   m([String a]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideOptionalParamType_twoInterfaces() {
+  test_invalidMethodOverrideOptionalParamType_twoInterfaces() async {
     Source source = addSource(r'''
 abstract class I {
   m([int n]);
@@ -1875,13 +1883,13 @@
 class B extends A {
   m([String n]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.INVALID_METHOD_OVERRIDE_OPTIONAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideReturnType_interface() {
+  test_invalidMethodOverrideReturnType_interface() async {
     Source source = addSource(r'''
 class A {
   int m() { return 0; }
@@ -1889,13 +1897,13 @@
 class B implements A {
   String m() { return 'a'; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideReturnType_interface_grandparent() {
+  test_invalidMethodOverrideReturnType_interface_grandparent() async {
     Source source = addSource(r'''
 abstract class A {
   int m();
@@ -1905,13 +1913,13 @@
 class C implements B {
   String m() { return 'a'; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideReturnType_mixin() {
+  test_invalidMethodOverrideReturnType_mixin() async {
     Source source = addSource(r'''
 class A {
   int m() { return 0; }
@@ -1919,13 +1927,13 @@
 class B extends Object with A {
   String m() { return 'a'; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideReturnType_superclass() {
+  test_invalidMethodOverrideReturnType_superclass() async {
     Source source = addSource(r'''
 class A {
   int m() { return 0; }
@@ -1933,13 +1941,13 @@
 class B extends A {
   String m() { return 'a'; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideReturnType_superclass_grandparent() {
+  test_invalidMethodOverrideReturnType_superclass_grandparent() async {
     Source source = addSource(r'''
 class A {
   int m() { return 0; }
@@ -1949,13 +1957,13 @@
 class C extends B {
   String m() { return 'a'; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideReturnType_twoInterfaces() {
+  test_invalidMethodOverrideReturnType_twoInterfaces() async {
     Source source = addSource(r'''
 abstract class I {
   int m();
@@ -1967,13 +1975,13 @@
 class B extends A {
   String m() => '';
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidMethodOverrideReturnType_void() {
+  test_invalidMethodOverrideReturnType_void() async {
     Source source = addSource(r'''
 class A {
   int m() { return 0; }
@@ -1981,13 +1989,13 @@
 class B extends A {
   void m() {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_METHOD_OVERRIDE_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_invalidOverride_defaultOverridesNonDefault() {
+  test_invalidOverride_defaultOverridesNonDefault() async {
     // If the base class provided an explicit value for a default parameter,
     // then it is a static warning for the derived class to provide a different
     // value, even if implicitly.
@@ -1999,14 +2007,14 @@
   foo([x]) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL
     ]);
     verify([source]);
   }
 
-  void test_invalidOverride_defaultOverridesNonDefault_named() {
+  test_invalidOverride_defaultOverridesNonDefault_named() async {
     // If the base class provided an explicit value for a default parameter,
     // then it is a static warning for the derived class to provide a different
     // value, even if implicitly.
@@ -2018,13 +2026,13 @@
   foo({x}) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED]);
     verify([source]);
   }
 
-  void test_invalidOverride_defaultOverridesNonDefaultNull() {
+  test_invalidOverride_defaultOverridesNonDefaultNull() async {
     // If the base class provided an explicit null value for a default
     // parameter, then it is ok for the derived class to let the default value
     // be implicit, because the implicit default value of null matches the
@@ -2037,12 +2045,12 @@
   foo([x]) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverride_defaultOverridesNonDefaultNull_named() {
+  test_invalidOverride_defaultOverridesNonDefaultNull_named() async {
     // If the base class provided an explicit null value for a default
     // parameter, then it is ok for the derived class to let the default value
     // be implicit, because the implicit default value of null matches the
@@ -2055,12 +2063,12 @@
   foo({x}) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverride_nonDefaultOverridesDefault() {
+  test_invalidOverride_nonDefaultOverridesDefault() async {
     // If the base class lets the default parameter be implicit, then it is ok
     // for the derived class to provide an explicit default value, even if it's
     // not null.
@@ -2072,12 +2080,12 @@
   foo([x = 1]) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverride_nonDefaultOverridesDefault_named() {
+  test_invalidOverride_nonDefaultOverridesDefault_named() async {
     // If the base class lets the default parameter be implicit, then it is ok
     // for the derived class to provide an explicit default value, even if it's
     // not null.
@@ -2089,12 +2097,12 @@
   foo({x: 1}) {}
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_invalidOverrideDifferentDefaultValues_named() {
+  test_invalidOverrideDifferentDefaultValues_named() async {
     Source source = addSource(r'''
 class A {
   m({int p : 0}) {}
@@ -2102,13 +2110,13 @@
 class B extends A {
   m({int p : 1}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_NAMED]);
     verify([source]);
   }
 
-  void test_invalidOverrideDifferentDefaultValues_positional() {
+  test_invalidOverrideDifferentDefaultValues_positional() async {
     Source source = addSource(r'''
 class A {
   m([int p = 0]) {}
@@ -2116,14 +2124,14 @@
 class B extends A {
   m([int p = 1]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.INVALID_OVERRIDE_DIFFERENT_DEFAULT_VALUES_POSITIONAL
     ]);
     verify([source]);
   }
 
-  void test_invalidOverrideNamed_fewerNamedParameters() {
+  test_invalidOverrideNamed_fewerNamedParameters() async {
     Source source = addSource(r'''
 class A {
   m({a, b}) {}
@@ -2131,12 +2139,12 @@
 class B extends A {
   m({a}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.INVALID_OVERRIDE_NAMED]);
     verify([source]);
   }
 
-  void test_invalidOverrideNamed_missingNamedParameter() {
+  test_invalidOverrideNamed_missingNamedParameter() async {
     Source source = addSource(r'''
 class A {
   m({a, b}) {}
@@ -2144,12 +2152,12 @@
 class B extends A {
   m({a, c}) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.INVALID_OVERRIDE_NAMED]);
     verify([source]);
   }
 
-  void test_invalidOverridePositional_optional() {
+  test_invalidOverridePositional_optional() async {
     Source source = addSource(r'''
 class A {
   m([a, b]) {}
@@ -2157,12 +2165,12 @@
 class B extends A {
   m([a]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.INVALID_OVERRIDE_POSITIONAL]);
     verify([source]);
   }
 
-  void test_invalidOverridePositional_optionalAndRequired() {
+  test_invalidOverridePositional_optionalAndRequired() async {
     Source source = addSource(r'''
 class A {
   m(a, b, [c, d]) {}
@@ -2170,12 +2178,12 @@
 class B extends A {
   m(a, b, [c]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.INVALID_OVERRIDE_POSITIONAL]);
     verify([source]);
   }
 
-  void test_invalidOverridePositional_optionalAndRequired2() {
+  test_invalidOverridePositional_optionalAndRequired2() async {
     Source source = addSource(r'''
 class A {
   m(a, b, [c, d]) {}
@@ -2183,12 +2191,12 @@
 class B extends A {
   m(a, [c, d]) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.INVALID_OVERRIDE_POSITIONAL]);
     verify([source]);
   }
 
-  void test_invalidOverrideRequired() {
+  test_invalidOverrideRequired() async {
     Source source = addSource(r'''
 class A {
   m(a) {}
@@ -2196,12 +2204,12 @@
 class B extends A {
   m(a, b) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.INVALID_OVERRIDE_REQUIRED]);
     verify([source]);
   }
 
-  void test_invalidSetterOverrideNormalParamType() {
+  test_invalidSetterOverrideNormalParamType() async {
     Source source = addSource(r'''
 class A {
   void set s(int v) {}
@@ -2209,13 +2217,13 @@
 class B extends A {
   void set s(String v) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidSetterOverrideNormalParamType_superclass_interface() {
+  test_invalidSetterOverrideNormalParamType_superclass_interface() async {
     Source source = addSource(r'''
 abstract class I {
   set setter14(int _) => null;
@@ -2227,13 +2235,13 @@
 class B extends A {
   set setter14(String _) => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidSetterOverrideNormalParamType_twoInterfaces() {
+  test_invalidSetterOverrideNormalParamType_twoInterfaces() async {
     // test from language/override_inheritance_field_test_34.dart
     Source source = addSource(r'''
 abstract class I {
@@ -2246,13 +2254,13 @@
 class B extends A {
   set setter14(String _) => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_invalidSetterOverrideNormalParamType_twoInterfaces_conflicting() {
+  test_invalidSetterOverrideNormalParamType_twoInterfaces_conflicting() async {
     Source source = addSource(r'''
 abstract class I<U> {
   set s(U u) {}
@@ -2263,46 +2271,46 @@
 class B implements I<int>, J<String> {
   set s(double d) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.INVALID_SETTER_OVERRIDE_NORMAL_PARAM_TYPE]);
     verify([source]);
   }
 
-  void test_listElementTypeNotAssignable() {
+  test_listElementTypeNotAssignable() async {
     Source source = addSource("var v = <String> [42];");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_mapKeyTypeNotAssignable() {
+  test_mapKeyTypeNotAssignable() async {
     Source source = addSource("var v = <String, int > {1 : 2};");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_mapValueTypeNotAssignable() {
+  test_mapValueTypeNotAssignable() async {
     Source source = addSource("var v = <String, String> {'a' : 2};");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_mismatchedAccessorTypes_class() {
+  test_mismatchedAccessorTypes_class() async {
     Source source = addSource(r'''
 class A {
   int get g { return 0; }
   set g(String v) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]);
     verify([source]);
   }
 
-  void test_mismatchedAccessorTypes_getterAndSuperSetter() {
+  test_mismatchedAccessorTypes_getterAndSuperSetter() async {
     Source source = addSource(r'''
 class A {
   int get g { return 0; }
@@ -2310,13 +2318,13 @@
 class B extends A {
   set g(String v) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE]);
     verify([source]);
   }
 
-  void test_mismatchedAccessorTypes_setterAndSuperGetter() {
+  test_mismatchedAccessorTypes_setterAndSuperGetter() async {
     Source source = addSource(r'''
 class A {
   set g(int v) {}
@@ -2324,23 +2332,23 @@
 class B extends A {
   String get g { return ''; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES_FROM_SUPERTYPE]);
     verify([source]);
   }
 
-  void test_mismatchedAccessorTypes_topLevel() {
+  test_mismatchedAccessorTypes_topLevel() async {
     Source source = addSource(r'''
 int get g { return 0; }
 set g(String v) {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.MISMATCHED_GETTER_AND_SETTER_TYPES]);
     verify([source]);
   }
 
-  void test_missingEnumConstantInSwitch() {
+  test_missingEnumConstantInSwitch() async {
     Source source = addSource(r'''
 enum E { ONE, TWO, THREE, FOUR }
 bool odd(E e) {
@@ -2350,7 +2358,7 @@
   }
   return false;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH,
       StaticWarningCode.MISSING_ENUM_CONSTANT_IN_SWITCH
@@ -2358,7 +2366,7 @@
     verify([source]);
   }
 
-  void test_mixedReturnTypes_localFunction() {
+  test_mixedReturnTypes_localFunction() async {
     Source source = addSource(r'''
 class C {
   m(int x) {
@@ -2370,7 +2378,7 @@
     };
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.MIXED_RETURN_TYPES,
       StaticWarningCode.MIXED_RETURN_TYPES
@@ -2378,7 +2386,7 @@
     verify([source]);
   }
 
-  void test_mixedReturnTypes_method() {
+  test_mixedReturnTypes_method() async {
     Source source = addSource(r'''
 class C {
   m(int x) {
@@ -2388,7 +2396,7 @@
     return 0;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.MIXED_RETURN_TYPES,
       StaticWarningCode.MIXED_RETURN_TYPES
@@ -2396,7 +2404,7 @@
     verify([source]);
   }
 
-  void test_mixedReturnTypes_topLevelFunction() {
+  test_mixedReturnTypes_topLevelFunction() async {
     Source source = addSource(r'''
 f(int x) {
   if (x < 0) {
@@ -2404,7 +2412,7 @@
   }
   return 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.MIXED_RETURN_TYPES,
       StaticWarningCode.MIXED_RETURN_TYPES
@@ -2412,62 +2420,62 @@
     verify([source]);
   }
 
-  void test_newWithAbstractClass() {
+  test_newWithAbstractClass() async {
     Source source = addSource(r'''
 abstract class A {}
 void f() {
   A a = new A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NEW_WITH_ABSTRACT_CLASS]);
     verify([source]);
   }
 
-  void test_newWithInvalidTypeParameters() {
+  test_newWithInvalidTypeParameters() async {
     Source source = addSource(r'''
 class A {}
 f() { return new A<A>(); }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS]);
     verify([source]);
   }
 
-  void test_newWithInvalidTypeParameters_tooFew() {
+  test_newWithInvalidTypeParameters_tooFew() async {
     Source source = addSource(r'''
 class A {}
 class C<K, V> {}
 f(p) {
   return new C<A>();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS]);
     verify([source]);
   }
 
-  void test_newWithInvalidTypeParameters_tooMany() {
+  test_newWithInvalidTypeParameters_tooMany() async {
     Source source = addSource(r'''
 class A {}
 class C<E> {}
 f(p) {
   return new C<A, A>();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NEW_WITH_INVALID_TYPE_PARAMETERS]);
     verify([source]);
   }
 
-  void test_newWithNonType() {
+  test_newWithNonType() async {
     Source source = addSource(r'''
 var A = 0;
 void f() {
   var a = new A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NEW_WITH_NON_TYPE]);
     verify([source]);
   }
 
-  void test_newWithNonType_fromLibrary() {
+  test_newWithNonType_fromLibrary() async {
     Source source1 = addNamedSource("/lib.dart", "class B {}");
     Source source2 = addNamedSource(
         "/lib2.dart",
@@ -2477,13 +2485,13 @@
   var a = new lib.A();
 }
 lib.B b;''');
-    computeLibrarySourceErrors(source1);
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source1);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [StaticWarningCode.NEW_WITH_NON_TYPE]);
     verify([source1]);
   }
 
-  void test_newWithUndefinedConstructor() {
+  test_newWithUndefinedConstructor() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -2491,12 +2499,12 @@
 f() {
   new A.name();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR]);
     // no verify(), 'name' is not resolved
   }
 
-  void test_newWithUndefinedConstructorDefault() {
+  test_newWithUndefinedConstructorDefault() async {
     Source source = addSource(r'''
 class A {
   A.name() {}
@@ -2504,13 +2512,13 @@
 f() {
   new A();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.NEW_WITH_UNDEFINED_CONSTRUCTOR_DEFAULT]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberFivePlus() {
+  test_nonAbstractClassInheritsAbstractMemberFivePlus() async {
     Source source = addSource(r'''
 abstract class A {
   m();
@@ -2521,14 +2529,14 @@
 }
 class C extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS
     ]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberFour() {
+  test_nonAbstractClassInheritsAbstractMemberFour() async {
     Source source = addSource(r'''
 abstract class A {
   m();
@@ -2538,14 +2546,13 @@
 }
 class C extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR]);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_interface() {
+  test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_interface() async {
     // 15979
     Source source = addSource(r'''
 abstract class M {}
@@ -2554,13 +2561,13 @@
   m();
 }
 class B = A with M implements I;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_mixin() {
+  test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_mixin() async {
     // 15979
     Source source = addSource(r'''
 abstract class M {
@@ -2568,14 +2575,13 @@
 }
 abstract class A {}
 class B = A with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_superclass() {
+  test_nonAbstractClassInheritsAbstractMemberOne_classTypeAlias_superclass() async {
     // 15979
     Source source = addSource(r'''
 class M {}
@@ -2583,14 +2589,13 @@
   m();
 }
 class B = A with M;''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_ensureCorrectFunctionSubtypeIsUsedInImplementation() {
+  test_nonAbstractClassInheritsAbstractMemberOne_ensureCorrectFunctionSubtypeIsUsedInImplementation() async {
     // 15028
     Source source = addSource(r'''
 class C {
@@ -2600,66 +2605,65 @@
   foo(x, [y]);
 }
 class E extends C implements D {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_getter_fromInterface() {
+  test_nonAbstractClassInheritsAbstractMemberOne_getter_fromInterface() async {
     Source source = addSource(r'''
 class I {
   int get g {return 1;}
 }
 class C implements I {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_getter_fromSuperclass() {
+  test_nonAbstractClassInheritsAbstractMemberOne_getter_fromSuperclass() async {
     Source source = addSource(r'''
 abstract class A {
   int get g;
 }
 class C extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_method_fromInterface() {
+  test_nonAbstractClassInheritsAbstractMemberOne_method_fromInterface() async {
     Source source = addSource(r'''
 class I {
   m(p) {}
 }
 class C implements I {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_method_fromSuperclass() {
+  test_nonAbstractClassInheritsAbstractMemberOne_method_fromSuperclass() async {
     Source source = addSource(r'''
 abstract class A {
   m(p);
 }
 class C extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_method_optionalParamCount() {
+  test_nonAbstractClassInheritsAbstractMemberOne_method_optionalParamCount() async {
     // 7640
     Source source = addSource(r'''
 abstract class A {
@@ -2670,46 +2674,46 @@
 }
 class C implements A, B {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_mixinInherits_getter() {
+  test_nonAbstractClassInheritsAbstractMemberOne_mixinInherits_getter() async {
     // 15001
     Source source = addSource(r'''
 abstract class A { get g1; get g2; }
 abstract class B implements A { get g1 => 1; }
 class C extends Object with B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_mixinInherits_method() {
+  test_nonAbstractClassInheritsAbstractMemberOne_mixinInherits_method() async {
     // 15001
     Source source = addSource(r'''
 abstract class A { m1(); m2(); }
 abstract class B implements A { m1() => 1; }
 class C extends Object with B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_mixinInherits_setter() {
+  test_nonAbstractClassInheritsAbstractMemberOne_mixinInherits_setter() async {
     // 15001
     Source source = addSource(r'''
 abstract class A { set s1(v); set s2(v); }
 abstract class B implements A { set s1(v) {} }
 class C extends Object with B {}''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_interface() {
+  test_nonAbstractClassInheritsAbstractMemberOne_noSuchMethod_interface() async {
     // 15979
     Source source = addSource(r'''
 class I {
@@ -2720,14 +2724,13 @@
 }
 class B extends A implements I {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_setter_and_implicitSetter() {
+  test_nonAbstractClassInheritsAbstractMemberOne_setter_and_implicitSetter() async {
     // test from language/override_inheritance_abstract_test_14.dart
     Source source = addSource(r'''
 abstract class A {
@@ -2739,39 +2742,39 @@
 class B extends A implements I {
   get field => 0;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterface() {
+  test_nonAbstractClassInheritsAbstractMemberOne_setter_fromInterface() async {
     Source source = addSource(r'''
 class I {
   set s(int i) {}
 }
 class C implements I {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_setter_fromSuperclass() {
+  test_nonAbstractClassInheritsAbstractMemberOne_setter_fromSuperclass() async {
     Source source = addSource(r'''
 abstract class A {
   set s(int i);
 }
 class C extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberOne_superclasses_interface() {
+  test_nonAbstractClassInheritsAbstractMemberOne_superclasses_interface() async {
     // bug 11154
     Source source = addSource(r'''
 class A {
@@ -2782,14 +2785,13 @@
 }
 class C extends B {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_variable_fromInterface_missingGetter() {
+  test_nonAbstractClassInheritsAbstractMemberOne_variable_fromInterface_missingGetter() async {
     // 16133
     Source source = addSource(r'''
 class I {
@@ -2798,14 +2800,13 @@
 class C implements I {
   set v(_) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberOne_variable_fromInterface_missingSetter() {
+  test_nonAbstractClassInheritsAbstractMemberOne_variable_fromInterface_missingSetter() async {
     // 16133
     Source source = addSource(r'''
 class I {
@@ -2814,13 +2815,13 @@
 class C implements I {
   get v => 1;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberThree() {
+  test_nonAbstractClassInheritsAbstractMemberThree() async {
     Source source = addSource(r'''
 abstract class A {
   m();
@@ -2829,13 +2830,13 @@
 }
 class C extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE]);
     verify([source]);
   }
 
-  void test_nonAbstractClassInheritsAbstractMemberTwo() {
+  test_nonAbstractClassInheritsAbstractMemberTwo() async {
     Source source = addSource(r'''
 abstract class A {
   m();
@@ -2843,14 +2844,13 @@
 }
 class C extends A {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO]);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberTwo_variable_fromInterface_missingBoth() {
+  test_nonAbstractClassInheritsAbstractMemberTwo_variable_fromInterface_missingBoth() async {
     // 16133
     Source source = addSource(r'''
 class I {
@@ -2858,16 +2858,15 @@
 }
 class C implements I {
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO]);
     verify([source]);
   }
 
-  void
-      test_nonAbstractClassInheritsAbstractMemberTwo_variable_fromMixin_missingBoth() {
+  test_nonAbstractClassInheritsAbstractMemberTwo_variable_fromMixin_missingBoth() async {
     // 26411
-    resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+    resetWith(options: new AnalysisOptionsImpl()..enableSuperMixins = true);
     Source source = addSource(r'''
 class A {
   int f;
@@ -2875,25 +2874,25 @@
 class B extends A {}
 class C extends Object with B {}
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source,
         [StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO]);
     verify([source]);
   }
 
-  void test_nonTypeInCatchClause_noElement() {
+  test_nonTypeInCatchClause_noElement() async {
     Source source = addSource(r'''
 f() {
   try {
   } on T catch (e) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]);
     verify([source]);
   }
 
-  void test_nonTypeInCatchClause_notType() {
+  test_nonTypeInCatchClause_notType() async {
     Source source = addSource(r'''
 var T = 0;
 f() {
@@ -2901,98 +2900,98 @@
   } on T catch (e) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NON_TYPE_IN_CATCH_CLAUSE]);
     verify([source]);
   }
 
-  void test_nonVoidReturnForOperator() {
+  test_nonVoidReturnForOperator() async {
     Source source = addSource(r'''
 class A {
   int operator []=(a, b) { return a; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NON_VOID_RETURN_FOR_OPERATOR]);
     verify([source]);
   }
 
-  void test_nonVoidReturnForSetter_function() {
+  test_nonVoidReturnForSetter_function() async {
     Source source = addSource(r'''
 int set x(int v) {
   return 42;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_nonVoidReturnForSetter_method() {
+  test_nonVoidReturnForSetter_method() async {
     Source source = addSource(r'''
 class A {
   int set x(int v) {
     return 42;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NON_VOID_RETURN_FOR_SETTER]);
     verify([source]);
   }
 
-  void test_notAType() {
+  test_notAType() async {
     Source source = addSource(r'''
 f() {}
 main() {
   f v = null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NOT_A_TYPE]);
     verify([source]);
   }
 
-  void test_notEnoughRequiredArguments() {
+  test_notEnoughRequiredArguments() async {
     Source source = addSource(r'''
 f(int a, String b) {}
 main() {
   f();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_notEnoughRequiredArguments_functionExpression() {
+  test_notEnoughRequiredArguments_functionExpression() async {
     Source source = addSource(r'''
 main() {
   (int x) {} ();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_notEnoughRequiredArguments_getterReturningFunction() {
+  test_notEnoughRequiredArguments_getterReturningFunction() async {
     Source source = addSource(r'''
 typedef Getter(self);
 Getter getter = (x) => x;
 main() {
   getter();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.NOT_ENOUGH_REQUIRED_ARGUMENTS]);
     verify([source]);
   }
 
-  void test_partOfDifferentLibrary() {
+  test_partOfDifferentLibrary() async {
     Source source = addSource(r'''
 library lib;
 part 'part.dart';''');
     addNamedSource("/part.dart", "part of lub;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.PART_OF_DIFFERENT_LIBRARY]);
     verify([source]);
   }
 
-  void test_redirectToInvalidFunctionType() {
+  test_redirectToInvalidFunctionType() async {
     Source source = addSource(r'''
 class A implements B {
   A(int p) {}
@@ -3000,12 +2999,12 @@
 class B {
   factory B() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.REDIRECT_TO_INVALID_FUNCTION_TYPE]);
     verify([source]);
   }
 
-  void test_redirectToInvalidReturnType() {
+  test_redirectToInvalidReturnType() async {
     Source source = addSource(r'''
 class A {
   A() {}
@@ -3013,12 +3012,12 @@
 class B {
   factory B() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE]);
     verify([source]);
   }
 
-  void test_redirectToMissingConstructor_named() {
+  test_redirectToMissingConstructor_named() async {
     Source source = addSource(r'''
 class A implements B{
   A() {}
@@ -3026,11 +3025,11 @@
 class B {
   factory B() = A.name;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
   }
 
-  void test_redirectToMissingConstructor_unnamed() {
+  test_redirectToMissingConstructor_unnamed() async {
     Source source = addSource(r'''
 class A implements B{
   A.name() {}
@@ -3038,65 +3037,65 @@
 class B {
   factory B() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.REDIRECT_TO_MISSING_CONSTRUCTOR]);
   }
 
-  void test_redirectToNonClass_notAType() {
+  test_redirectToNonClass_notAType() async {
     Source source = addSource(r'''
 class B {
   int A;
   factory B() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.REDIRECT_TO_NON_CLASS]);
     verify([source]);
   }
 
-  void test_redirectToNonClass_undefinedIdentifier() {
+  test_redirectToNonClass_undefinedIdentifier() async {
     Source source = addSource(r'''
 class B {
   factory B() = A;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.REDIRECT_TO_NON_CLASS]);
     verify([source]);
   }
 
-  void test_returnWithoutValue_async() {
+  test_returnWithoutValue_async() async {
     Source source = addSource('''
 import 'dart:async';
 Future<int> f() async {
   return;
 }
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.RETURN_WITHOUT_VALUE]);
     verify([source]);
   }
 
-  void test_returnWithoutValue_factoryConstructor() {
+  test_returnWithoutValue_factoryConstructor() async {
     Source source = addSource("class A { factory A() { return; } }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.RETURN_WITHOUT_VALUE]);
     verify([source]);
   }
 
-  void test_returnWithoutValue_function() {
+  test_returnWithoutValue_function() async {
     Source source = addSource("int f() { return; }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.RETURN_WITHOUT_VALUE]);
     verify([source]);
   }
 
-  void test_returnWithoutValue_method() {
+  test_returnWithoutValue_method() async {
     Source source = addSource("class A { int m() { return; } }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.RETURN_WITHOUT_VALUE]);
     verify([source]);
   }
 
-  void test_returnWithoutValue_mixedReturnTypes_function() {
+  test_returnWithoutValue_mixedReturnTypes_function() async {
     // Tests that only the RETURN_WITHOUT_VALUE warning is created, and no
     // MIXED_RETURN_TYPES are created.
     Source source = addSource(r'''
@@ -3106,12 +3105,12 @@
   }
   return;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.RETURN_WITHOUT_VALUE]);
     verify([source]);
   }
 
-  void test_staticAccessToInstanceMember_method_invocation() {
+  test_staticAccessToInstanceMember_method_invocation() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -3119,12 +3118,12 @@
 main() {
   A.m();
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]);
     verify([source]);
   }
 
-  void test_staticAccessToInstanceMember_method_reference() {
+  test_staticAccessToInstanceMember_method_reference() async {
     Source source = addSource(r'''
 class A {
   m() {}
@@ -3132,12 +3131,12 @@
 main() {
   A.m;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]);
     verify([source]);
   }
 
-  void test_staticAccessToInstanceMember_propertyAccess_field() {
+  test_staticAccessToInstanceMember_propertyAccess_field() async {
     Source source = addSource(r'''
 class A {
   var f;
@@ -3145,12 +3144,12 @@
 main() {
   A.f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]);
     verify([source]);
   }
 
-  void test_staticAccessToInstanceMember_propertyAccess_getter() {
+  test_staticAccessToInstanceMember_propertyAccess_getter() async {
     Source source = addSource(r'''
 class A {
   get f => 42;
@@ -3158,12 +3157,12 @@
 main() {
   A.f;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]);
     verify([source]);
   }
 
-  void test_staticAccessToInstanceMember_propertyAccess_setter() {
+  test_staticAccessToInstanceMember_propertyAccess_setter() async {
     Source source = addSource(r'''
 class A {
   set f(x) {}
@@ -3171,25 +3170,25 @@
 main() {
   A.f = 42;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER]);
     verify([source]);
   }
 
-  void test_switchExpressionNotAssignable() {
+  test_switchExpressionNotAssignable() async {
     Source source = addSource(r'''
 f(int p) {
   switch (p) {
     case 'a': break;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE]);
     verify([source]);
   }
 
-  void test_typeAnnotationDeferredClass_asExpression() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_asExpression() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3204,8 +3203,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_catchClause() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_catchClause() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3222,8 +3221,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_fieldFormalParameter() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_fieldFormalParameter() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3239,8 +3238,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_functionDeclaration_returnType() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_functionDeclaration_returnType() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3253,9 +3252,8 @@
     ]);
   }
 
-  void
-      test_typeAnnotationDeferredClass_functionTypedFormalParameter_returnType() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_functionTypedFormalParameter_returnType() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3268,8 +3266,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_isExpression() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_isExpression() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3284,8 +3282,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_methodDeclaration_returnType() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_methodDeclaration_returnType() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3300,8 +3298,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_simpleFormalParameter() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_simpleFormalParameter() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3314,8 +3312,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_typeArgumentList() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_typeArgumentList() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3329,8 +3327,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_typeArgumentList2() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_typeArgumentList2() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3345,8 +3343,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_typeParameter_bound() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_typeParameter_bound() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3359,8 +3357,8 @@
     ]);
   }
 
-  void test_typeAnnotationDeferredClass_variableDeclarationList() {
-    resolveWithErrors(<String>[
+  test_typeAnnotationDeferredClass_variableDeclarationList() async {
+    await resolveWithErrors(<String>[
       r'''
 library lib1;
 class A {}''',
@@ -3373,7 +3371,7 @@
     ]);
   }
 
-  void test_typeAnnotationGenericFunctionParameter_localFunction() {
+  test_typeAnnotationGenericFunctionParameter_localFunction() async {
     Source source = addSource(r'''
 class A {
   void method() {
@@ -3382,105 +3380,105 @@
     }
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER]);
     verify([source]);
   }
 
-  void test_typeAnnotationGenericFunctionParameter_method() {
+  test_typeAnnotationGenericFunctionParameter_method() async {
     Source source = addSource(r'''
 class A {
   T method<T>(Object t) {
     return (t is T) ? t : null;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER]);
     verify([source]);
   }
 
-  void test_typeAnnotationGenericFunctionParameter_topLevelFunction() {
+  test_typeAnnotationGenericFunctionParameter_topLevelFunction() async {
     Source source = addSource(r'''
 T function<T>(Object t) {
   return (t is T) ? t : null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER]);
     verify([source]);
   }
 
-  void test_typeParameterReferencedByStatic_field() {
+  test_typeParameterReferencedByStatic_field() async {
     Source source = addSource(r'''
 class A<K> {
   static K k;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]);
     verify([source]);
   }
 
-  void test_typeParameterReferencedByStatic_getter() {
+  test_typeParameterReferencedByStatic_getter() async {
     Source source = addSource(r'''
 class A<K> {
   static K get k => null;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]);
     verify([source]);
   }
 
-  void test_typeParameterReferencedByStatic_methodBodyReference() {
+  test_typeParameterReferencedByStatic_methodBodyReference() async {
     Source source = addSource(r'''
 class A<K> {
   static m() {
     K k;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]);
     verify([source]);
   }
 
-  void test_typeParameterReferencedByStatic_methodParameter() {
+  test_typeParameterReferencedByStatic_methodParameter() async {
     Source source = addSource(r'''
 class A<K> {
   static m(K k) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]);
     verify([source]);
   }
 
-  void test_typeParameterReferencedByStatic_methodReturn() {
+  test_typeParameterReferencedByStatic_methodReturn() async {
     Source source = addSource(r'''
 class A<K> {
   static K m() { return null; }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]);
     verify([source]);
   }
 
-  void test_typeParameterReferencedByStatic_setter() {
+  test_typeParameterReferencedByStatic_setter() async {
     Source source = addSource(r'''
 class A<K> {
   static set s(K k) {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(
         source, [StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC]);
     verify([source]);
   }
 
-  void test_typePromotion_functionType_arg_InterToDyn() {
+  test_typePromotion_functionType_arg_InterToDyn() async {
     Source source = addSource(r'''
 typedef FuncDyn(x);
 typedef FuncA(A a);
@@ -3491,52 +3489,52 @@
     f(new B());
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE]);
   }
 
-  void test_typeTestNonType() {
+  test_typeTestNonType() async {
     Source source = addSource(r'''
 var A = 0;
 f(var p) {
   if (p is A) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.TYPE_TEST_WITH_NON_TYPE]);
     verify([source]);
   }
 
-  void test_typeTestWithUndefinedName() {
+  test_typeTestWithUndefinedName() async {
     Source source = addSource(r'''
 f(var p) {
   if (p is A) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME]);
     verify([source]);
   }
 
-  void test_undefinedClass_instanceCreation() {
+  test_undefinedClass_instanceCreation() async {
     Source source = addSource("f() { new C(); }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
   }
 
-  void test_undefinedClass_variableDeclaration() {
+  test_undefinedClass_variableDeclaration() async {
     Source source = addSource("f() { C c; }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS]);
   }
 
-  void test_undefinedClassBoolean_variableDeclaration() {
+  test_undefinedClassBoolean_variableDeclaration() async {
     Source source = addSource("f() { boolean v; }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_CLASS_BOOLEAN]);
   }
 
-  void test_undefinedGetter_fromLibrary() {
+  test_undefinedGetter_fromLibrary() async {
     Source source1 = addNamedSource("/lib.dart", "");
     Source source2 = addNamedSource(
         "/lib2.dart",
@@ -3545,52 +3543,52 @@
 void f() {
   var g = lib.gg;
 }''');
-    computeLibrarySourceErrors(source1);
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source1);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [StaticWarningCode.UNDEFINED_GETTER]);
     verify([source1]);
   }
 
-  void test_undefinedIdentifier_for() {
+  test_undefinedIdentifier_for() async {
     Source source = addSource(r'''
 f(var l) {
   for (e in l) {
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
   }
 
-  void test_undefinedIdentifier_function() {
+  test_undefinedIdentifier_function() async {
     Source source = addSource("int a() => b;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
   }
 
-  void test_undefinedIdentifier_importCore_withShow() {
+  test_undefinedIdentifier_importCore_withShow() async {
     Source source = addSource(r'''
 import 'dart:core' show List;
 main() {
   List;
   String;
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
   }
 
-  void test_undefinedIdentifier_initializer() {
+  test_undefinedIdentifier_initializer() async {
     Source source = addSource("var a = b;");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
   }
 
-  void test_undefinedIdentifier_methodInvocation() {
+  test_undefinedIdentifier_methodInvocation() async {
     Source source = addSource("f() { C.m(); }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
   }
 
-  void test_undefinedIdentifier_private_getter() {
+  test_undefinedIdentifier_private_getter() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -3605,11 +3603,11 @@
     var v = _foo;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
   }
 
-  void test_undefinedIdentifier_private_setter() {
+  test_undefinedIdentifier_private_setter() async {
     addNamedSource(
         "/lib.dart",
         r'''
@@ -3624,29 +3622,29 @@
     _foo = 42;
   }
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER]);
   }
 
-  void test_undefinedIdentifierAwait_function() {
+  test_undefinedIdentifierAwait_function() async {
     Source source = addSource("void a() { await; }");
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_IDENTIFIER_AWAIT]);
   }
 
-  void test_undefinedNamedParameter() {
+  test_undefinedNamedParameter() async {
     Source source = addSource(r'''
 f({a, b}) {}
 main() {
   f(c: 1);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.UNDEFINED_NAMED_PARAMETER]);
     // no verify(), 'c' is not resolved
   }
 
-  void test_undefinedSetter() {
-    Source source1 = addNamedSource("/lib.dart", "");
+  test_undefinedSetter() async {
+    addNamedSource("/lib.dart", "");
     Source source2 = addNamedSource(
         "/lib2.dart",
         r'''
@@ -3654,22 +3652,21 @@
 void f() {
   lib.gg = null;
 }''');
-    computeLibrarySourceErrors(source1);
-    computeLibrarySourceErrors(source2);
+    await computeAnalysisResult(source2);
     assertErrors(source2, [StaticWarningCode.UNDEFINED_SETTER]);
   }
 
-  void test_undefinedStaticMethodOrGetter_getter() {
+  test_undefinedStaticMethodOrGetter_getter() async {
     Source source = addSource(r'''
 class C {}
 f(var p) {
   f(C.m);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedStaticMethodOrGetter_getter_inSuperclass() {
+  test_undefinedStaticMethodOrGetter_getter_inSuperclass() async {
     Source source = addSource(r'''
 class S {
   static int get g => 0;
@@ -3678,21 +3675,21 @@
 f(var p) {
   f(C.g);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_GETTER]);
   }
 
-  void test_undefinedStaticMethodOrGetter_method() {
+  test_undefinedStaticMethodOrGetter_method() async {
     Source source = addSource(r'''
 class C {}
 f(var p) {
   f(C.m());
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedStaticMethodOrGetter_method_inSuperclass() {
+  test_undefinedStaticMethodOrGetter_method_inSuperclass() async {
     Source source = addSource(r'''
 class S {
   static m() {}
@@ -3701,11 +3698,11 @@
 f(var p) {
   f(C.m());
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_METHOD]);
   }
 
-  void test_undefinedStaticMethodOrGetter_setter_inSuperclass() {
+  test_undefinedStaticMethodOrGetter_setter_inSuperclass() async {
     Source source = addSource(r'''
 class S {
   static set s(int i) {}
@@ -3714,16 +3711,16 @@
 f(var p) {
   f(C.s = 1);
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticTypeWarningCode.UNDEFINED_SETTER]);
   }
 
-  void test_voidReturnForGetter() {
+  test_voidReturnForGetter() async {
     Source source = addSource(r'''
 class S {
   void get value {}
 }''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [StaticWarningCode.VOID_RETURN_FOR_GETTER]);
   }
 }
diff --git a/pkg/analyzer/test/generated/strong_mode_driver_test.dart b/pkg/analyzer/test/generated/strong_mode_driver_test.dart
new file mode 100644
index 0000000..40d3685
--- /dev/null
+++ b/pkg/analyzer/test/generated/strong_mode_driver_test.dart
@@ -0,0 +1,71 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'strong_mode_test.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(StrongModeLocalInferenceTest_Driver);
+    defineReflectiveTests(StrongModeStaticTypeAnalyzer2Test_Driver);
+    defineReflectiveTests(StrongModeTypePropagationTest_Driver);
+  });
+}
+
+@reflectiveTest
+class StrongModeLocalInferenceTest_Driver extends StrongModeLocalInferenceTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
+
+@reflectiveTest
+class StrongModeStaticTypeAnalyzer2Test_Driver
+    extends StrongModeStaticTypeAnalyzer2Test {
+  @override
+  bool get enableNewAnalysisDriver => true;
+
+  @failingTest
+  @override
+  test_genericFunction_parameter() {
+    return super.test_genericFunction_parameter();
+  }
+
+  @failingTest
+  @override
+  test_genericMethod_functionExpressionInvocation_explicit() {
+    return super.test_genericMethod_functionExpressionInvocation_explicit();
+  }
+
+  @failingTest
+  @override
+  test_genericMethod_functionExpressionInvocation_inferred() {
+    return super.test_genericMethod_functionExpressionInvocation_inferred();
+  }
+
+  @failingTest
+  @override
+  test_genericMethod_functionInvocation_explicit() {
+    return super.test_genericMethod_functionInvocation_explicit();
+  }
+
+  @failingTest
+  @override
+  test_genericMethod_functionInvocation_inferred() {
+    return super.test_genericMethod_functionInvocation_inferred();
+  }
+
+  @failingTest
+  @override
+  test_genericMethod_tearoff() {
+    return super.test_genericMethod_tearoff();
+  }
+}
+
+@reflectiveTest
+class StrongModeTypePropagationTest_Driver
+    extends StrongModeTypePropagationTest {
+  @override
+  bool get enableNewAnalysisDriver => true;
+}
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 783b462..838f146 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -4,13 +4,17 @@
 
 library analyzer.test.generated.strong_mode_test;
 
+import 'dart:async';
+
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source_io.dart';
+import 'package:front_end/src/base/errors.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -19,29 +23,34 @@
 
 main() {
   defineReflectiveSuite(() {
-    defineReflectiveTests(StrongModeDownwardsInferenceTest);
+    defineReflectiveTests(StrongModeLocalInferenceTest);
     defineReflectiveTests(StrongModeStaticTypeAnalyzer2Test);
     defineReflectiveTests(StrongModeTypePropagationTest);
   });
 }
 
 /**
- * Strong mode static analyzer downwards inference tests
+ * Strong mode static analyzer local type inference tests
  */
 @reflectiveTest
-class StrongModeDownwardsInferenceTest extends ResolverTestCase {
+class StrongModeLocalInferenceTest extends ResolverTestCase {
   TypeAssertions _assertions;
 
   Asserter<DartType> _isDynamic;
   Asserter<InterfaceType> _isFutureOfDynamic;
   Asserter<InterfaceType> _isFutureOfInt;
+  Asserter<InterfaceType> _isFutureOfNull;
+  Asserter<InterfaceType> _isFutureOrOfInt;
   Asserter<DartType> _isInt;
+  Asserter<DartType> _isNull;
   Asserter<DartType> _isNum;
+  Asserter<DartType> _isObject;
   Asserter<DartType> _isString;
 
   AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, DartType>
       _isFunction2Of;
   AsserterBuilder<List<Asserter<DartType>>, InterfaceType> _isFutureOf;
+  AsserterBuilder<List<Asserter<DartType>>, InterfaceType> _isFutureOrOf;
   AsserterBuilderBuilder<Asserter<DartType>, List<Asserter<DartType>>, DartType>
       _isInstantiationOf;
   AsserterBuilder<Asserter<DartType>, InterfaceType> _isListOf;
@@ -51,33 +60,243 @@
   AsserterBuilder<DartType, DartType> _isType;
 
   AsserterBuilder<Element, DartType> _hasElement;
-  AsserterBuilder<DartType, DartType> _sameElement;
+  AsserterBuilder<DartType, DartType> _hasElementOf;
+
+  @override
+  Future<TestAnalysisResult> computeAnalysisResult(Source source) async {
+    TestAnalysisResult result = await super.computeAnalysisResult(source);
+    if (_assertions == null) {
+      _assertions = new TypeAssertions(typeProvider);
+      _isType = _assertions.isType;
+      _hasElement = _assertions.hasElement;
+      _isInstantiationOf = _assertions.isInstantiationOf;
+      _isInt = _assertions.isInt;
+      _isNull = _assertions.isNull;
+      _isNum = _assertions.isNum;
+      _isObject = _assertions.isObject;
+      _isString = _assertions.isString;
+      _isDynamic = _assertions.isDynamic;
+      _isListOf = _assertions.isListOf;
+      _isMapOf = _assertions.isMapOf;
+      _isFunction2Of = _assertions.isFunction2Of;
+      _hasElementOf = _assertions.hasElementOf;
+      _isFutureOf = _isInstantiationOf(_hasElementOf(typeProvider.futureType));
+      _isFutureOrOf =
+          _isInstantiationOf(_hasElementOf(typeProvider.futureOrType));
+      _isFutureOfDynamic = _isFutureOf([_isDynamic]);
+      _isFutureOfInt = _isFutureOf([_isInt]);
+      _isFutureOfNull = _isFutureOf([_isNull]);
+      _isFutureOrOfInt = _isFutureOrOf([_isInt]);
+      _isStreamOf = _isInstantiationOf(_hasElementOf(typeProvider.streamType));
+    }
+    return result;
+  }
+
+  fail_constrainedByBounds3() async {
+    // Test that upwards inference with two type variables does
+    // not propogate from the constrained variable to the unconstrained
+    // variable if they are ordered right to left, and that if the result
+    // is not a valid instantiation an error is issued
+    String code = r'''
+    T f<T extends S, S extends int>(S x) => null;
+    void test() { var x = f(3); }
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertErrors(
+        source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    List<Statement> statements =
+        AstFinder.getStatementsInTopLevelFunction(unit, "test");
+    VariableDeclarationStatement stmt = statements[0];
+    VariableDeclaration decl = stmt.variables.variables[0];
+    Expression call = decl.initializer;
+    _isDynamic(call.staticType);
+  }
+
+  fail_constrainedByBounds5() async {
+    // Test that upwards inference with two type variables does not
+    // propogate from the constrained variable to the unconstrained
+    // variable if they are ordered right to left, when the variable
+    // appears co and contra variantly, and that an error is issued
+    // for the non-matching bound.
+    String code = r'''
+    typedef To Func1<From, To>(From x);
+    T f<T extends Func1<S, S>, S>(S x) => null;
+    void test() { var x = f(3)(4); }
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertErrors(
+        source, [StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS]);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    List<Statement> statements =
+        AstFinder.getStatementsInTopLevelFunction(unit, "test");
+    VariableDeclarationStatement stmt = statements[0];
+    VariableDeclaration decl = stmt.variables.variables[0];
+    Expression call = decl.initializer;
+    _isInt(call.staticType);
+  }
+
+  fail_futureOr_downwards7() async {
+    // Test that downwards inference incorporates bounds correctly
+    // when instantiating type variables.
+    // TODO(leafp): I think this should pass once the inference changes
+    // that jmesserly is adding are landed.
+    MethodInvocation invoke = await _testFutureOr(r'''
+    T mk<T extends int>(T x) => null;
+    FutureOr<int> test() => mk(new Future.value(42));
+    ''');
+    _isFutureOfInt(invoke.staticType);
+    _isFutureOfInt(invoke.argumentList.arguments[0].staticType);
+  }
+
+  fail_futureOr_downwards8() async {
+    // Test that downwards inference incorporates bounds correctly
+    // when instantiating type variables.
+    // TODO(leafp): I think this should pass once the inference changes
+    // that jmesserly is adding are landed.
+    MethodInvocation invoke = await _testFutureOr(r'''
+    T mk<T extends Future<Object>>(T x) => null;
+    FutureOr<int> test() => mk(new Future.value(42));
+    ''');
+    _isFutureOfInt(invoke.staticType);
+    _isFutureOfInt(invoke.argumentList.arguments[0].staticType);
+  }
+
+  fail_pinning_multipleConstraints1() async {
+    // Test that downwards inference with two different downwards covariant
+    // constraints on the same parameter correctly fails to infer when
+    // the types do not share a common subtype
+    String code = r'''
+    class A<S, T> {
+      S s;
+      T t;
+    }
+    class B<S> extends A<S, S> { B(S s); }
+    A<int, String> test() => new B(3);
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertErrors(source, [StrongModeCode.COULD_NOT_INFER]);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    DartType type = body.expression.staticType;
+
+    Element elementB = AstFinder.getClass(unit, "B").element;
+
+    _isInstantiationOf(_hasElement(elementB))([_isDynamic])(type);
+  }
+
+  fail_pinning_multipleConstraints2() async {
+    // Test that downwards inference with two identical downwards covariant
+    // constraints on the same parameter correctly infers and pins the type
+    String code = r'''
+    class A<S, T> {
+      S s;
+      T t;
+    }
+    class B<S> extends A<S, S> { B(S s); }
+    A<num, num> test() => new B(3);
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    DartType type = body.expression.staticType;
+
+    Element elementB = AstFinder.getClass(unit, "B").element;
+
+    _isInstantiationOf(_hasElement(elementB))([_isNum])(type);
+  }
+
+  fail_pinning_multipleConstraints3() async {
+    // Test that downwards inference with two different downwards covariant
+    // constraints on the same parameter correctly fails to infer when
+    // the types do not share a common subtype, but do share a common supertype
+    String code = r'''
+    class A<S, T> {
+      S s;
+      T t;
+    }
+    class B<S> extends A<S, S> { B(S s); }
+    A<int, double> test() => new B(3);
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertErrors(source, [
+      StrongModeCode.COULD_NOT_INFER,
+      StaticTypeWarningCode.RETURN_OF_INVALID_TYPE
+    ]);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    DartType type = body.expression.staticType;
+
+    Element elementB = AstFinder.getClass(unit, "B").element;
+
+    _isInstantiationOf(_hasElement(elementB))([_isDynamic])(type);
+  }
+
+  fail_returnType_variance2() async {
+    // Check that downwards inference correctly pins a type parameter
+    // when the parameter is constrained in a covariant position
+    String code = r'''
+    typedef To Func1<From, To>(From x);
+    Func1<String, T> f<T>(T x) => null;
+    Func1<String, num> test() => f(42);
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    MethodInvocation invoke = body.expression;
+    _isFunction2Of(_isNum, _isFunction2Of(_isString, _isNum))(
+        invoke.staticInvokeType);
+  }
+
+  fail_returnType_variance6() async {
+    // Check that pinning works correctly with a partial type
+    // when the return type uses the variable in a covariant position
+    String code = r'''
+    typedef To Func1<From, To>(From x);
+    Func1<String, T> f<T>(T x) => null;
+    T g<T, S>(Func1<S, T> f) => null;
+    num test() => g(f(3));
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    MethodInvocation call = body.expression;
+    _isNum(call.staticType);
+    _isFunction2Of(_isFunction2Of(_isString, _isNum), _isNum)(
+        call.staticInvokeType);
+  }
 
   @override
   void setUp() {
     super.setUp();
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.strongMode = true;
-    resetWithOptions(options);
-    _assertions = new TypeAssertions(typeProvider);
-    _isType = _assertions.isType;
-    _hasElement = _assertions.hasElement;
-    _isInstantiationOf = _assertions.isInstantiationOf;
-    _isInt = _assertions.isInt;
-    _isNum = _assertions.isNum;
-    _isString = _assertions.isString;
-    _isDynamic = _assertions.isDynamic;
-    _isListOf = _assertions.isListOf;
-    _isMapOf = _assertions.isMapOf;
-    _isFunction2Of = _assertions.isFunction2Of;
-    _sameElement = _assertions.sameElement;
-    _isFutureOf = _isInstantiationOf(_sameElement(typeProvider.futureType));
-    _isFutureOfDynamic = _isFutureOf([_isDynamic]);
-    _isFutureOfInt = _isFutureOf([_isInt]);
-    _isStreamOf = _isInstantiationOf(_sameElement(typeProvider.streamType));
+    resetWith(options: options);
   }
 
-  void test_async_method_propagation() {
+  test_async_method_propagation() async {
     String code = r'''
       import "dart:async";
       class A {
@@ -98,7 +317,7 @@
         Future<int> g5() async { return await new Future.value(3); }
       }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     void check(String name, Asserter<InterfaceType> typeTest) {
       MethodDeclaration test = AstFinder.getMethodInClass(unit, "A", name);
@@ -134,7 +353,7 @@
     check("g5", _isFutureOfInt);
   }
 
-  void test_async_propagation() {
+  test_async_propagation() async {
     String code = r'''
       import "dart:async";
 
@@ -154,7 +373,7 @@
       Future<int> g4() async { return new Future.value(3); }
       Future<int> g5() async { return await new Future.value(3); }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     void check(String name, Asserter<InterfaceType> typeTest) {
       FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, name);
@@ -190,7 +409,7 @@
     check("g5", _isFutureOfInt);
   }
 
-  void test_async_star_method_propagation() {
+  test_async_star_method_propagation() async {
     String code = r'''
       import "dart:async";
       class A {
@@ -201,7 +420,7 @@
         Stream<List<int>> g3() async* { yield* new Stream(); }
       }
     ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     void check(String name, Asserter<InterfaceType> typeTest) {
       MethodDeclaration test = AstFinder.getMethodInClass(unit, "A", name);
@@ -218,7 +437,7 @@
     check("g3", _isStreamOf([(DartType type) => _isListOf(_isInt)(type)]));
   }
 
-  void test_async_star_propagation() {
+  test_async_star_propagation() async {
     String code = r'''
       import "dart:async";
 
@@ -228,7 +447,7 @@
       Stream<List<int>> g2() async* { yield []; }
       Stream<List<int>> g3() async* { yield* new Stream(); }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     void check(String name, Asserter<InterfaceType> typeTest) {
       FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, name);
@@ -245,7 +464,7 @@
     check("g3", _isStreamOf([(DartType type) => _isListOf(_isInt)(type)]));
   }
 
-  void test_cascadeExpression() {
+  test_cascadeExpression() async {
     String code = r'''
       class A<T> {
         List<T> map(T a, List<T> mapper(T x)) => mapper(a);
@@ -255,7 +474,7 @@
         A<int> a = new A()..map(0, (x) => [x]);
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     CascadeExpression fetch(int i) {
@@ -276,14 +495,79 @@
     expect(f0.type.normalParameterTypes[0], typeProvider.intType);
   }
 
-  void test_constructorInitializer_propagation() {
+  test_constrainedByBounds1() async {
+    // Test that upwards inference with two type variables correctly
+    // propogates from the constrained variable to the unconstrained
+    // variable if they are ordered left to right.
+    String code = r'''
+    T f<S, T extends S>(S x) => null;
+    void test() { var x = f(3); }
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    List<Statement> statements =
+        AstFinder.getStatementsInTopLevelFunction(unit, "test");
+    VariableDeclarationStatement stmt = statements[0];
+    VariableDeclaration decl = stmt.variables.variables[0];
+    Expression call = decl.initializer;
+    _isInt(call.staticType);
+  }
+
+  test_constrainedByBounds2() async {
+    // Test that upwards inference with two type variables does
+    // not propogate from the constrained variable to the unconstrained
+    // variable if they are ordered right to left.
+    String code = r'''
+    T f<T extends S, S>(S x) => null;
+    void test() { var x = f(3); }
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    List<Statement> statements =
+        AstFinder.getStatementsInTopLevelFunction(unit, "test");
+    VariableDeclarationStatement stmt = statements[0];
+    VariableDeclaration decl = stmt.variables.variables[0];
+    Expression call = decl.initializer;
+    _isDynamic(call.staticType);
+  }
+
+  test_constrainedByBounds4() async {
+    // Test that upwards inference with two type variables correctly
+    // propogates from the constrained variable to the unconstrained
+    // variable if they are ordered left to right, when the variable
+    // appears co and contra variantly
+    String code = r'''
+    typedef To Func1<From, To>(From x);
+    T f<S, T extends Func1<S, S>>(S x) => null;
+    void test() { var x = f(3)(4); }
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    List<Statement> statements =
+        AstFinder.getStatementsInTopLevelFunction(unit, "test");
+    VariableDeclarationStatement stmt = statements[0];
+    VariableDeclaration decl = stmt.variables.variables[0];
+    Expression call = decl.initializer;
+    _isInt(call.staticType);
+  }
+
+  test_constructorInitializer_propagation() async {
     String code = r'''
       class A {
         List<String> x;
         A() : this.x = [];
       }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     ConstructorDeclaration constructor =
         AstFinder.getConstructorInClass(unit, "A", null);
     ConstructorFieldInitializer assignment = constructor.initializers[0];
@@ -291,14 +575,14 @@
     _isListOf(_isString)(exp.staticType);
   }
 
-  void test_factoryConstructor_propagation() {
+  test_factoryConstructor_propagation() async {
     String code = r'''
       class A<T> {
         factory A() { return new B(); }
       }
       class B<S> extends A<S> {}
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     ConstructorDeclaration constructor =
         AstFinder.getConstructorInClass(unit, "A", null);
@@ -307,25 +591,26 @@
     InstanceCreationExpression exp = stmt.expression;
     ClassElement elementB = AstFinder.getClass(unit, "B").element;
     ClassElement elementA = AstFinder.getClass(unit, "A").element;
-    expect(exp.constructorName.type.type.element, elementB);
+    expect(resolutionMap.typeForTypeName(exp.constructorName.type).element,
+        elementB);
     _isInstantiationOf(_hasElement(elementB))(
         [_isType(elementA.typeParameters[0].type)])(exp.staticType);
   }
 
-  void test_fieldDeclaration_propagation() {
+  test_fieldDeclaration_propagation() async {
     String code = r'''
       class A {
         List<String> f0 = ["hello"];
       }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     VariableDeclaration field = AstFinder.getFieldInClass(unit, "A", "f0");
 
     _isListOf(_isString)(field.initializer.staticType);
   }
 
-  void test_functionDeclaration_body_propagation() {
+  test_functionDeclaration_body_propagation() async {
     String code = r'''
       typedef T Function2<S, T>(S x);
 
@@ -338,7 +623,7 @@
         return (x) => x;
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     Asserter<InterfaceType> assertListOfInt = _isListOf(_isInt);
 
@@ -359,12 +644,13 @@
     expect(type0.normalParameterTypes[0], typeProvider.stringType);
 
     FunctionExpression anon1 = (statements[1] as ReturnStatement).expression;
-    FunctionType type1 = anon1.element.type;
+    FunctionType type1 =
+        resolutionMap.elementDeclaredByFunctionExpression(anon1).type;
     expect(type1.returnType, typeProvider.intType);
     expect(type1.normalParameterTypes[0], typeProvider.intType);
   }
 
-  void test_functionLiteral_assignment_typedArguments() {
+  test_functionLiteral_assignment_typedArguments() async {
     String code = r'''
       typedef T Function2<S, T>(S x);
 
@@ -376,14 +662,14 @@
         Function2<int, String> l4 = (int x) {return 3;};
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
       VariableDeclarationStatement stmt = statements[i];
       VariableDeclaration decl = stmt.variables.variables[0];
       FunctionExpression exp = decl.initializer;
-      return exp.element.type;
+      return resolutionMap.elementDeclaredByFunctionExpression(exp).type;
     }
 
     _isFunction2Of(_isInt, _isString)(literal(0));
@@ -393,7 +679,7 @@
     _isFunction2Of(_isInt, _isString)(literal(4));
   }
 
-  void test_functionLiteral_assignment_unTypedArguments() {
+  test_functionLiteral_assignment_unTypedArguments() async {
     String code = r'''
       typedef T Function2<S, T>(S x);
 
@@ -405,14 +691,14 @@
         Function2<int, String> l4 = (x) {return 3;};
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
       VariableDeclarationStatement stmt = statements[i];
       VariableDeclaration decl = stmt.variables.variables[0];
       FunctionExpression exp = decl.initializer;
-      return exp.element.type;
+      return resolutionMap.elementDeclaredByFunctionExpression(exp).type;
     }
 
     _isFunction2Of(_isInt, _isString)(literal(0));
@@ -422,7 +708,7 @@
     _isFunction2Of(_isInt, _isString)(literal(4));
   }
 
-  void test_functionLiteral_body_propagation() {
+  test_functionLiteral_body_propagation() async {
     String code = r'''
       typedef T Function2<S, T>(S x);
 
@@ -433,7 +719,7 @@
         Function2<int, List<String>> l3 = (int x) {return [3];};
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     Expression functionReturnValue(int i) {
@@ -456,7 +742,7 @@
     assertListOfString(functionReturnValue(3).staticType);
   }
 
-  void test_functionLiteral_functionExpressionInvocation_typedArguments() {
+  test_functionLiteral_functionExpressionInvocation_typedArguments() async {
     String code = r'''
       class Mapper<F, T> {
         T map(T mapper(F x)) => mapper(null);
@@ -470,14 +756,14 @@
         (new Mapper<int, String>().map)((int x) {return 3;});
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
       ExpressionStatement stmt = statements[i];
       FunctionExpressionInvocation invk = stmt.expression;
       FunctionExpression exp = invk.argumentList.arguments[0];
-      return exp.element.type;
+      return resolutionMap.elementDeclaredByFunctionExpression(exp).type;
     }
 
     _isFunction2Of(_isInt, _isString)(literal(0));
@@ -487,7 +773,7 @@
     _isFunction2Of(_isInt, _isString)(literal(4));
   }
 
-  void test_functionLiteral_functionExpressionInvocation_unTypedArguments() {
+  test_functionLiteral_functionExpressionInvocation_unTypedArguments() async {
     String code = r'''
       class Mapper<F, T> {
         T map(T mapper(F x)) => mapper(null);
@@ -501,14 +787,14 @@
         (new Mapper<int, String>().map)((x) {return 3;});
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
       ExpressionStatement stmt = statements[i];
       FunctionExpressionInvocation invk = stmt.expression;
       FunctionExpression exp = invk.argumentList.arguments[0];
-      return exp.element.type;
+      return resolutionMap.elementDeclaredByFunctionExpression(exp).type;
     }
 
     _isFunction2Of(_isInt, _isString)(literal(0));
@@ -518,7 +804,7 @@
     _isFunction2Of(_isInt, _isString)(literal(4));
   }
 
-  void test_functionLiteral_functionInvocation_typedArguments() {
+  test_functionLiteral_functionInvocation_typedArguments() async {
     String code = r'''
       String map(String mapper(int x)) => mapper(null);
 
@@ -530,14 +816,14 @@
         map((int x) {return 3;});
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
       ExpressionStatement stmt = statements[i];
       MethodInvocation invk = stmt.expression;
       FunctionExpression exp = invk.argumentList.arguments[0];
-      return exp.element.type;
+      return resolutionMap.elementDeclaredByFunctionExpression(exp).type;
     }
 
     _isFunction2Of(_isInt, _isString)(literal(0));
@@ -547,7 +833,7 @@
     _isFunction2Of(_isInt, _isString)(literal(4));
   }
 
-  void test_functionLiteral_functionInvocation_unTypedArguments() {
+  test_functionLiteral_functionInvocation_unTypedArguments() async {
     String code = r'''
       String map(String mapper(int x)) => mapper(null);
 
@@ -559,14 +845,14 @@
         map((x) {return 3;});
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
       ExpressionStatement stmt = statements[i];
       MethodInvocation invk = stmt.expression;
       FunctionExpression exp = invk.argumentList.arguments[0];
-      return exp.element.type;
+      return resolutionMap.elementDeclaredByFunctionExpression(exp).type;
     }
 
     _isFunction2Of(_isInt, _isString)(literal(0));
@@ -576,7 +862,7 @@
     _isFunction2Of(_isInt, _isString)(literal(4));
   }
 
-  void test_functionLiteral_methodInvocation_typedArguments() {
+  test_functionLiteral_methodInvocation_typedArguments() async {
     String code = r'''
       class Mapper<F, T> {
         T map(T mapper(F x)) => mapper(null);
@@ -590,14 +876,14 @@
         new Mapper<int, String>().map((int x) {return 3;});
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
       ExpressionStatement stmt = statements[i];
       MethodInvocation invk = stmt.expression;
       FunctionExpression exp = invk.argumentList.arguments[0];
-      return exp.element.type;
+      return resolutionMap.elementDeclaredByFunctionExpression(exp).type;
     }
 
     _isFunction2Of(_isInt, _isString)(literal(0));
@@ -607,7 +893,7 @@
     _isFunction2Of(_isInt, _isString)(literal(4));
   }
 
-  void test_functionLiteral_methodInvocation_unTypedArguments() {
+  test_functionLiteral_methodInvocation_unTypedArguments() async {
     String code = r'''
       class Mapper<F, T> {
         T map(T mapper(F x)) => mapper(null);
@@ -621,14 +907,14 @@
         new Mapper<int, String>().map((x) {return 3;});
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
       ExpressionStatement stmt = statements[i];
       MethodInvocation invk = stmt.expression;
       FunctionExpression exp = invk.argumentList.arguments[0];
-      return exp.element.type;
+      return resolutionMap.elementDeclaredByFunctionExpression(exp).type;
     }
 
     _isFunction2Of(_isInt, _isString)(literal(0));
@@ -638,7 +924,7 @@
     _isFunction2Of(_isInt, _isString)(literal(4));
   }
 
-  void test_functionLiteral_unTypedArgument_propagation() {
+  test_functionLiteral_unTypedArgument_propagation() async {
     String code = r'''
       typedef T Function2<S, T>(S x);
 
@@ -650,7 +936,7 @@
         Function2<String, String> l4 = (x) => x.toLowerCase();
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     Expression functionReturnValue(int i) {
@@ -673,19 +959,265 @@
     expect(functionReturnValue(4).staticType, typeProvider.stringType);
   }
 
-  void test_inference_hints() {
+  test_futureOr_assignFromFuture() async {
+    // Test a Future<T> can be assigned to FutureOr<T>.
+    MethodInvocation invoke = await _testFutureOr(r'''
+    FutureOr<T> mk<T>(Future<T> x) => x;
+    test() => mk(new Future<int>.value(42));
+    ''');
+    _isFutureOrOfInt(invoke.staticType);
+  }
+
+  test_futureOr_assignFromValue() async {
+    // Test a T can be assigned to FutureOr<T>.
+    MethodInvocation invoke = await _testFutureOr(r'''
+    FutureOr<T> mk<T>(T x) => x;
+    test() => mk(42);
+    ''');
+    _isFutureOrOfInt(invoke.staticType);
+  }
+
+  test_futureOr_asyncExpressionBody() async {
+    // A FutureOr<T> can be used as the expression body for an async function
+    MethodInvocation invoke = await _testFutureOr(r'''
+    Future<T> mk<T>(FutureOr<T> x) async => x;
+    test() => mk(42);
+    ''');
+    _isFutureOfInt(invoke.staticType);
+  }
+
+  test_futureOr_asyncReturn() async {
+    // A FutureOr<T> can be used as the return value for an async function
+    MethodInvocation invoke = await _testFutureOr(r'''
+    Future<T> mk<T>(FutureOr<T> x) async { return x; }
+    test() => mk(42);
+    ''');
+    _isFutureOfInt(invoke.staticType);
+  }
+
+  test_futureOr_await() async {
+    // Test a FutureOr<T> can be awaited.
+    MethodInvocation invoke = await _testFutureOr(r'''
+    Future<T> mk<T>(FutureOr<T> x) async => await x;
+    test() => mk(42);
+    ''');
+    _isFutureOfInt(invoke.staticType);
+  }
+
+  test_futureOr_downwards1() async {
+    // Test that downwards inference interacts correctly with FutureOr
+    // parameters.
+    MethodInvocation invoke = await _testFutureOr(r'''
+    Future<T> mk<T>(FutureOr<T> x) => null;
+    Future<int> test() => mk(new Future<int>.value(42));
+    ''');
+    _isFutureOfInt(invoke.staticType);
+  }
+
+  test_futureOr_downwards2() async {
+    // Test that downwards inference interacts correctly with FutureOr
+    // parameters when the downwards context is FutureOr
+    MethodInvocation invoke = await _testFutureOr(r'''
+    Future<T> mk<T>(FutureOr<T> x) => null;
+    FutureOr<int> test() => mk(new Future<int>.value(42));
+    ''');
+    _isFutureOfInt(invoke.staticType);
+  }
+
+  test_futureOr_downwards3() async {
+    // Test that downwards inference correctly propogates into
+    // arguments.
+    MethodInvocation invoke = await _testFutureOr(r'''
+    Future<T> mk<T>(FutureOr<T> x) => null;
+    Future<int> test() => mk(new Future.value(42));
+    ''');
+    _isFutureOfInt(invoke.staticType);
+    _isFutureOfInt(invoke.argumentList.arguments[0].staticType);
+  }
+
+  test_futureOr_downwards4() async {
+    // Test that downwards inference interacts correctly with FutureOr
+    // parameters when the downwards context is FutureOr
+    MethodInvocation invoke = await _testFutureOr(r'''
+    Future<T> mk<T>(FutureOr<T> x) => null;
+    FutureOr<int> test() => mk(new Future.value(42));
+    ''');
+    _isFutureOfInt(invoke.staticType);
+    _isFutureOfInt(invoke.argumentList.arguments[0].staticType);
+  }
+
+  test_futureOr_downwards5() async {
+    // Test that downwards inference correctly pins the type when it
+    // comes from a FutureOr
+    MethodInvocation invoke = await _testFutureOr(r'''
+    Future<T> mk<T>(FutureOr<T> x) => null;
+    FutureOr<num> test() => mk(new Future.value(42));
+    ''');
+    _isFutureOf([_isNum])(invoke.staticType);
+    _isFutureOf([_isNum])(invoke.argumentList.arguments[0].staticType);
+  }
+
+  test_futureOr_downwards6() async {
+    // Test that downwards inference doesn't decompose FutureOr
+    // when instantiating type variables.
+    MethodInvocation invoke = await _testFutureOr(r'''
+    T mk<T>(T x) => null;
+    FutureOr<int> test() => mk(new Future.value(42));
+    ''');
+    _isFutureOfInt(invoke.staticType);
+    _isFutureOfInt(invoke.argumentList.arguments[0].staticType);
+  }
+
+  test_futureOr_downwards9() async {
+    // Test that downwards inference decomposes correctly with
+    // other composite types
+    MethodInvocation invoke = await _testFutureOr(r'''
+    List<T> mk<T>(T x) => null;
+    FutureOr<List<int>> test() => mk(3);
+    ''');
+    _isListOf(_isInt)(invoke.staticType);
+    _isInt(invoke.argumentList.arguments[0].staticType);
+  }
+
+  test_futureOr_methods1() async {
+    // Test that FutureOr has the Object methods
+    MethodInvocation invoke = await _testFutureOr(r'''
+    dynamic test(FutureOr<int> x) => x.toString();
+    ''');
+    _isString(invoke.staticType);
+  }
+
+  test_futureOr_methods2() async {
+    // Test that FutureOr does not have the constituent type methods
+    MethodInvocation invoke = await _testFutureOr(
+        r'''
+    dynamic test(FutureOr<int> x) => x.abs();
+    ''',
+        errors: [StaticTypeWarningCode.UNDEFINED_METHOD]);
+    _isDynamic(invoke.staticType);
+  }
+
+  test_futureOr_methods3() async {
+    // Test that FutureOr does not have the Future type methods
+    MethodInvocation invoke = await _testFutureOr(
+        r'''
+    dynamic test(FutureOr<int> x) => x.then((x) => x);
+    ''',
+        errors: [StaticTypeWarningCode.UNDEFINED_METHOD]);
+    _isDynamic(invoke.staticType);
+  }
+
+  test_futureOr_methods4() async {
+    // Test that FutureOr<dynamic> does not have all methods
+    MethodInvocation invoke = await _testFutureOr(
+        r'''
+    dynamic test(FutureOr<dynamic> x) => x.abs();
+    ''',
+        errors: [StaticTypeWarningCode.UNDEFINED_METHOD]);
+    _isDynamic(invoke.staticType);
+  }
+
+  test_futureOr_no_return() async {
+    MethodInvocation invoke = await _testFutureOr(r'''
+    FutureOr<T> mk<T>(Future<T> x) => x;
+    Future<int> f;
+    test() => f.then((int x) {});
+    ''');
+    _isFunction2Of(_isInt, _isNull)(
+        invoke.argumentList.arguments[0].staticType);
+    _isFutureOfDynamic(invoke.staticType);
+  }
+
+  test_futureOr_no_return_value() async {
+    MethodInvocation invoke = await _testFutureOr(r'''
+    FutureOr<T> mk<T>(Future<T> x) => x;
+    Future<int> f;
+    test() => f.then((int x) {return;});
+    ''');
+    _isFunction2Of(_isInt, _isNull)(
+        invoke.argumentList.arguments[0].staticType);
+    _isFutureOfDynamic(invoke.staticType);
+  }
+
+  test_futureOr_return_null() async {
+    MethodInvocation invoke = await _testFutureOr(r'''
+    FutureOr<T> mk<T>(Future<T> x) => x;
+    Future<int> f;
+    test() => f.then((int x) {});
+    ''');
+    _isFunction2Of(_isInt, _isNull)(
+        invoke.argumentList.arguments[0].staticType);
+    _isFutureOfDynamic(invoke.staticType);
+  }
+
+  test_futureOr_upwards1() async {
+    // Test that upwards inference correctly prefers to instantiate type
+    // variables with the "smaller" solution when both are possible.
+    MethodInvocation invoke = await _testFutureOr(r'''
+    Future<T> mk<T>(FutureOr<T> x) => null;
+    dynamic test() => mk(new Future<int>.value(42));
+    ''');
+    _isFutureOfInt(invoke.staticType);
+  }
+
+  test_futureOr_upwards2() async {
+    // Test that upwards inference fails when the solution doesn't
+    // match the bound.
+    MethodInvocation invoke = await _testFutureOr(
+        r'''
+    Future<T> mk<T extends Future<Object>>(FutureOr<T> x) => null;
+    dynamic test() => mk(new Future<int>.value(42));
+    ''',
+        errors: [StrongModeCode.COULD_NOT_INFER]);
+    _isFutureOf([_isObject])(invoke.staticType);
+  }
+
+  test_futureOrNull_no_return_value() async {
+    MethodInvocation invoke = await _testFutureOr(r'''
+    FutureOr<T> mk<T>(Future<T> x) => x;
+    Future<int> f;
+    test() => f.then<Null>((int x) {return;});
+    ''');
+    _isFunction2Of(_isInt, _isNull)(
+        invoke.argumentList.arguments[0].staticType);
+    _isFutureOfNull(invoke.staticType);
+  }
+
+  test_futureOrNull_no_return() async {
+    MethodInvocation invoke = await _testFutureOr(r'''
+    FutureOr<T> mk<T>(Future<T> x) => x;
+    Future<int> f;
+    test() => f.then<Null>((int x) {});
+    ''');
+    _isFunction2Of(_isInt, _isNull)(
+        invoke.argumentList.arguments[0].staticType);
+    _isFutureOfNull(invoke.staticType);
+  }
+
+  test_futureOrNull_return_null() async {
+    MethodInvocation invoke = await _testFutureOr(r'''
+    FutureOr<T> mk<T>(Future<T> x) => x;
+    Future<int> f;
+    test() => f.then<Null>((int x) {});
+    ''');
+    _isFunction2Of(_isInt, _isNull)(
+        invoke.argumentList.arguments[0].staticType);
+    _isFutureOfNull(invoke.staticType);
+  }
+
+  test_inference_hints() async {
     Source source = addSource(r'''
       void main () {
         var x = 3;
         List<int> l0 = [];
      }
    ''');
-    resolve2(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_inferredFieldDeclaration_propagation() {
+  test_inferredFieldDeclaration_propagation() async {
     // Regression test for https://github.com/dart-lang/sdk/issues/25546
     String code = r'''
       abstract class A {
@@ -698,7 +1230,7 @@
         get map => { 43: [] };
       }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     Asserter<InterfaceType> assertListOfInt = _isListOf(_isInt);
     Asserter<InterfaceType> assertMapOfIntToListOfInt =
@@ -706,8 +1238,10 @@
 
     VariableDeclaration mapB = AstFinder.getFieldInClass(unit, "B", "map");
     MethodDeclaration mapC = AstFinder.getMethodInClass(unit, "C", "map");
-    assertMapOfIntToListOfInt(mapB.element.type);
-    assertMapOfIntToListOfInt(mapC.element.returnType);
+    assertMapOfIntToListOfInt(
+        resolutionMap.elementDeclaredByVariableDeclaration(mapB).type);
+    assertMapOfIntToListOfInt(
+        resolutionMap.elementDeclaredByMethodDeclaration(mapC).returnType);
 
     MapLiteral mapLiteralB = mapB.initializer;
     MapLiteral mapLiteralC = (mapC.body as ExpressionFunctionBody).expression;
@@ -720,7 +1254,7 @@
     assertListOfInt(listLiteralC.staticType);
   }
 
-  void test_instanceCreation() {
+  test_instanceCreation() async {
     String code = r'''
       class A<S, T> {
         S x;
@@ -813,7 +1347,7 @@
         A<int, String> a5 = new F.named(3, "hello", "hello");
       }
     }''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     Expression rhs(VariableDeclarationStatement stmt) {
       VariableDeclaration decl = stmt.variables.variables[0];
@@ -939,7 +1473,7 @@
     }
   }
 
-  void test_listLiteral_nested() {
+  test_listLiteral_nested() async {
     String code = r'''
       void main () {
         List<List<int>> l0 = [[]];
@@ -948,7 +1482,7 @@
         List<List<int>> l3 = [["hello", 3], []];
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     ListLiteral literal(int i) {
@@ -972,7 +1506,7 @@
     assertListOfInt(literal(3).elements[0].staticType);
   }
 
-  void test_listLiteral_simple() {
+  test_listLiteral_simple() async {
     String code = r'''
       void main () {
         List<int> l0 = [];
@@ -981,7 +1515,7 @@
         List<int> l3 = ["hello", 3];
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
@@ -999,7 +1533,7 @@
     assertListOfInt(literal(3));
   }
 
-  void test_listLiteral_simple_const() {
+  test_listLiteral_simple_const() async {
     String code = r'''
       void main () {
         const List<int> c0 = const [];
@@ -1008,7 +1542,7 @@
         const List<int> c3 = const ["hello", 3];
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
@@ -1026,7 +1560,7 @@
     assertListOfInt(literal(3));
   }
 
-  void test_listLiteral_simple_disabled() {
+  test_listLiteral_simple_disabled() async {
     String code = r'''
       void main () {
         List<int> l0 = <num>[];
@@ -1035,7 +1569,7 @@
         List<int> l3 = <dynamic>["hello", 3];
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
@@ -1051,7 +1585,7 @@
     _isListOf(_isDynamic)(literal(3));
   }
 
-  void test_listLiteral_simple_subtype() {
+  test_listLiteral_simple_subtype() async {
     String code = r'''
       void main () {
         Iterable<int> l0 = [];
@@ -1060,7 +1594,7 @@
         Iterable<int> l3 = ["hello", 3];
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
@@ -1078,7 +1612,7 @@
     assertListOfInt(literal(3));
   }
 
-  void test_mapLiteral_nested() {
+  test_mapLiteral_nested() async {
     String code = r'''
       void main () {
         Map<int, List<String>> l0 = {};
@@ -1088,7 +1622,7 @@
         Map<int, List<String>> l4 = {3:["hello"], "hello": [3]};
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     MapLiteral literal(int i) {
@@ -1114,7 +1648,7 @@
     assertListOfString(literal(4).entries[0].value.staticType);
   }
 
-  void test_mapLiteral_simple() {
+  test_mapLiteral_simple() async {
     String code = r'''
       void main () {
         Map<int, String> l0 = {};
@@ -1124,7 +1658,7 @@
         Map<int, String> l4 = {3:"hello", "hello": 3};
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
@@ -1143,7 +1677,7 @@
     assertMapOfIntToString(literal(3));
   }
 
-  void test_mapLiteral_simple_disabled() {
+  test_mapLiteral_simple_disabled() async {
     String code = r'''
       void main () {
         Map<int, String> l0 = <int, dynamic>{};
@@ -1152,7 +1686,7 @@
         Map<int, String> l3 = <int, dynamic>{3: 3};
      }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     List<Statement> statements =
         AstFinder.getStatementsInTopLevelFunction(unit, "main");
     DartType literal(int i) {
@@ -1171,14 +1705,14 @@
     assertMapOfIntToDynamic(literal(3));
   }
 
-  void test_methodDeclaration_body_propagation() {
+  test_methodDeclaration_body_propagation() async {
     String code = r'''
       class A {
         List<String> m0(int x) => ["hello"];
         List<String> m1(int x) {return [3];};
       }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
     Expression methodReturnValue(String methodName) {
       MethodDeclaration method =
           AstFinder.getMethodInClass(unit, "A", methodName);
@@ -1196,14 +1730,179 @@
     assertListOfString(methodReturnValue("m1").staticType);
   }
 
-  void test_redirectingConstructor_propagation() {
+  test_partialTypes1() async {
+    // Test that downwards inference with a partial type
+    // correctly uses the partial information to fill in subterm
+    // types
+    String code = r'''
+    typedef To Func1<From, To>(From x);
+    S f<S, T>(Func1<S, T> g) => null;
+    String test() => f((l) => l.length);
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    _isString(body.expression.staticType);
+    MethodInvocation invoke = body.expression;
+    FunctionExpression function = invoke.argumentList.arguments[0];
+    ExecutableElement f0 = function.element;
+    FunctionType type = f0.type;
+    _isFunction2Of(_isString, _isInt)(type);
+  }
+
+  test_pinning_multipleConstraints4() async {
+    // Test that downwards inference with two subtype related downwards
+    // covariant constraints on the same parameter correctly infers and pins
+    // the type
+    String code = r'''
+    class A<S, T> {
+      S s;
+      T t;
+    }
+    class B<S> extends A<S, S> {}
+    A<int, num> test() => new B();
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    DartType type = body.expression.staticType;
+
+    Element elementB = AstFinder.getClass(unit, "B").element;
+
+    _isInstantiationOf(_hasElement(elementB))([_isInt])(type);
+  }
+
+  test_pinning_multipleConstraints_contravariant1() async {
+    // Test that downwards inference with two different downwards contravariant
+    // constraints on the same parameter chooses the upper bound
+    // when the only supertype is Object
+    String code = r'''
+    class A<S, T> {
+      S s;
+      T t;
+    }
+    class B<S> extends A<S, S> {}
+    typedef void Contra1<T>(T x);
+    Contra1<A<S, S>> mkA<S>() => (A<S, S> x) {};
+    Contra1<A<int, String>> test() => mkA();
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    FunctionType functionType = body.expression.staticType;
+    DartType type = functionType.normalParameterTypes[0];
+
+    Element elementA = AstFinder.getClass(unit, "A").element;
+
+    _isInstantiationOf(_hasElement(elementA))([_isObject, _isObject])(type);
+  }
+
+  test_pinning_multipleConstraints_contravariant2() async {
+    // Test that downwards inference with two identical downwards contravariant
+    // constraints on the same parameter correctly pins the type
+    String code = r'''
+    class A<S, T> {
+      S s;
+      T t;
+    }
+    class B<S> extends A<S, S> {}
+    typedef void Contra1<T>(T x);
+    Contra1<A<S, S>> mkA<S>() => (A<S, S> x) {};
+    Contra1<A<num, num>> test() => mkA();
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    FunctionType functionType = body.expression.staticType;
+    DartType type = functionType.normalParameterTypes[0];
+
+    Element elementA = AstFinder.getClass(unit, "A").element;
+
+    _isInstantiationOf(_hasElement(elementA))([_isNum, _isNum])(type);
+  }
+
+  test_pinning_multipleConstraints_contravariant3() async {
+    // Test that downwards inference with two different downwards contravariant
+    // constraints on the same parameter correctly choose the least upper bound
+    // when they share a common supertype
+    String code = r'''
+    class A<S, T> {
+      S s;
+      T t;
+    }
+    class B<S> extends A<S, S> {}
+    typedef void Contra1<T>(T x);
+    Contra1<A<S, S>> mkA<S>() => (A<S, S> x) {};
+    Contra1<A<int, double>> test() => mkA();
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    FunctionType functionType = body.expression.staticType;
+    DartType type = functionType.normalParameterTypes[0];
+
+    Element elementA = AstFinder.getClass(unit, "A").element;
+
+    _isInstantiationOf(_hasElement(elementA))([_isNum, _isNum])(type);
+  }
+
+  test_pinning_multipleConstraints_contravariant4() async {
+    // Test that downwards inference with two different downwards contravariant
+    // constraints on the same parameter correctly choose the least upper bound
+    // when one is a subtype of the other
+    String code = r'''
+    class A<S, T> {
+      S s;
+      T t;
+    }
+    class B<S> extends A<S, S> {}
+    typedef void Contra1<T>(T x);
+    Contra1<A<S, S>> mkA<S>() => (A<S, S> x) {};
+    Contra1<A<int, num>> test() => mkA();
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    FunctionType functionType = body.expression.staticType;
+    DartType type = functionType.normalParameterTypes[0];
+
+    Element elementA = AstFinder.getClass(unit, "A").element;
+
+    _isInstantiationOf(_hasElement(elementA))([_isNum, _isNum])(type);
+  }
+
+  test_redirectingConstructor_propagation() async {
     String code = r'''
       class A {
         A() : this.named([]);
         A.named(List<String> x);
       }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     ConstructorDeclaration constructor =
         AstFinder.getConstructorInClass(unit, "A", null);
@@ -1212,7 +1911,91 @@
     _isListOf(_isString)(exp.staticType);
   }
 
-  void test_superConstructorInvocation_propagation() {
+  test_returnType_variance1() async {
+    // Check that downwards inference correctly pins a type parameter
+    // when the parameter is constrained in a contravariant position
+    String code = r'''
+    typedef To Func1<From, To>(From x);
+    Func1<T, String> f<T>(T x) => null;
+    Func1<num, String> test() => f(42);
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    MethodInvocation invoke = body.expression;
+    _isFunction2Of(_isNum, _isFunction2Of(_isNum, _isString))(
+        invoke.staticInvokeType);
+  }
+
+  test_returnType_variance3() async {
+    // Check that the variance heuristic chooses the less precise type
+    // when the return type uses the variable in a contravariant position
+    // and there is no downwards constraint.
+    String code = r'''
+    typedef To Func1<From, To>(From x);
+    Func1<T, String> f<T>(T x, g(T x)) => null;
+    dynamic test() => f(42, (num x) => x);
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    FunctionType functionType = body.expression.staticType;
+    DartType type = functionType.normalParameterTypes[0];
+    _isNum(type);
+  }
+
+  test_returnType_variance4() async {
+    // Check that the variance heuristic chooses the more precise type
+    // when the return type uses the variable in a covariant position
+    // and there is no downwards constraint
+    String code = r'''
+    typedef To Func1<From, To>(From x);
+    Func1<String, T> f<T>(T x, g(T x)) => null;
+    dynamic test() => f(42, (num x) => x);
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    FunctionType functionType = body.expression.staticType;
+    DartType type = functionType.returnType;
+    _isInt(type);
+  }
+
+  test_returnType_variance5() async {
+    // Check that pinning works correctly with a partial type
+    // when the return type uses the variable in a contravariant position
+    String code = r'''
+    typedef To Func1<From, To>(From x);
+    Func1<T, String> f<T>(T x) => null;
+    T g<T, S>(Func1<T, S> f) => null;
+    num test() => g(f(3));
+   ''';
+    Source source = addSource(code);
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+    assertNoErrors(source);
+    verify([source]);
+    CompilationUnit unit = analysisResult.unit;
+    FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    MethodInvocation call = body.expression;
+    _isNum(call.staticType);
+    _isFunction2Of(_isFunction2Of(_isNum, _isString), _isNum)(
+        call.staticInvokeType);
+  }
+
+  test_superConstructorInvocation_propagation() async {
     String code = r'''
       class B {
         B(List<String>);
@@ -1221,7 +2004,7 @@
         A() : super([]);
       }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     ConstructorDeclaration constructor =
         AstFinder.getConstructorInClass(unit, "A", null);
@@ -1230,7 +2013,7 @@
     _isListOf(_isString)(exp.staticType);
   }
 
-  void test_sync_star_method_propagation() {
+  test_sync_star_method_propagation() async {
     String code = r'''
       import "dart:async";
       class A {
@@ -1241,7 +2024,7 @@
         Iterable<List<int>> f3() sync* { yield* new List(); }
       }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     void check(String name, Asserter<InterfaceType> typeTest) {
       MethodDeclaration test = AstFinder.getMethodInClass(unit, "A", name);
@@ -1258,7 +2041,7 @@
     check("f3", _isListOf((DartType type) => _isListOf(_isInt)(type)));
   }
 
-  void test_sync_star_propagation() {
+  test_sync_star_propagation() async {
     String code = r'''
       import "dart:async";
 
@@ -1268,7 +2051,7 @@
       Iterable<List<int>> f2() sync* { yield []; }
       Iterable<List<int>> f3() sync* { yield* new List(); }
    ''';
-    CompilationUnit unit = resolveSource(code);
+    CompilationUnit unit = await resolveSource(code);
 
     void check(String name, Asserter<InterfaceType> typeTest) {
       FunctionDeclaration test = AstFinder.getTopLevelFunction(unit, name);
@@ -1284,6 +2067,30 @@
     check("f2", _isListOf(_isInt));
     check("f3", _isListOf((DartType type) => _isListOf(_isInt)(type)));
   }
+
+  /// Helper method for testing `FutureOr<T>`.
+  ///
+  /// Validates that [code] produces [errors]. It should define a function
+  /// "test", whose body is an expression that invokes a method. Returns that
+  /// invocation.
+  Future<MethodInvocation> _testFutureOr(String code,
+      {List<ErrorCode> errors}) async {
+    Source source = addSource("""
+    import "dart:async";
+    $code""");
+    TestAnalysisResult analysisResult = await computeAnalysisResult(source);
+
+    if (errors == null) {
+      assertNoErrors(source);
+    } else {
+      assertErrors(source, errors);
+    }
+    verify([source]);
+    FunctionDeclaration test =
+        AstFinder.getTopLevelFunction(analysisResult.unit, "test");
+    ExpressionFunctionBody body = test.functionExpression.body;
+    return body.expression;
+  }
 }
 
 /**
@@ -1291,8 +2098,26 @@
  */
 @reflectiveTest
 class StrongModeStaticTypeAnalyzer2Test extends StaticTypeAnalyzer2TestShared {
-  void fail_genericMethod_tearoff_instantiated() {
-    resolveTestUnit(r'''
+  void expectStaticInvokeType(String search, String type) {
+    var invocation = findIdentifier(search).parent as MethodInvocation;
+    expect(invocation.staticInvokeType.toString(), type);
+  }
+
+  fail_futureOr_promotion4() async {
+    // Test that promotion from FutureOr<T> to T works for type
+    // parameters T
+    // TODO(leafp): When the restriction on is checks for generic methods
+    // goes away this should pass.
+    String code = r'''
+    import "dart:async";
+    dynamic test<T extends num>(FutureOr<T> x) => (x is T) &&
+                                                  (x.abs() == 0);
+   ''';
+    await resolveTestUnit(code);
+  }
+
+  fail_genericMethod_tearoff_instantiated() async {
+    await resolveTestUnit(r'''
 class C<E> {
   /*=T*/ f/*<T>*/(E e) => null;
   static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1322,47 +2147,68 @@
     expectIdentifierType('paramTearOffInst', "(int) → int");
   }
 
-  void objectMethodOnFunctions_helper(String code) {
-    resolveTestUnit(code);
-    expectIdentifierType('t0', "String");
-    expectIdentifierType('t1', "() → String");
-    expectIdentifierType('t2', "int");
-    expectIdentifierType('t3', "String");
-    expectIdentifierType('t4', "() → String");
-    expectIdentifierType('t5', "int");
-  }
-
   void setUp() {
     super.setUp();
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.strongMode = true;
-    resetWithOptions(options);
+    resetWith(options: options);
   }
 
-  void test_dynamicObjectGetter_hashCode() {
+  test_dynamicObjectGetter_hashCode() async {
     String code = r'''
 main() {
   dynamic a = null;
   var foo = a.hashCode;
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'int', isNull);
   }
 
-  void test_dynamicObjectMethod_toString() {
+  test_dynamicObjectMethod_toString() async {
     String code = r'''
 main() {
   dynamic a = null;
   var foo = a.toString();
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'String', isNull);
   }
 
-  void test_genericFunction() {
-    resolveTestUnit(r'/*=T*/ f/*<T>*/(/*=T*/ x) => null;');
+  test_futureOr_promotion1() async {
+    // Test that promotion from FutureOr<T> to T works for concrete types
+    String code = r'''
+    import "dart:async";
+    dynamic test(FutureOr<int> x) => (x is int) && (x.abs() == 0);
+   ''';
+    await resolveTestUnit(code);
+  }
+
+  test_futureOr_promotion2() async {
+    // Test that promotion from FutureOr<T> to Future<T> works for concrete
+    // types
+    String code = r'''
+    import "dart:async";
+    dynamic test(FutureOr<int> x) => (x is Future<int>) &&
+                                     (x.then((x) => x) == null);
+   ''';
+    await resolveTestUnit(code);
+  }
+
+  test_futureOr_promotion4() async {
+    // Test that promotion from FutureOr<T> to Future<T> works for type
+    // parameters T
+    String code = r'''
+    import "dart:async";
+    dynamic test<T extends num>(FutureOr<T> x) => (x is Future<T>) &&
+                                                  (x.then((x) => x) == null);
+   ''';
+    await resolveTestUnit(code);
+  }
+
+  test_genericFunction() async {
+    await resolveTestUnit(r'/*=T*/ f/*<T>*/(/*=T*/ x) => null;');
     expectFunctionType('f', '<T>(T) → T',
         elementTypeParams: '[T]', typeFormals: '[T]');
     SimpleIdentifier f = findIdentifier('f');
@@ -1371,14 +2217,14 @@
     expect(ft.toString(), '(String) → String');
   }
 
-  void test_genericFunction_bounds() {
-    resolveTestUnit(r'/*=T*/ f/*<T extends num>*/(/*=T*/ x) => null;');
+  test_genericFunction_bounds() async {
+    await resolveTestUnit(r'/*=T*/ f/*<T extends num>*/(/*=T*/ x) => null;');
     expectFunctionType('f', '<T extends num>(T) → T',
         elementTypeParams: '[T extends num]', typeFormals: '[T extends num]');
   }
 
-  void test_genericFunction_parameter() {
-    resolveTestUnit(r'''
+  test_genericFunction_parameter() async {
+    await resolveTestUnit(r'''
 void g(/*=T*/ f/*<T>*/(/*=T*/ x)) {}
 ''');
     expectFunctionType('f', '<T>(T) → T',
@@ -1390,8 +2236,8 @@
     expect(ft.toString(), '(String) → String');
   }
 
-  void test_genericFunction_static() {
-    resolveTestUnit(r'''
+  test_genericFunction_static() async {
+    await resolveTestUnit(r'''
 class C<E> {
   static /*=T*/ f/*<T>*/(/*=T*/ x) => null;
 }
@@ -1404,7 +2250,7 @@
     expect(ft.toString(), '(String) → String');
   }
 
-  void test_genericFunction_typedef() {
+  test_genericFunction_typedef() async {
     String code = r'''
 typedef T F<T>(T x);
 F f0;
@@ -1435,7 +2281,7 @@
   }
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
 
     checkBody(String className) {
       List<Statement> statements =
@@ -1451,14 +2297,14 @@
     checkBody("D");
   }
 
-  void test_genericFunction_upwardsAndDownwards() {
+  test_genericFunction_upwardsAndDownwards() async {
     // Regression tests for https://github.com/dart-lang/sdk/issues/27151.
-    resolveTestUnit(r'List<num> x = [1, 2];');
+    await resolveTestUnit(r'List<num> x = [1, 2];');
     expectInitializerType('x', 'List<int>');
   }
 
-  void test_genericMethod() {
-    resolveTestUnit(r'''
+  test_genericMethod() async {
+    await resolveTestUnit(r'''
 class C<E> {
   List/*<T>*/ f/*<T>*/(E e) => null;
 }
@@ -1479,8 +2325,8 @@
     expect('${ft.typeArguments}/${ft.typeParameters}', '[String, int]/[E, T]');
   }
 
-  void test_genericMethod_explicitTypeParams() {
-    resolveTestUnit(r'''
+  test_genericMethod_explicitTypeParams() async {
+    await resolveTestUnit(r'''
 class C<E> {
   List/*<T>*/ f/*<T>*/(E e) => null;
 }
@@ -1499,8 +2345,8 @@
         typeProvider.listType.instantiate([typeProvider.intType]));
   }
 
-  void test_genericMethod_functionExpressionInvocation_explicit() {
-    resolveTestUnit(r'''
+  test_genericMethod_functionExpressionInvocation_explicit() async {
+    await resolveTestUnit(r'''
 class C<E> {
   /*=T*/ f/*<T>*/(/*=T*/ e) => null;
   static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1533,8 +2379,8 @@
     expectIdentifierType('lambdaCall', "int");
   }
 
-  void test_genericMethod_functionExpressionInvocation_inferred() {
-    resolveTestUnit(r'''
+  test_genericMethod_functionExpressionInvocation_inferred() async {
+    await resolveTestUnit(r'''
 class C<E> {
   /*=T*/ f/*<T>*/(/*=T*/ e) => null;
   static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1567,8 +2413,8 @@
     expectIdentifierType('lambdaCall', "int");
   }
 
-  void test_genericMethod_functionInvocation_explicit() {
-    resolveTestUnit(r'''
+  test_genericMethod_functionInvocation_explicit() async {
+    await resolveTestUnit(r'''
 class C<E> {
   /*=T*/ f/*<T>*/(/*=T*/ e) => null;
   static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1598,8 +2444,8 @@
     expectIdentifierType('paramCall', "int");
   }
 
-  void test_genericMethod_functionInvocation_inferred() {
-    resolveTestUnit(r'''
+  test_genericMethod_functionInvocation_inferred() async {
+    await resolveTestUnit(r'''
 class C<E> {
   /*=T*/ f/*<T>*/(/*=T*/ e) => null;
   static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1629,8 +2475,8 @@
     expectIdentifierType('paramCall', "int");
   }
 
-  void test_genericMethod_functionTypedParameter() {
-    resolveTestUnit(r'''
+  test_genericMethod_functionTypedParameter() async {
+    await resolveTestUnit(r'''
 class C<E> {
   List/*<T>*/ f/*<T>*/(/*=T*/ f(E e)) => null;
 }
@@ -1651,11 +2497,11 @@
     expect(ft.toString(), '((String) → int) → List<int>');
   }
 
-  void test_genericMethod_implicitDynamic() {
+  test_genericMethod_implicitDynamic() async {
     // Regression test for:
     // https://github.com/dart-lang/sdk/issues/25100#issuecomment-162047588
     // These should not cause any hints or warnings.
-    resolveTestUnit(r'''
+    await resolveTestUnit(r'''
 class List<E> {
   /*=T*/ map/*<T>*/(/*=T*/ f(E e)) => null;
 }
@@ -1673,62 +2519,62 @@
     expect(m2.staticInvokeType.toString(), '((dynamic) → int) → int');
   }
 
-  void test_genericMethod_max_doubleDouble() {
+  test_genericMethod_max_doubleDouble() async {
     String code = r'''
 import 'dart:math';
 main() {
   var foo = max(1.0, 2.0);
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'double', isNull);
   }
 
-  void test_genericMethod_max_doubleDouble_prefixed() {
+  test_genericMethod_max_doubleDouble_prefixed() async {
     String code = r'''
 import 'dart:math' as math;
 main() {
   var foo = math.max(1.0, 2.0);
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'double', isNull);
   }
 
-  void test_genericMethod_max_doubleInt() {
+  test_genericMethod_max_doubleInt() async {
     String code = r'''
 import 'dart:math';
 main() {
   var foo = max(1.0, 2);
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'num', isNull);
   }
 
-  void test_genericMethod_max_intDouble() {
+  test_genericMethod_max_intDouble() async {
     String code = r'''
 import 'dart:math';
 main() {
   var foo = max(1, 2.0);
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'num', isNull);
   }
 
-  void test_genericMethod_max_intInt() {
+  test_genericMethod_max_intInt() async {
     String code = r'''
 import 'dart:math';
 main() {
   var foo = max(1, 2);
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'int', isNull);
   }
 
-  void test_genericMethod_nestedBound() {
+  test_genericMethod_nestedBound() async {
     String code = r'''
 class Foo<T extends num> {
   void method/*<U extends T>*/(dynamic/*=U*/ u) {
@@ -1737,11 +2583,11 @@
 }
 ''';
     // Just validate that there is no warning on the call to `.abs()`.
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
   }
 
-  void test_genericMethod_nestedCapture() {
-    resolveTestUnit(r'''
+  test_genericMethod_nestedCapture() async {
+    await resolveTestUnit(r'''
 class C<T> {
   /*=T*/ f/*<S>*/(/*=S*/ x) {
     new C<S>().f/*<int>*/(3);
@@ -1758,8 +2604,8 @@
     expectIdentifierType('f;', '<S₀>(S₀) → S');
   }
 
-  void test_genericMethod_nestedFunctions() {
-    resolveTestUnit(r'''
+  test_genericMethod_nestedFunctions() async {
+    await resolveTestUnit(r'''
 /*=S*/ f/*<S>*/(/*=S*/ x) {
   g/*<S>*/(/*=S*/ x) => f;
   return null;
@@ -1769,8 +2615,8 @@
     expectIdentifierType('g', '<S>(S) → <S>(S) → S');
   }
 
-  void test_genericMethod_override() {
-    resolveTestUnit(r'''
+  test_genericMethod_override() async {
+    await resolveTestUnit(r'''
 class C {
   /*=T*/ f/*<T>*/(/*=T*/ x) => null;
 }
@@ -1787,8 +2633,8 @@
     expect(ft.toString(), '(String) → String');
   }
 
-  void test_genericMethod_override_bounds() {
-    resolveTestUnit(r'''
+  test_genericMethod_override_bounds() async {
+    await resolveTestUnit(r'''
 class A {}
 class B extends A {}
 class C {
@@ -1800,7 +2646,7 @@
 ''');
   }
 
-  void test_genericMethod_override_invalidReturnType() {
+  test_genericMethod_override_invalidReturnType() async {
     Source source = addSource(r'''
 class C {
   Iterable/*<T>*/ f/*<T>*/(/*=T*/ x) => null;
@@ -1808,11 +2654,12 @@
 class D extends C {
   String f/*<S>*/(/*=S*/ x) => null;
 }''');
+    await computeAnalysisResult(source);
     assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
     verify([source]);
   }
 
-  void test_genericMethod_override_invalidTypeParamBounds() {
+  test_genericMethod_override_invalidTypeParamBounds() async {
     Source source = addSource(r'''
 class A {}
 class B extends A {}
@@ -1822,11 +2669,12 @@
 class D extends C {
   /*=T*/ f/*<T extends B>*/(/*=T*/ x) => null;
 }''');
+    await computeAnalysisResult(source);
     assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
     verify([source]);
   }
 
-  void test_genericMethod_override_invalidTypeParamCount() {
+  test_genericMethod_override_invalidTypeParamCount() async {
     Source source = addSource(r'''
 class C {
   /*=T*/ f/*<T>*/(/*=T*/ x) => null;
@@ -1834,11 +2682,12 @@
 class D extends C {
   /*=S*/ f/*<T, S>*/(/*=T*/ x) => null;
 }''');
+    await computeAnalysisResult(source);
     assertErrors(source, [StrongModeCode.INVALID_METHOD_OVERRIDE]);
     verify([source]);
   }
 
-  void test_genericMethod_propagatedType_promotion() {
+  test_genericMethod_propagatedType_promotion() async {
     // Regression test for:
     // https://github.com/dart-lang/sdk/issues/25340
 
@@ -1846,7 +2695,7 @@
     // example won't work, as we now compute a static type and therefore discard
     // the propagated type. So a new test was created that doesn't run under
     // strong mode.
-    resolveTestUnit(r'''
+    await resolveTestUnit(r'''
 abstract class Iter {
   List/*<S>*/ map/*<S>*/(/*=S*/ f(x));
 }
@@ -1860,8 +2709,8 @@
     expectIdentifierType('y = ', 'List<C>', isNull);
   }
 
-  void test_genericMethod_tearoff() {
-    resolveTestUnit(r'''
+  test_genericMethod_tearoff() async {
+    await resolveTestUnit(r'''
 class C<E> {
   /*=T*/ f/*<T>*/(E e) => null;
   static /*=T*/ g/*<T>*/(/*=T*/ e) => null;
@@ -1891,7 +2740,7 @@
     expectIdentifierType('paramTearOff', "<T>(T) → T");
   }
 
-  void test_genericMethod_then() {
+  test_genericMethod_then() async {
     String code = r'''
 import 'dart:async';
 String toString(int x) => x.toString();
@@ -1900,11 +2749,12 @@
   var foo = bar.then(toString);
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
+
     expectInitializerType('foo', 'Future<String>', isNull);
   }
 
-  void test_genericMethod_then_prefixed() {
+  test_genericMethod_then_prefixed() async {
     String code = r'''
 import 'dart:async' as async;
 String toString(int x) => x.toString();
@@ -1913,11 +2763,11 @@
   var foo = bar.then(toString);
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'Future<String>', isNull);
   }
 
-  void test_genericMethod_then_propagatedType() {
+  test_genericMethod_then_propagatedType() async {
     // Regression test for https://github.com/dart-lang/sdk/issues/25482.
     String code = r'''
 import 'dart:async';
@@ -1927,17 +2777,17 @@
 }
 ''';
     // This should produce no hints or warnings.
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'Future<String>', isNull);
   }
 
-  void test_implicitBounds() {
+  test_implicitBounds() async {
     String code = r'''
 class A<T> {}
 
 class B<T extends num> {}
 
-class C<S extends int, T extends B<S>, U extends B> {}
+class C<S extends int, T extends B<S>, U extends A> {}
 
 void test() {
 //
@@ -1949,16 +2799,257 @@
   var cc = new C();
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectIdentifierType('ai', "A<dynamic>");
     expectIdentifierType('bi', "B<num>");
-    expectIdentifierType('ci', "C<int, B<int>, B<dynamic>>");
+    expectIdentifierType('ci', "C<int, B<int>, A<dynamic>>");
     expectIdentifierType('aa', "A<dynamic>");
     expectIdentifierType('bb', "B<num>");
-    expectIdentifierType('cc', "C<int, B<int>, B<dynamic>>");
+    expectIdentifierType('cc', "C<int, B<int>, A<dynamic>>");
   }
 
-  void test_objectMethodOnFunctions_Anonymous() {
+  @failingTest
+  test_instantiateToBounds_class_error_extension_malbounded() async {
+    // Test that superclasses are strictly checked for malbounded default
+    // types
+    String code = r'''
+class C<T0 extends List<T1>, T1 extends List<T0>> {}
+class D extends C {}
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertErrors(testSource, [StrongModeCode.NO_DEFAULT_BOUNDS]);
+  }
+
+  @failingTest
+  test_instantiateToBounds_class_error_instantiation_malbounded() async {
+    // Test that instance creations are strictly checked for malbounded default
+    // types
+    String code = r'''
+class C<T0 extends List<T1>, T1 extends List<T0>> {}
+void test() {
+  var c = new C();
+}
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertErrors(testSource, [StrongModeCode.NO_DEFAULT_BOUNDS]);
+    expectIdentifierType('c;', 'C<List<dynamic>, List<dynamic>>');
+  }
+
+  test_instantiateToBounds_class_error_recursion() async {
+    String code = r'''
+class C<T0 extends List<T1>, T1 extends List<T0>> {}
+C c;
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertNoErrors(testSource);
+    expectIdentifierType('c;', 'C<List<dynamic>, List<dynamic>>');
+  }
+
+  test_instantiateToBounds_class_error_recursion_self() async {
+    String code = r'''
+class C<T extends C<T>> {}
+C c;
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertNoErrors(testSource);
+    expectIdentifierType('c;', 'C<C<dynamic>>');
+  }
+
+  test_instantiateToBounds_class_error_recursion_self2() async {
+    String code = r'''
+class A<E> {}
+class C<T extends A<T>> {}
+C c;
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertNoErrors(testSource);
+    expectIdentifierType('c;', 'C<A<dynamic>>');
+  }
+
+  test_instantiateToBounds_class_error_typedef() async {
+    String code = r'''
+typedef T F<T>(T x);
+class C<T extends F<T>> {}
+C c;
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertNoErrors(testSource);
+    expectIdentifierType('c;', 'C<(dynamic) → dynamic>');
+  }
+
+  test_instantiateToBounds_class_ok_implicitDynamic_multi() async {
+    String code = r'''
+class C<T0 extends Map<T1, T2>, T1 extends List, T2 extends int> {}
+C c;
+''';
+    await resolveTestUnit(code);
+    assertNoErrors(testSource);
+    expectIdentifierType(
+        'c;', 'C<Map<List<dynamic>, int>, List<dynamic>, int>');
+  }
+
+  test_instantiateToBounds_class_ok_referenceOther_after() async {
+    String code = r'''
+class C<T0 extends T1, T1 extends int> {}
+C c;
+''';
+    await resolveTestUnit(code);
+    assertNoErrors(testSource);
+    expectIdentifierType('c;', 'C<int, int>');
+  }
+
+  test_instantiateToBounds_class_ok_referenceOther_after2() async {
+    String code = r'''
+class C<T0 extends Map<T1, T1>, T1 extends int> {}
+C c;
+''';
+    await resolveTestUnit(code);
+    assertNoErrors(testSource);
+    expectIdentifierType('c;', 'C<Map<int, int>, int>');
+  }
+
+  test_instantiateToBounds_class_ok_referenceOther_before() async {
+    String code = r'''
+class C<T0 extends int, T1 extends T0> {}
+C c;
+''';
+    await resolveTestUnit(code);
+    assertNoErrors(testSource);
+    expectIdentifierType('c;', 'C<int, int>');
+  }
+
+  test_instantiateToBounds_class_ok_referenceOther_multi() async {
+    String code = r'''
+class C<T0 extends Map<T1, T2>, T1 extends List<T2>, T2 extends int> {}
+C c;
+''';
+    await resolveTestUnit(code);
+    assertNoErrors(testSource);
+    expectIdentifierType('c;', 'C<Map<List<int>, int>, List<int>, int>');
+  }
+
+  test_instantiateToBounds_class_ok_simpleBounds() async {
+    String code = r'''
+class A<T> {}
+class B<T extends num> {}
+class C<T extends List<int>> {}
+class D<T extends A> {}
+void main() {
+  A a;
+  B b;
+  C c;
+  D d;
+}
+''';
+    await resolveTestUnit(code);
+    assertNoErrors(testSource);
+    expectIdentifierType('a;', 'A<dynamic>');
+    expectIdentifierType('b;', 'B<num>');
+    expectIdentifierType('c;', 'C<List<int>>');
+    expectIdentifierType('d;', 'D<A<dynamic>>');
+  }
+
+  @failingTest
+  test_instantiateToBounds_generic_function_error_malbounded() async {
+    // Test that generic methods are strictly checked for malbounded default
+    // types
+    String code = r'''
+T0 f<T0 extends List<T1>, T1 extends List<T0>>() {}
+void g() {
+  var c = f();
+  return;
+}
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertErrors(testSource, [StrongModeCode.NO_DEFAULT_BOUNDS]);
+    expectIdentifierType('c;', 'List<dynamic>');
+  }
+
+  test_instantiateToBounds_method_ok_referenceOther_before() async {
+    String code = r'''
+class C<T> {
+  void m<S0 extends T, S1 extends List<S0>>(S0 p0, S1 p1) {}
+
+  void main() {
+    m(null, null);
+  }
+}
+''';
+    await resolveTestUnit(code);
+    assertNoErrors(testSource);
+    expectStaticInvokeType('m(null', '(T, List<T>) → void');
+  }
+
+  test_instantiateToBounds_method_ok_simpleBounds() async {
+    String code = r'''
+class C<T> {
+  void m<S extends T>(S p0) {}
+
+  void main() {
+    m(null);
+  }
+}
+''';
+    await resolveTestUnit(code);
+    assertNoErrors(testSource);
+    expectStaticInvokeType('m(null)', '(T) → void');
+  }
+
+  test_notInstantiatedBound_direct_class_class() async {
+    String code = r'''
+class A<T extends int> {}
+class C<T extends A> {}
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
+  }
+
+  test_notInstantiatedBound_direct_class_typedef() async {
+    // Check that if the bound of a class is an uninstantiated typedef
+    // we emit an error
+    String code = r'''
+typedef void F<T extends int>();
+class C<T extends F> {}
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
+  }
+
+  test_notInstantiatedBound_direct_typedef_class() async {
+    // Check that if the bound of a typeded is an uninstantiated class
+    // we emit an error
+    String code = r'''
+class C<T extends int> {}
+typedef void F<T extends C>();
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
+  }
+
+  test_notInstantiatedBound_indirect_class_class() async {
+    String code = r'''
+class A<T> {}
+class B<T extends int> {}
+class C<T extends A<B>> {}
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertErrors(testSource, [StrongModeCode.NOT_INSTANTIATED_BOUND]);
+  }
+
+  test_notInstantiatedBound_indirect_class_class2() async {
+    String code = r'''
+class A<K, V> {}
+class B<T extends int> {}
+class C<T extends A<B, B>> {}
+''';
+    await resolveTestUnit(code, noErrors: false);
+    assertErrors(testSource, [
+      StrongModeCode.NOT_INSTANTIATED_BOUND,
+      StrongModeCode.NOT_INSTANTIATED_BOUND
+    ]);
+  }
+
+  test_objectMethodOnFunctions_Anonymous() async {
     String code = r'''
 void main() {
   var f = (x) => 3;
@@ -1982,10 +3073,10 @@
   (f)..toString;
   (f)..hashCode;
 }''';
-    objectMethodOnFunctions_helper(code);
+    await _objectMethodOnFunctions_helper2(code);
   }
 
-  void test_objectMethodOnFunctions_Function() {
+  test_objectMethodOnFunctions_Function() async {
     String code = r'''
 void main() {
   Function f;
@@ -2009,10 +3100,10 @@
   (f)..toString;
   (f)..hashCode;
 }''';
-    objectMethodOnFunctions_helper(code);
+    await _objectMethodOnFunctions_helper2(code);
   }
 
-  void test_objectMethodOnFunctions_Static() {
+  test_objectMethodOnFunctions_Static() async {
     String code = r'''
 int f(int x) => null;
 void main() {
@@ -2036,10 +3127,10 @@
   (f)..toString;
   (f)..hashCode;
 }''';
-    objectMethodOnFunctions_helper(code);
+    await _objectMethodOnFunctions_helper2(code);
   }
 
-  void test_objectMethodOnFunctions_Typedef() {
+  test_objectMethodOnFunctions_Typedef() async {
     String code = r'''
 typedef bool Predicate<T>(T object);
 
@@ -2065,17 +3156,17 @@
   (f)..toString;
   (f)..hashCode;
 }''';
-    objectMethodOnFunctions_helper(code);
+    await _objectMethodOnFunctions_helper2(code);
   }
 
-  void test_setterWithDynamicTypeIsError() {
+  test_setterWithDynamicTypeIsError() async {
     Source source = addSource(r'''
 class A {
   dynamic set f(String s) => null;
 }
 dynamic set g(int x) => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.NON_VOID_RETURN_FOR_SETTER,
       StaticWarningCode.NON_VOID_RETURN_FOR_SETTER
@@ -2083,7 +3174,7 @@
     verify([source]);
   }
 
-  void test_setterWithExplicitVoidType_returningVoid() {
+  test_setterWithExplicitVoidType_returningVoid() async {
     Source source = addSource(r'''
 void returnsVoid() {}
 class A {
@@ -2091,12 +3182,12 @@
 }
 void set g(int x) => returnsVoid();
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_setterWithNoVoidType() {
+  test_setterWithNoVoidType() async {
     Source source = addSource(r'''
 class A {
   set f(String s) {
@@ -2105,14 +3196,14 @@
 }
 set g(int x) => 42;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticTypeWarningCode.RETURN_OF_INVALID_TYPE,
     ]);
     verify([source]);
   }
 
-  void test_setterWithNoVoidType_returningVoid() {
+  test_setterWithNoVoidType_returningVoid() async {
     Source source = addSource(r'''
 void returnsVoid() {}
 class A {
@@ -2120,19 +3211,19 @@
 }
 set g(int x) => returnsVoid();
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertNoErrors(source);
     verify([source]);
   }
 
-  void test_setterWithOtherTypeIsError() {
+  test_setterWithOtherTypeIsError() async {
     Source source = addSource(r'''
 class A {
   String set f(String s) => null;
 }
 Object set g(x) => null;
 ''');
-    computeLibrarySourceErrors(source);
+    await computeAnalysisResult(source);
     assertErrors(source, [
       StaticWarningCode.NON_VOID_RETURN_FOR_SETTER,
       StaticWarningCode.NON_VOID_RETURN_FOR_SETTER
@@ -2140,25 +3231,35 @@
     verify([source]);
   }
 
-  void test_ternaryOperator_null_left() {
+  test_ternaryOperator_null_left() async {
     String code = r'''
 main() {
   var foo = (true) ? null : 3;
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'int', isNull);
   }
 
-  void test_ternaryOperator_null_right() {
+  test_ternaryOperator_null_right() async {
     String code = r'''
 main() {
   var foo = (true) ? 3 : null;
 }
 ''';
-    resolveTestUnit(code);
+    await resolveTestUnit(code);
     expectInitializerType('foo', 'int', isNull);
   }
+
+  Future<Null> _objectMethodOnFunctions_helper2(String code) async {
+    await resolveTestUnit(code);
+    expectIdentifierType('t0', "String");
+    expectIdentifierType('t1', "() → String");
+    expectIdentifierType('t2', "int");
+    expectIdentifierType('t3', "String");
+    expectIdentifierType('t4', "() → String");
+    expectIdentifierType('t5', "int");
+  }
 }
 
 @reflectiveTest
@@ -2168,10 +3269,10 @@
     super.setUp();
     AnalysisOptionsImpl options = new AnalysisOptionsImpl();
     options.strongMode = true;
-    resetWithOptions(options);
+    resetWith(options: options);
   }
 
-  void test_foreachInference_dynamic_disabled() {
+  test_foreachInference_dynamic_disabled() async {
     String code = r'''
 main() {
   var list = <int>[];
@@ -2179,11 +3280,12 @@
     v; // marker
   }
 }''';
-    assertPropagatedIterationType(code, typeProvider.dynamicType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedIterationType(code, unit, typeProvider.dynamicType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null);
   }
 
-  void test_foreachInference_reusedVar_disabled() {
+  test_foreachInference_reusedVar_disabled() async {
     String code = r'''
 main() {
   var list = <int>[];
@@ -2192,11 +3294,12 @@
     v; // marker
   }
 }''';
-    assertPropagatedIterationType(code, typeProvider.dynamicType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedIterationType(code, unit, typeProvider.dynamicType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null);
   }
 
-  void test_foreachInference_var() {
+  test_foreachInference_var() async {
     String code = r'''
 main() {
   var list = <int>[];
@@ -2204,11 +3307,12 @@
     v; // marker
   }
 }''';
-    assertPropagatedIterationType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedIterationType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_foreachInference_var_iterable() {
+  test_foreachInference_var_iterable() async {
     String code = r'''
 main() {
   Iterable<int> list = <int>[];
@@ -2216,11 +3320,12 @@
     v; // marker
   }
 }''';
-    assertPropagatedIterationType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedIterationType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_foreachInference_var_stream() {
+  test_foreachInference_var_stream() async {
     String code = r'''
 import 'dart:async';
 main() async {
@@ -2229,52 +3334,57 @@
     v; // marker
   }
 }''';
-    assertPropagatedIterationType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedIterationType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_bottom_disabled() {
+  test_localVariableInference_bottom_disabled() async {
     String code = r'''
 main() {
   var v = null;
   v; // marker
 }''';
-    assertPropagatedAssignedType(code, typeProvider.dynamicType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.dynamicType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null);
   }
 
-  void test_localVariableInference_constant() {
+  test_localVariableInference_constant() async {
     String code = r'''
 main() {
   var v = 3;
   v; // marker
 }''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_declaredType_disabled() {
+  test_localVariableInference_declaredType_disabled() async {
     String code = r'''
 main() {
   dynamic v = 3;
   v; // marker
 }''';
-    assertPropagatedAssignedType(code, typeProvider.dynamicType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.dynamicType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null);
   }
 
-  void test_localVariableInference_noInitializer_disabled() {
+  test_localVariableInference_noInitializer_disabled() async {
     String code = r'''
 main() {
   var v;
   v = 3;
   v; // marker
 }''';
-    assertPropagatedAssignedType(code, typeProvider.dynamicType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.dynamicType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.dynamicType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.dynamicType, null);
   }
 
-  void test_localVariableInference_transitive_field_inferred_lexical() {
+  test_localVariableInference_transitive_field_inferred_lexical() async {
     String code = r'''
 class A {
   final x = 3;
@@ -2286,11 +3396,12 @@
 main() {
 }
 ''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_transitive_field_inferred_reversed() {
+  test_localVariableInference_transitive_field_inferred_reversed() async {
     String code = r'''
 class A {
   f() {
@@ -2302,11 +3413,12 @@
 main() {
 }
 ''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_transitive_field_lexical() {
+  test_localVariableInference_transitive_field_lexical() async {
     String code = r'''
 class A {
   int x = 3;
@@ -2318,11 +3430,12 @@
 main() {
 }
 ''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_transitive_field_reversed() {
+  test_localVariableInference_transitive_field_reversed() async {
     String code = r'''
 class A {
   f() {
@@ -2334,33 +3447,36 @@
 main() {
 }
 ''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_transitive_list_local() {
+  test_localVariableInference_transitive_list_local() async {
     String code = r'''
 main() {
   var x = <int>[3];
   var v = x[0];
   v; // marker
 }''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_transitive_local() {
+  test_localVariableInference_transitive_local() async {
     String code = r'''
 main() {
   var x = 3;
   var v = x;
   v; // marker
 }''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_transitive_toplevel_inferred_lexical() {
+  test_localVariableInference_transitive_toplevel_inferred_lexical() async {
     String code = r'''
 final x = 3;
 main() {
@@ -2368,11 +3484,12 @@
   v; // marker
 }
 ''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_transitive_toplevel_inferred_reversed() {
+  test_localVariableInference_transitive_toplevel_inferred_reversed() async {
     String code = r'''
 main() {
   var v = x;
@@ -2380,11 +3497,12 @@
 }
 final x = 3;
 ''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_transitive_toplevel_lexical() {
+  test_localVariableInference_transitive_toplevel_lexical() async {
     String code = r'''
 int x = 3;
 main() {
@@ -2392,11 +3510,12 @@
   v; // marker
 }
 ''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 
-  void test_localVariableInference_transitive_toplevel_reversed() {
+  test_localVariableInference_transitive_toplevel_reversed() async {
     String code = r'''
 main() {
   var v = x;
@@ -2404,7 +3523,8 @@
 }
 int x = 3;
 ''';
-    assertPropagatedAssignedType(code, typeProvider.intType, null);
-    assertTypeOfMarkedExpression(code, typeProvider.intType, null);
+    CompilationUnit unit = await resolveSource(code);
+    assertPropagatedAssignedType(code, unit, typeProvider.intType, null);
+    assertTypeOfMarkedExpression(code, unit, typeProvider.intType, null);
   }
 }
diff --git a/pkg/analyzer/test/generated/test_all.dart b/pkg/analyzer/test/generated/test_all.dart
index 37c9268..4ad2c63 100644
--- a/pkg/analyzer/test/generated/test_all.dart
+++ b/pkg/analyzer/test/generated/test_all.dart
@@ -8,30 +8,47 @@
 
 import 'all_the_rest_test.dart' as all_the_rest;
 import 'bazel_test.dart' as bazel_test;
+import 'checked_mode_compile_time_error_code_driver_test.dart'
+    as checked_mode_compile_time_error_code_driver_test;
 import 'checked_mode_compile_time_error_code_test.dart'
     as checked_mode_compile_time_error_code_test;
+import 'compile_time_error_code_driver_test.dart'
+    as compile_time_error_code_driver_test;
 import 'compile_time_error_code_test.dart' as compile_time_error_code_test;
 import 'constant_test.dart' as constant_test;
 import 'declaration_resolver_test.dart' as declaration_resolver_test;
 import 'element_resolver_test.dart' as element_resolver_test;
 import 'engine_test.dart' as engine_test;
+import 'error_suppression_driver_test.dart' as error_suppression_driver_test;
 import 'error_suppression_test.dart' as error_suppression_test;
+import 'gn_test.dart' as gn_test;
+import 'hint_code_driver_test.dart' as hint_code_driver_test;
 import 'hint_code_test.dart' as hint_code_test;
 import 'incremental_resolver_test.dart' as incremental_resolver_test;
 import 'inheritance_manager_test.dart' as inheritance_manager_test;
 import 'java_core_test.dart' as java_core_test;
 import 'java_io_test.dart' as java_io_test;
+import 'non_error_resolver_driver_test.dart' as non_error_resolver_driver_test;
 import 'non_error_resolver_test.dart' as non_error_resolver_test;
+import 'non_hint_code_driver_test.dart' as non_hint_code_driver_test;
 import 'non_hint_code_test.dart' as non_hint_code_test;
 import 'parser_test.dart' as parser_test;
+import 'resolver_driver_test.dart' as resolver_driver_test;
 import 'resolver_test.dart' as resolver_test;
 import 'scanner_test.dart' as scanner_test;
 import 'sdk_test.dart' as sdk_test;
 import 'simple_resolver_test.dart' as simple_resolver_test;
 import 'source_factory_test.dart' as source_factory_test;
+import 'static_type_analyzer_driver_test.dart'
+    as static_type_analyzer_driver_test;
 import 'static_type_analyzer_test.dart' as static_type_analyzer_test;
+import 'static_type_warning_code_driver_test.dart'
+    as static_type_warning_code_driver_test;
 import 'static_type_warning_code_test.dart' as static_type_warning_code_test;
+import 'static_warning_code_driver_test.dart'
+    as static_warning_code_driver_test;
 import 'static_warning_code_test.dart' as static_warning_code_test;
+import 'strong_mode_driver_test.dart' as strong_mode_driver_test;
 import 'strong_mode_test.dart' as strong_mode_test;
 import 'type_system_test.dart' as type_system_test;
 import 'utilities_dart_test.dart' as utilities_dart_test;
@@ -42,29 +59,41 @@
   defineReflectiveSuite(() {
     all_the_rest.main();
     bazel_test.main();
+    checked_mode_compile_time_error_code_driver_test.main();
     checked_mode_compile_time_error_code_test.main();
+    compile_time_error_code_driver_test.main();
     compile_time_error_code_test.main();
     constant_test.main();
     declaration_resolver_test.main();
     element_resolver_test.main();
     engine_test.main();
+    error_suppression_driver_test.main();
     error_suppression_test.main();
+    gn_test.main();
+    hint_code_driver_test.main();
     hint_code_test.main();
     incremental_resolver_test.main();
     inheritance_manager_test.main();
     java_core_test.main();
     java_io_test.main();
+    non_error_resolver_driver_test.main();
     non_error_resolver_test.main();
+    non_hint_code_driver_test.main();
     non_hint_code_test.main();
     parser_test.main();
+    resolver_driver_test.main();
     resolver_test.main();
     scanner_test.main();
     sdk_test.main();
     simple_resolver_test.main();
     source_factory_test.main();
+    static_type_analyzer_driver_test.main();
     static_type_analyzer_test.main();
+    static_type_warning_code_driver_test.main();
     static_type_warning_code_test.main();
+    static_warning_code_driver_test.main();
     static_warning_code_test.main();
+    strong_mode_driver_test.main();
     strong_mode_test.main();
     type_system_test.main();
     utilities_dart_test.main();
diff --git a/pkg/analyzer/test/generated/test_support.dart b/pkg/analyzer/test/generated/test_support.dart
index ce0b3f0..68b7eed 100644
--- a/pkg/analyzer/test/generated/test_support.dart
+++ b/pkg/analyzer/test/generated/test_support.dart
@@ -99,8 +99,6 @@
   void setUp() {
     List<Plugin> plugins = <Plugin>[];
     plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-    plugins.add(AnalysisEngine.instance.commandLinePlugin);
-    plugins.add(AnalysisEngine.instance.optionsPlugin);
     new ExtensionManager().processPlugins(plugins);
   }
 
diff --git a/pkg/analyzer/test/generated/type_system_test.dart b/pkg/analyzer/test/generated/type_system_test.dart
index 6aa2ad1..0f6ea84 100644
--- a/pkg/analyzer/test/generated/type_system_test.dart
+++ b/pkg/analyzer/test/generated/type_system_test.dart
@@ -65,8 +65,7 @@
 
   void _checkGreatestLowerBound(
       DartType type1, DartType type2, DartType expectedResult) {
-    DartType glb =
-        strongTypeSystem.getGreatestLowerBound(typeProvider, type1, type2);
+    DartType glb = strongTypeSystem.getGreatestLowerBound(type1, type2);
     expect(glb, expectedResult);
     // Check that the result is a lower bound.
     expect(typeSystem.isSubtypeOf(glb, type1), true);
@@ -77,7 +76,7 @@
     // for function types we just check if they are mutual subtypes.
     // https://github.com/dart-lang/sdk/issues/26126
     // TODO(leafp): Fix this.
-    glb = strongTypeSystem.getGreatestLowerBound(typeProvider, type2, type1);
+    glb = strongTypeSystem.getGreatestLowerBound(type2, type1);
     if (glb is FunctionTypeImpl) {
       expect(typeSystem.isSubtypeOf(glb, expectedResult), true);
       expect(typeSystem.isSubtypeOf(expectedResult, glb), true);
@@ -88,7 +87,7 @@
 
   void _checkLeastUpperBound(
       DartType type1, DartType type2, DartType expectedResult) {
-    DartType lub = typeSystem.getLeastUpperBound(typeProvider, type1, type2);
+    DartType lub = typeSystem.getLeastUpperBound(type1, type2);
     expect(lub, expectedResult);
     // Check that the result is an upper bound.
     expect(typeSystem.isSubtypeOf(type1, lub), true);
@@ -100,7 +99,7 @@
     // for function types we just check if they are mutual subtypes.
     // https://github.com/dart-lang/sdk/issues/26126
     // TODO(leafp): Fix this.
-    lub = typeSystem.getLeastUpperBound(typeProvider, type2, type1);
+    lub = typeSystem.getLeastUpperBound(type2, type1);
     if (lub is FunctionTypeImpl) {
       expect(typeSystem.isSubtypeOf(lub, expectedResult), true);
       expect(typeSystem.isSubtypeOf(expectedResult, lub), true);
@@ -138,8 +137,8 @@
 @reflectiveTest
 class LeastUpperBoundTest extends LeastUpperBoundTestBase {
   void setUp() {
-    typeSystem = new TypeSystemImpl();
     super.setUp();
+    typeSystem = new TypeSystemImpl(typeProvider);
   }
 
   void test_functionsLubNamedParams() {
@@ -566,7 +565,7 @@
 
   void setUp() {
     typeProvider = new TestTypeProvider();
-    typeSystem = new StrongTypeSystemImpl();
+    typeSystem = new StrongTypeSystemImpl(typeProvider);
   }
 
   void test_isAssignableTo_bottom_isBottom() {
@@ -865,7 +864,7 @@
 
   void setUp() {
     typeProvider = new TestTypeProvider();
-    typeSystem = new StrongTypeSystemImpl();
+    typeSystem = new StrongTypeSystemImpl(typeProvider);
   }
 
   void test_boundedByAnotherTypeParameter() {
@@ -1125,7 +1124,6 @@
   List<DartType> _inferCall(FunctionTypeImpl ft, List<DartType> arguments,
       [DartType returnType]) {
     FunctionType inferred = typeSystem.inferGenericFunctionCall(
-        typeProvider,
         ft,
         ft.parameters.map((p) => p.type).toList(),
         arguments,
@@ -1141,8 +1139,8 @@
 @reflectiveTest
 class StrongGreatestLowerBoundTest extends BoundTestBase {
   void setUp() {
-    typeSystem = new StrongTypeSystemImpl();
     super.setUp();
+    typeSystem = new StrongTypeSystemImpl(typeProvider);
   }
 
   void test_bottom_function() {
@@ -1402,8 +1400,8 @@
 @reflectiveTest
 class StrongLeastUpperBoundTest extends LeastUpperBoundTestBase {
   void setUp() {
-    typeSystem = new StrongTypeSystemImpl();
     super.setUp();
+    typeSystem = new StrongTypeSystemImpl(typeProvider);
   }
 
   void test_functionsFuzzyArrows() {
@@ -1520,7 +1518,7 @@
 
   void setUp() {
     typeProvider = new TestTypeProvider();
-    typeSystem = new StrongTypeSystemImpl();
+    typeSystem = new StrongTypeSystemImpl(typeProvider);
   }
 
   void test_bottom_isBottom() {
@@ -1608,15 +1606,42 @@
     DartType u = TypeBuilder.variable("U", bound: intType);
     DartType v = TypeBuilder.variable("V", bound: u);
 
+    DartType a = TypeBuilder.variable("A");
+    DartType b = TypeBuilder.variable("B", bound: a);
+    DartType c = TypeBuilder.variable("C", bound: intType);
+    DartType d = TypeBuilder.variable("D", bound: c);
+
     _checkIsStrictSubtypeOf(
         TypeBuilder.function(types: [s, t], required: [s], result: t),
+        TypeBuilder.function(
+            types: [a, b], required: [dynamicType], result: dynamicType));
+
+    _checkIsNotSubtypeOf(
+        TypeBuilder.function(types: [u, v], required: [u], result: v),
+        TypeBuilder.function(
+            types: [c, d], required: [objectType], result: objectType));
+
+    _checkIsNotSubtypeOf(
+        TypeBuilder.function(types: [u, v], required: [u], result: v),
+        TypeBuilder
+            .function(types: [c, d], required: [intType], result: intType));
+  }
+
+  void test_genericFunction_genericDoesNotSubtypeNonGeneric() {
+    DartType s = TypeBuilder.variable("S");
+    DartType t = TypeBuilder.variable("T", bound: s);
+    DartType u = TypeBuilder.variable("U", bound: intType);
+    DartType v = TypeBuilder.variable("V", bound: u);
+
+    _checkIsNotSubtypeOf(
+        TypeBuilder.function(types: [s, t], required: [s], result: t),
         TypeBuilder.function(required: [dynamicType], result: dynamicType));
 
     _checkIsNotSubtypeOf(
         TypeBuilder.function(types: [u, v], required: [u], result: v),
         TypeBuilder.function(required: [objectType], result: objectType));
 
-    _checkIsStrictSubtypeOf(
+    _checkIsNotSubtypeOf(
         TypeBuilder.function(types: [u, v], required: [u], result: v),
         TypeBuilder.function(required: [intType], result: intType));
   }
diff --git a/pkg/analyzer/test/generated/utilities_test.dart b/pkg/analyzer/test/generated/utilities_test.dart
index 88b88d5..51c4a560 100644
--- a/pkg/analyzer/test/generated/utilities_test.dart
+++ b/pkg/analyzer/test/generated/utilities_test.dart
@@ -7,6 +7,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/src/dart/ast/token.dart';
@@ -1606,7 +1607,7 @@
             dynamic exception, StackTrace stackTrace) {
       handlerInvoked = true;
     });
-    new NullLiteral(null).accept(visitor);
+    astFactory.nullLiteral(null).accept(visitor);
     expect(handlerInvoked, isTrue);
   }
 }
@@ -1630,9 +1631,9 @@
 }
 
 class Getter_NodeReplacerTest_test_asExpression
-    implements NodeReplacerTest_Getter<AsExpression, TypeName> {
+    implements NodeReplacerTest_Getter<AsExpression, TypeAnnotation> {
   @override
-  TypeName get(AsExpression node) => node.type;
+  TypeAnnotation get(AsExpression node) => node.type;
 }
 
 class Getter_NodeReplacerTest_test_asExpression_2
@@ -1714,9 +1715,9 @@
 }
 
 class Getter_NodeReplacerTest_test_catchClause_3
-    implements NodeReplacerTest_Getter<CatchClause, TypeName> {
+    implements NodeReplacerTest_Getter<CatchClause, TypeAnnotation> {
   @override
-  TypeName get(CatchClause node) => node.exceptionType;
+  TypeAnnotation get(CatchClause node) => node.exceptionType;
 }
 
 class Getter_NodeReplacerTest_test_classDeclaration
@@ -1882,9 +1883,9 @@
 }
 
 class Getter_NodeReplacerTest_test_declaredIdentifier
-    implements NodeReplacerTest_Getter<DeclaredIdentifier, TypeName> {
+    implements NodeReplacerTest_Getter<DeclaredIdentifier, TypeAnnotation> {
   @override
-  TypeName get(DeclaredIdentifier node) => node.type;
+  TypeAnnotation get(DeclaredIdentifier node) => node.type;
 }
 
 class Getter_NodeReplacerTest_test_declaredIdentifier_2
@@ -1964,9 +1965,9 @@
 }
 
 class Getter_NodeReplacerTest_test_fieldFormalParameter_2
-    implements NodeReplacerTest_Getter<FieldFormalParameter, TypeName> {
+    implements NodeReplacerTest_Getter<FieldFormalParameter, TypeAnnotation> {
   @override
-  TypeName get(FieldFormalParameter node) => node.type;
+  TypeAnnotation get(FieldFormalParameter node) => node.type;
 }
 
 class Getter_NodeReplacerTest_test_forEachStatement_withIdentifier
@@ -2042,9 +2043,9 @@
 }
 
 class Getter_NodeReplacerTest_test_functionDeclaration
-    implements NodeReplacerTest_Getter<FunctionDeclaration, TypeName> {
+    implements NodeReplacerTest_Getter<FunctionDeclaration, TypeAnnotation> {
   @override
-  TypeName get(FunctionDeclaration node) => node.returnType;
+  TypeAnnotation get(FunctionDeclaration node) => node.returnType;
 }
 
 class Getter_NodeReplacerTest_test_functionDeclaration_2
@@ -2109,9 +2110,9 @@
 }
 
 class Getter_NodeReplacerTest_test_functionTypeAlias_3
-    implements NodeReplacerTest_Getter<FunctionTypeAlias, TypeName> {
+    implements NodeReplacerTest_Getter<FunctionTypeAlias, TypeAnnotation> {
   @override
-  TypeName get(FunctionTypeAlias node) => node.returnType;
+  TypeAnnotation get(FunctionTypeAlias node) => node.returnType;
 }
 
 class Getter_NodeReplacerTest_test_functionTypeAlias_4
@@ -2121,9 +2122,10 @@
 }
 
 class Getter_NodeReplacerTest_test_functionTypedFormalParameter
-    implements NodeReplacerTest_Getter<FunctionTypedFormalParameter, TypeName> {
+    implements
+        NodeReplacerTest_Getter<FunctionTypedFormalParameter, TypeAnnotation> {
   @override
-  TypeName get(FunctionTypedFormalParameter node) => node.returnType;
+  TypeAnnotation get(FunctionTypedFormalParameter node) => node.returnType;
 }
 
 class Getter_NodeReplacerTest_test_functionTypedFormalParameter_2
@@ -2197,9 +2199,9 @@
 }
 
 class Getter_NodeReplacerTest_test_isExpression_2
-    implements NodeReplacerTest_Getter<IsExpression, TypeName> {
+    implements NodeReplacerTest_Getter<IsExpression, TypeAnnotation> {
   @override
-  TypeName get(IsExpression node) => node.type;
+  TypeAnnotation get(IsExpression node) => node.type;
 }
 
 class Getter_NodeReplacerTest_test_label
@@ -2233,9 +2235,9 @@
 }
 
 class Getter_NodeReplacerTest_test_methodDeclaration
-    implements NodeReplacerTest_Getter<MethodDeclaration, TypeName> {
+    implements NodeReplacerTest_Getter<MethodDeclaration, TypeAnnotation> {
   @override
-  TypeName get(MethodDeclaration node) => node.returnType;
+  TypeAnnotation get(MethodDeclaration node) => node.returnType;
 }
 
 class Getter_NodeReplacerTest_test_methodDeclaration_2
@@ -2370,9 +2372,9 @@
 }
 
 class Getter_NodeReplacerTest_test_simpleFormalParameter
-    implements NodeReplacerTest_Getter<SimpleFormalParameter, TypeName> {
+    implements NodeReplacerTest_Getter<SimpleFormalParameter, TypeAnnotation> {
   @override
-  TypeName get(SimpleFormalParameter node) => node.type;
+  TypeAnnotation get(SimpleFormalParameter node) => node.type;
 }
 
 class Getter_NodeReplacerTest_test_superConstructorInvocation
@@ -2441,9 +2443,9 @@
 }
 
 class Getter_NodeReplacerTest_test_typeParameter
-    implements NodeReplacerTest_Getter<TypeParameter, TypeName> {
+    implements NodeReplacerTest_Getter<TypeParameter, TypeAnnotation> {
   @override
-  TypeName get(TypeParameter node) => node.bound;
+  TypeAnnotation get(TypeParameter node) => node.bound;
 }
 
 class Getter_NodeReplacerTest_test_typeParameter_2
@@ -2465,9 +2467,10 @@
 }
 
 class Getter_NodeReplacerTest_test_variableDeclarationList
-    implements NodeReplacerTest_Getter<VariableDeclarationList, TypeName> {
+    implements
+        NodeReplacerTest_Getter<VariableDeclarationList, TypeAnnotation> {
   @override
-  TypeName get(VariableDeclarationList node) => node.type;
+  TypeAnnotation get(VariableDeclarationList node) => node.type;
 }
 
 class Getter_NodeReplacerTest_test_variableDeclarationStatement
@@ -2763,11 +2766,11 @@
 }
 
 class ListGetter_NodeReplacerTest_test_typeArgumentList
-    extends NodeReplacerTest_ListGetter<TypeArgumentList, TypeName> {
+    extends NodeReplacerTest_ListGetter<TypeArgumentList, TypeAnnotation> {
   ListGetter_NodeReplacerTest_test_typeArgumentList(int arg0) : super(arg0);
 
   @override
-  NodeList<TypeName> getList(TypeArgumentList node) => node.arguments;
+  NodeList<TypeAnnotation> getList(TypeArgumentList node) => node.arguments;
 }
 
 class ListGetter_NodeReplacerTest_test_typeParameterList
@@ -3063,8 +3066,7 @@
       AstTestFactory.fieldDeclaration2(
           false, null, [AstTestFactory.variableDeclaration("f")])
     ]);
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     node.nativeClause = AstTestFactory.nativeClause("");
@@ -3087,8 +3089,7 @@
         AstTestFactory.typeName4("B"),
         AstTestFactory.withClause([AstTestFactory.typeName4("C")]),
         AstTestFactory.implementsClause([AstTestFactory.typeName4("D")]));
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(node, new Getter_NodeReplacerTest_test_classTypeAlias_4());
@@ -3100,15 +3101,15 @@
   }
 
   void test_comment() {
-    Comment node = Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
-    node.references
-        .add(new CommentReference(null, AstTestFactory.identifier3("x")));
+    Comment node = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
+    node.references.add(
+        astFactory.commentReference(null, AstTestFactory.identifier3("x")));
     _assertReplace(node, new ListGetter_NodeReplacerTest_test_comment(0));
   }
 
   void test_commentReference() {
     CommentReference node =
-        new CommentReference(null, AstTestFactory.identifier3("x"));
+        astFactory.commentReference(null, AstTestFactory.identifier3("x"));
     _assertReplace(node, new Getter_NodeReplacerTest_test_commentReference());
   }
 
@@ -3151,8 +3152,7 @@
               false, "x", AstTestFactory.integer(0))
         ],
         AstTestFactory.emptyFunctionBody());
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     node.redirectedConstructor =
@@ -3196,8 +3196,7 @@
   void test_declaredIdentifier() {
     DeclaredIdentifier node =
         AstTestFactory.declaredIdentifier4(AstTestFactory.typeName4("C"), "i");
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(node, new Getter_NodeReplacerTest_test_declaredIdentifier());
@@ -3223,8 +3222,8 @@
   }
 
   void test_enumConstantDeclaration() {
-    EnumConstantDeclaration node = new EnumConstantDeclaration(
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST),
+    EnumConstantDeclaration node = astFactory.enumConstantDeclaration(
+        astFactory.endOfLineComment(EMPTY_TOKEN_LIST),
         [AstTestFactory.annotation(AstTestFactory.identifier3("a"))],
         AstTestFactory.identifier3("C"));
     _assertReplace(
@@ -3234,8 +3233,7 @@
 
   void test_enumDeclaration() {
     EnumDeclaration node = AstTestFactory.enumDeclaration2("E", ["ONE", "TWO"]);
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(node, new Getter_NodeReplacerTest_test_enumDeclaration());
@@ -3246,8 +3244,7 @@
     ExportDirective node = AstTestFactory.exportDirective2("", [
       AstTestFactory.hideCombinator2(["C"])
     ]);
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _testNamespaceDirective(node);
@@ -3279,8 +3276,7 @@
         null,
         AstTestFactory.typeName4("C"),
         [AstTestFactory.variableDeclaration("c")]);
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(node, new Getter_NodeReplacerTest_test_fieldDeclaration());
@@ -3293,8 +3289,7 @@
         AstTestFactory.typeName4("C"),
         "f",
         AstTestFactory.formalParameterList());
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata = [
       AstTestFactory.annotation(AstTestFactory.identifier3("a"))
     ];
@@ -3380,8 +3375,7 @@
         "f",
         AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(),
             AstTestFactory.blockFunctionBody(AstTestFactory.block())));
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(
@@ -3431,8 +3425,7 @@
         "F",
         AstTestFactory.typeParameterList(["E"]),
         AstTestFactory.formalParameterList());
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(
@@ -3449,8 +3442,7 @@
     FunctionTypedFormalParameter node = AstTestFactory
         .functionTypedFormalParameter(AstTestFactory.typeName4("R"), "f",
             [AstTestFactory.simpleFormalParameter3("p")]);
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata = [
       AstTestFactory.annotation(AstTestFactory.identifier3("a"))
     ];
@@ -3489,8 +3481,7 @@
       AstTestFactory.showCombinator2(["A"]),
       AstTestFactory.hideCombinator2(["B"])
     ]);
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(node, new Getter_NodeReplacerTest_test_importDirective());
@@ -3542,8 +3533,7 @@
 
   void test_libraryDirective() {
     LibraryDirective node = AstTestFactory.libraryDirective2("lib");
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(node, new Getter_NodeReplacerTest_test_libraryDirective());
@@ -3590,8 +3580,7 @@
         AstTestFactory.identifier3("m"),
         AstTestFactory.formalParameterList(),
         AstTestFactory.blockFunctionBody(AstTestFactory.block()));
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(node, new Getter_NodeReplacerTest_test_methodDeclaration());
@@ -3638,8 +3627,7 @@
 
   void test_partDirective() {
     PartDirective node = AstTestFactory.partDirective2("");
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _testUriBasedDirective(node);
@@ -3648,8 +3636,7 @@
   void test_partOfDirective() {
     PartOfDirective node = AstTestFactory
         .partOfDirective(AstTestFactory.libraryIdentifier2(["lib"]));
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(node, new Getter_NodeReplacerTest_test_partOfDirective());
@@ -3706,8 +3693,7 @@
   void test_simpleFormalParameter() {
     SimpleFormalParameter node = AstTestFactory.simpleFormalParameter4(
         AstTestFactory.typeName4("T"), "p");
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata = [
       AstTestFactory.annotation(AstTestFactory.identifier3("a"))
     ];
@@ -3768,8 +3754,7 @@
     TopLevelVariableDeclaration node = AstTestFactory
         .topLevelVariableDeclaration(null, AstTestFactory.typeName4("T"),
             [AstTestFactory.variableDeclaration("t")]);
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(
@@ -3819,8 +3804,7 @@
   void test_variableDeclaration() {
     VariableDeclaration node =
         AstTestFactory.variableDeclaration2("a", AstTestFactory.nullLiteral());
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(
@@ -3835,8 +3819,7 @@
         null,
         AstTestFactory.typeName4("T"),
         [AstTestFactory.variableDeclaration("a")]);
-    node.documentationComment =
-        Comment.createEndOfLineComment(EMPTY_TOKEN_LIST);
+    node.documentationComment = astFactory.endOfLineComment(EMPTY_TOKEN_LIST);
     node.metadata
         .add(AstTestFactory.annotation(AstTestFactory.identifier3("a")));
     _assertReplace(
diff --git a/pkg/analyzer/test/source/error_processor_test.dart b/pkg/analyzer/test/source/error_processor_test.dart
index fcf3f1e..c7f0852 100644
--- a/pkg/analyzer/test/source/error_processor_test.dart
+++ b/pkg/analyzer/test/source/error_processor_test.dart
@@ -153,17 +153,15 @@
 void configureOptions(String options) {
   Map<String, YamlNode> optionMap =
       optionsProvider.getOptionsFromString(options);
-  configureContextOptions(context, optionMap);
+  applyToAnalysisOptions(context.analysisOptions, optionMap);
 }
 
 ErrorProcessor getProcessor(AnalysisError error) =>
-    ErrorProcessor.getProcessor(context, error);
+    ErrorProcessor.getProcessor(context.analysisOptions, error);
 
 void oneTimeSetup() {
   List<Plugin> plugins = <Plugin>[];
   plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-  plugins.add(AnalysisEngine.instance.commandLinePlugin);
-  plugins.add(AnalysisEngine.instance.optionsPlugin);
   ExtensionManager manager = new ExtensionManager();
   manager.processPlugins(plugins);
 }
diff --git a/pkg/analyzer/test/src/command_line/arguments_test.dart b/pkg/analyzer/test/src/command_line/arguments_test.dart
index eb6704c..7e1bb68 100644
--- a/pkg/analyzer/test/src/command_line/arguments_test.dart
+++ b/pkg/analyzer/test/src/command_line/arguments_test.dart
@@ -2,7 +2,7 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-library analyzer.test.src.context.context_builder_test;
+library analyzer.test.src.command_line.arguments_test;
 
 import 'package:analyzer/file_system/memory_file_system.dart';
 import 'package:analyzer/src/command_line/arguments.dart';
@@ -142,13 +142,30 @@
     expect(parser.options, hasLength(12));
   }
 
+  void test_extractDefinedVariables() {
+    List<String> args = ['--a', '-Dbaz', 'go', '-Dc=d', 'e=f', '-Dy=', '-Dx'];
+    Map<String, String> definedVariables = {'one': 'two'};
+    args = extractDefinedVariables(args, definedVariables);
+    expect(args, orderedEquals(['--a', 'e=f', '-Dx']));
+    expect(definedVariables['one'], 'two');
+    expect(definedVariables['two'], isNull);
+    expect(definedVariables['baz'], 'go');
+    expect(definedVariables['go'], isNull);
+    expect(definedVariables['c'], 'd');
+    expect(definedVariables['d'], isNull);
+    expect(definedVariables['y'], '');
+    expect(definedVariables, hasLength(4));
+  }
+
   void test_filterUnknownArguments() {
-    List<String> args = ['--a', '--b', '--c', 'foo', 'bar'];
+    List<String> args = ['--a', '--b', '--c=0', '--d=1', '-e=2', '-f', 'bar'];
     ArgParser parser = new ArgParser();
     parser.addFlag('a');
-    parser.addFlag('c');
+    parser.addOption('c');
+    parser.addOption('ee', abbr: 'e');
+    parser.addFlag('ff', abbr: 'f');
     List<String> result = filterUnknownArguments(args, parser);
-    expect(result, orderedEquals(['--a', '--c', 'foo', 'bar']));
+    expect(result, orderedEquals(['--a', '--c=0', '-e=2', '-f', 'bar']));
   }
 
   void test_parse_noReplacement_noIgnored() {
@@ -166,8 +183,10 @@
 
   void test_preprocessArgs_noReplacement() {
     MemoryResourceProvider provider = new MemoryResourceProvider();
-    List<String> result = preprocessArgs(provider, ['--xx' '--yy' 'baz']);
-    expect(result, orderedEquals(['--xx' '--yy' 'baz']));
+    List<String> original = ['--xx' '--yy' 'baz'];
+    List<String> result = preprocessArgs(provider, original);
+    expect(result, orderedEquals(original));
+    expect(identical(original, result), isFalse);
   }
 
   void test_preprocessArgs_replacement_exists() {
@@ -191,8 +210,13 @@
     MemoryResourceProvider provider = new MemoryResourceProvider();
     String filePath = provider.convertPath('/args.txt');
     List<String> args = ['ignored', '@$filePath'];
-    List<String> result = preprocessArgs(provider, args);
-    expect(result, orderedEquals(args));
+    try {
+      preprocessArgs(provider, args);
+      fail('Expect exception');
+    } on Exception catch (e) {
+      expect(e.toString(), contains('Failed to read file'));
+      expect(e.toString(), contains('@$filePath'));
+    }
   }
 
   void test_preprocessArgs_replacement_notLast() {
diff --git a/pkg/analyzer/test/src/context/abstract_context.dart b/pkg/analyzer/test/src/context/abstract_context.dart
index ae77652..0e60d81 100644
--- a/pkg/analyzer/test/src/context/abstract_context.dart
+++ b/pkg/analyzer/test/src/context/abstract_context.dart
@@ -162,8 +162,6 @@
   void setUp() {
     List<Plugin> plugins = <Plugin>[];
     plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-    plugins.add(AnalysisEngine.instance.commandLinePlugin);
-    plugins.add(AnalysisEngine.instance.optionsPlugin);
 
     ExtensionManager manager = new ExtensionManager();
     manager.processPlugins(plugins);
diff --git a/pkg/analyzer/test/src/context/builder_test.dart b/pkg/analyzer/test/src/context/builder_test.dart
index 9ddf64f..4569f8e 100644
--- a/pkg/analyzer/test/src/context/builder_test.dart
+++ b/pkg/analyzer/test/src/context/builder_test.dart
@@ -6,18 +6,17 @@
 
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/memory_file_system.dart';
-import 'package:analyzer/plugin/options.dart';
+import 'package:analyzer/src/command_line/arguments.dart';
 import 'package:analyzer/src/context/builder.dart';
 import 'package:analyzer/src/context/source.dart';
 import 'package:analyzer/src/generated/bazel.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/plugin/options_plugin.dart';
+import 'package:args/args.dart';
 import 'package:package_config/packages.dart';
 import 'package:package_config/src/packages_impl.dart';
 import 'package:path/path.dart' as path;
-import 'package:plugin/src/plugin_impl.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -113,6 +112,33 @@
     fail('Incomplete test');
   }
 
+  void test_cmdline_options_override_options_file() {
+    ArgParser argParser = new ArgParser();
+    defineAnalysisArguments(argParser);
+    ArgResults argResults = argParser.parse(['--$enableStrictCallChecksFlag']);
+    var builder = new ContextBuilder(resourceProvider, sdkManager, contentCache,
+        options: createContextBuilderOptions(argResults));
+
+    AnalysisOptionsImpl expected = new AnalysisOptionsImpl();
+    expected.enableSuperMixins = true;
+    expected.enableStrictCallChecks = true;
+
+    String path = resourceProvider.convertPath('/some/directory/path');
+    String filePath =
+    pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
+    resourceProvider.newFile(
+        filePath,
+        '''
+analyzer:
+  language:
+    enableSuperMixins : true
+    enableStrictCallChecks : false
+''');
+
+    AnalysisOptions options = builder.getAnalysisOptions(path);
+    _expectEqualOptions(options, expected);
+  }
+
   void test_convertPackagesToMap_noPackages() {
     expect(builder.convertPackagesToMap(Packages.noPackages), isEmpty);
   }
@@ -144,7 +170,6 @@
     // being returned.
     AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
     defaultOptions.dart2jsHint = !defaultOptions.dart2jsHint;
-    defaultOptions.enableAssertMessage = !defaultOptions.enableAssertMessage;
     defaultOptions.enableLazyAssignmentOperators =
         !defaultOptions.enableLazyAssignmentOperators;
     defaultOptions.enableStrictCallChecks =
@@ -513,8 +538,7 @@
     - empty_constructor_bodies
 ''');
 
-    AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
-    AnalysisOptions options = builder.getAnalysisOptions(context, path);
+    AnalysisOptions options = builder.getAnalysisOptions(path);
     _expectEqualOptions(options, expected);
   }
 
@@ -536,24 +560,8 @@
     enableSuperMixins : true
 ''');
 
-    AnalysisEngine engine = AnalysisEngine.instance;
-    OptionsPlugin plugin = engine.optionsPlugin;
-    plugin.registerExtensionPoints((_) {});
-    try {
-      _TestOptionsProcessor processor = new _TestOptionsProcessor();
-      processor.expectedOptions = <String, Object>{
-        'analyzer': {
-          'language': {'enableSuperMixins': true}
-        }
-      };
-      (plugin.optionsProcessorExtensionPoint as ExtensionPointImpl)
-          .add(processor);
-      AnalysisContext context = engine.createAnalysisContext();
-      AnalysisOptions options = builder.getAnalysisOptions(context, path);
-      _expectEqualOptions(options, expected);
-    } finally {
-      plugin.registerExtensionPoints((_) {});
-    }
+    AnalysisOptions options = builder.getAnalysisOptions(path);
+    _expectEqualOptions(options, expected);
   }
 
   void test_getAnalysisOptions_includes() {
@@ -589,26 +597,8 @@
     enableSuperMixins : true
 ''');
 
-    AnalysisEngine engine = AnalysisEngine.instance;
-    OptionsPlugin plugin = engine.optionsPlugin;
-    plugin.registerExtensionPoints((_) {});
-    try {
-      _TestOptionsProcessor processor = new _TestOptionsProcessor();
-      processor.expectedOptions = <String, Object>{
-        'analyzer': {
-          'language': {'enableSuperMixins': true}
-        },
-        'foo': {'bar': 'baz'},
-        'two': {'boo': 'newt'},
-      };
-      (plugin.optionsProcessorExtensionPoint as ExtensionPointImpl)
-          .add(processor);
-      AnalysisContext context = engine.createAnalysisContext();
-      AnalysisOptions options = builder.getAnalysisOptions(context, path);
-      _expectEqualOptions(options, expected);
-    } finally {
-      plugin.registerExtensionPoints((_) {});
-    }
+    AnalysisOptions options = builder.getAnalysisOptions(path);
+    _expectEqualOptions(options, expected);
   }
 
   void test_getAnalysisOptions_invalid() {
@@ -617,20 +607,8 @@
         pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
     resourceProvider.newFile(filePath, ';');
 
-    AnalysisEngine engine = AnalysisEngine.instance;
-    OptionsPlugin plugin = engine.optionsPlugin;
-    plugin.registerExtensionPoints((_) {});
-    try {
-      _TestOptionsProcessor processor = new _TestOptionsProcessor();
-      (plugin.optionsProcessorExtensionPoint as ExtensionPointImpl)
-          .add(processor);
-      AnalysisContext context = engine.createAnalysisContext();
-      AnalysisOptions options = builder.getAnalysisOptions(context, path);
-      expect(options, isNotNull);
-      expect(processor.errorCount, 1);
-    } finally {
-      plugin.registerExtensionPoints((_) {});
-    }
+    AnalysisOptions options = builder.getAnalysisOptions(path);
+    expect(options, isNotNull);
   }
 
   void test_getAnalysisOptions_noDefault_noOverrides() {
@@ -645,8 +623,7 @@
     - empty_constructor_bodies
 ''');
 
-    AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
-    AnalysisOptions options = builder.getAnalysisOptions(context, path);
+    AnalysisOptions options = builder.getAnalysisOptions(path);
     _expectEqualOptions(options, new AnalysisOptionsImpl());
   }
 
@@ -664,8 +641,7 @@
     enableSuperMixins : true
 ''');
 
-    AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
-    AnalysisOptions options = builder.getAnalysisOptions(context, path);
+    AnalysisOptions options = builder.getAnalysisOptions(path);
     _expectEqualOptions(options, expected);
   }
 
@@ -732,7 +708,6 @@
     expect(actual.analyzeFunctionBodiesPredicate,
         same(expected.analyzeFunctionBodiesPredicate));
     expect(actual.dart2jsHint, expected.dart2jsHint);
-    expect(actual.enableAssertMessage, expected.enableAssertMessage);
     expect(actual.enableLazyAssignmentOperators,
         expected.enableLazyAssignmentOperators);
     expect(actual.enableStrictCallChecks, expected.enableStrictCallChecks);
@@ -783,27 +758,3 @@
     expect(locator.embedderYamls, hasLength(1));
   }
 }
-
-class _TestOptionsProcessor implements OptionsProcessor {
-  Map<String, Object> expectedOptions = null;
-
-  int errorCount = 0;
-
-  @override
-  void onError(Exception exception) {
-    errorCount++;
-  }
-
-  @override
-  void optionsProcessed(AnalysisContext context, Map<String, Object> options) {
-    if (expectedOptions == null) {
-      fail('Unexpected invocation of optionsProcessed');
-    }
-    expect(options, hasLength(expectedOptions.length));
-    for (String key in expectedOptions.keys) {
-      expect(options.containsKey(key), isTrue, reason: 'missing key $key');
-      expect(options[key], expectedOptions[key],
-          reason: 'values for key $key do not match');
-    }
-  }
-}
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index b9d77b1..1f612b9 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -8,6 +8,7 @@
 import 'dart:collection';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/dart/element/visitor.dart';
@@ -2620,7 +2621,8 @@
     CompilationUnit compilationUnit =
         context.resolveCompilationUnit2(sourceA, sourceA);
     expect(compilationUnit, isNotNull);
-    LibraryElement library = compilationUnit.element.library;
+    LibraryElement library =
+        resolutionMap.elementDeclaredByCompilationUnit(compilationUnit).library;
     List<LibraryElement> importedLibraries = library.importedLibraries;
     assertNamedElements(importedLibraries, ["dart.core", "libB"]);
   }
@@ -2632,7 +2634,8 @@
     CompilationUnit compilationUnit =
         context.resolveCompilationUnit2(sourceA, sourceA);
     expect(compilationUnit, isNotNull);
-    LibraryElement library = compilationUnit.element.library;
+    LibraryElement library =
+        resolutionMap.elementDeclaredByCompilationUnit(compilationUnit).library;
     List<LibraryElement> importedLibraries = library.importedLibraries;
     assertNamedElements(importedLibraries, ["dart.core", "libB"]);
   }
@@ -4499,7 +4502,7 @@
     expect(context.getErrors(a).errors, hasLength(0));
     expect(context.getErrors(b).errors, hasLength(0));
     var unitA = context.getResolvedCompilationUnit2(a, a);
-    var unitElementA = unitA.element;
+    var unitElementA = resolutionMap.elementDeclaredByCompilationUnit(unitA);
     var libraryElementA = unitElementA.library;
     // Update a.dart, no declaration changes.
     context.setContents(
diff --git a/pkg/analyzer/test/src/context/mock_sdk.dart b/pkg/analyzer/test/src/context/mock_sdk.dart
index 464dec0..3f0f5dd3 100644
--- a/pkg/analyzer/test/src/context/mock_sdk.dart
+++ b/pkg/analyzer/test/src/context/mock_sdk.dart
@@ -43,15 +43,17 @@
 class Future<T> {
   factory Future(computation()) => null;
   factory Future.delayed(Duration duration, [T computation()]) => null;
-  factory Future.value([T value]) => null;
+  factory Future.value([value]) => null;
 
   static Future<List/*<T>*/> wait/*<T>*/(
       Iterable<Future/*<T>*/> futures) => null;
-  Future/*<R>*/ then/*<R>*/(onValue(T value)) => null;
+  Future/*<R>*/ then/*<R>*/(FutureOr/*<R>*/ onValue(T value)) => null;
 
   Future<T> whenComplete(action());
 }
 
+class FutureOr<T> {}
+
 abstract class Completer<T> {
   factory Completer() => new _AsyncCompleter<T>();
   factory Completer.sync() => new _SyncCompleter<T>();
@@ -64,9 +66,25 @@
     const <String, String>{
       '$sdkRoot/lib/async/stream.dart': r'''
 part of dart.async;
-class Stream<T> {
+abstract class Stream<T> {
   Future<T> get first;
+  StreamSubscription<T> listen(void onData(T event),
+                               { Function onError,
+                                 void onDone(),
+                                 bool cancelOnError});
 }
+
+abstract class StreamSubscription<T> {
+  Future cancel();
+  void onData(void handleData(T data));
+  void onError(Function handleError);
+  void onDone(void handleDone());
+  void pause([Future resumeSignal]);
+  void resume();
+  bool get isPaused;
+  Future<E> asFuture<E>([E futureValue]);
+}
+
 abstract class StreamTransformer<S, T> {}
 '''
     });
@@ -101,14 +119,23 @@
 import 'dart:async';
 
 class Object {
+  const Object() {}
   bool operator ==(other) => identical(this, other);
   String toString() => 'a string';
   int get hashCode => 0;
+  Type get runtimeType => null;
+  dynamic noSuchMethod(Invocation invocation) => null;
 }
 
 class Function {}
 class StackTrace {}
-class Symbol {}
+
+class Symbol {
+  const factory Symbol(String name) {
+    return null;
+  }
+}
+
 class Type {}
 
 abstract class Comparable<T> {
@@ -124,6 +151,7 @@
   bool get isNotEmpty => false;
   int get length => 0;
   String substring(int len) => null;
+  String toLowerCase();
   String toUpperCase();
   List<int> get codeUnits;
 }
@@ -131,7 +159,13 @@
   external factory RegExp(String source);
 }
 
-class bool extends Object {}
+class bool extends Object {
+  external const factory bool.fromEnvironment(String name,
+                                              {bool defaultValue: false});
+}
+
+abstract class Invocation {}
+
 abstract class num implements Comparable<num> {
   bool operator <(num other);
   bool operator <=(num other);
@@ -142,21 +176,33 @@
   num operator *(num other);
   num operator /(num other);
   int operator ^(int other);
-  int operator &(int other);
   int operator |(int other);
   int operator <<(int other);
   int operator >>(int other);
   int operator ~/(num other);
   num operator %(num other);
   int operator ~();
+  num operator -();
   int toInt();
   double toDouble();
   num abs();
   int round();
 }
 abstract class int extends num {
+  external const factory int.fromEnvironment(String name, {int defaultValue});
+
+  bool get isNegative;
   bool get isEven => false;
+
+  int operator &(int other);
+  int operator |(int other);
+  int operator ^(int other);
+  int operator ~();
+  int operator <<(int shiftAmount);
+  int operator >>(int shiftAmount);
+
   int operator -();
+
   external static int parse(String source,
                             { int radix,
                               int onError(String source) });
@@ -192,7 +238,12 @@
 }
 
 class DateTime extends Object {}
-class Null extends Object {}
+
+class Null extends Object {
+  factory Null._uninstantiable() {
+    throw new UnsupportedError('class Null cannot be instantiated');
+  }
+}
 
 class Deprecated extends Object {
   final String expires;
@@ -231,6 +282,7 @@
 
   bool get isEmpty => false;
   E get first => null;
+  E get last => null;
 
   Iterable/*<R>*/ map/*<R>*/(/*=R*/ f(E e)) => null;
 
@@ -240,9 +292,11 @@
 }
 
 class Map<K, V> extends Object {
-  Iterable<K> get keys => null;
   V operator [](K key) => null;
   void operator []=(K key, V value) {}
+  Iterable<K> get keys => null;
+  int get length;
+  Iterable<V> get values;
 }
 
 external bool identical(Object a, Object b);
@@ -279,8 +333,41 @@
     'dart:html',
     '$sdkRoot/lib/html/dartium/html_dartium.dart',
     '''
-library dart.html;
-class HtmlElement {}
+library dart.dom.html;
+
+final HtmlDocument document;
+
+abstract class Element {}
+
+abstract class HtmlDocument {
+  Element query(String relativeSelectors) => null;
+}
+
+abstract class HtmlElement extends Element {}
+
+abstract class AnchorElement extends HtmlElement {}
+abstract class BodyElement extends HtmlElement {}
+abstract class ButtonElement extends HtmlElement {}
+abstract class DivElement extends HtmlElement {}
+abstract class InputElement extends HtmlElement {}
+abstract class SelectElement extends HtmlElement {}
+
+
+abstract class CanvasElement extends HtmlElement {
+  Object getContext(String contextId, [Map attributes]);
+  CanvasRenderingContext2D get context2D;
+}
+
+abstract class class CanvasRenderingContext2D {}
+
+Element query(String relativeSelectors) => null;
+''');
+
+const _MockSdkLibrary _LIB_INTERCEPTORS = const _MockSdkLibrary(
+    'dart:_interceptors',
+    '$sdkRoot/lib/_internal/js_runtime/lib/interceptors.dart',
+    '''
+library dart._interceptors;
 ''');
 
 const _MockSdkLibrary _LIB_MATH = const _MockSdkLibrary(
@@ -293,8 +380,8 @@
 const double PI = 3.1415926535897932;
 const double LN10 =  2.302585092994046;
 
-num/*=T*/ min/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) => null;
-num/*=T*/ max/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) => null;
+T min<T extends num>(T a, T b) => null;
+T max<T extends num>(T a, T b) => null;
 
 external double cos(num x);
 external double sin(num x);
@@ -315,6 +402,7 @@
   _LIB_MATH,
   _LIB_HTML_DART2JS,
   _LIB_HTML_DARTIUM,
+  _LIB_INTERCEPTORS,
 ];
 
 class MockSdk implements DartSdk {
@@ -326,6 +414,8 @@
     "dart:collection": "$sdkRoot/lib/collection/collection.dart",
     "dart:convert": "$sdkRoot/lib/convert/convert.dart",
     "dart:_foreign_helper": "$sdkRoot/lib/_foreign_helper/_foreign_helper.dart",
+    "dart:_interceptors":
+        "$sdkRoot/lib/_internal/js_runtime/lib/interceptors.dart",
     "dart:math": "$sdkRoot/lib/math/math.dart"
   };
 
@@ -351,7 +441,9 @@
   PackageBundle _bundle;
 
   MockSdk(
-      {bool dartAsync: true, resource.MemoryResourceProvider resourceProvider})
+      {bool generateSummaryFiles: false,
+      bool dartAsync: true,
+      resource.MemoryResourceProvider resourceProvider})
       : provider = resourceProvider ?? new resource.MemoryResourceProvider(),
         sdkLibraries = dartAsync ? _LIBRARIES : [_LIB_CORE],
         uriMap = dartAsync ? FULL_URI_MAP : NO_ASYNC_URI_MAP {
@@ -365,6 +457,13 @@
         provider.convertPath(
             '$sdkRoot/lib/_internal/sdk_library_metadata/lib/libraries.dart'),
         librariesContent);
+    if (generateSummaryFiles) {
+      List<int> bytes = _computeLinkedBundleBytes();
+      provider.newFileWithBytes(
+          provider.convertPath('/lib/_internal/spec.sum'), bytes);
+      provider.newFileWithBytes(
+          provider.convertPath('/lib/_internal/strong.sum'), bytes);
+    }
   }
 
   @override
@@ -386,30 +485,29 @@
 
   @override
   Source fromFileUri(Uri uri) {
-    String filePath = uri.path;
-    String libPath = '$sdkRoot/lib';
-    if (!filePath.startsWith("$libPath/")) {
+    String filePath = provider.pathContext.fromUri(uri);
+    if (!filePath.startsWith(provider.convertPath('$sdkRoot/lib/'))) {
       return null;
     }
     for (SdkLibrary library in sdkLibraries) {
-      String libraryPath = library.path;
-      if (filePath.replaceAll('\\', '/') == libraryPath) {
+      String libraryPath = provider.convertPath(library.path);
+      if (filePath == libraryPath) {
         try {
-          resource.File file =
-              provider.getResource(provider.convertPath(filePath));
+          resource.File file = provider.getResource(filePath);
           Uri dartUri = Uri.parse(library.shortName);
           return file.createSource(dartUri);
         } catch (exception) {
           return null;
         }
       }
-      if (filePath.startsWith("$libraryPath/")) {
-        String pathInLibrary = filePath.substring(libraryPath.length + 1);
-        String path = '${library.shortName}/$pathInLibrary';
+      String libraryRootPath = provider.pathContext.dirname(libraryPath) +
+          provider.pathContext.separator;
+      if (filePath.startsWith(libraryRootPath)) {
+        String pathInLibrary = filePath.substring(libraryRootPath.length);
+        String uriStr = '${library.shortName}/$pathInLibrary';
         try {
-          resource.File file =
-              provider.getResource(provider.convertPath(filePath));
-          Uri dartUri = new Uri(scheme: 'dart', path: path);
+          resource.File file = provider.getResource(filePath);
+          Uri dartUri = Uri.parse(uriStr);
           return file.createSource(dartUri);
         } catch (exception) {
           return null;
@@ -422,12 +520,14 @@
   @override
   PackageBundle getLinkedBundle() {
     if (_bundle == null) {
-      List<Source> librarySources = sdkLibraries
-          .map((SdkLibrary library) => mapDartUri(library.shortName))
-          .toList();
-      List<int> bytes = new SummaryBuilder(
-              librarySources, context, context.analysisOptions.strongMode)
-          .build();
+      resource.File summaryFile =
+          provider.getFile(provider.convertPath('/lib/_internal/spec.sum'));
+      List<int> bytes;
+      if (summaryFile.exists) {
+        bytes = summaryFile.readAsBytesSync();
+      } else {
+        bytes = _computeLinkedBundleBytes();
+      }
       _bundle = new PackageBundle.fromBuffer(bytes);
     }
     return _bundle;
@@ -435,9 +535,11 @@
 
   @override
   SdkLibrary getSdkLibrary(String dartUri) {
-    // getSdkLibrary() is only used to determine whether a library is internal
-    // to the SDK.  The mock SDK doesn't have any internals, so it's safe to
-    // return null.
+    for (SdkLibrary library in _LIBRARIES) {
+      if (library.shortName == dartUri) {
+        return library;
+      }
+    }
     return null;
   }
 
@@ -467,6 +569,18 @@
     String newContent = updateContent(content);
     provider.updateFile(path, newContent);
   }
+
+  /**
+   * Compute the bytes of the linked bundle associated with this SDK.
+   */
+  List<int> _computeLinkedBundleBytes() {
+    List<Source> librarySources = sdkLibraries
+        .map((SdkLibrary library) => mapDartUri(library.shortName))
+        .toList();
+    return new SummaryBuilder(
+            librarySources, context, context.analysisOptions.strongMode)
+        .build();
+  }
 }
 
 class _MockSdkLibrary implements SdkLibrary {
@@ -491,16 +605,13 @@
   bool get isImplementation => throw new UnimplementedError();
 
   @override
-  bool get isInternal => throw new UnimplementedError();
+  bool get isInternal => shortName.startsWith('dart:_');
 
   @override
   bool get isShared => throw new UnimplementedError();
 
   @override
   bool get isVmLibrary => throw new UnimplementedError();
-
-  @override
-  List<String> getPatches(int platform) => const <String>[];
 }
 
 /**
diff --git a/pkg/analyzer/test/src/dart/analysis/base.dart b/pkg/analyzer/test/src/dart/analysis/base.dart
index bb716cf..11452bc 100644
--- a/pkg/analyzer/test/src/dart/analysis/base.dart
+++ b/pkg/analyzer/test/src/dart/analysis/base.dart
@@ -2,8 +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.
 
-import 'dart:async';
-
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/visitor.dart';
 import 'package:analyzer/file_system/file_system.dart';
@@ -14,6 +12,7 @@
 import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/dart/analysis/status.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
+import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:test/test.dart';
 
@@ -44,9 +43,8 @@
 typedef void _ElementVisitorFunction(Element element);
 
 class BaseAnalysisDriverTest {
-  static final MockSdk sdk = new MockSdk();
-
   final MemoryResourceProvider provider = new MemoryResourceProvider();
+  DartSdk sdk;
   final ByteStore byteStore = new MemoryByteStore();
   final FileContentOverlay contentOverlay = new FileContentOverlay();
 
@@ -55,7 +53,6 @@
 
   AnalysisDriverScheduler scheduler;
   AnalysisDriver driver;
-  final _Monitor idleStatusMonitor = new _Monitor();
   final List<AnalysisStatus> allStatuses = <AnalysisStatus>[];
   final List<AnalysisResult> allResults = <AnalysisResult>[];
 
@@ -102,7 +99,7 @@
   }
 
   void setUp() {
-    new MockSdk();
+    sdk = new MockSdk(resourceProvider: provider);
     testProject = _p('/test/lib');
     testFile = _p('/test/lib/test.dart');
     logger = new PerformanceLog(logBuffer);
@@ -113,6 +110,7 @@
         provider,
         byteStore,
         contentOverlay,
+        'test',
         new SourceFactory([
           new DartUriResolver(sdk),
           new PackageMapUriResolver(provider, <String, List<Folder>>{
@@ -122,12 +120,7 @@
         ], null, provider),
         new AnalysisOptionsImpl()..strongMode = true);
     scheduler.start();
-    driver.status.lastWhere((status) {
-      allStatuses.add(status);
-      if (status.isIdle) {
-        idleStatusMonitor.notify();
-      }
-    });
+    driver.status.listen(allStatuses.add);
     driver.results.listen(allResults.add);
   }
 
@@ -147,18 +140,3 @@
     super.visitElement(element);
   }
 }
-
-class _Monitor {
-  Completer<Null> _completer = new Completer<Null>();
-
-  Future<Null> get signal async {
-    await _completer.future;
-    _completer = new Completer<Null>();
-  }
-
-  void notify() {
-    if (!_completer.isCompleted) {
-      _completer.complete(null);
-    }
-  }
-}
diff --git a/pkg/analyzer/test/src/dart/analysis/byte_store_test.dart b/pkg/analyzer/test/src/dart/analysis/byte_store_test.dart
index 9da3f0b..484a99f 100644
--- a/pkg/analyzer/test/src/dart/analysis/byte_store_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/byte_store_test.dart
@@ -10,9 +10,14 @@
 main() {
   defineReflectiveSuite(() {
     defineReflectiveTests(MemoryCachingByteStoreTest);
+    defineReflectiveTests(NullByteStoreTest);
   });
 }
 
+List<int> _b(int length) {
+  return new List<int>(length);
+}
+
 @reflectiveTest
 class MemoryCachingByteStoreTest {
   test_get_notFound_evict() {
@@ -99,9 +104,17 @@
     expect(cachingStore.get('2'), isNull);
     expect(cachingStore.get('3'), hasLength(30));
   }
+}
 
-  static List<int> _b(int length) {
-    return new List<int>(length);
+@reflectiveTest
+class NullByteStoreTest {
+  test_get() {
+    var store = new NullByteStore();
+
+    expect(store.get('1'), isNull);
+
+    store.put('1', _b(10));
+    expect(store.get('1'), isNull);
   }
 }
 
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 6b4231e..30fc32e 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -8,7 +8,9 @@
 import 'dart:convert';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/memory_file_system.dart';
@@ -16,8 +18,10 @@
 import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/dart/analysis/status.dart';
+import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
 import 'package:analyzer/src/error/codes.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
+import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/summary/idl.dart';
 import 'package:convert/convert.dart';
@@ -51,9 +55,8 @@
 
 @reflectiveTest
 class AnalysisDriverSchedulerTest {
-  static final MockSdk sdk = new MockSdk();
-
   final MemoryResourceProvider provider = new MemoryResourceProvider();
+  DartSdk sdk;
   final ByteStore byteStore = new MemoryByteStore();
   final FileContentOverlay contentOverlay = new FileContentOverlay();
 
@@ -65,12 +68,14 @@
   List<AnalysisResult> allResults = [];
 
   AnalysisDriver newDriver() {
+    sdk = new MockSdk(resourceProvider: provider);
     AnalysisDriver driver = new AnalysisDriver(
         scheduler,
         logger,
         provider,
         byteStore,
         contentOverlay,
+        'test',
         new SourceFactory(
             [new DartUriResolver(sdk), new ResourceUriResolver(provider)],
             null,
@@ -81,6 +86,7 @@
   }
 
   void setUp() {
+    sdk = new MockSdk(resourceProvider: provider);
     logger = new PerformanceLog(logBuffer);
     scheduler = new AnalysisDriverScheduler(logger);
     scheduler.start();
@@ -213,6 +219,38 @@
     expect(allResults, hasLength(3));
   }
 
+  test_status_analyzingOnlyWhenHasFilesToAnalyze() async {
+    AnalysisDriver driver1 = newDriver();
+    AnalysisDriver driver2 = newDriver();
+
+    String a = _p('/a.dart');
+    String b = _p('/b.dart');
+    provider.newFile(a, 'class A {}');
+    provider.newFile(b, 'class B {}');
+    driver1.addFile(a);
+    driver2.addFile(b);
+
+    Monitor idleStatusMonitor = new Monitor();
+    List<AnalysisStatus> allStatuses = [];
+    scheduler.status.forEach((status) {
+      allStatuses.add(status);
+      if (status.isIdle) {
+        idleStatusMonitor.notify();
+      }
+    });
+
+    // The two added files were analyzed, and the schedule is idle.
+    await idleStatusMonitor.signal;
+    expect(allStatuses, hasLength(2));
+    expect(allStatuses[0].isAnalyzing, isTrue);
+    expect(allStatuses[1].isAnalyzing, isFalse);
+    allStatuses.clear();
+
+    // We don't transition to analysis and back to idle.
+    await driver1.getFilesReferencingName('X');
+    expect(allStatuses, isEmpty);
+  }
+
   String _p(String path) => provider.convertPath(path);
 }
 
@@ -231,6 +269,57 @@
     expect(driver.addedFiles, isNot(contains(b)));
   }
 
+  test_addFile_shouldRefresh() async {
+    var a = _p('/test/lib/a.dart');
+    var b = _p('/test/lib/b.dart');
+
+    provider.newFile(a, 'class A {}');
+    provider.newFile(
+        b,
+        r'''
+import 'a.dart';
+''');
+
+    driver.addFile(a);
+    driver.addFile(b);
+
+    void assertNumberOfErrorsInB(int n) {
+      var bResult = allResults.singleWhere((r) => r.path == b);
+      expect(bResult.errors, hasLength(n));
+      allResults.clear();
+    }
+
+    // Initial analysis, 'b' does not use 'a', so there is a hint.
+    await driver.waitForIdle();
+    assertNumberOfErrorsInB(1);
+
+    // Update 'b' to use 'a', no more hints.
+    provider.newFile(
+        b,
+        r'''
+import 'a.dart';
+main() {
+  print(A);
+}
+''');
+    driver.changeFile(b);
+    await driver.waitForIdle();
+    assertNumberOfErrorsInB(0);
+
+    // Change 'b' content so that it has a hint.
+    // Remove 'b' and add it again.
+    // The file 'b' must be refreshed, and the hint must be reported.
+    provider.newFile(
+        b,
+        r'''
+import 'a.dart';
+''');
+    driver.removeFile(b);
+    driver.addFile(b);
+    await driver.waitForIdle();
+    assertNumberOfErrorsInB(1);
+  }
+
   test_addFile_thenRemove() async {
     var a = _p('/test/lib/a.dart');
     var b = _p('/test/lib/b.dart');
@@ -242,13 +331,100 @@
     // Now remove 'a'.
     driver.removeFile(a);
 
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     // Only 'b' has been analyzed, because 'a' was removed before we started.
     expect(allResults, hasLength(1));
     expect(allResults[0].path, b);
   }
 
+  test_cachedPriorityResults() async {
+    var a = _p('/test/bin/a.dart');
+    provider.newFile(a, 'var a = 1;');
+
+    driver.priorityFiles = [a];
+
+    AnalysisResult result1 = await driver.getResult(a);
+    expect(driver.test.priorityResults, containsPair(a, result1));
+
+    AnalysisResult result2 = await driver.getResult(a);
+    expect(result2, same(result1));
+  }
+
+  test_cachedPriorityResults_flush_onAnyFileChange() async {
+    var a = _p('/test/bin/a.dart');
+    var b = _p('/test/bin/b.dart');
+    provider.newFile(a, 'var a = 1;');
+    provider.newFile(a, 'var b = 2;');
+
+    driver.priorityFiles = [a];
+
+    AnalysisResult result1 = await driver.getResult(a);
+    expect(driver.test.priorityResults, containsPair(a, result1));
+
+    // Change a file.
+    // The cache is flushed.
+    driver.changeFile(a);
+    expect(driver.test.priorityResults, isEmpty);
+    AnalysisResult result2 = await driver.getResult(a);
+    expect(driver.test.priorityResults, containsPair(a, result2));
+
+    // Add a file.
+    // The cache is flushed.
+    driver.addFile(b);
+    expect(driver.test.priorityResults, isEmpty);
+    AnalysisResult result3 = await driver.getResult(a);
+    expect(driver.test.priorityResults, containsPair(a, result3));
+
+    // Remove a file.
+    // The cache is flushed.
+    driver.removeFile(b);
+    expect(driver.test.priorityResults, isEmpty);
+  }
+
+  test_cachedPriorityResults_flush_onPrioritySetChange() async {
+    var a = _p('/test/bin/a.dart');
+    var b = _p('/test/bin/b.dart');
+    provider.newFile(a, 'var a = 1;');
+    provider.newFile(a, 'var b = 2;');
+
+    driver.priorityFiles = [a];
+
+    AnalysisResult result1 = await driver.getResult(a);
+    expect(driver.test.priorityResults, hasLength(1));
+    expect(driver.test.priorityResults, containsPair(a, result1));
+
+    // Make "a" and "b" priority.
+    // We still have the result for "a" cached.
+    driver.priorityFiles = [a, b];
+    expect(driver.test.priorityResults, hasLength(1));
+    expect(driver.test.priorityResults, containsPair(a, result1));
+
+    // Get the result for "b".
+    AnalysisResult result2 = await driver.getResult(b);
+    expect(driver.test.priorityResults, hasLength(2));
+    expect(driver.test.priorityResults, containsPair(a, result1));
+    expect(driver.test.priorityResults, containsPair(b, result2));
+
+    // Only "b" is priority.
+    // The result for "a" is flushed.
+    driver.priorityFiles = [b];
+    expect(driver.test.priorityResults, hasLength(1));
+    expect(driver.test.priorityResults, containsPair(b, result2));
+  }
+
+  test_cachedPriorityResults_notPriority() async {
+    var a = _p('/test/bin/a.dart');
+    provider.newFile(a, 'var a = 1;');
+
+    AnalysisResult result1 = await driver.getResult(a);
+    expect(driver.test.priorityResults, isEmpty);
+
+    // The file is not priority, so its result is not cached.
+    AnalysisResult result2 = await driver.getResult(a);
+    expect(result2, isNot(same(result1)));
+  }
+
   test_changeFile_implicitlyAnalyzed() async {
     var a = _p('/test/lib/a.dart');
     var b = _p('/test/lib/b.dart');
@@ -264,7 +440,7 @@
     driver.addFile(a);
 
     // We have a result only for "a".
-    await _waitForIdle();
+    await driver.waitForIdle();
     expect(allResults, hasLength(1));
     {
       AnalysisResult ar = allResults.firstWhere((r) => r.path == a);
@@ -276,9 +452,12 @@
     provider.updateFile(b, 'var B = 1.2;');
     driver.changeFile(b);
 
+    // "b" is not an added file, so it is not scheduled for analysis.
+    expect(driver.test.filesToAnalyze, isEmpty);
+
     // While "b" is not analyzed explicitly, it is analyzed implicitly.
     // The change causes "a" to be reanalyzed.
-    await _waitForIdle();
+    await driver.waitForIdle();
     expect(allResults, hasLength(1));
     {
       AnalysisResult ar = allResults.firstWhere((r) => r.path == a);
@@ -286,6 +465,28 @@
     }
   }
 
+  test_changeFile_notUsed() async {
+    var a = _p('/test/lib/a.dart');
+    var b = _p('/other/b.dart');
+    provider.newFile(a, '');
+    provider.newFile(b, 'class B1 {}');
+
+    driver.addFile(a);
+
+    await driver.waitForIdle();
+    allResults.clear();
+
+    // Change "b" and notify.
+    // Nothing depends on "b", so nothing is analyzed.
+    provider.updateFile(b, 'class B2 {}');
+    driver.changeFile(b);
+    await driver.waitForIdle();
+    expect(allResults, isEmpty);
+
+    // This should not add "b" to the file state.
+    expect(driver.fsState.knownFilePaths, isNot(contains(b)));
+  }
+
   test_changeFile_selfConsistent() async {
     var a = _p('/test/lib/a.dart');
     var b = _p('/test/lib/b.dart');
@@ -306,7 +507,7 @@
     driver.priorityFiles = [a, b];
     driver.addFile(a);
     driver.addFile(b);
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     // We have results for both "a" and "b".
     expect(allResults, hasLength(2));
@@ -333,7 +534,7 @@
 
     // We again get results for both "a" and "b".
     // The results are consistent.
-    await _waitForIdle();
+    await driver.waitForIdle();
     expect(allResults, hasLength(2));
     {
       AnalysisResult ar = allResults.firstWhere((r) => r.path == a);
@@ -351,7 +552,7 @@
 
     // Initial analysis.
     {
-      await _waitForIdle();
+      await driver.waitForIdle();
       expect(allResults, hasLength(1));
       AnalysisResult result = allResults[0];
       expect(result.path, testFile);
@@ -369,9 +570,12 @@
     // Notify the driver about the change.
     driver.changeFile(testFile);
 
+    // The file was added, so it is scheduled for analysis.
+    expect(driver.test.filesToAnalyze, contains(testFile));
+
     // We get a new result.
     {
-      await _waitForIdle();
+      await driver.waitForIdle();
       expect(allResults, hasLength(1));
       AnalysisResult result = allResults[0];
       expect(result.path, testFile);
@@ -379,6 +583,56 @@
     }
   }
 
+  test_errors_uriDoesNotExist_export() async {
+    addTestFile(r'''
+export 'foo.dart';
+''');
+
+    AnalysisResult result = await driver.getResult(testFile);
+    List<AnalysisError> errors = result.errors;
+    expect(errors, hasLength(1));
+    expect(errors[0].errorCode, CompileTimeErrorCode.URI_DOES_NOT_EXIST);
+  }
+
+  test_errors_uriDoesNotExist_import() async {
+    addTestFile(r'''
+import 'foo.dart';
+''');
+
+    AnalysisResult result = await driver.getResult(testFile);
+    List<AnalysisError> errors = result.errors;
+    expect(errors, hasLength(1));
+    expect(errors[0].errorCode, CompileTimeErrorCode.URI_DOES_NOT_EXIST);
+  }
+
+  test_errors_uriDoesNotExist_import_deferred() async {
+    addTestFile(
+        r'''
+import 'foo.dart' deferred as foo;
+main() {
+  foo.loadLibrary();
+}
+''',
+        priority: true);
+
+    AnalysisResult result = await driver.getResult(testFile);
+    List<AnalysisError> errors = result.errors;
+    expect(errors, hasLength(1));
+    expect(errors[0].errorCode, CompileTimeErrorCode.URI_DOES_NOT_EXIST);
+  }
+
+  test_errors_uriDoesNotExist_part() async {
+    addTestFile(r'''
+library lib;
+part 'foo.dart';
+''');
+
+    AnalysisResult result = await driver.getResult(testFile);
+    List<AnalysisError> errors = result.errors;
+    expect(errors, hasLength(1));
+    expect(errors[0].errorCode, CompileTimeErrorCode.URI_DOES_NOT_EXIST);
+  }
+
   test_getFilesReferencingName() async {
     var a = _p('/test/bin/a.dart');
     var b = _p('/test/bin/b.dart');
@@ -389,7 +643,7 @@
     provider.newFile(a, 'class A {}');
     provider.newFile(b, "import 'a.dart'; A a;");
     provider.newFile(c, "import 'a.dart'; var a = new A();");
-    provider.newFile(d, "classs A{} A a;");
+    provider.newFile(d, "class A{} A a;");
     provider.newFile(e, "import 'a.dart'; main() {}");
 
     driver.addFile(a);
@@ -419,15 +673,8 @@
 ''';
     addTestFile(content);
 
-    IndexResult result = await driver.getIndex(testFile);
+    AnalysisDriverUnitIndex index = await driver.getIndex(testFile);
 
-    CompilationUnitElement unitElement = result.unitElement;
-    expect(unitElement, isNotNull);
-    expect(unitElement.source.fullName, testFile);
-    expect(unitElement.functions.map((c) => c.name),
-        unorderedEquals(['foo', 'main']));
-
-    AnalysisDriverUnitIndex index = result.index;
     int unitId = index.strings.indexOf('package:test/test.dart');
     int fooId = index.strings.indexOf('foo');
     expect(unitId, isNonNegative);
@@ -441,6 +688,7 @@
     AnalysisResult result = await driver.getResult(testFile);
     expect(result.path, testFile);
     expect(result.uri.toString(), 'package:test/test.dart');
+    expect(result.exists, isTrue);
     expect(result.content, content);
     expect(result.contentHash, _md5(content));
     expect(result.unit, isNotNull);
@@ -451,7 +699,7 @@
     expect(f.returnType.type.toString(), 'int');
 
     // The same result is also received through the stream.
-    await _waitForIdle();
+    await driver.waitForIdle();
     expect(allResults, [result]);
   }
 
@@ -470,12 +718,22 @@
 ''');
     driver.addFile(a);
     driver.addFile(b);
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     AnalysisResult result = await driver.getResult(b);
     expect(result.errors, isEmpty);
   }
 
+  test_getResult_doesNotExist() async {
+    var a = _p('/test/lib/a.dart');
+
+    AnalysisResult result = await driver.getResult(a);
+    expect(result.path, a);
+    expect(result.uri.toString(), 'package:test/a.dart');
+    expect(result.exists, isFalse);
+    expect(result.content, '');
+  }
+
   test_getResult_errors() async {
     String content = 'main() { int vv; }';
     addTestFile(content, priority: true);
@@ -493,6 +751,23 @@
     }
   }
 
+  test_getResult_fileContentOverlay_throughAnalysisContext() async {
+    var a = _p('/test/bin/a.dart');
+    var b = _p('/test/bin/b.dart');
+
+    provider.newFile(a, 'import "b.dart";');
+    provider.newFile(b, 'var v = 1;');
+    contentOverlay[b] = 'var v = 2;';
+
+    var result = await driver.getResult(a);
+
+    // The content that was set into the overlay for "b" should be visible
+    // through the AnalysisContext that was used to analyze "a".
+    CompilationUnitElement unitA = result.unit.element;
+    Source sourceB = unitA.library.imports[0].importedLibrary.source;
+    expect(unitA.context.getContents(sourceB).data, 'var v = 2;');
+  }
+
   test_getResult_inferTypes_finalField() async {
     addTestFile(
         r'''
@@ -501,7 +776,7 @@
 }
 ''',
         priority: true);
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     AnalysisResult result = await driver.getResult(testFile);
     expect(_getClassFieldType(result.unit, 'C', 'f'), 'int');
@@ -518,13 +793,30 @@
 }
 ''',
         priority: true);
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     AnalysisResult result = await driver.getResult(testFile);
     expect(_getClassMethodReturnType(result.unit, 'A', 'm'), 'int');
     expect(_getClassMethodReturnType(result.unit, 'B', 'm'), 'int');
   }
 
+  test_getResult_invalid_annotation_functionAsConstructor() async {
+    addTestFile(
+        r'''
+fff() {}
+
+@fff()
+class C {}
+''',
+        priority: true);
+
+    AnalysisResult result = await driver.getResult(testFile);
+    ClassDeclaration c = result.unit.declarations[1] as ClassDeclaration;
+    Annotation a = c.metadata[0];
+    expect(a.name.name, 'fff');
+    expect(a.name.staticElement, new isInstanceOf<FunctionElement>());
+  }
+
   test_getResult_invalidUri_exports_dart() async {
     String content = r'''
 export 'dart:async';
@@ -536,7 +828,10 @@
     AnalysisResult result = await driver.getResult(testFile);
     expect(result.path, testFile);
     // Has only exports for valid URIs.
-    List<ExportElement> imports = result.unit.element.library.exports;
+    List<ExportElement> imports = resolutionMap
+        .elementDeclaredByCompilationUnit(result.unit)
+        .library
+        .exports;
     expect(
         imports.map((import) => import.exportedLibrary.source.uri.toString()),
         unorderedEquals(['dart:async', 'dart:math']));
@@ -553,7 +848,10 @@
     AnalysisResult result = await driver.getResult(testFile);
     expect(result.path, testFile);
     // Has only imports for valid URIs.
-    List<ImportElement> imports = result.unit.element.library.imports;
+    List<ImportElement> imports = resolutionMap
+        .elementDeclaredByCompilationUnit(result.unit)
+        .library
+        .imports;
     expect(
         imports.map((import) => import.importedLibrary.source.uri.toString()),
         unorderedEquals(['dart:async', 'dart:math', 'dart:core']));
@@ -588,6 +886,11 @@
 String z = "string";
 ''');
 
+    driver.addFile(a);
+    driver.addFile(b);
+    driver.addFile(c);
+    driver.addFile(d);
+
     // Analysis of my_pkg/bin/a.dart produces no error because
     // file:///my_pkg/bin/a.dart imports package:my_pkg/c.dart, and
     // package:my_pkg/c.dart's import is erroneous, causing y's reference to z
@@ -610,12 +913,21 @@
     }
   }
 
+  test_getResult_noErrors_ifNotAdded() async {
+    var a = _p('/test/lib/a.dart');
+    provider.newFile(a, 'A a = null;');
+
+    AnalysisResult result = await driver.getResult(a);
+    expect(result.errors, isEmpty);
+  }
+
   test_getResult_notDartFile() async {
     var path = _p('/test/lib/test.txt');
-    provider.newFile(path, 'foo bar');
+    provider.newFile(path, 'class A {}');
 
     AnalysisResult result = await driver.getResult(path);
-    expect(result, isNull);
+    expect(result, isNotNull);
+    expect(result.unit.element.types.map((e) => e.name), ['A']);
   }
 
   test_getResult_sameFile_twoUris() async {
@@ -638,7 +950,7 @@
 
     driver.addFile(a);
     driver.addFile(b);
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     {
       AnalysisResult result = await driver.getResult(b);
@@ -674,7 +986,7 @@
 
     driver.addFile(a);
     driver.addFile(b);
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     {
       AnalysisResult result = await driver.getResult(a);
@@ -733,27 +1045,263 @@
     expect(result1.unit, isNotNull);
   }
 
-  test_knownFiles() async {
+  test_getTopLevelNameDeclarations() async {
+    var a = _p('/test/lib/a.dart');
+    var b = _p('/test/lib/b.dart');
+    var c = _p('/test/lib/c.dart');
+    var d = _p('/test/lib/d.dart');
+
+    provider.newFile(a, 'class A {}');
+    provider.newFile(b, 'export "a.dart", class B {}');
+    provider.newFile(c, 'import "d.dart"; class C {}');
+    provider.newFile(d, 'class D {}');
+
+    driver.addFile(a);
+    driver.addFile(b);
+    driver.addFile(c);
+    // Don't add d.dart, it is referenced implicitly.
+
+    _assertTopLevelDeclarations(
+        await driver.getTopLevelNameDeclarations('A'), [a, b], [false, true]);
+
+    _assertTopLevelDeclarations(
+        await driver.getTopLevelNameDeclarations('B'), [b], [false]);
+
+    _assertTopLevelDeclarations(
+        await driver.getTopLevelNameDeclarations('C'), [c], [false]);
+
+    _assertTopLevelDeclarations(
+        await driver.getTopLevelNameDeclarations('D'), [d], [false]);
+
+    _assertTopLevelDeclarations(
+        await driver.getTopLevelNameDeclarations('X'), [], []);
+  }
+
+  test_getTopLevelNameDeclarations_parts() async {
+    var a = _p('/test/lib/a.dart');
+    var b = _p('/test/lib/b.dart');
+    var c = _p('/test/lib/c.dart');
+
+    provider.newFile(
+        a,
+        r'''
+library lib;
+part 'b.dart';
+part 'c.dart';
+class A {}
+''');
+    provider.newFile(b, 'part of lib; class B {}');
+    provider.newFile(c, 'part of lib; class C {}');
+
+    driver.addFile(a);
+    driver.addFile(b);
+    driver.addFile(c);
+
+    _assertTopLevelDeclarations(
+        await driver.getTopLevelNameDeclarations('A'), [a], [false]);
+
+    _assertTopLevelDeclarations(
+        await driver.getTopLevelNameDeclarations('B'), [a], [false]);
+
+    _assertTopLevelDeclarations(
+        await driver.getTopLevelNameDeclarations('C'), [a], [false]);
+
+    _assertTopLevelDeclarations(
+        await driver.getTopLevelNameDeclarations('X'), [], []);
+  }
+
+  test_getUnitElement() async {
+    String content = r'''
+foo(int p) {}
+main() {
+  foo(42);
+}
+''';
+    addTestFile(content);
+
+    CompilationUnitElement unitElement = await driver.getUnitElement(testFile);
+    expect(unitElement, isNotNull);
+    expect(unitElement.source.fullName, testFile);
+    expect(unitElement.functions.map((c) => c.name),
+        unorderedEquals(['foo', 'main']));
+  }
+
+  test_getUnitElement_notDart() async {
+    var path = _p('/test.txt');
+    provider.newFile(path, 'class A {}');
+    CompilationUnitElement unit = await driver.getUnitElement(path);
+    expect(unit, isNotNull);
+    expect(unit.types.map((e) => e.name), ['A']);
+  }
+
+  test_hasFilesToAnalyze() async {
+    // No files yet, nothing to analyze.
+    expect(driver.hasFilesToAnalyze, isFalse);
+
+    // Add a new file, it should be analyzed.
+    addTestFile('main() {}', priority: false);
+    expect(driver.hasFilesToAnalyze, isTrue);
+
+    // Wait for idle, nothing to do.
+    await driver.waitForIdle();
+    expect(driver.hasFilesToAnalyze, isFalse);
+
+    // Ask to analyze the file, so there is a file to analyze.
+    Future<AnalysisResult> future = driver.getResult(testFile);
+    expect(driver.hasFilesToAnalyze, isTrue);
+
+    // Once analysis is done, there is nothing to analyze.
+    await future;
+    expect(driver.hasFilesToAnalyze, isFalse);
+
+    // Change a file, even if not added, it still might affect analysis.
+    driver.changeFile(_p('/not/added.dart'));
+    expect(driver.hasFilesToAnalyze, isTrue);
+    await driver.waitForIdle();
+    expect(driver.hasFilesToAnalyze, isFalse);
+
+    // Request of referenced names is not analysis of a file.
+    driver.getFilesReferencingName('X');
+    expect(driver.hasFilesToAnalyze, isFalse);
+  }
+
+  test_hermetic_modifyLibraryFile_resolvePart() async {
     var a = _p('/test/lib/a.dart');
     var b = _p('/test/lib/b.dart');
 
     provider.newFile(
         a,
         r'''
-import 'b.dart';
+library a;
+part 'b.dart';
+class C {
+  int foo;
+}
+''');
+    provider.newFile(
+        b,
+        r'''
+part of a;
+var c = new C();
 ''');
 
     driver.addFile(a);
-    await _waitForIdle();
+    driver.addFile(b);
+
+    await driver.getResult(b);
+
+    // Modify the library, but don't notify the driver.
+    // The driver should use the previous library content and elements.
+    provider.newFile(
+        a,
+        r'''
+library a;
+part 'b.dart';
+class C {
+  int bar;
+}
+''');
+
+    var result = await driver.getResult(b);
+    var c = _getTopLevelVar(result.unit, 'c');
+    var typeC = c.element.type as InterfaceType;
+    // The class C has an old field 'foo', not the new 'bar'.
+    expect(typeC.element.getField('foo'), isNotNull);
+    expect(typeC.element.getField('bar'), isNull);
+  }
+
+  test_hermetic_overlayOnly_part() async {
+    var a = _p('/test/lib/a.dart');
+    var b = _p('/test/lib/b.dart');
+    contentOverlay[a] = r'''
+library a;
+part 'b.dart';
+class A {}
+var b = new B();
+''';
+    contentOverlay[b] = 'part of a; class B {}';
+
+    driver.addFile(a);
+    driver.addFile(b);
+
+    AnalysisResult result = await driver.getResult(a);
+    expect(result.errors, isEmpty);
+    expect(_getTopLevelVarType(result.unit, 'b'), 'B');
+  }
+
+  test_knownFiles() async {
+    var a = _p('/test/lib/a.dart');
+    var b = _p('/test/lib/b.dart');
+    var c = _p('/test/lib/c.dart');
+
+    provider.newFile(
+        a,
+        r'''
+import 'b.dart';
+''');
+    provider.newFile(b, '');
+    provider.newFile(c, '');
+
+    driver.addFile(a);
+    driver.addFile(c);
+    await driver.waitForIdle();
 
     expect(driver.knownFiles, contains(a));
     expect(driver.knownFiles, contains(b));
+    expect(driver.knownFiles, contains(c));
 
+    // Remove a.dart and analyze.
+    // Both a.dart and b.dart are not known now.
     driver.removeFile(a);
+    await driver.waitForIdle();
+    expect(driver.knownFiles, isNot(contains(a)));
+    expect(driver.knownFiles, isNot(contains(b)));
+    expect(driver.knownFiles, contains(c));
+  }
 
-    // a.dart was removed, but we don't clean up the file state state yet.
-    expect(driver.knownFiles, contains(a));
-    expect(driver.knownFiles, contains(b));
+  test_knownFiles_beforeAnalysis() async {
+    var a = _p('/test/lib/a.dart');
+    var b = _p('/test/lib/b.dart');
+
+    provider.newFile(a, '');
+
+    // 'a.dart' is added, but not processed yet.
+    // So, the set of known files is empty yet.
+    driver.addFile(a);
+    expect(driver.knownFiles, isEmpty);
+
+    // Remove 'a.dart'.
+    // It has been no analysis yet, so 'a.dart' is not in the file state, only
+    // in 'added' files. So, it disappears when removed.
+    driver.removeFile(a);
+    expect(driver.knownFiles, isNot(contains(a)));
+    expect(driver.knownFiles, isNot(contains(b)));
+  }
+
+  test_parseFile_notDart() async {
+    var p = _p('/test/bin/a.txt');
+    provider.newFile(p, 'class A {}');
+
+    ParseResult parseResult = await driver.parseFile(p);
+    expect(parseResult, isNotNull);
+    expect(driver.knownFiles, contains(p));
+  }
+
+  test_parseFile_shouldRefresh() async {
+    var p = _p('/test/bin/a.dart');
+
+    provider.newFile(p, 'class A {}');
+    driver.addFile(p);
+
+    // Get the result, so force the file reading.
+    await driver.getResult(p);
+
+    // Update the file.
+    provider.newFile(p, 'class A2 {}');
+
+    ParseResult parseResult = await driver.parseFile(p);
+    var clazz = parseResult.unit.declarations[0] as ClassDeclaration;
+    expect(clazz.name.name, 'A2');
   }
 
   test_part_getResult_afterLibrary() async {
@@ -883,7 +1431,7 @@
     driver.addFile(c);
 
     {
-      await _waitForIdle();
+      await driver.waitForIdle();
 
       // c.dart was added after a.dart, so it is analyzed after a.dart,
       // so we know that a.dart is the library of c.dart, so no errors.
@@ -896,7 +1444,7 @@
     {
       provider.updateFile(a, '// does not use c.dart anymore');
       driver.changeFile(a);
-      await _waitForIdle();
+      await driver.waitForIdle();
 
       // Now c.dart does not have a library context, so A and B cannot be
       // resolved, so there are errors.
@@ -934,7 +1482,7 @@
     driver.addFile(a);
     driver.addFile(b);
 
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     // c.dart was added before a.dart, so we attempt to analyze it before
     // a.dart, but we cannot find the library for it, so we delay analysis
@@ -958,7 +1506,7 @@
 
     driver.addFile(c);
 
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     // There is no library which c.dart is a part of, so it has unresolved
     // A and B references.
@@ -996,7 +1544,7 @@
     driver.addFile(a);
     driver.addFile(b);
 
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     // c.dart was added before a.dart, so we attempt to analyze it before
     // a.dart, but we cannot find the library for it, so we delay analysis
@@ -1023,7 +1571,7 @@
     driver.addFile(b);
 
     // We have results for both "a" and "b".
-    await _waitForIdle();
+    await driver.waitForIdle();
     expect(allResults, hasLength(2));
     {
       AnalysisResult ar = allResults.firstWhere((r) => r.path == a);
@@ -1043,7 +1591,7 @@
     // While "b" is not analyzed explicitly, it is analyzed implicitly.
     // We don't get a result for "b".
     // But the change causes "a" to be reanalyzed.
-    await _waitForIdle();
+    await driver.waitForIdle();
     expect(allResults, hasLength(1));
     {
       AnalysisResult ar = allResults.firstWhere((r) => r.path == a);
@@ -1055,7 +1603,7 @@
     addTestFile('main() {}');
 
     // We have a result.
-    await _waitForIdle();
+    await driver.waitForIdle();
     expect(allResults, hasLength(1));
     expect(allResults[0].path, testFile);
     allResults.clear();
@@ -1066,15 +1614,38 @@
     driver.removeFile(testFile);
     driver.changeFile(testFile);
 
-    await _waitForIdle();
+    await driver.waitForIdle();
     expect(allResults, isEmpty);
   }
 
+  test_removeFile_invalidate_importers() async {
+    var a = _p('/test/lib/a.dart');
+    var b = _p('/test/lib/b.dart');
+
+    provider.newFile(a, 'class A {}');
+    provider.newFile(b, "import 'a.dart';  var a = new A();");
+
+    driver.addFile(a);
+    driver.addFile(b);
+    await driver.waitForIdle();
+
+    // b.dart s clean.
+    expect(allResults.singleWhere((r) => r.path == b).errors, isEmpty);
+    allResults.clear();
+
+    // Remove a.dart, now b.dart should be reanalyzed and has an error.
+    provider.deleteFile(a);
+    driver.removeFile(a);
+    await driver.waitForIdle();
+    expect(allResults.singleWhere((r) => r.path == b).errors, hasLength(2));
+    allResults.clear();
+  }
+
   test_results_priority() async {
     String content = 'int f() => 42;';
     addTestFile(content, priority: true);
 
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     expect(allResults, hasLength(1));
     AnalysisResult result = allResults.single;
@@ -1102,7 +1673,7 @@
     driver.addFile(b);
     driver.addFile(c);
     driver.priorityFiles = [b];
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     expect(allResults, hasLength(3));
     AnalysisResult result = allResults[0];
@@ -1114,7 +1685,7 @@
   test_results_regular() async {
     String content = 'int f() => 42;';
     addTestFile(content);
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     expect(allResults, hasLength(1));
     AnalysisResult result = allResults.single;
@@ -1128,7 +1699,7 @@
 
   test_results_status() async {
     addTestFile('int f() => 42;');
-    await _waitForIdle();
+    await driver.waitForIdle();
 
     expect(allStatuses, hasLength(2));
     expect(allStatuses[0].isAnalyzing, isTrue);
@@ -1137,6 +1708,34 @@
     expect(allStatuses[1].isIdle, isTrue);
   }
 
+  test_waitForIdle() async {
+    // With no analysis to do, driver.waitForIdle should complete immediately.
+    await driver.waitForIdle();
+    // Now schedule some analysis.
+    addTestFile('int f() => 42;');
+    expect(allResults, isEmpty);
+    // driver.waitForIdle should wait for the analysis.
+    await driver.waitForIdle();
+    expect(allResults, hasLength(1));
+    // Make sure there is no more analysis pending.
+    await driver.waitForIdle();
+    expect(allResults, hasLength(1));
+  }
+
+  void _assertTopLevelDeclarations(
+      List<TopLevelDeclarationInSource> declarations,
+      List<String> expectedFiles,
+      List<bool> expectedIsExported) {
+    expect(expectedFiles, hasLength(expectedIsExported.length));
+    for (int i = 0; i < expectedFiles.length; i++) {
+      expect(declarations,
+          contains(predicate((TopLevelDeclarationInSource declaration) {
+        return declaration.source.fullName == expectedFiles[i] &&
+            declaration.isExported == expectedIsExported[i];
+      })));
+    }
+  }
+
   ClassDeclaration _getClass(CompilationUnit unit, String name) {
     for (CompilationUnitMember declaration in unit.declarations) {
       if (declaration is ClassDeclaration) {
@@ -1167,7 +1766,11 @@
 
   String _getClassFieldType(
       CompilationUnit unit, String className, String fieldName) {
-    return _getClassField(unit, className, fieldName).element.type.toString();
+    return resolutionMap
+        .elementDeclaredByVariableDeclaration(
+            _getClassField(unit, className, fieldName))
+        .type
+        .toString();
   }
 
   MethodDeclaration _getClassMethod(
@@ -1186,8 +1789,9 @@
 
   String _getClassMethodReturnType(
       CompilationUnit unit, String className, String fieldName) {
-    return _getClassMethod(unit, className, fieldName)
-        .element
+    return resolutionMap
+        .elementDeclaredByMethodDeclaration(
+            _getClassMethod(unit, className, fieldName))
         .type
         .returnType
         .toString();
@@ -1217,7 +1821,10 @@
   }
 
   String _getTopLevelVarType(CompilationUnit unit, String name) {
-    return _getTopLevelVar(unit, name).element.type.toString();
+    return resolutionMap
+        .elementDeclaredByVariableDeclaration(_getTopLevelVar(unit, name))
+        .type
+        .toString();
   }
 
   /**
@@ -1225,10 +1832,6 @@
    */
   String _p(String path) => provider.convertPath(path);
 
-  Future<Null> _waitForIdle() async {
-    await idleStatusMonitor.signal;
-  }
-
   static String _md5(String content) {
     return hex.encode(md5.convert(UTF8.encode(content)).bytes);
   }
diff --git a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
index a97f9c3..79323c1 100644
--- a/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/file_state_test.dart
@@ -11,6 +11,7 @@
 import 'package:analyzer/src/dart/analysis/byte_store.dart';
 import 'package:analyzer/src/dart/analysis/driver.dart' show PerformanceLog;
 import 'package:analyzer/src/dart/analysis/file_state.dart';
+import 'package:analyzer/src/dart/analysis/top_level_declaration.dart';
 import 'package:analyzer/src/generated/engine.dart'
     show AnalysisOptions, AnalysisOptionsImpl;
 import 'package:analyzer/src/generated/source.dart';
@@ -19,6 +20,7 @@
 import 'package:crypto/crypto.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
+import 'package:typed_mock/typed_mock.dart';
 
 import '../../context/mock_sdk.dart';
 
@@ -30,21 +32,25 @@
 
 @reflectiveTest
 class FileSystemStateTest {
-  static final MockSdk sdk = new MockSdk();
-
   final MemoryResourceProvider provider = new MemoryResourceProvider();
+  MockSdk sdk;
+
   final ByteStore byteStore = new MemoryByteStore();
   final FileContentOverlay contentOverlay = new FileContentOverlay();
 
   final StringBuffer logBuffer = new StringBuffer();
+  final UriResolver generatedUriResolver = new _GeneratedUriResolverMock();
+  SourceFactory sourceFactory;
   PerformanceLog logger;
 
   FileSystemState fileSystemState;
 
   void setUp() {
     logger = new PerformanceLog(logBuffer);
-    SourceFactory sourceFactory = new SourceFactory([
+    sdk = new MockSdk(resourceProvider: provider);
+    sourceFactory = new SourceFactory([
       new DartUriResolver(sdk),
+      generatedUriResolver,
       new PackageMapUriResolver(provider, <String, List<Folder>>{
         'aaa': [provider.getFolder(_p('/aaa/lib'))],
         'bbb': [provider.getFolder(_p('/bbb/lib'))],
@@ -54,7 +60,202 @@
     AnalysisOptions analysisOptions = new AnalysisOptionsImpl()
       ..strongMode = true;
     fileSystemState = new FileSystemState(logger, byteStore, contentOverlay,
-        provider, sourceFactory, analysisOptions, new Uint32List(0), '');
+        provider, sourceFactory, analysisOptions, new Uint32List(0));
+  }
+
+  test_exportedTopLevelDeclarations_export() {
+    String a = _p('/aaa/lib/a.dart');
+    String b = _p('/aaa/lib/b.dart');
+    provider.newFile(
+        a,
+        r'''
+class A {}
+''');
+    provider.newFile(
+        b,
+        r'''
+export 'a.dart';
+class B {}
+''');
+    FileState file = fileSystemState.getFileForPath(b);
+    Map<String, TopLevelDeclaration> declarations =
+        file.exportedTopLevelDeclarations;
+    expect(declarations.keys, unorderedEquals(['A', 'B']));
+  }
+
+  test_exportedTopLevelDeclarations_export2_show() {
+    String a = _p('/aaa/lib/a.dart');
+    String b = _p('/aaa/lib/b.dart');
+    String c = _p('/aaa/lib/c.dart');
+    provider.newFile(
+        a,
+        r'''
+class A1 {}
+class A2 {}
+class A3 {}
+''');
+    provider.newFile(
+        b,
+        r'''
+export 'a.dart' show A1, A2;
+class B1 {}
+class B2 {}
+''');
+    provider.newFile(
+        c,
+        r'''
+export 'b.dart' show A2, A3, B1;
+class C {}
+''');
+    _assertExportedTopLevelDeclarations(c, ['A2', 'B1', 'C']);
+  }
+
+  test_exportedTopLevelDeclarations_export_flushOnChange() {
+    String a = _p('/aaa/lib/a.dart');
+    String b = _p('/aaa/lib/b.dart');
+    provider.newFile(
+        a,
+        r'''
+class A {}
+''');
+    provider.newFile(
+        b,
+        r'''
+export 'a.dart';
+class B {}
+''');
+
+    // Initial exported declarations.
+    _assertExportedTopLevelDeclarations(b, ['A', 'B']);
+
+    // Update a.dart, so a.dart and b.dart exported declarations are flushed.
+    provider.newFile(a, 'class A {} class A2 {}');
+    fileSystemState.getFileForPath(a).refresh();
+    _assertExportedTopLevelDeclarations(b, ['A', 'A2', 'B']);
+  }
+
+  test_exportedTopLevelDeclarations_export_hide() {
+    String a = _p('/aaa/lib/a.dart');
+    String b = _p('/aaa/lib/b.dart');
+    provider.newFile(
+        a,
+        r'''
+class A1 {}
+class A2 {}
+class A3 {}
+''');
+    provider.newFile(
+        b,
+        r'''
+export 'a.dart' hide A2;
+class B {}
+''');
+    _assertExportedTopLevelDeclarations(b, ['A1', 'A3', 'B']);
+  }
+
+  test_exportedTopLevelDeclarations_export_preferLocal() {
+    String a = _p('/aaa/lib/a.dart');
+    String b = _p('/aaa/lib/b.dart');
+    provider.newFile(
+        a,
+        r'''
+class V {}
+''');
+    provider.newFile(
+        b,
+        r'''
+export 'a.dart';
+int V;
+''');
+    FileState file = fileSystemState.getFileForPath(b);
+    Map<String, TopLevelDeclaration> declarations =
+        file.exportedTopLevelDeclarations;
+    expect(declarations.keys, unorderedEquals(['V']));
+    expect(declarations['V'].kind, TopLevelDeclarationKind.variable);
+  }
+
+  test_exportedTopLevelDeclarations_export_show() {
+    String a = _p('/aaa/lib/a.dart');
+    String b = _p('/aaa/lib/b.dart');
+    provider.newFile(
+        a,
+        r'''
+class A1 {}
+class A2 {}
+''');
+    provider.newFile(
+        b,
+        r'''
+export 'a.dart' show A2;
+class B {}
+''');
+    _assertExportedTopLevelDeclarations(b, ['A2', 'B']);
+  }
+
+  test_exportedTopLevelDeclarations_export_show2() {
+    String a = _p('/aaa/lib/a.dart');
+    String b = _p('/aaa/lib/b.dart');
+    String c = _p('/aaa/lib/c.dart');
+    String d = _p('/aaa/lib/d.dart');
+    provider.newFile(
+        a,
+        r'''
+export 'b.dart' show Foo;
+export 'c.dart' show Bar;
+''');
+    provider.newFile(
+        b,
+        r'''
+export 'd.dart';
+''');
+    provider.newFile(
+        c,
+        r'''
+export 'd.dart';
+''');
+    provider.newFile(
+        d,
+        r'''
+class Foo {}
+class Bar {}
+''');
+    _assertExportedTopLevelDeclarations(a, ['Foo', 'Bar']);
+  }
+
+  test_exportedTopLevelDeclarations_import() {
+    String a = _p('/aaa/lib/a.dart');
+    String b = _p('/aaa/lib/b.dart');
+    provider.newFile(
+        a,
+        r'''
+class A {}
+''');
+    provider.newFile(
+        b,
+        r'''
+import 'a.dart';
+class B {}
+''');
+    _assertExportedTopLevelDeclarations(b, ['B']);
+  }
+
+  test_exportedTopLevelDeclarations_parts() {
+    String a = _p('/aaa/lib/a.dart');
+    String a2 = _p('/aaa/lib/a2.dart');
+    provider.newFile(
+        a,
+        r'''
+library lib;
+part 'a2.dart';
+class A1 {}
+''');
+    provider.newFile(
+        a2,
+        r'''
+part of lib;
+class A2 {}
+''');
+    _assertExportedTopLevelDeclarations(a, ['A1', 'A2']);
   }
 
   test_getFileForPath_doesNotExist() {
@@ -64,16 +265,39 @@
     expect(file.uri, FastUri.parse('package:aaa/a.dart'));
     expect(file.content, '');
     expect(file.contentHash, _md5(''));
-    expect(file.importedFiles, isEmpty);
+    expect(_excludeSdk(file.importedFiles), isEmpty);
     expect(file.exportedFiles, isEmpty);
     expect(file.partedFiles, isEmpty);
-    expect(file.directReferencedFiles, isEmpty);
+    expect(_excludeSdk(file.directReferencedFiles), isEmpty);
     expect(file.isPart, isFalse);
     expect(file.library, isNull);
     expect(file.unlinked, isNotNull);
     expect(file.unlinked.classes, isEmpty);
   }
 
+  test_getFileForPath_generatedFile() {
+    Uri uri = Uri.parse('package:aaa/foo.dart');
+    String templatePath = _p('/aaa/lib/foo.dart');
+    String generatedPath = _p('/generated/aaa/lib/foo.dart');
+
+    Source generatedSource = new _SourceMock();
+    when(generatedSource.fullName).thenReturn(generatedPath);
+    when(generatedSource.uri).thenReturn(uri);
+
+    when(generatedUriResolver.resolveAbsolute(uri, uri))
+        .thenReturn(generatedSource);
+
+    FileState generatedFile = fileSystemState.getFileForUri(uri);
+    expect(generatedFile.path, generatedPath);
+    expect(generatedFile.uri, uri);
+
+    FileState templateFile = fileSystemState.getFileForPath(templatePath);
+    expect(templateFile.path, templatePath);
+    expect(templateFile.uri, uri);
+
+    expect(fileSystemState.getFilesForPath(templatePath), [templateFile]);
+  }
+
   test_getFileForPath_library() {
     String a1 = _p('/aaa/lib/a1.dart');
     String a2 = _p('/aaa/lib/a2.dart');
@@ -103,7 +327,7 @@
     expect(file.unlinked.classes, hasLength(1));
     expect(file.unlinked.classes[0].name, 'A1');
 
-    expect(file.importedFiles, hasLength(2));
+    expect(_excludeSdk(file.importedFiles), hasLength(2));
     expect(file.importedFiles[0].path, a2);
     expect(file.importedFiles[0].uri, FastUri.parse('package:aaa/a2.dart'));
     expect(file.importedFiles[0].source, isNotNull);
@@ -123,11 +347,39 @@
     expect(file.partedFiles[0].path, a4);
     expect(file.partedFiles[0].uri, FastUri.parse('package:aaa/a4.dart'));
 
-    expect(file.directReferencedFiles, hasLength(5));
+    expect(_excludeSdk(file.directReferencedFiles), hasLength(5));
 
     expect(fileSystemState.getFilesForPath(a1), [file]);
   }
 
+  test_getFileForPath_onlyDartFiles() {
+    String not_dart = _p('/test/lib/not_dart.txt');
+    String a = _p('/test/lib/a.dart');
+    String b = _p('/test/lib/b.dart');
+    String c = _p('/test/lib/c.dart');
+    String d = _p('/test/lib/d.dart');
+    provider.newFile(
+        a,
+        r'''
+library lib;
+import 'dart:math';
+import 'b.dart';
+import 'not_dart.txt';
+export 'c.dart';
+export 'not_dart.txt';
+part 'd.dart';
+part 'not_dart.txt';
+''');
+    FileState file = fileSystemState.getFileForPath(a);
+    expect(_excludeSdk(file.importedFiles).map((f) => f.path),
+        unorderedEquals([b, not_dart]));
+    expect(
+        file.exportedFiles.map((f) => f.path), unorderedEquals([c, not_dart]));
+    expect(file.partedFiles.map((f) => f.path), unorderedEquals([d, not_dart]));
+    expect(_excludeSdk(fileSystemState.knownFilePaths),
+        unorderedEquals([a, b, c, d, not_dart]));
+  }
+
   test_getFileForPath_part() {
     String a1 = _p('/aaa/lib/a1.dart');
     String a2 = _p('/aaa/lib/a2.dart');
@@ -152,10 +404,10 @@
     expect(file_a2.unlinked.classes, hasLength(1));
     expect(file_a2.unlinked.classes[0].name, 'A2');
 
-    expect(file_a2.importedFiles, isEmpty);
+    expect(_excludeSdk(file_a2.importedFiles), isEmpty);
     expect(file_a2.exportedFiles, isEmpty);
     expect(file_a2.partedFiles, isEmpty);
-    expect(file_a2.directReferencedFiles, isEmpty);
+    expect(_excludeSdk(file_a2.directReferencedFiles), isEmpty);
 
     // The library is not known yet.
     expect(file_a2.isPart, isTrue);
@@ -165,7 +417,8 @@
     FileState file_a1 = fileSystemState.getFileForPath(a1);
     expect(file_a1.partedFiles, hasLength(1));
     expect(file_a1.partedFiles[0], same(file_a2));
-    expect(file_a1.directReferencedFiles, unorderedEquals([file_a2]));
+    expect(
+        _excludeSdk(file_a1.directReferencedFiles), unorderedEquals([file_a2]));
 
     // Now the part knows its library.
     expect(file_a2.library, same(file_a1));
@@ -280,6 +533,49 @@
     expect(file.apiSignature, signature);
   }
 
+  test_topLevelDeclarations() {
+    String path = _p('/aaa/lib/a.dart');
+    provider.newFile(
+        path,
+        r'''
+class C {}
+typedef F();
+enum E {E1, E2}
+void f() {}
+var V1;
+get V2 => null;
+set V3(_) {}
+get V4 => null;
+set V4(_) {}
+
+class _C {}
+typedef _F();
+enum _E {E1, E2}
+void _f() {}
+var _V1;
+get _V2 => null;
+set _V3(_) {}
+''');
+    FileState file = fileSystemState.getFileForPath(path);
+
+    Map<String, TopLevelDeclaration> declarations = file.topLevelDeclarations;
+
+    void assertHas(String name, TopLevelDeclarationKind kind) {
+      expect(declarations[name]?.kind, kind);
+    }
+
+    expect(declarations.keys,
+        unorderedEquals(['C', 'F', 'E', 'f', 'V1', 'V2', 'V3', 'V4']));
+    assertHas('C', TopLevelDeclarationKind.type);
+    assertHas('F', TopLevelDeclarationKind.type);
+    assertHas('E', TopLevelDeclarationKind.type);
+    assertHas('f', TopLevelDeclarationKind.function);
+    assertHas('V1', TopLevelDeclarationKind.variable);
+    assertHas('V2', TopLevelDeclarationKind.variable);
+    assertHas('V3', TopLevelDeclarationKind.variable);
+    assertHas('V4', TopLevelDeclarationKind.variable);
+  }
+
   test_transitiveFiles() {
     String pa = _p('/aaa/lib/a.dart');
     String pb = _p('/aaa/lib/b.dart');
@@ -296,7 +592,8 @@
     fb.transitiveFiles;
     fc.transitiveFiles;
     fd.transitiveFiles;
-    expect(fileSystemState.test.filesWithoutTransitiveFiles, isEmpty);
+    expect(
+        _excludeSdk(fileSystemState.test.filesWithoutTransitiveFiles), isEmpty);
 
     // No imports, so just a single file.
     provider.newFile(pa, "");
@@ -379,13 +676,15 @@
     expect(fb.transitiveSignature, isNotNull);
     expect(fc.transitiveSignature, isNotNull);
     expect(fd.transitiveSignature, isNotNull);
-    expect(fileSystemState.test.filesWithoutTransitiveFiles, isEmpty);
+    expect(
+        _excludeSdk(fileSystemState.test.filesWithoutTransitiveFiles), isEmpty);
 
     // Make an update to a.dart that does not change its API signature.
     // All transitive signatures are still valid.
     provider.newFile(pa, "class A {} // the same API signature");
     fa.refresh();
-    expect(fileSystemState.test.filesWithoutTransitiveFiles, isEmpty);
+    expect(
+        _excludeSdk(fileSystemState.test.filesWithoutTransitiveFiles), isEmpty);
 
     // Change a.dart API signature, also flush signatures of b.dart and c.dart,
     // but d.dart is still OK.
@@ -394,18 +693,35 @@
     _assertFilesWithoutTransitiveSignatures([fa, fb, fc]);
   }
 
+  void _assertExportedTopLevelDeclarations(String path, List<String> expected) {
+    FileState file = fileSystemState.getFileForPath(path);
+    Map<String, TopLevelDeclaration> declarations =
+        file.exportedTopLevelDeclarations;
+    expect(declarations.keys, unorderedEquals(expected));
+  }
+
   void _assertFilesWithoutTransitiveFiles(List<FileState> expected) {
     var actual = fileSystemState.test.filesWithoutTransitiveFiles;
-    expect(actual, unorderedEquals(expected));
+    expect(_excludeSdk(actual), unorderedEquals(expected));
   }
 
   void _assertFilesWithoutTransitiveSignatures(List<FileState> expected) {
     var actual = fileSystemState.test.filesWithoutTransitiveSignature;
-    expect(actual, unorderedEquals(expected));
+    expect(_excludeSdk(actual), unorderedEquals(expected));
   }
 
   void _assertTransitiveFiles(FileState file, List<FileState> expected) {
-    expect(file.transitiveFiles, unorderedEquals(expected));
+    expect(_excludeSdk(file.transitiveFiles), unorderedEquals(expected));
+  }
+
+  List<T> _excludeSdk<T>(Iterable<T> files) {
+    return files.where((Object file) {
+      if (file is FileState) {
+        return file.uri.scheme != 'dart';
+      } else {
+        return !(file as String).startsWith(_p('/sdk'));
+      }
+    }).toList();
   }
 
   String _p(String path) => provider.convertPath(path);
@@ -414,3 +730,7 @@
     return hex.encode(md5.convert(UTF8.encode(content)).bytes);
   }
 }
+
+class _GeneratedUriResolverMock extends TypedMock implements UriResolver {}
+
+class _SourceMock extends TypedMock implements Source {}
diff --git a/pkg/analyzer/test/src/dart/analysis/search_test.dart b/pkg/analyzer/test/src/dart/analysis/search_test.dart
index e473ffc..93cc816 100644
--- a/pkg/analyzer/test/src/dart/analysis/search_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/search_test.dart
@@ -5,6 +5,7 @@
 import 'dart:async';
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/dart/analysis/search.dart';
@@ -70,6 +71,144 @@
   CompilationUnitElement testUnitElement;
   LibraryElement testLibraryElement;
 
+  test_classMembers() async {
+    await _resolveTestUnit('''
+class A {
+  test() {}
+}
+class B {
+  int test = 1;
+  int testTwo = 2;
+  main() {
+    int test = 3;
+  }
+}
+''');
+    ClassElement a = _findElement('A');
+    ClassElement b = _findElement('B');
+    RegExp regExp = new RegExp(r'^test$');
+    expect(await driver.search.classMembers(regExp),
+        unorderedEquals([a.methods[0], b.fields[0]]));
+  }
+
+  test_classMembers_importNotDart() async {
+    await _resolveTestUnit('''
+import 'not-dart.txt';
+''');
+    RegExp regExp = new RegExp(r'^test$');
+    expect(await driver.search.classMembers(regExp), isEmpty);
+  }
+
+  test_searchMemberReferences_qualified_resolved() async {
+    await _resolveTestUnit('''
+class C {
+  var test;
+}
+main(C c) {
+  print(c.test);
+  c.test = 1;
+  c.test += 2;
+  c.test();
+}
+''');
+    await _verifyNameReferences('test', []);
+  }
+
+  test_searchMemberReferences_qualified_unresolved() async {
+    await _resolveTestUnit('''
+main(p) {
+  print(p.test);
+  p.test = 1;
+  p.test += 2;
+  p.test();
+}
+''');
+    Element main = _findElement('main');
+    await _verifyNameReferences('test', <ExpectedResult>[
+      _expectIdQU(main, SearchResultKind.READ, 'test);'),
+      _expectIdQU(main, SearchResultKind.WRITE, 'test = 1;'),
+      _expectIdQU(main, SearchResultKind.READ_WRITE, 'test += 2;'),
+      _expectIdQU(main, SearchResultKind.INVOCATION, 'test();'),
+    ]);
+  }
+
+  test_searchMemberReferences_unqualified_resolved() async {
+    await _resolveTestUnit('''
+class C {
+  var test;
+  main() {
+    print(test);
+    test = 1;
+    test += 2;
+    test();
+  }
+}
+''');
+    await _verifyNameReferences('test', []);
+  }
+
+  test_searchMemberReferences_unqualified_unresolved() async {
+    await _resolveTestUnit('''
+class C {
+  main() {
+    print(test);
+    test = 1;
+    test += 2;
+    test();
+  }
+}
+''');
+    Element main = _findElement('main');
+    await _verifyNameReferences('test', <ExpectedResult>[
+      _expectIdU(main, SearchResultKind.READ, 'test);'),
+      _expectIdU(main, SearchResultKind.WRITE, 'test = 1;'),
+      _expectIdU(main, SearchResultKind.READ_WRITE, 'test += 2;'),
+      _expectIdU(main, SearchResultKind.INVOCATION, 'test();'),
+    ]);
+  }
+
+  test_searchReferences_ClassElement_definedInSdk_declarationSite() async {
+    await _resolveTestUnit('''
+import 'dart:math';
+Random v1;
+Random v2;
+''');
+
+    // Find the Random class element in the SDK source.
+    // IDEA performs search always at declaration, never at reference.
+    ClassElement randomElement;
+    {
+      String randomPath = sdk.mapDartUri('dart:math').fullName;
+      AnalysisResult result = await driver.getResult(randomPath);
+      randomElement = result.unit.element.getType('Random');
+    }
+
+    Element v1 = _findElement('v1');
+    Element v2 = _findElement('v2');
+    var expected = [
+      _expectId(v1, SearchResultKind.REFERENCE, 'Random v1;'),
+      _expectId(v2, SearchResultKind.REFERENCE, 'Random v2;'),
+    ];
+    await _verifyReferences(randomElement, expected);
+  }
+
+  test_searchReferences_ClassElement_definedInSdk_useSite() async {
+    await _resolveTestUnit('''
+import 'dart:math';
+Random v1;
+Random v2;
+''');
+
+    var v1 = _findElement('v1') as VariableElement;
+    var v2 = _findElement('v2') as VariableElement;
+    var randomElement = v1.type.element as ClassElement;
+    var expected = [
+      _expectId(v1, SearchResultKind.REFERENCE, 'Random v1;'),
+      _expectId(v2, SearchResultKind.REFERENCE, 'Random v2;'),
+    ];
+    await _verifyReferences(randomElement, expected);
+  }
+
   test_searchReferences_ClassElement_definedInside() async {
     await _resolveTestUnit('''
 class A {};
@@ -121,27 +260,73 @@
     await _verifyReferences(element, expected);
   }
 
-  @failingTest
   test_searchReferences_CompilationUnitElement() async {
-    provider.newFile(
-        _p('$testProject/my_part.dart'),
-        '''
-part of lib;
-''');
+    provider.newFile(_p('$testProject/foo.dart'), '');
     await _resolveTestUnit('''
-library lib;
-part 'my_part.dart';
+import 'foo.dart'; // import
+export 'foo.dart'; // export
 ''');
-    CompilationUnitElement element = _findElementAtString('my_part');
+    CompilationUnitElement element =
+        testLibraryElement.imports[0].importedLibrary.definingCompilationUnit;
+    int uriLength = "'foo.dart'".length;
     var expected = [
-      _expectIdQ(element.library.definingCompilationUnit,
-          SearchResultKind.REFERENCE, "'my_part.dart'",
-          length: "'my_part.dart'".length)
+      _expectIdQ(
+          testUnitElement, SearchResultKind.REFERENCE, "'foo.dart'; // import",
+          length: uriLength),
+      _expectIdQ(
+          testUnitElement, SearchResultKind.REFERENCE, "'foo.dart'; // export",
+          length: uriLength),
     ];
     await _verifyReferences(element, expected);
   }
 
-  test_searchReferences_ConstructorElement() async {
+  test_searchReferences_ConstructorElement_default() async {
+    await _resolveTestUnit('''
+class A {
+  A() {}
+}
+main() {
+  new A();
+}
+''');
+    ConstructorElement element = _findElementAtString('A() {}');
+    Element mainElement = _findElement('main');
+    var expected = [
+      _expectIdQ(mainElement, SearchResultKind.REFERENCE, '();', length: 0)
+    ];
+    await _verifyReferences(element, expected);
+  }
+
+  test_searchReferences_ConstructorElement_default_otherFile() async {
+    String other = _p('$testProject/other.dart');
+    String otherCode = '''
+import 'test.dart';
+main() {
+  new A(); // in other
+}
+''';
+    provider.newFile(other, otherCode);
+    driver.addFile(other);
+
+    await _resolveTestUnit('''
+class A {
+  A() {}
+}
+''');
+    ConstructorElement element = _findElementAtString('A() {}');
+
+    CompilationUnit otherUnit = (await driver.getResult(other)).unit;
+    Element main =
+        resolutionMap.elementDeclaredByCompilationUnit(otherUnit).functions[0];
+    var expected = [
+      new ExpectedResult(main, SearchResultKind.REFERENCE,
+          otherCode.indexOf('(); // in other'), 0,
+          isResolved: true, isQualified: true)
+    ];
+    await _verifyReferences(element, expected);
+  }
+
+  test_searchReferences_ConstructorElement_named() async {
     await _resolveTestUnit('''
 class A {
   A.named() {}
@@ -154,7 +339,7 @@
     Element mainElement = _findElement('main');
     var expected = [
       _expectIdQ(mainElement, SearchResultKind.REFERENCE, '.named();',
-          length: 6)
+          length: '.named'.length)
     ];
     await _verifyReferences(element, expected);
   }
@@ -300,6 +485,83 @@
     await _verifyReferences(element, expected);
   }
 
+  test_searchReferences_ImportElement_noPrefix() async {
+    await _resolveTestUnit('''
+import 'dart:math' show max, PI, Random hide min;
+export 'dart:math' show max, PI, Random hide min;
+main() {
+  print(PI);
+  print(new Random());
+  print(max(1, 2));
+}
+Random bar() => null;
+''');
+    ImportElement element = testLibraryElement.imports[0];
+    Element mainElement = await _findElement('main');
+    Element barElement = await _findElement('bar');
+    var kind = SearchResultKind.REFERENCE;
+    var expected = [
+      _expectId(mainElement, kind, 'PI);', length: 0),
+      _expectId(mainElement, kind, 'Random()', length: 0),
+      _expectId(mainElement, kind, 'max(', length: 0),
+      _expectId(barElement, kind, 'Random bar()', length: 0),
+    ];
+    await _verifyReferences(element, expected);
+  }
+
+  test_searchReferences_ImportElement_withPrefix() async {
+    await _resolveTestUnit('''
+import 'dart:math' as math show max, PI, Random hide min;
+export 'dart:math' show max, PI, Random hide min;
+main() {
+  print(math.PI);
+  print(new math.Random());
+  print(math.max(1, 2));
+}
+math.Random bar() => null;
+''');
+    ImportElement element = testLibraryElement.imports[0];
+    Element mainElement = await _findElement('main');
+    Element barElement = await _findElement('bar');
+    var kind = SearchResultKind.REFERENCE;
+    var length = 'math.'.length;
+    var expected = [
+      _expectId(mainElement, kind, 'math.PI);', length: length),
+      _expectId(mainElement, kind, 'math.Random()', length: length),
+      _expectId(mainElement, kind, 'math.max(', length: length),
+      _expectId(barElement, kind, 'math.Random bar()', length: length),
+    ];
+    await _verifyReferences(element, expected);
+  }
+
+  test_searchReferences_ImportElement_withPrefix_forMultipleImports() async {
+    await _resolveTestUnit('''
+import 'dart:async' as p;
+import 'dart:math' as p;
+main() {
+  p.Random;
+  p.Future;
+}
+''');
+    Element mainElement = await _findElement('main');
+    var kind = SearchResultKind.REFERENCE;
+    var length = 'p.'.length;
+    {
+      ImportElement element = testLibraryElement.imports[0];
+      var expected = [
+        _expectId(mainElement, kind, 'p.Future;', length: length),
+      ];
+      await _verifyReferences(element, expected);
+    }
+    {
+      ImportElement element = testLibraryElement.imports[1];
+      var expected = [
+        _expectId(mainElement, kind, 'p.Random', length: length),
+      ];
+      await _verifyReferences(element, expected);
+    }
+  }
+
   test_searchReferences_LabelElement() async {
     await _resolveTestUnit('''
 main() {
@@ -321,6 +583,28 @@
     await _verifyReferences(element, expected);
   }
 
+  test_searchReferences_LibraryElement() async {
+    var codeA = 'part of lib; // A';
+    var codeB = 'part of lib; // B';
+    provider.newFile(_p('$testProject/unitA.dart'), codeA);
+    provider.newFile(_p('$testProject/unitB.dart'), codeB);
+    await _resolveTestUnit('''
+library lib;
+part 'unitA.dart';
+part 'unitB.dart';
+''');
+    LibraryElement element = testLibraryElement;
+    CompilationUnitElement unitElementA = element.parts[0];
+    CompilationUnitElement unitElementB = element.parts[1];
+    var expected = [
+      new ExpectedResult(unitElementA, SearchResultKind.REFERENCE,
+          codeA.indexOf('lib; // A'), 'lib'.length),
+      new ExpectedResult(unitElementB, SearchResultKind.REFERENCE,
+          codeB.indexOf('lib; // B'), 'lib'.length),
+    ];
+    await _verifyReferences(element, expected);
+  }
+
   test_searchReferences_LocalVariableElement() async {
     await _resolveTestUnit(r'''
 main() {
@@ -404,89 +688,7 @@
     await _verifyReferences(method, expected);
   }
 
-  test_searchReferences_ParameterElement_ofConstructor() async {
-    await _resolveTestUnit('''
-class C {
-  var f;
-  C({p}) : f = p + 1 {
-    p = 2;
-    p += 3;
-    print(p);
-    p();
-  }
-}
-main() {
-  new C(p: 42);
-}
-''');
-    ParameterElement element = _findElement('p');
-    ClassElement classC = _findElement('C');
-    ConstructorElement constructorA = classC.unnamedConstructor;
-    Element mainElement = _findElement('main');
-    var expected = [
-      _expectId(constructorA, SearchResultKind.READ, 'p + 1 {'),
-      _expectId(constructorA, SearchResultKind.WRITE, 'p = 2;'),
-      _expectId(constructorA, SearchResultKind.READ_WRITE, 'p += 3;'),
-      _expectId(constructorA, SearchResultKind.READ, 'p);'),
-      _expectId(constructorA, SearchResultKind.INVOCATION, 'p();'),
-      _expectIdQ(mainElement, SearchResultKind.REFERENCE, 'p: 42')
-    ];
-    await _verifyReferences(element, expected);
-  }
-
-  test_searchReferences_ParameterElement_ofLocalFunction() async {
-    await _resolveTestUnit('''
-main() {
-  foo({p}) {
-    p = 1;
-    p += 2;
-    print(p);
-    p();
-  }
-  foo(p: 42);
-}
-''');
-    ParameterElement element = _findElement('p');
-    Element fooElement = _findElement('foo');
-    Element mainElement = _findElement('main');
-    var expected = [
-      _expectId(fooElement, SearchResultKind.WRITE, 'p = 1;'),
-      _expectId(fooElement, SearchResultKind.READ_WRITE, 'p += 2;'),
-      _expectId(fooElement, SearchResultKind.READ, 'p);'),
-      _expectId(fooElement, SearchResultKind.INVOCATION, 'p();'),
-      _expectIdQ(mainElement, SearchResultKind.REFERENCE, 'p: 42')
-    ];
-    await _verifyReferences(element, expected);
-  }
-
-  test_searchReferences_ParameterElement_ofMethod() async {
-    await _resolveTestUnit('''
-class C {
-  foo({p}) {
-    p = 1;
-    p += 2;
-    print(p);
-    p();
-  }
-}
-main(C c) {
-  c.foo(p: 42);
-}
-''');
-    ParameterElement element = _findElement('p');
-    Element fooElement = _findElement('foo');
-    Element mainElement = _findElement('main');
-    var expected = [
-      _expectId(fooElement, SearchResultKind.WRITE, 'p = 1;'),
-      _expectId(fooElement, SearchResultKind.READ_WRITE, 'p += 2;'),
-      _expectId(fooElement, SearchResultKind.READ, 'p);'),
-      _expectId(fooElement, SearchResultKind.INVOCATION, 'p();'),
-      _expectIdQ(mainElement, SearchResultKind.REFERENCE, 'p: 42')
-    ];
-    await _verifyReferences(element, expected);
-  }
-
-  test_searchReferences_ParameterElement_ofTopLevelFunction() async {
+  test_searchReferences_ParameterElement_named() async {
     await _resolveTestUnit('''
 foo({p}) {
   p = 1;
@@ -511,6 +713,105 @@
     await _verifyReferences(element, expected);
   }
 
+  test_searchReferences_ParameterElement_ofConstructor() async {
+    await _resolveTestUnit('''
+class C {
+  var f;
+  C(p) : f = p + 1 {
+    p = 2;
+    p += 3;
+    print(p);
+    p();
+  }
+}
+main() {
+  new C(42);
+}
+''');
+    ParameterElement element = _findElement('p');
+    ClassElement classC = _findElement('C');
+    ConstructorElement constructorA = classC.unnamedConstructor;
+    var expected = [
+      _expectId(constructorA, SearchResultKind.READ, 'p + 1 {'),
+      _expectId(constructorA, SearchResultKind.WRITE, 'p = 2;'),
+      _expectId(constructorA, SearchResultKind.READ_WRITE, 'p += 3;'),
+      _expectId(constructorA, SearchResultKind.READ, 'p);'),
+      _expectId(constructorA, SearchResultKind.INVOCATION, 'p();')
+    ];
+    await _verifyReferences(element, expected);
+  }
+
+  test_searchReferences_ParameterElement_ofLocalFunction() async {
+    await _resolveTestUnit('''
+main() {
+  foo(p) {
+    p = 1;
+    p += 2;
+    print(p);
+    p();
+  }
+  foo(42);
+}
+''');
+    ParameterElement element = _findElement('p');
+    Element fooElement = _findElement('foo');
+    var expected = [
+      _expectId(fooElement, SearchResultKind.WRITE, 'p = 1;'),
+      _expectId(fooElement, SearchResultKind.READ_WRITE, 'p += 2;'),
+      _expectId(fooElement, SearchResultKind.READ, 'p);'),
+      _expectId(fooElement, SearchResultKind.INVOCATION, 'p();')
+    ];
+    await _verifyReferences(element, expected);
+  }
+
+  test_searchReferences_ParameterElement_ofMethod() async {
+    await _resolveTestUnit('''
+class C {
+  foo(p) {
+    p = 1;
+    p += 2;
+    print(p);
+    p();
+  }
+}
+main(C c) {
+  c.foo(42);
+}
+''');
+    ParameterElement element = _findElement('p');
+    Element fooElement = _findElement('foo');
+    var expected = [
+      _expectId(fooElement, SearchResultKind.WRITE, 'p = 1;'),
+      _expectId(fooElement, SearchResultKind.READ_WRITE, 'p += 2;'),
+      _expectId(fooElement, SearchResultKind.READ, 'p);'),
+      _expectId(fooElement, SearchResultKind.INVOCATION, 'p();')
+    ];
+    await _verifyReferences(element, expected);
+  }
+
+  test_searchReferences_ParameterElement_ofTopLevelFunction() async {
+    await _resolveTestUnit('''
+foo(p) {
+  p = 1;
+  p += 2;
+  print(p);
+  p();
+}
+main() {
+  foo(42);
+}
+''');
+    ParameterElement element = _findElement('p');
+    Element fooElement = _findElement('foo');
+    var expected = [
+      _expectId(fooElement, SearchResultKind.WRITE, 'p = 1;'),
+      _expectId(fooElement, SearchResultKind.READ_WRITE, 'p += 2;'),
+      _expectId(fooElement, SearchResultKind.READ, 'p);'),
+      _expectId(fooElement, SearchResultKind.INVOCATION, 'p();')
+    ];
+    await _verifyReferences(element, expected);
+  }
+
   test_searchReferences_PrefixElement() async {
     String partCode = r'''
 part of my_lib;
@@ -539,6 +840,88 @@
     await _verifyReferences(element, expected);
   }
 
+  test_searchReferences_private_declaredInDefiningUnit() async {
+    String p1 = _p('$testProject/part1.dart');
+    String p2 = _p('$testProject/part2.dart');
+    String p3 = _p('$testProject/part3.dart');
+    String code1 = 'part of lib; _C v1;';
+    String code2 = 'part of lib; _C v2;';
+    provider.newFile(p1, code1);
+    provider.newFile(p2, code2);
+    provider.newFile(p3, 'part of lib; int v3;');
+
+    driver.addFile(p1);
+    driver.addFile(p2);
+    driver.addFile(p3);
+
+    await _resolveTestUnit('''
+library lib;
+part 'part1.dart';
+part 'part2.dart';
+part 'part3.dart';
+class _C {}
+_C v;
+''');
+    ClassElement element = _findElementAtString('_C {}');
+    Element v = testUnitElement.topLevelVariables[0];
+    Element v1 = testLibraryElement.parts[0].topLevelVariables[0];
+    Element v2 = testLibraryElement.parts[1].topLevelVariables[0];
+    var expected = [
+      _expectId(v, SearchResultKind.REFERENCE, '_C v;', length: 2),
+      new ExpectedResult(
+          v1, SearchResultKind.REFERENCE, code1.indexOf('_C v1;'), 2),
+      new ExpectedResult(
+          v2, SearchResultKind.REFERENCE, code2.indexOf('_C v2;'), 2),
+    ];
+    await _verifyReferences(element, expected);
+  }
+
+  test_searchReferences_private_declaredInPart() async {
+    String p = _p('$testProject/lib.dart');
+    String p1 = _p('$testProject/part1.dart');
+    String p2 = _p('$testProject/part2.dart');
+
+    var code = '''
+library lib;
+part 'part1.dart';
+part 'part2.dart';
+_C v;
+''';
+    var code1 = '''
+part of lib;
+class _C {}
+_C v1;
+''';
+    String code2 = 'part of lib; _C v2;';
+
+    provider.newFile(p, code);
+    provider.newFile(p1, code1);
+    provider.newFile(p2, code2);
+
+    driver.addFile(p);
+    driver.addFile(p1);
+    driver.addFile(p2);
+
+    AnalysisResult result = await driver.getResult(p);
+    testUnit = result.unit;
+    testUnitElement = testUnit.element;
+    testLibraryElement = testUnitElement.library;
+
+    ClassElement element = testLibraryElement.parts[0].types[0];
+    Element v = testUnitElement.topLevelVariables[0];
+    Element v1 = testLibraryElement.parts[0].topLevelVariables[0];
+    Element v2 = testLibraryElement.parts[1].topLevelVariables[0];
+    var expected = [
+      new ExpectedResult(
+          v, SearchResultKind.REFERENCE, code.indexOf('_C v;'), 2),
+      new ExpectedResult(
+          v1, SearchResultKind.REFERENCE, code1.indexOf('_C v1;'), 2),
+      new ExpectedResult(
+          v2, SearchResultKind.REFERENCE, code2.indexOf('_C v2;'), 2),
+    ];
+    await _verifyReferences(element, expected);
+  }
+
   test_searchReferences_PropertyAccessorElement_getter() async {
     await _resolveTestUnit('''
 class A {
@@ -682,6 +1065,44 @@
     await _verifyReferences(element, expected);
   }
 
+  test_searchSubtypes() async {
+    await _resolveTestUnit('''
+class T {}
+class A extends T {} // A
+class B = Object with T; // B
+class C implements T {} // C
+''');
+    ClassElement element = _findElement('T');
+    ClassElement a = _findElement('A');
+    ClassElement b = _findElement('B');
+    ClassElement c = _findElement('C');
+    var expected = [
+      _expectId(a, SearchResultKind.REFERENCE, 'T {} // A'),
+      _expectId(b, SearchResultKind.REFERENCE, 'T; // B'),
+      _expectId(c, SearchResultKind.REFERENCE, 'T {} // C'),
+    ];
+    await _verifyReferences(element, expected);
+  }
+
+  test_topLevelElements() async {
+    await _resolveTestUnit('''
+class A {} // A
+class B = Object with A;
+typedef C();
+D() {}
+var e = null;
+class NoMatchABCDE {}
+''');
+    Element a = _findElement('A');
+    Element b = _findElement('B');
+    Element c = _findElement('C');
+    Element d = _findElement('D');
+    Element e = _findElement('e');
+    RegExp regExp = new RegExp(r'^[ABCDe]$');
+    expect(await driver.search.topLevelElements(regExp),
+        unorderedEquals([a, b, c, d, e]));
+  }
+
   ExpectedResult _expectId(
       Element enclosingElement, SearchResultKind kind, String search,
       {int length, bool isResolved: true, bool isQualified: false}) {
@@ -702,6 +1123,26 @@
     return _expectId(element, kind, search, isQualified: true, length: length);
   }
 
+  /**
+   * Create [ExpectedResult] for a qualified and unresolved match.
+   */
+  ExpectedResult _expectIdQU(
+      Element element, SearchResultKind kind, String search,
+      {int length}) {
+    return _expectId(element, kind, search,
+        isQualified: true, isResolved: false, length: length);
+  }
+
+  /**
+   * Create [ExpectedResult] for a unqualified and unresolved match.
+   */
+  ExpectedResult _expectIdU(
+      Element element, SearchResultKind kind, String search,
+      {int length}) {
+    return _expectId(element, kind, search,
+        isQualified: false, isResolved: false, length: length);
+  }
+
   Element _findElement(String name, [ElementKind kind]) {
     return findChildElement(testUnit.element, name, kind);
   }
@@ -724,6 +1165,14 @@
     }
   }
 
+  Future<Null> _verifyNameReferences(
+      String name, List<ExpectedResult> expectedMatches) async {
+    List<SearchResult> results =
+        await driver.search.unresolvedMemberReferences(name);
+    _assertResults(results, expectedMatches);
+    expect(results, hasLength(expectedMatches.length));
+  }
+
   Future _verifyReferences(
       Element element, List<ExpectedResult> expectedMatches) async {
     List<SearchResult> results = await driver.search.references(element);
diff --git a/pkg/analyzer/test/src/dart/ast/utilities_test.dart b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
index 5a18e5f..cb3652e 100644
--- a/pkg/analyzer/test/src/dart/ast/utilities_test.dart
+++ b/pkg/analyzer/test/src/dart/ast/utilities_test.dart
@@ -5,9 +5,11 @@
 library analyzer.test.src.dart.ast.utilities_test;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/dart/ast/utilities.dart';
 import 'package:analyzer/src/dart/element/element.dart';
 import 'package:analyzer/src/generated/java_core.dart';
@@ -200,11 +202,36 @@
     expect(value, 2.3 + 3.2);
   }
 
+  void test_binary_plus_double_string() {
+    Object value = _getConstantValue("'world' + 5.5");
+    expect(value, ConstantEvaluator.NOT_A_CONSTANT);
+  }
+
+  void test_binary_plus_int_string() {
+    Object value = _getConstantValue("'world' + 5");
+    expect(value, ConstantEvaluator.NOT_A_CONSTANT);
+  }
+
   void test_binary_plus_integer() {
     Object value = _getConstantValue("2 + 3");
     expect(value, 5);
   }
 
+  void test_binary_plus_string() {
+    Object value = _getConstantValue("'hello ' + 'world'");
+    expect(value, 'hello world');
+  }
+
+  void test_binary_plus_string_double() {
+    Object value = _getConstantValue("5.5 + 'world'");
+    expect(value, ConstantEvaluator.NOT_A_CONSTANT);
+  }
+
+  void test_binary_plus_string_int() {
+    Object value = _getConstantValue("5 + 'world'");
+    expect(value, ConstantEvaluator.NOT_A_CONSTANT);
+  }
+
   void test_binary_remainder_double() {
     Object value = _getConstantValue("3.2 % 2.3");
     expect(value, 3.2 % 2.3);
@@ -346,7 +373,7 @@
     CompilationUnit unit = ParserTestCase.parseCompilationUnit(code);
     TopLevelVariableDeclaration declaration = unit.declarations[0];
     VariableDeclarationList variableList = declaration.variables;
-    Identifier typeName = variableList.type.name;
+    Identifier typeName = (variableList.type as TypeName).name;
     SimpleIdentifier varName = variableList.variables[0].name;
     expect(new NodeLocator2(0).searchWithin(unit), same(unit));
     expect(new NodeLocator2(1).searchWithin(unit), same(typeName));
@@ -367,7 +394,7 @@
     CompilationUnit unit = ParserTestCase.parseCompilationUnit(code);
     TopLevelVariableDeclaration declaration = unit.declarations[0];
     VariableDeclarationList variableList = declaration.variables;
-    Identifier typeName = variableList.type.name;
+    Identifier typeName = (variableList.type as TypeName).name;
     SimpleIdentifier varName = variableList.variables[0].name;
     expect(new NodeLocator2(-1, 2).searchWithin(unit), isNull);
     expect(new NodeLocator2(0, 2).searchWithin(unit), same(unit));
@@ -437,9 +464,9 @@
 @reflectiveTest
 class ResolutionCopierTest extends EngineTestCase {
   void test_visitAdjacentStrings() {
-    AdjacentStrings createNode() => new AdjacentStrings([
-          new SimpleStringLiteral(null, 'hello'),
-          new SimpleStringLiteral(null, 'world')
+    AdjacentStrings createNode() => astFactory.adjacentStrings([
+          astFactory.simpleStringLiteral(null, 'hello'),
+          astFactory.simpleStringLiteral(null, 'world')
         ]);
 
     AdjacentStrings fromNode = createNode();
@@ -670,9 +697,9 @@
         .functionExpressionInvocation(AstTestFactory.identifier3("f"));
     ClassElement elementT = ElementFactory.classElement2('T');
     fromNode.typeArguments = AstTestFactory
-        .typeArgumentList(<TypeName>[AstTestFactory.typeName(elementT)]);
+        .typeArgumentList(<TypeAnnotation>[AstTestFactory.typeName(elementT)]);
     toNode.typeArguments = AstTestFactory
-        .typeArgumentList(<TypeName>[AstTestFactory.typeName4('T')]);
+        .typeArgumentList(<TypeAnnotation>[AstTestFactory.typeName4('T')]);
 
     _copyAndVerifyInvocation(fromNode, toNode);
 
@@ -805,9 +832,9 @@
     MethodInvocation toNode = AstTestFactory.methodInvocation2("m");
     ClassElement elementT = ElementFactory.classElement2('T');
     fromNode.typeArguments = AstTestFactory
-        .typeArgumentList(<TypeName>[AstTestFactory.typeName(elementT)]);
+        .typeArgumentList(<TypeAnnotation>[AstTestFactory.typeName(elementT)]);
     toNode.typeArguments = AstTestFactory
-        .typeArgumentList(<TypeName>[AstTestFactory.typeName4('T')]);
+        .typeArgumentList(<TypeAnnotation>[AstTestFactory.typeName4('T')]);
     _copyAndVerifyInvocation(fromNode, toNode);
   }
 
@@ -1104,12 +1131,12 @@
     expect(toNode.staticType, same(staticType));
     expect(toNode.propagatedInvokeType, same(propagatedInvokeType));
     expect(toNode.staticInvokeType, same(staticInvokeType));
-    List<TypeName> fromTypeArguments = toNode.typeArguments.arguments;
-    List<TypeName> toTypeArguments = fromNode.typeArguments.arguments;
+    List<TypeAnnotation> fromTypeArguments = toNode.typeArguments.arguments;
+    List<TypeAnnotation> toTypeArguments = fromNode.typeArguments.arguments;
     if (fromTypeArguments != null) {
       for (int i = 0; i < fromTypeArguments.length; i++) {
-        TypeName toArgument = fromTypeArguments[i];
-        TypeName fromArgument = toTypeArguments[i];
+        TypeAnnotation toArgument = fromTypeArguments[i];
+        TypeAnnotation fromArgument = toTypeArguments[i];
         expect(toArgument.type, same(fromArgument.type));
       }
     }
@@ -1555,13 +1582,13 @@
   void test_visitComment() {
     _assertSource(
         "",
-        Comment.createBlockComment(
+        astFactory.blockComment(
             <Token>[TokenFactory.tokenFromString("/* comment */")]));
   }
 
   void test_visitCommentReference() {
     _assertSource(
-        "", new CommentReference(null, AstTestFactory.identifier3("a")));
+        "", astFactory.commentReference(null, AstTestFactory.identifier3("a")));
   }
 
   void test_visitCompilationUnit_declaration() {
@@ -1947,7 +1974,7 @@
   void test_visitFieldFormalParameter_functionTyped_typeParameters() {
     _assertSource(
         "A this.a<E, F>(b)",
-        new FieldFormalParameter(
+        astFactory.fieldFormalParameter(
             null,
             null,
             null,
@@ -1979,6 +2006,14 @@
             null, AstTestFactory.typeName4("A"), "a"));
   }
 
+  void test_visitFieldFormalParameter_type_covariant() {
+    FieldFormalParameterImpl expected = AstTestFactory.fieldFormalParameter(
+        null, AstTestFactory.typeName4("A"), "a");
+    expected.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _assertSource("covariant A this.a", expected);
+  }
+
   void test_visitForEachStatement_declared() {
     _assertSource(
         "for (var a in b) {}",
@@ -1989,7 +2024,7 @@
   void test_visitForEachStatement_variable() {
     _assertSource(
         "for (a in b) {}",
-        new ForEachStatement.withReference(
+        astFactory.forEachStatementWithReference(
             null,
             TokenFactory.tokenFromKeyword(Keyword.FOR),
             TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
@@ -2003,7 +2038,7 @@
   void test_visitForEachStatement_variable_await() {
     _assertSource(
         "await for (a in b) {}",
-        new ForEachStatement.withReference(
+        astFactory.forEachStatementWithReference(
             TokenFactory.tokenFromString("await"),
             TokenFactory.tokenFromKeyword(Keyword.FOR),
             TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
@@ -2305,7 +2340,7 @@
     FunctionDeclaration f = AstTestFactory.functionDeclaration(
         null, null, "f", AstTestFactory.functionExpression());
     FunctionDeclarationStatement fStatement =
-        new FunctionDeclarationStatement(f);
+        astFactory.functionDeclarationStatement(f);
     _assertSource(
         "main() {f() {} 42;}",
         AstTestFactory.functionDeclaration(
@@ -2328,7 +2363,7 @@
         AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(),
             AstTestFactory.expressionFunctionBody(AstTestFactory.integer(1))));
     FunctionDeclarationStatement fStatement =
-        new FunctionDeclarationStatement(f);
+        astFactory.functionDeclarationStatement(f);
     _assertSource(
         "main() {f() => 1; 2;}",
         AstTestFactory.functionDeclaration(
@@ -2461,10 +2496,18 @@
             AstTestFactory.typeName4("T"), "f"));
   }
 
+  void test_visitFunctionTypedFormalParameter_type_covariant() {
+    FunctionTypedFormalParameterImpl expected = AstTestFactory
+        .functionTypedFormalParameter(AstTestFactory.typeName4("T"), "f");
+    expected.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _assertSource("covariant T f()", expected);
+  }
+
   void test_visitFunctionTypedFormalParameter_typeParameters() {
     _assertSource(
         "T f<E>()",
-        new FunctionTypedFormalParameter(
+        astFactory.functionTypedFormalParameter(
             null,
             null,
             AstTestFactory.typeName4("T"),
@@ -3103,6 +3146,14 @@
             AstTestFactory.typeName4("A"), "a"));
   }
 
+  void test_visitSimpleFormalParameter_type_covariant() {
+    SimpleFormalParameterImpl expected = AstTestFactory.simpleFormalParameter4(
+        AstTestFactory.typeName4("A"), "a");
+    expected.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _assertSource("covariant A a", expected);
+  }
+
   void test_visitSimpleIdentifier() {
     _assertSource("a", AstTestFactory.identifier3("a"));
   }
@@ -3885,13 +3936,13 @@
   void test_visitComment() {
     _assertSource(
         "",
-        Comment.createBlockComment(
+        astFactory.blockComment(
             <Token>[TokenFactory.tokenFromString("/* comment */")]));
   }
 
   void test_visitCommentReference() {
     _assertSource(
-        "", new CommentReference(null, AstTestFactory.identifier3("a")));
+        "", astFactory.commentReference(null, AstTestFactory.identifier3("a")));
   }
 
   void test_visitCompilationUnit_declaration() {
@@ -4277,7 +4328,7 @@
   void test_visitFieldFormalParameter_functionTyped_typeParameters() {
     _assertSource(
         "A this.a<E, F>(b)",
-        new FieldFormalParameter(
+        astFactory.fieldFormalParameter(
             null,
             null,
             null,
@@ -4309,6 +4360,14 @@
             null, AstTestFactory.typeName4("A"), "a"));
   }
 
+  void test_visitFieldFormalParameter_type_covariant() {
+    FieldFormalParameterImpl expected = AstTestFactory.fieldFormalParameter(
+        null, AstTestFactory.typeName4("A"), "a");
+    expected.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _assertSource("covariant A this.a", expected);
+  }
+
   void test_visitForEachStatement_declared() {
     _assertSource(
         "for (var a in b) {}",
@@ -4319,7 +4378,7 @@
   void test_visitForEachStatement_variable() {
     _assertSource(
         "for (a in b) {}",
-        new ForEachStatement.withReference(
+        astFactory.forEachStatementWithReference(
             null,
             TokenFactory.tokenFromKeyword(Keyword.FOR),
             TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
@@ -4333,7 +4392,7 @@
   void test_visitForEachStatement_variable_await() {
     _assertSource(
         "await for (a in b) {}",
-        new ForEachStatement.withReference(
+        astFactory.forEachStatementWithReference(
             TokenFactory.tokenFromString("await"),
             TokenFactory.tokenFromKeyword(Keyword.FOR),
             TokenFactory.tokenFromType(TokenType.OPEN_PAREN),
@@ -4635,7 +4694,7 @@
     FunctionDeclaration f = AstTestFactory.functionDeclaration(
         null, null, "f", AstTestFactory.functionExpression());
     FunctionDeclarationStatement fStatement =
-        new FunctionDeclarationStatement(f);
+        astFactory.functionDeclarationStatement(f);
     _assertSource(
         "main() {f() {} 42;}",
         AstTestFactory.functionDeclaration(
@@ -4658,7 +4717,7 @@
         AstTestFactory.functionExpression2(AstTestFactory.formalParameterList(),
             AstTestFactory.expressionFunctionBody(AstTestFactory.integer(1))));
     FunctionDeclarationStatement fStatement =
-        new FunctionDeclarationStatement(f);
+        astFactory.functionDeclarationStatement(f);
     _assertSource(
         "main() {f() => 1; 2;}",
         AstTestFactory.functionDeclaration(
@@ -4791,10 +4850,18 @@
             AstTestFactory.typeName4("T"), "f"));
   }
 
+  void test_visitFunctionTypedFormalParameter_type_covariant() {
+    FunctionTypedFormalParameterImpl expected = AstTestFactory
+        .functionTypedFormalParameter(AstTestFactory.typeName4("T"), "f");
+    expected.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _assertSource("covariant T f()", expected);
+  }
+
   void test_visitFunctionTypedFormalParameter_typeParameters() {
     _assertSource(
         "T f<E>()",
-        new FunctionTypedFormalParameter(
+        astFactory.functionTypedFormalParameter(
             null,
             null,
             AstTestFactory.typeName4("T"),
@@ -5433,6 +5500,14 @@
             AstTestFactory.typeName4("A"), "a"));
   }
 
+  void test_visitSimpleFormalParameter_type_covariant() {
+    SimpleFormalParameterImpl expected = AstTestFactory.simpleFormalParameter4(
+        AstTestFactory.typeName4("A"), "a");
+    expected.covariantKeyword =
+        TokenFactory.tokenFromKeyword(Keyword.COVARIANT);
+    _assertSource("covariant A a", expected);
+  }
+
   void test_visitSimpleIdentifier() {
     _assertSource("a", AstTestFactory.identifier3("a"));
   }
diff --git a/pkg/analyzer/test/src/dart/constant/evaluation_test.dart b/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
index 43dfdf7..2be471d 100644
--- a/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
+++ b/pkg/analyzer/test/src/dart/constant/evaluation_test.dart
@@ -4,8 +4,11 @@
 
 library analyzer.test.constant_test;
 
+import 'dart:async';
+
 import 'package:analyzer/context/declared_variables.dart';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart';
@@ -91,8 +94,8 @@
 
 @reflectiveTest
 class ConstantValueComputerTest extends ResolverTestCase {
-  void test_annotation_constConstructor() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_annotation_constConstructor() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class A {
   final int i;
   const A(this.i);
@@ -109,8 +112,8 @@
     _assertIntField(annotationFields, 'i', 5);
   }
 
-  void test_annotation_constConstructor_named() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_annotation_constConstructor_named() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class A {
   final int i;
   const A.named(this.i);
@@ -127,10 +130,10 @@
     _assertIntField(annotationFields, 'i', 5);
   }
 
-  void test_annotation_constConstructor_noArgs() {
+  test_annotation_constConstructor_noArgs() async {
     // Failing to pass arguments to an annotation which is a constant
     // constructor is illegal, but shouldn't crash analysis.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class A {
   final int i;
   const A(this.i);
@@ -144,10 +147,10 @@
     _evaluateAnnotation(compilationUnit, "C", "f");
   }
 
-  void test_annotation_constConstructor_noArgs_named() {
+  test_annotation_constConstructor_noArgs_named() async {
     // Failing to pass arguments to an annotation which is a constant
     // constructor is illegal, but shouldn't crash analysis.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class A {
   final int i;
   const A.named(this.i);
@@ -161,10 +164,10 @@
     _evaluateAnnotation(compilationUnit, "C", "f");
   }
 
-  void test_annotation_nonConstConstructor() {
+  test_annotation_nonConstConstructor() async {
     // Calling a non-const constructor from an annotation that is illegal, but
     // shouldn't crash analysis.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class A {
   final int i;
   A(this.i);
@@ -178,8 +181,8 @@
     _evaluateAnnotation(compilationUnit, "C", "f");
   }
 
-  void test_annotation_staticConst() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_annotation_staticConst() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class C {
   static const int i = 5;
 
@@ -192,10 +195,10 @@
     expect(_assertValidInt(result), 5);
   }
 
-  void test_annotation_staticConst_args() {
+  test_annotation_staticConst_args() async {
     // Applying arguments to an annotation that is a static const is
     // illegal, but shouldn't crash analysis.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class C {
   static const int i = 5;
 
@@ -206,8 +209,8 @@
     _evaluateAnnotation(compilationUnit, "C", "f");
   }
 
-  void test_annotation_staticConst_otherClass() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_annotation_staticConst_otherClass() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class A {
   static const int i = 5;
 }
@@ -222,10 +225,10 @@
     expect(_assertValidInt(result), 5);
   }
 
-  void test_annotation_staticConst_otherClass_args() {
+  test_annotation_staticConst_otherClass_args() async {
     // Applying arguments to an annotation that is a static const is
     // illegal, but shouldn't crash analysis.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class A {
   static const int i = 5;
 }
@@ -238,8 +241,8 @@
     _evaluateAnnotation(compilationUnit, "C", "f");
   }
 
-  void test_annotation_topLevelVariable() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_annotation_topLevelVariable() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const int i = 5;
 class C {
   @i
@@ -251,10 +254,10 @@
     expect(_assertValidInt(result), 5);
   }
 
-  void test_annotation_topLevelVariable_args() {
+  test_annotation_topLevelVariable_args() async {
     // Applying arguments to an annotation that is a top-level variable is
     // illegal, but shouldn't crash analysis.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const int i = 5;
 class C {
   @i(1)
@@ -264,7 +267,7 @@
     _evaluateAnnotation(compilationUnit, "C", "f");
   }
 
-  void test_computeValues_cycle() {
+  test_computeValues_cycle() async {
     TestLogger logger = new TestLogger();
     AnalysisEngine.instance.logger = logger;
     try {
@@ -290,7 +293,7 @@
     }
   }
 
-  void test_computeValues_dependentVariables() {
+  test_computeValues_dependentVariables() async {
     Source source = addSource(r'''
 const int b = a;
 const int a = 0;''');
@@ -307,12 +310,12 @@
     _validate(true, (members[1] as TopLevelVariableDeclaration).variables);
   }
 
-  void test_computeValues_empty() {
+  test_computeValues_empty() async {
     ConstantValueComputer computer = _makeConstantValueComputer();
     computer.computeValues();
   }
 
-  void test_computeValues_multipleSources() {
+  test_computeValues_multipleSources() async {
     Source librarySource = addNamedSource(
         "/lib.dart",
         r'''
@@ -349,7 +352,7 @@
     _validate(true, (partMembers[1] as TopLevelVariableDeclaration).variables);
   }
 
-  void test_computeValues_singleVariable() {
+  test_computeValues_singleVariable() async {
     Source source = addSource("const int a = 0;");
     LibraryElement libraryElement = resolve2(source);
     CompilationUnit unit =
@@ -363,7 +366,7 @@
     _validate(true, (members[0] as TopLevelVariableDeclaration).variables);
   }
 
-  void test_computeValues_value_depends_on_enum() {
+  test_computeValues_value_depends_on_enum() async {
     Source source = addSource('''
 enum E { id0, id1 }
 const E e = E.id0;
@@ -380,18 +383,18 @@
     _validate(true, declaration.variables);
   }
 
-  void test_dependencyOnConstructor() {
+  test_dependencyOnConstructor() async {
     // x depends on "const A()"
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 class A {
   const A();
 }
 const x = const A();''');
   }
 
-  void test_dependencyOnConstructorArgument() {
+  test_dependencyOnConstructorArgument() async {
     // "const A(x)" depends on x
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 class A {
   const A(this.next);
   final A next;
@@ -400,9 +403,9 @@
 const A y = const A(x);''');
   }
 
-  void test_dependencyOnConstructorArgument_unresolvedConstructor() {
+  test_dependencyOnConstructorArgument_unresolvedConstructor() async {
     // "const A.a(x)" depends on x even if the constructor A.a can't be found.
-    _assertProperDependencies(
+    await _assertProperDependencies(
         r'''
 class A {
 }
@@ -411,9 +414,9 @@
         [CompileTimeErrorCode.CONST_WITH_UNDEFINED_CONSTRUCTOR]);
   }
 
-  void test_dependencyOnConstructorInitializer() {
+  test_dependencyOnConstructorInitializer() async {
     // "const A()" depends on x
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 const int x = 1;
 class A {
   const A() : v = x;
@@ -421,9 +424,9 @@
 }''');
   }
 
-  void test_dependencyOnExplicitSuperConstructor() {
+  test_dependencyOnExplicitSuperConstructor() async {
     // b depends on B() depends on A()
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 class A {
   const A(this.x);
   final int x;
@@ -434,9 +437,9 @@
 const B b = const B();''');
   }
 
-  void test_dependencyOnExplicitSuperConstructorParameters() {
+  test_dependencyOnExplicitSuperConstructorParameters() async {
     // b depends on B() depends on i
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 class A {
   const A(this.x);
   final int x;
@@ -448,9 +451,9 @@
 const int i = 5;''');
   }
 
-  void test_dependencyOnFactoryRedirect() {
+  test_dependencyOnFactoryRedirect() async {
     // a depends on A.foo() depends on A.bar()
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 const A a = const A.foo();
 class A {
   factory const A.foo() = A.bar;
@@ -458,8 +461,8 @@
 }''');
   }
 
-  void test_dependencyOnFactoryRedirectWithTypeParams() {
-    _assertProperDependencies(r'''
+  test_dependencyOnFactoryRedirectWithTypeParams() async {
+    await _assertProperDependencies(r'''
 class A {
   const factory A(var a) = B<int>;
 }
@@ -472,9 +475,9 @@
 const A a = const A(10);''');
   }
 
-  void test_dependencyOnImplicitSuperConstructor() {
+  test_dependencyOnImplicitSuperConstructor() async {
     // b depends on B() depends on A()
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 class A {
   const A() : x = 5;
   final int x;
@@ -485,9 +488,9 @@
 const B b = const B();''');
   }
 
-  void test_dependencyOnInitializedFinal() {
+  test_dependencyOnInitializedFinal() async {
     // a depends on A() depends on A.x
-    _assertProperDependencies('''
+    await _assertProperDependencies('''
 class A {
   const A();
   final int x = 1;
@@ -496,11 +499,11 @@
 ''');
   }
 
-  void test_dependencyOnInitializedNonStaticConst() {
+  test_dependencyOnInitializedNonStaticConst() async {
     // Even though non-static consts are not allowed by the language, we need
     // to handle them for error recovery purposes.
     // a depends on A() depends on A.x
-    _assertProperDependencies(
+    await _assertProperDependencies(
         '''
 class A {
   const A();
@@ -511,9 +514,9 @@
         [CompileTimeErrorCode.CONST_INSTANCE_FIELD]);
   }
 
-  void test_dependencyOnNonFactoryRedirect() {
+  test_dependencyOnNonFactoryRedirect() async {
     // a depends on A.foo() depends on A.bar()
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 const A a = const A.foo();
 class A {
   const A.foo() : this.bar();
@@ -521,9 +524,9 @@
 }''');
   }
 
-  void test_dependencyOnNonFactoryRedirect_arg() {
+  test_dependencyOnNonFactoryRedirect_arg() async {
     // a depends on A.foo() depends on b
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 const A a = const A.foo();
 const int b = 1;
 class A {
@@ -533,9 +536,9 @@
 }''');
   }
 
-  void test_dependencyOnNonFactoryRedirect_defaultValue() {
+  test_dependencyOnNonFactoryRedirect_defaultValue() async {
     // a depends on A.foo() depends on A.bar() depends on b
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 const A a = const A.foo();
 const int b = 1;
 class A {
@@ -545,10 +548,10 @@
 }''');
   }
 
-  void test_dependencyOnNonFactoryRedirect_toMissing() {
+  test_dependencyOnNonFactoryRedirect_toMissing() async {
     // a depends on A.foo() which depends on nothing, since A.bar() is
     // missing.
-    _assertProperDependencies(
+    await _assertProperDependencies(
         r'''
 const A a = const A.foo();
 class A {
@@ -557,10 +560,10 @@
         [CompileTimeErrorCode.REDIRECT_GENERATIVE_TO_MISSING_CONSTRUCTOR]);
   }
 
-  void test_dependencyOnNonFactoryRedirect_toNonConst() {
+  test_dependencyOnNonFactoryRedirect_toNonConst() async {
     // a depends on A.foo() which depends on nothing, since A.bar() is
     // non-const.
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 const A a = const A.foo();
 class A {
   const A.foo() : this.bar();
@@ -568,9 +571,9 @@
 }''');
   }
 
-  void test_dependencyOnNonFactoryRedirect_unnamed() {
+  test_dependencyOnNonFactoryRedirect_unnamed() async {
     // a depends on A.foo() depends on A()
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 const A a = const A.foo();
 class A {
   const A.foo() : this();
@@ -578,9 +581,9 @@
 }''');
   }
 
-  void test_dependencyOnOptionalParameterDefault() {
+  test_dependencyOnOptionalParameterDefault() async {
     // a depends on A() depends on B()
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 class A {
   const A([x = const B()]) : b = x;
   final B b;
@@ -591,15 +594,15 @@
 const A a = const A();''');
   }
 
-  void test_dependencyOnVariable() {
+  test_dependencyOnVariable() async {
     // x depends on y
-    _assertProperDependencies(r'''
+    await _assertProperDependencies(r'''
 const x = y + 1;
 const y = 2;''');
   }
 
-  void test_final_initialized_at_declaration() {
-    CompilationUnit compilationUnit = resolveSource('''
+  test_final_initialized_at_declaration() async {
+    CompilationUnit compilationUnit = await resolveSource('''
 class A {
   final int i = 123;
   const A();
@@ -614,103 +617,115 @@
     _assertIntField(fields, "i", 123);
   }
 
-  void test_fromEnvironment_bool_default_false() {
-    expect(_assertValidBool(_check_fromEnvironment_bool(null, "false")), false);
-  }
-
-  void test_fromEnvironment_bool_default_overridden() {
-    expect(
-        _assertValidBool(_check_fromEnvironment_bool("false", "true")), false);
-  }
-
-  void test_fromEnvironment_bool_default_parseError() {
-    expect(_assertValidBool(_check_fromEnvironment_bool("parseError", "true")),
-        true);
-  }
-
-  void test_fromEnvironment_bool_default_true() {
-    expect(_assertValidBool(_check_fromEnvironment_bool(null, "true")), true);
-  }
-
-  void test_fromEnvironment_bool_false() {
-    expect(_assertValidBool(_check_fromEnvironment_bool("false", null)), false);
-  }
-
-  void test_fromEnvironment_bool_parseError() {
-    expect(_assertValidBool(_check_fromEnvironment_bool("parseError", null)),
+  test_fromEnvironment_bool_default_false() async {
+    expect(_assertValidBool(await _check_fromEnvironment_bool(null, "false")),
         false);
   }
 
-  void test_fromEnvironment_bool_true() {
-    expect(_assertValidBool(_check_fromEnvironment_bool("true", null)), true);
+  test_fromEnvironment_bool_default_overridden() async {
+    expect(_assertValidBool(await _check_fromEnvironment_bool("false", "true")),
+        false);
   }
 
-  void test_fromEnvironment_bool_undeclared() {
-    _assertValidUnknown(_check_fromEnvironment_bool(null, null));
-  }
-
-  void test_fromEnvironment_int_default_overridden() {
-    expect(_assertValidInt(_check_fromEnvironment_int("234", "123")), 234);
-  }
-
-  void test_fromEnvironment_int_default_parseError() {
+  test_fromEnvironment_bool_default_parseError() async {
     expect(
-        _assertValidInt(_check_fromEnvironment_int("parseError", "123")), 123);
+        _assertValidBool(
+            await _check_fromEnvironment_bool("parseError", "true")),
+        true);
   }
 
-  void test_fromEnvironment_int_default_undeclared() {
-    expect(_assertValidInt(_check_fromEnvironment_int(null, "123")), 123);
+  test_fromEnvironment_bool_default_true() async {
+    expect(_assertValidBool(await _check_fromEnvironment_bool(null, "true")),
+        true);
   }
 
-  void test_fromEnvironment_int_ok() {
-    expect(_assertValidInt(_check_fromEnvironment_int("234", null)), 234);
+  test_fromEnvironment_bool_false() async {
+    expect(_assertValidBool(await _check_fromEnvironment_bool("false", null)),
+        false);
   }
 
-  void test_fromEnvironment_int_parseError() {
-    _assertValidNull(_check_fromEnvironment_int("parseError", null));
+  test_fromEnvironment_bool_parseError() async {
+    expect(
+        _assertValidBool(await _check_fromEnvironment_bool("parseError", null)),
+        false);
   }
 
-  void test_fromEnvironment_int_parseError_nullDefault() {
-    _assertValidNull(_check_fromEnvironment_int("parseError", "null"));
+  test_fromEnvironment_bool_true() async {
+    expect(_assertValidBool(await _check_fromEnvironment_bool("true", null)),
+        true);
   }
 
-  void test_fromEnvironment_int_undeclared() {
-    _assertValidUnknown(_check_fromEnvironment_int(null, null));
+  test_fromEnvironment_bool_undeclared() async {
+    _assertValidUnknown(await _check_fromEnvironment_bool(null, null));
   }
 
-  void test_fromEnvironment_int_undeclared_nullDefault() {
-    _assertValidNull(_check_fromEnvironment_int(null, "null"));
+  test_fromEnvironment_int_default_overridden() async {
+    expect(
+        _assertValidInt(await _check_fromEnvironment_int("234", "123")), 234);
   }
 
-  void test_fromEnvironment_string_default_overridden() {
-    expect(_assertValidString(_check_fromEnvironment_string("abc", "'def'")),
+  test_fromEnvironment_int_default_parseError() async {
+    expect(
+        _assertValidInt(await _check_fromEnvironment_int("parseError", "123")),
+        123);
+  }
+
+  test_fromEnvironment_int_default_undeclared() async {
+    expect(_assertValidInt(await _check_fromEnvironment_int(null, "123")), 123);
+  }
+
+  test_fromEnvironment_int_ok() async {
+    expect(_assertValidInt(await _check_fromEnvironment_int("234", null)), 234);
+  }
+
+  test_fromEnvironment_int_parseError() async {
+    _assertValidNull(await _check_fromEnvironment_int("parseError", null));
+  }
+
+  test_fromEnvironment_int_parseError_nullDefault() async {
+    _assertValidNull(await _check_fromEnvironment_int("parseError", "null"));
+  }
+
+  test_fromEnvironment_int_undeclared() async {
+    _assertValidUnknown(await _check_fromEnvironment_int(null, null));
+  }
+
+  test_fromEnvironment_int_undeclared_nullDefault() async {
+    _assertValidNull(await _check_fromEnvironment_int(null, "null"));
+  }
+
+  test_fromEnvironment_string_default_overridden() async {
+    expect(
+        _assertValidString(await _check_fromEnvironment_string("abc", "'def'")),
         "abc");
   }
 
-  void test_fromEnvironment_string_default_undeclared() {
-    expect(_assertValidString(_check_fromEnvironment_string(null, "'def'")),
+  test_fromEnvironment_string_default_undeclared() async {
+    expect(
+        _assertValidString(await _check_fromEnvironment_string(null, "'def'")),
         "def");
   }
 
-  void test_fromEnvironment_string_empty() {
-    expect(_assertValidString(_check_fromEnvironment_string("", null)), "");
-  }
-
-  void test_fromEnvironment_string_ok() {
+  test_fromEnvironment_string_empty() async {
     expect(
-        _assertValidString(_check_fromEnvironment_string("abc", null)), "abc");
+        _assertValidString(await _check_fromEnvironment_string("", null)), "");
   }
 
-  void test_fromEnvironment_string_undeclared() {
-    _assertValidUnknown(_check_fromEnvironment_string(null, null));
+  test_fromEnvironment_string_ok() async {
+    expect(_assertValidString(await _check_fromEnvironment_string("abc", null)),
+        "abc");
   }
 
-  void test_fromEnvironment_string_undeclared_nullDefault() {
-    _assertValidNull(_check_fromEnvironment_string(null, "null"));
+  test_fromEnvironment_string_undeclared() async {
+    _assertValidUnknown(await _check_fromEnvironment_string(null, null));
   }
 
-  void test_instanceCreationExpression_computedField() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_fromEnvironment_string_undeclared_nullDefault() async {
+    _assertValidNull(await _check_fromEnvironment_string(null, "null"));
+  }
+
+  test_instanceCreationExpression_computedField() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A(4, 5);
 class A {
   const A(int i, int j) : k = 2 * i + j;
@@ -723,28 +738,24 @@
     _assertIntField(fields, "k", 13);
   }
 
-  void
-      test_instanceCreationExpression_computedField_namedOptionalWithDefault() {
-    _checkInstanceCreationOptionalParams(false, true, true);
+  test_instanceCreationExpression_computedField_namedOptionalWithDefault() async {
+    await _checkInstanceCreationOptionalParams(false, true, true);
   }
 
-  void
-      test_instanceCreationExpression_computedField_namedOptionalWithoutDefault() {
-    _checkInstanceCreationOptionalParams(false, true, false);
+  test_instanceCreationExpression_computedField_namedOptionalWithoutDefault() async {
+    await _checkInstanceCreationOptionalParams(false, true, false);
   }
 
-  void
-      test_instanceCreationExpression_computedField_unnamedOptionalWithDefault() {
-    _checkInstanceCreationOptionalParams(false, false, true);
+  test_instanceCreationExpression_computedField_unnamedOptionalWithDefault() async {
+    await _checkInstanceCreationOptionalParams(false, false, true);
   }
 
-  void
-      test_instanceCreationExpression_computedField_unnamedOptionalWithoutDefault() {
-    _checkInstanceCreationOptionalParams(false, false, false);
+  test_instanceCreationExpression_computedField_unnamedOptionalWithoutDefault() async {
+    await _checkInstanceCreationOptionalParams(false, false, false);
   }
 
-  void test_instanceCreationExpression_computedField_usesConstConstructor() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_computedField_usesConstConstructor() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A(3);
 class A {
   const A(int i) : b = const B(4);
@@ -764,8 +775,8 @@
     _assertIntField(fieldsOfB, "k", 4);
   }
 
-  void test_instanceCreationExpression_computedField_usesStaticConst() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_computedField_usesStaticConst() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A(3);
 class A {
   const A(int i) : k = i + B.bar;
@@ -781,8 +792,8 @@
     _assertIntField(fields, "k", 7);
   }
 
-  void test_instanceCreationExpression_computedField_usesTopLevelConst() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_computedField_usesTopLevelConst() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A(3);
 const bar = 4;
 class A {
@@ -796,8 +807,8 @@
     _assertIntField(fields, "k", 7);
   }
 
-  void test_instanceCreationExpression_explicitSuper() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_explicitSuper() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const B(4, 5);
 class A {
   const A(this.x);
@@ -818,8 +829,8 @@
     _assertIntField(superclassFields, "x", 8);
   }
 
-  void test_instanceCreationExpression_fieldFormalParameter() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_fieldFormalParameter() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A(42);
 class A {
   int x;
@@ -832,28 +843,24 @@
     _assertIntField(fields, "x", 42);
   }
 
-  void
-      test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithDefault() {
-    _checkInstanceCreationOptionalParams(true, true, true);
+  test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithDefault() async {
+    await _checkInstanceCreationOptionalParams(true, true, true);
   }
 
-  void
-      test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithoutDefault() {
-    _checkInstanceCreationOptionalParams(true, true, false);
+  test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithoutDefault() async {
+    await _checkInstanceCreationOptionalParams(true, true, false);
   }
 
-  void
-      test_instanceCreationExpression_fieldFormalParameter_unnamedOptionalWithDefault() {
-    _checkInstanceCreationOptionalParams(true, false, true);
+  test_instanceCreationExpression_fieldFormalParameter_unnamedOptionalWithDefault() async {
+    await _checkInstanceCreationOptionalParams(true, false, true);
   }
 
-  void
-      test_instanceCreationExpression_fieldFormalParameter_unnamedOptionalWithoutDefault() {
-    _checkInstanceCreationOptionalParams(true, false, false);
+  test_instanceCreationExpression_fieldFormalParameter_unnamedOptionalWithoutDefault() async {
+    await _checkInstanceCreationOptionalParams(true, false, false);
   }
 
-  void test_instanceCreationExpression_implicitSuper() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_implicitSuper() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const B(4);
 class A {
   const A() : x = 3;
@@ -874,8 +881,8 @@
     _assertIntField(superclassFields, "x", 3);
   }
 
-  void test_instanceCreationExpression_nonFactoryRedirect() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_nonFactoryRedirect() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A.a1();
 class A {
   const A.a1() : this.a2();
@@ -887,8 +894,8 @@
     _assertIntField(aFields, 'x', 5);
   }
 
-  void test_instanceCreationExpression_nonFactoryRedirect_arg() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_nonFactoryRedirect_arg() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A.a1(1);
 class A {
   const A.a1(x) : this.a2(x + 100);
@@ -900,11 +907,11 @@
     _assertIntField(aFields, 'y', 111);
   }
 
-  void test_instanceCreationExpression_nonFactoryRedirect_cycle() {
+  test_instanceCreationExpression_nonFactoryRedirect_cycle() async {
     // It is an error to have a cycle in non-factory redirects; however, we
     // need to make sure that even if the error occurs, attempting to evaluate
     // the constant will terminate.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A();
 class A {
   const A() : this.b();
@@ -913,8 +920,8 @@
     _assertValidUnknown(_evaluateTopLevelVariable(compilationUnit, "foo"));
   }
 
-  void test_instanceCreationExpression_nonFactoryRedirect_defaultArg() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_nonFactoryRedirect_defaultArg() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A.a1();
 class A {
   const A.a1() : this.a2();
@@ -926,8 +933,8 @@
     _assertIntField(aFields, 'y', 110);
   }
 
-  void test_instanceCreationExpression_nonFactoryRedirect_toMissing() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_nonFactoryRedirect_toMissing() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A.a1();
 class A {
   const A.a1() : this.a2();
@@ -938,8 +945,8 @@
     _assertType(_evaluateTopLevelVariable(compilationUnit, "foo"), "A");
   }
 
-  void test_instanceCreationExpression_nonFactoryRedirect_toNonConst() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_nonFactoryRedirect_toNonConst() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A.a1();
 class A {
   const A.a1() : this.a2();
@@ -951,8 +958,8 @@
     _assertType(_evaluateTopLevelVariable(compilationUnit, "foo"), "A");
   }
 
-  void test_instanceCreationExpression_nonFactoryRedirect_unnamed() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_nonFactoryRedirect_unnamed() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A.a1();
 class A {
   const A.a1() : this();
@@ -964,8 +971,8 @@
     _assertIntField(aFields, 'x', 5);
   }
 
-  void test_instanceCreationExpression_redirect() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_redirect() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A();
 class A {
   const factory A() = B;
@@ -976,11 +983,11 @@
     _assertType(_evaluateTopLevelVariable(compilationUnit, "foo"), "B");
   }
 
-  void test_instanceCreationExpression_redirect_cycle() {
+  test_instanceCreationExpression_redirect_cycle() async {
     // It is an error to have a cycle in factory redirects; however, we need
     // to make sure that even if the error occurs, attempting to evaluate the
     // constant will terminate.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A();
 class A {
   const factory A() = A.b;
@@ -989,8 +996,8 @@
     _assertValidUnknown(_evaluateTopLevelVariable(compilationUnit, "foo"));
   }
 
-  void test_instanceCreationExpression_redirect_external() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_redirect_external() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A();
 class A {
   external const factory A();
@@ -998,11 +1005,11 @@
     _assertValidUnknown(_evaluateTopLevelVariable(compilationUnit, "foo"));
   }
 
-  void test_instanceCreationExpression_redirect_nonConst() {
+  test_instanceCreationExpression_redirect_nonConst() async {
     // It is an error for a const factory constructor redirect to a non-const
     // constructor; however, we need to make sure that even if the error
     // attempting to evaluate the constant won't cause a crash.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const foo = const A();
 class A {
   const factory A() = A.b;
@@ -1011,8 +1018,8 @@
     _assertValidUnknown(_evaluateTopLevelVariable(compilationUnit, "foo"));
   }
 
-  void test_instanceCreationExpression_redirectWithTypeParams() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_redirectWithTypeParams() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class A {
   const factory A(var a) = B<int>;
 }
@@ -1030,11 +1037,11 @@
     _assertIntField(fields, "x", 10);
   }
 
-  void test_instanceCreationExpression_redirectWithTypeSubstitution() {
+  test_instanceCreationExpression_redirectWithTypeSubstitution() async {
     // To evaluate the redirection of A<int>,
     // A's template argument (T=int) must be substituted
     // into B's template argument (B<U> where U=T) to get B<int>.
-    CompilationUnit compilationUnit = resolveSource(r'''
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class A<T> {
   const factory A(var a) = B<T>;
 }
@@ -1052,9 +1059,9 @@
     _assertIntField(fields, "x", 10);
   }
 
-  void test_instanceCreationExpression_symbol() {
+  test_instanceCreationExpression_symbol() async {
     CompilationUnit compilationUnit =
-        resolveSource("const foo = const Symbol('a');");
+        await resolveSource("const foo = const Symbol('a');");
     EvaluationResultImpl evaluationResult =
         _evaluateTopLevelVariable(compilationUnit, "foo");
     expect(evaluationResult.value, isNotNull);
@@ -1063,16 +1070,16 @@
     expect(value.toSymbolValue(), "a");
   }
 
-  void test_instanceCreationExpression_withSupertypeParams_explicit() {
-    _checkInstanceCreation_withSupertypeParams(true);
+  test_instanceCreationExpression_withSupertypeParams_explicit() async {
+    await _checkInstanceCreation_withSupertypeParams(true);
   }
 
-  void test_instanceCreationExpression_withSupertypeParams_implicit() {
-    _checkInstanceCreation_withSupertypeParams(false);
+  test_instanceCreationExpression_withSupertypeParams_implicit() async {
+    await _checkInstanceCreation_withSupertypeParams(false);
   }
 
-  void test_instanceCreationExpression_withTypeParams() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_instanceCreationExpression_withTypeParams() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 class C<E> {
   const C();
 }
@@ -1089,7 +1096,7 @@
     expect(c_int_value == c_num_value, isFalse);
   }
 
-  void test_isValidSymbol() {
+  test_isValidSymbol() async {
     expect(ConstantEvaluationEngine.isValidPublicSymbol(""), isTrue);
     expect(ConstantEvaluationEngine.isValidPublicSymbol("foo"), isTrue);
     expect(ConstantEvaluationEngine.isValidPublicSymbol("foo.bar"), isTrue);
@@ -1116,11 +1123,11 @@
     expect(ConstantEvaluationEngine.isValidPublicSymbol("foo.void"), isFalse);
   }
 
-  void test_length_of_improperly_typed_string_expression() {
+  test_length_of_improperly_typed_string_expression() async {
     // Since type annotations are ignored in unchecked mode, the improper
     // types on s1 and s2 shouldn't prevent us from evaluating i to
     // 'alpha'.length.
-    CompilationUnit compilationUnit = resolveSource('''
+    CompilationUnit compilationUnit = await resolveSource('''
 const int s1 = 'alpha';
 const int s2 = 'beta';
 const int i = (true ? s1 : s2).length;
@@ -1131,10 +1138,10 @@
     expect(_assertValidInt(result), 5);
   }
 
-  void test_length_of_improperly_typed_string_identifier() {
+  test_length_of_improperly_typed_string_identifier() async {
     // Since type annotations are ignored in unchecked mode, the improper type
     // on s shouldn't prevent us from evaluating i to 'alpha'.length.
-    CompilationUnit compilationUnit = resolveSource('''
+    CompilationUnit compilationUnit = await resolveSource('''
 const int s = 'alpha';
 const int i = s.length;
 ''');
@@ -1144,10 +1151,10 @@
     expect(_assertValidInt(result), 5);
   }
 
-  void test_non_static_const_initialized_at_declaration() {
+  test_non_static_const_initialized_at_declaration() async {
     // Even though non-static consts are not allowed by the language, we need
     // to handle them for error recovery purposes.
-    CompilationUnit compilationUnit = resolveSource('''
+    CompilationUnit compilationUnit = await resolveSource('''
 class A {
   const int i = 123;
   const A();
@@ -1162,9 +1169,9 @@
     _assertIntField(fields, "i", 123);
   }
 
-  void test_symbolLiteral_void() {
+  test_symbolLiteral_void() async {
     CompilationUnit compilationUnit =
-        resolveSource("const voidSymbol = #void;");
+        await resolveSource("const voidSymbol = #void;");
     VariableDeclaration voidSymbol =
         findTopLevelDeclaration(compilationUnit, "voidSymbol");
     EvaluationResultImpl voidSymbolResult =
@@ -1195,8 +1202,8 @@
     expect(field.isNull, isTrue);
   }
 
-  void _assertProperDependencies(String sourceText,
-      [List<ErrorCode> expectedErrorCodes = const <ErrorCode>[]]) {
+  Future<Null> _assertProperDependencies(String sourceText,
+      [List<ErrorCode> expectedErrorCodes = const <ErrorCode>[]]) async {
     Source source = addSource(sourceText);
     LibraryElement element = resolve2(source);
     CompilationUnit unit =
@@ -1205,6 +1212,7 @@
     ConstantValueComputer computer = _makeConstantValueComputer();
     computer.add(unit);
     computer.computeValues();
+    await computeAnalysisResult(source);
     assertErrors(source, expectedErrorCodes);
   }
 
@@ -1252,51 +1260,67 @@
     expect(value.isUnknown, isTrue);
   }
 
-  EvaluationResultImpl _check_fromEnvironment_bool(
-      String valueInEnvironment, String defaultExpr) {
+  Future<EvaluationResultImpl> _check_fromEnvironment_bool(
+      String valueInEnvironment, String defaultExpr) async {
     String envVarName = "x";
     String varName = "foo";
     if (valueInEnvironment != null) {
-      analysisContext2.declaredVariables.define(envVarName, valueInEnvironment);
+      if (enableNewAnalysisDriver) {
+        driver.declaredVariables.define(envVarName, valueInEnvironment);
+      } else {
+        analysisContext2.declaredVariables
+            .define(envVarName, valueInEnvironment);
+      }
     }
     String defaultArg =
         defaultExpr == null ? "" : ", defaultValue: $defaultExpr";
-    CompilationUnit compilationUnit = resolveSource(
+    CompilationUnit compilationUnit = await resolveSource(
         "const $varName = const bool.fromEnvironment('$envVarName'$defaultArg);");
     return _evaluateTopLevelVariable(compilationUnit, varName);
   }
 
-  EvaluationResultImpl _check_fromEnvironment_int(
-      String valueInEnvironment, String defaultExpr) {
+  Future<EvaluationResultImpl> _check_fromEnvironment_int(
+      String valueInEnvironment, String defaultExpr) async {
     String envVarName = "x";
     String varName = "foo";
     if (valueInEnvironment != null) {
-      analysisContext2.declaredVariables.define(envVarName, valueInEnvironment);
+      if (enableNewAnalysisDriver) {
+        driver.declaredVariables.define(envVarName, valueInEnvironment);
+      } else {
+        analysisContext2.declaredVariables
+            .define(envVarName, valueInEnvironment);
+      }
     }
     String defaultArg =
         defaultExpr == null ? "" : ", defaultValue: $defaultExpr";
-    CompilationUnit compilationUnit = resolveSource(
+    CompilationUnit compilationUnit = await resolveSource(
         "const $varName = const int.fromEnvironment('$envVarName'$defaultArg);");
     return _evaluateTopLevelVariable(compilationUnit, varName);
   }
 
-  EvaluationResultImpl _check_fromEnvironment_string(
-      String valueInEnvironment, String defaultExpr) {
+  Future<EvaluationResultImpl> _check_fromEnvironment_string(
+      String valueInEnvironment, String defaultExpr) async {
     String envVarName = "x";
     String varName = "foo";
     if (valueInEnvironment != null) {
-      analysisContext2.declaredVariables.define(envVarName, valueInEnvironment);
+      if (enableNewAnalysisDriver) {
+        driver.declaredVariables.define(envVarName, valueInEnvironment);
+      } else {
+        analysisContext2.declaredVariables
+            .define(envVarName, valueInEnvironment);
+      }
     }
     String defaultArg =
         defaultExpr == null ? "" : ", defaultValue: $defaultExpr";
-    CompilationUnit compilationUnit = resolveSource(
+    CompilationUnit compilationUnit = await resolveSource(
         "const $varName = const String.fromEnvironment('$envVarName'$defaultArg);");
     return _evaluateTopLevelVariable(compilationUnit, varName);
   }
 
-  void _checkInstanceCreation_withSupertypeParams(bool isExplicit) {
+  Future<Null> _checkInstanceCreation_withSupertypeParams(
+      bool isExplicit) async {
     String superCall = isExplicit ? " : super()" : "";
-    CompilationUnit compilationUnit = resolveSource("""
+    CompilationUnit compilationUnit = await resolveSource("""
 class A<T> {
   const A();
 }
@@ -1320,13 +1344,13 @@
     _assertFieldType(c_int_num_fields, GenericState.SUPERCLASS_FIELD, "A<num>");
   }
 
-  void _checkInstanceCreationOptionalParams(
-      bool isFieldFormal, bool isNamed, bool hasDefault) {
+  Future<Null> _checkInstanceCreationOptionalParams(
+      bool isFieldFormal, bool isNamed, bool hasDefault) async {
     String fieldName = "j";
     String paramName = isFieldFormal ? fieldName : "i";
     String formalParam =
         "${isFieldFormal ? "this." : "int "}$paramName${hasDefault ? " = 3" : ""}";
-    CompilationUnit compilationUnit = resolveSource("""
+    CompilationUnit compilationUnit = await resolveSource("""
 const x = const A();
 const y = const A(${isNamed ? '$paramName: ' : ''}10);
 class A {
@@ -1406,7 +1430,7 @@
 
 @reflectiveTest
 class ConstantVisitorTest extends ResolverTestCase {
-  void test_visitBinaryExpression_questionQuestion_notNull_notNull() {
+  test_visitBinaryExpression_questionQuestion_notNull_notNull() async {
     Expression left = AstTestFactory.string2('a');
     Expression right = AstTestFactory.string2('b');
     Expression expression = AstTestFactory.binaryExpression(
@@ -1422,7 +1446,7 @@
     errorListener.assertNoErrors();
   }
 
-  void test_visitBinaryExpression_questionQuestion_null_notNull() {
+  test_visitBinaryExpression_questionQuestion_null_notNull() async {
     Expression left = AstTestFactory.nullLiteral();
     Expression right = AstTestFactory.string2('b');
     Expression expression = AstTestFactory.binaryExpression(
@@ -1438,7 +1462,7 @@
     errorListener.assertNoErrors();
   }
 
-  void test_visitBinaryExpression_questionQuestion_null_null() {
+  test_visitBinaryExpression_questionQuestion_null_null() async {
     Expression left = AstTestFactory.nullLiteral();
     Expression right = AstTestFactory.nullLiteral();
     Expression expression = AstTestFactory.binaryExpression(
@@ -1453,7 +1477,7 @@
     errorListener.assertNoErrors();
   }
 
-  void test_visitConditionalExpression_false() {
+  test_visitConditionalExpression_false() async {
     Expression thenExpression = AstTestFactory.integer(1);
     Expression elseExpression = AstTestFactory.integer(0);
     ConditionalExpression expression = AstTestFactory.conditionalExpression(
@@ -1465,7 +1489,7 @@
     errorListener.assertNoErrors();
   }
 
-  void test_visitConditionalExpression_nonBooleanCondition() {
+  test_visitConditionalExpression_nonBooleanCondition() async {
     Expression thenExpression = AstTestFactory.integer(1);
     Expression elseExpression = AstTestFactory.integer(0);
     NullLiteral conditionExpression = AstTestFactory.nullLiteral();
@@ -1480,7 +1504,7 @@
         .assertErrorsWithCodes([CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL]);
   }
 
-  void test_visitConditionalExpression_nonConstantElse() {
+  test_visitConditionalExpression_nonConstantElse() async {
     Expression thenExpression = AstTestFactory.integer(1);
     Expression elseExpression = AstTestFactory.identifier3("x");
     ConditionalExpression expression = AstTestFactory.conditionalExpression(
@@ -1494,7 +1518,7 @@
         .assertErrorsWithCodes([CompileTimeErrorCode.INVALID_CONSTANT]);
   }
 
-  void test_visitConditionalExpression_nonConstantThen() {
+  test_visitConditionalExpression_nonConstantThen() async {
     Expression thenExpression = AstTestFactory.identifier3("x");
     Expression elseExpression = AstTestFactory.integer(0);
     ConditionalExpression expression = AstTestFactory.conditionalExpression(
@@ -1508,7 +1532,7 @@
         .assertErrorsWithCodes([CompileTimeErrorCode.INVALID_CONSTANT]);
   }
 
-  void test_visitConditionalExpression_true() {
+  test_visitConditionalExpression_true() async {
     Expression thenExpression = AstTestFactory.integer(1);
     Expression elseExpression = AstTestFactory.integer(0);
     ConditionalExpression expression = AstTestFactory.conditionalExpression(
@@ -1520,8 +1544,8 @@
     errorListener.assertNoErrors();
   }
 
-  void test_visitSimpleIdentifier_className() {
-    CompilationUnit compilationUnit = resolveSource('''
+  test_visitSimpleIdentifier_className() async {
+    CompilationUnit compilationUnit = await resolveSource('''
 const a = C;
 class C {}
 ''');
@@ -1530,8 +1554,8 @@
     expect(result.toTypeValue().name, 'C');
   }
 
-  void test_visitSimpleIdentifier_dynamic() {
-    CompilationUnit compilationUnit = resolveSource('''
+  test_visitSimpleIdentifier_dynamic() async {
+    CompilationUnit compilationUnit = await resolveSource('''
 const a = dynamic;
 ''');
     DartObjectImpl result = _evaluateConstant(compilationUnit, 'a', null);
@@ -1539,8 +1563,8 @@
     expect(result.toTypeValue(), typeProvider.dynamicType);
   }
 
-  void test_visitSimpleIdentifier_inEnvironment() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_visitSimpleIdentifier_inEnvironment() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const a = b;
 const b = 3;''');
     Map<String, DartObjectImpl> environment = new Map<String, DartObjectImpl>();
@@ -1550,8 +1574,8 @@
     _assertValue(6, _evaluateConstant(compilationUnit, "a", environment));
   }
 
-  void test_visitSimpleIdentifier_notInEnvironment() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_visitSimpleIdentifier_notInEnvironment() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const a = b;
 const b = 3;''');
     Map<String, DartObjectImpl> environment = new Map<String, DartObjectImpl>();
@@ -1561,8 +1585,8 @@
     _assertValue(3, _evaluateConstant(compilationUnit, "a", environment));
   }
 
-  void test_visitSimpleIdentifier_withoutEnvironment() {
-    CompilationUnit compilationUnit = resolveSource(r'''
+  test_visitSimpleIdentifier_withoutEnvironment() async {
+    CompilationUnit compilationUnit = await resolveSource(r'''
 const a = b;
 const b = 3;''');
     _assertValue(3, _evaluateConstant(compilationUnit, "a", null));
@@ -1580,16 +1604,17 @@
   }
 
   DartObjectImpl _evaluate(Expression expression, ErrorReporter errorReporter) {
+    TestTypeProvider typeProvider = new TestTypeProvider();
     return expression.accept(new ConstantVisitor(
-        new ConstantEvaluationEngine(
-            new TestTypeProvider(), new DeclaredVariables(),
-            typeSystem: new TypeSystemImpl()),
+        new ConstantEvaluationEngine(typeProvider, new DeclaredVariables(),
+            typeSystem: new TypeSystemImpl(typeProvider)),
         errorReporter));
   }
 
   DartObjectImpl _evaluateConstant(CompilationUnit compilationUnit, String name,
       Map<String, DartObjectImpl> lexicalEnvironment) {
-    Source source = compilationUnit.element.source;
+    Source source =
+        resolutionMap.elementDeclaredByCompilationUnit(compilationUnit).source;
     Expression expression =
         findTopLevelConstantExpression(compilationUnit, name);
     GatheringErrorListener errorListener = new GatheringErrorListener();
@@ -1608,6 +1633,6 @@
 class StrongConstantValueComputerTest extends ConstantValueComputerTest {
   void setUp() {
     super.setUp();
-    resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
+    resetWith(options: new AnalysisOptionsImpl()..strongMode = true);
   }
 }
diff --git a/pkg/analyzer/test/src/dart/constant/utilities_test.dart b/pkg/analyzer/test/src/dart/constant/utilities_test.dart
index 9920600..bf382f1 100644
--- a/pkg/analyzer/test/src/dart/constant/utilities_test.dart
+++ b/pkg/analyzer/test/src/dart/constant/utilities_test.dart
@@ -5,6 +5,7 @@
 library analyzer.test.src.dart.constant.utilities_test;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/src/dart/ast/token.dart';
@@ -65,7 +66,7 @@
     // Analyzer ignores annotations on enum constant declarations.
     Annotation annotation = AstTestFactory.annotation2(
         AstTestFactory.identifier3('A'), null, AstTestFactory.argumentList());
-    _node = new EnumConstantDeclaration(
+    _node = astFactory.enumConstantDeclaration(
         null, <Annotation>[annotation], AstTestFactory.identifier3('C'));
     expect(_findConstants(), isEmpty);
   }
diff --git a/pkg/analyzer/test/src/dart/element/element_test.dart b/pkg/analyzer/test/src/dart/element/element_test.dart
index 5c691e3..da65a63 100644
--- a/pkg/analyzer/test/src/dart/element/element_test.dart
+++ b/pkg/analyzer/test/src/dart/element/element_test.dart
@@ -40,6 +40,7 @@
     defineReflectiveTests(ElementImplTest);
     defineReflectiveTests(LibraryElementImplTest);
     defineReflectiveTests(MethodElementImplTest);
+    defineReflectiveTests(MethodMemberTest);
     defineReflectiveTests(MultiplyDefinedElementImplTest);
     defineReflectiveTests(ParameterElementImplTest);
     defineReflectiveTests(PropertyAccessorElementImplTest);
@@ -1819,8 +1820,8 @@
     // () -> B <: () -> A
     ClassElement a = ElementFactory.classElement2("A");
     ClassElement b = ElementFactory.classElement("B", a.type);
-    FunctionType t = ElementFactory.functionElement2("t", a).type;
-    FunctionType s = ElementFactory.functionElement2("s", b).type;
+    FunctionType t = ElementFactory.functionElement2("t", a.type).type;
+    FunctionType s = ElementFactory.functionElement2("s", b.type).type;
     expect(t.isSubtypeOf(s), isTrue);
     expect(s.isSubtypeOf(t), isTrue);
   }
@@ -1828,10 +1829,10 @@
   void test_isSubtypeOf_returnType_tNotAssignableToS() {
     // ! () -> A <: () -> B
     FunctionType t = ElementFactory
-        .functionElement2("t", ElementFactory.classElement2("A"))
+        .functionElement2("t", ElementFactory.classElement2("A").type)
         .type;
     FunctionType s = ElementFactory
-        .functionElement2("s", ElementFactory.classElement2("B"))
+        .functionElement2("s", ElementFactory.classElement2("B").type)
         .type;
     expect(t.isSubtypeOf(s), isFalse);
   }
@@ -4014,6 +4015,49 @@
 }
 
 @reflectiveTest
+class MethodMemberTest extends EngineTestCase {
+  /**
+   * The type provider used to access the types.
+   */
+  TestTypeProvider _typeProvider;
+
+  @override
+  void setUp() {
+    super.setUp();
+    _typeProvider = new TestTypeProvider();
+  }
+
+  void test_getReifiedType_substituteFor() {
+    AnalysisOptionsImpl options = new AnalysisOptionsImpl();
+    options.analyzeFunctionBodies = false;
+    AnalysisContextHelper contextHelper = new AnalysisContextHelper(options);
+    AnalysisContext context = contextHelper.context;
+    Source source = contextHelper.addSource(
+        "/test.dart",
+        r'''
+class A<T> {
+  T f(T x) => x;
+}
+class B<S> extends A<S> {
+  S f(S x) => x;
+}
+''');
+    // prepare CompilationUnitElement
+    LibraryElement libraryElement = context.computeLibraryElement(source);
+    CompilationUnitElement unitElement = libraryElement.definingCompilationUnit;
+    DartType objectType = _typeProvider.objectType;
+    // B.f
+    ClassElement elementB = unitElement.getType("B");
+    MethodElement BfElement = elementB.type
+        .lookUpInheritedMethod("f", library: libraryElement, thisType: true);
+    MethodElement AfElement = elementB.type
+        .lookUpInheritedMethod("f", library: libraryElement, thisType: false);
+    expect(BfElement.getReifiedType(objectType),
+        equals(AfElement.getReifiedType(objectType)));
+  }
+}
+
+@reflectiveTest
 class MultiplyDefinedElementImplTest extends EngineTestCase {
   void test_fromElements_conflicting() {
     TopLevelVariableElement firstElement =
diff --git a/pkg/analyzer/test/src/dart/sdk/patch_test.dart b/pkg/analyzer/test/src/dart/sdk/patch_test.dart
index dc3a903..ec02930 100644
--- a/pkg/analyzer/test/src/dart/sdk/patch_test.dart
+++ b/pkg/analyzer/test/src/dart/sdk/patch_test.dart
@@ -9,7 +9,6 @@
 import 'package:analyzer/src/dart/sdk/patch.dart';
 import 'package:analyzer/src/dart/sdk/sdk.dart';
 import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/util/fast_uri.dart';
 import 'package:test/test.dart';
@@ -163,6 +162,63 @@
     }, throwsArgumentError);
   }
 
+  test_class_constructor_patch_fail_fieldFormalParam_inBase() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  int f;
+  external C.named(this.f);
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  C.named() : f = 2 {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_constructor_patch_fail_fieldFormalParam_inPatch() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  int f;
+  external C.named(int f);
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  C.named(this.f) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_constructor_patch_fail_fieldFormalParam_inPatchAndBase() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  int f;
+  external C.named(this.f);
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  C.named(this.f) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
   test_class_constructor_patch_fail_hasInitializers() {
     expect(() {
       _doTopLevelPatching(
@@ -200,6 +256,42 @@
     }, throwsArgumentError);
   }
 
+  test_class_constructor_patch_fail_signatureChange() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external C.named(int x);
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  C.named(double x) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_constructor_patch_fail_signatureChange_nameOnly() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external C.named(int x);
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  C.named(int y) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
   test_class_constructor_patch_initializers() {
     CompilationUnit unit = _doTopLevelPatching(
         r'''
@@ -411,6 +503,254 @@
     }, throwsArgumentError);
   }
 
+  test_class_method_patch_fail_signatureChange() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external void f(int x);
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  void f(double x) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_fail_signatureChange_extraArgument() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external void f();
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  void f(int x) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_fail_signatureChange_extraTypeTokens() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external List f();
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  List<int> f() => null;
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_fail_signatureChange_functionTypedParam_paramType() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external void f(void x(int y));
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  void f(void x(double y)) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_fail_signatureChange_functionTypedParam_returnType() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external void f(int x());
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  void f(double x()) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_fail_signatureChange_makeReturnTypeExplicit() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external f();
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  int f() => 0;
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_fail_signatureChange_missingArgument() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external void f(int x);
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  void f() {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_fail_signatureChange_missingTypeTokens() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external List<int> f();
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  List f() => null;
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_fail_signatureChange_nameOnly() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external void f(int x);
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  void f(int y) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_fail_signatureChange_returnTypeOnly() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+class C {
+  external void f(int x);
+}
+''',
+          r'''
+@patch
+class C {
+  @patch
+  int f(int x) {}
+}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_class_method_patch_success_defaultFormalParameter() {
+    CompilationUnit unit = _doTopLevelPatching(
+        r'''
+class C {
+  external void f(int x = 0);
+}
+''',
+        r'''
+@patch
+class C {
+  @patch
+  void f(int x) {}
+}
+''');
+    ClassDeclaration cls = unit.declarations[0];
+    MethodDeclaration method = cls.members[0];
+    FormalParameter parameter = method.parameters.parameters[0];
+    expect(parameter, new isInstanceOf<DefaultFormalParameter>());
+  }
+
+  test_class_method_patch_success_implicitReturnType() {
+    _doTopLevelPatching(
+        r'''
+class C {
+  external f();
+}
+''',
+        r'''
+@patch
+class C {
+  @patch
+  f() => null;
+}
+''');
+  }
+
+  test_class_method_patch_success_multiTokenReturnType() {
+    _doTopLevelPatching(
+        r'''
+class C {
+  external List<int> f();
+}
+''',
+        r'''
+@patch
+class C {
+  @patch
+  List<int> f() => null;
+}
+''');
+  }
+
+  test_class_method_patch_success_signatureChange_functionTypedParam_matching() {
+    _doTopLevelPatching(
+        r'''
+class C {
+  external void f(void x(int y));
+}
+''',
+        r'''
+@patch
+class C {
+  @patch
+  void f(void x(int y)) {}
+}
+''');
+  }
+
   test_class_setter_append() {
     CompilationUnit unit = _doTopLevelPatching(
         r'''
@@ -453,30 +793,21 @@
         "import 'a.dart'; part 'b.dart'; import 'c.dart'; int bar() => 0;");
   }
 
-  test_fail_noSuchLibrary() {
-    expect(() {
-      _setSdkLibraries('const LIBRARIES = const {};');
-      _createSdk();
-      File file = provider.newFile(_p('/sdk/lib/test/test.dart'), '');
-      Source source = file.createSource(FastUri.parse('dart:test'));
-      CompilationUnit unit = SdkPatcher.parse(source, true, listener);
-      patcher.patch(sdk, SdkLibraryImpl.VM_PLATFORM, listener, source, unit);
-    }, throwsArgumentError);
-  }
-
   test_fail_patchFileDoesNotExist() {
     expect(() {
       _setSdkLibraries(r'''
 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
   'test' : const LibraryInfo(
-    'test/test.dart',
-    patches: {VM_PLATFORM: ['does_not_exists.dart']}),
+    'test/test.dart'),
 };''');
       _createSdk();
+      var patchPaths = {
+        'dart:test': [_p('/sdk/lib/does_not_exist.dart')]
+      };
       File file = provider.newFile(_p('/sdk/lib/test/test.dart'), '');
       Source source = file.createSource(FastUri.parse('dart:test'));
       CompilationUnit unit = SdkPatcher.parse(source, true, listener);
-      patcher.patch(sdk, SdkLibraryImpl.VM_PLATFORM, listener, source, unit);
+      patcher.patch(provider, true, patchPaths, listener, source, unit);
     }, throwsArgumentError);
   }
 
@@ -484,9 +815,11 @@
     _setSdkLibraries(r'''
 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
   '_internal' : const LibraryInfo(
-    'internal/internal.dart',
-    patches: {VM_PLATFORM: ['internal/internal_patch.dart']}),
+    'internal/internal.dart'),
 };''');
+    var patchPaths = {
+      'dart:_internal': [_p('/sdk/lib/internal/internal_patch.dart')]
+    };
     File file = provider.newFile(
         _p('/sdk/lib/internal/internal.dart'),
         r'''
@@ -513,7 +846,7 @@
 
     Source source = file.createSource(FastUri.parse('dart:_internal'));
     CompilationUnit unit = SdkPatcher.parse(source, true, listener);
-    patcher.patch(sdk, SdkLibraryImpl.VM_PLATFORM, listener, source, unit);
+    patcher.patch(provider, true, patchPaths, listener, source, unit);
     _assertUnitCode(
         unit,
         'library dart._internal; class A {} '
@@ -537,6 +870,9 @@
     'test/test.dart',
     patches: {VM_PLATFORM: ['test/test_patch.dart']}),
 };''');
+    var patchPaths = {
+      'dart:test': [_p('/sdk/lib/test/test_patch.dart')]
+    };
     File fileLib = provider.newFile(_p('/sdk/lib/test/test.dart'), baseLibCode);
     File filePart =
         provider.newFile(_p('/sdk/lib/test/test_part.dart'), basePartCode);
@@ -564,7 +900,7 @@
       Uri uri = FastUri.parse('dart:test');
       Source source = fileLib.createSource(uri);
       CompilationUnit unit = SdkPatcher.parse(source, true, listener);
-      patcher.patch(sdk, SdkLibraryImpl.VM_PLATFORM, listener, source, unit);
+      patcher.patch(provider, true, patchPaths, listener, source, unit);
       _assertUnitCode(
           unit,
           "library test; part 'test_part.dart'; import 'foo.dart'; "
@@ -575,7 +911,7 @@
       Uri uri = FastUri.parse('dart:test/test_part.dart');
       Source source = filePart.createSource(uri);
       CompilationUnit unit = SdkPatcher.parse(source, true, listener);
-      patcher.patch(sdk, SdkLibraryImpl.VM_PLATFORM, listener, source, unit);
+      patcher.patch(provider, true, patchPaths, listener, source, unit);
       _assertUnitCode(unit, "part of test; class B {int _b() => 1;}");
     }
   }
@@ -621,18 +957,6 @@
     }, throwsArgumentError);
   }
 
-  test_topLevel_fail_topLevelVariable() {
-    expect(() {
-      _doTopLevelPatching(
-          r'''
-int foo() => 0;
-''',
-          r'''
-int _bar;
-''');
-    }, throwsArgumentError);
-  }
-
   test_topLevel_function_append() {
     CompilationUnit unit = _doTopLevelPatching(
         r'''
@@ -770,6 +1094,45 @@
     _assertUnitCode(unit, 'int foo() {int v = 1; return v + 2;}');
   }
 
+  test_topLevel_patch_function_fail_signatureChange() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+external void f(int x);
+''',
+          r'''
+@patch
+void f(double x) {}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_topLevel_patch_function_fail_signatureChange_nameOnly() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+external void f(int x);
+''',
+          r'''
+@patch
+void f(int y) {}
+''');
+    }, throwsArgumentError);
+  }
+
+  test_topLevel_patch_function_fail_signatureChange_returnTypeOnly() {
+    expect(() {
+      _doTopLevelPatching(
+          r'''
+external void f(int x);
+''',
+          r'''
+@patch
+int f(int x) {}
+''');
+    }, throwsArgumentError);
+  }
+
   test_topLevel_patch_getter() {
     CompilationUnit unit = _doTopLevelPatching(
         r'''
@@ -796,6 +1159,20 @@
     _assertUnitCode(unit, 'void set foo(int val) {} int bar() => 2;');
   }
 
+  test_topLevel_topLevelVariable_append() {
+    CompilationUnit unit = _doTopLevelPatching(
+        r'''
+int foo() => 0;
+''',
+        r'''
+int _bar;
+''');
+    _assertUnitCode(unit, 'int foo() => 0; int _bar;');
+    FunctionDeclaration a = unit.declarations[0];
+    TopLevelVariableDeclaration b = unit.declarations[1];
+    _assertPrevNextToken(a.endToken, b.beginToken);
+  }
+
   void _assertUnitCode(CompilationUnit unit, String expectedCode) {
     expect(unit.toSource(), expectedCode);
   }
@@ -809,9 +1186,11 @@
     _setSdkLibraries(r'''
 final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
   'test' : const LibraryInfo(
-    'test/test.dart',
-    patches: {VM_PLATFORM: ['test/test_patch.dart']}),
+    'test/test.dart'),
 };''');
+    var patchPaths = {
+      'dart:test': [_p('/sdk/lib/test/test_patch.dart')]
+    };
     File file = provider.newFile(_p('/sdk/lib/test/test.dart'), baseCode);
     provider.newFile(_p('/sdk/lib/test/test_patch.dart'), patchCode);
 
@@ -819,7 +1198,7 @@
 
     Source source = file.createSource(FastUri.parse('dart:test'));
     CompilationUnit unit = SdkPatcher.parse(source, true, listener);
-    patcher.patch(sdk, SdkLibraryImpl.VM_PLATFORM, listener, source, unit);
+    patcher.patch(provider, true, patchPaths, listener, source, unit);
     return unit;
   }
 
diff --git a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
index dbc0d01..3abf7c2 100644
--- a/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
+++ b/pkg/analyzer/test/src/dart/sdk/sdk_test.dart
@@ -26,7 +26,6 @@
     defineReflectiveTests(FolderBasedDartSdkTest);
     defineReflectiveTests(SdkExtensionFinderTest);
     defineReflectiveTests(SdkLibrariesReaderTest);
-    defineReflectiveTests(SdkLibraryImplTest);
   });
 }
 
@@ -60,38 +59,6 @@
     expectSource('$foxLib/deep/directory/part.dart', 'dart:deep/part.dart');
   }
 
-  void test_getLinkedBundle_hasBundle() {
-    pathTranslator.newFileWithBytes(
-        '$foxPath/sdk.ds', new PackageBundleAssembler().assemble().toBuffer());
-    EmbedderYamlLocator locator = new EmbedderYamlLocator({
-      'fox': <Folder>[pathTranslator.getResource(foxLib)]
-    });
-    // No bundle for spec mode.
-    {
-      EmbedderSdk sdk =
-          new EmbedderSdk(resourceProvider, locator.embedderYamls);
-      sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = false;
-      sdk.useSummary = true;
-      expect(sdk.getLinkedBundle(), isNull);
-    }
-    // Has bundle for strong mode.
-    {
-      EmbedderSdk sdk =
-          new EmbedderSdk(resourceProvider, locator.embedderYamls);
-      sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true;
-      sdk.useSummary = true;
-      expect(sdk.getLinkedBundle(), isNotNull);
-    }
-    // Don't use bundle if not enabled.
-    {
-      EmbedderSdk sdk =
-          new EmbedderSdk(resourceProvider, locator.embedderYamls);
-      sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true;
-      sdk.useSummary = false;
-      expect(sdk.getLinkedBundle(), isNull);
-    }
-  }
-
   void test_getLinkedBundle_noBundle() {
     EmbedderYamlLocator locator = new EmbedderYamlLocator({
       'fox': <Folder>[pathTranslator.getResource(foxLib)]
@@ -100,6 +67,30 @@
     expect(sdk.getLinkedBundle(), isNull);
   }
 
+  void test_getLinkedBundle_spec() {
+    pathTranslator.newFileWithBytes('$foxPath/spec.sum',
+        new PackageBundleAssembler().assemble().toBuffer());
+    EmbedderYamlLocator locator = new EmbedderYamlLocator({
+      'fox': <Folder>[pathTranslator.getResource(foxLib)]
+    });
+    EmbedderSdk sdk = new EmbedderSdk(resourceProvider, locator.embedderYamls);
+    sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = false;
+    sdk.useSummary = true;
+    expect(sdk.getLinkedBundle(), isNotNull);
+  }
+
+  void test_getLinkedBundle_strong() {
+    pathTranslator.newFileWithBytes('$foxPath/strong.sum',
+        new PackageBundleAssembler().assemble().toBuffer());
+    EmbedderYamlLocator locator = new EmbedderYamlLocator({
+      'fox': <Folder>[pathTranslator.getResource(foxLib)]
+    });
+    EmbedderSdk sdk = new EmbedderSdk(resourceProvider, locator.embedderYamls);
+    sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true;
+    sdk.useSummary = true;
+    expect(sdk.getLinkedBundle(), isNotNull);
+  }
+
   void test_getSdkLibrary() {
     EmbedderYamlLocator locator = new EmbedderYamlLocator({
       'fox': <Folder>[pathTranslator.getResource(foxLib)]
@@ -474,148 +465,4 @@
     expect(second.isImplementation, true);
     expect(second.isVmLibrary, false);
   }
-
-  void test_readFrom_patches() {
-    LibraryMap libraryMap = new SdkLibrariesReader(false).readFromFile(
-        resourceProvider.getFile('/libs.dart'),
-        r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
-  'foo' : const LibraryInfo(
-    'foo/foo.dart',
-    patches: {
-      DART2JS_PLATFORM | VM_PLATFORM: ['a', 'b'],
-      DART2JS_PLATFORM: ['c', 'd'],
-      VM_PLATFORM: ['e']}),
-};''');
-    expect(libraryMap, isNotNull);
-    expect(libraryMap.size(), 1);
-    SdkLibrary library = libraryMap.getLibrary('dart:foo');
-    expect(library, isNotNull);
-    expect(library.path, 'foo/foo.dart');
-    expect(library.shortName, 'dart:foo');
-    expect(library.getPatches(SdkLibraryImpl.DART2JS_PLATFORM),
-        unorderedEquals(['a', 'b', 'c', 'd']));
-    expect(library.getPatches(SdkLibraryImpl.VM_PLATFORM),
-        unorderedEquals(['a', 'b', 'e']));
-  }
-
-  void test_readFrom_patches_invalid_notList() {
-    expect(() {
-      new SdkLibrariesReader(false).readFromFile(
-          resourceProvider.getFile('/libs.dart'),
-          r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
-  'foo' : const LibraryInfo(
-    'foo/foo.dart',
-    patches: {
-      VM_PLATFORM: 'X'}),
-};''');
-    }, throwsArgumentError);
-  }
-
-  void test_readFrom_patches_invalid_notString_inList() {
-    expect(() {
-      new SdkLibrariesReader(false).readFromFile(
-          resourceProvider.getFile('/libs.dart'),
-          r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
-  'foo' : const LibraryInfo(
-    'foo/foo.dart',
-    patches: {
-      VM_PLATFORM: [42]}),
-};''');
-    }, throwsArgumentError);
-  }
-
-  void test_readFrom_patches_invalid_path_hasDotDot() {
-    _assertPatchPathIsInvalid('foo/../bar.dart');
-    _assertPatchPathIsInvalid('../foo/bar.dart');
-    _assertPatchPathIsInvalid('foo/bar..dart');
-  }
-
-  void test_readFrom_patches_invalid_path_isAbsolute() {
-    _assertPatchPathIsInvalid('/foo.dart');
-    _assertPatchPathIsInvalid('/foo/bar.dart');
-  }
-
-  void test_readFrom_patches_invalid_path_notPosix() {
-    _assertPatchPathIsInvalid(r'foo\bar.dart');
-  }
-
-  void test_readFrom_patches_invalid_platformCombinator() {
-    expect(() {
-      new SdkLibrariesReader(false).readFromFile(
-          resourceProvider.getFile('/libs.dart'),
-          r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
-  'foo' : const LibraryInfo(
-    'foo/foo.dart',
-    patches: {
-      DART2JS_PLATFORM + VM_PLATFORM: ['X']}),
-};''');
-    }, throwsArgumentError);
-  }
-
-  void test_readFrom_patches_invalid_unknownPlatform() {
-    expect(() {
-      new SdkLibrariesReader(false).readFromFile(
-          resourceProvider.getFile('/libs.dart'),
-          r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
-  'foo' : const LibraryInfo(
-    'foo/foo.dart',
-    patches: {
-      MY_UNKNOWN_PLATFORM: ['foo/bar_patch.dart']}),
-};''');
-    }, throwsArgumentError);
-  }
-
-  void test_readFrom_patches_no() {
-    LibraryMap libraryMap = new SdkLibrariesReader(false).readFromFile(
-        resourceProvider.getFile('/libs.dart'),
-        r'''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
-  'my' : const LibraryInfo('my/my.dart')
-};''');
-    expect(libraryMap, isNotNull);
-    expect(libraryMap.size(), 1);
-    SdkLibrary library = libraryMap.getLibrary('dart:my');
-    expect(library, isNotNull);
-    expect(library.path, 'my/my.dart');
-    expect(library.shortName, 'dart:my');
-    expect(library.getPatches(SdkLibraryImpl.VM_PLATFORM), isEmpty);
-    expect(library.getPatches(SdkLibraryImpl.DART2JS_PLATFORM), isEmpty);
-  }
-
-  void _assertPatchPathIsInvalid(String patchPath) {
-    expect(() {
-      new SdkLibrariesReader(false).readFromFile(
-          resourceProvider.getFile('/libs.dart'),
-          '''
-final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo> {
-  'foo' : const LibraryInfo(
-    'foo/foo.dart',
-    patches: {
-      VM_PLATFORM: [r'$patchPath']}),
-};''');
-    }, throwsArgumentError);
-  }
-}
-
-@reflectiveTest
-class SdkLibraryImplTest extends EngineTestCase {
-  void test_patches() {
-    SdkLibraryImpl library = new SdkLibraryImpl('dart:foo');
-    // Set patches.
-    library.setPatchPaths(
-        SdkLibraryImpl.DART2JS_PLATFORM | SdkLibraryImpl.VM_PLATFORM,
-        ['a', 'b']);
-    library.setPatchPaths(SdkLibraryImpl.DART2JS_PLATFORM, ['c', 'd']);
-    library.setPatchPaths(SdkLibraryImpl.VM_PLATFORM, ['e']);
-    // Get patches.
-    expect(library.getPatches(SdkLibraryImpl.DART2JS_PLATFORM),
-        unorderedEquals(['a', 'b', 'c', 'd']));
-    expect(library.getPatches(SdkLibraryImpl.VM_PLATFORM),
-        unorderedEquals(['a', 'b', 'e']));
-  }
 }
diff --git a/pkg/analyzer/test/src/lint/config_test.dart b/pkg/analyzer/test/src/lint/config_test.dart
new file mode 100644
index 0000000..44f385d
--- /dev/null
+++ b/pkg/analyzer/test/src/lint/config_test.dart
@@ -0,0 +1,206 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/lint/config.dart';
+import 'package:test/test.dart';
+
+main() {
+  defineTests();
+}
+
+defineTests() {
+  const src = """
+files:
+  include: foo # un-quoted
+  exclude:
+    - 'test/**'       # file globs can be scalars or lists
+    - '**/_data.dart' # unquoted stars treated by YAML as aliases
+rules:
+  style_guide:
+    unnecessary_getters: false #disable
+    camel_case_types: true #enable
+  pub:
+    package_names: false
+""";
+
+// In the future, options might be marshaled in maps and passed to rules.
+//  acme:
+//    some_rule:
+//      some_option: # Note this nesting might be arbitrarily complex?
+//        - param1
+//        - param2
+
+  var config = new LintConfig.parse(src);
+
+  group('lint config', () {
+    group('file', () {
+      test('includes', () {
+        expect(config.fileIncludes, unorderedEquals(['foo']));
+      });
+      test('excludes', () {
+        expect(
+            config.fileExcludes, unorderedEquals(['test/**', '**/_data.dart']));
+      });
+    });
+    group('rule', () {
+      test('configs', () {
+        expect(config.ruleConfigs, hasLength(3));
+      });
+
+      test('config', () {
+        config = new LintConfig.parse('''
+rules:
+  style_guide:
+    unnecessary_getters: false''');
+        expect(config.ruleConfigs, hasLength(1));
+        var ruleConfig = config.ruleConfigs[0];
+        expect(ruleConfig.group, 'style_guide');
+        expect(ruleConfig.name, 'unnecessary_getters');
+        expect(ruleConfig.args, {'enabled': false});
+        expect(ruleConfig.disables('unnecessary_getters'), isTrue);
+      });
+    });
+  });
+
+  group('analysis options', () {
+    group('parsing', () {
+      group('groups', () {
+        test('basic', () {
+          var src = '''
+plugin_a:
+  option_a: false
+plugin_b:
+  option_b: true
+linter:
+  rules:
+    style_guide:
+      unnecessary_getters: false #disable
+      camel_case_types: true #enable
+''';
+          var config = processAnalysisOptionsFile(src);
+          var ruleNames = config.ruleConfigs.map((rc) => rc.name);
+          expect(ruleNames, hasLength(2));
+          expect(ruleNames, contains('unnecessary_getters'));
+          expect(ruleNames, contains('camel_case_types'));
+        });
+      });
+
+      group('w/o groups', () {
+        test('rule list', () {
+          var src = '''
+plugin_a:
+  option_a: false
+plugin_b:
+  option_b: true
+linter:
+  rules:
+    - camel_case_types
+''';
+          var config = processAnalysisOptionsFile(src);
+          expect(config.ruleConfigs.length, 1);
+          // Verify that defaults are enabled.
+          expect(config.ruleConfigs[0].args['enabled'], isTrue);
+        });
+
+        test('rule map (bools)', () {
+          var src = '''
+plugin_a:
+  option_a: false
+plugin_b:
+  option_b: true
+linter:
+  rules:
+    camel_case_types: true #enable
+    unnecessary_getters: false #disable
+''';
+          var config = processAnalysisOptionsFile(src);
+          var ruleConfigs = config.ruleConfigs.toList();
+          ruleConfigs.sort(
+              (RuleConfig rc1, RuleConfig rc2) => rc1.name.compareTo(rc2.name));
+          expect(ruleConfigs, hasLength(2));
+          expect(ruleConfigs[0].name, 'camel_case_types');
+          expect(config.ruleConfigs[0].args['enabled'], isFalse);
+          expect(ruleConfigs[1].name, 'unnecessary_getters');
+          expect(config.ruleConfigs[1].args['enabled'], isTrue);
+        });
+      });
+    });
+
+    test('empty file', () {
+      expect(processAnalysisOptionsFile(''), isNull);
+    });
+
+    test('bad format', () {
+      expect(processAnalysisOptionsFile('foo: '), isNull);
+    });
+  });
+
+  group('options processing', () {
+    group('raw maps', () {
+      test('rule list', () {
+        Map options = {};
+        var lintOptions = {
+          'rules': ['camel_case_types']
+        };
+        options['linter'] = lintOptions;
+
+        var config = parseConfig(options);
+        expect(config, isNotNull);
+        expect(config.ruleConfigs, hasLength(1));
+      });
+
+      test('rule map (bool)', () {
+        Map options = {};
+        var lintOptions = {
+          'rules': {'camel_case_types': true}
+        };
+        options['linter'] = lintOptions;
+
+        var config = parseConfig(options);
+        expect(config, isNotNull);
+        expect(config.ruleConfigs, hasLength(1));
+      });
+
+      test('rule map (string)', () {
+        Map options = {};
+        var lintOptions = {
+          'rules': {'camel_case_types': 'true'}
+        };
+        options['linter'] = lintOptions;
+
+        var config = parseConfig(options);
+        expect(config, isNotNull);
+        expect(config.ruleConfigs, hasLength(1));
+      });
+
+      test('nested rule map (bool)', () {
+        Map options = {};
+        var lintOptions = {
+          'rules': {
+            'style_guide': {'camel_case_types': true}
+          }
+        };
+        options['linter'] = lintOptions;
+
+        var config = parseConfig(options);
+        expect(config, isNotNull);
+        expect(config.ruleConfigs, hasLength(1));
+      });
+
+      test('nested rule map (string)', () {
+        Map options = {};
+        var lintOptions = {
+          'rules': {
+            'style_guide': {'camel_case_types': true}
+          }
+        };
+        options['linter'] = lintOptions;
+
+        var config = parseConfig(options);
+        expect(config, isNotNull);
+        expect(config.ruleConfigs, hasLength(1));
+      });
+    });
+  });
+}
diff --git a/pkg/analyzer/test/src/lint/io_test.dart b/pkg/analyzer/test/src/lint/io_test.dart
new file mode 100644
index 0000000..3a377f0
--- /dev/null
+++ b/pkg/analyzer/test/src/lint/io_test.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:analyzer/src/lint/io.dart';
+import 'package:test/test.dart';
+
+main() {
+  defineTests();
+}
+
+defineTests() {
+  // TODO: redefine tests
+
+//  group('commandline args', () {
+//    var mockFile = new File('foo.dart');
+//    when(mockFile.absolute).thenReturn(mockFile);
+//
+//    var options = new LinterOptions(() => []);
+//    var mockLinter = new MockLinter();
+//    when(mockLinter.options).thenReturn(options);
+//
+//    lintFile(mockFile,
+//        dartSdkPath: '/path/to/sdk',
+//        packageRoot: '/my/pkgs',
+//        linter: mockLinter);
+//
+//    test('dartSdkPath', () {
+//      expect(options.dartSdkPath, equals('/path/to/sdk'));
+//      expect(options.packageRootPath, equals('/my/pkgs'));
+//    });
+//
+//    test('packageRoot', () {
+//      expect(options.dartSdkPath, equals('/path/to/sdk'));
+//      expect(options.packageRootPath, equals('/my/pkgs'));
+//    });
+//
+//    test('exception handling', () {
+//      var mockErr = new MockIOSink();
+//      std_err = mockErr;
+//      when(mockLinter.lintFiles(any)).thenAnswer((_) => throw 'err');
+//      expect(lintFiles([mockFile], linter: mockLinter), isFalse);
+//      verify(std_err.writeln(any)).called(1);
+//    });
+//  });
+
+  group('processing', () {
+    group('files', () {
+      test('dart', () {
+        var file = new File('foo.dart');
+        expect(isLintable(file), isTrue);
+      });
+      test('pubspec', () {
+        var file = new File('pubspec.yaml');
+        expect(isLintable(file), isTrue);
+      });
+      test('_pubspec', () {
+        // Analyzable for testing purposes
+        var file = new File('_pubspec.yaml');
+        expect(isLintable(file), isTrue);
+      });
+      test('text', () {
+        var file = new File('foo.txt');
+        expect(isLintable(file), isFalse);
+      });
+      test('hidden dirs', () {
+        expect(isInHiddenDir('.foo/'), isTrue);
+        expect(isInHiddenDir('.foo/bar'), isTrue);
+      });
+    });
+  });
+
+  // TODO(brianwilkerson) Rewrite this to use a memory resource provider.
+//  group('collecting', () {
+//    group('files', () {
+//      test('basic', () {
+//        expect(
+//            collectFiles(p.join('test', '_data', 'p1')).map((f) => f.path),
+//            unorderedEquals([
+//              p.join('test', '_data', 'p1', 'p1.dart'),
+//              p.join('test', '_data', 'p1', '_pubspec.yaml'),
+//              p.join('test', '_data', 'p1', 'src', 'p2.dart')
+//            ]));
+//      });
+//    });
+//  });
+}
diff --git a/pkg/analyzer/test/src/lint/project_test.dart b/pkg/analyzer/test/src/lint/project_test.dart
new file mode 100644
index 0000000..76282d1
--- /dev/null
+++ b/pkg/analyzer/test/src/lint/project_test.dart
@@ -0,0 +1,61 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+
+import 'package:analyzer/src/lint/project.dart';
+import 'package:test/test.dart';
+
+main() {
+//  defineTests();
+}
+
+defineTests() {
+  group('project', () {
+    group('basic', () {
+      // TODO(brianwilkerson) These tests fail on the bots because the cwd is
+      // not the same there as when we run tests locally.
+      group('cwd', () {
+        var project = new DartProject(null, null);
+        test('name', () {
+          expect(project.name, 'analyzer');
+        });
+        test('spec', () {
+          expect(project.pubspec, isNotNull);
+        });
+        test('root', () {
+          expect(project.root.path, Directory.current.path);
+        });
+      });
+      // TODO(brianwilkerson) Rewrite these to use a memory resource provider.
+//      group('p1', () {
+//        var project =
+//            new DartProject(null, null, dir: new Directory('test/_data/p1'));
+//        test('name', () {
+//          expect(project.name, 'p1');
+//        });
+//        test('spec', () {
+//          expect(project.pubspec, isNotNull);
+//          expect(project.pubspec.name.value.text, 'p1');
+//        });
+//        test('root', () {
+//          expect(project.root.path, 'test/_data/p1');
+//        });
+//      });
+//      group('no pubspec', () {
+//        var project = new DartProject(null, null,
+//            dir: new Directory('test/_data/p1/src'));
+//        test('name', () {
+//          expect(project.name, 'src');
+//        });
+//        test('spec', () {
+//          expect(project.pubspec, isNull);
+//        });
+//        test('root', () {
+//          expect(project.root.path, 'test/_data/p1/src');
+//        });
+//      });
+    });
+  });
+}
diff --git a/pkg/analyzer/test/src/lint/pub_test.dart b/pkg/analyzer/test/src/lint/pub_test.dart
new file mode 100644
index 0000000..5a7f721
--- /dev/null
+++ b/pkg/analyzer/test/src/lint/pub_test.dart
@@ -0,0 +1,200 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/src/lint/pub.dart';
+import 'package:source_span/source_span.dart';
+import 'package:test/test.dart';
+
+main() {
+  defineTests();
+}
+
+defineTests() {
+  const src = """
+name: linter
+version: 0.0.1
+author: Dart Team <misc@dartlang.org>
+authors:
+  - Bill
+  - Ted
+description: Style linter for Dart.
+documentation:
+homepage: https://github.com/dart-lang/linter
+dependencies:
+  transmogrify:
+    hosted:
+      name: transmogrify
+      url: http://your-package-server.com
+    version: '>=0.4.0 <1.0.0'
+  analyzer: '0.24.0-dev.1'
+  cli_util: '>=0.0.1 <0.1.0'
+  semver: '>=0.2.0 <0.3.0'
+  yaml: '>=2.1.2 <3.0.0'
+  kittens:
+    git:
+      url: git://github.com/munificent/kittens.git
+      ref: some-branch
+  foo: any
+dev_dependencies:
+  markdown: '>=0.7.1+2 <0.8.0'
+  unittest: '>=0.11.0 <0.12.0'
+""";
+
+  Pubspec ps = new Pubspec.parse(src);
+
+  group('pubspec', () {
+    group('basic', () {
+      test('toString()', () {
+        // For now just confirm it doesn't blow up
+        expect(ps.toString(), isNotNull);
+      });
+    });
+    group('entries', () {
+      testValue('name', ps.name, equals('linter'));
+      testKeySpan('name', ps.name, startOffset: 0, endOffset: 4);
+      testValueSpan('name', ps.name, startOffset: 6, endOffset: 12);
+      group('documentation', () {
+        test('no value', () {
+          expect(ps.documentation.value.text, isNull);
+        });
+      });
+      testValue('homepage', ps.homepage,
+          equals('https://github.com/dart-lang/linter'));
+      testValue(
+          'description', ps.description, equals('Style linter for Dart.'));
+      testValue('version', ps.version, equals('0.0.1'));
+      testValue('author', ps.author, equals('Dart Team <misc@dartlang.org>'));
+
+      group('authors', () {
+        PSNodeList authors = ps.authors;
+        test('contents', () {
+          expect(authors, isNotNull);
+          expect(authors.any((PSNode n) => n.text == 'Bill'), isTrue);
+          expect(authors.any((PSNode n) => n.text == 'Ted'), isTrue);
+        });
+      });
+
+      testDepListContains('dependencies', ps.dependencies, [
+        {'analyzer': '0.24.0-dev.1'}
+      ]);
+
+      testDepListContains('dev_dependencies', ps.devDependencies, [
+        {'markdown': '>=0.7.1+2 <0.8.0'}
+      ]);
+
+      group('hosted', () {
+        PSDependency dep =
+            findDependency(ps.dependencies, name: 'transmogrify');
+        PSHost host = dep.host;
+        testValue('name', host.name, equals('transmogrify'));
+        testValue('url', host.url, equals('http://your-package-server.com'));
+        testKeySpan('name', host.name, startOffset: 237, endOffset: 241);
+        testValueSpan('name', host.name, startOffset: 243, endOffset: 255);
+      });
+
+      group('git', () {
+        PSDependency dep = findDependency(ps.dependencies, name: 'kittens');
+        PSGitRepo git = dep.git;
+        testValue('ref', git.ref, equals('some-branch'));
+        testValue(
+            'url', git.url, equals('git://github.com/munificent/kittens.git'));
+      });
+    });
+//    group('visiting', () {
+//      test('smoke', () {
+//        var mock = new MockPubVisitor();
+//        ps.accept(mock);
+//        verify(mock.visitPackageAuthor(any)).called(1);
+//        verify(mock.visitPackageAuthors(any)).called(1);
+//        verify(mock.visitPackageDependencies(any)).called(1);
+//        verify(mock.visitPackageDependency(any)).called(7);
+//        verify(mock.visitPackageDescription(any)).called(1);
+//        verify(mock.visitPackageDevDependencies(any)).called(1);
+//        verify(mock.visitPackageDevDependency(any)).called(2);
+//        verify(mock.visitPackageDocumentation(any)).called(1);
+//        verify(mock.visitPackageHomepage(any)).called(1);
+//        verify(mock.visitPackageName(any)).called(1);
+//        verify(mock.visitPackageVersion(any)).called(1);
+//      });
+//    });
+    // TODO(brianwilkerson) Rewrite this to use a memory resource provider.
+//    group('initialization', () {
+//      test('sourceUrl', () {
+//        File ps = new File('test/_data/p1/_pubspec.yaml');
+//        Pubspec spec = new Pubspec.parse(ps.readAsStringSync(),
+//            sourceUrl: p.toUri(ps.path));
+//        expect(spec.name.key.span.sourceUrl.toFilePath(windows: false),
+//            equals('test/_data/p1/_pubspec.yaml'));
+//      });
+//    });
+//    group('parsing', () {
+//      test('bad yaml', () {
+//        File ps = new File('test/_data/p3/_pubspec.yaml');
+//        Pubspec spec = new Pubspec.parse(ps.readAsStringSync(),
+//            sourceUrl: p.toUri(ps.path));
+//        expect(spec.name, isNull);
+//        expect(spec.description, isNull);
+//      });
+//    });
+  });
+}
+
+PSDependency findDependency(PSDependencyList deps, {String name}) =>
+    deps.firstWhere((dep) => dep.name.text == name, orElse: () => null);
+
+testDepListContains(
+    String label, PSDependencyList list, List<Map<String, String>> exp) {
+  test(label, () {
+    exp.forEach((Map<String, String> entry) {
+      entry.forEach((k, v) {
+        PSDependency dep = findDependency(list, name: k);
+        expect(dep, isNotNull);
+        expect(dep.version.value.text, equals(v));
+      });
+    });
+  });
+}
+
+testEntry(String label, PSEntry node, Matcher m) {
+  group(label, () {
+    test('entry', () {
+      expect(node, m);
+    });
+  });
+}
+
+testKeySpan(String label, PSEntry node, {int startOffset, int endOffset}) {
+  group(label, () {
+    group('key', () {
+      testSpan(node.key.span, startOffset: startOffset, endOffset: endOffset);
+    });
+  });
+}
+
+testSpan(SourceSpan span, {int startOffset, int endOffset}) {
+  test('span', () {
+    var start = span.start;
+    expect(start, isNotNull);
+    expect(start.offset, equals(startOffset));
+    var end = span.end;
+    expect(end, isNotNull);
+    expect(end.offset, equals(endOffset));
+  });
+}
+
+testValue(String label, PSEntry node, Matcher m) {
+  group(label, () {
+    test('value', () {
+      expect(node.value.text, m);
+    });
+  });
+}
+
+testValueSpan(String label, PSEntry node, {int startOffset, int endOffset}) {
+  group(label, () {
+    group('value', () {
+      testSpan(node.value.span, startOffset: startOffset, endOffset: endOffset);
+    });
+  });
+}
diff --git a/pkg/analyzer/test/src/lint/test_all.dart b/pkg/analyzer/test/src/lint/test_all.dart
new file mode 100644
index 0000000..60555a3
--- /dev/null
+++ b/pkg/analyzer/test/src/lint/test_all.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'config_test.dart' as config_test;
+import 'io_test.dart' as io_test;
+import 'project_test.dart' as project_test;
+import 'pub_test.dart' as pub_test;
+
+/// Utility for manually running all tests.
+main() {
+  defineReflectiveSuite(() {
+    config_test.main();
+    io_test.main();
+    project_test.main();
+    pub_test.main();
+  }, name: 'lint');
+}
diff --git a/pkg/analyzer/test/src/plugin/plugin_config_test.dart b/pkg/analyzer/test/src/plugin/plugin_config_test.dart
deleted file mode 100644
index 84ec8c8..0000000
--- a/pkg/analyzer/test/src/plugin/plugin_config_test.dart
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analyzer.test.src.plugin.plugin_config_test;
-
-import 'package:analyzer/source/analysis_options_provider.dart';
-import 'package:analyzer/src/plugin/plugin_configuration.dart';
-import 'package:test/test.dart';
-import 'package:yaml/yaml.dart';
-
-main() {
-  group('plugin config tests', () {
-    group('parsing', () {
-      test('plugin map', () {
-        const optionsSrc = '''
-analyzer:
-  plugins:
-    my_plugin1: ^0.1.0 #shorthand
-    my_plugin2:
-      version: ^0.2.0
-    my_plugin3:
-      class_name: MyPlugin
-      library_uri: myplugin/myplugin.dart
-      path: '/u/disk/src/'
-''';
-        var config = parseConfig(optionsSrc);
-        var plugins = pluginsSortedByName(config.plugins);
-        expect(plugins, hasLength(3));
-        expect(plugins[0].name, equals('my_plugin1'));
-        expect(plugins[0].version, equals('^0.1.0'));
-        expect(plugins[1].name, equals('my_plugin2'));
-        expect(plugins[1].version, equals('^0.2.0'));
-        expect(plugins[2].name, equals('my_plugin3'));
-        expect(plugins[2].version, isNull);
-        expect(plugins[2].path, equals('/u/disk/src/'));
-        expect(plugins[2].libraryUri, equals('myplugin/myplugin.dart'));
-        expect(plugins[2].className, equals('MyPlugin'));
-      });
-
-      test('plugin map (empty)', () {
-        const optionsSrc = '''
-analyzer:
-  plugins:
-    # my_plugin1: ^0.1.0 #shorthand
-''';
-        var config = parseConfig(optionsSrc);
-        // Commented out plugins shouldn't cause a parse failure.
-        expect(config.plugins, hasLength(0));
-      });
-
-      test('plugin manifest', () {
-        const manifestSrc = '''
-class_name: AnalyzerPlugin
-library_uri: myplugin/analyzer_plugin.dart
-contributes_to: analyzer
-''';
-        var manifest = parsePluginManifestString(manifestSrc);
-        var plugin = manifest.plugin;
-        expect(plugin.libraryUri, equals('myplugin/analyzer_plugin.dart'));
-        expect(plugin.className, equals('AnalyzerPlugin'));
-        expect(manifest.contributesTo, unorderedEquals(['analyzer']));
-      });
-
-      test('plugin manifest (contributes_to list)', () {
-        const manifestSrc = '''
-class_name: AnalyzerPlugin
-library_uri: myplugin/analyzer_plugin.dart
-contributes_to:
-  - analyzer
-  - analysis_server
-''';
-        var manifest = parsePluginManifestString(manifestSrc);
-        var plugin = manifest.plugin;
-        expect(plugin.libraryUri, equals('myplugin/analyzer_plugin.dart'));
-        expect(plugin.className, equals('AnalyzerPlugin'));
-        expect(manifest.contributesTo,
-            unorderedEquals(['analyzer', 'analysis_server']));
-      });
-
-      group('errors', () {
-        test('bad config format', () {
-          const optionsSrc = '''
-analyzer:
-  plugins:
-    - my_plugin1
-    - my_plugin2
-''';
-          try {
-            parseConfig(optionsSrc);
-            fail('expected PluginConfigFormatException');
-          } on PluginConfigFormatException catch (e) {
-            expect(
-                e.message,
-                equals(
-                    'Unrecognized plugin config format, expected `YamlMap`, got `YamlList`'));
-            expect(e.yamlNode, new isInstanceOf<YamlList>());
-          }
-        });
-        test('bad manifest format', () {
-          const manifestSource = '''
-library_uri:
- - should be a scalar uri
-''';
-          try {
-            parsePluginManifestString(manifestSource);
-            fail('expected PluginConfigFormatException');
-          } on PluginConfigFormatException catch (e) {
-            expect(
-                e.message,
-                equals(
-                    'Unable to parse pugin manifest, expected `String`, got `YamlList`'));
-            expect(e.yamlNode, new isInstanceOf<YamlList>());
-          }
-        });
-      });
-    });
-  });
-}
-
-PluginConfig parseConfig(String optionsSrc) {
-  var options = new AnalysisOptionsProvider().getOptionsFromString(optionsSrc);
-  return new PluginConfig.fromOptions(options);
-}
-
-List<PluginInfo> pluginsSortedByName(Iterable<PluginInfo> plugins) =>
-    plugins.toList()..sort((p1, p2) => p1.name.compareTo(p2.name));
diff --git a/pkg/analyzer/test/src/summary/bazel_summary_test.dart b/pkg/analyzer/test/src/summary/bazel_summary_test.dart
deleted file mode 100644
index a020a32..0000000
--- a/pkg/analyzer/test/src/summary/bazel_summary_test.dart
+++ /dev/null
@@ -1,608 +0,0 @@
-// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/dart/ast/token.dart';
-import 'package:analyzer/dart/element/element.dart';
-import 'package:analyzer/error/listener.dart';
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/src/context/cache.dart';
-import 'package:analyzer/src/dart/scanner/reader.dart';
-import 'package:analyzer/src/dart/scanner/scanner.dart';
-import 'package:analyzer/src/generated/engine.dart';
-import 'package:analyzer/src/generated/parser.dart';
-import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/summary/bazel_summary.dart';
-import 'package:analyzer/src/summary/format.dart';
-import 'package:analyzer/src/summary/idl.dart';
-import 'package:analyzer/src/summary/summarize_ast.dart';
-import 'package:analyzer/src/summary/summarize_elements.dart';
-import 'package:analyzer/src/util/fast_uri.dart';
-import 'package:analyzer/task/dart.dart';
-import 'package:path/path.dart' as pathos;
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import '../context/abstract_context.dart';
-
-main() {
-  defineReflectiveSuite(() {
-    defineReflectiveTests(BazelResultProviderTest);
-    defineReflectiveTests(SummaryProviderTest);
-  });
-}
-
-@reflectiveTest
-class BazelResultProviderTest extends _BaseTest {
-  BazelResultProvider provider;
-
-  @override
-  void setUp() {
-    super.setUp();
-    provider = new BazelResultProvider(new SummaryProvider(
-        resourceProvider,
-        '_.temp',
-        _getOutputFolder,
-        resourceProvider
-            .getFolder(resourceProvider.convertPath('/tmp/dart/bazel/linked')),
-        context));
-  }
-
-  test_failure_inconsistent_directDependency() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-''');
-    _writeUnlinkedBundle('components.aaa');
-    _writeUnlinkedBundle('components.bbb');
-    _setComponentFile('aaa', 'a.dart', 'class A2 {}');
-    // The 'aaa' unlinked bundle in inconsistent, so 'bbb' linking fails.
-    Source source = _resolveUri('package:components.bbb/b.dart');
-    CacheEntry entry = context.getCacheEntry(source);
-    expect(provider.compute(entry, LIBRARY_ELEMENT), isFalse);
-  }
-
-  test_failure_missingDirectDependency() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-''');
-    _writeUnlinkedBundle('components.bbb');
-    // We cannot find 'aaa' bundle, so 'bbb' linking fails.
-    Source source = _resolveUri('package:components.bbb/b.dart');
-    CacheEntry entry = context.getCacheEntry(source);
-    expect(provider.compute(entry, LIBRARY_ELEMENT), isFalse);
-  }
-
-  test_success_withoutDependencies() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _writeUnlinkedBundle('components.aaa');
-    // Resynthesize 'aaa' library.
-    Source source = _resolveUri('package:components.aaa/a.dart');
-    LibraryElement library = _resynthesizeLibrary(source);
-    List<ClassElement> types = library.definingCompilationUnit.types;
-    expect(types, hasLength(1));
-    expect(types.single.name, 'A');
-  }
-
-  test_withDependency_import() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-''');
-    _writeUnlinkedBundle('components.aaa');
-    _writeUnlinkedBundle('components.bbb');
-    // Prepare sources.
-    Source sourceA = _resolveUri('package:components.aaa/a.dart');
-    Source sourceB = _resolveUri('package:components.bbb/b.dart');
-    // Resynthesize 'bbb' library.
-    LibraryElement libraryB = _resynthesizeLibrary(sourceB);
-    List<ClassElement> types = libraryB.definingCompilationUnit.types;
-    expect(types, hasLength(1));
-    ClassElement typeB = types.single;
-    expect(typeB.name, 'B');
-    expect(typeB.supertype.name, 'A');
-    // The LibraryElement for 'aaa' is not created at all.
-    expect(context.getResult(sourceA, LIBRARY_ELEMENT), isNull);
-    // But we can resynthesize it, and it's the same as from 'bbb'.
-    expect(provider.compute(context.getCacheEntry(sourceA), LIBRARY_ELEMENT),
-        isTrue);
-    LibraryElement libraryA = context.getResult(sourceA, LIBRARY_ELEMENT);
-    expect(libraryA, isNotNull);
-    expect(typeB.supertype.element.library, same(libraryA));
-  }
-
-  LibraryElement _resynthesizeLibrary(Source source) {
-    CacheEntry entry = context.getCacheEntry(source);
-    expect(provider.compute(entry, LIBRARY_ELEMENT), isTrue);
-    return context.getResult(source, LIBRARY_ELEMENT);
-  }
-}
-
-@reflectiveTest
-class SummaryProviderTest extends _BaseTest {
-  SummaryProvider manager;
-
-  @override
-  void setUp() {
-    super.setUp();
-    _createManager();
-  }
-
-  test_getLinkedPackages_cached() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-''');
-    _writeUnlinkedBundle('components.aaa');
-    _writeUnlinkedBundle('components.bbb');
-    Source source = _resolveUri('package:components.bbb/b.dart');
-
-    // Session 1.
-    // Create linked bundles and store them in files.
-    {
-      List<Package> packages = manager.getLinkedPackages(source);
-      expect(packages, hasLength(2));
-    }
-
-    // Session 2.
-    // Recreate manager (with disabled linking) and ask again.
-    {
-      _createManager(allowLinking: false);
-      List<Package> packages = manager.getLinkedPackages(source);
-      expect(packages, hasLength(2));
-    }
-  }
-
-  test_getLinkedPackages_cached_declaredVariables_export() {
-    _testImpl_getLinkedPackages_cached_declaredVariables('export');
-  }
-
-  test_getLinkedPackages_cached_declaredVariables_import() {
-    _testImpl_getLinkedPackages_cached_declaredVariables('import');
-  }
-
-  test_getLinkedPackages_null_inconsistent_directDependency() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-''');
-    _writeUnlinkedBundle('components.aaa');
-    _writeUnlinkedBundle('components.bbb');
-    _setComponentFile('aaa', 'a.dart', 'class A2 {}');
-    // The 'aaa' unlinked bundle in inconsistent, so 'bbb' linking fails.
-    Source source = _resolveUri('package:components.bbb/b.dart');
-    List<Package> packages = manager.getLinkedPackages(source);
-    expect(packages, isNull);
-  }
-
-  test_getLinkedPackages_null_missingBundle() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    // We don't write 'aaa', so we cannot get its package.
-    // Ask the package for the URI.
-    Source source = _resolveUri('package:components.aaa/a.dart');
-    List<Package> packages = manager.getLinkedPackages(source);
-    expect(packages, isNull);
-  }
-
-  test_getLinkedPackages_null_missingDirectDependency() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-''');
-    _writeUnlinkedBundle('components.bbb');
-    // We cannot find 'aaa' bundle, so 'bbb' linking fails.
-    Source source = _resolveUri('package:components.bbb/b.dart');
-    List<Package> packages = manager.getLinkedPackages(source);
-    expect(packages, isNull);
-  }
-
-  test_getLinkedPackages_null_missingIndirectDependency() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-''');
-    _setComponentFile(
-        'ccc',
-        'c.dart',
-        r'''
-import 'package:components.bbb/b.dart';
-class C extends B {}
-''');
-    _writeUnlinkedBundle('components.bbb');
-    _writeUnlinkedBundle('components.ccc');
-    // We cannot find 'aaa' bundle, so 'ccc' linking fails.
-    Source source = _resolveUri('package:components.ccc/c.dart');
-    List<Package> packages = manager.getLinkedPackages(source);
-    expect(packages, isNull);
-  }
-
-  test_getLinkedPackages_withDependency_export() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-export 'package:components.aaa/a.dart';
-''');
-    _writeUnlinkedBundle('components.aaa');
-    _writeUnlinkedBundle('components.bbb');
-    Source source = _resolveUri('package:components.bbb/b.dart');
-    List<Package> packages = manager.getLinkedPackages(source);
-    expect(packages, hasLength(2));
-  }
-
-  test_getLinkedPackages_withDependency_import() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-''');
-    _writeUnlinkedBundle('components.aaa');
-    _writeUnlinkedBundle('components.bbb');
-    Source source = _resolveUri('package:components.bbb/b.dart');
-    List<Package> packages = manager.getLinkedPackages(source);
-    expect(packages, hasLength(2));
-  }
-
-  test_getLinkedPackages_withDependency_import_cycle() {
-    _setComponentFile(
-        'aaa',
-        'a.dart',
-        r'''
-import 'package:components.bbb/b.dart';
-class A {}
-class A2 extends B {}
-''');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-class B2 extends A2 {}
-''');
-    _writeUnlinkedBundle('components.aaa');
-    _writeUnlinkedBundle('components.bbb');
-    Source source = _resolveUri('package:components.bbb/b.dart');
-    List<Package> packages = manager.getLinkedPackages(source);
-    expect(packages, hasLength(2));
-  }
-
-  test_getLinkedPackages_withDependency_import_indirect() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _setComponentFile(
-        'bbb',
-        'b.dart',
-        r'''
-import 'package:components.aaa/a.dart';
-class B extends A {}
-''');
-    _setComponentFile(
-        'ccc',
-        'c.dart',
-        r'''
-import 'package:components.bbb/b.dart';
-class C extends B {}
-''');
-    _writeUnlinkedBundle('components.aaa');
-    _writeUnlinkedBundle('components.bbb');
-    _writeUnlinkedBundle('components.ccc');
-    Source source = _resolveUri('package:components.ccc/c.dart');
-    List<Package> packages = manager.getLinkedPackages(source);
-    expect(packages, hasLength(3));
-  }
-
-  test_getLinkedPackages_withoutDependencies() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _writeUnlinkedBundle('components.aaa');
-    // Ask the package for the URI.
-    Source source = _resolveUri('package:components.aaa/a.dart');
-    List<Package> packages = manager.getLinkedPackages(source);
-    expect(packages, hasLength(1));
-  }
-
-  test_getUnlinkedForUri() {
-    _setComponentFile('aaa', 'a1.dart', 'class A1 {}');
-    _setComponentFile('aaa', 'a2.dart', 'class A2 {}');
-    _writeUnlinkedBundle('components.aaa');
-    // Ask the package for the URI.
-    Source source1 = _resolveUri('package:components.aaa/a1.dart');
-    Source source2 = _resolveUri('package:components.aaa/a2.dart');
-    Package package = manager.getUnlinkedForUri(source1.uri);
-    expect(package, isNotNull);
-    // The same instance is returned to another URI in the same package.
-    expect(manager.getUnlinkedForUri(source2.uri), same(package));
-  }
-
-  test_getUnlinkedForUri_inconsistent_fileContent() {
-    File file1 = _setComponentFile('aaa', 'a1.dart', 'class A1 {}');
-    _setComponentFile('aaa', 'a2.dart', 'class A2 {}');
-    _writeUnlinkedBundle('components.aaa');
-    // Update one of the files, so the bundle is not consistent.
-    file1.writeAsStringSync('\nclass A1 {}');
-    Source source1 = _resolveUri('package:components.aaa/a1.dart');
-    Source source2 = _resolveUri('package:components.aaa/a2.dart');
-    expect(manager.getUnlinkedForUri(source1.uri), isNull);
-    expect(manager.getUnlinkedForUri(source2.uri), isNull);
-  }
-
-  test_getUnlinkedForUri_inconsistent_majorVersion() {
-    _setComponentFile('aaa', 'a.dart', 'class A {}');
-    _writeUnlinkedBundle('components.aaa');
-    Source source = _resolveUri('package:components.aaa/a.dart');
-
-    // Create manager with a different major version.
-    // The unlinked bundle cannot be used.
-    _createManager(majorVersion: 12345);
-    Package package = manager.getUnlinkedForUri(source.uri);
-    expect(package, isNull);
-  }
-
-  void _createManager(
-      {bool allowLinking: true,
-      int majorVersion: PackageBundleAssembler.currentMajorVersion}) {
-    manager = new SummaryProvider(resourceProvider, '_.temp', _getOutputFolder,
-        resourceProvider.getFolder('/tmp/dart/bazel/linked'), context,
-        allowLinking: allowLinking, majorVersion: majorVersion);
-  }
-
-  void _testImpl_getLinkedPackages_cached_declaredVariables(
-      String importOrExport) {
-    _setComponentFile(
-        'aaa',
-        'user.dart',
-        '''
-    $importOrExport 'foo.dart'
-      if (dart.library.io) 'foo_io.dart'
-      if (dart.library.html) 'foo_html.dart';
-    ''');
-    _setComponentFile('aaa', 'foo.dart', 'class B {}');
-    _setComponentFile('aaa', 'foo_io.dart', 'class B {}');
-    _setComponentFile('aaa', 'foo_dart.dart', 'class B {}');
-    _writeUnlinkedBundle('components.aaa');
-    Source source = _resolveUri('package:components.aaa/user.dart');
-
-    void _assertDependencyInUser(PackageBundle bundle, String shortName) {
-      for (var i = 0; i < bundle.linkedLibraryUris.length; i++) {
-        if (bundle.linkedLibraryUris[i].endsWith('user.dart')) {
-          LinkedLibrary library = bundle.linkedLibraries[i];
-          expect(library.dependencies.map((d) => d.uri),
-              unorderedEquals(['', 'dart:core', shortName]));
-          return;
-        }
-      }
-      fail('Not found user.dart in $bundle');
-    }
-
-    // Session 1.
-    // Create linked bundles and store them in files.
-    {
-      List<Package> packages = manager.getLinkedPackages(source);
-      expect(packages, hasLength(1));
-      _assertDependencyInUser(packages.single.linked, 'foo.dart');
-    }
-
-    // Session 2.
-    // Recreate manager and don't allow it to perform new linking.
-    // Set a declared variable, which is not used in the package.
-    // We still can get the cached linked bundle.
-    {
-      context.declaredVariables.define('not.used.variable', 'baz');
-      _createManager(allowLinking: false);
-      List<Package> packages = manager.getLinkedPackages(source);
-      expect(packages, hasLength(1));
-      _assertDependencyInUser(packages.single.linked, 'foo.dart');
-    }
-
-    // Session 3.
-    // Recreate manager and don't allow it to perform new linking.
-    // Set the value of a referenced declared variable.
-    // So, we cannot use the previously cached linked bundle.
-    {
-      context.declaredVariables.define('dart.library.io', 'does-not-matter');
-      _createManager(allowLinking: false);
-      List<Package> packages = manager.getLinkedPackages(source);
-      expect(packages, isEmpty);
-    }
-
-    // Session 4.
-    // Enable new linking, and configure to use 'foo_html.dart'.
-    {
-      context.declaredVariables.define('dart.library.html', 'true');
-      _createManager(allowLinking: true);
-      List<Package> packages = manager.getLinkedPackages(source);
-      expect(packages, hasLength(1));
-      _assertDependencyInUser(packages.single.linked, 'foo_html.dart');
-    }
-  }
-}
-
-class _BaseTest extends AbstractContextTest {
-  String sourceRoot;
-  String outRoot;
-
-  @override
-  void setUp() {
-    super.setUp();
-    // Include a 'package' URI resolver.
-    sourceRoot = resourceProvider.convertPath('/company/src/user/project/root');
-    outRoot = resourceProvider.pathContext.join(sourceRoot, 'bazel-bin');
-    sourceFactory = new SourceFactory(<UriResolver>[
-      sdkResolver,
-      resourceResolver,
-      new _TestPackageResolver(resourceProvider, sourceRoot)
-    ], null, resourceProvider);
-    context.sourceFactory = sourceFactory;
-  }
-
-  Folder _getOutputFolder(Uri absoluteUri) {
-    var pathContext = resourceProvider.pathContext;
-    if (absoluteUri.scheme == 'package') {
-      List<String> segments = absoluteUri.pathSegments;
-      if (segments.isNotEmpty) {
-        String packageName = segments.first;
-        String path = pathContext.join(
-            outRoot, packageName.replaceAll('.', pathContext.separator));
-        return resourceProvider.getFolder(path);
-      }
-    }
-    return null;
-  }
-
-  Source _resolveUri(String uri) {
-    return context.sourceFactory.resolveUri(null, uri);
-  }
-
-  File _setComponentFile(String componentName, String fileName, String code) {
-    String path = resourceProvider.pathContext
-        .join(sourceRoot, 'components', componentName, 'lib', fileName);
-    return resourceProvider.newFile(path, code);
-  }
-
-  void _writeUnlinkedBundle(String packageName) {
-    var pathContext = resourceProvider.pathContext;
-    String packagePath = packageName.replaceAll('.', pathContext.separator);
-    PackageBundleBuilder unlinkedBundle = _computeUnlinkedBundle(
-        resourceProvider,
-        packageName,
-        resourceProvider
-            .getFolder(pathContext.join(sourceRoot, packagePath, 'lib')),
-        true);
-    String shortName = packageName.substring(packageName.lastIndexOf('.') + 1);
-    resourceProvider.newFileWithBytes(
-        pathContext.join(outRoot, packagePath, shortName) + '.full.ds',
-        unlinkedBundle.toBuffer());
-  }
-
-  static PackageBundleBuilder _computeUnlinkedBundle(ResourceProvider provider,
-      String packageName, Folder libFolder, bool strong) {
-    var pathContext = provider.pathContext;
-    String libPath = libFolder.path + pathContext.separator;
-    PackageBundleAssembler assembler = new PackageBundleAssembler();
-
-    /**
-     * Return the `package` [Uri] for the given [path] in the `lib` folder
-     * of the current package.
-     */
-    Uri getUri(String path) {
-      String pathInLib = path.substring(libPath.length);
-      String uriPath = pathos.posix.joinAll(pathContext.split(pathInLib));
-      String uriStr = 'package:$packageName/$uriPath';
-      return FastUri.parse(uriStr);
-    }
-
-    /**
-     * If the given [file] is a Dart file, add its unlinked unit.
-     */
-    void addDartFile(File file) {
-      String path = file.path;
-      if (AnalysisEngine.isDartFileName(path)) {
-        Uri uri = getUri(path);
-        Source source = file.createSource(uri);
-        CompilationUnit unit = _parse(source, strong);
-        UnlinkedUnitBuilder unlinkedUnit = serializeAstUnlinked(unit);
-        assembler.addUnlinkedUnit(source, unlinkedUnit);
-      }
-    }
-
-    /**
-     * Visit the [folder] recursively.
-     */
-    void addDartFiles(Folder folder) {
-      List<Resource> children = folder.getChildren();
-      for (Resource child in children) {
-        if (child is File) {
-          addDartFile(child);
-        }
-      }
-      for (Resource child in children) {
-        if (child is Folder) {
-          addDartFiles(child);
-        }
-      }
-    }
-
-    addDartFiles(libFolder);
-    return assembler.assemble();
-  }
-
-  /**
-   * Parse the given [source] into AST.
-   */
-  static CompilationUnit _parse(Source source, bool strong) {
-    String code = source.contents.data;
-    AnalysisErrorListener errorListener = AnalysisErrorListener.NULL_LISTENER;
-    CharSequenceReader reader = new CharSequenceReader(code);
-    Scanner scanner = new Scanner(source, reader, errorListener);
-    scanner.scanGenericMethodComments = strong;
-    Token token = scanner.tokenize();
-    LineInfo lineInfo = new LineInfo(scanner.lineStarts);
-    Parser parser = new Parser(source, errorListener);
-    parser.parseGenericMethodComments = strong;
-    CompilationUnit unit = parser.parseCompilationUnit(token);
-    unit.lineInfo = lineInfo;
-    return unit;
-  }
-}
-
-class _TestPackageResolver implements UriResolver {
-  final ResourceProvider resourceProvider;
-  final String sourceRoot;
-
-  _TestPackageResolver(this.resourceProvider, this.sourceRoot);
-
-  @override
-  Source resolveAbsolute(Uri uri, [Uri actualUri]) {
-    if (uri.scheme == 'package') {
-      List<String> segments = uri.pathSegments;
-      if (segments.isNotEmpty) {
-        pathos.Context pathContext = resourceProvider.pathContext;
-        String packageName = segments.first;
-        String folderPath = pathContext.join(
-            sourceRoot, packageName.replaceAll('.', pathContext.separator));
-        String path = pathContext.join(
-            folderPath, 'lib', pathContext.joinAll(segments.skip(1)));
-        return resourceProvider.getFile(path).createSource(uri);
-      }
-    }
-    return null;
-  }
-
-  @override
-  Uri restoreAbsolute(Source source) {
-    throw new UnimplementedError();
-  }
-}
diff --git a/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart b/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart
index 7b6fab2..404d9af 100644
--- a/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart
+++ b/pkg/analyzer/test/src/summary/package_bundle_reader_test.dart
@@ -72,6 +72,9 @@
     when(bundle.linkedLibraries).thenReturn(<LinkedLibrary>[linkedLibrary]);
     dataStore.addBundle('/p1.ds', bundle);
 
+    when(unlinkedUnit1.isPartOf).thenReturn(false);
+    when(unlinkedUnit2.isPartOf).thenReturn(true);
+
     when(unlinkedUnit1.publicNamespace)
         .thenReturn(_namespaceWithParts(['package:p1/u2.dart']));
     when(unlinkedUnit2.publicNamespace).thenReturn(_namespaceWithParts([]));
@@ -124,6 +127,13 @@
     expect(entry1.getValue(SOURCE_KIND), SourceKind.LIBRARY);
   }
 
+  test_compute_SOURCE_KIND_librarySource_isPartOf() {
+    when(unlinkedUnit1.isPartOf).thenReturn(true);
+    bool success = provider.compute(entry1, SOURCE_KIND);
+    expect(success, isTrue);
+    expect(entry1.getValue(SOURCE_KIND), SourceKind.PART);
+  }
+
   test_compute_SOURCE_KIND_noResults() {
     bool success = provider.compute(entry3, SOURCE_KIND);
     expect(success, isFalse);
diff --git a/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart b/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
index 29e30d3..266f772 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_ast_test.dart
@@ -107,20 +107,26 @@
 
   @override
   @failingTest
-  void test_blockBodiedLambdas_doesNotInferBottom_async_topLevel() {
-    super.test_blockBodiedLambdas_doesNotInferBottom_async_topLevel();
+  void test_blockBodiedLambdas_inferBottom_async_topLevel() {
+    super.test_blockBodiedLambdas_inferBottom_async_topLevel();
   }
 
   @override
   @failingTest
-  void test_blockBodiedLambdas_doesNotInferBottom_asyncStar_topLevel() {
-    super.test_blockBodiedLambdas_doesNotInferBottom_asyncStar_topLevel();
+  void test_blockBodiedLambdas_inferBottom_asyncStar_topLevel() {
+    super.test_blockBodiedLambdas_inferBottom_asyncStar_topLevel();
   }
 
   @override
   @failingTest
-  void test_blockBodiedLambdas_doesNotInferBottom_syncStar_topLevel() {
-    super.test_blockBodiedLambdas_doesNotInferBottom_syncStar_topLevel();
+  void test_blockBodiedLambdas_inferBottom_sync_topLevel() {
+    super.test_blockBodiedLambdas_inferBottom_sync_topLevel();
+  }
+
+  @override
+  @failingTest
+  void test_blockBodiedLambdas_inferBottom_syncStar_topLevel() {
+    super.test_blockBodiedLambdas_inferBottom_syncStar_topLevel();
   }
 
   @override
@@ -559,6 +565,18 @@
 
   @override
   @failingTest
+  void test_inferredType_blockBodiedClosure_noArguments() {
+    super.test_inferredType_blockBodiedClosure_noArguments();
+  }
+
+  @override
+  @failingTest
+  void test_inferredType_blockClosure_noArgs_noReturn() {
+    super.test_inferredType_blockClosure_noArgs_noReturn();
+  }
+
+  @override
+  @failingTest
   void test_inferredType_opAssignToProperty_prefixedIdentifier() {
     super.test_inferredType_opAssignToProperty_prefixedIdentifier();
   }
@@ -701,6 +719,7 @@
         .test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment();
   }
 
+  @override
   LibraryElementImpl _checkSource(
       SummaryResynthesizer resynthesizer, Source source) {
     LibraryElementImpl resynthesized =
@@ -725,10 +744,8 @@
       super.createOptions()..strongMode = true;
 
   @override
-  @failingTest
-  test_instantiateToBounds_boundRefersToLaterTypeArgument() {
-    // TODO(paulberry): this is failing due to dartbug.com/27072.
-    super.test_instantiateToBounds_boundRefersToLaterTypeArgument();
+  test_instantiateToBounds_boundRefersToItself() {
+    super.test_instantiateToBounds_boundRefersToItself();
   }
 
   @override
@@ -820,7 +837,6 @@
         context.analysisOptions.strongMode);
 
     return new TestSummaryResynthesizer(
-        null,
         context,
         new Map<String, UnlinkedUnit>()
           ..addAll(SerializedMockSdk.instance.uriToUnlinkedUnit)
@@ -832,6 +848,10 @@
   }
 
   UnlinkedUnit _getUnlinkedUnit(Source source) {
+    if (source == null) {
+      return new UnlinkedUnitBuilder();
+    }
+
     String uriStr = source.uri.toString();
     {
       UnlinkedUnit unlinkedUnitInSdk =
@@ -873,7 +893,7 @@
     Source resolveRelativeUri(String relativeUri) {
       Source resolvedSource =
           context.sourceFactory.resolveUri(librarySource, relativeUri);
-      if (resolvedSource == null) {
+      if (resolvedSource == null && !allowMissingFiles) {
         throw new StateError('Could not resolve $relativeUri in the context of '
             '$librarySource (${librarySource.runtimeType})');
       }
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index ddff695..3d8874c 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -5,6 +5,7 @@
 library test.src.serialization.elements_test;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/constant/value.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
@@ -145,7 +146,7 @@
       TestSummaryResynthesizer resynthesizer, LibraryElement library) {
     // Check that no other summaries needed to be resynthesized to resynthesize
     // the library element.
-    expect(resynthesizer.resynthesisCount, 1);
+    expect(resynthesizer.resynthesisCount, 3);
     // Check that the only linked summary consulted was that for [uri].
     expect(resynthesizer.linkedSummariesRequested, hasLength(1));
     expect(resynthesizer.linkedSummariesRequested.first,
@@ -345,6 +346,9 @@
         } else {
           compareConstAsts(rItem.expression, oItem.expression, desc);
         }
+      } else if (oItem is AssertInitializer && rItem is AssertInitializer) {
+        compareConstAsts(rItem.condition, oItem.condition, '$desc condition');
+        compareConstAsts(rItem.message, oItem.message, '$desc message');
       } else if (oItem is SuperConstructorInvocation &&
           rItem is SuperConstructorInvocation) {
         compareElements(rItem.staticElement, oItem.staticElement, desc);
@@ -393,8 +397,9 @@
         // In 'class C {static const a = 0; static const b = a;}' the reference
         // to 'a' in 'b' is serialized as a fully qualified 'C.a' reference.
         if (r.prefix.staticElement is ClassElement) {
+          Element oElement = resolutionMap.staticElementForIdentifier(o);
           compareElements(
-              r.prefix.staticElement, o.staticElement?.enclosingElement, desc);
+              r.prefix.staticElement, oElement?.enclosingElement, desc);
           compareConstAsts(r.identifier, o, desc);
         } else {
           fail('Prefix of type ${r.prefix.staticElement.runtimeType} should not'
@@ -435,6 +440,8 @@
         checkElidablePrefix(oTarget.prefix);
         checkElidablePrefix(oTarget.identifier);
         compareConstAsts(r, o.propertyName, desc);
+      } else if (o is ThisExpression && r is ThisExpression) {
+        // Nothing to compare.
       } else if (o is NullLiteral) {
         expect(r, new isInstanceOf<NullLiteral>(), reason: desc);
       } else if (o is BooleanLiteral && r is BooleanLiteral) {
@@ -525,18 +532,17 @@
         Identifier rName = r.name;
         Identifier oName = o.name;
         if (oName is PrefixedIdentifier &&
+            rName is PrefixedIdentifier &&
             o.constructorName != null &&
-            o.element != null) {
-          // E.g. `@prefix.cls.ctor`.  This gets resynthesized as `@cls.ctor`,
-          // with `cls.ctor` represented as a PrefixedIdentifier.
-          expect(rName, new isInstanceOf<PrefixedIdentifier>(), reason: desc);
-          if (rName is PrefixedIdentifier) {
-            compareConstAsts(rName.prefix, oName.identifier, desc);
-            expect(rName.period.lexeme, '.', reason: desc);
-            compareConstAsts(rName.identifier, o.constructorName, desc);
-            expect(r.period, isNull, reason: desc);
-            expect(r.constructorName, isNull, reason: desc);
-          }
+            o.element != null &&
+            r.constructorName == null) {
+          // E.g. `@prefix.cls.ctor`.  This sometimes gets resynthesized as
+          // `@cls.ctor`, with `cls.ctor` represented as a PrefixedIdentifier.
+          compareConstAsts(rName.prefix, oName.identifier, desc);
+          expect(rName.period.lexeme, '.', reason: desc);
+          compareConstAsts(rName.identifier, o.constructorName, desc);
+          expect(r.period, isNull, reason: desc);
+          expect(r.constructorName, isNull, reason: desc);
         } else {
           compareConstAsts(r.name, o.name, desc);
           expect(r.period?.lexeme, o.period?.lexeme, reason: desc);
@@ -919,10 +925,14 @@
     }
     expect(resynthesized.defaultValueCode, original.defaultValueCode,
         reason: desc);
-    expect(resynthesized.isCovariant, original.isCovariant, reason: desc);
+    expect(resynthesized.isCovariant, original.isCovariant,
+        reason: '$desc isCovariant');
     ParameterElementImpl resynthesizedActual =
         getActualElement(resynthesized, desc);
     ParameterElementImpl originalActual = getActualElement(original, desc);
+    expect(resynthesizedActual.isExplicitlyCovariant,
+        originalActual.isExplicitlyCovariant,
+        reason: desc);
     compareFunctionElements(
         resynthesizedActual.initializer, originalActual.initializer, desc);
   }
@@ -1118,7 +1128,8 @@
   /**
    * Determine the analysis options that should be used for this test.
    */
-  AnalysisOptionsImpl createOptions() => new AnalysisOptionsImpl();
+  AnalysisOptionsImpl createOptions() =>
+      new AnalysisOptionsImpl()..enableAssertInitializer = true;
 
   ElementImpl getActualElement(Element element, String desc) {
     if (element == null) {
@@ -1197,6 +1208,11 @@
         return element.isConst;
       }
       return false;
+    } else if (modifier == Modifier.COVARIANT) {
+      if (element is ParameterElementImpl) {
+        return element.isExplicitlyCovariant;
+      }
+      return false;
     } else if (modifier == Modifier.DEFERRED) {
       if (element is ImportElement) {
         return element.isDeferred;
@@ -1480,6 +1496,14 @@
 class C {}''');
   }
 
+  test_class_documented_tripleSlash() {
+    checkLibrary('''
+/// aaa
+/// bbbb
+/// cc
+class C {}''');
+  }
+
   test_class_documented_with_references() {
     checkLibrary('''
 /**
@@ -1593,6 +1617,10 @@
     checkLibrary('class C { set x(int value) {} }');
   }
 
+  test_class_setter_invalid_no_parameter() {
+    checkLibrary('class C { void set x() {} }');
+  }
+
   test_class_setter_static() {
     checkLibrary('class C { static void set x(int value) {} }');
   }
@@ -2410,6 +2438,22 @@
 }''');
   }
 
+  test_constructor_initializers_assertInvocation() {
+    checkLibrary('''
+class C {
+  const C(int x) : assert(x >= 42);
+}
+''');
+  }
+
+  test_constructor_initializers_assertInvocation_message() {
+    checkLibrary('''
+class C {
+  const C(int x) : assert(x >= 42, 'foo');
+}
+''');
+  }
+
   test_constructor_initializers_field() {
     checkLibrary('''
 class C {
@@ -2786,35 +2830,6 @@
 ''');
   }
 
-  void test_covariant_parameter() {
-    // Note: due to dartbug.com/27393, the keyword "checked" is identified by
-    // its presence in a library called "meta".  If that bug is fixed, this test
-    // my need to be changed.
-    checkLibrary(r'''
-library meta;
-const checked = null;
-class A<T> {
-  void f(@checked T t) {}
-}
-''');
-  }
-
-  void test_covariant_parameter_inherited() {
-    // Note: due to dartbug.com/27393, the keyword "checked" is identified by
-    // its presence in a library called "meta".  If that bug is fixed, this test
-    // my need to be changed.
-    checkLibrary(r'''
-library meta;
-const checked = null;
-class A<T> {
-  void f(@checked T t) {}
-}
-class B<T> extends A<T> {
-  void f(T t) {}
-}
-''');
-  }
-
   test_defaultValue_refersToGenericClass_constructor() {
     checkLibrary('''
 class B<T> {
@@ -3067,6 +3082,13 @@
     checkLibrary('export "a.dart"; export "b.dart";');
   }
 
+  test_field_covariant() {
+    checkLibrary('''
+class C {
+  covariant int x;
+}''');
+  }
+
   test_field_documented() {
     checkLibrary('''
 class C {
@@ -3193,6 +3215,10 @@
     checkLibrary('external f();');
   }
 
+  test_function_parameter_final() {
+    checkLibrary('f(final x) {}');
+  }
+
   test_function_parameter_kind_named() {
     checkLibrary('f({x}) {}');
   }
@@ -3251,6 +3277,52 @@
     checkLibrary('f() {} g() {}');
   }
 
+  test_futureOr() {
+    var library = checkLibrary('import "dart:async"; FutureOr<int> x;');
+    var variables = library.definingCompilationUnit.topLevelVariables;
+    expect(variables, hasLength(1));
+    if (createOptions().strongMode) {
+      expect(variables[0].type.toString(), 'FutureOr<int>');
+    } else {
+      expect(variables[0].type.toString(), 'dynamic');
+    }
+  }
+
+  test_futureOr_const() {
+    var library = checkLibrary('import "dart:async"; const x = FutureOr;');
+    var variables = library.definingCompilationUnit.topLevelVariables;
+    expect(variables, hasLength(1));
+    var x = variables[0] as ConstTopLevelVariableElementImpl;
+    if (createOptions().strongMode) {
+      expect(x.type.toString(), 'Type');
+    } else {
+      expect(x.type.toString(), 'dynamic');
+    }
+    expect(x.constantInitializer.toString(), 'FutureOr');
+  }
+
+  test_futureOr_inferred() {
+    var library = checkLibrary('''
+import "dart:async";
+FutureOr<int> f() => null;
+var x = f();
+var y = x.then((z) => z.asDouble());
+''');
+    var variables = library.definingCompilationUnit.topLevelVariables;
+    expect(variables, hasLength(2));
+    var x = variables[0];
+    expect(x.name, 'x');
+    var y = variables[1];
+    expect(y.name, 'y');
+    if (createOptions().strongMode) {
+      expect(x.type.toString(), 'FutureOr<int>');
+      expect(y.type.toString(), 'dynamic');
+    } else {
+      expect(x.type.toString(), 'dynamic');
+      expect(y.type.toString(), 'dynamic');
+    }
+  }
+
   test_generic_gClass_gMethodStatic() {
     prepareAnalysisContext(createOptions());
     checkLibrary('''
@@ -3441,14 +3513,11 @@
   }
 
   test_import_short_absolute() {
-    if (resourceProvider.pathContext.separator == '\\') {
-      // This test fails on Windows due to
-      // https://github.com/dart-lang/path/issues/18
-      // TODO(paulberry): reenable once that bug is addressed.
-      return;
-    }
     testFile = '/my/project/bin/test.dart';
-    addLibrarySource('/a.dart', 'class C {}');
+    // Note: "/a.dart" resolves differently on Windows vs. Posix.
+    var destinationPath =
+        resourceProvider.pathContext.fromUri(Uri.parse('/a.dart'));
+    addLibrarySource(destinationPath, 'class C {}');
     checkLibrary('import "/a.dart"; C c;');
   }
 
@@ -3747,6 +3816,36 @@
 ''');
   }
 
+  test_invalid_annotation_prefixed_constructor() {
+    addLibrarySource(
+        '/a.dart',
+        r'''
+class C {
+  const C.named();
+}
+''');
+    checkLibrary('''
+import "a.dart" as a;
+@a.C.named
+class D {}
+''');
+  }
+
+  test_invalid_annotation_unprefixed_constructor() {
+    addLibrarySource(
+        '/a.dart',
+        r'''
+class C {
+  const C.named();
+}
+''');
+    checkLibrary('''
+import "a.dart";
+@C.named
+class D {}
+''');
+  }
+
   test_library() {
     checkLibrary('');
   }
@@ -4062,6 +4161,10 @@
     checkLibrary('@a import "foo.dart"; const a = b;');
   }
 
+  test_metadata_invalid_classDeclaration() {
+    checkLibrary('f(_) {} @f(42) class C {}');
+  }
+
   test_metadata_libraryDirective() {
     checkLibrary('@a library L; const a = null;');
   }
@@ -4137,22 +4240,6 @@
         'class C extends D { f() => null; } abstract class D { int f(); }');
   }
 
-  test_method_parameter_parameters() {
-    checkLibrary('class C { f(g(x, y)) {} }');
-  }
-
-  test_method_parameter_parameters_in_generic_class() {
-    checkLibrary('class C<A, B> { f(A g(B x)) {} }');
-  }
-
-  test_method_parameter_return_type() {
-    checkLibrary('class C { f(int g()) {} }');
-  }
-
-  test_method_parameter_return_type_void() {
-    checkLibrary('class C { f(void g()) {} }');
-  }
-
   test_method_type_parameter() {
     prepareAnalysisContext(createOptions());
     checkLibrary('class C { T f<T, U>(U u) => null; }');
@@ -4252,6 +4339,67 @@
     checkLibrary('class C { bool operator<=(C other) => false; }');
   }
 
+  void test_parameter_checked() {
+    // Note: due to dartbug.com/27393, the keyword "checked" is identified by
+    // its presence in a library called "meta".  If that bug is fixed, this test
+    // my need to be changed.
+    checkLibrary(r'''
+library meta;
+const checked = null;
+class A<T> {
+  void f(@checked T t) {}
+}
+''');
+  }
+
+  void test_parameter_checked_inherited() {
+    // Note: due to dartbug.com/27393, the keyword "checked" is identified by
+    // its presence in a library called "meta".  If that bug is fixed, this test
+    // my need to be changed.
+    checkLibrary(r'''
+library meta;
+const checked = null;
+class A<T> {
+  void f(@checked T t) {}
+}
+class B<T> extends A<T> {
+  void f(T t) {}
+}
+''');
+  }
+
+  test_parameter_covariant() {
+    prepareAnalysisContext(createOptions());
+    checkLibrary('class C { void m(covariant C c) {} }');
+  }
+
+  void test_parameter_covariant_inherited() {
+    checkLibrary(r'''
+class A<T> {
+  void f(covariant T t) {}
+}
+class B<T> extends A<T> {
+  void f(T t) {}
+}
+''');
+  }
+
+  test_parameter_parameters() {
+    checkLibrary('class C { f(g(x, y)) {} }');
+  }
+
+  test_parameter_parameters_in_generic_class() {
+    checkLibrary('class C<A, B> { f(A g(B x)) {} }');
+  }
+
+  test_parameter_return_type() {
+    checkLibrary('class C { f(int g()) {} }');
+  }
+
+  test_parameter_return_type_void() {
+    checkLibrary('class C { f(void g()) {} }');
+  }
+
   test_parameterTypeNotInferred_constructor() {
     // Strong mode doesn't do type inference on constructor parameters, so it's
     // ok that we don't store inferred type info for them in summaries.
@@ -4302,6 +4450,21 @@
     checkLibrary('library my.lib; part "a.dart"; part "b.dart";');
   }
 
+  test_parts_invalidUri() {
+    allowMissingFiles = true;
+    addSource('/foo/bar.dart', 'part of my.lib;');
+    checkLibrary('library my.lib; part "foo/";');
+  }
+
+  test_parts_invalidUri_nullStringValue() {
+    allowMissingFiles = true;
+    addSource('/foo/bar.dart', 'part of my.lib;');
+    checkLibrary(r'''
+library my.lib;
+part "${foo}/bar.dart";
+''');
+  }
+
   test_propagated_type_refers_to_closure() {
     checkLibrary('''
 void f() {
@@ -4311,6 +4474,10 @@
 ''');
   }
 
+  test_setter_covariant() {
+    checkLibrary('class C { void set x(covariant int value); }');
+  }
+
   test_setter_documented() {
     checkLibrary('''
 // Extra comment so doc comment offset != 0
@@ -4616,6 +4783,19 @@
     checkLibrary('f() {} g() {}');
   }
 
+  test_unresolved_annotation_instanceCreation_argument_this() {
+    checkLibrary(
+        '''
+class A {
+  const A(_);
+}
+
+@A(this)
+class C {}
+''',
+        allowErrors: true);
+  }
+
   test_unresolved_annotation_namedConstructorCall_noClass() {
     checkLibrary('@foo.bar() class C {}', allowErrors: true);
   }
@@ -4671,7 +4851,12 @@
 
   test_unresolved_import() {
     allowMissingFiles = true;
-    checkLibrary("import 'foo.dart';", allowErrors: true);
+    LibraryElementImpl library =
+        checkLibrary("import 'foo.dart';", allowErrors: true);
+    LibraryElement importedLibrary = library.imports[0].importedLibrary;
+    expect(importedLibrary.loadLibraryFunction, isNotNull);
+    expect(importedLibrary.publicNamespace, isNotNull);
+    expect(importedLibrary.exportNamespace, isNotNull);
   }
 
   test_unresolved_part() {
@@ -4782,7 +4967,7 @@
     checkMinimalResynthesisWork(resynthesizer, original.library);
     // Check that no other summaries needed to be resynthesized to resynthesize
     // the library element.
-    expect(resynthesizer.resynthesisCount, 1);
+    expect(resynthesizer.resynthesisCount, 3);
     expect(result.location, location);
     return result;
   }
@@ -4805,10 +4990,14 @@
    */
   final Set<String> linkedSummariesRequested = new Set<String>();
 
-  TestSummaryResynthesizer(SummaryResynthesizer parent, AnalysisContext context,
-      this.unlinkedSummaries, this.linkedSummaries, this.allowMissingFiles)
-      : super(parent, context, context.typeProvider, context.sourceFactory,
-            context.analysisOptions.strongMode);
+  TestSummaryResynthesizer(AnalysisContext context, this.unlinkedSummaries,
+      this.linkedSummaries, this.allowMissingFiles)
+      : super(context, context.sourceFactory,
+            context.analysisOptions.strongMode) {
+    // Clear after resynthesizing TypeProvider in super().
+    unlinkedSummariesRequested.clear();
+    linkedSummariesRequested.clear();
+  }
 
   @override
   LinkedLibrary getLinkedSummary(String uri) {
diff --git a/pkg/analyzer/test/src/summary/summarize_ast_test.dart b/pkg/analyzer/test/src/summary/summarize_ast_test.dart
index e0083e0..932e1fc 100644
--- a/pkg/analyzer/test/src/summary/summarize_ast_test.dart
+++ b/pkg/analyzer/test/src/summary/summarize_ast_test.dart
@@ -268,8 +268,8 @@
       {String path: '/test.dart', String uri}) {
     uri ??= absUri(path);
     Uri testDartUri = Uri.parse(uri);
-    CompilationUnit unit = _parseText(text);
-    UnlinkedUnitBuilder unlinkedDefiningUnit = serializeAstUnlinked(unit);
+    UnlinkedUnitBuilder unlinkedDefiningUnit =
+        createUnlinkedSummary(testDartUri, text);
     _filesToLink.uriToUnit[testDartUri.toString()] = unlinkedDefiningUnit;
     LinkerInputs linkerInputs = new LinkerInputs(
         allowMissingFiles,
@@ -309,12 +309,16 @@
     return assembler.assemble();
   }
 
+  UnlinkedUnitBuilder createUnlinkedSummary(Uri uri, String text) =>
+      serializeAstUnlinked(_parseText(text));
+
   CompilationUnit _parseText(String text) {
     CharSequenceReader reader = new CharSequenceReader(text);
     Scanner scanner =
         new Scanner(null, reader, AnalysisErrorListener.NULL_LISTENER);
     Token token = scanner.tokenize();
     Parser parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER);
+    parser.enableAssertInitializer = true;
     CompilationUnit unit = parser.parseCompilationUnit(token);
     unit.lineInfo = new LineInfo(scanner.lineStarts);
     return unit;
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index fd93301..9e12705 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -140,6 +140,13 @@
   LinkedUnit get definingUnit => linked.units[0];
 
   /**
+   * Whether the parts of the IDL marked `@informative` are expected to be
+   * included in the generated summary; if `false`, these parts of the IDL won't
+   * be checked.
+   */
+  bool get includeInformative => true;
+
+  /**
    * Get access to the linked summary that results from serializing and
    * then deserializing the library under test.
    */
@@ -175,12 +182,38 @@
   Source addNamedSource(String filePath, String contents);
 
   /**
+   * TODO(scheglov) rename "Const" to "Expr" everywhere
+   */
+  void assertUnlinkedConst(UnlinkedExpr constExpr,
+      {bool isValidConst: true,
+      List<UnlinkedExprOperation> operators: const <UnlinkedExprOperation>[],
+      List<UnlinkedExprAssignOperator> assignmentOperators:
+          const <UnlinkedExprAssignOperator>[],
+      List<int> ints: const <int>[],
+      List<double> doubles: const <double>[],
+      List<String> strings: const <String>[],
+      List<_EntityRefValidator> referenceValidators:
+          const <_EntityRefValidator>[]}) {
+    expect(constExpr, isNotNull);
+    expect(constExpr.isValidConst, isValidConst);
+    expect(constExpr.operations, operators);
+    expect(constExpr.ints, ints);
+    expect(constExpr.doubles, doubles);
+    expect(constExpr.strings, strings);
+    expect(constExpr.assignmentOperators, assignmentOperators);
+    expect(constExpr.references, hasLength(referenceValidators.length));
+    for (int i = 0; i < referenceValidators.length; i++) {
+      referenceValidators[i](constExpr.references[i]);
+    }
+  }
+
+  /**
    * Check that [annotations] contains a single entry which is a reference to
    * a top level variable called `a` in the current library.
    */
   void checkAnnotationA(List<UnlinkedExpr> annotations) {
     expect(annotations, hasLength(1));
-    _assertUnlinkedConst(annotations[0], operators: [
+    assertUnlinkedConst(annotations[0], operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'a',
@@ -1116,6 +1149,7 @@
   }
 
   test_class_alias_documented() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -1194,6 +1228,7 @@
   }
 
   test_class_codeRange() {
+    if (!includeInformative) return;
     UnlinkedClass cls = serializeClassText(' class C {}');
     _assertCodeRange(cls.codeRange, 1, 10);
   }
@@ -1282,6 +1317,7 @@
   }
 
   test_class_documented() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -1293,7 +1329,21 @@
     checkDocumentationComment(cls.documentationComment, text);
   }
 
+  test_class_documented_tripleSlash() {
+    if (!includeInformative) return;
+    String text = '''
+/// aaa
+/// bbbb
+/// cc
+class C {}''';
+    UnlinkedClass cls = serializeClassText(text);
+    UnlinkedDocumentationComment comment = cls.documentationComment;
+    expect(comment, isNotNull);
+    expect(comment.text, '/// aaa\n/// bbbb\n/// cc');
+  }
+
   test_class_documented_with_references() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -1309,6 +1359,7 @@
   }
 
   test_class_documented_with_with_windows_line_endings() {
+    if (!includeInformative) return;
     String text = '/**\r\n * Docs\r\n */\r\nclass C {}';
     UnlinkedClass cls = serializeClassText(text);
     expect(cls.documentationComment, isNotNull);
@@ -1359,7 +1410,9 @@
     var classText = 'class C {}';
     UnlinkedClass cls = serializeClassText(classText);
     expect(cls.name, 'C');
-    expect(cls.nameOffset, classText.indexOf('C'));
+    if (includeInformative) {
+      expect(cls.nameOffset, classText.indexOf('C'));
+    }
   }
 
   test_class_no_flags() {
@@ -1449,7 +1502,9 @@
     UnlinkedClass cls = serializeClassText(text);
     expect(cls.typeParameters, hasLength(1));
     expect(cls.typeParameters[0].name, 'T');
-    expect(cls.typeParameters[0].nameOffset, text.indexOf('T'));
+    if (includeInformative) {
+      expect(cls.typeParameters[0].nameOffset, text.indexOf('T'));
+    }
     expect(cls.typeParameters[0].bound, isNull);
     expect(unlinkedUnits[0].publicNamespace.names[0].numTypeParameters, 1);
   }
@@ -1545,7 +1600,7 @@
 
   test_constExpr_binary_add() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 + 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.add
@@ -1558,7 +1613,7 @@
   test_constExpr_binary_and() {
     UnlinkedVariable variable =
         serializeVariableText('const v = true && false;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushTrue,
       UnlinkedExprOperation.pushFalse,
       UnlinkedExprOperation.and
@@ -1567,7 +1622,7 @@
 
   test_constExpr_binary_bitAnd() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 & 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.bitAnd
@@ -1579,7 +1634,7 @@
 
   test_constExpr_binary_bitOr() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 | 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.bitOr
@@ -1591,7 +1646,7 @@
 
   test_constExpr_binary_bitShiftLeft() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 << 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.bitShiftLeft
@@ -1603,7 +1658,7 @@
 
   test_constExpr_binary_bitShiftRight() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 >> 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.bitShiftRight
@@ -1615,7 +1670,7 @@
 
   test_constExpr_binary_bitXor() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 ^ 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.bitXor
@@ -1627,7 +1682,7 @@
 
   test_constExpr_binary_divide() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 / 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.divide
@@ -1639,7 +1694,7 @@
 
   test_constExpr_binary_equal() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 == 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.equal
@@ -1651,7 +1706,7 @@
 
   test_constExpr_binary_equal_not() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 != 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.notEqual
@@ -1663,7 +1718,7 @@
 
   test_constExpr_binary_floorDivide() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 ~/ 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.floorDivide
@@ -1675,7 +1730,7 @@
 
   test_constExpr_binary_greater() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 > 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.greater
@@ -1687,7 +1742,7 @@
 
   test_constExpr_binary_greaterEqual() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 >= 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.greaterEqual
@@ -1699,7 +1754,7 @@
 
   test_constExpr_binary_less() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 < 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.less
@@ -1711,7 +1766,7 @@
 
   test_constExpr_binary_lessEqual() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 <= 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.lessEqual
@@ -1723,7 +1778,7 @@
 
   test_constExpr_binary_modulo() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 % 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.modulo
@@ -1735,7 +1790,7 @@
 
   test_constExpr_binary_multiply() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 * 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.multiply
@@ -1748,7 +1803,7 @@
   test_constExpr_binary_or() {
     UnlinkedVariable variable =
         serializeVariableText('const v = false || true;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushFalse,
       UnlinkedExprOperation.pushTrue,
       UnlinkedExprOperation.or
@@ -1757,7 +1812,7 @@
 
   test_constExpr_binary_qq() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 ?? 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.ifNull
@@ -1769,7 +1824,7 @@
 
   test_constExpr_binary_subtract() {
     UnlinkedVariable variable = serializeVariableText('const v = 1 - 2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.subtract
@@ -1792,7 +1847,7 @@
 }
 ''';
     UnlinkedClass cls = serializeClassText(text, allowErrors: true);
-    _assertUnlinkedConst(cls.executables[0].constantInitializers[0].expression,
+    assertUnlinkedConst(cls.executables[0].constantInitializers[0].expression,
         operators: [
           UnlinkedExprOperation.pushReference
         ],
@@ -1809,7 +1864,7 @@
   test_constExpr_conditional() {
     UnlinkedVariable variable =
         serializeVariableText('const v = true ? 1 : 2;', allowErrors: true);
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushTrue,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
@@ -1828,7 +1883,7 @@
   const C(a) : b = a;
 }
 ''');
-    _assertUnlinkedConst(cls.executables[0].constantInitializers[0].expression,
+    assertUnlinkedConst(cls.executables[0].constantInitializers[0].expression,
         operators: [UnlinkedExprOperation.pushParameter], strings: ['a']);
   }
 
@@ -1839,7 +1894,7 @@
   const C(T) : x = T;
 }
 ''');
-    _assertUnlinkedConst(cls.executables[0].constantInitializers[0].expression,
+    assertUnlinkedConst(cls.executables[0].constantInitializers[0].expression,
         operators: [UnlinkedExprOperation.pushParameter], strings: ['T']);
   }
 
@@ -1851,7 +1906,7 @@
 import 'dart:async';
 const v = (f) async => await f;
 ''');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushParameter,
@@ -1871,7 +1926,7 @@
 const v = foo(5, () => 42);
 foo(a, b) {}
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -1900,7 +1955,7 @@
 const v = foo(5, () => 42, () => 43);
 foo(a, b, c) {}
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -1935,11 +1990,11 @@
 }
 ''').executables[0];
     expect(executable.localFunctions, hasLength(2));
-    _assertUnlinkedConst(executable.constantInitializers[0].expression,
+    assertUnlinkedConst(executable.constantInitializers[0].expression,
         isValidConst: false,
         operators: [UnlinkedExprOperation.pushLocalFunctionReference],
         ints: [0, 0]);
-    _assertUnlinkedConst(executable.constantInitializers[1].expression,
+    assertUnlinkedConst(executable.constantInitializers[1].expression,
         isValidConst: false,
         operators: [UnlinkedExprOperation.pushLocalFunctionReference],
         ints: [0, 1]);
@@ -1952,7 +2007,7 @@
 }
 const v = const C<int, String>.named();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -1984,7 +2039,7 @@
 import 'a.dart';
 const v = const C<int, String>.named();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2018,7 +2073,7 @@
 import 'a.dart' as p;
 const v = const p.C<int, String>.named();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2048,7 +2103,7 @@
 }
 const v = const C<int, String>();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2077,7 +2132,7 @@
 import 'a.dart';
 const v = const C<int, String>();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2106,7 +2161,7 @@
 import 'a.dart' as p;
 const v = const p.C<int, String>();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2133,7 +2188,7 @@
 }
 const v = const C.named();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2159,7 +2214,7 @@
 import 'a.dart';
 const v = const C.named();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2186,7 +2241,7 @@
 import 'a.dart' as p;
 const v = const p.C.named();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2213,7 +2268,7 @@
     // Ints: ^pointer 3 4
     // Doubles: ^pointer
     // Strings: ^pointer 'e' 'g' 'f' ''
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushDouble,
@@ -2255,7 +2310,7 @@
 import 'a.dart';
 const v = const C();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2278,7 +2333,7 @@
 import 'a.dart' as p;
 const v = const p.C();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2299,7 +2354,7 @@
 const v = const C.foo();
 ''',
         allowErrors: true);
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2319,7 +2374,7 @@
 const v = const C.foo();
 ''',
         allowErrors: true);
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2346,7 +2401,7 @@
 const v = const p.C.foo();
 ''',
         allowErrors: true);
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2370,7 +2425,7 @@
 const v = const p.C.foo();
 ''',
         allowErrors: true);
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2391,7 +2446,7 @@
 const v = const Foo();
 ''',
         allowErrors: true);
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -2405,7 +2460,7 @@
   test_constExpr_invokeMethodRef_identical() {
     UnlinkedVariable variable =
         serializeVariableText('const v = identical(42, null);');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushNull,
       UnlinkedExprOperation.invokeMethodRef
@@ -2429,7 +2484,7 @@
 }
 const int v = C.length;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'length',
@@ -2452,7 +2507,7 @@
 import 'a.dart' as p;
 const int v = p.C.length;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'length',
@@ -2470,7 +2525,7 @@
 const String a = 'aaa';
 const int v = a.length;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'length',
@@ -2490,7 +2545,7 @@
 }
 const int v = C.F.length;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'length',
@@ -2513,7 +2568,7 @@
 import 'a.dart';
 const int v = a.length;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'length',
@@ -2537,7 +2592,7 @@
 import 'a.dart' as p;
 const int v = p.a.length;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'length',
@@ -2555,7 +2610,7 @@
   test_constExpr_length_parenthesizedBinaryTarget() {
     UnlinkedVariable variable =
         serializeVariableText('const v = ("abc" + "edf").length;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.add,
@@ -2570,7 +2625,7 @@
   test_constExpr_length_parenthesizedStringTarget() {
     UnlinkedVariable variable =
         serializeVariableText('const v = ("abc").length;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.extractProperty
     ], strings: [
@@ -2582,7 +2637,7 @@
   test_constExpr_length_stringLiteralTarget() {
     UnlinkedVariable variable =
         serializeVariableText('const v = "abc".length;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.extractProperty
     ], strings: [
@@ -2593,14 +2648,14 @@
 
   test_constExpr_makeSymbol() {
     UnlinkedVariable variable = serializeVariableText('const v = #a.bb.ccc;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.makeSymbol], strings: ['a.bb.ccc']);
   }
 
   test_constExpr_makeTypedList() {
     UnlinkedVariable variable =
         serializeVariableText('const v = const <int>[11, 22, 33];');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
@@ -2619,7 +2674,7 @@
   test_constExpr_makeTypedList_dynamic() {
     UnlinkedVariable variable =
         serializeVariableText('const v = const <dynamic>[11, 22, 33];');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
@@ -2637,7 +2692,7 @@
   test_constExpr_makeTypedMap() {
     UnlinkedVariable variable = serializeVariableText(
         'const v = const <int, String>{11: "aaa", 22: "bbb", 33: "ccc"};');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.pushInt,
@@ -2665,7 +2720,7 @@
   test_constExpr_makeTypedMap_dynamic() {
     UnlinkedVariable variable = serializeVariableText(
         'const v = const <dynamic, dynamic>{11: "aaa", 22: "bbb", 33: "ccc"};');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.pushInt,
@@ -2691,7 +2746,7 @@
   test_constExpr_makeUntypedList() {
     UnlinkedVariable variable =
         serializeVariableText('const v = const [11, 22, 33];');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
@@ -2707,7 +2762,7 @@
   test_constExpr_makeUntypedMap() {
     UnlinkedVariable variable = serializeVariableText(
         'const v = const {11: "aaa", 22: "bbb", 33: "ccc"};');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.pushInt,
@@ -2729,7 +2784,7 @@
 
   test_constExpr_parenthesized() {
     UnlinkedVariable variable = serializeVariableText('const v = (1 + 2) * 3;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.add,
@@ -2744,7 +2799,7 @@
 
   test_constExpr_prefix_complement() {
     UnlinkedVariable variable = serializeVariableText('const v = ~2;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.complement
     ], ints: [
@@ -2754,7 +2809,7 @@
 
   test_constExpr_prefix_negate() {
     UnlinkedVariable variable = serializeVariableText('const v = -(2);');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.negate
     ], ints: [
@@ -2764,31 +2819,31 @@
 
   test_constExpr_prefix_not() {
     UnlinkedVariable variable = serializeVariableText('const v = !true;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushTrue, UnlinkedExprOperation.not]);
   }
 
   test_constExpr_pushDouble() {
     UnlinkedVariable variable = serializeVariableText('const v = 123.4567;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushDouble], doubles: [123.4567]);
   }
 
   test_constExpr_pushFalse() {
     UnlinkedVariable variable = serializeVariableText('const v = false;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushFalse]);
   }
 
   test_constExpr_pushInt() {
     UnlinkedVariable variable = serializeVariableText('const v = 1;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushInt], ints: [1]);
   }
 
   test_constExpr_pushInt_max() {
     UnlinkedVariable variable = serializeVariableText('const v = 0xFFFFFFFF;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
     ], ints: [
       0xFFFFFFFF
@@ -2797,7 +2852,7 @@
 
   test_constExpr_pushInt_negative() {
     UnlinkedVariable variable = serializeVariableText('const v = -5;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.negate
     ], ints: [
@@ -2808,14 +2863,14 @@
   test_constExpr_pushLongInt() {
     UnlinkedVariable variable =
         serializeVariableText('const v = 0xA123456789ABCDEF012345678;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushLongInt],
         ints: [4, 0xA, 0x12345678, 0x9ABCDEF0, 0x12345678]);
   }
 
   test_constExpr_pushLongInt_min2() {
     UnlinkedVariable variable = serializeVariableText('const v = 0x100000000;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushLongInt
     ], ints: [
       2,
@@ -2827,7 +2882,7 @@
   test_constExpr_pushLongInt_min3() {
     UnlinkedVariable variable =
         serializeVariableText('const v = 0x10000000000000000;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushLongInt
     ], ints: [
       3,
@@ -2839,7 +2894,7 @@
 
   test_constExpr_pushNull() {
     UnlinkedVariable variable = serializeVariableText('const v = null;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushNull]);
   }
 
@@ -2848,7 +2903,7 @@
 class C {}
 const v = C;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'C',
@@ -2861,7 +2916,7 @@
 enum C {V1, V2, V3}
 const v = C;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'C',
@@ -2874,7 +2929,7 @@
 enum C {V1, V2, V3}
 const v = C.V1;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'V1',
@@ -2895,7 +2950,7 @@
 import 'a.dart';
 const v = C.V1;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'V1',
@@ -2912,7 +2967,7 @@
 enum C {V1, V2, V3}
 const v = C.values;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'values',
@@ -2933,7 +2988,7 @@
 import 'a.dart';
 const v = C.values;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'values',
@@ -2952,7 +3007,7 @@
 }
 const v = C.F;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'F',
@@ -2975,7 +3030,7 @@
 import 'a.dart';
 const v = C.F;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'F',
@@ -2999,7 +3054,7 @@
 import 'a.dart' as p;
 const v = p.C.F;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'F',
@@ -3019,7 +3074,7 @@
   static const b = null;
 }
 ''').fields[0];
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'b',
@@ -3037,7 +3092,7 @@
 }
 const v = C.x;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'x',
@@ -3060,7 +3115,7 @@
 import 'a.dart';
 const v = C.x;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'x',
@@ -3084,7 +3139,7 @@
 import 'a.dart' as p;
 const v = p.C.x;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'x',
@@ -3104,7 +3159,7 @@
 }
 const v = C.m;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'm',
@@ -3127,7 +3182,7 @@
 import 'a.dart';
 const v = C.m;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'm',
@@ -3151,7 +3206,7 @@
 import 'a.dart' as p;
 const v = p.C.m;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'm',
@@ -3171,7 +3226,7 @@
   static m() {}
 }
 ''').fields[0];
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'm',
@@ -3187,7 +3242,7 @@
 f() {}
 const v = f;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'f',
@@ -3205,7 +3260,7 @@
 import 'a.dart';
 const v = f;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f',
@@ -3223,7 +3278,7 @@
 import 'a.dart' as p;
 const v = p.f;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'f',
@@ -3239,7 +3294,7 @@
 int get x => null;
 const v = x;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'x',
@@ -3253,7 +3308,7 @@
 import 'a.dart';
 const v = x;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'x',
@@ -3267,7 +3322,7 @@
 import 'a.dart' as p;
 const v = p.x;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'x',
@@ -3281,7 +3336,7 @@
 const int a = 1;
 const v = a;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'a',
@@ -3295,7 +3350,7 @@
 import 'a.dart';
 const v = a;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'a',
@@ -3309,7 +3364,7 @@
 import 'a.dart' as p;
 const v = p.a;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) {
@@ -3328,7 +3383,7 @@
 ''';
     UnlinkedVariable variable =
         serializeClassText(text, allowErrors: true).fields[0];
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) {
@@ -3343,7 +3398,7 @@
 const v = foo;
 ''',
         allowErrors: true);
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -3358,7 +3413,7 @@
 const v = C.foo;
 ''',
         allowErrors: true);
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -3381,7 +3436,7 @@
 const v = p.C.foo;
 ''',
         allowErrors: true);
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -3397,14 +3452,14 @@
   test_constExpr_pushString_adjacent() {
     UnlinkedVariable variable =
         serializeVariableText('const v = "aaa" "b" "ccc";');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushString], strings: ['aaabccc']);
   }
 
   test_constExpr_pushString_adjacent_interpolation() {
     UnlinkedVariable variable =
         serializeVariableText(r'const v = "aaa" "bb ${42} bbb" "cccc";');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.pushInt,
@@ -3427,7 +3482,7 @@
   test_constExpr_pushString_interpolation() {
     UnlinkedVariable variable =
         serializeVariableText(r'const v = "aaa ${42} bbb";');
-    _assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushString,
       UnlinkedExprOperation.pushInt,
       UnlinkedExprOperation.pushString,
@@ -3443,13 +3498,13 @@
 
   test_constExpr_pushString_simple() {
     UnlinkedVariable variable = serializeVariableText('const v = "abc";');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushString], strings: ['abc']);
   }
 
   test_constExpr_pushTrue() {
     UnlinkedVariable variable = serializeVariableText('const v = true;');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushTrue]);
   }
 
@@ -3462,14 +3517,19 @@
     expect(executable.isAsynchronous, isFalse);
     expect(executable.isExternal, isFalse);
     expect(executable.isGenerator, isFalse);
-    expect(executable.nameOffset, text.indexOf('C();'));
-    expect(executable.periodOffset, 0);
-    expect(executable.nameEnd, 0);
+    if (includeInformative) {
+      expect(executable.nameOffset, text.indexOf('C();'));
+      expect(executable.periodOffset, 0);
+      expect(executable.nameEnd, 0);
+    }
     expect(executable.isRedirectedConstructor, isFalse);
     expect(executable.redirectedConstructor, isNull);
     expect(executable.redirectedConstructorName, isEmpty);
-    expect(executable.visibleOffset, 0);
-    expect(executable.visibleLength, 0);
+
+    if (includeInformative) {
+      expect(executable.visibleOffset, 0);
+      expect(executable.visibleLength, 0);
+    }
   }
 
   test_constructor_anonymous() {
@@ -3494,6 +3554,7 @@
   }
 
   test_constructor_documented() {
+    if (!includeInformative) return;
     String text = '''
 class C {
   /**
@@ -3528,6 +3589,63 @@
     expect(executable, isNull);
   }
 
+  test_constructor_initializers_assertInvocation() {
+    UnlinkedExecutable executable =
+        findExecutable('', executables: serializeClassText(r'''
+class C {
+  const C(int x) : assert(x >= 42);
+}
+''').executables);
+    expect(executable.constantInitializers, hasLength(1));
+    UnlinkedConstructorInitializer initializer =
+        executable.constantInitializers[0];
+    expect(
+        initializer.kind, UnlinkedConstructorInitializerKind.assertInvocation);
+    expect(initializer.name, '');
+    expect(initializer.expression, isNull);
+    expect(initializer.arguments, hasLength(1));
+    assertUnlinkedConst(initializer.arguments[0], operators: [
+      UnlinkedExprOperation.pushParameter,
+      UnlinkedExprOperation.pushInt,
+      UnlinkedExprOperation.greaterEqual
+    ], ints: [
+      42
+    ], strings: [
+      'x'
+    ]);
+  }
+
+  test_constructor_initializers_assertInvocation_message() {
+    UnlinkedExecutable executable =
+        findExecutable('', executables: serializeClassText(r'''
+class C {
+  const C(int x) : assert(x >= 42, 'foo');
+}
+''').executables);
+    expect(executable.constantInitializers, hasLength(1));
+    UnlinkedConstructorInitializer initializer =
+        executable.constantInitializers[0];
+    expect(
+        initializer.kind, UnlinkedConstructorInitializerKind.assertInvocation);
+    expect(initializer.name, '');
+    expect(initializer.expression, isNull);
+    expect(initializer.arguments, hasLength(2));
+    assertUnlinkedConst(initializer.arguments[0], operators: [
+      UnlinkedExprOperation.pushParameter,
+      UnlinkedExprOperation.pushInt,
+      UnlinkedExprOperation.greaterEqual
+    ], ints: [
+      42
+    ], strings: [
+      'x',
+    ]);
+    assertUnlinkedConst(initializer.arguments[1], operators: [
+      UnlinkedExprOperation.pushString,
+    ], strings: [
+      'foo'
+    ]);
+  }
+
   test_constructor_initializers_field() {
     UnlinkedExecutable executable =
         findExecutable('', executables: serializeClassText(r'''
@@ -3541,7 +3659,7 @@
         executable.constantInitializers[0];
     expect(initializer.kind, UnlinkedConstructorInitializerKind.field);
     expect(initializer.name, 'x');
-    _assertUnlinkedConst(initializer.expression,
+    assertUnlinkedConst(initializer.expression,
         operators: [UnlinkedExprOperation.pushInt], ints: [42]);
     expect(initializer.arguments, isEmpty);
   }
@@ -3559,7 +3677,7 @@
         executable.constantInitializers[0];
     expect(initializer.kind, UnlinkedConstructorInitializerKind.field);
     expect(initializer.name, 'x');
-    _assertUnlinkedConst(initializer.expression,
+    assertUnlinkedConst(initializer.expression,
         operators: [UnlinkedExprOperation.pushParameter], strings: ['p']);
     expect(initializer.arguments, isEmpty);
   }
@@ -3593,7 +3711,7 @@
     expect(initializer.name, 'aaa');
     expect(initializer.expression, isNull);
     expect(initializer.arguments, hasLength(1));
-    _assertUnlinkedConst(initializer.arguments[0],
+    assertUnlinkedConst(initializer.arguments[0],
         operators: [UnlinkedExprOperation.pushInt], ints: [42]);
   }
 
@@ -3615,11 +3733,11 @@
     expect(initializer.name, '');
     expect(initializer.expression, isNull);
     expect(initializer.arguments, hasLength(3));
-    _assertUnlinkedConst(initializer.arguments[0],
+    assertUnlinkedConst(initializer.arguments[0],
         operators: [UnlinkedExprOperation.pushInt], ints: [1]);
-    _assertUnlinkedConst(initializer.arguments[1],
+    assertUnlinkedConst(initializer.arguments[1],
         operators: [UnlinkedExprOperation.pushInt], ints: [2]);
-    _assertUnlinkedConst(initializer.arguments[2],
+    assertUnlinkedConst(initializer.arguments[2],
         operators: [UnlinkedExprOperation.pushInt], ints: [3]);
     expect(initializer.argumentNames, ['b', 'c']);
   }
@@ -3642,7 +3760,7 @@
     expect(initializer.name, '');
     expect(initializer.expression, isNull);
     expect(initializer.arguments, hasLength(1));
-    _assertUnlinkedConst(initializer.arguments[0],
+    assertUnlinkedConst(initializer.arguments[0],
         operators: [UnlinkedExprOperation.pushInt], ints: [42]);
   }
 
@@ -3661,9 +3779,9 @@
     expect(initializer.name, 'named');
     expect(initializer.expression, isNull);
     expect(initializer.arguments, hasLength(2));
-    _assertUnlinkedConst(initializer.arguments[0],
+    assertUnlinkedConst(initializer.arguments[0],
         operators: [UnlinkedExprOperation.pushInt], ints: [1]);
-    _assertUnlinkedConst(initializer.arguments[1],
+    assertUnlinkedConst(initializer.arguments[1],
         operators: [UnlinkedExprOperation.pushString], strings: ['bbb']);
   }
 
@@ -3682,11 +3800,11 @@
     expect(initializer.name, 'named');
     expect(initializer.expression, isNull);
     expect(initializer.arguments, hasLength(3));
-    _assertUnlinkedConst(initializer.arguments[0],
+    assertUnlinkedConst(initializer.arguments[0],
         operators: [UnlinkedExprOperation.pushInt], ints: [1]);
-    _assertUnlinkedConst(initializer.arguments[1],
+    assertUnlinkedConst(initializer.arguments[1],
         operators: [UnlinkedExprOperation.pushInt], ints: [2]);
-    _assertUnlinkedConst(initializer.arguments[2],
+    assertUnlinkedConst(initializer.arguments[2],
         operators: [UnlinkedExprOperation.pushInt], ints: [3]);
     expect(initializer.argumentNames, ['b', 'c']);
   }
@@ -3706,9 +3824,9 @@
     expect(initializer.name, '');
     expect(initializer.expression, isNull);
     expect(initializer.arguments, hasLength(2));
-    _assertUnlinkedConst(initializer.arguments[0],
+    assertUnlinkedConst(initializer.arguments[0],
         operators: [UnlinkedExprOperation.pushInt], ints: [1]);
-    _assertUnlinkedConst(initializer.arguments[1],
+    assertUnlinkedConst(initializer.arguments[1],
         operators: [UnlinkedExprOperation.pushString], strings: ['bbb']);
   }
 
@@ -3793,7 +3911,7 @@
     expect(param.isFunctionTyped, isTrue);
     expect(param.kind, UnlinkedParamKind.positional);
     expect(param.defaultValueCode, 'foo');
-    _assertUnlinkedConst(param.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(param.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -3837,8 +3955,10 @@
     expect(parameter.kind, UnlinkedParamKind.named);
     expect(parameter.initializer, isNotNull);
     expect(parameter.defaultValueCode, '42');
-    _assertCodeRange(parameter.codeRange, 13, 10);
-    _assertUnlinkedConst(parameter.initializer.bodyExpr,
+    if (includeInformative) {
+      _assertCodeRange(parameter.codeRange, 13, 10);
+    }
+    assertUnlinkedConst(parameter.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushInt], ints: [42]);
   }
 
@@ -3869,8 +3989,10 @@
     expect(parameter.kind, UnlinkedParamKind.positional);
     expect(parameter.initializer, isNotNull);
     expect(parameter.defaultValueCode, '42');
-    _assertCodeRange(parameter.codeRange, 13, 11);
-    _assertUnlinkedConst(parameter.initializer.bodyExpr,
+    if (includeInformative) {
+      _assertCodeRange(parameter.codeRange, 13, 11);
+    }
+    assertUnlinkedConst(parameter.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushInt], ints: [42]);
   }
 
@@ -3902,7 +4024,7 @@
     UnlinkedParam param = executable.parameters[0];
     expect(param.kind, UnlinkedParamKind.positional);
     expect(param.defaultValueCode, '42');
-    _assertUnlinkedConst(param.initializer.bodyExpr,
+    assertUnlinkedConst(param.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushInt], ints: [42]);
   }
 
@@ -3911,10 +4033,12 @@
     UnlinkedExecutable executable = findExecutable('foo',
         executables: serializeClassText(text).executables);
     expect(executable.name, 'foo');
-    expect(executable.nameOffset, text.indexOf('foo'));
-    expect(executable.periodOffset, text.indexOf('.foo'));
-    expect(executable.nameEnd, text.indexOf('()'));
-    _assertCodeRange(executable.codeRange, 10, 8);
+    if (includeInformative) {
+      expect(executable.nameOffset, text.indexOf('foo'));
+      expect(executable.periodOffset, text.indexOf('.foo'));
+      expect(executable.nameEnd, text.indexOf('()'));
+      _assertCodeRange(executable.codeRange, 10, 8);
+    }
   }
 
   test_constructor_non_const() {
@@ -5012,11 +5136,15 @@
     String text = 'enum E { v1 }';
     UnlinkedEnum e = serializeEnumText(text);
     expect(e.name, 'E');
-    expect(e.nameOffset, text.indexOf('E'));
+    if (includeInformative) {
+      expect(e.nameOffset, text.indexOf('E'));
+    }
     expect(e.values, hasLength(1));
     expect(e.values[0].name, 'v1');
-    expect(e.values[0].nameOffset, text.indexOf('v1'));
-    _assertCodeRange(e.codeRange, 0, 13);
+    if (includeInformative) {
+      expect(e.values[0].nameOffset, text.indexOf('v1'));
+      _assertCodeRange(e.codeRange, 0, 13);
+    }
     expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
     expect(unlinkedUnits[0].publicNamespace.names[0].kind,
         ReferenceKind.classOrEnum);
@@ -5038,6 +5166,7 @@
   }
 
   test_enum_documented() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -5062,6 +5191,7 @@
   }
 
   test_enum_value_documented() {
+    if (!includeInformative) return;
     String text = '''
 enum E {
   /**
@@ -5101,9 +5231,11 @@
     expect(executable.isAsynchronous, isFalse);
     expect(executable.isExternal, isFalse);
     expect(executable.isGenerator, isFalse);
-    expect(executable.nameOffset, text.indexOf('f'));
-    expect(executable.visibleOffset, 0);
-    expect(executable.visibleLength, 0);
+    if (includeInformative) {
+      expect(executable.nameOffset, text.indexOf('f'));
+      expect(executable.visibleOffset, 0);
+      expect(executable.visibleLength, 0);
+    }
     expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
     expect(unlinkedUnits[0].publicNamespace.names[0].kind,
         ReferenceKind.topLevelFunction);
@@ -5153,7 +5285,9 @@
     expect(executable.isAsynchronous, isFalse);
     expect(executable.isExternal, isFalse);
     expect(executable.isGenerator, isFalse);
-    expect(executable.nameOffset, text.indexOf('f'));
+    if (includeInformative) {
+      expect(executable.nameOffset, text.indexOf('f'));
+    }
     expect(findVariable('f'), isNull);
     expect(findExecutable('f='), isNull);
     expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
@@ -5518,9 +5652,11 @@
     expect(executable.isAsynchronous, isFalse);
     expect(executable.isExternal, isFalse);
     expect(executable.isGenerator, isFalse);
-    expect(executable.visibleOffset, 0);
-    expect(executable.visibleLength, 0);
-    _assertCodeRange(executable.codeRange, 10, 6);
+    if (includeInformative) {
+      expect(executable.visibleOffset, 0);
+      expect(executable.visibleLength, 0);
+      _assertCodeRange(executable.codeRange, 10, 6);
+    }
   }
 
   test_executable_member_function_async() {
@@ -5571,7 +5707,9 @@
     expect(executable.isExternal, isFalse);
     expect(executable.isGenerator, isFalse);
     expect(executable.isStatic, isFalse);
-    _assertCodeRange(executable.codeRange, 10, 15);
+    if (includeInformative) {
+      _assertCodeRange(executable.codeRange, 10, 15);
+    }
     expect(findVariable('f', variables: cls.fields), isNull);
     expect(findExecutable('f=', executables: cls.executables), isNull);
     expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
@@ -5614,7 +5752,9 @@
     expect(executable.isAsynchronous, isFalse);
     expect(executable.isExternal, isFalse);
     expect(executable.isGenerator, isFalse);
-    _assertCodeRange(executable.codeRange, 10, 20);
+    if (includeInformative) {
+      _assertCodeRange(executable.codeRange, 10, 20);
+    }
     expect(findVariable('f', variables: cls.fields), isNull);
     expect(findExecutable('f', executables: cls.executables), isNull);
   }
@@ -5661,8 +5801,8 @@
 
   test_executable_operator() {
     UnlinkedExecutable executable =
-        serializeClassText('class C { C operator+(C c) => null; }').executables[
-            0];
+        serializeClassText('class C { C operator+(C c) => null; }')
+            .executables[0];
     expect(executable.kind, UnlinkedExecutableKind.functionOrMethod);
     expect(executable.name, '+');
     expect(executable.returnType, isNotNull);
@@ -5752,6 +5892,7 @@
   }
 
   test_executable_param_codeRange() {
+    if (!includeInformative) return;
     UnlinkedExecutable executable = serializeExecutableText('f(int x) {}');
     UnlinkedParam parameter = executable.parameters[0];
     _assertCodeRange(parameter.codeRange, 2, 5);
@@ -5812,7 +5953,7 @@
     expect(param.kind, UnlinkedParamKind.positional);
     expect(param.initializer, isNotNull);
     expect(param.defaultValueCode, 'foo');
-    _assertUnlinkedConst(param.initializer.bodyExpr, operators: [
+    assertUnlinkedConst(param.initializer.bodyExpr, operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -5834,8 +5975,10 @@
     expect(param.kind, UnlinkedParamKind.named);
     expect(param.initializer, isNotNull);
     expect(param.defaultValueCode, '42');
-    _assertCodeRange(param.codeRange, 3, 5);
-    _assertUnlinkedConst(param.initializer.bodyExpr,
+    if (includeInformative) {
+      _assertCodeRange(param.codeRange, 3, 5);
+    }
+    assertUnlinkedConst(param.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushInt], ints: [42]);
   }
 
@@ -5853,8 +5996,10 @@
     expect(param.kind, UnlinkedParamKind.positional);
     expect(param.initializer, isNotNull);
     expect(param.defaultValueCode, '42');
-    _assertCodeRange(param.codeRange, 3, 6);
-    _assertUnlinkedConst(param.initializer.bodyExpr,
+    if (includeInformative) {
+      _assertCodeRange(param.codeRange, 3, 6);
+    }
+    assertUnlinkedConst(param.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushInt], ints: [42]);
   }
 
@@ -5871,7 +6016,19 @@
     UnlinkedExecutable executable = serializeExecutableText(text);
     expect(executable.parameters, hasLength(1));
     expect(executable.parameters[0].name, 'x');
-    expect(executable.parameters[0].nameOffset, text.indexOf('x'));
+    if (includeInformative) {
+      expect(executable.parameters[0].nameOffset, text.indexOf('x'));
+    }
+  }
+
+  test_executable_param_isFinal() {
+    String text = 'f(x, final y) {}';
+    UnlinkedExecutable executable = serializeExecutableText(text);
+    expect(executable.parameters, hasLength(2));
+    expect(executable.parameters[0].name, 'x');
+    expect(executable.parameters[0].isFinal, isFalse);
+    expect(executable.parameters[1].name, 'y');
+    expect(executable.parameters[1].isFinal, isTrue);
   }
 
   test_executable_param_no_flags() {
@@ -5976,7 +6133,9 @@
     expect(executable.isAsynchronous, isFalse);
     expect(executable.isExternal, isFalse);
     expect(executable.isGenerator, isFalse);
-    expect(executable.nameOffset, text.indexOf('f'));
+    if (includeInformative) {
+      expect(executable.nameOffset, text.indexOf('f'));
+    }
     expect(findVariable('f'), isNull);
     expect(findExecutable('f'), isNull);
     expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
@@ -6175,9 +6334,11 @@
         'Future');
     expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].hides[1],
         'Stream');
-    expect(
-        unlinkedUnits[0].publicNamespace.exports[0].combinators[0].offset, 0);
-    expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].end, 0);
+    if (includeInformative) {
+      expect(
+          unlinkedUnits[0].publicNamespace.exports[0].combinators[0].offset, 0);
+      expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].end, 0);
+    }
     expect(linked.exportNames, isNotEmpty);
   }
 
@@ -6293,10 +6454,12 @@
         'Future');
     expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].shows[1],
         'Stream');
-    expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].offset,
-        libraryText.indexOf('show'));
-    expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].end,
-        libraryText.indexOf(';'));
+    if (includeInformative) {
+      expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].offset,
+          libraryText.indexOf('show'));
+      expect(unlinkedUnits[0].publicNamespace.exports[0].combinators[0].end,
+          libraryText.indexOf(';'));
+    }
   }
 
   test_export_typedef() {
@@ -6318,6 +6481,17 @@
     expect(unlinkedExports[0].configurations, isEmpty);
   }
 
+  test_export_uri_nullStringValue() {
+    String libraryText = r'''
+export "${'a'}.dart";
+''';
+    serializeLibraryText(libraryText);
+    var unlinkedExports = unlinkedUnits[0].publicNamespace.exports;
+    expect(unlinkedExports, hasLength(1));
+    expect(unlinkedExports[0].uri, '');
+    expect(unlinkedExports[0].configurations, isEmpty);
+  }
+
   test_export_variable() {
     addNamedSource('/a.dart', 'var v;');
     serializeLibraryText('export "a.dart";');
@@ -6416,7 +6590,7 @@
 A a = new A();
 final v = (a.b.c.f[1] = 5);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -6461,7 +6635,7 @@
 A a = new A();
 final v = (a.b[1].c[2].f[3] = 5);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           // 5
@@ -6510,7 +6684,7 @@
 List<int> a = <int>[0, 1, 2];
 final v = (a[1] = 5);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -6542,7 +6716,7 @@
 }
 final v = (new C().f = 5);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -6576,7 +6750,7 @@
 }
 final v = (C.f = 1);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -6615,7 +6789,7 @@
 A a = new A();
 final v = (a.b.c.f = 1);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -6668,7 +6842,7 @@
 int a = 0;
 final v = (a = 1);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -6700,7 +6874,7 @@
 import 'a.dart';
 final v = (a = 1);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -6732,7 +6906,7 @@
 import 'a.dart' as p;
 final v = (p.a = 1);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -6765,7 +6939,7 @@
 final C c = new C();
 final v = c.items..[1] = 2;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushReference,
@@ -6806,7 +6980,7 @@
 }
 final v = new C()..f1 = 1..f2 += 2;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           // new C()
@@ -6861,7 +7035,7 @@
   ..b = (new B()..fb = 2)
   ..fa2 = 3;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           // new A()
@@ -6929,7 +7103,7 @@
 final A a = new A();
 final v = a..m(5).abs()..m(6);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           // a
@@ -6975,7 +7149,7 @@
 }
 final v = new C().items[5];
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.invokeConstructor,
@@ -7007,7 +7181,7 @@
 }
 final v = new C().f;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.invokeConstructor,
@@ -7034,7 +7208,7 @@
 final v = foo(5, () => 42);
 foo(a, b) {}
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -7063,7 +7237,7 @@
 final v = foo(5, () => 42, () => 43);
 foo(a, b, c) {}
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -7094,7 +7268,7 @@
     UnlinkedVariable variable = serializeVariableText('''
 final v = () { return 42; };
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [UnlinkedExprOperation.pushLocalFunctionReference],
         ints: [0, 0]);
@@ -7107,7 +7281,7 @@
     UnlinkedVariable variable = serializeVariableText('''
 final v = () => 42;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [UnlinkedExprOperation.pushLocalFunctionReference],
         ints: [0, 0]);
@@ -7120,7 +7294,7 @@
     UnlinkedVariable variable = serializeVariableText('''
 final v = ((a, b) {return 42;})(1, 2);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false, operators: [UnlinkedExprOperation.pushNull]);
   }
 
@@ -7131,7 +7305,7 @@
     UnlinkedVariable variable = serializeVariableText('''
 final v = ((a, b) => 42)(1, 2);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false, operators: [UnlinkedExprOperation.pushNull]);
   }
 
@@ -7140,7 +7314,7 @@
       return;
     }
     UnlinkedVariable variable = serializeVariableText('var v = () => 1;');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         operators: [UnlinkedExprOperation.pushInt], ints: [1]);
   }
 
@@ -7157,7 +7331,7 @@
     }
     UnlinkedVariable variable =
         serializeVariableText('var v = (x) => (y) => x;');
-    _assertUnlinkedConst(
+    assertUnlinkedConst(
         variable.initializer.localFunctions[0].localFunctions[0].bodyExpr,
         operators: [UnlinkedExprOperation.pushParameter],
         strings: ['x']);
@@ -7168,7 +7342,7 @@
       return;
     }
     UnlinkedVariable variable = serializeVariableText('var v = (x) => x;');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         operators: [UnlinkedExprOperation.pushParameter], strings: ['x']);
   }
 
@@ -7177,7 +7351,7 @@
       return;
     }
     UnlinkedVariable variable = serializeVariableText('var v = (x) => x.f();');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushParameter,
@@ -7200,7 +7374,7 @@
     }
     UnlinkedVariable variable =
         serializeVariableText('var v = (x) => x.y.f();');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushParameter,
@@ -7225,7 +7399,7 @@
     }
     UnlinkedVariable variable =
         serializeVariableText('var x; var v = (b) => (b ? (x) => x : x);');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushParameter,
@@ -7251,7 +7425,7 @@
       return;
     }
     UnlinkedVariable variable = serializeVariableText('var v = (x) => x.y;');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         operators: [
           UnlinkedExprOperation.pushParameter,
           UnlinkedExprOperation.extractProperty
@@ -7268,7 +7442,7 @@
     }
     UnlinkedVariable variable =
         serializeVariableText('var v = (x) => x.y = null;');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushNull,
@@ -7289,7 +7463,7 @@
       return;
     }
     UnlinkedVariable variable = serializeVariableText('var v = (x) => x.y.z;');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         operators: [
           UnlinkedExprOperation.pushParameter,
           UnlinkedExprOperation.extractProperty,
@@ -7308,7 +7482,7 @@
     }
     UnlinkedVariable variable =
         serializeVariableText('var v = (x) => x.y.z = null;');
-    _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+    assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushNull,
@@ -7336,7 +7510,7 @@
 }
 final v = new C().m(1, b: 2, c: 3);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.invokeConstructor,
@@ -7376,7 +7550,7 @@
 }
 final v = new C().f<int, String>();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.invokeConstructor,
@@ -7416,7 +7590,7 @@
 A a = new A();
 final v = a.b.c.m(10, 20);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -7458,7 +7632,7 @@
 import 'a.dart' as p;
 final v = p.C.m();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.invokeMethodRef,
@@ -7489,7 +7663,7 @@
 final u = null;
 final v = f(u);
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushReference,
@@ -7516,7 +7690,7 @@
 f<T, U>() => null;
 final v = f<int, String>();
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.invokeMethodRef
@@ -7542,7 +7716,7 @@
     UnlinkedVariable variable = serializeVariableText('''
 final v = throw 1 + 2;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -7563,7 +7737,7 @@
     UnlinkedVariable variable = serializeVariableText('''
 final v = 42 as num;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -7585,7 +7759,7 @@
     UnlinkedVariable variable = serializeVariableText('''
 final v = 42 is num;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -7619,11 +7793,12 @@
     UnlinkedVariable variable =
         serializeClassText('class C { static const int i = 0; }').fields[0];
     expect(variable.isConst, isTrue);
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushInt], ints: [0]);
   }
 
   test_field_documented() {
+    if (!includeInformative) return;
     String text = '''
 class C {
   /**
@@ -7640,7 +7815,7 @@
     UnlinkedVariable variable =
         serializeClassText('class C { final int i = 0; }').fields[0];
     expect(variable.isFinal, isTrue);
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.pushInt], ints: [0]);
   }
 
@@ -7651,7 +7826,7 @@
   static int m() => 42;
 }''').fields[0];
     expect(variable.isFinal, isTrue);
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -7680,7 +7855,7 @@
   final f = <T>[];
 }''').fields[0];
     expect(variable.isFinal, isTrue);
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         operators: [UnlinkedExprOperation.makeTypedList],
         ints: [0],
         referenceValidators: [(EntityRef r) => checkParamTypeRef(r, 1)]);
@@ -7815,6 +7990,7 @@
   }
 
   test_function_documented() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -7847,6 +8023,7 @@
   }
 
   test_getter_documented() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -7956,8 +8133,10 @@
     expect(unlinkedUnits[0].imports[0].combinators[0].hides, hasLength(2));
     expect(unlinkedUnits[0].imports[0].combinators[0].hides[0], 'Future');
     expect(unlinkedUnits[0].imports[0].combinators[0].hides[1], 'Stream');
-    expect(unlinkedUnits[0].imports[0].combinators[0].offset, 0);
-    expect(unlinkedUnits[0].imports[0].combinators[0].end, 0);
+    if (includeInformative) {
+      expect(unlinkedUnits[0].imports[0].combinators[0].offset, 0);
+      expect(unlinkedUnits[0].imports[0].combinators[0].end, 0);
+    }
   }
 
   test_import_implicit() {
@@ -7966,8 +8145,10 @@
     expect(unlinkedUnits[0].imports, hasLength(1));
     checkDependency(linked.importDependencies[0], 'dart:core', 'dart:core');
     expect(unlinkedUnits[0].imports[0].uri, isEmpty);
-    expect(unlinkedUnits[0].imports[0].uriOffset, 0);
-    expect(unlinkedUnits[0].imports[0].uriEnd, 0);
+    if (includeInformative) {
+      expect(unlinkedUnits[0].imports[0].uriOffset, 0);
+      expect(unlinkedUnits[0].imports[0].uriEnd, 0);
+    }
     expect(unlinkedUnits[0].imports[0].prefixReference, 0);
     expect(unlinkedUnits[0].imports[0].combinators, isEmpty);
     expect(unlinkedUnits[0].imports[0].isImplicit, isTrue);
@@ -8186,6 +8367,16 @@
     expect(unlinkedUnits[0].imports[0].uri, 'dart:async');
   }
 
+  test_import_uri_nullStringValue() {
+    String libraryText = r'''
+import "${'a'}.dart";
+''';
+    serializeLibraryText(libraryText);
+    // Second import is the implicit import of dart:core
+    expect(unlinkedUnits[0].imports, hasLength(2));
+    expect(unlinkedUnits[0].imports[0].uri, '');
+  }
+
   test_inferred_function_type_parameter_type_with_unrelated_type_param() {
     if (!strongMode || skipFullyLinkedData) {
       return;
@@ -8597,6 +8788,7 @@
   }
 
   test_library_documented() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -8698,6 +8890,11 @@
     checkTypeRef(findVariable('d').type, absUri('/a.dart'), 'a.dart', 'D');
   }
 
+  test_localNameShadowsImportPrefix() {
+    serializeLibraryText('import "dart:async" as a; class a {}; a x;');
+    checkTypeRef(findVariable('x').type, null, null, 'a');
+  }
+
   test_metadata_classDeclaration() {
     checkAnnotationA(
         serializeClassText('const a = null; @a class C {}').annotations);
@@ -8714,7 +8911,7 @@
     UnlinkedClass cls = serializeClassText(
         'class A { const A.named(); } @A.named() class C {}');
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8733,7 +8930,7 @@
     UnlinkedClass cls = serializeClassText(
         'import "foo.dart" as foo; @foo.A.named() class C {}');
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8755,7 +8952,7 @@
         'import "foo.dart" as foo; @foo.A.named() class C {}',
         allowErrors: true);
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8776,7 +8973,7 @@
         'import "foo.dart" as foo; @foo.A.named() class C {}',
         allowErrors: true);
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8796,7 +8993,7 @@
     UnlinkedClass cls =
         serializeClassText('@A.named() class C {}', allowErrors: true);
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8814,7 +9011,7 @@
     UnlinkedClass cls = serializeClassText('class A {} @A.named() class C {}',
         allowErrors: true);
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8832,7 +9029,7 @@
     UnlinkedClass cls =
         serializeClassText('class A { const A(); } @A() class C {}');
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8848,7 +9045,7 @@
     UnlinkedClass cls =
         serializeClassText('import "foo.dart" as foo; @foo.A() class C {}');
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8865,7 +9062,7 @@
         'import "foo.dart" as foo; @foo.A() class C {}',
         allowErrors: true);
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8880,7 +9077,7 @@
     UnlinkedClass cls =
         serializeClassText('@A() class C {}', allowErrors: true);
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
       0,
@@ -8895,7 +9092,7 @@
     UnlinkedClass cls =
         serializeClassText('class A { const A(x); } @A(null) class C {}');
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.pushNull,
       UnlinkedExprOperation.invokeConstructor,
     ], ints: [
@@ -8995,6 +9192,28 @@
     checkAnnotationA(unlinkedUnits[0].imports[0].annotations);
   }
 
+  test_metadata_invalid_instanceCreation_argument_this() {
+    List<UnlinkedExpr> annotations = serializeClassText('''
+class A {
+  const A(_);
+}
+
+@A(this)
+class C {}
+''').annotations;
+    expect(annotations, hasLength(1));
+    assertUnlinkedConst(annotations[0], operators: [
+      UnlinkedExprOperation.pushThis,
+      UnlinkedExprOperation.invokeConstructor,
+    ], ints: [
+      0,
+      1
+    ], referenceValidators: [
+      (EntityRef r) => checkTypeRef(r, null, null, 'A',
+          expectedKind: ReferenceKind.classOrEnum)
+    ]);
+  }
+
   test_metadata_libraryDirective() {
     serializeLibraryText('@a library L; const a = null;');
     checkAnnotationA(unlinkedUnits[0].libraryAnnotations);
@@ -9025,13 +9244,13 @@
         serializeClassText('const a = null, b = null; @a @b class C {}');
     List<UnlinkedExpr> annotations = cls.annotations;
     expect(annotations, hasLength(2));
-    _assertUnlinkedConst(annotations[0], operators: [
+    assertUnlinkedConst(annotations[0], operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'a',
           expectedKind: ReferenceKind.topLevelPropertyAccessor)
     ]);
-    _assertUnlinkedConst(annotations[1], operators: [
+    assertUnlinkedConst(annotations[1], operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'b',
@@ -9050,7 +9269,7 @@
     UnlinkedClass cls =
         serializeClassText('import "a.dart" as a; @a.b class C {}');
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'b',
@@ -9065,7 +9284,7 @@
         'import "a.dart" as a; @a.b class C {}',
         allowErrors: true);
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'b',
@@ -9120,7 +9339,7 @@
   test_metadata_variable_unresolved() {
     UnlinkedClass cls = serializeClassText('@a class C {}', allowErrors: true);
     expect(cls.annotations, hasLength(1));
-    _assertUnlinkedConst(cls.annotations[0], operators: [
+    assertUnlinkedConst(cls.annotations[0], operators: [
       UnlinkedExprOperation.pushReference
     ], referenceValidators: [
       (EntityRef r) => checkTypeRef(r, null, null, 'a',
@@ -9129,6 +9348,7 @@
   }
 
   test_method_documented() {
+    if (!includeInformative) return;
     String text = '''
 class C {
   /**
@@ -9291,6 +9511,20 @@
     expect(unlinkedUnits[0].parts[0].uriEnd, text.indexOf('; // <-part'));
   }
 
+  test_part_declaration_invalidUri_nullStringValue() {
+    addNamedSource('/a.dart', 'part of my.lib;');
+    String text = r'''
+library my.lib;
+part "${'a'}.dart"; // <-part
+''';
+    serializeLibraryText(text);
+    expect(unlinkedUnits[0].publicNamespace.parts, hasLength(1));
+    expect(unlinkedUnits[0].publicNamespace.parts[0], '');
+    expect(unlinkedUnits[0].parts, hasLength(1));
+    expect(unlinkedUnits[0].parts[0].uriOffset, text.indexOf(r'"${'));
+    expect(unlinkedUnits[0].parts[0].uriEnd, text.indexOf('; // <-part'));
+  }
+
   test_part_isPartOf() {
     addNamedSource('/a.dart', 'part of foo; class C {}');
     serializeLibraryText('library foo; part "a.dart";');
@@ -9340,6 +9574,7 @@
   }
 
   test_setter_documented() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -9363,8 +9598,8 @@
 
   test_setter_inferred_type_nonstatic_explicit_return() {
     UnlinkedExecutable f =
-        serializeClassText('class C { void set f(int value) {} }').executables[
-            0];
+        serializeClassText('class C { void set f(int value) {} }')
+            .executables[0];
     expect(f.inferredReturnTypeSlot, 0);
   }
 
@@ -9608,6 +9843,7 @@
   }
 
   test_type_param_codeRange() {
+    if (!includeInformative) return;
     UnlinkedClass cls =
         serializeClassText('class A {} class C<T extends A> {}');
     UnlinkedTypeParam typeParameter = cls.typeParameters[0];
@@ -9861,11 +10097,13 @@
   }
 
   test_typedef_codeRange() {
+    if (!includeInformative) return;
     UnlinkedTypedef type = serializeTypedefText('typedef F();');
     _assertCodeRange(type.codeRange, 0, 12);
   }
 
   test_typedef_documented() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -9881,7 +10119,9 @@
     String text = 'typedef F();';
     UnlinkedTypedef type = serializeTypedefText(text);
     expect(type.name, 'F');
-    expect(type.nameOffset, text.indexOf('F'));
+    if (includeInformative) {
+      expect(type.nameOffset, text.indexOf('F'));
+    }
     expect(unlinkedUnits[0].publicNamespace.names, hasLength(1));
     expect(
         unlinkedUnits[0].publicNamespace.names[0].kind, ReferenceKind.typedef);
@@ -9950,6 +10190,7 @@
   }
 
   test_unit_codeRange() {
+    if (!includeInformative) return;
     serializeLibraryText('  int a = 1;  ');
     UnlinkedUnit unit = unlinkedUnits[0];
     _assertCodeRange(unit.codeRange, 0, 14);
@@ -10028,7 +10269,9 @@
   test_variable() {
     String text = 'int i;';
     UnlinkedVariable v = serializeVariableText(text, variableName: 'i');
-    expect(v.nameOffset, text.indexOf('i;'));
+    if (includeInformative) {
+      expect(v.nameOffset, text.indexOf('i;'));
+    }
     expect(findExecutable('i'), isNull);
     expect(findExecutable('i='), isNull);
     expect(unlinkedUnits[0].publicNamespace.names, hasLength(2));
@@ -10043,6 +10286,7 @@
   }
 
   test_variable_codeRange() {
+    if (!includeInformative) return;
     serializeLibraryText(' int a = 1, b = 22;');
     List<UnlinkedVariable> variables = unlinkedUnits[0].variables;
     _assertCodeRange(variables[0].codeRange, 1, 18);
@@ -10056,6 +10300,7 @@
   }
 
   test_variable_documented() {
+    if (!includeInformative) return;
     String text = '''
 // Extra comment so doc comment offset != 0
 /**
@@ -10108,7 +10353,9 @@
     UnlinkedVariable variable = serializeVariableText('var v = 42;');
     UnlinkedExecutable initializer = variable.initializer;
     expect(initializer, isNotNull);
-    expect(initializer.nameOffset, 8);
+    if (includeInformative) {
+      expect(initializer.nameOffset, 8);
+    }
     expect(initializer.name, isEmpty);
     expect(initializer.localFunctions, isEmpty);
     expect(initializer.localVariables, isEmpty);
@@ -10125,36 +10372,50 @@
     UnlinkedVariable variable = serializeVariableText(text);
     UnlinkedExecutable initializer = variable.initializer;
     expect(initializer, isNotNull);
-    expect(initializer.nameOffset, text.indexOf('<dynamic, dynamic>{"1'));
+    if (includeInformative) {
+      expect(initializer.nameOffset, text.indexOf('<dynamic, dynamic>{"1'));
+    }
     expect(initializer.name, isEmpty);
     expect(initializer.localFunctions, hasLength(2));
     // closure: () { f1() {} var v1; }
     {
       UnlinkedExecutable closure = initializer.localFunctions[0];
-      expect(closure.nameOffset, text.indexOf('() { f1()'));
+      if (includeInformative) {
+        expect(closure.nameOffset, text.indexOf('() { f1()'));
+      }
       expect(closure.name, isEmpty);
       // closure - f1
       expect(closure.localFunctions, hasLength(1));
       expect(closure.localFunctions[0].name, 'f1');
-      expect(closure.localFunctions[0].nameOffset, text.indexOf('f1()'));
+      if (includeInformative) {
+        expect(closure.localFunctions[0].nameOffset, text.indexOf('f1()'));
+      }
       // closure - v1
       expect(closure.localVariables, hasLength(1));
       expect(closure.localVariables[0].name, 'v1');
-      expect(closure.localVariables[0].nameOffset, text.indexOf('v1;'));
+      if (includeInformative) {
+        expect(closure.localVariables[0].nameOffset, text.indexOf('v1;'));
+      }
     }
     // closure: () { f2() {} var v2; }
     {
       UnlinkedExecutable closure = initializer.localFunctions[1];
-      expect(closure.nameOffset, text.indexOf('() { f2()'));
+      if (includeInformative) {
+        expect(closure.nameOffset, text.indexOf('() { f2()'));
+      }
       expect(closure.name, isEmpty);
       // closure - f1
       expect(closure.localFunctions, hasLength(1));
       expect(closure.localFunctions[0].name, 'f2');
-      expect(closure.localFunctions[0].nameOffset, text.indexOf('f2()'));
+      if (includeInformative) {
+        expect(closure.localFunctions[0].nameOffset, text.indexOf('f2()'));
+      }
       // closure - v1
       expect(closure.localVariables, hasLength(1));
       expect(closure.localVariables[0].name, 'v2');
-      expect(closure.localVariables[0].nameOffset, text.indexOf('v2;'));
+      if (includeInformative) {
+        expect(closure.localVariables[0].nameOffset, text.indexOf('v2;'));
+      }
     }
   }
 
@@ -10263,7 +10524,7 @@
 int a = 0;
 final v = $expr;
     ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.pushInt,
@@ -10330,7 +10591,7 @@
 int a = 0;
 final v = $expr;
 ''');
-    _assertUnlinkedConst(variable.initializer.bodyExpr,
+    assertUnlinkedConst(variable.initializer.bodyExpr,
         isValidConst: false,
         operators: [
           UnlinkedExprOperation.assignToRef,
@@ -10350,32 +10611,6 @@
         ]);
   }
 
-  /**
-   * TODO(scheglov) rename "Const" to "Expr" everywhere
-   */
-  void _assertUnlinkedConst(UnlinkedExpr constExpr,
-      {bool isValidConst: true,
-      List<UnlinkedExprOperation> operators: const <UnlinkedExprOperation>[],
-      List<UnlinkedExprAssignOperator> assignmentOperators:
-          const <UnlinkedExprAssignOperator>[],
-      List<int> ints: const <int>[],
-      List<double> doubles: const <double>[],
-      List<String> strings: const <String>[],
-      List<_EntityRefValidator> referenceValidators:
-          const <_EntityRefValidator>[]}) {
-    expect(constExpr, isNotNull);
-    expect(constExpr.isValidConst, isValidConst);
-    expect(constExpr.operations, operators);
-    expect(constExpr.ints, ints);
-    expect(constExpr.doubles, doubles);
-    expect(constExpr.strings, strings);
-    expect(constExpr.assignmentOperators, assignmentOperators);
-    expect(constExpr.references, hasLength(referenceValidators.length));
-    for (int i = 0; i < referenceValidators.length; i++) {
-      referenceValidators[i](constExpr.references[i]);
-    }
-  }
-
   void _assertVariableVisible(
       String code, UnlinkedVariable v, String visibleBegin, String visibleEnd) {
     int expectedVisibleOffset = code.indexOf(visibleBegin);
diff --git a/pkg/analyzer/test/src/summary/test_all.dart b/pkg/analyzer/test/src/summary/test_all.dart
index dd63f2f..bce3840 100644
--- a/pkg/analyzer/test/src/summary/test_all.dart
+++ b/pkg/analyzer/test/src/summary/test_all.dart
@@ -7,7 +7,6 @@
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
 import 'api_signature_test.dart' as api_signature_test;
-import 'bazel_summary_test.dart' as bazel_summary_test;
 import 'flat_buffers_test.dart' as flat_buffers_test;
 import 'in_summary_source_test.dart' as in_summary_source_test;
 import 'linker_test.dart' as linker_test;
@@ -23,7 +22,6 @@
 main() {
   defineReflectiveSuite(() {
     api_signature_test.main();
-    bazel_summary_test.main();
     flat_buffers_test.main();
     in_summary_source_test.main();
     linker_test.main();
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index 4041961..75d799de 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -5,6 +5,7 @@
 library analyzer.test.src.task.dart_test;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/ast/visitor.dart';
 import 'package:analyzer/dart/element/element.dart';
@@ -186,7 +187,7 @@
       unitElement.types[0].fields[0],
       unitElement.functions[0].localVariables[0],
       unitElement.types[0].constructors[0],
-      annotation.elementAnnotation,
+      resolutionMap.elementAnnotationForAnnotation(annotation),
       unitElement.types[0].constructors[0].parameters[0]
     ];
     expect(
@@ -580,7 +581,9 @@
     // Validate metadata
     expect(part.directives[0], new isInstanceOf<PartOfDirective>());
     expect(part.directives[0].element, same(libraryA));
-    expect(part.directives[0].element.metadata, isEmpty);
+    expect(
+        resolutionMap.elementDeclaredByDirective(part.directives[0]).metadata,
+        isEmpty);
   }
 
   void _assertErrorsWithCodes(List<ErrorCode> expectedErrorCodes) {
@@ -626,7 +629,8 @@
         matcher: isBuildEnumMemberElementsTask);
     CompilationUnit unit = outputs[RESOLVED_UNIT3];
     // validate Element
-    ClassElement enumElement = unit.element.getEnum('MyEnum');
+    ClassElement enumElement =
+        resolutionMap.elementDeclaredByCompilationUnit(unit).getEnum('MyEnum');
     List<FieldElement> fields = enumElement.fields;
     expect(fields, hasLength(4));
     {
@@ -832,7 +836,8 @@
     // CompilationUnitElement(s)
     CompilationUnitElement firstPart;
     CompilationUnitElement secondPart;
-    if (partUnits[0].element.uri == 'part1.dart') {
+    if (resolutionMap.elementDeclaredByCompilationUnit(partUnits[0]).uri ==
+        'part1.dart') {
       firstPart = partUnits[0].element;
       secondPart = partUnits[1].element;
     } else {
@@ -1000,10 +1005,16 @@
 '''
     });
     CompilationUnitElement unitElement1 = partUnits
-        .singleWhere((u) => u.element.name.endsWith('part1.dart'))
+        .singleWhere((u) => resolutionMap
+            .elementDeclaredByCompilationUnit(u)
+            .name
+            .endsWith('part1.dart'))
         .element;
     CompilationUnitElement unitElement2 = partUnits
-        .singleWhere((u) => u.element.name.endsWith('part2.dart'))
+        .singleWhere((u) => resolutionMap
+            .elementDeclaredByCompilationUnit(u)
+            .name
+            .endsWith('part2.dart'))
         .element;
     PropertyAccessorElement getter = unitElement1.accessors[0];
     PropertyAccessorElement setter = unitElement2.accessors[0];
@@ -1157,19 +1168,22 @@
     computeResult(librarySpecificUnit, RESOLVED_UNIT1);
     CompilationUnit unit = outputs[RESOLVED_UNIT1];
     // Find the elements for x and D's constructor, and the annotation on C.
-    List<PropertyAccessorElement> accessors = unit.element.accessors;
+    CompilationUnitElement compilationUnitElement =
+        resolutionMap.elementDeclaredByCompilationUnit(unit);
+    List<PropertyAccessorElement> accessors = compilationUnitElement.accessors;
     Element x = accessors
         .firstWhere((PropertyAccessorElement accessor) =>
             accessor.isGetter && accessor.name == 'x')
         .variable;
-    List<ClassElement> types = unit.element.types;
+    List<ClassElement> types = compilationUnitElement.types;
     Element constructorForD =
         types.firstWhere((ClassElement cls) => cls.name == 'D').constructors[0];
     Annotation annotation = findClassAnnotation(unit, 'C');
     // Now compute the dependencies for the annotation, and check that it is
     // the set [x, constructorForD].
     // TODO(paulberry): test librarySource != source
-    computeResult(annotation.elementAnnotation, CONSTANT_DEPENDENCIES,
+    computeResult(resolutionMap.elementAnnotationForAnnotation(annotation),
+        CONSTANT_DEPENDENCIES,
         matcher: isComputeConstantDependenciesTask);
     expect(
         outputs[CONSTANT_DEPENDENCIES].toSet(), [x, constructorForD].toSet());
@@ -1197,7 +1211,8 @@
     Annotation annotation = classC.members[0].metadata[0];
     // Now compute the dependencies for the annotation, and check that it is
     // the right size.
-    computeResult(annotation.elementAnnotation, CONSTANT_DEPENDENCIES,
+    computeResult(resolutionMap.elementAnnotationForAnnotation(annotation),
+        CONSTANT_DEPENDENCIES,
         matcher: isComputeConstantDependenciesTask);
     expect(outputs[CONSTANT_DEPENDENCIES], hasLength(1));
   }
@@ -1215,7 +1230,8 @@
     computeResult(librarySpecificUnit, RESOLVED_UNIT1);
     CompilationUnit unit = outputs[RESOLVED_UNIT1];
     // Find the element for x and the annotation on C.
-    List<PropertyAccessorElement> accessors = unit.element.accessors;
+    List<PropertyAccessorElement> accessors =
+        resolutionMap.elementDeclaredByCompilationUnit(unit).accessors;
     Element x = accessors
         .firstWhere((PropertyAccessorElement accessor) =>
             accessor.isGetter && accessor.name == 'x')
@@ -1223,7 +1239,8 @@
     Annotation annotation = findClassAnnotation(unit, 'C');
     // Now compute the dependencies for the annotation, and check that it is
     // the list [x].
-    computeResult(annotation.elementAnnotation, CONSTANT_DEPENDENCIES,
+    computeResult(resolutionMap.elementAnnotationForAnnotation(annotation),
+        CONSTANT_DEPENDENCIES,
         matcher: isComputeConstantDependenciesTask);
     expect(outputs[CONSTANT_DEPENDENCIES], [x]);
   }
@@ -1263,7 +1280,8 @@
     computeResult(librarySpecificUnit, RESOLVED_UNIT1);
     CompilationUnit unit = outputs[RESOLVED_UNIT1];
     // Find the elements for the constants x and y.
-    List<PropertyAccessorElement> accessors = unit.element.accessors;
+    List<PropertyAccessorElement> accessors =
+        resolutionMap.elementDeclaredByCompilationUnit(unit).accessors;
     Element x = accessors
         .firstWhere((PropertyAccessorElement accessor) =>
             accessor.isGetter && accessor.name == 'x')
@@ -1539,14 +1557,19 @@
     LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
     computeResult(target, RESOLVED_UNIT7);
     CompilationUnit unit = outputs[RESOLVED_UNIT7];
-    TopLevelVariableElement elementA = unit.element.topLevelVariables[0];
-    TopLevelVariableElement elementB = unit.element.topLevelVariables[1];
+    TopLevelVariableElement elementA = resolutionMap
+        .elementDeclaredByCompilationUnit(unit)
+        .topLevelVariables[0];
+    TopLevelVariableElement elementB = resolutionMap
+        .elementDeclaredByCompilationUnit(unit)
+        .topLevelVariables[1];
 
     computeResult(elementA, INFERABLE_STATIC_VARIABLE_DEPENDENCIES,
         matcher: isComputeInferableStaticVariableDependenciesTask);
     expect(outputs, hasLength(1));
-    List<VariableElement> dependencies = outputs[
-        INFERABLE_STATIC_VARIABLE_DEPENDENCIES] as List<VariableElement>;
+    List<VariableElement> dependencies =
+        outputs[INFERABLE_STATIC_VARIABLE_DEPENDENCIES]
+            as List<VariableElement>;
     expect(dependencies, unorderedEquals([elementB]));
   }
 }
@@ -2678,13 +2701,26 @@
     CompilationUnit unit = outputs[RESOLVED_UNIT10];
     VariableDeclaration field = AstFinder.getFieldInClass(unit, 'B', 'f');
     MethodDeclaration method = AstFinder.getMethodInClass(unit, 'B', 'm');
-    DartType typeX = AstFinder.getClass(unit, 'X').element.type;
-    DartType typeY = AstFinder.getClass(unit, 'Y').element.type;
-    DartType typeZ = AstFinder.getClass(unit, 'Z').element.type;
+    DartType typeX = resolutionMap
+        .elementDeclaredByClassDeclaration(AstFinder.getClass(unit, 'X'))
+        .type;
+    DartType typeY = resolutionMap
+        .elementDeclaredByClassDeclaration(AstFinder.getClass(unit, 'Y'))
+        .type;
+    DartType typeZ = resolutionMap
+        .elementDeclaredByClassDeclaration(AstFinder.getClass(unit, 'Z'))
+        .type;
 
-    expect(field.element.type, typeX);
-    expect(method.element.returnType, typeY);
-    expect(method.element.parameters[0].type, typeZ);
+    expect(
+        resolutionMap.elementDeclaredByVariableDeclaration(field).type, typeX);
+    expect(resolutionMap.elementDeclaredByMethodDeclaration(method).returnType,
+        typeY);
+    expect(
+        resolutionMap
+            .elementDeclaredByMethodDeclaration(method)
+            .parameters[0]
+            .type,
+        typeZ);
   }
 
   void test_perform_cross_library_const() {
@@ -2722,10 +2758,13 @@
         AstFinder.getFieldInClass(secondUnit, 'M', 'c');
     InterfaceType stringType = context.typeProvider.stringType;
 
-    expect(variableA.element.type, stringType);
-    expect(variableB.element.type, stringType);
+    expect(resolutionMap.elementDeclaredByVariableDeclaration(variableA).type,
+        stringType);
+    expect(resolutionMap.elementDeclaredByVariableDeclaration(variableB).type,
+        stringType);
     expect(variableB.initializer.staticType, stringType);
-    expect(variableC.element.type, stringType);
+    expect(resolutionMap.elementDeclaredByVariableDeclaration(variableC).type,
+        stringType);
     expect(variableC.initializer.staticType, stringType);
   }
 
@@ -2790,7 +2829,8 @@
     CompilationUnit unit = outputs[RESOLVED_UNIT8];
     VariableDeclaration declaration = AstFinder.getFieldInClass(unit, 'M', 'X');
     InterfaceType stringType = context.typeProvider.stringType;
-    expect(declaration.element.type, stringType);
+    expect(resolutionMap.elementDeclaredByVariableDeclaration(declaration).type,
+        stringType);
   }
 
   test_perform_hasParseError() {
@@ -2853,12 +2893,16 @@
     VariableDeclaration variableC =
         AstFinder.getTopLevelVariable(firstUnit, 'c');
     ClassDeclaration classM = AstFinder.getClass(secondUnit, 'M');
-    DartType typeM = classM.element.type;
+    DartType typeM =
+        resolutionMap.elementDeclaredByClassDeclaration(classM).type;
 
-    expect(variableA.element.type, typeM);
-    expect(variableB.element.type, typeM);
+    expect(resolutionMap.elementDeclaredByVariableDeclaration(variableA).type,
+        typeM);
+    expect(resolutionMap.elementDeclaredByVariableDeclaration(variableB).type,
+        typeM);
     expect(variableB.initializer.staticType, typeM);
-    expect(variableC.element.type, typeM);
+    expect(resolutionMap.elementDeclaredByVariableDeclaration(variableC).type,
+        typeM);
     expect(variableC.initializer.staticType, typeM);
   }
 
@@ -2900,8 +2944,9 @@
     expect(outputs[RESOLVED_UNIT8], isNotNull);
     expect(outputs[CREATED_RESOLVED_UNIT8], isTrue);
     // An INFERRED_TYPE_LITERAL error should be generated.
-    List<AnalysisError> errors = outputs[
-        STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT] as List<AnalysisError>;
+    List<AnalysisError> errors =
+        outputs[STATIC_VARIABLE_RESOLUTION_ERRORS_IN_UNIT]
+            as List<AnalysisError>;
     expect(errors, hasLength(1));
     expect(errors[0].errorCode, StrongModeCode.INFERRED_TYPE_LITERAL);
   }
@@ -4496,11 +4541,15 @@
 
   void _assertTypeParameterBound(TypeParameter typeParameter,
       String expectedBoundTypeString, String expectedBoundElementName) {
-    TypeName boundNode = typeParameter.bound;
+    TypeAnnotation bound = typeParameter.bound;
+    // TODO(brianwilkerson) Extend this to support function types as bounds.
+    expect(bound, new isInstanceOf<TypeName>());
+    TypeName boundNode = bound;
     Identifier boundName = boundNode.name;
     expect(boundNode.type.toString(), expectedBoundTypeString);
     expect(boundName.staticType.toString(), expectedBoundTypeString);
-    expect(boundName.staticElement.displayName, expectedBoundElementName);
+    expect(resolutionMap.staticElementForIdentifier(boundName).displayName,
+        expectedBoundElementName);
   }
 }
 
@@ -4584,7 +4633,8 @@
       ClassDeclaration nodeA = unit.declarations[0];
       ClassDeclaration nodeB = unit.declarations[1];
       DartType extendsType = nodeB.extendsClause.superclass.type;
-      expect(extendsType, nodeA.element.type);
+      expect(extendsType,
+          resolutionMap.elementDeclaredByClassDeclaration(nodeA).type);
     }
     {
       FunctionDeclaration functionNode = unit.declarations[2];
@@ -4592,7 +4642,12 @@
       List<FormalParameter> parameters =
           functionNode.functionExpression.parameters.parameters;
       expect(returnType.displayName, 'int');
-      expect(parameters[0].element.type.displayName, 'String');
+      expect(
+          resolutionMap
+              .elementDeclaredByFormalParameter(parameters[0])
+              .type
+              .displayName,
+          'String');
     }
   }
 
@@ -4626,15 +4681,20 @@
     FunctionTypeAlias nodeG = unit.declarations[1];
     {
       FormalParameter parameter = nodeF.parameters.parameters[0];
-      DartType parameterType = parameter.element.type;
-      Element returnTypeElement = nodeF.returnType.type.element;
+      DartType parameterType =
+          resolutionMap.elementDeclaredByFormalParameter(parameter).type;
+      Element returnTypeElement =
+          resolutionMap.typeForTypeName(nodeF.returnType).element;
       expect(returnTypeElement.displayName, 'int');
       expect(parameterType.element, nodeG.element);
     }
     {
       FormalParameter parameter = nodeG.parameters.parameters[0];
-      DartType parameterType = parameter.element.type;
-      expect(nodeG.returnType.type.element.displayName, 'String');
+      DartType parameterType =
+          resolutionMap.elementDeclaredByFormalParameter(parameter).type;
+      expect(
+          resolutionMap.typeForTypeName(nodeG.returnType).element.displayName,
+          'String');
       expect(parameterType.element.displayName, 'int');
     }
   }
@@ -5258,19 +5318,19 @@
 
     InterfaceType intType = context.typeProvider.intType;
     InterfaceType stringType = context.typeProvider.stringType;
-    DartType bottomType = context.typeProvider.bottomType;
+    DartType nullType = context.typeProvider.nullType;
     DartType dynamicType = context.typeProvider.dynamicType;
 
     assertVariableDeclarationTypes(
-        AstFinder.getTopLevelVariable(unit, "x"), dynamicType, bottomType);
+        AstFinder.getTopLevelVariable(unit, "x"), dynamicType, nullType);
     assertVariableDeclarationTypes(
         AstFinder.getTopLevelVariable(unit, "y"), intType, intType);
     assertVariableDeclarationTypes(
-        AstFinder.getFieldInClass(unit, "A", "x"), dynamicType, bottomType);
+        AstFinder.getFieldInClass(unit, "A", "x"), dynamicType, nullType);
     assertVariableDeclarationTypes(
         AstFinder.getFieldInClass(unit, "A", "y"), intType, intType);
     assertVariableDeclarationTypes(
-        AstFinder.getFieldInClass(unit, "A", "x2"), dynamicType, bottomType);
+        AstFinder.getFieldInClass(unit, "A", "x2"), dynamicType, nullType);
     assertVariableDeclarationTypes(
         AstFinder.getFieldInClass(unit, "A", "y2"), intType, intType);
 
@@ -5305,7 +5365,8 @@
         AstFinder.getStatementsInTopLevelFunction(unit, "test");
     VariableDeclaration decl =
         (statements[0] as VariableDeclarationStatement).variables.variables[0];
-    expect(decl.element.type, intType);
+    expect(
+        resolutionMap.elementDeclaredByVariableDeclaration(decl).type, intType);
     expect(decl.initializer.staticType, intType);
 
     ExpressionStatement statement = statements[1];
@@ -5593,7 +5654,8 @@
 
   void assertVariableDeclarationTypes(
       VariableDeclaration decl, DartType varType, DartType initializerType) {
-    expect(decl.element.type, varType);
+    expect(
+        resolutionMap.elementDeclaredByVariableDeclaration(decl).type, varType);
     expect(decl.initializer.staticType, initializerType);
   }
 
diff --git a/pkg/analyzer/test/src/task/incremental_element_builder_test.dart b/pkg/analyzer/test/src/task/incremental_element_builder_test.dart
index 05c7a76..05b0807 100644
--- a/pkg/analyzer/test/src/task/incremental_element_builder_test.dart
+++ b/pkg/analyzer/test/src/task/incremental_element_builder_test.dart
@@ -5,6 +5,7 @@
 library analyzer.test.src.task.incremental_element_builder_test;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/visitor.dart';
 import 'package:analyzer/src/dart/ast/utilities.dart';
@@ -1244,7 +1245,9 @@
     // Set the LibraryElement and check that its nameOffset is correct.
     libraryDirective.element =
         new LibraryElementImpl.forNode(context, libraryDirective.name);
-    expect(libraryDirective.element.nameOffset, libraryDirective.name.offset);
+    expect(
+        resolutionMap.elementDeclaredByDirective(libraryDirective).nameOffset,
+        libraryDirective.name.offset);
     // Update and check again that the nameOffset is correct.
     _buildNewUnit(r'''
 #!/bin/sh
@@ -1252,7 +1255,9 @@
 library my_lib;
 class A {}
 ''');
-    expect(libraryDirective.element.nameOffset, libraryDirective.name.offset);
+    expect(
+        resolutionMap.elementDeclaredByDirective(libraryDirective).nameOffset,
+        libraryDirective.name.offset);
   }
 
   test_directives_remove() {
@@ -1350,8 +1355,10 @@
 class A {}
 ''');
     int expectedPrefixOffset = 23;
-    expect(import1.prefix.staticElement.nameOffset, expectedPrefixOffset);
-    expect(import2.prefix.staticElement.nameOffset, expectedPrefixOffset);
+    expect(resolutionMap.staticElementForIdentifier(import1.prefix).nameOffset,
+        expectedPrefixOffset);
+    expect(resolutionMap.staticElementForIdentifier(import2.prefix).nameOffset,
+        expectedPrefixOffset);
     expect(importElement1.prefix.nameOffset, expectedPrefixOffset);
     expect(importElement2.prefix.nameOffset, expectedPrefixOffset);
   }
@@ -1528,7 +1535,11 @@
       {
         var docReferences = newNode.documentationComment.references;
         expect(docReferences, hasLength(2));
-        expect(docReferences[0].identifier.staticElement.name, 'double');
+        expect(
+            resolutionMap
+                .staticElementForIdentifier(docReferences[0].identifier)
+                .name,
+            'double');
         expect(docReferences[1].identifier.staticElement,
             same(newNodes[2].element));
       }
@@ -1549,7 +1560,11 @@
       {
         var docReferences = newNode.documentationComment.references;
         expect(docReferences, hasLength(1));
-        expect(docReferences[0].identifier.staticElement.name, 'bool');
+        expect(
+            resolutionMap
+                .staticElementForIdentifier(docReferences[0].identifier)
+                .name,
+            'bool');
       }
     }
     {
@@ -1568,7 +1583,11 @@
       {
         var docReferences = newNode.documentationComment.references;
         expect(docReferences, hasLength(1));
-        expect(docReferences[0].identifier.staticElement.name, 'int');
+        expect(
+            resolutionMap
+                .staticElementForIdentifier(docReferences[0].identifier)
+                .name,
+            'int');
       }
     }
     // verify delta
@@ -2206,8 +2225,9 @@
       AstNode parent = actual.parent;
       if (parent is Declaration) {
         ElementAnnotationImpl actualElement = actual.elementAnnotation;
-        CompilationUnitElement enclosingUnitElement =
-            parent.element.getAncestor((a) => a is CompilationUnitElement);
+        CompilationUnitElement enclosingUnitElement = resolutionMap
+            .elementDeclaredByDeclaration(parent)
+            .getAncestor((a) => a is CompilationUnitElement);
         expect(actualElement.compilationUnit, same(enclosingUnitElement));
       }
     }
diff --git a/pkg/analyzer/test/src/task/options_test.dart b/pkg/analyzer/test/src/task/options_test.dart
index b8f717a..01ece33 100644
--- a/pkg/analyzer/test/src/task/options_test.dart
+++ b/pkg/analyzer/test/src/task/options_test.dart
@@ -9,6 +9,8 @@
 import 'package:analyzer/source/error_processor.dart';
 import 'package:analyzer/src/generated/engine.dart';
 import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/lint/linter.dart';
+import 'package:analyzer/src/lint/registry.dart';
 import 'package:analyzer/src/task/options.dart';
 import 'package:analyzer/task/general.dart';
 import 'package:analyzer/task/model.dart';
@@ -38,7 +40,7 @@
   AnalysisOptions get analysisOptions => context.analysisOptions;
 
   configureContext(String optionsSource) =>
-      configureContextOptions(context, parseOptions(optionsSource));
+      applyToAnalysisOptions(analysisOptions, parseOptions(optionsSource));
 
   Map<String, YamlNode> parseOptions(String source) =>
       optionsProvider.getOptionsFromString(source);
@@ -87,7 +89,7 @@
     unused_local_variable: error
 ''');
 
-    List<ErrorProcessor> processors = context.analysisOptions.errorProcessors;
+    List<ErrorProcessor> processors = analysisOptions.errorProcessors;
     expect(processors, hasLength(2));
 
     var unused_local = new AnalysisError(
@@ -118,7 +120,7 @@
     - 'test/**'
 ''');
 
-    List<String> excludes = context.analysisOptions.excludePatterns;
+    List<String> excludes = analysisOptions.excludePatterns;
     expect(excludes, unorderedEquals(['foo/bar.dart', 'test/**']));
   }
 
@@ -443,11 +445,12 @@
   }
 
   test_linter_supported_rules() {
+    Registry.ruleRegistry.register(new TestRule());
     validate(
         '''
 linter:
   rules:
-    - camel_case_types
+    - fantastic_test_rule
     ''',
         []);
   }
@@ -468,3 +471,7 @@
         unorderedEquals(expected));
   }
 }
+
+class TestRule extends LintRule {
+  TestRule() : super(name: 'fantastic_test_rule');
+}
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index 6c22865..0d95689 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -40,21 +40,26 @@
   void test_awaitForInCastsStreamElementToVariable() {
     checkFile('''
 import 'dart:async';
+
+abstract class MyStream<T> extends Stream<T> {
+  factory MyStream() => null;
+}
+
 main() async {
   // Don't choke if sequence is not stream.
   await for (var i in /*error:FOR_IN_OF_INVALID_TYPE*/1234) {}
 
   // Dynamic cast.
-  await for (String /*info:DYNAMIC_CAST*/s in new Stream<dynamic>()) {}
+  await for (String /*info:DYNAMIC_CAST*/s in new MyStream<dynamic>()) {}
 
   // Identity cast.
-  await for (String s in new Stream<String>()) {}
+  await for (String s in new MyStream<String>()) {}
 
   // Untyped.
-  await for (var s in new Stream<String>()) {}
+  await for (var s in new MyStream<String>()) {}
 
   // Downcast.
-  await for (int /*info:DOWN_CAST_IMPLICIT*/i in new Stream<num>()) {}
+  await for (int /*info:DOWN_CAST_IMPLICIT*/i in new MyStream<num>()) {}
 }
 ''');
   }
@@ -937,16 +942,16 @@
 foo1() async => x;
 Future foo2() async => x;
 Future<int> foo3() async => x;
-Future<int> foo4() async => new Future<int>.value(/*info:DYNAMIC_CAST*/x);
+Future<int> foo4() async => new Future<int>.value(x);
 Future<int> foo5() async =>
-    /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(/*info:DYNAMIC_CAST*/x);
+    /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(x);
 
 bar1() async { return x; }
 Future bar2() async { return x; }
 Future<int> bar3() async { return x; }
-Future<int> bar4() async { return new Future<int>.value(/*info:DYNAMIC_CAST*/x); }
+Future<int> bar4() async { return new Future<int>.value(x); }
 Future<int> bar5() async {
-  return /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(/*info:DYNAMIC_CAST*/x);
+  return /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(x);
 }
 
 int y;
@@ -981,16 +986,22 @@
 
 dynamic x;
 
+Stream<int> intStream;
+
+abstract class MyStream<T> extends Stream<T> {
+  factory MyStream() => null;
+}
+
 bar1() async* { yield x; }
 Stream bar2() async* { yield x; }
 Stream<int> bar3() async* { yield /*info:DYNAMIC_CAST*/x; }
-Stream<int> bar4() async* { yield /*error:YIELD_OF_INVALID_TYPE*/new Stream<int>(); }
+Stream<int> bar4() async* { yield /*error:YIELD_OF_INVALID_TYPE*/intStream; }
 
 baz1() async* { yield* /*info:DYNAMIC_CAST*/x; }
 Stream baz2() async* { yield* /*info:DYNAMIC_CAST*/x; }
 Stream<int> baz3() async* { yield* /*info:DYNAMIC_CAST*/x; }
-Stream<int> baz4() async* { yield* new Stream<int>(); }
-Stream<int> baz5() async* { yield* /*info:INFERRED_TYPE_ALLOCATION*/new Stream(); }
+Stream<int> baz4() async* { yield* intStream; }
+Stream<int> baz5() async* { yield* /*info:INFERRED_TYPE_ALLOCATION*/new MyStream(); }
 ''');
   }
 
@@ -1301,9 +1312,10 @@
   }
 
   void test_functionTypingAndSubtyping_dynamicFunctions_closuresAreNotFuzzy() {
-    // Regression test for
+    // Regression test for definite function cases
     // https://github.com/dart-lang/sdk/issues/26118
     // https://github.com/dart-lang/sdk/issues/26156
+    // https://github.com/dart-lang/sdk/issues/28087
     checkFile('''
 void takesF(void f(int x)) {}
 
@@ -1313,20 +1325,27 @@
 void updateOpt([_]) {}
 void updateOptNum([num x]) {}
 
+class Callable {
+  void call(_) {}
+}
+
 class A {
   TakesInt f;
   A(TakesInt g) {
     f = update;
     f = updateOpt;
     f = updateOptNum;
+    f = new Callable();
   }
   TakesInt g(bool a, bool b) {
     if (a) {
       return update;
     } else if (b) {
       return updateOpt;
-    } else {
+    } else if (a) {
       return updateOptNum;
+    } else {
+      return new Callable();
     }
   }
 }
@@ -1335,13 +1354,16 @@
   takesF(update);
   takesF(updateOpt);
   takesF(updateOptNum);
+  takesF(new Callable());
   TakesInt f;
   f = update;
   f = updateOpt;
   f = updateOptNum;
+  f = new Callable();
   new A(update);
   new A(updateOpt);
   new A(updateOptNum);
+  new A(new Callable());
 }
 
 void test1() {
@@ -2083,6 +2105,41 @@
 ''');
   }
 
+  void test_genericMethodSuper() {
+    checkFile(r'''
+class A<T> {
+  A<S> create<S extends T>() => new A<S>();
+}
+class B extends A {
+  A<S> create<S>() => super.create<S>();
+}
+class C extends A {
+  A<S> create<S>() => super.create();
+}
+class D extends A<num> {
+  A<S> create<S extends num>() => super.create<S>();
+}
+class E extends A<num> {
+  A<S> create<S extends num>() => /*error:RETURN_OF_INVALID_TYPE*/super.create<int>();
+}
+class F extends A<num> {
+  create2<S>() => super.create</*error:TYPE_ARGUMENT_NOT_MATCHING_BOUNDS*/S>();
+}
+    ''');
+  }
+
+  void test_genericMethodSuperSubstitute() {
+    checkFile(r'''
+class Clonable<T> {}
+class G<T> {
+  create<A extends Clonable<T>, B extends Iterable<A>>() => null;
+}
+class H extends G<num> {
+  create2() => super.create<Clonable<int>, List<Clonable<int>>>();
+}
+    ''');
+  }
+
   void test_getterGetterOverride() {
     checkFile('''
 class A {}
@@ -2332,12 +2389,12 @@
   void test_implicitDynamic_return() {
     addFile(r'''
 // function
-/*error:IMPLICIT_DYNAMIC_RETURN*/f0() {}
+/*error:IMPLICIT_DYNAMIC_RETURN*/f0() {return f0();}
 dynamic f1() { return 42; }
 
 // nested function
 void main() {
-  /*error:IMPLICIT_DYNAMIC_RETURN*/g0() {}
+  /*error:IMPLICIT_DYNAMIC_RETURN*/g0() {return g0();}
   dynamic g1() { return 42; }
 }
 
@@ -2353,7 +2410,7 @@
 
 // accessors
 set x(int value) {}
-/*error:IMPLICIT_DYNAMIC_RETURN*/get y0 => 42;
+get /*error:IMPLICIT_DYNAMIC_RETURN*/y0 => 42;
 dynamic get y1 => 42;
 
 // function typed formals
@@ -3174,8 +3231,10 @@
     // Regression test for https://github.com/dart-lang/sdk/issues/26155
     checkFile(r'''
 void takesF(void f(int x)) {
-  takesF(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/([x]) { bool z = x.isEven; });
-  takesF(/*info:INFERRED_TYPE_CLOSURE*/(y) { bool z = y.isEven; });
+  takesF(/*info:INFERRED_TYPE_CLOSURE,
+           info:INFERRED_TYPE_CLOSURE*/([x]) { bool z = x.isEven; });
+  takesF(/*info:INFERRED_TYPE_CLOSURE,
+           info:INFERRED_TYPE_CLOSURE*/(y) { bool z = y.isEven; });
 }
     ''');
   }
@@ -3606,6 +3665,61 @@
 ''');
   }
 
+  void test_tearOffTreatedConsistentlyAsStrictArrow() {
+    checkFile(r'''
+void foo(void f(String x)) {}
+
+class A {
+  Null bar1(dynamic x) => null;
+  void bar2(dynamic x) => null;
+  Null bar3(String x) => null;
+  void test() {
+    foo(bar1);
+    foo(bar2);
+    foo(bar3);
+  }
+}
+
+
+Null baz1(dynamic x) => null;
+void baz2(dynamic x) => null;
+Null baz3(String x) => null;
+void test() {
+  foo(baz1);
+  foo(baz2);
+  foo(baz3);
+}
+    ''');
+  }
+
+  void test_tearOffTreatedConsistentlyAsStrictArrowNamedParam() {
+    checkFile(r'''
+typedef void Handler(String x);
+void foo({Handler f}) {}
+
+class A {
+  Null bar1(dynamic x) => null;
+  void bar2(dynamic x) => null;
+  Null bar3(String x) => null;
+  void test() {
+    foo(f: bar1);
+    foo(f: bar2);
+    foo(f: bar3);
+  }
+}
+
+
+Null baz1(dynamic x) => null;
+void baz2(dynamic x) => null;
+Null baz3(String x) => null;
+void test() {
+  foo(f: baz1);
+  foo(f: baz2);
+  foo(f: baz3);
+}
+    ''');
+  }
+
   void test_ternaryOperator() {
     checkFile('''
 abstract class Comparable<T> {
@@ -3991,6 +4105,27 @@
 ''');
   }
 
+  void test_universalFunctionSubtyping() {
+    checkFile(r'''
+dynamic foo<T>(dynamic x) => x;
+
+void takesDtoD(dynamic f(dynamic x)) {}
+
+void test() {
+  // here we currently infer an instantiation.
+  takesDtoD(/*pass should be error:INVALID_ASSIGNMENT*/foo);
+}
+
+class A {
+  dynamic method(dynamic x) => x;
+}
+
+class B extends A {
+  /*error:INVALID_METHOD_OVERRIDE*/T method<T>(T x) => x;
+}
+    ''');
+  }
+
   void test_voidSubtyping() {
     // Regression test for https://github.com/dart-lang/sdk/issues/25069
     checkFile('''
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index 7979880..048d414 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -36,6 +36,49 @@
    */
   CompilationUnitElement checkFile(String content);
 
+  void test_asyncClosureReturnType_flatten() {
+    var mainUnit = checkFile('''
+import 'dart:async';
+Future<int> futureInt = null;
+var f = () => futureInt;
+var g = () async => futureInt;
+''');
+    var futureInt = mainUnit.topLevelVariables[0];
+    expect(futureInt.name, 'futureInt');
+    expect(futureInt.type.toString(), 'Future<int>');
+    var f = mainUnit.topLevelVariables[1];
+    expect(f.name, 'f');
+    expect(f.type.toString(), '() → Future<int>');
+    var g = mainUnit.topLevelVariables[2];
+    expect(g.name, 'g');
+    expect(g.type.toString(), '() → Future<int>');
+  }
+
+  void test_asyncClosureReturnType_future() {
+    var mainUnit = checkFile('var f = () async => 0;');
+    var f = mainUnit.topLevelVariables[0];
+    expect(f.name, 'f');
+    expect(f.type.toString(), '() → Future<int>');
+  }
+
+  void test_asyncClosureReturnType_futureOr() {
+    var mainUnit = checkFile('''
+import 'dart:async';
+FutureOr<int> futureOrInt = null;
+var f = () => futureOrInt;
+var g = () async => futureOrInt;
+''');
+    var futureOrInt = mainUnit.topLevelVariables[0];
+    expect(futureOrInt.name, 'futureOrInt');
+    expect(futureOrInt.type.toString(), 'FutureOr<int>');
+    var f = mainUnit.topLevelVariables[1];
+    expect(f.name, 'f');
+    expect(f.type.toString(), '() → FutureOr<int>');
+    var g = mainUnit.topLevelVariables[2];
+    expect(g.name, 'g');
+    expect(g.type.toString(), '() → Future<int>');
+  }
+
   void test_blockBodiedLambdas_async_allReturnsAreFutures() {
     if (!mayCheckTypesOfLocals) {
       return;
@@ -204,113 +247,6 @@
 ''');
   }
 
-  void test_blockBodiedLambdas_doesNotInferBottom_async() {
-    if (!mayCheckTypesOfLocals) {
-      return;
-    }
-    var mainUnit = checkFile(r'''
-import 'dart:async';
-main() async {
-  var f = () async { return null; };
-  Future y = f();
-  Future<String> z = /*warning:DOWN_CAST_COMPOSITE*/f();
-  String s = /*info:DYNAMIC_CAST*/await f();
-}
-''');
-    var f = mainUnit.functions[0].localVariables[0];
-    expect(f.type.toString(), '() → Future<dynamic>');
-  }
-
-  void test_blockBodiedLambdas_doesNotInferBottom_async_topLevel() {
-    var mainUnit = checkFile(r'''
-import 'dart:async';
-var f = /*warning:UNSAFE_BLOCK_CLOSURE_INFERENCE*/() async { return null; };
-''');
-    var f = mainUnit.topLevelVariables[0];
-    expect(f.type.toString(), '() → Future<dynamic>');
-  }
-
-  void test_blockBodiedLambdas_doesNotInferBottom_asyncStar() {
-    if (!mayCheckTypesOfLocals) {
-      return;
-    }
-    var mainUnit = checkFile(r'''
-import 'dart:async';
-main() async {
-  var f = () async* { yield null; };
-  Stream y = f();
-  Stream<String> z = /*warning:DOWN_CAST_COMPOSITE*/f();
-  String s = /*info:DYNAMIC_CAST*/await f().first;
-}
-''');
-    var f = mainUnit.functions[0].localVariables[0];
-    expect(f.type.toString(), '() → Stream<dynamic>');
-  }
-
-  void test_blockBodiedLambdas_doesNotInferBottom_asyncStar_topLevel() {
-    var mainUnit = checkFile(r'''
-import 'dart:async';
-var f = /*warning:UNSAFE_BLOCK_CLOSURE_INFERENCE*/() async* { yield null; };
-''');
-    var f = mainUnit.topLevelVariables[0];
-    expect(f.type.toString(), '() → Stream<dynamic>');
-  }
-
-  void test_blockBodiedLambdas_doesNotInferBottom_sync() {
-    if (!mayCheckTypesOfLocals) {
-      return;
-    }
-    var mainUnit = checkFile(r'''
-var h = null;
-void foo(int f(Object _)) {}
-
-main() {
-  var f = (Object x) { return null; };
-  String y = /*info:DYNAMIC_CAST*/f(42);
-
-  f = /*info:INFERRED_TYPE_CLOSURE*/(x) => 'hello';
-
-  foo(/*info:INFERRED_TYPE_CLOSURE*/(x) { return null; });
-  foo(/*info:INFERRED_TYPE_CLOSURE*/(x) { throw "not implemented"; });
-}
-''');
-
-    var f = mainUnit.functions[1].localVariables[0];
-    expect(f.type.toString(), '(Object) → dynamic');
-  }
-
-  void test_blockBodiedLambdas_doesNotInferBottom_sync_topLevel() {
-    var mainUnit = checkFile(r'''
-var f = (Object x) { return null; };
-''');
-    var f = mainUnit.topLevelVariables[0];
-    expect(f.type.toString(), '(Object) → dynamic');
-  }
-
-  void test_blockBodiedLambdas_doesNotInferBottom_syncStar() {
-    if (!mayCheckTypesOfLocals) {
-      return;
-    }
-    var mainUnit = checkFile(r'''
-main() {
-  var f = () sync* { yield null; };
-  Iterable y = f();
-  Iterable<String> z = /*warning:DOWN_CAST_COMPOSITE*/f();
-  String s = /*info:DYNAMIC_CAST*/f().first;
-}
-''');
-    var f = mainUnit.functions[0].localVariables[0];
-    expect(f.type.toString(), '() → Iterable<dynamic>');
-  }
-
-  void test_blockBodiedLambdas_doesNotInferBottom_syncStar_topLevel() {
-    var mainUnit = checkFile(r'''
-var f = /*warning:UNSAFE_BLOCK_CLOSURE_INFERENCE*/() sync* { yield null; };
-''');
-    var f = mainUnit.topLevelVariables[0];
-    expect(f.type.toString(), '() → Iterable<dynamic>');
-  }
-
   void test_blockBodiedLambdas_downwardsIncompatibleWithUpwardsInference() {
     if (!mayCheckTypesOfLocals) {
       return;
@@ -336,6 +272,115 @@
     expect(f.type.toString(), '() → String');
   }
 
+  void test_blockBodiedLambdas_inferBottom_async() {
+    if (!mayCheckTypesOfLocals) {
+      return;
+    }
+    var mainUnit = checkFile(r'''
+import 'dart:async';
+main() async {
+  var f = /*info:INFERRED_TYPE_CLOSURE*/() async { return null; };
+  Future y = f();
+  Future<String> z = f();
+  String s = await f();
+}
+''');
+    var f = mainUnit.functions[0].localVariables[0];
+    expect(f.type.toString(), '() → Future<Null>');
+  }
+
+  void test_blockBodiedLambdas_inferBottom_async_topLevel() {
+    var mainUnit = checkFile(r'''
+import 'dart:async';
+var f = /*warning:UNSAFE_BLOCK_CLOSURE_INFERENCE,info:INFERRED_TYPE_CLOSURE*/() async { return null; };
+''');
+    var f = mainUnit.topLevelVariables[0];
+    expect(f.type.toString(), '() → Future<Null>');
+  }
+
+  void test_blockBodiedLambdas_inferBottom_asyncStar() {
+    if (!mayCheckTypesOfLocals) {
+      return;
+    }
+    var mainUnit = checkFile(r'''
+import 'dart:async';
+main() async {
+  var f = /*info:INFERRED_TYPE_CLOSURE*/() async* { yield null; };
+  Stream y = f();
+  Stream<String> z = f();
+  String s = await f().first;
+}
+''');
+    var f = mainUnit.functions[0].localVariables[0];
+    expect(f.type.toString(), '() → Stream<Null>');
+  }
+
+  void test_blockBodiedLambdas_inferBottom_asyncStar_topLevel() {
+    var mainUnit = checkFile(r'''
+import 'dart:async';
+var f = /*info:INFERRED_TYPE_CLOSURE, warning:UNSAFE_BLOCK_CLOSURE_INFERENCE*/() async* { yield null; };
+''');
+    var f = mainUnit.topLevelVariables[0];
+    expect(f.type.toString(), '() → Stream<Null>');
+  }
+
+  void test_blockBodiedLambdas_inferBottom_sync() {
+    if (!mayCheckTypesOfLocals) {
+      return;
+    }
+    var mainUnit = checkFile(r'''
+var h = null;
+void foo(int f(Object _)) {}
+
+main() {
+  var f = /*info:INFERRED_TYPE_CLOSURE*/(Object x) { return null; };
+  String y = f(42);
+
+  f = /*error:INVALID_CAST_FUNCTION_EXPR, info:INFERRED_TYPE_CLOSURE*/(x) => 'hello';
+
+  foo(/*info:INFERRED_TYPE_CLOSURE,
+        info:INFERRED_TYPE_CLOSURE*/(x) { return null; });
+  foo(/*info:INFERRED_TYPE_CLOSURE,
+        info:INFERRED_TYPE_CLOSURE*/(x) { throw "not implemented"; });
+}
+''');
+
+    var f = mainUnit.functions[1].localVariables[0];
+    expect(f.type.toString(), '(Object) → Null');
+  }
+
+  void test_blockBodiedLambdas_inferBottom_sync_topLevel() {
+    var mainUnit = checkFile(r'''
+var f = /*info:INFERRED_TYPE_CLOSURE,warning:UNSAFE_BLOCK_CLOSURE_INFERENCE*/(Object x) { return null; };
+''');
+    var f = mainUnit.topLevelVariables[0];
+    expect(f.type.toString(), '(Object) → Null');
+  }
+
+  void test_blockBodiedLambdas_inferBottom_syncStar() {
+    if (!mayCheckTypesOfLocals) {
+      return;
+    }
+    var mainUnit = checkFile(r'''
+main() {
+  var f = /*info:INFERRED_TYPE_CLOSURE*/() sync* { yield null; };
+  Iterable y = f();
+  Iterable<String> z = f();
+  String s = f().first;
+}
+''');
+    var f = mainUnit.functions[0].localVariables[0];
+    expect(f.type.toString(), '() → Iterable<Null>');
+  }
+
+  void test_blockBodiedLambdas_inferBottom_syncStar_topLevel() {
+    var mainUnit = checkFile(r'''
+var f = /*info:INFERRED_TYPE_CLOSURE,warning:UNSAFE_BLOCK_CLOSURE_INFERENCE*/() sync* { yield null; };
+''');
+    var f = mainUnit.topLevelVariables[0];
+    expect(f.type.toString(), '() → Iterable<Null>');
+  }
+
   void test_blockBodiedLambdas_LUB() {
     checkFile(r'''
 import 'dart:math' show Random;
@@ -404,7 +449,7 @@
     var mainUnit = checkFile(r'''
 test1() {
   List<int> o;
-  var y = o.map(/*info:INFERRED_TYPE_CLOSURE*/(x) { });
+  var y = o.map(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/(x) { });
   Iterable<int> z = /*warning:DOWN_CAST_COMPOSITE*/y;
 }
 ''');
@@ -415,7 +460,7 @@
   void test_blockBodiedLambdas_noReturn_topLevel() {
     var mainUnit = checkFile(r'''
 final List<int> o = <int>[];
-var y = o.map((x) { });
+var y = o.map(/*info:INFERRED_TYPE_CLOSURE, warning:UNSAFE_BLOCK_CLOSURE_INFERENCE*/(x) { });
 ''');
     var f = mainUnit.topLevelVariables[1];
     expect(f.type.toString(), 'Iterable<dynamic>');
@@ -459,7 +504,7 @@
 ''');
     var v = mainUnit.topLevelVariables[0];
     expect(v.type.toString(), 'dynamic');
-    expect(v.initializer.type.toString(), '() → <bottom>');
+    expect(v.initializer.type.toString(), '() → Null');
   }
 
   void test_bottom_inClosure() {
@@ -592,9 +637,11 @@
   void test_constructors_downwardsWithConstraint() {
     // Regression test for https://github.com/dart-lang/sdk/issues/26431
     checkFile(r'''
-class Foo<T extends Iterable> {}
+class A {}
+class B extends A {}
+class Foo<T extends A> {}
 void main() {
-  Foo<List> foo = /*info:INFERRED_TYPE_ALLOCATION*/new Foo();
+  Foo<B> foo = /*info:INFERRED_TYPE_ALLOCATION*/new Foo();
 }
     ''');
   }
@@ -912,7 +959,7 @@
 Future test() async {
   dynamic d;
   List<int> l0 = await /*info:INFERRED_TYPE_LITERAL,error:COULD_NOT_INFER*/[/*info:DYNAMIC_CAST*/d];
-  List<int> l1 = await /*info:INFERRED_TYPE_ALLOCATION*/new Future.value(/*info:INFERRED_TYPE_LITERAL,error:COULD_NOT_INFER*/[/*info:DYNAMIC_CAST*/d]);
+  List<int> l1 = await /*info:INFERRED_TYPE_ALLOCATION*/new Future.value([d]);
 }
 ''');
   }
@@ -920,9 +967,14 @@
   void test_downwardsInferenceForEach() {
     checkFile('''
 import 'dart:async';
+
+abstract class MyStream<T> extends Stream<T> {
+  factory MyStream() => null;
+}
+
 Future main() async {
   for(int x in /*info:INFERRED_TYPE_LITERAL*/[1, 2, 3]) {}
-  await for(int x in /*info:INFERRED_TYPE_ALLOCATION*/new Stream()) {}
+  await for(int x in /*info:INFERRED_TYPE_ALLOCATION*/new MyStream()) {}
 }
 ''');
   }
@@ -1561,11 +1613,16 @@
   void test_downwardsInferenceYieldYieldStar() {
     checkFile('''
 import 'dart:async';
+
+abstract class MyStream<T> extends Stream<T> {
+  factory MyStream() => null;
+}
+
 Stream<List<int>> foo() async* {
   yield /*info:INFERRED_TYPE_LITERAL*/[];
-  yield /*error:YIELD_OF_INVALID_TYPE*/new Stream();
+  yield /*error:YIELD_OF_INVALID_TYPE*/new MyStream();
   yield* /*error:YIELD_OF_INVALID_TYPE*/[];
-  yield* /*info:INFERRED_TYPE_ALLOCATION*/new Stream();
+  yield* /*info:INFERRED_TYPE_ALLOCATION*/new MyStream();
 }
 
 Iterable<Map<int, int>> bar() sync* {
@@ -1577,6 +1634,34 @@
   ''');
   }
 
+  test_dynamic_has_object_methods_viaNonPrefixedIdentifier() {
+    var mainUnit = checkFile('''
+dynamic f() => null;
+var s = f().toString();
+var h = f().hashCode;
+''');
+    var s = mainUnit.topLevelVariables[0];
+    expect(s.name, 's');
+    expect(s.type.toString(), 'String');
+    var h = mainUnit.topLevelVariables[1];
+    expect(h.name, 'h');
+    expect(h.type.toString(), 'int');
+  }
+
+  test_dynamic_has_object_methods_viaPrefixedIdentifier() {
+    var mainUnit = checkFile('''
+dynamic d;
+var s = d.toString();
+var h = d.hashCode;
+''');
+    var s = mainUnit.topLevelVariables[1];
+    expect(s.name, 's');
+    expect(s.type.toString(), 'String');
+    var h = mainUnit.topLevelVariables[2];
+    expect(h.name, 'h');
+    expect(h.type.toString(), 'int');
+  }
+
   void test_fieldRefersToStaticGetter() {
     var mainUnit = checkFile('''
 class C {
@@ -1599,7 +1684,22 @@
     expect(x.type.toString(), 'int');
   }
 
-  void test_futureThen() {
+  void test_futureOr_subtyping() {
+    checkFile(r'''
+import 'dart:async';
+void add(int x) {}
+add2(int y) {}
+main() {
+  Future<int> f;
+  var a = f.then(add);
+  var b = f.then(add2);
+}
+    ''');
+  }
+
+  void test_futureThen_deprecated() {
+// Tests the deprecated ad hoc future inference for classes which implement
+// Future but haven't been updated to use FutureOr
     String build({String declared, String downwards, String upwards}) => '''
 import 'dart:async';
 class MyFuture<T> implements Future<T> {
@@ -1639,14 +1739,14 @@
         build(declared: "Future", downwards: "Future", upwards: "Future"));
   }
 
-  void test_futureThen_comment() {
+  void test_futureThen() {
     String build({String declared, String downwards, String upwards}) => '''
 import 'dart:async';
 class MyFuture<T> implements Future<T> {
   MyFuture() {}
   MyFuture.value(T x) {}
   dynamic noSuchMethod(invocation);
-  MyFuture/*<S>*/ then/*<S>*/(dynamic f(T x), {Function onError}) => null;
+  MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
 }
 
 void main() {
@@ -1679,6 +1779,40 @@
         build(declared: "Future", downwards: "Future", upwards: "Future"));
   }
 
+  void test_futureThen_conditional_deprecated() {
+// Tests the deprecated ad hoc future inference for classes which implement
+// Future but haven't been updated to use FutureOr
+    String build({String declared, String downwards, String upwards}) => '''
+import 'dart:async';
+class MyFuture<T> implements Future<T> {
+  MyFuture() {}
+  MyFuture.value(T x) {}
+  dynamic noSuchMethod(invocation);
+  MyFuture<S> then<S>(dynamic f(T x), {Function onError}) => null;
+}
+
+void main() {
+  $declared<bool> f;
+  $downwards<int> t1 = f.then(/*info:INFERRED_TYPE_CLOSURE*/
+      (x) async => x ? 2 : await new $upwards<int>.value(3));
+  $downwards<int> t2 = f.then(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/(x) async { // TODO(leafp): Why the duplicate here?
+    return await x ? 2 : new $upwards<int>.value(3);});
+  $downwards<int> t5 = f.then(/*info:INFERRED_TYPE_CLOSURE*/
+      (x) => x ? 2 : new $upwards<int>.value(3));
+  $downwards<int> t6 = f.then(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/
+      (x) {return /*warning:DOWN_CAST_COMPOSITE*/x ? 2 : new $upwards<int>.value(3);});
+}
+''';
+    checkFile(
+        build(declared: "MyFuture", downwards: "Future", upwards: "Future"));
+    checkFile(
+        build(declared: "MyFuture", downwards: "Future", upwards: "MyFuture"));
+    checkFile(
+        build(declared: "MyFuture", downwards: "MyFuture", upwards: "Future"));
+    checkFile(build(
+        declared: "MyFuture", downwards: "MyFuture", upwards: "MyFuture"));
+  }
+
   void test_futureThen_conditional() {
     String build({String declared, String downwards, String upwards}) => '''
 import 'dart:async';
@@ -1686,7 +1820,7 @@
   MyFuture() {}
   MyFuture.value(T x) {}
   dynamic noSuchMethod(invocation);
-  MyFuture<S> then<S>(dynamic f(T x), {Function onError}) => null;
+  MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
 }
 
 void main() {
@@ -1695,46 +1829,10 @@
       (x) async => x ? 2 : await new $upwards<int>.value(3));
   $downwards<int> t2 = f.then(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/(x) async { // TODO(leafp): Why the duplicate here?
     return await x ? 2 : new $upwards<int>.value(3);});
-  $downwards<int> t5 = f.then(/*info:INFERRED_TYPE_CLOSURE*/
+  $downwards<int> t5 = f.then(/*info:INFERRED_TYPE_CLOSURE,error:INVALID_CAST_FUNCTION_EXPR*/
       (x) => x ? 2 : new $upwards<int>.value(3));
   $downwards<int> t6 = f.then(/*info:INFERRED_TYPE_CLOSURE*/
-      (x) {return x ? 2 : new $upwards<int>.value(3);});
-}
-''';
-    checkFile(
-        build(declared: "MyFuture", downwards: "Future", upwards: "Future"));
-    checkFile(
-        build(declared: "MyFuture", downwards: "Future", upwards: "MyFuture"));
-    checkFile(
-        build(declared: "MyFuture", downwards: "MyFuture", upwards: "Future"));
-    checkFile(build(
-        declared: "MyFuture", downwards: "MyFuture", upwards: "MyFuture"));
-    checkFile(
-        build(declared: "Future", downwards: "Future", upwards: "MyFuture"));
-    checkFile(
-        build(declared: "Future", downwards: "Future", upwards: "Future"));
-  }
-
-  void test_futureThen_conditional_comment() {
-    String build({String declared, String downwards, String upwards}) => '''
-import 'dart:async';
-class MyFuture<T> implements Future<T> {
-  MyFuture() {}
-  MyFuture.value(T x) {}
-  dynamic noSuchMethod(invocation);
-  MyFuture/*<S>*/ then/*<S>*/(dynamic f(T x), {Function onError}) => null;
-}
-
-void main() {
-  $declared<bool> f;
-  $downwards<int> t1 = f.then(/*info:INFERRED_TYPE_CLOSURE*/
-      (x) async => x ? 2 : await new $upwards<int>.value(3));
-  $downwards<int> t2 = f.then(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/(x) async { // TODO(leafp): Why the duplicate here?
-    return await x ? 2 : new $upwards<int>.value(3);});
-  $downwards<int> t5 = f.then(/*info:INFERRED_TYPE_CLOSURE*/
-      (x) => x ? 2 : new $upwards<int>.value(3));
-  $downwards<int> t6 = f.then(/*info:INFERRED_TYPE_CLOSURE*/
-      (x) {return x ? 2 : new $upwards<int>.value(3);});
+      (x) {return /*warning:DOWN_CAST_COMPOSITE*/x ? 2 : new $upwards<int>.value(3);});
 }
 ''';
     checkFile(
@@ -1759,7 +1857,7 @@
   Future<int> f;
   Future<List<int>> b = /*info:ASSIGNMENT_CAST should be pass*/f
       .then(/*info:INFERRED_TYPE_CLOSURE*/(x) => [])
-      .whenComplete(/*pass should be info:INFERRED_TYPE_LITERAL*/() {});
+      .whenComplete(/*info:INFERRED_TYPE_CLOSURE*/() {});
   b = f.then(/*info:INFERRED_TYPE_CLOSURE*/(x) => /*info:INFERRED_TYPE_LITERAL*/[]);
 }
     ''');
@@ -1768,26 +1866,24 @@
   void test_futureThen_explicitFuture() {
     checkFile(r'''
 import "dart:async";
-main() {
+m1() {
   Future<int> f;
-  var x = f.then<Future<List<int>>>(/*info:INFERRED_TYPE_CLOSURE*/(x) => /*info:INFERRED_TYPE_LITERAL*/[]);
+  var x = f.then<Future<List<int>>>(/*info:INFERRED_TYPE_CLOSURE,
+                                      error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/
+                                    (x) => /*info:INFERRED_TYPE_LITERAL*/[]);
+  Future<List<int>> y = x;
+}
+m2() {
+  Future<int> f;
+  var x = f.then<List<int>>(/*info:INFERRED_TYPE_CLOSURE*/(x) => /*info:INFERRED_TYPE_LITERAL*/[]);
   Future<List<int>> y = x;
 }
     ''');
   }
 
-  void test_futureThen_explicitFuture_comment() {
-    checkFile(r'''
-import "dart:async";
-main() {
-  Future<int> f;
-  var x = f.then/*<Future<List<int>>>*/(/*info:INFERRED_TYPE_CLOSURE*/(x) => /*info:INFERRED_TYPE_LITERAL*/[]);
-  Future<List<int>> y = x;
-}
-    ''');
-  }
-
-  void test_futureThen_upwards() {
+  void test_futureThen_upwards_deprecated() {
+    // Tests the deprecated ad hoc future inference for classes which implement
+    // Future but haven't been updated to use FutureOr
     // Regression test for https://github.com/dart-lang/sdk/issues/27088.
     String build({String declared, String downwards, String upwards}) => '''
 import 'dart:async';
@@ -1817,7 +1913,7 @@
         build(declared: "Future", downwards: "Future", upwards: "Future"));
   }
 
-  void test_futureThen_upwards_comment() {
+  void test_futureThen_upwards() {
     // Regression test for https://github.com/dart-lang/sdk/issues/27088.
     String build({String declared, String downwards, String upwards}) => '''
 import 'dart:async';
@@ -1825,7 +1921,7 @@
   MyFuture() {}
   MyFuture.value(T x) {}
   dynamic noSuchMethod(invocation);
-  MyFuture/*<S>*/ then/*<S>*/(dynamic f(T x), {Function onError}) => null;
+  MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
 }
 
 void main() {
@@ -1861,12 +1957,14 @@
     ''');
   }
 
-  void test_futureUnion_asyncConditional() {
+  void test_futureUnion_asyncConditional_deprecated() {
+    // Tests the deprecated ad hoc future inference for classes which implement
+    // Future but haven't been updated to use FutureOr
     String build({String declared, String downwards, String upwards}) => '''
 import 'dart:async';
 class MyFuture<T> implements Future<T> {
   MyFuture() {}
-  MyFuture.value(T x) {}
+  MyFuture.value(x) {}
   dynamic noSuchMethod(invocation);
   MyFuture<S> then<S>(dynamic f(T x), {Function onError}) => null;
 }
@@ -1876,7 +1974,7 @@
 $downwards<int> g2(bool x) async =>
   x ? 42 : /*info:INFERRED_TYPE_ALLOCATION*/new $upwards.value(42);
 $downwards<int> g3(bool x) async {
-  var y = x ? 42 : /*info:INFERRED_TYPE_ALLOCATION*/new $upwards.value(42);
+  var y = x ? 42 : new $upwards.value(42);
   return y;
 }
     ''';
@@ -1884,14 +1982,14 @@
     checkFile(build(downwards: "Future", upwards: "MyFuture"));
   }
 
-  void test_futureUnion_asyncConditional_comment() {
+  void test_futureUnion_asyncConditional() {
     String build({String declared, String downwards, String upwards}) => '''
 import 'dart:async';
 class MyFuture<T> implements Future<T> {
   MyFuture() {}
-  MyFuture.value(T x) {}
+  MyFuture.value(x) {}
   dynamic noSuchMethod(invocation);
-  MyFuture/*<S>*/ then/*<S>*/(dynamic f(T x), {Function onError}) => null;
+  MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
 }
 
 $downwards<int> g1(bool x) async {
@@ -1899,7 +1997,7 @@
 $downwards<int> g2(bool x) async =>
   x ? 42 : /*info:INFERRED_TYPE_ALLOCATION*/new $upwards.value(42);
 $downwards<int> g3(bool x) async {
-  var y = x ? 42 : /*info:INFERRED_TYPE_ALLOCATION*/new $upwards.value(42);
+  var y = x ? 42 : new $upwards.value(42);
   return y;
 }
     ''';
@@ -1907,6 +2005,48 @@
     checkFile(build(downwards: "Future", upwards: "MyFuture"));
   }
 
+  void test_futureUnion_downwards_deprecated() {
+    // Tests the deprecated ad hoc future inference for classes which implement
+    // Future but haven't been updated to use FutureOr
+    String build({String declared, String downwards, String upwards}) {
+      // TODO(leafp): The use of matchTypes in visitInstanceCreationExpression
+      // in the resolver visitor isn't powerful enough to catch this for the
+      // subclass.  See the TODO there.
+      var allocInfo =
+          (upwards == "Future") ? "/*info:INFERRED_TYPE_ALLOCATION*/" : "";
+      return '''
+import 'dart:async';
+class MyFuture<T> implements Future<T> {
+  MyFuture() {}
+  MyFuture.value([x]) {}
+  dynamic noSuchMethod(invocation);
+  MyFuture<S> then<S>(dynamic f(T x), {Function onError}) => null;
+}
+
+$declared f;
+// Instantiates Future<int>
+$downwards<int> t1 = f.then((_) =>
+   ${allocInfo}new $upwards.value('hi'));
+
+// Instantiates List<int>
+$downwards<List<int>> t2 = f.then((_) => /*info:INFERRED_TYPE_LITERAL*/[3]);
+$downwards<List<int>> g2() async { return /*info:INFERRED_TYPE_LITERAL*/[3]; }
+$downwards<List<int>> g3() async {
+  return /*info:INFERRED_TYPE_ALLOCATION*/new $upwards.value(
+      /*info:INFERRED_TYPE_LITERAL*/[3]); }
+''';
+    }
+
+    checkFile(
+        build(declared: "MyFuture", downwards: "Future", upwards: "Future"));
+    checkFile(
+        build(declared: "MyFuture", downwards: "Future", upwards: "MyFuture"));
+    checkFile(
+        build(declared: "Future", downwards: "Future", upwards: "Future"));
+    checkFile(
+        build(declared: "Future", downwards: "Future", upwards: "MyFuture"));
+  }
+
   void test_futureUnion_downwards() {
     String build({String declared, String downwards, String upwards}) {
       // TODO(leafp): The use of matchTypes in visitInstanceCreationExpression
@@ -1918,16 +2058,15 @@
 import 'dart:async';
 class MyFuture<T> implements Future<T> {
   MyFuture() {}
-  MyFuture.value([T x]) {}
+  MyFuture.value([x]) {}
   dynamic noSuchMethod(invocation);
-  MyFuture<S> then<S>(dynamic f(T x), {Function onError}) => null;
+  MyFuture<S> then<S>(FutureOr<S> f(T x), {Function onError}) => null;
 }
 
 $declared f;
 // Instantiates Future<int>
 $downwards<int> t1 = f.then((_) =>
-   ${allocInfo}new /*error:COULD_NOT_INFER*/$upwards.value(
-     /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/'hi'));
+   ${allocInfo}new $upwards.value('hi'));
 
 // Instantiates List<int>
 $downwards<List<int>> t2 = f.then((_) => /*info:INFERRED_TYPE_LITERAL*/[3]);
@@ -1938,49 +2077,6 @@
 ''';
     }
 
-    ;
-    checkFile(
-        build(declared: "MyFuture", downwards: "Future", upwards: "Future"));
-    checkFile(
-        build(declared: "MyFuture", downwards: "Future", upwards: "MyFuture"));
-    checkFile(
-        build(declared: "Future", downwards: "Future", upwards: "Future"));
-    checkFile(
-        build(declared: "Future", downwards: "Future", upwards: "MyFuture"));
-  }
-
-  void test_futureUnion_downwards_comment() {
-    String build({String declared, String downwards, String upwards}) {
-      // TODO(leafp): The use of matchTypes in visitInstanceCreationExpression
-      // in the resolver visitor isn't powerful enough to catch this for the
-      // subclass.  See the TODO there.
-      var allocInfo =
-          (upwards == "Future") ? "/*info:INFERRED_TYPE_ALLOCATION*/" : "";
-      return '''
-import 'dart:async';
-class MyFuture<T> implements Future<T> {
-  MyFuture() {}
-  MyFuture.value([T x]) {}
-  dynamic noSuchMethod(invocation);
-  MyFuture/*<S>*/ then/*<S>*/(dynamic f(T x), {Function onError}) => null;
-}
-
-$declared f;
-// Instantiates Future<int>
-$downwards<int> t1 = f.then((_) =>
-   ${allocInfo}new /*error:COULD_NOT_INFER*/$upwards.value(
-     /*error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/'hi'));
-
-// Instantiates List<int>
-$downwards<List<int>> t2 = f.then((_) => /*info:INFERRED_TYPE_LITERAL*/[3]);
-$downwards<List<int>> g2() async { return /*info:INFERRED_TYPE_LITERAL*/[3]; }
-$downwards<List<int>> g3() async {
-  return /*info:INFERRED_TYPE_ALLOCATION*/new $upwards.value(
-      /*info:INFERRED_TYPE_LITERAL*/[3]); }
-''';
-    }
-
-    ;
     checkFile(
         build(declared: "MyFuture", downwards: "Future", upwards: "Future"));
     checkFile(
@@ -2263,26 +2359,8 @@
   dynamic g(int x) => x;
 }
 class D extends C {
-  T m<T>(T x) => x;
-  T g<T>(T x) => x;
-}
-main() {
-  int y = /*info:DYNAMIC_CAST*/(/*info:UNNECESSARY_CAST*/new D() as C).m(42);
-  print(y);
-}
-  ''');
-  }
-
-  void test_genericMethods_handleOverrideOfNonGenericWithGeneric_comment() {
-    // Regression test for crash when adding genericity
-    checkFile('''
-class C {
-  m(x) => x;
-  dynamic g(int x) => x;
-}
-class D extends C {
-  /*=T*/ m/*<T>*/(/*=T*/ x) => x;
-  /*=T*/ g/*<T>*/(/*=T*/ x) => x;
+  /*error:INVALID_METHOD_OVERRIDE*/T m<T>(T x) => x;
+  /*error:INVALID_METHOD_OVERRIDE*/T g<T>(T x) => x;
 }
 main() {
   int y = /*info:DYNAMIC_CAST*/(/*info:UNNECESSARY_CAST*/new D() as C).m(42);
@@ -2600,7 +2678,7 @@
     // TODO(jmesserly): we should change how this inference works.
     // For now this test will cover what we use.
     checkFile('''
-import 'dart:_foreign_helper' show JS;
+/*error:IMPORT_INTERNAL_LIBRARY*/import 'dart:_foreign_helper' show JS;
 main() {
   String x = /*error:INVALID_ASSIGNMENT*/JS('int', '42');
   var y = JS('String', '"hello"');
@@ -2620,7 +2698,10 @@
   Iterable<Future<int>> list = <int>[1, 2, 3].map(make);
   Future<List<int>> results = Future.wait(list);
   Future<String> results2 = results.then((List<int> list)
-    => list.fold('', /*info:INFERRED_TYPE_CLOSURE*/(x, y) => x + y.toString()));
+    => list.fold('', /*info:INFERRED_TYPE_CLOSURE*/(x, y) => /*info:DYNAMIC_CAST,info:DYNAMIC_INVOKE*/x /*error:UNDEFINED_OPERATOR*/+ y.toString()));
+
+  Future<String> results3 = results.then((List<int> list)
+    => list.fold('', /*info:INFERRED_TYPE_CLOSURE*/(String x, y) => x + y.toString()));
 }
 ''');
   }
@@ -3472,19 +3553,21 @@
   void test_inferredType_blockBodiedClosure_noArguments() {
     var mainUnit = checkFile('''
 class C {
-  static final v = () {};
+  static final v = /*warning:UNSAFE_BLOCK_CLOSURE_INFERENCE,
+                     info:INFERRED_TYPE_CLOSURE*/() {};
 }
 ''');
     var v = mainUnit.getType('C').fields[0];
-    expect(v.type.toString(), '() → dynamic');
+    expect(v.type.toString(), '() → Null');
   }
 
   void test_inferredType_blockClosure_noArgs_noReturn() {
     var mainUnit = checkFile('''
-var f = () {};
+var f = /*warning:UNSAFE_BLOCK_CLOSURE_INFERENCE,
+                     info:INFERRED_TYPE_CLOSURE*/() {};
 ''');
     var f = mainUnit.topLevelVariables[0];
-    expect(f.type.toString(), '() → dynamic');
+    expect(f.type.toString(), '() → Null');
   }
 
   void test_inferredType_customBinaryOp() {
@@ -4230,6 +4313,16 @@
 ''');
   }
 
+  void test_inferVariableVoid() {
+    var mainUnit = checkFile('''
+void f() {}
+var x = /*info:USE_OF_VOID_RESULT*/f();
+    ''');
+    var x = mainUnit.topLevelVariables[0];
+    expect(x.name, 'x');
+    expect(x.type.toString(), 'void');
+  }
+
   void test_instanceField_basedOnInstanceField_betweenCycles() {
     // Verify that all instance fields in one library cycle are inferred before
     // an instance fields in a dependent library cycle.
@@ -4295,7 +4388,7 @@
 
   void test_instantiateToBounds_generic2_hasBound_definedAfter() {
     var unit = checkFile(r'''
-class B<T extends A> {}
+class B<T extends /*error:NOT_INSTANTIATED_BOUND*/A> {}
 class A<T extends int> {}
 B v = null;
 ''');
@@ -4305,7 +4398,7 @@
   void test_instantiateToBounds_generic2_hasBound_definedBefore() {
     var unit = checkFile(r'''
 class A<T extends int> {}
-class B<T extends A> {}
+class B<T extends /*error:NOT_INSTANTIATED_BOUND*/A> {}
 B v = null;
 ''');
     expect(unit.topLevelVariables[0].type.toString(), 'B<A<dynamic>>');
@@ -5365,54 +5458,23 @@
 
 void printRunning() { print("running"); }
 var x = run<dynamic>(printRunning);
-var y = run(printRunning);
+var y = /*info:USE_OF_VOID_RESULT*/run(printRunning);
 
 main() {
   void printRunning() { print("running"); }
   var x = run<dynamic>(printRunning);
-  var y = run(printRunning);
+  var y = /*info:USE_OF_VOID_RESULT*/run(printRunning);
   x = 123;
   x = 'hi';
-  y = 123;
-  y = 'hi';
+  y = /*error:INVALID_ASSIGNMENT*/123;
+  y = /*error:INVALID_ASSIGNMENT*/'hi';
 }
     ''');
 
     var x = unit.topLevelVariables[0];
     var y = unit.topLevelVariables[1];
     expect(x.type.toString(), 'dynamic');
-    expect(y.type.toString(), 'dynamic');
-  }
-
-  void test_voidReturnTypeSubtypesDynamic_comment() {
-    var unit = checkFile(r'''
-/*=T*/ run/*<T>*/(/*=T*/ f()) {
-  print("running");
-  var t = f();
-  print("done running");
-  return t;
-}
-
-
-void printRunning() { print("running"); }
-var x = run/*<dynamic>*/(printRunning);
-var y = run(printRunning);
-
-main() {
-  void printRunning() { print("running"); }
-  var x = run/*<dynamic>*/(printRunning);
-  var y = run(printRunning);
-  x = 123;
-  x = 'hi';
-  y = 123;
-  y = 'hi';
-}
-    ''');
-
-    var x = unit.topLevelVariables[0];
-    var y = unit.topLevelVariables[1];
-    expect(x.type.toString(), 'dynamic');
-    expect(y.type.toString(), 'dynamic');
+    expect(y.type.toString(), 'void');
   }
 }
 
diff --git a/pkg/analyzer/test/src/task/strong/strong_test_helper.dart b/pkg/analyzer/test/src/task/strong/strong_test_helper.dart
index 2b8314d..c2debb8 100644
--- a/pkg/analyzer/test/src/task/strong/strong_test_helper.dart
+++ b/pkg/analyzer/test/src/task/strong/strong_test_helper.dart
@@ -7,6 +7,7 @@
 library analyzer.test.src.task.strong.strong_test_helper;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/error/error.dart';
@@ -87,7 +88,8 @@
 
   // Extract expectations from the comments in the test files, and
   // check that all errors we emit are included in the expected map.
-  var allLibraries = _reachableLibraries(initialLibrary.element.library);
+  var allLibraries = _reachableLibraries(
+      resolutionMap.elementDeclaredByCompilationUnit(initialLibrary).library);
   for (var lib in allLibraries) {
     for (var unit in lib.units) {
       var errors = <AnalysisError>[];
@@ -173,7 +175,9 @@
 
 ErrorSeverity _errorSeverity(AnalysisContext context, AnalysisError error) {
   // Attempt to process severity in a similar way to analyzer_cli and server.
-  return ErrorProcessor.getProcessor(context, error)?.severity ??
+  return ErrorProcessor
+          .getProcessor(context.analysisOptions, error)
+          ?.severity ??
       error.errorCode.errorSeverity;
 }
 
@@ -283,13 +287,14 @@
     Map<_ErrorExpectation, AnalysisError> different) {
   // Get the source code. This reads the data again, but it's safe because
   // all tests use memory file system.
-  var sourceCode = unit.element.source.contents.data;
+  var sourceCode =
+      resolutionMap.elementDeclaredByCompilationUnit(unit).source.contents.data;
 
   String formatActualError(AnalysisError error) {
     int offset = error.offset;
     int length = error.length;
-    var span = _createSpanHelper(
-        unit.lineInfo, offset, unit.element.source, sourceCode,
+    var span = _createSpanHelper(unit.lineInfo, offset,
+        resolutionMap.elementDeclaredByCompilationUnit(unit).source, sourceCode,
         end: offset + length);
     var levelName = _errorSeverity(context, error).displayName;
     return '@$offset $levelName:${_errorCodeName(error.errorCode)}\n' +
@@ -299,7 +304,10 @@
   String formatExpectedError(_ErrorExpectation error) {
     int offset = error.offset;
     var span = _createSpanHelper(
-        unit.lineInfo, offset, unit.element.source, sourceCode);
+        unit.lineInfo,
+        offset,
+        resolutionMap.elementDeclaredByCompilationUnit(unit).source,
+        sourceCode);
     var severity = error.severity.displayName;
     return '@$offset $severity:${error.typeName}\n' + span.message('');
   }
diff --git a/pkg/analyzer/test/src/test_all.dart b/pkg/analyzer/test/src/test_all.dart
index 8f727da..6287bed 100644
--- a/pkg/analyzer/test/src/test_all.dart
+++ b/pkg/analyzer/test/src/test_all.dart
@@ -9,7 +9,7 @@
 import 'command_line/test_all.dart' as command_line;
 import 'context/test_all.dart' as context;
 import 'dart/test_all.dart' as dart;
-import 'plugin/plugin_config_test.dart' as plugin;
+import 'lint/test_all.dart' as lint;
 import 'source/test_all.dart' as source;
 import 'summary/test_all.dart' as summary;
 import 'task/test_all.dart' as task;
@@ -21,7 +21,7 @@
     command_line.main();
     context.main();
     dart.main();
-    plugin.main();
+    lint.main();
     source.main();
     summary.main();
     task.main();
diff --git a/pkg/analyzer/test/test_all.dart b/pkg/analyzer/test/test_all.dart
index d9cdf90..2f6954f 100644
--- a/pkg/analyzer/test/test_all.dart
+++ b/pkg/analyzer/test/test_all.dart
@@ -8,6 +8,7 @@
 
 import 'cancelable_future_test.dart' as cancelable_future_test;
 import 'context/test_all.dart' as context;
+import 'dart/test_all.dart' as dart;
 import 'file_system/test_all.dart' as file_system;
 import 'generated/test_all.dart' as generated;
 import 'instrumentation/test_all.dart' as instrumentation;
@@ -20,6 +21,7 @@
   defineReflectiveSuite(() {
     cancelable_future_test.main();
     context.main();
+    dart.main();
     file_system.main();
     generated.main();
     instrumentation.main();
diff --git a/pkg/analyzer/test/utils.dart b/pkg/analyzer/test/utils.dart
index be7e64d..154a266 100644
--- a/pkg/analyzer/test/utils.dart
+++ b/pkg/analyzer/test/utils.dart
@@ -5,9 +5,11 @@
 library analyzer.test.utils;
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
+import 'package:front_end/src/base/source.dart';
 import 'package:test/test.dart';
 
 /**
@@ -45,7 +47,8 @@
         return unitMember;
       }
     }
-    fail('No class named $className in ${unit.element.source}');
+    Source source = resolutionMap.elementDeclaredByCompilationUnit(unit).source;
+    fail('No class named $className in $source');
     return null;
   }
 
@@ -198,7 +201,9 @@
   // TODO(leafp): Make these matchers.
   // https://www.dartdocs.org/documentation/matcher/0.12.0%2B1/matcher/Matcher-class.html
 
-  /* Provides primitive types for basic type assertions */
+  /**
+   * Provides primitive types for basic type assertions.
+   */
   final TypeProvider _typeProvider;
 
   TypeAssertions(this._typeProvider);
@@ -216,12 +221,17 @@
   /**
    * Primitive assertion for the list type
    */
-  Asserter<DartType> get isList => sameElement(_typeProvider.listType);
+  Asserter<DartType> get isList => hasElementOf(_typeProvider.listType);
 
   /**
    * Primitive assertion for the map type
    */
-  Asserter<DartType> get isMap => sameElement(_typeProvider.mapType);
+  Asserter<DartType> get isMap => hasElementOf(_typeProvider.mapType);
+
+  /**
+   * Primitive assertion for the Null type
+   */
+  Asserter<DartType> get isNull => isType(_typeProvider.nullType);
 
   /**
    * Primitive assertion for the num type
@@ -229,15 +239,26 @@
   Asserter<DartType> get isNum => isType(_typeProvider.numType);
 
   /**
+   * Primitive assertion for the Object type
+   */
+  Asserter<DartType> get isObject => isType(_typeProvider.objectType);
+
+  /**
    * Primitive assertion for the string type
    */
   Asserter<DartType> get isString => isType(_typeProvider.stringType);
 
   /**
-   * Given a type, produce an assertion that a type has the same element.
+   * Assert that a type has the element that is equal to the [expected].
    */
-  Asserter<DartType> hasElement(Element element) =>
-      (DartType type) => expect(element, same(type.element));
+  Asserter<DartType> hasElement(Element expected) =>
+      (DartType type) => expect(expected, type.element);
+
+  /**
+   * Assert that a type has the element that is equal to the element of the
+   * given [type].
+   */
+  Asserter<DartType> hasElementOf(DartType type) => hasElement(type.element);
 
   /**
    * Given assertions for the argument and return types, produce an
@@ -253,7 +274,7 @@
 
   /**
    * Given an assertion for the base type and assertions over the type
-   * parameters, produce an assertion over instantations.
+   * parameters, produce an assertion over instantiations.
    */
   AsserterBuilder<List<Asserter<DartType>>, DartType> isInstantiationOf(
           Asserter<DartType> baseAssert) =>
@@ -283,15 +304,9 @@
       isInstantiationOf(isMap)([argAssert0, argAssert1]);
 
   /**
-   * Assert that one type is the same as another
+   * Assert that a type is equal to the [expected].
    */
-  Asserter<DartType> isType(DartType argument) => (DartType t) {
-        expect(t, same(argument));
+  Asserter<DartType> isType(DartType expected) => (DartType t) {
+        expect(t, expected);
       };
-
-  /**
-   * Given a type, produce an assertion that a type has the same element.
-   */
-  Asserter<DartType> sameElement(DartType elementType) =>
-      hasElement(elementType.element);
 }
diff --git a/pkg/analyzer/tool/summary/generate.dart b/pkg/analyzer/tool/summary/generate.dart
index d3fd863..6db5cf0 100644
--- a/pkg/analyzer/tool/summary/generate.dart
+++ b/pkg/analyzer/tool/summary/generate.dart
@@ -268,10 +268,13 @@
         for (ClassMember classMember in decl.members) {
           if (classMember is MethodDeclaration && classMember.isGetter) {
             String desc = '$clsName.${classMember.name.name}';
-            TypeName type = classMember.returnType;
-            if (type == null) {
-              throw new Exception('Class member needs a type: $desc');
+            if (classMember.returnType is! TypeName) {
+              if (classMember.returnType == null) {
+                throw new Exception('Class member needs a type: $desc');
+              }
+              throw new Exception('Class member needs a class type: $desc');
             }
+            TypeName type = classMember.returnType;
             bool isList = false;
             if (type.name.name == 'List' &&
                 type.typeArguments != null &&
diff --git a/pkg/analyzer/tool/task_dependency_graph/tasks.dot b/pkg/analyzer/tool/task_dependency_graph/tasks.dot
index e6af229..89988ad 100644
--- a/pkg/analyzer/tool/task_dependency_graph/tasks.dot
+++ b/pkg/analyzer/tool/task_dependency_graph/tasks.dot
@@ -85,6 +85,7 @@
   EXPORTED_LIBRARIES -> ReadyLibraryElement2Task
   EXPORTED_LIBRARIES -> ReadyLibraryElement5Task
   EXPORTED_LIBRARIES -> ReadyLibraryElement7Task
+  EXPORTED_LIBRARIES -> ResolveDirectiveElementsTask
   EXPORTED_LIBRARIES -> ResolveTopLevelLibraryTypeBoundsTask
   EXPORTED_LIBRARIES [shape=box]
   EXPORT_SOURCE_CLOSURE -> BuildExportNamespaceTask
@@ -104,6 +105,7 @@
   IMPORTED_LIBRARIES -> ReadyLibraryElement2Task
   IMPORTED_LIBRARIES -> ReadyLibraryElement5Task
   IMPORTED_LIBRARIES -> ReadyLibraryElement7Task
+  IMPORTED_LIBRARIES -> ResolveDirectiveElementsTask
   IMPORTED_LIBRARIES -> ResolveTopLevelLibraryTypeBoundsTask
   IMPORTED_LIBRARIES -> ResolveTopLevelUnitTypeBoundsTask
   IMPORTED_LIBRARIES [shape=box]
@@ -189,6 +191,7 @@
   MODIFICATION_TIME -> BuildDirectiveElementsTask
   MODIFICATION_TIME -> BuildLibraryElementTask
   MODIFICATION_TIME -> ParseDartTask
+  MODIFICATION_TIME -> ResolveDirectiveElementsTask
   MODIFICATION_TIME -> ScanDartTask
   MODIFICATION_TIME -> VerifyUnitTask
   MODIFICATION_TIME [shape=box]
@@ -226,6 +229,7 @@
   READY_RESOLVED_UNIT [shape=box]
   REFERENCED_NAMES [shape=box]
   REFERENCED_SOURCES -> BuildDirectiveElementsTask
+  REFERENCED_SOURCES -> ResolveDirectiveElementsTask
   REFERENCED_SOURCES -> VerifyUnitTask
   REFERENCED_SOURCES [shape=box]
   REQUIRED_CONSTANTS -> VerifyUnitTask
@@ -270,6 +274,8 @@
   RESOLVED_UNIT8 [shape=box]
   RESOLVED_UNIT9 -> InferInstanceMembersInUnitTask
   RESOLVED_UNIT9 [shape=box]
+  RESOLVE_DIRECTIVES_ERRORS -> LibraryUnitErrorsTask
+  RESOLVE_DIRECTIVES_ERRORS [shape=box]
   RESOLVE_TYPE_BOUNDS_ERRORS -> LibraryUnitErrorsTask
   RESOLVE_TYPE_BOUNDS_ERRORS [shape=box]
   RESOLVE_TYPE_NAMES_ERRORS -> LibraryUnitErrorsTask
@@ -283,6 +289,7 @@
   ResolveConstantExpressionTask -> CONSTANT_EXPRESSION_RESOLVED
   ResolveDirectiveElementsTask -> CREATED_RESOLVED_UNIT2
   ResolveDirectiveElementsTask -> RESOLVED_UNIT2
+  ResolveDirectiveElementsTask -> RESOLVE_DIRECTIVES_ERRORS
   ResolveInstanceFieldsInUnitTask -> CREATED_RESOLVED_UNIT9
   ResolveInstanceFieldsInUnitTask -> RESOLVED_UNIT9
   ResolveLibraryReferencesTask -> LIBRARY_ELEMENT9
@@ -307,6 +314,7 @@
   SCAN_ERRORS -> dartErrorsForSource
   SCAN_ERRORS [shape=box]
   SOURCE_KIND -> BuildDirectiveElementsTask
+  SOURCE_KIND -> ResolveDirectiveElementsTask
   SOURCE_KIND [shape=box]
   STATIC_VARIABLE_RESOLUTION_ERRORS -> InferStaticVariableTypesInUnitTask
   STATIC_VARIABLE_RESOLUTION_ERRORS [shape=box]
diff --git a/pkg/analyzer_cli/BUILD.gn b/pkg/analyzer_cli/BUILD.gn
index 69993f0..76daaf8 100644
--- a/pkg/analyzer_cli/BUILD.gn
+++ b/pkg/analyzer_cli/BUILD.gn
@@ -11,10 +11,10 @@
 
   deps = [
     "//dart/pkg/analyzer",
+    "//dart/third_party/pkg/linter",
     "//third_party/dart-pkg/pub/args",
     "//third_party/dart-pkg/pub/bazel_worker",
     "//third_party/dart-pkg/pub/cli_util",
-    "//third_party/dart-pkg/pub/linter",
     "//third_party/dart-pkg/pub/package_config",
     "//third_party/dart-pkg/pub/plugin",
     "//third_party/dart-pkg/pub/protobuf",
diff --git a/pkg/analyzer_cli/lib/src/analyzer_impl.dart b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
index 14b61b8..186ed82 100644
--- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
@@ -4,6 +4,7 @@
 
 library analyzer_cli.src.analyzer_impl;
 
+import 'dart:async';
 import 'dart:collection';
 import 'dart:io';
 
@@ -11,8 +12,9 @@
 import 'package:analyzer/error/error.dart';
 import 'package:analyzer/exception/exception.dart';
 import 'package:analyzer/source/error_processor.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
 import 'package:analyzer/src/error/codes.dart';
-import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/engine.dart' hide AnalysisResult;
 import 'package:analyzer/src/generated/java_io.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/source_io.dart';
@@ -37,7 +39,9 @@
   final CommandLineOptions options;
   final int startTime;
 
+  final AnalysisOptions analysisOptions;
   final AnalysisContext context;
+  final AnalysisDriver analysisDriver;
 
   /// Accumulated analysis statistics.
   final AnalysisStats stats;
@@ -61,8 +65,8 @@
   /// specified the "--package-warnings" option.
   String _selfPackageName;
 
-  AnalyzerImpl(this.context, this.librarySource, this.options, this.stats,
-      this.startTime);
+  AnalyzerImpl(this.analysisOptions, this.context, this.analysisDriver,
+      this.librarySource, this.options, this.stats, this.startTime);
 
   /// Returns the maximal [ErrorSeverity] of the recorded errors.
   ErrorSeverity get maxErrorSeverity {
@@ -111,24 +115,34 @@
     }
   }
 
-  /// Treats the [sourcePath] as the top level library and analyzes it using a
-  /// synchronous algorithm over the analysis engine. If [printMode] is `0`,
-  /// then no error or performance information is printed. If [printMode] is `1`,
-  /// then both will be printed. If [printMode] is `2`, then only performance
-  /// information will be printed, and it will be marked as being for a cold VM.
-  ErrorSeverity analyzeSync({int printMode: 1}) {
+  /// Treats the [sourcePath] as the top level library and analyzes it using
+  /// the analysis engine. If [printMode] is `0`, then no error or performance
+  /// information is printed. If [printMode] is `1`, then both will be printed.
+  /// If [printMode] is `2`, then only performance information will be printed,
+  /// and it will be marked as being for a cold VM.
+  Future<ErrorSeverity> analyze({int printMode: 1}) async {
     setupForAnalysis();
-    return _analyzeSync(printMode);
+    return await _analyze(printMode);
   }
 
   /// Fills [errorInfos] using [sources].
-  void prepareErrors() {
-    return _prepareErrorsTag.makeCurrentWhile(() {
+  Future<Null> prepareErrors() async {
+    PerformanceTag previous = _prepareErrorsTag.makeCurrent();
+    try {
       for (Source source in sources) {
-        context.computeErrors(source);
-        errorInfos.add(context.getErrors(source));
+        if (analysisDriver != null) {
+          String path = source.fullName;
+          AnalysisResult analysisResult = await analysisDriver.getResult(path);
+          errorInfos.add(new AnalysisErrorInfoImpl(
+              analysisResult.errors, analysisResult.lineInfo));
+        } else {
+          context.computeErrors(source);
+          errorInfos.add(context.getErrors(source));
+        }
       }
-    });
+    } finally {
+      previous.makeCurrent();
+    }
   }
 
   /// Fills [sources].
@@ -148,8 +162,7 @@
     }
   }
 
-  /// The sync version of analysis.
-  ErrorSeverity _analyzeSync(int printMode) {
+  Future<ErrorSeverity> _analyze(int printMode) async {
     // Don't try to analyze parts.
     if (context.computeKindOf(librarySource) == SourceKind.PART) {
       stderr.writeln("Only libraries can be analyzed.");
@@ -157,9 +170,10 @@
           "${librarySource.fullName} is a part and can not be analyzed.");
       return ErrorSeverity.ERROR;
     }
-    var libraryElement = _resolveLibrary();
+
+    LibraryElement libraryElement = await _resolveLibrary();
     prepareSources(libraryElement);
-    prepareErrors();
+    await prepareErrors();
 
     // Print errors and performance numbers.
     if (printMode == 1) {
@@ -240,12 +254,22 @@
   }
 
   ProcessedSeverity _processError(AnalysisError error) =>
-      processError(error, options, context);
+      processError(error, options, analysisOptions);
 
-  LibraryElement _resolveLibrary() {
-    return _resolveLibraryTag.makeCurrentWhile(() {
-      return context.computeLibraryElement(librarySource);
-    });
+  Future<LibraryElement> _resolveLibrary() async {
+    PerformanceTag previous = _resolveLibraryTag.makeCurrent();
+    try {
+      if (analysisDriver != null) {
+        String path = librarySource.fullName;
+        analysisDriver.priorityFiles = [path];
+        AnalysisResult analysisResult = await analysisDriver.getResult(path);
+        return analysisResult.unit.element.library;
+      } else {
+        return context.computeLibraryElement(librarySource);
+      }
+    } finally {
+      previous.makeCurrent();
+    }
   }
 
   /// Compute the severity of the error; however:
@@ -255,9 +279,10 @@
   ///   * if [options.lintsAreFatal] is true, escalate lints to errors.
   static ErrorSeverity computeSeverity(
       AnalysisError error, CommandLineOptions options,
-      [AnalysisContext context]) {
-    if (context != null) {
-      ErrorProcessor processor = ErrorProcessor.getProcessor(context, error);
+      [AnalysisOptions analysisOptions]) {
+    if (analysisOptions != null) {
+      ErrorProcessor processor =
+          ErrorProcessor.getProcessor(analysisOptions, error);
       // If there is a processor for this error, defer to it.
       if (processor != null) {
         return processor.severity;
@@ -295,8 +320,8 @@
   /// Check various configuration options to get a desired severity for this
   /// [error] (or `null` if it's to be suppressed).
   static ProcessedSeverity processError(AnalysisError error,
-      CommandLineOptions options, AnalysisContext context) {
-    ErrorSeverity severity = computeSeverity(error, options, context);
+      CommandLineOptions options, AnalysisOptions analysisOptions) {
+    ErrorSeverity severity = computeSeverity(error, options, analysisOptions);
     bool isOverridden = false;
 
     // Skip TODOs categorically (unless escalated to ERROR or HINT.)
diff --git a/pkg/analyzer_cli/lib/src/boot_loader.dart b/pkg/analyzer_cli/lib/src/boot_loader.dart
deleted file mode 100644
index 5b03f40..0000000
--- a/pkg/analyzer_cli/lib/src/boot_loader.dart
+++ /dev/null
@@ -1,211 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analyzer_cli.src.boot_loader;
-
-import 'dart:async';
-import 'dart:isolate';
-
-import 'package:analyzer/file_system/file_system.dart';
-import 'package:analyzer/file_system/physical_file_system.dart';
-import 'package:analyzer/source/analysis_options_provider.dart';
-import 'package:analyzer/src/context/context.dart';
-import 'package:analyzer/src/generated/engine.dart' as engine;
-import 'package:analyzer/src/plugin/plugin_configuration.dart';
-import 'package:analyzer_cli/src/driver.dart';
-import 'package:analyzer_cli/src/options.dart';
-import 'package:source_span/source_span.dart';
-import 'package:yaml/src/yaml_node.dart';
-
-const _analyzerPackageName = 'analyzer';
-
-/// Return non-null if there is a validation issue with this plugin.
-String validate(PluginInfo plugin) {
-  var missing = <String>[];
-  if (plugin.className == null) {
-    missing.add('class name');
-  }
-  if (plugin.libraryUri == null) {
-    missing.add('library uri');
-  }
-  if (missing.isEmpty) {
-    // All good.
-    return null;
-  }
-  return 'Plugin ${plugin.name} skipped, config missing: ${missing.join(", ")}';
-}
-
-List<PluginInfo> _validate(Iterable<PluginInfo> plugins) {
-  List<PluginInfo> validated = <PluginInfo>[];
-  plugins.forEach((PluginInfo plugin) {
-    String validation = validate(plugin);
-    if (validation != null) {
-      errorSink.writeln(validation);
-    } else {
-      validated.add(plugin);
-    }
-  });
-  return validated;
-}
-
-/// Source code assembler.
-class Assembler {
-  /// Plugins to configure.
-  final Iterable<PluginInfo> plugins;
-
-  /// Create an assembler for the given plugin [config].
-  Assembler(this.plugins);
-
-  /// A string enumerating required package `import`s.
-  String get enumerateImports =>
-      plugins.map((PluginInfo p) => "import '${p.libraryUri}';").join('\n');
-
-  /// A string listing initialized plugin instances.
-  String get pluginList =>
-      plugins.map((PluginInfo p) => 'new ${p.className}()').join(', ');
-
-  /// Create a file containing a `main()` suitable for loading in spawned
-  /// isolate.
-  String createMain() => _generateMain();
-
-  String _generateMain() => """
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// This code was auto-generated, is not intended to be edited, and is subject to
-// significant change. Please see the README file for more information.
-
-import 'package:analyzer_cli/src/driver.dart';
-
-$enumerateImports
-
-void main(List<String> args) {
-  var starter = new Driver();
-  starter.userDefinedPlugins = [$pluginList];
-  starter.start(args);
-}
-""";
-}
-
-/// Given environment information extracted from command-line `args`, creates a
-/// a loadable analyzer "image".
-class BootLoader {
-  /// Emits an error message to [errorSink] if plugin config can't be read.
-  static final ErrorHandler _pluginConfigErrorHandler = (Exception e) {
-    String details;
-    if (e is PluginConfigFormatException) {
-      details = e.message;
-      var node = e.yamlNode;
-      if (node is YamlNode) {
-        SourceLocation location = node.span.start;
-        details += ' (line ${location.line}, column ${location.column})';
-      }
-    } else {
-      details = e.toString();
-    }
-
-    errorSink.writeln('Plugin configuration skipped: $details');
-  };
-
-  /// Reads plugin config info from the analysis options file.
-  PluginConfigOptionsProcessor _pluginOptionsProcessor =
-      new PluginConfigOptionsProcessor(_pluginConfigErrorHandler);
-
-  /// Create a loadable analyzer image configured with plugins derived from
-  /// the given analyzer command-line `args`.
-  Image createImage(List<String> args) {
-    // Parse commandline options.
-    CommandLineOptions options = CommandLineOptions.parse(args);
-
-    // Process analysis options file (and notify all interested parties).
-    _processAnalysisOptions(options);
-
-    // TODO(pquitslund): Pass in .packages info
-    return new Image(_pluginOptionsProcessor.config,
-        args: args, packageRootPath: options.packageRootPath);
-  }
-
-  File _getOptionsFile(
-      CommandLineOptions options, ResourceProvider resourceProvider) {
-    String analysisOptionsFile = options.analysisOptionsFile;
-    if (analysisOptionsFile != null) {
-      return resourceProvider.getFile(analysisOptionsFile);
-    }
-    File file =
-        resourceProvider.getFile(engine.AnalysisEngine.ANALYSIS_OPTIONS_FILE);
-    if (!file.exists) {
-      file = resourceProvider
-          .getFile(engine.AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
-    }
-    return file;
-  }
-
-  void _processAnalysisOptions(CommandLineOptions commandLineOptions) {
-    // Determine options file path.
-    try {
-      File file = _getOptionsFile(
-          commandLineOptions, PhysicalResourceProvider.INSTANCE);
-      AnalysisOptionsProvider analysisOptionsProvider =
-          new AnalysisOptionsProvider();
-      Map<String, YamlNode> options =
-          analysisOptionsProvider.getOptionsFromFile(file);
-      //TODO(pq): thread in proper context.
-      var temporaryContext = new AnalysisContextImpl();
-      _pluginOptionsProcessor.optionsProcessed(temporaryContext, options);
-    } on Exception catch (e) {
-      _pluginOptionsProcessor.onError(e);
-    }
-  }
-}
-
-/// A loadable "image" of a a configured analyzer instance.
-class Image {
-  /// (Optional) package root path.
-  final String packageRootPath;
-
-  /// (Optional) package map.
-  final Map<String, Uri> packages;
-
-  /// (Optional) args to be passed on to the loaded main.
-  final List<String> args;
-
-  /// Plugin configuration.
-  final PluginConfig config;
-
-  /// Create an image with the given [config] and optionally [packages],
-  /// [packageRootPath], and command line [args].
-  Image(this.config, {this.packages, this.packageRootPath, this.args});
-
-  /// Load this image.
-  ///
-  /// Loading an image consists in assembling an analyzer `main()`, configured
-  /// to include the appropriate analyzer plugins as specified in
-  /// `.analyzer_options` which is then run in a spawned isolate.
-  Future load() {
-    List<PluginInfo> plugins = _validate(config.plugins);
-    String mainSource = new Assembler(plugins).createMain();
-
-    Completer completer = new Completer();
-    ReceivePort exitListener = new ReceivePort();
-    exitListener.listen((data) {
-      completer.complete();
-      exitListener.close();
-    });
-
-    Uri uri =
-        Uri.parse('data:application/dart;charset=utf-8,${Uri.encodeComponent(
-        mainSource)}');
-
-    // TODO(pquitslund): update once .packages are supported.
-    String packageRoot =
-        packageRootPath != null ? packageRootPath : './packages';
-    Uri packageUri = new Uri.file(packageRoot);
-
-    Isolate.spawnUri(uri, args, null /* msg */,
-        packageRoot: packageUri, onExit: exitListener.sendPort);
-
-    return completer.future;
-  }
-}
diff --git a/pkg/analyzer_cli/lib/src/build_mode.dart b/pkg/analyzer_cli/lib/src/build_mode.dart
index a8e9757..8249e77 100644
--- a/pkg/analyzer_cli/lib/src/build_mode.dart
+++ b/pkg/analyzer_cli/lib/src/build_mode.dart
@@ -225,8 +225,8 @@
       for (Source source in explicitSources) {
         AnalysisErrorInfo errorInfo = context.getErrors(source);
         for (AnalysisError error in errorInfo.errors) {
-          ProcessedSeverity processedSeverity =
-              AnalyzerImpl.processError(error, options, context);
+          ProcessedSeverity processedSeverity = AnalyzerImpl.processError(
+              error, options, context.analysisOptions);
           if (processedSeverity != null) {
             maxSeverity = maxSeverity.max(processedSeverity.severity);
           }
@@ -270,7 +270,8 @@
     ]);
 
     // Set context options.
-    Driver.setAnalysisContextOptions(resourceProvider, context, options,
+    Driver.setAnalysisContextOptions(
+        resourceProvider, context.sourceFactory, context, options,
         (AnalysisOptionsImpl contextOptions) {
       if (options.buildSummaryOnlyDiet) {
         contextOptions.analyzeFunctionBodies = false;
@@ -318,7 +319,7 @@
         options,
         stats,
         (AnalysisError error) =>
-            AnalyzerImpl.processError(error, options, context));
+            AnalyzerImpl.processError(error, options, context.analysisOptions));
     for (Source source in explicitSources) {
       AnalysisErrorInfo errorInfo = context.getErrors(source);
       formatter.formatErrors([errorInfo]);
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index 16ec22d..cab1e4c 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -12,7 +12,6 @@
 import 'package:analyzer/file_system/file_system.dart' as file_system;
 import 'package:analyzer/file_system/file_system.dart';
 import 'package:analyzer/file_system/physical_file_system.dart';
-import 'package:analyzer/plugin/options.dart';
 import 'package:analyzer/plugin/resolver_provider.dart';
 import 'package:analyzer/source/analysis_options_provider.dart';
 import 'package:analyzer/source/package_map_provider.dart';
@@ -20,6 +19,9 @@
 import 'package:analyzer/source/pub_package_map_provider.dart';
 import 'package:analyzer/source/sdk_ext.dart';
 import 'package:analyzer/src/context/builder.dart';
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
+import 'package:analyzer/src/dart/analysis/file_state.dart';
 import 'package:analyzer/src/dart/sdk/sdk.dart';
 import 'package:analyzer/src/generated/constant.dart';
 import 'package:analyzer/src/generated/engine.dart';
@@ -30,8 +32,9 @@
 import 'package:analyzer/src/generated/source_io.dart';
 import 'package:analyzer/src/generated/utilities_general.dart'
     show PerformanceTag;
-import 'package:analyzer/src/services/lint.dart';
+import 'package:analyzer/src/lint/registry.dart';
 import 'package:analyzer/src/source/source_resource.dart';
+import 'package:analyzer/src/summary/idl.dart';
 import 'package:analyzer/src/summary/package_bundle_reader.dart';
 import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk;
 import 'package:analyzer/src/task/options.dart';
@@ -41,7 +44,7 @@
 import 'package:analyzer_cli/src/options.dart';
 import 'package:analyzer_cli/src/perf_report.dart';
 import 'package:analyzer_cli/starter.dart';
-import 'package:linter/src/plugin/linter_plugin.dart';
+import 'package:linter/src/rules.dart' as linter;
 import 'package:package_config/discovery.dart' as pkg_discovery;
 import 'package:package_config/packages.dart' show Packages;
 import 'package:package_config/packages_file.dart' as pkgfile show parse;
@@ -67,12 +70,14 @@
   return linterNode is YamlMap && linterNode.containsKey('rules');
 }
 
-typedef ErrorSeverity _BatchRunnerHandler(List<String> args);
+typedef Future<ErrorSeverity> _BatchRunnerHandler(List<String> args);
 
 class Driver implements CommandLineStarter {
   static final PerformanceTag _analyzeAllTag =
       new PerformanceTag("Driver._analyzeAll");
 
+  static ByteStore analysisDriverByteStore = new MemoryByteStore();
+
   /// The plugins that are defined outside the `analyzer_cli` package.
   List<Plugin> _userDefinedPlugins = <Plugin>[];
 
@@ -80,6 +85,8 @@
   /// `null` if [_analyzeAll] hasn't been called yet.
   InternalAnalysisContext _context;
 
+  AnalysisDriver analysisDriver;
+
   /// The total number of source files loaded by an AnalysisContext.
   int _analyzedFileCount = 0;
 
@@ -113,7 +120,7 @@
   }
 
   @override
-  void start(List<String> args) {
+  Future<Null> start(List<String> args) async {
     if (_context != null) {
       throw new StateError("start() can only be called once");
     }
@@ -134,12 +141,12 @@
         io.exitCode = severity.ordinal;
       }
     } else if (options.shouldBatch) {
-      _BatchRunner.runAsBatch(args, (List<String> args) {
+      _BatchRunner.runAsBatch(args, (List<String> args) async {
         CommandLineOptions options = CommandLineOptions.parse(args);
-        return _analyzeAll(options);
+        return await _analyzeAll(options);
       });
     } else {
-      ErrorSeverity severity = _analyzeAll(options);
+      ErrorSeverity severity = await _analyzeAll(options);
       // In case of error propagate exit code.
       if (severity == ErrorSeverity.ERROR) {
         io.exitCode = severity.ordinal;
@@ -157,14 +164,17 @@
     }
   }
 
-  ErrorSeverity _analyzeAll(CommandLineOptions options) {
-    return _analyzeAllTag.makeCurrentWhile(() {
-      return _analyzeAllImpl(options);
-    });
+  Future<ErrorSeverity> _analyzeAll(CommandLineOptions options) async {
+    PerformanceTag previous = _analyzeAllTag.makeCurrent();
+    try {
+      return await _analyzeAllImpl(options);
+    } finally {
+      previous.makeCurrent();
+    }
   }
 
   /// Perform analysis according to the given [options].
-  ErrorSeverity _analyzeAllImpl(CommandLineOptions options) {
+  Future<ErrorSeverity> _analyzeAllImpl(CommandLineOptions options) async {
     if (!options.machineFormat) {
       outSink.writeln("Analyzing ${options.sourceFiles}...");
     }
@@ -204,8 +214,15 @@
         }
         sourcesToAnalyze.add(source);
       }
+
+      if (analysisDriver != null) {
+        files.forEach((file) {
+          analysisDriver.addFile(file.path);
+        });
+      } else {
+        context.applyChanges(changeSet);
+      }
     }
-    context.applyChanges(changeSet);
 
     // Analyze the libraries.
     ErrorSeverity allResult = ErrorSeverity.NONE;
@@ -216,7 +233,7 @@
         parts.add(source);
         continue;
       }
-      ErrorSeverity status = _runAnalyzer(source, options);
+      ErrorSeverity status = await _runAnalyzer(source, options);
       allResult = allResult.max(status);
       libUris.add(source.uri);
     }
@@ -343,25 +360,30 @@
   /// Decide on the appropriate method for resolving URIs based on the given
   /// [options] and [customUrlMappings] settings, and return a
   /// [SourceFactory] that has been configured accordingly.
+  /// When [includeSdkResolver] is `false`, return a temporary [SourceFactory]
+  /// for the purpose of resolved analysis options file `include:` directives.
+  /// In this situation, [analysisOptions] is ignored and can be `null`.
   SourceFactory _chooseUriResolutionPolicy(
       CommandLineOptions options,
       Map<file_system.Folder, YamlMap> embedderMap,
       _PackageInfo packageInfo,
-      SummaryDataStore summaryDataStore) {
+      SummaryDataStore summaryDataStore,
+      bool includeSdkResolver,
+      AnalysisOptions analysisOptions) {
     // Create a custom package resolver if one has been specified.
     if (packageResolverProvider != null) {
       file_system.Folder folder = resourceProvider.getResource('.');
       UriResolver resolver = packageResolverProvider(folder);
       if (resolver != null) {
-        UriResolver sdkResolver = new DartUriResolver(sdk);
-
         // TODO(brianwilkerson) This doesn't handle sdk extensions.
-        List<UriResolver> resolvers = <UriResolver>[
-          sdkResolver,
-          new InSummaryUriResolver(resourceProvider, summaryDataStore),
-          resolver,
-          new file_system.ResourceUriResolver(resourceProvider)
-        ];
+        List<UriResolver> resolvers = <UriResolver>[];
+        if (includeSdkResolver) {
+          resolvers.add(new DartUriResolver(sdk));
+        }
+        resolvers
+            .add(new InSummaryUriResolver(resourceProvider, summaryDataStore));
+        resolvers.add(resolver);
+        resolvers.add(new file_system.ResourceUriResolver(resourceProvider));
         return new SourceFactory(resolvers);
       }
     }
@@ -403,16 +425,18 @@
     // 'dart:' URIs come first.
 
     // Setup embedding.
-    EmbedderSdk embedderSdk = new EmbedderSdk(resourceProvider, embedderMap);
-    if (embedderSdk.libraryMap.size() == 0) {
-      // The embedder uri resolver has no mappings. Use the default Dart SDK
-      // uri resolver.
-      resolvers.add(new DartUriResolver(sdk));
-    } else {
-      // The embedder uri resolver has mappings, use it instead of the default
-      // Dart SDK uri resolver.
-      embedderSdk.analysisOptions = _context.analysisOptions;
-      resolvers.add(new DartUriResolver(embedderSdk));
+    if (includeSdkResolver) {
+      EmbedderSdk embedderSdk = new EmbedderSdk(resourceProvider, embedderMap);
+      if (embedderSdk.libraryMap.size() == 0) {
+        // The embedder uri resolver has no mappings. Use the default Dart SDK
+        // uri resolver.
+        resolvers.add(new DartUriResolver(sdk));
+      } else {
+        // The embedder uri resolver has mappings, use it instead of the default
+        // Dart SDK uri resolver.
+        embedderSdk.analysisOptions = analysisOptions;
+        resolvers.add(new DartUriResolver(embedderSdk));
+      }
     }
 
     // Next SdkExts.
@@ -488,16 +512,6 @@
       _analyzedFileCount += _context.sources.length;
     }
 
-    // Create a context.
-    _context = AnalysisEngine.instance.createAnalysisContext();
-
-    AnalyzeFunctionBodiesPredicate dietParsingPolicy =
-        _chooseDietParsingPolicy(options);
-    setAnalysisContextOptions(resourceProvider, _context, options,
-        (AnalysisOptionsImpl contextOptions) {
-      contextOptions.analyzeFunctionBodiesPredicate = dietParsingPolicy;
-    });
-
     // Find package info.
     _PackageInfo packageInfo = _findPackages(options);
 
@@ -520,17 +534,55 @@
     SummaryDataStore summaryDataStore = new SummaryDataStore(
         useSummaries ? options.buildSummaryInputs : <String>[]);
 
+    // Create a temporary source factory without an SDK resolver
+    // for resolving "include:" directives in analysis options files.
+    SourceFactory tempSourceFactory = _chooseUriResolutionPolicy(
+        options, embedderMap, packageInfo, summaryDataStore, false, null);
+
+    AnalysisOptionsImpl analysisOptions =
+        createAnalysisOptions(resourceProvider, tempSourceFactory, options);
+    analysisOptions.analyzeFunctionBodiesPredicate =
+        _chooseDietParsingPolicy(options);
+
     // Once options and embedders are processed, setup the SDK.
-    _setupSdk(options, useSummaries);
+    _setupSdk(options, useSummaries, analysisOptions);
+
+    PackageBundle sdkBundle = sdk.getLinkedBundle();
+    if (sdkBundle != null) {
+      summaryDataStore.addBundle(null, sdkBundle);
+    }
 
     // Choose a package resolution policy and a diet parsing policy based on
     // the command-line options.
-    SourceFactory sourceFactory = _chooseUriResolutionPolicy(
-        options, embedderMap, packageInfo, summaryDataStore);
+    SourceFactory sourceFactory = _chooseUriResolutionPolicy(options,
+        embedderMap, packageInfo, summaryDataStore, true, analysisOptions);
 
+    // Create a context.
+    _context = AnalysisEngine.instance.createAnalysisContext();
+    setupAnalysisContext(_context, options, analysisOptions);
     _context.sourceFactory = sourceFactory;
-    _context.resultProvider =
-        new InputPackagesResultProvider(_context, summaryDataStore);
+
+    if (options.enableNewAnalysisDriver) {
+      PerformanceLog log = new PerformanceLog(null);
+      AnalysisDriverScheduler scheduler = new AnalysisDriverScheduler(log);
+      analysisDriver = new AnalysisDriver(
+          scheduler,
+          log,
+          resourceProvider,
+          analysisDriverByteStore,
+          new FileContentOverlay(),
+          'test',
+          context.sourceFactory,
+          context.analysisOptions);
+      analysisDriver.results.listen((_) {});
+      analysisDriver.exceptions.listen((_) {});
+      scheduler.start();
+    } else {
+      if (sdkBundle != null) {
+        _context.resultProvider =
+            new InputPackagesResultProvider(_context, summaryDataStore);
+      }
+    }
   }
 
   /// Return discovered packagespec, or `null` if none is found.
@@ -615,21 +667,21 @@
   void _processPlugins() {
     List<Plugin> plugins = <Plugin>[];
     plugins.addAll(AnalysisEngine.instance.requiredPlugins);
-    plugins.add(AnalysisEngine.instance.commandLinePlugin);
-    plugins.add(AnalysisEngine.instance.optionsPlugin);
-    plugins.add(linterPlugin);
     plugins.addAll(_userDefinedPlugins);
 
     ExtensionManager manager = new ExtensionManager();
     manager.processPlugins(plugins);
+
+    linter.registerLintRules();
   }
 
   /// Analyze a single source.
-  ErrorSeverity _runAnalyzer(Source source, CommandLineOptions options) {
+  Future<ErrorSeverity> _runAnalyzer(
+      Source source, CommandLineOptions options) async {
     int startTime = currentTimeMillis();
-    AnalyzerImpl analyzer =
-        new AnalyzerImpl(_context, source, options, stats, startTime);
-    var errorSeverity = analyzer.analyzeSync();
+    AnalyzerImpl analyzer = new AnalyzerImpl(_context.analysisOptions, _context,
+        analysisDriver, source, options, stats, startTime);
+    ErrorSeverity errorSeverity = await analyzer.analyze();
     if (errorSeverity == ErrorSeverity.ERROR) {
       io.exitCode = errorSeverity.ordinal;
     }
@@ -639,7 +691,8 @@
     return errorSeverity;
   }
 
-  void _setupSdk(CommandLineOptions options, bool useSummaries) {
+  void _setupSdk(CommandLineOptions options, bool useSummaries,
+      AnalysisOptions analysisOptions) {
     if (sdk == null) {
       if (options.dartSdkSummaryPath != null) {
         sdk = new SummaryBasedDartSdk(
@@ -654,8 +707,7 @@
               sourcePath = path.normalize(sourcePath);
               return !path.isWithin(dartSdkPath, sourcePath);
             });
-
-        dartSdk.analysisOptions = context.analysisOptions;
+        dartSdk.analysisOptions = analysisOptions;
         sdk = dartSdk;
       }
     }
@@ -678,11 +730,34 @@
     return contextOptions;
   }
 
+  static AnalysisOptionsImpl createAnalysisOptions(
+      file_system.ResourceProvider resourceProvider,
+      SourceFactory sourceFactory,
+      CommandLineOptions options) {
+    // Prepare context options.
+    AnalysisOptionsImpl analysisOptions =
+        createAnalysisOptionsForCommandLineOptions(options);
+
+    // Process analysis options file (and notify all interested parties).
+    _processAnalysisOptions(
+        resourceProvider, sourceFactory, analysisOptions, options);
+    return analysisOptions;
+  }
+
   static void setAnalysisContextOptions(
       file_system.ResourceProvider resourceProvider,
+      SourceFactory sourceFactory,
       AnalysisContext context,
       CommandLineOptions options,
       void configureContextOptions(AnalysisOptionsImpl contextOptions)) {
+    AnalysisOptionsImpl analysisOptions =
+        createAnalysisOptions(resourceProvider, sourceFactory, options);
+    configureContextOptions(analysisOptions);
+    setupAnalysisContext(context, options, analysisOptions);
+  }
+
+  static void setupAnalysisContext(AnalysisContext context,
+      CommandLineOptions options, AnalysisOptionsImpl analysisOptions) {
     Map<String, String> definedVariables = options.definedVariables;
     if (definedVariables.isNotEmpty) {
       DeclaredVariables declaredVariables = context.declaredVariables;
@@ -695,16 +770,8 @@
       AnalysisEngine.instance.logger = new StdLogger();
     }
 
-    // Prepare context options.
-    AnalysisOptionsImpl contextOptions =
-        createAnalysisOptionsForCommandLineOptions(options);
-    configureContextOptions(contextOptions);
-
     // Set context options.
-    context.analysisOptions = contextOptions;
-
-    // Process analysis options file (and notify all interested parties).
-    _processAnalysisOptions(resourceProvider, context, options);
+    context.analysisOptions = analysisOptions;
   }
 
   /// Perform a deep comparison of two string lists.
@@ -761,31 +828,25 @@
 
   static void _processAnalysisOptions(
       file_system.ResourceProvider resourceProvider,
-      AnalysisContext context,
+      SourceFactory sourceFactory,
+      AnalysisOptionsImpl analysisOptions,
       CommandLineOptions options) {
     file_system.File file = _getOptionsFile(resourceProvider, options);
-    List<OptionsProcessor> optionsProcessors =
-        AnalysisEngine.instance.optionsPlugin.optionsProcessors;
-    try {
-      AnalysisOptionsProvider analysisOptionsProvider =
-          new AnalysisOptionsProvider();
-      Map<String, YamlNode> optionMap =
-          analysisOptionsProvider.getOptionsFromFile(file);
-      optionsProcessors.forEach(
-          (OptionsProcessor p) => p.optionsProcessed(context, optionMap));
 
-      // Fill in lint rule defaults in case lints are enabled and rules are
-      // not specified in an options file.
-      if (options.lints && !containsLintRuleEntry(optionMap)) {
-        setLints(context, linterPlugin.contributedRules);
-      }
+    AnalysisOptionsProvider analysisOptionsProvider =
+        new AnalysisOptionsProvider(sourceFactory);
+    Map<String, YamlNode> optionMap =
+        analysisOptionsProvider.getOptionsFromFile(file);
 
-      // Ask engine to further process options.
-      if (optionMap != null) {
-        configureContextOptions(context, optionMap);
-      }
-    } on Exception catch (e) {
-      optionsProcessors.forEach((OptionsProcessor p) => p.onError(e));
+    // Fill in lint rule defaults in case lints are enabled and rules are
+    // not specified in an options file.
+    if (options.lints && !containsLintRuleEntry(optionMap)) {
+      analysisOptions.lintRules = Registry.ruleRegistry.defaultRules;
+    }
+
+    // Ask engine to further process options.
+    if (optionMap != null) {
+      applyToAnalysisOptions(analysisOptions, optionMap);
     }
   }
 }
@@ -806,7 +867,7 @@
     // Read line from stdin.
     Stream cmdLine =
         io.stdin.transform(UTF8.decoder).transform(new LineSplitter());
-    cmdLine.listen((String line) {
+    cmdLine.listen((String line) async {
       // Maybe finish.
       if (line.isEmpty) {
         var time = stopwatch.elapsedMilliseconds;
@@ -824,7 +885,7 @@
       // Analyze single set of arguments.
       try {
         totalTests++;
-        ErrorSeverity result = handler(args);
+        ErrorSeverity result = await handler(args);
         bool resultPass = result != ErrorSeverity.ERROR;
         if (!resultPass) {
           testsFailed++;
diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart
index abb3623..7dd9de9 100644
--- a/pkg/analyzer_cli/lib/src/options.dart
+++ b/pkg/analyzer_cli/lib/src/options.dart
@@ -6,6 +6,9 @@
 
 import 'dart:io';
 
+import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/src/command_line/arguments.dart';
+import 'package:analyzer/src/context/builder.dart';
 import 'package:analyzer_cli/src/driver.dart';
 import 'package:args/args.dart';
 import 'package:cli_util/cli_util.dart' show getSdkDir;
@@ -30,8 +33,7 @@
 
 /// Analyzer commandline configuration options.
 class CommandLineOptions {
-  /// The path to an analysis options file
-  final String analysisOptionsFile;
+  final bool enableNewAnalysisDriver = false;
 
   /// The path to output analysis results when in build mode.
   final String buildAnalysisOutput;
@@ -65,15 +67,15 @@
   /// Whether to suppress a nonzero exit code in build mode.
   final bool buildSuppressExitCode;
 
+  /// The options defining the context in which analysis is performed.
+  final ContextBuilderOptions contextBuilderOptions;
+
   /// The path to the dart SDK.
   String dartSdkPath;
 
   /// The path to the dart SDK summary file.
   String dartSdkSummaryPath;
 
-  /// A table mapping the names of defined variables to their values.
-  final Map<String, String> definedVariables;
-
   /// Whether to disable cache flushing.  This option can improve analysis
   /// speed at the expense of memory usage.  It may also be useful for working
   /// around bugs.
@@ -88,13 +90,6 @@
   /// Whether to enable null-aware operators (DEP 9).
   final bool enableNullAwareOperators;
 
-  /// Whether to strictly follow the specification when generating warnings on
-  /// "call" methods (fixes dartbug.com/21938).
-  final bool enableStrictCallChecks;
-
-  /// Whether to relax restrictions on mixins (DEP 34).
-  final bool enableSuperMixins;
-
   /// Whether to treat type mismatches found during constant evaluation as
   /// errors.
   final bool enableTypeChecks;
@@ -114,12 +109,6 @@
   /// Whether to use machine format for error display
   final bool machineFormat;
 
-  /// The path to the package root
-  final String packageRootPath;
-
-  /// The path to a `.packages` configuration file
-  final String packageConfigPath;
-
   /// The path to a file to write a performance log.
   /// (Or null if not enabled.)
   final String perfReport;
@@ -155,8 +144,7 @@
   final bool lintsAreFatal;
 
   /// Initialize options from the given parsed [args].
-  CommandLineOptions._fromArgs(
-      ArgResults args, Map<String, String> definedVariables)
+  CommandLineOptions._fromArgs(ArgResults args)
       : buildAnalysisOutput = args['build-analysis-output'],
         buildMode = args['build-mode'],
         buildModePersistentWorker = args['persistent_worker'],
@@ -168,24 +156,19 @@
         buildSummaryOutput = args['build-summary-output'],
         buildSummaryOutputSemantic = args['build-summary-output-semantic'],
         buildSuppressExitCode = args['build-suppress-exit-code'],
+        contextBuilderOptions = createContextBuilderOptions(args),
         dartSdkPath = args['dart-sdk'],
         dartSdkSummaryPath = args['dart-sdk-summary'],
-        definedVariables = definedVariables,
-        analysisOptionsFile = args['options'],
         disableCacheFlushing = args['disable-cache-flushing'],
         disableHints = args['no-hints'],
         displayVersion = args['version'],
         enableNullAwareOperators = args['enable-null-aware-operators'],
-        enableStrictCallChecks = args['enable-strict-call-checks'],
-        enableSuperMixins = args['supermixin'],
         enableTypeChecks = args['enable_type_checks'],
         hintsAreFatal = args['fatal-hints'],
         ignoreUnrecognizedFlags = args['ignore-unrecognized-flags'],
         lints = args['lints'],
         log = args['log'],
         machineFormat = args['machine'] || args['format'] == 'machine',
-        packageConfigPath = args['packages'],
-        packageRootPath = args['package-root'],
         perfReport = args['x-perf-report'],
         shouldBatch = args['batch'],
         showPackageWarnings = args['show-package-warnings'] ||
@@ -200,6 +183,30 @@
         implicitDynamic = !args['no-implicit-dynamic'],
         lintsAreFatal = args['fatal-lints'];
 
+  /// The path to an analysis options file
+  String get analysisOptionsFile =>
+      contextBuilderOptions.defaultAnalysisOptionsFilePath;
+
+  /// A table mapping the names of defined variables to their values.
+  Map<String, String> get definedVariables =>
+      contextBuilderOptions.declaredVariables;
+
+  /// Whether to strictly follow the specification when generating warnings on
+  /// "call" methods (fixes dartbug.com/21938).
+  bool get enableStrictCallChecks =>
+      contextBuilderOptions.defaultOptions.enableStrictCallChecks;
+
+  /// Whether to relax restrictions on mixins (DEP 34).
+  bool get enableSuperMixins =>
+      contextBuilderOptions.defaultOptions.enableSuperMixins;
+
+  /// The path to a `.packages` configuration file
+  String get packageConfigPath => contextBuilderOptions.defaultPackageFilePath;
+
+  /// The path to the package root
+  String get packageRootPath =>
+      contextBuilderOptions.defaultPackagesDirectoryPath;
+
   /// Parse [args] into [CommandLineOptions] describing the specified
   /// analyzer options. In case of a format error, calls [printAndFail], which
   /// by default prints an error message to stderr and exits.
@@ -273,32 +280,19 @@
   }
 
   static CommandLineOptions _parse(List<String> args) {
-    // Check if the args are in a file (bazel worker mode).
-    if (args.last.startsWith('@')) {
-      var argsFile = new File(args.last.substring(1));
-      args = argsFile.readAsLinesSync();
-    }
+    args = preprocessArgs(PhysicalResourceProvider.INSTANCE, args);
 
-    args = args.expand((String arg) => arg.split('=')).toList();
-    var parser = new CommandLineParser()
+    bool verbose = args.contains('-v') || args.contains('--verbose');
+    bool hide = !verbose;
+
+    var parser = new ArgParser(allowTrailingOptions: true);
+    defineAnalysisArguments(parser, hide: hide);
+    parser
       ..addFlag('batch',
           abbr: 'b',
           help: 'Read commands from standard input (for testing).',
           defaultsTo: false,
           negatable: false)
-      ..addOption('dart-sdk', help: 'The path to the Dart SDK.')
-      ..addOption('dart-sdk-summary',
-          help: 'The path to the Dart SDK summary file.', hide: true)
-      ..addOption('packages',
-          help:
-              'Path to the package resolution configuration file, which supplies '
-              'a mapping of package names to paths.  This option cannot be '
-              'used with --package-root.')
-      ..addOption('package-root',
-          abbr: 'p',
-          help: 'Path to a package root directory (deprecated). This option '
-              'cannot be used with --packages.')
-      ..addOption('options', help: 'Path to an analysis options file.')
       ..addOption('format',
           help: 'Specifies the format in which errors are displayed.')
       ..addFlag('machine',
@@ -316,7 +310,7 @@
           defaultsTo: false,
           negatable: false)
       ..addFlag('disable-cache-flushing', defaultsTo: false, hide: true)
-      ..addFlag('ignore-unrecognized-flags',
+      ..addFlag(ignoreUnrecognizedFlagsFlag,
           help: 'Ignore unrecognized command line flags.',
           defaultsTo: false,
           negatable: false)
@@ -352,9 +346,12 @@
           help: 'Writes a performance report to the given file (experimental).')
       ..addFlag('help',
           abbr: 'h',
-          help: 'Display this help message.',
+          help: 'Display this help message.\n'
+              'Add --verbose to show hidden options.',
           defaultsTo: false,
           negatable: false)
+      ..addFlag('verbose',
+          abbr: 'v', defaultsTo: false, help: 'Verbose output.')
       ..addOption('url-mapping',
           help: '--url-mapping=libraryUri,/path/to/library.dart directs the '
               'analyzer to use "library.dart" as the source for an import '
@@ -368,56 +365,56 @@
           help: 'Enable Bazel persistent worker mode.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addOption('build-analysis-output',
           help:
               'Specifies the path to the file where analysis results should be written.',
-          hide: true)
+          hide: hide)
       ..addFlag('build-mode',
           // TODO(paulberry): add more documentation.
           help: 'Enable build mode.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addOption('build-summary-input',
           help: 'Path to a summary file that contains information from a '
               'previous analysis run.  May be specified multiple times.',
           allowMultiple: true,
-          hide: true)
+          hide: hide)
       ..addOption('build-summary-output',
           help: 'Specifies the path to the file where the full summary '
               'information should be written.',
-          hide: true)
+          hide: hide)
       ..addOption('build-summary-output-semantic',
           help: 'Specifies the path to the file where the semantic summary '
               'information should be written.',
-          hide: true)
+          hide: hide)
       ..addFlag('build-summary-only',
           help: 'Disable analysis (only generate summaries).',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('build-summary-only-ast',
           help: 'deprecated -- Generate summaries using ASTs.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('build-summary-only-diet',
           help: 'Diet parse function bodies.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('build-summary-exclude-informative',
           help: 'Exclude @informative information (docs, offsets, etc).  '
               'Deprecated: please use --build-summary-output-semantic instead.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('build-suppress-exit-code',
           help: 'Exit with code 0 even if errors are found.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       //
       // Hidden flags.
       //
@@ -425,69 +422,47 @@
           help: 'Enable support for the proposed async feature.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('enable-enum',
           help: 'Enable support for the proposed enum feature.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('enable-conditional-directives',
           help:
               'deprecated -- Enable support for conditional directives (DEP 40).',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('enable-null-aware-operators',
           help: 'Enable support for null-aware operators (DEP 9).',
           defaultsTo: false,
           negatable: false,
-          hide: true)
-      ..addFlag('enable-strict-call-checks',
-          help: 'Fix issue 21938.',
-          defaultsTo: false,
-          negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('enable-new-task-model',
           help: 'deprecated -- Ennable new task model.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
-      ..addFlag('initializing-formal-access',
-          help:
-              'Enable support for allowing access to field formal parameters in a constructor\'s initializer list',
-          defaultsTo: false,
-          negatable: false,
-          hide: true)
-      ..addFlag('supermixin',
-          help: 'Relax restrictions on mixins (DEP 34).',
-          defaultsTo: false,
-          negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('log',
           help: 'Log additional messages and exceptions.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
+          hide: hide)
       ..addFlag('enable_type_checks',
           help: 'Check types in constant evaluation.',
           defaultsTo: false,
           negatable: false,
-          hide: true)
-      ..addFlag('strong',
-          help: 'Enable strong static checks (https://goo.gl/DqcBsw)')
-      ..addFlag('no-implicit-casts',
-          negatable: false,
-          help: 'Disable implicit casts in strong mode (https://goo.gl/cTLz40)')
-      ..addFlag('no-implicit-dynamic',
-          negatable: false,
-          help: 'Disable implicit dynamic (https://goo.gl/m0UgXD)');
+          hide: hide);
 
     try {
       // TODO(scheglov) https://code.google.com/p/dart/issues/detail?id=11061
       args =
           args.map((String arg) => arg == '-batch' ? '--batch' : arg).toList();
-      Map<String, String> definedVariables = <String, String>{};
-      var results = parser.parse(args, definedVariables);
+      if (args.contains('--$ignoreUnrecognizedFlagsFlag')) {
+        args = filterUnknownArguments(args, parser);
+      }
+      var results = parser.parse(args);
 
       // Persistent worker.
       if (args.contains('--persistent_worker')) {
@@ -507,7 +482,7 @@
               'option. Got: $args');
           return null; // Only reachable in testing.
         }
-        return new CommandLineOptions._fromArgs(results, definedVariables);
+        return new CommandLineOptions._fromArgs(results);
       }
 
       // Help requests.
@@ -543,7 +518,7 @@
           return null; // Only reachable in testing.
         }
       }
-      return new CommandLineOptions._fromArgs(results, definedVariables);
+      return new CommandLineOptions._fromArgs(results);
     } on FormatException catch (e) {
       errorSink.writeln(e.message);
       _showUsage(parser);
@@ -561,145 +536,3 @@
         'For more information, see http://www.dartlang.org/tools/analyzer.');
   }
 }
-
-/// Commandline argument parser.
-///
-/// TODO(pq): when the args package supports ignoring unrecognized
-/// options/flags, this class can be replaced with a simple [ArgParser]
-/// instance.
-class CommandLineParser {
-  final List<String> _knownFlags;
-  final bool _alwaysIgnoreUnrecognized;
-  final ArgParser _parser;
-
-  /// Creates a new command line parser.
-  CommandLineParser({bool alwaysIgnoreUnrecognized: false})
-      : _knownFlags = <String>[],
-        _alwaysIgnoreUnrecognized = alwaysIgnoreUnrecognized,
-        _parser = new ArgParser(allowTrailingOptions: true);
-
-  ArgParser get parser => _parser;
-
-  /// Defines a flag.
-  /// See [ArgParser.addFlag()].
-  void addFlag(String name,
-      {String abbr,
-      String help,
-      bool defaultsTo: false,
-      bool negatable: true,
-      void callback(bool value),
-      bool hide: false}) {
-    _knownFlags.add(name);
-    _parser.addFlag(name,
-        abbr: abbr,
-        help: help,
-        defaultsTo: defaultsTo,
-        negatable: negatable,
-        callback: callback,
-        hide: hide);
-  }
-
-  /// Defines a value-taking option.
-  /// See [ArgParser.addOption()].
-  void addOption(String name,
-      {String abbr,
-      String help,
-      List<String> allowed,
-      Map<String, String> allowedHelp,
-      String defaultsTo,
-      void callback(value),
-      bool allowMultiple: false,
-      bool splitCommas,
-      bool hide: false}) {
-    _knownFlags.add(name);
-    _parser.addOption(name,
-        abbr: abbr,
-        help: help,
-        allowed: allowed,
-        allowedHelp: allowedHelp,
-        defaultsTo: defaultsTo,
-        callback: callback,
-        allowMultiple: allowMultiple,
-        splitCommas: splitCommas,
-        hide: hide);
-  }
-
-  /// Generates a string displaying usage information for the defined options.
-  /// See [ArgParser.usage].
-  String getUsage() => _parser.usage;
-
-  /// Parses [args], a list of command-line arguments, matches them against the
-  /// flags and options defined by this parser, and returns the result. The
-  /// values of any defined variables are captured in the given map.
-  /// See [ArgParser].
-  ArgResults parse(List<String> args, Map<String, String> definedVariables) =>
-      _parser.parse(
-          _filterUnknowns(parseDefinedVariables(args, definedVariables)));
-
-  List<String> parseDefinedVariables(
-      List<String> args, Map<String, String> definedVariables) {
-    int count = args.length;
-    List<String> remainingArgs = <String>[];
-    for (int i = 0; i < count; i++) {
-      String arg = args[i];
-      if (arg == '--') {
-        while (i < count) {
-          remainingArgs.add(args[i++]);
-        }
-      } else if (arg.startsWith("-D")) {
-        definedVariables[arg.substring(2)] = args[++i];
-      } else {
-        remainingArgs.add(arg);
-      }
-    }
-    return remainingArgs;
-  }
-
-  List<String> _filterUnknowns(List<String> args) {
-    // Only filter args if the ignore flag is specified, or if
-    // _alwaysIgnoreUnrecognized was set to true.
-    if (_alwaysIgnoreUnrecognized ||
-        args.contains('--ignore-unrecognized-flags')) {
-      //TODO(pquitslund): replace w/ the following once library skew issues are
-      // sorted out
-      //return args.where((arg) => !arg.startsWith('--') ||
-      //  _knownFlags.contains(arg.substring(2)));
-
-      // Filter all unrecognized flags and options.
-      List<String> filtered = <String>[];
-      for (int i = 0; i < args.length; ++i) {
-        String arg = args[i];
-        if (arg.startsWith('--') && arg.length > 2) {
-          String option = arg.substring(2);
-          // strip the last '=value'
-          int equalsOffset = option.lastIndexOf('=');
-          if (equalsOffset != -1) {
-            option = option.substring(0, equalsOffset);
-          }
-          // Check the option
-          if (!_knownFlags.contains(option)) {
-            //"eat" params by advancing to the next flag/option
-            i = _getNextFlagIndex(args, i);
-          } else {
-            filtered.add(arg);
-          }
-        } else {
-          filtered.add(arg);
-        }
-      }
-
-      return filtered;
-    } else {
-      return args;
-    }
-  }
-
-  int _getNextFlagIndex(args, i) {
-    for (; i < args.length; ++i) {
-      if (args[i].startsWith('--')) {
-        return i;
-      }
-    }
-    return i;
-  }
-}
diff --git a/pkg/analyzer_cli/lib/src/plugin/plugin_manager.dart b/pkg/analyzer_cli/lib/src/plugin/plugin_manager.dart
deleted file mode 100644
index 7c819fd..0000000
--- a/pkg/analyzer_cli/lib/src/plugin/plugin_manager.dart
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analyzer_cli.src.plugin.plugin_manager;
-
-import 'dart:io';
-
-import 'package:analyzer/src/plugin/plugin_configuration.dart';
-import 'package:path/path.dart' as path;
-
-const _manifestFileName = 'plugins.yaml';
-
-/// Given a local configuration (as defined in an analysis options file) and
-/// information from a plugin manifest, return plugin info appropriate for
-/// configuring this plugin.
-PluginInfo combine(PluginInfo localConfig, PluginInfo manifestInfo) {
-  return new PluginInfo(
-      name: localConfig.name,
-      version: manifestInfo.version,
-      className: manifestInfo.className,
-      libraryUri: manifestInfo.libraryUri);
-}
-
-/// Call-back to allow for the injection of manifest readers that do not need
-/// to go to disk (for testing purposes).
-typedef String ManifestReader(Uri uri);
-
-/// Wraps a [plugin] info object elaborated with any configuration information
-/// extracted from an associated manifest and [status].
-class PluginDetails {
-  /// Plugin status.
-  final PluginStatus status;
-
-  /// Plugin info.
-  final PluginInfo plugin;
-
-  /// Wrap a [plugin] with [status] info.
-  PluginDetails(this.plugin) : status = PluginStatus.Applicable;
-  PluginDetails.notApplicable(this.plugin)
-      : status = PluginStatus.NotApplicable;
-  PluginDetails.notFound(this.plugin) : status = PluginStatus.NotFound;
-}
-
-/// Manages plugin information derived from plugin manifests.
-class PluginManager {
-  /// Mapping from package name to package location.
-  final Map<String, Uri> _packageMap;
-
-  /// The package naming the app to host plugins.
-  final String hostPackage;
-
-  /// Function to perform the reading of manifest URIs. (For testing.)
-  ManifestReader _manifestReader;
-
-  /// Create a plugin manager with backing package map information.
-  PluginManager(this._packageMap, this.hostPackage,
-      [ManifestReader manifestReader]) {
-    _manifestReader =
-        manifestReader != null ? manifestReader : _findAndReadManifestAtUri;
-  }
-
-  /// Find a plugin manifest describing the given [pluginPackage].
-  PluginManifest findManifest(String pluginPackage) {
-    Uri uri = _packageMap[pluginPackage];
-    String contents = _manifestReader(uri);
-    if (contents == null) {
-      return null;
-    }
-    return parsePluginManifestString(contents);
-  }
-
-  /// Return [PluginDetails] derived from associated plugin manifests
-  /// corresponding to plugins specified in the given [config].
-  Iterable<PluginDetails> getPluginDetails(PluginConfig config) =>
-      config.plugins.map((PluginInfo localConfig) {
-        PluginManifest manifest = findManifest(localConfig.name);
-        return _getDetails(localConfig, manifest);
-      });
-
-  String _findAndReadManifestAtUri(Uri uri) {
-    File manifestFile = _findManifest(uri);
-    return manifestFile?.readAsStringSync();
-  }
-
-  File _findManifest(Uri uri) {
-    if (uri == null) {
-      return null;
-    }
-
-    Directory directory = new Directory.fromUri(uri);
-    File file = new File(path.join(directory.path, _manifestFileName));
-
-    return file.existsSync() ? file : null;
-  }
-
-  PluginDetails _getDetails(PluginInfo localConfig, PluginManifest manifest) {
-    if (manifest == null) {
-      return new PluginDetails.notFound(localConfig);
-    }
-    if (!manifest.contributesTo.contains(hostPackage)) {
-      return new PluginDetails.notApplicable(localConfig);
-    }
-
-    return new PluginDetails(combine(localConfig, manifest.plugin));
-  }
-}
-
-/// Describes plugin status.
-enum PluginStatus { Applicable, NotApplicable, NotFound }
diff --git a/pkg/analyzer_cli/test/all.dart b/pkg/analyzer_cli/test/all.dart
index 5764922..86d6d75 100644
--- a/pkg/analyzer_cli/test/all.dart
+++ b/pkg/analyzer_cli/test/all.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.
 
-import 'boot_loader_test.dart' as boot_loader;
 import 'build_mode_test.dart' as build_mode_test;
 import 'driver_test.dart' as driver;
 import 'embedder_test.dart' as embedder;
@@ -10,14 +9,12 @@
 import 'options_test.dart' as options;
 import 'package_prefix_test.dart' as package_prefix;
 import 'perf_report_test.dart' as perf;
-import 'plugin_manager_test.dart' as plugin_manager;
 import 'reporter_test.dart' as reporter;
 import 'sdk_ext_test.dart' as sdk_ext;
 import 'super_mixin_test.dart' as super_mixin;
 //import 'strong_mode_test.dart' as strong_mode;
 
 main() {
-  boot_loader.main();
   build_mode_test.main();
   driver.main();
   embedder.main();
@@ -28,7 +25,6 @@
   error.main();
   options.main();
   perf.main();
-  plugin_manager.main();
   reporter.main();
   super_mixin.main();
   package_prefix.main();
diff --git a/pkg/analyzer_cli/test/boot_loader_test.dart b/pkg/analyzer_cli/test/boot_loader_test.dart
deleted file mode 100644
index 30223fb..0000000
--- a/pkg/analyzer_cli/test/boot_loader_test.dart
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analyzer_cli.test.boot_loader_test;
-
-import 'dart:io';
-
-import 'package:analyzer/src/plugin/plugin_configuration.dart';
-import 'package:analyzer_cli/src/boot_loader.dart';
-import 'package:analyzer_cli/src/driver.dart';
-import 'package:analyzer_cli/src/options.dart';
-import 'package:path/path.dart' as path;
-import 'package:test/test.dart';
-
-import 'utils.dart';
-
-main() {
-  StringSink savedOutSink, savedErrorSink;
-  int savedExitCode;
-  ExitHandler savedExitHandler;
-
-  /// Base setup.
-  _setUp() {
-    savedOutSink = outSink;
-    savedErrorSink = errorSink;
-    savedExitHandler = exitHandler;
-    savedExitCode = exitCode;
-    exitHandler = (code) => exitCode = code;
-    outSink = new StringBuffer();
-    errorSink = new StringBuffer();
-  }
-
-  /// Base teardown.
-  _tearDown() {
-    outSink = savedOutSink;
-    errorSink = savedErrorSink;
-    exitCode = savedExitCode;
-    exitHandler = savedExitHandler;
-  }
-
-  setUp(() => _setUp());
-
-  tearDown(() => _tearDown());
-
-  group('Bootloader', () {
-    group('plugin processing', () {
-      test('bad format', () {
-        BootLoader loader = new BootLoader();
-        loader.createImage([
-          '--options',
-          path.join(testDirectory, 'data/bad_plugin_options.yaml'),
-          path.join(testDirectory, 'data/test_file.dart')
-        ]);
-        expect(
-            errorSink.toString(),
-            'Plugin configuration skipped: Unrecognized plugin config '
-            'format, expected `YamlMap`, got `YamlList` '
-            '(line 2, column 4)\n');
-      });
-      test('plugin config', () {
-        BootLoader loader = new BootLoader();
-        Image image = loader.createImage([
-          '--options',
-          path.join(testDirectory, 'data/plugin_options.yaml'),
-          path.join(testDirectory, 'data/test_file.dart')
-        ]);
-        var plugins = image.config.plugins;
-        expect(plugins, hasLength(1));
-        expect(plugins.first.name, 'my_plugin1');
-      });
-      group('plugin validation', () {
-        test('requires class name', () {
-          expect(
-              validate(new PluginInfo(
-                  name: 'test_plugin', libraryUri: 'my_package/foo.dart')),
-              isNotNull);
-        });
-        test('requires library URI', () {
-          expect(
-              validate(
-                  new PluginInfo(name: 'test_plugin', className: 'MyPlugin')),
-              isNotNull);
-        });
-        test('check', () {
-          expect(
-              validate(new PluginInfo(
-                  name: 'test_plugin',
-                  className: 'MyPlugin',
-                  libraryUri: 'my_package/foo.dart')),
-              isNull);
-        });
-      });
-    });
-  });
-}
diff --git a/pkg/analyzer_cli/test/data/options_include_directive_tests_project/.analysis_options b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/.analysis_options
new file mode 100644
index 0000000..7d95424
--- /dev/null
+++ b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/.analysis_options
@@ -0,0 +1 @@
+include: other_options.yaml
diff --git a/pkg/analyzer_cli/test/data/options_include_directive_tests_project/_packages b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/_packages
new file mode 100644
index 0000000..574bcbd
--- /dev/null
+++ b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/_packages
@@ -0,0 +1,3 @@
+# Generated by pub on 2016-11-30 13:02:00.280796.
+foo:pkg/foo/lib/
+options_include_directive_tests_project:lib/
diff --git a/pkg/analyzer_cli/test/data/options_include_directive_tests_project/lib/test_file.dart b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/lib/test_file.dart
new file mode 100644
index 0000000..c53a7e0
--- /dev/null
+++ b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/lib/test_file.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library analyzer_cli.test.data.options_include_directive_test_project.test_file;
+
+
+int foo() {
+
+  int x = baz(); // Undefined function.
+  if (x == 0) {
+    print('x is zero');
+  } else ; // Empty else statement
+
+  // Missing return
+}
diff --git a/pkg/analyzer_cli/test/data/options_include_directive_tests_project/other_options.yaml b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/other_options.yaml
new file mode 100644
index 0000000..c27dd4a
--- /dev/null
+++ b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/other_options.yaml
@@ -0,0 +1 @@
+include: package:foo/foo_package_options.yaml
diff --git a/pkg/analyzer_cli/test/data/options_include_directive_tests_project/pkg/foo/lib/foo_package_options.yaml b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/pkg/foo/lib/foo_package_options.yaml
new file mode 100644
index 0000000..89c0bf6a
--- /dev/null
+++ b/pkg/analyzer_cli/test/data/options_include_directive_tests_project/pkg/foo/lib/foo_package_options.yaml
@@ -0,0 +1,13 @@
+analyzer:
+  strong-mode: true
+  errors:
+    unused_local_variable: ignore
+    missing_return: error
+    undefined_function: warning
+  language:
+    enableSuperMixins: true
+
+linter:
+ rules:
+   # see catalog here: http://dart-lang.github.io/linter/lints/
+   - avoid_empty_else
diff --git a/pkg/analyzer_cli/test/data/strong_sdk/main.dart b/pkg/analyzer_cli/test/data/strong_sdk/main.dart
new file mode 100644
index 0000000..34b0c4c
--- /dev/null
+++ b/pkg/analyzer_cli/test/data/strong_sdk/main.dart
@@ -0,0 +1,7 @@
+import 'dart:js';
+
+typedef dynamic Func(String x, String y);
+
+Func bar(Func f) {
+  return allowInterop(f);
+}
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index 222d96d..0a379c4 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -4,10 +4,10 @@
 
 library analyzer_cli.test.driver;
 
+import 'dart:async';
 import 'dart:io';
 
 import 'package:analyzer/error/error.dart';
-import 'package:analyzer/plugin/options.dart';
 import 'package:analyzer/source/analysis_options_provider.dart';
 import 'package:analyzer/source/error_processor.dart';
 import 'package:analyzer/src/error/codes.dart';
@@ -17,7 +17,6 @@
 import 'package:analyzer_cli/src/driver.dart';
 import 'package:analyzer_cli/src/options.dart';
 import 'package:path/path.dart' as path;
-import 'package:plugin/plugin.dart';
 import 'package:test/test.dart';
 import 'package:yaml/src/yaml_node.dart';
 
@@ -53,77 +52,65 @@
 
   group('Driver', () {
     group('options', () {
-      test('custom processor', () {
-        Driver driver = new Driver();
-        TestProcessor processor = new TestProcessor();
-        driver.userDefinedPlugins = [new TestPlugin(processor)];
-        driver.start([
-          '--options',
-          path.join(testDirectory, 'data/test_options.yaml'),
-          path.join(testDirectory, 'data/test_file.dart')
-        ]);
-        expect(processor.options['test_plugin'], isNotNull);
-        expect(processor.exception, isNull);
-      });
-      test('todos', () {
-        drive('data/file_with_todo.dart');
+      test('todos', () async {
+        await drive('data/file_with_todo.dart');
         expect(outSink.toString().contains('[info]'), isFalse);
       });
     });
 
     group('exit codes', () {
-      test('fatal hints', () {
-        drive('data/file_with_hint.dart', args: ['--fatal-hints']);
+      test('fatal hints', () async {
+        await drive('data/file_with_hint.dart', args: ['--fatal-hints']);
         expect(exitCode, 3);
       });
 
-      test('not fatal hints', () {
-        drive('data/file_with_hint.dart');
+      test('not fatal hints', () async {
+        await drive('data/file_with_hint.dart');
         expect(exitCode, 0);
       });
 
-      test('fatal errors', () {
-        drive('data/file_with_error.dart');
+      test('fatal errors', () async {
+        await drive('data/file_with_error.dart');
         expect(exitCode, 3);
       });
 
-      test('not fatal warnings', () {
-        drive('data/file_with_warning.dart');
+      test('not fatal warnings', () async {
+        await drive('data/file_with_warning.dart');
         expect(exitCode, 0);
       });
 
-      test('fatal warnings', () {
-        drive('data/file_with_warning.dart', args: ['--fatal-warnings']);
+      test('fatal warnings', () async {
+        await drive('data/file_with_warning.dart', args: ['--fatal-warnings']);
         expect(exitCode, 3);
       });
 
-      test('missing options file', () {
-        drive('data/test_file.dart', options: 'data/NO_OPTIONS_HERE');
+      test('missing options file', () async {
+        await drive('data/test_file.dart', options: 'data/NO_OPTIONS_HERE');
         expect(exitCode, 3);
       });
 
-      test('missing dart file', () {
-        drive('data/NO_DART_FILE_HERE.dart');
+      test('missing dart file', () async {
+        await drive('data/NO_DART_FILE_HERE.dart');
         expect(exitCode, 3);
       });
 
-      test('part file', () {
-        drive('data/library_and_parts/part2.dart');
+      test('part file', () async {
+        await drive('data/library_and_parts/part2.dart');
         expect(exitCode, 3);
       });
 
-      test('non-dangling part file', () {
+      test('non-dangling part file', () async {
         Driver driver = new Driver();
-        driver.start([
+        await driver.start([
           path.join(testDirectory, 'data/library_and_parts/lib.dart'),
           path.join(testDirectory, 'data/library_and_parts/part1.dart')
         ]);
         expect(exitCode, 0);
       });
 
-      test('extra part file', () {
+      test('extra part file', () async {
         Driver driver = new Driver();
-        driver.start([
+        await driver.start([
           path.join(testDirectory, 'data/library_and_parts/lib.dart'),
           path.join(testDirectory, 'data/library_and_parts/part1.dart'),
           path.join(testDirectory, 'data/library_and_parts/part2.dart')
@@ -136,12 +123,14 @@
       void createTests(String designator, String optionsFileName) {
         group('lints in options - $designator', () {
           // Shared lint command.
-          void runLinter() => drive('data/linter_project/test_file.dart',
-              options: 'data/linter_project/$optionsFileName',
-              args: ['--lints']);
+          Future<Null> runLinter() async {
+            return await drive('data/linter_project/test_file.dart',
+                options: 'data/linter_project/$optionsFileName',
+                args: ['--lints']);
+          }
 
-          test('gets analysis options', () {
-            runLinter();
+          test('gets analysis options', () async {
+            await runLinter();
 
             /// Lints should be enabled.
             expect(driver.context.analysisOptions.lint, isTrue);
@@ -151,8 +140,8 @@
             expect(lintNames, orderedEquals(['camel_case_types']));
           });
 
-          test('generates lints', () {
-            runLinter();
+          test('generates lints', () async {
+            await runLinter();
             expect(outSink.toString(),
                 contains('[lint] Name types using UpperCamelCase.'));
           });
@@ -160,12 +149,14 @@
 
         group('default lints - $designator', () {
           // Shared lint command.
-          void runLinter() => drive('data/linter_project/test_file.dart',
-              options: 'data/linter_project/$optionsFileName',
-              args: ['--lints']);
+          Future<Null> runLinter() async {
+            return await drive('data/linter_project/test_file.dart',
+                options: 'data/linter_project/$optionsFileName',
+                args: ['--lints']);
+          }
 
-          test('gets default lints', () {
-            runLinter();
+          test('gets default lints', () async {
+            await runLinter();
 
             /// Lints should be enabled.
             expect(driver.context.analysisOptions.lint, isTrue);
@@ -175,8 +166,8 @@
             expect(lintNames, contains('camel_case_types'));
           });
 
-          test('generates lints', () {
-            runLinter();
+          test('generates lints', () async {
+            await runLinter();
             expect(outSink.toString(),
                 contains('[lint] Name types using UpperCamelCase.'));
           });
@@ -184,21 +175,23 @@
 
         group('no `--lints` flag (none in options) - $designator', () {
           // Shared lint command.
-          void runLinter() => drive('data/no_lints_project/test_file.dart',
-              options: 'data/no_lints_project/$optionsFileName');
+          Future<Null> runLinter() async {
+            return await drive('data/no_lints_project/test_file.dart',
+                options: 'data/no_lints_project/$optionsFileName');
+          }
 
-          test('lints disabled', () {
-            runLinter();
+          test('lints disabled', () async {
+            await runLinter();
             expect(driver.context.analysisOptions.lint, isFalse);
           });
 
-          test('no registered lints', () {
-            runLinter();
+          test('no registered lints', () async {
+            await runLinter();
             expect(getLints(driver.context), isEmpty);
           });
 
-          test('no generated warnings', () {
-            runLinter();
+          test('no generated warnings', () async {
+            await runLinter();
             expect(outSink.toString(), contains('No issues found'));
           });
         });
@@ -237,11 +230,13 @@
       void createTests(String designator, String optionsFileName) {
         group('basic config - $designator', () {
           // Shared driver command.
-          void doDrive() => drive('data/options_tests_project/test_file.dart',
-              options: 'data/options_tests_project/$optionsFileName');
+          Future<Null> doDrive() async {
+            await drive('data/options_tests_project/test_file.dart',
+                options: 'data/options_tests_project/$optionsFileName');
+          }
 
-          test('filters', () {
-            doDrive();
+          test('filters', () async {
+            await doDrive();
             expect(processors, hasLength(3));
 
             // unused_local_variable: ignore
@@ -265,13 +260,13 @@
                 outSink.toString(), contains("1 error and 1 warning found."));
           });
 
-          test('language', () {
-            doDrive();
+          test('language', () async {
+            await doDrive();
             expect(driver.context.analysisOptions.enableSuperMixins, isTrue);
           });
 
-          test('strongMode', () {
-            doDrive();
+          test('strongMode', () async {
+            await doDrive();
             expect(driver.context.analysisOptions.strongMode, isTrue);
             //https://github.com/dart-lang/sdk/issues/26129
             AnalysisContext sdkContext =
@@ -282,12 +277,14 @@
 
         group('with flags - $designator', () {
           // Shared driver command.
-          void doDrive() => drive('data/options_tests_project/test_file.dart',
-              args: ['--fatal-warnings'],
-              options: 'data/options_tests_project/$optionsFileName');
+          Future<Null> doDrive() async {
+            await drive('data/options_tests_project/test_file.dart',
+                args: ['--fatal-warnings'],
+                options: 'data/options_tests_project/$optionsFileName');
+          }
 
-          test('override fatal warning', () {
-            doDrive();
+          test('override fatal warning', () async {
+            await doDrive();
             // missing_return: error
             var undefined_function = new AnalysisError(new TestSource(), 0, 1,
                 StaticTypeWarningCode.UNDEFINED_FUNCTION, [
@@ -306,13 +303,41 @@
 
       createTests('old', AnalysisEngine.ANALYSIS_OPTIONS_FILE);
       createTests('new', AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
+
+      test('include directive', () async {
+        String testDir = path.join(
+            testDirectory, 'data', 'options_include_directive_tests_project');
+        await drive(
+          path.join(testDir, 'lib', 'test_file.dart'),
+          args: [
+            '--fatal-warnings',
+            '--packages',
+            path.join(testDir, '_packages'),
+          ],
+          options: path.join(testDir, '.analysis_options'),
+        );
+        expect(exitCode, 3);
+        expect(outSink.toString(),
+            contains('but doesn\'t end with a return statement.'));
+        expect(outSink.toString(), contains('isn\'t defined'));
+        expect(outSink.toString(), contains('Avoid empty else statements.'));
+      });
+
+      test('test strong SDK', () async {
+        String testDir = path.join(testDirectory, 'data', 'strong_sdk');
+        await drive(path.join(testDir, 'main.dart'), args: ['--strong']);
+        expect(driver.context.analysisOptions.strongMode, isTrue);
+        expect(outSink.toString(), contains('No issues found'));
+        expect(exitCode, 0);
+      });
     });
 
     void createTests(String designator, String optionsFileName) {
       group('build-mode - $designator', () {
         // Shared driver command.
-        void doDrive(String filePath, {List<String> additionalArgs: const []}) {
-          drive('file:///test_file.dart|$filePath',
+        Future<Null> doDrive(String filePath,
+            {List<String> additionalArgs: const []}) async {
+          await drive('file:///test_file.dart|$filePath',
               args: [
                 '--dart-sdk',
                 findSdkDirForSummaries(),
@@ -322,8 +347,8 @@
               options: 'data/options_tests_project/$optionsFileName');
         }
 
-        test('no stats', () {
-          doDrive('data/test_file.dart');
+        test('no stats', () async {
+          await doDrive('data/test_file.dart');
           // Should not print stat summary.
           expect(outSink.toString(), isEmpty);
           expect(errorSink.toString(), isEmpty);
@@ -332,21 +357,21 @@
 
         test(
             'Fails if file not found, even when --build-suppress-exit-code is given',
-            () {
-          doDrive('data/non_existent_file.dart',
+            () async {
+          await doDrive('data/non_existent_file.dart',
               additionalArgs: ['--build-suppress-exit-code']);
           expect(exitCode, isNot(0));
         });
 
-        test('Fails if there are errors', () {
-          doDrive('data/file_with_error.dart');
+        test('Fails if there are errors', () async {
+          await doDrive('data/file_with_error.dart');
           expect(exitCode, isNot(0));
         });
 
         test(
             'Succeeds if there are errors, when --build-suppress-exit-code is given',
-            () {
-          doDrive('data/file_with_error.dart',
+            () async {
+          await doDrive('data/file_with_error.dart',
               additionalArgs: ['--build-suppress-exit-code']);
           expect(exitCode, 0);
         });
@@ -441,15 +466,16 @@
 /// [args] and an [options] file path.  The value of [options] defaults to
 /// an empty options file to avoid unwanted configuration from an otherwise
 /// discovered options file.
-void drive(String source,
-    {String options: emptyOptionsFile, List<String> args: const <String>[]}) {
+Future<Null> drive(String source,
+    {String options: emptyOptionsFile,
+    List<String> args: const <String>[]}) async {
   driver = new Driver();
   var cmd = [
     '--options',
     path.join(testDirectory, options),
     adjustFileSpec(source)
   ]..addAll(args);
-  driver.start(cmd);
+  await driver.start(cmd);
 }
 
 /// Try to find a appropriate directory to pass to "--dart-sdk" that will
@@ -502,39 +528,6 @@
 ErrorProcessor processorFor(AnalysisError error) =>
     processors.firstWhere((p) => p.appliesTo(error));
 
-class TestPlugin extends Plugin {
-  TestProcessor processor;
-  TestPlugin(this.processor);
-
-  @override
-  String get uniqueIdentifier => 'test_plugin.core';
-
-  @override
-  void registerExtensionPoints(RegisterExtensionPoint register) {
-    // None
-  }
-
-  @override
-  void registerExtensions(RegisterExtension register) {
-    register(OPTIONS_PROCESSOR_EXTENSION_POINT_ID, processor);
-  }
-}
-
-class TestProcessor extends OptionsProcessor {
-  Map<String, Object> options;
-  Exception exception;
-
-  @override
-  void onError(Exception exception) {
-    this.exception = exception;
-  }
-
-  @override
-  void optionsProcessed(AnalysisContext context, Map<String, Object> options) {
-    this.options = options;
-  }
-}
-
 class TestSource implements Source {
   TestSource();
 
diff --git a/pkg/analyzer_cli/test/embedder_test.dart b/pkg/analyzer_cli/test/embedder_test.dart
index c1c544c..37b1d767 100644
--- a/pkg/analyzer_cli/test/embedder_test.dart
+++ b/pkg/analyzer_cli/test/embedder_test.dart
@@ -24,15 +24,16 @@
       outSink = new StringBuffer();
       errorSink = new StringBuffer();
     });
+
     tearDown(() {
       outSink = savedOutSink;
       errorSink = savedErrorSink;
       exitCode = savedExitCode;
     });
 
-    test('resolution', wrap(() {
+    test('resolution', wrap(() async {
       var testDir = path.join(testDirectory, 'data', 'embedder_client');
-      new Driver().start([
+      await new Driver().start([
         '--packages',
         path.join(testDir, '_packages'),
         path.join(testDir, 'embedder_yaml_user.dart')
@@ -42,10 +43,10 @@
       expect(outSink.toString(), contains('No issues found'));
     }));
 
-    test('sdk setup', wrap(() {
+    test('sdk setup', wrap(() async {
       var testDir = path.join(testDirectory, 'data', 'embedder_client');
       Driver driver = new Driver();
-      driver.start([
+      await driver.start([
         '--packages',
         path.join(testDir, '_packages'),
         path.join(testDir, 'embedder_yaml_user.dart')
@@ -60,9 +61,9 @@
 
 /// Wrap a function call to dump stdout and stderr in case of an exception.
 Function wrap(Function f) {
-  return () {
+  return () async {
     try {
-      f();
+      await f();
     } catch (e) {
       if (outSink.toString().isNotEmpty) {
         print('stdout:');
@@ -72,7 +73,7 @@
         print('stderr:');
         print(errorSink);
       }
-      throw e;
+      rethrow;
     }
   };
 }
diff --git a/pkg/analyzer_cli/test/options_test.dart b/pkg/analyzer_cli/test/options_test.dart
index f30a6e4..c0ca301 100644
--- a/pkg/analyzer_cli/test/options_test.dart
+++ b/pkg/analyzer_cli/test/options_test.dart
@@ -8,7 +8,6 @@
 
 import 'package:analyzer_cli/src/driver.dart';
 import 'package:analyzer_cli/src/options.dart';
-import 'package:args/args.dart';
 import 'package:test/test.dart';
 import 'package:test_reflective_loader/test_reflective_loader.dart';
 
@@ -152,13 +151,6 @@
         expect(options.warningsAreFatal, isTrue);
       });
 
-      test('notice unrecognized flags', () {
-        expect(
-            () => new CommandLineParser()
-                .parse(['--bar', '--baz', 'foo.dart'], {}),
-            throwsA(new isInstanceOf<FormatException>()));
-      });
-
       test('ignore unrecognized flags', () {
         CommandLineOptions options = CommandLineOptions.parse([
           '--ignore-unrecognized-flags',
@@ -172,17 +164,6 @@
         expect(options.sourceFiles, equals(['foo.dart']));
       });
 
-      test('ignore unrecognized options', () {
-        CommandLineParser parser =
-            new CommandLineParser(alwaysIgnoreUnrecognized: true);
-        parser.addOption('optionA');
-        parser.addFlag('flagA');
-        ArgResults argResults =
-            parser.parse(['--optionA=1', '--optionB=2', '--flagA'], {});
-        expect(argResults['optionA'], '1');
-        expect(argResults['flagA'], isTrue);
-      });
-
       test('strong mode', () {
         CommandLineOptions options =
             CommandLineOptions.parse(['--strong', 'foo.dart']);
diff --git a/pkg/analyzer_cli/test/package_prefix_test.dart b/pkg/analyzer_cli/test/package_prefix_test.dart
index 1a3f9b0..4bda02e 100644
--- a/pkg/analyzer_cli/test/package_prefix_test.dart
+++ b/pkg/analyzer_cli/test/package_prefix_test.dart
@@ -1,3 +1,4 @@
+import 'dart:async';
 import 'dart:io' show exitCode;
 
 import 'package:analyzer_cli/src/driver.dart' show Driver, outSink, errorSink;
@@ -20,8 +21,8 @@
       runner = null;
     });
 
-    test('shows only the hint whose package matches the prefix', () {
-      runner.run([
+    test('shows only the hint whose package matches the prefix', () async {
+      await runner.run2([
         "--packages",
         join(testDirectory, 'data', 'package_prefix', 'packagelist'),
         "--x-package-warnings-prefix=f",
@@ -58,8 +59,9 @@
   String get stderr => _stderr.toString();
 
   String get stdout => _stdout.toString();
-  void run(List<String> args) {
-    new Driver().start(args);
+
+  Future<Null> run2(List<String> args) async {
+    await new Driver().start(args);
     if (stderr.isNotEmpty) {
       fail("Unexpected output to stderr:\n$stderr");
     }
diff --git a/pkg/analyzer_cli/test/plugin_manager_test.dart b/pkg/analyzer_cli/test/plugin_manager_test.dart
deleted file mode 100644
index e257300..0000000
--- a/pkg/analyzer_cli/test/plugin_manager_test.dart
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library analyzer_cli.test.plugin_manager_test;
-
-import 'package:analyzer/src/plugin/plugin_configuration.dart';
-import 'package:analyzer_cli/src/plugin/plugin_manager.dart';
-import 'package:test/test.dart';
-
-main() {
-  group('plugin manager tests', () {
-    test('combine plugin info', () {
-      PluginInfo localInfo = new PluginInfo(name: 'my_plugin');
-      PluginInfo manifestInfo = new PluginInfo(
-          className: 'MyPlugin', libraryUri: 'my_plugin/my_plugin.dart');
-
-      PluginInfo merged = combine(localInfo, manifestInfo);
-      expect(merged.name, equals('my_plugin'));
-      expect(merged.className, equals('MyPlugin'));
-      expect(merged.libraryUri, equals('my_plugin/my_plugin.dart'));
-    });
-
-    test('find manifest', () {
-      const manifestSrc = '''
-library_uri: 'my_plugin/my_plugin.dart'
-''';
-      var packageMap = {'my_plugin': new Uri.file('my_plugin')};
-
-      PluginManager pm =
-          new PluginManager(packageMap, 'analyzer', (Uri uri) => manifestSrc);
-
-      PluginManifest manifest = pm.findManifest('my_plugin');
-      expect(manifest, isNotNull);
-      expect(manifest.plugin.libraryUri, equals('my_plugin/my_plugin.dart'));
-    });
-
-    final plugin1Uri = new Uri.file('my_plugin1');
-    final plugin2Uri = new Uri.file('my_plugin2');
-    final plugin3Uri = new Uri.file('my_plugin3');
-
-    const serverPluginManifest = '''
-library_uri: 'my_plugin2/my_plugin2.dart'
-contributes_to: analysis_server
-''';
-    const analyzerPluginManifest = '''
-library_uri: 'my_plugin3/my_plugin3.dart'
-contributes_to: analyzer
-''';
-
-    var packageMap = {
-      'my_plugin': plugin1Uri,
-      'my_plugin2': plugin2Uri,
-      'my_plugin3': plugin3Uri
-    };
-
-    var manifestReader = (Uri uri) {
-      if (uri == plugin2Uri) return serverPluginManifest;
-      if (uri == plugin3Uri) return analyzerPluginManifest;
-      return null;
-    };
-
-    test('get plugin details', () {
-      PluginManager pm =
-          new PluginManager(packageMap, 'analysis_server', manifestReader);
-
-      PluginInfo notFound = new PluginInfo(name: 'my_plugin1');
-      PluginInfo applicable = new PluginInfo(name: 'my_plugin2');
-      PluginInfo notApplicable = new PluginInfo(name: 'my_plugin3');
-
-      PluginConfig localConfig =
-          new PluginConfig([notFound, applicable, notApplicable]);
-
-      Iterable<PluginDetails> details = pm.getPluginDetails(localConfig);
-      expect(details, hasLength(3));
-
-      List<PluginDetails> plugins = sortByName(details);
-
-      expect(plugins[0].plugin.name, equals('my_plugin1'));
-      expect(plugins[0].status, equals(PluginStatus.NotFound));
-      expect(plugins[1].plugin.name, equals('my_plugin2'));
-      expect(
-          plugins[1].plugin.libraryUri, equals('my_plugin2/my_plugin2.dart'));
-      expect(plugins[1].status, equals(PluginStatus.Applicable));
-      expect(plugins[2].plugin.name, equals('my_plugin3'));
-      expect(plugins[2].status, equals(PluginStatus.NotApplicable));
-    });
-  });
-}
-
-List<PluginDetails> sortByName(Iterable<PluginDetails> details) =>
-    details.toList()
-      ..sort((p1, p2) => p1.plugin.name.compareTo(p2.plugin.name));
diff --git a/pkg/analyzer_cli/test/sdk_ext_test.dart b/pkg/analyzer_cli/test/sdk_ext_test.dart
index 535897c..48a02ce 100644
--- a/pkg/analyzer_cli/test/sdk_ext_test.dart
+++ b/pkg/analyzer_cli/test/sdk_ext_test.dart
@@ -40,12 +40,12 @@
 
     test('.packages file specified', () async {
       String testDir = path.join(testDirectory, 'data', 'packages_file');
-      Driver driver = new Driver()
-        ..start([
-          '--packages',
-          path.join(testDir, '_packages'),
-          path.join(testDir, 'sdk_ext_user.dart')
-        ]);
+      Driver driver = new Driver();
+      await driver.start([
+        '--packages',
+        path.join(testDir, '_packages'),
+        path.join(testDir, 'sdk_ext_user.dart')
+      ]);
 
       DartSdk sdk = driver.sdk;
       expect(sdk, new isInstanceOf<FolderBasedDartSdk>());
diff --git a/pkg/analyzer_cli/test/super_mixin_test.dart b/pkg/analyzer_cli/test/super_mixin_test.dart
index f890289..de1ad1a 100644
--- a/pkg/analyzer_cli/test/super_mixin_test.dart
+++ b/pkg/analyzer_cli/test/super_mixin_test.dart
@@ -38,7 +38,7 @@
 
     test('produces errors when option absent', () async {
       var testPath = path.join(testDirectory, 'data/super_mixin_example.dart');
-      new Driver().start([testPath]);
+      await new Driver().start([testPath]);
 
       expect(exitCode, 3);
       var stdout = outSink.toString();
@@ -56,7 +56,7 @@
 
     test('produces no errors when option present', () async {
       var testPath = path.join(testDirectory, 'data/super_mixin_example.dart');
-      new Driver().start(['--supermixin', testPath]);
+      await new Driver().start(['--supermixin', testPath]);
 
       expect(exitCode, 0);
       var stdout = outSink.toString();
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index dbff8df..2861f6b 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -47,7 +47,7 @@
 
   CompilerImpl(this.provider, api.CompilerOutput outputProvider, this.handler,
       CompilerOptions options,
-      {MakeBackendFuncion makeBackend, MakeReporterFunction makeReporter})
+      {MakeBackendFunction makeBackend, MakeReporterFunction makeReporter})
       // NOTE: allocating measurer is done upfront to ensure the wallclock is
       // started before other computations.
       : measurer = new Measurer(enableTaskMeasurements: options.verbose),
@@ -381,8 +381,7 @@
     // Private libraries are not exposed to the users.
     if (libraryName.startsWith("_")) return null;
 
-    Uri libraryUri =
-        compiler.resolvedUriTranslator.sdkLibraries[libraryName];
+    Uri libraryUri = compiler.resolvedUriTranslator.sdkLibraries[libraryName];
     if (libraryUri != null && libraryUri.scheme != "unsupported") {
       // Dart2js always "supports" importing 'dart:mirrors' but will abort
       // the compilation at a later point if the backend doesn't support
diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
index f9885ba..07987db 100644
--- a/pkg/compiler/lib/src/closure.dart
+++ b/pkg/compiler/lib/src/closure.dart
@@ -10,7 +10,7 @@
 import 'common.dart';
 import 'compiler.dart' show Compiler;
 import 'constants/expressions.dart';
-import 'dart_types.dart';
+import 'elements/resolution_types.dart';
 import 'elements/elements.dart';
 import 'elements/modelx.dart'
     show BaseFunctionElementX, ClassElementX, ElementX;
@@ -20,6 +20,7 @@
 import 'tokens/token.dart' show Token;
 import 'tree/tree.dart';
 import 'util/util.dart';
+import 'world.dart' show ClosedWorldRefiner;
 
 class ClosureTask extends CompilerTask {
   Map<Element, ClosureClassMap> _closureMappingCache =
@@ -49,9 +50,11 @@
   }
 
   /// Create [ClosureClassMap]s for all live members.
-  void createClosureClasses() {
-    compiler.enqueuer.resolution.processedElements
+  void createClosureClasses(ClosedWorldRefiner closedWorldRefiner) {
+    compiler.enqueuer.resolution.processedEntities
         .forEach((AstElement element) {
+      // TODO(johnniwinther): Typedefs should never be in processedElements.
+      if (element.isTypedef) return;
       ResolvedAst resolvedAst = element.resolvedAst;
       if (element.isAbstract) return;
       if (element.isField &&
@@ -60,11 +63,12 @@
         // Skip top-level/static fields without an initializer.
         return;
       }
-      computeClosureToClassMapping(resolvedAst);
+      computeClosureToClassMapping(resolvedAst, closedWorldRefiner);
     });
   }
 
-  ClosureClassMap computeClosureToClassMapping(ResolvedAst resolvedAst) {
+  ClosureClassMap computeClosureToClassMapping(
+      ResolvedAst resolvedAst, ClosedWorldRefiner closedWorldRefiner) {
     return measure(() {
       Element element = resolvedAst.element;
       ClosureClassMap cached = _closureMappingCache[element];
@@ -77,8 +81,8 @@
         Node node = resolvedAst.node;
         TreeElements elements = resolvedAst.elements;
 
-        ClosureTranslator translator =
-            new ClosureTranslator(compiler, elements, _closureMappingCache);
+        ClosureTranslator translator = new ClosureTranslator(
+            compiler, closedWorldRefiner, elements, _closureMappingCache);
 
         // The translator will store the computed closure-mappings inside the
         // cache. One for given node and one for each nested closure.
@@ -121,7 +125,7 @@
       throw new SpannableAssertionFailure(
           closure, 'Not a closure: $closure (${closure.runtimeType}).');
     }
-    compiler.enqueuer.codegen.forgetElement(cls, compiler);
+    compiler.enqueuer.codegen.forgetEntity(cls, compiler);
   }
 }
 
@@ -175,14 +179,14 @@
   bool get isInstanceMember => true;
   bool get isAssignable => false;
 
-  DartType computeType(Resolution resolution) => type;
+  ResolutionDartType computeType(Resolution resolution) => type;
 
-  DartType get type {
+  ResolutionDartType get type {
     if (local is LocalElement) {
       LocalElement element = local;
       return element.type;
     }
-    return const DynamicType();
+    return const ResolutionDynamicType();
   }
 
   String toString() => "ClosureFieldElement($name)";
@@ -206,9 +210,9 @@
 // TODO(ahe): These classes continuously cause problems.  We need to find
 // a more general solution.
 class ClosureClassElement extends ClassElementX {
-  DartType rawType;
-  DartType thisType;
-  FunctionType callType;
+  ResolutionDartType rawType;
+  ResolutionDartType thisType;
+  ResolutionFunctionType callType;
 
   /// Node that corresponds to this closure, used for source position.
   final FunctionExpression node;
@@ -237,8 +241,8 @@
         : backend.helpers.closureClass;
     superclass.ensureResolved(compiler.resolution);
     supertype = superclass.thisType;
-    interfaces = const Link<DartType>();
-    thisType = rawType = new InterfaceType(this);
+    interfaces = const Link<ResolutionDartType>();
+    thisType = rawType = new ResolutionInterfaceType(this);
     allSupertypesAndSelf =
         superclass.allSupertypesAndSelf.extendClass(thisType);
     callType = methodElement.type;
@@ -299,9 +303,9 @@
       : this.box = box,
         super(name, ElementKind.FIELD, box.executableContext);
 
-  DartType computeType(Resolution resolution) => type;
+  ResolutionDartType computeType(Resolution resolution) => type;
 
-  DartType get type => variableElement.type;
+  ResolutionDartType get type => variableElement.type;
 
   @override
   Entity get declaredEntity => variableElement;
@@ -543,6 +547,7 @@
 
 class ClosureTranslator extends Visitor {
   final Compiler compiler;
+  final ClosedWorldRefiner closedWorldRefiner;
   final TreeElements elements;
   int closureFieldCounter = 0;
   int boxedFieldCounter = 0;
@@ -574,7 +579,8 @@
 
   bool insideClosure = false;
 
-  ClosureTranslator(this.compiler, this.elements, this.closureMappingCache);
+  ClosureTranslator(this.compiler, this.closedWorldRefiner, this.elements,
+      this.closureMappingCache);
 
   DiagnosticReporter get reporter => compiler.reporter;
 
@@ -746,7 +752,7 @@
     }
   }
 
-  void useTypeVariableAsLocal(TypeVariableType typeVariable) {
+  void useTypeVariableAsLocal(ResolutionTypeVariableType typeVariable) {
     useLocal(new TypeVariableLocal(typeVariable, outermostElement));
   }
 
@@ -794,7 +800,7 @@
 
   visitTypeAnnotation(TypeAnnotation node) {
     MemberElement member = executableContext.memberContext;
-    DartType type = elements.getType(node);
+    ResolutionDartType type = elements.getType(node);
     // TODO(karlklose,johnniwinther): if the type is null, the annotation is
     // from a parameter which has been analyzed before the method has been
     // resolved and the result has been thrown away.
@@ -805,7 +811,7 @@
         // This is a closure in a factory constructor.  Since there is no
         // [:this:], we have to mark the type arguments as free variables to
         // capture them in the closure.
-        type.forEachTypeVariable((TypeVariableType variable) {
+        type.forEachTypeVariable((ResolutionTypeVariableType variable) {
           useTypeVariableAsLocal(variable);
         });
       }
@@ -852,13 +858,14 @@
       registerNeedsThis();
     } else if (node.isTypeTest || node.isTypeCast) {
       TypeAnnotation annotation = node.typeAnnotationFromIsCheckOrCast;
-      DartType type = elements.getType(annotation);
+      ResolutionDartType type = elements.getType(annotation);
       analyzeType(type);
     } else if (node.isTypeTest) {
-      DartType type = elements.getType(node.typeAnnotationFromIsCheckOrCast);
+      ResolutionDartType type =
+          elements.getType(node.typeAnnotationFromIsCheckOrCast);
       analyzeType(type);
     } else if (node.isTypeCast) {
-      DartType type = elements.getType(node.arguments.head);
+      ResolutionDartType type = elements.getType(node.arguments.head);
       analyzeType(type);
     }
     node.visitChildren(this);
@@ -877,25 +884,25 @@
   }
 
   visitNewExpression(NewExpression node) {
-    DartType type = elements.getType(node);
+    ResolutionDartType type = elements.getType(node);
     analyzeType(type);
     node.visitChildren(this);
   }
 
   visitLiteralList(LiteralList node) {
-    DartType type = elements.getType(node);
+    ResolutionDartType type = elements.getType(node);
     analyzeType(type);
     node.visitChildren(this);
   }
 
   visitLiteralMap(LiteralMap node) {
-    DartType type = elements.getType(node);
+    ResolutionDartType type = elements.getType(node);
     analyzeType(type);
     node.visitChildren(this);
   }
 
-  void analyzeTypeVariables(DartType type) {
-    type.forEachTypeVariable((TypeVariableType typeVariable) {
+  void analyzeTypeVariables(ResolutionDartType type) {
+    type.forEachTypeVariable((ResolutionTypeVariableType typeVariable) {
       // Field initializers are inlined and access the type variable as
       // normal parameters.
       if (!outermostElement.isField && !outermostElement.isConstructor) {
@@ -906,7 +913,7 @@
     });
   }
 
-  void analyzeType(DartType type) {
+  void analyzeType(ResolutionDartType type) {
     // TODO(johnniwinther): Find out why this can be null.
     if (type == null) return;
     if (outermostElement.isClassMember &&
@@ -1068,7 +1075,7 @@
     ClosureClassElement globalizedElement =
         new ClosureClassElement(node, closureName, compiler, element);
     // Extend [globalizedElement] as an instantiated class in the closed world.
-    compiler.inferenceWorld.registerClosureClass(globalizedElement);
+    closedWorldRefiner.registerClosureClass(globalizedElement);
     FunctionElement callElement = new SynthesizedCallMethodElementX(
         Identifiers.call, element, globalizedElement, node, elements);
     backend.maybeMarkClosureAsNeededForReflection(
@@ -1112,7 +1119,7 @@
     }
 
     inNewScope(node, () {
-      DartType type = element.type;
+      ResolutionDartType type = element.type;
       // If the method needs RTI, or checked mode is set, we need to
       // escape the potential type variables used in that closure.
       if (element is FunctionElement &&
@@ -1190,7 +1197,7 @@
 
 /// A type variable as a local variable.
 class TypeVariableLocal implements Local {
-  final TypeVariableType typeVariable;
+  final ResolutionTypeVariableType typeVariable;
   final ExecutableElement executableContext;
 
   TypeVariableLocal(this.typeVariable, this.executableContext);
diff --git a/pkg/compiler/lib/src/common/backend_api.dart b/pkg/compiler/lib/src/common/backend_api.dart
index 089058c..73e22cd 100644
--- a/pkg/compiler/lib/src/common/backend_api.dart
+++ b/pkg/compiler/lib/src/common/backend_api.dart
@@ -15,9 +15,17 @@
 import '../constants/constant_system.dart' show ConstantSystem;
 import '../constants/expressions.dart' show ConstantExpression;
 import '../constants/values.dart' show ConstantValue;
-import '../dart_types.dart' show DartType, InterfaceType;
+import '../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionInterfaceType;
 import '../elements/elements.dart'
-    show ClassElement, Element, FunctionElement, MethodElement, LibraryElement;
+    show
+        ClassElement,
+        Element,
+        FunctionElement,
+        MemberElement,
+        MethodElement,
+        LibraryElement;
+import '../elements/entities.dart';
 import '../enqueue.dart' show Enqueuer, EnqueueTask, ResolutionEnqueuer;
 import '../io/code_output.dart' show CodeBuffer;
 import '../io/source_information.dart' show SourceInformationStrategy;
@@ -32,6 +40,7 @@
 import '../tree/tree.dart' show Node;
 import '../universe/world_impact.dart'
     show ImpactStrategy, WorldImpact, WorldImpactBuilder;
+import '../world.dart' show ClosedWorld, ClosedWorldRefiner;
 import 'codegen.dart' show CodegenWorkItem;
 import 'tasks.dart' show CompilerTask;
 
@@ -101,11 +110,12 @@
   }
 
   /// Generates the output and returns the total size of the generated code.
-  int assembleProgram();
+  int assembleProgram(ClosedWorld closedWorld);
 
   List<CompilerTask> get tasks;
 
-  void onResolutionComplete() {}
+  void onResolutionComplete(
+      ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) {}
   void onTypeInferenceComplete() {}
 
   bool classNeedsRti(ClassElement cls);
@@ -141,21 +151,12 @@
 
   /// Called to instruct to the backend register [type] as instantiated on
   /// [enqueuer].
-  void registerInstantiatedType(InterfaceType type) {}
+  void registerInstantiatedType(ResolutionInterfaceType type) {}
 
   /// Register a runtime type variable bound tests between [typeArgument] and
   /// [bound].
   void registerTypeVariableBoundsSubtypeCheck(
-      DartType typeArgument, DartType bound) {}
-
-  /// Called to register that an instantiated generic class has a call method.
-  /// Any backend specific [WorldImpact] of this is returned.
-  ///
-  /// Note: The [callMethod] is registered even thought it doesn't reference
-  /// the type variables.
-  WorldImpact registerCallMethodWithFreeTypeVariables(Element callMethod,
-          {bool forResolution}) =>
-      const WorldImpact();
+      ResolutionDartType typeArgument, ResolutionDartType bound) {}
 
   /// Called to instruct the backend to register that a closure exists for a
   /// function on an instantiated generic class. Any backend specific
@@ -172,17 +173,6 @@
   /// specific [WorldImpact] of this is returned.
   WorldImpact registerGetOfStaticFunction() => const WorldImpact();
 
-  /// Called to register that the `runtimeType` property has been accessed. Any
-  /// backend specific [WorldImpact] of this is returned.
-  WorldImpact registerRuntimeType() => const WorldImpact();
-
-  /// Called to register a `noSuchMethod` implementation.
-  void registerNoSuchMethod(FunctionElement noSuchMethodElement) {}
-
-  /// Called to enable support for `noSuchMethod`. Any backend specific
-  /// [WorldImpact] of this is returned.
-  WorldImpact enableNoSuchMethod() => const WorldImpact();
-
   /// Returns whether or not `noSuchMethod` support has been enabled.
   bool get enabledNoSuchMethod => false;
 
@@ -193,7 +183,7 @@
   void registerConstSymbol(String name) {}
 
   ClassElement defaultSuperclass(ClassElement element) {
-    return compiler.coreClasses.objectClass;
+    return compiler.commonElements.objectClass;
   }
 
   bool isInterceptorClass(ClassElement element) => false;
@@ -222,7 +212,8 @@
 
   /// Called to register that [element] is statically known to be used. Any
   /// backend specific [WorldImpact] of this is returned.
-  WorldImpact registerStaticUse(Element element, {bool forResolution}) =>
+  WorldImpact registerUsedElement(MemberElement element,
+          {bool forResolution}) =>
       const WorldImpact();
 
   /// This method is called immediately after the [LibraryElement] [library] has
@@ -271,6 +262,10 @@
   /// Returns true if this element needs reflection information at runtime.
   bool isAccessibleByReflection(Element element) => true;
 
+  /// Returns true if this member element needs reflection information at
+  /// runtime.
+  bool isMemberAccessibleByReflection(MemberElement element) => true;
+
   /// Returns true if this element is covered by a mirrorsUsed annotation.
   ///
   /// Note that it might still be ok to tree shake the element away if no
@@ -305,7 +300,7 @@
   /// There is no guarantee that a class is only present once in
   /// [recentClasses], but every class seen by the [enqueuer] will be present in
   /// [recentClasses] at least once.
-  bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassElement> recentClasses) {
+  bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassEntity> recentClasses) {
     return true;
   }
 
@@ -313,11 +308,12 @@
   /// times, but [onQueueClosed] is only called once.
   void onQueueClosed() {}
 
-  /// Called when the compiler starts running the codegen enqueuer.
-  void onCodegenStart() {}
+  /// Called when the compiler starts running the codegen enqueuer. The
+  /// [WorldImpact] of enabled backend features is returned.
+  WorldImpact onCodegenStart(ClosedWorld closedWorld) => const WorldImpact();
 
-  /// Called after [element] has been resolved.
-  void onElementResolved(Element element) {}
+  /// Called when code generation has been completed.
+  void onCodegenEnd() {}
 
   // Does this element belong in the output
   bool shouldOutput(Element element) => true;
@@ -368,10 +364,10 @@
   ConstantExpression getConstant(Node node);
 
   /// Registers [type] as instantiated.
-  void registerInstantiatedType(InterfaceType type);
+  void registerInstantiatedType(ResolutionInterfaceType type);
 
   /// Resolves [typeName] to a type in the context of [node].
-  DartType resolveTypeFromString(Node node, String typeName);
+  ResolutionDartType resolveTypeFromString(Node node, String typeName);
 }
 
 /// Backend transformation methods for the world impacts.
@@ -405,6 +401,7 @@
   ClassElement get numImplementation;
   ClassElement get stringImplementation;
   ClassElement get listImplementation;
+  ClassElement get mutableListImplementation;
   ClassElement get growableListImplementation;
   ClassElement get fixedListImplementation;
   ClassElement get constListImplementation;
@@ -420,4 +417,13 @@
   ClassElement get syncStarIterableImplementation;
   ClassElement get asyncFutureImplementation;
   ClassElement get asyncStarStreamImplementation;
+  ClassElement get indexableImplementation;
+  ClassElement get mutableIndexableImplementation;
+  ClassElement get indexingBehaviorImplementation;
+  ClassElement get interceptorImplementation;
+
+  bool isDefaultEqualityImplementation(MemberElement element);
+  bool isInterceptorClass(ClassElement cls);
+  bool isNativeClass(ClassElement element);
+  bool isNativeMember(MemberElement element);
 }
diff --git a/pkg/compiler/lib/src/common/codegen.dart b/pkg/compiler/lib/src/common/codegen.dart
index 748f222..cd17e56 100644
--- a/pkg/compiler/lib/src/common/codegen.dart
+++ b/pkg/compiler/lib/src/common/codegen.dart
@@ -7,7 +7,8 @@
 import '../common.dart';
 import '../common/backend_api.dart' show Backend;
 import '../constants/values.dart' show ConstantValue;
-import '../dart_types.dart' show DartType, InterfaceType;
+import '../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionInterfaceType;
 import '../elements/elements.dart'
     show
         AstElement,
@@ -28,8 +29,9 @@
 
   Iterable<ConstantValue> get compileTimeConstants => const <ConstantValue>[];
 
-  Iterable<Pair<DartType, DartType>> get typeVariableBoundsSubtypeChecks {
-    return const <Pair<DartType, DartType>>[];
+  Iterable<Pair<ResolutionDartType, ResolutionDartType>>
+      get typeVariableBoundsSubtypeChecks {
+    return const <Pair<ResolutionDartType, ResolutionDartType>>[];
   }
 
   Iterable<String> get constSymbols => const <String>[];
@@ -47,7 +49,8 @@
 
 class _CodegenImpact extends WorldImpactBuilderImpl implements CodegenImpact {
   Setlet<ConstantValue> _compileTimeConstants;
-  Setlet<Pair<DartType, DartType>> _typeVariableBoundsSubtypeChecks;
+  Setlet<Pair<ResolutionDartType, ResolutionDartType>>
+      _typeVariableBoundsSubtypeChecks;
   Setlet<String> _constSymbols;
   List<Set<ClassElement>> _specializedGetInterceptors;
   bool _usesInterceptor = false;
@@ -76,18 +79,20 @@
   }
 
   void registerTypeVariableBoundsSubtypeCheck(
-      DartType subtype, DartType supertype) {
+      ResolutionDartType subtype, ResolutionDartType supertype) {
     if (_typeVariableBoundsSubtypeChecks == null) {
-      _typeVariableBoundsSubtypeChecks = new Setlet<Pair<DartType, DartType>>();
+      _typeVariableBoundsSubtypeChecks =
+          new Setlet<Pair<ResolutionDartType, ResolutionDartType>>();
     }
-    _typeVariableBoundsSubtypeChecks
-        .add(new Pair<DartType, DartType>(subtype, supertype));
+    _typeVariableBoundsSubtypeChecks.add(
+        new Pair<ResolutionDartType, ResolutionDartType>(subtype, supertype));
   }
 
-  Iterable<Pair<DartType, DartType>> get typeVariableBoundsSubtypeChecks {
+  Iterable<Pair<ResolutionDartType, ResolutionDartType>>
+      get typeVariableBoundsSubtypeChecks {
     return _typeVariableBoundsSubtypeChecks != null
         ? _typeVariableBoundsSubtypeChecks
-        : const <Pair<DartType, DartType>>[];
+        : const <Pair<ResolutionDartType, ResolutionDartType>>[];
   }
 
   void registerConstSymbol(String name) {
@@ -184,7 +189,7 @@
   }
 
   void registerTypeVariableBoundsSubtypeCheck(
-      DartType subtype, DartType supertype) {
+      ResolutionDartType subtype, ResolutionDartType supertype) {
     worldImpact.registerTypeVariableBoundsSubtypeCheck(subtype, supertype);
   }
 
@@ -208,7 +213,7 @@
     worldImpact.registerTypeConstant(element);
   }
 
-  void registerInstantiation(InterfaceType type) {
+  void registerInstantiation(ResolutionInterfaceType type) {
     registerTypeUse(new TypeUse.instantiation(type));
   }
 
diff --git a/pkg/compiler/lib/src/common/names.dart b/pkg/compiler/lib/src/common/names.dart
index 06ef360..715d8cf 100644
--- a/pkg/compiler/lib/src/common/names.dart
+++ b/pkg/compiler/lib/src/common/names.dart
@@ -162,6 +162,9 @@
   /// The URI for 'dart:html'.
   static final Uri dart_html = new Uri(scheme: 'dart', path: 'html');
 
+  /// The URI for 'dart:isolate'.
+  static final Uri dart_isolate = new Uri(scheme: 'dart', path: 'isolate');
+
   /// The URI for 'dart:mirrors'.
   static final Uri dart_mirrors = new Uri(scheme: 'dart', path: 'mirrors');
 
diff --git a/pkg/compiler/lib/src/common/resolution.dart b/pkg/compiler/lib/src/common/resolution.dart
index 2adfe26..0ccd78e 100644
--- a/pkg/compiler/lib/src/common/resolution.dart
+++ b/pkg/compiler/lib/src/common/resolution.dart
@@ -9,14 +9,14 @@
 import '../compiler.dart' show Compiler;
 import '../constants/expressions.dart' show ConstantExpression;
 import '../constants/values.dart' show ConstantValue;
-import '../core_types.dart' show CoreClasses, CoreTypes, CommonElements;
-import '../dart_types.dart' show DartType, Types;
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart' show ResolutionDartType, Types;
 import '../elements/elements.dart'
     show
         AstElement,
         ClassElement,
-        ConstructorElement,
         Element,
+        Entity,
         ExecutableElement,
         FunctionElement,
         FunctionSignature,
@@ -113,7 +113,7 @@
 
   /// Returns `true` if [element] is a native element, that is, that the
   /// corresponding entity already exists in the target language.
-  bool isNative(Element element) => false;
+  bool isNative(Entity element) => false;
 
   /// Returns `true` if [element] is a foreign element, that is, that the
   /// backend has specialized handling for the element.
@@ -127,8 +127,6 @@
 abstract class Resolution implements Frontend {
   ParsingContext get parsingContext;
   DiagnosticReporter get reporter;
-  CoreClasses get coreClasses;
-  CoreTypes get coreTypes;
   CommonElements get commonElements;
   Types get types;
   Target get target;
@@ -153,7 +151,8 @@
   void registerClass(ClassElement cls);
   void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation);
   FunctionSignature resolveSignature(FunctionElement function);
-  DartType resolveTypeAnnotation(Element element, TypeAnnotation node);
+  ResolutionDartType resolveTypeAnnotation(
+      Element element, TypeAnnotation node);
 
   /// Returns `true` if [element] has been resolved.
   // TODO(johnniwinther): Normalize semantics between normal and deserialized
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
index a1d62a2..82459f3 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -13,8 +13,8 @@
 import 'constants/evaluation.dart';
 import 'constants/expressions.dart';
 import 'constants/values.dart';
-import 'core_types.dart' show CoreTypes;
-import 'dart_types.dart';
+import 'core_types.dart' show CommonElements;
+import 'elements/resolution_types.dart';
 import 'elements/elements.dart';
 import 'elements/modelx.dart' show ConstantVariableMixin;
 import 'resolution/operators.dart';
@@ -159,7 +159,7 @@
 
   DiagnosticReporter get reporter => compiler.reporter;
 
-  CoreTypes get coreTypes => compiler.coreTypes;
+  CommonElements get commonElements => compiler.commonElements;
 
   @override
   @deprecated
@@ -252,7 +252,7 @@
           checkType &&
           expression != null &&
           element.isField) {
-        DartType elementType = element.type;
+        ResolutionDartType elementType = element.type;
         ConstantValue value = getConstantValue(expression);
         if (elementType.isMalformed && !value.isNull) {
           if (isConst) {
@@ -272,7 +272,7 @@
             expression = null;
           }
         } else {
-          DartType constantType = value.getType(coreTypes);
+          ResolutionDartType constantType = value.getType(commonElements);
           if (!constantSystem.isSubtype(
               compiler.types, constantType, elementType)) {
             if (isConst) {
@@ -407,7 +407,7 @@
 
   ConstantSystem get constantSystem => handler.constantSystem;
   Resolution get resolution => compiler.resolution;
-  CoreTypes get coreTypes => compiler.coreTypes;
+  CommonElements get commonElements => compiler.commonElements;
   DiagnosticReporter get reporter => compiler.reporter;
 
   AstConstant evaluate(Node node) {
@@ -470,7 +470,7 @@
       argumentExpressions.add(argument.expression);
       argumentValues.add(argument.value);
     }
-    DartType type = elements.getType(node);
+    ResolutionDartType type = elements.getType(node);
     return new AstConstant(
         context,
         node,
@@ -508,7 +508,7 @@
       valueExpressions.add(value.expression);
       map[key.value] = value.value;
     }
-    InterfaceType type = elements.getType(node);
+    ResolutionInterfaceType type = elements.getType(node);
     return new AstConstant(
         context,
         node,
@@ -594,7 +594,7 @@
   }
 
   AstConstant visitLiteralSymbol(LiteralSymbol node) {
-    InterfaceType type = coreTypes.symbolType;
+    ResolutionInterfaceType type = commonElements.symbolType;
     String text = node.slowNameString;
     List<AstConstant> arguments = <AstConstant>[
       new AstConstant(context, node, new StringConstantExpression(text),
@@ -608,7 +608,7 @@
         context, node, new SymbolConstantExpression(text), constant.value);
   }
 
-  ConstantValue makeTypeConstant(DartType elementType) {
+  ConstantValue makeTypeConstant(ResolutionDartType elementType) {
     return constantSystem.createType(compiler, elementType);
   }
 
@@ -624,7 +624,7 @@
     Element element = elements[node];
     if (Elements.isClass(element) || Elements.isTypedef(element)) {
       TypeDeclarationElement typeDeclarationElement = element;
-      DartType type = typeDeclarationElement.rawType;
+      ResolutionDartType type = typeDeclarationElement.rawType;
       return new AstConstant(element, node, new TypeConstantExpression(type),
           makeTypeConstant(type));
     }
@@ -637,13 +637,13 @@
     if (send.isPropertyAccess) {
       AstConstant result;
       if (Elements.isStaticOrTopLevelFunction(element)) {
-        FunctionElement function = element;
+        MethodElement function = element;
         function.computeType(resolution);
         result = new AstConstant(
             context,
             send,
             new FunctionConstantExpression(function),
-            new FunctionConstantValue(function));
+            new FunctionConstantValue(function, function.type));
       } else if (Elements.isStaticOrTopLevelField(element)) {
         ConstantExpression elementExpression;
         if (element.isConst) {
@@ -660,7 +660,7 @@
         }
       } else if (Elements.isClass(element) || Elements.isTypedef(element)) {
         assert(elements.isTypeLiteral(send));
-        DartType elementType = elements.getTypeLiteralType(send);
+        ResolutionDartType elementType = elements.getTypeLiteralType(send);
         result = new AstConstant(
             context,
             send,
@@ -810,10 +810,11 @@
     if (condition == null || condition.isError) {
       return condition;
     } else if (!condition.value.isBool) {
-      DartType conditionType = condition.value.getType(coreTypes);
+      ResolutionDartType conditionType =
+          condition.value.getType(commonElements);
       if (isEvaluatingConstant) {
         reporter.reportErrorMessage(node.condition, MessageKind.NOT_ASSIGNABLE,
-            {'fromType': conditionType, 'toType': coreTypes.boolType});
+            {'fromType': conditionType, 'toType': commonElements.boolType});
         return new ErroneousAstConstant(context, node);
       }
       return null;
@@ -864,8 +865,7 @@
 
     target.computeType(resolution);
 
-    FunctionSignature signature = target.functionSignature;
-    if (!callStructure.signatureApplies(signature)) {
+    if (!callStructure.signatureApplies(target.type)) {
       String name = Elements.constructorNameForDiagnostics(
           target.enclosingClass.name, target.name);
       reporter.reportErrorMessage(node,
@@ -875,8 +875,8 @@
           target.functionSignature.parameterCount,
           new ErroneousAstConstant(context, node));
     }
-    return callStructure.makeArgumentsList(
-        arguments, target, compileArgument, compileDefaultValue);
+    return Elements.makeArgumentsList<AstConstant>(
+        callStructure, arguments, target, compileArgument, compileDefaultValue);
   }
 
   AstConstant visitNewExpression(NewExpression node) {
@@ -897,16 +897,20 @@
           message: MessageKind.DEFERRED_COMPILE_TIME_CONSTANT_CONSTRUCTION);
     }
 
-    InterfaceType type = elements.getType(node);
+    ResolutionInterfaceType type = elements.getType(node);
     CallStructure callStructure = elements.getSelector(send).callStructure;
 
     return createConstructorInvocation(node, type, constructor, callStructure,
         arguments: node.send.arguments);
   }
 
-  AstConstant createConstructorInvocation(Node node, InterfaceType type,
-      ConstructorElement constructor, CallStructure callStructure,
-      {Link<Node> arguments, List<AstConstant> normalizedArguments}) {
+  AstConstant createConstructorInvocation(
+      Node node,
+      ResolutionInterfaceType type,
+      ConstructorElement constructor,
+      CallStructure callStructure,
+      {Link<Node> arguments,
+      List<AstConstant> normalizedArguments}) {
     // TODO(ahe): This is nasty: we must eagerly analyze the
     // constructor to ensure the redirectionTarget has been computed
     // correctly.  Find a way to avoid this.
@@ -917,7 +921,7 @@
     compiler.resolver.resolveRedirectionChain(constructor, node);
 
     bool isInvalid = false;
-    InterfaceType constructedType = type;
+    ResolutionInterfaceType constructedType = type;
     ConstructorElement implementation;
     if (constructor.isRedirectingFactory) {
       if (constructor.isEffectiveTargetMalformed) {
@@ -994,7 +998,7 @@
 
   AstConstant createFromEnvironmentConstant(
       Node node,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       ConstructorElement constructor,
       CallStructure callStructure,
       List<AstConstant> normalizedArguments,
@@ -1008,38 +1012,38 @@
     }
 
     if (!firstArgument.isString) {
-      DartType type = defaultValue.getType(coreTypes);
+      ResolutionDartType type = defaultValue.getType(commonElements);
       return reportNotCompileTimeConstant(
           normalizedArguments[0].node,
           MessageKind.NOT_ASSIGNABLE,
-          {'fromType': type, 'toType': coreTypes.stringType});
+          {'fromType': type, 'toType': commonElements.stringType});
     }
 
     if (constructor.isIntFromEnvironmentConstructor &&
         !(defaultValue.isNull || defaultValue.isInt)) {
-      DartType type = defaultValue.getType(coreTypes);
+      ResolutionDartType type = defaultValue.getType(commonElements);
       return reportNotCompileTimeConstant(
           normalizedArguments[1].node,
           MessageKind.NOT_ASSIGNABLE,
-          {'fromType': type, 'toType': coreTypes.intType});
+          {'fromType': type, 'toType': commonElements.intType});
     }
 
     if (constructor.isBoolFromEnvironmentConstructor &&
         !(defaultValue.isNull || defaultValue.isBool)) {
-      DartType type = defaultValue.getType(coreTypes);
+      ResolutionDartType type = defaultValue.getType(commonElements);
       return reportNotCompileTimeConstant(
           normalizedArguments[1].node,
           MessageKind.NOT_ASSIGNABLE,
-          {'fromType': type, 'toType': coreTypes.boolType});
+          {'fromType': type, 'toType': commonElements.boolType});
     }
 
     if (constructor.isStringFromEnvironmentConstructor &&
         !(defaultValue.isNull || defaultValue.isString)) {
-      DartType type = defaultValue.getType(coreTypes);
+      ResolutionDartType type = defaultValue.getType(commonElements);
       return reportNotCompileTimeConstant(
           normalizedArguments[1].node,
           MessageKind.NOT_ASSIGNABLE,
-          {'fromType': type, 'toType': coreTypes.stringType});
+          {'fromType': type, 'toType': commonElements.stringType});
     }
 
     String name = firstArgument.primitiveValue.slowToString();
@@ -1092,9 +1096,9 @@
       ConstantCompilerBase handler,
       Element context,
       Node node,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       ConstructorElement constructor,
-      InterfaceType constructedType,
+      ResolutionInterfaceType constructedType,
       ConstructorElement target,
       CallStructure callStructure,
       List<AstConstant> concreteArguments,
@@ -1108,7 +1112,7 @@
     }
     assert(invariant(
         node,
-        callStructure.signatureApplies(constructor.functionSignature) ||
+        callStructure.signatureApplies(constructor.type) ||
             compiler.compilationFailed,
         message: "Call structure $callStructure does not apply to constructor "
             "$constructor."));
@@ -1163,7 +1167,7 @@
 }
 
 class ConstructorEvaluator extends CompileTimeConstantEvaluator {
-  final InterfaceType constructedType;
+  final ResolutionInterfaceType constructedType;
   final ConstructorElement constructor;
   final Map<Element, AstConstant> definitions;
   final Map<Element, AstConstant> fieldValues;
@@ -1175,7 +1179,7 @@
    * Invariant: [constructor] must be an implementation element.
    */
   ConstructorEvaluator(
-      InterfaceType this.constructedType,
+      ResolutionInterfaceType this.constructedType,
       ConstructorElement constructor,
       ConstantCompiler handler,
       Compiler compiler)
@@ -1208,8 +1212,9 @@
 
   void potentiallyCheckType(TypedElement element, AstConstant constant) {
     if (compiler.options.enableTypeAssertions) {
-      DartType elementType = element.type.substByContext(constructedType);
-      DartType constantType = constant.value.getType(coreTypes);
+      ResolutionDartType elementType =
+          element.type.substByContext(constructedType);
+      ResolutionDartType constantType = constant.value.getType(commonElements);
       if (!constantSystem.isSubtype(
           compiler.types, constantType, elementType)) {
         reporter.withCurrentElement(constant.element, () {
@@ -1250,7 +1255,7 @@
 
   void evaluateSuperOrRedirectSend(List<AstConstant> compiledArguments,
       CallStructure callStructure, ConstructorElement targetConstructor) {
-    InterfaceType type =
+    ResolutionInterfaceType type =
         constructedType.asInstanceOf(targetConstructor.enclosingClass);
     if (compiler.serialization.isDeserialized(targetConstructor)) {
       List<ConstantExpression> arguments =
@@ -1289,10 +1294,10 @@
       Function compileArgument = (element) => definitions[element];
       Function compileConstant = handler.compileConstant;
       FunctionElement target = constructor.definingConstructor.implementation;
-      CallStructure.addForwardingElementArgumentsToList(constructor,
+      Elements.addForwardingElementArgumentsToList<AstConstant>(constructor,
           compiledArguments, target, compileArgument, compileConstant);
-      CallStructure callStructure =
-          new CallStructure.fromSignature(target.functionSignature);
+      CallStructure callStructure = new CallStructure(
+          target.functionSignature.parameterCount, target.type.namedParameters);
       evaluateSuperOrRedirectSend(compiledArguments, callStructure, target);
       return;
     }
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index db282a3..795b81c 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -10,7 +10,6 @@
 import 'cache_strategy.dart' show CacheStrategy;
 import 'closure.dart' as closureMapping show ClosureTask;
 import 'common/backend_api.dart' show Backend;
-import 'common/codegen.dart' show CodegenWorkItem;
 import 'common/names.dart' show Selectors;
 import 'common/names.dart' show Identifiers, Uris;
 import 'common/resolution.dart'
@@ -25,8 +24,13 @@
 import 'common.dart';
 import 'compile_time_constants.dart';
 import 'constants/values.dart';
-import 'core_types.dart' show CoreClasses, CommonElements, CoreTypes;
-import 'dart_types.dart' show DartType, DynamicType, InterfaceType, Types;
+import 'core_types.dart' show CommonElements;
+import 'elements/resolution_types.dart'
+    show
+        ResolutionDartType,
+        ResolutionDynamicType,
+        ResolutionInterfaceType,
+        Types;
 import 'deferred_load.dart' show DeferredLoadTask;
 import 'diagnostics/code_location.dart';
 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter;
@@ -78,9 +82,9 @@
         WorldImpactBuilder,
         WorldImpactBuilderImpl;
 import 'util/util.dart' show Link, Setlet;
-import 'world.dart' show ClosedWorld, ClosedWorldRefiner, OpenWorld, WorldImpl;
+import 'world.dart' show ClosedWorld, ClosedWorldRefiner, ClosedWorldImpl;
 
-typedef Backend MakeBackendFuncion(Compiler compiler);
+typedef Backend MakeBackendFunction(Compiler compiler);
 
 typedef CompilerDiagnosticReporter MakeReporterFunction(
     Compiler compiler, CompilerOptions options);
@@ -89,9 +93,8 @@
   Measurer get measurer;
 
   final IdGenerator idGenerator = new IdGenerator();
-  WorldImpl get _world => resolverWorld.openWorld;
   Types types;
-  _CompilerCoreTypes _coreTypes;
+  _CompilerCommonElements _commonElements;
   CompilerDiagnosticReporter _reporter;
   CompilerResolution _resolution;
   ParsingContext _parsingContext;
@@ -130,15 +133,11 @@
 
   ResolvedUriTranslator get resolvedUriTranslator;
 
-  Tracer tracer;
-
   LibraryElement mainApp;
-  FunctionElement mainFunction;
+  MethodElement mainFunction;
 
   DiagnosticReporter get reporter => _reporter;
-  CommonElements get commonElements => _coreTypes;
-  CoreClasses get coreClasses => _coreTypes;
-  CoreTypes get coreTypes => _coreTypes;
+  CommonElements get commonElements => _commonElements;
   Resolution get resolution => _resolution;
   ParsingContext get parsingContext => _parsingContext;
 
@@ -180,9 +179,6 @@
   MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask;
   DumpInfoTask dumpInfoTask;
 
-  bool get hasFunctionApplySupport => resolverWorld.hasFunctionApplySupport;
-  bool get hasIsolateSupport => resolverWorld.hasIsolateSupport;
-
   bool get hasCrashed => _reporter.hasCrashed;
 
   Stopwatch progress;
@@ -203,7 +199,7 @@
       {CompilerOptions options,
       api.CompilerOutput outputProvider,
       this.environment: const _EmptyEnvironment(),
-      MakeBackendFuncion makeBackend,
+      MakeBackendFunction makeBackend,
       MakeReporterFunction makeReporter})
       : this.options = options,
         this.cacheStrategy = new CacheStrategy(options.hasIncrementalSupport),
@@ -216,11 +212,8 @@
       _reporter = new CompilerDiagnosticReporter(this, options);
     }
     _resolution = createResolution();
-    // TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and
-    // make its field final.
-    _coreTypes = new _CompilerCoreTypes(_resolution, reporter);
+    _commonElements = new _CompilerCommonElements(_resolution, reporter);
     types = new Types(_resolution);
-    tracer = new Tracer(this, this.outputProvider);
 
     if (options.verbose) {
       progress = new Stopwatch()..start();
@@ -237,11 +230,6 @@
     }
     enqueuer = backend.makeEnqueuer();
 
-    if (options.dumpInfo && options.useStartupEmitter) {
-      throw new ArgumentError(
-          '--dump-info is not supported with the fast startup emitter');
-    }
-
     tasks = [
       dietParser = new DietParserTask(idGenerator, backend, reporter, measurer),
       scanner = createScannerTask(),
@@ -282,20 +270,6 @@
     tasks.addAll(backend.tasks);
   }
 
-  /// The world currently being computed by resolution. This forms a basis for
-  /// the [inferenceWorld] and later the [closedWorld].
-  OpenWorld get openWorld => _world;
-
-  /// The closed world after resolution but currently refined by inference.
-  ClosedWorldRefiner get inferenceWorld => _world;
-
-  /// The closed world after resolution and inference.
-  ClosedWorld get closedWorld {
-    assert(invariant(CURRENT_ELEMENT_SPANNABLE, _world.isClosed,
-        message: "Closed world not computed yet."));
-    return _world;
-  }
-
   /// Creates the backend.
   ///
   /// Override this to mock the backend for testing.
@@ -323,14 +297,12 @@
   ///
   /// Override this to mock the resolver for testing.
   ResolverTask createResolverTask() {
-    return new ResolverTask(
-        resolution, backend.constantCompilerTask, openWorld, measurer);
+    return new ResolverTask(resolution, backend.constantCompilerTask, measurer);
   }
 
-  // TODO(johnniwinther): Rename these appropriately when unification of worlds/
-  // universes is complete.
-  ResolutionWorldBuilder get resolverWorld => enqueuer.resolution.universe;
-  CodegenWorldBuilder get codegenWorld => enqueuer.codegen.universe;
+  ResolutionWorldBuilder get resolutionWorldBuilder =>
+      enqueuer.resolution.worldBuilder;
+  CodegenWorldBuilder get codegenWorldBuilder => enqueuer.codegen.worldBuilder;
 
   bool get analyzeAll => options.analyzeAll || compileAll;
 
@@ -355,7 +327,6 @@
         return new Future.sync(() => runInternal(uri))
             .catchError((error) => _reporter.onError(uri, error))
             .whenComplete(() {
-          tracer.close();
           measurer.stopWallClock();
         }).then((_) {
           return !compilationFailed;
@@ -369,7 +340,7 @@
   /// Note that [library] has not been scanned yet, nor has its imports/exports
   /// been resolved.
   void onLibraryCreated(LibraryElement library) {
-    _coreTypes.onLibraryCreated(library);
+    _commonElements.onLibraryCreated(library);
     backend.onLibraryCreated(library);
   }
 
@@ -496,20 +467,6 @@
   // [JavaScriptBackend]. Currently needed for testing.
   String get patchVersion => backend.patchVersion;
 
-  Element _unnamedListConstructor;
-  Element get unnamedListConstructor {
-    if (_unnamedListConstructor != null) return _unnamedListConstructor;
-    return _unnamedListConstructor =
-        coreClasses.listClass.lookupDefaultConstructor();
-  }
-
-  Element _filledListConstructor;
-  Element get filledListConstructor {
-    if (_filledListConstructor != null) return _filledListConstructor;
-    return _filledListConstructor =
-        coreClasses.listClass.lookupConstructor("filled");
-  }
-
   /**
    * Get an [Uri] pointing to a patch for the dart: library with
    * the given path. Returns null if there is no patch.
@@ -732,10 +689,12 @@
         }
         assert(mainFunction != null);
 
-        closeResolution();
+        ClosedWorldRefiner closedWorldRefiner = closeResolution();
+        ClosedWorld closedWorld = closedWorldRefiner.closedWorld;
 
         reporter.log('Inferring types...');
-        globalInference.runGlobalTypeInference(mainFunction);
+        globalInference.runGlobalTypeInference(
+            mainFunction, closedWorld, closedWorldRefiner);
 
         if (stopAfterTypeInference) return;
 
@@ -744,11 +703,8 @@
         reporter.log('Compiling...');
         phase = PHASE_COMPILING;
 
-        backend.onCodegenStart();
-        if (hasIsolateSupport) {
-          enqueuer.codegen
-              .applyImpact(backend.enableIsolateSupport(forResolution: false));
-        }
+        codegenWorldBuilder.open(closedWorld);
+        enqueuer.codegen.applyImpact(backend.onCodegenStart(closedWorld));
         if (compileAll) {
           libraryLoader.libraries.forEach((LibraryElement library) {
             enqueuer.codegen.applyImpact(computeImpactForLibrary(library));
@@ -758,32 +714,33 @@
             onProgress: showCodegenProgress);
         enqueuer.codegen.logSummary(reporter.log);
 
-        int programSize = backend.assembleProgram();
+        int programSize = backend.assembleProgram(closedWorld);
 
         if (options.dumpInfo) {
           dumpInfoTask.reportSize(programSize);
-          dumpInfoTask.dumpInfo();
+          dumpInfoTask.dumpInfo(closedWorld);
         }
 
-        backend.sourceInformationStrategy.onComplete();
+        backend.onCodegenEnd();
 
         checkQueues();
       });
 
   /// Perform the steps needed to fully end the resolution phase.
-  void closeResolution() {
+  ClosedWorldRefiner closeResolution() {
     phase = PHASE_DONE_RESOLVING;
 
-    openWorld.closeWorld(reporter);
+    ClosedWorldImpl world = resolutionWorldBuilder.closeWorld(reporter);
     // Compute whole-program-knowledge that the backend needs. (This might
     // require the information computed in [world.closeWorld].)
-    backend.onResolutionComplete();
+    backend.onResolutionComplete(world, world);
 
     deferredLoadTask.onResolutionComplete(mainFunction);
 
     // TODO(johnniwinther): Move this after rti computation but before
     // reflection members computation, and (re-)close the world afterwards.
-    closureToClassMapper.createClosureClasses();
+    closureToClassMapper.createClosureClasses(world);
+    return world;
   }
 
   /// Compute the [WorldImpact] for accessing all elements in [library].
@@ -800,6 +757,9 @@
         cls.ensureResolved(resolution);
         cls.forEachLocalMember(registerStaticUse);
         impactBuilder.registerTypeUse(new TypeUse.instantiation(cls.rawType));
+      } else if (element.isTypedef) {
+        TypedefElement typdef = element;
+        typdef.ensureResolved(resolution);
       } else {
         registerStaticUse(element);
       }
@@ -908,7 +868,7 @@
       });
     }
     if (!REPORT_EXCESS_RESOLUTION) return;
-    var resolved = new Set.from(enqueuer.resolution.processedElements);
+    var resolved = new Set.from(enqueuer.resolution.processedEntities);
     for (Element e in enqueuer.codegen.processedEntities) {
       resolved.remove(e);
     }
@@ -939,7 +899,7 @@
       // TODO(ahe): Add structured diagnostics to the compiler API and
       // use it to separate this from the --verbose option.
       assert(phase == PHASE_RESOLVING);
-      reporter.log('Resolved ${enqueuer.resolution.processedElements.length} '
+      reporter.log('Resolved ${enqueuer.resolution.processedEntities.length} '
           'elements.');
       progress.reset();
     }
@@ -1113,7 +1073,7 @@
 
   void forgetElement(Element element) {
     resolution.forgetElement(element);
-    enqueuer.forgetElement(element);
+    enqueuer.forgetEntity(element);
     if (element is MemberElement) {
       for (Element closure in element.nestedClosures) {
         // TODO(ahe): It would be nice to reuse names of nested closures.
@@ -1163,7 +1123,7 @@
   int hints = 0;
 }
 
-class _CompilerCoreTypes implements CoreTypes, CoreClasses, CommonElements {
+class _CompilerCommonElements implements CommonElements {
   final Resolution resolution;
   final DiagnosticReporter reporter;
 
@@ -1180,7 +1140,7 @@
   // specific backend.
   LibraryElement jsHelperLibrary;
 
-  _CompilerCoreTypes(this.resolution, this.reporter);
+  _CompilerCommonElements(this.resolution, this.reporter);
 
   // From dart:core
 
@@ -1210,8 +1170,8 @@
   ClassElement get functionClass =>
       _functionClass ??= _findRequired(coreLibrary, 'Function');
 
-  Element _functionApplyMethod;
-  Element get functionApplyMethod {
+  MethodElement _functionApplyMethod;
+  MethodElement get functionApplyMethod {
     if (_functionApplyMethod == null) {
       functionClass.ensureResolved(resolution);
       _functionApplyMethod = functionClass.lookupLocalMember('apply');
@@ -1221,7 +1181,7 @@
     return _functionApplyMethod;
   }
 
-  bool isFunctionApplyMethod(Element element) =>
+  bool isFunctionApplyMethod(MemberElement element) =>
       element.name == 'apply' && element.enclosingClass == functionClass;
 
   ClassElement _nullClass;
@@ -1269,8 +1229,8 @@
   ClassElement get resourceClass =>
       _resourceClass ??= _findRequired(coreLibrary, 'Resource');
 
-  Element _identicalFunction;
-  Element get identicalFunction =>
+  MethodElement _identicalFunction;
+  MethodElement get identicalFunction =>
       _identicalFunction ??= coreLibrary.find('identical');
 
   // From dart:async
@@ -1294,7 +1254,7 @@
       _mirrorSystemClass ??= _findRequired(mirrorsLibrary, 'MirrorSystem');
 
   FunctionElement _mirrorSystemGetNameFunction;
-  bool isMirrorSystemGetNameFunction(Element element) {
+  bool isMirrorSystemGetNameFunction(MemberElement element) {
     if (_mirrorSystemGetNameFunction == null) {
       if (!element.isFunction || mirrorsLibrary == null) return false;
       ClassElement cls = mirrorSystemClass;
@@ -1347,45 +1307,48 @@
       _nativeAnnotationClass ??= _findRequired(jsHelperLibrary, 'Native');
 
   @override
-  InterfaceType get objectType {
+  ResolutionDynamicType get dynamicType => const ResolutionDynamicType();
+
+  @override
+  ResolutionInterfaceType get objectType {
     objectClass.ensureResolved(resolution);
     return objectClass.rawType;
   }
 
   @override
-  InterfaceType get boolType {
+  ResolutionInterfaceType get boolType {
     boolClass.ensureResolved(resolution);
     return boolClass.rawType;
   }
 
   @override
-  InterfaceType get doubleType {
+  ResolutionInterfaceType get doubleType {
     doubleClass.ensureResolved(resolution);
     return doubleClass.rawType;
   }
 
   @override
-  InterfaceType get functionType {
+  ResolutionInterfaceType get functionType {
     functionClass.ensureResolved(resolution);
     return functionClass.rawType;
   }
 
   @override
-  InterfaceType get intType {
+  ResolutionInterfaceType get intType {
     intClass.ensureResolved(resolution);
     return intClass.rawType;
   }
 
   @override
-  InterfaceType get resourceType {
+  ResolutionInterfaceType get resourceType {
     resourceClass.ensureResolved(resolution);
     return resourceClass.rawType;
   }
 
   @override
-  InterfaceType listType([DartType elementType]) {
+  ResolutionInterfaceType listType([ResolutionDartType elementType]) {
     listClass.ensureResolved(resolution);
-    InterfaceType type = listClass.rawType;
+    ResolutionInterfaceType type = listClass.rawType;
     if (elementType == null) {
       return type;
     }
@@ -1393,59 +1356,60 @@
   }
 
   @override
-  InterfaceType mapType([DartType keyType, DartType valueType]) {
+  ResolutionInterfaceType mapType(
+      [ResolutionDartType keyType, ResolutionDartType valueType]) {
     mapClass.ensureResolved(resolution);
-    InterfaceType type = mapClass.rawType;
+    ResolutionInterfaceType type = mapClass.rawType;
     if (keyType == null && valueType == null) {
       return type;
     } else if (keyType == null) {
-      keyType = const DynamicType();
+      keyType = const ResolutionDynamicType();
     } else if (valueType == null) {
-      valueType = const DynamicType();
+      valueType = const ResolutionDynamicType();
     }
     return type.createInstantiation([keyType, valueType]);
   }
 
   @override
-  InterfaceType get nullType {
+  ResolutionInterfaceType get nullType {
     nullClass.ensureResolved(resolution);
     return nullClass.rawType;
   }
 
   @override
-  InterfaceType get numType {
+  ResolutionInterfaceType get numType {
     numClass.ensureResolved(resolution);
     return numClass.rawType;
   }
 
   @override
-  InterfaceType get stringType {
+  ResolutionInterfaceType get stringType {
     stringClass.ensureResolved(resolution);
     return stringClass.rawType;
   }
 
   @override
-  InterfaceType get symbolType {
+  ResolutionInterfaceType get symbolType {
     symbolClass.ensureResolved(resolution);
     return symbolClass.rawType;
   }
 
   @override
-  InterfaceType get typeType {
+  ResolutionInterfaceType get typeType {
     typeClass.ensureResolved(resolution);
     return typeClass.rawType;
   }
 
   @override
-  InterfaceType get stackTraceType {
+  ResolutionInterfaceType get stackTraceType {
     stackTraceClass.ensureResolved(resolution);
     return stackTraceClass.rawType;
   }
 
   @override
-  InterfaceType iterableType([DartType elementType]) {
+  ResolutionInterfaceType iterableType([ResolutionDartType elementType]) {
     iterableClass.ensureResolved(resolution);
-    InterfaceType type = iterableClass.rawType;
+    ResolutionInterfaceType type = iterableClass.rawType;
     if (elementType == null) {
       return type;
     }
@@ -1453,9 +1417,9 @@
   }
 
   @override
-  InterfaceType futureType([DartType elementType]) {
+  ResolutionInterfaceType futureType([ResolutionDartType elementType]) {
     futureClass.ensureResolved(resolution);
-    InterfaceType type = futureClass.rawType;
+    ResolutionInterfaceType type = futureClass.rawType;
     if (elementType == null) {
       return type;
     }
@@ -1463,9 +1427,9 @@
   }
 
   @override
-  InterfaceType streamType([DartType elementType]) {
+  ResolutionInterfaceType streamType([ResolutionDartType elementType]) {
     streamClass.ensureResolved(resolution);
-    InterfaceType type = streamClass.rawType;
+    ResolutionInterfaceType type = streamClass.rawType;
     if (elementType == null) {
       return type;
     }
@@ -1504,6 +1468,26 @@
     }
     return element;
   }
+
+  ConstructorElement _unnamedListConstructor;
+  ConstructorElement get unnamedListConstructor =>
+      _unnamedListConstructor ??= listClass.lookupDefaultConstructor();
+
+  ConstructorElement _filledListConstructor;
+  ConstructorElement get filledListConstructor =>
+      _filledListConstructor ??= listClass.lookupConstructor("filled");
+
+  // TODO(johnniwinther): Change types to `ClassElement` when these are not
+  // called with unrelated elements.
+  bool isNumberOrStringSupertype(/*Class*/ Entity element) {
+    return element == coreLibrary.find('Comparable');
+  }
+
+  bool isStringOnlySupertype(/*Class*/ Entity element) {
+    return element == coreLibrary.find('Pattern');
+  }
+
+  bool isListSupertype(/*Class*/ Entity element) => element == iterableClass;
 }
 
 class CompilerDiagnosticReporter extends DiagnosticReporter {
@@ -1792,8 +1776,6 @@
   }
 
   SourceSpan spanFromSpannable(Spannable node) {
-    // TODO(johnniwinther): Disallow `node == null` ?
-    if (node == null) return null;
     if (node == CURRENT_ELEMENT_SPANNABLE) {
       node = currentElement;
     } else if (node == NO_LOCATION_SPANNABLE) {
@@ -1944,12 +1926,6 @@
   ParsingContext get parsingContext => _compiler.parsingContext;
 
   @override
-  CoreClasses get coreClasses => _compiler.coreClasses;
-
-  @override
-  CoreTypes get coreTypes => _compiler.coreTypes;
-
-  @override
   CommonElements get commonElements => _compiler.commonElements;
 
   @override
@@ -1978,14 +1954,14 @@
       _compiler.mirrorUsageAnalyzerTask;
 
   @override
-  LibraryElement get coreLibrary => _compiler._coreTypes.coreLibrary;
+  LibraryElement get coreLibrary => _compiler._commonElements.coreLibrary;
 
   @override
   bool get wasProxyConstantComputedTestingOnly => _proxyConstant != null;
 
   @override
   void registerClass(ClassElement cls) {
-    _compiler.openWorld.registerClass(cls);
+    enqueuer.worldBuilder.registerClass(cls);
   }
 
   @override
@@ -2009,7 +1985,8 @@
   }
 
   @override
-  DartType resolveTypeAnnotation(Element element, TypeAnnotation node) {
+  ResolutionDartType resolveTypeAnnotation(
+      Element element, TypeAnnotation node) {
     return _compiler.resolver.resolveTypeAnnotation(element, node);
   }
 
diff --git a/pkg/compiler/lib/src/constant_system_dart.dart b/pkg/compiler/lib/src/constant_system_dart.dart
index e1d468d..7c3ebc1 100644
--- a/pkg/compiler/lib/src/constant_system_dart.dart
+++ b/pkg/compiler/lib/src/constant_system_dart.dart
@@ -7,7 +7,7 @@
 import 'compiler.dart' show Compiler;
 import 'constants/constant_system.dart';
 import 'constants/values.dart';
-import 'dart_types.dart';
+import 'elements/resolution_types.dart';
 import 'tree/dartstring.dart' show DartString;
 
 const DART_CONSTANT_SYSTEM = const DartConstantSystem();
@@ -203,6 +203,14 @@
   apply(left, right) => left % right;
 }
 
+class RemainderOperation extends ArithmeticNumOperation {
+  final String name = 'remainder';
+  const RemainderOperation();
+  // Not a defined constant operation.
+  num foldNums(num left, num right) => null;
+  apply(left, right) => left.remainder(right);
+}
+
 class TruncatingDivideOperation extends ArithmeticNumOperation {
   final String name = '~/';
   const TruncatingDivideOperation();
@@ -406,6 +414,7 @@
   final multiply = const MultiplyOperation();
   final negate = const NegateOperation();
   final not = const NotOperation();
+  final remainder = const RemainderOperation();
   final shiftLeft = const ShiftLeftOperation();
   final shiftRight = const ShiftRightOperation();
   final subtract = const SubtractOperation();
@@ -433,25 +442,26 @@
   NullConstantValue createNull() => new NullConstantValue();
 
   @override
-  ListConstantValue createList(InterfaceType type, List<ConstantValue> values) {
+  ListConstantValue createList(
+      ResolutionInterfaceType type, List<ConstantValue> values) {
     return new ListConstantValue(type, values);
   }
 
   @override
-  MapConstantValue createMap(Compiler compiler, InterfaceType type,
+  MapConstantValue createMap(Compiler compiler, ResolutionInterfaceType type,
       List<ConstantValue> keys, List<ConstantValue> values) {
     return new MapConstantValue(type, keys, values);
   }
 
   @override
-  ConstantValue createType(Compiler compiler, DartType type) {
+  ConstantValue createType(Compiler compiler, ResolutionDartType type) {
     // TODO(johnniwinther): Change the `Type` type to
-    // `compiler.coreTypes.typeType` and check the backend specific value in
-    // [checkConstMapKeysDontOverrideEquals] in 'members.dart'.
-    return new TypeConstantValue(
-        type,
-        compiler.backend.backendClasses.typeImplementation
-            .computeType(compiler.resolution));
+    // `compiler.commonElements.typeType` and check the backend specific value
+    // in [checkConstMapKeysDontOverrideEquals] in 'members.dart'.
+    ResolutionInterfaceType implementationType = compiler
+        .backend.backendClasses.typeImplementation
+        .computeType(compiler.resolution);
+    return new TypeConstantValue(type, implementationType);
   }
 
   @override
@@ -465,7 +475,7 @@
   bool isBool(ConstantValue constant) => constant.isBool;
   bool isNull(ConstantValue constant) => constant.isNull;
 
-  bool isSubtype(DartTypes types, DartType s, DartType t) {
+  bool isSubtype(DartTypes types, ResolutionDartType s, ResolutionDartType t) {
     return types.isSubtype(s, t);
   }
 }
diff --git a/pkg/compiler/lib/src/constants/constant_constructors.dart b/pkg/compiler/lib/src/constants/constant_constructors.dart
index 7945601..38a182d 100644
--- a/pkg/compiler/lib/src/constants/constant_constructors.dart
+++ b/pkg/compiler/lib/src/constants/constant_constructors.dart
@@ -7,7 +7,7 @@
 library dart2js.constants.constant_constructors;
 
 import '../common.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../resolution/operators.dart';
 import '../resolution/semantic_visitor.dart';
@@ -112,7 +112,7 @@
       FunctionExpression node,
       ConstructorElement constructor,
       NodeList parameters,
-      InterfaceType redirectionType,
+      ResolutionInterfaceType redirectionType,
       ConstructorElement redirectionTarget,
       _) {
     List<String> argumentNames = [];
@@ -230,7 +230,7 @@
   ConstructedConstantExpression visitSuperConstructorInvoke(
       Send node,
       ConstructorElement superConstructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -243,7 +243,7 @@
   ConstructedConstantExpression visitImplicitSuperConstructorInvoke(
       FunctionExpression node,
       ConstructorElement superConstructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       _) {
     return new ConstructedConstantExpression(type, superConstructor,
         CallStructure.NO_ARGS, const <ConstantExpression>[]);
diff --git a/pkg/compiler/lib/src/constants/constant_system.dart b/pkg/compiler/lib/src/constants/constant_system.dart
index edccf03..14d0941 100644
--- a/pkg/compiler/lib/src/constants/constant_system.dart
+++ b/pkg/compiler/lib/src/constants/constant_system.dart
@@ -5,7 +5,7 @@
 library dart2js.constant_system;
 
 import '../compiler.dart' show Compiler;
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../resolution/operators.dart';
 import '../tree/dartstring.dart' show DartString;
 import 'values.dart';
@@ -48,6 +48,7 @@
   BinaryOperation get multiply;
   UnaryOperation get negate;
   UnaryOperation get not;
+  BinaryOperation get remainder;
   BinaryOperation get shiftLeft;
   BinaryOperation get shiftRight;
   BinaryOperation get subtract;
@@ -63,18 +64,19 @@
   ConstantValue createString(DartString string);
   ConstantValue createBool(bool value);
   ConstantValue createNull();
-  ConstantValue createList(InterfaceType type, List<ConstantValue> values);
+  ConstantValue createList(
+      ResolutionInterfaceType type, List<ConstantValue> values);
   // TODO(johnniwinther): Remove the need for [compiler].
-  ConstantValue createMap(Compiler compiler, InterfaceType type,
+  ConstantValue createMap(Compiler compiler, ResolutionInterfaceType type,
       List<ConstantValue> keys, List<ConstantValue> values);
   // TODO(johnniwinther): Remove the need for [compiler].
-  ConstantValue createType(Compiler compiler, DartType type);
+  ConstantValue createType(Compiler compiler, ResolutionDartType type);
   // TODO(johnniwinther): Remove the need for [compiler].
   ConstantValue createSymbol(Compiler compiler, String text);
 
   // We need to special case the subtype check for JavaScript constant
   // system because an int is a double at runtime.
-  bool isSubtype(DartTypes types, DartType s, DartType t);
+  bool isSubtype(DartTypes types, ResolutionDartType s, ResolutionDartType t);
 
   /** Returns true if the [constant] is an integer at runtime. */
   bool isInt(ConstantValue constant);
diff --git a/pkg/compiler/lib/src/constants/constructors.dart b/pkg/compiler/lib/src/constants/constructors.dart
index c0e09b6..8199bbc 100644
--- a/pkg/compiler/lib/src/constants/constructors.dart
+++ b/pkg/compiler/lib/src/constants/constructors.dart
@@ -4,7 +4,7 @@
 
 library dart2js.constants.constructors;
 
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart' show FieldElement;
 import '../universe/call_structure.dart' show CallStructure;
 import '../util/util.dart';
@@ -23,7 +23,7 @@
 
   /// Computes the type of the instance created in a const constructor
   /// invocation with type [newType].
-  InterfaceType computeInstanceType(InterfaceType newType);
+  ResolutionInterfaceType computeInstanceType(ResolutionInterfaceType newType);
 
   /// Computes the constant expressions of the fields of the created instance
   /// in a const constructor invocation with [arguments].
@@ -49,7 +49,7 @@
 
 /// A generative constant constructor.
 class GenerativeConstantConstructor implements ConstantConstructor {
-  final InterfaceType type;
+  final ResolutionInterfaceType type;
   final Map<dynamic /*int|String*/, ConstantExpression> defaultValues;
   final Map<FieldElement, ConstantExpression> fieldMap;
   final ConstructedConstantExpression superConstructorInvocation;
@@ -59,7 +59,7 @@
 
   ConstantConstructorKind get kind => ConstantConstructorKind.GENERATIVE;
 
-  InterfaceType computeInstanceType(InterfaceType newType) {
+  ResolutionInterfaceType computeInstanceType(ResolutionInterfaceType newType) {
     return type.substByContext(newType);
   }
 
@@ -152,7 +152,7 @@
     return ConstantConstructorKind.REDIRECTING_GENERATIVE;
   }
 
-  InterfaceType computeInstanceType(InterfaceType newType) {
+  ResolutionInterfaceType computeInstanceType(ResolutionInterfaceType newType) {
     return thisConstructorInvocation
         .computeInstanceType()
         .substByContext(newType);
@@ -207,7 +207,7 @@
     return ConstantConstructorKind.REDIRECTING_FACTORY;
   }
 
-  InterfaceType computeInstanceType(InterfaceType newType) {
+  ResolutionInterfaceType computeInstanceType(ResolutionInterfaceType newType) {
     return targetConstructorInvocation
         .computeInstanceType()
         .substByContext(newType);
diff --git a/pkg/compiler/lib/src/constants/evaluation.dart b/pkg/compiler/lib/src/constants/evaluation.dart
index 88aad8a..5b2428b 100644
--- a/pkg/compiler/lib/src/constants/evaluation.dart
+++ b/pkg/compiler/lib/src/constants/evaluation.dart
@@ -10,7 +10,8 @@
 
 /// Environment used for evaluating constant expressions.
 abstract class Environment {
-  // TODO(johnniwinther): Replace this with [CoreTypes] and maybe [Backend].
+  // TODO(johnniwinther): Replace this with [CommonElements] and maybe
+  // [Backend].
   Compiler get compiler;
 
   /// Read environments string passed in using the '-Dname=value' option.
diff --git a/pkg/compiler/lib/src/constants/expressions.dart b/pkg/compiler/lib/src/constants/expressions.dart
index 6fc55de..ed2143d 100644
--- a/pkg/compiler/lib/src/constants/expressions.dart
+++ b/pkg/compiler/lib/src/constants/expressions.dart
@@ -7,12 +7,12 @@
 import '../common.dart';
 import '../constants/constant_system.dart';
 import '../core_types.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart'
     show
         ConstructorElement,
         FieldElement,
-        FunctionElement,
+        MethodElement,
         PrefixElement,
         VariableElement;
 import '../resolution/operators.dart';
@@ -80,7 +80,7 @@
 
   /// Returns the type of this constant expression, if it is independent of the
   /// environment values.
-  DartType getKnownType(CoreTypes coreTypes) => null;
+  ResolutionDartType getKnownType(CommonElements commonElements) => null;
 
   /// Returns a text string resembling the Dart code creating this constant.
   String toDartText() {
@@ -236,7 +236,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.boolType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.boolType;
 }
 
 /// Integer literal constant.
@@ -271,7 +272,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.intType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.intType;
 }
 
 /// Double literal constant.
@@ -306,7 +308,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.doubleType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.doubleType;
 }
 
 /// String literal constant.
@@ -341,7 +344,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.stringType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.stringType;
 }
 
 /// Null literal constant.
@@ -374,12 +378,13 @@
   bool _equals(NullConstantExpression other) => true;
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.nullType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.nullType;
 }
 
 /// Literal list constant.
 class ListConstantExpression extends ConstantExpression {
-  final InterfaceType type;
+  final ResolutionInterfaceType type;
   final List<ConstantExpression> values;
 
   ListConstantExpression(this.type, this.values);
@@ -434,7 +439,7 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => type;
+  ResolutionDartType getKnownType(CommonElements commonElements) => type;
 
   @override
   bool get isImplicit => false;
@@ -445,7 +450,7 @@
 
 /// Literal map constant.
 class MapConstantExpression extends ConstantExpression {
-  final InterfaceType type;
+  final ResolutionInterfaceType type;
   final List<ConstantExpression> keys;
   final List<ConstantExpression> values;
 
@@ -513,7 +518,7 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => type;
+  ResolutionDartType getKnownType(CommonElements commonElements) => type;
 
   @override
   bool get isImplicit => false;
@@ -526,7 +531,7 @@
 
 /// Invocation of a const constructor.
 class ConstructedConstantExpression extends ConstantExpression {
-  final InterfaceType type;
+  final ResolutionInterfaceType type;
   final ConstructorElement target;
   final CallStructure callStructure;
   final List<ConstantExpression> arguments;
@@ -563,7 +568,7 @@
         .computeInstanceFields(arguments, callStructure);
   }
 
-  InterfaceType computeInstanceType() {
+  ResolutionInterfaceType computeInstanceType() {
     return target.constantConstructor.computeInstanceType(type);
   }
 
@@ -690,7 +695,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.stringType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.stringType;
 
   @override
   bool get isPotential {
@@ -730,16 +736,17 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.symbolType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.symbolType;
 }
 
 /// Type literal.
 class TypeConstantExpression extends ConstantExpression {
-  /// Either [DynamicType] or a raw [GenericType].
-  final DartType type;
+  /// Either [ResolutionDynamicType] or a raw [GenericType].
+  final ResolutionDartType type;
 
   TypeConstantExpression(this.type) {
-    assert(type is GenericType || type is DynamicType);
+    assert(type is GenericType || type is ResolutionDynamicType);
   }
 
   ConstantExpressionKind get kind => ConstantExpressionKind.TYPE;
@@ -768,7 +775,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.typeType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.typeType;
 }
 
 /// Reference to a constant local, top-level, or static variable.
@@ -805,7 +813,7 @@
 
 /// Reference to a top-level or static function.
 class FunctionConstantExpression extends ConstantExpression {
-  final FunctionElement element;
+  final MethodElement element;
 
   FunctionConstantExpression(this.element);
 
@@ -823,7 +831,7 @@
   @override
   ConstantValue evaluate(
       Environment environment, ConstantSystem constantSystem) {
-    return new FunctionConstantValue(element);
+    return new FunctionConstantValue(element, element.type);
   }
 
   @override
@@ -835,7 +843,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.functionType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.functionType;
 }
 
 /// A constant binary expression like `a * b`.
@@ -885,9 +894,9 @@
         left.apply(arguments), operator, right.apply(arguments));
   }
 
-  DartType getKnownType(CoreTypes coreTypes) {
-    DartType knownLeftType = left.getKnownType(coreTypes);
-    DartType knownRightType = right.getKnownType(coreTypes);
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) {
+    ResolutionDartType knownLeftType = left.getKnownType(commonElements);
+    ResolutionDartType knownRightType = right.getKnownType(commonElements);
     switch (operator.kind) {
       case BinaryOperatorKind.EQ:
       case BinaryOperatorKind.NOT_EQ:
@@ -897,38 +906,38 @@
       case BinaryOperatorKind.LT:
       case BinaryOperatorKind.GTEQ:
       case BinaryOperatorKind.LTEQ:
-        return coreTypes.boolType;
+        return commonElements.boolType;
       case BinaryOperatorKind.ADD:
-        if (knownLeftType == coreTypes.stringType) {
-          assert(knownRightType == coreTypes.stringType);
-          return coreTypes.stringType;
-        } else if (knownLeftType == coreTypes.intType &&
-            knownRightType == coreTypes.intType) {
-          return coreTypes.intType;
+        if (knownLeftType == commonElements.stringType) {
+          assert(knownRightType == commonElements.stringType);
+          return commonElements.stringType;
+        } else if (knownLeftType == commonElements.intType &&
+            knownRightType == commonElements.intType) {
+          return commonElements.intType;
         }
-        assert(knownLeftType == coreTypes.doubleType ||
-            knownRightType == coreTypes.doubleType);
-        return coreTypes.doubleType;
+        assert(knownLeftType == commonElements.doubleType ||
+            knownRightType == commonElements.doubleType);
+        return commonElements.doubleType;
       case BinaryOperatorKind.SUB:
       case BinaryOperatorKind.MUL:
       case BinaryOperatorKind.MOD:
-        if (knownLeftType == coreTypes.intType &&
-            knownRightType == coreTypes.intType) {
-          return coreTypes.intType;
+        if (knownLeftType == commonElements.intType &&
+            knownRightType == commonElements.intType) {
+          return commonElements.intType;
         }
-        assert(knownLeftType == coreTypes.doubleType ||
-            knownRightType == coreTypes.doubleType);
-        return coreTypes.doubleType;
+        assert(knownLeftType == commonElements.doubleType ||
+            knownRightType == commonElements.doubleType);
+        return commonElements.doubleType;
       case BinaryOperatorKind.DIV:
-        return coreTypes.doubleType;
+        return commonElements.doubleType;
       case BinaryOperatorKind.IDIV:
-        return coreTypes.intType;
+        return commonElements.intType;
       case BinaryOperatorKind.AND:
       case BinaryOperatorKind.OR:
       case BinaryOperatorKind.XOR:
       case BinaryOperatorKind.SHR:
       case BinaryOperatorKind.SHL:
-        return coreTypes.intType;
+        return commonElements.intType;
       case BinaryOperatorKind.IF_NULL:
       case BinaryOperatorKind.INDEX:
         throw new UnsupportedError(
@@ -1027,7 +1036,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.boolType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.boolType;
 
   @override
   bool get isPotential {
@@ -1082,8 +1092,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) {
-    return expression.getKnownType(coreTypes);
+  ResolutionDartType getKnownType(CommonElements commonElements) {
+    return expression.getKnownType(commonElements);
   }
 
   @override
@@ -1145,7 +1155,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.intType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.intType;
 
   @override
   bool get isPotential {
@@ -1216,9 +1227,9 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) {
-    DartType trueType = trueExp.getKnownType(coreTypes);
-    DartType falseType = falseExp.getKnownType(coreTypes);
+  ResolutionDartType getKnownType(CommonElements commonElements) {
+    ResolutionDartType trueType = trueExp.getKnownType(commonElements);
+    ResolutionDartType falseType = falseExp.getKnownType(commonElements);
     if (trueType == falseType) {
       return trueType;
     }
@@ -1397,7 +1408,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.boolType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.boolType;
 }
 
 /// A `const int.fromEnvironment` constant.
@@ -1462,7 +1474,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.intType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.intType;
 }
 
 /// A `const String.fromEnvironment` constant.
@@ -1523,7 +1536,8 @@
   }
 
   @override
-  DartType getKnownType(CoreTypes coreTypes) => coreTypes.stringType;
+  ResolutionInterfaceType getKnownType(CommonElements commonElements) =>
+      commonElements.stringType;
 }
 
 /// A constant expression referenced with a deferred prefix.
@@ -1627,11 +1641,11 @@
     }
   }
 
-  void writeTypeArguments(InterfaceType type) {
+  void writeTypeArguments(ResolutionInterfaceType type) {
     if (type.treatAsRaw) return;
     sb.write('<');
     bool needsComma = false;
-    for (DartType value in type.typeArguments) {
+    for (ResolutionDartType value in type.typeArguments) {
       if (needsComma) {
         sb.write(', ');
       }
diff --git a/pkg/compiler/lib/src/constants/values.dart b/pkg/compiler/lib/src/constants/values.dart
index cba4e69..36c14cc 100644
--- a/pkg/compiler/lib/src/constants/values.dart
+++ b/pkg/compiler/lib/src/constants/values.dart
@@ -6,9 +6,9 @@
 
 import '../common.dart';
 import '../core_types.dart';
-import '../dart_types.dart';
-import '../elements/elements.dart'
-    show FieldElement, FunctionElement, PrefixElement;
+import '../elements/elements.dart' show Entity;
+import '../elements/entities.dart';
+import '../elements/types.dart';
 import '../tree/dartstring.dart';
 import '../util/util.dart' show Hashing;
 
@@ -82,7 +82,7 @@
   bool get isNegativeInfinity => false;
 
   // TODO(johnniwinther): Replace with a 'type' getter.
-  DartType getType(CoreTypes types);
+  DartType getType(CommonElements types);
 
   List<ConstantValue> getDependencies();
 
@@ -112,11 +112,11 @@
 }
 
 class FunctionConstantValue extends ConstantValue {
-  FunctionElement element;
+  final FunctionEntity element;
+  // TODO(johnniwinther): Should the type be derived from [element].
+  final FunctionType type;
 
-  FunctionConstantValue(this.element) {
-    assert(element.type != null);
-  }
+  FunctionConstantValue(this.element, this.type);
 
   bool get isFunction => true;
 
@@ -131,7 +131,7 @@
     return new DartString.literal(element.name);
   }
 
-  DartType getType(CoreTypes types) => element.type;
+  DartType getType(CommonElements types) => type;
 
   int get hashCode => (17 * element.hashCode) & 0x7fffffff;
 
@@ -140,7 +140,7 @@
   ConstantValueKind get kind => ConstantValueKind.FUNCTION;
 
   String toDartText() {
-    if (element.isStatic) {
+    if (element.enclosingClass != null) {
       return '${element.enclosingClass.name}.${element.name}';
     } else {
       return '${element.name}';
@@ -189,7 +189,7 @@
 
   get primitiveValue => null;
 
-  DartType getType(CoreTypes types) => types.nullType;
+  DartType getType(CommonElements types) => types.nullType;
 
   // The magic constant has no meaning. It is just a random value.
   int get hashCode => 785965825;
@@ -261,7 +261,7 @@
 
   bool get isOne => primitiveValue == 1;
 
-  DartType getType(CoreTypes types) => types.intType;
+  DartType getType(CommonElements types) => types.intType;
 
   // We have to override the equality operator so that ints and doubles are
   // treated as separate constants.
@@ -322,7 +322,7 @@
 
   bool get isNegativeInfinity => primitiveValue == -double.INFINITY;
 
-  DartType getType(CoreTypes types) => types.doubleType;
+  DartType getType(CommonElements types) => types.doubleType;
 
   bool operator ==(var other) {
     if (other is! DoubleConstantValue) return false;
@@ -359,7 +359,7 @@
 
   bool get isBool => true;
 
-  DartType getType(CoreTypes types) => types.boolType;
+  DartType getType(CommonElements types) => types.boolType;
 
   BoolConstantValue negate();
 
@@ -427,7 +427,7 @@
 
   bool get isString => true;
 
-  DartType getType(CoreTypes types) => types.stringType;
+  DartType getType(CommonElements types) => types.stringType;
 
   bool operator ==(var other) {
     if (identical(this, other)) return true;
@@ -458,7 +458,7 @@
 
   bool get isObject => true;
 
-  DartType getType(CoreTypes types) => type;
+  DartType getType(CommonElements types) => type;
 
   void _unparseTypeArguments(StringBuffer sb) {
     if (!type.treatAsRaw) {
@@ -635,20 +635,19 @@
 }
 
 class InterceptorConstantValue extends ConstantValue {
-  /// The type for which this interceptor holds the methods.  The constant
-  /// is a dispatch table for this type.
-  final DartType dispatchedType;
+  /// The class for which this interceptor holds the methods.  The constant
+  /// is a dispatch table for this class.
+  final ClassEntity cls;
 
-  InterceptorConstantValue(this.dispatchedType);
+  InterceptorConstantValue(this.cls);
 
   bool get isInterceptor => true;
 
   bool operator ==(other) {
-    return other is InterceptorConstantValue &&
-        dispatchedType == other.dispatchedType;
+    return other is InterceptorConstantValue && cls == other.cls;
   }
 
-  int get hashCode => dispatchedType.hashCode * 43;
+  int get hashCode => cls.hashCode * 43;
 
   List<ConstantValue> getDependencies() => const <ConstantValue>[];
 
@@ -656,16 +655,16 @@
     return visitor.visitInterceptor(this, arg);
   }
 
-  DartType getType(CoreTypes types) => const DynamicType();
+  DartType getType(CommonElements types) => types.dynamicType;
 
   ConstantValueKind get kind => ConstantValueKind.INTERCEPTOR;
 
   String toDartText() {
-    return 'interceptor($dispatchedType)';
+    return 'interceptor($cls)';
   }
 
   String toStructuredText() {
-    return 'InterceptorConstant(${dispatchedType.getStringAsDeclared("o")})';
+    return 'InterceptorConstant(${cls.name})';
   }
 }
 
@@ -689,7 +688,7 @@
     return visitor.visitSynthetic(this, arg);
   }
 
-  DartType getType(CoreTypes types) => const DynamicType();
+  DartType getType(CommonElements types) => types.dynamicType;
 
   ConstantValueKind get kind => ConstantValueKind.SYNTHETIC;
 
@@ -701,11 +700,11 @@
 class ConstructedConstantValue extends ObjectConstantValue {
   // TODO(johnniwinther): Make [fields] private to avoid misuse of the map
   // ordering and mutability.
-  final Map<FieldElement, ConstantValue> fields;
+  final Map<FieldEntity, ConstantValue> fields;
   final int hashCode;
 
   ConstructedConstantValue(
-      InterfaceType type, Map<FieldElement, ConstantValue> fields)
+      InterfaceType type, Map<FieldEntity, ConstantValue> fields)
       : this.fields = fields,
         hashCode = Hashing.unorderedMapHash(fields, Hashing.objectHash(type)),
         super(type) {
@@ -722,7 +721,7 @@
     if (hashCode != other.hashCode) return false;
     if (type != other.type) return false;
     if (fields.length != other.fields.length) return false;
-    for (FieldElement field in fields.keys) {
+    for (FieldEntity field in fields.keys) {
       if (fields[field] != other.fields[field]) return false;
     }
     return true;
@@ -738,11 +737,11 @@
 
   String toDartText() {
     StringBuffer sb = new StringBuffer();
-    sb.write(type.name);
+    sb.write(type.element.name);
     _unparseTypeArguments(sb);
     sb.write('(');
     int i = 0;
-    fields.forEach((FieldElement field, ConstantValue value) {
+    fields.forEach((FieldEntity field, ConstantValue value) {
       if (i > 0) sb.write(',');
       sb.write(field.name);
       sb.write('=');
@@ -759,7 +758,7 @@
     sb.write(type);
     sb.write('(');
     int i = 0;
-    fields.forEach((FieldElement field, ConstantValue value) {
+    fields.forEach((FieldEntity field, ConstantValue value) {
       if (i > 0) sb.write(',');
       sb.write(field.name);
       sb.write('=');
@@ -777,7 +776,7 @@
   DeferredConstantValue(this.referenced, this.prefix);
 
   final ConstantValue referenced;
-  final PrefixElement prefix;
+  final Entity prefix;
 
   bool get isReference => true;
 
@@ -793,7 +792,7 @@
 
   accept(ConstantValueVisitor visitor, arg) => visitor.visitDeferred(this, arg);
 
-  DartType getType(CoreTypes types) => referenced.getType(types);
+  DartType getType(CommonElements types) => referenced.getType(types);
 
   ConstantValueKind get kind => ConstantValueKind.DEFERRED;
 
@@ -819,7 +818,7 @@
   List<ConstantValue> getDependencies() => const <ConstantValue>[];
 
   @override
-  DartType getType(CoreTypes types) => const DynamicType();
+  DartType getType(CommonElements types) => types.dynamicType;
 
   ConstantValueKind get kind => ConstantValueKind.NON_CONSTANT;
 
diff --git a/pkg/compiler/lib/src/core_types.dart b/pkg/compiler/lib/src/core_types.dart
index ea201f9..3108c1a 100644
--- a/pkg/compiler/lib/src/core_types.dart
+++ b/pkg/compiler/lib/src/core_types.dart
@@ -5,135 +5,133 @@
 // TODO(sigmund): rename and move to common/elements.dart
 library dart2js.type_system;
 
-import 'dart_types.dart';
-import 'elements/elements.dart'
-    show
-        ClassElement,
-        ConstructorElement,
-        FunctionElement,
-        LibraryElement,
-        Element;
+import 'elements/types.dart';
+import 'elements/entities.dart';
+import 'elements/elements.dart' show Entity;
 
-/// The core classes in Dart.
-abstract class CoreClasses {
+/// The common elements and types in Dart.
+abstract class CommonElements {
   /// The `Object` class defined in 'dart:core'.
-  ClassElement get objectClass;
+  ClassEntity get objectClass;
 
   /// The `bool` class defined in 'dart:core'.
-  ClassElement get boolClass;
+  ClassEntity get boolClass;
 
   /// The `num` class defined in 'dart:core'.
-  ClassElement get numClass;
+  ClassEntity get numClass;
 
   /// The `int` class defined in 'dart:core'.
-  ClassElement get intClass;
+  ClassEntity get intClass;
 
   /// The `double` class defined in 'dart:core'.
-  ClassElement get doubleClass;
+  ClassEntity get doubleClass;
 
   /// The `Resource` class defined in 'dart:core'.
-  ClassElement get resourceClass;
+  ClassEntity get resourceClass;
 
   /// The `String` class defined in 'dart:core'.
-  ClassElement get stringClass;
+  ClassEntity get stringClass;
 
   /// The `Symbol` class defined in 'dart:core'.
-  ClassElement get symbolClass;
+  ClassEntity get symbolClass;
 
   /// The `Function` class defined in 'dart:core'.
-  ClassElement get functionClass;
+  ClassEntity get functionClass;
 
   /// The `Null` class defined in 'dart:core'.
-  ClassElement get nullClass;
+  ClassEntity get nullClass;
 
   /// The `Type` class defined in 'dart:core'.
-  ClassElement get typeClass;
+  ClassEntity get typeClass;
 
   /// The `StackTrace` class defined in 'dart:core';
-  ClassElement get stackTraceClass;
+  ClassEntity get stackTraceClass;
 
   /// The `List` class defined in 'dart:core';
-  ClassElement get listClass;
+  ClassEntity get listClass;
 
   /// The `Map` class defined in 'dart:core';
-  ClassElement get mapClass;
+  ClassEntity get mapClass;
 
   /// The `Iterable` class defined in 'dart:core';
-  ClassElement get iterableClass;
+  ClassEntity get iterableClass;
 
-  /// The `Future` class defined in 'async';
-  ClassElement get futureClass;
+  /// The `Future` class defined in 'async';.
+  ClassEntity get futureClass;
 
   /// The `Stream` class defined in 'async';
-  ClassElement get streamClass;
-}
+  ClassEntity get streamClass;
 
-/// TODO(sigmund): delete CoreClasses and merge it here.
-abstract class CommonElements extends CoreClasses {
   /// The dart:core library.
-  LibraryElement get coreLibrary;
+  LibraryEntity get coreLibrary;
 
   /// The dart:async library.
-  LibraryElement get asyncLibrary;
+  LibraryEntity get asyncLibrary;
 
   /// The dart:mirrors library. Null if the program doesn't access dart:mirrors.
-  LibraryElement get mirrorsLibrary;
+  LibraryEntity get mirrorsLibrary;
 
   /// The dart:typed_data library.
-  LibraryElement get typedDataLibrary;
+  LibraryEntity get typedDataLibrary;
 
   /// The `NativeTypedData` class from dart:typed_data.
-  ClassElement get typedDataClass;
+  ClassEntity get typedDataClass;
 
   // TODO(johnniwinther): Move this to the JavaScriptBackend.
   /// The class for patch annotation defined in dart:_js_helper.
-  ClassElement get patchAnnotationClass;
+  ClassEntity get patchAnnotationClass;
 
   // TODO(johnniwinther): Move this to the JavaScriptBackend.
-  ClassElement get nativeAnnotationClass;
+  ClassEntity get nativeAnnotationClass;
 
   /// Constructor of the `Symbol` class. This getter will ensure that `Symbol`
   /// is resolved and lookup the constructor on demand.
-  ConstructorElement get symbolConstructor;
+  FunctionEntity get symbolConstructor;
 
   /// Whether [element] is the same as [symbolConstructor]. Used to check
   /// for the constructor without computing it until it is likely to be seen.
-  bool isSymbolConstructor(Element e);
+  bool isSymbolConstructor(Entity e);
 
   /// The `MirrorSystem` class in dart:mirrors.
-  ClassElement get mirrorSystemClass;
+  ClassEntity get mirrorSystemClass;
 
   /// Whether [element] is `MirrorClass.getName`. Used to check for the use of
   /// that static method without forcing the resolution of the `MirrorSystem`
   /// class until it is necessary.
-  bool isMirrorSystemGetNameFunction(Element element);
+  bool isMirrorSystemGetNameFunction(MemberEntity element);
 
   /// The `MirrorsUsed` annotation in dart:mirrors.
-  ClassElement get mirrorsUsedClass;
+  ClassEntity get mirrorsUsedClass;
 
   /// Whether [element] is the constructor of the `MirrorsUsed` class. Used to
   /// check for the constructor without forcing the resolution of the
   /// `MirrorsUsed` class until it is necessary.
-  bool isMirrorsUsedConstructor(ConstructorElement element);
+  bool isMirrorsUsedConstructor(FunctionEntity element);
 
   /// The `DeferredLibrary` annotation in dart:async that was used before the
   /// deferred import syntax was introduced.
   // TODO(sigmund): drop support for this old syntax?
-  ClassElement get deferredLibraryClass;
+  ClassEntity get deferredLibraryClass;
 
   /// The function `identical` in dart:core.
-  FunctionElement get identicalFunction;
+  FunctionEntity get identicalFunction;
 
   /// The method `Function.apply`.
-  FunctionElement get functionApplyMethod;
+  FunctionEntity get functionApplyMethod;
 
   /// Whether [element] is the same as [functionApplyMethod]. This will not
   /// resolve the apply method if it hasn't been seen yet during compilation.
-  bool isFunctionApplyMethod(Element element);
-}
+  bool isFunctionApplyMethod(MemberEntity element);
 
-/// The core types in Dart.
-abstract class CoreTypes {
+  /// The unnamed constructor of `List`.
+  FunctionEntity get unnamedListConstructor;
+
+  /// The 'filled' constructor of `List`.
+  FunctionEntity get filledListConstructor;
+
+  /// The `dynamic` type.
+  DynamicType get dynamicType;
+
   /// The `Object` type defined in 'dart:core'.
   InterfaceType get objectType;
 
@@ -188,9 +186,6 @@
   /// If no type argument is provided, the canonical raw type is returned.
   InterfaceType iterableType([DartType elementType]);
 
-  /// The `Future` class declaration.
-  ClassElement get futureClass;
-
   /// Returns an instance of the `Future` type defined in 'dart:async' with
   /// [elementType] as its type argument.
   ///
@@ -202,4 +197,13 @@
   ///
   /// If no type argument is provided, the canonical raw type is returned.
   InterfaceType streamType([DartType elementType]);
+
+  /// Returns `true` if [element] is a superclass of `String` or `num`.
+  bool isNumberOrStringSupertype(ClassEntity element);
+
+  /// Returns `true` if [element] is a superclass of `String`.
+  bool isStringOnlySupertype(ClassEntity element);
+
+  /// Returns `true` if [element] is a superclass of `List`.
+  bool isListSupertype(ClassEntity element);
 }
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index d2c8ddb..6055e03 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -15,7 +15,7 @@
         ConstructedConstantValue,
         DeferredConstantValue,
         StringConstantValue;
-import 'dart_types.dart';
+import 'elements/resolution_types.dart';
 import 'elements/elements.dart'
     show
         AccessorElement,
@@ -278,27 +278,27 @@
     }
 
     /// Recursively collects all the dependencies of [type].
-    void collectTypeDependencies(DartType type) {
+    void collectTypeDependencies(ResolutionDartType type) {
       // TODO(het): we would like to separate out types that are only needed for
       // rti from types that are needed for their members.
       if (type is GenericType) {
         type.typeArguments.forEach(collectTypeDependencies);
       }
-      if (type is FunctionType) {
-        for (DartType argumentType in type.parameterTypes) {
+      if (type is ResolutionFunctionType) {
+        for (ResolutionDartType argumentType in type.parameterTypes) {
           collectTypeDependencies(argumentType);
         }
-        for (DartType argumentType in type.optionalParameterTypes) {
+        for (ResolutionDartType argumentType in type.optionalParameterTypes) {
           collectTypeDependencies(argumentType);
         }
-        for (DartType argumentType in type.namedParameterTypes) {
+        for (ResolutionDartType argumentType in type.namedParameterTypes) {
           collectTypeDependencies(argumentType);
         }
         collectTypeDependencies(type.returnType);
-      } else if (type is TypedefType) {
+      } else if (type is ResolutionTypedefType) {
         elements.add(type.element);
         collectTypeDependencies(type.unaliased);
-      } else if (type is InterfaceType) {
+      } else if (type is ResolutionInterfaceType) {
         elements.add(type.element);
       }
     }
@@ -338,7 +338,7 @@
                 default:
               }
             }, visitTypeUse: (TypeUse typeUse) {
-              DartType type = typeUse.type;
+              ResolutionDartType type = typeUse.type;
               switch (typeUse.kind) {
                 case TypeUseKind.TYPE_LITERAL:
                   if (type.isTypedef || type.isInterfaceType) {
@@ -420,7 +420,7 @@
       // If we see a class, add everything its live instance members refer
       // to.  Static members are not relevant, unless we are processing
       // extra dependencies due to mirrors.
-      void addLiveInstanceMember(Element element) {
+      void addLiveInstanceMember(_, Element element) {
         if (!compiler.enqueuer.resolution.hasBeenProcessed(element)) return;
         if (!isMirrorUsage && !element.isInstanceMember) return;
         elements.add(element);
@@ -428,11 +428,7 @@
       }
 
       ClassElement cls = element.declaration;
-      cls.forEachLocalMember(addLiveInstanceMember);
-      if (cls.implementation != cls) {
-        // TODO(ahe): Why doesn't ClassElement.forEachLocalMember do this?
-        cls.implementation.forEachLocalMember(addLiveInstanceMember);
-      }
+      cls.implementation.forEachMember(addLiveInstanceMember);
       for (var type in cls.implementation.allSupertypes) {
         elements.add(type.element.implementation);
       }
@@ -497,7 +493,8 @@
     if (constants.contains(constant)) return;
     constants.add(constant);
     if (constant is ConstructedConstantValue) {
-      _mapDependencies(element: constant.type.element, import: import);
+      ClassElement cls = constant.type.element;
+      _mapDependencies(element: cls, import: import);
     }
     constant.getDependencies().forEach((ConstantValue dependency) {
       _mapConstantDependencies(dependency, import);
@@ -548,8 +545,9 @@
 
     for (ConstantValue dependency in dependentConstants) {
       if (dependency is DeferredConstantValue) {
-        _mapConstantDependencies(dependency,
-            new _DeclaredDeferredImport(dependency.prefix.deferredImport));
+        PrefixElement prefix = dependency.prefix;
+        _mapConstantDependencies(
+            dependency, new _DeclaredDeferredImport(prefix.deferredImport));
       } else {
         _mapConstantDependencies(dependency, import);
       }
@@ -801,7 +799,8 @@
               metadata.ensureResolved(compiler.resolution);
               ConstantValue value =
                   compiler.constants.getConstantValue(metadata.constant);
-              Element element = value.getType(compiler.coreTypes).element;
+              ResolutionDartType type = value.getType(compiler.commonElements);
+              Element element = type.element;
               if (element == deferredLibraryClass) {
                 reporter.reportErrorMessage(
                     import, MessageKind.DEFERRED_OLD_SYNTAX);
@@ -1037,7 +1036,8 @@
         metadata.ensureResolved(compiler.resolution);
         ConstantValue value =
             compiler.constants.getConstantValue(metadata.constant);
-        Element element = value.getType(compiler.coreTypes).element;
+        ResolutionDartType type = value.getType(compiler.commonElements);
+        Element element = type.element;
         if (element == compiler.commonElements.deferredLibraryClass) {
           ConstructedConstantValue constant = value;
           StringConstantValue s = constant.fields.values.single;
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index a65c6ef..7563cea 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -162,7 +162,6 @@
   DEFERRED_LIBRARY_WITHOUT_PREFIX,
   DEFERRED_OLD_SYNTAX,
   DEFERRED_TYPE_ANNOTATION,
-  DEPRECATED_TYPEDEF_MIXIN_SYNTAX,
   DIRECTLY_THROWING_NSM,
   DISALLOWED_LIBRARY_IMPORT,
   DUPLICATE_DEFINITION,
@@ -191,7 +190,6 @@
   EXISTING_DEFINITION,
   EXISTING_LABEL,
   EXPECTED_IDENTIFIER_NOT_RESERVED_WORD,
-  EXPERIMENTAL_ASSERT_MESSAGE,
   EXPONENT_MISSING,
   EXPORT_BEFORE_PARTS,
   EXTERNAL_WITH_BODY,
@@ -385,6 +383,7 @@
   PATCH_POINT_TO_SETTER,
   PATCH_REQUIRED_PARAMETER_COUNT_MISMATCH,
   PATCH_RETURN_TYPE_MISMATCH,
+  PATCH_TYPE_VARIABLES_MISMATCH,
   PLEASE_REPORT_THE_CRASH,
   POSITIONAL_PARAMETER_WITH_EQUALS,
   POTENTIAL_MUTATION,
@@ -1239,12 +1238,14 @@
           ]),
 
       MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC:
-      const MessageTemplate(
-          MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC,
-          "Method type variables are treated as `dynamic` in `as` expressions.",
-          howToFix: "Try using the upper bound of the type variable, or check "
-              "that the blind success of the test does not introduce bugs.",
-          examples: const [
+          const MessageTemplate(
+              MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC,
+              "Method type variables are treated as `dynamic` in `as` "
+              "expressions.",
+              howToFix:
+                  "Try using the upper bound of the type variable, or check "
+                  "that the blind success of the test does not introduce bugs.",
+              examples: const [
             """
 // Method type variables are not reified, so they cannot be tested dynamically.
 bool f<T>(Object o) => o as T;
@@ -1630,7 +1631,7 @@
 main() => new C();
 """,
             """
-typedef C = Object with String;
+class C = Object with String;
 
 main() => new C();
 """
@@ -2478,19 +2479,6 @@
             "main() => +2;  // No longer a valid way to write '2'"
           ]),
 
-      MessageKind.DEPRECATED_TYPEDEF_MIXIN_SYNTAX: const MessageTemplate(
-          MessageKind.DEPRECATED_TYPEDEF_MIXIN_SYNTAX,
-          "'typedef' not allowed here. ",
-          howToFix: "Try replacing 'typedef' with 'class'.",
-          examples: const [
-            """
-class B { }
-class M1 {  }
-typedef C = B with M1;  // Need to replace 'typedef' with 'class'.
-main() { new C(); }
-"""
-          ]),
-
       MessageKind.MIRRORS_EXPECTED_STRING: const MessageTemplate(
           MessageKind.MIRRORS_EXPECTED_STRING,
           "Can't use '#{name}' here because it's an instance of '#{type}' "
@@ -3530,6 +3518,11 @@
       // Patch errors start.
       //////////////////////////////////////////////////////////////////////////////
 
+      MessageKind.PATCH_TYPE_VARIABLES_MISMATCH: const MessageTemplate(
+          MessageKind.PATCH_TYPE_VARIABLES_MISMATCH,
+          "Patch type variables do not match "
+          "type variables on origin method '#{methodName}'."),
+
       MessageKind.PATCH_RETURN_TYPE_MISMATCH: const MessageTemplate(
           MessageKind.PATCH_RETURN_TYPE_MISMATCH,
           "Patch return type '#{patchReturnType}' does not match "
@@ -3664,21 +3657,6 @@
       // Patch errors end.
       //////////////////////////////////////////////////////////////////////////////
 
-      MessageKind.EXPERIMENTAL_ASSERT_MESSAGE: const MessageTemplate(
-          MessageKind.EXPERIMENTAL_ASSERT_MESSAGE,
-          "Experimental language feature 'assertion with message'"
-          " is not supported.",
-          howToFix:
-              "Use option '--assert-message' to use assertions with messages.",
-          examples: const [
-            r'''
-main() {
-  int n = -7;
-  assert(n > 0, 'must be positive: $n');
-}
-'''
-          ]),
-
       MessageKind.IMPORT_EXPERIMENTAL_MIRRORS: const MessageTemplate(
           MessageKind.IMPORT_EXPERIMENTAL_MIRRORS,
           r'''
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index db6a13a..bcb5627 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -24,16 +24,18 @@
 import 'universe/world_builder.dart' show ReceiverConstraint;
 import 'universe/world_impact.dart'
     show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl;
+import 'world.dart' show ClosedWorld;
 
 class ElementInfoCollector extends BaseElementVisitor<Info, dynamic> {
   final Compiler compiler;
+  final ClosedWorld closedWorld;
 
   final AllInfo result = new AllInfo();
   final Map<Element, Info> _elementToInfo = <Element, Info>{};
   final Map<ConstantValue, Info> _constantToInfo = <ConstantValue, Info>{};
   final Map<OutputUnit, OutputUnitInfo> _outputToInfo = {};
 
-  ElementInfoCollector(this.compiler);
+  ElementInfoCollector(this.compiler, this.closedWorld);
 
   void run() {
     compiler.dumpInfoTask._constantToNode.forEach((constant, node) {
@@ -260,12 +262,11 @@
     // TODO(sigmund): why all these checks?
     if (element.isInstanceMember &&
         !element.isAbstract &&
-        compiler.closedWorld.allFunctions.contains(element)) {
+        closedWorld.allFunctions.contains(element as MemberElement)) {
       returnType = '${element.type.returnType}';
     }
     String inferredReturnType = '${_resultOf(element).returnType}';
-    String sideEffects =
-        '${compiler.closedWorld.getSideEffectsOfElement(element)}';
+    String sideEffects = '${closedWorld.getSideEffectsOfElement(element)}';
 
     int inlinedCount = compiler.dumpInfoTask.inlineCount[element];
     if (inlinedCount == null) inlinedCount = 0;
@@ -328,10 +329,9 @@
       // Dump-info currently only works with the full emitter. If another
       // emitter is used it will fail here.
       JavaScriptBackend backend = compiler.backend;
-      full.Emitter emitter = backend.emitter.emitter;
       assert(outputUnit.name != null || outputUnit.isMainOutput);
       OutputUnitInfo info = new OutputUnitInfo(
-          outputUnit.name, emitter.outputBuffers[outputUnit].length);
+          outputUnit.name, backend.emitter.emitter.generatedSize(outputUnit));
       info.imports.addAll(outputUnit.imports
           .map((d) => compiler.deferredLoadTask.importDeferName[d]));
       result.outputUnits.add(info);
@@ -391,8 +391,8 @@
   // is called.
   final Set<jsAst.Node> _tracking = new Set<jsAst.Node>();
   // A mapping from Dart Elements to Javascript AST Nodes.
-  final Map<Element, List<jsAst.Node>> _elementToNodes =
-      <Element, List<jsAst.Node>>{};
+  final Map<Entity, List<jsAst.Node>> _elementToNodes =
+      <Entity, List<jsAst.Node>>{};
   final Map<ConstantValue, jsAst.Node> _constantToNode =
       <ConstantValue, jsAst.Node>{};
   // A mapping from Javascript AST Nodes to the size of their
@@ -419,9 +419,11 @@
   }
 
   final Map<Element, Set<Element>> _dependencies = {};
-  void registerDependency(Element source, Element target) {
+  void registerDependency(Element target) {
     if (compiler.options.dumpInfo) {
-      _dependencies.putIfAbsent(source, () => new Set()).add(target);
+      _dependencies
+          .putIfAbsent(compiler.currentElement, () => new Set())
+          .add(target);
     }
   }
 
@@ -431,8 +433,8 @@
     }
   }
 
-  void unregisterImpact(Element element) {
-    impacts.remove(element);
+  void unregisterImpact(var impactSource) {
+    impacts.remove(impactSource);
   }
 
   /**
@@ -440,7 +442,7 @@
    * [element].  Each [Selection] contains an element that is
    * used and the selector that selected the element.
    */
-  Iterable<Selection> getRetaining(Element element) {
+  Iterable<Selection> getRetaining(Element element, ClosedWorld closedWorld) {
     WorldImpact impact = impacts[element];
     if (impact == null) return const <Selection>[];
 
@@ -449,7 +451,7 @@
         element,
         impact,
         new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) {
-          selections.addAll(compiler.closedWorld.allFunctions
+          selections.addAll(closedWorld.allFunctions
               .filter(dynamicUse.selector, dynamicUse.mask)
               .map((e) => new Selection(e, dynamicUse.mask)));
         }, visitStaticUse: (staticUse) {
@@ -471,7 +473,7 @@
 
   // Registers that a javascript AST node `code` was produced by the
   // dart Element `element`.
-  void registerElementAst(Element element, jsAst.Node code) {
+  void registerElementAst(Entity element, jsAst.Node code) {
     if (compiler.options.dumpInfo) {
       _elementToNodes
           .putIfAbsent(element, () => new List<jsAst.Node>())
@@ -526,18 +528,18 @@
     return sb.toString();
   }
 
-  void dumpInfo() {
+  void dumpInfo(ClosedWorld closedWorld) {
     measure(() {
-      infoCollector = new ElementInfoCollector(compiler)..run();
+      infoCollector = new ElementInfoCollector(compiler, closedWorld)..run();
       StringBuffer jsonBuffer = new StringBuffer();
-      dumpInfoJson(jsonBuffer);
+      dumpInfoJson(jsonBuffer, closedWorld);
       compiler.outputProvider('', 'info.json')
         ..add(jsonBuffer.toString())
         ..close();
     });
   }
 
-  void dumpInfoJson(StringSink buffer) {
+  void dumpInfoJson(StringSink buffer, ClosedWorld closedWorld) {
     JsonEncoder encoder = const JsonEncoder.withIndent('  ');
     Stopwatch stopwatch = new Stopwatch();
     stopwatch.start();
@@ -547,7 +549,7 @@
         infoCollector._elementToInfo.keys.where((k) => k is FunctionElement);
     for (FunctionElement element in functionElements) {
       FunctionInfo info = infoCollector._elementToInfo[element];
-      Iterable<Selection> uses = getRetaining(element);
+      Iterable<Selection> uses = getRetaining(element, closedWorld);
       // Don't bother recording an empty list of dependencies.
       for (Selection selection in uses) {
         // Don't register dart2js builtin functions that are not recorded.
diff --git a/pkg/compiler/lib/src/elements/common.dart b/pkg/compiler/lib/src/elements/common.dart
index 6ab5de2..167582f 100644
--- a/pkg/compiler/lib/src/elements/common.dart
+++ b/pkg/compiler/lib/src/elements/common.dart
@@ -7,10 +7,11 @@
 library elements.common;
 
 import '../common/names.dart' show Identifiers, Names, Uris;
-import '../core_types.dart' show CoreClasses;
-import '../dart_types.dart' show DartType, InterfaceType, FunctionType;
+import '../core_types.dart' show CommonElements;
 import '../util/util.dart' show Link;
 import 'elements.dart';
+import 'resolution_types.dart'
+    show ResolutionDartType, ResolutionInterfaceType, ResolutionFunctionType;
 
 abstract class ElementCommon implements Element {
   @override
@@ -141,7 +142,7 @@
   Element get outermostEnclosingMemberOrTopLevel {
     // TODO(lrn): Why is this called "Outermost"?
     // TODO(johnniwinther): Clean up this method: This method does not return
-    // the outermost for elements in closure classses, but some call-sites rely
+    // the outermost for elements in closure classes, but some call-sites rely
     // on that behavior.
     for (Element e = this; e != null; e = e.enclosingElement) {
       if (e.isClassMember || e.isTopLevel) {
@@ -188,13 +189,13 @@
 
 abstract class ClassElementCommon implements ClassElement {
   @override
-  Link<DartType> get allSupertypes => allSupertypesAndSelf.supertypes;
+  Link<ResolutionDartType> get allSupertypes => allSupertypesAndSelf.supertypes;
 
   @override
   int get hierarchyDepth => allSupertypesAndSelf.maxDepth;
 
   @override
-  InterfaceType asInstanceOf(ClassElement cls) {
+  ResolutionInterfaceType asInstanceOf(ClassElement cls) {
     if (cls == this) return thisType;
     return allSupertypesAndSelf.asInstanceOf(cls);
   }
@@ -439,8 +440,9 @@
   }
 
   @override
-  bool implementsFunction(CoreClasses coreClasses) {
-    return asInstanceOf(coreClasses.functionClass) != null || callType != null;
+  bool implementsFunction(CommonElements commonElements) {
+    return asInstanceOf(commonElements.functionClass) != null ||
+        callType != null;
   }
 
   @override
@@ -454,7 +456,7 @@
     return false;
   }
 
-  FunctionType get callType {
+  ResolutionFunctionType get callType {
     MemberSignature member = lookupInterfaceMember(Names.call);
     return member != null && member.isMethod ? member.type : null;
   }
@@ -496,7 +498,7 @@
 }
 
 abstract class FunctionSignatureCommon implements FunctionSignature {
-  DartType get returnType => type.returnType;
+  ResolutionDartType get returnType => type.returnType;
 
   void forEachRequiredParameter(void function(Element parameter)) {
     requiredParameters.forEach(function);
@@ -601,7 +603,12 @@
   }
 }
 
-enum _FromEnvironmentState { NOT, BOOL, INT, STRING, }
+enum _FromEnvironmentState {
+  NOT,
+  BOOL,
+  INT,
+  STRING,
+}
 
 abstract class ConstructorElementCommon implements ConstructorElement {
   _FromEnvironmentState _fromEnvironmentState;
diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart
index 178ba03..dcf3f09 100644
--- a/pkg/compiler/lib/src/elements/elements.dart
+++ b/pkg/compiler/lib/src/elements/elements.dart
@@ -9,8 +9,7 @@
 import '../compiler.dart' show Compiler;
 import '../constants/constructors.dart';
 import '../constants/expressions.dart';
-import '../core_types.dart' show CoreClasses;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
 import '../ordered_typeset.dart' show OrderedTypeSet;
 import '../resolution/scope.dart' show Scope;
 import '../resolution/tree_elements.dart' show TreeElements;
@@ -18,9 +17,12 @@
 import '../tokens/token.dart'
     show Token, isUserDefinableOperator, isMinusOperator;
 import '../tree/tree.dart';
+import '../universe/call_structure.dart';
 import '../util/characters.dart' show $_;
 import '../util/util.dart';
+import '../world.dart' show ClosedWorld;
 import 'entities.dart';
+import 'resolution_types.dart';
 import 'visitor.dart' show ElementVisitor;
 
 part 'names.dart';
@@ -140,7 +142,7 @@
  * are elements corresponding to "dynamic", "null", and unresolved
  * references.
  *
- * Elements are distinct from types ([DartType]). For example, there
+ * Elements are distinct from types ([ResolutionDartType]). For example, there
  * is one declaration of the class List, but several related types,
  * for example, List, List<int>, List<String>, etc.
  *
@@ -675,21 +677,6 @@
     return null;
   }
 
-  static bool isNumberOrStringSupertype(Element element, Compiler compiler) {
-    LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
-    return (element == coreLibrary.find('Comparable'));
-  }
-
-  static bool isStringOnlySupertype(Element element, Compiler compiler) {
-    LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
-    return element == coreLibrary.find('Pattern');
-  }
-
-  static bool isListSupertype(Element element, Compiler compiler) {
-    LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
-    return element == coreLibrary.find('Iterable');
-  }
-
   /// A `compareTo` function that places [Element]s in a consistent order based
   /// on the source code order.
   static int compareByPosition(Element a, Element b) {
@@ -770,23 +757,23 @@
   }
 
   static bool isFixedListConstructorCall(
-      Element element, Send node, Compiler compiler) {
-    return element == compiler.unnamedListConstructor &&
+      Element element, Send node, CommonElements commonElements) {
+    return element == commonElements.unnamedListConstructor &&
         node.isCall &&
         !node.arguments.isEmpty &&
         node.arguments.tail.isEmpty;
   }
 
   static bool isGrowableListConstructorCall(
-      Element element, Send node, Compiler compiler) {
-    return element == compiler.unnamedListConstructor &&
+      Element element, Send node, CommonElements commonElements) {
+    return element == commonElements.unnamedListConstructor &&
         node.isCall &&
         node.arguments.isEmpty;
   }
 
   static bool isFilledListConstructorCall(
-      Element element, Send node, Compiler compiler) {
-    return element == compiler.filledListConstructor &&
+      Element element, Send node, CommonElements commonElements) {
+    return element == commonElements.filledListConstructor &&
         node.isCall &&
         !node.arguments.isEmpty &&
         !node.arguments.tail.isEmpty &&
@@ -794,17 +781,17 @@
   }
 
   static bool isConstructorOfTypedArraySubclass(
-      Element element, Compiler compiler) {
-    if (compiler.commonElements.typedDataLibrary == null) return false;
+      Element element, ClosedWorld closedWorld) {
+    if (closedWorld.commonElements.typedDataLibrary == null) return false;
     if (!element.isConstructor) return false;
     ConstructorElement constructor = element.implementation;
     constructor = constructor.effectiveTarget;
     ClassElement cls = constructor.enclosingClass;
-    return cls.library == compiler.commonElements.typedDataLibrary &&
-        compiler.backend.isNative(cls) &&
-        compiler.closedWorld
-            .isSubtypeOf(cls, compiler.commonElements.typedDataClass) &&
-        compiler.closedWorld.isSubtypeOf(cls, compiler.coreClasses.listClass) &&
+    return cls.library == closedWorld.commonElements.typedDataLibrary &&
+        closedWorld.backendClasses.isNativeClass(cls) &&
+        closedWorld.isSubtypeOf(
+            cls, closedWorld.commonElements.typedDataClass) &&
+        closedWorld.isSubtypeOf(cls, closedWorld.commonElements.listClass) &&
         constructor.name == '';
   }
 
@@ -833,6 +820,131 @@
     // label is also always unused.
     return element == null || element.statement != body;
   }
+
+  /**
+   * Returns a `List` with the evaluated arguments in the normalized order.
+   *
+   * [compileDefaultValue] is a function that returns a compiled constant
+   * of an optional argument that is not in [compiledArguments].
+   *
+   * Precondition: `callStructure.signatureApplies(element.type)`.
+   *
+   * Invariant: [element] must be the implementation element.
+   */
+  static List<T> makeArgumentsList<T>(
+      CallStructure callStructure,
+      Link<Node> arguments,
+      FunctionElement element,
+      T compileArgument(Node argument),
+      T compileDefaultValue(ParameterElement element)) {
+    assert(invariant(element, element.isImplementation));
+    List<T> result = <T>[];
+
+    FunctionSignature parameters = element.functionSignature;
+    parameters.forEachRequiredParameter((ParameterElement element) {
+      result.add(compileArgument(arguments.head));
+      arguments = arguments.tail;
+    });
+
+    if (!parameters.optionalParametersAreNamed) {
+      parameters.forEachOptionalParameter((ParameterElement element) {
+        if (!arguments.isEmpty) {
+          result.add(compileArgument(arguments.head));
+          arguments = arguments.tail;
+        } else {
+          result.add(compileDefaultValue(element));
+        }
+      });
+    } else {
+      // Visit named arguments and add them into a temporary list.
+      List compiledNamedArguments = [];
+      for (; !arguments.isEmpty; arguments = arguments.tail) {
+        NamedArgument namedArgument = arguments.head;
+        compiledNamedArguments.add(compileArgument(namedArgument.expression));
+      }
+      // Iterate over the optional parameters of the signature, and try to
+      // find them in [compiledNamedArguments]. If found, we use the
+      // value in the temporary list, otherwise the default value.
+      parameters.orderedOptionalParameters.forEach((ParameterElement element) {
+        int foundIndex = callStructure.namedArguments.indexOf(element.name);
+        if (foundIndex != -1) {
+          result.add(compiledNamedArguments[foundIndex]);
+        } else {
+          result.add(compileDefaultValue(element));
+        }
+      });
+    }
+    return result;
+  }
+
+  /**
+   * Fills [list] with the arguments in the order expected by
+   * [callee], and where [caller] is a synthesized element
+   *
+   * [compileArgument] is a function that returns a compiled version
+   * of a parameter of [callee].
+   *
+   * [compileConstant] is a function that returns a compiled constant
+   * of an optional argument that is not in the parameters of [callee].
+   *
+   * Returns [:true:] if the signature of the [caller] matches the
+   * signature of the [callee], [:false:] otherwise.
+   */
+  static bool addForwardingElementArgumentsToList<T>(
+      ConstructorElement caller,
+      List<T> list,
+      ConstructorElement callee,
+      T compileArgument(ParameterElement element),
+      T compileConstant(ParameterElement element)) {
+    assert(invariant(caller, !callee.isMalformed,
+        message: "Cannot compute arguments to malformed constructor: "
+            "$caller calling $callee."));
+
+    FunctionSignature signature = caller.functionSignature;
+    Map<Node, ParameterElement> mapping = <Node, ParameterElement>{};
+
+    // TODO(ngeoffray): This is a hack that fakes up AST nodes, so
+    // that we can call [addArgumentsToList].
+    Link<Node> computeCallNodesFromParameters() {
+      LinkBuilder<Node> builder = new LinkBuilder<Node>();
+      signature.forEachRequiredParameter((ParameterElement element) {
+        Node node = element.node;
+        mapping[node] = element;
+        builder.addLast(node);
+      });
+      if (signature.optionalParametersAreNamed) {
+        signature.forEachOptionalParameter((ParameterElement element) {
+          mapping[element.initializer] = element;
+          builder.addLast(new NamedArgument(null, null, element.initializer));
+        });
+      } else {
+        signature.forEachOptionalParameter((ParameterElement element) {
+          Node node = element.node;
+          mapping[node] = element;
+          builder.addLast(node);
+        });
+      }
+      return builder.toLink();
+    }
+
+    T internalCompileArgument(Node node) {
+      return compileArgument(mapping[node]);
+    }
+
+    Link<Node> nodes = computeCallNodesFromParameters();
+
+    // Synthesize a structure for the call.
+    // TODO(ngeoffray): Should the resolver do it instead?
+    CallStructure callStructure = new CallStructure(
+        signature.parameterCount, signature.type.namedParameters);
+    if (!callStructure.signatureApplies(signature.type)) {
+      return false;
+    }
+    list.addAll(makeArgumentsList<T>(callStructure, nodes, callee,
+        internalCompileArgument, compileConstant));
+
+    return true;
+  }
 }
 
 /// An element representing an erroneous resolution.
@@ -918,7 +1030,7 @@
 }
 
 abstract class LibraryElement extends Element
-    implements ScopeContainerElement, AnalyzableElement {
+    implements ScopeContainerElement, AnalyzableElement, LibraryEntity {
   /**
    * The canonical uri for this library.
    *
@@ -1012,18 +1124,18 @@
   /// arguments.
   ///
   /// For instance `F<T>` for `typedef void F<T>(T t)`.
-  TypedefType get thisType;
+  ResolutionTypedefType get thisType;
 
   /// The type defined by this typedef with `dynamic` as its type arguments.
   ///
   /// For instance `F<dynamic>` for `typedef void F<T>(T t)`.
-  TypedefType get rawType;
+  ResolutionTypedefType get rawType;
 
   /// The type, function type if well-defined, for which this typedef is an
   /// alias.
   ///
   /// For instance `(int)->void` for `typedef void F(int)`.
-  DartType get alias;
+  ResolutionDartType get alias;
 
   void checkCyclicReference(Resolution resolution);
 }
@@ -1179,9 +1291,9 @@
 }
 
 abstract class FunctionSignature {
-  FunctionType get type;
-  DartType get returnType;
-  List<DartType> get typeVariables;
+  ResolutionFunctionType get type;
+  ResolutionDartType get returnType;
+  List<ResolutionDartType> get typeVariables;
   List<FormalElement> get requiredParameters;
   List<FormalElement> get optionalParameters;
 
@@ -1222,7 +1334,7 @@
   List<ParameterElement> get parameters;
 
   /// The type of this function.
-  FunctionType get type;
+  ResolutionFunctionType get type;
 
   /// The synchronous/asynchronous marker on this function.
   AsyncMarker get asyncMarker;
@@ -1367,7 +1479,8 @@
 
   /// Compute the type of the effective target of this constructor for an
   /// instantiation site with type [:newType:].
-  InterfaceType computeEffectiveTargetType(InterfaceType newType);
+  ResolutionInterfaceType computeEffectiveTargetType(
+      ResolutionInterfaceType newType);
 
   /// If this is a synthesized constructor [definingConstructor] points to
   /// the generative constructor from which this constructor was created.
@@ -1417,12 +1530,20 @@
 /// [GenericElement] defines the common interface for generic functions and
 /// [TypeDeclarationElement].
 abstract class GenericElement extends Element implements AstElement {
+  /// Do not use [computeType] outside of the resolver.
+  ///
+  /// Trying to access a type that has not been computed in resolution is an
+  /// error and calling [computeType] covers that error.
+  /// This method will go away!
+  @deprecated
+  ResolutionDartType computeType(Resolution resolution);
+
   /**
    * The type variables declared on this declaration. The type variables are not
    * available until the type of the element has been computed through
    * [computeType].
    */
-  List<DartType> get typeVariables;
+  List<ResolutionDartType> get typeVariables;
 }
 
 /// [TypeDeclarationElement] defines the common interface for class/interface
@@ -1463,9 +1584,9 @@
    * used to distinguish explicit and implicit uses of the [dynamic]
    * type arguments. For instance should [:List:] be the [rawType] of the
    * [:List:] class element whereas [:List<dynamic>:] should be its own
-   * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using
-   * this distinction, we can print the raw type with type arguments only when
-   * the input source has used explicit type arguments.
+   * instantiation of [ResolutionInterfaceType] with [:dynamic:] as type
+   * argument. Using this distinction, we can print the raw type with type
+   * arguments only when the input source has used explicit type arguments.
    */
   GenericType get rawType;
 
@@ -1479,24 +1600,24 @@
   /// The length of the longest inheritance path from [:Object:].
   int get hierarchyDepth;
 
-  InterfaceType get rawType;
-  InterfaceType get thisType;
+  ResolutionInterfaceType get rawType;
+  ResolutionInterfaceType get thisType;
   ClassElement get superclass;
 
   /// The direct supertype of this class.
-  DartType get supertype;
+  ResolutionDartType get supertype;
 
   /// Ordered set of all supertypes of this class including the class itself.
   OrderedTypeSet get allSupertypesAndSelf;
 
   /// A list of all supertypes of this class excluding the class itself.
-  Link<DartType> get allSupertypes;
+  Link<ResolutionDartType> get allSupertypes;
 
   /// Returns the this type of this class as an instance of [cls].
-  InterfaceType asInstanceOf(ClassElement cls);
+  ResolutionInterfaceType asInstanceOf(ClassElement cls);
 
   /// A list of all direct superinterfaces of this class.
-  Link<DartType> get interfaces;
+  Link<ResolutionDartType> get interfaces;
 
   bool get hasConstructor;
   Link<Element> get constructors;
@@ -1533,7 +1654,7 @@
 
   /// Returns `true` if this class implements [Function] either by directly
   /// implementing the interface or by providing a [call] method.
-  bool implementsFunction(CoreClasses coreClasses);
+  bool implementsFunction(CommonElements commonElements);
 
   /// Returns `true` if this class extends [cls] directly or indirectly.
   ///
@@ -1607,12 +1728,12 @@
 
   /// Returns the type of the 'call' method in the interface of this class, or
   /// `null` if the interface has no 'call' method.
-  FunctionType get callType;
+  ResolutionFunctionType get callType;
 }
 
 abstract class MixinApplicationElement extends ClassElement {
   ClassElement get mixin;
-  InterfaceType get mixinType;
+  ResolutionInterfaceType get mixinType;
 
   /// If this is an unnamed mixin application [subclass] is the subclass for
   /// which this mixin application is created.
@@ -1653,7 +1774,7 @@
 abstract class JumpTarget extends Local {
   Node get statement;
   int get nestingLevel;
-  Link<LabelDefinition> get labels;
+  List<LabelDefinition> get labels;
 
   bool get isTarget;
   bool get isBreakTarget;
@@ -1669,7 +1790,7 @@
 
 /// The [Element] for a type variable declaration on a generic class or typedef.
 abstract class TypeVariableElement extends Element
-    implements AstElement, TypedElement {
+    implements AstElement, TypedElement, TypeVariableEntity {
   /// The name of this type variable, taking privacy into account.
   Name get memberName;
 
@@ -1685,11 +1806,11 @@
   int get index;
 
   /// The [type] defined by the type variable.
-  TypeVariableType get type;
+  ResolutionTypeVariableType get type;
 
   /// The upper bound on the type variable. If not explicitly declared, this is
   /// `Object`.
-  DartType get bound;
+  ResolutionDartType get bound;
 }
 
 abstract class MetadataAnnotation implements Spannable {
@@ -1713,9 +1834,9 @@
   /// error and calling [computeType] covers that error.
   /// This method will go away!
   @deprecated
-  DartType computeType(Resolution resolution);
+  ResolutionDartType computeType(Resolution resolution);
 
-  DartType get type;
+  ResolutionDartType get type;
 }
 
 /// An [Element] that can define a function type.
@@ -1866,13 +1987,13 @@
   /// The type of the member when accessed. For getters and setters this is the
   /// return type and argument type, respectively. For methods the type is the
   /// [functionType] defined by the return type and parameters.
-  DartType get type;
+  ResolutionDartType get type;
 
   /// The function type of the member. For a getter `Foo get foo` this is
   /// `() -> Foo`, for a setter `void set foo(Foo _)` this is `(Foo) -> void`.
   /// For methods the function type is defined by the return type and
   /// parameters.
-  FunctionType get functionType;
+  ResolutionFunctionType get functionType;
 
   /// Returns `true` if this member is a getter, possibly implictly defined by a
   /// field declaration.
@@ -1914,7 +2035,7 @@
   ///   class B<S> extends A<S> {}
   /// The declarer of `m` in `A` is `A<T>` whereas the declarer of `m` in `B` is
   /// `A<S>`.
-  InterfaceType get declarer;
+  ResolutionInterfaceType get declarer;
 
   /// Returns `true` if this member is static.
   bool get isStatic;
diff --git a/pkg/compiler/lib/src/elements/entities.dart b/pkg/compiler/lib/src/elements/entities.dart
index 7c03e03..6fd1f50 100644
--- a/pkg/compiler/lib/src/elements/entities.dart
+++ b/pkg/compiler/lib/src/elements/entities.dart
@@ -6,14 +6,25 @@
 
 import 'elements.dart' show Entity;
 
+/// Stripped down super interface for library like entities.
+///
+/// Currently only [LibraryElement] but later also kernel based Dart classes
+/// and/or Dart-in-JS classes.
+abstract class LibraryEntity extends Entity {
+  String get libraryName;
+}
+
 /// Stripped down super interface for class like entities.
 ///
 /// Currently only [ClassElement] but later also kernel based Dart classes
 /// and/or Dart-in-JS classes.
 abstract class ClassEntity extends Entity {
   bool get isClosure;
-  void forEachInstanceField(f(ClassEntity cls, FieldEntity field),
-      {bool includeSuperAndInjectedMembers: false});
+}
+
+abstract class TypeVariableEntity extends Entity {
+  Entity get typeDeclaration;
+  int get index;
 }
 
 /// Stripped down super interface for member like entities, that is,
@@ -22,9 +33,14 @@
 /// Currently only [MemberElement] but later also kernel based Dart members
 /// and/or Dart-in-JS properties.
 abstract class MemberEntity extends Entity {
+  bool get isTopLevel;
+  bool get isStatic;
+  bool get isInstanceMember;
+  bool get isConstructor;
   bool get isField;
   bool get isFunction;
   bool get isGetter;
+  bool get isSetter;
   bool get isAssignable;
   ClassEntity get enclosingClass;
 }
diff --git a/pkg/compiler/lib/src/elements/modelx.dart b/pkg/compiler/lib/src/elements/modelx.dart
index b479367..7f887ac 100644
--- a/pkg/compiler/lib/src/elements/modelx.dart
+++ b/pkg/compiler/lib/src/elements/modelx.dart
@@ -11,7 +11,6 @@
 import '../constants/constant_constructors.dart';
 import '../constants/constructors.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
 import '../diagnostics/messages.dart' show MessageTemplate;
 import '../ordered_typeset.dart' show OrderedTypeSet;
 import '../resolution/class_members.dart' show ClassMemberMixin;
@@ -27,6 +26,7 @@
 import '../util/util.dart';
 import 'common.dart';
 import 'elements.dart';
+import 'resolution_types.dart';
 import 'visitor.dart' show ElementVisitor;
 
 /// Object that identifies a declaration site.
@@ -163,7 +163,7 @@
 
   ClassElement get enclosingClass {
     for (Element e = this; e != null; e = e.enclosingElement) {
-      if (e.isClass) return e;
+      if (e.isClass) return e.declaration;
     }
     return null;
   }
@@ -266,7 +266,7 @@
 
   get effectiveTarget => this;
 
-  computeEffectiveTargetType(InterfaceType newType) => unsupported();
+  computeEffectiveTargetType(ResolutionInterfaceType newType) => unsupported();
 
   get definingConstructor => null;
 
@@ -290,7 +290,7 @@
   }
 
   @override
-  List<DartType> get typeVariables => unsupported();
+  List<ResolutionDartType> get typeVariables => unsupported();
 }
 
 /// A constructor that was synthesized to recover from a compile-time error.
@@ -378,7 +378,8 @@
   }
 
   @override
-  void setEffectiveTarget(ConstructorElement target, InterfaceType type,
+  void setEffectiveTarget(
+      ConstructorElement target, ResolutionInterfaceType type,
       {bool isMalformed: false}) {
     throw new UnsupportedError("setEffectiveTarget");
   }
@@ -565,7 +566,7 @@
 
   bool get isTopLevel => false;
 
-  DynamicType get type => const DynamicType();
+  ResolutionDynamicType get type => const ResolutionDynamicType();
 }
 
 /// Element synthesized to diagnose an ambiguous import.
@@ -1274,7 +1275,8 @@
 
   void forEachLocalMember(f(Element member)) => importScope.forEach(f);
 
-  DartType computeType(Resolution resolution) => const DynamicType();
+  ResolutionDartType computeType(Resolution resolution) =>
+      const ResolutionDynamicType();
 
   Token get position => firstPosition;
 
@@ -1299,16 +1301,16 @@
     with
         AstElementMixin,
         AnalyzableElementX,
-        TypeDeclarationElementX<TypedefType>
+        TypeDeclarationElementX<ResolutionTypedefType>
     implements TypedefElement {
   Typedef cachedNode;
 
   /**
    * The type annotation which defines this typedef.
    */
-  DartType aliasCache;
+  ResolutionDartType aliasCache;
 
-  DartType get alias {
+  ResolutionDartType get alias {
     assert(invariant(this, hasBeenCheckedForCycles,
         message: "$this has not been checked for cycles."));
     return aliasCache;
@@ -1340,7 +1342,7 @@
    */
   FunctionSignature functionSignature;
 
-  TypedefType computeType(Resolution resolution) {
+  ResolutionTypedefType computeType(Resolution resolution) {
     if (thisTypeCache != null) return thisTypeCache;
     Typedef node = parseNode(resolution.parsingContext);
     setThisAndRawTypes(createTypeVariables(node.typeParameters));
@@ -1354,8 +1356,8 @@
     }
   }
 
-  TypedefType createType(List<DartType> typeArguments) {
-    return new TypedefType(this, typeArguments);
+  ResolutionTypedefType createType(List<ResolutionDartType> typeArguments) {
+    return new ResolutionTypedefType(this, typeArguments);
   }
 
   Scope buildScope() {
@@ -1383,7 +1385,7 @@
 // forwards its [computeType] and [parseNode] methods to this class.
 class VariableList implements DeclarationSite {
   VariableDefinitions definitions;
-  DartType type;
+  ResolutionDartType type;
   final Modifiers modifiers;
   List<MetadataAnnotation> metadataInternal;
 
@@ -1419,7 +1421,8 @@
     return definitions;
   }
 
-  DartType computeType(Element element, Resolution resolution) => type;
+  ResolutionDartType computeType(Element element, Resolution resolution) =>
+      type;
 }
 
 abstract class ConstantVariableMixin implements VariableElement {
@@ -1559,7 +1562,7 @@
     definitionsCache = definitions;
   }
 
-  DartType computeType(Resolution resolution) {
+  ResolutionDartType computeType(Resolution resolution) {
     if (variables.type != null) return variables.type;
     // Call [parseNode] to ensure that [definitionsCache] and [initializerCache]
     // are set as a consequence of calling [computeType].
@@ -1567,7 +1570,7 @@
     return variables.computeType(this, resolution);
   }
 
-  DartType get type {
+  ResolutionDartType get type {
     assert(invariant(this, variables.type != null,
         message: "Type has not been computed for $this."));
     return variables.type;
@@ -1638,7 +1641,7 @@
       : variables = new VariableList(Modifiers.EMPTY)
           ..definitions = new VariableDefinitions(
               null, Modifiers.EMPTY, new NodeList.singleton(name))
-          ..type = const DynamicType(),
+          ..type = const ResolutionDynamicType(),
         super(name.source, ElementKind.FIELD, enclosingElement);
 
   VariableDefinitions get definitionsCache => variables.definitions;
@@ -1657,7 +1660,7 @@
     throw new UnsupportedError("resolvedAst");
   }
 
-  DynamicType get type => const DynamicType();
+  ResolutionDynamicType get type => const ResolutionDynamicType();
 
   Token get token => node.getBeginToken();
 
@@ -1714,7 +1717,7 @@
     throw new UnsupportedError("copyWithEnclosing");
   }
 
-  DartType computeType(Resolution resolution) => type;
+  ResolutionDartType computeType(Resolution resolution) => type;
 }
 
 /// [Element] for a parameter-like element.
@@ -1723,10 +1726,10 @@
     implements FormalElement {
   final VariableDefinitions definitions;
   final Identifier identifier;
-  DartType typeCache;
+  ResolutionDartType typeCache;
 
   @override
-  List<DartType> get typeVariables => functionSignature.typeVariables;
+  List<ResolutionDartType> get typeVariables => functionSignature.typeVariables;
 
   /**
    * Function signature for a variable with a function type. The signature is
@@ -1748,13 +1751,13 @@
 
   Node parseNode(ParsingContext parsing) => definitions;
 
-  DartType computeType(Resolution resolution) {
+  ResolutionDartType computeType(Resolution resolution) {
     assert(invariant(this, type != null,
         message: "Parameter type has not been set for $this."));
     return type;
   }
 
-  DartType get type {
+  ResolutionDartType get type {
     assert(invariant(this, typeCache != null,
         message: "Parameter type has not been set for $this."));
     return typeCache;
@@ -1777,7 +1780,7 @@
 
   VariableDefinitions get node => definitions;
 
-  FunctionType get functionType => type;
+  ResolutionFunctionType get functionType => type;
 
   accept(ElementVisitor visitor, arg) {
     return visitor.visitFormalElement(this, arg);
@@ -1896,7 +1899,7 @@
 
   bool get isMalformed => true;
 
-  DynamicType get type => const DynamicType();
+  ResolutionDynamicType get type => const ResolutionDynamicType();
 }
 
 class AbstractFieldElementX extends ElementX
@@ -1908,7 +1911,7 @@
   AbstractFieldElementX(String name, Element enclosing)
       : super(name, ElementKind.ABSTRACT_FIELD, enclosing);
 
-  DartType computeType(Compiler compiler) {
+  ResolutionDartType computeType(Compiler compiler) {
     throw "internal error: AbstractFieldElement has no type";
   }
 
@@ -1954,18 +1957,18 @@
 // TODO(karlklose): all these lists should have element type [FormalElement].
 class FunctionSignatureX extends FunctionSignatureCommon
     implements FunctionSignature {
-  final List<DartType> typeVariables;
+  final List<ResolutionDartType> typeVariables;
   final List<Element> requiredParameters;
   final List<Element> optionalParameters;
   final int requiredParameterCount;
   final int optionalParameterCount;
   final bool optionalParametersAreNamed;
   final List<Element> orderedOptionalParameters;
-  final FunctionType type;
+  final ResolutionFunctionType type;
   final bool hasOptionalParameters;
 
   FunctionSignatureX(
-      {this.typeVariables: const <DartType>[],
+      {this.typeVariables: const <ResolutionDartType>[],
       this.requiredParameters: const <Element>[],
       this.requiredParameterCount: 0,
       List<Element> optionalParameters: const <Element>[],
@@ -1980,7 +1983,7 @@
 abstract class BaseFunctionElementX extends ElementX
     with PatchMixin<FunctionElement>, AstElementMixin
     implements FunctionElement {
-  DartType typeCache;
+  ResolutionDartType typeCache;
   final Modifiers modifiers;
 
   List<FunctionElement> nestedClosures = new List<FunctionElement>();
@@ -2031,7 +2034,7 @@
     return list;
   }
 
-  FunctionType computeType(Resolution resolution) {
+  ResolutionFunctionType computeType(Resolution resolution) {
     if (typeCache != null) return typeCache;
     _computeSignature(resolution);
     assert(invariant(this, typeCache != null,
@@ -2039,7 +2042,7 @@
     return typeCache;
   }
 
-  FunctionType get type {
+  ResolutionFunctionType get type {
     assert(invariant(this, typeCache != null,
         message: "Type has not been computed for $this."));
     return typeCache;
@@ -2066,7 +2069,7 @@
   AstElement get definingElement => implementation;
 
   @override
-  List<DartType> get typeVariables => functionSignature.typeVariables;
+  List<ResolutionDartType> get typeVariables => functionSignature.typeVariables;
 }
 
 abstract class FunctionElementX extends BaseFunctionElementX
@@ -2219,7 +2222,7 @@
 
   /// Returns the empty list of type variables by default.
   @override
-  List<DartType> get typeVariables => functionSignature.typeVariables;
+  List<ResolutionDartType> get typeVariables => functionSignature.typeVariables;
 }
 
 abstract class ConstructorElementX extends FunctionElementX
@@ -2251,7 +2254,7 @@
 
   /// These fields are set by the post process queue when checking for cycles.
   ConstructorElement effectiveTargetInternal;
-  DartType _effectiveTargetType;
+  ResolutionDartType _effectiveTargetType;
   bool _isEffectiveTargetMalformed;
 
   bool get hasEffectiveTarget {
@@ -2288,7 +2291,7 @@
     return _redirectionDeferredPrefix;
   }
 
-  void setEffectiveTarget(ConstructorElement target, DartType type,
+  void setEffectiveTarget(ConstructorElement target, ResolutionDartType type,
       {bool isMalformed: false}) {
     if (isPatched) {
       patch.setEffectiveTarget(target, type, isMalformed: isMalformed);
@@ -2320,7 +2323,7 @@
     return this;
   }
 
-  DartType get effectiveTargetType {
+  ResolutionDartType get effectiveTargetType {
     if (isPatched) {
       return patch.effectiveTargetType;
     }
@@ -2329,7 +2332,8 @@
     return _effectiveTargetType;
   }
 
-  DartType computeEffectiveTargetType(InterfaceType newType) {
+  ResolutionDartType computeEffectiveTargetType(
+      ResolutionInterfaceType newType) {
     if (isPatched) {
       return patch.computeEffectiveTargetType(newType);
     }
@@ -2353,7 +2357,7 @@
 
   ConstructorElement get definingConstructor => null;
 
-  ClassElement get enclosingClass => enclosingElement;
+  ClassElement get enclosingClass => enclosingElement.declaration;
 }
 
 class DeferredLoaderGetterElementX extends GetterElementX
@@ -2363,7 +2367,8 @@
   DeferredLoaderGetterElementX(PrefixElement prefix)
       : this.prefix = prefix,
         super(Identifiers.loadLibrary, Modifiers.EMPTY, prefix, false) {
-    functionSignature = new FunctionSignatureX(type: new FunctionType(this));
+    functionSignature =
+        new FunctionSignatureX(type: new ResolutionFunctionType(this));
   }
 
   bool get isClassMember => false;
@@ -2409,6 +2414,51 @@
     functionSignature = constructor.functionSignature;
   }
 
+  /// Returns the constructor body associated with the given constructor or
+  /// creates a new constructor body, if none can be found.
+  ///
+  /// Returns `null` if the constructor does not have a body.
+  static ConstructorBodyElementX createFromResolvedAst(
+      ResolvedAst constructorResolvedAst) {
+    ConstructorElement constructor =
+        constructorResolvedAst.element.implementation;
+    assert(constructor.isGenerativeConstructor);
+    if (constructorResolvedAst.kind != ResolvedAstKind.PARSED) return null;
+
+    FunctionExpression node = constructorResolvedAst.node;
+    // If we know the body doesn't have any code, we don't generate it.
+    if (!node.hasBody) return null;
+    if (node.hasEmptyBody) return null;
+    ClassElement classElement = constructor.enclosingClass;
+    ConstructorBodyElement bodyElement;
+    classElement.forEachBackendMember((Element backendMember) {
+      if (backendMember.isGenerativeConstructorBody) {
+        ConstructorBodyElement body = backendMember;
+        if (body.constructor == constructor) {
+          // TODO(kasperl): Find a way of stopping the iteration
+          // through the backend members.
+          bodyElement = backendMember;
+        }
+      }
+    });
+    if (bodyElement == null) {
+      bodyElement =
+          new ConstructorBodyElementX(constructorResolvedAst, constructor);
+      classElement.addBackendMember(bodyElement);
+
+      if (constructor.isPatch) {
+        // Create origin body element for patched constructors.
+        ConstructorBodyElementX patch = bodyElement;
+        ConstructorBodyElementX origin = new ConstructorBodyElementX(
+            constructorResolvedAst, constructor.origin);
+        origin.applyPatch(patch);
+        classElement.origin.addBackendMember(bodyElement.origin);
+      }
+    }
+    assert(bodyElement.isGenerativeConstructorBody);
+    return bodyElement;
+  }
+
   bool get hasNode => _resolvedAst.kind == ResolvedAstKind.PARSED;
 
   FunctionExpression get node => _resolvedAst.node;
@@ -2428,7 +2478,7 @@
 
   bool get isInstanceMember => true;
 
-  FunctionType computeType(Resolution resolution) {
+  ResolutionFunctionType computeType(Resolution resolution) {
     DiagnosticReporter reporter = resolution.reporter;
     reporter.internalError(this, '$this.computeType.');
     return null;
@@ -2473,7 +2523,7 @@
       : super('', ElementKind.GENERATIVE_CONSTRUCTOR, Modifiers.EMPTY,
             enclosing) {
     functionSignature = new FunctionSignatureX(
-        type: new FunctionType.synthesized(enclosingClass.thisType));
+        type: new ResolutionFunctionType.synthesized(enclosingClass.thisType));
     _resolvedAst =
         new SynthesizedResolvedAst(this, ResolvedAstKind.DEFAULT_CONSTRUCTOR);
   }
@@ -2496,7 +2546,7 @@
 
   ResolvedAst get resolvedAst => _resolvedAst;
 
-  DartType get type {
+  ResolutionDartType get type {
     if (isDefaultConstructor) {
       return super.type;
     } else {
@@ -2510,7 +2560,8 @@
     if (hasFunctionSignature) return;
     if (definingConstructor.isMalformed) {
       functionSignature = new FunctionSignatureX(
-          type: new FunctionType.synthesized(enclosingClass.thisType));
+          type:
+              new ResolutionFunctionType.synthesized(enclosingClass.thisType));
     }
     // TODO(johnniwinther): Ensure that the function signature (and with it the
     // function type) substitutes type variables correctly.
@@ -2550,9 +2601,9 @@
    * used to distinguish explicit and implicit uses of the [dynamic]
    * type arguments. For instance should [:List:] be the [rawType] of the
    * [:List:] class element whereas [:List<dynamic>:] should be its own
-   * instantiation of [InterfaceType] with [:dynamic:] as type argument. Using
-   * this distinction, we can print the raw type with type arguments only when
-   * the input source has used explicit type arguments.
+   * instantiation of [ResolutionInterfaceType] with [:dynamic:] as type
+   * argument. Using this distinction, we can print the raw type with type
+   * arguments only when the input source has used explicit type arguments.
    *
    * This type is computed together with [thisType] in [computeType].
    */
@@ -2570,9 +2621,9 @@
     return rawTypeCache;
   }
 
-  T createType(List<DartType> typeArguments);
+  T createType(List<ResolutionDartType> typeArguments);
 
-  void setThisAndRawTypes(List<DartType> typeParameters) {
+  void setThisAndRawTypes(List<ResolutionDartType> typeParameters) {
     assert(invariant(this, thisTypeCache == null,
         message: "This type has already been set on $this."));
     assert(invariant(this, rawTypeCache == null,
@@ -2581,32 +2632,33 @@
     if (typeParameters.isEmpty) {
       rawTypeCache = thisTypeCache;
     } else {
-      List<DartType> dynamicParameters =
-          new List.filled(typeParameters.length, const DynamicType());
+      List<ResolutionDartType> dynamicParameters =
+          new List.filled(typeParameters.length, const ResolutionDynamicType());
       rawTypeCache = createType(dynamicParameters);
     }
   }
 
-  List<DartType> get typeVariables => thisType.typeArguments;
+  List<ResolutionDartType> get typeVariables => thisType.typeArguments;
 
   /**
    * Creates the type variables, their type and corresponding element, for the
    * type variables declared in [parameter] on [element]. The bounds of the type
    * variables are not set until [element] has been resolved.
    */
-  List<DartType> createTypeVariables(NodeList parameters) {
-    if (parameters == null) return const <DartType>[];
+  List<ResolutionDartType> createTypeVariables(NodeList parameters) {
+    if (parameters == null) return const <ResolutionDartType>[];
 
     // Create types and elements for type variable.
     Link<Node> nodes = parameters.nodes;
-    List<DartType> arguments =
+    List<ResolutionDartType> arguments =
         new List.generate(nodes.slowLength(), (int index) {
       TypeVariable node = nodes.head;
       String variableName = node.name.source;
       nodes = nodes.tail;
       TypeVariableElementX variableElement =
           new TypeVariableElementX(variableName, this, index, node);
-      TypeVariableType variableType = new TypeVariableType(variableElement);
+      ResolutionTypeVariableType variableType =
+          new ResolutionTypeVariableType(variableElement);
       variableElement.typeCache = variableType;
       return variableType;
     }, growable: false);
@@ -2623,14 +2675,14 @@
         AstElementMixin,
         AnalyzableElementX,
         ClassElementCommon,
-        TypeDeclarationElementX<InterfaceType>,
+        TypeDeclarationElementX<ResolutionInterfaceType>,
         PatchMixin<ClassElement>,
         ClassMemberMixin
     implements ClassElement {
   final int id;
 
-  DartType supertype;
-  Link<DartType> interfaces;
+  ResolutionDartType supertype;
+  Link<ResolutionDartType> interfaces;
   int supertypeLoadState;
   int resolutionState;
   bool isProxy = false;
@@ -2650,7 +2702,7 @@
   @override
   bool get isEnumClass => false;
 
-  InterfaceType computeType(Resolution resolution) {
+  ResolutionInterfaceType computeType(Resolution resolution) {
     if (isPatch) {
       origin.computeType(resolution);
       thisTypeCache = origin.thisType;
@@ -2663,7 +2715,7 @@
   }
 
   void computeThisAndRawType(
-      Resolution resolution, List<DartType> typeVariables) {
+      Resolution resolution, List<ResolutionDartType> typeVariables) {
     if (thisTypeCache == null) {
       if (origin == null) {
         setThisAndRawTypes(typeVariables);
@@ -2675,11 +2727,11 @@
   }
 
   @override
-  InterfaceType createType(List<DartType> typeArguments) {
-    return new InterfaceType(this, typeArguments);
+  ResolutionInterfaceType createType(List<ResolutionDartType> typeArguments) {
+    return new ResolutionInterfaceType(this, typeArguments);
   }
 
-  List<DartType> computeTypeParameters(ParsingContext parsing);
+  List<ResolutionDartType> computeTypeParameters(ParsingContext parsing);
 
   bool get isObject {
     assert(invariant(this, isResolved,
@@ -2787,7 +2839,7 @@
     addMember(constructor, reporter);
   }
 
-  List<DartType> computeTypeParameters(ParsingContext parsing) {
+  List<ResolutionDartType> computeTypeParameters(ParsingContext parsing) {
     ClassNode node = parseNode(parsing);
     return createTypeVariables(node.typeParameters);
   }
@@ -2855,8 +2907,8 @@
     return visitor.visitEnumClassElement(this, arg);
   }
 
-  List<DartType> computeTypeParameters(ParsingContext parsing) =>
-      const <DartType>[];
+  List<ResolutionDartType> computeTypeParameters(ParsingContext parsing) =>
+      const <ResolutionDartType>[];
 
   List<FieldElement> get enumValues {
     assert(invariant(this, _enumValues != null,
@@ -3092,7 +3144,7 @@
     implements MixinApplicationElement {
   Link<ConstructorElement> constructors = new Link<ConstructorElement>();
 
-  InterfaceType mixinType;
+  ResolutionInterfaceType mixinType;
 
   MixinApplicationElementX(String name, Element enclosing, int id)
       : super(name, enclosing, id, STATE_NOT_STARTED);
@@ -3130,7 +3182,7 @@
     addConstructor(constructor);
   }
 
-  List<DartType> computeTypeParameters(ParsingContext parsing) {
+  List<ResolutionDartType> computeTypeParameters(ParsingContext parsing) {
     NamedMixinApplication named = node.asNamedMixinApplication();
     if (named == null) {
       throw new SpannableAssertionFailure(
@@ -3209,7 +3261,7 @@
   final ExecutableElement executableContext;
   final Node statement;
   final int nestingLevel;
-  Link<LabelDefinition> labels = const Link<LabelDefinition>();
+  List<LabelDefinition> labels = <LabelDefinition>[];
   bool isBreakTarget = false;
   bool isContinueTarget = false;
 
@@ -3223,7 +3275,7 @@
 
   LabelDefinition addLabel(Label label, String labelName) {
     LabelDefinition result = new LabelDefinitionX(label, labelName, this);
-    labels = labels.prepend(result);
+    labels.add(result);
     return result;
   }
 
@@ -3237,8 +3289,8 @@
     implements TypeVariableElement {
   final int index;
   final Node node;
-  TypeVariableType typeCache;
-  DartType boundCache;
+  ResolutionTypeVariableType typeCache;
+  ResolutionDartType boundCache;
 
   TypeVariableElementX(
       String name, GenericElement enclosing, this.index, this.node)
@@ -3246,15 +3298,15 @@
 
   GenericElement get typeDeclaration => enclosingElement;
 
-  TypeVariableType computeType(Resolution resolution) => type;
+  ResolutionTypeVariableType computeType(Resolution resolution) => type;
 
-  TypeVariableType get type {
+  ResolutionTypeVariableType get type {
     assert(invariant(this, typeCache != null,
         message: "Type has not been set on $this."));
     return typeCache;
   }
 
-  DartType get bound {
+  ResolutionDartType get bound {
     assert(invariant(this, boundCache != null,
         message: "Bound has not been set on $this."));
     return boundCache;
diff --git a/pkg/compiler/lib/src/elements/names.dart b/pkg/compiler/lib/src/elements/names.dart
index e38def0..a4a6f7a 100644
--- a/pkg/compiler/lib/src/elements/names.dart
+++ b/pkg/compiler/lib/src/elements/names.dart
@@ -37,7 +37,7 @@
 
   /// Returns `true` if an entity of this name is accessible from library
   /// [element].
-  bool isAccessibleFrom(LibraryElement element);
+  bool isAccessibleFrom(LibraryEntity element);
 
   /// Returns `true` if this name is private.
   bool get isPrivate;
@@ -47,7 +47,7 @@
   bool isSimilarTo(Name other);
   int get similarHashCode;
 
-  LibraryElement get library;
+  LibraryEntity get library;
 
   /// Returns `true` when [s] is private if used as an identifier.
   static bool isPrivateName(String s) => !s.isEmpty && s.codeUnitAt(0) == $_;
@@ -66,7 +66,7 @@
 
   Name get setter => isSetter ? this : new PublicName(text, isSetter: true);
 
-  bool isAccessibleFrom(LibraryElement element) => true;
+  bool isAccessibleFrom(LibraryEntity element) => true;
 
   bool get isPrivate => false;
 
@@ -81,13 +81,13 @@
       text == other.text && isSetter == other.isSetter;
   int get similarHashCode => text.hashCode + 11 * isSetter.hashCode;
 
-  LibraryElement get library => null;
+  LibraryEntity get library => null;
 
   String toString() => isSetter ? '$text=' : text;
 }
 
 class PrivateName extends PublicName {
-  final LibraryElement library;
+  final LibraryEntity library;
 
   PrivateName(String text, this.library, {bool isSetter: false})
       : super(text, isSetter: isSetter);
diff --git a/pkg/compiler/lib/src/dart_types.dart b/pkg/compiler/lib/src/elements/resolution_types.dart
similarity index 67%
rename from pkg/compiler/lib/src/dart_types.dart
rename to pkg/compiler/lib/src/elements/resolution_types.dart
index 4482d34..b8ed4fb 100644
--- a/pkg/compiler/lib/src/dart_types.dart
+++ b/pkg/compiler/lib/src/elements/resolution_types.dart
@@ -2,22 +2,25 @@
 // for 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 dart_types;
+/// Implementation of the Dart types hierarchy in 'types.dart' specifically
+/// tailored to the resolution phase of the compiler.
+
+library resolution_types;
 
 import 'dart:math' show min;
 
-import 'common/resolution.dart' show Resolution;
-import 'common.dart';
-import 'core_types.dart';
-import 'elements/elements.dart';
-import 'elements/modelx.dart' show TypeDeclarationElementX;
-import 'ordered_typeset.dart' show OrderedTypeSet;
-import 'util/util.dart' show equalElements;
+import '../common.dart';
+import '../common/resolution.dart' show Resolution;
+import '../core_types.dart';
+import '../ordered_typeset.dart' show OrderedTypeSet;
+import '../util/util.dart' show equalElements;
+import 'elements.dart';
+import 'modelx.dart' show TypeDeclarationElementX;
+import 'types.dart';
 
-enum TypeKind {
+enum ResolutionTypeKind {
   FUNCTION,
   INTERFACE,
-  STATEMENT,
   TYPEDEF,
   TYPE_VARIABLE,
   MALFORMED_TYPE,
@@ -25,12 +28,12 @@
   VOID,
 }
 
-abstract class DartType {
+abstract class ResolutionDartType implements DartType {
   String get name;
 
-  TypeKind get kind;
+  ResolutionTypeKind get kind;
 
-  const DartType();
+  const ResolutionDartType();
 
   /**
    * Returns the [Element] which declared this type.
@@ -50,15 +53,16 @@
    *
    *     (lambda x.e0)e1 -> [e1/x]e0.
    *
-   * See [TypeVariableType] for a motivation for this method.
+   * See [ResolutionTypeVariableType] for a motivation for this method.
    *
    * Invariant: There must be the same number of [arguments] and [parameters].
    */
-  DartType subst(List<DartType> arguments, List<DartType> parameters);
+  ResolutionDartType subst(
+      List<ResolutionDartType> arguments, List<ResolutionDartType> parameters);
 
   /// Performs the substitution of the type arguments of [type] for their
   /// corresponding type variables in this type.
-  DartType substByContext(GenericType type) {
+  ResolutionDartType substByContext(GenericType type) {
     return subst(type.typeArguments, type.element.typeVariables);
   }
 
@@ -81,20 +85,20 @@
   /// For example, the unaliased type of `typedef A Func<A,B>(B b)` is the
   /// function type `(B) -> A` and the unaliased type of `Func<int,String>`
   /// is the function type `(String) -> int`.
-  DartType get unaliased => this;
+  ResolutionDartType get unaliased => this;
 
   /**
    * If this type is malformed or a generic type created with the wrong number
    * of type arguments then [userProvidedBadType] holds the bad type provided
    * by the user.
    */
-  DartType get userProvidedBadType => null;
+  ResolutionDartType get userProvidedBadType => null;
 
   /// Is [: true :] if this type has no explict type arguments.
   bool get isRaw => true;
 
   /// Returns the raw version of this type.
-  DartType asRaw() => this;
+  ResolutionDartType asRaw() => this;
 
   /// Is [: true :] if this type has no non-dynamic type arguments.
   bool get treatAsRaw => isRaw;
@@ -103,25 +107,25 @@
   bool get treatAsDynamic => false;
 
   /// Is [: true :] if this type is the dynamic type.
-  bool get isDynamic => kind == TypeKind.DYNAMIC;
+  bool get isDynamic => kind == ResolutionTypeKind.DYNAMIC;
 
   /// Is [: true :] if this type is the void type.
-  bool get isVoid => kind == TypeKind.VOID;
+  bool get isVoid => kind == ResolutionTypeKind.VOID;
 
   /// Is [: true :] if this is the type of `Object` from dart:core.
   bool get isObject => false;
 
   /// Is [: true :] if this type is an interface type.
-  bool get isInterfaceType => kind == TypeKind.INTERFACE;
+  bool get isInterfaceType => kind == ResolutionTypeKind.INTERFACE;
 
   /// Is [: true :] if this type is a typedef.
-  bool get isTypedef => kind == TypeKind.TYPEDEF;
+  bool get isTypedef => kind == ResolutionTypeKind.TYPEDEF;
 
   /// Is [: true :] if this type is a function type.
-  bool get isFunctionType => kind == TypeKind.FUNCTION;
+  bool get isFunctionType => kind == ResolutionTypeKind.FUNCTION;
 
   /// Is [: true :] if this type is a type variable.
-  bool get isTypeVariable => kind == TypeKind.TYPE_VARIABLE;
+  bool get isTypeVariable => kind == ResolutionTypeKind.TYPE_VARIABLE;
 
   /// Is [: true :] if this type is a malformed type.
   bool get isMalformed => false;
@@ -130,14 +134,16 @@
   bool get isEnumType => false;
 
   /// Returns an occurrence of a type variable within this type, if any.
-  TypeVariableType get typeVariableOccurrence => null;
+  ResolutionTypeVariableType get typeVariableOccurrence => null;
 
-  /// Applies [f] to each occurence of a [TypeVariableType] within this type.
-  void forEachTypeVariable(f(TypeVariableType variable)) {}
+  /// Applies [f] to each occurence of a [ResolutionTypeVariableType] within
+  /// this type.
+  void forEachTypeVariable(f(ResolutionTypeVariableType variable)) {}
 
-  TypeVariableType _findTypeVariableOccurrence(List<DartType> types) {
-    for (DartType type in types) {
-      TypeVariableType typeVariable = type.typeVariableOccurrence;
+  ResolutionTypeVariableType _findTypeVariableOccurrence(
+      List<ResolutionDartType> types) {
+    for (ResolutionDartType type in types) {
+      ResolutionTypeVariableType typeVariable = type.typeVariableOccurrence;
       if (typeVariable != null) {
         return typeVariable;
       }
@@ -159,16 +165,17 @@
   void visitChildren(DartTypeVisitor visitor, var argument) {}
 
   static void visitList(
-      List<DartType> types, DartTypeVisitor visitor, var argument) {
-    for (DartType type in types) {
+      List<ResolutionDartType> types, DartTypeVisitor visitor, var argument) {
+    for (ResolutionDartType type in types) {
       type.accept(visitor, argument);
     }
   }
 
-  /// Returns a [DartType] which corresponds to [this] except that each
-  /// contained [MethodTypeVariableType] is replaced by a [DynamicType].
+  /// Returns a [ResolutionDartType] which corresponds to [this] except that
+  /// each contained [MethodTypeVariableType] is replaced by a
+  /// [ResolutionDynamicType].
   /// GENERIC_METHODS: Temporary, only used with '--generic-method-syntax'.
-  DartType get dynamifyMethodTypeVariableType => this;
+  ResolutionDartType get dynamifyMethodTypeVariableType => this;
 
   /// Returns true iff [this] is or contains a [MethodTypeVariableType].
   /// GENERIC_METHODS: Temporary, only used with '--generic-method-syntax'
@@ -197,24 +204,26 @@
  * [: String :] because we must substitute [: String :] for the
  * the type variable [: T :].
  */
-class TypeVariableType extends DartType {
+class ResolutionTypeVariableType extends ResolutionDartType
+    implements TypeVariableType {
   final TypeVariableElement element;
 
-  TypeVariableType(this.element);
+  ResolutionTypeVariableType(this.element);
 
-  TypeKind get kind => TypeKind.TYPE_VARIABLE;
+  ResolutionTypeKind get kind => ResolutionTypeKind.TYPE_VARIABLE;
 
   String get name => element.name;
 
-  DartType subst(List<DartType> arguments, List<DartType> parameters) {
+  ResolutionDartType subst(
+      List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
     assert(arguments.length == parameters.length);
     if (parameters.isEmpty) {
       // Return fast on empty substitutions.
       return this;
     }
     for (int index = 0; index < arguments.length; index++) {
-      TypeVariableType parameter = parameters[index];
-      DartType argument = arguments[index];
+      ResolutionTypeVariableType parameter = parameters[index];
+      ResolutionDartType argument = arguments[index];
       if (parameter == this) {
         return argument;
       }
@@ -223,9 +232,9 @@
     return this;
   }
 
-  TypeVariableType get typeVariableOccurrence => this;
+  ResolutionTypeVariableType get typeVariableOccurrence => this;
 
-  void forEachTypeVariable(f(TypeVariableType variable)) {
+  void forEachTypeVariable(f(ResolutionTypeVariableType variable)) {
     f(this);
   }
 
@@ -236,7 +245,7 @@
   int get hashCode => 17 * element.hashCode;
 
   bool operator ==(other) {
-    if (other is! TypeVariableType) return false;
+    if (other is! ResolutionTypeVariableType) return false;
     return identical(other.element, element);
   }
 
@@ -246,7 +255,7 @@
 /// Provides a thin model of method type variables: They are treated as if
 /// their value were `dynamic` when used in a type annotation, and as a
 /// malformed type when used in an `as` or `is` expression.
-class MethodTypeVariableType extends TypeVariableType {
+class MethodTypeVariableType extends ResolutionTypeVariableType {
   MethodTypeVariableType(TypeVariableElement element) : super(element);
 
   @override
@@ -256,39 +265,24 @@
   bool get isMalformed => true;
 
   @override
-  DartType get dynamifyMethodTypeVariableType => const DynamicType();
+  ResolutionDartType get dynamifyMethodTypeVariableType =>
+      const ResolutionDynamicType();
 
   @override
   get containsMethodTypeVariableType => true;
 }
 
-/// Internal type representing the result of analyzing a statement.
-class StatementType extends DartType {
-  Element get element => null;
+class ResolutionVoidType extends ResolutionDartType implements VoidType {
+  const ResolutionVoidType();
 
-  TypeKind get kind => TypeKind.STATEMENT;
-
-  String get name => 'statement';
-
-  const StatementType();
-
-  DartType subst(List<DartType> arguments, List<DartType> parameters) => this;
-
-  accept(DartTypeVisitor visitor, var argument) {
-    return visitor.visitStatementType(this, argument);
-  }
-}
-
-class VoidType extends DartType {
-  const VoidType();
-
-  TypeKind get kind => TypeKind.VOID;
+  ResolutionTypeKind get kind => ResolutionTypeKind.VOID;
 
   String get name => 'void';
 
   Element get element => null;
 
-  DartType subst(List<DartType> arguments, List<DartType> parameters) {
+  ResolutionDartType subst(
+      List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
     // Void cannot be substituted.
     return this;
   }
@@ -302,7 +296,7 @@
   int get hashCode => 6007;
 }
 
-class MalformedType extends DartType {
+class MalformedType extends ResolutionDartType {
   final ErroneousElement element;
 
   /**
@@ -312,7 +306,7 @@
    * [declaredType] is [: Map<String> :] whereas for an unresolved type
    * [userProvidedBadType] is [: null :].
    */
-  final DartType userProvidedBadType;
+  final ResolutionDartType userProvidedBadType;
 
   /**
    * Type arguments for the malformed typed, if these cannot fit in the
@@ -323,7 +317,7 @@
    * [: dynamic :] and [: T :], respectively, or for [: X<int> :] where [: X :]
    * is not resolved or does not imply a type.
    */
-  final List<DartType> typeArguments;
+  final List<ResolutionDartType> typeArguments;
 
   final int hashCode = _nextHash = (_nextHash + 1).toUnsigned(30);
   static int _nextHash = 43765;
@@ -331,11 +325,12 @@
   MalformedType(this.element, this.userProvidedBadType,
       [this.typeArguments = null]);
 
-  TypeKind get kind => TypeKind.MALFORMED_TYPE;
+  ResolutionTypeKind get kind => ResolutionTypeKind.MALFORMED_TYPE;
 
   String get name => element.name;
 
-  DartType subst(List<DartType> arguments, List<DartType> parameters) {
+  ResolutionDartType subst(
+      List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
     // Malformed types are not substitutable.
     return this;
   }
@@ -370,11 +365,12 @@
   }
 }
 
-abstract class GenericType extends DartType {
+abstract class GenericType<T extends GenericType> extends ResolutionDartType {
   final TypeDeclarationElement element;
-  final List<DartType> typeArguments;
+  final List<ResolutionDartType> typeArguments;
 
-  GenericType(TypeDeclarationElement element, List<DartType> typeArguments,
+  GenericType(
+      TypeDeclarationElement element, List<ResolutionDartType> typeArguments,
       {bool checkTypeArgumentCount: true})
       : this.element = element,
         this.typeArguments = typeArguments,
@@ -395,9 +391,10 @@
   }
 
   /// Creates a new instance of this type using the provided type arguments.
-  GenericType createInstantiation(List<DartType> newTypeArguments);
+  T createInstantiation(List<ResolutionDartType> newTypeArguments);
 
-  DartType subst(List<DartType> arguments, List<DartType> parameters) {
+  T subst(
+      List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
     if (typeArguments.isEmpty) {
       // Return fast on non-generic types.
       return this;
@@ -407,7 +404,7 @@
       // Return fast on empty substitutions.
       return this;
     }
-    List<DartType> newTypeArguments =
+    List<ResolutionDartType> newTypeArguments =
         Types.substTypes(typeArguments, arguments, parameters);
     if (!identical(typeArguments, newTypeArguments)) {
       // Create a new type only if necessary.
@@ -416,18 +413,18 @@
     return this;
   }
 
-  TypeVariableType get typeVariableOccurrence {
+  ResolutionTypeVariableType get typeVariableOccurrence {
     return _findTypeVariableOccurrence(typeArguments);
   }
 
-  void forEachTypeVariable(f(TypeVariableType variable)) {
-    for (DartType type in typeArguments) {
+  void forEachTypeVariable(f(ResolutionTypeVariableType variable)) {
+    for (ResolutionDartType type in typeArguments) {
       type.forEachTypeVariable(f);
     }
   }
 
   void visitChildren(DartTypeVisitor visitor, var argument) {
-    DartType.visitList(typeArguments, visitor, argument);
+    ResolutionDartType.visitList(typeArguments, visitor, argument);
   }
 
   String toString() {
@@ -445,17 +442,17 @@
   final bool containsMethodTypeVariableType;
 
   @override
-  DartType get dynamifyMethodTypeVariableType {
+  ResolutionDartType get dynamifyMethodTypeVariableType {
     if (!containsMethodTypeVariableType) return this;
-    List<DartType> newTypeArguments = typeArguments
-        .map((DartType type) => type.dynamifyMethodTypeVariableType)
+    List<ResolutionDartType> newTypeArguments = typeArguments
+        .map((ResolutionDartType type) => type.dynamifyMethodTypeVariableType)
         .toList();
     return createInstantiation(newTypeArguments);
   }
 
   int get hashCode {
     int hash = element.hashCode;
-    for (DartType argument in typeArguments) {
+    for (ResolutionDartType argument in typeArguments) {
       int argumentHash = argument != null ? argument.hashCode : 0;
       hash = 17 * hash + 3 * argumentHash;
     }
@@ -478,29 +475,30 @@
 
   bool get treatAsRaw {
     if (isRaw) return true;
-    for (DartType type in typeArguments) {
+    for (ResolutionDartType type in typeArguments) {
       if (!type.treatAsDynamic) return false;
     }
     return true;
   }
 }
 
-class InterfaceType extends GenericType {
+class ResolutionInterfaceType extends GenericType<ResolutionInterfaceType>
+    implements InterfaceType {
   int _hashCode;
 
-  InterfaceType(ClassElement element,
-      [List<DartType> typeArguments = const <DartType>[]])
+  ResolutionInterfaceType(ClassElement element,
+      [List<ResolutionDartType> typeArguments = const <ResolutionDartType>[]])
       : super(element, typeArguments) {
     assert(invariant(element, element.isDeclaration));
   }
 
-  InterfaceType.forUserProvidedBadType(ClassElement element,
-      [List<DartType> typeArguments = const <DartType>[]])
+  ResolutionInterfaceType.forUserProvidedBadType(ClassElement element,
+      [List<ResolutionDartType> typeArguments = const <ResolutionDartType>[]])
       : super(element, typeArguments, checkTypeArgumentCount: false);
 
   ClassElement get element => super.element;
 
-  TypeKind get kind => TypeKind.INTERFACE;
+  ResolutionTypeKind get kind => ResolutionTypeKind.INTERFACE;
 
   String get name => element.name;
 
@@ -508,22 +506,23 @@
 
   bool get isEnumType => element.isEnumClass;
 
-  InterfaceType createInstantiation(List<DartType> newTypeArguments) {
-    return new InterfaceType(element, newTypeArguments);
+  ResolutionInterfaceType createInstantiation(
+      List<ResolutionDartType> newTypeArguments) {
+    return new ResolutionInterfaceType(element, newTypeArguments);
   }
 
   /**
    * Returns the type as an instance of class [other], if possible, null
    * otherwise.
    */
-  InterfaceType asInstanceOf(ClassElement other) {
+  ResolutionInterfaceType asInstanceOf(ClassElement other) {
     other = other.declaration;
     if (element == other) return this;
-    InterfaceType supertype = element.asInstanceOf(other);
+    ResolutionInterfaceType supertype = element.asInstanceOf(other);
     if (supertype != null) {
-      List<DartType> arguments = Types.substTypes(
+      List<ResolutionDartType> arguments = Types.substTypes(
           supertype.typeArguments, typeArguments, element.typeVariables);
-      return new InterfaceType(supertype.element, arguments);
+      return new ResolutionInterfaceType(supertype.element, arguments);
     }
     return null;
   }
@@ -546,7 +545,7 @@
 
   int get hashCode => _hashCode ??= super.hashCode;
 
-  InterfaceType asRaw() => super.asRaw();
+  ResolutionInterfaceType asRaw() => super.asRaw();
 
   accept(DartTypeVisitor visitor, var argument) {
     return visitor.visitInterfaceType(this, argument);
@@ -554,22 +553,21 @@
 
   /// Returns the type of the 'call' method in this interface type, or
   /// `null` if the interface type has no 'call' method.
-  FunctionType get callType {
-    FunctionType type = element.callType;
+  ResolutionFunctionType get callType {
+    ResolutionFunctionType type = element.callType;
     return type != null && isGeneric ? type.substByContext(this) : type;
   }
 }
 
-/**
- * Special subclass of [InterfaceType] used for generic interface types created
- * with the wrong number of type arguments.
- *
- * The type uses [:dynamic:] for all it s type arguments.
- */
-class BadInterfaceType extends InterfaceType {
-  final InterfaceType userProvidedBadType;
+/// Special subclass of [ResolutionInterfaceType] used for generic interface
+/// types created with the wrong number of type arguments.
+///
+/// The type uses `dynamic` for all it s type arguments.
+class BadInterfaceType extends ResolutionInterfaceType {
+  final ResolutionInterfaceType userProvidedBadType;
 
-  BadInterfaceType(ClassElement element, InterfaceType this.userProvidedBadType)
+  BadInterfaceType(
+      ClassElement element, ResolutionInterfaceType this.userProvidedBadType)
       : super(element, element.rawType.typeArguments);
 
   String toString() {
@@ -578,15 +576,16 @@
 }
 
 /**
- * Special subclass of [TypedefType] used for generic typedef types created
- * with the wrong number of type arguments.
+ * Special subclass of [ResolutionTypedefType] used for generic typedef types
+ * created with the wrong number of type arguments.
  *
  * The type uses [:dynamic:] for all it s type arguments.
  */
-class BadTypedefType extends TypedefType {
-  final TypedefType userProvidedBadType;
+class BadTypedefType extends ResolutionTypedefType {
+  final ResolutionTypedefType userProvidedBadType;
 
-  BadTypedefType(TypedefElement element, TypedefType this.userProvidedBadType)
+  BadTypedefType(
+      TypedefElement element, ResolutionTypedefType this.userProvidedBadType)
       : super(element, element.rawType.typeArguments);
 
   String toString() {
@@ -594,11 +593,12 @@
   }
 }
 
-class FunctionType extends DartType {
+class ResolutionFunctionType extends ResolutionDartType
+    implements FunctionType {
   final FunctionTypedElement element;
-  final DartType returnType;
-  final List<DartType> parameterTypes;
-  final List<DartType> optionalParameterTypes;
+  final ResolutionDartType returnType;
+  final List<ResolutionDartType> parameterTypes;
+  final List<ResolutionDartType> optionalParameterTypes;
 
   /**
    * The names of the named parameters ordered lexicographically.
@@ -609,36 +609,47 @@
    * The types of the named parameters in the order corresponding to the
    * [namedParameters].
    */
-  final List<DartType> namedParameterTypes;
+  final List<ResolutionDartType> namedParameterTypes;
 
-  factory FunctionType(FunctionTypedElement element,
-      [DartType returnType = const DynamicType(),
-      List<DartType> parameterTypes = const <DartType>[],
-      List<DartType> optionalParameterTypes = const <DartType>[],
+  factory ResolutionFunctionType(FunctionTypedElement element,
+      [ResolutionDartType returnType = const ResolutionDynamicType(),
+      List<ResolutionDartType> parameterTypes = const <ResolutionDartType>[],
+      List<ResolutionDartType> optionalParameterTypes =
+          const <ResolutionDartType>[],
       List<String> namedParameters = const <String>[],
-      List<DartType> namedParameterTypes = const <DartType>[]]) {
+      List<ResolutionDartType> namedParameterTypes =
+          const <ResolutionDartType>[]]) {
     assert(invariant(CURRENT_ELEMENT_SPANNABLE, element != null));
     assert(invariant(element, element.isDeclaration));
-    return new FunctionType.internal(element, returnType, parameterTypes,
+    return new ResolutionFunctionType.internal(
+        element,
+        returnType,
+        parameterTypes,
+        optionalParameterTypes,
+        namedParameters,
+        namedParameterTypes);
+  }
+
+  factory ResolutionFunctionType.synthesized(
+      [ResolutionDartType returnType = const ResolutionDynamicType(),
+      List<ResolutionDartType> parameterTypes = const <ResolutionDartType>[],
+      List<ResolutionDartType> optionalParameterTypes =
+          const <ResolutionDartType>[],
+      List<String> namedParameters = const <String>[],
+      List<ResolutionDartType> namedParameterTypes =
+          const <ResolutionDartType>[]]) {
+    return new ResolutionFunctionType.internal(null, returnType, parameterTypes,
         optionalParameterTypes, namedParameters, namedParameterTypes);
   }
 
-  factory FunctionType.synthesized(
-      [DartType returnType = const DynamicType(),
-      List<DartType> parameterTypes = const <DartType>[],
-      List<DartType> optionalParameterTypes = const <DartType>[],
+  ResolutionFunctionType.internal(FunctionTypedElement this.element,
+      [ResolutionDartType returnType = const ResolutionDynamicType(),
+      List<ResolutionDartType> parameterTypes = const <ResolutionDartType>[],
+      List<ResolutionDartType> optionalParameterTypes =
+          const <ResolutionDartType>[],
       List<String> namedParameters = const <String>[],
-      List<DartType> namedParameterTypes = const <DartType>[]]) {
-    return new FunctionType.internal(null, returnType, parameterTypes,
-        optionalParameterTypes, namedParameters, namedParameterTypes);
-  }
-
-  FunctionType.internal(FunctionTypedElement this.element,
-      [DartType returnType = const DynamicType(),
-      List<DartType> parameterTypes = const <DartType>[],
-      List<DartType> optionalParameterTypes = const <DartType>[],
-      List<String> namedParameters = const <String>[],
-      List<DartType> namedParameterTypes = const <DartType>[]])
+      List<ResolutionDartType> namedParameterTypes =
+          const <ResolutionDartType>[]])
       : this.returnType = returnType,
         this.parameterTypes = parameterTypes,
         this.optionalParameterTypes = optionalParameterTypes,
@@ -656,9 +667,9 @@
     assert(namedParameters.length == namedParameterTypes.length);
   }
 
-  TypeKind get kind => TypeKind.FUNCTION;
+  ResolutionTypeKind get kind => ResolutionTypeKind.FUNCTION;
 
-  DartType getNamedParameterType(String name) {
+  ResolutionDartType getNamedParameterType(String name) {
     for (int i = 0; i < namedParameters.length; i++) {
       if (namedParameters[i] == name) {
         return namedParameterTypes[i];
@@ -667,19 +678,20 @@
     return null;
   }
 
-  DartType subst(List<DartType> arguments, List<DartType> parameters) {
+  ResolutionDartType subst(
+      List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
     if (parameters.isEmpty) {
       assert(arguments.isEmpty);
       // Return fast on empty substitutions.
       return this;
     }
-    DartType newReturnType = returnType.subst(arguments, parameters);
+    ResolutionDartType newReturnType = returnType.subst(arguments, parameters);
     bool changed = !identical(newReturnType, returnType);
-    List<DartType> newParameterTypes =
+    List<ResolutionDartType> newParameterTypes =
         Types.substTypes(parameterTypes, arguments, parameters);
-    List<DartType> newOptionalParameterTypes =
+    List<ResolutionDartType> newOptionalParameterTypes =
         Types.substTypes(optionalParameterTypes, arguments, parameters);
-    List<DartType> newNamedParameterTypes =
+    List<ResolutionDartType> newNamedParameterTypes =
         Types.substTypes(namedParameterTypes, arguments, parameters);
     if (!changed &&
         (!identical(parameterTypes, newParameterTypes) ||
@@ -689,7 +701,7 @@
     }
     if (changed) {
       // Create a new type only if necessary.
-      return new FunctionType.internal(
+      return new ResolutionFunctionType.internal(
           element,
           newReturnType,
           newParameterTypes,
@@ -700,8 +712,9 @@
     return this;
   }
 
-  TypeVariableType get typeVariableOccurrence {
-    TypeVariableType typeVariableType = returnType.typeVariableOccurrence;
+  ResolutionTypeVariableType get typeVariableOccurrence {
+    ResolutionTypeVariableType typeVariableType =
+        returnType.typeVariableOccurrence;
     if (typeVariableType != null) return typeVariableType;
 
     typeVariableType = _findTypeVariableOccurrence(parameterTypes);
@@ -713,15 +726,15 @@
     return _findTypeVariableOccurrence(namedParameterTypes);
   }
 
-  void forEachTypeVariable(f(TypeVariableType variable)) {
+  void forEachTypeVariable(f(ResolutionTypeVariableType variable)) {
     returnType.forEachTypeVariable(f);
-    parameterTypes.forEach((DartType type) {
+    parameterTypes.forEach((ResolutionDartType type) {
       type.forEachTypeVariable(f);
     });
-    optionalParameterTypes.forEach((DartType type) {
+    optionalParameterTypes.forEach((ResolutionDartType type) {
       type.forEachTypeVariable(f);
     });
-    namedParameterTypes.forEach((DartType type) {
+    namedParameterTypes.forEach((ResolutionDartType type) {
       type.forEachTypeVariable(f);
     });
   }
@@ -732,9 +745,9 @@
 
   void visitChildren(DartTypeVisitor visitor, var argument) {
     returnType.accept(visitor, argument);
-    DartType.visitList(parameterTypes, visitor, argument);
-    DartType.visitList(optionalParameterTypes, visitor, argument);
-    DartType.visitList(namedParameterTypes, visitor, argument);
+    ResolutionDartType.visitList(parameterTypes, visitor, argument);
+    ResolutionDartType.visitList(optionalParameterTypes, visitor, argument);
+    ResolutionDartType.visitList(namedParameterTypes, visitor, argument);
   }
 
   String toString() {
@@ -774,20 +787,26 @@
 
   String get name => 'Function';
 
-  int computeArity() => parameterTypes.length;
-
   @override
-  DartType get dynamifyMethodTypeVariableType {
+  ResolutionDartType get dynamifyMethodTypeVariableType {
     if (!containsMethodTypeVariableType) return this;
-    DartType eraseIt(DartType type) => type.dynamifyMethodTypeVariableType;
-    DartType newReturnType = returnType.dynamifyMethodTypeVariableType;
-    List<DartType> newParameterTypes = parameterTypes.map(eraseIt).toList();
-    List<DartType> newOptionalParameterTypes =
+    ResolutionDartType eraseIt(ResolutionDartType type) =>
+        type.dynamifyMethodTypeVariableType;
+    ResolutionDartType newReturnType =
+        returnType.dynamifyMethodTypeVariableType;
+    List<ResolutionDartType> newParameterTypes =
+        parameterTypes.map(eraseIt).toList();
+    List<ResolutionDartType> newOptionalParameterTypes =
         optionalParameterTypes.map(eraseIt).toList();
-    List<DartType> newNamedParameterTypes =
+    List<ResolutionDartType> newNamedParameterTypes =
         namedParameterTypes.map(eraseIt).toList();
-    return new FunctionType.internal(element, newReturnType, newParameterTypes,
-        newOptionalParameterTypes, namedParameters, newNamedParameterTypes);
+    return new ResolutionFunctionType.internal(
+        element,
+        newReturnType,
+        newParameterTypes,
+        newOptionalParameterTypes,
+        namedParameters,
+        newNamedParameterTypes);
   }
 
   @override
@@ -795,23 +814,23 @@
 
   int get hashCode {
     int hash = 3 * returnType.hashCode;
-    for (DartType parameter in parameterTypes) {
+    for (ResolutionDartType parameter in parameterTypes) {
       hash = 17 * hash + 5 * parameter.hashCode;
     }
-    for (DartType parameter in optionalParameterTypes) {
+    for (ResolutionDartType parameter in optionalParameterTypes) {
       hash = 19 * hash + 7 * parameter.hashCode;
     }
     for (String name in namedParameters) {
       hash = 23 * hash + 11 * name.hashCode;
     }
-    for (DartType parameter in namedParameterTypes) {
+    for (ResolutionDartType parameter in namedParameterTypes) {
       hash = 29 * hash + 13 * parameter.hashCode;
     }
     return hash;
   }
 
   bool operator ==(other) {
-    if (other is! FunctionType) return false;
+    if (other is! ResolutionFunctionType) return false;
     return returnType == other.returnType &&
         equalElements(parameterTypes, other.parameterTypes) &&
         equalElements(optionalParameterTypes, other.optionalParameterTypes) &&
@@ -820,35 +839,36 @@
   }
 }
 
-bool _typeContainsMethodTypeVariableType(DartType type) =>
+bool _typeContainsMethodTypeVariableType(ResolutionDartType type) =>
     type.containsMethodTypeVariableType;
 
-class TypedefType extends GenericType {
-  DartType _unaliased;
+class ResolutionTypedefType extends GenericType<ResolutionTypedefType> {
+  ResolutionDartType _unaliased;
 
-  TypedefType(TypedefElement element,
-      [List<DartType> typeArguments = const <DartType>[]])
+  ResolutionTypedefType(TypedefElement element,
+      [List<ResolutionDartType> typeArguments = const <ResolutionDartType>[]])
       : super(element, typeArguments);
 
-  TypedefType.forUserProvidedBadType(TypedefElement element,
-      [List<DartType> typeArguments = const <DartType>[]])
+  ResolutionTypedefType.forUserProvidedBadType(TypedefElement element,
+      [List<ResolutionDartType> typeArguments = const <ResolutionDartType>[]])
       : super(element, typeArguments, checkTypeArgumentCount: false);
 
   TypedefElement get element => super.element;
 
-  TypeKind get kind => TypeKind.TYPEDEF;
+  ResolutionTypeKind get kind => ResolutionTypeKind.TYPEDEF;
 
   String get name => element.name;
 
-  TypedefType createInstantiation(List<DartType> newTypeArguments) {
-    return new TypedefType(element, newTypeArguments);
+  ResolutionTypedefType createInstantiation(
+      List<ResolutionDartType> newTypeArguments) {
+    return new ResolutionTypedefType(element, newTypeArguments);
   }
 
   void computeUnaliased(Resolution resolution) {
     if (_unaliased == null) {
       element.ensureResolved(resolution);
       if (element.isMalformed) {
-        _unaliased = const DynamicType();
+        _unaliased = const ResolutionDynamicType();
         return;
       }
       element.checkCyclicReference(resolution);
@@ -857,9 +877,9 @@
     }
   }
 
-  DartType get unaliased {
+  ResolutionDartType get unaliased {
     if (_unaliased == null) {
-      DartType definition = element.alias.unaliased;
+      ResolutionDartType definition = element.alias.unaliased;
       _unaliased = definition.substByContext(this);
     }
     return _unaliased;
@@ -867,7 +887,7 @@
 
   int get hashCode => super.hashCode;
 
-  TypedefType asRaw() => super.asRaw();
+  ResolutionTypedefType asRaw() => super.asRaw();
 
   accept(DartTypeVisitor visitor, var argument) {
     return visitor.visitTypedefType(this, argument);
@@ -877,8 +897,8 @@
 /**
  * Special type for the `dynamic` type.
  */
-class DynamicType extends DartType {
-  const DynamicType();
+class ResolutionDynamicType extends ResolutionDartType implements DynamicType {
+  const ResolutionDynamicType();
 
   Element get element => null;
 
@@ -886,9 +906,11 @@
 
   bool get treatAsDynamic => true;
 
-  TypeKind get kind => TypeKind.DYNAMIC;
+  ResolutionTypeKind get kind => ResolutionTypeKind.DYNAMIC;
 
-  DartType subst(List<DartType> arguments, List<DartType> parameters) => this;
+  ResolutionDartType subst(List<ResolutionDartType> arguments,
+          List<ResolutionDartType> parameters) =>
+      this;
 
   accept(DartTypeVisitor visitor, var argument) {
     return visitor.visitDynamicType(this, argument);
@@ -919,16 +941,17 @@
  * `B<F>` and `B<String>`.
  */
 class InterfaceMember implements MemberSignature {
-  final InterfaceType instance;
+  final ResolutionInterfaceType instance;
   final MemberSignature member;
 
   InterfaceMember(this.instance, this.member);
 
   Name get name => member.name;
 
-  DartType get type => member.type.substByContext(instance);
+  ResolutionDartType get type => member.type.substByContext(instance);
 
-  FunctionType get functionType => member.functionType.substByContext(instance);
+  ResolutionFunctionType get functionType =>
+      member.functionType.substByContext(instance);
 
   bool get isGetter => member.isGetter;
 
@@ -942,105 +965,104 @@
 abstract class DartTypeVisitor<R, A> {
   const DartTypeVisitor();
 
-  R visit(DartType type, A argument) => type.accept(this, argument);
+  R visit(ResolutionDartType type, A argument) => type.accept(this, argument);
 
-  R visitVoidType(VoidType type, A argument) => null;
+  R visitVoidType(ResolutionVoidType type, A argument) => null;
 
-  R visitTypeVariableType(TypeVariableType type, A argument) => null;
+  R visitTypeVariableType(ResolutionTypeVariableType type, A argument) => null;
 
-  R visitFunctionType(FunctionType type, A argument) => null;
+  R visitFunctionType(ResolutionFunctionType type, A argument) => null;
 
   R visitMalformedType(MalformedType type, A argument) => null;
 
-  R visitStatementType(StatementType type, A argument) => null;
+  R visitInterfaceType(ResolutionInterfaceType type, A argument) => null;
 
-  R visitInterfaceType(InterfaceType type, A argument) => null;
+  R visitTypedefType(ResolutionTypedefType type, A argument) => null;
 
-  R visitTypedefType(TypedefType type, A argument) => null;
-
-  R visitDynamicType(DynamicType type, A argument) => null;
+  R visitDynamicType(ResolutionDynamicType type, A argument) => null;
 }
 
 abstract class BaseDartTypeVisitor<R, A> extends DartTypeVisitor<R, A> {
   const BaseDartTypeVisitor();
 
-  R visitType(DartType type, A argument);
+  R visitType(ResolutionDartType type, A argument);
 
   @override
-  R visitVoidType(VoidType type, A argument) => visitType(type, argument);
-
-  @override
-  R visitTypeVariableType(TypeVariableType type, A argument) =>
+  R visitVoidType(ResolutionVoidType type, A argument) =>
       visitType(type, argument);
 
   @override
-  R visitFunctionType(FunctionType type, A argument) =>
+  R visitTypeVariableType(ResolutionTypeVariableType type, A argument) =>
+      visitType(type, argument);
+
+  @override
+  R visitFunctionType(ResolutionFunctionType type, A argument) =>
       visitType(type, argument);
 
   @override
   R visitMalformedType(MalformedType type, A argument) =>
       visitType(type, argument);
 
-  @override
-  R visitStatementType(StatementType type, A argument) =>
-      visitType(type, argument);
-
   R visitGenericType(GenericType type, A argument) => visitType(type, argument);
 
   @override
-  R visitInterfaceType(InterfaceType type, A argument) =>
+  R visitInterfaceType(ResolutionInterfaceType type, A argument) =>
       visitGenericType(type, argument);
 
   @override
-  R visitTypedefType(TypedefType type, A argument) =>
+  R visitTypedefType(ResolutionTypedefType type, A argument) =>
       visitGenericType(type, argument);
 
   @override
-  R visitDynamicType(DynamicType type, A argument) => visitType(type, argument);
+  R visitDynamicType(ResolutionDynamicType type, A argument) =>
+      visitType(type, argument);
 }
 
 /**
  * Abstract visitor for determining relations between types.
  */
 abstract class AbstractTypeRelation
-    extends BaseDartTypeVisitor<bool, DartType> {
+    extends BaseDartTypeVisitor<bool, ResolutionDartType> {
   final Resolution resolution;
 
   AbstractTypeRelation(this.resolution);
 
-  CoreTypes get coreTypes => resolution.coreTypes;
+  CommonElements get commonElements => resolution.commonElements;
 
-  bool visitType(DartType t, DartType s) {
+  bool visitType(ResolutionDartType t, ResolutionDartType s) {
     throw 'internal error: unknown type kind ${t.kind}';
   }
 
-  bool visitVoidType(VoidType t, DartType s) {
-    assert(s is! VoidType);
+  bool visitVoidType(ResolutionVoidType t, ResolutionDartType s) {
+    assert(s is! ResolutionVoidType);
     return false;
   }
 
-  bool invalidTypeArguments(DartType t, DartType s);
+  bool invalidTypeArguments(ResolutionDartType t, ResolutionDartType s);
 
-  bool invalidFunctionReturnTypes(DartType t, DartType s);
+  bool invalidFunctionReturnTypes(ResolutionDartType t, ResolutionDartType s);
 
-  bool invalidFunctionParameterTypes(DartType t, DartType s);
+  bool invalidFunctionParameterTypes(
+      ResolutionDartType t, ResolutionDartType s);
 
-  bool invalidTypeVariableBounds(DartType bound, DartType s);
+  bool invalidTypeVariableBounds(
+      ResolutionDartType bound, ResolutionDartType s);
 
-  bool invalidCallableType(DartType callType, DartType s);
+  bool invalidCallableType(ResolutionDartType callType, ResolutionDartType s);
 
   /// Handle as dynamic for both subtype and more specific relation to avoid
   /// spurious errors from malformed types.
-  bool visitMalformedType(MalformedType t, DartType s) => true;
+  bool visitMalformedType(MalformedType t, ResolutionDartType s) => true;
 
-  bool visitInterfaceType(InterfaceType t, DartType s) {
+  bool visitInterfaceType(ResolutionInterfaceType t, ResolutionDartType s) {
     // TODO(johnniwinther): Currently needed since literal types like int,
     // double, bool etc. might not have been resolved yet.
     t.element.ensureResolved(resolution);
 
-    bool checkTypeArguments(InterfaceType instance, InterfaceType other) {
-      List<DartType> tTypeArgs = instance.typeArguments;
-      List<DartType> sTypeArgs = other.typeArguments;
+    bool checkTypeArguments(
+        ResolutionInterfaceType instance, ResolutionInterfaceType other) {
+      List<ResolutionDartType> tTypeArgs = instance.typeArguments;
+      List<ResolutionDartType> sTypeArgs = other.typeArguments;
       assert(tTypeArgs.length == sTypeArgs.length);
       for (int i = 0; i < tTypeArgs.length; i++) {
         if (invalidTypeArguments(tTypeArgs[i], sTypeArgs[i])) {
@@ -1050,30 +1072,30 @@
       return true;
     }
 
-    if (s is InterfaceType) {
-      InterfaceType instance = t.asInstanceOf(s.element);
+    if (s is ResolutionInterfaceType) {
+      ResolutionInterfaceType instance = t.asInstanceOf(s.element);
       if (instance != null && checkTypeArguments(instance, s)) {
         return true;
       }
     }
 
-    if (s == coreTypes.functionType && t.element.callType != null) {
+    if (s == commonElements.functionType && t.element.callType != null) {
       return true;
-    } else if (s is FunctionType) {
-      FunctionType callType = t.callType;
+    } else if (s is ResolutionFunctionType) {
+      ResolutionFunctionType callType = t.callType;
       return callType != null && !invalidCallableType(callType, s);
     }
 
     return false;
   }
 
-  bool visitFunctionType(FunctionType t, DartType s) {
-    if (s == coreTypes.functionType) {
+  bool visitFunctionType(ResolutionFunctionType t, ResolutionDartType s) {
+    if (s == commonElements.functionType) {
       return true;
     }
-    if (s is! FunctionType) return false;
-    FunctionType tf = t;
-    FunctionType sf = s;
+    if (s is! ResolutionFunctionType) return false;
+    ResolutionFunctionType tf = t;
+    ResolutionFunctionType sf = s;
     if (invalidFunctionReturnTypes(tf.returnType, sf.returnType)) {
       return false;
     }
@@ -1086,8 +1108,8 @@
     //  x.o     : optionalParameterTypes on [:x:], and
     //  len(xs) : length of list [:xs:].
 
-    Iterator<DartType> tps = tf.parameterTypes.iterator;
-    Iterator<DartType> sps = sf.parameterTypes.iterator;
+    Iterator<ResolutionDartType> tps = tf.parameterTypes.iterator;
+    Iterator<ResolutionDartType> sps = sf.parameterTypes.iterator;
     bool sNotEmpty = sps.moveNext();
     bool tNotEmpty = tps.moveNext();
     tNext() => (tNotEmpty = tps.moveNext());
@@ -1118,9 +1140,9 @@
       // subset relation with a linear search for [:sf.namedParameters:]
       // within [:tf.namedParameters:].
       List<String> tNames = tf.namedParameters;
-      List<DartType> tTypes = tf.namedParameterTypes;
+      List<ResolutionDartType> tTypes = tf.namedParameterTypes;
       List<String> sNames = sf.namedParameters;
-      List<DartType> sTypes = sf.namedParameterTypes;
+      List<ResolutionDartType> sTypes = sf.namedParameterTypes;
       int tIndex = 0;
       int sIndex = 0;
       while (tIndex < tNames.length && sIndex < sNames.length) {
@@ -1165,9 +1187,10 @@
     return true;
   }
 
-  bool visitTypeVariableType(TypeVariableType t, DartType s) {
+  bool visitTypeVariableType(
+      ResolutionTypeVariableType t, ResolutionDartType s) {
     // Identity check is handled in [isSubtype].
-    DartType bound = t.element.bound;
+    ResolutionDartType bound = t.element.bound;
     if (bound.isTypeVariable) {
       // The bound is potentially cyclic so we need to be extra careful.
       Set<TypeVariableElement> seenTypeVariables =
@@ -1197,8 +1220,8 @@
 class MoreSpecificVisitor extends AbstractTypeRelation {
   MoreSpecificVisitor(Resolution resolution) : super(resolution);
 
-  bool isMoreSpecific(DartType t, DartType s) {
-    if (identical(t, s) || s.treatAsDynamic || t == coreTypes.nullType) {
+  bool isMoreSpecific(ResolutionDartType t, ResolutionDartType s) {
+    if (identical(t, s) || s.treatAsDynamic || t == commonElements.nullType) {
       return true;
     }
     if (t.isVoid || s.isVoid) {
@@ -1207,7 +1230,7 @@
     if (t.treatAsDynamic) {
       return false;
     }
-    if (s == coreTypes.objectType) {
+    if (s == commonElements.objectType) {
       return true;
     }
     t.computeUnaliased(resolution);
@@ -1218,24 +1241,26 @@
     return t.accept(this, s);
   }
 
-  bool invalidTypeArguments(DartType t, DartType s) {
+  bool invalidTypeArguments(ResolutionDartType t, ResolutionDartType s) {
     return !isMoreSpecific(t, s);
   }
 
-  bool invalidFunctionReturnTypes(DartType t, DartType s) {
+  bool invalidFunctionReturnTypes(ResolutionDartType t, ResolutionDartType s) {
     if (s.treatAsDynamic && t.isVoid) return true;
     return !s.isVoid && !isMoreSpecific(t, s);
   }
 
-  bool invalidFunctionParameterTypes(DartType t, DartType s) {
+  bool invalidFunctionParameterTypes(
+      ResolutionDartType t, ResolutionDartType s) {
     return !isMoreSpecific(t, s);
   }
 
-  bool invalidTypeVariableBounds(DartType bound, DartType s) {
+  bool invalidTypeVariableBounds(
+      ResolutionDartType bound, ResolutionDartType s) {
     return !isMoreSpecific(bound, s);
   }
 
-  bool invalidCallableType(DartType callType, DartType s) {
+  bool invalidCallableType(ResolutionDartType callType, ResolutionDartType s) {
     return !isMoreSpecific(callType, s);
   }
 }
@@ -1246,31 +1271,33 @@
 class SubtypeVisitor extends MoreSpecificVisitor {
   SubtypeVisitor(Resolution resolution) : super(resolution);
 
-  bool isSubtype(DartType t, DartType s) {
+  bool isSubtype(ResolutionDartType t, ResolutionDartType s) {
     return t.treatAsDynamic || isMoreSpecific(t, s);
   }
 
-  bool isAssignable(DartType t, DartType s) {
+  bool isAssignable(ResolutionDartType t, ResolutionDartType s) {
     return isSubtype(t, s) || isSubtype(s, t);
   }
 
-  bool invalidTypeArguments(DartType t, DartType s) {
+  bool invalidTypeArguments(ResolutionDartType t, ResolutionDartType s) {
     return !isSubtype(t, s);
   }
 
-  bool invalidFunctionReturnTypes(DartType t, DartType s) {
+  bool invalidFunctionReturnTypes(ResolutionDartType t, ResolutionDartType s) {
     return !s.isVoid && !isAssignable(t, s);
   }
 
-  bool invalidFunctionParameterTypes(DartType t, DartType s) {
+  bool invalidFunctionParameterTypes(
+      ResolutionDartType t, ResolutionDartType s) {
     return !isAssignable(t, s);
   }
 
-  bool invalidTypeVariableBounds(DartType bound, DartType s) {
+  bool invalidTypeVariableBounds(
+      ResolutionDartType bound, ResolutionDartType s) {
     return !isSubtype(bound, s);
   }
 
-  bool invalidCallableType(DartType callType, DartType s) {
+  bool invalidCallableType(ResolutionDartType callType, ResolutionDartType s) {
     return !isSubtype(callType, s);
   }
 }
@@ -1280,20 +1307,23 @@
  * substitute for the bound of [typeVariable]. [bound] holds the bound against
  * which [typeArgument] should be checked.
  */
-typedef void CheckTypeVariableBound(GenericType type, DartType typeArgument,
-    TypeVariableType typeVariable, DartType bound);
+typedef void CheckTypeVariableBound(
+    GenericType type,
+    ResolutionDartType typeArgument,
+    ResolutionTypeVariableType typeVariable,
+    ResolutionDartType bound);
 
 /// Basic interface for the Dart type system.
 abstract class DartTypes {
   /// The types defined in 'dart:core'.
-  CoreTypes get coreTypes;
+  CommonElements get commonElements;
 
   /// Returns `true` if [t] is a subtype of [s].
-  bool isSubtype(DartType t, DartType s);
+  bool isSubtype(ResolutionDartType t, ResolutionDartType s);
 
   /// Returns `true` if [t] might be a subtype of [s] for some values of
   /// type variables in [s] and [t].
-  bool isPotentialSubtype(DartType t, DartType s);
+  bool isPotentialSubtype(ResolutionDartType t, ResolutionDartType s);
 }
 
 class Types implements DartTypes {
@@ -1302,7 +1332,7 @@
   final SubtypeVisitor subtypeVisitor;
   final PotentialSubtypeVisitor potentialSubtypeVisitor;
 
-  CoreTypes get coreTypes => resolution.coreTypes;
+  CommonElements get commonElements => resolution.commonElements;
 
   DiagnosticReporter get reporter => resolution.reporter;
 
@@ -1332,13 +1362,14 @@
   ///
   /// This method is used in the static typing of await and type checking of
   /// return.
-  DartType flatten(DartType type) {
-    if (type is InterfaceType) {
-      if (type.element == coreTypes.futureClass) {
+  ResolutionDartType flatten(ResolutionDartType type) {
+    if (type is ResolutionInterfaceType) {
+      if (type.element == commonElements.futureClass) {
         // T = Future<S>
         return flatten(type.typeArguments.first);
       }
-      InterfaceType futureType = type.asInstanceOf(coreTypes.futureClass);
+      ResolutionInterfaceType futureType =
+          type.asInstanceOf(commonElements.futureClass);
       if (futureType != null) {
         // T << Future<S>
         return futureType.typeArguments.single;
@@ -1348,13 +1379,14 @@
   }
 
   /// Returns true if [t] is more specific than [s].
-  bool isMoreSpecific(DartType t, DartType s) {
+  bool isMoreSpecific(ResolutionDartType t, ResolutionDartType s) {
     return moreSpecificVisitor.isMoreSpecific(t, s);
   }
 
   /// Returns the most specific type of [t] and [s] or `null` if neither is more
   /// specific than the other.
-  DartType getMostSpecific(DartType t, DartType s) {
+  ResolutionDartType getMostSpecific(
+      ResolutionDartType t, ResolutionDartType s) {
     if (isMoreSpecific(t, s)) {
       return t;
     } else if (isMoreSpecific(s, t)) {
@@ -1365,11 +1397,11 @@
   }
 
   /** Returns true if t is a subtype of s */
-  bool isSubtype(DartType t, DartType s) {
+  bool isSubtype(ResolutionDartType t, ResolutionDartType s) {
     return subtypeVisitor.isSubtype(t, s);
   }
 
-  bool isAssignable(DartType r, DartType s) {
+  bool isAssignable(ResolutionDartType r, ResolutionDartType s) {
     return subtypeVisitor.isAssignable(r, s);
   }
 
@@ -1377,13 +1409,13 @@
   static const int MAYBE_SUBTYPE = 0;
   static const int NOT_SUBTYPE = -1;
 
-  int computeSubtypeRelation(DartType t, DartType s) {
+  int computeSubtypeRelation(ResolutionDartType t, ResolutionDartType s) {
     // TODO(johnniwinther): Compute this directly in [isPotentialSubtype].
     if (isSubtype(t, s)) return IS_SUBTYPE;
     return isPotentialSubtype(t, s) ? MAYBE_SUBTYPE : NOT_SUBTYPE;
   }
 
-  bool isPotentialSubtype(DartType t, DartType s) {
+  bool isPotentialSubtype(ResolutionDartType t, ResolutionDartType s) {
     // TODO(johnniwinther): Return a set of variable points in the positive
     // cases.
     return potentialSubtypeVisitor.isSubtype(t, s);
@@ -1397,13 +1429,14 @@
   void checkTypeVariableBounds(
       GenericType type, CheckTypeVariableBound checkTypeVariableBound) {
     TypeDeclarationElement element = type.element;
-    List<DartType> typeArguments = type.typeArguments;
-    List<DartType> typeVariables = element.typeVariables;
+    List<ResolutionDartType> typeArguments = type.typeArguments;
+    List<ResolutionDartType> typeVariables = element.typeVariables;
     assert(typeVariables.length == typeArguments.length);
     for (int index = 0; index < typeArguments.length; index++) {
-      TypeVariableType typeVariable = typeVariables[index];
-      DartType bound = typeVariable.element.bound.substByContext(type);
-      DartType typeArgument = typeArguments[index];
+      ResolutionTypeVariableType typeVariable = typeVariables[index];
+      ResolutionDartType bound =
+          typeVariable.element.bound.substByContext(type);
+      ResolutionDartType typeArgument = typeArguments[index];
       checkTypeVariableBound(type, typeArgument, typeVariable, bound);
     }
   }
@@ -1414,12 +1447,13 @@
    * If no types are changed by the substitution, the [types] is returned
    * instead of a newly created list.
    */
-  static List<DartType> substTypes(List<DartType> types,
-      List<DartType> arguments, List<DartType> parameters) {
+  static List<ResolutionDartType> substTypes(List<ResolutionDartType> types,
+      List<ResolutionDartType> arguments, List<ResolutionDartType> parameters) {
     bool changed = false;
-    List<DartType> result = new List<DartType>.generate(types.length, (index) {
-      DartType type = types[index];
-      DartType argument = type.subst(arguments, parameters);
+    List<ResolutionDartType> result =
+        new List<ResolutionDartType>.generate(types.length, (index) {
+      ResolutionDartType type = types[index];
+      ResolutionDartType argument = type.subst(arguments, parameters);
       if (!changed && !identical(argument, type)) {
         changed = true;
       }
@@ -1433,9 +1467,12 @@
    * Returns the [ClassElement] which declares the type variables occurring in
    * [type], or [:null:] if [type] does not contain type variables.
    */
-  static ClassElement getClassContext(DartType type) {
-    TypeVariableType typeVariable = type.typeVariableOccurrence;
-    if (typeVariable == null) return null;
+  static ClassElement getClassContext(ResolutionDartType type) {
+    ClassElement contextClass;
+    type.forEachTypeVariable((ResolutionTypeVariableType typeVariable) {
+      if (typeVariable.element.typeDeclaration is! ClassElement) return;
+      contextClass = typeVariable.element.typeDeclaration;
+    });
     // GENERIC_METHODS: When generic method support is complete enough to
     // include a runtime value for method type variables this must be updated.
     // For full support the global assumption that all type variables are
@@ -1444,8 +1481,7 @@
     // type cannot be [ClassElement] and the caller must be prepared to look in
     // two locations, not one. Currently we ignore method type variables by
     // returning in the next statement.
-    if (typeVariable.element.typeDeclaration is! ClassElement) return null;
-    return typeVariable.element.typeDeclaration;
+    return contextClass;
   }
 
   /**
@@ -1467,7 +1503,7 @@
    * * malformed types
    * * statement types
    */
-  static int compare(DartType a, DartType b) {
+  static int compare(ResolutionDartType a, ResolutionDartType b) {
     if (a == b) return 0;
     if (a.isVoid) {
       // [b] is not void => a < b.
@@ -1483,7 +1519,7 @@
       // [a] is not dynamic => a > b.
       return 1;
     }
-    bool isDefinedByDeclaration(DartType type) {
+    bool isDefinedByDeclaration(ResolutionDartType type) {
       return type.isInterfaceType || type.isTypedef || type.isTypeVariable;
     }
 
@@ -1516,8 +1552,8 @@
     }
     if (a.isFunctionType) {
       if (b.isFunctionType) {
-        FunctionType aFunc = a;
-        FunctionType bFunc = b;
+        ResolutionFunctionType aFunc = a;
+        ResolutionFunctionType bFunc = b;
         int result = compare(aFunc.returnType, bFunc.returnType);
         if (result != 0) return result;
         result = compareList(aFunc.parameterTypes, bFunc.parameterTypes);
@@ -1549,24 +1585,14 @@
       // [b] is a malformed or statement type => a > b.
       return 1;
     }
-    if (a.kind == TypeKind.STATEMENT) {
-      if (b.kind == TypeKind.STATEMENT) {
-        return 0;
-      } else {
-        // [b] is a malformed type => a > b.
-        return 1;
-      }
-    } else if (b.kind == TypeKind.STATEMENT) {
-      // [a] is a malformed type => a < b.
-      return -1;
-    }
     assert(a.isMalformed);
     assert(b.isMalformed);
     // TODO(johnniwinther): Can we do this better?
     return Elements.compareByPosition(a.element, b.element);
   }
 
-  static int compareList(List<DartType> a, List<DartType> b) {
+  static int compareList(
+      List<ResolutionDartType> a, List<ResolutionDartType> b) {
     for (int index = 0; index < min(a.length, b.length); index++) {
       int result = compare(a[index], b[index]);
       if (result != 0) return result;
@@ -1579,18 +1605,19 @@
     return 0;
   }
 
-  static List<DartType> sorted(Iterable<DartType> types) {
+  static List<ResolutionDartType> sorted(Iterable<ResolutionDartType> types) {
     return types.toList()..sort(compare);
   }
 
   /// Computes the least upper bound of two interface types [a] and [b].
-  InterfaceType computeLeastUpperBoundInterfaces(
-      InterfaceType a, InterfaceType b) {
+  ResolutionInterfaceType computeLeastUpperBoundInterfaces(
+      ResolutionInterfaceType a, ResolutionInterfaceType b) {
     /// Returns the set of supertypes of [type] at depth [depth].
-    Set<DartType> getSupertypesAtDepth(InterfaceType type, int depth) {
+    Set<ResolutionDartType> getSupertypesAtDepth(
+        ResolutionInterfaceType type, int depth) {
       OrderedTypeSet types = type.element.allSupertypesAndSelf;
-      Set<DartType> set = new Set<DartType>();
-      types.forEach(depth, (DartType supertype) {
+      Set<ResolutionDartType> set = new Set<ResolutionDartType>();
+      types.forEach(depth, (ResolutionDartType supertype) {
         set.add(supertype.substByContext(type));
       });
       return set;
@@ -1600,9 +1627,9 @@
     ClassElement bClass = b.element;
     int maxCommonDepth = min(aClass.hierarchyDepth, bClass.hierarchyDepth);
     for (int depth = maxCommonDepth; depth >= 0; depth--) {
-      Set<DartType> aTypeSet = getSupertypesAtDepth(a, depth);
-      Set<DartType> bTypeSet = getSupertypesAtDepth(b, depth);
-      Set<DartType> intersection = aTypeSet..retainAll(bTypeSet);
+      Set<ResolutionDartType> aTypeSet = getSupertypesAtDepth(a, depth);
+      Set<ResolutionDartType> bTypeSet = getSupertypesAtDepth(b, depth);
+      Set<ResolutionDartType> intersection = aTypeSet..retainAll(bTypeSet);
       if (intersection.length == 1) {
         return intersection.first;
       }
@@ -1615,11 +1642,11 @@
 
   /// Computes the least upper bound of the types in the longest prefix of [a]
   /// and [b].
-  List<DartType> computeLeastUpperBoundsTypes(
-      List<DartType> a, List<DartType> b) {
-    if (a.isEmpty || b.isEmpty) return const <DartType>[];
+  List<ResolutionDartType> computeLeastUpperBoundsTypes(
+      List<ResolutionDartType> a, List<ResolutionDartType> b) {
+    if (a.isEmpty || b.isEmpty) return const <ResolutionDartType>[];
     int prefixLength = min(a.length, b.length);
-    List<DartType> types = new List<DartType>(prefixLength);
+    List<ResolutionDartType> types = new List<ResolutionDartType>(prefixLength);
     for (int index = 0; index < prefixLength; index++) {
       types[index] = computeLeastUpperBound(a[index], b[index]);
     }
@@ -1637,21 +1664,25 @@
   /// bound of the longest common prefix of the optional parameters of [a] and
   /// [b], and the named parameters are the least upper bound of those common to
   /// [a] and [b].
-  DartType computeLeastUpperBoundFunctionTypes(FunctionType a, FunctionType b) {
+  ResolutionDartType computeLeastUpperBoundFunctionTypes(
+      ResolutionFunctionType a, ResolutionFunctionType b) {
     if (a.parameterTypes.length != b.parameterTypes.length) {
-      return coreTypes.functionType;
+      ResolutionInterfaceType functionType = commonElements.functionType;
+      return functionType;
     }
-    DartType returnType = computeLeastUpperBound(a.returnType, b.returnType);
-    List<DartType> parameterTypes =
+    ResolutionDartType returnType =
+        computeLeastUpperBound(a.returnType, b.returnType);
+    List<ResolutionDartType> parameterTypes =
         computeLeastUpperBoundsTypes(a.parameterTypes, b.parameterTypes);
-    List<DartType> optionalParameterTypes = computeLeastUpperBoundsTypes(
-        a.optionalParameterTypes, b.optionalParameterTypes);
+    List<ResolutionDartType> optionalParameterTypes =
+        computeLeastUpperBoundsTypes(
+            a.optionalParameterTypes, b.optionalParameterTypes);
     List<String> namedParameters = <String>[];
     List<String> aNamedParameters = a.namedParameters;
     List<String> bNamedParameters = b.namedParameters;
-    List<DartType> namedParameterTypes = <DartType>[];
-    List<DartType> aNamedParameterTypes = a.namedParameterTypes;
-    List<DartType> bNamedParameterTypes = b.namedParameterTypes;
+    List<ResolutionDartType> namedParameterTypes = <ResolutionDartType>[];
+    List<ResolutionDartType> aNamedParameterTypes = a.namedParameterTypes;
+    List<ResolutionDartType> bNamedParameterTypes = b.namedParameterTypes;
     int aIndex = 0;
     int bIndex = 0;
     while (
@@ -1671,7 +1702,7 @@
         bIndex++;
       }
     }
-    return new FunctionType.synthesized(returnType, parameterTypes,
+    return new ResolutionFunctionType.synthesized(returnType, parameterTypes,
         optionalParameterTypes, namedParameters, namedParameterTypes);
   }
 
@@ -1679,8 +1710,9 @@
   /// type variable. The least upper bound of a type variable is defined in
   /// terms of its bound, but to ensure reflexivity we need to check for common
   /// bounds transitively.
-  DartType computeLeastUpperBoundTypeVariableTypes(DartType a, DartType b) {
-    Set<DartType> typeVariableBounds = new Set<DartType>();
+  ResolutionDartType computeLeastUpperBoundTypeVariableTypes(
+      ResolutionDartType a, ResolutionDartType b) {
+    Set<ResolutionDartType> typeVariableBounds = new Set<ResolutionDartType>();
     while (a.isTypeVariable) {
       if (a == b) return a;
       typeVariableBounds.add(a);
@@ -1696,7 +1728,8 @@
   }
 
   /// Computes the least upper bound for [a] and [b].
-  DartType computeLeastUpperBound(DartType a, DartType b) {
+  ResolutionDartType computeLeastUpperBound(
+      ResolutionDartType a, ResolutionDartType b) {
     if (a == b) return a;
 
     if (a.isTypeVariable || b.isTypeVariable) {
@@ -1708,24 +1741,27 @@
     b.computeUnaliased(resolution);
     b = b.unaliased;
 
-    if (a.treatAsDynamic || b.treatAsDynamic) return const DynamicType();
-    if (a.isVoid || b.isVoid) return const VoidType();
+    if (a.treatAsDynamic || b.treatAsDynamic)
+      return const ResolutionDynamicType();
+    if (a.isVoid || b.isVoid) return const ResolutionVoidType();
 
     if (a.isFunctionType && b.isFunctionType) {
       return computeLeastUpperBoundFunctionTypes(a, b);
     }
 
     if (a.isFunctionType) {
-      a = coreTypes.functionType;
+      ResolutionInterfaceType functionType = commonElements.functionType;
+      a = functionType;
     }
     if (b.isFunctionType) {
-      b = coreTypes.functionType;
+      ResolutionInterfaceType functionType = commonElements.functionType;
+      b = functionType;
     }
 
     if (a.isInterfaceType && b.isInterfaceType) {
       return computeLeastUpperBoundInterfaces(a, b);
     }
-    return const DynamicType();
+    return const ResolutionDynamicType();
   }
 
   /// Computes the unaliased type of the first non type variable bound of
@@ -1755,17 +1791,20 @@
   ///     unaliasedBound(U) = unaliasedBound(Baz) = ()->dynamic
   ///     unaliasedBound(X) = unaliasedBound(Y) = `Object`
   ///
-  static DartType computeUnaliasedBound(Resolution resolution, DartType type) {
-    DartType originalType = type;
+  static ResolutionDartType computeUnaliasedBound(
+      Resolution resolution, ResolutionDartType type) {
+    ResolutionDartType originalType = type;
     while (type.isTypeVariable) {
-      TypeVariableType variable = type;
+      ResolutionTypeVariableType variable = type;
       type = variable.element.bound;
       if (type == originalType) {
-        type = resolution.coreTypes.objectType;
+        ResolutionInterfaceType objectType =
+            resolution.commonElements.objectType;
+        type = objectType;
       }
     }
     if (type.isMalformed) {
-      return const DynamicType();
+      return const ResolutionDynamicType();
     }
     type.computeUnaliased(resolution);
     return type.unaliased;
@@ -1798,14 +1837,16 @@
   /// When typechecking `o.foo` the interface type of the static type of `o` is
   /// used to lookup the existence and type of `foo`.
   ///
-  static InterfaceType computeInterfaceType(
-      Resolution resolution, DartType type) {
+  static ResolutionInterfaceType computeInterfaceType(
+      Resolution resolution, ResolutionDartType type) {
     type = computeUnaliasedBound(resolution, type);
     if (type.treatAsDynamic) {
       return null;
     }
     if (type.isFunctionType) {
-      type = resolution.coreTypes.functionType;
+      ResolutionInterfaceType functionType =
+          resolution.commonElements.functionType;
+      type = functionType;
     }
     assert(invariant(NO_LOCATION_SPANNABLE, type.isInterfaceType,
         message: "unexpected type kind ${type.kind}."));
@@ -1821,8 +1862,8 @@
 class PotentialSubtypeVisitor extends SubtypeVisitor {
   PotentialSubtypeVisitor(Resolution resolution) : super(resolution);
 
-  bool isSubtype(DartType t, DartType s) {
-    if (t is TypeVariableType || s is TypeVariableType) {
+  bool isSubtype(ResolutionDartType t, ResolutionDartType s) {
+    if (t is ResolutionTypeVariableType || s is ResolutionTypeVariableType) {
       return true;
     }
     return super.isSubtype(t, s);
@@ -1836,9 +1877,10 @@
 /// visited type by structurally matching it with the argument type. If the
 /// constraints are too complex or the two types are too different, `false`
 /// is returned. Otherwise, the [constraintMap] holds the valid constraints.
-class MoreSpecificSubtypeVisitor extends BaseDartTypeVisitor<bool, DartType> {
+class MoreSpecificSubtypeVisitor
+    extends BaseDartTypeVisitor<bool, ResolutionDartType> {
   final Types types;
-  Map<TypeVariableType, DartType> constraintMap;
+  Map<ResolutionTypeVariableType, ResolutionDartType> constraintMap;
 
   MoreSpecificSubtypeVisitor(this.types);
 
@@ -1847,30 +1889,31 @@
   ///
   /// Note that this computation is a heuristic. It does not find a suggestion
   /// in all possible cases.
-  InterfaceType computeMoreSpecific(
-      ClassElement element, InterfaceType supertype) {
-    InterfaceType supertypeInstance =
+  ResolutionInterfaceType computeMoreSpecific(
+      ClassElement element, ResolutionInterfaceType supertype) {
+    ResolutionInterfaceType supertypeInstance =
         element.thisType.asInstanceOf(supertype.element);
     if (supertypeInstance == null) return null;
 
-    constraintMap = new Map<TypeVariableType, DartType>();
-    element.typeVariables.forEach((TypeVariableType typeVariable) {
-      constraintMap[typeVariable] = const DynamicType();
+    constraintMap = new Map<ResolutionTypeVariableType, ResolutionDartType>();
+    element.typeVariables.forEach((ResolutionTypeVariableType typeVariable) {
+      constraintMap[typeVariable] = const ResolutionDynamicType();
     });
     if (supertypeInstance.accept(this, supertype)) {
-      List<DartType> variables = element.typeVariables;
-      List<DartType> typeArguments = new List<DartType>.generate(
-          variables.length, (int index) => constraintMap[variables[index]]);
+      List<ResolutionDartType> variables = element.typeVariables;
+      List<ResolutionDartType> typeArguments =
+          new List<ResolutionDartType>.generate(
+              variables.length, (int index) => constraintMap[variables[index]]);
       return element.thisType.createInstantiation(typeArguments);
     }
     return null;
   }
 
-  bool visitType(DartType type, DartType argument) {
+  bool visitType(ResolutionDartType type, ResolutionDartType argument) {
     return types.isMoreSpecific(type, argument);
   }
 
-  bool visitTypes(List<DartType> a, List<DartType> b) {
+  bool visitTypes(List<ResolutionDartType> a, List<ResolutionDartType> b) {
     int prefixLength = min(a.length, b.length);
     for (int index = 0; index < prefixLength; index++) {
       if (!a[index].accept(this, b[index])) return false;
@@ -1878,14 +1921,17 @@
     return prefixLength == a.length && a.length == b.length;
   }
 
-  bool visitTypeVariableType(TypeVariableType type, DartType argument) {
-    DartType constraint = types.getMostSpecific(constraintMap[type], argument);
+  bool visitTypeVariableType(
+      ResolutionTypeVariableType type, ResolutionDartType argument) {
+    ResolutionDartType constraint =
+        types.getMostSpecific(constraintMap[type], argument);
     constraintMap[type] = constraint;
     return constraint != null;
   }
 
-  bool visitFunctionType(FunctionType type, DartType argument) {
-    if (argument is FunctionType) {
+  bool visitFunctionType(
+      ResolutionFunctionType type, ResolutionDartType argument) {
+    if (argument is ResolutionFunctionType) {
       if (type.parameterTypes.length != argument.parameterTypes.length) {
         return false;
       }
@@ -1910,7 +1956,7 @@
     return false;
   }
 
-  bool visitGenericType(GenericType type, DartType argument) {
+  bool visitGenericType(GenericType type, ResolutionDartType argument) {
     if (argument is GenericType) {
       if (type.element != argument.element) return false;
       return visitTypes(type.typeArguments, argument.typeArguments);
@@ -1928,7 +1974,7 @@
 
   /// Creates textual representation of [type] as if a member by the [name] were
   /// declared. For instance 'String foo' for `format(String, 'foo')`.
-  String format(DartType type, String name) {
+  String format(ResolutionDartType type, String name) {
     sb = new StringBuffer();
     usedNames = new Set<String>();
     type.accept(this, name);
@@ -1950,13 +1996,13 @@
     return proposal;
   }
 
-  void visit(DartType type, [_]) {
+  void visit(ResolutionDartType type, [_]) {
     type.accept(this, null);
   }
 
-  void visitTypes(List<DartType> types, String prefix) {
+  void visitTypes(List<ResolutionDartType> types, String prefix) {
     bool needsComma = false;
-    for (DartType type in types) {
+    for (ResolutionDartType type in types) {
       if (needsComma) {
         sb.write(', ');
       }
@@ -1965,7 +2011,7 @@
     }
   }
 
-  void visitType(DartType type, String name) {
+  void visitType(ResolutionDartType type, String name) {
     if (name == null) {
       sb.write(type);
     } else {
@@ -1986,7 +2032,7 @@
     }
   }
 
-  void visitFunctionType(FunctionType type, String name) {
+  void visitFunctionType(ResolutionFunctionType type, String name) {
     visit(type.returnType);
     sb.write(' ');
     if (name != null) {
@@ -2012,7 +2058,7 @@
       }
       sb.write('{');
       List<String> namedParameters = type.namedParameters;
-      List<DartType> namedParameterTypes = type.namedParameterTypes;
+      List<ResolutionDartType> namedParameterTypes = type.namedParameterTypes;
       needsComma = false;
       for (int index = 0; index < namedParameters.length; index++) {
         if (needsComma) {
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart
new file mode 100644
index 0000000..3d564b3
--- /dev/null
+++ b/pkg/compiler/lib/src/elements/types.dart
@@ -0,0 +1,88 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'entities.dart';
+
+/// Hierarchy to describe types in Dart.
+///
+/// This hierarchy is a super hierarchy of the use-case specific hierarchies
+/// used in different parts of the compiler. This hierarchy abstracts details
+/// not generally needed or required for the Dart type hierarchy. For instance,
+/// the hierarchy in 'resolution_types.dart' has properties supporting lazy
+/// computation (like computeAlias) and distinctions between 'Foo' and
+/// 'Foo<dynamic>', features that are not needed for code generation and not
+/// supported from kernel.
+///
+/// Current only 'resolution_types.dart' implement this hierarchy but when the
+/// compiler moves to use [Entity] instead of [Element] this hierarchy can be
+/// implementated directly but other entity systems, for instance based directly
+/// on kernel ir without the need for [Element].
+
+abstract class DartType {
+  /// Returns the unaliased type of this type.
+  ///
+  /// The unaliased type of a typedef'd type is the unaliased type to which its
+  /// name is bound. The unaliased version of any other type is the type itself.
+  ///
+  /// For example, the unaliased type of `typedef A Func<A,B>(B b)` is the
+  /// function type `(B) -> A` and the unaliased type of `Func<int,String>`
+  /// is the function type `(String) -> int`.
+  DartType get unaliased;
+
+  /// Is `true` if this type has no non-dynamic type arguments.
+  bool get treatAsRaw;
+
+  /// Is `true` if this type should be treated as the dynamic type.
+  bool get treatAsDynamic;
+
+  /// Is `true` if this type is the dynamic type.
+  bool get isDynamic;
+
+  /// Is `true` if this type is the void type.
+  bool get isVoid;
+
+  /// Is `true` if this is the type of `Object` from dart:core.
+  bool get isObject;
+
+  /// Is `true` if this type is an interface type.
+  bool get isInterfaceType;
+
+  /// Is `true` if this type is a typedef.
+  bool get isTypedef;
+
+  /// Is `true` if this type is a function type.
+  bool get isFunctionType;
+
+  /// Is `true` if this type is a type variable.
+  bool get isTypeVariable;
+
+  /// Is `true` if this type is a malformed type.
+  bool get isMalformed;
+}
+
+abstract class InterfaceType extends DartType {
+  ClassEntity get element;
+  List<DartType> get typeArguments;
+}
+
+abstract class TypeVariableType extends DartType {
+  TypeVariableEntity get element;
+}
+
+abstract class VoidType extends DartType {}
+
+abstract class DynamicType extends DartType {}
+
+abstract class FunctionType extends DartType {
+  DartType get returnType;
+  List<DartType> get parameterTypes;
+  List<DartType> get optionalParameterTypes;
+
+  /// The names of the named parameters ordered lexicographically.
+  List<String> get namedParameters;
+
+  /// The types of the named parameters in the order corresponding to the
+  /// [namedParameters].
+  List<DartType> get namedParameterTypes;
+}
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index cdd46e9..efbcc50 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -8,37 +8,31 @@
 
 import 'cache_strategy.dart';
 import 'common/backend_api.dart' show Backend;
-import 'common/names.dart' show Identifiers;
-import 'common/resolution.dart' show Resolution, ResolutionWorkItem;
+import 'common/resolution.dart' show Resolution;
 import 'common/tasks.dart' show CompilerTask;
 import 'common/work.dart' show WorkItem;
 import 'common.dart';
 import 'compiler.dart' show Compiler, GlobalDependencyRegistry;
-import 'core_types.dart' show CommonElements;
 import 'options.dart';
-import 'dart_types.dart' show DartType, InterfaceType;
 import 'elements/elements.dart'
     show
         AnalyzableElement,
-        AstElement,
         ClassElement,
         ConstructorElement,
         Element,
         Entity,
-        FunctionElement,
-        LibraryElement,
-        LocalFunctionElement,
-        TypedElement;
+        MemberElement;
+import 'elements/entities.dart';
+import 'elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionInterfaceType;
 import 'native/native.dart' as native;
-import 'types/types.dart' show TypeMaskStrategy;
-import 'universe/selector.dart' show Selector;
 import 'universe/world_builder.dart';
 import 'universe/use.dart'
     show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind;
 import 'universe/world_impact.dart'
     show ImpactStrategy, ImpactUseCase, WorldImpact, WorldImpactVisitor;
+import 'util/enumset.dart';
 import 'util/util.dart' show Setlet;
-import 'world.dart' show OpenWorld;
 
 class EnqueueTask extends CompilerTask {
   ResolutionEnqueuer _resolution;
@@ -59,7 +53,6 @@
             : const TreeShakingEnqueuerStrategy(),
         compiler.globalDependencies,
         compiler.backend,
-        compiler.coreClasses,
         compiler.cacheStrategy);
     _codegen = compiler.backend.createCodegenEnqueuer(this, compiler);
   }
@@ -67,16 +60,16 @@
   ResolutionEnqueuer get resolution => _resolution;
   Enqueuer get codegen => _codegen;
 
-  void forgetElement(Element element) {
-    resolution.forgetElement(element, compiler);
-    codegen.forgetElement(element, compiler);
+  void forgetEntity(Entity entity) {
+    resolution.forgetEntity(entity, compiler);
+    codegen.forgetEntity(entity, compiler);
   }
 }
 
 abstract class Enqueuer {
-  WorldBuilder get universe;
+  WorldBuilder get worldBuilder;
   native.NativeEnqueuer get nativeEnqueuer;
-  void forgetElement(Element element, Compiler compiler);
+  void forgetEntity(Entity entity, Compiler compiler);
 
   // TODO(johnniwinther): Initialize [_impactStrategy] to `null`.
   ImpactStrategy _impactStrategy = const ImpactStrategy();
@@ -107,135 +100,105 @@
   /// Apply the [worldImpact] to this enqueuer. If the [impactSource] is
   /// provided the impact strategy will remove it from the element impact cache,
   /// if it is no longer needed.
-  void applyImpact(WorldImpact worldImpact, {Element impactSource});
+  void applyImpact(WorldImpact worldImpact, {var impactSource});
   bool checkNoEnqueuedInvokedInstanceMethods();
   void logSummary(log(message));
 
-  /// Returns [:true:] if [member] has been processed by this enqueuer.
-  bool isProcessed(Element member);
-
   Iterable<Entity> get processedEntities;
 
-  Iterable<ClassElement> get processedClasses;
+  Iterable<ClassEntity> get processedClasses;
 }
 
 abstract class EnqueuerImpl extends Enqueuer {
   CompilerTask get task;
-  void processInstantiatedClassMembers(ClassElement cls);
-  void processInstantiatedClassMember(ClassElement cls, Element member);
-  void registerStaticUse(StaticUse staticUse);
-  void registerStaticUseInternal(StaticUse staticUse);
-  void registerTypeUse(TypeUse typeUse);
-  void registerTypeUseInternal(TypeUse typeUse);
-  void registerDynamicUse(DynamicUse dynamicUse);
-  void handleUnseenSelectorInternal(DynamicUse dynamicUse);
+  EnqueuerStrategy get strategy;
+  void checkClass(ClassEntity cls);
+  void processStaticUse(StaticUse staticUse);
+  void processTypeUse(TypeUse typeUse);
+  void processDynamicUse(DynamicUse dynamicUse);
 }
 
 /// [Enqueuer] which is specific to resolution.
 class ResolutionEnqueuer extends EnqueuerImpl {
+  static const ImpactUseCase IMPACT_USE =
+      const ImpactUseCase('ResolutionEnqueuer');
+
   final CompilerTask task;
   final String name;
-  final Resolution resolution;
-  final CompilerOptions options;
+  final Resolution _resolution;
+  final CompilerOptions _options;
   final Backend backend;
-  final GlobalDependencyRegistry globalDependencies;
-  final CommonElements commonElements;
+  final GlobalDependencyRegistry _globalDependencies;
   final native.NativeEnqueuer nativeEnqueuer;
 
   final EnqueuerStrategy strategy;
-  final Map<String, Set<Element>> instanceMembersByName =
-      new Map<String, Set<Element>>();
-  final Map<String, Set<Element>> instanceFunctionsByName =
-      new Map<String, Set<Element>>();
-  final Set<ClassElement> _processedClasses = new Set<ClassElement>();
-  Set<ClassElement> recentClasses = new Setlet<ClassElement>();
+  final Set<ClassEntity> _recentClasses = new Setlet<ClassEntity>();
   final ResolutionWorldBuilderImpl _universe;
+  final WorkItemBuilder _workItemBuilder;
 
   bool queueIsClosed = false;
 
-  WorldImpactVisitor impactVisitor;
+  WorldImpactVisitor _impactVisitor;
+
+  /// All declaration elements that have been processed by the resolver.
+  final Set<Entity> _processedEntities = new Set<Entity>();
+
+  final Queue<WorkItem> _queue = new Queue<WorkItem>();
+
+  /// Queue of deferred resolution actions to execute when the resolution queue
+  /// has been emptied.
+  final Queue<_DeferredAction> _deferredQueue = new Queue<_DeferredAction>();
 
   ResolutionEnqueuer(
       this.task,
-      this.options,
-      this.resolution,
+      this._options,
+      Resolution resolution,
       this.strategy,
-      this.globalDependencies,
+      this._globalDependencies,
       Backend backend,
-      CommonElements commonElements,
       CacheStrategy cacheStrategy,
       [this.name = 'resolution enqueuer'])
       : this.backend = backend,
-        this.commonElements = commonElements,
+        this._resolution = resolution,
         this.nativeEnqueuer = backend.nativeResolutionEnqueuer(),
-        processedElements = new Set<AstElement>(),
-        queue = new Queue<ResolutionWorkItem>(),
-        deferredQueue = new Queue<_DeferredAction>(),
         _universe = new ResolutionWorldBuilderImpl(
-            backend, commonElements, cacheStrategy, const TypeMaskStrategy()) {
-    impactVisitor = new EnqueuerImplImpactVisitor(this);
+            backend, resolution, cacheStrategy, const OpenWorldStrategy()),
+        _workItemBuilder = new ResolutionWorkItemBuilder(resolution) {
+    _impactVisitor = new EnqueuerImplImpactVisitor(this);
   }
 
-  ResolutionWorldBuilder get universe => _universe;
+  ResolutionWorldBuilder get worldBuilder => _universe;
 
-  OpenWorld get openWorld => universe.openWorld;
+  bool get queueIsEmpty => _queue.isEmpty;
 
-  bool get queueIsEmpty => queue.isEmpty;
+  DiagnosticReporter get _reporter => _resolution.reporter;
 
-  DiagnosticReporter get reporter => resolution.reporter;
+  Iterable<ClassEntity> get processedClasses => _universe.processedClasses;
 
-  bool isClassProcessed(ClassElement cls) => _processedClasses.contains(cls);
-
-  Iterable<ClassElement> get processedClasses => _processedClasses;
-
-  /**
-   * Documentation wanted -- johnniwinther
-   *
-   * Invariant: [element] must be a declaration element.
-   */
-  void addToWorkList(Element element) {
-    assert(invariant(element, element.isDeclaration));
-    internalAddToWorkList(element);
-  }
-
-  void applyImpact(WorldImpact worldImpact, {Element impactSource}) {
+  void applyImpact(WorldImpact worldImpact, {var impactSource}) {
     if (worldImpact.isEmpty) return;
     impactStrategy.visitImpact(
-        impactSource, worldImpact, impactVisitor, impactUse);
+        impactSource, worldImpact, _impactVisitor, impactUse);
   }
 
-  void registerInstantiatedType(InterfaceType type) {
-    _registerInstantiatedType(type, globalDependency: true);
-  }
-
-  void _registerInstantiatedType(InterfaceType type,
+  void _registerInstantiatedType(ResolutionInterfaceType type,
       {ConstructorElement constructor,
       bool mirrorUsage: false,
       bool nativeUsage: false,
       bool globalDependency: false,
       bool isRedirection: false}) {
     task.measure(() {
-      ClassElement cls = type.element;
-      cls.ensureResolved(resolution);
-      bool isNative = backend.isNative(cls);
-      _universe.registerTypeInstantiation(type,
+      _universe.registerTypeInstantiation(type, _applyClassUse,
           constructor: constructor,
-          isNative: isNative,
           byMirrors: mirrorUsage,
-          isRedirection: isRedirection, onImplemented: (ClassElement cls) {
-        applyImpact(backend.registerImplementedClass(cls, forResolution: true));
-      });
+          isRedirection: isRedirection);
       if (globalDependency && !mirrorUsage) {
-        globalDependencies.registerDependency(type.element);
+        _globalDependencies.registerDependency(type.element);
       }
       if (nativeUsage) {
         nativeEnqueuer.onInstantiatedType(type);
       }
       backend.registerInstantiatedType(type);
-      // TODO(johnniwinther): Share this reasoning with [Universe].
-      if (!cls.isAbstract || isNative || mirrorUsage) {
-        processInstantiatedClass(cls);
-      }
     });
   }
 
@@ -243,225 +206,55 @@
     return strategy.checkEnqueuerConsistency(this);
   }
 
-  void processInstantiatedClassMembers(ClassElement cls) {
-    strategy.processInstantiatedClass(this, cls);
+  void checkClass(ClassEntity cls) {
+    _universe.processClassMembers(cls,
+        (MemberEntity member, EnumSet<MemberUse> useSet) {
+      if (useSet.isNotEmpty) {
+        _reporter.internalError(member,
+            'Unenqueued use of $member: ${useSet.iterable(MemberUse.values)}');
+      }
+    });
   }
 
-  void processInstantiatedClassMember(ClassElement cls, Element member) {
-    assert(invariant(member, member.isDeclaration));
-    if (isProcessed(member)) return;
-    if (!member.isInstanceMember) return;
-    String memberName = member.name;
-
-    if (member.isField) {
-      // The obvious thing to test here would be "member.isNative",
-      // however, that only works after metadata has been parsed/analyzed,
-      // and that may not have happened yet.
-      // So instead we use the enclosing class, which we know have had
-      // its metadata parsed and analyzed.
-      // Note: this assumes that there are no non-native fields on native
-      // classes, which may not be the case when a native class is subclassed.
-      if (backend.isNative(cls)) {
-        openWorld.registerUsedElement(member);
-        if (_universe.hasInvokedGetter(member, openWorld) ||
-            _universe.hasInvocation(member, openWorld)) {
-          addToWorkList(member);
-          return;
-        }
-        if (_universe.hasInvokedSetter(member, openWorld)) {
-          addToWorkList(member);
-          return;
-        }
-        // Native fields need to go into instanceMembersByName as they
-        // are virtual instantiation points and escape points.
-      } else {
-        // All field initializers must be resolved as they could
-        // have an observable side-effect (and cannot be tree-shaken
-        // away).
-        addToWorkList(member);
-        return;
-      }
-    } else if (member.isFunction) {
-      FunctionElement function = member;
-      function.computeType(resolution);
-      if (function.name == Identifiers.noSuchMethod_) {
-        registerNoSuchMethod(function);
-      }
-      if (function.name == Identifiers.call && !cls.typeVariables.isEmpty) {
-        _registerCallMethodWithFreeTypeVariables(function);
-      }
-      // If there is a property access with the same name as a method we
-      // need to emit the method.
-      if (_universe.hasInvokedGetter(function, openWorld)) {
-        registerClosurizedMember(function);
-        addToWorkList(function);
-        return;
-      }
-      // Store the member in [instanceFunctionsByName] to catch
-      // getters on the function.
-      instanceFunctionsByName
-          .putIfAbsent(memberName, () => new Set<Element>())
-          .add(member);
-      if (_universe.hasInvocation(function, openWorld)) {
-        addToWorkList(function);
-        return;
-      }
-    } else if (member.isGetter) {
-      FunctionElement getter = member;
-      getter.computeType(resolution);
-      if (_universe.hasInvokedGetter(getter, openWorld)) {
-        addToWorkList(getter);
-        return;
-      }
-      // We don't know what selectors the returned closure accepts. If
-      // the set contains any selector we have to assume that it matches.
-      if (_universe.hasInvocation(getter, openWorld)) {
-        addToWorkList(getter);
-        return;
-      }
-    } else if (member.isSetter) {
-      FunctionElement setter = member;
-      setter.computeType(resolution);
-      if (_universe.hasInvokedSetter(setter, openWorld)) {
-        addToWorkList(setter);
-        return;
-      }
+  /// Callback for applying the use of a [member].
+  void _applyMemberUse(Entity member, EnumSet<MemberUse> useSet) {
+    if (useSet.contains(MemberUse.NORMAL)) {
+      _addToWorkList(member);
     }
-
-    // The element is not yet used. Add it to the list of instance
-    // members to still be processed.
-    instanceMembersByName
-        .putIfAbsent(memberName, () => new Set<Element>())
-        .add(member);
+    if (useSet.contains(MemberUse.CLOSURIZE_INSTANCE)) {
+      _registerClosurizedMember(member);
+    }
+    if (useSet.contains(MemberUse.CLOSURIZE_STATIC)) {
+      applyImpact(backend.registerGetOfStaticFunction());
+    }
   }
 
-  void processInstantiatedClass(ClassElement cls) {
+  /// Callback for applying the use of a [cls].
+  void _applyClassUse(ClassEntity cls, EnumSet<ClassUse> useSet) {
+    if (useSet.contains(ClassUse.INSTANTIATED)) {
+      _recentClasses.add(cls);
+      _universe.processClassMembers(cls, _applyMemberUse);
+      // We only tell the backend once that [cls] was instantiated, so
+      // any additional dependencies must be treated as global
+      // dependencies.
+      applyImpact(backend.registerInstantiatedClass(cls, forResolution: true));
+    }
+    if (useSet.contains(ClassUse.IMPLEMENTED)) {
+      applyImpact(backend.registerImplementedClass(cls, forResolution: true));
+    }
+  }
+
+  void processDynamicUse(DynamicUse dynamicUse) {
     task.measure(() {
-      if (_processedClasses.contains(cls)) return;
-      // The class must be resolved to compute the set of all
-      // supertypes.
-      cls.ensureResolved(resolution);
-
-      void processClass(ClassElement superclass) {
-        if (_processedClasses.contains(superclass)) return;
-
-        _processedClasses.add(superclass);
-        recentClasses.add(superclass);
-        superclass.ensureResolved(resolution);
-        superclass.implementation.forEachMember(processInstantiatedClassMember);
-        resolution.ensureClassMembers(superclass);
-        // We only tell the backend once that [superclass] was instantiated, so
-        // any additional dependencies must be treated as global
-        // dependencies.
-        applyImpact(
-            backend.registerInstantiatedClass(superclass, forResolution: true));
-      }
-
-      ClassElement superclass = cls;
-      while (superclass != null) {
-        processClass(superclass);
-        superclass = superclass.superclass;
-      }
+      _universe.registerDynamicUse(dynamicUse, _applyMemberUse);
     });
   }
 
-  void registerDynamicUse(DynamicUse dynamicUse) {
-    task.measure(() {
-      if (_universe.registerDynamicUse(dynamicUse)) {
-        handleUnseenSelector(dynamicUse);
-      }
-    });
-  }
-
-  void processSet(
-      Map<String, Set<Element>> map, String memberName, bool f(Element e)) {
-    Set<Element> members = map[memberName];
-    if (members == null) return;
-    // [f] might add elements to [: map[memberName] :] during the loop below
-    // so we create a new list for [: map[memberName] :] and prepend the
-    // [remaining] members after the loop.
-    map[memberName] = new Set<Element>();
-    Set<Element> remaining = new Set<Element>();
-    for (Element member in members) {
-      if (!f(member)) remaining.add(member);
-    }
-    map[memberName].addAll(remaining);
-  }
-
-  processInstanceMembers(String n, bool f(Element e)) {
-    processSet(instanceMembersByName, n, f);
-  }
-
-  processInstanceFunctions(String n, bool f(Element e)) {
-    processSet(instanceFunctionsByName, n, f);
-  }
-
-  void handleUnseenSelector(DynamicUse universeSelector) {
-    strategy.processDynamicUse(this, universeSelector);
-  }
-
-  void handleUnseenSelectorInternal(DynamicUse dynamicUse) {
-    Selector selector = dynamicUse.selector;
-    String methodName = selector.name;
-    processInstanceMembers(methodName, (Element member) {
-      if (dynamicUse.appliesUnnamed(member, openWorld)) {
-        if (member.isFunction && selector.isGetter) {
-          registerClosurizedMember(member);
-        }
-        addToWorkList(member);
-        return true;
-      }
-      return false;
-    });
-    if (selector.isGetter) {
-      processInstanceFunctions(methodName, (Element member) {
-        if (dynamicUse.appliesUnnamed(member, openWorld)) {
-          registerClosurizedMember(member);
-          return true;
-        }
-        return false;
-      });
-    }
-  }
-
-  /**
-   * Documentation wanted -- johnniwinther
-   *
-   * Invariant: [element] must be a declaration element.
-   */
-  void registerStaticUse(StaticUse staticUse) {
-    strategy.processStaticUse(this, staticUse);
-  }
-
-  void registerStaticUseInternal(StaticUse staticUse) {
-    Element element = staticUse.element;
-    assert(invariant(element, element.isDeclaration,
-        message: "Element ${element} is not the declaration."));
-    _universe.registerStaticUse(staticUse);
-    applyImpact(backend.registerStaticUse(element, forResolution: true));
-    bool addElement = true;
+  void processStaticUse(StaticUse staticUse) {
+    _universe.registerStaticUse(staticUse, _applyMemberUse);
+    // TODO(johnniwinther): Add `ResolutionWorldBuilder.registerConstructorUse`
+    // for these:
     switch (staticUse.kind) {
-      case StaticUseKind.STATIC_TEAR_OFF:
-        applyImpact(backend.registerGetOfStaticFunction());
-        break;
-      case StaticUseKind.FIELD_GET:
-      case StaticUseKind.FIELD_SET:
-      case StaticUseKind.CLOSURE:
-        // TODO(johnniwinther): Avoid this. Currently [FIELD_GET] and
-        // [FIELD_SET] contains [BoxFieldElement]s which we cannot enqueue.
-        // Also [CLOSURE] contains [LocalFunctionElement] which we cannot
-        // enqueue.
-        LocalFunctionElement closure = staticUse.element;
-        if (closure.type.containsTypeVariables) {
-          universe.closuresWithFreeTypeVariables.add(closure);
-        }
-        addElement = false;
-        break;
-      case StaticUseKind.SUPER_FIELD_SET:
-      case StaticUseKind.SUPER_TEAR_OFF:
-      case StaticUseKind.GENERAL:
-      case StaticUseKind.DIRECT_USE:
-        break;
       case StaticUseKind.CONSTRUCTOR_INVOKE:
       case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
         _registerInstantiatedType(staticUse.type,
@@ -473,22 +266,13 @@
             globalDependency: false,
             isRedirection: true);
         break;
-      case StaticUseKind.DIRECT_INVOKE:
-        invariant(
-            element, 'Direct static use is not supported for resolution.');
+      default:
         break;
     }
-    if (addElement) {
-      addToWorkList(element);
-    }
   }
 
-  void registerTypeUse(TypeUse typeUse) {
-    strategy.processTypeUse(this, typeUse);
-  }
-
-  void registerTypeUseInternal(TypeUse typeUse) {
-    DartType type = typeUse.type;
+  void processTypeUse(TypeUse typeUse) {
+    ResolutionDartType type = typeUse.type;
     switch (typeUse.kind) {
       case TypeUseKind.INSTANTIATION:
         _registerInstantiatedType(type, globalDependency: false);
@@ -507,32 +291,29 @@
         _registerIsCheck(type);
         break;
       case TypeUseKind.CHECKED_MODE_CHECK:
-        if (options.enableTypeAssertions) {
+        if (_options.enableTypeAssertions) {
           _registerIsCheck(type);
         }
         break;
       case TypeUseKind.TYPE_LITERAL:
+        if (type.isTypedef) {
+          worldBuilder.registerTypedef(type.element);
+        }
         break;
     }
   }
 
-  void _registerIsCheck(DartType type) {
-    type = _universe.registerIsCheck(type, resolution);
+  void _registerIsCheck(ResolutionDartType type) {
+    type = _universe.registerIsCheck(type);
     // Even in checked mode, type annotations for return type and argument
     // types do not imply type checks, so there should never be a check
     // against the type variable of a typedef.
     assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef);
   }
 
-  void _registerCallMethodWithFreeTypeVariables(Element element) {
-    applyImpact(backend.registerCallMethodWithFreeTypeVariables(element,
-        forResolution: true));
-    _universe.callMethodsWithFreeTypeVariables.add(element);
-  }
-
-  void registerClosurizedMember(TypedElement element) {
+  void _registerClosurizedMember(MemberElement element) {
     assert(element.isInstanceMember);
-    if (element.computeType(resolution).containsTypeVariables) {
+    if (element.type.containsTypeVariables) {
       applyImpact(backend.registerClosureWithFreeTypeVariables(element,
           forResolution: true));
       _universe.closuresWithFreeTypeVariables.add(element);
@@ -543,146 +324,88 @@
 
   void forEach(void f(WorkItem work)) {
     do {
-      while (queue.isNotEmpty) {
+      while (_queue.isNotEmpty) {
         // TODO(johnniwinther): Find an optimal process order.
-        WorkItem work = queue.removeLast();
-        if (!isProcessed(work.element)) {
+        WorkItem work = _queue.removeLast();
+        if (!_processedEntities.contains(work.element)) {
           strategy.processWorkItem(f, work);
-          registerProcessedElement(work.element);
+          _processedEntities.add(work.element);
         }
       }
-      List recents = recentClasses.toList(growable: false);
-      recentClasses.clear();
-      if (!onQueueEmpty(recents)) recentClasses.addAll(recents);
-    } while (queue.isNotEmpty || recentClasses.isNotEmpty);
+      List recents = _recentClasses.toList(growable: false);
+      _recentClasses.clear();
+      if (!_onQueueEmpty(recents)) {
+        _recentClasses.addAll(recents);
+      }
+    } while (_queue.isNotEmpty || _recentClasses.isNotEmpty);
   }
 
   void logSummary(log(message)) {
-    log('Resolved ${processedElements.length} elements.');
+    log('Resolved ${_processedEntities.length} elements.');
     nativeEnqueuer.logSummary(log);
   }
 
   String toString() => 'Enqueuer($name)';
 
-  /// All declaration elements that have been processed by the resolver.
-  final Set<AstElement> processedElements;
-
-  Iterable<Entity> get processedEntities => processedElements;
-
-  final Queue<ResolutionWorkItem> queue;
-
-  /// Queue of deferred resolution actions to execute when the resolution queue
-  /// has been emptied.
-  final Queue<_DeferredAction> deferredQueue;
-
-  static const ImpactUseCase IMPACT_USE =
-      const ImpactUseCase('ResolutionEnqueuer');
+  Iterable<Entity> get processedEntities => _processedEntities;
 
   ImpactUseCase get impactUse => IMPACT_USE;
 
   bool get isResolutionQueue => true;
 
-  bool isProcessed(Element member) => processedElements.contains(member);
-
   /// Returns `true` if [element] has been processed by the resolution enqueuer.
-  bool hasBeenProcessed(Element element) {
-    return processedElements.contains(element.analyzableElement.declaration);
+  // TODO(johnniwinther): Move this to the [OpenWorld]/[ResolutionWorldBuilder].
+  bool hasBeenProcessed(MemberElement element) {
+    assert(invariant(element, element == element.analyzableElement.declaration,
+        message: "Unexpected element $element"));
+    return _processedEntities.contains(element);
   }
 
-  /// Registers [element] as processed by the resolution enqueuer.
-  void registerProcessedElement(AstElement element) {
-    processedElements.add(element);
-    backend.onElementResolved(element);
+  /// Registers [entity] as processed by the resolution enqueuer. Used only for
+  /// testing.
+  void registerProcessedElementInternal(Entity entity) {
+    _processedEntities.add(entity);
   }
 
-  /**
-   * Adds [element] to the work list if it has not already been processed.
-   *
-   * Returns [true] if the element was actually added to the queue.
-   */
-  bool internalAddToWorkList(Element element) {
-    if (element.isMalformed) return false;
+  /// Create a [WorkItem] for [entity] and add it to the work list if it has not
+  /// already been processed.
+  void _addToWorkList(MemberEntity entity) {
+    if (hasBeenProcessed(entity)) return;
+    WorkItem workItem = _workItemBuilder.createWorkItem(entity);
+    if (workItem == null) return;
 
-    assert(invariant(element, element is AnalyzableElement,
-        message: 'Element $element is not analyzable.'));
-    if (hasBeenProcessed(element)) return false;
     if (queueIsClosed) {
       throw new SpannableAssertionFailure(
-          element, "Resolution work list is closed. Trying to add $element.");
+          entity, "Resolution work list is closed. Trying to add $entity.");
     }
 
-    openWorld.registerUsedElement(element);
-
-    ResolutionWorkItem workItem = resolution.createWorkItem(element);
-    queue.add(workItem);
-
-    // Enable isolate support if we start using something from the isolate
-    // library, or timers for the async library.  We exclude constant fields,
-    // which are ending here because their initializing expression is compiled.
-    LibraryElement library = element.library;
-    if (!universe.hasIsolateSupport && (!element.isField || !element.isConst)) {
-      String uri = library.canonicalUri.toString();
-      if (uri == 'dart:isolate') {
-        enableIsolateSupport();
-      } else if (uri == 'dart:async') {
-        if (element.name == '_createTimer' ||
-            element.name == '_createPeriodicTimer') {
-          // The [:Timer:] class uses the event queue of the isolate
-          // library, so we make sure that event queue is generated.
-          enableIsolateSupport();
-        }
-      }
-    }
-
-    if (element.isGetter && element.name == Identifiers.runtimeType_) {
-      // Enable runtime type support if we discover a getter called runtimeType.
-      // We have to enable runtime type before hitting the codegen, so
-      // that constructors know whether they need to generate code for
-      // runtime type.
-      _universe.hasRuntimeTypeSupport = true;
-      // TODO(ahe): Record precise dependency here.
-      applyImpact(backend.registerRuntimeType());
-    } else if (commonElements.isFunctionApplyMethod(element)) {
-      _universe.hasFunctionApplySupport = true;
-    }
-
-    return true;
+    applyImpact(backend.registerUsedElement(entity, forResolution: true));
+    _universe.registerUsedElement(entity);
+    _queue.add(workItem);
   }
 
-  void registerNoSuchMethod(Element element) {
-    backend.registerNoSuchMethod(element);
-  }
-
-  void enableIsolateSupport() {
-    _universe.hasIsolateSupport = true;
-    applyImpact(backend.enableIsolateSupport(forResolution: true));
-  }
-
-  /**
-   * Adds an action to the deferred task queue.
-   *
-   * The action is performed the next time the resolution queue has been
-   * emptied.
-   *
-   * The queue is processed in FIFO order.
-   */
-  void addDeferredAction(Element element, void action()) {
+  /// Adds an action to the deferred task queue.
+  /// The action is performed the next time the resolution queue has been
+  /// emptied.
+  ///
+  /// The queue is processed in FIFO order.
+  void addDeferredAction(Entity entity, void action()) {
     if (queueIsClosed) {
       throw new SpannableAssertionFailure(
-          element,
+          entity,
           "Resolution work list is closed. "
-          "Trying to add deferred action for $element");
+          "Trying to add deferred action for $entity");
     }
-    deferredQueue.add(new _DeferredAction(element, action));
+    _deferredQueue.add(new _DeferredAction(entity, action));
   }
 
-  /// [onQueueEmpty] is called whenever the queue is drained. [recentClasses]
+  /// [_onQueueEmpty] is called whenever the queue is drained. [recentClasses]
   /// contains the set of all classes seen for the first time since
-  /// [onQueueEmpty] was called last. A return value of [true] indicates that
+  /// [_onQueueEmpty] was called last. A return value of [true] indicates that
   /// the [recentClasses] have been processed and may be cleared. If [false] is
-  /// returned, [onQueueEmpty] will be called once the queue is empty again (or
+  /// returned, [_onQueueEmpty] will be called once the queue is empty again (or
   /// still empty) and [recentClasses] will be a superset of the current value.
-  bool onQueueEmpty(Iterable<ClassElement> recentClasses) {
+  bool _onQueueEmpty(Iterable<ClassEntity> recentClasses) {
     _emptyDeferredQueue();
 
     return backend.onQueueEmpty(this, recentClasses);
@@ -691,34 +414,22 @@
   void emptyDeferredQueueForTesting() => _emptyDeferredQueue();
 
   void _emptyDeferredQueue() {
-    while (!deferredQueue.isEmpty) {
-      _DeferredAction task = deferredQueue.removeFirst();
-      reporter.withCurrentElement(task.element, task.action);
+    while (!_deferredQueue.isEmpty) {
+      _DeferredAction task = _deferredQueue.removeFirst();
+      _reporter.withCurrentElement(task.element, task.action);
     }
   }
 
-  void forgetElement(Element element, Compiler compiler) {
-    _universe.forgetElement(element, compiler);
-    _processedClasses.remove(element);
-    instanceMembersByName[element.name]?.remove(element);
-    instanceFunctionsByName[element.name]?.remove(element);
-    processedElements.remove(element);
+  void forgetEntity(Entity entity, Compiler compiler) {
+    _universe.forgetEntity(entity, compiler);
+    _processedEntities.remove(entity);
   }
 }
 
-void removeFromSet(Map<String, Set<Element>> map, Element element) {
-  Set<Element> set = map[element.name];
-  if (set == null) return;
-  set.remove(element);
-}
-
 /// Strategy used by the enqueuer to populate the world.
 class EnqueuerStrategy {
   const EnqueuerStrategy();
 
-  /// Process a class instantiated in live code.
-  void processInstantiatedClass(EnqueuerImpl enqueuer, ClassElement cls) {}
-
   /// Process a static use of and element in live code.
   void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {}
 
@@ -729,20 +440,7 @@
   void processDynamicUse(EnqueuerImpl enqueuer, DynamicUse dynamicUse) {}
 
   /// Check enqueuer consistency after the queue has been closed.
-  bool checkEnqueuerConsistency(EnqueuerImpl enqueuer) {
-    enqueuer.task.measure(() {
-      // Run through the classes and see if we need to enqueue more methods.
-      for (ClassElement classElement
-          in enqueuer.universe.directlyInstantiatedClasses) {
-        for (ClassElement currentClass = classElement;
-            currentClass != null;
-            currentClass = currentClass.superclass) {
-          enqueuer.processInstantiatedClassMembers(currentClass);
-        }
-      }
-    });
-    return true;
-  }
+  bool checkEnqueuerConsistency(EnqueuerImpl enqueuer) => true;
 
   /// Process [work] using [f].
   void processWorkItem(void f(WorkItem work), WorkItem work) {
@@ -755,7 +453,7 @@
   const DirectEnqueuerStrategy();
   void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {
     if (staticUse.kind == StaticUseKind.DIRECT_USE) {
-      enqueuer.registerStaticUseInternal(staticUse);
+      enqueuer.processStaticUse(staticUse);
     }
   }
 }
@@ -765,23 +463,34 @@
   const TreeShakingEnqueuerStrategy();
 
   @override
-  void processInstantiatedClass(EnqueuerImpl enqueuer, ClassElement cls) {
-    cls.implementation.forEachMember(enqueuer.processInstantiatedClassMember);
-  }
-
-  @override
   void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {
-    enqueuer.registerStaticUseInternal(staticUse);
+    enqueuer.processStaticUse(staticUse);
   }
 
   @override
   void processTypeUse(EnqueuerImpl enqueuer, TypeUse typeUse) {
-    enqueuer.registerTypeUseInternal(typeUse);
+    enqueuer.processTypeUse(typeUse);
   }
 
   @override
   void processDynamicUse(EnqueuerImpl enqueuer, DynamicUse dynamicUse) {
-    enqueuer.handleUnseenSelectorInternal(dynamicUse);
+    enqueuer.processDynamicUse(dynamicUse);
+  }
+
+  /// Check enqueuer consistency after the queue has been closed.
+  bool checkEnqueuerConsistency(EnqueuerImpl enqueuer) {
+    enqueuer.task.measure(() {
+      // Run through the classes and see if we need to enqueue more methods.
+      for (ClassElement classElement
+          in enqueuer.worldBuilder.directlyInstantiatedClasses) {
+        for (ClassElement currentClass = classElement;
+            currentClass != null;
+            currentClass = currentClass.superclass) {
+          enqueuer.checkClass(currentClass);
+        }
+      }
+    });
+    return true;
   }
 }
 
@@ -792,17 +501,17 @@
 
   @override
   void visitDynamicUse(DynamicUse dynamicUse) {
-    enqueuer.registerDynamicUse(dynamicUse);
+    enqueuer.strategy.processDynamicUse(enqueuer, dynamicUse);
   }
 
   @override
   void visitStaticUse(StaticUse staticUse) {
-    enqueuer.registerStaticUse(staticUse);
+    enqueuer.strategy.processStaticUse(enqueuer, staticUse);
   }
 
   @override
   void visitTypeUse(TypeUse typeUse) {
-    enqueuer.registerTypeUse(typeUse);
+    enqueuer.strategy.processTypeUse(enqueuer, typeUse);
   }
 }
 
@@ -814,3 +523,26 @@
 
   _DeferredAction(this.element, this.action);
 }
+
+/// Interface for creating work items for enqueued member entities.
+abstract class WorkItemBuilder {
+  WorkItem createWorkItem(MemberEntity entity);
+}
+
+/// Builder that creates work item necessary for the resolution of a
+/// [MemberElement].
+class ResolutionWorkItemBuilder extends WorkItemBuilder {
+  final Resolution _resolution;
+
+  ResolutionWorkItemBuilder(this._resolution);
+
+  @override
+  WorkItem createWorkItem(MemberElement element) {
+    assert(invariant(element, element.isDeclaration));
+    if (element.isMalformed) return null;
+
+    assert(invariant(element, element is AnalyzableElement,
+        message: 'Element $element is not analyzable.'));
+    return _resolution.createWorkItem(element);
+  }
+}
diff --git a/pkg/compiler/lib/src/helpers/debug_collection.dart b/pkg/compiler/lib/src/helpers/debug_collection.dart
index b20bf0c..3ff3f49 100644
--- a/pkg/compiler/lib/src/helpers/debug_collection.dart
+++ b/pkg/compiler/lib/src/helpers/debug_collection.dart
@@ -71,11 +71,11 @@
 
   Iterator<E> get iterator => iterable.iterator;
 
-  Iterable map(f(E element)) => iterable.map(f);
+  Iterable<T> map<T>(T f(E element)) => iterable.map(f);
 
   Iterable<E> where(bool test(E element)) => iterable.where(test);
 
-  Iterable expand(Iterable f(E element)) => iterable.expand(f);
+  Iterable<T> expand<T>(Iterable<T> f(E element)) => iterable.expand(f);
 
   bool contains(Object element) => iterable.contains(element);
 
@@ -83,8 +83,7 @@
 
   E reduce(E combine(E value, E element)) => iterable.reduce(combine);
 
-  dynamic fold(
-      var initialValue, dynamic combine(var previousValue, E element)) {
+  T fold<T>(T initialValue, T combine(T previousValue, E element)) {
     return iterable.fold(initialValue, combine);
   }
 
diff --git a/pkg/compiler/lib/src/inferrer/builder.dart b/pkg/compiler/lib/src/inferrer/builder.dart
new file mode 100644
index 0000000..526357dd
--- /dev/null
+++ b/pkg/compiler/lib/src/inferrer/builder.dart
@@ -0,0 +1,2941 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library simple_types_inferrer;
+
+import '../closure.dart' show ClosureClassMap;
+import '../common.dart';
+import '../common/names.dart' show Identifiers, Selectors;
+import '../compiler.dart' show Compiler;
+import '../constants/constant_system.dart';
+import '../constants/expressions.dart';
+import '../constants/values.dart' show ConstantValue, IntConstantValue;
+import '../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionInterfaceType;
+import '../elements/elements.dart';
+import '../js_backend/backend_helpers.dart';
+import '../js_backend/js_backend.dart' as js;
+import '../native/native.dart' as native;
+import '../resolution/operators.dart' as op;
+import '../resolution/semantic_visitor.dart';
+import '../resolution/tree_elements.dart' show TreeElements;
+import '../tree/tree.dart' as ast;
+import '../types/constants.dart' show computeTypeMask;
+import '../types/types.dart' show TypeMask, GlobalTypeInferenceElementData;
+import '../universe/call_structure.dart' show CallStructure;
+import '../universe/selector.dart' show Selector;
+import '../universe/side_effects.dart' show SideEffects;
+import '../util/util.dart' show Link, Setlet;
+import '../world.dart' show ClosedWorld;
+import 'inferrer_engine.dart';
+import 'locals_handler.dart';
+import 'type_graph_nodes.dart';
+import 'type_system.dart';
+
+/// [ElementGraphBuilder] can be thought of as a type-inference graph
+/// builder for a single element.
+///
+/// Calling [run] will start the work of visiting the body of the code to
+/// construct a set of infernece-nodes that abstractly represent what the code
+/// is doing.
+///
+/// This visitor is parameterized by an [InferenceEngine], which internally
+/// decides how to represent inference nodes.
+class ElementGraphBuilder extends ast.Visitor<TypeInformation>
+    with
+        SemanticSendResolvedMixin<TypeInformation, dynamic>,
+        CompoundBulkMixin<TypeInformation, dynamic>,
+        SetIfNullBulkMixin<TypeInformation, dynamic>,
+        PrefixBulkMixin<TypeInformation, dynamic>,
+        PostfixBulkMixin<TypeInformation, dynamic>,
+        ErrorBulkMixin<TypeInformation, dynamic>,
+        NewBulkMixin<TypeInformation, dynamic>,
+        SetBulkMixin<TypeInformation, dynamic>
+    implements SemanticSendVisitor<TypeInformation, dynamic> {
+  final Compiler compiler;
+  final AstElement analyzedElement;
+  final ResolvedAst resolvedAst;
+  final TypeSystem types;
+  final Map<JumpTarget, List<LocalsHandler>> breaksFor =
+      new Map<JumpTarget, List<LocalsHandler>>();
+  final Map<JumpTarget, List<LocalsHandler>> continuesFor =
+      new Map<JumpTarget, List<LocalsHandler>>();
+  LocalsHandler locals;
+  final List<TypeInformation> cascadeReceiverStack =
+      new List<TypeInformation>();
+
+  TypeInformation returnType;
+  bool visitingInitializers = false;
+  bool isConstructorRedirect = false;
+  bool seenSuperConstructorCall = false;
+  SideEffects sideEffects = new SideEffects.empty();
+  final Element outermostElement;
+  final InferrerEngine inferrer;
+  final Setlet<Entity> capturedVariables = new Setlet<Entity>();
+  final GlobalTypeInferenceElementData inTreeData;
+
+  ElementGraphBuilder.internal(
+      AstElement analyzedElement,
+      this.resolvedAst,
+      this.outermostElement,
+      InferrerEngine inferrer,
+      this.compiler,
+      this.locals)
+      : this.analyzedElement = analyzedElement,
+        this.inferrer = inferrer,
+        this.types = inferrer.types,
+        this.inTreeData = inferrer.dataOf(analyzedElement) {
+    assert(outermostElement != null);
+    if (locals != null) return;
+    ast.Node node;
+    if (resolvedAst.kind == ResolvedAstKind.PARSED) {
+      node = resolvedAst.node;
+    }
+    FieldInitializationScope fieldScope =
+        analyzedElement.isGenerativeConstructor
+            ? new FieldInitializationScope(types)
+            : null;
+    locals =
+        new LocalsHandler(inferrer, types, compiler.options, node, fieldScope);
+  }
+
+  ElementGraphBuilder(Element element, ResolvedAst resolvedAst,
+      Compiler compiler, InferrerEngine inferrer, [LocalsHandler handler])
+      : this.internal(
+            element,
+            resolvedAst,
+            element.outermostEnclosingMemberOrTopLevel.implementation,
+            inferrer,
+            compiler,
+            handler);
+
+  TreeElements get elements => resolvedAst.elements;
+
+  bool accumulateIsChecks = false;
+  bool conditionIsSimple = false;
+  List<ast.Send> isChecks;
+  int loopLevel = 0;
+
+  bool get inLoop => loopLevel > 0;
+  bool get isThisExposed {
+    return analyzedElement.isGenerativeConstructor
+        ? locals.fieldScope.isThisExposed
+        : true;
+  }
+
+  void set isThisExposed(value) {
+    if (analyzedElement.isGenerativeConstructor) {
+      locals.fieldScope.isThisExposed = value;
+    }
+  }
+
+  DiagnosticReporter get reporter => compiler.reporter;
+
+  ClosedWorld get closedWorld => inferrer.closedWorld;
+
+  @override
+  SemanticSendVisitor get sendVisitor => this;
+
+  @override
+  TypeInformation apply(ast.Node node, _) => visit(node);
+
+  TypeInformation visitAssert(ast.Assert node) {
+    // Avoid pollution from assert statement unless enabled.
+    if (!compiler.options.enableUserAssertions) {
+      return null;
+    }
+    List<ast.Send> tests = <ast.Send>[];
+    bool simpleCondition = handleCondition(node.condition, tests);
+    LocalsHandler saved = locals;
+    locals = new LocalsHandler.from(locals, node);
+    updateIsChecks(tests, usePositive: true);
+
+    LocalsHandler thenLocals = locals;
+    locals = new LocalsHandler.from(saved, node);
+    if (simpleCondition) updateIsChecks(tests, usePositive: false);
+    visit(node.message);
+    locals.seenReturnOrThrow = true;
+    saved.mergeDiamondFlow(thenLocals, locals);
+    locals = saved;
+    return null;
+  }
+
+  @override
+  TypeInformation bulkHandleSet(ast.SendSet node, _) {
+    return handleSendSet(node);
+  }
+
+  @override
+  TypeInformation bulkHandleCompound(ast.SendSet node, _) {
+    return handleSendSet(node);
+  }
+
+  @override
+  TypeInformation bulkHandleSetIfNull(ast.SendSet node, _) {
+    return handleSendSet(node);
+  }
+
+  @override
+  TypeInformation bulkHandlePrefix(ast.SendSet node, _) {
+    return handleSendSet(node);
+  }
+
+  @override
+  TypeInformation bulkHandlePostfix(ast.SendSet node, _) {
+    return handleSendSet(node);
+  }
+
+  @override
+  TypeInformation bulkHandleError(ast.Node node, ErroneousElement error, _) {
+    return types.dynamicType;
+  }
+
+  TypeInformation visitNode(ast.Node node) {
+    return node.visitChildren(this);
+  }
+
+  TypeInformation visit(ast.Node node) {
+    return node == null ? null : node.accept(this);
+  }
+
+  TypeInformation visitLiteralString(ast.LiteralString node) {
+    return types.stringLiteralType(node.dartString);
+  }
+
+  TypeInformation visitStringJuxtaposition(ast.StringJuxtaposition node) {
+    node.visitChildren(this);
+    return types.stringType;
+  }
+
+  TypeInformation visitLiteralBool(ast.LiteralBool node) {
+    return types.boolLiteralType(node);
+  }
+
+  TypeInformation visitLiteralDouble(ast.LiteralDouble node) {
+    ConstantSystem constantSystem = compiler.backend.constantSystem;
+    // The JavaScript backend may turn this literal into an integer at
+    // runtime.
+    return types.getConcreteTypeFor(
+        computeTypeMask(closedWorld, constantSystem.createDouble(node.value)));
+  }
+
+  TypeInformation visitLiteralInt(ast.LiteralInt node) {
+    ConstantSystem constantSystem = compiler.backend.constantSystem;
+    // The JavaScript backend may turn this literal into a double at
+    // runtime.
+    return types.getConcreteTypeFor(
+        computeTypeMask(closedWorld, constantSystem.createInt(node.value)));
+  }
+
+  TypeInformation visitLiteralNull(ast.LiteralNull node) {
+    return types.nullType;
+  }
+
+  TypeInformation visitLiteralSymbol(ast.LiteralSymbol node) {
+    // TODO(kasperl): We should be able to tell that the type of a literal
+    // symbol is always a non-null exact symbol implementation -- not just
+    // any non-null subtype of the symbol interface.
+    return types.nonNullSubtype(closedWorld.commonElements.symbolClass);
+  }
+
+  @override
+  void previsitDeferredAccess(ast.Send node, PrefixElement prefix, _) {
+    // Deferred access does not affect inference.
+  }
+
+  TypeInformation handleTypeLiteralGet() {
+    return types.typeType;
+  }
+
+  @override
+  TypeInformation bulkHandleNode(ast.Node node, String message, _) {
+    return internalError(node, message.replaceAll('#', '$node'));
+  }
+
+  @override
+  TypeInformation visitConstantGet(
+      ast.Send node, ConstantExpression constant, _) {
+    return bulkHandleNode(node, "Constant read `#` unhandled.", _);
+  }
+
+  @override
+  TypeInformation visitConstantInvoke(
+      ast.Send node,
+      ConstantExpression constant,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return bulkHandleNode(node, "Constant invoke `#` unhandled.", _);
+  }
+
+  TypeInformation visitClassTypeLiteralGet(
+      ast.Send node, ConstantExpression constant, _) {
+    return handleTypeLiteralGet();
+  }
+
+  TypeInformation visitClassTypeLiteralInvoke(
+      ast.Send node,
+      ConstantExpression constant,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleTypeLiteralInvoke(arguments);
+  }
+
+  TypeInformation visitTypedefTypeLiteralGet(
+      ast.Send node, ConstantExpression constant, _) {
+    return handleTypeLiteralGet();
+  }
+
+  TypeInformation visitTypedefTypeLiteralInvoke(
+      ast.Send node,
+      ConstantExpression constant,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleTypeLiteralInvoke(arguments);
+  }
+
+  TypeInformation visitTypeVariableTypeLiteralGet(
+      ast.Send node, TypeVariableElement element, _) {
+    return handleTypeLiteralGet();
+  }
+
+  TypeInformation visitTypeVariableTypeLiteralInvoke(
+      ast.Send node,
+      TypeVariableElement element,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleTypeLiteralInvoke(arguments);
+  }
+
+  TypeInformation visitDynamicTypeLiteralGet(
+      ast.Send node, ConstantExpression constant, _) {
+    return handleTypeLiteralGet();
+  }
+
+  TypeInformation visitDynamicTypeLiteralInvoke(
+      ast.Send node,
+      ConstantExpression constant,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleTypeLiteralInvoke(arguments);
+  }
+
+  TypeInformation _thisType;
+  TypeInformation get thisType {
+    if (_thisType != null) return _thisType;
+    ClassElement cls = outermostElement.enclosingClass;
+    if (closedWorld.isUsedAsMixin(cls)) {
+      return _thisType = types.nonNullSubtype(cls);
+    } else {
+      return _thisType = types.nonNullSubclass(cls);
+    }
+  }
+
+  @override
+  TypeInformation visitThisGet(ast.Identifier node, _) {
+    return thisType;
+  }
+
+  TypeInformation visitIdentifier(ast.Identifier node) {
+    if (node.isThis()) {
+      return thisType;
+    } else if (node.isSuper()) {
+      return internalError(node, 'Unexpected expression $node.');
+    } else {
+      Element element = elements[node];
+      if (Elements.isLocal(element)) {
+        LocalElement local = element;
+        return locals.use(local);
+      }
+      return null;
+    }
+  }
+
+  void potentiallyAddIsCheck(ast.Send node) {
+    if (!accumulateIsChecks) return;
+    if (!Elements.isLocal(elements[node.receiver])) return;
+    isChecks.add(node);
+  }
+
+  void potentiallyAddNullCheck(ast.Send node, ast.Node receiver) {
+    if (!accumulateIsChecks) return;
+    if (!Elements.isLocal(elements[receiver])) return;
+    isChecks.add(node);
+  }
+
+  void updateIsChecks(List<ast.Node> tests, {bool usePositive}) {
+    void narrow(Element element, ResolutionDartType type, ast.Node node) {
+      if (element is LocalElement) {
+        TypeInformation existing = locals.use(element);
+        TypeInformation newType =
+            types.narrowType(existing, type, isNullable: false);
+        locals.update(element, newType, node);
+      }
+    }
+
+    if (tests == null) return;
+    for (ast.Send node in tests) {
+      if (node.isTypeTest) {
+        if (node.isIsNotCheck) {
+          if (usePositive) continue;
+        } else {
+          if (!usePositive) continue;
+        }
+        ResolutionDartType type =
+            elements.getType(node.typeAnnotationFromIsCheckOrCast);
+        narrow(elements[node.receiver], type, node);
+      } else {
+        Element receiverElement = elements[node.receiver];
+        Element argumentElement = elements[node.arguments.first];
+        String operator = node.selector.asOperator().source;
+        if ((operator == '==' && usePositive) ||
+            (operator == '!=' && !usePositive)) {
+          // Type the elements as null.
+          if (Elements.isLocal(receiverElement)) {
+            locals.update(receiverElement, types.nullType, node);
+          }
+          if (Elements.isLocal(argumentElement)) {
+            locals.update(argumentElement, types.nullType, node);
+          }
+        } else {
+          // Narrow the elements to a non-null type.
+          ResolutionInterfaceType objectType =
+              closedWorld.commonElements.objectType;
+          if (Elements.isLocal(receiverElement)) {
+            narrow(receiverElement, objectType, node);
+          }
+          if (Elements.isLocal(argumentElement)) {
+            narrow(argumentElement, objectType, node);
+          }
+        }
+      }
+    }
+  }
+
+  @override
+  TypeInformation visitIndex(
+      ast.Send node, ast.Node receiver, ast.Node index, _) {
+    return handleDynamicInvoke(node);
+  }
+
+  @override
+  TypeInformation visitDynamicPropertyInvoke(ast.Send node, ast.Node receiver,
+      ast.NodeList arguments, Selector selector, _) {
+    return handleDynamicInvoke(node);
+  }
+
+  @override
+  TypeInformation visitIfNotNullDynamicPropertyInvoke(ast.Send node,
+      ast.Node receiver, ast.NodeList arguments, Selector selector, _) {
+    return handleDynamicInvoke(node);
+  }
+
+  @override
+  TypeInformation visitThisPropertyInvoke(
+      ast.Send node, ast.NodeList arguments, Selector selector, _) {
+    return handleDynamicInvoke(node);
+  }
+
+  @override
+  TypeInformation visitIfNull(ast.Send node, ast.Node left, ast.Node right, _) {
+    TypeInformation firstType = visit(left);
+    TypeInformation secondType = visit(right);
+    return types.allocateDiamondPhi(types.narrowNotNull(firstType), secondType);
+  }
+
+  @override
+  TypeInformation visitLogicalAnd(
+      ast.Send node, ast.Node left, ast.Node right, _) {
+    conditionIsSimple = false;
+    bool oldAccumulateIsChecks = accumulateIsChecks;
+    List<ast.Send> oldIsChecks = isChecks;
+    if (!accumulateIsChecks) {
+      accumulateIsChecks = true;
+      isChecks = <ast.Send>[];
+    }
+    visit(left);
+    LocalsHandler saved = locals;
+    locals = new LocalsHandler.from(locals, node);
+    updateIsChecks(isChecks, usePositive: true);
+    LocalsHandler narrowed;
+    if (oldAccumulateIsChecks) {
+      narrowed = new LocalsHandler.topLevelCopyOf(locals);
+    } else {
+      accumulateIsChecks = false;
+      isChecks = oldIsChecks;
+    }
+    visit(right);
+    if (oldAccumulateIsChecks) {
+      bool invalidatedInRightHandSide(ast.Send test) {
+        Element receiver = elements[test.receiver];
+        if (receiver is LocalElement) {
+          return narrowed.locals[receiver] != locals.locals[receiver];
+        }
+        return false;
+      }
+
+      isChecks.removeWhere(invalidatedInRightHandSide);
+    }
+    saved.mergeDiamondFlow(locals, null);
+    locals = saved;
+    return types.boolType;
+  }
+
+  @override
+  TypeInformation visitLogicalOr(
+      ast.Send node, ast.Node left, ast.Node right, _) {
+    conditionIsSimple = false;
+    List<ast.Send> tests = <ast.Send>[];
+    bool isSimple = handleCondition(left, tests);
+    LocalsHandler saved = locals;
+    locals = new LocalsHandler.from(locals, node);
+    if (isSimple) updateIsChecks(tests, usePositive: false);
+    bool oldAccumulateIsChecks = accumulateIsChecks;
+    accumulateIsChecks = false;
+    visit(right);
+    accumulateIsChecks = oldAccumulateIsChecks;
+    saved.mergeDiamondFlow(locals, null);
+    locals = saved;
+    return types.boolType;
+  }
+
+  @override
+  TypeInformation visitNot(ast.Send node, ast.Node expression, _) {
+    bool oldAccumulateIsChecks = accumulateIsChecks;
+    accumulateIsChecks = false;
+    visit(expression);
+    accumulateIsChecks = oldAccumulateIsChecks;
+    return types.boolType;
+  }
+
+  @override
+  TypeInformation visitIs(
+      ast.Send node, ast.Node expression, ResolutionDartType type, _) {
+    potentiallyAddIsCheck(node);
+    visit(expression);
+    return types.boolType;
+  }
+
+  @override
+  TypeInformation visitIsNot(
+      ast.Send node, ast.Node expression, ResolutionDartType type, _) {
+    potentiallyAddIsCheck(node);
+    visit(expression);
+    return types.boolType;
+  }
+
+  @override
+  TypeInformation visitAs(
+      ast.Send node, ast.Node expression, ResolutionDartType type, _) {
+    TypeInformation receiverType = visit(expression);
+    return types.narrowType(receiverType, type);
+  }
+
+  @override
+  TypeInformation visitUnary(
+      ast.Send node, op.UnaryOperator operator, ast.Node expression, _) {
+    return handleDynamicInvoke(node);
+  }
+
+  @override
+  TypeInformation visitNotEquals(
+      ast.Send node, ast.Node left, ast.Node right, _) {
+    handleDynamicInvoke(node);
+    return types.boolType;
+  }
+
+  @override
+  TypeInformation visitEquals(ast.Send node, ast.Node left, ast.Node right, _) {
+    return handleDynamicInvoke(node);
+  }
+
+  @override
+  TypeInformation visitBinary(ast.Send node, ast.Node left,
+      op.BinaryOperator operator, ast.Node right, _) {
+    return handleDynamicInvoke(node);
+  }
+
+  // Because some nodes just visit their children, we may end up
+  // visiting a type annotation, that may contain a send in case of a
+  // prefixed type. Therefore we explicitly visit the type annotation
+  // to avoid confusing the [ResolvedVisitor].
+  visitTypeAnnotation(ast.TypeAnnotation node) {}
+
+  TypeInformation visitConditional(ast.Conditional node) {
+    List<ast.Send> tests = <ast.Send>[];
+    bool simpleCondition = handleCondition(node.condition, tests);
+    LocalsHandler saved = locals;
+    locals = new LocalsHandler.from(locals, node);
+    updateIsChecks(tests, usePositive: true);
+    TypeInformation firstType = visit(node.thenExpression);
+    LocalsHandler thenLocals = locals;
+    locals = new LocalsHandler.from(saved, node);
+    if (simpleCondition) updateIsChecks(tests, usePositive: false);
+    TypeInformation secondType = visit(node.elseExpression);
+    saved.mergeDiamondFlow(thenLocals, locals);
+    locals = saved;
+    TypeInformation type = types.allocateDiamondPhi(firstType, secondType);
+    return type;
+  }
+
+  TypeInformation visitVariableDefinitions(ast.VariableDefinitions node) {
+    for (Link<ast.Node> link = node.definitions.nodes;
+        !link.isEmpty;
+        link = link.tail) {
+      ast.Node definition = link.head;
+      if (definition is ast.Identifier) {
+        locals.update(elements[definition], types.nullType, node);
+      } else {
+        assert(definition.asSendSet() != null);
+        handleSendSet(definition);
+      }
+    }
+    return null;
+  }
+
+  bool handleCondition(ast.Node node, List<ast.Send> tests) {
+    bool oldConditionIsSimple = conditionIsSimple;
+    bool oldAccumulateIsChecks = accumulateIsChecks;
+    List<ast.Send> oldIsChecks = isChecks;
+    accumulateIsChecks = true;
+    conditionIsSimple = true;
+    isChecks = tests;
+    visit(node);
+    bool simpleCondition = conditionIsSimple;
+    accumulateIsChecks = oldAccumulateIsChecks;
+    isChecks = oldIsChecks;
+    conditionIsSimple = oldConditionIsSimple;
+    return simpleCondition;
+  }
+
+  TypeInformation visitIf(ast.If node) {
+    List<ast.Send> tests = <ast.Send>[];
+    bool simpleCondition = handleCondition(node.condition, tests);
+    LocalsHandler saved = locals;
+    locals = new LocalsHandler.from(locals, node);
+    updateIsChecks(tests, usePositive: true);
+    visit(node.thenPart);
+    LocalsHandler thenLocals = locals;
+    locals = new LocalsHandler.from(saved, node);
+    if (simpleCondition) updateIsChecks(tests, usePositive: false);
+    visit(node.elsePart);
+    saved.mergeDiamondFlow(thenLocals, locals);
+    locals = saved;
+    return null;
+  }
+
+  void setupBreaksAndContinues(JumpTarget element) {
+    if (element == null) return;
+    if (element.isContinueTarget) continuesFor[element] = <LocalsHandler>[];
+    if (element.isBreakTarget) breaksFor[element] = <LocalsHandler>[];
+  }
+
+  void clearBreaksAndContinues(JumpTarget element) {
+    continuesFor.remove(element);
+    breaksFor.remove(element);
+  }
+
+  List<LocalsHandler> getBreaks(JumpTarget element) {
+    List<LocalsHandler> list = <LocalsHandler>[locals];
+    if (element == null) return list;
+    if (!element.isBreakTarget) return list;
+    return list..addAll(breaksFor[element]);
+  }
+
+  List<LocalsHandler> getLoopBackEdges(JumpTarget element) {
+    List<LocalsHandler> list = <LocalsHandler>[locals];
+    if (element == null) return list;
+    if (!element.isContinueTarget) return list;
+    return list..addAll(continuesFor[element]);
+  }
+
+  TypeInformation handleLoop(ast.Node node, void logic()) {
+    loopLevel++;
+    bool changed = false;
+    JumpTarget target = elements.getTargetDefinition(node);
+    LocalsHandler saved = locals;
+    saved.startLoop(node);
+    do {
+      // Setup (and clear in case of multiple iterations of the loop)
+      // the lists of breaks and continues seen in the loop.
+      setupBreaksAndContinues(target);
+      locals = new LocalsHandler.from(saved, node);
+      logic();
+      changed = saved.mergeAll(getLoopBackEdges(target));
+    } while (changed);
+    loopLevel--;
+    saved.endLoop(node);
+    bool keepOwnLocals = node.asDoWhile() == null;
+    saved.mergeAfterBreaks(getBreaks(target), keepOwnLocals: keepOwnLocals);
+    locals = saved;
+    clearBreaksAndContinues(target);
+    return null;
+  }
+
+  TypeInformation visitWhile(ast.While node) {
+    return handleLoop(node, () {
+      List<ast.Send> tests = <ast.Send>[];
+      handleCondition(node.condition, tests);
+      updateIsChecks(tests, usePositive: true);
+      visit(node.body);
+    });
+  }
+
+  TypeInformation visitDoWhile(ast.DoWhile node) {
+    return handleLoop(node, () {
+      visit(node.body);
+      List<ast.Send> tests = <ast.Send>[];
+      handleCondition(node.condition, tests);
+      updateIsChecks(tests, usePositive: true);
+    });
+  }
+
+  TypeInformation visitFor(ast.For node) {
+    visit(node.initializer);
+    return handleLoop(node, () {
+      List<ast.Send> tests = <ast.Send>[];
+      handleCondition(node.condition, tests);
+      updateIsChecks(tests, usePositive: true);
+      visit(node.body);
+      visit(node.update);
+    });
+  }
+
+  TypeInformation visitTryStatement(ast.TryStatement node) {
+    LocalsHandler saved = locals;
+    locals = new LocalsHandler.from(locals, node, useOtherTryBlock: false);
+    visit(node.tryBlock);
+    saved.mergeDiamondFlow(locals, null);
+    locals = saved;
+    for (ast.Node catchBlock in node.catchBlocks) {
+      saved = locals;
+      locals = new LocalsHandler.from(locals, catchBlock);
+      visit(catchBlock);
+      saved.mergeDiamondFlow(locals, null);
+      locals = saved;
+    }
+    visit(node.finallyBlock);
+    return null;
+  }
+
+  TypeInformation visitThrow(ast.Throw node) {
+    node.visitChildren(this);
+    locals.seenReturnOrThrow = true;
+    return types.nonNullEmpty();
+  }
+
+  TypeInformation visitCatchBlock(ast.CatchBlock node) {
+    ast.Node exception = node.exception;
+    if (exception != null) {
+      ResolutionDartType type = elements.getType(node.type);
+      TypeInformation mask =
+          type == null || type.treatAsDynamic || type.isTypeVariable
+              ? types.dynamicType
+              : types.nonNullSubtype(type.element);
+      locals.update(elements[exception], mask, node);
+    }
+    ast.Node trace = node.trace;
+    if (trace != null) {
+      locals.update(elements[trace], types.dynamicType, node);
+    }
+    visit(node.block);
+    return null;
+  }
+
+  TypeInformation visitParenthesizedExpression(
+      ast.ParenthesizedExpression node) {
+    return visit(node.expression);
+  }
+
+  TypeInformation visitBlock(ast.Block node) {
+    if (node.statements != null) {
+      for (ast.Node statement in node.statements) {
+        visit(statement);
+        if (locals.aborts) break;
+      }
+    }
+    return null;
+  }
+
+  TypeInformation visitLabeledStatement(ast.LabeledStatement node) {
+    ast.Statement body = node.statement;
+    if (body is ast.Loop ||
+        body is ast.SwitchStatement ||
+        Elements.isUnusedLabel(node, elements)) {
+      // Loops and switches handle their own labels.
+      visit(body);
+    } else {
+      JumpTarget targetElement = elements.getTargetDefinition(body);
+      setupBreaksAndContinues(targetElement);
+      visit(body);
+      locals.mergeAfterBreaks(getBreaks(targetElement));
+      clearBreaksAndContinues(targetElement);
+    }
+    return null;
+  }
+
+  TypeInformation visitBreakStatement(ast.BreakStatement node) {
+    JumpTarget target = elements.getTargetOf(node);
+    locals.seenBreakOrContinue = true;
+    // Do a deep-copy of the locals, because the code following the
+    // break will change them.
+    breaksFor[target].add(new LocalsHandler.deepCopyOf(locals));
+    return null;
+  }
+
+  TypeInformation visitContinueStatement(ast.ContinueStatement node) {
+    JumpTarget target = elements.getTargetOf(node);
+    locals.seenBreakOrContinue = true;
+    // Do a deep-copy of the locals, because the code following the
+    // continue will change them.
+    continuesFor[target].add(new LocalsHandler.deepCopyOf(locals));
+    return null;
+  }
+
+  internalError(Spannable node, String reason) {
+    reporter.internalError(node, reason);
+  }
+
+  TypeInformation visitSwitchStatement(ast.SwitchStatement node) {
+    visit(node.parenthesizedExpression);
+
+    setupBreaksAndContinues(elements.getTargetDefinition(node));
+    if (Elements.switchStatementHasContinue(node, elements)) {
+      void forEachLabeledCase(void action(JumpTarget target)) {
+        for (ast.SwitchCase switchCase in node.cases) {
+          for (ast.Node labelOrCase in switchCase.labelsAndCases) {
+            if (labelOrCase.asLabel() == null) continue;
+            LabelDefinition labelElement =
+                elements.getLabelDefinition(labelOrCase);
+            if (labelElement != null) {
+              action(labelElement.target);
+            }
+          }
+        }
+      }
+
+      forEachLabeledCase((JumpTarget target) {
+        setupBreaksAndContinues(target);
+      });
+
+      // If the switch statement has a continue, we conservatively
+      // visit all cases and update [locals] until we have reached a
+      // fixed point.
+      bool changed;
+      locals.startLoop(node);
+      do {
+        changed = false;
+        for (ast.Node switchCase in node.cases) {
+          LocalsHandler saved = locals;
+          locals = new LocalsHandler.from(locals, switchCase);
+          visit(switchCase);
+          changed = saved.mergeAll([locals]) || changed;
+          locals = saved;
+        }
+      } while (changed);
+      locals.endLoop(node);
+
+      forEachLabeledCase((JumpTarget target) {
+        clearBreaksAndContinues(target);
+      });
+    } else {
+      LocalsHandler saved = locals;
+      List<LocalsHandler> localsToMerge = <LocalsHandler>[];
+      bool hasDefaultCase = false;
+
+      for (ast.SwitchCase switchCase in node.cases) {
+        if (switchCase.isDefaultCase) {
+          hasDefaultCase = true;
+        }
+        locals = new LocalsHandler.from(saved, switchCase);
+        visit(switchCase);
+        localsToMerge.add(locals);
+      }
+      saved.mergeAfterBreaks(localsToMerge, keepOwnLocals: !hasDefaultCase);
+      locals = saved;
+    }
+    clearBreaksAndContinues(elements.getTargetDefinition(node));
+    return null;
+  }
+
+  TypeInformation visitCascadeReceiver(ast.CascadeReceiver node) {
+    var type = visit(node.expression);
+    cascadeReceiverStack.add(type);
+    return type;
+  }
+
+  TypeInformation visitCascade(ast.Cascade node) {
+    // Ignore the result of the cascade send and return the type of the cascade
+    // receiver.
+    visit(node.expression);
+    return cascadeReceiverStack.removeLast();
+  }
+
+  void analyzeSuperConstructorCall(
+      AstElement target, ArgumentsTypes arguments) {
+    ResolvedAst resolvedAst = target.resolvedAst;
+    inferrer.analyze(resolvedAst, arguments);
+    isThisExposed = isThisExposed || inferrer.checkIfExposesThis(target);
+  }
+
+  TypeInformation run() {
+    var node;
+    if (resolvedAst.kind == ResolvedAstKind.PARSED) {
+      node = resolvedAst.node;
+    }
+    ast.Expression initializer;
+    if (analyzedElement.isField) {
+      initializer = resolvedAst.body;
+      if (initializer == null) {
+        // Eagerly bailout, because computing the closure data only
+        // works for functions and field assignments.
+        return types.nullType;
+      }
+    }
+    // Update the locals that are boxed in [locals]. These locals will
+    // be handled specially, in that we are computing their LUB at
+    // each update, and reading them yields the type that was found in a
+    // previous analysis of [outermostElement].
+    ClosureClassMap closureData =
+        compiler.closureToClassMapper.getClosureToClassMapping(resolvedAst);
+    closureData.forEachCapturedVariable((variable, field) {
+      locals.setCaptured(variable, field);
+    });
+    closureData.forEachBoxedVariable((variable, field) {
+      locals.setCapturedAndBoxed(variable, field);
+    });
+    if (analyzedElement.isField) {
+      return visit(initializer);
+    }
+
+    FunctionElement function = analyzedElement;
+    FunctionSignature signature = function.functionSignature;
+    signature.forEachOptionalParameter((ParameterElement element) {
+      ast.Expression defaultValue = element.initializer;
+      // TODO(25566): The default value of a parameter of a redirecting factory
+      // constructor comes from the corresponding parameter of the target.
+
+      // If this is a default value from a different context (because
+      // the current function is synthetic, e.g., a constructor from
+      // a mixin application), we have to start a new inferrer visitor
+      // with the correct context.
+      // TODO(johnniwinther): Remove once function signatures are fixed.
+      ElementGraphBuilder visitor = this;
+      if (inferrer.hasAlreadyComputedTypeOfParameterDefault(element)) return;
+      if (element.functionDeclaration != analyzedElement) {
+        visitor = new ElementGraphBuilder(element.functionDeclaration,
+            element.functionDeclaration.resolvedAst, compiler, inferrer);
+      }
+      TypeInformation type =
+          (defaultValue == null) ? types.nullType : visitor.visit(defaultValue);
+      inferrer.setDefaultTypeOfParameter(element, type);
+    });
+
+    if (compiler.backend.isNative(analyzedElement)) {
+      // Native methods do not have a body, and we currently just say
+      // they return dynamic.
+      return types.dynamicType;
+    }
+
+    if (analyzedElement.isGenerativeConstructor) {
+      isThisExposed = false;
+      signature.forEachParameter((ParameterElement element) {
+        TypeInformation parameterType = inferrer.typeOfElement(element);
+        if (element.isInitializingFormal) {
+          InitializingFormalElement initializingFormal = element;
+          if (initializingFormal.fieldElement.isFinal) {
+            inferrer.recordTypeOfFinalField(node, analyzedElement,
+                initializingFormal.fieldElement, parameterType);
+          } else {
+            locals.updateField(initializingFormal.fieldElement, parameterType);
+            inferrer.recordTypeOfNonFinalField(initializingFormal.node,
+                initializingFormal.fieldElement, parameterType);
+          }
+        }
+        locals.update(element, parameterType, node);
+      });
+      ClassElement cls = analyzedElement.enclosingClass;
+      Spannable spannable = node;
+      if (analyzedElement.isSynthesized) {
+        spannable = analyzedElement;
+        ConstructorElement constructor = analyzedElement;
+        synthesizeForwardingCall(spannable, constructor.definingConstructor);
+      } else {
+        visitingInitializers = true;
+        if (node.initializers != null) {
+          for (ast.Node initializer in node.initializers) {
+            ast.SendSet fieldInitializer = initializer.asSendSet();
+            if (fieldInitializer != null) {
+              handleSendSet(fieldInitializer);
+            } else {
+              Element element = elements[initializer];
+              handleConstructorSend(initializer, element);
+            }
+          }
+        }
+        visitingInitializers = false;
+        // For a generative constructor like: `Foo();`, we synthesize
+        // a call to the default super constructor (the one that takes
+        // no argument). Resolution ensures that such a constructor
+        // exists.
+        if (!isConstructorRedirect &&
+            !seenSuperConstructorCall &&
+            !cls.isObject) {
+          FunctionElement target = cls.superclass.lookupDefaultConstructor();
+          ArgumentsTypes arguments = new ArgumentsTypes([], {});
+          analyzeSuperConstructorCall(target, arguments);
+          inferrer.registerCalledElement(node, null, null, outermostElement,
+              target.implementation, arguments, sideEffects, inLoop);
+        }
+        visit(node.body);
+        inferrer.recordExposesThis(analyzedElement, isThisExposed);
+      }
+      if (!isConstructorRedirect) {
+        // Iterate over all instance fields, and give a null type to
+        // fields that we haven'TypeInformation initialized for sure.
+        cls.forEachInstanceField((_, FieldElement field) {
+          if (field.isFinal) return;
+          TypeInformation type = locals.fieldScope.readField(field);
+          ResolvedAst resolvedAst = field.resolvedAst;
+          if (type == null && resolvedAst.body == null) {
+            inferrer.recordTypeOfNonFinalField(
+                spannable, field, types.nullType);
+          }
+        });
+      }
+      if (analyzedElement.isGenerativeConstructor && cls.isAbstract) {
+        if (closedWorld.isInstantiated(cls)) {
+          returnType = types.nonNullSubclass(cls);
+        } else {
+          // TODO(johnniwinther): Avoid analyzing [analyzedElement] in this
+          // case; it's never called.
+          returnType = types.nonNullEmpty();
+        }
+      } else {
+        returnType = types.nonNullExact(cls);
+      }
+    } else {
+      signature.forEachParameter((LocalParameterElement element) {
+        locals.update(element, inferrer.typeOfElement(element), node);
+      });
+      visit(node.body);
+      switch (function.asyncMarker) {
+        case AsyncMarker.SYNC:
+          if (returnType == null) {
+            // No return in the body.
+            returnType = locals.seenReturnOrThrow
+                ? types.nonNullEmpty() // Body always throws.
+                : types.nullType;
+          } else if (!locals.seenReturnOrThrow) {
+            // We haven'TypeInformation seen returns on all branches. So the method may
+            // also return null.
+            returnType = inferrer.addReturnTypeFor(
+                analyzedElement, returnType, types.nullType);
+          }
+          break;
+
+        case AsyncMarker.SYNC_STAR:
+          // TODO(asgerf): Maybe make a ContainerTypeMask for these? The type
+          //               contained is the method body's return type.
+          returnType = inferrer.addReturnTypeFor(
+              analyzedElement, returnType, types.syncStarIterableType);
+          break;
+
+        case AsyncMarker.ASYNC:
+          returnType = inferrer.addReturnTypeFor(
+              analyzedElement, returnType, types.asyncFutureType);
+          break;
+
+        case AsyncMarker.ASYNC_STAR:
+          returnType = inferrer.addReturnTypeFor(
+              analyzedElement, returnType, types.asyncStarStreamType);
+          break;
+      }
+    }
+
+    inferrer.closedWorldRefiner
+        .registerSideEffects(analyzedElement, sideEffects);
+    assert(breaksFor.isEmpty);
+    assert(continuesFor.isEmpty);
+    return returnType;
+  }
+
+  TypeInformation visitFunctionExpression(ast.FunctionExpression node) {
+    // We loose track of [this] in closures (see issue 20840). To be on
+    // the safe side, we mark [this] as exposed here. We could do better by
+    // analyzing the closure.
+    // TODO(herhut): Analyze whether closure exposes this.
+    isThisExposed = true;
+    LocalFunctionElement element = elements.getFunctionDefinition(node);
+    // We don'TypeInformation put the closure in the work queue of the
+    // inferrer, because it will share information with its enclosing
+    // method, like for example the types of local variables.
+    LocalsHandler closureLocals =
+        new LocalsHandler.from(locals, node, useOtherTryBlock: false);
+    ElementGraphBuilder visitor = new ElementGraphBuilder(
+        element, element.resolvedAst, compiler, inferrer, closureLocals);
+    visitor.run();
+    inferrer.recordReturnType(element, visitor.returnType);
+
+    // Record the types of captured non-boxed variables. Types of
+    // these variables may already be there, because of an analysis of
+    // a previous closure.
+    ClosureClassMap nestedClosureData = compiler.closureToClassMapper
+        .getClosureToClassMapping(element.resolvedAst);
+    nestedClosureData.forEachCapturedVariable((variable, field) {
+      if (!nestedClosureData.isVariableBoxed(variable)) {
+        if (variable == nestedClosureData.thisLocal) {
+          inferrer.recordType(field, thisType);
+        }
+        // The type is null for type parameters.
+        if (locals.locals[variable] == null) return;
+        inferrer.recordType(field, locals.locals[variable]);
+      }
+      capturedVariables.add(variable);
+    });
+
+    return inferrer.concreteTypes.putIfAbsent(node, () {
+      return types.allocateClosure(node, element);
+    });
+  }
+
+  TypeInformation visitFunctionDeclaration(ast.FunctionDeclaration node) {
+    LocalFunctionElement element =
+        elements.getFunctionDefinition(node.function);
+    TypeInformation type =
+        inferrer.concreteTypes.putIfAbsent(node.function, () {
+      return types.allocateClosure(node.function, element);
+    });
+    locals.update(element, type, node);
+    visit(node.function);
+    return type;
+  }
+
+  TypeInformation visitStringInterpolation(ast.StringInterpolation node) {
+    // Interpolation could have any effects since it could call any toString()
+    // method.
+    // TODO(sra): This could be modelled by a call to toString() but with a
+    // guaranteed String return type.  Interpolation of known types would get
+    // specialized effects.  This would not currently be effective since the JS
+    // code in the toString methods for intercepted primitive types is assumed
+    // to have all effects.  Effect annotations on JS code would be needed to
+    // get the benefit.
+    sideEffects.setAllSideEffects();
+    node.visitChildren(this);
+    return types.stringType;
+  }
+
+  TypeInformation visitLiteralList(ast.LiteralList node) {
+    // We only set the type once. We don'TypeInformation need to re-visit the children
+    // when re-analyzing the node.
+    return inferrer.concreteTypes.putIfAbsent(node, () {
+      TypeInformation elementType;
+      int length = 0;
+      for (ast.Node element in node.elements.nodes) {
+        TypeInformation type = visit(element);
+        elementType = elementType == null
+            ? types.allocatePhi(null, null, type)
+            : types.addPhiInput(null, elementType, type);
+        length++;
+      }
+      elementType = elementType == null
+          ? types.nonNullEmpty()
+          : types.simplifyPhi(null, null, elementType);
+      TypeInformation containerType =
+          node.isConst ? types.constListType : types.growableListType;
+      return types.allocateList(
+          containerType, node, outermostElement, elementType, length);
+    });
+  }
+
+  TypeInformation visitLiteralMap(ast.LiteralMap node) {
+    return inferrer.concreteTypes.putIfAbsent(node, () {
+      ast.NodeList entries = node.entries;
+      List keyTypes = [];
+      List valueTypes = [];
+
+      for (ast.LiteralMapEntry entry in entries) {
+        keyTypes.add(visit(entry.key));
+        valueTypes.add(visit(entry.value));
+      }
+
+      TypeInformation type = node.isConst ? types.constMapType : types.mapType;
+      return types.allocateMap(
+          type, node, outermostElement, keyTypes, valueTypes);
+    });
+  }
+
+  bool isThisOrSuper(ast.Node node) => node.isThis() || node.isSuper();
+
+  bool isInClassOrSubclass(Element element) {
+    ClassElement cls = outermostElement.enclosingClass;
+    ClassElement enclosing = element.enclosingClass;
+    return closedWorld.isSubclassOf(enclosing, cls);
+  }
+
+  void checkIfExposesThis(Selector selector, TypeMask mask) {
+    if (isThisExposed) return;
+    inferrer.forEachElementMatching(selector, mask, (element) {
+      if (element.isField) {
+        ResolvedAst elementResolvedAst = element.resolvedAst;
+        if (!selector.isSetter &&
+            isInClassOrSubclass(element) &&
+            !element.isFinal &&
+            locals.fieldScope.readField(element) == null &&
+            elementResolvedAst.body == null) {
+          // If the field is being used before this constructor
+          // actually had a chance to initialize it, say it can be
+          // null.
+          inferrer.recordTypeOfNonFinalField(
+              resolvedAst.node, element, types.nullType);
+        }
+        // Accessing a field does not expose [:this:].
+        return true;
+      }
+      // TODO(ngeoffray): We could do better here if we knew what we
+      // are calling does not expose this.
+      isThisExposed = true;
+      return false;
+    });
+  }
+
+  bool get inInstanceContext {
+    return (outermostElement.isInstanceMember && !outermostElement.isField) ||
+        outermostElement.isGenerativeConstructor;
+  }
+
+  bool treatAsInstanceMember(Element element) {
+    return (Elements.isUnresolved(element) && inInstanceContext) ||
+        (element != null && element.isInstanceMember);
+  }
+
+  @override
+  TypeInformation handleSendSet(ast.SendSet node) {
+    Element element = elements[node];
+    if (!Elements.isUnresolved(element) && element.impliesType) {
+      node.visitChildren(this);
+      return types.dynamicType;
+    }
+
+    Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node);
+    TypeMask getterMask = inTreeData.typeOfGetter(node);
+    TypeMask operatorMask = inTreeData.typeOfOperator(node);
+    Selector setterSelector = elements.getSelector(node);
+    TypeMask setterMask = inTreeData.typeOfSend(node);
+
+    String op = node.assignmentOperator.source;
+    bool isIncrementOrDecrement = op == '++' || op == '--';
+
+    TypeInformation receiverType;
+    bool isCallOnThis = false;
+    if (node.receiver == null) {
+      if (treatAsInstanceMember(element)) {
+        receiverType = thisType;
+        isCallOnThis = true;
+      }
+    } else {
+      if (node.receiver != null) {
+        Element receiver = elements[node.receiver];
+        if (receiver is! PrefixElement && receiver is! ClassElement) {
+          // TODO(johnniwinther): Avoid blindly recursing on the receiver.
+          receiverType = visit(node.receiver);
+        }
+      }
+      isCallOnThis = isThisOrSuper(node.receiver);
+    }
+
+    TypeInformation rhsType;
+
+    if (isIncrementOrDecrement) {
+      rhsType = types.uint31Type;
+      if (node.isIndex) visit(node.arguments.head);
+    } else if (node.isIndex) {
+      visit(node.arguments.head);
+      rhsType = visit(node.arguments.tail.head);
+    } else {
+      rhsType = visit(node.arguments.head);
+    }
+
+    if (!visitingInitializers && !isThisExposed) {
+      for (ast.Node node in node.arguments) {
+        if (isThisOrSuper(node)) {
+          isThisExposed = true;
+          break;
+        }
+      }
+      if (!isThisExposed && isCallOnThis) {
+        checkIfExposesThis(
+            setterSelector, types.newTypedSelector(receiverType, setterMask));
+        if (getterSelector != null) {
+          checkIfExposesThis(
+              getterSelector, types.newTypedSelector(receiverType, getterMask));
+        }
+      }
+    }
+
+    if (node.isIndex) {
+      return internalError(node, "Unexpected index operation");
+    } else if (op == '=') {
+      return handlePlainAssignment(node, element, setterSelector, setterMask,
+          receiverType, rhsType, node.arguments.head);
+    } else {
+      // [foo ??= bar], [: foo++ :] or [: foo += 1 :].
+      TypeInformation getterType;
+      TypeInformation newType;
+
+      if (Elements.isMalformed(element)) return types.dynamicType;
+
+      if (Elements.isStaticOrTopLevelField(element)) {
+        Element getterElement = elements[node.selector];
+        getterType = handleStaticSend(
+            node, getterSelector, getterMask, getterElement, null);
+      } else if (Elements.isUnresolved(element) ||
+          element.isSetter ||
+          element.isField) {
+        getterType = handleDynamicSend(
+            node, getterSelector, getterMask, receiverType, null);
+      } else if (element.isLocal) {
+        LocalElement local = element;
+        getterType = locals.use(local);
+      } else {
+        // Bogus SendSet, for example [: myMethod += 42 :].
+        getterType = types.dynamicType;
+      }
+
+      if (op == '??=') {
+        newType = types.allocateDiamondPhi(getterType, rhsType);
+      } else {
+        Selector operatorSelector =
+            elements.getOperatorSelectorInComplexSendSet(node);
+        newType = handleDynamicSend(node, operatorSelector, operatorMask,
+            getterType, new ArgumentsTypes([rhsType], null));
+      }
+
+      if (Elements.isStaticOrTopLevelField(element)) {
+        handleStaticSend(node, setterSelector, setterMask, element,
+            new ArgumentsTypes([newType], null));
+      } else if (Elements.isUnresolved(element) ||
+          element.isSetter ||
+          element.isField) {
+        handleDynamicSend(node, setterSelector, setterMask, receiverType,
+            new ArgumentsTypes([newType], null));
+      } else if (element.isLocal) {
+        locals.update(element, newType, node);
+      }
+
+      return node.isPostfix ? getterType : newType;
+    }
+  }
+
+  /// Handle compound index set, like `foo[0] += 42` or `foo[0]++`.
+  TypeInformation handleCompoundIndexSet(
+      ast.SendSet node,
+      TypeInformation receiverType,
+      TypeInformation indexType,
+      TypeInformation rhsType) {
+    Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node);
+
+    TypeMask getterMask = inTreeData.typeOfGetter(node);
+    Selector operatorSelector =
+        elements.getOperatorSelectorInComplexSendSet(node);
+    TypeMask operatorMask = inTreeData.typeOfOperator(node);
+    Selector setterSelector = elements.getSelector(node);
+    TypeMask setterMask = inTreeData.typeOfSend(node);
+
+    TypeInformation getterType = handleDynamicSend(node, getterSelector,
+        getterMask, receiverType, new ArgumentsTypes([indexType], null));
+
+    TypeInformation returnType;
+    if (node.isIfNullAssignment) {
+      returnType = types.allocateDiamondPhi(getterType, rhsType);
+    } else {
+      returnType = handleDynamicSend(node, operatorSelector, operatorMask,
+          getterType, new ArgumentsTypes([rhsType], null));
+    }
+    handleDynamicSend(node, setterSelector, setterMask, receiverType,
+        new ArgumentsTypes([indexType, returnType], null));
+
+    if (node.isPostfix) {
+      return getterType;
+    } else {
+      return returnType;
+    }
+  }
+
+  /// Handle compound prefix/postfix operations, like `a[0]++`.
+  TypeInformation handleCompoundPrefixPostfix(
+      ast.Send node, TypeInformation receiverType, TypeInformation indexType) {
+    return handleCompoundIndexSet(
+        node, receiverType, indexType, types.uint31Type);
+  }
+
+  @override
+  TypeInformation visitIndexPostfix(ast.Send node, ast.Node receiver,
+      ast.Node index, op.IncDecOperator operator, _) {
+    TypeInformation receiverType = visit(receiver);
+    TypeInformation indexType = visit(index);
+    return handleCompoundPrefixPostfix(node, receiverType, indexType);
+  }
+
+  @override
+  TypeInformation visitIndexPrefix(ast.Send node, ast.Node receiver,
+      ast.Node index, op.IncDecOperator operator, _) {
+    TypeInformation receiverType = visit(receiver);
+    TypeInformation indexType = visit(index);
+    return handleCompoundPrefixPostfix(node, receiverType, indexType);
+  }
+
+  @override
+  TypeInformation visitCompoundIndexSet(ast.SendSet node, ast.Node receiver,
+      ast.Node index, op.AssignmentOperator operator, ast.Node rhs, _) {
+    TypeInformation receiverType = visit(receiver);
+    TypeInformation indexType = visit(index);
+    TypeInformation rhsType = visit(rhs);
+    return handleCompoundIndexSet(node, receiverType, indexType, rhsType);
+  }
+
+  @override
+  TypeInformation visitIndexSetIfNull(
+      ast.SendSet node, ast.Node receiver, ast.Node index, ast.Node rhs, _) {
+    TypeInformation receiverType = visit(receiver);
+    TypeInformation indexType = visit(index);
+    TypeInformation rhsType = visit(rhs);
+    return handleCompoundIndexSet(node, receiverType, indexType, rhsType);
+  }
+
+  @override
+  TypeInformation visitSuperIndexPrefix(ast.Send node, MethodElement getter,
+      MethodElement setter, ast.Node index, op.IncDecOperator operator, _) {
+    TypeInformation indexType = visit(index);
+    return handleSuperIndexPrefixPostfix(node, getter, setter, indexType);
+  }
+
+  @override
+  TypeInformation visitSuperIndexPostfix(ast.Send node, MethodElement getter,
+      MethodElement setter, ast.Node index, op.IncDecOperator operator, _) {
+    TypeInformation indexType = visit(index);
+    return handleSuperIndexPrefixPostfix(node, getter, setter, indexType);
+  }
+
+  /// Handle compound prefix/postfix operations, like `super[0]++`.
+  TypeInformation handleSuperIndexPrefixPostfix(ast.Send node, Element getter,
+      Element setter, TypeInformation indexType) {
+    return _handleSuperCompoundIndexSet(
+        node, getter, setter, indexType, types.uint31Type);
+  }
+
+  /// Handle compound super index set, like `super[42] =+ 2`.
+  TypeInformation handleSuperCompoundIndexSet(ast.SendSet node, Element getter,
+      Element setter, ast.Node index, ast.Node rhs) {
+    TypeInformation indexType = visit(index);
+    TypeInformation rhsType = visit(rhs);
+    return _handleSuperCompoundIndexSet(
+        node, getter, setter, indexType, rhsType);
+  }
+
+  TypeInformation _handleSuperCompoundIndexSet(ast.SendSet node, Element getter,
+      Element setter, TypeInformation indexType, TypeInformation rhsType) {
+    Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node);
+
+    TypeMask getterMask = inTreeData.typeOfGetter(node);
+    Selector setterSelector = elements.getSelector(node);
+    TypeMask setterMask = inTreeData.typeOfSend(node);
+
+    TypeInformation getterType = handleSuperSend(node, getterSelector,
+        getterMask, getter, new ArgumentsTypes([indexType], null));
+
+    TypeInformation returnType;
+    if (node.isIfNullAssignment) {
+      returnType = types.allocateDiamondPhi(getterType, rhsType);
+    } else {
+      Selector operatorSelector =
+          elements.getOperatorSelectorInComplexSendSet(node);
+      TypeMask operatorMask = inTreeData.typeOfOperator(node);
+      returnType = handleDynamicSend(node, operatorSelector, operatorMask,
+          getterType, new ArgumentsTypes([rhsType], null));
+    }
+    handleSuperSend(node, setterSelector, setterMask, setter,
+        new ArgumentsTypes([indexType, returnType], null));
+
+    return node.isPostfix ? getterType : returnType;
+  }
+
+  TypeInformation handleSuperSend(ast.Node node, Selector selector,
+      TypeMask mask, Element element, ArgumentsTypes arguments) {
+    if (element.isMalformed) {
+      return handleSuperNoSuchMethod(node, selector, mask, arguments);
+    } else {
+      return handleStaticSend(node, selector, mask, element, arguments);
+    }
+  }
+
+  @override
+  TypeInformation visitSuperCompoundIndexSet(
+      ast.SendSet node,
+      MethodElement getter,
+      MethodElement setter,
+      ast.Node index,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompoundIndexSet(node, getter, setter, index, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperIndexSetIfNull(
+      ast.SendSet node,
+      MethodElement getter,
+      MethodElement setter,
+      ast.Node index,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompoundIndexSet(node, getter, setter, index, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperCompoundIndexSet(
+      ast.Send node,
+      Element element,
+      ast.Node index,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompoundIndexSet(node, element, element, index, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperIndexSetIfNull(
+      ast.Send node, Element element, ast.Node index, ast.Node rhs, _) {
+    return handleSuperCompoundIndexSet(node, element, element, index, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperGetterCompoundIndexSet(
+      ast.SendSet node,
+      Element element,
+      MethodElement setter,
+      ast.Node index,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompoundIndexSet(node, element, setter, index, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperGetterIndexSetIfNull(ast.SendSet node,
+      Element element, MethodElement setter, ast.Node index, ast.Node rhs, _) {
+    return handleSuperCompoundIndexSet(node, element, setter, index, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperSetterCompoundIndexSet(
+      ast.SendSet node,
+      MethodElement getter,
+      Element element,
+      ast.Node index,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompoundIndexSet(node, getter, element, index, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperSetterIndexSetIfNull(ast.SendSet node,
+      MethodElement getter, Element element, ast.Node index, ast.Node rhs, _) {
+    return handleSuperCompoundIndexSet(node, getter, element, index, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperIndexPrefix(ast.Send node,
+      Element element, ast.Node index, op.IncDecOperator operator, _) {
+    TypeInformation indexType = visit(index);
+    return handleSuperIndexPrefixPostfix(node, element, element, indexType);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperGetterIndexPrefix(
+      ast.SendSet node,
+      Element element,
+      MethodElement setter,
+      ast.Node index,
+      op.IncDecOperator operator,
+      _) {
+    TypeInformation indexType = visit(index);
+    return handleSuperIndexPrefixPostfix(node, element, setter, indexType);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperSetterIndexPrefix(
+      ast.SendSet node,
+      MethodElement getter,
+      Element element,
+      ast.Node index,
+      op.IncDecOperator operator,
+      _) {
+    TypeInformation indexType = visit(index);
+    return handleSuperIndexPrefixPostfix(node, getter, element, indexType);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperIndexPostfix(ast.Send node,
+      Element element, ast.Node index, op.IncDecOperator operator, _) {
+    TypeInformation indexType = visit(index);
+    return handleSuperIndexPrefixPostfix(node, element, element, indexType);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperGetterIndexPostfix(
+      ast.SendSet node,
+      Element element,
+      MethodElement setter,
+      ast.Node index,
+      op.IncDecOperator operator,
+      _) {
+    TypeInformation indexType = visit(index);
+    return handleSuperIndexPrefixPostfix(node, element, setter, indexType);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperSetterIndexPostfix(
+      ast.SendSet node,
+      MethodElement getter,
+      Element element,
+      ast.Node index,
+      op.IncDecOperator operator,
+      _) {
+    TypeInformation indexType = visit(index);
+    return handleSuperIndexPrefixPostfix(node, getter, element, indexType);
+  }
+
+  @override
+  TypeInformation visitSuperFieldCompound(ast.Send node, FieldElement field,
+      op.AssignmentOperator operator, ast.Node rhs, _) {
+    return handleSuperCompound(node, field, field, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperFieldSetterCompound(
+      ast.Send node,
+      FieldElement field,
+      FunctionElement setter,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompound(node, field, setter, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperGetterFieldCompound(
+      ast.Send node,
+      FunctionElement getter,
+      FieldElement field,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompound(node, getter, field, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperGetterSetterCompound(
+      ast.Send node,
+      FunctionElement getter,
+      FunctionElement setter,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompound(node, getter, setter, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperMethodSetterCompound(
+      ast.Send node,
+      FunctionElement method,
+      FunctionElement setter,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompound(node, method, setter, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperCompound(ast.Send node, Element element,
+      op.AssignmentOperator operator, ast.Node rhs, _) {
+    return handleSuperCompound(node, element, element, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperGetterCompound(
+      ast.Send node,
+      Element getter,
+      SetterElement setter,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompound(node, getter, setter, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperSetterCompound(
+      ast.Send node,
+      GetterElement getter,
+      Element setter,
+      op.AssignmentOperator operator,
+      ast.Node rhs,
+      _) {
+    return handleSuperCompound(node, getter, setter, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperFieldFieldSetIfNull(ast.Send node,
+      FieldElement readField, FieldElement writtenField, ast.Node rhs, _) {
+    return handleSuperCompound(node, readField, writtenField, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperFieldSetIfNull(
+      ast.Send node, FieldElement field, ast.Node rhs, _) {
+    return handleSuperCompound(node, field, field, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperFieldSetterSetIfNull(ast.Send node,
+      FieldElement field, FunctionElement setter, ast.Node rhs, _) {
+    return handleSuperCompound(node, field, setter, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperGetterFieldSetIfNull(ast.Send node,
+      FunctionElement getter, FieldElement field, ast.Node rhs, _) {
+    return handleSuperCompound(node, getter, field, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperGetterSetterSetIfNull(ast.Send node,
+      FunctionElement getter, FunctionElement setter, ast.Node rhs, _) {
+    return handleSuperCompound(node, getter, setter, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperMethodSetIfNull(
+      ast.Send node, FunctionElement method, ast.Node rhs, _) {
+    return handleSuperCompound(node, method, null, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperMethodSetterSetIfNull(ast.Send node,
+      FunctionElement method, FunctionElement setter, ast.Node rhs, _) {
+    return handleSuperCompound(node, method, setter, rhs);
+  }
+
+  TypeInformation handleSuperCompound(
+      ast.SendSet node, Element getter, Element setter, ast.Node rhs) {
+    TypeInformation rhsType = visit(rhs);
+    return _handleSuperCompound(node, getter, setter, rhsType);
+  }
+
+  @override
+  TypeInformation visitSuperFieldFieldPostfix(
+      ast.SendSet node,
+      FieldElement readField,
+      FieldElement writtenField,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, readField, writtenField);
+  }
+
+  @override
+  TypeInformation visitSuperFieldFieldPrefix(
+      ast.SendSet node,
+      FieldElement readField,
+      FieldElement writtenField,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, readField, writtenField);
+  }
+
+  @override
+  TypeInformation visitSuperFieldPostfix(
+      ast.SendSet node, FieldElement field, op.IncDecOperator operator, _) {
+    return handleSuperPrefixPostfix(node, field, field);
+  }
+
+  @override
+  TypeInformation visitSuperFieldPrefix(
+      ast.SendSet node, FieldElement field, op.IncDecOperator operator, _) {
+    return handleSuperPrefixPostfix(node, field, field);
+  }
+
+  @override
+  TypeInformation visitSuperFieldSetterPostfix(
+      ast.SendSet node,
+      FieldElement field,
+      FunctionElement setter,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, field, setter);
+  }
+
+  @override
+  TypeInformation visitSuperFieldSetterPrefix(
+      ast.SendSet node,
+      FieldElement field,
+      FunctionElement setter,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, field, setter);
+  }
+
+  @override
+  TypeInformation visitSuperGetterFieldPostfix(
+      ast.SendSet node,
+      FunctionElement getter,
+      FieldElement field,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, getter, field);
+  }
+
+  @override
+  TypeInformation visitSuperGetterFieldPrefix(
+      ast.SendSet node,
+      FunctionElement getter,
+      FieldElement field,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, getter, field);
+  }
+
+  @override
+  TypeInformation visitSuperGetterSetterPostfix(
+      ast.SendSet node,
+      FunctionElement getter,
+      FunctionElement setter,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, getter, setter);
+  }
+
+  @override
+  TypeInformation visitSuperGetterSetterPrefix(
+      ast.SendSet node,
+      FunctionElement getter,
+      FunctionElement setter,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, getter, setter);
+  }
+
+  @override
+  TypeInformation visitSuperMethodSetterPostfix(
+      ast.SendSet node,
+      FunctionElement method,
+      FunctionElement setter,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, method, setter);
+  }
+
+  @override
+  TypeInformation visitSuperMethodSetterPrefix(
+      ast.SendSet node,
+      FunctionElement method,
+      FunctionElement setter,
+      op.IncDecOperator operator,
+      _) {
+    return handleSuperPrefixPostfix(node, method, setter);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperPrefix(
+      ast.SendSet node, Element element, op.IncDecOperator operator, _) {
+    return handleSuperPrefixPostfix(node, element, element);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperPostfix(
+      ast.SendSet node, Element element, op.IncDecOperator operator, _) {
+    return handleSuperPrefixPostfix(node, element, element);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperGetterPrefix(ast.SendSet node,
+      Element getter, SetterElement setter, op.IncDecOperator operator, _) {
+    return handleSuperPrefixPostfix(node, getter, setter);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperGetterPostfix(ast.SendSet node,
+      Element getter, SetterElement setter, op.IncDecOperator operator, _) {
+    return handleSuperPrefixPostfix(node, getter, setter);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperSetterPrefix(ast.SendSet node,
+      GetterElement getter, Element setter, op.IncDecOperator operator, _) {
+    return handleSuperPrefixPostfix(node, getter, setter);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperSetterPostfix(ast.SendSet node,
+      GetterElement getter, Element setter, op.IncDecOperator operator, _) {
+    return handleSuperPrefixPostfix(node, getter, setter);
+  }
+
+  TypeInformation handleSuperPrefixPostfix(
+      ast.SendSet node, Element getter, Element setter) {
+    return _handleSuperCompound(node, getter, setter, types.uint31Type);
+  }
+
+  TypeInformation _handleSuperCompound(ast.SendSet node, Element getter,
+      Element setter, TypeInformation rhsType) {
+    Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node);
+    TypeMask getterMask = inTreeData.typeOfGetter(node);
+    Selector setterSelector = elements.getSelector(node);
+    TypeMask setterMask = inTreeData.typeOfSend(node);
+
+    TypeInformation getterType =
+        handleSuperSend(node, getterSelector, getterMask, getter, null);
+
+    TypeInformation returnType;
+    if (node.isIfNullAssignment) {
+      returnType = types.allocateDiamondPhi(getterType, rhsType);
+    } else {
+      Selector operatorSelector =
+          elements.getOperatorSelectorInComplexSendSet(node);
+      TypeMask operatorMask = inTreeData.typeOfOperator(node);
+      returnType = handleDynamicSend(node, operatorSelector, operatorMask,
+          getterType, new ArgumentsTypes([rhsType], null));
+    }
+    handleSuperSend(node, setterSelector, setterMask, setter,
+        new ArgumentsTypes([returnType], null));
+
+    return node.isPostfix ? getterType : returnType;
+  }
+
+  /// Handle index set, like `foo[0] = 42`.
+  TypeInformation handleIndexSet(ast.SendSet node, TypeInformation receiverType,
+      TypeInformation indexType, TypeInformation rhsType) {
+    Selector setterSelector = elements.getSelector(node);
+    TypeMask setterMask = inTreeData.typeOfSend(node);
+    handleDynamicSend(node, setterSelector, setterMask, receiverType,
+        new ArgumentsTypes([indexType, rhsType], null));
+    return rhsType;
+  }
+
+  @override
+  TypeInformation visitIndexSet(
+      ast.SendSet node, ast.Node receiver, ast.Node index, ast.Node rhs, _) {
+    TypeInformation receiverType = visit(receiver);
+    TypeInformation indexType = visit(index);
+    TypeInformation rhsType = visit(rhs);
+    return handleIndexSet(node, receiverType, indexType, rhsType);
+  }
+
+  /// Handle super index set, like `super[42] = true`.
+  TypeInformation handleSuperIndexSet(
+      ast.SendSet node, Element element, ast.Node index, ast.Node rhs) {
+    TypeInformation indexType = visit(index);
+    TypeInformation rhsType = visit(rhs);
+    Selector setterSelector = elements.getSelector(node);
+    TypeMask setterMask = inTreeData.typeOfSend(node);
+    handleStaticSend(node, setterSelector, setterMask, element,
+        new ArgumentsTypes([indexType, rhsType], null));
+    return rhsType;
+  }
+
+  @override
+  TypeInformation visitSuperIndexSet(ast.SendSet node, FunctionElement function,
+      ast.Node index, ast.Node rhs, _) {
+    return handleSuperIndexSet(node, function, index, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperIndexSet(
+      ast.SendSet node, Element element, ast.Node index, ast.Node rhs, _) {
+    return handleSuperIndexSet(node, element, index, rhs);
+  }
+
+  TypeInformation handlePlainAssignment(
+      ast.Node node,
+      Element element,
+      Selector setterSelector,
+      TypeMask setterMask,
+      TypeInformation receiverType,
+      TypeInformation rhsType,
+      ast.Node rhs) {
+    ArgumentsTypes arguments = new ArgumentsTypes([rhsType], null);
+    if (Elements.isMalformed(element)) {
+      // Code will always throw.
+    } else if (Elements.isStaticOrTopLevelField(element)) {
+      handleStaticSend(node, setterSelector, setterMask, element, arguments);
+    } else if (Elements.isUnresolved(element) || element.isSetter) {
+      if (analyzedElement.isGenerativeConstructor &&
+          (node.asSendSet() != null) &&
+          (node.asSendSet().receiver != null) &&
+          node.asSendSet().receiver.isThis()) {
+        Iterable<Element> targets = closedWorld.allFunctions.filter(
+            setterSelector, types.newTypedSelector(thisType, setterMask));
+        // We just recognized a field initialization of the form:
+        // `this.foo = 42`. If there is only one target, we can update
+        // its type.
+        if (targets.length == 1) {
+          Element single = targets.first;
+          if (single.isField) {
+            locals.updateField(single, rhsType);
+          }
+        }
+      }
+      handleDynamicSend(
+          node, setterSelector, setterMask, receiverType, arguments);
+    } else if (element.isField) {
+      if (element.isFinal) {
+        inferrer.recordTypeOfFinalField(
+            node, outermostElement, element, rhsType);
+      } else {
+        if (analyzedElement.isGenerativeConstructor) {
+          locals.updateField(element, rhsType);
+        }
+        if (visitingInitializers) {
+          inferrer.recordTypeOfNonFinalField(node, element, rhsType);
+        } else {
+          handleDynamicSend(
+              node, setterSelector, setterMask, receiverType, arguments);
+        }
+      }
+    } else if (element.isLocal) {
+      locals.update(element, rhsType, node);
+    }
+    return rhsType;
+  }
+
+  /// Handle a super access or invocation that results in a `noSuchMethod` call.
+  TypeInformation handleErroneousSuperSend(ast.Send node) {
+    ArgumentsTypes arguments =
+        node.isPropertyAccess ? null : analyzeArguments(node.arguments);
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    // TODO(herhut): We could do better here if we knew what we
+    // are calling does not expose this.
+    // TODO(johnniwinther): Do we still need this when calling directly?
+    isThisExposed = true;
+    return handleSuperNoSuchMethod(node, selector, mask, arguments);
+  }
+
+  TypeInformation handleSuperNoSuchMethod(ast.Send node, Selector selector,
+      TypeMask mask, ArgumentsTypes arguments) {
+    // Ensure we create a node, to make explicit the call to the
+    // `noSuchMethod` handler.
+    ClassElement cls = outermostElement.enclosingClass;
+    MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_);
+    if (!Selectors.noSuchMethod_.signatureApplies(element)) {
+      ClassElement objectClass = compiler.commonElements.objectClass;
+      element = objectClass.lookupMember(Identifiers.noSuchMethod_);
+    }
+    return handleStaticSend(node, selector, mask, element, arguments);
+  }
+
+  /// Handle a .call invocation on the values retrieved from the super
+  /// [element]. For instance `super.foo(bar)` where `foo` is a field or getter.
+  TypeInformation handleSuperClosureCall(
+      ast.Send node, Element element, ast.NodeList arguments) {
+    ArgumentsTypes argumentTypes = analyzeArguments(arguments.nodes);
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    // TODO(herhut): We could do better here if we knew what we
+    // are calling does not expose this.
+    isThisExposed = true;
+    return inferrer.registerCalledClosure(
+        node,
+        selector,
+        mask,
+        inferrer.typeOfElement(element),
+        outermostElement,
+        argumentTypes,
+        sideEffects,
+        inLoop);
+  }
+
+  /// Handle an invocation of super [method].
+  TypeInformation handleSuperMethodInvoke(
+      ast.Send node, MethodElement method, ArgumentsTypes arguments) {
+    // TODO(herhut): We could do better here if we knew what we
+    // are calling does not expose this.
+    isThisExposed = true;
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    return handleStaticSend(node, selector, mask, method, arguments);
+  }
+
+  /// Handle access to a super field or getter [element].
+  TypeInformation handleSuperGet(ast.Send node, Element element) {
+    // TODO(herhut): We could do better here if we knew what we
+    // are calling does not expose this.
+    isThisExposed = true;
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    return handleStaticSend(node, selector, mask, element, null);
+  }
+
+  /// Handle update to a super field or setter [element].
+  TypeInformation handleSuperSet(ast.Send node, Element element, ast.Node rhs) {
+    TypeInformation rhsType = visit(rhs);
+    // TODO(herhut): We could do better here if we knew what we
+    // are calling does not expose this.
+    isThisExposed = true;
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    handleStaticSend(
+        node, selector, mask, element, new ArgumentsTypes([rhsType], null));
+    return rhsType;
+  }
+
+  @override
+  TypeInformation visitSuperFieldSet(
+      ast.Send node, FieldElement method, ast.Node rhs, _) {
+    return handleSuperSet(node, method, rhs);
+  }
+
+  @override
+  TypeInformation visitSuperSetterSet(
+      ast.Send node, SetterElement field, ast.Node rhs, _) {
+    return handleSuperSet(node, field, rhs);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperIndex(
+      ast.Send node, Element element, ast.Node index, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperUnary(
+      ast.Send node, op.UnaryOperator operator, Element element, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperBinary(ast.Send node, Element element,
+      op.BinaryOperator operator, ast.Node argument, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperGet(ast.Send node, Element element, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitSuperSetterGet(ast.Send node, MethodElement setter, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitSuperGetterSet(
+      ast.Send node, MethodElement getter, ast.Node rhs, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitSuperMethodSet(
+      ast.Send node, MethodElement method, ast.Node rhs, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitFinalSuperFieldSet(
+      ast.Send node, FieldElement method, ast.Node rhs, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperSet(
+      ast.Send node, Element element, ast.Node rhs, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitUnresolvedSuperInvoke(
+      ast.Send node, Element element, ast.Node argument, Selector selector, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitSuperFieldGet(ast.Send node, FieldElement field, _) {
+    return handleSuperGet(node, field);
+  }
+
+  @override
+  TypeInformation visitSuperGetterGet(ast.Send node, MethodElement method, _) {
+    return handleSuperGet(node, method);
+  }
+
+  @override
+  TypeInformation visitSuperMethodGet(ast.Send node, MethodElement method, _) {
+    return handleSuperGet(node, method);
+  }
+
+  @override
+  TypeInformation visitSuperFieldInvoke(ast.Send node, FieldElement field,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleSuperClosureCall(node, field, arguments);
+  }
+
+  @override
+  TypeInformation visitSuperGetterInvoke(ast.Send node, MethodElement getter,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleSuperClosureCall(node, getter, arguments);
+  }
+
+  @override
+  TypeInformation visitSuperMethodInvoke(ast.Send node, MethodElement method,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleSuperMethodInvoke(
+        node, method, analyzeArguments(arguments.nodes));
+  }
+
+  @override
+  TypeInformation visitSuperSetterInvoke(ast.Send node, FunctionElement setter,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  @override
+  TypeInformation visitSuperIndex(
+      ast.Send node, MethodElement method, ast.Node index, _) {
+    return handleSuperMethodInvoke(
+        node, method, analyzeArguments(node.arguments));
+  }
+
+  @override
+  TypeInformation visitSuperEquals(
+      ast.Send node, MethodElement method, ast.Node argument, _) {
+    // TODO(johnniwinther): Special case ==.
+    return handleSuperMethodInvoke(
+        node, method, analyzeArguments(node.arguments));
+  }
+
+  @override
+  TypeInformation visitSuperNotEquals(
+      ast.Send node, MethodElement method, ast.Node argument, _) {
+    // TODO(johnniwinther): Special case !=.
+    return handleSuperMethodInvoke(
+        node, method, analyzeArguments(node.arguments));
+  }
+
+  @override
+  TypeInformation visitSuperBinary(ast.Send node, MethodElement method,
+      op.BinaryOperator operator, ast.Node argument, _) {
+    return handleSuperMethodInvoke(
+        node, method, analyzeArguments(node.arguments));
+  }
+
+  @override
+  TypeInformation visitSuperUnary(
+      ast.Send node, op.UnaryOperator operator, MethodElement method, _) {
+    return handleSuperMethodInvoke(
+        node, method, analyzeArguments(node.arguments));
+  }
+
+  @override
+  TypeInformation visitSuperMethodIncompatibleInvoke(
+      ast.Send node,
+      MethodElement method,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleErroneousSuperSend(node);
+  }
+
+  // Try to find the length given to a fixed array constructor call.
+  int findLength(ast.Send node) {
+    ast.Node firstArgument = node.arguments.head;
+    Element element = elements[firstArgument];
+    ast.LiteralInt length = firstArgument.asLiteralInt();
+    if (length != null) {
+      return length.value;
+    } else if (element != null &&
+        element.isField &&
+        Elements.isStaticOrTopLevelField(element)) {
+      FieldElement fieldElement = element;
+      if (closedWorld.fieldNeverChanges(fieldElement)) {
+        ConstantValue value =
+            compiler.backend.constants.getConstantValue(fieldElement.constant);
+        if (value != null && value.isInt) {
+          IntConstantValue intValue = value;
+          return intValue.primitiveValue;
+        }
+      }
+    }
+    return null;
+  }
+
+  TypeInformation visitAwait(ast.Await node) {
+    TypeInformation futureType = node.expression.accept(this);
+    return inferrer.registerAwait(node, futureType);
+  }
+
+  @override
+  TypeInformation handleTypeLiteralInvoke(ast.NodeList arguments) {
+    // This is reached when users forget to put a `new` in front of a type
+    // literal. The emitter will generate an actual call (even though it is
+    // likely invalid), and for that it needs to have the arguments processed
+    // as well.
+    analyzeArguments(arguments.nodes);
+    return types.dynamicType;
+  }
+
+  /// Handle constructor invocation of [constructor].
+  TypeInformation handleConstructorSend(
+      ast.Send node, ConstructorElement constructor) {
+    ConstructorElement target = constructor.implementation;
+    ArgumentsTypes arguments = analyzeArguments(node.arguments);
+    if (visitingInitializers) {
+      if (ast.Initializers.isConstructorRedirect(node)) {
+        isConstructorRedirect = true;
+      } else if (ast.Initializers.isSuperConstructorCall(node)) {
+        seenSuperConstructorCall = true;
+        analyzeSuperConstructorCall(constructor, arguments);
+      }
+    }
+    // If we are looking at a new expression on a forwarding factory, we have to
+    // forward the call to the effective target of the factory.
+    // TODO(herhut): Remove the loop once effectiveTarget forwards to patches.
+    while (target.isFactoryConstructor) {
+      if (!target.isRedirectingFactory) break;
+      target = target.effectiveTarget.implementation;
+    }
+    if (compiler.backend.isForeign(target)) {
+      return handleForeignSend(node, target);
+    }
+    Selector selector = elements.getSelector(node);
+    CallStructure callStructure = selector.callStructure;
+    TypeMask mask = inTreeData.typeOfSend(node);
+    // In erroneous code the number of arguments in the selector might not
+    // match the function element.
+    // TODO(polux): return nonNullEmpty and check it doesn'TypeInformation break anything
+    if (target.isMalformed || !callStructure.signatureApplies(target.type)) {
+      return types.dynamicType;
+    }
+
+    TypeInformation returnType =
+        handleStaticSend(node, selector, mask, target, arguments);
+    if (Elements.isGrowableListConstructorCall(
+        constructor, node, closedWorld.commonElements)) {
+      return inferrer.concreteTypes.putIfAbsent(
+          node,
+          () => types.allocateList(types.growableListType, node,
+              outermostElement, types.nonNullEmpty(), 0));
+    } else if (Elements.isFixedListConstructorCall(
+            constructor, node, closedWorld.commonElements) ||
+        Elements.isFilledListConstructorCall(
+            constructor, node, closedWorld.commonElements)) {
+      int length = findLength(node);
+      TypeInformation elementType = Elements.isFixedListConstructorCall(
+              constructor, node, closedWorld.commonElements)
+          ? types.nullType
+          : arguments.positional[1];
+
+      return inferrer.concreteTypes.putIfAbsent(
+          node,
+          () => types.allocateList(types.fixedListType, node, outermostElement,
+              elementType, length));
+    } else if (Elements.isConstructorOfTypedArraySubclass(
+        constructor, closedWorld)) {
+      int length = findLength(node);
+      TypeInformation elementType = inferrer
+          .returnTypeOfElement(target.enclosingClass.lookupMember('[]'));
+      return inferrer.concreteTypes.putIfAbsent(
+          node,
+          () => types.allocateList(types.nonNullExact(target.enclosingClass),
+              node, outermostElement, elementType, length));
+    } else {
+      return returnType;
+    }
+  }
+
+  @override
+  TypeInformation bulkHandleNew(ast.NewExpression node, _) {
+    Element element = elements[node.send];
+    return handleConstructorSend(node.send, element);
+  }
+
+  @override
+  TypeInformation errorNonConstantConstructorInvoke(
+      ast.NewExpression node,
+      Element element,
+      ResolutionDartType type,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return bulkHandleNew(node, _);
+  }
+
+  /// Handle invocation of a top level or static field or getter [element].
+  TypeInformation handleStaticFieldOrGetterInvoke(
+      ast.Send node, Element element) {
+    ArgumentsTypes arguments = analyzeArguments(node.arguments);
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    handleStaticSend(node, selector, mask, element, arguments);
+    return inferrer.registerCalledClosure(
+        node,
+        selector,
+        mask,
+        inferrer.typeOfElement(element),
+        outermostElement,
+        arguments,
+        sideEffects,
+        inLoop);
+  }
+
+  /// Handle invocation of a top level or static [function].
+  TypeInformation handleStaticFunctionInvoke(
+      ast.Send node, MethodElement function) {
+    if (compiler.backend.isForeign(function)) {
+      return handleForeignSend(node, function);
+    }
+    ArgumentsTypes arguments = analyzeArguments(node.arguments);
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    return handleStaticSend(node, selector, mask, function, arguments);
+  }
+
+  /// Handle an static invocation of an unresolved target or with incompatible
+  /// arguments to a resolved target.
+  TypeInformation handleInvalidStaticInvoke(ast.Send node) {
+    analyzeArguments(node.arguments);
+    return types.dynamicType;
+  }
+
+  @override
+  TypeInformation visitStaticFieldInvoke(ast.Send node, FieldElement field,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleStaticFieldOrGetterInvoke(node, field);
+  }
+
+  @override
+  TypeInformation visitStaticFunctionInvoke(
+      ast.Send node,
+      MethodElement function,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleStaticFunctionInvoke(node, function);
+  }
+
+  @override
+  TypeInformation visitStaticFunctionIncompatibleInvoke(
+      ast.Send node,
+      MethodElement function,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleInvalidStaticInvoke(node);
+  }
+
+  @override
+  TypeInformation visitStaticGetterInvoke(ast.Send node, FunctionElement getter,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleStaticFieldOrGetterInvoke(node, getter);
+  }
+
+  @override
+  TypeInformation visitTopLevelFieldInvoke(ast.Send node, FieldElement field,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleStaticFieldOrGetterInvoke(node, field);
+  }
+
+  @override
+  TypeInformation visitTopLevelFunctionInvoke(
+      ast.Send node,
+      MethodElement function,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleStaticFunctionInvoke(node, function);
+  }
+
+  @override
+  TypeInformation visitTopLevelFunctionIncompatibleInvoke(
+      ast.Send node,
+      MethodElement function,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleInvalidStaticInvoke(node);
+  }
+
+  @override
+  TypeInformation visitTopLevelGetterInvoke(
+      ast.Send node,
+      FunctionElement getter,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleStaticFieldOrGetterInvoke(node, getter);
+  }
+
+  @override
+  TypeInformation visitStaticSetterInvoke(ast.Send node, MethodElement setter,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleInvalidStaticInvoke(node);
+  }
+
+  @override
+  TypeInformation visitTopLevelSetterInvoke(ast.Send node, MethodElement setter,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleInvalidStaticInvoke(node);
+  }
+
+  @override
+  TypeInformation visitUnresolvedInvoke(ast.Send node, Element element,
+      ast.NodeList arguments, Selector selector, _) {
+    return handleInvalidStaticInvoke(node);
+  }
+
+  TypeInformation handleForeignSend(ast.Send node, Element element) {
+    ArgumentsTypes arguments = analyzeArguments(node.arguments);
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    String name = element.name;
+    handleStaticSend(node, selector, mask, element, arguments);
+    if (name == BackendHelpers.JS ||
+        name == BackendHelpers.JS_EMBEDDED_GLOBAL ||
+        name == BackendHelpers.JS_BUILTIN) {
+      native.NativeBehavior nativeBehavior = elements.getNativeData(node);
+      sideEffects.add(nativeBehavior.sideEffects);
+      return inferrer.typeOfNativeBehavior(nativeBehavior);
+    } else if (name == 'JS_OPERATOR_AS_PREFIX' || name == 'JS_STRING_CONCAT') {
+      return types.stringType;
+    } else {
+      sideEffects.setAllSideEffects();
+      return types.dynamicType;
+    }
+  }
+
+  ArgumentsTypes analyzeArguments(Link<ast.Node> arguments) {
+    List positional = [];
+    Map<String, TypeInformation> named;
+    for (var argument in arguments) {
+      ast.NamedArgument namedArgument = argument.asNamedArgument();
+      if (namedArgument != null) {
+        argument = namedArgument.expression;
+        if (named == null) named = new Map<String, TypeInformation>();
+        named[namedArgument.name.source] = argument.accept(this);
+      } else {
+        positional.add(argument.accept(this));
+      }
+      // TODO(ngeoffray): We could do better here if we knew what we
+      // are calling does not expose this.
+      isThisExposed = isThisExposed || argument.isThis();
+    }
+    return new ArgumentsTypes(positional, named);
+  }
+
+  /// Read a local variable, function or parameter.
+  TypeInformation handleLocalGet(ast.Send node, LocalElement local) {
+    assert(locals.use(local) != null);
+    return locals.use(local);
+  }
+
+  /// Read a static or top level field.
+  TypeInformation handleStaticFieldGet(ast.Send node, FieldElement field) {
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    return handleStaticSend(node, selector, mask, field, null);
+  }
+
+  /// Invoke a static or top level getter.
+  TypeInformation handleStaticGetterGet(ast.Send node, MethodElement getter) {
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    return handleStaticSend(node, selector, mask, getter, null);
+  }
+
+  /// Closurize a static or top level function.
+  TypeInformation handleStaticFunctionGet(
+      ast.Send node, MethodElement function) {
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    return handleStaticSend(node, selector, mask, function, null);
+  }
+
+  @override
+  TypeInformation visitDynamicPropertyGet(
+      ast.Send node, ast.Node receiver, Name name, _) {
+    return handleDynamicGet(node);
+  }
+
+  @override
+  TypeInformation visitIfNotNullDynamicPropertyGet(
+      ast.Send node, ast.Node receiver, Name name, _) {
+    return handleDynamicGet(node);
+  }
+
+  @override
+  TypeInformation visitLocalVariableGet(
+      ast.Send node, LocalVariableElement variable, _) {
+    return handleLocalGet(node, variable);
+  }
+
+  @override
+  TypeInformation visitParameterGet(
+      ast.Send node, ParameterElement parameter, _) {
+    return handleLocalGet(node, parameter);
+  }
+
+  @override
+  TypeInformation visitLocalFunctionGet(
+      ast.Send node, LocalFunctionElement function, _) {
+    return handleLocalGet(node, function);
+  }
+
+  @override
+  TypeInformation visitStaticFieldGet(ast.Send node, FieldElement field, _) {
+    return handleStaticFieldGet(node, field);
+  }
+
+  @override
+  TypeInformation visitStaticFunctionGet(
+      ast.Send node, MethodElement function, _) {
+    return handleStaticFunctionGet(node, function);
+  }
+
+  @override
+  TypeInformation visitStaticGetterGet(
+      ast.Send node, FunctionElement getter, _) {
+    return handleStaticGetterGet(node, getter);
+  }
+
+  @override
+  TypeInformation visitThisPropertyGet(ast.Send node, Name name, _) {
+    return handleDynamicGet(node);
+  }
+
+  @override
+  TypeInformation visitTopLevelFieldGet(ast.Send node, FieldElement field, _) {
+    return handleStaticFieldGet(node, field);
+  }
+
+  @override
+  TypeInformation visitTopLevelFunctionGet(
+      ast.Send node, MethodElement function, _) {
+    return handleStaticFunctionGet(node, function);
+  }
+
+  @override
+  TypeInformation visitTopLevelGetterGet(
+      ast.Send node, FunctionElement getter, _) {
+    return handleStaticGetterGet(node, getter);
+  }
+
+  @override
+  TypeInformation visitStaticSetterGet(ast.Send node, MethodElement setter, _) {
+    return types.dynamicType;
+  }
+
+  @override
+  TypeInformation visitTopLevelSetterGet(
+      ast.Send node, MethodElement setter, _) {
+    return types.dynamicType;
+  }
+
+  @override
+  TypeInformation visitUnresolvedGet(ast.Send node, Element element, _) {
+    return types.dynamicType;
+  }
+
+  /// Handle .call invocation on [closure].
+  TypeInformation handleCallInvoke(ast.Send node, TypeInformation closure) {
+    ArgumentsTypes arguments = analyzeArguments(node.arguments);
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    return inferrer.registerCalledClosure(node, selector, mask, closure,
+        outermostElement, arguments, sideEffects, inLoop);
+  }
+
+  @override
+  TypeInformation visitExpressionInvoke(ast.Send node, ast.Node expression,
+      ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleCallInvoke(node, expression.accept(this));
+  }
+
+  @override
+  TypeInformation visitThisInvoke(
+      ast.Send node, ast.NodeList arguments, CallStructure callStructure, _) {
+    return handleCallInvoke(node, thisType);
+  }
+
+  @override
+  TypeInformation visitParameterInvoke(
+      ast.Send node,
+      ParameterElement parameter,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleCallInvoke(node, locals.use(parameter));
+  }
+
+  @override
+  TypeInformation visitLocalVariableInvoke(
+      ast.Send node,
+      LocalVariableElement variable,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    return handleCallInvoke(node, locals.use(variable));
+  }
+
+  @override
+  TypeInformation visitLocalFunctionInvoke(
+      ast.Send node,
+      LocalFunctionElement function,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    ArgumentsTypes argumentTypes = analyzeArguments(node.arguments);
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    // This only works for function statements. We need a
+    // more sophisticated type system with function types to support
+    // more.
+    return inferrer.registerCalledElement(node, selector, mask,
+        outermostElement, function, argumentTypes, sideEffects, inLoop);
+  }
+
+  @override
+  TypeInformation visitLocalFunctionIncompatibleInvoke(
+      ast.Send node,
+      LocalFunctionElement function,
+      ast.NodeList arguments,
+      CallStructure callStructure,
+      _) {
+    analyzeArguments(node.arguments);
+    return types.dynamicType;
+  }
+
+  TypeInformation handleStaticSend(ast.Node node, Selector selector,
+      TypeMask mask, Element element, ArgumentsTypes arguments) {
+    assert(!element.isFactoryConstructor ||
+        !(element as ConstructorElement).isRedirectingFactory);
+    // Erroneous elements may be unresolved, for example missing getters.
+    if (Elements.isUnresolved(element)) return types.dynamicType;
+    // TODO(herhut): should we follow redirecting constructors here? We would
+    // need to pay attention if the constructor is pointing to an erroneous
+    // element.
+    return inferrer.registerCalledElement(node, selector, mask,
+        outermostElement, element, arguments, sideEffects, inLoop);
+  }
+
+  TypeInformation handleDynamicSend(ast.Node node, Selector selector,
+      TypeMask mask, TypeInformation receiverType, ArgumentsTypes arguments) {
+    assert(receiverType != null);
+    if (types.selectorNeedsUpdate(receiverType, mask)) {
+      mask = receiverType == types.dynamicType
+          ? null
+          : types.newTypedSelector(receiverType, mask);
+      inferrer.updateSelectorInTree(analyzedElement, node, selector, mask);
+    }
+
+    // If the receiver of the call is a local, we may know more about
+    // its type by refining it with the potential targets of the
+    // calls.
+    ast.Send send = node.asSend();
+    if (send != null) {
+      ast.Node receiver = send.receiver;
+      if (receiver != null) {
+        Element element = elements[receiver];
+        if (Elements.isLocal(element) && !capturedVariables.contains(element)) {
+          TypeInformation refinedType = types.refineReceiver(
+              selector, mask, receiverType, send.isConditional);
+          locals.update(element, refinedType, node);
+        }
+      }
+    }
+
+    return inferrer.registerCalledSelector(node, selector, mask, receiverType,
+        outermostElement, arguments, sideEffects, inLoop);
+  }
+
+  TypeInformation handleDynamicInvoke(ast.Send node) {
+    return _handleDynamicSend(node);
+  }
+
+  TypeInformation handleDynamicGet(ast.Send node) {
+    return _handleDynamicSend(node);
+  }
+
+  TypeInformation _handleDynamicSend(ast.Send node) {
+    Element element = elements[node];
+    TypeInformation receiverType;
+    bool isCallOnThis = false;
+    if (node.receiver == null) {
+      if (treatAsInstanceMember(element)) {
+        isCallOnThis = true;
+        receiverType = thisType;
+      }
+    } else {
+      ast.Node receiver = node.receiver;
+      isCallOnThis = isThisOrSuper(receiver);
+      receiverType = visit(receiver);
+    }
+
+    Selector selector = elements.getSelector(node);
+    TypeMask mask = inTreeData.typeOfSend(node);
+    if (!isThisExposed && isCallOnThis) {
+      checkIfExposesThis(selector, types.newTypedSelector(receiverType, mask));
+    }
+
+    ArgumentsTypes arguments =
+        node.isPropertyAccess ? null : analyzeArguments(node.arguments);
+    if (selector.name == '==' || selector.name == '!=') {
+      if (types.isNull(receiverType)) {
+        potentiallyAddNullCheck(node, node.arguments.head);
+        return types.boolType;
+      } else if (types.isNull(arguments.positional[0])) {
+        potentiallyAddNullCheck(node, node.receiver);
+        return types.boolType;
+      }
+    }
+    return handleDynamicSend(node, selector, mask, receiverType, arguments);
+  }
+
+  void recordReturnType(TypeInformation type) {
+    returnType = inferrer.addReturnTypeFor(analyzedElement, returnType, type);
+  }
+
+  TypeInformation synthesizeForwardingCall(
+      Spannable node, FunctionElement element) {
+    element = element.implementation;
+    FunctionElement function = analyzedElement;
+    FunctionSignature signature = function.functionSignature;
+    FunctionSignature calleeSignature = element.functionSignature;
+    if (!calleeSignature.isCompatibleWith(signature)) {
+      return types.nonNullEmpty();
+    }
+
+    List<TypeInformation> unnamed = <TypeInformation>[];
+    signature.forEachRequiredParameter((ParameterElement element) {
+      assert(locals.use(element) != null);
+      unnamed.add(locals.use(element));
+    });
+
+    Map<String, TypeInformation> named;
+    if (signature.optionalParametersAreNamed) {
+      named = new Map<String, TypeInformation>();
+      signature.forEachOptionalParameter((ParameterElement element) {
+        named[element.name] = locals.use(element);
+      });
+    } else {
+      signature.forEachOptionalParameter((ParameterElement element) {
+        unnamed.add(locals.use(element));
+      });
+    }
+
+    ArgumentsTypes arguments = new ArgumentsTypes(unnamed, named);
+    return inferrer.registerCalledElement(node, null, null, outermostElement,
+        element, arguments, sideEffects, inLoop);
+  }
+
+  TypeInformation visitRedirectingFactoryBody(ast.RedirectingFactoryBody node) {
+    Element element = elements.getRedirectingTargetConstructor(node);
+    if (Elements.isMalformed(element)) {
+      recordReturnType(types.dynamicType);
+    } else {
+      // We don'TypeInformation create a selector for redirecting factories, and
+      // the send is just a property access. Therefore we must
+      // manually create the [ArgumentsTypes] of the call, and
+      // manually register [analyzedElement] as a caller of [element].
+      TypeInformation mask =
+          synthesizeForwardingCall(node.constructorReference, element);
+      recordReturnType(mask);
+    }
+    locals.seenReturnOrThrow = true;
+    return null;
+  }
+
+  TypeInformation visitReturn(ast.Return node) {
+    ast.Node expression = node.expression;
+    recordReturnType(
+        expression == null ? types.nullType : expression.accept(this));
+    locals.seenReturnOrThrow = true;
+    return null;
+  }
+
+  TypeInformation handleForInLoop(
+      ast.ForIn node,
+      TypeInformation iteratorType,
+      Selector currentSelector,
+      TypeMask currentMask,
+      Selector moveNextSelector,
+      TypeMask moveNextMask) {
+    handleDynamicSend(node, moveNextSelector, moveNextMask, iteratorType,
+        new ArgumentsTypes.empty());
+    TypeInformation currentType = handleDynamicSend(node, currentSelector,
+        currentMask, iteratorType, new ArgumentsTypes.empty());
+
+    if (node.expression.isThis()) {
+      // Any reasonable implementation of an iterator would expose
+      // this, so we play it safe and assume it will.
+      isThisExposed = true;
+    }
+
+    ast.Node identifier = node.declaredIdentifier;
+    Element element = elements.getForInVariable(node);
+    Selector selector = elements.getSelector(identifier);
+    TypeMask mask = inTreeData.typeOfSend(identifier.asSend());
+
+    TypeInformation receiverType;
+    if (element != null && element.isInstanceMember) {
+      receiverType = thisType;
+    } else {
+      receiverType = types.dynamicType;
+    }
+
+    handlePlainAssignment(identifier, element, selector, mask, receiverType,
+        currentType, node.expression);
+    return handleLoop(node, () {
+      visit(node.body);
+    });
+  }
+
+  TypeInformation visitAsyncForIn(ast.AsyncForIn node) {
+    TypeInformation expressionType = visit(node.expression);
+
+    Selector currentSelector = Selectors.current;
+    TypeMask currentMask = inTreeData.typeOfIteratorCurrent(node);
+    Selector moveNextSelector = Selectors.moveNext;
+    TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node);
+
+    js.JavaScriptBackend backend = compiler.backend;
+    Element ctor = backend.helpers.streamIteratorConstructor;
+
+    /// Synthesize a call to the [StreamIterator] constructor.
+    TypeInformation iteratorType = handleStaticSend(
+        node, null, null, ctor, new ArgumentsTypes([expressionType], null));
+
+    return handleForInLoop(node, iteratorType, currentSelector, currentMask,
+        moveNextSelector, moveNextMask);
+  }
+
+  TypeInformation visitSyncForIn(ast.SyncForIn node) {
+    TypeInformation expressionType = visit(node.expression);
+    Selector iteratorSelector = Selectors.iterator;
+    TypeMask iteratorMask = inTreeData.typeOfIterator(node);
+    Selector currentSelector = Selectors.current;
+    TypeMask currentMask = inTreeData.typeOfIteratorCurrent(node);
+    Selector moveNextSelector = Selectors.moveNext;
+    TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node);
+
+    TypeInformation iteratorType = handleDynamicSend(node, iteratorSelector,
+        iteratorMask, expressionType, new ArgumentsTypes.empty());
+
+    return handleForInLoop(node, iteratorType, currentSelector, currentMask,
+        moveNextSelector, moveNextMask);
+  }
+}
diff --git a/pkg/compiler/lib/src/inferrer/closure_tracer.dart b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
index a757a7b..cd76db6 100644
--- a/pkg/compiler/lib/src/inferrer/closure_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/closure_tracer.dart
@@ -10,17 +10,21 @@
 import '../types/types.dart' show TypeMask;
 import '../universe/selector.dart' show Selector;
 import 'debug.dart' as debug;
+import 'inferrer_engine.dart';
 import 'node_tracer.dart';
 import 'type_graph_nodes.dart';
 
-class ClosureTracerVisitor extends TracerVisitor<ApplyableTypeInformation> {
+class ClosureTracerVisitor extends TracerVisitor {
   final Iterable<FunctionElement> tracedElements;
   final List<CallSiteTypeInformation> _callsToAnalyze =
       new List<CallSiteTypeInformation>();
 
-  ClosureTracerVisitor(this.tracedElements, tracedType, inferrer)
+  ClosureTracerVisitor(this.tracedElements, ApplyableTypeInformation tracedType,
+      InferrerEngine inferrer)
       : super(tracedType, inferrer);
 
+  ApplyableTypeInformation get tracedType => super.tracedType;
+
   void run() {
     analyze();
     if (!continueAnalyzing) return;
@@ -49,7 +53,9 @@
     Selector selector = info.selector;
     TypeMask mask = info.mask;
     tracedElements.forEach((FunctionElement functionElement) {
-      if (!selector.signatureApplies(functionElement)) return;
+      if (!selector.callStructure.signatureApplies(functionElement.type)) {
+        return;
+      }
       inferrer.updateParameterAssignments(
           info, functionElement, info.arguments, selector, mask,
           remove: false, addToQueue: false);
@@ -94,8 +100,10 @@
   bool _checkIfCurrentUser(element) =>
       inferrer.types.getInferredTypeOf(element) == currentUser;
 
-  bool _checkIfFunctionApply(element) =>
-      compiler.commonElements.isFunctionApplyMethod(element);
+  bool _checkIfFunctionApply(Element element) {
+    return element is MemberElement &&
+        compiler.commonElements.isFunctionApplyMethod(element);
+  }
 
   @override
   visitDynamicCallSiteTypeInformation(DynamicCallSiteTypeInformation info) {
diff --git a/pkg/compiler/lib/src/inferrer/inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
new file mode 100644
index 0000000..fc6d0bf
--- /dev/null
+++ b/pkg/compiler/lib/src/inferrer/inferrer_engine.dart
@@ -0,0 +1,1051 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import '../common.dart';
+import '../common/names.dart';
+import '../compiler.dart';
+import '../constants/expressions.dart';
+import '../constants/values.dart';
+import '../core_types.dart';
+import '../elements/elements.dart';
+import '../js_backend/js_backend.dart';
+import '../native/behavior.dart' as native;
+import '../resolution/tree_elements.dart';
+import '../tree/nodes.dart' as ast;
+import '../types/constants.dart';
+import '../types/types.dart';
+import '../universe/call_structure.dart';
+import '../universe/selector.dart';
+import '../universe/side_effects.dart';
+import '../util/util.dart';
+import '../world.dart';
+import 'closure_tracer.dart';
+import 'debug.dart' as debug;
+import 'locals_handler.dart';
+import 'list_tracer.dart';
+import 'map_tracer.dart';
+import 'builder.dart';
+import 'type_graph_dump.dart';
+import 'type_graph_inferrer.dart';
+import 'type_graph_nodes.dart';
+import 'type_system.dart';
+
+/**
+ * An inferencing engine that computes a call graph of
+ * [TypeInformation] nodes by visiting the AST of the application, and
+ * then does the inferencing on the graph.
+ */
+class InferrerEngine {
+  final Map<Element, TypeInformation> defaultTypeOfParameter =
+      new Map<Element, TypeInformation>();
+  final List<CallSiteTypeInformation> allocatedCalls =
+      <CallSiteTypeInformation>[];
+  final WorkQueue workQueue = new WorkQueue();
+  final Element mainElement;
+  final Set<Element> analyzedElements = new Set<Element>();
+
+  /// The maximum number of times we allow a node in the graph to
+  /// change types. If a node reaches that limit, we give up
+  /// inferencing on it and give it the dynamic type.
+  final int MAX_CHANGE_COUNT = 6;
+
+  int overallRefineCount = 0;
+  int addedInGraph = 0;
+
+  final Compiler compiler;
+
+  /// The [ClosedWorld] on which inference reasoning is based.
+  final ClosedWorld closedWorld;
+
+  final ClosedWorldRefiner closedWorldRefiner;
+  final TypeSystem types;
+  final Map<ast.Node, TypeInformation> concreteTypes =
+      new Map<ast.Node, TypeInformation>();
+  final Set<Element> generativeConstructorsExposingThis = new Set<Element>();
+
+  /// Data computed internally within elements, like the type-mask of a send a
+  /// list allocation, or a for-in loop.
+  final Map<Element, GlobalTypeInferenceElementData> inTreeData =
+      new Map<Element, GlobalTypeInferenceElementData>();
+
+  InferrerEngine(this.compiler, ClosedWorld closedWorld,
+      this.closedWorldRefiner, this.mainElement)
+      : this.types = new TypeSystem(closedWorld),
+        this.closedWorld = closedWorld;
+
+  CommonElements get commonElements => closedWorld.commonElements;
+
+  /**
+   * Applies [f] to all elements in the universe that match
+   * [selector] and [mask]. If [f] returns false, aborts the iteration.
+   */
+  void forEachElementMatching(
+      Selector selector, TypeMask mask, bool f(Element element)) {
+    Iterable<Element> elements =
+        closedWorld.allFunctions.filter(selector, mask);
+    for (Element e in elements) {
+      if (!f(e.implementation)) return;
+    }
+  }
+
+  // TODO(johnniwinther): Make this private again.
+  GlobalTypeInferenceElementData dataOf(AstElement element) => inTreeData
+      .putIfAbsent(element, () => new GlobalTypeInferenceElementData());
+
+  /**
+   * Update [sideEffects] with the side effects of [callee] being
+   * called with [selector].
+   */
+  void updateSideEffects(
+      SideEffects sideEffects, Selector selector, Element callee) {
+    if (callee.isField) {
+      if (callee.isInstanceMember) {
+        if (selector.isSetter) {
+          sideEffects.setChangesInstanceProperty();
+        } else if (selector.isGetter) {
+          sideEffects.setDependsOnInstancePropertyStore();
+        } else {
+          sideEffects.setAllSideEffects();
+          sideEffects.setDependsOnSomething();
+        }
+      } else {
+        if (selector.isSetter) {
+          sideEffects.setChangesStaticProperty();
+        } else if (selector.isGetter) {
+          sideEffects.setDependsOnStaticPropertyStore();
+        } else {
+          sideEffects.setAllSideEffects();
+          sideEffects.setDependsOnSomething();
+        }
+      }
+    } else if (callee.isGetter && !selector.isGetter) {
+      sideEffects.setAllSideEffects();
+      sideEffects.setDependsOnSomething();
+    } else {
+      sideEffects.add(closedWorldRefiner.getCurrentlyKnownSideEffects(callee));
+    }
+  }
+
+  /**
+   * Returns the type for [nativeBehavior]. See documentation on
+   * [native.NativeBehavior].
+   */
+  TypeInformation typeOfNativeBehavior(native.NativeBehavior nativeBehavior) {
+    if (nativeBehavior == null) return types.dynamicType;
+    List typesReturned = nativeBehavior.typesReturned;
+    if (typesReturned.isEmpty) return types.dynamicType;
+    TypeInformation returnType;
+    for (var type in typesReturned) {
+      TypeInformation mappedType;
+      if (type == native.SpecialType.JsObject) {
+        mappedType = types.nonNullExact(commonElements.objectClass);
+      } else if (type == commonElements.stringType) {
+        mappedType = types.stringType;
+      } else if (type == commonElements.intType) {
+        mappedType = types.intType;
+      } else if (type == commonElements.numType ||
+          type == commonElements.doubleType) {
+        // Note: the backend double class is specifically for non-integer
+        // doubles, and a native behavior returning 'double' does not guarantee
+        // a non-integer return type, so we return the number type for those.
+        mappedType = types.numType;
+      } else if (type == commonElements.boolType) {
+        mappedType = types.boolType;
+      } else if (type == commonElements.nullType) {
+        mappedType = types.nullType;
+      } else if (type.isVoid) {
+        mappedType = types.nullType;
+      } else if (type.isDynamic) {
+        return types.dynamicType;
+      } else {
+        mappedType = types.nonNullSubtype(type.element);
+      }
+      returnType = types.computeLUB(returnType, mappedType);
+      if (returnType == types.dynamicType) {
+        break;
+      }
+    }
+    return returnType;
+  }
+
+  // TODO(johnniwinther): Pass the [ResolvedAst] instead of [owner].
+  void updateSelectorInTree(
+      AstElement owner, Spannable node, Selector selector, TypeMask mask) {
+    ast.Node astNode = node;
+    GlobalTypeInferenceElementData data = dataOf(owner);
+    if (astNode.asSendSet() != null) {
+      if (selector.isSetter || selector.isIndexSet) {
+        data.setTypeMask(node, mask);
+      } else if (selector.isGetter || selector.isIndex) {
+        data.setGetterTypeMaskInComplexSendSet(node, mask);
+      } else {
+        assert(selector.isOperator);
+        data.setOperatorTypeMaskInComplexSendSet(node, mask);
+      }
+    } else if (astNode.asSend() != null) {
+      data.setTypeMask(node, mask);
+    } else {
+      assert(astNode.asForIn() != null);
+      if (selector == Selectors.iterator) {
+        data.setIteratorTypeMask(node, mask);
+      } else if (selector == Selectors.current) {
+        data.setCurrentTypeMask(node, mask);
+      } else {
+        assert(selector == Selectors.moveNext);
+        data.setMoveNextTypeMask(node, mask);
+      }
+    }
+  }
+
+  bool isNativeElement(Element element) {
+    return compiler.backend.isNative(element);
+  }
+
+  bool checkIfExposesThis(Element element) {
+    element = element.implementation;
+    return generativeConstructorsExposingThis.contains(element);
+  }
+
+  void recordExposesThis(Element element, bool exposesThis) {
+    element = element.implementation;
+    if (exposesThis) {
+      generativeConstructorsExposingThis.add(element);
+    }
+  }
+
+  JavaScriptBackend get backend => compiler.backend;
+  Annotations get annotations => backend.annotations;
+  DiagnosticReporter get reporter => compiler.reporter;
+  CommonMasks get commonMasks => closedWorld.commonMasks;
+
+  /**
+   * A set of selector names that [List] implements, that we know return
+   * their element type.
+   */
+  final Set<Selector> returnsListElementTypeSet =
+      new Set<Selector>.from(<Selector>[
+    new Selector.getter(const PublicName('first')),
+    new Selector.getter(const PublicName('last')),
+    new Selector.getter(const PublicName('single')),
+    new Selector.call(const PublicName('singleWhere'), CallStructure.ONE_ARG),
+    new Selector.call(const PublicName('elementAt'), CallStructure.ONE_ARG),
+    new Selector.index(),
+    new Selector.call(const PublicName('removeAt'), CallStructure.ONE_ARG),
+    new Selector.call(const PublicName('removeLast'), CallStructure.NO_ARGS)
+  ]);
+
+  bool returnsListElementType(Selector selector, TypeMask mask) {
+    return mask != null &&
+        mask.isContainer &&
+        returnsListElementTypeSet.contains(selector);
+  }
+
+  bool returnsMapValueType(Selector selector, TypeMask mask) {
+    return mask != null && mask.isMap && selector.isIndex;
+  }
+
+  void analyzeListAndEnqueue(ListTypeInformation info) {
+    if (info.analyzed) return;
+    info.analyzed = true;
+
+    ListTracerVisitor tracer = new ListTracerVisitor(info, this);
+    bool succeeded = tracer.run();
+    if (!succeeded) return;
+
+    info.bailedOut = false;
+    info.elementType.inferred = true;
+    TypeMask fixedListType = commonMasks.fixedListType;
+    if (info.originalType.forwardTo == fixedListType) {
+      info.checksGrowable = tracer.callsGrowableMethod;
+    }
+    tracer.assignments.forEach(info.elementType.addAssignment);
+    // Enqueue the list for later refinement
+    workQueue.add(info);
+    workQueue.add(info.elementType);
+  }
+
+  void analyzeMapAndEnqueue(MapTypeInformation info) {
+    if (info.analyzed) return;
+    info.analyzed = true;
+    MapTracerVisitor tracer = new MapTracerVisitor(info, this);
+
+    bool succeeded = tracer.run();
+    if (!succeeded) return;
+
+    info.bailedOut = false;
+    for (int i = 0; i < tracer.keyAssignments.length; ++i) {
+      TypeInformation newType = info.addEntryAssignment(
+          tracer.keyAssignments[i], tracer.valueAssignments[i]);
+      if (newType != null) workQueue.add(newType);
+    }
+    for (TypeInformation map in tracer.mapAssignments) {
+      workQueue.addAll(info.addMapAssignment(map));
+    }
+
+    info.markAsInferred();
+    workQueue.add(info.keyType);
+    workQueue.add(info.valueType);
+    workQueue.addAll(info.typeInfoMap.values);
+    workQueue.add(info);
+  }
+
+  void runOverAllElements() {
+    if (compiler.disableTypeInference) return;
+    if (compiler.options.verbose) {
+      compiler.progress.reset();
+    }
+    sortResolvedAsts().forEach((ResolvedAst resolvedAst) {
+      if (compiler.shouldPrintProgress) {
+        reporter.log('Added $addedInGraph elements in inferencing graph.');
+        compiler.progress.reset();
+      }
+      // This also forces the creation of the [ElementTypeInformation] to ensure
+      // it is in the graph.
+      types.withMember(
+          resolvedAst.element.implementation, () => analyze(resolvedAst, null));
+    });
+    reporter.log('Added $addedInGraph elements in inferencing graph.');
+
+    TypeGraphDump dump = debug.PRINT_GRAPH ? new TypeGraphDump(this) : null;
+
+    dump?.beforeAnalysis();
+    buildWorkQueue();
+    refine();
+
+    // Try to infer element types of lists and compute their escape information.
+    types.allocatedLists.values.forEach((ListTypeInformation info) {
+      analyzeListAndEnqueue(info);
+    });
+
+    // Try to infer the key and value types for maps and compute the values'
+    // escape information.
+    types.allocatedMaps.values.forEach((MapTypeInformation info) {
+      analyzeMapAndEnqueue(info);
+    });
+
+    Set<FunctionElement> bailedOutOn = new Set<FunctionElement>();
+
+    // Trace closures to potentially infer argument types.
+    types.allocatedClosures.forEach((info) {
+      void trace(
+          Iterable<FunctionElement> elements, ClosureTracerVisitor tracer) {
+        tracer.run();
+        if (!tracer.continueAnalyzing) {
+          elements.forEach((FunctionElement e) {
+            closedWorldRefiner.registerMightBePassedToApply(e);
+            if (debug.VERBOSE) print("traced closure $e as ${true} (bail)");
+            e.functionSignature.forEachParameter((parameter) {
+              types
+                  .getInferredTypeOf(parameter)
+                  .giveUp(this, clearAssignments: false);
+            });
+          });
+          bailedOutOn.addAll(elements);
+          return;
+        }
+        elements
+            .where((e) => !bailedOutOn.contains(e))
+            .forEach((FunctionElement e) {
+          e.functionSignature.forEachParameter((parameter) {
+            var info = types.getInferredTypeOf(parameter);
+            info.maybeResume();
+            workQueue.add(info);
+          });
+          if (tracer.tracedType.mightBePassedToFunctionApply) {
+            closedWorldRefiner.registerMightBePassedToApply(e);
+          }
+          if (debug.VERBOSE) {
+            print("traced closure $e as "
+                "${closedWorldRefiner
+                .getCurrentlyKnownMightBePassedToApply(e)}");
+          }
+        });
+      }
+
+      if (info is ClosureTypeInformation) {
+        Iterable<FunctionElement> elements = [info.element];
+        trace(elements, new ClosureTracerVisitor(elements, info, this));
+      } else if (info is CallSiteTypeInformation) {
+        if (info is StaticCallSiteTypeInformation &&
+            info.selector != null &&
+            info.selector.isCall) {
+          // This is a constructor call to a class with a call method. So we
+          // need to trace the call method here.
+          assert(info.calledElement.isConstructor);
+          ClassElement cls = info.calledElement.enclosingClass;
+          FunctionElement callMethod = cls.lookupMember(Identifiers.call);
+          assert(invariant(cls, callMethod != null));
+          Iterable<FunctionElement> elements = [callMethod];
+          trace(elements, new ClosureTracerVisitor(elements, info, this));
+        } else {
+          // We only are interested in functions here, as other targets
+          // of this closure call are not a root to trace but an intermediate
+          // for some other function.
+          Iterable<FunctionElement> elements = new List<FunctionElement>.from(
+              info.callees.where((e) => e.isFunction));
+          trace(elements, new ClosureTracerVisitor(elements, info, this));
+        }
+      } else {
+        assert(info is ElementTypeInformation);
+        trace([info.element],
+            new StaticTearOffClosureTracerVisitor(info.element, info, this));
+      }
+    });
+
+    dump?.beforeTracing();
+
+    // Reset all nodes that use lists/maps that have been inferred, as well
+    // as nodes that use elements fetched from these lists/maps. The
+    // workset for a new run of the analysis will be these nodes.
+    Set<TypeInformation> seenTypes = new Set<TypeInformation>();
+    while (!workQueue.isEmpty) {
+      TypeInformation info = workQueue.remove();
+      if (seenTypes.contains(info)) continue;
+      // If the node cannot be reset, we do not need to update its users either.
+      if (!info.reset(this)) continue;
+      seenTypes.add(info);
+      workQueue.addAll(info.users);
+    }
+
+    workQueue.addAll(seenTypes);
+    refine();
+
+    if (debug.PRINT_SUMMARY) {
+      types.allocatedLists.values.forEach((ListTypeInformation info) {
+        print('${info.type} '
+            'for ${info.originalType.allocationNode} '
+            'at ${info.originalType.allocationElement} '
+            'after ${info.refineCount}');
+      });
+      types.allocatedMaps.values.forEach((MapTypeInformation info) {
+        print('${info.type} '
+            'for ${info.originalType.allocationNode} '
+            'at ${info.originalType.allocationElement} '
+            'after ${info.refineCount}');
+      });
+      types.allocatedClosures.forEach((TypeInformation info) {
+        if (info is ElementTypeInformation) {
+          print('${types.getInferredSignatureOf(info.element)} for '
+              '${info.element}');
+        } else if (info is ClosureTypeInformation) {
+          print('${types.getInferredSignatureOf(info.element)} for '
+              '${info.element}');
+        } else if (info is DynamicCallSiteTypeInformation) {
+          for (Element target in info.targets) {
+            if (target is FunctionElement) {
+              print('${types.getInferredSignatureOf(target)} for ${target}');
+            } else {
+              print('${types.getInferredTypeOf(target).type} for ${target}');
+            }
+          }
+        } else if (info is StaticCallSiteTypeInformation) {
+          ClassElement cls = info.calledElement.enclosingClass;
+          FunctionElement callMethod = cls.lookupMember(Identifiers.call);
+          print('${types.getInferredSignatureOf(callMethod)} for ${cls}');
+        } else {
+          print('${info.type} for some unknown kind of closure');
+        }
+      });
+      analyzedElements.forEach((Element elem) {
+        TypeInformation type = types.getInferredTypeOf(elem);
+        print('${elem} :: ${type} from ${type.assignments} ');
+      });
+    }
+    dump?.afterAnalysis();
+
+    reporter.log('Inferred $overallRefineCount types.');
+
+    processLoopInformation();
+  }
+
+  void analyze(ResolvedAst resolvedAst, ArgumentsTypes arguments) {
+    AstElement element = resolvedAst.element.implementation;
+    if (analyzedElements.contains(element)) return;
+    analyzedElements.add(element);
+
+    ElementGraphBuilder visitor =
+        new ElementGraphBuilder(element, resolvedAst, compiler, this);
+    TypeInformation type;
+    reporter.withCurrentElement(element, () {
+      type = visitor.run();
+    });
+    addedInGraph++;
+
+    if (element.isField) {
+      VariableElement fieldElement = element;
+      ast.Node node = resolvedAst.node;
+      ast.Node initializer = resolvedAst.body;
+      if (element.isFinal || element.isConst) {
+        // If [element] is final and has an initializer, we record
+        // the inferred type.
+        if (resolvedAst.body != null) {
+          if (type is! ListTypeInformation && type is! MapTypeInformation) {
+            // For non-container types, the constant handler does
+            // constant folding that could give more precise results.
+            ConstantExpression constant = fieldElement.constant;
+            if (constant != null) {
+              ConstantValue value =
+                  compiler.backend.constants.getConstantValue(constant);
+              if (value != null) {
+                if (value.isFunction) {
+                  FunctionConstantValue functionConstant = value;
+                  MethodElement function = functionConstant.element;
+                  type = types.allocateClosure(node, function);
+                } else {
+                  // Although we might find a better type, we have to keep
+                  // the old type around to ensure that we get a complete view
+                  // of the type graph and do not drop any flow edges.
+                  TypeMask refinedType = computeTypeMask(closedWorld, value);
+                  assert(TypeMask.assertIsNormalized(refinedType, closedWorld));
+                  type = new NarrowTypeInformation(type, refinedType);
+                  types.allocatedTypes.add(type);
+                }
+              } else {
+                assert(invariant(
+                    fieldElement,
+                    fieldElement.isInstanceMember ||
+                        constant.isImplicit ||
+                        constant.isPotential,
+                    message: "Constant expression without value: "
+                        "${constant.toStructuredText()}."));
+              }
+            }
+          }
+          recordType(element, type);
+        } else if (!element.isInstanceMember) {
+          recordType(element, types.nullType);
+        }
+      } else if (initializer == null) {
+        // Only update types of static fields if there is no
+        // assignment. Instance fields are dealt with in the constructor.
+        if (Elements.isStaticOrTopLevelField(element)) {
+          recordTypeOfNonFinalField(node, element, type);
+        }
+      } else {
+        recordTypeOfNonFinalField(node, element, type);
+      }
+      if (Elements.isStaticOrTopLevelField(element) &&
+          resolvedAst.body != null &&
+          !element.isConst) {
+        var argument = resolvedAst.body;
+        // TODO(13429): We could do better here by using the
+        // constant handler to figure out if it's a lazy field or not.
+        if (argument.asSend() != null ||
+            (argument.asNewExpression() != null && !argument.isConst)) {
+          recordType(element, types.nullType);
+        }
+      }
+    } else {
+      recordReturnType(element, type);
+    }
+  }
+
+  void processLoopInformation() {
+    allocatedCalls.forEach((info) {
+      if (!info.inLoop) return;
+      if (info is StaticCallSiteTypeInformation) {
+        closedWorldRefiner.addFunctionCalledInLoop(info.calledElement);
+      } else if (info.mask != null && !info.mask.containsAll(closedWorld)) {
+        // For instance methods, we only register a selector called in a
+        // loop if it is a typed selector, to avoid marking too many
+        // methods as being called from within a loop. This cuts down
+        // on the code bloat.
+        info.targets.forEach(closedWorldRefiner.addFunctionCalledInLoop);
+      }
+    });
+  }
+
+  void refine() {
+    while (!workQueue.isEmpty) {
+      if (compiler.shouldPrintProgress) {
+        reporter.log('Inferred $overallRefineCount types.');
+        compiler.progress.reset();
+      }
+      TypeInformation info = workQueue.remove();
+      TypeMask oldType = info.type;
+      TypeMask newType = info.refine(this);
+      // Check that refinement has not accidentially changed the type.
+      assert(oldType == info.type);
+      if (info.abandonInferencing) info.doNotEnqueue = true;
+      if ((info.type = newType) != oldType) {
+        overallRefineCount++;
+        info.refineCount++;
+        if (info.refineCount > MAX_CHANGE_COUNT) {
+          if (debug.ANOMALY_WARN) {
+            print("ANOMALY WARNING: max refinement reached for $info");
+          }
+          info.giveUp(this);
+          info.type = info.refine(this);
+          info.doNotEnqueue = true;
+        }
+        workQueue.addAll(info.users);
+        if (info.hasStableType(this)) {
+          info.stabilize(this);
+        }
+      }
+    }
+  }
+
+  void buildWorkQueue() {
+    workQueue.addAll(types.typeInformations.values);
+    workQueue.addAll(types.allocatedTypes);
+    workQueue.addAll(types.allocatedClosures);
+    workQueue.addAll(allocatedCalls);
+  }
+
+  /**
+   * Update the assignments to parameters in the graph. [remove] tells
+   * wheter assignments must be added or removed. If [init] is false,
+   * parameters are added to the work queue.
+   */
+  void updateParameterAssignments(TypeInformation caller, Element callee,
+      ArgumentsTypes arguments, Selector selector, TypeMask mask,
+      {bool remove, bool addToQueue: true}) {
+    if (callee.name == Identifiers.noSuchMethod_) return;
+    if (callee.isField) {
+      if (selector.isSetter) {
+        ElementTypeInformation info = types.getInferredTypeOf(callee);
+        if (remove) {
+          info.removeAssignment(arguments.positional[0]);
+        } else {
+          info.addAssignment(arguments.positional[0]);
+        }
+        if (addToQueue) workQueue.add(info);
+      }
+    } else if (callee.isGetter) {
+      return;
+    } else if (selector != null && selector.isGetter) {
+      // We are tearing a function off and thus create a closure.
+      assert(callee.isFunction);
+      MemberTypeInformation info = types.getInferredTypeOf(callee);
+      if (remove) {
+        info.closurizedCount--;
+      } else {
+        info.closurizedCount++;
+        if (Elements.isStaticOrTopLevel(callee)) {
+          types.allocatedClosures.add(info);
+        } else {
+          // We add the call-site type information here so that we
+          // can benefit from further refinement of the selector.
+          types.allocatedClosures.add(caller);
+        }
+        FunctionElement function = callee.implementation;
+        FunctionSignature signature = function.functionSignature;
+        signature.forEachParameter((Element parameter) {
+          ParameterTypeInformation info = types.getInferredTypeOf(parameter);
+          info.tagAsTearOffClosureParameter(this);
+          if (addToQueue) workQueue.add(info);
+        });
+      }
+    } else {
+      FunctionElement function = callee.implementation;
+      FunctionSignature signature = function.functionSignature;
+      int parameterIndex = 0;
+      bool visitingRequiredParameter = true;
+      signature.forEachParameter((Element parameter) {
+        if (signature.hasOptionalParameters &&
+            parameter == signature.optionalParameters.first) {
+          visitingRequiredParameter = false;
+        }
+        TypeInformation type = visitingRequiredParameter
+            ? arguments.positional[parameterIndex]
+            : signature.optionalParametersAreNamed
+                ? arguments.named[parameter.name]
+                : parameterIndex < arguments.positional.length
+                    ? arguments.positional[parameterIndex]
+                    : null;
+        if (type == null) type = getDefaultTypeOfParameter(parameter);
+        TypeInformation info = types.getInferredTypeOf(parameter);
+        if (remove) {
+          info.removeAssignment(type);
+        } else {
+          info.addAssignment(type);
+        }
+        parameterIndex++;
+        if (addToQueue) workQueue.add(info);
+      });
+    }
+  }
+
+  /**
+   * Sets the type of a parameter's default value to [type]. If the global
+   * mapping in [defaultTypeOfParameter] already contains a type, it must be
+   * a [PlaceholderTypeInformation], which will be replaced. All its uses are
+   * updated.
+   */
+  void setDefaultTypeOfParameter(
+      ParameterElement parameter, TypeInformation type) {
+    assert(parameter.functionDeclaration.isImplementation);
+    TypeInformation existing = defaultTypeOfParameter[parameter];
+    defaultTypeOfParameter[parameter] = type;
+    TypeInformation info = types.getInferredTypeOf(parameter);
+    if (existing != null && existing is PlaceholderTypeInformation) {
+      // Replace references to [existing] to use [type] instead.
+      if (parameter.functionDeclaration.isInstanceMember) {
+        ParameterAssignments assignments = info.assignments;
+        assignments.replace(existing, type);
+      } else {
+        List<TypeInformation> assignments = info.assignments;
+        for (int i = 0; i < assignments.length; i++) {
+          if (assignments[i] == existing) {
+            assignments[i] = type;
+          }
+        }
+      }
+      // Also forward all users.
+      type.addUsersOf(existing);
+    } else {
+      assert(existing == null);
+    }
+  }
+
+  /**
+   * Returns the [TypeInformation] node for the default value of a parameter.
+   * If this is queried before it is set by [setDefaultTypeOfParameter], a
+   * [PlaceholderTypeInformation] is returned, which will later be replaced
+   * by the actual node when [setDefaultTypeOfParameter] is called.
+   *
+   * Invariant: After graph construction, no [PlaceholderTypeInformation] nodes
+   *            should be present and a default type for each parameter should
+   *            exist.
+   */
+  TypeInformation getDefaultTypeOfParameter(Element parameter) {
+    return defaultTypeOfParameter.putIfAbsent(parameter, () {
+      return new PlaceholderTypeInformation(types.currentMember);
+    });
+  }
+
+  /**
+   * This helper breaks abstractions but is currently required to work around
+   * the wrong modeling of default values of optional parameters of
+   * synthetic constructors.
+   *
+   * TODO(johnniwinther): Remove once default values of synthetic parameters
+   * are fixed.
+   */
+  bool hasAlreadyComputedTypeOfParameterDefault(Element parameter) {
+    TypeInformation seen = defaultTypeOfParameter[parameter];
+    return (seen != null && seen is! PlaceholderTypeInformation);
+  }
+
+  /**
+   * Returns the type of [element].
+   */
+  TypeInformation typeOfElement(Element element) {
+    if (element is FunctionElement) return types.functionType;
+    return types.getInferredTypeOf(element);
+  }
+
+  /**
+   * Returns the return type of [element].
+   */
+  TypeInformation returnTypeOfElement(Element element) {
+    if (element is! FunctionElement) return types.dynamicType;
+    return types.getInferredTypeOf(element);
+  }
+
+  /**
+   * Records that [node] sets final field [element] to be of type [type].
+   *
+   * [nodeHolder] is the element holder of [node].
+   */
+  void recordTypeOfFinalField(
+      Spannable node, Element analyzed, Element element, TypeInformation type) {
+    types.getInferredTypeOf(element).addAssignment(type);
+  }
+
+  /**
+   * Records that [node] sets non-final field [element] to be of type
+   * [type].
+   */
+  void recordTypeOfNonFinalField(
+      Spannable node, Element element, TypeInformation type) {
+    types.getInferredTypeOf(element).addAssignment(type);
+  }
+
+  /**
+   * Records that [element] is of type [type].
+   */
+  void recordType(Element element, TypeInformation type) {
+    types.getInferredTypeOf(element).addAssignment(type);
+  }
+
+  /**
+   * Records that the return type [element] is of type [type].
+   */
+  void recordReturnType(Element element, TypeInformation type) {
+    TypeInformation info = types.getInferredTypeOf(element);
+    if (element.name == '==') {
+      // Even if x.== doesn't return a bool, 'x == null' evaluates to 'false'.
+      info.addAssignment(types.boolType);
+    }
+    // TODO(ngeoffray): Clean up. We do these checks because
+    // [SimpleTypesInferrer] deals with two different inferrers.
+    if (type == null) return;
+    if (info.assignments.isEmpty) info.addAssignment(type);
+  }
+
+  /**
+   * Notifies to the inferrer that [analyzedElement] can have return
+   * type [newType]. [currentType] is the type the [ElementGraphBuilder]
+   * currently found.
+   *
+   * Returns the new type for [analyzedElement].
+   */
+  TypeInformation addReturnTypeFor(
+      Element element, TypeInformation unused, TypeInformation newType) {
+    TypeInformation type = types.getInferredTypeOf(element);
+    // TODO(ngeoffray): Clean up. We do this check because
+    // [SimpleTypesInferrer] deals with two different inferrers.
+    if (element.isGenerativeConstructor) return type;
+    type.addAssignment(newType);
+    return type;
+  }
+
+  /**
+   * Registers that [caller] calls [callee] at location [node], with
+   * [selector], and [arguments]. Note that [selector] is null for
+   * forwarding constructors.
+   *
+   * [sideEffects] will be updated to incorporate [callee]'s side
+   * effects.
+   *
+   * [inLoop] tells whether the call happens in a loop.
+   */
+  TypeInformation registerCalledElement(
+      Spannable node,
+      Selector selector,
+      TypeMask mask,
+      Element caller,
+      Element callee,
+      ArgumentsTypes arguments,
+      SideEffects sideEffects,
+      bool inLoop) {
+    CallSiteTypeInformation info = new StaticCallSiteTypeInformation(
+        types.currentMember,
+        node,
+        caller,
+        callee,
+        selector,
+        mask,
+        arguments,
+        inLoop);
+    // If this class has a 'call' method then we have essentially created a
+    // closure here. Register it as such so that it is traced.
+    if (selector != null && selector.isCall && callee.isConstructor) {
+      ClassElement cls = callee.enclosingClass;
+      if (cls.callType != null) {
+        types.allocatedClosures.add(info);
+      }
+    }
+    info.addToGraph(this);
+    allocatedCalls.add(info);
+    updateSideEffects(sideEffects, selector, callee);
+    return info;
+  }
+
+  /**
+   * Registers that [caller] calls [selector] with [receiverType] as
+   * receiver, and [arguments].
+   *
+   * [sideEffects] will be updated to incorporate the potential
+   * callees' side effects.
+   *
+   * [inLoop] tells whether the call happens in a loop.
+   */
+  TypeInformation registerCalledSelector(
+      ast.Node node,
+      Selector selector,
+      TypeMask mask,
+      TypeInformation receiverType,
+      Element caller,
+      ArgumentsTypes arguments,
+      SideEffects sideEffects,
+      bool inLoop) {
+    if (selector.isClosureCall) {
+      return registerCalledClosure(node, selector, mask, receiverType, caller,
+          arguments, sideEffects, inLoop);
+    }
+
+    closedWorld.allFunctions.filter(selector, mask).forEach((callee) {
+      updateSideEffects(sideEffects, selector, callee);
+    });
+
+    CallSiteTypeInformation info = new DynamicCallSiteTypeInformation(
+        types.currentMember,
+        node,
+        caller,
+        selector,
+        mask,
+        receiverType,
+        arguments,
+        inLoop);
+
+    info.addToGraph(this);
+    allocatedCalls.add(info);
+    return info;
+  }
+
+  /**
+   * Registers a call to await with an expression of type [argumentType] as
+   * argument.
+   */
+  TypeInformation registerAwait(ast.Node node, TypeInformation argument) {
+    AwaitTypeInformation info =
+        new AwaitTypeInformation(types.currentMember, node);
+    info.addAssignment(argument);
+    types.allocatedTypes.add(info);
+    return info;
+  }
+
+  /**
+   * Registers that [caller] calls [closure] with [arguments].
+   *
+   * [sideEffects] will be updated to incorporate the potential
+   * callees' side effects.
+   *
+   * [inLoop] tells whether the call happens in a loop.
+   */
+  TypeInformation registerCalledClosure(
+      ast.Node node,
+      Selector selector,
+      TypeMask mask,
+      TypeInformation closure,
+      Element caller,
+      ArgumentsTypes arguments,
+      SideEffects sideEffects,
+      bool inLoop) {
+    sideEffects.setDependsOnSomething();
+    sideEffects.setAllSideEffects();
+    CallSiteTypeInformation info = new ClosureCallSiteTypeInformation(
+        types.currentMember,
+        node,
+        caller,
+        selector,
+        mask,
+        closure,
+        arguments,
+        inLoop);
+    info.addToGraph(this);
+    allocatedCalls.add(info);
+    return info;
+  }
+
+  // Sorts the resolved elements by size. We do this for this inferrer
+  // to get the same results for [ListTracer] compared to the
+  // [SimpleTypesInferrer].
+  Iterable<ResolvedAst> sortResolvedAsts() {
+    int max = 0;
+    Map<int, Setlet<ResolvedAst>> methodSizes = <int, Setlet<ResolvedAst>>{};
+    compiler.enqueuer.resolution.processedEntities
+        .forEach((AstElement element) {
+      ResolvedAst resolvedAst = element.resolvedAst;
+      element = element.implementation;
+      if (element.impliesType) return;
+      assert(invariant(
+          element,
+          element.isField ||
+              element.isFunction ||
+              element.isConstructor ||
+              element.isGetter ||
+              element.isSetter,
+          message: 'Unexpected element kind: ${element.kind}'));
+      if (element.isAbstract) return;
+      // Put the other operators in buckets by length, later to be added in
+      // length order.
+      int length = 0;
+      if (resolvedAst.kind == ResolvedAstKind.PARSED) {
+        TreeElementMapping mapping = resolvedAst.elements;
+        length = mapping.getSelectorCount();
+      }
+      max = length > max ? length : max;
+      Setlet<ResolvedAst> set =
+          methodSizes.putIfAbsent(length, () => new Setlet<ResolvedAst>());
+      set.add(resolvedAst);
+    });
+
+    List<ResolvedAst> result = <ResolvedAst>[];
+    for (int i = 0; i <= max; i++) {
+      Setlet<ResolvedAst> set = methodSizes[i];
+      if (set != null) result.addAll(set);
+    }
+    return result;
+  }
+
+  void clear() {
+    void cleanup(TypeInformation info) => info.cleanup();
+
+    allocatedCalls.forEach(cleanup);
+    allocatedCalls.clear();
+
+    defaultTypeOfParameter.clear();
+
+    types.typeInformations.values.forEach(cleanup);
+
+    types.allocatedTypes.forEach(cleanup);
+    types.allocatedTypes.clear();
+
+    types.concreteTypes.clear();
+
+    types.allocatedClosures.forEach(cleanup);
+    types.allocatedClosures.clear();
+
+    analyzedElements.clear();
+    generativeConstructorsExposingThis.clear();
+
+    types.allocatedMaps.values.forEach(cleanup);
+    types.allocatedLists.values.forEach(cleanup);
+  }
+
+  Iterable<Element> getCallersOf(Element element) {
+    if (compiler.disableTypeInference) {
+      throw new UnsupportedError(
+          "Cannot query the type inferrer when type inference is disabled.");
+    }
+    MemberTypeInformation info = types.getInferredTypeOf(element);
+    return info.callers;
+  }
+
+  /**
+   * Returns the type of [element] when being called with [selector].
+   */
+  TypeInformation typeOfElementWithSelector(
+      Element element, Selector selector) {
+    if (element.name == Identifiers.noSuchMethod_ &&
+        selector.name != element.name) {
+      // An invocation can resolve to a [noSuchMethod], in which case
+      // we get the return type of [noSuchMethod].
+      return returnTypeOfElement(element);
+    } else if (selector.isGetter) {
+      if (element.isFunction) {
+        // [functionType] is null if the inferrer did not run.
+        return types.functionType == null
+            ? types.dynamicType
+            : types.functionType;
+      } else if (element.isField) {
+        return typeOfElement(element);
+      } else if (Elements.isUnresolved(element)) {
+        return types.dynamicType;
+      } else {
+        assert(element.isGetter);
+        return returnTypeOfElement(element);
+      }
+    } else if (element.isGetter || element.isField) {
+      assert(selector.isCall || selector.isSetter);
+      return types.dynamicType;
+    } else {
+      return returnTypeOfElement(element);
+    }
+  }
+
+  /**
+   * Records that the captured variable [local] is read.
+   */
+  void recordCapturedLocalRead(Local local) {}
+
+  /**
+   * Records that the variable [local] is being updated.
+   */
+  void recordLocalUpdate(Local local, TypeInformation type) {}
+}
diff --git a/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart b/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart
deleted file mode 100644
index 7b913b0..0000000
--- a/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart
+++ /dev/null
@@ -1,1499 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library inferrer_visitor;
-
-import 'dart:collection' show IterableMixin;
-
-import '../common.dart';
-import '../compiler.dart' show Compiler;
-import '../constants/constant_system.dart';
-import '../constants/expressions.dart';
-import '../dart_types.dart';
-import '../elements/elements.dart';
-import '../resolution/operators.dart';
-import '../resolution/semantic_visitor.dart';
-import '../resolution/tree_elements.dart' show TreeElements;
-import '../tree/tree.dart';
-import '../types/constants.dart' show computeTypeMask;
-import '../types/types.dart' show TypeMask;
-import '../universe/call_structure.dart' show CallStructure;
-import '../universe/selector.dart' show Selector;
-import '../util/util.dart';
-import '../world.dart' show ClosedWorld;
-
-/**
- * The interface [InferrerVisitor] will use when working on types.
- */
-abstract class TypeSystem<T> {
-  T get dynamicType;
-  T get nullType;
-  T get intType;
-  T get uint31Type;
-  T get uint32Type;
-  T get positiveIntType;
-  T get doubleType;
-  T get numType;
-  T get boolType;
-  T get functionType;
-  T get listType;
-  T get constListType;
-  T get fixedListType;
-  T get growableListType;
-  T get mapType;
-  T get constMapType;
-  T get stringType;
-  T get typeType;
-  T get syncStarIterableType;
-  T get asyncFutureType; // Subtype of Future returned by async methods.
-  T get asyncStarStreamType;
-
-  T stringLiteralType(DartString value);
-  T boolLiteralType(LiteralBool value);
-
-  T nonNullSubtype(ClassElement type);
-  T nonNullSubclass(ClassElement type);
-  T nonNullExact(ClassElement type);
-  T nonNullEmpty();
-  bool isNull(T type);
-  TypeMask newTypedSelector(T receiver, TypeMask mask);
-
-  T allocateList(T type, Node node, Element enclosing,
-      [T elementType, int length]);
-
-  T allocateMap(T type, Node node, Element element,
-      [List<T> keyType, List<T> valueType]);
-
-  T allocateClosure(Node node, Element element);
-
-  /**
-   * Returns the least upper bound between [firstType] and
-   * [secondType].
-   */
-  T computeLUB(T firstType, T secondType);
-
-  /**
-   * Returns the intersection between [T] and [annotation].
-   * [isNullable] indicates whether the annotation implies a null
-   * type.
-   */
-  T narrowType(T type, DartType annotation, {bool isNullable: true});
-
-  /**
-   * Returns the non-nullable type [T].
-   */
-  T narrowNotNull(T type);
-
-  /**
-   * Returns a new type that unions [firstInput] and [secondInput].
-   */
-  T allocateDiamondPhi(T firstInput, T secondInput);
-
-  /**
-   * Returns a new type for holding the potential types of [element].
-   * [inputType] is the first incoming type of the phi.
-   */
-  T allocatePhi(Node node, Local variable, T inputType);
-
-  /**
-   * Returns a new type for holding the potential types of [element].
-   * [inputType] is the first incoming type of the phi. [allocateLoopPhi]
-   * only differs from [allocatePhi] in that it allows the underlying
-   * implementation of [TypeSystem] to differentiate Phi nodes due to loops
-   * from other merging uses.
-   */
-  T allocateLoopPhi(Node node, Local variable, T inputType);
-
-  /**
-   * Simplies the phi representing [element] and of the type
-   * [phiType]. For example, if this phi has one incoming input, an
-   * implementation of this method could just return that incoming
-   * input type.
-   */
-  T simplifyPhi(Node node, Local variable, T phiType);
-
-  /**
-   * Adds [newType] as an input of [phiType].
-   */
-  T addPhiInput(Local variable, T phiType, T newType);
-
-  /**
-   * Returns `true` if `selector` should be updated to reflect the new
-   * `receiverType`.
-   */
-  bool selectorNeedsUpdate(T receiverType, TypeMask mask);
-
-  /**
-   * Returns a new receiver type for this [selector] applied to
-   * [receiverType].
-   *
-   * The option [isConditional] is true when [selector] was seen in a
-   * conditional send (e.g.  `a?.selector`), in which case the returned type may
-   * be null.
-   */
-  T refineReceiver(
-      Selector selector, TypeMask mask, T receiverType, bool isConditional);
-
-  /**
-   * Returns the internal inferrer representation for [mask].
-   */
-  T getConcreteTypeFor(TypeMask mask);
-}
-
-/**
- * A variable scope holds types for variables. It has a link to a
- * parent scope, but never changes the types in that parent. Instead,
- * updates to locals of a parent scope are put in the current scope.
- * The inferrer makes sure updates get merged into the parent scope,
- * once the control flow block has been visited.
- */
-class VariableScope<T> {
-  Map<Local, T> variables;
-
-  /// The parent of this scope. Null for the root scope.
-  final VariableScope<T> parent;
-
-  /// The [Node] that created this scope.
-  final Node block;
-
-  VariableScope(this.block, [parent])
-      : this.variables = null,
-        this.parent = parent;
-
-  VariableScope.deepCopyOf(VariableScope<T> other)
-      : variables = other.variables == null
-            ? null
-            : new Map<Local, T>.from(other.variables),
-        block = other.block,
-        parent = other.parent == null
-            ? null
-            : new VariableScope<T>.deepCopyOf(other.parent);
-
-  VariableScope.topLevelCopyOf(VariableScope<T> other)
-      : variables = other.variables == null
-            ? null
-            : new Map<Local, T>.from(other.variables),
-        block = other.block,
-        parent = other.parent;
-
-  T operator [](Local variable) {
-    T result;
-    if (variables == null || (result = variables[variable]) == null) {
-      return parent == null ? null : parent[variable];
-    }
-    return result;
-  }
-
-  void operator []=(Local variable, T mask) {
-    assert(mask != null);
-    if (variables == null) {
-      variables = new Map<Local, T>();
-    }
-    variables[variable] = mask;
-  }
-
-  void forEachOwnLocal(void f(Local variable, T type)) {
-    if (variables == null) return;
-    variables.forEach(f);
-  }
-
-  void forEachLocalUntilNode(Node node, void f(Local variable, T type),
-      [Setlet<Local> seenLocals]) {
-    if (seenLocals == null) seenLocals = new Setlet<Local>();
-    if (variables != null) {
-      variables.forEach((variable, type) {
-        if (seenLocals.contains(variable)) return;
-        seenLocals.add(variable);
-        f(variable, type);
-      });
-    }
-    if (block == node) return;
-    if (parent != null) parent.forEachLocalUntilNode(node, f, seenLocals);
-  }
-
-  void forEachLocal(void f(Local variable, T type)) {
-    forEachLocalUntilNode(null, f);
-  }
-
-  bool updates(Local variable) {
-    if (variables == null) return false;
-    return variables.containsKey(variable);
-  }
-
-  String toString() {
-    String rest = parent == null ? "null" : parent.toString();
-    return '$variables $rest';
-  }
-}
-
-class FieldInitializationScope<T> {
-  final TypeSystem<T> types;
-  Map<Element, T> fields;
-  bool isThisExposed;
-
-  FieldInitializationScope(this.types) : isThisExposed = false;
-
-  FieldInitializationScope.internalFrom(FieldInitializationScope<T> other)
-      : types = other.types,
-        isThisExposed = other.isThisExposed;
-
-  factory FieldInitializationScope.from(FieldInitializationScope<T> other) {
-    if (other == null) return null;
-    return new FieldInitializationScope<T>.internalFrom(other);
-  }
-
-  void updateField(Element field, T type) {
-    if (isThisExposed) return;
-    if (fields == null) fields = new Map<Element, T>();
-    fields[field] = type;
-  }
-
-  T readField(Element field) {
-    return fields == null ? null : fields[field];
-  }
-
-  void forEach(void f(Element element, T type)) {
-    if (fields == null) return;
-    fields.forEach(f);
-  }
-
-  void mergeDiamondFlow(FieldInitializationScope<T> thenScope,
-      FieldInitializationScope<T> elseScope) {
-    // Quick bailout check. If [isThisExposed] is true, we know the
-    // code following won't do anything.
-    if (isThisExposed) return;
-    if (elseScope == null || elseScope.fields == null) {
-      elseScope = this;
-    }
-
-    thenScope.forEach((Element field, T type) {
-      T otherType = elseScope.readField(field);
-      if (otherType == null) return;
-      updateField(field, types.allocateDiamondPhi(type, otherType));
-    });
-    isThisExposed = thenScope.isThisExposed || elseScope.isThisExposed;
-  }
-}
-
-/**
- * Placeholder for inferred arguments types on sends.
- */
-class ArgumentsTypes<T> extends IterableMixin<T> {
-  final List<T> positional;
-  final Map<String, T> named;
-  ArgumentsTypes(this.positional, named)
-      : this.named = (named == null || named.isEmpty) ? const {} : named {
-    assert(this.positional.every((T type) => type != null));
-    assert(this.named.values.every((T type) => type != null));
-  }
-
-  ArgumentsTypes.empty()
-      : positional = const [],
-        named = const {};
-
-  int get length => positional.length + named.length;
-
-  Iterator<T> get iterator => new ArgumentsTypesIterator(this);
-
-  String toString() => "{ positional = $positional, named = $named }";
-
-  bool operator ==(other) {
-    if (positional.length != other.positional.length) return false;
-    if (named.length != other.named.length) return false;
-    for (int i = 0; i < positional.length; i++) {
-      if (positional[i] != other.positional[i]) return false;
-    }
-    named.forEach((name, type) {
-      if (other.named[name] != type) return false;
-    });
-    return true;
-  }
-
-  int get hashCode => throw new UnsupportedError('ArgumentsTypes.hashCode');
-
-  bool hasNoArguments() => positional.isEmpty && named.isEmpty;
-
-  void forEach(void f(T type)) {
-    positional.forEach(f);
-    named.values.forEach(f);
-  }
-
-  bool every(bool f(T type)) {
-    return positional.every(f) && named.values.every(f);
-  }
-
-  bool contains(T type) {
-    return positional.contains(type) || named.containsValue(type);
-  }
-}
-
-class ArgumentsTypesIterator<T> implements Iterator<T> {
-  final Iterator<T> positional;
-  final Iterator<T> named;
-  bool _iteratePositional = true;
-
-  ArgumentsTypesIterator(ArgumentsTypes<T> iteratee)
-      : positional = iteratee.positional.iterator,
-        named = iteratee.named.values.iterator;
-
-  Iterator<T> get _currentIterator => _iteratePositional ? positional : named;
-
-  T get current => _currentIterator.current;
-
-  bool moveNext() {
-    if (_iteratePositional && positional.moveNext()) {
-      return true;
-    }
-    _iteratePositional = false;
-    return named.moveNext();
-  }
-}
-
-abstract class MinimalInferrerEngine<T> {
-  /**
-   * Returns the type of [element].
-   */
-  T typeOfElement(Element element);
-
-  /**
-   * Records that [node] sets non-final field [element] to be of type
-   * [type].
-   */
-  void recordTypeOfNonFinalField(Node node, Element field, T type);
-
-  /**
-   * Records that the captured variable [local] is read.
-   */
-  void recordCapturedLocalRead(Local local);
-
-  /**
-   * Records that the variable [local] is being updated.
-   */
-  void recordLocalUpdate(Local local, T type);
-}
-
-/**
- * Placeholder for inferred types of local variables.
- */
-class LocalsHandler<T> {
-  final Compiler compiler;
-  final TypeSystem<T> types;
-  final MinimalInferrerEngine<T> inferrer;
-  final VariableScope<T> locals;
-  final Map<Local, Element> captured;
-  final Map<Local, Element> capturedAndBoxed;
-  final FieldInitializationScope<T> fieldScope;
-  LocalsHandler<T> tryBlock;
-  bool seenReturnOrThrow = false;
-  bool seenBreakOrContinue = false;
-
-  bool get aborts {
-    return seenReturnOrThrow || seenBreakOrContinue;
-  }
-
-  bool get inTryBlock => tryBlock != null;
-
-  LocalsHandler(this.inferrer, this.types, this.compiler, Node block,
-      [this.fieldScope])
-      : locals = new VariableScope<T>(block),
-        captured = new Map<Local, Element>(),
-        capturedAndBoxed = new Map<Local, Element>(),
-        tryBlock = null;
-
-  LocalsHandler.from(LocalsHandler<T> other, Node block,
-      {bool useOtherTryBlock: true})
-      : locals = new VariableScope<T>(block, other.locals),
-        fieldScope = new FieldInitializationScope<T>.from(other.fieldScope),
-        captured = other.captured,
-        capturedAndBoxed = other.capturedAndBoxed,
-        types = other.types,
-        inferrer = other.inferrer,
-        compiler = other.compiler {
-    tryBlock = useOtherTryBlock ? other.tryBlock : this;
-  }
-
-  LocalsHandler.deepCopyOf(LocalsHandler<T> other)
-      : locals = new VariableScope<T>.deepCopyOf(other.locals),
-        fieldScope = new FieldInitializationScope<T>.from(other.fieldScope),
-        captured = other.captured,
-        capturedAndBoxed = other.capturedAndBoxed,
-        tryBlock = other.tryBlock,
-        types = other.types,
-        inferrer = other.inferrer,
-        compiler = other.compiler;
-
-  LocalsHandler.topLevelCopyOf(LocalsHandler<T> other)
-      : locals = new VariableScope<T>.topLevelCopyOf(other.locals),
-        fieldScope = new FieldInitializationScope<T>.from(other.fieldScope),
-        captured = other.captured,
-        capturedAndBoxed = other.capturedAndBoxed,
-        tryBlock = other.tryBlock,
-        types = other.types,
-        inferrer = other.inferrer,
-        compiler = other.compiler;
-
-  T use(Local local) {
-    if (capturedAndBoxed.containsKey(local)) {
-      return inferrer.typeOfElement(capturedAndBoxed[local]);
-    } else {
-      if (captured.containsKey(local)) {
-        inferrer.recordCapturedLocalRead(local);
-      }
-      return locals[local];
-    }
-  }
-
-  void update(LocalElement local, T type, Node node) {
-    assert(type != null);
-    if (compiler.options.trustTypeAnnotations ||
-        compiler.options.enableTypeAssertions) {
-      type = types.narrowType(type, local.type);
-    }
-    updateLocal() {
-      T currentType = locals[local];
-
-      SendSet send = node != null ? node.asSendSet() : null;
-      if (send != null && send.isIfNullAssignment && currentType != null) {
-        // If-null assignments may return either the new or the original value
-        // narrowed to non-null.
-        type = types.addPhiInput(
-            local,
-            types.allocatePhi(
-                locals.block, local, types.narrowNotNull(currentType)),
-            type);
-      }
-      locals[local] = type;
-      if (currentType != type) {
-        inferrer.recordLocalUpdate(local, type);
-      }
-    }
-
-    if (capturedAndBoxed.containsKey(local)) {
-      inferrer.recordTypeOfNonFinalField(node, capturedAndBoxed[local], type);
-    } else if (inTryBlock) {
-      // We don't know if an assignment in a try block
-      // will be executed, so all assigments in that block are
-      // potential types after we have left it. We update the parent
-      // of the try block so that, at exit of the try block, we get
-      // the right phi for it.
-      T existing = tryBlock.locals.parent[local];
-      if (existing != null) {
-        T phiType = types.allocatePhi(tryBlock.locals.block, local, existing);
-        T inputType = types.addPhiInput(local, phiType, type);
-        tryBlock.locals.parent[local] = inputType;
-      }
-      // Update the current handler unconditionnally with the new
-      // type.
-      updateLocal();
-    } else {
-      updateLocal();
-    }
-  }
-
-  void setCaptured(Local local, Element field) {
-    captured[local] = field;
-  }
-
-  void setCapturedAndBoxed(Local local, Element field) {
-    capturedAndBoxed[local] = field;
-  }
-
-  void mergeDiamondFlow(
-      LocalsHandler<T> thenBranch, LocalsHandler<T> elseBranch) {
-    if (fieldScope != null && elseBranch != null) {
-      fieldScope.mergeDiamondFlow(thenBranch.fieldScope, elseBranch.fieldScope);
-    }
-    seenReturnOrThrow = thenBranch.seenReturnOrThrow &&
-        elseBranch != null &&
-        elseBranch.seenReturnOrThrow;
-    seenBreakOrContinue = thenBranch.seenBreakOrContinue &&
-        elseBranch != null &&
-        elseBranch.seenBreakOrContinue;
-    if (aborts) return;
-
-    void mergeOneBranch(LocalsHandler<T> other) {
-      other.locals.forEachOwnLocal((Local local, T type) {
-        T myType = locals[local];
-        if (myType == null) return; // Variable is only defined in [other].
-        if (type == myType) return;
-        locals[local] = types.allocateDiamondPhi(myType, type);
-      });
-    }
-
-    void inPlaceUpdateOneBranch(LocalsHandler<T> other) {
-      other.locals.forEachOwnLocal((Local local, T type) {
-        T myType = locals[local];
-        if (myType == null) return; // Variable is only defined in [other].
-        if (type == myType) return;
-        locals[local] = type;
-      });
-    }
-
-    if (thenBranch.aborts) {
-      if (elseBranch == null) return;
-      inPlaceUpdateOneBranch(elseBranch);
-    } else if (elseBranch == null) {
-      mergeOneBranch(thenBranch);
-    } else if (elseBranch.aborts) {
-      inPlaceUpdateOneBranch(thenBranch);
-    } else {
-      void mergeLocal(Local local) {
-        T myType = locals[local];
-        if (myType == null) return;
-        T elseType = elseBranch.locals[local];
-        T thenType = thenBranch.locals[local];
-        if (thenType == elseType) {
-          locals[local] = thenType;
-        } else {
-          locals[local] = types.allocateDiamondPhi(thenType, elseType);
-        }
-      }
-
-      thenBranch.locals.forEachOwnLocal((Local local, _) {
-        mergeLocal(local);
-      });
-      elseBranch.locals.forEachOwnLocal((Local local, _) {
-        // Discard locals we already processed when iterating over
-        // [thenBranch]'s locals.
-        if (!thenBranch.locals.updates(local)) mergeLocal(local);
-      });
-    }
-  }
-
-  /**
-   * Merge all [LocalsHandler] in [handlers] into [:this:].
-   *
-   * If [keepOwnLocals] is true, the types of locals in this
-   * [LocalsHandler] are being used in the merge. [keepOwnLocals]
-   * should be true if this [LocalsHandler], the dominator of
-   * all [handlers], also direclty flows into the join point,
-   * that is the code after all [handlers]. For example, consider:
-   *
-   * [: switch (...) {
-   *      case 1: ...; break;
-   *    }
-   * :]
-   *
-   * The [LocalsHandler] at entry of the switch also flows into the
-   * exit of the switch, because there is no default case. So the
-   * types of locals at entry of the switch have to take part to the
-   * merge.
-   *
-   * The above situation is also true for labeled statements like
-   *
-   * [: L: {
-   *      if (...) break;
-   *      ...
-   *    }
-   * :]
-   *
-   * where [:this:] is the [LocalsHandler] for the paths through the
-   * labeled statement that do not break out.
-   */
-  void mergeAfterBreaks(List<LocalsHandler<T>> handlers,
-      {bool keepOwnLocals: true}) {
-    Node level = locals.block;
-    // Use a separate locals handler to perform the merge in, so that Phi
-    // creation does not invalidate previous type knowledge while we might
-    // still look it up.
-    LocalsHandler merged = new LocalsHandler.from(this, level);
-    Set<Local> seenLocals = new Setlet<Local>();
-    bool allBranchesAbort = true;
-    // Merge all other handlers.
-    for (LocalsHandler handler in handlers) {
-      allBranchesAbort = allBranchesAbort && handler.seenReturnOrThrow;
-      merged.mergeHandler(handler, seenLocals);
-    }
-    // If we want to keep own locals, we merge [seenLocals] from [this] into
-    // [merged] to update the Phi nodes with original values.
-    if (keepOwnLocals && !seenReturnOrThrow) {
-      for (Local variable in seenLocals) {
-        T originalType = locals[variable];
-        if (originalType != null) {
-          merged.locals[variable] = types.addPhiInput(
-              variable, merged.locals[variable], originalType);
-        }
-      }
-    }
-    // Clean up Phi nodes with single input and store back result into
-    // actual locals handler.
-    merged.locals.forEachOwnLocal((Local variable, T type) {
-      locals[variable] = types.simplifyPhi(level, variable, type);
-    });
-    seenReturnOrThrow =
-        allBranchesAbort && (!keepOwnLocals || seenReturnOrThrow);
-  }
-
-  /**
-   * Merge [other] into this handler. Returns whether a local in this
-   * has changed. If [seen] is not null, we allocate new Phi nodes
-   * unless the local is already present in the set [seen]. This effectively
-   * overwrites the current type knowledge in this handler.
-   */
-  bool mergeHandler(LocalsHandler<T> other, [Set<Local> seen]) {
-    if (other.seenReturnOrThrow) return false;
-    bool changed = false;
-    other.locals.forEachLocalUntilNode(locals.block, (local, otherType) {
-      T myType = locals[local];
-      if (myType == null) return;
-      T newType;
-      if (seen != null && !seen.contains(local)) {
-        newType = types.allocatePhi(locals.block, local, otherType);
-        seen.add(local);
-      } else {
-        newType = types.addPhiInput(local, myType, otherType);
-      }
-      if (newType != myType) {
-        changed = true;
-        locals[local] = newType;
-      }
-    });
-    return changed;
-  }
-
-  /**
-   * Merge all [LocalsHandler] in [handlers] into this handler.
-   * Returns whether a local in this handler has changed.
-   */
-  bool mergeAll(List<LocalsHandler<T>> handlers) {
-    bool changed = false;
-    assert(!seenReturnOrThrow);
-    handlers.forEach((other) {
-      changed = mergeHandler(other) || changed;
-    });
-    return changed;
-  }
-
-  void startLoop(Node loop) {
-    locals.forEachLocal((Local variable, T type) {
-      T newType = types.allocateLoopPhi(loop, variable, type);
-      if (newType != type) {
-        locals[variable] = newType;
-      }
-    });
-  }
-
-  void endLoop(Node loop) {
-    locals.forEachLocal((Local variable, T type) {
-      T newType = types.simplifyPhi(loop, variable, type);
-      if (newType != type) {
-        locals[variable] = newType;
-      }
-    });
-  }
-
-  void updateField(Element element, T type) {
-    fieldScope.updateField(element, type);
-  }
-}
-
-abstract class InferrerVisitor<T, E extends MinimalInferrerEngine<T>>
-    extends Visitor<T>
-    with
-        SemanticSendResolvedMixin<T, dynamic>,
-        CompoundBulkMixin<T, dynamic>,
-        SetIfNullBulkMixin<T, dynamic>,
-        PrefixBulkMixin<T, dynamic>,
-        PostfixBulkMixin<T, dynamic>,
-        ErrorBulkMixin<T, dynamic>,
-        NewBulkMixin<T, dynamic>,
-        SetBulkMixin<T, dynamic>
-    implements SemanticSendVisitor<T, dynamic> {
-  final Compiler compiler;
-  final AstElement analyzedElement;
-  final ResolvedAst resolvedAst;
-  final TypeSystem<T> types;
-  final E inferrer;
-  final Map<JumpTarget, List<LocalsHandler<T>>> breaksFor =
-      new Map<JumpTarget, List<LocalsHandler<T>>>();
-  final Map<JumpTarget, List<LocalsHandler>> continuesFor =
-      new Map<JumpTarget, List<LocalsHandler<T>>>();
-  LocalsHandler<T> locals;
-  final List<T> cascadeReceiverStack = new List<T>();
-
-  TreeElements get elements => resolvedAst.elements;
-
-  bool accumulateIsChecks = false;
-  bool conditionIsSimple = false;
-  List<Send> isChecks;
-  int loopLevel = 0;
-
-  bool get inLoop => loopLevel > 0;
-  bool get isThisExposed {
-    return analyzedElement.isGenerativeConstructor
-        ? locals.fieldScope.isThisExposed
-        : true;
-  }
-
-  void set isThisExposed(value) {
-    if (analyzedElement.isGenerativeConstructor) {
-      locals.fieldScope.isThisExposed = value;
-    }
-  }
-
-  InferrerVisitor(AstElement analyzedElement, this.resolvedAst, this.inferrer,
-      this.types, this.compiler,
-      [LocalsHandler<T> handler])
-      : this.analyzedElement = analyzedElement,
-        this.locals = handler {
-    if (handler != null) return;
-    Node node;
-    if (resolvedAst.kind == ResolvedAstKind.PARSED) {
-      node = resolvedAst.node;
-    }
-    FieldInitializationScope<T> fieldScope =
-        analyzedElement.isGenerativeConstructor
-            ? new FieldInitializationScope<T>(types)
-            : null;
-    locals = new LocalsHandler<T>(inferrer, types, compiler, node, fieldScope);
-  }
-
-  DiagnosticReporter get reporter => compiler.reporter;
-
-  @override
-  SemanticSendVisitor get sendVisitor => this;
-
-  @override
-  T apply(Node node, _) => visit(node);
-
-  T handleSendSet(SendSet node);
-
-  T handleDynamicInvoke(Send node);
-
-  T visitAssert(Assert node) {
-    // Avoid pollution from assert statement unless enabled.
-    if (!compiler.options.enableUserAssertions) {
-      return null;
-    }
-    List<Send> tests = <Send>[];
-    bool simpleCondition = handleCondition(node.condition, tests);
-    LocalsHandler<T> saved = locals;
-    locals = new LocalsHandler<T>.from(locals, node);
-    updateIsChecks(tests, usePositive: true);
-
-    LocalsHandler<T> thenLocals = locals;
-    locals = new LocalsHandler<T>.from(saved, node);
-    if (simpleCondition) updateIsChecks(tests, usePositive: false);
-    visit(node.message);
-    locals.seenReturnOrThrow = true;
-    saved.mergeDiamondFlow(thenLocals, locals);
-    locals = saved;
-    return null;
-  }
-
-  T visitAsyncForIn(AsyncForIn node);
-
-  T visitSyncForIn(SyncForIn node);
-
-  T visitReturn(Return node);
-
-  T visitFunctionExpression(FunctionExpression node);
-
-  @override
-  T bulkHandleSet(SendSet node, _) {
-    return handleSendSet(node);
-  }
-
-  @override
-  T bulkHandleCompound(SendSet node, _) {
-    return handleSendSet(node);
-  }
-
-  @override
-  T bulkHandleSetIfNull(SendSet node, _) {
-    return handleSendSet(node);
-  }
-
-  @override
-  T bulkHandlePrefix(SendSet node, _) {
-    return handleSendSet(node);
-  }
-
-  @override
-  T bulkHandlePostfix(SendSet node, _) {
-    return handleSendSet(node);
-  }
-
-  @override
-  T bulkHandleError(Node node, ErroneousElement error, _) {
-    return types.dynamicType;
-  }
-
-  T visitNode(Node node) {
-    return node.visitChildren(this);
-  }
-
-  T visit(Node node) {
-    return node == null ? null : node.accept(this);
-  }
-
-  T visitFunctionDeclaration(FunctionDeclaration node) {
-    locals.update(elements[node], types.functionType, node);
-    return visit(node.function);
-  }
-
-  T visitLiteralString(LiteralString node) {
-    return types.stringLiteralType(node.dartString);
-  }
-
-  T visitStringInterpolation(StringInterpolation node) {
-    node.visitChildren(this);
-    return types.stringType;
-  }
-
-  T visitStringJuxtaposition(StringJuxtaposition node) {
-    node.visitChildren(this);
-    return types.stringType;
-  }
-
-  T visitLiteralBool(LiteralBool node) {
-    return types.boolLiteralType(node);
-  }
-
-  T visitLiteralDouble(LiteralDouble node) {
-    ConstantSystem constantSystem = compiler.backend.constantSystem;
-    // The JavaScript backend may turn this literal into an integer at
-    // runtime.
-    return types.getConcreteTypeFor(
-        computeTypeMask(compiler, constantSystem.createDouble(node.value)));
-  }
-
-  T visitLiteralInt(LiteralInt node) {
-    ConstantSystem constantSystem = compiler.backend.constantSystem;
-    // The JavaScript backend may turn this literal into a double at
-    // runtime.
-    return types.getConcreteTypeFor(
-        computeTypeMask(compiler, constantSystem.createInt(node.value)));
-  }
-
-  T visitLiteralList(LiteralList node) {
-    node.visitChildren(this);
-    return node.isConst ? types.constListType : types.growableListType;
-  }
-
-  T visitLiteralMap(LiteralMap node) {
-    node.visitChildren(this);
-    return node.isConst ? types.constMapType : types.mapType;
-  }
-
-  T visitLiteralNull(LiteralNull node) {
-    return types.nullType;
-  }
-
-  T visitLiteralSymbol(LiteralSymbol node) {
-    // TODO(kasperl): We should be able to tell that the type of a literal
-    // symbol is always a non-null exact symbol implementation -- not just
-    // any non-null subtype of the symbol interface.
-    return types.nonNullSubtype(compiler.coreClasses.symbolClass);
-  }
-
-  @override
-  void previsitDeferredAccess(Send node, PrefixElement prefix, _) {
-    // Deferred access does not affect inference.
-  }
-
-  T handleTypeLiteralGet() {
-    return types.typeType;
-  }
-
-  T handleTypeLiteralInvoke(NodeList arguments) {
-    return types.dynamicType;
-  }
-
-  @override
-  T bulkHandleNode(Node node, String message, _) {
-    return internalError(node, message.replaceAll('#', '$node'));
-  }
-
-  @override
-  T visitConstantGet(Send node, ConstantExpression constant, _) {
-    return bulkHandleNode(node, "Constant read `#` unhandled.", _);
-  }
-
-  @override
-  T visitConstantInvoke(Send node, ConstantExpression constant,
-      NodeList arguments, CallStructure callStructure, _) {
-    return bulkHandleNode(node, "Constant invoke `#` unhandled.", _);
-  }
-
-  T visitClassTypeLiteralGet(Send node, ConstantExpression constant, _) {
-    return handleTypeLiteralGet();
-  }
-
-  T visitClassTypeLiteralInvoke(Send node, ConstantExpression constant,
-      NodeList arguments, CallStructure callStructure, _) {
-    return handleTypeLiteralInvoke(arguments);
-  }
-
-  T visitTypedefTypeLiteralGet(Send node, ConstantExpression constant, _) {
-    return handleTypeLiteralGet();
-  }
-
-  T visitTypedefTypeLiteralInvoke(Send node, ConstantExpression constant,
-      NodeList arguments, CallStructure callStructure, _) {
-    return handleTypeLiteralInvoke(arguments);
-  }
-
-  T visitTypeVariableTypeLiteralGet(Send node, TypeVariableElement element, _) {
-    return handleTypeLiteralGet();
-  }
-
-  T visitTypeVariableTypeLiteralInvoke(Send node, TypeVariableElement element,
-      NodeList arguments, CallStructure callStructure, _) {
-    return handleTypeLiteralInvoke(arguments);
-  }
-
-  T visitDynamicTypeLiteralGet(Send node, ConstantExpression constant, _) {
-    return handleTypeLiteralGet();
-  }
-
-  T visitDynamicTypeLiteralInvoke(Send node, ConstantExpression constant,
-      NodeList arguments, CallStructure callStructure, _) {
-    return handleTypeLiteralInvoke(arguments);
-  }
-
-  bool isThisOrSuper(Node node) => node.isThis() || node.isSuper();
-
-  Element get outermostElement {
-    return analyzedElement.outermostEnclosingMemberOrTopLevel.implementation;
-  }
-
-  T _thisType;
-  T get thisType {
-    if (_thisType != null) return _thisType;
-    ClassElement cls = outermostElement.enclosingClass;
-    ClosedWorld closedWorld = compiler.closedWorld;
-    if (closedWorld.isUsedAsMixin(cls)) {
-      return _thisType = types.nonNullSubtype(cls);
-    } else {
-      return _thisType = types.nonNullSubclass(cls);
-    }
-  }
-
-  @override
-  T visitThisGet(Identifier node, _) {
-    return thisType;
-  }
-
-  T visitIdentifier(Identifier node) {
-    if (node.isThis()) {
-      return thisType;
-    } else if (node.isSuper()) {
-      return internalError(node, 'Unexpected expression $node.');
-    } else {
-      Element element = elements[node];
-      if (Elements.isLocal(element)) {
-        LocalElement local = element;
-        return locals.use(local);
-      }
-      return null;
-    }
-  }
-
-  void potentiallyAddIsCheck(Send node) {
-    if (!accumulateIsChecks) return;
-    if (!Elements.isLocal(elements[node.receiver])) return;
-    isChecks.add(node);
-  }
-
-  void potentiallyAddNullCheck(Send node, Node receiver) {
-    if (!accumulateIsChecks) return;
-    if (!Elements.isLocal(elements[receiver])) return;
-    isChecks.add(node);
-  }
-
-  void updateIsChecks(List<Node> tests, {bool usePositive}) {
-    void narrow(Element element, DartType type, Node node) {
-      if (element is LocalElement) {
-        T existing = locals.use(element);
-        T newType = types.narrowType(existing, type, isNullable: false);
-        locals.update(element, newType, node);
-      }
-    }
-
-    if (tests == null) return;
-    for (Send node in tests) {
-      if (node.isTypeTest) {
-        if (node.isIsNotCheck) {
-          if (usePositive) continue;
-        } else {
-          if (!usePositive) continue;
-        }
-        DartType type = elements.getType(node.typeAnnotationFromIsCheckOrCast);
-        narrow(elements[node.receiver], type, node);
-      } else {
-        Element receiverElement = elements[node.receiver];
-        Element argumentElement = elements[node.arguments.first];
-        String operator = node.selector.asOperator().source;
-        if ((operator == '==' && usePositive) ||
-            (operator == '!=' && !usePositive)) {
-          // Type the elements as null.
-          if (Elements.isLocal(receiverElement)) {
-            locals.update(receiverElement, types.nullType, node);
-          }
-          if (Elements.isLocal(argumentElement)) {
-            locals.update(argumentElement, types.nullType, node);
-          }
-        } else {
-          // Narrow the elements to a non-null type.
-          DartType objectType = compiler.coreTypes.objectType;
-          if (Elements.isLocal(receiverElement)) {
-            narrow(receiverElement, objectType, node);
-          }
-          if (Elements.isLocal(argumentElement)) {
-            narrow(argumentElement, objectType, node);
-          }
-        }
-      }
-    }
-  }
-
-  @override
-  T visitIndex(Send node, Node receiver, Node index, _) {
-    return handleDynamicInvoke(node);
-  }
-
-  @override
-  T visitDynamicPropertyInvoke(
-      Send node, Node receiver, NodeList arguments, Selector selector, _) {
-    return handleDynamicInvoke(node);
-  }
-
-  @override
-  T visitIfNotNullDynamicPropertyInvoke(
-      Send node, Node receiver, NodeList arguments, Selector selector, _) {
-    return handleDynamicInvoke(node);
-  }
-
-  @override
-  T visitThisPropertyInvoke(
-      Send node, NodeList arguments, Selector selector, _) {
-    return handleDynamicInvoke(node);
-  }
-
-  @override
-  T visitIfNull(Send node, Node left, Node right, _) {
-    T firstType = visit(left);
-    T secondType = visit(right);
-    return types.allocateDiamondPhi(types.narrowNotNull(firstType), secondType);
-  }
-
-  @override
-  T visitLogicalAnd(Send node, Node left, Node right, _) {
-    conditionIsSimple = false;
-    bool oldAccumulateIsChecks = accumulateIsChecks;
-    List<Send> oldIsChecks = isChecks;
-    if (!accumulateIsChecks) {
-      accumulateIsChecks = true;
-      isChecks = <Send>[];
-    }
-    visit(left);
-    LocalsHandler<T> saved = locals;
-    locals = new LocalsHandler<T>.from(locals, node);
-    updateIsChecks(isChecks, usePositive: true);
-    LocalsHandler<T> narrowed;
-    if (oldAccumulateIsChecks) {
-      narrowed = new LocalsHandler<T>.topLevelCopyOf(locals);
-    } else {
-      accumulateIsChecks = false;
-      isChecks = oldIsChecks;
-    }
-    visit(right);
-    if (oldAccumulateIsChecks) {
-      bool invalidatedInRightHandSide(Send test) {
-        Element receiver = elements[test.receiver];
-        if (receiver is LocalElement) {
-          return narrowed.locals[receiver] != locals.locals[receiver];
-        }
-        return false;
-      }
-
-      isChecks.removeWhere(invalidatedInRightHandSide);
-    }
-    saved.mergeDiamondFlow(locals, null);
-    locals = saved;
-    return types.boolType;
-  }
-
-  @override
-  T visitLogicalOr(Send node, Node left, Node right, _) {
-    conditionIsSimple = false;
-    List<Send> tests = <Send>[];
-    bool isSimple = handleCondition(left, tests);
-    LocalsHandler<T> saved = locals;
-    locals = new LocalsHandler<T>.from(locals, node);
-    if (isSimple) updateIsChecks(tests, usePositive: false);
-    bool oldAccumulateIsChecks = accumulateIsChecks;
-    accumulateIsChecks = false;
-    visit(right);
-    accumulateIsChecks = oldAccumulateIsChecks;
-    saved.mergeDiamondFlow(locals, null);
-    locals = saved;
-    return types.boolType;
-  }
-
-  @override
-  T visitNot(Send node, Node expression, _) {
-    bool oldAccumulateIsChecks = accumulateIsChecks;
-    accumulateIsChecks = false;
-    visit(expression);
-    accumulateIsChecks = oldAccumulateIsChecks;
-    return types.boolType;
-  }
-
-  @override
-  T visitIs(Send node, Node expression, DartType type, _) {
-    potentiallyAddIsCheck(node);
-    visit(expression);
-    return types.boolType;
-  }
-
-  @override
-  T visitIsNot(Send node, Node expression, DartType type, _) {
-    potentiallyAddIsCheck(node);
-    visit(expression);
-    return types.boolType;
-  }
-
-  @override
-  T visitAs(Send node, Node expression, DartType type, _) {
-    T receiverType = visit(expression);
-    return types.narrowType(receiverType, type);
-  }
-
-  @override
-  T visitUnary(Send node, UnaryOperator operator, Node expression, _) {
-    return handleDynamicInvoke(node);
-  }
-
-  @override
-  T visitNotEquals(Send node, Node left, Node right, _) {
-    handleDynamicInvoke(node);
-    return types.boolType;
-  }
-
-  @override
-  T visitEquals(Send node, Node left, Node right, _) {
-    return handleDynamicInvoke(node);
-  }
-
-  @override
-  T visitBinary(Send node, Node left, BinaryOperator operator, Node right, _) {
-    return handleDynamicInvoke(node);
-  }
-
-  // Because some nodes just visit their children, we may end up
-  // visiting a type annotation, that may contain a send in case of a
-  // prefixed type. Therefore we explicitly visit the type annotation
-  // to avoid confusing the [ResolvedVisitor].
-  visitTypeAnnotation(TypeAnnotation node) {}
-
-  T visitConditional(Conditional node) {
-    List<Send> tests = <Send>[];
-    bool simpleCondition = handleCondition(node.condition, tests);
-    LocalsHandler<T> saved = locals;
-    locals = new LocalsHandler<T>.from(locals, node);
-    updateIsChecks(tests, usePositive: true);
-    T firstType = visit(node.thenExpression);
-    LocalsHandler<T> thenLocals = locals;
-    locals = new LocalsHandler<T>.from(saved, node);
-    if (simpleCondition) updateIsChecks(tests, usePositive: false);
-    T secondType = visit(node.elseExpression);
-    saved.mergeDiamondFlow(thenLocals, locals);
-    locals = saved;
-    T type = types.allocateDiamondPhi(firstType, secondType);
-    return type;
-  }
-
-  T visitVariableDefinitions(VariableDefinitions node) {
-    for (Link<Node> link = node.definitions.nodes;
-        !link.isEmpty;
-        link = link.tail) {
-      Node definition = link.head;
-      if (definition is Identifier) {
-        locals.update(elements[definition], types.nullType, node);
-      } else {
-        assert(definition.asSendSet() != null);
-        handleSendSet(definition);
-      }
-    }
-    return null;
-  }
-
-  bool handleCondition(Node node, List<Send> tests) {
-    bool oldConditionIsSimple = conditionIsSimple;
-    bool oldAccumulateIsChecks = accumulateIsChecks;
-    List<Send> oldIsChecks = isChecks;
-    accumulateIsChecks = true;
-    conditionIsSimple = true;
-    isChecks = tests;
-    visit(node);
-    bool simpleCondition = conditionIsSimple;
-    accumulateIsChecks = oldAccumulateIsChecks;
-    isChecks = oldIsChecks;
-    conditionIsSimple = oldConditionIsSimple;
-    return simpleCondition;
-  }
-
-  T visitIf(If node) {
-    List<Send> tests = <Send>[];
-    bool simpleCondition = handleCondition(node.condition, tests);
-    LocalsHandler<T> saved = locals;
-    locals = new LocalsHandler<T>.from(locals, node);
-    updateIsChecks(tests, usePositive: true);
-    visit(node.thenPart);
-    LocalsHandler<T> thenLocals = locals;
-    locals = new LocalsHandler<T>.from(saved, node);
-    if (simpleCondition) updateIsChecks(tests, usePositive: false);
-    visit(node.elsePart);
-    saved.mergeDiamondFlow(thenLocals, locals);
-    locals = saved;
-    return null;
-  }
-
-  void setupBreaksAndContinues(JumpTarget element) {
-    if (element == null) return;
-    if (element.isContinueTarget) continuesFor[element] = <LocalsHandler>[];
-    if (element.isBreakTarget) breaksFor[element] = <LocalsHandler>[];
-  }
-
-  void clearBreaksAndContinues(JumpTarget element) {
-    continuesFor.remove(element);
-    breaksFor.remove(element);
-  }
-
-  List<LocalsHandler<T>> getBreaks(JumpTarget element) {
-    List<LocalsHandler<T>> list = <LocalsHandler<T>>[locals];
-    if (element == null) return list;
-    if (!element.isBreakTarget) return list;
-    return list..addAll(breaksFor[element]);
-  }
-
-  List<LocalsHandler<T>> getLoopBackEdges(JumpTarget element) {
-    List<LocalsHandler<T>> list = <LocalsHandler<T>>[locals];
-    if (element == null) return list;
-    if (!element.isContinueTarget) return list;
-    return list..addAll(continuesFor[element]);
-  }
-
-  T handleLoop(Node node, void logic()) {
-    loopLevel++;
-    bool changed = false;
-    JumpTarget target = elements.getTargetDefinition(node);
-    LocalsHandler<T> saved = locals;
-    saved.startLoop(node);
-    do {
-      // Setup (and clear in case of multiple iterations of the loop)
-      // the lists of breaks and continues seen in the loop.
-      setupBreaksAndContinues(target);
-      locals = new LocalsHandler<T>.from(saved, node);
-      logic();
-      changed = saved.mergeAll(getLoopBackEdges(target));
-    } while (changed);
-    loopLevel--;
-    saved.endLoop(node);
-    bool keepOwnLocals = node.asDoWhile() == null;
-    saved.mergeAfterBreaks(getBreaks(target), keepOwnLocals: keepOwnLocals);
-    locals = saved;
-    clearBreaksAndContinues(target);
-    return null;
-  }
-
-  T visitWhile(While node) {
-    return handleLoop(node, () {
-      List<Send> tests = <Send>[];
-      handleCondition(node.condition, tests);
-      updateIsChecks(tests, usePositive: true);
-      visit(node.body);
-    });
-  }
-
-  T visitDoWhile(DoWhile node) {
-    return handleLoop(node, () {
-      visit(node.body);
-      List<Send> tests = <Send>[];
-      handleCondition(node.condition, tests);
-      updateIsChecks(tests, usePositive: true);
-    });
-  }
-
-  T visitFor(For node) {
-    visit(node.initializer);
-    return handleLoop(node, () {
-      List<Send> tests = <Send>[];
-      handleCondition(node.condition, tests);
-      updateIsChecks(tests, usePositive: true);
-      visit(node.body);
-      visit(node.update);
-    });
-  }
-
-  T visitTryStatement(TryStatement node) {
-    LocalsHandler<T> saved = locals;
-    locals = new LocalsHandler<T>.from(locals, node, useOtherTryBlock: false);
-    visit(node.tryBlock);
-    saved.mergeDiamondFlow(locals, null);
-    locals = saved;
-    for (Node catchBlock in node.catchBlocks) {
-      saved = locals;
-      locals = new LocalsHandler<T>.from(locals, catchBlock);
-      visit(catchBlock);
-      saved.mergeDiamondFlow(locals, null);
-      locals = saved;
-    }
-    visit(node.finallyBlock);
-    return null;
-  }
-
-  T visitThrow(Throw node) {
-    node.visitChildren(this);
-    locals.seenReturnOrThrow = true;
-    return types.nonNullEmpty();
-  }
-
-  T visitCatchBlock(CatchBlock node) {
-    Node exception = node.exception;
-    if (exception != null) {
-      DartType type = elements.getType(node.type);
-      T mask = type == null || type.treatAsDynamic || type.isTypeVariable
-          ? types.dynamicType
-          : types.nonNullSubtype(type.element);
-      locals.update(elements[exception], mask, node);
-    }
-    Node trace = node.trace;
-    if (trace != null) {
-      locals.update(elements[trace], types.dynamicType, node);
-    }
-    visit(node.block);
-    return null;
-  }
-
-  T visitParenthesizedExpression(ParenthesizedExpression node) {
-    return visit(node.expression);
-  }
-
-  T visitBlock(Block node) {
-    if (node.statements != null) {
-      for (Node statement in node.statements) {
-        visit(statement);
-        if (locals.aborts) break;
-      }
-    }
-    return null;
-  }
-
-  T visitLabeledStatement(LabeledStatement node) {
-    Statement body = node.statement;
-    if (body is Loop ||
-        body is SwitchStatement ||
-        Elements.isUnusedLabel(node, elements)) {
-      // Loops and switches handle their own labels.
-      visit(body);
-    } else {
-      JumpTarget targetElement = elements.getTargetDefinition(body);
-      setupBreaksAndContinues(targetElement);
-      visit(body);
-      locals.mergeAfterBreaks(getBreaks(targetElement));
-      clearBreaksAndContinues(targetElement);
-    }
-    return null;
-  }
-
-  T visitBreakStatement(BreakStatement node) {
-    JumpTarget target = elements.getTargetOf(node);
-    locals.seenBreakOrContinue = true;
-    // Do a deep-copy of the locals, because the code following the
-    // break will change them.
-    breaksFor[target].add(new LocalsHandler<T>.deepCopyOf(locals));
-    return null;
-  }
-
-  T visitContinueStatement(ContinueStatement node) {
-    JumpTarget target = elements.getTargetOf(node);
-    locals.seenBreakOrContinue = true;
-    // Do a deep-copy of the locals, because the code following the
-    // continue will change them.
-    continuesFor[target].add(new LocalsHandler<T>.deepCopyOf(locals));
-    return null;
-  }
-
-  internalError(Spannable node, String reason) {
-    reporter.internalError(node, reason);
-  }
-
-  T visitSwitchStatement(SwitchStatement node) {
-    visit(node.parenthesizedExpression);
-
-    setupBreaksAndContinues(elements.getTargetDefinition(node));
-    if (Elements.switchStatementHasContinue(node, elements)) {
-      void forEachLabeledCase(void action(JumpTarget target)) {
-        for (SwitchCase switchCase in node.cases) {
-          for (Node labelOrCase in switchCase.labelsAndCases) {
-            if (labelOrCase.asLabel() == null) continue;
-            LabelDefinition labelElement =
-                elements.getLabelDefinition(labelOrCase);
-            if (labelElement != null) {
-              action(labelElement.target);
-            }
-          }
-        }
-      }
-
-      forEachLabeledCase((JumpTarget target) {
-        setupBreaksAndContinues(target);
-      });
-
-      // If the switch statement has a continue, we conservatively
-      // visit all cases and update [locals] until we have reached a
-      // fixed point.
-      bool changed;
-      locals.startLoop(node);
-      do {
-        changed = false;
-        for (Node switchCase in node.cases) {
-          LocalsHandler<T> saved = locals;
-          locals = new LocalsHandler<T>.from(locals, switchCase);
-          visit(switchCase);
-          changed = saved.mergeAll([locals]) || changed;
-          locals = saved;
-        }
-      } while (changed);
-      locals.endLoop(node);
-
-      forEachLabeledCase((JumpTarget target) {
-        clearBreaksAndContinues(target);
-      });
-    } else {
-      LocalsHandler<T> saved = locals;
-      List<LocalsHandler<T>> localsToMerge = <LocalsHandler<T>>[];
-      bool hasDefaultCase = false;
-
-      for (SwitchCase switchCase in node.cases) {
-        if (switchCase.isDefaultCase) {
-          hasDefaultCase = true;
-        }
-        locals = new LocalsHandler<T>.from(saved, switchCase);
-        visit(switchCase);
-        localsToMerge.add(locals);
-      }
-      saved.mergeAfterBreaks(localsToMerge, keepOwnLocals: !hasDefaultCase);
-      locals = saved;
-    }
-    clearBreaksAndContinues(elements.getTargetDefinition(node));
-    return null;
-  }
-
-  T visitCascadeReceiver(CascadeReceiver node) {
-    var type = visit(node.expression);
-    cascadeReceiverStack.add(type);
-    return type;
-  }
-
-  T visitCascade(Cascade node) {
-    // Ignore the result of the cascade send and return the type of the cascade
-    // receiver.
-    visit(node.expression);
-    return cascadeReceiverStack.removeLast();
-  }
-}
diff --git a/pkg/compiler/lib/src/inferrer/list_tracer.dart b/pkg/compiler/lib/src/inferrer/list_tracer.dart
index 575a8c9..96fc9d6 100644
--- a/pkg/compiler/lib/src/inferrer/list_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/list_tracer.dart
@@ -130,7 +130,7 @@
   'checkGrowable',
 ]);
 
-class ListTracerVisitor extends TracerVisitor<ListTypeInformation> {
+class ListTracerVisitor extends TracerVisitor {
   // The [Set] of found assignments to the list.
   Set<TypeInformation> assignments = new Setlet<TypeInformation>();
   bool callsGrowableMethod = false;
diff --git a/pkg/compiler/lib/src/inferrer/locals_handler.dart b/pkg/compiler/lib/src/inferrer/locals_handler.dart
new file mode 100644
index 0000000..1f588e7
--- /dev/null
+++ b/pkg/compiler/lib/src/inferrer/locals_handler.dart
@@ -0,0 +1,540 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library locals_handler;
+
+import 'dart:collection' show IterableMixin;
+
+import '../options.dart' show CompilerOptions;
+import '../elements/elements.dart';
+import '../tree/tree.dart';
+import '../util/util.dart';
+import 'inferrer_engine.dart';
+import 'type_graph_nodes.dart';
+import 'type_system.dart';
+
+/**
+ * A variable scope holds types for variables. It has a link to a
+ * parent scope, but never changes the types in that parent. Instead,
+ * updates to locals of a parent scope are put in the current scope.
+ * The inferrer makes sure updates get merged into the parent scope,
+ * once the control flow block has been visited.
+ */
+class VariableScope {
+  Map<Local, TypeInformation> variables;
+
+  /// The parent of this scope. Null for the root scope.
+  final VariableScope parent;
+
+  /// The [Node] that created this scope.
+  final Node block;
+
+  VariableScope(this.block, [parent])
+      : this.variables = null,
+        this.parent = parent;
+
+  VariableScope.deepCopyOf(VariableScope other)
+      : variables = other.variables == null
+            ? null
+            : new Map<Local, TypeInformation>.from(other.variables),
+        block = other.block,
+        parent = other.parent == null
+            ? null
+            : new VariableScope.deepCopyOf(other.parent);
+
+  VariableScope.topLevelCopyOf(VariableScope other)
+      : variables = other.variables == null
+            ? null
+            : new Map<Local, TypeInformation>.from(other.variables),
+        block = other.block,
+        parent = other.parent;
+
+  TypeInformation operator [](Local variable) {
+    TypeInformation result;
+    if (variables == null || (result = variables[variable]) == null) {
+      return parent == null ? null : parent[variable];
+    }
+    return result;
+  }
+
+  void operator []=(Local variable, TypeInformation mask) {
+    assert(mask != null);
+    if (variables == null) {
+      variables = new Map<Local, TypeInformation>();
+    }
+    variables[variable] = mask;
+  }
+
+  void forEachOwnLocal(void f(Local variable, TypeInformation type)) {
+    if (variables == null) return;
+    variables.forEach(f);
+  }
+
+  void forEachLocalUntilNode(
+      Node node, void f(Local variable, TypeInformation type),
+      [Setlet<Local> seenLocals]) {
+    if (seenLocals == null) seenLocals = new Setlet<Local>();
+    if (variables != null) {
+      variables.forEach((variable, type) {
+        if (seenLocals.contains(variable)) return;
+        seenLocals.add(variable);
+        f(variable, type);
+      });
+    }
+    if (block == node) return;
+    if (parent != null) parent.forEachLocalUntilNode(node, f, seenLocals);
+  }
+
+  void forEachLocal(void f(Local variable, TypeInformation type)) {
+    forEachLocalUntilNode(null, f);
+  }
+
+  bool updates(Local variable) {
+    if (variables == null) return false;
+    return variables.containsKey(variable);
+  }
+
+  String toString() {
+    String rest = parent == null ? "null" : parent.toString();
+    return '$variables $rest';
+  }
+}
+
+class FieldInitializationScope {
+  final TypeSystem types;
+  Map<Element, TypeInformation> fields;
+  bool isThisExposed;
+
+  FieldInitializationScope(this.types) : isThisExposed = false;
+
+  FieldInitializationScope.internalFrom(FieldInitializationScope other)
+      : types = other.types,
+        isThisExposed = other.isThisExposed;
+
+  factory FieldInitializationScope.from(FieldInitializationScope other) {
+    if (other == null) return null;
+    return new FieldInitializationScope.internalFrom(other);
+  }
+
+  void updateField(Element field, TypeInformation type) {
+    if (isThisExposed) return;
+    if (fields == null) fields = new Map<Element, TypeInformation>();
+    fields[field] = type;
+  }
+
+  TypeInformation readField(Element field) {
+    return fields == null ? null : fields[field];
+  }
+
+  void forEach(void f(Element element, TypeInformation type)) {
+    if (fields == null) return;
+    fields.forEach(f);
+  }
+
+  void mergeDiamondFlow(
+      FieldInitializationScope thenScope, FieldInitializationScope elseScope) {
+    // Quick bailout check. If [isThisExposed] is true, we know the
+    // code following won'TypeInformation do anything.
+    if (isThisExposed) return;
+    if (elseScope == null || elseScope.fields == null) {
+      elseScope = this;
+    }
+
+    thenScope.forEach((Element field, TypeInformation type) {
+      TypeInformation otherType = elseScope.readField(field);
+      if (otherType == null) return;
+      updateField(field, types.allocateDiamondPhi(type, otherType));
+    });
+    isThisExposed = thenScope.isThisExposed || elseScope.isThisExposed;
+  }
+}
+
+/**
+ * Placeholder for inferred arguments types on sends.
+ */
+class ArgumentsTypes extends IterableMixin<TypeInformation> {
+  final List<TypeInformation> positional;
+  final Map<String, TypeInformation> named;
+  ArgumentsTypes(this.positional, named)
+      : this.named = (named == null || named.isEmpty) ? const {} : named {
+    assert(this.positional.every((TypeInformation type) => type != null));
+    assert(this.named.values.every((TypeInformation type) => type != null));
+  }
+
+  ArgumentsTypes.empty()
+      : positional = const [],
+        named = const {};
+
+  int get length => positional.length + named.length;
+
+  Iterator<TypeInformation> get iterator => new ArgumentsTypesIterator(this);
+
+  String toString() => "{ positional = $positional, named = $named }";
+
+  bool operator ==(other) {
+    if (positional.length != other.positional.length) return false;
+    if (named.length != other.named.length) return false;
+    for (int i = 0; i < positional.length; i++) {
+      if (positional[i] != other.positional[i]) return false;
+    }
+    named.forEach((name, type) {
+      if (other.named[name] != type) return false;
+    });
+    return true;
+  }
+
+  int get hashCode => throw new UnsupportedError('ArgumentsTypes.hashCode');
+
+  bool hasNoArguments() => positional.isEmpty && named.isEmpty;
+
+  void forEach(void f(TypeInformation type)) {
+    positional.forEach(f);
+    named.values.forEach(f);
+  }
+
+  bool every(bool f(TypeInformation type)) {
+    return positional.every(f) && named.values.every(f);
+  }
+
+  bool contains(TypeInformation type) {
+    return positional.contains(type) || named.containsValue(type);
+  }
+}
+
+class ArgumentsTypesIterator implements Iterator<TypeInformation> {
+  final Iterator<TypeInformation> positional;
+  final Iterator<TypeInformation> named;
+  bool _iteratePositional = true;
+
+  ArgumentsTypesIterator(ArgumentsTypes iteratee)
+      : positional = iteratee.positional.iterator,
+        named = iteratee.named.values.iterator;
+
+  Iterator<TypeInformation> get _currentIterator =>
+      _iteratePositional ? positional : named;
+
+  TypeInformation get current => _currentIterator.current;
+
+  bool moveNext() {
+    if (_iteratePositional && positional.moveNext()) {
+      return true;
+    }
+    _iteratePositional = false;
+    return named.moveNext();
+  }
+}
+
+/**
+ * Placeholder for inferred types of local variables.
+ */
+class LocalsHandler {
+  final CompilerOptions options;
+  final TypeSystem types;
+  final InferrerEngine inferrer;
+  final VariableScope locals;
+  final Map<Local, Element> captured;
+  final Map<Local, Element> capturedAndBoxed;
+  final FieldInitializationScope fieldScope;
+  LocalsHandler tryBlock;
+  bool seenReturnOrThrow = false;
+  bool seenBreakOrContinue = false;
+
+  bool get aborts {
+    return seenReturnOrThrow || seenBreakOrContinue;
+  }
+
+  bool get inTryBlock => tryBlock != null;
+
+  LocalsHandler(this.inferrer, this.types, this.options, Node block,
+      [this.fieldScope])
+      : locals = new VariableScope(block),
+        captured = new Map<Local, Element>(),
+        capturedAndBoxed = new Map<Local, Element>(),
+        tryBlock = null;
+
+  LocalsHandler.from(LocalsHandler other, Node block,
+      {bool useOtherTryBlock: true})
+      : locals = new VariableScope(block, other.locals),
+        fieldScope = new FieldInitializationScope.from(other.fieldScope),
+        captured = other.captured,
+        capturedAndBoxed = other.capturedAndBoxed,
+        types = other.types,
+        inferrer = other.inferrer,
+        options = other.options {
+    tryBlock = useOtherTryBlock ? other.tryBlock : this;
+  }
+
+  LocalsHandler.deepCopyOf(LocalsHandler other)
+      : locals = new VariableScope.deepCopyOf(other.locals),
+        fieldScope = new FieldInitializationScope.from(other.fieldScope),
+        captured = other.captured,
+        capturedAndBoxed = other.capturedAndBoxed,
+        tryBlock = other.tryBlock,
+        types = other.types,
+        inferrer = other.inferrer,
+        options = other.options;
+
+  LocalsHandler.topLevelCopyOf(LocalsHandler other)
+      : locals = new VariableScope.topLevelCopyOf(other.locals),
+        fieldScope = new FieldInitializationScope.from(other.fieldScope),
+        captured = other.captured,
+        capturedAndBoxed = other.capturedAndBoxed,
+        tryBlock = other.tryBlock,
+        types = other.types,
+        inferrer = other.inferrer,
+        options = other.options;
+
+  TypeInformation use(Local local) {
+    if (capturedAndBoxed.containsKey(local)) {
+      return inferrer.typeOfElement(capturedAndBoxed[local]);
+    } else {
+      if (captured.containsKey(local)) {
+        inferrer.recordCapturedLocalRead(local);
+      }
+      return locals[local];
+    }
+  }
+
+  void update(LocalElement local, TypeInformation type, Node node) {
+    assert(type != null);
+    if (options.trustTypeAnnotations || options.enableTypeAssertions) {
+      type = types.narrowType(type, local.type);
+    }
+    updateLocal() {
+      TypeInformation currentType = locals[local];
+
+      SendSet send = node != null ? node.asSendSet() : null;
+      if (send != null && send.isIfNullAssignment && currentType != null) {
+        // If-null assignments may return either the new or the original value
+        // narrowed to non-null.
+        type = types.addPhiInput(
+            local,
+            types.allocatePhi(
+                locals.block, local, types.narrowNotNull(currentType)),
+            type);
+      }
+      locals[local] = type;
+      if (currentType != type) {
+        inferrer.recordLocalUpdate(local, type);
+      }
+    }
+
+    if (capturedAndBoxed.containsKey(local)) {
+      inferrer.recordTypeOfNonFinalField(node, capturedAndBoxed[local], type);
+    } else if (inTryBlock) {
+      // We don'TypeInformation know if an assignment in a try block
+      // will be executed, so all assigments in that block are
+      // potential types after we have left it. We update the parent
+      // of the try block so that, at exit of the try block, we get
+      // the right phi for it.
+      TypeInformation existing = tryBlock.locals.parent[local];
+      if (existing != null) {
+        TypeInformation phiType =
+            types.allocatePhi(tryBlock.locals.block, local, existing);
+        TypeInformation inputType = types.addPhiInput(local, phiType, type);
+        tryBlock.locals.parent[local] = inputType;
+      }
+      // Update the current handler unconditionnally with the new
+      // type.
+      updateLocal();
+    } else {
+      updateLocal();
+    }
+  }
+
+  void setCaptured(Local local, Element field) {
+    captured[local] = field;
+  }
+
+  void setCapturedAndBoxed(Local local, Element field) {
+    capturedAndBoxed[local] = field;
+  }
+
+  void mergeDiamondFlow(LocalsHandler thenBranch, LocalsHandler elseBranch) {
+    if (fieldScope != null && elseBranch != null) {
+      fieldScope.mergeDiamondFlow(thenBranch.fieldScope, elseBranch.fieldScope);
+    }
+    seenReturnOrThrow = thenBranch.seenReturnOrThrow &&
+        elseBranch != null &&
+        elseBranch.seenReturnOrThrow;
+    seenBreakOrContinue = thenBranch.seenBreakOrContinue &&
+        elseBranch != null &&
+        elseBranch.seenBreakOrContinue;
+    if (aborts) return;
+
+    void mergeOneBranch(LocalsHandler other) {
+      other.locals.forEachOwnLocal((Local local, TypeInformation type) {
+        TypeInformation myType = locals[local];
+        if (myType == null) return; // Variable is only defined in [other].
+        if (type == myType) return;
+        locals[local] = types.allocateDiamondPhi(myType, type);
+      });
+    }
+
+    void inPlaceUpdateOneBranch(LocalsHandler other) {
+      other.locals.forEachOwnLocal((Local local, TypeInformation type) {
+        TypeInformation myType = locals[local];
+        if (myType == null) return; // Variable is only defined in [other].
+        if (type == myType) return;
+        locals[local] = type;
+      });
+    }
+
+    if (thenBranch.aborts) {
+      if (elseBranch == null) return;
+      inPlaceUpdateOneBranch(elseBranch);
+    } else if (elseBranch == null) {
+      mergeOneBranch(thenBranch);
+    } else if (elseBranch.aborts) {
+      inPlaceUpdateOneBranch(thenBranch);
+    } else {
+      void mergeLocal(Local local) {
+        TypeInformation myType = locals[local];
+        if (myType == null) return;
+        TypeInformation elseType = elseBranch.locals[local];
+        TypeInformation thenType = thenBranch.locals[local];
+        if (thenType == elseType) {
+          locals[local] = thenType;
+        } else {
+          locals[local] = types.allocateDiamondPhi(thenType, elseType);
+        }
+      }
+
+      thenBranch.locals.forEachOwnLocal((Local local, _) {
+        mergeLocal(local);
+      });
+      elseBranch.locals.forEachOwnLocal((Local local, _) {
+        // Discard locals we already processed when iterating over
+        // [thenBranch]'s locals.
+        if (!thenBranch.locals.updates(local)) mergeLocal(local);
+      });
+    }
+  }
+
+  /**
+   * Merge all [LocalsHandler] in [handlers] into [:this:].
+   *
+   * If [keepOwnLocals] is true, the types of locals in this
+   * [LocalsHandler] are being used in the merge. [keepOwnLocals]
+   * should be true if this [LocalsHandler], the dominator of
+   * all [handlers], also direclty flows into the join point,
+   * that is the code after all [handlers]. For example, consider:
+   *
+   * [: switch (...) {
+   *      case 1: ...; break;
+   *    }
+   * :]
+   *
+   * The [LocalsHandler] at entry of the switch also flows into the
+   * exit of the switch, because there is no default case. So the
+   * types of locals at entry of the switch have to take part to the
+   * merge.
+   *
+   * The above situation is also true for labeled statements like
+   *
+   * [: L: {
+   *      if (...) break;
+   *      ...
+   *    }
+   * :]
+   *
+   * where [:this:] is the [LocalsHandler] for the paths through the
+   * labeled statement that do not break out.
+   */
+  void mergeAfterBreaks(List<LocalsHandler> handlers,
+      {bool keepOwnLocals: true}) {
+    Node level = locals.block;
+    // Use a separate locals handler to perform the merge in, so that Phi
+    // creation does not invalidate previous type knowledge while we might
+    // still look it up.
+    LocalsHandler merged = new LocalsHandler.from(this, level);
+    Set<Local> seenLocals = new Setlet<Local>();
+    bool allBranchesAbort = true;
+    // Merge all other handlers.
+    for (LocalsHandler handler in handlers) {
+      allBranchesAbort = allBranchesAbort && handler.seenReturnOrThrow;
+      merged.mergeHandler(handler, seenLocals);
+    }
+    // If we want to keep own locals, we merge [seenLocals] from [this] into
+    // [merged] to update the Phi nodes with original values.
+    if (keepOwnLocals && !seenReturnOrThrow) {
+      for (Local variable in seenLocals) {
+        TypeInformation originalType = locals[variable];
+        if (originalType != null) {
+          merged.locals[variable] = types.addPhiInput(
+              variable, merged.locals[variable], originalType);
+        }
+      }
+    }
+    // Clean up Phi nodes with single input and store back result into
+    // actual locals handler.
+    merged.locals.forEachOwnLocal((Local variable, TypeInformation type) {
+      locals[variable] = types.simplifyPhi(level, variable, type);
+    });
+    seenReturnOrThrow =
+        allBranchesAbort && (!keepOwnLocals || seenReturnOrThrow);
+  }
+
+  /**
+   * Merge [other] into this handler. Returns whether a local in this
+   * has changed. If [seen] is not null, we allocate new Phi nodes
+   * unless the local is already present in the set [seen]. This effectively
+   * overwrites the current type knowledge in this handler.
+   */
+  bool mergeHandler(LocalsHandler other, [Set<Local> seen]) {
+    if (other.seenReturnOrThrow) return false;
+    bool changed = false;
+    other.locals.forEachLocalUntilNode(locals.block, (local, otherType) {
+      TypeInformation myType = locals[local];
+      if (myType == null) return;
+      TypeInformation newType;
+      if (seen != null && !seen.contains(local)) {
+        newType = types.allocatePhi(locals.block, local, otherType);
+        seen.add(local);
+      } else {
+        newType = types.addPhiInput(local, myType, otherType);
+      }
+      if (newType != myType) {
+        changed = true;
+        locals[local] = newType;
+      }
+    });
+    return changed;
+  }
+
+  /**
+   * Merge all [LocalsHandler] in [handlers] into this handler.
+   * Returns whether a local in this handler has changed.
+   */
+  bool mergeAll(List<LocalsHandler> handlers) {
+    bool changed = false;
+    assert(!seenReturnOrThrow);
+    handlers.forEach((other) {
+      changed = mergeHandler(other) || changed;
+    });
+    return changed;
+  }
+
+  void startLoop(Node loop) {
+    locals.forEachLocal((Local variable, TypeInformation type) {
+      TypeInformation newType = types.allocateLoopPhi(loop, variable, type);
+      if (newType != type) {
+        locals[variable] = newType;
+      }
+    });
+  }
+
+  void endLoop(Node loop) {
+    locals.forEachLocal((Local variable, TypeInformation type) {
+      TypeInformation newType = types.simplifyPhi(loop, variable, type);
+      if (newType != type) {
+        locals[variable] = newType;
+      }
+    });
+  }
+
+  void updateField(Element element, TypeInformation type) {
+    fieldScope.updateField(element, type);
+  }
+}
diff --git a/pkg/compiler/lib/src/inferrer/map_tracer.dart b/pkg/compiler/lib/src/inferrer/map_tracer.dart
index 0abb2ca..3693663e 100644
--- a/pkg/compiler/lib/src/inferrer/map_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/map_tracer.dart
@@ -31,7 +31,7 @@
   "remove"
 ]);
 
-class MapTracerVisitor extends TracerVisitor<MapTypeInformation> {
+class MapTracerVisitor extends TracerVisitor {
   // These lists are used to keep track of newly discovered assignments to
   // the map. Note that elements at corresponding indices are expected to
   // belong to the same assignment operation.
diff --git a/pkg/compiler/lib/src/inferrer/node_tracer.dart b/pkg/compiler/lib/src/inferrer/node_tracer.dart
index 058d36d..5261780 100644
--- a/pkg/compiler/lib/src/inferrer/node_tracer.dart
+++ b/pkg/compiler/lib/src/inferrer/node_tracer.dart
@@ -10,7 +10,7 @@
 import '../types/types.dart' show ContainerTypeMask, MapTypeMask;
 import '../util/util.dart' show Setlet;
 import 'debug.dart' as debug;
-import 'type_graph_inferrer.dart' show TypeGraphInferrerEngine;
+import 'inferrer_engine.dart';
 import 'type_graph_nodes.dart';
 
 // A set of selectors we know do not escape the elements inside the
@@ -72,16 +72,15 @@
 ]);
 
 /// Common logic to trace a value through the type inference graph nodes.
-abstract class TracerVisitor<T extends TypeInformation>
-    implements TypeInformationVisitor {
-  final T tracedType;
-  final TypeGraphInferrerEngine inferrer;
+abstract class TracerVisitor implements TypeInformationVisitor {
+  final TypeInformation tracedType;
+  final InferrerEngine inferrer;
   final Compiler compiler;
 
   static const int MAX_ANALYSIS_COUNT = 16;
   final Setlet<Element> analyzedElements = new Setlet<Element>();
 
-  TracerVisitor(this.tracedType, TypeGraphInferrerEngine inferrer)
+  TracerVisitor(this.tracedType, InferrerEngine inferrer)
       : this.inferrer = inferrer,
         this.compiler = inferrer.compiler;
 
@@ -113,10 +112,14 @@
   bool _wouldBeTooManyUsers(Set users) {
     int seenSoFar = analyzedElements.length;
     if (seenSoFar + users.length <= MAX_ANALYSIS_COUNT) return false;
-    int actualWork = users
-        .where((TypeInformation user) => !analyzedElements.contains(user.owner))
-        .length;
-    return seenSoFar + actualWork > MAX_ANALYSIS_COUNT;
+    int actualWork = 0;
+    for (TypeInformation user in users) {
+      if (!analyzedElements.contains(user.owner)) {
+        actualWork++;
+        if (actualWork > MAX_ANALYSIS_COUNT - seenSoFar) return true;
+      }
+    }
+    return false;
   }
 
   void analyze() {
diff --git a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
deleted file mode 100644
index f6cdace..0000000
--- a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
+++ /dev/null
@@ -1,2259 +0,0 @@
-// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library simple_types_inferrer;
-
-import '../closure.dart' show ClosureClassMap;
-import '../common.dart';
-import '../common/names.dart' show Identifiers, Selectors;
-import '../compiler.dart' show Compiler;
-import '../constants/values.dart' show ConstantValue, IntConstantValue;
-import '../core_types.dart' show CoreClasses, CoreTypes;
-import '../dart_types.dart' show DartType;
-import '../elements/elements.dart';
-import '../js_backend/backend_helpers.dart';
-import '../js_backend/js_backend.dart' as js;
-import '../native/native.dart' as native;
-import '../resolution/operators.dart' as op;
-import '../resolution/tree_elements.dart' show TreeElements;
-import '../tree/tree.dart' as ast;
-import '../types/types.dart' show TypeMask, GlobalTypeInferenceElementData;
-import '../universe/call_structure.dart' show CallStructure;
-import '../universe/selector.dart' show Selector;
-import '../universe/side_effects.dart' show SideEffects;
-import '../util/util.dart' show Link, Setlet;
-import '../world.dart' show ClosedWorld;
-import 'inferrer_visitor.dart';
-
-/**
- * Common super class used by [SimpleTypeInferrerVisitor] to propagate
- * type information about visited nodes, as well as to request type
- * information of elements.
- */
-abstract class InferrerEngine<T, V extends TypeSystem>
-    implements MinimalInferrerEngine<T> {
-  final Compiler compiler;
-  final ClosedWorld closedWorld;
-  final V types;
-  final Map<ast.Node, T> concreteTypes = new Map<ast.Node, T>();
-  final Set<Element> generativeConstructorsExposingThis = new Set<Element>();
-
-  /// Data computed internally within elements, like the type-mask of a send a
-  /// list allocation, or a for-in loop.
-  final Map<Element, GlobalTypeInferenceElementData> inTreeData =
-      new Map<Element, GlobalTypeInferenceElementData>();
-
-  InferrerEngine(Compiler compiler, this.types)
-      : this.compiler = compiler,
-        this.closedWorld = compiler.closedWorld;
-
-  CoreClasses get coreClasses => compiler.coreClasses;
-
-  CoreTypes get coreTypes => compiler.coreTypes;
-
-  /**
-   * Records the default type of parameter [parameter].
-   */
-  void setDefaultTypeOfParameter(ParameterElement parameter, T type);
-
-  /**
-   * This helper breaks abstractions but is currently required to work around
-   * the wrong modelling of default values of optional parameters of
-   * synthetic constructors.
-   *
-   * TODO(johnniwinther): Remove once default values of synthetic parameters
-   * are fixed.
-   */
-  bool hasAlreadyComputedTypeOfParameterDefault(ParameterElement paramemter);
-
-  /**
-   * Returns the type of [element].
-   */
-  T typeOfElement(Element element);
-
-  /**
-   * Returns the return type of [element].
-   */
-  T returnTypeOfElement(Element element);
-
-  /**
-   * Records that [node] sets final field [element] to be of type [type].
-   *
-   * [nodeHolder] is the element holder of [node].
-   */
-  void recordTypeOfFinalField(
-      ast.Node node, Element nodeHolder, Element field, T type);
-
-  /**
-   * Records that [node] sets non-final field [element] to be of type
-   * [type].
-   */
-  void recordTypeOfNonFinalField(Spannable node, Element field, T type);
-
-  /**
-   * Records that [element] is of type [type].
-   */
-  void recordType(Element element, T type);
-
-  /**
-   * Records that the return type [element] is of type [type].
-   */
-  void recordReturnType(Element element, T type);
-
-  /**
-   * Registers that [caller] calls [callee] at location [node], with
-   * [selector], and [arguments]. Note that [selector] is null for
-   * forwarding constructors.
-   *
-   * [sideEffects] will be updated to incorporate [callee]'s side
-   * effects.
-   *
-   * [inLoop] tells whether the call happens in a loop.
-   */
-  T registerCalledElement(
-      Spannable node,
-      Selector selector,
-      TypeMask mask,
-      Element caller,
-      Element callee,
-      ArgumentsTypes<T> arguments,
-      SideEffects sideEffects,
-      bool inLoop);
-
-  /**
-   * Registers that [caller] calls [selector] with [receiverType] as
-   * receiver, and [arguments].
-   *
-   * [sideEffects] will be updated to incorporate the potential
-   * callees' side effects.
-   *
-   * [inLoop] tells whether the call happens in a loop.
-   */
-  T registerCalledSelector(
-      ast.Node node,
-      Selector selector,
-      TypeMask mask,
-      T receiverType,
-      Element caller,
-      ArgumentsTypes<T> arguments,
-      SideEffects sideEffects,
-      bool inLoop);
-
-  /**
-   * Registers that [caller] calls [closure] with [arguments].
-   *
-   * [sideEffects] will be updated to incorporate the potential
-   * callees' side effects.
-   *
-   * [inLoop] tells whether the call happens in a loop.
-   */
-  T registerCalledClosure(
-      ast.Node node,
-      Selector selector,
-      TypeMask mask,
-      T closure,
-      Element caller,
-      ArgumentsTypes<T> arguments,
-      SideEffects sideEffects,
-      bool inLoop);
-
-  /**
-   * Registers a call to await with an expression of type [argumentType] as
-   * argument.
-   */
-  T registerAwait(ast.Node node, T argumentType);
-
-  /**
-   * Notifies to the inferrer that [analyzedElement] can have return
-   * type [newType]. [currentType] is the type the [InferrerVisitor]
-   * currently found.
-   *
-   * Returns the new type for [analyzedElement].
-   */
-  T addReturnTypeFor(Element analyzedElement, T currentType, T newType);
-
-  /**
-   * Applies [f] to all elements in the universe that match
-   * [selector] and [mask]. If [f] returns false, aborts the iteration.
-   */
-  void forEachElementMatching(
-      Selector selector, TypeMask mask, bool f(Element element)) {
-    Iterable<Element> elements =
-        compiler.closedWorld.allFunctions.filter(selector, mask);
-    for (Element e in elements) {
-      if (!f(e.implementation)) return;
-    }
-  }
-
-  GlobalTypeInferenceElementData _dataOf(AstElement element) => inTreeData
-      .putIfAbsent(element, () => new GlobalTypeInferenceElementData());
-
-  /**
-   * Update [sideEffects] with the side effects of [callee] being
-   * called with [selector].
-   */
-  void updateSideEffects(
-      SideEffects sideEffects, Selector selector, Element callee) {
-    if (callee.isField) {
-      if (callee.isInstanceMember) {
-        if (selector.isSetter) {
-          sideEffects.setChangesInstanceProperty();
-        } else if (selector.isGetter) {
-          sideEffects.setDependsOnInstancePropertyStore();
-        } else {
-          sideEffects.setAllSideEffects();
-          sideEffects.setDependsOnSomething();
-        }
-      } else {
-        if (selector.isSetter) {
-          sideEffects.setChangesStaticProperty();
-        } else if (selector.isGetter) {
-          sideEffects.setDependsOnStaticPropertyStore();
-        } else {
-          sideEffects.setAllSideEffects();
-          sideEffects.setDependsOnSomething();
-        }
-      }
-    } else if (callee.isGetter && !selector.isGetter) {
-      sideEffects.setAllSideEffects();
-      sideEffects.setDependsOnSomething();
-    } else {
-      sideEffects
-          .add(compiler.inferenceWorld.getCurrentlyKnownSideEffects(callee));
-    }
-  }
-
-  /**
-   * Returns the type for [nativeBehavior]. See documentation on
-   * [native.NativeBehavior].
-   */
-  T typeOfNativeBehavior(native.NativeBehavior nativeBehavior) {
-    if (nativeBehavior == null) return types.dynamicType;
-    List typesReturned = nativeBehavior.typesReturned;
-    if (typesReturned.isEmpty) return types.dynamicType;
-    T returnType;
-    for (var type in typesReturned) {
-      T mappedType;
-      if (type == native.SpecialType.JsObject) {
-        mappedType = types.nonNullExact(coreClasses.objectClass);
-      } else if (type == coreTypes.stringType) {
-        mappedType = types.stringType;
-      } else if (type == coreTypes.intType) {
-        mappedType = types.intType;
-      } else if (type == coreTypes.numType || type == coreTypes.doubleType) {
-        // Note: the backend double class is specifically for non-integer
-        // doubles, and a native behavior returning 'double' does not guarantee
-        // a non-integer return type, so we return the number type for those.
-        mappedType = types.numType;
-      } else if (type == coreTypes.boolType) {
-        mappedType = types.boolType;
-      } else if (type == coreTypes.nullType) {
-        mappedType = types.nullType;
-      } else if (type.isVoid) {
-        mappedType = types.nullType;
-      } else if (type.isDynamic) {
-        return types.dynamicType;
-      } else {
-        mappedType = types.nonNullSubtype(type.element);
-      }
-      returnType = types.computeLUB(returnType, mappedType);
-      if (returnType == types.dynamicType) {
-        break;
-      }
-    }
-    return returnType;
-  }
-
-  // TODO(johnniwinther): Pass the [ResolvedAst] instead of [owner].
-  void updateSelectorInTree(
-      AstElement owner, Spannable node, Selector selector, TypeMask mask) {
-    ast.Node astNode = node;
-    GlobalTypeInferenceElementData data = _dataOf(owner);
-    if (astNode.asSendSet() != null) {
-      if (selector.isSetter || selector.isIndexSet) {
-        data.setTypeMask(node, mask);
-      } else if (selector.isGetter || selector.isIndex) {
-        data.setGetterTypeMaskInComplexSendSet(node, mask);
-      } else {
-        assert(selector.isOperator);
-        data.setOperatorTypeMaskInComplexSendSet(node, mask);
-      }
-    } else if (astNode.asSend() != null) {
-      data.setTypeMask(node, mask);
-    } else {
-      assert(astNode.asForIn() != null);
-      if (selector == Selectors.iterator) {
-        data.setIteratorTypeMask(node, mask);
-      } else if (selector == Selectors.current) {
-        data.setCurrentTypeMask(node, mask);
-      } else {
-        assert(selector == Selectors.moveNext);
-        data.setMoveNextTypeMask(node, mask);
-      }
-    }
-  }
-
-  bool isNativeElement(Element element) {
-    return compiler.backend.isNative(element);
-  }
-
-  void analyze(ResolvedAst resolvedAst, ArgumentsTypes arguments);
-
-  bool checkIfExposesThis(Element element) {
-    element = element.implementation;
-    return generativeConstructorsExposingThis.contains(element);
-  }
-
-  void recordExposesThis(Element element, bool exposesThis) {
-    element = element.implementation;
-    if (exposesThis) {
-      generativeConstructorsExposingThis.add(element);
-    }
-  }
-}
-
-/// [SimpleTypeInferrerVisitor] can be thought of as a type-inference graph
-/// builder for a single element.
-///
-/// Calling [run] will start the work of visiting the body of the code to
-/// construct a set of infernece-nodes that abstractly represent what the code
-/// is doing.
-///
-/// This visitor is parameterized by an [InferenceEngine], which internally
-/// decides how to represent inference nodes.
-class SimpleTypeInferrerVisitor<T>
-    extends InferrerVisitor<T, InferrerEngine<T, TypeSystem<T>>> {
-  T returnType;
-  bool visitingInitializers = false;
-  bool isConstructorRedirect = false;
-  bool seenSuperConstructorCall = false;
-  SideEffects sideEffects = new SideEffects.empty();
-  final Element outermostElement;
-  final InferrerEngine<T, TypeSystem<T>> inferrer;
-  final Setlet<Entity> capturedVariables = new Setlet<Entity>();
-  final GlobalTypeInferenceElementData inTreeData;
-
-  SimpleTypeInferrerVisitor.internal(
-      AstElement analyzedElement,
-      ResolvedAst resolvedAst,
-      this.outermostElement,
-      inferrer,
-      compiler,
-      locals)
-      : super(analyzedElement, resolvedAst, inferrer, inferrer.types, compiler,
-            locals),
-        this.inferrer = inferrer,
-        this.inTreeData = inferrer._dataOf(analyzedElement) {
-    assert(outermostElement != null);
-  }
-
-  SimpleTypeInferrerVisitor(Element element, ResolvedAst resolvedAst,
-      Compiler compiler, InferrerEngine<T, TypeSystem<T>> inferrer,
-      [LocalsHandler<T> handler])
-      : this.internal(
-            element,
-            resolvedAst,
-            element.outermostEnclosingMemberOrTopLevel.implementation,
-            inferrer,
-            compiler,
-            handler);
-
-  void analyzeSuperConstructorCall(
-      AstElement target, ArgumentsTypes arguments) {
-    ResolvedAst resolvedAst = target.resolvedAst;
-    inferrer.analyze(resolvedAst, arguments);
-    isThisExposed = isThisExposed || inferrer.checkIfExposesThis(target);
-  }
-
-  T run() {
-    var node;
-    if (resolvedAst.kind == ResolvedAstKind.PARSED) {
-      node = resolvedAst.node;
-    }
-    ast.Expression initializer;
-    if (analyzedElement.isField) {
-      initializer = resolvedAst.body;
-      if (initializer == null) {
-        // Eagerly bailout, because computing the closure data only
-        // works for functions and field assignments.
-        return types.nullType;
-      }
-    }
-    // Update the locals that are boxed in [locals]. These locals will
-    // be handled specially, in that we are computing their LUB at
-    // each update, and reading them yields the type that was found in a
-    // previous analysis of [outermostElement].
-    ClosureClassMap closureData =
-        compiler.closureToClassMapper.getClosureToClassMapping(resolvedAst);
-    closureData.forEachCapturedVariable((variable, field) {
-      locals.setCaptured(variable, field);
-    });
-    closureData.forEachBoxedVariable((variable, field) {
-      locals.setCapturedAndBoxed(variable, field);
-    });
-    if (analyzedElement.isField) {
-      return visit(initializer);
-    }
-
-    FunctionElement function = analyzedElement;
-    FunctionSignature signature = function.functionSignature;
-    signature.forEachOptionalParameter((ParameterElement element) {
-      ast.Expression defaultValue = element.initializer;
-      // TODO(25566): The default value of a parameter of a redirecting factory
-      // constructor comes from the corresponding parameter of the target.
-
-      // If this is a default value from a different context (because
-      // the current function is synthetic, e.g., a constructor from
-      // a mixin application), we have to start a new inferrer visitor
-      // with the correct context.
-      // TODO(johnniwinther): Remove once function signatures are fixed.
-      SimpleTypeInferrerVisitor visitor = this;
-      if (inferrer.hasAlreadyComputedTypeOfParameterDefault(element)) return;
-      if (element.functionDeclaration != analyzedElement) {
-        visitor = new SimpleTypeInferrerVisitor(element.functionDeclaration,
-            element.functionDeclaration.resolvedAst, compiler, inferrer);
-      }
-      T type =
-          (defaultValue == null) ? types.nullType : visitor.visit(defaultValue);
-      inferrer.setDefaultTypeOfParameter(element, type);
-    });
-
-    if (compiler.backend.isNative(analyzedElement)) {
-      // Native methods do not have a body, and we currently just say
-      // they return dynamic.
-      return types.dynamicType;
-    }
-
-    if (analyzedElement.isGenerativeConstructor) {
-      isThisExposed = false;
-      signature.forEachParameter((ParameterElement element) {
-        T parameterType = inferrer.typeOfElement(element);
-        if (element.isInitializingFormal) {
-          InitializingFormalElement initializingFormal = element;
-          if (initializingFormal.fieldElement.isFinal) {
-            inferrer.recordTypeOfFinalField(node, analyzedElement,
-                initializingFormal.fieldElement, parameterType);
-          } else {
-            locals.updateField(initializingFormal.fieldElement, parameterType);
-            inferrer.recordTypeOfNonFinalField(initializingFormal.node,
-                initializingFormal.fieldElement, parameterType);
-          }
-        }
-        locals.update(element, parameterType, node);
-      });
-      ClassElement cls = analyzedElement.enclosingClass;
-      Spannable spannable = node;
-      if (analyzedElement.isSynthesized) {
-        spannable = analyzedElement;
-        ConstructorElement constructor = analyzedElement;
-        synthesizeForwardingCall(spannable, constructor.definingConstructor);
-      } else {
-        visitingInitializers = true;
-        if (node.initializers != null) {
-          for (ast.Node initializer in node.initializers) {
-            ast.SendSet fieldInitializer = initializer.asSendSet();
-            if (fieldInitializer != null) {
-              handleSendSet(fieldInitializer);
-            } else {
-              Element element = elements[initializer];
-              handleConstructorSend(initializer, element);
-            }
-          }
-        }
-        visitingInitializers = false;
-        // For a generative constructor like: `Foo();`, we synthesize
-        // a call to the default super constructor (the one that takes
-        // no argument). Resolution ensures that such a constructor
-        // exists.
-        if (!isConstructorRedirect &&
-            !seenSuperConstructorCall &&
-            !cls.isObject) {
-          FunctionElement target = cls.superclass.lookupDefaultConstructor();
-          ArgumentsTypes arguments = new ArgumentsTypes([], {});
-          analyzeSuperConstructorCall(target, arguments);
-          inferrer.registerCalledElement(node, null, null, outermostElement,
-              target.implementation, arguments, sideEffects, inLoop);
-        }
-        visit(node.body);
-        inferrer.recordExposesThis(analyzedElement, isThisExposed);
-      }
-      if (!isConstructorRedirect) {
-        // Iterate over all instance fields, and give a null type to
-        // fields that we haven't initialized for sure.
-        cls.forEachInstanceField((_, FieldElement field) {
-          if (field.isFinal) return;
-          T type = locals.fieldScope.readField(field);
-          ResolvedAst resolvedAst = field.resolvedAst;
-          if (type == null && resolvedAst.body == null) {
-            inferrer.recordTypeOfNonFinalField(
-                spannable, field, types.nullType);
-          }
-        });
-      }
-      if (analyzedElement.isGenerativeConstructor && cls.isAbstract) {
-        if (compiler.closedWorld.isInstantiated(cls)) {
-          returnType = types.nonNullSubclass(cls);
-        } else {
-          // TODO(johnniwinther): Avoid analyzing [analyzedElement] in this
-          // case; it's never called.
-          returnType = types.nonNullEmpty();
-        }
-      } else {
-        returnType = types.nonNullExact(cls);
-      }
-    } else {
-      signature.forEachParameter((LocalParameterElement element) {
-        locals.update(element, inferrer.typeOfElement(element), node);
-      });
-      visit(node.body);
-      switch (function.asyncMarker) {
-        case AsyncMarker.SYNC:
-          if (returnType == null) {
-            // No return in the body.
-            returnType = locals.seenReturnOrThrow
-                ? types.nonNullEmpty() // Body always throws.
-                : types.nullType;
-          } else if (!locals.seenReturnOrThrow) {
-            // We haven't seen returns on all branches. So the method may
-            // also return null.
-            returnType = inferrer.addReturnTypeFor(
-                analyzedElement, returnType, types.nullType);
-          }
-          break;
-
-        case AsyncMarker.SYNC_STAR:
-          // TODO(asgerf): Maybe make a ContainerTypeMask for these? The type
-          //               contained is the method body's return type.
-          returnType = inferrer.addReturnTypeFor(
-              analyzedElement, returnType, types.syncStarIterableType);
-          break;
-
-        case AsyncMarker.ASYNC:
-          returnType = inferrer.addReturnTypeFor(
-              analyzedElement, returnType, types.asyncFutureType);
-          break;
-
-        case AsyncMarker.ASYNC_STAR:
-          returnType = inferrer.addReturnTypeFor(
-              analyzedElement, returnType, types.asyncStarStreamType);
-          break;
-      }
-    }
-
-    compiler.inferenceWorld.registerSideEffects(analyzedElement, sideEffects);
-    assert(breaksFor.isEmpty);
-    assert(continuesFor.isEmpty);
-    return returnType;
-  }
-
-  T visitFunctionExpression(ast.FunctionExpression node) {
-    // We loose track of [this] in closures (see issue 20840). To be on
-    // the safe side, we mark [this] as exposed here. We could do better by
-    // analyzing the closure.
-    // TODO(herhut): Analyze whether closure exposes this.
-    isThisExposed = true;
-    LocalFunctionElement element = elements.getFunctionDefinition(node);
-    // We don't put the closure in the work queue of the
-    // inferrer, because it will share information with its enclosing
-    // method, like for example the types of local variables.
-    LocalsHandler closureLocals =
-        new LocalsHandler<T>.from(locals, node, useOtherTryBlock: false);
-    SimpleTypeInferrerVisitor visitor = new SimpleTypeInferrerVisitor<T>(
-        element, element.resolvedAst, compiler, inferrer, closureLocals);
-    visitor.run();
-    inferrer.recordReturnType(element, visitor.returnType);
-
-    // Record the types of captured non-boxed variables. Types of
-    // these variables may already be there, because of an analysis of
-    // a previous closure.
-    ClosureClassMap nestedClosureData = compiler.closureToClassMapper
-        .getClosureToClassMapping(element.resolvedAst);
-    nestedClosureData.forEachCapturedVariable((variable, field) {
-      if (!nestedClosureData.isVariableBoxed(variable)) {
-        if (variable == nestedClosureData.thisLocal) {
-          inferrer.recordType(field, thisType);
-        }
-        // The type is null for type parameters.
-        if (locals.locals[variable] == null) return;
-        inferrer.recordType(field, locals.locals[variable]);
-      }
-      capturedVariables.add(variable);
-    });
-
-    return inferrer.concreteTypes.putIfAbsent(node, () {
-      return types.allocateClosure(node, element);
-    });
-  }
-
-  T visitFunctionDeclaration(ast.FunctionDeclaration node) {
-    LocalFunctionElement element =
-        elements.getFunctionDefinition(node.function);
-    T type = inferrer.concreteTypes.putIfAbsent(node.function, () {
-      return types.allocateClosure(node.function, element);
-    });
-    locals.update(element, type, node);
-    visit(node.function);
-    return type;
-  }
-
-  T visitStringInterpolation(ast.StringInterpolation node) {
-    // Interpolation could have any effects since it could call any toString()
-    // method.
-    // TODO(sra): This could be modelled by a call to toString() but with a
-    // guaranteed String return type.  Interpolation of known types would get
-    // specialized effects.  This would not currently be effective since the JS
-    // code in the toString methods for intercepted primitive types is assumed
-    // to have all effects.  Effect annotations on JS code would be needed to
-    // get the benefit.
-    sideEffects.setAllSideEffects();
-    return super.visitStringInterpolation(node);
-  }
-
-  T visitLiteralList(ast.LiteralList node) {
-    // We only set the type once. We don't need to re-visit the children
-    // when re-analyzing the node.
-    return inferrer.concreteTypes.putIfAbsent(node, () {
-      T elementType;
-      int length = 0;
-      for (ast.Node element in node.elements.nodes) {
-        T type = visit(element);
-        elementType = elementType == null
-            ? types.allocatePhi(null, null, type)
-            : types.addPhiInput(null, elementType, type);
-        length++;
-      }
-      elementType = elementType == null
-          ? types.nonNullEmpty()
-          : types.simplifyPhi(null, null, elementType);
-      T containerType =
-          node.isConst ? types.constListType : types.growableListType;
-      return types.allocateList(
-          containerType, node, outermostElement, elementType, length);
-    });
-  }
-
-  T visitLiteralMap(ast.LiteralMap node) {
-    return inferrer.concreteTypes.putIfAbsent(node, () {
-      ast.NodeList entries = node.entries;
-      List<T> keyTypes = [];
-      List<T> valueTypes = [];
-
-      for (ast.LiteralMapEntry entry in entries) {
-        keyTypes.add(visit(entry.key));
-        valueTypes.add(visit(entry.value));
-      }
-
-      T type = node.isConst ? types.constMapType : types.mapType;
-      return types.allocateMap(
-          type, node, outermostElement, keyTypes, valueTypes);
-    });
-  }
-
-  bool isThisOrSuper(ast.Node node) => node.isThis() || node.isSuper();
-
-  bool isInClassOrSubclass(Element element) {
-    ClassElement cls = outermostElement.enclosingClass.declaration;
-    ClassElement enclosing = element.enclosingClass.declaration;
-    return compiler.closedWorld.isSubclassOf(enclosing, cls);
-  }
-
-  void checkIfExposesThis(Selector selector, TypeMask mask) {
-    if (isThisExposed) return;
-    inferrer.forEachElementMatching(selector, mask, (element) {
-      if (element.isField) {
-        ResolvedAst elementResolvedAst = element.resolvedAst;
-        if (!selector.isSetter &&
-            isInClassOrSubclass(element) &&
-            !element.isFinal &&
-            locals.fieldScope.readField(element) == null &&
-            elementResolvedAst.body == null) {
-          // If the field is being used before this constructor
-          // actually had a chance to initialize it, say it can be
-          // null.
-          inferrer.recordTypeOfNonFinalField(
-              resolvedAst.node, element, types.nullType);
-        }
-        // Accessing a field does not expose [:this:].
-        return true;
-      }
-      // TODO(ngeoffray): We could do better here if we knew what we
-      // are calling does not expose this.
-      isThisExposed = true;
-      return false;
-    });
-  }
-
-  bool get inInstanceContext {
-    return (outermostElement.isInstanceMember && !outermostElement.isField) ||
-        outermostElement.isGenerativeConstructor;
-  }
-
-  bool treatAsInstanceMember(Element element) {
-    return (Elements.isUnresolved(element) && inInstanceContext) ||
-        (element != null && element.isInstanceMember);
-  }
-
-  @override
-  T handleSendSet(ast.SendSet node) {
-    Element element = elements[node];
-    if (!Elements.isUnresolved(element) && element.impliesType) {
-      node.visitChildren(this);
-      return types.dynamicType;
-    }
-
-    Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node);
-    TypeMask getterMask = inTreeData.typeOfGetter(node);
-    TypeMask operatorMask = inTreeData.typeOfOperator(node);
-    Selector setterSelector = elements.getSelector(node);
-    TypeMask setterMask = inTreeData.typeOfSend(node);
-
-    String op = node.assignmentOperator.source;
-    bool isIncrementOrDecrement = op == '++' || op == '--';
-
-    T receiverType;
-    bool isCallOnThis = false;
-    if (node.receiver == null) {
-      if (treatAsInstanceMember(element)) {
-        receiverType = thisType;
-        isCallOnThis = true;
-      }
-    } else {
-      if (node.receiver != null) {
-        Element receiver = elements[node.receiver];
-        if (receiver is! PrefixElement && receiver is! ClassElement) {
-          // TODO(johnniwinther): Avoid blindly recursing on the receiver.
-          receiverType = visit(node.receiver);
-        }
-      }
-      isCallOnThis = isThisOrSuper(node.receiver);
-    }
-
-    T rhsType;
-
-    if (isIncrementOrDecrement) {
-      rhsType = types.uint31Type;
-      if (node.isIndex) visit(node.arguments.head);
-    } else if (node.isIndex) {
-      visit(node.arguments.head);
-      rhsType = visit(node.arguments.tail.head);
-    } else {
-      rhsType = visit(node.arguments.head);
-    }
-
-    if (!visitingInitializers && !isThisExposed) {
-      for (ast.Node node in node.arguments) {
-        if (isThisOrSuper(node)) {
-          isThisExposed = true;
-          break;
-        }
-      }
-      if (!isThisExposed && isCallOnThis) {
-        checkIfExposesThis(
-            setterSelector, types.newTypedSelector(receiverType, setterMask));
-        if (getterSelector != null) {
-          checkIfExposesThis(
-              getterSelector, types.newTypedSelector(receiverType, getterMask));
-        }
-      }
-    }
-
-    if (node.isIndex) {
-      return internalError(node, "Unexpected index operation");
-    } else if (op == '=') {
-      return handlePlainAssignment(node, element, setterSelector, setterMask,
-          receiverType, rhsType, node.arguments.head);
-    } else {
-      // [foo ??= bar], [: foo++ :] or [: foo += 1 :].
-      T getterType;
-      T newType;
-
-      if (Elements.isMalformed(element)) return types.dynamicType;
-
-      if (Elements.isStaticOrTopLevelField(element)) {
-        Element getterElement = elements[node.selector];
-        getterType = handleStaticSend(
-            node, getterSelector, getterMask, getterElement, null);
-      } else if (Elements.isUnresolved(element) ||
-          element.isSetter ||
-          element.isField) {
-        getterType = handleDynamicSend(
-            node, getterSelector, getterMask, receiverType, null);
-      } else if (element.isLocal) {
-        LocalElement local = element;
-        getterType = locals.use(local);
-      } else {
-        // Bogus SendSet, for example [: myMethod += 42 :].
-        getterType = types.dynamicType;
-      }
-
-      if (op == '??=') {
-        newType = types.allocateDiamondPhi(getterType, rhsType);
-      } else {
-        Selector operatorSelector =
-            elements.getOperatorSelectorInComplexSendSet(node);
-        newType = handleDynamicSend(node, operatorSelector, operatorMask,
-            getterType, new ArgumentsTypes<T>([rhsType], null));
-      }
-
-      if (Elements.isStaticOrTopLevelField(element)) {
-        handleStaticSend(node, setterSelector, setterMask, element,
-            new ArgumentsTypes<T>([newType], null));
-      } else if (Elements.isUnresolved(element) ||
-          element.isSetter ||
-          element.isField) {
-        handleDynamicSend(node, setterSelector, setterMask, receiverType,
-            new ArgumentsTypes<T>([newType], null));
-      } else if (element.isLocal) {
-        locals.update(element, newType, node);
-      }
-
-      return node.isPostfix ? getterType : newType;
-    }
-  }
-
-  /// Handle compound index set, like `foo[0] += 42` or `foo[0]++`.
-  T handleCompoundIndexSet(
-      ast.SendSet node, T receiverType, T indexType, T rhsType) {
-    Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node);
-
-    TypeMask getterMask = inTreeData.typeOfGetter(node);
-    Selector operatorSelector =
-        elements.getOperatorSelectorInComplexSendSet(node);
-    TypeMask operatorMask = inTreeData.typeOfOperator(node);
-    Selector setterSelector = elements.getSelector(node);
-    TypeMask setterMask = inTreeData.typeOfSend(node);
-
-    T getterType = handleDynamicSend(node, getterSelector, getterMask,
-        receiverType, new ArgumentsTypes<T>([indexType], null));
-
-    T returnType;
-    if (node.isIfNullAssignment) {
-      returnType = types.allocateDiamondPhi(getterType, rhsType);
-    } else {
-      returnType = handleDynamicSend(node, operatorSelector, operatorMask,
-          getterType, new ArgumentsTypes<T>([rhsType], null));
-    }
-    handleDynamicSend(node, setterSelector, setterMask, receiverType,
-        new ArgumentsTypes<T>([indexType, returnType], null));
-
-    if (node.isPostfix) {
-      return getterType;
-    } else {
-      return returnType;
-    }
-  }
-
-  /// Handle compound prefix/postfix operations, like `a[0]++`.
-  T handleCompoundPrefixPostfix(ast.Send node, T receiverType, T indexType) {
-    return handleCompoundIndexSet(
-        node, receiverType, indexType, types.uint31Type);
-  }
-
-  @override
-  T visitIndexPostfix(ast.Send node, ast.Node receiver, ast.Node index,
-      op.IncDecOperator operator, _) {
-    T receiverType = visit(receiver);
-    T indexType = visit(index);
-    return handleCompoundPrefixPostfix(node, receiverType, indexType);
-  }
-
-  @override
-  T visitIndexPrefix(ast.Send node, ast.Node receiver, ast.Node index,
-      op.IncDecOperator operator, _) {
-    T receiverType = visit(receiver);
-    T indexType = visit(index);
-    return handleCompoundPrefixPostfix(node, receiverType, indexType);
-  }
-
-  @override
-  T visitCompoundIndexSet(ast.SendSet node, ast.Node receiver, ast.Node index,
-      op.AssignmentOperator operator, ast.Node rhs, _) {
-    T receiverType = visit(receiver);
-    T indexType = visit(index);
-    T rhsType = visit(rhs);
-    return handleCompoundIndexSet(node, receiverType, indexType, rhsType);
-  }
-
-  @override
-  T visitIndexSetIfNull(
-      ast.SendSet node, ast.Node receiver, ast.Node index, ast.Node rhs, _) {
-    T receiverType = visit(receiver);
-    T indexType = visit(index);
-    T rhsType = visit(rhs);
-    return handleCompoundIndexSet(node, receiverType, indexType, rhsType);
-  }
-
-  @override
-  T visitSuperIndexPrefix(ast.Send node, MethodElement getter,
-      MethodElement setter, ast.Node index, op.IncDecOperator operator, _) {
-    T indexType = visit(index);
-    return handleSuperIndexPrefixPostfix(node, getter, setter, indexType);
-  }
-
-  @override
-  T visitSuperIndexPostfix(ast.Send node, MethodElement getter,
-      MethodElement setter, ast.Node index, op.IncDecOperator operator, _) {
-    T indexType = visit(index);
-    return handleSuperIndexPrefixPostfix(node, getter, setter, indexType);
-  }
-
-  /// Handle compound prefix/postfix operations, like `super[0]++`.
-  T handleSuperIndexPrefixPostfix(
-      ast.Send node, Element getter, Element setter, T indexType) {
-    return _handleSuperCompoundIndexSet(
-        node, getter, setter, indexType, types.uint31Type);
-  }
-
-  /// Handle compound super index set, like `super[42] =+ 2`.
-  T handleSuperCompoundIndexSet(ast.SendSet node, Element getter,
-      Element setter, ast.Node index, ast.Node rhs) {
-    T indexType = visit(index);
-    T rhsType = visit(rhs);
-    return _handleSuperCompoundIndexSet(
-        node, getter, setter, indexType, rhsType);
-  }
-
-  T _handleSuperCompoundIndexSet(ast.SendSet node, Element getter,
-      Element setter, T indexType, T rhsType) {
-    Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node);
-
-    TypeMask getterMask = inTreeData.typeOfGetter(node);
-    Selector setterSelector = elements.getSelector(node);
-    TypeMask setterMask = inTreeData.typeOfSend(node);
-
-    T getterType = handleSuperSend(node, getterSelector, getterMask, getter,
-        new ArgumentsTypes<T>([indexType], null));
-
-    T returnType;
-    if (node.isIfNullAssignment) {
-      returnType = types.allocateDiamondPhi(getterType, rhsType);
-    } else {
-      Selector operatorSelector =
-          elements.getOperatorSelectorInComplexSendSet(node);
-      TypeMask operatorMask = inTreeData.typeOfOperator(node);
-      returnType = handleDynamicSend(node, operatorSelector, operatorMask,
-          getterType, new ArgumentsTypes<T>([rhsType], null));
-    }
-    handleSuperSend(node, setterSelector, setterMask, setter,
-        new ArgumentsTypes<T>([indexType, returnType], null));
-
-    return node.isPostfix ? getterType : returnType;
-  }
-
-  T handleSuperSend(ast.Node node, Selector selector, TypeMask mask,
-      Element element, ArgumentsTypes arguments) {
-    if (element.isMalformed) {
-      return handleSuperNoSuchMethod(node, selector, mask, arguments);
-    } else {
-      return handleStaticSend(node, selector, mask, element, arguments);
-    }
-  }
-
-  @override
-  T visitSuperCompoundIndexSet(
-      ast.SendSet node,
-      MethodElement getter,
-      MethodElement setter,
-      ast.Node index,
-      op.AssignmentOperator operator,
-      ast.Node rhs,
-      _) {
-    return handleSuperCompoundIndexSet(node, getter, setter, index, rhs);
-  }
-
-  @override
-  T visitSuperIndexSetIfNull(ast.SendSet node, MethodElement getter,
-      MethodElement setter, ast.Node index, ast.Node rhs, _) {
-    return handleSuperCompoundIndexSet(node, getter, setter, index, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperCompoundIndexSet(ast.Send node, Element element,
-      ast.Node index, op.AssignmentOperator operator, ast.Node rhs, _) {
-    return handleSuperCompoundIndexSet(node, element, element, index, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperIndexSetIfNull(
-      ast.Send node, Element element, ast.Node index, ast.Node rhs, _) {
-    return handleSuperCompoundIndexSet(node, element, element, index, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperGetterCompoundIndexSet(
-      ast.SendSet node,
-      Element element,
-      MethodElement setter,
-      ast.Node index,
-      op.AssignmentOperator operator,
-      ast.Node rhs,
-      _) {
-    return handleSuperCompoundIndexSet(node, element, setter, index, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperGetterIndexSetIfNull(ast.SendSet node, Element element,
-      MethodElement setter, ast.Node index, ast.Node rhs, _) {
-    return handleSuperCompoundIndexSet(node, element, setter, index, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperSetterCompoundIndexSet(
-      ast.SendSet node,
-      MethodElement getter,
-      Element element,
-      ast.Node index,
-      op.AssignmentOperator operator,
-      ast.Node rhs,
-      _) {
-    return handleSuperCompoundIndexSet(node, getter, element, index, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperSetterIndexSetIfNull(ast.SendSet node,
-      MethodElement getter, Element element, ast.Node index, ast.Node rhs, _) {
-    return handleSuperCompoundIndexSet(node, getter, element, index, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperIndexPrefix(ast.Send node, Element element,
-      ast.Node index, op.IncDecOperator operator, _) {
-    T indexType = visit(index);
-    return handleSuperIndexPrefixPostfix(node, element, element, indexType);
-  }
-
-  @override
-  T visitUnresolvedSuperGetterIndexPrefix(ast.SendSet node, Element element,
-      MethodElement setter, ast.Node index, op.IncDecOperator operator, _) {
-    T indexType = visit(index);
-    return handleSuperIndexPrefixPostfix(node, element, setter, indexType);
-  }
-
-  @override
-  T visitUnresolvedSuperSetterIndexPrefix(
-      ast.SendSet node,
-      MethodElement getter,
-      Element element,
-      ast.Node index,
-      op.IncDecOperator operator,
-      _) {
-    T indexType = visit(index);
-    return handleSuperIndexPrefixPostfix(node, getter, element, indexType);
-  }
-
-  @override
-  T visitUnresolvedSuperIndexPostfix(ast.Send node, Element element,
-      ast.Node index, op.IncDecOperator operator, _) {
-    T indexType = visit(index);
-    return handleSuperIndexPrefixPostfix(node, element, element, indexType);
-  }
-
-  @override
-  T visitUnresolvedSuperGetterIndexPostfix(ast.SendSet node, Element element,
-      MethodElement setter, ast.Node index, op.IncDecOperator operator, _) {
-    T indexType = visit(index);
-    return handleSuperIndexPrefixPostfix(node, element, setter, indexType);
-  }
-
-  @override
-  T visitUnresolvedSuperSetterIndexPostfix(
-      ast.SendSet node,
-      MethodElement getter,
-      Element element,
-      ast.Node index,
-      op.IncDecOperator operator,
-      _) {
-    T indexType = visit(index);
-    return handleSuperIndexPrefixPostfix(node, getter, element, indexType);
-  }
-
-  @override
-  T visitSuperFieldCompound(ast.Send node, FieldElement field,
-      op.AssignmentOperator operator, ast.Node rhs, _) {
-    return handleSuperCompound(node, field, field, rhs);
-  }
-
-  @override
-  T visitSuperFieldSetterCompound(ast.Send node, FieldElement field,
-      FunctionElement setter, op.AssignmentOperator operator, ast.Node rhs, _) {
-    return handleSuperCompound(node, field, setter, rhs);
-  }
-
-  @override
-  T visitSuperGetterFieldCompound(ast.Send node, FunctionElement getter,
-      FieldElement field, op.AssignmentOperator operator, ast.Node rhs, _) {
-    return handleSuperCompound(node, getter, field, rhs);
-  }
-
-  @override
-  T visitSuperGetterSetterCompound(ast.Send node, FunctionElement getter,
-      FunctionElement setter, op.AssignmentOperator operator, ast.Node rhs, _) {
-    return handleSuperCompound(node, getter, setter, rhs);
-  }
-
-  @override
-  T visitSuperMethodSetterCompound(ast.Send node, FunctionElement method,
-      FunctionElement setter, op.AssignmentOperator operator, ast.Node rhs, _) {
-    return handleSuperCompound(node, method, setter, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperCompound(ast.Send node, Element element,
-      op.AssignmentOperator operator, ast.Node rhs, _) {
-    return handleSuperCompound(node, element, element, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperGetterCompound(ast.Send node, Element getter,
-      SetterElement setter, op.AssignmentOperator operator, ast.Node rhs, _) {
-    return handleSuperCompound(node, getter, setter, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperSetterCompound(ast.Send node, GetterElement getter,
-      Element setter, op.AssignmentOperator operator, ast.Node rhs, _) {
-    return handleSuperCompound(node, getter, setter, rhs);
-  }
-
-  @override
-  T visitSuperFieldFieldSetIfNull(ast.Send node, FieldElement readField,
-      FieldElement writtenField, ast.Node rhs, _) {
-    return handleSuperCompound(node, readField, writtenField, rhs);
-  }
-
-  @override
-  T visitSuperFieldSetIfNull(
-      ast.Send node, FieldElement field, ast.Node rhs, _) {
-    return handleSuperCompound(node, field, field, rhs);
-  }
-
-  @override
-  T visitSuperFieldSetterSetIfNull(ast.Send node, FieldElement field,
-      FunctionElement setter, ast.Node rhs, _) {
-    return handleSuperCompound(node, field, setter, rhs);
-  }
-
-  @override
-  T visitSuperGetterFieldSetIfNull(ast.Send node, FunctionElement getter,
-      FieldElement field, ast.Node rhs, _) {
-    return handleSuperCompound(node, getter, field, rhs);
-  }
-
-  @override
-  T visitSuperGetterSetterSetIfNull(ast.Send node, FunctionElement getter,
-      FunctionElement setter, ast.Node rhs, _) {
-    return handleSuperCompound(node, getter, setter, rhs);
-  }
-
-  @override
-  T visitSuperMethodSetIfNull(
-      ast.Send node, FunctionElement method, ast.Node rhs, _) {
-    return handleSuperCompound(node, method, null, rhs);
-  }
-
-  @override
-  T visitSuperMethodSetterSetIfNull(ast.Send node, FunctionElement method,
-      FunctionElement setter, ast.Node rhs, _) {
-    return handleSuperCompound(node, method, setter, rhs);
-  }
-
-  T handleSuperCompound(
-      ast.SendSet node, Element getter, Element setter, ast.Node rhs) {
-    T rhsType = visit(rhs);
-    return _handleSuperCompound(node, getter, setter, rhsType);
-  }
-
-  @override
-  T visitSuperFieldFieldPostfix(ast.SendSet node, FieldElement readField,
-      FieldElement writtenField, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, readField, writtenField);
-  }
-
-  @override
-  T visitSuperFieldFieldPrefix(ast.SendSet node, FieldElement readField,
-      FieldElement writtenField, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, readField, writtenField);
-  }
-
-  @override
-  T visitSuperFieldPostfix(
-      ast.SendSet node, FieldElement field, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, field, field);
-  }
-
-  @override
-  T visitSuperFieldPrefix(
-      ast.SendSet node, FieldElement field, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, field, field);
-  }
-
-  @override
-  T visitSuperFieldSetterPostfix(ast.SendSet node, FieldElement field,
-      FunctionElement setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, field, setter);
-  }
-
-  @override
-  T visitSuperFieldSetterPrefix(ast.SendSet node, FieldElement field,
-      FunctionElement setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, field, setter);
-  }
-
-  @override
-  T visitSuperGetterFieldPostfix(ast.SendSet node, FunctionElement getter,
-      FieldElement field, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, getter, field);
-  }
-
-  @override
-  T visitSuperGetterFieldPrefix(ast.SendSet node, FunctionElement getter,
-      FieldElement field, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, getter, field);
-  }
-
-  @override
-  T visitSuperGetterSetterPostfix(ast.SendSet node, FunctionElement getter,
-      FunctionElement setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, getter, setter);
-  }
-
-  @override
-  T visitSuperGetterSetterPrefix(ast.SendSet node, FunctionElement getter,
-      FunctionElement setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, getter, setter);
-  }
-
-  @override
-  T visitSuperMethodSetterPostfix(ast.SendSet node, FunctionElement method,
-      FunctionElement setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, method, setter);
-  }
-
-  @override
-  T visitSuperMethodSetterPrefix(ast.SendSet node, FunctionElement method,
-      FunctionElement setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, method, setter);
-  }
-
-  @override
-  T visitUnresolvedSuperPrefix(
-      ast.SendSet node, Element element, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, element, element);
-  }
-
-  @override
-  T visitUnresolvedSuperPostfix(
-      ast.SendSet node, Element element, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, element, element);
-  }
-
-  @override
-  T visitUnresolvedSuperGetterPrefix(ast.SendSet node, Element getter,
-      SetterElement setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, getter, setter);
-  }
-
-  @override
-  T visitUnresolvedSuperGetterPostfix(ast.SendSet node, Element getter,
-      SetterElement setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, getter, setter);
-  }
-
-  @override
-  T visitUnresolvedSuperSetterPrefix(ast.SendSet node, GetterElement getter,
-      Element setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, getter, setter);
-  }
-
-  @override
-  T visitUnresolvedSuperSetterPostfix(ast.SendSet node, GetterElement getter,
-      Element setter, op.IncDecOperator operator, _) {
-    return handleSuperPrefixPostfix(node, getter, setter);
-  }
-
-  T handleSuperPrefixPostfix(ast.SendSet node, Element getter, Element setter) {
-    return _handleSuperCompound(node, getter, setter, types.uint31Type);
-  }
-
-  T _handleSuperCompound(
-      ast.SendSet node, Element getter, Element setter, T rhsType) {
-    Selector getterSelector = elements.getGetterSelectorInComplexSendSet(node);
-    TypeMask getterMask = inTreeData.typeOfGetter(node);
-    Selector setterSelector = elements.getSelector(node);
-    TypeMask setterMask = inTreeData.typeOfSend(node);
-
-    T getterType =
-        handleSuperSend(node, getterSelector, getterMask, getter, null);
-
-    T returnType;
-    if (node.isIfNullAssignment) {
-      returnType = types.allocateDiamondPhi(getterType, rhsType);
-    } else {
-      Selector operatorSelector =
-          elements.getOperatorSelectorInComplexSendSet(node);
-      TypeMask operatorMask = inTreeData.typeOfOperator(node);
-      returnType = handleDynamicSend(node, operatorSelector, operatorMask,
-          getterType, new ArgumentsTypes<T>([rhsType], null));
-    }
-    handleSuperSend(node, setterSelector, setterMask, setter,
-        new ArgumentsTypes<T>([returnType], null));
-
-    return node.isPostfix ? getterType : returnType;
-  }
-
-  /// Handle index set, like `foo[0] = 42`.
-  T handleIndexSet(ast.SendSet node, T receiverType, T indexType, T rhsType) {
-    Selector setterSelector = elements.getSelector(node);
-    TypeMask setterMask = inTreeData.typeOfSend(node);
-    handleDynamicSend(node, setterSelector, setterMask, receiverType,
-        new ArgumentsTypes<T>([indexType, rhsType], null));
-    return rhsType;
-  }
-
-  @override
-  T visitIndexSet(
-      ast.SendSet node, ast.Node receiver, ast.Node index, ast.Node rhs, _) {
-    T receiverType = visit(receiver);
-    T indexType = visit(index);
-    T rhsType = visit(rhs);
-    return handleIndexSet(node, receiverType, indexType, rhsType);
-  }
-
-  /// Handle super index set, like `super[42] = true`.
-  T handleSuperIndexSet(
-      ast.SendSet node, Element element, ast.Node index, ast.Node rhs) {
-    T indexType = visit(index);
-    T rhsType = visit(rhs);
-    Selector setterSelector = elements.getSelector(node);
-    TypeMask setterMask = inTreeData.typeOfSend(node);
-    handleStaticSend(node, setterSelector, setterMask, element,
-        new ArgumentsTypes<T>([indexType, rhsType], null));
-    return rhsType;
-  }
-
-  @override
-  T visitSuperIndexSet(ast.SendSet node, FunctionElement function,
-      ast.Node index, ast.Node rhs, _) {
-    return handleSuperIndexSet(node, function, index, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperIndexSet(
-      ast.SendSet node, Element element, ast.Node index, ast.Node rhs, _) {
-    return handleSuperIndexSet(node, element, index, rhs);
-  }
-
-  T handlePlainAssignment(
-      ast.Node node,
-      Element element,
-      Selector setterSelector,
-      TypeMask setterMask,
-      T receiverType,
-      T rhsType,
-      ast.Node rhs) {
-    ArgumentsTypes arguments = new ArgumentsTypes<T>([rhsType], null);
-    if (Elements.isMalformed(element)) {
-      // Code will always throw.
-    } else if (Elements.isStaticOrTopLevelField(element)) {
-      handleStaticSend(node, setterSelector, setterMask, element, arguments);
-    } else if (Elements.isUnresolved(element) || element.isSetter) {
-      if (analyzedElement.isGenerativeConstructor &&
-          (node.asSendSet() != null) &&
-          (node.asSendSet().receiver != null) &&
-          node.asSendSet().receiver.isThis()) {
-        Iterable<Element> targets = compiler.closedWorld.allFunctions.filter(
-            setterSelector, types.newTypedSelector(thisType, setterMask));
-        // We just recognized a field initialization of the form:
-        // `this.foo = 42`. If there is only one target, we can update
-        // its type.
-        if (targets.length == 1) {
-          Element single = targets.first;
-          if (single.isField) {
-            locals.updateField(single, rhsType);
-          }
-        }
-      }
-      handleDynamicSend(
-          node, setterSelector, setterMask, receiverType, arguments);
-    } else if (element.isField) {
-      if (element.isFinal) {
-        inferrer.recordTypeOfFinalField(
-            node, outermostElement, element, rhsType);
-      } else {
-        if (analyzedElement.isGenerativeConstructor) {
-          locals.updateField(element, rhsType);
-        }
-        if (visitingInitializers) {
-          inferrer.recordTypeOfNonFinalField(node, element, rhsType);
-        } else {
-          handleDynamicSend(
-              node, setterSelector, setterMask, receiverType, arguments);
-        }
-      }
-    } else if (element.isLocal) {
-      locals.update(element, rhsType, node);
-    }
-    return rhsType;
-  }
-
-  /// Handle a super access or invocation that results in a `noSuchMethod` call.
-  T handleErroneousSuperSend(ast.Send node) {
-    ArgumentsTypes arguments =
-        node.isPropertyAccess ? null : analyzeArguments(node.arguments);
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    // TODO(herhut): We could do better here if we knew what we
-    // are calling does not expose this.
-    // TODO(johnniwinther): Do we still need this when calling directly?
-    isThisExposed = true;
-    return handleSuperNoSuchMethod(node, selector, mask, arguments);
-  }
-
-  T handleSuperNoSuchMethod(ast.Send node, Selector selector, TypeMask mask,
-      ArgumentsTypes arguments) {
-    // Ensure we create a node, to make explicit the call to the
-    // `noSuchMethod` handler.
-    ClassElement cls = outermostElement.enclosingClass.declaration;
-    MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_);
-    if (!Selectors.noSuchMethod_.signatureApplies(element)) {
-      element = compiler.coreClasses.objectClass
-          .lookupMember(Identifiers.noSuchMethod_);
-    }
-    return handleStaticSend(node, selector, mask, element, arguments);
-  }
-
-  /// Handle a .call invocation on the values retrieved from the super
-  /// [element]. For instance `super.foo(bar)` where `foo` is a field or getter.
-  T handleSuperClosureCall(
-      ast.Send node, Element element, ast.NodeList arguments) {
-    ArgumentsTypes argumentTypes = analyzeArguments(arguments.nodes);
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    // TODO(herhut): We could do better here if we knew what we
-    // are calling does not expose this.
-    isThisExposed = true;
-    return inferrer.registerCalledClosure(
-        node,
-        selector,
-        mask,
-        inferrer.typeOfElement(element),
-        outermostElement,
-        argumentTypes,
-        sideEffects,
-        inLoop);
-  }
-
-  /// Handle an invocation of super [method].
-  T handleSuperMethodInvoke(
-      ast.Send node, MethodElement method, ArgumentsTypes arguments) {
-    // TODO(herhut): We could do better here if we knew what we
-    // are calling does not expose this.
-    isThisExposed = true;
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    return handleStaticSend(node, selector, mask, method, arguments);
-  }
-
-  /// Handle access to a super field or getter [element].
-  T handleSuperGet(ast.Send node, Element element) {
-    // TODO(herhut): We could do better here if we knew what we
-    // are calling does not expose this.
-    isThisExposed = true;
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    return handleStaticSend(node, selector, mask, element, null);
-  }
-
-  /// Handle update to a super field or setter [element].
-  T handleSuperSet(ast.Send node, Element element, ast.Node rhs) {
-    T rhsType = visit(rhs);
-    // TODO(herhut): We could do better here if we knew what we
-    // are calling does not expose this.
-    isThisExposed = true;
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    handleStaticSend(
-        node, selector, mask, element, new ArgumentsTypes<T>([rhsType], null));
-    return rhsType;
-  }
-
-  @override
-  T visitSuperFieldSet(ast.Send node, FieldElement method, ast.Node rhs, _) {
-    return handleSuperSet(node, method, rhs);
-  }
-
-  @override
-  T visitSuperSetterSet(ast.Send node, SetterElement field, ast.Node rhs, _) {
-    return handleSuperSet(node, field, rhs);
-  }
-
-  @override
-  T visitUnresolvedSuperIndex(
-      ast.Send node, Element element, ast.Node index, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitUnresolvedSuperUnary(
-      ast.Send node, op.UnaryOperator operator, Element element, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitUnresolvedSuperBinary(ast.Send node, Element element,
-      op.BinaryOperator operator, ast.Node argument, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitUnresolvedSuperGet(ast.Send node, Element element, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitSuperSetterGet(ast.Send node, MethodElement setter, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitSuperGetterSet(ast.Send node, MethodElement getter, ast.Node rhs, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitSuperMethodSet(ast.Send node, MethodElement method, ast.Node rhs, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitFinalSuperFieldSet(
-      ast.Send node, FieldElement method, ast.Node rhs, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitUnresolvedSuperSet(ast.Send node, Element element, ast.Node rhs, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitUnresolvedSuperInvoke(
-      ast.Send node, Element element, ast.Node argument, Selector selector, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitSuperFieldGet(ast.Send node, FieldElement field, _) {
-    return handleSuperGet(node, field);
-  }
-
-  @override
-  T visitSuperGetterGet(ast.Send node, MethodElement method, _) {
-    return handleSuperGet(node, method);
-  }
-
-  @override
-  T visitSuperMethodGet(ast.Send node, MethodElement method, _) {
-    return handleSuperGet(node, method);
-  }
-
-  @override
-  T visitSuperFieldInvoke(ast.Send node, FieldElement field,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleSuperClosureCall(node, field, arguments);
-  }
-
-  @override
-  T visitSuperGetterInvoke(ast.Send node, MethodElement getter,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleSuperClosureCall(node, getter, arguments);
-  }
-
-  @override
-  T visitSuperMethodInvoke(ast.Send node, MethodElement method,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleSuperMethodInvoke(
-        node, method, analyzeArguments(arguments.nodes));
-  }
-
-  @override
-  T visitSuperSetterInvoke(ast.Send node, FunctionElement setter,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  @override
-  T visitSuperIndex(ast.Send node, MethodElement method, ast.Node index, _) {
-    return handleSuperMethodInvoke(
-        node, method, analyzeArguments(node.arguments));
-  }
-
-  @override
-  T visitSuperEquals(
-      ast.Send node, MethodElement method, ast.Node argument, _) {
-    // TODO(johnniwinther): Special case ==.
-    return handleSuperMethodInvoke(
-        node, method, analyzeArguments(node.arguments));
-  }
-
-  @override
-  T visitSuperNotEquals(
-      ast.Send node, MethodElement method, ast.Node argument, _) {
-    // TODO(johnniwinther): Special case !=.
-    return handleSuperMethodInvoke(
-        node, method, analyzeArguments(node.arguments));
-  }
-
-  @override
-  T visitSuperBinary(ast.Send node, MethodElement method,
-      op.BinaryOperator operator, ast.Node argument, _) {
-    return handleSuperMethodInvoke(
-        node, method, analyzeArguments(node.arguments));
-  }
-
-  @override
-  T visitSuperUnary(
-      ast.Send node, op.UnaryOperator operator, MethodElement method, _) {
-    return handleSuperMethodInvoke(
-        node, method, analyzeArguments(node.arguments));
-  }
-
-  @override
-  T visitSuperMethodIncompatibleInvoke(ast.Send node, MethodElement method,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleErroneousSuperSend(node);
-  }
-
-  // Try to find the length given to a fixed array constructor call.
-  int findLength(ast.Send node) {
-    ast.Node firstArgument = node.arguments.head;
-    Element element = elements[firstArgument];
-    ast.LiteralInt length = firstArgument.asLiteralInt();
-    if (length != null) {
-      return length.value;
-    } else if (element != null &&
-        element.isField &&
-        Elements.isStaticOrTopLevelField(element) &&
-        compiler.closedWorld.fieldNeverChanges(element)) {
-      FieldElement fieldElement = element;
-      ConstantValue value =
-          compiler.backend.constants.getConstantValue(fieldElement.constant);
-      if (value != null && value.isInt) {
-        IntConstantValue intValue = value;
-        return intValue.primitiveValue;
-      }
-    }
-    return null;
-  }
-
-  T visitAwait(ast.Await node) {
-    T futureType = node.expression.accept(this);
-    return inferrer.registerAwait(node, futureType);
-  }
-
-  @override
-  T handleTypeLiteralInvoke(ast.NodeList arguments) {
-    // This is reached when users forget to put a `new` in front of a type
-    // literal. The emitter will generate an actual call (even though it is
-    // likely invalid), and for that it needs to have the arguments processed
-    // as well.
-    analyzeArguments(arguments.nodes);
-    return super.handleTypeLiteralInvoke(arguments);
-  }
-
-  /// Handle constructor invocation of [constructor].
-  T handleConstructorSend(ast.Send node, ConstructorElement constructor) {
-    ConstructorElement target = constructor.implementation;
-    ArgumentsTypes arguments = analyzeArguments(node.arguments);
-    if (visitingInitializers) {
-      if (ast.Initializers.isConstructorRedirect(node)) {
-        isConstructorRedirect = true;
-      } else if (ast.Initializers.isSuperConstructorCall(node)) {
-        seenSuperConstructorCall = true;
-        analyzeSuperConstructorCall(constructor, arguments);
-      }
-    }
-    // If we are looking at a new expression on a forwarding factory, we have to
-    // forward the call to the effective target of the factory.
-    // TODO(herhut): Remove the loop once effectiveTarget forwards to patches.
-    while (target.isFactoryConstructor) {
-      if (!target.isRedirectingFactory) break;
-      target = target.effectiveTarget.implementation;
-    }
-    if (compiler.backend.isForeign(target)) {
-      return handleForeignSend(node, target);
-    }
-    Selector selector = elements.getSelector(node);
-    CallStructure callStructure = selector.callStructure;
-    TypeMask mask = inTreeData.typeOfSend(node);
-    // In erroneous code the number of arguments in the selector might not
-    // match the function element.
-    // TODO(polux): return nonNullEmpty and check it doesn't break anything
-    if (target.isMalformed ||
-        !callStructure.signatureApplies(target.functionSignature)) {
-      return types.dynamicType;
-    }
-
-    T returnType = handleStaticSend(node, selector, mask, target, arguments);
-    if (Elements.isGrowableListConstructorCall(constructor, node, compiler)) {
-      return inferrer.concreteTypes.putIfAbsent(
-          node,
-          () => types.allocateList(types.growableListType, node,
-              outermostElement, types.nonNullEmpty(), 0));
-    } else if (Elements.isFixedListConstructorCall(
-            constructor, node, compiler) ||
-        Elements.isFilledListConstructorCall(constructor, node, compiler)) {
-      int length = findLength(node);
-      T elementType =
-          Elements.isFixedListConstructorCall(constructor, node, compiler)
-              ? types.nullType
-              : arguments.positional[1];
-
-      return inferrer.concreteTypes.putIfAbsent(
-          node,
-          () => types.allocateList(types.fixedListType, node, outermostElement,
-              elementType, length));
-    } else if (Elements.isConstructorOfTypedArraySubclass(
-        constructor, compiler)) {
-      int length = findLength(node);
-      T elementType = inferrer
-          .returnTypeOfElement(target.enclosingClass.lookupMember('[]'));
-      return inferrer.concreteTypes.putIfAbsent(
-          node,
-          () => types.allocateList(types.nonNullExact(target.enclosingClass),
-              node, outermostElement, elementType, length));
-    } else {
-      return returnType;
-    }
-  }
-
-  @override
-  T bulkHandleNew(ast.NewExpression node, _) {
-    Element element = elements[node.send];
-    return handleConstructorSend(node.send, element);
-  }
-
-  @override
-  T errorNonConstantConstructorInvoke(ast.NewExpression node, Element element,
-      DartType type, ast.NodeList arguments, CallStructure callStructure, _) {
-    return bulkHandleNew(node, _);
-  }
-
-  /// Handle invocation of a top level or static field or getter [element].
-  T handleStaticFieldOrGetterInvoke(ast.Send node, Element element) {
-    ArgumentsTypes arguments = analyzeArguments(node.arguments);
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    handleStaticSend(node, selector, mask, element, arguments);
-    return inferrer.registerCalledClosure(
-        node,
-        selector,
-        mask,
-        inferrer.typeOfElement(element),
-        outermostElement,
-        arguments,
-        sideEffects,
-        inLoop);
-  }
-
-  /// Handle invocation of a top level or static [function].
-  T handleStaticFunctionInvoke(ast.Send node, MethodElement function) {
-    if (compiler.backend.isForeign(function)) {
-      return handleForeignSend(node, function);
-    }
-    ArgumentsTypes arguments = analyzeArguments(node.arguments);
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    return handleStaticSend(node, selector, mask, function, arguments);
-  }
-
-  /// Handle an static invocation of an unresolved target or with incompatible
-  /// arguments to a resolved target.
-  T handleInvalidStaticInvoke(ast.Send node) {
-    analyzeArguments(node.arguments);
-    return types.dynamicType;
-  }
-
-  @override
-  T visitStaticFieldInvoke(ast.Send node, FieldElement field,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleStaticFieldOrGetterInvoke(node, field);
-  }
-
-  @override
-  T visitStaticFunctionInvoke(ast.Send node, MethodElement function,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleStaticFunctionInvoke(node, function);
-  }
-
-  @override
-  T visitStaticFunctionIncompatibleInvoke(ast.Send node, MethodElement function,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleInvalidStaticInvoke(node);
-  }
-
-  @override
-  T visitStaticGetterInvoke(ast.Send node, FunctionElement getter,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleStaticFieldOrGetterInvoke(node, getter);
-  }
-
-  @override
-  T visitTopLevelFieldInvoke(ast.Send node, FieldElement field,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleStaticFieldOrGetterInvoke(node, field);
-  }
-
-  @override
-  T visitTopLevelFunctionInvoke(ast.Send node, MethodElement function,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleStaticFunctionInvoke(node, function);
-  }
-
-  @override
-  T visitTopLevelFunctionIncompatibleInvoke(
-      ast.Send node,
-      MethodElement function,
-      ast.NodeList arguments,
-      CallStructure callStructure,
-      _) {
-    return handleInvalidStaticInvoke(node);
-  }
-
-  @override
-  T visitTopLevelGetterInvoke(ast.Send node, FunctionElement getter,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleStaticFieldOrGetterInvoke(node, getter);
-  }
-
-  @override
-  T visitStaticSetterInvoke(ast.Send node, MethodElement setter,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleInvalidStaticInvoke(node);
-  }
-
-  @override
-  T visitTopLevelSetterInvoke(ast.Send node, MethodElement setter,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleInvalidStaticInvoke(node);
-  }
-
-  @override
-  T visitUnresolvedInvoke(ast.Send node, Element element,
-      ast.NodeList arguments, Selector selector, _) {
-    return handleInvalidStaticInvoke(node);
-  }
-
-  T handleForeignSend(ast.Send node, Element element) {
-    ArgumentsTypes arguments = analyzeArguments(node.arguments);
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    String name = element.name;
-    handleStaticSend(node, selector, mask, element, arguments);
-    if (name == BackendHelpers.JS ||
-        name == BackendHelpers.JS_EMBEDDED_GLOBAL ||
-        name == BackendHelpers.JS_BUILTIN) {
-      native.NativeBehavior nativeBehavior = elements.getNativeData(node);
-      sideEffects.add(nativeBehavior.sideEffects);
-      return inferrer.typeOfNativeBehavior(nativeBehavior);
-    } else if (name == 'JS_OPERATOR_AS_PREFIX' || name == 'JS_STRING_CONCAT') {
-      return types.stringType;
-    } else {
-      sideEffects.setAllSideEffects();
-      return types.dynamicType;
-    }
-  }
-
-  ArgumentsTypes analyzeArguments(Link<ast.Node> arguments) {
-    List<T> positional = [];
-    Map<String, T> named;
-    for (var argument in arguments) {
-      ast.NamedArgument namedArgument = argument.asNamedArgument();
-      if (namedArgument != null) {
-        argument = namedArgument.expression;
-        if (named == null) named = new Map<String, T>();
-        named[namedArgument.name.source] = argument.accept(this);
-      } else {
-        positional.add(argument.accept(this));
-      }
-      // TODO(ngeoffray): We could do better here if we knew what we
-      // are calling does not expose this.
-      isThisExposed = isThisExposed || argument.isThis();
-    }
-    return new ArgumentsTypes<T>(positional, named);
-  }
-
-  /// Read a local variable, function or parameter.
-  T handleLocalGet(ast.Send node, LocalElement local) {
-    assert(locals.use(local) != null);
-    return locals.use(local);
-  }
-
-  /// Read a static or top level field.
-  T handleStaticFieldGet(ast.Send node, FieldElement field) {
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    return handleStaticSend(node, selector, mask, field, null);
-  }
-
-  /// Invoke a static or top level getter.
-  T handleStaticGetterGet(ast.Send node, MethodElement getter) {
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    return handleStaticSend(node, selector, mask, getter, null);
-  }
-
-  /// Closurize a static or top level function.
-  T handleStaticFunctionGet(ast.Send node, MethodElement function) {
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    return handleStaticSend(node, selector, mask, function, null);
-  }
-
-  @override
-  T visitDynamicPropertyGet(ast.Send node, ast.Node receiver, Name name, _) {
-    return handleDynamicGet(node);
-  }
-
-  @override
-  T visitIfNotNullDynamicPropertyGet(
-      ast.Send node, ast.Node receiver, Name name, _) {
-    return handleDynamicGet(node);
-  }
-
-  @override
-  T visitLocalVariableGet(ast.Send node, LocalVariableElement variable, _) {
-    return handleLocalGet(node, variable);
-  }
-
-  @override
-  T visitParameterGet(ast.Send node, ParameterElement parameter, _) {
-    return handleLocalGet(node, parameter);
-  }
-
-  @override
-  T visitLocalFunctionGet(ast.Send node, LocalFunctionElement function, _) {
-    return handleLocalGet(node, function);
-  }
-
-  @override
-  T visitStaticFieldGet(ast.Send node, FieldElement field, _) {
-    return handleStaticFieldGet(node, field);
-  }
-
-  @override
-  T visitStaticFunctionGet(ast.Send node, MethodElement function, _) {
-    return handleStaticFunctionGet(node, function);
-  }
-
-  @override
-  T visitStaticGetterGet(ast.Send node, FunctionElement getter, _) {
-    return handleStaticGetterGet(node, getter);
-  }
-
-  @override
-  T visitThisPropertyGet(ast.Send node, Name name, _) {
-    return handleDynamicGet(node);
-  }
-
-  @override
-  T visitTopLevelFieldGet(ast.Send node, FieldElement field, _) {
-    return handleStaticFieldGet(node, field);
-  }
-
-  @override
-  T visitTopLevelFunctionGet(ast.Send node, MethodElement function, _) {
-    return handleStaticFunctionGet(node, function);
-  }
-
-  @override
-  T visitTopLevelGetterGet(ast.Send node, FunctionElement getter, _) {
-    return handleStaticGetterGet(node, getter);
-  }
-
-  @override
-  T visitStaticSetterGet(ast.Send node, MethodElement setter, _) {
-    return types.dynamicType;
-  }
-
-  @override
-  T visitTopLevelSetterGet(ast.Send node, MethodElement setter, _) {
-    return types.dynamicType;
-  }
-
-  @override
-  T visitUnresolvedGet(ast.Send node, Element element, _) {
-    return types.dynamicType;
-  }
-
-  /// Handle .call invocation on [closure].
-  T handleCallInvoke(ast.Send node, T closure) {
-    ArgumentsTypes arguments = analyzeArguments(node.arguments);
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    return inferrer.registerCalledClosure(node, selector, mask, closure,
-        outermostElement, arguments, sideEffects, inLoop);
-  }
-
-  @override
-  T visitExpressionInvoke(ast.Send node, ast.Node expression,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleCallInvoke(node, expression.accept(this));
-  }
-
-  @override
-  T visitThisInvoke(
-      ast.Send node, ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleCallInvoke(node, thisType);
-  }
-
-  @override
-  T visitParameterInvoke(ast.Send node, ParameterElement parameter,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleCallInvoke(node, locals.use(parameter));
-  }
-
-  @override
-  T visitLocalVariableInvoke(ast.Send node, LocalVariableElement variable,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    return handleCallInvoke(node, locals.use(variable));
-  }
-
-  @override
-  T visitLocalFunctionInvoke(ast.Send node, LocalFunctionElement function,
-      ast.NodeList arguments, CallStructure callStructure, _) {
-    ArgumentsTypes argumentTypes = analyzeArguments(node.arguments);
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    // This only works for function statements. We need a
-    // more sophisticated type system with function types to support
-    // more.
-    return inferrer.registerCalledElement(node, selector, mask,
-        outermostElement, function, argumentTypes, sideEffects, inLoop);
-  }
-
-  @override
-  T visitLocalFunctionIncompatibleInvoke(
-      ast.Send node,
-      LocalFunctionElement function,
-      ast.NodeList arguments,
-      CallStructure callStructure,
-      _) {
-    analyzeArguments(node.arguments);
-    return types.dynamicType;
-  }
-
-  T handleStaticSend(ast.Node node, Selector selector, TypeMask mask,
-      Element element, ArgumentsTypes arguments) {
-    assert(!element.isFactoryConstructor ||
-        !(element as ConstructorElement).isRedirectingFactory);
-    // Erroneous elements may be unresolved, for example missing getters.
-    if (Elements.isUnresolved(element)) return types.dynamicType;
-    // TODO(herhut): should we follow redirecting constructors here? We would
-    // need to pay attention if the constructor is pointing to an erroneous
-    // element.
-    return inferrer.registerCalledElement(node, selector, mask,
-        outermostElement, element, arguments, sideEffects, inLoop);
-  }
-
-  T handleDynamicSend(ast.Node node, Selector selector, TypeMask mask,
-      T receiverType, ArgumentsTypes arguments) {
-    assert(receiverType != null);
-    if (types.selectorNeedsUpdate(receiverType, mask)) {
-      mask = receiverType == types.dynamicType
-          ? null
-          : types.newTypedSelector(receiverType, mask);
-      inferrer.updateSelectorInTree(analyzedElement, node, selector, mask);
-    }
-
-    // If the receiver of the call is a local, we may know more about
-    // its type by refining it with the potential targets of the
-    // calls.
-    ast.Send send = node.asSend();
-    if (send != null) {
-      ast.Node receiver = send.receiver;
-      if (receiver != null) {
-        Element element = elements[receiver];
-        if (Elements.isLocal(element) && !capturedVariables.contains(element)) {
-          T refinedType = types.refineReceiver(
-              selector, mask, receiverType, send.isConditional);
-          locals.update(element, refinedType, node);
-        }
-      }
-    }
-
-    return inferrer.registerCalledSelector(node, selector, mask, receiverType,
-        outermostElement, arguments, sideEffects, inLoop);
-  }
-
-  T handleDynamicInvoke(ast.Send node) {
-    return _handleDynamicSend(node);
-  }
-
-  T handleDynamicGet(ast.Send node) {
-    return _handleDynamicSend(node);
-  }
-
-  T _handleDynamicSend(ast.Send node) {
-    Element element = elements[node];
-    T receiverType;
-    bool isCallOnThis = false;
-    if (node.receiver == null) {
-      if (treatAsInstanceMember(element)) {
-        isCallOnThis = true;
-        receiverType = thisType;
-      }
-    } else {
-      ast.Node receiver = node.receiver;
-      isCallOnThis = isThisOrSuper(receiver);
-      receiverType = visit(receiver);
-    }
-
-    Selector selector = elements.getSelector(node);
-    TypeMask mask = inTreeData.typeOfSend(node);
-    if (!isThisExposed && isCallOnThis) {
-      checkIfExposesThis(selector, types.newTypedSelector(receiverType, mask));
-    }
-
-    ArgumentsTypes arguments =
-        node.isPropertyAccess ? null : analyzeArguments(node.arguments);
-    if (selector.name == '==' || selector.name == '!=') {
-      if (types.isNull(receiverType)) {
-        potentiallyAddNullCheck(node, node.arguments.head);
-        return types.boolType;
-      } else if (types.isNull(arguments.positional[0])) {
-        potentiallyAddNullCheck(node, node.receiver);
-        return types.boolType;
-      }
-    }
-    return handleDynamicSend(node, selector, mask, receiverType, arguments);
-  }
-
-  void recordReturnType(T type) {
-    returnType = inferrer.addReturnTypeFor(analyzedElement, returnType, type);
-  }
-
-  T synthesizeForwardingCall(Spannable node, FunctionElement element) {
-    element = element.implementation;
-    FunctionElement function = analyzedElement;
-    FunctionSignature signature = function.functionSignature;
-    FunctionSignature calleeSignature = element.functionSignature;
-    if (!calleeSignature.isCompatibleWith(signature)) {
-      return types.nonNullEmpty();
-    }
-
-    List<T> unnamed = <T>[];
-    signature.forEachRequiredParameter((ParameterElement element) {
-      assert(locals.use(element) != null);
-      unnamed.add(locals.use(element));
-    });
-
-    Map<String, T> named;
-    if (signature.optionalParametersAreNamed) {
-      named = new Map<String, T>();
-      signature.forEachOptionalParameter((ParameterElement element) {
-        named[element.name] = locals.use(element);
-      });
-    } else {
-      signature.forEachOptionalParameter((ParameterElement element) {
-        unnamed.add(locals.use(element));
-      });
-    }
-
-    ArgumentsTypes arguments = new ArgumentsTypes<T>(unnamed, named);
-    return inferrer.registerCalledElement(node, null, null, outermostElement,
-        element, arguments, sideEffects, inLoop);
-  }
-
-  T visitRedirectingFactoryBody(ast.RedirectingFactoryBody node) {
-    Element element = elements.getRedirectingTargetConstructor(node);
-    if (Elements.isMalformed(element)) {
-      recordReturnType(types.dynamicType);
-    } else {
-      // We don't create a selector for redirecting factories, and
-      // the send is just a property access. Therefore we must
-      // manually create the [ArgumentsTypes] of the call, and
-      // manually register [analyzedElement] as a caller of [element].
-      T mask = synthesizeForwardingCall(node.constructorReference, element);
-      recordReturnType(mask);
-    }
-    locals.seenReturnOrThrow = true;
-    return null;
-  }
-
-  T visitReturn(ast.Return node) {
-    ast.Node expression = node.expression;
-    recordReturnType(
-        expression == null ? types.nullType : expression.accept(this));
-    locals.seenReturnOrThrow = true;
-    return null;
-  }
-
-  T handleForInLoop(ast.ForIn node, T iteratorType, Selector currentSelector,
-      TypeMask currentMask, Selector moveNextSelector, TypeMask moveNextMask) {
-    handleDynamicSend(node, moveNextSelector, moveNextMask, iteratorType,
-        new ArgumentsTypes<T>.empty());
-    T currentType = handleDynamicSend(node, currentSelector, currentMask,
-        iteratorType, new ArgumentsTypes<T>.empty());
-
-    if (node.expression.isThis()) {
-      // Any reasonable implementation of an iterator would expose
-      // this, so we play it safe and assume it will.
-      isThisExposed = true;
-    }
-
-    ast.Node identifier = node.declaredIdentifier;
-    Element element = elements.getForInVariable(node);
-    Selector selector = elements.getSelector(identifier);
-    TypeMask mask = inTreeData.typeOfSend(identifier);
-
-    T receiverType;
-    if (element != null && element.isInstanceMember) {
-      receiverType = thisType;
-    } else {
-      receiverType = types.dynamicType;
-    }
-
-    handlePlainAssignment(identifier, element, selector, mask, receiverType,
-        currentType, node.expression);
-    return handleLoop(node, () {
-      visit(node.body);
-    });
-  }
-
-  T visitAsyncForIn(ast.AsyncForIn node) {
-    T expressionType = visit(node.expression);
-
-    Selector currentSelector = Selectors.current;
-    TypeMask currentMask = inTreeData.typeOfIteratorCurrent(node);
-    Selector moveNextSelector = Selectors.moveNext;
-    TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node);
-
-    js.JavaScriptBackend backend = compiler.backend;
-    Element ctor = backend.helpers.streamIteratorConstructor;
-
-    /// Synthesize a call to the [StreamIterator] constructor.
-    T iteratorType = handleStaticSend(
-        node, null, null, ctor, new ArgumentsTypes<T>([expressionType], null));
-
-    return handleForInLoop(node, iteratorType, currentSelector, currentMask,
-        moveNextSelector, moveNextMask);
-  }
-
-  T visitSyncForIn(ast.SyncForIn node) {
-    T expressionType = visit(node.expression);
-    Selector iteratorSelector = Selectors.iterator;
-    TypeMask iteratorMask = inTreeData.typeOfIterator(node);
-    Selector currentSelector = Selectors.current;
-    TypeMask currentMask = inTreeData.typeOfIteratorCurrent(node);
-    Selector moveNextSelector = Selectors.moveNext;
-    TypeMask moveNextMask = inTreeData.typeOfIteratorMoveNext(node);
-
-    T iteratorType = handleDynamicSend(node, iteratorSelector, iteratorMask,
-        expressionType, new ArgumentsTypes<T>.empty());
-
-    return handleForInLoop(node, iteratorType, currentSelector, currentMask,
-        moveNextSelector, moveNextMask);
-  }
-}
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
index 8024e52..1afa2d3 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_dump.dart
@@ -7,7 +7,7 @@
 
 import '../elements/elements.dart';
 import '../types/types.dart';
-import 'type_graph_inferrer.dart';
+import 'inferrer_engine.dart';
 import 'type_graph_nodes.dart';
 
 /// Dumps the type inference graph in Graphviz Dot format into the `typegraph`
@@ -29,7 +29,7 @@
 class TypeGraphDump {
   static const String outputDir = 'typegraph';
 
-  final TypeGraphInferrerEngine inferrer;
+  final InferrerEngine inferrer;
   final Map<TypeInformation, Set<TypeInformation>> assignmentsBeforeAnalysis =
       <TypeInformation, Set<TypeInformation>>{};
   final Map<TypeInformation, Set<TypeInformation>> assignmentsBeforeTracing =
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
index 67f2aa0..0155c28 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_inferrer.dart
@@ -7,524 +7,17 @@
 import 'dart:collection' show Queue;
 
 import '../common.dart';
-import '../common/names.dart' show Identifiers;
 import '../compiler.dart' show Compiler;
-import '../constants/expressions.dart' show ConstantExpression;
-import '../constants/values.dart';
-import '../dart_types.dart' show DartType;
 import '../elements/elements.dart';
-import '../js_backend/js_backend.dart' show Annotations, JavaScriptBackend;
-import '../resolution/tree_elements.dart' show TreeElementMapping;
-import '../tree/dartstring.dart' show DartString;
-import '../tree/tree.dart' as ast show Node, LiteralBool, TryStatement;
-import '../types/constants.dart' show computeTypeMask;
+import '../tree/tree.dart' as ast show Node;
 import '../types/masks.dart'
     show CommonMasks, ContainerTypeMask, MapTypeMask, TypeMask;
 import '../types/types.dart' show TypesInferrer;
-import '../universe/call_structure.dart' show CallStructure;
 import '../universe/selector.dart' show Selector;
-import '../universe/side_effects.dart' show SideEffects;
-import '../util/util.dart' show Setlet;
-import '../world.dart' show ClosedWorld;
-import 'closure_tracer.dart';
-import 'debug.dart' as debug;
-import 'inferrer_visitor.dart' show ArgumentsTypes, TypeSystem;
-import 'list_tracer.dart';
-import 'map_tracer.dart';
-import 'simple_types_inferrer.dart';
-import 'type_graph_dump.dart';
+import '../world.dart' show ClosedWorld, ClosedWorldRefiner;
+import 'inferrer_engine.dart';
 import 'type_graph_nodes.dart';
 
-class TypeInformationSystem extends TypeSystem<TypeInformation> {
-  final Compiler compiler;
-  final ClosedWorld closedWorld;
-  final CommonMasks commonMasks;
-
-  /// [ElementTypeInformation]s for elements.
-  final Map<Element, TypeInformation> typeInformations =
-      new Map<Element, TypeInformation>();
-
-  /// [ListTypeInformation] for allocated lists.
-  final Map<ast.Node, TypeInformation> allocatedLists =
-      new Map<ast.Node, TypeInformation>();
-
-  /// [MapTypeInformation] for allocated Maps.
-  final Map<ast.Node, TypeInformation> allocatedMaps =
-      new Map<ast.Node, TypeInformation>();
-
-  /// Closures found during the analysis.
-  final Set<TypeInformation> allocatedClosures = new Set<TypeInformation>();
-
-  /// Cache of [ConcreteTypeInformation].
-  final Map<TypeMask, TypeInformation> concreteTypes =
-      new Map<TypeMask, TypeInformation>();
-
-  /// List of [TypeInformation]s allocated inside method bodies (calls,
-  /// narrowing, phis, and containers).
-  final List<TypeInformation> allocatedTypes = <TypeInformation>[];
-
-  Iterable<TypeInformation> get allTypes => [
-        typeInformations.values,
-        allocatedLists.values,
-        allocatedMaps.values,
-        allocatedClosures,
-        concreteTypes.values,
-        allocatedTypes
-      ].expand((x) => x);
-
-  TypeInformationSystem(Compiler compiler, this.commonMasks)
-      : this.compiler = compiler,
-        this.closedWorld = compiler.closedWorld {
-    nonNullEmptyType = getConcreteTypeFor(const TypeMask.nonNullEmpty());
-  }
-
-  /// Used to group [TypeInformation] nodes by the element that triggered their
-  /// creation.
-  MemberTypeInformation _currentMember = null;
-  MemberTypeInformation get currentMember => _currentMember;
-
-  void withMember(MemberElement element, action) {
-    assert(invariant(element, _currentMember == null,
-        message: "Already constructing graph for $_currentMember."));
-    _currentMember = getInferredTypeOf(element);
-    action();
-    _currentMember = null;
-  }
-
-  TypeInformation nullTypeCache;
-  TypeInformation get nullType {
-    if (nullTypeCache != null) return nullTypeCache;
-    return nullTypeCache = getConcreteTypeFor(commonMasks.nullType);
-  }
-
-  TypeInformation intTypeCache;
-  TypeInformation get intType {
-    if (intTypeCache != null) return intTypeCache;
-    return intTypeCache = getConcreteTypeFor(commonMasks.intType);
-  }
-
-  TypeInformation uint32TypeCache;
-  TypeInformation get uint32Type {
-    if (uint32TypeCache != null) return uint32TypeCache;
-    return uint32TypeCache = getConcreteTypeFor(commonMasks.uint32Type);
-  }
-
-  TypeInformation uint31TypeCache;
-  TypeInformation get uint31Type {
-    if (uint31TypeCache != null) return uint31TypeCache;
-    return uint31TypeCache = getConcreteTypeFor(commonMasks.uint31Type);
-  }
-
-  TypeInformation positiveIntTypeCache;
-  TypeInformation get positiveIntType {
-    if (positiveIntTypeCache != null) return positiveIntTypeCache;
-    return positiveIntTypeCache =
-        getConcreteTypeFor(commonMasks.positiveIntType);
-  }
-
-  TypeInformation doubleTypeCache;
-  TypeInformation get doubleType {
-    if (doubleTypeCache != null) return doubleTypeCache;
-    return doubleTypeCache = getConcreteTypeFor(commonMasks.doubleType);
-  }
-
-  TypeInformation numTypeCache;
-  TypeInformation get numType {
-    if (numTypeCache != null) return numTypeCache;
-    return numTypeCache = getConcreteTypeFor(commonMasks.numType);
-  }
-
-  TypeInformation boolTypeCache;
-  TypeInformation get boolType {
-    if (boolTypeCache != null) return boolTypeCache;
-    return boolTypeCache = getConcreteTypeFor(commonMasks.boolType);
-  }
-
-  TypeInformation functionTypeCache;
-  TypeInformation get functionType {
-    if (functionTypeCache != null) return functionTypeCache;
-    return functionTypeCache = getConcreteTypeFor(commonMasks.functionType);
-  }
-
-  TypeInformation listTypeCache;
-  TypeInformation get listType {
-    if (listTypeCache != null) return listTypeCache;
-    return listTypeCache = getConcreteTypeFor(commonMasks.listType);
-  }
-
-  TypeInformation constListTypeCache;
-  TypeInformation get constListType {
-    if (constListTypeCache != null) return constListTypeCache;
-    return constListTypeCache = getConcreteTypeFor(commonMasks.constListType);
-  }
-
-  TypeInformation fixedListTypeCache;
-  TypeInformation get fixedListType {
-    if (fixedListTypeCache != null) return fixedListTypeCache;
-    return fixedListTypeCache = getConcreteTypeFor(commonMasks.fixedListType);
-  }
-
-  TypeInformation growableListTypeCache;
-  TypeInformation get growableListType {
-    if (growableListTypeCache != null) return growableListTypeCache;
-    return growableListTypeCache =
-        getConcreteTypeFor(commonMasks.growableListType);
-  }
-
-  TypeInformation mapTypeCache;
-  TypeInformation get mapType {
-    if (mapTypeCache != null) return mapTypeCache;
-    return mapTypeCache = getConcreteTypeFor(commonMasks.mapType);
-  }
-
-  TypeInformation constMapTypeCache;
-  TypeInformation get constMapType {
-    if (constMapTypeCache != null) return constMapTypeCache;
-    return constMapTypeCache = getConcreteTypeFor(commonMasks.constMapType);
-  }
-
-  TypeInformation stringTypeCache;
-  TypeInformation get stringType {
-    if (stringTypeCache != null) return stringTypeCache;
-    return stringTypeCache = getConcreteTypeFor(commonMasks.stringType);
-  }
-
-  TypeInformation typeTypeCache;
-  TypeInformation get typeType {
-    if (typeTypeCache != null) return typeTypeCache;
-    return typeTypeCache = getConcreteTypeFor(commonMasks.typeType);
-  }
-
-  TypeInformation dynamicTypeCache;
-  TypeInformation get dynamicType {
-    if (dynamicTypeCache != null) return dynamicTypeCache;
-    return dynamicTypeCache = getConcreteTypeFor(commonMasks.dynamicType);
-  }
-
-  TypeInformation asyncFutureTypeCache;
-  TypeInformation get asyncFutureType {
-    if (asyncFutureTypeCache != null) return asyncFutureTypeCache;
-    return asyncFutureTypeCache =
-        getConcreteTypeFor(commonMasks.asyncFutureType);
-  }
-
-  TypeInformation syncStarIterableTypeCache;
-  TypeInformation get syncStarIterableType {
-    if (syncStarIterableTypeCache != null) return syncStarIterableTypeCache;
-    return syncStarIterableTypeCache =
-        getConcreteTypeFor(commonMasks.syncStarIterableType);
-  }
-
-  TypeInformation asyncStarStreamTypeCache;
-  TypeInformation get asyncStarStreamType {
-    if (asyncStarStreamTypeCache != null) return asyncStarStreamTypeCache;
-    return asyncStarStreamTypeCache =
-        getConcreteTypeFor(commonMasks.asyncStarStreamType);
-  }
-
-  TypeInformation nonNullEmptyType;
-
-  TypeInformation stringLiteralType(DartString value) {
-    return new StringLiteralTypeInformation(value, commonMasks.stringType);
-  }
-
-  TypeInformation boolLiteralType(ast.LiteralBool value) {
-    return new BoolLiteralTypeInformation(value, commonMasks.boolType);
-  }
-
-  TypeInformation computeLUB(
-      TypeInformation firstType, TypeInformation secondType) {
-    if (firstType == null) return secondType;
-    if (firstType == secondType) return firstType;
-    if (firstType == nonNullEmptyType) return secondType;
-    if (secondType == nonNullEmptyType) return firstType;
-    if (firstType == dynamicType || secondType == dynamicType) {
-      return dynamicType;
-    }
-    return getConcreteTypeFor(
-        firstType.type.union(secondType.type, closedWorld));
-  }
-
-  bool selectorNeedsUpdate(TypeInformation info, TypeMask mask) {
-    return info.type != mask;
-  }
-
-  TypeInformation refineReceiver(Selector selector, TypeMask mask,
-      TypeInformation receiver, bool isConditional) {
-    if (receiver.type.isExact) return receiver;
-    TypeMask otherType =
-        compiler.closedWorld.allFunctions.receiverType(selector, mask);
-    // Conditional sends (a?.b) can still narrow the possible types of `a`,
-    // however, we still need to consider that `a` may be null.
-    if (isConditional) {
-      // Note: we don't check that receiver.type.isNullable here because this is
-      // called during the graph construction.
-      otherType = otherType.nullable();
-    }
-    // If this is refining to nullable subtype of `Object` just return
-    // the receiver. We know the narrowing is useless.
-    if (otherType.isNullable && otherType.containsAll(closedWorld)) {
-      return receiver;
-    }
-    assert(TypeMask.assertIsNormalized(otherType, closedWorld));
-    TypeInformation newType = new NarrowTypeInformation(receiver, otherType);
-    allocatedTypes.add(newType);
-    return newType;
-  }
-
-  TypeInformation narrowType(TypeInformation type, DartType annotation,
-      {bool isNullable: true}) {
-    if (annotation.treatAsDynamic) return type;
-    if (annotation.isVoid) return nullType;
-    if (annotation.element == closedWorld.coreClasses.objectClass &&
-        isNullable) {
-      return type;
-    }
-    TypeMask otherType;
-    if (annotation.isTypedef || annotation.isFunctionType) {
-      otherType = functionType.type;
-    } else if (annotation.isTypeVariable) {
-      // TODO(ngeoffray): Narrow to bound.
-      return type;
-    } else {
-      assert(annotation.isInterfaceType);
-      otherType = annotation.element == closedWorld.coreClasses.objectClass
-          ? dynamicType.type.nonNullable()
-          : new TypeMask.nonNullSubtype(annotation.element, closedWorld);
-    }
-    if (isNullable) otherType = otherType.nullable();
-    if (type.type.isExact) {
-      return type;
-    } else {
-      assert(TypeMask.assertIsNormalized(otherType, closedWorld));
-      TypeInformation newType = new NarrowTypeInformation(type, otherType);
-      allocatedTypes.add(newType);
-      return newType;
-    }
-  }
-
-  TypeInformation narrowNotNull(TypeInformation type) {
-    if (type.type.isExact && !type.type.isNullable) {
-      return type;
-    }
-    TypeInformation newType =
-        new NarrowTypeInformation(type, dynamicType.type.nonNullable());
-    allocatedTypes.add(newType);
-    return newType;
-  }
-
-  ElementTypeInformation getInferredTypeOf(Element element) {
-    element = element.implementation;
-    return typeInformations.putIfAbsent(element, () {
-      return new ElementTypeInformation(element, this);
-    });
-  }
-
-  ConcreteTypeInformation getConcreteTypeFor(TypeMask mask) {
-    assert(mask != null);
-    return concreteTypes.putIfAbsent(mask, () {
-      return new ConcreteTypeInformation(mask);
-    });
-  }
-
-  String getInferredSignatureOf(FunctionElement function) {
-    ElementTypeInformation info = getInferredTypeOf(function);
-    FunctionElement impl = function.implementation;
-    FunctionSignature signature = impl.functionSignature;
-    var res = "";
-    signature.forEachParameter((Element parameter) {
-      TypeInformation type = getInferredTypeOf(parameter);
-      res += "${res.isEmpty ? '(' : ', '}${type.type} ${parameter.name}";
-    });
-    res += ") -> ${info.type}";
-    return res;
-  }
-
-  TypeInformation nonNullSubtype(ClassElement type) {
-    return getConcreteTypeFor(
-        new TypeMask.nonNullSubtype(type.declaration, closedWorld));
-  }
-
-  TypeInformation nonNullSubclass(ClassElement type) {
-    return getConcreteTypeFor(
-        new TypeMask.nonNullSubclass(type.declaration, closedWorld));
-  }
-
-  TypeInformation nonNullExact(ClassElement type) {
-    return getConcreteTypeFor(
-        new TypeMask.nonNullExact(type.declaration, closedWorld));
-  }
-
-  TypeInformation nonNullEmpty() {
-    return nonNullEmptyType;
-  }
-
-  bool isNull(TypeInformation type) {
-    return type == nullType;
-  }
-
-  TypeInformation allocateList(
-      TypeInformation type, ast.Node node, Element enclosing,
-      [TypeInformation elementType, int length]) {
-    ClassElement typedDataClass = compiler.commonElements.typedDataClass;
-    bool isTypedArray = typedDataClass != null &&
-        closedWorld.isInstantiated(typedDataClass) &&
-        type.type.satisfies(typedDataClass, closedWorld);
-    bool isConst = (type.type == commonMasks.constListType);
-    bool isFixed =
-        (type.type == commonMasks.fixedListType) || isConst || isTypedArray;
-    bool isElementInferred = isConst || isTypedArray;
-
-    int inferredLength = isFixed ? length : null;
-    TypeMask elementTypeMask =
-        isElementInferred ? elementType.type : dynamicType.type;
-    ContainerTypeMask mask = new ContainerTypeMask(
-        type.type, node, enclosing, elementTypeMask, inferredLength);
-    ElementInContainerTypeInformation element =
-        new ElementInContainerTypeInformation(currentMember, elementType);
-    element.inferred = isElementInferred;
-
-    allocatedTypes.add(element);
-    return allocatedLists[node] =
-        new ListTypeInformation(currentMember, mask, element, length);
-  }
-
-  TypeInformation allocateClosure(ast.Node node, Element element) {
-    TypeInformation result =
-        new ClosureTypeInformation(currentMember, node, element);
-    allocatedClosures.add(result);
-    return result;
-  }
-
-  TypeInformation allocateMap(
-      ConcreteTypeInformation type, ast.Node node, Element element,
-      [List<TypeInformation> keyTypes, List<TypeInformation> valueTypes]) {
-    assert(keyTypes.length == valueTypes.length);
-    bool isFixed = (type.type == commonMasks.constMapType);
-
-    TypeMask keyType, valueType;
-    if (isFixed) {
-      keyType = keyTypes.fold(nonNullEmptyType.type,
-          (type, info) => type.union(info.type, closedWorld));
-      valueType = valueTypes.fold(nonNullEmptyType.type,
-          (type, info) => type.union(info.type, closedWorld));
-    } else {
-      keyType = valueType = dynamicType.type;
-    }
-    MapTypeMask mask =
-        new MapTypeMask(type.type, node, element, keyType, valueType);
-
-    TypeInformation keyTypeInfo =
-        new KeyInMapTypeInformation(currentMember, null);
-    TypeInformation valueTypeInfo =
-        new ValueInMapTypeInformation(currentMember, null);
-    allocatedTypes.add(keyTypeInfo);
-    allocatedTypes.add(valueTypeInfo);
-
-    MapTypeInformation map =
-        new MapTypeInformation(currentMember, mask, keyTypeInfo, valueTypeInfo);
-
-    for (int i = 0; i < keyTypes.length; ++i) {
-      TypeInformation newType =
-          map.addEntryAssignment(keyTypes[i], valueTypes[i], true);
-      if (newType != null) allocatedTypes.add(newType);
-    }
-
-    // Shortcut: If we already have a first approximation of the key/value type,
-    // start propagating it early.
-    if (isFixed) map.markAsInferred();
-
-    allocatedMaps[node] = map;
-    return map;
-  }
-
-  TypeMask newTypedSelector(TypeInformation info, TypeMask mask) {
-    // Only type the selector if [info] is concrete, because the other
-    // kinds of [TypeInformation] have the empty type at this point of
-    // analysis.
-    return info.isConcrete ? info.type : mask;
-  }
-
-  TypeInformation allocateDiamondPhi(
-      TypeInformation firstInput, TypeInformation secondInput) {
-    PhiElementTypeInformation result =
-        new PhiElementTypeInformation(currentMember, null, false, null);
-    result.addAssignment(firstInput);
-    result.addAssignment(secondInput);
-    allocatedTypes.add(result);
-    return result;
-  }
-
-  PhiElementTypeInformation _addPhi(
-      ast.Node node, Local variable, inputType, bool isLoop) {
-    PhiElementTypeInformation result =
-        new PhiElementTypeInformation(currentMember, node, isLoop, variable);
-    allocatedTypes.add(result);
-    result.addAssignment(inputType);
-    return result;
-  }
-
-  PhiElementTypeInformation allocatePhi(
-      ast.Node node, Local variable, inputType) {
-    // Check if [inputType] is a phi for a local updated in
-    // the try/catch block [node]. If it is, no need to allocate a new
-    // phi.
-    if (inputType is PhiElementTypeInformation &&
-        inputType.branchNode == node &&
-        inputType.branchNode is ast.TryStatement) {
-      return inputType;
-    }
-    return _addPhi(node, variable, inputType, false);
-  }
-
-  PhiElementTypeInformation allocateLoopPhi(
-      ast.Node node, Local variable, inputType) {
-    return _addPhi(node, variable, inputType, true);
-  }
-
-  TypeInformation simplifyPhi(
-      ast.Node node, Local variable, PhiElementTypeInformation phiType) {
-    assert(phiType.branchNode == node);
-    if (phiType.assignments.length == 1) return phiType.assignments.first;
-    return phiType;
-  }
-
-  PhiElementTypeInformation addPhiInput(Local variable,
-      PhiElementTypeInformation phiType, TypeInformation newType) {
-    phiType.addAssignment(newType);
-    return phiType;
-  }
-
-  TypeMask computeTypeMask(Iterable<TypeInformation> assignments) {
-    return joinTypeMasks(assignments.map((e) => e.type));
-  }
-
-  TypeMask joinTypeMasks(Iterable<TypeMask> masks) {
-    var dynamicType = commonMasks.dynamicType;
-    // Optimization: we are iterating over masks twice, but because `masks` is a
-    // mapped iterable, we save the intermediate results to avoid computing them
-    // again.
-    var list = [];
-    for (TypeMask mask in masks) {
-      // Don't do any work on computing unions if we know that after all that
-      // work the result will be `dynamic`.
-      // TODO(sigmund): change to `mask == dynamicType` so we can continue to
-      // track the non-nullable bit.
-      if (mask.containsAll(closedWorld)) return dynamicType;
-      list.add(mask);
-    }
-
-    TypeMask newType = null;
-    for (TypeMask mask in list) {
-      newType = newType == null ? mask : newType.union(mask, closedWorld);
-      // Likewise - stop early if we already reach dynamic.
-      if (newType.containsAll(closedWorld)) return dynamicType;
-    }
-
-    return newType ?? const TypeMask.nonNullEmpty();
-  }
-}
-
 /**
  * A work queue for the inferrer. It filters out nodes that are tagged as
  * [TypeInformation.doNotEnqueue], as well as ensures through
@@ -556,817 +49,23 @@
   int get length => queue.length;
 }
 
-/**
- * An inferencing engine that computes a call graph of
- * [TypeInformation] nodes by visiting the AST of the application, and
- * then does the inferencing on the graph.
- *
- */
-class TypeGraphInferrerEngine
-    extends InferrerEngine<TypeInformation, TypeInformationSystem> {
-  final Map<Element, TypeInformation> defaultTypeOfParameter =
-      new Map<Element, TypeInformation>();
-  final List<CallSiteTypeInformation> allocatedCalls =
-      <CallSiteTypeInformation>[];
-  final WorkQueue workQueue = new WorkQueue();
-  final Element mainElement;
-  final CommonMasks commonMasks;
-  final Set<Element> analyzedElements = new Set<Element>();
-
-  /// The maximum number of times we allow a node in the graph to
-  /// change types. If a node reaches that limit, we give up
-  /// inferencing on it and give it the dynamic type.
-  final int MAX_CHANGE_COUNT = 6;
-
-  int overallRefineCount = 0;
-  int addedInGraph = 0;
-
-  TypeGraphInferrerEngine(
-      Compiler compiler, CommonMasks commonMasks, this.mainElement)
-      : commonMasks = commonMasks,
-        super(compiler, new TypeInformationSystem(compiler, commonMasks));
-
-  JavaScriptBackend get backend => compiler.backend;
-  Annotations get annotations => backend.annotations;
-  DiagnosticReporter get reporter => compiler.reporter;
-
-  /**
-   * A set of selector names that [List] implements, that we know return
-   * their element type.
-   */
-  final Set<Selector> returnsListElementTypeSet =
-      new Set<Selector>.from(<Selector>[
-    new Selector.getter(const PublicName('first')),
-    new Selector.getter(const PublicName('last')),
-    new Selector.getter(const PublicName('single')),
-    new Selector.call(const PublicName('singleWhere'), CallStructure.ONE_ARG),
-    new Selector.call(const PublicName('elementAt'), CallStructure.ONE_ARG),
-    new Selector.index(),
-    new Selector.call(const PublicName('removeAt'), CallStructure.ONE_ARG),
-    new Selector.call(const PublicName('removeLast'), CallStructure.NO_ARGS)
-  ]);
-
-  bool returnsListElementType(Selector selector, TypeMask mask) {
-    return mask != null &&
-        mask.isContainer &&
-        returnsListElementTypeSet.contains(selector);
-  }
-
-  bool returnsMapValueType(Selector selector, TypeMask mask) {
-    return mask != null && mask.isMap && selector.isIndex;
-  }
-
-  void analyzeListAndEnqueue(ListTypeInformation info) {
-    if (info.analyzed) return;
-    info.analyzed = true;
-
-    ListTracerVisitor tracer = new ListTracerVisitor(info, this);
-    bool succeeded = tracer.run();
-    if (!succeeded) return;
-
-    info.bailedOut = false;
-    info.elementType.inferred = true;
-    TypeMask fixedListType = commonMasks.fixedListType;
-    if (info.originalType.forwardTo == fixedListType) {
-      info.checksGrowable = tracer.callsGrowableMethod;
-    }
-    tracer.assignments.forEach(info.elementType.addAssignment);
-    // Enqueue the list for later refinement
-    workQueue.add(info);
-    workQueue.add(info.elementType);
-  }
-
-  void analyzeMapAndEnqueue(MapTypeInformation info) {
-    if (info.analyzed) return;
-    info.analyzed = true;
-    MapTracerVisitor tracer = new MapTracerVisitor(info, this);
-
-    bool succeeded = tracer.run();
-    if (!succeeded) return;
-
-    info.bailedOut = false;
-    for (int i = 0; i < tracer.keyAssignments.length; ++i) {
-      TypeInformation newType = info.addEntryAssignment(
-          tracer.keyAssignments[i], tracer.valueAssignments[i]);
-      if (newType != null) workQueue.add(newType);
-    }
-    for (TypeInformation map in tracer.mapAssignments) {
-      workQueue.addAll(info.addMapAssignment(map));
-    }
-
-    info.markAsInferred();
-    workQueue.add(info.keyType);
-    workQueue.add(info.valueType);
-    workQueue.addAll(info.typeInfoMap.values);
-    workQueue.add(info);
-  }
-
-  void runOverAllElements() {
-    if (compiler.disableTypeInference) return;
-    if (compiler.options.verbose) {
-      compiler.progress.reset();
-    }
-    sortResolvedAsts().forEach((ResolvedAst resolvedAst) {
-      if (compiler.shouldPrintProgress) {
-        reporter.log('Added $addedInGraph elements in inferencing graph.');
-        compiler.progress.reset();
-      }
-      // This also forces the creation of the [ElementTypeInformation] to ensure
-      // it is in the graph.
-      types.withMember(
-          resolvedAst.element.implementation, () => analyze(resolvedAst, null));
-    });
-    reporter.log('Added $addedInGraph elements in inferencing graph.');
-
-    TypeGraphDump dump = debug.PRINT_GRAPH ? new TypeGraphDump(this) : null;
-
-    dump?.beforeAnalysis();
-    buildWorkQueue();
-    refine();
-
-    // Try to infer element types of lists and compute their escape information.
-    types.allocatedLists.values.forEach((ListTypeInformation info) {
-      analyzeListAndEnqueue(info);
-    });
-
-    // Try to infer the key and value types for maps and compute the values'
-    // escape information.
-    types.allocatedMaps.values.forEach((MapTypeInformation info) {
-      analyzeMapAndEnqueue(info);
-    });
-
-    Set<FunctionElement> bailedOutOn = new Set<FunctionElement>();
-
-    // Trace closures to potentially infer argument types.
-    types.allocatedClosures.forEach((info) {
-      void trace(
-          Iterable<FunctionElement> elements, ClosureTracerVisitor tracer) {
-        tracer.run();
-        if (!tracer.continueAnalyzing) {
-          elements.forEach((FunctionElement e) {
-            compiler.inferenceWorld.registerMightBePassedToApply(e);
-            if (debug.VERBOSE) print("traced closure $e as ${true} (bail)");
-            e.functionSignature.forEachParameter((parameter) {
-              types
-                  .getInferredTypeOf(parameter)
-                  .giveUp(this, clearAssignments: false);
-            });
-          });
-          bailedOutOn.addAll(elements);
-          return;
-        }
-        elements
-            .where((e) => !bailedOutOn.contains(e))
-            .forEach((FunctionElement e) {
-          e.functionSignature.forEachParameter((parameter) {
-            var info = types.getInferredTypeOf(parameter);
-            info.maybeResume();
-            workQueue.add(info);
-          });
-          if (tracer.tracedType.mightBePassedToFunctionApply) {
-            compiler.inferenceWorld.registerMightBePassedToApply(e);
-          }
-          if (debug.VERBOSE) {
-            print("traced closure $e as "
-                "${compiler.inferenceWorld
-                    .getCurrentlyKnownMightBePassedToApply(e)}");
-          }
-        });
-      }
-
-      if (info is ClosureTypeInformation) {
-        Iterable<FunctionElement> elements = [info.element];
-        trace(elements, new ClosureTracerVisitor(elements, info, this));
-      } else if (info is CallSiteTypeInformation) {
-        if (info is StaticCallSiteTypeInformation &&
-            info.selector != null &&
-            info.selector.isCall) {
-          // This is a constructor call to a class with a call method. So we
-          // need to trace the call method here.
-          assert(info.calledElement.isConstructor);
-          ClassElement cls = info.calledElement.enclosingClass;
-          FunctionElement callMethod = cls.lookupMember(Identifiers.call);
-          assert(invariant(cls, callMethod != null));
-          Iterable<FunctionElement> elements = [callMethod];
-          trace(elements, new ClosureTracerVisitor(elements, info, this));
-        } else {
-          // We only are interested in functions here, as other targets
-          // of this closure call are not a root to trace but an intermediate
-          // for some other function.
-          Iterable<FunctionElement> elements = new List<FunctionElement>.from(
-              info.callees.where((e) => e.isFunction));
-          trace(elements, new ClosureTracerVisitor(elements, info, this));
-        }
-      } else {
-        assert(info is ElementTypeInformation);
-        trace([info.element],
-            new StaticTearOffClosureTracerVisitor(info.element, info, this));
-      }
-    });
-
-    dump?.beforeTracing();
-
-    // Reset all nodes that use lists/maps that have been inferred, as well
-    // as nodes that use elements fetched from these lists/maps. The
-    // workset for a new run of the analysis will be these nodes.
-    Set<TypeInformation> seenTypes = new Set<TypeInformation>();
-    while (!workQueue.isEmpty) {
-      TypeInformation info = workQueue.remove();
-      if (seenTypes.contains(info)) continue;
-      // If the node cannot be reset, we do not need to update its users either.
-      if (!info.reset(this)) continue;
-      seenTypes.add(info);
-      workQueue.addAll(info.users);
-    }
-
-    workQueue.addAll(seenTypes);
-    refine();
-
-    if (debug.PRINT_SUMMARY) {
-      types.allocatedLists.values.forEach((ListTypeInformation info) {
-        print('${info.type} '
-            'for ${info.originalType.allocationNode} '
-            'at ${info.originalType.allocationElement} '
-            'after ${info.refineCount}');
-      });
-      types.allocatedMaps.values.forEach((MapTypeInformation info) {
-        print('${info.type} '
-            'for ${info.originalType.allocationNode} '
-            'at ${info.originalType.allocationElement} '
-            'after ${info.refineCount}');
-      });
-      types.allocatedClosures.forEach((TypeInformation info) {
-        if (info is ElementTypeInformation) {
-          print('${types.getInferredSignatureOf(info.element)} for '
-              '${info.element}');
-        } else if (info is ClosureTypeInformation) {
-          print('${types.getInferredSignatureOf(info.element)} for '
-              '${info.element}');
-        } else if (info is DynamicCallSiteTypeInformation) {
-          for (Element target in info.targets) {
-            if (target is FunctionElement) {
-              print('${types.getInferredSignatureOf(target)} for ${target}');
-            } else {
-              print('${types.getInferredTypeOf(target).type} for ${target}');
-            }
-          }
-        } else if (info is StaticCallSiteTypeInformation) {
-          ClassElement cls = info.calledElement.enclosingClass;
-          FunctionElement callMethod = cls.lookupMember(Identifiers.call);
-          print('${types.getInferredSignatureOf(callMethod)} for ${cls}');
-        } else {
-          print('${info.type} for some unknown kind of closure');
-        }
-      });
-      analyzedElements.forEach((Element elem) {
-        TypeInformation type = types.getInferredTypeOf(elem);
-        print('${elem} :: ${type} from ${type.assignments} ');
-      });
-    }
-    dump?.afterAnalysis();
-
-    reporter.log('Inferred $overallRefineCount types.');
-
-    processLoopInformation();
-  }
-
-  void analyze(ResolvedAst resolvedAst, ArgumentsTypes arguments) {
-    AstElement element = resolvedAst.element.implementation;
-    if (analyzedElements.contains(element)) return;
-    analyzedElements.add(element);
-
-    SimpleTypeInferrerVisitor visitor =
-        new SimpleTypeInferrerVisitor(element, resolvedAst, compiler, this);
-    TypeInformation type;
-    reporter.withCurrentElement(element, () {
-      type = visitor.run();
-    });
-    addedInGraph++;
-
-    if (element.isField) {
-      VariableElement fieldElement = element;
-      ast.Node node = resolvedAst.node;
-      ast.Node initializer = resolvedAst.body;
-      if (element.isFinal || element.isConst) {
-        // If [element] is final and has an initializer, we record
-        // the inferred type.
-        if (resolvedAst.body != null) {
-          if (type is! ListTypeInformation && type is! MapTypeInformation) {
-            // For non-container types, the constant handler does
-            // constant folding that could give more precise results.
-            ConstantExpression constant = fieldElement.constant;
-            if (constant != null) {
-              ConstantValue value =
-                  compiler.backend.constants.getConstantValue(constant);
-              if (value != null) {
-                if (value.isFunction) {
-                  FunctionConstantValue functionConstant = value;
-                  type = types.allocateClosure(node, functionConstant.element);
-                } else {
-                  // Although we might find a better type, we have to keep
-                  // the old type around to ensure that we get a complete view
-                  // of the type graph and do not drop any flow edges.
-                  TypeMask refinedType = computeTypeMask(compiler, value);
-                  assert(TypeMask.assertIsNormalized(refinedType, closedWorld));
-                  type = new NarrowTypeInformation(type, refinedType);
-                  types.allocatedTypes.add(type);
-                }
-              } else {
-                assert(invariant(
-                    fieldElement,
-                    fieldElement.isInstanceMember ||
-                        constant.isImplicit ||
-                        constant.isPotential,
-                    message: "Constant expression without value: "
-                        "${constant.toStructuredText()}."));
-              }
-            }
-          }
-          recordType(element, type);
-        } else if (!element.isInstanceMember) {
-          recordType(element, types.nullType);
-        }
-      } else if (initializer == null) {
-        // Only update types of static fields if there is no
-        // assignment. Instance fields are dealt with in the constructor.
-        if (Elements.isStaticOrTopLevelField(element)) {
-          recordTypeOfNonFinalField(node, element, type);
-        }
-      } else {
-        recordTypeOfNonFinalField(node, element, type);
-      }
-      if (Elements.isStaticOrTopLevelField(element) &&
-          resolvedAst.body != null &&
-          !element.isConst) {
-        var argument = resolvedAst.body;
-        // TODO(13429): We could do better here by using the
-        // constant handler to figure out if it's a lazy field or not.
-        if (argument.asSend() != null ||
-            (argument.asNewExpression() != null && !argument.isConst)) {
-          recordType(element, types.nullType);
-        }
-      }
-    } else {
-      recordReturnType(element, type);
-    }
-  }
-
-  void processLoopInformation() {
-    allocatedCalls.forEach((info) {
-      if (!info.inLoop) return;
-      if (info is StaticCallSiteTypeInformation) {
-        compiler.inferenceWorld.addFunctionCalledInLoop(info.calledElement);
-      } else if (info.mask != null &&
-          !info.mask.containsAll(compiler.closedWorld)) {
-        // For instance methods, we only register a selector called in a
-        // loop if it is a typed selector, to avoid marking too many
-        // methods as being called from within a loop. This cuts down
-        // on the code bloat.
-        info.targets.forEach(compiler.inferenceWorld.addFunctionCalledInLoop);
-      }
-    });
-  }
-
-  void refine() {
-    while (!workQueue.isEmpty) {
-      if (compiler.shouldPrintProgress) {
-        reporter.log('Inferred $overallRefineCount types.');
-        compiler.progress.reset();
-      }
-      TypeInformation info = workQueue.remove();
-      TypeMask oldType = info.type;
-      TypeMask newType = info.refine(this);
-      // Check that refinement has not accidentially changed the type.
-      assert(oldType == info.type);
-      if (info.abandonInferencing) info.doNotEnqueue = true;
-      if ((info.type = newType) != oldType) {
-        overallRefineCount++;
-        info.refineCount++;
-        if (info.refineCount > MAX_CHANGE_COUNT) {
-          if (debug.ANOMALY_WARN) {
-            print("ANOMALY WARNING: max refinement reached for $info");
-          }
-          info.giveUp(this);
-          info.type = info.refine(this);
-          info.doNotEnqueue = true;
-        }
-        workQueue.addAll(info.users);
-        if (info.hasStableType(this)) {
-          info.stabilize(this);
-        }
-      }
-    }
-  }
-
-  void buildWorkQueue() {
-    workQueue.addAll(types.typeInformations.values);
-    workQueue.addAll(types.allocatedTypes);
-    workQueue.addAll(types.allocatedClosures);
-    workQueue.addAll(allocatedCalls);
-  }
-
-  /**
-   * Update the assignments to parameters in the graph. [remove] tells
-   * wheter assignments must be added or removed. If [init] is false,
-   * parameters are added to the work queue.
-   */
-  void updateParameterAssignments(TypeInformation caller, Element callee,
-      ArgumentsTypes arguments, Selector selector, TypeMask mask,
-      {bool remove, bool addToQueue: true}) {
-    if (callee.name == Identifiers.noSuchMethod_) return;
-    if (callee.isField) {
-      if (selector.isSetter) {
-        ElementTypeInformation info = types.getInferredTypeOf(callee);
-        if (remove) {
-          info.removeAssignment(arguments.positional[0]);
-        } else {
-          info.addAssignment(arguments.positional[0]);
-        }
-        if (addToQueue) workQueue.add(info);
-      }
-    } else if (callee.isGetter) {
-      return;
-    } else if (selector != null && selector.isGetter) {
-      // We are tearing a function off and thus create a closure.
-      assert(callee.isFunction);
-      MemberTypeInformation info = types.getInferredTypeOf(callee);
-      if (remove) {
-        info.closurizedCount--;
-      } else {
-        info.closurizedCount++;
-        if (Elements.isStaticOrTopLevel(callee)) {
-          types.allocatedClosures.add(info);
-        } else {
-          // We add the call-site type information here so that we
-          // can benefit from further refinement of the selector.
-          types.allocatedClosures.add(caller);
-        }
-        FunctionElement function = callee.implementation;
-        FunctionSignature signature = function.functionSignature;
-        signature.forEachParameter((Element parameter) {
-          ParameterTypeInformation info = types.getInferredTypeOf(parameter);
-          info.tagAsTearOffClosureParameter(this);
-          if (addToQueue) workQueue.add(info);
-        });
-      }
-    } else {
-      FunctionElement function = callee.implementation;
-      FunctionSignature signature = function.functionSignature;
-      int parameterIndex = 0;
-      bool visitingRequiredParameter = true;
-      signature.forEachParameter((Element parameter) {
-        if (signature.hasOptionalParameters &&
-            parameter == signature.optionalParameters.first) {
-          visitingRequiredParameter = false;
-        }
-        TypeInformation type = visitingRequiredParameter
-            ? arguments.positional[parameterIndex]
-            : signature.optionalParametersAreNamed
-                ? arguments.named[parameter.name]
-                : parameterIndex < arguments.positional.length
-                    ? arguments.positional[parameterIndex]
-                    : null;
-        if (type == null) type = getDefaultTypeOfParameter(parameter);
-        TypeInformation info = types.getInferredTypeOf(parameter);
-        if (remove) {
-          info.removeAssignment(type);
-        } else {
-          info.addAssignment(type);
-        }
-        parameterIndex++;
-        if (addToQueue) workQueue.add(info);
-      });
-    }
-  }
-
-  /**
-   * Sets the type of a parameter's default value to [type]. If the global
-   * mapping in [defaultTypeOfParameter] already contains a type, it must be
-   * a [PlaceholderTypeInformation], which will be replaced. All its uses are
-   * updated.
-   */
-  void setDefaultTypeOfParameter(
-      ParameterElement parameter, TypeInformation type) {
-    assert(parameter.functionDeclaration.isImplementation);
-    TypeInformation existing = defaultTypeOfParameter[parameter];
-    defaultTypeOfParameter[parameter] = type;
-    TypeInformation info = types.getInferredTypeOf(parameter);
-    if (existing != null && existing is PlaceholderTypeInformation) {
-      // Replace references to [existing] to use [type] instead.
-      if (parameter.functionDeclaration.isInstanceMember) {
-        ParameterAssignments assignments = info.assignments;
-        assignments.replace(existing, type);
-      } else {
-        List<TypeInformation> assignments = info.assignments;
-        for (int i = 0; i < assignments.length; i++) {
-          if (assignments[i] == existing) {
-            assignments[i] = type;
-          }
-        }
-      }
-      // Also forward all users.
-      type.addUsersOf(existing);
-    } else {
-      assert(existing == null);
-    }
-  }
-
-  /**
-   * Returns the [TypeInformation] node for the default value of a parameter.
-   * If this is queried before it is set by [setDefaultTypeOfParameter], a
-   * [PlaceholderTypeInformation] is returned, which will later be replaced
-   * by the actual node when [setDefaultTypeOfParameter] is called.
-   *
-   * Invariant: After graph construction, no [PlaceholderTypeInformation] nodes
-   *            should be present and a default type for each parameter should
-   *            exist.
-   */
-  TypeInformation getDefaultTypeOfParameter(Element parameter) {
-    return defaultTypeOfParameter.putIfAbsent(parameter, () {
-      return new PlaceholderTypeInformation(types.currentMember);
-    });
-  }
-
-  /**
-   * Helper to inspect the [TypeGraphInferrer]'s state. To be removed by
-   * TODO(johnniwinther) once synthetic parameters get their own default
-   * values.
-   */
-  bool hasAlreadyComputedTypeOfParameterDefault(Element parameter) {
-    TypeInformation seen = defaultTypeOfParameter[parameter];
-    return (seen != null && seen is! PlaceholderTypeInformation);
-  }
-
-  TypeInformation typeOfElement(Element element) {
-    if (element is FunctionElement) return types.functionType;
-    return types.getInferredTypeOf(element);
-  }
-
-  TypeInformation returnTypeOfElement(Element element) {
-    if (element is! FunctionElement) return types.dynamicType;
-    return types.getInferredTypeOf(element);
-  }
-
-  void recordTypeOfFinalField(
-      Spannable node, Element analyzed, Element element, TypeInformation type) {
-    types.getInferredTypeOf(element).addAssignment(type);
-  }
-
-  void recordTypeOfNonFinalField(
-      Spannable node, Element element, TypeInformation type) {
-    types.getInferredTypeOf(element).addAssignment(type);
-  }
-
-  void recordType(Element element, TypeInformation type) {
-    types.getInferredTypeOf(element).addAssignment(type);
-  }
-
-  void recordReturnType(Element element, TypeInformation type) {
-    TypeInformation info = types.getInferredTypeOf(element);
-    if (element.name == '==') {
-      // Even if x.== doesn't return a bool, 'x == null' evaluates to 'false'.
-      info.addAssignment(types.boolType);
-    }
-    // TODO(ngeoffray): Clean up. We do these checks because
-    // [SimpleTypesInferrer] deals with two different inferrers.
-    if (type == null) return;
-    if (info.assignments.isEmpty) info.addAssignment(type);
-  }
-
-  TypeInformation addReturnTypeFor(
-      Element element, TypeInformation unused, TypeInformation newType) {
-    TypeInformation type = types.getInferredTypeOf(element);
-    // TODO(ngeoffray): Clean up. We do this check because
-    // [SimpleTypesInferrer] deals with two different inferrers.
-    if (element.isGenerativeConstructor) return type;
-    type.addAssignment(newType);
-    return type;
-  }
-
-  TypeInformation registerCalledElement(
-      Spannable node,
-      Selector selector,
-      TypeMask mask,
-      Element caller,
-      Element callee,
-      ArgumentsTypes arguments,
-      SideEffects sideEffects,
-      bool inLoop) {
-    CallSiteTypeInformation info = new StaticCallSiteTypeInformation(
-        types.currentMember,
-        node,
-        caller,
-        callee,
-        selector,
-        mask,
-        arguments,
-        inLoop);
-    // If this class has a 'call' method then we have essentially created a
-    // closure here. Register it as such so that it is traced.
-    if (selector != null && selector.isCall && callee.isConstructor) {
-      ClassElement cls = callee.enclosingClass.declaration;
-      if (cls.callType != null) {
-        types.allocatedClosures.add(info);
-      }
-    }
-    info.addToGraph(this);
-    allocatedCalls.add(info);
-    updateSideEffects(sideEffects, selector, callee);
-    return info;
-  }
-
-  TypeInformation registerCalledSelector(
-      ast.Node node,
-      Selector selector,
-      TypeMask mask,
-      TypeInformation receiverType,
-      Element caller,
-      ArgumentsTypes arguments,
-      SideEffects sideEffects,
-      bool inLoop) {
-    if (selector.isClosureCall) {
-      return registerCalledClosure(node, selector, mask, receiverType, caller,
-          arguments, sideEffects, inLoop);
-    }
-
-    compiler.closedWorld.allFunctions.filter(selector, mask).forEach((callee) {
-      updateSideEffects(sideEffects, selector, callee);
-    });
-
-    CallSiteTypeInformation info = new DynamicCallSiteTypeInformation(
-        types.currentMember,
-        node,
-        caller,
-        selector,
-        mask,
-        receiverType,
-        arguments,
-        inLoop);
-
-    info.addToGraph(this);
-    allocatedCalls.add(info);
-    return info;
-  }
-
-  TypeInformation registerAwait(ast.Node node, TypeInformation argument) {
-    AwaitTypeInformation info =
-        new AwaitTypeInformation(types.currentMember, node);
-    info.addAssignment(argument);
-    types.allocatedTypes.add(info);
-    return info;
-  }
-
-  TypeInformation registerCalledClosure(
-      ast.Node node,
-      Selector selector,
-      TypeMask mask,
-      TypeInformation closure,
-      Element caller,
-      ArgumentsTypes arguments,
-      SideEffects sideEffects,
-      bool inLoop) {
-    sideEffects.setDependsOnSomething();
-    sideEffects.setAllSideEffects();
-    CallSiteTypeInformation info = new ClosureCallSiteTypeInformation(
-        types.currentMember,
-        node,
-        caller,
-        selector,
-        mask,
-        closure,
-        arguments,
-        inLoop);
-    info.addToGraph(this);
-    allocatedCalls.add(info);
-    return info;
-  }
-
-  // Sorts the resolved elements by size. We do this for this inferrer
-  // to get the same results for [ListTracer] compared to the
-  // [SimpleTypesInferrer].
-  Iterable<ResolvedAst> sortResolvedAsts() {
-    int max = 0;
-    Map<int, Setlet<ResolvedAst>> methodSizes = <int, Setlet<ResolvedAst>>{};
-    compiler.enqueuer.resolution.processedElements
-        .forEach((AstElement element) {
-      // TODO(ngeoffray): Not sure why the resolver would put a null
-      // mapping.
-      if (!compiler.enqueuer.resolution.hasBeenProcessed(element)) return;
-      ResolvedAst resolvedAst = element.resolvedAst;
-      element = element.implementation;
-      if (element.impliesType) return;
-      assert(invariant(
-          element,
-          element.isField ||
-              element.isFunction ||
-              element.isConstructor ||
-              element.isGetter ||
-              element.isSetter,
-          message: 'Unexpected element kind: ${element.kind}'));
-      if (element.isAbstract) return;
-      // Put the other operators in buckets by length, later to be added in
-      // length order.
-      int length = 0;
-      if (resolvedAst.kind == ResolvedAstKind.PARSED) {
-        TreeElementMapping mapping = resolvedAst.elements;
-        length = mapping.getSelectorCount();
-      }
-      max = length > max ? length : max;
-      Setlet<ResolvedAst> set =
-          methodSizes.putIfAbsent(length, () => new Setlet<ResolvedAst>());
-      set.add(resolvedAst);
-    });
-
-    List<ResolvedAst> result = <ResolvedAst>[];
-    for (int i = 0; i <= max; i++) {
-      Setlet<ResolvedAst> set = methodSizes[i];
-      if (set != null) result.addAll(set);
-    }
-    return result;
-  }
-
-  void clear() {
-    void cleanup(TypeInformation info) => info.cleanup();
-
-    allocatedCalls.forEach(cleanup);
-    allocatedCalls.clear();
-
-    defaultTypeOfParameter.clear();
-
-    types.typeInformations.values.forEach(cleanup);
-
-    types.allocatedTypes.forEach(cleanup);
-    types.allocatedTypes.clear();
-
-    types.concreteTypes.clear();
-
-    types.allocatedClosures.forEach(cleanup);
-    types.allocatedClosures.clear();
-
-    analyzedElements.clear();
-    generativeConstructorsExposingThis.clear();
-
-    types.allocatedMaps.values.forEach(cleanup);
-    types.allocatedLists.values.forEach(cleanup);
-  }
-
-  Iterable<Element> getCallersOf(Element element) {
-    if (compiler.disableTypeInference) {
-      throw new UnsupportedError(
-          "Cannot query the type inferrer when type inference is disabled.");
-    }
-    MemberTypeInformation info = types.getInferredTypeOf(element);
-    return info.callers;
-  }
-
-  /**
-   * Returns the type of [element] when being called with [selector].
-   */
-  TypeInformation typeOfElementWithSelector(
-      Element element, Selector selector) {
-    if (element.name == Identifiers.noSuchMethod_ &&
-        selector.name != element.name) {
-      // An invocation can resolve to a [noSuchMethod], in which case
-      // we get the return type of [noSuchMethod].
-      return returnTypeOfElement(element);
-    } else if (selector.isGetter) {
-      if (element.isFunction) {
-        // [functionType] is null if the inferrer did not run.
-        return types.functionType == null
-            ? types.dynamicType
-            : types.functionType;
-      } else if (element.isField) {
-        return typeOfElement(element);
-      } else if (Elements.isUnresolved(element)) {
-        return types.dynamicType;
-      } else {
-        assert(element.isGetter);
-        return returnTypeOfElement(element);
-      }
-    } else if (element.isGetter || element.isField) {
-      assert(selector.isCall || selector.isSetter);
-      return types.dynamicType;
-    } else {
-      return returnTypeOfElement(element);
-    }
-  }
-
-  void recordCapturedLocalRead(Local local) {}
-
-  void recordLocalUpdate(Local local, TypeInformation type) {}
-}
-
 class TypeGraphInferrer implements TypesInferrer {
-  TypeGraphInferrerEngine inferrer;
+  InferrerEngine inferrer;
   final Compiler compiler;
-  final CommonMasks commonMasks;
-  TypeGraphInferrer(this.compiler, this.commonMasks);
+  final ClosedWorld closedWorld;
+  final ClosedWorldRefiner closedWorldRefiner;
+
+  TypeGraphInferrer(this.compiler, this.closedWorld, this.closedWorldRefiner);
 
   String get name => 'Graph inferrer';
+
+  CommonMasks get commonMasks => closedWorld.commonMasks;
+
   TypeMask get _dynamicType => commonMasks.dynamicType;
 
   void analyzeMain(Element main) {
-    inferrer = new TypeGraphInferrerEngine(compiler, commonMasks, main);
+    inferrer =
+        new InferrerEngine(compiler, closedWorld, closedWorldRefiner, main);
     inferrer.runOverAllElements();
   }
 
@@ -1417,11 +116,11 @@
 
     TypeMask result = const TypeMask.nonNullEmpty();
     Iterable<Element> elements =
-        compiler.closedWorld.allFunctions.filter(selector, mask);
+        inferrer.closedWorld.allFunctions.filter(selector, mask);
     for (Element element in elements) {
       TypeMask type =
           inferrer.typeOfElementWithSelector(element, selector).type;
-      result = result.union(type, compiler.closedWorld);
+      result = result.union(type, inferrer.closedWorld);
     }
     return result;
   }
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index 7e3bbd6..16c9260 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -10,7 +10,12 @@
 import '../common/names.dart' show Identifiers;
 import '../compiler.dart' show Compiler;
 import '../constants/values.dart';
-import '../dart_types.dart' show DartType, FunctionType, TypeKind;
+import '../elements/resolution_types.dart'
+    show
+        ResolutionDartType,
+        ResolutionFunctionType,
+        ResolutionInterfaceType,
+        ResolutionTypeKind;
 import '../elements/elements.dart';
 import '../js_backend/backend.dart';
 import '../tree/dartstring.dart' show DartString;
@@ -27,9 +32,9 @@
 import '../util/util.dart' show ImmutableEmptySet, Setlet;
 import '../world.dart' show ClosedWorld;
 import 'debug.dart' as debug;
-import 'inferrer_visitor.dart' show ArgumentsTypes;
-import 'type_graph_inferrer.dart'
-    show TypeGraphInferrerEngine, TypeInformationSystem;
+import 'locals_handler.dart' show ArgumentsTypes;
+import 'inferrer_engine.dart';
+import 'type_system.dart';
 
 /**
  * Common class for all nodes in the graph. The current nodes are:
@@ -155,7 +160,7 @@
     }
   }
 
-  TypeMask refine(TypeGraphInferrerEngine inferrer) {
+  TypeMask refine(InferrerEngine inferrer) {
     return abandonInferencing ? safeType(inferrer) : computeType(inferrer);
   }
 
@@ -163,17 +168,17 @@
    * Computes a new type for this [TypeInformation] node depending on its
    * potentially updated inputs.
    */
-  TypeMask computeType(TypeGraphInferrerEngine inferrer);
+  TypeMask computeType(InferrerEngine inferrer);
 
   /**
    * Returns an approximation for this [TypeInformation] node that is always
    * safe to use. Used when abandoning inference on a node.
    */
-  TypeMask safeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask safeType(InferrerEngine inferrer) {
     return inferrer.types.dynamicType.type;
   }
 
-  void giveUp(TypeGraphInferrerEngine inferrer, {bool clearAssignments: true}) {
+  void giveUp(InferrerEngine inferrer, {bool clearAssignments: true}) {
     abandonInferencing = true;
     // Do not remove [this] as a user of nodes in [assignments],
     // because our tracing analysis could be interested in tracing
@@ -190,7 +195,7 @@
 
   /// Reset the analysis of this node by making its type empty.
 
-  bool reset(TypeGraphInferrerEngine inferrer) {
+  bool reset(InferrerEngine inferrer) {
     if (abandonInferencing) return false;
     type = const TypeMask.nonNullEmpty();
     refineCount = 0;
@@ -206,17 +211,17 @@
 
   /// Returns whether the type cannot change after it has been
   /// inferred.
-  bool hasStableType(TypeGraphInferrerEngine inferrer) {
+  bool hasStableType(InferrerEngine inferrer) {
     return !mightResume && assignments.every((e) => e.isStable);
   }
 
-  void removeAndClearReferences(TypeGraphInferrerEngine inferrer) {
+  void removeAndClearReferences(InferrerEngine inferrer) {
     assignments.forEach((info) {
       info.removeUser(this);
     });
   }
 
-  void stabilize(TypeGraphInferrerEngine inferrer) {
+  void stabilize(InferrerEngine inferrer) {
     removeAndClearReferences(inferrer);
     // Do not remove users because the tracing analysis could be interested
     // in tracing the users of this node.
@@ -257,7 +262,7 @@
     throw new UnsupportedError("Cannot visit placeholder");
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     throw new UnsupportedError("Cannot refine placeholder");
   }
 
@@ -344,7 +349,7 @@
   /// Marker to disable inference for closures in [handleSpecialCases].
   bool disableInferenceForClosures = true;
 
-  factory ElementTypeInformation(Element element, TypeInformationSystem types) {
+  factory ElementTypeInformation(Element element, TypeSystem types) {
     if (element.isRegularParameter || element.isInitializingFormal) {
       ParameterElement parameter = element;
       if (parameter.functionDeclaration.isInstanceMember) {
@@ -455,7 +460,7 @@
   // state of the [isStable] field inhertied from [TypeInformation].
   bool get isStable => super.isStable && !isClosurized;
 
-  TypeMask handleSpecialCases(TypeGraphInferrerEngine inferrer) {
+  TypeMask handleSpecialCases(InferrerEngine inferrer) {
     if (element.isField &&
         (!inferrer.backend.canBeUsedForGlobalOptimizations(element) ||
             inferrer.annotations.assumeDynamic(element))) {
@@ -482,7 +487,7 @@
             element.isConstructor);
         TypedElement typedElement = element;
         var elementType = typedElement.type;
-        if (elementType.kind != TypeKind.FUNCTION) {
+        if (elementType.kind != ResolutionTypeKind.FUNCTION) {
           return safeType(inferrer);
         } else {
           return inferrer
@@ -510,8 +515,7 @@
     return null;
   }
 
-  TypeMask potentiallyNarrowType(
-      TypeMask mask, TypeGraphInferrerEngine inferrer) {
+  TypeMask potentiallyNarrowType(TypeMask mask, InferrerEngine inferrer) {
     Compiler compiler = inferrer.compiler;
     if (!compiler.options.trustTypeAnnotations &&
         !compiler.options.enableTypeAssertions &&
@@ -522,23 +526,23 @@
       return mask;
     }
     if (element.isField) {
-      return _narrowType(compiler.closedWorld, mask, element.type);
+      return _narrowType(inferrer.closedWorld, mask, element.type);
     }
     assert(
         element.isFunction || element.isGetter || element.isFactoryConstructor);
 
-    FunctionType type = element.type;
-    return _narrowType(compiler.closedWorld, mask, type.returnType);
+    ResolutionFunctionType type = element.type;
+    return _narrowType(inferrer.closedWorld, mask, type.returnType);
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     TypeMask special = handleSpecialCases(inferrer);
     if (special != null) return potentiallyNarrowType(special, inferrer);
     return potentiallyNarrowType(
         inferrer.types.computeTypeMask(assignments), inferrer);
   }
 
-  TypeMask safeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask safeType(InferrerEngine inferrer) {
     return potentiallyNarrowType(super.safeType(inferrer), inferrer);
   }
 
@@ -548,7 +552,7 @@
     return visitor.visitMemberTypeInformation(this);
   }
 
-  bool hasStableType(TypeGraphInferrerEngine inferrer) {
+  bool hasStableType(InferrerEngine inferrer) {
     // The number of assignments of non-final fields is
     // not stable. Therefore such a field cannot be stable.
     if (element.isField && !(element.isConst || element.isFinal)) {
@@ -582,15 +586,14 @@
   ParameterElement get element => super.element;
   FunctionElement get declaration => element.functionDeclaration;
 
-  ParameterTypeInformation._internal(
-      ParameterElement element, TypeInformationSystem types)
+  ParameterTypeInformation._internal(ParameterElement element, TypeSystem types)
       : super._internal(
             types.getInferredTypeOf(element.functionDeclaration), element) {
     assert(!element.functionDeclaration.isInstanceMember);
   }
 
   ParameterTypeInformation._instanceMember(
-      ParameterElement element, TypeInformationSystem types)
+      ParameterElement element, TypeSystem types)
       : super._withAssignments(
             types.getInferredTypeOf(element.functionDeclaration),
             element,
@@ -600,7 +603,7 @@
 
   bool isTearOffClosureParameter = false;
 
-  void tagAsTearOffClosureParameter(TypeGraphInferrerEngine inferrer) {
+  void tagAsTearOffClosureParameter(InferrerEngine inferrer) {
     assert(element.isRegularParameter);
     isTearOffClosureParameter = true;
     // We have to add a flow-edge for the default value (if it exists), as we
@@ -610,7 +613,7 @@
   }
 
   // TODO(herhut): Cleanup into one conditional.
-  TypeMask handleSpecialCases(TypeGraphInferrerEngine inferrer) {
+  TypeMask handleSpecialCases(InferrerEngine inferrer) {
     if (!inferrer.backend.canBeUsedForGlobalOptimizations(element) ||
         inferrer.annotations.assumeDynamic(declaration)) {
       // Do not infer types for parameters that have a correspondign annotation
@@ -640,7 +643,7 @@
       giveUp(inferrer);
       return safeType(inferrer);
     }
-    if (inferrer.compiler.inferenceWorld
+    if (inferrer.closedWorldRefiner
         .getCurrentlyKnownMightBePassedToApply(declaration)) {
       giveUp(inferrer);
       return safeType(inferrer);
@@ -658,8 +661,7 @@
     return null;
   }
 
-  TypeMask potentiallyNarrowType(
-      TypeMask mask, TypeGraphInferrerEngine inferrer) {
+  TypeMask potentiallyNarrowType(TypeMask mask, InferrerEngine inferrer) {
     Compiler compiler = inferrer.compiler;
     if (!compiler.options.trustTypeAnnotations &&
         !inferrer.annotations.trustTypeAnnotations(declaration)) {
@@ -669,21 +671,21 @@
     // ignore type annotations to ensure that the checks are actually inserted
     // into the function body and retained until runtime.
     assert(!compiler.options.enableTypeAssertions);
-    return _narrowType(compiler.closedWorld, mask, element.type);
+    return _narrowType(inferrer.closedWorld, mask, element.type);
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     TypeMask special = handleSpecialCases(inferrer);
     if (special != null) return special;
     return potentiallyNarrowType(
         inferrer.types.computeTypeMask(assignments), inferrer);
   }
 
-  TypeMask safeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask safeType(InferrerEngine inferrer) {
     return potentiallyNarrowType(super.safeType(inferrer), inferrer);
   }
 
-  bool hasStableType(TypeGraphInferrerEngine inferrer) {
+  bool hasStableType(InferrerEngine inferrer) {
     // The number of assignments of parameters of instance methods is
     // not stable. Therefore such a parameter cannot be stable.
     if (element.functionDeclaration.isInstanceMember) {
@@ -725,7 +727,7 @@
   String toString() => 'Call site $call $type';
 
   /// Add [this] to the graph being computed by [engine].
-  void addToGraph(TypeGraphInferrerEngine engine);
+  void addToGraph(InferrerEngine engine);
 
   /// Return an iterable over the targets of this call.
   Iterable<Element> get callees;
@@ -745,7 +747,7 @@
       bool inLoop)
       : super(context, call, enclosing, selector, mask, arguments, inLoop);
 
-  void addToGraph(TypeGraphInferrerEngine inferrer) {
+  void addToGraph(InferrerEngine inferrer) {
     MemberTypeInformation callee =
         inferrer.types.getInferredTypeOf(calledElement);
     callee.addCall(caller, call);
@@ -766,7 +768,7 @@
     return selector == null;
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     if (isSynthesized) {
       assert(arguments != null);
       return inferrer.types.getInferredTypeOf(calledElement).type;
@@ -781,13 +783,13 @@
     return visitor.visitStaticCallSiteTypeInformation(this);
   }
 
-  bool hasStableType(TypeGraphInferrerEngine inferrer) {
+  bool hasStableType(InferrerEngine inferrer) {
     return inferrer.types.getInferredTypeOf(calledElement).isStable &&
         (arguments == null || arguments.every((info) => info.isStable)) &&
         super.hasStableType(inferrer);
   }
 
-  void removeAndClearReferences(TypeGraphInferrerEngine inferrer) {
+  void removeAndClearReferences(InferrerEngine inferrer) {
     ElementTypeInformation callee =
         inferrer.types.getInferredTypeOf(calledElement);
     callee.removeUser(this);
@@ -815,11 +817,10 @@
       bool inLoop)
       : super(context, call, enclosing, selector, mask, arguments, inLoop);
 
-  void addToGraph(TypeGraphInferrerEngine inferrer) {
+  void addToGraph(InferrerEngine inferrer) {
     assert(receiver != null);
     TypeMask typeMask = computeTypedSelector(inferrer);
-    targets =
-        inferrer.compiler.closedWorld.allFunctions.filter(selector, typeMask);
+    targets = inferrer.closedWorld.allFunctions.filter(selector, typeMask);
     receiver.addUser(this);
     if (arguments != null) {
       arguments.forEach((info) => info.addUser(this));
@@ -836,7 +837,7 @@
 
   Iterable<Element> get callees => targets.map((e) => e.implementation);
 
-  TypeMask computeTypedSelector(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeTypedSelector(InferrerEngine inferrer) {
     TypeMask receiverType = receiver.type;
 
     if (mask != receiverType) {
@@ -848,7 +849,7 @@
     }
   }
 
-  bool targetsIncludeComplexNoSuchMethod(TypeGraphInferrerEngine inferrer) {
+  bool targetsIncludeComplexNoSuchMethod(InferrerEngine inferrer) {
     return targets.any((Element e) {
       return e is FunctionElement &&
           e.isInstanceMember &&
@@ -867,7 +868,7 @@
    * code.
    */
   TypeInformation handleIntrisifiedSelector(
-      Selector selector, TypeMask mask, TypeGraphInferrerEngine inferrer) {
+      Selector selector, TypeMask mask, InferrerEngine inferrer) {
     ClosedWorld closedWorld = inferrer.closedWorld;
     if (!closedWorld.backendClasses.intImplementation.isResolved) return null;
     if (mask == null) return null;
@@ -965,7 +966,7 @@
     }
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     Iterable<Element> oldTargets = targets;
     TypeMask typeMask = computeTypedSelector(inferrer);
     inferrer.updateSelectorInTree(caller, call, selector, typeMask);
@@ -973,16 +974,16 @@
     Compiler compiler = inferrer.compiler;
     JavaScriptBackend backend = compiler.backend;
     TypeMask maskToUse =
-        compiler.closedWorld.extendMaskIfReachesAll(selector, typeMask);
+        inferrer.closedWorld.extendMaskIfReachesAll(selector, typeMask);
     bool canReachAll = backend.hasInvokeOnSupport && (maskToUse != typeMask);
 
     // If this call could potentially reach all methods that satisfy
     // the untyped selector (through noSuchMethod's `Invocation`
     // and a call to `delegate`), we iterate over all these methods to
     // update their parameter types.
-    targets = compiler.closedWorld.allFunctions.filter(selector, maskToUse);
+    targets = inferrer.closedWorld.allFunctions.filter(selector, maskToUse);
     Iterable<Element> typedTargets = canReachAll
-        ? compiler.closedWorld.allFunctions.filter(selector, typeMask)
+        ? inferrer.closedWorld.allFunctions.filter(selector, typeMask)
         : targets;
 
     // Update the call graph if the targets could have changed.
@@ -1025,30 +1026,29 @@
       if (canReachAll && !typedTargets.contains(element)) {
         return const TypeMask.nonNullEmpty();
       }
-
       if (inferrer.returnsListElementType(selector, typeMask)) {
         ContainerTypeMask containerTypeMask = receiver.type;
         return containerTypeMask.elementType;
       } else if (inferrer.returnsMapValueType(selector, typeMask)) {
-        if (typeMask.isDictionary &&
-            arguments.positional[0].type.isValue &&
-            arguments.positional[0].type.value.isString) {
-          DictionaryTypeMask dictionaryTypeMask = typeMask;
-          ValueTypeMask arg = arguments.positional[0].type;
-          String key = arg.value.primitiveValue.slowToString();
-          if (dictionaryTypeMask.typeMap.containsKey(key)) {
-            if (debug.VERBOSE) {
-              print("Dictionary lookup for $key yields "
-                  "${dictionaryTypeMask.typeMap[key]}.");
+        if (typeMask.isDictionary) {
+          TypeMask arg = arguments.positional[0].type;
+          if (arg is ValueTypeMask && arg.value.isString) {
+            DictionaryTypeMask dictionaryTypeMask = typeMask;
+            String key = arg.value.primitiveValue.slowToString();
+            if (dictionaryTypeMask.typeMap.containsKey(key)) {
+              if (debug.VERBOSE) {
+                print("Dictionary lookup for $key yields "
+                    "${dictionaryTypeMask.typeMap[key]}.");
+              }
+              return dictionaryTypeMask.typeMap[key];
+            } else {
+              // The typeMap is precise, so if we do not find the key, the lookup
+              // will be [null] at runtime.
+              if (debug.VERBOSE) {
+                print("Dictionary lookup for $key yields [null].");
+              }
+              return inferrer.types.nullType.type;
             }
-            return dictionaryTypeMask.typeMap[key];
-          } else {
-            // The typeMap is precise, so if we do not find the key, the lookup
-            // will be [null] at runtime.
-            if (debug.VERBOSE) {
-              print("Dictionary lookup for $key yields [null].");
-            }
-            return inferrer.types.nullType.type;
           }
         }
         MapTypeMask mapTypeMask = typeMask;
@@ -1074,12 +1074,11 @@
     return result;
   }
 
-  void giveUp(TypeGraphInferrerEngine inferrer, {bool clearAssignments: true}) {
+  void giveUp(InferrerEngine inferrer, {bool clearAssignments: true}) {
     if (!abandonInferencing) {
       inferrer.updateSelectorInTree(caller, call, selector, mask);
       Iterable<Element> oldTargets = targets;
-      targets =
-          inferrer.compiler.closedWorld.allFunctions.filter(selector, mask);
+      targets = inferrer.closedWorld.allFunctions.filter(selector, mask);
       for (Element element in targets) {
         if (!oldTargets.contains(element)) {
           MemberTypeInformation callee =
@@ -1094,7 +1093,7 @@
     super.giveUp(inferrer, clearAssignments: clearAssignments);
   }
 
-  void removeAndClearReferences(TypeGraphInferrerEngine inferrer) {
+  void removeAndClearReferences(InferrerEngine inferrer) {
     for (Element element in targets) {
       ElementTypeInformation callee = inferrer.types.getInferredTypeOf(element);
       callee.removeUser(this);
@@ -1111,7 +1110,7 @@
     return visitor.visitDynamicCallSiteTypeInformation(this);
   }
 
-  bool hasStableType(TypeGraphInferrerEngine inferrer) {
+  bool hasStableType(InferrerEngine inferrer) {
     return receiver.isStable &&
         targets.every(
             (element) => inferrer.types.getInferredTypeOf(element).isStable) &&
@@ -1134,12 +1133,12 @@
       bool inLoop)
       : super(context, call, enclosing, selector, mask, arguments, inLoop);
 
-  void addToGraph(TypeGraphInferrerEngine inferrer) {
+  void addToGraph(InferrerEngine inferrer) {
     arguments.forEach((info) => info.addUser(this));
     closure.addUser(this);
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) => safeType(inferrer);
+  TypeMask computeType(InferrerEngine inferrer) => safeType(inferrer);
 
   Iterable<Element> get callees {
     throw new UnsupportedError("Cannot compute callees of a closure call.");
@@ -1151,7 +1150,7 @@
     return visitor.visitClosureCallSiteTypeInformation(this);
   }
 
-  void removeAndClearReferences(TypeGraphInferrerEngine inferrer) {
+  void removeAndClearReferences(InferrerEngine inferrer) {
     // This method is a placeholder for the following comment:
     // We should maintain the information that the closure is a user
     // of its arguments because we do not check that the arguments
@@ -1200,9 +1199,9 @@
     throw "Not supported";
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) => type;
+  TypeMask computeType(InferrerEngine inferrer) => type;
 
-  bool reset(TypeGraphInferrerEngine inferrer) {
+  bool reset(InferrerEngine inferrer) {
     throw "Not supported";
   }
 
@@ -1212,7 +1211,7 @@
     return visitor.visitConcreteTypeInformation(this);
   }
 
-  bool hasStableType(TypeGraphInferrerEngine inferrer) => true;
+  bool hasStableType(InferrerEngine inferrer) => true;
 }
 
 class StringLiteralTypeInformation extends ConcreteTypeInformation {
@@ -1277,7 +1276,7 @@
     assert(assignments.length == 1);
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     TypeMask input = assignments.first.type;
     TypeMask intersection =
         input.intersection(typeAnnotation, inferrer.closedWorld);
@@ -1316,12 +1315,12 @@
     if (parentType != null) addAssignment(parentType);
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     if (!inferred) return safeType(inferrer);
     return inferrer.types.computeTypeMask(assignments);
   }
 
-  bool hasStableType(TypeGraphInferrerEngine inferrer) {
+  bool hasStableType(InferrerEngine inferrer) {
     return inferred && super.hasStableType(inferrer);
   }
 }
@@ -1362,11 +1361,11 @@
     return visitor.visitListTypeInformation(this);
   }
 
-  bool hasStableType(TypeGraphInferrerEngine inferrer) {
+  bool hasStableType(InferrerEngine inferrer) {
     return elementType.isStable && super.hasStableType(inferrer);
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     var mask = type;
     if (!mask.isContainer ||
         mask.elementType != elementType.type ||
@@ -1381,7 +1380,7 @@
     return mask;
   }
 
-  TypeMask safeType(TypeGraphInferrerEngine inferrer) => originalType;
+  TypeMask safeType(InferrerEngine inferrer) => originalType;
 
   void cleanup() {
     super.cleanup();
@@ -1487,7 +1486,7 @@
     return visitor.visitMapTypeInformation(this);
   }
 
-  TypeMask toTypeMask(TypeGraphInferrerEngine inferrer) {
+  TypeMask toTypeMask(InferrerEngine inferrer) {
     if (inDictionaryMode) {
       Map<String, TypeMask> mappings = new Map<String, TypeMask>();
       for (var key in typeInfoMap.keys) {
@@ -1510,7 +1509,7 @@
     }
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     if (type.isDictionary != inDictionaryMode) {
       return toTypeMask(inferrer);
     } else if (type.isDictionary) {
@@ -1539,9 +1538,9 @@
     return type;
   }
 
-  TypeMask safeType(TypeGraphInferrerEngine inferrer) => originalType;
+  TypeMask safeType(InferrerEngine inferrer) => originalType;
 
-  bool hasStableType(TypeGraphInferrerEngine inferrer) {
+  bool hasStableType(InferrerEngine inferrer) {
     return keyType.isStable &&
         valueType.isStable &&
         super.hasStableType(inferrer);
@@ -1597,7 +1596,7 @@
     return visitor.visitValueInMapTypeInformation(this);
   }
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     return nonNull
         ? super.computeType(inferrer)
         : super.computeType(inferrer).nullable();
@@ -1619,7 +1618,7 @@
       this.isLoopPhi, this.variable)
       : super(context);
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask computeType(InferrerEngine inferrer) {
     return inferrer.types.computeTypeMask(assignments);
   }
 
@@ -1638,9 +1637,9 @@
   ClosureTypeInformation(MemberTypeInformation context, this.node, this.element)
       : super(context);
 
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) => safeType(inferrer);
+  TypeMask computeType(InferrerEngine inferrer) => safeType(inferrer);
 
-  TypeMask safeType(TypeGraphInferrerEngine inferrer) {
+  TypeMask safeType(InferrerEngine inferrer) {
     return inferrer.types.functionType.type;
   }
 
@@ -1650,7 +1649,7 @@
     return visitor.visitClosureTypeInformation(this);
   }
 
-  bool hasStableType(TypeGraphInferrerEngine inferrer) {
+  bool hasStableType(InferrerEngine inferrer) {
     return false;
   }
 }
@@ -1696,7 +1695,7 @@
       : super(context);
 
   // TODO(22894): Compute a better type here.
-  TypeMask computeType(TypeGraphInferrerEngine inferrer) => safeType(inferrer);
+  TypeMask computeType(InferrerEngine inferrer) => safeType(inferrer);
 
   String toString() => 'Await';
 
@@ -1727,7 +1726,7 @@
 }
 
 TypeMask _narrowType(
-    ClosedWorld closedWorld, TypeMask type, DartType annotation,
+    ClosedWorld closedWorld, TypeMask type, ResolutionDartType annotation,
     {bool isNullable: true}) {
   if (annotation.treatAsDynamic) return type;
   if (annotation.isObject) return type;
@@ -1740,8 +1739,8 @@
   } else if (annotation.isVoid) {
     otherType = closedWorld.commonMasks.nullType;
   } else {
-    assert(annotation.isInterfaceType);
-    otherType = new TypeMask.nonNullSubtype(annotation.element, closedWorld);
+    ResolutionInterfaceType interfaceType = annotation;
+    otherType = new TypeMask.nonNullSubtype(interfaceType.element, closedWorld);
   }
   if (isNullable) otherType = otherType.nullable();
   if (type == null) return otherType;
diff --git a/pkg/compiler/lib/src/inferrer/type_system.dart b/pkg/compiler/lib/src/inferrer/type_system.dart
new file mode 100644
index 0000000..9f51271
--- /dev/null
+++ b/pkg/compiler/lib/src/inferrer/type_system.dart
@@ -0,0 +1,556 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import '../common.dart';
+import '../elements/elements.dart';
+import '../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionInterfaceType;
+import '../tree/dartstring.dart';
+import '../tree/nodes.dart' as ast;
+import '../types/masks.dart';
+import '../universe/selector.dart';
+import '../world.dart';
+import 'type_graph_nodes.dart';
+
+/**
+ * The class [SimpleInferrerVisitor] will use when working on types.
+ */
+class TypeSystem {
+  final ClosedWorld closedWorld;
+
+  /// [ElementTypeInformation]s for elements.
+  final Map<Element, TypeInformation> typeInformations =
+      new Map<Element, TypeInformation>();
+
+  /// [ListTypeInformation] for allocated lists.
+  final Map<ast.Node, TypeInformation> allocatedLists =
+      new Map<ast.Node, TypeInformation>();
+
+  /// [MapTypeInformation] for allocated Maps.
+  final Map<ast.Node, TypeInformation> allocatedMaps =
+      new Map<ast.Node, TypeInformation>();
+
+  /// Closures found during the analysis.
+  final Set<TypeInformation> allocatedClosures = new Set<TypeInformation>();
+
+  /// Cache of [ConcreteTypeInformation].
+  final Map<TypeMask, TypeInformation> concreteTypes =
+      new Map<TypeMask, TypeInformation>();
+
+  /// List of [TypeInformation]s allocated inside method bodies (calls,
+  /// narrowing, phis, and containers).
+  final List<TypeInformation> allocatedTypes = <TypeInformation>[];
+
+  Iterable<TypeInformation> get allTypes => [
+        typeInformations.values,
+        allocatedLists.values,
+        allocatedMaps.values,
+        allocatedClosures,
+        concreteTypes.values,
+        allocatedTypes
+      ].expand((x) => x);
+
+  TypeSystem(this.closedWorld) {
+    nonNullEmptyType = getConcreteTypeFor(commonMasks.emptyType);
+  }
+
+  CommonMasks get commonMasks => closedWorld.commonMasks;
+
+  /// Used to group [TypeInformation] nodes by the element that triggered their
+  /// creation.
+  MemberTypeInformation _currentMember = null;
+  MemberTypeInformation get currentMember => _currentMember;
+
+  void withMember(MemberElement element, action) {
+    assert(invariant(element, _currentMember == null,
+        message: "Already constructing graph for $_currentMember."));
+    _currentMember = getInferredTypeOf(element);
+    action();
+    _currentMember = null;
+  }
+
+  TypeInformation nullTypeCache;
+  TypeInformation get nullType {
+    if (nullTypeCache != null) return nullTypeCache;
+    return nullTypeCache = getConcreteTypeFor(commonMasks.nullType);
+  }
+
+  TypeInformation intTypeCache;
+  TypeInformation get intType {
+    if (intTypeCache != null) return intTypeCache;
+    return intTypeCache = getConcreteTypeFor(commonMasks.intType);
+  }
+
+  TypeInformation uint32TypeCache;
+  TypeInformation get uint32Type {
+    if (uint32TypeCache != null) return uint32TypeCache;
+    return uint32TypeCache = getConcreteTypeFor(commonMasks.uint32Type);
+  }
+
+  TypeInformation uint31TypeCache;
+  TypeInformation get uint31Type {
+    if (uint31TypeCache != null) return uint31TypeCache;
+    return uint31TypeCache = getConcreteTypeFor(commonMasks.uint31Type);
+  }
+
+  TypeInformation positiveIntTypeCache;
+  TypeInformation get positiveIntType {
+    if (positiveIntTypeCache != null) return positiveIntTypeCache;
+    return positiveIntTypeCache =
+        getConcreteTypeFor(commonMasks.positiveIntType);
+  }
+
+  TypeInformation doubleTypeCache;
+  TypeInformation get doubleType {
+    if (doubleTypeCache != null) return doubleTypeCache;
+    return doubleTypeCache = getConcreteTypeFor(commonMasks.doubleType);
+  }
+
+  TypeInformation numTypeCache;
+  TypeInformation get numType {
+    if (numTypeCache != null) return numTypeCache;
+    return numTypeCache = getConcreteTypeFor(commonMasks.numType);
+  }
+
+  TypeInformation boolTypeCache;
+  TypeInformation get boolType {
+    if (boolTypeCache != null) return boolTypeCache;
+    return boolTypeCache = getConcreteTypeFor(commonMasks.boolType);
+  }
+
+  TypeInformation functionTypeCache;
+  TypeInformation get functionType {
+    if (functionTypeCache != null) return functionTypeCache;
+    return functionTypeCache = getConcreteTypeFor(commonMasks.functionType);
+  }
+
+  TypeInformation listTypeCache;
+  TypeInformation get listType {
+    if (listTypeCache != null) return listTypeCache;
+    return listTypeCache = getConcreteTypeFor(commonMasks.listType);
+  }
+
+  TypeInformation constListTypeCache;
+  TypeInformation get constListType {
+    if (constListTypeCache != null) return constListTypeCache;
+    return constListTypeCache = getConcreteTypeFor(commonMasks.constListType);
+  }
+
+  TypeInformation fixedListTypeCache;
+  TypeInformation get fixedListType {
+    if (fixedListTypeCache != null) return fixedListTypeCache;
+    return fixedListTypeCache = getConcreteTypeFor(commonMasks.fixedListType);
+  }
+
+  TypeInformation growableListTypeCache;
+  TypeInformation get growableListType {
+    if (growableListTypeCache != null) return growableListTypeCache;
+    return growableListTypeCache =
+        getConcreteTypeFor(commonMasks.growableListType);
+  }
+
+  TypeInformation mapTypeCache;
+  TypeInformation get mapType {
+    if (mapTypeCache != null) return mapTypeCache;
+    return mapTypeCache = getConcreteTypeFor(commonMasks.mapType);
+  }
+
+  TypeInformation constMapTypeCache;
+  TypeInformation get constMapType {
+    if (constMapTypeCache != null) return constMapTypeCache;
+    return constMapTypeCache = getConcreteTypeFor(commonMasks.constMapType);
+  }
+
+  TypeInformation stringTypeCache;
+  TypeInformation get stringType {
+    if (stringTypeCache != null) return stringTypeCache;
+    return stringTypeCache = getConcreteTypeFor(commonMasks.stringType);
+  }
+
+  TypeInformation typeTypeCache;
+  TypeInformation get typeType {
+    if (typeTypeCache != null) return typeTypeCache;
+    return typeTypeCache = getConcreteTypeFor(commonMasks.typeType);
+  }
+
+  TypeInformation dynamicTypeCache;
+  TypeInformation get dynamicType {
+    if (dynamicTypeCache != null) return dynamicTypeCache;
+    return dynamicTypeCache = getConcreteTypeFor(commonMasks.dynamicType);
+  }
+
+  TypeInformation asyncFutureTypeCache;
+  // Subtype of Future returned by async methods.
+  TypeInformation get asyncFutureType {
+    if (asyncFutureTypeCache != null) return asyncFutureTypeCache;
+    return asyncFutureTypeCache =
+        getConcreteTypeFor(commonMasks.asyncFutureType);
+  }
+
+  TypeInformation syncStarIterableTypeCache;
+  TypeInformation get syncStarIterableType {
+    if (syncStarIterableTypeCache != null) return syncStarIterableTypeCache;
+    return syncStarIterableTypeCache =
+        getConcreteTypeFor(commonMasks.syncStarIterableType);
+  }
+
+  TypeInformation asyncStarStreamTypeCache;
+  TypeInformation get asyncStarStreamType {
+    if (asyncStarStreamTypeCache != null) return asyncStarStreamTypeCache;
+    return asyncStarStreamTypeCache =
+        getConcreteTypeFor(commonMasks.asyncStarStreamType);
+  }
+
+  TypeInformation nonNullEmptyType;
+
+  TypeInformation stringLiteralType(DartString value) {
+    return new StringLiteralTypeInformation(value, commonMasks.stringType);
+  }
+
+  TypeInformation boolLiteralType(ast.LiteralBool value) {
+    return new BoolLiteralTypeInformation(value, commonMasks.boolType);
+  }
+
+  /**
+   * Returns the least upper bound between [firstType] and
+   * [secondType].
+   */
+  TypeInformation computeLUB(
+      TypeInformation firstType, TypeInformation secondType) {
+    if (firstType == null) return secondType;
+    if (firstType == secondType) return firstType;
+    if (firstType == nonNullEmptyType) return secondType;
+    if (secondType == nonNullEmptyType) return firstType;
+    if (firstType == dynamicType || secondType == dynamicType) {
+      return dynamicType;
+    }
+    return getConcreteTypeFor(
+        firstType.type.union(secondType.type, closedWorld));
+  }
+
+  /**
+   * Returns `true` if `selector` should be updated to reflect the new
+   * `receiverType`.
+   */
+  bool selectorNeedsUpdate(TypeInformation info, TypeMask mask) {
+    return info.type != mask;
+  }
+
+  /**
+   * Returns a new receiver type for this [selector] applied to
+   * [receiverType].
+   *
+   * The option [isConditional] is true when [selector] was seen in a
+   * conditional send (e.g.  `a?.selector`), in which case the returned type may
+   * be null.
+   */
+  TypeInformation refineReceiver(Selector selector, TypeMask mask,
+      TypeInformation receiver, bool isConditional) {
+    if (receiver.type.isExact) return receiver;
+    TypeMask otherType = closedWorld.allFunctions.receiverType(selector, mask);
+    // Conditional sends (a?.b) can still narrow the possible types of `a`,
+    // however, we still need to consider that `a` may be null.
+    if (isConditional) {
+      // Note: we don't check that receiver.type.isNullable here because this is
+      // called during the graph construction.
+      otherType = otherType.nullable();
+    }
+    // If this is refining to nullable subtype of `Object` just return
+    // the receiver. We know the narrowing is useless.
+    if (otherType.isNullable && otherType.containsAll(closedWorld)) {
+      return receiver;
+    }
+    assert(TypeMask.assertIsNormalized(otherType, closedWorld));
+    TypeInformation newType = new NarrowTypeInformation(receiver, otherType);
+    allocatedTypes.add(newType);
+    return newType;
+  }
+
+  /**
+   * Returns the intersection between [type] and [annotation].
+   * [isNullable] indicates whether the annotation implies a null
+   * type.
+   */
+  TypeInformation narrowType(
+      TypeInformation type, ResolutionDartType annotation,
+      {bool isNullable: true}) {
+    if (annotation.treatAsDynamic) return type;
+    if (annotation.isVoid) return nullType;
+    if (annotation.element == closedWorld.commonElements.objectClass &&
+        isNullable) {
+      return type;
+    }
+    TypeMask otherType;
+    if (annotation.isTypedef || annotation.isFunctionType) {
+      otherType = functionType.type;
+    } else if (annotation.isTypeVariable) {
+      // TODO(ngeoffray): Narrow to bound.
+      return type;
+    } else {
+      ResolutionInterfaceType interface = annotation;
+      otherType = annotation.element == closedWorld.commonElements.objectClass
+          ? dynamicType.type.nonNullable()
+          : new TypeMask.nonNullSubtype(interface.element, closedWorld);
+    }
+    if (isNullable) otherType = otherType.nullable();
+    if (type.type.isExact) {
+      return type;
+    } else {
+      assert(TypeMask.assertIsNormalized(otherType, closedWorld));
+      TypeInformation newType = new NarrowTypeInformation(type, otherType);
+      allocatedTypes.add(newType);
+      return newType;
+    }
+  }
+
+  /**
+   * Returns the non-nullable type of [type].
+   */
+  TypeInformation narrowNotNull(TypeInformation type) {
+    if (type.type.isExact && !type.type.isNullable) {
+      return type;
+    }
+    TypeInformation newType =
+        new NarrowTypeInformation(type, dynamicType.type.nonNullable());
+    allocatedTypes.add(newType);
+    return newType;
+  }
+
+  ElementTypeInformation getInferredTypeOf(Element element) {
+    element = element.implementation;
+    return typeInformations.putIfAbsent(element, () {
+      return new ElementTypeInformation(element, this);
+    });
+  }
+
+  /**
+   * Returns the internal inferrer representation for [mask].
+   */
+  ConcreteTypeInformation getConcreteTypeFor(TypeMask mask) {
+    assert(mask != null);
+    return concreteTypes.putIfAbsent(mask, () {
+      return new ConcreteTypeInformation(mask);
+    });
+  }
+
+  String getInferredSignatureOf(FunctionElement function) {
+    ElementTypeInformation info = getInferredTypeOf(function);
+    FunctionElement impl = function.implementation;
+    FunctionSignature signature = impl.functionSignature;
+    var res = "";
+    signature.forEachParameter((Element parameter) {
+      TypeInformation type = getInferredTypeOf(parameter);
+      res += "${res.isEmpty ? '(' : ', '}${type.type} ${parameter.name}";
+    });
+    res += ") -> ${info.type}";
+    return res;
+  }
+
+  TypeInformation nonNullSubtype(ClassElement type) {
+    return getConcreteTypeFor(
+        new TypeMask.nonNullSubtype(type.declaration, closedWorld));
+  }
+
+  TypeInformation nonNullSubclass(ClassElement type) {
+    return getConcreteTypeFor(
+        new TypeMask.nonNullSubclass(type.declaration, closedWorld));
+  }
+
+  TypeInformation nonNullExact(ClassElement type) {
+    return getConcreteTypeFor(
+        new TypeMask.nonNullExact(type.declaration, closedWorld));
+  }
+
+  TypeInformation nonNullEmpty() {
+    return nonNullEmptyType;
+  }
+
+  bool isNull(TypeInformation type) {
+    return type == nullType;
+  }
+
+  TypeInformation allocateList(
+      TypeInformation type, ast.Node node, Element enclosing,
+      [TypeInformation elementType, int length]) {
+    ClassElement typedDataClass = closedWorld.commonElements.typedDataClass;
+    bool isTypedArray = typedDataClass != null &&
+        closedWorld.isInstantiated(typedDataClass) &&
+        type.type.satisfies(typedDataClass, closedWorld);
+    bool isConst = (type.type == commonMasks.constListType);
+    bool isFixed =
+        (type.type == commonMasks.fixedListType) || isConst || isTypedArray;
+    bool isElementInferred = isConst || isTypedArray;
+
+    int inferredLength = isFixed ? length : null;
+    TypeMask elementTypeMask =
+        isElementInferred ? elementType.type : dynamicType.type;
+    ContainerTypeMask mask = new ContainerTypeMask(
+        type.type, node, enclosing, elementTypeMask, inferredLength);
+    ElementInContainerTypeInformation element =
+        new ElementInContainerTypeInformation(currentMember, elementType);
+    element.inferred = isElementInferred;
+
+    allocatedTypes.add(element);
+    return allocatedLists[node] =
+        new ListTypeInformation(currentMember, mask, element, length);
+  }
+
+  TypeInformation allocateClosure(ast.Node node, Element element) {
+    TypeInformation result =
+        new ClosureTypeInformation(currentMember, node, element);
+    allocatedClosures.add(result);
+    return result;
+  }
+
+  TypeInformation allocateMap(
+      ConcreteTypeInformation type, ast.Node node, Element element,
+      [List<TypeInformation> keyTypes, List<TypeInformation> valueTypes]) {
+    assert(keyTypes.length == valueTypes.length);
+    bool isFixed = (type.type == commonMasks.constMapType);
+
+    TypeMask keyType, valueType;
+    if (isFixed) {
+      keyType = keyTypes.fold(nonNullEmptyType.type,
+          (type, info) => type.union(info.type, closedWorld));
+      valueType = valueTypes.fold(nonNullEmptyType.type,
+          (type, info) => type.union(info.type, closedWorld));
+    } else {
+      keyType = valueType = dynamicType.type;
+    }
+    MapTypeMask mask =
+        new MapTypeMask(type.type, node, element, keyType, valueType);
+
+    TypeInformation keyTypeInfo =
+        new KeyInMapTypeInformation(currentMember, null);
+    TypeInformation valueTypeInfo =
+        new ValueInMapTypeInformation(currentMember, null);
+    allocatedTypes.add(keyTypeInfo);
+    allocatedTypes.add(valueTypeInfo);
+
+    MapTypeInformation map =
+        new MapTypeInformation(currentMember, mask, keyTypeInfo, valueTypeInfo);
+
+    for (int i = 0; i < keyTypes.length; ++i) {
+      TypeInformation newType =
+          map.addEntryAssignment(keyTypes[i], valueTypes[i], true);
+      if (newType != null) allocatedTypes.add(newType);
+    }
+
+    // Shortcut: If we already have a first approximation of the key/value type,
+    // start propagating it early.
+    if (isFixed) map.markAsInferred();
+
+    allocatedMaps[node] = map;
+    return map;
+  }
+
+  TypeMask newTypedSelector(TypeInformation info, TypeMask mask) {
+    // Only type the selector if [info] is concrete, because the other
+    // kinds of [TypeInformation] have the empty type at this point of
+    // analysis.
+    return info.isConcrete ? info.type : mask;
+  }
+
+  /**
+   * Returns a new type that unions [firstInput] and [secondInput].
+   */
+  TypeInformation allocateDiamondPhi(
+      TypeInformation firstInput, TypeInformation secondInput) {
+    PhiElementTypeInformation result =
+        new PhiElementTypeInformation(currentMember, null, false, null);
+    result.addAssignment(firstInput);
+    result.addAssignment(secondInput);
+    allocatedTypes.add(result);
+    return result;
+  }
+
+  PhiElementTypeInformation _addPhi(
+      ast.Node node, Local variable, inputType, bool isLoop) {
+    PhiElementTypeInformation result =
+        new PhiElementTypeInformation(currentMember, node, isLoop, variable);
+    allocatedTypes.add(result);
+    result.addAssignment(inputType);
+    return result;
+  }
+
+  /**
+   * Returns a new type for holding the potential types of [element].
+   * [inputType] is the first incoming type of the phi.
+   */
+  PhiElementTypeInformation allocatePhi(
+      ast.Node node, Local variable, inputType) {
+    // Check if [inputType] is a phi for a local updated in
+    // the try/catch block [node]. If it is, no need to allocate a new
+    // phi.
+    if (inputType is PhiElementTypeInformation &&
+        inputType.branchNode == node &&
+        inputType.branchNode is ast.TryStatement) {
+      return inputType;
+    }
+    return _addPhi(node, variable, inputType, false);
+  }
+
+  /**
+   * Returns a new type for holding the potential types of [element].
+   * [inputType] is the first incoming type of the phi. [allocateLoopPhi]
+   * only differs from [allocatePhi] in that it allows the underlying
+   * implementation of [TypeSystem] to differentiate Phi nodes due to loops
+   * from other merging uses.
+   */
+  PhiElementTypeInformation allocateLoopPhi(
+      ast.Node node, Local variable, inputType) {
+    return _addPhi(node, variable, inputType, true);
+  }
+
+  /**
+   * Simplies the phi representing [element] and of the type
+   * [phiType]. For example, if this phi has one incoming input, an
+   * implementation of this method could just return that incoming
+   * input type.
+   */
+  TypeInformation simplifyPhi(
+      ast.Node node, Local variable, PhiElementTypeInformation phiType) {
+    assert(phiType.branchNode == node);
+    if (phiType.assignments.length == 1) return phiType.assignments.first;
+    return phiType;
+  }
+
+  /**
+   * Adds [newType] as an input of [phiType].
+   */
+  PhiElementTypeInformation addPhiInput(Local variable,
+      PhiElementTypeInformation phiType, TypeInformation newType) {
+    phiType.addAssignment(newType);
+    return phiType;
+  }
+
+  TypeMask computeTypeMask(Iterable<TypeInformation> assignments) {
+    return joinTypeMasks(assignments.map((e) => e.type));
+  }
+
+  TypeMask joinTypeMasks(Iterable<TypeMask> masks) {
+    var dynamicType = commonMasks.dynamicType;
+    // Optimization: we are iterating over masks twice, but because `masks` is a
+    // mapped iterable, we save the intermediate results to avoid computing them
+    // again.
+    var list = [];
+    for (TypeMask mask in masks) {
+      // Don't do any work on computing unions if we know that after all that
+      // work the result will be `dynamic`.
+      // TODO(sigmund): change to `mask == dynamicType` so we can continue to
+      // track the non-nullable bit.
+      if (mask.containsAll(closedWorld)) return dynamicType;
+      list.add(mask);
+    }
+
+    TypeMask newType = null;
+    for (TypeMask mask in list) {
+      newType = newType == null ? mask : newType.union(mask, closedWorld);
+      // Likewise - stop early if we already reach dynamic.
+      if (newType.containsAll(closedWorld)) return dynamicType;
+    }
+
+    return newType ?? const TypeMask.nonNullEmpty();
+  }
+}
diff --git a/pkg/compiler/lib/src/io/code_output.dart b/pkg/compiler/lib/src/io/code_output.dart
index e43cbbb..674bef3 100644
--- a/pkg/compiler/lib/src/io/code_output.dart
+++ b/pkg/compiler/lib/src/io/code_output.dart
@@ -39,7 +39,7 @@
   /// If the output is closed, a [StateError] is thrown.
   void addBuffer(CodeBuffer buffer);
 
-  /// Returns the number of characters currently write to this output.
+  /// Returns the number of characters currently written to this output.
   int get length;
 
   /// Returns `true` if this output has been closed.
diff --git a/pkg/compiler/lib/src/io/position_information.dart b/pkg/compiler/lib/src/io/position_information.dart
index cfb6657..17e8397 100644
--- a/pkg/compiler/lib/src/io/position_information.dart
+++ b/pkg/compiler/lib/src/io/position_information.dart
@@ -520,11 +520,17 @@
 
   @override
   void onStep(js.Node node, Offset offset, StepKind kind) {
-    SourceInformation sourceInformation = computeSourceInformation(node);
-    if (sourceInformation == null) return;
     int codeLocation = offset.value;
     if (codeLocation == null) return;
 
+    if (kind == StepKind.NO_INFO) {
+      sourceMapper.register(node, codeLocation, const NoSourceLocationMarker());
+      return;
+    }
+
+    SourceInformation sourceInformation = computeSourceInformation(node);
+    if (sourceInformation == null) return;
+
     void registerPosition(SourcePositionKind sourcePositionKind) {
       SourceLocation sourceLocation =
           getSourceLocation(sourceInformation, sourcePositionKind);
@@ -562,6 +568,8 @@
       case StepKind.SWITCH_EXPRESSION:
         registerPosition(SourcePositionKind.START);
         break;
+      case StepKind.NO_INFO:
+        break;
     }
   }
 }
@@ -685,7 +693,13 @@
   }
 }
 
-enum BranchKind { CONDITION, LOOP, CATCH, FINALLY, CASE, }
+enum BranchKind {
+  CONDITION,
+  LOOP,
+  CATCH,
+  FINALLY,
+  CASE,
+}
 
 enum StepKind {
   FUN_ENTRY,
@@ -704,6 +718,7 @@
   WHILE_CONDITION,
   DO_CONDITION,
   SWITCH_EXPRESSION,
+  NO_INFO,
 }
 
 /// Listener for the [JavaScriptTracer].
@@ -769,14 +784,20 @@
     }
   }
 
-  void notifyStep(js.Node node, Offset offset, StepKind kind) {
-    if (active) {
+  void notifyStep(js.Node node, Offset offset, StepKind kind,
+      {bool force: false}) {
+    if (active || force) {
       listeners.forEach((listener) => listener.onStep(node, offset, kind));
     }
   }
 
   void apply(js.Node node) {
     notifyStart(node);
+
+    int startPosition = getSyntaxOffset(node, kind: CodePositionKind.START);
+    Offset startOffset = getOffsetForNode(node, startPosition);
+    notifyStep(node, startOffset, StepKind.NO_INFO, force: true);
+
     node.accept(this);
     notifyEnd(node);
   }
@@ -823,6 +844,11 @@
         statementOffset = getSyntaxOffset(node, kind: CodePositionKind.CLOSING);
     Offset exitOffset = getOffsetForNode(node, statementOffset);
     notifyStep(node, exitOffset, StepKind.FUN_EXIT);
+    if (active && !activeBefore) {
+      int endPosition = getSyntaxOffset(node, kind: CodePositionKind.END);
+      Offset endOffset = getOffsetForNode(node, endPosition);
+      notifyStep(node, endOffset, StepKind.NO_INFO);
+    }
     active = activeBefore;
   }
 
diff --git a/pkg/compiler/lib/src/io/source_information.dart b/pkg/compiler/lib/src/io/source_information.dart
index a84d8bf..2b01ba1 100644
--- a/pkg/compiler/lib/src/io/source_information.dart
+++ b/pkg/compiler/lib/src/io/source_information.dart
@@ -154,35 +154,25 @@
 
 /// A location in a source file.
 abstract class SourceLocation {
-  final SourceFile _sourceFile;
-  int _line;
-
-  SourceLocation(this._sourceFile) {
-    assert(invariant(new SourceSpan(sourceUri, 0, 0), isValid,
-        message: "Invalid source location in ${sourceUri}: "
-            "offset=$offset, length=${_sourceFile.length}."));
-  }
+  const SourceLocation();
 
   /// The absolute URI of the source file of this source location.
-  Uri get sourceUri => _sourceFile.uri;
+  Uri get sourceUri;
 
   /// The character offset of the this source location into the source file.
   int get offset;
 
   /// The 0-based line number of the [offset].
-  int get line {
-    if (_line == null) _line = _sourceFile.getLine(offset);
-    return _line;
-  }
+  int get line;
 
   /// The 0-base column number of the [offset] with its line.
-  int get column => _sourceFile.getColumn(line, offset);
+  int get column;
 
   /// The name associated with this source location, if any.
   String get sourceName;
 
   /// `true` if the offset within the length of the source file.
-  bool get isValid => offset < _sourceFile.length;
+  bool get isValid;
 
   int get hashCode {
     return sourceUri.hashCode * 17 +
@@ -209,7 +199,50 @@
   }
 }
 
-class OffsetSourceLocation extends SourceLocation {
+/// A location in a source file.
+abstract class AbstractSourceLocation extends SourceLocation {
+  final SourceFile _sourceFile;
+  int _line;
+
+  AbstractSourceLocation(this._sourceFile) {
+    assert(invariant(new SourceSpan(sourceUri, 0, 0), isValid,
+        message: "Invalid source location in ${sourceUri}: "
+            "offset=$offset, length=${_sourceFile.length}."));
+  }
+
+  /// The absolute URI of the source file of this source location.
+  Uri get sourceUri => _sourceFile.uri;
+
+  /// The character offset of the this source location into the source file.
+  int get offset;
+
+  /// The 0-based line number of the [offset].
+  int get line {
+    if (_line == null) _line = _sourceFile.getLine(offset);
+    return _line;
+  }
+
+  /// The 0-base column number of the [offset] with its line.
+  int get column => _sourceFile.getColumn(line, offset);
+
+  /// The name associated with this source location, if any.
+  String get sourceName;
+
+  /// `true` if the offset within the length of the source file.
+  bool get isValid => offset < _sourceFile.length;
+
+  String get shortText {
+    // Use 1-based line/column info to match usual dart tool output.
+    return '${sourceUri.pathSegments.last}:[${line + 1},${column + 1}]';
+  }
+
+  String toString() {
+    // Use 1-based line/column info to match usual dart tool output.
+    return '${sourceUri}:[${line + 1},${column + 1}]';
+  }
+}
+
+class OffsetSourceLocation extends AbstractSourceLocation {
   final int offset;
   final String sourceName;
 
@@ -282,3 +315,29 @@
   }
   return sourceFile;
 }
+
+class NoSourceLocationMarker extends SourceLocation {
+  const NoSourceLocationMarker();
+
+  @override
+  Uri get sourceUri => null;
+
+  @override
+  bool get isValid => true;
+
+  @override
+  String get sourceName => null;
+
+  @override
+  int get column => null;
+
+  @override
+  int get line => null;
+
+  @override
+  int get offset => null;
+
+  String get shortName => '<no-location>';
+
+  String toString() => '<no-location>';
+}
diff --git a/pkg/compiler/lib/src/io/source_map_builder.dart b/pkg/compiler/lib/src/io/source_map_builder.dart
index c3e6f5f..e7c12aa 100644
--- a/pkg/compiler/lib/src/io/source_map_builder.dart
+++ b/pkg/compiler/lib/src/io/source_map_builder.dart
@@ -52,10 +52,13 @@
 
       SourceLocation location = sourceMapEntry.sourceLocation;
       if (location != null) {
-        LineColumnMap<SourceMapEntry> sourceLineColumnMap =
-            sourceLocationMap.putIfAbsent(
-                location.sourceUri, () => new LineColumnMap<SourceMapEntry>());
-        sourceLineColumnMap.add(location.line, location.column, sourceMapEntry);
+        if (location.sourceUri != null) {
+          LineColumnMap<SourceMapEntry> sourceLineColumnMap =
+              sourceLocationMap.putIfAbsent(location.sourceUri,
+                  () => new LineColumnMap<SourceMapEntry>());
+          sourceLineColumnMap.add(
+              location.line, location.column, sourceMapEntry);
+        }
       }
     });
 
@@ -69,9 +72,11 @@
     lineColumnMap.forEachElement((SourceMapEntry entry) {
       SourceLocation sourceLocation = entry.sourceLocation;
       if (sourceLocation != null) {
-        uriMap.register(sourceLocation.sourceUri);
-        if (sourceLocation.sourceName != null) {
-          nameMap.register(sourceLocation.sourceName);
+        if (sourceLocation.sourceUri != null) {
+          uriMap.register(sourceLocation.sourceUri);
+          if (sourceLocation.sourceName != null) {
+            nameMap.register(sourceLocation.sourceName);
+          }
         }
       }
     });
@@ -143,9 +148,11 @@
       }
 
       Uri sourceUri = sourceLocation.sourceUri;
-      sourceUriIndexEncoder.encode(output, uriMap[sourceUri]);
-      sourceLineEncoder.encode(output, sourceLocation.line);
-      sourceColumnEncoder.encode(output, sourceLocation.column);
+      if (sourceUri != null) {
+        sourceUriIndexEncoder.encode(output, uriMap[sourceUri]);
+        sourceLineEncoder.encode(output, sourceLocation.line);
+        sourceColumnEncoder.encode(output, sourceLocation.column);
+      }
 
       String sourceName = sourceLocation.sourceName;
       if (sourceName != null) {
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index c4d156b..f5a2453 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -18,18 +18,19 @@
         ForeignResolver,
         NativeRegistry;
 import '../common/codegen.dart' show CodegenImpact, CodegenWorkItem;
-import '../common/names.dart' show Identifiers, Selectors, Uris;
+import '../common/names.dart' show Identifiers, Uris;
 import '../common/resolution.dart' show Frontend, Resolution, ResolutionImpact;
 import '../common/tasks.dart' show CompilerTask;
 import '../compiler.dart' show Compiler;
 import '../constants/constant_system.dart';
 import '../constants/expressions.dart';
 import '../constants/values.dart';
-import '../core_types.dart' show CoreClasses, CoreTypes;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart';
 import '../deferred_load.dart' show DeferredLoadTask;
 import '../dump_info.dart' show DumpInfoTask;
 import '../elements/elements.dart';
+import '../elements/entities.dart';
 import '../enqueue.dart'
     show Enqueuer, ResolutionEnqueuer, TreeShakingEnqueuerStrategy;
 import '../io/position_information.dart' show PositionSourceInformationStrategy;
@@ -44,6 +45,7 @@
 import '../library_loader.dart' show LibraryLoader, LoadedLibraries;
 import '../native/native.dart' as native;
 import '../ssa/ssa.dart' show SsaFunctionCompiler;
+import '../tracer.dart';
 import '../tree/tree.dart';
 import '../types/types.dart';
 import '../universe/call_structure.dart' show CallStructure;
@@ -63,7 +65,7 @@
         WorldImpactVisitor,
         StagedWorldImpactBuilder;
 import '../util/util.dart';
-import '../world.dart' show ClosedWorld;
+import '../world.dart' show ClosedWorld, ClosedWorldRefiner;
 import 'backend_helpers.dart';
 import 'backend_impact.dart';
 import 'backend_serialization.dart' show JavaScriptBackendSerialization;
@@ -87,7 +89,7 @@
 
 abstract class FunctionCompiler {
   /// Generates JavaScript code for `work.element`.
-  jsAst.Fun compile(CodegenWorkItem work);
+  jsAst.Fun compile(CodegenWorkItem work, ClosedWorld closedWorld);
 
   Iterable get tasks;
 }
@@ -304,7 +306,7 @@
 class JavaScriptBackend extends Backend {
   String get patchVersion => emitter.patchVersion;
 
-  bool get supportsReflection => emitter.emitter.supportsReflection;
+  bool get supportsReflection => emitter.supportsReflection;
 
   final Annotations annotations;
 
@@ -322,9 +324,8 @@
   /**
    * The generated code as a js AST for compiled methods.
    */
-  Map<Element, jsAst.Expression> get generatedCode {
-    return codegenEnqueuer.generatedCode;
-  }
+  final Map<Element, jsAst.Expression> generatedCode =
+      <Element, jsAst.Expression>{};
 
   FunctionInlineCache inlineCache = new FunctionInlineCache();
 
@@ -336,81 +337,19 @@
   static const bool TRACE_CALLS =
       TRACE_METHOD == 'post' || TRACE_METHOD == 'console';
 
-  TypeMask get stringType => compiler.closedWorld.commonMasks.stringType;
-  TypeMask get doubleType => compiler.closedWorld.commonMasks.doubleType;
-  TypeMask get intType => compiler.closedWorld.commonMasks.intType;
-  TypeMask get uint32Type => compiler.closedWorld.commonMasks.uint32Type;
-  TypeMask get uint31Type => compiler.closedWorld.commonMasks.uint31Type;
-  TypeMask get positiveIntType =>
-      compiler.closedWorld.commonMasks.positiveIntType;
-  TypeMask get numType => compiler.closedWorld.commonMasks.numType;
-  TypeMask get boolType => compiler.closedWorld.commonMasks.boolType;
-  TypeMask get dynamicType => compiler.closedWorld.commonMasks.dynamicType;
-  TypeMask get nullType => compiler.closedWorld.commonMasks.nullType;
-  TypeMask get emptyType => const TypeMask.nonNullEmpty();
-  TypeMask get nonNullType => compiler.closedWorld.commonMasks.nonNullType;
-
-  TypeMask _indexablePrimitiveTypeCache;
-  TypeMask get indexablePrimitiveType {
-    if (_indexablePrimitiveTypeCache == null) {
-      _indexablePrimitiveTypeCache = new TypeMask.nonNullSubtype(
-          helpers.jsIndexableClass, compiler.closedWorld);
-    }
-    return _indexablePrimitiveTypeCache;
-  }
-
-  TypeMask _readableArrayTypeCache;
-  TypeMask get readableArrayType {
-    if (_readableArrayTypeCache == null) {
-      _readableArrayTypeCache = new TypeMask.nonNullSubclass(
-          helpers.jsArrayClass, compiler.closedWorld);
-    }
-    return _readableArrayTypeCache;
-  }
-
-  TypeMask _mutableArrayTypeCache;
-  TypeMask get mutableArrayType {
-    if (_mutableArrayTypeCache == null) {
-      _mutableArrayTypeCache = new TypeMask.nonNullSubclass(
-          helpers.jsMutableArrayClass, compiler.closedWorld);
-    }
-    return _mutableArrayTypeCache;
-  }
-
-  TypeMask _fixedArrayTypeCache;
-  TypeMask get fixedArrayType {
-    if (_fixedArrayTypeCache == null) {
-      _fixedArrayTypeCache = new TypeMask.nonNullExact(
-          helpers.jsFixedArrayClass, compiler.closedWorld);
-    }
-    return _fixedArrayTypeCache;
-  }
-
-  TypeMask _extendableArrayTypeCache;
-  TypeMask get extendableArrayType {
-    if (_extendableArrayTypeCache == null) {
-      _extendableArrayTypeCache = new TypeMask.nonNullExact(
-          helpers.jsExtendableArrayClass, compiler.closedWorld);
-    }
-    return _extendableArrayTypeCache;
-  }
-
-  TypeMask _unmodifiableArrayTypeCache;
-  TypeMask get unmodifiableArrayType {
-    if (_unmodifiableArrayTypeCache == null) {
-      _unmodifiableArrayTypeCache = new TypeMask.nonNullExact(
-          helpers.jsUnmodifiableArrayClass, compiler.closedWorld);
-    }
-    return _fixedArrayTypeCache;
-  }
-
   /// Maps special classes to their implementation (JSXxx) class.
   Map<ClassElement, ClassElement> implementationClasses;
 
   bool needToInitializeIsolateAffinityTag = false;
   bool needToInitializeDispatchProperty = false;
 
-  final Namer namer;
+  Namer _namer;
+
+  Namer get namer {
+    assert(invariant(NO_LOCATION_SPANNABLE, _namer != null,
+        message: "Namer has not been created yet."));
+    return _namer;
+  }
 
   /**
    * A collection of selectors that must have a one shot interceptor
@@ -470,8 +409,7 @@
   /**
    * A set of members that are called from subclasses via `super`.
    */
-  final Set<FunctionElement> aliasedSuperMembers =
-      new Setlet<FunctionElement>();
+  final Set<MethodElement> aliasedSuperMembers = new Setlet<MethodElement>();
 
   List<CompilerTask> get tasks {
     List<CompilerTask> result = functionCompiler.tasks;
@@ -522,6 +460,18 @@
   /// `true` if access to [BackendHelpers.invokeOnMethod] is supported.
   bool hasInvokeOnSupport = false;
 
+  /// `true` if tear-offs are supported for incremental compilation.
+  bool hasIncrementalTearOffSupport = false;
+
+  /// `true` of `Object.runtimeType` is supported.
+  bool hasRuntimeTypeSupport = false;
+
+  /// `true` of use of the `dart:isolate` library is supported.
+  bool hasIsolateSupport = false;
+
+  /// `true` of `Function.apply` is supported.
+  bool hasFunctionApplySupport = false;
+
   /// List of constants from metadata.  If metadata must be preserved,
   /// these constants must be registered.
   final List<Dependency> metadataConstants = <Dependency>[];
@@ -589,6 +539,7 @@
   PatchResolverTask patchResolverTask;
 
   bool enabledNoSuchMethod = false;
+  bool _noSuchMethodEnabledForCodegen = false;
 
   SourceInformationStrategy sourceInformationStrategy;
 
@@ -608,13 +559,14 @@
 
   final JSFrontendAccess frontend;
 
+  Tracer tracer;
+
   JavaScriptBackend(Compiler compiler,
       {bool generateSourceMap: true,
       bool useStartupEmitter: false,
       bool useNewSourceInfo: false,
       bool useKernel: false})
-      : namer = determineNamer(compiler),
-        oneShotInterceptors = new Map<jsAst.Name, Selector>(),
+      : oneShotInterceptors = new Map<jsAst.Name, Selector>(),
         interceptedElements = new Map<String, Set<Element>>(),
         rti = new _RuntimeTypes(compiler),
         rtiEncoder = new _RuntimeTypesEncoder(compiler),
@@ -629,8 +581,8 @@
         impacts = new BackendImpacts(compiler),
         frontend = new JSFrontendAccess(compiler),
         super(compiler) {
-    emitter = new CodeEmitterTask(
-        compiler, namer, generateSourceMap, useStartupEmitter);
+    emitter =
+        new CodeEmitterTask(compiler, generateSourceMap, useStartupEmitter);
     typeVariableHandler = new TypeVariableHandler(compiler);
     customElementsAnalysis = new CustomElementsAnalysis(this);
     lookupMapAnalysis = new LookupMapAnalysis(this, reporter);
@@ -652,9 +604,7 @@
 
   DiagnosticReporter get reporter => compiler.reporter;
 
-  CoreClasses get coreClasses => compiler.coreClasses;
-
-  CoreTypes get coreTypes => compiler.coreTypes;
+  CommonElements get commonElements => compiler.commonElements;
 
   Resolution get resolution => compiler.resolution;
 
@@ -693,12 +643,13 @@
         library == helpers.jsHelperLibrary;
   }
 
-  static Namer determineNamer(Compiler compiler) {
+  Namer determineNamer(
+      ClosedWorld closedWorld, CodegenWorldBuilder codegenWorldBuilder) {
     return compiler.options.enableMinification
         ? compiler.options.useFrequencyNamer
-            ? new FrequencyBasedNamer(compiler)
-            : new MinifyNamer(compiler)
-        : new Namer(compiler);
+            ? new FrequencyBasedNamer(this, closedWorld, codegenWorldBuilder)
+            : new MinifyNamer(this, closedWorld, codegenWorldBuilder)
+        : new Namer(this, closedWorld, codegenWorldBuilder);
   }
 
   /// The backend must *always* call this method when enqueuing an
@@ -727,7 +678,7 @@
         compiler.commonElements.isSymbolConstructor(element) ||
         helpers.isSymbolValidatedConstructor(element) ||
         element == helpers.syncCompleterConstructor ||
-        element == coreClasses.symbolClass ||
+        element == commonElements.symbolClass ||
         element == helpers.objectNoSuchMethod) {
       // TODO(johnniwinther): These are valid but we could be more precise.
       return true;
@@ -742,12 +693,16 @@
         element.library == helpers.isolateHelperLibrary) {
       // TODO(johnniwinther): We should be more precise about these.
       return true;
-    } else if (element == coreClasses.listClass ||
+    } else if (element == commonElements.listClass ||
         element == helpers.mapLiteralClass ||
-        element == coreClasses.functionClass ||
-        element == coreClasses.stringClass) {
+        element == commonElements.functionClass ||
+        element == commonElements.stringClass) {
       // TODO(johnniwinther): Avoid these.
       return true;
+    } else if (element == helpers.genericNoSuchMethod ||
+        element == helpers.unresolvedConstructorError ||
+        element == helpers.malformedTypeError) {
+      return true;
     }
     return false;
   }
@@ -802,7 +757,8 @@
   /**
    * Record that [method] is called from a subclass via `super`.
    */
-  bool maybeRegisterAliasedSuperMember(Element member, Selector selector) {
+  bool maybeRegisterAliasedSuperMember(
+      MemberElement member, Selector selector) {
     if (!canUseAliasedSuperMember(member, selector)) {
       // Invoking a super getter isn't supported, this would require changes to
       // compact field descriptors in the emitter.
@@ -830,15 +786,21 @@
   @override
   bool isJsInterop(Element element) => nativeData.isJsInterop(element);
 
+  /// Returns `true` if [element] is a JsInterop class.
+  bool isJsInteropClass(ClassElement element) => isJsInterop(element);
+
+  /// Returns `true` if [element] is a JsInterop method.
+  bool isJsInteropMethod(MethodElement element) => isJsInterop(element);
+
   /// Whether [element] corresponds to a native JavaScript construct either
   /// through the native mechanism (`@Native(...)` or the `native` pseudo
   /// keyword) which is only allowed for internal libraries or via the typed
   /// JavaScriptInterop mechanism which is allowed for user libraries.
   @override
-  bool isNative(Element element) => nativeData.isNative(element);
+  bool isNative(Entity element) => nativeData.isNative(element);
 
   /// Returns the [NativeBehavior] for calling the native [method].
-  native.NativeBehavior getNativeMethodBehavior(FunctionElement method) {
+  native.NativeBehavior getNativeMethodBehavior(MethodElement method) {
     return nativeData.getNativeMethodBehavior(method);
   }
 
@@ -896,7 +858,7 @@
     return isNativeOrExtendsNative(element.superclass);
   }
 
-  bool isInterceptedMethod(Element element) {
+  bool isInterceptedMethod(MemberElement element) {
     if (!element.isInstanceMember) return false;
     if (element.isGenerativeConstructorBody) {
       return isNativeOrExtendsNative(element.enclosingClass);
@@ -942,8 +904,7 @@
     if (elements.isEmpty) return false;
     return elements.any((element) {
       return selector.applies(element) &&
-          (mask == null ||
-              mask.canHit(element, selector, compiler.closedWorld));
+          (mask == null || mask.canHit(element, selector, _closedWorld));
     });
   }
 
@@ -999,11 +960,10 @@
   }
 
   Set<ClassElement> nativeSubclassesOfMixin(ClassElement mixin) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    Iterable<MixinApplicationElement> uses = closedWorld.mixinUsesOf(mixin);
+    Iterable<MixinApplicationElement> uses = _closedWorld.mixinUsesOf(mixin);
     Set<ClassElement> result = null;
     for (MixinApplicationElement use in uses) {
-      closedWorld.forEachStrictSubclassOf(use, (ClassElement subclass) {
+      _closedWorld.forEachStrictSubclassOf(use, (ClassElement subclass) {
         if (isNativeOrExtendsNative(subclass)) {
           if (result == null) result = new Set<ClassElement>();
           result.add(subclass);
@@ -1021,7 +981,8 @@
       ClassElement interceptorClass) {
     if (interceptorClass == null) return;
     interceptorClass.ensureResolved(resolution);
-    coreClasses.objectClass.forEachMember((_, Element member) {
+    ClassElement objectClass = commonElements.objectClass;
+    objectClass.forEachMember((_, Element member) {
       if (member.isGenerativeConstructor) return;
       Element interceptorMember = interceptorClass.lookupMember(member.name);
       // Interceptors must override all Object methods due to calling convention
@@ -1045,7 +1006,7 @@
         }
         if (member.isSynthesized) return;
         // All methods on [Object] are shadowed by [Interceptor].
-        if (classElement == coreClasses.objectClass) return;
+        if (classElement == commonElements.objectClass) return;
         Set<Element> set = interceptedElements.putIfAbsent(
             member.name, () => new Set<Element>());
         set.add(member);
@@ -1068,7 +1029,7 @@
         cls.ensureResolved(resolution);
         cls.forEachMember((ClassElement classElement, Element member) {
           // All methods on [Object] are shadowed by [Interceptor].
-          if (classElement == coreClasses.objectClass) return;
+          if (classElement == commonElements.objectClass) return;
           Set<Element> set = interceptedElements.putIfAbsent(
               member.name, () => new Set<Element>());
           set.add(member);
@@ -1118,7 +1079,7 @@
 
   void computeImpactForCompileTimeConstantInternal(ConstantValue constant,
       WorldImpactBuilder impactBuilder, bool isForResolution) {
-    DartType type = constant.getType(compiler.coreTypes);
+    ResolutionDartType type = constant.getType(compiler.commonElements);
     computeImpactForInstantiatedConstantType(type, impactBuilder);
 
     if (constant.isFunction) {
@@ -1128,8 +1089,8 @@
     } else if (constant.isInterceptor) {
       // An interceptor constant references the class's prototype chain.
       InterceptorConstantValue interceptor = constant;
-      computeImpactForInstantiatedConstantType(
-          interceptor.dispatchedType, impactBuilder);
+      ClassElement cls = interceptor.cls;
+      computeImpactForInstantiatedConstantType(cls.thisType, impactBuilder);
     } else if (constant.isType) {
       if (isForResolution) {
         impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
@@ -1145,12 +1106,9 @@
   }
 
   void computeImpactForInstantiatedConstantType(
-      DartType type, WorldImpactBuilder impactBuilder) {
-    DartType instantiatedType =
-        type.isFunctionType ? coreTypes.functionType : type;
-    if (type is InterfaceType) {
-      impactBuilder
-          .registerTypeUse(new TypeUse.instantiation(instantiatedType));
+      ResolutionDartType type, WorldImpactBuilder impactBuilder) {
+    if (type is ResolutionInterfaceType) {
+      impactBuilder.registerTypeUse(new TypeUse.instantiation(type));
       if (classNeedsRtiField(type.element)) {
         impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
             // TODO(johnniwinther): Find the right [CallStructure].
@@ -1187,19 +1145,19 @@
 
     // Register any helper that will be needed by the backend.
     if (forResolution) {
-      if (cls == coreClasses.intClass ||
-          cls == coreClasses.doubleClass ||
-          cls == coreClasses.numClass) {
+      if (cls == commonElements.intClass ||
+          cls == commonElements.doubleClass ||
+          cls == commonElements.numClass) {
         impactTransformer.registerBackendImpact(
             impactBuilder, impacts.numClasses);
-      } else if (cls == coreClasses.listClass ||
-          cls == coreClasses.stringClass) {
+      } else if (cls == commonElements.listClass ||
+          cls == commonElements.stringClass) {
         impactTransformer.registerBackendImpact(
             impactBuilder, impacts.listOrStringClasses);
-      } else if (cls == coreClasses.functionClass) {
+      } else if (cls == commonElements.functionClass) {
         impactTransformer.registerBackendImpact(
             impactBuilder, impacts.functionClass);
-      } else if (cls == coreClasses.mapClass) {
+      } else if (cls == commonElements.mapClass) {
         impactTransformer.registerBackendImpact(
             impactBuilder, impacts.mapClass);
         // For map literals, the dependency between the implementation class
@@ -1220,10 +1178,10 @@
       impactTransformer.registerBackendImpact(
           impactBuilder, impacts.closureClass);
     }
-    if (cls == coreClasses.stringClass || cls == helpers.jsStringClass) {
+    if (cls == commonElements.stringClass || cls == helpers.jsStringClass) {
       addInterceptors(helpers.jsStringClass, impactBuilder,
           forResolution: forResolution);
-    } else if (cls == coreClasses.listClass ||
+    } else if (cls == commonElements.listClass ||
         cls == helpers.jsArrayClass ||
         cls == helpers.jsFixedArrayClass ||
         cls == helpers.jsExtendableArrayClass ||
@@ -1242,7 +1200,7 @@
         impactTransformer.registerBackendImpact(
             impactBuilder, impacts.listClasses);
       }
-    } else if (cls == coreClasses.intClass || cls == helpers.jsIntClass) {
+    } else if (cls == commonElements.intClass || cls == helpers.jsIntClass) {
       addInterceptors(helpers.jsIntClass, impactBuilder,
           forResolution: forResolution);
       addInterceptors(helpers.jsPositiveIntClass, impactBuilder,
@@ -1253,18 +1211,19 @@
           forResolution: forResolution);
       addInterceptors(helpers.jsNumberClass, impactBuilder,
           forResolution: forResolution);
-    } else if (cls == coreClasses.doubleClass || cls == helpers.jsDoubleClass) {
+    } else if (cls == commonElements.doubleClass ||
+        cls == helpers.jsDoubleClass) {
       addInterceptors(helpers.jsDoubleClass, impactBuilder,
           forResolution: forResolution);
       addInterceptors(helpers.jsNumberClass, impactBuilder,
           forResolution: forResolution);
-    } else if (cls == coreClasses.boolClass || cls == helpers.jsBoolClass) {
+    } else if (cls == commonElements.boolClass || cls == helpers.jsBoolClass) {
       addInterceptors(helpers.jsBoolClass, impactBuilder,
           forResolution: forResolution);
-    } else if (cls == coreClasses.nullClass || cls == helpers.jsNullClass) {
+    } else if (cls == commonElements.nullClass || cls == helpers.jsNullClass) {
       addInterceptors(helpers.jsNullClass, impactBuilder,
           forResolution: forResolution);
-    } else if (cls == coreClasses.numClass || cls == helpers.jsNumberClass) {
+    } else if (cls == commonElements.numClass || cls == helpers.jsNumberClass) {
       addInterceptors(helpers.jsIntClass, impactBuilder,
           forResolution: forResolution);
       addInterceptors(helpers.jsPositiveIntClass, impactBuilder,
@@ -1305,7 +1264,7 @@
     return impactBuilder;
   }
 
-  void registerInstantiatedType(InterfaceType type) {
+  void registerInstantiatedType(ResolutionInterfaceType type) {
     lookupMapAnalysis.registerInstantiatedType(type);
   }
 
@@ -1333,10 +1292,14 @@
     return impactBuilder;
   }
 
-  onResolutionComplete() {
-    super.onResolutionComplete();
-    computeMembersNeededForReflection();
-    rti.computeClassesNeedingRti();
+  onResolutionComplete(
+      ClosedWorld closedWorld, ClosedWorldRefiner closedWorldRefiner) {
+    for (Entity entity in compiler.enqueuer.resolution.processedEntities) {
+      processAnnotations(entity, closedWorldRefiner);
+    }
+    computeMembersNeededForReflection(closedWorld);
+    rti.computeClassesNeedingRti(
+        compiler.enqueuer.resolution.worldBuilder, closedWorld);
     _registeredMetadata.clear();
   }
 
@@ -1345,6 +1308,11 @@
     noSuchMethodRegistry.onTypeInferenceComplete();
   }
 
+  /// Called to register that an instantiated generic class has a call method.
+  /// Any backend specific [WorldImpact] of this is returned.
+  ///
+  /// Note: The [callMethod] is registered even thought it doesn't reference
+  /// the type variables.
   WorldImpact registerCallMethodWithFreeTypeVariables(Element callMethod,
       {bool forResolution}) {
     if (forResolution || methodNeedsRti(callMethod)) {
@@ -1373,12 +1341,14 @@
     return impactTransformer.createImpactFor(impacts.computeSignature);
   }
 
+  /// Called to register that the `runtimeType` property has been accessed. Any
+  /// backend specific [WorldImpact] of this is returned.
   WorldImpact registerRuntimeType() {
     return impactTransformer.createImpactFor(impacts.runtimeTypeSupport);
   }
 
   void registerTypeVariableBoundsSubtypeCheck(
-      DartType typeArgument, DartType bound) {
+      ResolutionDartType typeArgument, ResolutionDartType bound) {
     rti.registerTypeVariableBoundsSubtypeCheck(typeArgument, bound);
   }
 
@@ -1386,7 +1356,8 @@
     return impactTransformer.createImpactFor(impacts.deferredLoading);
   }
 
-  void registerNoSuchMethod(FunctionElement noSuchMethod) {
+  /// Called to register a `noSuchMethod` implementation.
+  void registerNoSuchMethod(MethodElement noSuchMethod) {
     noSuchMethodRegistry.registerNoSuchMethod(noSuchMethod);
   }
 
@@ -1410,7 +1381,7 @@
         ConstantExpression constant = resolver.getConstant(argument);
         if (constant != null && constant.kind == ConstantExpressionKind.TYPE) {
           TypeConstantExpression typeConstant = constant;
-          if (typeConstant.type is InterfaceType) {
+          if (typeConstant.type is ResolutionInterfaceType) {
             resolver.registerInstantiatedType(typeConstant.type);
             // No native behavior for this call.
             return null;
@@ -1424,7 +1395,7 @@
     return null;
   }
 
-  WorldImpact enableNoSuchMethod() {
+  WorldImpact computeNoSuchMethodImpact() {
     return impactTransformer.createImpactFor(impacts.noSuchMethodSupport);
   }
 
@@ -1453,37 +1424,28 @@
   }
 
   bool classNeedsRti(ClassElement cls) {
-    if (compiler.resolverWorld.hasRuntimeTypeSupport) return true;
+    if (hasRuntimeTypeSupport) return true;
     return rti.classesNeedingRti.contains(cls.declaration);
   }
 
   bool classNeedsRtiField(ClassElement cls) {
     if (cls.rawType.typeArguments.isEmpty) return false;
-    if (compiler.resolverWorld.hasRuntimeTypeSupport) return true;
+    if (hasRuntimeTypeSupport) return true;
     return rti.classesNeedingRti.contains(cls.declaration);
   }
 
   bool isComplexNoSuchMethod(FunctionElement element) =>
       noSuchMethodRegistry.isComplex(element);
 
-  bool isDefaultEqualityImplementation(Element element) {
-    assert(element.name == '==');
-    ClassElement classElement = element.enclosingClass;
-    return classElement == coreClasses.objectClass ||
-        classElement == helpers.jsInterceptorClass ||
-        classElement == helpers.jsNullClass;
-  }
-
   bool methodNeedsRti(FunctionElement function) {
-    return rti.methodsNeedingRti.contains(function) ||
-        compiler.resolverWorld.hasRuntimeTypeSupport;
+    return rti.methodsNeedingRti.contains(function) || hasRuntimeTypeSupport;
   }
 
   CodegenEnqueuer get codegenEnqueuer => compiler.enqueuer.codegen;
 
   CodegenEnqueuer createCodegenEnqueuer(CompilerTask task, Compiler compiler) {
-    return new CodegenEnqueuer(
-        task, compiler, const TreeShakingEnqueuerStrategy());
+    return new CodegenEnqueuer(task, compiler.cacheStrategy, this,
+        compiler.options, const TreeShakingEnqueuerStrategy());
   }
 
   WorldImpact codegen(CodegenWorkItem work) {
@@ -1545,7 +1507,7 @@
       }
     }
 
-    jsAst.Fun function = functionCompiler.compile(work);
+    jsAst.Fun function = functionCompiler.compile(work, _closedWorld);
     if (function.sourceInformation == null) {
       function = function.withSourceInformation(
           sourceInformationStrategy.buildSourceMappedMarker());
@@ -1572,7 +1534,7 @@
     // Native classes inherit from Interceptor.
     return isNative(element)
         ? helpers.jsInterceptorClass
-        : coreClasses.objectClass;
+        : commonElements.objectClass;
   }
 
   /**
@@ -1585,8 +1547,8 @@
     return jsAst.prettyPrint(generatedCode[element], compiler);
   }
 
-  int assembleProgram() {
-    int programSize = emitter.assembleProgram();
+  int assembleProgram(ClosedWorld closedWorld) {
+    int programSize = emitter.assembleProgram(namer, closedWorld);
     noSuchMethodRegistry.emitDiagnostic();
     int totalMethodCount = generatedCode.length;
     if (totalMethodCount != preMirrorsMethodCount) {
@@ -1635,7 +1597,8 @@
    * the resolver with interface types (int, String, ...), and by the SSA
    * backend with implementation types (JSInt, JSString, ...).
    */
-  CheckedModeHelper getCheckedModeHelper(DartType type, {bool typeCast}) {
+  CheckedModeHelper getCheckedModeHelper(ResolutionDartType type,
+      {bool typeCast}) {
     return getCheckedModeHelperInternal(type,
         typeCast: typeCast, nativeCheckOnly: false);
   }
@@ -1645,7 +1608,8 @@
    * check/type cast on [type] at runtime. If no native helper exists for
    * [type], [:null:] is returned.
    */
-  CheckedModeHelper getNativeCheckedModeHelper(DartType type, {bool typeCast}) {
+  CheckedModeHelper getNativeCheckedModeHelper(ResolutionDartType type,
+      {bool typeCast}) {
     return getCheckedModeHelperInternal(type,
         typeCast: typeCast, nativeCheckOnly: true);
   }
@@ -1654,7 +1618,7 @@
    * Returns the checked mode helper for the type check/type cast for [type]. If
    * [nativeCheckOnly] is [:true:], only names for native helpers are returned.
    */
-  CheckedModeHelper getCheckedModeHelperInternal(DartType type,
+  CheckedModeHelper getCheckedModeHelperInternal(ResolutionDartType type,
       {bool typeCast, bool nativeCheckOnly}) {
     String name = getCheckedModeHelperNameInternal(type,
         typeCast: typeCast, nativeCheckOnly: nativeCheckOnly);
@@ -1664,15 +1628,32 @@
     return helper;
   }
 
-  String getCheckedModeHelperNameInternal(DartType type,
+  String getCheckedModeHelperNameInternal(ResolutionDartType type,
       {bool typeCast, bool nativeCheckOnly}) {
-    assert(type.kind != TypeKind.TYPEDEF);
+    assert(type.kind != ResolutionTypeKind.TYPEDEF);
     if (type.isMalformed) {
       // The same error is thrown for type test and type cast of a malformed
       // type so we only need one check method.
       return 'checkMalformedType';
     }
-    Element element = type.element;
+
+    if (type.isVoid) {
+      assert(!typeCast); // Cannot cast to void.
+      if (nativeCheckOnly) return null;
+      return 'voidTypeCheck';
+    }
+
+    if (type.isTypeVariable) {
+      return typeCast
+          ? 'subtypeOfRuntimeTypeCast'
+          : 'assertSubtypeOfRuntimeType';
+    }
+
+    if (type.isFunctionType) return null;
+
+    assert(invariant(NO_LOCATION_SPANNABLE, type.isInterfaceType,
+        message: "Unexpected type: $type (${type.kind})"));
+    ClassElement element = type.element;
     bool nativeCheck =
         nativeCheckOnly || emitter.nativeEmitter.requiresNativeIsCheck(element);
 
@@ -1681,84 +1662,70 @@
     // that it can be optimized by standard interceptor optimizations.
     nativeCheck = true;
 
-    if (type.isVoid) {
-      assert(!typeCast); // Cannot cast to void.
+    var suffix = typeCast ? 'TypeCast' : 'TypeCheck';
+    if (element == helpers.jsStringClass ||
+        element == commonElements.stringClass) {
       if (nativeCheckOnly) return null;
-      return 'voidTypeCheck';
-    } else if (element == helpers.jsStringClass ||
-        element == coreClasses.stringClass) {
+      return 'string$suffix';
+    }
+
+    if (element == helpers.jsDoubleClass ||
+        element == commonElements.doubleClass) {
       if (nativeCheckOnly) return null;
-      return typeCast ? 'stringTypeCast' : 'stringTypeCheck';
-    } else if (element == helpers.jsDoubleClass ||
-        element == coreClasses.doubleClass) {
+      return 'double$suffix';
+    }
+
+    if (element == helpers.jsNumberClass ||
+        element == commonElements.numClass) {
       if (nativeCheckOnly) return null;
-      return typeCast ? 'doubleTypeCast' : 'doubleTypeCheck';
-    } else if (element == helpers.jsNumberClass ||
-        element == coreClasses.numClass) {
+      return 'num$suffix';
+    }
+
+    if (element == helpers.jsBoolClass || element == commonElements.boolClass) {
       if (nativeCheckOnly) return null;
-      return typeCast ? 'numTypeCast' : 'numTypeCheck';
-    } else if (element == helpers.jsBoolClass ||
-        element == coreClasses.boolClass) {
-      if (nativeCheckOnly) return null;
-      return typeCast ? 'boolTypeCast' : 'boolTypeCheck';
-    } else if (element == helpers.jsIntClass ||
-        element == coreClasses.intClass ||
+      return 'bool$suffix';
+    }
+
+    if (element == helpers.jsIntClass ||
+        element == commonElements.intClass ||
         element == helpers.jsUInt32Class ||
         element == helpers.jsUInt31Class ||
         element == helpers.jsPositiveIntClass) {
       if (nativeCheckOnly) return null;
-      return typeCast ? 'intTypeCast' : 'intTypeCheck';
-    } else if (Elements.isNumberOrStringSupertype(element, compiler)) {
-      if (nativeCheck) {
-        return typeCast
-            ? 'numberOrStringSuperNativeTypeCast'
-            : 'numberOrStringSuperNativeTypeCheck';
-      } else {
-        return typeCast
-            ? 'numberOrStringSuperTypeCast'
-            : 'numberOrStringSuperTypeCheck';
-      }
-    } else if (Elements.isStringOnlySupertype(element, compiler)) {
-      if (nativeCheck) {
-        return typeCast
-            ? 'stringSuperNativeTypeCast'
-            : 'stringSuperNativeTypeCheck';
-      } else {
-        return typeCast ? 'stringSuperTypeCast' : 'stringSuperTypeCheck';
-      }
-    } else if ((element == coreClasses.listClass ||
+      return 'int$suffix';
+    }
+
+    if (commonElements.isNumberOrStringSupertype(element)) {
+      return nativeCheck
+          ? 'numberOrStringSuperNative$suffix'
+          : 'numberOrStringSuper$suffix';
+    }
+
+    if (commonElements.isStringOnlySupertype(element)) {
+      return nativeCheck ? 'stringSuperNative$suffix' : 'stringSuper$suffix';
+    }
+
+    if ((element == commonElements.listClass ||
             element == helpers.jsArrayClass) &&
         type.treatAsRaw) {
       if (nativeCheckOnly) return null;
-      return typeCast ? 'listTypeCast' : 'listTypeCheck';
+      return 'list$suffix';
+    }
+
+    if (commonElements.isListSupertype(element)) {
+      return nativeCheck ? 'listSuperNative$suffix' : 'listSuper$suffix';
+    }
+
+    if (type.isInterfaceType && !type.treatAsRaw) {
+      return typeCast ? 'subtypeCast' : 'assertSubtype';
+    }
+
+    if (nativeCheck) {
+      // TODO(karlklose): can we get rid of this branch when we use
+      // interceptors?
+      return 'intercepted$suffix';
     } else {
-      if (Elements.isListSupertype(element, compiler)) {
-        if (nativeCheck) {
-          return typeCast
-              ? 'listSuperNativeTypeCast'
-              : 'listSuperNativeTypeCheck';
-        } else {
-          return typeCast ? 'listSuperTypeCast' : 'listSuperTypeCheck';
-        }
-      } else {
-        if (type.isInterfaceType && !type.treatAsRaw) {
-          return typeCast ? 'subtypeCast' : 'assertSubtype';
-        } else if (type.isTypeVariable) {
-          return typeCast
-              ? 'subtypeOfRuntimeTypeCast'
-              : 'assertSubtypeOfRuntimeType';
-        } else if (type.isFunctionType) {
-          return null;
-        } else {
-          if (nativeCheck) {
-            // TODO(karlklose): can we get rid of this branch when we use
-            // interceptors?
-            return typeCast ? 'interceptedTypeCast' : 'interceptedTypeCheck';
-          } else {
-            return typeCast ? 'propertyTypeCast' : 'propertyTypeCheck';
-          }
-        }
-      }
+      return 'property$suffix';
     }
   }
 
@@ -1777,13 +1744,13 @@
    * Returns [:true:] if the checking of [type] is performed directly on the
    * object and not on an interceptor.
    */
-  bool hasDirectCheckFor(DartType type) {
+  bool hasDirectCheckFor(ResolutionDartType type) {
     Element element = type.element;
-    return element == coreClasses.stringClass ||
-        element == coreClasses.boolClass ||
-        element == coreClasses.numClass ||
-        element == coreClasses.intClass ||
-        element == coreClasses.doubleClass ||
+    return element == commonElements.stringClass ||
+        element == commonElements.boolClass ||
+        element == commonElements.numClass ||
+        element == commonElements.intClass ||
+        element == commonElements.doubleClass ||
         element == helpers.jsArrayClass ||
         element == helpers.jsMutableArrayClass ||
         element == helpers.jsExtendableArrayClass ||
@@ -1791,17 +1758,17 @@
         element == helpers.jsUnmodifiableArrayClass;
   }
 
-  bool mayGenerateInstanceofCheck(DartType type) {
+  bool mayGenerateInstanceofCheck(ResolutionDartType type) {
     // We can use an instanceof check for raw types that have no subclass that
     // is mixed-in or in an implements clause.
 
     if (!type.isRaw) return false;
     ClassElement classElement = type.element;
     if (isInterceptorClass(classElement)) return false;
-    return compiler.closedWorld.hasOnlySubclasses(classElement);
+    return _closedWorld.hasOnlySubclasses(classElement);
   }
 
-  WorldImpact registerStaticUse(Element element, {bool forResolution}) {
+  WorldImpact registerUsedElement(MemberElement element, {bool forResolution}) {
     WorldImpactBuilderImpl worldImpact = new WorldImpactBuilderImpl();
     if (element == helpers.disableTreeShakingMarker) {
       isTreeShakingDisabled = true;
@@ -1826,9 +1793,60 @@
       }
     } else if (element == helpers.requiresPreambleMarker) {
       requiresPreamble = true;
+    } else if (element == helpers.invokeOnMethod && forResolution) {
+      hasInvokeOnSupport = true;
     }
     customElementsAnalysis.registerStaticUse(element,
         forResolution: forResolution);
+
+    if (element.isFunction && element.isInstanceMember) {
+      MemberElement function = element;
+      ClassElement cls = function.enclosingClass;
+      if (function.name == Identifiers.call && !cls.typeVariables.isEmpty) {
+        worldImpact.addImpact(registerCallMethodWithFreeTypeVariables(function,
+            forResolution: forResolution));
+      }
+    }
+    if (forResolution) {
+      // Enable isolate support if we start using something from the isolate
+      // library, or timers for the async library.  We exclude constant fields,
+      // which are ending here because their initializing expression is
+      // compiled.
+      LibraryElement library = element.library;
+      if (!hasIsolateSupport && !(element.isField && element.isConst)) {
+        Uri uri = library.canonicalUri;
+        if (uri == Uris.dart_isolate) {
+          hasIsolateSupport = true;
+          worldImpact
+              .addImpact(enableIsolateSupport(forResolution: forResolution));
+        } else if (uri == Uris.dart_async) {
+          if (element.name == '_createTimer' ||
+              element.name == '_createPeriodicTimer') {
+            // The [:Timer:] class uses the event queue of the isolate
+            // library, so we make sure that event queue is generated.
+            hasIsolateSupport = true;
+            worldImpact
+                .addImpact(enableIsolateSupport(forResolution: forResolution));
+          }
+        }
+      }
+
+      if (element.isGetter && element.name == Identifiers.runtimeType_) {
+        // Enable runtime type support if we discover a getter called
+        // runtimeType. We have to enable runtime type before hitting the
+        // codegen, so that constructors know whether they need to generate code
+        // for runtime type.
+        hasRuntimeTypeSupport = true;
+        // TODO(ahe): Record precise dependency here.
+        worldImpact.addImpact(registerRuntimeType());
+      } else if (compiler.commonElements.isFunctionApplyMethod(element)) {
+        hasFunctionApplySupport = true;
+      }
+    } else {
+      // TODO(sigmund): add other missing dependencies (internals, selectors
+      // enqueued after allocations).
+      compiler.dumpInfoTask.registerDependency(element);
+    }
     return worldImpact;
   }
 
@@ -1911,20 +1929,20 @@
     helpers.onLibrariesLoaded(loadedLibraries);
 
     implementationClasses = <ClassElement, ClassElement>{};
-    implementationClasses[coreClasses.intClass] = helpers.jsIntClass;
-    implementationClasses[coreClasses.boolClass] = helpers.jsBoolClass;
-    implementationClasses[coreClasses.numClass] = helpers.jsNumberClass;
-    implementationClasses[coreClasses.doubleClass] = helpers.jsDoubleClass;
-    implementationClasses[coreClasses.stringClass] = helpers.jsStringClass;
-    implementationClasses[coreClasses.listClass] = helpers.jsArrayClass;
-    implementationClasses[coreClasses.nullClass] = helpers.jsNullClass;
+    implementationClasses[commonElements.intClass] = helpers.jsIntClass;
+    implementationClasses[commonElements.boolClass] = helpers.jsBoolClass;
+    implementationClasses[commonElements.numClass] = helpers.jsNumberClass;
+    implementationClasses[commonElements.doubleClass] = helpers.jsDoubleClass;
+    implementationClasses[commonElements.stringClass] = helpers.jsStringClass;
+    implementationClasses[commonElements.listClass] = helpers.jsArrayClass;
+    implementationClasses[commonElements.nullClass] = helpers.jsNullClass;
 
     // These methods are overwritten with generated versions.
     inlineCache.markAsNonInlinable(helpers.getInterceptorMethod,
         insideLoop: true);
 
     specialOperatorEqClasses
-      ..add(coreClasses.objectClass)
+      ..add(commonElements.objectClass)
       ..add(helpers.jsInterceptorClass)
       ..add(helpers.jsNullClass);
 
@@ -1974,10 +1992,14 @@
     return membersNeededForReflection.contains(element);
   }
 
+  bool isMemberAccessibleByReflection(MemberElement element) {
+    return membersNeededForReflection.contains(element);
+  }
+
   /**
    * Returns true if the element has to be resolved due to a mirrorsUsed
    * annotation. If we have insufficient mirrors used annotations, we only
-   * keep additonal elements if treeshaking has been disabled.
+   * keep additional elements if treeshaking has been disabled.
    */
   bool requiredByMirrorSystem(Element element) {
     return hasInsufficientMirrorsUsed && isTreeShakingDisabled ||
@@ -2013,7 +2035,7 @@
       ConstantValue value =
           compiler.constants.getConstantValue(metadata.constant);
       if (value == null) continue;
-      DartType type = value.getType(compiler.coreTypes);
+      ResolutionDartType type = value.getType(compiler.commonElements);
       if (metaTargetsUsed.contains(type.element)) return true;
     }
     return false;
@@ -2031,9 +2053,9 @@
    * be visible by reflection unless some other interfaces makes them
    * accessible.
    */
-  computeMembersNeededForReflection() {
+  void computeMembersNeededForReflection(ClosedWorld closedWorld) {
     if (_membersNeededForReflection != null) return;
-    if (compiler.commonElements.mirrorsLibrary == null) {
+    if (closedWorld.commonElements.mirrorsLibrary == null) {
       _membersNeededForReflection = const ImmutableEmptySet<Element>();
       return;
     }
@@ -2041,13 +2063,15 @@
     // can include the correct ones when including the class.
     Map<ClassElement, List<LocalFunctionElement>> closureMap =
         new Map<ClassElement, List<LocalFunctionElement>>();
-    for (LocalFunctionElement closure in compiler.resolverWorld.allClosures) {
+    for (LocalFunctionElement closure
+        in compiler.resolutionWorldBuilder.allClosures) {
       closureMap.putIfAbsent(closure.enclosingClass, () => []).add(closure);
     }
     bool foundClosure = false;
     Set<Element> reflectableMembers = new Set<Element>();
     ResolutionEnqueuer resolution = compiler.enqueuer.resolution;
-    for (ClassElement cls in resolution.universe.directlyInstantiatedClasses) {
+    for (ClassElement cls
+        in resolution.worldBuilder.directlyInstantiatedClasses) {
       // Do not process internal classes.
       if (cls.library.isInternalLibrary || cls.isInjected) continue;
       if (referencedFromMirrorSystem(cls)) {
@@ -2075,9 +2099,8 @@
           }
         });
         // 4) all overriding members of subclasses/subtypes (should be resolved)
-        if (compiler.closedWorld.hasAnyStrictSubtype(cls)) {
-          compiler.closedWorld.forEachStrictSubtypeOf(cls,
-              (ClassElement subcls) {
+        if (closedWorld.hasAnyStrictSubtype(cls)) {
+          closedWorld.forEachStrictSubtypeOf(cls, (ClassElement subcls) {
             subcls.forEachClassMember((Member member) {
               if (memberNames.contains(member.name)) {
                 // TODO(20993): find out why this assertion fails.
@@ -2129,7 +2152,7 @@
     for (LibraryElement lib in compiler.libraryLoader.libraries) {
       if (lib.isInternalLibrary) continue;
       lib.forEachLocalMember((Element member) {
-        if (!member.isClass &&
+        if (!(member.isClass || member.isTypedef) &&
             resolution.hasBeenProcessed(member) &&
             referencedFromMirrorSystem(member)) {
           reflectableMembers.add(member);
@@ -2151,13 +2174,14 @@
     if (foundClosure) {
       reflectableMembers.add(helpers.closureClass);
     }
-    Set<Element> closurizedMembers = compiler.resolverWorld.closurizedMembers;
+    Set<Element> closurizedMembers =
+        compiler.resolutionWorldBuilder.closurizedMembers;
     if (closurizedMembers.any(reflectableMembers.contains)) {
       reflectableMembers.add(helpers.boundClosureClass);
     }
     // Add typedefs.
-    reflectableMembers.addAll(
-        compiler.closedWorld.allTypedefs.where(referencedFromMirrorSystem));
+    reflectableMembers
+        .addAll(closedWorld.allTypedefs.where(referencedFromMirrorSystem));
     // Register all symbols of reflectable elements
     for (Element element in reflectableMembers) {
       symbolsUsed.add(element.name);
@@ -2189,39 +2213,11 @@
         new jsAst.PropertyAccess(use2, dispatchProperty);
 
     List<jsAst.Expression> arguments = <jsAst.Expression>[use1, record];
-    FunctionElement helper = helpers.isJsIndexable;
+    MethodElement helper = helpers.isJsIndexable;
     jsAst.Expression helperExpression = emitter.staticFunctionAccess(helper);
     return new jsAst.Call(helperExpression, arguments);
   }
 
-  bool isTypedArray(TypeMask mask) {
-    // Just checking for [:TypedData:] is not sufficient, as it is an
-    // abstract class any user-defined class can implement. So we also
-    // check for the interface [JavaScriptIndexingBehavior].
-    ClassElement typedDataClass = compiler.commonElements.typedDataClass;
-    return typedDataClass != null &&
-        compiler.closedWorld.isInstantiated(typedDataClass) &&
-        mask.satisfies(typedDataClass, compiler.closedWorld) &&
-        mask.satisfies(
-            helpers.jsIndexingBehaviorInterface, compiler.closedWorld);
-  }
-
-  bool couldBeTypedArray(TypeMask mask) {
-    bool intersects(TypeMask type1, TypeMask type2) =>
-        !type1.intersection(type2, compiler.closedWorld).isEmpty;
-    // TODO(herhut): Maybe cache the TypeMask for typedDataClass and
-    //               jsIndexingBehaviourInterface.
-    ClassElement typedDataClass = compiler.commonElements.typedDataClass;
-    return typedDataClass != null &&
-        compiler.closedWorld.isInstantiated(typedDataClass) &&
-        intersects(
-            mask, new TypeMask.subtype(typedDataClass, compiler.closedWorld)) &&
-        intersects(
-            mask,
-            new TypeMask.subtype(
-                helpers.jsIndexingBehaviorInterface, compiler.closedWorld));
-  }
-
   /// Returns all static fields that are referenced through [targetsUsed].
   /// If the target is a library or class all nested static fields are
   /// included too.
@@ -2250,7 +2246,7 @@
   }
 
   /// Called when [enqueuer] is empty, but before it is closed.
-  bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassElement> recentClasses) {
+  bool onQueueEmpty(Enqueuer enqueuer, Iterable<ClassEntity> recentClasses) {
     // Add elements used synthetically, that is, through features rather than
     // syntax, for instance custom elements.
     //
@@ -2263,27 +2259,44 @@
     enqueuer.applyImpact(
         typeVariableHandler.flush(forResolution: enqueuer.isResolutionQueue));
 
-    if (!enqueuer.queueIsEmpty) return false;
-
-    noSuchMethodRegistry.onQueueEmpty();
-    if (!enabledNoSuchMethod &&
-        (noSuchMethodRegistry.hasThrowingNoSuchMethod ||
-            noSuchMethodRegistry.hasComplexNoSuchMethod)) {
-      enqueuer.applyImpact(enableNoSuchMethod());
-      enabledNoSuchMethod = true;
+    if (enqueuer.isResolutionQueue) {
+      for (ClassElement cls in recentClasses) {
+        Element element = cls.lookupLocalMember(Identifiers.noSuchMethod_);
+        if (element != null && element.isInstanceMember && element.isFunction) {
+          registerNoSuchMethod(element);
+        }
+      }
     }
+    noSuchMethodRegistry.onQueueEmpty();
+    if (enqueuer.isResolutionQueue) {
+      if (!enabledNoSuchMethod &&
+          (noSuchMethodRegistry.hasThrowingNoSuchMethod ||
+              noSuchMethodRegistry.hasComplexNoSuchMethod)) {
+        enqueuer.applyImpact(computeNoSuchMethodImpact());
+        enabledNoSuchMethod = true;
+      }
+    } else {
+      if (enabledNoSuchMethod && !_noSuchMethodEnabledForCodegen) {
+        enqueuer.applyImpact(computeNoSuchMethodImpact());
+        _noSuchMethodEnabledForCodegen = true;
+      }
+    }
+
+    if (!enqueuer.queueIsEmpty) return false;
 
     if (compiler.options.useKernel && compiler.mainApp != null) {
       kernelTask.buildKernelIr();
     }
 
-    if (compiler.options.hasIncrementalSupport) {
+    if (compiler.options.hasIncrementalSupport &&
+        !hasIncrementalTearOffSupport) {
       // Always enable tear-off closures during incremental compilation.
       Element element = helpers.closureFromTearOff;
-      if (element != null && !enqueuer.isProcessed(element)) {
+      if (element != null) {
         enqueuer.applyImpact(
             impactTransformer.createImpactFor(impacts.closureClass));
       }
+      hasIncrementalTearOffSupport = true;
     }
 
     if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) {
@@ -2314,7 +2327,7 @@
 
       StagedWorldImpactBuilder impactBuilder = enqueuer.isResolutionQueue
           ? constantImpactsForResolution
-          : constantImpactsForResolution;
+          : constantImpactsForCodegen;
       if (enqueuer.isResolutionQueue && !enqueuer.queueIsClosed) {
         /// Register the constant value of [metadata] as live in resolution.
         void registerMetadataConstant(MetadataAnnotation metadata) {
@@ -2329,7 +2342,7 @@
 
         // TODO(johnniwinther): We should have access to all recently processed
         // elements and process these instead.
-        processMetadata(compiler.enqueuer.resolution.processedElements,
+        processMetadata(compiler.enqueuer.resolution.processedEntities,
             registerMetadataConstant);
       } else {
         for (Dependency dependency in metadataConstants) {
@@ -2343,9 +2356,9 @@
     return true;
   }
 
-  /// Call [registerMetadataConstant] on all metadata from [elements].
-  void processMetadata(Iterable<Element> elements,
-      void onMetadata(MetadataAnnotation metadata)) {
+  /// Call [registerMetadataConstant] on all metadata from [entities].
+  void processMetadata(
+      Iterable<Entity> entities, void onMetadata(MetadataAnnotation metadata)) {
     void processLibraryMetadata(LibraryElement library) {
       if (_registeredMetadata.add(library)) {
         library.metadata.forEach(onMetadata);
@@ -2366,14 +2379,22 @@
           }
         }
         if (element.enclosingClass != null) {
-          processElementMetadata(element.enclosingClass);
+          // Only process library of top level fields/methods
+          // (and not for classes).
+          // TODO(johnniwinther): Fix this: We are missing some metadata on
+          // libraries (example: in co19/Language/Metadata/before_export_t01).
+          if (element.enclosingElement is ClassElement) {
+            // Use [enclosingElement] instead of [enclosingClass] to ensure that
+            // we process patch class metadata for patch and injected members.
+            processElementMetadata(element.enclosingElement);
+          }
         } else {
           processLibraryMetadata(element.library);
         }
       }
     }
 
-    elements.forEach(processElementMetadata);
+    entities.forEach(processElementMetadata);
   }
 
   void onQueueClosed() {
@@ -2381,14 +2402,41 @@
     jsInteropAnalysis.onQueueClosed();
   }
 
-  void onCodegenStart() {
-    lookupMapAnalysis.onCodegenStart();
+  // TODO(johnniwinther): Create a CodegenPhase object for the backend to hold
+  // data only available during code generation.
+  ClosedWorld _closedWorldCache;
+  ClosedWorld get _closedWorld {
+    assert(invariant(NO_LOCATION_SPANNABLE, _closedWorldCache != null,
+        message: "ClosedWorld has not be set yet."));
+    return _closedWorldCache;
   }
 
-  @override
-  void onElementResolved(Element element) {
+  void set _closedWorld(ClosedWorld value) {
+    _closedWorldCache = value;
+  }
+
+  WorldImpact onCodegenStart(ClosedWorld closedWorld) {
+    _closedWorld = closedWorld;
+    _namer = determineNamer(_closedWorld, compiler.codegenWorldBuilder);
+    tracer = new Tracer(_closedWorld, namer, compiler.outputProvider);
+    emitter.createEmitter(_namer, _closedWorld);
+    lookupMapAnalysis.onCodegenStart();
+    if (hasIsolateSupport) {
+      return enableIsolateSupport(forResolution: false);
+    }
+    return const WorldImpact();
+  }
+
+  void onCodegenEnd() {
+    sourceInformationStrategy.onComplete();
+    tracer.close();
+  }
+
+  /// Process backend specific annotations.
+  void processAnnotations(
+      Element element, ClosedWorldRefiner closedWorldRefiner) {
     if (element.isMalformed) {
-      // Elements that are marker as malformed during parsing or resolution
+      // Elements that are marked as malformed during parsing or resolution
       // might be registered here. These should just be ignored.
       return;
     }
@@ -2440,14 +2488,14 @@
           reporter.reportHintMessage(
               element, MessageKind.GENERIC, {'text': "Cannot throw"});
         }
-        compiler.inferenceWorld.registerCannotThrow(element);
+        closedWorldRefiner.registerCannotThrow(element);
       } else if (cls == helpers.noSideEffectsClass) {
         hasNoSideEffects = true;
         if (VERBOSE_OPTIMIZER_HINTS) {
           reporter.reportHintMessage(
               element, MessageKind.GENERIC, {'text': "Has no side effects"});
         }
-        compiler.inferenceWorld.registerSideEffectsFree(element);
+        closedWorldRefiner.registerSideEffectsFree(element);
       }
     }
     if (hasForceInline && hasNoInline) {
@@ -2462,18 +2510,8 @@
       reporter.internalError(element,
           "@NoSideEffects() should always be combined with @NoInline.");
     }
-    if (element == helpers.invokeOnMethod) {
-      hasInvokeOnSupport = true;
-    }
   }
 
-/*
-  CodeBuffer codeOf(Element element) {
-    return generatedCode.containsKey(element)
-        ? jsAst.prettyPrint(generatedCode[element], compiler)
-        : null;
-  }
-*/
   FunctionElement helperForBadMain() => helpers.badMain;
 
   FunctionElement helperForMissingMain() => helpers.missingMain;
@@ -2484,6 +2522,12 @@
     constants.forgetElement(element);
     constantCompilerTask.dartConstantCompiler.forgetElement(element);
     aliasedSuperMembers.remove(element);
+    generatedCode.remove(element);
+    if (element is MemberElement) {
+      for (Element closure in element.nestedClosures) {
+        generatedCode.remove(closure);
+      }
+    }
   }
 
   @override
@@ -2744,7 +2788,7 @@
         case Feature.FIELD_WITHOUT_INITIALIZER:
         case Feature.LOCAL_WITHOUT_INITIALIZER:
           transformed.registerTypeUse(
-              new TypeUse.instantiation(backend.coreTypes.nullType));
+              new TypeUse.instantiation(backend.commonElements.nullType));
           registerBackendImpact(transformed, impacts.nullLiteral);
           break;
         case Feature.LAZY_FIELD:
@@ -2789,7 +2833,7 @@
     bool hasAsCast = false;
     bool hasTypeLiteral = false;
     for (TypeUse typeUse in worldImpact.typeUses) {
-      DartType type = typeUse.type;
+      ResolutionDartType type = typeUse.type;
       switch (typeUse.kind) {
         case TypeUseKind.INSTANTIATION:
         case TypeUseKind.MIRROR_INSTANTIATION:
@@ -2813,9 +2857,6 @@
           break;
         case TypeUseKind.TYPE_LITERAL:
           backend.customElementsAnalysis.registerTypeLiteral(type);
-          if (type.isTypedef) {
-            backend.compiler.openWorld.registerTypedef(type.element);
-          }
           if (type.isTypeVariable && type is! MethodTypeVariableType) {
             // GENERIC_METHODS: The `is!` test above filters away method type
             // variables, because they have the value `dynamic` with the
@@ -2837,7 +2878,7 @@
 
     if (hasTypeLiteral) {
       transformed.registerTypeUse(
-          new TypeUse.instantiation(backend.compiler.coreTypes.typeType));
+          new TypeUse.instantiation(backend.compiler.commonElements.typeType));
       registerBackendImpact(transformed, impacts.typeLiteral);
     }
 
@@ -2959,7 +3000,8 @@
       assert(selector != null);
       worldImpact.registerDynamicUse(new DynamicUse(selector, null));
     }
-    for (InterfaceType instantiatedType in backendImpact.instantiatedTypes) {
+    for (ResolutionInterfaceType instantiatedType
+        in backendImpact.instantiatedTypes) {
       backend.registerBackendUse(instantiatedType.element);
       worldImpact.registerTypeUse(new TypeUse.instantiation(instantiatedType));
     }
@@ -2985,7 +3027,7 @@
   }
 
   /// Register [type] as required for the runtime type information system.
-  void registerRequiredType(DartType type) {
+  void registerRequiredType(ResolutionDartType type) {
     // If [argument] has type variables or is a type variable, this method
     // registers a RTI dependency between the class where the type variable is
     // defined (that is the enclosing class of the current element being
@@ -2998,7 +3040,7 @@
   }
 
   // TODO(johnniwinther): Maybe split this into [onAssertType] and [onTestType].
-  void onIsCheck(DartType type, TransformedWorldImpact transformed) {
+  void onIsCheck(ResolutionDartType type, TransformedWorldImpact transformed) {
     registerRequiredType(type);
     type.computeUnaliased(backend.resolution);
     type = type.unaliased;
@@ -3024,7 +3066,7 @@
         }
       }
     }
-    if (type is FunctionType) {
+    if (type is ResolutionFunctionType) {
       registerBackendImpact(transformed, impacts.functionTypeCheck);
     }
     if (type.element != null && backend.isNative(type.element)) {
@@ -3032,7 +3074,9 @@
     }
   }
 
-  void onIsCheckForCodegen(DartType type, TransformedWorldImpact transformed) {
+  void onIsCheckForCodegen(
+      ResolutionDartType type, TransformedWorldImpact transformed) {
+    if (type.isDynamic) return;
     type = type.unaliased;
     registerBackendImpact(transformed, impacts.typeCheck);
 
@@ -3075,7 +3119,7 @@
     TransformedWorldImpact transformed = new TransformedWorldImpact(impact);
 
     for (TypeUse typeUse in impact.typeUses) {
-      DartType type = typeUse.type;
+      ResolutionDartType type = typeUse.type;
       switch (typeUse.kind) {
         case TypeUseKind.INSTANTIATION:
           backend.lookupMapAnalysis.registerInstantiatedType(type);
@@ -3092,7 +3136,7 @@
       backend.addCompileTimeConstantForEmission(constant);
     }
 
-    for (Pair<DartType, DartType> check
+    for (Pair<ResolutionDartType, ResolutionDartType> check
         in impact.typeVariableBoundsSubtypeChecks) {
       backend.registerTypeVariableBoundsSubtypeCheck(check.a, check.b);
     }
@@ -3174,7 +3218,7 @@
       this.supportSerialization});
 
   @override
-  void visitImpact(Element element, WorldImpact impact,
+  void visitImpact(var impactSource, WorldImpact impact,
       WorldImpactVisitor visitor, ImpactUseCase impactUse) {
     // TODO(johnniwinther): Compute the application strategy once for each use.
     if (impactUse == ResolutionEnqueuer.IMPACT_USE) {
@@ -3182,8 +3226,8 @@
         impact.apply(visitor);
       } else {
         impact.apply(visitor);
-        if (element != null) {
-          resolution.uncacheWorldImpact(element);
+        if (impactSource is Element) {
+          resolution.uncacheWorldImpact(impactSource);
         }
       }
     } else if (impactUse == DeferredLoadTask.IMPACT_USE) {
@@ -3191,7 +3235,7 @@
       // Impacts are uncached globally in [onImpactUsed].
     } else if (impactUse == DumpInfoTask.IMPACT_USE) {
       impact.apply(visitor);
-      dumpInfoTask.unregisterImpact(element);
+      dumpInfoTask.unregisterImpact(impactSource);
     } else {
       impact.apply(visitor);
     }
@@ -3220,6 +3264,7 @@
   ClassElement get numImplementation => helpers.jsNumberClass;
   ClassElement get stringImplementation => helpers.jsStringClass;
   ClassElement get listImplementation => helpers.jsArrayClass;
+  ClassElement get mutableListImplementation => helpers.jsMutableArrayClass;
   ClassElement get constListImplementation => helpers.jsUnmodifiableArrayClass;
   ClassElement get fixedListImplementation => helpers.jsFixedArrayClass;
   ClassElement get growableListImplementation => helpers.jsExtendableArrayClass;
@@ -3231,5 +3276,35 @@
   ClassElement get syncStarIterableImplementation => helpers.syncStarIterable;
   ClassElement get asyncFutureImplementation => helpers.futureImplementation;
   ClassElement get asyncStarStreamImplementation => helpers.controllerStream;
-  ClassElement get functionImplementation => helpers.coreClasses.functionClass;
+  ClassElement get functionImplementation =>
+      helpers.commonElements.functionClass;
+  ClassElement get indexableImplementation => helpers.jsIndexableClass;
+  ClassElement get mutableIndexableImplementation =>
+      helpers.jsMutableIndexableClass;
+  ClassElement get indexingBehaviorImplementation =>
+      helpers.jsIndexingBehaviorInterface;
+  ClassElement get interceptorImplementation => helpers.jsInterceptorClass;
+
+  bool isDefaultEqualityImplementation(MemberElement element) {
+    assert(element.name == '==');
+    ClassElement classElement = element.enclosingClass;
+    return classElement == helpers.commonElements.objectClass ||
+        classElement == helpers.jsInterceptorClass ||
+        classElement == helpers.jsNullClass;
+  }
+
+  @override
+  bool isInterceptorClass(ClassElement cls) {
+    return helpers.backend.isInterceptorClass(cls);
+  }
+
+  @override
+  bool isNativeClass(ClassElement element) {
+    return helpers.backend.isNative(element);
+  }
+
+  @override
+  bool isNativeMember(MemberElement element) {
+    return helpers.backend.isNative(element);
+  }
 }
diff --git a/pkg/compiler/lib/src/js_backend/backend_helpers.dart b/pkg/compiler/lib/src/js_backend/backend_helpers.dart
index e50c744..5c2834a 100644
--- a/pkg/compiler/lib/src/js_backend/backend_helpers.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_helpers.dart
@@ -8,7 +8,7 @@
 import '../common/names.dart' show Identifiers, Uris;
 import '../common/resolution.dart' show Resolution;
 import '../compiler.dart' show Compiler;
-import '../core_types.dart' show CoreClasses;
+import '../core_types.dart' show CommonElements;
 import '../elements/elements.dart'
     show
         AbstractFieldElement,
@@ -16,7 +16,6 @@
         ConstructorElement,
         Element,
         EnumClassElement,
-        FieldElement,
         FunctionElement,
         LibraryElement,
         MemberElement,
@@ -26,6 +25,7 @@
 import '../library_loader.dart' show LoadedLibraries;
 import '../universe/call_structure.dart' show CallStructure;
 import '../universe/selector.dart' show Selector;
+import 'constant_system_javascript.dart';
 import 'js_backend.dart';
 
 /// Helper classes and functions for the JavaScript backend.
@@ -62,7 +62,7 @@
 
   Resolution get resolution => backend.resolution;
 
-  CoreClasses get coreClasses => compiler.coreClasses;
+  CommonElements get commonElements => compiler.commonElements;
 
   DiagnosticReporter get reporter => compiler.reporter;
 
@@ -113,9 +113,9 @@
   MethodElement jsArrayRemoveLast;
   MethodElement jsArrayAdd;
   MethodElement jsStringSplit;
-  Element jsStringToString;
-  Element jsStringOperatorAdd;
-  Element objectEquals;
+  MethodElement jsStringToString;
+  MethodElement jsStringOperatorAdd;
+  MethodElement objectEquals;
 
   ClassElement typeLiteralClass;
   ClassElement mapLiteralClass;
@@ -145,7 +145,7 @@
    */
   ClassElement jsIndexingBehaviorInterface;
 
-  Element getNativeInterceptorMethod;
+  MethodElement getNativeInterceptorMethod;
 
   /// Holds the method "getIsolateAffinityTag" when dart:_js_helper has been
   /// loaded.
@@ -182,7 +182,7 @@
 
   ClassElement _symbolImplementationClass;
   ClassElement get symbolImplementationClass {
-    return _symbolImplementationClass ??= find(internalLibrary, 'Symbol');
+    return _symbolImplementationClass ??= _find(internalLibrary, 'Symbol');
   }
 
   final Selector symbolValidatedConstructorSelector =
@@ -203,18 +203,25 @@
   }
 
   // TODO(johnniwinther): Make these private.
-  // TODO(johnniwinther): Split into findHelperFunction and findHelperClass and
-  // add a check that the element has the expected kind.
-  Element findHelper(String name) => find(jsHelperLibrary, name);
-  Element findAsyncHelper(String name) => find(asyncLibrary, name);
-  Element findInterceptor(String name) => find(interceptorsLibrary, name);
-  Element find(LibraryElement library, String name) {
+  // TODO(johnniwinther): Split into _findHelperFunction and _findHelperClass
+  // and add a check that the element has the expected kind.
+  Element _findHelper(String name) => _find(jsHelperLibrary, name);
+  FunctionElement _findHelperFunction(String name) =>
+      _find(jsHelperLibrary, name);
+  Element _findAsyncHelper(String name) => _find(asyncLibrary, name);
+  Element _findInterceptor(String name) => _find(interceptorsLibrary, name);
+  Element _find(LibraryElement library, String name) {
     Element element = library.implementation.findLocal(name);
     assert(invariant(library, element != null,
         message: "Element '$name' not found in '${library.canonicalUri}'."));
     return element;
   }
 
+  Element findCoreHelper(String name) {
+    LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
+    return coreLibrary.implementation.localLookup(name);
+  }
+
   ConstructorElement _findConstructor(ClassElement cls, String name) {
     cls.ensureResolved(resolution);
     ConstructorElement constructor = cls.lookupConstructor(name);
@@ -243,7 +250,7 @@
   void initializeHelperClasses(DiagnosticReporter reporter) {
     final List missingHelperClasses = [];
     ClassElement lookupHelperClass(String name) {
-      ClassElement result = findHelper(name);
+      ClassElement result = _findHelper(name);
       if (result == null) {
         missingHelperClasses.add(name);
       }
@@ -265,11 +272,11 @@
     Uri uri = library.canonicalUri;
 
     FunctionElement findMethod(String name) {
-      return find(library, name);
+      return _find(library, name);
     }
 
     ClassElement findClass(String name) {
-      return find(library, name);
+      return _find(library, name);
     }
 
     if (uri == DART_INTERCEPTORS) {
@@ -300,10 +307,10 @@
       jsMutableIndexableClass = findClass('JSMutableIndexable');
     } else if (uri == DART_JS_HELPER) {
       initializeHelperClasses(reporter);
-      assertTest = findHelper('assertTest');
-      assertThrow = findHelper('assertThrow');
-      assertHelper = findHelper('assertHelper');
-      assertUnreachableMethod = findHelper('assertUnreachable');
+      assertTest = _findHelper('assertTest');
+      assertThrow = _findHelper('assertThrow');
+      assertHelper = _findHelper('assertHelper');
+      assertUnreachableMethod = _findHelper('assertUnreachable');
 
       typeLiteralClass = findClass('TypeImpl');
       constMapLiteralClass = findClass('ConstantMap');
@@ -321,21 +328,21 @@
 
       requiresPreambleMarker = findMethod('requiresPreamble');
     } else if (uri == DART_JS_MIRRORS) {
-      disableTreeShakingMarker = find(library, 'disableTreeShaking');
-      preserveMetadataMarker = find(library, 'preserveMetadata');
-      preserveUrisMarker = find(library, 'preserveUris');
-      preserveLibraryNamesMarker = find(library, 'preserveLibraryNames');
+      disableTreeShakingMarker = _find(library, 'disableTreeShaking');
+      preserveMetadataMarker = _find(library, 'preserveMetadata');
+      preserveUrisMarker = _find(library, 'preserveUris');
+      preserveLibraryNamesMarker = _find(library, 'preserveLibraryNames');
     } else if (uri == DART_JS_NAMES) {
-      preserveNamesMarker = find(library, 'preserveNames');
+      preserveNamesMarker = _find(library, 'preserveNames');
     } else if (uri == DART_EMBEDDED_NAMES) {
-      jsGetNameEnum = find(library, 'JsGetName');
-      jsBuiltinEnum = find(library, 'JsBuiltin');
+      jsGetNameEnum = _find(library, 'JsGetName');
+      jsBuiltinEnum = _find(library, 'JsBuiltin');
     } else if (uri == Uris.dart__native_typed_data) {
       typedArrayClass = findClass('NativeTypedArray');
       typedArrayOfIntClass = findClass('NativeTypedArrayOfInt');
     } else if (uri == PACKAGE_JS) {
-      jsAnnotationClass = find(library, 'JS');
-      jsAnonymousClass = find(library, '_Anonymous');
+      jsAnnotationClass = _find(library, 'JS');
+      jsAnonymousClass = _find(library, '_Anonymous');
     }
   }
 
@@ -351,7 +358,8 @@
 
     // [LinkedHashMap] is reexported from dart:collection and can therefore not
     // be loaded from dart:core in [onLibraryScanned].
-    mapLiteralClass = compiler.commonElements.coreLibrary.find('LinkedHashMap');
+    LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
+    mapLiteralClass = coreLibrary.find('LinkedHashMap');
     assert(invariant(
         compiler.commonElements.coreLibrary, mapLiteralClass != null,
         message: "Element 'LinkedHashMap' not found in 'dart:core'."));
@@ -390,7 +398,8 @@
     jsStringOperatorAdd = compiler.lookupElementIn(jsStringClass, '+');
     jsStringToString = compiler.lookupElementIn(jsStringClass, 'toString');
 
-    objectEquals = compiler.lookupElementIn(coreClasses.objectClass, '==');
+    ClassElement objectClass = commonElements.objectClass;
+    objectEquals = compiler.lookupElementIn(objectClass, '==');
   }
 
   ConstructorElement _mapLiteralConstructor;
@@ -461,23 +470,23 @@
   }
 
   Element get badMain {
-    return findHelper('badMain');
+    return _findHelper('badMain');
   }
 
   Element get missingMain {
-    return findHelper('missingMain');
+    return _findHelper('missingMain');
   }
 
   Element get mainHasTooManyParameters {
-    return findHelper('mainHasTooManyParameters');
+    return _findHelper('mainHasTooManyParameters');
   }
 
   MethodElement get loadLibraryWrapper {
-    return findHelper("_loadLibraryWrapper");
+    return _findHelper("_loadLibraryWrapper");
   }
 
   Element get boolConversionCheck {
-    return findHelper('boolConversionCheck');
+    return _findHelper('boolConversionCheck');
   }
 
   MethodElement _traceHelper;
@@ -489,316 +498,392 @@
   }
 
   MethodElement get _consoleTraceHelper {
-    return findHelper('consoleTraceHelper');
+    return _findHelper('consoleTraceHelper');
   }
 
   MethodElement get _postTraceHelper {
-    return findHelper('postTraceHelper');
+    return _findHelper('postTraceHelper');
   }
 
-  FunctionElement get closureFromTearOff {
-    return findHelper('closureFromTearOff');
+  MethodElement get closureFromTearOff {
+    return _findHelper('closureFromTearOff');
   }
 
-  Element get isJsIndexable {
-    return findHelper('isJsIndexable');
+  MethodElement get isJsIndexable {
+    return _findHelper('isJsIndexable');
   }
 
-  Element get throwIllegalArgumentException {
-    return findHelper('iae');
+  MethodElement get throwIllegalArgumentException {
+    return _findHelper('iae');
   }
 
-  Element get throwIndexOutOfRangeException {
-    return findHelper('ioore');
+  MethodElement get throwIndexOutOfRangeException {
+    return _findHelper('ioore');
   }
 
   Element get exceptionUnwrapper {
-    return findHelper('unwrapException');
+    return _findHelper('unwrapException');
   }
 
   Element get throwRuntimeError {
-    return findHelper('throwRuntimeError');
+    return _findHelper('throwRuntimeError');
   }
 
   Element get throwTypeError {
-    return findHelper('throwTypeError');
+    return _findHelper('throwTypeError');
   }
 
   Element get throwAbstractClassInstantiationError {
-    return findHelper('throwAbstractClassInstantiationError');
+    return _findHelper('throwAbstractClassInstantiationError');
   }
 
   Element get checkConcurrentModificationError {
     if (cachedCheckConcurrentModificationError == null) {
       cachedCheckConcurrentModificationError =
-          findHelper('checkConcurrentModificationError');
+          _findHelper('checkConcurrentModificationError');
     }
     return cachedCheckConcurrentModificationError;
   }
 
-  Element get throwConcurrentModificationError {
-    return findHelper('throwConcurrentModificationError');
+  MethodElement get throwConcurrentModificationError {
+    return _findHelper('throwConcurrentModificationError');
   }
 
-  Element get checkInt => _checkInt ??= findHelper('checkInt');
+  Element get checkInt => _checkInt ??= _findHelper('checkInt');
   Element _checkInt;
 
-  Element get checkNum => _checkNum ??= findHelper('checkNum');
+  Element get checkNum => _checkNum ??= _findHelper('checkNum');
   Element _checkNum;
 
-  Element get checkString => _checkString ??= findHelper('checkString');
+  Element get checkString => _checkString ??= _findHelper('checkString');
   Element _checkString;
 
-  Element get stringInterpolationHelper {
-    return findHelper('S');
+  MethodElement get stringInterpolationHelper {
+    return _findHelper('S');
   }
 
-  Element get wrapExceptionHelper {
-    return findHelper(r'wrapException');
+  MethodElement get wrapExceptionHelper {
+    return _findHelper(r'wrapException');
   }
 
-  Element get throwExpressionHelper {
-    return findHelper('throwExpression');
+  MethodElement get throwExpressionHelper {
+    return _findHelper('throwExpression');
   }
 
-  Element get closureConverter {
-    return findHelper('convertDartClosureToJS');
+  MethodElement get closureConverter {
+    return _findHelper('convertDartClosureToJS');
   }
 
   Element get traceFromException {
-    return findHelper('getTraceFromException');
+    return _findHelper('getTraceFromException');
   }
 
-  Element get setRuntimeTypeInfo {
-    return findHelper('setRuntimeTypeInfo');
+  MethodElement get setRuntimeTypeInfo {
+    return _findHelper('setRuntimeTypeInfo');
   }
 
   Element get getRuntimeTypeInfo {
-    return findHelper('getRuntimeTypeInfo');
+    return _findHelper('getRuntimeTypeInfo');
   }
 
-  Element get getTypeArgumentByIndex {
-    return findHelper('getTypeArgumentByIndex');
+  MethodElement get getTypeArgumentByIndex {
+    return _findHelper('getTypeArgumentByIndex');
   }
 
-  Element get computeSignature {
-    return findHelper('computeSignature');
+  MethodElement get computeSignature {
+    return _findHelper('computeSignature');
   }
 
   Element get getRuntimeTypeArguments {
-    return findHelper('getRuntimeTypeArguments');
+    return _findHelper('getRuntimeTypeArguments');
   }
 
-  Element get getRuntimeTypeArgument {
-    return findHelper('getRuntimeTypeArgument');
+  MethodElement get getRuntimeTypeArgument {
+    return _findHelper('getRuntimeTypeArgument');
   }
 
   Element get runtimeTypeToString {
-    return findHelper('runtimeTypeToString');
+    return _findHelper('runtimeTypeToString');
   }
 
   Element get assertIsSubtype {
-    return findHelper('assertIsSubtype');
+    return _findHelper('assertIsSubtype');
   }
 
   Element get checkSubtype {
-    return findHelper('checkSubtype');
+    return _findHelper('checkSubtype');
   }
 
   Element get assertSubtype {
-    return findHelper('assertSubtype');
+    return _findHelper('assertSubtype');
   }
 
   Element get subtypeCast {
-    return findHelper('subtypeCast');
+    return _findHelper('subtypeCast');
   }
 
   Element get checkSubtypeOfRuntimeType {
-    return findHelper('checkSubtypeOfRuntimeType');
+    return _findHelper('checkSubtypeOfRuntimeType');
   }
 
   Element get assertSubtypeOfRuntimeType {
-    return findHelper('assertSubtypeOfRuntimeType');
+    return _findHelper('assertSubtypeOfRuntimeType');
   }
 
   Element get subtypeOfRuntimeTypeCast {
-    return findHelper('subtypeOfRuntimeTypeCast');
+    return _findHelper('subtypeOfRuntimeTypeCast');
   }
 
   Element get checkDeferredIsLoaded {
-    return findHelper('checkDeferredIsLoaded');
+    return _findHelper('checkDeferredIsLoaded');
   }
 
   Element get throwNoSuchMethod {
-    return findHelper('throwNoSuchMethod');
+    return _findHelper('throwNoSuchMethod');
   }
 
-  Element get createRuntimeType {
-    return findHelper('createRuntimeType');
+  Element get malformedTypeError => _cachedCoreHelper('_malformedTypeError');
+  Element get genericNoSuchMethod => _cachedCoreHelper('_genericNoSuchMethod');
+  Element get unresolvedConstructorError =>
+      _cachedCoreHelper('_unresolvedConstructorError');
+  Element get unresolvedStaticGetterError =>
+      _cachedCoreHelper('_unresolvedStaticGetterError');
+  Element get unresolvedStaticSetterError =>
+      _cachedCoreHelper('_unresolvedStaticSetterError');
+  Element get unresolvedStaticMethodError =>
+      _cachedCoreHelper('_unresolvedStaticMethodError');
+  Element get unresolvedTopLevelGetterError =>
+      _cachedCoreHelper('_unresolvedTopLevelGetterError');
+  Element get unresolvedTopLevelSetterError =>
+      _cachedCoreHelper('_unresolvedTopLevelSetterError');
+  Element get unresolvedTopLevelMethodError =>
+      _cachedCoreHelper('_unresolvedTopLevelMethodError');
+
+  Map<String, Element> _cachedCoreHelpers = <String, Element>{};
+  Element _cachedCoreHelper(String name) =>
+      _cachedCoreHelpers[name] ??= findCoreHelper(name);
+
+  MethodElement get createRuntimeType {
+    return _findHelper('createRuntimeType');
   }
 
   Element get fallThroughError {
-    return findHelper("getFallThroughError");
+    return _findHelper("getFallThroughError");
   }
 
-  Element get createInvocationMirror {
-    return findHelper('createInvocationMirror');
+  MethodElement get createInvocationMirror {
+    return _findHelper('createInvocationMirror');
   }
 
-  Element get cyclicThrowHelper {
-    return findHelper("throwCyclicInit");
+  MethodElement get cyclicThrowHelper {
+    return _findHelper("throwCyclicInit");
   }
 
-  Element get asyncHelper {
-    return findAsyncHelper("_asyncHelper");
+  MethodElement get asyncHelper {
+    return _findAsyncHelper("_asyncHelper");
   }
 
-  Element get wrapBody {
-    return findAsyncHelper("_wrapJsFunctionForAsync");
+  MethodElement get wrapBody {
+    return _findAsyncHelper("_wrapJsFunctionForAsync");
   }
 
-  Element get yieldStar {
-    ClassElement classElement = findAsyncHelper("_IterationMarker");
+  MethodElement get yieldStar {
+    ClassElement classElement = _findAsyncHelper("_IterationMarker");
     classElement.ensureResolved(resolution);
     return classElement.lookupLocalMember("yieldStar");
   }
 
-  Element get yieldSingle {
-    ClassElement classElement = findAsyncHelper("_IterationMarker");
+  MethodElement get yieldSingle {
+    ClassElement classElement = _findAsyncHelper("_IterationMarker");
     classElement.ensureResolved(resolution);
     return classElement.lookupLocalMember("yieldSingle");
   }
 
-  Element get syncStarUncaughtError {
-    ClassElement classElement = findAsyncHelper("_IterationMarker");
+  MethodElement get syncStarUncaughtError {
+    ClassElement classElement = _findAsyncHelper("_IterationMarker");
     classElement.ensureResolved(resolution);
     return classElement.lookupLocalMember("uncaughtError");
   }
 
-  Element get asyncStarHelper {
-    return findAsyncHelper("_asyncStarHelper");
+  MethodElement get asyncStarHelper {
+    return _findAsyncHelper("_asyncStarHelper");
   }
 
-  Element get streamOfController {
-    return findAsyncHelper("_streamOfController");
+  MethodElement get streamOfController {
+    return _findAsyncHelper("_streamOfController");
   }
 
-  Element get endOfIteration {
-    ClassElement classElement = findAsyncHelper("_IterationMarker");
+  MethodElement get endOfIteration {
+    ClassElement classElement = _findAsyncHelper("_IterationMarker");
     classElement.ensureResolved(resolution);
     return classElement.lookupLocalMember("endOfIteration");
   }
 
-  Element get syncStarIterable {
-    ClassElement classElement = findAsyncHelper("_SyncStarIterable");
+  ClassElement get syncStarIterable {
+    ClassElement classElement = _findAsyncHelper("_SyncStarIterable");
     classElement.ensureResolved(resolution);
     return classElement;
   }
 
   Element get futureImplementation {
-    ClassElement classElement = findAsyncHelper('_Future');
+    ClassElement classElement = _findAsyncHelper('_Future');
     classElement.ensureResolved(resolution);
     return classElement;
   }
 
-  Element get controllerStream {
-    ClassElement classElement = findAsyncHelper("_ControllerStream");
+  ClassElement get controllerStream {
+    ClassElement classElement = _findAsyncHelper("_ControllerStream");
     classElement.ensureResolved(resolution);
     return classElement;
   }
 
-  Element get syncStarIterableConstructor {
+  ConstructorElement get syncStarIterableConstructor {
     ClassElement classElement = syncStarIterable;
     classElement.ensureResolved(resolution);
     return classElement.lookupConstructor("");
   }
 
-  Element get syncCompleterConstructor {
-    ClassElement classElement = find(asyncLibrary, "Completer");
+  ConstructorElement get syncCompleterConstructor {
+    ClassElement classElement = _find(asyncLibrary, "Completer");
     classElement.ensureResolved(resolution);
     return classElement.lookupConstructor("sync");
   }
 
-  Element get asyncStarController {
-    ClassElement classElement = findAsyncHelper("_AsyncStarStreamController");
+  ClassElement get asyncStarController {
+    ClassElement classElement = _findAsyncHelper("_AsyncStarStreamController");
     classElement.ensureResolved(resolution);
     return classElement;
   }
 
-  Element get asyncStarControllerConstructor {
+  ConstructorElement get asyncStarControllerConstructor {
     ClassElement classElement = asyncStarController;
     return classElement.lookupConstructor("");
   }
 
-  Element get streamIteratorConstructor {
-    ClassElement classElement = find(asyncLibrary, "StreamIterator");
+  ConstructorElement get streamIteratorConstructor {
+    ClassElement classElement = _find(asyncLibrary, "StreamIterator");
     classElement.ensureResolved(resolution);
     return classElement.lookupConstructor("");
   }
 
   ClassElement get VoidRuntimeType {
-    return findHelper('VoidRuntimeType');
+    return _findHelper('VoidRuntimeType');
   }
 
   ClassElement get RuntimeType {
-    return findHelper('RuntimeType');
+    return _findHelper('RuntimeType');
   }
 
   ClassElement get RuntimeFunctionType {
-    return findHelper('RuntimeFunctionType');
+    return _findHelper('RuntimeFunctionType');
   }
 
   ClassElement get RuntimeTypePlain {
-    return findHelper('RuntimeTypePlain');
+    return _findHelper('RuntimeTypePlain');
   }
 
   ClassElement get RuntimeTypeGeneric {
-    return findHelper('RuntimeTypeGeneric');
+    return _findHelper('RuntimeTypeGeneric');
   }
 
   ClassElement get DynamicRuntimeType {
-    return findHelper('DynamicRuntimeType');
+    return _findHelper('DynamicRuntimeType');
+  }
+
+  MethodElement get getDynamicRuntimeType {
+    // TODO(johnniwinther): Support this in mocks.
+    return jsHelperLibrary.find('getDynamicRuntimeType');
+  }
+
+  MethodElement get getVoidRuntimeType {
+    // TODO(johnniwinther): Support this in mocks.
+    return jsHelperLibrary.find('getVoidRuntimeType');
+  }
+
+  MethodElement get buildInterfaceType {
+    // TODO(johnniwinther): Support this in mocks.
+    return jsHelperLibrary.find('buildInterfaceType');
+  }
+
+  MethodElement get buildFunctionType {
+    // TODO(johnniwinther): Support this in mocks.
+    return jsHelperLibrary.find('buildFunctionType');
+  }
+
+  MethodElement get buildNamedFunctionType {
+    // TODO(johnniwinther): Support this in mocks.
+    return jsHelperLibrary.find('buildNamedFunctionType');
   }
 
   MethodElement get functionTypeTestMetaHelper {
-    return findHelper('functionTypeTestMetaHelper');
+    return _findHelper('functionTypeTestMetaHelper');
   }
 
   MethodElement get defineProperty {
-    return findHelper('defineProperty');
+    return _findHelper('defineProperty');
   }
 
-  Element get startRootIsolate {
-    return find(isolateHelperLibrary, START_ROOT_ISOLATE);
+  MethodElement get startRootIsolate {
+    return _find(isolateHelperLibrary, START_ROOT_ISOLATE);
   }
 
   Element get currentIsolate {
-    return find(isolateHelperLibrary, '_currentIsolate');
+    return _find(isolateHelperLibrary, '_currentIsolate');
   }
 
   Element get callInIsolate {
-    return find(isolateHelperLibrary, '_callInIsolate');
+    return _find(isolateHelperLibrary, '_callInIsolate');
   }
 
   Element get findIndexForNativeSubclassType {
-    return findInterceptor('findIndexForNativeSubclassType');
+    return _findInterceptor('findIndexForNativeSubclassType');
   }
 
-  Element get convertRtiToRuntimeType {
-    return findHelper('convertRtiToRuntimeType');
+  MethodElement get convertRtiToRuntimeType {
+    return _findHelper('convertRtiToRuntimeType');
   }
 
   ClassElement get stackTraceClass {
-    return findHelper('_StackTrace');
+    return _findHelper('_StackTrace');
   }
 
   MethodElement _objectNoSuchMethod;
 
   MethodElement get objectNoSuchMethod {
     if (_objectNoSuchMethod == null) {
+      ClassElement objectClass = commonElements.objectClass;
       _objectNoSuchMethod =
-          coreClasses.objectClass.lookupLocalMember(Identifiers.noSuchMethod_);
+          objectClass.lookupLocalMember(Identifiers.noSuchMethod_);
     }
     return _objectNoSuchMethod;
   }
+
+  ClassElement get constantMapClass =>
+      _findHelper(JavaScriptMapConstant.DART_CLASS);
+  ClassElement get constantStringMapClass =>
+      _findHelper(JavaScriptMapConstant.DART_STRING_CLASS);
+  ClassElement get constantProtoMapClass =>
+      _findHelper(JavaScriptMapConstant.DART_PROTO_CLASS);
+  ClassElement get generalConstantMapClass =>
+      _findHelper(JavaScriptMapConstant.DART_GENERAL_CLASS);
+
+  ClassElement get annotationCreatesClass {
+    return _findHelper('Creates');
+  }
+
+  ClassElement get annotationReturnsClass {
+    return _findHelper('Returns');
+  }
+
+  ClassElement get annotationJSNameClass {
+    return _findHelper('JSName');
+  }
+
+  MethodElement get toStringForNativeObject {
+    return _findHelper('toStringForNativeObject');
+  }
+
+  MethodElement get hashCodeForNativeObject {
+    return _findHelper('hashCodeForNativeObject');
+  }
 }
diff --git a/pkg/compiler/lib/src/js_backend/backend_impact.dart b/pkg/compiler/lib/src/js_backend/backend_impact.dart
index b5b9e72..97da9b7 100644
--- a/pkg/compiler/lib/src/js_backend/backend_impact.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_impact.dart
@@ -7,7 +7,7 @@
 import '../common/names.dart';
 import '../compiler.dart' show Compiler;
 import '../core_types.dart' show CommonElements;
-import '../dart_types.dart' show InterfaceType;
+import '../elements/resolution_types.dart' show ResolutionInterfaceType;
 import '../elements/elements.dart' show ClassElement, Element;
 import '../universe/selector.dart';
 import '../util/enumset.dart';
@@ -26,7 +26,7 @@
   final List<Element> staticUses;
   final List<Element> globalUses;
   final List<Selector> dynamicUses;
-  final List<InterfaceType> instantiatedTypes;
+  final List<ResolutionInterfaceType> instantiatedTypes;
   final List<ClassElement> instantiatedClasses;
   final List<ClassElement> globalClasses;
   final List<BackendImpact> otherImpacts;
@@ -36,7 +36,7 @@
       {this.staticUses: const <Element>[],
       this.globalUses: const <Element>[],
       this.dynamicUses: const <Selector>[],
-      this.instantiatedTypes: const <InterfaceType>[],
+      this.instantiatedTypes: const <ResolutionInterfaceType>[],
       this.instantiatedClasses: const <ClassElement>[],
       this.globalClasses: const <ClassElement>[],
       this.otherImpacts: const <BackendImpact>[],
@@ -160,13 +160,33 @@
   BackendImpact _throwNoSuchMethod;
 
   BackendImpact get throwNoSuchMethod {
-    return _throwNoSuchMethod ??= new BackendImpact(staticUses: [
-      helpers.throwNoSuchMethod
-    ], otherImpacts: [
-      // Also register the types of the arguments passed to this method.
-      _needsList('Needed to encode the arguments for throw NoSuchMethodError.'),
-      _needsString('Needed to encode the name for throw NoSuchMethodError.')
-    ]);
+    return _throwNoSuchMethod ??= new BackendImpact(
+        instantiatedClasses: compiler.options.useKernel
+            ? [
+                commonElements.symbolClass,
+              ]
+            : [],
+        staticUses: compiler.options.useKernel
+            ? [
+                helpers.genericNoSuchMethod,
+                helpers.unresolvedConstructorError,
+                helpers.unresolvedStaticMethodError,
+                helpers.unresolvedStaticGetterError,
+                helpers.unresolvedStaticSetterError,
+                helpers.unresolvedTopLevelMethodError,
+                helpers.unresolvedTopLevelGetterError,
+                helpers.unresolvedTopLevelSetterError,
+                commonElements.symbolConstructor,
+              ]
+            : [
+                helpers.throwNoSuchMethod,
+              ],
+        otherImpacts: [
+          // Also register the types of the arguments passed to this method.
+          _needsList(
+              'Needed to encode the arguments for throw NoSuchMethodError.'),
+          _needsString('Needed to encode the name for throw NoSuchMethodError.')
+        ]);
   }
 
   BackendImpact _stringValues;
@@ -222,12 +242,21 @@
   BackendImpact _throwRuntimeError;
 
   BackendImpact get throwRuntimeError {
-    return _throwRuntimeError ??= new BackendImpact(staticUses: [
-      helpers.throwRuntimeError
-    ], otherImpacts: [
-      // Also register the types of the arguments passed to this method.
-      stringValues
-    ]);
+    return _throwRuntimeError ??= new BackendImpact(
+        staticUses: compiler.options.useKernel
+            ? [
+                // TODO(sra): Refactor impacts so that we know which of these
+                // are called.
+                helpers.malformedTypeError,
+                helpers.throwRuntimeError,
+              ]
+            : [
+                helpers.throwRuntimeError,
+              ],
+        otherImpacts: [
+          // Also register the types of the arguments passed to this method.
+          stringValues
+        ]);
   }
 
   BackendImpact _superNoSuchMethod;
@@ -246,19 +275,12 @@
   BackendImpact _constantMapLiteral;
 
   BackendImpact get constantMapLiteral {
-    if (_constantMapLiteral == null) {
-      ClassElement find(String name) {
-        return helpers.find(helpers.jsHelperLibrary, name);
-      }
-
-      _constantMapLiteral = new BackendImpact(instantiatedClasses: [
-        find(JavaScriptMapConstant.DART_CLASS),
-        find(JavaScriptMapConstant.DART_PROTO_CLASS),
-        find(JavaScriptMapConstant.DART_STRING_CLASS),
-        find(JavaScriptMapConstant.DART_GENERAL_CLASS)
-      ]);
-    }
-    return _constantMapLiteral;
+    return _constantMapLiteral ??= new BackendImpact(instantiatedClasses: [
+      helpers.constantMapClass,
+      helpers.constantProtoMapClass,
+      helpers.constantStringMapClass,
+      helpers.generalConstantMapClass,
+    ]);
   }
 
   BackendImpact _symbolConstructor;
@@ -273,7 +295,7 @@
   BackendImpact get constSymbol {
     return _constSymbol ??= new BackendImpact(
         instantiatedClasses: [commonElements.symbolClass],
-        staticUses: [commonElements.symbolConstructor.declaration]);
+        staticUses: [commonElements.symbolConstructor]);
   }
 
   /// Helper for registering that `int` is needed.
@@ -427,8 +449,14 @@
   BackendImpact _malformedTypeCheck;
 
   BackendImpact get malformedTypeCheck {
-    return _malformedTypeCheck ??=
-        new BackendImpact(staticUses: [helpers.throwTypeError]);
+    return _malformedTypeCheck ??= new BackendImpact(
+        staticUses: compiler.options.useKernel
+            ? [
+                helpers.malformedTypeError,
+              ]
+            : [
+                helpers.throwTypeError,
+              ]);
   }
 
   BackendImpact _genericTypeCheck;
@@ -550,7 +578,7 @@
         // The backend will use a literal list to initialize the entries
         // of the map.
         globalClasses: [
-          helpers.coreClasses.listClass,
+          helpers.commonElements.listClass,
           helpers.mapLiteralClass
         ]);
   }
@@ -644,7 +672,7 @@
 
   BackendImpact get runtimeTypeSupport {
     return _runtimeTypeSupport ??= new BackendImpact(
-        globalClasses: [helpers.coreClasses.listClass],
+        globalClasses: [helpers.commonElements.listClass],
         globalUses: [helpers.setRuntimeTypeInfo, helpers.getRuntimeTypeInfo],
         otherImpacts: [getRuntimeTypeArgument, computeSignature]);
   }
@@ -655,7 +683,7 @@
     return _deferredLoading ??=
         new BackendImpact(globalUses: [helpers.checkDeferredIsLoaded],
             // Also register the types of the arguments passed to this method.
-            globalClasses: [helpers.coreClasses.stringClass]);
+            globalClasses: [helpers.commonElements.stringClass]);
   }
 
   BackendImpact _noSuchMethodSupport;
diff --git a/pkg/compiler/lib/src/js_backend/backend_serialization.dart b/pkg/compiler/lib/src/js_backend/backend_serialization.dart
index 523f188..834daae 100644
--- a/pkg/compiler/lib/src/js_backend/backend_serialization.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_serialization.dart
@@ -5,7 +5,7 @@
 library js_backend.serialization;
 
 import '../common/backend_api.dart' show BackendSerialization;
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../js/js.dart' as js;
 import '../native/native.dart';
@@ -156,7 +156,7 @@
   static const int SPECIAL_TYPE = 2;
 
   static int getTypeKind(var type) {
-    if (type is DartType) {
+    if (type is ResolutionDartType) {
       // TODO(johnniwinther): Remove this when annotation are no longer resolved
       // to this-types.
       if (type is GenericType &&
@@ -169,8 +169,8 @@
     return SPECIAL_TYPE;
   }
 
-  /// Returns a list of the non-this-type [DartType]s in [types].
-  static List<DartType> filterDartTypes(List types) {
+  /// Returns a list of the non-this-type [ResolutionDartType]s in [types].
+  static List<ResolutionDartType> filterDartTypes(List types) {
     return types.where((type) => getTypeKind(type) == NORMAL_TYPE).toList();
   }
 
diff --git a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
index 38e0070..613abf9 100644
--- a/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
+++ b/pkg/compiler/lib/src/js_backend/checked_mode_helpers.dart
@@ -3,7 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import '../compiler.dart' show Compiler;
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../js/js.dart' as jsAst;
 import '../js/js.dart' show js;
@@ -20,8 +20,10 @@
 
   StaticUse getStaticUse(Compiler compiler) {
     JavaScriptBackend backend = compiler.backend;
-    return new StaticUse.staticInvoke(
-        backend.helpers.findHelper(name), callStructure);
+    // TODO(johnniwinther): Refactor this to avoid looking up directly in the
+    // js helper library but instead access helpers directly on backend helpers.
+    MethodElement method = backend.helpers.jsHelperLibrary.find(name);
+    return new StaticUse.staticInvoke(method, callStructure);
   }
 
   CallStructure get callStructure => CallStructure.ONE_ARG;
@@ -89,7 +91,8 @@
 
   void generateAdditionalArguments(SsaCodeGenerator codegen,
       HTypeConversion node, List<jsAst.Expression> arguments) {
-    ErroneousElement element = node.typeExpression.element;
+    MalformedType type = node.typeExpression;
+    ErroneousElement element = type.element;
     arguments.add(js.escapedString(element.message));
   }
 }
@@ -101,7 +104,7 @@
 
   void generateAdditionalArguments(SsaCodeGenerator codegen,
       HTypeConversion node, List<jsAst.Expression> arguments) {
-    DartType type = node.typeExpression;
+    ResolutionDartType type = node.typeExpression;
     jsAst.Name additionalArgument = codegen.backend.namer.operatorIsType(type);
     arguments.add(js.quoteName(additionalArgument));
   }
@@ -127,7 +130,7 @@
 
   void generateAdditionalArguments(SsaCodeGenerator codegen,
       HTypeConversion node, List<jsAst.Expression> arguments) {
-    DartType type = node.typeExpression;
+    ResolutionDartType type = node.typeExpression;
     Element element = type.element;
     jsAst.Name isField = codegen.backend.namer.operatorIs(element);
     arguments.add(js.quoteName(isField));
diff --git a/pkg/compiler/lib/src/js_backend/constant_emitter.dart b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
index 31bcccb..32bffa9 100644
--- a/pkg/compiler/lib/src/js_backend/constant_emitter.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_emitter.dart
@@ -5,7 +5,7 @@
 import '../common.dart';
 import '../compiler.dart' show Compiler;
 import '../constants/values.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../io/code_output.dart';
 import '../js/js.dart' as jsAst;
@@ -263,13 +263,13 @@
 
   JavaScriptBackend get backend => compiler.backend;
 
-  jsAst.PropertyAccess getHelperProperty(Element helper) {
+  jsAst.PropertyAccess getHelperProperty(MethodElement helper) {
     return backend.emitter.staticFunctionAccess(helper);
   }
 
   @override
   jsAst.Expression visitType(TypeConstantValue constant, [_]) {
-    DartType type = constant.representedType;
+    ResolutionDartType type = constant.representedType;
     jsAst.Name typeName = namer.runtimeTypeName(type.element);
     return new jsAst.Call(getHelperProperty(backend.helpers.createRuntimeType),
         [js.quoteName(typeName)]);
@@ -277,7 +277,7 @@
 
   @override
   jsAst.Expression visitInterceptor(InterceptorConstantValue constant, [_]) {
-    ClassElement interceptorClass = constant.dispatchedType.element;
+    ClassElement interceptorClass = constant.cls;
     return backend.emitter.interceptorPrototypeAccess(interceptorClass);
   }
 
@@ -323,8 +323,8 @@
   }
 
   jsAst.Expression maybeAddTypeArguments(
-      InterfaceType type, jsAst.Expression value) {
-    if (type is InterfaceType &&
+      ResolutionInterfaceType type, jsAst.Expression value) {
+    if (type is ResolutionInterfaceType &&
         !type.treatAsRaw &&
         backend.classNeedsRti(type.element)) {
       return new jsAst.Call(
@@ -334,8 +334,8 @@
     return value;
   }
 
-  jsAst.Expression _reifiedTypeArguments(InterfaceType type) {
-    jsAst.Expression unexpected(TypeVariableType variable) {
+  jsAst.Expression _reifiedTypeArguments(ResolutionInterfaceType type) {
+    jsAst.Expression unexpected(ResolutionTypeVariableType variable) {
       reporter.internalError(
           NO_LOCATION_SPANNABLE,
           "Unexpected type variable '${variable.getStringAsDeclared(null)}'"
@@ -345,7 +345,7 @@
 
     List<jsAst.Expression> arguments = <jsAst.Expression>[];
     RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder;
-    for (DartType argument in type.typeArguments) {
+    for (ResolutionDartType argument in type.typeArguments) {
       arguments.add(rtiEncoder.getTypeRepresentation(argument, unexpected));
     }
     return new jsAst.ArrayInitializer(arguments);
diff --git a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
index 0473fe6..4847928 100644
--- a/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_handler_javascript.dart
@@ -118,7 +118,7 @@
 
   // TODO(johnniwinther): Move this to the backend constant handler.
   /** Caches the statics where the initial value cannot be eagerly compiled. */
-  final Set<VariableElement> lazyStatics = new Set<VariableElement>();
+  final Set<FieldElement> lazyStatics = new Set<FieldElement>();
 
   // Constants computed for constant expressions.
   final Map<Node, ConstantExpression> nodeConstantMap =
@@ -157,8 +157,8 @@
     compiledConstants.add(constant);
   }
 
-  List<VariableElement> getLazilyInitializedFieldsForEmission() {
-    return new List<VariableElement>.from(lazyStatics);
+  List<FieldElement> getLazilyInitializedFieldsForEmission() {
+    return new List<FieldElement>.from(lazyStatics);
   }
 
   /**
diff --git a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
index 08174df..1571c41 100644
--- a/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
+++ b/pkg/compiler/lib/src/js_backend/constant_system_javascript.dart
@@ -8,8 +8,8 @@
 import '../constant_system_dart.dart';
 import '../constants/constant_system.dart';
 import '../constants/values.dart';
-import '../core_types.dart' show CoreTypes;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart' show ClassElement, FieldElement;
 import '../tree/dartstring.dart' show DartString, LiteralDartString;
 import 'js_backend.dart';
@@ -124,6 +124,20 @@
   apply(left, right) => _addOperation.apply(left, right);
 }
 
+class JavaScriptRemainderOperation extends ArithmeticNumOperation {
+  String get name => 'remainder';
+
+  const JavaScriptRemainderOperation();
+
+  int foldInts(int left, int right) {
+    if (right == 0) return null;
+    return left.remainder(right);
+  }
+
+  num foldNums(num left, num right) => left.remainder(right);
+  apply(left, right) => left.remainder(right);
+}
+
 class JavaScriptBinaryArithmeticOperation implements BinaryOperation {
   final BinaryOperation dartArithmeticOperation;
 
@@ -233,6 +247,7 @@
       const JavaScriptBinaryArithmeticOperation(const MultiplyOperation());
   final negate = const JavaScriptNegateOperation();
   final not = const NotOperation();
+  final remainder = const JavaScriptRemainderOperation();
   final shiftLeft =
       const JavaScriptBinaryBitOperation(const ShiftLeftOperation());
   final shiftRight = const JavaScriptShiftRightOperation();
@@ -298,16 +313,17 @@
   NullConstantValue createNull() => new NullConstantValue();
 
   @override
-  ListConstantValue createList(InterfaceType type, List<ConstantValue> values) {
+  ListConstantValue createList(
+      ResolutionInterfaceType type, List<ConstantValue> values) {
     return new ListConstantValue(type, values);
   }
 
   @override
-  ConstantValue createType(Compiler compiler, DartType type) {
-    return new TypeConstantValue(
-        type,
-        compiler.backend.backendClasses.typeImplementation
-            .computeType(compiler.resolution));
+  ConstantValue createType(Compiler compiler, ResolutionDartType type) {
+    ResolutionInterfaceType instanceType = compiler
+        .backend.backendClasses.typeImplementation
+        .computeType(compiler.resolution);
+    return new TypeConstantValue(type, instanceType);
   }
 
   // Integer checks report true for -0.0, INFINITY, and -INFINITY.  At
@@ -329,21 +345,25 @@
   bool isBool(ConstantValue constant) => constant.isBool;
   bool isNull(ConstantValue constant) => constant.isNull;
 
-  bool isSubtype(DartTypes types, DartType s, DartType t) {
+  bool isSubtype(DartTypes types, ResolutionDartType s, ResolutionDartType t) {
     // At runtime, an integer is both an integer and a double: the
     // integer type check is Math.floor, which will return true only
     // for real integers, and our double type check is 'typeof number'
     // which will return true for both integers and doubles.
-    if (s == types.coreTypes.intType && t == types.coreTypes.doubleType) {
+    if (s == types.commonElements.intType &&
+        t == types.commonElements.doubleType) {
       return true;
     }
     return types.isSubtype(s, t);
   }
 
-  MapConstantValue createMap(Compiler compiler, InterfaceType sourceType,
-      List<ConstantValue> keys, List<ConstantValue> values) {
+  MapConstantValue createMap(
+      Compiler compiler,
+      ResolutionInterfaceType sourceType,
+      List<ConstantValue> keys,
+      List<ConstantValue> values) {
     JavaScriptBackend backend = compiler.backend;
-    CoreTypes coreTypes = compiler.coreTypes;
+    CommonElements commonElements = compiler.commonElements;
 
     bool onlyStringKeys = true;
     ConstantValue protoValue = null;
@@ -362,26 +382,25 @@
     }
 
     bool hasProtoKey = (protoValue != null);
-    DartType keysType;
+    ResolutionInterfaceType keysType;
     if (sourceType.treatAsRaw) {
-      keysType = coreTypes.listType();
+      keysType = commonElements.listType();
     } else {
-      keysType = coreTypes.listType(sourceType.typeArguments.first);
+      keysType = commonElements.listType(sourceType.typeArguments.first);
     }
     ListConstantValue keysList = new ListConstantValue(keysType, keys);
-    String className = onlyStringKeys
+    ClassElement classElement = onlyStringKeys
         ? (hasProtoKey
-            ? JavaScriptMapConstant.DART_PROTO_CLASS
-            : JavaScriptMapConstant.DART_STRING_CLASS)
-        : JavaScriptMapConstant.DART_GENERAL_CLASS;
-    ClassElement classElement = backend.helpers.jsHelperLibrary.find(className);
+            ? backend.helpers.constantProtoMapClass
+            : backend.helpers.constantStringMapClass)
+        : backend.helpers.generalConstantMapClass;
     classElement.ensureResolved(compiler.resolution);
-    List<DartType> typeArgument = sourceType.typeArguments;
-    InterfaceType type;
+    List<ResolutionDartType> typeArgument = sourceType.typeArguments;
+    ResolutionInterfaceType type;
     if (sourceType.treatAsRaw) {
       type = classElement.rawType;
     } else {
-      type = new InterfaceType(classElement, typeArgument);
+      type = new ResolutionInterfaceType(classElement, typeArgument);
     }
     return new JavaScriptMapConstant(
         type, keysList, values, protoValue, onlyStringKeys);
@@ -392,7 +411,7 @@
     // TODO(johnniwinther): Create a backend agnostic value.
     JavaScriptBackend backend = compiler.backend;
     ClassElement symbolClass = backend.helpers.symbolImplementationClass;
-    InterfaceType type = symbolClass.rawType;
+    ResolutionInterfaceType type = symbolClass.rawType;
     ConstantValue argument = createString(new DartString.literal(text));
     Map<FieldElement, ConstantValue> fields = <FieldElement, ConstantValue>{};
     symbolClass.forEachInstanceField(
@@ -427,7 +446,7 @@
   final ConstantValue protoValue;
   final bool onlyStringKeys;
 
-  JavaScriptMapConstant(InterfaceType type, ListConstantValue keyList,
+  JavaScriptMapConstant(ResolutionInterfaceType type, ListConstantValue keyList,
       List<ConstantValue> values, this.protoValue, this.onlyStringKeys)
       : this.keyList = keyList,
         super(type, keyList.entries, values);
diff --git a/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart b/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
index d87ffa3..3a55345 100644
--- a/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/custom_elements_analysis.dart
@@ -4,7 +4,7 @@
 
 import '../compiler.dart' show Compiler;
 import '../constants/values.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../enqueue.dart' show Enqueuer;
 import '../universe/use.dart' show StaticUse;
@@ -86,7 +86,7 @@
     joinFor(forResolution: forResolution).instantiatedClasses.add(classElement);
   }
 
-  void registerTypeLiteral(DartType type) {
+  void registerTypeLiteral(ResolutionDartType type) {
     if (type.isInterfaceType) {
       // TODO(sra): If we had a flow query from the type literal expression to
       // the Type argument of the metadata lookup, we could tell if this type
@@ -126,7 +126,7 @@
   bool needsClass(ClassElement classElement) =>
       codegenJoin.activeClasses.contains(classElement);
 
-  List<Element> constructors(ClassElement classElement) =>
+  List<ConstructorElement> constructors(ClassElement classElement) =>
       codegenJoin.computeEscapingConstructors(classElement);
 }
 
@@ -189,7 +189,7 @@
   }
 
   TypeConstantValue makeTypeConstant(ClassElement element) {
-    DartType elementType = element.rawType;
+    ResolutionDartType elementType = element.rawType;
     return backend.constantSystem.createType(compiler, elementType);
   }
 
diff --git a/pkg/compiler/lib/src/js_backend/enqueuer.dart b/pkg/compiler/lib/src/js_backend/enqueuer.dart
index c0b028c..603e667 100644
--- a/pkg/compiler/lib/src/js_backend/enqueuer.dart
+++ b/pkg/compiler/lib/src/js_backend/enqueuer.dart
@@ -6,150 +6,115 @@
 
 import 'dart:collection' show Queue;
 
+import '../cache_strategy.dart' show CacheStrategy;
 import '../common/backend_api.dart' show Backend;
 import '../common/codegen.dart' show CodegenWorkItem;
-import '../common/names.dart' show Identifiers;
 import '../common/tasks.dart' show CompilerTask;
 import '../common/work.dart' show WorkItem;
 import '../common.dart';
 import '../compiler.dart' show Compiler;
-import '../dart_types.dart' show DartType, InterfaceType;
-import '../elements/elements.dart'
-    show
-        ClassElement,
-        Element,
-        Elements,
-        Entity,
-        FunctionElement,
-        LibraryElement,
-        Member,
-        MemberElement,
-        MethodElement,
-        Name,
-        TypedElement,
-        TypedefElement;
+import '../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionInterfaceType;
+import '../elements/elements.dart' show Entity, MemberElement, TypedElement;
+import '../elements/entities.dart';
 import '../enqueue.dart';
-import '../js/js.dart' as js;
 import '../native/native.dart' as native;
 import '../options.dart';
 import '../types/types.dart' show TypeMaskStrategy;
-import '../universe/selector.dart' show Selector;
 import '../universe/world_builder.dart';
 import '../universe/use.dart'
     show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind;
 import '../universe/world_impact.dart'
-    show ImpactUseCase, ImpactStrategy, WorldImpact, WorldImpactVisitor;
+    show ImpactUseCase, WorldImpact, WorldImpactVisitor;
+import '../util/enumset.dart';
 import '../util/util.dart' show Setlet;
-import '../world.dart';
 
 /// [Enqueuer] which is specific to code generation.
 class CodegenEnqueuer extends EnqueuerImpl {
   final String name;
-  @deprecated
-  final Compiler _compiler; // TODO(ahe): Remove this dependency.
   final EnqueuerStrategy strategy;
-  final Map<String, Set<Element>> instanceMembersByName =
-      new Map<String, Set<Element>>();
-  final Map<String, Set<Element>> instanceFunctionsByName =
-      new Map<String, Set<Element>>();
-  final Set<ClassElement> _processedClasses = new Set<ClassElement>();
-  Set<ClassElement> recentClasses = new Setlet<ClassElement>();
-  final CodegenWorldBuilderImpl _universe =
-      new CodegenWorldBuilderImpl(const TypeMaskStrategy());
+
+  Set<ClassEntity> _recentClasses = new Setlet<ClassEntity>();
+  final CodegenWorldBuilderImpl _universe;
+  final WorkItemBuilder _workItemBuilder;
 
   bool queueIsClosed = false;
   final CompilerTask task;
   final native.NativeEnqueuer nativeEnqueuer;
+  final Backend _backend;
+  final CompilerOptions _options;
 
-  WorldImpactVisitor impactVisitor;
+  WorldImpactVisitor _impactVisitor;
 
-  CodegenEnqueuer(this.task, Compiler compiler, this.strategy)
-      : queue = new Queue<CodegenWorkItem>(),
-        newlyEnqueuedElements = compiler.cacheStrategy.newSet(),
-        newlySeenSelectors = compiler.cacheStrategy.newSet(),
-        nativeEnqueuer = compiler.backend.nativeCodegenEnqueuer(),
-        this.name = 'codegen enqueuer',
-        this._compiler = compiler {
-    impactVisitor = new EnqueuerImplImpactVisitor(this);
+  final Queue<WorkItem> _queue = new Queue<WorkItem>();
+
+  /// All declaration elements that have been processed by codegen.
+  final Set<Entity> _processedEntities = new Set<Entity>();
+
+  final Set<Entity> newlyEnqueuedElements;
+
+  final Set<DynamicUse> newlySeenSelectors;
+
+  static const ImpactUseCase IMPACT_USE =
+      const ImpactUseCase('CodegenEnqueuer');
+
+  CodegenEnqueuer(this.task, CacheStrategy cacheStrategy, Backend backend,
+      CompilerOptions options, this.strategy)
+      : _universe =
+            new CodegenWorldBuilderImpl(backend, const TypeMaskStrategy()),
+        _workItemBuilder = new CodegenWorkItemBuilder(backend, options),
+        newlyEnqueuedElements = cacheStrategy.newSet(),
+        newlySeenSelectors = cacheStrategy.newSet(),
+        nativeEnqueuer = backend.nativeCodegenEnqueuer(),
+        this._backend = backend,
+        this._options = options,
+        this.name = 'codegen enqueuer' {
+    _impactVisitor = new EnqueuerImplImpactVisitor(this);
   }
 
-  CodegenWorldBuilder get universe => _universe;
+  CodegenWorldBuilder get worldBuilder => _universe;
 
-  Backend get backend => _compiler.backend;
-
-  CompilerOptions get options => _compiler.options;
-
-  ClosedWorld get _world => _compiler.closedWorld;
-
-  bool get queueIsEmpty => queue.isEmpty;
+  bool get queueIsEmpty => _queue.isEmpty;
 
   /// Returns [:true:] if this enqueuer is the resolution enqueuer.
   bool get isResolutionQueue => false;
 
-  DiagnosticReporter get reporter => _compiler.reporter;
+  /// Create a [WorkItem] for [entity] and add it to the work list if it has not
+  /// already been processed.
+  void _addToWorkList(MemberEntity entity) {
+    if (_processedEntities.contains(entity)) return;
 
-  /**
-   * Documentation wanted -- johnniwinther
-   *
-   * Invariant: [element] must be a declaration element.
-   */
-  void addToWorkList(Element element) {
-    assert(invariant(element, element.isDeclaration));
-    // Don't generate code for foreign elements.
-    if (backend.isForeign(element)) return;
+    WorkItem workItem = _workItemBuilder.createWorkItem(entity);
+    if (workItem == null) return;
 
-    // Codegen inlines field initializers. It only needs to generate
-    // code for checked setters.
-    if (element.isField && element.isInstanceMember) {
-      if (!options.enableTypeAssertions || element.enclosingElement.isClosure) {
-        return;
-      }
-    }
-
-    if (options.hasIncrementalSupport && !isProcessed(element)) {
-      newlyEnqueuedElements.add(element);
+    if (_options.hasIncrementalSupport) {
+      newlyEnqueuedElements.add(entity);
     }
 
     if (queueIsClosed) {
       throw new SpannableAssertionFailure(
-          element, "Codegen work list is closed. Trying to add $element");
+          entity, "Codegen work list is closed. Trying to add $entity");
     }
-    queue.add(new CodegenWorkItem(backend, element));
-    // TODO(sigmund): add other missing dependencies (internals, selectors
-    // enqueued after allocations).
-    _compiler.dumpInfoTask
-        .registerDependency(_compiler.currentElement, element);
+
+    applyImpact(_backend.registerUsedElement(entity, forResolution: false));
+    _queue.add(workItem);
   }
 
-  void applyImpact(WorldImpact worldImpact, {Element impactSource}) {
+  void applyImpact(WorldImpact worldImpact, {var impactSource}) {
     if (worldImpact.isEmpty) return;
     impactStrategy.visitImpact(
-        impactSource, worldImpact, impactVisitor, impactUse);
+        impactSource, worldImpact, _impactVisitor, impactUse);
   }
 
-  void registerInstantiatedType(InterfaceType type) {
-    _registerInstantiatedType(type);
-  }
-
-  void _registerInstantiatedType(InterfaceType type,
+  void _registerInstantiatedType(ResolutionInterfaceType type,
       {bool mirrorUsage: false, bool nativeUsage: false}) {
     task.measure(() {
-      ClassElement cls = type.element;
-      bool isNative = backend.isNative(cls);
-      _universe.registerTypeInstantiation(type,
-          isNative: isNative,
-          byMirrors: mirrorUsage, onImplemented: (ClassElement cls) {
-        applyImpact(
-            backend.registerImplementedClass(cls, forResolution: false));
-      });
+      _universe.registerTypeInstantiation(type, _applyClassUse,
+          byMirrors: mirrorUsage);
       if (nativeUsage) {
         nativeEnqueuer.onInstantiatedType(type);
       }
-      backend.registerInstantiatedType(type);
-      // TODO(johnniwinther): Share this reasoning with [Universe].
-      if (!cls.isAbstract || isNative || mirrorUsage) {
-        processInstantiatedClass(cls);
-      }
+      _backend.registerInstantiatedType(type);
     });
   }
 
@@ -157,245 +122,69 @@
     return strategy.checkEnqueuerConsistency(this);
   }
 
-  void processInstantiatedClassMembers(ClassElement cls) {
-    strategy.processInstantiatedClass(this, cls);
+  void checkClass(ClassEntity cls) {
+    _universe.processClassMembers(cls, (MemberEntity member, useSet) {
+      if (useSet.isNotEmpty) {
+        _backend.compiler.reporter.internalError(member,
+            'Unenqueued use of $member: ${useSet.iterable(MemberUse.values)}');
+      }
+    });
   }
 
-  void processInstantiatedClassMember(ClassElement cls, Element member) {
-    assert(invariant(member, member.isDeclaration));
-    if (isProcessed(member)) return;
-    if (!member.isInstanceMember) return;
-    String memberName = member.name;
-
-    if (member.isField) {
-      // The obvious thing to test here would be "member.isNative",
-      // however, that only works after metadata has been parsed/analyzed,
-      // and that may not have happened yet.
-      // So instead we use the enclosing class, which we know have had
-      // its metadata parsed and analyzed.
-      // Note: this assumes that there are no non-native fields on native
-      // classes, which may not be the case when a native class is subclassed.
-      if (backend.isNative(cls)) {
-        if (_universe.hasInvokedGetter(member, _world) ||
-            _universe.hasInvocation(member, _world)) {
-          addToWorkList(member);
-          return;
-        } else if (universe.hasInvokedSetter(member, _world)) {
-          addToWorkList(member);
-          return;
-        }
-        // Native fields need to go into instanceMembersByName as they
-        // are virtual instantiation points and escape points.
-      } else {
-        // All field initializers must be resolved as they could
-        // have an observable side-effect (and cannot be tree-shaken
-        // away).
-        addToWorkList(member);
-        return;
-      }
-    } else if (member.isFunction) {
-      FunctionElement function = member;
-      if (function.name == Identifiers.noSuchMethod_) {
-        registerNoSuchMethod(function);
-      }
-      if (function.name == Identifiers.call && !cls.typeVariables.isEmpty) {
-        registerCallMethodWithFreeTypeVariables(function);
-      }
-      // If there is a property access with the same name as a method we
-      // need to emit the method.
-      if (_universe.hasInvokedGetter(function, _world)) {
-        registerClosurizedMember(function);
-        addToWorkList(function);
-        return;
-      }
-      _registerInstanceMethod(function);
-      if (_universe.hasInvocation(function, _world)) {
-        addToWorkList(function);
-        return;
-      }
-    } else if (member.isGetter) {
-      FunctionElement getter = member;
-      if (_universe.hasInvokedGetter(getter, _world)) {
-        addToWorkList(getter);
-        return;
-      }
-      // We don't know what selectors the returned closure accepts. If
-      // the set contains any selector we have to assume that it matches.
-      if (_universe.hasInvocation(getter, _world)) {
-        addToWorkList(getter);
-        return;
-      }
-    } else if (member.isSetter) {
-      FunctionElement setter = member;
-      if (_universe.hasInvokedSetter(setter, _world)) {
-        addToWorkList(setter);
-        return;
-      }
+  /// Callback for applying the use of a [cls].
+  void _applyClassUse(ClassEntity cls, EnumSet<ClassUse> useSet) {
+    if (useSet.contains(ClassUse.INSTANTIATED)) {
+      _recentClasses.add(cls);
+      _universe.processClassMembers(cls, _applyMemberUse);
+      // We only tell the backend once that [cls] was instantiated, so
+      // any additional dependencies must be treated as global
+      // dependencies.
+      applyImpact(
+          _backend.registerInstantiatedClass(cls, forResolution: false));
     }
-
-    // The element is not yet used. Add it to the list of instance
-    // members to still be processed.
-    instanceMembersByName
-        .putIfAbsent(memberName, () => new Set<Element>())
-        .add(member);
+    if (useSet.contains(ClassUse.IMPLEMENTED)) {
+      applyImpact(_backend.registerImplementedClass(cls, forResolution: false));
+    }
   }
 
-  // Store the member in [instanceFunctionsByName] to catch
-  // getters on the function.
-  void _registerInstanceMethod(MethodElement element) {
-    instanceFunctionsByName
-        .putIfAbsent(element.name, () => new Set<Element>())
-        .add(element);
+  /// Callback for applying the use of a [member].
+  void _applyMemberUse(Entity member, EnumSet<MemberUse> useSet) {
+    if (useSet.contains(MemberUse.NORMAL)) {
+      _addToWorkList(member);
+    }
+    if (useSet.contains(MemberUse.CLOSURIZE_INSTANCE)) {
+      _registerClosurizedMember(member);
+    }
+    if (useSet.contains(MemberUse.CLOSURIZE_STATIC)) {
+      applyImpact(_backend.registerGetOfStaticFunction());
+    }
   }
 
-  void enableIsolateSupport() {}
-
-  void processInstantiatedClass(ClassElement cls) {
+  void processDynamicUse(DynamicUse dynamicUse) {
     task.measure(() {
-      if (_processedClasses.contains(cls)) return;
-
-      void processClass(ClassElement superclass) {
-        if (_processedClasses.contains(superclass)) return;
-        // TODO(johnniwinther): Re-insert this invariant when unittests don't
-        // fail. There is already a similar invariant on the members.
-        /*assert(invariant(superclass,
-              superclass.isClosure ||
-              _compiler.enqueuer.resolution.isClassProcessed(superclass),
-              message: "Class $superclass has not been "
-                       "processed in resolution."));
-        */
-
-        _processedClasses.add(superclass);
-        recentClasses.add(superclass);
-        superclass.implementation.forEachMember(processInstantiatedClassMember);
-        // We only tell the backend once that [superclass] was instantiated, so
-        // any additional dependencies must be treated as global
-        // dependencies.
-        applyImpact(backend.registerInstantiatedClass(superclass,
-            forResolution: false));
-      }
-
-      ClassElement superclass = cls;
-      while (superclass != null) {
-        processClass(superclass);
-        superclass = superclass.superclass;
-      }
-    });
-  }
-
-  void registerDynamicUse(DynamicUse dynamicUse) {
-    task.measure(() {
-      if (_universe.registerDynamicUse(dynamicUse)) {
-        handleUnseenSelector(dynamicUse);
-      }
-    });
-  }
-
-  void processSet(
-      Map<String, Set<Element>> map, String memberName, bool f(Element e)) {
-    Set<Element> members = map[memberName];
-    if (members == null) return;
-    // [f] might add elements to [: map[memberName] :] during the loop below
-    // so we create a new list for [: map[memberName] :] and prepend the
-    // [remaining] members after the loop.
-    map[memberName] = new Set<Element>();
-    Set<Element> remaining = new Set<Element>();
-    for (Element member in members) {
-      if (!f(member)) remaining.add(member);
-    }
-    map[memberName].addAll(remaining);
-  }
-
-  processInstanceMembers(String n, bool f(Element e)) {
-    processSet(instanceMembersByName, n, f);
-  }
-
-  processInstanceFunctions(String n, bool f(Element e)) {
-    processSet(instanceFunctionsByName, n, f);
-  }
-
-  void _handleUnseenSelector(DynamicUse universeSelector) {
-    strategy.processDynamicUse(this, universeSelector);
-  }
-
-  void handleUnseenSelectorInternal(DynamicUse dynamicUse) {
-    Selector selector = dynamicUse.selector;
-    String methodName = selector.name;
-    processInstanceMembers(methodName, (Element member) {
-      if (dynamicUse.appliesUnnamed(member, _world)) {
-        if (member.isFunction && selector.isGetter) {
-          registerClosurizedMember(member);
+      if (_universe.registerDynamicUse(dynamicUse, _applyMemberUse)) {
+        if (_options.hasIncrementalSupport) {
+          newlySeenSelectors.add(dynamicUse);
         }
-        addToWorkList(member);
-        return true;
       }
-      return false;
     });
-    if (selector.isGetter) {
-      processInstanceFunctions(methodName, (Element member) {
-        if (dynamicUse.appliesUnnamed(member, _world)) {
-          registerClosurizedMember(member);
-          return true;
-        }
-        return false;
-      });
-    }
   }
 
-  /**
-   * Documentation wanted -- johnniwinther
-   *
-   * Invariant: [element] must be a declaration element.
-   */
-  void registerStaticUse(StaticUse staticUse) {
-    strategy.processStaticUse(this, staticUse);
-  }
-
-  void registerStaticUseInternal(StaticUse staticUse) {
-    Element element = staticUse.element;
-    assert(invariant(element, element.isDeclaration,
-        message: "Element ${element} is not the declaration."));
-    _universe.registerStaticUse(staticUse);
-    applyImpact(backend.registerStaticUse(element, forResolution: false));
-    bool addElement = true;
+  void processStaticUse(StaticUse staticUse) {
+    _universe.registerStaticUse(staticUse, _applyMemberUse);
     switch (staticUse.kind) {
-      case StaticUseKind.STATIC_TEAR_OFF:
-        applyImpact(backend.registerGetOfStaticFunction());
-        break;
-      case StaticUseKind.FIELD_GET:
-      case StaticUseKind.FIELD_SET:
-      case StaticUseKind.CLOSURE:
-        // TODO(johnniwinther): Avoid this. Currently [FIELD_GET] and
-        // [FIELD_SET] contains [BoxFieldElement]s which we cannot enqueue.
-        // Also [CLOSURE] contains [LocalFunctionElement] which we cannot
-        // enqueue.
-        addElement = false;
-        break;
-      case StaticUseKind.SUPER_FIELD_SET:
-      case StaticUseKind.SUPER_TEAR_OFF:
-      case StaticUseKind.GENERAL:
-      case StaticUseKind.DIRECT_USE:
-        break;
       case StaticUseKind.CONSTRUCTOR_INVOKE:
       case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
       case StaticUseKind.REDIRECTION:
-        registerTypeUseInternal(new TypeUse.instantiation(staticUse.type));
+        processTypeUse(new TypeUse.instantiation(staticUse.type));
         break;
-      case StaticUseKind.DIRECT_INVOKE:
-        _registerInstanceMethod(staticUse.element);
+      default:
         break;
     }
-    if (addElement) {
-      addToWorkList(element);
-    }
   }
 
-  void registerTypeUse(TypeUse typeUse) {
-    strategy.processTypeUse(this, typeUse);
-  }
-
-  void registerTypeUseInternal(TypeUse typeUse) {
-    DartType type = typeUse.type;
+  void processTypeUse(TypeUse typeUse) {
+    ResolutionDartType type = typeUse.type;
     switch (typeUse.kind) {
       case TypeUseKind.INSTANTIATION:
         _registerInstantiatedType(type);
@@ -412,7 +201,7 @@
         _registerIsCheck(type);
         break;
       case TypeUseKind.CHECKED_MODE_CHECK:
-        if (options.enableTypeAssertions) {
+        if (_options.enableTypeAssertions) {
           _registerIsCheck(type);
         }
         break;
@@ -421,125 +210,95 @@
     }
   }
 
-  void _registerIsCheck(DartType type) {
-    type = _universe.registerIsCheck(type, _compiler.resolution);
+  void _registerIsCheck(ResolutionDartType type) {
+    type = _universe.registerIsCheck(type);
     // Even in checked mode, type annotations for return type and argument
     // types do not imply type checks, so there should never be a check
     // against the type variable of a typedef.
     assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef);
   }
 
-  void registerCallMethodWithFreeTypeVariables(Element element) {
-    applyImpact(backend.registerCallMethodWithFreeTypeVariables(element,
-        forResolution: false));
-  }
-
-  void registerClosurizedMember(TypedElement element) {
+  void _registerClosurizedMember(TypedElement element) {
     assert(element.isInstanceMember);
     if (element.type.containsTypeVariables) {
-      applyImpact(backend.registerClosureWithFreeTypeVariables(element,
+      applyImpact(_backend.registerClosureWithFreeTypeVariables(element,
           forResolution: false));
     }
-    applyImpact(backend.registerBoundClosure());
+    applyImpact(_backend.registerBoundClosure());
   }
 
   void forEach(void f(WorkItem work)) {
     do {
-      while (queue.isNotEmpty) {
+      while (_queue.isNotEmpty) {
         // TODO(johnniwinther): Find an optimal process order.
-        WorkItem work = queue.removeLast();
-        if (!isProcessed(work.element)) {
+        WorkItem work = _queue.removeLast();
+        if (!_processedEntities.contains(work.element)) {
           strategy.processWorkItem(f, work);
           // TODO(johnniwinther): Register the processed element here. This
           // is currently a side-effect of calling `work.run`.
+          _processedEntities.add(work.element);
         }
       }
-      List recents = recentClasses.toList(growable: false);
-      recentClasses.clear();
-      if (!onQueueEmpty(recents)) recentClasses.addAll(recents);
-    } while (queue.isNotEmpty || recentClasses.isNotEmpty);
+      List recents = _recentClasses.toList(growable: false);
+      _recentClasses.clear();
+      if (!_onQueueEmpty(recents)) _recentClasses.addAll(recents);
+    } while (_queue.isNotEmpty || _recentClasses.isNotEmpty);
   }
 
-  /// [onQueueEmpty] is called whenever the queue is drained. [recentClasses]
+  /// [_onQueueEmpty] is called whenever the queue is drained. [recentClasses]
   /// contains the set of all classes seen for the first time since
-  /// [onQueueEmpty] was called last. A return value of [true] indicates that
+  /// [_onQueueEmpty] was called last. A return value of [true] indicates that
   /// the [recentClasses] have been processed and may be cleared. If [false] is
-  /// returned, [onQueueEmpty] will be called once the queue is empty again (or
+  /// returned, [_onQueueEmpty] will be called once the queue is empty again (or
   /// still empty) and [recentClasses] will be a superset of the current value.
-  bool onQueueEmpty(Iterable<ClassElement> recentClasses) {
-    return backend.onQueueEmpty(this, recentClasses);
+  bool _onQueueEmpty(Iterable<ClassEntity> recentClasses) {
+    return _backend.onQueueEmpty(this, recentClasses);
   }
 
   void logSummary(log(message)) {
-    _logSpecificSummary(log);
+    log('Compiled ${_processedEntities.length} methods.');
     nativeEnqueuer.logSummary(log);
   }
 
   String toString() => 'Enqueuer($name)';
 
-  void _forgetElement(Element element) {
-    _universe.forgetElement(element, _compiler);
-    _processedClasses.remove(element);
-    instanceMembersByName[element.name]?.remove(element);
-    instanceFunctionsByName[element.name]?.remove(element);
-  }
-
-  final Queue<CodegenWorkItem> queue;
-  final Map<Element, js.Expression> generatedCode = <Element, js.Expression>{};
-
-  final Set<Element> newlyEnqueuedElements;
-
-  final Set<DynamicUse> newlySeenSelectors;
-
-  bool enabledNoSuchMethod = false;
-
-  static const ImpactUseCase IMPACT_USE =
-      const ImpactUseCase('CodegenEnqueuer');
-
   ImpactUseCase get impactUse => IMPACT_USE;
 
-  bool isProcessed(Element member) =>
-      member.isAbstract || generatedCode.containsKey(member);
-
-  void registerNoSuchMethod(Element element) {
-    if (!enabledNoSuchMethod && backend.enabledNoSuchMethod) {
-      applyImpact(backend.enableNoSuchMethod());
-      enabledNoSuchMethod = true;
-    }
-  }
-
-  void _logSpecificSummary(log(message)) {
-    log('Compiled ${generatedCode.length} methods.');
-  }
-
-  void forgetElement(Element element, Compiler compiler) {
-    _forgetElement(element);
-    generatedCode.remove(element);
-    if (element is MemberElement) {
-      for (Element closure in element.nestedClosures) {
-        generatedCode.remove(closure);
-        removeFromSet(instanceMembersByName, closure);
-        removeFromSet(instanceFunctionsByName, closure);
-      }
-    }
-  }
-
-  void handleUnseenSelector(DynamicUse dynamicUse) {
-    if (options.hasIncrementalSupport) {
-      newlySeenSelectors.add(dynamicUse);
-    }
-    _handleUnseenSelector(dynamicUse);
+  void forgetEntity(Entity entity, Compiler compiler) {
+    _universe.forgetElement(entity, compiler);
+    _processedEntities.remove(entity);
   }
 
   @override
-  Iterable<Entity> get processedEntities => generatedCode.keys;
+  Iterable<Entity> get processedEntities => _processedEntities;
 
   @override
-  Iterable<ClassElement> get processedClasses => _processedClasses;
+  Iterable<ClassEntity> get processedClasses => _universe.processedClasses;
 }
 
-void removeFromSet(Map<String, Set<Element>> map, Element element) {
-  Set<Element> set = map[element.name];
-  if (set == null) return;
-  set.remove(element);
+/// Builder that creates the work item necessary for the code generation of a
+/// [MemberElement].
+class CodegenWorkItemBuilder extends WorkItemBuilder {
+  Backend _backend;
+  CompilerOptions _options;
+
+  CodegenWorkItemBuilder(this._backend, this._options);
+
+  @override
+  WorkItem createWorkItem(MemberElement element) {
+    assert(invariant(element, element.isDeclaration));
+    // Don't generate code for foreign elements.
+    if (_backend.isForeign(element)) return null;
+    if (element.isAbstract) return null;
+
+    // Codegen inlines field initializers. It only needs to generate
+    // code for checked setters.
+    if (element.isField && element.isInstanceMember) {
+      if (!_options.enableTypeAssertions ||
+          element.enclosingElement.isClosure) {
+        return null;
+      }
+    }
+    return new CodegenWorkItem(_backend, element);
+  }
 }
diff --git a/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart b/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart
index b5e3c71..d7a3ca9 100644
--- a/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart
+++ b/pkg/compiler/lib/src/js_backend/field_naming_mixin.dart
@@ -24,8 +24,7 @@
       names = new _FieldNamingScope.forBox(element.box, fieldRegistry);
     } else {
       ClassElement cls = element.enclosingClass;
-      names = new _FieldNamingScope.forClass(
-          cls, compiler.closedWorld, fieldRegistry);
+      names = new _FieldNamingScope.forClass(cls, closedWorld, fieldRegistry);
     }
 
     if (names.containsField(element)) {
diff --git a/pkg/compiler/lib/src/js_backend/frequency_namer.dart b/pkg/compiler/lib/src/js_backend/frequency_namer.dart
index 9636e67..49aecfe 100644
--- a/pkg/compiler/lib/src/js_backend/frequency_namer.dart
+++ b/pkg/compiler/lib/src/js_backend/frequency_namer.dart
@@ -25,7 +25,9 @@
   jsAst.Name get staticsPropertyName =>
       _staticsPropertyName ??= getFreshName(instanceScope, 'static');
 
-  FrequencyBasedNamer(Compiler compiler) : super(compiler) {
+  FrequencyBasedNamer(JavaScriptBackend backend, ClosedWorld closedWorld,
+      CodegenWorldBuilder codegenWorldBuilder)
+      : super(backend, closedWorld, codegenWorldBuilder) {
     fieldRegistry = new _FieldNamingRegistry(this);
   }
 
diff --git a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
index 3b75b49..b2ad759 100644
--- a/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/js_interop_analysis.dart
@@ -8,7 +8,8 @@
 import '../common.dart';
 import '../constants/values.dart'
     show ConstantValue, ConstructedConstantValue, StringConstantValue;
-import '../dart_types.dart' show DartType, DynamicType, FunctionType;
+import '../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionDynamicType, ResolutionFunctionType;
 import '../diagnostics/messages.dart' show MessageKind;
 import '../elements/elements.dart'
     show
@@ -116,7 +117,10 @@
 
       // Skip classes that are completely unreachable. This should only happen
       // when all of jsinterop types are unreachable from main.
-      if (!backend.compiler.resolverWorld.isImplemented(classElement)) return;
+      if (!backend.compiler.resolutionWorldBuilder
+          .isImplemented(classElement)) {
+        return;
+      }
 
       if (!classElement.implementsInterface(helpers.jsJavaScriptObjectClass)) {
         backend.reporter.reportErrorMessage(classElement,
@@ -165,7 +169,7 @@
   jsAst.Statement buildJsInteropBootstrap() {
     if (!enabledJsInterop) return null;
     List<jsAst.Statement> statements = <jsAst.Statement>[];
-    backend.compiler.codegenWorld.forEachInvokedName(
+    backend.compiler.codegenWorldBuilder.forEachInvokedName(
         (String name, Map<Selector, SelectorConstraints> selectors) {
       selectors.forEach((Selector selector, SelectorConstraints constraints) {
         if (selector.isClosureCall) {
@@ -187,11 +191,13 @@
     return new jsAst.Block(statements);
   }
 
-  FunctionType buildJsFunctionType() {
-    // TODO(jacobr): consider using codegenWorld.isChecks to determine the
+  ResolutionFunctionType buildJsFunctionType() {
+    // TODO(jacobr): consider using codegenWorldBuilder.isChecks to determine the
     // range of positional arguments that need to be supported by JavaScript
     // function types.
-    return new FunctionType.synthesized(const DynamicType(), [],
-        new List<DartType>.filled(16, const DynamicType()));
+    return new ResolutionFunctionType.synthesized(
+        const ResolutionDynamicType(),
+        [],
+        new List<ResolutionDartType>.filled(16, const ResolutionDynamicType()));
   }
 }
diff --git a/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart b/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart
index 4a51239..eb9aa3c 100644
--- a/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart
@@ -17,8 +17,8 @@
         NullConstantValue,
         StringConstantValue,
         TypeConstantValue;
-import '../dart_types.dart' show DartType;
-import '../dart_types.dart' show InterfaceType;
+import '../elements/resolution_types.dart' show ResolutionDartType;
+import '../elements/resolution_types.dart' show ResolutionInterfaceType;
 import '../elements/elements.dart'
     show ClassElement, FieldElement, LibraryElement, VariableElement;
 import '../universe/use.dart' show StaticUse;
@@ -201,10 +201,13 @@
   }
 
   /// Whether [constant] is an instance of a `LookupMap`.
-  bool isLookupMap(ConstantValue constant) =>
-      _isEnabled &&
-      constant is ConstructedConstantValue &&
-      constant.type.asRaw().element.isSubclassOf(typeLookupMapClass);
+  bool isLookupMap(ConstantValue constant) {
+    if (_isEnabled && constant is ConstructedConstantValue) {
+      ResolutionInterfaceType type = constant.type;
+      return type.element.isSubclassOf(typeLookupMapClass);
+    }
+    return false;
+  }
 
   /// Registers an instance of a lookup-map with the analysis.
   void registerLookupMapReference(ConstantValue lookupMap) {
@@ -246,13 +249,12 @@
 
   /// If [key] is a type, cache it in [_typeConstants].
   _registerTypeKey(ConstantValue key) {
-    if (key is TypeConstantValue) {
-      ClassElement cls = key.representedType.element;
-      if (cls == null || !cls.isClass) {
-        // TODO(sigmund): report error?
-        return;
-      }
-      _typeConstants[cls] = key;
+    if (key is TypeConstantValue &&
+        key.representedType is ResolutionInterfaceType) {
+      ResolutionInterfaceType type = key.representedType;
+      _typeConstants[type.element] = key;
+    } else {
+      // TODO(sigmund): report error?
     }
   }
 
@@ -264,7 +266,7 @@
   }
 
   /// Callback from the enqueuer, invoked when [type] is instantiated.
-  void registerInstantiatedType(InterfaceType type) {
+  void registerInstantiatedType(ResolutionInterfaceType type) {
     if (!_isEnabled || !_inCodegen) return;
     // TODO(sigmund): only add if .runtimeType is ever used
     _addClassUse(type.element);
@@ -274,10 +276,10 @@
 
   /// Records generic type arguments in [type], in case they are retrieved and
   /// returned using a type-argument expression.
-  void _addGenerics(InterfaceType type) {
+  void _addGenerics(ResolutionInterfaceType type) {
     if (!type.isGeneric) return;
     for (var arg in type.typeArguments) {
-      if (arg is InterfaceType) {
+      if (arg is ResolutionInterfaceType) {
         _addClassUse(arg.element);
         // Note: this call was needed to generate correct code for
         // type_lookup_map/generic_type_test
@@ -431,7 +433,7 @@
   /// Restores [original] to contain all of the entries marked as possibly used.
   void _prepareForEmission() {
     ListConstantValue originalEntries = original.fields[analysis.entriesField];
-    DartType listType = originalEntries.type;
+    ResolutionInterfaceType listType = originalEntries.type;
     List<ConstantValue> keyValuePairs = <ConstantValue>[];
     usedEntries.forEach((key, value) {
       keyValuePairs.add(key);
diff --git a/pkg/compiler/lib/src/js_backend/minify_namer.dart b/pkg/compiler/lib/src/js_backend/minify_namer.dart
index 3e689d4..f0fdcb8 100644
--- a/pkg/compiler/lib/src/js_backend/minify_namer.dart
+++ b/pkg/compiler/lib/src/js_backend/minify_namer.dart
@@ -12,7 +12,9 @@
         _MinifiedFieldNamer,
         _MinifyConstructorBodyNamer,
         _MinifiedOneShotInterceptorNamer {
-  MinifyNamer(Compiler compiler) : super(compiler) {
+  MinifyNamer(JavaScriptBackend backend, ClosedWorld closedWorld,
+      CodegenWorldBuilder codegenWorldBuilder)
+      : super(backend, closedWorld, codegenWorldBuilder) {
     reserveBackendNames();
     fieldRegistry = new _FieldNamingRegistry(this);
   }
diff --git a/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart b/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart
index c66c8f1..e7be92d 100644
--- a/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/mirrors_analysis.dart
@@ -8,6 +8,7 @@
 import '../common/resolution.dart';
 import '../diagnostics/diagnostic_listener.dart';
 import '../elements/elements.dart';
+import '../elements/entities.dart';
 import '../universe/selector.dart';
 import '../universe/use.dart';
 import '../universe/world_impact.dart';
@@ -24,8 +25,8 @@
   /// Compute the impact for elements that are matched by the mirrors used
   /// annotation or, in lack thereof, all elements.
   WorldImpact computeImpactForReflectiveElements(
-      Iterable<ClassElement> recents,
-      Iterable<ClassElement> processedClasses,
+      Iterable<ClassEntity> recents,
+      Iterable<ClassEntity> processedClasses,
       Iterable<LibraryElement> loadedLibraries,
       {bool forResolution}) {
     MirrorsHandler handler = forResolution ? resolutionHandler : codegenHandler;
@@ -81,7 +82,7 @@
     return includedEnclosing || _backend.requiredByMirrorSystem(element);
   }
 
-  /// Enqeue the constructor [ctor] if it is required for reflection.
+  /// Enqueue the constructor [ctor] if it is required for reflection.
   ///
   /// [enclosingWasIncluded] provides a hint whether the enclosing element was
   /// needed for reflection.
@@ -98,7 +99,7 @@
     }
   }
 
-  /// Enqeue the member [element] if it is required for reflection.
+  /// Enqueue the member [element] if it is required for reflection.
   ///
   /// [enclosingWasIncluded] provides a hint whether the enclosing element was
   /// needed for reflection.
@@ -130,12 +131,12 @@
     }
   }
 
-  /// Enqeue the member [element] if it is required for reflection.
+  /// Enqueue the member [element] if it is required for reflection.
   ///
   /// [enclosingWasIncluded] provides a hint whether the enclosing element was
   /// needed for reflection.
   void _enqueueReflectiveElementsInClass(
-      ClassElement cls, Iterable<ClassElement> recents,
+      ClassElement cls, Iterable<ClassEntity> recents,
       {bool enclosingWasIncluded}) {
     if (cls.library.isInternalLibrary || cls.isInjected) return;
     bool includeClass = _shouldIncludeElementDueToMirrors(cls,
@@ -162,7 +163,7 @@
     }
   }
 
-  /// Enqeue special classes that might not be visible by normal means or that
+  /// Enqueue special classes that might not be visible by normal means or that
   /// would not normally be enqueued:
   ///
   /// [Closure] is treated specially as it is the superclass of all closures.
@@ -181,10 +182,10 @@
     }
   }
 
-  /// Enqeue all local members of the library [lib] if they are required for
+  /// Enqueue all local members of the library [lib] if they are required for
   /// reflection.
   void _enqueueReflectiveElementsInLibrary(
-      LibraryElement lib, Iterable<ClassElement> recents) {
+      LibraryElement lib, Iterable<ClassEntity> recents) {
     bool includeLibrary =
         _shouldIncludeElementDueToMirrors(lib, includedEnclosing: false);
     lib.forEachLocalMember((Element member) {
@@ -207,8 +208,8 @@
   /// annotation or, in lack thereof, all elements.
   // TODO(johnniwinther): Compute [WorldImpact] instead of enqueuing directly.
   void enqueueReflectiveElements(
-      Iterable<ClassElement> recents,
-      Iterable<ClassElement> processedClasses,
+      Iterable<ClassEntity> recents,
+      Iterable<ClassEntity> processedClasses,
       Iterable<LibraryElement> loadedLibraries) {
     if (!hasEnqueuedReflectiveElements) {
       _logEnqueueReflectiveAction("!START enqueueAll");
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index e0511a3..ffb7800 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -13,8 +13,8 @@
 import '../common/names.dart' show Identifiers, Selectors;
 import '../compiler.dart' show Compiler;
 import '../constants/values.dart';
-import '../core_types.dart' show CoreClasses;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart';
 import '../diagnostics/invariant.dart' show DEBUG_MODE;
 import '../elements/elements.dart';
 import '../elements/entities.dart';
@@ -23,6 +23,7 @@
 import '../tree/tree.dart';
 import '../universe/call_structure.dart' show CallStructure;
 import '../universe/selector.dart' show Selector, SelectorKind;
+import '../universe/world_builder.dart' show CodegenWorldBuilder;
 import '../util/characters.dart';
 import '../util/util.dart';
 import '../world.dart' show ClosedWorld;
@@ -134,18 +135,106 @@
  */
 class Namer {
   static const List<String> javaScriptKeywords = const <String>[
-    // These are current keywords.
-    "break", "delete", "function", "return", "typeof", "case", "do", "if",
-    "switch", "var", "catch", "else", "in", "this", "void", "continue",
-    "false", "instanceof", "throw", "while", "debugger", "finally", "new",
-    "true", "with", "default", "for", "null", "try",
+    // ES5 7.6.1.1 Keywords.
+    'break',
+    'do',
+    'instanceof',
+    'typeof',
+    'case',
+    'else',
+    'new',
+    'var',
+    'catch',
+    'finally',
+    'return',
+    'void',
+    'continue',
+    'for',
+    'switch',
+    'while',
+    'debugger',
+    'function',
+    'this',
+    'with',
+    'default',
+    'if',
+    'throw',
+    'delete',
+    'in',
+    'try',
 
-    // These are future keywords.
-    "abstract", "double", "goto", "native", "static", "boolean", "enum",
-    "implements", "package", "super", "byte", "export", "import", "private",
-    "synchronized", "char", "extends", "int", "protected", "throws",
-    "class", "final", "interface", "public", "transient", "const", "float",
-    "long", "short", "volatile"
+    // ES5 7.6.1.2 Future Reserved Words.
+    'class',
+    'enum',
+    'extends',
+    'super',
+    'const',
+    'export',
+    'import',
+
+    // ES5 7.6.1.2 Words with semantic restrictions.
+    'implements',
+    'let',
+    'private',
+    'public',
+    'yield',
+    'interface',
+    'package',
+    'protected',
+    'static',
+
+    // ES6 11.6.2.1 Keywords (including repeats of ES5 to ease comparison with
+    // documents).
+    'break',
+    'do',
+    'in',
+    'typeof',
+    'case',
+    'else',
+    'instanceof',
+    'var',
+    'catch',
+    'export',
+    'new',
+    'void',
+    'class',
+    'extends',
+    'return',
+    'while',
+    'const',
+    'finally',
+    'super',
+    'with',
+    'continue',
+    'for',
+    'switch',
+    'yield',
+    'debugger',
+    'function',
+    'this',
+    'default',
+    'if',
+    'throw',
+    'delete',
+    'import',
+    'try',
+
+    // ES6 11.6.2.1 Words with semantic restrictions.
+    'yield', 'let', 'static',
+
+    // ES6 11.6.2.2 Future Reserved Words.
+    'enum',
+    'await',
+
+    // ES6 11.6.2.2 / ES6 12.1.1 Words with semantic restrictions.
+    'implements',
+    'package',
+    'protected',
+    'interface',
+    'private',
+    'public',
+
+    // Other words to avoid due to non-standard keyword-like behavior.
   ];
 
   static const List<String> reservedPropertySymbols = const <String>[
@@ -236,12 +325,6 @@
     // https://developer.mozilla.org/en/New_in_JavaScript_1.8.1
     "getPrototypeOf", "let", "yield",
 
-    // "future reserved words"
-    "abstract", "int", "short", "boolean", "interface", "static", "byte",
-    "long", "char", "final", "native", "synchronized", "float", "package",
-    "throws", "goto", "private", "transient", "implements", "protected",
-    "volatile", "double", "public",
-
     // IE methods
     // (http://msdn.microsoft.com/en-us/library/ms535873(VS.85).aspx#)
     "attachEvent", "clientInformation", "clipboardData", "createPopup",
@@ -277,7 +360,7 @@
     "JavaArray", "JavaMember",
 
     // ES6 collections.
-    "Map",
+    "Map", "Set",
   ];
 
   static const List<String> reservedGlobalObjectNames = const <String>[
@@ -402,7 +485,9 @@
   static final RegExp IDENTIFIER = new RegExp(r'^[A-Za-z_$][A-Za-z0-9_$]*$');
   static final RegExp NON_IDENTIFIER_CHAR = new RegExp(r'[^A-Za-z_0-9$]');
 
-  final Compiler compiler;
+  final JavaScriptBackend backend;
+  final ClosedWorld closedWorld;
+  final CodegenWorldBuilder codegenWorldBuilder;
 
   /// Used disambiguated names in the global namespace, issued by
   /// [_disambiguateGlobal], and [_disambiguateInternalGlobal].
@@ -459,23 +544,24 @@
   final Map<LibraryElement, String> _libraryKeys =
       new HashMap<LibraryElement, String>();
 
-  Namer(Compiler compiler)
-      : compiler = compiler,
-        constantHasher = new ConstantCanonicalHasher(compiler),
-        functionTypeNamer = new FunctionTypeNamer(compiler) {
+  Namer(JavaScriptBackend backend, this.closedWorld,
+      CodegenWorldBuilder codegenWorldBuilder)
+      : this.backend = backend,
+        this.codegenWorldBuilder = codegenWorldBuilder,
+        constantHasher = new ConstantCanonicalHasher(
+            backend.rtiEncoder, backend.reporter, codegenWorldBuilder),
+        functionTypeNamer = new FunctionTypeNamer(backend.rtiEncoder) {
     _literalAsyncPrefix = new StringBackedName(asyncPrefix);
     _literalGetterPrefix = new StringBackedName(getterPrefix);
     _literalSetterPrefix = new StringBackedName(setterPrefix);
     _literalLazyGetterPrefix = new StringBackedName(lazyGetterPrefix);
   }
 
-  JavaScriptBackend get backend => compiler.backend;
-
   BackendHelpers get helpers => backend.helpers;
 
-  DiagnosticReporter get reporter => compiler.reporter;
+  DiagnosticReporter get reporter => backend.reporter;
 
-  CoreClasses get coreClasses => compiler.coreClasses;
+  CommonElements get commonElements => closedWorld.commonElements;
 
   String get deferredTypesName => 'deferredTypes';
   String get isolateName => 'Isolate';
@@ -550,11 +636,14 @@
       case JsGetName.IS_INDEXABLE_FIELD_NAME:
         return operatorIs(helpers.jsIndexingBehaviorInterface);
       case JsGetName.NULL_CLASS_TYPE_NAME:
-        return runtimeTypeName(coreClasses.nullClass);
+        ClassElement nullClass = commonElements.nullClass;
+        return runtimeTypeName(nullClass);
       case JsGetName.OBJECT_CLASS_TYPE_NAME:
-        return runtimeTypeName(coreClasses.objectClass);
+        ClassElement objectClass = commonElements.objectClass;
+        return runtimeTypeName(objectClass);
       case JsGetName.FUNCTION_CLASS_TYPE_NAME:
-        return runtimeTypeName(coreClasses.functionClass);
+        ClassElement functionClass = commonElements.functionClass;
+        return runtimeTypeName(functionClass);
       default:
         reporter.reportErrorMessage(node, MessageKind.GENERIC,
             {'text': 'Error: Namer has no name for "$name".'});
@@ -591,8 +680,9 @@
   String constantLongName(ConstantValue constant) {
     String longName = constantLongNames[constant];
     if (longName == null) {
-      longName =
-          new ConstantNamingVisitor(compiler, constantHasher).getName(constant);
+      longName = new ConstantNamingVisitor(
+              backend.rtiEncoder, reporter, codegenWorldBuilder, constantHasher)
+          .getName(constant);
       constantLongNames[constant] = longName;
     }
     return longName;
@@ -689,10 +779,14 @@
   /// For example: fixedBackendPath for the static method createMap in the
   /// Map class of the goog.map JavaScript library would have path
   /// "goog.maps.Map".
-  String fixedBackendPath(Element element) {
+  String fixedBackendMethodPath(MethodElement element) {
+    return _fixedBackendPath(element);
+  }
+
+  String _fixedBackendPath(Element element) {
     if (!backend.isJsInterop(element)) return null;
     if (element.isInstanceMember) return 'this';
-    if (element.isConstructor) return fixedBackendPath(element.enclosingClass);
+    if (element.isConstructor) return _fixedBackendPath(element.enclosingClass);
     if (element.isLibrary) return 'self';
     var sb = new StringBuffer();
     sb..write(_jsNameHelper(element.library));
@@ -854,7 +948,6 @@
     // mangle the field names of classes extending native classes.
     // Methods on such classes are stored on the interceptor, not the instance,
     // so only fields have the potential to clash with a native property name.
-    ClosedWorld closedWorld = compiler.closedWorld;
     if (closedWorld.isUsedAsMixin(enclosingClass) ||
         _isShadowingSuperField(element) ||
         _isUserClassExtendingNative(enclosingClass)) {
@@ -1253,7 +1346,7 @@
 
   String suffixForGetInterceptor(Iterable<ClassEntity> classes) {
     String abbreviate(ClassElement cls) {
-      if (cls == coreClasses.objectClass) return "o";
+      if (cls == commonElements.objectClass) return "o";
       if (cls == helpers.jsStringClass) return "s";
       if (cls == helpers.jsArrayClass) return "a";
       if (cls == helpers.jsDoubleClass) return "d";
@@ -1369,7 +1462,7 @@
   ///         this.super$A$foo(); // super.foo()
   ///     }
   ///
-  jsAst.Name aliasedSuperMemberPropertyName(Element member) {
+  jsAst.Name aliasedSuperMemberPropertyName(MemberElement member) {
     assert(!member.isField); // Fields do not need super aliases.
     return _disambiguateInternalMember(member, () {
       String invocationName = operatorNameToIdentifier(member.name);
@@ -1411,9 +1504,19 @@
   }
 
   /// Returns [staticStateHolder] or one of [reservedGlobalObjectNames].
+  // TODO(johnniwinther): Verify that the implementation can be changed to
+  // `globalObjectForLibrary(element.library)`.
+  String globalObjectForMethod(MethodElement element) =>
+      globalObjectFor(element);
+
+  /// Returns [staticStateHolder] or one of [reservedGlobalObjectNames].
   String globalObjectFor(Element element) {
     if (_isPropertyOfStaticStateHolder(element)) return staticStateHolder;
-    LibraryElement library = element.library;
+    return globalObjectForLibrary(element.library);
+  }
+
+  /// Returns the [reservedGlobalObjectNames] for [library].
+  String globalObjectForLibrary(LibraryElement library) {
     if (library == helpers.interceptorsLibrary) return 'J';
     if (library.isInternalLibrary) return 'H';
     if (library.isPlatformLibrary) {
@@ -1475,18 +1578,18 @@
 
   String get functionTypeNamedParametersTag => r'named';
 
-  Map<FunctionType, jsAst.Name> functionTypeNameMap =
-      new HashMap<FunctionType, jsAst.Name>();
+  Map<ResolutionFunctionType, jsAst.Name> functionTypeNameMap =
+      new HashMap<ResolutionFunctionType, jsAst.Name>();
   final FunctionTypeNamer functionTypeNamer;
 
-  jsAst.Name getFunctionTypeName(FunctionType functionType) {
+  jsAst.Name getFunctionTypeName(ResolutionFunctionType functionType) {
     return functionTypeNameMap.putIfAbsent(functionType, () {
       String proposedName = functionTypeNamer.computeName(functionType);
       return getFreshName(instanceScope, proposedName);
     });
   }
 
-  jsAst.Name operatorIsType(DartType type) {
+  jsAst.Name operatorIsType(ResolutionDartType type) {
     if (type.isFunctionType) {
       // TODO(erikcorry): Reduce from $isx to ix when we are minifying.
       return new CompoundName([
@@ -1643,7 +1746,9 @@
   static const MAX_EXTRA_LENGTH = 30;
   static const DEFAULT_TAG_LENGTH = 3;
 
-  final Compiler compiler;
+  final RuntimeTypesEncoder rtiEncoder;
+  final DiagnosticReporter reporter;
+  final CodegenWorldBuilder codegenWorldBuilder;
   final ConstantCanonicalHasher hasher;
 
   String root = null; // First word, usually a type name.
@@ -1651,9 +1756,8 @@
   List<String> fragments = <String>[];
   int length = 0;
 
-  ConstantNamingVisitor(this.compiler, this.hasher);
-
-  DiagnosticReporter get reporter => compiler.reporter;
+  ConstantNamingVisitor(
+      this.rtiEncoder, this.reporter, this.codegenWorldBuilder, this.hasher);
 
   String getName(ConstantValue constant) {
     _visit(constant);
@@ -1782,10 +1886,12 @@
   @override
   void visitConstructed(ConstructedConstantValue constant, [_]) {
     addRoot(constant.type.element.name);
-    constant.type.element.forEachInstanceField((_, FieldElement field) {
+    // TODO(johnniwinther): This should be accessed from a codegen closed world.
+    codegenWorldBuilder.forEachInstanceField(constant.type.element,
+        (_, FieldElement field) {
       if (failed) return;
       _visit(constant.fields[field]);
-    }, includeSuperAndInjectedMembers: true);
+    });
   }
 
   @override
@@ -1793,12 +1899,11 @@
     // Generates something like 'Type_String_k8F', using the simple name of the
     // type and a hash to disambiguate the same name in different libraries.
     addRoot('Type');
-    DartType type = constant.representedType;
+    ResolutionDartType type = constant.representedType;
     String name = type.element?.name;
     if (name == null) {
       // e.g. DartType 'dynamic' has no element.
-      JavaScriptBackend backend = compiler.backend;
-      name = backend.rtiEncoder.getTypeRepresentationForTypeConstant(type);
+      name = rtiEncoder.getTypeRepresentationForTypeConstant(type);
     }
     addIdentifier(name);
     add(getHashTag(constant, 3));
@@ -1806,7 +1911,7 @@
 
   @override
   void visitInterceptor(InterceptorConstantValue constant, [_]) {
-    addRoot(constant.dispatchedType.element.name);
+    addRoot(constant.cls.name);
     add('methods');
   }
 
@@ -1846,12 +1951,13 @@
   static const _MASK = 0x1fffffff;
   static const _UINT32_LIMIT = 4 * 1024 * 1024 * 1024;
 
-  final Compiler compiler;
+  final DiagnosticReporter reporter;
+  final RuntimeTypesEncoder rtiEncoder;
+  final CodegenWorldBuilder codegenWorldBuilder;
   final Map<ConstantValue, int> hashes = new Map<ConstantValue, int>();
 
-  ConstantCanonicalHasher(this.compiler);
-
-  DiagnosticReporter get reporter => compiler.reporter;
+  ConstantCanonicalHasher(
+      this.rtiEncoder, this.reporter, this.codegenWorldBuilder);
 
   int getHash(ConstantValue constant) => _visit(constant);
 
@@ -1909,24 +2015,24 @@
   @override
   int visitConstructed(ConstructedConstantValue constant, [_]) {
     int hash = _hashString(3, constant.type.element.name);
-    constant.type.element.forEachInstanceField((_, FieldElement field) {
+    codegenWorldBuilder.forEachInstanceField(constant.type.element,
+        (_, FieldElement field) {
       hash = _combine(hash, _visit(constant.fields[field]));
-    }, includeSuperAndInjectedMembers: true);
+    });
     return hash;
   }
 
   @override
   int visitType(TypeConstantValue constant, [_]) {
-    DartType type = constant.representedType;
-    JavaScriptBackend backend = compiler.backend;
+    ResolutionDartType type = constant.representedType;
     // This name includes the library name and type parameters.
-    String name = backend.rtiEncoder.getTypeRepresentationForTypeConstant(type);
+    String name = rtiEncoder.getTypeRepresentationForTypeConstant(type);
     return _hashString(4, name);
   }
 
   @override
   int visitInterceptor(InterceptorConstantValue constant, [_]) {
-    String typeName = constant.dispatchedType.element.name;
+    String typeName = constant.cls.name;
     return _hashString(5, typeName);
   }
 
@@ -2027,40 +2133,38 @@
 }
 
 class FunctionTypeNamer extends BaseDartTypeVisitor {
-  final Compiler compiler;
+  final RuntimeTypesEncoder rtiEncoder;
   StringBuffer sb;
 
-  FunctionTypeNamer(this.compiler);
+  FunctionTypeNamer(this.rtiEncoder);
 
-  JavaScriptBackend get backend => compiler.backend;
-
-  String computeName(DartType type) {
+  String computeName(ResolutionDartType type) {
     sb = new StringBuffer();
     visit(type);
     return sb.toString();
   }
 
-  visit(DartType type, [_]) {
+  visit(ResolutionDartType type, [_]) {
     type.accept(this, null);
   }
 
-  visitType(DartType type, _) {
+  visitType(ResolutionDartType type, _) {
     sb.write(type.name);
   }
 
-  visitFunctionType(FunctionType type, _) {
-    if (backend.rtiEncoder.isSimpleFunctionType(type)) {
+  visitFunctionType(ResolutionFunctionType type, _) {
+    if (rtiEncoder.isSimpleFunctionType(type)) {
       sb.write('args${type.parameterTypes.length}');
       return;
     }
     visit(type.returnType);
     sb.write('_');
-    for (DartType parameter in type.parameterTypes) {
+    for (ResolutionDartType parameter in type.parameterTypes) {
       sb.write('_');
       visit(parameter);
     }
     bool first = false;
-    for (DartType parameter in type.optionalParameterTypes) {
+    for (ResolutionDartType parameter in type.optionalParameterTypes) {
       if (!first) {
         sb.write('_');
       }
@@ -2070,7 +2174,7 @@
     }
     if (!type.namedParameterTypes.isEmpty) {
       first = false;
-      for (DartType parameter in type.namedParameterTypes) {
+      for (ResolutionDartType parameter in type.namedParameterTypes) {
         if (!first) {
           sb.write('_');
         }
diff --git a/pkg/compiler/lib/src/js_backend/native_data.dart b/pkg/compiler/lib/src/js_backend/native_data.dart
index 31fe7d6..e30010d 100644
--- a/pkg/compiler/lib/src/js_backend/native_data.dart
+++ b/pkg/compiler/lib/src/js_backend/native_data.dart
@@ -6,7 +6,13 @@
 
 import '../common.dart';
 import '../elements/elements.dart'
-    show ClassElement, Element, FieldElement, FunctionElement, MemberElement;
+    show
+        ClassElement,
+        Element,
+        Entity,
+        FieldElement,
+        FunctionElement,
+        MemberElement;
 import '../native/behavior.dart' show NativeBehavior;
 
 /// Additional element information for native classes and methods and js-interop
@@ -102,7 +108,10 @@
 
   /// Computes the name for [element] to use in the generated JavaScript. This
   /// is either given through a native annotation or a js interop annotation.
-  String getFixedBackendName(Element element) {
+  String getFixedBackendName(Entity entity) {
+    // TODO(johnniwinther): Remove this assignment from [Entity] to [Element]
+    // when `.declaration` is no longer needed.
+    Element element = entity;
     String name = nativeMemberName[element.declaration];
     if (name == null && isJsInterop(element)) {
       // If an element isJsInterop but _isJsInterop is false that means it is
diff --git a/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart b/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
index 9956a18..00b9ac7 100644
--- a/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
+++ b/pkg/compiler/lib/src/js_backend/no_such_method_registry.dart
@@ -187,7 +187,7 @@
 
   bool isDefaultNoSuchMethodImplementation(FunctionElement element) {
     ClassElement classElement = element.enclosingClass;
-    return classElement == _compiler.coreClasses.objectClass ||
+    return classElement == _compiler.commonElements.objectClass ||
         classElement == _backend.helpers.jsInterceptorClass ||
         classElement == _backend.helpers.jsNullClass;
   }
@@ -267,4 +267,9 @@
   }
 }
 
-enum NsmCategory { DEFAULT, THROWING, NOT_APPLICABLE, OTHER, }
+enum NsmCategory {
+  DEFAULT,
+  THROWING,
+  NOT_APPLICABLE,
+  OTHER,
+}
diff --git a/pkg/compiler/lib/src/js_backend/patch_resolver.dart b/pkg/compiler/lib/src/js_backend/patch_resolver.dart
index 17a4a4e..f7477fe 100644
--- a/pkg/compiler/lib/src/js_backend/patch_resolver.dart
+++ b/pkg/compiler/lib/src/js_backend/patch_resolver.dart
@@ -8,7 +8,7 @@
 import '../common/resolution.dart' show Resolution;
 import '../common/tasks.dart' show CompilerTask;
 import '../compiler.dart' show Compiler;
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart';
 import '../tree/tree.dart';
@@ -54,8 +54,10 @@
         assert(invariant(origin, originParameter.patch == patchParameter,
             message: "Inconsistent repatch of $originParameter."));
       }
-      DartType originParameterType = originParameter.computeType(resolution);
-      DartType patchParameterType = patchParameter.computeType(resolution);
+      ResolutionDartType originParameterType =
+          originParameter.computeType(resolution);
+      ResolutionDartType patchParameterType =
+          patchParameter.computeType(resolution);
       if (originParameterType != patchParameterType) {
         reporter.reportError(
             reporter.createMessage(
@@ -84,7 +86,7 @@
             // We special case the list constructor because of the
             // optional parameter.
             &&
-            origin != compiler.unnamedListConstructor) {
+            origin != compiler.commonElements.unnamedListConstructor) {
           reporter.reportError(
               reporter.createMessage(
                   originParameter, MessageKind.PATCH_PARAMETER_MISMATCH, {
@@ -106,10 +108,24 @@
   void checkMatchingPatchSignatures(
       FunctionElement origin, FunctionElement patch) {
     // TODO(johnniwinther): Show both origin and patch locations on errors.
+    FunctionExpression originTree = origin.node;
     FunctionSignature originSignature = origin.functionSignature;
     FunctionExpression patchTree = patch.node;
     FunctionSignature patchSignature = patch.functionSignature;
 
+    if ('${originTree.typeVariables}' != '${patchTree.typeVariables}') {
+      reporter.withCurrentElement(patch, () {
+        Node errorNode = patchTree.typeVariables != null
+            ? patchTree.typeVariables
+            : patchTree;
+        reporter.reportError(
+            reporter.createMessage(
+                errorNode,
+                MessageKind.PATCH_TYPE_VARIABLES_MISMATCH,
+                {'methodName': origin.name}),
+            [reporter.createMessage(origin, MessageKind.THIS_IS_THE_METHOD)]);
+      });
+    }
     if (originSignature.type.returnType != patchSignature.type.returnType) {
       reporter.withCurrentElement(patch, () {
         Node errorNode =
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 23740b3..dfa0813 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -13,8 +13,9 @@
   Iterable<ClassElement> get classes;
 }
 
-typedef jsAst.Expression OnVariableCallback(TypeVariableType variable);
-typedef bool ShouldEncodeTypedefCallback(TypedefType variable);
+typedef jsAst.Expression OnVariableCallback(
+    ResolutionTypeVariableType variable);
+typedef bool ShouldEncodeTypedefCallback(ResolutionTypedefType variable);
 
 // TODO(johnniwinther): Rename to something like [RuntimeTypeUsageCollector]
 // we semantics is more clear.
@@ -30,11 +31,12 @@
   void registerClassUsingTypeVariableExpression(ClassElement cls);
   void registerRtiDependency(Element element, Element dependency);
   void registerTypeVariableBoundsSubtypeCheck(
-      DartType typeArgument, DartType bound);
+      ResolutionDartType typeArgument, ResolutionDartType bound);
 
   Set<ClassElement> getClassesUsedInSubstitutions(
       JavaScriptBackend backend, TypeChecks checks);
-  void computeClassesNeedingRti();
+  void computeClassesNeedingRti(
+      ResolutionWorldBuilder resolutionWorldBuilder, ClosedWorld closedWorld);
 
   /// Compute the required type checkes and substitutions for the given
   /// instantitated and checked classes.
@@ -46,11 +48,11 @@
   ///
   /// This function must be called after all is-checks have been registered.
   void addImplicitChecks(
-      WorldBuilder universe, Iterable<ClassElement> classesUsingChecks);
+      WorldBuilder worldBuilder, Iterable<ClassElement> classesUsingChecks);
 
   /// Return all classes that are referenced in the type of the function, i.e.,
   /// in the return type or the argument types.
-  Set<ClassElement> getReferencedClasses(FunctionType type);
+  Set<ClassElement> getReferencedClasses(ResolutionFunctionType type);
 
   /// Return all classes that are uses a type arguments.
   Set<ClassElement> getRequiredArgumentClasses(JavaScriptBackend backend);
@@ -59,9 +61,9 @@
 
   Substitution getSubstitution(ClassElement cls, ClassElement other);
 
-  static bool hasTypeArguments(DartType type) {
-    if (type is InterfaceType) {
-      InterfaceType interfaceType = type;
+  static bool hasTypeArguments(ResolutionDartType type) {
+    if (type is ResolutionInterfaceType) {
+      ResolutionInterfaceType interfaceType = type;
       return !interfaceType.treatAsRaw;
     }
     return false;
@@ -69,12 +71,13 @@
 }
 
 abstract class RuntimeTypesEncoder {
-  bool isSimpleFunctionType(FunctionType type);
+  bool isSimpleFunctionType(ResolutionFunctionType type);
 
-  jsAst.Expression getSignatureEncoding(DartType type, jsAst.Expression this_);
+  jsAst.Expression getSignatureEncoding(
+      ResolutionDartType type, jsAst.Expression this_);
 
   jsAst.Expression getSubstitutionRepresentation(
-      List<DartType> types, OnVariableCallback onVariable);
+      List<ResolutionDartType> types, OnVariableCallback onVariable);
   jsAst.Expression getSubstitutionCode(Substitution substitution);
   jsAst.Expression getSubstitutionCodeForVariable(
       Substitution substitution, int index);
@@ -91,10 +94,10 @@
   /// Returns a [jsAst.Expression] representing the given [type]. Type variables
   /// are replaced by the [jsAst.Expression] returned by [onVariable].
   jsAst.Expression getTypeRepresentation(
-      DartType type, OnVariableCallback onVariable,
+      ResolutionDartType type, OnVariableCallback onVariable,
       [ShouldEncodeTypedefCallback shouldEncodeTypedef]);
 
-  String getTypeRepresentationForTypeConstant(DartType type);
+  String getTypeRepresentationForTypeConstant(ResolutionDartType type);
 }
 
 class _RuntimeTypes implements RuntimeTypes {
@@ -112,9 +115,9 @@
   final Set<ClassElement> classesUsingTypeVariableExpression;
 
   // The set of type arguments tested against type variable bounds.
-  final Set<DartType> checkedTypeArguments;
+  final Set<ResolutionDartType> checkedTypeArguments;
   // The set of tested type variable bounds.
-  final Set<DartType> checkedBounds;
+  final Set<ResolutionDartType> checkedBounds;
 
   TypeChecks cachedRequiredChecks;
 
@@ -126,8 +129,8 @@
         methodsNeedingRti = new Set<Element>(),
         rtiDependencies = new Map<ClassElement, Set<ClassElement>>(),
         classesUsingTypeVariableExpression = new Set<ClassElement>(),
-        checkedTypeArguments = new Set<DartType>(),
-        checkedBounds = new Set<DartType>();
+        checkedTypeArguments = new Set<ResolutionDartType>(),
+        checkedBounds = new Set<ResolutionDartType>();
 
   Set<ClassElement> directlyInstantiatedArguments;
   Set<ClassElement> allInstantiatedArguments;
@@ -149,7 +152,7 @@
 
   @override
   void registerTypeVariableBoundsSubtypeCheck(
-      DartType typeArgument, DartType bound) {
+      ResolutionDartType typeArgument, ResolutionDartType bound) {
     checkedTypeArguments.add(typeArgument);
     checkedBounds.add(bound);
   }
@@ -170,18 +173,18 @@
    */
   @override
   void addImplicitChecks(
-      WorldBuilder universe, Iterable<ClassElement> classesUsingChecks) {
+      WorldBuilder worldBuilder, Iterable<ClassElement> classesUsingChecks) {
     // If there are no classes that use their variables in checks, there is
     // nothing to do.
     if (classesUsingChecks.isEmpty) return;
-    Set<DartType> instantiatedTypes = universe.instantiatedTypes;
+    Set<ResolutionDartType> instantiatedTypes = worldBuilder.instantiatedTypes;
     if (cannotDetermineInstantiatedTypesPrecisely) {
-      for (DartType type in instantiatedTypes) {
-        if (type.kind != TypeKind.INTERFACE) continue;
-        InterfaceType interface = type;
+      for (ResolutionDartType type in instantiatedTypes) {
+        if (type.kind != ResolutionTypeKind.INTERFACE) continue;
+        ResolutionInterfaceType interface = type;
         do {
-          for (DartType argument in interface.typeArguments) {
-            universe.registerIsCheck(argument, compiler.resolution);
+          for (ResolutionDartType argument in interface.typeArguments) {
+            worldBuilder.registerIsCheck(argument);
           }
           interface = interface.element.supertype;
         } while (interface != null && !instantiatedTypes.contains(interface));
@@ -192,19 +195,19 @@
       // set of is-checks.
       // TODO(karlklose): replace this with code that uses a subtype lookup
       // datastructure in the world.
-      for (DartType type in instantiatedTypes) {
-        if (type.kind != TypeKind.INTERFACE) continue;
-        InterfaceType classType = type;
+      for (ResolutionDartType type in instantiatedTypes) {
+        if (type.kind != ResolutionTypeKind.INTERFACE) continue;
+        ResolutionInterfaceType classType = type;
         for (ClassElement cls in classesUsingChecks) {
-          InterfaceType current = classType;
+          ResolutionInterfaceType current = classType;
           do {
             // We need the type as instance of its superclass anyway, so we just
             // try to compute the substitution; if the result is [:null:], the
             // classes are not related.
-            InterfaceType instance = current.asInstanceOf(cls);
+            ResolutionInterfaceType instance = current.asInstanceOf(cls);
             if (instance == null) break;
-            for (DartType argument in instance.typeArguments) {
-              universe.registerIsCheck(argument, compiler.resolution);
+            for (ResolutionDartType argument in instance.typeArguments) {
+              worldBuilder.registerIsCheck(argument);
             }
             current = current.element.supertype;
           } while (current != null && !instantiatedTypes.contains(current));
@@ -214,7 +217,8 @@
   }
 
   @override
-  void computeClassesNeedingRti() {
+  void computeClassesNeedingRti(
+      ResolutionWorldBuilder resolutionWorldBuilder, ClosedWorld closedWorld) {
     // Find the classes that need runtime type information. Such
     // classes are:
     // (1) used in a is check with type variables,
@@ -227,7 +231,7 @@
       classesNeedingRti.add(cls);
 
       // TODO(ngeoffray): This should use subclasses, not subtypes.
-      compiler.closedWorld.forEachStrictSubtypeOf(cls, (ClassElement sub) {
+      closedWorld.forEachStrictSubtypeOf(cls, (ClassElement sub) {
         potentiallyAddForRti(sub);
       });
 
@@ -240,7 +244,7 @@
     }
 
     Set<ClassElement> classesUsingTypeVariableTests = new Set<ClassElement>();
-    compiler.resolverWorld.isChecks.forEach((DartType type) {
+    resolutionWorldBuilder.isChecks.forEach((ResolutionDartType type) {
       if (type.isTypeVariable) {
         TypeVariableElement variable = type.element;
         // GENERIC_METHODS: When generic method support is complete enough to
@@ -252,7 +256,8 @@
       }
     });
     // Add is-checks that result from classes using type variables in checks.
-    addImplicitChecks(compiler.resolverWorld, classesUsingTypeVariableTests);
+    addImplicitChecks(
+        compiler.resolutionWorldBuilder, classesUsingTypeVariableTests);
     // Add the rti dependencies that are implicit in the way the backend
     // generates code: when we create a new [List], we actually create
     // a JSArray in the backend and we need to add type arguments to
@@ -260,14 +265,14 @@
     // JSArray needs type arguments.
     // TODO(karlklose): make this dependency visible from code.
     if (backend.helpers.jsArrayClass != null) {
-      registerRtiDependency(
-          backend.helpers.jsArrayClass, compiler.coreClasses.listClass);
+      ClassElement listClass = compiler.commonElements.listClass;
+      registerRtiDependency(backend.helpers.jsArrayClass, listClass);
     }
     // Compute the set of all classes and methods that need runtime type
     // information.
-    compiler.resolverWorld.isChecks.forEach((DartType type) {
+    compiler.resolutionWorldBuilder.isChecks.forEach((ResolutionDartType type) {
       if (type.isInterfaceType) {
-        InterfaceType itf = type;
+        ResolutionInterfaceType itf = type;
         if (!itf.treatAsRaw) {
           potentiallyAddForRti(itf.element);
         }
@@ -281,7 +286,7 @@
         }
         if (type.isFunctionType) {
           void analyzeMethod(TypedElement method) {
-            DartType memberType = method.type;
+            ResolutionDartType memberType = method.type;
             ClassElement contextClass = Types.getClassContext(memberType);
             if (contextClass != null &&
                 compiler.types.isPotentialSubtype(memberType, type)) {
@@ -290,16 +295,16 @@
             }
           }
 
-          compiler.resolverWorld.closuresWithFreeTypeVariables
+          compiler.resolutionWorldBuilder.closuresWithFreeTypeVariables
               .forEach(analyzeMethod);
-          compiler.resolverWorld.callMethodsWithFreeTypeVariables
+          compiler.resolutionWorldBuilder.callMethodsWithFreeTypeVariables
               .forEach(analyzeMethod);
         }
       }
     });
     if (compiler.options.enableTypeAssertions) {
       void analyzeMethod(TypedElement method) {
-        DartType memberType = method.type;
+        ResolutionDartType memberType = method.type;
         ClassElement contextClass = Types.getClassContext(memberType);
         if (contextClass != null) {
           potentiallyAddForRti(contextClass);
@@ -307,9 +312,9 @@
         }
       }
 
-      compiler.resolverWorld.closuresWithFreeTypeVariables
+      compiler.resolutionWorldBuilder.closuresWithFreeTypeVariables
           .forEach(analyzeMethod);
-      compiler.resolverWorld.callMethodsWithFreeTypeVariables
+      compiler.resolutionWorldBuilder.callMethodsWithFreeTypeVariables
           .forEach(analyzeMethod);
     }
     // Add the classes that need RTI because they use a type variable as
@@ -341,7 +346,7 @@
       // and precompute the substitutions for them.
       assert(invariant(element, element.allSupertypes != null,
           message: 'Supertypes have not been computed for $element.'));
-      for (DartType supertype in element.allSupertypes) {
+      for (ResolutionDartType supertype in element.allSupertypes) {
         ClassElement superelement = supertype.element;
         if (checked.contains(superelement)) {
           Substitution substitution =
@@ -354,37 +359,39 @@
   }
 
   void computeRequiredChecks() {
-    Set<DartType> isChecks = compiler.codegenWorld.isChecks;
+    Set<ResolutionDartType> isChecks = compiler.codegenWorldBuilder.isChecks;
     // These types are needed for is-checks against function types.
-    Set<DartType> instantiatedTypesAndClosures =
-        computeInstantiatedTypesAndClosures(compiler.codegenWorld);
+    Set<ResolutionDartType> instantiatedTypesAndClosures =
+        computeInstantiatedTypesAndClosures(compiler.codegenWorldBuilder);
     computeInstantiatedArguments(instantiatedTypesAndClosures, isChecks);
     computeCheckedArguments(instantiatedTypesAndClosures, isChecks);
     cachedRequiredChecks =
         computeChecks(allInstantiatedArguments, checkedArguments);
   }
 
-  Set<DartType> computeInstantiatedTypesAndClosures(
-      CodegenWorldBuilder universe) {
-    Set<DartType> instantiatedTypes =
-        new Set<DartType>.from(universe.instantiatedTypes);
-    for (DartType instantiatedType in universe.instantiatedTypes) {
+  Set<ResolutionDartType> computeInstantiatedTypesAndClosures(
+      CodegenWorldBuilder worldBuilder) {
+    Set<ResolutionDartType> instantiatedTypes =
+        new Set<ResolutionDartType>.from(worldBuilder.instantiatedTypes);
+    for (ResolutionDartType instantiatedType
+        in worldBuilder.instantiatedTypes) {
       if (instantiatedType.isInterfaceType) {
-        InterfaceType interface = instantiatedType;
-        FunctionType callType = interface.callType;
+        ResolutionInterfaceType interface = instantiatedType;
+        ResolutionFunctionType callType = interface.callType;
         if (callType != null) {
           instantiatedTypes.add(callType);
         }
       }
     }
-    for (FunctionElement element in universe.staticFunctionsNeedingGetter) {
+    for (FunctionElement element in worldBuilder.staticFunctionsNeedingGetter) {
       instantiatedTypes.add(element.type);
     }
     // TODO(johnniwinther): We should get this information through the
     // [neededClasses] computed in the emitter instead of storing it and pulling
     // it from resolution, but currently it would introduce a cyclic dependency
     // between [computeRequiredChecks] and [computeNeededClasses].
-    for (TypedElement element in compiler.resolverWorld.closurizedMembers) {
+    for (TypedElement element
+        in compiler.resolutionWorldBuilder.closurizedMembers) {
       instantiatedTypes.add(element.type);
     }
     return instantiatedTypes;
@@ -397,8 +404,8 @@
    * have a type check against this supertype that includes a check against
    * the type arguments.
    */
-  void computeInstantiatedArguments(
-      Set<DartType> instantiatedTypes, Set<DartType> isChecks) {
+  void computeInstantiatedArguments(Set<ResolutionDartType> instantiatedTypes,
+      Set<ResolutionDartType> isChecks) {
     ArgumentCollector superCollector = new ArgumentCollector(backend);
     ArgumentCollector directCollector = new ArgumentCollector(backend);
     FunctionArgumentCollector functionArgumentCollector =
@@ -406,8 +413,8 @@
 
     // We need to add classes occuring in function type arguments, like for
     // instance 'I' for [: o is C<f> :] where f is [: typedef I f(); :].
-    void collectFunctionTypeArguments(Iterable<DartType> types) {
-      for (DartType type in types) {
+    void collectFunctionTypeArguments(Iterable<ResolutionDartType> types) {
+      for (ResolutionDartType type in types) {
         functionArgumentCollector.collect(type);
       }
     }
@@ -415,13 +422,13 @@
     collectFunctionTypeArguments(isChecks);
     collectFunctionTypeArguments(checkedBounds);
 
-    void collectTypeArguments(Iterable<DartType> types,
+    void collectTypeArguments(Iterable<ResolutionDartType> types,
         {bool isTypeArgument: false}) {
-      for (DartType type in types) {
+      for (ResolutionDartType type in types) {
         directCollector.collect(type, isTypeArgument: isTypeArgument);
         if (type.isInterfaceType) {
           ClassElement cls = type.element;
-          for (DartType supertype in cls.allSupertypes) {
+          for (ResolutionDartType supertype in cls.allSupertypes) {
             superCollector.collect(supertype, isTypeArgument: isTypeArgument);
           }
         }
@@ -432,7 +439,7 @@
     collectTypeArguments(checkedTypeArguments, isTypeArgument: true);
 
     for (ClassElement cls in superCollector.classes.toList()) {
-      for (DartType supertype in cls.allSupertypes) {
+      for (ResolutionDartType supertype in cls.allSupertypes) {
         superCollector.collect(supertype);
       }
     }
@@ -444,8 +451,8 @@
   }
 
   /// Collects all type arguments used in is-checks.
-  void computeCheckedArguments(
-      Set<DartType> instantiatedTypes, Set<DartType> isChecks) {
+  void computeCheckedArguments(Set<ResolutionDartType> instantiatedTypes,
+      Set<ResolutionDartType> isChecks) {
     ArgumentCollector collector = new ArgumentCollector(backend);
     FunctionArgumentCollector functionArgumentCollector =
         new FunctionArgumentCollector(backend);
@@ -453,8 +460,8 @@
     // We need to add types occuring in function type arguments, like for
     // instance 'J' for [: (J j) {} is f :] where f is
     // [: typedef void f(I i); :] and 'J' is a subtype of 'I'.
-    void collectFunctionTypeArguments(Iterable<DartType> types) {
-      for (DartType type in types) {
+    void collectFunctionTypeArguments(Iterable<ResolutionDartType> types) {
+      for (ResolutionDartType type in types) {
         functionArgumentCollector.collect(type);
       }
     }
@@ -462,9 +469,9 @@
     collectFunctionTypeArguments(instantiatedTypes);
     collectFunctionTypeArguments(checkedTypeArguments);
 
-    void collectTypeArguments(Iterable<DartType> types,
+    void collectTypeArguments(Iterable<ResolutionDartType> types,
         {bool isTypeArgument: false}) {
-      for (DartType type in types) {
+      for (ResolutionDartType type in types) {
         collector.collect(type, isTypeArgument: isTypeArgument);
       }
     }
@@ -506,7 +513,7 @@
   }
 
   @override
-  Set<ClassElement> getReferencedClasses(FunctionType type) {
+  Set<ClassElement> getReferencedClasses(ResolutionFunctionType type) {
     FunctionArgumentCollector collector =
         new FunctionArgumentCollector(backend);
     collector.collect(type);
@@ -527,8 +534,8 @@
       return true;
     }
 
-    InterfaceType originalType = cls.thisType;
-    InterfaceType type = originalType.asInstanceOf(check);
+    ResolutionInterfaceType originalType = cls.thisType;
+    ResolutionInterfaceType type = originalType.asInstanceOf(check);
     // [type] is not a subtype of [check]. we do not generate a check and do not
     // need a substitution.
     if (type == null) return true;
@@ -536,8 +543,8 @@
     // Run through both lists of type variables and check if the type variables
     // are identical at each position. If they are not, we need to calculate a
     // substitution function.
-    List<DartType> variables = cls.typeVariables;
-    List<DartType> arguments = type.typeArguments;
+    List<ResolutionDartType> variables = cls.typeVariables;
+    List<ResolutionDartType> arguments = type.typeArguments;
     if (variables.length != arguments.length) {
       return false;
     }
@@ -569,9 +576,9 @@
     // Unnamed mixin application classes do not need substitutions, because they
     // are never instantiated and their checks are overwritten by the class that
     // they are mixed into.
-    InterfaceType type = cls.thisType;
-    InterfaceType target = type.asInstanceOf(check);
-    List<DartType> typeVariables = cls.typeVariables;
+    ResolutionInterfaceType type = cls.thisType;
+    ResolutionInterfaceType target = type.asInstanceOf(check);
+    List<ResolutionDartType> typeVariables = cls.typeVariables;
     if (typeVariables.isEmpty && !alwaysGenerateFunction) {
       return new Substitution.list(target.typeArguments);
     } else {
@@ -607,25 +614,28 @@
 
   @override
   jsAst.Expression getTypeRepresentation(
-      DartType type, OnVariableCallback onVariable,
+      ResolutionDartType type, OnVariableCallback onVariable,
       [ShouldEncodeTypedefCallback shouldEncodeTypedef]) {
+    // GENERIC_METHODS: When generic method support is complete enough to
+    // include a runtime value for method type variables this must be updated.
     return representationGenerator.getTypeRepresentation(
-        type, onVariable, shouldEncodeTypedef);
+        type.dynamifyMethodTypeVariableType, onVariable, shouldEncodeTypedef);
   }
 
   @override
   jsAst.Expression getSubstitutionRepresentation(
-      List<DartType> types, OnVariableCallback onVariable) {
+      List<ResolutionDartType> types, OnVariableCallback onVariable) {
     List<jsAst.Expression> elements = types
-        .map((DartType type) => getTypeRepresentation(type, onVariable))
+        .map((ResolutionDartType type) =>
+            getTypeRepresentation(type, onVariable))
         .toList(growable: false);
     return new jsAst.ArrayInitializer(elements);
   }
 
-  jsAst.Expression getTypeEncoding(DartType type,
+  jsAst.Expression getTypeEncoding(ResolutionDartType type,
       {bool alwaysGenerateFunction: false}) {
     ClassElement contextClass = Types.getClassContext(type);
-    jsAst.Expression onVariable(TypeVariableType v) {
+    jsAst.Expression onVariable(ResolutionTypeVariableType v) {
       return new jsAst.VariableUse(v.name);
     }
 
@@ -644,7 +654,8 @@
   }
 
   @override
-  jsAst.Expression getSignatureEncoding(DartType type, jsAst.Expression this_) {
+  jsAst.Expression getSignatureEncoding(
+      ResolutionDartType type, jsAst.Expression this_) {
     ClassElement contextClass = Types.getClassContext(type);
     jsAst.Expression encoding =
         getTypeEncoding(type, alwaysGenerateFunction: true);
@@ -678,15 +689,16 @@
    */
   @override
   jsAst.Expression getSubstitutionCode(Substitution substitution) {
-    jsAst.Expression declaration(TypeVariableType variable) {
+    jsAst.Expression declaration(ResolutionTypeVariableType variable) {
       return new jsAst.Parameter(getVariableName(variable.name));
     }
 
-    jsAst.Expression use(TypeVariableType variable) {
+    jsAst.Expression use(ResolutionTypeVariableType variable) {
       return new jsAst.VariableUse(getVariableName(variable.name));
     }
 
-    if (substitution.arguments.every((DartType type) => type.isDynamic)) {
+    if (substitution.arguments
+        .every((ResolutionDartType type) => type.isDynamic)) {
       return backend.emitter.emitter.generateFunctionThatReturnsNull();
     } else {
       jsAst.Expression value =
@@ -704,11 +716,11 @@
   @override
   jsAst.Expression getSubstitutionCodeForVariable(
       Substitution substitution, int index) {
-    jsAst.Expression declaration(TypeVariableType variable) {
+    jsAst.Expression declaration(ResolutionTypeVariableType variable) {
       return new jsAst.Parameter(getVariableName(variable.name));
     }
 
-    jsAst.Expression use(TypeVariableType variable) {
+    jsAst.Expression use(ResolutionTypeVariableType variable) {
       return new jsAst.VariableUse(getVariableName(variable.name));
     }
 
@@ -732,14 +744,14 @@
       backend.namer.internalGlobal('functionThatReturnsNull');
 
   @override
-  String getTypeRepresentationForTypeConstant(DartType type) {
+  String getTypeRepresentationForTypeConstant(ResolutionDartType type) {
     JavaScriptBackend backend = compiler.backend;
     Namer namer = backend.namer;
     if (type.isDynamic) return "dynamic";
     String name = namer.uniqueNameForTypeConstantElement(type.element);
     if (!type.element.isClass) return name;
-    InterfaceType interface = type;
-    List<DartType> variables = interface.element.typeVariables;
+    ResolutionInterfaceType interface = type;
+    List<ResolutionDartType> variables = interface.element.typeVariables;
     // Type constants can currently only be raw types, so there is no point
     // adding ground-term type parameters, as they would just be 'dynamic'.
     // TODO(sra): Since the result string is used only in constructing constant
@@ -751,11 +763,11 @@
   }
 
   @override
-  bool isSimpleFunctionType(FunctionType type) {
+  bool isSimpleFunctionType(ResolutionFunctionType type) {
     if (!type.returnType.isDynamic) return false;
     if (!type.optionalParameterTypes.isEmpty) return false;
     if (!type.namedParameterTypes.isEmpty) return false;
-    for (DartType parameter in type.parameterTypes) {
+    for (ResolutionDartType parameter in type.parameterTypes) {
       if (!parameter.isDynamic) return false;
     }
     return true;
@@ -778,12 +790,13 @@
    * the type representation for type variables.
    */
   jsAst.Expression getTypeRepresentation(
-      DartType type,
+      ResolutionDartType type,
       OnVariableCallback onVariable,
       ShouldEncodeTypedefCallback encodeTypedef) {
     this.onVariable = onVariable;
-    this.shouldEncodeTypedef =
-        (encodeTypedef != null) ? encodeTypedef : (TypedefType type) => false;
+    this.shouldEncodeTypedef = (encodeTypedef != null)
+        ? encodeTypedef
+        : (ResolutionTypedefType type) => false;
     jsAst.Expression representation = visit(type);
     this.onVariable = null;
     this.shouldEncodeTypedef = null;
@@ -795,27 +808,28 @@
   }
 
   @override
-  visit(DartType type, [_]) => type.accept(this, null);
+  visit(ResolutionDartType type, [_]) => type.accept(this, null);
 
-  visitTypeVariableType(TypeVariableType type, _) {
+  visitTypeVariableType(ResolutionTypeVariableType type, _) {
     return onVariable(type);
   }
 
-  visitDynamicType(DynamicType type, _) {
+  visitDynamicType(ResolutionDynamicType type, _) {
     return js('null');
   }
 
-  visitInterfaceType(InterfaceType type, _) {
+  visitInterfaceType(ResolutionInterfaceType type, _) {
     jsAst.Expression name = getJavaScriptClassName(type.element);
     return type.treatAsRaw ? name : visitList(type.typeArguments, head: name);
   }
 
-  jsAst.Expression visitList(List<DartType> types, {jsAst.Expression head}) {
+  jsAst.Expression visitList(List<ResolutionDartType> types,
+      {jsAst.Expression head}) {
     List<jsAst.Expression> elements = <jsAst.Expression>[];
     if (head != null) {
       elements.add(head);
     }
-    for (DartType type in types) {
+    for (ResolutionDartType type in types) {
       jsAst.Expression element = visit(type);
       if (element is jsAst.LiteralNull) {
         elements.add(new jsAst.ArrayHole());
@@ -841,7 +855,7 @@
         .expressionTemplateFor('{ ${namer.functionTypeTag}: "dynafunc" }');
   }
 
-  visitFunctionType(FunctionType type, _) {
+  visitFunctionType(ResolutionFunctionType type, _) {
     List<jsAst.Property> properties = <jsAst.Property>[];
 
     void addProperty(String name, jsAst.Expression value) {
@@ -867,7 +881,7 @@
     if (!type.namedParameterTypes.isEmpty) {
       List<jsAst.Property> namedArguments = <jsAst.Property>[];
       List<String> names = type.namedParameters;
-      List<DartType> types = type.namedParameterTypes;
+      List<ResolutionDartType> types = type.namedParameterTypes;
       assert(types.length == names.length);
       for (int index = 0; index < types.length; index++) {
         jsAst.Expression name = js.string(names[index]);
@@ -884,14 +898,14 @@
     return js('null');
   }
 
-  visitVoidType(VoidType type, _) {
+  visitVoidType(ResolutionVoidType type, _) {
     // TODO(ahe): Reify void type ("null" means "dynamic").
     return js('null');
   }
 
-  visitTypedefType(TypedefType type, _) {
+  visitTypedefType(ResolutionTypedefType type, _) {
     bool shouldEncode = shouldEncodeTypedef(type);
-    DartType unaliasedType = type.unaliased;
+    ResolutionDartType unaliasedType = type.unaliased;
     if (shouldEncode) {
       jsAst.ObjectInitializer initializer = unaliasedType.accept(this, null);
       // We have to encode the aliased type.
@@ -907,11 +921,6 @@
       return unaliasedType.accept(this, null);
     }
   }
-
-  visitStatementType(StatementType type, _) {
-    reporter.internalError(
-        NO_LOCATION_SPANNABLE, 'Unexpected type: $type (${type.kind}).');
-  }
 }
 
 class TypeCheckMapping implements TypeChecks {
@@ -947,28 +956,28 @@
 
   ArgumentCollector(this.backend);
 
-  collect(DartType type, {bool isTypeArgument: false}) {
+  collect(ResolutionDartType type, {bool isTypeArgument: false}) {
     visit(type, isTypeArgument);
   }
 
   /// Collect all types in the list as if they were arguments of an
   /// InterfaceType.
-  collectAll(List<DartType> types) {
-    for (DartType type in types) {
+  collectAll(List<ResolutionDartType> types) {
+    for (ResolutionDartType type in types) {
       visit(type, true);
     }
   }
 
-  visitTypedefType(TypedefType type, bool isTypeArgument) {
+  visitTypedefType(ResolutionTypedefType type, bool isTypeArgument) {
     type.unaliased.accept(this, isTypeArgument);
   }
 
-  visitInterfaceType(InterfaceType type, bool isTypeArgument) {
+  visitInterfaceType(ResolutionInterfaceType type, bool isTypeArgument) {
     if (isTypeArgument) classes.add(type.element);
     type.visitChildren(this, true);
   }
 
-  visitFunctionType(FunctionType type, _) {
+  visitFunctionType(ResolutionFunctionType type, _) {
     type.visitChildren(this, true);
   }
 }
@@ -979,30 +988,30 @@
 
   FunctionArgumentCollector(this.backend);
 
-  collect(DartType type) {
+  collect(ResolutionDartType type) {
     visit(type, false);
   }
 
   /// Collect all types in the list as if they were arguments of an
   /// InterfaceType.
-  collectAll(Link<DartType> types) {
-    for (DartType type in types) {
+  collectAll(Link<ResolutionDartType> types) {
+    for (ResolutionDartType type in types) {
       visit(type, true);
     }
   }
 
-  visitTypedefType(TypedefType type, bool inFunctionType) {
+  visitTypedefType(ResolutionTypedefType type, bool inFunctionType) {
     type.unaliased.accept(this, inFunctionType);
   }
 
-  visitInterfaceType(InterfaceType type, bool inFunctionType) {
+  visitInterfaceType(ResolutionInterfaceType type, bool inFunctionType) {
     if (inFunctionType) {
       classes.add(type.element);
     }
     type.visitChildren(this, inFunctionType);
   }
 
-  visitFunctionType(FunctionType type, _) {
+  visitFunctionType(ResolutionFunctionType type, _) {
     type.visitChildren(this, true);
   }
 }
@@ -1019,12 +1028,12 @@
 //TODO(floitsch): Remove support for non-function substitutions.
 class Substitution {
   final bool isFunction;
-  final List<DartType> arguments;
-  final List<DartType> parameters;
+  final List<ResolutionDartType> arguments;
+  final List<ResolutionDartType> parameters;
 
   Substitution.list(this.arguments)
       : isFunction = false,
-        parameters = const <DartType>[];
+        parameters = const <ResolutionDartType>[];
 
   Substitution.function(this.arguments, this.parameters) : isFunction = true;
 }
diff --git a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
index a32a3b5..898e910 100644
--- a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
+++ b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
@@ -6,7 +6,7 @@
 import '../compiler.dart' show Compiler;
 import '../constants/expressions.dart';
 import '../constants/values.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../enqueue.dart' show Enqueuer;
 import '../js/js.dart' as jsAst;
@@ -101,10 +101,10 @@
     // Do not process classes twice.
     if (_typeVariables.containsKey(cls)) return;
 
-    InterfaceType typeVariableType = _typeVariableClass.thisType;
+    ResolutionInterfaceType typeVariableType = _typeVariableClass.thisType;
     List<jsAst.Expression> constants = <jsAst.Expression>[];
 
-    for (TypeVariableType currentTypeVariable in cls.typeVariables) {
+    for (ResolutionTypeVariableType currentTypeVariable in cls.typeVariables) {
       TypeVariableElement typeVariableElement = currentTypeVariable.element;
 
       jsAst.Expression boundIndex =
diff --git a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
index 96d991a..5d7b4b5 100644
--- a/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/class_stub_generator.dart
@@ -2,17 +2,34 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.class_stub_generator;
+
+import '../common/names.dart' show Identifiers;
+import '../compiler.dart' show Compiler;
+import '../elements/entities.dart';
+import '../js/js.dart' as jsAst;
+import '../js/js.dart' show js;
+import '../js_backend/js_backend.dart' show JavaScriptBackend, Namer;
+import '../universe/selector.dart' show Selector;
+import '../universe/world_builder.dart'
+    show CodegenWorldBuilder, SelectorConstraints;
+import '../world.dart' show ClosedWorld;
+
+import 'model.dart';
 
 class ClassStubGenerator {
   final Namer namer;
-  final Compiler compiler;
   final JavaScriptBackend backend;
+  final CodegenWorldBuilder worldBuilder;
+  final ClosedWorld closedWorld;
+  final bool enableMinification;
 
-  ClassStubGenerator(this.compiler, this.namer, this.backend);
+  ClassStubGenerator(
+      this.namer, this.backend, this.worldBuilder, this.closedWorld,
+      {this.enableMinification});
 
-  jsAst.Expression generateClassConstructor(ClassElement classElement,
-      Iterable<jsAst.Name> fields, bool hasRtiField) {
+  jsAst.Expression generateClassConstructor(
+      ClassEntity classElement, Iterable<jsAst.Name> fields, bool hasRtiField) {
     // TODO(sra): Implement placeholders in VariableDeclaration position:
     //
     //     String constructorName = namer.getNameOfClass(classElement);
@@ -23,9 +40,8 @@
     var typeParameters = const <jsAst.Parameter>[];
     var typeInits = const <jsAst.Expression>[];
     if (hasRtiField) {
-      String parameterName = r'$ti';
-      typeParameters = parameterName;
-      typeInits = js('this.# = #', [namer.rtiFieldName, parameterName]);
+      typeParameters = namer.rtiFieldName;
+      typeInits = js('this.# = #', [namer.rtiFieldName, namer.rtiFieldName]);
     }
     return js('function(#, #) { #; #; this.#();}', [
       fields,
@@ -36,15 +52,15 @@
     ]);
   }
 
-  jsAst.Expression generateGetter(Element member, jsAst.Name fieldName) {
-    ClassElement cls = member.enclosingClass;
+  jsAst.Expression generateGetter(MemberEntity member, jsAst.Name fieldName) {
+    ClassEntity cls = member.enclosingClass;
     String receiver = backend.isInterceptorClass(cls) ? 'receiver' : 'this';
     List<String> args = backend.isInterceptedMethod(member) ? ['receiver'] : [];
     return js('function(#) { return #.# }', [args, receiver, fieldName]);
   }
 
-  jsAst.Expression generateSetter(Element member, jsAst.Name fieldName) {
-    ClassElement cls = member.enclosingClass;
+  jsAst.Expression generateSetter(MemberEntity member, jsAst.Name fieldName) {
+    ClassEntity cls = member.enclosingClass;
     String receiver = backend.isInterceptorClass(cls) ? 'receiver' : 'this';
     List<String> args = backend.isInterceptedMethod(member) ? ['receiver'] : [];
     // TODO(floitsch): remove 'return'?
@@ -58,9 +74,7 @@
    * Invariant: [member] must be a declaration element.
    */
   Map<jsAst.Name, jsAst.Expression> generateCallStubsForGetter(
-      Element member, Map<Selector, SelectorConstraints> selectors) {
-    assert(invariant(member, member.isDeclaration));
-
+      MemberEntity member, Map<Selector, SelectorConstraints> selectors) {
     // If the method is intercepted, the stub gets the
     // receiver explicitely and we need to pass it to the getter call.
     bool isInterceptedMethod = backend.isInterceptedMethod(member);
@@ -93,7 +107,7 @@
     for (Selector selector in selectors.keys) {
       if (generatedSelectors.contains(selector)) continue;
       if (!selector.appliesUnnamed(member)) continue;
-      if (selectors[selector].applies(member, selector, compiler.closedWorld)) {
+      if (selectors[selector].applies(member, selector, closedWorld)) {
         generatedSelectors.add(selector);
 
         jsAst.Name invocationName = namer.invocationName(selector);
@@ -126,7 +140,7 @@
     Map<jsAst.Name, Selector> jsNames = <jsAst.Name, Selector>{};
 
     // Do not generate no such method handlers if there is no class.
-    if (compiler.codegenWorld.directlyInstantiatedClasses.isEmpty) {
+    if (worldBuilder.directlyInstantiatedClasses.isEmpty) {
       return jsNames;
     }
 
@@ -134,16 +148,16 @@
         String ignore, Map<Selector, SelectorConstraints> selectors) {
       for (Selector selector in selectors.keys) {
         SelectorConstraints maskSet = selectors[selector];
-        if (maskSet.needsNoSuchMethodHandling(selector, compiler.closedWorld)) {
+        if (maskSet.needsNoSuchMethodHandling(selector, closedWorld)) {
           jsAst.Name jsName = namer.invocationMirrorInternalName(selector);
           jsNames[jsName] = selector;
         }
       }
     }
 
-    compiler.codegenWorld.forEachInvokedName(addNoSuchMethodHandlers);
-    compiler.codegenWorld.forEachInvokedGetter(addNoSuchMethodHandlers);
-    compiler.codegenWorld.forEachInvokedSetter(addNoSuchMethodHandlers);
+    worldBuilder.forEachInvokedName(addNoSuchMethodHandlers);
+    worldBuilder.forEachInvokedGetter(addNoSuchMethodHandlers);
+    worldBuilder.forEachInvokedSetter(addNoSuchMethodHandlers);
     return jsNames;
   }
 
@@ -175,8 +189,8 @@
           'noSuchMethodName': namer.noSuchMethodName,
           'createInvocationMirror': backend.emitter
               .staticFunctionAccess(backend.helpers.createInvocationMirror),
-          'methodName': js.quoteName(
-              compiler.options.enableMinification ? internalName : methodName),
+          'methodName':
+              js.quoteName(enableMinification ? internalName : methodName),
           'internalName': js.quoteName(internalName),
           'type': js.number(type),
           'arguments':
@@ -213,7 +227,7 @@
   Namer namer = backend.namer;
   Compiler compiler = backend.compiler;
 
-  Element closureFromTearOff = backend.helpers.closureFromTearOff;
+  FunctionEntity closureFromTearOff = backend.helpers.closureFromTearOff;
   jsAst.Expression tearOffAccessExpression;
   jsAst.Expression tearOffGlobalObjectString;
   jsAst.Expression tearOffGlobalObject;
@@ -221,9 +235,9 @@
     tearOffAccessExpression =
         backend.emitter.staticFunctionAccess(closureFromTearOff);
     tearOffGlobalObject =
-        js.stringPart(namer.globalObjectFor(closureFromTearOff));
+        js.stringPart(namer.globalObjectForMethod(closureFromTearOff));
     tearOffGlobalObjectString =
-        js.string(namer.globalObjectFor(closureFromTearOff));
+        js.string(namer.globalObjectForMethod(closureFromTearOff));
   } else {
     // Default values for mocked-up test libraries.
     tearOffAccessExpression =
diff --git a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
index eabb905..7b9314e 100644
--- a/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
+++ b/pkg/compiler/lib/src/js_emitter/code_emitter_task.dart
@@ -2,7 +2,28 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.code_emitter_task;
+
+import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin;
+
+import '../common.dart';
+import '../common/tasks.dart' show CompilerTask;
+import '../compiler.dart' show Compiler;
+import '../constants/values.dart';
+import '../deferred_load.dart' show OutputUnit;
+import '../elements/elements.dart' show Entity;
+import '../elements/entities.dart';
+import '../js/js.dart' as jsAst;
+import '../js_backend/js_backend.dart' show JavaScriptBackend, Namer;
+import '../world.dart' show ClosedWorld;
+import 'full_emitter/emitter.dart' as full_js_emitter;
+import 'lazy_emitter/emitter.dart' as lazy_js_emitter;
+import 'program_builder/program_builder.dart';
+import 'startup_emitter/emitter.dart' as startup_js_emitter;
+
+import 'metadata_collector.dart' show MetadataCollector;
+import 'native_emitter.dart' show NativeEmitter;
+import 'type_test_registry.dart' show TypeTestRegistry;
 
 const USE_LAZY_EMITTER = const bool.fromEnvironment("dart2js.use.lazy.emitter");
 
@@ -13,17 +34,16 @@
  * The code for the containing (used) methods must exist in the `universe`.
  */
 class CodeEmitterTask extends CompilerTask {
-  // TODO(floitsch): the code-emitter task should not need a namer.
-  final Namer namer;
-  final TypeTestRegistry typeTestRegistry;
+  TypeTestRegistry typeTestRegistry;
   NativeEmitter nativeEmitter;
   MetadataCollector metadataCollector;
-  Emitter emitter;
+  EmitterFactory _emitterFactory;
+  Emitter _emitter;
   final Compiler compiler;
 
   /// Records if a type variable is read dynamically for type tests.
-  final Set<TypeVariableElement> readTypeVariables =
-      new Set<TypeVariableElement>();
+  final Set<TypeVariableEntity> readTypeVariables =
+      new Set<TypeVariableEntity>();
 
   JavaScriptBackend get backend => compiler.backend;
 
@@ -32,41 +52,47 @@
   // tests.
   // The field is set after the program has been emitted.
   /// Contains a list of all classes that are emitted.
-  Set<ClassElement> neededClasses;
+  Set<ClassEntity> neededClasses;
 
-  CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap,
-      bool useStartupEmitter)
+  CodeEmitterTask(
+      Compiler compiler, bool generateSourceMap, bool useStartupEmitter)
       : compiler = compiler,
-        this.namer = namer,
-        this.typeTestRegistry = new TypeTestRegistry(compiler),
         super(compiler.measurer) {
     nativeEmitter = new NativeEmitter(this);
     if (USE_LAZY_EMITTER) {
-      emitter = new lazy_js_emitter.Emitter(compiler, namer, nativeEmitter);
+      _emitterFactory = new lazy_js_emitter.EmitterFactory();
     } else if (useStartupEmitter) {
-      emitter = new startup_js_emitter.Emitter(
-          compiler, namer, nativeEmitter, generateSourceMap);
+      _emitterFactory = new startup_js_emitter.EmitterFactory(
+          generateSourceMap: generateSourceMap);
     } else {
-      emitter =
-          new full_js_emitter.Emitter(compiler, namer, generateSourceMap, this);
+      _emitterFactory = new full_js_emitter.EmitterFactory(
+          generateSourceMap: generateSourceMap);
     }
-    metadataCollector = new MetadataCollector(compiler, emitter);
+  }
+
+  Emitter get emitter {
+    assert(invariant(NO_LOCATION_SPANNABLE, _emitter != null,
+        message: "Emitter has not been created yet."));
+    return _emitter;
   }
 
   String get name => 'Code emitter';
 
   /// Returns the string that is used to find library patches that are
   /// specialized for the emitter.
-  String get patchVersion => emitter.patchVersion;
+  String get patchVersion => _emitterFactory.patchVersion;
+
+  /// Returns true, if the emitter supports reflection.
+  bool get supportsReflection => _emitterFactory.supportsReflection;
 
   /// Returns the closure expression of a static function.
-  jsAst.Expression isolateStaticClosureAccess(MethodElement element) {
+  jsAst.Expression isolateStaticClosureAccess(FunctionEntity element) {
     return emitter.isolateStaticClosureAccess(element);
   }
 
   /// Returns the JS function that must be invoked to get the value of the
   /// lazily initialized static.
-  jsAst.Expression isolateLazyInitializerAccess(FieldElement element) {
+  jsAst.Expression isolateLazyInitializerAccess(FieldEntity element) {
     return emitter.isolateLazyInitializerAccess(element);
   }
 
@@ -80,44 +106,44 @@
     return emitter.constantReference(constant);
   }
 
-  jsAst.Expression staticFieldAccess(FieldElement e) {
+  jsAst.Expression staticFieldAccess(FieldEntity e) {
     return emitter.staticFieldAccess(e);
   }
 
   /// Returns the JS function representing the given function.
   ///
   /// The function must be invoked and can not be used as closure.
-  jsAst.Expression staticFunctionAccess(MethodElement e) {
+  jsAst.Expression staticFunctionAccess(FunctionEntity e) {
     return emitter.staticFunctionAccess(e);
   }
 
   /// Returns the JS constructor of the given element.
   ///
   /// The returned expression must only be used in a JS `new` expression.
-  jsAst.Expression constructorAccess(ClassElement e) {
+  jsAst.Expression constructorAccess(ClassEntity e) {
     return emitter.constructorAccess(e);
   }
 
   /// Returns the JS prototype of the given class [e].
-  jsAst.Expression prototypeAccess(ClassElement e,
+  jsAst.Expression prototypeAccess(ClassEntity e,
       {bool hasBeenInstantiated: false}) {
     return emitter.prototypeAccess(e, hasBeenInstantiated);
   }
 
   /// Returns the JS prototype of the given interceptor class [e].
-  jsAst.Expression interceptorPrototypeAccess(ClassElement e) {
+  jsAst.Expression interceptorPrototypeAccess(ClassEntity e) {
     return jsAst.js('#.prototype', interceptorClassAccess(e));
   }
 
   /// Returns the JS constructor of the given interceptor class [e].
-  jsAst.Expression interceptorClassAccess(ClassElement e) {
+  jsAst.Expression interceptorClassAccess(ClassEntity e) {
     return emitter.interceptorClassAccess(e);
   }
 
   /// Returns the JS expression representing the type [e].
   ///
   /// The given type [e] might be a Typedef.
-  jsAst.Expression typeAccess(Element e) {
+  jsAst.Expression typeAccess(Entity e) {
     return emitter.typeAccess(e);
   }
 
@@ -126,11 +152,11 @@
     return emitter.templateForBuiltin(builtin);
   }
 
-  void registerReadTypeVariable(TypeVariableElement element) {
+  void registerReadTypeVariable(TypeVariableEntity element) {
     readTypeVariables.add(element);
   }
 
-  Set<ClassElement> _finalizeRti() {
+  Set<ClassEntity> _finalizeRti() {
     // Compute the required type checks to know which classes need a
     // 'is$' method.
     typeTestRegistry.computeRequiredTypeChecks();
@@ -138,13 +164,22 @@
     return typeTestRegistry.computeRtiNeededClasses();
   }
 
-  int assembleProgram() {
+  /// Creates the [Emitter] for this task.
+  void createEmitter(Namer namer, ClosedWorld closedWorld) {
+    measure(() {
+      _emitter = _emitterFactory.createEmitter(this, namer, closedWorld);
+      metadataCollector = new MetadataCollector(compiler, _emitter);
+      typeTestRegistry = new TypeTestRegistry(compiler, closedWorld);
+    });
+  }
+
+  int assembleProgram(Namer namer, ClosedWorld closedWorld) {
     return measure(() {
       emitter.invalidateCaches();
 
-      Set<ClassElement> rtiNeededClasses = _finalizeRti();
-      ProgramBuilder programBuilder =
-          new ProgramBuilder(compiler, namer, this, emitter, rtiNeededClasses);
+      Set<ClassEntity> rtiNeededClasses = _finalizeRti();
+      ProgramBuilder programBuilder = new ProgramBuilder(
+          compiler, namer, this, emitter, closedWorld, rtiNeededClasses);
       int size = emitter.emitProgram(programBuilder);
       // TODO(floitsch): we shouldn't need the `neededClasses` anymore.
       neededClasses = programBuilder.collector.neededClasses;
@@ -153,24 +188,30 @@
   }
 }
 
-abstract class Emitter {
+abstract class EmitterFactory {
   /// Returns the string that is used to find library patches that are
   /// specialized for this emitter.
   String get patchVersion;
 
+  /// Returns true, if the emitter supports reflection.
+  bool get supportsReflection;
+
+  /// Create the [Emitter] for the emitter [task] that uses the given [namer].
+  Emitter createEmitter(
+      CodeEmitterTask task, Namer namer, ClosedWorld closedWorld);
+}
+
+abstract class Emitter {
   /// Uses the [programBuilder] to generate a model of the program, emits
   /// the program, and returns the size of the generated output.
   int emitProgram(ProgramBuilder programBuilder);
 
-  /// Returns true, if the emitter supports reflection.
-  bool get supportsReflection;
-
   /// Returns the JS function that must be invoked to get the value of the
   /// lazily initialized static.
-  jsAst.Expression isolateLazyInitializerAccess(FieldElement element);
+  jsAst.Expression isolateLazyInitializerAccess(FieldEntity element);
 
   /// Returns the closure expression of a static function.
-  jsAst.Expression isolateStaticClosureAccess(FunctionElement element);
+  jsAst.Expression isolateStaticClosureAccess(FunctionEntity element);
 
   /// Returns the JS code for accessing the embedded [global].
   jsAst.Expression generateEmbeddedGlobalAccess(String global);
@@ -178,23 +219,23 @@
   /// Returns the JS function representing the given function.
   ///
   /// The function must be invoked and can not be used as closure.
-  jsAst.Expression staticFunctionAccess(FunctionElement element);
+  jsAst.Expression staticFunctionAccess(FunctionEntity element);
 
-  jsAst.Expression staticFieldAccess(FieldElement element);
+  jsAst.Expression staticFieldAccess(FieldEntity element);
 
   /// Returns the JS constructor of the given element.
   ///
   /// The returned expression must only be used in a JS `new` expression.
-  jsAst.Expression constructorAccess(ClassElement e);
+  jsAst.Expression constructorAccess(ClassEntity e);
 
   /// Returns the JS prototype of the given class [e].
-  jsAst.Expression prototypeAccess(ClassElement e, bool hasBeenInstantiated);
+  jsAst.Expression prototypeAccess(ClassEntity e, bool hasBeenInstantiated);
 
   /// Returns the JS constructor of the given interceptor class [e].
-  jsAst.Expression interceptorClassAccess(ClassElement e);
+  jsAst.Expression interceptorClassAccess(ClassEntity e);
 
   /// Returns the JS expression representing the type [e].
-  jsAst.Expression typeAccess(Element e);
+  jsAst.Expression typeAccess(Entity e);
 
   /// Returns the JS expression representing a function that returns 'null'
   jsAst.Expression generateFunctionThatReturnsNull();
@@ -208,5 +249,8 @@
   /// Returns the JS template for the given [builtin].
   jsAst.Template templateForBuiltin(JsBuiltin builtin);
 
+  /// Returns the size of the code generated for a given output [unit].
+  int generatedSize(OutputUnit unit);
+
   void invalidateCaches();
 }
diff --git a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
index 6baa377..49b77e7 100644
--- a/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
+++ b/pkg/compiler/lib/src/js_emitter/constant_ordering.dart
@@ -5,8 +5,9 @@
 library dart2js.js_emitter.constant_ordering;
 
 import '../constants/values.dart';
-import '../dart_types.dart';
-import '../elements/elements.dart' show Element, Elements, FieldElement;
+import '../elements/elements.dart' show Entity, Elements;
+import '../elements/entities.dart' show FieldEntity;
+import '../elements/resolution_types.dart';
 import '../js_backend/js_backend.dart' show SyntheticConstantKind;
 import '../tree/dartstring.dart' show DartString;
 
@@ -44,13 +45,13 @@
     return 0;
   }
 
-  static int compareElements(Element a, Element b) {
+  static int compareElements(Entity a, Entity b) {
     int r = a.name.compareTo(b.name);
     if (r != 0) return r;
     return Elements.compareByPosition(a, b);
   }
 
-  static int compareDartTypes(DartType a, DartType b) {
+  static int compareDartTypes(ResolutionDartType a, ResolutionDartType b) {
     if (a == b) return 0;
     int r = a.kind.index.compareTo(b.kind.index);
     if (r != 0) return r;
@@ -104,7 +105,9 @@
   int visitList(ListConstantValue a, ListConstantValue b) {
     int r = compareLists(compareValues, a.entries, b.entries);
     if (r != 0) return r;
-    return compareDartTypes(a.type, b.type);
+    ResolutionInterfaceType type1 = a.type;
+    ResolutionInterfaceType type2 = b.type;
+    return compareDartTypes(type1, type2);
   }
 
   int visitMap(MapConstantValue a, MapConstantValue b) {
@@ -112,15 +115,19 @@
     if (r != 0) return r;
     r = compareLists(compareValues, a.values, b.values);
     if (r != 0) return r;
-    return compareDartTypes(a.type, b.type);
+    ResolutionInterfaceType type1 = a.type;
+    ResolutionInterfaceType type2 = b.type;
+    return compareDartTypes(type1, type2);
   }
 
   int visitConstructed(ConstructedConstantValue a, ConstructedConstantValue b) {
-    int r = compareDartTypes(a.type, b.type);
+    ResolutionInterfaceType type1 = a.type;
+    ResolutionInterfaceType type2 = b.type;
+    int r = compareDartTypes(type1, type2);
     if (r != 0) return r;
 
-    List<FieldElement> aFields = a.fields.keys.toList()..sort(compareElements);
-    List<FieldElement> bFields = b.fields.keys.toList()..sort(compareElements);
+    List<FieldEntity> aFields = a.fields.keys.toList()..sort(compareElements);
+    List<FieldEntity> bFields = b.fields.keys.toList()..sort(compareElements);
 
     r = compareLists(compareElements, aFields, bFields);
     if (r != 0) return r;
@@ -134,11 +141,13 @@
   int visitType(TypeConstantValue a, TypeConstantValue b) {
     int r = compareDartTypes(a.representedType, b.representedType);
     if (r != 0) return r;
-    return compareDartTypes(a.type, b.type);
+    ResolutionInterfaceType type1 = a.type;
+    ResolutionInterfaceType type2 = b.type;
+    return compareDartTypes(type1, type2);
   }
 
   int visitInterceptor(InterceptorConstantValue a, InterceptorConstantValue b) {
-    return compareDartTypes(a.dispatchedType, b.dispatchedType);
+    return compareElements(a.cls, b.cls);
   }
 
   int visitSynthetic(SyntheticConstantValue a, SyntheticConstantValue b) {
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/class_builder.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/class_builder.dart
index 2e0cb0e..f0167e1 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/class_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/class_builder.dart
@@ -2,7 +2,13 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter.full_emitter;
+library dart2js.js_emitter.full_emitter.class_builder;
+
+import '../../elements/elements.dart' show Entity;
+import '../../elements/entities.dart';
+import '../../js/js.dart' as jsAst;
+import '../../js/js.dart' show js;
+import '../../js_backend/js_backend.dart' show Namer;
 
 /**
  * A data structure for collecting fragments of a class definition.
@@ -15,13 +21,13 @@
   jsAst.Node functionType;
   List<jsAst.Node> fieldMetadata;
 
-  final Element element;
+  final Entity element;
   final Namer namer;
   final bool isForActualClass;
 
   ClassBuilder(this.element, this.namer, this.isForActualClass);
 
-  ClassBuilder.forClass(ClassElement cls, this.namer)
+  ClassBuilder.forClass(ClassEntity cls, this.namer)
       : isForActualClass = true,
         element = cls;
 
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart
index 5a6fb44..c5d5181 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/class_emitter.dart
@@ -2,11 +2,32 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter.full_emitter;
+library dart2js.js_emitter.full_emitter.class_emitter;
+
+import '../../common.dart';
+import '../../common/names.dart' show Names;
+import '../../elements/resolution_types.dart' show ResolutionDartType;
+import '../../deferred_load.dart' show OutputUnit;
+import '../../elements/elements.dart'
+    show ClassElement, Element, FieldElement, MemberElement, Name;
+import '../../js/js.dart' as jsAst;
+import '../../js/js.dart' show js;
+import '../../js_backend/js_backend.dart' show CompoundName, Namer;
+import '../../universe/selector.dart' show Selector;
+import '../../util/util.dart' show equalElements;
+import '../../world.dart' show ClosedWorld;
+import '../js_emitter.dart' hide Emitter, EmitterFactory;
+import '../model.dart';
+import 'emitter.dart';
 
 class ClassEmitter extends CodeEmitterHelper {
+  final ClosedWorld closedWorld;
+
+  ClassEmitter(this.closedWorld);
+
   ClassStubGenerator get _stubGenerator =>
-      new ClassStubGenerator(compiler, namer, backend);
+      new ClassStubGenerator(namer, backend, codegenWorldBuilder, closedWorld,
+          enableMinification: compiler.options.enableMinification);
 
   /**
    * Documentation wanted -- johnniwinther
@@ -171,7 +192,7 @@
           fieldNameParts.add(new jsAst.LiteralString('-'));
           if (fieldElement.isTopLevel ||
               backend.isAccessibleByReflection(fieldElement.enclosingClass)) {
-            DartType type = fieldElement.type;
+            ResolutionDartType type = fieldElement.type;
             fieldNameParts.add(task.metadataCollector.reifyType(type));
           }
         }
@@ -194,7 +215,7 @@
     if (cls.onlyForRti) return;
 
     for (StubMethod method in cls.checkedSetters) {
-      Element member = method.element;
+      MemberElement member = method.element;
       assert(member != null);
       jsAst.Expression code = method.code;
       jsAst.Name setterName = method.name;
@@ -210,7 +231,7 @@
     if (!compiler.options.useContentSecurityPolicy || cls.onlyForRti) return;
 
     for (Field field in cls.fields) {
-      Element member = field.element;
+      FieldElement member = field.element;
       reporter.withCurrentElement(member, () {
         if (field.needsGetter) {
           emitGetterForCSP(member, field.name, field.accessorName, builder);
@@ -246,7 +267,6 @@
     }
 
     for (Method method in cls.methods) {
-      assert(invariant(classElement, method.element.isDeclaration));
       assert(invariant(classElement, method.element.isInstanceMember));
       emitter.containerBuilder.addMemberMethod(method, builder);
     }
@@ -290,7 +310,7 @@
     }
 
     if (backend.isAccessibleByReflection(classElement)) {
-      List<DartType> typeVars = classElement.typeVariables;
+      List<ResolutionDartType> typeVars = classElement.typeVariables;
       Iterable typeVariableProperties =
           emitter.typeVariableHandler.typeVariablesOf(classElement);
 
@@ -344,7 +364,7 @@
         if (classElement.supertype != null) {
           types.add(task.metadataCollector.reifyType(classElement.supertype));
         }
-        for (DartType interface in classElement.interfaces) {
+        for (ResolutionDartType interface in classElement.interfaces) {
           types.add(task.metadataCollector.reifyType(interface));
         }
         // TODO(herhut): Fix use of reflection name here.
@@ -369,7 +389,7 @@
         message: '$previousName != ${memberName}'));
   }
 
-  void emitGetterForCSP(Element member, jsAst.Name fieldName,
+  void emitGetterForCSP(FieldElement member, jsAst.Name fieldName,
       jsAst.Name accessorName, ClassBuilder builder) {
     jsAst.Expression function =
         _stubGenerator.generateGetter(member, fieldName);
@@ -389,7 +409,7 @@
     }
   }
 
-  void emitSetterForCSP(Element member, jsAst.Name fieldName,
+  void emitSetterForCSP(FieldElement member, jsAst.Name fieldName,
       jsAst.Name accessorName, ClassBuilder builder) {
     jsAst.Expression function =
         _stubGenerator.generateSetter(member, fieldName);
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/code_emitter_helper.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/code_emitter_helper.dart
index 6c7ee56..185f093 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/code_emitter_helper.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/code_emitter_helper.dart
@@ -19,6 +19,8 @@
 
   DiagnosticReporter get reporter => compiler.reporter;
 
+  CodegenWorldBuilder get codegenWorldBuilder => compiler.codegenWorldBuilder;
+
   String get n => emitter.n;
 
   String get _ => emitter._;
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/container_builder.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/container_builder.dart
index d0c0d93..8d344ae 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/container_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/container_builder.dart
@@ -2,7 +2,21 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter.full_emitter;
+library dart2js.js_emitter.full_emitter.container_builder;
+
+import '../../constants/values.dart';
+import '../../elements/elements.dart'
+    show
+        Element,
+        Elements,
+        FunctionSignature,
+        MetadataAnnotation,
+        MethodElement;
+import '../../js/js.dart' as jsAst;
+import '../../js/js.dart' show js;
+import '../js_emitter.dart' hide Emitter, EmitterFactory;
+import '../model.dart';
+import 'emitter.dart';
 
 /// This class should morph into something that makes it easy to build
 /// JavaScript representations of libraries, class-sides, and instance-sides.
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
index a5e7b4c..3e5b669 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
@@ -12,24 +12,22 @@
     show JsBuiltin, JsGetName;
 
 import '../../common.dart';
-import '../../common/names.dart' show Names;
 import '../../compiler.dart' show Compiler;
 import '../../constants/values.dart';
-import '../../core_types.dart' show CoreClasses;
-import '../../dart_types.dart' show DartType;
+import '../../core_types.dart' show CommonElements;
+import '../../elements/resolution_types.dart' show ResolutionDartType;
 import '../../deferred_load.dart' show OutputUnit;
 import '../../elements/elements.dart'
     show
         ClassElement,
         Element,
         Elements,
+        Entity,
         FieldElement,
         FunctionElement,
         FunctionSignature,
         LibraryElement,
-        MetadataAnnotation,
         MethodElement,
-        Name,
         TypedefElement,
         VariableElement;
 import '../../hash/sha1.dart' show Hasher;
@@ -42,9 +40,7 @@
 import '../../js_backend/backend_helpers.dart' show BackendHelpers;
 import '../../js_backend/js_backend.dart'
     show
-        CompoundName,
         ConstantEmitter,
-        GetterName,
         JavaScriptBackend,
         JavaScriptConstantCompiler,
         Namer,
@@ -52,26 +48,52 @@
         TypeVariableHandler;
 import '../../universe/call_structure.dart' show CallStructure;
 import '../../universe/selector.dart' show Selector;
-import '../../util/characters.dart' show $$, $A, $HASH, $Z, $a, $z;
+import '../../universe/world_builder.dart' show CodegenWorldBuilder;
 import '../../util/uri_extras.dart' show relativize;
-import '../../util/util.dart' show equalElements;
+import '../../world.dart' show ClosedWorld;
 import '../constant_ordering.dart' show deepCompareConstants;
 import '../headers.dart';
-import '../js_emitter.dart' hide Emitter;
-import '../js_emitter.dart' as js_emitter show Emitter;
+import '../js_emitter.dart' hide Emitter, EmitterFactory;
+import '../js_emitter.dart' as js_emitter show Emitter, EmitterFactory;
 import '../model.dart';
 import '../program_builder/program_builder.dart';
 
-part 'class_builder.dart';
-part 'class_emitter.dart';
+import 'class_builder.dart';
+import 'class_emitter.dart';
+import 'container_builder.dart';
+import 'interceptor_emitter.dart';
+import 'nsm_emitter.dart';
+
+export 'class_builder.dart';
+export 'class_emitter.dart';
+export 'container_builder.dart';
+export 'interceptor_emitter.dart';
+export 'nsm_emitter.dart';
+
 part 'code_emitter_helper.dart';
-part 'container_builder.dart';
 part 'declarations.dart';
 part 'deferred_output_unit_hash.dart';
-part 'interceptor_emitter.dart';
-part 'nsm_emitter.dart';
 part 'setup_program_builder.dart';
 
+class EmitterFactory implements js_emitter.EmitterFactory {
+  final bool generateSourceMap;
+
+  EmitterFactory({this.generateSourceMap});
+
+  @override
+  String get patchVersion => "full";
+
+  @override
+  bool get supportsReflection => true;
+
+  @override
+  Emitter createEmitter(
+      CodeEmitterTask task, Namer namer, ClosedWorld closedWorld) {
+    return new Emitter(
+        task.compiler, namer, closedWorld, generateSourceMap, task);
+  }
+}
+
 class Emitter implements js_emitter.Emitter {
   final Compiler compiler;
   final CodeEmitterTask task;
@@ -83,9 +105,9 @@
   List<TypedefElement> typedefsNeededForReflection;
 
   final ContainerBuilder containerBuilder = new ContainerBuilder();
-  final ClassEmitter classEmitter = new ClassEmitter();
-  final NsmEmitter nsmEmitter = new NsmEmitter();
-  final InterceptorEmitter interceptorEmitter = new InterceptorEmitter();
+  final ClassEmitter classEmitter;
+  final NsmEmitter nsmEmitter;
+  final InterceptorEmitter interceptorEmitter;
 
   // TODO(johnniwinther): Wrap these fields in a caching strategy.
   final Set<ConstantValue> cachedEmittedConstants;
@@ -106,7 +128,7 @@
   ConstantEmitter constantEmitter;
   NativeEmitter get nativeEmitter => task.nativeEmitter;
   TypeTestRegistry get typeTestRegistry => task.typeTestRegistry;
-  CoreClasses get coreClasses => compiler.coreClasses;
+  CommonElements get commonElements => compiler.commonElements;
 
   // The full code that is written to each hunk part-file.
   Map<OutputUnit, CodeOutput> outputBuffers = new Map<OutputUnit, CodeOutput>();
@@ -154,18 +176,30 @@
 
   final bool generateSourceMap;
 
-  Emitter(Compiler compiler, Namer namer, this.generateSourceMap, this.task)
+  Emitter(Compiler compiler, Namer namer, ClosedWorld closedWorld,
+      this.generateSourceMap, this.task)
       : this.compiler = compiler,
         this.namer = namer,
         cachedEmittedConstants = compiler.cacheStrategy.newSet(),
         cachedClassBuilders = compiler.cacheStrategy.newMap(),
-        cachedElements = compiler.cacheStrategy.newSet() {
+        cachedElements = compiler.cacheStrategy.newSet(),
+        classEmitter = new ClassEmitter(closedWorld),
+        interceptorEmitter = new InterceptorEmitter(closedWorld),
+        nsmEmitter = new NsmEmitter(closedWorld) {
     constantEmitter = new ConstantEmitter(
         compiler, namer, this.constantReference, constantListGenerator);
     containerBuilder.emitter = this;
     classEmitter.emitter = this;
     nsmEmitter.emitter = this;
     interceptorEmitter.emitter = this;
+    if (compiler.options.hasIncrementalSupport) {
+      // Much like a scout, an incremental compiler is always prepared. For
+      // mixins, classes, and lazy statics, at least.
+      needsClassSupport = true;
+      needsMixinSupport = true;
+      needsLazyInitializer = true;
+      needsStructuredMemberInfo = true;
+    }
   }
 
   DiagnosticReporter get reporter => compiler.reporter;
@@ -189,9 +223,6 @@
   }
 
   @override
-  String get patchVersion => "full";
-
-  @override
   bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) {
     if (constant.isFunction) return true; // Already emitted.
     if (constant.isPrimitive) return true; // Inlined.
@@ -273,9 +304,6 @@
   String get globalsHolder => r"$globals$";
 
   @override
-  bool get supportsReflection => true;
-
-  @override
   jsAst.Expression generateEmbeddedGlobalAccess(String global) {
     return js(generateEmbeddedGlobalAccessString(global));
   }
@@ -299,7 +327,7 @@
   }
 
   @override
-  jsAst.Expression isolateStaticClosureAccess(FunctionElement element) {
+  jsAst.Expression isolateStaticClosureAccess(MethodElement element) {
     return jsAst.js('#.#()',
         [namer.globalObjectFor(element), namer.staticClosureName(element)]);
   }
@@ -310,7 +338,7 @@
   }
 
   @override
-  jsAst.PropertyAccess staticFunctionAccess(FunctionElement element) {
+  jsAst.PropertyAccess staticFunctionAccess(MethodElement element) {
     return globalPropertyAccess(element);
   }
 
@@ -331,7 +359,7 @@
   }
 
   @override
-  jsAst.PropertyAccess typeAccess(Element element) {
+  jsAst.PropertyAccess typeAccess(Entity element) {
     return globalPropertyAccess(element);
   }
 
@@ -340,7 +368,7 @@
     switch (builtin) {
       case JsBuiltin.dartObjectConstructor:
         return jsAst.js
-            .expressionTemplateYielding(typeAccess(coreClasses.objectClass));
+            .expressionTemplateYielding(typeAccess(commonElements.objectClass));
 
       case JsBuiltin.isCheckPropertyToJsConstructorName:
         int isPrefixLength = namer.operatorIsPrefix.length;
@@ -392,6 +420,11 @@
     }
   }
 
+  @override
+  int generatedSize(OutputUnit unit) {
+    return outputBuffers[unit].length;
+  }
+
   List<jsAst.Statement> buildTrivialNsmHandlers() {
     return nsmEmitter.buildTrivialNsmHandlers();
   }
@@ -413,13 +446,13 @@
   /// In minified mode we want to keep the name for the most common core types.
   bool _isNativeTypeNeedingReflectionName(Element element) {
     if (!element.isClass) return false;
-    return (element == coreClasses.intClass ||
-        element == coreClasses.doubleClass ||
-        element == coreClasses.numClass ||
-        element == coreClasses.stringClass ||
-        element == coreClasses.boolClass ||
-        element == coreClasses.nullClass ||
-        element == coreClasses.listClass);
+    return (element == commonElements.intClass ||
+        element == commonElements.doubleClass ||
+        element == commonElements.numClass ||
+        element == commonElements.stringClass ||
+        element == commonElements.boolClass ||
+        element == commonElements.nullClass ||
+        element == commonElements.listClass);
   }
 
   /// Returns the "reflection name" of an [Element] or [Selector].
@@ -586,7 +619,7 @@
     if (staticFunctions == null) return;
 
     for (Method method in staticFunctions) {
-      Element element = method.element;
+      MethodElement element = method.element;
       // We need to filter out null-elements for the interceptors.
       // TODO(floitsch): use the precomputed interceptors here.
       if (element == null) continue;
@@ -911,10 +944,14 @@
 
             prototype[getterName] = function () {
               var result = this[fieldName];
+              if (result == sentinelInProgress) {
+                // In minified mode, static name is not provided, so fall back
+                // to the minified fieldName.
+                #cyclicThrow(staticName || fieldName);
+              }
               try {
                 if (result === sentinelUndefined) {
                   this[fieldName] = sentinelInProgress;
-
                   try {
                     result = this[fieldName] = lazyValue();
                   } finally {
@@ -923,13 +960,7 @@
                     if (result === sentinelUndefined)
                       this[fieldName] = null;
                   }
-                } else {
-                  if (result === sentinelInProgress)
-                    // In minified mode, static name is not provided, so fall
-                    // back to the minified fieldName.
-                    #cyclicThrow(staticName || fieldName);
                 }
-
                 return result;
               } finally {
                 this[getterName] = function() { return this[fieldName]; };
@@ -1152,7 +1183,7 @@
         .add(new jsAst.FunctionDeclaration(constructorName, constructorAst));
 
     String fieldNamesProperty = FIELD_NAMES_PROPERTY_NAME;
-    bool hasIsolateSupport = compiler.resolverWorld.hasIsolateSupport;
+    bool hasIsolateSupport = backend.hasIsolateSupport;
     jsAst.Node fieldNamesArray;
     if (hasIsolateSupport) {
       fieldNamesArray =
@@ -1196,7 +1227,7 @@
     for (TypedefElement typedef in typedefsNeededForReflection) {
       LibraryElement library = typedef.library;
       // TODO(karlklose): add a TypedefBuilder and move this code there.
-      DartType type = typedef.alias;
+      ResolutionDartType type = typedef.alias;
       // TODO(zarah): reify type variables once reflection on type arguments of
       // typedefs is supported.
       jsAst.Expression typeIndex =
@@ -1210,8 +1241,8 @@
       // We can be pretty sure that the objectClass is initialized, since
       // typedefs are only emitted with reflection, which requires lots of
       // classes.
-      assert(coreClasses.objectClass != null);
-      builder.superName = namer.className(coreClasses.objectClass);
+      assert(commonElements.objectClass != null);
+      builder.superName = namer.className(commonElements.objectClass);
       jsAst.Node declaration = builder.toObjectInitializer();
       jsAst.Name mangledName = namer.globalPropertyName(typedef);
       String reflectionName = getReflectionName(typedef, mangledName);
@@ -1863,7 +1894,8 @@
       // specific to the class. For now, not supported for native classes and
       // native elements.
       ClassElement cls = element.enclosingClassOrCompilationUnit.declaration;
-      if (compiler.codegenWorld.directlyInstantiatedClasses.contains(cls) &&
+      if (compiler.codegenWorldBuilder.directlyInstantiatedClasses
+              .contains(cls) &&
           !backend.isNative(cls) &&
           compiler.deferredLoadTask.outputUnitForElement(element) ==
               compiler.deferredLoadTask.outputUnitForElement(cls)) {
@@ -2153,8 +2185,6 @@
     for (Element element in backend.codegenEnqueuer.newlyEnqueuedElements) {
       if (element.isInstanceMember) {
         cachedClassBuilders.remove(element.enclosingClass);
-
-        nativeEmitter.cachedBuilders.remove(element.enclosingClass);
       }
     }
   }
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/interceptor_emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/interceptor_emitter.dart
index 0da9ca3..516641d 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/interceptor_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/interceptor_emitter.dart
@@ -2,22 +2,33 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter.full_emitter;
+library dart2js.js_emitter.full_emitter.interceptor_emitter;
+
+import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
+import '../../elements/entities.dart';
+import '../../js/js.dart' as jsAst;
+import '../../js/js.dart' show js;
+import '../../world.dart' show ClosedWorld;
+import '../js_emitter.dart' hide Emitter, EmitterFactory;
+import '../model.dart';
+import 'emitter.dart';
 
 class InterceptorEmitter extends CodeEmitterHelper {
+  final ClosedWorld closedWorld;
   final Set<jsAst.Name> interceptorInvocationNames = new Set<jsAst.Name>();
 
-  void recordMangledNameOfMemberMethod(
-      FunctionElement member, jsAst.Name name) {
+  InterceptorEmitter(this.closedWorld);
+
+  void recordMangledNameOfMemberMethod(MemberEntity member, jsAst.Name name) {
     if (backend.isInterceptedMethod(member)) {
       interceptorInvocationNames.add(name);
     }
   }
 
   jsAst.Expression buildGetInterceptorMethod(
-      jsAst.Name key, Set<ClassElement> classes) {
+      jsAst.Name key, Set<ClassEntity> classes) {
     InterceptorStubGenerator stubGenerator =
-        new InterceptorStubGenerator(compiler, namer, backend);
+        new InterceptorStubGenerator(compiler, namer, backend, closedWorld);
     jsAst.Expression function =
         stubGenerator.generateGetInterceptorMethod(classes);
 
@@ -32,11 +43,11 @@
 
     parts.add(js.comment('getInterceptor methods'));
 
-    Map<jsAst.Name, Set<ClassElement>> specializedGetInterceptors =
+    Map<jsAst.Name, Set<ClassEntity>> specializedGetInterceptors =
         backend.specializedGetInterceptors;
     List<jsAst.Name> names = specializedGetInterceptors.keys.toList()..sort();
     for (jsAst.Name name in names) {
-      Set<ClassElement> classes = specializedGetInterceptors[name];
+      Set<ClassEntity> classes = specializedGetInterceptors[name];
       parts.add(js.statement('#.# = #', [
         namer.globalObjectFor(backend.helpers.interceptorsLibrary),
         name,
@@ -53,7 +64,7 @@
       ..sort();
 
     InterceptorStubGenerator stubGenerator =
-        new InterceptorStubGenerator(compiler, namer, backend);
+        new InterceptorStubGenerator(compiler, namer, backend, closedWorld);
     String globalObject =
         namer.globalObjectFor(backend.helpers.interceptorsLibrary);
     for (jsAst.Name name in names) {
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/nsm_emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/nsm_emitter.dart
index f0a6e0f..472a2c7 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/nsm_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/nsm_emitter.dart
@@ -2,11 +2,25 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter.full_emitter;
+library dart2js.js_emitter.full_emitter.nsm_emitter;
+
+import '../../elements/entities.dart';
+import '../../js/js.dart' as jsAst;
+import '../../js/js.dart' show js;
+import '../../js_backend/js_backend.dart' show GetterName, SetterName;
+import '../../universe/selector.dart' show Selector;
+import '../../util/characters.dart' show $$, $A, $HASH, $Z, $a, $z;
+import '../../world.dart' show ClosedWorld;
+import '../js_emitter.dart' hide Emitter, EmitterFactory;
+import '../model.dart';
+import 'emitter.dart';
 
 class NsmEmitter extends CodeEmitterHelper {
+  final ClosedWorld closedWorld;
   final List<Selector> trivialNsmHandlers = <Selector>[];
 
+  NsmEmitter(this.closedWorld);
+
   /// If this is true then we can generate the noSuchMethod handlers at startup
   /// time, instead of them being emitted as part of the Object class.
   bool get generateTrivialNsmHandlers => true;
@@ -19,8 +33,9 @@
   static const MAX_MINIFIED_LENGTH_FOR_DIFF_ENCODING = 4;
 
   void emitNoSuchMethodHandlers(AddPropertyFunction addProperty) {
-    ClassStubGenerator generator =
-        new ClassStubGenerator(compiler, namer, backend);
+    ClassStubGenerator generator = new ClassStubGenerator(
+        namer, backend, codegenWorldBuilder, closedWorld,
+        enableMinification: compiler.options.enableMinification);
 
     // Keep track of the JavaScript names we've already added so we
     // do not introduce duplicates (bad for code size).
@@ -55,9 +70,9 @@
             generator.generateStubForNoSuchMethod(jsName, selector);
         addProperty(method.name, method.code);
         if (reflectionName != null) {
-          bool accessible = compiler.closedWorld.allFunctions
+          bool accessible = closedWorld.allFunctions
               .filter(selector, null)
-              .any((Element e) => backend.isAccessibleByReflection(e));
+              .any(backend.isMemberAccessibleByReflection);
           addProperty(
               namer.asName('+$reflectionName'), js(accessible ? '2' : '0'));
         }
@@ -158,7 +173,7 @@
     }
     // Startup code that loops over the method names and puts handlers on the
     // Object class to catch noSuchMethod invocations.
-    ClassElement objectClass = compiler.coreClasses.objectClass;
+    ClassEntity objectClass = compiler.commonElements.objectClass;
     jsAst.Expression createInvocationMirror = backend.emitter
         .staticFunctionAccess(backend.helpers.createInvocationMirror);
     if (useDiffEncoding) {
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart
index feaee8e..a8dc281 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart
@@ -129,16 +129,16 @@
     'enabledJsInterop': backend.jsInteropAnalysis.enabledJsInterop,
     'jsInteropBoostrap': backend.jsInteropAnalysis.buildJsInteropBootstrap(),
     'isInterceptorClass': namer.operatorIs(backend.helpers.jsInterceptorClass),
-    'isObject': namer.operatorIs(compiler.coreClasses.objectClass),
+    'isObject': namer.operatorIs(compiler.commonElements.objectClass),
     'specProperty': js.string(namer.nativeSpecProperty),
     'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(),
     'hasRetainedMetadata': backend.hasRetainedMetadata,
     'types': typesAccess,
-    'objectClassName':
-        js.quoteName(namer.runtimeTypeName(compiler.coreClasses.objectClass)),
+    'objectClassName': js.quoteName(
+        namer.runtimeTypeName(compiler.commonElements.objectClass as Entity)),
     'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo,
     'usesMangledNames': compiler.commonElements.mirrorsLibrary != null ||
-        compiler.hasFunctionApplySupport,
+        backend.hasFunctionApplySupport,
     'tearOffCode': buildTearOffCode(backend),
     'nativeInfoHandler': nativeInfoHandler,
     'operatorIsPrefix': js.string(namer.operatorIsPrefix),
@@ -499,6 +499,7 @@
           chain = targetPrototype.#deferredAction;
         }
         return function foo() {
+          if (!supportsDirectProtoAccess) return;
           var prototype = this;
           // Find the actual prototype that this handler is installed on.
           while (!prototype.hasOwnProperty(#deferredActionString)) {
diff --git a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
index 265c946..7c3337e 100644
--- a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart
@@ -2,21 +2,41 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.interceptor_stub_generator;
+
+import '../compiler.dart' show Compiler;
+import '../constants/values.dart';
+import '../elements/entities.dart';
+import '../elements/types.dart' show InterfaceType;
+import '../js/js.dart' as jsAst;
+import '../js/js.dart' show js;
+import '../js_backend/backend_helpers.dart' show BackendHelpers;
+import '../js_backend/js_backend.dart'
+    show
+        CustomElementsAnalysis,
+        JavaScriptBackend,
+        JavaScriptConstantCompiler,
+        Namer;
+import '../universe/selector.dart' show Selector;
+import '../world.dart' show ClosedWorld;
+
+import 'code_emitter_task.dart' show Emitter;
 
 class InterceptorStubGenerator {
   final Compiler compiler;
   final Namer namer;
   final JavaScriptBackend backend;
+  final ClosedWorld closedWorld;
 
-  InterceptorStubGenerator(this.compiler, this.namer, this.backend);
+  InterceptorStubGenerator(
+      this.compiler, this.namer, this.backend, this.closedWorld);
 
   Emitter get emitter => backend.emitter.emitter;
 
   BackendHelpers get helpers => backend.helpers;
 
-  jsAst.Expression generateGetInterceptorMethod(Set<ClassElement> classes) {
-    jsAst.Expression interceptorFor(ClassElement cls) {
+  jsAst.Expression generateGetInterceptorMethod(Set<ClassEntity> classes) {
+    jsAst.Expression interceptorFor(ClassEntity cls) {
       return backend.emitter.interceptorPrototypeAccess(cls);
     }
 
@@ -24,7 +44,7 @@
      * Build a JavaScrit AST node for doing a type check on
      * [cls]. [cls] must be a non-native interceptor class.
      */
-    jsAst.Statement buildInterceptorCheck(ClassElement cls) {
+    jsAst.Statement buildInterceptorCheck(ClassEntity cls) {
       jsAst.Expression condition;
       assert(backend.isInterceptorClass(cls));
       if (cls == helpers.jsBoolClass) {
@@ -59,7 +79,7 @@
     bool anyNativeClasses =
         compiler.enqueuer.codegen.nativeEnqueuer.hasInstantiatedNativeClasses;
 
-    for (ClassElement cls in classes) {
+    for (ClassEntity cls in classes) {
       if (cls == helpers.jsArrayClass ||
           cls == helpers.jsMutableArrayClass ||
           cls == helpers.jsFixedArrayClass ||
@@ -160,16 +180,18 @@
       }''',
           [
             interceptorFor(helpers.jsJavaScriptFunctionClass),
-            backend.emitter.constructorAccess(compiler.coreClasses.objectClass),
+            backend.emitter
+                .constructorAccess(compiler.commonElements.objectClass),
             backend.emitter
                 .staticFunctionAccess(helpers.getNativeInterceptorMethod)
           ]));
     } else {
-      ClassElement jsUnknown = helpers.jsUnknownJavaScriptObjectClass;
-      if (compiler.codegenWorld.directlyInstantiatedClasses
+      ClassEntity jsUnknown = helpers.jsUnknownJavaScriptObjectClass;
+      if (compiler.codegenWorldBuilder.directlyInstantiatedClasses
           .contains(jsUnknown)) {
         statements.add(js.statement('if (!(receiver instanceof #)) return #;', [
-          backend.emitter.constructorAccess(compiler.coreClasses.objectClass),
+          backend.emitter
+              .constructorAccess(compiler.commonElements.objectClass),
           interceptorFor(jsUnknown)
         ]));
       }
@@ -184,7 +206,7 @@
   // common case for a one-shot interceptor, or null if there is no
   // fast path.
   jsAst.Statement _fastPathForOneShotInterceptor(
-      Selector selector, Set<ClassElement> classes) {
+      Selector selector, Set<ClassEntity> classes) {
     if (selector.isOperator) {
       String name = selector.name;
       if (name == '==') {
@@ -248,8 +270,8 @@
       bool containsJsIndexable =
           helpers.jsIndexingBehaviorInterface.isResolved &&
               classes.any((cls) {
-                return compiler.closedWorld
-                    .isSubtypeOf(cls, helpers.jsIndexingBehaviorInterface);
+                return closedWorld.isSubtypeOf(
+                    cls, helpers.jsIndexingBehaviorInterface);
               });
       // The index set operator requires a check on its set value in
       // checked mode, so we don't optimize the interceptor if the
@@ -316,7 +338,7 @@
 
   jsAst.Expression generateOneShotInterceptor(jsAst.Name name) {
     Selector selector = backend.oneShotInterceptors[name];
-    Set<ClassElement> classes = backend.getInterceptedClassesOn(selector.name);
+    Set<ClassEntity> classes = backend.getInterceptedClassesOn(selector.name);
     jsAst.Name getInterceptorName = namer.nameForGetInterceptor(classes);
 
     List<String> parameterNames = <String>[];
@@ -357,40 +379,38 @@
     List<ConstantValue> constants =
         handler.getConstantsForEmission(emitter.compareConstants);
     for (ConstantValue constant in constants) {
-      if (constant is TypeConstantValue) {
-        TypeConstantValue typeConstant = constant;
-        Element element = typeConstant.representedType.element;
-        if (element is ClassElement) {
-          ClassElement classElement = element;
-          if (!analysis.needsClass(classElement)) continue;
+      if (constant is TypeConstantValue &&
+          constant.representedType is InterfaceType) {
+        InterfaceType type = constant.representedType;
+        ClassEntity classElement = type.element;
+        if (!analysis.needsClass(classElement)) continue;
 
-          elements.add(emitter.constantReference(constant));
-          elements.add(backend.emitter.interceptorClassAccess(classElement));
+        elements.add(emitter.constantReference(constant));
+        elements.add(backend.emitter.interceptorClassAccess(classElement));
 
-          // Create JavaScript Object map for by-name lookup of generative
-          // constructors.  For example, the class A has three generative
-          // constructors
-          //
-          //     class A {
-          //       A() {}
-          //       A.foo() {}
-          //       A.bar() {}
-          //     }
-          //
-          // Which are described by the map
-          //
-          //     {"": A.A$, "foo": A.A$foo, "bar": A.A$bar}
-          //
-          // We expect most of the time the map will be a singleton.
-          var properties = [];
-          for (Element member in analysis.constructors(classElement)) {
-            properties.add(new jsAst.Property(js.string(member.name),
-                backend.emitter.staticFunctionAccess(member)));
-          }
-
-          var map = new jsAst.ObjectInitializer(properties);
-          elements.add(map);
+        // Create JavaScript Object map for by-name lookup of generative
+        // constructors.  For example, the class A has three generative
+        // constructors
+        //
+        //     class A {
+        //       A() {}
+        //       A.foo() {}
+        //       A.bar() {}
+        //     }
+        //
+        // Which are described by the map
+        //
+        //     {"": A.A$, "foo": A.A$foo, "bar": A.A$bar}
+        //
+        // We expect most of the time the map will be a singleton.
+        var properties = [];
+        for (FunctionEntity member in analysis.constructors(classElement)) {
+          properties.add(new jsAst.Property(js.string(member.name),
+              backend.emitter.staticFunctionAccess(member)));
         }
+
+        var map = new jsAst.ObjectInitializer(properties);
+        elements.add(map);
       }
     }
 
diff --git a/pkg/compiler/lib/src/js_emitter/js_emitter.dart b/pkg/compiler/lib/src/js_emitter/js_emitter.dart
index e902ab5..f026734 100644
--- a/pkg/compiler/lib/src/js_emitter/js_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/js_emitter.dart
@@ -4,74 +4,17 @@
 
 library dart2js.js_emitter;
 
-import 'package:js_ast/src/precedence.dart' as js_precedence;
-import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
-import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin;
+import '../elements/elements.dart' show ClassElement, MixinApplicationElement;
 
-import '../closure.dart'
-    show ClosureClassElement, ClosureClassMap, ClosureFieldElement;
-import '../common.dart';
-import '../common/names.dart' show Identifiers;
-import '../common/tasks.dart' show CompilerTask;
-import '../compiler.dart' show Compiler;
-import '../constants/values.dart';
-import '../core_types.dart' show CoreClasses;
-import '../dart_types.dart'
-    show
-        DartType,
-        FunctionType,
-        InterfaceType,
-        TypedefType,
-        Types,
-        TypeVariableType;
-import '../deferred_load.dart' show OutputUnit;
-import '../elements/elements.dart'
-    show
-        ClassElement,
-        ConstructorElement,
-        Element,
-        ElementKind,
-        FieldElement,
-        FunctionElement,
-        FunctionSignature,
-        MetadataAnnotation,
-        MethodElement,
-        MixinApplicationElement,
-        ParameterElement,
-        TypeVariableElement;
-import '../js/js.dart' as jsAst;
-import '../js/js.dart' show js;
-import '../js_backend/backend_helpers.dart' show BackendHelpers;
-import '../js_backend/js_backend.dart'
-    show
-        CustomElementsAnalysis,
-        JavaScriptBackend,
-        JavaScriptConstantCompiler,
-        Namer,
-        RuntimeTypes,
-        RuntimeTypesEncoder,
-        Substitution,
-        TypeCheck,
-        TypeChecks,
-        TypeVariableHandler;
-import '../universe/call_structure.dart' show CallStructure;
-import '../universe/selector.dart' show Selector;
-import '../universe/world_builder.dart' show SelectorConstraints;
-import '../util/util.dart' show Setlet;
-import 'full_emitter/emitter.dart' as full_js_emitter;
-import 'lazy_emitter/emitter.dart' as lazy_js_emitter;
-import 'model.dart';
-import 'program_builder/program_builder.dart';
-import 'startup_emitter/emitter.dart' as startup_js_emitter;
+export 'class_stub_generator.dart';
+export 'code_emitter_task.dart';
+export 'interceptor_stub_generator.dart';
+export 'main_call_stub_generator.dart';
+export 'metadata_collector.dart';
+export 'native_emitter.dart';
+export 'native_generator.dart';
+export 'parameter_stub_generator.dart';
+export 'runtime_type_generator.dart';
+export 'type_test_registry.dart';
 
-part 'class_stub_generator.dart';
-part 'code_emitter_task.dart';
 part 'helpers.dart';
-part 'interceptor_stub_generator.dart';
-part 'main_call_stub_generator.dart';
-part 'metadata_collector.dart';
-part 'native_emitter.dart';
-part 'native_generator.dart';
-part 'parameter_stub_generator.dart';
-part 'runtime_type_generator.dart';
-part 'type_test_registry.dart';
diff --git a/pkg/compiler/lib/src/js_emitter/lazy_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/lazy_emitter/emitter.dart
index 64e1f79b..ab86f53 100644
--- a/pkg/compiler/lib/src/js_emitter/lazy_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/lazy_emitter/emitter.dart
@@ -9,16 +9,32 @@
 import '../../common.dart';
 import '../../compiler.dart' show Compiler;
 import '../../constants/values.dart' show ConstantValue;
+import '../../deferred_load.dart' show OutputUnit;
 import '../../elements/elements.dart'
-    show ClassElement, Element, FieldElement, FunctionElement;
+    show ClassElement, Element, Entity, FieldElement, MethodElement;
 import '../../js/js.dart' as js;
 import '../../js_backend/js_backend.dart' show JavaScriptBackend, Namer;
-import '../js_emitter.dart' show NativeEmitter;
-import '../js_emitter.dart' as emitterTask show Emitter;
+import '../../world.dart' show ClosedWorld;
+import '../js_emitter.dart' show CodeEmitterTask, NativeEmitter;
+import '../js_emitter.dart' as emitterTask show Emitter, EmitterFactory;
 import '../model.dart';
 import '../program_builder/program_builder.dart' show ProgramBuilder;
 import 'model_emitter.dart';
 
+class EmitterFactory implements emitterTask.EmitterFactory {
+  @override
+  String get patchVersion => "lazy";
+
+  @override
+  bool get supportsReflection => false;
+
+  @override
+  Emitter createEmitter(
+      CodeEmitterTask task, Namer namer, ClosedWorld closedWorld) {
+    return new Emitter(task.compiler, namer, task.nativeEmitter);
+  }
+}
+
 class Emitter implements emitterTask.Emitter {
   final Compiler _compiler;
   final Namer namer;
@@ -34,17 +50,11 @@
   DiagnosticReporter get reporter => _compiler.reporter;
 
   @override
-  String get patchVersion => "lazy";
-
-  @override
   int emitProgram(ProgramBuilder programBuilder) {
     Program program = programBuilder.buildProgram();
     return _emitter.emitProgram(program);
   }
 
-  @override
-  bool get supportsReflection => false;
-
   // TODO(floitsch): copied from full emitter. Adjust or share.
   @override
   bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) {
@@ -87,7 +97,7 @@
   }
 
   @override
-  js.Expression isolateStaticClosureAccess(FunctionElement element) {
+  js.Expression isolateStaticClosureAccess(MethodElement element) {
     return _emitter.generateStaticClosureAccess(element);
   }
 
@@ -97,7 +107,7 @@
   }
 
   @override
-  js.PropertyAccess staticFunctionAccess(FunctionElement element) {
+  js.PropertyAccess staticFunctionAccess(MethodElement element) {
     return _globalPropertyAccess(element);
   }
 
@@ -122,7 +132,7 @@
   }
 
   @override
-  js.Expression typeAccess(Element element) {
+  js.Expression typeAccess(Entity element) {
     // TODO(floitsch): minify 'ensureResolved'.
     // TODO(floitsch): don't emit `ensureResolved` for eager classes.
     return js.js('#.ensureResolved()', _globalPropertyAccess(element));
@@ -135,7 +145,7 @@
     switch (builtin) {
       case JsBuiltin.dartObjectConstructor:
         return js.js.expressionTemplateYielding(
-            typeAccess(_compiler.coreClasses.objectClass));
+            typeAccess(_compiler.commonElements.objectClass));
 
       case JsBuiltin.isCheckPropertyToJsConstructorName:
         int isPrefixLength = namer.operatorIsPrefix.length;
@@ -179,5 +189,9 @@
   }
 
   @override
+  // TODO(het): Generate this correctly
+  int generatedSize(OutputUnit unit) => 0;
+
+  @override
   void invalidateCaches() {}
 }
diff --git a/pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart
index 53f12e3..570526a 100644
--- a/pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/lazy_emitter/model_emitter.dart
@@ -22,8 +22,8 @@
 
 import '../../compiler.dart' show Compiler;
 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue;
-import '../../core_types.dart' show CoreClasses;
-import '../../elements/elements.dart' show ClassElement, FunctionElement;
+import '../../core_types.dart' show CommonElements;
+import '../../elements/elements.dart' show ClassElement, MethodElement;
 import '../../js/js.dart' as js;
 import '../../js_backend/js_backend.dart'
     show JavaScriptBackend, Namer, ConstantEmitter;
@@ -103,7 +103,7 @@
     return deepCompareConstants(a, b);
   }
 
-  js.Expression generateStaticClosureAccess(FunctionElement element) {
+  js.Expression generateStaticClosureAccess(MethodElement element) {
     return js.js('#.#()',
         [namer.globalObjectFor(element), namer.staticClosureName(element)]);
   }
@@ -342,17 +342,17 @@
   js.Property emitMangledGlobalNames() {
     List<js.Property> names = <js.Property>[];
 
-    CoreClasses coreClasses = compiler.coreClasses;
+    CommonElements commonElements = compiler.commonElements;
     // We want to keep the original names for the most common core classes when
     // calling toString on them.
     List<ClassElement> nativeClassesNeedingUnmangledName = [
-      coreClasses.intClass,
-      coreClasses.doubleClass,
-      coreClasses.numClass,
-      coreClasses.stringClass,
-      coreClasses.boolClass,
-      coreClasses.nullClass,
-      coreClasses.listClass
+      commonElements.intClass,
+      commonElements.doubleClass,
+      commonElements.numClass,
+      commonElements.stringClass,
+      commonElements.boolClass,
+      commonElements.nullClass,
+      commonElements.listClass
     ];
     nativeClassesNeedingUnmangledName.forEach((element) {
       names.add(new js.Property(
@@ -860,7 +860,8 @@
         data.add(js.quoteName(method.callName, allowNull: true));
 
         if (method.needsTearOff) {
-          bool isIntercepted = backend.isInterceptedMethod(method.element);
+          MethodElement element = method.element;
+          bool isIntercepted = backend.isInterceptedMethod(element);
           data.add(new js.LiteralBool(isIntercepted));
           data.add(js.quoteName(method.tearOffName));
           data.add((method.functionType));
diff --git a/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart
index 55824e8..3586026 100644
--- a/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart
@@ -2,21 +2,32 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.main_call_stub_generator;
+
+import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
+
+import '../elements/entities.dart';
+import '../js/js.dart' as jsAst;
+import '../js/js.dart' show js;
+import '../js_backend/backend_helpers.dart' show BackendHelpers;
+import '../js_backend/js_backend.dart' show JavaScriptBackend;
+
+import 'code_emitter_task.dart' show CodeEmitterTask;
 
 class MainCallStubGenerator {
-  final Compiler compiler;
   final JavaScriptBackend backend;
   final CodeEmitterTask emitterTask;
+  final bool hasIncrementalSupport;
 
-  MainCallStubGenerator(this.compiler, this.backend, this.emitterTask);
+  MainCallStubGenerator(this.backend, this.emitterTask,
+      {this.hasIncrementalSupport: false});
 
   BackendHelpers get helpers => backend.helpers;
 
   /// Returns the code equivalent to:
   ///   `function(args) { $.startRootIsolate(X.main$closure(), args); }`
   jsAst.Expression _buildIsolateSetupClosure(
-      Element appMain, Element isolateMain) {
+      FunctionEntity appMain, FunctionEntity isolateMain) {
     jsAst.Expression mainAccess =
         emitterTask.isolateStaticClosureAccess(appMain);
     // Since we pass the closurized version of the main method to
@@ -25,14 +36,12 @@
         [emitterTask.staticFunctionAccess(isolateMain), mainAccess]);
   }
 
-  jsAst.Statement generateInvokeMain() {
-    Element main = compiler.mainFunction;
+  jsAst.Statement generateInvokeMain(FunctionEntity main) {
     jsAst.Expression mainCallClosure = null;
-    if (compiler.resolverWorld.hasIsolateSupport) {
-      Element isolateMain =
-          helpers.isolateHelperLibrary.find(BackendHelpers.START_ROOT_ISOLATE);
+    if (backend.hasIsolateSupport) {
+      FunctionEntity isolateMain = helpers.startRootIsolate;
       mainCallClosure = _buildIsolateSetupClosure(main, isolateMain);
-    } else if (compiler.options.hasIncrementalSupport) {
+    } else if (hasIncrementalSupport) {
       mainCallClosure = js(
           'function() { return #(); }', emitterTask.staticFunctionAccess(main));
     } else {
diff --git a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
index d918135..6c84560 100644
--- a/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
+++ b/pkg/compiler/lib/src/js_emitter/metadata_collector.dart
@@ -2,7 +2,30 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.metadata_collector;
+
+import 'package:js_ast/src/precedence.dart' as js_precedence;
+
+import '../common.dart';
+import '../compiler.dart' show Compiler;
+import '../constants/values.dart';
+import '../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionTypedefType;
+import '../deferred_load.dart' show OutputUnit;
+import '../elements/elements.dart'
+    show
+        ConstructorElement,
+        Element,
+        FunctionElement,
+        FunctionSignature,
+        MetadataAnnotation,
+        ParameterElement;
+import '../js/js.dart' as jsAst;
+import '../js/js.dart' show js;
+import '../js_backend/js_backend.dart'
+    show JavaScriptBackend, TypeVariableHandler;
+
+import 'code_emitter_task.dart' show Emitter;
 
 /// Represents an entry's position in one of the global metadata arrays.
 ///
@@ -130,8 +153,8 @@
   }
 
   /// A map used to canonicalize the entries of types.
-  Map<OutputUnit, Map<DartType, _BoundMetadataEntry>> _typesMap =
-      <OutputUnit, Map<DartType, _BoundMetadataEntry>>{};
+  Map<OutputUnit, Map<ResolutionDartType, _BoundMetadataEntry>> _typesMap =
+      <OutputUnit, Map<ResolutionDartType, _BoundMetadataEntry>>{};
 
   // To support incremental compilation, we have to be able to eagerly emit
   // metadata and add metadata later on. We use the below two counters for
@@ -247,8 +270,8 @@
       int i = source.requiredParameterCount;
       for (ParameterElement element in source.orderedOptionalParameters) {
         if (i >= target.requiredParameterCount && i < target.parameterCount) {
-          map[element] = target.orderedOptionalParameters[
-              i - target.requiredParameterCount];
+          map[element] = target
+              .orderedOptionalParameters[i - target.requiredParameterCount];
         }
         ++i;
       }
@@ -266,13 +289,15 @@
     return _addGlobalMetadata(_emitter.constantReference(constant));
   }
 
-  jsAst.Expression reifyType(DartType type, {ignoreTypeVariables: false}) {
+  jsAst.Expression reifyType(ResolutionDartType type,
+      {ignoreTypeVariables: false}) {
     return reifyTypeForOutputUnit(
         type, _compiler.deferredLoadTask.mainOutputUnit,
         ignoreTypeVariables: ignoreTypeVariables);
   }
 
-  jsAst.Expression reifyTypeForOutputUnit(DartType type, OutputUnit outputUnit,
+  jsAst.Expression reifyTypeForOutputUnit(
+      ResolutionDartType type, OutputUnit outputUnit,
       {ignoreTypeVariables: false}) {
     return addTypeInOutputUnit(type, outputUnit,
         ignoreTypeVariables: ignoreTypeVariables);
@@ -303,13 +328,13 @@
     });
   }
 
-  jsAst.Expression _computeTypeRepresentation(DartType type,
+  jsAst.Expression _computeTypeRepresentation(ResolutionDartType type,
       {ignoreTypeVariables: false}) {
     jsAst.Expression representation =
         _backend.rtiEncoder.getTypeRepresentation(type, (variable) {
       if (ignoreTypeVariables) return new jsAst.LiteralNull();
       return _typeVariableHandler.reifyTypeVariable(variable.element);
-    }, (TypedefType typedef) {
+    }, (ResolutionTypedefType typedef) {
       return _backend.isAccessibleByReflection(typedef.element);
     });
 
@@ -323,10 +348,12 @@
     return representation;
   }
 
-  jsAst.Expression addTypeInOutputUnit(DartType type, OutputUnit outputUnit,
+  jsAst.Expression addTypeInOutputUnit(
+      ResolutionDartType type, OutputUnit outputUnit,
       {ignoreTypeVariables: false}) {
     if (_typesMap[outputUnit] == null) {
-      _typesMap[outputUnit] = new Map<DartType, _BoundMetadataEntry>();
+      _typesMap[outputUnit] =
+          new Map<ResolutionDartType, _BoundMetadataEntry>();
     }
     return _typesMap[outputUnit].putIfAbsent(type, () {
       _BoundMetadataEntry result = new _BoundMetadataEntry(
diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart
index 62070c2..b4473a6 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -6,7 +6,7 @@
 
 import '../constants/values.dart' show ConstantValue;
 import '../deferred_load.dart' show OutputUnit;
-import '../elements/elements.dart' show Element;
+import '../elements/entities.dart';
 import '../js/js.dart' as js show Expression, Name, Statement, TokenFinalizer;
 import 'js_emitter.dart' show MetadataCollector;
 
@@ -178,7 +178,7 @@
 class Library implements FieldContainer {
   /// The element should only be used during the transition to the new model.
   /// Uses indicate missing information in the model.
-  final Element element;
+  final LibraryEntity element;
 
   final String uri;
   final List<StaticMethod> statics;
@@ -193,7 +193,7 @@
 class StaticField {
   /// The element should only be used during the transition to the new model.
   /// Uses indicate missing information in the model.
-  final Element element;
+  final FieldEntity element;
 
   js.Name name;
   // TODO(floitsch): the holder for static fields is the isolate object. We
@@ -210,7 +210,7 @@
 class Class implements FieldContainer {
   /// The element should only be used during the transition to the new model.
   /// Uses indicate missing information in the model.
-  final Element element;
+  final ClassEntity element;
 
   final js.Name name;
   final Holder holder;
@@ -289,7 +289,7 @@
   Class _mixinClass;
 
   MixinApplication(
-      Element element,
+      ClassEntity element,
       js.Name name,
       Holder holder,
       List<Field> instanceFields,
@@ -335,7 +335,7 @@
 class Field {
   /// The element should only be used during the transition to the new model.
   /// Uses indicate missing information in the model.
-  final Element element;
+  final FieldEntity element;
 
   final js.Name name;
   final js.Name accessorName;
@@ -374,7 +374,7 @@
 abstract class Method {
   /// The element should only be used during the transition to the new model.
   /// Uses indicate missing information in the model.
-  final Element element;
+  final MemberEntity element;
 
   /// The name of the method. If the method is a [ParameterStubMethod] for a
   /// static function, then the name can be `null`. In that case, only the
@@ -410,7 +410,7 @@
   // `call$1$name` (in unminified mode).
   final js.Name callName;
 
-  DartMethod(Element element, js.Name name, js.Expression code,
+  DartMethod(FunctionEntity element, js.Name name, js.Expression code,
       this.parameterStubs, this.callName,
       {this.needsTearOff,
       this.tearOffName,
@@ -444,7 +444,7 @@
   /// functions that can be torn off.
   final bool isClosureCallMethod;
 
-  InstanceMethod(Element element, js.Name name, js.Expression code,
+  InstanceMethod(FunctionEntity element, js.Name name, js.Expression code,
       List<ParameterStubMethod> parameterStubs, js.Name callName,
       {bool needsTearOff,
       js.Name tearOffName,
@@ -473,7 +473,7 @@
 /// to a method in the original Dart program. Examples are getter and setter
 /// stubs and stubs to dispatch calls to methods with optional parameters.
 class StubMethod extends Method {
-  StubMethod(js.Name name, js.Expression code, {Element element})
+  StubMethod(js.Name name, js.Expression code, {MemberEntity element})
       : super(element, name, code);
 }
 
@@ -506,7 +506,7 @@
   final Holder holder;
 
   StaticDartMethod(
-      Element element,
+      FunctionEntity element,
       js.Name name,
       this.holder,
       js.Expression code,
diff --git a/pkg/compiler/lib/src/js_emitter/native_emitter.dart b/pkg/compiler/lib/src/js_emitter/native_emitter.dart
index 2e5f457..c49895a 100644
--- a/pkg/compiler/lib/src/js_emitter/native_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/native_emitter.dart
@@ -2,32 +2,39 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.native_emitter;
+
+import '../common.dart';
+import '../compiler.dart' show Compiler;
+import '../elements/types.dart' show DartType, FunctionType;
+import '../elements/entities.dart';
+import '../js/js.dart' as jsAst;
+import '../js/js.dart' show js;
+import '../js_backend/backend_helpers.dart' show BackendHelpers;
+import '../js_backend/js_backend.dart' show JavaScriptBackend;
+import '../universe/world_builder.dart' show CodegenWorldBuilder;
+
+import 'code_emitter_task.dart' show CodeEmitterTask;
+import 'model.dart';
 
 class NativeEmitter {
-  // TODO(floitsch): the native-emitter should not know about ClassBuilders.
-  final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders;
-
   final CodeEmitterTask emitterTask;
 
   // Whether the application contains native classes.
   bool hasNativeClasses = false;
 
   // Caches the native subtypes of a native class.
-  Map<ClassElement, List<ClassElement>> subtypes;
+  Map<ClassEntity, List<ClassEntity>> subtypes =
+      <ClassEntity, List<ClassEntity>>{};
 
   // Caches the direct native subtypes of a native class.
-  Map<ClassElement, List<ClassElement>> directSubtypes;
+  Map<ClassEntity, List<ClassEntity>> directSubtypes =
+      <ClassEntity, List<ClassEntity>>{};
 
   // Caches the methods that have a native body.
-  Set<FunctionElement> nativeMethods;
+  Set<FunctionEntity> nativeMethods = new Set<FunctionEntity>();
 
-  NativeEmitter(CodeEmitterTask emitterTask)
-      : this.emitterTask = emitterTask,
-        subtypes = new Map<ClassElement, List<ClassElement>>(),
-        directSubtypes = new Map<ClassElement, List<ClassElement>>(),
-        nativeMethods = new Set<FunctionElement>(),
-        cachedBuilders = emitterTask.compiler.cacheStrategy.newMap();
+  NativeEmitter(CodeEmitterTask emitterTask) : this.emitterTask = emitterTask;
 
   Compiler get compiler => emitterTask.compiler;
 
@@ -35,6 +42,8 @@
 
   BackendHelpers get helpers => backend.helpers;
 
+  CodegenWorldBuilder get worldBuilder => compiler.codegenWorldBuilder;
+
   /**
    * Prepares native classes for emission. Returns the unneeded classes.
    *
@@ -67,8 +76,8 @@
    */
   Set<Class> prepareNativeClasses(
       List<Class> classes,
-      Set<ClassElement> interceptorClassesNeededByConstants,
-      Set<ClassElement> classesModifiedByEmitRTISupport) {
+      Set<ClassEntity> interceptorClassesNeededByConstants,
+      Set<ClassEntity> classesModifiedByEmitRTISupport) {
     assert(classes.every((Class cls) => cls != null));
 
     hasNativeClasses = classes.isNotEmpty;
@@ -83,7 +92,7 @@
     Class jsInterceptorClass = null;
 
     void walk(Class cls) {
-      if (cls.element == compiler.coreClasses.objectClass) {
+      if (cls.element == compiler.commonElements.objectClass) {
         objectClass = cls;
         return;
       }
@@ -111,7 +120,7 @@
     neededClasses.add(objectClass);
 
     for (Class cls in preOrder.reversed) {
-      ClassElement classElement = cls.element;
+      ClassEntity classElement = cls.element;
       // Post-order traversal ensures we visit the subclasses before their
       // superclass.  This makes it easy to tell if a class is needed because a
       // subclass is needed.
@@ -132,7 +141,7 @@
       } else if (extensionPoints.containsKey(cls)) {
         needed = true;
       }
-      if (backend.isJsInterop(classElement)) {
+      if (backend.isJsInteropClass(classElement)) {
         needed = true; // TODO(jacobr): we don't need all interop classes.
       } else if (cls.isNative &&
           backend.nativeData.hasNativeTagsForcedNonLeaf(classElement)) {
@@ -154,7 +163,8 @@
 
     for (Class cls in classes) {
       if (!cls.isNative) continue;
-      if (backend.isJsInterop(cls.element)) continue;
+      ClassEntity element = cls.element;
+      if (backend.isJsInteropClass(element)) continue;
       List<String> nativeTags =
           backend.nativeData.getNativeTagsOfClass(cls.element);
 
@@ -253,23 +263,21 @@
   }
 
   void potentiallyConvertDartClosuresToJs(List<jsAst.Statement> statements,
-      FunctionElement member, List<jsAst.Parameter> stubParameters) {
-    FunctionSignature parameters = member.functionSignature;
-    Element converter = helpers.closureConverter;
+      FunctionEntity member, List<jsAst.Parameter> stubParameters) {
+    FunctionEntity converter = helpers.closureConverter;
     jsAst.Expression closureConverter =
         emitterTask.staticFunctionAccess(converter);
-    parameters.forEachParameter((ParameterElement parameter) {
-      String name = parameter.name;
+    worldBuilder.forEachParameter(member, (DartType type, String name) {
       // If [name] is not in [stubParameters], then the parameter is an optional
       // parameter that was not provided for this stub.
       for (jsAst.Parameter stubParameter in stubParameters) {
         if (stubParameter.name == name) {
-          DartType type = parameter.type.unaliased;
-          if (type is FunctionType) {
+          type = type.unaliased;
+          if (type.isFunctionType) {
             // The parameter type is a function type either directly or through
             // typedef(s).
             FunctionType functionType = type;
-            int arity = functionType.computeArity();
+            int arity = functionType.parameterTypes.length;
             statements.add(js
                 .statement('# = #(#, $arity)', [name, closureConverter, name]));
             break;
@@ -280,7 +288,7 @@
   }
 
   List<jsAst.Statement> generateParameterStubStatements(
-      FunctionElement member,
+      FunctionEntity member,
       bool isInterceptedMethod,
       jsAst.Name invocationName,
       List<jsAst.Parameter> stubParameters,
@@ -316,7 +324,7 @@
       assert(invariant(member, member.isStatic));
       arguments = argumentsBuffer.sublist(
           0, indexOfLastOptionalArgumentInParameters + 1);
-      if (backend.isJsInterop(member)) {
+      if (backend.isJsInteropMethod(member)) {
         // fixedBackendPath is allowed to have the form foo.bar.baz for
         // interop. This template is uncached to avoid possibly running out of
         // memory when Dart2Js is run in server mode. In reality the risk of
@@ -324,7 +332,8 @@
         // and library that uses typed JavaScript interop will create only 1
         // unique template.
         receiver = js
-            .uncachedExpressionTemplate(backend.namer.fixedBackendPath(member))
+            .uncachedExpressionTemplate(
+                backend.namer.fixedBackendMethodPath(member))
             .instantiate([]);
       } else {
         receiver = js('this');
@@ -336,7 +345,7 @@
     return statements;
   }
 
-  bool isSupertypeOfNativeClass(ClassElement element) {
+  bool isSupertypeOfNativeClass(ClassEntity element) {
     if (backend.classesMixedIntoInterceptedClasses.contains(element)) {
       return true;
     }
@@ -344,15 +353,14 @@
     return subtypes[element] != null;
   }
 
-  bool requiresNativeIsCheck(Element element) {
+  bool requiresNativeIsCheck(ClassEntity element) {
     // TODO(sra): Remove this function.  It determines if a native type may
     // satisfy a check against [element], in which case an interceptor must be
     // used.  We should also use an interceptor if the check can't be satisfied
     // by a native class in case we get a native instance that tries to spoof
     // the type info.  i.e the criteria for whether or not to use an interceptor
     // is whether the receiver can be native, not the type of the test.
-    if (element == null || !element.isClass) return false;
-    ClassElement cls = element;
+    ClassEntity cls = element;
     if (backend.isNativeOrExtendsNative(cls)) return true;
     return isSupertypeOfNativeClass(element);
   }
diff --git a/pkg/compiler/lib/src/js_emitter/native_generator.dart b/pkg/compiler/lib/src/js_emitter/native_generator.dart
index 4dfa36c..b44034c 100644
--- a/pkg/compiler/lib/src/js_emitter/native_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/native_generator.dart
@@ -2,7 +2,15 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.native_generator;
+
+import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
+
+import '../js/js.dart' as jsAst;
+import '../js/js.dart' show js;
+import '../js_backend/js_backend.dart' show JavaScriptBackend;
+
+import 'model.dart';
 
 class NativeGenerator {
   static bool needsIsolateAffinityTagInitialization(JavaScriptBackend backend) {
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 c63527d..0e5d681 100644
--- a/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart
@@ -2,7 +2,31 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.parameter_stub_generator;
+
+import '../closure.dart' show ClosureClassElement;
+import '../common.dart';
+import '../compiler.dart' show Compiler;
+import '../constants/values.dart';
+import '../elements/elements.dart'
+    show
+        ClassElement,
+        FunctionElement,
+        FunctionSignature,
+        MethodElement,
+        ParameterElement;
+import '../js/js.dart' as jsAst;
+import '../js/js.dart' show js;
+import '../js_backend/js_backend.dart'
+    show JavaScriptBackend, JavaScriptConstantCompiler, Namer;
+import '../universe/call_structure.dart' show CallStructure;
+import '../universe/selector.dart' show Selector;
+import '../universe/world_builder.dart' show SelectorConstraints;
+import '../world.dart' show ClosedWorld;
+
+import 'model.dart';
+
+import 'code_emitter_task.dart' show CodeEmitterTask, Emitter;
 
 class ParameterStubGenerator {
   static final Set<Selector> emptySelectorSet = new Set<Selector>();
@@ -10,15 +34,17 @@
   final Namer namer;
   final Compiler compiler;
   final JavaScriptBackend backend;
+  final ClosedWorld closedWorld;
 
-  ParameterStubGenerator(this.compiler, this.namer, this.backend);
+  ParameterStubGenerator(
+      this.compiler, this.namer, this.backend, this.closedWorld);
 
   Emitter get emitter => backend.emitter.emitter;
   CodeEmitterTask get emitterTask => backend.emitter;
   DiagnosticReporter get reporter => compiler.reporter;
 
   bool needsSuperGetter(FunctionElement element) =>
-      compiler.codegenWorld.methodsNeedingSuperGetter.contains(element);
+      compiler.codegenWorldBuilder.methodsNeedingSuperGetter.contains(element);
 
   /**
    * Generates stubs to handle invocation of methods with optional
@@ -37,7 +63,7 @@
    * the input selector is non-null (and the member needs a stub).
    */
   ParameterStubMethod generateParameterStub(
-      FunctionElement member, Selector selector, Selector callSelector) {
+      MethodElement member, Selector selector, Selector callSelector) {
     CallStructure callStructure = selector.callStructure;
     FunctionSignature parameters = member.functionSignature;
     int positionalArgumentCount = callStructure.positionalArgumentCount;
@@ -212,12 +238,12 @@
 
     // Only instance members (not static methods) need stubs.
     if (member.isInstanceMember) {
-      selectors = compiler.codegenWorld.invocationsByName(member.name);
+      selectors = compiler.codegenWorldBuilder.invocationsByName(member.name);
     }
 
     if (canTearOff) {
       String call = namer.closureInvocationSelectorName;
-      callSelectors = compiler.codegenWorld.invocationsByName(call);
+      callSelectors = compiler.codegenWorldBuilder.invocationsByName(call);
     }
 
     assert(emptySelectorSet.isEmpty);
@@ -267,8 +293,7 @@
     for (Selector selector in selectors.keys) {
       if (renamedCallSelectors.contains(selector)) continue;
       if (!selector.appliesUnnamed(member)) continue;
-      if (!selectors[selector]
-          .applies(member, selector, compiler.closedWorld)) {
+      if (!selectors[selector].applies(member, selector, closedWorld)) {
         continue;
       }
 
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/collector.dart b/pkg/compiler/lib/src/js_emitter/program_builder/collector.dart
index 6e43f98..01b3a99 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/collector.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/collector.dart
@@ -14,6 +14,7 @@
   // TODO(floitsch): the code-emitter task should not need a namer.
   final Namer namer;
   final Compiler compiler;
+  final ClosedWorld closedWorld;
   final Set<ClassElement> rtiNeededClasses;
   final Emitter emitter;
 
@@ -44,9 +45,10 @@
 
   BackendHelpers get helpers => backend.helpers;
 
-  CoreClasses get coreClasses => compiler.coreClasses;
+  CommonElements get commonElements => compiler.commonElements;
 
-  Collector(this.compiler, this.namer, this.rtiNeededClasses, this.emitter);
+  Collector(this.compiler, this.namer, this.closedWorld, this.rtiNeededClasses,
+      this.emitter);
 
   Set<ClassElement> computeInterceptorsReferencedFromConstants() {
     Set<ClassElement> classes = new Set<ClassElement>();
@@ -55,7 +57,7 @@
     for (ConstantValue constant in constants) {
       if (constant is InterceptorConstantValue) {
         InterceptorConstantValue interceptorConstant = constant;
-        classes.add(interceptorConstant.dispatchedType.element);
+        classes.add(interceptorConstant.cls);
       }
     }
     return classes;
@@ -71,7 +73,7 @@
     Set<ClassElement> unneededClasses = new Set<ClassElement>();
     // The [Bool] class is not marked as abstract, but has a factory
     // constructor that always throws. We never need to emit it.
-    unneededClasses.add(coreClasses.boolClass);
+    unneededClasses.add(commonElements.boolClass);
 
     // Go over specialized interceptors and then constants to know which
     // interceptors are needed.
@@ -87,7 +89,7 @@
     // Add unneeded interceptors to the [unneededClasses] set.
     for (ClassElement interceptor in backend.interceptedClasses) {
       if (!needed.contains(interceptor) &&
-          interceptor != coreClasses.objectClass) {
+          interceptor != commonElements.objectClass) {
         unneededClasses.add(interceptor);
       }
     }
@@ -129,7 +131,7 @@
         final onlyForRti = classesOnlyNeededForRti.contains(cls);
         if (!onlyForRti) {
           backend.retainMetadataOf(cls);
-          new FieldVisitor(compiler, namer).visitFields(cls, false,
+          new FieldVisitor(compiler, namer, closedWorld).visitFields(cls, false,
               (Element member, js.Name name, js.Name accessorName,
                   bool needsGetter, bool needsSetter, bool needsCheckedSetter) {
             bool needsAccessor = needsGetter || needsSetter;
@@ -169,14 +171,17 @@
   /// Compute all the classes and typedefs that must be emitted.
   void computeNeededDeclarations() {
     // Compute needed typedefs.
-    typedefsNeededForReflection = Elements.sortedByPosition(compiler
-        .closedWorld.allTypedefs
+    typedefsNeededForReflection = Elements.sortedByPosition(closedWorld
+        .allTypedefs
         .where(backend.isAccessibleByReflection)
         .toList());
 
     // Compute needed classes.
     Set<ClassElement> instantiatedClasses = compiler
-        .codegenWorld.directlyInstantiatedClasses
+        // TODO(johnniwinther): This should be accessed from a codegen closed
+        // world.
+        .codegenWorldBuilder
+        .directlyInstantiatedClasses
         .where(computeClassFilter())
         .toSet();
 
@@ -218,22 +223,22 @@
 
     // TODO(18175, floitsch): remove once issue 18175 is fixed.
     if (neededClasses.contains(helpers.jsIntClass)) {
-      neededClasses.add(coreClasses.intClass);
+      neededClasses.add(commonElements.intClass);
     }
     if (neededClasses.contains(helpers.jsDoubleClass)) {
-      neededClasses.add(coreClasses.doubleClass);
+      neededClasses.add(commonElements.doubleClass);
     }
     if (neededClasses.contains(helpers.jsNumberClass)) {
-      neededClasses.add(coreClasses.numClass);
+      neededClasses.add(commonElements.numClass);
     }
     if (neededClasses.contains(helpers.jsStringClass)) {
-      neededClasses.add(coreClasses.stringClass);
+      neededClasses.add(commonElements.stringClass);
     }
     if (neededClasses.contains(helpers.jsBoolClass)) {
-      neededClasses.add(coreClasses.boolClass);
+      neededClasses.add(commonElements.boolClass);
     }
     if (neededClasses.contains(helpers.jsArrayClass)) {
-      neededClasses.add(coreClasses.listClass);
+      neededClasses.add(commonElements.listClass);
     }
 
     // 4. Finally, sort the classes.
@@ -284,7 +289,11 @@
       list.add(element);
     }
 
-    Iterable<Element> fields = compiler.codegenWorld.allReferencedStaticFields
+    Iterable<Element> fields = compiler
+        // TODO(johnniwinther): This should be accessed from a codegen closed
+        // world.
+        .codegenWorldBuilder
+        .allReferencedStaticFields
         .where((FieldElement field) {
       if (!field.isConst) {
         return field.isField &&
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart b/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
index 1f6956d..2e19299 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/field_visitor.dart
@@ -33,10 +33,11 @@
 class FieldVisitor {
   final Compiler compiler;
   final Namer namer;
+  final ClosedWorld closedWorld;
 
   JavaScriptBackend get backend => compiler.backend;
 
-  FieldVisitor(this.compiler, this.namer);
+  FieldVisitor(this.compiler, this.namer, this.closedWorld);
 
   /**
    * Invokes [f] for each of the fields of [element].
@@ -71,8 +72,9 @@
 
     // If the class is never instantiated we still need to set it up for
     // inheritance purposes, but we can simplify its JavaScript constructor.
-    bool isInstantiated =
-        compiler.codegenWorld.directlyInstantiatedClasses.contains(element);
+    bool isInstantiated = compiler
+        .codegenWorldBuilder.directlyInstantiatedClasses
+        .contains(element);
 
     void visitField(Element holder, FieldElement field) {
       assert(invariant(element, field.isDeclaration));
@@ -140,7 +142,7 @@
     if (fieldAccessNeverThrows(field)) return false;
     if (backend.shouldRetainGetter(field)) return true;
     return field.isClassMember &&
-        compiler.codegenWorld.hasInvokedGetter(field, compiler.closedWorld);
+        compiler.codegenWorldBuilder.hasInvokedGetter(field, closedWorld);
   }
 
   bool fieldNeedsSetter(VariableElement field) {
@@ -149,7 +151,7 @@
     if (field.isFinal || field.isConst) return false;
     if (backend.shouldRetainSetter(field)) return true;
     return field.isClassMember &&
-        compiler.codegenWorld.hasInvokedSetter(field, compiler.closedWorld);
+        compiler.codegenWorldBuilder.hasInvokedSetter(field, closedWorld);
   }
 
   static bool fieldAccessNeverThrows(VariableElement field) {
@@ -164,7 +166,7 @@
   bool canAvoidGeneratedCheckedSetter(VariableElement member) {
     // We never generate accessors for top-level/static fields.
     if (!member.isInstanceMember) return true;
-    DartType type = member.type;
+    ResolutionDartType type = member.type;
     return type.treatAsDynamic || type.isObject;
   }
 }
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 3fac271..79eff9a 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
@@ -10,8 +10,9 @@
 import '../../compiler.dart' show Compiler;
 import '../../constants/values.dart'
     show ConstantValue, InterceptorConstantValue;
-import '../../core_types.dart' show CoreClasses;
-import '../../dart_types.dart' show DartType, FunctionType, TypedefType;
+import '../../core_types.dart' show CommonElements;
+import '../../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionFunctionType, ResolutionTypedefType;
 import '../../deferred_load.dart' show DeferredLoadTask, OutputUnit;
 import '../../elements/elements.dart'
     show
@@ -23,10 +24,12 @@
         FunctionSignature,
         GetterElement,
         LibraryElement,
+        MemberElement,
         MethodElement,
         ParameterElement,
         TypedefElement,
         VariableElement;
+import '../../elements/types.dart' show DartType;
 import '../../js/js.dart' as js;
 import '../../js_backend/backend_helpers.dart' show BackendHelpers;
 import '../../js_backend/js_backend.dart'
@@ -34,6 +37,7 @@
 import '../../universe/selector.dart' show Selector;
 import '../../universe/world_builder.dart'
     show CodegenWorldBuilder, SelectorConstraints;
+import '../../world.dart' show ClosedWorld;
 import '../js_emitter.dart'
     show
         ClassStubGenerator,
@@ -57,6 +61,7 @@
   final Compiler _compiler;
   final Namer namer;
   final CodeEmitterTask _task;
+  final ClosedWorld closedWorld;
 
   /// Contains the collected information the program builder used to build
   /// the model.
@@ -71,16 +76,17 @@
   bool _storeFunctionTypesInMetadata = false;
 
   ProgramBuilder(Compiler compiler, Namer namer, this._task, Emitter emitter,
-      Set<ClassElement> rtiNeededClasses)
+      ClosedWorld closedWorld, Set<ClassElement> rtiNeededClasses)
       : this._compiler = compiler,
         this.namer = namer,
-        this.collector =
-            new Collector(compiler, namer, rtiNeededClasses, emitter),
+        this.closedWorld = closedWorld,
+        this.collector = new Collector(
+            compiler, namer, closedWorld, rtiNeededClasses, emitter),
         this._registry = new Registry(compiler);
 
   JavaScriptBackend get backend => _compiler.backend;
   BackendHelpers get helpers => backend.helpers;
-  CodegenWorldBuilder get universe => _compiler.codegenWorld;
+  CodegenWorldBuilder get worldBuilder => _compiler.codegenWorldBuilder;
 
   /// Mapping from [ClassElement] to constructed [Class]. We need this to
   /// update the superclass in the [Class].
@@ -184,7 +190,7 @@
         _buildTypeToInterceptorMap(), _task.metadataCollector, finalizers,
         needsNativeSupport: needsNativeSupport,
         outputContainsConstantList: collector.outputContainsConstantList,
-        hasIsolateSupport: _compiler.hasIsolateSupport);
+        hasIsolateSupport: backend.hasIsolateSupport);
   }
 
   void _markEagerClasses() {
@@ -205,7 +211,7 @@
 
   js.Expression _buildTypeToInterceptorMap() {
     InterceptorStubGenerator stubGenerator =
-        new InterceptorStubGenerator(_compiler, namer, backend);
+        new InterceptorStubGenerator(_compiler, namer, backend, closedWorld);
     return stubGenerator.generateTypeToInterceptorMap();
   }
 
@@ -226,9 +232,10 @@
   js.Statement _buildInvokeMain() {
     if (_compiler.isMockCompilation) return js.js.comment("Mock compilation");
 
-    MainCallStubGenerator generator =
-        new MainCallStubGenerator(_compiler, backend, backend.emitter);
-    return generator.generateInvokeMain();
+    MainCallStubGenerator generator = new MainCallStubGenerator(
+        backend, backend.emitter,
+        hasIncrementalSupport: _compiler.options.hasIncrementalSupport);
+    return generator.generateInvokeMain(_compiler.mainFunction);
   }
 
   DeferredFragment _buildDeferredFragment(LibrariesMap librariesMap) {
@@ -285,7 +292,7 @@
       LibrariesMap librariesMap) {
     JavaScriptConstantCompiler handler = backend.constants;
     DeferredLoadTask loadTask = _compiler.deferredLoadTask;
-    Iterable<VariableElement> lazyFields = handler
+    Iterable<FieldElement> lazyFields = handler
         .getLazilyInitializedFieldsForEmission()
         .where((element) =>
             loadTask.outputUnitForElement(element) == librariesMap.outputUnit);
@@ -296,7 +303,7 @@
         .toList(growable: false);
   }
 
-  StaticField _buildLazyField(Element element) {
+  StaticField _buildLazyField(FieldElement element) {
     js.Expression code = backend.generatedCode[element];
     // The code is null if we ended up not needing the lazily
     // initialized field after all because of constant folding
@@ -324,11 +331,11 @@
   }
 
   void _addJsInteropStubs(LibrariesMap librariesMap) {
-    if (_classes.containsKey(_compiler.coreClasses.objectClass)) {
+    if (_classes.containsKey(_compiler.commonElements.objectClass)) {
       var toStringInvocation = namer.invocationName(Selectors.toString_);
       // TODO(jacobr): register toString as used so that it is always accessible
       // from JavaScript.
-      _classes[_compiler.coreClasses.objectClass].callStubs.add(
+      _classes[_compiler.commonElements.objectClass].callStubs.add(
           _buildStubMethod(new StringBackedName("toString"),
               js.js('function() { return this.#(this) }', toStringInvocation)));
     }
@@ -350,8 +357,7 @@
                 backend.nativeData.getUnescapedJSInteropName(member.name);
             if (!member.isInstanceMember) return;
             if (member.isGetter || member.isField || member.isFunction) {
-              var selectors =
-                  _compiler.codegenWorld.getterInvocationsByName(member.name);
+              var selectors = worldBuilder.getterInvocationsByName(member.name);
               if (selectors != null && !selectors.isEmpty) {
                 for (var selector in selectors.keys) {
                   var stubName = namer.invocationName(selector);
@@ -365,8 +371,7 @@
             }
 
             if (member.isSetter || (member.isField && !member.isConst)) {
-              var selectors =
-                  _compiler.codegenWorld.setterInvocationsByName(member.name);
+              var selectors = worldBuilder.setterInvocationsByName(member.name);
               if (selectors != null && !selectors.isEmpty) {
                 var stubName = namer.setterForElement(member);
                 if (stubNames.add(stubName.key)) {
@@ -380,7 +385,7 @@
             // Generating stubs for direct calls and stubs for call-through
             // of getters that happen to be functions.
             bool isFunctionLike = false;
-            FunctionType functionType = null;
+            ResolutionFunctionType functionType = null;
 
             if (member.isFunction) {
               FunctionElement fn = member;
@@ -388,18 +393,18 @@
             } else if (member.isGetter) {
               if (_compiler.options.trustTypeAnnotations) {
                 GetterElement getter = member;
-                DartType returnType = getter.type.returnType;
+                ResolutionDartType returnType = getter.type.returnType;
                 if (returnType.isFunctionType) {
                   functionType = returnType;
                 } else if (returnType.treatAsDynamic ||
-                    _compiler.types.isSubtype(
-                        returnType, backend.coreTypes.functionType)) {
+                    _compiler.types.isSubtype(returnType,
+                        backend.commonElements.functionType as DartType)) {
                   if (returnType.isTypedef) {
-                    TypedefType typedef = returnType;
+                    ResolutionTypedefType typedef = returnType;
                     // TODO(jacobr): can we just use typdef.unaliased instead?
                     functionType = typedef.element.functionSignature.type;
                   } else {
-                    // Other misc function type such as coreTypes.Function.
+                    // Other misc function type such as commonElements.Function.
                     // Allow any number of arguments.
                     isFunctionLike = true;
                   }
@@ -419,8 +424,7 @@
                 minArgs = 0;
                 maxArgs = 32767;
               }
-              var selectors =
-                  _compiler.codegenWorld.invocationsByName(member.name);
+              var selectors = worldBuilder.invocationsByName(member.name);
               // Named arguments are not yet supported. In the future we
               // may want to map named arguments to an object literal containing
               // all named arguments.
@@ -517,12 +521,13 @@
     List<Method> methods = [];
     List<StubMethod> callStubs = <StubMethod>[];
 
-    ClassStubGenerator classStubGenerator =
-        new ClassStubGenerator(_compiler, namer, backend);
+    ClassStubGenerator classStubGenerator = new ClassStubGenerator(
+        namer, backend, worldBuilder, closedWorld,
+        enableMinification: _compiler.options.enableMinification);
     RuntimeTypeGenerator runtimeTypeGenerator =
         new RuntimeTypeGenerator(_compiler, _task, namer);
 
-    void visitMember(ClassElement enclosing, Element member) {
+    void visitMember(ClassElement enclosing, MemberElement member) {
       assert(invariant(element, member.isDeclaration));
       assert(invariant(element, element == enclosing));
 
@@ -533,7 +538,7 @@
       }
       if (member.isGetter || member.isField) {
         Map<Selector, SelectorConstraints> selectors =
-            _compiler.codegenWorld.invocationsByName(member.name);
+            worldBuilder.invocationsByName(member.name);
         if (selectors != null && !selectors.isEmpty) {
           Map<js.Name, js.Expression> callStubsForMember =
               classStubGenerator.generateCallStubsForGetter(member, selectors);
@@ -600,7 +605,7 @@
       for (Field field in instanceFields) {
         if (field.needsCheckedSetter) {
           assert(!field.needsUncheckedSetter);
-          Element element = field.element;
+          FieldElement element = field.element;
           js.Expression code = backend.generatedCode[element];
           assert(code != null);
           js.Name name = namer.deriveSetterName(field.accessorName);
@@ -619,7 +624,7 @@
     // building a class.
     Holder holder = _registry.registerHolder(holderName);
     bool isInstantiated = !backend.isJsInterop(element) &&
-        _compiler.codegenWorld.directlyInstantiatedClasses.contains(element);
+        worldBuilder.directlyInstantiatedClasses.contains(element);
 
     Class result;
     if (element.isMixinApplication && !onlyForRti) {
@@ -675,8 +680,8 @@
   }
 
   bool _methodCanBeApplied(FunctionElement method) {
-    return _compiler.hasFunctionApplySupport &&
-        _compiler.closedWorld.getMightBePassedToApply(method);
+    return backend.hasFunctionApplySupport &&
+        closedWorld.getMightBePassedToApply(method);
   }
 
   // TODO(herhut): Refactor incremental compilation and remove method.
@@ -710,6 +715,7 @@
   }
 
   DartMethod _buildMethod(MethodElement element) {
+    assert(element.isDeclaration);
     js.Name name = namer.methodPropertyName(element);
     js.Expression code = backend.generatedCode[element];
 
@@ -736,11 +742,10 @@
         isClosureCallMethod = true;
       } else {
         // Careful with operators.
-        canTearOff =
-            universe.hasInvokedGetter(element, _compiler.closedWorld) ||
-                (canBeReflected && !element.isOperator);
+        canTearOff = worldBuilder.hasInvokedGetter(element, closedWorld) ||
+            (canBeReflected && !element.isOperator);
         assert(canTearOff ||
-            !universe.methodsNeedingSuperGetter.contains(element));
+            !worldBuilder.methodsNeedingSuperGetter.contains(element));
         tearOffName = namer.getterForElement(element);
       }
     }
@@ -758,7 +763,7 @@
       callName = namer.invocationName(callSelector);
     }
 
-    DartType memberType;
+    ResolutionDartType memberType;
     if (element.isGenerativeConstructorBody) {
       // TODO(herhut): Why does this need to be normalized away? We never need
       //               this information anyway as they cannot be torn off or
@@ -798,7 +803,8 @@
         functionType: functionType);
   }
 
-  js.Expression _generateFunctionType(DartType type, OutputUnit outputUnit) {
+  js.Expression _generateFunctionType(
+      ResolutionDartType type, OutputUnit outputUnit) {
     if (type.containsTypeVariables) {
       js.Expression thisAccess = js.js(r'this.$receiver');
       return backend.rtiEncoder.getSignatureEncoding(type, thisAccess);
@@ -813,7 +819,7 @@
     if (!_methodNeedsStubs(element)) return const <ParameterStubMethod>[];
 
     ParameterStubGenerator generator =
-        new ParameterStubGenerator(_compiler, namer, backend);
+        new ParameterStubGenerator(_compiler, namer, backend, closedWorld);
     return generator.generateParameterStubs(element, canTearOff: canTearOff);
   }
 
@@ -821,7 +827,8 @@
   ///
   /// Stub methods may have an element that can be used for code-size
   /// attribution.
-  Method _buildStubMethod(js.Name name, js.Expression code, {Element element}) {
+  Method _buildStubMethod(js.Name name, js.Expression code,
+      {MemberElement element}) {
     return new StubMethod(name, code, element: element);
   }
 
@@ -841,7 +848,7 @@
 
   Iterable<StaticStubMethod> _generateGetInterceptorMethods() {
     InterceptorStubGenerator stubGenerator =
-        new InterceptorStubGenerator(_compiler, namer, backend);
+        new InterceptorStubGenerator(_compiler, namer, backend, closedWorld);
 
     String holderName = namer.globalObjectFor(helpers.interceptorsLibrary);
     // TODO(floitsch): we shouldn't update the registry in the middle of
@@ -860,9 +867,13 @@
 
   List<Field> _buildFields(Element holder, bool visitStatics) {
     List<Field> fields = <Field>[];
-    new FieldVisitor(_compiler, namer).visitFields(holder, visitStatics,
-        (VariableElement field, js.Name name, js.Name accessorName,
-            bool needsGetter, bool needsSetter, bool needsCheckedSetter) {
+    new FieldVisitor(_compiler, namer, closedWorld)
+        .visitFields(holder, visitStatics, (FieldElement field,
+            js.Name name,
+            js.Name accessorName,
+            bool needsGetter,
+            bool needsSetter,
+            bool needsCheckedSetter) {
       assert(invariant(field, field.isDeclaration));
 
       int getterFlags = 0;
@@ -901,7 +912,7 @@
 
   Iterable<StaticStubMethod> _generateOneShotInterceptors() {
     InterceptorStubGenerator stubGenerator =
-        new InterceptorStubGenerator(_compiler, namer, backend);
+        new InterceptorStubGenerator(_compiler, namer, backend, closedWorld);
 
     String holderName = namer.globalObjectFor(helpers.interceptorsLibrary);
     // TODO(floitsch): we shouldn't update the registry in the middle of
@@ -915,7 +926,7 @@
     });
   }
 
-  StaticDartMethod _buildStaticMethod(FunctionElement element) {
+  StaticDartMethod _buildStaticMethod(MethodElement element) {
     js.Name name = namer.methodPropertyName(element);
     String holder = namer.globalObjectFor(element);
     js.Expression code = backend.generatedCode[element];
@@ -926,7 +937,7 @@
 
     bool needsTearOff = isApplyTarget &&
         (canBeReflected ||
-            universe.staticFunctionsNeedingGetter.contains(element));
+            worldBuilder.staticFunctionsNeedingGetter.contains(element));
 
     js.Name tearOffName =
         needsTearOff ? namer.staticClosureName(element) : null;
@@ -938,7 +949,7 @@
       callName = namer.invocationName(callSelector);
     }
     js.Expression functionType;
-    DartType type = element.type;
+    ResolutionDartType type = element.type;
     if (needsTearOff || canBeReflected) {
       OutputUnit outputUnit =
           _compiler.deferredLoadTask.outputUnitForElement(element);
diff --git a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
index 7cffc44..6d4066e 100644
--- a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
@@ -2,11 +2,42 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.runtime_type_generator;
+
+import '../closure.dart' show ClosureClassMap, ClosureFieldElement;
+import '../common.dart';
+import '../common/names.dart' show Identifiers;
+import '../compiler.dart' show Compiler;
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionFunctionType, ResolutionTypeVariableType;
+import '../elements/elements.dart'
+    show
+        ClassElement,
+        Element,
+        FunctionElement,
+        MixinApplicationElement,
+        TypeVariableElement;
+import '../js/js.dart' as jsAst;
+import '../js/js.dart' show js;
+import '../js_backend/js_backend.dart'
+    show
+        JavaScriptBackend,
+        Namer,
+        RuntimeTypes,
+        RuntimeTypesEncoder,
+        Substitution,
+        TypeCheck,
+        TypeChecks;
+import '../util/util.dart' show Setlet;
+
+import 'code_emitter_task.dart' show CodeEmitterTask;
+import 'model.dart';
+import 'type_test_registry.dart' show TypeTestRegistry;
 
 // Function signatures used in the generation of runtime type information.
 typedef void FunctionTypeSignatureEmitter(
-    Element method, FunctionType methodType);
+    Element method, ResolutionFunctionType methodType);
 
 typedef void SubstitutionEmitter(Element element, {bool emitNull});
 
@@ -35,7 +66,7 @@
 
   JavaScriptBackend get backend => compiler.backend;
   TypeTestRegistry get typeTestRegistry => emitterTask.typeTestRegistry;
-  CoreClasses get coreClasses => compiler.coreClasses;
+  CommonElements get commonElements => compiler.commonElements;
 
   Set<ClassElement> get checkedClasses => typeTestRegistry.checkedClasses;
 
@@ -44,7 +75,7 @@
   Iterable<ClassElement> get classesUsingTypeVariableExpression =>
       backend.rti.classesUsingTypeVariableExpression;
 
-  Set<FunctionType> get checkedFunctionTypes =>
+  Set<ResolutionFunctionType> get checkedFunctionTypes =>
       typeTestRegistry.checkedFunctionTypes;
 
   /// Generates all properties necessary for is-checks on the [classElement].
@@ -75,7 +106,7 @@
     }
 
     void generateFunctionTypeSignature(
-        FunctionElement method, FunctionType type) {
+        FunctionElement method, ResolutionFunctionType type) {
       assert(method.isImplementation);
       jsAst.Expression thisAccess = new jsAst.This();
       if (!method.isAbstract) {
@@ -193,7 +224,7 @@
     bool supertypesNeedSubstitutions = false;
 
     if (superclass != null &&
-        superclass != coreClasses.objectClass &&
+        superclass != commonElements.objectClass &&
         !haveSameTypeVariables(cls, superclass)) {
       // We cannot inherit the generated substitutions, because the type
       // variable layout for this class is different.  Instead we generate
@@ -217,7 +248,7 @@
     }
 
     if (supertypesNeedSubstitutions) {
-      for (DartType supertype in cls.allSupertypes) {
+      for (ResolutionDartType supertype in cls.allSupertypes) {
         ClassElement superclass = supertype.element;
         if (generated.contains(superclass)) continue;
 
@@ -238,7 +269,7 @@
 
     // A class that defines a `call` method implicitly implements
     // [Function] and needs checks for all typedefs that are used in is-checks.
-    if (checkedClasses.contains(coreClasses.functionClass) ||
+    if (checkedClasses.contains(commonElements.functionClass) ||
         checkedFunctionTypes.isNotEmpty) {
       Element call = cls.lookupLocalMember(Identifiers.call);
       if (call == null) {
@@ -249,16 +280,17 @@
         FunctionElement callFunction = call;
         // A superclass might already implement the Function interface. In such
         // a case, we can avoid emiting the is test here.
-        if (!cls.superclass.implementsFunction(coreClasses)) {
-          _generateInterfacesIsTests(coreClasses.functionClass, generateIsTest,
-              generateSubstitution, generated);
+        if (!cls.superclass.implementsFunction(commonElements)) {
+          _generateInterfacesIsTests(commonElements.functionClass,
+              generateIsTest, generateSubstitution, generated);
         }
-        FunctionType callType = callFunction.computeType(compiler.resolution);
+        ResolutionFunctionType callType =
+            callFunction.computeType(compiler.resolution);
         generateFunctionTypeSignature(callFunction, callType);
       }
     }
 
-    for (DartType interfaceType in cls.interfaces) {
+    for (ResolutionDartType interfaceType in cls.interfaces) {
       _generateInterfacesIsTests(interfaceType.element, generateIsTest,
           generateSubstitution, generated);
     }
@@ -282,7 +314,7 @@
 
     tryEmitTest(cls);
 
-    for (DartType interfaceType in cls.interfaces) {
+    for (ResolutionDartType interfaceType in cls.interfaces) {
       Element element = interfaceType.element;
       tryEmitTest(element);
       _generateInterfacesIsTests(
@@ -302,7 +334,7 @@
     List<StubMethod> stubs = <StubMethod>[];
     ClassElement superclass = classElement;
     while (superclass != null) {
-      for (TypeVariableType parameter in superclass.typeVariables) {
+      for (ResolutionTypeVariableType parameter in superclass.typeVariables) {
         if (backend.emitter.readTypeVariables.contains(parameter.element)) {
           stubs.add(
               _generateTypeVariableReader(classElement, parameter.element));
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
index 07be9d6..6fa1d3b 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
@@ -10,16 +10,37 @@
 import '../../common.dart';
 import '../../compiler.dart' show Compiler;
 import '../../constants/values.dart' show ConstantValue;
+import '../../deferred_load.dart' show OutputUnit;
 import '../../elements/elements.dart'
-    show ClassElement, Element, FieldElement, FunctionElement;
+    show ClassElement, Element, FieldElement, MethodElement;
 import '../../js/js.dart' as js;
 import '../../js_backend/js_backend.dart' show JavaScriptBackend, Namer;
-import '../js_emitter.dart' show NativeEmitter;
-import '../js_emitter.dart' as emitterTask show Emitter;
+import '../../world.dart' show ClosedWorld;
+import '../js_emitter.dart' show CodeEmitterTask, NativeEmitter;
+import '../js_emitter.dart' as emitterTask show Emitter, EmitterFactory;
 import '../model.dart';
 import '../program_builder/program_builder.dart' show ProgramBuilder;
 import 'model_emitter.dart';
 
+class EmitterFactory implements emitterTask.EmitterFactory {
+  final bool generateSourceMap;
+
+  EmitterFactory({this.generateSourceMap});
+
+  @override
+  String get patchVersion => "startup";
+
+  @override
+  bool get supportsReflection => false;
+
+  @override
+  Emitter createEmitter(
+      CodeEmitterTask task, Namer namer, ClosedWorld closedWorld) {
+    return new Emitter(
+        task.compiler, namer, task.nativeEmitter, generateSourceMap);
+  }
+}
+
 class Emitter implements emitterTask.Emitter {
   final Compiler _compiler;
   final Namer namer;
@@ -37,18 +58,12 @@
   DiagnosticReporter get reporter => _compiler.reporter;
 
   @override
-  String get patchVersion => "startup";
-
-  @override
   int emitProgram(ProgramBuilder programBuilder) {
     Program program = programBuilder.buildProgram();
     return _emitter.emitProgram(program);
   }
 
   @override
-  bool get supportsReflection => false;
-
-  @override
   bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant) {
     return _emitter.isConstantInlinedOrAlreadyEmitted(constant);
   }
@@ -88,7 +103,7 @@
   }
 
   @override
-  js.Expression isolateStaticClosureAccess(FunctionElement element) {
+  js.Expression isolateStaticClosureAccess(MethodElement element) {
     return _emitter.generateStaticClosureAccess(element);
   }
 
@@ -98,7 +113,7 @@
   }
 
   @override
-  js.PropertyAccess staticFunctionAccess(FunctionElement element) {
+  js.PropertyAccess staticFunctionAccess(MethodElement element) {
     return _globalPropertyAccess(element);
   }
 
@@ -131,8 +146,8 @@
 
     switch (builtin) {
       case JsBuiltin.dartObjectConstructor:
-        return js.js.expressionTemplateYielding(
-            typeAccess(_compiler.coreClasses.objectClass));
+        ClassElement objectClass = _compiler.commonElements.objectClass;
+        return js.js.expressionTemplateYielding(typeAccess(objectClass));
 
       case JsBuiltin.isCheckPropertyToJsConstructorName:
         int isPrefixLength = namer.operatorIsPrefix.length;
@@ -181,5 +196,12 @@
   }
 
   @override
+  int generatedSize(OutputUnit unit) {
+    Fragment key = _emitter.outputBuffers.keys
+        .firstWhere((Fragment fragment) => fragment.outputUnit == unit);
+    return _emitter.outputBuffers[key].length;
+  }
+
+  @override
   void invalidateCaches() {}
 }
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index 57e10a2..bd3a080 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -171,7 +171,7 @@
 function convertToFastObject(properties) {
   // Create an instance that uses 'properties' as prototype. This should
   // make 'properties' a fast object.
-  function t() {};
+  function t() {}
   t.prototype = properties;
   new t();
   return properties;
@@ -563,11 +563,21 @@
     for (Library library in fragment.libraries) {
       for (StaticMethod method in library.statics) {
         assert(!method.holder.isStaticStateHolder);
-        holderCode[method.holder].addAll(emitStaticMethod(method));
+        var staticMethod = emitStaticMethod(method);
+        if (compiler.options.dumpInfo) {
+          for (var code in staticMethod.values) {
+            compiler.dumpInfoTask.registerElementAst(method.element, code);
+            compiler.dumpInfoTask.registerElementAst(library.element, code);
+          }
+        }
+        holderCode[method.holder].addAll(staticMethod);
       }
       for (Class cls in library.classes) {
         assert(!cls.holder.isStaticStateHolder);
-        holderCode[cls.holder][cls.name] = emitConstructor(cls);
+        var constructor = emitConstructor(cls);
+        compiler.dumpInfoTask.registerElementAst(cls.element, constructor);
+        compiler.dumpInfoTask.registerElementAst(library.element, constructor);
+        holderCode[cls.holder][cls.name] = constructor;
       }
     }
 
@@ -668,9 +678,14 @@
   js.Statement emitPrototypes(Fragment fragment) {
     List<js.Statement> assignments = fragment.libraries
         .expand((Library library) => library.classes)
-        .map((Class cls) => js.js.statement(
-            '#.prototype = #;', [classReference(cls), emitPrototype(cls)]))
-        .toList(growable: false);
+        .map((Class cls) {
+      var proto = js.js.statement(
+          '#.prototype = #;', [classReference(cls), emitPrototype(cls)]);
+      ClassElement element = cls.element;
+      compiler.dumpInfoTask.registerElementAst(element, proto);
+      compiler.dumpInfoTask.registerElementAst(element.library, proto);
+      return proto;
+    }).toList(growable: false);
 
     return new js.Block(assignments);
   }
@@ -712,7 +727,9 @@
     allMethods.forEach((Method method) {
       emitInstanceMethod(method)
           .forEach((js.Expression name, js.Expression code) {
-        properties.add(new js.Property(name, code));
+        var prop = new js.Property(name, code);
+        compiler.dumpInfoTask.registerElementAst(method.element, prop);
+        properties.add(prop);
       });
     });
 
@@ -948,7 +965,8 @@
 
     bool isIntercepted = false;
     if (method is InstanceMethod) {
-      isIntercepted = backend.isInterceptedMethod(method.element);
+      MethodElement element = method.element;
+      isIntercepted = backend.isInterceptedMethod(element);
     }
     int requiredParameterCount = 0;
     js.Expression optionalParameterDefaultValues = new js.LiteralNull();
@@ -1011,11 +1029,13 @@
       // find the constants that don't have any dependency on other constants
       // and create an object-literal with them (and assign it to the
       // constant-holder variable).
-      assignments.add(js.js.statement('#.# = #', [
+      var assignment = js.js.statement('#.# = #', [
         constant.holder.name,
         constant.name,
         constantEmitter.generate(constant.value)
-      ]));
+      ]);
+      compiler.dumpInfoTask.registerConstantAst(constant.value, assignment);
+      assignments.add(assignment);
     }
     return new js.Block(assignments);
   }
@@ -1140,17 +1160,17 @@
   js.Property emitMangledGlobalNames() {
     List<js.Property> names = <js.Property>[];
 
-    CoreClasses coreClasses = compiler.coreClasses;
+    CommonElements commonElements = compiler.commonElements;
     // We want to keep the original names for the most common core classes when
     // calling toString on them.
     List<ClassElement> nativeClassesNeedingUnmangledName = [
-      coreClasses.intClass,
-      coreClasses.doubleClass,
-      coreClasses.numClass,
-      coreClasses.stringClass,
-      coreClasses.boolClass,
-      coreClasses.nullClass,
-      coreClasses.listClass
+      commonElements.intClass,
+      commonElements.doubleClass,
+      commonElements.numClass,
+      commonElements.stringClass,
+      commonElements.boolClass,
+      commonElements.nullClass,
+      commonElements.listClass
     ];
     // TODO(floitsch): this should probably be on a per-fragment basis.
     nativeClassesNeedingUnmangledName.forEach((element) {
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
index 046fa6f..b84608b 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
@@ -33,8 +33,8 @@
 import '../../common.dart';
 import '../../compiler.dart' show Compiler;
 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue;
-import '../../core_types.dart' show CoreClasses;
-import '../../elements/elements.dart' show ClassElement, FunctionElement;
+import '../../core_types.dart' show CommonElements;
+import '../../elements/elements.dart' show ClassElement, MethodElement;
 import '../../hash/sha1.dart' show Hasher;
 import '../../io/code_output.dart';
 import '../../io/line_column_provider.dart'
@@ -128,7 +128,7 @@
     return deepCompareConstants(a, b);
   }
 
-  js.Expression generateStaticClosureAccess(FunctionElement element) {
+  js.Expression generateStaticClosureAccess(MethodElement element) {
     return js.js('#.#()',
         [namer.globalObjectFor(element), namer.staticClosureName(element)]);
   }
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 c1ff342..15f3b55 100644
--- a/pkg/compiler/lib/src/js_emitter/type_test_registry.dart
+++ b/pkg/compiler/lib/src/js_emitter/type_test_registry.dart
@@ -2,7 +2,21 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-part of dart2js.js_emitter;
+library dart2js.js_emitter.type_test_registry;
+
+import '../compiler.dart' show Compiler;
+import '../elements/resolution_types.dart'
+    show
+        ResolutionDartType,
+        ResolutionFunctionType,
+        ResolutionInterfaceType,
+        Types,
+        ResolutionTypeVariableType;
+import '../elements/elements.dart'
+    show ClassElement, Element, ElementKind, FunctionElement;
+import '../js_backend/js_backend.dart'
+    show JavaScriptBackend, RuntimeTypes, TypeChecks;
+import '../world.dart' show ClosedWorld;
 
 class TypeTestRegistry {
   /**
@@ -17,7 +31,7 @@
    * The set of function types that checked, both explicity through tests of
    * typedefs and implicitly through type annotations in checked mode.
    */
-  Set<FunctionType> checkedFunctionTypes;
+  Set<ResolutionFunctionType> checkedFunctionTypes;
 
   /// Initially contains all classes that need RTI. After
   /// [computeNeededClasses]
@@ -28,17 +42,19 @@
 
   Iterable<ClassElement> get classesUsingTypeVariableTests {
     if (cachedClassesUsingTypeVariableTests == null) {
-      cachedClassesUsingTypeVariableTests = compiler.codegenWorld.isChecks
-          .where((DartType t) => t is TypeVariableType)
-          .map((TypeVariableType v) => v.element.enclosingClass)
+      cachedClassesUsingTypeVariableTests = compiler
+          .codegenWorldBuilder.isChecks
+          .where((ResolutionDartType t) => t is ResolutionTypeVariableType)
+          .map((ResolutionTypeVariableType v) => v.element.enclosingClass)
           .toList();
     }
     return cachedClassesUsingTypeVariableTests;
   }
 
   final Compiler compiler;
+  final ClosedWorld closedWorld;
 
-  TypeTestRegistry(this.compiler);
+  TypeTestRegistry(this.compiler, this.closedWorld);
 
   JavaScriptBackend get backend => compiler.backend;
 
@@ -91,7 +107,7 @@
 
     // 3.  Add classes that contain checked generic function types. These are
     //     needed to store the signature encoding.
-    for (FunctionType type in checkedFunctionTypes) {
+    for (ResolutionFunctionType type in checkedFunctionTypes) {
       ClassElement contextClass = Types.getClassContext(type);
       if (contextClass != null) {
         rtiNeededClasses.add(contextClass);
@@ -105,8 +121,8 @@
         return false;
       } else if (function.isInstanceMember) {
         if (!function.enclosingClass.isClosure) {
-          return compiler.codegenWorld
-              .hasInvokedGetter(function, compiler.closedWorld);
+          return compiler.codegenWorldBuilder
+              .hasInvokedGetter(function, closedWorld);
         }
       }
       return false;
@@ -128,7 +144,7 @@
     backend.generatedCode.keys.where((element) {
       return canBeReflectedAsFunction(element) && canBeReified(element);
     }).forEach((FunctionElement function) {
-      DartType type = function.type;
+      ResolutionDartType type = function.type;
       for (ClassElement cls in backend.rti.getReferencedClasses(type)) {
         while (cls != null) {
           rtiNeededClasses.add(cls);
@@ -144,14 +160,14 @@
     assert(checkedClasses == null && checkedFunctionTypes == null);
 
     backend.rti.addImplicitChecks(
-        compiler.codegenWorld, classesUsingTypeVariableTests);
+        compiler.codegenWorldBuilder, classesUsingTypeVariableTests);
 
     checkedClasses = new Set<ClassElement>();
-    checkedFunctionTypes = new Set<FunctionType>();
-    compiler.codegenWorld.isChecks.forEach((DartType t) {
-      if (t is InterfaceType) {
+    checkedFunctionTypes = new Set<ResolutionFunctionType>();
+    compiler.codegenWorldBuilder.isChecks.forEach((ResolutionDartType t) {
+      if (t is ResolutionInterfaceType) {
         checkedClasses.add(t.element);
-      } else if (t is FunctionType) {
+      } else if (t is ResolutionFunctionType) {
         checkedFunctionTypes.add(t);
       }
     });
diff --git a/pkg/compiler/lib/src/kernel/constant_visitor.dart b/pkg/compiler/lib/src/kernel/constant_visitor.dart
index 0d1e1a6..3d0405d 100644
--- a/pkg/compiler/lib/src/kernel/constant_visitor.dart
+++ b/pkg/compiler/lib/src/kernel/constant_visitor.dart
@@ -94,7 +94,8 @@
 
   @override
   ir.Node visitConcatenate(ConcatenateConstantExpression exp, Kernel kernel) {
-    throw new UnimplementedError('${exp.toStructuredText()} is not supported.');
+    return new ir.StringConcatenation(
+        exp.expressions.map((e) => visit(e, kernel)).toList());
   }
 
   @override
diff --git a/pkg/compiler/lib/src/kernel/error.dart b/pkg/compiler/lib/src/kernel/error.dart
index 464112f..df2daaf 100644
--- a/pkg/compiler/lib/src/kernel/error.dart
+++ b/pkg/compiler/lib/src/kernel/error.dart
@@ -4,7 +4,7 @@
 
 import 'package:kernel/ast.dart' as ir;
 
-import "../dart_types.dart" show DartType;
+import "../elements/resolution_types.dart" show ResolutionDartType;
 import "../elements/elements.dart" show Element, ErroneousElement;
 import "../resolution/operators.dart"
     show AssignmentOperator, BinaryOperator, IncDecOperator, UnaryOperator;
@@ -100,7 +100,7 @@
   ir.Expression errorNonConstantConstructorInvoke(
       NewExpression node,
       Element element,
-      DartType type,
+      ResolutionDartType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
diff --git a/pkg/compiler/lib/src/kernel/kernel.dart b/pkg/compiler/lib/src/kernel/kernel.dart
index 1210501..373c873 100644
--- a/pkg/compiler/lib/src/kernel/kernel.dart
+++ b/pkg/compiler/lib/src/kernel/kernel.dart
@@ -11,9 +11,15 @@
 import '../common.dart';
 import '../common/names.dart';
 import '../compiler.dart' show Compiler;
-import '../constants/expressions.dart' show TypeConstantExpression;
-import '../dart_types.dart'
-    show DartType, FunctionType, InterfaceType, TypeKind, TypeVariableType;
+import '../constants/expressions.dart'
+    show ConstantExpression, TypeConstantExpression;
+import '../elements/resolution_types.dart'
+    show
+        ResolutionDartType,
+        ResolutionFunctionType,
+        ResolutionInterfaceType,
+        ResolutionTypeKind,
+        ResolutionTypeVariableType;
 import '../diagnostics/messages.dart' show MessageKind;
 import '../diagnostics/spannable.dart' show Spannable;
 import '../elements/elements.dart'
@@ -74,6 +80,13 @@
   final Map<ir.Node, Element> nodeToElement = <ir.Node, Element>{};
   final Map<ir.Node, Node> nodeToAst = <ir.Node, Node>{};
   final Map<ir.Node, Node> nodeToAstOperator = <ir.Node, Node>{};
+  // Synthetic nodes are nodes we generated that do not correspond to
+  // [ast.Node]s. A node should be in one of nodeToAst or syntheticNodes but not
+  // both.
+  final Set<ir.Node> syntheticNodes = new Set<ir.Node>();
+
+  final Map<ir.Node, ConstantExpression> parameterInitializerNodeToConstant =
+      <ir.Node, ConstantExpression>{};
 
   /// FIFO queue of work that needs to be completed before the returned AST
   /// nodes are correct.
@@ -144,10 +157,18 @@
         Queue<ir.Member> members = new Queue<ir.Member>();
         library.implementation.forEachLocalMember((Element e) {
           if (e.isClass) {
-            classes.addFirst(classToIr(e));
+            ClassElement cls = e;
+            if (!cls.isResolved) return;
+            classes.addFirst(classToIr(cls));
           } else if (e.isFunction || e.isAccessor) {
+            if (!compiler.resolution.hasBeenResolved(e) && !e.isMalformed) {
+              return;
+            }
             members.addFirst(functionToIr(e));
           } else if (e.isField) {
+            if (!compiler.resolution.hasBeenResolved(e) && !e.isMalformed) {
+              return;
+            }
             members.addFirst(fieldToIr(e));
           } else if (e.isTypedef) {
             // Ignored, typedefs are unaliased on use.
@@ -180,8 +201,7 @@
   ir.Class classToIr(ClassElement cls) {
     cls = cls.declaration;
     return classes.putIfAbsent(cls, () {
-      cls.ensureResolved(compiler.resolution);
-      compiler.enqueuer.resolution.emptyDeferredQueueForTesting();
+      assert(cls.isResolved);
       String name = computeName(cls);
       ir.Class classNode = new ir.Class(
           name: name,
@@ -205,6 +225,10 @@
         }
         cls.implementation
             .forEachMember((ClassElement enclosingClass, Element member) {
+          if (!compiler.resolution.hasBeenResolved(member) &&
+              !member.isMalformed) {
+            return;
+          }
           if (member.enclosingClass.declaration != cls) {
             // TODO(het): figure out why impact_test triggers this
             //internalError(cls, "`$member` isn't mine.");
@@ -276,7 +300,7 @@
 
   bool hasHierarchyProblem(ClassElement cls) => cls.hasIncompleteHierarchy;
 
-  ir.InterfaceType interfaceTypeToIr(InterfaceType type) {
+  ir.InterfaceType interfaceTypeToIr(ResolutionInterfaceType type) {
     ir.Class cls = classToIr(type.element);
     if (type.typeArguments.isEmpty) {
       return cls.rawType;
@@ -285,7 +309,7 @@
     }
   }
 
-  ir.Supertype supertypeToIr(InterfaceType type) {
+  ir.Supertype supertypeToIr(ResolutionInterfaceType type) {
     ir.Class cls = classToIr(type.element);
     if (type.typeArguments.isEmpty) {
       return cls.asRawSupertype;
@@ -294,13 +318,8 @@
     }
   }
 
-  // TODO(ahe): Remove this method when dart2js support generic type arguments.
-  List<ir.TypeParameter> typeParametersNotImplemented() {
-    return const <ir.TypeParameter>[];
-  }
-
-  ir.FunctionType functionTypeToIr(FunctionType type) {
-    List<ir.TypeParameter> typeParameters = typeParametersNotImplemented();
+  ir.FunctionType functionTypeToIr(ResolutionFunctionType type) {
+    List<ir.TypeParameter> typeParameters = <ir.TypeParameter>[];
     int requiredParameterCount = type.parameterTypes.length;
     List<ir.DartType> positionalParameters =
         new List<ir.DartType>.from(typesToIr(type.parameterTypes))
@@ -317,11 +336,11 @@
         requiredParameterCount: requiredParameterCount);
   }
 
-  ir.TypeParameterType typeVariableTypeToIr(TypeVariableType type) {
+  ir.TypeParameterType typeVariableTypeToIr(ResolutionTypeVariableType type) {
     return new ir.TypeParameterType(typeVariableToIr(type.element));
   }
 
-  List<ir.DartType> typesToIr(List<DartType> types) {
+  List<ir.DartType> typesToIr(List<ResolutionDartType> types) {
     List<ir.DartType> result = new List<ir.DartType>(types.length);
     for (int i = 0; i < types.length; i++) {
       result[i] = typeToIr(types[i]);
@@ -329,7 +348,7 @@
     return result;
   }
 
-  List<ir.Supertype> supertypesToIr(List<DartType> types) {
+  List<ir.Supertype> supertypesToIr(List<ResolutionDartType> types) {
     List<ir.Supertype> result = new List<ir.Supertype>(types.length);
     for (int i = 0; i < types.length; i++) {
       result[i] = supertypeToIr(types[i]);
@@ -337,31 +356,28 @@
     return result;
   }
 
-  ir.DartType typeToIr(DartType type) {
+  ir.DartType typeToIr(ResolutionDartType type) {
     switch (type.kind) {
-      case TypeKind.FUNCTION:
+      case ResolutionTypeKind.FUNCTION:
         return functionTypeToIr(type);
 
-      case TypeKind.INTERFACE:
+      case ResolutionTypeKind.INTERFACE:
         return interfaceTypeToIr(type);
 
-      case TypeKind.STATEMENT:
-        throw "Internal error: statement type: $type.";
-
-      case TypeKind.TYPEDEF:
+      case ResolutionTypeKind.TYPEDEF:
         type.computeUnaliased(compiler.resolution);
         return typeToIr(type.unaliased);
 
-      case TypeKind.TYPE_VARIABLE:
+      case ResolutionTypeKind.TYPE_VARIABLE:
         return typeVariableTypeToIr(type);
 
-      case TypeKind.MALFORMED_TYPE:
+      case ResolutionTypeKind.MALFORMED_TYPE:
         return const ir.InvalidType();
 
-      case TypeKind.DYNAMIC:
+      case ResolutionTypeKind.DYNAMIC:
         return const ir.DynamicType();
 
-      case TypeKind.VOID:
+      case ResolutionTypeKind.VOID:
         return const ir.VoidType();
     }
   }
@@ -409,8 +425,8 @@
     }
     function = function.declaration;
     return functions.putIfAbsent(function, () {
-      compiler.resolution.ensureResolved(function);
-      compiler.enqueuer.resolution.emptyDeferredQueueForTesting();
+      assert(compiler.resolution.hasBeenResolved(function) ||
+          function.isMalformed);
       function = function.implementation;
       ir.Member member;
       ir.Constructor constructor;
@@ -454,6 +470,8 @@
           procedure.kind = irFunction.kind;
         }
         endFactoryScope(function);
+        irFunction.node.typeParameters
+            .addAll(typeVariablesToIr(function.typeVariables));
         member.transformerFlags = visitor.transformerFlags;
         assert(() {
           visitor.locals.forEach(checkMember);
@@ -481,14 +499,14 @@
     assert(factoryTypeParameters.isEmpty);
     if (!function.isFactoryConstructor) return;
     ClassElement cls = function.enclosingClass;
-    for (DartType type in cls.typeVariables) {
+    for (ResolutionDartType type in cls.typeVariables) {
       if (type.isTypeVariable) {
         TypeVariableElement variable = type.element;
         factoryTypeParameters[variable] =
             new ir.TypeParameter(variable.name, null);
       }
     }
-    for (DartType type in cls.typeVariables) {
+    for (ResolutionDartType type in cls.typeVariables) {
       if (type.isTypeVariable) {
         TypeVariableElement variable = type.element;
         factoryTypeParameters[variable].bound = typeToIr(variable.bound);
@@ -507,8 +525,13 @@
     }
     field = field.declaration;
     return fields.putIfAbsent(field, () {
+      // TODO(sigmund): remove `ensureResolved` here.  It appears we hit this
+      // case only in metadata: when a constant has a field that is never read,
+      // but it is initialized in the constant constructor.
       compiler.resolution.ensureResolved(field);
       compiler.enqueuer.resolution.emptyDeferredQueueForTesting();
+      assert(compiler.resolution.hasBeenResolved(field) || field.isMalformed);
+
       field = field.implementation;
       ir.DartType type =
           field.isMalformed ? const ir.InvalidType() : typeToIr(field.type);
@@ -548,22 +571,25 @@
     return typeParameters.putIfAbsent(variable, () {
       ir.TypeParameter parameter = new ir.TypeParameter(variable.name, null);
       addWork(variable, () {
-        // TODO(ahe): This assignment will probably not be correct when dart2js
-        // supports generic methods.
-        ClassElement cls = variable.typeDeclaration;
-        cls.ensureResolved(compiler.resolution);
-        parameter.parent = classToIr(cls);
+        if (variable.typeDeclaration.isClass) {
+          ClassElement cls = variable.typeDeclaration;
+          assert(cls.isResolved);
+          parameter.parent = classToIr(cls);
+        } else {
+          FunctionElement method = variable.typeDeclaration;
+          parameter.parent = functionToIr(method).function;
+        }
         parameter.bound = typeToIr(variable.bound);
       });
       return parameter;
     });
   }
 
-  List<ir.TypeParameter> typeVariablesToIr(List<DartType> variables) {
+  List<ir.TypeParameter> typeVariablesToIr(List<ResolutionDartType> variables) {
     List<ir.TypeParameter> result =
         new List<ir.TypeParameter>(variables.length);
     for (int i = 0; i < variables.length; i++) {
-      TypeVariableType type = variables[i];
+      ResolutionTypeVariableType type = variables[i];
       result[i] = typeVariableToIr(type.element);
     }
     return result;
@@ -592,7 +618,7 @@
   }
 
   ConstructorTarget computeEffectiveTarget(
-      ConstructorElement constructor, DartType type) {
+      ConstructorElement constructor, ResolutionDartType type) {
     constructor = constructor.implementation;
     Set<ConstructorElement> seen = new Set<ConstructorElement>();
     functionToIr(constructor);
@@ -683,12 +709,14 @@
     LibraryElement library =
         compiler.libraryLoader.lookupLibrary(Uris.dart_core);
     ClassElement cls = library.implementation.localLookup(className);
+    cls.ensureResolved(compiler.resolution);
     assert(invariant(CURRENT_ELEMENT_SPANNABLE, cls != null,
         message: 'dart:core class $className not found.'));
     ConstructorElement constructor = cls.lookupConstructor(constructorName);
     assert(invariant(CURRENT_ELEMENT_SPANNABLE, constructor != null,
         message: "Constructor '$constructorName' not found "
             "in class '$className'."));
+    compiler.resolution.ensureResolved(constructor);
     return functionToIr(constructor);
   }
 
@@ -698,6 +726,7 @@
     Element function = library.implementation.localLookup(name);
     assert(invariant(CURRENT_ELEMENT_SPANNABLE, function != null,
         message: "dart:core method '$name' not found."));
+    compiler.resolution.ensureResolved(function);
     return functionToIr(function);
   }
 
@@ -756,7 +785,7 @@
 
 class ConstructorTarget {
   final ConstructorElement element;
-  final DartType type;
+  final ResolutionDartType type;
 
   ConstructorTarget(this.element, this.type);
 
diff --git a/pkg/compiler/lib/src/kernel/kernel_visitor.dart b/pkg/compiler/lib/src/kernel/kernel_visitor.dart
index 664388d..1bb66cc 100644
--- a/pkg/compiler/lib/src/kernel/kernel_visitor.dart
+++ b/pkg/compiler/lib/src/kernel/kernel_visitor.dart
@@ -31,7 +31,8 @@
         IntFromEnvironmentConstantExpression,
         StringFromEnvironmentConstantExpression,
         TypeConstantExpression;
-import '../dart_types.dart' show DartType, InterfaceType;
+import '../elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionInterfaceType;
 import '../diagnostics/spannable.dart' show Spannable;
 import '../elements/elements.dart'
     show
@@ -259,7 +260,7 @@
 
   // This works around a bug in dart2js.
   // TODO(ahe): Fix the bug in dart2js and remove this function.
-  ir.DartType typeToIrHack(DartType type) {
+  ir.DartType typeToIrHack(ResolutionDartType type) {
     if (currentElement.isSynthesized &&
         currentElement.enclosingClass.isMixinApplication &&
         !kernel.hasHierarchyProblem(currentElement.enclosingClass)) {
@@ -283,7 +284,7 @@
       // is Super<S> and it should be Sub<T>, but we settle for Super<T> for
       // now). So we need to translate Sub<T> to an instance of Super, which is
       // Super<T> (not Super<S>).
-      InterfaceType supertype =
+      ResolutionInterfaceType supertype =
           currentElement.enclosingClass.asInstanceOf(superclass);
       // Once we have [supertype], we know how to substitute S with T: the type
       // arguments of [supertype] corresponds to T, and the type variables of
@@ -296,8 +297,7 @@
 
   // TODO(ahe): Hack. Fix dart2js instead.
   ir.Name nameToIrName(Name name) {
-    assert(!name.isPrivate ||
-        name.library.implementation == currentElement.library.implementation);
+    assert(!name.isPrivate || name.library == currentElement.library);
     return kernel.irName(name.text, currentElement);
   }
 
@@ -404,6 +404,7 @@
       ir.Statement statement, Node node, JumpTarget jumpTarget) {
     assert(node.isValidBreakTarget());
     assert(jumpTarget == elements.getTargetDefinition(node));
+    associateNode(statement, node);
     if (jumpTarget != null && jumpTarget.isBreakTarget) {
       ir.LabeledStatement breakTarget = getBreakTarget(jumpTarget);
       breakTarget.body = statement;
@@ -847,17 +848,17 @@
 
   @override
   ir.BoolLiteral visitLiteralBool(LiteralBool node) {
-    return new ir.BoolLiteral(node.value);
+    return associateNode(new ir.BoolLiteral(node.value), node);
   }
 
   @override
   ir.DoubleLiteral visitLiteralDouble(LiteralDouble node) {
-    return new ir.DoubleLiteral(node.value);
+    return associateNode(new ir.DoubleLiteral(node.value), node);
   }
 
   @override
   ir.IntLiteral visitLiteralInt(LiteralInt node) {
-    return new ir.IntLiteral(node.value);
+    return associateNode(new ir.IntLiteral(node.value), node);
   }
 
   @override
@@ -908,7 +909,8 @@
   @override
   ir.Expression visitLiteralString(LiteralString node) {
     if (node.dartString == null) return new ir.InvalidExpression();
-    return new ir.StringLiteral(node.dartString.slowToString());
+    return associateNode(
+        new ir.StringLiteral(node.dartString.slowToString()), node);
   }
 
   @override
@@ -1038,8 +1040,10 @@
       }
       if (statements.isEmpty || fallsThrough(statements.last)) {
         if (isLastCase) {
-          statements.add(new ir.BreakStatement(
-              getBreakTarget(elements.getTargetDefinition(node))));
+          if (!caseNode.isDefaultCase) {
+            statements.add(new ir.BreakStatement(
+                getBreakTarget(elements.getTargetDefinition(node))));
+          }
         } else {
           statements.add(new ir.ExpressionStatement(new ir.Throw(
               new ir.ConstructorInvocation(
@@ -1105,9 +1109,7 @@
     ir.Statement body =
         buildContinueTarget(buildStatementInBlock(node.body), node, jumpTarget);
     return buildBreakTarget(
-        associateNode(new ir.WhileStatement(condition, body), node),
-        node,
-        jumpTarget);
+        new ir.WhileStatement(condition, body), node, jumpTarget);
   }
 
   @override
@@ -1120,7 +1122,7 @@
   ir.InvalidExpression visitAbstractClassConstructorInvoke(
       NewExpression node,
       ConstructorElement element,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -1145,7 +1147,8 @@
   }
 
   @override
-  ir.AsExpression visitAs(Send node, Node expression, DartType type, _) {
+  ir.AsExpression visitAs(
+      Send node, Node expression, ResolutionDartType type, _) {
     return new ir.AsExpression(
         visitForValue(expression), kernel.typeToIr(type));
   }
@@ -1171,7 +1174,7 @@
             isConst: isConst)
         : buildStaticInvoke(target.element, arguments, isConst: isConst);
     if (target.type.isInterfaceType) {
-      InterfaceType type = target.type;
+      ResolutionInterfaceType type = target.type;
       if (type.isGeneric) {
         invoke.arguments.types.addAll(kernel.typesToIr(type.typeArguments));
       }
@@ -1202,7 +1205,8 @@
       NodeList arguments,
       CallStructure callStructure,
       _) {
-    return buildCall(buildTypeLiteral(constant), callStructure, arguments);
+    return associateNode(
+        buildCall(buildTypeLiteral(constant), callStructure, arguments), node);
   }
 
   ir.Expression buildTypeLiteralSet(TypeConstantExpression constant, Node rhs) {
@@ -1230,17 +1234,17 @@
   @override
   ir.Expression visitCompoundIndexSet(SendSet node, Node receiver, Node index,
       AssignmentOperator operator, Node rhs, _) {
-    // TODO(sra): Find binary operator.
-    return buildIndexAccessor(receiver, index).buildCompoundAssignment(
+    return buildCompoundAssignment(
+        node,
+        buildIndexAccessor(receiver, index),
         kernel.irName(operator.selectorName, currentElement),
-        visitForValue(rhs),
-        voidContext: isVoidContext);
+        visitForValue(rhs));
   }
 
   @override
   ir.InvocationExpression visitConstConstructorInvoke(
       NewExpression node, ConstructedConstantExpression constant, _) {
-    return buildConstructorInvoke(node, isConst: true);
+    return associateNode(buildConstructorInvoke(node, isConst: true), node);
   }
 
   @override
@@ -1260,7 +1264,7 @@
   ir.InvalidExpression visitConstructorIncompatibleInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -1315,8 +1319,17 @@
     Accessor accessor = (receiver == null)
         ? new ThisPropertyAccessor(irName, null, null)
         : PropertyAccessor.make(visitForValue(receiver), irName, null, null);
-    return accessor.buildNullAwareAssignment(visitForValue(rhs), null,
+    return _finishSetIfNull(node, accessor, rhs);
+  }
+
+  ir.Expression _finishSetIfNull(Send node, Accessor accessor, Node rhs) {
+    ir.Expression result = accessor.buildNullAwareAssignment(
+        visitForValue(rhs), null,
         voidContext: isVoidContext);
+    if (accessor.builtGetter != null) {
+      kernel.nodeToAst[accessor.builtGetter] = node;
+    }
+    return result;
   }
 
   @override
@@ -1369,7 +1382,7 @@
   ir.InvocationExpression visitFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -1498,7 +1511,7 @@
   ir.InvocationExpression visitGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -1513,7 +1526,12 @@
   @override
   ir.Expression visitIfNotNullDynamicPropertyGet(
       Send node, Node receiver, Name name, _) {
-    return buildNullAwarePropertyAccessor(receiver, name).buildSimpleRead();
+    Accessor accessor = buildNullAwarePropertyAccessor(receiver, name);
+    ir.Expression result = accessor.buildSimpleRead();
+    if (accessor.builtGetter != null) {
+      kernel.nodeToAst[accessor.builtGetter] = node;
+    }
+    return result;
   }
 
   @override
@@ -1526,8 +1544,10 @@
         new ir.ConditionalExpression(
             buildIsNull(new ir.VariableGet(receiver)),
             new ir.NullLiteral(),
-            buildInvokeSelector(new ir.VariableGet(receiver), selector,
-                buildArguments(arguments)),
+            associateNode(
+                buildInvokeSelector(new ir.VariableGet(receiver), selector,
+                    buildArguments(arguments)),
+                receiverNode),
             null));
   }
 
@@ -1541,9 +1561,8 @@
   @override
   ir.Expression visitIfNotNullDynamicPropertySetIfNull(
       Send node, Node receiver, Name name, Node rhs, _) {
-    return buildNullAwarePropertyAccessor(receiver, name)
-        .buildNullAwareAssignment(visitForValue(rhs), null,
-            voidContext: isVoidContext);
+    return _finishSetIfNull(
+        node, buildNullAwarePropertyAccessor(receiver, name), rhs);
   }
 
   ir.LogicalExpression buildLogicalExpression(
@@ -1563,7 +1582,7 @@
 
   @override
   ir.Initializer visitImplicitSuperConstructorInvoke(FunctionExpression node,
-      ConstructorElement superConstructor, InterfaceType type, _) {
+      ConstructorElement superConstructor, ResolutionInterfaceType type, _) {
     if (superConstructor == null) {
       // TODO(ahe): Semantic visitor shouldn't call this.
       return new ir.InvalidInitializer();
@@ -1583,26 +1602,30 @@
         buildIndexAccessor(receiver, index).buildSimpleRead(), node);
   }
 
-  ir.Expression buildIndexPostfix(Accessor accessor, IncDecOperator operator) {
+  ir.Expression buildIndexPostfix(
+      Send node, Accessor accessor, IncDecOperator operator) {
     ir.Name name = kernel.irName(operator.selectorName, currentElement);
-    return accessor.buildPostfixIncrement(name, voidContext: isVoidContext);
+    return buildPostfixIncrement(node, accessor, name);
   }
 
   @override
   ir.Expression visitIndexPostfix(
       Send node, Node receiver, Node index, IncDecOperator operator, _) {
-    return buildIndexPostfix(buildIndexAccessor(receiver, index), operator);
+    return buildIndexPostfix(
+        node, buildIndexAccessor(receiver, index), operator);
   }
 
-  ir.Expression buildIndexPrefix(Accessor accessor, IncDecOperator operator) {
+  ir.Expression buildIndexPrefix(
+      Send node, Accessor accessor, IncDecOperator operator) {
     ir.Name name = kernel.irName(operator.selectorName, currentElement);
-    return accessor.buildPrefixIncrement(name, voidContext: isVoidContext);
+    return buildPrefixIncrement(node, accessor, name);
   }
 
   @override
   ir.Expression visitIndexPrefix(
       Send node, Node receiver, Node index, IncDecOperator operator, _) {
-    return buildIndexPrefix(buildIndexAccessor(receiver, index), operator);
+    return buildIndexPrefix(
+        node, buildIndexAccessor(receiver, index), operator);
   }
 
   @override
@@ -1655,18 +1678,19 @@
     return buildConstructorInvoke(node, isConst: true);
   }
 
-  ir.IsExpression buildIs(Node expression, DartType type) {
+  ir.IsExpression buildIs(Node expression, ResolutionDartType type) {
     return new ir.IsExpression(
         visitForValue(expression), kernel.typeToIr(type));
   }
 
   @override
-  ir.IsExpression visitIs(Send node, Node expression, DartType type, _) {
+  ir.IsExpression visitIs(
+      Send node, Node expression, ResolutionDartType type, _) {
     return buildIs(expression, type);
   }
 
   @override
-  ir.Not visitIsNot(Send node, Node expression, DartType type, _) {
+  ir.Not visitIsNot(Send node, Node expression, ResolutionDartType type, _) {
     return new ir.Not(buildIs(expression, type));
   }
 
@@ -1725,29 +1749,49 @@
   ir.Expression buildCompound(
       Accessor accessor, CompoundRhs rhs, SendSet node) {
     ir.Name name = kernel.irName(rhs.operator.selectorName, currentElement);
-    ir.Expression result;
     switch (rhs.kind) {
       case CompoundKind.POSTFIX:
-        result =
-            accessor.buildPostfixIncrement(name, voidContext: isVoidContext);
-        break;
+        return buildPostfixIncrement(node, accessor, name);
 
       case CompoundKind.PREFIX:
-        result =
-            accessor.buildPrefixIncrement(name, voidContext: isVoidContext);
-        break;
+        return buildPrefixIncrement(node, accessor, name);
 
       case CompoundKind.ASSIGNMENT:
-        result = accessor.buildCompoundAssignment(name, visitForValue(rhs.rhs),
-            voidContext: isVoidContext);
-        break;
+        return buildCompoundAssignment(
+            node, accessor, name, visitForValue(rhs.rhs));
     }
+  }
+
+  ir.Expression buildCompoundAssignment(
+      SendSet node, Accessor accessor, ir.Name name, ir.Expression rhs) {
+    ir.Expression result =
+        accessor.buildCompoundAssignment(name, rhs, voidContext: isVoidContext);
+    associateCompoundComponents(accessor, node);
+    return result;
+  }
+
+  ir.Expression buildPrefixIncrement(
+      SendSet node, Accessor accessor, ir.Name name) {
+    ir.Expression result =
+        accessor.buildPrefixIncrement(name, voidContext: isVoidContext);
+    associateCompoundComponents(accessor, node);
+    return result;
+  }
+
+  ir.Expression buildPostfixIncrement(
+      SendSet node, Accessor accessor, ir.Name name) {
+    ir.Expression result =
+        accessor.buildPostfixIncrement(name, voidContext: isVoidContext);
+    associateCompoundComponents(accessor, node);
+    return result;
+  }
+
+  void associateCompoundComponents(Accessor accessor, Node node) {
     assert(accessor.builtBinary != null);
     kernel.nodeToAstOperator[accessor.builtBinary] = node;
     if (accessor.builtGetter != null) {
       kernel.nodeToAst[accessor.builtGetter] = node;
     }
-    return result;
   }
 
   @override
@@ -1857,9 +1901,7 @@
   ir.Expression handleLocalSetIfNulls(
       SendSet node, LocalElement local, Node rhs, _,
       {bool isSetterValid}) {
-    return new VariableAccessor(getLocal(local)).buildNullAwareAssignment(
-        visitForValue(rhs), null,
-        voidContext: isVoidContext);
+    return _finishSetIfNull(node, new VariableAccessor(getLocal(local)), rhs);
   }
 
   @override
@@ -1867,7 +1909,7 @@
       FunctionExpression node,
       ConstructorElement constructor,
       NodeList parameters,
-      DartType redirectionType, // TODO(ahe): Should be InterfaceType.
+      ResolutionDartType redirectionType, // TODO(ahe): Should be InterfaceType.
       ConstructorElement redirectionTarget,
       _) {
     if (!constructor.isFactoryConstructor) {
@@ -1896,9 +1938,9 @@
   ir.InvocationExpression visitRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       ConstructorElement effectiveTarget,
-      InterfaceType effectiveTargetType,
+      ResolutionInterfaceType effectiveTargetType,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -1919,7 +1961,7 @@
   ir.InvocationExpression visitRedirectingGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -1974,9 +2016,7 @@
     if (setterKind == CompoundSetter.INVALID) {
       setter = null;
     }
-    return buildStaticAccessor(getter, setter).buildNullAwareAssignment(
-        visitForValue(rhs), null,
-        voidContext: isVoidContext);
+    return _finishSetIfNull(node, buildStaticAccessor(getter, setter), rhs);
   }
 
   ir.VariableDeclaration getLocal(LocalElement local) {
@@ -1994,8 +2034,7 @@
   }
 
   ir.FunctionNode buildFunctionNode(FunctionElement function, Node bodyNode) {
-    List<ir.TypeParameter> typeParameters =
-        kernel.typeParametersNotImplemented();
+    List<ir.TypeParameter> typeParameters = <ir.TypeParameter>[];
     List<ir.VariableDeclaration> positionalParameters =
         <ir.VariableDeclaration>[];
     List<ir.VariableDeclaration> namedParameters = <ir.VariableDeclaration>[];
@@ -2019,6 +2058,8 @@
         if (initializer != null) {
           variable.initializer = initializer;
           initializer.parent = variable;
+          kernel.parameterInitializerNodeToConstant[initializer] =
+              parameter.constant;
         }
       });
       if (function.isGenerativeConstructor) {
@@ -2027,10 +2068,10 @@
         returnType = typeToIrHack(signature.type.returnType);
       }
       if (function.isFactoryConstructor) {
-        InterfaceType type = function.enclosingClass.thisType;
+        ResolutionInterfaceType type = function.enclosingClass.thisType;
         if (type.isGeneric) {
           typeParameters = new List<ir.TypeParameter>();
-          for (DartType parameter in type.typeArguments) {
+          for (ResolutionDartType parameter in type.typeArguments) {
             typeParameters.add(kernel.typeVariableToIr(parameter.element));
           }
         }
@@ -2129,12 +2170,20 @@
   }
 
   @override
-  ir.StaticInvocation handleStaticFunctionIncompatibleInvoke(
+  ir.Expression handleStaticFunctionIncompatibleInvoke(
       Send node,
       MethodElement function,
       NodeList arguments,
       CallStructure callStructure,
       _) {
+    if (!kernel.compiler.resolution.hasBeenResolved(function) &&
+        !function.isMalformed) {
+      // TODO(sigmund): consider calling nSM or handle recovery differently
+      // here. This case occurs only when this call was the only call to
+      // function, and knowing that the call was erroneous, our resolver didn't
+      // enqueue function itself.
+      return new ir.InvalidExpression();
+    }
     return buildStaticInvoke(function, arguments, isConst: false);
   }
 
@@ -2186,7 +2235,8 @@
       // TODO(ahe): Support deferred load.
       return new ir.InvalidExpression();
     }
-    return buildCall(buildStaticGet(getter), callStructure, arguments);
+    return associateNode(
+        buildCall(buildStaticGet(getter), callStructure, arguments), node);
   }
 
   @override
@@ -2208,14 +2258,9 @@
   }
 
   @override
-  ir.MethodInvocation handleStaticSetterInvoke(
-      Send node,
-      FunctionElement setter,
-      NodeList arguments,
-      CallStructure callStructure,
-      _) {
-    return buildCall(buildStaticAccessor(null, setter).buildSimpleRead(),
-        callStructure, arguments);
+  ir.Expression handleStaticSetterInvoke(Send node, FunctionElement setter,
+      NodeList arguments, CallStructure callStructure, _) {
+    return new ir.InvalidExpression();
   }
 
   @override
@@ -2250,19 +2295,18 @@
       AssignmentOperator operator,
       Node rhs,
       _) {
-    // TODO(sra): Find binary operator.
-    return buildSuperIndexAccessor(index, getter, setter)
-        .buildCompoundAssignment(
-            kernel.irName(operator.selectorName, currentElement),
-            visitForValue(rhs),
-            voidContext: isVoidContext);
+    return buildCompoundAssignment(
+        node,
+        buildSuperIndexAccessor(index, getter, setter),
+        kernel.irName(operator.selectorName, currentElement),
+        visitForValue(rhs));
   }
 
   @override
   ir.Initializer visitSuperConstructorInvoke(
       Send node,
       ConstructorElement superConstructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -2418,9 +2462,8 @@
     if (setterKind == CompoundSetter.INVALID) {
       setter = null;
     }
-    return buildSuperPropertyAccessor(getter, setter).buildNullAwareAssignment(
-        visitForValue(rhs), null,
-        voidContext: isVoidContext);
+    return _finishSetIfNull(
+        node, buildSuperPropertyAccessor(getter, setter), rhs);
   }
 
   @override
@@ -2434,7 +2477,7 @@
       MethodElement indexSetFunction, Node index, IncDecOperator operator, _) {
     Accessor accessor =
         buildSuperIndexAccessor(index, indexFunction, indexSetFunction);
-    return buildIndexPostfix(accessor, operator);
+    return buildIndexPostfix(node, accessor, operator);
   }
 
   @override
@@ -2442,7 +2485,7 @@
       MethodElement indexSetFunction, Node index, IncDecOperator operator, _) {
     Accessor accessor =
         buildSuperIndexAccessor(index, indexFunction, indexSetFunction);
-    return buildIndexPrefix(accessor, operator);
+    return buildIndexPrefix(node, accessor, operator);
   }
 
   @override
@@ -2547,7 +2590,8 @@
   @override
   ir.MethodInvocation visitThisInvoke(
       Send node, NodeList arguments, CallStructure callStructure, _) {
-    return buildCall(new ir.ThisExpression(), callStructure, arguments);
+    return associateNode(
+        buildCall(new ir.ThisExpression(), callStructure, arguments), node);
   }
 
   Accessor buildThisPropertyAccessor(Name name) {
@@ -2634,7 +2678,8 @@
       NodeList arguments,
       CallStructure callStructure,
       _) {
-    return buildCall(buildTypeVariable(element), callStructure, arguments);
+    return associateNode(
+        buildCall(buildTypeVariable(element), callStructure, arguments), node);
   }
 
   @override
@@ -2647,9 +2692,8 @@
   @override
   ir.Expression visitTypeVariableTypeLiteralSetIfNull(
       Send node, TypeVariableElement element, Node rhs, _) {
-    return new ReadOnlyAccessor(buildTypeVariable(element))
-        .buildNullAwareAssignment(visitForValue(rhs), null,
-            voidContext: isVoidContext);
+    return _finishSetIfNull(
+        node, new ReadOnlyAccessor(buildTypeVariable(element)), rhs);
   }
 
   @override
@@ -2665,7 +2709,8 @@
       NodeList arguments,
       CallStructure callStructure,
       _) {
-    return buildCall(buildTypeLiteral(constant), callStructure, arguments);
+    return associateNode(
+        buildCall(buildTypeLiteral(constant), callStructure, arguments), node);
   }
 
   @override
@@ -2713,17 +2758,14 @@
   @override
   ir.Expression visitIndexSetIfNull(
       SendSet node, Node receiver, Node index, Node rhs, _) {
-    return buildIndexAccessor(receiver, index).buildNullAwareAssignment(
-        visitForValue(rhs), null,
-        voidContext: isVoidContext);
+    return _finishSetIfNull(node, buildIndexAccessor(receiver, index), rhs);
   }
 
   @override
   ir.Expression visitSuperIndexSetIfNull(SendSet node, MethodElement getter,
       MethodElement setter, Node index, Node rhs, _) {
-    return buildSuperIndexAccessor(index, getter, setter)
-        .buildNullAwareAssignment(visitForValue(rhs), null,
-            voidContext: isVoidContext);
+    return _finishSetIfNull(
+        node, buildSuperIndexAccessor(index, getter, setter), rhs);
   }
 
   @override
diff --git a/pkg/compiler/lib/src/kernel/task.dart b/pkg/compiler/lib/src/kernel/task.dart
index 59cf0b4..42f439b 100644
--- a/pkg/compiler/lib/src/kernel/task.dart
+++ b/pkg/compiler/lib/src/kernel/task.dart
@@ -29,8 +29,8 @@
   ///
   /// May enqueue more elements to the resolution queue.
   void buildKernelIr() => measure(() {
-    program = buildProgram(_compiler.mainApp);
-  });
+        program = buildProgram(_compiler.mainApp);
+      });
 
   /// Builds the kernel IR program for the main function exported from
   /// [library].
diff --git a/pkg/compiler/lib/src/kernel/unresolved.dart b/pkg/compiler/lib/src/kernel/unresolved.dart
index 04632b7..8a984ed 100644
--- a/pkg/compiler/lib/src/kernel/unresolved.dart
+++ b/pkg/compiler/lib/src/kernel/unresolved.dart
@@ -4,7 +4,8 @@
 
 import 'package:kernel/ast.dart' as ir;
 
-import "../dart_types.dart" show DartType, InterfaceType;
+import "../elements/resolution_types.dart"
+    show ResolutionDartType, ResolutionInterfaceType;
 import "../elements/elements.dart"
     show
         AstElement,
@@ -29,6 +30,7 @@
   bool get isVoidContext;
   ir.Arguments buildArguments(NodeList arguments);
   ir.TreeNode visitForValue(Expression node);
+  void associateCompoundComponents(Accessor accessor, Node node);
 
   // TODO(ahe): Delete this method.
   ir.InvalidExpression handleUnresolved(Node node);
@@ -57,11 +59,15 @@
   ir.Expression buildThrowNoSuchMethodError(ir.Procedure exceptionBuilder,
       ir.Expression receiver, String memberName, ir.Arguments callArguments,
       [Element candidateTarget]) {
-    ir.Expression memberNameArg = new ir.SymbolLiteral(memberName);
-    ir.Expression positional = new ir.ListLiteral(callArguments.positional);
-    ir.Expression named = new ir.MapLiteral(callArguments.named.map((e) {
-      return new ir.MapEntry(new ir.SymbolLiteral(e.name), e.value);
-    }).toList());
+    ir.Expression memberNameArg =
+        markSynthetic(new ir.SymbolLiteral(memberName));
+    ir.Expression positional =
+        markSynthetic(new ir.ListLiteral(callArguments.positional));
+    ir.Expression named =
+        markSynthetic(new ir.MapLiteral(callArguments.named.map((e) {
+      return new ir.MapEntry(
+          markSynthetic(new ir.SymbolLiteral(e.name)), e.value);
+    }).toList()));
     if (candidateTarget is FunctionElement) {
       // Ensure [candidateTarget] has been resolved.
       possiblyErroneousFunctionToIr(candidateTarget);
@@ -72,13 +78,15 @@
         candidateTarget.hasFunctionSignature) {
       List<ir.Expression> existingArgumentsList = <ir.Expression>[];
       candidateTarget.functionSignature.forEachParameter((param) {
-        existingArgumentsList.add(new ir.StringLiteral(param.name));
+        existingArgumentsList
+            .add(markSynthetic(new ir.StringLiteral(param.name)));
       });
-      existingArguments = new ir.ListLiteral(existingArgumentsList);
+      existingArguments =
+          markSynthetic(new ir.ListLiteral(existingArgumentsList));
     } else {
       existingArguments = new ir.NullLiteral();
     }
-    return new ir.Throw(new ir.StaticInvocation(
+    ir.Expression construction = markSynthetic(new ir.StaticInvocation(
         exceptionBuilder,
         new ir.Arguments(<ir.Expression>[
           receiver,
@@ -87,6 +95,12 @@
           named,
           existingArguments
         ])));
+    return new ir.Throw(construction);
+  }
+
+  ir.Expression markSynthetic(ir.Expression expression) {
+    kernel.syntheticNodes.add(expression);
+    return expression;
   }
 
   /// Throws a NoSuchMethodError for an unresolved getter named [name].
@@ -111,6 +125,7 @@
   }
 
   ir.Expression buildThrowUnresolvedSuperGetter(String name) {
+    // TODO(sra): This is incorrect when the superclass defines noSuchMethod.
     return buildThrowNoSuchMethodError(kernel.getUnresolvedSuperGetterBuilder(),
         new ir.ThisExpression(), name, new ir.Arguments.empty());
   }
@@ -145,7 +160,7 @@
   ir.Expression visitUnresolvedClassConstructorInvoke(
       NewExpression node,
       ErroneousElement element,
-      DartType type,
+      ResolutionDartType type,
       NodeList arguments,
       Selector selector,
       _) {
@@ -158,7 +173,7 @@
   ir.Expression visitUnresolvedConstructorInvoke(
       NewExpression node,
       Element constructor,
-      DartType type,
+      ResolutionDartType type,
       NodeList arguments,
       Selector selector,
       _) {
@@ -199,7 +214,7 @@
   ir.Expression visitUnresolvedRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -256,16 +271,22 @@
       MethodElement getter, Element element, IncDecOperator operator, _) {
     var accessor = new ClassStaticAccessor(
         this, getter.name, possiblyErroneousFunctionToIr(getter), null);
-    return accessor.buildPostfixIncrement(new ir.Name(operator.selectorName),
+    var result = accessor.buildPostfixIncrement(
+        new ir.Name(operator.selectorName),
         voidContext: isVoidContext);
+    associateCompoundComponents(accessor, node);
+    return result;
   }
 
   ir.Expression visitUnresolvedStaticSetterPrefix(Send node,
       MethodElement getter, Element element, IncDecOperator operator, _) {
     var accessor = new ClassStaticAccessor(
         this, getter.name, possiblyErroneousFunctionToIr(getter), null);
-    return accessor.buildPrefixIncrement(new ir.Name(operator.selectorName),
+    var result = accessor.buildPrefixIncrement(
+        new ir.Name(operator.selectorName),
         voidContext: isVoidContext);
+    associateCompoundComponents(accessor, node);
+    return result;
   }
 
   ir.Expression visitUnresolvedStaticSetterSetIfNull(
@@ -278,6 +299,7 @@
 
   ir.Expression visitUnresolvedSuperBinary(
       Send node, Element element, BinaryOperator operator, Node argument, _) {
+    // TODO(sra): This is incorrect when the superclass defines noSuchMethod.
     return buildThrowNoSuchMethodError(
         kernel.getUnresolvedSuperMethodBuilder(),
         new ir.ThisExpression(),
@@ -508,25 +530,33 @@
       _) {
     var accessor = new TopLevelStaticAccessor(
         this, getter.name, possiblyErroneousFunctionToIr(getter), null);
-    return accessor.buildCompoundAssignment(
+    var result = accessor.buildCompoundAssignment(
         new ir.Name(operator.selectorName), visitForValue(rhs),
         voidContext: isVoidContext);
+    associateCompoundComponents(accessor, node);
+    return result;
   }
 
   ir.Expression visitUnresolvedTopLevelSetterPostfix(Send node,
       MethodElement getter, Element element, IncDecOperator operator, _) {
     var accessor = new TopLevelStaticAccessor(
         this, getter.name, possiblyErroneousFunctionToIr(getter), null);
-    return accessor.buildPostfixIncrement(new ir.Name(operator.selectorName),
+    var result = accessor.buildPostfixIncrement(
+        new ir.Name(operator.selectorName),
         voidContext: isVoidContext);
+    associateCompoundComponents(accessor, node);
+    return result;
   }
 
   ir.Expression visitUnresolvedTopLevelSetterPrefix(Send node,
       MethodElement getter, Element element, IncDecOperator operator, _) {
     var accessor = new TopLevelStaticAccessor(
         this, getter.name, possiblyErroneousFunctionToIr(getter), null);
-    return accessor.buildPrefixIncrement(new ir.Name(operator.selectorName),
+    var result = accessor.buildPrefixIncrement(
+        new ir.Name(operator.selectorName),
         voidContext: isVoidContext);
+    associateCompoundComponents(accessor, node);
+    return result;
   }
 
   ir.Expression visitUnresolvedTopLevelSetterSetIfNull(
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index c7c6e86..796b707 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -427,7 +427,8 @@
       // TODO(johnniwinther): Ensure that currentHandler correctly encloses the
       // loading of a library cluster.
       currentHandler = new LibraryDependencyHandler(this);
-      return createLibrary(currentHandler, null, resolvedUri,
+      return createLibrary(
+              currentHandler, null, resolvedUri, NO_LOCATION_SPANNABLE,
               skipFileWithPartOfTag: skipFileWithPartOfTag)
           .then((LibraryElement library) {
         if (library == null) {
@@ -543,7 +544,7 @@
 
         // Import dart:core if not already imported.
         if (!importsDartCore && library.canonicalUri != Uris.dart_core) {
-          return createLibrary(handler, null, Uris.dart_core)
+          return createLibrary(handler, null, Uris.dart_core, library)
               .then((LibraryElement coreLibrary) {
             handler.registerDependency(
                 library,
@@ -629,7 +630,7 @@
       LibraryElement library, LibraryDependencyElementX libraryDependency) {
     Uri base = library.canonicalUri;
     Uri resolvedUri = base.resolveUri(libraryDependency.uri);
-    return createLibrary(handler, library, resolvedUri, node: libraryDependency)
+    return createLibrary(handler, library, resolvedUri, libraryDependency)
         .then((LibraryElement loadedLibrary) {
       if (loadedLibrary == null) return;
       reporter.withCurrentElement(library, () {
@@ -650,15 +651,15 @@
     return listener.onLibraryScanned(library, handler).then((_) {
       return Future.forEach(library.imports, (ImportElement import) {
         Uri resolvedUri = library.canonicalUri.resolveUri(import.uri);
-        return createLibrary(handler, library, resolvedUri);
+        return createLibrary(handler, library, resolvedUri, library);
       }).then((_) {
         return Future.forEach(library.exports, (ExportElement export) {
           Uri resolvedUri = library.canonicalUri.resolveUri(export.uri);
-          return createLibrary(handler, library, resolvedUri);
+          return createLibrary(handler, library, resolvedUri, library);
         }).then((_) {
           // TODO(johnniwinther): Shouldn't there be an [ImportElement] for the
           // implicit import of dart:core?
-          return createLibrary(handler, library, Uris.dart_core);
+          return createLibrary(handler, library, Uris.dart_core, library);
         }).then((_) => library);
       });
     });
@@ -680,10 +681,10 @@
    * If a new library is created, the [handler] is notified.
    */
   Future<LibraryElement> createLibrary(LibraryDependencyHandler handler,
-      LibraryElement importingLibrary, Uri resolvedUri,
-      {Spannable node, bool skipFileWithPartOfTag: false}) {
+      LibraryElement importingLibrary, Uri resolvedUri, Spannable spannable,
+      {bool skipFileWithPartOfTag: false}) {
     Uri readableUri =
-        uriTranslator.translate(importingLibrary, resolvedUri, node);
+        uriTranslator.translate(importingLibrary, resolvedUri, spannable);
     LibraryElement library = libraryCanonicalUriMap[resolvedUri];
     if (library != null) {
       return new Future.value(library);
@@ -693,7 +694,7 @@
         return loadDeserializedLibrary(handler, library);
       }
       return reporter.withCurrentElement(importingLibrary, () {
-        return _readScript(node, readableUri, resolvedUri)
+        return _readScript(spannable, readableUri, resolvedUri)
             .then((Script script) {
           if (script == null) return null;
           LibraryElement element =
@@ -721,7 +722,7 @@
               DiagnosticMessage info = reporter.withCurrentElement(
                   importingLibrary,
                   () => reporter.createMessage(
-                      node, MessageKind.IMPORT_PART_OF_HERE));
+                      spannable, MessageKind.IMPORT_PART_OF_HERE));
               reporter.reportError(error, [info]);
             }
           }
diff --git a/pkg/compiler/lib/src/mirrors_used.dart b/pkg/compiler/lib/src/mirrors_used.dart
index 79dac05..08c8750 100644
--- a/pkg/compiler/lib/src/mirrors_used.dart
+++ b/pkg/compiler/lib/src/mirrors_used.dart
@@ -16,16 +16,17 @@
         ListConstantValue,
         StringConstantValue,
         TypeConstantValue;
-import 'dart_types.dart' show DartType, InterfaceType;
+import 'elements/resolution_types.dart'
+    show ResolutionDartType, ResolutionInterfaceType;
 import 'elements/elements.dart'
     show
         ClassElement,
         Element,
+        FieldElement,
         ImportElement,
         LibraryElement,
         MetadataAnnotation,
-        ScopeContainerElement,
-        VariableElement;
+        ScopeContainerElement;
 import 'resolution/tree_elements.dart' show TreeElements;
 import 'tree/tree.dart' show NamedArgument, NewExpression, Node;
 
@@ -115,7 +116,7 @@
         (librariesWithUsage != null && librariesWithUsage.contains(library));
   }
 
-  /// Call-back from the resolver to analyze MirorsUsed annotations. The result
+  /// Call-back from the resolver to analyze MirrorsUsed annotations. The result
   /// is stored in [analyzer] and later used to compute
   /// [:analyzer.mergedMirrorUsage:].
   void validate(NewExpression node, TreeElements mapping) {
@@ -251,7 +252,8 @@
       metadata.ensureResolved(compiler.resolution);
       ConstantValue value =
           compiler.constants.getConstantValue(metadata.constant);
-      Element element = value.getType(compiler.coreTypes).element;
+      ResolutionDartType type = value.getType(compiler.commonElements);
+      Element element = type.element;
       if (element == compiler.commonElements.mirrorsUsedClass) {
         result.add(buildUsage(value));
       }
@@ -259,7 +261,7 @@
     return result;
   }
 
-  /// Merge all [MirrorUsage] instances accross all libraries.
+  /// Merge all [MirrorUsage] instances across all libraries.
   MirrorUsage mergeUsages(Map<LibraryElement, List<MirrorUsage>> usageMap) {
     Set<MirrorUsage> usagesToMerge = new Set<MirrorUsage>();
     usageMap.forEach((LibraryElement library, List<MirrorUsage> usages) {
@@ -314,12 +316,12 @@
   /// Convert a [constant] to an instance of [MirrorUsage] using information
   /// that was resolved during [MirrorUsageAnalyzerTask.validate].
   MirrorUsage buildUsage(ConstructedConstantValue constant) {
-    Map<Element, ConstantValue> fields = constant.fields;
+    Map<FieldElement, ConstantValue> fields = constant.fields;
     ClassElement cls = compiler.commonElements.mirrorsUsedClass;
-    VariableElement symbolsField = cls.lookupLocalMember('symbols');
-    VariableElement targetsField = cls.lookupLocalMember('targets');
-    VariableElement metaTargetsField = cls.lookupLocalMember('metaTargets');
-    VariableElement overrideField = cls.lookupLocalMember('override');
+    FieldElement symbolsField = cls.lookupLocalMember('symbols');
+    FieldElement targetsField = cls.lookupLocalMember('targets');
+    FieldElement metaTargetsField = cls.lookupLocalMember('metaTargets');
+    FieldElement overrideField = cls.lookupLocalMember('override');
 
     return new MirrorUsage(
         cachedStrings[fields[symbolsField]],
@@ -414,14 +416,14 @@
   }
 
   /// Find the first non-implementation interface of constant.
-  DartType apiTypeOf(ConstantValue constant) {
-    DartType type = constant.getType(compiler.coreTypes);
+  ResolutionDartType apiTypeOf(ConstantValue constant) {
+    ResolutionDartType type = constant.getType(compiler.commonElements);
     LibraryElement library = type.element.library;
     if (type.isInterfaceType && library.isInternalLibrary) {
-      InterfaceType interface = type;
+      ResolutionInterfaceType interface = type;
       ClassElement cls = type.element;
       cls.ensureResolved(compiler.resolution);
-      for (DartType supertype in cls.allSupertypes) {
+      for (ResolutionDartType supertype in cls.allSupertypes) {
         if (supertype.isInterfaceType &&
             !supertype.element.library.isInternalLibrary) {
           return interface.asInstanceOf(supertype.element);
@@ -445,8 +447,8 @@
     }
     List<Element> result = <Element>[];
     for (var entry in list) {
-      if (entry is DartType) {
-        DartType type = entry;
+      if (entry is ResolutionDartType) {
+        ResolutionDartType type = entry;
         result.add(type.element);
       } else {
         String string = entry;
diff --git a/pkg/compiler/lib/src/native/behavior.dart b/pkg/compiler/lib/src/native/behavior.dart
index e34145a..e236975 100644
--- a/pkg/compiler/lib/src/native/behavior.dart
+++ b/pkg/compiler/lib/src/native/behavior.dart
@@ -8,8 +8,8 @@
 import '../compiler.dart' show Compiler;
 import '../constants/expressions.dart';
 import '../constants/values.dart';
-import '../core_types.dart' show CoreTypes;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../js/js.dart' as js;
 import '../js_backend/js_backend.dart';
@@ -130,10 +130,12 @@
  * `null` may be returned.
  */
 class NativeBehavior {
-  /// [DartType]s or [SpecialType]s returned or yielded by the native element.
+  /// [ResolutionDartType]s or [SpecialType]s returned or yielded by the native
+  /// element.
   final List typesReturned = [];
 
-  /// [DartType]s or [SpecialType]s instantiated by the native element.
+  /// [ResolutionDartType]s or [SpecialType]s instantiated by the native
+  /// element.
   final List typesInstantiated = [];
 
   String codeTemplateText;
@@ -498,8 +500,12 @@
   }
 
   /// Compute the [NativeBehavior] for a [Send] node calling the 'JS' function.
-  static NativeBehavior ofJsCallSend(Send jsCall, DiagnosticReporter reporter,
-      ParsingContext parsing, CoreTypes coreTypes, ForeignResolver resolver) {
+  static NativeBehavior ofJsCallSend(
+      Send jsCall,
+      DiagnosticReporter reporter,
+      ParsingContext parsing,
+      CommonElements commonElements,
+      ForeignResolver resolver) {
     var argNodes = jsCall.arguments;
     if (argNodes.isEmpty || argNodes.tail.isEmpty) {
       reporter.reportErrorMessage(jsCall, MessageKind.WRONG_ARGUMENT_FOR_JS);
@@ -524,7 +530,7 @@
     String codeString = codeArgument.dartString.slowToString();
 
     return ofJsCall(specString, codeString, _typeLookup(specArgument, resolver),
-        specArgument, reporter, coreTypes);
+        specArgument, reporter, commonElements);
   }
 
   /// Compute the [NativeBehavior] for a call to the 'JS' function with the
@@ -535,7 +541,7 @@
       TypeLookup lookupType,
       Spannable spannable,
       DiagnosticReporter reporter,
-      CoreTypes coreTypes) {
+      CommonElements commonElements) {
     // The first argument of a JS-call is a string encoding various attributes
     // of the code.
     //
@@ -576,8 +582,8 @@
         lookupType: lookupType,
         typesReturned: behavior.typesReturned,
         typesInstantiated: behavior.typesInstantiated,
-        objectType: coreTypes.objectType,
-        nullType: coreTypes.nullType);
+        objectType: commonElements.objectType,
+        nullType: commonElements.nullType);
 
     if (!sideEffectsAreEncodedInSpecString) {
       new SideEffectsVisitor(behavior.sideEffects)
@@ -597,7 +603,7 @@
       String specString,
       TypeLookup lookupType,
       DiagnosticReporter reporter,
-      CoreTypes coreTypes,
+      CommonElements commonElements,
       {List<String> validTags}) {
     void setSideEffects(SideEffects newEffects) {
       behavior.sideEffects.setTo(newEffects);
@@ -609,14 +615,14 @@
         setSideEffects: setSideEffects,
         typesReturned: behavior.typesReturned,
         typesInstantiated: behavior.typesInstantiated,
-        objectType: coreTypes.objectType,
-        nullType: coreTypes.nullType);
+        objectType: commonElements.objectType,
+        nullType: commonElements.nullType);
   }
 
   static NativeBehavior ofJsBuiltinCallSend(
       Send jsBuiltinCall,
       DiagnosticReporter reporter,
-      CoreTypes coreTypes,
+      CommonElements commonElements,
       ForeignResolver resolver) {
     NativeBehavior behavior = new NativeBehavior();
     behavior.sideEffects.setTo(new SideEffects());
@@ -650,7 +656,7 @@
     String specString = specLiteral.dartString.slowToString();
 
     return ofJsBuiltinCall(specString, _typeLookup(jsBuiltinCall, resolver),
-        jsBuiltinCall, reporter, coreTypes);
+        jsBuiltinCall, reporter, commonElements);
   }
 
   static NativeBehavior ofJsBuiltinCall(
@@ -658,18 +664,18 @@
       TypeLookup lookupType,
       Spannable spannable,
       DiagnosticReporter reporter,
-      CoreTypes coreTypes) {
+      CommonElements commonElements) {
     NativeBehavior behavior = new NativeBehavior();
     behavior.sideEffects.setTo(new SideEffects());
     _fillNativeBehaviorOfBuiltinOrEmbeddedGlobal(
-        behavior, spannable, specString, lookupType, reporter, coreTypes);
+        behavior, spannable, specString, lookupType, reporter, commonElements);
     return behavior;
   }
 
   static NativeBehavior ofJsEmbeddedGlobalCallSend(
       Send jsEmbeddedGlobalCall,
       DiagnosticReporter reporter,
-      CoreTypes coreTypes,
+      CommonElements commonElements,
       ForeignResolver resolver) {
     NativeBehavior behavior = new NativeBehavior();
     // TODO(sra): Allow the use site to override these defaults.
@@ -717,7 +723,7 @@
         _typeLookup(jsEmbeddedGlobalCall, resolver),
         jsEmbeddedGlobalCall,
         reporter,
-        coreTypes);
+        commonElements);
   }
 
   static NativeBehavior ofJsEmbeddedGlobalCall(
@@ -725,7 +731,7 @@
       TypeLookup lookupType,
       Spannable spannable,
       DiagnosticReporter reporter,
-      CoreTypes coreTypes) {
+      CommonElements commonElements) {
     NativeBehavior behavior = new NativeBehavior();
     // TODO(sra): Allow the use site to override these defaults.
     // Embedded globals are usually pre-computed data structures or JavaScript
@@ -733,21 +739,21 @@
     behavior.sideEffects.setTo(new SideEffects.empty());
     behavior.throwBehavior = NativeThrowBehavior.NEVER;
     _fillNativeBehaviorOfBuiltinOrEmbeddedGlobal(
-        behavior, spannable, specString, lookupType, reporter, coreTypes,
+        behavior, spannable, specString, lookupType, reporter, commonElements,
         validTags: ['returns', 'creates']);
     return behavior;
   }
 
   static NativeBehavior ofMethodElement(
       FunctionElement element, Compiler compiler) {
-    FunctionType type = element.computeType(compiler.resolution);
+    ResolutionFunctionType type = element.computeType(compiler.resolution);
     List<ConstantExpression> metadata = <ConstantExpression>[];
     for (MetadataAnnotation annotation in element.implementation.metadata) {
       annotation.ensureResolved(compiler.resolution);
       metadata.add(annotation.constant);
     }
 
-    DartType lookup(String name) {
+    ResolutionDartType lookup(String name) {
       Element e = element.buildScope().lookup(name);
       if (e == null) return null;
       if (e is! ClassElement) return null;
@@ -762,7 +768,7 @@
 
   static NativeBehavior ofMethod(
       Spannable spannable,
-      FunctionType type,
+      ResolutionFunctionType type,
       List<ConstantExpression> metadata,
       TypeLookup lookupType,
       Compiler compiler,
@@ -781,18 +787,18 @@
     behavior.typesReturned.add(
         !isJsInterop || compiler.options.trustJSInteropTypeAnnotations
             ? returnType
-            : const DynamicType());
+            : const ResolutionDynamicType());
     if (!type.returnType.isVoid) {
       // Declared types are nullable.
-      behavior.typesReturned.add(compiler.coreTypes.nullType);
+      behavior.typesReturned.add(compiler.commonElements.nullType);
     }
     behavior._capture(type, compiler.resolution,
         isInterop: isJsInterop, compiler: compiler);
 
-    for (DartType type in type.optionalParameterTypes) {
+    for (ResolutionDartType type in type.optionalParameterTypes) {
       behavior._escape(type, compiler.resolution);
     }
-    for (DartType type in type.namedParameterTypes) {
+    for (ResolutionDartType type in type.namedParameterTypes) {
       behavior._escape(type, compiler.resolution);
     }
 
@@ -804,14 +810,14 @@
   static NativeBehavior ofFieldElementLoad(
       MemberElement element, Compiler compiler) {
     Resolution resolution = compiler.resolution;
-    DartType type = element.computeType(resolution);
+    ResolutionDartType type = element.computeType(resolution);
     List<ConstantExpression> metadata = <ConstantExpression>[];
     for (MetadataAnnotation annotation in element.implementation.metadata) {
       annotation.ensureResolved(compiler.resolution);
       metadata.add(annotation.constant);
     }
 
-    DartType lookup(String name) {
+    ResolutionDartType lookup(String name) {
       Element e = element.buildScope().lookup(name);
       if (e == null) return null;
       if (e is! ClassElement) return null;
@@ -826,7 +832,7 @@
 
   static NativeBehavior ofFieldLoad(
       Spannable spannable,
-      DartType type,
+      ResolutionDartType type,
       List<ConstantExpression> metadata,
       TypeLookup lookupType,
       Compiler compiler,
@@ -837,9 +843,9 @@
     behavior.typesReturned.add(
         !isJsInterop || compiler.options.trustJSInteropTypeAnnotations
             ? type
-            : const DynamicType());
+            : const ResolutionDynamicType());
     // Declared types are nullable.
-    behavior.typesReturned.add(resolution.coreTypes.nullType);
+    behavior.typesReturned.add(resolution.commonElements.nullType);
     behavior._capture(type, resolution,
         isInterop: isJsInterop, compiler: compiler);
     behavior._overrideWithAnnotations(
@@ -849,11 +855,12 @@
 
   static NativeBehavior ofFieldElementStore(
       MemberElement field, Resolution resolution) {
-    DartType type = field.computeType(resolution);
+    ResolutionDartType type = field.computeType(resolution);
     return ofFieldStore(type, resolution);
   }
 
-  static NativeBehavior ofFieldStore(DartType type, Resolution resolution) {
+  static NativeBehavior ofFieldStore(
+      ResolutionDartType type, Resolution resolution) {
     var behavior = new NativeBehavior();
     behavior._escape(type, resolution);
     // We don't override the default behaviour - the annotations apply to
@@ -920,15 +927,15 @@
 
   /// Models the behavior of having intances of [type] escape from Dart code
   /// into native code.
-  void _escape(DartType type, Resolution resolution) {
+  void _escape(ResolutionDartType type, Resolution resolution) {
     type.computeUnaliased(resolution);
     type = type.unaliased;
-    if (type is FunctionType) {
-      FunctionType functionType = type;
+    if (type is ResolutionFunctionType) {
+      ResolutionFunctionType functionType = type;
       // A function might be called from native code, passing us novel
       // parameters.
       _escape(functionType.returnType, resolution);
-      for (DartType parameter in functionType.parameterTypes) {
+      for (ResolutionDartType parameter in functionType.parameterTypes) {
         _capture(parameter, resolution);
       }
     }
@@ -940,15 +947,15 @@
   ///
   /// We assume that JS-interop APIs cannot instantiate Dart types or
   /// non-JSInterop native types.
-  void _capture(DartType type, Resolution resolution,
+  void _capture(ResolutionDartType type, Resolution resolution,
       {bool isInterop: false, Compiler compiler}) {
     type.computeUnaliased(resolution);
     type = type.unaliased;
-    if (type is FunctionType) {
-      FunctionType functionType = type;
+    if (type is ResolutionFunctionType) {
+      ResolutionFunctionType functionType = type;
       _capture(functionType.returnType, resolution,
           isInterop: isInterop, compiler: compiler);
-      for (DartType parameter in functionType.parameterTypes) {
+      for (ResolutionDartType parameter in functionType.parameterTypes) {
         _escape(parameter, resolution);
       }
     } else {
@@ -988,7 +995,7 @@
       Spannable spannable, DiagnosticReporter reporter, TypeLookup lookupType) {
     if (typeString == '=Object') return SpecialType.JsObject;
     if (typeString == 'dynamic') {
-      return const DynamicType();
+      return const ResolutionDynamicType();
     }
     var type = lookupType(typeString);
     if (type != null) return type;
@@ -997,7 +1004,7 @@
     if (index < 1) {
       reporter.reportErrorMessage(spannable, MessageKind.GENERIC,
           {'text': "Type '$typeString' not found."});
-      return const DynamicType();
+      return const ResolutionDynamicType();
     }
     type = lookupType(typeString.substring(0, index));
     if (type != null) {
@@ -1006,6 +1013,6 @@
     }
     reporter.reportErrorMessage(spannable, MessageKind.GENERIC,
         {'text': "Type '$typeString' not found."});
-    return const DynamicType();
+    return const ResolutionDynamicType();
   }
 }
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index 300a650..2b804bd 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -9,10 +9,11 @@
 import '../common/resolution.dart' show Resolution;
 import '../compiler.dart' show Compiler;
 import '../constants/values.dart';
-import '../core_types.dart' show CoreTypes;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
 import '../elements/elements.dart';
+import '../elements/entities.dart';
 import '../elements/modelx.dart' show FunctionElementX;
+import '../elements/resolution_types.dart';
 import '../js_backend/backend_helpers.dart' show BackendHelpers;
 import '../js_backend/js_backend.dart';
 import '../js_emitter/js_emitter.dart' show CodeEmitterTask, NativeEmitter;
@@ -29,7 +30,7 @@
  */
 class NativeEnqueuer {
   /// Called when a [type] has been instantiated natively.
-  void onInstantiatedType(InterfaceType type) {}
+  void onInstantiatedType(ResolutionInterfaceType type) {}
 
   /// Initial entry point to native enqueuer.
   WorldImpact processNativeClasses(Iterable<LibraryElement> libraries) =>
@@ -97,9 +98,9 @@
   Resolution get resolution => compiler.resolution;
 
   DiagnosticReporter get reporter => compiler.reporter;
-  CoreTypes get coreTypes => compiler.coreTypes;
+  CommonElements get commonElements => compiler.commonElements;
 
-  void onInstantiatedType(InterfaceType type) {
+  void onInstantiatedType(ResolutionInterfaceType type) {
     if (_unusedClasses.remove(type.element)) {
       _registeredClasses.add(type.element);
     }
@@ -283,18 +284,10 @@
 
   void findAnnotationClasses() {
     if (_annotationCreatesClass != null) return;
-    ClassElement find(name) {
-      Element e = helpers.findHelper(name);
-      if (e == null || e is! ClassElement) {
-        reporter.internalError(NO_LOCATION_SPANNABLE,
-            "Could not find implementation class '${name}'.");
-      }
-      return e;
-    }
 
-    _annotationCreatesClass = find('Creates');
-    _annotationReturnsClass = find('Returns');
-    _annotationJsNameClass = find('JSName');
+    _annotationCreatesClass = helpers.annotationCreatesClass;
+    _annotationReturnsClass = helpers.annotationReturnsClass;
+    _annotationJsNameClass = helpers.annotationJSNameClass;
   }
 
   /// Returns the JSName annotation string or `null` if no JSName annotation is
@@ -430,7 +423,7 @@
 
   void _processNativeBehavior(
       WorldImpactBuilder impactBuilder, NativeBehavior behavior, cause) {
-    void registerInstantiation(InterfaceType type) {
+    void registerInstantiation(ResolutionInterfaceType type) {
       impactBuilder.registerTypeUse(new TypeUse.nativeInstantiation(type));
     }
 
@@ -439,23 +432,23 @@
     for (var type in behavior.typesInstantiated) {
       if (type is SpecialType) {
         if (type == SpecialType.JsObject) {
-          registerInstantiation(compiler.coreTypes.objectType);
+          registerInstantiation(compiler.commonElements.objectType);
         }
         continue;
       }
-      if (type is InterfaceType) {
-        if (type == coreTypes.intType) {
+      if (type is ResolutionInterfaceType) {
+        if (type == commonElements.intType) {
           registerInstantiation(type);
-        } else if (type == coreTypes.doubleType) {
+        } else if (type == commonElements.doubleType) {
           registerInstantiation(type);
-        } else if (type == coreTypes.numType) {
-          registerInstantiation(coreTypes.doubleType);
-          registerInstantiation(coreTypes.intType);
-        } else if (type == coreTypes.stringType) {
+        } else if (type == commonElements.numType) {
+          registerInstantiation(commonElements.doubleType);
+          registerInstantiation(commonElements.intType);
+        } else if (type == commonElements.stringType) {
           registerInstantiation(type);
-        } else if (type == coreTypes.nullType) {
+        } else if (type == commonElements.nullType) {
           registerInstantiation(type);
-        } else if (type == coreTypes.boolType) {
+        } else if (type == commonElements.boolType) {
           registerInstantiation(type);
         } else if (compiler.types.isSubtype(
             type, backend.backendClasses.listImplementation.rawType)) {
@@ -470,14 +463,14 @@
         // actual implementation classes such as `JSArray` et al.
         matchingClasses
             .addAll(_findUnusedClassesMatching((ClassElement nativeClass) {
-          InterfaceType nativeType = nativeClass.thisType;
-          InterfaceType specType = type.element.thisType;
+          ResolutionInterfaceType nativeType = nativeClass.thisType;
+          ResolutionInterfaceType specType = type.element.thisType;
           return compiler.types.isSubtype(nativeType, specType);
         }));
       } else if (type.isDynamic) {
         matchingClasses.addAll(_unusedClasses);
       } else {
-        assert(type is VoidType);
+        assert(type is ResolutionVoidType);
       }
     }
     if (matchingClasses.isNotEmpty && _registeredClasses.isEmpty) {
@@ -487,7 +480,7 @@
 
     // Give an info so that library developers can compile with -v to find why
     // all the native classes are included.
-    if (unusedBefore == matchingClasses.length) {
+    if (unusedBefore > 0 && unusedBefore == matchingClasses.length) {
       reporter.log('All native types marked as used due to $cause.');
     }
   }
@@ -498,17 +491,16 @@
   }
 
   Iterable<ClassElement> _onFirstNativeClass(WorldImpactBuilder impactBuilder) {
-    void staticUse(name) {
-      Element element = helpers.findHelper(name);
+    void staticUse(element) {
       impactBuilder.registerStaticUse(new StaticUse.foreignUse(element));
       backend.registerBackendUse(element);
       compiler.globalDependencies.registerDependency(element);
     }
 
-    staticUse('defineProperty');
-    staticUse('toStringForNativeObject');
-    staticUse('hashCodeForNativeObject');
-    staticUse('convertDartClosureToJS');
+    staticUse(helpers.defineProperty);
+    staticUse(helpers.toStringForNativeObject);
+    staticUse(helpers.hashCodeForNativeObject);
+    staticUse(helpers.closureConverter);
     return _findNativeExceptions();
   }
 
@@ -564,8 +556,8 @@
    *
    */
   NativeBehavior resolveJsCall(Send node, ForeignResolver resolver) {
-    return NativeBehavior.ofJsCallSend(
-        node, reporter, compiler.parsingContext, compiler.coreTypes, resolver);
+    return NativeBehavior.ofJsCallSend(node, reporter, compiler.parsingContext,
+        compiler.commonElements, resolver);
   }
 
   /**
@@ -580,7 +572,7 @@
   NativeBehavior resolveJsEmbeddedGlobalCall(
       Send node, ForeignResolver resolver) {
     return NativeBehavior.ofJsEmbeddedGlobalCallSend(
-        node, reporter, compiler.coreTypes, resolver);
+        node, reporter, compiler.commonElements, resolver);
   }
 
   /**
@@ -594,7 +586,7 @@
    */
   NativeBehavior resolveJsBuiltinCall(Send node, ForeignResolver resolver) {
     return NativeBehavior.ofJsBuiltinCallSend(
-        node, reporter, compiler.coreTypes, resolver);
+        node, reporter, compiler.commonElements, resolver);
   }
 }
 
@@ -644,9 +636,9 @@
     // be instantiated (abstract or simply unused).
     _addSubtypes(cls.superclass, emitter);
 
-    for (DartType type in cls.allSupertypes) {
-      List<Element> subtypes =
-          emitter.subtypes.putIfAbsent(type.element, () => <ClassElement>[]);
+    for (ResolutionInterfaceType type in cls.allSupertypes) {
+      List<ClassEntity> subtypes =
+          emitter.subtypes.putIfAbsent(type.element, () => <ClassEntity>[]);
       subtypes.add(cls);
     }
 
@@ -659,8 +651,8 @@
       superclass = superclass.superclass;
     }
 
-    List<Element> directSubtypes =
-        emitter.directSubtypes.putIfAbsent(superclass, () => <ClassElement>[]);
+    List<ClassEntity> directSubtypes =
+        emitter.directSubtypes.putIfAbsent(superclass, () => <ClassEntity>[]);
     directSubtypes.add(cls);
   }
 
diff --git a/pkg/compiler/lib/src/native/ssa.dart b/pkg/compiler/lib/src/native/ssa.dart
index f3134c3..20d1ee3 100644
--- a/pkg/compiler/lib/src/native/ssa.dart
+++ b/pkg/compiler/lib/src/native/ssa.dart
@@ -5,7 +5,7 @@
 import '../common.dart';
 import '../compiler.dart' show Compiler;
 import '../constants/values.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../js/js.dart' as js;
 import '../js_backend/js_backend.dart';
@@ -19,17 +19,18 @@
 
 void handleSsaNative(SsaBuilder builder, Expression nativeBody) {
   Compiler compiler = builder.compiler;
-  FunctionElement element = builder.target;
+  MethodElement element = builder.target;
   NativeEmitter nativeEmitter = builder.nativeEmitter;
   JavaScriptBackend backend = builder.backend;
   DiagnosticReporter reporter = compiler.reporter;
 
   HInstruction convertDartClosure(
-      ParameterElement parameter, FunctionType type) {
+      ParameterElement parameter, ResolutionFunctionType type) {
     HInstruction local = builder.localsHandler.readLocal(parameter);
     ConstantValue arityConstant =
-        builder.constantSystem.createInt(type.computeArity());
-    HInstruction arity = builder.graph.addConstant(arityConstant, compiler);
+        builder.constantSystem.createInt(type.parameterTypes.length);
+    HInstruction arity =
+        builder.graph.addConstant(arityConstant, builder.closedWorld);
     // TODO(ngeoffray): For static methods, we could pass a method with a
     // defined arity.
     Element helper = backend.helpers.closureConverter;
@@ -72,9 +73,9 @@
       inputs.add(builder.localsHandler.readThis());
     }
     parameters.forEachParameter((ParameterElement parameter) {
-      DartType type = parameter.type.unaliased;
+      ResolutionDartType type = parameter.type.unaliased;
       HInstruction input = builder.localsHandler.readLocal(parameter);
-      if (type is FunctionType) {
+      if (type is ResolutionFunctionType) {
         // The parameter type is a function type either directly or through
         // typedef(s).
         input = convertDartClosure(parameter, type);
@@ -101,7 +102,7 @@
         // be proportional to the number of native methods, which is bounded
         // by the dart: libraries.
         js.js.uncachedExpressionTemplate(nativeMethodCall),
-        backend.dynamicType,
+        builder.commonMasks.dynamicType,
         inputs,
         effects: new SideEffects()));
     // TODO(johnniwinther): Provide source information.
@@ -122,6 +123,6 @@
         <HInstruction>[],
         new SideEffects(),
         null,
-        backend.dynamicType));
+        builder.commonMasks.dynamicType));
   }
 }
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index 70594dc..59992f5 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -131,6 +131,9 @@
 
   /// Whether we allow passing an extra argument to `assert`, containing a
   /// reason for why an assertion fails. (experimental)
+  ///
+  /// This is only included so that tests can pass the --assert-message flag
+  /// without causing dart2js to crash. The flag has no effect.
   final bool enableAssertMessage;
 
   /// Whether the user specified a flag to allow the use of dart:mirrors. This
@@ -267,7 +270,6 @@
         disableInlining: _hasOption(options, Flags.disableInlining),
         disableTypeInference: _hasOption(options, Flags.disableTypeInference),
         dumpInfo: _hasOption(options, Flags.dumpInfo),
-        enableAssertMessage: _hasOption(options, Flags.enableAssertMessage),
         enableExperimentalMirrors:
             _hasOption(options, Flags.enableExperimentalMirrors),
         enableMinification: _hasOption(options, Flags.minify),
@@ -333,7 +335,7 @@
       bool disableInlining: false,
       bool disableTypeInference: false,
       bool dumpInfo: false,
-      bool enableAssertMessage: false,
+      bool enableAssertMessage: true,
       bool enableExperimentalMirrors: false,
       bool enableMinification: false,
       bool enableNativeLiveTypeAnalysis: true,
@@ -452,7 +454,7 @@
       this.disableInlining: false,
       this.disableTypeInference: false,
       this.dumpInfo: false,
-      this.enableAssertMessage: false,
+      this.enableAssertMessage: true,
       this.enableExperimentalMirrors: false,
       this.enableMinification: false,
       this.enableNativeLiveTypeAnalysis: false,
diff --git a/pkg/compiler/lib/src/ordered_typeset.dart b/pkg/compiler/lib/src/ordered_typeset.dart
index 4e37362..4798c43 100644
--- a/pkg/compiler/lib/src/ordered_typeset.dart
+++ b/pkg/compiler/lib/src/ordered_typeset.dart
@@ -5,7 +5,7 @@
 library ordered_typeset;
 
 import 'common.dart';
-import 'dart_types.dart';
+import 'elements/resolution_types.dart';
 import 'diagnostics/diagnostic_listener.dart' show DiagnosticReporter;
 import 'elements/elements.dart' show ClassElement;
 import 'util/util.dart' show Link, LinkBuilder;
@@ -29,30 +29,35 @@
  *     C: [C, B, A, Object]
  */
 class OrderedTypeSet {
-  final List<Link<DartType>> _levels;
-  final Link<DartType> types;
-  final Link<DartType> _supertypes;
+  final List<Link<ResolutionDartType>> _levels;
+  final Link<ResolutionDartType> types;
+  final Link<ResolutionDartType> _supertypes;
 
-  OrderedTypeSet.internal(List<Link<DartType>> this._levels,
-      Link<DartType> this.types, Link<DartType> this._supertypes);
+  OrderedTypeSet.internal(
+      List<Link<ResolutionDartType>> this._levels,
+      Link<ResolutionDartType> this.types,
+      Link<ResolutionDartType> this._supertypes);
 
-  factory OrderedTypeSet.singleton(DartType type) {
-    Link<DartType> types =
-        new LinkEntry<DartType>(type, const Link<DartType>());
-    List<Link<DartType>> list = new List<Link<DartType>>(1);
+  factory OrderedTypeSet.singleton(ResolutionDartType type) {
+    Link<ResolutionDartType> types = new LinkEntry<ResolutionDartType>(
+        type, const Link<ResolutionDartType>());
+    List<Link<ResolutionDartType>> list = new List<Link<ResolutionDartType>>(1);
     list[0] = types;
-    return new OrderedTypeSet.internal(list, types, const Link<DartType>());
+    return new OrderedTypeSet.internal(
+        list, types, const Link<ResolutionDartType>());
   }
 
   /// Creates a new [OrderedTypeSet] for [type] when it directly extends the
   /// class which this set represents. This is for instance used to create the
   /// type set for [ClosureClassElement] which extends [Closure].
-  OrderedTypeSet extendClass(InterfaceType type) {
+  OrderedTypeSet extendClass(ResolutionInterfaceType type) {
     assert(invariant(type.element, types.head.treatAsRaw,
         message: 'Cannot extend generic class ${types.head} using '
             'OrderedTypeSet.extendClass'));
-    Link<DartType> extendedTypes = new LinkEntry<DartType>(type, types);
-    List<Link<DartType>> list = new List<Link<DartType>>(levels + 1);
+    Link<ResolutionDartType> extendedTypes =
+        new LinkEntry<ResolutionDartType>(type, types);
+    List<Link<ResolutionDartType>> list =
+        new List<Link<ResolutionDartType>>(levels + 1);
     for (int i = 0; i < levels; i++) {
       list[i] = _levels[i];
     }
@@ -61,24 +66,24 @@
         list, extendedTypes, _supertypes.prepend(types.head));
   }
 
-  Link<DartType> get supertypes => _supertypes;
+  Link<ResolutionDartType> get supertypes => _supertypes;
 
   int get levels => _levels.length;
 
   int get maxDepth => levels - 1;
 
-  Link<DartType> operator [](int index) {
+  Link<ResolutionDartType> operator [](int index) {
     if (index < levels) {
       return _levels[index];
     }
-    return const Link<DartType>();
+    return const Link<ResolutionDartType>();
   }
 
   /// Returns the offsets into [types] at which each level begins.
   List<int> get levelOffsets {
     List<int> offsets = new List.filled(levels, -1);
     int offset = 0;
-    Link<DartType> pointer = types;
+    Link<ResolutionDartType> pointer = types;
     for (int depth = maxDepth; depth >= 0; depth--) {
       while (!identical(pointer, _levels[depth])) {
         pointer = pointer.tail;
@@ -89,11 +94,11 @@
     return offsets;
   }
 
-  void forEach(int level, void f(DartType type)) {
+  void forEach(int level, void f(ResolutionDartType type)) {
     if (level < levels) {
-      Link<DartType> pointer = _levels[level];
-      Link<DartType> end =
-          level > 0 ? _levels[level - 1] : const Link<DartType>();
+      Link<ResolutionDartType> pointer = _levels[level];
+      Link<ResolutionDartType> end =
+          level > 0 ? _levels[level - 1] : const Link<ResolutionDartType>();
       // TODO(het): checking `isNotEmpty` should be unnecessary, remove when
       // constants are properly canonicalized
       while (pointer.isNotEmpty && !identical(pointer, end)) {
@@ -103,12 +108,12 @@
     }
   }
 
-  InterfaceType asInstanceOf(ClassElement cls) {
+  ResolutionInterfaceType asInstanceOf(ClassElement cls) {
     int level = cls.hierarchyDepth;
     if (level < levels) {
-      Link<DartType> pointer = _levels[level];
-      Link<DartType> end =
-          level > 0 ? _levels[level - 1] : const Link<DartType>();
+      Link<ResolutionDartType> pointer = _levels[level];
+      Link<ResolutionDartType> end =
+          level > 0 ? _levels[level - 1] : const Link<ResolutionDartType>();
       // TODO(het): checking `isNotEmpty` should be unnecessary, remove when
       // constants are properly canonicalized
       while (pointer.isNotEmpty && !identical(pointer, end)) {
@@ -142,23 +147,26 @@
  *     C: [C, B, A, Object]
  */
 class OrderedTypeSetBuilder {
-  Map<int, LinkEntry<DartType>> map = new Map<int, LinkEntry<DartType>>();
+  Map<int, LinkEntry<ResolutionDartType>> map =
+      new Map<int, LinkEntry<ResolutionDartType>>();
   // TODO(15296): Avoid computing this order on the side when member
   // lookup handles multiply inherited members correctly.
-  LinkBuilder<DartType> allSupertypes = new LinkBuilder<DartType>();
+  LinkBuilder<ResolutionDartType> allSupertypes =
+      new LinkBuilder<ResolutionDartType>();
   int maxDepth = -1;
 
   final DiagnosticReporter reporter;
   final ClassElement cls;
-  InterfaceType _objectType;
+  ResolutionInterfaceType _objectType;
 
   // TODO(johnniwinther): Provide access to `Object` in deserialization and
   // make [objectType] mandatory.
-  OrderedTypeSetBuilder(this.cls, {this.reporter, InterfaceType objectType})
+  OrderedTypeSetBuilder(this.cls,
+      {this.reporter, ResolutionInterfaceType objectType})
       : this._objectType = objectType;
 
   OrderedTypeSet createOrderedTypeSet(
-      InterfaceType supertype, Link<DartType> interfaces) {
+      ResolutionInterfaceType supertype, Link<ResolutionDartType> interfaces) {
     if (_objectType == null) {
       // Find `Object` through in hierarchy. This is used for serialization
       // where it is assumed that the hierarchy is valid.
@@ -171,12 +179,16 @@
     // TODO(15296): Collapse these iterations to one when the order is not
     // needed.
     add(supertype);
-    for (Link<DartType> link = interfaces; !link.isEmpty; link = link.tail) {
+    for (Link<ResolutionDartType> link = interfaces;
+        !link.isEmpty;
+        link = link.tail) {
       add(link.head);
     }
 
     addAllSupertypes(supertype);
-    for (Link<DartType> link = interfaces; !link.isEmpty; link = link.tail) {
+    for (Link<ResolutionDartType> link = interfaces;
+        !link.isEmpty;
+        link = link.tail) {
       addAllSupertypes(link.head);
     }
     add(cls.thisType);
@@ -187,20 +199,20 @@
    * Adds [type] and all supertypes of [type] to [allSupertypes] while
    * substituting type variables.
    */
-  void addAllSupertypes(InterfaceType type) {
+  void addAllSupertypes(ResolutionInterfaceType type) {
     ClassElement classElement = type.element;
-    Link<DartType> supertypes = classElement.allSupertypes;
+    Link<ResolutionDartType> supertypes = classElement.allSupertypes;
     assert(invariant(cls, supertypes != null,
         message: "Supertypes not computed on $classElement "
             "during resolution of $cls"));
     while (!supertypes.isEmpty) {
-      DartType supertype = supertypes.head;
+      ResolutionDartType supertype = supertypes.head;
       add(supertype.substByContext(type));
       supertypes = supertypes.tail;
     }
   }
 
-  void add(InterfaceType type) {
+  void add(ResolutionInterfaceType type) {
     if (type.element == cls) {
       if (type != _objectType) {
         allSupertypes.addLast(_objectType);
@@ -214,11 +226,11 @@
     }
   }
 
-  void _addAtDepth(InterfaceType type, int depth) {
-    LinkEntry<DartType> prev = null;
-    LinkEntry<DartType> link = map[depth];
+  void _addAtDepth(ResolutionInterfaceType type, int depth) {
+    LinkEntry<ResolutionDartType> prev = null;
+    LinkEntry<ResolutionDartType> link = map[depth];
     while (link != null) {
-      DartType existingType = link.head;
+      ResolutionDartType existingType = link.head;
       if (existingType == type) return;
       if (existingType.element == type.element) {
         if (reporter != null) {
@@ -236,7 +248,8 @@
       prev = link;
       link = link.tail;
     }
-    LinkEntry<DartType> next = new LinkEntry<DartType>(type);
+    LinkEntry<ResolutionDartType> next =
+        new LinkEntry<ResolutionDartType>(type);
     next.tail = null;
     if (prev == null) {
       map[depth] = next;
@@ -249,19 +262,20 @@
   }
 
   OrderedTypeSet toTypeSet() {
-    List<Link<DartType>> levels = new List<Link<DartType>>(maxDepth + 1);
+    List<Link<ResolutionDartType>> levels =
+        new List<Link<ResolutionDartType>>(maxDepth + 1);
     if (maxDepth < 0) {
-      return new OrderedTypeSet.internal(
-          levels, const Link<DartType>(), const Link<DartType>());
+      return new OrderedTypeSet.internal(levels,
+          const Link<ResolutionDartType>(), const Link<ResolutionDartType>());
     }
-    Link<DartType> next = const Link<DartType>();
+    Link<ResolutionDartType> next = const Link<ResolutionDartType>();
     for (int depth = 0; depth <= maxDepth; depth++) {
-      LinkEntry<DartType> first = map[depth];
+      LinkEntry<ResolutionDartType> first = map[depth];
       if (first == null) {
         levels[depth] = next;
       } else {
         levels[depth] = first;
-        LinkEntry<DartType> last = first;
+        LinkEntry<ResolutionDartType> last = first;
         while (last.tail != null) {
           last = last.tail;
         }
@@ -277,7 +291,7 @@
     StringBuffer sb = new StringBuffer();
     for (int depth = 0; depth <= maxDepth; depth++) {
       sb.write('$depth: ');
-      LinkEntry<DartType> first = map[depth];
+      LinkEntry<ResolutionDartType> first = map[depth];
       if (first != null) {
         sb.write('${first.head}');
         while (first.tail != null) {
diff --git a/pkg/compiler/lib/src/parser/class_element_parser.dart b/pkg/compiler/lib/src/parser/class_element_parser.dart
index 851873a..88a6fa1 100644
--- a/pkg/compiler/lib/src/parser/class_element_parser.dart
+++ b/pkg/compiler/lib/src/parser/class_element_parser.dart
@@ -9,7 +9,7 @@
 import 'partial_parser.dart' show PartialParser;
 
 class ClassElementParser extends PartialParser {
-  ClassElementParser(Listener listener): super(listener);
+  ClassElementParser(Listener listener) : super(listener);
 
   Token parseClassBody(Token token) => fullParseClassBody(token);
 }
diff --git a/pkg/compiler/lib/src/parser/diet_parser_task.dart b/pkg/compiler/lib/src/parser/diet_parser_task.dart
index e975a83..aa635b9 100644
--- a/pkg/compiler/lib/src/parser/diet_parser_task.dart
+++ b/pkg/compiler/lib/src/parser/diet_parser_task.dart
@@ -19,8 +19,8 @@
   final Backend _backend;
   final DiagnosticReporter _reporter;
 
-  DietParserTask(this._idGenerator, this._backend, this._reporter,
-      Measurer measurer)
+  DietParserTask(
+      this._idGenerator, this._backend, this._reporter, Measurer measurer)
       : super(measurer);
 
   final String name = 'Diet Parser';
diff --git a/pkg/compiler/lib/src/parser/element_listener.dart b/pkg/compiler/lib/src/parser/element_listener.dart
index 75cd0e9..5c058ee 100644
--- a/pkg/compiler/lib/src/parser/element_listener.dart
+++ b/pkg/compiler/lib/src/parser/element_listener.dart
@@ -273,9 +273,9 @@
       Token classKeyword, Token implementsKeyword, Token endToken) {
     NodeList interfaces = (implementsKeyword != null) ? popNode() : null;
     MixinApplication mixinApplication = popNode();
-    Modifiers modifiers = popNode();
     NodeList typeParameters = popNode();
     Identifier name = popNode();
+    Modifiers modifiers = popNode();
     NamedMixinApplication namedMixinApplication = new NamedMixinApplication(
         name,
         typeParameters,
diff --git a/pkg/compiler/lib/src/parser/node_listener.dart b/pkg/compiler/lib/src/parser/node_listener.dart
index f3e343c..4dc325c 100644
--- a/pkg/compiler/lib/src/parser/node_listener.dart
+++ b/pkg/compiler/lib/src/parser/node_listener.dart
@@ -29,10 +29,12 @@
 
   void endLibraryName(Token libraryKeyword, Token semicolon) {
     Expression name = popNode();
-    pushNode(new LibraryName(libraryKeyword, name,
-          // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
-          // (element) instead of Metatada (node).
-          null));
+    pushNode(new LibraryName(
+        libraryKeyword,
+        name,
+        // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
+        // (element) instead of Metatada (node).
+        null));
   }
 
   void endImport(Token importKeyword, Token deferredKeyword, Token asKeyword,
@@ -41,37 +43,50 @@
     Identifier prefix = asKeyword != null ? popNode() : null;
     NodeList conditionalUris = popNode();
     StringNode uri = popLiteralString();
-    pushNode(new Import(importKeyword, uri, conditionalUris, prefix,
-          combinators,
-          // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
-          // (element) instead of Metatada (node).
-          null, isDeferred: deferredKeyword != null));
+    pushNode(new Import(
+        importKeyword,
+        uri,
+        conditionalUris,
+        prefix,
+        combinators,
+        // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
+        // (element) instead of Metatada (node).
+        null,
+        isDeferred: deferredKeyword != null));
   }
 
   void endExport(Token exportKeyword, Token semicolon) {
     NodeList combinators = popNode();
     NodeList conditionalUris = popNode();
     StringNode uri = popLiteralString();
-    pushNode(new Export(exportKeyword, uri, conditionalUris, combinators,
-          // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
-          // (element) instead of Metatada (node).
-          null));
+    pushNode(new Export(
+        exportKeyword,
+        uri,
+        conditionalUris,
+        combinators,
+        // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
+        // (element) instead of Metatada (node).
+        null));
   }
 
   void endPart(Token partKeyword, Token semicolon) {
     StringNode uri = popLiteralString();
-    pushNode(new Part(partKeyword, uri,
-          // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
-          // (element) instead of Metatada (node).
-          null));
+    pushNode(new Part(
+        partKeyword,
+        uri,
+        // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
+        // (element) instead of Metatada (node).
+        null));
   }
 
   void endPartOf(Token partKeyword, Token semicolon) {
     Expression name = popNode(); // name
-    pushNode(new PartOf(partKeyword, name,
-          // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
-          // (element) instead of Metatada (node).
-          null));
+    pushNode(new PartOf(
+        partKeyword,
+        name,
+        // TODO(sigmund): Import AST nodes have pointers to MetadataAnnotation
+        // (element) instead of Metatada (node).
+        null));
   }
 
   void endClassDeclaration(int interfacesCount, Token beginToken,
@@ -113,9 +128,9 @@
       Token classKeyword, Token implementsKeyword, Token endToken) {
     NodeList interfaces = (implementsKeyword != null) ? popNode() : null;
     Node mixinApplication = popNode();
-    Modifiers modifiers = popNode();
     NodeList typeParameters = popNode();
     Identifier name = popNode();
+    Modifiers modifiers = popNode();
     pushNode(new NamedMixinApplication(name, typeParameters, modifiers,
         mixinApplication, interfaces, classKeyword, endToken));
   }
@@ -365,10 +380,10 @@
 
   void endSend(Token token) {
     NodeList arguments = popNode();
-    popNode(); // typeArguments
+    NodeList typeArguments = popNode();
     Node selector = popNode();
     // TODO(ahe): Handle receiver.
-    pushNode(new Send(null, selector, arguments));
+    pushNode(new Send(null, selector, arguments, typeArguments));
   }
 
   void endFunctionBody(int count, Token beginToken, Token endToken) {
diff --git a/pkg/compiler/lib/src/parser/parser.dart b/pkg/compiler/lib/src/parser/parser.dart
index e39ce38..0ef9cb8 100644
--- a/pkg/compiler/lib/src/parser/parser.dart
+++ b/pkg/compiler/lib/src/parser/parser.dart
@@ -362,30 +362,12 @@
 
   Token parseTypedef(Token token) {
     Token typedefKeyword = token;
-    if (optional('=', peekAfterType(token.next))) {
-      // TODO(aprelev@gmail.com): Remove deprecated 'typedef' mixin application,
-      // remove corresponding diagnostic from members.dart.
-      listener.beginNamedMixinApplication(token);
-      token = parseIdentifier(token.next);
-      token = parseTypeVariablesOpt(token);
-      token = expect('=', token);
-      token = parseModifiers(token);
-      token = parseMixinApplication(token);
-      Token implementsKeyword = null;
-      if (optional('implements', token)) {
-        implementsKeyword = token;
-        token = parseTypeList(token.next);
-      }
-      listener.endNamedMixinApplication(
-          typedefKeyword, implementsKeyword, token);
-    } else {
-      listener.beginFunctionTypeAlias(token);
-      token = parseReturnTypeOpt(token.next);
-      token = parseIdentifier(token);
-      token = parseTypeVariablesOpt(token);
-      token = parseFormalParameters(token);
-      listener.endFunctionTypeAlias(typedefKeyword, token);
-    }
+    listener.beginFunctionTypeAlias(token);
+    token = parseReturnTypeOpt(token.next);
+    token = parseIdentifier(token);
+    token = parseTypeVariablesOpt(token);
+    token = parseFormalParameters(token);
+    listener.endFunctionTypeAlias(typedefKeyword, token);
     return expect(';', token);
   }
 
@@ -444,6 +426,15 @@
   Token parseFormalParameter(Token token, FormalParameterType type) {
     token = parseMetadataStar(token, forParameter: true);
     listener.beginFormalParameter(token);
+
+    // Skip over `covariant` token, if the next token is an identifier or
+    // modifier.
+    // This enables the case where `covariant` is the name of the parameter:
+    //    void foo(covariant);
+    if (identical(token.stringValue, 'covariant') &&
+        (token.next.isIdentifier() || isModifier(token.next))) {
+      token = token.next;
+    }
     token = parseModifiers(token);
     // TODO(ahe): Validate that there are formal parameters if void.
     token = parseReturnTypeOpt(token);
@@ -682,17 +673,10 @@
     var isMixinApplication = optional('=', peekAfterType(token.next));
     if (isMixinApplication) {
       listener.beginNamedMixinApplication(begin);
-      token = parseIdentifier(token.next);
-      token = parseTypeVariablesOpt(token);
-      token = expect('=', token);
     } else {
       listener.beginClassDeclaration(begin);
     }
 
-    // TODO(aprelev@gmail.com): Once 'typedef' named mixin application is
-    // removed, move modifiers for named mixin application to the bottom of
-    // listener stack. This is so stacks for class declaration and named
-    // mixin application look similar.
     int modifierCount = 0;
     if (abstractKeyword != null) {
       parseModifier(abstractKeyword);
@@ -701,6 +685,9 @@
     listener.handleModifiers(modifierCount);
 
     if (isMixinApplication) {
+      token = parseIdentifier(token.next);
+      token = parseTypeVariablesOpt(token);
+      token = expect('=', token);
       return parseNamedMixinApplication(token, classKeyword);
     } else {
       return parseClass(begin, classKeyword);
@@ -1010,9 +997,29 @@
     return null;
   }
 
+  /// Removes the optional `covariant` token from the modifiers, if there
+  /// is no `static` in the list, and `covariant` is the first modifier.
+  Link<Token> removeOptCovariantTokenIfNotStatic(Link<Token> modifiers) {
+    if (modifiers.isEmpty ||
+        !identical(modifiers.first.stringValue, 'covariant')) {
+      return modifiers;
+    }
+    for (Token modifier in modifiers.tail) {
+      if (identical(modifier.stringValue, 'static')) {
+        return modifiers;
+      }
+    }
+    return modifiers.tail;
+  }
+
   Token parseFields(Token start, Link<Token> modifiers, Token type,
       Token getOrSet, Token name, bool isTopLevel) {
     bool hasType = type != null;
+
+    if (getOrSet == null && !isTopLevel) {
+      modifiers = removeOptCovariantTokenIfNotStatic(modifiers);
+    }
+
     Token varFinalOrConst =
         expectVarFinalOrConst(modifiers, hasType, !isTopLevel);
     bool isVar = false;
@@ -1357,7 +1364,7 @@
     if (isFactoryDeclaration(token)) {
       token = parseFactoryMethod(token);
       listener.endMember();
-      assert (token != null);
+      assert(token != null);
       return token;
     }
 
diff --git a/pkg/compiler/lib/src/parser/parser_task.dart b/pkg/compiler/lib/src/parser/parser_task.dart
index e6e8bfe..54219d4 100644
--- a/pkg/compiler/lib/src/parser/parser_task.dart
+++ b/pkg/compiler/lib/src/parser/parser_task.dart
@@ -18,7 +18,9 @@
 class ParserTask extends CompilerTask {
   final Compiler compiler;
 
-  ParserTask(Compiler compiler): compiler = compiler, super(compiler.measurer);
+  ParserTask(Compiler compiler)
+      : compiler = compiler,
+        super(compiler.measurer);
 
   String get name => 'Parser';
 
diff --git a/pkg/compiler/lib/src/parser/partial_elements.dart b/pkg/compiler/lib/src/parser/partial_elements.dart
index 1f37ff3..c68e5e4 100644
--- a/pkg/compiler/lib/src/parser/partial_elements.dart
+++ b/pkg/compiler/lib/src/parser/partial_elements.dart
@@ -6,7 +6,7 @@
 
 import '../common.dart';
 import '../common/resolution.dart' show ParsingContext, Resolution;
-import '../dart_types.dart' show DynamicType;
+import '../elements/resolution_types.dart' show ResolutionDynamicType;
 import '../elements/elements.dart'
     show
         CompilationUnitElement,
@@ -258,7 +258,7 @@
         return resolution.resolveTypeAnnotation(element, node.type);
       });
     } else {
-      type = const DynamicType();
+      type = const ResolutionDynamicType();
     }
     assert(type != null);
     return type;
diff --git a/pkg/compiler/lib/src/parser/partial_parser.dart b/pkg/compiler/lib/src/parser/partial_parser.dart
index c5d9d62..6aaa52c 100644
--- a/pkg/compiler/lib/src/parser/partial_parser.dart
+++ b/pkg/compiler/lib/src/parser/partial_parser.dart
@@ -12,7 +12,7 @@
 import 'parser.dart' show Parser;
 
 class PartialParser extends Parser {
-  PartialParser(Listener listener): super(listener);
+  PartialParser(Listener listener) : super(listener);
 
   Token parseClassBody(Token token) => skipClassBody(token);
 
diff --git a/pkg/compiler/lib/src/patch_parser.dart b/pkg/compiler/lib/src/patch_parser.dart
index da76073..bf2ae05 100644
--- a/pkg/compiler/lib/src/patch_parser.dart
+++ b/pkg/compiler/lib/src/patch_parser.dart
@@ -120,7 +120,7 @@
 import 'common.dart';
 import 'compiler.dart' show Compiler;
 import 'constants/values.dart' show ConstantValue;
-import 'dart_types.dart' show DartType;
+import 'elements/resolution_types.dart' show ResolutionDartType;
 import 'elements/elements.dart';
 import 'elements/modelx.dart'
     show
@@ -149,7 +149,8 @@
   DiagnosticReporter get reporter => compiler.reporter;
 
   PatchParserTask(Compiler compiler)
-      : compiler = compiler, super(compiler.measurer);
+      : compiler = compiler,
+        super(compiler.measurer);
 
   /**
    * Scans a library patch file, applies the method patches and
@@ -203,8 +204,8 @@
             Token token = parser.parseTopLevelDeclaration(cls.beginToken);
             assert(identical(token, cls.endToken.next));
           } on ParserError catch (e) {
-            // No need to recover from a parser error in platform libraries, user
-            // will never see this if the libraries are tested correctly.
+            // No need to recover from a parser error in platform libraries,
+            // user will never see this if the libraries are tested correctly.
             reporter.internalError(cls, "Parser error in patch file: $e");
           }
           cls.cachedNode = listener.popNode();
@@ -248,7 +249,7 @@
  * declarations.
  */
 class PatchClassElementParser extends PartialParser {
-  PatchClassElementParser(Listener listener): super(listener);
+  PatchClassElementParser(Listener listener) : super(listener);
 
   Token parseClassBody(Token token) => fullParseClassBody(token);
 }
@@ -427,7 +428,8 @@
 
   void validate(Compiler compiler, Element element,
       MetadataAnnotation annotation, ConstantValue constant) {
-    DartType annotationType = constant.getType(compiler.coreTypes);
+    ResolutionDartType annotationType =
+        constant.getType(compiler.commonElements);
     if (annotationType.element !=
         compiler.commonElements.nativeAnnotationClass) {
       DiagnosticReporter reporter = compiler.reporter;
@@ -460,8 +462,8 @@
   void validate(Compiler compiler, Element element,
       MetadataAnnotation annotation, ConstantValue constant) {
     JavaScriptBackend backend = compiler.backend;
-    if (constant.getType(compiler.coreTypes).element !=
-        backend.helpers.jsAnnotationClass) {
+    ResolutionDartType type = constant.getType(compiler.commonElements);
+    if (type.element != backend.helpers.jsAnnotationClass) {
       compiler.reporter
           .internalError(annotation, 'Invalid @JS(...) annotation.');
     }
@@ -496,7 +498,8 @@
   @override
   void validate(Compiler compiler, Element element,
       MetadataAnnotation annotation, ConstantValue constant) {
-    DartType annotationType = constant.getType(compiler.coreTypes);
+    ResolutionDartType annotationType =
+        constant.getType(compiler.commonElements);
     if (annotationType.element !=
         compiler.commonElements.patchAnnotationClass) {
       DiagnosticReporter reporter = compiler.reporter;
diff --git a/pkg/compiler/lib/src/resolution/access_semantics.dart b/pkg/compiler/lib/src/resolution/access_semantics.dart
index ffb71f9..15e280a 100644
--- a/pkg/compiler/lib/src/resolution/access_semantics.dart
+++ b/pkg/compiler/lib/src/resolution/access_semantics.dart
@@ -8,7 +8,7 @@
 library dart2js.access_semantics;
 
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 
 /// Enum representing the different kinds of destinations which a property
@@ -477,7 +477,7 @@
   final Element element;
 
   /// The type on which the constructor is invoked.
-  final DartType type;
+  final ResolutionDartType type;
 
   ConstructorAccessSemantics(this.kind, this.element, this.type);
 
diff --git a/pkg/compiler/lib/src/resolution/class_hierarchy.dart b/pkg/compiler/lib/src/resolution/class_hierarchy.dart
index ef03ab5..c260b99 100644
--- a/pkg/compiler/lib/src/resolution/class_hierarchy.dart
+++ b/pkg/compiler/lib/src/resolution/class_hierarchy.dart
@@ -6,8 +6,8 @@
 
 import '../common.dart';
 import '../common/resolution.dart' show Resolution;
-import '../core_types.dart' show CoreClasses, CoreTypes;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart'
     show
@@ -28,7 +28,7 @@
 import 'resolution_common.dart' show CommonResolverVisitor, MappingVisitor;
 import 'scope.dart' show Scope, TypeDeclarationScope;
 
-class TypeDefinitionVisitor extends MappingVisitor<DartType> {
+class TypeDefinitionVisitor extends MappingVisitor<ResolutionDartType> {
   Scope scope;
   final TypeDeclarationElement enclosingElement;
   TypeDeclarationElement get element => enclosingElement;
@@ -39,20 +39,20 @@
         scope = Scope.buildEnclosingScope(element),
         super(resolution, registry);
 
-  CoreTypes get coreTypes => resolution.coreTypes;
+  CommonElements get commonElements => resolution.commonElements;
 
-  DartType get objectType => coreTypes.objectType;
+  ResolutionInterfaceType get objectType => commonElements.objectType;
 
   void resolveTypeVariableBounds(NodeList node) {
     if (node == null) return;
 
     Setlet<String> nameSet = new Setlet<String>();
     // Resolve the bounds of type variables.
-    Iterator<DartType> types = element.typeVariables.iterator;
+    Iterator<ResolutionDartType> types = element.typeVariables.iterator;
     Link<Node> nodeLink = node.nodes;
     while (!nodeLink.isEmpty) {
       types.moveNext();
-      TypeVariableType typeVariable = types.current;
+      ResolutionTypeVariableType typeVariable = types.current;
       String typeName = typeVariable.name;
       TypeVariable typeNode = nodeLink.head;
       registry.useType(typeNode, typeVariable);
@@ -66,7 +66,7 @@
 
       TypeVariableElementX variableElement = typeVariable.element;
       if (typeNode.bound != null) {
-        DartType boundType =
+        ResolutionDartType boundType =
             typeResolver.resolveTypeAnnotation(this, typeNode.bound);
         variableElement.boundCache = boundType;
 
@@ -74,7 +74,7 @@
           Link<TypeVariableElement> seenTypeVariables =
               const Link<TypeVariableElement>();
           seenTypeVariables = seenTypeVariables.prepend(variableElement);
-          DartType bound = boundType;
+          ResolutionDartType bound = boundType;
           while (bound.isTypeVariable) {
             TypeVariableElement element = bound.element;
             if (seenTypeVariables.contains(element)) {
@@ -122,7 +122,7 @@
       ResolutionRegistry registry)
       : super(resolution, classElement, registry);
 
-  DartType visitClassNode(ClassNode node) {
+  ResolutionDartType visitClassNode(ClassNode node) {
     if (element == null) {
       throw reporter.internalError(node, 'element is null');
     }
@@ -143,7 +143,8 @@
     if (element.supertype == null && node.superclass != null) {
       MixinApplication superMixin = node.superclass.asMixinApplication();
       if (superMixin != null) {
-        DartType supertype = resolveSupertype(element, superMixin.superclass);
+        ResolutionDartType supertype =
+            resolveSupertype(element, superMixin.superclass);
         Link<Node> link = superMixin.mixins.nodes;
         while (!link.isEmpty) {
           supertype =
@@ -201,8 +202,7 @@
       } else {
         ConstructorElement superConstructor = superMember;
         superConstructor.computeType(resolution);
-        if (!CallStructure.NO_ARGS
-            .signatureApplies(superConstructor.functionSignature)) {
+        if (!CallStructure.NO_ARGS.signatureApplies(superConstructor.type)) {
           MessageKind kind = MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT;
           reporter.reportErrorMessage(node, kind);
           superMember = new ErroneousElementX(kind, {}, '', element);
@@ -223,7 +223,7 @@
   }
 
   @override
-  DartType visitEnum(Enum node) {
+  ResolutionDartType visitEnum(Enum node) {
     if (element == null) {
       throw reporter.internalError(node, 'element is null');
     }
@@ -232,9 +232,9 @@
           element, 'cyclic resolution of class $element');
     }
 
-    InterfaceType enumType = element.computeType(resolution);
+    ResolutionInterfaceType enumType = element.computeType(resolution);
     element.supertype = objectType;
-    element.interfaces = const Link<DartType>();
+    element.interfaces = const Link<ResolutionDartType>();
     calculateAllSupertypes(element);
 
     if (node.names.nodes.isEmpty) {
@@ -243,15 +243,15 @@
     }
 
     EnumCreator creator =
-        new EnumCreator(reporter, resolution.coreTypes, element);
+        new EnumCreator(reporter, resolution.commonElements, element);
     creator.createMembers();
     return enumType;
   }
 
   /// Resolves the mixed type for [mixinNode] and checks that the mixin type
   /// is a valid, non-blacklisted interface type. The mixin type is returned.
-  DartType checkMixinType(TypeAnnotation mixinNode) {
-    DartType mixinType = resolveType(mixinNode);
+  ResolutionDartType checkMixinType(TypeAnnotation mixinNode) {
+    ResolutionDartType mixinType = resolveType(mixinNode);
     if (isBlackListed(mixinType)) {
       reporter.reportErrorMessage(
           mixinNode, MessageKind.CANNOT_MIXIN, {'type': mixinType});
@@ -267,7 +267,7 @@
     return mixinType;
   }
 
-  DartType visitNamedMixinApplication(NamedMixinApplication node) {
+  ResolutionDartType visitNamedMixinApplication(NamedMixinApplication node) {
     if (element == null) {
       throw reporter.internalError(node, 'element is null');
     }
@@ -276,20 +276,13 @@
           element, 'cyclic resolution of class $element');
     }
 
-    if (identical(node.classKeyword.stringValue, 'typedef')) {
-      // TODO(aprelev@gmail.com): Remove this deprecation diagnostic
-      // together with corresponding TODO in parser.dart.
-      reporter.reportWarningMessage(
-          node.classKeyword, MessageKind.DEPRECATED_TYPEDEF_MIXIN_SYNTAX);
-    }
-
     element.computeType(resolution);
     scope = new TypeDeclarationScope(scope, element);
     resolveTypeVariableBounds(node.typeParameters);
 
     // Generate anonymous mixin application elements for the
     // intermediate mixin applications (excluding the last).
-    DartType supertype = resolveSupertype(element, node.superclass);
+    ResolutionDartType supertype = resolveSupertype(element, node.superclass);
     Link<Node> link = node.mixins.nodes;
     while (!link.tail.isEmpty) {
       supertype = applyMixin(supertype, checkMixinType(link.head), link.head);
@@ -299,25 +292,28 @@
     return element.computeType(resolution);
   }
 
-  DartType applyMixin(DartType supertype, DartType mixinType, Node node) {
+  ResolutionDartType applyMixin(
+      ResolutionDartType supertype, ResolutionDartType mixinType, Node node) {
     String superName = supertype.name;
     String mixinName = mixinType.name;
     MixinApplicationElementX mixinApplication =
         new UnnamedMixinApplicationElementX("${superName}+${mixinName}",
             element, resolution.idGenerator.getNextFreeId(), node);
     // Create synthetic type variables for the mixin application.
-    List<DartType> typeVariables = <DartType>[];
+    List<ResolutionDartType> typeVariables = <ResolutionDartType>[];
     int index = 0;
-    for (TypeVariableType type in element.typeVariables) {
+    for (ResolutionTypeVariableType type in element.typeVariables) {
       TypeVariableElementX typeVariableElement = new TypeVariableElementX(
           type.name, mixinApplication, index, type.element.node);
-      TypeVariableType typeVariable = new TypeVariableType(typeVariableElement);
+      ResolutionTypeVariableType typeVariable =
+          new ResolutionTypeVariableType(typeVariableElement);
       typeVariables.add(typeVariable);
       index++;
     }
     // Setup bounds on the synthetic type variables.
-    for (TypeVariableType type in element.typeVariables) {
-      TypeVariableType typeVariable = typeVariables[type.element.index];
+    for (ResolutionTypeVariableType type in element.typeVariables) {
+      ResolutionTypeVariableType typeVariable =
+          typeVariables[type.element.index];
       TypeVariableElementX typeVariableElement = typeVariable.element;
       typeVariableElement.typeCache = typeVariable;
       typeVariableElement.boundCache =
@@ -334,7 +330,7 @@
     mixinApplication.supertypeLoadState = STATE_DONE;
     // Replace the synthetic type variables by the original type variables in
     // the returned type (which should be the type actually extended).
-    InterfaceType mixinThisType = mixinApplication.thisType;
+    ResolutionInterfaceType mixinThisType = mixinApplication.thisType;
     return mixinThisType.subst(
         element.typeVariables, mixinThisType.typeArguments);
   }
@@ -355,7 +351,7 @@
   }
 
   void doApplyMixinTo(MixinApplicationElementX mixinApplication,
-      DartType supertype, DartType mixinType) {
+      ResolutionDartType supertype, ResolutionDartType mixinType) {
     Node node = mixinApplication.parseNode(resolution.parsingContext);
 
     if (mixinApplication.supertype != null) {
@@ -370,10 +366,10 @@
     // Named mixin application may have an 'implements' clause.
     NamedMixinApplication namedMixinApplication =
         node.asNamedMixinApplication();
-    Link<DartType> interfaces = (namedMixinApplication != null)
+    Link<ResolutionDartType> interfaces = (namedMixinApplication != null)
         ? resolveInterfaces(
             namedMixinApplication.interfaces, namedMixinApplication.superclass)
-        : const Link<DartType>();
+        : const Link<ResolutionDartType>();
 
     // The class that is the result of a mixin application implements
     // the interface of the class that was mixed in so always prepend
@@ -390,7 +386,7 @@
     }
 
     ClassElement superclass = supertype.element;
-    if (mixinType.kind != TypeKind.INTERFACE) {
+    if (mixinType.kind != ResolutionTypeKind.INTERFACE) {
       mixinApplication.hasIncompleteHierarchy = true;
       mixinApplication.allSupertypesAndSelf = superclass.allSupertypesAndSelf;
       return;
@@ -418,8 +414,8 @@
     calculateAllSupertypes(mixinApplication);
   }
 
-  InterfaceType resolveMixinFor(
-      MixinApplicationElement mixinApplication, DartType mixinType) {
+  ResolutionInterfaceType resolveMixinFor(
+      MixinApplicationElement mixinApplication, ResolutionDartType mixinType) {
     ClassElement mixin = mixinType.element;
     mixin.ensureResolved(resolution);
 
@@ -444,12 +440,13 @@
     return mixinType;
   }
 
-  DartType resolveType(TypeAnnotation node) {
+  ResolutionDartType resolveType(TypeAnnotation node) {
     return typeResolver.resolveTypeAnnotation(this, node);
   }
 
-  DartType resolveSupertype(ClassElement cls, TypeAnnotation superclass) {
-    DartType supertype = resolveType(superclass);
+  ResolutionDartType resolveSupertype(
+      ClassElement cls, TypeAnnotation superclass) {
+    ResolutionDartType supertype = resolveType(superclass);
     if (supertype != null) {
       if (supertype.isMalformed) {
         reporter.reportErrorMessage(
@@ -474,20 +471,21 @@
     return supertype;
   }
 
-  Link<DartType> resolveInterfaces(NodeList interfaces, Node superclass) {
-    Link<DartType> result = const Link<DartType>();
+  Link<ResolutionDartType> resolveInterfaces(
+      NodeList interfaces, Node superclass) {
+    Link<ResolutionDartType> result = const Link<ResolutionDartType>();
     if (interfaces == null) return result;
     for (Link<Node> link = interfaces.nodes; !link.isEmpty; link = link.tail) {
-      DartType interfaceType = resolveType(link.head);
+      ResolutionDartType interfaceType = resolveType(link.head);
       if (interfaceType != null) {
         if (interfaceType.isMalformed) {
           reporter.reportErrorMessage(
-              superclass,
+              link.head,
               MessageKind.CANNOT_IMPLEMENT_MALFORMED,
               {'className': element.name, 'malformedType': interfaceType});
         } else if (interfaceType.isEnumType) {
           reporter.reportErrorMessage(
-              superclass,
+              link.head,
               MessageKind.CANNOT_IMPLEMENT_ENUM,
               {'className': element.name, 'enumType': interfaceType});
         } else if (!interfaceType.isInterfaceType) {
@@ -539,29 +537,29 @@
    */
   void calculateAllSupertypes(BaseClassElementX cls) {
     if (cls.allSupertypesAndSelf != null) return;
-    final DartType supertype = cls.supertype;
+    final ResolutionDartType supertype = cls.supertype;
     if (supertype != null) {
       cls.allSupertypesAndSelf = new OrderedTypeSetBuilder(cls,
-              reporter: reporter, objectType: coreTypes.objectType)
+              reporter: reporter, objectType: commonElements.objectType)
           .createOrderedTypeSet(supertype, cls.interfaces);
     } else {
-      assert(cls == resolution.coreClasses.objectClass);
+      assert(cls == resolution.commonElements.objectClass);
       cls.allSupertypesAndSelf =
           new OrderedTypeSet.singleton(cls.computeType(resolution));
     }
   }
 
-  isBlackListed(DartType type) {
+  isBlackListed(ResolutionDartType type) {
     LibraryElement lib = element.library;
     return !identical(lib, resolution.commonElements.coreLibrary) &&
         !resolution.target.isTargetSpecificLibrary(lib) &&
         (type.isDynamic ||
-            type == coreTypes.boolType ||
-            type == coreTypes.numType ||
-            type == coreTypes.intType ||
-            type == coreTypes.doubleType ||
-            type == coreTypes.stringType ||
-            type == coreTypes.nullType);
+            type == commonElements.boolType ||
+            type == commonElements.numType ||
+            type == commonElements.intType ||
+            type == commonElements.doubleType ||
+            type == commonElements.stringType ||
+            type == commonElements.nullType);
   }
 }
 
@@ -574,7 +572,7 @@
         this.classElement = cls,
         super(resolution);
 
-  CoreClasses get coreClasses => resolution.coreClasses;
+  CommonElements get commonElements => resolution.commonElements;
 
   void loadSupertype(ClassElement element, Node from) {
     if (!element.isResolved) {
@@ -593,8 +591,8 @@
 
   void visitClassNode(ClassNode node) {
     if (node.superclass == null) {
-      if (classElement != coreClasses.objectClass) {
-        loadSupertype(coreClasses.objectClass, node);
+      if (classElement != commonElements.objectClass) {
+        loadSupertype(commonElements.objectClass, node);
       }
     } else {
       node.superclass.accept(this);
@@ -603,7 +601,7 @@
   }
 
   void visitEnum(Enum node) {
-    loadSupertype(coreClasses.objectClass, node);
+    loadSupertype(commonElements.objectClass, node);
   }
 
   void visitMixinApplication(MixinApplication node) {
diff --git a/pkg/compiler/lib/src/resolution/class_members.dart b/pkg/compiler/lib/src/resolution/class_members.dart
index 3039130..f2f670b 100644
--- a/pkg/compiler/lib/src/resolution/class_members.dart
+++ b/pkg/compiler/lib/src/resolution/class_members.dart
@@ -7,7 +7,7 @@
 import '../common.dart';
 import '../common/names.dart' show Identifiers, Names;
 import '../common/resolution.dart' show Resolution;
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart'
     show
         ClassElement,
@@ -99,7 +99,7 @@
   /// If [name] and [names] are not null, the computation is restricted to
   /// members with these names.
   void computeSuperClassMembers(String name, Setlet<Name> names) {
-    InterfaceType supertype = cls.supertype;
+    ResolutionInterfaceType supertype = cls.supertype;
     if (supertype == null) return;
     ClassElement superclass = supertype.element;
 
@@ -162,7 +162,7 @@
       }
     } else {
       LibraryElement library = cls.library;
-      InterfaceType thisType = cls.thisType;
+      ResolutionInterfaceType thisType = cls.thisType;
 
       void createMember(MemberElement element) {
         if (element.isConstructor) return;
@@ -170,8 +170,8 @@
         if (shouldSkipName(elementName)) return;
         if (nameText != null && elementName != nameText) return;
 
-        void addDeclaredMember(
-            Name name, DartType type, FunctionType functionType) {
+        void addDeclaredMember(Name name, ResolutionDartType type,
+            ResolutionFunctionType functionType) {
           DeclaredMember inherited = classMembers[name];
           DeclaredMember declared;
           if (element.isAbstract) {
@@ -188,32 +188,33 @@
 
         Name name = new Name(element.name, library);
         if (element.isField) {
-          DartType type = element.computeType(resolution);
-          addDeclaredMember(name, type, new FunctionType.synthesized(type));
+          ResolutionDartType type = element.computeType(resolution);
+          addDeclaredMember(
+              name, type, new ResolutionFunctionType.synthesized(type));
           if (!element.isConst && !element.isFinal) {
             addDeclaredMember(
                 name.setter,
                 type,
-                new FunctionType.synthesized(
-                    const VoidType(), <DartType>[type]));
+                new ResolutionFunctionType.synthesized(
+                    const ResolutionVoidType(), <ResolutionDartType>[type]));
           }
         } else if (element.isGetter) {
-          FunctionType functionType = element.computeType(resolution);
-          DartType type = functionType.returnType;
+          ResolutionFunctionType functionType = element.computeType(resolution);
+          ResolutionDartType type = functionType.returnType;
           addDeclaredMember(name, type, functionType);
         } else if (element.isSetter) {
-          FunctionType functionType = element.computeType(resolution);
-          DartType type;
+          ResolutionFunctionType functionType = element.computeType(resolution);
+          ResolutionDartType type;
           if (!functionType.parameterTypes.isEmpty) {
             type = functionType.parameterTypes.first;
           } else {
-            type = const DynamicType();
+            type = const ResolutionDynamicType();
           }
           name = name.setter;
           addDeclaredMember(name, type, functionType);
         } else {
           assert(invariant(element, element.isFunction));
-          FunctionType type = element.computeType(resolution);
+          ResolutionFunctionType type = element.computeType(resolution);
           addDeclaredMember(name, type, type);
         }
       }
@@ -310,7 +311,7 @@
   void checkImplementsFunctionWithCall() {
     assert(!cls.isAbstract);
 
-    ClassElement functionClass = resolution.coreClasses.functionClass;
+    ClassElement functionClass = resolution.commonElements.functionClass;
     functionClass.ensureResolved(resolution);
     if (cls.asInstanceOf(functionClass) == null) return;
     if (cls.lookupMember(Identifiers.call) != null) return;
@@ -380,7 +381,7 @@
         }
       }
 
-      DartType declaredType = declared.functionType;
+      ResolutionDartType declaredType = declared.functionType;
       for (Member inherited in superMember.declarations) {
         if (inherited.element == declared.element) {
           // TODO(ahe): For some reason, "call" elements are repeated in
@@ -425,7 +426,7 @@
           reportError(MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD,
               MessageKind.CANNOT_OVERRIDE_GETTER_WITH_METHOD_CONT);
         } else {
-          DartType inheritedType = inherited.functionType;
+          ResolutionDartType inheritedType = inherited.functionType;
           if (!resolution.types.isSubtype(declaredType, inheritedType)) {
             void reportWarning(
                 var marker, MessageKind warningKind, MessageKind infoKind) {
@@ -595,7 +596,7 @@
 
   Map<Name, Setlet<Member>> computeSuperInterfaceMembers(
       String name, Setlet<Name> names) {
-    InterfaceType supertype = cls.supertype;
+    ResolutionInterfaceType supertype = cls.supertype;
     assert(invariant(cls, supertype != null,
         message: "Interface members computed for $cls."));
     ClassElement superclass = supertype.element;
@@ -604,7 +605,7 @@
         new Map<Name, Setlet<Member>>();
 
     void inheritInterfaceMember(
-        InterfaceType supertype, MemberSignature member) {
+        ResolutionInterfaceType supertype, MemberSignature member) {
       if (shouldSkipMember(member)) return;
       Setlet<Member> members = inheritedInterfaceMembers.putIfAbsent(
           member.name, () => new Setlet<Member>());
@@ -613,7 +614,7 @@
       }
     }
 
-    void inheritInterfaceMembers(InterfaceType supertype) {
+    void inheritInterfaceMembers(ResolutionInterfaceType supertype) {
       supertype.element.forEachInterfaceMember((MemberSignature member) {
         inheritInterfaceMember(supertype, member);
       });
@@ -629,10 +630,10 @@
     }
 
     // Inherit interface members from superinterfaces.
-    for (Link<DartType> link = cls.interfaces;
+    for (Link<ResolutionDartType> link = cls.interfaces;
         !link.isEmpty;
         link = link.tail) {
-      InterfaceType superinterface = link.head;
+      ResolutionInterfaceType superinterface = link.head;
       if (names != null) {
         MembersCreator._computeClassMember(
             resolution, superinterface.element, name, names);
@@ -668,7 +669,7 @@
   void computeInterfaceMembers(
       Map<Name, Setlet<Member>> inheritedInterfaceMembers,
       Map<Name, Member> declaredMembers) {
-    InterfaceType thisType = cls.thisType;
+    ResolutionInterfaceType thisType = cls.thisType;
     // Compute the interface members by overriding the inherited members with
     // a declared member or by computing a single, possibly synthesized,
     // inherited member.
@@ -688,8 +689,8 @@
       } else {
         bool someAreGetters = false;
         bool allAreGetters = true;
-        Map<DartType, Setlet<Member>> subtypesOfAllInherited =
-            new Map<DartType, Setlet<Member>>();
+        Map<ResolutionDartType, Setlet<Member>> subtypesOfAllInherited =
+            new Map<ResolutionDartType, Setlet<Member>>();
         outer:
         for (Member inherited in inheritedMembers) {
           if (inherited.isGetter) {
@@ -773,7 +774,7 @@
         requiredParameters = 1;
       }
       if (member.type.isFunctionType) {
-        FunctionType type = member.type;
+        ResolutionFunctionType type = member.type;
         type.namedParameters.forEach((String name) => names.add(name));
         requiredParameters = type.parameterTypes.length;
         optionalParameters = type.optionalParameterTypes.length;
@@ -792,24 +793,25 @@
     // TODO(johnniwinther): Support function types with both optional
     // and named parameters?
     if (optionalParameters == 0 || names.isEmpty) {
-      DartType dynamic = const DynamicType();
-      List<DartType> requiredParameterTypes =
+      ResolutionDartType dynamic = const ResolutionDynamicType();
+      List<ResolutionDartType> requiredParameterTypes =
           new List.filled(minRequiredParameters, dynamic);
-      List<DartType> optionalParameterTypes =
+      List<ResolutionDartType> optionalParameterTypes =
           new List.filled(optionalParameters, dynamic);
       List<String> namedParameters = names.toList()
         ..sort((a, b) => a.compareTo(b));
-      List<DartType> namedParameterTypes =
+      List<ResolutionDartType> namedParameterTypes =
           new List.filled(namedParameters.length, dynamic);
-      FunctionType memberType = new FunctionType.synthesized(
-          const DynamicType(),
-          requiredParameterTypes,
-          optionalParameterTypes,
-          namedParameters,
-          namedParameterTypes);
-      DartType type = memberType;
+      ResolutionFunctionType memberType =
+          new ResolutionFunctionType.synthesized(
+              const ResolutionDynamicType(),
+              requiredParameterTypes,
+              optionalParameterTypes,
+              namedParameters,
+              namedParameterTypes);
+      ResolutionDartType type = memberType;
       if (inheritedMembers.first.isGetter || inheritedMembers.first.isSetter) {
-        type = const DynamicType();
+        type = const ResolutionDynamicType();
       }
       interfaceMembers[name] =
           new SyntheticMember(inheritedMembers, type, memberType);
diff --git a/pkg/compiler/lib/src/resolution/constructors.dart b/pkg/compiler/lib/src/resolution/constructors.dart
index ae51c80..90964c8 100644
--- a/pkg/compiler/lib/src/resolution/constructors.dart
+++ b/pkg/compiler/lib/src/resolution/constructors.dart
@@ -11,7 +11,7 @@
         GenerativeConstantConstructor,
         RedirectingGenerativeConstantConstructor;
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart'
     show
@@ -98,7 +98,10 @@
     Element target;
     FieldElement field;
     if (isFieldInitializer(init)) {
-      target = constructor.enclosingClass.lookupLocalMember(name);
+      // Use [enclosingElement] instead of [enclosingClass] to ensure lookup in
+      // patch class when necessary.
+      ClassElement cls = constructor.enclosingElement;
+      target = cls.lookupLocalMember(name);
       if (target == null) {
         reporter.reportErrorMessage(
             selector, MessageKind.CANNOT_RESOLVE, {'name': name});
@@ -139,7 +142,7 @@
     }
   }
 
-  InterfaceType getSuperOrThisLookupTarget(Node diagnosticNode,
+  ResolutionInterfaceType getSuperOrThisLookupTarget(Node diagnosticNode,
       {bool isSuperCall}) {
     if (isSuperCall) {
       // Calculate correct lookup target and constructor name.
@@ -163,7 +166,7 @@
     }, inConstantInitializer: isConst);
 
     bool isSuperCall = Initializers.isSuperConstructorCall(node);
-    InterfaceType targetType =
+    ResolutionInterfaceType targetType =
         getSuperOrThisLookupTarget(node, isSuperCall: isSuperCall);
     ClassElement lookupTarget = targetType.element;
     String constructorName =
@@ -210,7 +213,7 @@
       assert(superClass != null);
       assert(superClass.isResolved);
 
-      InterfaceType targetType =
+      ResolutionInterfaceType targetType =
           getSuperOrThisLookupTarget(functionNode, isSuperCall: true);
       ClassElement lookupTarget = targetType.element;
       ConstructorElement calledConstructor =
@@ -272,8 +275,7 @@
           reportAndCreateErroneousConstructor(node, constructorName, kind, {});
     } else {
       lookedupConstructor.computeType(visitor.resolution);
-      if (!callStructure
-          .signatureApplies(lookedupConstructor.functionSignature)) {
+      if (!callStructure.signatureApplies(lookedupConstructor.type)) {
         MessageKind kind = isImplicitSuperCall
             ? MessageKind.NO_MATCHING_CONSTRUCTOR_FOR_IMPLICIT
             : MessageKind.NO_MATCHING_CONSTRUCTOR;
@@ -345,7 +347,7 @@
         if (!field.isMalformed) {
           registry.registerStaticUse(new StaticUse.fieldInit(field));
         }
-        checkForDuplicateInitializers(field, element.initializer);
+        checkForDuplicateInitializers(field, parameterNode);
         visitor.defineLocalVariable(parameterNode, initializingFormal);
         visitor.addToScope(initializingFormal);
         if (isConst) {
@@ -488,7 +490,7 @@
   ConstructorResult reportAndCreateErroneousConstructorElement(
       Spannable diagnosticNode,
       ConstructorResultKind resultKind,
-      DartType type,
+      ResolutionDartType type,
       String name,
       MessageKind kind,
       Map arguments,
@@ -515,8 +517,11 @@
     return new ConstructorResult.forError(resultKind, error, type);
   }
 
-  ConstructorResult resolveConstructor(PrefixElement prefix, InterfaceType type,
-      Node diagnosticNode, String constructorName) {
+  ConstructorResult resolveConstructor(
+      PrefixElement prefix,
+      ResolutionInterfaceType type,
+      Node diagnosticNode,
+      String constructorName) {
     ClassElement cls = type.element;
     cls.ensureResolved(resolution);
     ConstructorElement constructor =
@@ -616,7 +621,7 @@
   ConstructorResult visitTypeAnnotation(TypeAnnotation node) {
     // This is not really resolving a type-annotation, but the name of the
     // constructor. Therefore we allow deferred types.
-    DartType type = resolver.resolveTypeAnnotation(node,
+    ResolutionDartType type = resolver.resolveTypeAnnotation(node,
         malformedIsError: inConstContext,
         deferredIsMalformed: false,
         registerCheckedModeCheck: false);
@@ -747,7 +752,7 @@
         error, new MalformedType(error, null));
   }
 
-  ConstructorResult constructorResultForType(Node node, DartType type,
+  ConstructorResult constructorResultForType(Node node, ResolutionDartType type,
       {PrefixElement prefix}) {
     String name = type.name;
     if (type.isTypeVariable) {
@@ -816,12 +821,12 @@
 
   /// The type of the new expression. For instance `Foo<String>` in
   /// `new prefix.Foo<String>.constructorName()`.
-  final DartType type;
+  final ResolutionDartType type;
 
   /// Creates a fully resolved constructor access where [element] is resolved
   /// to a constructor and [type] to an interface type.
   ConstructorResult(this.kind, this.prefix, ConstructorElement this.element,
-      InterfaceType this.type);
+      ResolutionInterfaceType this.type);
 
   /// Creates a fully resolved constructor access where [element] is an
   /// [ErroneousElement].
diff --git a/pkg/compiler/lib/src/resolution/enum_creator.dart b/pkg/compiler/lib/src/resolution/enum_creator.dart
index 2d07373..c73a926 100644
--- a/pkg/compiler/lib/src/resolution/enum_creator.dart
+++ b/pkg/compiler/lib/src/resolution/enum_creator.dart
@@ -5,8 +5,8 @@
 library dart2js.resolution.enum_creator;
 
 import '../common.dart';
-import '../core_types.dart' show CoreTypes;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart';
 import '../tokens/keyword.dart' show Keyword;
@@ -199,20 +199,21 @@
 // removed.
 class EnumCreator {
   final DiagnosticReporter reporter;
-  final CoreTypes coreTypes;
+  final CommonElements commonElements;
   final EnumClassElementX enumClass;
 
-  EnumCreator(this.reporter, this.coreTypes, this.enumClass);
+  EnumCreator(this.reporter, this.commonElements, this.enumClass);
 
   void createMembers() {
     Enum node = enumClass.node;
-    InterfaceType enumType = enumClass.thisType;
+    ResolutionInterfaceType enumType = enumClass.thisType;
     AstBuilder builder = new AstBuilder(enumClass.position.charOffset);
 
-    InterfaceType intType = coreTypes.intType;
-    InterfaceType stringType = coreTypes.stringType;
+    ResolutionInterfaceType intType = commonElements.intType;
+    ResolutionInterfaceType stringType = commonElements.stringType;
 
-    EnumFieldElementX addInstanceMember(String name, InterfaceType type) {
+    EnumFieldElementX addInstanceMember(
+        String name, ResolutionInterfaceType type) {
       Identifier identifier = builder.identifier(name);
       VariableList variableList =
           new VariableList(builder.modifiers(isFinal: true));
@@ -243,8 +244,8 @@
     FunctionSignatureX constructorSignature = new FunctionSignatureX(
         requiredParameters: [indexFormal],
         requiredParameterCount: 1,
-        type: new FunctionType(
-            constructor, const DynamicType(), <DartType>[intType]));
+        type: new ResolutionFunctionType(constructor,
+            const ResolutionDynamicType(), <ResolutionDartType>[intType]));
     constructor.functionSignature = constructorSignature;
     enumClass.addMember(constructor, reporter);
 
@@ -281,7 +282,8 @@
 
     VariableList valuesVariableList =
         new VariableList(builder.modifiers(isStatic: true, isConst: true));
-    valuesVariableList.type = coreTypes.listType(enumType);
+    ResolutionInterfaceType valuesType = commonElements.listType(enumType);
+    valuesVariableList.type = valuesType;
 
     Identifier valuesIdentifier = builder.identifier('values');
     // TODO(johnniwinther): Add type argument.
@@ -308,8 +310,8 @@
 
     EnumMethodElementX toString = new EnumMethodElementX(
         'toString', enumClass, Modifiers.EMPTY, toStringNode);
-    FunctionSignatureX toStringSignature =
-        new FunctionSignatureX(type: new FunctionType(toString, stringType));
+    FunctionSignatureX toStringSignature = new FunctionSignatureX(
+        type: new ResolutionFunctionType(toString, stringType));
     toString.functionSignature = toStringSignature;
     enumClass.addMember(toString, reporter);
 
diff --git a/pkg/compiler/lib/src/resolution/member_impl.dart b/pkg/compiler/lib/src/resolution/member_impl.dart
index 8c4eb1c..70f2a7a 100644
--- a/pkg/compiler/lib/src/resolution/member_impl.dart
+++ b/pkg/compiler/lib/src/resolution/member_impl.dart
@@ -7,9 +7,9 @@
 class DeclaredMember implements Member {
   final Name name;
   final Element element;
-  final InterfaceType declarer;
-  final DartType type;
-  final FunctionType functionType;
+  final ResolutionInterfaceType declarer;
+  final ResolutionDartType type;
+  final ResolutionFunctionType functionType;
 
   DeclaredMember(
       this.name, this.element, this.declarer, this.type, this.functionType);
@@ -36,7 +36,7 @@
   ///   class C<U> extends B<U> {}
   /// The member `T m()` is declared in `A<T>` and inherited from `A<S>` into
   /// `B` as `S m()`, and further from `B<U>` into `C` as `U m()`.
-  DeclaredMember inheritFrom(InterfaceType instance) {
+  DeclaredMember inheritFrom(ResolutionInterfaceType instance) {
     // If the member is declared in a non-generic class its type cannot change
     // as a result of inheritance.
     if (!declarer.isGeneric) return this;
@@ -44,7 +44,7 @@
     return _newInheritedMember(instance);
   }
 
-  InheritedMember _newInheritedMember(InterfaceType instance) {
+  InheritedMember _newInheritedMember(ResolutionInterfaceType instance) {
     return new InheritedMember(this, instance);
   }
 
@@ -63,7 +63,7 @@
     return sb.toString();
   }
 
-  void printOn(StringBuffer sb, DartType type) {
+  void printOn(StringBuffer sb, ResolutionDartType type) {
     if (isStatic) {
       sb.write('static ');
     }
@@ -89,13 +89,18 @@
 class DeclaredAbstractMember extends DeclaredMember {
   final DeclaredMember implementation;
 
-  DeclaredAbstractMember(Name name, Element element, InterfaceType declarer,
-      DartType type, FunctionType functionType, this.implementation)
+  DeclaredAbstractMember(
+      Name name,
+      Element element,
+      ResolutionInterfaceType declarer,
+      ResolutionDartType type,
+      ResolutionFunctionType functionType,
+      this.implementation)
       : super(name, element, declarer, type, functionType);
 
   bool get isAbstract => true;
 
-  InheritedMember _newInheritedMember(InterfaceType instance) {
+  InheritedMember _newInheritedMember(ResolutionInterfaceType instance) {
     return new InheritedAbstractMember(this, instance,
         implementation != null ? implementation.inheritFrom(instance) : null);
   }
@@ -103,10 +108,10 @@
 
 class InheritedMember implements DeclaredMember {
   final DeclaredMember declaration;
-  final InterfaceType instance;
+  final ResolutionInterfaceType instance;
 
   InheritedMember(
-      DeclaredMember this.declaration, InterfaceType this.instance) {
+      DeclaredMember this.declaration, ResolutionInterfaceType this.instance) {
     assert(instance.isGeneric);
     assert(!declaration.isStatic);
   }
@@ -115,7 +120,7 @@
 
   Name get name => declaration.name;
 
-  InterfaceType get declarer => instance;
+  ResolutionInterfaceType get declarer => instance;
 
   bool get isStatic => false;
 
@@ -131,13 +136,13 @@
 
   Member get implementation => this;
 
-  DartType get type => declaration.type.substByContext(instance);
+  ResolutionDartType get type => declaration.type.substByContext(instance);
 
-  FunctionType get functionType {
+  ResolutionFunctionType get functionType {
     return declaration.functionType.substByContext(instance);
   }
 
-  DeclaredMember inheritFrom(InterfaceType newInstance) {
+  DeclaredMember inheritFrom(ResolutionInterfaceType newInstance) {
     assert(invariant(declaration.element, () {
       // Assert that if [instance] contains type variables, then these are
       // defined in the declaration of [newInstance] and will therefore be
@@ -152,7 +157,7 @@
     return _newInheritedMember(newInstance);
   }
 
-  InheritedMember _newInheritedMember(InterfaceType newInstance) {
+  InheritedMember _newInheritedMember(ResolutionInterfaceType newInstance) {
     return new InheritedMember(
         declaration, instance.substByContext(newInstance));
   }
@@ -166,7 +171,7 @@
     return declaration == other.declaration && instance == other.instance;
   }
 
-  void printOn(StringBuffer sb, DartType type) {
+  void printOn(StringBuffer sb, ResolutionDartType type) {
     declaration.printOn(sb, type);
     sb.write(' inherited from $instance');
   }
@@ -181,13 +186,13 @@
 class InheritedAbstractMember extends InheritedMember {
   final DeclaredMember implementation;
 
-  InheritedAbstractMember(
-      DeclaredMember declaration, InterfaceType instance, this.implementation)
+  InheritedAbstractMember(DeclaredMember declaration,
+      ResolutionInterfaceType instance, this.implementation)
       : super(declaration, instance);
 
   bool get isAbstract => true;
 
-  InheritedMember _newInheritedMember(InterfaceType newInstance) {
+  InheritedMember _newInheritedMember(ResolutionInterfaceType newInstance) {
     return new InheritedAbstractMember(
         declaration,
         instance.substByContext(newInstance),
@@ -210,8 +215,8 @@
 }
 
 class SyntheticMember extends AbstractSyntheticMember {
-  final DartType type;
-  final FunctionType functionType;
+  final ResolutionDartType type;
+  final ResolutionFunctionType functionType;
 
   SyntheticMember(Setlet<Member> inheritedMembers, this.type, this.functionType)
       : super(inheritedMembers);
@@ -231,9 +236,9 @@
 class ErroneousMember extends AbstractSyntheticMember {
   ErroneousMember(Setlet<Member> inheritedMembers) : super(inheritedMembers);
 
-  DartType get type => functionType;
+  ResolutionDartType get type => functionType;
 
-  FunctionType get functionType {
+  ResolutionFunctionType get functionType {
     throw new UnsupportedError('Erroneous members have no type.');
   }
 
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index f566e40..13bcdd9 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -13,7 +13,7 @@
 import '../constants/expressions.dart';
 import '../constants/values.dart';
 import '../core_types.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart'
     show
@@ -171,8 +171,7 @@
             : ConstantState.NON_CONSTANT,
         super(resolution, registry);
 
-  CoreClasses get coreClasses => resolution.coreClasses;
-  CoreTypes get coreTypes => resolution.coreTypes;
+  CommonElements get commonElements => resolution.commonElements;
   ConstantEnvironment get constants => resolution.constants;
   ResolverTask get resolver => resolution.resolver;
   CompilerOptions get options => resolution.options;
@@ -337,9 +336,10 @@
       if (Elements.isUnresolved(element) && name == 'dynamic') {
         // TODO(johnniwinther): Remove this hack when we can return more complex
         // objects than [Element] from this method.
-        element = coreClasses.typeClass;
+        ClassElement typeClass = commonElements.typeClass;
+        element = typeClass;
         // Set the type to be `dynamic` to mark that this is a type literal.
-        registry.setType(node, const DynamicType());
+        registry.setType(node, const ResolutionDynamicType());
       }
       element = reportLookupErrorIfAny(element, node, name);
       if (element == null) {
@@ -414,7 +414,7 @@
     // Create the scope where the type variables are introduced, if any.
     scope = new MethodScope(scope, function);
     functionSignature.typeVariables
-        .forEach((DartType type) => addToScope(type.element));
+        .forEach((ResolutionDartType type) => addToScope(type.element));
 
     // Create the scope for the function body, and put the parameters in scope.
     scope = new BlockScope(scope);
@@ -464,12 +464,6 @@
   }
 
   ResolutionResult visitAssert(Assert node) {
-    if (!options.enableAssertMessage) {
-      if (node.hasMessage) {
-        reporter.reportErrorMessage(
-            node, MessageKind.EXPERIMENTAL_ASSERT_MESSAGE);
-      }
-    }
     // TODO(sra): We could completely ignore the assert in production mode if we
     // didn't need it to be resolved for type checking.
     registry.registerFeature(
@@ -1108,7 +1102,7 @@
     // mutation/access to unpromoted variables.
 
     Send notTypeNode = node.arguments.head.asSend();
-    DartType type;
+    ResolutionDartType type;
     SendStructure sendStructure;
     if (notTypeNode != null) {
       // `e is! T`.
@@ -1140,7 +1134,7 @@
     visitExpression(expression);
 
     Node typeNode = node.arguments.head;
-    DartType type =
+    ResolutionDartType type =
         resolveTypeAnnotation(typeNode, registerCheckedModeCheck: false);
 
     // GENERIC_METHODS: Method type variables are not reified, so we must inform
@@ -1187,8 +1181,9 @@
         // TODO(johnniwinther): Add information to [AccessSemantics] about
         // whether it is erroneous.
         if (semantics.kind == AccessKind.SUPER_METHOD) {
-          registry.registerStaticUse(new StaticUse.superInvoke(
-              semantics.element.declaration, selector.callStructure));
+          MethodElement superMethod = semantics.element.declaration;
+          registry.registerStaticUse(
+              new StaticUse.superInvoke(superMethod, selector.callStructure));
         }
         // TODO(23998): Remove this when all information goes through
         // the [SendStructure].
@@ -1202,15 +1197,15 @@
       if (expressionResult.isConstant) {
         bool isValidConstant;
         ConstantExpression expressionConstant = expressionResult.constant;
-        DartType knownExpressionType =
-            expressionConstant.getKnownType(coreTypes);
+        ResolutionDartType knownExpressionType =
+            expressionConstant.getKnownType(commonElements);
         switch (operator.kind) {
           case UnaryOperatorKind.COMPLEMENT:
-            isValidConstant = knownExpressionType == coreTypes.intType;
+            isValidConstant = knownExpressionType == commonElements.intType;
             break;
           case UnaryOperatorKind.NEGATE:
-            isValidConstant = knownExpressionType == coreTypes.intType ||
-                knownExpressionType == coreTypes.doubleType;
+            isValidConstant = knownExpressionType == commonElements.intType ||
+                knownExpressionType == commonElements.doubleType;
             break;
           case UnaryOperatorKind.NOT:
             reporter.internalError(
@@ -1243,7 +1238,8 @@
 
     if (result.isConstant) {
       ConstantExpression expressionConstant = result.constant;
-      if (expressionConstant.getKnownType(coreTypes) == coreTypes.boolType) {
+      if (expressionConstant.getKnownType(commonElements) ==
+          commonElements.boolType) {
         // TODO(johnniwinther): Handle potentially invalid constant expressions.
         ConstantExpression constant =
             new UnaryConstantExpression(operator, expressionConstant);
@@ -1268,8 +1264,10 @@
     if (leftResult.isConstant && rightResult.isConstant) {
       ConstantExpression leftConstant = leftResult.constant;
       ConstantExpression rightConstant = rightResult.constant;
-      if (leftConstant.getKnownType(coreTypes) == coreTypes.boolType &&
-          rightConstant.getKnownType(coreTypes) == coreTypes.boolType) {
+      if (leftConstant.getKnownType(commonElements) ==
+              commonElements.boolType &&
+          rightConstant.getKnownType(commonElements) ==
+              commonElements.boolType) {
         // TODO(johnniwinther): Handle potentially invalid constant expressions.
         ConstantExpression constant = new BinaryConstantExpression(
             leftConstant, BinaryOperator.LOGICAL_AND, rightConstant);
@@ -1292,8 +1290,10 @@
     if (leftResult.isConstant && rightResult.isConstant) {
       ConstantExpression leftConstant = leftResult.constant;
       ConstantExpression rightConstant = rightResult.constant;
-      if (leftConstant.getKnownType(coreTypes) == coreTypes.boolType &&
-          rightConstant.getKnownType(coreTypes) == coreTypes.boolType) {
+      if (leftConstant.getKnownType(commonElements) ==
+              commonElements.boolType &&
+          rightConstant.getKnownType(commonElements) ==
+              commonElements.boolType) {
         // TODO(johnniwinther): Handle potentially invalid constant expressions.
         ConstantExpression constant = new BinaryConstantExpression(
             leftConstant, BinaryOperator.LOGICAL_OR, rightConstant);
@@ -1356,8 +1356,9 @@
         // TODO(johnniwinther): Add information to [AccessSemantics] about
         // whether it is erroneous.
         if (semantics.kind == AccessKind.SUPER_METHOD) {
-          registry.registerStaticUse(new StaticUse.superInvoke(
-              semantics.element.declaration, selector.callStructure));
+          MethodElement superMethod = semantics.element.declaration;
+          registry.registerStaticUse(
+              new StaticUse.superInvoke(superMethod, selector.callStructure));
         }
         // TODO(23998): Remove this when all information goes through
         // the [SendStructure].
@@ -1374,29 +1375,31 @@
         bool isValidConstant;
         ConstantExpression leftConstant = leftResult.constant;
         ConstantExpression rightConstant = rightResult.constant;
-        DartType knownLeftType = leftConstant.getKnownType(coreTypes);
-        DartType knownRightType = rightConstant.getKnownType(coreTypes);
+        ResolutionDartType knownLeftType =
+            leftConstant.getKnownType(commonElements);
+        ResolutionDartType knownRightType =
+            rightConstant.getKnownType(commonElements);
         switch (operator.kind) {
           case BinaryOperatorKind.EQ:
           case BinaryOperatorKind.NOT_EQ:
-            isValidConstant = (knownLeftType == coreTypes.intType ||
-                    knownLeftType == coreTypes.doubleType ||
-                    knownLeftType == coreTypes.stringType ||
-                    knownLeftType == coreTypes.boolType ||
-                    knownLeftType == coreTypes.nullType) &&
-                (knownRightType == coreTypes.intType ||
-                    knownRightType == coreTypes.doubleType ||
-                    knownRightType == coreTypes.stringType ||
-                    knownRightType == coreTypes.boolType ||
-                    knownRightType == coreTypes.nullType);
+            isValidConstant = (knownLeftType == commonElements.intType ||
+                    knownLeftType == commonElements.doubleType ||
+                    knownLeftType == commonElements.stringType ||
+                    knownLeftType == commonElements.boolType ||
+                    knownLeftType == commonElements.nullType) &&
+                (knownRightType == commonElements.intType ||
+                    knownRightType == commonElements.doubleType ||
+                    knownRightType == commonElements.stringType ||
+                    knownRightType == commonElements.boolType ||
+                    knownRightType == commonElements.nullType);
             break;
           case BinaryOperatorKind.ADD:
-            isValidConstant = (knownLeftType == coreTypes.intType ||
-                    knownLeftType == coreTypes.doubleType ||
-                    knownLeftType == coreTypes.stringType) &&
-                (knownRightType == coreTypes.intType ||
-                    knownRightType == coreTypes.doubleType ||
-                    knownRightType == coreTypes.stringType);
+            isValidConstant = (knownLeftType == commonElements.intType ||
+                    knownLeftType == commonElements.doubleType ||
+                    knownLeftType == commonElements.stringType) &&
+                (knownRightType == commonElements.intType ||
+                    knownRightType == commonElements.doubleType ||
+                    knownRightType == commonElements.stringType);
             break;
           case BinaryOperatorKind.SUB:
           case BinaryOperatorKind.MUL:
@@ -1407,18 +1410,18 @@
           case BinaryOperatorKind.GT:
           case BinaryOperatorKind.LTEQ:
           case BinaryOperatorKind.LT:
-            isValidConstant = (knownLeftType == coreTypes.intType ||
-                    knownLeftType == coreTypes.doubleType) &&
-                (knownRightType == coreTypes.intType ||
-                    knownRightType == coreTypes.doubleType);
+            isValidConstant = (knownLeftType == commonElements.intType ||
+                    knownLeftType == commonElements.doubleType) &&
+                (knownRightType == commonElements.intType ||
+                    knownRightType == commonElements.doubleType);
             break;
           case BinaryOperatorKind.SHL:
           case BinaryOperatorKind.SHR:
           case BinaryOperatorKind.AND:
           case BinaryOperatorKind.OR:
           case BinaryOperatorKind.XOR:
-            isValidConstant = knownLeftType == coreTypes.intType &&
-                knownRightType == coreTypes.intType;
+            isValidConstant = knownLeftType == commonElements.intType &&
+                knownRightType == commonElements.intType;
             break;
           case BinaryOperatorKind.INDEX:
             isValidConstant = false;
@@ -1566,20 +1569,21 @@
         case AccessKind.SUPER_METHOD:
           MethodElement superMethod = semantics.element;
           superMethod.computeType(resolution);
-          if (!callStructure.signatureApplies(superMethod.functionSignature)) {
+          if (!callStructure.signatureApplies(superMethod.type)) {
             registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
             registry.registerDynamicUse(new DynamicUse(selector, null));
             registry.registerFeature(Feature.SUPER_NO_SUCH_METHOD);
             isIncompatibleInvoke = true;
           } else {
             registry.registerStaticUse(
-                new StaticUse.superInvoke(semantics.element, callStructure));
+                new StaticUse.superInvoke(superMethod, callStructure));
           }
           break;
         case AccessKind.SUPER_FIELD:
         case AccessKind.SUPER_FINAL_FIELD:
         case AccessKind.SUPER_GETTER:
-          registry.registerStaticUse(new StaticUse.superGet(semantics.element));
+          MemberElement superMember = semantics.element;
+          registry.registerStaticUse(new StaticUse.superGet(superMember));
           selector = callStructure.callSelector;
           registry.registerDynamicUse(new DynamicUse(selector, null));
           break;
@@ -1605,13 +1609,14 @@
         case AccessKind.SUPER_METHOD:
           // TODO(johnniwinther): Method this should be registered as a
           // closurization.
-          registry
-              .registerStaticUse(new StaticUse.superTearOff(semantics.element));
+          MethodElement superMethod = semantics.element;
+          registry.registerStaticUse(new StaticUse.superTearOff(superMethod));
           break;
         case AccessKind.SUPER_FIELD:
         case AccessKind.SUPER_FINAL_FIELD:
         case AccessKind.SUPER_GETTER:
-          registry.registerStaticUse(new StaticUse.superGet(semantics.element));
+          MemberElement superMember = semantics.element;
+          registry.registerStaticUse(new StaticUse.superGet(superMember));
           break;
         case AccessKind.SUPER_SETTER:
         case AccessKind.UNRESOLVED_SUPER:
@@ -1980,8 +1985,12 @@
   // the [GetStructure].
   // TODO(johnniwinther): Remove [element] when it is no longer needed for
   // evaluating constants.
-  ResolutionResult handleConstantTypeLiteralAccess(Send node, Name name,
-      TypeDeclarationElement element, DartType type, ConstantAccess semantics) {
+  ResolutionResult handleConstantTypeLiteralAccess(
+      Send node,
+      Name name,
+      TypeDeclarationElement element,
+      ResolutionDartType type,
+      ConstantAccess semantics) {
     registry.useElement(node, element);
     registry.registerTypeLiteral(node, type);
 
@@ -2015,8 +2024,12 @@
   // the [GetStructure].
   // TODO(johnniwinther): Remove [element] when it is no longer needed for
   // evaluating constants.
-  ResolutionResult handleConstantTypeLiteralUpdate(SendSet node, Name name,
-      TypeDeclarationElement element, DartType type, ConstantAccess semantics) {
+  ResolutionResult handleConstantTypeLiteralUpdate(
+      SendSet node,
+      Name name,
+      TypeDeclarationElement element,
+      ResolutionDartType type,
+      ConstantAccess semantics) {
     // TODO(johnniwinther): Remove this when all constants are evaluated.
     resolver.constantCompiler.evaluate(semantics.constant);
 
@@ -2047,7 +2060,7 @@
   ResolutionResult handleTypedefTypeLiteralAccess(
       Send node, Name name, TypedefElement typdef) {
     typdef.ensureResolved(resolution);
-    DartType type = typdef.rawType;
+    ResolutionDartType type = typdef.rawType;
     ConstantExpression constant = new TypeConstantExpression(type);
     AccessSemantics semantics = new ConstantAccess.typedefTypeLiteral(constant);
     return handleConstantTypeLiteralAccess(node, name, typdef, type, semantics);
@@ -2058,7 +2071,7 @@
   ResolutionResult handleTypedefTypeLiteralUpdate(
       SendSet node, Name name, TypedefElement typdef) {
     typdef.ensureResolved(resolution);
-    DartType type = typdef.rawType;
+    ResolutionDartType type = typdef.rawType;
     ConstantExpression constant = new TypeConstantExpression(type);
     AccessSemantics semantics = new ConstantAccess.typedefTypeLiteral(constant);
     return handleConstantTypeLiteralUpdate(node, name, typdef, type, semantics);
@@ -2067,25 +2080,27 @@
   /// Handle access to a type literal of the type 'dynamic'. Like `dynamic` or
   /// `dynamic()`.
   ResolutionResult handleDynamicTypeLiteralAccess(Send node) {
-    DartType type = const DynamicType();
+    ResolutionDartType type = const ResolutionDynamicType();
     ConstantExpression constant = new TypeConstantExpression(
         // TODO(johnniwinther): Use [type] when evaluation of constants is done
         // directly on the constant expressions.
-        node.isCall ? coreTypes.typeType : type);
+        node.isCall ? commonElements.typeType : type);
     AccessSemantics semantics = new ConstantAccess.dynamicTypeLiteral(constant);
-    return handleConstantTypeLiteralAccess(node, const PublicName('dynamic'),
-        coreClasses.typeClass, type, semantics);
+    ClassElement typeClass = commonElements.typeClass;
+    return handleConstantTypeLiteralAccess(
+        node, const PublicName('dynamic'), typeClass, type, semantics);
   }
 
   /// Handle update to a type literal of the type 'dynamic'. Like `dynamic++` or
   /// `dynamic = 0`.
   ResolutionResult handleDynamicTypeLiteralUpdate(SendSet node) {
-    DartType type = const DynamicType();
+    ResolutionDartType type = const ResolutionDynamicType();
     ConstantExpression constant =
-        new TypeConstantExpression(const DynamicType());
+        new TypeConstantExpression(const ResolutionDynamicType());
     AccessSemantics semantics = new ConstantAccess.dynamicTypeLiteral(constant);
-    return handleConstantTypeLiteralUpdate(node, const PublicName('dynamic'),
-        coreClasses.typeClass, type, semantics);
+    ClassElement typeClass = commonElements.typeClass;
+    return handleConstantTypeLiteralUpdate(
+        node, const PublicName('dynamic'), typeClass, type, semantics);
   }
 
   /// Handle access to a type literal of a class. Like `C` or
@@ -2093,7 +2108,7 @@
   ResolutionResult handleClassTypeLiteralAccess(
       Send node, Name name, ClassElement cls) {
     cls.ensureResolved(resolution);
-    DartType type = cls.rawType;
+    ResolutionDartType type = cls.rawType;
     ConstantExpression constant = new TypeConstantExpression(type);
     AccessSemantics semantics = new ConstantAccess.classTypeLiteral(constant);
     return handleConstantTypeLiteralAccess(node, name, cls, type, semantics);
@@ -2104,7 +2119,7 @@
   ResolutionResult handleClassTypeLiteralUpdate(
       SendSet node, Name name, ClassElement cls) {
     cls.ensureResolved(resolution);
-    DartType type = cls.rawType;
+    ResolutionDartType type = cls.rawType;
     ConstantExpression constant = new TypeConstantExpression(type);
     AccessSemantics semantics = new ConstantAccess.classTypeLiteral(constant);
     return handleConstantTypeLiteralUpdate(node, name, cls, type, semantics);
@@ -2486,7 +2501,7 @@
         case AccessKind.LOCAL_FUNCTION:
           LocalFunctionElementX function = semantics.element;
           function.computeType(resolution);
-          if (!callStructure.signatureApplies(function.functionSignature)) {
+          if (!callStructure.signatureApplies(function.type)) {
             registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
             registry.registerDynamicUse(new DynamicUse(selector, null));
             isIncompatibleInvoke = true;
@@ -2654,13 +2669,13 @@
         case AccessKind.TOPLEVEL_METHOD:
           MethodElement method = semantics.element;
           method.computeType(resolution);
-          if (!callStructure.signatureApplies(method.functionSignature)) {
+          if (!callStructure.signatureApplies(method.type)) {
             registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
             registry.registerDynamicUse(new DynamicUse(selector, null));
             isIncompatibleInvoke = true;
           } else {
             registry.registerStaticUse(
-                new StaticUse.staticInvoke(semantics.element, callStructure));
+                new StaticUse.staticInvoke(method, callStructure));
             handleForeignCall(node, semantics.element, callStructure);
             if (method == resolution.commonElements.identicalFunction &&
                 argumentsResult.isValidAsConstant) {
@@ -2678,8 +2693,8 @@
         case AccessKind.TOPLEVEL_FIELD:
         case AccessKind.FINAL_TOPLEVEL_FIELD:
         case AccessKind.TOPLEVEL_GETTER:
-          registry
-              .registerStaticUse(new StaticUse.staticGet(semantics.element));
+          MemberElement member = semantics.element;
+          registry.registerStaticUse(new StaticUse.staticGet(member));
           selector = callStructure.callSelector;
           registry.registerDynamicUse(new DynamicUse(selector, null));
           break;
@@ -2705,8 +2720,8 @@
       switch (semantics.kind) {
         case AccessKind.STATIC_METHOD:
         case AccessKind.TOPLEVEL_METHOD:
-          registry.registerStaticUse(
-              new StaticUse.staticTearOff(semantics.element));
+          MethodElement method = semantics.element;
+          registry.registerStaticUse(new StaticUse.staticTearOff(method));
           break;
         case AccessKind.STATIC_FIELD:
         case AccessKind.FINAL_STATIC_FIELD:
@@ -2714,8 +2729,8 @@
         case AccessKind.TOPLEVEL_FIELD:
         case AccessKind.FINAL_TOPLEVEL_FIELD:
         case AccessKind.TOPLEVEL_GETTER:
-          registry
-              .registerStaticUse(new StaticUse.staticGet(semantics.element));
+          MemberElement member = semantics.element;
+          registry.registerStaticUse(new StaticUse.staticGet(member));
           break;
         case AccessKind.STATIC_SETTER:
         case AccessKind.TOPLEVEL_SETTER:
@@ -2825,16 +2840,17 @@
         semantics = new StaticAccess.unresolved(member);
       } else if (member.isFunction) {
         // `a = b`, `a++` or `a += b` where `a` is a function.
+        MethodElement method = member;
         ErroneousElement error = reportAndCreateErroneousElement(
             node.selector, name.text, MessageKind.ASSIGNING_METHOD, const {});
         registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
         if (node.isComplex) {
           // `a++` or `a += b` where `a` is a function.
-          registry.registerStaticUse(new StaticUse.staticTearOff(element));
+          registry.registerStaticUse(new StaticUse.staticTearOff(method));
         }
         semantics = member.isTopLevel
-            ? new StaticAccess.topLevelMethod(member)
-            : new StaticAccess.staticMethod(member);
+            ? new StaticAccess.topLevelMethod(method)
+            : new StaticAccess.staticMethod(method);
       } else {
         // `a = b`, `a++` or `a += b` where `a` is a field.
         assert(invariant(node, member.isField,
@@ -3006,6 +3022,12 @@
   }
 
   ResolutionResult visitSend(Send node) {
+    // Resolve type arguments to ensure that these are well-formed types.
+    if (node.typeArgumentsNode != null) {
+      for (TypeAnnotation type in node.typeArgumentsNode.nodes) {
+        resolveTypeAnnotation(type, registerCheckedModeCheck: false);
+      }
+    }
     if (node.isOperator) {
       // `a && b`, `a + b`, `-a`, or `a is T`.
       return handleOperatorSend(node);
@@ -3038,7 +3060,7 @@
   }
 
   /// Callback for native enqueuer to parse a type.  Returns [:null:] on error.
-  DartType resolveTypeFromString(Node node, String typeName) {
+  ResolutionDartType resolveTypeFromString(Node node, String typeName) {
     Element element = lookupInScope(reporter, node, scope, typeName);
     if (element == null) return null;
     if (element is! ClassElement) return null;
@@ -3154,12 +3176,14 @@
             isIndex: true);
 
         if (!semantics.getter.isError) {
-          registry.registerStaticUse(new StaticUse.superInvoke(
-              semantics.getter, getterSelector.callStructure));
+          MethodElement getter = semantics.getter;
+          registry.registerStaticUse(
+              new StaticUse.superInvoke(getter, getterSelector.callStructure));
         }
         if (!semantics.setter.isError) {
-          registry.registerStaticUse(new StaticUse.superInvoke(
-              semantics.setter, setterSelector.callStructure));
+          MethodElement setter = semantics.setter;
+          registry.registerStaticUse(
+              new StaticUse.superInvoke(setter, setterSelector.callStructure));
         }
 
         // TODO(23998): Remove these when elements are only accessed
@@ -3195,8 +3219,9 @@
         // through the send structure.
         registry.setSelector(node, setterSelector);
         if (!semantics.setter.isError) {
-          registry.registerStaticUse(new StaticUse.superInvoke(
-              semantics.setter, setterSelector.callStructure));
+          MethodElement setter = semantics.setter;
+          registry.registerStaticUse(
+              new StaticUse.superInvoke(setter, setterSelector.callStructure));
         }
 
         SendStructure sendStructure = new IndexSetStructure(semantics);
@@ -3214,12 +3239,14 @@
               isIndex: true);
 
           if (!semantics.getter.isError) {
+            MethodElement getter = semantics.getter;
             registry.registerStaticUse(new StaticUse.superInvoke(
-                semantics.getter, getterSelector.callStructure));
+                getter, getterSelector.callStructure));
           }
           if (!semantics.setter.isError) {
+            MethodElement setter = semantics.setter;
             registry.registerStaticUse(new StaticUse.superInvoke(
-                semantics.setter, setterSelector.callStructure));
+                setter, setterSelector.callStructure));
           }
 
           // TODO(23998): Remove these when elements are only accessed
@@ -3262,52 +3289,54 @@
     void registerStaticUses(AccessSemantics semantics) {
       switch (semantics.kind) {
         case AccessKind.SUPER_METHOD:
-          registry
-              .registerStaticUse(new StaticUse.superTearOff(semantics.element));
+          MethodElement method = semantics.element;
+          registry.registerStaticUse(new StaticUse.superTearOff(method));
           break;
         case AccessKind.SUPER_GETTER:
-          registry.registerStaticUse(new StaticUse.superGet(semantics.getter));
+          MethodElement getter = semantics.getter;
+          registry.registerStaticUse(new StaticUse.superGet(getter));
           break;
         case AccessKind.SUPER_SETTER:
-          registry.registerStaticUse(
-              new StaticUse.superSetterSet(semantics.setter));
+          MethodElement setter = semantics.setter;
+          registry.registerStaticUse(new StaticUse.superSetterSet(setter));
           break;
         case AccessKind.SUPER_FIELD:
-          registry.registerStaticUse(new StaticUse.superGet(semantics.element));
-          registry.registerStaticUse(
-              new StaticUse.superFieldSet(semantics.element));
+          FieldElement field = semantics.element;
+          registry.registerStaticUse(new StaticUse.superGet(field));
+          registry.registerStaticUse(new StaticUse.superFieldSet(field));
           break;
         case AccessKind.SUPER_FINAL_FIELD:
-          registry.registerStaticUse(new StaticUse.superGet(semantics.element));
+          FieldElement field = semantics.element;
+          registry.registerStaticUse(new StaticUse.superGet(field));
           break;
         case AccessKind.COMPOUND:
           CompoundAccessSemantics compoundSemantics = semantics;
           switch (compoundSemantics.compoundAccessKind) {
             case CompoundAccessKind.SUPER_GETTER_FIELD:
             case CompoundAccessKind.SUPER_FIELD_FIELD:
-              registry
-                  .registerStaticUse(new StaticUse.superGet(semantics.getter));
-              registry.registerStaticUse(
-                  new StaticUse.superFieldSet(semantics.setter));
+              MemberElement getter = semantics.getter;
+              FieldElement setter = semantics.setter;
+              registry.registerStaticUse(new StaticUse.superGet(getter));
+              registry.registerStaticUse(new StaticUse.superFieldSet(setter));
               break;
             case CompoundAccessKind.SUPER_FIELD_SETTER:
             case CompoundAccessKind.SUPER_GETTER_SETTER:
-              registry
-                  .registerStaticUse(new StaticUse.superGet(semantics.getter));
-              registry.registerStaticUse(
-                  new StaticUse.superSetterSet(semantics.setter));
+              MemberElement getter = semantics.getter;
+              MethodElement setter = semantics.setter;
+              registry.registerStaticUse(new StaticUse.superGet(getter));
+              registry.registerStaticUse(new StaticUse.superSetterSet(setter));
               break;
             case CompoundAccessKind.SUPER_METHOD_SETTER:
-              registry.registerStaticUse(
-                  new StaticUse.superSetterSet(semantics.setter));
+              MethodElement setter = semantics.setter;
+              registry.registerStaticUse(new StaticUse.superSetterSet(setter));
               break;
             case CompoundAccessKind.UNRESOLVED_SUPER_GETTER:
-              registry.registerStaticUse(
-                  new StaticUse.superSetterSet(semantics.setter));
+              MethodElement setter = semantics.setter;
+              registry.registerStaticUse(new StaticUse.superSetterSet(setter));
               break;
             case CompoundAccessKind.UNRESOLVED_SUPER_SETTER:
-              registry
-                  .registerStaticUse(new StaticUse.superGet(semantics.getter));
+              MethodElement getter = semantics.getter;
+              registry.registerStaticUse(new StaticUse.superGet(getter));
               break;
             default:
               break;
@@ -3357,12 +3386,12 @@
               registry.registerFeature(Feature.SUPER_NO_SUCH_METHOD);
               break;
             case AccessKind.SUPER_FIELD:
-              registry.registerStaticUse(
-                  new StaticUse.superFieldSet(semantics.setter));
+              FieldElement field = semantics.setter;
+              registry.registerStaticUse(new StaticUse.superFieldSet(field));
               break;
             case AccessKind.SUPER_SETTER:
-              registry.registerStaticUse(
-                  new StaticUse.superSetterSet(semantics.setter));
+              MethodElement setter = semantics.setter;
+              registry.registerStaticUse(new StaticUse.superSetterSet(setter));
               break;
             default:
               break;
@@ -3589,11 +3618,13 @@
       if (!currentAsyncMarker.isYielding) {
         reporter.reportErrorMessage(node, MessageKind.INVALID_YIELD);
       }
+      ClassElement cls;
       if (currentAsyncMarker.isAsync) {
-        coreClasses.streamClass.ensureResolved(resolution);
+        cls = commonElements.streamClass;
       } else {
-        coreClasses.iterableClass.ensureResolved(resolution);
+        cls = commonElements.iterableClass;
       }
+      cls.ensureResolved(resolution);
     }
     visit(node.expression);
     return const NoneResult();
@@ -3655,11 +3686,12 @@
     // Check that the target constructor is type compatible with the
     // redirecting constructor.
     ClassElement targetClass = redirectionTarget.enclosingClass;
-    InterfaceType type = registry.getType(node);
-    FunctionType targetConstructorType = redirectionTarget
+    ResolutionInterfaceType type = registry.getType(node);
+    ResolutionFunctionType targetConstructorType = redirectionTarget
         .computeType(resolution)
         .subst(type.typeArguments, targetClass.typeVariables);
-    FunctionType constructorType = constructor.computeType(resolution);
+    ResolutionFunctionType constructorType =
+        constructor.computeType(resolution);
     bool isSubtype =
         resolution.types.isSubtype(targetConstructorType, constructorType);
     if (!isSubtype) {
@@ -3668,7 +3700,7 @@
       // TODO(johnniwinther): Handle this (potentially) erroneous case.
       isValidAsConstant = false;
     }
-    if (type.typeArguments.any((DartType type) => !type.isDynamic)) {
+    if (type.typeArguments.any((ResolutionDartType type) => !type.isDynamic)) {
       registry.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
     }
 
@@ -3727,18 +3759,19 @@
       if (!currentAsyncMarker.isAsync) {
         reporter.reportErrorMessage(node, MessageKind.INVALID_AWAIT);
       }
-      coreClasses.futureClass.ensureResolved(resolution);
+      ClassElement futureClass = commonElements.futureClass;
+      futureClass.ensureResolved(resolution);
     }
     visit(node.expression);
     return const NoneResult();
   }
 
   ResolutionResult visitVariableDefinitions(VariableDefinitions node) {
-    DartType type;
+    ResolutionDartType type;
     if (node.type != null) {
       type = resolveTypeAnnotation(node.type);
     } else {
-      type = const DynamicType();
+      type = const ResolutionDynamicType();
     }
     VariableList variables = new VariableList.node(node, type);
     VariableDefinitionsVisitor visitor =
@@ -3819,14 +3852,14 @@
     CallStructure callStructure = selector.callStructure;
     registry.useElement(node.send, constructor);
 
-    DartType type = result.type;
+    ResolutionDartType type = result.type;
     ConstructorAccessKind kind;
     bool isInvalid = false;
     switch (result.kind) {
       case ConstructorResultKind.GENERATIVE:
         // Ensure that the signature of [constructor] has been computed.
         constructor.computeType(resolution);
-        if (!callStructure.signatureApplies(constructor.functionSignature)) {
+        if (!callStructure.signatureApplies(constructor.type)) {
           isInvalid = true;
           kind = ConstructorAccessKind.INCOMPATIBLE;
           registry.registerFeature(Feature.THROW_NO_SUCH_METHOD);
@@ -3837,7 +3870,7 @@
       case ConstructorResultKind.FACTORY:
         // Ensure that the signature of [constructor] has been computed.
         constructor.computeType(resolution);
-        if (!callStructure.signatureApplies(constructor.functionSignature)) {
+        if (!callStructure.signatureApplies(constructor.type)) {
           // The effective target might still be valid(!) so the is not an
           // invalid case in itself. For instance
           //
@@ -3887,13 +3920,15 @@
       // and only declaration elements may be registered.
       // TODO(johniwinther): Avoid registration of `type` in face of redirecting
       // factory constructors.
+      ConstructorElement declaration = constructor.declaration;
       registry.registerStaticUse(node.isConst
           ? new StaticUse.constConstructorInvoke(
-              constructor.declaration, callStructure, type)
+              declaration, callStructure, type)
           : new StaticUse.typedConstructorInvoke(
-              constructor.declaration, callStructure, type));
-      InterfaceType interfaceType = type;
-      if (interfaceType.typeArguments.any((DartType type) => !type.isDynamic)) {
+              constructor, callStructure, type));
+      ResolutionInterfaceType interfaceType = type;
+      if (interfaceType.typeArguments
+          .any((ResolutionDartType type) => !type.isDynamic)) {
         registry.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
       }
     }
@@ -3909,7 +3944,7 @@
             .compileNode(argumentNode, registry.mapping);
         ConstantValue name = resolution.constants.getConstantValue(constant);
         if (!name.isString) {
-          DartType type = name.getType(coreTypes);
+          ResolutionDartType type = name.getType(commonElements);
           reporter.reportErrorMessage(
               argumentNode, MessageKind.STRING_EXPECTED, {'type': type});
         } else {
@@ -3983,7 +4018,7 @@
           !resolution.mirrorUsageAnalyzerTask
               .hasMirrorUsage(enclosingElement)) {
         reporter.reportHintMessage(node.newToken, MessageKind.NON_CONST_BLOAT,
-            {'name': coreClasses.symbolClass.name});
+            {'name': commonElements.symbolClass.name});
       }
       registry.registerNewStructure(
           node,
@@ -4000,11 +4035,11 @@
     for (ConstantValue key in map.keys) {
       if (!key.isObject) continue;
       ObjectConstantValue objectConstant = key;
-      DartType keyType = objectConstant.type;
+      ResolutionInterfaceType keyType = objectConstant.type;
       ClassElement cls = keyType.element;
-      if (cls == coreClasses.stringClass) continue;
+      if (cls == commonElements.stringClass) continue;
       Element equals = cls.lookupMember('==');
-      if (equals.enclosingClass != coreClasses.objectClass) {
+      if (equals.enclosingClass != commonElements.objectClass) {
         reporter.reportErrorMessage(spannable,
             MessageKind.CONST_MAP_KEY_OVERRIDES_EQUALS, {'type': keyType});
       }
@@ -4071,11 +4106,11 @@
         inConstContext: inConstContext));
   }
 
-  DartType resolveTypeAnnotation(TypeAnnotation node,
+  ResolutionDartType resolveTypeAnnotation(TypeAnnotation node,
       {bool malformedIsError: false,
       bool deferredIsMalformed: true,
       bool registerCheckedModeCheck: true}) {
-    DartType type = typeResolver.resolveTypeAnnotation(this, node,
+    ResolutionDartType type = typeResolver.resolveTypeAnnotation(this, node,
         malformedIsError: malformedIsError,
         deferredIsMalformed: deferredIsMalformed);
     if (registerCheckedModeCheck) {
@@ -4089,7 +4124,7 @@
     sendIsMemberAccess = false;
 
     NodeList arguments = node.typeArguments;
-    DartType typeArgument;
+    ResolutionDartType typeArgument;
     if (arguments != null) {
       Link<Node> nodes = arguments.nodes;
       if (nodes.isEmpty) {
@@ -4106,16 +4141,16 @@
         }
       }
     }
-    DartType listType;
+    ResolutionInterfaceType listType;
     if (typeArgument != null) {
       if (node.isConst && typeArgument.containsTypeVariables) {
         reporter.reportErrorMessage(
             arguments.nodes.head, MessageKind.TYPE_VARIABLE_IN_CONSTANT);
         isValidAsConstant = false;
       }
-      listType = coreTypes.listType(typeArgument);
+      listType = commonElements.listType(typeArgument);
     } else {
-      listType = coreTypes.listType();
+      listType = commonElements.listType();
     }
     registry.registerLiteralList(node, listType,
         isConstant: node.isConst, isEmpty: node.elements.isEmpty);
@@ -4335,8 +4370,8 @@
       if (loopVariable == null || loopVariable.isInstanceMember) {
         registry.registerDynamicUse(new DynamicUse(loopVariableSelector, null));
       } else if (loopVariable.isStatic || loopVariable.isTopLevel) {
-        registry.registerStaticUse(
-            new StaticUse.staticSet(loopVariable.declaration));
+        MemberElement member = loopVariable.declaration;
+        registry.registerStaticUse(new StaticUse.staticSet(member));
       }
     } else {
       // The selector may only be null if we reported an error.
@@ -4384,8 +4419,8 @@
     sendIsMemberAccess = false;
 
     NodeList arguments = node.typeArguments;
-    DartType keyTypeArgument;
-    DartType valueTypeArgument;
+    ResolutionDartType keyTypeArgument;
+    ResolutionDartType valueTypeArgument;
     if (arguments != null) {
       Link<Node> nodes = arguments.nodes;
       if (nodes.isEmpty) {
@@ -4409,11 +4444,11 @@
         }
       }
     }
-    DartType mapType;
+    ResolutionInterfaceType mapType;
     if (valueTypeArgument != null) {
-      mapType = coreTypes.mapType(keyTypeArgument, valueTypeArgument);
+      mapType = commonElements.mapType(keyTypeArgument, valueTypeArgument);
     } else {
-      mapType = coreTypes.mapType();
+      mapType = commonElements.mapType();
     }
     if (node.isConst && mapType.containsTypeVariables) {
       reporter.reportErrorMessage(
@@ -4464,27 +4499,28 @@
     return visit(node.expression);
   }
 
-  DartType typeOfConstant(ConstantValue constant) {
-    if (constant.isInt) return coreTypes.intType;
-    if (constant.isBool) return coreTypes.boolType;
-    if (constant.isDouble) return coreTypes.doubleType;
-    if (constant.isString) return coreTypes.stringType;
-    if (constant.isNull) return coreTypes.nullType;
-    if (constant.isFunction) return coreTypes.functionType;
+  ResolutionInterfaceType typeOfConstant(ConstantValue constant) {
+    if (constant.isInt) return commonElements.intType;
+    if (constant.isBool) return commonElements.boolType;
+    if (constant.isDouble) return commonElements.doubleType;
+    if (constant.isString) return commonElements.stringType;
+    if (constant.isNull) return commonElements.nullType;
+    if (constant.isFunction) return commonElements.functionType;
     assert(constant.isObject);
     ObjectConstantValue objectConstant = constant;
-    return objectConstant.type;
+    ResolutionInterfaceType type = objectConstant.type;
+    return type;
   }
 
-  bool overridesEquals(DartType type) {
+  bool overridesEquals(ResolutionDartType type) {
     ClassElement cls = type.element;
     Element equals = cls.lookupMember('==');
-    return equals.enclosingClass != coreClasses.objectClass;
+    return equals.enclosingClass != commonElements.objectClass;
   }
 
   void checkCaseExpressions(SwitchStatement node) {
     CaseMatch firstCase = null;
-    DartType firstCaseType = null;
+    ResolutionDartType firstCaseType = null;
     DiagnosticMessage error;
     List<DiagnosticMessage> infos = <DiagnosticMessage>[];
 
@@ -4504,7 +4540,8 @@
             message: 'No constant computed for $node'));
 
         ConstantValue value = resolution.constants.getConstantValue(constant);
-        DartType caseType = value.getType(coreTypes); //typeOfConstant(value);
+        ResolutionDartType caseType =
+            value.getType(commonElements); //typeOfConstant(value);
 
         if (firstCaseType == null) {
           firstCase = caseMatch;
@@ -4512,12 +4549,12 @@
 
           // We only report the bad type on the first class element. All others
           // get a "type differs" error.
-          if (caseType == coreTypes.doubleType) {
+          if (caseType == commonElements.doubleType) {
             reporter.reportErrorMessage(
                 node,
                 MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS,
                 {'type': "double"});
-          } else if (caseType == coreTypes.functionType) {
+          } else if (caseType == commonElements.functionType) {
             reporter.reportErrorMessage(
                 node, MessageKind.SWITCH_CASE_FORBIDDEN, {'type': "Function"});
           } else if (value.isObject && overridesEquals(caseType)) {
@@ -4726,7 +4763,7 @@
     inCatchBlock = oldInCatchBlock;
 
     if (node.type != null) {
-      DartType exceptionType =
+      ResolutionDartType exceptionType =
           resolveTypeAnnotation(node.type, registerCheckedModeCheck: false);
       if (exceptionDefinition != null) {
         Node exceptionVariable = exceptionDefinition.definitions.nodes.head;
@@ -4740,7 +4777,7 @@
       Node stackTraceVariable = stackTraceDefinition.definitions.nodes.head;
       VariableElementX stackTraceElement =
           registry.getDefinition(stackTraceVariable);
-      InterfaceType stackTraceType = coreTypes.stackTraceType;
+      ResolutionInterfaceType stackTraceType = commonElements.stackTraceType;
       stackTraceElement.variables.type = stackTraceType;
     }
     return const NoneResult();
diff --git a/pkg/compiler/lib/src/resolution/operators.dart b/pkg/compiler/lib/src/resolution/operators.dart
index 499192f..b5d83d9 100644
--- a/pkg/compiler/lib/src/resolution/operators.dart
+++ b/pkg/compiler/lib/src/resolution/operators.dart
@@ -8,7 +8,11 @@
 import '../universe/call_structure.dart' show CallStructure;
 import '../universe/selector.dart' show Selector, SelectorKind;
 
-enum UnaryOperatorKind { NOT, NEGATE, COMPLEMENT, }
+enum UnaryOperatorKind {
+  NOT,
+  NEGATE,
+  COMPLEMENT,
+}
 
 class UnaryOperator {
   final UnaryOperatorKind kind;
diff --git a/pkg/compiler/lib/src/resolution/registry.dart b/pkg/compiler/lib/src/resolution/registry.dart
index 3784bd9..83edcfe 100644
--- a/pkg/compiler/lib/src/resolution/registry.dart
+++ b/pkg/compiler/lib/src/resolution/registry.dart
@@ -9,7 +9,7 @@
     show Backend, ForeignResolver, NativeRegistry;
 import '../common/resolution.dart' show ResolutionImpact, Target;
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../diagnostics/source_span.dart';
 import '../elements/elements.dart';
 import '../tree/tree.dart';
@@ -230,16 +230,17 @@
   //  Node-to-Type mapping functionality.
   //////////////////////////////////////////////////////////////////////////////
 
-  DartType useType(Node annotation, DartType type) {
+  ResolutionDartType useType(Node annotation, ResolutionDartType type) {
     if (type != null) {
       mapping.setType(annotation, type);
     }
     return type;
   }
 
-  void setType(Node node, DartType type) => mapping.setType(node, type);
+  void setType(Node node, ResolutionDartType type) =>
+      mapping.setType(node, type);
 
-  DartType getType(Node node) => mapping.getType(node);
+  ResolutionDartType getType(Node node) => mapping.getType(node);
 
   //////////////////////////////////////////////////////////////////////////////
   //  Node-to-Constant mapping functionality.
@@ -334,7 +335,7 @@
   }
 
   /// Register checked mode check of [type] if it isn't `dynamic`.
-  void registerCheckedModeCheck(DartType type) {
+  void registerCheckedModeCheck(ResolutionDartType type) {
     if (!type.isDynamic) {
       impactBuilder.registerTypeUse(new TypeUse.checkedModeCheck(type));
     }
@@ -344,19 +345,19 @@
     mapping.addSuperUse(span);
   }
 
-  void registerTypeLiteral(Send node, DartType type) {
+  void registerTypeLiteral(Send node, ResolutionDartType type) {
     mapping.setType(node, type);
     impactBuilder.registerTypeUse(new TypeUse.typeLiteral(type));
   }
 
-  void registerLiteralList(Node node, InterfaceType type,
+  void registerLiteralList(Node node, ResolutionInterfaceType type,
       {bool isConstant, bool isEmpty}) {
     setType(node, type);
     impactBuilder.registerListLiteral(
         new ListLiteralUse(type, isConstant: isConstant, isEmpty: isEmpty));
   }
 
-  void registerMapLiteral(Node node, InterfaceType type,
+  void registerMapLiteral(Node node, ResolutionInterfaceType type,
       {bool isConstant, bool isEmpty}) {
     setType(node, type);
     impactBuilder.registerMapLiteral(
@@ -394,7 +395,7 @@
     return target.defaultSuperclass(element);
   }
 
-  void registerInstantiation(InterfaceType type) {
+  void registerInstantiation(ResolutionInterfaceType type) {
     impactBuilder.registerTypeUse(new TypeUse.instantiation(type));
   }
 
@@ -429,12 +430,12 @@
   }
 
   @override
-  void registerInstantiatedType(InterfaceType type) {
+  void registerInstantiatedType(ResolutionInterfaceType type) {
     registry.registerInstantiation(type);
   }
 
   @override
-  DartType resolveTypeFromString(Node node, String typeName) {
+  ResolutionDartType resolveTypeFromString(Node node, String typeName) {
     return visitor.resolveTypeFromString(node, typeName);
   }
 }
diff --git a/pkg/compiler/lib/src/resolution/resolution.dart b/pkg/compiler/lib/src/resolution/resolution.dart
index d5334f1..b844779 100644
--- a/pkg/compiler/lib/src/resolution/resolution.dart
+++ b/pkg/compiler/lib/src/resolution/resolution.dart
@@ -19,8 +19,8 @@
         ConstructedConstantExpression,
         ErroneousConstantExpression;
 import '../constants/values.dart' show ConstantValue;
-import '../core_types.dart' show CoreClasses, CoreTypes, CommonElements;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart'
     show
@@ -64,22 +64,19 @@
 class ResolverTask extends CompilerTask {
   final ConstantCompiler constantCompiler;
   final Resolution resolution;
-  final OpenWorld world;
 
-  ResolverTask(
-      this.resolution, this.constantCompiler, this.world, Measurer measurer)
+  ResolverTask(this.resolution, this.constantCompiler, Measurer measurer)
       : super(measurer);
 
   String get name => 'Resolver';
 
   DiagnosticReporter get reporter => resolution.reporter;
   Target get target => resolution.target;
-  CoreTypes get coreTypes => resolution.coreTypes;
-  CoreClasses get coreClasses => resolution.coreClasses;
   CommonElements get commonElements => resolution.commonElements;
   ParsingContext get parsingContext => resolution.parsingContext;
   CompilerOptions get options => resolution.options;
   ResolutionEnqueuer get enqueuer => resolution.enqueuer;
+  OpenWorld get world => enqueuer.worldBuilder;
 
   ResolutionImpact resolve(Element element) {
     return measure(() {
@@ -147,7 +144,7 @@
   static void processAsyncMarker(Resolution resolution,
       BaseFunctionElementX element, ResolutionRegistry registry) {
     DiagnosticReporter reporter = resolution.reporter;
-    CoreClasses coreClasses = resolution.coreClasses;
+    CommonElements commonElements = resolution.commonElements;
     FunctionExpression functionExpression = element.node;
     AsyncModifier asyncModifier = functionExpression.asyncModifier;
     if (asyncModifier != null) {
@@ -187,20 +184,22 @@
                 {'modifier': element.asyncMarker});
           }
         }
+        ClassElement cls;
         switch (element.asyncMarker) {
           case AsyncMarker.ASYNC:
             registry.registerFeature(Feature.ASYNC);
-            coreClasses.futureClass.ensureResolved(resolution);
+            cls = commonElements.futureClass;
             break;
           case AsyncMarker.ASYNC_STAR:
             registry.registerFeature(Feature.ASYNC_STAR);
-            coreClasses.streamClass.ensureResolved(resolution);
+            cls = commonElements.streamClass;
             break;
           case AsyncMarker.SYNC_STAR:
             registry.registerFeature(Feature.SYNC_STAR);
-            coreClasses.iterableClass.ensureResolved(resolution);
+            cls = commonElements.iterableClass;
             break;
         }
+        cls?.ensureResolved(resolution);
       }
     }
   }
@@ -313,7 +312,7 @@
           // Ensure the signature of the synthesized element is
           // resolved. This is the only place where the resolver is
           // seeing this element.
-          FunctionType type = element.computeType(resolution);
+          ResolutionFunctionType type = element.computeType(resolution);
           if (!target.isMalformed) {
             registry.registerStaticUse(new StaticUse.superConstructorInvoke(
                 // TODO(johnniwinther): Provide the right call structure for
@@ -369,13 +368,13 @@
       }
       ResolverVisitor visitor = visitorFor(element);
       ResolutionRegistry registry = visitor.registry;
-      // TODO(johnniwinther): Maybe remove this when placeholderCollector migrates
-      // to the backend ast.
+      // TODO(johnniwinther): Maybe remove this when placeholderCollector
+      // migrates to the backend ast.
       registry.defineElement(element.definition, element);
       // TODO(johnniwinther): Share the resolved type between all variables
       // declared in the same declaration.
       if (tree.type != null) {
-        DartType type = visitor.resolveTypeAnnotation(tree.type);
+        ResolutionDartType type = visitor.resolveTypeAnnotation(tree.type);
         assert(invariant(
             element,
             element.variables.type == null ||
@@ -390,7 +389,7 @@
         // Only assign the dynamic type if the element has no known type. This
         // happens for enum fields where the type is known but is not in the
         // synthesized AST.
-        element.variables.type = const DynamicType();
+        element.variables.type = const ResolutionDynamicType();
       } else {
         registry.registerCheckedModeCheck(element.variables.type);
       }
@@ -441,29 +440,32 @@
     });
   }
 
-  DartType resolveTypeAnnotation(Element element, TypeAnnotation annotation) {
-    DartType type = _resolveReturnType(element, annotation);
+  ResolutionDartType resolveTypeAnnotation(
+      Element element, TypeAnnotation annotation) {
+    ResolutionDartType type = _resolveReturnType(element, annotation);
     if (type.isVoid) {
       reporter.reportErrorMessage(annotation, MessageKind.VOID_NOT_ALLOWED);
     }
     return type;
   }
 
-  DartType _resolveReturnType(Element element, TypeAnnotation annotation) {
-    if (annotation == null) return const DynamicType();
-    DartType result = visitorFor(element).resolveTypeAnnotation(annotation);
+  ResolutionDartType _resolveReturnType(
+      Element element, TypeAnnotation annotation) {
+    if (annotation == null) return const ResolutionDynamicType();
+    ResolutionDartType result =
+        visitorFor(element).resolveTypeAnnotation(annotation);
     assert(invariant(annotation, result != null,
         message: "No type computed for $annotation."));
     if (result == null) {
       // TODO(karklose): warning.
-      return const DynamicType();
+      return const ResolutionDynamicType();
     }
     return result;
   }
 
   void resolveRedirectionChain(ConstructorElement constructor, Spannable node) {
     ConstructorElement target = constructor;
-    DartType targetType;
+    ResolutionDartType targetType;
     List<ConstructorElement> seen = new List<ConstructorElement>();
     bool isMalformed = false;
     // Follow the chain of redirections and check for cycles.
@@ -518,7 +520,8 @@
           message: 'No ResolvedAst for $factory.'));
       FunctionExpression functionNode = resolvedAst.node;
       RedirectingFactoryBody redirectionNode = resolvedAst.body;
-      DartType factoryType = resolvedAst.elements.getType(redirectionNode);
+      ResolutionDartType factoryType =
+          resolvedAst.elements.getType(redirectionNode);
       if (!factoryType.isDynamic) {
         targetType = targetType.substByContext(factoryType);
       }
@@ -540,12 +543,13 @@
             from, MessageKind.CYCLIC_CLASS_HIERARCHY, {'className': cls.name});
         cls.supertypeLoadState = STATE_DONE;
         cls.hasIncompleteHierarchy = true;
-        cls.allSupertypesAndSelf = coreClasses.objectClass.allSupertypesAndSelf
+        ClassElement objectClass = commonElements.objectClass;
+        cls.allSupertypesAndSelf = objectClass.allSupertypesAndSelf
             .extendClass(cls.computeType(resolution));
         cls.supertype = cls.allSupertypes.head;
         assert(invariant(from, cls.supertype != null,
             message: 'Missing supertype on cyclic class $cls.'));
-        cls.interfaces = const Link<DartType>();
+        cls.interfaces = const Link<ResolutionDartType>();
         return;
       }
       cls.supertypeLoadState = STATE_STARTED;
@@ -1100,10 +1104,10 @@
               annotation.constant = constant;
 
               constantCompiler.evaluate(annotation.constant);
-              // TODO(johnniwinther): Register the relation between the annotation
-              // and the annotated element instead. This will allow the backend to
-              // retrieve the backend constant and only register metadata on the
-              // elements for which it is needed. (Issue 17732).
+              // TODO(johnniwinther): Register the relation between the
+              // annotation and the annotated element instead. This will allow
+              // the backend to retrieve the backend constant and only register
+              // metadata on the elements for which it is needed. (Issue 17732).
               annotation.resolutionState = STATE_DONE;
             }));
   }
diff --git a/pkg/compiler/lib/src/resolution/resolution_result.dart b/pkg/compiler/lib/src/resolution/resolution_result.dart
index b034712..fd7576f 100644
--- a/pkg/compiler/lib/src/resolution/resolution_result.dart
+++ b/pkg/compiler/lib/src/resolution/resolution_result.dart
@@ -5,12 +5,19 @@
 library dart2js.resolution.result;
 
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../tree/tree.dart';
 import '../universe/call_structure.dart' show CallStructure;
 
-enum ResultKind { NONE, ELEMENT, TYPE, ASSERT, CONSTANT, PREFIX, }
+enum ResultKind {
+  NONE,
+  ELEMENT,
+  TYPE,
+  ASSERT,
+  CONSTANT,
+  PREFIX,
+}
 
 /// The result of resolving a node.
 abstract class ResolutionResult {
@@ -25,7 +32,7 @@
   ResultKind get kind;
   Node get node => null;
   Element get element => null;
-  DartType get type => null;
+  ResolutionDartType get type => null;
   ConstantExpression get constant => null;
   bool get isConstant => false;
 }
@@ -60,9 +67,10 @@
   String toString() => 'ElementResult($element)';
 }
 
-/// The result for the resolution of a node that points to an [DartType].
+/// The result for the resolution of a node that points to an
+/// [ResolutionDartType].
 class TypeResult extends ResolutionResult {
-  final DartType type;
+  final ResolutionDartType type;
 
   TypeResult(this.type) {
     assert(type != null);
diff --git a/pkg/compiler/lib/src/resolution/scope.dart b/pkg/compiler/lib/src/resolution/scope.dart
index e03304e..380b764 100644
--- a/pkg/compiler/lib/src/resolution/scope.dart
+++ b/pkg/compiler/lib/src/resolution/scope.dart
@@ -4,7 +4,7 @@
 
 library dart2js.resolution.scope;
 
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 
 abstract class Scope {
@@ -66,7 +66,7 @@
 /// available, but where locally declared and inherited members are not
 /// available.
 abstract class TypeVariablesScope extends NestedScope {
-  List<DartType> get typeVariables;
+  List<ResolutionDartType> get typeVariables;
 
   TypeVariablesScope(Scope parent) : super(parent) {
     assert(parent != null);
@@ -77,7 +77,7 @@
   }
 
   Element lookupTypeVariable(String name) {
-    for (TypeVariableType type in typeVariables) {
+    for (ResolutionTypeVariableType type in typeVariables) {
       if (type.name == name) {
         return type.element;
       }
@@ -99,7 +99,7 @@
   final GenericElement element;
 
   @override
-  List<DartType> get typeVariables => element.typeVariables;
+  List<ResolutionDartType> get typeVariables => element.typeVariables;
 
   TypeDeclarationScope(Scope parent, this.element) : super(parent);
 
diff --git a/pkg/compiler/lib/src/resolution/semantic_visitor.dart b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
index c4fe79a..304b852 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor.dart
@@ -6,7 +6,7 @@
 
 import '../common.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../tree/tree.dart';
 import '../universe/call_structure.dart' show CallStructure;
@@ -1431,7 +1431,7 @@
   ///     class C {}
   ///     m() => expression is C;
   ///
-  R visitIs(Send node, Node expression, DartType type, A arg);
+  R visitIs(Send node, Node expression, ResolutionDartType type, A arg);
 
   /// Is not test of [expression] against [type].
   ///
@@ -1440,7 +1440,7 @@
   ///     class C {}
   ///     m() => expression is! C;
   ///
-  R visitIsNot(Send node, Node expression, DartType type, A arg);
+  R visitIsNot(Send node, Node expression, ResolutionDartType type, A arg);
 
   /// As cast of [expression] to [type].
   ///
@@ -1449,7 +1449,7 @@
   ///     class C {}
   ///     m() => expression as C;
   ///
-  R visitAs(Send node, Node expression, DartType type, A arg);
+  R visitAs(Send node, Node expression, ResolutionDartType type, A arg);
 
   /// Compound assignment expression of [rhs] with [operator] of the property on
   /// [receiver] whose getter and setter are defined by [getterSelector] and
@@ -2228,8 +2228,8 @@
 
   /// If-null assignment expression of [rhs] to the type literal for the type
   /// variable [element]. That is, [rhs] is only evaluated and assigned, if
-  /// the value is of the [element] is `null`. The behavior is thus equivalent to
-  /// a type literal access.
+  /// the value is of the [element] is `null`. The behavior is thus equivalent
+  /// to a type literal access.
   ///
   /// For instance:
   ///
@@ -3867,7 +3867,7 @@
   R visitGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg);
@@ -3888,7 +3888,7 @@
   R visitRedirectingGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg);
@@ -3908,7 +3908,7 @@
   R visitFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg);
@@ -3932,9 +3932,9 @@
   R visitRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       ConstructorElement effectiveTarget,
-      InterfaceType effectiveTargetType,
+      ResolutionInterfaceType effectiveTargetType,
       NodeList arguments,
       CallStructure callStructure,
       A arg);
@@ -3953,7 +3953,7 @@
   // TODO(johnniwinther): Change [type] to [InterfaceType] when is it not
   // `dynamic`.
   R visitUnresolvedConstructorInvoke(NewExpression node, Element constructor,
-      DartType type, NodeList arguments, Selector selector, A arg);
+      ResolutionDartType type, NodeList arguments, Selector selector, A arg);
 
   /// Invocation of a constructor on an unresolved [type] with [arguments].
   ///
@@ -3966,7 +3966,7 @@
   // TODO(johnniwinther): Change [type] to [MalformedType] when is it not
   // `dynamic`.
   R visitUnresolvedClassConstructorInvoke(NewExpression node, Element element,
-      DartType type, NodeList arguments, Selector selector, A arg);
+      ResolutionDartType type, NodeList arguments, Selector selector, A arg);
 
   /// Constant invocation of a non-constant constructor.
   ///
@@ -3977,8 +3977,13 @@
   ///     }
   ///     m() => const C(true, 42);
   ///
-  R errorNonConstantConstructorInvoke(NewExpression node, Element element,
-      DartType type, NodeList arguments, CallStructure callStructure, A arg);
+  R errorNonConstantConstructorInvoke(
+      NewExpression node,
+      Element element,
+      ResolutionDartType type,
+      NodeList arguments,
+      CallStructure callStructure,
+      A arg);
 
   /// Invocation of a constructor on an abstract [type] with [arguments].
   ///
@@ -3991,7 +3996,7 @@
   R visitAbstractClassConstructorInvoke(
       NewExpression node,
       ConstructorElement element,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg);
@@ -4012,7 +4017,7 @@
   R visitUnresolvedRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg);
@@ -4029,7 +4034,7 @@
   R visitConstructorIncompatibleInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg);
@@ -4609,7 +4614,7 @@
       FunctionExpression node,
       ConstructorElement constructor,
       NodeList parameters,
-      InterfaceType redirectionType,
+      ResolutionInterfaceType redirectionType,
       ConstructorElement redirectionTarget,
       A arg);
 
@@ -4653,7 +4658,7 @@
   R visitSuperConstructorInvoke(
       Send node,
       ConstructorElement superConstructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg);
@@ -4671,7 +4676,7 @@
   ///     }
   ///
   R visitImplicitSuperConstructorInvoke(FunctionExpression node,
-      ConstructorElement superConstructor, InterfaceType type, A arg);
+      ConstructorElement superConstructor, ResolutionInterfaceType type, A arg);
 
   /// An super constructor invocation of an unresolved with [arguments] as
   /// found in generative constructor initializers.
diff --git a/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart b/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
index b9ebd0b..d46a6ef 100644
--- a/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
+++ b/pkg/compiler/lib/src/resolution/semantic_visitor_mixins.dart
@@ -26,8 +26,13 @@
   }
 
   @override
-  R errorNonConstantConstructorInvoke(NewExpression node, Element element,
-      DartType type, NodeList arguments, CallStructure callStructure, A arg) {
+  R errorNonConstantConstructorInvoke(
+      NewExpression node,
+      Element element,
+      ResolutionDartType type,
+      NodeList arguments,
+      CallStructure callStructure,
+      A arg) {
     return bulkHandleError(node, null, arg);
   }
 
@@ -1913,17 +1918,17 @@
 abstract class BaseBulkMixin<R, A>
     implements SemanticSendVisitor<R, A>, BulkHandle<R, A> {
   @override
-  R visitAs(Send node, Node expression, DartType type, A arg) {
+  R visitAs(Send node, Node expression, ResolutionDartType type, A arg) {
     return bulkHandleNode(node, 'As cast `#` unhandled.', arg);
   }
 
   @override
-  R visitIs(Send node, Node expression, DartType type, A arg) {
+  R visitIs(Send node, Node expression, ResolutionDartType type, A arg) {
     return bulkHandleNode(node, 'Is test `#` unhandled.', arg);
   }
 
   @override
-  R visitIsNot(Send node, Node expression, DartType type, A arg) {
+  R visitIsNot(Send node, Node expression, ResolutionDartType type, A arg) {
     return bulkHandleNode(node, 'Is not test `#` unhandled.', arg);
   }
 
@@ -2196,7 +2201,7 @@
   R visitAbstractClassConstructorInvoke(
       NewExpression node,
       ConstructorElement element,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -2231,7 +2236,7 @@
   R visitConstructorIncompatibleInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -2242,7 +2247,7 @@
   R visitGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -2253,7 +2258,7 @@
   R visitRedirectingGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -2264,7 +2269,7 @@
   R visitFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -2275,9 +2280,9 @@
   R visitRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       ConstructorElement effectiveTarget,
-      InterfaceType effectiveTargetType,
+      ResolutionInterfaceType effectiveTargetType,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -2286,13 +2291,13 @@
 
   @override
   R visitUnresolvedClassConstructorInvoke(NewExpression node, Element element,
-      DartType type, NodeList arguments, Selector selector, A arg) {
+      ResolutionDartType type, NodeList arguments, Selector selector, A arg) {
     return bulkHandleNew(node, arg);
   }
 
   @override
   R visitUnresolvedConstructorInvoke(NewExpression node, Element constructor,
-      DartType type, NodeList arguments, Selector selector, A arg) {
+      ResolutionDartType type, NodeList arguments, Selector selector, A arg) {
     return bulkHandleNew(node, arg);
   }
 
@@ -2300,7 +2305,7 @@
   R visitUnresolvedRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -2434,7 +2439,7 @@
       FunctionExpression node,
       ConstructorElement constructor,
       NodeList parameters,
-      InterfaceType redirectionType,
+      ResolutionInterfaceType redirectionType,
       ConstructorElement redirectionTarget,
       A arg) {
     return bulkHandleConstructorDeclaration(node, arg);
@@ -2489,7 +2494,7 @@
   R visitSuperConstructorInvoke(
       Send node,
       ConstructorElement superConstructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -2497,8 +2502,11 @@
   }
 
   @override
-  R visitImplicitSuperConstructorInvoke(FunctionExpression node,
-      ConstructorElement superConstructor, InterfaceType type, A arg) {
+  R visitImplicitSuperConstructorInvoke(
+      FunctionExpression node,
+      ConstructorElement superConstructor,
+      ResolutionInterfaceType type,
+      A arg) {
     return bulkHandleInitializer(node, arg);
   }
 
@@ -3019,7 +3027,7 @@
   }
 
   @override
-  R visitAs(Send node, Node expression, DartType type, A arg) {
+  R visitAs(Send node, Node expression, ResolutionDartType type, A arg) {
     apply(expression, arg);
     return null;
   }
@@ -3235,13 +3243,13 @@
   }
 
   @override
-  R visitIs(Send node, Node expression, DartType type, A arg) {
+  R visitIs(Send node, Node expression, ResolutionDartType type, A arg) {
     apply(expression, arg);
     return null;
   }
 
   @override
-  R visitIsNot(Send node, Node expression, DartType type, A arg) {
+  R visitIsNot(Send node, Node expression, ResolutionDartType type, A arg) {
     apply(expression, arg);
     return null;
   }
@@ -4427,7 +4435,7 @@
   R visitConstructorIncompatibleInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -4439,7 +4447,7 @@
   R visitUnresolvedClassConstructorInvoke(
       NewExpression node,
       Element constructor,
-      DartType type,
+      ResolutionDartType type,
       NodeList arguments,
       Selector selector,
       A arg) {
@@ -4449,7 +4457,7 @@
 
   @override
   R visitUnresolvedConstructorInvoke(NewExpression node, Element constructor,
-      DartType type, NodeList arguments, Selector selector, A arg) {
+      ResolutionDartType type, NodeList arguments, Selector selector, A arg) {
     apply(arguments, arg);
     return null;
   }
@@ -4458,7 +4466,7 @@
   R visitFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -4470,7 +4478,7 @@
   R visitGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -4482,9 +4490,9 @@
   R visitRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       ConstructorElement effectiveTarget,
-      InterfaceType effectiveTargetType,
+      ResolutionInterfaceType effectiveTargetType,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -4496,7 +4504,7 @@
   R visitRedirectingGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -4508,7 +4516,7 @@
   R visitAbstractClassConstructorInvoke(
       NewExpression node,
       ConstructorElement element,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -4520,7 +4528,7 @@
   R visitUnresolvedRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -4529,8 +4537,13 @@
   }
 
   @override
-  R errorNonConstantConstructorInvoke(NewExpression node, Element element,
-      DartType type, NodeList arguments, CallStructure callStructure, A arg) {
+  R errorNonConstantConstructorInvoke(
+      NewExpression node,
+      Element element,
+      ResolutionDartType type,
+      NodeList arguments,
+      CallStructure callStructure,
+      A arg) {
     apply(arguments, arg);
     return null;
   }
@@ -4934,7 +4947,7 @@
       FunctionExpression node,
       ConstructorElement constructor,
       NodeList parameters,
-      InterfaceType redirectionType,
+      ResolutionInterfaceType redirectionType,
       ConstructorElement redirectionTarget,
       A arg) {
     applyParameters(parameters, arg);
@@ -4965,7 +4978,7 @@
   R visitSuperConstructorInvoke(
       Send node,
       ConstructorElement superConstructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -4974,8 +4987,11 @@
   }
 
   @override
-  R visitImplicitSuperConstructorInvoke(FunctionExpression node,
-      ConstructorElement superConstructor, InterfaceType type, A arg) {
+  R visitImplicitSuperConstructorInvoke(
+      FunctionExpression node,
+      ConstructorElement superConstructor,
+      ResolutionInterfaceType type,
+      A arg) {
     return null;
   }
 
@@ -8217,13 +8233,18 @@
 /// handled uniformly.
 abstract class BaseImplementationOfNewMixin<R, A>
     implements SemanticSendVisitor<R, A> {
-  R handleConstructorInvoke(NewExpression node, ConstructorElement constructor,
-      DartType type, NodeList arguments, CallStructure callStructure, A arg);
+  R handleConstructorInvoke(
+      NewExpression node,
+      ConstructorElement constructor,
+      ResolutionDartType type,
+      NodeList arguments,
+      CallStructure callStructure,
+      A arg);
 
   R visitGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -8235,7 +8256,7 @@
   R visitRedirectingGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -8247,7 +8268,7 @@
   R visitFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -8259,9 +8280,9 @@
   R visitRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       ConstructorElement effectiveTarget,
-      InterfaceType effectiveTargetType,
+      ResolutionInterfaceType effectiveTargetType,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -8271,14 +8292,14 @@
 
   @override
   R visitUnresolvedConstructorInvoke(NewExpression node, Element constructor,
-      DartType type, NodeList arguments, Selector selector, A arg) {
+      ResolutionDartType type, NodeList arguments, Selector selector, A arg) {
     return handleConstructorInvoke(
         node, constructor, type, arguments, selector.callStructure, arg);
   }
 
   @override
   R visitUnresolvedClassConstructorInvoke(NewExpression node, Element element,
-      DartType type, NodeList arguments, Selector selector, A arg) {
+      ResolutionDartType type, NodeList arguments, Selector selector, A arg) {
     return handleConstructorInvoke(
         node, element, type, arguments, selector.callStructure, arg);
   }
@@ -8287,7 +8308,7 @@
   R visitAbstractClassConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
@@ -8299,7 +8320,7 @@
   R visitUnresolvedRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       A arg) {
diff --git a/pkg/compiler/lib/src/resolution/send_resolver.dart b/pkg/compiler/lib/src/resolution/send_resolver.dart
index d53d4ec..0d44a31 100644
--- a/pkg/compiler/lib/src/resolution/send_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/send_resolver.dart
@@ -6,7 +6,7 @@
 
 import '../common.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../tree/tree.dart';
 import 'semantic_visitor.dart';
@@ -58,7 +58,7 @@
 
 class RedirectingFactoryConstructorDeclStructure<R, A>
     extends DeclStructure<R, A> {
-  InterfaceType redirectionTargetType;
+  ResolutionInterfaceType redirectionTargetType;
   ConstructorElement redirectionTarget;
 
   RedirectingFactoryConstructorDeclStructure(ConstructorElement constructor,
@@ -234,7 +234,7 @@
     if (!constructorInvocationSeen) {
       ConstructorElement currentConstructor = elements[node];
       ClassElement currentClass = currentConstructor.enclosingClass;
-      InterfaceType supertype = currentClass.supertype;
+      ResolutionInterfaceType supertype = currentClass.supertype;
       if (supertype != null) {
         ClassElement superclass = supertype.element;
         ConstructorElement superConstructor =
diff --git a/pkg/compiler/lib/src/resolution/send_structure.dart b/pkg/compiler/lib/src/resolution/send_structure.dart
index 52bf4dd..799b0a2 100644
--- a/pkg/compiler/lib/src/resolution/send_structure.dart
+++ b/pkg/compiler/lib/src/resolution/send_structure.dart
@@ -6,7 +6,7 @@
 
 import '../common.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../resolution/tree_elements.dart' show TreeElements;
 import '../tree/tree.dart';
@@ -112,7 +112,7 @@
 /// The structure for a [Send] of the form `a is T`.
 class IsStructure<R, A> implements SendStructure<R, A> {
   /// The type that the expression is tested against.
-  final DartType type;
+  final ResolutionDartType type;
 
   IsStructure(this.type);
 
@@ -129,7 +129,7 @@
 /// The structure for a [Send] of the form `a is! T`.
 class IsNotStructure<R, A> implements SendStructure<R, A> {
   /// The type that the expression is tested against.
-  final DartType type;
+  final ResolutionDartType type;
 
   IsNotStructure(this.type);
 
@@ -146,7 +146,7 @@
 /// The structure for a [Send] of the form `a as T`.
 class AsStructure<R, A> implements SendStructure<R, A> {
   /// The type that the expression is cast to.
-  final DartType type;
+  final ResolutionDartType type;
 
   AsStructure(this.type);
 
@@ -2059,7 +2059,11 @@
   }
 }
 
-enum NewStructureKind { NEW_INVOKE, CONST_INVOKE, LATE_CONST, }
+enum NewStructureKind {
+  NEW_INVOKE,
+  CONST_INVOKE,
+  LATE_CONST,
+}
 
 /// The structure for a [NewExpression] of a new invocation.
 abstract class NewStructure<R, A> implements SemanticSendStructure<R, A> {
@@ -2110,10 +2114,9 @@
                 arg);
           }
           ConstructorElement effectiveTarget = constructor.effectiveTarget;
-          InterfaceType effectiveTargetType =
+          ResolutionInterfaceType effectiveTargetType =
               constructor.computeEffectiveTargetType(semantics.type);
-          if (callStructure
-              .signatureApplies(effectiveTarget.functionSignature)) {
+          if (callStructure.signatureApplies(effectiveTarget.type)) {
             return visitor.visitRedirectingFactoryConstructorInvoke(
                 node,
                 semantics.element,
@@ -2133,7 +2136,7 @@
                 arg);
           }
         }
-        if (callStructure.signatureApplies(constructor.functionSignature)) {
+        if (callStructure.signatureApplies(constructor.type)) {
           return visitor.visitFactoryConstructorInvoke(node, constructor,
               semantics.type, node.send.argumentsNode, callStructure, arg);
         }
@@ -2234,7 +2237,7 @@
   NewStructure resolve(NewExpression node) {
     Element element = elements[node.send];
     Selector selector = elements.getSelector(node.send);
-    DartType type = elements.getType(node);
+    ResolutionDartType type = elements.getType(node);
     ConstantExpression constant = elements.getConstant(node);
     if (element.isMalformed ||
         constant == null ||
@@ -2271,7 +2274,7 @@
   R dispatch(SemanticSendVisitor<R, A> visitor, NewExpression node, A arg) {
     Element element = elements[node.send];
     Selector selector = elements.getSelector(node.send);
-    DartType type = elements.getType(node);
+    ResolutionDartType type = elements.getType(node);
     ConstantExpression constant = elements.getConstant(node);
     if (element.isMalformed ||
         constant == null ||
@@ -2470,7 +2473,7 @@
 class SuperConstructorInvokeStructure<R, A> extends InitializerStructure<R, A> {
   final Send node;
   final ConstructorElement constructor;
-  final InterfaceType type;
+  final ResolutionInterfaceType type;
   final CallStructure callStructure;
 
   SuperConstructorInvokeStructure(
@@ -2488,7 +2491,7 @@
     extends InitializerStructure<R, A> {
   final FunctionExpression node;
   final ConstructorElement constructor;
-  final InterfaceType type;
+  final ResolutionInterfaceType type;
 
   ImplicitSuperConstructorInvokeStructure(
       this.node, this.constructor, this.type);
diff --git a/pkg/compiler/lib/src/resolution/signatures.dart b/pkg/compiler/lib/src/resolution/signatures.dart
index 31673c2..07f3bba 100644
--- a/pkg/compiler/lib/src/resolution/signatures.dart
+++ b/pkg/compiler/lib/src/resolution/signatures.dart
@@ -6,7 +6,7 @@
 
 import '../common.dart';
 import '../common/resolution.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart'
     show
@@ -148,7 +148,7 @@
         if (fieldElement != null) {
           element.typeCache = fieldElement.computeType(resolution);
         } else {
-          element.typeCache = const DynamicType();
+          element.typeCache = const ResolutionDynamicType();
         }
       }
     }
@@ -306,12 +306,17 @@
       bool isFunctionExpression: false}) {
     DiagnosticReporter reporter = resolution.reporter;
 
-    List<DartType> createTypeVariables(NodeList typeVariableNodes) {
-      if (typeVariableNodes == null) return const <DartType>[];
+    List<ResolutionDartType> createTypeVariables(NodeList typeVariableNodes) {
+      if (element.isPatch) {
+        FunctionTypedElement origin = element.origin;
+        origin.computeType(resolution);
+        return origin.typeVariables;
+      }
+      if (typeVariableNodes == null) return const <ResolutionDartType>[];
 
       // Create the types and elements corresponding to [typeVariableNodes].
       Link<Node> nodes = typeVariableNodes.nodes;
-      List<DartType> arguments =
+      List<ResolutionDartType> arguments =
           new List.generate(nodes.slowLength(), (int index) {
         TypeVariable node = nodes.head;
         String variableName = node.name.source;
@@ -321,8 +326,8 @@
         // GENERIC_METHODS: When method type variables are implemented fully we
         // must resolve the actual bounds; currently we just claim that
         // every method type variable has upper bound [dynamic].
-        variableElement.boundCache = const DynamicType();
-        TypeVariableType variableType =
+        variableElement.boundCache = const ResolutionDynamicType();
+        ResolutionTypeVariableType variableType =
             new MethodTypeVariableType(variableElement);
         variableElement.typeCache = variableType;
         return variableType;
@@ -330,7 +335,8 @@
       return arguments;
     }
 
-    List<DartType> typeVariableTypes = createTypeVariables(typeVariables);
+    List<ResolutionDartType> typeVariableTypes =
+        createTypeVariables(typeVariables);
     scope = new FunctionSignatureBuildingScope(scope, typeVariableTypes);
     SignatureResolver visitor = new SignatureResolver(
         resolution, element, scope, registry,
@@ -365,7 +371,7 @@
       requiredParameterCount = parametersBuilder.length;
       parameters = parametersBuilder.toList();
     }
-    DartType returnType;
+    ResolutionDartType returnType;
     if (element.isFactoryConstructor) {
       returnType = element.enclosingClass.thisType;
       // Because there is no type annotation for the return type of
@@ -384,13 +390,19 @@
           returnType = visitor.resolveReturnType(returnNode);
           break;
         case AsyncMarker.SYNC_STAR:
-          returnType = resolution.coreTypes.iterableType();
+          ResolutionInterfaceType iterableType =
+              resolution.commonElements.iterableType();
+          returnType = iterableType;
           break;
         case AsyncMarker.ASYNC:
-          returnType = resolution.coreTypes.futureType();
+          ResolutionInterfaceType futureType =
+              resolution.commonElements.futureType();
+          returnType = futureType;
           break;
         case AsyncMarker.ASYNC_STAR:
-          returnType = resolution.coreTypes.streamType();
+          ResolutionInterfaceType streamType =
+              resolution.commonElements.streamType();
+          returnType = streamType;
           break;
       }
     }
@@ -403,13 +415,15 @@
             formalParameters, MessageKind.ILLEGAL_SETTER_FORMALS);
       }
     }
-    LinkBuilder<DartType> parameterTypes = new LinkBuilder<DartType>();
+    LinkBuilder<ResolutionDartType> parameterTypes =
+        new LinkBuilder<ResolutionDartType>();
     for (FormalElement parameter in parameters) {
       parameterTypes.addLast(parameter.type);
     }
-    List<DartType> optionalParameterTypes = const <DartType>[];
+    List<ResolutionDartType> optionalParameterTypes =
+        const <ResolutionDartType>[];
     List<String> namedParameters = const <String>[];
-    List<DartType> namedParameterTypes = const <DartType>[];
+    List<ResolutionDartType> namedParameterTypes = const <ResolutionDartType>[];
     List<Element> orderedOptionalParameters =
         visitor.optionalParameters.toList();
     if (visitor.optionalParametersAreNamed) {
@@ -418,8 +432,8 @@
         return a.name.compareTo(b.name);
       });
       LinkBuilder<String> namedParametersBuilder = new LinkBuilder<String>();
-      LinkBuilder<DartType> namedParameterTypesBuilder =
-          new LinkBuilder<DartType>();
+      LinkBuilder<ResolutionDartType> namedParameterTypesBuilder =
+          new LinkBuilder<ResolutionDartType>();
       for (FormalElement parameter in orderedOptionalParameters) {
         namedParametersBuilder.addLast(parameter.name);
         namedParameterTypesBuilder.addLast(parameter.type);
@@ -429,15 +443,15 @@
           namedParameterTypesBuilder.toLink().toList(growable: false);
     } else {
       // TODO(karlklose); replace when [visitor.optinalParameters] is a [List].
-      LinkBuilder<DartType> optionalParameterTypesBuilder =
-          new LinkBuilder<DartType>();
+      LinkBuilder<ResolutionDartType> optionalParameterTypesBuilder =
+          new LinkBuilder<ResolutionDartType>();
       for (FormalElement parameter in visitor.optionalParameters) {
         optionalParameterTypesBuilder.addLast(parameter.type);
       }
       optionalParameterTypes =
           optionalParameterTypesBuilder.toLink().toList(growable: false);
     }
-    FunctionType type = new FunctionType(
+    ResolutionFunctionType type = new ResolutionFunctionType(
         element.declaration,
         returnType,
         parameterTypes.toLink().toList(growable: false),
@@ -455,19 +469,19 @@
         type: type);
   }
 
-  DartType resolveTypeAnnotation(TypeAnnotation annotation) {
-    DartType type = resolveReturnType(annotation);
+  ResolutionDartType resolveTypeAnnotation(TypeAnnotation annotation) {
+    ResolutionDartType type = resolveReturnType(annotation);
     if (type.isVoid) {
       reporter.reportErrorMessage(annotation, MessageKind.VOID_NOT_ALLOWED);
     }
     return type;
   }
 
-  DartType resolveReturnType(TypeAnnotation annotation) {
-    if (annotation == null) return const DynamicType();
-    DartType result = resolver.resolveTypeAnnotation(annotation);
+  ResolutionDartType resolveReturnType(TypeAnnotation annotation) {
+    if (annotation == null) return const ResolutionDynamicType();
+    ResolutionDartType result = resolver.resolveTypeAnnotation(annotation);
     if (result == null) {
-      return const DynamicType();
+      return const ResolutionDynamicType();
     }
     return result;
   }
@@ -477,7 +491,7 @@
 /// variables of the function signature itself when its signature is analyzed.
 class FunctionSignatureBuildingScope extends TypeVariablesScope {
   @override
-  final List<DartType> typeVariables;
+  final List<ResolutionDartType> typeVariables;
 
   FunctionSignatureBuildingScope(Scope parent, this.typeVariables)
       : super(parent);
diff --git a/pkg/compiler/lib/src/resolution/tree_elements.dart b/pkg/compiler/lib/src/resolution/tree_elements.dart
index fd0080f..df32daa 100644
--- a/pkg/compiler/lib/src/resolution/tree_elements.dart
+++ b/pkg/compiler/lib/src/resolution/tree_elements.dart
@@ -6,7 +6,7 @@
 
 import '../common.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../diagnostics/source_span.dart';
 import '../elements/elements.dart';
 import '../tree/tree.dart';
@@ -22,7 +22,7 @@
   void forEachConstantNode(f(Node n, ConstantExpression c));
 
   Element operator [](Node node);
-  Map<Node, DartType> get typesCache;
+  Map<Node, ResolutionDartType> get typesCache;
 
   /// Returns the [SendStructure] that describes the semantics of [node].
   SendStructure getSendStructure(Send node);
@@ -34,7 +34,7 @@
   Selector getSelector(Node node);
   Selector getGetterSelectorInComplexSendSet(SendSet node);
   Selector getOperatorSelectorInComplexSendSet(SendSet node);
-  DartType getType(Node node);
+  ResolutionDartType getType(Node node);
 
   /// Returns the for-in loop variable for [node].
   Element getForInVariable(ForIn node);
@@ -57,7 +57,7 @@
   bool isTypeLiteral(Send node);
 
   /// Returns the type that the type literal [node] refers to.
-  DartType getTypeLiteralType(Send node);
+  ResolutionDartType getTypeLiteralType(Send node);
 
   /// Returns a list of nodes that potentially mutate [element] anywhere in its
   /// scope.
@@ -94,10 +94,11 @@
 class TreeElementMapping extends TreeElements {
   final AnalyzableElement analyzedElement;
   Map<Spannable, Selector> _selectors;
-  Map<Node, DartType> _types;
+  Map<Node, ResolutionDartType> _types;
 
-  Map<Node, DartType> _typesCache;
-  Map<Node, DartType> get typesCache => _typesCache ??= <Node, DartType>{};
+  Map<Node, ResolutionDartType> _typesCache;
+  Map<Node, ResolutionDartType> get typesCache =>
+      _typesCache ??= <Node, ResolutionDartType>{};
 
   Setlet<SourceSpan> _superUses;
   Map<Node, ConstantExpression> _constants;
@@ -176,15 +177,15 @@
     _newStructureMap[node] = newStructure;
   }
 
-  void setType(Node node, DartType type) {
+  void setType(Node node, ResolutionDartType type) {
     if (_types == null) {
-      _types = new Maplet<Node, DartType>();
+      _types = new Maplet<Node, ResolutionDartType>();
     }
     _types[node] = type;
   }
 
   @override
-  DartType getType(Node node) => _types != null ? _types[node] : null;
+  ResolutionDartType getType(Node node) => _types != null ? _types[node] : null;
 
   @override
   Iterable<SourceSpan> get superUses {
@@ -260,7 +261,7 @@
   }
 
   @override
-  DartType getTypeLiteralType(Send node) {
+  ResolutionDartType getTypeLiteralType(Send node) {
     return getType(node);
   }
 
@@ -361,9 +362,7 @@
   }
 
   void defineTarget(Node node, JumpTarget target) {
-    if (_definedTargets == null) {
-      _definedTargets = new Maplet<Node, JumpTarget>();
-    }
+    _definedTargets ??= new Maplet<Node, JumpTarget>();
     _definedTargets[node] = target;
   }
 
@@ -382,9 +381,7 @@
   }
 
   void registerTargetOf(GotoStatement node, JumpTarget target) {
-    if (_usedTargets == null) {
-      _usedTargets = new Maplet<GotoStatement, JumpTarget>();
-    }
+    _usedTargets ??= new Maplet<GotoStatement, JumpTarget>();
     _usedTargets[node] = target;
   }
 
@@ -394,9 +391,7 @@
   }
 
   void defineLabel(Label label, LabelDefinition target) {
-    if (_definedLabels == null) {
-      _definedLabels = new Maplet<Label, LabelDefinition>();
-    }
+    _definedLabels ??= new Maplet<Label, LabelDefinition>();
     _definedLabels[label] = target;
   }
 
diff --git a/pkg/compiler/lib/src/resolution/type_resolver.dart b/pkg/compiler/lib/src/resolution/type_resolver.dart
index bc9f2e5..318e748 100644
--- a/pkg/compiler/lib/src/resolution/type_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/type_resolver.dart
@@ -6,7 +6,7 @@
 
 import '../common.dart';
 import '../common/resolution.dart' show Resolution;
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart'
     show
         AmbiguousElement,
@@ -63,17 +63,18 @@
     return element;
   }
 
-  DartType resolveTypeAnnotation(MappingVisitor visitor, TypeAnnotation node,
+  ResolutionDartType resolveTypeAnnotation(
+      MappingVisitor visitor, TypeAnnotation node,
       {bool malformedIsError: false, bool deferredIsMalformed: true}) {
     ResolutionRegistry registry = visitor.registry;
 
     Identifier typeName;
-    DartType type;
+    ResolutionDartType type;
 
-    DartType checkNoTypeArguments(DartType type) {
-      List<DartType> arguments = new List<DartType>();
-      bool hasTypeArgumentMismatch =
-          resolveTypeArguments(visitor, node, const <DartType>[], arguments);
+    ResolutionDartType checkNoTypeArguments(ResolutionDartType type) {
+      List<ResolutionDartType> arguments = new List<ResolutionDartType>();
+      bool hasTypeArgumentMismatch = resolveTypeArguments(
+          visitor, node, const <ResolutionDartType>[], arguments);
       if (hasTypeArgumentMismatch) {
         return new MalformedType(
             new ErroneousElementX(MessageKind.TYPE_ARGUMENT_COUNT_MISMATCH,
@@ -93,12 +94,12 @@
     } else {
       typeName = node.typeName.asIdentifier();
       if (identical(typeName.source, 'void')) {
-        type = const VoidType();
+        type = const ResolutionVoidType();
         checkNoTypeArguments(type);
         registry.useType(node, type);
         return type;
       } else if (identical(typeName.source, 'dynamic')) {
-        type = const DynamicType();
+        type = const ResolutionDynamicType();
         checkNoTypeArguments(type);
         registry.useType(node, type);
         return type;
@@ -108,9 +109,9 @@
     Element element = resolveTypeName(prefixName, typeName, visitor.scope,
         deferredIsMalformed: deferredIsMalformed);
 
-    DartType reportFailureAndCreateType(
+    ResolutionDartType reportFailureAndCreateType(
         MessageKind messageKind, Map messageArguments,
-        {DartType userProvidedBadType,
+        {ResolutionDartType userProvidedBadType,
         Element erroneousElement,
         List<DiagnosticMessage> infos: const <DiagnosticMessage>[]}) {
       if (malformedIsError) {
@@ -126,8 +127,9 @@
         erroneousElement = new ErroneousElementX(messageKind, messageArguments,
             typeName.source, visitor.enclosingElement);
       }
-      List<DartType> arguments = <DartType>[];
-      resolveTypeArguments(visitor, node, const <DartType>[], arguments);
+      List<ResolutionDartType> arguments = <ResolutionDartType>[];
+      resolveTypeArguments(
+          visitor, node, const <ResolutionDartType>[], arguments);
       return new MalformedType(
           erroneousElement, userProvidedBadType, arguments);
     }
@@ -149,11 +151,16 @@
             element.messageKind, element.messageArguments,
             erroneousElement: element);
       } else {
-        type = const DynamicType();
+        type = const ResolutionDynamicType();
       }
     } else if (!element.impliesType) {
       type = reportFailureAndCreateType(
           MessageKind.NOT_A_TYPE, {'node': node.typeName});
+    } else if (element.library.isPlatformLibrary &&
+        element.name == 'FutureOr') {
+      type = const ResolutionDynamicType();
+      registry.useType(node, type);
+      return type;
     } else {
       bool addTypeVariableBoundsCheck = false;
       if (element.isClass) {
@@ -162,22 +169,22 @@
         // [computeType].
         resolver.ensureClassWillBeResolvedInternal(cls);
         cls.computeType(resolution);
-        List<DartType> arguments = <DartType>[];
+        List<ResolutionDartType> arguments = <ResolutionDartType>[];
         bool hasTypeArgumentMismatch =
             resolveTypeArguments(visitor, node, cls.typeVariables, arguments);
         if (hasTypeArgumentMismatch) {
           type = new BadInterfaceType(
               cls.declaration,
-              new InterfaceType.forUserProvidedBadType(
+              new ResolutionInterfaceType.forUserProvidedBadType(
                   cls.declaration, arguments));
         } else {
           if (arguments.isEmpty) {
             type = cls.rawType;
           } else {
-            type = new InterfaceType(
+            type = new ResolutionInterfaceType(
                 cls.declaration, arguments.toList(growable: false));
             addTypeVariableBoundsCheck =
-                arguments.any((DartType type) => !type.isDynamic);
+                arguments.any((ResolutionDartType type) => !type.isDynamic);
           }
         }
       } else if (element.isTypedef) {
@@ -185,19 +192,22 @@
         // TODO(johnniwinther): [ensureResolved] should imply [computeType].
         typdef.ensureResolved(resolution);
         typdef.computeType(resolution);
-        List<DartType> arguments = <DartType>[];
+        List<ResolutionDartType> arguments = <ResolutionDartType>[];
         bool hasTypeArgumentMismatch = resolveTypeArguments(
             visitor, node, typdef.typeVariables, arguments);
         if (hasTypeArgumentMismatch) {
-          type = new BadTypedefType(typdef,
-              new TypedefType.forUserProvidedBadType(typdef, arguments));
+          type = new BadTypedefType(
+              typdef,
+              new ResolutionTypedefType.forUserProvidedBadType(
+                  typdef, arguments));
         } else {
           if (arguments.isEmpty) {
             type = typdef.rawType;
           } else {
-            type = new TypedefType(typdef, arguments.toList(growable: false));
+            type = new ResolutionTypedefType(
+                typdef, arguments.toList(growable: false));
             addTypeVariableBoundsCheck =
-                arguments.any((DartType type) => !type.isDynamic);
+                arguments.any((ResolutionDartType type) => !type.isDynamic);
           }
         }
       } else if (element.isTypeVariable) {
@@ -232,8 +242,8 @@
 
   /// Checks the type arguments of [type] against the type variable bounds.
   void checkTypeVariableBounds(TypeAnnotation node, GenericType type) {
-    void checkTypeVariableBound(_, DartType typeArgument,
-        TypeVariableType typeVariable, DartType bound) {
+    void checkTypeVariableBound(_, ResolutionDartType typeArgument,
+        ResolutionTypeVariableType typeVariable, ResolutionDartType bound) {
       if (!types.isSubtype(typeArgument, bound)) {
         reporter.reportWarningMessage(
             node, MessageKind.INVALID_TYPE_VARIABLE_BOUND, {
@@ -254,8 +264,11 @@
    * Returns [: true :] if the number of type arguments did not match the
    * number of type variables.
    */
-  bool resolveTypeArguments(MappingVisitor visitor, TypeAnnotation node,
-      List<DartType> typeVariables, List<DartType> arguments) {
+  bool resolveTypeArguments(
+      MappingVisitor visitor,
+      TypeAnnotation node,
+      List<ResolutionDartType> typeVariables,
+      List<ResolutionDartType> arguments) {
     if (node.typeArguments == null) {
       return false;
     }
@@ -270,7 +283,8 @@
             typeArguments.head, MessageKind.ADDITIONAL_TYPE_ARGUMENT);
         typeArgumentCountMismatch = true;
       }
-      DartType argType = resolveTypeAnnotation(visitor, typeArguments.head);
+      ResolutionDartType argType =
+          resolveTypeAnnotation(visitor, typeArguments.head);
       // TODO(karlklose): rewrite to not modify [arguments].
       arguments.add(argType);
     }
diff --git a/pkg/compiler/lib/src/resolution/typedefs.dart b/pkg/compiler/lib/src/resolution/typedefs.dart
index 1c52c93..90fc2c3 100644
--- a/pkg/compiler/lib/src/resolution/typedefs.dart
+++ b/pkg/compiler/lib/src/resolution/typedefs.dart
@@ -6,7 +6,7 @@
 
 import '../common.dart';
 import '../common/resolution.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart'
     show FunctionSignature, TypedefElement, TypeVariableElement;
 import '../elements/modelx.dart' show ErroneousElementX, TypedefElementX;
@@ -69,11 +69,11 @@
 
   TypedefCyclicVisitor(this.reporter, this.element);
 
-  visitType(DartType type, _) {
+  visitType(ResolutionDartType type, _) {
     // Do nothing.
   }
 
-  visitTypedefType(TypedefType type, _) {
+  visitTypedefType(ResolutionTypedefType type, _) {
     TypedefElementX typedefElement = type.element;
     if (seenTypedefs.contains(typedefElement)) {
       if (!hasCyclicReference && identical(element, typedefElement)) {
@@ -123,15 +123,15 @@
     }
   }
 
-  visitFunctionType(FunctionType type, _) {
+  visitFunctionType(ResolutionFunctionType type, _) {
     type.visitChildren(this, null);
   }
 
-  visitInterfaceType(InterfaceType type, _) {
+  visitInterfaceType(ResolutionInterfaceType type, _) {
     type.visitChildren(this, null);
   }
 
-  visitTypeVariableType(TypeVariableType type, _) {
+  visitTypeVariableType(ResolutionTypeVariableType type, _) {
     TypeVariableElement typeVariableElement = type.element;
     if (seenTypeVariables.contains(typeVariableElement)) {
       // Avoid running in cycles on cyclic type variable bounds.
diff --git a/pkg/compiler/lib/src/resolved_uri_translator.dart b/pkg/compiler/lib/src/resolved_uri_translator.dart
index 41a96b3..e2bf954 100644
--- a/pkg/compiler/lib/src/resolved_uri_translator.dart
+++ b/pkg/compiler/lib/src/resolved_uri_translator.dart
@@ -35,8 +35,7 @@
   /// responsible for reporting errors.
   ///
   /// See [LibraryLoader] for terminology on URIs.
-  Uri translate(LibraryElement importingLibrary, Uri uri,
-      [Spannable spannable]);
+  Uri translate(LibraryElement importingLibrary, Uri uri, Spannable spannable);
 }
 
 /// A translator that forwards all methods to an internal
@@ -59,7 +58,7 @@
 
   @override
   Uri translate(LibraryElement importingLibrary, Uri resolvedUri,
-          [Spannable spannable]) =>
+          Spannable spannable) =>
       resolvedUriTranslator.translate(importingLibrary, resolvedUri, spannable);
 
   @override
@@ -86,8 +85,7 @@
   Map<String, Uri> get sdkLibraries => _sdkLibraries;
 
   @override
-  Uri translate(LibraryElement importingLibrary, Uri uri,
-      [Spannable spannable]) {
+  Uri translate(LibraryElement importingLibrary, Uri uri, Spannable spannable) {
     if (uri.scheme == 'dart') {
       return translateDartUri(importingLibrary, uri, spannable);
     }
@@ -117,6 +115,7 @@
       bool allowInternalLibraryAccess = importingLibrary != null &&
           (importingLibrary.isPlatformLibrary ||
               importingLibrary.isPatch ||
+              importingLibrary.canonicalUri.scheme == 'memory' ||
               importingLibrary.canonicalUri.path
                   .contains('sdk/tests/compiler/dart2js_native'));
 
diff --git a/pkg/compiler/lib/src/serialization/constant_serialization.dart b/pkg/compiler/lib/src/serialization/constant_serialization.dart
index fae3d2f..a3025c2 100644
--- a/pkg/compiler/lib/src/serialization/constant_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/constant_serialization.dart
@@ -6,7 +6,7 @@
 
 import '../constants/constructors.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart' show FieldElement;
 import '../resolution/operators.dart';
 import '../universe/call_structure.dart' show CallStructure;
@@ -17,9 +17,9 @@
 /// [ObjectEncoder].
 ///
 /// This class is called from the [Serializer] when a [ConstantExpression] needs
-/// serialization. The [ObjectEncoder] ensures that any [Element], [DartType],
-/// and other [ConstantExpression] that the serialized [ConstantExpression]
-/// depends upon are also serialized.
+/// serialization. The [ObjectEncoder] ensures that any [Element],
+/// [ResolutionDartType], and other [ConstantExpression] that the serialized
+/// [ConstantExpression] depends upon are also serialized.
 class ConstantSerializer
     extends ConstantExpressionVisitor<dynamic, ObjectEncoder> {
   const ConstantSerializer();
@@ -182,7 +182,7 @@
   ///
   /// The class is called from the [Deserializer] when a [ConstantExpression]
   /// needs deserialization. The [ObjectDecoder] ensures that any [Element],
-  /// [DartType], and other [ConstantExpression] that the deserialized
+  /// [ResolutionDartType], and other [ConstantExpression] that the deserialized
   /// [ConstantExpression] depends upon are available.
   static ConstantExpression deserialize(ObjectDecoder decoder) {
     ConstantExpressionKind kind =
@@ -281,8 +281,8 @@
 ///
 /// This class is called from the [ConstructorSerializer] when the [Serializer]
 /// is serializing constant constructor. The [ObjectEncoder] ensures that any
-/// [Element], [DartType], and [ConstantExpression] that the serialized
-/// [ConstantConstructor] depends upon are also serialized.
+/// [Element], [ResolutionDartType], and [ConstantExpression] that the
+/// serialized [ConstantConstructor] depends upon are also serialized.
 class ConstantConstructorSerializer
     extends ConstantConstructorVisitor<dynamic, ObjectEncoder> {
   const ConstantConstructorSerializer();
@@ -341,13 +341,13 @@
   ///
   /// The class is called from the [Deserializer] when a constant constructor
   /// needs deserialization. The [ObjectDecoder] ensures that any [Element],
-  /// [DartType], and [ConstantExpression] that the deserialized
+  /// [ResolutionDartType], and [ConstantExpression] that the deserialized
   /// [ConstantConstructor] depends upon are available.
   static ConstantConstructor deserialize(ObjectDecoder decoder) {
     ConstantConstructorKind kind =
         decoder.getEnum(Key.KIND, ConstantConstructorKind.values);
 
-    DartType readType() {
+    ResolutionDartType readType() {
       return decoder.getType(Key.TYPE);
     }
 
diff --git a/pkg/compiler/lib/src/serialization/element_serialization.dart b/pkg/compiler/lib/src/serialization/element_serialization.dart
index 64a7782..0e5c562 100644
--- a/pkg/compiler/lib/src/serialization/element_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/element_serialization.dart
@@ -7,7 +7,7 @@
 import '../common.dart';
 import '../constants/constructors.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../diagnostics/messages.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart'
@@ -71,9 +71,9 @@
 /// encoding into them into [ObjectEncoder]s.
 ///
 /// This class is called from the [Serializer] when an [Element] needs
-/// serialization. The [ObjectEncoder] ensures that any [Element], [DartType],
-/// and [ConstantExpression] that the serialized [Element] depends upon are also
-/// serialized.
+/// serialization. The [ObjectEncoder] ensures that any [Element],
+/// [ResolutionDartType], and [ConstantExpression] that the serialized [Element]
+/// depends upon are also serialized.
 const List<ElementSerializer> ELEMENT_SERIALIZERS = const [
   const ErrorSerializer(),
   const LibrarySerializer(),
@@ -166,8 +166,7 @@
   static void serializeParentRelation(Element element, ObjectEncoder encoder) {
     if (element.enclosingClass != null) {
       encoder.setElement(Key.CLASS, element.enclosingClass);
-      if (element.enclosingClass.declaration.compilationUnit !=
-          element.compilationUnit) {
+      if (element.enclosingClass.compilationUnit != element.compilationUnit) {
         encoder.setElement(Key.COMPILATION_UNIT, element.compilationUnit);
       }
     } else {
@@ -179,7 +178,7 @@
   /// Serialize the parameters of [element] into [encoder].
   static void serializeParameters(
       FunctionElement element, ObjectEncoder encoder) {
-    FunctionType type = element.type;
+    ResolutionFunctionType type = element.type;
     encoder.setType(Key.RETURN_TYPE, type.returnType);
     encoder.setElements(Key.PARAMETERS, element.parameters);
   }
@@ -420,7 +419,7 @@
     }
     if (element.isObject) return;
 
-    List<InterfaceType> mixins = <InterfaceType>[];
+    List<ResolutionInterfaceType> mixins = <ResolutionInterfaceType>[];
     ClassElement superclass = element.superclass;
     while (superclass.isUnnamedMixinApplication) {
       MixinApplicationElement mixinElement = superclass;
@@ -428,12 +427,13 @@
       superclass = mixinElement.superclass;
     }
     mixins = mixins.reversed.toList();
-    InterfaceType supertype = element.thisType.asInstanceOf(superclass);
+    ResolutionInterfaceType supertype =
+        element.thisType.asInstanceOf(superclass);
 
     encoder.setType(Key.SUPERTYPE, supertype);
     encoder.setTypes(Key.MIXINS, mixins);
     encoder.setTypes(Key.INTERFACES, element.interfaces.toList());
-    FunctionType callType = element.declaration.callType;
+    ResolutionFunctionType callType = element.declaration.callType;
     if (callType != null) {
       encoder.setType(Key.CALL_TYPE, element.callType);
     }
@@ -848,8 +848,8 @@
   ///
   /// The class is called from the [Deserializer] when an [Element]
   /// needs deserialization. The [ObjectDecoder] ensures that any [Element],
-  /// [DartType], and [ConstantExpression] that the deserialized [Element]
-  /// depends upon are available.
+  /// [ResolutionDartType], and [ConstantExpression] that the deserialized
+  /// [Element] depends upon are available.
   static Element deserialize(
       ObjectDecoder decoder, SerializedElementKind elementKind) {
     switch (elementKind) {
diff --git a/pkg/compiler/lib/src/serialization/equivalence.dart b/pkg/compiler/lib/src/serialization/equivalence.dart
index c9f03f2..f3fc4f1 100644
--- a/pkg/compiler/lib/src/serialization/equivalence.dart
+++ b/pkg/compiler/lib/src/serialization/equivalence.dart
@@ -10,7 +10,7 @@
 import '../common/resolution.dart';
 import '../constants/expressions.dart';
 import '../constants/values.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../elements/visitor.dart';
 import '../js_backend/backend_serialization.dart'
@@ -97,7 +97,7 @@
 }
 
 /// Returns `true` if types [a] and [b] are equivalent.
-bool areTypesEquivalent(DartType a, DartType b) {
+bool areTypesEquivalent(ResolutionDartType a, ResolutionDartType b) {
   if (identical(a, b)) return true;
   if (a == null || b == null) return false;
   return const TypeEquivalence().visit(a, b);
@@ -123,7 +123,8 @@
 }
 
 /// Returns `true` if the lists of types, [a] and [b], are equivalent.
-bool areTypeListsEquivalent(List<DartType> a, List<DartType> b) {
+bool areTypeListsEquivalent(
+    List<ResolutionDartType> a, List<ResolutionDartType> b) {
   return areListsEquivalent(a, b, areTypesEquivalent);
 }
 
@@ -150,9 +151,11 @@
 
 /// Returns `true` if the names [a] and [b] are equivalent.
 bool areNamesEquivalent(Name a, Name b) {
+  LibraryElement library1 = a.library;
+  LibraryElement library2 = b.library;
   return a.text == b.text &&
       a.isSetter == b.isSetter &&
-      areElementsEquivalent(a.library, b.library);
+      areElementsEquivalent(library1, library2);
 }
 
 /// Returns `true` if the dynamic uses [a] and [b] are equivalent.
@@ -359,7 +362,7 @@
   }
 
   bool testTypes(Object object1, Object object2, String property,
-      DartType type1, DartType type2) {
+      ResolutionDartType type1, ResolutionDartType type2) {
     return areTypesEquivalent(type1, type2);
   }
 
@@ -374,7 +377,7 @@
   }
 
   bool testTypeLists(Object object1, Object object2, String property,
-      List<DartType> list1, List<DartType> list2) {
+      List<ResolutionDartType> list1, List<ResolutionDartType> list2) {
     return areTypeListsEquivalent(list1, list2);
   }
 
@@ -592,22 +595,25 @@
   }
 }
 
-/// Visitor that checks for equivalence of [DartType]s.
-class TypeEquivalence implements DartTypeVisitor<bool, DartType> {
+/// Visitor that checks for equivalence of [ResolutionDartType]s.
+class TypeEquivalence implements DartTypeVisitor<bool, ResolutionDartType> {
   final TestStrategy strategy;
 
   const TypeEquivalence([this.strategy = const TestStrategy()]);
 
-  bool visit(DartType type1, DartType type2) {
+  bool visit(ResolutionDartType type1, ResolutionDartType type2) {
     return strategy.test(type1, type2, 'kind', type1.kind, type2.kind) &&
         type1.accept(this, type2);
   }
 
   @override
-  bool visitDynamicType(DynamicType type, DynamicType other) => true;
+  bool visitDynamicType(
+          ResolutionDynamicType type, ResolutionDynamicType other) =>
+      true;
 
   @override
-  bool visitFunctionType(FunctionType type, FunctionType other) {
+  bool visitFunctionType(
+      ResolutionFunctionType type, ResolutionFunctionType other) {
     return strategy.testTypeLists(type, other, 'parameterTypes',
             type.parameterTypes, other.parameterTypes) &&
         strategy.testTypeLists(type, other, 'optionalParameterTypes',
@@ -629,12 +635,8 @@
   bool visitMalformedType(MalformedType type, MalformedType other) => true;
 
   @override
-  bool visitStatementType(StatementType type, StatementType other) {
-    throw new UnsupportedError("Unsupported type: $type");
-  }
-
-  @override
-  bool visitTypeVariableType(TypeVariableType type, TypeVariableType other) {
+  bool visitTypeVariableType(
+      ResolutionTypeVariableType type, ResolutionTypeVariableType other) {
     return strategy.testElements(
             type, other, 'element', type.element, other.element) &&
         strategy.test(type, other, 'is MethodTypeVariableType',
@@ -642,15 +644,18 @@
   }
 
   @override
-  bool visitVoidType(VoidType type, VoidType argument) => true;
+  bool visitVoidType(ResolutionVoidType type, ResolutionVoidType argument) =>
+      true;
 
   @override
-  bool visitInterfaceType(InterfaceType type, InterfaceType other) {
+  bool visitInterfaceType(
+      ResolutionInterfaceType type, ResolutionInterfaceType other) {
     return visitGenericType(type, other);
   }
 
   @override
-  bool visitTypedefType(TypedefType type, TypedefType other) {
+  bool visitTypedefType(
+      ResolutionTypedefType type, ResolutionTypedefType other) {
     return visitGenericType(type, other);
   }
 }
@@ -863,8 +868,9 @@
   @override
   bool visitConstructed(
       ConstructedConstantValue value1, ConstructedConstantValue value2) {
-    return strategy.testTypes(
-            value1, value2, 'type', value1.type, value2.type) &&
+    ResolutionInterfaceType type1 = value1.type;
+    ResolutionInterfaceType type2 = value2.type;
+    return strategy.testTypes(value1, value2, 'type', type1, type2) &&
         strategy.testMaps(
             value1,
             value2,
@@ -879,22 +885,25 @@
   @override
   bool visitFunction(
       FunctionConstantValue value1, FunctionConstantValue value2) {
-    return strategy.testElements(
-        value1, value2, 'element', value1.element, value2.element);
+    MethodElement method1 = value1.element;
+    MethodElement method2 = value2.element;
+    return strategy.testElements(value1, value2, 'element', method1, method2);
   }
 
   @override
   bool visitList(ListConstantValue value1, ListConstantValue value2) {
-    return strategy.testTypes(
-            value1, value2, 'type', value1.type, value2.type) &&
+    ResolutionInterfaceType type1 = value1.type;
+    ResolutionInterfaceType type2 = value2.type;
+    return strategy.testTypes(value1, value2, 'type', type1, type2) &&
         strategy.testConstantValueLists(
             value1, value2, 'entries', value1.entries, value2.entries);
   }
 
   @override
   bool visitMap(MapConstantValue value1, MapConstantValue value2) {
-    return strategy.testTypes(
-            value1, value2, 'type', value1.type, value2.type) &&
+    ResolutionInterfaceType type1 = value1.type;
+    ResolutionInterfaceType type2 = value2.type;
+    return strategy.testTypes(value1, value2, 'type', type1, type2) &&
         strategy.testConstantValueLists(
             value1, value2, 'keys', value1.keys, value2.keys) &&
         strategy.testConstantValueLists(
@@ -903,7 +912,9 @@
 
   @override
   bool visitType(TypeConstantValue value1, TypeConstantValue value2) {
-    return strategy.testTypes(value1, value2, 'type', value1.type, value2.type);
+    ResolutionInterfaceType type1 = value1.type;
+    ResolutionInterfaceType type2 = value2.type;
+    return strategy.testTypes(value1, value2, 'type', type1, type2);
   }
 
   @override
@@ -961,8 +972,9 @@
   @override
   bool visitInterceptor(
       InterceptorConstantValue value1, InterceptorConstantValue value2) {
-    return strategy.testTypes(value1, value2, 'dispatchedType',
-        value1.dispatchedType, value2.dispatchedType);
+    ClassElement cls1 = value1.cls;
+    ClassElement cls2 = value2.cls;
+    return strategy.testElements(value1, value2, 'cls', cls1, cls2);
   }
 }
 
diff --git a/pkg/compiler/lib/src/serialization/impact_serialization.dart b/pkg/compiler/lib/src/serialization/impact_serialization.dart
index 90c1570..3b8e4b1 100644
--- a/pkg/compiler/lib/src/serialization/impact_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/impact_serialization.dart
@@ -6,7 +6,7 @@
 
 import '../common/resolution.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../universe/selector.dart';
 import '../universe/feature.dart';
@@ -137,7 +137,7 @@
       StaticUseKind kind = object.getEnum(Key.KIND, StaticUseKind.values);
       Element usedElement =
           deserializeElementReference(element, Key.ELEMENT, Key.NAME, object);
-      DartType type = object.getType(Key.TYPE, isOptional: true);
+      ResolutionDartType type = object.getType(Key.TYPE, isOptional: true);
       staticUses.add(new StaticUse.internal(usedElement, kind, type));
     }
 
@@ -154,7 +154,7 @@
     for (int index = 0; index < typeUseDecoder.length; index++) {
       ObjectDecoder object = typeUseDecoder.getObject(index);
       TypeUseKind kind = object.getEnum(Key.KIND, TypeUseKind.values);
-      DartType type = object.getType(Key.TYPE);
+      ResolutionDartType type = object.getType(Key.TYPE);
       typeUses.add(new TypeUse.internal(type, kind));
     }
 
@@ -174,7 +174,7 @@
       listLiterals = <ListLiteralUse>[];
       for (int i = 0; i < listLiteralDecoder.length; i++) {
         ObjectDecoder useDecoder = listLiteralDecoder.getObject(i);
-        DartType type = useDecoder.getType(Key.TYPE);
+        ResolutionDartType type = useDecoder.getType(Key.TYPE);
         bool isConstant = useDecoder.getBool(Key.IS_CONST);
         bool isEmpty = useDecoder.getBool(Key.IS_EMPTY);
         listLiterals.add(
@@ -189,7 +189,7 @@
       mapLiterals = <MapLiteralUse>[];
       for (int i = 0; i < mapLiteralDecoder.length; i++) {
         ObjectDecoder useDecoder = mapLiteralDecoder.getObject(i);
-        DartType type = useDecoder.getType(Key.TYPE);
+        ResolutionDartType type = useDecoder.getType(Key.TYPE);
         bool isConstant = useDecoder.getBool(Key.IS_CONST);
         bool isEmpty = useDecoder.getBool(Key.IS_EMPTY);
         mapLiterals.add(
diff --git a/pkg/compiler/lib/src/serialization/modelz.dart b/pkg/compiler/lib/src/serialization/modelz.dart
index a628cbf..e1fb5d0 100644
--- a/pkg/compiler/lib/src/serialization/modelz.dart
+++ b/pkg/compiler/lib/src/serialization/modelz.dart
@@ -13,7 +13,7 @@
 import '../common/resolution.dart' show Resolution;
 import '../constants/constructors.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/common.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart' show FunctionSignatureX;
@@ -762,10 +762,10 @@
 }
 
 abstract class TypedElementMixin implements DeserializedElementZ, TypedElement {
-  DartType _type;
+  ResolutionDartType _type;
 
   @override
-  DartType get type {
+  ResolutionDartType get type {
     if (_type == null) {
       _type = _decoder.getType(Key.TYPE);
     }
@@ -773,7 +773,7 @@
   }
 
   @override
-  DartType computeType(Resolution resolution) => type;
+  ResolutionDartType computeType(Resolution resolution) => type;
 }
 
 abstract class ParametersMixin
@@ -792,8 +792,8 @@
       int requiredParameterCount = 0;
       int optionalParameterCount = 0;
       bool optionalParametersAreNamed = false;
-      List<DartType> parameterTypes = <DartType>[];
-      List<DartType> optionalParameterTypes = <DartType>[];
+      List<ResolutionDartType> parameterTypes = <ResolutionDartType>[];
+      List<ResolutionDartType> optionalParameterTypes = <ResolutionDartType>[];
       for (ParameterElement parameter in parameters) {
         if (parameter.isOptional) {
           optionalParameterCount++;
@@ -811,10 +811,11 @@
         }
       }
       List<String> namedParameters = const <String>[];
-      List<DartType> namedParameterTypes = const <DartType>[];
+      List<ResolutionDartType> namedParameterTypes =
+          const <ResolutionDartType>[];
       if (optionalParametersAreNamed) {
         namedParameters = <String>[];
-        namedParameterTypes = <DartType>[];
+        namedParameterTypes = <ResolutionDartType>[];
         orderedOptionalParameters.sort((Element a, Element b) {
           return a.name.compareTo(b.name);
         });
@@ -823,10 +824,10 @@
           namedParameterTypes.add(parameter.type);
         }
       }
-      List<DartType> typeVariables =
+      List<ResolutionDartType> typeVariables =
           _decoder.getTypes(Key.TYPE_VARIABLES, isOptional: true);
 
-      FunctionType type = new FunctionType(
+      ResolutionFunctionType type = new ResolutionFunctionType(
           this,
           _decoder.getType(Key.RETURN_TYPE),
           parameterTypes,
@@ -866,15 +867,15 @@
   }
 
   @override
-  List<DartType> get typeVariables => functionSignature.typeVariables;
+  List<ResolutionDartType> get typeVariables => functionSignature.typeVariables;
 }
 
 abstract class ClassElementMixin
     implements ElementZ, ClassElement, class_members.ClassMemberMixin {
   bool _isResolved = false;
 
-  InterfaceType _createType(List<DartType> typeArguments) {
-    return new InterfaceType(this, typeArguments);
+  ResolutionInterfaceType _createType(List<ResolutionDartType> typeArguments) {
+    return new ResolutionInterfaceType(this, typeArguments);
   }
 
   @override
@@ -926,37 +927,37 @@
         class_members.ClassMemberMixin,
         ContainerMixin,
         LibraryMemberMixin,
-        TypeDeclarationMixin<InterfaceType>,
+        TypeDeclarationMixin<ResolutionInterfaceType>,
         ClassElementMixin
     implements ClassElement {
   bool _isObject;
-  DartType _supertype;
+  ResolutionDartType _supertype;
   OrderedTypeSet _allSupertypesAndSelf;
-  Link<DartType> _interfaces;
-  FunctionType _callType;
+  Link<ResolutionDartType> _interfaces;
+  ResolutionFunctionType _callType;
 
   ClassElementZ(ObjectDecoder decoder) : super(decoder);
 
   @override
-  List<DartType> _getTypeVariables() {
+  List<ResolutionDartType> _getTypeVariables() {
     return _decoder.getTypes(Key.TYPE_VARIABLES, isOptional: true);
   }
 
   void _ensureSuperHierarchy() {
     if (_interfaces == null) {
-      InterfaceType supertype =
+      ResolutionInterfaceType supertype =
           _decoder.getType(Key.SUPERTYPE, isOptional: true);
       if (supertype == null) {
         _isObject = true;
         _allSupertypesAndSelf = new OrderedTypeSet.singleton(thisType);
-        _interfaces = const Link<DartType>();
+        _interfaces = const Link<ResolutionDartType>();
       } else {
         _isObject = false;
         _interfaces =
             toLink(_decoder.getTypes(Key.INTERFACES, isOptional: true));
-        List<InterfaceType> mixins =
+        List<ResolutionInterfaceType> mixins =
             _decoder.getTypes(Key.MIXINS, isOptional: true);
-        for (InterfaceType mixin in mixins) {
+        for (ResolutionInterfaceType mixin in mixins) {
           MixinApplicationElement mixinElement =
               new UnnamedMixinApplicationElementZ(this, supertype, mixin);
           supertype = mixinElement.thisType
@@ -976,7 +977,7 @@
   }
 
   @override
-  DartType get supertype {
+  ResolutionDartType get supertype {
     _ensureSuperHierarchy();
     return _supertype;
   }
@@ -997,7 +998,7 @@
   }
 
   @override
-  Link<DartType> get interfaces {
+  Link<ResolutionDartType> get interfaces {
     _ensureSuperHierarchy();
     return _interfaces;
   }
@@ -1012,7 +1013,7 @@
   bool get isUnnamedMixinApplication => false;
 
   @override
-  FunctionType get callType {
+  ResolutionFunctionType get callType {
     _ensureSuperHierarchy();
     // TODO(johnniwinther): Why can't this always be computed in ensureResolved?
     return _callType;
@@ -1031,12 +1032,13 @@
 class NamedMixinApplicationElementZ extends ClassElementZ
     with MixinApplicationElementMixin {
   Link<Element> _constructors;
-  InterfaceType _mixinType;
+  ResolutionInterfaceType _mixinType;
 
   NamedMixinApplicationElementZ(ObjectDecoder decoder) : super(decoder);
 
   @override
-  InterfaceType get mixinType => _mixinType ??= _decoder.getType(Key.MIXIN);
+  ResolutionInterfaceType get mixinType =>
+      _mixinType ??= _decoder.getType(Key.MIXIN);
 
   @override
   ClassElement get subclass => null;
@@ -1047,22 +1049,22 @@
         ClassElementCommon,
         ClassElementMixin,
         class_members.ClassMemberMixin,
-        TypeDeclarationMixin<InterfaceType>,
+        TypeDeclarationMixin<ResolutionInterfaceType>,
         AnalyzableElementMixin,
         AstElementMixinZ,
         MixinApplicationElementCommon,
         MixinApplicationElementMixin {
   final String name;
   final ClassElement subclass;
-  final InterfaceType _supertypeBase;
-  final InterfaceType _mixinBase;
-  InterfaceType _supertype;
-  Link<DartType> _interfaces;
+  final ResolutionInterfaceType _supertypeBase;
+  final ResolutionInterfaceType _mixinBase;
+  ResolutionInterfaceType _supertype;
+  Link<ResolutionDartType> _interfaces;
   OrderedTypeSet _allSupertypesAndSelf;
   Link<ConstructorElement> _constructors;
 
-  UnnamedMixinApplicationElementZ(
-      this.subclass, InterfaceType supertype, InterfaceType mixin)
+  UnnamedMixinApplicationElementZ(this.subclass,
+      ResolutionInterfaceType supertype, ResolutionInterfaceType mixin)
       : this._supertypeBase = supertype,
         this._mixinBase = mixin,
         this.name = "${supertype.name}+${mixin.name}";
@@ -1099,20 +1101,22 @@
   }
 
   @override
-  List<DartType> _getTypeVariables() {
+  List<ResolutionDartType> _getTypeVariables() {
     // Create synthetic type variables for the mixin application.
-    List<DartType> typeVariables = <DartType>[];
+    List<ResolutionDartType> typeVariables = <ResolutionDartType>[];
     int index = 0;
-    for (TypeVariableType type in subclass.typeVariables) {
+    for (ResolutionTypeVariableType type in subclass.typeVariables) {
       SyntheticTypeVariableElementZ typeVariableElement =
           new SyntheticTypeVariableElementZ(this, index, type.name);
-      TypeVariableType typeVariable = new TypeVariableType(typeVariableElement);
+      ResolutionTypeVariableType typeVariable =
+          new ResolutionTypeVariableType(typeVariableElement);
       typeVariables.add(typeVariable);
       index++;
     }
     // Setup bounds on the synthetic type variables.
-    for (TypeVariableType type in subclass.typeVariables) {
-      TypeVariableType typeVariable = typeVariables[type.element.index];
+    for (ResolutionTypeVariableType type in subclass.typeVariables) {
+      ResolutionTypeVariableType typeVariable =
+          typeVariables[type.element.index];
       SyntheticTypeVariableElementZ typeVariableElement = typeVariable.element;
       typeVariableElement._type = typeVariable;
       typeVariableElement._bound =
@@ -1122,7 +1126,7 @@
   }
 
   @override
-  InterfaceType get supertype {
+  ResolutionInterfaceType get supertype {
     if (_supertype == null) {
       // Substitute the type variables in [_supertypeBase] provided by
       // [_subclass] with the type variables in this unnamed mixin application.
@@ -1141,7 +1145,7 @@
   }
 
   @override
-  Link<DartType> get interfaces {
+  Link<ResolutionDartType> get interfaces {
     if (_interfaces == null) {
       // Substitute the type variables in [_mixinBase] provided by
       // [_subclass] with the type variables in this unnamed mixin application.
@@ -1154,7 +1158,7 @@
       //    abstract class S+M<S+M.T> extends S<S+M.T> implements M<S+M.T> {}
       // but the mixin is provided as M<C.T> and we need to substitute S+M.T
       // for C.T.
-      _interfaces = const Link<DartType>()
+      _interfaces = const Link<ResolutionDartType>()
           .prepend(_mixinBase.subst(typeVariables, subclass.typeVariables));
     }
     return _interfaces;
@@ -1187,7 +1191,7 @@
   LibraryElement get library => enclosingElement.library;
 
   @override
-  InterfaceType get mixinType => interfaces.head;
+  ResolutionInterfaceType get mixinType => interfaces.head;
 
   @override
   int get sourceOffset => subclass.sourceOffset;
@@ -1300,7 +1304,9 @@
   PrefixElement get redirectionDeferredPrefix => null;
 
   @override
-  InterfaceType computeEffectiveTargetType(InterfaceType newType) => newType;
+  ResolutionInterfaceType computeEffectiveTargetType(
+          ResolutionInterfaceType newType) =>
+      newType;
 }
 
 class GenerativeConstructorElementZ extends ConstructorElementZ {
@@ -1339,7 +1345,7 @@
 }
 
 class RedirectingFactoryConstructorElementZ extends ConstructorElementZ {
-  DartType _effectiveTargetType;
+  ResolutionDartType _effectiveTargetType;
   ConstructorElement _immediateRedirectionTarget;
   PrefixElement _redirectionDeferredPrefix;
   bool _effectiveTargetIsMalformed;
@@ -1380,7 +1386,8 @@
   }
 
   @override
-  DartType computeEffectiveTargetType(InterfaceType newType) {
+  ResolutionDartType computeEffectiveTargetType(
+      ResolutionInterfaceType newType) {
     _ensureEffectiveTarget();
     return _effectiveTargetType.substByContext(newType);
   }
@@ -1432,12 +1439,13 @@
   AsyncMarker get asyncMarker => AsyncMarker.SYNC;
 
   @override
-  InterfaceType computeEffectiveTargetType(InterfaceType newType) {
+  ResolutionInterfaceType computeEffectiveTargetType(
+      ResolutionInterfaceType newType) {
     return enclosingClass.thisType.substByContext(newType);
   }
 
   @override
-  DartType computeType(Resolution resolution) => type;
+  ResolutionDartType computeType(Resolution resolution) => type;
 
   @override
   bool get isConst => false;
@@ -1541,14 +1549,14 @@
   SourceSpan get sourcePosition => enclosingClass.sourcePosition;
 
   @override
-  FunctionType get type {
+  ResolutionFunctionType get type {
     // TODO(johnniwinther): Ensure that the function type substitutes type
     // variables correctly.
     return definingConstructor.type;
   }
 
   @override
-  List<DartType> get typeVariables => _unsupported("typeVariables");
+  List<ResolutionDartType> get typeVariables => _unsupported("typeVariables");
 }
 
 abstract class MemberElementMixin
@@ -1839,7 +1847,7 @@
 
 abstract class TypeDeclarationMixin<T extends GenericType>
     implements ElementZ, TypeDeclarationElement {
-  List<DartType> _typeVariables;
+  List<ResolutionDartType> _typeVariables;
   T _rawType;
   T _thisType;
   Name _memberName;
@@ -1851,21 +1859,21 @@
     return _memberName;
   }
 
-  List<DartType> _getTypeVariables();
+  List<ResolutionDartType> _getTypeVariables();
 
   void _ensureTypes() {
     if (_typeVariables == null) {
       _typeVariables = _getTypeVariables();
-      _rawType = _createType(new List<DartType>.filled(
-          _typeVariables.length, const DynamicType()));
+      _rawType = _createType(new List<ResolutionDartType>.filled(
+          _typeVariables.length, const ResolutionDynamicType()));
       _thisType = _createType(_typeVariables);
     }
   }
 
-  T _createType(List<DartType> typeArguments);
+  T _createType(List<ResolutionDartType> typeArguments);
 
   @override
-  List<DartType> get typeVariables {
+  List<ResolutionDartType> get typeVariables {
     _ensureTypes();
     return _typeVariables;
   }
@@ -1895,18 +1903,18 @@
         AstElementMixinZ,
         LibraryMemberMixin,
         ParametersMixin,
-        TypeDeclarationMixin<TypedefType>
+        TypeDeclarationMixin<ResolutionTypedefType>
     implements TypedefElement {
-  DartType _alias;
+  ResolutionDartType _alias;
 
   TypedefElementZ(ObjectDecoder decoder) : super(decoder);
 
-  TypedefType _createType(List<DartType> typeArguments) {
-    return new TypedefType(this, typeArguments);
+  ResolutionTypedefType _createType(List<ResolutionDartType> typeArguments) {
+    return new ResolutionTypedefType(this, typeArguments);
   }
 
   @override
-  List<DartType> _getTypeVariables() {
+  List<ResolutionDartType> _getTypeVariables() {
     return _decoder.getTypes(Key.TYPE_VARIABLES, isOptional: true);
   }
 
@@ -1919,7 +1927,7 @@
   }
 
   @override
-  DartType get alias {
+  ResolutionDartType get alias {
     if (_alias == null) {
       _alias = _decoder.getType(Key.ALIAS);
     }
@@ -1937,8 +1945,8 @@
     with AnalyzableElementMixin, AstElementMixinZ, TypedElementMixin
     implements TypeVariableElement {
   GenericElement _typeDeclaration;
-  TypeVariableType _type;
-  DartType _bound;
+  ResolutionTypeVariableType _type;
+  ResolutionDartType _bound;
   Name _memberName;
 
   TypeVariableElementZ(ObjectDecoder decoder) : super(decoder);
@@ -1980,7 +1988,7 @@
     return _typeDeclaration;
   }
 
-  DartType get bound {
+  ResolutionDartType get bound {
     if (_bound == null) {
       _bound = _decoder.getType(Key.BOUND);
     }
@@ -1997,8 +2005,8 @@
   final TypeDeclarationElement typeDeclaration;
   final int index;
   final String name;
-  TypeVariableType _type;
-  DartType _bound;
+  ResolutionTypeVariableType _type;
+  ResolutionDartType _bound;
   Name _memberName;
 
   SyntheticTypeVariableElementZ(this.typeDeclaration, this.index, this.name);
@@ -2024,14 +2032,14 @@
   }
 
   @override
-  TypeVariableType get type {
+  ResolutionTypeVariableType get type {
     assert(invariant(this, _type != null,
         message: "Type variable type has not been set on $this."));
     return _type;
   }
 
   @override
-  TypeVariableType computeType(Resolution resolution) => type;
+  ResolutionTypeVariableType computeType(Resolution resolution) => type;
 
   @override
   Element get enclosingElement => typeDeclaration;
@@ -2039,7 +2047,7 @@
   @override
   Element get enclosingClass => typeDeclaration;
 
-  DartType get bound {
+  ResolutionDartType get bound {
     assert(invariant(this, _bound != null,
         message: "Type variable bound has not been set on $this."));
     return _bound;
@@ -2060,7 +2068,7 @@
     implements ParameterElement {
   FunctionElement _functionDeclaration;
   ConstantExpression _constant;
-  DartType _type;
+  ResolutionDartType _type;
 
   ParameterElementZ(ObjectDecoder decoder) : super(decoder);
 
@@ -2127,7 +2135,7 @@
   MemberElement get memberContext => executableContext.memberContext;
 
   @override
-  List<DartType> get typeVariables => functionSignature.typeVariables;
+  List<ResolutionDartType> get typeVariables => functionSignature.typeVariables;
 }
 
 class LocalParameterElementZ extends ParameterElementZ
diff --git a/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart b/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
index c839c95..85044fb 100644
--- a/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
@@ -7,7 +7,7 @@
 import '../common.dart';
 import '../common/resolution.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../diagnostics/diagnostic_listener.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart';
@@ -237,7 +237,7 @@
       serializeElementReference(element, Key.ELEMENT, Key.NAME,
           getNodeDataEncoder(node), nodeElement);
     }
-    DartType type = elements.getType(node);
+    ResolutionDartType type = elements.getType(node);
     if (type != null) {
       getNodeDataEncoder(node).setType(Key.TYPE, type);
     }
@@ -250,7 +250,7 @@
     if (constant != null) {
       getNodeDataEncoder(node).setConstant(Key.CONSTANT, constant);
     }
-    DartType cachedType = elements.typesCache[node];
+    ResolutionDartType cachedType = elements.typesCache[node];
     if (cachedType != null) {
       getNodeDataEncoder(node).setType(Key.CACHED_TYPE, cachedType);
     }
@@ -587,12 +587,11 @@
     }
     jumpTargetLabels.forEach((JumpTargetX jumpTarget, List<int> labelIds) {
       if (labelIds.isEmpty) return;
-      LinkBuilder<LabelDefinition> linkBuilder =
-          new LinkBuilder<LabelDefinition>();
+      List<LabelDefinition> labels = <LabelDefinition>[];
       for (int labelId in labelIds) {
-        linkBuilder.addLast(labelDefinitions[labelId]);
+        labels.add(labelDefinitions[labelId]);
       }
-      jumpTarget.labels = linkBuilder.toLink();
+      jumpTarget.labels = labels;
     });
 
     ListDecoder dataDecoder = objectDecoder.getList(Key.DATA, isOptional: true);
@@ -607,7 +606,8 @@
         if (nodeElement != null) {
           elements[node] = nodeElement;
         }
-        DartType type = objectDecoder.getType(Key.TYPE, isOptional: true);
+        ResolutionDartType type =
+            objectDecoder.getType(Key.TYPE, isOptional: true);
         if (type != null) {
           elements.setType(node, type);
         }
@@ -621,7 +621,7 @@
         if (constant != null) {
           elements.setConstant(node, constant);
         }
-        DartType cachedType =
+        ResolutionDartType cachedType =
             objectDecoder.getType(Key.CACHED_TYPE, isOptional: true);
         if (cachedType != null) {
           elements.typesCache[node] = cachedType;
diff --git a/pkg/compiler/lib/src/serialization/serialization.dart b/pkg/compiler/lib/src/serialization/serialization.dart
index 27baa60..ff18e36 100644
--- a/pkg/compiler/lib/src/serialization/serialization.dart
+++ b/pkg/compiler/lib/src/serialization/serialization.dart
@@ -7,7 +7,7 @@
 import '../common.dart';
 import '../common/resolution.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../library_loader.dart' show LibraryProvider;
 import '../util/enumset.dart';
@@ -23,8 +23,8 @@
 /// An object that supports the encoding an [ObjectValue] for serialization.
 ///
 /// The [ObjectEncoder] ensures that nominality and circularities of
-/// non-primitive values like [Element], [DartType] and [ConstantExpression] are
-/// handled.
+/// non-primitive values like [Element], [ResolutionDartType] and
+/// [ConstantExpression] are handled.
 class ObjectEncoder extends AbstractEncoder<Key> {
   /// Creates an [ObjectEncoder] in the scope of [serializer] that uses [map]
   /// as its internal storage.
@@ -37,8 +37,8 @@
 /// An object that supports the encoding a [MapValue] for serialization.
 ///
 /// The [MapEncoder] ensures that nominality and circularities of
-/// non-primitive values like [Element], [DartType] and [ConstantExpression] are
-/// handled.
+/// non-primitive values like [Element], [ResolutionDartType] and
+/// [ConstantExpression] are handled.
 class MapEncoder extends AbstractEncoder<String> {
   /// Creates an [MapEncoder] in the scope of [serializer] that uses [map]
   /// as its internal storage.
@@ -52,8 +52,8 @@
 /// or [MapValue]s.
 ///
 /// The [ListEncoder] ensures that nominality and circularities of
-/// non-primitive values like [Element], [DartType] and [ConstantExpression] are
-/// handled.
+/// non-primitive values like [Element], [ResolutionDartType] and
+/// [ConstantExpression] are handled.
 class ListEncoder {
   final Serializer _serializer;
   final List<Value> _list;
@@ -151,7 +151,7 @@
   }
 
   /// Maps the [key] entry to the [type] in the encoded object.
-  void setType(K key, DartType type) {
+  void setType(K key, ResolutionDartType type) {
     _checkKey(key);
     _map[key] = _serializer.createTypeValue(type);
   }
@@ -159,7 +159,7 @@
   /// Maps the [key] entry to the [types] in the encoded object.
   ///
   /// If [types] is empty, it is skipped.
-  void setTypes(K key, Iterable<DartType> types) {
+  void setTypes(K key, Iterable<ResolutionDartType> types) {
     _checkKey(key);
     if (types.isNotEmpty) {
       _map[key] =
@@ -412,11 +412,12 @@
     return list.map(_deserializer.deserializeConstant).toList();
   }
 
-  /// Returns the [DartType] value associated with [key] in the decoded object.
+  /// Returns the [ResolutionDartType] value associated with [key] in the
+  /// decoded object.
   ///
   /// If no value is associated with [key], then if [isOptional] is `true`,
   /// `null` is returned, otherwise an exception is thrown.
-  DartType getType(K key, {bool isOptional: false}) {
+  ResolutionDartType getType(K key, {bool isOptional: false}) {
     int id = _map[_getKeyValue(key)];
     if (id == null) {
       if (isOptional) {
@@ -427,12 +428,12 @@
     return _deserializer.deserializeType(id);
   }
 
-  /// Returns the list of [DartType] values associated with [key] in the decoded
-  /// object.
+  /// Returns the list of [ResolutionDartType] values associated with [key] in
+  /// the decoded object.
   ///
   /// If no value is associated with [key], then if [isOptional] is `true`,
   /// and empty [List] is returned, otherwise an exception is thrown.
-  List<DartType> getTypes(K key, {bool isOptional: false}) {
+  List<ResolutionDartType> getTypes(K key, {bool isOptional: false}) {
     List list = _map[_getKeyValue(key)];
     if (list == null) {
       if (isOptional) {
@@ -630,9 +631,9 @@
 
 /// Serializer for the transitive closure of a collection of libraries.
 ///
-/// The serializer creates an [ObjectValue] model of the [Element], [DartType]
-/// and [ConstantExpression] values in the transitive closure of the serialized
-/// libraries.
+/// The serializer creates an [ObjectValue] model of the [Element],
+/// [ResolutionDartType] and [ConstantExpression] values in the transitive
+/// closure of the serialized libraries.
 ///
 /// The model layout of the produced [objectValue] is:
 ///
@@ -662,7 +663,8 @@
   Map<Element, DataObject> _elementMap = <Element, DataObject>{};
   Map<ConstantExpression, DataObject> _constantMap =
       <ConstantExpression, DataObject>{};
-  Map<DartType, DataObject> _typeMap = <DartType, DataObject>{};
+  Map<ResolutionDartType, DataObject> _typeMap =
+      <ResolutionDartType, DataObject>{};
   List _pendingList = [];
   ElementMatcher shouldInclude;
 
@@ -848,7 +850,7 @@
   /// If [type] has no [DataObject], a new [DataObject] is created and
   /// encoding the [ObjectValue] for [type] is put into the work queue of this
   /// serializer.
-  Value _getTypeId(DartType type) {
+  Value _getTypeId(ResolutionDartType type) {
     DataObject dataObject = _typeMap[type];
     if (dataObject == null) {
       _typeMap[type] = dataObject = new DataObject(
@@ -861,7 +863,7 @@
   }
 
   /// Encodes [type] into the [ObjectValue] of [dataObject].
-  void _encodeType(DartType type, DataObject dataObject) {
+  void _encodeType(ResolutionDartType type, DataObject dataObject) {
     const TypeSerializer().visit(type, new ObjectEncoder(this, dataObject.map));
   }
 
@@ -869,7 +871,7 @@
   ///
   /// If [type] has not already been serialized, it is added to the work
   /// queue of this serializer.
-  TypeValue createTypeValue(DartType type) {
+  TypeValue createTypeValue(ResolutionDartType type) {
     return new TypeValue(type, _getTypeId(type));
   }
 
@@ -982,7 +984,7 @@
   ListDecoder _typeList;
   ListDecoder _constantList;
   Map<int, Element> _elementMap = {};
-  Map<int, DartType> _typeMap = {};
+  Map<int, ResolutionDartType> _typeMap = {};
   Map<int, ConstantExpression> _constantMap = {};
 
   Deserializer.fromText(
@@ -998,7 +1000,8 @@
     return _elementList;
   }
 
-  /// Returns the [ListDecoder] for the [DartType]s in this deserializer.
+  /// Returns the [ListDecoder] for the [ResolutionDartType]s in this
+  /// deserializer.
   ListDecoder get types {
     if (_typeList == null) {
       _typeList = _headerObject.getList(Key.TYPES);
@@ -1105,8 +1108,8 @@
     return element;
   }
 
-  /// Returns the deserialized [DartType] for [id].
-  DartType deserializeType(int id) {
+  /// Returns the deserialized [ResolutionDartType] for [id].
+  ResolutionDartType deserializeType(int id) {
     if (id == null) throw new ArgumentError('Deserializer.getType(null)');
     return _typeMap.putIfAbsent(id, () {
       return TypeDeserializer.deserialize(types.getObject(id));
diff --git a/pkg/compiler/lib/src/serialization/serialization_util.dart b/pkg/compiler/lib/src/serialization/serialization_util.dart
index 4883adb..9c7d1a8 100644
--- a/pkg/compiler/lib/src/serialization/serialization_util.dart
+++ b/pkg/compiler/lib/src/serialization/serialization_util.dart
@@ -6,7 +6,7 @@
 
 import '../common.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../diagnostics/messages.dart';
 import '../elements/elements.dart';
 import '../elements/modelx.dart' show WrappedMessage;
@@ -23,7 +23,8 @@
   encoder.setString(Key.NAME, name.text);
   encoder.setBool(Key.IS_SETTER, name.isSetter);
   if (name.library != null) {
-    encoder.setElement(Key.LIBRARY, name.library);
+    LibraryElement library = name.library;
+    encoder.setElement(Key.LIBRARY, library);
   }
 }
 
@@ -350,7 +351,7 @@
       ConstructorAccessKind constructorAccessKind =
           decoder.getEnum(Key.SUB_KIND, ConstructorAccessKind.values);
       Element element = decoder.getElement(Key.ELEMENT);
-      DartType type = decoder.getType(Key.TYPE);
+      ResolutionDartType type = decoder.getType(Key.TYPE);
       ConstructorAccessSemantics semantics =
           new ConstructorAccessSemantics(constructorAccessKind, element, type);
       Selector selector = deserializeSelector(decoder.getObject(Key.SELECTOR));
diff --git a/pkg/compiler/lib/src/serialization/system.dart b/pkg/compiler/lib/src/serialization/system.dart
index 9e6da49..12b4adb 100644
--- a/pkg/compiler/lib/src/serialization/system.dart
+++ b/pkg/compiler/lib/src/serialization/system.dart
@@ -9,7 +9,7 @@
 import '../common.dart';
 import '../common/resolution.dart';
 import '../compiler.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../scanner/scanner.dart';
 import '../script.dart';
@@ -169,13 +169,13 @@
       return _resolutionImpactDeserializer.registerResolutionImpact(constructor,
           () {
         List<TypeUse> typeUses = <TypeUse>[];
-        void addCheckedModeCheck(DartType type) {
+        void addCheckedModeCheck(ResolutionDartType type) {
           if (!type.isDynamic) {
             typeUses.add(new TypeUse.checkedModeCheck(type));
           }
         }
 
-        FunctionType type = constructor.type;
+        ResolutionFunctionType type = constructor.type;
         // TODO(johnniwinther): Remove this substitution when synthesized
         // constructors handle type variables correctly.
         type = type.substByContext(constructor.enclosingClass
diff --git a/pkg/compiler/lib/src/serialization/type_serialization.dart b/pkg/compiler/lib/src/serialization/type_serialization.dart
index 96f659e..c5f68c8 100644
--- a/pkg/compiler/lib/src/serialization/type_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/type_serialization.dart
@@ -4,32 +4,35 @@
 
 library dart2js.serialization.types;
 
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import 'keys.dart';
 import 'serialization.dart';
 
-/// Visitor that serializes a [DartType] by encoding it into an [ObjectEncoder].
+/// Visitor that serializes a [ResolutionDartType] by encoding it into an
+/// [ObjectEncoder].
 ///
-/// This class is called from the [Serializer] when a [DartType] needs
+/// This class is called from the [Serializer] when a [ResolutionDartType] needs
 /// serialization. The [ObjectEncoder] ensures that any [Element], and other
-/// [DartType] that the serialized [DartType] depends upon are also serialized.
+/// [ResolutionDartType] that the serialized [ResolutionDartType] depends upon
+/// are also serialized.
 class TypeSerializer extends DartTypeVisitor<dynamic, ObjectEncoder> {
   const TypeSerializer();
 
-  void visitType(DartType type, ObjectEncoder encoder) {
+  void visitType(ResolutionDartType type, ObjectEncoder encoder) {
     throw new UnsupportedError('Unsupported type: $type');
   }
 
-  void visitVoidType(VoidType type, ObjectEncoder encoder) {}
+  void visitVoidType(ResolutionVoidType type, ObjectEncoder encoder) {}
 
-  void visitTypeVariableType(TypeVariableType type, ObjectEncoder encoder) {
+  void visitTypeVariableType(
+      ResolutionTypeVariableType type, ObjectEncoder encoder) {
     encoder.setElement(Key.ELEMENT, type.element);
     encoder.setBool(
         Key.IS_METHOD_TYPE_VARIABLE_TYPE, type is MethodTypeVariableType);
   }
 
-  void visitFunctionType(FunctionType type, ObjectEncoder encoder) {
+  void visitFunctionType(ResolutionFunctionType type, ObjectEncoder encoder) {
     // TODO(johnniwinther): Support encoding of `type.element`.
     encoder.setType(Key.RETURN_TYPE, type.returnType);
     encoder.setTypes(Key.PARAMETER_TYPES, type.parameterTypes);
@@ -42,61 +45,61 @@
     encoder.setElement(Key.ELEMENT, type.element);
   }
 
-  void visitInterfaceType(InterfaceType type, ObjectEncoder encoder) {
+  void visitInterfaceType(ResolutionInterfaceType type, ObjectEncoder encoder) {
     encoder.setElement(Key.ELEMENT, type.element);
     encoder.setTypes(Key.TYPE_ARGUMENTS, type.typeArguments);
   }
 
-  void visitTypedefType(TypedefType type, ObjectEncoder encoder) {
+  void visitTypedefType(ResolutionTypedefType type, ObjectEncoder encoder) {
     encoder.setElement(Key.ELEMENT, type.element);
     encoder.setTypes(Key.TYPE_ARGUMENTS, type.typeArguments);
   }
 
-  void visitDynamicType(DynamicType type, ObjectEncoder encoder) {}
+  void visitDynamicType(ResolutionDynamicType type, ObjectEncoder encoder) {}
 }
 
-/// Utility class for deserializing [DartType]s.
+/// Utility class for deserializing [ResolutionDartType]s.
 ///
 /// This is used by the [Deserializer].
 class TypeDeserializer {
-  /// Deserializes a [DartType] from an [ObjectDecoder].
+  /// Deserializes a [ResolutionDartType] from an [ObjectDecoder].
   ///
-  /// The class is called from the [Deserializer] when a [DartType] needs
-  /// deserialization. The [ObjectDecoder] ensures that any [Element], other
-  /// [DartType] that the deserialized [DartType] depends upon are available.
-  static DartType deserialize(ObjectDecoder decoder) {
-    TypeKind typeKind = decoder.getEnum(Key.KIND, TypeKind.values);
+  /// The class is called from the [Deserializer] when a [ResolutionDartType]
+  /// needs deserialization. The [ObjectDecoder] ensures that any [Element],
+  /// other [ResolutionDartType] that the deserialized [ResolutionDartType]
+  /// depends upon are available.
+  static ResolutionDartType deserialize(ObjectDecoder decoder) {
+    ResolutionTypeKind typeKind =
+        decoder.getEnum(Key.KIND, ResolutionTypeKind.values);
     switch (typeKind) {
-      case TypeKind.INTERFACE:
-        return new InterfaceType(decoder.getElement(Key.ELEMENT),
+      case ResolutionTypeKind.INTERFACE:
+        return new ResolutionInterfaceType(decoder.getElement(Key.ELEMENT),
             decoder.getTypes(Key.TYPE_ARGUMENTS, isOptional: true));
-      case TypeKind.FUNCTION:
+      case ResolutionTypeKind.FUNCTION:
         // TODO(johnniwinther): Support decoding of `type.element`.
-        return new FunctionType.synthesized(
+        return new ResolutionFunctionType.synthesized(
             decoder.getType(Key.RETURN_TYPE),
             decoder.getTypes(Key.PARAMETER_TYPES, isOptional: true),
             decoder.getTypes(Key.OPTIONAL_PARAMETER_TYPES, isOptional: true),
             decoder.getStrings(Key.NAMED_PARAMETERS, isOptional: true),
             decoder.getTypes(Key.NAMED_PARAMETER_TYPES, isOptional: true));
-      case TypeKind.TYPE_VARIABLE:
+      case ResolutionTypeKind.TYPE_VARIABLE:
         TypeVariableElement element = decoder.getElement(Key.ELEMENT);
         if (decoder.getBool(Key.IS_METHOD_TYPE_VARIABLE_TYPE)) {
           return new MethodTypeVariableType(element);
         }
-        return new TypeVariableType(element);
-      case TypeKind.TYPEDEF:
-        return new TypedefType(decoder.getElement(Key.ELEMENT),
+        return new ResolutionTypeVariableType(element);
+      case ResolutionTypeKind.TYPEDEF:
+        return new ResolutionTypedefType(decoder.getElement(Key.ELEMENT),
             decoder.getTypes(Key.TYPE_ARGUMENTS, isOptional: true));
-      case TypeKind.STATEMENT:
-        throw new UnsupportedError("Unexpected type kind '${typeKind}.");
-      case TypeKind.MALFORMED_TYPE:
+      case ResolutionTypeKind.MALFORMED_TYPE:
         // TODO(johnniwinther): Do we need the 'userProvidedBadType' or maybe
         // just a toString of it?
         return new MalformedType(decoder.getElement(Key.ELEMENT), null);
-      case TypeKind.DYNAMIC:
-        return const DynamicType();
-      case TypeKind.VOID:
-        return const VoidType();
+      case ResolutionTypeKind.DYNAMIC:
+        return const ResolutionDynamicType();
+      case ResolutionTypeKind.VOID:
+        return const ResolutionVoidType();
     }
   }
 }
diff --git a/pkg/compiler/lib/src/serialization/values.dart b/pkg/compiler/lib/src/serialization/values.dart
index f23a6f0..cebbe18 100644
--- a/pkg/compiler/lib/src/serialization/values.dart
+++ b/pkg/compiler/lib/src/serialization/values.dart
@@ -7,7 +7,7 @@
 library dart2js.serialization.values;
 
 import '../constants/expressions.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import 'keys.dart';
 
@@ -49,7 +49,7 @@
 }
 
 class TypeValue implements Value {
-  final DartType type;
+  final ResolutionDartType type;
   final Value id;
 
   TypeValue(this.type, this.id);
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 2fee721..b49d87e6 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -15,8 +15,8 @@
 import '../constants/constant_system.dart';
 import '../constants/expressions.dart';
 import '../constants/values.dart';
-import '../core_types.dart' show CoreClasses;
-import '../dart_types.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/resolution_types.dart';
 import '../diagnostics/messages.dart' show Message, MessageTemplate;
 import '../dump_info.dart' show InfoReporter;
 import '../elements/elements.dart';
@@ -66,15 +66,16 @@
 
   DiagnosticReporter get reporter => compiler.reporter;
 
-  HGraph build(CodegenWorkItem work) {
+  HGraph build(CodegenWorkItem work, ClosedWorld closedWorld) {
     return measure(() {
-      Element element = work.element.implementation;
+      MemberElement element = work.element.implementation;
       return reporter.withCurrentElement(element, () {
         SsaBuilder builder = new SsaBuilder(
             work.element.implementation,
             work.resolvedAst,
             work.registry,
             backend,
+            closedWorld,
             emitter.nativeEmitter,
             sourceInformationFactory);
         HGraph graph = builder.build();
@@ -82,7 +83,7 @@
         // Default arguments are handled elsewhere, but we must ensure
         // that the default values are computed during codegen.
         if (!identical(element.kind, ElementKind.FIELD)) {
-          FunctionElement function = element;
+          MethodElement function = element;
           FunctionSignature signature = function.functionSignature;
           signature.forEachOptionalParameter((ParameterElement parameter) {
             // This ensures the default value will be computed.
@@ -91,7 +92,7 @@
             work.registry.registerCompileTimeConstant(constant);
           });
         }
-        if (compiler.tracer.isEnabled) {
+        if (backend.tracer.isEnabled) {
           String name;
           if (element.isClassMember) {
             String className = element.enclosingClass.name;
@@ -103,8 +104,8 @@
           } else {
             name = "${element.name}";
           }
-          compiler.tracer.traceCompilation(name);
-          compiler.tracer.traceGraph('builder', graph);
+          backend.tracer.traceCompilation(name);
+          backend.tracer.traceGraph('builder', graph);
         }
         return graph;
       });
@@ -126,7 +127,8 @@
         GraphBuilder
     implements SemanticSendVisitor {
   /// The element for which this SSA builder is being used.
-  final Element target;
+  final MemberElement target;
+  final ClosedWorld closedWorld;
 
   ResolvedAst resolvedAst;
 
@@ -175,7 +177,7 @@
    * This stack contains declaration elements of the functions being built
    * or inlined by this builder.
    */
-  final List<Element> sourceElementStack = <Element>[];
+  final List<MemberElement> sourceElementStack = <MemberElement>[];
 
   HInstruction rethrowableException;
 
@@ -198,6 +200,7 @@
       this.resolvedAst,
       this.registry,
       JavaScriptBackend backend,
+      this.closedWorld,
       this.nativeEmitter,
       SourceInformationStrategy sourceInformationFactory)
       : this.infoReporter = backend.compiler.dumpInfoTask,
@@ -226,7 +229,7 @@
 
   DiagnosticReporter get reporter => compiler.reporter;
 
-  CoreClasses get coreClasses => compiler.coreClasses;
+  CommonElements get commonElements => closedWorld.commonElements;
 
   Element get targetElement => target;
 
@@ -252,7 +255,7 @@
   // TODO(johnniwinther): Check that all usages of sourceElement agree on
   // implementation/declaration distinction.
   @override
-  Element get sourceElement => sourceElementStack.last;
+  MemberElement get sourceElement => sourceElementStack.last;
 
   /// Helper to retrieve global inference results for [element] with special
   /// care for `ConstructorBodyElement`s which don't exist at the time the
@@ -299,7 +302,7 @@
   }
 
   HTypeConversion buildFunctionTypeConversion(
-      HInstruction original, DartType type, int kind) {
+      HInstruction original, ResolutionDartType type, int kind) {
     HInstruction reifiedType = buildFunctionType(type);
     return new HTypeConversion.viaMethodOnType(
         type, kind, original.instructionType, reifiedType, original);
@@ -347,7 +350,7 @@
    * [selector]) in a specific order (see [addDynamicSendArgumentsToList]).
    */
   List<HInstruction> completeDynamicSendArgumentsList(Selector selector,
-      FunctionElement function, List<HInstruction> providedArguments) {
+      MethodElement function, List<HInstruction> providedArguments) {
     assert(selector.applies(function));
     FunctionSignature signature = function.functionSignature;
     List<HInstruction> compiledArguments = new List<HInstruction>(
@@ -406,9 +409,9 @@
    */
   bool tryInlineMethod(Element element, Selector selector, TypeMask mask,
       List<HInstruction> providedArguments, ast.Node currentNode,
-      {InterfaceType instanceType}) {
+      {ResolutionInterfaceType instanceType}) {
     registry
-        .addImpact(backend.registerStaticUse(element, forResolution: false));
+        .addImpact(backend.registerUsedElement(element, forResolution: false));
 
     if (backend.isJsInterop(element) && !element.isFactoryConstructor) {
       // We only inline factory JavaScript interop constructors.
@@ -420,7 +423,7 @@
 
     if (compiler.elementHasCompileTimeError(element)) return false;
 
-    FunctionElement function = element;
+    MethodElement function = element;
     ResolvedAst functionResolvedAst = function.resolvedAst;
     bool insideLoop = loopDepth > 0 || graph.calledInLoop;
 
@@ -434,24 +437,23 @@
       if (compiler.options.disableInlining) return false;
 
       assert(invariant(
-          currentNode != null ? currentNode : element,
+          currentNode != null ? currentNode : function,
           selector != null ||
-              Elements.isStaticOrTopLevel(element) ||
-              element.isGenerativeConstructorBody,
-          message: "Missing selector for inlining of $element."));
+              Elements.isStaticOrTopLevel(function) ||
+              function.isGenerativeConstructorBody,
+          message: "Missing selector for inlining of $function."));
       if (selector != null) {
         if (!selector.applies(function)) return false;
-        if (mask != null &&
-            !mask.canHit(function, selector, compiler.closedWorld)) {
+        if (mask != null && !mask.canHit(function, selector, closedWorld)) {
           return false;
         }
       }
 
-      if (backend.isJsInterop(element)) return false;
+      if (backend.isJsInterop(function)) return false;
 
       // Don't inline operator== methods if the parameter can be null.
-      if (element.name == '==') {
-        if (element.enclosingClass != coreClasses.objectClass &&
+      if (function.name == '==') {
+        if (function.enclosingClass != commonElements.objectClass &&
             providedArguments[1].canBeNull()) {
           return false;
         }
@@ -459,15 +461,15 @@
 
       // Generative constructors of native classes should not be called directly
       // and have an extra argument that causes problems with inlining.
-      if (element.isGenerativeConstructor &&
-          backend.isNativeOrExtendsNative(element.enclosingClass)) {
+      if (function.isGenerativeConstructor &&
+          backend.isNativeOrExtendsNative(function.enclosingClass)) {
         return false;
       }
 
       // A generative constructor body is not seen by global analysis,
       // so we should not query for its type.
-      if (!element.isGenerativeConstructorBody) {
-        if (inferenceResults.resultOf(element).throwsAlways) {
+      if (!function.isGenerativeConstructorBody) {
+        if (inferenceResults.resultOf(function).throwsAlways) {
           isReachable = false;
           return false;
         }
@@ -485,7 +487,7 @@
     bool reductiveHeuristic() {
       // The call is on a path which is executed rarely, so inline only if it
       // does not make the program larger.
-      if (isCalledOnce(element)) {
+      if (isCalledOnce(function)) {
         return InlineWeeder.canBeInlined(functionResolvedAst, -1, false,
             enableUserAssertions: compiler.options.enableUserAssertions);
       }
@@ -505,12 +507,12 @@
         return false;
       }
 
-      if (element.isSynthesized) return true;
+      if (function.isSynthesized) return true;
 
       // Don't inline across deferred import to prevent leaking code. The only
       // exception is an empty function (which does not contain code).
       bool hasOnlyNonDeferredImportPaths = compiler.deferredLoadTask
-          .hasOnlyNonDeferredImportPaths(compiler.currentElement, element);
+          .hasOnlyNonDeferredImportPaths(compiler.currentElement, function);
 
       if (!hasOnlyNonDeferredImportPaths) {
         return doesNotContainCode();
@@ -544,7 +546,7 @@
       // If a method is called only once, and all the methods in the
       // inlining stack are called only once as well, we know we will
       // save on output size by inlining this method.
-      if (isCalledOnce(element)) {
+      if (isCalledOnce(function)) {
         useMaxInliningNodes = false;
       }
       bool canInline;
@@ -552,9 +554,10 @@
           functionResolvedAst, maxInliningNodes, useMaxInliningNodes,
           enableUserAssertions: compiler.options.enableUserAssertions);
       if (canInline) {
-        backend.inlineCache.markAsInlinable(element, insideLoop: insideLoop);
+        backend.inlineCache.markAsInlinable(function, insideLoop: insideLoop);
       } else {
-        backend.inlineCache.markAsNonInlinable(element, insideLoop: insideLoop);
+        backend.inlineCache
+            .markAsNonInlinable(function, insideLoop: insideLoop);
       }
       return canInline;
     }
@@ -563,11 +566,11 @@
       // Add an explicit null check on the receiver before doing the
       // inlining. We use [element] to get the same name in the
       // NoSuchMethodError message as if we had called it.
-      if (element.isInstanceMember &&
-          !element.isGenerativeConstructorBody &&
+      if (function.isInstanceMember &&
+          !function.isGenerativeConstructorBody &&
           (mask == null || mask.isNullable)) {
         addWithPosition(
-            new HFieldGet(null, providedArguments[0], backend.dynamicType,
+            new HFieldGet(null, providedArguments[0], commonMasks.dynamicType,
                 isAssignable: false),
             currentNode);
       }
@@ -577,7 +580,7 @@
           instanceType: instanceType);
       inlinedFrom(functionResolvedAst, () {
         if (!isReachable) {
-          emitReturn(graph.addConstantNull(compiler), null);
+          emitReturn(graph.addConstantNull(closedWorld), null);
         } else {
           doInline(functionResolvedAst);
         }
@@ -587,7 +590,7 @@
 
     if (meetsHardConstraints() && heuristicSayGoodToGo()) {
       doInlining();
-      infoReporter?.reportInlined(element,
+      infoReporter?.reportInlined(function,
           inliningStack.isEmpty ? target : inliningStack.last.function);
       return true;
     }
@@ -599,18 +602,18 @@
     return inliningStack.isEmpty || inliningStack.last.allFunctionsCalledOnce;
   }
 
-  bool isFunctionCalledOnce(element) {
+  bool isFunctionCalledOnce(MethodElement element) {
     // ConstructorBodyElements are not in the type inference graph.
     if (element is ConstructorBodyElement) return false;
     return inferenceResults.resultOf(element).isCalledOnce;
   }
 
-  bool isCalledOnce(Element element) {
+  bool isCalledOnce(MethodElement element) {
     return allInlinedFunctionsCalledOnce && isFunctionCalledOnce(element);
   }
 
   inlinedFrom(ResolvedAst resolvedAst, f()) {
-    Element element = resolvedAst.element;
+    MemberElement element = resolvedAst.element;
     assert(element is FunctionElement || element is VariableElement);
     return reporter.withCurrentElement(element.implementation, () {
       // The [sourceElementStack] contains declaration elements.
@@ -638,7 +641,7 @@
         backend.constants.getConstantValue(parameter.constant);
     assert(invariant(parameter, constantValue != null,
         message: 'No constant computed for $parameter'));
-    return graph.addConstant(constantValue, compiler);
+    return graph.addConstant(constantValue, closedWorld);
   }
 
   ClassElement get currentNonClosureClass {
@@ -651,20 +654,19 @@
     }
   }
 
-  /// A stack of [DartType]s that have been seen during inlining of factory
-  /// constructors.  These types are preserved in [HInvokeStatic]s and
+  /// A stack of [ResolutionDartType]s that have been seen during inlining of
+  /// factory constructors.  These types are preserved in [HInvokeStatic]s and
   /// [HCreate]s inside the inline code and registered during code generation
   /// for these nodes.
   // TODO(karlklose): consider removing this and keeping the (substituted) types
   // of the type variables in an environment (like the [LocalsHandler]).
-  final List<DartType> currentInlinedInstantiations = <DartType>[];
+  final List<ResolutionDartType> currentInlinedInstantiations =
+      <ResolutionDartType>[];
 
   final List<AstInliningState> inliningStack = <AstInliningState>[];
 
   Local returnLocal;
-  DartType returnType;
-
-  bool inTryStatement = false;
+  ResolutionDartType returnType;
 
   ConstantValue getConstantForNode(ast.Node node) {
     ConstantValue constantValue =
@@ -675,7 +677,7 @@
   }
 
   HInstruction addConstant(ast.Node node) {
-    return graph.addConstant(getConstantForNode(node), compiler);
+    return graph.addConstant(getConstantForNode(node), closedWorld);
   }
 
   /**
@@ -683,9 +685,9 @@
    *
    * Invariant: [functionElement] must be an implementation element.
    */
-  HGraph buildMethod(FunctionElement functionElement) {
+  HGraph buildMethod(MethodElement functionElement) {
     assert(invariant(functionElement, functionElement.isImplementation));
-    graph.calledInLoop = compiler.closedWorld.isCalledInLoop(functionElement);
+    graph.calledInLoop = closedWorld.isCalledInLoop(functionElement);
     ast.FunctionExpression function = resolvedAst.node;
     assert(function != null);
     assert(elements.getFunctionDefinition(function) != null);
@@ -710,12 +712,12 @@
             node: function,
             visitCondition: () {
               HParameterValue parameter = parameters.values.first;
-              push(new HIdentity(parameter, graph.addConstantNull(compiler),
-                  null, backend.boolType));
+              push(new HIdentity(parameter, graph.addConstantNull(closedWorld),
+                  null, commonMasks.boolType));
             },
             visitThen: () {
               closeAndGotoExit(new HReturn(
-                  graph.addConstantBool(false, compiler),
+                  graph.addConstantBool(false, closedWorld),
                   sourceInformationBuilder
                       .buildImplicitReturn(functionElement)));
             },
@@ -744,7 +746,7 @@
   // TODO(sra): Figure out how to keep comment anchored without effects.
   void addComment(String text) {
     add(new HForeignCode(js.js.statementTemplateYielding(new js.Comment(text)),
-        backend.dynamicType, <HInstruction>[],
+        commonMasks.dynamicType, <HInstruction>[],
         isStatement: true));
   }
 
@@ -754,7 +756,8 @@
     HInstruction thisInstruction = localsHandler.readThis();
     // Use dynamic type because the type computed by the inferrer is
     // narrowed to the type annotation.
-    HInstruction parameter = new HParameterValue(field, backend.dynamicType);
+    HInstruction parameter =
+        new HParameterValue(field, commonMasks.dynamicType);
     // Add the parameter as the last instruction of the entry block.
     // If the method is intercepted, we want the actual receiver
     // to be the first parameter.
@@ -765,7 +768,7 @@
     return closeFunction();
   }
 
-  HGraph buildLazyInitializer(VariableElement variable) {
+  HGraph buildLazyInitializer(FieldElement variable) {
     assert(invariant(variable, resolvedAst.element == variable,
         message: "Unexpected variable $variable for $resolvedAst."));
     inLazyInitializerExpression = true;
@@ -795,53 +798,6 @@
   }
 
   /**
-   * Returns the constructor body associated with the given constructor or
-   * creates a new constructor body, if none can be found.
-   *
-   * Returns [:null:] if the constructor does not have a body.
-   */
-  ConstructorBodyElement getConstructorBody(
-      ResolvedAst constructorResolvedAst) {
-    ConstructorElement constructor =
-        constructorResolvedAst.element.implementation;
-    assert(constructor.isGenerativeConstructor);
-    if (constructorResolvedAst.kind != ResolvedAstKind.PARSED) return null;
-
-    ast.FunctionExpression node = constructorResolvedAst.node;
-    // If we know the body doesn't have any code, we don't generate it.
-    if (!node.hasBody) return null;
-    if (node.hasEmptyBody) return null;
-    ClassElement classElement = constructor.enclosingClass;
-    ConstructorBodyElement bodyElement;
-    classElement.forEachBackendMember((Element backendMember) {
-      if (backendMember.isGenerativeConstructorBody) {
-        ConstructorBodyElement body = backendMember;
-        if (body.constructor == constructor) {
-          // TODO(kasperl): Find a way of stopping the iteration
-          // through the backend members.
-          bodyElement = backendMember;
-        }
-      }
-    });
-    if (bodyElement == null) {
-      bodyElement =
-          new ConstructorBodyElementX(constructorResolvedAst, constructor);
-      classElement.addBackendMember(bodyElement);
-
-      if (constructor.isPatch) {
-        // Create origin body element for patched constructors.
-        ConstructorBodyElementX patch = bodyElement;
-        ConstructorBodyElementX origin = new ConstructorBodyElementX(
-            constructorResolvedAst, constructor.origin);
-        origin.applyPatch(patch);
-        classElement.origin.addBackendMember(bodyElement.origin);
-      }
-    }
-    assert(bodyElement.isGenerativeConstructorBody);
-    return bodyElement;
-  }
-
-  /**
    * This method sets up the local state of the builder for inlining [function].
    * The arguments of the function are inserted into the [localsHandler].
    *
@@ -852,14 +808,14 @@
    */
   void setupStateForInlining(
       FunctionElement function, List<HInstruction> compiledArguments,
-      {InterfaceType instanceType}) {
+      {ResolutionInterfaceType instanceType}) {
     ResolvedAst resolvedAst = function.resolvedAst;
     assert(resolvedAst != null);
     localsHandler = new LocalsHandler(this, function, instanceType, compiler);
     localsHandler.closureData =
         compiler.closureToClassMapper.getClosureToClassMapping(resolvedAst);
     returnLocal = new SyntheticLocal("result", function);
-    localsHandler.updateLocal(returnLocal, graph.addConstantNull(compiler));
+    localsHandler.updateLocal(returnLocal, graph.addConstantNull(closedWorld));
 
     inTryStatement = false; // TODO(lry): why? Document.
 
@@ -878,7 +834,8 @@
     ClassElement enclosing = function.enclosingClass;
     if ((function.isConstructor || function.isGenerativeConstructorBody) &&
         backend.classNeedsRti(enclosing)) {
-      enclosing.typeVariables.forEach((TypeVariableType typeVariable) {
+      enclosing.typeVariables
+          .forEach((ResolutionTypeVariableType typeVariable) {
         HInstruction argument = compiledArguments[argumentIndex++];
         localsHandler.updateLocal(
             localsHandler.getTypeVariableAsLocal(typeVariable), argument);
@@ -919,13 +876,13 @@
     }
   }
 
-  addInlinedInstantiation(DartType type) {
+  addInlinedInstantiation(ResolutionDartType type) {
     if (type != null) {
       currentInlinedInstantiations.add(type);
     }
   }
 
-  removeInlinedInstantiation(DartType type) {
+  removeInlinedInstantiation(ResolutionDartType type) {
     if (type != null) {
       currentInlinedInstantiations.removeLast();
     }
@@ -964,16 +921,17 @@
         // [currentClass]. For a redirecting constructor, the type is
         // the current type. [InterfaceType.asInstanceOf] takes care
         // of both.
-        InterfaceType type = currentClass.thisType.asInstanceOf(enclosingClass);
+        ResolutionInterfaceType type =
+            currentClass.thisType.asInstanceOf(enclosingClass);
         type = localsHandler.substInContext(type);
-        List<DartType> arguments = type.typeArguments;
-        List<DartType> typeVariables = enclosingClass.typeVariables;
+        List<ResolutionDartType> arguments = type.typeArguments;
+        List<ResolutionDartType> typeVariables = enclosingClass.typeVariables;
         if (!type.isRaw) {
           assert(arguments.length == typeVariables.length);
-          Iterator<DartType> variables = typeVariables.iterator;
-          type.typeArguments.forEach((DartType argument) {
+          Iterator<ResolutionDartType> variables = typeVariables.iterator;
+          type.typeArguments.forEach((ResolutionDartType argument) {
             variables.moveNext();
-            TypeVariableType typeVariable = variables.current;
+            ResolutionTypeVariableType typeVariable = variables.current;
             localsHandler.updateLocal(
                 localsHandler.getTypeVariableAsLocal(typeVariable),
                 typeBuilder.analyzeTypeArgument(argument, sourceElement));
@@ -981,10 +939,10 @@
         } else {
           // If the supertype is a raw type, we need to set to null the
           // type variables.
-          for (TypeVariableType variable in typeVariables) {
+          for (ResolutionTypeVariableType variable in typeVariables) {
             localsHandler.updateLocal(
                 localsHandler.getTypeVariableAsLocal(variable),
-                graph.addConstantNull(compiler));
+                graph.addConstantNull(closedWorld));
           }
         }
       }
@@ -1063,7 +1021,7 @@
 
     ConstructorElement target = constructor.definingConstructor.implementation;
     bool match = !target.isMalformed &&
-        CallStructure.addForwardingElementArgumentsToList(
+        Elements.addForwardingElementArgumentsToList<HInstruction>(
             constructor,
             arguments,
             target,
@@ -1156,7 +1114,8 @@
           reporter.internalError(
               superClass, "No default constructor available.");
         }
-        List<HInstruction> arguments = CallStructure.NO_ARGS.makeArgumentsList(
+        List<HInstruction> arguments = Elements.makeArgumentsList<HInstruction>(
+            CallStructure.NO_ARGS,
             const Link<ast.Node>(),
             target.implementation,
             null,
@@ -1187,7 +1146,7 @@
           // Unassigned fields of native classes are not initialized to
           // prevent overwriting pre-initialized native properties.
           if (!backend.isNativeOrExtendsNative(classElement)) {
-            fieldValues[member] = graph.addConstantNull(compiler);
+            fieldValues[member] = graph.addConstantNull(closedWorld);
           }
         } else {
           ast.Node right = initializer;
@@ -1277,19 +1236,20 @@
             member, isNativeUpgradeFactory || compiler.compilationFailed));
       } else {
         fields.add(member);
-        DartType type = localsHandler.substInContext(member.type);
+        ResolutionDartType type = localsHandler.substInContext(member.type);
         constructorArguments
             .add(typeBuilder.potentiallyCheckOrTrustType(value, type));
       }
     }, includeSuperAndInjectedMembers: true);
 
-    InterfaceType type = classElement.thisType;
-    TypeMask ssaType = new TypeMask.nonNullExact(
-        classElement.declaration, compiler.closedWorld);
-    List<DartType> instantiatedTypes;
+    ResolutionInterfaceType type = classElement.thisType;
+    TypeMask ssaType =
+        new TypeMask.nonNullExact(classElement.declaration, closedWorld);
+    List<ResolutionDartType> instantiatedTypes;
     addInlinedInstantiation(type);
     if (!currentInlinedInstantiations.isEmpty) {
-      instantiatedTypes = new List<DartType>.from(currentInlinedInstantiations);
+      instantiatedTypes =
+          new List<ResolutionDartType>.from(currentInlinedInstantiations);
     }
 
     HInstruction newObject;
@@ -1301,7 +1261,8 @@
         // HTypeInfoExpression to set on the newly create object.
         hasRtiInput = true;
         List<HInstruction> typeArguments = <HInstruction>[];
-        classElement.typeVariables.forEach((TypeVariableType typeVariable) {
+        classElement.typeVariables
+            .forEach((ResolutionTypeVariableType typeVariable) {
           HInstruction argument = localsHandler
               .readLocal(localsHandler.getTypeVariableAsLocal(typeVariable));
           typeArguments.add(argument);
@@ -1311,7 +1272,7 @@
             TypeInfoExpressionKind.INSTANCE,
             classElement.thisType,
             typeArguments,
-            backend.dynamicType);
+            commonMasks.dynamicType);
         add(typeInfo);
         constructorArguments.add(typeInfo);
       }
@@ -1331,7 +1292,7 @@
       // Null guard ensures an error if we are being called from an explicit
       // 'new' of the constructor instead of via an upgrade. It is optimized out
       // if there are field initializers.
-      add(new HFieldGet(null, newObject, backend.dynamicType,
+      add(new HFieldGet(null, newObject, commonMasks.dynamicType,
           isAssignable: false));
       for (int i = 0; i < fields.length; i++) {
         add(new HFieldSet(fields[i], newObject, constructorArguments[i]));
@@ -1343,15 +1304,15 @@
     HInstruction interceptor = null;
     for (int index = constructorResolvedAsts.length - 1; index >= 0; index--) {
       ResolvedAst constructorResolvedAst = constructorResolvedAsts[index];
-      ConstructorBodyElement body = getConstructorBody(constructorResolvedAst);
+      ConstructorBodyElement body =
+          ConstructorBodyElementX.createFromResolvedAst(constructorResolvedAst);
       if (body == null) continue;
 
       List bodyCallInputs = <HInstruction>[];
       if (isNativeUpgradeFactory) {
         if (interceptor == null) {
-          ConstantValue constant =
-              new InterceptorConstantValue(classElement.thisType);
-          interceptor = graph.addConstant(constant, compiler);
+          ConstantValue constant = new InterceptorConstantValue(classElement);
+          interceptor = graph.addConstant(constant, closedWorld);
         }
         bodyCallInputs.add(interceptor);
       }
@@ -1385,7 +1346,8 @@
       if (backend.classNeedsRti(currentClass)) {
         // If [currentClass] needs RTI, we add the type variables as
         // parameters of the generative constructor body.
-        currentClass.typeVariables.forEach((TypeVariableType argument) {
+        currentClass.typeVariables
+            .forEach((ResolutionTypeVariableType argument) {
           // TODO(johnniwinther): Substitute [argument] with
           // `localsHandler.substInContext(argument)`.
           bodyCallInputs.add(localsHandler
@@ -1398,9 +1360,8 @@
         pop();
       } else {
         HInvokeConstructorBody invoke = new HInvokeConstructorBody(
-            body.declaration, bodyCallInputs, backend.nonNullType);
-        invoke.sideEffects =
-            compiler.closedWorld.getSideEffectsOfElement(constructor);
+            body.declaration, bodyCallInputs, commonMasks.nonNullType);
+        invoke.sideEffects = closedWorld.getSideEffectsOfElement(constructor);
         add(invoke);
       }
     }
@@ -1435,9 +1396,10 @@
     var enclosing = element.enclosingElement;
     if ((element.isConstructor || element.isGenerativeConstructorBody) &&
         backend.classNeedsRti(enclosing)) {
-      enclosing.typeVariables.forEach((TypeVariableType typeVariable) {
+      enclosing.typeVariables
+          .forEach((ResolutionTypeVariableType typeVariable) {
         HParameterValue param =
-            addParameter(typeVariable.element, backend.nonNullType);
+            addParameter(typeVariable.element, commonMasks.nonNullType);
         localsHandler.directLocals[
             localsHandler.getTypeVariableAsLocal(typeVariable)] = param;
       });
@@ -1501,7 +1463,7 @@
           "${n(element)}";
       HConstant nameConstant = addConstantString(name);
       add(new HInvokeStatic(backend.helpers.traceHelper,
-          <HInstruction>[nameConstant], backend.dynamicType));
+          <HInstruction>[nameConstant], commonMasks.dynamicType));
     }
   }
 
@@ -1509,21 +1471,22 @@
     if (JavaScriptBackend.TRACE_METHOD == 'post') {
       if (element == backend.helpers.traceHelper) return;
       // TODO(sigmund): create a better uuid for elements.
-      HConstant idConstant = graph.addConstantInt(element.hashCode, compiler);
+      HConstant idConstant =
+          graph.addConstantInt(element.hashCode, closedWorld);
       HConstant nameConstant = addConstantString(element.name);
       add(new HInvokeStatic(backend.helpers.traceHelper,
-          <HInstruction>[idConstant, nameConstant], backend.dynamicType));
+          <HInstruction>[idConstant, nameConstant], commonMasks.dynamicType));
     }
   }
 
-  void assertIsSubtype(
-      ast.Node node, DartType subtype, DartType supertype, String message) {
+  void assertIsSubtype(ast.Node node, ResolutionDartType subtype,
+      ResolutionDartType supertype, String message) {
     HInstruction subtypeInstruction = typeBuilder.analyzeTypeArgument(
         localsHandler.substInContext(subtype), sourceElement);
     HInstruction supertypeInstruction = typeBuilder.analyzeTypeArgument(
         localsHandler.substInContext(supertype), sourceElement);
-    HInstruction messageInstruction =
-        graph.addConstantString(new ast.DartString.literal(message), compiler);
+    HInstruction messageInstruction = graph.addConstantString(
+        new ast.DartString.literal(message), closedWorld);
     MethodElement element = helpers.assertIsSubtype;
     var inputs = <HInstruction>[
       subtypeInstruction,
@@ -1554,11 +1517,11 @@
   HInstruction popBoolified() {
     HInstruction value = pop();
     if (typeBuilder.checkOrTrustTypes) {
-      return typeBuilder.potentiallyCheckOrTrustType(
-          value, compiler.coreTypes.boolType,
+      ResolutionInterfaceType boolType = compiler.commonElements.boolType;
+      return typeBuilder.potentiallyCheckOrTrustType(value, boolType,
           kind: HTypeConversion.BOOLEAN_CONVERSION_CHECK);
     }
-    HInstruction result = new HBoolify(value, backend.boolType);
+    HInstruction result = new HBoolify(value, commonMasks.boolType);
     add(result);
     return result;
   }
@@ -1675,7 +1638,7 @@
 
     HInstruction buildCondition() {
       if (node.condition == null) {
-        return graph.addConstantBool(true, compiler);
+        return graph.addConstantBool(true, closedWorld);
       }
       visit(node.condition);
       return popBoolified();
@@ -1767,7 +1730,7 @@
         localsHandler =
             savedLocals.mergeMultiple(continueHandlers, conditionBlock);
         SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock);
-        List<LabelDefinition> labels = jumpHandler.labels();
+        List<LabelDefinition> labels = jumpHandler.labels;
         HSubGraphBlockInformation bodyInfo =
             new HSubGraphBlockInformation(bodyGraph);
         HLabeledBlockInformation info;
@@ -1871,8 +1834,7 @@
       capturedVariables.add(localsHandler.readLocal(capturedLocal));
     });
 
-    TypeMask type =
-        new TypeMask.nonNullExact(closureClassElement, compiler.closedWorld);
+    TypeMask type = new TypeMask.nonNullExact(closureClassElement, closedWorld);
     push(new HCreate(closureClassElement, capturedVariables, type)
       ..sourceInformation = sourceInformationBuilder.buildCreate(node));
 
@@ -1901,6 +1863,17 @@
     }
   }
 
+  void handleIf(
+      {ast.Node node,
+      void visitCondition(),
+      void visitThen(),
+      void visitElse(),
+      SourceInformation sourceInformation}) {
+    SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this, compiler, node);
+    branchBuilder.handleIf(visitCondition, visitThen, visitElse,
+        sourceInformation: sourceInformation);
+  }
+
   visitIf(ast.If node) {
     assert(isReachable);
     handleIf(
@@ -1976,7 +1949,7 @@
     visit(expression);
     SourceInformation sourceInformation =
         sourceInformationBuilder.buildGeneric(node);
-    push(new HNot(popBoolified(), backend.boolType)
+    push(new HNot(popBoolified(), commonMasks.boolType)
       ..sourceInformation = sourceInformation);
   }
 
@@ -1992,7 +1965,7 @@
       HConstant constant = operand;
       ConstantValue folded = operation.fold(constant.constant);
       if (folded != null) {
-        stack.add(graph.addConstant(folded, compiler));
+        stack.add(graph.addConstant(folded, closedWorld));
         return;
       }
     }
@@ -2021,7 +1994,8 @@
   @override
   void visitNotEquals(ast.Send node, ast.Node left, ast.Node right, _) {
     handleBinary(node, left, right);
-    pushWithPosition(new HNot(popBoolified(), backend.boolType), node.selector);
+    pushWithPosition(
+        new HNot(popBoolified(), commonMasks.boolType), node.selector);
   }
 
   void handleBinary(ast.Send node, ast.Node left, ast.Node right) {
@@ -2112,7 +2086,7 @@
       assert(invariant(node, element == null || element.isMalformed));
       // TODO(ahe): Do something like the above, that is, emit a runtime
       // error.
-      stack.add(graph.addConstantNull(compiler));
+      stack.add(graph.addConstantNull(closedWorld));
     }
   }
 
@@ -2126,19 +2100,19 @@
     PrefixElement prefix =
         compiler.deferredLoadTask.deferredPrefixElement(node, elements);
     if (prefix != null) {
-      instruction =
-          graph.addDeferredConstant(value, prefix, sourceInformation, compiler);
+      instruction = graph.addDeferredConstant(
+          value, prefix, sourceInformation, compiler, closedWorld);
     } else {
-      instruction = graph.addConstant(value, compiler,
+      instruction = graph.addConstant(value, closedWorld,
           sourceInformation: sourceInformation);
     }
     stack.add(instruction);
     // The inferrer may have found a better type than the constant
     // handler in the case of lists, because the constant handler
     // does not look at elements in the list.
-    TypeMask type = TypeMaskFactory.inferredTypeForElement(field, compiler);
-    if (!type.containsAll(compiler.closedWorld) &&
-        !instruction.isConstantNull()) {
+    TypeMask type =
+        TypeMaskFactory.inferredTypeForElement(field, globalInferenceResults);
+    if (!type.containsAll(closedWorld) && !instruction.isConstantNull()) {
       // TODO(13429): The inferrer should know that an element
       // cannot be null.
       instruction.instructionType = type.nonNullable();
@@ -2164,13 +2138,15 @@
         // TODO(5346): Try to avoid the need for calling [declaration] before
         // creating an [HStatic].
         HInstruction instruction = new HStatic(
-            field, TypeMaskFactory.inferredTypeForElement(field, compiler))
+            field,
+            TypeMaskFactory.inferredTypeForElement(
+                field, globalInferenceResults))
           ..sourceInformation = sourceInformation;
         push(instruction);
       }
     } else {
-      HInstruction instruction = new HLazyStatic(
-          field, TypeMaskFactory.inferredTypeForElement(field, compiler))
+      HInstruction instruction = new HLazyStatic(field,
+          TypeMaskFactory.inferredTypeForElement(field, globalInferenceResults))
         ..sourceInformation = sourceInformation;
       push(instruction);
     }
@@ -2202,7 +2178,7 @@
     // creating an [HStatic].
     SourceInformation sourceInformation =
         sourceInformationBuilder.buildGet(node);
-    push(new HStatic(method, backend.nonNullType)
+    push(new HStatic(method, commonMasks.nonNullType)
       ..sourceInformation = sourceInformation);
   }
 
@@ -2354,7 +2330,7 @@
       generateNoSuchSetter(location, element, send == null ? null : value);
     } else if (Elements.isMalformed(element)) {
       // TODO(ahe): Do something like [generateWrongArgumentCountError].
-      stack.add(graph.addConstantNull(compiler));
+      stack.add(graph.addConstantNull(closedWorld));
     } else {
       stack.add(value);
       LocalElement local = element;
@@ -2376,17 +2352,18 @@
   }
 
   HInstruction invokeInterceptor(HInstruction receiver) {
-    HInterceptor interceptor = new HInterceptor(receiver, backend.nonNullType);
+    HInterceptor interceptor =
+        new HInterceptor(receiver, commonMasks.nonNullType);
     add(interceptor);
     return interceptor;
   }
 
   HLiteralList buildLiteralList(List<HInstruction> inputs) {
-    return new HLiteralList(inputs, backend.extendableArrayType);
+    return new HLiteralList(inputs, commonMasks.extendableArrayType);
   }
 
   @override
-  void visitAs(ast.Send node, ast.Node expression, DartType type, _) {
+  void visitAs(ast.Send node, ast.Node expression, ResolutionDartType type, _) {
     HInstruction expressionInstruction = visitAndPop(expression);
     if (type.isMalformed) {
       if (type is MalformedType) {
@@ -2407,21 +2384,22 @@
   }
 
   @override
-  void visitIs(ast.Send node, ast.Node expression, DartType type, _) {
+  void visitIs(ast.Send node, ast.Node expression, ResolutionDartType type, _) {
     HInstruction expressionInstruction = visitAndPop(expression);
     push(buildIsNode(node, type, expressionInstruction));
   }
 
   @override
-  void visitIsNot(ast.Send node, ast.Node expression, DartType type, _) {
+  void visitIsNot(
+      ast.Send node, ast.Node expression, ResolutionDartType type, _) {
     HInstruction expressionInstruction = visitAndPop(expression);
     HInstruction instruction = buildIsNode(node, type, expressionInstruction);
     add(instruction);
-    push(new HNot(instruction, backend.boolType));
+    push(new HNot(instruction, commonMasks.boolType));
   }
 
   HInstruction buildIsNode(
-      ast.Node node, DartType type, HInstruction expression) {
+      ast.Node node, ResolutionDartType type, HInstruction expression) {
     type = localsHandler.substInContext(type).unaliased;
     if (type.isMalformed) {
       String message;
@@ -2435,7 +2413,7 @@
       }
       generateTypeError(node, message);
       HInstruction call = pop();
-      return new HIs.compound(type, expression, call, backend.boolType);
+      return new HIs.compound(type, expression, call, commonMasks.boolType);
     } else if (type.isFunctionType) {
       List arguments = [buildFunctionType(type), expression];
       pushInvokeDynamic(
@@ -2444,15 +2422,15 @@
               CallStructure.ONE_ARG),
           null,
           arguments);
-      return new HIs.compound(type, expression, pop(), backend.boolType);
+      return new HIs.compound(type, expression, pop(), commonMasks.boolType);
     } else if (type.isTypeVariable) {
       HInstruction runtimeType =
           typeBuilder.addTypeVariableReference(type, sourceElement);
       Element helper = helpers.checkSubtypeOfRuntimeType;
       List<HInstruction> inputs = <HInstruction>[expression, runtimeType];
-      pushInvokeStatic(null, helper, inputs, typeMask: backend.boolType);
+      pushInvokeStatic(null, helper, inputs, typeMask: commonMasks.boolType);
       HInstruction call = pop();
-      return new HIs.variable(type, expression, call, backend.boolType);
+      return new HIs.variable(type, expression, call, commonMasks.boolType);
     } else if (RuntimeTypes.hasTypeArguments(type)) {
       ClassElement element = type.element;
       Element helper = helpers.checkSubtype;
@@ -2461,27 +2439,26 @@
       add(representations);
       js.Name operator = backend.namer.operatorIs(element);
       HInstruction isFieldName = addConstantStringFromName(operator);
-      HInstruction asFieldName = compiler.closedWorld
-              .hasAnyStrictSubtype(element)
+      HInstruction asFieldName = closedWorld.hasAnyStrictSubtype(element)
           ? addConstantStringFromName(backend.namer.substitutionName(element))
-          : graph.addConstantNull(compiler);
+          : graph.addConstantNull(closedWorld);
       List<HInstruction> inputs = <HInstruction>[
         expression,
         isFieldName,
         representations,
         asFieldName
       ];
-      pushInvokeStatic(node, helper, inputs, typeMask: backend.boolType);
+      pushInvokeStatic(node, helper, inputs, typeMask: commonMasks.boolType);
       HInstruction call = pop();
-      return new HIs.compound(type, expression, call, backend.boolType);
+      return new HIs.compound(type, expression, call, commonMasks.boolType);
     } else {
       if (backend.hasDirectCheckFor(type)) {
-        return new HIs.direct(type, expression, backend.boolType);
+        return new HIs.direct(type, expression, commonMasks.boolType);
       }
       // The interceptor is not always needed.  It is removed by optimization
       // when the receiver type or tested type permit.
-      return new HIs.raw(
-          type, expression, invokeInterceptor(expression), backend.boolType);
+      return new HIs.raw(type, expression, invokeInterceptor(expression),
+          commonMasks.boolType);
     }
   }
 
@@ -2534,7 +2511,8 @@
       return pop();
     }
 
-    return callStructure.makeArgumentsList(
+    return Elements.makeArgumentsList<HInstruction>(
+        callStructure,
         arguments,
         element,
         compileArgument,
@@ -2666,7 +2644,8 @@
         'text': 'Mismatch between number of placeholders'
             ' and number of arguments.'
       });
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
@@ -2675,7 +2654,7 @@
     }
 
     TypeMask ssaType =
-        TypeMaskFactory.fromNativeBehavior(nativeBehavior, compiler);
+        TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
 
     SourceInformation sourceInformation =
         sourceInformationBuilder.buildCall(node, node.argumentsNode);
@@ -2698,7 +2677,7 @@
     if (inputs.length != 2) {
       reporter.internalError(node.argumentsNode, 'Two arguments expected.');
     }
-    push(new HStringConcat(inputs[0], inputs[1], backend.stringType));
+    push(new HStringConcat(inputs[0], inputs[1], commonMasks.stringType));
   }
 
   void handleForeignJsCurrentIsolateContext(ast.Send node) {
@@ -2707,12 +2686,12 @@
           node, 'Too many arguments to JS_CURRENT_ISOLATE_CONTEXT.');
     }
 
-    if (!compiler.hasIsolateSupport) {
+    if (!backend.hasIsolateSupport) {
       // If the isolate library is not used, we just generate code
       // to fetch the static state.
       String name = backend.namer.staticStateHolder;
       push(new HForeignCode(
-          js.js.parseForeignJS(name), backend.dynamicType, <HInstruction>[],
+          js.js.parseForeignJS(name), commonMasks.dynamicType, <HInstruction>[],
           nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
     } else {
       // Call a helper method from the isolate library. The isolate
@@ -2722,7 +2701,7 @@
       if (element == null) {
         reporter.internalError(node, 'Isolate library and compiler mismatch.');
       }
-      pushInvokeStatic(null, element, [], typeMask: backend.dynamicType);
+      pushInvokeStatic(null, element, [], typeMask: commonMasks.dynamicType);
     }
   }
 
@@ -2762,7 +2741,7 @@
         reporter.reportErrorMessage(node, MessageKind.GENERIC,
             {'text': 'Error: Unknown internal flag "$name".'});
     }
-    stack.add(graph.addConstantBool(value, compiler));
+    stack.add(graph.addConstantBool(value, closedWorld));
   }
 
   void handleForeignJsGetName(ast.Send node) {
@@ -2828,7 +2807,7 @@
         message: "No NativeBehavior for $node"));
 
     TypeMask ssaType =
-        TypeMaskFactory.fromNativeBehavior(nativeBehavior, compiler);
+        TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
 
     push(new HForeignCode(template, ssaType, compiledArguments,
         nativeBehavior: nativeBehavior));
@@ -2873,7 +2852,7 @@
     assert(invariant(node, nativeBehavior != null,
         message: "No NativeBehavior for $node"));
     TypeMask ssaType =
-        TypeMaskFactory.fromNativeBehavior(nativeBehavior, compiler);
+        TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
     push(new HForeignCode(expr, ssaType, const [],
         nativeBehavior: nativeBehavior));
   }
@@ -2887,10 +2866,11 @@
       HInstruction argumentInstruction = pop();
       if (argumentInstruction is HConstant) {
         ConstantValue argumentConstant = argumentInstruction.constant;
-        if (argumentConstant is TypeConstantValue) {
-          ConstantValue constant =
-              new InterceptorConstantValue(argumentConstant.representedType);
-          HInstruction instruction = graph.addConstant(constant, compiler);
+        if (argumentConstant is TypeConstantValue &&
+            argumentConstant.representedType is ResolutionInterfaceType) {
+          ResolutionInterfaceType type = argumentConstant.representedType;
+          ConstantValue constant = new InterceptorConstantValue(type.element);
+          HInstruction instruction = graph.addConstant(constant, closedWorld);
           stack.add(instruction);
           return;
         }
@@ -2898,17 +2878,17 @@
     }
     reporter.reportErrorMessage(
         node, MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
-    stack.add(graph.addConstantNull(compiler));
+    stack.add(graph.addConstantNull(closedWorld));
   }
 
   void handleForeignJsCallInIsolate(ast.Send node) {
     Link<ast.Node> link = node.arguments;
-    if (!compiler.hasIsolateSupport) {
+    if (!backend.hasIsolateSupport) {
       // If the isolate library is not used, we just invoke the
       // closure.
       visit(link.tail.head);
       push(new HInvokeClosure(new Selector.callClosure(0),
-          <HInstruction>[pop()], backend.dynamicType));
+          <HInstruction>[pop()], commonMasks.dynamicType));
     } else {
       // Call a helper method from the isolate library.
       Element element = helpers.callInIsolate;
@@ -2917,7 +2897,8 @@
       }
       List<HInstruction> inputs = <HInstruction>[];
       addGenericSendArgumentsToList(link, inputs);
-      pushInvokeStatic(node, element, inputs, typeMask: backend.dynamicType);
+      pushInvokeStatic(node, element, inputs,
+          typeMask: commonMasks.dynamicType);
     }
   }
 
@@ -2932,7 +2913,7 @@
       reporter.internalError(
           closure, '"$name" requires a static or top-level method.');
     }
-    FunctionElement function = element;
+    MethodElement function = element;
     // TODO(johnniwinther): Try to eliminate the need to distinguish declaration
     // and implementation signatures. Currently it is need because the
     // signatures have different elements for parameters.
@@ -2947,7 +2928,7 @@
     push(new HForeignCode(
         js.js.expressionTemplateYielding(
             backend.emitter.staticFunctionAccess(function)),
-        backend.dynamicType,
+        commonMasks.dynamicType,
         <HInstruction>[],
         nativeBehavior: native.NativeBehavior.PURE));
     return params;
@@ -2970,7 +2951,7 @@
     SideEffects sideEffects = new SideEffects.empty();
     sideEffects.setAllSideEffects();
     push(new HForeignCode(js.js.parseForeignJS("$isolateName = #"),
-        backend.dynamicType, <HInstruction>[pop()],
+        commonMasks.dynamicType, <HInstruction>[pop()],
         nativeBehavior: native.NativeBehavior.CHANGES_OTHER,
         effects: sideEffects));
   }
@@ -2980,7 +2961,7 @@
       reporter.internalError(node.argumentsNode, 'Too many arguments.');
     }
     push(new HForeignCode(js.js.parseForeignJS(backend.namer.staticStateHolder),
-        backend.dynamicType, <HInstruction>[],
+        commonMasks.dynamicType, <HInstruction>[],
         nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
   }
 
@@ -3009,7 +2990,7 @@
     } else if (name == 'JS_GET_FLAG') {
       handleForeignJsGetFlag(node);
     } else if (name == 'JS_EFFECT') {
-      stack.add(graph.addConstantNull(compiler));
+      stack.add(graph.addConstantNull(closedWorld));
     } else if (name == BackendHelpers.JS_INTERCEPTOR_CONSTANT) {
       handleJsInterceptorConstant(node);
     } else if (name == 'JS_STRING_CONCAT') {
@@ -3028,9 +3009,9 @@
     String loadId =
         compiler.deferredLoadTask.getImportDeferName(node, prefixElement);
     var inputs = [
-      graph.addConstantString(new ast.DartString.literal(loadId), compiler)
+      graph.addConstantString(new ast.DartString.literal(loadId), closedWorld)
     ];
-    push(new HInvokeStatic(loadFunction, inputs, backend.nonNullType,
+    push(new HInvokeStatic(loadFunction, inputs, commonMasks.nonNullType,
         targetCanThrow: false)..sourceInformation = sourceInformation);
   }
 
@@ -3041,7 +3022,8 @@
     ClassElement cls = currentNonClosureClass;
     MethodElement element = cls.lookupSuperMember(Identifiers.noSuchMethod_);
     if (!Selectors.noSuchMethod_.signatureApplies(element)) {
-      element = coreClasses.objectClass.lookupMember(Identifiers.noSuchMethod_);
+      ClassElement objectClass = commonElements.objectClass;
+      element = objectClass.lookupMember(Identifiers.noSuchMethod_);
     }
     if (backend.hasInvokeOnSupport && !element.enclosingClass.isObject) {
       // Register the call as dynamic if [noSuchMethod] on the super
@@ -3067,7 +3049,7 @@
     for (String argumentName in selector.namedArguments) {
       ConstantValue argumentNameConstant =
           constantSystem.createString(new ast.DartString.literal(argumentName));
-      argumentNames.add(graph.addConstant(argumentNameConstant, compiler));
+      argumentNames.add(graph.addConstant(argumentNameConstant, closedWorld));
     }
     var argumentNamesInstruction = buildLiteralList(argumentNames);
     add(argumentNamesInstruction);
@@ -3079,13 +3061,13 @@
         null,
         createInvocationMirror,
         [
-          graph.addConstant(nameConstant, compiler),
-          graph.addConstantStringFromName(internalName, compiler),
-          graph.addConstant(kindConstant, compiler),
+          graph.addConstant(nameConstant, closedWorld),
+          graph.addConstantStringFromName(internalName, closedWorld),
+          graph.addConstant(kindConstant, closedWorld),
           argumentsInstruction,
           argumentNamesInstruction
         ],
-        typeMask: backend.dynamicType);
+        typeMask: commonMasks.dynamicType);
 
     var inputs = <HInstruction>[pop()];
     push(buildInvokeSuper(Selectors.noSuchMethod_, element, inputs));
@@ -3233,7 +3215,8 @@
   void visitSuperNotEquals(
       ast.Send node, MethodElement method, ast.Node argument, _) {
     handleSuperMethodInvoke(node, method);
-    pushWithPosition(new HNot(popBoolified(), backend.boolType), node.selector);
+    pushWithPosition(
+        new HNot(popBoolified(), commonMasks.boolType), node.selector);
   }
 
   @override
@@ -3262,23 +3245,21 @@
   }
 
   bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
-    ClosedWorld closedWorld = compiler.closedWorld;
     if (closedWorld.isUsedAsMixin(cls)) return true;
 
-    return compiler.closedWorld.anyStrictSubclassOf(cls,
-        (ClassElement subclass) {
+    return closedWorld.anyStrictSubclassOf(cls, (ClassElement subclass) {
       return !rti.isTrivialSubstitution(subclass, cls);
     });
   }
 
-  HInstruction handleListConstructor(
-      InterfaceType type, ast.Node currentNode, HInstruction newObject) {
+  HInstruction handleListConstructor(ResolutionInterfaceType type,
+      ast.Node currentNode, HInstruction newObject) {
     if (!backend.classNeedsRti(type.element) || type.treatAsRaw) {
       return newObject;
     }
     List<HInstruction> inputs = <HInstruction>[];
     type = localsHandler.substInContext(type);
-    type.typeArguments.forEach((DartType argument) {
+    type.typeArguments.forEach((ResolutionDartType argument) {
       inputs.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
     });
     // TODO(15489): Register at codegen.
@@ -3292,7 +3273,7 @@
     Element typeInfoSetterElement = helpers.setRuntimeTypeInfo;
     pushInvokeStatic(
         null, typeInfoSetterElement, <HInstruction>[newObject, typeInfo],
-        typeMask: backend.dynamicType,
+        typeMask: commonMasks.dynamicType,
         sourceInformation: newObject.sourceInformation);
 
     // The new object will now be referenced through the
@@ -3312,35 +3293,34 @@
     generateIsDeferredLoadedCheckOfSend(send);
 
     bool isFixedList = false;
-    bool isFixedListConstructorCall =
-        Elements.isFixedListConstructorCall(elements[send], send, compiler);
-    bool isGrowableListConstructorCall =
-        Elements.isGrowableListConstructorCall(elements[send], send, compiler);
+    bool isFixedListConstructorCall = Elements.isFixedListConstructorCall(
+        elements[send], send, closedWorld.commonElements);
+    bool isGrowableListConstructorCall = Elements.isGrowableListConstructorCall(
+        elements[send], send, closedWorld.commonElements);
 
     TypeMask computeType(element) {
       Element originalElement = elements[send];
       if (isFixedListConstructorCall ||
           Elements.isFilledListConstructorCall(
-              originalElement, send, compiler)) {
+              originalElement, send, closedWorld.commonElements)) {
         isFixedList = true;
         TypeMask inferred = _inferredTypeOfNewList(send);
-        return inferred.containsAll(compiler.closedWorld)
-            ? backend.fixedArrayType
+        return inferred.containsAll(closedWorld)
+            ? commonMasks.fixedArrayType
             : inferred;
       } else if (isGrowableListConstructorCall) {
         TypeMask inferred = _inferredTypeOfNewList(send);
-        return inferred.containsAll(compiler.closedWorld)
-            ? backend.extendableArrayType
+        return inferred.containsAll(closedWorld)
+            ? commonMasks.extendableArrayType
             : inferred;
       } else if (Elements.isConstructorOfTypedArraySubclass(
-          originalElement, compiler)) {
+          originalElement, closedWorld)) {
         isFixedList = true;
         TypeMask inferred = _inferredTypeOfNewList(send);
         ClassElement cls = element.enclosingClass;
         assert(backend.isNative(cls.thisType.element));
-        return inferred.containsAll(compiler.closedWorld)
-            ? new TypeMask.nonNullExact(
-                cls.thisType.element, compiler.closedWorld)
+        return inferred.containsAll(closedWorld)
+            ? new TypeMask.nonNullExact(cls.thisType.element, closedWorld)
             : inferred;
       } else if (element.isGenerativeConstructor) {
         ClassElement cls = element.enclosingClass;
@@ -3348,12 +3328,11 @@
           // An error will be thrown.
           return new TypeMask.nonNullEmpty();
         } else {
-          return new TypeMask.nonNullExact(
-              cls.thisType.element, compiler.closedWorld);
+          return new TypeMask.nonNullExact(cls.thisType.element, closedWorld);
         }
       } else {
         return TypeMaskFactory.inferredReturnTypeForElement(
-            originalElement, compiler);
+            originalElement, globalInferenceResults);
       }
     }
 
@@ -3364,7 +3343,7 @@
     constructor = constructorImplementation.effectiveTarget;
 
     final bool isSymbolConstructor =
-        compiler.commonElements.isSymbolConstructor(constructorDeclaration);
+        closedWorld.commonElements.isSymbolConstructor(constructorDeclaration);
     final bool isJSArrayTypedConstructor =
         constructorDeclaration == helpers.jsArrayTypedConstructor;
 
@@ -3390,14 +3369,14 @@
         target = target.immediateRedirectionTarget;
       }
     }
-    InterfaceType type = elements.getType(node);
-    InterfaceType expectedType =
+    ResolutionInterfaceType type = elements.getType(node);
+    ResolutionInterfaceType expectedType =
         constructorDeclaration.computeEffectiveTargetType(type);
     expectedType = localsHandler.substInContext(expectedType);
 
     if (compiler.elementHasCompileTimeError(constructor)) {
       // TODO(ahe): Do something like [generateWrongArgumentCountError].
-      stack.add(graph.addConstantNull(compiler));
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
@@ -3421,39 +3400,42 @@
     // calling [makeStaticArgumentList].
     constructorImplementation = constructor.implementation;
     if (constructorImplementation.isMalformed ||
-        !callStructure
-            .signatureApplies(constructorImplementation.functionSignature)) {
+        !callStructure.signatureApplies(constructorImplementation.type)) {
       generateWrongArgumentCountError(send, constructor, send.arguments);
       return;
     }
 
-    var inputs = <HInstruction>[];
+    List<HInstruction> inputs = <HInstruction>[];
     if (constructor.isGenerativeConstructor &&
         backend.isNativeOrExtendsNative(constructor.enclosingClass) &&
         !backend.isJsInterop(constructor)) {
       // Native class generative constructors take a pre-constructed object.
-      inputs.add(graph.addConstantNull(compiler));
+      inputs.add(graph.addConstantNull(closedWorld));
     }
     inputs.addAll(makeStaticArgumentList(
         callStructure, send.arguments, constructorImplementation));
 
     TypeMask elementType = computeType(constructor);
     if (isFixedListConstructorCall) {
-      if (!inputs[0].isNumber(compiler)) {
-        HTypeConversion conversion = new HTypeConversion(null,
-            HTypeConversion.ARGUMENT_TYPE_CHECK, backend.numType, inputs[0]);
+      if (!inputs[0].isNumber(closedWorld)) {
+        HTypeConversion conversion = new HTypeConversion(
+            null,
+            HTypeConversion.ARGUMENT_TYPE_CHECK,
+            commonMasks.numType,
+            inputs[0]);
         add(conversion);
         inputs[0] = conversion;
       }
       js.Template code = js.js.parseForeignJS('new Array(#)');
       var behavior = new native.NativeBehavior();
+      behavior.typesInstantiated.add(expectedType);
       behavior.typesReturned.add(expectedType);
       // The allocation can throw only if the given length is a double or
       // outside the unsigned 32 bit range.
       // TODO(sra): Array allocation should be an instruction so that canThrow
       // can depend on a length type discovered in optimization.
       bool canThrow = true;
-      if (inputs[0].isInteger(compiler) && inputs[0] is HConstant) {
+      if (inputs[0].isInteger(closedWorld) && inputs[0] is HConstant) {
         var constant = inputs[0];
         int value = constant.constant.primitiveValue;
         if (0 <= value && value < 0x100000000) canThrow = false;
@@ -3468,7 +3450,7 @@
         js.Template code = js.js.parseForeignJS(r'#.fixed$length = Array');
         // We set the instruction as [canThrow] to avoid it being dead code.
         // We need a finer grained side effect.
-        add(new HForeignCode(code, backend.nullType, [stack.last],
+        add(new HForeignCode(code, commonMasks.nullType, [stack.last],
             throwBehavior: native.NativeThrowBehavior.MAY));
       }
     } else if (isGrowableListConstructorCall) {
@@ -3497,7 +3479,7 @@
     // not know about the type argument. Therefore we special case
     // this constructor to have the setRuntimeTypeInfo called where
     // the 'new' is done.
-    if (backend.classNeedsRti(coreClasses.listClass) &&
+    if (backend.classNeedsRti(commonElements.listClass) &&
         (isFixedListConstructorCall ||
             isGrowableListConstructorCall ||
             isJSArrayTypedConstructor)) {
@@ -3516,12 +3498,12 @@
     }
   }
 
-  void potentiallyAddTypeArguments(
-      List<HInstruction> inputs, ClassElement cls, InterfaceType expectedType,
+  void potentiallyAddTypeArguments(List<HInstruction> inputs, ClassElement cls,
+      ResolutionInterfaceType expectedType,
       {SourceInformation sourceInformation}) {
     if (!backend.classNeedsRti(cls)) return;
     assert(cls.typeVariables.length == expectedType.typeArguments.length);
-    expectedType.typeArguments.forEach((DartType argument) {
+    expectedType.typeArguments.forEach((ResolutionDartType argument) {
       inputs.add(typeBuilder.analyzeTypeArgument(argument, sourceElement,
           sourceInformation: sourceInformation));
     });
@@ -3529,15 +3511,19 @@
 
   /// In checked mode checks the [type] of [node] to be well-bounded. The method
   /// returns [:true:] if an error can be statically determined.
-  bool checkTypeVariableBounds(ast.NewExpression node, InterfaceType type) {
+  bool checkTypeVariableBounds(
+      ast.NewExpression node, ResolutionInterfaceType type) {
     if (!compiler.options.enableTypeAssertions) return false;
 
-    Map<DartType, Set<DartType>> seenChecksMap =
-        new Map<DartType, Set<DartType>>();
+    Map<ResolutionDartType, Set<ResolutionDartType>> seenChecksMap =
+        new Map<ResolutionDartType, Set<ResolutionDartType>>();
     bool definitelyFails = false;
 
-    void addTypeVariableBoundCheck(GenericType instance, DartType typeArgument,
-        TypeVariableType typeVariable, DartType bound) {
+    void addTypeVariableBoundCheck(
+        GenericType instance,
+        ResolutionDartType typeArgument,
+        ResolutionTypeVariableType typeVariable,
+        ResolutionDartType bound) {
       if (definitelyFails) return;
 
       int subtypeRelation =
@@ -3557,8 +3543,8 @@
         definitelyFails = true;
         return;
       } else if (subtypeRelation == Types.MAYBE_SUBTYPE) {
-        Set<DartType> seenChecks =
-            seenChecksMap.putIfAbsent(typeArgument, () => new Set<DartType>());
+        Set<ResolutionDartType> seenChecks = seenChecksMap.putIfAbsent(
+            typeArgument, () => new Set<ResolutionDartType>());
         if (!seenChecks.contains(bound)) {
           seenChecks.add(bound);
           assertIsSubtype(node, typeArgument, bound, message);
@@ -3570,8 +3556,8 @@
     if (definitelyFails) {
       return true;
     }
-    for (InterfaceType supertype in type.element.allSupertypes) {
-      DartType instance = type.asInstanceOf(supertype.element);
+    for (ResolutionInterfaceType supertype in type.element.allSupertypes) {
+      ResolutionDartType instance = type.asInstanceOf(supertype.element);
       compiler.types
           .checkTypeVariableBounds(instance, addTypeVariableBoundCheck);
       if (definitelyFails) {
@@ -3591,15 +3577,9 @@
     List<HInstruction> inputs = makeStaticArgumentList(
         callStructure, node.arguments, function.implementation);
 
-    if (function == compiler.commonElements.identicalFunction) {
-      pushWithPosition(
-          new HIdentity(inputs[0], inputs[1], null, backend.boolType), node);
-      return;
-    } else {
-      pushInvokeStatic(node, function, inputs,
-          sourceInformation:
-              sourceInformationBuilder.buildCall(node, node.selector));
-    }
+    pushInvokeStatic(node, function, inputs,
+        sourceInformation:
+            sourceInformationBuilder.buildCall(node, node.selector));
   }
 
   /// Generate an invocation to a static or top level function with the wrong
@@ -3718,18 +3698,18 @@
       handleInvalidStaticInvoke(node, element);
     } else {
       // TODO(ahe): Do something like [generateWrongArgumentCountError].
-      stack.add(graph.addConstantNull(compiler));
+      stack.add(graph.addConstantNull(closedWorld));
     }
     return;
   }
 
   HConstant addConstantString(String string) {
     ast.DartString dartString = new ast.DartString.literal(string);
-    return graph.addConstantString(dartString, compiler);
+    return graph.addConstantString(dartString, closedWorld);
   }
 
   HConstant addConstantStringFromName(js.Name name) {
-    return graph.addConstantStringFromName(name, compiler);
+    return graph.addConstantStringFromName(name, closedWorld);
   }
 
   visitClassTypeLiteralGet(ast.Send node, ConstantExpression constant, _) {
@@ -3787,18 +3767,18 @@
 
   /// Generate the literal for [typeVariable] in the current context.
   void generateTypeVariableLiteral(
-      ast.Send node, TypeVariableType typeVariable) {
+      ast.Send node, ResolutionTypeVariableType typeVariable) {
     // GENERIC_METHODS: This provides thin support for method type variables
     // by treating them as malformed when evaluated as a literal. For full
     // support of generic methods this must be revised.
     if (typeVariable is MethodTypeVariableType) {
       generateTypeError(node, "Method type variables are not reified");
     } else {
-      DartType type = localsHandler.substInContext(typeVariable);
+      ResolutionDartType type = localsHandler.substInContext(typeVariable);
       HInstruction value = typeBuilder.analyzeTypeArgument(type, sourceElement,
           sourceInformation: sourceInformationBuilder.buildGet(node));
       pushInvokeStatic(node, helpers.runtimeTypeToString, [value],
-          typeMask: backend.stringType);
+          typeMask: commonMasks.stringType);
       pushInvokeStatic(node, helpers.createRuntimeType, [pop()]);
     }
   }
@@ -3821,7 +3801,7 @@
     List<HInstruction> inputs = <HInstruction>[target];
     addDynamicSendArgumentsToList(node, inputs);
     push(new HInvokeClosure(
-        new Selector.callClosureFrom(selector), inputs, backend.dynamicType)
+        new Selector.callClosureFrom(selector), inputs, commonMasks.dynamicType)
       ..sourceInformation = sourceInformation);
   }
 
@@ -3859,10 +3839,10 @@
     Element helper = helpers.throwNoSuchMethod;
     ConstantValue receiverConstant =
         constantSystem.createString(new ast.DartString.empty());
-    HInstruction receiver = graph.addConstant(receiverConstant, compiler);
+    HInstruction receiver = graph.addConstant(receiverConstant, closedWorld);
     ast.DartString dartString = new ast.DartString.literal(methodName);
     ConstantValue nameConstant = constantSystem.createString(dartString);
-    HInstruction name = graph.addConstant(nameConstant, compiler);
+    HInstruction name = graph.addConstant(nameConstant, closedWorld);
     if (argumentValues == null) {
       argumentValues = <HInstruction>[];
       argumentNodes.forEach((argumentNode) {
@@ -3877,14 +3857,14 @@
     if (existingArguments != null) {
       List<HInstruction> existingNames = <HInstruction>[];
       for (String name in existingArguments) {
-        HInstruction nameConstant =
-            graph.addConstantString(new ast.DartString.literal(name), compiler);
+        HInstruction nameConstant = graph.addConstantString(
+            new ast.DartString.literal(name), closedWorld);
         existingNames.add(nameConstant);
       }
       existingNamesList = buildLiteralList(existingNames);
       add(existingNamesList);
     } else {
-      existingNamesList = graph.addConstantNull(compiler);
+      existingNamesList = graph.addConstantNull(closedWorld);
     }
     pushInvokeStatic(
         diagnosticNode, helper, [receiver, name, arguments, existingNamesList],
@@ -3935,7 +3915,7 @@
       }
     } else if (Elements.isMalformed(element)) {
       // TODO(ahe): Do something like [generateWrongArgumentCountError].
-      stack.add(graph.addConstantNull(compiler));
+      stack.add(graph.addConstantNull(closedWorld));
     } else if (node.isConst) {
       stack.add(addConstant(node));
       if (isSymbolConstructor) {
@@ -3953,7 +3933,7 @@
   void errorNonConstantConstructorInvoke(
       ast.NewExpression node,
       Element element,
-      DartType type,
+      ResolutionDartType type,
       ast.NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -3970,12 +3950,11 @@
     bool isOptimizableOperationOnIndexable(Selector selector, Element element) {
       bool isLength = selector.isGetter && selector.name == "length";
       if (isLength || selector.isIndex) {
-        return compiler.closedWorld.isSubtypeOf(
-            element.enclosingClass.declaration, helpers.jsIndexableClass);
+        return closedWorld.isSubtypeOf(
+            element.enclosingClass, helpers.jsIndexableClass);
       } else if (selector.isIndexSet) {
-        return compiler.closedWorld.isSubtypeOf(
-            element.enclosingClass.declaration,
-            helpers.jsMutableIndexableClass);
+        return closedWorld.isSubtypeOf(
+            element.enclosingClass, helpers.jsMutableIndexableClass);
       } else {
         return false;
       }
@@ -3997,7 +3976,7 @@
       return false;
     }
 
-    Element element = compiler.closedWorld.locateSingleElement(selector, mask);
+    MemberElement element = closedWorld.locateSingleElement(selector, mask);
     if (element != null &&
         !element.isField &&
         !(element.isGetter && selector.isCall) &&
@@ -4015,8 +3994,8 @@
       inputs.add(invokeInterceptor(receiver));
     }
     inputs.addAll(arguments);
-    TypeMask type =
-        TypeMaskFactory.inferredTypeForSelector(selector, mask, compiler);
+    TypeMask type = TypeMaskFactory.inferredTypeForSelector(
+        selector, mask, globalInferenceResults);
     if (selector.isGetter) {
       push(new HInvokeDynamicGetter(selector, mask, null, inputs, type)
         ..sourceInformation = sourceInformation);
@@ -4029,7 +4008,7 @@
     }
   }
 
-  HForeignCode invokeJsInteropFunction(FunctionElement element,
+  HForeignCode invokeJsInteropFunction(MethodElement element,
       List<HInstruction> arguments, SourceInformation sourceInformation) {
     assert(backend.isJsInterop(element));
     nativeEmitter.nativeMethods.add(element);
@@ -4067,14 +4046,14 @@
         nativeBehavior.typesReturned.add(constructor.enclosingClass.thisType);
       }
       return new HForeignCode(
-          codeTemplate, backend.dynamicType, filteredArguments,
+          codeTemplate, commonMasks.dynamicType, filteredArguments,
           nativeBehavior: nativeBehavior)
         ..sourceInformation = sourceInformation;
     }
     var target = new HForeignCode(
-        js.js.parseForeignJS("${backend.namer.fixedBackendPath(element)}."
+        js.js.parseForeignJS("${backend.namer.fixedBackendMethodPath(element)}."
             "${backend.nativeData.getFixedBackendName(element)}"),
-        backend.dynamicType,
+        commonMasks.dynamicType,
         <HInstruction>[]);
     add(target);
     // Strip off trailing arguments that were not specified.
@@ -4087,7 +4066,7 @@
     var nativeBehavior = new native.NativeBehavior()
       ..sideEffects.setAllSideEffects();
 
-    DartType type = element.isConstructor
+    ResolutionDartType type = element.isConstructor
         ? element.enclosingClass.thisType
         : element.type.returnType;
     // Native behavior effects here are similar to native/behavior.dart.
@@ -4096,7 +4075,7 @@
     nativeBehavior.typesReturned.add(
         compiler.options.trustJSInteropTypeAnnotations
             ? type
-            : const DynamicType());
+            : const ResolutionDynamicType());
 
     // The allocation effects include the declared type if it is native (which
     // includes js interop types).
@@ -4125,14 +4104,14 @@
     js.Template codeTemplate = js.js.parseForeignJS(code);
     nativeBehavior.codeTemplate = codeTemplate;
 
-    return new HForeignCode(codeTemplate, backend.dynamicType, inputs,
+    return new HForeignCode(codeTemplate, commonMasks.dynamicType, inputs,
         nativeBehavior: nativeBehavior)..sourceInformation = sourceInformation;
   }
 
   void pushInvokeStatic(
       ast.Node location, MethodElement element, List<HInstruction> arguments,
       {TypeMask typeMask,
-      InterfaceType instanceType,
+      ResolutionInterfaceType instanceType,
       SourceInformation sourceInformation}) {
     assert(element.isDeclaration);
     // TODO(johnniwinther): Use [sourceInformation] instead of [location].
@@ -4142,10 +4121,10 @@
     }
 
     if (typeMask == null) {
-      typeMask =
-          TypeMaskFactory.inferredReturnTypeForElement(element, compiler);
+      typeMask = TypeMaskFactory.inferredReturnTypeForElement(
+          element, globalInferenceResults);
     }
-    bool targetCanThrow = !compiler.closedWorld.getCannotThrow(element);
+    bool targetCanThrow = !closedWorld.getCannotThrow(element);
     // TODO(5346): Try to avoid the need for calling [declaration] before
     var instruction;
     if (backend.isJsInterop(element)) {
@@ -4158,10 +4137,9 @@
         ..sourceInformation = sourceInformation;
       if (currentInlinedInstantiations.isNotEmpty) {
         instruction.instantiatedTypes =
-            new List<DartType>.from(currentInlinedInstantiations);
+            new List<ResolutionDartType>.from(currentInlinedInstantiations);
       }
-      instruction.sideEffects =
-          compiler.closedWorld.getSideEffectsOfElement(element);
+      instruction.sideEffects = closedWorld.getSideEffectsOfElement(element);
     }
     if (location == null) {
       push(instruction);
@@ -4187,15 +4165,17 @@
     inputs.addAll(arguments);
     TypeMask type;
     if (!element.isGetter && selector.isGetter) {
-      type = TypeMaskFactory.inferredTypeForElement(element, compiler);
+      type = TypeMaskFactory.inferredTypeForElement(
+          element, globalInferenceResults);
     } else {
-      type = TypeMaskFactory.inferredReturnTypeForElement(element, compiler);
+      type = TypeMaskFactory.inferredReturnTypeForElement(
+          element, globalInferenceResults);
     }
     HInstruction instruction = new HInvokeSuper(element, currentNonClosureClass,
         selector, inputs, type, sourceInformation,
         isSetter: selector.isSetter || selector.isIndexSet);
     instruction.sideEffects =
-        compiler.closedWorld.getSideEffectsOfSelector(selector, null);
+        closedWorld.getSideEffectsOfSelector(selector, null);
     return instruction;
   }
 
@@ -4203,7 +4183,7 @@
       ast.SendSet node, HInstruction receiver, Link<ast.Node> arguments) {
     HInstruction rhs;
     if (node.isPrefix || node.isPostfix) {
-      rhs = graph.addConstantInt(1, compiler);
+      rhs = graph.addConstantInt(1, closedWorld);
     } else {
       visit(arguments.head);
       assert(arguments.tail.isEmpty);
@@ -4963,19 +4943,19 @@
   }
 
   void visitLiteralInt(ast.LiteralInt node) {
-    stack.add(graph.addConstantInt(node.value, compiler));
+    stack.add(graph.addConstantInt(node.value, closedWorld));
   }
 
   void visitLiteralDouble(ast.LiteralDouble node) {
-    stack.add(graph.addConstantDouble(node.value, compiler));
+    stack.add(graph.addConstantDouble(node.value, closedWorld));
   }
 
   void visitLiteralBool(ast.LiteralBool node) {
-    stack.add(graph.addConstantBool(node.value, compiler));
+    stack.add(graph.addConstantBool(node.value, closedWorld));
   }
 
   void visitLiteralString(ast.LiteralString node) {
-    stack.add(graph.addConstantString(node.dartString, compiler));
+    stack.add(graph.addConstantString(node.dartString, closedWorld));
   }
 
   void visitLiteralSymbol(ast.LiteralSymbol node) {
@@ -4986,7 +4966,7 @@
   void visitStringJuxtaposition(ast.StringJuxtaposition node) {
     if (!node.isInterpolation) {
       // This is a simple string with no interpolations.
-      stack.add(graph.addConstantString(node.dartString, compiler));
+      stack.add(graph.addConstantString(node.dartString, closedWorld));
       return;
     }
     StringBuilderVisitor stringBuilder = new StringBuilderVisitor(this, node);
@@ -4995,7 +4975,7 @@
   }
 
   void visitLiteralNull(ast.LiteralNull node) {
-    stack.add(graph.addConstantNull(compiler));
+    stack.add(graph.addConstantNull(closedWorld));
   }
 
   visitNodeList(ast.NodeList node) {
@@ -5030,18 +5010,10 @@
     dup();
   }
 
-  void handleInTryStatement() {
-    if (!inTryStatement) return;
-    HBasicBlock block = close(new HExitTry());
-    HBasicBlock newBlock = graph.addNewBlock();
-    block.addSuccessor(newBlock);
-    open(newBlock);
-  }
-
   visitRethrow(ast.Rethrow node) {
     HInstruction exception = rethrowableException;
     if (exception == null) {
-      exception = graph.addConstantNull(compiler);
+      exception = graph.addConstantNull(closedWorld);
       reporter.internalError(node, 'rethrowableException should not be null.');
     }
     handleInTryStatement();
@@ -5086,7 +5058,7 @@
         inputs.add(handleConstantForOptionalParameter(optionalParameter));
       } else {
         // Wrong.
-        inputs.add(graph.addConstantNull(compiler));
+        inputs.add(graph.addConstantNull(closedWorld));
       }
     }
 
@@ -5117,10 +5089,10 @@
     ClassElement targetClass = targetConstructor.enclosingClass;
     if (backend.classNeedsRti(targetClass)) {
       ClassElement cls = redirectingConstructor.enclosingClass;
-      InterfaceType targetType =
+      ResolutionInterfaceType targetType =
           redirectingConstructor.computeEffectiveTargetType(cls.thisType);
       targetType = localsHandler.substInContext(targetType);
-      targetType.typeArguments.forEach((DartType argument) {
+      targetType.typeArguments.forEach((ResolutionDartType argument) {
         inputs.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
       });
     }
@@ -5136,7 +5108,7 @@
   /// either dynamic, Object, or Future.
   ///
   /// We do not accept the internal Future implementation class.
-  bool isValidAsyncReturnType(DartType type) {
+  bool isValidAsyncReturnType(ResolutionDartType type) {
     assert(isBuildingAsyncFunction);
     // TODO(sigurdm): In an internal library a function could be declared:
     //
@@ -5147,7 +5119,8 @@
     // case.
     return type.isDynamic ||
         type.isObject ||
-        (type is InterfaceType && type.element == coreClasses.futureClass);
+        (type is ResolutionInterfaceType &&
+            type.element == commonElements.futureClass);
   }
 
   visitReturn(ast.Return node) {
@@ -5157,7 +5130,7 @@
     }
     HInstruction value;
     if (node.expression == null) {
-      value = graph.addConstantNull(compiler);
+      value = graph.addConstantNull(closedWorld);
     } else {
       visit(node.expression);
       value = pop();
@@ -5200,7 +5173,7 @@
     HInstruction awaited = pop();
     // TODO(herhut): Improve this type.
     push(new HAwait(awaited,
-        new TypeMask.subclass(coreClasses.objectClass, compiler.closedWorld)));
+        new TypeMask.subclass(commonElements.objectClass, closedWorld)));
   }
 
   visitTypeAnnotation(ast.TypeAnnotation node) {
@@ -5215,7 +5188,7 @@
       ast.Node definition = link.head;
       LocalElement local = elements[definition];
       if (definition is ast.Identifier) {
-        HInstruction initialValue = graph.addConstantNull(compiler);
+        HInstruction initialValue = graph.addConstantNull(closedWorld);
         localsHandler.updateLocal(local, initialValue);
       } else {
         ast.SendSet node = definition;
@@ -5227,12 +5200,13 @@
   }
 
   HInstruction setRtiIfNeeded(HInstruction object, ast.Node node) {
-    InterfaceType type = localsHandler.substInContext(elements.getType(node));
+    ResolutionInterfaceType type =
+        localsHandler.substInContext(elements.getType(node));
     if (!backend.classNeedsRti(type.element) || type.treatAsRaw) {
       return object;
     }
     List<HInstruction> arguments = <HInstruction>[];
-    for (DartType argument in type.typeArguments) {
+    for (ResolutionDartType argument in type.typeArguments) {
       arguments.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
     }
     // TODO(15489): Register at codegen.
@@ -5258,16 +5232,19 @@
       instruction = setRtiIfNeeded(instruction, node);
     }
 
-    TypeMask type = _inferredTypeOfNewList(node);
-    if (!type.containsAll(compiler.closedWorld)) {
+    TypeMask type = _inferredTypeOfListLiteral(node);
+    if (!type.containsAll(closedWorld)) {
       instruction.instructionType = type;
     }
     stack.add(instruction);
   }
 
-  _inferredTypeOfNewList(ast.Node node) =>
-      _resultOf(sourceElement).typeOfNewList(node) ??
-      compiler.closedWorld.commonMasks.dynamicType;
+  _inferredTypeOfNewList(ast.Send node) =>
+      _resultOf(sourceElement).typeOfNewList(node) ?? commonMasks.dynamicType;
+
+  _inferredTypeOfListLiteral(ast.LiteralList node) =>
+      _resultOf(sourceElement).typeOfListLiteral(node) ??
+      commonMasks.dynamicType;
 
   visitConditional(ast.Conditional node) {
     SsaBranchBuilder brancher = new SsaBranchBuilder(this, compiler, node);
@@ -5343,7 +5320,7 @@
     if (isLoopJump && node is ast.SwitchStatement) {
       // Create a special jump handler for loops created for switch statements
       // with continue statements.
-      return new SwitchCaseJumpHandler(this, element, node);
+      return new AstSwitchCaseJumpHandler(this, element, node);
     }
     return new JumpHandler(this, element);
   }
@@ -5355,7 +5332,7 @@
     visit(node.expression);
     HInstruction expression = pop();
     pushInvokeStatic(node, helpers.streamIteratorConstructor,
-        [expression, graph.addConstantNull(compiler)]);
+        [expression, graph.addConstantNull(closedWorld)]);
     streamIterator = pop();
 
     void buildInitializer() {}
@@ -5365,10 +5342,8 @@
       TypeMask mask = elementInferenceResults.typeOfIteratorMoveNext(node);
       pushInvokeDynamic(node, selector, mask, [streamIterator]);
       HInstruction future = pop();
-      push(new HAwait(
-          future,
-          new TypeMask.subclass(
-              coreClasses.objectClass, compiler.closedWorld)));
+      push(new HAwait(future,
+          new TypeMask.subclass(commonElements.objectClass, closedWorld)));
       return popBoolified();
     }
 
@@ -5403,10 +5378,8 @@
           node, buildInitializer, buildCondition, buildUpdate, buildBody);
     }, () {
       pushInvokeDynamic(node, Selectors.cancel, null, [streamIterator]);
-      push(new HAwait(
-          pop(),
-          new TypeMask.subclass(
-              coreClasses.objectClass, compiler.closedWorld)));
+      push(new HAwait(pop(),
+          new TypeMask.subclass(commonElements.objectClass, closedWorld)));
       pop();
     });
   }
@@ -5424,7 +5397,6 @@
 
     TypeMask mask = elementInferenceResults.typeOfIterator(node);
 
-    ClosedWorld closedWorld = compiler.closedWorld;
     if (mask != null &&
         mask.satisfies(helpers.jsIndexableClass, closedWorld) &&
         // String is indexable but not iterable.
@@ -5503,7 +5475,7 @@
     //     }
     Element loopVariable = elements.getForInVariable(node);
     SyntheticLocal indexVariable = new SyntheticLocal('_i', loopVariable);
-    TypeMask boolType = backend.boolType;
+    TypeMask boolType = commonMasks.boolType;
 
     // These variables are shared by initializer, condition, body and update.
     HInstruction array; // Set in buildInitializer.
@@ -5513,7 +5485,7 @@
     HInstruction buildGetLength() {
       MemberElement lengthElement = helpers.jsIndexableLength;
       HFieldGet result = new HFieldGet(
-          lengthElement, array, backend.positiveIntType,
+          lengthElement, array, commonMasks.positiveIntType,
           isAssignable: !isFixed);
       add(result);
       return result;
@@ -5536,9 +5508,9 @@
     void buildInitializer() {
       visit(node.expression);
       array = pop();
-      isFixed = isFixedLength(array.instructionType, compiler);
+      isFixed = isFixedLength(array.instructionType, closedWorld);
       localsHandler.updateLocal(
-          indexVariable, graph.addConstantInt(0, compiler));
+          indexVariable, graph.addConstantInt(0, closedWorld));
       originalLength = buildGetLength();
     }
 
@@ -5563,7 +5535,7 @@
       // TODO(sra): The element type of a container type mask might be better.
       Selector selector = new Selector.index();
       TypeMask type = TypeMaskFactory.inferredTypeForSelector(
-          selector, arrayType, compiler);
+          selector, arrayType, globalInferenceResults);
 
       HInstruction index = localsHandler.readLocal(indexVariable);
       HInstruction value = new HIndex(array, index, null, type);
@@ -5582,9 +5554,9 @@
       // but the code is horrible as `i+1` is carried around the loop in an
       // additional variable.
       HInstruction index = localsHandler.readLocal(indexVariable);
-      HInstruction one = graph.addConstantInt(1, compiler);
+      HInstruction one = graph.addConstantInt(1, closedWorld);
       HInstruction addInstruction =
-          new HAdd(index, one, null, backend.positiveIntType);
+          new HAdd(index, one, null, commonMasks.positiveIntType);
       add(addInstruction);
       localsHandler.updateLocal(indexVariable, addInstruction);
     }
@@ -5633,7 +5605,7 @@
       // There was at least one reachable break, so the label is needed.
       entryBlock.setBlockFlow(
           new HLabeledBlockInformation(
-              new HSubGraphBlockInformation(bodyGraph), handler.labels()),
+              new HSubGraphBlockInformation(bodyGraph), handler.labels),
           joinBlock);
     }
     handler.close();
@@ -5670,8 +5642,8 @@
     ConstructorElement functionElement = constructor;
     constructor = functionElement.effectiveTarget;
 
-    InterfaceType type = elements.getType(node);
-    InterfaceType expectedType =
+    ResolutionInterfaceType type = elements.getType(node);
+    ResolutionInterfaceType expectedType =
         functionElement.computeEffectiveTargetType(type);
     expectedType = localsHandler.substInContext(expectedType);
 
@@ -5679,7 +5651,7 @@
 
     if (backend.classNeedsRti(cls)) {
       List<HInstruction> typeInputs = <HInstruction>[];
-      expectedType.typeArguments.forEach((DartType argument) {
+      expectedType.typeArguments.forEach((ResolutionDartType argument) {
         typeInputs
             .add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
       });
@@ -5705,12 +5677,12 @@
     // The instruction type will always be a subtype of the mapLiteralClass, but
     // type inference might discover a more specific type, or find nothing (in
     // dart2js unit tests).
-    TypeMask mapType = new TypeMask.nonNullSubtype(
-        helpers.mapLiteralClass, compiler.closedWorld);
-    TypeMask returnTypeMask =
-        TypeMaskFactory.inferredReturnTypeForElement(constructor, compiler);
+    TypeMask mapType =
+        new TypeMask.nonNullSubtype(helpers.mapLiteralClass, closedWorld);
+    TypeMask returnTypeMask = TypeMaskFactory.inferredReturnTypeForElement(
+        constructor, globalInferenceResults);
     TypeMask instructionType =
-        mapType.intersection(returnTypeMask, compiler.closedWorld);
+        mapType.intersection(returnTypeMask, closedWorld);
 
     addInlinedInstantiation(expectedType);
     pushInvokeStatic(node, constructor, inputs,
@@ -5851,7 +5823,7 @@
     //   }
 
     JumpTarget switchTarget = elements.getTargetDefinition(node);
-    HInstruction initialValue = graph.addConstantNull(compiler);
+    HInstruction initialValue = graph.addConstantNull(closedWorld);
     localsHandler.updateLocal(switchTarget, initialValue);
 
     JumpHandler jumpHandler = createJumpHandler(node, isLoopJump: false);
@@ -5887,11 +5859,11 @@
       if (switchCase != null) {
         // Generate 'target = i; break;' for switch case i.
         int index = caseIndex[switchCase];
-        HInstruction value = graph.addConstantInt(index, compiler);
+        HInstruction value = graph.addConstantInt(index, closedWorld);
         localsHandler.updateLocal(switchTarget, value);
       } else {
         // Generate synthetic default case 'target = null; break;'.
-        HInstruction value = graph.addConstantNull(compiler);
+        HInstruction value = graph.addConstantNull(closedWorld);
         localsHandler.updateLocal(switchTarget, value);
       }
       jumpTargets[switchTarget].generateBreak();
@@ -5901,7 +5873,7 @@
         isDefaultCase, buildSwitchCase);
     jumpHandler.close();
 
-    HInstruction buildCondition() => graph.addConstantBool(true, compiler);
+    HInstruction buildCondition() => graph.addConstantBool(true, closedWorld);
 
     void buildSwitch() {
       HInstruction buildExpression() {
@@ -5946,7 +5918,7 @@
       void buildCondition() {
         js.Template code = js.js.parseForeignJS('#');
         push(new HForeignCode(
-            code, backend.boolType, [localsHandler.readLocal(switchTarget)],
+            code, commonMasks.boolType, [localsHandler.readLocal(switchTarget)],
             nativeBehavior: native.NativeBehavior.PURE));
       }
 
@@ -5966,7 +5938,7 @@
    * [switchCases] must be either an [Iterable] of [ast.SwitchCase] nodes or
    *   a [Link] or a [ast.NodeList] of [ast.SwitchCase] nodes.
    * [getConstants] returns the set of constants for a switch case.
-   * [isDefaultCase] returns [:true:] if the provided switch case should be
+   * [isDefaultCase] returns true if the provided switch case should be
    *   considered default for the created switch statement.
    * [buildSwitchCase] creates the statements for the switch case.
    */
@@ -5996,7 +5968,7 @@
       ast.SwitchCase switchCase = caseIterator.next();
       HBasicBlock block = graph.addNewBlock();
       for (ConstantValue constant in getConstants(switchCase)) {
-        HConstant hConstant = graph.addConstant(constant, compiler);
+        HConstant hConstant = graph.addConstant(constant, closedWorld);
         switchInstruction.inputs.add(hConstant);
         hConstant.usedBy.add(switchInstruction);
         expressionEnd.addSuccessor(block);
@@ -6079,8 +6051,8 @@
         new HSubExpressionBlockInformation(
             new SubExpression(expressionStart, expressionEnd));
     expressionStart.setBlockFlow(
-        new HSwitchBlockInformation(expressionInfo, statements,
-            jumpHandler.target, jumpHandler.labels()),
+        new HSwitchBlockInformation(
+            expressionInfo, statements, jumpHandler.target, jumpHandler.labels),
         joinBlock);
 
     jumpHandler.close();
@@ -6228,7 +6200,7 @@
       // Note that the name of this local is irrelevant.
       SyntheticLocal local =
           new SyntheticLocal('exception', localsHandler.executableContext);
-      exception = new HLocalValue(local, backend.nonNullType);
+      exception = new HLocalValue(local, commonMasks.nonNullType);
       add(exception);
       HInstruction oldRethrowableException = rethrowableException;
       rethrowableException = exception;
@@ -6240,7 +6212,7 @@
 
       void pushCondition(ast.CatchBlock catchBlock) {
         if (catchBlock.onKeyword != null) {
-          DartType type = elements.getType(catchBlock.type);
+          ResolutionDartType type = elements.getType(catchBlock.type);
           if (type == null) {
             reporter.internalError(catchBlock.type, 'On with no type.');
           }
@@ -6251,14 +6223,14 @@
           ast.VariableDefinitions declaration = catchBlock.formals.nodes.head;
           HInstruction condition = null;
           if (declaration.type == null) {
-            condition = graph.addConstantBool(true, compiler);
+            condition = graph.addConstantBool(true, closedWorld);
             stack.add(condition);
           } else {
             // TODO(aprelev@gmail.com): Once old catch syntax is removed
             // "if" condition above and this "else" branch should be deleted as
             // type of declared variable won't matter for the catch
             // condition.
-            DartType type = elements.getType(declaration.type);
+            ResolutionDartType type = elements.getType(declaration.type);
             if (type == null) {
               reporter.internalError(catchBlock, 'Catch with unresolved type.');
             }
@@ -6409,9 +6381,9 @@
    * This method is invoked before inlining the body of [function] into this
    * [SsaBuilder].
    */
-  void enterInlinedMethod(FunctionElement function,
+  void enterInlinedMethod(MethodElement function,
       ResolvedAst functionResolvedAst, List<HInstruction> compiledArguments,
-      {InterfaceType instanceType}) {
+      {ResolutionInterfaceType instanceType}) {
     AstInliningState state = new AstInliningState(
         function,
         returnLocal,
@@ -6538,7 +6510,7 @@
     //      conversions.
     //   2. The value can be primitive, because the library stringifier has
     //      fast-path code for most primitives.
-    if (expression.canBePrimitive(compiler)) {
+    if (expression.canBePrimitive(builder.closedWorld)) {
       append(stringify(node, expression));
       return;
     }
@@ -6547,8 +6519,8 @@
     // directly.
     Selector selector = Selectors.toString_;
     TypeMask type = TypeMaskFactory.inferredTypeForSelector(
-        selector, expression.instructionType, compiler);
-    if (type.containsOnlyString(compiler.closedWorld)) {
+        selector, expression.instructionType, builder.globalInferenceResults);
+    if (type.containsOnlyString(builder.closedWorld)) {
       builder.pushInvokeDynamic(node, selector, expression.instructionType,
           <HInstruction>[expression]);
       append(builder.pop());
@@ -6581,14 +6553,14 @@
 
   HInstruction concat(HInstruction left, HInstruction right) {
     HInstruction instruction =
-        new HStringConcat(left, right, builder.backend.stringType);
+        new HStringConcat(left, right, builder.commonMasks.stringType);
     builder.add(instruction);
     return instruction;
   }
 
   HInstruction stringify(ast.Node node, HInstruction expression) {
     HInstruction instruction =
-        new HStringify(expression, builder.backend.stringType);
+        new HStringify(expression, builder.commonMasks.stringType);
     builder.add(instruction);
     return instruction;
   }
@@ -6738,7 +6710,7 @@
 
 class AstInliningState extends InliningState {
   final Local oldReturnLocal;
-  final DartType oldReturnType;
+  final ResolutionDartType oldReturnType;
   final ResolvedAst oldResolvedAst;
   final List<HInstruction> oldStack;
   final LocalsHandler oldLocalsHandler;
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index c05772e..84ae3a5 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -4,6 +4,7 @@
 
 import 'package:kernel/ast.dart' as ir;
 
+import '../closure.dart';
 import '../common.dart';
 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
 import '../common/names.dart';
@@ -15,8 +16,9 @@
         InterceptorConstantValue,
         StringConstantValue,
         TypeConstantValue;
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
+import '../elements/entities.dart' show MemberEntity;
 import '../io/source_information.dart';
 import '../js/js.dart' as js;
 import '../js_backend/backend.dart' show JavaScriptBackend;
@@ -24,19 +26,22 @@
 import '../native/native.dart' as native;
 import '../resolution/tree_elements.dart';
 import '../tree/dartstring.dart';
-import '../tree/nodes.dart' show FunctionExpression, Node;
+import '../tree/nodes.dart' show Node, BreakStatement;
 import '../types/masks.dart';
 import '../universe/call_structure.dart' show CallStructure;
 import '../universe/selector.dart';
-import '../universe/use.dart' show StaticUse, TypeUse;
 import '../universe/side_effects.dart' show SideEffects;
+import '../universe/use.dart' show StaticUse;
+import '../world.dart';
 import 'graph_builder.dart';
+import 'jump_handler.dart';
 import 'kernel_ast_adapter.dart';
 import 'kernel_string_builder.dart';
 import 'locals_handler.dart';
 import 'loop_handler.dart';
 import 'nodes.dart';
 import 'ssa_branch_builder.dart';
+import 'switch_continue_analysis.dart';
 import 'type_builder.dart';
 import 'types.dart' show TypeMaskFactory;
 
@@ -50,36 +55,71 @@
       : backend = backend,
         super(backend.compiler.measurer);
 
-  HGraph build(CodegenWorkItem work) {
+  HGraph build(CodegenWorkItem work, ClosedWorld closedWorld) {
     return measure(() {
       AstElement element = work.element.implementation;
       Kernel kernel = backend.kernelTask.kernel;
-      KernelSsaBuilder builder = new KernelSsaBuilder(element, work.resolvedAst,
-          backend.compiler, work.registry, sourceInformationFactory, kernel);
-      return builder.build();
+      KernelSsaBuilder builder = new KernelSsaBuilder(
+          element,
+          work.resolvedAst,
+          backend.compiler,
+          closedWorld,
+          work.registry,
+          sourceInformationFactory,
+          kernel);
+      HGraph graph = builder.build();
+
+      if (backend.tracer.isEnabled) {
+        String name;
+        if (element.isClassMember) {
+          String className = element.enclosingClass.name;
+          String memberName = element.name;
+          name = "$className.$memberName";
+          if (element.isGenerativeConstructorBody) {
+            name = "$name (body)";
+          }
+        } else {
+          name = "${element.name}";
+        }
+        backend.tracer.traceCompilation(name);
+        backend.tracer.traceGraph('builder', graph);
+      }
+
+      return graph;
     });
   }
 }
 
 class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
   ir.Node target;
+  bool _targetIsConstructorBody = false;
   final AstElement targetElement;
   final ResolvedAst resolvedAst;
+  final ClosedWorld closedWorld;
   final CodegenRegistry registry;
 
-  /// A stack of [DartType]s that have been seen during inlining of factory
-  /// constructors.  These types are preserved in [HInvokeStatic]s and
+  /// Helper accessor for all kernel function-like targets (Procedure,
+  /// FunctionExpression, FunctionDeclaration) of the inner FunctionNode itself.
+  /// If the current target is not a function-like target, _targetFunction will
+  /// be null.
+  ir.FunctionNode _targetFunction;
+
+  /// A stack of [ResolutionDartType]s that have been seen during inlining of
+  /// factory constructors.  These types are preserved in [HInvokeStatic]s and
   /// [HCreate]s inside the inline code and registered during code generation
   /// for these nodes.
   // TODO(karlklose): consider removing this and keeping the (substituted) types
   // of the type variables in an environment (like the [LocalsHandler]).
-  final List<DartType> currentImplicitInstantiations = <DartType>[];
+  final List<ResolutionDartType> currentImplicitInstantiations =
+      <ResolutionDartType>[];
+
+  HInstruction rethrowableException;
 
   @override
   JavaScriptBackend get backend => compiler.backend;
 
   @override
-  TreeElements get elements => resolvedAst.elements;
+  TreeElements get elements => astAdapter.elements;
 
   SourceInformationBuilder sourceInformationBuilder;
   KernelAstAdapter astAdapter;
@@ -89,10 +129,15 @@
   final Map<ir.VariableDeclaration, HInstruction> letBindings =
       <ir.VariableDeclaration, HInstruction>{};
 
+  /// True if we are visiting the expression of a throw statement; we assume
+  /// this is a slow path.
+  bool _inExpressionOfThrow = false;
+
   KernelSsaBuilder(
       this.targetElement,
       this.resolvedAst,
       Compiler compiler,
+      this.closedWorld,
       this.registry,
       SourceInformationStrategy sourceInformationFactory,
       Kernel kernel) {
@@ -113,7 +158,21 @@
       originTarget = originTarget.origin;
     }
     if (originTarget is FunctionElement) {
+      if (originTarget is ConstructorBodyElement) {
+        ConstructorBodyElement body = originTarget;
+        _targetIsConstructorBody = true;
+        originTarget = body.constructor;
+      }
       target = kernel.functions[originTarget];
+      // Closures require a lookup one level deeper in the closure class mapper.
+      if (target == null) {
+        FunctionElement originTargetFunction = originTarget;
+        ClosureClassMap classMap = compiler.closureToClassMapper
+            .getClosureToClassMapping(originTargetFunction.resolvedAst);
+        if (classMap.closureElement != null) {
+          target = kernel.localFunctions[classMap.closureElement];
+        }
+      }
     } else if (originTarget is FieldElement) {
       target = kernel.fields[originTarget];
     }
@@ -123,11 +182,24 @@
     // TODO(het): no reason to do this here...
     HInstruction.idCounter = 0;
     if (target is ir.Procedure) {
-      buildProcedure(target);
+      _targetFunction = (target as ir.Procedure).function;
+      buildFunctionNode(_targetFunction);
     } else if (target is ir.Field) {
       buildField(target);
     } else if (target is ir.Constructor) {
-      buildConstructor(target);
+      if (_targetIsConstructorBody) {
+        buildConstructorBody(target);
+      } else {
+        buildConstructor(target);
+      }
+    } else if (target is ir.FunctionExpression) {
+      _targetFunction = (target as ir.FunctionExpression).function;
+      buildFunctionNode(_targetFunction);
+    } else if (target is ir.FunctionDeclaration) {
+      _targetFunction = (target as ir.FunctionDeclaration).function;
+      buildFunctionNode(_targetFunction);
+    } else {
+      throw 'No case implemented to handle target: $target';
     }
     assert(graph.isValid());
     return graph;
@@ -137,8 +209,12 @@
     openFunction();
     if (field.initializer != null) {
       field.initializer.accept(this);
+      HInstruction fieldValue = pop();
+      HInstruction checkInstruction = typeBuilder.potentiallyCheckOrTrustType(
+          fieldValue, astAdapter.getDartTypeIfValid(field.type));
+      stack.add(checkInstruction);
     } else {
-      stack.add(graph.addConstantNull(compiler));
+      stack.add(graph.addConstantNull(closedWorld));
     }
     HInstruction value = pop();
     closeAndGotoExit(new HReturn(value, null));
@@ -152,15 +228,34 @@
   HInstruction popBoolified() {
     HInstruction value = pop();
     if (typeBuilder.checkOrTrustTypes) {
-      return typeBuilder.potentiallyCheckOrTrustType(
-          value, compiler.coreTypes.boolType,
+      ResolutionInterfaceType type = compiler.commonElements.boolType;
+      return typeBuilder.potentiallyCheckOrTrustType(value, type,
           kind: HTypeConversion.BOOLEAN_CONVERSION_CHECK);
     }
-    HInstruction result = new HBoolify(value, backend.boolType);
+    HInstruction result = new HBoolify(value, commonMasks.boolType);
     add(result);
     return result;
   }
 
+  void _addClassTypeVariablesIfNeeded(ir.Member constructor) {
+    var enclosing = constructor.enclosingClass;
+    if (backend.classNeedsRti(astAdapter.getElement(enclosing))) {
+      ClassElement clsElement =
+          astAdapter.getElement(constructor).enclosingElement;
+      enclosing.typeParameters.forEach((ir.TypeParameter typeParameter) {
+        var typeParamElement = astAdapter.getElement(typeParameter);
+        HParameterValue param =
+            addParameter(typeParamElement, commonMasks.nonNullType);
+        // This is a little bit wacky (and n^2) until we make the localsHandler
+        // take Kernel DartTypes instead of just the AST DartTypes.
+        var typeVariableType = clsElement.typeVariables.firstWhere(
+            (ResolutionTypeVariableType i) => i.name == typeParameter.name);
+        localsHandler.directLocals[
+            localsHandler.getTypeVariableAsLocal(typeVariableType)] = param;
+      });
+    }
+  }
+
   /// Builds generative constructors.
   ///
   /// Generative constructors are built in two stages.
@@ -171,14 +266,16 @@
   /// constructor bodies for all constructors in the hierarchy.
   void buildConstructor(ir.Constructor constructor) {
     openFunction();
+    _addClassTypeVariablesIfNeeded(constructor);
 
     // Collect field values for the current class.
     // TODO(het): Does kernel always put field initializers in the constructor
     //            initializer list? If so then this is unnecessary...
     Map<ir.Field, HInstruction> fieldValues =
         _collectFieldValues(constructor.enclosingClass);
+    List<ir.Constructor> constructorChain = <ir.Constructor>[];
 
-    _buildInitializers(constructor, fieldValues);
+    _buildInitializers(constructor, constructorChain, fieldValues);
 
     final constructorArguments = <HInstruction>[];
     astAdapter.getClass(constructor.enclosingClass).forEachInstanceField(
@@ -189,35 +286,92 @@
 
     // TODO(het): If the class needs runtime type information, add it as a
     // constructor argument.
-    HInstruction create = new HCreate(
+    HInstruction newObject = new HCreate(
         astAdapter.getClass(constructor.enclosingClass),
         constructorArguments,
         new TypeMask.nonNullExact(
-            astAdapter.getClass(constructor.enclosingClass),
-            compiler.closedWorld),
-        instantiatedTypes: <DartType>[
+            astAdapter.getClass(constructor.enclosingClass), closedWorld),
+        instantiatedTypes: <ResolutionDartType>[
           astAdapter.getClass(constructor.enclosingClass).thisType
         ],
         hasRtiInput: false);
 
-    add(create);
+    add(newObject);
 
     // Generate calls to the constructor bodies.
 
-    closeAndGotoExit(new HReturn(create, null));
+    for (ir.Constructor body in constructorChain.reversed) {
+      if (_isEmptyStatement(body.function.body)) continue;
+
+      List<HInstruction> bodyCallInputs = <HInstruction>[];
+      bodyCallInputs.add(newObject);
+
+      // Pass uncaptured arguments first, captured arguments in a box, then type
+      // arguments.
+
+      ConstructorElement constructorElement = astAdapter.getElement(body);
+      ClosureClassMap parameterClosureData = compiler.closureToClassMapper
+          .getClosureToClassMapping(constructorElement.resolvedAst);
+
+      var functionSignature = astAdapter.getFunctionSignature(body.function);
+      // Provide the parameters to the generative constructor body.
+      functionSignature.orderedForEachParameter((ParameterElement parameter) {
+        // If [parameter] is boxed, it will be a field in the box passed as the
+        // last parameter. So no need to directly pass it.
+        if (!localsHandler.isBoxed(parameter)) {
+          bodyCallInputs.add(localsHandler.readLocal(parameter));
+        }
+      });
+
+      // If there are locals that escape (i.e. mutated in closures), we pass the
+      // box to the constructor.
+      ClosureScope scopeData = parameterClosureData
+          .capturingScopes[constructorElement.resolvedAst.node];
+      if (scopeData != null) {
+        bodyCallInputs.add(localsHandler.readLocal(scopeData.boxElement));
+      }
+
+      // TODO(sra): Pass type arguments.
+
+      _invokeConstructorBody(body, bodyCallInputs);
+    }
+
+    closeAndGotoExit(new HReturn(newObject, null));
     closeFunction();
   }
 
-  /// Maps the fields of a class to their SSA values.
+  static bool _isEmptyStatement(ir.Statement body) {
+    if (body is ir.EmptyStatement) return true;
+    if (body is ir.Block) return body.statements.every(_isEmptyStatement);
+    return false;
+  }
+
+  void _invokeConstructorBody(
+      ir.Constructor constructor, List<HInstruction> inputs) {
+    // TODO(sra): Inline the constructor body.
+    MemberEntity constructorBody =
+        astAdapter.getConstructorBodyEntity(constructor);
+    HInvokeConstructorBody invoke = new HInvokeConstructorBody(
+        constructorBody, inputs, commonMasks.nonNullType);
+    add(invoke);
+  }
+
+  /// Maps the instance fields of a class to their SSA values.
   Map<ir.Field, HInstruction> _collectFieldValues(ir.Class clazz) {
     final fieldValues = <ir.Field, HInstruction>{};
 
     for (var field in clazz.fields) {
-      if (field.initializer == null) {
-        fieldValues[field] = graph.addConstantNull(compiler);
-      } else {
-        field.initializer.accept(this);
-        fieldValues[field] = pop();
+      if (field.isInstanceMember) {
+        if (field.initializer == null) {
+          fieldValues[field] = graph.addConstantNull(closedWorld);
+        } else {
+          // Gotta update the resolvedAst when we're looking at field values
+          // outside the constructor.
+          astAdapter.pushResolvedAst(field);
+          field.initializer.accept(this);
+          fieldValues[field] = pop();
+          astAdapter.popResolvedAstStack();
+        }
       }
     }
 
@@ -226,37 +380,29 @@
 
   /// Collects field initializers all the way up the inheritance chain.
   void _buildInitializers(
-      ir.Constructor constructor, Map<ir.Field, HInstruction> fieldValues) {
-    var foundSuperCall = false;
+      ir.Constructor constructor,
+      List<ir.Constructor> constructorChain,
+      Map<ir.Field, HInstruction> fieldValues) {
+    constructorChain.add(constructor);
+    var foundSuperOrRedirectCall = false;
     for (var initializer in constructor.initializers) {
-      if (initializer is ir.SuperInitializer) {
-        foundSuperCall = true;
-        var superConstructor = initializer.target;
+      if (initializer is ir.SuperInitializer ||
+          initializer is ir.RedirectingInitializer) {
+        foundSuperOrRedirectCall = true;
+        var superOrRedirectConstructor = initializer.target;
         var arguments = _normalizeAndBuildArguments(
-            superConstructor.function, initializer.arguments);
-        _buildInlinedSuperInitializers(
-            superConstructor, arguments, fieldValues);
+            superOrRedirectConstructor.function, initializer.arguments);
+        _buildInlinedInitializers(superOrRedirectConstructor, arguments,
+            constructorChain, fieldValues);
       } else if (initializer is ir.FieldInitializer) {
         initializer.value.accept(this);
         fieldValues[initializer.field] = pop();
       }
     }
 
-    // TODO(het): does kernel always set the super initializer at the end?
-    // If there was no super-call initializer, then call the default constructor
-    // in the superclass.
-    if (!foundSuperCall) {
-      if (constructor.enclosingClass != astAdapter.objectClass) {
-        var superclass = constructor.enclosingClass.superclass;
-        var defaultConstructor = superclass.constructors
-            .firstWhere((c) => c.name == '', orElse: () => null);
-        if (defaultConstructor == null) {
-          compiler.reporter.internalError(
-              NO_LOCATION_SPANNABLE, 'Could not find default constructor.');
-        }
-        _buildInlinedSuperInitializers(
-            defaultConstructor, <HInstruction>[], fieldValues);
-      }
+    if (!foundSuperOrRedirectCall) {
+      assert(constructor.enclosingClass == astAdapter.objectClass,
+          'All constructors have super-constructor initializers, except Object()');
     }
   }
 
@@ -279,7 +425,7 @@
               backend.constants.getConstantValue(element.constant);
           assert(invariant(element, constantValue != null,
               message: 'No constant computed for $element'));
-          builtArguments.add(graph.addConstant(constantValue, compiler));
+          builtArguments.add(graph.addConstant(constantValue, closedWorld));
         }
       });
     } else {
@@ -295,7 +441,7 @@
               backend.constants.getConstantValue(element.constant);
           assert(invariant(element, constantValue != null,
               message: 'No constant computed for $element'));
-          builtArguments.add(graph.addConstant(constantValue, compiler));
+          builtArguments.add(graph.addConstant(constantValue, closedWorld));
         }
       });
     }
@@ -303,11 +449,14 @@
     return builtArguments;
   }
 
-  /// Inlines the given super [constructor]'s initializers by collecting it's
+  /// Inlines the given super [constructor]'s initializers by collecting its
   /// field values and building its constructor initializers. We visit super
   /// constructors all the way up to the [Object] constructor.
-  void _buildInlinedSuperInitializers(ir.Constructor constructor,
-      List<HInstruction> arguments, Map<ir.Field, HInstruction> fieldValues) {
+  void _buildInlinedInitializers(
+      ir.Constructor constructor,
+      List<HInstruction> arguments,
+      List<ir.Constructor> constructorChain,
+      Map<ir.Field, HInstruction> fieldValues) {
     // TODO(het): Handle RTI if class needs it
     fieldValues.addAll(_collectFieldValues(constructor.enclosingClass));
 
@@ -324,30 +473,43 @@
 
     // TODO(het): set the locals handler state as if we were inlining the
     // constructor.
-    _buildInitializers(constructor, fieldValues);
+    _buildInitializers(constructor, constructorChain, fieldValues);
   }
 
   HTypeConversion buildFunctionTypeConversion(
-      HInstruction original, DartType type, int kind) {
+      HInstruction original, ResolutionDartType type, int kind) {
     HInstruction reifiedType = buildFunctionType(type);
     return new HTypeConversion.viaMethodOnType(
         type, kind, original.instructionType, reifiedType, original);
   }
 
-  /// Builds a SSA graph for [procedure].
-  void buildProcedure(ir.Procedure procedure) {
+  /// Builds generative constructor body.
+  void buildConstructorBody(ir.Constructor constructor) {
     openFunction();
-    procedure.function.body.accept(this);
+    constructor.function.body.accept(this);
     closeFunction();
   }
 
-  void addImplicitInstantiation(DartType type) {
+  /// Builds a SSA graph for FunctionNodes, found in FunctionExpressions and
+  /// Procedures.
+  void buildFunctionNode(ir.FunctionNode functionNode) {
+    openFunction();
+    if (functionNode.parent is ir.Procedure &&
+        (functionNode.parent as ir.Procedure).kind ==
+            ir.ProcedureKind.Factory) {
+      _addClassTypeVariablesIfNeeded(functionNode.parent);
+    }
+    functionNode.body.accept(this);
+    closeFunction();
+  }
+
+  void addImplicitInstantiation(ResolutionDartType type) {
     if (type != null) {
       currentImplicitInstantiations.add(type);
     }
   }
 
-  void removeImplicitInstantiation(DartType type) {
+  void removeImplicitInstantiation(ResolutionDartType type) {
     if (type != null) {
       currentImplicitInstantiations.removeLast();
     }
@@ -374,22 +536,61 @@
 
   /// Pushes a boolean checking [expression] against null.
   pushCheckNull(HInstruction expression) {
-    push(new HIdentity(
-        expression, graph.addConstantNull(compiler), null, backend.boolType));
+    push(new HIdentity(expression, graph.addConstantNull(closedWorld), null,
+        commonMasks.boolType));
   }
 
   @override
   void defaultExpression(ir.Expression expression) {
-    // TODO(het): This is only to get tests working
-    stack.add(graph.addConstantNull(compiler));
+    // TODO(het): This is only to get tests working.
+    _trap('Unhandled ir.${expression.runtimeType}  $expression');
   }
 
-  /// Returns the current source element.
+  @override
+  void defaultStatement(ir.Statement statement) {
+    _trap('Unhandled ir.${statement.runtimeType}  $statement');
+    pop();
+  }
+
+  void _trap(String message) {
+    HInstruction nullValue = graph.addConstantNull(closedWorld);
+    HInstruction errorMessage =
+        graph.addConstantString(new DartString.literal(message), closedWorld);
+    HInstruction trap = new HForeignCode(js.js.parseForeignJS("#.#"),
+        commonMasks.dynamicType, <HInstruction>[nullValue, errorMessage]);
+    trap.sideEffects
+      ..setAllSideEffects()
+      ..setDependsOnSomething();
+    push(trap);
+  }
+
+  /// Returns the current source element. This is used by the type builder.
   ///
   /// The returned element is a declaration element.
   // TODO(efortuna): Update this when we implement inlining.
+  // TODO(sra): Re-implement type builder using Kernel types and the
+  // `target` for context.
   @override
-  Element get sourceElement => astAdapter.getElement(target);
+  Element get sourceElement => _sourceElementForTarget(target);
+
+  Element _sourceElementForTarget(ir.Node target) {
+    // For closure-converted (i.e. local functions) the source element is the
+    // 'call' method of the class that represents the closure.
+    if (target is ir.FunctionExpression) {
+      LocalFunctionElement element = astAdapter.getElement(target);
+      ClosureClassMap classMap = compiler.closureToClassMapper
+          .getClosureToClassMapping(element.resolvedAst);
+      return classMap.callElement;
+    }
+    if (target is ir.FunctionDeclaration) {
+      LocalFunctionElement element = astAdapter.getElement(target);
+      ClosureClassMap classMap = compiler.closureToClassMapper
+          .getClosureToClassMapping(element.resolvedAst);
+      return classMap.callElement;
+    }
+    Element element = astAdapter.getElement(target);
+    return element;
+  }
 
   @override
   void visitBlock(ir.Block block) {
@@ -413,23 +614,72 @@
   }
 
   @override
+  void visitEmptyStatement(ir.EmptyStatement statement) {
+    // Empty statement adds no instructions to current block.
+  }
+
+  @override
   void visitExpressionStatement(ir.ExpressionStatement exprStatement) {
-    exprStatement.expression.accept(this);
-    pop();
+    if (!isReachable) return;
+    ir.Expression expression = exprStatement.expression;
+    if (expression is ir.Throw) {
+      // TODO(sra): Prevent generating a statement when inlining.
+      _visitThrowExpression(expression.expression);
+      handleInTryStatement();
+      closeAndGotoExit(new HThrow(pop(), null));
+    } else {
+      expression.accept(this);
+      pop();
+    }
+  }
+
+  /// Returns true if the [type] is a valid return type for an asynchronous
+  /// function.
+  ///
+  /// Asynchronous functions return a `Future`, and a valid return is thus
+  /// either dynamic, Object, or Future.
+  ///
+  /// We do not accept the internal Future implementation class.
+  bool isValidAsyncReturnType(ir.DartType type) {
+    // TODO(sigurdm): In an internal library a function could be declared:
+    //
+    // _FutureImpl foo async => 1;
+    //
+    // This should be valid (because the actual value returned from an async
+    // function is a `_FutureImpl`), but currently false is returned in this
+    // case.
+    return type is ir.DynamicType ||
+        type == astAdapter.objectClass.thisType ||
+        (type is ir.InterfaceType && type == astAdapter.futureClass.thisType);
   }
 
   @override
   void visitReturnStatement(ir.ReturnStatement returnStatement) {
     HInstruction value;
     if (returnStatement.expression == null) {
-      value = graph.addConstantNull(compiler);
+      value = graph.addConstantNull(closedWorld);
     } else {
-      assert(target is ir.Procedure);
+      assert(_targetFunction != null && _targetFunction is ir.FunctionNode);
       returnStatement.expression.accept(this);
-      value = typeBuilder.potentiallyCheckOrTrustType(pop(),
-          astAdapter.getFunctionReturnType((target as ir.Procedure).function));
+      value = pop();
+      if (_targetFunction.asyncMarker == ir.AsyncMarker.Async) {
+        var returnType = astAdapter.getDartType(_targetFunction.returnType);
+        if (compiler.options.enableTypeAssertions &&
+            !isValidAsyncReturnType(_targetFunction.returnType)) {
+          generateTypeError(
+              returnStatement,
+              "Async function returned a Future,"
+              " was declared to return a ${_targetFunction.returnType}.");
+          pop();
+          return;
+        }
+      } else {
+        value = typeBuilder.potentiallyCheckOrTrustType(
+            value, astAdapter.getFunctionReturnType(_targetFunction));
+      }
     }
     // TODO(het): Add source information
+    handleInTryStatement();
     // TODO(het): Set a return value instead of closing the function when we
     // support inlining.
     closeAndGotoExit(new HReturn(value, null));
@@ -447,7 +697,7 @@
 
     HInstruction buildCondition() {
       if (forStatement.condition == null) {
-        return graph.addConstantBool(true, compiler);
+        return graph.addConstantBool(true, closedWorld);
       }
       forStatement.condition.accept(this);
       return popBoolified();
@@ -474,12 +724,11 @@
   @override
   void visitForInStatement(ir.ForInStatement forInStatement) {
     if (forInStatement.isAsync) {
-      compiler.reporter.internalError(astAdapter.getNode(forInStatement),
-          "Cannot compile async for-in using kernel.");
+      _buildAsyncForIn(forInStatement);
     }
     // If the expression being iterated over is a JS indexable type, we can
     // generate an optimized version of for-in that uses indexing.
-    if (astAdapter.isJsIndexableIterator(forInStatement)) {
+    if (astAdapter.isJsIndexableIterator(forInStatement, closedWorld)) {
       _buildForInIndexable(forInStatement);
     } else {
       _buildForInIterator(forInStatement);
@@ -507,7 +756,7 @@
 
     HInstruction buildGetLength() {
       HFieldGet result = new HFieldGet(
-          astAdapter.jsIndexableLength, array, backend.positiveIntType,
+          astAdapter.jsIndexableLength, array, commonMasks.positiveIntType,
           isAssignable: !isFixed);
       add(result);
       return result;
@@ -521,7 +770,7 @@
       //     array.length == _end || throwConcurrentModificationError(array)
       //
       HInstruction length = buildGetLength();
-      push(new HIdentity(length, originalLength, null, backend.boolType));
+      push(new HIdentity(length, originalLength, null, commonMasks.boolType));
       _pushStaticInvocation(
           astAdapter.checkConcurrentModificationError,
           [pop(), array],
@@ -532,16 +781,17 @@
     void buildInitializer() {
       forInStatement.iterable.accept(this);
       array = pop();
-      isFixed = astAdapter.isFixedLength(array.instructionType);
+      isFixed = astAdapter.isFixedLength(array.instructionType, closedWorld);
       localsHandler.updateLocal(
-          indexVariable, graph.addConstantInt(0, compiler));
+          indexVariable, graph.addConstantInt(0, closedWorld));
       originalLength = buildGetLength();
     }
 
     HInstruction buildCondition() {
       HInstruction index = localsHandler.readLocal(indexVariable);
       HInstruction length = buildGetLength();
-      HInstruction compare = new HLess(index, length, null, backend.boolType);
+      HInstruction compare =
+          new HLess(index, length, null, commonMasks.boolType);
       add(compare);
       return compare;
     }
@@ -578,9 +828,9 @@
       // but the code is horrible as `i+1` is carried around the loop in an
       // additional variable.
       HInstruction index = localsHandler.readLocal(indexVariable);
-      HInstruction one = graph.addConstantInt(1, compiler);
+      HInstruction one = graph.addConstantInt(1, closedWorld);
       HInstruction addInstruction =
-          new HAdd(index, one, null, backend.positiveIntType);
+          new HAdd(index, one, null, commonMasks.positiveIntType);
       add(addInstruction);
       localsHandler.updateLocal(indexVariable, addInstruction);
     }
@@ -629,13 +879,64 @@
         forInStatement, buildInitializer, buildCondition, () {}, buildBody);
   }
 
+  void _buildAsyncForIn(ir.ForInStatement forInStatement) {
+    // The async-for is implemented with a StreamIterator.
+    HInstruction streamIterator;
+
+    forInStatement.iterable.accept(this);
+    _pushStaticInvocation(
+        astAdapter.streamIteratorConstructor,
+        [pop(), graph.addConstantNull(closedWorld)],
+        astAdapter.streamIteratorConstructorType);
+    streamIterator = pop();
+
+    void buildInitializer() {}
+
+    HInstruction buildCondition() {
+      TypeMask mask = astAdapter.typeOfIteratorMoveNext(forInStatement);
+      _pushDynamicInvocation(forInStatement, mask, [streamIterator],
+          selector: Selectors.moveNext);
+      HInstruction future = pop();
+      push(new HAwait(future, astAdapter.makeSubtypeOfObject(closedWorld)));
+      return popBoolified();
+    }
+
+    void buildBody() {
+      TypeMask mask = astAdapter.typeOfIteratorCurrent(forInStatement);
+      _pushDynamicInvocation(forInStatement, mask, [streamIterator],
+          selector: Selectors.current);
+      localsHandler.updateLocal(
+          astAdapter.getLocal(forInStatement.variable), pop());
+      forInStatement.body.accept(this);
+    }
+
+    void buildUpdate() {}
+
+    // Creates a synthetic try/finally block in case anything async goes amiss.
+    TryCatchFinallyBuilder tryBuilder = new TryCatchFinallyBuilder(this);
+    // Build fake try body:
+    loopHandler.handleLoop(forInStatement, buildInitializer, buildCondition,
+        buildUpdate, buildBody);
+
+    void finalizerFunction() {
+      _pushDynamicInvocation(forInStatement, null, [streamIterator],
+          selector: Selectors.cancel);
+      add(new HAwait(pop(), astAdapter.makeSubtypeOfObject(closedWorld)));
+    }
+
+    tryBuilder
+      ..closeTryBody()
+      ..buildFinallyBlock(finalizerFunction)
+      ..cleanUp();
+  }
+
   HInstruction callSetRuntimeTypeInfo(
       HInstruction typeInfo, HInstruction newObject) {
     // Set the runtime type information on the object.
     ir.Procedure typeInfoSetterFn = astAdapter.setRuntimeTypeInfo;
     // TODO(efortuna): Insert source information in this static invocation.
     _pushStaticInvocation(typeInfoSetterFn, <HInstruction>[newObject, typeInfo],
-        backend.dynamicType);
+        commonMasks.dynamicType);
 
     // The new object will now be referenced through the
     // `setRuntimeTypeInfo` call. We therefore set the type of that
@@ -663,6 +964,144 @@
   }
 
   @override
+  visitDoStatement(ir.DoStatement doStatement) {
+    // TODO(efortuna): I think this can be rewritten using
+    // LoopHandler.handleLoop with some tricks about when the "update" happens.
+    LocalsHandler savedLocals = new LocalsHandler.from(localsHandler);
+    localsHandler.startLoop(astAdapter.getNode(doStatement));
+    JumpHandler jumpHandler = loopHandler.beginLoopHeader(doStatement);
+    HLoopInformation loopInfo = current.loopInformation;
+    HBasicBlock loopEntryBlock = current;
+    HBasicBlock bodyEntryBlock = current;
+    JumpTarget target = astAdapter.getJumpTarget(doStatement);
+    bool hasContinues = target != null && target.isContinueTarget;
+    if (hasContinues) {
+      // Add extra block to hang labels on.
+      // It doesn't currently work if they are on the same block as the
+      // HLoopInfo. The handling of HLabeledBlockInformation will visit a
+      // SubGraph that starts at the same block again, so the HLoopInfo is
+      // either handled twice, or it's handled after the labeled block info,
+      // both of which generate the wrong code.
+      // Using a separate block is just a simple workaround.
+      bodyEntryBlock = openNewBlock();
+    }
+    localsHandler.enterLoopBody(astAdapter.getNode(doStatement));
+    doStatement.body.accept(this);
+
+    // If there are no continues we could avoid the creation of the condition
+    // block. This could also lead to a block having multiple entries and exits.
+    HBasicBlock bodyExitBlock;
+    bool isAbortingBody = false;
+    if (current != null) {
+      bodyExitBlock = close(new HGoto());
+    } else {
+      isAbortingBody = true;
+      bodyExitBlock = lastOpenedBlock;
+    }
+
+    SubExpression conditionExpression;
+    bool loopIsDegenerate = isAbortingBody && !hasContinues;
+    if (!loopIsDegenerate) {
+      HBasicBlock conditionBlock = addNewBlock();
+
+      List<LocalsHandler> continueHandlers = <LocalsHandler>[];
+      jumpHandler
+          .forEachContinue((HContinue instruction, LocalsHandler locals) {
+        instruction.block.addSuccessor(conditionBlock);
+        continueHandlers.add(locals);
+      });
+
+      if (!isAbortingBody) {
+        bodyExitBlock.addSuccessor(conditionBlock);
+      }
+
+      if (!continueHandlers.isEmpty) {
+        if (!isAbortingBody) continueHandlers.add(localsHandler);
+        localsHandler =
+            savedLocals.mergeMultiple(continueHandlers, conditionBlock);
+        SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock);
+        List<LabelDefinition> labels = jumpHandler.labels;
+        HSubGraphBlockInformation bodyInfo =
+            new HSubGraphBlockInformation(bodyGraph);
+        HLabeledBlockInformation info;
+        if (!labels.isEmpty) {
+          info =
+              new HLabeledBlockInformation(bodyInfo, labels, isContinue: true);
+        } else {
+          info = new HLabeledBlockInformation.implicit(bodyInfo, target,
+              isContinue: true);
+        }
+        bodyEntryBlock.setBlockFlow(info, conditionBlock);
+      }
+      open(conditionBlock);
+
+      doStatement.condition.accept(this);
+      assert(!isAborted());
+      HInstruction conditionInstruction = popBoolified();
+      HBasicBlock conditionEndBlock = close(
+          new HLoopBranch(conditionInstruction, HLoopBranch.DO_WHILE_LOOP));
+
+      HBasicBlock avoidCriticalEdge = addNewBlock();
+      conditionEndBlock.addSuccessor(avoidCriticalEdge);
+      open(avoidCriticalEdge);
+      close(new HGoto());
+      avoidCriticalEdge.addSuccessor(loopEntryBlock); // The back-edge.
+
+      conditionExpression =
+          new SubExpression(conditionBlock, conditionEndBlock);
+
+      // Avoid a critical edge from the condition to the loop-exit body.
+      HBasicBlock conditionExitBlock = addNewBlock();
+      open(conditionExitBlock);
+      close(new HGoto());
+      conditionEndBlock.addSuccessor(conditionExitBlock);
+
+      loopHandler.endLoop(
+          loopEntryBlock, conditionExitBlock, jumpHandler, localsHandler);
+
+      loopEntryBlock.postProcessLoopHeader();
+      SubGraph bodyGraph = new SubGraph(loopEntryBlock, bodyExitBlock);
+      HLoopBlockInformation loopBlockInfo = new HLoopBlockInformation(
+          HLoopBlockInformation.DO_WHILE_LOOP,
+          null,
+          wrapExpressionGraph(conditionExpression),
+          wrapStatementGraph(bodyGraph),
+          null,
+          loopEntryBlock.loopInformation.target,
+          loopEntryBlock.loopInformation.labels,
+          sourceInformationBuilder.buildLoop(astAdapter.getNode(doStatement)));
+      loopEntryBlock.setBlockFlow(loopBlockInfo, current);
+      loopInfo.loopBlockInformation = loopBlockInfo;
+    } else {
+      // Since the loop has no back edge, we remove the loop information on the
+      // header.
+      loopEntryBlock.loopInformation = null;
+
+      if (jumpHandler.hasAnyBreak()) {
+        // Null branchBlock because the body of the do-while loop always aborts,
+        // so we never get to the condition.
+        loopHandler.endLoop(loopEntryBlock, null, jumpHandler, localsHandler);
+
+        // Since the body of the loop has a break, we attach a synthesized label
+        // to the body.
+        SubGraph bodyGraph = new SubGraph(bodyEntryBlock, bodyExitBlock);
+        JumpTarget target = astAdapter.getJumpTarget(doStatement);
+        LabelDefinition label = target.addLabel(null, 'loop');
+        label.setBreakTarget();
+        HLabeledBlockInformation info = new HLabeledBlockInformation(
+            new HSubGraphBlockInformation(bodyGraph), <LabelDefinition>[label]);
+        loopEntryBlock.setBlockFlow(info, current);
+        jumpHandler.forEachBreak((HBreak breakInstruction, _) {
+          HBasicBlock block = breakInstruction.block;
+          block.addAtExit(new HBreak.toLabel(label));
+          block.remove(breakInstruction);
+        });
+      }
+    }
+    jumpHandler.close();
+  }
+
+  @override
   void visitIfStatement(ir.IfStatement ifStatement) {
     handleIf(
         visitCondition: () => ifStatement.condition.accept(this),
@@ -670,11 +1109,30 @@
         visitElse: () => ifStatement.otherwise?.accept(this));
   }
 
+  void handleIf(
+      {ir.Node node,
+      void visitCondition(),
+      void visitThen(),
+      void visitElse(),
+      SourceInformation sourceInformation}) {
+    SsaBranchBuilder branchBuilder = new SsaBranchBuilder(
+        this, compiler, node == null ? node : astAdapter.getNode(node));
+    branchBuilder.handleIf(visitCondition, visitThen, visitElse,
+        sourceInformation: sourceInformation);
+  }
+
   @override
   void visitAsExpression(ir.AsExpression asExpression) {
     asExpression.operand.accept(this);
     HInstruction expressionInstruction = pop();
-    DartType type = astAdapter.getDartType(asExpression.type);
+
+    if (asExpression.type is ir.InvalidType) {
+      generateTypeError(asExpression, 'invalid type');
+      stack.add(expressionInstruction);
+      return;
+    }
+
+    ResolutionDartType type = astAdapter.getDartType(asExpression.type);
     if (type.isMalformed) {
       if (type is MalformedType) {
         ErroneousElement element = type.element;
@@ -695,14 +1153,17 @@
     }
   }
 
-  void generateError(ir.Node node, String message, TypeMask typeMask) {
+  void generateError(
+      ir.Node node, ir.Procedure procedure, String message, TypeMask typeMask) {
     HInstruction errorMessage =
-        graph.addConstantString(new DartString.literal(message), compiler);
-    _pushStaticInvocation(node, [errorMessage], typeMask);
+        graph.addConstantString(new DartString.literal(message), closedWorld);
+    // TODO(sra): Assocate source info from [node].
+    _pushStaticInvocation(procedure, [errorMessage], typeMask);
   }
 
   void generateTypeError(ir.Node node, String message) {
-    generateError(node, message, astAdapter.throwTypeErrorType);
+    generateError(node, astAdapter.throwTypeError, message,
+        astAdapter.throwTypeErrorType);
   }
 
   @override
@@ -733,6 +1194,425 @@
     handleIf(visitCondition: buildCondition, visitThen: fail);
   }
 
+  /// Creates a [JumpHandler] for a statement. The node must be a jump
+  /// target. If there are no breaks or continues targeting the statement,
+  /// a special "null handler" is returned.
+  ///
+  /// [isLoopJump] is true when the jump handler is for a loop. This is used
+  /// to distinguish the synthesized loop created for a switch statement with
+  /// continue statements from simple switch statements.
+  JumpHandler createJumpHandler(ir.TreeNode node, {bool isLoopJump: false}) {
+    JumpTarget target = astAdapter.getJumpTarget(node);
+    assert(target is KernelJumpTarget);
+    if (target == null) {
+      // No breaks or continues to this node.
+      return new NullJumpHandler(compiler.reporter);
+    }
+    if (isLoopJump && node is ir.SwitchStatement) {
+      return new KernelSwitchCaseJumpHandler(this, target, node, astAdapter);
+    }
+
+    return new JumpHandler(this, target);
+  }
+
+  @override
+  void visitBreakStatement(ir.BreakStatement breakStatement) {
+    assert(!isAborted());
+    handleInTryStatement();
+    JumpTarget target = astAdapter.getJumpTarget(breakStatement.target);
+    assert(target != null);
+    JumpHandler handler = jumpTargets[target];
+    assert(handler != null);
+    if (handler.labels.isNotEmpty) {
+      handler.generateBreak(handler.labels.first);
+    } else {
+      handler.generateBreak();
+    }
+  }
+
+  @override
+  void visitLabeledStatement(ir.LabeledStatement labeledStatement) {
+    ir.Statement body = labeledStatement.body;
+    if (body is ir.WhileStatement ||
+        body is ir.DoStatement ||
+        body is ir.ForStatement ||
+        body is ir.ForInStatement ||
+        body is ir.SwitchStatement) {
+      // loops and switches handle breaks on their own
+      body.accept(this);
+      return;
+    }
+    JumpHandler handler = createJumpHandler(labeledStatement);
+
+    LocalsHandler beforeLocals = new LocalsHandler.from(localsHandler);
+
+    HBasicBlock newBlock = openNewBlock();
+    body.accept(this);
+    SubGraph bodyGraph = new SubGraph(newBlock, lastOpenedBlock);
+
+    HBasicBlock joinBlock = graph.addNewBlock();
+    List<LocalsHandler> breakHandlers = <LocalsHandler>[];
+    handler.forEachBreak((HBreak breakInstruction, LocalsHandler locals) {
+      breakInstruction.block.addSuccessor(joinBlock);
+      breakHandlers.add(locals);
+    });
+
+    if (!isAborted()) {
+      goto(current, joinBlock);
+      breakHandlers.add(localsHandler);
+    }
+
+    open(joinBlock);
+    localsHandler = beforeLocals.mergeMultiple(breakHandlers, joinBlock);
+
+    // There was at least one reachable break, so the label is needed.
+    newBlock.setBlockFlow(
+        new HLabeledBlockInformation(
+            new HSubGraphBlockInformation(bodyGraph), handler.labels),
+        joinBlock);
+    handler.close();
+  }
+
+  /// Loop through the cases in a switch and create a mapping of case
+  /// expressions to constants.
+  Map<ir.Expression, ConstantValue> _buildSwitchCaseConstants(
+      ir.SwitchStatement switchStatement) {
+    Map<ir.Expression, ConstantValue> constants =
+        new Map<ir.Expression, ConstantValue>();
+    for (ir.SwitchCase switchCase in switchStatement.cases) {
+      for (ir.Expression caseExpression in switchCase.expressions) {
+        ConstantValue constant = astAdapter.getConstantFor(caseExpression);
+        constants[caseExpression] = constant;
+      }
+    }
+    return constants;
+  }
+
+  @override
+  void visitContinueSwitchStatement(
+      ir.ContinueSwitchStatement switchStatement) {
+    handleInTryStatement();
+    JumpTarget target = astAdapter.getJumpTarget(switchStatement.target);
+    assert(target != null);
+    JumpHandler handler = jumpTargets[target];
+    assert(handler != null);
+    assert(target.labels.isNotEmpty);
+    handler.generateContinue(target.labels.first);
+  }
+
+  @override
+  void visitSwitchStatement(ir.SwitchStatement switchStatement) {
+    // The switch case indices must match those computed in
+    // [KernelSwitchCaseJumpHandler].
+    bool hasContinue = false;
+    Map<ir.SwitchCase, int> caseIndex = new Map<ir.SwitchCase, int>();
+    int switchIndex = 1;
+    bool hasDefault = false;
+    for (ir.SwitchCase switchCase in switchStatement.cases) {
+      if (SwitchContinueAnalysis.containsContinue(switchCase.body)) {
+        hasContinue = true;
+      }
+      if (switchCase.isDefault) {
+        hasDefault = true;
+      }
+      caseIndex[switchCase] = switchIndex;
+      switchIndex++;
+    }
+
+    JumpHandler jumpHandler = createJumpHandler(switchStatement);
+    if (!hasContinue) {
+      // If the switch statement has no switch cases targeted by continue
+      // statements we encode the switch statement directly.
+      _buildSimpleSwitchStatement(switchStatement, jumpHandler);
+    } else {
+      _buildComplexSwitchStatement(
+          switchStatement, jumpHandler, caseIndex, hasDefault);
+    }
+  }
+
+  /// Helper for building switch statements.
+  static bool _isDefaultCase(ir.SwitchCase switchCase) =>
+      switchCase == null || switchCase.isDefault;
+
+  /// Helper for building switch statements.
+  HInstruction _buildExpression(ir.SwitchStatement switchStatement) {
+    switchStatement.expression.accept(this);
+    return pop();
+  }
+
+  /// Helper method for creating the list of constants that make up the
+  /// switch case branches.
+  List<ConstantValue> _getSwitchConstants(
+      ir.SwitchStatement parentSwitch, ir.SwitchCase switchCase) {
+    Map<ir.Expression, ConstantValue> constantsLookup =
+        _buildSwitchCaseConstants(parentSwitch);
+    List<ConstantValue> constantList = <ConstantValue>[];
+    if (switchCase != null) {
+      for (var expression in switchCase.expressions) {
+        constantList.add(constantsLookup[expression]);
+      }
+    }
+    return constantList;
+  }
+
+  /// Builds a simple switch statement which does not handle uses of continue
+  /// statements to labeled switch cases.
+  void _buildSimpleSwitchStatement(
+      ir.SwitchStatement switchStatement, JumpHandler jumpHandler) {
+    void buildSwitchCase(ir.SwitchCase switchCase) {
+      switchCase.body.accept(this);
+    }
+
+    _handleSwitch(
+        switchStatement,
+        jumpHandler,
+        _buildExpression,
+        switchStatement.cases,
+        _getSwitchConstants,
+        _isDefaultCase,
+        buildSwitchCase);
+    jumpHandler.close();
+  }
+
+  /// Builds a switch statement that can handle arbitrary uses of continue
+  /// statements to labeled switch cases.
+  void _buildComplexSwitchStatement(
+      ir.SwitchStatement switchStatement,
+      JumpHandler jumpHandler,
+      Map<ir.SwitchCase, int> caseIndex,
+      bool hasDefault) {
+    // If the switch statement has switch cases targeted by continue
+    // statements we create the following encoding:
+    //
+    //   switch (e) {
+    //     l_1: case e0: s_1; break;
+    //     l_2: case e1: s_2; continue l_i;
+    //     ...
+    //     l_n: default: s_n; continue l_j;
+    //   }
+    //
+    // is encoded as
+    //
+    //   var target;
+    //   switch (e) {
+    //     case e1: target = 1; break;
+    //     case e2: target = 2; break;
+    //     ...
+    //     default: target = n; break;
+    //   }
+    //   l: while (true) {
+    //    switch (target) {
+    //       case 1: s_1; break l;
+    //       case 2: s_2; target = i; continue l;
+    //       ...
+    //       case n: s_n; target = j; continue l;
+    //     }
+    //   }
+    //
+    // This is because JS does not have this same "continue label" semantics so
+    // we encode it in the form of a state machine.
+
+    JumpTarget switchTarget = astAdapter.getJumpTarget(switchStatement.parent);
+    localsHandler.updateLocal(switchTarget, graph.addConstantNull(closedWorld));
+
+    var switchCases = switchStatement.cases;
+    if (!hasDefault) {
+      // Use null as the marker for a synthetic default clause.
+      // The synthetic default is added because otherwise there would be no
+      // good place to give a default value to the local.
+      switchCases = new List<ir.SwitchCase>.from(switchCases);
+      switchCases.add(null);
+    }
+
+    void buildSwitchCase(ir.SwitchCase switchCase) {
+      if (switchCase != null) {
+        // Generate 'target = i; break;' for switch case i.
+        int index = caseIndex[switchCase];
+        HInstruction value = graph.addConstantInt(index, closedWorld);
+        localsHandler.updateLocal(switchTarget, value);
+      } else {
+        // Generate synthetic default case 'target = null; break;'.
+        HInstruction nullValue = graph.addConstantNull(closedWorld);
+        localsHandler.updateLocal(switchTarget, nullValue);
+      }
+      jumpTargets[switchTarget].generateBreak();
+    }
+
+    _handleSwitch(switchStatement, jumpHandler, _buildExpression, switchCases,
+        _getSwitchConstants, _isDefaultCase, buildSwitchCase);
+    jumpHandler.close();
+
+    HInstruction buildCondition() => graph.addConstantBool(true, closedWorld);
+
+    void buildSwitch() {
+      HInstruction buildExpression(ir.SwitchStatement notUsed) {
+        return localsHandler.readLocal(switchTarget);
+      }
+
+      List<ConstantValue> getConstants(
+          ir.SwitchStatement parentSwitch, ir.SwitchCase switchCase) {
+        return <ConstantValue>[
+          backend.constantSystem.createInt(caseIndex[switchCase])
+        ];
+      }
+
+      void buildSwitchCase(ir.SwitchCase switchCase) {
+        switchCase.body.accept(this);
+        if (!isAborted()) {
+          // Ensure that we break the loop if the case falls through. (This
+          // is only possible for the last case.)
+          jumpTargets[switchTarget].generateBreak();
+        }
+      }
+
+      // Pass a [NullJumpHandler] because the target for the contained break
+      // is not the generated switch statement but instead the loop generated
+      // in the call to [handleLoop] below.
+      _handleSwitch(
+          switchStatement, // nor is buildExpression.
+          new NullJumpHandler(compiler.reporter),
+          buildExpression,
+          switchStatement.cases,
+          getConstants,
+          (_) => false, // No case is default.
+          buildSwitchCase);
+    }
+
+    void buildLoop() {
+      loopHandler.handleLoop(
+          switchStatement, () {}, buildCondition, () {}, buildSwitch);
+    }
+
+    if (hasDefault) {
+      buildLoop();
+    } else {
+      // If the switch statement has no default case, surround the loop with
+      // a test of the target. So:
+      // `if (target) while (true) ...` If there's no default case, target is
+      // null, so we don't drop into the while loop.
+      void buildCondition() {
+        js.Template code = js.js.parseForeignJS('#');
+        push(new HForeignCode(
+            code, commonMasks.boolType, [localsHandler.readLocal(switchTarget)],
+            nativeBehavior: native.NativeBehavior.PURE));
+      }
+
+      handleIf(
+          node: switchStatement,
+          visitCondition: buildCondition,
+          visitThen: buildLoop,
+          visitElse: () => {});
+    }
+  }
+
+  /// Creates a switch statement.
+  ///
+  /// [jumpHandler] is the [JumpHandler] for the created switch statement.
+  /// [buildSwitchCase] creates the statements for the switch case.
+  void _handleSwitch(
+      ir.SwitchStatement switchStatement,
+      JumpHandler jumpHandler,
+      HInstruction buildExpression(ir.SwitchStatement statement),
+      List<ir.SwitchCase> switchCases,
+      List<ConstantValue> getConstants(
+          ir.SwitchStatement parentSwitch, ir.SwitchCase switchCase),
+      bool isDefaultCase(ir.SwitchCase switchCase),
+      void buildSwitchCase(ir.SwitchCase switchCase)) {
+    HBasicBlock expressionStart = openNewBlock();
+    HInstruction expression = buildExpression(switchStatement);
+
+    if (switchCases.isEmpty) {
+      return;
+    }
+
+    HSwitch switchInstruction = new HSwitch(<HInstruction>[expression]);
+    HBasicBlock expressionEnd = close(switchInstruction);
+    LocalsHandler savedLocals = localsHandler;
+
+    List<HStatementInformation> statements = <HStatementInformation>[];
+    bool hasDefault = false;
+    for (ir.SwitchCase switchCase in switchCases) {
+      HBasicBlock block = graph.addNewBlock();
+      for (ConstantValue constant
+          in getConstants(switchStatement, switchCase)) {
+        HConstant hConstant = graph.addConstant(constant, closedWorld);
+        switchInstruction.inputs.add(hConstant);
+        hConstant.usedBy.add(switchInstruction);
+        expressionEnd.addSuccessor(block);
+      }
+
+      if (isDefaultCase(switchCase)) {
+        // An HSwitch has n inputs and n+1 successors, the last being the
+        // default case.
+        expressionEnd.addSuccessor(block);
+        hasDefault = true;
+      }
+      open(block);
+      localsHandler = new LocalsHandler.from(savedLocals);
+      buildSwitchCase(switchCase);
+      statements.add(
+          new HSubGraphBlockInformation(new SubGraph(block, lastOpenedBlock)));
+    }
+
+    // Add a join-block if necessary.
+    // We create [joinBlock] early, and then go through the cases that might
+    // want to jump to it. In each case, if we add [joinBlock] as a successor
+    // of another block, we also add an element to [caseHandlers] that is used
+    // to create the phis in [joinBlock].
+    // If we never jump to the join block, [caseHandlers] will stay empty, and
+    // the join block is never added to the graph.
+    HBasicBlock joinBlock = new HBasicBlock();
+    List<LocalsHandler> caseHandlers = <LocalsHandler>[];
+    jumpHandler.forEachBreak((HBreak instruction, LocalsHandler locals) {
+      instruction.block.addSuccessor(joinBlock);
+      caseHandlers.add(locals);
+    });
+    jumpHandler.forEachContinue((HContinue instruction, LocalsHandler locals) {
+      assert(invariant(astAdapter.getNode(switchStatement), false,
+          message: 'Continue cannot target a switch.'));
+    });
+    if (!isAborted()) {
+      current.close(new HGoto());
+      lastOpenedBlock.addSuccessor(joinBlock);
+      caseHandlers.add(localsHandler);
+    }
+    if (!hasDefault) {
+      // Always create a default case, to avoid a critical edge in the
+      // graph.
+      HBasicBlock defaultCase = addNewBlock();
+      expressionEnd.addSuccessor(defaultCase);
+      open(defaultCase);
+      close(new HGoto());
+      defaultCase.addSuccessor(joinBlock);
+      caseHandlers.add(savedLocals);
+      statements.add(new HSubGraphBlockInformation(
+          new SubGraph(defaultCase, defaultCase)));
+    }
+    assert(caseHandlers.length == joinBlock.predecessors.length);
+    if (caseHandlers.length != 0) {
+      graph.addBlock(joinBlock);
+      open(joinBlock);
+      if (caseHandlers.length == 1) {
+        localsHandler = caseHandlers[0];
+      } else {
+        localsHandler = savedLocals.mergeMultiple(caseHandlers, joinBlock);
+      }
+    } else {
+      // The joinblock is not used.
+      joinBlock = null;
+    }
+
+    HSubExpressionBlockInformation expressionInfo =
+        new HSubExpressionBlockInformation(
+            new SubExpression(expressionStart, expressionEnd));
+    expressionStart.setBlockFlow(
+        new HSwitchBlockInformation(
+            expressionInfo, statements, jumpHandler.target, jumpHandler.labels),
+        joinBlock);
+
+    jumpHandler.close();
+  }
+
   @override
   void visitConditionalExpression(ir.ConditionalExpression conditional) {
     SsaBranchBuilder brancher = new SsaBranchBuilder(this, compiler);
@@ -752,47 +1632,47 @@
 
   @override
   void visitIntLiteral(ir.IntLiteral intLiteral) {
-    stack.add(graph.addConstantInt(intLiteral.value, compiler));
+    stack.add(graph.addConstantInt(intLiteral.value, closedWorld));
   }
 
   @override
   void visitDoubleLiteral(ir.DoubleLiteral doubleLiteral) {
-    stack.add(graph.addConstantDouble(doubleLiteral.value, compiler));
+    stack.add(graph.addConstantDouble(doubleLiteral.value, closedWorld));
   }
 
   @override
   void visitBoolLiteral(ir.BoolLiteral boolLiteral) {
-    stack.add(graph.addConstantBool(boolLiteral.value, compiler));
+    stack.add(graph.addConstantBool(boolLiteral.value, closedWorld));
   }
 
   @override
   void visitStringLiteral(ir.StringLiteral stringLiteral) {
     stack.add(graph.addConstantString(
-        new DartString.literal(stringLiteral.value), compiler));
+        new DartString.literal(stringLiteral.value), closedWorld));
   }
 
   @override
   void visitSymbolLiteral(ir.SymbolLiteral symbolLiteral) {
     stack.add(graph.addConstant(
-        astAdapter.getConstantForSymbol(symbolLiteral), compiler));
+        astAdapter.getConstantForSymbol(symbolLiteral), closedWorld));
     registry?.registerConstSymbol(symbolLiteral.value);
   }
 
   @override
   void visitNullLiteral(ir.NullLiteral nullLiteral) {
-    stack.add(graph.addConstantNull(compiler));
+    stack.add(graph.addConstantNull(closedWorld));
   }
 
   /// Set the runtime type information if necessary.
   HInstruction setListRuntimeTypeInfoIfNeeded(
       HInstruction object, ir.ListLiteral listLiteral) {
-    InterfaceType type = localsHandler
-        .substInContext(elements.getType(astAdapter.getNode(listLiteral)));
+    ResolutionInterfaceType type = localsHandler
+        .substInContext(astAdapter.getDartTypeOfListLiteral(listLiteral));
     if (!backend.classNeedsRti(type.element) || type.treatAsRaw) {
       return object;
     }
     List<HInstruction> arguments = <HInstruction>[];
-    for (DartType argument in type.typeArguments) {
+    for (ResolutionDartType argument in type.typeArguments) {
       arguments.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
     }
     // TODO(15489): Register at codegen.
@@ -804,22 +1684,24 @@
   void visitListLiteral(ir.ListLiteral listLiteral) {
     HInstruction listInstruction;
     if (listLiteral.isConst) {
-      listInstruction =
-          graph.addConstant(astAdapter.getConstantFor(listLiteral), compiler);
+      listInstruction = graph.addConstant(
+          astAdapter.getConstantFor(listLiteral), closedWorld);
     } else {
       List<HInstruction> elements = <HInstruction>[];
       for (ir.Expression element in listLiteral.expressions) {
         element.accept(this);
         elements.add(pop());
       }
-      listInstruction = new HLiteralList(elements, backend.extendableArrayType);
+      listInstruction =
+          new HLiteralList(elements, commonMasks.extendableArrayType);
       add(listInstruction);
       listInstruction =
           setListRuntimeTypeInfoIfNeeded(listInstruction, listLiteral);
     }
 
-    TypeMask type = astAdapter.typeOfNewList(targetElement, listLiteral);
-    if (!type.containsAll(compiler.closedWorld)) {
+    TypeMask type =
+        astAdapter.typeOfListLiteral(targetElement, listLiteral, closedWorld);
+    if (!type.containsAll(closedWorld)) {
       listInstruction.instructionType = type;
     }
     stack.add(listInstruction);
@@ -828,8 +1710,8 @@
   @override
   void visitMapLiteral(ir.MapLiteral mapLiteral) {
     if (mapLiteral.isConst) {
-      stack.add(
-          graph.addConstant(astAdapter.getConstantFor(mapLiteral), compiler));
+      stack.add(graph.addConstant(
+          astAdapter.getConstantFor(mapLiteral), closedWorld));
       return;
     }
 
@@ -849,21 +1731,21 @@
     } else {
       constructor = astAdapter.mapLiteralConstructor;
       HLiteralList argList =
-          new HLiteralList(constructorArgs, backend.extendableArrayType);
+          new HLiteralList(constructorArgs, commonMasks.extendableArrayType);
       add(argList);
       inputs.add(argList);
     }
 
     assert(constructor.kind == ir.ProcedureKind.Factory);
 
-    InterfaceType type = localsHandler
-        .substInContext(elements.getType(astAdapter.getNode(mapLiteral)));
+    ResolutionInterfaceType type = localsHandler
+        .substInContext(astAdapter.getDartTypeOfMapLiteral(mapLiteral));
 
     ir.Class cls = constructor.enclosingClass;
 
     if (backend.classNeedsRti(astAdapter.getElement(cls))) {
       List<HInstruction> typeInputs = <HInstruction>[];
-      type.typeArguments.forEach((DartType argument) {
+      type.typeArguments.forEach((ResolutionDartType argument) {
         typeInputs
             .add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
       });
@@ -884,18 +1766,18 @@
     // If runtime type information is needed and the map literal has no type
     // parameters, 'constructor' is a static function that forwards the call to
     // the factory constructor without type parameters.
-    assert(constructor.kind == ir.ProcedureKind.Factory);
+    assert(constructor.kind == ir.ProcedureKind.Method ||
+        constructor.kind == ir.ProcedureKind.Factory);
 
     // The instruction type will always be a subtype of the mapLiteralClass, but
     // type inference might discover a more specific type, or find nothing (in
     // dart2js unit tests).
     TypeMask mapType = new TypeMask.nonNullSubtype(
-        astAdapter.getElement(astAdapter.mapLiteralClass),
-        compiler.closedWorld);
+        astAdapter.getClass(astAdapter.mapLiteralClass), closedWorld);
     TypeMask returnTypeMask = TypeMaskFactory.inferredReturnTypeForElement(
-        astAdapter.getElement(constructor), compiler);
+        astAdapter.getElement(constructor), globalInferenceResults);
     TypeMask instructionType =
-        mapType.intersection(returnTypeMask, compiler.closedWorld);
+        mapType.intersection(returnTypeMask, closedWorld);
 
     addImplicitInstantiation(type);
     _pushStaticInvocation(constructor, inputs, instructionType);
@@ -913,19 +1795,24 @@
   @override
   void visitTypeLiteral(ir.TypeLiteral typeLiteral) {
     ir.DartType type = typeLiteral.type;
-    if (type is ir.InterfaceType) {
+    if (type is ir.InterfaceType || type is ir.DynamicType) {
       ConstantValue constant = astAdapter.getConstantForType(type);
-      stack.add(graph.addConstant(constant, compiler));
+      stack.add(graph.addConstant(constant, closedWorld));
       return;
     }
-    if (type is ir.TypeParameterType) {
-      // TODO(27394): Load type parameter from current 'this' object.
-      defaultExpression(typeLiteral);
-      return;
-    }
-    // TODO(27394): 'dynamic' and function types observed. Where are they from?
-    defaultExpression(typeLiteral);
-    return;
+    // For other types (e.g. TypeParameterType, function types from expanded
+    // typedefs), look-up or construct a reified type representation and convert
+    // to a RuntimeType.
+
+    // TODO(sra): Convert the type logic here to use ir.DartType.
+    ResolutionDartType dartType = astAdapter.getDartType(type);
+    dartType = localsHandler.substInContext(dartType);
+    HInstruction value = typeBuilder
+        .analyzeTypeArgument(dartType, sourceElement, sourceInformation: null);
+    _pushStaticInvocation(astAdapter.runtimeTypeToString, <HInstruction>[value],
+        commonMasks.stringType);
+    _pushStaticInvocation(astAdapter.createRuntimeType, <HInstruction>[pop()],
+        astAdapter.createRuntimeTypeReturnType);
   }
 
   @override
@@ -939,19 +1826,28 @@
     } else if (staticTarget is ir.Field && staticTarget.isConst) {
       assert(staticTarget.initializer != null);
       stack.add(graph.addConstant(
-          astAdapter.getConstantFor(staticTarget.initializer), compiler));
+          astAdapter.getConstantFor(staticTarget.initializer), closedWorld));
     } else {
-      push(new HStatic(astAdapter.getMember(staticTarget),
-          astAdapter.inferredTypeOf(staticTarget)));
+      if (_isLazyStatic(staticTarget)) {
+        push(new HLazyStatic(astAdapter.getField(staticTarget),
+            astAdapter.inferredTypeOf(staticTarget)));
+      } else {
+        push(new HStatic(astAdapter.getMember(staticTarget),
+            astAdapter.inferredTypeOf(staticTarget)));
+      }
     }
   }
 
+  bool _isLazyStatic(ir.Member target) {
+    return astAdapter.isLazyStatic(target);
+  }
+
   @override
   void visitStaticSet(ir.StaticSet staticSet) {
     staticSet.value.accept(this);
     HInstruction value = pop();
 
-    var staticTarget = staticSet.target;
+    ir.Member staticTarget = staticSet.target;
     if (staticTarget is ir.Procedure) {
       // Invoke the setter
       _pushStaticInvocation(staticTarget, <HInstruction>[value],
@@ -961,7 +1857,7 @@
       add(new HStaticStore(
           astAdapter.getMember(staticTarget),
           typeBuilder.potentiallyCheckOrTrustType(
-              value, astAdapter.getDartType(staticTarget.setterType))));
+              value, astAdapter.getDartTypeIfValid(staticTarget.setterType))));
     }
     stack.add(value);
   }
@@ -995,7 +1891,9 @@
     propertySet.value.accept(this);
     HInstruction value = pop();
 
-    _pushDynamicInvocation(propertySet, astAdapter.typeOfSet(propertySet),
+    _pushDynamicInvocation(
+        propertySet,
+        astAdapter.typeOfSet(propertySet, closedWorld),
         <HInstruction>[receiver, value]);
 
     pop();
@@ -1013,10 +1911,9 @@
   void visitVariableDeclaration(ir.VariableDeclaration declaration) {
     Local local = astAdapter.getLocal(declaration);
     if (declaration.initializer == null) {
-      HInstruction initialValue = graph.addConstantNull(compiler);
+      HInstruction initialValue = graph.addConstantNull(closedWorld);
       localsHandler.updateLocal(local, initialValue);
     } else {
-      // TODO(het): handle case where the variable is top-level or static
       declaration.initializer.accept(this);
       HInstruction initialValue = pop();
 
@@ -1028,7 +1925,6 @@
   }
 
   void _visitLocalSetter(ir.VariableDeclaration variable, HInstruction value) {
-    // TODO(het): handle case where the variable is top-level or static
     LocalElement local = astAdapter.getElement(variable);
 
     // Give the value a name if it doesn't have one already.
@@ -1040,7 +1936,7 @@
     localsHandler.updateLocal(
         local,
         typeBuilder.potentiallyCheckOrTrustType(
-            value, astAdapter.getDartType(variable.type)));
+            value, astAdapter.getDartTypeIfValid(variable.type)));
   }
 
   @override
@@ -1053,21 +1949,89 @@
     let.body.accept(this);
   }
 
-  // TODO(het): Also extract type arguments
-  /// Extracts the list of instructions for the expressions in the arguments.
-  List<HInstruction> _visitArguments(ir.Arguments arguments) {
+  /// Extracts the list of instructions for the positional subset of arguments.
+  List<HInstruction> _visitPositionalArguments(ir.Arguments arguments) {
     List<HInstruction> result = <HInstruction>[];
-
     for (ir.Expression argument in arguments.positional) {
       argument.accept(this);
       result.add(pop());
     }
+    return result;
+  }
+
+  /// Builds the list of instructions for the expressions in the arguments to a
+  /// dynamic target (member function).  Dynamic targets use stubs to add
+  /// defaulted arguments, so (unlike static targets) we do not add the default
+  /// values.
+  List<HInstruction> _visitArgumentsForDynamicTarget(
+      Selector selector, ir.Arguments arguments) {
+    List<HInstruction> values = _visitPositionalArguments(arguments);
+
+    if (arguments.named.isEmpty) return values;
+
+    var namedValues = <String, HInstruction>{};
     for (ir.NamedExpression argument in arguments.named) {
       argument.value.accept(this);
-      result.add(pop());
+      namedValues[argument.name] = pop();
+    }
+    for (String name in selector.callStructure.getOrderedNamedArguments()) {
+      values.add(namedValues[name]);
     }
 
-    return result;
+    return values;
+  }
+
+  /// Build argument list in canonical order for a static [target], including
+  /// filling in the defaulted argument value.
+  List<HInstruction> _visitArgumentsForStaticTarget(
+      ir.FunctionNode target, ir.Arguments arguments) {
+    // Visit arguments in source order, then re-order and fill in defaults.
+    var values = _visitPositionalArguments(arguments);
+
+    while (values.length < target.positionalParameters.length) {
+      ir.VariableDeclaration parameter =
+          target.positionalParameters[values.length];
+      values.add(_defaultValueForParameter(parameter));
+    }
+
+    if (arguments.named.isEmpty) return values;
+
+    var namedValues = <String, HInstruction>{};
+    for (ir.NamedExpression argument in arguments.named) {
+      argument.value.accept(this);
+      namedValues[argument.name] = pop();
+    }
+
+    // Visit named arguments in parameter-position order, selecting provided or
+    // default value.
+    // TODO(sra): Ensure the stored order is canonical so we don't have to
+    // sort. The old builder uses CallStructure.makeArgumentList which depends
+    // on the old element model.
+    var namedParameters = target.namedParameters.toList()
+      ..sort((ir.VariableDeclaration a, ir.VariableDeclaration b) =>
+          a.name.compareTo(b.name));
+    for (ir.VariableDeclaration parameter in namedParameters) {
+      HInstruction value = namedValues[parameter.name];
+      if (value == null) {
+        values.add(_defaultValueForParameter(parameter));
+      } else {
+        values.add(value);
+        namedValues.remove(parameter.name);
+      }
+    }
+    assert(namedValues.isEmpty);
+
+    return values;
+  }
+
+  HInstruction _defaultValueForParameter(ir.VariableDeclaration parameter) {
+    ir.Expression initializer = parameter.initializer;
+    if (initializer == null) return graph.addConstantNull(closedWorld);
+    // TODO(sra): Evaluate constant in ir.Node domain.
+    ConstantValue constant =
+        astAdapter.getConstantForParameterDefaultValue(initializer);
+    if (constant == null) return graph.addConstantNull(closedWorld);
+    return graph.addConstant(constant, closedWorld);
   }
 
   @override
@@ -1079,7 +2043,10 @@
     }
     TypeMask typeMask = astAdapter.returnTypeOf(target);
 
-    List<HInstruction> arguments = _visitArguments(invocation.arguments);
+    // TODO(sra): For JS interop external functions, use a different function to
+    // build arguments.
+    List<HInstruction> arguments =
+        _visitArgumentsForStaticTarget(target.function, invocation.arguments);
 
     _pushStaticInvocation(target, arguments, typeMask);
   }
@@ -1110,7 +2077,7 @@
     } else if (name == 'JS_GET_FLAG') {
       handleForeignJsGetFlag(invocation);
     } else if (name == 'JS_EFFECT') {
-      stack.add(graph.addConstantNull(compiler));
+      stack.add(graph.addConstantNull(closedWorld));
     } else if (name == 'JS_INTERCEPTOR_CONSTANT') {
       handleJsInterceptorConstant(invocation);
     } else if (name == 'JS_STRING_CONCAT') {
@@ -1194,26 +2161,19 @@
     return stringConstant.primitiveValue.slowToString();
   }
 
-  // TODO(sra): Remove when handleInvokeStaticForeign fully implemented.
-  void unhandledForeign(ir.StaticInvocation invocation) {
-    ir.Procedure target = invocation.target;
-    TypeMask typeMask = astAdapter.returnTypeOf(target);
-    List<HInstruction> arguments = _visitArguments(invocation.arguments);
-    _pushStaticInvocation(target, arguments, typeMask);
-  }
-
   void handleForeignJsCurrentIsolateContext(ir.StaticInvocation invocation) {
     if (_unexpectedForeignArguments(invocation, 0, 0)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
-    if (!compiler.hasIsolateSupport) {
+    if (!backend.hasIsolateSupport) {
       // If the isolate library is not used, we just generate code
       // to fetch the static state.
       String name = backend.namer.staticStateHolder;
       push(new HForeignCode(
-          js.js.parseForeignJS(name), backend.dynamicType, <HInstruction>[],
+          js.js.parseForeignJS(name), commonMasks.dynamicType, <HInstruction>[],
           nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
     } else {
       // Call a helper method from the isolate library. The isolate library uses
@@ -1224,12 +2184,33 @@
         compiler.reporter.internalError(astAdapter.getNode(invocation),
             'Isolate library and compiler mismatch.');
       }
-      _pushStaticInvocation(target, <HInstruction>[], backend.dynamicType);
+      _pushStaticInvocation(target, <HInstruction>[], commonMasks.dynamicType);
     }
   }
 
   void handleForeignJsCallInIsolate(ir.StaticInvocation invocation) {
-    unhandledForeign(invocation);
+    if (_unexpectedForeignArguments(invocation, 2, 2)) {
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
+      return;
+    }
+
+    List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments);
+
+    if (!backend.hasIsolateSupport) {
+      // If the isolate library is not used, we ignore the isolate argument and
+      // just invoke the closure.
+      push(new HInvokeClosure(new Selector.callClosure(0),
+          <HInstruction>[inputs[1]], commonMasks.dynamicType));
+    } else {
+      // Call a helper method from the isolate library.
+      ir.Procedure callInIsolate = astAdapter.callInIsolate;
+      if (callInIsolate == null) {
+        compiler.reporter.internalError(astAdapter.getNode(invocation),
+            'Isolate library and compiler mismatch.');
+      }
+      _pushStaticInvocation(callInIsolate, inputs, commonMasks.dynamicType);
+    }
   }
 
   void handleForeignDartClosureToJs(
@@ -1242,7 +2223,8 @@
   void handleForeignRawFunctionRef(
       ir.StaticInvocation invocation, String name) {
     if (_unexpectedForeignArguments(invocation, 1, 1)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
@@ -1258,11 +2240,11 @@
                   function.positionalParameters.length &&
               function.namedParameters.isEmpty) {
             registry?.registerStaticUse(
-                new StaticUse.foreignUse(astAdapter.getMember(staticTarget)));
+                new StaticUse.foreignUse(astAdapter.getMethod(staticTarget)));
             push(new HForeignCode(
                 js.js.expressionTemplateYielding(backend.emitter
-                    .staticFunctionAccess(astAdapter.getMember(staticTarget))),
-                backend.dynamicType,
+                    .staticFunctionAccess(astAdapter.getMethod(staticTarget))),
+                commonMasks.dynamicType,
                 <HInstruction>[],
                 nativeBehavior: native.NativeBehavior.PURE));
             return;
@@ -1274,39 +2256,44 @@
 
     compiler.reporter.reportErrorMessage(astAdapter.getNode(invocation),
         MessageKind.GENERIC, {'text': "'$name' $problem."});
-    stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+    stack.add(graph.addConstantNull(closedWorld)); // Result expected on stack.
     return;
   }
 
   void handleForeignJsSetStaticState(ir.StaticInvocation invocation) {
-    if (_unexpectedForeignArguments(invocation, 0, 0)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+    if (_unexpectedForeignArguments(invocation, 1, 1)) {
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
-    _visitArguments(invocation.arguments);
+
+    List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments);
+
     String isolateName = backend.namer.staticStateHolder;
     SideEffects sideEffects = new SideEffects.empty();
     sideEffects.setAllSideEffects();
     push(new HForeignCode(js.js.parseForeignJS("$isolateName = #"),
-        backend.dynamicType, <HInstruction>[pop()],
+        commonMasks.dynamicType, inputs,
         nativeBehavior: native.NativeBehavior.CHANGES_OTHER,
         effects: sideEffects));
   }
 
   void handleForeignJsGetStaticState(ir.StaticInvocation invocation) {
     if (_unexpectedForeignArguments(invocation, 0, 0)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
     push(new HForeignCode(js.js.parseForeignJS(backend.namer.staticStateHolder),
-        backend.dynamicType, <HInstruction>[],
+        commonMasks.dynamicType, <HInstruction>[],
         nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
   }
 
   void handleForeignJsGetName(ir.StaticInvocation invocation) {
     if (_unexpectedForeignArguments(invocation, 1, 1)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
@@ -1317,7 +2304,7 @@
     if (instruction is HConstant) {
       js.Name name =
           astAdapter.getNameForJsGetName(argument, instruction.constant);
-      stack.add(graph.addConstantStringFromName(name, compiler));
+      stack.add(graph.addConstantStringFromName(name, closedWorld));
       return;
     }
 
@@ -1325,12 +2312,14 @@
         astAdapter.getNode(argument),
         MessageKind.GENERIC,
         {'text': 'Error: Expected a JsGetName enum value.'});
-    stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+    // Result expected on stack.
+    stack.add(graph.addConstantNull(closedWorld));
   }
 
   void handleForeignJsEmbeddedGlobal(ir.StaticInvocation invocation) {
     if (_unexpectedForeignArguments(invocation, 2, 2)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
     String globalName = _foreignConstantStringArgument(
@@ -1343,14 +2332,16 @@
     assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null,
         message: "No NativeBehavior for $invocation"));
 
-    TypeMask ssaType = astAdapter.typeFromNativeBehavior(nativeBehavior);
+    TypeMask ssaType =
+        astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld);
     push(new HForeignCode(expr, ssaType, const <HInstruction>[],
         nativeBehavior: nativeBehavior));
   }
 
   void handleForeignJsBuiltin(ir.StaticInvocation invocation) {
     if (_unexpectedForeignArguments(invocation, 2)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
@@ -1369,7 +2360,8 @@
           astAdapter.getNode(nameArgument),
           MessageKind.GENERIC,
           {'text': 'Error: Expected a JsBuiltin enum value.'});
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
@@ -1384,7 +2376,8 @@
     assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null,
         message: "No NativeBehavior for $invocation"));
 
-    TypeMask ssaType = astAdapter.typeFromNativeBehavior(nativeBehavior);
+    TypeMask ssaType =
+        astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld);
     push(new HForeignCode(template, ssaType, inputs,
         nativeBehavior: nativeBehavior));
   }
@@ -1392,7 +2385,8 @@
   void handleForeignJsGetFlag(ir.StaticInvocation invocation) {
     if (_unexpectedForeignArguments(invocation, 1, 1)) {
       stack.add(
-          graph.addConstantBool(false, compiler)); // Result expected on stack.
+          // Result expected on stack.
+          graph.addConstantBool(false, closedWorld));
       return;
     }
     String name = _foreignConstantStringArgument(invocation, 0, 'JS_GET_FLAG');
@@ -1410,14 +2404,15 @@
             MessageKind.GENERIC,
             {'text': 'Error: Unknown internal flag "$name".'});
     }
-    stack.add(graph.addConstantBool(value, compiler));
+    stack.add(graph.addConstantBool(value, closedWorld));
   }
 
   void handleJsInterceptorConstant(ir.StaticInvocation invocation) {
     // Single argument must be a TypeConstant which is converted into a
     // InterceptorConstant.
     if (_unexpectedForeignArguments(invocation, 1, 1)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
     ir.Expression argument = invocation.arguments.positional.single;
@@ -1425,11 +2420,12 @@
     HInstruction argumentInstruction = pop();
     if (argumentInstruction is HConstant) {
       ConstantValue argumentConstant = argumentInstruction.constant;
-      if (argumentConstant is TypeConstantValue) {
+      if (argumentConstant is TypeConstantValue &&
+          argumentConstant.representedType is ResolutionInterfaceType) {
+        ResolutionInterfaceType type = argumentConstant.representedType;
         // TODO(sra): Check that type is a subclass of [Interceptor].
-        ConstantValue constant =
-            new InterceptorConstantValue(argumentConstant.representedType);
-        HInstruction instruction = graph.addConstant(constant, compiler);
+        ConstantValue constant = new InterceptorConstantValue(type.element);
+        HInstruction instruction = graph.addConstant(constant, closedWorld);
         stack.add(instruction);
         return;
       }
@@ -1437,17 +2433,18 @@
 
     compiler.reporter.reportErrorMessage(astAdapter.getNode(invocation),
         MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
-    stack.add(graph.addConstantNull(compiler));
+    stack.add(graph.addConstantNull(closedWorld));
   }
 
   void handleForeignJs(ir.StaticInvocation invocation) {
     if (_unexpectedForeignArguments(invocation, 2)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
     native.NativeBehavior nativeBehavior =
-        astAdapter.getNativeBehavior(invocation);
+        astAdapter.getNativeBehaviorForJsCall(invocation);
     assert(invariant(astAdapter.getNode(invocation), nativeBehavior != null,
         message: "No NativeBehavior for $invocation"));
 
@@ -1463,7 +2460,8 @@
         'text': 'Mismatch between number of placeholders'
             ' and number of arguments.'
       });
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
 
@@ -1472,7 +2470,8 @@
           astAdapter.getNode(invocation), MessageKind.JS_PLACEHOLDER_CAPTURE);
     }
 
-    TypeMask ssaType = astAdapter.typeFromNativeBehavior(nativeBehavior);
+    TypeMask ssaType =
+        astAdapter.typeFromNativeBehavior(nativeBehavior, closedWorld);
 
     SourceInformation sourceInformation = null;
     push(new HForeignCode(nativeBehavior.codeTemplate, ssaType, inputs,
@@ -1483,23 +2482,24 @@
 
   void handleJsStringConcat(ir.StaticInvocation invocation) {
     if (_unexpectedForeignArguments(invocation, 2, 2)) {
-      stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+      // Result expected on stack.
+      stack.add(graph.addConstantNull(closedWorld));
       return;
     }
-    List<HInstruction> inputs = _visitArguments(invocation.arguments);
-    push(new HStringConcat(inputs[0], inputs[1], backend.stringType));
+    List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments);
+    push(new HStringConcat(inputs[0], inputs[1], commonMasks.stringType));
   }
 
   void _pushStaticInvocation(
-      ir.Node target, List<HInstruction> arguments, TypeMask typeMask) {
+      ir.Member target, List<HInstruction> arguments, TypeMask typeMask) {
     HInvokeStatic instruction = new HInvokeStatic(
         astAdapter.getMember(target), arguments, typeMask,
-        targetCanThrow: astAdapter.getCanThrow(target));
+        targetCanThrow: astAdapter.getCanThrow(target, closedWorld));
     if (currentImplicitInstantiations.isNotEmpty) {
       instruction.instantiatedTypes =
-          new List<DartType>.from(currentImplicitInstantiations);
+          new List<ResolutionDartType>.from(currentImplicitInstantiations);
     }
-    instruction.sideEffects = astAdapter.getSideEffects(target);
+    instruction.sideEffects = astAdapter.getSideEffects(target, closedWorld);
 
     push(instruction);
   }
@@ -1530,6 +2530,50 @@
     }
   }
 
+  @override
+  visitFunctionNode(ir.FunctionNode node) {
+    LocalFunctionElement methodElement = astAdapter.getElement(node);
+    ClosureClassMap nestedClosureData = compiler.closureToClassMapper
+        .getClosureToClassMapping(methodElement.resolvedAst);
+    assert(nestedClosureData != null);
+    assert(nestedClosureData.closureClassElement != null);
+    ClosureClassElement closureClassElement =
+        nestedClosureData.closureClassElement;
+    FunctionElement callElement = nestedClosureData.callElement;
+    // TODO(ahe): This should be registered in codegen, not here.
+    // TODO(johnniwinther): Is [registerStaticUse] equivalent to
+    // [addToWorkList]?
+    registry?.registerStaticUse(new StaticUse.foreignUse(callElement));
+
+    List<HInstruction> capturedVariables = <HInstruction>[];
+    closureClassElement.closureFields.forEach((ClosureFieldElement field) {
+      Local capturedLocal =
+          nestedClosureData.getLocalVariableForClosureField(field);
+      assert(capturedLocal != null);
+      capturedVariables.add(localsHandler.readLocal(capturedLocal));
+    });
+
+    TypeMask type = new TypeMask.nonNullExact(closureClassElement, closedWorld);
+    // TODO(efortuna): Add source information here.
+    push(new HCreate(closureClassElement, capturedVariables, type));
+
+    registry?.registerInstantiatedClosure(methodElement);
+  }
+
+  @override
+  visitFunctionDeclaration(ir.FunctionDeclaration declaration) {
+    assert(isReachable);
+    declaration.function.accept(this);
+    LocalFunctionElement localFunction =
+        astAdapter.getElement(declaration.function);
+    localsHandler.updateLocal(localFunction, pop());
+  }
+
+  @override
+  void visitFunctionExpression(ir.FunctionExpression funcExpression) {
+    funcExpression.function.accept(this);
+  }
+
   // TODO(het): Decide when to inline
   @override
   void visitMethodInvocation(ir.MethodInvocation invocation) {
@@ -1538,12 +2582,13 @@
     if (_handleEqualsNull(invocation)) return;
     invocation.receiver.accept(this);
     HInstruction receiver = pop();
-
+    Selector selector = astAdapter.getSelector(invocation);
     _pushDynamicInvocation(
         invocation,
-        astAdapter.typeOfInvocation(invocation),
+        astAdapter.typeOfInvocation(invocation, closedWorld),
         <HInstruction>[receiver]
-          ..addAll(_visitArguments(invocation.arguments)));
+          ..addAll(
+              _visitArgumentsForDynamicTarget(selector, invocation.arguments)));
   }
 
   bool _handleEqualsNull(ir.MethodInvocation invocation) {
@@ -1569,7 +2614,7 @@
 
   HInterceptor _interceptorFor(HInstruction intercepted) {
     HInterceptor interceptor =
-        new HInterceptor(intercepted, backend.nonNullType);
+        new HInterceptor(intercepted, commonMasks.nonNullType);
     add(interceptor);
     return interceptor;
   }
@@ -1584,9 +2629,10 @@
 
   @override
   void visitSuperMethodInvocation(ir.SuperMethodInvocation invocation) {
-    List<HInstruction> arguments = _visitArguments(invocation.arguments);
-    HInstruction receiver = localsHandler.readThis();
     Selector selector = astAdapter.getSelector(invocation);
+    List<HInstruction> arguments = _visitArgumentsForStaticTarget(
+        invocation.interfaceTarget.function, invocation.arguments);
+    HInstruction receiver = localsHandler.readThis();
     ir.Class surroundingClass = _containingClass(invocation);
 
     List<HInstruction> inputs = <HInstruction>[];
@@ -1605,16 +2651,18 @@
         null,
         isSetter: selector.isSetter || selector.isIndexSet);
     instruction.sideEffects =
-        compiler.closedWorld.getSideEffectsOfSelector(selector, null);
+        closedWorld.getSideEffectsOfSelector(selector, null);
     push(instruction);
   }
 
   @override
   void visitConstructorInvocation(ir.ConstructorInvocation invocation) {
     ir.Constructor target = invocation.target;
-    List<HInstruction> arguments = _visitArguments(invocation.arguments);
+    // TODO(sra): For JS-interop targets, process arguments differently.
+    List<HInstruction> arguments =
+        _visitArgumentsForStaticTarget(target.function, invocation.arguments);
     TypeMask typeMask = new TypeMask.nonNullExact(
-        astAdapter.getElement(target.enclosingClass), compiler.closedWorld);
+        astAdapter.getClass(target.enclosingClass), closedWorld);
     _pushStaticInvocation(target, arguments, typeMask);
   }
 
@@ -1622,30 +2670,149 @@
   void visitIsExpression(ir.IsExpression isExpression) {
     isExpression.operand.accept(this);
     HInstruction expression = pop();
+    pushIsTest(isExpression, isExpression.type, expression);
+  }
 
-    DartType type = astAdapter.getDartType(isExpression.type);
+  void pushIsTest(ir.Node node, ir.DartType type, HInstruction expression) {
+    // Note: The call to "unalias" this type like in the original SSA builder is
+    // unnecessary in kernel because Kernel has no notion of typedef.
+    // TODO(efortuna): Add test for this.
 
-    if (backend.hasDirectCheckFor(type)) {
-      push(new HIs.direct(type, expression, backend.boolType));
+    if (type is ir.InvalidType) {
+      // TODO(sra): Make InvalidType carry a message.
+      generateTypeError(node, 'invalid type');
+      pop();
+      stack.add(graph.addConstantBool(true, closedWorld));
       return;
     }
 
+    if (type is ir.DynamicType) {
+      stack.add(graph.addConstantBool(true, closedWorld));
+      return;
+    }
+
+    ResolutionDartType typeValue =
+        localsHandler.substInContext(astAdapter.getDartType(type));
+    if (type is ir.FunctionType) {
+      List arguments = [buildFunctionType(typeValue), expression];
+      _pushDynamicInvocation(node, null, arguments,
+          selector: new Selector.call(
+              new PrivateName('_isTest', backend.helpers.jsHelperLibrary),
+              CallStructure.ONE_ARG));
+      push(
+          new HIs.compound(typeValue, expression, pop(), commonMasks.boolType));
+      return;
+    }
+
+    if (type is ir.TypeParameterType) {
+      HInstruction runtimeType =
+          typeBuilder.addTypeVariableReference(typeValue, sourceElement);
+      _pushStaticInvocation(astAdapter.checkSubtypeOfRuntimeType,
+          <HInstruction>[expression, runtimeType], commonMasks.boolType);
+      push(
+          new HIs.variable(typeValue, expression, pop(), commonMasks.boolType));
+      return;
+    }
+
+    if (_isInterfaceWithNoDynamicTypes(type)) {
+      HInstruction representations = typeBuilder
+          .buildTypeArgumentRepresentations(typeValue, sourceElement);
+      add(representations);
+      ClassElement element = typeValue.element;
+      js.Name operator = backend.namer.operatorIs(element);
+      HInstruction isFieldName =
+          graph.addConstantStringFromName(operator, closedWorld);
+      HInstruction asFieldName = closedWorld.hasAnyStrictSubtype(element)
+          ? graph.addConstantStringFromName(
+              backend.namer.substitutionName(element), closedWorld)
+          : graph.addConstantNull(closedWorld);
+      List<HInstruction> inputs = <HInstruction>[
+        expression,
+        isFieldName,
+        representations,
+        asFieldName
+      ];
+      _pushStaticInvocation(
+          astAdapter.checkSubtype, inputs, commonMasks.boolType);
+      push(
+          new HIs.compound(typeValue, expression, pop(), commonMasks.boolType));
+      return;
+    }
+
+    if (backend.hasDirectCheckFor(typeValue)) {
+      push(new HIs.direct(typeValue, expression, commonMasks.boolType));
+      return;
+    }
     // The interceptor is not always needed.  It is removed by optimization
     // when the receiver type or tested type permit.
-    HInterceptor interceptor = _interceptorFor(expression);
-    push(new HIs.raw(type, expression, interceptor, backend.boolType));
+    push(new HIs.raw(typeValue, expression, _interceptorFor(expression),
+        commonMasks.boolType));
+    return;
+  }
+
+  bool _isInterfaceWithNoDynamicTypes(ir.DartType type) {
+    bool isMethodTypeVariableType(ir.DartType typeArgType) {
+      return (typeArgType is ir.TypeParameterType &&
+          typeArgType.parameter.parent is ir.FunctionNode);
+    }
+
+    return type is ir.InterfaceType &&
+        (type as ir.InterfaceType).typeArguments.any(
+            (ir.DartType typeArgType) =>
+                typeArgType is! ir.DynamicType &&
+                typeArgType is! ir.InvalidType &&
+                !isMethodTypeVariableType(type));
   }
 
   @override
   void visitThrow(ir.Throw throwNode) {
-    throwNode.expression.accept(this);
-    HInstruction expression = pop();
+    _visitThrowExpression(throwNode.expression);
     if (isReachable) {
-      push(new HThrowExpression(expression, null));
+      handleInTryStatement();
+      push(new HThrowExpression(pop(), null));
       isReachable = false;
     }
   }
 
+  void _visitThrowExpression(ir.Expression expression) {
+    bool old = _inExpressionOfThrow;
+    try {
+      _inExpressionOfThrow = true;
+      expression.accept(this);
+    } finally {
+      _inExpressionOfThrow = old;
+    }
+  }
+
+  void visitYieldStatement(ir.YieldStatement yieldStatement) {
+    yieldStatement.expression.accept(this);
+    add(new HYield(pop(), yieldStatement.isYieldStar));
+  }
+
+  @override
+  void visitAwaitExpression(ir.AwaitExpression await) {
+    await.operand.accept(this);
+    HInstruction awaited = pop();
+    // TODO(herhut): Improve this type.
+    push(new HAwait(awaited, astAdapter.makeSubtypeOfObject(closedWorld)));
+  }
+
+  @override
+  void visitRethrow(ir.Rethrow rethrowNode) {
+    HInstruction exception = rethrowableException;
+    if (exception == null) {
+      exception = graph.addConstantNull(closedWorld);
+      compiler.reporter.internalError(astAdapter.getNode(rethrowNode),
+          'rethrowableException should not be null.');
+    }
+    handleInTryStatement();
+    SourceInformation sourceInformation = null;
+    closeAndGotoExit(new HThrow(exception, sourceInformation, isRethrow: true));
+    // ir.Rethrow is an expression so we need to push a value - a constant with
+    // no type.
+    stack.add(graph.addConstantUnreachable(closedWorld));
+  }
+
   @override
   void visitThisExpression(ir.ThisExpression thisExpression) {
     stack.add(localsHandler.readThis());
@@ -1654,7 +2821,7 @@
   @override
   void visitNot(ir.Not not) {
     not.operand.accept(this);
-    push(new HNot(popBoolified(), backend.boolType));
+    push(new HNot(popBoolified(), commonMasks.boolType));
   }
 
   @override
@@ -1663,4 +2830,270 @@
     stringConcat.accept(stringBuilder);
     stack.add(stringBuilder.result);
   }
+
+  @override
+  void visitTryCatch(ir.TryCatch tryCatch) {
+    TryCatchFinallyBuilder tryBuilder = new TryCatchFinallyBuilder(this);
+    tryCatch.body.accept(this);
+    tryBuilder
+      ..closeTryBody()
+      ..buildCatch(tryCatch)
+      ..cleanUp();
+  }
+
+  /// `try { ... } catch { ... } finally { ... }` statements are a little funny
+  /// because a try can have one or both of {catch|finally}. The way this is
+  /// encoded in kernel AST are two separate classes with no common superclass
+  /// aside from Statement. If a statement has both `catch` and `finally`
+  /// clauses then it is encoded in kernel as so that the TryCatch is the body
+  /// statement of the TryFinally. To produce more efficient code rather than
+  /// nested try statements, the visitors avoid one potential level of
+  /// recursion.
+  @override
+  void visitTryFinally(ir.TryFinally tryFinally) {
+    TryCatchFinallyBuilder tryBuilder = new TryCatchFinallyBuilder(this);
+
+    // We do these shenanigans to produce better looking code that doesn't
+    // have nested try statements.
+    if (tryFinally.body is ir.TryCatch) {
+      ir.TryCatch tryCatch = tryFinally.body;
+      tryCatch.body.accept(this);
+      tryBuilder
+        ..closeTryBody()
+        ..buildCatch(tryCatch);
+    } else {
+      tryFinally.body.accept(this);
+      tryBuilder.closeTryBody();
+    }
+
+    tryBuilder
+      ..buildFinallyBlock(() {
+        tryFinally.finalizer.accept(this);
+      })
+      ..cleanUp();
+  }
+}
+
+/// Class in charge of building try, catch and/or finally blocks. This handles
+/// the instructions that need to be output and the dominator calculation of
+/// this sequence of code.
+class TryCatchFinallyBuilder {
+  HBasicBlock enterBlock;
+  HBasicBlock startTryBlock;
+  HBasicBlock endTryBlock;
+  HBasicBlock startCatchBlock;
+  HBasicBlock endCatchBlock;
+  HBasicBlock startFinallyBlock;
+  HBasicBlock endFinallyBlock;
+  HBasicBlock exitBlock;
+  HTry tryInstruction;
+  HLocalValue exception;
+  KernelSsaBuilder kernelBuilder;
+
+  /// True if the code surrounding this try statement was also part of a
+  /// try/catch/finally statement.
+  bool previouslyInTryStatement;
+
+  SubGraph bodyGraph;
+  SubGraph catchGraph;
+  SubGraph finallyGraph;
+
+  // The original set of locals that were defined before this try block.
+  // The catch block and the finally block must not reuse the existing locals
+  // handler. None of the variables that have been defined in the body-block
+  // will be used, but for loops we will add (unnecessary) phis that will
+  // reference the body variables. This makes it look as if the variables were
+  // used in a non-dominated block.
+  LocalsHandler originalSavedLocals;
+
+  TryCatchFinallyBuilder(this.kernelBuilder) {
+    tryInstruction = new HTry();
+    originalSavedLocals = new LocalsHandler.from(kernelBuilder.localsHandler);
+    enterBlock = kernelBuilder.openNewBlock();
+    kernelBuilder.close(tryInstruction);
+    previouslyInTryStatement = kernelBuilder.inTryStatement;
+    kernelBuilder.inTryStatement = true;
+
+    startTryBlock = kernelBuilder.graph.addNewBlock();
+    kernelBuilder.open(startTryBlock);
+  }
+
+  void _addExitTrySuccessor(successor) {
+    if (successor == null) return;
+    // Iterate over all blocks created inside this try/catch, and
+    // attach successor information to blocks that end with
+    // [HExitTry].
+    for (int i = startTryBlock.id; i < successor.id; i++) {
+      HBasicBlock block = kernelBuilder.graph.blocks[i];
+      var last = block.last;
+      if (last is HExitTry) {
+        block.addSuccessor(successor);
+      }
+    }
+  }
+
+  void _addOptionalSuccessor(block1, block2) {
+    if (block2 != null) block1.addSuccessor(block2);
+  }
+
+  /// Helper function to set up basic block successors for try-catch-finally
+  /// sequences.
+  void _setBlockSuccessors() {
+    // Setup all successors. The entry block that contains the [HTry]
+    // has 1) the body, 2) the catch, 3) the finally, and 4) the exit
+    // blocks as successors.
+    enterBlock.addSuccessor(startTryBlock);
+    _addOptionalSuccessor(enterBlock, startCatchBlock);
+    _addOptionalSuccessor(enterBlock, startFinallyBlock);
+    enterBlock.addSuccessor(exitBlock);
+
+    // The body has either the catch or the finally block as successor.
+    if (endTryBlock != null) {
+      assert(startCatchBlock != null || startFinallyBlock != null);
+      endTryBlock.addSuccessor(
+          startCatchBlock != null ? startCatchBlock : startFinallyBlock);
+      endTryBlock.addSuccessor(exitBlock);
+    }
+
+    // The catch block has either the finally or the exit block as
+    // successor.
+    endCatchBlock?.addSuccessor(
+        startFinallyBlock != null ? startFinallyBlock : exitBlock);
+
+    // The finally block has the exit block as successor.
+    endFinallyBlock?.addSuccessor(exitBlock);
+
+    // If a block inside try/catch aborts (eg with a return statement),
+    // we explicitely mark this block a predecessor of the catch
+    // block and the finally block.
+    _addExitTrySuccessor(startCatchBlock);
+    _addExitTrySuccessor(startFinallyBlock);
+  }
+
+  /// Build the finally{} clause of a try/{catch}/finally statement. Note this
+  /// does not examine the body of the try clause, only the finally portion.
+  void buildFinallyBlock(void buildFinalizer()) {
+    kernelBuilder.localsHandler = new LocalsHandler.from(originalSavedLocals);
+    startFinallyBlock = kernelBuilder.graph.addNewBlock();
+    kernelBuilder.open(startFinallyBlock);
+    buildFinalizer();
+    if (!kernelBuilder.isAborted()) {
+      endFinallyBlock = kernelBuilder.close(new HGoto());
+    }
+    tryInstruction.finallyBlock = startFinallyBlock;
+    finallyGraph =
+        new SubGraph(startFinallyBlock, kernelBuilder.lastOpenedBlock);
+  }
+
+  void closeTryBody() {
+    // We use a [HExitTry] instead of a [HGoto] for the try block
+    // because it will have multiple successors: the join block, and
+    // the catch or finally block.
+    if (!kernelBuilder.isAborted()) {
+      endTryBlock = kernelBuilder.close(new HExitTry());
+    }
+    bodyGraph = new SubGraph(startTryBlock, kernelBuilder.lastOpenedBlock);
+  }
+
+  void buildCatch(ir.TryCatch tryCatch) {
+    kernelBuilder.localsHandler = new LocalsHandler.from(originalSavedLocals);
+    startCatchBlock = kernelBuilder.graph.addNewBlock();
+    kernelBuilder.open(startCatchBlock);
+    // Note that the name of this local is irrelevant.
+    SyntheticLocal local = new SyntheticLocal(
+        'exception', kernelBuilder.localsHandler.executableContext);
+    exception = new HLocalValue(local, kernelBuilder.commonMasks.nonNullType);
+    kernelBuilder.add(exception);
+    HInstruction oldRethrowableException = kernelBuilder.rethrowableException;
+    kernelBuilder.rethrowableException = exception;
+
+    kernelBuilder._pushStaticInvocation(
+        kernelBuilder.astAdapter.exceptionUnwrapper,
+        [exception],
+        kernelBuilder.astAdapter.exceptionUnwrapperType);
+    HInvokeStatic unwrappedException = kernelBuilder.pop();
+    tryInstruction.exception = exception;
+    int catchesIndex = 0;
+
+    void pushCondition(ir.Catch catchBlock) {
+      // `guard` is often `dynamic`, which generates `true`.
+      kernelBuilder.pushIsTest(
+          catchBlock.exception, catchBlock.guard, unwrappedException);
+    }
+
+    void visitThen() {
+      ir.Catch catchBlock = tryCatch.catches[catchesIndex];
+      catchesIndex++;
+      if (catchBlock.exception != null) {
+        LocalVariableElement exceptionVariable =
+            kernelBuilder.astAdapter.getElement(catchBlock.exception);
+        kernelBuilder.localsHandler
+            .updateLocal(exceptionVariable, unwrappedException);
+      }
+      if (catchBlock.stackTrace != null) {
+        kernelBuilder._pushStaticInvocation(
+            kernelBuilder.astAdapter.traceFromException,
+            [exception],
+            kernelBuilder.astAdapter.traceFromExceptionType);
+        HInstruction traceInstruction = kernelBuilder.pop();
+        LocalVariableElement traceVariable =
+            kernelBuilder.astAdapter.getElement(catchBlock.stackTrace);
+        kernelBuilder.localsHandler
+            .updateLocal(traceVariable, traceInstruction);
+      }
+      catchBlock.body.accept(kernelBuilder);
+    }
+
+    void visitElse() {
+      if (catchesIndex >= tryCatch.catches.length) {
+        kernelBuilder.closeAndGotoExit(new HThrow(
+            exception, exception.sourceInformation,
+            isRethrow: true));
+      } else {
+        // TODO(efortuna): Make SsaBranchBuilder handle kernel elements, and
+        // pass tryCatch in here as the "diagnosticNode".
+        kernelBuilder.handleIf(
+            visitCondition: () {
+              pushCondition(tryCatch.catches[catchesIndex]);
+            },
+            visitThen: visitThen,
+            visitElse: visitElse);
+      }
+    }
+
+    ir.Catch firstBlock = tryCatch.catches[catchesIndex];
+    // TODO(efortuna): Make SsaBranchBuilder handle kernel elements, and then
+    // pass tryCatch in here as the "diagnosticNode".
+    kernelBuilder.handleIf(
+        visitCondition: () {
+          pushCondition(firstBlock);
+        },
+        visitThen: visitThen,
+        visitElse: visitElse);
+    if (!kernelBuilder.isAborted()) {
+      endCatchBlock = kernelBuilder.close(new HGoto());
+    }
+
+    kernelBuilder.rethrowableException = oldRethrowableException;
+    tryInstruction.catchBlock = startCatchBlock;
+    catchGraph = new SubGraph(startCatchBlock, kernelBuilder.lastOpenedBlock);
+  }
+
+  void cleanUp() {
+    exitBlock = kernelBuilder.graph.addNewBlock();
+    _setBlockSuccessors();
+
+    // Use the locals handler not altered by the catch and finally
+    // blocks.
+    kernelBuilder.localsHandler = originalSavedLocals;
+    kernelBuilder.open(exitBlock);
+    enterBlock.setBlockFlow(
+        new HTryBlockInformation(
+            kernelBuilder.wrapStatementGraph(bodyGraph),
+            exception,
+            kernelBuilder.wrapStatementGraph(catchGraph),
+            kernelBuilder.wrapStatementGraph(finallyGraph)),
+        exitBlock);
+    kernelBuilder.inTryStatement = previouslyInTryStatement;
+  }
 }
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index cd9d7c0..7709a20 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -9,10 +9,18 @@
 import '../compiler.dart' show Compiler;
 import '../constants/constant_system.dart';
 import '../constants/values.dart';
-import '../core_types.dart' show CoreClasses;
-import '../dart_types.dart';
-import '../elements/elements.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/elements.dart'
+    show
+        Entity,
+        JumpTarget,
+        LabelDefinition,
+        Name,
+        AsyncMarker,
+        ResolvedAst,
+        FunctionElement;
 import '../elements/entities.dart';
+import '../elements/types.dart';
 import '../io/source_information.dart';
 import '../js/js.dart' as js;
 import '../js_backend/backend_helpers.dart' show BackendHelpers;
@@ -59,36 +67,41 @@
             .buildDeclaration(resolvedAst));
   }
 
-  js.Expression generateCode(CodegenWorkItem work, HGraph graph) {
+  js.Expression generateCode(
+      CodegenWorkItem work, HGraph graph, ClosedWorld closedWorld) {
     if (work.element.isField) {
-      return generateLazyInitializer(work, graph);
+      return generateLazyInitializer(work, graph, closedWorld);
     } else {
-      return generateMethod(work, graph);
+      return generateMethod(work, graph, closedWorld);
     }
   }
 
-  js.Expression generateLazyInitializer(CodegenWorkItem work, HGraph graph) {
+  js.Expression generateLazyInitializer(
+      CodegenWorkItem work, HGraph graph, ClosedWorld closedWorld) {
     return measure(() {
-      compiler.tracer.traceGraph("codegen", graph);
+      backend.tracer.traceGraph("codegen", graph);
       SourceInformation sourceInformation = sourceInformationFactory
           .createBuilderForContext(work.resolvedAst)
           .buildDeclaration(work.resolvedAst);
-      SsaCodeGenerator codegen = new SsaCodeGenerator(backend, work);
+      SsaCodeGenerator codegen =
+          new SsaCodeGenerator(backend, closedWorld, work);
       codegen.visitGraph(graph);
       return new js.Fun(codegen.parameters, codegen.body)
           .withSourceInformation(sourceInformation);
     });
   }
 
-  js.Expression generateMethod(CodegenWorkItem work, HGraph graph) {
+  js.Expression generateMethod(
+      CodegenWorkItem work, HGraph graph, ClosedWorld closedWorld) {
     return measure(() {
       FunctionElement element = work.element;
       if (element.asyncMarker != AsyncMarker.SYNC) {
         work.registry.registerAsyncMarker(element);
       }
-      SsaCodeGenerator codegen = new SsaCodeGenerator(backend, work);
+      SsaCodeGenerator codegen =
+          new SsaCodeGenerator(backend, closedWorld, work);
       codegen.visitGraph(graph);
-      compiler.tracer.traceGraph("codegen", graph);
+      backend.tracer.traceGraph("codegen", graph);
       return buildJavaScriptFunction(
           work.resolvedAst, codegen.parameters, codegen.body);
     });
@@ -121,6 +134,7 @@
   bool isGeneratingExpression = false;
 
   final JavaScriptBackend backend;
+  final ClosedWorld closedWorld;
   final CodegenWorkItem work;
 
   final Set<HInstruction> generateAtUseSite;
@@ -163,7 +177,7 @@
   // if branches.
   SubGraph subGraph;
 
-  SsaCodeGenerator(this.backend, CodegenWorkItem work,
+  SsaCodeGenerator(this.backend, this.closedWorld, CodegenWorkItem work,
       {SourceInformation sourceInformation})
       : this.work = work,
         declaredLocals = new Set<String>(),
@@ -191,7 +205,7 @@
 
   DiagnosticReporter get reporter => compiler.reporter;
 
-  CoreClasses get coreClasses => compiler.coreClasses;
+  CommonElements get commonElements => closedWorld.commonElements;
 
   bool isGenerateAtUseSite(HInstruction instruction) {
     return generateAtUseSite.contains(instruction);
@@ -261,8 +275,8 @@
     return MAX;
   }
 
-  bool requiresUintConversion(instruction) {
-    if (instruction.isUInt31(compiler)) return false;
+  bool requiresUintConversion(HInstruction instruction) {
+    if (instruction.isUInt31(closedWorld)) return false;
     if (bitWidth(instruction) <= 31) return false;
     // If the result of a bit-operation is only used by other bit
     // operations, we do not have to convert to an unsigned integer.
@@ -305,7 +319,7 @@
   }
 
   void preGenerateMethod(HGraph graph) {
-    new SsaInstructionSelection(compiler).visitGraph(graph);
+    new SsaInstructionSelection(compiler, closedWorld).visitGraph(graph);
     new SsaTypeKnownRemover().visitGraph(graph);
     new SsaTrustedCheckRemover(compiler).visitGraph(graph);
     new SsaInstructionMerger(generateAtUseSite, compiler).visitGraph(graph);
@@ -788,7 +802,7 @@
     js.Catch catchPart = null;
     js.Block finallyPart = null;
     if (info.catchBlock != null) {
-      void register(ClassElement classElement) {
+      void register(ClassEntity classElement) {
         if (classElement != null) {
           registry.registerInstantiatedClass(classElement);
         }
@@ -828,7 +842,7 @@
     js.Loop loop;
 
     switch (info.kind) {
-      // Treate all three "test-first" loops the same way.
+      // Treat all three "test-first" loops the same way.
       case HLoopBlockInformation.FOR_LOOP:
       case HLoopBlockInformation.WHILE_LOOP:
       case HLoopBlockInformation.FOR_IN_LOOP:
@@ -1381,11 +1395,11 @@
   visitShiftRight(HShiftRight node) => visitBitInvokeBinary(node, '>>>');
 
   visitTruncatingDivide(HTruncatingDivide node) {
-    assert(node.isUInt31(compiler));
+    assert(node.isUInt31(closedWorld));
     // TODO(karlklose): Enable this assertion again when type propagation is
     // fixed. Issue 23555.
 //    assert(node.left.isUInt32(compiler));
-    assert(node.right.isPositiveInteger(compiler));
+    assert(node.right.isPositiveInteger(closedWorld));
     use(node.left);
     js.Expression jsLeft = pop();
     use(node.right);
@@ -1395,6 +1409,10 @@
         .withSourceInformation(node.sourceInformation));
   }
 
+  visitRemainder(HRemainder node) {
+    return visitInvokeBinary(node, '%');
+  }
+
   visitNegate(HNegate node) => visitInvokeUnary(node, '-');
 
   visitLess(HLess node) => visitRelational(node, '<');
@@ -1635,7 +1653,7 @@
     js.Expression object = pop();
     String methodName;
     List<js.Expression> arguments = visitArguments(node.inputs);
-    MemberElement target = node.element;
+    MemberEntity target = node.element;
 
     // TODO(herhut): The namer should return the appropriate backendname here.
     if (target != null && !node.isInterceptedCall) {
@@ -1647,7 +1665,7 @@
         methodName = 'split';
         // Split returns a List, so we make sure the backend knows the
         // list class is instantiated.
-        registry.registerInstantiatedClass(coreClasses.listClass);
+        registry.registerInstantiatedClass(commonElements.listClass);
       } else if (backend.isNative(target) &&
           target.isFunction &&
           !node.isInterceptedCall) {
@@ -1708,23 +1726,21 @@
       // [node.element] will be enqueued. We're not using the receiver
       // type because our optimizations might end up in a state where the
       // invoke dynamic knows more than the receiver.
-      ClassElement enclosing = node.element.enclosingClass;
-      if (compiler.closedWorld.isInstantiated(enclosing)) {
-        return new TypeMask.nonNullExact(
-            enclosing.declaration, compiler.closedWorld);
+      ClassEntity enclosing = node.element.enclosingClass;
+      if (closedWorld.isInstantiated(enclosing)) {
+        return closedWorld.commonMasks.createNonNullExact(enclosing);
       } else {
         // The element is mixed in so a non-null subtype mask is the most
         // precise we have.
-        assert(invariant(node, compiler.closedWorld.isUsedAsMixin(enclosing),
+        assert(invariant(node, closedWorld.isUsedAsMixin(enclosing),
             message: "Element ${node.element} from $enclosing expected "
                 "to be mixed in."));
-        return new TypeMask.nonNullSubtype(
-            enclosing.declaration, compiler.closedWorld);
+        return closedWorld.commonMasks.createNonNullSubtype(enclosing);
       }
     }
     // If [JSInvocationMirror._invokeOn] is enabled, and this call
     // might hit a `noSuchMethod`, we register an untyped selector.
-    return compiler.closedWorld.extendMaskIfReachesAll(selector, mask);
+    return closedWorld.extendMaskIfReachesAll(selector, mask);
   }
 
   void registerMethodInvoke(HInvokeDynamic node) {
@@ -1733,7 +1749,7 @@
     // If we don't know what we're calling or if we are calling a getter,
     // we need to register that fact that we may be calling a closure
     // with the same arguments.
-    MemberElement target = node.element;
+    MemberEntity target = node.element;
     if (target == null || target.isGetter) {
       // TODO(kasperl): If we have a typed selector for the call, we
       // may know something about the types of closures that need
@@ -1815,7 +1831,7 @@
   }
 
   visitInvokeStatic(HInvokeStatic node) {
-    MemberElement element = node.element;
+    MemberEntity element = node.element;
     List<DartType> instantiatedTypes = node.instantiatedTypes;
 
     if (instantiatedTypes != null && !instantiatedTypes.isEmpty) {
@@ -1834,7 +1850,8 @@
       // confuses loop recognition.
 
       assert(arguments.length == 2);
-      Element throwFunction = backend.helpers.throwConcurrentModificationError;
+      FunctionEntity throwFunction =
+          backend.helpers.throwConcurrentModificationError;
       registry.registerStaticUse(
           new StaticUse.staticInvoke(throwFunction, CallStructure.ONE_ARG));
 
@@ -1862,8 +1879,8 @@
   }
 
   visitInvokeSuper(HInvokeSuper node) {
-    MemberElement superElement = node.element;
-    ClassElement superClass = superElement.enclosingClass;
+    MemberEntity superElement = node.element;
+    ClassEntity superClass = superElement.enclosingClass;
     if (superElement.isField) {
       js.Name fieldName = backend.namer.instanceFieldPropertyName(superElement);
       use(node.inputs[0]);
@@ -1888,9 +1905,9 @@
           // If this is a tear-off, register the fact that a tear-off closure
           // will be created, and that this tear-off must bypass ordinary
           // dispatch to ensure the super method is invoked.
-          FunctionElement helper = backend.helpers.closureFromTearOff;
+          FunctionEntity helper = backend.helpers.closureFromTearOff;
           registry.registerStaticUse(new StaticUse.staticInvoke(
-              helper, new CallStructure.unnamed(helper.parameters.length)));
+              helper, new CallStructure.unnamed(node.inputs.length)));
           registry.registerStaticUse(new StaticUse.superTearOff(node.element));
           methodName = backend.namer.invocationName(selector);
         } else {
@@ -1920,7 +1937,7 @@
 
   visitFieldGet(HFieldGet node) {
     use(node.receiver);
-    MemberElement element = node.element;
+    MemberEntity element = node.element;
     if (node.isNullCheck) {
       // We access a JavaScript member we know all objects besides
       // null and undefined have: V8 does not like accessing a member
@@ -1934,15 +1951,16 @@
       push(new js.PropertyAccess.field(pop(), 'length')
           .withSourceInformation(node.sourceInformation));
     } else {
-      js.Name name = backend.namer.instanceFieldPropertyName(element);
+      FieldEntity field = element;
+      js.Name name = backend.namer.instanceFieldPropertyName(field);
       push(new js.PropertyAccess(pop(), name)
           .withSourceInformation(node.sourceInformation));
-      registry.registerStaticUse(new StaticUse.fieldGet(element));
+      registry.registerStaticUse(new StaticUse.fieldGet(field));
     }
   }
 
   visitFieldSet(HFieldSet node) {
-    MemberElement element = node.element;
+    MemberEntity element = node.element;
     registry.registerStaticUse(new StaticUse.fieldSet(element));
     js.Name name = backend.namer.instanceFieldPropertyName(element);
     use(node.receiver);
@@ -1953,7 +1971,7 @@
   }
 
   visitReadModifyWrite(HReadModifyWrite node) {
-    FieldElement element = node.element;
+    FieldEntity element = node.element;
     registry.registerStaticUse(new StaticUse.fieldGet(element));
     registry.registerStaticUse(new StaticUse.fieldSet(element));
     js.Name name = backend.namer.instanceFieldPropertyName(element);
@@ -2051,9 +2069,9 @@
       // If the type is a web component, we need to ensure the constructors are
       // available to 'upgrade' the native object.
       TypeConstantValue type = constant;
-      Element element = type.representedType.element;
-      if (element != null && element.isClass) {
-        registry.registerTypeConstant(element);
+      if (type.representedType.isInterfaceType) {
+        InterfaceType representedType = type.representedType;
+        registry.registerTypeConstant(representedType.element);
       }
     }
     js.Expression expression = backend.emitter.constantReference(constant);
@@ -2098,13 +2116,14 @@
 
       HInstruction left = relational.left;
       HInstruction right = relational.right;
-      if (left.isStringOrNull(compiler) && right.isStringOrNull(compiler)) {
+      if (left.isStringOrNull(closedWorld) &&
+          right.isStringOrNull(closedWorld)) {
         return true;
       }
 
       // This optimization doesn't work for NaN, so we only do it if the
       // type is known to be an integer.
-      return left.isInteger(compiler) && right.isInteger(compiler);
+      return left.isInteger(closedWorld) && right.isInteger(closedWorld);
     }
 
     bool handledBySpecialCase = false;
@@ -2240,13 +2259,13 @@
       js.Expression over;
       if (node.staticChecks != HBoundsCheck.ALWAYS_ABOVE_ZERO) {
         use(node.index);
-        if (node.index.isInteger(compiler)) {
+        if (node.index.isInteger(closedWorld)) {
           under = js.js("# < 0", pop());
         } else {
           js.Expression jsIndex = pop();
           under = js.js("# >>> 0 !== #", [jsIndex, jsIndex]);
         }
-      } else if (!node.index.isInteger(compiler)) {
+      } else if (!node.index.isInteger(closedWorld)) {
         checkInt(node.index, '!==');
         under = pop();
       }
@@ -2276,7 +2295,7 @@
     }
   }
 
-  void generateThrowWithHelper(Element helper, argument,
+  void generateThrowWithHelper(FunctionEntity helper, argument,
       {SourceInformation sourceInformation}) {
     js.Expression jsHelper = backend.emitter.staticFunctionAccess(helper);
     List arguments = [];
@@ -2300,7 +2319,7 @@
       pushStatement(
           new js.Throw(value).withSourceInformation(sourceInformation));
     } else {
-      Element element = work.element;
+      Entity element = work.element;
       if (element is FunctionElement && element.asyncMarker.isYielding) {
         // `return <expr>;` is illegal in a sync* or async* function.
         // To have the async-translator working, we avoid introducing
@@ -2318,7 +2337,7 @@
     HInstruction argument = node.inputs[0];
     use(argument);
 
-    Element helper = helpers.throwExpressionHelper;
+    FunctionEntity helper = helpers.throwExpressionHelper;
     registry.registerStaticUse(
         new StaticUse.staticInvoke(helper, CallStructure.ONE_ARG));
 
@@ -2376,9 +2395,9 @@
 
   void visitStringify(HStringify node) {
     HInstruction input = node.inputs.first;
-    if (input.isString(compiler)) {
+    if (input.isString(closedWorld)) {
       use(input);
-    } else if (input.isInteger(compiler) || input.isBoolean(compiler)) {
+    } else if (input.isInteger(closedWorld) || input.isBoolean(closedWorld)) {
       // JavaScript's + operator with a string for the left operand will convert
       // the right operand to a string, and the conversion result is correct.
       use(input);
@@ -2392,7 +2411,8 @@
             .withSourceInformation(node.sourceInformation));
       }
     } else {
-      Element convertToString = backend.helpers.stringInterpolationHelper;
+      FunctionEntity convertToString =
+          backend.helpers.stringInterpolationHelper;
       registry.registerStaticUse(
           new StaticUse.staticInvoke(convertToString, CallStructure.ONE_ARG));
       js.Expression jsHelper =
@@ -2404,7 +2424,7 @@
   }
 
   void visitLiteralList(HLiteralList node) {
-    registry.registerInstantiatedClass(coreClasses.listClass);
+    registry.registerInstantiatedClass(commonElements.listClass);
     generateArrayLiteral(node);
   }
 
@@ -2551,38 +2571,41 @@
   void checkType(HInstruction input, HInstruction interceptor, DartType type,
       SourceInformation sourceInformation,
       {bool negative: false}) {
-    Element element = type.element;
-    if (element == helpers.jsArrayClass) {
-      checkArray(input, negative ? '!==' : '===');
-      return;
-    } else if (element == helpers.jsMutableArrayClass) {
-      if (negative) {
-        checkImmutableArray(input);
-      } else {
-        checkMutableArray(input);
+    if (type.isInterfaceType) {
+      InterfaceType interfaceType = type;
+      ClassEntity element = interfaceType.element;
+      if (element == helpers.jsArrayClass) {
+        checkArray(input, negative ? '!==' : '===');
+        return;
+      } else if (element == helpers.jsMutableArrayClass) {
+        if (negative) {
+          checkImmutableArray(input);
+        } else {
+          checkMutableArray(input);
+        }
+        return;
+      } else if (element == helpers.jsExtendableArrayClass) {
+        if (negative) {
+          checkFixedArray(input);
+        } else {
+          checkExtendableArray(input);
+        }
+        return;
+      } else if (element == helpers.jsFixedArrayClass) {
+        if (negative) {
+          checkExtendableArray(input);
+        } else {
+          checkFixedArray(input);
+        }
+        return;
+      } else if (element == helpers.jsUnmodifiableArrayClass) {
+        if (negative) {
+          checkMutableArray(input);
+        } else {
+          checkImmutableArray(input);
+        }
+        return;
       }
-      return;
-    } else if (element == helpers.jsExtendableArrayClass) {
-      if (negative) {
-        checkFixedArray(input);
-      } else {
-        checkExtendableArray(input);
-      }
-      return;
-    } else if (element == helpers.jsFixedArrayClass) {
-      if (negative) {
-        checkExtendableArray(input);
-      } else {
-        checkFixedArray(input);
-      }
-      return;
-    } else if (element == helpers.jsUnmodifiableArrayClass) {
-      if (negative) {
-        checkMutableArray(input);
-      } else {
-        checkImmutableArray(input);
-      }
-      return;
     }
     if (interceptor != null) {
       checkTypeViaProperty(interceptor, type, sourceInformation,
@@ -2610,8 +2633,8 @@
     }
   }
 
-  void checkTypeViaInstanceof(
-      HInstruction input, DartType type, SourceInformation sourceInformation,
+  void checkTypeViaInstanceof(HInstruction input, InterfaceType type,
+      SourceInformation sourceInformation,
       {bool negative: false}) {
     registry.registerTypeUse(new TypeUse.isCheck(type));
 
@@ -2630,12 +2653,12 @@
   void handleNumberOrStringSupertypeCheck(
       HInstruction input,
       HInstruction interceptor,
-      DartType type,
+      InterfaceType type,
       SourceInformation sourceInformation,
       {bool negative: false}) {
-    assert(!identical(type.element, coreClasses.listClass) &&
-        !Elements.isListSupertype(type.element, compiler) &&
-        !Elements.isStringOnlySupertype(type.element, compiler));
+    assert(!identical(type.element, commonElements.listClass) &&
+        !commonElements.isListSupertype(type.element) &&
+        !commonElements.isStringOnlySupertype(type.element));
     String relation = negative ? '!==' : '===';
     checkNum(input, relation, sourceInformation);
     js.Expression numberTest = pop();
@@ -2656,11 +2679,11 @@
   }
 
   void handleStringSupertypeCheck(HInstruction input, HInstruction interceptor,
-      DartType type, SourceInformation sourceInformation,
+      InterfaceType type, SourceInformation sourceInformation,
       {bool negative: false}) {
-    assert(!identical(type.element, coreClasses.listClass) &&
-        !Elements.isListSupertype(type.element, compiler) &&
-        !Elements.isNumberOrStringSupertype(type.element, compiler));
+    assert(!identical(type.element, commonElements.listClass) &&
+        !commonElements.isListSupertype(type.element) &&
+        !commonElements.isNumberOrStringSupertype(type.element));
     String relation = negative ? '!==' : '===';
     checkString(input, relation, sourceInformation);
     js.Expression stringTest = pop();
@@ -2673,11 +2696,11 @@
   }
 
   void handleListOrSupertypeCheck(HInstruction input, HInstruction interceptor,
-      DartType type, SourceInformation sourceInformation,
+      InterfaceType type, SourceInformation sourceInformation,
       {bool negative: false}) {
-    assert(!identical(type.element, coreClasses.stringClass) &&
-        !Elements.isStringOnlySupertype(type.element, compiler) &&
-        !Elements.isNumberOrStringSupertype(type.element, compiler));
+    assert(!identical(type.element, commonElements.stringClass) &&
+        !commonElements.isStringOnlySupertype(type.element) &&
+        !commonElements.isNumberOrStringSupertype(type.element));
     String relation = negative ? '!==' : '===';
     checkObject(input, relation, sourceInformation);
     js.Expression objectTest = pop();
@@ -2714,27 +2737,28 @@
     } else {
       assert(node.isRawCheck);
       HInstruction interceptor = node.interceptor;
-      ClassElement objectClass = coreClasses.objectClass;
-      Element element = type.element;
-      if (element == coreClasses.nullClass) {
+      InterfaceType interfaceType = type;
+      ClassEntity element = interfaceType.element;
+      if (element == commonElements.nullClass) {
         if (negative) {
           checkNonNull(input);
         } else {
           checkNull(input);
         }
-      } else if (identical(element, objectClass) || type.treatAsDynamic) {
+      } else if (element ==
+          commonElements.objectClass /* || type.treatAsDynamic*/) {
         // The constant folder also does this optimization, but we make
         // it safe by assuming it may have not run.
         push(newLiteralBool(!negative, sourceInformation));
-      } else if (element == coreClasses.stringClass) {
+      } else if (element == commonElements.stringClass) {
         checkString(input, relation, sourceInformation);
-      } else if (element == coreClasses.doubleClass) {
+      } else if (element == commonElements.doubleClass) {
         checkDouble(input, relation, sourceInformation);
-      } else if (element == coreClasses.numClass) {
+      } else if (element == commonElements.numClass) {
         checkNum(input, relation, sourceInformation);
-      } else if (element == coreClasses.boolClass) {
+      } else if (element == commonElements.boolClass) {
         checkBool(input, relation, sourceInformation);
-      } else if (element == coreClasses.intClass) {
+      } else if (element == commonElements.intClass) {
         // The is check in the code tells us that it might not be an
         // int. So we do a typeof first to avoid possible
         // deoptimizations on the JS engine due to the Math.floor check.
@@ -2747,22 +2771,22 @@
         assert(interceptor == null);
         checkTypeViaInstanceof(input, type, sourceInformation,
             negative: negative);
-      } else if (Elements.isNumberOrStringSupertype(element, compiler)) {
+      } else if (commonElements.isNumberOrStringSupertype(element)) {
         handleNumberOrStringSupertypeCheck(
             input, interceptor, type, sourceInformation,
             negative: negative);
-      } else if (Elements.isStringOnlySupertype(element, compiler)) {
+      } else if (commonElements.isStringOnlySupertype(element)) {
         handleStringSupertypeCheck(input, interceptor, type, sourceInformation,
             negative: negative);
-      } else if (identical(element, coreClasses.listClass) ||
-          Elements.isListSupertype(element, compiler)) {
+      } else if (element == commonElements.listClass ||
+          commonElements.isListSupertype(element)) {
         handleListOrSupertypeCheck(input, interceptor, type, sourceInformation,
             negative: negative);
       } else if (type.isFunctionType) {
         checkType(input, interceptor, type, sourceInformation,
             negative: negative);
-      } else if ((input.canBePrimitive(compiler) &&
-              !input.canBePrimitiveArray(compiler)) ||
+      } else if ((input.canBePrimitive(closedWorld) &&
+              !input.canBePrimitiveArray(closedWorld)) ||
           input.canBeNull()) {
         checkObject(input, relation, node.sourceInformation);
         js.Expression objectTest = pop();
@@ -2787,14 +2811,13 @@
 
   js.Expression generateReceiverOrArgumentTypeTest(
       HInstruction input, TypeMask checkedType) {
-    ClosedWorld closedWorld = compiler.closedWorld;
     TypeMask inputType = input.instructionType;
     // Figure out if it is beneficial to turn this into a null check.
     // V8 generally prefers 'typeof' checks, but for integers and
     // indexable primitives we cannot compile this test into a single
     // typeof check so the null check is cheaper.
     bool isIntCheck = checkedType.containsOnlyInt(closedWorld);
-    bool turnIntoNumCheck = isIntCheck && input.isIntegerOrNull(compiler);
+    bool turnIntoNumCheck = isIntCheck && input.isIntegerOrNull(closedWorld);
     bool turnIntoNullCheck = !turnIntoNumCheck &&
         (checkedType.nullable() == inputType) &&
         (isIntCheck ||
@@ -2827,12 +2850,11 @@
 
   void visitTypeConversion(HTypeConversion node) {
     if (node.isArgumentTypeCheck || node.isReceiverTypeCheck) {
-      ClosedWorld closedWorld = compiler.closedWorld;
       // An int check if the input is not int or null, is not
       // sufficient for doing an argument or receiver check.
       assert(compiler.options.trustTypeAnnotations ||
           !node.checkedType.containsOnlyInt(closedWorld) ||
-          node.checkedInput.isIntegerOrNull(compiler));
+          node.checkedInput.isIntegerOrNull(closedWorld));
       js.Expression test = generateReceiverOrArgumentTypeTest(
           node.checkedInput, node.checkedType);
       js.Block oldContainer = currentContainer;
@@ -2858,12 +2880,13 @@
 
     assert(node.isCheckedModeCheck || node.isCastTypeCheck);
     DartType type = node.typeExpression;
-    assert(type.kind != TypeKind.TYPEDEF);
+    assert(!type.isTypedef);
+    assert(!type.isDynamic);
     if (type.isFunctionType) {
       // TODO(5022): We currently generate $isFunction checks for
       // function types.
       registry.registerTypeUse(
-          new TypeUse.isCheck(compiler.coreTypes.functionType));
+          new TypeUse.isCheck(compiler.commonElements.functionType));
     }
     registry.registerTypeUse(new TypeUse.isCheck(type));
 
@@ -2936,14 +2959,15 @@
       if (!optionalParameterTypes.isEmpty) {
         arguments.add(new js.ArrayInitializer(optionalParameterTypes));
       }
-      push(js.js('#(#)', [accessHelper('buildFunctionType'), arguments]));
+      push(js.js('#(#)', [accessHelper(helpers.buildFunctionType), arguments]));
     } else {
       var arguments = [
         returnType,
         new js.ArrayInitializer(parameterTypes),
         new js.ObjectInitializer(namedParameters)
       ];
-      push(js.js('#(#)', [accessHelper('buildNamedFunctionType'), arguments]));
+      push(js.js(
+          '#(#)', [accessHelper(helpers.buildNamedFunctionType), arguments]));
     }
   }
 
@@ -2954,7 +2978,7 @@
   }
 
   void visitTypeInfoReadVariable(HTypeInfoReadVariable node) {
-    TypeVariableElement element = node.variable.element;
+    TypeVariableEntity element = node.variable.element;
 
     int index = element.index;
     HInstruction object = node.object;
@@ -2963,8 +2987,8 @@
 
     if (typeVariableAccessNeedsSubstitution(element, object.instructionType)) {
       js.Expression typeName =
-          js.quoteName(backend.namer.runtimeTypeName(element.enclosingClass));
-      Element helperElement = helpers.getRuntimeTypeArgument;
+          js.quoteName(backend.namer.runtimeTypeName(element.typeDeclaration));
+      FunctionEntity helperElement = helpers.getRuntimeTypeArgument;
       registry.registerStaticUse(
           new StaticUse.staticInvoke(helperElement, CallStructure.THREE_ARGS));
       js.Expression helper =
@@ -2972,7 +2996,7 @@
       push(js.js(
           r'#(#, #, #)', [helper, receiver, typeName, js.js.number(index)]));
     } else {
-      Element helperElement = helpers.getTypeArgumentByIndex;
+      FunctionEntity helperElement = helpers.getTypeArgumentByIndex;
       registry.registerStaticUse(
           new StaticUse.staticInvoke(helperElement, CallStructure.TWO_ARGS));
       js.Expression helper =
@@ -2999,24 +3023,23 @@
 
       case TypeInfoExpressionKind.INSTANCE:
         // We expect only flat types for the INSTANCE representation.
-        assert(
-            node.dartType == (node.dartType.element as ClassElement).thisType);
-        registry.registerInstantiatedClass(coreClasses.listClass);
+        assert((node.dartType as InterfaceType).typeArguments.length ==
+            arguments.length);
+        registry.registerInstantiatedClass(commonElements.listClass);
         push(new js.ArrayInitializer(arguments)
             .withSourceInformation(node.sourceInformation));
     }
   }
 
   bool typeVariableAccessNeedsSubstitution(
-      TypeVariableElement element, TypeMask receiverMask) {
-    ClassElement cls = element.enclosingClass;
-    ClosedWorld closedWorld = compiler.closedWorld;
+      TypeVariableEntity element, TypeMask receiverMask) {
+    ClassEntity cls = element.typeDeclaration;
 
     // See if the receiver type narrows the set of classes to ones that can be
     // indexed.
     // TODO(sra): Currently the only convenient query is [singleClass]. We
     // should iterate over all the concrete classes in [receiverMask].
-    ClassElement receiverClass = receiverMask.singleClass(closedWorld);
+    ClassEntity receiverClass = receiverMask.singleClass(closedWorld);
     if (receiverClass != null) {
       if (backend.rti.isTrivialSubstitution(receiverClass, cls)) {
         return false;
@@ -3025,20 +3048,20 @@
 
     if (closedWorld.isUsedAsMixin(cls)) return true;
 
-    return closedWorld.anyStrictSubclassOf(cls, (ClassElement subclass) {
+    return closedWorld.anyStrictSubclassOf(cls, (ClassEntity subclass) {
       return !backend.rti.isTrivialSubstitution(subclass, cls);
     });
   }
 
   void visitReadTypeVariable(HReadTypeVariable node) {
-    TypeVariableElement element = node.dartType.element;
-    Element helperElement = helpers.convertRtiToRuntimeType;
+    TypeVariableEntity element = node.dartType.element;
+    FunctionEntity helperElement = helpers.convertRtiToRuntimeType;
     registry.registerStaticUse(
         new StaticUse.staticInvoke(helperElement, CallStructure.ONE_ARG));
 
     use(node.inputs[0]);
     if (node.hasReceiver) {
-      if (backend.isInterceptorClass(element.enclosingClass)) {
+      if (backend.isInterceptorClass(element.typeDeclaration)) {
         int index = element.index;
         js.Expression receiver = pop();
         js.Expression helper =
@@ -3069,29 +3092,31 @@
       use(type);
       typeArguments.add(pop());
     }
-
-    ClassElement cls = node.dartType.element;
+    InterfaceType type = node.dartType;
+    ClassEntity cls = type.element;
     var arguments = [backend.emitter.typeAccess(cls)];
     if (!typeArguments.isEmpty) {
       arguments.add(new js.ArrayInitializer(typeArguments));
     }
-    push(js.js('#(#)',
-        [accessHelper('buildInterfaceType', arguments.length), arguments]));
+    push(js.js('#(#)', [
+      accessHelper(helpers.buildInterfaceType, arguments.length),
+      arguments
+    ]));
   }
 
   void visitVoidType(HVoidType node) {
-    push(js.js('#()', accessHelper('getVoidRuntimeType')));
+    push(js.js('#()', accessHelper(helpers.getVoidRuntimeType)));
   }
 
   void visitDynamicType(HDynamicType node) {
-    push(js.js('#()', accessHelper('getDynamicRuntimeType')));
+    push(js.js('#()', accessHelper(helpers.getDynamicRuntimeType)));
   }
 
-  js.PropertyAccess accessHelper(String name, [int argumentCount = 0]) {
-    Element helper = helpers.findHelper(name);
+  js.PropertyAccess accessHelper(FunctionEntity helper,
+      [int argumentCount = 0]) {
     if (helper == null) {
       // For mocked-up tests.
-      return js.js('(void 0).$name');
+      return js.js('(void 0).dummy');
     }
     registry.registerStaticUse(new StaticUse.staticInvoke(
         helper, new CallStructure.unnamed(argumentCount)));
diff --git a/pkg/compiler/lib/src/ssa/codegen_helpers.dart b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
index 34d156b..9773af6 100644
--- a/pkg/compiler/lib/src/ssa/codegen_helpers.dart
+++ b/pkg/compiler/lib/src/ssa/codegen_helpers.dart
@@ -8,6 +8,7 @@
 import '../js_backend/js_backend.dart';
 import '../types/types.dart';
 import '../universe/selector.dart' show Selector;
+import '../world.dart' show ClosedWorld;
 import 'nodes.dart';
 
 /**
@@ -16,9 +17,10 @@
  */
 class SsaInstructionSelection extends HBaseVisitor {
   final Compiler compiler;
+  final ClosedWorld closedWorld;
   HGraph graph;
 
-  SsaInstructionSelection(this.compiler);
+  SsaInstructionSelection(this.compiler, this.closedWorld);
 
   JavaScriptBackend get backend => compiler.backend;
 
@@ -67,7 +69,7 @@
       HInstruction interceptor = node.interceptor;
       if (interceptor != null) {
         return new HIsViaInterceptor(
-            node.typeExpression, interceptor, backend.boolType);
+            node.typeExpression, interceptor, closedWorld.commonMasks.boolType);
       }
     }
     return node;
@@ -86,7 +88,7 @@
     if (leftType.isNullable && rightType.isNullable) {
       if (left.isConstantNull() ||
           right.isConstantNull() ||
-          (left.isPrimitive(compiler) && leftType == rightType)) {
+          (left.isPrimitive(closedWorld) && leftType == rightType)) {
         return '==';
       }
       return null;
@@ -103,7 +105,7 @@
 
   HInstruction visitInvokeSuper(HInvokeSuper node) {
     if (node.isInterceptedCall) {
-      TypeMask mask = node.getDartReceiver(compiler).instructionType;
+      TypeMask mask = node.getDartReceiver(closedWorld).instructionType;
       tryReplaceInterceptorWithDummy(node, node.selector, mask);
     }
     return node;
@@ -145,7 +147,7 @@
         ConstantValue constant = new SyntheticConstantValue(
             SyntheticConstantKind.DUMMY_INTERCEPTOR,
             receiverArgument.instructionType);
-        HConstant dummy = graph.addConstant(constant, compiler);
+        HConstant dummy = graph.addConstant(constant, closedWorld);
         receiverArgument.usedBy.remove(node);
         node.inputs[1] = dummy;
         dummy.usedBy.add(node);
@@ -166,7 +168,7 @@
       if (candidate is HFieldGet) {
         if (candidate.element != setter.element) return false;
         if (candidate.receiver != setter.receiver) return false;
-        // Recognize only three instructions in sequence in the same block.  This
+        // Recognize only three instructions in sequence in the same block. This
         // could be broadened to allow non-interfering interleaved instructions.
         if (op.block != block) return false;
         if (candidate.block != block) return false;
@@ -242,7 +244,7 @@
     HInstruction bitop(String assignOp) {
       // HBitAnd, HBitOr etc. are more difficult because HBitAnd(a.x, y)
       // sometimes needs to be forced to unsigned: a.x = (a.x & y) >>> 0.
-      if (op.isUInt31(compiler)) return simpleBinary(assignOp);
+      if (op.isUInt31(closedWorld)) return simpleBinary(assignOp);
       return noMatchingRead();
     }
 
diff --git a/pkg/compiler/lib/src/ssa/graph_builder.dart b/pkg/compiler/lib/src/ssa/graph_builder.dart
index e5dce33..a426b34 100644
--- a/pkg/compiler/lib/src/ssa/graph_builder.dart
+++ b/pkg/compiler/lib/src/ssa/graph_builder.dart
@@ -6,7 +6,8 @@
 import '../common.dart';
 import '../common/codegen.dart' show CodegenRegistry;
 import '../compiler.dart';
-import '../dart_types.dart';
+import '../constants/constant_system.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../io/source_information.dart';
 import '../js_backend/js_backend.dart';
@@ -34,14 +35,26 @@
   /// A reference to the compiler.
   Compiler compiler;
 
-  /// The JavaScript backend we are targeting in this compilation.
-  JavaScriptBackend get backend;
+  /// True if the builder is processing nodes inside a try statement. This is
+  /// important for generating control flow out of a try block like returns or
+  /// breaks.
+  bool inTryStatement = false;
 
   /// The tree elements for the element being built into an SSA graph.
   TreeElements get elements;
 
+  /// The JavaScript backend we are targeting in this compilation.
+  JavaScriptBackend get backend;
+
   CodegenRegistry get registry;
 
+  ClosedWorld get closedWorld;
+
+  CommonMasks get commonMasks => closedWorld.commonMasks;
+
+  GlobalTypeInferenceResults get globalInferenceResults =>
+      compiler.globalInference.results;
+
   /// Used to track the locals while building the graph.
   LocalsHandler localsHandler;
 
@@ -75,8 +88,8 @@
 
   /// Pushes a boolean checking [expression] against null.
   pushCheckNull(HInstruction expression) {
-    push(new HIdentity(
-        expression, graph.addConstantNull(compiler), null, backend.boolType));
+    push(new HIdentity(expression, graph.addConstantNull(closedWorld), null,
+        closedWorld.commonMasks.boolType));
   }
 
   void dup() {
@@ -172,17 +185,6 @@
     return result;
   }
 
-  void handleIf(
-      {ast.Node node,
-      void visitCondition(),
-      void visitThen(),
-      void visitElse(),
-      SourceInformation sourceInformation}) {
-    SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this, compiler, node);
-    branchBuilder.handleIf(visitCondition, visitThen, visitElse,
-        sourceInformation: sourceInformation);
-  }
-
   HSubGraphBlockInformation wrapStatementGraph(SubGraph statements) {
     if (statements == null) return null;
     return new HSubGraphBlockInformation(statements);
@@ -193,14 +195,13 @@
     return new HSubExpressionBlockInformation(expression);
   }
 
-  HInstruction buildFunctionType(FunctionType type) {
-    type.accept(
-        new ReifiedTypeRepresentationBuilder(compiler.closedWorld), this);
+  HInstruction buildFunctionType(ResolutionFunctionType type) {
+    type.accept(new ReifiedTypeRepresentationBuilder(closedWorld), this);
     return pop();
   }
 
   HInstruction buildFunctionTypeConversion(
-      HInstruction original, DartType type, int kind);
+      HInstruction original, ResolutionDartType type, int kind);
 
   /// Returns the current source element.
   ///
@@ -215,8 +216,8 @@
         localsHandler.directLocals[local] != null;
   }
 
-  HInstruction callSetRuntimeTypeInfoWithTypeArguments(
-      DartType type, List<HInstruction> rtiInputs, HInstruction newObject) {
+  HInstruction callSetRuntimeTypeInfoWithTypeArguments(ResolutionDartType type,
+      List<HInstruction> rtiInputs, HInstruction newObject) {
     if (!backend.classNeedsRti(type.element)) {
       return newObject;
     }
@@ -225,11 +226,21 @@
         TypeInfoExpressionKind.INSTANCE,
         (type.element as ClassElement).thisType,
         rtiInputs,
-        backend.dynamicType);
+        closedWorld.commonMasks.dynamicType);
     add(typeInfo);
     return callSetRuntimeTypeInfo(typeInfo, newObject);
   }
 
+  /// Called when control flow is about to change, in which case we need to
+  /// specify special successors if we are already in a try/catch/finally block.
+  void handleInTryStatement() {
+    if (!inTryStatement) return;
+    HBasicBlock block = close(new HExitTry());
+    HBasicBlock newBlock = graph.addNewBlock();
+    block.addSuccessor(newBlock);
+    open(newBlock);
+  }
+
   HInstruction callSetRuntimeTypeInfo(
       HInstruction typeInfo, HInstruction newObject);
 
@@ -244,14 +255,16 @@
 
   ReifiedTypeRepresentationBuilder(this.closedWorld);
 
-  void visit(DartType type, GraphBuilder builder) => type.accept(this, builder);
+  void visit(ResolutionDartType type, GraphBuilder builder) =>
+      type.accept(this, builder);
 
-  void visitVoidType(VoidType type, GraphBuilder builder) {
+  void visitVoidType(ResolutionVoidType type, GraphBuilder builder) {
     ClassElement cls = builder.backend.helpers.VoidRuntimeType;
     builder.push(new HVoidType(type, new TypeMask.exact(cls, closedWorld)));
   }
 
-  void visitTypeVariableType(TypeVariableType type, GraphBuilder builder) {
+  void visitTypeVariableType(
+      ResolutionTypeVariableType type, GraphBuilder builder) {
     ClassElement cls = builder.backend.helpers.RuntimeType;
     TypeMask instructionType = new TypeMask.subclass(cls, closedWorld);
     if (!builder.sourceElement.enclosingElement.isClosure &&
@@ -267,26 +280,27 @@
     }
   }
 
-  void visitFunctionType(FunctionType type, GraphBuilder builder) {
+  void visitFunctionType(ResolutionFunctionType type, GraphBuilder builder) {
     type.returnType.accept(this, builder);
     HInstruction returnType = builder.pop();
     List<HInstruction> inputs = <HInstruction>[returnType];
 
-    for (DartType parameter in type.parameterTypes) {
+    for (ResolutionDartType parameter in type.parameterTypes) {
       parameter.accept(this, builder);
       inputs.add(builder.pop());
     }
 
-    for (DartType parameter in type.optionalParameterTypes) {
+    for (ResolutionDartType parameter in type.optionalParameterTypes) {
       parameter.accept(this, builder);
       inputs.add(builder.pop());
     }
 
-    List<DartType> namedParameterTypes = type.namedParameterTypes;
+    List<ResolutionDartType> namedParameterTypes = type.namedParameterTypes;
     List<String> names = type.namedParameters;
     for (int index = 0; index < names.length; index++) {
       ast.DartString dartString = new ast.DartString.literal(names[index]);
-      inputs.add(builder.graph.addConstantString(dartString, builder.compiler));
+      inputs.add(
+          builder.graph.addConstantString(dartString, builder.closedWorld));
       namedParameterTypes[index].accept(this, builder);
       inputs.add(builder.pop());
     }
@@ -297,16 +311,12 @@
   }
 
   void visitMalformedType(MalformedType type, GraphBuilder builder) {
-    visitDynamicType(const DynamicType(), builder);
+    visitDynamicType(const ResolutionDynamicType(), builder);
   }
 
-  void visitStatementType(StatementType type, GraphBuilder builder) {
-    throw 'not implemented visitStatementType($type)';
-  }
-
-  void visitInterfaceType(InterfaceType type, GraphBuilder builder) {
+  void visitInterfaceType(ResolutionInterfaceType type, GraphBuilder builder) {
     List<HInstruction> inputs = <HInstruction>[];
-    for (DartType typeArgument in type.typeArguments) {
+    for (ResolutionDartType typeArgument in type.typeArguments) {
       typeArgument.accept(this, builder);
       inputs.add(builder.pop());
     }
@@ -320,13 +330,13 @@
         new HInterfaceType(inputs, type, new TypeMask.exact(cls, closedWorld)));
   }
 
-  void visitTypedefType(TypedefType type, GraphBuilder builder) {
-    DartType unaliased = type.unaliased;
-    if (unaliased is TypedefType) throw 'unable to unalias $type';
+  void visitTypedefType(ResolutionTypedefType type, GraphBuilder builder) {
+    ResolutionDartType unaliased = type.unaliased;
+    if (unaliased is ResolutionTypedefType) throw 'unable to unalias $type';
     unaliased.accept(this, builder);
   }
 
-  void visitDynamicType(DynamicType type, GraphBuilder builder) {
+  void visitDynamicType(ResolutionDynamicType type, GraphBuilder builder) {
     JavaScriptBackend backend = builder.compiler.backend;
     ClassElement cls = backend.helpers.DynamicRuntimeType;
     builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld)));
diff --git a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
index 1716c7f..86d436e 100644
--- a/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
+++ b/pkg/compiler/lib/src/ssa/interceptor_simplifier.dart
@@ -2,13 +2,12 @@
 // for 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 '../common/codegen.dart' show CodegenWorkItem;
+import '../common/backend_api.dart' show BackendClasses;
 import '../compiler.dart' show Compiler;
 import '../constants/constant_system.dart';
 import '../constants/values.dart';
-import '../elements/elements.dart';
-import '../js_backend/backend_helpers.dart' show BackendHelpers;
-import '../js_backend/js_backend.dart';
+import '../elements/entities.dart';
+import '../js_backend/backend.dart';
 import '../types/types.dart';
 import '../universe/selector.dart' show Selector;
 import '../world.dart' show ClosedWorld;
@@ -38,18 +37,18 @@
 class SsaSimplifyInterceptors extends HBaseVisitor
     implements OptimizationPhase {
   final String name = "SsaSimplifyInterceptors";
-  final ConstantSystem constantSystem;
+  final ClosedWorld closedWorld;
   final Compiler compiler;
-  final Element element;
+  final ClassEntity enclosingClass;
   HGraph graph;
 
-  SsaSimplifyInterceptors(this.compiler, this.constantSystem, this.element);
+  SsaSimplifyInterceptors(this.compiler, this.closedWorld, this.enclosingClass);
 
   JavaScriptBackend get backend => compiler.backend;
 
-  BackendHelpers get helpers => backend.helpers;
+  BackendClasses get backendClasses => closedWorld.backendClasses;
 
-  ClosedWorld get closedWorld => compiler.closedWorld;
+  ConstantSystem get constantSystem => closedWorld.constantSystem;
 
   void visitGraph(HGraph graph) {
     this.graph = graph;
@@ -96,25 +95,26 @@
   }
 
   bool canUseSelfForInterceptor(
-      HInstruction receiver, Set<ClassElement> interceptedClasses) {
-    if (receiver.canBePrimitive(compiler)) {
+      HInstruction receiver, Set<ClassEntity> interceptedClasses) {
+    if (receiver.canBePrimitive(closedWorld)) {
       // Primitives always need interceptors.
       return false;
     }
     if (receiver.canBeNull() &&
-        interceptedClasses.contains(helpers.jsNullClass)) {
+        interceptedClasses.contains(backendClasses.nullImplementation)) {
       // Need the JSNull interceptor.
       return false;
     }
 
     // All intercepted classes extend `Interceptor`, so if the receiver can't be
     // a class extending `Interceptor` then it can be called directly.
-    return new TypeMask.nonNullSubclass(helpers.jsInterceptorClass, closedWorld)
+    return new TypeMask.nonNullSubclass(
+            backend.helpers.jsInterceptorClass, closedWorld)
         .isDisjoint(receiver.instructionType, closedWorld);
   }
 
   HInstruction tryComputeConstantInterceptor(
-      HInstruction input, Set<ClassElement> interceptedClasses) {
+      HInstruction input, Set<ClassEntity> interceptedClasses) {
     if (input == graph.explicitReceiverParameter) {
       // If `explicitReceiverParameter` is set it means the current method is an
       // interceptor method, and `this` is the interceptor.  The caller just did
@@ -122,46 +122,45 @@
       return graph.thisInstruction;
     }
 
-    ClassElement constantInterceptor = tryComputeConstantInterceptorFromType(
+    ClassEntity constantInterceptor = tryComputeConstantInterceptorFromType(
         input.instructionType, interceptedClasses);
 
     if (constantInterceptor == null) return null;
 
     // If we just happen to be in an instance method of the constant
     // interceptor, `this` is a shorter alias.
-    if (constantInterceptor == element.enclosingClass &&
+    if (constantInterceptor == enclosingClass &&
         graph.thisInstruction != null) {
       return graph.thisInstruction;
     }
 
-    ConstantValue constant =
-        new InterceptorConstantValue(constantInterceptor.thisType);
-    return graph.addConstant(constant, compiler);
+    ConstantValue constant = new InterceptorConstantValue(constantInterceptor);
+    return graph.addConstant(constant, closedWorld);
   }
 
-  ClassElement tryComputeConstantInterceptorFromType(
-      TypeMask type, Set<ClassElement> interceptedClasses) {
+  ClassEntity tryComputeConstantInterceptorFromType(
+      TypeMask type, Set<ClassEntity> interceptedClasses) {
     if (type.isNullable) {
       if (type.isNull) {
-        return helpers.jsNullClass;
+        return backendClasses.nullImplementation;
       }
     } else if (type.containsOnlyInt(closedWorld)) {
-      return helpers.jsIntClass;
+      return backendClasses.intImplementation;
     } else if (type.containsOnlyDouble(closedWorld)) {
-      return helpers.jsDoubleClass;
+      return backendClasses.doubleImplementation;
     } else if (type.containsOnlyBool(closedWorld)) {
-      return helpers.jsBoolClass;
+      return backendClasses.boolImplementation;
     } else if (type.containsOnlyString(closedWorld)) {
-      return helpers.jsStringClass;
-    } else if (type.satisfies(helpers.jsArrayClass, closedWorld)) {
-      return helpers.jsArrayClass;
+      return backendClasses.stringImplementation;
+    } else if (type.satisfies(backendClasses.listImplementation, closedWorld)) {
+      return backendClasses.listImplementation;
     } else if (type.containsOnlyNum(closedWorld) &&
-        !interceptedClasses.contains(helpers.jsIntClass) &&
-        !interceptedClasses.contains(helpers.jsDoubleClass)) {
+        !interceptedClasses.contains(backendClasses.intImplementation) &&
+        !interceptedClasses.contains(backendClasses.doubleImplementation)) {
       // If the method being intercepted is not defined in [int] or [double] we
       // can safely use the number interceptor.  This is because none of the
       // [int] or [double] methods are called from a method defined on [num].
-      return helpers.jsNumberClass;
+      return backendClasses.numImplementation;
     } else {
       // Try to find constant interceptor for a native class.  If the receiver
       // is constrained to a leaf native class, we can use the class's
@@ -174,8 +173,8 @@
       // for a subclass or call methods defined on a subclass.  Provided the
       // code is completely insensitive to the specific instance subclasses, we
       // can use the non-leaf class directly.
-      ClassElement element = type.singleClass(closedWorld);
-      if (element != null && backend.isNative(element)) {
+      ClassEntity element = type.singleClass(closedWorld);
+      if (element != null && backendClasses.isNativeClass(element)) {
         return element;
       }
     }
@@ -217,12 +216,12 @@
     int useCount(HInstruction user, HInstruction used) =>
         user.inputs.where((input) => input == used).length;
 
-    Set<ClassElement> interceptedClasses;
+    Set<ClassEntity> interceptedClasses;
     HInstruction dominator = findDominator(node.usedBy);
     // If there is a call that dominates all other uses, we can use just the
     // selector of that instruction.
     if (dominator is HInvokeDynamic &&
-        dominator.isCallOnInterceptor(compiler) &&
+        dominator.isCallOnInterceptor(closedWorld) &&
         node == dominator.receiver &&
         useCount(dominator, node) == 1) {
       interceptedClasses =
@@ -230,21 +229,25 @@
 
       // If we found that we need number, we must still go through all
       // uses to check if they require int, or double.
-      if (interceptedClasses.contains(helpers.jsNumberClass) &&
-          !(interceptedClasses.contains(helpers.jsDoubleClass) ||
-              interceptedClasses.contains(helpers.jsIntClass))) {
-        Set<ClassElement> required;
+      if (interceptedClasses.contains(backendClasses.numImplementation) &&
+          !(interceptedClasses.contains(backendClasses.doubleImplementation) ||
+              interceptedClasses.contains(backendClasses.intImplementation))) {
+        Set<ClassEntity> required;
         for (HInstruction user in node.usedBy) {
           if (user is! HInvoke) continue;
-          Set<ClassElement> intercepted =
+          Set<ClassEntity> intercepted =
               backend.getInterceptedClassesOn(user.selector.name);
-          if (intercepted.contains(helpers.jsIntClass)) {
-            required ??= new Set<ClassElement>();
-            required.add(helpers.jsIntClass);
+          if (intercepted.contains(backendClasses.intImplementation)) {
+            // TODO(johnniwinther): Use type argument when all uses of
+            // intercepted classes expect entities instead of elements.
+            required ??= new Set/*<ClassEntity>*/();
+            required.add(backendClasses.intImplementation);
           }
-          if (intercepted.contains(helpers.jsDoubleClass)) {
-            required ??= new Set<ClassElement>();
-            required.add(helpers.jsDoubleClass);
+          if (intercepted.contains(backendClasses.doubleImplementation)) {
+            // TODO(johnniwinther): Use type argument when all uses of
+            // intercepted classes expect entities instead of elements.
+            required ??= new Set/*<ClassEntity>*/();
+            required.add(backendClasses.doubleImplementation);
           }
         }
         // Don't modify the result of [backend.getInterceptedClassesOn].
@@ -253,16 +256,18 @@
         }
       }
     } else {
-      interceptedClasses = new Set<ClassElement>();
+      // TODO(johnniwinther): Use type argument when all uses of intercepted
+      // classes expect entities instead of elements.
+      interceptedClasses = new Set/*<ClassEntity>*/();
       for (HInstruction user in node.usedBy) {
         if (user is HInvokeDynamic &&
-            user.isCallOnInterceptor(compiler) &&
+            user.isCallOnInterceptor(closedWorld) &&
             node == user.receiver &&
             useCount(user, node) == 1) {
           interceptedClasses
               .addAll(backend.getInterceptedClassesOn(user.selector.name));
         } else if (user is HInvokeSuper &&
-            user.isCallOnInterceptor(compiler) &&
+            user.isCallOnInterceptor(closedWorld) &&
             node == user.receiver &&
             useCount(user, node) == 1) {
           interceptedClasses
@@ -310,17 +315,16 @@
     // constant interceptor `C`.  Then we can use `(receiver && C)` for the
     // interceptor.
     if (receiver.canBeNull()) {
-      if (!interceptedClasses.contains(helpers.jsNullClass)) {
+      if (!interceptedClasses.contains(backendClasses.nullImplementation)) {
         // Can use `(receiver && C)` only if receiver is either null or truthy.
-        if (!(receiver.canBePrimitiveNumber(compiler) ||
-            receiver.canBePrimitiveBoolean(compiler) ||
-            receiver.canBePrimitiveString(compiler))) {
-          ClassElement interceptorClass = tryComputeConstantInterceptorFromType(
+        if (!(receiver.canBePrimitiveNumber(closedWorld) ||
+            receiver.canBePrimitiveBoolean(closedWorld) ||
+            receiver.canBePrimitiveString(closedWorld))) {
+          ClassEntity interceptorClass = tryComputeConstantInterceptorFromType(
               receiver.instructionType.nonNullable(), interceptedClasses);
           if (interceptorClass != null) {
             HInstruction constantInstruction = graph.addConstant(
-                new InterceptorConstantValue(interceptorClass.thisType),
-                compiler);
+                new InterceptorConstantValue(interceptorClass), closedWorld);
             node.conditionalConstantInterceptor = constantInstruction;
             constantInstruction.usedBy.add(node);
             return false;
@@ -360,7 +364,7 @@
     } else if (user is HInvokeDynamic) {
       if (node == user.inputs[0]) {
         // Replace the user with a [HOneShotInterceptor].
-        HConstant nullConstant = graph.addConstantNull(compiler);
+        HConstant nullConstant = graph.addConstantNull(closedWorld);
         List<HInstruction> inputs = new List<HInstruction>.from(user.inputs);
         inputs[0] = nullConstant;
         HOneShotInterceptor oneShotInterceptor = new HOneShotInterceptor(
diff --git a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
index 63e3a26..6dbf37b 100644
--- a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
+++ b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
@@ -5,7 +5,8 @@
 import '../compiler.dart' show Compiler;
 import '../constants/constant_system.dart';
 import '../constants/values.dart';
-import '../elements/elements.dart';
+import '../elements/elements.dart' show Name;
+import '../elements/entities.dart';
 import '../js_backend/js_backend.dart';
 import '../types/types.dart';
 import '../universe/call_structure.dart';
@@ -24,13 +25,13 @@
   const InvokeDynamicSpecializer();
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return TypeMaskFactory.inferredTypeForSelector(
-        instruction.selector, instruction.mask, compiler);
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return TypeMaskFactory.inferredTypeForSelector(instruction.selector,
+        instruction.mask, compiler.globalInference.results);
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     return null;
   }
 
@@ -72,8 +73,21 @@
         int argumentCount = selector.argumentCount;
         if (argumentCount == 0) {
           if (name == 'round') return const RoundSpecializer();
+          if (name == 'trim') return const TrimSpecializer();
         } else if (argumentCount == 1) {
           if (name == 'codeUnitAt') return const CodeUnitAtSpecializer();
+          if (name == 'remainder') return const RemainderSpecializer();
+          if (name == 'substring') return const SubstringSpecializer();
+          if (name == 'contains') return const PatternMatchSpecializer();
+          if (name == 'indexOf') return const PatternMatchSpecializer();
+          if (name == 'startsWith') return const PatternMatchSpecializer();
+          if (name == 'endsWith') return const PatternMatchSpecializer();
+        } else if (argumentCount == 2) {
+          if (name == 'substring') return const SubstringSpecializer();
+          if (name == 'contains') return const PatternMatchSpecializer();
+          if (name == 'indexOf') return const PatternMatchSpecializer();
+          if (name == 'startsWith') return const PatternMatchSpecializer();
+          if (name == 'endsWith') return const PatternMatchSpecializer();
         }
       }
     }
@@ -85,9 +99,9 @@
   const IndexAssignSpecializer();
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
-    if (instruction.inputs[1].isMutableIndexable(compiler)) {
-      if (!instruction.inputs[2].isInteger(compiler) &&
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    if (instruction.inputs[1].isMutableIndexable(closedWorld)) {
+      if (!instruction.inputs[2].isInteger(closedWorld) &&
           compiler.options.enableTypeAssertions) {
         // We want the right checked mode error.
         return null;
@@ -103,17 +117,17 @@
   const IndexSpecializer();
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
-    if (!instruction.inputs[1].isIndexablePrimitive(compiler)) return null;
-    if (!instruction.inputs[2].isInteger(compiler) &&
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    if (!instruction.inputs[1].isIndexablePrimitive(closedWorld)) return null;
+    if (!instruction.inputs[2].isInteger(closedWorld) &&
         compiler.options.enableTypeAssertions) {
       // We want the right checked mode error.
       return null;
     }
     TypeMask receiverType =
-        instruction.getDartReceiver(compiler).instructionType;
+        instruction.getDartReceiver(closedWorld).instructionType;
     TypeMask type = TypeMaskFactory.inferredTypeForSelector(
-        instruction.selector, receiverType, compiler);
+        instruction.selector, receiverType, compiler.globalInference.results);
     return new HIndex(instruction.inputs[1], instruction.inputs[2],
         instruction.selector, type);
   }
@@ -127,22 +141,21 @@
   }
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     // All bitwise operations on primitive types either produce an
     // integer or throw an error.
-    JavaScriptBackend backend = compiler.backend;
-    if (instruction.inputs[1].isPrimitiveOrNull(compiler)) {
-      return backend.uint32Type;
+    if (instruction.inputs[1].isPrimitiveOrNull(closedWorld)) {
+      return closedWorld.commonMasks.uint32Type;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction input = instruction.inputs[1];
-    if (input.isNumber(compiler)) {
+    if (input.isNumber(closedWorld)) {
       return new HBitNot(input, instruction.selector,
-          computeTypeFromInputTypes(instruction, compiler));
+          computeTypeFromInputTypes(instruction, compiler, closedWorld));
     }
     return null;
   }
@@ -156,16 +169,16 @@
   }
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     TypeMask operandType = instruction.inputs[1].instructionType;
-    if (instruction.inputs[1].isNumberOrNull(compiler)) return operandType;
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    if (instruction.inputs[1].isNumberOrNull(closedWorld)) return operandType;
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction input = instruction.inputs[1];
-    if (input.isNumber(compiler)) {
+    if (input.isNumber(closedWorld)) {
       return new HNegate(input, instruction.selector, input.instructionType);
     }
     return null;
@@ -176,31 +189,33 @@
   const BinaryArithmeticSpecializer();
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    JavaScriptBackend backend = compiler.backend;
-    if (left.isIntegerOrNull(compiler) && right.isIntegerOrNull(compiler)) {
-      return backend.intType;
+    if (left.isIntegerOrNull(closedWorld) &&
+        right.isIntegerOrNull(closedWorld)) {
+      return closedWorld.commonMasks.intType;
     }
-    if (left.isNumberOrNull(compiler)) {
-      if (left.isDoubleOrNull(compiler) || right.isDoubleOrNull(compiler)) {
-        return backend.doubleType;
+    if (left.isNumberOrNull(closedWorld)) {
+      if (left.isDoubleOrNull(closedWorld) ||
+          right.isDoubleOrNull(closedWorld)) {
+        return closedWorld.commonMasks.doubleType;
       }
-      return backend.numType;
+      return closedWorld.commonMasks.numType;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
-  bool isBuiltin(HInvokeDynamic instruction, Compiler compiler) {
-    return instruction.inputs[1].isNumber(compiler) &&
-        instruction.inputs[2].isNumber(compiler);
+  bool isBuiltin(HInvokeDynamic instruction, ClosedWorld closedWorld) {
+    return instruction.inputs[1].isNumber(closedWorld) &&
+        instruction.inputs[2].isNumber(closedWorld);
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
-    if (isBuiltin(instruction, compiler)) {
-      HInstruction builtin = newBuiltinVariant(instruction, compiler);
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    if (isBuiltin(instruction, closedWorld)) {
+      HInstruction builtin =
+          newBuiltinVariant(instruction, compiler, closedWorld);
       if (builtin != null) return builtin;
       // Even if there is no builtin equivalent instruction, we know
       // the instruction does not have any side effect, and that it
@@ -210,20 +225,22 @@
     return null;
   }
 
-  bool inputsArePositiveIntegers(HInstruction instruction, Compiler compiler) {
+  bool inputsArePositiveIntegers(
+      HInstruction instruction, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    return left.isPositiveIntegerOrNull(compiler) &&
-        right.isPositiveIntegerOrNull(compiler);
+    return left.isPositiveIntegerOrNull(closedWorld) &&
+        right.isPositiveIntegerOrNull(closedWorld);
   }
 
-  bool inputsAreUInt31(HInstruction instruction, Compiler compiler) {
+  bool inputsAreUInt31(HInstruction instruction, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    return left.isUInt31(compiler) && right.isUInt31(compiler);
+    return left.isUInt31(closedWorld) && right.isUInt31(closedWorld);
   }
 
-  HInstruction newBuiltinVariant(HInvokeDynamic instruction, Compiler compiler);
+  HInstruction newBuiltinVariant(
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld);
 
   Selector renameToOptimizedSelector(
       String name, Selector selector, Compiler compiler) {
@@ -239,16 +256,14 @@
   const AddSpecializer();
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
-    if (inputsAreUInt31(instruction, compiler)) {
-      JavaScriptBackend backend = compiler.backend;
-      return backend.uint32Type;
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    if (inputsAreUInt31(instruction, closedWorld)) {
+      return closedWorld.commonMasks.uint32Type;
     }
-    if (inputsArePositiveIntegers(instruction, compiler)) {
-      JavaScriptBackend backend = compiler.backend;
-      return backend.positiveIntType;
+    if (inputsArePositiveIntegers(instruction, closedWorld)) {
+      return closedWorld.commonMasks.positiveIntType;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   BinaryOperation operation(ConstantSystem constantSystem) {
@@ -256,9 +271,12 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return new HAdd(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, computeTypeFromInputTypes(instruction, compiler));
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HAdd(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
   }
 }
 
@@ -270,20 +288,18 @@
   }
 
   TypeMask computeTypeFromInputTypes(
-      HInstruction instruction, Compiler compiler) {
+      HInstruction instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
-    JavaScriptBackend backend = compiler.backend;
-    if (left.isNumberOrNull(compiler)) {
-      return backend.doubleType;
+    if (left.isNumberOrNull(closedWorld)) {
+      return closedWorld.commonMasks.doubleType;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    JavaScriptBackend backend = compiler.backend;
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     return new HDivide(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, backend.doubleType);
+        instruction.selector, closedWorld.commonMasks.doubleType);
   }
 }
 
@@ -291,12 +307,11 @@
   const ModuloSpecializer();
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
-    if (inputsArePositiveIntegers(instruction, compiler)) {
-      JavaScriptBackend backend = compiler.backend;
-      return backend.positiveIntType;
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    if (inputsArePositiveIntegers(instruction, closedWorld)) {
+      return closedWorld.commonMasks.positiveIntType;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   BinaryOperation operation(ConstantSystem constantSystem) {
@@ -304,13 +319,93 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     // Modulo cannot be mapped to the native operator (different semantics).
-    // TODO(sra): For non-negative values we can use JavaScript's %.
+
+    // We can use HRemainder if both inputs are non-negative and the receiver
+    // cannot be -0.0.  Note that -0.0 is considered to be an int, so until we
+    // track -0.0 precisely, we have to syntatically filter inputs that cannot
+    // generate -0.0.
+    bool canBePositiveZero(HInstruction input) {
+      if (input is HConstant) {
+        ConstantValue value = input.constant;
+        if (value is DoubleConstantValue && value.isZero) return true;
+        if (value is IntConstantValue && value.isZero) return true;
+        return false;
+      }
+      return true;
+    }
+
+    bool inPhi = false;
+    bool canBeNegativeZero(HInstruction input) {
+      if (input is HConstant) {
+        ConstantValue value = input.constant;
+        if (value is DoubleConstantValue && value.isMinusZero) return true;
+        return false;
+      }
+      if (input is HAdd) {
+        // '+' can only generate -0.0 when both inputs are -0.0.
+        return canBeNegativeZero(input.left) && canBeNegativeZero(input.right);
+      }
+      if (input is HSubtract) {
+        return canBeNegativeZero(input.left) && canBePositiveZero(input.right);
+      }
+      if (input is HPhi) {
+        if (inPhi) return true;
+        inPhi = true;
+        bool result = input.inputs.any(canBeNegativeZero);
+        inPhi = false;
+        return result;
+      }
+      return true;
+    }
+
+    if (inputsArePositiveIntegers(instruction, closedWorld) &&
+        !canBeNegativeZero(instruction.getDartReceiver(closedWorld))) {
+      return new HRemainder(
+          instruction.inputs[1],
+          instruction.inputs[2],
+          instruction.selector,
+          computeTypeFromInputTypes(instruction, compiler, closedWorld));
+    }
+    // TODO(sra):
+    //   a % N -->  a & (N-1), N=2^k, where a>=0, does not have -0.0 problem.
+
+    // TODO(sra): We could avoid problems with -0.0 if we generate x % y as (x +
+    // 0) % y, but we would have to fix HAdd optimizations.
+
+    // TODO(sra): We could replace $mod with HRemainder when we don't care about
+    // a -0.0 result (e.g. a % 10 == 0, a[i % 3]). This is tricky, since we
+    // don't want to ruin GVN opportunities.
     return null;
   }
 }
 
+class RemainderSpecializer extends BinaryArithmeticSpecializer {
+  const RemainderSpecializer();
+
+  TypeMask computeTypeFromInputTypes(
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    if (inputsArePositiveIntegers(instruction, closedWorld)) {
+      return closedWorld.commonMasks.positiveIntType;
+    }
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
+  }
+
+  BinaryOperation operation(ConstantSystem constantSystem) {
+    return constantSystem.remainder;
+  }
+
+  HInstruction newBuiltinVariant(
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HRemainder(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
+  }
+}
+
 class MultiplySpecializer extends BinaryArithmeticSpecializer {
   const MultiplySpecializer();
 
@@ -319,18 +414,20 @@
   }
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
-    if (inputsArePositiveIntegers(instruction, compiler)) {
-      JavaScriptBackend backend = compiler.backend;
-      return backend.positiveIntType;
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    if (inputsArePositiveIntegers(instruction, closedWorld)) {
+      return closedWorld.commonMasks.positiveIntType;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return new HMultiply(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, computeTypeFromInputTypes(instruction, compiler));
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HMultiply(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
   }
 }
 
@@ -342,9 +439,12 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return new HSubtract(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, computeTypeFromInputTypes(instruction, compiler));
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HSubtract(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
   }
 }
 
@@ -356,18 +456,17 @@
   }
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
-    JavaScriptBackend backend = compiler.backend;
-    if (hasUint31Result(instruction, compiler)) {
-      return backend.uint31Type;
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    if (hasUint31Result(instruction, closedWorld)) {
+      return closedWorld.commonMasks.uint31Type;
     }
-    if (inputsArePositiveIntegers(instruction, compiler)) {
-      return backend.positiveIntType;
+    if (inputsArePositiveIntegers(instruction, closedWorld)) {
+      return closedWorld.commonMasks.positiveIntType;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
-  bool isNotZero(HInstruction instruction, Compiler compiler) {
+  bool isNotZero(HInstruction instruction) {
     if (!instruction.isConstantInteger()) return false;
     HConstant rightConstant = instruction;
     IntConstantValue intConstant = rightConstant.constant;
@@ -375,7 +474,7 @@
     return count != 0;
   }
 
-  bool isTwoOrGreater(HInstruction instruction, Compiler compiler) {
+  bool isTwoOrGreater(HInstruction instruction) {
     if (!instruction.isConstantInteger()) return false;
     HConstant rightConstant = instruction;
     IntConstantValue intConstant = rightConstant.constant;
@@ -383,14 +482,14 @@
     return count >= 2;
   }
 
-  bool hasUint31Result(HInstruction instruction, Compiler compiler) {
+  bool hasUint31Result(HInstruction instruction, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    if (right.isPositiveInteger(compiler)) {
-      if (left.isUInt31(compiler) && isNotZero(right, compiler)) {
+    if (right.isPositiveInteger(closedWorld)) {
+      if (left.isUInt31(closedWorld) && isNotZero(right)) {
         return true;
       }
-      if (left.isUInt32(compiler) && isTwoOrGreater(right, compiler)) {
+      if (left.isUInt32(closedWorld) && isTwoOrGreater(right)) {
         return true;
       }
     }
@@ -398,12 +497,12 @@
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction right = instruction.inputs[2];
-    if (isBuiltin(instruction, compiler)) {
-      if (right.isPositiveInteger(compiler) && isNotZero(right, compiler)) {
-        if (hasUint31Result(instruction, compiler)) {
-          return newBuiltinVariant(instruction, compiler);
+    if (isBuiltin(instruction, closedWorld)) {
+      if (right.isPositiveInteger(closedWorld) && isNotZero(right)) {
+        if (hasUint31Result(instruction, closedWorld)) {
+          return newBuiltinVariant(instruction, compiler, closedWorld);
         }
         // We can call _tdivFast because the rhs is a 32bit integer
         // and not 0, nor -1.
@@ -416,9 +515,12 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return new HTruncatingDivide(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, computeTypeFromInputTypes(instruction, compiler));
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HTruncatingDivide(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
   }
 }
 
@@ -426,15 +528,14 @@
   const BinaryBitOpSpecializer();
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     // All bitwise operations on primitive types either produce an
     // integer or throw an error.
     HInstruction left = instruction.inputs[1];
-    JavaScriptBackend backend = compiler.backend;
-    if (left.isPrimitiveOrNull(compiler)) {
-      return backend.uint32Type;
+    if (left.isPrimitiveOrNull(closedWorld)) {
+      return closedWorld.commonMasks.uint32Type;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   bool argumentLessThan32(HInstruction instruction) {
@@ -445,10 +546,10 @@
     return count >= 0 && count <= 31;
   }
 
-  bool isPositive(HInstruction instruction, Compiler compiler) {
+  bool isPositive(HInstruction instruction, ClosedWorld closedWorld) {
     // TODO: We should use the value range analysis. Currently, ranges
     // are discarded just after the analysis.
-    return instruction.isPositiveInteger(compiler);
+    return instruction.isPositiveInteger(closedWorld);
   }
 }
 
@@ -460,18 +561,18 @@
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    if (left.isNumber(compiler)) {
+    if (left.isNumber(closedWorld)) {
       if (argumentLessThan32(right)) {
-        return newBuiltinVariant(instruction, compiler);
+        return newBuiltinVariant(instruction, compiler, closedWorld);
       }
       // Even if there is no builtin equivalent instruction, we know
       // the instruction does not have any side effect, and that it
       // can be GVN'ed.
       clearAllSideEffects(instruction);
-      if (isPositive(right, compiler)) {
+      if (isPositive(right, closedWorld)) {
         instruction.selector = renameToOptimizedSelector(
             '_shlPositive', instruction.selector, compiler);
       }
@@ -480,9 +581,12 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return new HShiftLeft(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, computeTypeFromInputTypes(instruction, compiler));
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HShiftLeft(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
   }
 }
 
@@ -490,31 +594,31 @@
   const ShiftRightSpecializer();
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
-    if (left.isUInt32(compiler)) return left.instructionType;
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    if (left.isUInt32(closedWorld)) return left.instructionType;
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    if (left.isNumber(compiler)) {
-      if (argumentLessThan32(right) && isPositive(left, compiler)) {
-        return newBuiltinVariant(instruction, compiler);
+    if (left.isNumber(closedWorld)) {
+      if (argumentLessThan32(right) && isPositive(left, closedWorld)) {
+        return newBuiltinVariant(instruction, compiler, closedWorld);
       }
       // Even if there is no builtin equivalent instruction, we know
       // the instruction does not have any side effect, and that it
       // can be GVN'ed.
       clearAllSideEffects(instruction);
-      if (isPositive(right, compiler) && isPositive(left, compiler)) {
+      if (isPositive(right, closedWorld) && isPositive(left, closedWorld)) {
         instruction.selector = renameToOptimizedSelector(
             '_shrBothPositive', instruction.selector, compiler);
-      } else if (isPositive(left, compiler) && right.isNumber(compiler)) {
+      } else if (isPositive(left, closedWorld) && right.isNumber(closedWorld)) {
         instruction.selector = renameToOptimizedSelector(
             '_shrReceiverPositive', instruction.selector, compiler);
-      } else if (isPositive(right, compiler)) {
+      } else if (isPositive(right, closedWorld)) {
         instruction.selector = renameToOptimizedSelector(
             '_shrOtherPositive', instruction.selector, compiler);
       }
@@ -523,9 +627,12 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return new HShiftRight(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, computeTypeFromInputTypes(instruction, compiler));
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HShiftRight(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
   }
 
   BinaryOperation operation(ConstantSystem constantSystem) {
@@ -541,20 +648,22 @@
   }
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    JavaScriptBackend backend = compiler.backend;
-    if (left.isUInt31(compiler) && right.isUInt31(compiler)) {
-      return backend.uint31Type;
+    if (left.isUInt31(closedWorld) && right.isUInt31(closedWorld)) {
+      return closedWorld.commonMasks.uint31Type;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return new HBitOr(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, computeTypeFromInputTypes(instruction, compiler));
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HBitOr(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
   }
 }
 
@@ -566,21 +675,23 @@
   }
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    JavaScriptBackend backend = compiler.backend;
-    if (left.isPrimitiveOrNull(compiler) &&
-        (left.isUInt31(compiler) || right.isUInt31(compiler))) {
-      return backend.uint31Type;
+    if (left.isPrimitiveOrNull(closedWorld) &&
+        (left.isUInt31(closedWorld) || right.isUInt31(closedWorld))) {
+      return closedWorld.commonMasks.uint31Type;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return new HBitAnd(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, computeTypeFromInputTypes(instruction, compiler));
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HBitAnd(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
   }
 }
 
@@ -592,20 +703,22 @@
   }
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    JavaScriptBackend backend = compiler.backend;
-    if (left.isUInt31(compiler) && right.isUInt31(compiler)) {
-      return backend.uint31Type;
+    if (left.isUInt31(closedWorld) && right.isUInt31(closedWorld)) {
+      return closedWorld.commonMasks.uint31Type;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    return new HBitXor(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, computeTypeFromInputTypes(instruction, compiler));
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    return new HBitXor(
+        instruction.inputs[1],
+        instruction.inputs[2],
+        instruction.selector,
+        computeTypeFromInputTypes(instruction, compiler, closedWorld));
   }
 }
 
@@ -613,47 +726,46 @@
   const RelationalSpecializer();
 
   TypeMask computeTypeFromInputTypes(
-      HInvokeDynamic instruction, Compiler compiler) {
-    JavaScriptBackend backend = compiler.backend;
-    if (instruction.inputs[1].isPrimitiveOrNull(compiler)) {
-      return backend.boolType;
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    if (instruction.inputs[1].isPrimitiveOrNull(closedWorld)) {
+      return closedWorld.commonMasks.boolType;
     }
-    return super.computeTypeFromInputTypes(instruction, compiler);
+    return super.computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
-    if (left.isNumber(compiler) && right.isNumber(compiler)) {
-      return newBuiltinVariant(instruction, compiler);
+    if (left.isNumber(closedWorld) && right.isNumber(closedWorld)) {
+      return newBuiltinVariant(instruction, closedWorld);
     }
     return null;
   }
 
-  HInstruction newBuiltinVariant(HInvokeDynamic instruction, Compiler compiler);
+  HInstruction newBuiltinVariant(
+      HInvokeDynamic instruction, ClosedWorld closedWorld);
 }
 
 class EqualsSpecializer extends RelationalSpecializer {
   const EqualsSpecializer();
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     HInstruction left = instruction.inputs[1];
     HInstruction right = instruction.inputs[2];
     TypeMask instructionType = left.instructionType;
-    if (right.isConstantNull() || left.isPrimitiveOrNull(compiler)) {
-      return newBuiltinVariant(instruction, compiler);
+    if (right.isConstantNull() || left.isPrimitiveOrNull(closedWorld)) {
+      return newBuiltinVariant(instruction, closedWorld);
     }
-    ClosedWorld world = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    Iterable<Element> matches =
-        world.allFunctions.filter(instruction.selector, instructionType);
+    Iterable<MemberEntity> matches =
+        closedWorld.allFunctions.filter(instruction.selector, instructionType);
     // This test relies the on `Object.==` and `Interceptor.==` always being
     // implemented because if the selector matches by subtype, it still will be
     // a regular object or an interceptor.
-    if (matches.every(backend.isDefaultEqualityImplementation)) {
-      return newBuiltinVariant(instruction, compiler);
+    if (matches
+        .every(closedWorld.backendClasses.isDefaultEqualityImplementation)) {
+      return newBuiltinVariant(instruction, closedWorld);
     }
     return null;
   }
@@ -663,10 +775,9 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    JavaScriptBackend backend = compiler.backend;
+      HInvokeDynamic instruction, ClosedWorld closedWorld) {
     return new HIdentity(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, backend.boolType);
+        instruction.selector, closedWorld.commonMasks.boolType);
   }
 }
 
@@ -678,10 +789,9 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    JavaScriptBackend backend = compiler.backend;
+      HInvokeDynamic instruction, ClosedWorld closedWorld) {
     return new HLess(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, backend.boolType);
+        instruction.selector, closedWorld.commonMasks.boolType);
   }
 }
 
@@ -693,10 +803,9 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    JavaScriptBackend backend = compiler.backend;
+      HInvokeDynamic instruction, ClosedWorld closedWorld) {
     return new HGreater(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, backend.boolType);
+        instruction.selector, closedWorld.commonMasks.boolType);
   }
 }
 
@@ -708,10 +817,9 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    JavaScriptBackend backend = compiler.backend;
+      HInvokeDynamic instruction, ClosedWorld closedWorld) {
     return new HGreaterEqual(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, backend.boolType);
+        instruction.selector, closedWorld.commonMasks.boolType);
   }
 }
 
@@ -723,10 +831,9 @@
   }
 
   HInstruction newBuiltinVariant(
-      HInvokeDynamic instruction, Compiler compiler) {
-    JavaScriptBackend backend = compiler.backend;
+      HInvokeDynamic instruction, ClosedWorld closedWorld) {
     return new HLessEqual(instruction.inputs[1], instruction.inputs[2],
-        instruction.selector, backend.boolType);
+        instruction.selector, closedWorld.commonMasks.boolType);
   }
 }
 
@@ -738,11 +845,11 @@
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
     // TODO(sra): Implement a builtin HCodeUnitAt instruction and the same index
     // bounds checking optimizations as for HIndex.
-    HInstruction receiver = instruction.getDartReceiver(compiler);
-    if (receiver.isStringOrNull(compiler)) {
+    HInstruction receiver = instruction.getDartReceiver(closedWorld);
+    if (receiver.isStringOrNull(closedWorld)) {
       // Even if there is no builtin equivalent instruction, we know
       // String.codeUnitAt does not have any side effect (other than throwing),
       // and that it can be GVN'ed.
@@ -752,6 +859,46 @@
   }
 }
 
+class IdempotentStringOperationSpecializer extends InvokeDynamicSpecializer {
+  const IdempotentStringOperationSpecializer();
+
+  HInstruction tryConvertToBuiltin(
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    HInstruction receiver = instruction.getDartReceiver(closedWorld);
+    if (receiver.isStringOrNull(closedWorld)) {
+      // String.xxx does not have any side effect (other than throwing), and it
+      // can be GVN'ed.
+      clearAllSideEffects(instruction);
+    }
+    return null;
+  }
+}
+
+class SubstringSpecializer extends IdempotentStringOperationSpecializer {
+  const SubstringSpecializer();
+}
+
+class TrimSpecializer extends IdempotentStringOperationSpecializer {
+  const TrimSpecializer();
+}
+
+class PatternMatchSpecializer extends InvokeDynamicSpecializer {
+  const PatternMatchSpecializer();
+
+  HInstruction tryConvertToBuiltin(
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    HInstruction receiver = instruction.getDartReceiver(closedWorld);
+    HInstruction pattern = instruction.inputs[2];
+    if (receiver.isStringOrNull(closedWorld) &&
+        pattern.isStringOrNull(closedWorld)) {
+      // String.contains(String s) does not have any side effect (other than
+      // throwing), and it can be GVN'ed.
+      clearAllSideEffects(instruction);
+    }
+    return null;
+  }
+}
+
 class RoundSpecializer extends InvokeDynamicSpecializer {
   const RoundSpecializer();
 
@@ -760,9 +907,9 @@
   }
 
   HInstruction tryConvertToBuiltin(
-      HInvokeDynamic instruction, Compiler compiler) {
-    HInstruction receiver = instruction.getDartReceiver(compiler);
-    if (receiver.isNumberOrNull(compiler)) {
+      HInvokeDynamic instruction, Compiler compiler, ClosedWorld closedWorld) {
+    HInstruction receiver = instruction.getDartReceiver(closedWorld);
+    if (receiver.isNumberOrNull(closedWorld)) {
       // Even if there is no builtin equivalent instruction, we know the
       // instruction does not have any side effect, and that it can be GVN'ed.
       clearAllSideEffects(instruction);
diff --git a/pkg/compiler/lib/src/ssa/jump_handler.dart b/pkg/compiler/lib/src/ssa/jump_handler.dart
index a50d496..c3d1528 100644
--- a/pkg/compiler/lib/src/ssa/jump_handler.dart
+++ b/pkg/compiler/lib/src/ssa/jump_handler.dart
@@ -12,12 +12,12 @@
 import 'nodes.dart';
 
 /// A single break/continue instruction.
-class JumpHandlerEntry {
+class _JumpHandlerEntry {
   final HJump jumpInstruction;
   final LocalsHandler locals;
   bool isBreak() => jumpInstruction is HBreak;
   bool isContinue() => jumpInstruction is HContinue;
-  JumpHandlerEntry(this.jumpInstruction, this.locals);
+  _JumpHandlerEntry(this.jumpInstruction, this.locals);
 }
 
 abstract class JumpHandler {
@@ -33,7 +33,7 @@
   bool hasAnyBreak();
   void close();
   final JumpTarget target;
-  List<LabelDefinition> labels();
+  List<LabelDefinition> get labels;
 }
 
 /// Jump handler used to avoid null checks when a target isn't used as the
@@ -60,7 +60,7 @@
   bool hasAnyContinue() => false;
   bool hasAnyBreak() => false;
 
-  List<LabelDefinition> labels() => const <LabelDefinition>[];
+  List<LabelDefinition> get labels => const <LabelDefinition>[];
   JumpTarget get target => null;
 }
 
@@ -71,11 +71,11 @@
 class TargetJumpHandler implements JumpHandler {
   final GraphBuilder builder;
   final JumpTarget target;
-  final List<JumpHandlerEntry> jumps;
+  final List<_JumpHandlerEntry> jumps;
 
   TargetJumpHandler(GraphBuilder builder, this.target)
       : this.builder = builder,
-        jumps = <JumpHandlerEntry>[] {
+        jumps = <_JumpHandlerEntry>[] {
     assert(builder.jumpTargets[target] == null);
     builder.jumpTargets[target] = this;
   }
@@ -89,7 +89,7 @@
     }
     LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
     builder.close(breakInstruction);
-    jumps.add(new JumpHandlerEntry(breakInstruction, locals));
+    jumps.add(new _JumpHandlerEntry(breakInstruction, locals));
   }
 
   void generateContinue([LabelDefinition label]) {
@@ -104,30 +104,30 @@
     }
     LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
     builder.close(continueInstruction);
-    jumps.add(new JumpHandlerEntry(continueInstruction, locals));
+    jumps.add(new _JumpHandlerEntry(continueInstruction, locals));
   }
 
   void forEachBreak(Function action) {
-    for (JumpHandlerEntry entry in jumps) {
+    for (_JumpHandlerEntry entry in jumps) {
       if (entry.isBreak()) action(entry.jumpInstruction, entry.locals);
     }
   }
 
   void forEachContinue(Function action) {
-    for (JumpHandlerEntry entry in jumps) {
+    for (_JumpHandlerEntry entry in jumps) {
       if (entry.isContinue()) action(entry.jumpInstruction, entry.locals);
     }
   }
 
   bool hasAnyContinue() {
-    for (JumpHandlerEntry entry in jumps) {
+    for (_JumpHandlerEntry entry in jumps) {
       if (entry.isContinue()) return true;
     }
     return false;
   }
 
   bool hasAnyBreak() {
-    for (JumpHandlerEntry entry in jumps) {
+    for (_JumpHandlerEntry entry in jumps) {
       if (entry.isBreak()) return true;
     }
     return false;
@@ -138,24 +138,82 @@
     builder.jumpTargets.remove(target);
   }
 
-  List<LabelDefinition> labels() {
+  List<LabelDefinition> get labels {
     List<LabelDefinition> result = null;
     for (LabelDefinition element in target.labels) {
-      if (result == null) result = <LabelDefinition>[];
+      result ??= <LabelDefinition>[];
       result.add(element);
     }
-    return (result == null) ? const <LabelDefinition>[] : result;
+    return result ?? const <LabelDefinition>[];
   }
 }
 
 /// Special [JumpHandler] implementation used to handle continue statements
 /// targeting switch cases.
-class SwitchCaseJumpHandler extends TargetJumpHandler {
+abstract class SwitchCaseJumpHandler extends TargetJumpHandler {
   /// Map from switch case targets to indices used to encode the flow of the
   /// switch case loop.
   final Map<JumpTarget, int> targetIndexMap = new Map<JumpTarget, int>();
 
-  SwitchCaseJumpHandler(
+  SwitchCaseJumpHandler(GraphBuilder builder, JumpTarget target)
+      : super(builder, target);
+
+  void generateBreak([LabelDefinition label]) {
+    if (label == null) {
+      // Creates a special break instruction for the synthetic loop generated
+      // for a switch statement with continue statements. See
+      // [SsaFromAstMixin.buildComplexSwitchStatement] for detail.
+
+      HInstruction breakInstruction =
+          new HBreak(target, breakSwitchContinueLoop: true);
+      LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
+      builder.close(breakInstruction);
+      jumps.add(new _JumpHandlerEntry(breakInstruction, locals));
+    } else {
+      super.generateBreak(label);
+    }
+  }
+
+  bool isContinueToSwitchCase(LabelDefinition label) {
+    return label != null && targetIndexMap.containsKey(label.target);
+  }
+
+  void generateContinue([LabelDefinition label]) {
+    if (isContinueToSwitchCase(label)) {
+      // Creates the special instructions 'label = i; continue l;' used in
+      // switch statements with continue statements. See
+      // [SsaFromAstMixin.buildComplexSwitchStatement] for detail.
+
+      assert(label != null);
+      // TODO(het): change the graph 'addConstantXXX' to take a ConstantSystem
+      // instead of a Compiler.
+      HInstruction value = builder.graph
+          .addConstantInt(targetIndexMap[label.target], builder.closedWorld);
+      builder.localsHandler.updateLocal(target, value);
+
+      assert(label.target.labels.contains(label));
+      HInstruction continueInstruction = new HContinue(target);
+      LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
+      builder.close(continueInstruction);
+      jumps.add(new _JumpHandlerEntry(continueInstruction, locals));
+    } else {
+      super.generateContinue(label);
+    }
+  }
+
+  void close() {
+    // The mapping from TargetElement to JumpHandler is no longer needed.
+    for (JumpTarget target in targetIndexMap.keys) {
+      builder.jumpTargets.remove(target);
+    }
+    super.close();
+  }
+}
+
+/// Special [JumpHandler] implementation used to handle continue statements
+/// targeting switch cases.
+class AstSwitchCaseJumpHandler extends SwitchCaseJumpHandler {
+  AstSwitchCaseJumpHandler(
       GraphBuilder builder, JumpTarget target, ast.SwitchStatement node)
       : super(builder, target) {
     // The switch case indices must match those computed in
@@ -180,55 +238,4 @@
       switchIndex++;
     }
   }
-
-  void generateBreak([LabelDefinition label]) {
-    if (label == null) {
-      // Creates a special break instruction for the synthetic loop generated
-      // for a switch statement with continue statements. See
-      // [SsaFromAstMixin.buildComplexSwitchStatement] for detail.
-
-      HInstruction breakInstruction =
-          new HBreak(target, breakSwitchContinueLoop: true);
-      LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
-      builder.close(breakInstruction);
-      jumps.add(new JumpHandlerEntry(breakInstruction, locals));
-    } else {
-      super.generateBreak(label);
-    }
-  }
-
-  bool isContinueToSwitchCase(LabelDefinition label) {
-    return label != null && targetIndexMap.containsKey(label.target);
-  }
-
-  void generateContinue([LabelDefinition label]) {
-    if (isContinueToSwitchCase(label)) {
-      // Creates the special instructions 'label = i; continue l;' used in
-      // switch statements with continue statements. See
-      // [SsaFromAstMixin.buildComplexSwitchStatement] for detail.
-
-      assert(label != null);
-      // TODO(het): change the graph 'addConstantXXX' to take a ConstantSystem
-      // instead of a Compiler.
-      HInstruction value = builder.graph
-          .addConstantInt(targetIndexMap[label.target], builder.compiler);
-      builder.localsHandler.updateLocal(target, value);
-
-      assert(label.target.labels.contains(label));
-      HInstruction continueInstruction = new HContinue(target);
-      LocalsHandler locals = new LocalsHandler.from(builder.localsHandler);
-      builder.close(continueInstruction);
-      jumps.add(new JumpHandlerEntry(continueInstruction, locals));
-    } else {
-      super.generateContinue(label);
-    }
-  }
-
-  void close() {
-    // The mapping from TargetElement to JumpHandler is no longer needed.
-    for (JumpTarget target in targetIndexMap.keys) {
-      builder.jumpTargets.remove(target);
-    }
-    super.close();
-  }
 }
diff --git a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
index 07c515c..ea8dedb 100644
--- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
@@ -5,13 +5,16 @@
 import 'package:js_runtime/shared/embedded_names.dart';
 import 'package:kernel/ast.dart' as ir;
 
-import '../constants/expressions.dart';
 import '../common.dart';
 import '../common/names.dart';
 import '../compiler.dart';
+import '../constants/expressions.dart';
 import '../constants/values.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
+import '../elements/entities.dart';
+import '../elements/modelx.dart';
+import '../elements/types.dart';
 import '../js/js.dart' as js;
 import '../js_backend/backend_helpers.dart';
 import '../js_backend/js_backend.dart';
@@ -26,24 +29,120 @@
 import '../universe/selector.dart';
 import '../universe/side_effects.dart';
 import '../world.dart';
+import 'graph_builder.dart';
+import 'jump_handler.dart' show SwitchCaseJumpHandler;
 import 'locals_handler.dart';
 import 'types.dart';
 
+/// Interface that translates between Kernel IR nodes and entities.
+abstract class KernelWorldBuilder {
+  /// Returns the [DartType] corresponding to [type].
+  DartType getDartType(ir.DartType type);
+
+  /// Returns the list of [DartType]s corresponding to [types].
+  List<DartType> getDartTypes(List<ir.DartType> types);
+
+  /// Returns the [InterfaceType] corresponding to [type].
+  InterfaceType getInterfaceType(ir.InterfaceType type);
+
+  /// Return the [InterfaceType] corresponding to the [cls] with the given
+  /// [typeArguments].
+  InterfaceType createInterfaceType(
+      ir.Class cls, List<ir.DartType> typeArguments);
+
+  /// Returns the [CallStructure] corresponding to the [arguments].
+  CallStructure getCallStructure(ir.Arguments arguments);
+
+  /// Returns the [Selector] corresponding to the invocation or getter/setter
+  /// access of [node].
+  Selector getSelector(ir.Expression node);
+
+  /// Returns the [FunctionEntity] corresponding to the generative or factory
+  /// constructor [node].
+  FunctionEntity getConstructor(ir.Member node);
+
+  /// Returns the [MemberEntity] corresponding to the member [node].
+  MemberEntity getMember(ir.Member node);
+
+  /// Returns the [FunctionEntity] corresponding to the procedure [node].
+  FunctionEntity getMethod(ir.Procedure node);
+
+  /// Returns the [FieldEntity] corresponding to the field [node].
+  FieldEntity getField(ir.Field node);
+
+  /// Returns the [ClassEntity] corresponding to the class [node].
+  ClassEntity getClass(ir.Class node);
+
+  /// Returns the [Local] corresponding to the [node]. The node must be either
+  /// a [ir.FunctionDeclaration] or [ir.FunctionExpression].
+  Local getLocalFunction(ir.Node node);
+
+  /// Returns the [Name] corresponding to [name].
+  Name getName(ir.Name name);
+
+  /// Returns `true` is [node] has a `@Native(...)` annotation.
+  bool isNativeClass(ir.Class node);
+
+  /// Return `true` if [node] is the `dart:_foreign_helper` library.
+  bool isForeignLibrary(ir.Library node);
+
+  /// Computes the native behavior for reading the native [field].
+  native.NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field);
+
+  /// Computes the native behavior for writing to the native [field].
+  native.NativeBehavior getNativeBehaviorForFieldStore(ir.Field field);
+
+  /// Computes the native behavior for calling [procedure].
+  native.NativeBehavior getNativeBehaviorForMethod(ir.Procedure procedure);
+
+  /// Computes the [native.NativeBehavior] for a call to the [JS] function.
+  native.NativeBehavior getNativeBehaviorForJsCall(ir.StaticInvocation node);
+
+  /// Computes the [native.NativeBehavior] for a call to the [JS_BUILTIN]
+  /// function.
+  native.NativeBehavior getNativeBehaviorForJsBuiltinCall(
+      ir.StaticInvocation node);
+
+  /// Computes the [native.NativeBehavior] for a call to the
+  /// [JS_EMBEDDED_GLOBAL] function.
+  native.NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
+      ir.StaticInvocation node);
+
+  /// Compute the kind of foreign helper function called by [node], if any.
+  ForeignKind getForeignKind(ir.StaticInvocation node);
+
+  /// Computes the [InterfaceType] referenced by a call to the
+  /// [JS_INTERCEPTOR_CONSTANT] function, if any.
+  InterfaceType getInterfaceTypeForJsInterceptorCall(ir.StaticInvocation node);
+}
+
 /// A helper class that abstracts all accesses of the AST from Kernel nodes.
 ///
 /// The goal is to remove all need for the AST from the Kernel SSA builder.
-class KernelAstAdapter {
+class KernelAstAdapter implements KernelWorldBuilder {
   final Kernel kernel;
   final JavaScriptBackend _backend;
-  final ResolvedAst _resolvedAst;
   final Map<ir.Node, ast.Node> _nodeToAst;
   final Map<ir.Node, Element> _nodeToElement;
   final Map<ir.VariableDeclaration, SyntheticLocal> _syntheticLocals =
       <ir.VariableDeclaration, SyntheticLocal>{};
+  // TODO(efortuna): In an ideal world the TreeNodes should be some common
+  // interface we create for both ir.Statements and ir.SwitchCase (the
+  // ContinueSwitchStatement's target is a SwitchCase) rather than general
+  // TreeNode. Talking to Asger about this.
+  final Map<ir.TreeNode, KernelJumpTarget> _jumpTargets =
+      <ir.TreeNode, KernelJumpTarget>{};
   DartTypeConverter _typeConverter;
+  ResolvedAst _resolvedAst;
+
+  /// Sometimes for resolution the resolved AST element needs to change (for
+  /// example, if we're inlining, or if we're in a constructor, but then also
+  /// constructing the field values). We keep track of this with a stack.
+  final List<ResolvedAst> _resolvedAstStack = <ResolvedAst>[];
 
   KernelAstAdapter(this.kernel, this._backend, this._resolvedAst,
       this._nodeToAst, this._nodeToElement) {
+    KernelJumpTarget.index = 0;
     // TODO(het): Maybe just use all of the kernel maps directly?
     for (FieldElement fieldElement in kernel.fields.keys) {
       _nodeToElement[kernel.fields[fieldElement]] = fieldElement;
@@ -60,18 +159,41 @@
     for (LocalFunctionElement localFunction in kernel.localFunctions.keys) {
       _nodeToElement[kernel.localFunctions[localFunction]] = localFunction;
     }
+    for (TypeVariableElement typeVariable in kernel.typeParameters.keys) {
+      _nodeToElement[kernel.typeParameters[typeVariable]] = typeVariable;
+    }
     _typeConverter = new DartTypeConverter(this);
   }
 
+  /// Push the existing resolved AST on the stack and shift the current resolved
+  /// AST to the AST that this kernel node points to.
+  void pushResolvedAst(ir.Node node) {
+    _resolvedAstStack.add(_resolvedAst);
+    _resolvedAst = (getElement(node) as AstElement).resolvedAst;
+  }
+
+  /// Pop the resolved AST stack to reset it to the previous resolved AST node.
+  void popResolvedAstStack() {
+    assert(_resolvedAstStack.isNotEmpty);
+    _resolvedAst = _resolvedAstStack.removeLast();
+  }
+
   Compiler get _compiler => _backend.compiler;
   TreeElements get elements => _resolvedAst.elements;
   DiagnosticReporter get reporter => _compiler.reporter;
   Element get _target => _resolvedAst.element;
 
+  GlobalTypeInferenceResults get _globalInferenceResults =>
+      _compiler.globalInference.results;
+
   GlobalTypeInferenceElementResult _resultOf(Element e) =>
-      _compiler.globalInference.results.resultOf(e);
+      _globalInferenceResults
+          .resultOf(e is ConstructorBodyElementX ? e.constructor : e);
 
   ConstantValue getConstantForSymbol(ir.SymbolLiteral node) {
+    if (kernel.syntheticNodes.contains(node)) {
+      return _backend.constantSystem.createSymbol(_compiler, node.value);
+    }
     ast.Node astNode = getNode(node);
     ConstantValue constantValue = _backend.constants
         .getConstantValueForNode(astNode, _resolvedAst.elements);
@@ -88,11 +210,18 @@
     return result;
   }
 
-  MemberElement getMember(ir.Node node) => getElement(node).declaration;
+  ConstructorElement getConstructor(ir.Member node) =>
+      getElement(node).declaration;
 
-  MethodElement getMethod(ir.Node node) => getElement(node).declaration;
+  MemberElement getMember(ir.Member node) => getElement(node).declaration;
 
-  ClassElement getClass(ir.Node node) => getElement(node).declaration;
+  MethodElement getMethod(ir.Procedure node) => getElement(node).declaration;
+
+  FieldElement getField(ir.Field node) => getElement(node).declaration;
+
+  ClassElement getClass(ir.Class node) => getElement(node).declaration;
+
+  LocalFunctionElement getLocalFunction(ir.Node node) => getElement(node);
 
   ast.Node getNode(ir.Node node) {
     ast.Node result = _nodeToAst[node];
@@ -101,6 +230,16 @@
     return result;
   }
 
+  ast.Node getNodeOrNull(ir.Node node) {
+    return _nodeToAst[node];
+  }
+
+  void assertNodeIsSynthetic(ir.Node node) {
+    assert(invariant(
+        CURRENT_ELEMENT_SPANNABLE, kernel.syntheticNodes.contains(node),
+        message: "No synthetic marker found for $node"));
+  }
+
   Local getLocal(ir.VariableDeclaration variable) {
     // If this is a synthetic local, return the synthetic local
     if (variable.name == null) {
@@ -110,18 +249,18 @@
     return getElement(variable) as LocalElement;
   }
 
-  bool getCanThrow(ir.Node procedure) {
+  bool getCanThrow(ir.Node procedure, ClosedWorld closedWorld) {
     FunctionElement function = getElement(procedure);
-    return !_compiler.closedWorld.getCannotThrow(function);
+    return !closedWorld.getCannotThrow(function);
   }
 
   TypeMask returnTypeOf(ir.Member node) {
     return TypeMaskFactory.inferredReturnTypeForElement(
-        getElement(node), _compiler);
+        getElement(node), _globalInferenceResults);
   }
 
-  SideEffects getSideEffects(ir.Node node) {
-    return _compiler.closedWorld.getSideEffectsOfElement(getElement(node));
+  SideEffects getSideEffects(ir.Node node, ClosedWorld closedWorld) {
+    return closedWorld.getSideEffectsOfElement(getElement(node));
   }
 
   CallStructure getCallStructure(ir.Arguments arguments) {
@@ -183,11 +322,14 @@
     return new Selector.setter(name);
   }
 
-  TypeMask typeOfInvocation(ir.Expression send) {
+  TypeMask typeOfInvocation(ir.MethodInvocation send, ClosedWorld closedWorld) {
     ast.Node operatorNode = kernel.nodeToAstOperator[send];
     if (operatorNode != null) {
       return _resultOf(_target).typeOfOperator(operatorNode);
     }
+    if (send.name.name == '[]=') {
+      return closedWorld.commonMasks.dynamicType;
+    }
     return _resultOf(_target).typeOfSend(getNode(send));
   }
 
@@ -195,8 +337,8 @@
     return _resultOf(_target).typeOfSend(getNode(getter));
   }
 
-  TypeMask typeOfSet(ir.PropertySet setter) {
-    return _compiler.closedWorld.commonMasks.dynamicType;
+  TypeMask typeOfSet(ir.PropertySet setter, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.dynamicType;
   }
 
   TypeMask typeOfSend(ir.Expression send) {
@@ -204,9 +346,15 @@
     return _resultOf(_target).typeOfSend(getNode(send));
   }
 
-  TypeMask typeOfNewList(Element owner, ir.ListLiteral listLiteral) {
-    return _resultOf(owner).typeOfNewList(getNode(listLiteral)) ??
-        _compiler.closedWorld.commonMasks.dynamicType;
+  TypeMask typeOfListLiteral(
+      Element owner, ir.ListLiteral listLiteral, ClosedWorld closedWorld) {
+    ast.Node node = getNodeOrNull(listLiteral);
+    if (node == null) {
+      assertNodeIsSynthetic(listLiteral);
+      return closedWorld.commonMasks.growableListType;
+    }
+    return _resultOf(owner).typeOfListLiteral(getNode(listLiteral)) ??
+        closedWorld.commonMasks.dynamicType;
   }
 
   TypeMask typeOfIterator(ir.ForInStatement forInStatement) {
@@ -221,50 +369,55 @@
     return _resultOf(_target).typeOfIteratorMoveNext(getNode(forInStatement));
   }
 
-  bool isJsIndexableIterator(ir.ForInStatement forInStatement) {
+  bool isJsIndexableIterator(
+      ir.ForInStatement forInStatement, ClosedWorld closedWorld) {
     TypeMask mask = typeOfIterator(forInStatement);
-    ClosedWorld closedWorld = _compiler.closedWorld;
     return mask != null &&
         mask.satisfies(_backend.helpers.jsIndexableClass, closedWorld) &&
         // String is indexable but not iterable.
         !mask.satisfies(_backend.helpers.jsStringClass, closedWorld);
   }
 
-  bool isFixedLength(TypeMask mask) {
-    ClosedWorld closedWorld = _compiler.closedWorld;
-    JavaScriptBackend backend = _compiler.backend;
+  bool isFixedLength(TypeMask mask, ClosedWorld closedWorld) {
     if (mask.isContainer && (mask as ContainerTypeMask).length != null) {
       // A container on which we have inferred the length.
       return true;
     }
     // TODO(sra): Recognize any combination of fixed length indexables.
-    if (mask.containsOnly(backend.helpers.jsFixedArrayClass) ||
-        mask.containsOnly(backend.helpers.jsUnmodifiableArrayClass) ||
+    if (mask.containsOnly(closedWorld.backendClasses.fixedListImplementation) ||
+        mask.containsOnly(closedWorld.backendClasses.constListImplementation) ||
         mask.containsOnlyString(closedWorld) ||
-        backend.isTypedArray(mask)) {
+        closedWorld.commonMasks.isTypedArray(mask)) {
       return true;
     }
     return false;
   }
 
   TypeMask inferredIndexType(ir.ForInStatement forInStatement) {
-    return TypeMaskFactory.inferredTypeForSelector(
-        new Selector.index(), typeOfIterator(forInStatement), _compiler);
+    return TypeMaskFactory.inferredTypeForSelector(new Selector.index(),
+        typeOfIterator(forInStatement), _globalInferenceResults);
   }
 
   TypeMask inferredTypeOf(ir.Member node) {
-    return TypeMaskFactory.inferredTypeForElement(getElement(node), _compiler);
+    return TypeMaskFactory.inferredTypeForElement(
+        getElement(node), _globalInferenceResults);
   }
 
   TypeMask selectorTypeOf(Selector selector, TypeMask mask) {
-    return TypeMaskFactory.inferredTypeForSelector(selector, mask, _compiler);
+    return TypeMaskFactory.inferredTypeForSelector(
+        selector, mask, _globalInferenceResults);
   }
 
-  TypeMask typeFromNativeBehavior(native.NativeBehavior nativeBehavior) {
-    return TypeMaskFactory.fromNativeBehavior(nativeBehavior, _compiler);
+  TypeMask typeFromNativeBehavior(
+      native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) {
+    return TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
   }
 
   ConstantValue getConstantFor(ir.Node node) {
+    // Some `null`s are not mapped when they correspond to errors, e.g. missing
+    // `const` initializers.
+    if (node is ir.NullLiteral) return new NullConstantValue();
+
     ConstantValue constantValue =
         _backend.constants.getConstantValueForNode(getNode(node), elements);
     assert(invariant(getNode(node), constantValue != null,
@@ -272,8 +425,21 @@
     return constantValue;
   }
 
+  ConstantValue getConstantForParameterDefaultValue(ir.Node defaultExpression) {
+    // TODO(27394): Evaluate constant expressions in ir.Node domain.
+    // In the interim, expand the Constantifier and do this:
+    //
+    //     ConstantExpression constantExpression =
+    //         defaultExpression.accept(new Constantifier(this));
+    //     assert(constantExpression != null);
+    ConstantExpression constantExpression =
+        kernel.parameterInitializerNodeToConstant[defaultExpression];
+    if (constantExpression == null) return null;
+    return _backend.constants.getConstantValue(constantExpression);
+  }
+
   ConstantValue getConstantForType(ir.DartType irType) {
-    DartType type = getDartType(irType);
+    ResolutionDartType type = getDartType(irType);
     return _backend.constantSystem.createType(_compiler, type.asRaw());
   }
 
@@ -286,10 +452,28 @@
     return _backend.isInterceptedSelector(selector);
   }
 
+  // Is the member a lazy initialized static or top-level member?
+  bool isLazyStatic(ir.Member member) {
+    if (member is ir.Field) {
+      FieldElement field = _nodeToElement[member];
+      return field.constant == null;
+    }
+    return false;
+  }
+
   LibraryElement get jsHelperLibrary => _backend.helpers.jsHelperLibrary;
 
-  JumpTarget getTargetDefinition(ir.Node node) =>
-      elements.getTargetDefinition(getNode(node));
+  KernelJumpTarget getJumpTarget(ir.TreeNode node,
+      {bool isContinueTarget: false}) {
+    return _jumpTargets.putIfAbsent(node, () {
+      if (node is ir.LabeledStatement &&
+          _jumpTargets.containsKey((node as ir.LabeledStatement).body)) {
+        return _jumpTargets[(node as ir.LabeledStatement).body];
+      }
+      return new KernelJumpTarget(node, this,
+          makeContinueLabel: isContinueTarget);
+    });
+  }
 
   ir.Class get mapLiteralClass =>
       kernel.classes[_backend.helpers.mapLiteralClass];
@@ -303,6 +487,34 @@
   ir.Procedure get mapLiteralUntypedEmptyMaker =>
       kernel.functions[_backend.helpers.mapLiteralUntypedEmptyMaker];
 
+  ir.Procedure get exceptionUnwrapper =>
+      kernel.functions[_backend.helpers.exceptionUnwrapper];
+
+  TypeMask get exceptionUnwrapperType =>
+      TypeMaskFactory.inferredReturnTypeForElement(
+          _backend.helpers.exceptionUnwrapper, _globalInferenceResults);
+
+  ir.Procedure get traceFromException =>
+      kernel.functions[_backend.helpers.traceFromException];
+
+  TypeMask get traceFromExceptionType =>
+      TypeMaskFactory.inferredReturnTypeForElement(
+          _backend.helpers.traceFromException, _globalInferenceResults);
+
+  ir.Procedure get streamIteratorConstructor =>
+      kernel.functions[_backend.helpers.streamIteratorConstructor];
+
+  TypeMask get streamIteratorConstructorType =>
+      TypeMaskFactory.inferredReturnTypeForElement(
+          _backend.helpers.streamIteratorConstructor, _globalInferenceResults);
+
+  ir.Procedure get fallThroughError =>
+      kernel.functions[_backend.helpers.fallThroughError];
+
+  TypeMask get fallThroughErrorType =>
+      TypeMaskFactory.inferredReturnTypeForElement(
+          _backend.helpers.fallThroughError, _globalInferenceResults);
+
   ir.Procedure get mapLiteralUntypedMaker =>
       kernel.functions[_backend.helpers.mapLiteralUntypedMaker];
 
@@ -313,21 +525,34 @@
 
   TypeMask get checkConcurrentModificationErrorReturnType =>
       TypeMaskFactory.inferredReturnTypeForElement(
-          _backend.helpers.checkConcurrentModificationError, _compiler);
+          _backend.helpers.checkConcurrentModificationError,
+          _globalInferenceResults);
+
+  ir.Procedure get checkSubtype =>
+      kernel.functions[_backend.helpers.checkSubtype];
+
+  ir.Procedure get checkSubtypeOfRuntimeType =>
+      kernel.functions[_backend.helpers.checkSubtypeOfRuntimeType];
+
+  ir.Procedure get throwTypeError =>
+      kernel.functions[_backend.helpers.throwTypeError];
+
+  TypeMask get throwTypeErrorType =>
+      TypeMaskFactory.inferredReturnTypeForElement(
+          _backend.helpers.throwTypeError, _globalInferenceResults);
 
   ir.Procedure get assertHelper =>
       kernel.functions[_backend.helpers.assertHelper];
 
-  TypeMask get throwTypeErrorType => TypeMaskFactory
-      .inferredReturnTypeForElement(_backend.helpers.throwTypeError, _compiler);
-
-  TypeMask get assertHelperReturnType => TypeMaskFactory
-      .inferredReturnTypeForElement(_backend.helpers.assertHelper, _compiler);
+  TypeMask get assertHelperReturnType =>
+      TypeMaskFactory.inferredReturnTypeForElement(
+          _backend.helpers.assertHelper, _globalInferenceResults);
 
   ir.Procedure get assertTest => kernel.functions[_backend.helpers.assertTest];
 
-  TypeMask get assertTestReturnType => TypeMaskFactory
-      .inferredReturnTypeForElement(_backend.helpers.assertTest, _compiler);
+  TypeMask get assertTestReturnType =>
+      TypeMaskFactory.inferredReturnTypeForElement(
+          _backend.helpers.assertTest, _globalInferenceResults);
 
   ir.Procedure get assertThrow =>
       kernel.functions[_backend.helpers.assertThrow];
@@ -335,14 +560,35 @@
   ir.Procedure get setRuntimeTypeInfo =>
       kernel.functions[_backend.helpers.setRuntimeTypeInfo];
 
-  TypeMask get assertThrowReturnType => TypeMaskFactory
-      .inferredReturnTypeForElement(_backend.helpers.assertThrow, _compiler);
+  TypeMask get assertThrowReturnType =>
+      TypeMaskFactory.inferredReturnTypeForElement(
+          _backend.helpers.assertThrow, _globalInferenceResults);
 
-  ir.Class get objectClass => kernel.classes[_compiler.coreClasses.objectClass];
+  ir.Procedure get runtimeTypeToString =>
+      kernel.functions[_backend.helpers.runtimeTypeToString];
+
+  ir.Procedure get createRuntimeType =>
+      kernel.functions[_backend.helpers.createRuntimeType];
+
+  TypeMask get createRuntimeTypeReturnType =>
+      TypeMaskFactory.inferredReturnTypeForElement(
+          _backend.helpers.createRuntimeType, _globalInferenceResults);
+
+  ir.Class get objectClass =>
+      kernel.classes[_compiler.commonElements.objectClass];
+
+  ir.Class get futureClass =>
+      kernel.classes[_compiler.commonElements.futureClass];
+
+  TypeMask makeSubtypeOfObject(ClosedWorld closedWorld) =>
+      new TypeMask.subclass(_compiler.commonElements.objectClass, closedWorld);
 
   ir.Procedure get currentIsolate =>
       kernel.functions[_backend.helpers.currentIsolate];
 
+  ir.Procedure get callInIsolate =>
+      kernel.functions[_backend.helpers.callInIsolate];
+
   bool isInForeignLibrary(ir.Member member) =>
       _backend.isForeign(getElement(member));
 
@@ -379,23 +625,44 @@
     return null;
   }
 
-  DartType getDartType(ir.DartType type) {
-    return type.accept(_typeConverter);
+  ResolutionDartType getDartType(ir.DartType type) {
+    return _typeConverter.convert(type);
   }
 
-  List<DartType> getDartTypes(List<ir.DartType> types) {
+  ResolutionDartType getDartTypeIfValid(ir.DartType type) {
+    if (type is ir.InvalidType) return null;
+    return _typeConverter.convert(type);
+  }
+
+  List<ResolutionDartType> getDartTypes(List<ir.DartType> types) {
     return types.map(getDartType).toList();
   }
 
-  DartType getFunctionReturnType(ir.FunctionNode node) {
+  ResolutionInterfaceType getDartTypeOfListLiteral(ir.ListLiteral list) {
+    ast.Node node = getNodeOrNull(list);
+    if (node != null) return elements.getType(node);
+    assertNodeIsSynthetic(list);
+    return _compiler.commonElements.listType(getDartType(list.typeArgument));
+  }
+
+  ResolutionInterfaceType getDartTypeOfMapLiteral(ir.MapLiteral literal) {
+    ast.Node node = getNodeOrNull(literal);
+    if (node != null) return elements.getType(node);
+    assertNodeIsSynthetic(literal);
+    return _compiler.commonElements
+        .mapType(getDartType(literal.keyType), getDartType(literal.valueType));
+  }
+
+  ResolutionDartType getFunctionReturnType(ir.FunctionNode node) {
+    if (node.returnType is ir.InvalidType) return const ResolutionDynamicType();
     return getDartType(node.returnType);
   }
 
   /// Computes the function type corresponding the signature of [node].
-  FunctionType getFunctionType(ir.FunctionNode node) {
-    DartType returnType = getFunctionReturnType(node);
-    List<DartType> parameterTypes = <DartType>[];
-    List<DartType> optionalParameterTypes = <DartType>[];
+  ResolutionFunctionType getFunctionType(ir.FunctionNode node) {
+    ResolutionDartType returnType = getFunctionReturnType(node);
+    List<ResolutionDartType> parameterTypes = <ResolutionDartType>[];
+    List<ResolutionDartType> optionalParameterTypes = <ResolutionDartType>[];
     for (ir.VariableDeclaration variable in node.positionalParameters) {
       if (parameterTypes.length == node.requiredParameterCount) {
         optionalParameterTypes.add(getDartType(variable.type));
@@ -404,17 +671,26 @@
       }
     }
     List<String> namedParameters = <String>[];
-    List<DartType> namedParameterTypes = <DartType>[];
+    List<ResolutionDartType> namedParameterTypes = <ResolutionDartType>[];
     List<ir.VariableDeclaration> sortedNamedParameters =
         node.namedParameters.toList()..sort((a, b) => a.name.compareTo(b.name));
     for (ir.VariableDeclaration variable in sortedNamedParameters) {
       namedParameters.add(variable.name);
       namedParameterTypes.add(getDartType(variable.type));
     }
-    return new FunctionType.synthesized(returnType, parameterTypes,
+    return new ResolutionFunctionType.synthesized(returnType, parameterTypes,
         optionalParameterTypes, namedParameters, namedParameterTypes);
   }
 
+  ResolutionInterfaceType getInterfaceType(ir.InterfaceType type) =>
+      getDartType(type);
+
+  ResolutionInterfaceType createInterfaceType(
+      ir.Class cls, List<ir.DartType> typeArguments) {
+    return new ResolutionInterfaceType(
+        getClass(cls), getDartTypes(typeArguments));
+  }
+
   /// Converts [annotations] into a list of [ConstantExpression]s.
   List<ConstantExpression> getMetadata(List<ir.Expression> annotations) {
     List<ConstantExpression> metadata = <ConstantExpression>[];
@@ -452,12 +728,12 @@
   }
 
   /// Looks up [typeName] for use in the spec-string of a `JS` called.
-  // TODO(johnniwinther): Use this in [native.NativeBehavior] instead of calling the
-  // `ForeignResolver`.
+  // TODO(johnniwinther): Use this in [native.NativeBehavior] instead of calling
+  // the `ForeignResolver`.
   // TODO(johnniwinther): Cache the result to avoid redundant lookups?
   native.TypeLookup _typeLookup({bool resolveAsRaw: true}) {
     return (String typeName) {
-      DartType findIn(Uri uri) {
+      ResolutionDartType findIn(Uri uri) {
         LibraryElement library = _compiler.libraryLoader.lookupLibrary(uri);
         if (library != null) {
           Element element = library.find(typeName);
@@ -470,7 +746,7 @@
         return null;
       }
 
-      DartType type = findIn(Uris.dart_core);
+      ResolutionDartType type = findIn(Uris.dart_core);
       type ??= findIn(BackendHelpers.DART_JS_HELPER);
       type ??= findIn(BackendHelpers.DART_INTERCEPTORS);
       type ??= findIn(BackendHelpers.DART_ISOLATE_HELPER);
@@ -516,10 +792,11 @@
         _typeLookup(resolveAsRaw: true),
         CURRENT_ELEMENT_SPANNABLE,
         reporter,
-        _compiler.coreTypes);
+        _compiler.commonElements);
   }
 
-  /// Computes the [native.NativeBehavior] for a call to the [JS_BUILTIN] function.
+  /// Computes the [native.NativeBehavior] for a call to the [JS_BUILTIN]
+  /// function.
   // TODO(johnniwinther): Cache this for later use.
   native.NativeBehavior getNativeBehaviorForJsBuiltinCall(
       ir.StaticInvocation node) {
@@ -544,11 +821,11 @@
         _typeLookup(resolveAsRaw: true),
         CURRENT_ELEMENT_SPANNABLE,
         reporter,
-        _compiler.coreTypes);
+        _compiler.commonElements);
   }
 
-  /// Computes the [native.NativeBehavior] for a call to the [JS_EMBEDDED_GLOBAL]
-  /// function.
+  /// Computes the [native.NativeBehavior] for a call to the
+  /// [JS_EMBEDDED_GLOBAL] function.
   // TODO(johnniwinther): Cache this for later use.
   native.NativeBehavior getNativeBehaviorForJsEmbeddedGlobalCall(
       ir.StaticInvocation node) {
@@ -579,12 +856,27 @@
         _typeLookup(resolveAsRaw: true),
         CURRENT_ELEMENT_SPANNABLE,
         reporter,
-        _compiler.coreTypes);
+        _compiler.commonElements);
+  }
+
+  /// Computes the [InterfaceType] referenced by a call to the
+  /// [JS_INTERCEPTOR_CONSTANT] function, if any.
+  InterfaceType getInterfaceTypeForJsInterceptorCall(ir.StaticInvocation node) {
+    if (node.arguments.positional.length != 1 ||
+        node.arguments.named.isNotEmpty) {
+      reporter.reportErrorMessage(CURRENT_ELEMENT_SPANNABLE,
+          MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
+    }
+    ir.Node argument = node.arguments.positional.first;
+    if (argument is ir.TypeLiteral && argument.type is ir.InterfaceType) {
+      return getInterfaceType(argument.type);
+    }
+    return null;
   }
 
   /// Returns `true` is [node] has a `@Native(...)` annotation.
   // TODO(johnniwinther): Cache this for later use.
-  bool isNative(ir.Class node) {
+  bool isNativeClass(ir.Class node) {
     for (ir.Expression annotation in node.annotations) {
       if (annotation is ir.ConstructorInvocation) {
         ConstructorElement target = getElement(annotation.target).declaration;
@@ -600,7 +892,7 @@
   /// Computes the native behavior for reading the native [field].
   // TODO(johnniwinther): Cache this for later use.
   native.NativeBehavior getNativeBehaviorForFieldLoad(ir.Field field) {
-    DartType type = getDartType(field.type);
+    ResolutionDartType type = getDartType(field.type);
     List<ConstantExpression> metadata = getMetadata(field.annotations);
     return native.NativeBehavior.ofFieldLoad(CURRENT_ELEMENT_SPANNABLE, type,
         metadata, _typeLookup(resolveAsRaw: false), _compiler,
@@ -610,19 +902,27 @@
   /// Computes the native behavior for writing to the native [field].
   // TODO(johnniwinther): Cache this for later use.
   native.NativeBehavior getNativeBehaviorForFieldStore(ir.Field field) {
-    DartType type = getDartType(field.type);
+    ResolutionDartType type = getDartType(field.type);
     return native.NativeBehavior.ofFieldStore(type, _compiler.resolution);
   }
 
   /// Computes the native behavior for calling [procedure].
   // TODO(johnniwinther): Cache this for later use.
   native.NativeBehavior getNativeBehaviorForMethod(ir.Procedure procedure) {
-    DartType type = getFunctionType(procedure.function);
+    ResolutionDartType type = getFunctionType(procedure.function);
     List<ConstantExpression> metadata = getMetadata(procedure.annotations);
     return native.NativeBehavior.ofMethod(CURRENT_ELEMENT_SPANNABLE, type,
         metadata, _typeLookup(resolveAsRaw: false), _compiler,
         isJsInterop: false);
   }
+
+  MemberEntity getConstructorBodyEntity(ir.Constructor constructor) {
+    AstElement element = getElement(constructor);
+    MemberEntity constructorBody =
+        ConstructorBodyElementX.createFromResolvedAst(element.resolvedAst);
+    assert(constructorBody != null);
+    return constructorBody;
+  }
 }
 
 /// Kinds of foreign functions.
@@ -634,21 +934,32 @@
   NONE,
 }
 
-/// Visitor that converts kernel dart types into [DartType].
-class DartTypeConverter extends ir.DartTypeVisitor<DartType> {
+/// Visitor that converts kernel dart types into [ResolutionDartType].
+class DartTypeConverter extends ir.DartTypeVisitor<ResolutionDartType> {
   final KernelAstAdapter astAdapter;
+  bool topLevel = true;
 
   DartTypeConverter(this.astAdapter);
 
-  DartType visitType(ir.DartType type) => type.accept(this);
+  ResolutionDartType convert(ir.DartType type) {
+    topLevel = true;
+    return type.accept(this);
+  }
 
-  List<DartType> visitTypes(List<ir.DartType> types) {
+  /// Visit a inner type.
+  ResolutionDartType visitType(ir.DartType type) {
+    topLevel = false;
+    return type.accept(this);
+  }
+
+  List<ResolutionDartType> visitTypes(List<ir.DartType> types) {
+    topLevel = false;
     return new List.generate(
         types.length, (int index) => types[index].accept(this));
   }
 
   @override
-  DartType visitTypeParameterType(ir.TypeParameterType node) {
+  ResolutionDartType visitTypeParameterType(ir.TypeParameterType node) {
     if (node.parameter.parent is ir.Class) {
       ir.Class cls = node.parameter.parent;
       int index = cls.typeParameters.indexOf(node.parameter);
@@ -657,16 +968,21 @@
     } else if (node.parameter.parent is ir.FunctionNode) {
       ir.FunctionNode func = node.parameter.parent;
       int index = func.typeParameters.indexOf(node.parameter);
-      ConstructorElement constructorElement = astAdapter.getElement(func);
-      ClassElement classElement = constructorElement.enclosingClass;
-      return classElement.typeVariables[index];
+      Element element = astAdapter.getElement(func);
+      if (element.isConstructor) {
+        ClassElement classElement = element.enclosingClass;
+        return classElement.typeVariables[index];
+      } else {
+        GenericElement genericElement = element;
+        return genericElement.typeVariables[index];
+      }
     }
     throw new UnsupportedError('Unsupported type parameter type node $node.');
   }
 
   @override
-  DartType visitFunctionType(ir.FunctionType node) {
-    return new FunctionType.synthesized(
+  ResolutionDartType visitFunctionType(ir.FunctionType node) {
+    return new ResolutionFunctionType.synthesized(
         visitType(node.returnType),
         visitTypes(node.positionalParameters
             .take(node.requiredParameterCount)
@@ -679,24 +995,29 @@
   }
 
   @override
-  DartType visitInterfaceType(ir.InterfaceType node) {
+  ResolutionDartType visitInterfaceType(ir.InterfaceType node) {
     ClassElement cls = astAdapter.getElement(node.classNode);
-    return new InterfaceType(cls, visitTypes(node.typeArguments));
+    return new ResolutionInterfaceType(cls, visitTypes(node.typeArguments));
   }
 
   @override
-  DartType visitVoidType(ir.VoidType node) {
-    return const VoidType();
+  ResolutionDartType visitVoidType(ir.VoidType node) {
+    return const ResolutionVoidType();
   }
 
   @override
-  DartType visitDynamicType(ir.DynamicType node) {
-    return const DynamicType();
+  ResolutionDartType visitDynamicType(ir.DynamicType node) {
+    return const ResolutionDynamicType();
   }
 
   @override
-  DartType visitInvalidType(ir.InvalidType node) {
-    throw new UnimplementedError("Invalid types not currently supported");
+  ResolutionDartType visitInvalidType(ir.InvalidType node) {
+    if (topLevel) {
+      throw new UnimplementedError(
+          "Outermost invalid types not currently supported");
+    }
+    // Nested invalid types are treated as `dynamic`.
+    return const ResolutionDynamicType();
   }
 }
 
@@ -729,7 +1050,7 @@
   ConstantExpression visitConstructorInvocation(ir.ConstructorInvocation node) {
     ConstructorElement constructor =
         astAdapter.getElement(node.target).declaration;
-    List<DartType> typeArguments = <DartType>[];
+    List<ResolutionDartType> typeArguments = <ResolutionDartType>[];
     for (ir.DartType type in node.arguments.types) {
       typeArguments.add(astAdapter.getDartType(type));
     }
@@ -771,3 +1092,117 @@
     return new StringConstantExpression(node.value);
   }
 }
+
+class KernelJumpTarget extends JumpTarget {
+  static int index = 0;
+
+  /// Pointer to the actual executable statements that a jump target refers to.
+  /// If this jump target was not initially constructed with a LabeledStatement,
+  /// this value is identical to originalStatement.
+  // TODO(efortuna): In an ideal world the Node should be some common
+  // interface we create for both ir.Statements and ir.SwitchCase (the
+  // ContinueSwitchStatement's target is a SwitchCase) rather than general
+  // Node. Talking to Asger about this.
+  ir.Node targetStatement;
+
+  /// The original statement used to construct this jump target.
+  /// If this jump target was not initially constructed with a LabeledStatement,
+  /// this value is identical to targetStatement.
+  ir.Node originalStatement;
+
+  @override
+  bool isBreakTarget = false;
+
+  @override
+  bool isContinueTarget = false;
+
+  KernelJumpTarget(this.targetStatement, KernelAstAdapter adapter,
+      {bool makeContinueLabel = false}) {
+    originalStatement = targetStatement;
+    this.labels = <LabelDefinition>[];
+    if (targetStatement is ir.WhileStatement ||
+        targetStatement is ir.DoStatement ||
+        targetStatement is ir.ForStatement ||
+        targetStatement is ir.ForInStatement) {
+      // Currently these labels are set at resolution on the element itself.
+      // Once that gets updated, this logic can change downstream.
+      JumpTarget target = adapter.elements
+          .getTargetDefinition(adapter.getNode(targetStatement));
+      if (target != null) {
+        labels.addAll(target.labels);
+        isBreakTarget = target.isBreakTarget;
+        isContinueTarget = target.isContinueTarget;
+      }
+    } else if (targetStatement is ir.LabeledStatement) {
+      targetStatement = (targetStatement as ir.LabeledStatement).body;
+      labels.add(
+          new LabelDefinitionX(null, 'L${index++}', this)..setBreakTarget());
+      isBreakTarget = true;
+    }
+
+    if (makeContinueLabel) {
+      labels.add(
+          new LabelDefinitionX(null, 'L${index++}', this)..setContinueTarget());
+      isContinueTarget = true;
+    }
+  }
+
+  @override
+  LabelDefinition addLabel(ast.Label label, String labelName) {
+    LabelDefinition result = new LabelDefinitionX(label, labelName, this);
+    labels.add(result);
+    return result;
+  }
+
+  @override
+  ExecutableElement get executableContext => null;
+
+  @override
+  bool get isSwitch => targetStatement is ir.SwitchStatement;
+
+  @override
+  bool get isTarget => isBreakTarget || isContinueTarget;
+
+  @override
+  List<LabelDefinition> labels;
+
+  @override
+  String get name => 'target';
+
+  // TODO(efortuna): In the original version, this nesting level is specified at
+  // jump target construction time, by the resolver. Because these are
+  // instantiated later, we don't have that information. When we move fully over
+  // to the kernel model, we can pass the nesting level in KernelJumpTarget's
+  // constructor.
+  @override
+  int get nestingLevel => 0;
+
+  @override
+  ast.Node get statement => null;
+
+  String toString() => 'Target:$targetStatement';
+}
+
+/// Special [JumpHandler] implementation used to handle continue statements
+/// targeting switch cases.
+class KernelSwitchCaseJumpHandler extends SwitchCaseJumpHandler {
+  KernelSwitchCaseJumpHandler(GraphBuilder builder, JumpTarget target,
+      ir.SwitchStatement switchStatement, KernelAstAdapter astAdapter)
+      : super(builder, target) {
+    // The switch case indices must match those computed in
+    // [KernelSsaBuilder.buildSwitchCaseConstants].
+    // Switch indices are 1-based so we can bypass the synthetic loop when no
+    // cases match simply by branching on the index (which defaults to null).
+    // TODO
+    int switchIndex = 1;
+    for (ir.SwitchCase switchCase in switchStatement.cases) {
+      JumpTarget continueTarget =
+          astAdapter.getJumpTarget(switchCase, isContinueTarget: true);
+      assert(continueTarget is KernelJumpTarget);
+      targetIndexMap[continueTarget] = switchIndex;
+      assert(builder.jumpTargets[continueTarget] == null);
+      builder.jumpTargets[continueTarget] = this;
+      switchIndex++;
+    }
+  }
+}
diff --git a/pkg/compiler/lib/src/ssa/kernel_impact.dart b/pkg/compiler/lib/src/ssa/kernel_impact.dart
index 155c10e..54d2686 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -8,12 +8,13 @@
 import '../common/names.dart';
 import '../compiler.dart';
 import '../constants/expressions.dart';
-import '../dart_types.dart';
-import '../elements/elements.dart';
+import '../core_types.dart';
+import '../elements/types.dart';
+import '../elements/elements.dart' show AstElement, ResolvedAst;
+import '../elements/entities.dart';
 import '../js_backend/backend.dart' show JavaScriptBackend;
 import '../kernel/kernel.dart';
 import '../kernel/kernel_debug.dart';
-import '../kernel/kernel_visitor.dart';
 import '../resolution/registry.dart' show ResolutionWorldImpactBuilder;
 import '../universe/call_structure.dart';
 import '../universe/feature.dart';
@@ -29,8 +30,10 @@
   return compiler.reporter.withCurrentElement(element.implementation, () {
     JavaScriptBackend backend = compiler.backend;
     Kernel kernel = backend.kernelTask.kernel;
-    KernelImpactBuilder builder =
-        new KernelImpactBuilder(resolvedAst, compiler, kernel);
+    KernelAstAdapter astAdapter = new KernelAstAdapter(kernel, compiler.backend,
+        resolvedAst, kernel.nodeToAst, kernel.nodeToElement);
+    KernelImpactBuilder builder = new KernelImpactBuilder(
+        '${resolvedAst.element}', astAdapter, compiler.commonElements);
     if (element.isFunction ||
         element.isGetter ||
         element.isSetter ||
@@ -62,20 +65,12 @@
 }
 
 class KernelImpactBuilder extends ir.Visitor {
-  final ResolvedAst resolvedAst;
-  final Compiler compiler;
+  final ResolutionWorldImpactBuilder impactBuilder;
+  final KernelWorldBuilder astAdapter;
+  final CommonElements commonElements;
 
-  JavaScriptBackend get backend => compiler.backend;
-
-  ResolutionWorldImpactBuilder impactBuilder;
-  KernelAstAdapter astAdapter;
-
-  KernelImpactBuilder(this.resolvedAst, this.compiler, Kernel kernel) {
-    this.impactBuilder =
-        new ResolutionWorldImpactBuilder('${resolvedAst.element}');
-    this.astAdapter = new KernelAstAdapter(kernel, compiler.backend,
-        resolvedAst, kernel.nodeToAst, kernel.nodeToElement);
-  }
+  KernelImpactBuilder(String name, this.astAdapter, this.commonElements)
+      : this.impactBuilder = new ResolutionWorldImpactBuilder(name);
 
   /// Add a checked-mode type use of [type] if it is not `dynamic`.
   DartType checkType(ir.DartType irType) {
@@ -113,7 +108,8 @@
         impactBuilder.registerFeature(Feature.LAZY_FIELD);
       }
     }
-    if (field.isInstanceMember && astAdapter.isNative(field.enclosingClass)) {
+    if (field.isInstanceMember &&
+        astAdapter.isNativeClass(field.enclosingClass)) {
       impactBuilder
           .registerNativeData(astAdapter.getNativeBehaviorForFieldLoad(field));
       impactBuilder
@@ -145,7 +141,7 @@
         impactBuilder.registerFeature(Feature.ASYNC_STAR);
         break;
       case ir.AsyncMarker.SyncYielding:
-        compiler.reporter.internalError(resolvedAst.element,
+        throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE,
             "Unexpected async marker: ${procedure.function.asyncMarker}");
     }
     if (procedure.isExternal &&
@@ -222,7 +218,7 @@
     DartType elementType = checkType(literal.typeArgument);
 
     impactBuilder.registerListLiteral(new ListLiteralUse(
-        compiler.coreTypes.listType(elementType),
+        commonElements.listType(elementType),
         isConstant: literal.isConst,
         isEmpty: literal.expressions.isEmpty));
   }
@@ -233,7 +229,7 @@
     DartType keyType = checkType(literal.keyType);
     DartType valueType = checkType(literal.valueType);
     impactBuilder.registerMapLiteral(new MapLiteralUse(
-        compiler.coreTypes.mapType(keyType, valueType),
+        commonElements.mapType(keyType, valueType),
         isConstant: literal.isConst,
         isEmpty: literal.entries.isEmpty));
   }
@@ -256,23 +252,22 @@
   void handleNew(ir.InvocationExpression node, ir.Member target,
       {bool isConst: false}) {
     _visitArguments(node.arguments);
-    Element element = astAdapter.getElement(target).declaration;
-    ClassElement cls = astAdapter.getElement(target.enclosingClass);
-    List<DartType> typeArguments =
-        astAdapter.getDartTypes(node.arguments.types);
-    InterfaceType type = new InterfaceType(cls, typeArguments);
+    FunctionEntity constructor = astAdapter.getConstructor(target);
+    InterfaceType type = astAdapter.createInterfaceType(
+        target.enclosingClass, node.arguments.types);
     CallStructure callStructure = astAdapter.getCallStructure(node.arguments);
     impactBuilder.registerStaticUse(isConst
-        ? new StaticUse.constConstructorInvoke(element, callStructure, type)
-        : new StaticUse.typedConstructorInvoke(element, callStructure, type));
-    if (typeArguments.any((DartType type) => !type.isDynamic)) {
+        ? new StaticUse.constConstructorInvoke(constructor, callStructure, type)
+        : new StaticUse.typedConstructorInvoke(
+            constructor, callStructure, type));
+    if (type.typeArguments.any((DartType type) => !type.isDynamic)) {
       impactBuilder.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK);
     }
   }
 
   @override
   void visitSuperInitializer(ir.SuperInitializer node) {
-    Element target = astAdapter.getElement(node.target).declaration;
+    FunctionEntity target = astAdapter.getConstructor(node.target);
     _visitArguments(node.arguments);
     impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke(
         target, astAdapter.getCallStructure(node.arguments)));
@@ -280,8 +275,8 @@
 
   @override
   void visitStaticInvocation(ir.StaticInvocation node) {
-    Element target = astAdapter.getElement(node.target).declaration;
-    if (target.isFactoryConstructor) {
+    FunctionEntity target = astAdapter.getMethod(node.target);
+    if (node.target.kind == ir.ProcedureKind.Factory) {
       // TODO(johnniwinther): We should not mark the type as instantiated but
       // rather follow the type arguments directly.
       //
@@ -324,15 +319,10 @@
             astAdapter.getNativeBehaviorForJsEmbeddedGlobalCall(node));
         break;
       case ForeignKind.JS_INTERCEPTOR_CONSTANT:
-        if (node.arguments.positional.length != 1 ||
-            node.arguments.named.isNotEmpty) {
-          astAdapter.reporter.reportErrorMessage(CURRENT_ELEMENT_SPANNABLE,
-              MessageKind.WRONG_ARGUMENT_FOR_JS_INTERCEPTOR_CONSTANT);
-        }
-        ir.Node argument = node.arguments.positional.first;
-        if (argument is ir.TypeLiteral && argument.type is ir.InterfaceType) {
-          impactBuilder.registerTypeUse(
-              new TypeUse.instantiation(astAdapter.getDartType(argument.type)));
+        InterfaceType type =
+            astAdapter.getInterfaceTypeForJsInterceptorCall(node);
+        if (type != null) {
+          impactBuilder.registerTypeUse(new TypeUse.instantiation(type));
         }
         break;
       case ForeignKind.NONE:
@@ -343,26 +333,27 @@
   @override
   void visitStaticGet(ir.StaticGet node) {
     ir.Member target = node.target;
-    Element element = astAdapter.getElement(target).declaration;
     if (target is ir.Procedure && target.kind == ir.ProcedureKind.Method) {
-      impactBuilder.registerStaticUse(new StaticUse.staticTearOff(element));
+      FunctionEntity method = astAdapter.getMethod(target);
+      impactBuilder.registerStaticUse(new StaticUse.staticTearOff(method));
     } else {
-      impactBuilder.registerStaticUse(new StaticUse.staticGet(element));
+      MemberEntity member = astAdapter.getMember(target);
+      impactBuilder.registerStaticUse(new StaticUse.staticGet(member));
     }
   }
 
   @override
   void visitStaticSet(ir.StaticSet node) {
     visitNode(node.value);
-    Element element = astAdapter.getElement(node.target).declaration;
-    impactBuilder.registerStaticUse(new StaticUse.staticSet(element));
+    MemberEntity member = astAdapter.getMember(node.target);
+    impactBuilder.registerStaticUse(new StaticUse.staticSet(member));
   }
 
   void handleSuperInvocation(ir.Node target, ir.Node arguments) {
-    Element element = astAdapter.getElement(target).declaration;
+    FunctionEntity method = astAdapter.getMethod(target);
     _visitArguments(arguments);
     impactBuilder.registerStaticUse(new StaticUse.superInvoke(
-        element, astAdapter.getCallStructure(arguments)));
+        method, astAdapter.getCallStructure(arguments)));
   }
 
   @override
@@ -378,16 +369,17 @@
   }
 
   void handleSuperGet(ir.Member target) {
-    Element element = astAdapter.getElement(target).declaration;
     if (target is ir.Procedure && target.kind == ir.ProcedureKind.Method) {
-      impactBuilder.registerStaticUse(new StaticUse.superTearOff(element));
+      FunctionEntity method = astAdapter.getMethod(target);
+      impactBuilder.registerStaticUse(new StaticUse.superTearOff(method));
     } else {
-      impactBuilder.registerStaticUse(new StaticUse.superGet(element));
+      MemberEntity member = astAdapter.getMember(target);
+      impactBuilder.registerStaticUse(new StaticUse.superGet(member));
     }
   }
 
   @override
-  void visitDirectGet(ir.StaticGet node) {
+  void visitDirectPropertyGet(ir.DirectPropertyGet node) {
     handleSuperGet(node.target);
   }
 
@@ -398,11 +390,12 @@
 
   void handleSuperSet(ir.Node target, ir.Node value) {
     visitNode(value);
-    Element element = astAdapter.getElement(target).declaration;
     if (target is ir.Field) {
-      impactBuilder.registerStaticUse(new StaticUse.superFieldSet(element));
+      FieldEntity field = astAdapter.getField(target);
+      impactBuilder.registerStaticUse(new StaticUse.superFieldSet(field));
     } else {
-      impactBuilder.registerStaticUse(new StaticUse.superSetterSet(element));
+      FunctionEntity method = astAdapter.getMethod(target);
+      impactBuilder.registerStaticUse(new StaticUse.superSetterSet(method));
     }
   }
 
@@ -463,16 +456,16 @@
 
   @override
   void visitFunctionDeclaration(ir.FunctionDeclaration node) {
-    impactBuilder
-        .registerStaticUse(new StaticUse.closure(astAdapter.getElement(node)));
+    impactBuilder.registerStaticUse(
+        new StaticUse.closure(astAdapter.getLocalFunction(node)));
     handleSignature(node.function);
     visitNode(node.function.body);
   }
 
   @override
   void visitFunctionExpression(ir.FunctionExpression node) {
-    impactBuilder
-        .registerStaticUse(new StaticUse.closure(astAdapter.getElement(node)));
+    impactBuilder.registerStaticUse(
+        new StaticUse.closure(astAdapter.getLocalFunction(node)));
     handleSignature(node.function);
     visitNode(node.function.body);
   }
@@ -557,14 +550,14 @@
   @override
   void visitFieldInitializer(ir.FieldInitializer node) {
     impactBuilder.registerStaticUse(
-        new StaticUse.fieldInit(astAdapter.getElement(node.field)));
+        new StaticUse.fieldInit(astAdapter.getField(node.field)));
     visitNode(node.value);
   }
 
   @override
   void visitRedirectingInitializer(ir.RedirectingInitializer node) {
     _visitArguments(node.arguments);
-    Element target = astAdapter.getElement(node.target).declaration;
+    FunctionEntity target = astAdapter.getConstructor(node.target);
     impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke(
         target, astAdapter.getCallStructure(node.arguments)));
   }
diff --git a/pkg/compiler/lib/src/ssa/kernel_string_builder.dart b/pkg/compiler/lib/src/ssa/kernel_string_builder.dart
index 38a3f63..ddef20a 100644
--- a/pkg/compiler/lib/src/ssa/kernel_string_builder.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_string_builder.dart
@@ -38,7 +38,7 @@
     //      conversions.
     //   2. The value can be primitive, because the library stringifier has
     //      fast-path code for most primitives.
-    if (expression.canBePrimitive(compiler)) {
+    if (expression.canBePrimitive(builder.closedWorld)) {
       append(stringify(expression));
       return;
     }
@@ -62,14 +62,14 @@
 
   HInstruction concat(HInstruction left, HInstruction right) {
     HInstruction instruction =
-        new HStringConcat(left, right, builder.backend.stringType);
+        new HStringConcat(left, right, builder.commonMasks.stringType);
     builder.add(instruction);
     return instruction;
   }
 
   HInstruction stringify(HInstruction expression) {
     HInstruction instruction =
-        new HStringify(expression, builder.backend.stringType);
+        new HStringify(expression, builder.commonMasks.stringType);
     builder.add(instruction);
     return instruction;
   }
diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart
index 0eca03a..70d9522 100644
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart
@@ -5,7 +5,7 @@
 import '../closure.dart';
 import '../common.dart';
 import '../compiler.dart' show Compiler;
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../io/source_information.dart';
 import '../js/js.dart' as js;
@@ -35,8 +35,8 @@
       new Map<Local, CapturedVariable>();
   final GraphBuilder builder;
   ClosureClassMap closureData;
-  Map<TypeVariableType, TypeVariableLocal> typeVariableLocals =
-      new Map<TypeVariableType, TypeVariableLocal>();
+  Map<ResolutionTypeVariableType, TypeVariableLocal> typeVariableLocals =
+      new Map<ResolutionTypeVariableType, TypeVariableLocal>();
   final ExecutableElement executableContext;
 
   /// The class that defines the current type environment or null if no type
@@ -59,20 +59,27 @@
   /// [instanceType] is not used if it contains type variables, since these
   /// might not be in scope or from the current instance.
   ///
-  final InterfaceType instanceType;
+  final ResolutionInterfaceType instanceType;
 
   final Compiler _compiler;
 
   LocalsHandler(this.builder, this.executableContext,
-      InterfaceType instanceType, this._compiler)
+      ResolutionInterfaceType instanceType, this._compiler)
       : this.instanceType =
             instanceType == null || instanceType.containsTypeVariables
                 ? null
                 : instanceType;
 
+  ClosedWorld get closedWorld => builder.closedWorld;
+
+  CommonMasks get commonMasks => closedWorld.commonMasks;
+
+  GlobalTypeInferenceResults get _globalInferenceResults =>
+      _compiler.globalInference.results;
+
   /// Substituted type variables occurring in [type] into the context of
   /// [contextClass].
-  DartType substInContext(DartType type) {
+  ResolutionDartType substInContext(ResolutionDartType type) {
     if (contextClass != null) {
       ClassElement typeContext = Types.getClassContext(type);
       if (typeContext != null) {
@@ -111,9 +118,8 @@
   HInstruction createBox() {
     // TODO(floitsch): Clean up this hack. Should we create a box-object by
     // just creating an empty object literal?
-    JavaScriptBackend backend = _compiler.backend;
     HInstruction box = new HForeignCode(
-        js.js.parseForeignJS('{}'), backend.nonNullType, <HInstruction>[],
+        js.js.parseForeignJS('{}'), commonMasks.nonNullType, <HInstruction>[],
         nativeBehavior: native.NativeBehavior.PURE_ALLOCATION);
     builder.add(box);
     return box;
@@ -131,8 +137,7 @@
     if (element != null && element.isGenerativeConstructorBody) {
       // The box is passed as a parameter to a generative
       // constructor body.
-      JavaScriptBackend backend = _compiler.backend;
-      box = builder.addParameter(scopeData.boxElement, backend.nonNullType);
+      box = builder.addParameter(scopeData.boxElement, commonMasks.nonNullType);
     } else {
       box = createBox();
     }
@@ -204,7 +209,7 @@
         HInstruction parameter = builder.addParameter(
             parameterElement,
             TypeMaskFactory.inferredTypeForElement(
-                parameterElement, _compiler));
+                parameterElement, _globalInferenceResults));
         builder.parameters[parameterElement] = parameter;
         directLocals[parameterElement] = parameter;
       });
@@ -222,7 +227,7 @@
     if (closureData.isClosure) {
       // Inside closure redirect references to itself to [:this:].
       HThis thisInstruction =
-          new HThis(closureData.thisLocal, backend.nonNullType);
+          new HThis(closureData.thisLocal, commonMasks.nonNullType);
       builder.graph.thisInstruction = thisInstruction;
       builder.graph.entry.addAtEntry(thisInstruction);
       updateLocal(closureData.closureElement, thisInstruction);
@@ -267,11 +272,14 @@
           new SyntheticLocal('receiver', executableContext);
       // Unlike `this`, receiver is nullable since direct calls to generative
       // constructor call the constructor with `null`.
-      ClosedWorld closedWorld = _compiler.closedWorld;
       HParameterValue value =
           new HParameterValue(parameter, new TypeMask.exact(cls, closedWorld));
       builder.graph.explicitReceiverParameter = value;
       builder.graph.entry.addAtEntry(value);
+      if (builder.lastAddedParameter == null) {
+        // If this is the first parameter inserted, make sure it stays first.
+        builder.lastAddedParameter = value;
+      }
     }
   }
 
@@ -325,7 +333,7 @@
       ClosureFieldElement redirect = redirectionMapping[local];
       HInstruction receiver = readLocal(closureData.closureElement);
       TypeMask type = local is BoxLocal
-          ? (_compiler.backend as JavaScriptBackend).nonNullType
+          ? commonMasks.nonNullType
           : getTypeOfCapturedVariable(redirect);
       HInstruction fieldGet = new HFieldGet(redirect, receiver, type);
       builder.add(fieldGet);
@@ -346,10 +354,7 @@
       assert(isUsedInTryOrGenerator(local));
       HLocalValue localValue = getLocal(local);
       HInstruction instruction = new HLocalGet(
-          local,
-          localValue,
-          (_compiler.backend as JavaScriptBackend).dynamicType,
-          sourceInformation);
+          local, localValue, commonMasks.dynamicType, sourceInformation);
       builder.add(instruction);
       return instruction;
     }
@@ -377,15 +382,14 @@
     }
 
     return activationVariables.putIfAbsent(local, () {
-      JavaScriptBackend backend = _compiler.backend;
-      HLocalValue localValue = new HLocalValue(local, backend.nonNullType)
+      HLocalValue localValue = new HLocalValue(local, commonMasks.nonNullType)
         ..sourceInformation = sourceInformation;
       builder.graph.entry.addAtExit(localValue);
       return localValue;
     });
   }
 
-  Local getTypeVariableAsLocal(TypeVariableType type) {
+  Local getTypeVariableAsLocal(ResolutionTypeVariableType type) {
     return typeVariableLocals.putIfAbsent(type, () {
       return new TypeVariableLocal(type, executableContext);
     });
@@ -489,7 +493,7 @@
         // We know 'this' cannot be modified.
         if (local != closureData.thisLocal) {
           HPhi phi =
-              new HPhi.singleInput(local, instruction, backend.dynamicType);
+              new HPhi.singleInput(local, instruction, commonMasks.dynamicType);
           loopEntry.addPhi(phi);
           directLocals[local] = phi;
         } else {
@@ -546,7 +550,6 @@
     // variable cannot be alive outside the block. Note: this is only
     // true for nodes where we do joins.
     Map<Local, HInstruction> joinedLocals = new Map<Local, HInstruction>();
-    JavaScriptBackend backend = _compiler.backend;
     otherLocals.directLocals.forEach((Local local, HInstruction instruction) {
       // We know 'this' cannot be modified.
       if (local == closureData.thisLocal) {
@@ -558,8 +561,8 @@
         if (identical(instruction, mine)) {
           joinedLocals[local] = instruction;
         } else {
-          HInstruction phi = new HPhi.manyInputs(
-              local, <HInstruction>[mine, instruction], backend.dynamicType);
+          HInstruction phi = new HPhi.manyInputs(local,
+              <HInstruction>[mine, instruction], commonMasks.dynamicType);
           joinBlock.addPhi(phi);
           joinedLocals[local] = phi;
         }
@@ -576,13 +579,12 @@
   LocalsHandler mergeMultiple(
       List<LocalsHandler> localsHandlers, HBasicBlock joinBlock) {
     assert(localsHandlers.length > 0);
-    if (localsHandlers.length == 1) return localsHandlers[0];
+    if (localsHandlers.length == 1) return localsHandlers.single;
     Map<Local, HInstruction> joinedLocals = new Map<Local, HInstruction>();
     HInstruction thisValue = null;
-    JavaScriptBackend backend = _compiler.backend;
     directLocals.forEach((Local local, HInstruction instruction) {
       if (local != closureData.thisLocal) {
-        HPhi phi = new HPhi.noInputs(local, backend.dynamicType);
+        HPhi phi = new HPhi.noInputs(local, commonMasks.dynamicType);
         joinedLocals[local] = phi;
         joinBlock.addPhi(phi);
       } else {
@@ -625,17 +627,14 @@
     if (result == null) {
       ThisLocal local = closureData.thisLocal;
       ClassElement cls = local.enclosingClass;
-      ClosedWorld closedWorld = _compiler.closedWorld;
       if (closedWorld.isUsedAsMixin(cls)) {
         // If the enclosing class is used as a mixin, [:this:] can be
         // of the class that mixins the enclosing class. These two
         // classes do not have a subclass relationship, so, for
         // simplicity, we mark the type as an interface type.
-        result =
-            new TypeMask.nonNullSubtype(cls.declaration, _compiler.closedWorld);
+        result = new TypeMask.nonNullSubtype(cls.declaration, closedWorld);
       } else {
-        result = new TypeMask.nonNullSubclass(
-            cls.declaration, _compiler.closedWorld);
+        result = new TypeMask.nonNullSubclass(cls.declaration, closedWorld);
       }
       cachedTypeOfThis = result;
     }
@@ -645,10 +644,10 @@
   Map<Element, TypeMask> cachedTypesOfCapturedVariables =
       new Map<Element, TypeMask>();
 
-  TypeMask getTypeOfCapturedVariable(Element element) {
-    assert(element.isField);
+  TypeMask getTypeOfCapturedVariable(FieldElement element) {
     return cachedTypesOfCapturedVariables.putIfAbsent(element, () {
-      return TypeMaskFactory.inferredTypeForElement(element, _compiler);
+      return TypeMaskFactory.inferredTypeForElement(
+          element, _globalInferenceResults);
     });
   }
 
diff --git a/pkg/compiler/lib/src/ssa/loop_handler.dart b/pkg/compiler/lib/src/ssa/loop_handler.dart
index e897820..3b59a5f 100644
--- a/pkg/compiler/lib/src/ssa/loop_handler.dart
+++ b/pkg/compiler/lib/src/ssa/loop_handler.dart
@@ -4,7 +4,7 @@
 
 import 'package:kernel/ast.dart' as ir;
 
-import '../elements/elements.dart';
+import '../elements/elements.dart' show JumpTarget, LabelDefinition;
 import '../io/source_information.dart';
 import '../tree/tree.dart' as ast;
 
@@ -106,12 +106,12 @@
       builder.localsHandler =
           continueHandlers[0].mergeMultiple(continueHandlers, updateBlock);
 
-      List<LabelDefinition> labels = jumpHandler.labels();
+      List<LabelDefinition> labels = jumpHandler.labels;
       JumpTarget target = getTargetDefinition(loop);
-      if (!labels.isEmpty) {
+      if (labels.isNotEmpty) {
         beginBodyBlock.setBlockFlow(
             new HLabeledBlockInformation(
-                new HSubGraphBlockInformation(bodyGraph), jumpHandler.labels(),
+                new HSubGraphBlockInformation(bodyGraph), jumpHandler.labels,
                 isContinue: true),
             updateBlock);
       } else if (target != null && target.isContinueTarget) {
@@ -222,7 +222,7 @@
 
     JumpHandler jumpHandler = createJumpHandler(node, isLoopJump: true);
     HBasicBlock loopEntry = builder.graph
-        .addNewLoopHeaderBlock(jumpHandler.target, jumpHandler.labels());
+        .addNewLoopHeaderBlock(jumpHandler.target, jumpHandler.labels);
     previousBlock.addSuccessor(loopEntry);
     builder.open(loopEntry);
 
@@ -350,7 +350,7 @@
 
 // TODO(het): Since kernel simplifies loop breaks and continues, we should
 // rewrite the loop handler from scratch to account for the simplified structure
-class KernelLoopHandler extends LoopHandler<ir.Node> {
+class KernelLoopHandler extends LoopHandler<ir.TreeNode> {
   final KernelSsaBuilder builder;
 
   KernelAstAdapter get astAdapter => builder.astAdapter;
@@ -360,33 +360,22 @@
         super(builder);
 
   @override
-  JumpHandler createJumpHandler(ir.Node node, {bool isLoopJump}) {
-    JumpTarget element = getTargetDefinition(node);
-    if (element == null || !identical(element.statement, node)) {
-      // No breaks or continues to this node.
-      return new NullJumpHandler(builder.compiler.reporter);
-    }
-    if (isLoopJump && node is ast.SwitchStatement) {
-      // Create a special jump handler for loops created for switch statements
-      // with continue statements.
-      return new SwitchCaseJumpHandler(builder, element, getNode(node));
-    }
-    return new JumpHandler(builder, element);
-  }
+  JumpHandler createJumpHandler(ir.TreeNode node, {bool isLoopJump}) =>
+      builder.createJumpHandler(node, isLoopJump: isLoopJump);
 
   @override
-  ast.Node getNode(ir.Node node) => astAdapter.getNode(node);
+  ast.Node getNode(ir.TreeNode node) => astAdapter.getNode(node);
 
   @override
-  JumpTarget getTargetDefinition(ir.Node node) =>
-      astAdapter.getTargetDefinition(node);
+  JumpTarget getTargetDefinition(ir.TreeNode node) =>
+      astAdapter.getJumpTarget(node.parent);
 
   @override
-  int loopKind(ir.Node node) => node.accept(new _KernelLoopTypeVisitor());
+  int loopKind(ir.TreeNode node) => node.accept(new _KernelLoopTypeVisitor());
 
   // TODO(het): return the actual source information
   @override
-  SourceInformation loopSourceInformation(ir.Node node) => null;
+  SourceInformation loopSourceInformation(ir.TreeNode node) => null;
 }
 
 class _KernelLoopTypeVisitor extends ir.Visitor<int> {
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index 712ff29..1852bce 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -4,16 +4,16 @@
 
 import '../closure.dart';
 import '../common.dart';
+import '../common/backend_api.dart' show BackendClasses;
 import '../compiler.dart' show Compiler;
 import '../constants/constant_system.dart';
 import '../constants/values.dart';
-import '../dart_types.dart';
 import '../elements/elements.dart'
     show Entity, JumpTarget, LabelDefinition, Local;
 import '../elements/entities.dart';
+import '../elements/types.dart';
 import '../io/source_information.dart';
 import '../js/js.dart' as js;
-import '../js_backend/backend_helpers.dart' show BackendHelpers;
 import '../js_backend/js_backend.dart';
 import '../native/native.dart' as native;
 import '../tree/dartstring.dart' as ast;
@@ -79,6 +79,7 @@
   R visitRangeConversion(HRangeConversion node);
   R visitReadModifyWrite(HReadModifyWrite node);
   R visitRef(HRef node);
+  R visitRemainder(HRemainder node);
   R visitReturn(HReturn node);
   R visitShiftLeft(HShiftLeft node);
   R visitShiftRight(HShiftRight node);
@@ -206,7 +207,7 @@
     return result;
   }
 
-  HConstant addConstant(ConstantValue constant, Compiler compiler,
+  HConstant addConstant(ConstantValue constant, ClosedWorld closedWorld,
       {SourceInformation sourceInformation}) {
     HConstant result = constants[constant];
     // TODO(johnniwinther): Support source information per constant reference.
@@ -215,7 +216,7 @@
         // We use `null` as the value for invalid constant expressions.
         constant = const NullConstantValue();
       }
-      TypeMask type = computeTypeMask(compiler, constant);
+      TypeMask type = computeTypeMask(closedWorld, constant);
       result = new HConstant.internal(constant, type)
         ..sourceInformation = sourceInformation;
       entry.addAtExit(result);
@@ -227,43 +228,56 @@
     return result;
   }
 
-  HConstant addDeferredConstant(ConstantValue constant, Entity prefix,
-      SourceInformation sourceInformation, Compiler compiler) {
+  HConstant addDeferredConstant(
+      ConstantValue constant,
+      Entity prefix,
+      SourceInformation sourceInformation,
+      Compiler compiler,
+      ClosedWorld closedWorld) {
     // TODO(sigurdm,johnniwinther): These deferred constants should be created
     // by the constant evaluator.
     ConstantValue wrapper = new DeferredConstantValue(constant, prefix);
     compiler.deferredLoadTask.registerConstantDeferredUse(wrapper, prefix);
-    return addConstant(wrapper, compiler, sourceInformation: sourceInformation);
+    return addConstant(wrapper, closedWorld,
+        sourceInformation: sourceInformation);
   }
 
-  HConstant addConstantInt(int i, Compiler compiler) {
-    return addConstant(compiler.backend.constantSystem.createInt(i), compiler);
+  HConstant addConstantInt(int i, ClosedWorld closedWorld) {
+    return addConstant(closedWorld.constantSystem.createInt(i), closedWorld);
   }
 
-  HConstant addConstantDouble(double d, Compiler compiler) {
+  HConstant addConstantDouble(double d, ClosedWorld closedWorld) {
+    return addConstant(closedWorld.constantSystem.createDouble(d), closedWorld);
+  }
+
+  HConstant addConstantString(ast.DartString str, ClosedWorld closedWorld) {
     return addConstant(
-        compiler.backend.constantSystem.createDouble(d), compiler);
+        closedWorld.constantSystem.createString(str), closedWorld);
   }
 
-  HConstant addConstantString(ast.DartString str, Compiler compiler) {
-    return addConstant(
-        compiler.backend.constantSystem.createString(str), compiler);
-  }
-
-  HConstant addConstantStringFromName(js.Name name, Compiler compiler) {
+  HConstant addConstantStringFromName(js.Name name, ClosedWorld closedWorld) {
     return addConstant(
         new SyntheticConstantValue(
             SyntheticConstantKind.NAME, js.quoteName(name)),
-        compiler);
+        closedWorld);
   }
 
-  HConstant addConstantBool(bool value, Compiler compiler) {
+  HConstant addConstantBool(bool value, ClosedWorld closedWorld) {
     return addConstant(
-        compiler.backend.constantSystem.createBool(value), compiler);
+        closedWorld.constantSystem.createBool(value), closedWorld);
   }
 
-  HConstant addConstantNull(Compiler compiler) {
-    return addConstant(compiler.backend.constantSystem.createNull(), compiler);
+  HConstant addConstantNull(ClosedWorld closedWorld) {
+    return addConstant(closedWorld.constantSystem.createNull(), closedWorld);
+  }
+
+  HConstant addConstantUnreachable(ClosedWorld closedWorld) {
+    // A constant with an empty type used as the HInstruction of an expression
+    // in an unreachable context.
+    return addConstant(
+        new SyntheticConstantValue(
+            SyntheticConstantKind.EMPTY_VALUE, const TypeMask.nonNullEmpty()),
+        closedWorld);
   }
 
   void finalize() {
@@ -382,6 +396,7 @@
   visitRangeConversion(HRangeConversion node) => visitCheck(node);
   visitReadModifyWrite(HReadModifyWrite node) => visitInstruction(node);
   visitRef(HRef node) => node.value.accept(this);
+  visitRemainder(HRemainder node) => visitBinaryArithmetic(node);
   visitReturn(HReturn node) => visitControlFlow(node);
   visitShiftLeft(HShiftLeft node) => visitBinaryBitOp(node);
   visitShiftRight(HShiftRight node) => visitBinaryBitOp(node);
@@ -877,6 +892,7 @@
   static const int TYPE_INFO_EXPRESSION_TYPECODE = 40;
 
   static const int FOREIGN_CODE_TYPECODE = 41;
+  static const int REMAINDER_TYPECODE = 42;
 
   HInstruction(this.inputs, this.instructionType)
       : id = idCounter++,
@@ -949,203 +965,168 @@
         typeMask.satisfies(cls, closedWorld);
   }
 
-  bool canBePrimitive(Compiler compiler) {
-    return canBePrimitiveNumber(compiler) ||
-        canBePrimitiveArray(compiler) ||
-        canBePrimitiveBoolean(compiler) ||
-        canBePrimitiveString(compiler) ||
+  bool canBePrimitive(ClosedWorld closedWorld) {
+    return canBePrimitiveNumber(closedWorld) ||
+        canBePrimitiveArray(closedWorld) ||
+        canBePrimitiveBoolean(closedWorld) ||
+        canBePrimitiveString(closedWorld) ||
         isNull();
   }
 
-  bool canBePrimitiveNumber(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
+  bool canBePrimitiveNumber(ClosedWorld closedWorld) {
+    BackendClasses backendClasses = closedWorld.backendClasses;
     // TODO(sra): It should be possible to test only jsDoubleClass and
     // jsUInt31Class, since all others are superclasses of these two.
-    return containsType(instructionType, helpers.jsNumberClass, closedWorld) ||
-        containsType(instructionType, helpers.jsIntClass, closedWorld) ||
+    return containsType(
+            instructionType, backendClasses.numImplementation, closedWorld) ||
         containsType(
-            instructionType, helpers.jsPositiveIntClass, closedWorld) ||
-        containsType(instructionType, helpers.jsUInt32Class, closedWorld) ||
-        containsType(instructionType, helpers.jsUInt31Class, closedWorld) ||
-        containsType(instructionType, helpers.jsDoubleClass, closedWorld);
+            instructionType, backendClasses.intImplementation, closedWorld) ||
+        containsType(instructionType, backendClasses.positiveIntImplementation,
+            closedWorld) ||
+        containsType(instructionType, backendClasses.uint32Implementation,
+            closedWorld) ||
+        containsType(instructionType, backendClasses.uint31Implementation,
+            closedWorld) ||
+        containsType(
+            instructionType, backendClasses.doubleImplementation, closedWorld);
   }
 
-  bool canBePrimitiveBoolean(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
-    return containsType(instructionType, helpers.jsBoolClass, closedWorld);
+  bool canBePrimitiveBoolean(ClosedWorld closedWorld) {
+    return containsType(instructionType,
+        closedWorld.backendClasses.boolImplementation, closedWorld);
   }
 
-  bool canBePrimitiveArray(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
-    return containsType(instructionType, helpers.jsArrayClass, closedWorld) ||
-        containsType(instructionType, helpers.jsFixedArrayClass, closedWorld) ||
-        containsType(
-            instructionType, helpers.jsExtendableArrayClass, closedWorld) ||
-        containsType(
-            instructionType, helpers.jsUnmodifiableArrayClass, closedWorld);
+  bool canBePrimitiveArray(ClosedWorld closedWorld) {
+    BackendClasses backendClasses = closedWorld.backendClasses;
+    return containsType(
+            instructionType, backendClasses.listImplementation, closedWorld) ||
+        containsType(instructionType, backendClasses.fixedListImplementation,
+            closedWorld) ||
+        containsType(instructionType, backendClasses.growableListImplementation,
+            closedWorld) ||
+        containsType(instructionType, backendClasses.constListImplementation,
+            closedWorld);
   }
 
-  bool isIndexablePrimitive(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
+  bool isIndexablePrimitive(ClosedWorld closedWorld) {
     return instructionType.containsOnlyString(closedWorld) ||
-        isInstanceOf(instructionType, helpers.jsIndexableClass, closedWorld);
+        isInstanceOf(instructionType,
+            closedWorld.backendClasses.indexableImplementation, closedWorld);
   }
 
-  bool isFixedArray(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
+  bool isFixedArray(ClosedWorld closedWorld) {
+    BackendClasses backendClasses = closedWorld.backendClasses;
     // TODO(sra): Recognize the union of these types as well.
-    return containsOnlyType(
-            instructionType, helpers.jsFixedArrayClass, closedWorld) ||
-        containsOnlyType(
-            instructionType, helpers.jsUnmodifiableArrayClass, closedWorld);
+    return containsOnlyType(instructionType,
+            backendClasses.fixedListImplementation, closedWorld) ||
+        containsOnlyType(instructionType,
+            backendClasses.constListImplementation, closedWorld);
   }
 
-  bool isExtendableArray(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
-    return containsOnlyType(
-        instructionType, helpers.jsExtendableArrayClass, closedWorld);
+  bool isExtendableArray(ClosedWorld closedWorld) {
+    return containsOnlyType(instructionType,
+        closedWorld.backendClasses.growableListImplementation, closedWorld);
   }
 
-  bool isMutableArray(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
-    return isInstanceOf(
-        instructionType, helpers.jsMutableArrayClass, closedWorld);
+  bool isMutableArray(ClosedWorld closedWorld) {
+    return isInstanceOf(instructionType,
+        closedWorld.backendClasses.mutableListImplementation, closedWorld);
   }
 
-  bool isReadableArray(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
-    return isInstanceOf(instructionType, helpers.jsArrayClass, closedWorld);
+  bool isReadableArray(ClosedWorld closedWorld) {
+    return isInstanceOf(instructionType,
+        closedWorld.backendClasses.listImplementation, closedWorld);
   }
 
-  bool isMutableIndexable(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
-    return isInstanceOf(
-        instructionType, helpers.jsMutableIndexableClass, closedWorld);
+  bool isMutableIndexable(ClosedWorld closedWorld) {
+    return isInstanceOf(instructionType,
+        closedWorld.backendClasses.mutableIndexableImplementation, closedWorld);
   }
 
-  bool isArray(Compiler compiler) => isReadableArray(compiler);
+  bool isArray(ClosedWorld closedWorld) => isReadableArray(closedWorld);
 
-  bool canBePrimitiveString(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
-    return containsType(instructionType, helpers.jsStringClass, closedWorld);
+  bool canBePrimitiveString(ClosedWorld closedWorld) {
+    return containsType(instructionType,
+        closedWorld.backendClasses.stringImplementation, closedWorld);
   }
 
-  bool isInteger(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isInteger(ClosedWorld closedWorld) {
     return instructionType.containsOnlyInt(closedWorld) &&
         !instructionType.isNullable;
   }
 
-  bool isUInt32(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
+  bool isUInt32(ClosedWorld closedWorld) {
     return !instructionType.isNullable &&
-        isInstanceOf(instructionType, helpers.jsUInt32Class, closedWorld);
+        isInstanceOf(instructionType,
+            closedWorld.backendClasses.uint32Implementation, closedWorld);
   }
 
-  bool isUInt31(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
+  bool isUInt31(ClosedWorld closedWorld) {
     return !instructionType.isNullable &&
-        isInstanceOf(instructionType, helpers.jsUInt31Class, closedWorld);
+        isInstanceOf(instructionType,
+            closedWorld.backendClasses.uint31Implementation, closedWorld);
   }
 
-  bool isPositiveInteger(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
+  bool isPositiveInteger(ClosedWorld closedWorld) {
     return !instructionType.isNullable &&
-        isInstanceOf(instructionType, helpers.jsPositiveIntClass, closedWorld);
+        isInstanceOf(instructionType,
+            closedWorld.backendClasses.positiveIntImplementation, closedWorld);
   }
 
-  bool isPositiveIntegerOrNull(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
-    JavaScriptBackend backend = compiler.backend;
-    BackendHelpers helpers = backend.helpers;
-    return isInstanceOf(
-        instructionType, helpers.jsPositiveIntClass, closedWorld);
+  bool isPositiveIntegerOrNull(ClosedWorld closedWorld) {
+    return isInstanceOf(instructionType,
+        closedWorld.backendClasses.positiveIntImplementation, closedWorld);
   }
 
-  bool isIntegerOrNull(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isIntegerOrNull(ClosedWorld closedWorld) {
     return instructionType.containsOnlyInt(closedWorld);
   }
 
-  bool isNumber(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isNumber(ClosedWorld closedWorld) {
     return instructionType.containsOnlyNum(closedWorld) &&
         !instructionType.isNullable;
   }
 
-  bool isNumberOrNull(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isNumberOrNull(ClosedWorld closedWorld) {
     return instructionType.containsOnlyNum(closedWorld);
   }
 
-  bool isDouble(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isDouble(ClosedWorld closedWorld) {
     return instructionType.containsOnlyDouble(closedWorld) &&
         !instructionType.isNullable;
   }
 
-  bool isDoubleOrNull(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isDoubleOrNull(ClosedWorld closedWorld) {
     return instructionType.containsOnlyDouble(closedWorld);
   }
 
-  bool isBoolean(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isBoolean(ClosedWorld closedWorld) {
     return instructionType.containsOnlyBool(closedWorld) &&
         !instructionType.isNullable;
   }
 
-  bool isBooleanOrNull(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isBooleanOrNull(ClosedWorld closedWorld) {
     return instructionType.containsOnlyBool(closedWorld);
   }
 
-  bool isString(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isString(ClosedWorld closedWorld) {
     return instructionType.containsOnlyString(closedWorld) &&
         !instructionType.isNullable;
   }
 
-  bool isStringOrNull(Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool isStringOrNull(ClosedWorld closedWorld) {
     return instructionType.containsOnlyString(closedWorld);
   }
 
-  bool isPrimitive(Compiler compiler) {
-    return (isPrimitiveOrNull(compiler) && !instructionType.isNullable) ||
+  bool isPrimitive(ClosedWorld closedWorld) {
+    return (isPrimitiveOrNull(closedWorld) && !instructionType.isNullable) ||
         isNull();
   }
 
-  bool isPrimitiveOrNull(Compiler compiler) {
-    return isIndexablePrimitive(compiler) ||
-        isNumberOrNull(compiler) ||
-        isBooleanOrNull(compiler) ||
+  bool isPrimitiveOrNull(ClosedWorld closedWorld) {
+    return isIndexablePrimitive(closedWorld) ||
+        isNumberOrNull(closedWorld) ||
+        isBooleanOrNull(closedWorld) ||
         isNull();
   }
 
@@ -1155,7 +1136,7 @@
   TypeMask instructionType;
 
   Selector get selector => null;
-  HInstruction getDartReceiver(Compiler compiler) => null;
+  HInstruction getDartReceiver(ClosedWorld closedWorld) => null;
   bool onlyThrowsNSM() => false;
 
   bool isInBasicBlock() => block != null;
@@ -1338,7 +1319,7 @@
   bool isConstantFalse() => false;
   bool isConstantTrue() => false;
 
-  bool isInterceptor(Compiler compiler) => false;
+  bool isInterceptor(ClosedWorld closedWorld) => false;
 
   bool isValid() {
     HValidator validator = new HValidator();
@@ -1364,7 +1345,7 @@
     return false;
   }
 
-  HInstruction convertType(Compiler compiler, DartType type, int kind) {
+  HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) {
     if (type == null) return this;
     type = type.unaliased;
     // Only the builder knows how to create [HTypeConversion]
@@ -1374,19 +1355,21 @@
     assert(type.treatAsRaw || type.isFunctionType);
     if (type.isDynamic) return this;
     if (type.isObject) return this;
-    JavaScriptBackend backend = compiler.backend;
     if (type.isVoid || type.isFunctionType || type.isMalformed) {
-      return new HTypeConversion(type, kind, backend.dynamicType, this);
+      return new HTypeConversion(
+          type, kind, closedWorld.commonMasks.dynamicType, this);
     }
     assert(type.isInterfaceType);
     if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) {
       // Boolean conversion checks work on non-nullable booleans.
-      return new HTypeConversion(type, kind, backend.boolType, this);
+      return new HTypeConversion(
+          type, kind, closedWorld.commonMasks.boolType, this);
     } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) {
       throw 'creating compound check to $type (this = ${this})';
     } else {
-      Entity cls = type.element;
-      TypeMask subtype = new TypeMask.subtype(cls, compiler.closedWorld);
+      InterfaceType interfaceType = type;
+      TypeMask subtype =
+          new TypeMask.subtype(interfaceType.element, closedWorld);
       return new HTypeConversion(type, kind, subtype, this);
     }
   }
@@ -1412,8 +1395,8 @@
   HInstruction get value => inputs[0];
 
   @override
-  HInstruction convertType(Compiler compiler, DartType type, int kind) {
-    HInstruction converted = value.convertType(compiler, type, kind);
+  HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) {
+    HInstruction converted = value.convertType(closedWorld, type, kind);
     if (converted == value) return this;
     HTypeConversion conversion = converted;
     conversion.inputs[0] = this;
@@ -1577,15 +1560,15 @@
             : const InvokeDynamicSpecializer();
   toString() => 'invoke dynamic: selector=$selector, mask=$mask';
   HInstruction get receiver => inputs[0];
-  HInstruction getDartReceiver(Compiler compiler) {
-    return isCallOnInterceptor(compiler) ? inputs[1] : inputs[0];
+  HInstruction getDartReceiver(ClosedWorld closedWorld) {
+    return isCallOnInterceptor(closedWorld) ? inputs[1] : inputs[0];
   }
 
   /**
    * Returns whether this call is on an interceptor object.
    */
-  bool isCallOnInterceptor(Compiler compiler) {
-    return isInterceptedCall && receiver.isInterceptor(compiler);
+  bool isCallOnInterceptor(ClosedWorld closedWorld) {
+    return isInterceptedCall && receiver.isInterceptor(closedWorld);
   }
 
   int typeCode() => HInstruction.INVOKE_DYNAMIC_TYPECODE;
@@ -1682,15 +1665,15 @@
   }
 
   HInstruction get receiver => inputs[0];
-  HInstruction getDartReceiver(Compiler compiler) {
-    return isCallOnInterceptor(compiler) ? inputs[1] : inputs[0];
+  HInstruction getDartReceiver(ClosedWorld closedWorld) {
+    return isCallOnInterceptor(closedWorld) ? inputs[1] : inputs[0];
   }
 
   /**
    * Returns whether this call is on an interceptor object.
    */
-  bool isCallOnInterceptor(Compiler compiler) {
-    return isInterceptedCall && receiver.isInterceptor(compiler);
+  bool isCallOnInterceptor(ClosedWorld closedWorld) {
+    return isInterceptedCall && receiver.isInterceptor(closedWorld);
   }
 
   toString() => 'invoke super: $element';
@@ -1740,22 +1723,22 @@
     }
   }
 
-  bool isInterceptor(Compiler compiler) {
+  bool isInterceptor(ClosedWorld closedWorld) {
     if (sourceElement == null) return false;
     // In case of a closure inside an interceptor class, [:this:] is
     // stored in the generated closure class, and accessed through a
     // [HFieldGet].
-    JavaScriptBackend backend = compiler.backend;
     if (sourceElement is ThisLocal) {
       ThisLocal thisLocal = sourceElement;
-      return backend.isInterceptorClass(thisLocal.enclosingClass);
+      return closedWorld.backendClasses
+          .isInterceptorClass(thisLocal.enclosingClass);
     }
     return false;
   }
 
   bool canThrow() => receiver.canBeNull();
 
-  HInstruction getDartReceiver(Compiler compiler) => receiver;
+  HInstruction getDartReceiver(ClosedWorld closedWorld) => receiver;
   bool onlyThrowsNSM() => true;
   bool get isNullCheck => element == null;
 
@@ -1778,7 +1761,7 @@
 
   bool canThrow() => receiver.canBeNull();
 
-  HInstruction getDartReceiver(Compiler compiler) => receiver;
+  HInstruction getDartReceiver(ClosedWorld closedWorld) => receiver;
   bool onlyThrowsNSM() => true;
 
   HInstruction get value => inputs[1];
@@ -1830,7 +1813,7 @@
 
   bool canThrow() => receiver.canBeNull();
 
-  HInstruction getDartReceiver(Compiler compiler) => receiver;
+  HInstruction getDartReceiver(ClosedWorld closedWorld) => receiver;
   bool onlyThrowsNSM() => true;
 
   HInstruction get value => inputs[1];
@@ -2037,6 +2020,19 @@
   bool dataEquals(HInstruction other) => true;
 }
 
+class HRemainder extends HBinaryArithmetic {
+  HRemainder(
+      HInstruction left, HInstruction right, Selector selector, TypeMask type)
+      : super(left, right, selector, type);
+  accept(HVisitor visitor) => visitor.visitRemainder(this);
+
+  BinaryOperation operation(ConstantSystem constantSystem) =>
+      constantSystem.remainder;
+  int typeCode() => HInstruction.REMAINDER_TYPECODE;
+  bool typeEquals(other) => other is HRemainder;
+  bool dataEquals(HInstruction other) => true;
+}
+
 /**
  * An [HSwitch] instruction has one input for the incoming
  * value, and one input per constant that it can switch on.
@@ -2194,11 +2190,9 @@
 }
 
 class HBreak extends HJump {
-  /**
-   * Signals that this is a special break instruction for the synthetic loop
-   * generatedfor a switch statement with continue statements. See
-   * [SsaFromAstMixin.buildComplexSwitchStatement] for detail.
-   */
+  /// Signals that this is a special break instruction for the synthetic loop
+  /// generated for a switch statement with continue statements. See
+  /// [SsaFromAstMixin.buildComplexSwitchStatement] for detail.
   final bool breakSwitchContinueLoop;
   HBreak(JumpTarget target, {bool this.breakSwitchContinueLoop: false})
       : super(target);
@@ -2287,7 +2281,7 @@
   bool isConstantFalse() => constant.isFalse;
   bool isConstantTrue() => constant.isTrue;
 
-  bool isInterceptor(Compiler compiler) => constant.isInterceptor;
+  bool isInterceptor(ClosedWorld closedWorld) => constant.isInterceptor;
 
   // Maybe avoid this if the literal is big?
   bool isCodeMotionInvariant() => true;
@@ -2353,9 +2347,9 @@
 
   bool isCodeMotionInvariant() => true;
 
-  bool isInterceptor(Compiler compiler) {
-    JavaScriptBackend backend = compiler.backend;
-    return backend.isInterceptorClass(sourceElement.enclosingClass);
+  bool isInterceptor(ClosedWorld closedWorld) {
+    return closedWorld.backendClasses
+        .isInterceptorClass(sourceElement.enclosingClass);
   }
 
   String toString() => 'this';
@@ -2561,7 +2555,7 @@
     inputs.add(constant);
   }
 
-  bool isInterceptor(Compiler compiler) => true;
+  bool isInterceptor(ClosedWorld closedWorld) => true;
 
   int typeCode() => HInstruction.INTERCEPTOR_TYPECODE;
   bool typeEquals(other) => other is HInterceptor;
@@ -2589,7 +2583,7 @@
     assert(inputs[0] is HConstant);
     assert(inputs[0].isNull());
   }
-  bool isCallOnInterceptor(Compiler compiler) => true;
+  bool isCallOnInterceptor(ClosedWorld closedWorld) => true;
 
   String toString() => 'one shot interceptor: selector=$selector, mask=$mask';
   accept(HVisitor visitor) => visitor.visitOneShotInterceptor(this);
@@ -2664,7 +2658,7 @@
   // TODO(27272): Make HIndex dependent on bounds checking.
   bool get isMovable => false;
 
-  HInstruction getDartReceiver(Compiler compiler) => receiver;
+  HInstruction getDartReceiver(ClosedWorld closedWorld) => receiver;
   bool onlyThrowsNSM() => true;
   bool canThrow() => receiver.canBeNull();
 
@@ -2698,7 +2692,7 @@
   // TODO(27272): Make HIndex dependent on bounds checking.
   bool get isMovable => false;
 
-  HInstruction getDartReceiver(Compiler compiler) => receiver;
+  HInstruction getDartReceiver(ClosedWorld closedWorld) => receiver;
   bool onlyThrowsNSM() => true;
   bool canThrow() => receiver.canBeNull();
 }
@@ -2826,7 +2820,7 @@
       : checkedType = type,
         super(<HInstruction>[input], type) {
     assert(!isReceiverTypeCheck || receiverTypeCheckSelector != null);
-    assert(typeExpression == null || typeExpression.kind != TypeKind.TYPEDEF);
+    assert(typeExpression == null || !typeExpression.isTypedef);
     sourceElement = input.sourceElement;
   }
 
@@ -2835,7 +2829,7 @@
       : checkedType = type,
         super(<HInstruction>[input, typeRepresentation], type),
         receiverTypeCheckSelector = null {
-    assert(typeExpression.kind != TypeKind.TYPEDEF);
+    assert(!typeExpression.isTypedef);
     sourceElement = input.sourceElement;
   }
 
@@ -2862,7 +2856,7 @@
   HInstruction get checkedInput =>
       usesMethodOnType ? inputs[1] : super.checkedInput;
 
-  HInstruction convertType(Compiler compiler, DartType type, int kind) {
+  HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) {
     if (typeExpression == type) {
       // Don't omit a boolean conversion (which doesn't allow `null`) unless
       // this type conversion is already a boolean conversion.
@@ -2870,7 +2864,7 @@
         return this;
       }
     }
-    return super.convertType(compiler, type, kind);
+    return super.convertType(closedWorld, type, kind);
   }
 
   bool get isCheckedModeCheck {
@@ -3295,7 +3289,7 @@
   bool typeEquals(HInstruction other) => other is HTypeInfoReadVariable;
 
   bool dataEquals(HTypeInfoReadVariable other) {
-    return variable.element == other.variable.element;
+    return variable == other.variable;
   }
 
   String toString() => 'HTypeInfoReadVariable($variable)';
@@ -3413,8 +3407,7 @@
   bool typeEquals(HInstruction other) => other is HReadTypeVariable;
 
   bool dataEquals(HReadTypeVariable other) {
-    return dartType.element == other.dartType.element &&
-        hasReceiver == other.hasReceiver;
+    return dartType == other.dartType && hasReceiver == other.hasReceiver;
   }
 }
 
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index de90a81..b7b0c0a 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -8,9 +8,11 @@
 import '../compiler.dart' show Compiler;
 import '../constants/constant_system.dart';
 import '../constants/values.dart';
-import '../core_types.dart' show CoreClasses;
-import '../dart_types.dart';
-import '../elements/elements.dart';
+import '../core_types.dart' show CommonElements;
+import '../elements/elements.dart'
+    show ClassElement, Entity, FieldElement, MethodElement;
+import '../elements/entities.dart';
+import '../elements/resolution_types.dart';
 import '../js/js.dart' as js;
 import '../js_backend/backend_helpers.dart' show BackendHelpers;
 import '../js_backend/js_backend.dart';
@@ -35,21 +37,24 @@
 
 class SsaOptimizerTask extends CompilerTask {
   final JavaScriptBackend backend;
+
+  Map<HInstruction, Range> ranges = <HInstruction, Range>{};
+
   SsaOptimizerTask(JavaScriptBackend backend)
       : this.backend = backend,
         super(backend.compiler.measurer);
-  String get name => 'SSA optimizer';
-  Compiler get compiler => backend.compiler;
-  Map<HInstruction, Range> ranges = <HInstruction, Range>{};
 
-  void optimize(CodegenWorkItem work, HGraph graph) {
+  String get name => 'SSA optimizer';
+
+  Compiler get compiler => backend.compiler;
+
+  void optimize(CodegenWorkItem work, HGraph graph, ClosedWorld closedWorld) {
     void runPhase(OptimizationPhase phase) {
       measureSubtask(phase.name, () => phase.visitGraph(graph));
-      compiler.tracer.traceGraph(phase.name, graph);
+      backend.tracer.traceGraph(phase.name, graph);
       assert(graph.isValid());
     }
 
-    ConstantSystem constantSystem = compiler.backend.constantSystem;
     bool trustPrimitives = compiler.options.trustPrimitives;
     CodegenRegistry registry = work.registry;
     Set<HInstruction> boundsChecked = new Set<HInstruction>();
@@ -58,63 +63,68 @@
       List<OptimizationPhase> phases = <OptimizationPhase>[
         // Run trivial instruction simplification first to optimize
         // some patterns useful for type conversion.
-        new SsaInstructionSimplifier(constantSystem, backend, this, registry),
-        new SsaTypeConversionInserter(compiler),
+        new SsaInstructionSimplifier(backend, closedWorld, this, registry),
+        new SsaTypeConversionInserter(closedWorld),
         new SsaRedundantPhiEliminator(),
         new SsaDeadPhiEliminator(),
-        new SsaTypePropagator(compiler),
+        new SsaTypePropagator(compiler, closedWorld),
         // After type propagation, more instructions can be
         // simplified.
-        new SsaInstructionSimplifier(constantSystem, backend, this, registry),
-        new SsaCheckInserter(trustPrimitives, backend, boundsChecked),
-        new SsaInstructionSimplifier(constantSystem, backend, this, registry),
-        new SsaCheckInserter(trustPrimitives, backend, boundsChecked),
-        new SsaTypePropagator(compiler),
+        new SsaInstructionSimplifier(backend, closedWorld, this, registry),
+        new SsaCheckInserter(
+            trustPrimitives, backend, closedWorld, boundsChecked),
+        new SsaInstructionSimplifier(backend, closedWorld, this, registry),
+        new SsaCheckInserter(
+            trustPrimitives, backend, closedWorld, boundsChecked),
+        new SsaTypePropagator(compiler, closedWorld),
         // Run a dead code eliminator before LICM because dead
         // interceptors are often in the way of LICM'able instructions.
-        new SsaDeadCodeEliminator(compiler, this),
-        new SsaGlobalValueNumberer(compiler),
+        new SsaDeadCodeEliminator(closedWorld, this),
+        new SsaGlobalValueNumberer(),
         // After GVN, some instructions might need their type to be
         // updated because they now have different inputs.
-        new SsaTypePropagator(compiler),
+        new SsaTypePropagator(compiler, closedWorld),
         codeMotion = new SsaCodeMotion(),
-        new SsaLoadElimination(compiler),
+        new SsaLoadElimination(compiler, closedWorld),
         new SsaRedundantPhiEliminator(),
         new SsaDeadPhiEliminator(),
-        new SsaTypePropagator(compiler),
-        new SsaValueRangeAnalyzer(compiler, constantSystem, this),
+        new SsaTypePropagator(compiler, closedWorld),
+        new SsaValueRangeAnalyzer(backend.helpers, closedWorld, this),
         // Previous optimizations may have generated new
         // opportunities for instruction simplification.
-        new SsaInstructionSimplifier(constantSystem, backend, this, registry),
-        new SsaCheckInserter(trustPrimitives, backend, boundsChecked),
+        new SsaInstructionSimplifier(backend, closedWorld, this, registry),
+        new SsaCheckInserter(
+            trustPrimitives, backend, closedWorld, boundsChecked),
       ];
       phases.forEach(runPhase);
 
       // Simplifying interceptors is not strictly just an optimization, it is
       // required for implementation correctness because the code generator
       // assumes it is always performed.
-      runPhase(
-          new SsaSimplifyInterceptors(compiler, constantSystem, work.element));
+      runPhase(new SsaSimplifyInterceptors(
+          compiler, closedWorld, work.element.enclosingClass));
 
-      SsaDeadCodeEliminator dce = new SsaDeadCodeEliminator(compiler, this);
+      SsaDeadCodeEliminator dce = new SsaDeadCodeEliminator(closedWorld, this);
       runPhase(dce);
       if (codeMotion.movedCode || dce.eliminatedSideEffects) {
         phases = <OptimizationPhase>[
-          new SsaTypePropagator(compiler),
-          new SsaGlobalValueNumberer(compiler),
+          new SsaTypePropagator(compiler, closedWorld),
+          new SsaGlobalValueNumberer(),
           new SsaCodeMotion(),
-          new SsaValueRangeAnalyzer(compiler, constantSystem, this),
-          new SsaInstructionSimplifier(constantSystem, backend, this, registry),
-          new SsaCheckInserter(trustPrimitives, backend, boundsChecked),
-          new SsaSimplifyInterceptors(compiler, constantSystem, work.element),
-          new SsaDeadCodeEliminator(compiler, this),
+          new SsaValueRangeAnalyzer(backend.helpers, closedWorld, this),
+          new SsaInstructionSimplifier(backend, closedWorld, this, registry),
+          new SsaCheckInserter(
+              trustPrimitives, backend, closedWorld, boundsChecked),
+          new SsaSimplifyInterceptors(
+              compiler, closedWorld, work.element.enclosingClass),
+          new SsaDeadCodeEliminator(closedWorld, this),
         ];
       } else {
         phases = <OptimizationPhase>[
-          new SsaTypePropagator(compiler),
+          new SsaTypePropagator(compiler, closedWorld),
           // Run the simplifier to remove unneeded type checks inserted by
           // type propagation.
-          new SsaInstructionSimplifier(constantSystem, backend, this, registry),
+          new SsaInstructionSimplifier(backend, closedWorld, this, registry),
         ];
       }
       phases.forEach(runPhase);
@@ -126,18 +136,16 @@
 /// cannot change.  The current implementation is conservative for the purpose
 /// of identifying gvn-able lengths and mis-identifies some unions of fixed
 /// length indexables (see TODO) as not fixed length.
-bool isFixedLength(mask, Compiler compiler) {
-  ClosedWorld closedWorld = compiler.closedWorld;
-  JavaScriptBackend backend = compiler.backend;
+bool isFixedLength(mask, ClosedWorld closedWorld) {
   if (mask.isContainer && mask.length != null) {
     // A container on which we have inferred the length.
     return true;
   }
   // TODO(sra): Recognize any combination of fixed length indexables.
-  if (mask.containsOnly(backend.helpers.jsFixedArrayClass) ||
-      mask.containsOnly(backend.helpers.jsUnmodifiableArrayClass) ||
+  if (mask.containsOnly(closedWorld.backendClasses.fixedListImplementation) ||
+      mask.containsOnly(closedWorld.backendClasses.constListImplementation) ||
       mask.containsOnlyString(closedWorld) ||
-      backend.isTypedArray(mask)) {
+      closedWorld.commonMasks.isTypedArray(mask)) {
     return true;
   }
   return false;
@@ -156,19 +164,24 @@
 
   final String name = "SsaInstructionSimplifier";
   final JavaScriptBackend backend;
-  final ConstantSystem constantSystem;
+  final ClosedWorld closedWorld;
   final CodegenRegistry registry;
   HGraph graph;
   Compiler get compiler => backend.compiler;
   final SsaOptimizerTask optimizer;
 
   SsaInstructionSimplifier(
-      this.constantSystem, this.backend, this.optimizer, this.registry);
+      this.backend, this.closedWorld, this.optimizer, this.registry);
 
-  CoreClasses get coreClasses => compiler.coreClasses;
+  CommonElements get commonElements => closedWorld.commonElements;
 
   BackendHelpers get helpers => backend.helpers;
 
+  ConstantSystem get constantSystem => closedWorld.constantSystem;
+
+  GlobalTypeInferenceResults get globalInferenceResults =>
+      compiler.globalInference.results;
+
   void visitGraph(HGraph visitee) {
     graph = visitee;
     visitDominatorTree(visitee);
@@ -187,12 +200,12 @@
         // might be that an operation thought to return double, can be
         // simplified to an int. For example:
         // `2.5 * 10`.
-        if (!(replacement.isNumberOrNull(compiler) &&
-            instruction.isNumberOrNull(compiler))) {
+        if (!(replacement.isNumberOrNull(closedWorld) &&
+            instruction.isNumberOrNull(closedWorld))) {
           // If we can replace [instruction] with [replacement], then
           // [replacement]'s type can be narrowed.
           TypeMask newType = replacement.instructionType
-              .intersection(instruction.instructionType, compiler.closedWorld);
+              .intersection(instruction.instructionType, closedWorld);
           replacement.instructionType = newType;
         }
 
@@ -239,7 +252,7 @@
     if (node.usedBy.isEmpty) return;
     ConstantValue value = getConstantFromType(node);
     if (value != null) {
-      HConstant constant = graph.addConstant(value, compiler);
+      HConstant constant = graph.addConstant(value, closedWorld);
       for (HInstruction user in node.usedBy.toList()) {
         user.changeUse(node, constant);
       }
@@ -275,7 +288,7 @@
     List<HInstruction> inputs = node.inputs;
     assert(inputs.length == 1);
     HInstruction input = inputs[0];
-    if (input.isBoolean(compiler)) return input;
+    if (input.isBoolean(closedWorld)) return input;
 
     // If the code is unreachable, remove the HBoolify.  This can happen when
     // there is a throw expression in a short-circuit conditional.  Removing the
@@ -285,8 +298,8 @@
 
     // All values that cannot be 'true' are boolified to false.
     TypeMask mask = input.instructionType;
-    if (!mask.contains(helpers.jsBoolClass, compiler.closedWorld)) {
-      return graph.addConstantBool(false, compiler);
+    if (!mask.contains(helpers.jsBoolClass, closedWorld)) {
+      return graph.addConstantBool(false, closedWorld);
     }
     return node;
   }
@@ -298,7 +311,7 @@
     if (input is HConstant) {
       HConstant constant = input;
       bool isTrue = constant.constant.isTrue;
-      return graph.addConstantBool(!isTrue, compiler);
+      return graph.addConstantBool(!isTrue, closedWorld);
     } else if (input is HNot) {
       return input.inputs[0];
     }
@@ -315,35 +328,34 @@
     if (operand is HConstant) {
       HConstant receiver = operand;
       ConstantValue folded = operation.fold(receiver.constant);
-      if (folded != null) return graph.addConstant(folded, compiler);
+      if (folded != null) return graph.addConstant(folded, closedWorld);
     }
     return null;
   }
 
   HInstruction tryOptimizeLengthInterceptedGetter(HInvokeDynamic node) {
     HInstruction actualReceiver = node.inputs[1];
-    if (actualReceiver.isIndexablePrimitive(compiler)) {
+    if (actualReceiver.isIndexablePrimitive(closedWorld)) {
       if (actualReceiver.isConstantString()) {
         HConstant constantInput = actualReceiver;
         StringConstantValue constant = constantInput.constant;
-        return graph.addConstantInt(constant.length, compiler);
+        return graph.addConstantInt(constant.length, closedWorld);
       } else if (actualReceiver.isConstantList()) {
         HConstant constantInput = actualReceiver;
         ListConstantValue constant = constantInput.constant;
-        return graph.addConstantInt(constant.length, compiler);
+        return graph.addConstantInt(constant.length, closedWorld);
       }
-      MemberElement element = helpers.jsIndexableLength;
-      bool isFixed = isFixedLength(actualReceiver.instructionType, compiler);
+      MemberEntity element = helpers.jsIndexableLength;
+      bool isFixed = isFixedLength(actualReceiver.instructionType, closedWorld);
       TypeMask actualType = node.instructionType;
-      ClosedWorld closedWorld = compiler.closedWorld;
-      TypeMask resultType = backend.positiveIntType;
+      TypeMask resultType = closedWorld.commonMasks.positiveIntType;
       // If we already have computed a more specific type, keep that type.
       if (HInstruction.isInstanceOf(
           actualType, helpers.jsUInt31Class, closedWorld)) {
-        resultType = backend.uint31Type;
+        resultType = closedWorld.commonMasks.uint31Type;
       } else if (HInstruction.isInstanceOf(
           actualType, helpers.jsUInt32Class, closedWorld)) {
-        resultType = backend.uint32Type;
+        resultType = closedWorld.commonMasks.uint32Type;
       }
       HFieldGet result = new HFieldGet(element, actualReceiver, resultType,
           isAssignable: !isFixed);
@@ -351,7 +363,7 @@
     } else if (actualReceiver.isConstantMap()) {
       HConstant constantInput = actualReceiver;
       MapConstantValue constant = constantInput.constant;
-      return graph.addConstantInt(constant.length, compiler);
+      return graph.addConstantInt(constant.length, closedWorld);
     }
     return null;
   }
@@ -368,23 +380,21 @@
 
     // Try converting the instruction to a builtin instruction.
     HInstruction instruction =
-        node.specializer.tryConvertToBuiltin(node, compiler);
+        node.specializer.tryConvertToBuiltin(node, compiler, closedWorld);
     if (instruction != null) return instruction;
 
     Selector selector = node.selector;
     TypeMask mask = node.mask;
     HInstruction input = node.inputs[1];
 
-    ClosedWorld world = compiler.closedWorld;
-
-    bool applies(Element element) {
+    bool applies(MemberEntity element) {
       return selector.applies(element) &&
-          (mask == null || mask.canHit(element, selector, world));
+          (mask == null || mask.canHit(element, selector, closedWorld));
     }
 
     if (selector.isCall || selector.isOperator) {
-      MethodElement target;
-      if (input.isExtendableArray(compiler)) {
+      FunctionEntity target;
+      if (input.isExtendableArray(closedWorld)) {
         if (applies(helpers.jsArrayRemoveLast)) {
           target = helpers.jsArrayRemoveLast;
         } else if (applies(helpers.jsArrayAdd)) {
@@ -394,10 +404,10 @@
             target = helpers.jsArrayAdd;
           }
         }
-      } else if (input.isStringOrNull(compiler)) {
+      } else if (input.isStringOrNull(closedWorld)) {
         if (applies(helpers.jsStringSplit)) {
           HInstruction argument = node.inputs[2];
-          if (argument.isString(compiler)) {
+          if (argument.isString(closedWorld)) {
             target = helpers.jsStringSplit;
           }
         } else if (applies(helpers.jsStringOperatorAdd)) {
@@ -405,7 +415,7 @@
           // make sure the receiver and the argument are not null.
           // TODO(sra): Do this via [node.specializer].
           HInstruction argument = node.inputs[2];
-          if (argument.isString(compiler) && !input.canBeNull()) {
+          if (argument.isString(closedWorld) && !input.canBeNull()) {
             return new HStringConcat(input, argument, node.instructionType);
           }
         } else if (applies(helpers.jsStringToString) && !input.canBeNull()) {
@@ -443,9 +453,9 @@
       if (folded != node) return folded;
     }
 
-    TypeMask receiverType = node.getDartReceiver(compiler).instructionType;
-    Element element =
-        compiler.closedWorld.locateSingleElement(node.selector, receiverType);
+    TypeMask receiverType = node.getDartReceiver(closedWorld).instructionType;
+    MemberEntity element =
+        closedWorld.locateSingleElement(node.selector, receiverType);
     // TODO(ngeoffray): Also fold if it's a getter or variable.
     if (element != null &&
         element.isFunction
@@ -461,9 +471,12 @@
       } else {
         // TODO(ngeoffray): If the method has optional parameters,
         // we should pass the default values.
-        FunctionSignature parameters = method.functionSignature;
-        if (parameters.optionalParameterCount == 0 ||
-            parameters.parameterCount == node.selector.argumentCount) {
+        ResolutionFunctionType type = method.type;
+        int optionalParameterCount =
+            type.optionalParameterTypes.length + type.namedParameters.length;
+        if (optionalParameterCount == 0 ||
+            type.parameterTypes.length + optionalParameterCount ==
+                node.selector.argumentCount) {
           node.element = method;
         }
       }
@@ -477,10 +490,11 @@
     if (element != null &&
         element.isField &&
         element.name == node.selector.name) {
-      FieldElement field = element;
-      if (!backend.isNative(field) && !node.isCallOnInterceptor(compiler)) {
-        HInstruction receiver = node.getDartReceiver(compiler);
-        TypeMask type = TypeMaskFactory.inferredTypeForElement(field, compiler);
+      FieldEntity field = element;
+      if (!backend.isNative(field) && !node.isCallOnInterceptor(closedWorld)) {
+        HInstruction receiver = node.getDartReceiver(closedWorld);
+        TypeMask type = TypeMaskFactory.inferredTypeForElement(
+            field as Entity, globalInferenceResults);
         HInstruction load = new HFieldGet(field, receiver, type);
         node.block.addBefore(node, load);
         Selector callSelector = new Selector.callClosureFrom(node.selector);
@@ -515,8 +529,8 @@
     //   foo() native 'return something';
     // They should not be used.
 
-    FunctionSignature signature = method.functionSignature;
-    if (signature.optionalParametersAreNamed) return null;
+    ResolutionFunctionType type = method.type;
+    if (type.namedParameters.isNotEmpty) return null;
 
     // Return types on native methods don't need to be checked, since the
     // declaration has to be truthful.
@@ -525,23 +539,27 @@
     // preserve the number of arguments, so check only the actual arguments.
 
     List<HInstruction> inputs = node.inputs.sublist(1);
-    int inputPosition = 1; // Skip receiver.
     bool canInline = true;
-    signature.forEachParameter((ParameterElement element) {
-      if (inputPosition++ < inputs.length && canInline) {
-        DartType type = element.type.unaliased;
-        if (type is FunctionType) {
-          canInline = false;
-        }
-        if (compiler.options.enableTypeAssertions) {
-          // TODO(sra): Check if [input] is guaranteed to pass the parameter
-          // type check.  Consider using a strengthened type check to avoid
-          // passing `null` to primitive types since the native methods usually
-          // have non-nullable primitive parameter types.
-          canInline = false;
+    if (compiler.options.enableTypeAssertions && inputs.length > 1) {
+      // TODO(sra): Check if [input] is guaranteed to pass the parameter
+      // type check.  Consider using a strengthened type check to avoid
+      // passing `null` to primitive types since the native methods usually
+      // have non-nullable primitive parameter types.
+      canInline = false;
+    } else {
+      int inputPosition = 1; // Skip receiver.
+      void checkParameterType(ResolutionDartType type) {
+        if (inputPosition++ < inputs.length && canInline) {
+          if (type.unaliased.isFunctionType) {
+            canInline = false;
+          }
         }
       }
-    });
+
+      type.parameterTypes.forEach(checkParameterType);
+      type.optionalParameterTypes.forEach(checkParameterType);
+      type.namedParameterTypes.forEach(checkParameterType);
+    }
 
     if (!canInline) return null;
 
@@ -550,7 +568,7 @@
     native.NativeBehavior nativeBehavior =
         backend.getNativeMethodBehavior(method);
     TypeMask returnType =
-        TypeMaskFactory.fromNativeBehavior(nativeBehavior, compiler);
+        TypeMaskFactory.fromNativeBehavior(nativeBehavior, closedWorld);
     HInvokeDynamicMethod result =
         new HInvokeDynamicMethod(node.selector, node.mask, inputs, returnType);
     result.element = method;
@@ -559,7 +577,7 @@
 
   HInstruction visitBoundsCheck(HBoundsCheck node) {
     HInstruction index = node.index;
-    if (index.isInteger(compiler)) return node;
+    if (index.isInteger(closedWorld)) return node;
     if (index.isConstant()) {
       HConstant constantInstruction = index;
       assert(!constantInstruction.constant.isInt);
@@ -577,7 +595,7 @@
       HConstant op1 = left;
       HConstant op2 = right;
       ConstantValue folded = operation.fold(op1.constant, op2.constant);
-      if (folded != null) return graph.addConstant(folded, compiler);
+      if (folded != null) return graph.addConstant(folded, closedWorld);
     }
     return null;
   }
@@ -587,7 +605,7 @@
     HInstruction right = node.right;
     // We can only perform this rewriting on Integer, as it is not
     // valid for -0.0.
-    if (left.isInteger(compiler) && right.isInteger(compiler)) {
+    if (left.isInteger(closedWorld) && right.isInteger(closedWorld)) {
       if (left is HConstant && left.constant.isZero) return right;
       if (right is HConstant && right.constant.isZero) return left;
     }
@@ -597,7 +615,7 @@
   HInstruction visitMultiply(HMultiply node) {
     HInstruction left = node.left;
     HInstruction right = node.right;
-    if (left.isNumber(compiler) && right.isNumber(compiler)) {
+    if (left.isNumber(closedWorld) && right.isNumber(closedWorld)) {
       if (left is HConstant && left.constant.isOne) return right;
       if (right is HConstant && right.constant.isOne) return left;
     }
@@ -638,13 +656,14 @@
     TypeMask leftType = left.instructionType;
     TypeMask rightType = right.instructionType;
 
-    HInstruction makeTrue() => graph.addConstantBool(true, compiler);
-    HInstruction makeFalse() => graph.addConstantBool(false, compiler);
+    HInstruction makeTrue() => graph.addConstantBool(true, closedWorld);
+    HInstruction makeFalse() => graph.addConstantBool(false, closedWorld);
 
     // Intersection of int and double return conflicting, so
     // we don't optimize on numbers to preserve the runtime semantics.
-    if (!(left.isNumberOrNull(compiler) && right.isNumberOrNull(compiler))) {
-      if (leftType.isDisjoint(rightType, compiler.closedWorld)) {
+    if (!(left.isNumberOrNull(closedWorld) &&
+        right.isNumberOrNull(closedWorld))) {
+      if (leftType.isDisjoint(rightType, closedWorld)) {
         return makeFalse();
       }
     }
@@ -657,15 +676,15 @@
       if (constant.constant.isTrue) {
         return input;
       } else {
-        return new HNot(input, backend.boolType);
+        return new HNot(input, closedWorld.commonMasks.boolType);
       }
     }
 
-    if (left.isConstantBoolean() && right.isBoolean(compiler)) {
+    if (left.isConstantBoolean() && right.isBoolean(closedWorld)) {
       return compareConstant(left, right);
     }
 
-    if (right.isConstantBoolean() && left.isBoolean(compiler)) {
+    if (right.isConstantBoolean() && left.isBoolean(closedWorld)) {
       return compareConstant(right, left);
     }
 
@@ -674,8 +693,8 @@
       // dart2js runtime has not always been consistent with the Dart
       // specification (section 16.0.1), which makes distinctions on NaNs and
       // -0.0 that are hard to implement efficiently.
-      if (left.isIntegerOrNull(compiler)) return makeTrue();
-      if (!left.canBePrimitiveNumber(compiler)) return makeTrue();
+      if (left.isIntegerOrNull(closedWorld)) return makeTrue();
+      if (!left.canBePrimitiveNumber(closedWorld)) return makeTrue();
     }
 
     return null;
@@ -689,7 +708,7 @@
   void simplifyCondition(
       HBasicBlock block, HInstruction condition, bool value) {
     condition.dominatedUsers(block.first).forEach((user) {
-      HInstruction newCondition = graph.addConstantBool(value, compiler);
+      HInstruction newCondition = graph.addConstantBool(value, closedWorld);
       user.changeUse(condition, newCondition);
     });
   }
@@ -720,57 +739,56 @@
   }
 
   HInstruction visitIs(HIs node) {
-    DartType type = node.typeExpression;
-    Element element = type.element;
+    ResolutionDartType type = node.typeExpression;
 
     if (!node.isRawCheck) {
       return node;
     } else if (type.isTypedef) {
       return node;
-    } else if (element == coreClasses.functionClass) {
+    } else if (type.isFunctionType) {
       return node;
     }
 
     if (type.isObject || type.treatAsDynamic) {
-      return graph.addConstantBool(true, compiler);
+      return graph.addConstantBool(true, closedWorld);
     }
-
-    ClosedWorld closedWorld = compiler.closedWorld;
+    ResolutionInterfaceType interfaceType = type;
+    ClassEntity element = interfaceType.element;
     HInstruction expression = node.expression;
-    if (expression.isInteger(compiler)) {
-      if (element == coreClasses.intClass ||
-          element == coreClasses.numClass ||
-          Elements.isNumberOrStringSupertype(element, compiler)) {
-        return graph.addConstantBool(true, compiler);
-      } else if (element == coreClasses.doubleClass) {
+    if (expression.isInteger(closedWorld)) {
+      if (element == commonElements.intClass ||
+          element == commonElements.numClass ||
+          commonElements.isNumberOrStringSupertype(element)) {
+        return graph.addConstantBool(true, closedWorld);
+      } else if (element == commonElements.doubleClass) {
         // We let the JS semantics decide for that check. Currently
         // the code we emit will always return true.
         return node;
       } else {
-        return graph.addConstantBool(false, compiler);
+        return graph.addConstantBool(false, closedWorld);
       }
-    } else if (expression.isDouble(compiler)) {
-      if (element == coreClasses.doubleClass ||
-          element == coreClasses.numClass ||
-          Elements.isNumberOrStringSupertype(element, compiler)) {
-        return graph.addConstantBool(true, compiler);
-      } else if (element == coreClasses.intClass) {
+    } else if (expression.isDouble(closedWorld)) {
+      if (element == commonElements.doubleClass ||
+          element == commonElements.numClass ||
+          commonElements.isNumberOrStringSupertype(element)) {
+        return graph.addConstantBool(true, closedWorld);
+      } else if (element == commonElements.intClass) {
         // We let the JS semantics decide for that check. Currently
         // the code we emit will return true for a double that can be
         // represented as a 31-bit integer and for -0.0.
         return node;
       } else {
-        return graph.addConstantBool(false, compiler);
+        return graph.addConstantBool(false, closedWorld);
       }
-    } else if (expression.isNumber(compiler)) {
-      if (element == coreClasses.numClass) {
-        return graph.addConstantBool(true, compiler);
+    } else if (expression.isNumber(closedWorld)) {
+      if (element == commonElements.numClass) {
+        return graph.addConstantBool(true, closedWorld);
       } else {
         // We cannot just return false, because the expression may be of
         // type int or double.
       }
-    } else if (expression.canBePrimitiveNumber(compiler) &&
-        element == coreClasses.intClass) {
+    } else if (expression.canBePrimitiveNumber(closedWorld) &&
+        element == commonElements.intClass) {
       // We let the JS semantics decide for that check.
       return node;
       // We need the [:hasTypeArguments:] check because we don't have
@@ -780,20 +798,20 @@
     } else if (!RuntimeTypes.hasTypeArguments(type)) {
       TypeMask expressionMask = expression.instructionType;
       assert(TypeMask.assertIsNormalized(expressionMask, closedWorld));
-      TypeMask typeMask = (element == coreClasses.nullClass)
+      TypeMask typeMask = (element == commonElements.nullClass)
           ? new TypeMask.subtype(element, closedWorld)
           : new TypeMask.nonNullSubtype(element, closedWorld);
       if (expressionMask.union(typeMask, closedWorld) == typeMask) {
-        return graph.addConstantBool(true, compiler);
-      } else if (expressionMask.isDisjoint(typeMask, compiler.closedWorld)) {
-        return graph.addConstantBool(false, compiler);
+        return graph.addConstantBool(true, closedWorld);
+      } else if (expressionMask.isDisjoint(typeMask, closedWorld)) {
+        return graph.addConstantBool(false, closedWorld);
       }
     }
     return node;
   }
 
   HInstruction visitTypeConversion(HTypeConversion node) {
-    DartType type = node.typeExpression;
+    ResolutionDartType type = node.typeExpression;
     if (type != null) {
       if (type.isMalformed) {
         // Malformed types are treated as dynamic statically, but should
@@ -830,7 +848,6 @@
   }
 
   HInstruction removeIfCheckAlwaysSucceeds(HCheck node, TypeMask checkedType) {
-    ClosedWorld closedWorld = compiler.closedWorld;
     if (checkedType.containsAll(closedWorld)) return node;
     HInstruction input = node.checkedInput;
     TypeMask inputType = input.instructionType;
@@ -839,10 +856,10 @@
 
   HInstruction removeCheck(HCheck node) => node.checkedInput;
 
-  FieldElement findConcreteFieldForDynamicAccess(
+  FieldEntity findConcreteFieldForDynamicAccess(
       HInstruction receiver, Selector selector) {
     TypeMask receiverType = receiver.instructionType;
-    return compiler.closedWorld.locateSingleField(selector, receiverType);
+    return closedWorld.locateSingleField(selector, receiverType);
   }
 
   HInstruction visitFieldGet(HFieldGet node) {
@@ -854,15 +871,16 @@
         // should not be necessary but it currently makes it easier for
         // other optimizations to reason about a fixed length constructor
         // that we know takes an int.
-        if (receiver.inputs[0].isInteger(compiler)) {
+        if (receiver.inputs[0].isInteger(closedWorld)) {
           return receiver.inputs[0];
         }
       } else if (receiver.isConstantList() || receiver.isConstantString()) {
-        return graph.addConstantInt(receiver.constant.length, compiler);
+        return graph.addConstantInt(receiver.constant.length, closedWorld);
       } else {
         var type = receiver.instructionType;
         if (type.isContainer && type.length != null) {
-          HInstruction constant = graph.addConstantInt(type.length, compiler);
+          HInstruction constant =
+              graph.addConstantInt(type.length, closedWorld);
           if (type.isNullable) {
             // If the container can be null, we update all uses of the
             // length access to use the constant instead, but keep the
@@ -883,10 +901,10 @@
       ConstantValue constant = receiver.constant;
       if (constant.isConstructedObject) {
         ConstructedConstantValue constructedConstant = constant;
-        Map<Element, ConstantValue> fields = constructedConstant.fields;
+        Map<FieldEntity, ConstantValue> fields = constructedConstant.fields;
         ConstantValue value = fields[node.element];
         if (value != null) {
-          return graph.addConstant(value, compiler);
+          return graph.addConstant(value, closedWorld);
         }
       }
     }
@@ -901,7 +919,7 @@
       instruction = node.index;
       int index = instruction.constant.primitiveValue;
       if (index >= 0 && index < entries.length) {
-        return graph.addConstant(entries[index], compiler);
+        return graph.addConstant(entries[index], closedWorld);
       }
     }
     return node;
@@ -913,14 +931,14 @@
       HInstruction folded = handleInterceptedCall(node);
       if (folded != node) return folded;
     }
-    HInstruction receiver = node.getDartReceiver(compiler);
-    FieldElement field =
+    HInstruction receiver = node.getDartReceiver(closedWorld);
+    FieldEntity field =
         findConcreteFieldForDynamicAccess(receiver, node.selector);
     if (field != null) return directFieldGet(receiver, field);
 
     if (node.element == null) {
-      MemberElement element = compiler.closedWorld
-          .locateSingleElement(node.selector, receiver.instructionType);
+      MemberEntity element = closedWorld.locateSingleElement(
+          node.selector, receiver.instructionType);
       if (element != null && element.name == node.selector.name) {
         node.element = element;
         if (element.isFunction) {
@@ -934,15 +952,16 @@
     return node;
   }
 
-  HInstruction directFieldGet(HInstruction receiver, FieldElement field) {
-    bool isAssignable = !compiler.closedWorld.fieldNeverChanges(field);
+  HInstruction directFieldGet(HInstruction receiver, FieldEntity field) {
+    bool isAssignable = !closedWorld.fieldNeverChanges(field as MemberEntity);
 
     TypeMask type;
     if (backend.isNative(field.enclosingClass)) {
       type = TypeMaskFactory.fromNativeBehavior(
-          backend.getNativeFieldLoadBehavior(field), compiler);
+          backend.getNativeFieldLoadBehavior(field), closedWorld);
     } else {
-      type = TypeMaskFactory.inferredTypeForElement(field, compiler);
+      type = TypeMaskFactory.inferredTypeForElement(
+          field as Entity, globalInferenceResults);
     }
 
     return new HFieldGet(field, receiver, type, isAssignable: isAssignable);
@@ -954,7 +973,7 @@
       if (folded != node) return folded;
     }
 
-    HInstruction receiver = node.getDartReceiver(compiler);
+    HInstruction receiver = node.getDartReceiver(closedWorld);
     FieldElement field =
         findConcreteFieldForDynamicAccess(receiver, node.selector);
     if (field == null || !field.isAssignable) return node;
@@ -962,7 +981,7 @@
     // convention, but is not a call on an interceptor.
     HInstruction value = node.inputs.last;
     if (compiler.options.enableTypeAssertions) {
-      DartType type = field.type;
+      ResolutionDartType type = field.type;
       if (!type.treatAsRaw ||
           type.isTypeVariable ||
           type.unaliased.isFunctionType) {
@@ -972,8 +991,8 @@
         // can skip the test an generate the HFieldSet.
         return node;
       }
-      HInstruction other =
-          value.convertType(compiler, type, HTypeConversion.CHECKED_MODE_CHECK);
+      HInstruction other = value.convertType(
+          closedWorld, type, HTypeConversion.CHECKED_MODE_CHECK);
       if (other != value) {
         node.block.addBefore(node, other);
         value = other;
@@ -984,9 +1003,15 @@
 
   HInstruction visitInvokeStatic(HInvokeStatic node) {
     propagateConstantValueToUses(node);
-    MemberElement element = node.element;
+    MemberEntity element = node.element;
 
-    if (element == backend.helpers.checkConcurrentModificationError) {
+    if (element == compiler.commonElements.identicalFunction) {
+      if (node.inputs.length == 2) {
+        return new HIdentity(node.inputs[0], node.inputs[1], null,
+            closedWorld.commonMasks.boolType)
+          ..sourceInformation = node.sourceInformation;
+      }
+    } else if (element == backend.helpers.checkConcurrentModificationError) {
       if (node.inputs.length == 2) {
         HInstruction firstArgument = node.inputs[0];
         if (firstArgument is HConstant) {
@@ -997,17 +1022,17 @@
     } else if (element == backend.helpers.checkInt) {
       if (node.inputs.length == 1) {
         HInstruction argument = node.inputs[0];
-        if (argument.isInteger(compiler)) return argument;
+        if (argument.isInteger(closedWorld)) return argument;
       }
     } else if (element == backend.helpers.checkNum) {
       if (node.inputs.length == 1) {
         HInstruction argument = node.inputs[0];
-        if (argument.isNumber(compiler)) return argument;
+        if (argument.isNumber(closedWorld)) return argument;
       }
     } else if (element == backend.helpers.checkString) {
       if (node.inputs.length == 1) {
         HInstruction argument = node.inputs[0];
-        if (argument.isString(compiler)) return argument;
+        if (argument.isString(closedWorld)) return argument;
       }
     }
     return node;
@@ -1055,14 +1080,15 @@
     HInstruction folded = graph.addConstant(
         constantSystem.createString(new ast.DartString.concat(
             leftString.primitiveValue, rightString.primitiveValue)),
-        compiler);
+        closedWorld);
     if (prefix == null) return folded;
-    return new HStringConcat(prefix, folded, backend.stringType);
+    return new HStringConcat(
+        prefix, folded, closedWorld.commonMasks.stringType);
   }
 
   HInstruction visitStringify(HStringify node) {
     HInstruction input = node.inputs[0];
-    if (input.isString(compiler)) return input;
+    if (input.isString(closedWorld)) return input;
 
     HInstruction tryConstant() {
       if (!input.isConstant()) return null;
@@ -1078,7 +1104,7 @@
       }
       PrimitiveConstantValue primitive = constant.constant;
       return graph.addConstant(
-          constantSystem.createString(primitive.toDartString()), compiler);
+          constantSystem.createString(primitive.toDartString()), closedWorld);
     }
 
     HInstruction tryToString() {
@@ -1086,12 +1112,11 @@
       // it directly. Keep the stringifier for primitives (since they have fast
       // path code in the stringifier) and for classes requiring interceptors
       // (since SsaInstructionSimplifier runs after SsaSimplifyInterceptors).
-      if (input.canBePrimitive(compiler)) return null;
+      if (input.canBePrimitive(closedWorld)) return null;
       if (input.canBeNull()) return null;
       Selector selector = Selectors.toString_;
       TypeMask toStringType = TypeMaskFactory.inferredTypeForSelector(
-          selector, input.instructionType, compiler);
-      ClosedWorld closedWorld = compiler.closedWorld;
+          selector, input.instructionType, globalInferenceResults);
       if (!toStringType.containsOnlyString(closedWorld)) return null;
       // All intercepted classes extend `Interceptor`, so if the receiver can't
       // be a class extending `Interceptor` then it can be called directly.
@@ -1115,11 +1140,10 @@
     return handleInterceptedCall(node);
   }
 
-  bool needsSubstitutionForTypeVariableAccess(ClassElement cls) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+  bool needsSubstitutionForTypeVariableAccess(ClassEntity cls) {
     if (closedWorld.isUsedAsMixin(cls)) return true;
 
-    return closedWorld.anyStrictSubclassOf(cls, (ClassElement subclass) {
+    return closedWorld.anyStrictSubclassOf(cls, (ClassEntity subclass) {
       return !backend.rti.isTrivialSubstitution(subclass, cls);
     });
   }
@@ -1169,7 +1193,7 @@
       }
 
       if (source == null) return null;
-      return new HTypeInfoReadRaw(source, backend.dynamicType);
+      return new HTypeInfoReadRaw(source, closedWorld.commonMasks.dynamicType);
     }
 
     // TODO(sra): Consider fusing type expression trees with no type variables,
@@ -1179,20 +1203,20 @@
   }
 
   HInstruction visitTypeInfoReadVariable(HTypeInfoReadVariable node) {
-    TypeVariableType variable = node.variable;
+    ResolutionTypeVariableType variable = node.variable;
     HInstruction object = node.object;
 
-    HInstruction finishGroundType(InterfaceType groundType) {
-      InterfaceType typeAtVariable =
+    HInstruction finishGroundType(ResolutionInterfaceType groundType) {
+      ResolutionInterfaceType typeAtVariable =
           groundType.asInstanceOf(variable.element.enclosingClass);
       if (typeAtVariable != null) {
         int index = variable.element.index;
-        DartType typeArgument = typeAtVariable.typeArguments[index];
+        ResolutionDartType typeArgument = typeAtVariable.typeArguments[index];
         HInstruction replacement = new HTypeInfoExpression(
             TypeInfoExpressionKind.COMPLETE,
             typeArgument,
             const <HInstruction>[],
-            backend.dynamicType);
+            closedWorld.commonMasks.dynamicType);
         return replacement;
       }
       return node;
@@ -1203,15 +1227,15 @@
     /// the allocation for factory constructor call.
     HInstruction finishSubstituted(ClassElement createdClass,
         HInstruction selectTypeArgumentFromObjectCreation(int index)) {
-      HInstruction instructionForTypeVariable(TypeVariableType tv) {
+      HInstruction instructionForTypeVariable(ResolutionTypeVariableType tv) {
         return selectTypeArgumentFromObjectCreation(
             createdClass.thisType.typeArguments.indexOf(tv));
       }
 
-      DartType type = createdClass.thisType
+      ResolutionDartType type = createdClass.thisType
           .asInstanceOf(variable.element.enclosingClass)
           .typeArguments[variable.element.index];
-      if (type is TypeVariableType) {
+      if (type is ResolutionTypeVariableType) {
         return instructionForTypeVariable(type);
       }
       List<HInstruction> arguments = <HInstruction>[];
@@ -1222,7 +1246,7 @@
           TypeInfoExpressionKind.COMPLETE,
           type,
           arguments,
-          backend.dynamicType);
+          closedWorld.commonMasks.dynamicType);
       return replacement;
     }
 
@@ -1273,7 +1297,7 @@
         return finishSubstituted(
             object.element,
             // If there are type arguments, all type arguments are 'dynamic'.
-            (int i) => graph.addConstantNull(compiler));
+            (int i) => graph.addConstantNull(closedWorld));
       }
     }
 
@@ -1289,10 +1313,12 @@
   final Set<HInstruction> boundsChecked;
   final bool trustPrimitives;
   final JavaScriptBackend backend;
+  final ClosedWorld closedWorld;
   final String name = "SsaCheckInserter";
   HGraph graph;
 
-  SsaCheckInserter(this.trustPrimitives, this.backend, this.boundsChecked);
+  SsaCheckInserter(
+      this.trustPrimitives, this.backend, this.closedWorld, this.boundsChecked);
 
   BackendHelpers get helpers => backend.helpers;
 
@@ -1318,15 +1344,14 @@
 
   HBoundsCheck insertBoundsCheck(
       HInstruction indexNode, HInstruction array, HInstruction indexArgument) {
-    Compiler compiler = backend.compiler;
-    HFieldGet length = new HFieldGet(
-        helpers.jsIndexableLength, array, backend.positiveIntType,
-        isAssignable: !isFixedLength(array.instructionType, compiler));
+    HFieldGet length = new HFieldGet(helpers.jsIndexableLength, array,
+        closedWorld.commonMasks.positiveIntType,
+        isAssignable: !isFixedLength(array.instructionType, closedWorld));
     indexNode.block.addBefore(indexNode, length);
 
-    TypeMask type = indexArgument.isPositiveInteger(compiler)
+    TypeMask type = indexArgument.isPositiveInteger(closedWorld)
         ? indexArgument.instructionType
-        : backend.positiveIntType;
+        : closedWorld.commonMasks.positiveIntType;
     HBoundsCheck check = new HBoundsCheck(indexArgument, length, array, type);
     indexNode.block.addBefore(indexNode, check);
     // If the index input to the bounds check was not known to be an integer
@@ -1336,7 +1361,7 @@
     // the index eg. if it is a constant.  The range information from the
     // BoundsCheck instruction is attached to the input directly by
     // visitBoundsCheck in the SsaValueRangeAnalyzer.
-    if (!indexArgument.isInteger(compiler)) {
+    if (!indexArgument.isInteger(closedWorld)) {
       indexArgument.replaceAllUsersDominatedBy(indexNode, check);
     }
     boundsChecked.add(indexNode);
@@ -1356,15 +1381,15 @@
   }
 
   void visitInvokeDynamicMethod(HInvokeDynamicMethod node) {
-    MemberElement element = node.element;
+    MemberEntity element = node.element;
     if (node.isInterceptedCall) return;
     if (element != helpers.jsArrayRemoveLast) return;
     if (boundsChecked.contains(node)) return;
     // `0` is the index we want to check, but we want to report `-1`, as if we
     // executed `a[a.length-1]`
     HBoundsCheck check = insertBoundsCheck(
-        node, node.receiver, graph.addConstantInt(0, backend.compiler));
-    HInstruction minusOne = graph.addConstantInt(-1, backend.compiler);
+        node, node.receiver, graph.addConstantInt(0, closedWorld));
+    HInstruction minusOne = graph.addConstantInt(-1, closedWorld);
     check.inputs.add(minusOne);
     minusOne.usedBy.add(check);
   }
@@ -1373,14 +1398,14 @@
 class SsaDeadCodeEliminator extends HGraphVisitor implements OptimizationPhase {
   final String name = "SsaDeadCodeEliminator";
 
-  final Compiler compiler;
+  final ClosedWorld closedWorld;
   final SsaOptimizerTask optimizer;
   SsaLiveBlockAnalyzer analyzer;
   Map<HInstruction, bool> trivialDeadStoreReceivers =
       new Maplet<HInstruction, bool>();
   bool eliminatedSideEffects = false;
 
-  SsaDeadCodeEliminator(this.compiler, this.optimizer);
+  SsaDeadCodeEliminator(this.closedWorld, this.optimizer);
 
   HInstruction zapInstructionCache;
   HInstruction get zapInstruction {
@@ -1388,7 +1413,7 @@
       // A constant with no type does not pollute types at phi nodes.
       ConstantValue constant = new SyntheticConstantValue(
           SyntheticConstantKind.EMPTY_VALUE, const TypeMask.nonNullEmpty());
-      zapInstructionCache = analyzer.graph.addConstant(constant, compiler);
+      zapInstructionCache = analyzer.graph.addConstant(constant, closedWorld);
     }
     return zapInstructionCache;
   }
@@ -1431,10 +1456,10 @@
   /// effects after [instruction], throws [NoSuchMethodError] on the
   /// same receiver of [instruction].
   bool hasFollowingThrowingNSM(HInstruction instruction) {
-    HInstruction receiver = instruction.getDartReceiver(compiler);
+    HInstruction receiver = instruction.getDartReceiver(closedWorld);
     HInstruction current = instruction.next;
     do {
-      if ((current.getDartReceiver(compiler) == receiver) &&
+      if ((current.getDartReceiver(closedWorld) == receiver) &&
           current.canThrow()) {
         return true;
       }
@@ -1478,9 +1503,9 @@
       if (use is HFieldSet) {
         // The use must be the receiver.  Even if the use is also the argument,
         // i.e.  a.x = a, the store is still dead if all other uses are dead.
-        if (use.getDartReceiver(compiler) == instruction) return true;
+        if (use.getDartReceiver(closedWorld) == instruction) return true;
       } else if (use is HFieldGet) {
-        assert(use.getDartReceiver(compiler) == instruction);
+        assert(use.getDartReceiver(closedWorld) == instruction);
         if (isDeadCode(use)) return true;
       }
       return false;
@@ -1494,7 +1519,7 @@
 
   bool isTrivialDeadStore(HInstruction instruction) {
     return instruction is HFieldSet &&
-        isTrivialDeadStoreReceiver(instruction.getDartReceiver(compiler));
+        isTrivialDeadStoreReceiver(instruction.getDartReceiver(closedWorld));
   }
 
   bool isDeadCode(HInstruction instruction) {
@@ -1512,7 +1537,7 @@
   }
 
   void visitGraph(HGraph graph) {
-    analyzer = new SsaLiveBlockAnalyzer(graph, compiler, optimizer);
+    analyzer = new SsaLiveBlockAnalyzer(graph, closedWorld, optimizer);
     analyzer.analyze();
     visitPostDominatorTree(graph);
     cleanPhis(graph);
@@ -1600,9 +1625,9 @@
   final Set<HBasicBlock> live = new Set<HBasicBlock>();
   final List<HBasicBlock> worklist = <HBasicBlock>[];
   final SsaOptimizerTask optimizer;
-  final Compiler compiler;
+  final ClosedWorld closedWorld;
 
-  SsaLiveBlockAnalyzer(this.graph, this.compiler, this.optimizer);
+  SsaLiveBlockAnalyzer(this.graph, this.closedWorld, this.optimizer);
 
   Map<HInstruction, Range> get ranges => optimizer.ranges;
 
@@ -1641,7 +1666,7 @@
   }
 
   void visitSwitch(HSwitch node) {
-    if (node.expression.isInteger(compiler)) {
+    if (node.expression.isInteger(closedWorld)) {
       Range switchRange = ranges[node.expression];
       if (switchRange != null &&
           switchRange.lower is IntValue &&
@@ -1783,13 +1808,12 @@
 
 class SsaGlobalValueNumberer implements OptimizationPhase {
   final String name = "SsaGlobalValueNumberer";
-  final Compiler compiler;
   final Set<int> visited;
 
   List<int> blockChangesFlags;
   List<int> loopChangesFlags;
 
-  SsaGlobalValueNumberer(this.compiler) : visited = new Set<int>();
+  SsaGlobalValueNumberer() : visited = new Set<int>();
 
   void visitGraph(HGraph graph) {
     computeChangesFlags(graph);
@@ -2095,9 +2119,9 @@
 class SsaTypeConversionInserter extends HBaseVisitor
     implements OptimizationPhase {
   final String name = "SsaTypeconversionInserter";
-  final Compiler compiler;
+  final ClosedWorld closedWorld;
 
-  SsaTypeConversionInserter(this.compiler);
+  SsaTypeConversionInserter(this.closedWorld);
 
   void visitGraph(HGraph graph) {
     visitDominatorTree(graph);
@@ -2120,13 +2144,14 @@
   }
 
   void visitIs(HIs instruction) {
-    DartType type = instruction.typeExpression;
-    Element element = type.element;
+    ResolutionDartType type = instruction.typeExpression;
     if (!instruction.isRawCheck) {
       return;
-    } else if (element.isTypedef) {
+    } else if (type.isTypedef) {
       return;
     }
+    ResolutionInterfaceType interfaceType = type;
+    ClassEntity cls = interfaceType.element;
 
     List<HBasicBlock> trueTargets = <HBasicBlock>[];
     List<HBasicBlock> falseTargets = <HBasicBlock>[];
@@ -2135,8 +2160,7 @@
 
     if (trueTargets.isEmpty && falseTargets.isEmpty) return;
 
-    TypeMask convertedType =
-        new TypeMask.nonNullSubtype(element, compiler.closedWorld);
+    TypeMask convertedType = new TypeMask.nonNullSubtype(cls, closedWorld);
     HInstruction input = instruction.expression;
 
     for (HBasicBlock block in trueTargets) {
@@ -2218,11 +2242,12 @@
  */
 class SsaLoadElimination extends HBaseVisitor implements OptimizationPhase {
   final Compiler compiler;
+  final ClosedWorld closedWorld;
   final String name = "SsaLoadElimination";
   MemorySet memorySet;
   List<MemorySet> memories;
 
-  SsaLoadElimination(this.compiler);
+  SsaLoadElimination(this.compiler, this.closedWorld);
 
   void visitGraph(HGraph graph) {
     memories = new List<MemorySet>(graph.blocks.length);
@@ -2244,7 +2269,7 @@
   void visitBasicBlock(HBasicBlock block) {
     if (block.predecessors.length == 0) {
       // Entry block.
-      memorySet = new MemorySet(compiler);
+      memorySet = new MemorySet(closedWorld);
     } else if (block.predecessors.length == 1 &&
         block.predecessors[0].successors.length == 1) {
       // No need to clone, there is no other successor for
@@ -2277,8 +2302,8 @@
 
   void visitFieldGet(HFieldGet instruction) {
     if (instruction.isNullCheck) return;
-    MemberElement element = instruction.element;
-    HInstruction receiver = instruction.getDartReceiver(compiler).nonCheck();
+    MemberEntity element = instruction.element;
+    HInstruction receiver = instruction.getDartReceiver(closedWorld).nonCheck();
     HInstruction existing = memorySet.lookupFieldValue(element, receiver);
     if (existing != null) {
       instruction.block.rewriteWithBetterUser(instruction, existing);
@@ -2289,7 +2314,7 @@
   }
 
   void visitFieldSet(HFieldSet instruction) {
-    HInstruction receiver = instruction.getDartReceiver(compiler).nonCheck();
+    HInstruction receiver = instruction.getDartReceiver(closedWorld).nonCheck();
     memorySet.registerFieldValueUpdate(
         instruction.element, receiver, instruction.inputs.last);
   }
@@ -2298,11 +2323,12 @@
     memorySet.registerAllocation(instruction);
     if (shouldTrackInitialValues(instruction)) {
       int argumentIndex = 0;
-      instruction.element.forEachInstanceField((_, FieldElement member) {
-        if (compiler.elementHasCompileTimeError(member)) return;
+      compiler.codegenWorldBuilder.forEachInstanceField(instruction.element,
+          (_, FieldEntity member) {
+        if (compiler.elementHasCompileTimeError(member as Entity)) return;
         memorySet.registerFieldValue(
             member, instruction, instruction.inputs[argumentIndex++]);
-      }, includeSuperAndInjectedMembers: true);
+      });
     }
     // In case this instruction has as input non-escaping objects, we
     // need to mark these objects as escaping.
@@ -2355,11 +2381,11 @@
   }
 
   void visitLazyStatic(HLazyStatic instruction) {
-    FieldElement field = instruction.element;
+    FieldEntity field = instruction.element;
     handleStaticLoad(field, instruction);
   }
 
-  void handleStaticLoad(MemberElement element, HInstruction instruction) {
+  void handleStaticLoad(MemberEntity element, HInstruction instruction) {
     HInstruction existing = memorySet.lookupFieldValue(element, null);
     if (existing != null) {
       instruction.block.rewriteWithBetterUser(instruction, existing);
@@ -2429,13 +2455,13 @@
  * refinements to help further optimizations.
  */
 class MemorySet {
-  final Compiler compiler;
+  final ClosedWorld closedWorld;
 
   /**
    * Maps a field to a map of receiver to value.
    */
-  final Map<Element, Map<HInstruction, HInstruction>> fieldValues =
-      <Element, Map<HInstruction, HInstruction>>{};
+  final Map<MemberEntity, Map<HInstruction, HInstruction>> fieldValues =
+      <MemberEntity, Map<HInstruction, HInstruction>>{};
 
   /**
    * Maps a receiver to a map of keys to value.
@@ -2448,9 +2474,7 @@
    */
   final Setlet<HInstruction> nonEscapingReceivers = new Setlet<HInstruction>();
 
-  MemorySet(this.compiler);
-
-  JavaScriptBackend get backend => compiler.backend;
+  MemorySet(this.closedWorld);
 
   /**
    * Returns whether [first] and [second] always alias to the same object.
@@ -2470,11 +2494,11 @@
     // Typed arrays of different types might have a shared buffer.
     if (couldBeTypedArray(first) && couldBeTypedArray(second)) return true;
     return !first.instructionType
-        .isDisjoint(second.instructionType, compiler.closedWorld);
+        .isDisjoint(second.instructionType, closedWorld);
   }
 
-  bool isFinal(Element element) {
-    return compiler.closedWorld.fieldNeverChanges(element);
+  bool isFinal(MemberEntity element) {
+    return closedWorld.fieldNeverChanges(element);
   }
 
   bool isConcrete(HInstruction instruction) {
@@ -2484,8 +2508,7 @@
   }
 
   bool couldBeTypedArray(HInstruction receiver) {
-    JavaScriptBackend backend = compiler.backend;
-    return backend.couldBeTypedArray(receiver.instructionType);
+    return closedWorld.commonMasks.couldBeTypedArray(receiver.instructionType);
   }
 
   /**
@@ -2506,9 +2529,9 @@
    * may be affected by this update.
    */
   void registerFieldValueUpdate(
-      MemberElement element, HInstruction receiver, HInstruction value) {
+      MemberEntity element, HInstruction receiver, HInstruction value) {
     assert(receiver == null || receiver == receiver.nonCheck());
-    if (backend.isNative(element)) {
+    if (closedWorld.backendClasses.isNativeMember(element)) {
       return; // TODO(14955): Remove this restriction?
     }
     // [value] is being set in some place in memory, we remove it from
@@ -2526,9 +2549,9 @@
    * Registers that `receiver.element` is now [value].
    */
   void registerFieldValue(
-      MemberElement element, HInstruction receiver, HInstruction value) {
+      MemberEntity element, HInstruction receiver, HInstruction value) {
     assert(receiver == null || receiver == receiver.nonCheck());
-    if (backend.isNative(element)) {
+    if (closedWorld.backendClasses.isNativeMember(element)) {
       return; // TODO(14955): Remove this restriction?
     }
     Map<HInstruction, HInstruction> map =
@@ -2540,7 +2563,7 @@
    * Returns the value stored in `receiver.element`. Returns `null` if we don't
    * know.
    */
-  HInstruction lookupFieldValue(Element element, HInstruction receiver) {
+  HInstruction lookupFieldValue(MemberEntity element, HInstruction receiver) {
     assert(receiver == null || receiver == receiver.nonCheck());
     Map<HInstruction, HInstruction> map = fieldValues[element];
     return (map == null) ? null : map[receiver];
@@ -2561,7 +2584,7 @@
 
     if (instruction.sideEffects.changesInstanceProperty() ||
         instruction.sideEffects.changesStaticProperty()) {
-      fieldValues.forEach((element, map) {
+      fieldValues.forEach((MemberEntity element, map) {
         if (isFinal(element)) return;
         map.forEach((receiver, value) {
           if (escapes(receiver)) {
@@ -2638,8 +2661,8 @@
       HBasicBlock block, int predecessorIndex) {
     if (first == null || second == null) return null;
     if (first == second) return first;
-    TypeMask phiType = second.instructionType
-        .union(first.instructionType, compiler.closedWorld);
+    TypeMask phiType =
+        second.instructionType.union(first.instructionType, closedWorld);
     if (first is HPhi && first.block == block) {
       HPhi phi = first;
       phi.addInput(second);
@@ -2663,7 +2686,7 @@
    */
   MemorySet intersectionFor(
       MemorySet other, HBasicBlock block, int predecessorIndex) {
-    MemorySet result = new MemorySet(compiler);
+    MemorySet result = new MemorySet(closedWorld);
     if (other == null) {
       // This is the first visit to a loop header ([other] is `null` because we
       // have not visited the back edge). Copy the nonEscapingReceivers that are
@@ -2728,7 +2751,7 @@
    * Returns a copy of [this].
    */
   MemorySet clone() {
-    MemorySet result = new MemorySet(compiler);
+    MemorySet result = new MemorySet(closedWorld);
 
     fieldValues.forEach((element, values) {
       result.fieldValues[element] =
diff --git a/pkg/compiler/lib/src/ssa/ssa.dart b/pkg/compiler/lib/src/ssa/ssa.dart
index 55b13b0..92f05f9 100644
--- a/pkg/compiler/lib/src/ssa/ssa.dart
+++ b/pkg/compiler/lib/src/ssa/ssa.dart
@@ -10,6 +10,7 @@
 import '../io/source_information.dart';
 import '../js/js.dart' as js;
 import '../js_backend/backend.dart' show JavaScriptBackend, FunctionCompiler;
+import '../world.dart' show ClosedWorld;
 
 import 'builder.dart';
 import 'builder_kernel.dart';
@@ -36,11 +37,13 @@
 
   /// Generates JavaScript code for `work.element`.
   /// Using the ssa builder, optimizer and codegenerator.
-  js.Fun compile(CodegenWorkItem work) {
-    HGraph graph = useKernel ? builderKernel.build(work) : builder.build(work);
-    optimizer.optimize(work, graph);
+  js.Fun compile(CodegenWorkItem work, ClosedWorld closedWorld) {
+    HGraph graph = useKernel
+        ? builderKernel.build(work, closedWorld)
+        : builder.build(work, closedWorld);
+    optimizer.optimize(work, graph, closedWorld);
     Element element = work.element;
-    js.Expression result = generator.generateCode(work, graph);
+    js.Expression result = generator.generateCode(work, graph, closedWorld);
     if (element is FunctionElement) {
       // TODO(sigmund): replace by kernel transformer when `useKernel` is true.
       result = backend.rewriteAsync(element, result);
diff --git a/pkg/compiler/lib/src/ssa/ssa_branch_builder.dart b/pkg/compiler/lib/src/ssa/ssa_branch_builder.dart
index c0dfa0b..8c1fa21 100644
--- a/pkg/compiler/lib/src/ssa/ssa_branch_builder.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_branch_builder.dart
@@ -161,8 +161,7 @@
       boolifiedLeft = builder.popBoolified();
       builder.stack.add(boolifiedLeft);
       if (!isAnd) {
-        JavaScriptBackend backend = compiler.backend;
-        builder.push(new HNot(builder.pop(), backend.boolType));
+        builder.push(new HNot(builder.pop(), builder.commonMasks.boolType));
       }
     }
 
@@ -172,10 +171,12 @@
     }
 
     handleIf(visitCondition, visitThen, null);
-    HConstant notIsAnd = builder.graph.addConstantBool(!isAnd, compiler);
-    JavaScriptBackend backend = compiler.backend;
+    HConstant notIsAnd =
+        builder.graph.addConstantBool(!isAnd, builder.closedWorld);
     HPhi result = new HPhi.manyInputs(
-        null, <HInstruction>[boolifiedRight, notIsAnd], backend.dynamicType);
+        null,
+        <HInstruction>[boolifiedRight, notIsAnd],
+        builder.commonMasks.dynamicType);
     builder.current.addPhi(result);
     builder.stack.add(result);
   }
@@ -200,9 +201,8 @@
 
     if (isExpression) {
       assert(thenValue != null && elseValue != null);
-      JavaScriptBackend backend = compiler.backend;
-      HPhi phi = new HPhi.manyInputs(
-          null, <HInstruction>[thenValue, elseValue], backend.dynamicType);
+      HPhi phi = new HPhi.manyInputs(null, <HInstruction>[thenValue, elseValue],
+          builder.commonMasks.dynamicType);
       joinBranch.block.addPhi(phi);
       builder.stack.add(phi);
     }
diff --git a/pkg/compiler/lib/src/ssa/ssa_tracer.dart b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
index 6c1d543..c76b592 100644
--- a/pkg/compiler/lib/src/ssa/ssa_tracer.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
@@ -6,10 +6,10 @@
 
 import 'dart:async' show EventSink;
 
-import '../compiler.dart' show Compiler;
 import '../diagnostics/invariant.dart' show DEBUG_MODE;
-import '../js_backend/js_backend.dart';
+import '../js_backend/namer.dart' show Namer;
 import '../tracer.dart';
+import '../world.dart' show ClosedWorld;
 import 'nodes.dart';
 
 /**
@@ -18,10 +18,11 @@
  * to enable it.
  */
 class HTracer extends HGraphVisitor with TracerUtil {
-  Compiler compiler;
+  final ClosedWorld closedWorld;
+  final Namer namer;
   final EventSink<String> output;
 
-  HTracer(this.output, this.compiler);
+  HTracer(this.output, this.closedWorld, this.namer);
 
   void traceGraph(String name, HGraph graph) {
     DEBUG_MODE = true;
@@ -75,7 +76,7 @@
 
   void visitBasicBlock(HBasicBlock block) {
     HInstructionStringifier stringifier =
-        new HInstructionStringifier(block, compiler);
+        new HInstructionStringifier(block, closedWorld, namer);
     assert(block.id != null);
     tag("block", () {
       printProperty("name", "B${block.id}");
@@ -112,10 +113,11 @@
 }
 
 class HInstructionStringifier implements HVisitor<String> {
-  final Compiler compiler;
+  final ClosedWorld closedWorld;
+  final Namer namer;
   final HBasicBlock currentBlock;
 
-  HInstructionStringifier(this.currentBlock, this.compiler);
+  HInstructionStringifier(this.currentBlock, this.closedWorld, this.namer);
 
   visit(HInstruction node) => '${node.accept(this)} ${node.instructionType}';
 
@@ -125,27 +127,27 @@
       prefix = 'u';
     } else if (instruction.isConflicting()) {
       prefix = 'c';
-    } else if (instruction.isExtendableArray(compiler)) {
+    } else if (instruction.isExtendableArray(closedWorld)) {
       prefix = 'e';
-    } else if (instruction.isFixedArray(compiler)) {
+    } else if (instruction.isFixedArray(closedWorld)) {
       prefix = 'f';
-    } else if (instruction.isMutableArray(compiler)) {
+    } else if (instruction.isMutableArray(closedWorld)) {
       prefix = 'm';
-    } else if (instruction.isReadableArray(compiler)) {
+    } else if (instruction.isReadableArray(closedWorld)) {
       prefix = 'a';
-    } else if (instruction.isString(compiler)) {
+    } else if (instruction.isString(closedWorld)) {
       prefix = 's';
-    } else if (instruction.isIndexablePrimitive(compiler)) {
+    } else if (instruction.isIndexablePrimitive(closedWorld)) {
       prefix = 'r';
-    } else if (instruction.isBoolean(compiler)) {
+    } else if (instruction.isBoolean(closedWorld)) {
       prefix = 'b';
-    } else if (instruction.isInteger(compiler)) {
+    } else if (instruction.isInteger(closedWorld)) {
       prefix = 'i';
-    } else if (instruction.isDouble(compiler)) {
+    } else if (instruction.isDouble(closedWorld)) {
       prefix = 'd';
-    } else if (instruction.isNumber(compiler)) {
+    } else if (instruction.isNumber(closedWorld)) {
       prefix = 'n';
-    } else if (instruction.instructionType.containsAll(compiler.closedWorld)) {
+    } else if (instruction.instructionType.containsAll(closedWorld)) {
       prefix = 'v';
     } else {
       prefix = 'U';
@@ -292,9 +294,7 @@
   String visitInterceptor(HInterceptor node) {
     String value = temporaryId(node.inputs[0]);
     if (node.interceptedClasses != null) {
-      JavaScriptBackend backend = compiler.backend;
-      String cls =
-          backend.namer.suffixForGetInterceptor(node.interceptedClasses);
+      String cls = namer.suffixForGetInterceptor(node.interceptedClasses);
       return "Interceptor ($cls): $value";
     }
     return "Interceptor: $value";
@@ -452,6 +452,10 @@
     return handleInvokeBinary(node, 'TruncatingDivide');
   }
 
+  String visitRemainder(HRemainder node) {
+    return handleInvokeBinary(node, 'Remainder');
+  }
+
   String visitExitTry(HExitTry node) {
     return "ExitTry";
   }
diff --git a/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart b/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
new file mode 100644
index 0000000..ea06f8b
--- /dev/null
+++ b/pkg/compiler/lib/src/ssa/switch_continue_analysis.dart
@@ -0,0 +1,115 @@
+import 'package:kernel/ast.dart' as ir;
+
+/// Helper class that traverses a kernel AST subtree to see if it has any
+/// continue statements in the body of any switch cases (having continue
+/// statements results in a more complex generated code).
+class SwitchContinueAnalysis extends ir.Visitor<bool> {
+  SwitchContinueAnalysis._();
+
+  static bool containsContinue(ir.Statement switchCaseBody) {
+    return switchCaseBody.accept(new SwitchContinueAnalysis._());
+  }
+
+  bool visitContinueSwitchStatement(ir.ContinueSwitchStatement continueStmt) {
+    // TODO(efortuna): Check what the target of this continue statement actually
+    // IS, because depending on where the label points if we have a nested
+    // switch statement we might be able to output simpler code (not the complex
+    // switch statement).
+    return true;
+  }
+
+  bool visitBlock(ir.Block block) {
+    for (ir.Statement statement in block.statements) {
+      if (statement.accept(this)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  bool visitLabeledStatement(ir.LabeledStatement statement) {
+    return statement.body.accept(this);
+  }
+
+  bool visitDoStatement(ir.DoStatement doStatement) {
+    return doStatement.body.accept(this);
+  }
+
+  bool visitForStatement(ir.ForStatement forStatement) {
+    return forStatement.body.accept(this);
+  }
+
+  bool visitForInStatement(ir.ForInStatement forInStatement) {
+    return forInStatement.body.accept(this);
+  }
+
+  bool visitSwitchStatement(ir.SwitchStatement switchStatement) {
+    for (var switchCase in switchStatement.cases) {
+      if (switchCase.accept(this)) {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  bool visitSwitchCase(ir.SwitchCase switchCase) {
+    return switchCase.body.accept(this);
+  }
+
+  bool visitIfStatement(ir.IfStatement ifStatement) {
+    if (ifStatement.then.accept(this)) {
+      if (ifStatement.otherwise != null) {
+        return ifStatement.otherwise.accept(this);
+      }
+    }
+    return false;
+  }
+
+  bool visitTryCatch(ir.TryCatch tryCatch) {
+    if (tryCatch.body.accept(this)) {
+      for (var catchStatement in tryCatch.catches) {
+        if (catchStatement.accept(this)) {
+          return true;
+        }
+      }
+    }
+    return false;
+  }
+
+  bool visitWhileStatement(ir.WhileStatement statement) {
+    return statement.body.accept(this);
+  }
+
+  bool visitCatch(ir.Catch catchStatement) {
+    return catchStatement.body.accept(this);
+  }
+
+  bool visitTryFinally(ir.TryFinally tryFinally) {
+    return tryFinally.body.accept(this) && tryFinally.finalizer.accept(this);
+  }
+
+  bool visitFunctionDeclaration(ir.FunctionDeclaration declaration) {
+    return declaration.function.accept(this);
+  }
+
+  bool visitFunctionNode(ir.FunctionNode node) {
+    return node.body.accept(this);
+  }
+
+  bool defaultStatement(ir.Statement node) {
+    if (node is ir.ExpressionStatement ||
+        node is ir.EmptyStatement ||
+        node is ir.InvalidStatement ||
+        node is ir.BreakStatement ||
+        node is ir.ReturnStatement ||
+        node is ir.AssertStatement ||
+        node is ir.YieldStatement ||
+        node is ir.VariableDeclaration) {
+      return false;
+    }
+    throw 'Statement type ${node.runtimeType} not handled in '
+        'SwitchContinueAnalysis';
+  }
+
+  bool defaultNode(ir.Node node) => false;
+}
diff --git a/pkg/compiler/lib/src/ssa/type_builder.dart b/pkg/compiler/lib/src/ssa/type_builder.dart
index 605678b..a624e13 100644
--- a/pkg/compiler/lib/src/ssa/type_builder.dart
+++ b/pkg/compiler/lib/src/ssa/type_builder.dart
@@ -6,11 +6,10 @@
 import 'nodes.dart';
 import '../closure.dart';
 import '../common.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../types/types.dart';
 import '../elements/elements.dart';
 import '../io/source_information.dart';
-import '../universe/selector.dart' show Selector;
 import '../universe/use.dart' show TypeUse;
 
 /// Functions to insert type checking, coercion, and instruction insertion
@@ -20,7 +19,7 @@
   TypeBuilder(this.builder);
 
   /// Create an instruction to simply trust the provided type.
-  HInstruction _trustType(HInstruction original, DartType type) {
+  HInstruction _trustType(HInstruction original, ResolutionDartType type) {
     assert(builder.compiler.options.trustTypeAnnotations);
     assert(type != null);
     type = builder.localsHandler.substInContext(type);
@@ -29,14 +28,15 @@
     if (!type.isInterfaceType) return original;
     if (type.isObject) return original;
     // The type element is either a class or the void element.
-    Element element = type.element;
-    TypeMask mask = new TypeMask.subtype(element, builder.compiler.closedWorld);
+    ClassElement element = type.element;
+    TypeMask mask = new TypeMask.subtype(element, builder.closedWorld);
     return new HTypeKnown.pinned(mask, original);
   }
 
   /// Produces code that checks the runtime type is actually the type specified
   /// by attempting a type conversion.
-  HInstruction _checkType(HInstruction original, DartType type, int kind) {
+  HInstruction _checkType(
+      HInstruction original, ResolutionDartType type, int kind) {
     assert(builder.compiler.options.enableTypeAssertions);
     assert(type != null);
     type = builder.localsHandler.substInContext(type);
@@ -53,7 +53,8 @@
   /// Depending on the context and the mode, wrap the given type in an
   /// instruction that checks the type is what we expect or automatically
   /// trusts the written type.
-  HInstruction potentiallyCheckOrTrustType(HInstruction original, DartType type,
+  HInstruction potentiallyCheckOrTrustType(
+      HInstruction original, ResolutionDartType type,
       {int kind: HTypeConversion.CHECKED_MODE_CHECK}) {
     if (type == null) return original;
     HInstruction checkedOrTrusted = original;
@@ -68,11 +69,12 @@
   }
 
   /// Helper to create an instruction that gets the value of a type variable.
-  HInstruction addTypeVariableReference(TypeVariableType type, Element member,
+  HInstruction addTypeVariableReference(
+      ResolutionTypeVariableType type, Element member,
       {SourceInformation sourceInformation}) {
     assert(assertTypeInContext(type));
     if (type is MethodTypeVariableType) {
-      return builder.graph.addConstantNull(builder.compiler);
+      return builder.graph.addConstantNull(builder.closedWorld);
     }
     bool isClosure = member.enclosingElement.isClosure;
     if (isClosure) {
@@ -128,39 +130,40 @@
   }
 
   /// Generate code to extract the type argument from the object.
-  HInstruction readTypeVariable(TypeVariableType variable, Element member,
+  HInstruction readTypeVariable(
+      ResolutionTypeVariableType variable, Element member,
       {SourceInformation sourceInformation}) {
     assert(member.isInstanceMember);
     assert(variable is! MethodTypeVariableType);
     HInstruction target = builder.localsHandler.readThis();
-    builder.push(
-        new HTypeInfoReadVariable(variable, target, builder.backend.dynamicType)
-          ..sourceInformation = sourceInformation);
+    builder.push(new HTypeInfoReadVariable(
+        variable, target, builder.commonMasks.dynamicType)
+      ..sourceInformation = sourceInformation);
     return builder.pop();
   }
 
   HInstruction buildTypeArgumentRepresentations(
-      DartType type, Element sourceElement) {
+      ResolutionDartType type, Element sourceElement) {
     assert(!type.isTypeVariable);
     // Compute the representation of the type arguments, including access
     // to the runtime type information for type variables as instructions.
     assert(type.element.isClass);
-    InterfaceType interface = type;
+    ResolutionInterfaceType interface = type;
     List<HInstruction> inputs = <HInstruction>[];
-    for (DartType argument in interface.typeArguments) {
+    for (ResolutionDartType argument in interface.typeArguments) {
       inputs.add(analyzeTypeArgument(argument, sourceElement));
     }
     HInstruction representation = new HTypeInfoExpression(
         TypeInfoExpressionKind.INSTANCE,
         interface.element.thisType,
         inputs,
-        builder.backend.dynamicType);
+        builder.commonMasks.dynamicType);
     return representation;
   }
 
   /// Check that [type] is valid in the context of `localsHandler.contextClass`.
   /// This should only be called in assertions.
-  bool assertTypeInContext(DartType type, [Spannable spannable]) {
+  bool assertTypeInContext(ResolutionDartType type, [Spannable spannable]) {
     return invariant(spannable == null ? CURRENT_ELEMENT_SPANNABLE : spannable,
         () {
       ClassElement contextClass = Types.getClassContext(type);
@@ -171,13 +174,14 @@
             "${builder.localsHandler.contextClass}.");
   }
 
-  HInstruction analyzeTypeArgument(DartType argument, Element sourceElement,
+  HInstruction analyzeTypeArgument(
+      ResolutionDartType argument, Element sourceElement,
       {SourceInformation sourceInformation}) {
     assert(assertTypeInContext(argument));
     argument = argument.unaliased;
     if (argument.treatAsDynamic) {
       // Represent [dynamic] as [null].
-      return builder.graph.addConstantNull(builder.compiler);
+      return builder.graph.addConstantNull(builder.closedWorld);
     }
 
     if (argument.isTypeVariable) {
@@ -195,7 +199,7 @@
         TypeInfoExpressionKind.COMPLETE,
         argument,
         inputs,
-        builder.backend.dynamicType)..sourceInformation = sourceInformation;
+        builder.commonMasks.dynamicType)..sourceInformation = sourceInformation;
     builder.add(result);
     return result;
   }
@@ -221,7 +225,7 @@
   /// Invariant: [type] must be valid in the context.
   /// See [LocalsHandler.substInContext].
   HInstruction buildTypeConversion(
-      HInstruction original, DartType type, int kind) {
+      HInstruction original, ResolutionDartType type, int kind) {
     if (type == null) return original;
     // GENERIC_METHODS: The following statement was added for parsing and
     // ignoring method type variables; must be generalized for full support of
@@ -230,8 +234,9 @@
     type = type.unaliased;
     assert(assertTypeInContext(type, original));
     if (type.isInterfaceType && !type.treatAsRaw) {
+      ResolutionInterfaceType interfaceType = type;
       TypeMask subtype =
-          new TypeMask.subtype(type.element, builder.compiler.closedWorld);
+          new TypeMask.subtype(interfaceType.element, builder.closedWorld);
       HInstruction representations =
           buildTypeArgumentRepresentations(type, builder.sourceElement);
       builder.add(representations);
@@ -246,7 +251,7 @@
     } else if (type.isFunctionType) {
       return builder.buildFunctionTypeConversion(original, type, kind);
     } else {
-      return original.convertType(builder.compiler, type, kind);
+      return original.convertType(builder.closedWorld, type, kind);
     }
   }
 }
diff --git a/pkg/compiler/lib/src/ssa/types.dart b/pkg/compiler/lib/src/ssa/types.dart
index f145aff..07e99b3 100644
--- a/pkg/compiler/lib/src/ssa/types.dart
+++ b/pkg/compiler/lib/src/ssa/types.dart
@@ -2,51 +2,50 @@
 // for 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 '../compiler.dart' show Compiler;
-import '../core_types.dart' show CoreClasses;
+import '../core_types.dart' show CommonElements;
 import '../elements/elements.dart';
 import '../native/native.dart' as native;
-import '../tree/tree.dart' as ast;
 import '../types/types.dart';
 import '../universe/selector.dart' show Selector;
 import '../world.dart' show ClosedWorld;
 
 class TypeMaskFactory {
   static TypeMask inferredReturnTypeForElement(
-      Element element, Compiler compiler) {
-    return compiler.globalInference.results.resultOf(element).returnType ??
-        compiler.closedWorld.commonMasks.dynamicType;
+      Element element, GlobalTypeInferenceResults results) {
+    return results.resultOf(element).returnType ??
+        results.closedWorld.commonMasks.dynamicType;
   }
 
-  static TypeMask inferredTypeForElement(Element element, Compiler compiler) {
-    return compiler.globalInference.results.resultOf(element).type ??
-        compiler.closedWorld.commonMasks.dynamicType;
+  static TypeMask inferredTypeForElement(
+      Element element, GlobalTypeInferenceResults results) {
+    return results.resultOf(element).type ??
+        results.closedWorld.commonMasks.dynamicType;
   }
 
   static TypeMask inferredTypeForSelector(
-      Selector selector, TypeMask mask, Compiler compiler) {
-    return compiler.globalInference.results.typeOfSelector(selector, mask) ??
-        compiler.closedWorld.commonMasks.dynamicType;
+      Selector selector, TypeMask mask, GlobalTypeInferenceResults results) {
+    return results.typeOfSelector(selector, mask) ??
+        results.closedWorld.commonMasks.dynamicType;
   }
 
   static TypeMask fromNativeBehavior(
-      native.NativeBehavior nativeBehavior, Compiler compiler) {
-    ClosedWorld closedWorld = compiler.closedWorld;
+      native.NativeBehavior nativeBehavior, ClosedWorld closedWorld) {
     CommonMasks commonMasks = closedWorld.commonMasks;
     var typesReturned = nativeBehavior.typesReturned;
     if (typesReturned.isEmpty) return commonMasks.dynamicType;
 
-    CoreClasses coreClasses = closedWorld.coreClasses;
+    CommonElements commonElements = closedWorld.commonElements;
 
     // [type] is either an instance of [DartType] or special objects
     // like [native.SpecialType.JsObject].
     TypeMask fromNativeType(dynamic type) {
       if (type == native.SpecialType.JsObject) {
-        return new TypeMask.nonNullExact(coreClasses.objectClass, closedWorld);
+        return new TypeMask.nonNullExact(
+            commonElements.objectClass, closedWorld);
       }
 
       if (type.isVoid) return commonMasks.nullType;
-      if (type.element == coreClasses.nullClass) return commonMasks.nullType;
+      if (type.element == commonElements.nullClass) return commonMasks.nullType;
       if (type.treatAsDynamic) return commonMasks.dynamicType;
       return new TypeMask.nonNullSubtype(type.element, closedWorld);
     }
diff --git a/pkg/compiler/lib/src/ssa/types_propagation.dart b/pkg/compiler/lib/src/ssa/types_propagation.dart
index 63da628..5b1473a 100644
--- a/pkg/compiler/lib/src/ssa/types_propagation.dart
+++ b/pkg/compiler/lib/src/ssa/types_propagation.dart
@@ -3,7 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import '../compiler.dart' show Compiler;
-import '../elements/elements.dart';
+import '../elements/entities.dart';
 import '../js_backend/js_backend.dart';
 import '../types/types.dart';
 import '../universe/selector.dart' show Selector;
@@ -22,9 +22,7 @@
   JavaScriptBackend get backend => compiler.backend;
   String get name => 'type propagator';
 
-  SsaTypePropagator(Compiler compiler)
-      : this.compiler = compiler,
-        this.closedWorld = compiler.closedWorld;
+  SsaTypePropagator(this.compiler, this.closedWorld);
 
   TypeMask computeType(HInstruction instruction) {
     return instruction.accept(this);
@@ -109,18 +107,21 @@
   TypeMask visitBinaryArithmetic(HBinaryArithmetic instruction) {
     HInstruction left = instruction.left;
     HInstruction right = instruction.right;
-    if (left.isInteger(compiler) && right.isInteger(compiler)) {
-      return backend.intType;
+    if (left.isInteger(closedWorld) && right.isInteger(closedWorld)) {
+      return closedWorld.commonMasks.intType;
     }
-    if (left.isDouble(compiler)) return backend.doubleType;
-    return backend.numType;
+    if (left.isDouble(closedWorld)) {
+      return closedWorld.commonMasks.doubleType;
+    }
+    return closedWorld.commonMasks.numType;
   }
 
   TypeMask checkPositiveInteger(HBinaryArithmetic instruction) {
     HInstruction left = instruction.left;
     HInstruction right = instruction.right;
-    if (left.isPositiveInteger(compiler) && right.isPositiveInteger(compiler)) {
-      return backend.positiveIntType;
+    if (left.isPositiveInteger(closedWorld) &&
+        right.isPositiveInteger(closedWorld)) {
+      return closedWorld.commonMasks.positiveIntType;
     }
     return visitBinaryArithmetic(instruction);
   }
@@ -143,11 +144,18 @@
     return instruction.instructionType;
   }
 
+  TypeMask visitRemainder(HRemainder instruction) {
+    // Always as initialized.
+    return instruction.instructionType;
+  }
+
   TypeMask visitNegate(HNegate instruction) {
     HInstruction operand = instruction.operand;
     // We have integer subclasses that represent ranges, so widen any int
     // subclass to full integer.
-    if (operand.isInteger(compiler)) return backend.intType;
+    if (operand.isInteger(closedWorld)) {
+      return closedWorld.commonMasks.intType;
+    }
     return instruction.operand.instructionType;
   }
 
@@ -157,7 +165,7 @@
   }
 
   TypeMask visitPhi(HPhi phi) {
-    TypeMask candidateType = backend.emptyType;
+    TypeMask candidateType = closedWorld.commonMasks.emptyType;
     for (int i = 0, length = phi.inputs.length; i < length; i++) {
       TypeMask inputType = phi.inputs[i].instructionType;
       candidateType = candidateType.union(inputType, closedWorld);
@@ -175,11 +183,11 @@
       // We only do an int check if the input is integer or null.
       if (checkedType.containsOnlyNum(closedWorld) &&
           !checkedType.containsOnlyDouble(closedWorld) &&
-          input.isIntegerOrNull(compiler)) {
-        instruction.checkedType = backend.intType;
+          input.isIntegerOrNull(closedWorld)) {
+        instruction.checkedType = closedWorld.commonMasks.intType;
       } else if (checkedType.containsOnlyInt(closedWorld) &&
-          !input.isIntegerOrNull(compiler)) {
-        instruction.checkedType = backend.numType;
+          !input.isIntegerOrNull(closedWorld)) {
+        instruction.checkedType = closedWorld.commonMasks.numType;
       }
     }
 
@@ -193,9 +201,9 @@
       if (inputType.containsOnlyInt(closedWorld) &&
           checkedType.containsOnlyDouble(closedWorld)) {
         if (inputType.isNullable && checkedType.isNullable) {
-          outputType = backend.doubleType.nullable();
+          outputType = closedWorld.commonMasks.doubleType.nullable();
         } else {
-          outputType = backend.doubleType;
+          outputType = closedWorld.commonMasks.doubleType;
         }
       }
     }
@@ -248,7 +256,7 @@
       // If the instruction's type is integer or null, the codegen
       // will emit a null check, which is enough to know if it will
       // hit a noSuchMethod.
-      return instruction.isIntegerOrNull(compiler);
+      return instruction.isIntegerOrNull(closedWorld);
     }
     return true;
   }
@@ -259,8 +267,8 @@
   bool checkReceiver(HInvokeDynamic instruction) {
     assert(instruction.isInterceptedCall);
     HInstruction receiver = instruction.inputs[1];
-    if (receiver.isNumber(compiler)) return false;
-    if (receiver.isNumberOrNull(compiler)) {
+    if (receiver.isNumber(closedWorld)) return false;
+    if (receiver.isNumberOrNull(closedWorld)) {
       convertInput(
           instruction,
           receiver,
@@ -268,13 +276,12 @@
           HTypeConversion.RECEIVER_TYPE_CHECK);
       return true;
     } else if (instruction.element == null) {
-      Iterable<Element> targets = compiler.closedWorld.allFunctions
+      Iterable<MemberEntity> targets = closedWorld.allFunctions
           .filter(instruction.selector, instruction.mask);
       if (targets.length == 1) {
-        MemberElement target = targets.first;
-        ClassElement cls = target.enclosingClass;
-        TypeMask type =
-            new TypeMask.nonNullSubclass(cls.declaration, closedWorld);
+        MemberEntity target = targets.first;
+        ClassEntity cls = target.enclosingClass;
+        TypeMask type = new TypeMask.nonNullSubclass(cls, closedWorld);
         // TODO(ngeoffray): We currently only optimize on primitive
         // types.
         if (!type.satisfies(backend.helpers.jsIndexableClass, closedWorld) &&
@@ -302,11 +309,11 @@
     HInstruction right = instruction.inputs[2];
 
     Selector selector = instruction.selector;
-    if (selector.isOperator && left.isNumber(compiler)) {
-      if (right.isNumber(compiler)) return false;
-      TypeMask type = right.isIntegerOrNull(compiler)
+    if (selector.isOperator && left.isNumber(closedWorld)) {
+      if (right.isNumber(closedWorld)) return false;
+      TypeMask type = right.isIntegerOrNull(closedWorld)
           ? right.instructionType.nonNullable()
-          : backend.numType;
+          : closedWorld.commonMasks.numType;
       // TODO(ngeoffray): Some number operations don't have a builtin
       // variant and will do the check in their method anyway. We
       // still add a check because it allows to GVN these operations,
@@ -357,7 +364,7 @@
               });
     }
 
-    HInstruction receiver = instruction.getDartReceiver(compiler);
+    HInstruction receiver = instruction.getDartReceiver(closedWorld);
     TypeMask receiverType = receiver.instructionType;
     instruction.mask = receiverType;
 
@@ -371,7 +378,7 @@
     if (!instruction.selector.isClosureCall) {
       TypeMask newType;
       TypeMask computeNewType() {
-        newType = compiler.closedWorld.allFunctions
+        newType = closedWorld.allFunctions
             .receiverType(instruction.selector, instruction.mask);
         newType = newType.intersection(receiverType, closedWorld);
         return newType;
@@ -406,6 +413,6 @@
     }
 
     return instruction.specializer
-        .computeTypeFromInputTypes(instruction, compiler);
+        .computeTypeFromInputTypes(instruction, compiler, closedWorld);
   }
 }
diff --git a/pkg/compiler/lib/src/ssa/value_range_analyzer.dart b/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
index 1882fc6..23d5087 100644
--- a/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
+++ b/pkg/compiler/lib/src/ssa/value_range_analyzer.dart
@@ -2,11 +2,11 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-import '../compiler.dart' show Compiler;
 import '../constant_system_dart.dart';
 import '../constants/constant_system.dart';
 import '../constants/values.dart';
-import '../js_backend/js_backend.dart';
+import '../js_backend/backend_helpers.dart';
+import '../world.dart' show ClosedWorld;
 import 'nodes.dart';
 import 'optimize.dart';
 
@@ -600,16 +600,19 @@
    */
   final Map<HInstruction, Range> ranges = new Map<HInstruction, Range>();
 
-  final Compiler compiler;
-  final ConstantSystem constantSystem;
+  final BackendHelpers backendHelpers;
+  final ClosedWorld closedWorld;
   final ValueRangeInfo info;
   final SsaOptimizerTask optimizer;
 
   HGraph graph;
 
-  SsaValueRangeAnalyzer(this.compiler, constantSystem, this.optimizer)
-      : info = new ValueRangeInfo(constantSystem),
-        this.constantSystem = constantSystem;
+  SsaValueRangeAnalyzer(
+      this.backendHelpers, ClosedWorld closedWorld, this.optimizer)
+      : info = new ValueRangeInfo(closedWorld.constantSystem),
+        this.closedWorld = closedWorld;
+
+  ConstantSystem get constantSystem => closedWorld.constantSystem;
 
   void visitGraph(HGraph graph) {
     this.graph = graph;
@@ -632,7 +635,7 @@
   void visitBasicBlock(HBasicBlock block) {
     void visit(HInstruction instruction) {
       Range range = instruction.accept(this);
-      if (instruction.isInteger(compiler)) {
+      if (instruction.isInteger(closedWorld)) {
         assert(range != null);
         ranges[instruction] = range;
       }
@@ -643,10 +646,10 @@
   }
 
   Range visitInstruction(HInstruction instruction) {
-    if (instruction.isPositiveInteger(compiler)) {
+    if (instruction.isPositiveInteger(closedWorld)) {
       return info.newNormalizedRange(
           info.intZero, info.newPositiveValue(instruction));
-    } else if (instruction.isInteger(compiler)) {
+    } else if (instruction.isInteger(closedWorld)) {
       InstructionValue value = info.newInstructionValue(instruction);
       return info.newNormalizedRange(value, value);
     } else {
@@ -655,16 +658,17 @@
   }
 
   Range visitPhi(HPhi phi) {
-    if (!phi.isInteger(compiler)) return info.newUnboundRange();
+    if (!phi.isInteger(closedWorld)) return info.newUnboundRange();
     // Some phases may replace instructions that change the inputs of
     // this phi. Only the [SsaTypesPropagation] phase will update the
     // phi type. Play it safe by assuming the [SsaTypesPropagation]
     // phase is not necessarily run before the [ValueRangeAnalyzer].
-    if (phi.inputs.any((i) => !i.isInteger(compiler))) {
+    if (phi.inputs.any((i) => !i.isInteger(closedWorld))) {
       return info.newUnboundRange();
     }
     if (phi.block.isLoopHeader()) {
-      Range range = new LoopUpdateRecognizer(compiler, ranges, info).run(phi);
+      Range range =
+          new LoopUpdateRecognizer(closedWorld, ranges, info).run(phi);
       if (range == null) return info.newUnboundRange();
       return range;
     }
@@ -677,7 +681,7 @@
   }
 
   Range visitConstant(HConstant hConstant) {
-    if (!hConstant.isInteger(compiler)) return info.newUnboundRange();
+    if (!hConstant.isInteger(closedWorld)) return info.newUnboundRange();
     ConstantValue constant = hConstant.constant;
     NumConstantValue constantNum;
     if (constant is DeferredConstantValue) {
@@ -694,12 +698,11 @@
   }
 
   Range visitFieldGet(HFieldGet fieldGet) {
-    if (!fieldGet.isInteger(compiler)) return info.newUnboundRange();
-    if (!fieldGet.receiver.isIndexablePrimitive(compiler)) {
+    if (!fieldGet.isInteger(closedWorld)) return info.newUnboundRange();
+    if (!fieldGet.receiver.isIndexablePrimitive(closedWorld)) {
       return visitInstruction(fieldGet);
     }
-    JavaScriptBackend backend = compiler.backend;
-    assert(fieldGet.element == backend.helpers.jsIndexableLength);
+    assert(fieldGet.element == backendHelpers.jsIndexableLength);
     PositiveValue value = info.newPositiveValue(fieldGet);
     // We know this range is above zero. To simplify the analysis, we
     // put the zero value as the lower bound of this range. This
@@ -715,7 +718,7 @@
     Range lengthRange = ranges[check.length];
     if (indexRange == null) {
       indexRange = info.newUnboundRange();
-      assert(!check.index.isInteger(compiler));
+      assert(!check.index.isInteger(closedWorld));
     }
     if (lengthRange == null) {
       // We might have lost the length range due to a type conversion that
@@ -723,7 +726,7 @@
       // get to this point anyway, so no need to try and refine ranges.
       return indexRange;
     }
-    assert(check.length.isInteger(compiler));
+    assert(check.length.isInteger(closedWorld));
 
     // Check if the index is strictly below the upper bound of the length
     // range.
@@ -776,8 +779,8 @@
   Range visitRelational(HRelational relational) {
     HInstruction right = relational.right;
     HInstruction left = relational.left;
-    if (!left.isInteger(compiler)) return info.newUnboundRange();
-    if (!right.isInteger(compiler)) return info.newUnboundRange();
+    if (!left.isInteger(closedWorld)) return info.newUnboundRange();
+    if (!right.isInteger(closedWorld)) return info.newUnboundRange();
     BinaryOperation operation = relational.operation(constantSystem);
     Range rightRange = ranges[relational.right];
     Range leftRange = ranges[relational.left];
@@ -786,11 +789,11 @@
       handleEqualityCheck(relational);
     } else if (operation.apply(leftRange, rightRange)) {
       relational.block
-          .rewrite(relational, graph.addConstantBool(true, compiler));
+          .rewrite(relational, graph.addConstantBool(true, closedWorld));
       relational.block.remove(relational);
     } else if (negateOperation(operation).apply(leftRange, rightRange)) {
       relational.block
-          .rewrite(relational, graph.addConstantBool(false, compiler));
+          .rewrite(relational, graph.addConstantBool(false, closedWorld));
       relational.block.remove(relational);
     }
     return info.newUnboundRange();
@@ -800,7 +803,7 @@
     Range right = ranges[node.right];
     Range left = ranges[node.left];
     if (left.isSingleValue && right.isSingleValue && left == right) {
-      node.block.rewrite(node, graph.addConstantBool(true, compiler));
+      node.block.rewrite(node, graph.addConstantBool(true, closedWorld));
       node.block.remove(node);
     }
   }
@@ -810,9 +813,9 @@
     HInstruction right = invoke.inputs[2];
     Range divisor = ranges[right];
     if (divisor != null) {
-      // For Integer values we can be precise in the upper bound,
-      // so special case those.
-      if (left.isInteger(compiler) && right.isInteger(compiler)) {
+      // For Integer values we can be precise in the upper bound, so special
+      // case those.
+      if (left.isInteger(closedWorld) && right.isInteger(closedWorld)) {
         if (divisor.isPositive) {
           return info.newNormalizedRange(
               info.intZero, divisor.upper - info.intOne);
@@ -820,7 +823,7 @@
           return info.newNormalizedRange(
               info.intZero, info.newNegateValue(divisor.lower) - info.intOne);
         }
-      } else if (left.isNumber(compiler) && right.isNumber(compiler)) {
+      } else if (left.isNumber(closedWorld) && right.isNumber(closedWorld)) {
         if (divisor.isPositive) {
           return info.newNormalizedRange(info.intZero, divisor.upper);
         } else if (divisor.isNegative) {
@@ -832,6 +835,30 @@
     return info.newUnboundRange();
   }
 
+  Range visitRemainder(HRemainder instruction) {
+    HInstruction left = instruction.inputs[0];
+    HInstruction right = instruction.inputs[1];
+    Range dividend = ranges[left];
+    // If both operands are >=0, the result is >= 0 and bounded by the divisor.
+    if ((dividend != null && dividend.isPositive) ||
+        left.isPositiveInteger(closedWorld)) {
+      Range divisor = ranges[right];
+      if (divisor != null) {
+        if (divisor.isPositive) {
+          // For Integer values we can be precise in the upper bound.
+          if (left.isInteger(closedWorld) && right.isInteger(closedWorld)) {
+            return info.newNormalizedRange(
+                info.intZero, divisor.upper - info.intOne);
+          }
+          if (left.isNumber(closedWorld) && right.isNumber(closedWorld)) {
+            return info.newNormalizedRange(info.intZero, divisor.upper);
+          }
+        }
+      }
+    }
+    return info.newUnboundRange();
+  }
+
   Range visitInvokeDynamicMethod(HInvokeDynamicMethod invoke) {
     if ((invoke.inputs.length == 3) && (invoke.selector.name == "%"))
       return handleInvokeModulo(invoke);
@@ -839,7 +866,7 @@
   }
 
   Range handleBinaryOperation(HBinaryArithmetic instruction) {
-    if (!instruction.isInteger(compiler)) return info.newUnboundRange();
+    if (!instruction.isInteger(closedWorld)) return info.newUnboundRange();
     return instruction
         .operation(constantSystem)
         .apply(ranges[instruction.left], ranges[instruction.right]);
@@ -854,10 +881,10 @@
   }
 
   Range visitBitAnd(HBitAnd node) {
-    if (!node.isInteger(compiler)) return info.newUnboundRange();
+    if (!node.isInteger(closedWorld)) return info.newUnboundRange();
     HInstruction right = node.right;
     HInstruction left = node.left;
-    if (left.isInteger(compiler) && right.isInteger(compiler)) {
+    if (left.isInteger(closedWorld) && right.isInteger(closedWorld)) {
       return ranges[left] & ranges[right];
     }
 
@@ -871,9 +898,9 @@
       return info.newUnboundRange();
     }
 
-    if (left.isInteger(compiler)) {
+    if (left.isInteger(closedWorld)) {
       return tryComputeRange(left);
-    } else if (right.isInteger(compiler)) {
+    } else if (right.isInteger(closedWorld)) {
       return tryComputeRange(right);
     }
     return info.newUnboundRange();
@@ -888,9 +915,8 @@
 
   HInstruction createRangeConversion(
       HInstruction cursor, HInstruction instruction) {
-    JavaScriptBackend backend = compiler.backend;
     HRangeConversion newInstruction =
-        new HRangeConversion(instruction, backend.intType);
+        new HRangeConversion(instruction, closedWorld.commonMasks.intType);
     conversions.add(newInstruction);
     cursor.block.addBefore(cursor, newInstruction);
     // Update the users of the instruction dominated by [cursor] to
@@ -953,8 +979,8 @@
     if (condition is HIdentity) return info.newUnboundRange();
     HInstruction right = condition.right;
     HInstruction left = condition.left;
-    if (!left.isInteger(compiler)) return info.newUnboundRange();
-    if (!right.isInteger(compiler)) return info.newUnboundRange();
+    if (!left.isInteger(closedWorld)) return info.newUnboundRange();
+    if (!right.isInteger(closedWorld)) return info.newUnboundRange();
 
     Range rightRange = ranges[right];
     Range leftRange = ranges[left];
@@ -1016,10 +1042,10 @@
  * Tries to find a range for the update instruction of a loop phi.
  */
 class LoopUpdateRecognizer extends HBaseVisitor {
-  final Compiler compiler;
+  final ClosedWorld closedWorld;
   final Map<HInstruction, Range> ranges;
   final ValueRangeInfo info;
-  LoopUpdateRecognizer(this.compiler, this.ranges, this.info);
+  LoopUpdateRecognizer(this.closedWorld, this.ranges, this.info);
 
   Range run(HPhi loopPhi) {
     // Create a marker range for the loop phi, so that if the update
@@ -1044,7 +1070,7 @@
   }
 
   Range visit(HInstruction instruction) {
-    if (!instruction.isInteger(compiler)) return null;
+    if (!instruction.isInteger(closedWorld)) return null;
     if (ranges[instruction] != null) return ranges[instruction];
     return instruction.accept(this);
   }
diff --git a/pkg/compiler/lib/src/tokens/keyword.dart b/pkg/compiler/lib/src/tokens/keyword.dart
index 4d914bc..607c4e8 100644
--- a/pkg/compiler/lib/src/tokens/keyword.dart
+++ b/pkg/compiler/lib/src/tokens/keyword.dart
@@ -53,6 +53,7 @@
 
     const Keyword("abstract", isBuiltIn: true),
     const Keyword("as", info: Precedence.AS_INFO, isBuiltIn: true),
+    const Keyword("covariant", isBuiltIn: true),
     const Keyword("dynamic", isBuiltIn: true),
     const Keyword("export", isBuiltIn: true),
     const Keyword("external", isBuiltIn: true),
@@ -77,7 +78,7 @@
     const Keyword("async", isPseudo: true),
     const Keyword("sync", isPseudo: true),
     const Keyword("await", isPseudo: true),
-    const Keyword("yield", isPseudo: true)
+    const Keyword("yield", isPseudo: true),
   ];
 
   final String syntax;
diff --git a/pkg/compiler/lib/src/tracer.dart b/pkg/compiler/lib/src/tracer.dart
index e73e82a..0233143 100644
--- a/pkg/compiler/lib/src/tracer.dart
+++ b/pkg/compiler/lib/src/tracer.dart
@@ -7,10 +7,11 @@
 import 'dart:async' show EventSink;
 
 import '../compiler.dart' as api;
-import 'compiler.dart' show Compiler;
+import 'js_backend/namer.dart' show Namer;
 import 'ssa/nodes.dart' as ssa show HGraph;
 import 'ssa/ssa_tracer.dart' show HTracer;
 import 'util/util.dart' show Indentation;
+import 'world.dart' show ClosedWorld;
 
 /**
  * If non-null, we only trace methods whose name match the regexp defined by the
@@ -26,14 +27,15 @@
  * readable by IR Hydra.
  */
 class Tracer extends TracerUtil {
-  final Compiler compiler;
+  final ClosedWorld closedWorld;
+  final Namer namer;
   bool traceActive = false;
   final EventSink<String> output;
   final bool isEnabled = TRACE_FILTER != null;
 
-  Tracer(Compiler compiler, api.CompilerOutputProvider outputProvider)
-      : this.compiler = compiler,
-        output = TRACE_FILTER != null ? outputProvider('dart', 'cfg') : null;
+  Tracer(
+      this.closedWorld, this.namer, api.CompilerOutputProvider outputProvider)
+      : output = TRACE_FILTER != null ? outputProvider('dart', 'cfg') : null;
 
   void traceCompilation(String methodName) {
     if (!isEnabled) return;
@@ -49,7 +51,7 @@
   void traceGraph(String name, var irObject) {
     if (!traceActive) return;
     if (irObject is ssa.HGraph) {
-      new HTracer(output, compiler).traceGraph(name, irObject);
+      new HTracer(output, closedWorld, namer).traceGraph(name, irObject);
     }
   }
 
diff --git a/pkg/compiler/lib/src/tree/nodes.dart b/pkg/compiler/lib/src/tree/nodes.dart
index ff36cfe..1e5f9dd 100644
--- a/pkg/compiler/lib/src/tree/nodes.dart
+++ b/pkg/compiler/lib/src/tree/nodes.dart
@@ -593,6 +593,7 @@
   final Node receiver;
   final Node selector;
   final NodeList argumentsNode;
+  final NodeList typeArgumentsNode;
 
   /// Whether this is a conditional send of the form `a?.b`.
   final bool isConditional;
@@ -603,16 +604,19 @@
       [this.receiver,
       this.selector,
       this.argumentsNode,
+      this.typeArgumentsNode,
       this.isConditional = false]);
   Send.postfix(this.receiver, this.selector,
       [Node argument = null, this.isConditional = false])
       : argumentsNode = (argument == null)
             ? new Postfix()
-            : new Postfix.singleton(argument);
+            : new Postfix.singleton(argument),
+        typeArgumentsNode = null;
   Send.prefix(this.receiver, this.selector,
       [Node argument = null, this.isConditional = false])
       : argumentsNode =
-            (argument == null) ? new Prefix() : new Prefix.singleton(argument);
+            (argument == null) ? new Prefix() : new Prefix.singleton(argument),
+        typeArgumentsNode = null;
 
   Send asSend() => this;
 
@@ -695,7 +699,8 @@
 
   Send copyWithReceiver(Node newReceiver, bool isConditional) {
     assert(receiver == null);
-    return new Send(newReceiver, selector, argumentsNode, isConditional);
+    return new Send(
+        newReceiver, selector, argumentsNode, typeArgumentsNode, isConditional);
   }
 }
 
@@ -713,7 +718,7 @@
   final Operator assignmentOperator;
   SendSet(receiver, selector, this.assignmentOperator, argumentsNode,
       [bool isConditional = false])
-      : super(receiver, selector, argumentsNode, isConditional);
+      : super(receiver, selector, argumentsNode, null, isConditional);
   SendSet.postfix(receiver, selector, this.assignmentOperator,
       [Node argument = null, bool isConditional = false])
       : super.postfix(receiver, selector, argument, isConditional);
diff --git a/pkg/compiler/lib/src/tree/unparser.dart b/pkg/compiler/lib/src/tree/unparser.dart
index 12d4141..5d1d154 100644
--- a/pkg/compiler/lib/src/tree/unparser.dart
+++ b/pkg/compiler/lib/src/tree/unparser.dart
@@ -457,6 +457,7 @@
       visit(argNode.receiver);
     } else {
       if (spacesNeeded) write(' ');
+      visit(node.typeArgumentsNode);
       visit(node.argumentsNode);
     }
   }
diff --git a/pkg/compiler/lib/src/typechecker.dart b/pkg/compiler/lib/src/typechecker.dart
index 74831e1..e7d66ce 100644
--- a/pkg/compiler/lib/src/typechecker.dart
+++ b/pkg/compiler/lib/src/typechecker.dart
@@ -12,7 +12,7 @@
 import 'constants/expressions.dart';
 import 'constants/values.dart';
 import 'core_types.dart';
-import 'dart_types.dart';
+import 'elements/resolution_types.dart';
 import 'elements/elements.dart'
     show
         AbstractFieldElement,
@@ -64,7 +64,7 @@
             compiler, resolvedAst.elements, compiler.types);
         if (element.isField) {
           visitor.analyzingInitializer = true;
-          DartType type =
+          ResolutionDartType type =
               visitor.analyzeVariableTypeAnnotation(resolvedAst.node);
           visitor.analyzeVariableInitializer(element, type, resolvedAst.body);
         } else {
@@ -100,7 +100,7 @@
 
   String get name => element.name;
 
-  DartType computeType(Resolution resolution);
+  ResolutionDartType computeType(Resolution resolution);
 
   /// Returns [: true :] if the element can be access as an invocation.
   bool isCallable(Compiler compiler) {
@@ -111,8 +111,9 @@
         return false;
       }
     }
-    return compiler.types.isAssignable(
-        computeType(compiler.resolution), compiler.coreTypes.functionType);
+    ResolutionInterfaceType functionType = compiler.commonElements.functionType;
+    return compiler.types
+        .isAssignable(computeType(compiler.resolution), functionType);
   }
 }
 
@@ -124,7 +125,7 @@
 
   Element get element => member.declarations.first.element;
 
-  DartType computeType(Resolution resolution) => member.type;
+  ResolutionDartType computeType(Resolution resolution) => member.type;
 
   String toString() => 'MemberAccess($member)';
 }
@@ -137,7 +138,8 @@
 
   String get name => 'dynamic';
 
-  DartType computeType(Resolution resolution) => const DynamicType();
+  ResolutionDartType computeType(Resolution resolution) =>
+      const ResolutionDynamicType();
 
   bool isCallable(Compiler compiler) => true;
 
@@ -155,18 +157,18 @@
     assert(element != null);
   }
 
-  DartType computeType(Resolution resolution) {
+  ResolutionDartType computeType(Resolution resolution) {
     if (element.isGetter) {
       GetterElement getter = element;
-      FunctionType functionType = getter.computeType(resolution);
+      ResolutionFunctionType functionType = getter.computeType(resolution);
       return functionType.returnType;
     } else if (element.isSetter) {
       SetterElement setter = element;
-      FunctionType functionType = setter.computeType(resolution);
+      ResolutionFunctionType functionType = setter.computeType(resolution);
       if (functionType.parameterTypes.length != 1) {
         // TODO(johnniwinther,karlklose): this happens for malformed static
         // setters. Treat them the same as instance members.
-        return const DynamicType();
+        return const ResolutionDynamicType();
       }
       return functionType.parameterTypes.first;
     } else if (element.isTypedef || element.isClass) {
@@ -186,14 +188,14 @@
 /// An access to a promoted variable.
 class PromotedAccess extends ElementAccess {
   final VariableElement element;
-  final DartType type;
+  final ResolutionDartType type;
 
-  PromotedAccess(VariableElement this.element, DartType this.type) {
+  PromotedAccess(VariableElement this.element, ResolutionDartType this.type) {
     assert(element != null);
     assert(type != null);
   }
 
-  DartType computeType(Resolution resolution) => type;
+  ResolutionDartType computeType(Resolution resolution) => type;
 
   String toString() => 'PromotedAccess($element,$type)';
 }
@@ -203,14 +205,14 @@
  * access of a resolved element through [:this:].
  */
 class TypeAccess extends ElementAccess {
-  final DartType type;
-  TypeAccess(DartType this.type) {
+  final ResolutionDartType type;
+  TypeAccess(ResolutionDartType this.type) {
     assert(type != null);
   }
 
   Element get element => type.element;
 
-  DartType computeType(Resolution resolution) => type;
+  ResolutionDartType computeType(Resolution resolution) => type;
 
   String toString() => 'TypeAccess($type)';
 }
@@ -219,7 +221,7 @@
  * An access of a type literal.
  */
 class TypeLiteralAccess extends ElementAccess {
-  final DartType type;
+  final ResolutionDartType type;
 
   TypeLiteralAccess(this.type) {
     assert(type != null);
@@ -229,7 +231,8 @@
 
   String get name => type.name;
 
-  DartType computeType(Resolution resolution) => resolution.coreTypes.typeType;
+  ResolutionInterfaceType computeType(Resolution resolution) =>
+      resolution.commonElements.typeType;
 
   String toString() => 'TypeLiteralAccess($type)';
 }
@@ -237,13 +240,13 @@
 /// An access to the 'call' method of a function type.
 class FunctionCallAccess implements ElementAccess {
   final Element element;
-  final DartType type;
+  final ResolutionDartType type;
 
   const FunctionCallAccess(this.element, this.type);
 
   String get name => 'call';
 
-  DartType computeType(Resolution resolution) => type;
+  ResolutionDartType computeType(Resolution resolution) => type;
 
   bool isCallable(Compiler compiler) => true;
 
@@ -254,7 +257,7 @@
 class TypePromotion {
   final Send node;
   final VariableElement variable;
-  final DartType type;
+  final ResolutionDartType type;
   final List<TypePromotionMessage> messages = <TypePromotionMessage>[];
 
   TypePromotion(this.node, this.variable, this.type);
@@ -283,13 +286,13 @@
   TypePromotionMessage(this.hint, this.infos);
 }
 
-class TypeCheckerVisitor extends Visitor<DartType> {
+class TypeCheckerVisitor extends Visitor<ResolutionDartType> {
   final Compiler compiler;
   final TreeElements elements;
   final Types types;
 
   Node lastSeenNode;
-  DartType expectedReturnType;
+  ResolutionDartType expectedReturnType;
   AsyncMarker currentAsyncMarker = AsyncMarker.SYNC;
 
   final ClassElement currentClass;
@@ -297,21 +300,21 @@
   /// The immediately enclosing field, method or constructor being analyzed.
   ExecutableElement executableContext;
 
-  CoreTypes get coreTypes => compiler.coreTypes;
+  CommonElements get commonElements => compiler.commonElements;
 
   DiagnosticReporter get reporter => compiler.reporter;
 
   Resolution get resolution => compiler.resolution;
 
-  InterfaceType get intType => coreTypes.intType;
-  InterfaceType get doubleType => coreTypes.doubleType;
-  InterfaceType get boolType => coreTypes.boolType;
-  InterfaceType get stringType => coreTypes.stringType;
+  ResolutionInterfaceType get intType => commonElements.intType;
+  ResolutionInterfaceType get doubleType => commonElements.doubleType;
+  ResolutionInterfaceType get boolType => commonElements.boolType;
+  ResolutionInterfaceType get stringType => commonElements.stringType;
 
-  DartType thisType;
-  DartType superType;
+  ResolutionDartType thisType;
+  ResolutionDartType superType;
 
-  Link<DartType> cascadeTypes = const Link<DartType>();
+  Link<ResolutionDartType> cascadeTypes = const Link<ResolutionDartType>();
 
   bool analyzingInitializer = false;
 
@@ -365,7 +368,7 @@
     return null;
   }
 
-  DartType getKnownType(VariableElement element) {
+  ResolutionDartType getKnownType(VariableElement element) {
     TypePromotion typePromotion = getKnownTypePromotion(element);
     if (typePromotion != null) return typePromotion.type;
     return element.type;
@@ -382,8 +385,8 @@
       superType = currentClass.supertype;
     } else {
       // If these are used, an error should have been reported by the resolver.
-      thisType = const DynamicType();
-      superType = const DynamicType();
+      thisType = const ResolutionDynamicType();
+      superType = const ResolutionDynamicType();
     }
   }
 
@@ -413,23 +416,25 @@
   }
 
   // TODO(karlklose): remove these functions.
-  DartType unhandledExpression() => const DynamicType();
+  ResolutionDartType unhandledExpression() => const ResolutionDynamicType();
 
-  DartType analyzeNonVoid(Node node) {
-    DartType type = analyze(node);
+  ResolutionDartType analyzeNonVoid(Node node) {
+    ResolutionDartType type = analyze(node);
     if (type.isVoid) {
       reportTypeWarning(node, MessageKind.VOID_EXPRESSION);
     }
     return type;
   }
 
-  DartType analyzeWithDefault(Node node, DartType defaultValue) {
+  ResolutionDartType analyzeWithDefault(
+      Node node, ResolutionDartType defaultValue) {
     return node != null ? analyze(node) : defaultValue;
   }
 
   /// If [inInitializer] is true, assignment should be interpreted as write to
   /// a field and not to a setter.
-  DartType analyze(Node node, {bool inInitializer: false}) {
+  ResolutionDartType analyze(Node node,
+      {bool inInitializer: false, bool mustHaveType: true}) {
     if (node == null) {
       final String error = 'Unexpected node: null';
       if (lastSeenNode != null) {
@@ -442,14 +447,20 @@
     }
     bool previouslyInitializer = analyzingInitializer;
     analyzingInitializer = inInitializer;
-    DartType result = node.accept(this);
+    ResolutionDartType result = node.accept(this);
     analyzingInitializer = previouslyInitializer;
-    if (result == null) {
+    if (result == null && mustHaveType) {
       reporter.internalError(node, 'Type is null.');
     }
     return result;
   }
 
+  void analyzeUntyped(Node node, {bool inInitializer: false}) {
+    if (node != null) {
+      analyze(node, inInitializer: inInitializer, mustHaveType: false);
+    }
+  }
+
   void checkTypePromotion(Node node, TypePromotion typePromotion,
       {bool checkAccesses: false}) {
     VariableElement variable = typePromotion.variable;
@@ -529,7 +540,8 @@
   }
 
   /// Analyze [node] in the context of the known types shown in [context].
-  DartType analyzeInPromotedContext(Node context, Node node) {
+  ResolutionDartType analyzeInPromotedContext(Node context, Node node,
+      {bool mustHaveType: true}) {
     Link<TypePromotion> knownForNode = const Link<TypePromotion>();
     for (TypePromotion typePromotion in getShownTypePromotionsFor(context)) {
       typePromotion = typePromotion.copy();
@@ -538,7 +550,7 @@
       registerKnownTypePromotion(typePromotion);
     }
 
-    final DartType type = analyze(node);
+    final ResolutionDartType type = analyze(node, mustHaveType: mustHaveType);
 
     while (!knownForNode.isEmpty) {
       unregisterKnownTypePromotion(knownForNode.head);
@@ -553,7 +565,8 @@
    * return value of type [to].  If `isConst == true`, an error is emitted in
    * checked mode, otherwise a warning is issued.
    */
-  bool checkAssignable(Spannable spannable, DartType from, DartType to,
+  bool checkAssignable(
+      Spannable spannable, ResolutionDartType from, ResolutionDartType to,
       {bool isConst: false}) {
     if (!types.isAssignable(from, to)) {
       if (compiler.options.enableTypeAssertions && isConst) {
@@ -572,78 +585,74 @@
     checkAssignable(condition, analyze(condition), boolType);
   }
 
-  void pushCascadeType(DartType type) {
+  void pushCascadeType(ResolutionDartType type) {
     cascadeTypes = cascadeTypes.prepend(type);
   }
 
-  DartType popCascadeType() {
-    DartType type = cascadeTypes.head;
+  ResolutionDartType popCascadeType() {
+    ResolutionDartType type = cascadeTypes.head;
     cascadeTypes = cascadeTypes.tail;
     return type;
   }
 
-  DartType visitAssert(Assert node) {
+  visitAssert(Assert node) {
     analyze(node.condition);
     if (node.hasMessage) analyze(node.message);
-    return const StatementType();
   }
 
-  DartType visitBlock(Block node) {
-    return analyze(node.statements);
+  visitBlock(Block node) {
+    analyzeUntyped(node.statements);
   }
 
-  DartType visitCascade(Cascade node) {
+  ResolutionDartType visitCascade(Cascade node) {
     analyze(node.expression);
     return popCascadeType();
   }
 
-  DartType visitCascadeReceiver(CascadeReceiver node) {
-    DartType type = analyze(node.expression);
+  ResolutionDartType visitCascadeReceiver(CascadeReceiver node) {
+    ResolutionDartType type = analyze(node.expression);
     pushCascadeType(type);
     return type;
   }
 
-  DartType visitDoWhile(DoWhile node) {
-    analyze(node.body);
+  visitDoWhile(DoWhile node) {
+    analyzeUntyped(node.body);
     checkCondition(node.condition);
-    return const StatementType();
   }
 
-  DartType visitExpressionStatement(ExpressionStatement node) {
+  visitExpressionStatement(ExpressionStatement node) {
     Expression expression = node.expression;
     analyze(expression);
-    return const StatementType();
   }
 
   /** Dart Programming Language Specification: 11.5.1 For Loop */
-  DartType visitFor(For node) {
+  visitFor(For node) {
     if (node.initializer != null) {
-      analyze(node.initializer);
+      analyzeUntyped(node.initializer);
     }
     if (node.condition != null) {
       checkCondition(node.condition);
     }
     if (node.update != null) {
-      analyze(node.update);
+      analyzeUntyped(node.update);
     }
-    return analyze(node.body);
+    analyzeUntyped(node.body);
   }
 
-  DartType visitFunctionDeclaration(FunctionDeclaration node) {
+  visitFunctionDeclaration(FunctionDeclaration node) {
     analyze(node.function);
-    return const StatementType();
   }
 
-  DartType visitFunctionExpression(FunctionExpression node) {
-    DartType type;
-    DartType returnType;
+  ResolutionDartType visitFunctionExpression(FunctionExpression node) {
+    ResolutionDartType type;
+    ResolutionDartType returnType;
     final FunctionElement element = elements.getFunctionDefinition(node);
     assert(invariant(node, element != null,
         message: 'FunctionExpression with no element'));
-    if (Elements.isUnresolved(element)) return const DynamicType();
+    if (Elements.isUnresolved(element)) return const ResolutionDynamicType();
     if (element.isGenerativeConstructor) {
-      type = const DynamicType();
-      returnType = const VoidType();
+      type = const ResolutionDynamicType();
+      returnType = const ResolutionVoidType();
 
       element.functionSignature.forEachParameter((ParameterElement parameter) {
         if (parameter.isInitializingFormal) {
@@ -653,21 +662,21 @@
         }
       });
       if (node.initializers != null) {
-        analyze(node.initializers, inInitializer: true);
+        analyzeUntyped(node.initializers, inInitializer: true);
       }
     } else {
-      FunctionType functionType = element.computeType(resolution);
+      ResolutionFunctionType functionType = element.computeType(resolution);
       returnType = functionType.returnType;
       type = functionType;
     }
     ExecutableElement previousExecutableContext = executableContext;
-    DartType previousReturnType = expectedReturnType;
+    ResolutionDartType previousReturnType = expectedReturnType;
     expectedReturnType = returnType;
     AsyncMarker previousAsyncMarker = currentAsyncMarker;
 
     executableContext = element;
     currentAsyncMarker = element.asyncMarker;
-    analyze(node.body);
+    analyzeUntyped(node.body);
 
     executableContext = previousExecutableContext;
     expectedReturnType = previousReturnType;
@@ -675,7 +684,7 @@
     return type;
   }
 
-  DartType visitIdentifier(Identifier node) {
+  ResolutionDartType visitIdentifier(Identifier node) {
     if (node.isThis()) {
       return thisType;
     } else if (node.isSuper()) {
@@ -685,23 +694,21 @@
       assert(invariant(node, element != null,
           message: 'Missing element for identifier'));
       assert(invariant(
-          node,
-          element.isVariable || element.isParameter || element.isField,
+          node, element.isVariable || element.isParameter || element.isField,
           message: 'Unexpected context element ${element}'));
       return element.computeType(resolution);
     }
   }
 
-  DartType visitIf(If node) {
+  visitIf(If node) {
     Expression condition = node.condition.expression;
     Statement thenPart = node.thenPart;
 
     checkCondition(node.condition);
-    analyzeInPromotedContext(condition, thenPart);
+    analyzeInPromotedContext(condition, thenPart, mustHaveType: false);
     if (node.elsePart != null) {
-      analyze(node.elsePart);
+      analyzeUntyped(node.elsePart);
     }
-    return const StatementType();
   }
 
   void checkPrivateAccess(Node node, Element element, String name) {
@@ -713,8 +720,8 @@
     }
   }
 
-  ElementAccess lookupMember(Node node, DartType receiverType, String name,
-      MemberKind memberKind, Element receiverElement,
+  ElementAccess lookupMember(Node node, ResolutionDartType receiverType,
+      String name, MemberKind memberKind, Element receiverElement,
       {bool lookupClassMember: false, bool isHint: false}) {
     if (receiverType.treatAsDynamic) {
       return const DynamicAccess();
@@ -724,7 +731,8 @@
         isSetter: memberKind == MemberKind.SETTER);
 
     // Lookup the class or interface member [name] in [interface].
-    MemberSignature lookupMemberSignature(Name name, InterfaceType interface) {
+    MemberSignature lookupMemberSignature(
+        Name name, ResolutionInterfaceType interface) {
       MembersCreator.computeClassMembersByName(
           resolution, interface.element, name.text);
       return lookupClassMember || analyzingInitializer
@@ -734,8 +742,8 @@
 
     // Compute the access of [name] on [type]. This function takes the special
     // 'call' method into account.
-    ElementAccess getAccess(
-        Name name, DartType unaliasedBound, InterfaceType interface) {
+    ElementAccess getAccess(Name name, ResolutionDartType unaliasedBound,
+        ResolutionInterfaceType interface) {
       MemberSignature member = lookupMemberSignature(memberName, interface);
       if (member != null) {
         if (member is ErroneousMember) {
@@ -749,22 +757,23 @@
           // This is an access the implicit 'call' method of a function type.
           return new FunctionCallAccess(receiverElement, unaliasedBound);
         }
-        if (types.isSubtype(interface, coreTypes.functionType)) {
+        ResolutionInterfaceType functionType = commonElements.functionType;
+        if (types.isSubtype(interface, functionType)) {
           // This is an access of the special 'call' method implicitly defined
           // on 'Function'. This method can be called with any arguments, which
           // we ensure by giving it the type 'dynamic'.
-          return new FunctionCallAccess(null, const DynamicType());
+          return new FunctionCallAccess(null, const ResolutionDynamicType());
         }
       }
       return null;
     }
 
-    DartType unaliasedBound =
+    ResolutionDartType unaliasedBound =
         Types.computeUnaliasedBound(resolution, receiverType);
     if (unaliasedBound.treatAsDynamic) {
       return new DynamicAccess();
     }
-    InterfaceType interface =
+    ResolutionInterfaceType interface =
         Types.computeInterfaceType(resolution, unaliasedBound);
     ElementAccess access = getAccess(memberName, unaliasedBound, interface);
     if (access != null) {
@@ -777,10 +786,10 @@
         while (!typePromotions.isEmpty) {
           TypePromotion typePromotion = typePromotions.head;
           if (!typePromotion.isValid) {
-            DartType unaliasedBound =
+            ResolutionDartType unaliasedBound =
                 Types.computeUnaliasedBound(resolution, typePromotion.type);
             if (!unaliasedBound.treatAsDynamic) {
-              InterfaceType interface =
+              ResolutionInterfaceType interface =
                   Types.computeInterfaceType(resolution, unaliasedBound);
               if (getAccess(memberName, unaliasedBound, interface) != null) {
                 reportTypePromotionHint(typePromotion);
@@ -801,13 +810,9 @@
         void findPrivateMember(MemberSignature member) {
           if (memberName.isSimilarTo(member.name)) {
             PrivateName privateName = member.name;
-            reportMessage(
-                node,
-                MessageKind.PRIVATE_ACCESS,
-                {
-                  'name': name,
-                  'libraryName': privateName.library.libraryOrScriptName
-                },
+            LibraryElement library = privateName.library;
+            reportMessage(node, MessageKind.PRIVATE_ACCESS,
+                {'name': name, 'libraryName': library.libraryOrScriptName},
                 isHint: isHint);
             foundPrivateMember = true;
           }
@@ -870,19 +875,19 @@
     return const DynamicAccess();
   }
 
-  DartType lookupMemberType(
-      Node node, DartType type, String name, MemberKind memberKind,
+  ResolutionDartType lookupMemberType(
+      Node node, ResolutionDartType type, String name, MemberKind memberKind,
       {bool isHint: false}) {
     return lookupMember(node, type, name, memberKind, null, isHint: isHint)
         .computeType(resolution);
   }
 
-  void analyzeArguments(Send send, Element element, DartType type,
-      [LinkBuilder<DartType> argumentTypes]) {
+  void analyzeArguments(Send send, Element element, ResolutionDartType type,
+      [LinkBuilder<ResolutionDartType> argumentTypes]) {
     Link<Node> arguments = send.arguments;
     type.computeUnaliased(resolution);
-    DartType unaliasedType = type.unaliased;
-    if (identical(unaliasedType.kind, TypeKind.FUNCTION)) {
+    ResolutionDartType unaliasedType = type.unaliased;
+    if (identical(unaliasedType.kind, ResolutionTypeKind.FUNCTION)) {
       /// Report [warning] including info(s) about the declaration of [element]
       /// or [type].
       void reportWarning(DiagnosticMessage warning) {
@@ -906,17 +911,18 @@
 
       /// Report a warning on [node] if [argumentType] is not assignable to
       /// [parameterType].
-      void checkAssignable(
-          Spannable node, DartType argumentType, DartType parameterType) {
+      void checkAssignable(Spannable node, ResolutionDartType argumentType,
+          ResolutionDartType parameterType) {
         if (!types.isAssignable(argumentType, parameterType)) {
           reportWarning(reporter.createMessage(node, MessageKind.NOT_ASSIGNABLE,
               {'fromType': argumentType, 'toType': parameterType}));
         }
       }
 
-      FunctionType funType = unaliasedType;
-      Iterator<DartType> parameterTypes = funType.parameterTypes.iterator;
-      Iterator<DartType> optionalParameterTypes =
+      ResolutionFunctionType funType = unaliasedType;
+      Iterator<ResolutionDartType> parameterTypes =
+          funType.parameterTypes.iterator;
+      Iterator<ResolutionDartType> optionalParameterTypes =
           funType.optionalParameterTypes.iterator;
       while (!arguments.isEmpty) {
         Node argument = arguments.head;
@@ -924,7 +930,7 @@
         if (namedArgument != null) {
           argument = namedArgument.expression;
           String argumentName = namedArgument.name.source;
-          DartType namedParameterType =
+          ResolutionDartType namedParameterType =
               funType.getNamedParameterType(argumentName);
           if (namedParameterType == null) {
             // TODO(johnniwinther): Provide better information on the called
@@ -934,10 +940,10 @@
                 MessageKind.NAMED_ARGUMENT_NOT_FOUND,
                 {'argumentName': argumentName}));
 
-            DartType argumentType = analyze(argument);
+            ResolutionDartType argumentType = analyze(argument);
             if (argumentTypes != null) argumentTypes.addLast(argumentType);
           } else {
-            DartType argumentType = analyze(argument);
+            ResolutionDartType argumentType = analyze(argument);
             if (argumentTypes != null) argumentTypes.addLast(argumentType);
             checkAssignable(argument, argumentType, namedParameterType);
           }
@@ -949,16 +955,16 @@
               reportWarning(reporter.createMessage(
                   argument, MessageKind.ADDITIONAL_ARGUMENT));
 
-              DartType argumentType = analyze(argument);
+              ResolutionDartType argumentType = analyze(argument);
               if (argumentTypes != null) argumentTypes.addLast(argumentType);
             } else {
-              DartType argumentType = analyze(argument);
+              ResolutionDartType argumentType = analyze(argument);
               if (argumentTypes != null) argumentTypes.addLast(argumentType);
               checkAssignable(
                   argument, argumentType, optionalParameterTypes.current);
             }
           } else {
-            DartType argumentType = analyze(argument);
+            ResolutionDartType argumentType = analyze(argument);
             if (argumentTypes != null) argumentTypes.addLast(argumentType);
             checkAssignable(argument, argumentType, parameterTypes.current);
           }
@@ -973,7 +979,7 @@
       }
     } else {
       while (!arguments.isEmpty) {
-        DartType argumentType = analyze(arguments.head);
+        ResolutionDartType argumentType = analyze(arguments.head);
         if (argumentTypes != null) argumentTypes.addLast(argumentType);
         arguments = arguments.tail;
       }
@@ -984,24 +990,24 @@
   //
   // If provided [argumentTypes] is filled with the argument types during
   // analysis.
-  DartType analyzeInvocation(Send node, ElementAccess elementAccess,
-      [LinkBuilder<DartType> argumentTypes]) {
-    DartType type = elementAccess.computeType(resolution);
+  ResolutionDartType analyzeInvocation(Send node, ElementAccess elementAccess,
+      [LinkBuilder<ResolutionDartType> argumentTypes]) {
+    ResolutionDartType type = elementAccess.computeType(resolution);
     if (elementAccess.isCallable(compiler)) {
       analyzeArguments(node, elementAccess.element, type, argumentTypes);
     } else {
       reportTypeWarning(
           node, MessageKind.NOT_CALLABLE, {'elementName': elementAccess.name});
-      analyzeArguments(
-          node, elementAccess.element, const DynamicType(), argumentTypes);
+      analyzeArguments(node, elementAccess.element,
+          const ResolutionDynamicType(), argumentTypes);
     }
     type.computeUnaliased(resolution);
     type = type.unaliased;
     if (type.isFunctionType) {
-      FunctionType funType = type;
+      ResolutionFunctionType funType = type;
       return funType.returnType;
     } else {
-      return const DynamicType();
+      return const ResolutionDynamicType();
     }
   }
 
@@ -1029,7 +1035,7 @@
         }
       }
       // e.foo() for some expression e.
-      DartType receiverType = analyze(node.receiver);
+      ResolutionDartType receiverType = analyze(node.receiver);
       if (receiverType.treatAsDynamic || receiverType.isVoid) {
         return const DynamicAccess();
       }
@@ -1101,10 +1107,10 @@
    * Computes the type of the access of [name] on the [node] possibly using the
    * [element] provided for [node] by the resolver.
    */
-  DartType computeAccessType(
+  ResolutionDartType computeAccessType(
       Send node, String name, Element element, MemberKind memberKind,
       {bool lookupClassMember: false}) {
-    DartType type = computeAccess(node, name, element, memberKind,
+    ResolutionDartType type = computeAccess(node, name, element, memberKind,
             lookupClassMember: lookupClassMember)
         .computeType(resolution);
     if (type == null) {
@@ -1117,7 +1123,8 @@
   /// This is used to provided better hints when trying to promote a supertype
   /// to a raw subtype. For instance trying to promote `Iterable<int>` to `List`
   /// we suggest the use of `List<int>`, which would make promotion valid.
-  DartType computeMoreSpecificType(DartType shownType, DartType knownType) {
+  ResolutionDartType computeMoreSpecificType(
+      ResolutionDartType shownType, ResolutionDartType knownType) {
     if (knownType.isInterfaceType &&
         shownType.isInterfaceType &&
         types.isSubtype(shownType.asRaw(), knownType)) {
@@ -1126,14 +1133,14 @@
       //     class B<S, U> extends A<S, int> {}
       // and a promotion from a [knownType] of `A<double, int>` to a
       // [shownType] of `B`.
-      InterfaceType knownInterfaceType = knownType;
+      ResolutionInterfaceType knownInterfaceType = knownType;
       ClassElement shownClass = shownType.element;
 
       // Compute `B<double, dynamic>` as the subtype of `A<double, int>` using
       // the relation between `A<S, int>` and `A<double, int>`.
       MoreSpecificSubtypeVisitor visitor =
           new MoreSpecificSubtypeVisitor(types);
-      InterfaceType shownTypeGeneric =
+      ResolutionInterfaceType shownTypeGeneric =
           visitor.computeMoreSpecific(shownClass, knownInterfaceType);
 
       if (shownTypeGeneric != null &&
@@ -1146,11 +1153,11 @@
     return null;
   }
 
-  DartType visitSend(Send node) {
+  ResolutionDartType visitSend(Send node) {
     Element element = elements[node];
 
     if (element != null && element.isConstructor) {
-      DartType receiverType;
+      ResolutionDartType receiverType;
       if (node.receiver != null) {
         receiverType = analyze(node.receiver);
       } else if (node.selector.isSuper()) {
@@ -1160,9 +1167,10 @@
         assert(node.selector.isThis());
         receiverType = thisType;
       }
-      DartType constructorType = computeConstructorType(element, receiverType);
+      ResolutionDartType constructorType =
+          computeConstructorType(element, receiverType);
       analyzeArguments(node, element, constructorType);
-      return const DynamicType();
+      return const ResolutionDynamicType();
     }
 
     Identifier selector = node.selector.asIdentifier();
@@ -1179,12 +1187,12 @@
         }
       } else {
         // exp() where exp is some complex expression like (o) or foo().
-        DartType type = analyze(node.selector);
+        ResolutionDartType type = analyze(node.selector);
         return analyzeInvocation(node, new TypeAccess(type));
       }
     } else if (Elements.isMalformed(element) && selector == null) {
       // exp() where exp is an erroneous construct like `new Unresolved()`.
-      DartType type = analyze(node.selector);
+      ResolutionDartType type = analyze(node.selector);
       return analyzeInvocation(node, new TypeAccess(type));
     }
 
@@ -1206,9 +1214,10 @@
         }
 
         if (variable != null && (variable.isVariable || variable.isParameter)) {
-          DartType knownType = getKnownType(variable);
+          ResolutionDartType knownType = getKnownType(variable);
           if (!knownType.isDynamic) {
-            DartType shownType = elements.getType(node.arguments.head);
+            ResolutionDartType shownType =
+                elements.getType(node.arguments.head);
             TypePromotion typePromotion =
                 new TypePromotion(node, variable, shownType);
             if (!types.isMoreSpecific(shownType, knownType)) {
@@ -1221,7 +1230,7 @@
                   'knownType': knownType
                 }));
               } else {
-                DartType shownTypeSuggestion =
+                ResolutionDartType shownTypeSuggestion =
                     computeMoreSpecificType(shownType, knownType);
                 if (shownTypeSuggestion != null) {
                   typePromotion.addHint(reporter.createMessage(
@@ -1252,7 +1261,7 @@
       return elements.getType(node.arguments.head);
     } else if (node.isOperator) {
       final Node receiver = node.receiver;
-      final DartType receiverType = analyze(receiver);
+      final ResolutionDartType receiverType = analyze(receiver);
       if (identical(name, '==') ||
           identical(name, '!=')
           // TODO(johnniwinther): Remove these.
@@ -1265,14 +1274,14 @@
       } else if (identical(name, '||')) {
         checkAssignable(receiver, receiverType, boolType);
         final Node argument = node.arguments.head;
-        final DartType argumentType = analyze(argument);
+        final ResolutionDartType argumentType = analyze(argument);
         checkAssignable(argument, argumentType, boolType);
         return boolType;
       } else if (identical(name, '&&')) {
         checkAssignable(receiver, receiverType, boolType);
         final Node argument = node.arguments.head;
 
-        final DartType argumentType =
+        final ResolutionDartType argumentType =
             analyzeInPromotedContext(receiver, argument);
 
         reshowTypePromotions(node, receiver, argument);
@@ -1286,7 +1295,7 @@
         return boolType;
       } else if (identical(name, '??')) {
         final Node argument = node.arguments.head;
-        final DartType argumentType = analyze(argument);
+        final ResolutionDartType argumentType = analyze(argument);
         return types.computeLeastUpperBound(receiverType, argumentType);
       }
       String operatorName = selector.source;
@@ -1321,15 +1330,16 @@
           ? const DynamicAccess()
           : lookupMember(
               node, receiverType, operatorName, MemberKind.OPERATOR, null);
-      LinkBuilder<DartType> argumentTypesBuilder = new LinkBuilder<DartType>();
-      DartType resultType =
+      LinkBuilder<ResolutionDartType> argumentTypesBuilder =
+          new LinkBuilder<ResolutionDartType>();
+      ResolutionDartType resultType =
           analyzeInvocation(node, access, argumentTypesBuilder);
       if (receiverType == intType) {
         if (identical(name, '+') ||
             identical(operatorName, '-') ||
             identical(name, '*') ||
             identical(name, '%')) {
-          DartType argumentType = argumentTypesBuilder.toLink().head;
+          ResolutionDartType argumentType = argumentTypesBuilder.toLink().head;
           if (argumentType == intType) {
             return intType;
           } else if (argumentType == doubleType) {
@@ -1352,16 +1362,16 @@
   }
 
   /// Returns the first type in the list or [:dynamic:] if the list is empty.
-  DartType firstType(List<DartType> list) {
-    return list.isEmpty ? const DynamicType() : list.first;
+  ResolutionDartType firstType(List<ResolutionDartType> list) {
+    return list.isEmpty ? const ResolutionDynamicType() : list.first;
   }
 
   /**
    * Returns the second type in the list or [:dynamic:] if the list is too
    * short.
    */
-  DartType secondType(List<DartType> list) {
-    return list.length < 2 ? const DynamicType() : list[1];
+  ResolutionDartType secondType(List<ResolutionDartType> list) {
+    return list.length < 2 ? const ResolutionDynamicType() : list[1];
   }
 
   /**
@@ -1369,24 +1379,25 @@
    * of the result. This method also handles increment/decrement expressions
    * like [: target++ :].
    */
-  DartType checkAssignmentOperator(
-      SendSet node, String operatorName, Node valueNode, DartType value) {
+  ResolutionDartType checkAssignmentOperator(SendSet node, String operatorName,
+      Node valueNode, ResolutionDartType value) {
     assert(invariant(node, !node.isIndex));
     Element setterElement = elements[node];
     Element getterElement = elements[node.selector];
     Identifier selector = node.selector;
-    DartType getter = computeAccessType(
+    ResolutionDartType getter = computeAccessType(
         node, selector.source, getterElement, MemberKind.GETTER);
-    DartType setter = computeAccessType(
+    ResolutionDartType setter = computeAccessType(
         node, selector.source, setterElement, MemberKind.SETTER);
     // [operator] is the type of operator+ or operator- on [target].
-    DartType operator =
+    ResolutionDartType operator =
         lookupMemberType(node, getter, operatorName, MemberKind.OPERATOR);
-    if (operator is FunctionType) {
-      FunctionType operatorType = operator;
+    if (operator is ResolutionFunctionType) {
+      ResolutionFunctionType operatorType = operator;
       // [result] is the type of target o value.
-      DartType result = operatorType.returnType;
-      DartType operatorArgument = firstType(operatorType.parameterTypes);
+      ResolutionDartType result = operatorType.returnType;
+      ResolutionDartType operatorArgument =
+          firstType(operatorType.parameterTypes);
       // Check target o value.
       bool validValue = checkAssignable(valueNode, value, operatorArgument);
       if (validValue || !(node.isPrefix || node.isPostfix)) {
@@ -1395,7 +1406,7 @@
       }
       return node.isPostfix ? getter : result;
     }
-    return const DynamicType();
+    return const ResolutionDynamicType();
   }
 
   /**
@@ -1403,43 +1414,47 @@
    * of the result. This method also handles increment/decrement expressions
    * like [: base[key]++ :].
    */
-  DartType checkIndexAssignmentOperator(
-      SendSet node, String operatorName, Node valueNode, DartType value) {
+  ResolutionDartType checkIndexAssignmentOperator(SendSet node,
+      String operatorName, Node valueNode, ResolutionDartType value) {
     assert(invariant(node, node.isIndex));
-    final DartType base = analyze(node.receiver);
+    final ResolutionDartType base = analyze(node.receiver);
     final Node keyNode = node.arguments.head;
-    final DartType key = analyze(keyNode);
+    final ResolutionDartType key = analyze(keyNode);
 
     // [indexGet] is the type of operator[] on [base].
-    DartType indexGet = lookupMemberType(node, base, '[]', MemberKind.OPERATOR);
-    if (indexGet is FunctionType) {
-      FunctionType indexGetType = indexGet;
-      DartType indexGetKey = firstType(indexGetType.parameterTypes);
+    ResolutionDartType indexGet =
+        lookupMemberType(node, base, '[]', MemberKind.OPERATOR);
+    if (indexGet is ResolutionFunctionType) {
+      ResolutionFunctionType indexGetType = indexGet;
+      ResolutionDartType indexGetKey = firstType(indexGetType.parameterTypes);
       // Check base[key].
       bool validKey = checkAssignable(keyNode, key, indexGetKey);
 
       // [element] is the type of base[key].
-      DartType element = indexGetType.returnType;
+      ResolutionDartType element = indexGetType.returnType;
       // [operator] is the type of operator o on [element].
-      DartType operator =
+      ResolutionDartType operator =
           lookupMemberType(node, element, operatorName, MemberKind.OPERATOR);
-      if (operator is FunctionType) {
-        FunctionType operatorType = operator;
+      if (operator is ResolutionFunctionType) {
+        ResolutionFunctionType operatorType = operator;
 
         // Check base[key] o value.
-        DartType operatorArgument = firstType(operatorType.parameterTypes);
+        ResolutionDartType operatorArgument =
+            firstType(operatorType.parameterTypes);
         bool validValue = checkAssignable(valueNode, value, operatorArgument);
 
         // [result] is the type of base[key] o value.
-        DartType result = operatorType.returnType;
+        ResolutionDartType result = operatorType.returnType;
 
         // [indexSet] is the type of operator[]= on [base].
-        DartType indexSet =
+        ResolutionDartType indexSet =
             lookupMemberType(node, base, '[]=', MemberKind.OPERATOR);
-        if (indexSet is FunctionType) {
-          FunctionType indexSetType = indexSet;
-          DartType indexSetKey = firstType(indexSetType.parameterTypes);
-          DartType indexSetValue = secondType(indexSetType.parameterTypes);
+        if (indexSet is ResolutionFunctionType) {
+          ResolutionFunctionType indexSetType = indexSet;
+          ResolutionDartType indexSetKey =
+              firstType(indexSetType.parameterTypes);
+          ResolutionDartType indexSetValue =
+              secondType(indexSetType.parameterTypes);
 
           if (validKey || indexGetKey != indexSetKey) {
             // Only check base[key] on []= if base[key] was valid for [] or
@@ -1454,7 +1469,7 @@
         return node.isPostfix ? element : result;
       }
     }
-    return const DynamicType();
+    return const ResolutionDynamicType();
   }
 
   visitSendSet(SendSet node) {
@@ -1465,17 +1480,18 @@
       // e1 = value
       if (node.isIndex) {
         // base[key] = value
-        final DartType base = analyze(node.receiver);
+        final ResolutionDartType base = analyze(node.receiver);
         final Node keyNode = node.arguments.head;
-        final DartType key = analyze(keyNode);
+        final ResolutionDartType key = analyze(keyNode);
         final Node valueNode = node.arguments.tail.head;
-        final DartType value = analyze(valueNode);
-        DartType indexSet =
+        final ResolutionDartType value = analyze(valueNode);
+        ResolutionDartType indexSet =
             lookupMemberType(node, base, '[]=', MemberKind.OPERATOR);
-        DartType indexSetValue = const DynamicType();
-        if (indexSet is FunctionType) {
-          FunctionType indexSetType = indexSet;
-          DartType indexSetKey = firstType(indexSetType.parameterTypes);
+        ResolutionDartType indexSetValue = const ResolutionDynamicType();
+        if (indexSet is ResolutionFunctionType) {
+          ResolutionFunctionType indexSetType = indexSet;
+          ResolutionDartType indexSetKey =
+              firstType(indexSetType.parameterTypes);
           checkAssignable(keyNode, key, indexSetKey);
           indexSetValue = secondType(indexSetType.parameterTypes);
           checkAssignable(node.assignmentOperator, value, indexSetValue);
@@ -1485,7 +1501,7 @@
             : types.computeLeastUpperBound(value, indexSetValue);
       } else {
         // target = value
-        DartType target;
+        ResolutionDartType target;
         if (analyzingInitializer) {
           // Field declaration `Foo target = value;` or initializer
           // `this.target = value`. Lookup the getter `target` in the class
@@ -1499,7 +1515,7 @@
               node, selector.source, element, MemberKind.SETTER);
         }
         final Node valueNode = node.arguments.head;
-        final DartType value = analyze(valueNode);
+        final ResolutionDartType value = analyze(valueNode);
         checkAssignable(node.assignmentOperator, value, target);
         return identical(name, '=')
             ? value
@@ -1560,57 +1576,58 @@
       if (node.isIndex) {
         // base[key] o= value for some operator o.
         final Node valueNode = node.arguments.tail.head;
-        final DartType value = analyze(valueNode);
+        final ResolutionDartType value = analyze(valueNode);
         return checkIndexAssignmentOperator(
             node, operatorName, valueNode, value);
       } else {
         // target o= value for some operator o.
         final Node valueNode = node.arguments.head;
-        final DartType value = analyze(valueNode);
+        final ResolutionDartType value = analyze(valueNode);
         return checkAssignmentOperator(node, operatorName, valueNode, value);
       }
     }
   }
 
-  DartType visitLiteralInt(LiteralInt node) {
+  ResolutionDartType visitLiteralInt(LiteralInt node) {
     return intType;
   }
 
-  DartType visitLiteralDouble(LiteralDouble node) {
+  ResolutionDartType visitLiteralDouble(LiteralDouble node) {
     return doubleType;
   }
 
-  DartType visitLiteralBool(LiteralBool node) {
+  ResolutionDartType visitLiteralBool(LiteralBool node) {
     return boolType;
   }
 
-  DartType visitLiteralString(LiteralString node) {
+  ResolutionDartType visitLiteralString(LiteralString node) {
     return stringType;
   }
 
-  DartType visitStringJuxtaposition(StringJuxtaposition node) {
+  ResolutionDartType visitStringJuxtaposition(StringJuxtaposition node) {
     analyze(node.first);
     analyze(node.second);
     return stringType;
   }
 
-  DartType visitLiteralNull(LiteralNull node) {
-    return const DynamicType();
+  ResolutionDartType visitLiteralNull(LiteralNull node) {
+    return const ResolutionDynamicType();
   }
 
-  DartType visitLiteralSymbol(LiteralSymbol node) {
-    return coreTypes.symbolType;
+  ResolutionInterfaceType visitLiteralSymbol(LiteralSymbol node) {
+    return commonElements.symbolType;
   }
 
-  DartType computeConstructorType(
-      ConstructorElement constructor, DartType type) {
-    if (Elements.isUnresolved(constructor)) return const DynamicType();
-    DartType constructorType = constructor.computeType(resolution);
-    if (identical(type.kind, TypeKind.INTERFACE)) {
+  ResolutionDartType computeConstructorType(
+      ConstructorElement constructor, ResolutionDartType type) {
+    if (Elements.isUnresolved(constructor))
+      return const ResolutionDynamicType();
+    ResolutionDartType constructorType = constructor.computeType(resolution);
+    if (identical(type.kind, ResolutionTypeKind.INTERFACE)) {
       if (constructor.isSynthesized) {
         // TODO(johnniwinther): Remove this when synthesized constructors handle
         // type variables correctly.
-        InterfaceType interfaceType = type;
+        ResolutionInterfaceType interfaceType = type;
         ClassElement receiverElement = interfaceType.element;
         while (receiverElement.isMixinApplication) {
           receiverElement = receiverElement.supertype.element;
@@ -1624,55 +1641,54 @@
     return constructorType;
   }
 
-  DartType visitNewExpression(NewExpression node) {
+  ResolutionDartType visitNewExpression(NewExpression node) {
     Element element = elements[node.send];
-    if (Elements.isUnresolved(element)) return const DynamicType();
+    if (Elements.isUnresolved(element)) return const ResolutionDynamicType();
 
     checkPrivateAccess(node, element, element.name);
 
-    DartType newType = elements.getType(node);
+    ResolutionDartType newType = elements.getType(node);
     assert(invariant(node, newType != null,
         message: "No new type registered in $elements."));
-    DartType constructorType = computeConstructorType(element, newType);
+    ResolutionDartType constructorType =
+        computeConstructorType(element, newType);
     analyzeArguments(node.send, element, constructorType);
     return newType;
   }
 
-  DartType visitLiteralList(LiteralList node) {
-    InterfaceType listType = elements.getType(node);
-    DartType listElementType = firstType(listType.typeArguments);
+  ResolutionDartType visitLiteralList(LiteralList node) {
+    ResolutionInterfaceType listType = elements.getType(node);
+    ResolutionDartType listElementType = firstType(listType.typeArguments);
     for (Link<Node> link = node.elements.nodes;
         !link.isEmpty;
         link = link.tail) {
       Node element = link.head;
-      DartType elementType = analyze(element);
+      ResolutionDartType elementType = analyze(element);
       checkAssignable(element, elementType, listElementType,
           isConst: node.isConst);
     }
     return listType;
   }
 
-  DartType visitNodeList(NodeList node) {
+  visitNodeList(NodeList node) {
     for (Link<Node> link = node.nodes; !link.isEmpty; link = link.tail) {
-      analyze(link.head, inInitializer: analyzingInitializer);
+      analyzeUntyped(link.head, inInitializer: analyzingInitializer);
     }
-    return const StatementType();
   }
 
-  DartType visitRedirectingFactoryBody(RedirectingFactoryBody node) {
+  visitRedirectingFactoryBody(RedirectingFactoryBody node) {
     // TODO(lrn): Typecheck the body. It must refer to the constructor
     // of a subtype.
-    return const StatementType();
   }
 
-  DartType visitRethrow(Rethrow node) {
-    return const StatementType();
+  visitRethrow(Rethrow node) {
+    // Nothing to do here.
   }
 
   /** Dart Programming Language Specification: 11.10 Return */
-  DartType visitReturn(Return node) {
+  visitReturn(Return node) {
     if (identical(node.beginToken.stringValue, 'native')) {
-      return const StatementType();
+      return;
     }
 
     final Node expression = node.expression;
@@ -1681,15 +1697,17 @@
     // if the type of e may not be assigned to the declared return type of the
     // immediately enclosing function.
     if (expression != null) {
-      DartType expressionType = analyze(expression);
+      ResolutionDartType expressionType = analyze(expression);
       if (executableContext.isGenerativeConstructor) {
         // The resolver already emitted an error for this expression.
       } else {
         if (currentAsyncMarker == AsyncMarker.ASYNC) {
-          expressionType = coreTypes.futureType(types.flatten(expressionType));
+          ResolutionInterfaceType futureOfFlattenedType =
+              commonElements.futureType(types.flatten(expressionType));
+          expressionType = futureOfFlattenedType;
         }
         if (expectedReturnType.isVoid &&
-            !types.isAssignable(expressionType, const VoidType())) {
+            !types.isAssignable(expressionType, const ResolutionVoidType())) {
           reportTypeWarning(expression, MessageKind.RETURN_VALUE_IN_VOID);
         } else {
           checkAssignable(expression, expressionType, expectedReturnType);
@@ -1697,7 +1715,8 @@
       }
     } else if (currentAsyncMarker != AsyncMarker.SYNC) {
       // `return;` is allowed.
-    } else if (!types.isAssignable(expectedReturnType, const VoidType())) {
+    } else if (!types.isAssignable(
+        expectedReturnType, const ResolutionVoidType())) {
       // Let f be the function immediately enclosing a return statement of the
       // form 'return;' It is a static warning if both of the following
       // conditions hold:
@@ -1706,69 +1725,74 @@
       reportTypeWarning(
           node, MessageKind.RETURN_NOTHING, {'returnType': expectedReturnType});
     }
-    return const StatementType();
   }
 
-  DartType visitThrow(Throw node) {
+  ResolutionDartType visitThrow(Throw node) {
     // TODO(johnniwinther): Handle reachability.
     analyze(node.expression);
-    return const DynamicType();
+    return const ResolutionDynamicType();
   }
 
-  DartType visitAwait(Await node) {
-    DartType expressionType = analyze(node.expression);
+  ResolutionDartType visitAwait(Await node) {
+    ResolutionDartType expressionType = analyze(node.expression);
     if (resolution.target.supportsAsyncAwait) {
       return types.flatten(expressionType);
     } else {
-      return const DynamicType();
+      return const ResolutionDynamicType();
     }
   }
 
-  DartType visitYield(Yield node) {
-    DartType resultType = analyze(node.expression);
+  visitYield(Yield node) {
+    ResolutionDartType resultType = analyze(node.expression);
     if (!node.hasStar) {
       if (currentAsyncMarker.isAsync) {
-        resultType = coreTypes.streamType(resultType);
+        ResolutionInterfaceType streamOfResultType =
+            commonElements.streamType(resultType);
+        resultType = streamOfResultType;
       } else {
-        resultType = coreTypes.iterableType(resultType);
+        ResolutionInterfaceType iterableOfResultType =
+            commonElements.iterableType(resultType);
+        resultType = iterableOfResultType;
       }
     } else {
       if (currentAsyncMarker.isAsync) {
         // The static type of expression must be assignable to Stream.
-        checkAssignable(node, resultType, coreTypes.streamType());
+        ResolutionInterfaceType streamType = commonElements.streamType();
+        checkAssignable(node, resultType, streamType);
       } else {
         // The static type of expression must be assignable to Iterable.
-        checkAssignable(node, resultType, coreTypes.iterableType());
+        ResolutionInterfaceType iterableType = commonElements.iterableType();
+        checkAssignable(node, resultType, iterableType);
       }
     }
     // The static type of the result must be assignable to the declared type.
     checkAssignable(node, resultType, expectedReturnType);
-    return const StatementType();
   }
 
-  DartType visitTypeAnnotation(TypeAnnotation node) {
+  ResolutionDartType visitTypeAnnotation(TypeAnnotation node) {
     return elements.getType(node);
   }
 
-  DartType analyzeVariableTypeAnnotation(VariableDefinitions node) {
-    DartType type = analyzeWithDefault(node.type, const DynamicType());
+  ResolutionDartType analyzeVariableTypeAnnotation(VariableDefinitions node) {
+    ResolutionDartType type =
+        analyzeWithDefault(node.type, const ResolutionDynamicType());
     if (type.isVoid) {
       reportTypeWarning(node.type, MessageKind.VOID_VARIABLE);
-      type = const DynamicType();
+      type = const ResolutionDynamicType();
     }
     return type;
   }
 
   void analyzeVariableInitializer(
-      Spannable spannable, DartType declaredType, Node initializer) {
+      Spannable spannable, ResolutionDartType declaredType, Node initializer) {
     if (initializer == null) return;
 
-    DartType expressionType = analyzeNonVoid(initializer);
+    ResolutionDartType expressionType = analyzeNonVoid(initializer);
     checkAssignable(spannable, expressionType, declaredType);
   }
 
-  DartType visitVariableDefinitions(VariableDefinitions node) {
-    DartType type = analyzeVariableTypeAnnotation(node);
+  visitVariableDefinitions(VariableDefinitions node) {
+    ResolutionDartType type = analyzeVariableTypeAnnotation(node);
     for (Link<Node> link = node.definitions.nodes;
         !link.isEmpty;
         link = link.tail) {
@@ -1792,33 +1816,33 @@
         // }
       }
     }
-    return const StatementType();
   }
 
-  DartType visitWhile(While node) {
+  visitWhile(While node) {
     checkCondition(node.condition);
-    analyze(node.body);
-    return const StatementType();
+    analyzeUntyped(node.body);
   }
 
-  DartType visitParenthesizedExpression(ParenthesizedExpression node) {
+  ResolutionDartType visitParenthesizedExpression(
+      ParenthesizedExpression node) {
     Expression expression = node.expression;
-    DartType type = analyze(expression);
+    ResolutionDartType type = analyze(expression);
     for (TypePromotion typePromotion in getShownTypePromotionsFor(expression)) {
       showTypePromotion(node, typePromotion);
     }
     return type;
   }
 
-  DartType visitConditional(Conditional node) {
+  ResolutionDartType visitConditional(Conditional node) {
     Expression condition = node.condition;
     Expression thenExpression = node.thenExpression;
 
     checkCondition(condition);
 
-    DartType thenType = analyzeInPromotedContext(condition, thenExpression);
+    ResolutionDartType thenType =
+        analyzeInPromotedContext(condition, thenExpression);
 
-    DartType elseType = analyze(node.elseExpression);
+    ResolutionDartType elseType = analyze(node.elseExpression);
     return types.computeLeastUpperBound(thenType, elseType);
   }
 
@@ -1833,44 +1857,46 @@
   }
 
   visitEmptyStatement(EmptyStatement node) {
-    return const StatementType();
+    // Nothing to do here.
   }
 
   visitBreakStatement(BreakStatement node) {
-    return const StatementType();
+    // Nothing to do here.
   }
 
   visitContinueStatement(ContinueStatement node) {
-    return const StatementType();
+    // Nothing to do here.
   }
 
-  DartType computeForInElementType(ForIn node) {
+  ResolutionDartType computeForInElementType(ForIn node) {
     VariableDefinitions declaredIdentifier =
         node.declaredIdentifier.asVariableDefinitions();
     if (declaredIdentifier != null) {
-      return analyzeWithDefault(declaredIdentifier.type, const DynamicType());
+      return analyzeWithDefault(
+          declaredIdentifier.type, const ResolutionDynamicType());
     } else {
       return analyze(node.declaredIdentifier);
     }
   }
 
   visitAsyncForIn(AsyncForIn node) {
-    DartType elementType = computeForInElementType(node);
-    DartType expressionType = analyze(node.expression);
+    ResolutionDartType elementType = computeForInElementType(node);
+    ResolutionDartType expressionType = analyze(node.expression);
     if (resolution.target.supportsAsyncAwait) {
-      DartType streamOfDynamic = coreTypes.streamType();
+      ResolutionInterfaceType streamOfDynamic = commonElements.streamType();
       if (!types.isAssignable(expressionType, streamOfDynamic)) {
         reportMessage(node.expression, MessageKind.NOT_ASSIGNABLE,
             {'fromType': expressionType, 'toType': streamOfDynamic},
             isHint: true);
       } else {
-        InterfaceType interfaceType =
+        ResolutionInterfaceType interfaceType =
             Types.computeInterfaceType(resolution, expressionType);
         if (interfaceType != null) {
-          InterfaceType streamType =
+          ResolutionInterfaceType streamType =
               interfaceType.asInstanceOf(streamOfDynamic.element);
           if (streamType != null) {
-            DartType streamElementType = streamType.typeArguments.first;
+            ResolutionDartType streamElementType =
+                streamType.typeArguments.first;
             if (!types.isAssignable(streamElementType, elementType)) {
               reportMessage(
                   node.expression,
@@ -1886,16 +1912,15 @@
         }
       }
     }
-    analyze(node.body);
-    return const StatementType();
+    analyzeUntyped(node.body);
   }
 
   visitSyncForIn(SyncForIn node) {
-    DartType elementType = computeForInElementType(node);
-    DartType expressionType = analyze(node.expression);
-    DartType iteratorType = lookupMemberType(node.expression, expressionType,
-        Identifiers.iterator, MemberKind.GETTER);
-    DartType currentType = lookupMemberType(
+    ResolutionDartType elementType = computeForInElementType(node);
+    ResolutionDartType expressionType = analyze(node.expression);
+    ResolutionDartType iteratorType = lookupMemberType(node.expression,
+        expressionType, Identifiers.iterator, MemberKind.GETTER);
+    ResolutionDartType currentType = lookupMemberType(
         node.expression, iteratorType, Identifiers.current, MemberKind.GETTER,
         isHint: true);
     if (!types.isAssignable(currentType, elementType)) {
@@ -1909,26 +1934,25 @@
           },
           isHint: true);
     }
-    analyze(node.body);
-    return const StatementType();
+    analyzeUntyped(node.body);
   }
 
   visitLabeledStatement(LabeledStatement node) {
-    return analyze(node.statement);
+    analyzeUntyped(node.statement);
   }
 
   visitLiteralMap(LiteralMap node) {
-    InterfaceType mapType = elements.getType(node);
-    DartType mapKeyType = firstType(mapType.typeArguments);
-    DartType mapValueType = secondType(mapType.typeArguments);
+    ResolutionInterfaceType mapType = elements.getType(node);
+    ResolutionDartType mapKeyType = firstType(mapType.typeArguments);
+    ResolutionDartType mapValueType = secondType(mapType.typeArguments);
     bool isConst = node.isConst;
     for (Link<Node> link = node.entries.nodes;
         !link.isEmpty;
         link = link.tail) {
       LiteralMapEntry entry = link.head;
-      DartType keyType = analyze(entry.key);
+      ResolutionDartType keyType = analyze(entry.key);
       checkAssignable(entry.key, keyType, mapKeyType, isConst: isConst);
-      DartType valueType = analyze(entry.value);
+      ResolutionDartType valueType = analyze(entry.value);
       checkAssignable(entry.value, valueType, mapValueType, isConst: isConst);
     }
     return mapType;
@@ -1948,7 +1972,7 @@
     // switch cases.
     // TODO(johnniwinther): Provide hint of duplicate case constants.
 
-    DartType expressionType = analyze(node.expression);
+    ResolutionDartType expressionType = analyze(node.expression);
 
     // Check that all the case expressions are assignable to the expression.
     bool hasDefaultCase = false;
@@ -1960,11 +1984,11 @@
         CaseMatch caseMatch = labelOrCase.asCaseMatch();
         if (caseMatch == null) continue;
 
-        DartType caseType = analyze(caseMatch.expression);
+        ResolutionDartType caseType = analyze(caseMatch.expression);
         checkAssignable(caseMatch, expressionType, caseType);
       }
 
-      analyze(switchCase);
+      analyzeUntyped(switchCase);
     }
 
     if (!hasDefaultCase && expressionType.isEnumType) {
@@ -2007,28 +2031,25 @@
         }
       });
     }
-
-    return const StatementType();
   }
 
   visitSwitchCase(SwitchCase node) {
-    return analyze(node.statements);
+    analyzeUntyped(node.statements);
   }
 
   visitTryStatement(TryStatement node) {
     // TODO(johnniwinther): Use reachability information of try-block,
     // catch-blocks and finally-block to compute the whether the try statement
     // is returning.
-    analyze(node.tryBlock);
+    analyzeUntyped(node.tryBlock);
     for (CatchBlock catchBlock in node.catchBlocks) {
-      analyze(catchBlock);
+      analyzeUntyped(catchBlock);
     }
-    analyzeWithDefault(node.finallyBlock, null);
-    return const StatementType();
+    analyzeUntyped(node.finallyBlock);
   }
 
   visitCatchBlock(CatchBlock node) {
-    return analyze(node.block);
+    analyzeUntyped(node.block);
   }
 
   visitTypedef(Typedef node) {
diff --git a/pkg/compiler/lib/src/types/abstract_value_domain.dart b/pkg/compiler/lib/src/types/abstract_value_domain.dart
index e19da52..287cd2e 100644
--- a/pkg/compiler/lib/src/types/abstract_value_domain.dart
+++ b/pkg/compiler/lib/src/types/abstract_value_domain.dart
@@ -5,7 +5,7 @@
 library dart2js.abstract_value_domain;
 
 import '../constants/values.dart';
-import '../dart_types.dart';
+import '../elements/resolution_types.dart';
 import '../elements/elements.dart';
 import '../universe/selector.dart' show Selector;
 
@@ -139,7 +139,7 @@
 
   bool isMorePreciseOrEqual(AbstractValue t1, AbstractValue t2);
 
-  AbstractBool isSubtypeOf(AbstractValue value, DartType type,
+  AbstractBool isSubtypeOf(AbstractValue value, ResolutionDartType type,
       {bool allowNull});
 
   /// Returns whether [value] is one of the falsy values: false, 0, -0, NaN,
@@ -149,7 +149,7 @@
   AbstractBool strictBoolify(AbstractValue type);
 
   /// Create a type mask containing at least all subtypes of [type].
-  AbstractValue subtypesOf(DartType type);
+  AbstractValue subtypesOf(ResolutionDartType type);
 
   /// Returns a subset of [receiver] containing at least the types
   /// that can respond to [selector] without throwing.
diff --git a/pkg/compiler/lib/src/types/constants.dart b/pkg/compiler/lib/src/types/constants.dart
index 60dbd90..c6cc7b8 100644
--- a/pkg/compiler/lib/src/types/constants.dart
+++ b/pkg/compiler/lib/src/types/constants.dart
@@ -5,119 +5,123 @@
 library types.constants;
 
 import '../common.dart';
+import '../constants/constant_system.dart' show ConstantSystem;
 import '../compiler.dart' show Compiler;
 import '../constants/values.dart';
-import '../js_backend/js_backend.dart' show SyntheticConstantKind;
+import '../js_backend/js_backend.dart'
+    show JavaScriptBackend, SyntheticConstantKind;
+import '../world.dart' show ClosedWorld;
 import 'masks.dart';
 
 /// Computes the [TypeMask] for the constant [value].
-TypeMask computeTypeMask(Compiler compiler, ConstantValue value) {
-  return value.accept(const ConstantValueTypeMasks(), compiler);
+TypeMask computeTypeMask(ClosedWorld closedWorld, ConstantValue value) {
+  return value.accept(const ConstantValueTypeMasks(), closedWorld);
 }
 
-class ConstantValueTypeMasks extends ConstantValueVisitor<TypeMask, Compiler> {
+class ConstantValueTypeMasks
+    extends ConstantValueVisitor<TypeMask, ClosedWorld> {
   const ConstantValueTypeMasks();
 
   @override
   TypeMask visitConstructed(
-      ConstructedConstantValue constant, Compiler compiler) {
-    if (compiler.backend.isInterceptorClass(constant.type.element)) {
-      return compiler.closedWorld.commonMasks.nonNullType;
+      ConstructedConstantValue constant, ClosedWorld closedWorld) {
+    if (closedWorld.backendClasses.isInterceptorClass(constant.type.element)) {
+      return closedWorld.commonMasks.nonNullType;
     }
-    return new TypeMask.nonNullExact(
-        constant.type.element, compiler.closedWorld);
+    return new TypeMask.nonNullExact(constant.type.element, closedWorld);
   }
 
   @override
-  TypeMask visitDeferred(DeferredConstantValue constant, Compiler compiler) {
-    return constant.referenced.accept(this, compiler);
+  TypeMask visitDeferred(
+      DeferredConstantValue constant, ClosedWorld closedWorld) {
+    return constant.referenced.accept(this, closedWorld);
   }
 
   @override
-  TypeMask visitDouble(DoubleConstantValue constant, Compiler compiler) {
+  TypeMask visitDouble(DoubleConstantValue constant, ClosedWorld closedWorld) {
     // We have to recognize double constants that are 'is int'.
-    if (compiler.backend.constantSystem.isInt(constant)) {
+    if (closedWorld.constantSystem.isInt(constant)) {
       if (constant.isMinusZero) {
-        return compiler.closedWorld.commonMasks.uint31Type;
+        return closedWorld.commonMasks.uint31Type;
       } else {
         assert(constant.isPositiveInfinity || constant.isNegativeInfinity);
-        return compiler.closedWorld.commonMasks.intType;
+        return closedWorld.commonMasks.intType;
       }
     }
-    return compiler.closedWorld.commonMasks.doubleType;
+    return closedWorld.commonMasks.doubleType;
   }
 
   @override
-  TypeMask visitSynthetic(SyntheticConstantValue constant, Compiler compiler) {
+  TypeMask visitSynthetic(
+      SyntheticConstantValue constant, ClosedWorld closedWorld) {
     switch (constant.valueKind) {
       case SyntheticConstantKind.DUMMY_INTERCEPTOR:
         return constant.payload;
       case SyntheticConstantKind.EMPTY_VALUE:
         return constant.payload;
       case SyntheticConstantKind.TYPEVARIABLE_REFERENCE:
-        return compiler.closedWorld.commonMasks.intType;
+        return closedWorld.commonMasks.intType;
       case SyntheticConstantKind.NAME:
-        return compiler.closedWorld.commonMasks.stringType;
+        return closedWorld.commonMasks.stringType;
       default:
-        DiagnosticReporter reporter = compiler.reporter;
-        reporter.internalError(
-            CURRENT_ELEMENT_SPANNABLE, "Unexpected DummyConstantKind.");
-        return null;
+        throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE,
+            "Unexpected DummyConstantKind: ${constant.toStructuredText()}.");
     }
   }
 
   @override
-  TypeMask visitBool(BoolConstantValue constant, Compiler compiler) {
-    return compiler.closedWorld.commonMasks.boolType;
+  TypeMask visitBool(BoolConstantValue constant, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.boolType;
   }
 
   @override
-  TypeMask visitFunction(FunctionConstantValue constant, Compiler compiler) {
-    return compiler.closedWorld.commonMasks.functionType;
+  TypeMask visitFunction(
+      FunctionConstantValue constant, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.functionType;
   }
 
   @override
-  TypeMask visitInt(IntConstantValue constant, Compiler compiler) {
-    if (constant.isUInt31()) return compiler.closedWorld.commonMasks.uint31Type;
-    if (constant.isUInt32()) return compiler.closedWorld.commonMasks.uint32Type;
-    if (constant.isPositive())
-      return compiler.closedWorld.commonMasks.positiveIntType;
-    return compiler.closedWorld.commonMasks.intType;
+  TypeMask visitInt(IntConstantValue constant, ClosedWorld closedWorld) {
+    if (constant.isUInt31()) return closedWorld.commonMasks.uint31Type;
+    if (constant.isUInt32()) return closedWorld.commonMasks.uint32Type;
+    if (constant.isPositive()) return closedWorld.commonMasks.positiveIntType;
+    return closedWorld.commonMasks.intType;
   }
 
   @override
   TypeMask visitInterceptor(
-      InterceptorConstantValue constant, Compiler compiler) {
-    return compiler.closedWorld.commonMasks.nonNullType;
+      InterceptorConstantValue constant, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.nonNullType;
   }
 
   @override
-  TypeMask visitList(ListConstantValue constant, Compiler compiler) {
-    return compiler.closedWorld.commonMasks.constListType;
+  TypeMask visitList(ListConstantValue constant, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.constListType;
   }
 
   @override
-  TypeMask visitMap(MapConstantValue constant, Compiler compiler) {
-    return compiler.closedWorld.commonMasks.constMapType;
+  TypeMask visitMap(MapConstantValue constant, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.constMapType;
   }
 
   @override
-  TypeMask visitNull(NullConstantValue constant, Compiler compiler) {
-    return compiler.closedWorld.commonMasks.nullType;
+  TypeMask visitNull(NullConstantValue constant, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.nullType;
   }
 
   @override
-  TypeMask visitNonConstant(NonConstantValue constant, Compiler compiler) {
-    return compiler.closedWorld.commonMasks.nullType;
+  TypeMask visitNonConstant(
+      NonConstantValue constant, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.nullType;
   }
 
   @override
-  TypeMask visitString(StringConstantValue constant, Compiler compiler) {
-    return compiler.closedWorld.commonMasks.stringType;
+  TypeMask visitString(StringConstantValue constant, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.stringType;
   }
 
   @override
-  TypeMask visitType(TypeConstantValue constant, Compiler compiler) {
-    return compiler.closedWorld.commonMasks.typeType;
+  TypeMask visitType(TypeConstantValue constant, ClosedWorld closedWorld) {
+    return closedWorld.commonMasks.typeType;
   }
 }
diff --git a/pkg/compiler/lib/src/types/container_type_mask.dart b/pkg/compiler/lib/src/types/container_type_mask.dart
index 908996b..edad3af 100644
--- a/pkg/compiler/lib/src/types/container_type_mask.dart
+++ b/pkg/compiler/lib/src/types/container_type_mask.dart
@@ -13,8 +13,8 @@
   // The [Node] where this type mask was created.
   final Node allocationNode;
 
-  // The [Element] where this type mask was created.
-  final Element allocationElement;
+  // The [Entity] where this type mask was created.
+  final Entity allocationElement;
 
   // The element type of this container.
   final TypeMask elementType;
diff --git a/pkg/compiler/lib/src/types/flat_type_mask.dart b/pkg/compiler/lib/src/types/flat_type_mask.dart
index b93b1e6..5b93e4d 100644
--- a/pkg/compiler/lib/src/types/flat_type_mask.dart
+++ b/pkg/compiler/lib/src/types/flat_type_mask.dart
@@ -14,15 +14,17 @@
   static const int SUBCLASS = 2;
   static const int SUBTYPE = 3;
 
-  final Entity base;
+  final ClassEntity base;
   final int flags;
 
-  FlatTypeMask(Entity base, int kind, bool isNullable)
+  FlatTypeMask(ClassEntity base, int kind, bool isNullable)
       : this.internal(base, (kind << 1) | (isNullable ? 1 : 0));
 
-  FlatTypeMask.exact(Entity base) : this.internal(base, (EXACT << 1) | 1);
-  FlatTypeMask.subclass(Entity base) : this.internal(base, (SUBCLASS << 1) | 1);
-  FlatTypeMask.subtype(Entity base) : this.internal(base, (SUBTYPE << 1) | 1);
+  FlatTypeMask.exact(ClassEntity base) : this.internal(base, (EXACT << 1) | 1);
+  FlatTypeMask.subclass(ClassEntity base)
+      : this.internal(base, (SUBCLASS << 1) | 1);
+  FlatTypeMask.subtype(ClassEntity base)
+      : this.internal(base, (SUBTYPE << 1) | 1);
 
   const FlatTypeMask.nonNullEmpty()
       : base = null,
@@ -31,22 +33,24 @@
       : base = null,
         flags = 1;
 
-  FlatTypeMask.nonNullExact(Entity base) : this.internal(base, EXACT << 1);
-  FlatTypeMask.nonNullSubclass(Entity base)
+  FlatTypeMask.nonNullExact(ClassEntity base) : this.internal(base, EXACT << 1);
+  FlatTypeMask.nonNullSubclass(ClassEntity base)
       : this.internal(base, SUBCLASS << 1);
-  FlatTypeMask.nonNullSubtype(Entity base) : this.internal(base, SUBTYPE << 1);
+  FlatTypeMask.nonNullSubtype(ClassEntity base)
+      : this.internal(base, SUBTYPE << 1);
 
-  bool _validateBase(ClassElement element) => element.isDeclaration;
+  ClassQuery get _classQuery => isExact
+      ? ClassQuery.EXACT
+      : (isSubclass ? ClassQuery.SUBCLASS : ClassQuery.SUBTYPE);
 
-  FlatTypeMask.internal(this.base, this.flags) {
-    assert(base == null || _validateBase(base));
-  }
+  FlatTypeMask.internal(this.base, this.flags);
 
   /**
    * Ensures that the generated mask is normalized, i.e., a call to
    * [TypeMask.assertIsNormalized] with the factory's result returns `true`.
    */
-  factory FlatTypeMask.normalized(Entity base, int flags, ClosedWorld world) {
+  factory FlatTypeMask.normalized(
+      ClassEntity base, int flags, ClosedWorld world) {
     if ((flags >> 1) == EMPTY || ((flags >> 1) == EXACT)) {
       return new FlatTypeMask.internal(base, flags);
     }
@@ -89,8 +93,7 @@
     return isNullable ? new FlatTypeMask.internal(base, flags & ~1) : this;
   }
 
-  bool contains(Entity other, ClosedWorld closedWorld) {
-    assert(_validateBase(other));
+  bool contains(ClassEntity other, ClosedWorld closedWorld) {
     if (isEmptyOrNull) {
       return false;
     } else if (identical(base, other)) {
@@ -105,7 +108,7 @@
     }
   }
 
-  bool isSingleImplementationOf(Entity cls, ClosedWorld closedWorld) {
+  bool isSingleImplementationOf(ClassEntity cls, ClosedWorld closedWorld) {
     // Special case basic types so that, for example, JSString is the
     // single implementation of String.
     // The general optimization is to realize there is only one class that
@@ -113,22 +116,22 @@
     // not track correctly the list of truly instantiated classes.
     BackendClasses backendClasses = closedWorld.backendClasses;
     if (containsOnlyString(closedWorld)) {
-      return cls == closedWorld.coreClasses.stringClass ||
+      return cls == closedWorld.commonElements.stringClass ||
           cls == backendClasses.stringImplementation;
     }
     if (containsOnlyBool(closedWorld)) {
-      return cls == closedWorld.coreClasses.boolClass ||
+      return cls == closedWorld.commonElements.boolClass ||
           cls == backendClasses.boolImplementation;
     }
     if (containsOnlyInt(closedWorld)) {
-      return cls == closedWorld.coreClasses.intClass ||
+      return cls == closedWorld.commonElements.intClass ||
           cls == backendClasses.intImplementation ||
           cls == backendClasses.positiveIntImplementation ||
           cls == backendClasses.uint32Implementation ||
           cls == backendClasses.uint31Implementation;
     }
     if (containsOnlyDouble(closedWorld)) {
-      return cls == closedWorld.coreClasses.doubleClass ||
+      return cls == closedWorld.commonElements.doubleClass ||
           cls == backendClasses.doubleImplementation;
     }
     return false;
@@ -145,7 +148,7 @@
     if (other is! FlatTypeMask) return other.containsMask(this, closedWorld);
     // The other must be flat, so compare base and flags.
     FlatTypeMask flatOther = other;
-    Entity otherBase = flatOther.base;
+    ClassEntity otherBase = flatOther.base;
     // If other is exact, it only contains its base.
     // TODO(herhut): Get rid of isSingleImplementationOf.
     if (flatOther.isExact) {
@@ -158,7 +161,8 @@
     // TODO(herhut): Add check whether flatOther.base is superclass of
     //               all subclasses of this.base.
     if (flatOther.isSubclass) {
-      if (isSubtype) return (otherBase == closedWorld.coreClasses.objectClass);
+      if (isSubtype)
+        return (otherBase == closedWorld.commonElements.objectClass);
       return closedWorld.isSubclassOf(base, otherBase);
     }
     assert(flatOther.isSubtype);
@@ -172,7 +176,7 @@
 
   bool containsOnlyInt(ClosedWorld closedWorld) {
     BackendClasses backendClasses = closedWorld.backendClasses;
-    return base == closedWorld.coreClasses.intClass ||
+    return base == closedWorld.commonElements.intClass ||
         base == backendClasses.intImplementation ||
         base == backendClasses.positiveIntImplementation ||
         base == backendClasses.uint31Implementation ||
@@ -181,7 +185,7 @@
 
   bool containsOnlyDouble(ClosedWorld closedWorld) {
     BackendClasses backendClasses = closedWorld.backendClasses;
-    return base == closedWorld.coreClasses.doubleClass ||
+    return base == closedWorld.commonElements.doubleClass ||
         base == backendClasses.doubleImplementation;
   }
 
@@ -189,29 +193,27 @@
     BackendClasses backendClasses = closedWorld.backendClasses;
     return containsOnlyInt(closedWorld) ||
         containsOnlyDouble(closedWorld) ||
-        base == closedWorld.coreClasses.numClass ||
+        base == closedWorld.commonElements.numClass ||
         base == backendClasses.numImplementation;
   }
 
   bool containsOnlyBool(ClosedWorld closedWorld) {
     BackendClasses backendClasses = closedWorld.backendClasses;
-    return base == closedWorld.coreClasses.boolClass ||
+    return base == closedWorld.commonElements.boolClass ||
         base == backendClasses.boolImplementation;
   }
 
   bool containsOnlyString(ClosedWorld closedWorld) {
     BackendClasses backendClasses = closedWorld.backendClasses;
-    return base == closedWorld.coreClasses.stringClass ||
+    return base == closedWorld.commonElements.stringClass ||
         base == backendClasses.stringImplementation;
   }
 
-  bool containsOnly(Entity cls) {
-    assert(_validateBase(cls));
+  bool containsOnly(ClassEntity cls) {
     return base == cls;
   }
 
-  bool satisfies(Entity cls, ClosedWorld closedWorld) {
-    assert(_validateBase(cls));
+  bool satisfies(ClassEntity cls, ClosedWorld closedWorld) {
     if (isEmptyOrNull) return false;
     if (closedWorld.isSubtypeOf(base, cls)) return true;
     return false;
@@ -219,7 +221,7 @@
 
   /// Returns the [Entity] if this type represents a single class, otherwise
   /// returns `null`.  This method is conservative.
-  Entity singleClass(ClosedWorld closedWorld) {
+  ClassEntity singleClass(ClosedWorld closedWorld) {
     if (isEmptyOrNull) return null;
     if (isNullable) return null; // It is Null and some other class.
     if (isExact) {
@@ -237,7 +239,7 @@
    */
   bool containsAll(ClosedWorld closedWorld) {
     if (isEmptyOrNull || isExact) return false;
-    return identical(base, closedWorld.coreClasses.objectClass);
+    return identical(base, closedWorld.commonElements.objectClass);
   }
 
   TypeMask union(TypeMask other, ClosedWorld closedWorld) {
@@ -292,7 +294,7 @@
     assert(TypeMask.assertIsNormalized(other, closedWorld));
     int combined;
     if ((isExact && other.isExact) ||
-        base == closedWorld.coreClasses.objectClass) {
+        base == closedWorld.commonElements.objectClass) {
       // Since the other mask is a subclass of this mask, we need the
       // resulting union to be a subclass too. If either one of the
       // masks are nullable the result should be nullable too.
@@ -468,33 +470,14 @@
     if (isSubclass && other.isSubclass) return intersectionEmpty(other);
     assert(isSubtype || other.isSubtype);
     int kind = (isSubclass || other.isSubclass) ? SUBCLASS : SUBTYPE;
-    // TODO(johnniwinther): Move this computation to [ClosedWorld].
-    // Compute the set of classes that are contained in both type masks.
-    Set<ClassElement> common = commonContainedClasses(this, other, closedWorld);
-    if (common == null || common.isEmpty) return intersectionEmpty(other);
-    // Narrow down the candidates by only looking at common classes
-    // that do not have a superclass or supertype that will be a
-    // better candidate.
-    Iterable<ClassElement> candidates = common.where((ClassElement each) {
-      bool containsSuperclass = common.contains(each.supertype.element);
-      // If the superclass is also a candidate, then we don't want to
-      // deal with this class. If we're only looking for a subclass we
-      // know we don't have to look at the list of interfaces because
-      // they can never be in the common set.
-      if (containsSuperclass || kind == SUBCLASS) return !containsSuperclass;
-      // Run through the direct supertypes of the class. If the common
-      // set contains the direct supertype of the class, we ignore the
-      // the class because the supertype is a better candidate.
-      for (Link link = each.interfaces; !link.isEmpty; link = link.tail) {
-        if (common.contains(link.head.element)) return false;
-      }
-      return true;
-    });
+    Iterable<ClassEntity> candidates = closedWorld.commonSubclasses(
+        base, _classQuery, other.base, other._classQuery);
+    if (candidates.isEmpty) return intersectionEmpty(other);
     // Run through the list of candidates and compute the union. The
     // result will only be nullable if both masks are nullable. We have
     // to normalize here, as we generate types based on new base classes.
     int combined = (kind << 1) | (flags & other.flags & 1);
-    Iterable<TypeMask> masks = candidates.map((Entity cls) {
+    Iterable<TypeMask> masks = candidates.map((ClassEntity cls) {
       return new FlatTypeMask.normalized(cls, combined, closedWorld);
     });
     return UnionTypeMask.unionOf(masks, closedWorld);
@@ -511,7 +494,8 @@
    * invoked on this type mask. [selector] is used to ensure library
    * privacy is taken into account.
    */
-  bool canHit(Element element, Selector selector, ClosedWorld closedWorld) {
+  bool canHit(
+      MemberEntity element, Selector selector, ClosedWorld closedWorld) {
     BackendClasses backendClasses = closedWorld.backendClasses;
     assert(element.name == selector.name);
     if (isEmpty) return false;
@@ -520,37 +504,28 @@
           backendClasses.nullImplementation, selector, element);
     }
 
-    // TODO(kasperl): Can't we just avoid creating typed selectors
-    // based of function types?
-    Element self = base;
-    if (self.isTypedef) {
-      // A typedef is a function type that doesn't have any
-      // user-defined members.
-      return false;
-    }
-
-    ClassElement other = element.enclosingClass;
+    ClassEntity other = element.enclosingClass;
     if (other == backendClasses.nullImplementation) {
       return isNullable;
     } else if (isExact) {
-      return closedWorld.hasElementIn(self, selector, element);
+      return closedWorld.hasElementIn(base, selector, element);
     } else if (isSubclass) {
-      return closedWorld.hasElementIn(self, selector, element) ||
-          other.isSubclassOf(self) ||
-          closedWorld.hasAnySubclassThatMixes(self, other);
+      return closedWorld.hasElementIn(base, selector, element) ||
+          closedWorld.isSubclassOf(other, base) ||
+          closedWorld.hasAnySubclassThatMixes(base, other);
     } else {
       assert(isSubtype);
-      bool result = closedWorld.hasElementIn(self, selector, element) ||
-          other.implementsInterface(self) ||
+      bool result = closedWorld.hasElementIn(base, selector, element) ||
+          closedWorld.isSubtypeOf(other, base) ||
           closedWorld.hasAnySubclassThatImplements(other, base) ||
           closedWorld.hasAnySubclassOfMixinUseThatImplements(other, base);
       if (result) return true;
       // If the class is used as a mixin, we have to check if the element
       // can be hit from any of the mixin applications.
-      Iterable<ClassElement> mixinUses = closedWorld.mixinUsesOf(self);
+      Iterable<ClassEntity> mixinUses = closedWorld.mixinUsesOf(base);
       return mixinUses.any((mixinApplication) =>
           closedWorld.hasElementIn(mixinApplication, selector, element) ||
-          other.isSubclassOf(mixinApplication) ||
+          closedWorld.isSubclassOf(other, mixinApplication) ||
           closedWorld.hasAnySubclassThatMixes(mixinApplication, other));
     }
   }
@@ -565,20 +540,16 @@
     // usage).
     if (isExact && closedWorld.isAbstract(base)) return false;
 
-    return closedWorld.needsNoSuchMethod(
-        base,
-        selector,
-        isExact
-            ? ClassQuery.EXACT
-            : (isSubclass ? ClassQuery.SUBCLASS : ClassQuery.SUBTYPE));
+    return closedWorld.needsNoSuchMethod(base, selector, _classQuery);
   }
 
-  Element locateSingleElement(Selector selector, ClosedWorld closedWorld) {
+  MemberEntity locateSingleElement(Selector selector, ClosedWorld closedWorld) {
     if (isEmptyOrNull) return null;
-    Iterable<Element> targets = closedWorld.allFunctions.filter(selector, this);
+    Iterable<MemberEntity> targets =
+        closedWorld.allFunctions.filter(selector, this);
     if (targets.length != 1) return null;
-    Element result = targets.first;
-    ClassElement enclosing = result.enclosingClass.declaration;
+    MemberEntity result = targets.first;
+    ClassEntity enclosing = result.enclosingClass;
     // We only return the found element if it is guaranteed to be implemented on
     // all classes in the receiver type [this]. It could be found only in a
     // subclass or in an inheritance-wise unrelated class in case of subtype
@@ -618,26 +589,4 @@
     buffer.write(base.name);
     return "[$buffer]";
   }
-
-  static Set<ClassElement> commonContainedClasses(
-      FlatTypeMask x, FlatTypeMask y, ClosedWorld closedWorld) {
-    Iterable<ClassElement> xSubset = containedSubset(x, closedWorld);
-    if (xSubset == null) return null;
-    Iterable<ClassElement> ySubset = containedSubset(y, closedWorld);
-    if (ySubset == null) return null;
-    return xSubset.toSet().intersection(ySubset.toSet());
-  }
-
-  static Iterable<ClassElement> containedSubset(
-      FlatTypeMask x, ClosedWorld closedWorld) {
-    ClassElement element = x.base;
-    if (x.isExact) {
-      return null;
-    } else if (x.isSubclass) {
-      return closedWorld.strictSubclassesOf(element);
-    } else {
-      assert(x.isSubtype);
-      return closedWorld.strictSubtypesOf(element);
-    }
-  }
 }
diff --git a/pkg/compiler/lib/src/types/forwarding_type_mask.dart b/pkg/compiler/lib/src/types/forwarding_type_mask.dart
index 775fee0..04ee5c0 100644
--- a/pkg/compiler/lib/src/types/forwarding_type_mask.dart
+++ b/pkg/compiler/lib/src/types/forwarding_type_mask.dart
@@ -54,15 +54,15 @@
     return forwardTo.containsOnlyString(closedWorld);
   }
 
-  bool containsOnly(Entity cls) {
+  bool containsOnly(ClassEntity cls) {
     return forwardTo.containsOnly(cls);
   }
 
-  bool satisfies(Entity cls, ClosedWorld closedWorld) {
+  bool satisfies(ClassEntity cls, ClosedWorld closedWorld) {
     return forwardTo.satisfies(cls, closedWorld);
   }
 
-  bool contains(Entity cls, ClosedWorld closedWorld) {
+  bool contains(ClassEntity cls, ClosedWorld closedWorld) {
     return forwardTo.contains(cls, closedWorld);
   }
 
@@ -70,7 +70,7 @@
     return forwardTo.containsAll(closedWorld);
   }
 
-  Entity singleClass(ClosedWorld closedWorld) {
+  ClassEntity singleClass(ClosedWorld closedWorld) {
     return forwardTo.singleClass(closedWorld);
   }
 
@@ -97,11 +97,12 @@
     return forwardTo.needsNoSuchMethodHandling(selector, closedWorld);
   }
 
-  bool canHit(Element element, Selector selector, ClosedWorld closedWorld) {
+  bool canHit(
+      MemberEntity element, Selector selector, ClosedWorld closedWorld) {
     return forwardTo.canHit(element, selector, closedWorld);
   }
 
-  Element locateSingleElement(Selector selector, ClosedWorld closedWorld) {
+  MemberEntity locateSingleElement(Selector selector, ClosedWorld closedWorld) {
     return forwardTo.locateSingleElement(selector, closedWorld);
   }
 
diff --git a/pkg/compiler/lib/src/types/map_type_mask.dart b/pkg/compiler/lib/src/types/map_type_mask.dart
index 230db17..148fdbf 100644
--- a/pkg/compiler/lib/src/types/map_type_mask.dart
+++ b/pkg/compiler/lib/src/types/map_type_mask.dart
@@ -15,8 +15,8 @@
   // The [Node] where this type mask was created.
   final Node allocationNode;
 
-  // The [Element] where this type mask was created.
-  final Element allocationElement;
+  // The [Entity] where this type mask was created.
+  final Entity allocationElement;
 
   // The value type of this map.
   final TypeMask valueType;
diff --git a/pkg/compiler/lib/src/types/masks.dart b/pkg/compiler/lib/src/types/masks.dart
index 5cbc4c0..827e3f4 100644
--- a/pkg/compiler/lib/src/types/masks.dart
+++ b/pkg/compiler/lib/src/types/masks.dart
@@ -6,9 +6,9 @@
 
 import '../common.dart';
 import '../common/backend_api.dart' show BackendClasses;
-import '../compiler.dart' show Compiler;
 import '../constants/values.dart' show PrimitiveConstantValue;
-import '../elements/elements.dart';
+import '../elements/elements.dart' show Entity;
+import '../elements/entities.dart';
 import '../inferrer/type_graph_inferrer.dart' show TypeGraphInferrer;
 import '../tree/tree.dart';
 import '../universe/selector.dart' show Selector;
@@ -61,12 +61,19 @@
   TypeMask _syncStarIterableType;
   TypeMask _asyncFutureType;
   TypeMask _asyncStarStreamType;
+  TypeMask _indexablePrimitiveType;
+  TypeMask _readableArrayType;
+  TypeMask _mutableArrayType;
+  TypeMask _fixedArrayType;
+  TypeMask _extendableArrayType;
+  TypeMask _unmodifiableArrayType;
+  TypeMask _interceptorType;
 
-  TypeMask get dynamicType => _dynamicType ??=
-      new TypeMask.subclass(closedWorld.coreClasses.objectClass, closedWorld);
+  TypeMask get dynamicType => _dynamicType ??= new TypeMask.subclass(
+      closedWorld.commonElements.objectClass, closedWorld);
 
   TypeMask get nonNullType => _nonNullType ??= new TypeMask.nonNullSubclass(
-      closedWorld.coreClasses.objectClass, closedWorld);
+      closedWorld.commonElements.objectClass, closedWorld);
 
   TypeMask get intType => _intType ??= new TypeMask.nonNullSubclass(
       backendClasses.intImplementation, closedWorld);
@@ -132,4 +139,70 @@
 
   // TODO(johnniwinther): Assert that the null type has been resolved.
   TypeMask get nullType => _nullType ??= const TypeMask.empty();
+
+  TypeMask get emptyType => const TypeMask.nonNullEmpty();
+
+  TypeMask get indexablePrimitiveType =>
+      _indexablePrimitiveType ??= new TypeMask.nonNullSubtype(
+          backendClasses.indexableImplementation, closedWorld);
+
+  TypeMask get readableArrayType =>
+      _readableArrayType ??= new TypeMask.nonNullSubclass(
+          backendClasses.listImplementation, closedWorld);
+
+  TypeMask get mutableArrayType =>
+      _mutableArrayType ??= new TypeMask.nonNullSubclass(
+          backendClasses.mutableListImplementation, closedWorld);
+
+  TypeMask get fixedArrayType => _fixedArrayType ??= new TypeMask.nonNullExact(
+      backendClasses.fixedListImplementation, closedWorld);
+
+  TypeMask get extendableArrayType =>
+      _extendableArrayType ??= new TypeMask.nonNullExact(
+          backendClasses.growableListImplementation, closedWorld);
+
+  TypeMask get unmodifiableArrayType =>
+      _unmodifiableArrayType ??= new TypeMask.nonNullExact(
+          backendClasses.constListImplementation, closedWorld);
+
+  TypeMask get interceptorType =>
+      _interceptorType ??= new TypeMask.nonNullSubclass(
+          backendClasses.interceptorImplementation, closedWorld);
+
+  bool isTypedArray(TypeMask mask) {
+    // Just checking for [:TypedData:] is not sufficient, as it is an
+    // abstract class any user-defined class can implement. So we also
+    // check for the interface [JavaScriptIndexingBehavior].
+    ClassEntity typedDataClass = closedWorld.commonElements.typedDataClass;
+    return typedDataClass != null &&
+        closedWorld.isInstantiated(typedDataClass) &&
+        mask.satisfies(typedDataClass, closedWorld) &&
+        mask.satisfies(
+            closedWorld.backendClasses.indexingBehaviorImplementation,
+            closedWorld);
+  }
+
+  bool couldBeTypedArray(TypeMask mask) {
+    bool intersects(TypeMask type1, TypeMask type2) =>
+        !type1.intersection(type2, closedWorld).isEmpty;
+    // TODO(herhut): Maybe cache the TypeMask for typedDataClass and
+    //               jsIndexingBehaviourInterface.
+    ClassEntity typedDataClass = closedWorld.commonElements.typedDataClass;
+    return typedDataClass != null &&
+        closedWorld.isInstantiated(typedDataClass) &&
+        intersects(mask, new TypeMask.subtype(typedDataClass, closedWorld)) &&
+        intersects(
+            mask,
+            new TypeMask.subtype(
+                closedWorld.backendClasses.indexingBehaviorImplementation,
+                closedWorld));
+  }
+
+  TypeMask createNonNullExact(ClassEntity cls) {
+    return new TypeMask.nonNullExact(cls, closedWorld);
+  }
+
+  TypeMask createNonNullSubtype(ClassEntity cls) {
+    return new TypeMask.nonNullSubtype(cls, closedWorld);
+  }
 }
diff --git a/pkg/compiler/lib/src/types/type_mask.dart b/pkg/compiler/lib/src/types/type_mask.dart
index c91fac6..90bb911 100644
--- a/pkg/compiler/lib/src/types/type_mask.dart
+++ b/pkg/compiler/lib/src/types/type_mask.dart
@@ -4,15 +4,15 @@
 
 part of masks;
 
-/// An implementation of a [UniverseSelectorConstraints] that is consists if an only
-/// increasing set of [TypeMask]s, that is, once a mask is added it cannot be
-/// removed.
+/// An implementation of a [UniverseSelectorConstraints] that is consists if an
+/// only increasing set of [TypeMask]s, that is, once a mask is added it cannot
+/// be removed.
 class IncreasingTypeMaskSet extends UniverseSelectorConstraints {
   bool isAll = false;
   Set<TypeMask> _masks;
 
   @override
-  bool applies(Element element, Selector selector, ClosedWorld world) {
+  bool applies(MemberEntity element, Selector selector, ClosedWorld world) {
     if (isAll) return true;
     if (_masks == null) return false;
     for (TypeMask mask in _masks) {
@@ -25,7 +25,7 @@
   bool needsNoSuchMethodHandling(Selector selector, ClosedWorld world) {
     if (isAll) {
       TypeMask mask =
-          new TypeMask.subclass(world.coreClasses.objectClass, world);
+          new TypeMask.subclass(world.commonElements.objectClass, world);
       return mask.needsNoSuchMethodHandling(selector, world);
     }
     for (TypeMask mask in _masks) {
@@ -77,30 +77,30 @@
  */
 abstract class TypeMask implements ReceiverConstraint, AbstractValue {
   factory TypeMask(
-      Entity base, int kind, bool isNullable, ClosedWorld closedWorld) {
+      ClassEntity base, int kind, bool isNullable, ClosedWorld closedWorld) {
     return new FlatTypeMask.normalized(
         base, (kind << 1) | (isNullable ? 1 : 0), closedWorld);
   }
 
   const factory TypeMask.empty() = FlatTypeMask.empty;
 
-  factory TypeMask.exact(Entity base, ClosedWorld closedWorld) {
+  factory TypeMask.exact(ClassEntity base, ClosedWorld closedWorld) {
     assert(invariant(base, closedWorld.isInstantiated(base),
         message: () => "Cannot create exact type mask for uninstantiated "
             "class $base.\n${closedWorld.dump(base)}"));
     return new FlatTypeMask.exact(base);
   }
 
-  factory TypeMask.exactOrEmpty(Entity base, ClosedWorld closedWorld) {
+  factory TypeMask.exactOrEmpty(ClassEntity base, ClosedWorld closedWorld) {
     if (closedWorld.isInstantiated(base)) return new FlatTypeMask.exact(base);
     return const TypeMask.empty();
   }
 
-  factory TypeMask.subclass(Entity base, ClosedWorld closedWorld) {
+  factory TypeMask.subclass(ClassEntity base, ClosedWorld closedWorld) {
     assert(invariant(base, closedWorld.isInstantiated(base),
         message: () => "Cannot create subclass type mask for uninstantiated "
             "class $base.\n${closedWorld.dump(base)}"));
-    Entity topmost = closedWorld.getLubOfInstantiatedSubclasses(base);
+    ClassEntity topmost = closedWorld.getLubOfInstantiatedSubclasses(base);
     if (topmost == null) {
       return new TypeMask.empty();
     } else if (closedWorld.hasAnyStrictSubclass(topmost)) {
@@ -110,8 +110,8 @@
     }
   }
 
-  factory TypeMask.subtype(Entity base, ClosedWorld closedWorld) {
-    Entity topmost = closedWorld.getLubOfInstantiatedSubtypes(base);
+  factory TypeMask.subtype(ClassEntity base, ClosedWorld closedWorld) {
+    ClassEntity topmost = closedWorld.getLubOfInstantiatedSubtypes(base);
     if (topmost == null) {
       return new TypeMask.empty();
     }
@@ -127,25 +127,26 @@
 
   const factory TypeMask.nonNullEmpty() = FlatTypeMask.nonNullEmpty;
 
-  factory TypeMask.nonNullExact(Entity base, ClosedWorld closedWorld) {
+  factory TypeMask.nonNullExact(ClassEntity base, ClosedWorld closedWorld) {
     assert(invariant(base, closedWorld.isInstantiated(base),
         message: () => "Cannot create exact type mask for uninstantiated "
             "class $base.\n${closedWorld.dump(base)}"));
     return new FlatTypeMask.nonNullExact(base);
   }
 
-  factory TypeMask.nonNullExactOrEmpty(Entity base, ClosedWorld closedWorld) {
+  factory TypeMask.nonNullExactOrEmpty(
+      ClassEntity base, ClosedWorld closedWorld) {
     if (closedWorld.isInstantiated(base)) {
       return new FlatTypeMask.nonNullExact(base);
     }
     return const TypeMask.nonNullEmpty();
   }
 
-  factory TypeMask.nonNullSubclass(Entity base, ClosedWorld closedWorld) {
+  factory TypeMask.nonNullSubclass(ClassEntity base, ClosedWorld closedWorld) {
     assert(invariant(base, closedWorld.isInstantiated(base),
         message: () => "Cannot create subclass type mask for uninstantiated "
             "class $base.\n${closedWorld.dump(base)}"));
-    Entity topmost = closedWorld.getLubOfInstantiatedSubclasses(base);
+    ClassEntity topmost = closedWorld.getLubOfInstantiatedSubclasses(base);
     if (topmost == null) {
       return new TypeMask.nonNullEmpty();
     } else if (closedWorld.hasAnyStrictSubclass(topmost)) {
@@ -155,8 +156,8 @@
     }
   }
 
-  factory TypeMask.nonNullSubtype(Entity base, ClosedWorld closedWorld) {
-    Entity topmost = closedWorld.getLubOfInstantiatedSubtypes(base);
+  factory TypeMask.nonNullSubtype(ClassEntity base, ClosedWorld closedWorld) {
+    ClassEntity topmost = closedWorld.getLubOfInstantiatedSubtypes(base);
     if (topmost == null) {
       return new TypeMask.nonNullEmpty();
     }
@@ -286,7 +287,7 @@
   bool containsOnlyNum(ClosedWorld closedWorld);
   bool containsOnlyBool(ClosedWorld closedWorld);
   bool containsOnlyString(ClosedWorld closedWorld);
-  bool containsOnly(Entity cls);
+  bool containsOnly(ClassEntity cls);
 
   /**
    * Compares two [TypeMask] objects for structural equality.
@@ -315,21 +316,21 @@
   /**
    * Returns whether this type mask is an instance of [cls].
    */
-  bool satisfies(Entity cls, ClosedWorld closedWorld);
+  bool satisfies(ClassEntity cls, ClosedWorld closedWorld);
 
   /**
    * Returns whether or not this type mask contains the given class [cls].
    */
-  bool contains(Entity cls, ClosedWorld closedWorld);
+  bool contains(ClassEntity cls, ClosedWorld closedWorld);
 
   /**
    * Returns whether or not this type mask contains all types.
    */
   bool containsAll(ClosedWorld closedWorld);
 
-  /// Returns the [Entity] if this type represents a single class, otherwise
-  /// returns `null`.  This method is conservative.
-  Entity singleClass(ClosedWorld closedWorld);
+  /// Returns the [ClassEntity] if this type represents a single class,
+  /// otherwise returns `null`.  This method is conservative.
+  ClassEntity singleClass(ClosedWorld closedWorld);
 
   /**
    * Returns a type mask representing the union of [this] and [other].
@@ -349,12 +350,12 @@
    * invoked on this type mask. [selector] is used to ensure library
    * privacy is taken into account.
    */
-  bool canHit(Element element, Selector selector, ClosedWorld closedWorld);
+  bool canHit(MemberEntity element, Selector selector, ClosedWorld closedWorld);
 
   /**
    * Returns the [element] that is known to always be hit at runtime
    * on this mask. Returns null if there is none.
    */
   // TODO(johnniwinther): Move this method to [World].
-  Element locateSingleElement(Selector selector, ClosedWorld closedWorld);
+  MemberEntity locateSingleElement(Selector selector, ClosedWorld closedWorld);
 }
diff --git a/pkg/compiler/lib/src/types/types.dart b/pkg/compiler/lib/src/types/types.dart
index d2831c0..5892a00 100644
--- a/pkg/compiler/lib/src/types/types.dart
+++ b/pkg/compiler/lib/src/types/types.dart
@@ -9,11 +9,12 @@
 import '../common/tasks.dart' show CompilerTask;
 import '../compiler.dart' show Compiler;
 import '../elements/elements.dart';
-import '../inferrer/type_graph_inferrer.dart'
-    show TypeGraphInferrer, TypeInformationSystem;
+import '../inferrer/type_graph_inferrer.dart' show TypeGraphInferrer;
+import '../inferrer/type_system.dart';
 import '../tree/tree.dart';
 import '../universe/selector.dart' show Selector;
 import '../util/util.dart' show Maplet;
+import '../world.dart' show ClosedWorld, ClosedWorldRefiner;
 
 import 'masks.dart';
 export 'masks.dart';
@@ -43,12 +44,14 @@
   /// The inferred return type when this result belongs to a function element.
   TypeMask get returnType;
 
-  /// Returns the type of a list allocation [node] (which can be a list
-  /// literal or a list new expression).
-  TypeMask typeOfNewList(Node node);
+  /// Returns the type of a list new expression [node].
+  TypeMask typeOfNewList(Send node);
+
+  /// Returns the type of a list literal [node].
+  TypeMask typeOfListLiteral(LiteralList node);
 
   /// Returns the type of a send [node].
-  TypeMask typeOfSend(Node node);
+  TypeMask typeOfSend(Send node);
 
   /// Returns the type of the operator of a complex send-set [node], for
   /// example, the type of `+` in `a += b`.
@@ -98,10 +101,13 @@
     return mask != null && mask.isEmpty;
   }
 
-  TypeMask typeOfNewList(Node node) =>
+  TypeMask typeOfNewList(Send node) =>
       _inferrer.getTypeForNewList(_owner, node);
 
-  TypeMask typeOfSend(Node node) => _data?.typeOfSend(node);
+  TypeMask typeOfListLiteral(LiteralList node) =>
+      _inferrer.getTypeForNewList(_owner, node);
+
+  TypeMask typeOfSend(Send node) => _data?.typeOfSend(node);
   TypeMask typeOfGetter(SendSet node) => _data?.typeOfGetter(node);
   TypeMask typeOfOperator(SendSet node) => _data?.typeOfOperator(node);
   TypeMask typeOfIterator(ForIn node) => _data?.typeOfIterator(node);
@@ -122,11 +128,11 @@
     _typeMasks[node] = mask;
   }
 
-  TypeMask typeOfSend(Node node) => _get(node);
+  TypeMask typeOfSend(Send node) => _get(node);
   TypeMask typeOfGetter(SendSet node) => _get(node.selector);
   TypeMask typeOfOperator(SendSet node) => _get(node.assignmentOperator);
 
-  void setTypeMask(Node node, TypeMask mask) {
+  void setTypeMask(Send node, TypeMask mask) {
     _set(node, mask);
   }
 
@@ -184,8 +190,8 @@
 class GlobalTypeInferenceResults {
   // TODO(sigmund): store relevant data & drop reference to inference engine.
   final TypeGraphInferrer _inferrer;
-  final Compiler compiler;
-  final TypeMask dynamicType;
+  final ClosedWorld closedWorld;
+  final Compiler _compiler;
   final Map<Element, GlobalTypeInferenceElementResult> _elementResults = {};
 
   // TODO(sigmund,johnniwinther): compute result objects eagerly and make it an
@@ -206,13 +212,14 @@
             element,
             _inferrer.inferrer.inTreeData[key],
             _inferrer,
-            compiler.backend.isJsInterop(element),
+            _compiler.backend.isJsInterop(element),
             dynamicType));
   }
 
-  GlobalTypeInferenceResults(this._inferrer, this.compiler, CommonMasks masks,
-      TypeInformationSystem types)
-      : dynamicType = masks.dynamicType;
+  GlobalTypeInferenceResults(
+      this._inferrer, this._compiler, this.closedWorld, TypeSystem types);
+
+  TypeMask get dynamicType => closedWorld.commonMasks.dynamicType;
 
   /// Returns the type of a [selector] when applied to a receiver with the given
   /// type [mask].
@@ -245,14 +252,15 @@
         super(compiler.measurer);
 
   /// Runs the global type-inference algorithm once.
-  void runGlobalTypeInference(Element mainElement) {
+  void runGlobalTypeInference(Element mainElement, ClosedWorld closedWorld,
+      ClosedWorldRefiner closedWorldRefiner) {
     measure(() {
-      CommonMasks masks = compiler.closedWorld.commonMasks;
-      typesInferrerInternal ??= new TypeGraphInferrer(compiler, masks);
+      typesInferrerInternal ??=
+          new TypeGraphInferrer(compiler, closedWorld, closedWorldRefiner);
       typesInferrerInternal.analyzeMain(mainElement);
       typesInferrerInternal.clear();
       results = new GlobalTypeInferenceResults(typesInferrerInternal, compiler,
-          masks, typesInferrerInternal.inferrer.types);
+          closedWorld, typesInferrerInternal.inferrer.types);
     });
   }
 }
diff --git a/pkg/compiler/lib/src/types/union_type_mask.dart b/pkg/compiler/lib/src/types/union_type_mask.dart
index eada935..2832b75 100644
--- a/pkg/compiler/lib/src/types/union_type_mask.dart
+++ b/pkg/compiler/lib/src/types/union_type_mask.dart
@@ -97,13 +97,14 @@
     bool isNullable = masks.any((e) => e.isNullable);
 
     List masksBases = masks.map((mask) => mask.base).toList();
-    Iterable<Entity> candidates = closedWorld.commonSupertypesOf(masksBases);
+    Iterable<ClassEntity> candidates =
+        closedWorld.commonSupertypesOf(masksBases);
 
     // Compute the best candidate and its kind.
-    Entity bestElement;
+    ClassEntity bestElement;
     int bestKind;
     int bestSize;
-    for (Entity candidate in candidates) {
+    for (ClassEntity candidate in candidates) {
       bool isInstantiatedStrictSubclass(cls) =>
           cls != candidate &&
           closedWorld.isExplicitlyInstantiated(cls) &&
@@ -219,27 +220,27 @@
     // Ensure the cheap test fails.
     assert(!disjointMasks.any((mask) => mask.containsMask(other, closedWorld)));
     // If we cover object, we should never get here.
-    assert(!contains(closedWorld.coreClasses.objectClass, closedWorld));
+    assert(!contains(closedWorld.commonElements.objectClass, closedWorld));
     // Likewise, nullness should be covered.
     assert(isNullable || !other.isNullable);
     // The fast test is precise for exact types.
     if (other.isExact) return false;
     // We cannot contain object.
-    if (other.contains(closedWorld.coreClasses.objectClass, closedWorld)) {
+    if (other.contains(closedWorld.commonElements.objectClass, closedWorld)) {
       return false;
     }
     FlatTypeMask flat = TypeMask.nonForwardingMask(other);
     // Check we cover the base class.
     if (!contains(flat.base, closedWorld)) return false;
     // Check for other members.
-    Iterable<Entity> members;
+    Iterable<ClassEntity> members;
     if (flat.isSubclass) {
       members = closedWorld.strictSubclassesOf(flat.base);
     } else {
       assert(flat.isSubtype);
       members = closedWorld.strictSubtypesOf(flat.base);
     }
-    return members.every((Entity cls) => this.contains(cls, closedWorld));
+    return members.every((ClassEntity cls) => this.contains(cls, closedWorld));
   }
 
   bool isInMask(TypeMask other, ClosedWorld closedWorld) {
@@ -307,15 +308,15 @@
     return disjointMasks.every((mask) => mask.containsOnlyString(closedWorld));
   }
 
-  bool containsOnly(Entity element) {
+  bool containsOnly(ClassEntity element) {
     return disjointMasks.every((mask) => mask.containsOnly(element));
   }
 
-  bool satisfies(Entity cls, ClosedWorld closedWorld) {
+  bool satisfies(ClassEntity cls, ClosedWorld closedWorld) {
     return disjointMasks.every((mask) => mask.satisfies(cls, closedWorld));
   }
 
-  bool contains(Entity cls, ClosedWorld closedWorld) {
+  bool contains(ClassEntity cls, ClosedWorld closedWorld) {
     return disjointMasks.any((e) => e.contains(cls, closedWorld));
   }
 
@@ -323,21 +324,22 @@
     return disjointMasks.any((mask) => mask.containsAll(closedWorld));
   }
 
-  Entity singleClass(ClosedWorld closedWorld) => null;
+  ClassEntity singleClass(ClosedWorld closedWorld) => null;
 
   bool needsNoSuchMethodHandling(Selector selector, ClosedWorld closedWorld) {
     return disjointMasks
         .any((e) => e.needsNoSuchMethodHandling(selector, closedWorld));
   }
 
-  bool canHit(Element element, Selector selector, ClosedWorld closedWorld) {
+  bool canHit(
+      MemberEntity element, Selector selector, ClosedWorld closedWorld) {
     return disjointMasks.any((e) => e.canHit(element, selector, closedWorld));
   }
 
-  Element locateSingleElement(Selector selector, ClosedWorld closedWorld) {
-    Element candidate;
+  MemberEntity locateSingleElement(Selector selector, ClosedWorld closedWorld) {
+    MemberEntity candidate;
     for (FlatTypeMask mask in disjointMasks) {
-      Element current = mask.locateSingleElement(selector, closedWorld);
+      MemberEntity current = mask.locateSingleElement(selector, closedWorld);
       if (current == null) {
         return null;
       } else if (candidate == null) {
diff --git a/pkg/compiler/lib/src/universe/call_structure.dart b/pkg/compiler/lib/src/universe/call_structure.dart
index b60d435..7386238 100644
--- a/pkg/compiler/lib/src/universe/call_structure.dart
+++ b/pkg/compiler/lib/src/universe/call_structure.dart
@@ -6,8 +6,7 @@
 
 import '../common.dart';
 import '../common/names.dart' show Names;
-import '../elements/elements.dart';
-import '../tree/tree.dart';
+import '../elements/types.dart' show FunctionType;
 import '../util/util.dart';
 import 'selector.dart' show Selector;
 
@@ -39,17 +38,6 @@
     return new NamedCallStructure(argumentCount, namedArguments);
   }
 
-  /// Creates the [CallStructure] corresponding to calling [signature] as
-  /// declared, that is, all named arguments are in the order of declaration.
-  factory CallStructure.fromSignature(FunctionSignature signature) {
-    List<String> namedParameters;
-    if (signature.optionalParametersAreNamed) {
-      namedParameters =
-          signature.optionalParameters.map((e) => e.name).toList();
-    }
-    return new CallStructure(signature.parameterCount, namedParameters);
-  }
-
   /// `true` if this call has named arguments.
   bool get isNamed => false;
 
@@ -87,161 +75,44 @@
     return match(other);
   }
 
-  bool signatureApplies(FunctionSignature parameters) {
-    if (argumentCount > parameters.parameterCount) return false;
-    int requiredParameterCount = parameters.requiredParameterCount;
-    int optionalParameterCount = parameters.optionalParameterCount;
+  bool signatureApplies(FunctionType type) {
+    int requiredParameterCount = type.parameterTypes.length;
+    int optionalParameterCount =
+        type.optionalParameterTypes.length + type.namedParameters.length;
+    int parameterCount = requiredParameterCount + optionalParameterCount;
+    if (argumentCount > parameterCount) return false;
     if (positionalArgumentCount < requiredParameterCount) return false;
 
-    if (!parameters.optionalParametersAreNamed) {
+    if (type.namedParameters.isEmpty) {
       // We have already checked that the number of arguments are
       // not greater than the number of parameters. Therefore the
       // number of positional arguments are not greater than the
       // number of parameters.
-      assert(positionalArgumentCount <= parameters.parameterCount);
+      assert(positionalArgumentCount <= parameterCount);
       return namedArguments.isEmpty;
     } else {
       if (positionalArgumentCount > requiredParameterCount) return false;
       assert(positionalArgumentCount == requiredParameterCount);
       if (namedArgumentCount > optionalParameterCount) return false;
-      Set<String> nameSet = new Set<String>();
-      parameters.optionalParameters.forEach((Element element) {
-        nameSet.add(element.name);
-      });
-      for (String name in namedArguments) {
-        if (!nameSet.contains(name)) return false;
-        // TODO(5213): By removing from the set we are checking
-        // that we are not passing the name twice. We should have this
-        // check in the resolver also.
-        nameSet.remove(name);
+
+      int nameIndex = 0;
+      List<String> namedParameters = type.namedParameters;
+      for (String name in getOrderedNamedArguments()) {
+        bool found = false;
+        // Note: we start at the existing index because arguments are sorted.
+        while (nameIndex < namedParameters.length) {
+          if (name == namedParameters[nameIndex]) {
+            found = true;
+            break;
+          }
+          nameIndex++;
+        }
+        if (!found) return false;
       }
       return true;
     }
   }
 
-  /**
-   * Returns a `List` with the evaluated arguments in the normalized order.
-   *
-   * [compileDefaultValue] is a function that returns a compiled constant
-   * of an optional argument that is not in [compiledArguments].
-   *
-   * Precondition: `this.applies(element, world)`.
-   *
-   * Invariant: [element] must be the implementation element.
-   */
-  /*<T>*/ List/*<T>*/ makeArgumentsList(
-      Link<Node> arguments,
-      FunctionElement element,
-      /*T*/ compileArgument(Node argument),
-      /*T*/ compileDefaultValue(ParameterElement element)) {
-    assert(invariant(element, element.isImplementation));
-    List/*<T>*/ result = new List();
-
-    FunctionSignature parameters = element.functionSignature;
-    parameters.forEachRequiredParameter((ParameterElement element) {
-      result.add(compileArgument(arguments.head));
-      arguments = arguments.tail;
-    });
-
-    if (!parameters.optionalParametersAreNamed) {
-      parameters.forEachOptionalParameter((ParameterElement element) {
-        if (!arguments.isEmpty) {
-          result.add(compileArgument(arguments.head));
-          arguments = arguments.tail;
-        } else {
-          result.add(compileDefaultValue(element));
-        }
-      });
-    } else {
-      // Visit named arguments and add them into a temporary list.
-      List compiledNamedArguments = [];
-      for (; !arguments.isEmpty; arguments = arguments.tail) {
-        NamedArgument namedArgument = arguments.head;
-        compiledNamedArguments.add(compileArgument(namedArgument.expression));
-      }
-      // Iterate over the optional parameters of the signature, and try to
-      // find them in [compiledNamedArguments]. If found, we use the
-      // value in the temporary list, otherwise the default value.
-      parameters.orderedOptionalParameters.forEach((ParameterElement element) {
-        int foundIndex = namedArguments.indexOf(element.name);
-        if (foundIndex != -1) {
-          result.add(compiledNamedArguments[foundIndex]);
-        } else {
-          result.add(compileDefaultValue(element));
-        }
-      });
-    }
-    return result;
-  }
-
-  /**
-   * Fills [list] with the arguments in the order expected by
-   * [callee], and where [caller] is a synthesized element
-   *
-   * [compileArgument] is a function that returns a compiled version
-   * of a parameter of [callee].
-   *
-   * [compileConstant] is a function that returns a compiled constant
-   * of an optional argument that is not in the parameters of [callee].
-   *
-   * Returns [:true:] if the signature of the [caller] matches the
-   * signature of the [callee], [:false:] otherwise.
-   */
-  static/*<T>*/ bool addForwardingElementArgumentsToList(
-      ConstructorElement caller,
-      List/*<T>*/ list,
-      ConstructorElement callee,
-      /*T*/ compileArgument(ParameterElement element),
-      /*T*/ compileConstant(ParameterElement element)) {
-    assert(invariant(caller, !callee.isMalformed,
-        message: "Cannot compute arguments to malformed constructor: "
-            "$caller calling $callee."));
-
-    FunctionSignature signature = caller.functionSignature;
-    Map<Node, ParameterElement> mapping = <Node, ParameterElement>{};
-
-    // TODO(ngeoffray): This is a hack that fakes up AST nodes, so
-    // that we can call [addArgumentsToList].
-    Link<Node> computeCallNodesFromParameters() {
-      LinkBuilder<Node> builder = new LinkBuilder<Node>();
-      signature.forEachRequiredParameter((ParameterElement element) {
-        Node node = element.node;
-        mapping[node] = element;
-        builder.addLast(node);
-      });
-      if (signature.optionalParametersAreNamed) {
-        signature.forEachOptionalParameter((ParameterElement element) {
-          mapping[element.initializer] = element;
-          builder.addLast(new NamedArgument(null, null, element.initializer));
-        });
-      } else {
-        signature.forEachOptionalParameter((ParameterElement element) {
-          Node node = element.node;
-          mapping[node] = element;
-          builder.addLast(node);
-        });
-      }
-      return builder.toLink();
-    }
-
-    /*T*/ internalCompileArgument(Node node) {
-      return compileArgument(mapping[node]);
-    }
-
-    Link<Node> nodes = computeCallNodesFromParameters();
-
-    // Synthesize a structure for the call.
-    // TODO(ngeoffray): Should the resolver do it instead?
-    CallStructure callStructure = new CallStructure.fromSignature(signature);
-    if (!callStructure.signatureApplies(signature)) {
-      return false;
-    }
-    list.addAll(callStructure.makeArgumentsList(
-        nodes, callee, internalCompileArgument, compileConstant));
-
-    return true;
-  }
-
   static bool sameNames(List<String> first, List<String> second) {
     for (int i = 0; i < first.length; i++) {
       if (first[i] != second[i]) return false;
diff --git a/pkg/compiler/lib/src/universe/feature.dart b/pkg/compiler/lib/src/universe/feature.dart
index 580da8b..d3d8dfa 100644
--- a/pkg/compiler/lib/src/universe/feature.dart
+++ b/pkg/compiler/lib/src/universe/feature.dart
@@ -8,7 +8,7 @@
 /// compilation pipeline, for example during resolution.
 library compiler.universe.feature;
 
-import '../dart_types.dart' show InterfaceType;
+import '../elements/resolution_types.dart' show ResolutionInterfaceType;
 
 /// A language feature that may be seen in the program.
 // TODO(johnniwinther): Should mirror usage be part of this?
@@ -88,7 +88,7 @@
 
 /// Describes a use of a map literal in the program.
 class MapLiteralUse {
-  final InterfaceType type;
+  final ResolutionInterfaceType type;
   final bool isConstant;
   final bool isEmpty;
 
@@ -115,7 +115,7 @@
 
 /// Describes the use of a list literal in the program.
 class ListLiteralUse {
-  final InterfaceType type;
+  final ResolutionInterfaceType type;
   final bool isConstant;
   final bool isEmpty;
 
diff --git a/pkg/compiler/lib/src/universe/function_set.dart b/pkg/compiler/lib/src/universe/function_set.dart
index 0fb0018..3dc566a 100644
--- a/pkg/compiler/lib/src/universe/function_set.dart
+++ b/pkg/compiler/lib/src/universe/function_set.dart
@@ -5,25 +5,20 @@
 library universe.function_set;
 
 import '../common/names.dart' show Identifiers, Selectors;
-import '../compiler.dart' show Compiler;
-import '../elements/elements.dart';
+import '../elements/elements.dart' show MemberElement;
+import '../elements/entities.dart';
 import '../types/types.dart';
 import '../util/util.dart' show Hashing, Setlet;
 import '../world.dart' show ClosedWorld;
 import 'selector.dart' show Selector;
 import 'world_builder.dart' show ReceiverConstraint;
 
-// TODO(kasperl): This actually holds getters and setters just fine
-// too and stricly they aren't functions. Maybe this needs a better
-// name -- something like ElementSet seems a bit too generic.
-class FunctionSet {
-  final ClosedWorld closedWorld;
+class FunctionSetBuilder {
   final Map<String, FunctionSetNode> nodes = new Map<String, FunctionSetNode>();
-  FunctionSet(this.closedWorld);
 
   FunctionSetNode newNode(String name) => new FunctionSetNode(name);
 
-  void add(Element element) {
+  void add(MemberElement element) {
     assert(element.isInstanceMember);
     assert(!element.isAbstract);
     String name = element.name;
@@ -31,7 +26,7 @@
     node.add(element);
   }
 
-  void remove(Element element) {
+  void remove(MemberElement element) {
     assert(element.isInstanceMember);
     assert(!element.isAbstract);
     String name = element.name;
@@ -41,7 +36,21 @@
     }
   }
 
-  bool contains(Element element) {
+  FunctionSet close(ClosedWorld closedWorld) {
+    return new FunctionSet(closedWorld, nodes);
+  }
+}
+
+// TODO(kasperl): This actually holds getters and setters just fine
+// too and stricly they aren't functions. Maybe this needs a better
+// name -- something like ElementSet seems a bit too generic.
+class FunctionSet {
+  final ClosedWorld closedWorld;
+  final Map<String, FunctionSetNode> nodes;
+
+  FunctionSet(this.closedWorld, this.nodes);
+
+  bool contains(MemberElement element) {
     assert(element.isInstanceMember);
     assert(!element.isAbstract);
     String name = element.name;
@@ -53,7 +62,8 @@
   /// receiver with the given [constraint]. The returned elements may include
   /// noSuchMethod handlers that are potential targets indirectly through the
   /// noSuchMethod mechanism.
-  Iterable<Element> filter(Selector selector, ReceiverConstraint constraint) {
+  Iterable<MemberElement> filter(
+      Selector selector, ReceiverConstraint constraint) {
     return query(selector, constraint).functions;
   }
 
@@ -74,7 +84,7 @@
         : new SelectorMask(
             selector,
             new TypeMask.subclass(
-                closedWorld.coreClasses.objectClass, closedWorld));
+                closedWorld.commonElements.objectClass, closedWorld));
   }
 
   /// Returns the set of functions that can be the target of a call to
@@ -124,7 +134,7 @@
 
   String get name => selector.name;
 
-  bool applies(Element element, ClosedWorld closedWorld) {
+  bool applies(MemberEntity element, ClosedWorld closedWorld) {
     if (!selector.appliesUnnamed(element)) return false;
     return constraint.canHit(element, selector, closedWorld);
   }
@@ -152,12 +162,12 @@
   // compact than a hash set. Once we get enough elements, we change
   // the representation to be a set to get faster contains checks.
   static const int MAX_ELEMENTS_IN_LIST = 8;
-  var elements = <Element>[];
+  var elements = <MemberElement>[];
   bool isList = true;
 
   FunctionSetNode(this.name);
 
-  void add(Element element) {
+  void add(MemberElement element) {
     assert(element.name == name);
     // We try to avoid clearing the cache unless we have to. For that
     // reason we keep the explicit contains check even though the add
@@ -172,13 +182,13 @@
     }
   }
 
-  void remove(Element element) {
+  void remove(MemberElement element) {
     assert(element.name == name);
     if (isList) {
       List list = elements;
       int index = list.indexOf(element);
       if (index < 0) return;
-      Element last = list.removeLast();
+      MemberElement last = list.removeLast();
       if (index != list.length) {
         list[index] = last;
       }
@@ -194,7 +204,7 @@
     }
   }
 
-  bool contains(Element element) {
+  bool contains(MemberElement element) {
     assert(element.name == name);
     return elements.contains(element);
   }
@@ -211,14 +221,14 @@
     FunctionSetQuery result = cache[selectorMask];
     if (result != null) return result;
 
-    Setlet<Element> functions;
-    for (Element element in elements) {
+    Setlet<MemberElement> functions;
+    for (MemberElement element in elements) {
       if (selectorMask.applies(element, closedWorld)) {
         if (functions == null) {
           // Defer the allocation of the functions set until we are
           // sure we need it. This allows us to return immutable empty
           // lists when the filtering produced no results.
-          functions = new Setlet<Element>();
+          functions = new Setlet<MemberElement>();
         }
         functions.add(element);
       }
@@ -233,7 +243,8 @@
           noSuchMethods.query(noSuchMethodMask, closedWorld);
       if (!noSuchMethodQuery.functions.isEmpty) {
         if (functions == null) {
-          functions = new Setlet<Element>.from(noSuchMethodQuery.functions);
+          functions =
+              new Setlet<MemberElement>.from(noSuchMethodQuery.functions);
         } else {
           functions.addAll(noSuchMethodQuery.functions);
         }
@@ -255,7 +266,7 @@
   TypeMask computeMask(ClosedWorld closedWorld);
 
   /// Returns all potential targets of this function set.
-  Iterable<Element> get functions;
+  Iterable<MemberElement> get functions;
 }
 
 class EmptyFunctionSetQuery implements FunctionSetQuery {
@@ -266,12 +277,12 @@
       const TypeMask.nonNullEmpty();
 
   @override
-  Iterable<Element> get functions => const <Element>[];
+  Iterable<MemberElement> get functions => const <MemberElement>[];
 }
 
 class FullFunctionSetQuery implements FunctionSetQuery {
   @override
-  final Iterable<Element> functions;
+  final Iterable<MemberElement> functions;
 
   TypeMask _mask;
 
@@ -279,18 +290,18 @@
 
   @override
   TypeMask computeMask(ClosedWorld closedWorld) {
-    assert(
-        closedWorld.hasAnyStrictSubclass(closedWorld.coreClasses.objectClass));
+    assert(closedWorld
+        .hasAnyStrictSubclass(closedWorld.commonElements.objectClass));
     if (_mask != null) return _mask;
     return _mask = new TypeMask.unionOf(
-        functions.expand((element) {
-          ClassElement cls = element.enclosingClass;
+        functions.expand((MemberElement element) {
+          ClassEntity cls = element.enclosingClass;
           return [cls]..addAll(closedWorld.mixinUsesOf(cls));
         }).map((cls) {
           if (closedWorld.backendClasses.nullImplementation == cls) {
             return const TypeMask.empty();
-          } else if (closedWorld.isInstantiated(cls.declaration)) {
-            return new TypeMask.nonNullSubclass(cls.declaration, closedWorld);
+          } else if (closedWorld.isInstantiated(cls)) {
+            return new TypeMask.nonNullSubclass(cls, closedWorld);
           } else {
             // TODO(johnniwinther): Avoid the need for this case.
             return const TypeMask.empty();
diff --git a/pkg/compiler/lib/src/universe/selector.dart b/pkg/compiler/lib/src/universe/selector.dart
index bc959c1..be129c1 100644
--- a/pkg/compiler/lib/src/universe/selector.dart
+++ b/pkg/compiler/lib/src/universe/selector.dart
@@ -10,13 +10,13 @@
     show
         Element,
         Elements,
-        FunctionElement,
         FunctionSignature,
+        MemberElement,
+        MethodElement,
         Name,
-        LibraryElement,
         PublicName;
+import '../elements/entities.dart';
 import '../util/util.dart' show Hashing;
-import '../common/resolution.dart' show Target;
 import 'call_structure.dart' show CallStructure;
 
 class SelectorKind {
@@ -57,7 +57,7 @@
 
   String get name => memberName.text;
 
-  LibraryElement get library => memberName.library;
+  LibraryEntity get library => memberName.library;
 
   Selector.internal(
       this.kind, this.memberName, this.callStructure, this.hashCode) {
@@ -217,12 +217,12 @@
     return kind;
   }
 
-  bool appliesUnnamed(Element element) {
+  bool appliesUnnamed(MemberElement element) {
     assert(name == element.name);
     return appliesUntyped(element);
   }
 
-  bool appliesUntyped(Element element) {
+  bool appliesUntyped(MemberElement element) {
     assert(name == element.name);
     if (Elements.isUnresolved(element)) return false;
     if (memberName.isPrivate && memberName.library != element.library) {
@@ -242,12 +242,12 @@
     return signatureApplies(element);
   }
 
-  bool signatureApplies(FunctionElement function) {
+  bool signatureApplies(MethodElement function) {
     if (Elements.isUnresolved(function)) return false;
-    return callStructure.signatureApplies(function.functionSignature);
+    return callStructure.signatureApplies(function.type);
   }
 
-  bool applies(Element element) {
+  bool applies(MemberElement element) {
     if (name != element.name) return false;
     return appliesUnnamed(element);
   }
diff --git a/pkg/compiler/lib/src/universe/use.dart b/pkg/compiler/lib/src/universe/use.dart
index f399509..0595e8d 100644
--- a/pkg/compiler/lib/src/universe/use.dart
+++ b/pkg/compiler/lib/src/universe/use.dart
@@ -18,15 +18,26 @@
 
 import '../closure.dart' show BoxFieldElement;
 import '../common.dart';
-import '../dart_types.dart';
-import '../elements/elements.dart';
+import '../elements/types.dart';
+import '../elements/elements.dart'
+    show
+        ConstructorElement,
+        ConstructorBodyElement,
+        Element,
+        Entity,
+        LocalFunctionElement;
+import '../elements/entities.dart';
 import '../util/util.dart' show Hashing;
 import '../world.dart' show World;
 import 'call_structure.dart' show CallStructure;
 import 'selector.dart' show Selector;
 import 'world_builder.dart' show ReceiverConstraint;
 
-enum DynamicUseKind { INVOKE, GET, SET, }
+enum DynamicUseKind {
+  INVOKE,
+  GET,
+  SET,
+}
 
 /// The use of a dynamic property. [selector] defined the name and kind of the
 /// property and [mask] defines the known constraint for the object on which
@@ -37,7 +48,7 @@
 
   DynamicUse(this.selector, this.mask);
 
-  bool appliesUnnamed(Element element, World world) {
+  bool appliesUnnamed(MemberEntity element, World world) {
     return selector.appliesUnnamed(element) &&
         (mask == null || mask.canHit(element, selector, world));
   }
@@ -82,18 +93,17 @@
 // TODO(johnniwinther): Create backend-specific implementations with better
 // invariants.
 class StaticUse {
-  final Element element;
+  final Entity element;
   final StaticUseKind kind;
   final int hashCode;
   final DartType type;
 
-  StaticUse.internal(Element element, StaticUseKind kind,
-      [DartType type = null])
+  StaticUse.internal(Entity element, StaticUseKind kind, [DartType type = null])
       : this.element = element,
         this.kind = kind,
         this.type = type,
         this.hashCode = Hashing.objectsHash(element, kind, type) {
-    assert(invariant(element, element.isDeclaration,
+    assert(invariant(element, !(element is Element && !element.isDeclaration),
         message: "Static use element $element must be "
             "the declaration element."));
   }
@@ -101,7 +111,7 @@
   /// Invocation of a static or top-level [element] with the given
   /// [callStructure].
   factory StaticUse.staticInvoke(
-      MethodElement element, CallStructure callStructure) {
+      FunctionEntity element, CallStructure callStructure) {
     // TODO(johnniwinther): Use the [callStructure].
     assert(invariant(element, element.isStatic || element.isTopLevel,
         message: "Static invoke element $element must be a top-level "
@@ -110,7 +120,7 @@
   }
 
   /// Closurization of a static or top-level function [element].
-  factory StaticUse.staticTearOff(MethodElement element) {
+  factory StaticUse.staticTearOff(FunctionEntity element) {
     assert(invariant(element, element.isStatic || element.isTopLevel,
         message: "Static tear-off element $element must be a top-level "
             "or static method."));
@@ -118,7 +128,7 @@
   }
 
   /// Read access of a static or top-level field or getter [element].
-  factory StaticUse.staticGet(MemberElement element) {
+  factory StaticUse.staticGet(MemberEntity element) {
     assert(invariant(element, element.isStatic || element.isTopLevel,
         message: "Static get element $element must be a top-level "
             "or static method."));
@@ -128,7 +138,7 @@
   }
 
   /// Write access of a static or top-level field or setter [element].
-  factory StaticUse.staticSet(MemberElement element) {
+  factory StaticUse.staticSet(MemberEntity element) {
     assert(invariant(element, element.isStatic || element.isTopLevel,
         message: "Static set element $element must be a top-level "
             "or static method."));
@@ -139,7 +149,7 @@
 
   /// Invocation of the lazy initializer for a static or top-level field
   /// [element].
-  factory StaticUse.staticInit(FieldElement element) {
+  factory StaticUse.staticInit(FieldEntity element) {
     assert(invariant(element, element.isStatic || element.isTopLevel,
         message: "Static init element $element must be a top-level "
             "or static method."));
@@ -150,7 +160,7 @@
 
   /// Invocation of a super method [element] with the given [callStructure].
   factory StaticUse.superInvoke(
-      MethodElement element, CallStructure callStructure) {
+      FunctionEntity element, CallStructure callStructure) {
     // TODO(johnniwinther): Use the [callStructure].
     assert(invariant(element, element.isInstanceMember,
         message: "Super invoke element $element must be an instance method."));
@@ -158,7 +168,7 @@
   }
 
   /// Read access of a super field or getter [element].
-  factory StaticUse.superGet(MemberElement element) {
+  factory StaticUse.superGet(MemberEntity element) {
     assert(invariant(element, element.isInstanceMember,
         message: "Super get element $element must be an instance method."));
     assert(invariant(element, element.isField || element.isGetter,
@@ -167,7 +177,7 @@
   }
 
   /// Write access of a super field [element].
-  factory StaticUse.superFieldSet(FieldElement element) {
+  factory StaticUse.superFieldSet(FieldEntity element) {
     assert(invariant(element, element.isInstanceMember,
         message: "Super set element $element must be an instance method."));
     assert(invariant(element, element.isField,
@@ -176,7 +186,7 @@
   }
 
   /// Write access of a super setter [element].
-  factory StaticUse.superSetterSet(SetterElement element) {
+  factory StaticUse.superSetterSet(FunctionEntity element) {
     assert(invariant(element, element.isInstanceMember,
         message: "Super set element $element must be an instance method."));
     assert(invariant(element, element.isSetter,
@@ -185,7 +195,7 @@
   }
 
   /// Closurization of a super method [element].
-  factory StaticUse.superTearOff(MethodElement element) {
+  factory StaticUse.superTearOff(FunctionEntity element) {
     assert(invariant(element, element.isInstanceMember && element.isFunction,
         message: "Super invoke element $element must be an instance method."));
     return new StaticUse.internal(element, StaticUseKind.SUPER_TEAR_OFF);
@@ -194,7 +204,7 @@
   /// Invocation of a constructor [element] through a this or super
   /// constructor call with the given [callStructure].
   factory StaticUse.superConstructorInvoke(
-      Element element, CallStructure callStructure) {
+      ConstructorElement element, CallStructure callStructure) {
     // TODO(johnniwinther): Use the [callStructure].
     assert(invariant(element, element.isGenerativeConstructor,
         message: "Constructor invoke element $element must be a "
@@ -212,7 +222,7 @@
 
   /// Direct invocation of a method [element] with the given [callStructure].
   factory StaticUse.directInvoke(
-      MethodElement element, CallStructure callStructure) {
+      FunctionEntity element, CallStructure callStructure) {
     // TODO(johnniwinther): Use the [callStructure].
     assert(invariant(element, element.isInstanceMember,
         message: "Direct invoke element $element must be an instance member."));
@@ -222,7 +232,7 @@
   }
 
   /// Direct read access of a field or getter [element].
-  factory StaticUse.directGet(MemberElement element) {
+  factory StaticUse.directGet(MemberEntity element) {
     assert(invariant(element, element.isInstanceMember,
         message: "Direct get element $element must be an instance member."));
     assert(invariant(element, element.isField || element.isGetter,
@@ -231,7 +241,7 @@
   }
 
   /// Direct write access of a field [element].
-  factory StaticUse.directSet(FieldElement element) {
+  factory StaticUse.directSet(FieldEntity element) {
     assert(invariant(element, element.isInstanceMember,
         message: "Direct set element $element must be an instance member."));
     assert(invariant(element, element.isField,
@@ -241,7 +251,10 @@
 
   /// Constructor invocation of [element] with the given [callStructure].
   factory StaticUse.constructorInvoke(
-      ConstructorElement element, CallStructure callStructure) {
+      FunctionEntity element, CallStructure callStructure) {
+    assert(invariant(element, element.isConstructor,
+        message: "Constructor invocation element $element "
+            "must be a constructor."));
     // TODO(johnniwinther): Use the [callStructure].
     return new StaticUse.internal(element, StaticUseKind.GENERAL);
   }
@@ -249,9 +262,12 @@
   /// Constructor invocation of [element] with the given [callStructure] on
   /// [type].
   factory StaticUse.typedConstructorInvoke(
-      ConstructorElement element, CallStructure callStructure, DartType type) {
+      FunctionEntity element, CallStructure callStructure, DartType type) {
     assert(invariant(element, type != null,
         message: "No type provided for constructor invocation."));
+    assert(invariant(element, element.isConstructor,
+        message: "Typed constructor invocation element $element "
+            "must be a constructor."));
     // TODO(johnniwinther): Use the [callStructure].
     return new StaticUse.internal(
         element, StaticUseKind.CONSTRUCTOR_INVOKE, type);
@@ -260,9 +276,12 @@
   /// Constant constructor invocation of [element] with the given
   /// [callStructure] on [type].
   factory StaticUse.constConstructorInvoke(
-      ConstructorElement element, CallStructure callStructure, DartType type) {
+      FunctionEntity element, CallStructure callStructure, DartType type) {
     assert(invariant(element, type != null,
         message: "No type provided for constructor invocation."));
+    assert(invariant(element, element.isConstructor,
+        message: "Const constructor invocation element $element "
+            "must be a constructor."));
     // TODO(johnniwinther): Use the [callStructure].
     return new StaticUse.internal(
         element, StaticUseKind.CONST_CONSTRUCTOR_INVOKE, type);
@@ -270,21 +289,24 @@
 
   /// Constructor redirection to [element] on [type].
   factory StaticUse.constructorRedirect(
-      ConstructorElement element, InterfaceType type) {
+      FunctionEntity element, InterfaceType type) {
     assert(invariant(element, type != null,
-        message: "No type provided for constructor invocation."));
+        message: "No type provided for constructor redirection."));
+    assert(invariant(element, element.isConstructor,
+        message: "Constructor redirection element $element "
+            "must be a constructor."));
     return new StaticUse.internal(element, StaticUseKind.REDIRECTION, type);
   }
 
   /// Initialization of an instance field [element].
-  factory StaticUse.fieldInit(FieldElement element) {
+  factory StaticUse.fieldInit(FieldEntity element) {
     assert(invariant(element, element.isInstanceMember,
         message: "Field init element $element must be an instance field."));
     return new StaticUse.internal(element, StaticUseKind.GENERAL);
   }
 
   /// Read access of an instance field or boxed field [element].
-  factory StaticUse.fieldGet(Element element) {
+  factory StaticUse.fieldGet(FieldEntity element) {
     assert(invariant(
         element, element.isInstanceMember || element is BoxFieldElement,
         message: "Field init element $element must be an instance "
@@ -293,7 +315,7 @@
   }
 
   /// Write access of an instance field or boxed field [element].
-  factory StaticUse.fieldSet(Element element) {
+  factory StaticUse.fieldSet(FieldEntity element) {
     assert(invariant(
         element, element.isInstanceMember || element is BoxFieldElement,
         message: "Field init element $element must be an instance "
@@ -307,13 +329,16 @@
   }
 
   /// Unknown use of [element].
+  ///
+  /// Avoid using this, if possible: Use one of the other constructor which more
+  /// precisely capture why [element] is used.
   @deprecated
-  factory StaticUse.foreignUse(Element element) {
+  factory StaticUse.foreignUse(Entity element) {
     return new StaticUse.internal(element, StaticUseKind.GENERAL);
   }
 
   /// Direct use of [element] as done with `--analyze-all` and `--analyze-main`.
-  factory StaticUse.directUse(Element element) {
+  factory StaticUse.directUse(Entity element) {
     return new StaticUse.internal(element, StaticUseKind.DIRECT_USE);
   }
 
@@ -337,7 +362,7 @@
   NATIVE_INSTANTIATION,
 }
 
-/// Use of a [DartType].
+/// Use of a [ResolutionDartType].
 class TypeUse {
   final DartType type;
   final TypeUseKind kind;
diff --git a/pkg/compiler/lib/src/universe/world_builder.dart b/pkg/compiler/lib/src/universe/world_builder.dart
index 49deb8e..a201a73 100644
--- a/pkg/compiler/lib/src/universe/world_builder.dart
+++ b/pkg/compiler/lib/src/universe/world_builder.dart
@@ -9,14 +9,20 @@
 import '../cache_strategy.dart';
 import '../common.dart';
 import '../common/backend_api.dart' show Backend;
+import '../common/names.dart' show Identifiers;
 import '../common/resolution.dart' show Resolution;
 import '../compiler.dart' show Compiler;
-import '../core_types.dart' show CoreClasses;
-import '../dart_types.dart';
+import '../core_types.dart';
 import '../elements/elements.dart';
-import '../universe/class_set.dart' show Instantiation;
+import '../elements/entities.dart';
+import '../elements/resolution_types.dart';
+import '../elements/types.dart';
+import '../universe/class_set.dart';
+import '../universe/function_set.dart' show FunctionSetBuilder;
+import '../util/enumset.dart';
 import '../util/util.dart';
-import '../world.dart' show World, ClosedWorld, OpenWorld, WorldImpl;
+import '../world.dart' show World, ClosedWorld, ClosedWorldImpl, OpenWorld;
+import 'call_structure.dart' show CallStructure;
 import 'selector.dart' show Selector;
 import 'use.dart' show DynamicUse, DynamicUseKind, StaticUse, StaticUseKind;
 
@@ -34,7 +40,7 @@
   /// Returns whether [element] is a potential target when being
   /// invoked on a receiver with this constraint. [selector] is used to ensure
   /// library privacy is taken into account.
-  bool canHit(Element element, Selector selector, World world);
+  bool canHit(MemberElement element, Selector selector, World world);
 
   /// Returns whether this [TypeMask] applied to [selector] can hit a
   /// [noSuchMethod].
@@ -76,7 +82,7 @@
   ///
   /// Ideally the selector constraints for calls `foo` with two positional
   /// arguments apply to `A.foo` but `B.foo`.
-  bool applies(Element element, Selector selector, World world);
+  bool applies(MemberElement element, Selector selector, World world);
 
   /// Returns `true` if at least one of the receivers matching these constraints
   /// in the closed [world] have no implementation matching [selector].
@@ -107,6 +113,39 @@
   UniverseSelectorConstraints createSelectorConstraints(Selector selector);
 }
 
+class OpenWorldStrategy implements SelectorConstraintsStrategy {
+  const OpenWorldStrategy();
+
+  OpenWorldConstraints createSelectorConstraints(Selector selector) {
+    return new OpenWorldConstraints();
+  }
+}
+
+class OpenWorldConstraints extends UniverseSelectorConstraints {
+  bool isAll = false;
+
+  @override
+  bool applies(Element element, Selector selector, World world) => isAll;
+
+  @override
+  bool needsNoSuchMethodHandling(Selector selector, World world) => isAll;
+
+  @override
+  bool addReceiverConstraint(ReceiverConstraint constraint) {
+    if (isAll) return false;
+    isAll = true;
+    return true;
+  }
+
+  String toString() {
+    if (isAll) {
+      return '<all>';
+    } else {
+      return '<none>';
+    }
+  }
+}
+
 /// The [WorldBuilder] is an auxiliary class used in the process of computing
 /// the [ClosedWorld].
 // TODO(johnniwinther): Move common implementation to a [WorldBuilderBase] when
@@ -119,27 +158,24 @@
   Iterable<ClassElement> get directlyInstantiatedClasses;
 
   /// All types that are checked either through is, as or checked mode checks.
-  Iterable<DartType> get isChecks;
+  Iterable<ResolutionDartType> get isChecks;
 
-  /// Registers that [type] is checked in this universe. The unaliased type is
-  /// returned.
-  DartType registerIsCheck(DartType type, Resolution resolution);
+  /// Registers that [type] is checked in this world builder. The unaliased type
+  /// is returned.
+  ResolutionDartType registerIsCheck(ResolutionDartType type);
 
   /// All directly instantiated types, that is, the types of the directly
   /// instantiated classes.
   // TODO(johnniwinther): Improve semantic precision.
-  Iterable<DartType> get instantiatedTypes;
-
-  /// Returns `true` if [member] is invoked as a setter.
-  bool hasInvokedSetter(Element member, World world);
+  Iterable<ResolutionDartType> get instantiatedTypes;
 }
 
-abstract class ResolutionWorldBuilder implements WorldBuilder {
+abstract class ResolutionWorldBuilder implements WorldBuilder, OpenWorld {
   /// Set of (live) local functions (closures) whose signatures reference type
   /// variables.
   ///
   /// A live function is one whose enclosing member function has been enqueued.
-  Set<Element> get closuresWithFreeTypeVariables;
+  Iterable<Element> get closuresWithFreeTypeVariables;
 
   /// Set of (live) `call` methods whose signatures reference type variables.
   ///
@@ -167,24 +203,19 @@
   /// arguments are used in live factory constructors.
   void forEachInstantiatedClass(f(ClassElement cls, InstantiationInfo info));
 
-  /// `true` of `Object.runtimeType` is supported.
-  bool get hasRuntimeTypeSupport;
+  /// Returns `true` if [member] is invoked as a setter.
+  bool hasInvokedSetter(Element member);
 
-  /// `true` of use of the `dart:isolate` library is supported.
-  bool get hasIsolateSupport;
-
-  /// `true` of `Function.apply` is supported.
-  bool get hasFunctionApplySupport;
-
-  /// The [OpenWorld] being created by this world builder.
-  // TODO(johnniwinther): Merge this with [ResolutionWorldBuilder].
-  OpenWorld get openWorld;
+  /// The closed world computed by this world builder.
+  ///
+  /// This is only available after the world builder has been closed.
+  ClosedWorld get closedWorldForTesting;
 }
 
 /// The type and kind of an instantiation registered through
 /// `ResolutionWorldBuilder.registerTypeInstantiation`.
 class Instance {
-  final InterfaceType type;
+  final ResolutionInterfaceType type;
   final Instantiation kind;
   final bool isRedirection;
 
@@ -285,8 +316,8 @@
   Map<ConstructorElement, Set<Instance>> instantiationMap;
 
   /// Register [type] as the instantiation [kind] using [constructor].
-  void addInstantiation(
-      ConstructorElement constructor, InterfaceType type, Instantiation kind,
+  void addInstantiation(ConstructorElement constructor,
+      ResolutionInterfaceType type, Instantiation kind,
       {bool isRedirection: false}) {
     instantiationMap ??= <ConstructorElement, Set<Instance>>{};
     instantiationMap
@@ -370,9 +401,30 @@
   final Map<String, Map<Selector, SelectorConstraints>> _invokedSetters =
       <String, Map<Selector, SelectorConstraints>>{};
 
+  final Map<ClassElement, _ClassUsage> _processedClasses =
+      <ClassElement, _ClassUsage>{};
+
+  /// Map of registered usage of static members of live classes.
+  final Map<Entity, _StaticMemberUsage> _staticMemberUsage =
+      <Entity, _StaticMemberUsage>{};
+
+  /// Map of registered usage of instance members of live classes.
+  final Map<MemberEntity, _MemberUsage> _instanceMemberUsage =
+      <MemberEntity, _MemberUsage>{};
+
+  /// Map containing instance members of live classes that are not yet live
+  /// themselves.
+  final Map<String, Set<_MemberUsage>> _instanceMembersByName =
+      <String, Set<_MemberUsage>>{};
+
+  /// Map containing instance methods of live classes that are not yet
+  /// closurized.
+  final Map<String, Set<_MemberUsage>> _instanceFunctionsByName =
+      <String, Set<_MemberUsage>>{};
+
   /// Fields set.
   final Set<Element> fieldSetters = new Set<Element>();
-  final Set<DartType> isChecks = new Set<DartType>();
+  final Set<ResolutionDartType> isChecks = new Set<ResolutionDartType>();
 
   /**
    * Set of (live) [:call:] methods whose signatures reference type variables.
@@ -411,14 +463,50 @@
   /// and classes.
   bool useInstantiationMap = false;
 
-  OpenWorld _openWorld;
+  final Backend _backend;
+  final Resolution _resolution;
+  bool _closed = false;
+  ClosedWorld _closedWorldCache;
+  FunctionSetBuilder _allFunctions;
 
-  ResolutionWorldBuilderImpl(Backend backend, CoreClasses coreClasses,
-      CacheStrategy cacheStrategy, this.selectorConstraintsStrategy) {
-    _openWorld = new WorldImpl(this, backend, coreClasses, cacheStrategy);
+  final Set<TypedefElement> _allTypedefs = new Set<TypedefElement>();
+
+  final Map<ClassElement, Set<MixinApplicationElement>> _mixinUses =
+      new Map<ClassElement, Set<MixinApplicationElement>>();
+
+  // We keep track of subtype and subclass relationships in four
+  // distinct sets to make class hierarchy analysis faster.
+  final Map<ClassElement, ClassHierarchyNode> _classHierarchyNodes =
+      <ClassElement, ClassHierarchyNode>{};
+  final Map<ClassElement, ClassSet> _classSets = <ClassElement, ClassSet>{};
+
+  final Set<Element> alreadyPopulated;
+
+  final CacheStrategy cacheStrategy;
+
+  bool get isClosed => _closed;
+
+  ResolutionWorldBuilderImpl(Backend backend, Resolution resolution,
+      CacheStrategy cacheStrategy, this.selectorConstraintsStrategy)
+      : this._backend = backend,
+        this._resolution = resolution,
+        this.cacheStrategy = cacheStrategy,
+        alreadyPopulated = cacheStrategy.newSet() {
+    _allFunctions = new FunctionSetBuilder();
   }
 
-  OpenWorld get openWorld => _openWorld;
+  Iterable<ClassElement> get processedClasses => _processedClasses.keys
+      .where((cls) => _processedClasses[cls].isInstantiated);
+
+  CommonElements get commonElements => _resolution.commonElements;
+
+  ClosedWorld get closedWorldForTesting {
+    if (!_closed) {
+      throw new SpannableAssertionFailure(
+          NO_LOCATION_SPANNABLE, "The world builder has not yet been closed.");
+    }
+    return _closedWorldCache;
+  }
 
   /// All directly instantiated classes, that is, classes with a generative
   /// constructor that has been called directly and not only through a
@@ -439,8 +527,8 @@
   ///
   /// See [directlyInstantiatedClasses].
   // TODO(johnniwinther): Improve semantic precision.
-  Iterable<DartType> get instantiatedTypes {
-    Set<InterfaceType> types = new Set<InterfaceType>();
+  Iterable<ResolutionDartType> get instantiatedTypes {
+    Set<ResolutionInterfaceType> types = new Set<ResolutionInterfaceType>();
     getInstantiationMap().forEach((_, InstantiationInfo info) {
       if (info.instantiationMap != null) {
         for (Set<Instance> instances in info.instantiationMap.values) {
@@ -468,33 +556,33 @@
   // TODO(johnniwinther): Fully enforce the separation between exact, through
   // subclass and through subtype instantiated types/classes.
   // TODO(johnniwinther): Support unknown type arguments for generic types.
-  void registerTypeInstantiation(InterfaceType type,
+  void registerTypeInstantiation(
+      ResolutionInterfaceType type, ClassUsedCallback classUsed,
       {ConstructorElement constructor,
       bool byMirrors: false,
-      bool isNative: false,
-      bool isRedirection: false,
-      void onImplemented(ClassElement cls)}) {
+      bool isRedirection: false}) {
     ClassElement cls = type.element;
+    cls.ensureResolved(_resolution);
     InstantiationInfo info =
         _instantiationInfo.putIfAbsent(cls, () => new InstantiationInfo());
     Instantiation kind = Instantiation.UNINSTANTIATED;
-    if (!cls.isAbstract
+    bool isNative = _backend.isNative(cls);
+    if (!cls.isAbstract ||
         // We can't use the closed-world assumption with native abstract
         // classes; a native abstract class may have non-abstract subclasses
         // not declared to the program.  Instances of these classes are
         // indistinguishable from the abstract class.
-        ||
-        isNative
+        isNative ||
         // Likewise, if this registration comes from the mirror system,
         // all bets are off.
         // TODO(herhut): Track classes required by mirrors seperately.
-        ||
         byMirrors) {
       if (isNative || byMirrors) {
         kind = Instantiation.ABSTRACTLY_INSTANTIATED;
       } else {
         kind = Instantiation.DIRECTLY_INSTANTIATED;
       }
+      _processInstantiatedClass(cls, classUsed);
     }
     info.addInstantiation(constructor, type, kind,
         isRedirection: isRedirection);
@@ -502,10 +590,11 @@
     // TODO(johnniwinther): Use [_instantiationInfo] to compute this information
     // instead.
     if (_implementedClasses.add(cls)) {
-      onImplemented(cls);
-      cls.allSupertypes.forEach((InterfaceType supertype) {
+      classUsed(cls, _getClassUsage(cls).implement());
+      cls.allSupertypes.forEach((ResolutionInterfaceType supertype) {
         if (_implementedClasses.add(supertype.element)) {
-          onImplemented(supertype.element);
+          classUsed(
+              supertype.element, _getClassUsage(supertype.element).implement());
         }
       });
     }
@@ -516,13 +605,13 @@
     getInstantiationMap().forEach(f);
   }
 
-  bool _hasMatchingSelector(Map<Selector, SelectorConstraints> selectors,
-      Element member, OpenWorld world) {
+  bool _hasMatchingSelector(
+      Map<Selector, SelectorConstraints> selectors, Element member) {
     if (selectors == null) return false;
     for (Selector selector in selectors.keys) {
       if (selector.appliesUnnamed(member)) {
         SelectorConstraints masks = selectors[selector];
-        if (masks.applies(member, selector, world)) {
+        if (masks.applies(member, selector, this)) {
           return true;
         }
       }
@@ -557,7 +646,7 @@
                   .addInstantiation(constructor, instance.type, instance.kind);
             } else {
               ConstructorElement target = constructor.effectiveTarget;
-              InterfaceType targetType =
+              ResolutionInterfaceType targetType =
                   constructor.computeEffectiveTargetType(instance.type);
               Instantiation kind = Instantiation.DIRECTLY_INSTANTIATED;
               if (target.enclosingClass.isAbstract) {
@@ -574,27 +663,52 @@
     return instantiationMap;
   }
 
-  bool hasInvocation(Element member, OpenWorld world) {
-    return _hasMatchingSelector(_invokedNames[member.name], member, world);
+  bool _hasInvocation(Element member) {
+    return _hasMatchingSelector(_invokedNames[member.name], member);
   }
 
-  bool hasInvokedGetter(Element member, OpenWorld world) {
-    return _hasMatchingSelector(_invokedGetters[member.name], member, world) ||
+  bool _hasInvokedGetter(Element member) {
+    return _hasMatchingSelector(_invokedGetters[member.name], member) ||
         member.isFunction && methodsNeedingSuperGetter.contains(member);
   }
 
-  bool hasInvokedSetter(Element member, OpenWorld world) {
-    return _hasMatchingSelector(_invokedSetters[member.name], member, world);
+  bool hasInvokedSetter(Element member) {
+    return _hasMatchingSelector(_invokedSetters[member.name], member);
   }
 
-  bool registerDynamicUse(DynamicUse dynamicUse) {
+  void registerDynamicUse(
+      DynamicUse dynamicUse, MemberUsedCallback memberUsed) {
+    Selector selector = dynamicUse.selector;
+    String methodName = selector.name;
+
+    void _process(Map<String, Set<_MemberUsage>> memberMap,
+        EnumSet<MemberUse> action(_MemberUsage usage)) {
+      _processSet(memberMap, methodName, (_MemberUsage usage) {
+        if (dynamicUse.appliesUnnamed(usage.entity, this)) {
+          memberUsed(usage.entity, action(usage));
+          return true;
+        }
+        return false;
+      });
+    }
+
     switch (dynamicUse.kind) {
       case DynamicUseKind.INVOKE:
-        return _registerNewSelector(dynamicUse, _invokedNames);
+        if (_registerNewSelector(dynamicUse, _invokedNames)) {
+          _process(_instanceMembersByName, (m) => m.invoke());
+        }
+        break;
       case DynamicUseKind.GET:
-        return _registerNewSelector(dynamicUse, _invokedGetters);
+        if (_registerNewSelector(dynamicUse, _invokedGetters)) {
+          _process(_instanceMembersByName, (m) => m.read());
+          _process(_instanceFunctionsByName, (m) => m.read());
+        }
+        break;
       case DynamicUseKind.SET:
-        return _registerNewSelector(dynamicUse, _invokedSetters);
+        if (_registerNewSelector(dynamicUse, _invokedSetters)) {
+          _process(_instanceMembersByName, (m) => m.write());
+        }
+        break;
     }
   }
 
@@ -612,8 +726,8 @@
     return constraints.addReceiverConstraint(mask);
   }
 
-  DartType registerIsCheck(DartType type, Resolution resolution) {
-    type.computeUnaliased(resolution);
+  ResolutionDartType registerIsCheck(ResolutionDartType type) {
+    type.computeUnaliased(_resolution);
     type = type.unaliased;
     // Even in checked mode, type annotations for return type and argument
     // types do not imply type checks, so there should never be a check
@@ -622,43 +736,83 @@
     return type;
   }
 
-  void registerStaticUse(StaticUse staticUse) {
+  void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) {
     Element element = staticUse.element;
+    assert(invariant(element, element.isDeclaration,
+        message: "Element ${element} is not the declaration."));
+    _StaticMemberUsage usage = _staticMemberUsage.putIfAbsent(element, () {
+      if ((element.isStatic || element.isTopLevel) && element.isFunction) {
+        return new _StaticFunctionUsage(element);
+      } else {
+        return new _GeneralStaticMemberUsage(element);
+      }
+    });
+    EnumSet<MemberUse> useSet = new EnumSet<MemberUse>();
+
     if (Elements.isStaticOrTopLevel(element) && element.isField) {
       allReferencedStaticFields.add(element);
     }
+    // TODO(johnniwinther): Avoid this. Currently [FIELD_GET] and
+    // [FIELD_SET] contains [BoxFieldElement]s which we cannot enqueue.
+    // Also [CLOSURE] contains [LocalFunctionElement] which we cannot
+    // enqueue.
     switch (staticUse.kind) {
-      case StaticUseKind.SUPER_FIELD_SET:
+      case StaticUseKind.FIELD_GET:
+        break;
       case StaticUseKind.FIELD_SET:
         fieldSetters.add(element);
         break;
+      case StaticUseKind.CLOSURE:
+        LocalFunctionElement closure = staticUse.element;
+        if (closure.type.containsTypeVariables) {
+          closuresWithFreeTypeVariables.add(closure);
+        }
+        allClosures.add(element);
+        break;
       case StaticUseKind.SUPER_TEAR_OFF:
+        useSet.addAll(usage.tearOff());
         methodsNeedingSuperGetter.add(element);
         break;
+      case StaticUseKind.SUPER_FIELD_SET:
+        fieldSetters.add(element);
+        useSet.addAll(usage.normalUse());
+        break;
+      case StaticUseKind.STATIC_TEAR_OFF:
+        useSet.addAll(usage.tearOff());
+        break;
       case StaticUseKind.GENERAL:
       case StaticUseKind.DIRECT_USE:
-      case StaticUseKind.STATIC_TEAR_OFF:
-      case StaticUseKind.FIELD_GET:
       case StaticUseKind.CONSTRUCTOR_INVOKE:
       case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
       case StaticUseKind.REDIRECTION:
-        break;
-      case StaticUseKind.CLOSURE:
-        allClosures.add(element);
+        useSet.addAll(usage.normalUse());
         break;
       case StaticUseKind.DIRECT_INVOKE:
         invariant(
             element, 'Direct static use is not supported for resolution.');
         break;
     }
+    if (useSet.isNotEmpty) {
+      memberUsed(usage.entity, useSet);
+    }
   }
 
-  void forgetElement(Element element, Compiler compiler) {
-    allClosures.remove(element);
-    slowDirectlyNestedClosures(element).forEach(compiler.forgetElement);
-    closurizedMembers.remove(element);
-    fieldSetters.remove(element);
-    _instantiationInfo.remove(element);
+  void forgetEntity(Entity entity, Compiler compiler) {
+    allClosures.remove(entity);
+    slowDirectlyNestedClosures(entity).forEach(compiler.forgetElement);
+    closurizedMembers.remove(entity);
+    fieldSetters.remove(entity);
+    _instantiationInfo.remove(entity);
+
+    void removeUsage(Set<_MemberUsage> set, Entity entity) {
+      if (set == null) return;
+      set.removeAll(
+          set.where((_MemberUsage usage) => usage.entity == entity).toList());
+    }
+
+    _processedClasses.remove(entity);
+    removeUsage(_instanceMembersByName[entity.name], entity);
+    removeUsage(_instanceFunctionsByName[entity.name], entity);
   }
 
   // TODO(ahe): Replace this method with something that is O(1), for example,
@@ -670,12 +824,301 @@
       return closure.executableContext == element;
     }));
   }
+
+  /// Return the canonical [_ClassUsage] for [cls].
+  _ClassUsage _getClassUsage(ClassElement cls) {
+    return _processedClasses.putIfAbsent(cls, () {
+      cls.ensureResolved(_resolution);
+      _ClassUsage usage = new _ClassUsage(cls);
+      _resolution.ensureClassMembers(cls);
+      return usage;
+    });
+  }
+
+  /// Register [cls] and all its superclasses as instantiated.
+  void _processInstantiatedClass(
+      ClassElement cls, ClassUsedCallback classUsed) {
+    // Registers [superclass] as instantiated. Returns `true` if it wasn't
+    // already instantiated and we therefore have to process its superclass as
+    // well.
+    bool processClass(ClassElement superclass) {
+      _ClassUsage usage = _getClassUsage(superclass);
+      if (!usage.isInstantiated) {
+        classUsed(usage.cls, usage.instantiate());
+        return true;
+      }
+      return false;
+    }
+
+    while (cls != null && processClass(cls)) {
+      cls = cls.superclass;
+    }
+  }
+
+  /// Computes usage for all members declared by [cls]. Calls [membersUsed] with
+  /// the usage changes for each member.
+  void processClassMembers(ClassElement cls, MemberUsedCallback memberUsed) {
+    cls.implementation.forEachMember((ClassElement cls, MemberElement member) {
+      _processInstantiatedClassMember(cls, member, memberUsed);
+    });
+  }
+
+  /// Call [updateUsage] on all [_MemberUsage]s in the set in [map] for
+  /// [memberName]. If [updateUsage] returns `true` the usage is removed from
+  /// the set.
+  void _processSet(Map<String, Set<_MemberUsage>> map, String memberName,
+      bool updateUsage(_MemberUsage e)) {
+    Set<_MemberUsage> members = map[memberName];
+    if (members == null) return;
+    // [f] might add elements to [: map[memberName] :] during the loop below
+    // so we create a new list for [: map[memberName] :] and prepend the
+    // [remaining] members after the loop.
+    map[memberName] = new Set<_MemberUsage>();
+    Set<_MemberUsage> remaining = new Set<_MemberUsage>();
+    for (_MemberUsage usage in members) {
+      if (!updateUsage(usage)) remaining.add(usage);
+    }
+    map[memberName].addAll(remaining);
+  }
+
+  void _processInstantiatedClassMember(
+      ClassElement cls, MemberElement member, MemberUsedCallback memberUsed) {
+    assert(invariant(member, member.isDeclaration));
+    if (!member.isInstanceMember) return;
+    String memberName = member.name;
+    member.computeType(_resolution);
+    // The obvious thing to test here would be "member.isNative",
+    // however, that only works after metadata has been parsed/analyzed,
+    // and that may not have happened yet.
+    // So instead we use the enclosing class, which we know have had
+    // its metadata parsed and analyzed.
+    // Note: this assumes that there are no non-native fields on native
+    // classes, which may not be the case when a native class is subclassed.
+    _instanceMemberUsage.putIfAbsent(member, () {
+      bool isNative = _backend.isNative(cls);
+      _MemberUsage usage = new _MemberUsage(member, isNative: isNative);
+      EnumSet<MemberUse> useSet = new EnumSet<MemberUse>();
+      useSet.addAll(usage.appliedUse);
+      if (member.isField && isNative) {
+        registerUsedElement(member);
+      }
+      if (member.isFunction &&
+          member.name == Identifiers.call &&
+          !cls.typeVariables.isEmpty) {
+        callMethodsWithFreeTypeVariables.add(member);
+      }
+
+      if (_hasInvokedGetter(member)) {
+        useSet.addAll(usage.read());
+      }
+      if (_hasInvocation(member)) {
+        useSet.addAll(usage.invoke());
+      }
+      if (hasInvokedSetter(member)) {
+        useSet.addAll(usage.write());
+      }
+
+      if (usage.pendingUse.contains(MemberUse.NORMAL)) {
+        // The element is not yet used. Add it to the list of instance
+        // members to still be processed.
+        _instanceMembersByName
+            .putIfAbsent(memberName, () => new Set<_MemberUsage>())
+            .add(usage);
+      }
+      if (usage.pendingUse.contains(MemberUse.CLOSURIZE_INSTANCE)) {
+        // Store the member in [instanceFunctionsByName] to catch
+        // getters on the function.
+        _instanceFunctionsByName
+            .putIfAbsent(memberName, () => new Set<_MemberUsage>())
+            .add(usage);
+      }
+
+      memberUsed(usage.entity, useSet);
+      return usage;
+    });
+  }
+
+  /// Returns an iterable over all mixin applications that mixin [cls].
+  Iterable<MixinApplicationElement> allMixinUsesOf(ClassElement cls) {
+    Iterable<MixinApplicationElement> uses = _mixinUses[cls];
+    return uses != null ? uses : const <MixinApplicationElement>[];
+  }
+
+  /// Called to add [cls] to the set of known classes.
+  ///
+  /// This ensures that class hierarchy queries can be performed on [cls] and
+  /// classes that extend or implement it.
+  void registerClass(ClassElement cls) => _registerClass(cls);
+
+  void _registerClass(ClassElement cls, {bool isDirectlyInstantiated: false}) {
+    _ensureClassSet(cls);
+    if (isDirectlyInstantiated) {
+      _updateClassHierarchyNodeForClass(cls, directlyInstantiated: true);
+    }
+  }
+
+  void registerTypedef(TypedefElement typdef) {
+    _allTypedefs.add(typdef);
+  }
+
+  ClassHierarchyNode _ensureClassHierarchyNode(ClassElement cls) {
+    cls = cls.declaration;
+    return _classHierarchyNodes.putIfAbsent(cls, () {
+      ClassHierarchyNode parentNode;
+      if (cls.superclass != null) {
+        parentNode = _ensureClassHierarchyNode(cls.superclass);
+      }
+      return new ClassHierarchyNode(parentNode, cls);
+    });
+  }
+
+  ClassSet _ensureClassSet(ClassElement cls) {
+    cls = cls.declaration;
+    return _classSets.putIfAbsent(cls, () {
+      ClassHierarchyNode node = _ensureClassHierarchyNode(cls);
+      ClassSet classSet = new ClassSet(node);
+
+      for (ResolutionInterfaceType type in cls.allSupertypes) {
+        // TODO(johnniwinther): Optimization: Avoid adding [cls] to
+        // superclasses.
+        ClassSet subtypeSet = _ensureClassSet(type.element);
+        subtypeSet.addSubtype(node);
+      }
+      if (cls.isMixinApplication) {
+        // TODO(johnniwinther): Store this in the [ClassSet].
+        MixinApplicationElement mixinApplication = cls;
+        if (mixinApplication.mixin != null) {
+          // If [mixinApplication] is malformed [mixin] is `null`.
+          registerMixinUse(mixinApplication, mixinApplication.mixin);
+        }
+      }
+
+      return classSet;
+    });
+  }
+
+  void _updateSuperClassHierarchyNodeForClass(ClassHierarchyNode node) {
+    // Ensure that classes implicitly implementing `Function` are in its
+    // subtype set.
+    ClassElement cls = node.cls;
+    if (cls != commonElements.functionClass &&
+        cls.implementsFunction(commonElements)) {
+      ClassSet subtypeSet = _ensureClassSet(commonElements.functionClass);
+      subtypeSet.addSubtype(node);
+    }
+    if (!node.isInstantiated && node.parentNode != null) {
+      _updateSuperClassHierarchyNodeForClass(node.parentNode);
+    }
+  }
+
+  void _updateClassHierarchyNodeForClass(ClassElement cls,
+      {bool directlyInstantiated: false, bool abstractlyInstantiated: false}) {
+    ClassHierarchyNode node = _ensureClassHierarchyNode(cls);
+    _updateSuperClassHierarchyNodeForClass(node);
+    if (directlyInstantiated) {
+      node.isDirectlyInstantiated = true;
+    }
+    if (abstractlyInstantiated) {
+      node.isAbstractlyInstantiated = true;
+    }
+  }
+
+  ClosedWorld closeWorld(DiagnosticReporter reporter) {
+    Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses =
+        new Map<ClassElement, Set<ClassElement>>();
+
+    /// Updates the `isDirectlyInstantiated` and `isIndirectlyInstantiated`
+    /// properties of the [ClassHierarchyNode] for [cls].
+
+    void addSubtypes(ClassElement cls, InstantiationInfo info) {
+      if (!info.hasInstantiation) {
+        return;
+      }
+      if (cacheStrategy.hasIncrementalSupport && !alreadyPopulated.add(cls)) {
+        return;
+      }
+      assert(cls.isDeclaration);
+      if (!cls.isResolved) {
+        reporter.internalError(cls, 'Class "${cls.name}" is not resolved.');
+      }
+
+      _updateClassHierarchyNodeForClass(cls,
+          directlyInstantiated: info.isDirectlyInstantiated,
+          abstractlyInstantiated: info.isAbstractlyInstantiated);
+
+      // Walk through the superclasses, and record the types
+      // implemented by that type on the superclasses.
+      ClassElement superclass = cls.superclass;
+      while (superclass != null) {
+        Set<Element> typesImplementedBySubclassesOfCls =
+            typesImplementedBySubclasses.putIfAbsent(
+                superclass, () => new Set<ClassElement>());
+        for (ResolutionDartType current in cls.allSupertypes) {
+          typesImplementedBySubclassesOfCls.add(current.element);
+        }
+        superclass = superclass.superclass;
+      }
+    }
+
+    // Use the [:seenClasses:] set to include non-instantiated
+    // classes: if the superclass of these classes require RTI, then
+    // they also need RTI, so that a constructor passes the type
+    // variables to the super constructor.
+    forEachInstantiatedClass(addSubtypes);
+
+    _closed = true;
+    return _closedWorldCache = new ClosedWorldImpl(
+        backend: _backend,
+        commonElements: commonElements,
+        resolutionWorldBuilder: this,
+        functionSetBuilder: _allFunctions,
+        allTypedefs: _allTypedefs,
+        mixinUses: _mixinUses,
+        typesImplementedBySubclasses: typesImplementedBySubclasses,
+        classHierarchyNodes: _classHierarchyNodes,
+        classSets: _classSets);
+  }
+
+  void registerMixinUse(
+      MixinApplicationElement mixinApplication, ClassElement mixin) {
+    // TODO(johnniwinther): Add map restricted to live classes.
+    // We don't support patch classes as mixin.
+    assert(mixin.isDeclaration);
+    Set<MixinApplicationElement> users =
+        _mixinUses.putIfAbsent(mixin, () => new Set<MixinApplicationElement>());
+    users.add(mixinApplication);
+  }
+
+  void registerUsedElement(MemberElement element) {
+    if (element.isInstanceMember && !element.isAbstract) {
+      _allFunctions.add(element);
+    }
+  }
+
+  ClosedWorld get closedWorldCache {
+    assert(isClosed);
+    return _closedWorldCache;
+  }
 }
 
 /// World builder specific to codegen.
 ///
 /// This adds additional access to liveness of selectors and elements.
 abstract class CodegenWorldBuilder implements WorldBuilder {
+  /// Opens this world builder using [closedWorld] as the known superset of
+  /// possible runtime entities.
+  void open(ClosedWorld closedWorld);
+
+  /// Calls [f] with every instance field, together with its declarer, in an
+  /// instance of [cls].
+  void forEachInstanceField(
+      ClassEntity cls, void f(ClassEntity declarer, FieldEntity field));
+
+  /// Calls [f] for each parameter of [function] providing the type and name of
+  /// the parameter.
+  void forEachParameter(
+      FunctionEntity function, void f(DartType type, String name));
+
   void forEachInvokedName(
       f(String name, Map<Selector, SelectorConstraints> selectors));
 
@@ -685,6 +1128,9 @@
   void forEachInvokedSetter(
       f(String name, Map<Selector, SelectorConstraints> selectors));
 
+  /// Returns `true` if [member] is invoked as a setter.
+  bool hasInvokedSetter(Element member, ClosedWorld world);
+
   bool hasInvokedGetter(Element member, ClosedWorld world);
 
   Map<Selector, SelectorConstraints> invocationsByName(String name);
@@ -703,6 +1149,9 @@
 }
 
 class CodegenWorldBuilderImpl implements CodegenWorldBuilder {
+  final Backend _backend;
+  ClosedWorld __world;
+
   /// The set of all directly instantiated classes, that is, classes with a
   /// generative constructor that has been called directly and not only through
   /// a super-call.
@@ -717,7 +1166,8 @@
   /// directly instantiated classes.
   ///
   /// See [_directlyInstantiatedClasses].
-  final Set<DartType> _instantiatedTypes = new Set<DartType>();
+  final Set<ResolutionDartType> _instantiatedTypes =
+      new Set<ResolutionDartType>();
 
   /// Classes implemented by directly instantiated classes.
   final Set<ClassElement> _implementedClasses = new Set<ClassElement>();
@@ -743,11 +1193,64 @@
   final Map<String, Map<Selector, SelectorConstraints>> _invokedSetters =
       <String, Map<Selector, SelectorConstraints>>{};
 
-  final Set<DartType> isChecks = new Set<DartType>();
+  final Map<ClassElement, _ClassUsage> _processedClasses =
+      <ClassElement, _ClassUsage>{};
+
+  /// Map of registered usage of static members of live classes.
+  final Map<Entity, _StaticMemberUsage> _staticMemberUsage =
+      <Entity, _StaticMemberUsage>{};
+
+  /// Map of registered usage of instance members of live classes.
+  final Map<MemberEntity, _MemberUsage> _instanceMemberUsage =
+      <MemberEntity, _MemberUsage>{};
+
+  /// Map containing instance members of live classes that are not yet live
+  /// themselves.
+  final Map<String, Set<_MemberUsage>> _instanceMembersByName =
+      <String, Set<_MemberUsage>>{};
+
+  /// Map containing instance methods of live classes that are not yet
+  /// closurized.
+  final Map<String, Set<_MemberUsage>> _instanceFunctionsByName =
+      <String, Set<_MemberUsage>>{};
+
+  final Set<ResolutionDartType> isChecks = new Set<ResolutionDartType>();
 
   final SelectorConstraintsStrategy selectorConstraintsStrategy;
 
-  CodegenWorldBuilderImpl(this.selectorConstraintsStrategy);
+  CodegenWorldBuilderImpl(this._backend, this.selectorConstraintsStrategy);
+
+  void open(ClosedWorld closedWorld) {
+    assert(invariant(NO_LOCATION_SPANNABLE, __world == null,
+        message: "CodegenWorldBuilder has already been opened."));
+    __world = closedWorld;
+  }
+
+  ClosedWorld get _world {
+    assert(invariant(NO_LOCATION_SPANNABLE, __world != null,
+        message: "CodegenWorldBuilder has not been opened."));
+    return __world;
+  }
+
+  /// Calls [f] with every instance field, together with its declarer, in an
+  /// instance of [cls].
+  void forEachInstanceField(
+      ClassElement cls, void f(ClassEntity declarer, FieldEntity field)) {
+    cls.implementation
+        .forEachInstanceField(f, includeSuperAndInjectedMembers: true);
+  }
+
+  @override
+  void forEachParameter(
+      MethodElement function, void f(DartType type, String name)) {
+    FunctionSignature parameters = function.functionSignature;
+    parameters.forEachParameter((ParameterElement parameter) {
+      f(parameter.type, parameter.name);
+    });
+  }
+
+  Iterable<ClassElement> get processedClasses => _processedClasses.keys
+      .where((cls) => _processedClasses[cls].isInstantiated);
 
   /// All directly instantiated classes, that is, classes with a generative
   /// constructor that has been called directly and not only through a
@@ -762,7 +1265,7 @@
   ///
   /// See [directlyInstantiatedClasses].
   // TODO(johnniwinther): Improve semantic precision.
-  Iterable<DartType> get instantiatedTypes => _instantiatedTypes;
+  Iterable<ResolutionDartType> get instantiatedTypes => _instantiatedTypes;
 
   /// Register [type] as (directly) instantiated.
   ///
@@ -770,12 +1273,12 @@
   // TODO(johnniwinther): Fully enforce the separation between exact, through
   // subclass and through subtype instantiated types/classes.
   // TODO(johnniwinther): Support unknown type arguments for generic types.
-  void registerTypeInstantiation(InterfaceType type,
-      {bool byMirrors: false,
-      bool isNative: false,
-      void onImplemented(ClassElement cls)}) {
-    _instantiatedTypes.add(type);
+  void registerTypeInstantiation(
+      ResolutionInterfaceType type, ClassUsedCallback classUsed,
+      {bool byMirrors: false}) {
     ClassElement cls = type.element;
+    bool isNative = _backend.isNative(cls);
+    _instantiatedTypes.add(type);
     if (!cls.isAbstract
         // We can't use the closed-world assumption with native abstract
         // classes; a native abstract class may have non-abstract subclasses
@@ -789,15 +1292,17 @@
         ||
         byMirrors) {
       _directlyInstantiatedClasses.add(cls);
+      _processInstantiatedClass(cls, classUsed);
     }
 
     // TODO(johnniwinther): Replace this by separate more specific mappings that
     // include the type arguments.
     if (_implementedClasses.add(cls)) {
-      onImplemented(cls);
-      cls.allSupertypes.forEach((InterfaceType supertype) {
+      classUsed(cls, _getClassUsage(cls).implement());
+      cls.allSupertypes.forEach((ResolutionInterfaceType supertype) {
         if (_implementedClasses.add(supertype.element)) {
-          onImplemented(supertype.element);
+          classUsed(
+              supertype.element, _getClassUsage(supertype.element).implement());
         }
       });
     }
@@ -830,15 +1335,44 @@
     return _hasMatchingSelector(_invokedSetters[member.name], member, world);
   }
 
-  bool registerDynamicUse(DynamicUse dynamicUse) {
+  bool registerDynamicUse(
+      DynamicUse dynamicUse, MemberUsedCallback memberUsed) {
+    Selector selector = dynamicUse.selector;
+    String methodName = selector.name;
+
+    void _process(Map<String, Set<_MemberUsage>> memberMap,
+        EnumSet<MemberUse> action(_MemberUsage usage)) {
+      _processSet(memberMap, methodName, (_MemberUsage usage) {
+        if (dynamicUse.appliesUnnamed(usage.entity, _world)) {
+          memberUsed(usage.entity, action(usage));
+          return true;
+        }
+        return false;
+      });
+    }
+
     switch (dynamicUse.kind) {
       case DynamicUseKind.INVOKE:
-        return _registerNewSelector(dynamicUse, _invokedNames);
+        if (_registerNewSelector(dynamicUse, _invokedNames)) {
+          _process(_instanceMembersByName, (m) => m.invoke());
+          return true;
+        }
+        break;
       case DynamicUseKind.GET:
-        return _registerNewSelector(dynamicUse, _invokedGetters);
+        if (_registerNewSelector(dynamicUse, _invokedGetters)) {
+          _process(_instanceMembersByName, (m) => m.read());
+          _process(_instanceFunctionsByName, (m) => m.read());
+          return true;
+        }
+        break;
       case DynamicUseKind.SET:
-        return _registerNewSelector(dynamicUse, _invokedSetters);
+        if (_registerNewSelector(dynamicUse, _invokedSetters)) {
+          _process(_instanceMembersByName, (m) => m.write());
+          return true;
+        }
+        break;
     }
+    return false;
   }
 
   bool _registerNewSelector(DynamicUse dynamicUse,
@@ -888,7 +1422,7 @@
     _invokedSetters.forEach(f);
   }
 
-  DartType registerIsCheck(DartType type, Resolution resolution) {
+  ResolutionDartType registerIsCheck(ResolutionDartType type) {
     type = type.unaliased;
     // Even in checked mode, type annotations for return type and argument
     // types do not imply type checks, so there should never be a check
@@ -897,7 +1431,7 @@
     return type;
   }
 
-  void registerStaticUse(StaticUse staticUse) {
+  void _registerStaticUse(StaticUse staticUse) {
     Element element = staticUse.element;
     if (Elements.isStaticOrTopLevel(element) && element.isField) {
       allReferencedStaticFields.add(element);
@@ -923,12 +1457,535 @@
     }
   }
 
+  void registerStaticUse(StaticUse staticUse, MemberUsedCallback memberUsed) {
+    Element element = staticUse.element;
+    assert(invariant(element, element.isDeclaration,
+        message: "Element ${element} is not the declaration."));
+    _registerStaticUse(staticUse);
+    _StaticMemberUsage usage = _staticMemberUsage.putIfAbsent(element, () {
+      if ((element.isStatic || element.isTopLevel) && element.isFunction) {
+        return new _StaticFunctionUsage(element);
+      } else {
+        return new _GeneralStaticMemberUsage(element);
+      }
+    });
+    EnumSet<MemberUse> useSet = new EnumSet<MemberUse>();
+    switch (staticUse.kind) {
+      case StaticUseKind.STATIC_TEAR_OFF:
+        useSet.addAll(usage.tearOff());
+        break;
+      case StaticUseKind.FIELD_GET:
+      case StaticUseKind.FIELD_SET:
+      case StaticUseKind.CLOSURE:
+        // TODO(johnniwinther): Avoid this. Currently [FIELD_GET] and
+        // [FIELD_SET] contains [BoxFieldElement]s which we cannot enqueue.
+        // Also [CLOSURE] contains [LocalFunctionElement] which we cannot
+        // enqueue.
+        break;
+      case StaticUseKind.SUPER_FIELD_SET:
+      case StaticUseKind.SUPER_TEAR_OFF:
+      case StaticUseKind.GENERAL:
+      case StaticUseKind.DIRECT_USE:
+        useSet.addAll(usage.normalUse());
+        break;
+      case StaticUseKind.CONSTRUCTOR_INVOKE:
+      case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
+      case StaticUseKind.REDIRECTION:
+        useSet.addAll(usage.normalUse());
+        break;
+      case StaticUseKind.DIRECT_INVOKE:
+        _MemberUsage instanceUsage =
+            _getMemberUsage(staticUse.element, memberUsed);
+        memberUsed(instanceUsage.entity, instanceUsage.invoke());
+        _instanceMembersByName[instanceUsage.entity.name]
+            ?.remove(instanceUsage);
+        useSet.addAll(usage.normalUse());
+        break;
+    }
+    memberUsed(usage.entity, useSet);
+  }
+
   void forgetElement(Element element, Compiler compiler) {
+    _processedClasses.remove(element);
     _directlyInstantiatedClasses.remove(element);
     if (element is ClassElement) {
       assert(invariant(element, element.thisType.isRaw,
           message: 'Generic classes not supported (${element.thisType}).'));
       _instantiatedTypes..remove(element.rawType)..remove(element.thisType);
     }
+    removeFromSet(_instanceMembersByName, element);
+    removeFromSet(_instanceFunctionsByName, element);
+    if (element is MemberElement) {
+      for (Element closure in element.nestedClosures) {
+        removeFromSet(_instanceMembersByName, closure);
+        removeFromSet(_instanceFunctionsByName, closure);
+      }
+    }
   }
+
+  void processClassMembers(ClassElement cls, MemberUsedCallback memberUsed) {
+    cls.implementation.forEachMember((_, MemberElement member) {
+      assert(invariant(member, member.isDeclaration));
+      if (!member.isInstanceMember) return;
+      _getMemberUsage(member, memberUsed);
+    });
+  }
+
+  _MemberUsage _getMemberUsage(
+      MemberElement member, MemberUsedCallback memberUsed) {
+    assert(invariant(member, member.isDeclaration));
+    return _instanceMemberUsage.putIfAbsent(member, () {
+      String memberName = member.name;
+      ClassElement cls = member.enclosingClass;
+      bool isNative = _backend.isNative(cls);
+      _MemberUsage usage = new _MemberUsage(member, isNative: isNative);
+      EnumSet<MemberUse> useSet = new EnumSet<MemberUse>();
+      useSet.addAll(usage.appliedUse);
+      if (hasInvokedGetter(member, _world)) {
+        useSet.addAll(usage.read());
+      }
+      if (hasInvokedSetter(member, _world)) {
+        useSet.addAll(usage.write());
+      }
+      if (hasInvocation(member, _world)) {
+        useSet.addAll(usage.invoke());
+      }
+
+      if (usage.pendingUse.contains(MemberUse.CLOSURIZE_INSTANCE)) {
+        // Store the member in [instanceFunctionsByName] to catch
+        // getters on the function.
+        _instanceFunctionsByName
+            .putIfAbsent(usage.entity.name, () => new Set<_MemberUsage>())
+            .add(usage);
+      }
+      if (usage.pendingUse.contains(MemberUse.NORMAL)) {
+        // The element is not yet used. Add it to the list of instance
+        // members to still be processed.
+        _instanceMembersByName
+            .putIfAbsent(memberName, () => new Set<_MemberUsage>())
+            .add(usage);
+      }
+      memberUsed(member, useSet);
+      return usage;
+    });
+  }
+
+  void _processSet(Map<String, Set<_MemberUsage>> map, String memberName,
+      bool f(_MemberUsage e)) {
+    Set<_MemberUsage> members = map[memberName];
+    if (members == null) return;
+    // [f] might add elements to [: map[memberName] :] during the loop below
+    // so we create a new list for [: map[memberName] :] and prepend the
+    // [remaining] members after the loop.
+    map[memberName] = new Set<_MemberUsage>();
+    Set<_MemberUsage> remaining = new Set<_MemberUsage>();
+    for (_MemberUsage member in members) {
+      if (!f(member)) remaining.add(member);
+    }
+    map[memberName].addAll(remaining);
+  }
+
+  /// Return the canonical [_ClassUsage] for [cls].
+  _ClassUsage _getClassUsage(ClassElement cls) {
+    return _processedClasses.putIfAbsent(cls, () => new _ClassUsage(cls));
+  }
+
+  void _processInstantiatedClass(
+      ClassElement cls, ClassUsedCallback classUsed) {
+    // Registers [superclass] as instantiated. Returns `true` if it wasn't
+    // already instantiated and we therefore have to process its superclass as
+    // well.
+    bool processClass(ClassElement superclass) {
+      _ClassUsage usage = _getClassUsage(superclass);
+      if (!usage.isInstantiated) {
+        classUsed(usage.cls, usage.instantiate());
+        return true;
+      }
+      return false;
+    }
+
+    while (cls != null && processClass(cls)) {
+      cls = cls.superclass;
+    }
+  }
+}
+
+abstract class _AbstractUsage<T> {
+  final EnumSet<T> _pendingUse = new EnumSet<T>();
+
+  _AbstractUsage() {
+    _pendingUse.addAll(_originalUse);
+  }
+
+  /// Returns the possible uses of [entity] that have not yet been registered.
+  EnumSet<T> get pendingUse => _pendingUse;
+
+  /// Returns the uses of [entity] that have been registered.
+  EnumSet<T> get appliedUse => _originalUse.minus(_pendingUse);
+
+  EnumSet<T> get _originalUse;
+}
+
+/// Registry for the observed use of a member [entity] in the open world.
+abstract class _MemberUsage extends _AbstractUsage<MemberUse> {
+  // TODO(johnniwinther): Change [Entity] to [MemberEntity].
+  final Entity entity;
+
+  _MemberUsage.internal(this.entity);
+
+  factory _MemberUsage(MemberEntity member, {bool isNative: false}) {
+    if (member.isField) {
+      if (member.isAssignable) {
+        return new _FieldUsage(member, isNative: isNative);
+      } else {
+        return new _FinalFieldUsage(member, isNative: isNative);
+      }
+    } else if (member.isGetter) {
+      return new _GetterUsage(member);
+    } else if (member.isSetter) {
+      return new _SetterUsage(member);
+    } else {
+      assert(member.isFunction);
+      return new _FunctionUsage(member);
+    }
+  }
+
+  /// `true` if [entity] has been read as a value. For a field this is a normal
+  /// read access, for a function this is a closurization.
+  bool get hasRead => false;
+
+  /// `true` if a value has been written to [entity].
+  bool get hasWrite => false;
+
+  /// `true` if an invocation has been performed on the value [entity]. For a
+  /// function this is a normal invocation, for a field this is a read access
+  /// followed by an invocation of the function-like value.
+  bool get hasInvoke => false;
+
+  /// `true` if [entity] has been used in all the ways possible.
+  bool get fullyUsed;
+
+  /// Registers a read of the value of [entity] and returns the new [MemberUse]s
+  /// that it caused.
+  ///
+  /// For a field this is a normal read access, for a function this is a
+  /// closurization.
+  EnumSet<MemberUse> read() => MemberUses.NONE;
+
+  /// Registers a write of a value to [entity] and returns the new [MemberUse]s
+  /// that it caused.
+  EnumSet<MemberUse> write() => MemberUses.NONE;
+
+  /// Registers an invocation on the value of [entity] and returns the new
+  /// [MemberUse]s that it caused.
+  ///
+  /// For a function this is a normal invocation, for a field this is a read
+  /// access followed by an invocation of the function-like value.
+  EnumSet<MemberUse> invoke() => MemberUses.NONE;
+
+  /// Registers all possible uses of [entity] and returns the new [MemberUse]s
+  /// that it caused.
+  EnumSet<MemberUse> fullyUse() => MemberUses.NONE;
+
+  @override
+  EnumSet<MemberUse> get _originalUse => MemberUses.NORMAL_ONLY;
+
+  int get hashCode => entity.hashCode;
+
+  bool operator ==(other) {
+    if (identical(this, other)) return true;
+    if (other is! _MemberUsage) return false;
+    return entity == other.entity;
+  }
+
+  String toString() => entity.toString();
+}
+
+class _FieldUsage extends _MemberUsage {
+  bool hasRead = false;
+  bool hasWrite = false;
+
+  _FieldUsage(FieldEntity field, {bool isNative: false})
+      : super.internal(field) {
+    if (!isNative) {
+      // All field initializers must be resolved as they could
+      // have an observable side-effect (and cannot be tree-shaken
+      // away).
+      fullyUse();
+    }
+  }
+
+  @override
+  bool get fullyUsed => hasRead && hasWrite;
+
+  @override
+  EnumSet<MemberUse> read() {
+    if (fullyUsed) {
+      return MemberUses.NONE;
+    }
+    hasRead = true;
+    return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
+  }
+
+  @override
+  EnumSet<MemberUse> write() {
+    if (fullyUsed) {
+      return MemberUses.NONE;
+    }
+    hasWrite = true;
+    return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
+  }
+
+  @override
+  EnumSet<MemberUse> invoke() => read();
+
+  @override
+  EnumSet<MemberUse> fullyUse() {
+    if (fullyUsed) {
+      return MemberUses.NONE;
+    }
+    hasRead = hasWrite = true;
+    return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
+  }
+}
+
+class _FinalFieldUsage extends _MemberUsage {
+  bool hasRead = false;
+
+  _FinalFieldUsage(FieldEntity field, {bool isNative: false})
+      : super.internal(field) {
+    if (!isNative) {
+      // All field initializers must be resolved as they could
+      // have an observable side-effect (and cannot be tree-shaken
+      // away).
+      read();
+    }
+  }
+
+  @override
+  bool get fullyUsed => hasRead;
+
+  @override
+  EnumSet<MemberUse> read() {
+    if (hasRead) {
+      return MemberUses.NONE;
+    }
+    hasRead = true;
+    return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
+  }
+
+  @override
+  EnumSet<MemberUse> invoke() => read();
+
+  @override
+  EnumSet<MemberUse> fullyUse() => read();
+}
+
+class _FunctionUsage extends _MemberUsage {
+  bool hasInvoke = false;
+  bool hasRead = false;
+
+  _FunctionUsage(FunctionEntity function) : super.internal(function);
+
+  EnumSet<MemberUse> get _originalUse => MemberUses.ALL_INSTANCE;
+
+  @override
+  EnumSet<MemberUse> read() => fullyUse();
+
+  @override
+  EnumSet<MemberUse> invoke() {
+    if (hasInvoke) {
+      return MemberUses.NONE;
+    }
+    hasInvoke = true;
+    return _pendingUse
+        .removeAll(hasRead ? MemberUses.NONE : MemberUses.NORMAL_ONLY);
+  }
+
+  @override
+  EnumSet<MemberUse> fullyUse() {
+    if (hasInvoke) {
+      if (hasRead) {
+        return MemberUses.NONE;
+      }
+      hasRead = true;
+      return _pendingUse.removeAll(MemberUses.CLOSURIZE_INSTANCE_ONLY);
+    } else if (hasRead) {
+      hasInvoke = true;
+      return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
+    } else {
+      hasRead = hasInvoke = true;
+      return _pendingUse.removeAll(MemberUses.ALL_INSTANCE);
+    }
+  }
+
+  @override
+  bool get fullyUsed => hasInvoke && hasRead;
+}
+
+class _GetterUsage extends _MemberUsage {
+  bool hasRead = false;
+
+  _GetterUsage(FunctionEntity getter) : super.internal(getter);
+
+  @override
+  bool get fullyUsed => hasRead;
+
+  @override
+  EnumSet<MemberUse> read() {
+    if (hasRead) {
+      return MemberUses.NONE;
+    }
+    hasRead = true;
+    return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
+  }
+
+  @override
+  EnumSet<MemberUse> invoke() => read();
+
+  @override
+  EnumSet<MemberUse> fullyUse() => read();
+}
+
+class _SetterUsage extends _MemberUsage {
+  bool hasWrite = false;
+
+  _SetterUsage(FunctionEntity setter) : super.internal(setter);
+
+  @override
+  bool get fullyUsed => hasWrite;
+
+  @override
+  EnumSet<MemberUse> write() {
+    if (hasWrite) {
+      return MemberUses.NONE;
+    }
+    hasWrite = true;
+    return MemberUses.NORMAL_ONLY;
+  }
+
+  @override
+  EnumSet<MemberUse> fullyUse() => write();
+}
+
+/// Enum class for the possible kind of use of [MemberEntity] objects.
+enum MemberUse { NORMAL, CLOSURIZE_INSTANCE, CLOSURIZE_STATIC }
+
+/// Common [EnumSet]s used for [MemberUse].
+class MemberUses {
+  static const EnumSet<MemberUse> NONE = const EnumSet<MemberUse>.fixed(0);
+  static const EnumSet<MemberUse> NORMAL_ONLY =
+      const EnumSet<MemberUse>.fixed(1);
+  static const EnumSet<MemberUse> CLOSURIZE_INSTANCE_ONLY =
+      const EnumSet<MemberUse>.fixed(2);
+  static const EnumSet<MemberUse> CLOSURIZE_STATIC_ONLY =
+      const EnumSet<MemberUse>.fixed(4);
+  static const EnumSet<MemberUse> ALL_INSTANCE =
+      const EnumSet<MemberUse>.fixed(3);
+  static const EnumSet<MemberUse> ALL_STATIC =
+      const EnumSet<MemberUse>.fixed(5);
+}
+
+typedef void MemberUsedCallback(MemberEntity member, EnumSet<MemberUse> useSet);
+
+/// Registry for the observed use of a class [entity] in the open world.
+// TODO(johnniwinther): Merge this with [InstantiationInfo].
+class _ClassUsage extends _AbstractUsage<ClassUse> {
+  bool isInstantiated = false;
+  bool isImplemented = false;
+
+  final ClassEntity cls;
+
+  _ClassUsage(this.cls);
+
+  EnumSet<ClassUse> instantiate() {
+    if (isInstantiated) {
+      return ClassUses.NONE;
+    }
+    isInstantiated = true;
+    return _pendingUse.removeAll(ClassUses.INSTANTIATED_ONLY);
+  }
+
+  EnumSet<ClassUse> implement() {
+    if (isImplemented) {
+      return ClassUses.NONE;
+    }
+    isImplemented = true;
+    return _pendingUse.removeAll(ClassUses.IMPLEMENTED_ONLY);
+  }
+
+  @override
+  EnumSet<ClassUse> get _originalUse => ClassUses.ALL;
+
+  String toString() => cls.toString();
+}
+
+/// Enum class for the possible kind of use of [ClassEntity] objects.
+enum ClassUse { INSTANTIATED, IMPLEMENTED }
+
+/// Common [EnumSet]s used for [ClassUse].
+class ClassUses {
+  static const EnumSet<ClassUse> NONE = const EnumSet<ClassUse>.fixed(0);
+  static const EnumSet<ClassUse> INSTANTIATED_ONLY =
+      const EnumSet<ClassUse>.fixed(1);
+  static const EnumSet<ClassUse> IMPLEMENTED_ONLY =
+      const EnumSet<ClassUse>.fixed(2);
+  static const EnumSet<ClassUse> ALL = const EnumSet<ClassUse>.fixed(3);
+}
+
+typedef void ClassUsedCallback(ClassEntity cls, EnumSet<ClassUse> useSet);
+
+// TODO(johnniwinther): Merge this with [_MemberUsage].
+abstract class _StaticMemberUsage extends _AbstractUsage<MemberUse> {
+  final Entity entity;
+
+  bool hasNormalUse = false;
+  bool get hasClosurization => false;
+
+  _StaticMemberUsage.internal(this.entity);
+
+  EnumSet<MemberUse> normalUse() {
+    if (hasNormalUse) {
+      return MemberUses.NONE;
+    }
+    hasNormalUse = true;
+    return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
+  }
+
+  EnumSet<MemberUse> tearOff();
+
+  @override
+  EnumSet<MemberUse> get _originalUse => MemberUses.NORMAL_ONLY;
+
+  String toString() => entity.toString();
+}
+
+class _GeneralStaticMemberUsage extends _StaticMemberUsage {
+  _GeneralStaticMemberUsage(Entity entity) : super.internal(entity);
+
+  EnumSet<MemberUse> tearOff() => normalUse();
+}
+
+class _StaticFunctionUsage extends _StaticMemberUsage {
+  bool hasClosurization = false;
+
+  _StaticFunctionUsage(Entity entity) : super.internal(entity);
+
+  EnumSet<MemberUse> tearOff() {
+    if (hasClosurization) {
+      return MemberUses.NONE;
+    }
+    hasNormalUse = hasClosurization = true;
+    return _pendingUse.removeAll(MemberUses.ALL_STATIC);
+  }
+
+  @override
+  EnumSet<MemberUse> get _originalUse => MemberUses.ALL_STATIC;
+}
+
+void removeFromSet(Map<String, Set<_MemberUsage>> map, Element element) {
+  Set<_MemberUsage> set = map[element.name];
+  if (set == null) return;
+  set.removeAll(
+      set.where((_MemberUsage usage) => usage.entity == element).toList());
 }
diff --git a/pkg/compiler/lib/src/universe/world_impact.dart b/pkg/compiler/lib/src/universe/world_impact.dart
index 2a1afb8..4d4f3f9 100644
--- a/pkg/compiler/lib/src/universe/world_impact.dart
+++ b/pkg/compiler/lib/src/universe/world_impact.dart
@@ -261,8 +261,8 @@
 class ImpactStrategy {
   const ImpactStrategy();
 
-  /// Applies [impact] to [visitor] for the [impactUseCase] of [element].
-  void visitImpact(Element element, WorldImpact impact,
+  /// Applies [impact] to [visitor] for the [impactUseCase] of [impactSource].
+  void visitImpact(var impactSource, WorldImpact impact,
       WorldImpactVisitor visitor, ImpactUseCase impactUseCase) {
     // Apply unconditionally.
     impact.apply(visitor);
diff --git a/pkg/compiler/lib/src/use_unused_api.dart b/pkg/compiler/lib/src/use_unused_api.dart
index da1cbdf..de79fb6 100644
--- a/pkg/compiler/lib/src/use_unused_api.dart
+++ b/pkg/compiler/lib/src/use_unused_api.dart
@@ -17,7 +17,7 @@
 import 'constants/expressions.dart' as constants;
 import 'constants/values.dart' as constants;
 import 'dart2js.dart' as dart2js;
-import 'dart_types.dart' as dart_types;
+import 'elements/resolution_types.dart' as dart_types;
 import 'deferred_load.dart' as deferred;
 import 'diagnostics/source_span.dart' as diagnostics;
 import 'elements/elements.dart' as elements;
@@ -247,15 +247,15 @@
 usedByTests() {
   // TODO(ahe): We should try to avoid including API used only for tests. In
   // most cases, such API can be moved to a test library.
-  WorldImpl world = null;
+  ClosedWorldImpl closedWorld = null;
   type_graph_inferrer.TypeGraphInferrer typeGraphInferrer = null;
   source_file_provider.SourceFileProvider sourceFileProvider = null;
   sourceFileProvider.getSourceFile(null);
-  world.hasAnyUserDefinedGetter(null, null);
-  world.subclassesOf(null);
-  world.getClassHierarchyNode(null);
-  world.getClassSet(null);
-  world.haveAnyCommonSubtypes(null, null);
+  closedWorld.hasAnyUserDefinedGetter(null, null);
+  closedWorld.subclassesOf(null);
+  closedWorld.getClassHierarchyNode(null);
+  closedWorld.getClassSet(null);
+  closedWorld.haveAnyCommonSubtypes(null, null);
   typeGraphInferrer.getCallersOf(null);
   dart_types.Types.sorted(null);
   new dart_types.Types(null).copy(null);
diff --git a/pkg/compiler/lib/src/util/enumset.dart b/pkg/compiler/lib/src/util/enumset.dart
index ab4dcc86..31fef3c 100644
--- a/pkg/compiler/lib/src/util/enumset.dart
+++ b/pkg/compiler/lib/src/util/enumset.dart
@@ -35,9 +35,27 @@
   /// Adds [enumValue] to this set.
   void add(E enumValue);
 
+  /// Adds all enum values in [set] to this set.
+  void addAll(EnumSet<E> set);
+
   /// Removes [enumValue] from this set.
   void remove(E enumValue);
 
+  /// Removes all enum values in [set] from this set. The set of removed values
+  /// is returned.
+  EnumSet<E> removeAll(EnumSet<E> set);
+
+  /// Returns a new set containing all values in both this and the [other] set.
+  EnumSet<E> intersection(EnumSet<E> other) {
+    return new EnumSet.fromValue(value & other.value);
+  }
+
+  /// Returns a new set containing all values in this set that are not in the
+  /// [other] set.
+  EnumSet<E> minus(EnumSet<E> other) {
+    return new EnumSet.fromValue(value & ~other.value);
+  }
+
   /// Clears this set.
   void clear();
 
@@ -67,6 +85,9 @@
   /// Returns `true` if this set is empty.
   bool get isEmpty => value == 0;
 
+  /// Returns `true` if this set is not empty.
+  bool get isNotEmpty => value != 0;
+
   int get hashCode => value.hashCode * 19;
 
   bool operator ==(other) {
@@ -103,16 +124,32 @@
     values.forEach(add);
   }
 
+  @override
   int get value => _value;
 
+  @override
   void add(E enumValue) {
     _value |= 1 << (enumValue as dynamic).index;
   }
 
+  @override
+  void addAll(EnumSet<E> set) {
+    _value |= set.value;
+  }
+
+  @override
   void remove(E enumValue) {
     _value &= ~(1 << (enumValue as dynamic).index);
   }
 
+  @override
+  EnumSet<E> removeAll(EnumSet<E> set) {
+    int removed = _value & set.value;
+    _value &= ~set.value;
+    return new EnumSet<E>.fromValue(removed);
+  }
+
+  @override
   void clear() {
     _value = 0;
   }
@@ -142,6 +179,11 @@
   }
 
   @override
+  void addAll(EnumSet<E> set) {
+    throw new UnsupportedError('EnumSet.addAll');
+  }
+
+  @override
   void clear() {
     throw new UnsupportedError('EnumSet.clear');
   }
@@ -150,6 +192,11 @@
   void remove(E enumValue) {
     throw new UnsupportedError('EnumSet.remove');
   }
+
+  @override
+  EnumSet<E> removeAll(EnumSet<E> set) {
+    throw new UnsupportedError('EnumSet.removeAll');
+  }
 }
 
 class _EnumSetIterable<E> extends IterableBase<E> {
diff --git a/pkg/compiler/lib/src/world.dart b/pkg/compiler/lib/src/world.dart
index c406d07..7f5039d 100644
--- a/pkg/compiler/lib/src/world.dart
+++ b/pkg/compiler/lib/src/world.dart
@@ -4,29 +4,31 @@
 
 library dart2js.world;
 
-import 'cache_strategy.dart';
-import 'closure.dart' show SynthesizedCallMethodElementX;
+import 'closure.dart' show ClosureClassElement, SynthesizedCallMethodElementX;
 import 'common/backend_api.dart' show BackendClasses;
 import 'common.dart';
-import 'core_types.dart' show CoreClasses;
-import 'dart_types.dart';
+import 'constants/constant_system.dart';
+import 'core_types.dart' show CommonElements;
+import 'elements/entities.dart';
 import 'elements/elements.dart'
     show
         ClassElement,
         Element,
+        Entity,
         FunctionElement,
+        MemberElement,
         MixinApplicationElement,
         TypedefElement,
         FieldElement;
+import 'elements/resolution_types.dart';
 import 'js_backend/backend.dart' show JavaScriptBackend;
 import 'ordered_typeset.dart';
 import 'types/masks.dart' show CommonMasks, FlatTypeMask, TypeMask;
 import 'universe/class_set.dart';
-import 'universe/function_set.dart' show FunctionSet;
+import 'universe/function_set.dart' show FunctionSet, FunctionSetBuilder;
 import 'universe/selector.dart' show Selector;
 import 'universe/side_effects.dart' show SideEffects;
-import 'universe/world_builder.dart'
-    show InstantiationInfo, ResolutionWorldBuilder;
+import 'universe/world_builder.dart' show ResolutionWorldBuilder;
 import 'util/util.dart' show Link;
 
 /// Common superinterface for [OpenWorld] and [ClosedWorld].
@@ -44,17 +46,18 @@
   /// Access to core classes used by the backend.
   BackendClasses get backendClasses;
 
-  /// Access to core classes used in the Dart language.
-  CoreClasses get coreClasses;
+  CommonElements get commonElements;
 
   CommonMasks get commonMasks;
 
+  ConstantSystem get constantSystem;
+
   /// Returns `true` if [cls] is either directly or indirectly instantiated.
-  bool isInstantiated(ClassElement cls);
+  bool isInstantiated(ClassEntity cls);
 
   /// Returns `true` if [cls] is directly instantiated. This means that at
   /// runtime instances of exactly [cls] are assumed to exist.
-  bool isDirectlyInstantiated(ClassElement cls);
+  bool isDirectlyInstantiated(ClassEntity cls);
 
   /// Returns `true` if [cls] is abstractly instantiated. This means that at
   /// runtime instances of [cls] or unknown subclasses of [cls] are assumed to
@@ -65,121 +68,142 @@
   /// so [cls] here represents the root of the subclasses. For reflectable
   /// classes we need event abstract classes to be 'live' even though they
   /// cannot themselves be instantiated.
-  bool isAbstractlyInstantiated(ClassElement cls);
+  bool isAbstractlyInstantiated(ClassEntity cls);
 
   /// Returns `true` if [cls] is either directly or abstractly instantiated.
   ///
   /// See [isDirectlyInstantiated] and [isAbstractlyInstantiated].
-  bool isExplicitlyInstantiated(ClassElement cls);
+  bool isExplicitlyInstantiated(ClassEntity cls);
 
   /// Returns `true` if [cls] is indirectly instantiated, that is through a
   /// subclass.
-  bool isIndirectlyInstantiated(ClassElement cls);
+  bool isIndirectlyInstantiated(ClassEntity cls);
 
   /// Returns `true` if [cls] is abstract and thus can only be instantiated
   /// through subclasses.
-  bool isAbstract(ClassElement cls);
+  bool isAbstract(ClassEntity cls);
 
   /// Returns `true` if [cls] is implemented by an instantiated class.
-  bool isImplemented(ClassElement cls);
+  bool isImplemented(ClassEntity cls);
 
   /// Return `true` if [x] is a subclass of [y].
-  bool isSubclassOf(ClassElement x, ClassElement y);
+  bool isSubclassOf(ClassEntity x, ClassEntity y);
 
   /// Returns `true` if [x] is a subtype of [y], that is, if [x] implements an
   /// instance of [y].
-  bool isSubtypeOf(ClassElement x, ClassElement y);
+  bool isSubtypeOf(ClassEntity x, ClassEntity y);
 
   /// Returns an iterable over the live classes that extend [cls] including
   /// [cls] itself.
-  Iterable<ClassElement> subclassesOf(ClassElement cls);
+  Iterable<ClassEntity> subclassesOf(ClassEntity cls);
 
   /// Returns an iterable over the live classes that extend [cls] _not_
   /// including [cls] itself.
-  Iterable<ClassElement> strictSubclassesOf(ClassElement cls);
+  Iterable<ClassEntity> strictSubclassesOf(ClassEntity cls);
 
   /// Returns the number of live classes that extend [cls] _not_
   /// including [cls] itself.
-  int strictSubclassCount(ClassElement cls);
+  int strictSubclassCount(ClassEntity cls);
 
   /// Applies [f] to each live class that extend [cls] _not_ including [cls]
   /// itself.
   void forEachStrictSubclassOf(
-      ClassElement cls, IterationStep f(ClassElement cls));
+      ClassEntity cls, IterationStep f(ClassEntity cls));
 
   /// Returns `true` if [predicate] applies to any live class that extend [cls]
   /// _not_ including [cls] itself.
-  bool anyStrictSubclassOf(ClassElement cls, bool predicate(ClassElement cls));
+  bool anyStrictSubclassOf(ClassEntity cls, bool predicate(ClassEntity cls));
 
   /// Returns an iterable over the directly instantiated that implement [cls]
   /// possibly including [cls] itself, if it is live.
-  Iterable<ClassElement> subtypesOf(ClassElement cls);
+  Iterable<ClassElement> subtypesOf(ClassEntity cls);
 
   /// Returns an iterable over the live classes that implement [cls] _not_
   /// including [cls] if it is live.
-  Iterable<ClassElement> strictSubtypesOf(ClassElement cls);
+  Iterable<ClassElement> strictSubtypesOf(ClassEntity cls);
 
   /// Returns the number of live classes that implement [cls] _not_
   /// including [cls] itself.
-  int strictSubtypeCount(ClassElement cls);
+  int strictSubtypeCount(ClassEntity cls);
 
   /// Applies [f] to each live class that implements [cls] _not_ including [cls]
   /// itself.
   void forEachStrictSubtypeOf(
-      ClassElement cls, IterationStep f(ClassElement cls));
+      ClassEntity cls, IterationStep f(ClassEntity cls));
 
   /// Returns `true` if [predicate] applies to any live class that implements
   /// [cls] _not_ including [cls] itself.
-  bool anyStrictSubtypeOf(ClassElement cls, bool predicate(ClassElement cls));
+  bool anyStrictSubtypeOf(ClassEntity cls, bool predicate(ClassEntity cls));
 
   /// Returns `true` if [a] and [b] have any known common subtypes.
-  bool haveAnyCommonSubtypes(ClassElement a, ClassElement b);
+  bool haveAnyCommonSubtypes(ClassEntity a, ClassEntity b);
 
   /// Returns `true` if any live class other than [cls] extends [cls].
-  bool hasAnyStrictSubclass(ClassElement cls);
+  bool hasAnyStrictSubclass(ClassEntity cls);
 
   /// Returns `true` if any live class other than [cls] implements [cls].
-  bool hasAnyStrictSubtype(ClassElement cls);
+  bool hasAnyStrictSubtype(ClassEntity cls);
 
   /// Returns `true` if all live classes that implement [cls] extend it.
-  bool hasOnlySubclasses(ClassElement cls);
+  bool hasOnlySubclasses(ClassEntity cls);
 
   /// Returns the most specific subclass of [cls] (including [cls]) that is
   /// directly instantiated or a superclass of all directly instantiated
   /// subclasses. If [cls] is not instantiated, `null` is returned.
-  ClassElement getLubOfInstantiatedSubclasses(ClassElement cls);
+  ClassEntity getLubOfInstantiatedSubclasses(ClassEntity cls);
 
   /// Returns the most specific subtype of [cls] (including [cls]) that is
   /// directly instantiated or a superclass of all directly instantiated
   /// subtypes. If no subtypes of [cls] are instantiated, `null` is returned.
-  ClassElement getLubOfInstantiatedSubtypes(ClassElement cls);
+  ClassEntity getLubOfInstantiatedSubtypes(ClassEntity cls);
 
   /// Returns an iterable over the common supertypes of the [classes].
-  Iterable<ClassElement> commonSupertypesOf(Iterable<ClassElement> classes);
+  Iterable<ClassEntity> commonSupertypesOf(Iterable<ClassEntity> classes);
+
+  /// Returns an iterable of the classes that are contained in the
+  /// strict subclass/subtype sets of both [cls1] and [cls2].
+  ///
+  /// Classes that are implied by included superclasses/supertypes are not
+  /// returned.
+  ///
+  /// For instance for this hierarchy
+  ///
+  ///     class A {}
+  ///     class B {}
+  ///     class C implements A, B {}
+  ///     class D extends C {}
+  ///
+  /// the query
+  ///
+  ///     commonSubclasses(A, ClassQuery.SUBTYPE, B, ClassQuery.SUBTYPE)
+  ///
+  /// return the set {C} because [D] is implied by [C].
+  Iterable<ClassEntity> commonSubclasses(ClassElement cls1, ClassQuery query1,
+      ClassElement cls2, ClassQuery query2);
 
   /// Returns an iterable over the live mixin applications that mixin [cls].
-  Iterable<MixinApplicationElement> mixinUsesOf(ClassElement cls);
+  Iterable<ClassEntity> mixinUsesOf(ClassEntity cls);
 
   /// Returns `true` if [cls] is mixed into a live class.
-  bool isUsedAsMixin(ClassElement cls);
+  bool isUsedAsMixin(ClassEntity cls);
 
   /// Returns `true` if any live class that mixes in [cls] implements [type].
   bool hasAnySubclassOfMixinUseThatImplements(
-      ClassElement cls, ClassElement type);
+      ClassEntity cls, ClassEntity type);
 
   /// Returns `true` if any live class that mixes in [mixin] is also a subclass
   /// of [superclass].
-  bool hasAnySubclassThatMixes(ClassElement superclass, ClassElement mixin);
+  bool hasAnySubclassThatMixes(ClassEntity superclass, ClassEntity mixin);
 
   /// Returns `true` if [cls] or any superclass mixes in [mixin].
-  bool isSubclassOfMixinUseOf(ClassElement cls, ClassElement mixin);
+  bool isSubclassOfMixinUseOf(ClassEntity cls, ClassEntity mixin);
 
   /// Returns `true` if every subtype of [x] is a subclass of [y] or a subclass
   /// of a mixin application of [y].
-  bool everySubtypeIsSubclassOfOrMixinUseOf(ClassElement x, ClassElement y);
+  bool everySubtypeIsSubclassOfOrMixinUseOf(ClassEntity x, ClassEntity y);
 
   /// Returns `true` if any subclass of [superclass] implements [type].
-  bool hasAnySubclassThatImplements(ClassElement superclass, ClassElement type);
+  bool hasAnySubclassThatImplements(ClassEntity superclass, ClassEntity type);
 
   /// Returns `true` if a call of [selector] on [cls] and/or subclasses/subtypes
   /// need noSuchMethod handling.
@@ -220,38 +244,38 @@
   ///
   /// If we're calling bar on an object of type A we do need the handler because
   /// we may have to call B.noSuchMethod since B does not implement bar.
-  bool needsNoSuchMethod(ClassElement cls, Selector selector, ClassQuery query);
+  bool needsNoSuchMethod(ClassEntity cls, Selector selector, ClassQuery query);
 
   /// Returns whether [element] will be the one used at runtime when being
   /// invoked on an instance of [cls]. [selector] is used to ensure library
   /// privacy is taken into account.
-  bool hasElementIn(ClassElement cls, Selector selector, Element element);
+  bool hasElementIn(ClassEntity cls, Selector selector, Entity element);
 
   /// Returns [ClassHierarchyNode] for [cls] used to model the class hierarchies
   /// of known classes.
   ///
   /// This method is only provided for testing. For queries on classes, use the
   /// methods defined in [ClosedWorld].
-  ClassHierarchyNode getClassHierarchyNode(ClassElement cls);
+  ClassHierarchyNode getClassHierarchyNode(ClassEntity cls);
 
   /// Returns [ClassSet] for [cls] used to model the extends and implements
   /// relations of known classes.
   ///
   /// This method is only provided for testing. For queries on classes, use the
   /// methods defined in [ClosedWorld].
-  ClassSet getClassSet(ClassElement cls);
+  ClassSet getClassSet(ClassEntity cls);
 
   /// Return the cached mask for [base] with the given flags, or
   /// calls [createMask] to create the mask and cache it.
   // TODO(johnniwinther): Find a better strategy for caching these?
-  TypeMask getCachedMask(ClassElement base, int flags, TypeMask createMask());
+  TypeMask getCachedMask(ClassEntity base, int flags, TypeMask createMask());
 
   /// Returns the [FunctionSet] containing all live functions in the closed
   /// world.
   FunctionSet get allFunctions;
 
   /// Returns `true` if the field [element] is known to be effectively final.
-  bool fieldNeverChanges(Element element);
+  bool fieldNeverChanges(MemberEntity element);
 
   /// Extends the receiver type [mask] for calling [selector] to take live
   /// `noSuchMethod` handlers into account.
@@ -262,12 +286,12 @@
 
   /// Returns the single [Element] that matches a call to [selector] on a
   /// receiver of type [mask]. If multiple targets exist, `null` is returned.
-  Element locateSingleElement(Selector selector, TypeMask mask);
+  MemberEntity locateSingleElement(Selector selector, TypeMask mask);
 
   /// Returns the single field that matches a call to [selector] on a
   /// receiver of type [mask]. If multiple targets exist or the single target
   /// is not a field, `null` is returned.
-  FieldElement locateSingleField(Selector selector, TypeMask mask);
+  FieldEntity locateSingleField(Selector selector, TypeMask mask);
 
   /// Returns the side effects of executing [element].
   SideEffects getSideEffectsOfElement(Element element);
@@ -291,12 +315,15 @@
   /// Returns a string representation of the closed world.
   ///
   /// If [cls] is provided, the dump will contain only classes related to [cls].
-  String dump([ClassElement cls]);
+  String dump([ClassEntity cls]);
 }
 
 /// Interface for computing side effects and uses of elements. This is used
 /// during type inference to compute the [ClosedWorld] for code generation.
 abstract class ClosedWorldRefiner {
+  /// The closed world being refined.
+  ClosedWorld get closedWorld;
+
   /// Registers the side [effects] of executing [element].
   void registerSideEffects(Element element, SideEffects effects);
 
@@ -334,7 +361,7 @@
   /// classes that extend or implement it.
   void registerClass(ClassElement cls);
 
-  void registerUsedElement(Element element);
+  void registerUsedElement(MemberElement element);
   void registerTypedef(TypedefElement typedef);
 
   ClosedWorld closeWorld(DiagnosticReporter reporter);
@@ -343,8 +370,94 @@
   Iterable<MixinApplicationElement> allMixinUsesOf(ClassElement cls);
 }
 
-class WorldImpl implements ClosedWorld, ClosedWorldRefiner, OpenWorld {
-  bool _closed = false;
+/// Enum values defining subset of classes included in queries.
+enum ClassQuery {
+  /// Only the class itself is included.
+  EXACT,
+
+  /// The class and all subclasses (transitively) are included.
+  SUBCLASS,
+
+  /// The class and all classes that implement or subclass it (transitively)
+  /// are included.
+  SUBTYPE,
+}
+
+class ClosedWorldImpl implements ClosedWorld, ClosedWorldRefiner {
+  final JavaScriptBackend _backend;
+  BackendClasses get backendClasses => _backend.backendClasses;
+  FunctionSet _allFunctions;
+
+  final Iterable<TypedefElement> _allTypedefs;
+
+  final Map<ClassElement, Set<MixinApplicationElement>> _mixinUses;
+  Map<ClassElement, List<MixinApplicationElement>> _liveMixinUses;
+
+  final Map<ClassElement, Set<ClassElement>> _typesImplementedBySubclasses;
+
+  // We keep track of subtype and subclass relationships in four
+  // distinct sets to make class hierarchy analysis faster.
+  final Map<ClassElement, ClassHierarchyNode> _classHierarchyNodes;
+  final Map<ClassElement, ClassSet> _classSets;
+
+  final Map<ClassElement, Map<ClassElement, bool>> _subtypeCoveredByCache =
+      <ClassElement, Map<ClassElement, bool>>{};
+
+  final Set<Element> functionsCalledInLoop = new Set<Element>();
+  final Map<Element, SideEffects> sideEffects = new Map<Element, SideEffects>();
+
+  final Set<Element> sideEffectsFreeElements = new Set<Element>();
+
+  final Set<Element> elementsThatCannotThrow = new Set<Element>();
+
+  final Set<Element> functionsThatMightBePassedToApply =
+      new Set<FunctionElement>();
+
+  CommonMasks _commonMasks;
+
+  final CommonElements commonElements;
+
+  final ResolutionWorldBuilder _resolverWorld;
+
+  bool get isClosed => true;
+
+  ClosedWorldImpl(
+      {JavaScriptBackend backend,
+      this.commonElements,
+      ResolutionWorldBuilder resolutionWorldBuilder,
+      FunctionSetBuilder functionSetBuilder,
+      Iterable<TypedefElement> allTypedefs,
+      Map<ClassElement, Set<MixinApplicationElement>> mixinUses,
+      Map<ClassElement, Set<ClassElement>> typesImplementedBySubclasses,
+      Map<ClassElement, ClassHierarchyNode> classHierarchyNodes,
+      Map<ClassElement, ClassSet> classSets})
+      : this._backend = backend,
+        this._resolverWorld = resolutionWorldBuilder,
+        this._allTypedefs = allTypedefs,
+        this._mixinUses = mixinUses,
+        this._typesImplementedBySubclasses = typesImplementedBySubclasses,
+        this._classHierarchyNodes = classHierarchyNodes,
+        this._classSets = classSets {
+    _commonMasks = new CommonMasks(this);
+    _allFunctions = functionSetBuilder.close(this);
+  }
+
+  @override
+  ClosedWorld get closedWorld => this;
+
+  /// Cache of [FlatTypeMask]s grouped by the 8 possible values of the
+  /// `FlatTypeMask.flags` property.
+  final List<Map<ClassElement, TypeMask>> _canonicalizedTypeMasks =
+      new List<Map<ClassElement, TypeMask>>.filled(8, null);
+
+  FunctionSet get allFunctions => _allFunctions;
+
+  CommonMasks get commonMasks {
+    assert(isClosed);
+    return _commonMasks;
+  }
+
+  ConstantSystem get constantSystem => _backend.constantSystem;
 
   TypeMask getCachedMask(ClassElement base, int flags, TypeMask createMask()) {
     Map<ClassElement, TypeMask> cachedMasks =
@@ -352,11 +465,6 @@
     return cachedMasks.putIfAbsent(base, createMask);
   }
 
-  /// Cache of [FlatTypeMask]s grouped by the 8 possible values of the
-  /// `FlatTypeMask.flags` property.
-  final List<Map<ClassElement, TypeMask>> _canonicalizedTypeMasks =
-      new List<Map<ClassElement, TypeMask>>.filled(8, null);
-
   bool checkInvariants(ClassElement cls, {bool mustBeInstantiated: true}) {
     return invariant(cls, cls.isDeclaration,
                 message: '$cls must be the declaration.') &&
@@ -377,10 +485,10 @@
     assert(checkInvariants(x));
     assert(checkInvariants(y, mustBeInstantiated: false));
 
-    if (y == coreClasses.objectClass) return true;
-    if (x == coreClasses.objectClass) return false;
+    if (y == commonElements.objectClass) return true;
+    if (x == commonElements.objectClass) return false;
     if (x.asInstanceOf(y) != null) return true;
-    if (y != coreClasses.functionClass) return false;
+    if (y != commonElements.functionClass) return false;
     return x.callType != null;
   }
 
@@ -390,8 +498,8 @@
     assert(checkInvariants(x));
     assert(checkInvariants(y));
 
-    if (y == coreClasses.objectClass) return true;
-    if (x == coreClasses.objectClass) return false;
+    if (y == commonElements.objectClass) return true;
+    if (x == commonElements.objectClass) return false;
     while (x != null && x.hierarchyDepth >= y.hierarchyDepth) {
       if (x == y) return true;
       x = x.superclass;
@@ -440,7 +548,7 @@
   /// Returns `true` if [cls] is implemented by an instantiated class.
   bool isImplemented(ClassElement cls) {
     assert(isClosed);
-    return resolverWorld.isImplemented(cls);
+    return _resolverWorld.isImplemented(cls);
   }
 
   /// Returns an iterable over the directly instantiated classes that extend
@@ -588,7 +696,7 @@
   bool hasOnlySubclasses(ClassElement cls) {
     assert(isClosed);
     // TODO(johnniwinther): move this to ClassSet?
-    if (cls == coreClasses.objectClass) return true;
+    if (cls == commonElements.objectClass) return true;
     ClassSet classSet = _classSets[cls.declaration];
     if (classSet == null) {
       // Vacuously true.
@@ -644,8 +752,8 @@
 
     List<ClassElement> commonSupertypes = <ClassElement>[];
     OUTER:
-    for (Link<DartType> link = typeSet[depth];
-        link.head.element != coreClasses.objectClass;
+    for (Link<ResolutionDartType> link = typeSet[depth];
+        link.head.element != commonElements.objectClass;
         link = link.tail) {
       ClassElement cls = link.head.element;
       for (Link<OrderedTypeSet> link = otherTypeSets;
@@ -657,14 +765,60 @@
       }
       commonSupertypes.add(cls);
     }
-    commonSupertypes.add(coreClasses.objectClass);
+    commonSupertypes.add(commonElements.objectClass);
     return commonSupertypes;
   }
 
-  /// Returns an iterable over all mixin applications that mixin [cls].
-  Iterable<MixinApplicationElement> allMixinUsesOf(ClassElement cls) {
-    Iterable<MixinApplicationElement> uses = _mixinUses[cls];
-    return uses != null ? uses : const <MixinApplicationElement>[];
+  Iterable<ClassElement> commonSubclasses(ClassElement cls1, ClassQuery query1,
+      ClassElement cls2, ClassQuery query2) {
+    // TODO(johnniwinther): Use [ClassSet] to compute this.
+    // Compute the set of classes that are contained in both class subsets.
+    Set<ClassEntity> common =
+        _commonContainedClasses(cls1, query1, cls2, query2);
+    if (common == null || common.isEmpty) return const <ClassElement>[];
+    // Narrow down the candidates by only looking at common classes
+    // that do not have a superclass or supertype that will be a
+    // better candidate.
+    return common.where((ClassElement each) {
+      bool containsSuperclass = common.contains(each.supertype.element);
+      // If the superclass is also a candidate, then we don't want to
+      // deal with this class. If we're only looking for a subclass we
+      // know we don't have to look at the list of interfaces because
+      // they can never be in the common set.
+      if (containsSuperclass ||
+          query1 == ClassQuery.SUBCLASS ||
+          query2 == ClassQuery.SUBCLASS) {
+        return !containsSuperclass;
+      }
+      // Run through the direct supertypes of the class. If the common
+      // set contains the direct supertype of the class, we ignore the
+      // the class because the supertype is a better candidate.
+      for (Link link = each.interfaces; !link.isEmpty; link = link.tail) {
+        if (common.contains(link.head.element)) return false;
+      }
+      return true;
+    });
+  }
+
+  Set<ClassElement> _commonContainedClasses(ClassElement cls1,
+      ClassQuery query1, ClassElement cls2, ClassQuery query2) {
+    Iterable<ClassElement> xSubset = _containedSubset(cls1, query1);
+    if (xSubset == null) return null;
+    Iterable<ClassElement> ySubset = _containedSubset(cls2, query2);
+    if (ySubset == null) return null;
+    return xSubset.toSet().intersection(ySubset.toSet());
+  }
+
+  Iterable<ClassElement> _containedSubset(ClassElement cls, ClassQuery query) {
+    switch (query) {
+      case ClassQuery.EXACT:
+        return null;
+      case ClassQuery.SUBCLASS:
+        return strictSubclassesOf(cls);
+      case ClassQuery.SUBTYPE:
+        return strictSubtypesOf(cls);
+    }
+    throw new ArgumentError('Unexpected query: $query.');
   }
 
   /// Returns an iterable over the live mixin applications that mixin [cls].
@@ -751,7 +905,9 @@
   bool hasAnySubclassThatImplements(
       ClassElement superclass, ClassElement type) {
     assert(isClosed);
-    Set<ClassElement> subclasses = typesImplementedBySubclassesOf(superclass);
+
+    Set<ClassElement> subclasses =
+        _typesImplementedBySubclasses[superclass.declaration];
     if (subclasses == null) return false;
     return subclasses.contains(type);
   }
@@ -827,7 +983,7 @@
     ClassSet classSet = getClassSet(base);
     ClassHierarchyNode node = classSet.node;
     if (query == ClassQuery.EXACT) {
-      return node.isDirectlyInstantiated && !hasConcreteMatch(base, selector);
+      return node.isExplicitlyInstantiated && !hasConcreteMatch(base, selector);
     } else if (query == ClassQuery.SUBCLASS) {
       return subclassesNeedNoSuchMethod(node);
     } else {
@@ -839,90 +995,6 @@
     }
   }
 
-  final JavaScriptBackend _backend;
-  BackendClasses get backendClasses => _backend.backendClasses;
-  FunctionSet _allFunctions;
-  final Set<Element> functionsCalledInLoop = new Set<Element>();
-  final Map<Element, SideEffects> sideEffects = new Map<Element, SideEffects>();
-
-  final Set<TypedefElement> _allTypedefs = new Set<TypedefElement>();
-
-  final Map<ClassElement, Set<MixinApplicationElement>> _mixinUses =
-      new Map<ClassElement, Set<MixinApplicationElement>>();
-  Map<ClassElement, List<MixinApplicationElement>> _liveMixinUses;
-
-  final Map<ClassElement, Set<ClassElement>> _typesImplementedBySubclasses =
-      new Map<ClassElement, Set<ClassElement>>();
-
-  // We keep track of subtype and subclass relationships in four
-  // distinct sets to make class hierarchy analysis faster.
-  final Map<ClassElement, ClassHierarchyNode> _classHierarchyNodes =
-      <ClassElement, ClassHierarchyNode>{};
-  final Map<ClassElement, ClassSet> _classSets = <ClassElement, ClassSet>{};
-
-  final Map<ClassElement, Map<ClassElement, bool>> _subtypeCoveredByCache =
-      <ClassElement, Map<ClassElement, bool>>{};
-
-  final Set<Element> sideEffectsFreeElements = new Set<Element>();
-
-  final Set<Element> elementsThatCannotThrow = new Set<Element>();
-
-  final Set<Element> functionsThatMightBePassedToApply =
-      new Set<FunctionElement>();
-
-  final Set<Element> alreadyPopulated;
-
-  CommonMasks _commonMasks;
-
-  final CoreClasses coreClasses;
-
-  final CacheStrategy cacheStrategy;
-
-  final ResolutionWorldBuilder resolverWorld;
-
-  bool get isClosed => _closed;
-
-  Set<ClassElement> typesImplementedBySubclassesOf(ClassElement cls) {
-    return _typesImplementedBySubclasses[cls.declaration];
-  }
-
-  WorldImpl(this.resolverWorld, this._backend, this.coreClasses,
-      CacheStrategy cacheStrategy)
-      : this.cacheStrategy = cacheStrategy,
-        alreadyPopulated = cacheStrategy.newSet() {
-    _allFunctions = new FunctionSet(this);
-  }
-
-  FunctionSet get allFunctions => _allFunctions;
-
-  CommonMasks get commonMasks {
-    assert(isClosed);
-    return _commonMasks;
-  }
-
-  /// Called to add [cls] to the set of known classes.
-  ///
-  /// This ensures that class hierarchy queries can be performed on [cls] and
-  /// classes that extend or implement it.
-  void registerClass(ClassElement cls) => _registerClass(cls);
-
-  void registerClosureClass(ClassElement cls) {
-    _registerClass(cls, isDirectlyInstantiated: true);
-  }
-
-  void _registerClass(ClassElement cls, {bool isDirectlyInstantiated: false}) {
-    _ensureClassSet(cls);
-    if (isDirectlyInstantiated) {
-      _updateClassHierarchyNodeForClass(cls, directlyInstantiated: true);
-    }
-  }
-
-  void registerTypedef(TypedefElement typdef) {
-    _allTypedefs.add(typdef);
-  }
-
-  Iterable<TypedefElement> get allTypedefs => _allTypedefs;
-
   /// Returns [ClassHierarchyNode] for [cls] used to model the class hierarchies
   /// of known classes.
   ///
@@ -932,17 +1004,6 @@
     return _classHierarchyNodes[cls.declaration];
   }
 
-  ClassHierarchyNode _ensureClassHierarchyNode(ClassElement cls) {
-    cls = cls.declaration;
-    return _classHierarchyNodes.putIfAbsent(cls, () {
-      ClassHierarchyNode parentNode;
-      if (cls.superclass != null) {
-        parentNode = _ensureClassHierarchyNode(cls.superclass);
-      }
-      return new ClassHierarchyNode(parentNode, cls);
-    });
-  }
-
   /// Returns [ClassSet] for [cls] used to model the extends and implements
   /// relations of known classes.
   ///
@@ -952,38 +1013,26 @@
     return _classSets[cls.declaration];
   }
 
-  ClassSet _ensureClassSet(ClassElement cls) {
-    cls = cls.declaration;
-    return _classSets.putIfAbsent(cls, () {
-      ClassHierarchyNode node = _ensureClassHierarchyNode(cls);
-      ClassSet classSet = new ClassSet(node);
-
-      for (InterfaceType type in cls.allSupertypes) {
-        // TODO(johnniwinther): Optimization: Avoid adding [cls] to
-        // superclasses.
-        ClassSet subtypeSet = _ensureClassSet(type.element);
-        subtypeSet.addSubtype(node);
-      }
-      if (cls.isMixinApplication) {
-        // TODO(johnniwinther): Store this in the [ClassSet].
-        MixinApplicationElement mixinApplication = cls;
-        if (mixinApplication.mixin != null) {
-          // If [mixinApplication] is malformed [mixin] is `null`.
-          registerMixinUse(mixinApplication, mixinApplication.mixin);
-        }
-      }
-
-      return classSet;
-    });
+  void registerClosureClass(ClosureClassElement cls) {
+    ClassHierarchyNode parentNode = getClassHierarchyNode(cls.superclass);
+    ClassHierarchyNode node =
+        _classHierarchyNodes[cls] = new ClassHierarchyNode(parentNode, cls);
+    for (ResolutionInterfaceType type in cls.allSupertypes) {
+      ClassSet subtypeSet = getClassSet(type.element);
+      subtypeSet.addSubtype(node);
+    }
+    _classSets[cls] = new ClassSet(node);
+    _updateSuperClassHierarchyNodeForClass(node);
+    node.isDirectlyInstantiated = true;
   }
 
   void _updateSuperClassHierarchyNodeForClass(ClassHierarchyNode node) {
     // Ensure that classes implicitly implementing `Function` are in its
     // subtype set.
     ClassElement cls = node.cls;
-    if (cls != coreClasses.functionClass &&
-        cls.implementsFunction(coreClasses)) {
-      ClassSet subtypeSet = _ensureClassSet(coreClasses.functionClass);
+    if (cls != commonElements.functionClass &&
+        cls.implementsFunction(commonElements)) {
+      ClassSet subtypeSet = getClassSet(commonElements.functionClass);
       subtypeSet.addSubtype(node);
     }
     if (!node.isInstantiated && node.parentNode != null) {
@@ -991,62 +1040,7 @@
     }
   }
 
-  void _updateClassHierarchyNodeForClass(ClassElement cls,
-      {bool directlyInstantiated: false, bool abstractlyInstantiated: false}) {
-    ClassHierarchyNode node = _ensureClassHierarchyNode(cls);
-    _updateSuperClassHierarchyNodeForClass(node);
-    if (directlyInstantiated) {
-      node.isDirectlyInstantiated = true;
-    }
-    if (abstractlyInstantiated) {
-      node.isAbstractlyInstantiated = true;
-    }
-  }
-
-  ClosedWorld closeWorld(DiagnosticReporter reporter) {
-    /// Updates the `isDirectlyInstantiated` and `isIndirectlyInstantiated`
-    /// properties of the [ClassHierarchyNode] for [cls].
-
-    void addSubtypes(ClassElement cls, InstantiationInfo info) {
-      if (!info.hasInstantiation) {
-        return;
-      }
-      if (cacheStrategy.hasIncrementalSupport && !alreadyPopulated.add(cls)) {
-        return;
-      }
-      assert(cls.isDeclaration);
-      if (!cls.isResolved) {
-        reporter.internalError(cls, 'Class "${cls.name}" is not resolved.');
-      }
-
-      _updateClassHierarchyNodeForClass(cls,
-          directlyInstantiated: info.isDirectlyInstantiated,
-          abstractlyInstantiated: info.isAbstractlyInstantiated);
-
-      // Walk through the superclasses, and record the types
-      // implemented by that type on the superclasses.
-      ClassElement superclass = cls.superclass;
-      while (superclass != null) {
-        Set<Element> typesImplementedBySubclassesOfCls =
-            _typesImplementedBySubclasses.putIfAbsent(
-                superclass, () => new Set<ClassElement>());
-        for (DartType current in cls.allSupertypes) {
-          typesImplementedBySubclassesOfCls.add(current.element);
-        }
-        superclass = superclass.superclass;
-      }
-    }
-
-    // Use the [:seenClasses:] set to include non-instantiated
-    // classes: if the superclass of these classes require RTI, then
-    // they also need RTI, so that a constructor passes the type
-    // variables to the super constructor.
-    resolverWorld.forEachInstantiatedClass(addSubtypes);
-
-    _closed = true;
-    _commonMasks = new CommonMasks(this);
-    return this;
-  }
+  Iterable<TypedefElement> get allTypedefs => _allTypedefs;
 
   @override
   String dump([ClassElement cls]) {
@@ -1056,37 +1050,21 @@
     } else {
       sb.write("Instantiated classes in the closed world:\n");
     }
-    getClassHierarchyNode(coreClasses.objectClass)
+    getClassHierarchyNode(commonElements.objectClass)
         .printOn(sb, ' ', instantiatedOnly: cls == null, withRespectTo: cls);
     return sb.toString();
   }
 
-  void registerMixinUse(
-      MixinApplicationElement mixinApplication, ClassElement mixin) {
-    // TODO(johnniwinther): Add map restricted to live classes.
-    // We don't support patch classes as mixin.
-    assert(mixin.isDeclaration);
-    Set<MixinApplicationElement> users =
-        _mixinUses.putIfAbsent(mixin, () => new Set<MixinApplicationElement>());
-    users.add(mixinApplication);
-  }
-
   bool hasAnyUserDefinedGetter(Selector selector, TypeMask mask) {
     return allFunctions.filter(selector, mask).any((each) => each.isGetter);
   }
 
-  void registerUsedElement(Element element) {
-    if (element.isInstanceMember && !element.isAbstract) {
-      allFunctions.add(element);
-    }
-  }
-
   FieldElement locateSingleField(Selector selector, TypeMask mask) {
     Element result = locateSingleElement(selector, mask);
     return (result != null && result.isField) ? result : null;
   }
 
-  Element locateSingleElement(Selector selector, TypeMask mask) {
+  MemberElement locateSingleElement(Selector selector, TypeMask mask) {
     assert(isClosed);
     mask ??= commonMasks.dynamicType;
     return mask.locateSingleElement(selector, this);
@@ -1110,7 +1088,7 @@
     return functionsCalledInLoop.contains(element.declaration);
   }
 
-  bool fieldNeverChanges(Element element) {
+  bool fieldNeverChanges(MemberElement element) {
     if (!element.isField) return false;
     if (_backend.isNative(element)) {
       // Some native fields are views of data that may be changed by operations.
@@ -1124,8 +1102,8 @@
       return true;
     }
     if (element.isInstanceMember) {
-      return !resolverWorld.hasInvokedSetter(element, this) &&
-          !resolverWorld.fieldSetters.contains(element);
+      return !_resolverWorld.hasInvokedSetter(element) &&
+          !_resolverWorld.fieldSetters.contains(element);
     }
     return false;
   }
@@ -1163,7 +1141,7 @@
     // We're not tracking side effects of closures.
     if (selector.isClosureCall) return new SideEffects();
     SideEffects sideEffects = new SideEffects.empty();
-    for (Element e in allFunctions.filter(selector, mask)) {
+    for (MemberElement e in allFunctions.filter(selector, mask)) {
       if (e.isField) {
         if (selector.isGetter) {
           if (!fieldNeverChanges(e)) {
@@ -1213,16 +1191,3 @@
     return getMightBePassedToApply(element);
   }
 }
-
-/// Enum values defining subset of classes included in queries.
-enum ClassQuery {
-  /// Only the class itself is included.
-  EXACT,
-
-  /// The class and all subclasses (transitively) are included.
-  SUBCLASS,
-
-  /// The class and all classes that implement or subclass it (transitively)
-  /// are included.
-  SUBTYPE,
-}
diff --git a/pkg/compiler/pubspec.yaml b/pkg/compiler/pubspec.yaml
index 07f759a..e0f3df7d 100644
--- a/pkg/compiler/pubspec.yaml
+++ b/pkg/compiler/pubspec.yaml
@@ -15,7 +15,8 @@
     path: ../../pkg/kernel
   sdk_library_metadata:
     path: ../../sdk/lib/_internal/sdk_library_metadata
-  dart2js_info: ^0.3.0
+  dart2js_info:
+    path: ../../third_party/pkg/dart2js_info
   lookup_map:
     path: ../lookup_map
 
diff --git a/pkg/compiler/tool/perf.dart b/pkg/compiler/tool/perf.dart
index 4725014..194c392 100644
--- a/pkg/compiler/tool/perf.dart
+++ b/pkg/compiler/tool/perf.dart
@@ -33,7 +33,7 @@
 import 'package:package_config/src/util.dart' show checkValidPackageUri;
 
 /// Cumulative total number of chars scanned.
-int scanTotalChars = 0;
+int inputSize = 0;
 
 /// Cumulative time spent scanning.
 Stopwatch scanTimer = new Stopwatch();
@@ -47,32 +47,17 @@
     print('usage: perf.dart <bench-id> <entry.dart>');
     exit(1);
   }
-  var totalTimer = new Stopwatch()..start();
-
   var bench = args[0];
   var entryUri = Uri.base.resolve(args[1]);
 
   await setup(entryUri);
 
+  Set<SourceFile> files = await scanReachableFiles(entryUri);
   var handlers = {
-    'scan': () async {
-      Set<SourceFile> files = await scanReachableFiles(entryUri);
-      // TODO(sigmund): replace the warmup with instrumented snapshots.
-      for (int i = 0; i < 10; i++) scanFiles(files);
-    },
-    'parse': () async {
-      Set<SourceFile> files = await scanReachableFiles(entryUri);
-      // TODO(sigmund): replace the warmup with instrumented snapshots.
-      for (int i = 0; i < 10; i++) parseFiles(files);
-    },
+    'scan': () async => scanFiles(files),
+    'parse': () async => parseFiles(files),
     'kernel_gen_e2e': () async {
-      // TODO(sigmund): remove. This is used to compute the input size, we
-      // should extract input size from frontend instead.
-      await scanReachableFiles(entryUri);
-      // TODO(sigmund): replace this warmup. Note that for very large programs,
-      // the GC pressure on the VM seems to make this worse with time (maybe we
-      // are leaking memory?). That's why we run it twice and not 10 times.
-      for (int i = 0; i < 2; i++) await generateKernel(entryUri);
+      await generateKernel(entryUri);
     },
   };
 
@@ -80,12 +65,19 @@
   if (handler == null) {
     // TODO(sigmund): implement the remaining benchmarks.
     print('unsupported bench-id: $bench. Please specify one of the following: '
-        '${handler.keys.join(", ")}');
+        '${handlers.keys.join(", ")}');
     exit(1);
   }
-  await handler();
-  totalTimer.stop();
-  report("total", totalTimer.elapsedMicroseconds);
+
+  // TODO(sigmund): replace the warmup with instrumented snapshots.
+  int iterations = bench.contains('kernel_gen') ? 2 : 10;
+  for (int i = 0; i < iterations; i++) {
+    var totalTimer = new Stopwatch()..start();
+    print('== iteration $i');
+    await handler();
+    totalTimer.stop();
+    report('total', totalTimer.elapsedMicroseconds);
+  }
 }
 
 Future setup(Uri entryUri) async {
@@ -100,71 +92,56 @@
 Future<Set<SourceFile>> scanReachableFiles(Uri entryUri) async {
   var files = new Set<SourceFile>();
   var loadTimer = new Stopwatch()..start();
+  scanTimer = new Stopwatch();
   var entrypoints = [
     entryUri,
-    Uri.parse("dart:async"),
-    Uri.parse("dart:collection"),
-    Uri.parse("dart:convert"),
-    Uri.parse("dart:core"),
-    Uri.parse("dart:developer"),
-    Uri.parse("dart:_internal"),
-    Uri.parse("dart:io"),
-    Uri.parse("dart:isolate"),
-    Uri.parse("dart:math"),
-    Uri.parse("dart:mirrors"),
-    Uri.parse("dart:typed_data"),
+    Uri.parse('dart:async'),
+    Uri.parse('dart:collection'),
+    Uri.parse('dart:convert'),
+    Uri.parse('dart:core'),
+    Uri.parse('dart:developer'),
+    Uri.parse('dart:_internal'),
+    Uri.parse('dart:io'),
+    Uri.parse('dart:isolate'),
+    Uri.parse('dart:math'),
+    Uri.parse('dart:mirrors'),
+    Uri.parse('dart:typed_data'),
   ];
   for (var entry in entrypoints) {
     await collectSources(await loader.loadFile(entry), files);
   }
   loadTimer.stop();
 
-  print('input size: ${scanTotalChars} chars');
+  inputSize = 0;
+  for (var source in files) inputSize += source.length;
+  print('input size: ${inputSize} chars');
   var loadTime = loadTimer.elapsedMicroseconds - scanTimer.elapsedMicroseconds;
-  report("load", loadTime);
-  report("scan", scanTimer.elapsedMicroseconds);
+  report('load', loadTime);
+  report('scan', scanTimer.elapsedMicroseconds);
   return files;
 }
 
 /// Scans every file in [files] and reports the time spent doing so.
 void scanFiles(Set<SourceFile> files) {
-  // The code below will record again how many chars are scanned and how long it
-  // takes to scan them, even though we already did so in [scanReachableFiles].
-  // Recording and reporting this twice is unnecessary, but we do so for now to
-  // validate that the results are consistent.
   scanTimer = new Stopwatch();
-  var old = scanTotalChars;
-  scanTotalChars = 0;
   for (var source in files) {
     tokenize(source);
   }
-
-  // Report size and scanning time again. See discussion above.
-  if (old != scanTotalChars) print('input size changed? ${old} chars');
-  report("scan", scanTimer.elapsedMicroseconds);
+  report('scan', scanTimer.elapsedMicroseconds);
 }
 
 /// Parses every file in [files] and reports the time spent doing so.
 void parseFiles(Set<SourceFile> files) {
-  // The code below will record again how many chars are scanned and how long it
-  // takes to scan them, even though we already did so in [scanReachableFiles].
-  // Recording and reporting this twice is unnecessary, but we do so for now to
-  // validate that the results are consistent.
   scanTimer = new Stopwatch();
-  var old = scanTotalChars;
-  scanTotalChars = 0;
   var parseTimer = new Stopwatch()..start();
   for (var source in files) {
     parseFull(source);
   }
   parseTimer.stop();
 
-  // Report size and scanning time again. See discussion above.
-  if (old != scanTotalChars) print('input size changed? ${old} chars');
-  report("scan", scanTimer.elapsedMicroseconds);
-
+  report('scan', scanTimer.elapsedMicroseconds);
   report(
-      "parse", parseTimer.elapsedMicroseconds - scanTimer.elapsedMicroseconds);
+      'parse', parseTimer.elapsedMicroseconds - scanTimer.elapsedMicroseconds);
 }
 
 /// Add to [files] all sources reachable from [start].
@@ -198,18 +175,19 @@
 /// Scan [source] and return the first token produced by the scanner.
 Token tokenize(SourceFile source) {
   scanTimer.start();
-  scanTotalChars += source.length;
   var token = new Scanner(source).tokenize();
   scanTimer.stop();
   return token;
 }
 
 /// Report that metric [name] took [time] micro-seconds to process
-/// [scanTotalChars] characters.
+/// [inputSize] characters.
 void report(String name, int time) {
   var sb = new StringBuffer();
-  sb.write('$name: $time us, ${time ~/ 1000} ms');
-  sb.write(', ${scanTotalChars * 1000 ~/ time} chars/ms');
+  var padding = ' ' * (20 - name.length);
+  sb.write('$name:$padding $time us, ${time ~/ 1000} ms');
+  var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2);
+  sb.write(', $invSpeed ns/char');
   print('$sb');
 }
 
@@ -246,7 +224,7 @@
 }
 
 Uri _libraryRoot = Platform.script.resolve('../../../sdk/');
-Uri _platformConfigUri = _libraryRoot.resolve("lib/dart_server.platform");
+Uri _platformConfigUri = _libraryRoot.resolve('lib/dart_server.platform');
 
 class FakeReporter extends DiagnosticReporter {
   final hasReportedError = false;
@@ -282,9 +260,15 @@
   }
 }
 
-class FakeReporterOptions {
+class FakeReporterOptions implements DiagnosticOptions {
   bool get suppressHints => false;
   bool get hidePackageWarnings => false;
+
+  bool get fatalWarnings => false;
+  bool get terseDiagnostics => false;
+  bool get suppressWarnings => false;
+  bool get showAllPackageWarnings => true;
+  bool showPackageWarningsFor(Uri uri) => true;
 }
 
 class _Loader {
@@ -333,6 +317,10 @@
 }
 
 generateKernel(Uri entryUri) async {
+  // TODO(sigmund): this is here only to compute the input size,
+  // we should extract the input size from the frontend instead.
+  scanReachableFiles(entryUri);
+
   var timer = new Stopwatch()..start();
   var options = new CompilerOptions(
       entryPoint: entryUri,
@@ -347,7 +335,7 @@
   var compiler = new MyCompiler(inputProvider, diagnosticHandler, options);
   await compiler.run(entryUri);
   timer.stop();
-  report("kernel_gen_e2e", timer.elapsedMicroseconds);
+  report('kernel_gen_e2e', timer.elapsedMicroseconds);
 }
 
 // We subclass compiler to skip phases and stop after creating kernel.
@@ -358,7 +346,7 @@
 
   /// Performs the compilation when all libraries have been loaded.
   void compileLoadedLibraries() =>
-      selfTask.measureSubtask("KernelCompiler.compileLoadedLibraries", () {
+      selfTask.measureSubtask('KernelCompiler.compileLoadedLibraries', () {
         WorldImpact mainImpact = computeMain();
         mirrorUsageAnalyzerTask.analyzeUsage(mainApp);
 
@@ -377,8 +365,8 @@
         });
 
         if (deferredLoadTask.isProgramSplit) {
-          enqueuer.resolution.applyImpact(
-              backend.computeDeferredLoadingImpact());
+          enqueuer.resolution
+              .applyImpact(backend.computeDeferredLoadingImpact());
         }
         enqueuer.resolution.applyImpact(backend.computeHelpersImpact());
         resolveLibraryMetadata();
@@ -391,7 +379,7 @@
 
         if (compilationFailed) {
           // TODO(sigmund): more diagnostics?
-          print("compilation failed!");
+          print('compilation failed!');
           exit(1);
         }
 
diff --git a/pkg/compiler/tool/perf_test.dart b/pkg/compiler/tool/perf_test.dart
index 20b6478..d4afa17 100644
--- a/pkg/compiler/tool/perf_test.dart
+++ b/pkg/compiler/tool/perf_test.dart
@@ -8,4 +8,4 @@
 
 import 'perf.dart' as m;
 
-main() => print('done ${m.scanTotalChars}');
+main() => print('done ${m.inputSize}');
diff --git a/pkg/dart2js_incremental/lib/caching_compiler.dart b/pkg/dart2js_incremental/lib/caching_compiler.dart
index 8bf1c64..4b530c8 100644
--- a/pkg/dart2js_incremental/lib/caching_compiler.dart
+++ b/pkg/dart2js_incremental/lib/caching_compiler.dart
@@ -68,23 +68,13 @@
             environment: environment));
     backend = compiler.backend;
 
-    full.Emitter emitter = backend.emitter.emitter;
-
-    // Much like a scout, an incremental compiler is always prepared. For
-    // mixins, classes, and lazy statics, at least.
-    emitter
-        ..needsClassSupport = true
-        ..needsMixinSupport = true
-        ..needsLazyInitializer = true
-        ..needsStructuredMemberInfo = true;
-
     Uri core = Uri.parse("dart:core");
 
     return compiler.setupSdk().then((_) {
       return compiler.libraryLoader.loadLibrary(core).then((_) {
         // Likewise, always be prepared for runtimeType support.
         // TODO(johnniwinther): Add global switch to force RTI.
-        compiler.resolverWorld.hasRuntimeTypeSupport = true;
+        compiler.resolutionWorldBuilder.hasRuntimeTypeSupport = true;
         compiler.enqueuer.resolution.applyImpact(backend.registerRuntimeType());
         return compiler;
       });
diff --git a/pkg/dev_compiler/USAGE.md b/pkg/dev_compiler/USAGE.md
index 9a3de65..dcdce9a 100644
--- a/pkg/dev_compiler/USAGE.md
+++ b/pkg/dev_compiler/USAGE.md
@@ -1,81 +1,84 @@
 # Usage
 
-The [Dart Dev Compiler](README.md) (DDC) is an **experimental**
-development compiler from Dart to EcmaScript 6.  It is
-still incomplete, under heavy development, and not yet ready for
-production use.
+The [Dart Dev Compiler](README.md) (DDC) is an **experimental** development
+compiler from Dart to EcmaScript 6. It is still incomplete, under heavy
+development, and not yet ready for production use.
 
 With those caveats, we welcome feedback for those experimenting.
 
-The easiest way to compile and run DDC generated code for now is via NodeJS.  The following instructions are in a state of flux - please expect them to change.  If you find issues, please let us know.
+The easiest way to compile and run DDC generated code for now is via NodeJS.
+The following instructions are in a state of flux -- please expect them to
+change. If you find issues, please let us know.
 
-(1) Clone the [DDC repository](https://github.com/dart-lang/dev_compiler) and set the environment variable DDC_PATH to your checkout.
+1.  Clone the [DDC repository](https://github.com/dart-lang/sdk) and
+    set the environment variable `DDC_PATH` to the `pkg/dev_compiler`
+    subdirectory within wherever you check that out.
 
-(2) Install nodejs v6.0 or later and add it to your path.  It can be installed from:
+2.  Install nodejs v6.0 or later and add it to your path. It can be installed
+    from:
 
-https://nodejs.org/
+    https://nodejs.org/
 
-Note, v6 or later is required for harmony / ES6 support.
+    Note, v6 or later is required for harmony / ES6 support.
 
-(3) Create a node compatible version of the dart_sdk:
+3.  Define a node path (you can add other directories if you want to separate
+    things out):
 
-```
-dart $DDC_PATH/tool/build_sdk.dart --dart-sdk $DDC_PATH/gen/patched_sdk/ --modules node -o dart_sdk.js
-```
+    ```sh
+    export NODE_PATH=$DDC_PATH/lib/js/common:.
+    ```
 
-You can ignore any errors or warnings for now.
+4.  Compile a test file with a `main` entry point:
 
-(4) Define a node path (you can add other directories if you want to separate things out):
+    ```sh
+    dart $DDC_PATH/bin/dartdevc.dart --modules node -o hello.js hello.dart
+    ```
 
-```
-export NODE_PATH=.
-```
+    Note, the `hello.js` built here is not fully linked. It loads the SDK via a `require` call.
 
-(5) Compile a test file with a `main` entry point:
+5.  Run it via your node built in step 1:
 
-```
-dart  $DDC_PATH/bin/dartdevc.dart --modules node -o hello.js hello.dart
-```
+    ```sh
+    node -e 'require("hello").hello.main()'
+    ```
 
-Note, the `hello.js` built here is not fully linked.  It loads the SDK via a `require` call.
+6.  Compile multiple libraries using summaries. E.g., write a `world.dart` that
+    imports `hello.dart` with it's own `main`. Step 5 above generated a summary
+    (`hello.sum`) for `hello.dart`. Build world:
 
-(6) Run it via your node built in step 1:
+    ```sh
+    dart $DDC_PATH/bin/dartdevc.dart --modules node -s hello.sum -o world.js world.dart
+    ```
 
-```
-node -e 'require("hello").hello.main()'
-```
+    Run world just like hello above:
 
-(7) Compile multiple libraries using summaries.  E.g., write a `world.dart` that imports `hello.dart` with it's own `main`.  Step 5 above generated a summary (`hello.sum`) for `hello.dart`.  Build world:
+    ```sh
+    node -e 'require("world").world.main()'
+    ```
 
-```
-dart $DDC_PATH/bin/dartdevc.dart --modules node -s hello.sum -o world.js world.dart
-```
+7.  Node modules do not run directly on the browser or v8. You can use a tool
+    like `browserify` to build a linked javascript file that can:
 
-Run world just like hello above:
+    Install:
 
-```
-node -e 'require("world").world.main()'
-```
+    ```sh
+    sudo npm install -g browserify
+    ```
 
-(8) Node modules do not run directly on the browser or v8.  You can use a tool like `browserify` to build a linked javascript file that can:
+    and run, e.g.,:
 
-Install:
-```
-sudo npm install -g browserify
-```
+    ```sh
+    echo 'require("world").world.main()' | browserify -d - > world.dart.js
+    ```
 
-and run, e.g.,:
-```
-echo 'require("world").world.main()' | browserify -d - > world.dart.js
-```
-
-The produced `world.dart.js` fully links all dependencies (`dart_sdk`, `hello`, and `world`) and executes `world.main`.  It can be loaded via script tag and run in Chrome (stable or later).
+    The produced `world.dart.js` fully links all dependencies (`dart_sdk`,
+    `hello`, and `world`) and executes `world.main`.  It can be loaded via
+    script tag and run in Chrome (stable or later).
 
 ## Feedback
 
-Please file issues in our [GitHub issue tracker](https://github.com/dart-lang/sdk/issues).
+Please file issues in our [GitHub issue
+tracker](https://github.com/dart-lang/sdk/issues).
 
-You can also view or join our [mailing list](https://groups.google.com/a/dartlang.org/forum/#!forum/dev-compiler).
-
-
-
+You can also view or join our [mailing
+list](https://groups.google.com/a/dartlang.org/forum/#!forum/dev-compiler).
diff --git a/pkg/dev_compiler/bin/dartdevc.dart b/pkg/dev_compiler/bin/dartdevc.dart
index e6ca6a7..4a0ccbe 100755
--- a/pkg/dev_compiler/bin/dartdevc.dart
+++ b/pkg/dev_compiler/bin/dartdevc.dart
@@ -37,13 +37,15 @@
 
 import 'dart:async';
 import 'dart:io';
+import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/src/command_line/arguments.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine;
 import 'package:bazel_worker/bazel_worker.dart';
 import 'package:dev_compiler/src/compiler/command.dart';
 
 Future main(List<String> args) async {
   // Always returns a new modifiable list.
-  args = _preprocessArgs(args);
+  args = preprocessArgs(PhysicalResourceProvider.INSTANCE, args);
 
   if (args.contains('--persistent_worker')) {
     new _CompilerWorker(args..remove('--persistent_worker')).run();
@@ -71,19 +73,3 @@
       ..output = output.toString();
   }
 }
-
-/// Always returns a new modifiable list.
-///
-/// If the final arg is `@file_path` then read in all the lines of that file
-/// and add those as args.
-///
-/// Bazel actions that support workers must provide all their per-WorkRequest
-/// arguments in a file like this instead of as normal args.
-List<String> _preprocessArgs(List<String> args) {
-  args = new List.from(args);
-  if (args.isNotEmpty && args.last.startsWith('@')) {
-    var fileArg = args.removeLast();
-    args.addAll(new File(fileArg.substring(1)).readAsLinesSync());
-  }
-  return args;
-}
diff --git a/pkg/dev_compiler/doc/GENERIC_METHODS.md b/pkg/dev_compiler/doc/GENERIC_METHODS.md
index 7c21f94..a61748c 100644
--- a/pkg/dev_compiler/doc/GENERIC_METHODS.md
+++ b/pkg/dev_compiler/doc/GENERIC_METHODS.md
@@ -1,229 +1,188 @@
-# Prototype Syntax for Generic Methods
+# Using Generic Methods
 
-Generic methods are a [proposed addition to the Dart language](https://github.com/leafpetersen/dep-generic-methods/blob/master/proposal.md).
+**Note: For historical reasons, this feature is called "generic methods", but it
+applies equally well to instance methods, static methods, top-level functions,
+local functions, and even lambda expressions.**
 
-This is a summary of the current (as of January 2016) comment-based generic
-method syntax supported by the analyzer strong mode and the Dart Dev Compiler.
-The comment-based syntax essentially uses the proposed actual generic method
-syntax, but wraps it in comments.  This allows developers to experiment with
-generic methods while still ensuring that their code runs on all platforms while
-generic methods are still being evaluated for inclusion into the language.
+Initially a [proposal][], generic methods are on their way to being fully
+supported in Dart. Here is how to use them.
 
-## Declaring generic method parameters
+[proposal]: https://github.com/leafpetersen/dep-generic-methods/blob/master/proposal.md
 
-Generic method parameters are listed using a block comment after the method or
-function name, inside of angle brackets.
+When they were still being prototyped, an [older comment-based syntax was
+designed][old] so that the static analysis could be implemented and tested
+before the VM and compilers needed to worry about the syntax. Now that real
+syntax is allowed everywhere, this doc has been updated.
+
+[old]: GENERIC_METHOD_COMMENTS.md
+
+## Declaring generic methods
+
+Type parameters for generic methods are listed after the method or function
+name, inside angle brackets:
 
 ```dart
-// This declares a function which takes two unused generic method parameters
-int f/*<S, T>*/(int x) => 3;
+/// Takes two type parameters, [K] and [V].
+Map<K, V> singletonMap<K, V>(K key, V value) {
+  return <K, V>{ key, value };
+}
 ```
 
-As with classes, you can put bounds on type parameters.
+As with classes, you can put bounds on type parameters:
 
 ```dart
-// This declares a function which takes two unused generic method parameters
-// The first parameter (S) must extend num
-// The second parameter (T) must extend List<S>
-int f/*<S extends num, T extends List<S>>*/(int x) => 3;
+/// Takes a list of two numbers of some num-derived type [T].
+T sumPair<T extends num>(List<T> items) {
+  return items[0] + items[1];
+}
 ```
 
 Class methods (instance and static) can be declared to take generic parameters
-in the same way.
+in the same way:
 
 ```dart
 class C {
-  static int f/*<S, T>*/(int x) => 3;
-  int m/*<S, T>*/(int x) => 3;
+  static int f<S, T>(int x) => 3;
+  int m<S, T>(int x) => 3;
 }
 ```
 
-Function typed parameters, local functions, and function expressions can also be
-declared to take generic parameters.
+This even works for function-typed parameters, local functions, and function
+expressions:
 
 ```dart
-// foo takes a generic method as a parameter
-void foo(int f/*<S>*/(int x)) {}
+/// Takes a generic method as a parameter [callback].
+void functionTypedParameter(T callback<T>(T thing)) {}
 
-// foo declares a local generic function
-void foo() {
-  int f/*<S>*/(int x) => 3;
-  return;
+// Declares a local generic function `itself`.
+void localFunction() {
+  T itself<T>(T thing) => thing;
 }
 
-// foo binds a generic function expression to a local variable.
-void foo() {
-  var x = /*<S>*/(int x) => x;
+// Binds a generic function expression to a local variable.
+void functionExpression() {
+  var lambda = <T>(T thing) => thing;
 }
 ```
 
-We do not currently support a way to declare a function as returning a generic
-function.  This will eventually be supported using something analogous to Dart
-typedefs.
+We do not currently support a way to declare a function as *returning* a generic
+function. This will eventually be supported using a `typedef`.
 
-## Using generic method parameters
+## Using generic method type parameters
 
-The previous examples declared generic method parameters, but did not use them.
-You can use a generic method parameter `T` anywhere that a type is expected in
-Dart by writing a type followed by `/*=T*/`.  So for example, `dynamic /*=T*/`
-will be interpreted as `dynamic` by all non-strong mode tools, but will be
-interpreted as `T` by strong mode.  In places where it is valid to leave off a
-type, simply writing `/*=T*/` will be interpreted as `dynamic` by non-strong
-mode tools, but will be interpreted as `T` by strong mode.  For example:
+You've seen some examples already, but you can use a generic type parameter
+almost anywhere you would expect in a generic method.
+
+* Inside the method's parameter list:
+
+    ```dart
+    takeThing<T>(T thing) { ... }
+    //           ^-- Here.
+    ```
+
+* Inside type annotations in the body of the method:
+
+    ```dart
+    useThing<T>() {
+      T thing = getThing();
+    //^-- Here.
+      List<T> pair = [thing, thing];
+      //   ^-- And here.
+    }
+    ```
+
+* In the return type of the method:
+
+    ```dart
+      T itself<T>(T thing) => thing;
+    //^-- Here.
+    ```
+
+* As type arguments in generic classes and method calls:
+
+    ```dart
+    useThing<T>(T thing) {
+      var pair = <T>[thing, thing];
+      //          ^-- Here.
+      var set = new Set<T>()..add(thing);
+      //                ^-- And here.
+    }
+    ```
+
+    Note that generic methods are not yet supported *at runtime* on the VM and
+    dartjs. On those platforms, uses of generic method type arguments are
+    treated like `dynamic` today. So in this example, `pair`'s reified type at
+    runtime will be `List<dynamic>` and `set` will be `Set<dynamic>`.
+
+There are two places you *cannot* use a generic method type parameter. Both are
+because the VM and dart2js don't support reifying generic method type arguments
+yet. Since these expressions wouldn't do what you want, we've temporarily
+defined them to be an error:
+
+* As the right-hand side of an `is` or `is!` expression.
+
+    ```dart
+    testType<T>(object) {
+      print(object is T);
+      //              ^-- Error!
+      print(object is! T);
+      //               ^-- Error!
+    }
+    ```
+
+* As a type literal:
+
+    ```dart
+    printType<T>() {
+      Type t = T;
+      //       ^-- Error!
+      print(t);
+    }
+    ```
+
+Once we have full runtime support for generic methods, these will be allowed.
+
+## Calling generic methods
+
+Most of the time, when you call a generic method, you can leave off the type
+arguments and strong mode's type inference will fill them in for you
+automatically. For example:
 
 ```dart
-// foo is a generic method which takes a single generic method parameter S.
-// In strong mode, the parameter x will have type S, and the return type will
-// be S
-// In normal mode, the parameter x will have type dynamic, and the return
-// type will be dynamic.
-dynamic/*=S*/ foo/*<S>*/(dynamic/*=S*/ x) { return x; }
+var fruits = ["apple", "banana", "cherry"];
+var lengths = fruits.map((fruit) => fruit.length);
 ```
 
-This can be written more concisely by leaving off the `dynamic`.
+The `map()` method on Iterable is now generic and takes a type parameter for the
+element type of the returned sequence:
 
 ```dart
-/*=S*/ foo/*<S>*/(/*=S*/ x) {return x;}
-```
+class Iterable<T> {
+  Iterable<S> map<S>(S transform(T element)) { ... }
 
-You can also put a type to the left of the `/*=T/`. This type will be used
-for all non-strong mode tools. For example:
-
-```dart
-// This method works with `int`, `double`, or `num`. The return type will
-// match the type of the parameters.
-num/*=T*/ pickAtRandom/*<T extends num>*/(num/*=T*/ x, num/*=T*/ y) { ... }
-```
-
-
-Note that the generic parameter is in scope in the return type of the function,
-in the argument list of the function, and in the body of the function.  When
-declaring local variables and parameters, you can also use the `/*=T*/` syntax with `var`.
-
-```dart
-// foo is a generic method that takes a single generic parameter S, and a value
-// x of type S
-void foo/*<S>*/(var /*=S*/ x) {
-  // In strong mode, y will also have type S
-  var /*=S*/ y = x;
-
-  // In strong mode, z will also have type S
-  dynamic /*=S*/ z = y;
+  // Other stuff...
 }
 ```
 
-Anywhere that a type literal is expected, you can also use the `/*=T*/` syntax to
-produce a type literal from the generic method parameter.
+In this example, the type checker:
+
+1. Infers `List<String>` for the type of `fruits` based on the elements in the
+   list literal.
+2. That lets it infer `String` for the type of the lambda parameter `fruit`
+   passed to `map()`.
+3. Then, from the result of calling `.length`, it infers the return type of the
+   lambda to be `int`.
+4. That in turn is used to fill in the type argument to the call to `map()` as
+   `int`, and the resulting sequence is an `Iterable<int>`.
+
+If inference *isn't* able to fill in a type argument for you, it uses `dynamic`
+instead. If that isn't what you want, or it infers a type you don't want, you
+can always pass them explicitly:
 
 ```dart
-void foo/*<S>*/(/*=S*/ x) {
-  // In strong mode, s will get the type literal for S
-  Type s = dynamic /*=S*/;
+// Explicitly give a type so that we don't infer "int".
+var lengths = fruits.map<num>((fruit) => fruit.length).toList();
 
-  // In strong mode, this attempts to cast 3 as type S
-  var y = (3 as dynamic /*=S*/);
-}
-```
-
-You can use the `/*=T*/` syntax to replace any type with a generic type
-parameter, but you will usually want to replace `dynamic`. Otherwise, since the
-original type is used at runtime, it may cause checked mode errors:
-
-```dart
-List/*<T>*/ makeList/*<T extends num>*/() {
-  return new List<num /*=T*/>();
-}
-
-void main() {
-  List<int> list = makeList/*<int>*/(); // <-- Fails here.
-}
-```
-
-This program checks without error in strong mode but fails at runtime in checked
-mode since the list that gets created is a `List<num>`. A better choice is:
-
-```dart
-List/*<T>*/ makeList/*<T extends num>*/() {
-  return new List/*<T>*/();
-}
-
-void main() {
-  List<int> list = makeList/*<int>*/();
-}
-```
-
-## Instantiating generic classes with generic method parameters
-
-You can use generic method parameters to instantiate generic classes using the
-same `/*=T*/` syntax.
-
-```dart
-// foo is a generic method which returns a List<S> in strong mode,
-// but which returns List<dynamic> in normal mode.
-List<dynamic /*=S*/> foo/*<S>*/(/*=S*/ x) {
-   // l0 is a list literal whose reified type will be List<S> in strong mode,
-   // and List<dynamic> in normal mode.
-   var l0 = <dynamic /*=S*/>[x];
-
-   // as above, but with a regular constructor.
-   var l1 = new List<dynamic /*=S*/>();
-   return l1;
-}
-```
-
-In most cases, the entire type argument list to the generic class can be
-enclosed in parentheses, eliminating the need for explicitly writing `dynamic`.
-
-```dart
-// This is another way of writing the same code as above
-List/*<S>*/ foo/*<S>*/(/*=S*/ x) {
-   // The shorthand syntax is not yet supported for list and map literals
-   var l0 = <dynamic /*=S*/>[x];
-
-   // but with regular constructors you can use it
-   var l1 = new List/*<S>*/();
-   return l1;
-}
-```
-
-## Instantiating generic methods
-
-Generic methods can be called without passing type arguments.  Strong mode will
-attempt to infer the type arguments automatically.  If it is unable to do so,
-then the type arguments will be filled in with whatever their declared bounds
-are (by default, `dynamic`).
-
-```dart
-class C {
-  /*=S*/ inferableFromArgument/*<S>*/(/*=S*/ x) { return null;}
-  /*=S*/ notInferable/*<S>*/(int x) { return null;}
-}
-
-void main() {
-  C c = new C();
-  // This line will produce a type error, because strong mode will infer
-  // `int` as the generic argument to fill in for S
-  String x = c.inferableFromArgument(3);
-
-  // This line will not produce a type error, because strong mode is unable
-  // to infer a type and will fill in the type argument with `dynamic`.
-  String y = c.notInferable(3);
-}
-```
-
-In the case that strong mode cannot infer the generic type arguments, the same
-syntax that was shown above for instantiating generic classes can be used to
-instantiate generic methods explicitly.
-
-```dart
-void main() {
-  C c = new C();
-  // This line will produce a type error, because strong mode will infer
-  // `int` as the generic argument to fill in for S
-  String x = c.inferableFromArgument(3);
-
-  // This line will produce a type error in strong mode, because `int` is
-  // explicitly passed in as the argument to use for S
-  String y = c.notInferable/*<int>*/(3);
-}
+// So that we can later add doubles to the result.
+lengths.add(1.2);
 ```
diff --git a/pkg/dev_compiler/doc/GENERIC_METHOD_COMMENTS.md b/pkg/dev_compiler/doc/GENERIC_METHOD_COMMENTS.md
new file mode 100644
index 0000000..9050eab
--- /dev/null
+++ b/pkg/dev_compiler/doc/GENERIC_METHOD_COMMENTS.md
@@ -0,0 +1,237 @@
+# Prototype Syntax for Generic Methods
+
+**Note:** This documents the deprecated comment-based syntax for generic
+methods. New code should use the [much better real syntax][real]. This document
+is preserved in case you run into existing code still using the old syntax.
+
+[real]: GENERIC_METHODS.md
+
+---
+
+Generic methods are a [proposed addition to the Dart language](https://github.com/leafpetersen/dep-generic-methods/blob/master/proposal.md).
+
+This is a summary of the current (as of January 2016) comment-based generic
+method syntax supported by the analyzer strong mode and the Dart Dev Compiler.
+The comment-based syntax essentially uses the proposed actual generic method
+syntax, but wraps it in comments.  This allows developers to experiment with
+generic methods while still ensuring that their code runs on all platforms while
+generic methods are still being evaluated for inclusion into the language.
+
+## Declaring generic method parameters
+
+Generic method parameters are listed using a block comment after the method or
+function name, inside of angle brackets.
+
+```dart
+// This declares a function which takes two unused generic method parameters
+int f/*<S, T>*/(int x) => 3;
+```
+
+As with classes, you can put bounds on type parameters.
+
+```dart
+// This declares a function which takes two unused generic method parameters
+// The first parameter (S) must extend num
+// The second parameter (T) must extend List<S>
+int f/*<S extends num, T extends List<S>>*/(int x) => 3;
+```
+
+Class methods (instance and static) can be declared to take generic parameters
+in the same way.
+
+```dart
+class C {
+  static int f/*<S, T>*/(int x) => 3;
+  int m/*<S, T>*/(int x) => 3;
+}
+```
+
+Function typed parameters, local functions, and function expressions can also be
+declared to take generic parameters.
+
+```dart
+// foo takes a generic method as a parameter
+void foo(int f/*<S>*/(int x)) {}
+
+// foo declares a local generic function
+void foo() {
+  int f/*<S>*/(int x) => 3;
+  return;
+}
+
+// foo binds a generic function expression to a local variable.
+void foo() {
+  var x = /*<S>*/(int x) => x;
+}
+```
+
+We do not currently support a way to declare a function as returning a generic
+function.  This will eventually be supported using something analogous to Dart
+typedefs.
+
+## Using generic method parameters
+
+The previous examples declared generic method parameters, but did not use them.
+You can use a generic method parameter `T` anywhere that a type is expected in
+Dart by writing a type followed by `/*=T*/`.  So for example, `dynamic /*=T*/`
+will be interpreted as `dynamic` by all non-strong mode tools, but will be
+interpreted as `T` by strong mode.  In places where it is valid to leave off a
+type, simply writing `/*=T*/` will be interpreted as `dynamic` by non-strong
+mode tools, but will be interpreted as `T` by strong mode.  For example:
+
+```dart
+// foo is a generic method which takes a single generic method parameter S.
+// In strong mode, the parameter x will have type S, and the return type will
+// be S
+// In normal mode, the parameter x will have type dynamic, and the return
+// type will be dynamic.
+dynamic/*=S*/ foo/*<S>*/(dynamic/*=S*/ x) { return x; }
+```
+
+This can be written more concisely by leaving off the `dynamic`.
+
+```dart
+/*=S*/ foo/*<S>*/(/*=S*/ x) {return x;}
+```
+
+You can also put a type to the left of the `/*=T/`. This type will be used
+for all non-strong mode tools. For example:
+
+```dart
+// This method works with `int`, `double`, or `num`. The return type will
+// match the type of the parameters.
+num/*=T*/ pickAtRandom/*<T extends num>*/(num/*=T*/ x, num/*=T*/ y) { ... }
+```
+
+
+Note that the generic parameter is in scope in the return type of the function,
+in the argument list of the function, and in the body of the function.  When
+declaring local variables and parameters, you can also use the `/*=T*/` syntax with `var`.
+
+```dart
+// foo is a generic method that takes a single generic parameter S, and a value
+// x of type S
+void foo/*<S>*/(var /*=S*/ x) {
+  // In strong mode, y will also have type S
+  var /*=S*/ y = x;
+
+  // In strong mode, z will also have type S
+  dynamic /*=S*/ z = y;
+}
+```
+
+Anywhere that a type literal is expected, you can also use the `/*=T*/` syntax to
+produce a type literal from the generic method parameter.
+
+```dart
+void foo/*<S>*/(/*=S*/ x) {
+  // In strong mode, s will get the type literal for S
+  Type s = dynamic /*=S*/;
+
+  // In strong mode, this attempts to cast 3 as type S
+  var y = (3 as dynamic /*=S*/);
+}
+```
+
+You can use the `/*=T*/` syntax to replace any type with a generic type
+parameter, but you will usually want to replace `dynamic`. Otherwise, since the
+original type is used at runtime, it may cause checked mode errors:
+
+```dart
+List/*<T>*/ makeList/*<T extends num>*/() {
+  return new List<num /*=T*/>();
+}
+
+void main() {
+  List<int> list = makeList/*<int>*/(); // <-- Fails here.
+}
+```
+
+This program checks without error in strong mode but fails at runtime in checked
+mode since the list that gets created is a `List<num>`. A better choice is:
+
+```dart
+List/*<T>*/ makeList/*<T extends num>*/() {
+  return new List/*<T>*/();
+}
+
+void main() {
+  List<int> list = makeList/*<int>*/();
+}
+```
+
+## Instantiating generic classes with generic method parameters
+
+You can use generic method parameters to instantiate generic classes using the
+same `/*=T*/` syntax.
+
+```dart
+// foo is a generic method which returns a List<S> in strong mode,
+// but which returns List<dynamic> in normal mode.
+List<dynamic /*=S*/> foo/*<S>*/(/*=S*/ x) {
+   // l0 is a list literal whose reified type will be List<S> in strong mode,
+   // and List<dynamic> in normal mode.
+   var l0 = <dynamic /*=S*/>[x];
+
+   // as above, but with a regular constructor.
+   var l1 = new List<dynamic /*=S*/>();
+   return l1;
+}
+```
+
+In most cases, the entire type argument list to the generic class can be
+enclosed in parentheses, eliminating the need for explicitly writing `dynamic`.
+
+```dart
+// This is another way of writing the same code as above
+List/*<S>*/ foo/*<S>*/(/*=S*/ x) {
+   // The shorthand syntax is not yet supported for list and map literals
+   var l0 = <dynamic /*=S*/>[x];
+
+   // but with regular constructors you can use it
+   var l1 = new List/*<S>*/();
+   return l1;
+}
+```
+
+## Instantiating generic methods
+
+Generic methods can be called without passing type arguments.  Strong mode will
+attempt to infer the type arguments automatically.  If it is unable to do so,
+then the type arguments will be filled in with whatever their declared bounds
+are (by default, `dynamic`).
+
+```dart
+class C {
+  /*=S*/ inferableFromArgument/*<S>*/(/*=S*/ x) { return null;}
+  /*=S*/ notInferable/*<S>*/(int x) { return null;}
+}
+
+void main() {
+  C c = new C();
+  // This line will produce a type error, because strong mode will infer
+  // `int` as the generic argument to fill in for S
+  String x = c.inferableFromArgument(3);
+
+  // This line will not produce a type error, because strong mode is unable
+  // to infer a type and will fill in the type argument with `dynamic`.
+  String y = c.notInferable(3);
+}
+```
+
+In the case that strong mode cannot infer the generic type arguments, the same
+syntax that was shown above for instantiating generic classes can be used to
+instantiate generic methods explicitly.
+
+```dart
+void main() {
+  C c = new C();
+  // This line will produce a type error, because strong mode will infer
+  // `int` as the generic argument to fill in for S
+  String x = c.inferableFromArgument(3);
+
+  // This line will produce a type error in strong mode, because `int` is
+  // explicitly passed in as the argument to use for S
+  String y = c.notInferable/*<int>*/(3);
+}
+```
diff --git a/pkg/dev_compiler/lib/js/amd/dart_sdk.js b/pkg/dev_compiler/lib/js/amd/dart_sdk.js
index abb592c..152b38d 100644
--- a/pkg/dev_compiler/lib/js/amd/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/amd/dart_sdk.js
@@ -18,6 +18,7 @@
   const convert = Object.create(null);
   const core = Object.create(null);
   const developer = Object.create(null);
+  const io = Object.create(null);
   const isolate = Object.create(null);
   const js = Object.create(null);
   const js_util = Object.create(null);
@@ -166,6 +167,8 @@
   let _AsyncBroadcastStreamController = () => (_AsyncBroadcastStreamController = dart.constFn(async._AsyncBroadcastStreamController$()))();
   let _AsBroadcastStreamController = () => (_AsBroadcastStreamController = dart.constFn(async._AsBroadcastStreamController$()))();
   let _DoneSubscription = () => (_DoneSubscription = dart.constFn(async._DoneSubscription$()))();
+  let FutureOr = () => (FutureOr = dart.constFn(async.FutureOr$()))();
+  let dynamicToFutureOr = () => (dynamicToFutureOr = dart.constFn(dart.functionType(async.FutureOr, [dart.dynamic])))();
   let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart.dynamic, [])))();
   let Future = () => (Future = dart.constFn(async.Future$()))();
   let Completer = () => (Completer = dart.constFn(async.Completer$()))();
@@ -383,6 +386,103 @@
   let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
   let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
   let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
+  let ListOfListOfint = () => (ListOfListOfint = dart.constFn(core.List$(ListOfint())))();
+  let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
+  let FutureOfDirectory = () => (FutureOfDirectory = dart.constFn(async.Future$(io.Directory)))();
+  let FutureOrOfDirectory = () => (FutureOrOfDirectory = dart.constFn(async.FutureOr$(io.Directory)))();
+  let StreamOfFileSystemEntity = () => (StreamOfFileSystemEntity = dart.constFn(async.Stream$(io.FileSystemEntity)))();
+  let JSArrayOfFileSystemEntity = () => (JSArrayOfFileSystemEntity = dart.constFn(_interceptors.JSArray$(io.FileSystemEntity)))();
+  let FutureOrOfString = () => (FutureOrOfString = dart.constFn(async.FutureOr$(core.String)))();
+  let FutureOrOfbool = () => (FutureOrOfbool = dart.constFn(async.FutureOr$(core.bool)))();
+  let FutureOrOfint = () => (FutureOrOfint = dart.constFn(async.FutureOr$(core.int)))();
+  let ListOfFileSystemEntity = () => (ListOfFileSystemEntity = dart.constFn(core.List$(io.FileSystemEntity)))();
+  let StreamControllerOfListOfint = () => (StreamControllerOfListOfint = dart.constFn(async.StreamController$(ListOfint())))();
+  let FutureOfRandomAccessFile = () => (FutureOfRandomAccessFile = dart.constFn(async.Future$(io.RandomAccessFile)))();
+  let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(io.File)))();
+  let FutureOfListOfint = () => (FutureOfListOfint = dart.constFn(async.Future$(ListOfint())))();
+  let FutureOrOfFile = () => (FutureOrOfFile = dart.constFn(async.FutureOr$(io.File)))();
+  let FutureOfFile = () => (FutureOfFile = dart.constFn(async.Future$(io.File)))();
+  let FutureOrOfListOfint = () => (FutureOrOfListOfint = dart.constFn(async.FutureOr$(ListOfint())))();
+  let ListOfFileSystemEntityType = () => (ListOfFileSystemEntityType = dart.constFn(core.List$(io.FileSystemEntityType)))();
+  let StreamOfHttpRequest = () => (StreamOfHttpRequest = dart.constFn(async.Stream$(io.HttpRequest)))();
+  let ListOfRedirectInfo = () => (ListOfRedirectInfo = dart.constFn(core.List$(io.RedirectInfo)))();
+  let HashMapOfString$ListOfString = () => (HashMapOfString$ListOfString = dart.constFn(collection.HashMap$(core.String, ListOfString())))();
+  let ListOfCookie = () => (ListOfCookie = dart.constFn(core.List$(io.Cookie)))();
+  let StringAndListOfStringTovoid = () => (StringAndListOfStringTovoid = dart.constFn(dart.functionType(dart.void, [core.String, ListOfString()])))();
+  let FutureOfHttpClientResponse = () => (FutureOfHttpClientResponse = dart.constFn(async.Future$(io.HttpClientResponse)))();
+  let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
+  let FutureOrOfHttpClientResponse = () => (FutureOrOfHttpClientResponse = dart.constFn(async.FutureOr$(io.HttpClientResponse)))();
+  let _StreamSinkImpl = () => (_StreamSinkImpl = dart.constFn(io._StreamSinkImpl$()))();
+  let StreamConsumerOfListOfint = () => (StreamConsumerOfListOfint = dart.constFn(async.StreamConsumer$(ListOfint())))();
+  let _HttpOutboundMessage = () => (_HttpOutboundMessage = dart.constFn(io._HttpOutboundMessage$()))();
+  let CompleterOfHttpClientResponse = () => (CompleterOfHttpClientResponse = dart.constFn(async.Completer$(io.HttpClientResponse)))();
+  let JSArrayOfRedirectInfo = () => (JSArrayOfRedirectInfo = dart.constFn(_interceptors.JSArray$(io.RedirectInfo)))();
+  let JSArrayOfFuture = () => (JSArrayOfFuture = dart.constFn(_interceptors.JSArray$(async.Future)))();
+  let CompleterOf_HttpIncoming = () => (CompleterOf_HttpIncoming = dart.constFn(async.Completer$(io._HttpIncoming)))();
+  let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
+  let FutureOfSecureSocket = () => (FutureOfSecureSocket = dart.constFn(async.Future$(io.SecureSocket)))();
+  let HashSetOf_HttpClientConnection = () => (HashSetOf_HttpClientConnection = dart.constFn(collection.HashSet$(io._HttpClientConnection)))();
+  let FutureOf_ConnectionInfo = () => (FutureOf_ConnectionInfo = dart.constFn(async.Future$(io._ConnectionInfo)))();
+  let FutureOrOf_ConnectionInfo = () => (FutureOrOf_ConnectionInfo = dart.constFn(async.FutureOr$(io._ConnectionInfo)))();
+  let SetOf_HttpClientConnection = () => (SetOf_HttpClientConnection = dart.constFn(core.Set$(io._HttpClientConnection)))();
+  let HashMapOfString$_ConnectionTarget = () => (HashMapOfString$_ConnectionTarget = dart.constFn(collection.HashMap$(core.String, io._ConnectionTarget)))();
+  let JSArrayOf_Credentials = () => (JSArrayOf_Credentials = dart.constFn(_interceptors.JSArray$(io._Credentials)))();
+  let JSArrayOf_ProxyCredentials = () => (JSArrayOf_ProxyCredentials = dart.constFn(_interceptors.JSArray$(io._ProxyCredentials)))();
+  let FutureOf_HttpClientRequest = () => (FutureOf_HttpClientRequest = dart.constFn(async.Future$(io._HttpClientRequest)))();
+  let FutureOrOf_HttpClientRequest = () => (FutureOrOf_HttpClientRequest = dart.constFn(async.FutureOr$(io._HttpClientRequest)))();
+  let X509CertificateAndStringAndintTobool = () => (X509CertificateAndStringAndintTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate, core.String, core.int])))();
+  let FutureOfbool = () => (FutureOfbool = dart.constFn(async.Future$(core.bool)))();
+  let UriAndStringAndStringToFutureOfbool = () => (UriAndStringAndStringToFutureOfbool = dart.constFn(dart.functionType(FutureOfbool(), [core.Uri, core.String, core.String])))();
+  let StringAndintAndString__ToFutureOfbool = () => (StringAndintAndString__ToFutureOfbool = dart.constFn(dart.functionType(FutureOfbool(), [core.String, core.int, core.String, core.String])))();
+  let UriToString = () => (UriToString = dart.constFn(dart.functionType(core.String, [core.Uri])))();
+  let MapOfString$_ConnectionTarget = () => (MapOfString$_ConnectionTarget = dart.constFn(core.Map$(core.String, io._ConnectionTarget)))();
+  let ListOf_Credentials = () => (ListOf_Credentials = dart.constFn(core.List$(io._Credentials)))();
+  let ListOf_ProxyCredentials = () => (ListOf_ProxyCredentials = dart.constFn(core.List$(io._ProxyCredentials)))();
+  let MapOfint$_HttpConnection = () => (MapOfint$_HttpConnection = dart.constFn(core.Map$(core.int, io._HttpConnection)))();
+  let HashMapOfint$_HttpConnection = () => (HashMapOfint$_HttpConnection = dart.constFn(collection.HashMap$(core.int, io._HttpConnection)))();
+  let LinkedListOf_HttpConnection = () => (LinkedListOf_HttpConnection = dart.constFn(collection.LinkedList$(io._HttpConnection)))();
+  let StreamControllerOfHttpRequest = () => (StreamControllerOfHttpRequest = dart.constFn(async.StreamController$(io.HttpRequest)))();
+  let HttpRequestTovoid = () => (HttpRequestTovoid = dart.constFn(dart.functionType(dart.void, [io.HttpRequest])))();
+  let MapOfint$_HttpServer = () => (MapOfint$_HttpServer = dart.constFn(core.Map$(core.int, io._HttpServer)))();
+  let ListOf_Proxy = () => (ListOf_Proxy = dart.constFn(core.List$(io._Proxy)))();
+  let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
+  let ListOfbool = () => (ListOfbool = dart.constFn(core.List$(core.bool)))();
+  let StreamOfint = () => (StreamOfint = dart.constFn(async.Stream$(core.int)))();
+  let StreamControllerOf_HttpIncoming = () => (StreamControllerOf_HttpIncoming = dart.constFn(async.StreamController$(io._HttpIncoming)))();
+  let _HttpIncomingTovoid = () => (_HttpIncomingTovoid = dart.constFn(dart.functionType(dart.void, [io._HttpIncoming])))();
+  let MapOfString$_HttpSession = () => (MapOfString$_HttpSession = dart.constFn(core.Map$(core.String, io._HttpSession)))();
+  let ListOfMapOfString$String = () => (ListOfMapOfString$String = dart.constFn(core.List$(MapOfString$String())))();
+  let FutureOfServiceExtensionResponse = () => (FutureOfServiceExtensionResponse = dart.constFn(async.Future$(developer.ServiceExtensionResponse)))();
+  let MapOfint$_FileResourceInfo = () => (MapOfint$_FileResourceInfo = dart.constFn(core.Map$(core.int, io._FileResourceInfo)))();
+  let MapOfint$_ProcessResourceInfo = () => (MapOfint$_ProcessResourceInfo = dart.constFn(core.Map$(core.int, io._ProcessResourceInfo)))();
+  let MapOfint$_SocketResourceInfo = () => (MapOfint$_SocketResourceInfo = dart.constFn(core.Map$(core.int, io._SocketResourceInfo)))();
+  let StreamSinkOfListOfint = () => (StreamSinkOfListOfint = dart.constFn(async.StreamSink$(ListOfint())))();
+  let FutureOfLink = () => (FutureOfLink = dart.constFn(async.Future$(io.Link)))();
+  let _CaseInsensitiveStringMap = () => (_CaseInsensitiveStringMap = dart.constFn(io._CaseInsensitiveStringMap$()))();
+  let FutureOfRawSecureSocket = () => (FutureOfRawSecureSocket = dart.constFn(async.Future$(io.RawSecureSocket)))();
+  let SecureSocketTovoid = () => (SecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.SecureSocket])))();
+  let StreamControllerOfRawSecureSocket = () => (StreamControllerOfRawSecureSocket = dart.constFn(async.StreamController$(io.RawSecureSocket)))();
+  let RawSecureSocketTovoid = () => (RawSecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSecureSocket])))();
+  let StreamSubscriptionOfRawSocket = () => (StreamSubscriptionOfRawSocket = dart.constFn(async.StreamSubscription$(io.RawSocket)))();
+  let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
+  let CompleterOf_RawSecureSocket = () => (CompleterOf_RawSecureSocket = dart.constFn(async.Completer$(io._RawSecureSocket)))();
+  let StreamControllerOfRawSocketEvent = () => (StreamControllerOfRawSocketEvent = dart.constFn(async.StreamController$(io.RawSocketEvent)))();
+  let RawSocketEventTovoid = () => (RawSocketEventTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSocketEvent])))();
+  let StreamOfRawSocketEvent = () => (StreamOfRawSocketEvent = dart.constFn(async.Stream$(io.RawSocketEvent)))();
+  let X509CertificateTodynamic = () => (X509CertificateTodynamic = dart.constFn(dart.functionType(dart.dynamic, [io.X509Certificate])))();
+  let intToListOfint = () => (intToListOfint = dart.constFn(dart.functionType(ListOfint(), [core.int])))();
+  let StreamOfRawSocket = () => (StreamOfRawSocket = dart.constFn(async.Stream$(io.RawSocket)))();
+  let StreamOfSocket = () => (StreamOfSocket = dart.constFn(async.Stream$(io.Socket)))();
+  let StreamTransformerOfHttpRequest$WebSocket = () => (StreamTransformerOfHttpRequest$WebSocket = dart.constFn(async.StreamTransformer$(io.HttpRequest, io.WebSocket)))();
+  let ListOfStringTodynamic = () => (ListOfStringTodynamic = dart.constFn(dart.functionType(dart.dynamic, [ListOfString()])))();
+  let StreamTransformerOfListOfint$dynamic = () => (StreamTransformerOfListOfint$dynamic = dart.constFn(async.StreamTransformer$(ListOfint(), dart.dynamic)))();
+  let EventSinkOfUint8List = () => (EventSinkOfUint8List = dart.constFn(async.EventSink$(typed_data.Uint8List)))();
+  let StreamControllerOfWebSocket = () => (StreamControllerOfWebSocket = dart.constFn(async.StreamController$(io.WebSocket)))();
+  let FutureOfWebSocket = () => (FutureOfWebSocket = dart.constFn(async.Future$(io.WebSocket)))();
+  let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
+  let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+  let StreamTransformerOfdynamic$ListOfint = () => (StreamTransformerOfdynamic$ListOfint = dart.constFn(async.StreamTransformer$(dart.dynamic, ListOfint())))();
+  let MapOfint$_WebSocketImpl = () => (MapOfint$_WebSocketImpl = dart.constFn(core.Map$(core.int, io._WebSocketImpl)))();
   let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
   let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
   let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@@ -399,7 +499,6 @@
   let FutureOfIdbFactory = () => (FutureOfIdbFactory = dart.constFn(async.Future$(indexed_db.IdbFactory)))();
   let FutureOfListOfString = () => (FutureOfListOfString = dart.constFn(async.Future$(ListOfString())))();
   let EventTovoid = () => (EventTovoid = dart.constFn(dart.functionType(dart.void, [html$.Event])))();
-  let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
   let CompleterOfDatabase = () => (CompleterOfDatabase = dart.constFn(async.Completer$(indexed_db.Database)))();
   let ListOfEventTarget = () => (ListOfEventTarget = dart.constFn(core.List$(html$.EventTarget)))();
   let RectangleOfint = () => (RectangleOfint = dart.constFn(math.Rectangle$(core.int)))();
@@ -433,8 +532,8 @@
   let CompleterOfString = () => (CompleterOfString = dart.constFn(async.Completer$(core.String)))();
   let CompleterOfMetadata = () => (CompleterOfMetadata = dart.constFn(async.Completer$(html$.Metadata)))();
   let CompleterOfListOfEntry = () => (CompleterOfListOfEntry = dart.constFn(async.Completer$(ListOfEntry())))();
-  let ListOfStyleSheet = () => (ListOfStyleSheet = dart.constFn(core.List$(html$.StyleSheet)))();
   let EventStreamProviderOfSecurityPolicyViolationEvent = () => (EventStreamProviderOfSecurityPolicyViolationEvent = dart.constFn(html$.EventStreamProvider$(html$.SecurityPolicyViolationEvent)))();
+  let ListOfStyleSheet = () => (ListOfStyleSheet = dart.constFn(core.List$(html$.StyleSheet)))();
   let ImmutableListMixin = () => (ImmutableListMixin = dart.constFn(html$.ImmutableListMixin$()))();
   let ElementAndElementToint = () => (ElementAndElementToint = dart.constFn(dart.functionType(core.int, [html$.Element, html$.Element])))();
   let ElementTobool = () => (ElementTobool = dart.constFn(dart.functionType(core.bool, [html$.Element])))();
@@ -443,13 +542,14 @@
   let _EventStreamOfEvent = () => (_EventStreamOfEvent = dart.constFn(html$._EventStream$(html$.Event)))();
   let _ElementEventStreamImplOfEvent = () => (_ElementEventStreamImplOfEvent = dart.constFn(html$._ElementEventStreamImpl$(html$.Event)))();
   let CompleterOfFileWriter = () => (CompleterOfFileWriter = dart.constFn(async.Completer$(html$.FileWriter)))();
-  let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(html$.File)))();
+  let CompleterOfFile$ = () => (CompleterOfFile$ = dart.constFn(async.Completer$(html$.File)))();
   let ListOfFontFace = () => (ListOfFontFace = dart.constFn(core.List$(html$.FontFace)))();
   let ListOfGamepadButton = () => (ListOfGamepadButton = dart.constFn(core.List$(html$.GamepadButton)))();
   let CompleterOfGeoposition = () => (CompleterOfGeoposition = dart.constFn(async.Completer$(html$.Geoposition)))();
   let StreamControllerOfGeoposition = () => (StreamControllerOfGeoposition = dart.constFn(async.StreamController$(html$.Geoposition)))();
   let _CustomEventStreamProviderOfEvent = () => (_CustomEventStreamProviderOfEvent = dart.constFn(html$._CustomEventStreamProvider$(html$.Event)))();
   let CompleterOfHttpRequest = () => (CompleterOfHttpRequest = dart.constFn(async.Completer$(html$.HttpRequest)))();
+  let dynamicToNull = () => (dynamicToNull = dart.constFn(dart.functionType(core.Null, [dart.dynamic])))();
   let ProgressEventTovoid = () => (ProgressEventTovoid = dart.constFn(dart.functionType(dart.void, [html$.ProgressEvent])))();
   let ListOfMap = () => (ListOfMap = dart.constFn(core.List$(core.Map)))();
   let ListOfMediaStreamTrack = () => (ListOfMediaStreamTrack = dart.constFn(core.List$(html$.MediaStreamTrack)))();
@@ -458,6 +558,7 @@
   let EventStreamProviderOfMidiMessageEvent = () => (EventStreamProviderOfMidiMessageEvent = dart.constFn(html$.EventStreamProvider$(html$.MidiMessageEvent)))();
   let ListOfMimeType = () => (ListOfMimeType = dart.constFn(core.List$(html$.MimeType)))();
   let ListOfMutationRecord = () => (ListOfMutationRecord = dart.constFn(core.List$(html$.MutationRecord)))();
+  let _wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void = () => (_wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void = dart.constFn(html$._wrapZoneBinaryCallback$(ListOfMutationRecord(), html$.MutationObserver, dart.void)))();
   let MapOfString$bool = () => (MapOfString$bool = dart.constFn(core.Map$(core.String, core.bool)))();
   let CompleterOfMediaStream = () => (CompleterOfMediaStream = dart.constFn(async.Completer$(html$.MediaStream)))();
   let NodeTobool = () => (NodeTobool = dart.constFn(dart.functionType(core.bool, [html$.Node])))();
@@ -465,7 +566,6 @@
   let ListOfPlugin = () => (ListOfPlugin = dart.constFn(core.List$(html$.Plugin)))();
   let EventStreamProviderOfRtcDtmfToneChangeEvent = () => (EventStreamProviderOfRtcDtmfToneChangeEvent = dart.constFn(html$.EventStreamProvider$(html$.RtcDtmfToneChangeEvent)))();
   let JSArrayOfMapOfString$String = () => (JSArrayOfMapOfString$String = dart.constFn(_interceptors.JSArray$(MapOfString$String())))();
-  let ListOfMapOfString$String = () => (ListOfMapOfString$String = dart.constFn(core.List$(MapOfString$String())))();
   let CompleterOfRtcSessionDescription = () => (CompleterOfRtcSessionDescription = dart.constFn(async.Completer$(html$.RtcSessionDescription)))();
   let CompleterOfRtcStatsResponse = () => (CompleterOfRtcStatsResponse = dart.constFn(async.Completer$(html$.RtcStatsResponse)))();
   let EventStreamProviderOfMediaStreamEvent = () => (EventStreamProviderOfMediaStreamEvent = dart.constFn(html$.EventStreamProvider$(html$.MediaStreamEvent)))();
@@ -496,6 +596,7 @@
   let EventStreamProviderOfDeviceOrientationEvent = () => (EventStreamProviderOfDeviceOrientationEvent = dart.constFn(html$.EventStreamProvider$(html$.DeviceOrientationEvent)))();
   let EventStreamProviderOfAnimationEvent = () => (EventStreamProviderOfAnimationEvent = dart.constFn(html$.EventStreamProvider$(html$.AnimationEvent)))();
   let EventStreamProviderOfBeforeUnloadEvent = () => (EventStreamProviderOfBeforeUnloadEvent = dart.constFn(html$.EventStreamProvider$(html$.BeforeUnloadEvent)))();
+  let _EventStreamOfBeforeUnloadEvent = () => (_EventStreamOfBeforeUnloadEvent = dart.constFn(html$._EventStream$(html$.BeforeUnloadEvent)))();
   let StreamControllerOfBeforeUnloadEvent = () => (StreamControllerOfBeforeUnloadEvent = dart.constFn(async.StreamController$(html$.BeforeUnloadEvent)))();
   let _ElementEventStreamImplOfBeforeUnloadEvent = () => (_ElementEventStreamImplOfBeforeUnloadEvent = dart.constFn(html$._ElementEventStreamImpl$(html$.BeforeUnloadEvent)))();
   let _ElementListEventStreamImplOfBeforeUnloadEvent = () => (_ElementListEventStreamImplOfBeforeUnloadEvent = dart.constFn(html$._ElementListEventStreamImpl$(html$.BeforeUnloadEvent)))();
@@ -545,6 +646,7 @@
   let dynamicTodynamic$ = () => (dynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))();
   let StringAndStringToint = () => (StringAndStringToint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.String])))();
   let VoidTo_MethodStats = () => (VoidTo_MethodStats = dart.constFn(dart.definiteFunctionType(dart._MethodStats, [])))();
+  let VoidToFunctionType = () => (VoidToFunctionType = dart.constFn(dart.definiteFunctionType(dart.FunctionType, [])))();
   let dynamicToString = () => (dynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic])))();
   let dynamicToListOfString = () => (dynamicToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [dart.dynamic])))();
   let dynamicToList = () => (dynamicToList = dart.constFn(dart.definiteFunctionType(core.List, [dart.dynamic])))();
@@ -553,13 +655,12 @@
   let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
   let dynamicAnddynamicToString = () => (dynamicAnddynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic])))();
   let dynamicAndStringTobool = () => (dynamicAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, core.String])))();
-  let intAnddynamicTovoid = () => (intAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, dart.dynamic])))();
+  let intAnddynamicToNull = () => (intAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.int, dart.dynamic])))();
   let ObjectAndObjectToObject = () => (ObjectAndObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object, core.Object])))();
   let StringTobool$ = () => (StringTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))();
   let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
-  let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
-  let StringAndObjectTovoid = () => (StringAndObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Object])))();
-  let dynamicAnddynamicTovoid$ = () => (dynamicAnddynamicTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])))();
+  let dynamicAnddynamicToNull = () => (dynamicAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, dart.dynamic])))();
+  let StringAndObjectToNull = () => (StringAndObjectToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.Object])))();
   let StringToNameValuePair = () => (StringToNameValuePair = dart.constFn(dart.definiteFunctionType(_debugger.NameValuePair, [core.String])))();
   let VoidTodynamic$ = () => (VoidTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
   let StringAndString__Todynamic = () => (StringAndString__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -573,18 +674,22 @@
   let FunctionTovoid = () => (FunctionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Function])))();
   let StringAndStringToString$ = () => (StringAndStringToString$ = dart.constFn(dart.definiteFunctionType(core.String, [core.String, core.String])))();
   let TypeAndStringTodynamic = () => (TypeAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.String])))();
+  let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
   let dynamicAnddynamicToint = () => (dynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])))();
   let ListOfEToListOfE = () => (ListOfEToListOfE = dart.constFn(dart.definiteFunctionType(E => [core.List$(E), [core.List$(E)]])))();
   let StringTovoid$ = () => (StringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
   let _IsolateContextAndFunctionTodynamic = () => (_IsolateContextAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_isolate_helper._IsolateContext, core.Function])))();
   let VoidTobool = () => (VoidTobool = dart.constFn(dart.definiteFunctionType(core.bool, [])))();
   let VoidTo_IsolateContext = () => (VoidTo_IsolateContext = dart.constFn(dart.definiteFunctionType(_isolate_helper._IsolateContext, [])))();
+  let VoidToNull = () => (VoidToNull = dart.constFn(dart.definiteFunctionType(core.Null, [])))();
+  let dynamicAnddynamicTovoid$ = () => (dynamicAnddynamicTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])))();
   let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
-  let ListTodynamic = () => (ListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.List])))();
-  let StringTodynamic = () => (StringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String])))();
-  let TimerTovoid$ = () => (TimerTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [async.Timer])))();
+  let ListToNull = () => (ListToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.List])))();
+  let StringToNull = () => (StringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String])))();
+  let dynamicToNull$ = () => (dynamicToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic])))();
+  let TimerToNull = () => (TimerToNull = dart.constFn(dart.definiteFunctionType(core.Null, [async.Timer])))();
   let dynamicToFuture = () => (dynamicToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [dart.dynamic])))();
-  let boolTodynamic = () => (boolTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.bool])))();
+  let boolToNull = () => (boolToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.bool])))();
   let dynamicAndStackTraceTovoid = () => (dynamicAndStackTraceTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])))();
   let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
   let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core.int, [])))();
@@ -627,7 +732,7 @@
   let dynamicToSymbol = () => (dynamicToSymbol = dart.constFn(dart.definiteFunctionType(core.Symbol, [dart.dynamic])))();
   let dynamicToMapOfSymbol$dynamic = () => (dynamicToMapOfSymbol$dynamic = dart.constFn(dart.definiteFunctionType(MapOfSymbol$dynamic(), [dart.dynamic])))();
   let TypeAndInvocationTodynamic = () => (TypeAndInvocationTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.Invocation])))();
-  let SymbolAnddynamicTovoid = () => (SymbolAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Symbol, dart.dynamic])))();
+  let SymbolAnddynamicToNull = () => (SymbolAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.Symbol, dart.dynamic])))();
   let MapOfSymbol$dynamicTodynamic = () => (MapOfSymbol$dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [MapOfSymbol$dynamic()])))();
   let dynamicToTypeMirror = () => (dynamicToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [dart.dynamic])))();
   let dynamicAnddynamicAnddynamicTovoid = () => (dynamicAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -640,12 +745,12 @@
   let VoidToObject$ = () => (VoidToObject$ = dart.constFn(dart.definiteFunctionType(core.Object, [])))();
   let _FutureAnddynamicAnddynamicTovoid = () => (_FutureAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async._Future, dart.dynamic, dart.dynamic])))();
   let ObjectToObject = () => (ObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object])))();
-  let dynamic__Todynamic = () => (dynamic__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], [dart.dynamic])))();
+  let dynamic__ToNull = () => (dynamic__ToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [dart.dynamic])))();
   let dynamicTo_Future = () => (dynamicTo_Future = dart.constFn(dart.definiteFunctionType(async._Future, [dart.dynamic])))();
   let _AsyncCallbackTovoid = () => (_AsyncCallbackTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async._AsyncCallback])))();
-  let FnTodynamic = () => (FnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTovoid()])))();
+  let FnToNull = () => (FnToNull = dart.constFn(dart.definiteFunctionType(core.Null, [VoidTovoid()])))();
   let _NotificationHandlerToFuture = () => (_NotificationHandlerToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [async._NotificationHandler])))();
-  let dynamicAndStackTraceTodynamic = () => (dynamicAndStackTraceTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.StackTrace])))();
+  let dynamicAndStackTraceToNull = () => (dynamicAndStackTraceToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, core.StackTrace])))();
   let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace])))();
   let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), ZoneBinaryCallbackOfdynamic$dynamic$StackTrace()])))();
   let StreamSubscriptionAnd_FutureAnddynamic__Tovoid = () => (StreamSubscriptionAnd_FutureAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic, core.StackTrace])))();
@@ -686,10 +791,11 @@
   let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
   let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
   let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
-  let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
+  let StringAnddynamicToNull = () => (StringAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, dart.dynamic])))();
   let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
   let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
   let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
+  let StringAndStringToNull = () => (StringAndStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.String])))();
   let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
   let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
   let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
@@ -704,9 +810,107 @@
   let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
   let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
   let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
+  let dynamicAndStringAndStringTodynamic = () => (dynamicAndStringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])))();
+  let ListAndintAndintTo_BufferAndStart = () => (ListAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int, core.int])))();
+  let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))();
+  let DirectoryToFutureOfDirectory = () => (DirectoryToFutureOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOfDirectory(), [io.Directory])))();
+  let boolToFutureOrOfDirectory = () => (boolToFutureOrOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOrOfDirectory(), [core.bool])))();
+  let dynamicTo_Directory = () => (dynamicTo_Directory = dart.constFn(dart.definiteFunctionType(io._Directory, [dart.dynamic])))();
+  let dynamicToDirectory = () => (dynamicToDirectory = dart.constFn(dart.definiteFunctionType(io.Directory, [dart.dynamic])))();
+  let dynamicToFutureOrOfString = () => (dynamicToFutureOrOfString = dart.constFn(dart.definiteFunctionType(FutureOrOfString(), [dart.dynamic])))();
+  let dynamicToFutureOrOfbool = () => (dynamicToFutureOrOfbool = dart.constFn(dart.definiteFunctionType(FutureOrOfbool(), [dart.dynamic])))();
+  let dynamicToFutureOrOfint = () => (dynamicToFutureOrOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfint(), [dart.dynamic])))();
+  let ListOfintToNull = () => (ListOfintToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfint()])))();
+  let RandomAccessFileTovoid = () => (RandomAccessFileTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.RandomAccessFile])))();
+  let RandomAccessFileToFutureOr = () => (RandomAccessFileToFutureOr = dart.constFn(dart.definiteFunctionType(async.FutureOr, [io.RandomAccessFile])))();
+  let RandomAccessFileToNull = () => (RandomAccessFileToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RandomAccessFile])))();
+  let RandomAccessFileToFutureOfRandomAccessFile = () => (RandomAccessFileToFutureOfRandomAccessFile = dart.constFn(dart.definiteFunctionType(FutureOfRandomAccessFile(), [io.RandomAccessFile])))();
+  let dynamicTo_File = () => (dynamicTo_File = dart.constFn(dart.definiteFunctionType(io._File, [dart.dynamic])))();
+  let FileSystemEntityTo_File = () => (FileSystemEntityTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.FileSystemEntity])))();
+  let dynamicToFile = () => (dynamicToFile = dart.constFn(dart.definiteFunctionType(io.File, [dart.dynamic])))();
+  let dynamicTo_RandomAccessFile = () => (dynamicTo_RandomAccessFile = dart.constFn(dart.definiteFunctionType(io._RandomAccessFile, [dart.dynamic])))();
+  let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
+  let dynamicToFutureOfListOfint = () => (dynamicToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [dart.dynamic])))();
+  let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
+  let RandomAccessFileToFutureOfListOfint = () => (RandomAccessFileToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [io.RandomAccessFile])))();
+  let ListOfintToString = () => (ListOfintToString = dart.constFn(dart.definiteFunctionType(core.String, [ListOfint()])))();
+  let RandomAccessFileTo_File = () => (RandomAccessFileTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.RandomAccessFile])))();
+  let RandomAccessFileToObject = () => (RandomAccessFileToObject = dart.constFn(dart.definiteFunctionType(core.Object, [io.RandomAccessFile])))();
+  let RandomAccessFileToFutureOrOfFile = () => (RandomAccessFileToFutureOrOfFile = dart.constFn(dart.definiteFunctionType(FutureOrOfFile(), [io.RandomAccessFile])))();
+  let dynamicToFutureOrOfListOfint = () => (dynamicToFutureOrOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfListOfint(), [dart.dynamic])))();
+  let dynamicToFileStat = () => (dynamicToFileStat = dart.constFn(dart.definiteFunctionType(io.FileStat, [dart.dynamic])))();
+  let StringAndListOfStringToListOfString = () => (StringAndListOfStringToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String, ListOfString()])))();
+  let ListOfintTovoid$ = () => (ListOfintTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
+  let StringAndListOfStringToNull = () => (StringAndListOfStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, ListOfString()])))();
+  let CookieToString = () => (CookieToString = dart.constFn(dart.definiteFunctionType(core.String, [io.Cookie])))();
+  let CookieTobool = () => (CookieTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io.Cookie])))();
+  let _HttpClientRequestToFutureOfHttpClientResponse = () => (_HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io._HttpClientRequest])))();
+  let dynamicToFutureOfHttpClientResponse = () => (dynamicToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [dart.dynamic])))();
+  let VoidToFutureOfHttpClientResponse = () => (VoidToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [])))();
+  let VoidToListOfString = () => (VoidToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [])))();
+  let _AuthenticationSchemeTo_Credentials = () => (_AuthenticationSchemeTo_Credentials = dart.constFn(dart.definiteFunctionType(io._Credentials, [io._AuthenticationScheme])))();
+  let _CredentialsTovoid = () => (_CredentialsTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io._Credentials])))();
+  let _AuthenticationSchemeAndStringToFuture = () => (_AuthenticationSchemeAndStringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [io._AuthenticationScheme, core.String])))();
+  let dynamicToFutureOrOfHttpClientResponse = () => (dynamicToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [dart.dynamic])))();
+  let CookieToNull = () => (CookieToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Cookie])))();
+  let ListToFutureOrOfHttpClientResponse = () => (ListToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [core.List])))();
+  let HttpClientResponseTovoid = () => (HttpClientResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.HttpClientResponse])))();
+  let dynamicToIterable = () => (dynamicToIterable = dart.constFn(dart.definiteFunctionType(core.Iterable, [dart.dynamic])))();
+  let dynamicTo_HttpOutboundMessage = () => (dynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic])))();
+  let dynamicAnddynamicTo_HttpOutboundMessage = () => (dynamicAnddynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic, dart.dynamic])))();
+  let dynamic__ToNull$ = () => (dynamic__ToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [core.StackTrace])))();
+  let _HttpIncomingToNull = () => (_HttpIncomingToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpIncoming])))();
+  let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
+  let SecureSocketTo_HttpClientConnection = () => (SecureSocketTo_HttpClientConnection = dart.constFn(dart.definiteFunctionType(io._HttpClientConnection, [io.SecureSocket])))();
+  let HttpClientResponseToFutureOfSecureSocket = () => (HttpClientResponseToFutureOfSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfSecureSocket(), [io.HttpClientResponse])))();
+  let X509CertificateTobool$ = () => (X509CertificateTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [io.X509Certificate])))();
+  let _HttpClientConnectionTo_ConnectionInfo = () => (_HttpClientConnectionTo_ConnectionInfo = dart.constFn(dart.definiteFunctionType(io._ConnectionInfo, [io._HttpClientConnection])))();
+  let dynamicToFutureOrOf_ConnectionInfo = () => (dynamicToFutureOrOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOrOf_ConnectionInfo(), [dart.dynamic])))();
+  let _ConnectionTargetTobool = () => (_ConnectionTargetTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io._ConnectionTarget])))();
+  let _ConnectionInfoTo_HttpClientRequest = () => (_ConnectionInfoTo_HttpClientRequest = dart.constFn(dart.definiteFunctionType(io._HttpClientRequest, [io._ConnectionInfo])))();
+  let _ConnectionInfoToFutureOrOf_HttpClientRequest = () => (_ConnectionInfoToFutureOrOf_HttpClientRequest = dart.constFn(dart.definiteFunctionType(FutureOrOf_HttpClientRequest(), [io._ConnectionInfo])))();
+  let _HttpClientRequestTo_HttpClientRequest = () => (_HttpClientRequestTo_HttpClientRequest = dart.constFn(dart.definiteFunctionType(io._HttpClientRequest, [io._HttpClientRequest])))();
+  let VoidTo_ConnectionTarget = () => (VoidTo_ConnectionTarget = dart.constFn(dart.definiteFunctionType(io._ConnectionTarget, [])))();
+  let dynamicToFutureOf_ConnectionInfo = () => (dynamicToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [dart.dynamic])))();
+  let VoidToFutureOf_ConnectionInfo = () => (VoidToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [])))();
+  let _SiteCredentialsAnd_CredentialsTo_SiteCredentials = () => (_SiteCredentialsAnd_CredentialsTo_SiteCredentials = dart.constFn(dart.definiteFunctionType(io._SiteCredentials, [io._SiteCredentials, io._Credentials])))();
+  let ServerSocketTo_HttpServer = () => (ServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.ServerSocket])))();
+  let SecureServerSocketTo_HttpServer = () => (SecureServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.SecureServerSocket])))();
+  let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
+  let _HttpConnectionToNull = () => (_HttpConnectionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpConnection])))();
+  let _HttpConnectionToMap = () => (_HttpConnectionToMap = dart.constFn(dart.definiteFunctionType(core.Map, [io._HttpConnection])))();
+  let _FileResourceInfoToMapOfString$String = () => (_FileResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._FileResourceInfo])))();
+  let _ProcessResourceInfoToMapOfString$String = () => (_ProcessResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._ProcessResourceInfo])))();
+  let _SocketResourceInfoToMapOfString$String = () => (_SocketResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._SocketResourceInfo])))();
+  let dynamicTo_Link = () => (dynamicTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [dart.dynamic])))();
+  let FileSystemEntityToFutureOfLink = () => (FileSystemEntityToFutureOfLink = dart.constFn(dart.definiteFunctionType(FutureOfLink(), [io.FileSystemEntity])))();
+  let FileSystemEntityTo_Link = () => (FileSystemEntityTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [io.FileSystemEntity])))();
+  let dynamicToLink = () => (dynamicToLink = dart.constFn(dart.definiteFunctionType(io.Link, [dart.dynamic])))();
+  let DurationTovoid = () => (DurationTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Duration])))();
+  let RawSecureServerSocketToSecureServerSocket = () => (RawSecureServerSocketToSecureServerSocket = dart.constFn(dart.definiteFunctionType(io.SecureServerSocket, [io.RawSecureServerSocket])))();
+  let RawSecureSocketToSecureSocket = () => (RawSecureSocketToSecureSocket = dart.constFn(dart.definiteFunctionType(io.SecureSocket, [io.RawSecureSocket])))();
+  let dynamicToFutureOfRawSecureSocket = () => (dynamicToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [dart.dynamic])))();
+  let RawServerSocketToRawSecureServerSocket = () => (RawServerSocketToRawSecureServerSocket = dart.constFn(dart.definiteFunctionType(io.RawSecureServerSocket, [io.RawServerSocket])))();
+  let RawSecureSocketToNull = () => (RawSecureSocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RawSecureSocket])))();
+  let RawSocketToFutureOfRawSecureSocket = () => (RawSocketToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [io.RawSocket])))();
+  let _FilterStatusToNull = () => (_FilterStatusToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._FilterStatus])))();
+  let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
+  let dynamicTo_FilterStatus = () => (dynamicTo_FilterStatus = dart.constFn(dart.definiteFunctionType(io._FilterStatus, [dart.dynamic])))();
+  let ListOfintAndStringTovoid = () => (ListOfintAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint(), core.String])))();
+  let dynamicToStdioType = () => (dynamicToStdioType = dart.constFn(dart.definiteFunctionType(io.StdioType, [dart.dynamic])))();
+  let EventSinkTo_WebSocketProtocolTransformer = () => (EventSinkTo_WebSocketProtocolTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketProtocolTransformer, [async.EventSink])))();
+  let WebSocketTovoid = () => (WebSocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.WebSocket])))();
+  let HttpRequestToNull = () => (HttpRequestToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.HttpRequest])))();
+  let SocketTo_WebSocketImpl = () => (SocketTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [io.Socket])))();
+  let StringToFuture = () => (StringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [core.String])))();
+  let EventSinkOfListOfintTo_WebSocketOutgoingTransformer = () => (EventSinkOfListOfintTo_WebSocketOutgoingTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [EventSinkOfListOfint()])))();
+  let dynamicTo_WebSocketImpl = () => (dynamicTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic])))();
+  let HttpClientResponseToFutureOfWebSocket = () => (HttpClientResponseToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [io.HttpClientResponse])))();
+  let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
+  let HttpClientRequestToFutureOfHttpClientResponse = () => (HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io.HttpClientRequest])))();
+  let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
   let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
   let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
-  let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
   let dynamicAnddynamicAndFnToObject = () => (dynamicAnddynamicAndFnToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic, dart.dynamic, dynamicTodynamic()])))();
   let FToF = () => (FToF = dart.constFn(dart.definiteFunctionType(F => [F, [F]])))();
   let FunctionToFunction = () => (FunctionToFunction = dart.constFn(dart.definiteFunctionType(core.Function, [core.Function])))();
@@ -721,35 +925,35 @@
   let VoidToMirrorSystem = () => (VoidToMirrorSystem = dart.constFn(dart.definiteFunctionType(mirrors.MirrorSystem, [])))();
   let ObjectToInstanceMirror = () => (ObjectToInstanceMirror = dart.constFn(dart.definiteFunctionType(mirrors.InstanceMirror, [core.Object])))();
   let TypeToClassMirror = () => (TypeToClassMirror = dart.constFn(dart.definiteFunctionType(mirrors.ClassMirror, [core.Type])))();
-  let EventTovoid$ = () => (EventTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Event])))();
+  let EventToNull = () => (EventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Event])))();
   let RequestToFutureOfT = () => (RequestToFutureOfT = dart.constFn(dart.definiteFunctionType(T => [async.Future$(T), [indexed_db.Request]])))();
   let dynamicToTo = () => (dynamicToTo = dart.constFn(dart.definiteFunctionType(To => [To, [dart.dynamic]])))();
-  let EventTodynamic = () => (EventTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.Event])))();
   let NodeTobool$ = () => (NodeTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [html$.Node])))();
   let MapOfString$dynamicTobool = () => (MapOfString$dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [MapOfString$dynamic()])))();
   let UriAndListOfStringAnddynamicToFutureOfIsolate = () => (UriAndListOfStringAnddynamicToFutureOfIsolate = dart.constFn(dart.definiteFunctionType(FutureOfIsolate(), [core.Uri, ListOfString(), dart.dynamic])))();
   let TypeAnddynamicTodynamic = () => (TypeAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, dart.dynamic])))();
-  let FileSystemTovoid = () => (FileSystemTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.FileSystem])))();
-  let FileErrorTovoid = () => (FileErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.FileError])))();
-  let EntryTovoid = () => (EntryTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Entry])))();
+  let FileSystemToNull = () => (FileSystemToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.FileSystem])))();
+  let FileErrorToNull = () => (FileErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.FileError])))();
+  let EntryToNull = () => (EntryToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Entry])))();
   let dynamicToCssStyleDeclaration = () => (dynamicToCssStyleDeclaration = dart.constFn(dart.definiteFunctionType(html$.CssStyleDeclaration, [dart.dynamic])))();
   let CssStyleDeclarationTovoid = () => (CssStyleDeclarationTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.CssStyleDeclaration])))();
-  let MetadataTovoid = () => (MetadataTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Metadata])))();
-  let ListOfEntryTovoid = () => (ListOfEntryTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfEntry()])))();
+  let MetadataToNull = () => (MetadataToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Metadata])))();
+  let ListOfEntryToNull = () => (ListOfEntryToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfEntry()])))();
   let ElementTobool$ = () => (ElementTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [html$.Element])))();
-  let FileWriterTovoid = () => (FileWriterTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.FileWriter])))();
-  let FileTovoid = () => (FileTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.File])))();
-  let GeopositionTovoid = () => (GeopositionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Geoposition])))();
-  let PositionErrorTovoid = () => (PositionErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.PositionError])))();
+  let FileWriterToNull = () => (FileWriterToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.FileWriter])))();
+  let FileToNull = () => (FileToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.File])))();
+  let GeopositionToNull = () => (GeopositionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Geoposition])))();
+  let PositionErrorToNull = () => (PositionErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.PositionError])))();
   let HttpRequestToString = () => (HttpRequestToString = dart.constFn(dart.definiteFunctionType(core.String, [html$.HttpRequest])))();
-  let ProgressEventTovoid$ = () => (ProgressEventTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [html$.ProgressEvent])))();
-  let ListOfSourceInfoTovoid = () => (ListOfSourceInfoTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfSourceInfo()])))();
-  let MediaStreamTovoid = () => (MediaStreamTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.MediaStream])))();
-  let NavigatorUserMediaErrorTovoid = () => (NavigatorUserMediaErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.NavigatorUserMediaError])))();
-  let RtcSessionDescriptionTovoid = () => (RtcSessionDescriptionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.RtcSessionDescription])))();
-  let RtcStatsResponseTovoid = () => (RtcStatsResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.RtcStatsResponse])))();
+  let ProgressEventToNull = () => (ProgressEventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.ProgressEvent])))();
+  let ListOfSourceInfoToNull = () => (ListOfSourceInfoToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfSourceInfo()])))();
+  let MediaStreamToNull = () => (MediaStreamToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.MediaStream])))();
+  let NavigatorUserMediaErrorToNull = () => (NavigatorUserMediaErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.NavigatorUserMediaError])))();
+  let RtcSessionDescriptionToNull = () => (RtcSessionDescriptionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.RtcSessionDescription])))();
+  let RtcStatsResponseToNull = () => (RtcStatsResponseToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.RtcStatsResponse])))();
   let OptionElementTobool = () => (OptionElementTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.OptionElement])))();
-  let numTovoid = () => (numTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.num])))();
+  let numToNull = () => (numToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.num])))();
+  let BeforeUnloadEventToNull = () => (BeforeUnloadEventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.BeforeUnloadEvent])))();
   let ElementTovoid$ = () => (ElementTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Element])))();
   let ElementToCssClassSet = () => (ElementToCssClassSet = dart.constFn(dart.definiteFunctionType(html$.CssClassSet, [html$.Element])))();
   let CssClassSetImplTovoid = () => (CssClassSetImplTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html_common.CssClassSetImpl])))();
@@ -757,6 +961,7 @@
   let SetOfStringTobool = () => (SetOfStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [SetOfString()])))();
   let SetOfStringTovoid = () => (SetOfStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [SetOfString()])))();
   let EventAndStringTobool = () => (EventAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.Event, core.String])))();
+  let EventTodynamic = () => (EventTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.Event])))();
   let KeyEventTobool = () => (KeyEventTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.KeyEvent])))();
   let NodeValidatorTobool = () => (NodeValidatorTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.NodeValidator])))();
   let NodeAndNodeToint = () => (NodeAndNodeToint = dart.constFn(dart.definiteFunctionType(core.int, [html$.Node, html$.Node])))();
@@ -772,14 +977,12 @@
   let NodeAndNodeTovoid = () => (NodeAndNodeTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Node, html$.Node])))();
   let dynamicToImageData = () => (dynamicToImageData = dart.constFn(dart.definiteFunctionType(html$.ImageData, [dart.dynamic])))();
   let ImageDataTodynamic = () => (ImageDataTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.ImageData])))();
-  let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
   let Map__Todynamic = () => (Map__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Map], [dynamicTovoid()])))();
   let ListOfStringToList = () => (ListOfStringToList = dart.constFn(dart.definiteFunctionType(core.List, [ListOfString()])))();
-  let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
   let DateTimeTodynamic = () => (DateTimeTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.DateTime])))();
-  let dynamic__Todynamic$ = () => (dynamic__Todynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], {mustCopy: dart.dynamic})))();
+  let dynamic__Todynamic = () => (dynamic__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], {mustCopy: dart.dynamic})))();
   let NodeToElement = () => (NodeToElement = dart.constFn(dart.definiteFunctionType(html$.Element, [html$.Node])))();
-  let AudioBufferTovoid = () => (AudioBufferTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [web_audio.AudioBuffer])))();
+  let AudioBufferToNull = () => (AudioBufferToNull = dart.constFn(dart.definiteFunctionType(core.Null, [web_audio.AudioBuffer])))();
   dart.mixin = function(base, ...mixins) {
     class Mixin extends base {}
     for (let m of mixins) {
@@ -798,6 +1001,27 @@
           dart.copyProperties(s, m[dart._methodSig]);
         }
         return s;
+      },
+      fields: () => {
+        let s = {};
+        for (let m of mixins) {
+          dart.copyProperties(s, m[dart._fieldSig]);
+        }
+        return s;
+      },
+      getters: () => {
+        let s = {};
+        for (let m of mixins) {
+          dart.copyProperties(s, m[dart._getterSig]);
+        }
+        return s;
+      },
+      setters: () => {
+        let s = {};
+        for (let m of mixins) {
+          dart.copyProperties(s, m[dart._setterSig]);
+        }
+        return s;
       }
     });
     Mixin[dart._mixins] = mixins;
@@ -900,15 +1124,33 @@
   dart.getGenericTypeCtor = function(value) {
     return value[dart._genericTypeCtor];
   };
-  dart.getMethodType = function(obj, name) {
-    let type = obj == null ? core.Object : obj.__proto__.constructor;
-    return dart.getMethodTypeFromType(type, name);
+  dart.getType = function(obj) {
+    return obj == null ? core.Object : obj.__proto__.constructor;
   };
-  dart.getMethodTypeFromType = function(type, name) {
+  dart.isJsInterop = function(obj) {
+    if (typeof obj === "function") {
+      return dart._getRuntimeType(obj) == null;
+    }
+    if (typeof obj !== "object") return false;
+    if (dart.getExtensionType(obj) != null) return false;
+    return !(obj instanceof core.Object);
+  };
+  dart.getMethodType = function(type, name) {
     let sigObj = type[dart._methodSig];
     if (sigObj === void 0) return void 0;
     return sigObj[name];
   };
+  dart.getFieldType = function(type, name) {
+    let sigObj = type[dart._fieldSig];
+    if (sigObj === void 0) return void 0;
+    let fieldType = sigObj[name];
+    return fieldType instanceof Array ? fieldType[0] : fieldType;
+  };
+  dart.getSetterType = function(type, name) {
+    let sigObj = type[dart._setterSig];
+    if (sigObj === void 0) return void 0;
+    return sigObj[name];
+  };
   dart.classGetConstructorType = function(cls, name) {
     if (!name) name = 'new';
     if (cls === void 0) return void 0;
@@ -920,7 +1162,7 @@
   dart.bind = function(obj, name, f) {
     if (f === void 0) f = obj[name];
     f = f.bind(obj);
-    let sig = dart.getMethodType(obj, name);
+    let sig = dart.getMethodType(dart.getType(obj), name);
     dart.assert(sig);
     dart.tag(f, sig);
     return f;
@@ -934,7 +1176,8 @@
   dart._setInstanceSignature = function(f, sigF, kind) {
     dart.defineMemoizedGetter(f, kind, () => {
       let sigObj = sigF();
-      sigObj.__proto__ = f.__proto__[kind];
+      let proto = f.__proto__;
+      sigObj.__proto__ = kind in proto ? proto[kind] : null;
       return sigObj;
     });
   };
@@ -995,8 +1238,22 @@
     dart._setStaticSetterSignature(f, staticSetters);
     dart._setStaticTypes(f, names);
   };
-  dart.hasMethod = function(obj, name) {
-    return dart.getMethodType(obj, name) !== void 0;
+  dart._hasSigEntry = function(type, sigF, name) {
+    let sigObj = type[sigF];
+    if (sigObj === void 0) return false;
+    return name in sigObj;
+  };
+  dart.hasMethod = function(type, name) {
+    return dart._hasSigEntry(type, dart._methodSig, name);
+  };
+  dart.hasGetter = function(type, name) {
+    return dart._hasSigEntry(type, dart._getterSig, name);
+  };
+  dart.hasSetter = function(type, name) {
+    return dart._hasSigEntry(type, dart._setterSig, name);
+  };
+  dart.hasField = function(type, name) {
+    return dart._hasSigEntry(type, dart._fieldSig, name);
   };
   dart.defineNamedConstructor = function(clazz, name) {
     let proto = clazz.prototype;
@@ -1057,9 +1314,15 @@
     if (!jsProto) return;
     jsProto[dart._extensionType] = dartExtType;
     dart._installProperties(jsProto, extProto);
-    let originalSigFn = dart.getOwnPropertyDescriptor(dartExtType, dart._methodSig).get;
-    dart.assert(originalSigFn);
-    dart.defineMemoizedGetter(jsType, dart._methodSig, originalSigFn);
+    function updateSig(sigF) {
+      let originalSigFn = dart.getOwnPropertyDescriptor(dartExtType, sigF).get;
+      dart.assert(originalSigFn);
+      dart.defineMemoizedGetter(jsType, sigF, originalSigFn);
+    }
+    updateSig(dart._methodSig);
+    updateSig(dart._fieldSig);
+    updateSig(dart._getterSig);
+    updateSig(dart._setterSig);
   };
   dart.defineExtensionMembers = function(type, methodNames) {
     let proto = type.prototype;
@@ -1067,14 +1330,23 @@
       let method = dart.getOwnPropertyDescriptor(proto, name);
       dart.defineProperty(proto, dart.getExtensionSymbol(name), method);
     }
-    let originalSigFn = dart.getOwnPropertyDescriptor(type, dart._methodSig).get;
-    dart.defineMemoizedGetter(type, dart._methodSig, function() {
-      let sig = originalSigFn();
-      for (let name of methodNames) {
-        sig[dart.getExtensionSymbol(name)] = sig[name];
-      }
-      return sig;
-    });
+    function upgradeSig(sigF) {
+      let originalSigFn = dart.getOwnPropertyDescriptor(type, sigF).get;
+      dart.defineMemoizedGetter(type, sigF, function() {
+        let sig = originalSigFn();
+        let propertyNames = Object.getOwnPropertyNames(sig);
+        for (let name of methodNames) {
+          if (name in sig) {
+            sig[dart.getExtensionSymbol(name)] = sig[name];
+          }
+        }
+        return sig;
+      });
+    }
+    upgradeSig(dart._methodSig);
+    upgradeSig(dart._fieldSig);
+    upgradeSig(dart._getterSig);
+    upgradeSig(dart._setterSig);
   };
   dart.setType = function(obj, type) {
     obj.__proto__ = type.prototype;
@@ -1190,7 +1462,7 @@
   };
   const _wrappedType = Symbol('_wrappedType');
   dart.unwrapType = function(obj) {
-    return dart.dload(obj, _wrappedType);
+    return obj[_wrappedType];
   };
   dart._getRuntimeType = function(value) {
     return value[dart._runtimeType];
@@ -1275,6 +1547,65 @@
       return dart._asInstanceOfLazyJSType(object, this);
     };
   };
+  dart._memoizeArray = function(map, arr, create) {
+    let len = arr.length;
+    map = dart._lookupNonTerminal(map, len);
+    for (var i = 0; i < len - 1; ++i) {
+      map = dart._lookupNonTerminal(map, arr[i]);
+    }
+    let result = map.get(arr[len - 1]);
+    if (result !== void 0) return result;
+    map.set(arr[len - 1], result = create());
+    return result;
+  };
+  dart._normalizeParameter = function(a) {
+    if (a instanceof Array) {
+      let result = [];
+      result.push(a[0] == dart.dynamic ? dart.bottom : a[0]);
+      result.push(a.slice(1));
+      return result;
+    }
+    return a == dart.dynamic ? dart.bottom : a;
+  };
+  dart._canonicalizeArray = function(definite, array, map) {
+    let arr = definite ? array : array.map(dart._normalizeParameter);
+    return dart._memoizeArray(map, arr, () => arr);
+  };
+  dart._canonicalizeNamed = function(definite, named, map) {
+    let key = [];
+    let names = dart.getOwnPropertyNames(named);
+    let r = {};
+    for (var i = 0; i < names.length; ++i) {
+      let name = names[i];
+      let type = named[name];
+      if (!definite) r[name] = type = dart._normalizeParameter(type);
+      key.push(name);
+      key.push(type);
+    }
+    if (!definite) named = r;
+    return dart._memoizeArray(map, key, () => named);
+  };
+  dart._lookupNonTerminal = function(map, key) {
+    let result = map.get(key);
+    if (result !== void 0) return result;
+    map.set(key, result = new Map());
+    return result;
+  };
+  dart._createSmall = function(count, definite, returnType, required) {
+    let map = dart._fnTypeSmallMap[count];
+    let args = definite ? required : required.map(dart._normalizeParameter);
+    for (var i = 0; i < count; ++i) {
+      map = dart._lookupNonTerminal(map, args[i]);
+    }
+    let result = map.get(returnType);
+    if (result !== void 0) return result;
+    result = new dart.FunctionType(returnType, args, [], {});
+    map.set(returnType, result);
+    return result;
+  };
+  dart.typedef = function(name, closure) {
+    return new dart.Typedef(name, closure);
+  };
   dart._functionType = function(definite, returnType, args, extra) {
     if (args === void 0 && extra === void 0) {
       const fnTypeParts = returnType;
@@ -1293,9 +1624,6 @@
   dart.definiteFunctionType = function(returnType, args, extra) {
     return dart._functionType(true, returnType, args, extra);
   };
-  dart.typedef = function(name, closure) {
-    return new dart.Typedef(name, closure);
-  };
   dart.typeName = function(type) {
     if (type === void 0) return "undefined type";
     if (type === null) return "null type";
@@ -1331,17 +1659,17 @@
   };
   dart.getImplicitFunctionType = function(type) {
     if (dart.test(dart.isFunctionType(type))) return type;
-    return dart.getMethodTypeFromType(type, 'call');
+    return dart.getMethodType(type, 'call');
   };
   dart.isFunctionType = function(type) {
     return type instanceof dart.AbstractFunctionType || type === core.Function;
   };
-  dart.isLazyJSSubtype = function(t1, t2, covariant) {
+  dart.isLazyJSSubtype = function(t1, t2, isCovariant) {
     if (dart.equals(t1, t2)) return true;
     if (t1[_jsTypeCallback] == null || t2[_jsTypeCallback] == null) return true;
-    return dart.isClassSubType(t1[_rawJSType], t2[_rawJSType], covariant);
+    return dart.isClassSubType(t1[_rawJSType], t2[_rawJSType], isCovariant);
   };
-  dart.isFunctionSubtype = function(ft1, ft2, covariant) {
+  dart.isFunctionSubtype = function(ft1, ft2, isCovariant) {
     if (ft2 === core.Function) {
       return true;
     }
@@ -1353,26 +1681,26 @@
     let args1 = ft1.args;
     let args2 = ft2.args;
     if (args1.length > args2.length) {
-      return covariant ? false : null;
+      return isCovariant ? false : null;
     }
     for (let i = 0; i < args1.length; ++i) {
-      if (!dart._isSubtype(args2[i], args1[i], !covariant)) {
+      if (!dart._isSubtype(args2[i], args1[i], !isCovariant)) {
         return null;
       }
     }
     let optionals1 = ft1.optionals;
     let optionals2 = ft2.optionals;
     if (args1.length + optionals1.length < args2.length + optionals2.length) {
-      return covariant ? false : null;
+      return isCovariant ? false : null;
     }
     let j = 0;
     for (let i = args1.length; i < args2.length; ++i, ++j) {
-      if (!dart._isSubtype(args2[i], optionals1[j], !covariant)) {
+      if (!dart._isSubtype(args2[i], optionals1[j], !isCovariant)) {
         return null;
       }
     }
     for (let i = 0; i < optionals2.length; ++i, ++j) {
-      if (!dart._isSubtype(optionals2[i], optionals1[j], !covariant)) {
+      if (!dart._isSubtype(optionals2[i], optionals1[j], !isCovariant)) {
         return null;
       }
     }
@@ -1384,15 +1712,14 @@
       let n1 = named1[name];
       let n2 = named2[name];
       if (n1 === void 0) {
-        return covariant ? false : null;
+        return isCovariant ? false : null;
       }
-      if (!dart._isSubtype(n2, n1, !covariant)) {
+      if (!dart._isSubtype(n2, n1, !isCovariant)) {
         return null;
       }
     }
-    if (ret2 === dart.void) return true;
-    if (ret1 === dart.void) return ret2 === dart.dynamic;
-    if (!dart._isSubtype(ret1, ret2, covariant)) return null;
+    if (ret1 === dart.void) return dart._isTop(ret2);
+    if (!dart._isSubtype(ret1, ret2, isCovariant)) return null;
     return true;
   };
   dart._subtypeMemo = function(f) {
@@ -1412,12 +1739,15 @@
     };
   };
   dart._isBottom = function(type) {
-    return type == dart.bottom;
+    return type == dart.bottom || type == core.Null;
   };
   dart._isTop = function(type) {
-    return type == core.Object || type == dart.dynamic;
+    if (dart.getGenericClass(type) === dart.getGenericClass(async.FutureOr)) {
+      return dart._isTop(dart.getGenericArgs(type)[0]);
+    }
+    return type == core.Object || type == dart.dynamic || type == dart.void;
   };
-  dart._isSubtype = function(t1, t2, covariant) {
+  dart._isSubtype = function(t1, t2, isCovariant) {
     if (t1 === t2) return true;
     if (dart._isTop(t2) || dart._isBottom(t1)) {
       return true;
@@ -1428,20 +1758,20 @@
       return false;
     }
     if (!(t1 instanceof dart.AbstractFunctionType) && !(t2 instanceof dart.AbstractFunctionType)) {
-      let result = dart.isClassSubType(t1, t2, covariant);
+      let result = dart.isClassSubType(t1, t2, isCovariant);
       if (result === true || result === null) return result;
     }
     t1 = dart.getImplicitFunctionType(t1);
     if (!t1) return false;
     if (dart.isFunctionType(t1) && dart.isFunctionType(t2)) {
-      return dart.isFunctionSubtype(t1, t2, covariant);
+      return dart.isFunctionSubtype(t1, t2, isCovariant);
     }
     if (t1 instanceof dart.LazyJSType && t2 instanceof dart.LazyJSType) {
-      return dart.isLazyJSSubtype(t1, t2, covariant);
+      return dart.isLazyJSSubtype(t1, t2, isCovariant);
     }
     return false;
   };
-  dart.isClassSubType = function(t1, t2, covariant) {
+  dart.isClassSubType = function(t1, t2, isCovariant) {
     if (t1 == t2) return true;
     if (t1 == core.Object) return false;
     if (t1 == null) return t2 == core.Object || t2 == dart.dynamic;
@@ -1459,16 +1789,25 @@
       }
       dart.assert(length == typeArguments2.length);
       for (let i = 0; i < length; ++i) {
-        let result = dart._isSubtype(typeArguments1[i], typeArguments2[i], covariant);
+        let result = dart._isSubtype(typeArguments1[i], typeArguments2[i], isCovariant);
         if (!result) {
           return result;
         }
       }
       return true;
     }
+    if (raw1 === dart.getGenericClass(async.FutureOr)) {
+      let t1TypeArg = dart.getGenericArgs(t1)[0];
+      let t1Future = dart.getGenericClass(async.Future)(t1TypeArg);
+      return dart.isSubtype(t1Future, t2) && dart.isSubtype(t1TypeArg, t2);
+    } else if (raw2 === dart.getGenericClass(async.FutureOr)) {
+      let t2TypeArg = dart.getGenericArgs(t2)[0];
+      let t2Future = dart.getGenericClass(async.Future)(t2TypeArg);
+      return dart.isSubtype(t1, t2Future) || dart.isSubtype(t1, t2TypeArg);
+    }
     let indefinite = false;
     function definitive(t1, t2) {
-      let result = dart.isClassSubType(t1, t2, covariant);
+      let result = dart.isClassSubType(t1, t2, isCovariant);
       if (result == null) {
         indefinite = true;
         return false;
@@ -1513,32 +1852,47 @@
     }
     return true;
   };
+  dart.trapRuntimeErrors = function(flag) {
+    dart._trapRuntimeErrors = flag;
+  };
   dart.throwCastError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.CastErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.CastErrorImplementation(object, found, expected));
   };
   dart.throwTypeError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.TypeErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.TypeErrorImplementation(object, found, expected));
   };
   dart.throwStrongModeCastError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.StrongModeCastError(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.StrongModeCastError(object, found, expected));
   };
   dart.throwStrongModeTypeError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.StrongModeTypeError(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.StrongModeTypeError(object, found, expected));
   };
   dart.throwUnimplementedError = function(message) {
-    debugger;
+    if (dart._trapRuntimeErrors) debugger;
     dart.throw(new core.UnimplementedError(message));
   };
-  dart.throwAssertionError = function() {
-    debugger;
-    dart.throw(new core.AssertionError());
+  dart.throwAssertionError = function(message) {
+    if (message === void 0) message = null;
+    return (() => {
+      if (dart._trapRuntimeErrors) debugger;
+      let error = message != null ? new _js_helper.AssertionErrorWithMessage(message()) : new core.AssertionError();
+      dart.throw(error);
+    })();
   };
   dart.throwNullValueError = function() {
-    debugger;
+    if (dart._trapRuntimeErrors) debugger;
     dart.throw(new core.NoSuchMethodError(null, new core.Symbol('<Unexpected Null Value>'), null, null, null));
   };
   dart.syncStar = function(gen, E, ...args) {
@@ -1562,7 +1916,7 @@
       }
       return future.then(dart.dynamic)(onValue, {onError: onError});
     }
-    return dart.getGenericClass(async.Future)(T).new(function() {
+    return dart.getGenericClass(async.Future)(T).microtask(function() {
       iter = gen.apply(null, args)[Symbol.iterator]();
       return onValue();
     });
@@ -1574,24 +1928,70 @@
     let f = dart._canonicalMember(obj, field);
     dart._trackCall(obj);
     if (f != null) {
-      if (dart.test(dart.hasMethod(obj, f))) return dart.bind(obj, f, void 0);
-      return obj[f];
+      let type = dart.getType(obj);
+      if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
+      if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
+      if (dart.test(dart.isJsInterop(obj))) return obj[f];
     }
-    return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(field), [], {isGetter: true}));
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
+  };
+  dart.dloadMirror = function(obj, field) {
+    let f = dart._canonicalMember(obj, field);
+    dart._trackCall(obj);
+    if (f != null) {
+      let type = dart.getType(obj);
+      if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
+      if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
+    }
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
+  };
+  dart._stripGenericArguments = function(type) {
+    let genericClass = dart.getGenericClass(type);
+    if (genericClass != null) return genericClass();
+    return type;
+  };
+  dart.dputMirror = function(obj, field, value) {
+    let f = dart._canonicalMember(obj, field);
+    dart._trackCall(obj);
+    if (f != null) {
+      let objType = dart.getType(obj);
+      let setterType = dart.getSetterType(objType, f);
+      if (setterType != void 0) {
+        return obj[f] = dart.check(value, dart._stripGenericArguments(setterType.args[0]));
+      } else {
+        let fieldType = dart.getFieldType(objType, f);
+        if (fieldType != void 0) {
+          return obj[f] = dart.check(value, dart._stripGenericArguments(fieldType));
+        }
+      }
+    }
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [value], {isSetter: true}));
   };
   dart.dput = function(obj, field, value) {
     let f = dart._canonicalMember(obj, field);
     dart._trackCall(obj);
     if (f != null) {
-      return obj[f] = value;
+      let objType = dart.getType(obj);
+      let setterType = dart.getSetterType(objType, f);
+      if (setterType != void 0) {
+        return obj[f] = dart.check(value, setterType.args[0]);
+      } else {
+        let fieldType = dart.getFieldType(objType, f);
+        if (fieldType != void 0) {
+          return obj[f] = dart.check(value, fieldType);
+        }
+        if (dart.test(dart.isJsInterop(obj))) {
+          return obj[f] = value;
+        }
+      }
     }
-    return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(field), [value], {isSetter: true}));
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [value], {isSetter: true}));
   };
   dart._checkApply = function(type, actuals) {
     if (actuals.length < type.args.length) return false;
     let index = 0;
     for (let i = 0; i < type.args.length; ++i) {
-      if (!dart.instanceOfOrNull(actuals[i], type.args[i])) return false;
+      dart.check(actuals[i], type.args[i]);
       ++index;
     }
     if (actuals.length == type.args.length) return true;
@@ -1599,7 +1999,7 @@
     if (type.optionals.length > 0) {
       if (extras > type.optionals.length) return false;
       for (let i = 0, j = index; i < extras; ++i, ++j) {
-        if (!dart.instanceOfOrNull(actuals[j], type.optionals[i])) return false;
+        dart.check(actuals[j], type.optionals[i]);
       }
       return true;
     }
@@ -1612,12 +2012,40 @@
       if (!dart.hasOwnProperty.call(type.named, name)) {
         return false;
       }
-      if (!dart.instanceOfOrNull(opts[name], type.named[name])) return false;
+      dart.check(opts[name], type.named[name]);
     }
     return true;
   };
+  dart._toSymbolName = function(symbol) {
+    let str = symbol.toString();
+    return str.substring(7, str.length - 1);
+  };
+  dart._toDisplayName = function(name) {
+    if (name[0] === '_') {
+      switch (name) {
+        case '_get':
+        {
+          return '[]';
+        }
+        case '_set':
+        {
+          return '[]=';
+        }
+        case '_negate':
+        {
+          return 'unary-';
+        }
+        case '_constructor':
+        case '_prototype':
+        {
+          return name.substring(1);
+        }
+      }
+    }
+    return name;
+  };
   dart._dartSymbol = function(name) {
-    return dart.const(core.Symbol.new(name.toString()));
+    return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.Symbol.es6(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
   };
   dart.extractNamedArgs = function(args) {
     if (args.length > 0) {
@@ -1636,7 +2064,7 @@
     }
     if (!(f instanceof Function)) {
       if (f != null) {
-        ftype = dart.getMethodType(f, 'call');
+        ftype = dart.getMethodType(dart.getType(f), 'call');
         f = f.call;
       }
       if (!(f instanceof Function)) {
@@ -1741,16 +2169,17 @@
       }
     }
     let actualTypeName = dart.typeName(actual);
-    let o = dart._callMethodStats[dartx.putIfAbsent](dart.str`${actualTypeName} <${src}>`, dart.fn(() => new dart._MethodStats(core.String._check(actualTypeName), src), VoidTo_MethodStats()));
+    let o = dart._callMethodStats[dartx.putIfAbsent](dart.str`${actualTypeName} <${src}>`, dart.fn(() => new dart._MethodStats(actualTypeName, src), VoidTo_MethodStats()));
     o.count = dart.notNull(o.count) + 1;
   };
   dart._callMethod = function(obj, name, typeArgs, args, displayName) {
     let symbol = dart._canonicalMember(obj, name);
     if (symbol == null) {
-      return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(displayName), core.List._check(args), {isMethod: true}));
+      return dart.noSuchMethod(obj, new dart.InvocationImpl(displayName, core.List._check(args), {isMethod: true}));
     }
     let f = obj != null ? obj[symbol] : null;
-    let ftype = dart.getMethodType(obj, symbol);
+    let type = dart.getType(obj);
+    let ftype = dart.getMethodType(type, symbol);
     return dart._checkAndCall(f, ftype, obj, typeArgs, args, displayName);
   };
   dart.dsend = function(obj, method, ...args) {
@@ -1795,6 +2224,9 @@
     return false;
   };
   dart.is = function(obj, type) {
+    if (obj == null) {
+      return type == core.Null || dart._isTop(type);
+    }
     let result = dart.strongInstanceOf(obj, type);
     if (result !== null) return result;
     let actual = dart.getReifiedType(obj);
@@ -1896,18 +2328,19 @@
       return map;
     })();
   };
-  dart.assert = function(condition) {
-    if (!condition) dart.throwAssertionError();
+  dart.assert = function(condition, message) {
+    if (message === void 0) message = null;
+    return (() => {
+      if (!condition) dart.throwAssertionError(message);
+    })();
   };
   dart.throw = function(obj) {
-    if (obj != null && (typeof obj == 'object' || typeof obj == 'function')) {
-      dart._stack.set(obj, new Error());
-    }
+    dart._stack = new Error();
     throw obj;
   };
   dart.getError = function(exception) {
-    var stack = dart._stack.get(exception);
-    return stack !== void 0 ? stack : exception;
+    var stack = dart._stack;
+    return stack !== null ? stack : exception;
   };
   dart.stackPrint = function(exception) {
     var error = dart.getError(exception);
@@ -2069,11 +2502,11 @@
     return Object.getOwnPropertySymbols(obj);
   };
   dart.throwStrongModeError = function(message) {
-    debugger;
+    if (dart.test(dart._trapRuntimeErrors)) debugger;
     throw new _js_helper.StrongModeErrorImplementation(message);
   };
   dart.throwInternalError = function(message) {
-    debugger;
+    if (dart.test(dart._trapRuntimeErrors)) debugger;
     throw Error(message);
   };
   dart.getOwnNamesAndSymbols = function(obj) {
@@ -2140,7 +2573,56 @@
   dart.copyProperties = function(to, from) {
     return dart.copyTheseProperties(to, from, dart.getOwnNamesAndSymbols(from));
   };
-  dart.global = typeof window == "undefined" ? global : window;
+  dart.global = (function() {
+    if (typeof NodeList !== "undefined") {
+      NodeList.prototype.get = function(i) {
+        return this[i];
+      };
+      NamedNodeMap.prototype.get = function(i) {
+        return this[i];
+      };
+      DOMTokenList.prototype.get = function(i) {
+        return this[i];
+      };
+      HTMLCollection.prototype.get = function(i) {
+        return this[i];
+      };
+      if (typeof PannerNode == "undefined") {
+        let audioContext;
+        if (typeof AudioContext == "undefined" && typeof webkitAudioContext != "undefined") {
+          audioContext = new webkitAudioContext();
+        } else {
+          audioContext = new AudioContext();
+          window.StereoPannerNode = audioContext.createStereoPanner().constructor;
+        }
+        window.PannerNode = audioContext.createPanner().constructor;
+      }
+      if (typeof AudioSourceNode == "undefined") {
+        window.AudioSourceNode = MediaElementAudioSourceNode.__proto__;
+      }
+      if (typeof FontFaceSet == "undefined") {
+        window.FontFaceSet = document.fonts.__proto__.constructor;
+      }
+      if (typeof MemoryInfo == "undefined") {
+        if (typeof window.performance.memory != "undefined") {
+          window.MemoryInfo = window.performance.memory.constructor;
+        }
+      }
+      if (typeof Geolocation == "undefined") {
+        navigator.geolocation.constructor;
+      }
+      if (typeof Animation == "undefined") {
+        let d = document.createElement('div');
+        if (typeof d.animate != "undefined") {
+          window.Animation = d.animate(d).constructor;
+        }
+      }
+      if (typeof SourceBufferList == "undefined") {
+        window.SourceBufferList = new MediaSource().sourceBuffers.constructor;
+      }
+    }
+    return typeof window == "undefined" ? global : window;
+  })();
   dart.JsSymbol = Symbol;
   dart._mixins = Symbol("mixins");
   dart.implements = Symbol("implements");
@@ -2292,198 +2774,189 @@
       this[_wrappedType] = wrappedType;
     }
     toString() {
-      return core.String._check(dart.typeName(this[_wrappedType]));
+      return dart.typeName(this[_wrappedType]);
     }
   };
   dart.setSignature(dart.WrappedType, {
     constructors: () => ({new: dart.definiteFunctionType(dart.WrappedType, [dart.dynamic])}),
     fields: () => ({[_wrappedType]: dart.dynamic})
   });
+  const _stringValue = Symbol('_stringValue');
   dart.AbstractFunctionType = class AbstractFunctionType extends dart.TypeRep {
-    constructor() {
-      super();
-      this._stringValue = null;
+    new() {
+      this[_stringValue] = null;
+      super.new();
     }
     toString() {
       return this.name;
     }
     get name() {
-      if (this._stringValue) return this._stringValue;
+      if (this[_stringValue] != null) return this[_stringValue];
       let buffer = '(';
       for (let i = 0; i < this.args.length; ++i) {
         if (i > 0) {
-          buffer += ', ';
+          buffer = dart.notNull(buffer) + ', ';
         }
-        buffer += dart.typeName(this.args[i]);
+        buffer = dart.notNull(buffer) + dart.notNull(dart.typeName(this.args[i]));
       }
       if (this.optionals.length > 0) {
-        if (this.args.length > 0) buffer += ', ';
-        buffer += '[';
+        if (this.args.length > 0) {
+          buffer = dart.notNull(buffer) + ', ';
+        }
+        buffer = dart.notNull(buffer) + '[';
         for (let i = 0; i < this.optionals.length; ++i) {
           if (i > 0) {
-            buffer += ', ';
+            buffer = dart.notNull(buffer) + ', ';
           }
-          buffer += dart.typeName(this.optionals[i]);
+          buffer = dart.notNull(buffer) + dart.notNull(dart.typeName(this.optionals[i]));
         }
-        buffer += ']';
+        buffer = dart.notNull(buffer) + ']';
       } else if (Object.keys(this.named).length > 0) {
-        if (this.args.length > 0) buffer += ', ';
-        buffer += '{';
-        let names = dart.getOwnPropertyNames(this.named).sort();
+        if (this.args.length > 0) {
+          buffer = dart.notNull(buffer) + ', ';
+        }
+        buffer = dart.notNull(buffer) + '{';
+        let names = dart.getOwnPropertyNames(this.named);
+        names.sort();
         for (let i = 0; i < names.length; ++i) {
           if (i > 0) {
-            buffer += ', ';
+            buffer = dart.notNull(buffer) + ', ';
           }
-          buffer += names[i] + ': ' + dart.typeName(this.named[names[i]]);
+          let typeNameString = dart.typeName(this.named[names[i]]);
+          buffer = dart.notNull(buffer) + dart.str`${names[i]}: ${typeNameString}`;
         }
-        buffer += '}';
+        buffer = dart.notNull(buffer) + '}';
       }
-      buffer += ') -> ' + dart.typeName(this.returnType);
-      this._stringValue = buffer;
+      let returnTypeName = dart.typeName(this.returnType);
+      buffer = dart.notNull(buffer) + dart.str`) -> ${returnTypeName}`;
+      this[_stringValue] = buffer;
       return buffer;
     }
   };
+  dart.setSignature(dart.AbstractFunctionType, {
+    constructors: () => ({new: dart.definiteFunctionType(dart.AbstractFunctionType, [])}),
+    fields: () => ({[_stringValue]: core.String})
+  });
   dart._fnTypeNamedArgMap = new Map();
   dart._fnTypeArrayArgMap = new Map();
   dart._fnTypeTypeMap = new Map();
   dart._fnTypeSmallMap = [new Map(), new Map(), new Map()];
+  const _process = Symbol('_process');
   dart.FunctionType = class FunctionType extends dart.AbstractFunctionType {
-    static _memoizeArray(map, arr, create) {
-      let len = arr.length;
-      map = FunctionType._lookupNonTerminal(map, len);
-      for (var i = 0; i < len - 1; ++i) {
-        map = FunctionType._lookupNonTerminal(map, arr[i]);
-      }
-      let result = map.get(arr[len - 1]);
-      if (result !== void 0) return result;
-      map.set(arr[len - 1], result = create());
-      return result;
-    }
-    static _normalizeParameter(a) {
-      if (a instanceof Array) {
-        let result = [];
-        result.push(a[0] == dart.dynamic ? dart.bottom : a[0]);
-        result.push(a.slice(1));
-        return result;
-      }
-      return a == dart.dynamic ? dart.bottom : a;
-    }
-    static _canonicalizeArray(definite, array, map) {
-      let arr = definite ? array : array.map(FunctionType._normalizeParameter);
-      return FunctionType._memoizeArray(map, arr, () => arr);
-    }
-    static _canonicalizeNamed(definite, named, map) {
-      let key = [];
-      let names = dart.getOwnPropertyNames(named);
-      let r = {};
-      for (var i = 0; i < names.length; ++i) {
-        let name = names[i];
-        let type = named[name];
-        if (!definite) r[name] = type = FunctionType._normalizeParameter(type);
-        key.push(name);
-        key.push(type);
-      }
-      if (!definite) named = r;
-      return FunctionType._memoizeArray(map, key, () => named);
-    }
-    static _lookupNonTerminal(map, key) {
-      let result = map.get(key);
-      if (result !== void 0) return result;
-      map.set(key, result = new Map());
-      return result;
-    }
-    static _createSmall(count, definite, returnType, required) {
-      let map = dart._fnTypeSmallMap[count];
-      let args = definite ? required : required.map(FunctionType._normalizeParameter);
-      for (var i = 0; i < count; ++i) {
-        map = FunctionType._lookupNonTerminal(map, args[i]);
-      }
-      let result = map.get(returnType);
-      if (result !== void 0) return result;
-      result = new FunctionType(returnType, args, [], {});
-      map.set(returnType, result);
-      return result;
-    }
     static create(definite, returnType, args, extra) {
       if (extra === void 0 && args.length < 3) {
-        return FunctionType._createSmall(args.length, definite, returnType, args);
+        return dart._createSmall(args.length, definite, returnType, args);
       }
-      args = FunctionType._canonicalizeArray(definite, args, dart._fnTypeArrayArgMap);
-      let keys;
-      let create;
+      args = dart._canonicalizeArray(definite, args, dart._fnTypeArrayArgMap);
+      let keys = null;
+      let create = null;
       if (extra === void 0) {
         keys = [returnType, args];
-        create = () => new FunctionType(returnType, args, [], {});
+        create = dart.fn(() => new dart.FunctionType(returnType, args, [], {}), VoidToFunctionType());
       } else if (extra instanceof Array) {
-        let optionals = FunctionType._canonicalizeArray(definite, extra, dart._fnTypeArrayArgMap);
+        let optionals = dart._canonicalizeArray(definite, extra, dart._fnTypeArrayArgMap);
         keys = [returnType, args, optionals];
-        create = () => new FunctionType(returnType, args, optionals, {});
+        create = dart.fn(() => new dart.FunctionType(returnType, args, optionals, {}), VoidToFunctionType());
       } else {
-        let named = FunctionType._canonicalizeNamed(definite, extra, dart._fnTypeNamedArgMap);
+        let named = dart._canonicalizeNamed(definite, extra, dart._fnTypeNamedArgMap);
         keys = [returnType, args, named];
-        create = () => new FunctionType(returnType, args, [], named);
+        create = dart.fn(() => new dart.FunctionType(returnType, args, [], named), VoidToFunctionType());
       }
-      return FunctionType._memoizeArray(dart._fnTypeTypeMap, keys, create);
+      return dart._memoizeArray(dart._fnTypeTypeMap, keys, create);
     }
-    constructor(returnType, args, optionals, named) {
-      super();
+    [_process](array, metadata) {
+      let result = [];
+      for (let i = 0; i < array.length; ++i) {
+        let arg = array[i];
+        if (arg instanceof Array) {
+          dart.dsend(metadata, 'add', arg.slice(1));
+          result[dartx.add](arg[0]);
+        } else {
+          metadata.push([]);
+          result.push(arg);
+        }
+      }
+      return result;
+    }
+    new(returnType, args, optionals, named) {
       this.returnType = returnType;
       this.args = args;
       this.optionals = optionals;
       this.named = named;
+      this.metadata = null;
+      super.new();
       this.metadata = [];
-      function process(array, metadata) {
-        var result = [];
-        for (var i = 0; i < array.length; ++i) {
-          var arg = array[i];
-          if (arg instanceof Array) {
-            metadata.push(arg.slice(1));
-            result.push(arg[0]);
-          } else {
-            metadata.push([]);
-            result.push(arg);
-          }
-        }
-        return result;
-      }
-      this.args = process(this.args, this.metadata);
-      this.optionals = process(this.optionals, this.metadata);
+      this.args = this[_process](this.args, this.metadata);
+      this.optionals = this[_process](this.optionals, this.metadata);
     }
   };
+  dart.setSignature(dart.FunctionType, {
+    constructors: () => ({new: dart.definiteFunctionType(dart.FunctionType, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])}),
+    fields: () => ({
+      returnType: dart.dynamic,
+      args: dart.dynamic,
+      optionals: dart.dynamic,
+      named: dart.dynamic,
+      metadata: dart.dynamic
+    }),
+    methods: () => ({[_process]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])}),
+    statics: () => ({create: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])}),
+    names: ['create']
+  });
+  const _name = Symbol('_name');
+  const _closure = Symbol('_closure');
+  const _functionType = Symbol('_functionType');
   dart.Typedef = class Typedef extends dart.AbstractFunctionType {
-    constructor(name, closure) {
-      super();
-      this._name = name;
-      this._closure = closure;
-      this._functionType = null;
+    new(name, closure) {
+      this[_name] = name;
+      this[_closure] = closure;
+      this[_functionType] = null;
+      super.new();
     }
     get name() {
-      return this._name;
+      return core.String._check(this[_name]);
     }
     get functionType() {
-      if (!this._functionType) {
-        this._functionType = this._closure();
+      if (this[_functionType] == null) {
+        this[_functionType] = this[_closure]();
       }
-      return this._functionType;
+      return this[_functionType];
     }
     get returnType() {
       return this.functionType.returnType;
     }
     get args() {
-      return this.functionType.args;
+      return core.List._check(this.functionType.args);
     }
     get optionals() {
-      return this.functionType.optionals;
+      return core.List._check(this.functionType.optionals);
     }
     get named() {
       return this.functionType.named;
     }
     get metadata() {
-      return this.functionType.metadata;
+      return core.List._check(this.functionType.metadata);
     }
   };
+  dart.setSignature(dart.Typedef, {
+    constructors: () => ({new: dart.definiteFunctionType(dart.Typedef, [dart.dynamic, dart.dynamic])}),
+    fields: () => ({
+      [_name]: dart.dynamic,
+      [_closure]: dart.dynamic,
+      [_functionType]: dart.AbstractFunctionType
+    }),
+    getters: () => ({
+      functionType: dart.definiteFunctionType(dart.AbstractFunctionType, []),
+      returnType: dart.definiteFunctionType(dart.dynamic, []),
+      args: dart.definiteFunctionType(core.List, []),
+      optionals: dart.definiteFunctionType(core.List, []),
+      named: dart.definiteFunctionType(dart.dynamic, []),
+      metadata: dart.definiteFunctionType(core.List, [])
+    })
+  });
   dart._typeFormalCount = Symbol("_typeFormalCount");
   dart.isSubtype = dart._subtypeMemo((t1, t2) => t1 === t2 || dart._isSubtype(t1, t2, true));
+  dart._trapRuntimeErrors = true;
   dart._jsIterator = Symbol("_jsIterator");
   dart._current = Symbol("_current");
   dart._AsyncStarStreamController = class _AsyncStarStreamController {
@@ -2616,7 +3089,7 @@
     }
   };
   dart.setSignature(dart.InvocationImpl, {
-    constructors: () => ({new: dart.definiteFunctionType(dart.InvocationImpl, [core.String, core.List], {namedArguments: dart.dynamic, isMethod: core.bool, isGetter: core.bool, isSetter: core.bool})}),
+    constructors: () => ({new: dart.definiteFunctionType(dart.InvocationImpl, [dart.dynamic, core.List], {namedArguments: dart.dynamic, isMethod: core.bool, isGetter: core.bool, isSetter: core.bool})}),
     fields: () => ({
       memberName: core.Symbol,
       positionalArguments: core.List,
@@ -2665,7 +3138,7 @@
       return false;
     });
   })();
-  dart._stack = new WeakMap();
+  dart._stack = null;
   dart._value = Symbol("_value");
   dart.constants = new Map();
   dart.constantLists = new Map();
@@ -2760,8 +3233,8 @@
   dart.lazyFn(_debugger.getObjectTypeName, () => dynamicToString());
   _debugger.getTypeName = function(type) {
     let name = dart.typeName(type);
-    if (dart.equals(name, 'JSArray<dynamic>') || dart.equals(name, 'JSObject<Array>')) return 'List<dynamic>';
-    return core.String._check(name);
+    if (name == 'JSArray<dynamic>' || name == 'JSObject<Array>') return 'List<dynamic>';
+    return name;
   };
   dart.lazyFn(_debugger.getTypeName, () => TypeToString());
   _debugger._getType = function(object) {
@@ -2864,7 +3337,7 @@
       if (dart.notNull(this.length) <= dart.notNull(_debugger._maxSpanLength)) {
         this.asMap()[dartx.forEach](dart.fn((i, element) => {
           children[dartx.add](new _debugger.NameValuePair({name: dart.toString(dart.notNull(i) + dart.notNull(this.start)), value: element}));
-        }, intAnddynamicTovoid()));
+        }, intAnddynamicToNull()));
       } else {
         for (let i = this.start; dart.notNull(i) < dart.notNull(this.end); i = dart.notNull(i) + dart.notNull(this.subsetSize)) {
           let subSpan = new _debugger.IterableSpan(i, math.min(core.int)(this.end, dart.notNull(this.subsetSize) + dart.notNull(i)), this.iterable);
@@ -3157,7 +3630,7 @@
         protoChain[dartx.add](current);
         current = _debugger.safeGetProperty(current, '__proto__');
       }
-      for (/* Unimplemented unknown name */current of protoChain) {
+      for (current of protoChain) {
         for (let symbol of _debugger.getOwnPropertySymbols(current)) {
           let dartName = _debugger.symbolName(symbol);
           if (dart.test(_debugger.hasMethod(object, dartName))) {
@@ -3173,7 +3646,7 @@
           properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
         }
       }
-      for (/* Unimplemented unknown name */current of protoChain) {
+      for (current of protoChain) {
         let className = dart.dload(dart.getReifiedType(current), 'name');
         for (let name of _debugger.getOwnPropertyNames(current)) {
           if (dart.test(_debugger.ObjectFormatter._customNames.contains(name)) || dart.equals(name, className)) continue;
@@ -3265,14 +3738,14 @@
         } else {
           nonGenericProperties._set(core.String._check(name), value);
         }
-      }, dynamicAnddynamicTodynamic$()));
+      }, dynamicAnddynamicToNull()));
       nonGenericProperties.forEach(dart.fn((name, value) => {
         if (core.Type.is(value)) {
           children.add(_debugger.NameValuePair._check(this.classChild(name, value)));
         } else {
           children.add(new _debugger.NameValuePair({name: name, value: value}));
         }
-      }, StringAndObjectTovoid()));
+      }, StringAndObjectToNull()));
       return children.toList();
     }
     recordGenericParameters(name, genericTypeConstructor) {
@@ -3309,7 +3782,7 @@
       return true;
     }
     preview(object) {
-      return core.String._check(dart.typeName(dart.getReifiedType(object)));
+      return dart.typeName(dart.getReifiedType(object));
     }
     children(object) {
       return JSArrayOfNameValuePair().of([new _debugger.NameValuePair({name: 'signature', value: this.preview(object)}), new _debugger.NameValuePair({name: 'JavaScript Function', value: object, config: _debugger.JsonMLConfig.skipDart})]);
@@ -3341,7 +3814,7 @@
       map[dartx.forEach](dart.fn((key, value) => {
         let entryWrapper = new _debugger.MapEntry({key: key, value: value});
         entries.add(new _debugger.NameValuePair({name: dart.toString(entries.length), value: entryWrapper}));
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
       _debugger.addMetadataChildren(object, entries);
       return entries.toList();
     }
@@ -7020,30 +7493,8 @@
     ListIterable[dart.implements] = () => [_internal.EfficientLength];
     dart.setSignature(ListIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_internal.ListIterable$(E), [])}),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
-      methods: () => ({
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-        every: dart.definiteFunctionType(core.bool, [ETobool()]),
-        any: dart.definiteFunctionType(core.bool, [ETobool()]),
-        firstWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        lastWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        singleWhere: dart.definiteFunctionType(E, [ETobool()]),
-        where: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        map: dart.definiteFunctionType(T => [core.Iterable$(T), [dart.functionType(T, [E])]]),
-        reduce: dart.definiteFunctionType(E, [dynamicAndEToE()]),
-        fold: dart.definiteFunctionType(T => [T, [T, dart.functionType(T, [T, E])]]),
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        skipWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        takeWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
-      })
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
+      methods: () => ({reduce: dart.definiteFunctionType(E, [dynamicAndEToE()])})
     });
     dart.defineExtensionMembers(ListIterable, [
       'forEach',
@@ -7169,12 +7620,6 @@
       getters: () => ({
         [_endIndex]: dart.definiteFunctionType(core.int, []),
         [_startIndex]: dart.definiteFunctionType(core.int, [])
-      }),
-      methods: () => ({
-        elementAt: dart.definiteFunctionType(E, [core.int]),
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool})
       })
     });
     dart.defineExtensionMembers(SubListIterable, [
@@ -7289,13 +7734,7 @@
         [_iterable$]: IterableOfS(),
         [_f]: _TransformationOfS$T()
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(T), []),
-        first: dart.definiteFunctionType(T, []),
-        last: dart.definiteFunctionType(T, []),
-        single: dart.definiteFunctionType(T, [])
-      }),
-      methods: () => ({elementAt: dart.definiteFunctionType(T, [core.int])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(T), [])})
     });
     dart.defineExtensionMembers(MappedIterable, [
       'elementAt',
@@ -7388,8 +7827,7 @@
       fields: () => ({
         [_source]: IterableOfS(),
         [_f]: _TransformationOfS$T()
-      }),
-      methods: () => ({elementAt: dart.definiteFunctionType(T, [core.int])})
+      })
     });
     dart.defineExtensionMembers(MappedListIterable, ['elementAt', 'length']);
     return MappedListIterable;
@@ -7738,8 +8176,7 @@
         [_iterable$]: IterableOfE(),
         [_skipCount]: core.int
       }),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({skip: dart.definiteFunctionType(core.Iterable$(E), [core.int])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(SkipIterable, ['skip', 'iterator']);
     return SkipIterable;
@@ -7965,31 +8402,8 @@
     EmptyIterable[dart.implements] = () => [_internal.EfficientLength];
     dart.setSignature(EmptyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_internal.EmptyIterable$(E), [])}),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
-      methods: () => ({
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-        elementAt: dart.definiteFunctionType(E, [core.int]),
-        every: dart.definiteFunctionType(core.bool, [ETobool()]),
-        any: dart.definiteFunctionType(core.bool, [ETobool()]),
-        firstWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        lastWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        where: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        map: dart.definiteFunctionType(T => [core.Iterable$(T), [dart.functionType(T, [E])]]),
-        reduce: dart.definiteFunctionType(E, [EAndEToE()]),
-        fold: dart.definiteFunctionType(T => [T, [T, dart.functionType(T, [T, E])]]),
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        skipWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        takeWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
-      })
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
+      methods: () => ({singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()})})
     });
     dart.defineExtensionMembers(EmptyIterable, [
       'forEach',
@@ -8188,8 +8602,7 @@
   dart.addSimpleTypeTests(_internal._ListIndicesIterable);
   dart.setSignature(_internal._ListIndicesIterable, {
     constructors: () => ({new: dart.definiteFunctionType(_internal._ListIndicesIterable, [core.List])}),
-    fields: () => ({[_backedList]: core.List}),
-    methods: () => ({elementAt: dart.definiteFunctionType(core.int, [core.int])})
+    fields: () => ({[_backedList]: core.List})
   });
   dart.defineExtensionMembers(_internal._ListIndicesIterable, ['elementAt', 'length']);
   const _values = Symbol('_values');
@@ -8318,8 +8731,7 @@
     }
     dart.setSignature(ReversedListIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_internal.ReversedListIterable$(E), [IterableOfE()])}),
-      fields: () => ({[_source]: IterableOfE()}),
-      methods: () => ({elementAt: dart.definiteFunctionType(E, [core.int])})
+      fields: () => ({[_source]: IterableOfE()})
     });
     dart.defineExtensionMembers(ReversedListIterable, ['elementAt', 'length']);
     return ReversedListIterable;
@@ -8700,41 +9112,41 @@
     names: ['sort', 'sortRange', '_doSort', '_insertionSort', '_dualPivotQuicksort']
   });
   _internal.Sort._INSERTION_SORT_THRESHOLD = 32;
-  const _name = Symbol('_name');
+  const _name$ = Symbol('_name');
   const _nativeSymbol = Symbol('_nativeSymbol');
   _internal.Symbol = class Symbol extends core.Object {
     new(name) {
-      this[_name] = name;
+      this[_name$] = name;
       this[_nativeSymbol] = null;
     }
     es6(name, nativeSymbol) {
-      this[_name] = name;
+      this[_name$] = name;
       this[_nativeSymbol] = nativeSymbol;
     }
     unvalidated(name) {
-      this[_name] = name;
+      this[_name$] = name;
       this[_nativeSymbol] = null;
     }
     validated(name) {
-      this[_name] = _internal.Symbol.validatePublicSymbol(name);
+      this[_name$] = _internal.Symbol.validatePublicSymbol(name);
       this[_nativeSymbol] = null;
     }
     ['=='](other) {
-      return _internal.Symbol.is(other) && this[_name] == other[_name] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
+      return _internal.Symbol.is(other) && this[_name$] == other[_name$] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
     }
     get hashCode() {
       let hash = this._hashCode;
       if (hash != null) return hash;
       let arbitraryPrime = 664597;
-      hash = 536870911 & arbitraryPrime * dart.notNull(dart.hashCode(this[_name]));
+      hash = 536870911 & arbitraryPrime * dart.notNull(dart.hashCode(this[_name$]));
       this._hashCode = hash;
       return hash;
     }
     toString() {
-      return dart.str`Symbol("${this[_name]}")`;
+      return dart.str`Symbol("${this[_name$]}")`;
     }
     static getName(symbol) {
-      return symbol[_name];
+      return symbol[_name$];
     }
     static getNativeSymbol(symbol) {
       return symbol[_nativeSymbol];
@@ -8762,7 +9174,7 @@
       validated: dart.definiteFunctionType(_internal.Symbol, [core.String])
     }),
     fields: () => ({
-      [_name]: core.String,
+      [_name$]: core.String,
       [_nativeSymbol]: dart.dynamic
     }),
     methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
@@ -8838,11 +9250,11 @@
     if (_isolate_helper._MainFunctionArgs.is(entry)) {
       rootContext.eval(dart.fn(() => {
         dart.dcall(entry, args);
-      }, VoidTodynamic$()));
+      }, VoidToNull()));
     } else if (_isolate_helper._MainFunctionArgsMessage.is(entry)) {
       rootContext.eval(dart.fn(() => {
         dart.dcall(entry, args, null);
-      }, VoidTodynamic$()));
+      }, VoidToNull()));
     } else {
       rootContext.eval(core.Function._check(entry));
     }
@@ -8899,13 +9311,14 @@
           f(a, e);
         };
       })(_isolate_helper.IsolateNatives._processWorkerMessage, this.mainManager);
-      self.onmessage = func;
-      self.dartPrint = self.dartPrint || (function(serialize) {
+      _isolate_helper.global.onmessage = func;
+      _isolate_helper.global.dartPrint = _isolate_helper.global.dartPrint || (function(serialize) {
         return function(object) {
-          if (self.console && self.console.log) {
-            self.console.log(object);
+          var _self = _isolate_helper.global;
+          if (_self.console && _self.console.log) {
+            _self.console.log(object);
           } else {
-            self.postMessage(serialize(object));
+            _self.postMessage(serialize(object));
           }
         };
       })(_isolate_helper._Manager._serializePrintMessage);
@@ -9056,8 +9469,8 @@
         if (dart.test(this.errorsAreFatal) && core.identical(this, _isolate_helper._globalState.rootContext)) {
           return;
         }
-        if (self.console && self.console.error) {
-          self.console.error(error, stackTrace);
+        if (_isolate_helper.global.console && _isolate_helper.global.console.error) {
+          _isolate_helper.global.console.error(error, stackTrace);
         } else {
           core.print(error);
           if (stackTrace != null) core.print(stackTrace);
@@ -9283,7 +9696,7 @@
           if (!dart.test(this.runIteration())) return;
           async.Timer.run(next);
         }).bind(this);
-        dart.fn(next, VoidTodynamic$());
+        dart.fn(next, VoidToNull());
         next();
       } else {
         while (dart.test(this.runIteration())) {
@@ -9344,13 +9757,13 @@
     methods: () => ({process: dart.definiteFunctionType(dart.void, [])})
   });
   dart.defineLazy(_isolate_helper, {
-    get _global() {
+    get global() {
       return typeof global == 'undefined' ? self : global;
     }
   });
   _isolate_helper._MainManagerStub = class _MainManagerStub extends core.Object {
     postMessage(msg) {
-      _isolate_helper._global.postMessage(msg);
+      _isolate_helper.global.postMessage(msg);
     }
   };
   dart.setSignature(_isolate_helper._MainManagerStub, {
@@ -9360,17 +9773,17 @@
   _isolate_helper._SPAWN_FAILED_SIGNAL = "spawn failed";
   dart.copyProperties(_isolate_helper, {
     get globalWindow() {
-      return _isolate_helper._global.window;
+      return _isolate_helper.global.window;
     }
   });
   dart.copyProperties(_isolate_helper, {
     get globalWorker() {
-      return _isolate_helper._global.Worker;
+      return _isolate_helper.global.Worker;
     }
   });
   dart.copyProperties(_isolate_helper, {
     get globalPostMessageDefined() {
-      return !!_isolate_helper._global.postMessage;
+      return !!_isolate_helper.global.postMessage;
     }
   });
   _isolate_helper._MainFunction = dart.typedef('_MainFunction', () => dart.functionType(dart.dynamic, []));
@@ -9436,7 +9849,7 @@
           let context = new _isolate_helper._IsolateContext();
           _isolate_helper._globalState.topEventLoop.enqueue(context, dart.fn(() => {
             _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate.SendPort._check(replyTo));
-          }, VoidTodynamic$()), 'worker-start');
+          }, VoidToNull()), 'worker-start');
           _isolate_helper._globalState.currentContext = context;
           _isolate_helper._globalState.topEventLoop.run();
           break;
@@ -9486,9 +9899,9 @@
       let replyPort = dart.dindex(msg, 'replyPort');
       _isolate_helper.IsolateNatives.spawn(core.String._check(dart.dindex(msg, 'functionName')), core.String._check(dart.dindex(msg, 'uri')), ListOfString()._check(dart.dindex(msg, 'args')), dart.dindex(msg, 'msg'), false, core.bool._check(dart.dindex(msg, 'isSpawnUri')), core.bool._check(dart.dindex(msg, 'startPaused'))).then(dart.dynamic)(dart.fn(msg => {
         dart.dsend(replyPort, 'send', msg);
-      }, ListTodynamic()), {onError: dart.fn(errorMessage => {
+      }, ListToNull()), {onError: dart.fn(errorMessage => {
           dart.dsend(replyPort, 'send', JSArrayOfString().of([_isolate_helper._SPAWN_FAILED_SIGNAL, errorMessage]));
-        }, StringTodynamic())});
+        }, StringToNull())});
     }
     static _log(msg) {
       if (dart.test(_isolate_helper._globalState.isWorker)) {
@@ -9504,7 +9917,7 @@
       }
     }
     static _consoleLog(msg) {
-      self.console.log(msg);
+      _isolate_helper.global.console.log(msg);
     }
     static _getJSFunctionFromName(functionName) {
       let globalFunctionsContainer = _foreign_helper.JS_EMBEDDED_GLOBAL("", _js_embedded_names.GLOBAL_FUNCTIONS);
@@ -9545,7 +9958,7 @@
           dart.assert(dart.equals(dart.dindex(msg, 0), _isolate_helper._SPAWN_FAILED_SIGNAL));
           completer.completeError(dart.dindex(msg, 1));
         }
-      }, dynamicTodynamic$()));
+      }, dynamicToNull$()));
       let signalReply = port.sendPort;
       if (dart.test(_isolate_helper._globalState.useWorkers) && !dart.test(isLight)) {
         _isolate_helper.IsolateNatives._startWorker(functionName, uri, args, message, isSpawnUri, startPaused, signalReply, dart.fn(message => completer.completeError(message), StringTovoid$()));
@@ -9571,7 +9984,7 @@
       _isolate_helper._globalState.topEventLoop.enqueue(new _isolate_helper._IsolateContext(), dart.fn(() => {
         let func = _isolate_helper.IsolateNatives._getJSFunctionFromName(functionName);
         _isolate_helper.IsolateNatives._startIsolate(core.Function._check(func), args, message, isSpawnUri, startPaused, replyPort);
-      }, VoidTodynamic$()), 'nonworker start');
+      }, VoidToNull()), 'nonworker start');
     }
     static get currentIsolate() {
       let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
@@ -9716,7 +10129,7 @@
         if (!dart.test(this[_receivePort][_isClosed])) {
           this[_receivePort][_add](msg);
         }
-      }, VoidTodynamic$()), dart.str`receive ${message}`);
+      }, VoidToNull()), dart.str`receive ${message}`);
     }
     ['=='](other) {
       return _isolate_helper._NativeJsSendPort.is(other) && dart.equals(this[_receivePort], other[_receivePort]);
@@ -9850,13 +10263,11 @@
     let _EmptyStreamOfT = () => (_EmptyStreamOfT = dart.constFn(async._EmptyStream$(T)))();
     let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
     let _StreamControllerOfT = () => (_StreamControllerOfT = dart.constFn(async._StreamController$(T)))();
-    let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
     let _GeneratedStreamImplOfT = () => (_GeneratedStreamImplOfT = dart.constFn(async._GeneratedStreamImpl$(T)))();
     let _IterablePendingEventsOfT = () => (_IterablePendingEventsOfT = dart.constFn(async._IterablePendingEvents$(T)))();
     let _BoundSinkStreamOfdynamic$T = () => (_BoundSinkStreamOfdynamic$T = dart.constFn(async._BoundSinkStream$(dart.dynamic, T)))();
     let _AsBroadcastStreamOfT = () => (_AsBroadcastStreamOfT = dart.constFn(async._AsBroadcastStream$(T)))();
     let _WhereStreamOfT = () => (_WhereStreamOfT = dart.constFn(async._WhereStream$(T)))();
-    let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     let _HandleErrorStreamOfT = () => (_HandleErrorStreamOfT = dart.constFn(async._HandleErrorStream$(T)))();
     let StreamConsumerOfT = () => (StreamConsumerOfT = dart.constFn(async.StreamConsumer$(T)))();
     let TAndTToT = () => (TAndTToT = dart.constFn(dart.functionType(T, [T, T])))();
@@ -9871,12 +10282,14 @@
     let _SkipStreamOfT = () => (_SkipStreamOfT = dart.constFn(async._SkipStream$(T)))();
     let _SkipWhileStreamOfT = () => (_SkipWhileStreamOfT = dart.constFn(async._SkipWhileStream$(T)))();
     let _DistinctStreamOfT = () => (_DistinctStreamOfT = dart.constFn(async._DistinctStream$(T)))();
+    let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     let EventSinkOfT = () => (EventSinkOfT = dart.constFn(async.EventSink$(T)))();
     let _SyncBroadcastStreamControllerOfT = () => (_SyncBroadcastStreamControllerOfT = dart.constFn(async._SyncBroadcastStreamController$(T)))();
     let _SyncStreamControllerOfT = () => (_SyncStreamControllerOfT = dart.constFn(async._SyncStreamController$(T)))();
     let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
     let StreamSubscriptionOfTTovoid = () => (StreamSubscriptionOfTTovoid = dart.constFn(dart.functionType(dart.void, [StreamSubscriptionOfT()])))();
     let TTobool = () => (TTobool = dart.constFn(dart.functionType(core.bool, [T])))();
+    let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
     let TAndTTobool = () => (TAndTTobool = dart.constFn(dart.functionType(core.bool, [T, T])))();
     let EventSinkOfTTovoid = () => (EventSinkOfTTovoid = dart.constFn(dart.functionType(dart.void, [EventSinkOfT()])))();
     let FutureOfT = () => (FutureOfT = dart.constFn(async.Future$(T)))();
@@ -9884,10 +10297,10 @@
     let IterableOfT = () => (IterableOfT = dart.constFn(core.Iterable$(T)))();
     let intToT = () => (intToT = dart.constFn(dart.functionType(T, [core.int])))();
     let EventSinkOfTToEventSink = () => (EventSinkOfTToEventSink = dart.constFn(dart.functionType(async.EventSink, [EventSinkOfT()])))();
-    let TTodynamic$ = () => (TTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [T])))();
+    let TToNull = () => (TToNull = dart.constFn(dart.definiteFunctionType(core.Null, [T])))();
     let VoidTo_IterablePendingEventsOfT = () => (VoidTo_IterablePendingEventsOfT = dart.constFn(dart.definiteFunctionType(_IterablePendingEventsOfT(), [])))();
-    let TTovoid$ = () => (TTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [T])))();
     let VoidToT = () => (VoidToT = dart.constFn(dart.definiteFunctionType(T, [])))();
+    let TTovoid$ = () => (TTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [T])))();
     class Stream extends core.Object {
       new() {
       }
@@ -9901,10 +10314,10 @@
         future.then(dart.dynamic)(dart.fn(value => {
           controller[_add$](value);
           controller[_closeUnchecked]();
-        }, TTodynamic$()), {onError: dart.fn((error, stackTrace) => {
+        }, TToNull()), {onError: dart.fn((error, stackTrace) => {
             controller[_addError](error, core.StackTrace._check(stackTrace));
             controller[_closeUnchecked]();
-          }, dynamicAnddynamicTodynamic$())});
+          }, dynamicAnddynamicToNull())});
         return controller.stream;
       }
       static fromFutures(futures) {
@@ -9915,13 +10328,13 @@
             controller[_add$](value);
             if (--count == 0) controller[_closeUnchecked]();
           }
-        }, TTodynamic$());
+        }, TToNull());
         let onError = dart.fn((error, stack) => {
           if (!dart.test(controller.isClosed)) {
             controller[_addError](error, core.StackTrace._check(stack));
             if (--count == 0) controller[_closeUnchecked]();
           }
-        }, dynamicAnddynamicTodynamic$());
+        }, dynamicAnddynamicToNull());
         for (let future of futures) {
           count++;
           future.then(dart.dynamic)(onValue, {onError: onError});
@@ -9958,17 +10371,17 @@
           dart.assert(timer == null);
           timer = async.Timer.periodic(period, dart.fn(timer => {
             sendEvent();
-          }, TimerTovoid$()));
+          }, TimerToNull()));
         }
         dart.fn(startPeriodicTimer, VoidTovoid$());
         controller = StreamControllerOfT().new({sync: true, onListen: dart.fn(() => {
             watch.start();
             startPeriodicTimer();
-          }, VoidTovoid$()), onPause: dart.fn(() => {
+          }, VoidToNull()), onPause: dart.fn(() => {
             timer.cancel();
             timer = null;
             watch.stop();
-          }, VoidTovoid$()), onResume: dart.fn(() => {
+          }, VoidToNull()), onResume: dart.fn(() => {
             dart.assert(timer == null);
             let elapsed = watch.elapsed;
             watch.start();
@@ -9976,11 +10389,11 @@
               timer = null;
               startPeriodicTimer();
               sendEvent();
-            }, VoidTovoid$()));
-          }, VoidTovoid$()), onCancel: dart.fn(() => {
+            }, VoidToNull()));
+          }, VoidToNull()), onCancel: dart.fn(() => {
             if (timer != null) timer.cancel();
             timer = null;
-          }, VoidTodynamic$())});
+          }, VoidToNull())});
         return controller.stream;
       }
       static eventTransformed(source, mapSink) {
@@ -10023,25 +10436,25 @@
 
               if (async.Future.is(newValue)) {
                 subscription.pause();
-                newValue.then(dart.dynamic)(add, {onError: addError}).whenComplete(dart.bind(subscription, 'resume'));
+                newValue.then(dart.void)(add, {onError: addError}).whenComplete(dart.bind(subscription, 'resume'));
               } else {
                 controller.add(E.as(newValue));
               }
-            }, TTovoid$()), {onError: addError, onDone: dart.bind(controller, 'close')});
+            }, TToNull()), {onError: addError, onDone: dart.bind(controller, 'close')});
           }).bind(this);
           dart.fn(onListen, VoidTovoid$());
           if (dart.test(this.isBroadcast)) {
             controller = async.StreamController$(E).broadcast({onListen: onListen, onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTovoid$()), sync: true});
+              }, VoidToNull()), sync: true});
           } else {
             controller = async.StreamController$(E).new({onListen: onListen, onPause: dart.fn(() => {
                 subscription.pause();
-              }, VoidTovoid$()), onResume: dart.fn(() => {
+              }, VoidToNull()), onResume: dart.fn(() => {
                 subscription.resume();
-              }, VoidTovoid$()), onCancel: dart.fn(() => {
+              }, VoidToNull()), onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTodynamic$()), sync: true});
+              }, VoidToNull()), sync: true});
           }
           return controller.stream;
         };
@@ -10067,21 +10480,21 @@
                 subscription.pause();
                 controller.addStream(newStream).whenComplete(dart.bind(subscription, 'resume'));
               }
-            }, TTovoid$()), {onError: dart.bind(eventSink, _addError), onDone: dart.bind(controller, 'close')});
+            }, TToNull()), {onError: dart.bind(eventSink, _addError), onDone: dart.bind(controller, 'close')});
           }).bind(this);
           dart.fn(onListen, VoidTovoid$());
           if (dart.test(this.isBroadcast)) {
             controller = async.StreamController$(E).broadcast({onListen: onListen, onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTovoid$()), sync: true});
+              }, VoidToNull()), sync: true});
           } else {
             controller = async.StreamController$(E).new({onListen: onListen, onPause: dart.fn(() => {
                 subscription.pause();
-              }, VoidTovoid$()), onResume: dart.fn(() => {
+              }, VoidToNull()), onResume: dart.fn(() => {
                 subscription.resume();
-              }, VoidTovoid$()), onCancel: dart.fn(() => {
+              }, VoidToNull()), onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTodynamic$()), sync: true});
+              }, VoidToNull()), sync: true});
           }
           return controller.stream;
         };
@@ -10115,12 +10528,12 @@
           if (seenFirst) {
             async._runUserCode(dart.fn(() => combine(value, element), VoidToT()), dart.fn(newValue => {
               value = newValue;
-            }, TTodynamic$()), async._cancelAndErrorClosure(subscription, result));
+            }, TToNull()), async._cancelAndErrorClosure(subscription, result));
           } else {
             value = element;
             seenFirst = true;
           }
-        }, TTovoid$()), {onError: dart.bind(result, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(result, _completeError), onDone: dart.fn(() => {
             if (!seenFirst) {
               try {
                 dart.throw(_internal.IterableElementError.noElement());
@@ -10132,7 +10545,7 @@
             } else {
               result[_complete](value);
             }
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return result;
       }
       fold(S) {
@@ -10143,12 +10556,12 @@
           subscription = this.listen(dart.fn(element => {
             async._runUserCode(dart.fn(() => combine(value, element), dart.definiteFunctionType(S, [])), dart.fn(newValue => {
               value = newValue;
-            }, dart.definiteFunctionType(dart.dynamic, [S])), async._cancelAndErrorClosure(subscription, result));
-          }, TTovoid$()), {onError: dart.fn((e, st) => {
+            }, dart.definiteFunctionType(core.Null, [S])), async._cancelAndErrorClosure(subscription, result));
+          }, TToNull()), {onError: dart.fn((e, st) => {
               result[_completeError](e, core.StackTrace._check(st));
-            }, dynamicAnddynamicTodynamic$()), onDone: dart.fn(() => {
+            }, dynamicAnddynamicToNull()), onDone: dart.fn(() => {
               result[_complete](value);
-            }, VoidTovoid$()), cancelOnError: true});
+            }, VoidToNull()), cancelOnError: true});
           return result;
         };
       }
@@ -10170,11 +10583,11 @@
             async._cancelAndErrorWithReplacement(subscription, result, e, s);
           }
 
-        }, TTovoid$()), {onError: dart.fn(e => {
+        }, TToNull()), {onError: dart.fn(e => {
             result[_completeError](e);
-          }, dynamicTodynamic$()), onDone: dart.fn(() => {
+          }, dynamicToNull$()), onDone: dart.fn(() => {
             result[_complete](buffer.toString());
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return result;
       }
       contains(needle) {
@@ -10185,10 +10598,10 @@
             if (dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, true);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](false);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       forEach(action) {
@@ -10196,10 +10609,10 @@
         let subscription = null;
         subscription = this.listen(dart.fn(element => {
           async._runUserCode(dart.fn(() => action(element), VoidTovoid$()), dart.fn(_ => {
-          }, dynamicTodynamic$()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, dynamicToNull$()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](null);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       every(test) {
@@ -10210,10 +10623,10 @@
             if (!dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, false);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](true);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       any(test) {
@@ -10224,10 +10637,10 @@
             if (dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, true);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](false);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get length() {
@@ -10235,9 +10648,9 @@
         let count = 0;
         this.listen(dart.fn(_ => {
           count++;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](count);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get isEmpty() {
@@ -10245,9 +10658,9 @@
         let subscription = null;
         subscription = this.listen(dart.fn(_ => {
           async._cancelAndValue(subscription, future, false);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](true);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       toList() {
@@ -10255,9 +10668,9 @@
         let future = new (_FutureOfListOfT())();
         this.listen(dart.fn(data => {
           result[dartx.add](data);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](result);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       toSet() {
@@ -10265,9 +10678,9 @@
         let future = new (_FutureOfSetOfT())();
         this.listen(dart.fn(data => {
           result.add(data);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](result);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       drain(E) {
@@ -10297,7 +10710,7 @@
         let subscription = null;
         subscription = this.listen(dart.fn(value => {
           async._cancelAndValue(subscription, future, value);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             try {
               dart.throw(_internal.IterableElementError.noElement());
             } catch (e) {
@@ -10305,7 +10718,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get last() {
@@ -10315,7 +10728,7 @@
         this.listen(dart.fn(value => {
           foundResult = true;
           result = value;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10327,7 +10740,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get single() {
@@ -10348,7 +10761,7 @@
           }
           foundResult = true;
           result = value;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10360,7 +10773,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       firstWhere(test, opts) {
@@ -10372,8 +10785,8 @@
             if (dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, value);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (defaultValue != null) {
               async._runUserCode(defaultValue, dart.bind(future, _complete), dart.bind(future, _completeError));
               return;
@@ -10385,7 +10798,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       lastWhere(test, opts) {
@@ -10400,8 +10813,8 @@
               foundResult = true;
               result = value;
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10417,7 +10830,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       singleWhere(test) {
@@ -10441,8 +10854,8 @@
               foundResult = true;
               result = value;
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10454,7 +10867,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       elementAt(index) {
@@ -10468,9 +10881,9 @@
             return;
           }
           elementIndex = elementIndex + 1;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_completeError](core.RangeError.index(index, this, "index", null, elementIndex));
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       timeout(timeLimit, opts) {
@@ -10504,7 +10917,7 @@
           if (onTimeout == null) {
             timeout = dart.fn(() => {
               controller.addError(new async.TimeoutException("No stream event", timeLimit), null);
-            }, VoidTovoid$());
+            }, VoidToNull());
           } else {
             let registeredOnTimeout = zone.registerUnaryCallback(dart.dynamic, EventSinkOfT())(onTimeout);
             let wrapper = new async._ControllerEventSinkWrapper(null);
@@ -10512,7 +10925,7 @@
               wrapper[_sink] = controller;
               zone.runUnaryGuarded(dart.dynamic, EventSinkOfT())(registeredOnTimeout, wrapper);
               wrapper[_sink] = null;
-            }, VoidTovoid$());
+            }, VoidToNull());
           }
           subscription = this.listen(onData, {onError: onError, onDone: onDone});
           timer = zone.createTimer(timeLimit, timeout);
@@ -10528,10 +10941,10 @@
         controller = dart.test(this.isBroadcast) ? new (_SyncBroadcastStreamControllerOfT())(onListen, onCancel) : new (_SyncStreamControllerOfT())(onListen, dart.fn(() => {
           timer.cancel();
           subscription.pause();
-        }, VoidTovoid$()), dart.fn(() => {
+        }, VoidToNull()), dart.fn(() => {
           subscription.resume();
           timer = zone.createTimer(timeLimit, timeout);
-        }, VoidTovoid$()), onCancel);
+        }, VoidToNull()), onCancel);
         return controller.stream;
       }
     }
@@ -10664,7 +11077,7 @@
         }).bind(this);
         dart.fn(internalCallback, VoidTovoid$());
         _isolate_helper.enterJsAsync();
-        this[_handle] = self.setTimeout(internalCallback, milliseconds);
+        this[_handle] = _isolate_helper.global.setTimeout(internalCallback, milliseconds);
       } else {
         dart.assert(dart.notNull(milliseconds) > 0);
         dart.throw(new core.UnsupportedError("Timer greater than 0."));
@@ -10676,9 +11089,9 @@
       this[_handle] = null;
       if (dart.test(_isolate_helper.hasTimer())) {
         _isolate_helper.enterJsAsync();
-        this[_handle] = self.setInterval(dart.fn(() => {
+        this[_handle] = _isolate_helper.global.setInterval(dart.fn(() => {
           callback(this);
-        }, VoidTodynamic$()), milliseconds);
+        }, VoidToNull()), milliseconds);
       } else {
         dart.throw(new core.UnsupportedError("Periodic timer."));
       }
@@ -10691,9 +11104,9 @@
         if (this[_handle] == null) return;
         _isolate_helper.leaveJsAsync();
         if (dart.test(this[_once])) {
-          self.clearTimeout(this[_handle]);
+          _isolate_helper.global.clearTimeout(this[_handle]);
         } else {
-          self.clearInterval(this[_handle]);
+          _isolate_helper.global.clearInterval(this[_handle]);
         }
         this[_handle] = null;
       } else {
@@ -10720,7 +11133,7 @@
     methods: () => ({cancel: dart.definiteFunctionType(dart.void, [])})
   });
   _isolate_helper.hasTimer = function() {
-    return self.setTimeout != null;
+    return _isolate_helper.global.setTimeout != null;
   };
   dart.lazyFn(_isolate_helper.hasTimer, () => VoidTobool());
   _isolate_helper.CapabilityImpl = class CapabilityImpl extends core.Object {
@@ -11881,6 +12294,30 @@
     constructors: () => ({new: dart.definiteFunctionType(_js_helper.RuntimeError, [dart.dynamic])}),
     fields: () => ({message: dart.dynamic})
   });
+  core.AssertionError = class AssertionError extends core.Error {
+    new() {
+      super.new();
+    }
+    toString() {
+      return "Assertion failed";
+    }
+  };
+  dart.setSignature(core.AssertionError, {
+    constructors: () => ({new: dart.definiteFunctionType(core.AssertionError, [])})
+  });
+  _js_helper.AssertionErrorWithMessage = class AssertionErrorWithMessage extends core.AssertionError {
+    new(message) {
+      this[_message] = message;
+      super.new();
+    }
+    toString() {
+      return dart.str`Assertion failed: ${this[_message]}`;
+    }
+  };
+  dart.setSignature(_js_helper.AssertionErrorWithMessage, {
+    constructors: () => ({new: dart.definiteFunctionType(_js_helper.AssertionErrorWithMessage, [core.Object])}),
+    fields: () => ({[_message]: core.Object})
+  });
   _js_helper.random64 = function() {
     let int32a = Math.random() * 0x100000000 >>> 0;
     let int32b = Math.random() * 0x100000000 >>> 0;
@@ -12011,17 +12448,6 @@
     return SyncIterable;
   });
   _js_helper.SyncIterable = SyncIterable();
-  core.AssertionError = class AssertionError extends core.Error {
-    new() {
-      super.new();
-    }
-    toString() {
-      return "Assertion failed";
-    }
-  };
-  dart.setSignature(core.AssertionError, {
-    constructors: () => ({new: dart.definiteFunctionType(core.AssertionError, [])})
-  });
   _js_helper.BooleanConversionAssertionError = class BooleanConversionAssertionError extends core.AssertionError {
     new() {
       super.new();
@@ -12096,14 +12522,14 @@
     let LinkedHashMapKeyIterableOfK = () => (LinkedHashMapKeyIterableOfK = dart.constFn(_js_helper.LinkedHashMapKeyIterable$(K)))();
     let MappedIterableOfK$V = () => (MappedIterableOfK$V = dart.constFn(_internal.MappedIterable$(K, V)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let LinkedHashMapCellOfK$V = () => (LinkedHashMapCellOfK$V = dart.constFn(_js_helper.LinkedHashMapCell$(K, V)))();
     let LinkedHashMapOfK$V = () => (LinkedHashMapOfK$V = dart.constFn(collection.LinkedHashMap$(K, V)))();
     let InternalMapOfK$V = () => (InternalMapOfK$V = dart.constFn(_js_helper.InternalMap$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
     let KToV = () => (KToV = dart.constFn(dart.definiteFunctionType(V, [K])))();
     let KTobool = () => (KTobool = dart.constFn(dart.definiteFunctionType(core.bool, [K])))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     class JsLinkedHashMap extends core.Object {
       new() {
         this[_length$0] = 0;
@@ -12158,7 +12584,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       _get(key) {
         if (dart.test(_js_helper.JsLinkedHashMap._isStringKey(key))) {
@@ -12472,12 +12898,6 @@
         return new Map();
       }
     }
-    dart.setSignature(Es6LinkedHashMap, {
-      methods: () => ({
-        [_getTableCell]: dart.definiteFunctionType(_js_helper.LinkedHashMapCell$(K, V), [dart.dynamic, dart.dynamic]),
-        [_getTableBucket]: dart.definiteFunctionType(core.List$(_js_helper.LinkedHashMapCell$(K, V)), [dart.dynamic, dart.dynamic])
-      })
-    });
     return Es6LinkedHashMap;
   });
   _js_helper.Es6LinkedHashMap = Es6LinkedHashMap();
@@ -12542,8 +12962,7 @@
     dart.setSignature(LinkedHashMapKeyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_js_helper.LinkedHashMapKeyIterable$(E), [JsLinkedHashMapOfE$dynamic()])}),
       fields: () => ({[_map]: JsLinkedHashMapOfE$dynamic()}),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(LinkedHashMapKeyIterable, [
       'contains',
@@ -12991,10 +13410,7 @@
       [_pattern]: core.String,
       [_index$0]: core.int
     }),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(core.Match), []),
-      first: dart.definiteFunctionType(core.Match, [])
-    })
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(core.Match), [])})
   });
   dart.defineExtensionMembers(_js_helper._StringAllMatchesIterable, ['iterator', 'first']);
   _js_helper._StringAllMatchesIterator = class _StringAllMatchesIterator extends core.Object {
@@ -13264,11 +13680,11 @@
     }
   });
   _js_mirrors._dload = function(obj, name) {
-    return _js_mirrors._dart.dload(obj, name);
+    return _js_mirrors._dart.dloadMirror(obj, name);
   };
   dart.lazyFn(_js_mirrors._dload, () => dynamicAndStringTodynamic());
   _js_mirrors._dput = function(obj, name, val) {
-    _js_mirrors._dart.dput(obj, name, val);
+    _js_mirrors._dart.dputMirror(obj, name, val);
   };
   dart.lazyFn(_js_mirrors._dput, () => dynamicAndStringAnddynamicTovoid());
   _js_mirrors._dcall = function(obj, args) {
@@ -13309,7 +13725,31 @@
     if (privateSymbol != null) {
       return privateSymbol;
     }
-    return _js_mirrors.getName(symbol);
+    let name = _js_mirrors.getName(symbol);
+    switch (name) {
+      case '[]':
+      {
+        name = '_get';
+        break;
+      }
+      case '[]=':
+      {
+        name = '_set';
+        break;
+      }
+      case 'unary-':
+      {
+        name = '_negate';
+        break;
+      }
+      case 'constructor':
+      case 'prototype':
+      {
+        name = dart.str`_${name}`;
+        break;
+      }
+    }
+    return name;
   };
   dart.lazyFn(_js_mirrors._getMember, () => SymbolTodynamic());
   _js_mirrors._getNameForESSymbol = function(member) {
@@ -13414,7 +13854,7 @@
     let obj = {};
     map[dartx.forEach](dart.fn((key, value) => {
       obj[_js_mirrors.getName(key)] = value;
-    }, SymbolAnddynamicTovoid()));
+    }, SymbolAnddynamicToNull()));
     return obj;
   };
   dart.lazyFn(_js_mirrors._toJsMap, () => MapOfSymbol$dynamicTodynamic());
@@ -13629,7 +14069,7 @@
         constructors[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         if (dart.test(constructors[dartx.isEmpty])) {
           let name = 'new';
           let ft = _js_mirrors._defaultConstructorType(_js_mirrors._unwrap(this[_cls]));
@@ -13644,23 +14084,23 @@
             t = dart.dindex(t, 0);
           }
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let methods = _js_mirrors._getMethods(unwrapped);
         methods[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let getters = _js_mirrors._getGetters(unwrapped);
         getters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let setters = _js_mirrors._getSetters(unwrapped);
         setters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
           symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let staticFields = _js_mirrors._getStaticFields(unwrapped);
         staticFields[dartx.forEach](dart.fn((symbol, t) => {
           let name = _js_mirrors.getName(symbol);
@@ -13670,22 +14110,22 @@
             t = dart.dindex(t, 0);
           }
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let statics = _js_mirrors._getStatics(unwrapped);
         statics[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let staticGetters = _js_mirrors._getStaticGetters(unwrapped);
         staticGetters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let staticSetters = _js_mirrors._getStaticSetters(unwrapped);
         staticSetters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         this[_declarations] = MapOfSymbol$DeclarationMirror().unmodifiable(this[_declarations]);
       }
       return this[_declarations];
@@ -13853,21 +14293,21 @@
     })
   });
   const _symbol = Symbol('_symbol');
-  const _name$ = Symbol('_name');
+  const _name$0 = Symbol('_name');
   _js_mirrors.JsVariableMirror = class JsVariableMirror extends _js_mirrors.JsMirror {
     get simpleName() {
       return this[_symbol];
     }
     _(symbol, t, annotations) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.type = _js_mirrors.reflectType(t);
       this.metadata = ListOfInstanceMirror().unmodifiable(annotations[dartx.map](mirrors.InstanceMirror)(dart.fn(a => _js_mirrors.reflect(a), dynamicToInstanceMirror())));
       this.isStatic = false;
       this.isFinal = false;
     }
     toString() {
-      return dart.str`VariableMirror on '${this[_name$]}'`;
+      return dart.str`VariableMirror on '${this[_name$0]}'`;
     }
     get qualifiedName() {
       return core.Symbol._check(this.noSuchMethod(new dart.InvocationImpl('qualifiedName', [], {isGetter: true})));
@@ -13894,7 +14334,7 @@
     constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.Symbol, core.Type, core.List])}),
     fields: () => ({
       [_symbol]: core.Symbol,
-      [_name$]: core.String,
+      [_name$0]: core.String,
       type: mirrors.TypeMirror,
       metadata: ListOfInstanceMirror(),
       isStatic: core.bool,
@@ -13907,7 +14347,7 @@
       super._(member, t, annotations);
     }
     toString() {
-      return dart.str`ParameterMirror on '${this[_name$]}'`;
+      return dart.str`ParameterMirror on '${this[_name$0]}'`;
     }
     get qualifiedName() {
       return core.Symbol._check(this.noSuchMethod(new dart.InvocationImpl('qualifiedName', [], {isGetter: true})));
@@ -13952,17 +14392,17 @@
   let const$4;
   _js_mirrors.JsMethodMirror = class JsMethodMirror extends _js_mirrors.JsMirror {
     get isSetter() {
-      return this[_name$][dartx.endsWith]('=');
+      return this[_name$0][dartx.endsWith]('=');
     }
     get isPrivate() {
-      return this[_name$][dartx.startsWith]('_');
+      return this[_name$0][dartx.startsWith]('_');
     }
     get simpleName() {
       return this[_symbol];
     }
     _constructor(cls, symbol, ftype) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.isConstructor = true;
       this.isStatic = false;
       this[_params] = null;
@@ -13972,7 +14412,7 @@
     }
     _instanceMethod(cls, symbol, ftype) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.isConstructor = false;
       this.isStatic = false;
       this[_params] = null;
@@ -13982,7 +14422,7 @@
     }
     _staticMethod(cls, symbol, ftype) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.isConstructor = false;
       this.isStatic = true;
       this[_params] = null;
@@ -14032,7 +14472,7 @@
       this[_params] = ListOfParameterMirror().unmodifiable(params);
     }
     toString() {
-      return dart.str`MethodMirror on '${this[_name$]}'`;
+      return dart.str`MethodMirror on '${this[_name$0]}'`;
     }
     get qualifiedName() {
       return core.Symbol._check(this.noSuchMethod(new dart.InvocationImpl('qualifiedName', [], {isGetter: true})));
@@ -14092,7 +14532,7 @@
     }),
     fields: () => ({
       [_symbol]: core.Symbol,
-      [_name$]: core.String,
+      [_name$0]: core.String,
       [_params]: ListOfParameterMirror(),
       [_metadata$]: ListOfInstanceMirror(),
       isConstructor: core.bool,
@@ -14939,8 +15379,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(typed_data.Float32x4, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float32x4]),
-      sublist: dart.definiteFunctionType(core.List$(typed_data.Float32x4), [core.int], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float32x4])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeFloat32x4List, [
@@ -15572,8 +16011,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(typed_data.Int32x4, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Int32x4]),
-      sublist: dart.definiteFunctionType(core.List$(typed_data.Int32x4), [core.int], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Int32x4])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeInt32x4List, [
@@ -15689,8 +16127,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(typed_data.Float64x2, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float64x2]),
-      sublist: dart.definiteFunctionType(core.List$(typed_data.Float64x2), [core.int], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float64x2])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeFloat64x2List, [
@@ -16055,8 +16492,7 @@
     getters: () => ({length: dart.definiteFunctionType(core.int, [])}),
     methods: () => ({
       _get: dart.definiteFunctionType(core.double, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, core.num]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfdouble()], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, core.num])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeTypedArrayOfDouble, ['_get', '_set', 'setRange', 'length']);
@@ -16089,10 +16525,7 @@
   _native_typed_data.NativeTypedArrayOfInt[dart.implements] = () => [ListOfint()];
   dart.setSignature(_native_typed_data.NativeTypedArrayOfInt, {
     getters: () => ({length: dart.definiteFunctionType(core.int, [])}),
-    methods: () => ({
-      _set: dart.definiteFunctionType(dart.void, [core.int, core.int]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfint()], [core.int])
-    })
+    methods: () => ({_set: dart.definiteFunctionType(dart.void, [core.int, core.int])})
   });
   dart.defineExtensionMembers(_native_typed_data.NativeTypedArrayOfInt, ['_set', 'setRange', 'length']);
   dart.defineExtensionNames([
@@ -16136,7 +16569,6 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [ListOfdouble()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({[dartx.sublist]: dart.definiteFunctionType(core.List$(core.double), [core.int], [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [dart.dynamic, dart.dynamic]),
@@ -16186,7 +16618,6 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [ListOfdouble()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({[dartx.sublist]: dart.definiteFunctionType(core.List$(core.double), [core.int], [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [dart.dynamic, dart.dynamic]),
@@ -16241,10 +16672,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [_native_typed_data.NativeByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [dart.dynamic, dart.dynamic]),
@@ -16299,10 +16727,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [dart.dynamic, dart.dynamic]),
@@ -16357,10 +16782,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [dart.dynamic, dart.dynamic]),
@@ -16415,10 +16837,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [dart.dynamic, dart.dynamic]),
@@ -16473,10 +16892,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [dart.dynamic, dart.dynamic]),
@@ -16538,10 +16954,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [dart.dynamic, dart.dynamic]),
@@ -16604,10 +17017,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [dart.dynamic, dart.dynamic]),
@@ -17300,6 +17710,8 @@
     return end;
   };
   dart.fn(_native_typed_data._checkValidRange, intAndintAndintToint());
+  async._Callback = dart.typedef('_Callback', () => dart.functionType(dart.void, []));
+  async._TakeCallback = dart.typedef('_TakeCallback', () => dart.functionType(dart.void, [async._Callback]));
   async._invokeErrorHandler = function(errorHandler, error, stackTrace) {
     if (async.ZoneBinaryCallback.is(errorHandler)) {
       return dart.dcall(errorHandler, error, stackTrace);
@@ -17419,10 +17831,7 @@
     dart.setSignature(_ControllerStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._ControllerStream$(T), [_StreamControllerLifecycleOfT()])}),
       fields: () => ({[_controller$]: _StreamControllerLifecycleOfT()}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        '==': dart.definiteFunctionType(core.bool, [core.Object])
-      })
+      methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])})
     });
     return _ControllerStream;
   });
@@ -17527,7 +17936,7 @@
       }
       onDone(handleDone) {
         if (handleDone == null) handleDone = async._nullDoneHandler;
-        this[_onDone] = this[_zone].registerCallback(dart.dynamic)(handleDone);
+        this[_onDone] = this[_zone].registerCallback(dart.void)(handleDone);
       }
       pause(resumeSignal) {
         if (resumeSignal === void 0) resumeSignal = null;
@@ -17566,11 +17975,11 @@
           let result = new (async._Future$(E))();
           this[_onDone] = dart.fn(() => {
             result[_complete](futureValue);
-          }, VoidTovoid$());
+          }, VoidToNull());
           this[_onError] = dart.fn((error, stackTrace) => {
             this.cancel();
             result[_completeError](error, core.StackTrace._check(stackTrace));
-          }, dynamicAnddynamicTodynamic$());
+          }, dynamicAnddynamicToNull());
           return result;
         };
       }
@@ -17680,7 +18089,7 @@
         dart.assert(!dart.test(this[_inCallback]));
         let wasInputPaused = this[_isInputPaused];
         this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-        this[_zone].runUnaryGuarded(dart.dynamic, T)(this[_onData], data);
+        this[_zone].runUnaryGuarded(dart.void, T)(this[_onData], data);
         this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
         this[_checkState](wasInputPaused);
       }
@@ -17721,7 +18130,7 @@
         const sendDone = (function() {
           if (!dart.test(this[_waitsForCancel])) return;
           this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_CANCELED | async._BufferingStreamSubscription._STATE_CLOSED | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-          this[_zone].runGuarded(dart.dynamic)(this[_onDone]);
+          this[_zone].runGuarded(dart.void)(this[_onDone]);
           this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
         }).bind(this);
         dart.fn(sendDone, VoidTovoid$());
@@ -17737,7 +18146,7 @@
         dart.assert(!dart.test(this[_inCallback]));
         let wasInputPaused = this[_isInputPaused];
         this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-        dart.dcall(callback);
+        callback();
         this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
         this[_checkState](wasInputPaused);
       }
@@ -17818,7 +18227,7 @@
         [_sendData]: dart.definiteFunctionType(dart.void, [T]),
         [_sendError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
         [_sendDone]: dart.definiteFunctionType(dart.void, []),
-        [_guardCallback]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+        [_guardCallback]: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
         [_checkState]: dart.definiteFunctionType(dart.void, [core.bool])
       }),
       sfields: () => ({
@@ -18246,7 +18655,7 @@
   async._SyncBroadcastStreamController$ = dart.generic(T => {
     let _BufferingStreamSubscriptionOfT = () => (_BufferingStreamSubscriptionOfT = dart.constFn(async._BufferingStreamSubscription$(T)))();
     let SynchronousStreamControllerOfT = () => (SynchronousStreamControllerOfT = dart.constFn(async.SynchronousStreamController$(T)))();
-    let _BufferingStreamSubscriptionOfTTovoid = () => (_BufferingStreamSubscriptionOfTTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [_BufferingStreamSubscriptionOfT()])))();
+    let _BufferingStreamSubscriptionOfTToNull = () => (_BufferingStreamSubscriptionOfTToNull = dart.constFn(dart.definiteFunctionType(core.Null, [_BufferingStreamSubscriptionOfT()])))();
     class _SyncBroadcastStreamController extends async._BroadcastStreamController$(T) {
       new(onListen, onCancel) {
         super.new(onListen, onCancel);
@@ -18275,19 +18684,19 @@
         }
         this[_forEachListener](dart.fn(subscription => {
           subscription[_add$](data);
-        }, _BufferingStreamSubscriptionOfTTovoid()));
+        }, _BufferingStreamSubscriptionOfTToNull()));
       }
       [_sendError](error, stackTrace) {
         if (dart.test(this[_isEmpty])) return;
         this[_forEachListener](dart.fn(subscription => {
           subscription[_addError](error, stackTrace);
-        }, _BufferingStreamSubscriptionOfTTovoid()));
+        }, _BufferingStreamSubscriptionOfTToNull()));
       }
       [_sendDone]() {
         if (!dart.test(this[_isEmpty])) {
           this[_forEachListener](dart.fn(subscription => {
             subscription[_close$]();
-          }, _BufferingStreamSubscriptionOfTTovoid()));
+          }, _BufferingStreamSubscriptionOfTToNull()));
         } else {
           dart.assert(this[_doneFuture] != null);
           dart.assert(this[_doneFuture][_mayComplete]);
@@ -18414,10 +18823,7 @@
       constructors: () => ({new: dart.definiteFunctionType(async._AsBroadcastStreamController$(T), [VoidTovoid(), VoidTovoid()])}),
       fields: () => ({[_pending]: _StreamImplEventsOfT()}),
       getters: () => ({[_hasPending]: dart.definiteFunctionType(core.bool, [])}),
-      methods: () => ({
-        [_addPendingEvent]: dart.definiteFunctionType(dart.void, [async._DelayedEvent]),
-        add: dart.definiteFunctionType(dart.void, [T])
-      })
+      methods: () => ({[_addPendingEvent]: dart.definiteFunctionType(dart.void, [async._DelayedEvent])})
     });
     return _AsBroadcastStreamController;
   });
@@ -18436,7 +18842,7 @@
       onDone(handleDone) {}
       pause(resumeSignal) {
         if (resumeSignal === void 0) resumeSignal = null;
-        if (resumeSignal != null) resumeSignal.then(dart.dynamic)(dart.bind(this, _resume));
+        if (resumeSignal != null) resumeSignal.then(dart.void)(dart.bind(this, _resume));
         this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
       }
       resume() {
@@ -18511,6 +18917,20 @@
     constructors: () => ({new: dart.definiteFunctionType(async.DeferredLoadException, [core.String])}),
     fields: () => ({[_s]: core.String})
   });
+  async.FutureOr$ = dart.generic(T => {
+    class FutureOr extends core.Object {
+      _() {
+        dart.throw(new core.UnsupportedError("FutureOr can't be instantiated"));
+      }
+    }
+    dart.addTypeTests(FutureOr);
+    dart.defineNamedConstructor(FutureOr, '_');
+    dart.setSignature(FutureOr, {
+      constructors: () => ({_: dart.definiteFunctionType(async.FutureOr$(T), [])})
+    });
+    return FutureOr;
+  });
+  async.FutureOr = FutureOr();
   const _completeWithValue = Symbol('_completeWithValue');
   let const$8;
   async.Future$ = dart.flattenFutures(dart.generic(T => {
@@ -18527,7 +18947,7 @@
             async._completeWithErrorCallback(result, e, s);
           }
 
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         return result;
       }
       static microtask(computation) {
@@ -18540,7 +18960,7 @@
             async._completeWithErrorCallback(result, e, s);
           }
 
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         return result;
       }
       static sync(computation) {
@@ -18574,13 +18994,13 @@
         let result = new (_FutureOfT())();
         async.Timer.new(duration, dart.fn(() => {
           try {
-            result[_complete](computation == null ? null : computation());
+            result[_complete](dart.nullSafe(computation, _ => _()));
           } catch (e) {
             let s = dart.stackTrace(e);
             async._completeWithErrorCallback(result, e, s);
           }
 
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         return result;
       }
       static wait(T) {
@@ -18600,7 +19020,7 @@
                   if (value != null) {
                     async.Future.sync(dart.fn(() => {
                       cleanUp(value);
-                    }, VoidTodynamic$()));
+                    }, VoidToNull()));
                   }
                 }
               }
@@ -18616,31 +19036,43 @@
             }
           }
           dart.fn(handleError, dynamicAnddynamicTovoid$());
-          for (let future of futures) {
-            let pos = remaining++;
-            future.then(dart.dynamic)(dart.fn(value => {
-              remaining--;
-              if (values != null) {
-                values[dartx._set](pos, value);
-                if (remaining == 0) {
-                  result[_completeWithValue](values);
+          try {
+            for (let future of futures) {
+              let pos = remaining;
+              future.then(dart.dynamic)(dart.fn(value => {
+                remaining--;
+                if (values != null) {
+                  values[dartx._set](pos, value);
+                  if (remaining == 0) {
+                    result[_completeWithValue](values);
+                  }
+                } else {
+                  if (cleanUp != null && value != null) {
+                    async.Future.sync(dart.fn(() => {
+                      cleanUp(value);
+                    }, VoidToNull()));
+                  }
+                  if (remaining == 0 && !dart.test(eagerError)) {
+                    result[_completeError](error, stackTrace);
+                  }
                 }
-              } else {
-                if (cleanUp != null && value != null) {
-                  async.Future.sync(dart.fn(() => {
-                    cleanUp(value);
-                  }, VoidTodynamic$()));
-                }
-                if (remaining == 0 && !dart.test(eagerError)) {
-                  result[_completeError](error, stackTrace);
-                }
-              }
-            }, dart.definiteFunctionType(dart.dynamic, [T])), {onError: handleError});
+              }, dart.definiteFunctionType(core.Null, [T])), {onError: handleError});
+              remaining++;
+            }
+            if (remaining == 0) {
+              return async.Future$(core.List$(T)).value(const$8 || (const$8 = dart.constList([], dart.dynamic)));
+            }
+            values = core.List$(T).new(remaining);
+          } catch (e) {
+            let st = dart.stackTrace(e);
+            if (remaining == 0 || dart.test(eagerError)) {
+              return async.Future$(core.List$(T)).error(e, st);
+            } else {
+              error = e;
+              stackTrace = st;
+            }
           }
-          if (remaining == 0) {
-            return async.Future$(core.List$(T)).value(const$8 || (const$8 = dart.constList([], dart.dynamic)));
-          }
-          values = core.List$(T).new(remaining);
+
           return result;
         };
       }
@@ -18649,10 +19081,10 @@
           let completer = async.Completer$(T).sync();
           let onValue = dart.fn(value => {
             if (!dart.test(completer.isCompleted)) completer.complete(value);
-          }, dart.definiteFunctionType(dart.dynamic, [T]));
+          }, dart.definiteFunctionType(core.Null, [T]));
           let onError = dart.fn((error, stack) => {
             if (!dart.test(completer.isCompleted)) completer.completeError(error, core.StackTrace._check(stack));
-          }, dynamicAnddynamicTodynamic$());
+          }, dynamicAnddynamicToNull());
           for (let future of futures) {
             future.then(dart.dynamic)(onValue, {onError: onError});
           }
@@ -18671,11 +19103,11 @@
         let nextIteration = null;
         nextIteration = async.Zone.current.bindUnaryCallback(dart.dynamic, core.bool)(dart.fn(keepGoing => {
           if (dart.test(keepGoing)) {
-            async.Future.sync(f).then(dart.dynamic)(dynamicTodynamic()._check(nextIteration), {onError: dart.bind(doneSignal, _completeError)});
+            async.Future.sync(f).then(dart.dynamic)(dynamicToFutureOr()._check(nextIteration), {onError: dart.bind(doneSignal, _completeError)});
           } else {
             doneSignal[_complete](null);
           }
-        }, boolTodynamic()), {runGuarded: true});
+        }, boolToNull()), {runGuarded: true});
         dart.dcall(nextIteration, true);
         return doneSignal;
       }
@@ -19012,6 +19444,7 @@
   const _setChained = Symbol('_setChained');
   const _thenNoZoneRegistration = Symbol('_thenNoZoneRegistration');
   const _setPendingComplete = Symbol('_setPendingComplete');
+  const _clearPendingComplete = Symbol('_clearPendingComplete');
   const _error = Symbol('_error');
   const _chainSource = Symbol('_chainSource');
   const _setValue = Symbol('_setValue');
@@ -19027,7 +19460,7 @@
     let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
     let FutureOfT = () => (FutureOfT = dart.constFn(async.Future$(T)))();
     let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
-    let TTodynamic$ = () => (TTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [T])))();
+    let TToNull = () => (TToNull = dart.constFn(dart.definiteFunctionType(core.Null, [T])))();
     class _Future extends core.Object {
       new() {
         this[_zone] = async.Zone.current;
@@ -19076,7 +19509,7 @@
           let currentZone = async.Zone.current;
           let registered = null;
           if (!core.identical(currentZone, async._ROOT_ZONE)) {
-            f = currentZone.registerUnaryCallback(dart.dynamic, T)(f);
+            f = currentZone.registerUnaryCallback(async.FutureOr$(E), T)(f);
             if (onError != null) {
               onError = async._registerErrorHandler(T)(onError, currentZone);
             }
@@ -19116,6 +19549,10 @@
         dart.assert(this[_mayComplete]);
         this[_state] = async._Future._PENDING_COMPLETE;
       }
+      [_clearPendingComplete]() {
+        dart.assert(this[_isPendingComplete]);
+        this[_state] = async._Future._INCOMPLETE;
+      }
       get [_error]() {
         dart.assert(this[_hasError]);
         return async.AsyncError._check(this[_resultOrListeners]);
@@ -19161,7 +19598,7 @@
           dart.assert(this[_isComplete]);
           this[_zone].scheduleMicrotask(dart.fn(() => {
             async._Future._propagateToListeners(this, listener);
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
       }
       [_prependListeners](listeners) {
@@ -19189,7 +19626,7 @@
           listeners = this[_reverseListeners](listeners);
           this[_zone].scheduleMicrotask(dart.fn(() => {
             async._Future._propagateToListeners(this, listeners);
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
       }
       [_removeListeners]() {
@@ -19216,17 +19653,18 @@
         try {
           source.then(dart.dynamic)(dart.fn(value => {
             dart.assert(target[_isPendingComplete]);
-            target[_completeWithValue](value);
-          }, dynamicTodynamic$()), {onError: dart.fn((error, stackTrace) => {
+            target[_clearPendingComplete]();
+            target[_complete](value);
+          }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
               if (stackTrace === void 0) stackTrace = null;
               dart.assert(target[_isPendingComplete]);
               target[_completeError](error, core.StackTrace._check(stackTrace));
-            }, dynamic__Todynamic())});
+            }, dynamic__ToNull())});
         } catch (e) {
           let s = dart.stackTrace(e);
           async.scheduleMicrotask(dart.fn(() => {
             target[_completeError](e, s);
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
 
       }
@@ -19284,7 +19722,7 @@
               this[_setPendingComplete]();
               this[_zone].scheduleMicrotask(dart.fn(() => {
                 async._Future._chainCoreFuture(coreFuture, this);
-              }, VoidTovoid$()));
+              }, VoidToNull()));
             } else {
               async._Future._chainCoreFuture(coreFuture, this);
             }
@@ -19297,14 +19735,14 @@
         this[_setPendingComplete]();
         this[_zone].scheduleMicrotask(dart.fn(() => {
           this[_completeWithValue](typedValue);
-        }, VoidTovoid$()));
+        }, VoidToNull()));
       }
       [_asyncCompleteError](error, stackTrace) {
         dart.assert(!dart.test(this[_isComplete]));
         this[_setPendingComplete]();
         this[_zone].scheduleMicrotask(dart.fn(() => {
           this[_completeError](error, stackTrace);
-        }, VoidTovoid$()));
+        }, VoidToNull()));
       }
       static _propagateToListeners(source, listeners) {
         while (true) {
@@ -19448,7 +19886,7 @@
         if (onTimeout == null) {
           timer = async.Timer.new(timeLimit, dart.fn(() => {
             result[_completeError](new async.TimeoutException("Future not completed", timeLimit));
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         } else {
           let zone = async.Zone.current;
           onTimeout = zone.registerCallback(dart.dynamic)(onTimeout);
@@ -19460,19 +19898,19 @@
               result[_completeError](e, s);
             }
 
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
         this.then(dart.dynamic)(dart.fn(v => {
           if (dart.test(timer.isActive)) {
             timer.cancel();
             result[_completeWithValue](v);
           }
-        }, TTodynamic$()), {onError: dart.fn((e, s) => {
+        }, TToNull()), {onError: dart.fn((e, s) => {
             if (dart.test(timer.isActive)) {
               timer.cancel();
               result[_completeError](e, core.StackTrace._check(s));
             }
-          }, dynamicAnddynamicTodynamic$())});
+          }, dynamicAnddynamicToNull())});
         return result;
       }
     }
@@ -19503,12 +19941,13 @@
       }),
       methods: () => ({
         [_setChained]: dart.definiteFunctionType(dart.void, [async._Future]),
-        then: dart.definiteFunctionType(E => [async.Future$(E), [TTodynamic()], {onError: core.Function}]),
+        then: dart.definiteFunctionType(E => [async.Future$(E), [dart.functionType(async.FutureOr$(E), [T])], {onError: core.Function}]),
         [_thenNoZoneRegistration]: dart.definiteFunctionType(E => [async.Future$(E), [TTodynamic(), core.Function]]),
         catchError: dart.definiteFunctionType(async.Future$(T), [core.Function], {test: dynamicTobool()}),
         whenComplete: dart.definiteFunctionType(async.Future$(T), [VoidTodynamic()]),
         asStream: dart.definiteFunctionType(async.Stream$(T), []),
         [_setPendingComplete]: dart.definiteFunctionType(dart.void, []),
+        [_clearPendingComplete]: dart.definiteFunctionType(dart.void, []),
         [_setValue]: dart.definiteFunctionType(dart.void, [T]),
         [_setErrorObject]: dart.definiteFunctionType(dart.void, [async.AsyncError]),
         [_setError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
@@ -19629,41 +20068,41 @@
     }
     let implementation = currentZone[_scheduleMicrotask];
     if (core.identical(async._ROOT_ZONE, implementation.zone) && dart.test(async._ROOT_ZONE.inSameErrorZone(currentZone))) {
-      async._rootScheduleMicrotask(null, null, currentZone, currentZone.registerCallback(dart.dynamic)(callback));
+      async._rootScheduleMicrotask(null, null, currentZone, currentZone.registerCallback(dart.void)(callback));
       return;
     }
-    async.Zone.current.scheduleMicrotask(async.Zone.current.bindCallback(dart.dynamic)(callback, {runGuarded: true}));
+    async.Zone.current.scheduleMicrotask(async.Zone.current.bindCallback(dart.void)(callback, {runGuarded: true}));
   };
   dart.fn(async.scheduleMicrotask, _AsyncCallbackTovoid());
   async._AsyncRun = class _AsyncRun extends core.Object {
     static _scheduleImmediate(callback) {
-      dart.dcall(async._AsyncRun._scheduleImmediateClosure, callback);
+      async._AsyncRun._scheduleImmediateClosure(callback);
     }
     static _initializeScheduleImmediate() {
-      if (self.scheduleImmediate != null) {
+      if (_isolate_helper.global.scheduleImmediate != null) {
         return async._AsyncRun._scheduleImmediateJsOverride;
       }
-      if (self.MutationObserver != null && self.document != null) {
-        let div = self.document.createElement("div");
-        let span = self.document.createElement("span");
+      if (_isolate_helper.global.MutationObserver != null && _isolate_helper.global.document != null) {
+        let div = _isolate_helper.global.document.createElement("div");
+        let span = _isolate_helper.global.document.createElement("span");
         let storedCallback = null;
         function internalCallback(_) {
           _isolate_helper.leaveJsAsync();
           let f = storedCallback;
           storedCallback = null;
-          dart.dcall(f);
+          f();
         }
-        dart.fn(internalCallback, dynamicTodynamic$());
+        dart.fn(internalCallback, dynamicToNull$());
         ;
-        let observer = new self.MutationObserver(internalCallback);
+        let observer = new _isolate_helper.global.MutationObserver(internalCallback);
         observer.observe(div, {childList: true});
         return dart.fn(callback => {
           dart.assert(storedCallback == null);
           _isolate_helper.enterJsAsync();
           storedCallback = callback;
           div.firstChild ? div.removeChild(span) : div.appendChild(span);
-        }, FnTodynamic());
-      } else if (self.setImmediate != null) {
+        }, FnToNull());
+      } else if (_isolate_helper.global.setImmediate != null) {
         return async._AsyncRun._scheduleImmediateWithSetImmediate;
       }
       return async._AsyncRun._scheduleImmediateWithTimer;
@@ -19673,30 +20112,30 @@
         _isolate_helper.leaveJsAsync();
         callback();
       }
-      dart.fn(internalCallback, VoidTodynamic$());
+      dart.fn(internalCallback, VoidToNull());
       ;
       _isolate_helper.enterJsAsync();
-      self.scheduleImmediate(internalCallback);
+      _isolate_helper.global.scheduleImmediate(internalCallback);
     }
     static _scheduleImmediateWithSetImmediate(callback) {
       function internalCallback() {
         _isolate_helper.leaveJsAsync();
         callback();
       }
-      dart.fn(internalCallback, VoidTodynamic$());
+      dart.fn(internalCallback, VoidToNull());
       ;
       _isolate_helper.enterJsAsync();
-      self.setImmediate(internalCallback);
+      _isolate_helper.global.setImmediate(internalCallback);
     }
     static _scheduleImmediateWithTimer(callback) {
       async.Timer._createTimer(core.Duration.ZERO, callback);
     }
   };
   dart.setSignature(async._AsyncRun, {
-    sfields: () => ({_scheduleImmediateClosure: core.Function}),
+    sfields: () => ({_scheduleImmediateClosure: async._TakeCallback}),
     statics: () => ({
       _scheduleImmediate: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
-      _initializeScheduleImmediate: dart.definiteFunctionType(core.Function, []),
+      _initializeScheduleImmediate: dart.definiteFunctionType(async._TakeCallback, []),
       _scheduleImmediateJsOverride: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
       _scheduleImmediateWithSetImmediate: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
       _scheduleImmediateWithTimer: dart.definiteFunctionType(dart.void, [VoidTovoid()])
@@ -19752,10 +20191,7 @@
     dart.setSignature(StreamView, {
       constructors: () => ({new: dart.definiteFunctionType(async.StreamView$(T), [StreamOfT()])}),
       fields: () => ({[_stream]: StreamOfT()}),
-      methods: () => ({
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
-        listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})
-      })
+      methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
     });
     return StreamView;
   });
@@ -20100,7 +20536,7 @@
         subscription[_setPendingEvents](pendingEvents);
         subscription[_guardCallback](dart.fn(() => {
           async._runGuarded(this.onListen);
-        }, VoidTodynamic$()));
+        }, VoidToNull()));
         return subscription;
       }
       [_recordCancel](subscription) {
@@ -20360,7 +20796,7 @@
         return dart.fn((e, s) => {
           controller[_addError](e, s);
           controller[_close$]();
-        }, dynamicAndStackTraceTodynamic());
+        }, dynamicAndStackTraceToNull());
       }
       pause() {
         this.addSubscription.pause();
@@ -20376,7 +20812,7 @@
         }
         return cancel.whenComplete(dart.fn(() => {
           this.addStreamFuture[_asyncComplete](null);
-        }, VoidTodynamic$()));
+        }, VoidToNull()));
       }
       complete() {
         this.addStreamFuture[_asyncComplete](null);
@@ -20460,8 +20896,7 @@
       fields: () => ({
         [_pending]: _EventGeneratorOfT(),
         [_isUsed]: core.bool
-      }),
-      methods: () => ({[_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool])})
+      })
     });
     return _GeneratedStreamImpl;
   });
@@ -20494,7 +20929,7 @@
           this[_state] = async._PendingEvents._STATE_UNSCHEDULED;
           if (oldState == async._PendingEvents._STATE_CANCELED) return;
           this.handleNext(dispatch);
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         this[_state] = async._PendingEvents._STATE_SCHEDULED;
       }
       cancelSchedule() {
@@ -20801,7 +21236,7 @@
           let result = new (async._Future$(E))();
           this[_onDone] = dart.fn(() => {
             result[_completeWithValue](null);
-          }, VoidTovoid$());
+          }, VoidToNull());
           return result;
         };
       }
@@ -20809,7 +21244,7 @@
         this[_state] = (dart.notNull(this[_state]) & ~async._DoneStreamSubscription._SCHEDULED) >>> 0;
         if (dart.test(this.isPaused)) return;
         this[_state] = (dart.notNull(this[_state]) | async._DoneStreamSubscription._DONE_SENT) >>> 0;
-        if (this[_onDone] != null) this[_zone].runGuarded(dart.dynamic)(this[_onDone]);
+        if (this[_onDone] != null) this[_zone].runGuarded(dart.void)(this[_onDone]);
       }
     }
     dart.addTypeTests(_DoneStreamSubscription);
@@ -20894,7 +21329,7 @@
       [_onCancel]() {
         let shutdown = this[_controller$] == null || dart.test(this[_controller$].isClosed);
         if (this[_onCancelHandler] != null) {
-          this[_zone].runUnary(dart.dynamic, _BroadcastSubscriptionWrapperOfT())(this[_onCancelHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
+          this[_zone].runUnary(dart.void, _BroadcastSubscriptionWrapperOfT())(this[_onCancelHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
         }
         if (shutdown) {
           if (this[_subscription] != null) {
@@ -20905,7 +21340,7 @@
       }
       [_onListen]() {
         if (this[_onListenHandler] != null) {
-          this[_zone].runUnary(dart.dynamic, _BroadcastSubscriptionWrapperOfT())(this[_onListenHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
+          this[_zone].runUnary(dart.void, _BroadcastSubscriptionWrapperOfT())(this[_onListenHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
         }
       }
       [_cancelSubscription]() {
@@ -21220,7 +21655,7 @@
   async._cancelAndErrorClosure = function(subscription, future) {
     return dart.fn((error, stackTrace) => {
       async._cancelAndError(subscription, future, error, stackTrace);
-    }, dynamicAndStackTraceTovoid());
+    }, dynamicAndStackTraceToNull());
   };
   dart.fn(async._cancelAndErrorClosure, StreamSubscriptionAnd_FutureTo_ErrorCallback());
   async._cancelAndValue = function(subscription, future, value) {
@@ -21340,7 +21775,6 @@
         [_subscription]: StreamSubscriptionOfS()
       }),
       methods: () => ({
-        [_add$]: dart.definiteFunctionType(dart.void, [T]),
         [_handleData]: dart.definiteFunctionType(dart.void, [S]),
         [_handleError]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
         [_handleDone]: dart.definiteFunctionType(dart.void, [])
@@ -21392,8 +21826,7 @@
     }
     dart.setSignature(_WhereStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._WhereStream$(T), [StreamOfT(), _PredicateOfT()])}),
-      fields: () => ({[_test]: _PredicateOfT()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])})
+      fields: () => ({[_test]: _PredicateOfT()})
     });
     return _WhereStream;
   });
@@ -21430,8 +21863,7 @@
     }
     dart.setSignature(_MapStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._MapStream$(S, T), [StreamOfS(), _TransformationOfS$T()])}),
-      fields: () => ({[_transform]: _TransformationOfS$T()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [S, _EventSinkOfT()])})
+      fields: () => ({[_transform]: _TransformationOfS$T()})
     });
     return _MapStream;
   });
@@ -21463,8 +21895,7 @@
     }
     dart.setSignature(_ExpandStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._ExpandStream$(S, T), [StreamOfS(), _TransformationOfS$IterableOfT()])}),
-      fields: () => ({[_expand]: _TransformationOfS$IterableOfT()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [S, _EventSinkOfT()])})
+      fields: () => ({[_expand]: _TransformationOfS$IterableOfT()})
     });
     return _ExpandStream;
   });
@@ -21553,11 +21984,7 @@
     }
     dart.setSignature(_TakeStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._TakeStream$(T), [StreamOfT(), core.int])}),
-      fields: () => ({[_count]: core.int}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-      })
+      fields: () => ({[_count]: core.int})
     });
     return _TakeStream;
   });
@@ -21631,8 +22058,7 @@
     }
     dart.setSignature(_TakeWhileStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._TakeWhileStream$(T), [StreamOfT(), _PredicateOfT()])}),
-      fields: () => ({[_test]: _PredicateOfT()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])})
+      fields: () => ({[_test]: _PredicateOfT()})
     });
     return _TakeWhileStream;
   });
@@ -21665,11 +22091,7 @@
     }
     dart.setSignature(_SkipStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._SkipStream$(T), [StreamOfT(), core.int])}),
-      fields: () => ({[_count]: core.int}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-      })
+      fields: () => ({[_count]: core.int})
     });
     return _SkipStream;
   });
@@ -21715,11 +22137,7 @@
     }
     dart.setSignature(_SkipWhileStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._SkipWhileStream$(T), [StreamOfT(), _PredicateOfT()])}),
-      fields: () => ({[_test]: _PredicateOfT()}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-      })
+      fields: () => ({[_test]: _PredicateOfT()})
     });
     return _SkipWhileStream;
   });
@@ -21773,7 +22191,6 @@
         [_equals]: _EqualityOfT(),
         [_previous$]: core.Object
       }),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])}),
       sfields: () => ({_SENTINEL: core.Object})
     });
     return _DistinctStream;
@@ -21914,7 +22331,6 @@
       }),
       getters: () => ({[_isSubscribed]: dart.definiteFunctionType(core.bool, [])}),
       methods: () => ({
-        [_add$]: dart.definiteFunctionType(dart.void, [T]),
         [_handleData]: dart.definiteFunctionType(dart.void, [S]),
         [_handleError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [dart.dynamic]),
         [_handleDone]: dart.definiteFunctionType(dart.void, [])
@@ -22082,7 +22498,6 @@
     }
     dart.setSignature(_StreamHandlerTransformer, {
       constructors: () => ({new: dart.definiteFunctionType(async._StreamHandlerTransformer$(S, T), [], {handleData: SAndEventSinkOfTTovoid(), handleError: ObjectAndStackTraceAndEventSinkOfTTovoid(), handleDone: EventSinkOfTTovoid()})}),
-      methods: () => ({bind: dart.definiteFunctionType(async.Stream$(T), [StreamOfS()])}),
       statics: () => ({
         _defaultHandleData: dart.definiteFunctionType(dart.void, [dart.dynamic, async.EventSink]),
         _defaultHandleError: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace, async.EventSink]),
@@ -22161,7 +22576,7 @@
       if (dart.equals(async.Zone.current, async.Zone.ROOT)) {
         return async.Zone.current.createTimer(duration, callback);
       }
-      return async.Zone.current.createTimer(duration, async.Zone.current.bindCallback(dart.dynamic)(callback, {runGuarded: true}));
+      return async.Zone.current.createTimer(duration, async.Zone.current.bindCallback(dart.void)(callback, {runGuarded: true}));
     }
     static periodic(duration, callback) {
       if (dart.equals(async.Zone.current, async.Zone.ROOT)) {
@@ -22822,7 +23237,7 @@
         if (error == null) error = new core.NullThrownError();
         if (stackTrace == null) dart.throw(error);
         async._rethrow(error, stackTrace);
-      }, VoidTovoid$()));
+      }, VoidToNull()));
     };
   };
   dart.lazyFn(async._rootHandleUncaughtError, () => ZoneAndZoneDelegateAndZone__ToR());
@@ -22900,7 +23315,7 @@
   dart.fn(async._rootScheduleMicrotask, ZoneAndZoneDelegateAndZone__Tovoid());
   async._rootCreateTimer = function(self, parent, zone, duration, callback) {
     if (!core.identical(async._ROOT_ZONE, zone)) {
-      callback = zone.bindCallback(dart.dynamic)(callback);
+      callback = zone.bindCallback(dart.void)(callback);
     }
     return async.Timer._createTimer(duration, callback);
   };
@@ -23258,13 +23673,13 @@
     let _HashMapKeyIterableOfK = () => (_HashMapKeyIterableOfK = dart.constFn(collection._HashMapKeyIterable$(K)))();
     let MappedIterableOfK$V = () => (MappedIterableOfK$V = dart.constFn(_internal.MappedIterable$(K, V)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let ListOfK = () => (ListOfK = dart.constFn(core.List$(K)))();
     let HashMapOfK$V = () => (HashMapOfK$V = dart.constFn(collection.HashMap$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
     let KToV = () => (KToV = dart.constFn(dart.definiteFunctionType(V, [K])))();
     let KTobool = () => (KTobool = dart.constFn(dart.definiteFunctionType(core.bool, [K])))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     class _HashMap extends core.Object {
       new() {
         this[_length$1] = 0;
@@ -23312,7 +23727,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       _get(key) {
         if (dart.test(collection._HashMap._isStringKey(key))) {
@@ -23663,11 +24078,6 @@
         [_equals$]: _EqualityOfK(),
         [_hashCode]: _HasherOfK(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        _get: dart.definiteFunctionType(V, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [K, V]),
-        remove: dart.definiteFunctionType(V, [core.Object])
       })
     });
     dart.defineExtensionMembers(_CustomHashMap, ['_get', '_set', 'containsKey', 'remove']);
@@ -23710,8 +24120,7 @@
     dart.setSignature(_HashMapKeyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(collection._HashMapKeyIterable$(E), [_HashMapOfE$dynamic()])}),
       fields: () => ({[_map$0]: _HashMapOfE$dynamic()}),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(_HashMapKeyIterable, [
       'contains',
@@ -23811,11 +24220,11 @@
   collection._Es6LinkedIdentityHashMap$ = dart.generic((K, V) => {
     let _Es6MapIterableOfK = () => (_Es6MapIterableOfK = dart.constFn(collection._Es6MapIterable$(K)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let InternalMapOfK$V = () => (InternalMapOfK$V = dart.constFn(_js_helper.InternalMap$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let _Es6MapIterableOfV = () => (_Es6MapIterableOfV = dart.constFn(collection._Es6MapIterable$(V)))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     let VTobool = () => (VTobool = dart.constFn(dart.definiteFunctionType(core.bool, [V])))();
     class _Es6LinkedIdentityHashMap extends collection._LinkedIdentityHashMap$(K, V) {
       new() {
@@ -23848,7 +24257,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       _get(key) {
         return this[_map$0].get(key);
@@ -23908,19 +24317,7 @@
         [_map$0]: dart.dynamic,
         [_modifications$]: core.int
       }),
-      getters: () => ({
-        keys: dart.definiteFunctionType(core.Iterable$(K), []),
-        values: dart.definiteFunctionType(core.Iterable$(V), [])
-      }),
-      methods: () => ({
-        addAll: dart.definiteFunctionType(dart.void, [MapOfK$V()]),
-        _get: dart.definiteFunctionType(V, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [K, V]),
-        putIfAbsent: dart.definiteFunctionType(V, [K, VoidToV()]),
-        remove: dart.definiteFunctionType(V, [core.Object]),
-        forEach: dart.definiteFunctionType(dart.void, [KAndVTovoid()]),
-        [_modified$]: dart.definiteFunctionType(dart.void, [])
-      })
+      methods: () => ({[_modified$]: dart.definiteFunctionType(dart.void, [])})
     });
     dart.defineExtensionMembers(_Es6LinkedIdentityHashMap, [
       'containsKey',
@@ -23990,8 +24387,7 @@
         [_map$0]: dart.dynamic,
         [_isKeys]: core.bool
       }),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(_Es6MapIterable, [
       'contains',
@@ -24110,11 +24506,6 @@
         [_equals$]: _EqualityOfK(),
         [_hashCode]: _HasherOfK(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        _get: dart.definiteFunctionType(V, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [K, V]),
-        remove: dart.definiteFunctionType(V, [core.Object])
       })
     });
     dart.defineExtensionMembers(_LinkedCustomHashMap, ['_get', '_set', 'containsKey', 'remove']);
@@ -24486,11 +24877,7 @@
       }
     }
     dart.setSignature(_HashSetBase, {
-      methods: () => ({
-        difference: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        intersection: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
-      })
+      methods: () => ({toSet: dart.definiteFunctionType(core.Set$(E), [])})
     });
     dart.defineExtensionMembers(_HashSetBase, ['toSet']);
     return _HashSetBase;
@@ -24740,7 +25127,6 @@
         [_lookup]: dart.definiteFunctionType(E, [core.Object]),
         add: dart.definiteFunctionType(core.bool, [E]),
         [_add$0]: dart.definiteFunctionType(core.bool, [E]),
-        addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
         [_remove]: dart.definiteFunctionType(core.bool, [core.Object]),
         [_computeElements]: dart.definiteFunctionType(core.List$(E), []),
@@ -24791,9 +25177,6 @@
         return -1;
       }
     }
-    dart.setSignature(_IdentityHashSet, {
-      methods: () => ({[_newSet]: dart.definiteFunctionType(core.Set$(E), [])})
-    });
     return _IdentityHashSet;
   });
   collection._IdentityHashSet = _IdentityHashSet();
@@ -24847,11 +25230,6 @@
         [_equality]: _EqualityOfE(),
         [_hasher]: _HasherOfE(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
-        add: dart.definiteFunctionType(core.bool, [E]),
-        lookup: dart.definiteFunctionType(E, [core.Object])
       })
     });
     dart.defineExtensionMembers(_CustomHashSet, ['contains']);
@@ -25183,9 +25561,7 @@
       }),
       getters: () => ({
         iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        length: dart.definiteFunctionType(core.int, []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, [])
+        length: dart.definiteFunctionType(core.int, [])
       }),
       methods: () => ({
         [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
@@ -25194,13 +25570,10 @@
         [_contains]: dart.definiteFunctionType(core.bool, [core.Object]),
         lookup: dart.definiteFunctionType(E, [core.Object]),
         [_lookup]: dart.definiteFunctionType(E, [core.Object]),
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
         add: dart.definiteFunctionType(core.bool, [E]),
         [_add$0]: dart.definiteFunctionType(core.bool, [E]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
         [_remove]: dart.definiteFunctionType(core.bool, [core.Object]),
-        removeWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
-        retainWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
         [_filterWhere]: dart.definiteFunctionType(dart.void, [ETobool(), core.bool]),
         [_addHashTableEntry$]: dart.definiteFunctionType(core.bool, [dart.dynamic, E]),
         [_removeHashTableEntry$]: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Object]),
@@ -25256,9 +25629,6 @@
         return -1;
       }
     }
-    dart.setSignature(_LinkedIdentityHashSet, {
-      methods: () => ({[_newSet]: dart.definiteFunctionType(core.Set$(E), [])})
-    });
     return _LinkedIdentityHashSet;
   });
   collection._LinkedIdentityHashSet = _LinkedIdentityHashSet();
@@ -25324,11 +25694,6 @@
         [_equality]: _EqualityOfE(),
         [_hasher]: _HasherOfE(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
-        add: dart.definiteFunctionType(core.bool, [E]),
-        lookup: dart.definiteFunctionType(E, [core.Object])
       })
     });
     dart.defineExtensionMembers(_LinkedCustomHashSet, ['contains']);
@@ -25492,7 +25857,7 @@
         let result = HashMapOfK$V().new();
         other[dartx.forEach](dart.fn((k, v) => {
           result._set(K.as(k), V.as(v));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return result;
       }
       static fromIterable(iterable, opts) {
@@ -26044,7 +26409,7 @@
         let result = LinkedHashMapOfK$V().new();
         other[dartx.forEach](dart.fn((k, v) => {
           result._set(K.as(k), V.as(v));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return result;
       }
       static fromIterable(iterable, opts) {
@@ -26274,19 +26639,13 @@
         [_length$1]: core.int,
         [_first$]: E
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
       methods: () => ({
         addFirst: dart.definiteFunctionType(dart.void, [E]),
         add: dart.definiteFunctionType(dart.void, [E]),
         addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         remove: dart.definiteFunctionType(core.bool, [E]),
         clear: dart.definiteFunctionType(dart.void, []),
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
         [_insertBefore$]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
         [_unlink$]: dart.definiteFunctionType(dart.void, [E])
       })
@@ -26578,12 +26937,7 @@
     dart.setSignature(_MapBaseValueIterable, {
       constructors: () => ({new: dart.definiteFunctionType(collection._MapBaseValueIterable$(K, V), [MapOfK$V()])}),
       fields: () => ({[_map$0]: MapOfK$V()}),
-      getters: () => ({
-        first: dart.definiteFunctionType(V, []),
-        single: dart.definiteFunctionType(V, []),
-        last: dart.definiteFunctionType(V, []),
-        iterator: dart.definiteFunctionType(core.Iterator$(V), [])
-      })
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
     });
     dart.defineExtensionMembers(_MapBaseValueIterable, [
       'length',
@@ -26810,7 +27164,7 @@
           result.write(k);
           result.write(': ');
           result.write(v);
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         result.write('}');
       } finally {
         dart.assert(core.identical(collection._toStringVisiting[dartx.last], m));
@@ -27256,12 +27610,7 @@
         [_sentinel]: _DoubleLinkedQueueSentinelOfE(),
         [_elementCount]: core.int
       }),
-      getters: () => ({
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, []),
-        iterator: dart.definiteFunctionType(collection._DoubleLinkedQueueIterator$(E), [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(collection._DoubleLinkedQueueIterator$(E), [])}),
       methods: () => ({
         addLast: dart.definiteFunctionType(dart.void, [E]),
         addFirst: dart.definiteFunctionType(dart.void, [E]),
@@ -27633,16 +27982,8 @@
         [_tail]: core.int,
         [_modificationCount]: core.int
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
       methods: () => ({
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-        elementAt: dart.definiteFunctionType(E, [core.int]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
         add: dart.definiteFunctionType(dart.void, [E]),
         addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
@@ -27950,16 +28291,16 @@
     let ComparatorOfK = () => (ComparatorOfK = dart.constFn(core.Comparator$(K)))();
     let SplayTreeMapOfK$V = () => (SplayTreeMapOfK$V = dart.constFn(collection.SplayTreeMap$(K, V)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let _SplayTreeNodeIteratorOfK = () => (_SplayTreeNodeIteratorOfK = dart.constFn(collection._SplayTreeNodeIterator$(K)))();
     let _SplayTreeKeyIterableOfK = () => (_SplayTreeKeyIterableOfK = dart.constFn(collection._SplayTreeKeyIterable$(K)))();
     let _SplayTreeValueIterableOfK$V = () => (_SplayTreeValueIterableOfK$V = dart.constFn(collection._SplayTreeValueIterable$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let dynamicToK = () => (dynamicToK = dart.constFn(dart.functionType(K, [dart.dynamic])))();
     let IterableOfK = () => (IterableOfK = dart.constFn(core.Iterable$(K)))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
     let dynamicToV = () => (dynamicToV = dart.constFn(dart.functionType(V, [dart.dynamic])))();
     let IterableOfV = () => (IterableOfV = dart.constFn(core.Iterable$(V)))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     class SplayTreeMap extends collection._SplayTree$(K, collection._SplayTreeMapNode$(K, V)) {
       new(compare, isValidKey) {
         if (compare === void 0) compare = null;
@@ -27982,7 +28323,7 @@
         let result = new (SplayTreeMapOfK$V())(compare, isValidKey);
         other[dartx.forEach](dart.fn((k, v) => {
           result._set(K.as(k), V.as(v));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return result;
       }
       static fromIterable(iterable, opts) {
@@ -28068,7 +28409,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       get isEmpty() {
         return this[_root] == null;
@@ -28343,8 +28684,7 @@
     dart.setSignature(_SplayTreeKeyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(collection._SplayTreeKeyIterable$(K), [_SplayTreeOfK$_SplayTreeNodeOfK()])}),
       fields: () => ({[_tree]: _SplayTreeOfK$_SplayTreeNodeOfK()}),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])}),
-      methods: () => ({toSet: dart.definiteFunctionType(core.Set$(K), [])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])})
     });
     dart.defineExtensionMembers(_SplayTreeKeyIterable, ['toSet', 'length', 'isEmpty', 'iterator']);
     return _SplayTreeKeyIterable;
@@ -28614,24 +28954,14 @@
         [_comparator]: ComparatorOfE(),
         [_validKey]: collection._Predicate
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
       methods: () => ({
         [_compare]: dart.definiteFunctionType(core.int, [E, E]),
         add: dart.definiteFunctionType(core.bool, [E]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
-        addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         lookup: dart.definiteFunctionType(E, [core.Object]),
-        intersection: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        difference: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        union: dart.definiteFunctionType(core.Set$(E), [SetOfE()]),
         [_clone]: dart.definiteFunctionType(collection.SplayTreeSet$(E), []),
-        [_copyNode]: dart.definiteFunctionType(collection._SplayTreeNode$(E), [_SplayTreeNodeOfE()]),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
+        [_copyNode]: dart.definiteFunctionType(collection._SplayTreeNode$(E), [_SplayTreeNodeOfE()])
       })
     });
     dart.defineExtensionMembers(SplayTreeSet, [
@@ -28698,7 +29028,7 @@
   const _data = Symbol('_data');
   const _isUpgraded = Symbol('_isUpgraded');
   const _upgradedMap = Symbol('_upgradedMap');
-  const _process = Symbol('_process');
+  const _process$ = Symbol('_process');
   const _upgrade = Symbol('_upgrade');
   convert._JsonMap = class _JsonMap extends core.Object {
     new(original) {
@@ -28713,7 +29043,7 @@
         return null;
       } else {
         let result = convert._JsonMap._getProperty(this[_processed], core.String._check(key));
-        if (dart.test(convert._JsonMap._isUnprocessed(result))) result = this[_process](core.String._check(key));
+        if (dart.test(convert._JsonMap._isUnprocessed(result))) result = this[_process$](core.String._check(key));
         return result;
       }
     }
@@ -28752,7 +29082,7 @@
     addAll(other) {
       other[dartx.forEach](dart.fn((key, value) => {
         this._set(key, value);
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
     }
     containsValue(value) {
       if (dart.test(this[_isUpgraded])) return this[_upgradedMap][dartx.containsValue](value);
@@ -28841,7 +29171,7 @@
       dart.assert(this[_isUpgraded]);
       return result;
     }
-    [_process](key) {
+    [_process$](key) {
       if (!dart.test(convert._JsonMap._hasProperty(this[_original], key))) return null;
       let result = convert._convertJsonToDartLazy(convert._JsonMap._getProperty(this[_original], key));
       return convert._JsonMap._setProperty(this[_processed], key, result);
@@ -28894,7 +29224,7 @@
       forEach: dart.definiteFunctionType(dart.void, [dynamicAnddynamicTovoid()]),
       [_computeKeys$]: dart.definiteFunctionType(core.List$(core.String), []),
       [_upgrade]: dart.definiteFunctionType(core.Map, []),
-      [_process]: dart.definiteFunctionType(dart.dynamic, [core.String])
+      [_process$]: dart.definiteFunctionType(dart.dynamic, [core.String])
     }),
     statics: () => ({
       _hasProperty: dart.definiteFunctionType(core.bool, [dart.dynamic, core.String]),
@@ -28945,7 +29275,6 @@
   dart.setSignature(convert._JsonMapKeyIterable, {
     constructors: () => ({new: dart.definiteFunctionType(convert._JsonMapKeyIterable, [convert._JsonMap])}),
     fields: () => ({[_parent]: convert._JsonMap}),
-    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator, [])}),
     methods: () => ({elementAt: dart.definiteFunctionType(core.String, [core.int])})
   });
   dart.defineExtensionMembers(convert._JsonMapKeyIterable, ['elementAt', 'contains', 'length', 'iterator']);
@@ -29370,8 +29699,7 @@
     fields: () => ({[_subsetMask]: core.int}),
     methods: () => ({
       convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
-      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfString()])
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
     })
   });
   convert.AsciiEncoder = class AsciiEncoder extends convert._UnicodeSubsetEncoder {
@@ -29461,8 +29789,7 @@
     }),
     methods: () => ({
       convert: dart.definiteFunctionType(core.String, [ListOfint()], [core.int, core.int]),
-      [_convertInvalid]: dart.definiteFunctionType(core.String, [ListOfint(), core.int, core.int]),
-      bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfListOfint()])
+      [_convertInvalid]: dart.definiteFunctionType(core.String, [ListOfint(), core.int, core.int])
     })
   });
   convert.AsciiDecoder = class AsciiDecoder extends convert._UnicodeSubsetDecoder {
@@ -29485,8 +29812,7 @@
     }
   };
   dart.setSignature(convert.AsciiDecoder, {
-    constructors: () => ({new: dart.definiteFunctionType(convert.AsciiDecoder, [], {allowInvalid: core.bool})}),
-    methods: () => ({startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])})
+    constructors: () => ({new: dart.definiteFunctionType(convert.AsciiDecoder, [], {allowInvalid: core.bool})})
   });
   const _utf8Sink = Symbol('_utf8Sink');
   let const$30;
@@ -30501,8 +30827,7 @@
       fields: () => ({[_codec]: CodecOfS$T()}),
       getters: () => ({
         encoder: dart.definiteFunctionType(convert.Converter$(T, S), []),
-        decoder: dart.definiteFunctionType(convert.Converter$(S, T), []),
-        inverted: dart.definiteFunctionType(convert.Codec$(S, T), [])
+        decoder: dart.definiteFunctionType(convert.Converter$(S, T), [])
       })
     });
     return _InvertedCodec;
@@ -30533,15 +30858,12 @@
         [_first$0]: ConverterOfS$M(),
         [_second]: ConverterOfM$T()
       }),
-      methods: () => ({
-        convert: dart.definiteFunctionType(T, [S]),
-        startChunkedConversion: dart.definiteFunctionType(core.Sink$(S), [SinkOfT()])
-      })
+      methods: () => ({convert: dart.definiteFunctionType(T, [S])})
     });
     return _FusedConverter;
   });
   convert._FusedConverter = _FusedConverter();
-  const _name$0 = Symbol('_name');
+  const _name$1 = Symbol('_name');
   let const$34;
   let const$35;
   let const$36;
@@ -30552,7 +30874,7 @@
   let const$41;
   convert.HtmlEscapeMode = class HtmlEscapeMode extends core.Object {
     _(name, escapeLtGt, escapeQuot, escapeApos, escapeSlash) {
-      this[_name$0] = name;
+      this[_name$1] = name;
       this.escapeLtGt = escapeLtGt;
       this.escapeQuot = escapeQuot;
       this.escapeApos = escapeApos;
@@ -30568,10 +30890,10 @@
       this.escapeQuot = escapeQuot;
       this.escapeApos = escapeApos;
       this.escapeSlash = escapeSlash;
-      this[_name$0] = name;
+      this[_name$1] = name;
     }
     toString() {
-      return this[_name$0];
+      return this[_name$1];
     }
   };
   dart.defineNamedConstructor(convert.HtmlEscapeMode, '_');
@@ -30581,7 +30903,7 @@
       new: dart.definiteFunctionType(convert.HtmlEscapeMode, [], {name: core.String, escapeLtGt: core.bool, escapeQuot: core.bool, escapeApos: core.bool, escapeSlash: core.bool})
     }),
     fields: () => ({
-      [_name$0]: core.String,
+      [_name$1]: core.String,
       escapeLtGt: core.bool,
       escapeQuot: core.bool,
       escapeApos: core.bool,
@@ -30855,9 +31177,7 @@
     }),
     methods: () => ({
       convert: dart.definiteFunctionType(core.String, [core.Object]),
-      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfString()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfObject()]),
-      fuse: dart.definiteFunctionType(T => [convert.Converter$(core.Object, T), [convert.Converter$(core.String, T)]])
+      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfString()])
     })
   });
   const _indent = Symbol('_indent');
@@ -30931,8 +31251,7 @@
     }),
     methods: () => ({
       convert: dart.definiteFunctionType(core.List$(core.int), [core.Object]),
-      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfListOfint()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfObject()])
+      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfListOfint()])
     }),
     sfields: () => ({DEFAULT_BUFFER_SIZE: core.int}),
     statics: () => ({_utf8Encode: dart.definiteFunctionType(core.List$(core.int), [core.String])}),
@@ -31039,8 +31358,7 @@
     fields: () => ({[_reviver]: convert._Reviver}),
     methods: () => ({
       convert: dart.definiteFunctionType(dart.dynamic, [core.String]),
-      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfObject()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.Object), [StreamOfString()])
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfObject()])
     })
   });
   convert._parseJson = function(source, reviver) {
@@ -31221,7 +31539,7 @@
         }
         keyValueList[dartx._set](i++, key);
         keyValueList[dartx._set](i++, value);
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
       if (!allStringKeys) return false;
       this.writeString('{');
       let separator = '"';
@@ -31322,7 +31640,7 @@
         }
         keyValueList[dartx._set](i++, key);
         keyValueList[dartx._set](i++, value);
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
       if (!allStringKeys) return false;
       this.writeString('{\n');
       this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1;
@@ -31637,8 +31955,7 @@
     }
   };
   dart.setSignature(convert.Latin1Decoder, {
-    constructors: () => ({new: dart.definiteFunctionType(convert.Latin1Decoder, [], {allowInvalid: core.bool})}),
-    methods: () => ({startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])})
+    constructors: () => ({new: dart.definiteFunctionType(convert.Latin1Decoder, [], {allowInvalid: core.bool})})
   });
   const _addSliceToSink = Symbol('_addSliceToSink');
   convert._Latin1DecoderSink = class _Latin1DecoderSink extends convert.ByteConversionSinkBase {
@@ -32226,8 +32543,7 @@
     constructors: () => ({new: dart.definiteFunctionType(convert.Utf8Encoder, [])}),
     methods: () => ({
       convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
-      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfString()])
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
     })
   });
   convert._Utf8Encoder = class _Utf8Encoder extends core.Object {
@@ -32472,9 +32788,7 @@
     fields: () => ({[_allowMalformed]: core.bool}),
     methods: () => ({
       convert: dart.definiteFunctionType(core.String, [ListOfint()], [core.int, core.int]),
-      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfListOfint()]),
-      fuse: dart.definiteFunctionType(T => [convert.Converter$(core.List$(core.int), T), [convert.Converter$(core.String, T)]])
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])
     }),
     statics: () => ({_convertIntercepted: dart.definiteFunctionType(core.String, [core.bool, ListOfint(), core.int, core.int])}),
     names: ['_convertIntercepted']
@@ -33572,7 +33886,7 @@
           sb.write(": ");
           sb.write(core.Error.safeToString(value));
           i++;
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
       }
       if (this[_existingArgumentNames] == null) {
         return dart.str`NoSuchMethodError : method not found: '${this[_memberName]}'\n` + dart.str`Receiver: ${core.Error.safeToString(this[_receiver$])}\n` + dart.str`Arguments: [${sb}]`;
@@ -33898,10 +34212,21 @@
       let result = dart.map({}, core.String, dart.dynamic);
       namedArguments[dartx.forEach](dart.fn((symbol, value) => {
         result[dartx._set](core._symbolToString(symbol), value);
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       return result;
     }
   };
+  core.Function.is = function is_Function(o) {
+    return typeof o == "function";
+  };
+  core.Function.as = function as_Function(o) {
+    if (typeof o == "function" || o == null) return o;
+    return dart.as(o, core.Function);
+  };
+  core.Function._check = function check_String(o) {
+    if (typeof o == "function" || o == null) return o;
+    return dart.check(o, core.Function);
+  };
   dart.setSignature(core.Function, {
     statics: () => ({
       apply: dart.definiteFunctionType(dart.dynamic, [core.Function, core.List], [MapOfSymbol$dynamic()]),
@@ -33980,10 +34305,6 @@
         [_generator$]: _GeneratorOfE()
       }),
       getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int])
-      }),
       statics: () => ({_id: dart.definiteFunctionType(core.int, [core.int])}),
       names: ['_id']
     });
@@ -34165,18 +34486,7 @@
       return new core._StringStackTrace(stackTraceString);
     }
     static get current() {
-      if (Error.captureStackTrace != null) {
-        let error = new Error();
-        Error.captureStackTrace(error);
-        return _js_helper.getTraceFromException(error);
-      }
-      try {
-        dart.throw('');
-      } catch (_) {
-        let stackTrace = dart.stackTrace(_);
-        return stackTrace;
-      }
-
+      return _js_helper.getTraceFromException(new Error());
     }
   };
   dart.setSignature(core.StackTrace, {
@@ -34310,10 +34620,7 @@
   dart.setSignature(core.Runes, {
     constructors: () => ({new: dart.definiteFunctionType(core.Runes, [core.String])}),
     fields: () => ({string: core.String}),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.RuneIterator, []),
-      last: dart.definiteFunctionType(core.int, [])
-    })
+    getters: () => ({iterator: dart.definiteFunctionType(core.RuneIterator, [])})
   });
   dart.defineExtensionMembers(core.Runes, ['iterator', 'last']);
   core._isLeadSurrogate = function(code) {
@@ -34889,7 +35196,7 @@
             dart.throw(new core.UnsupportedError(dart.str`Illegal path character ${segment}`));
           }
         }
-      }, StringTovoid$()));
+      }, StringToNull()));
     }
     static _checkWindowsPathReservedCharacters(segments, argumentError, firstSegment) {
       if (firstSegment === void 0) firstSegment = 0;
@@ -35246,7 +35553,7 @@
             writeParameter(key, value);
           }
         }
-      }, StringAnddynamicTovoid()));
+      }, StringAnddynamicToNull()));
       return result.toString();
     }
     static _makeFragment(fragment, start, end) {
@@ -36234,7 +36541,7 @@
         if (indices != null) indices[dartx.add](buffer.length);
         buffer.write('=');
         buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
-      }, StringAndStringTovoid$())));
+      }, StringAndStringToNull())));
     }
     static _validateMimeType(mimeType) {
       let slashIndex = -1;
@@ -37221,6 +37528,14902 @@
     return 0;
   };
   dart.fn(developer._getServiceMinorVersion, VoidToint());
+  io.BytesBuilder = class BytesBuilder extends core.Object {
+    static new(opts) {
+      let copy = opts && 'copy' in opts ? opts.copy : true;
+      if (dart.test(copy)) {
+        return new io._CopyingBytesBuilder();
+      } else {
+        return new io._BytesBuilder();
+      }
+    }
+  };
+  dart.setSignature(io.BytesBuilder, {
+    constructors: () => ({new: dart.definiteFunctionType(io.BytesBuilder, [], {copy: core.bool})})
+  });
+  const _length$2 = Symbol('_length');
+  const _buffer$ = Symbol('_buffer');
+  const _pow2roundup = Symbol('_pow2roundup');
+  io._CopyingBytesBuilder = class _CopyingBytesBuilder extends core.Object {
+    new() {
+      this[_length$2] = 0;
+      this[_buffer$] = null;
+    }
+    add(bytes) {
+      let bytesLength = bytes[dartx.length];
+      if (bytesLength == 0) return;
+      let required = dart.notNull(this[_length$2]) + dart.notNull(bytesLength);
+      if (this[_buffer$] == null) {
+        let size = this[_pow2roundup](required);
+        size = math.max(core.int)(size, io._CopyingBytesBuilder._INIT_SIZE);
+        this[_buffer$] = typed_data.Uint8List.new(size);
+      } else if (dart.notNull(this[_buffer$][dartx.length]) < required) {
+        let size = dart.notNull(this[_pow2roundup](required)) * 2;
+        let newBuffer = typed_data.Uint8List.new(size);
+        newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
+        this[_buffer$] = newBuffer;
+      }
+      dart.assert(dart.notNull(this[_buffer$][dartx.length]) >= required);
+      if (typed_data.Uint8List.is(bytes)) {
+        this[_buffer$][dartx.setRange](this[_length$2], required, bytes);
+      } else {
+        for (let i = 0; i < dart.notNull(bytesLength); i++) {
+          this[_buffer$][dartx._set](dart.notNull(this[_length$2]) + i, bytes[dartx._get](i));
+        }
+      }
+      this[_length$2] = required;
+    }
+    addByte(byte) {
+      this.add(JSArrayOfint().of([byte]));
+    }
+    takeBytes() {
+      if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+      let buffer = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]);
+      this.clear();
+      return buffer;
+    }
+    toBytes() {
+      if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+      return typed_data.Uint8List.fromList(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+    }
+    get length() {
+      return this[_length$2];
+    }
+    get isEmpty() {
+      return this[_length$2] == 0;
+    }
+    get isNotEmpty() {
+      return this[_length$2] != 0;
+    }
+    clear() {
+      this[_length$2] = 0;
+      this[_buffer$] = null;
+    }
+    [_pow2roundup](x) {
+      x = dart.notNull(x) - 1;
+      x = (dart.notNull(x) | x[dartx['>>']](1)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](2)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](4)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](8)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](16)) >>> 0;
+      return dart.notNull(x) + 1;
+    }
+  };
+  io._CopyingBytesBuilder[dart.implements] = () => [io.BytesBuilder];
+  dart.setSignature(io._CopyingBytesBuilder, {
+    fields: () => ({
+      [_length$2]: core.int,
+      [_buffer$]: typed_data.Uint8List
+    }),
+    getters: () => ({
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addByte: dart.definiteFunctionType(dart.void, [core.int]),
+      takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      toBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      clear: dart.definiteFunctionType(dart.void, []),
+      [_pow2roundup]: dart.definiteFunctionType(core.int, [core.int])
+    }),
+    sfields: () => ({_INIT_SIZE: core.int})
+  });
+  io._CopyingBytesBuilder._INIT_SIZE = 1024;
+  const _chunks = Symbol('_chunks');
+  io._BytesBuilder = class _BytesBuilder extends core.Object {
+    new() {
+      this[_chunks] = JSArrayOfListOfint().of([]);
+      this[_length$2] = 0;
+    }
+    add(bytes) {
+      if (!typed_data.Uint8List.is(bytes)) {
+        bytes = typed_data.Uint8List.fromList(bytes);
+      }
+      this[_chunks][dartx.add](bytes);
+      this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(bytes[dartx.length]);
+    }
+    addByte(byte) {
+      this.add(JSArrayOfint().of([byte]));
+    }
+    takeBytes() {
+      if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+      if (this[_chunks][dartx.length] == 1) {
+        let buffer = this[_chunks][dartx.single];
+        this.clear();
+        return buffer;
+      }
+      let buffer = typed_data.Uint8List.new(this[_length$2]);
+      let offset = 0;
+      for (let chunk of this[_chunks]) {
+        buffer[dartx.setRange](offset, dart.notNull(offset) + dart.notNull(chunk[dartx.length]), chunk);
+        offset = dart.notNull(offset) + dart.notNull(chunk[dartx.length]);
+      }
+      this.clear();
+      return buffer;
+    }
+    toBytes() {
+      if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+      let buffer = typed_data.Uint8List.new(this[_length$2]);
+      let offset = 0;
+      for (let chunk of this[_chunks]) {
+        buffer[dartx.setRange](offset, dart.notNull(offset) + dart.notNull(chunk[dartx.length]), chunk);
+        offset = dart.notNull(offset) + dart.notNull(chunk[dartx.length]);
+      }
+      return buffer;
+    }
+    get length() {
+      return this[_length$2];
+    }
+    get isEmpty() {
+      return this[_length$2] == 0;
+    }
+    get isNotEmpty() {
+      return this[_length$2] != 0;
+    }
+    clear() {
+      this[_length$2] = 0;
+      this[_chunks][dartx.clear]();
+    }
+  };
+  io._BytesBuilder[dart.implements] = () => [io.BytesBuilder];
+  dart.setSignature(io._BytesBuilder, {
+    fields: () => ({
+      [_length$2]: core.int,
+      [_chunks]: ListOfListOfint()
+    }),
+    getters: () => ({
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addByte: dart.definiteFunctionType(dart.void, [core.int]),
+      takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      toBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      clear: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._SUCCESS_RESPONSE = 0;
+  io._ILLEGAL_ARGUMENT_RESPONSE = 1;
+  io._OSERROR_RESPONSE = 2;
+  io._FILE_CLOSED_RESPONSE = 3;
+  io._ERROR_RESPONSE_ERROR_TYPE = 0;
+  io._OSERROR_RESPONSE_ERROR_CODE = 1;
+  io._OSERROR_RESPONSE_MESSAGE = 2;
+  io._isErrorResponse = function(response) {
+    return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+  };
+  dart.fn(io._isErrorResponse, dynamicTobool$());
+  io._exceptionFromResponse = function(response, message, path) {
+    dart.assert(io._isErrorResponse(response));
+    switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+      case io._ILLEGAL_ARGUMENT_RESPONSE:
+      {
+        return new core.ArgumentError();
+      }
+      case io._OSERROR_RESPONSE:
+      {
+        let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+        return new io.FileSystemException(message, path, err);
+      }
+      case io._FILE_CLOSED_RESPONSE:
+      {
+        return new io.FileSystemException("File closed", path);
+      }
+      default:
+      {
+        return core.Exception.new("Unknown error");
+      }
+    }
+  };
+  dart.fn(io._exceptionFromResponse, dynamicAndStringAndStringTodynamic());
+  io.IOException = class IOException extends core.Object {
+    toString() {
+      return "IOException";
+    }
+  };
+  io.IOException[dart.implements] = () => [core.Exception];
+  io.OSError = class OSError extends core.Object {
+    new(message, errorCode) {
+      if (message === void 0) message = "";
+      if (errorCode === void 0) errorCode = io.OSError.noErrorCode;
+      this.message = message;
+      this.errorCode = errorCode;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write("OS Error");
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(": ");
+        sb.write(this.message);
+        if (this.errorCode != io.OSError.noErrorCode) {
+          sb.write(", errno = ");
+          sb.write(dart.toString(this.errorCode));
+        }
+      } else if (this.errorCode != io.OSError.noErrorCode) {
+        sb.write(": errno = ");
+        sb.write(dart.toString(this.errorCode));
+      }
+      return sb.toString();
+    }
+  };
+  dart.setSignature(io.OSError, {
+    constructors: () => ({new: dart.definiteFunctionType(io.OSError, [], [core.String, core.int])}),
+    fields: () => ({
+      message: core.String,
+      errorCode: core.int
+    }),
+    sfields: () => ({noErrorCode: core.int})
+  });
+  io.OSError.noErrorCode = -1;
+  io._BufferAndStart = class _BufferAndStart extends core.Object {
+    new(buffer, start) {
+      this.buffer = buffer;
+      this.start = start;
+    }
+  };
+  dart.setSignature(io._BufferAndStart, {
+    constructors: () => ({new: dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int])}),
+    fields: () => ({
+      buffer: core.List,
+      start: core.int
+    })
+  });
+  io._ensureFastAndSerializableByteData = function(buffer, start, end) {
+    if (typed_data.Uint8List.is(buffer) || typed_data.Int8List.is(buffer)) {
+      return new io._BufferAndStart(buffer, start);
+    }
+    let length = dart.notNull(end) - dart.notNull(start);
+    let newBuffer = typed_data.Uint8List.new(length);
+    let j = start;
+    for (let i = 0; i < length; i++) {
+      let value = core.int._check(buffer[dartx._get](j));
+      if (!(typeof value == 'number')) {
+        dart.throw(new core.ArgumentError(dart.str`List element is not an integer at index ${j}`));
+      }
+      newBuffer[dartx._set](i, value);
+      j = dart.notNull(j) + 1;
+    }
+    return new io._BufferAndStart(newBuffer, 0);
+  };
+  dart.fn(io._ensureFastAndSerializableByteData, ListAndintAndintTo_BufferAndStart());
+  io._IOCrypto = class _IOCrypto extends core.Object {
+    static getRandomBytes(count) {
+      dart.throw(new core.UnsupportedError("_IOCrypto.getRandomBytes"));
+    }
+  };
+  dart.setSignature(io._IOCrypto, {
+    statics: () => ({getRandomBytes: dart.definiteFunctionType(typed_data.Uint8List, [core.int])}),
+    names: ['getRandomBytes']
+  });
+  io._CryptoUtils = class _CryptoUtils extends core.Object {
+    static bytesToHex(bytes) {
+      let result = new core.StringBuffer();
+      for (let part of bytes) {
+        result.write(dart.str`${dart.notNull(part) < 16 ? '0' : ''}${part[dartx.toRadixString](16)}`);
+      }
+      return result.toString();
+    }
+    static bytesToBase64(bytes, urlSafe, addLineSeparator) {
+      if (urlSafe === void 0) urlSafe = false;
+      if (addLineSeparator === void 0) addLineSeparator = false;
+      let len = bytes[dartx.length];
+      if (len == 0) {
+        return "";
+      }
+      let lookup = dart.test(urlSafe) ? io._CryptoUtils._encodeTableUrlSafe : io._CryptoUtils._encodeTable;
+      let remainderLength = dart.asInt(len[dartx.remainder](3));
+      let chunkLength = dart.notNull(len) - dart.notNull(remainderLength);
+      let outputLen = (dart.notNull(len) / 3)[dartx.truncate]() * 4 + (dart.notNull(remainderLength) > 0 ? 4 : 0);
+      if (dart.test(addLineSeparator)) {
+        outputLen = outputLen + (((outputLen - 1) / io._CryptoUtils.LINE_LENGTH)[dartx.truncate]() << 1 >>> 0);
+      }
+      let out = ListOfint().new(outputLen);
+      let j = 0, i = 0, c = 0;
+      while (i < chunkLength) {
+        let x = (dart.notNull(bytes[dartx._get](i++)) << 16 & 16777215 | dart.notNull(bytes[dartx._get](i++)) << 8 & 16777215 | dart.notNull(bytes[dartx._get](i++))) >>> 0;
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](18)));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x >> 12 & 63));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x >> 6 & 63));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x & 63));
+        if (dart.test(addLineSeparator) && ++c == 19 && j < outputLen - 2) {
+          out[dartx._set](j++, io._CryptoUtils.CR);
+          out[dartx._set](j++, io._CryptoUtils.LF);
+          c = 0;
+        }
+      }
+      if (remainderLength == 1) {
+        let x = bytes[dartx._get](i);
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](2)));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](dart.notNull(x) << 4 & 63));
+        out[dartx._set](j++, io._CryptoUtils.PAD);
+        out[dartx._set](j++, io._CryptoUtils.PAD);
+      } else if (remainderLength == 2) {
+        let x = bytes[dartx._get](i);
+        let y = bytes[dartx._get](i + 1);
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](2)));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt]((dart.notNull(x) << 4 | dart.notNull(y) >> 4) & 63));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](dart.notNull(y) << 2 & 63));
+        out[dartx._set](j++, io._CryptoUtils.PAD);
+      }
+      return core.String.fromCharCodes(out);
+    }
+    static base64StringToBytes(input, ignoreInvalidCharacters) {
+      if (ignoreInvalidCharacters === void 0) ignoreInvalidCharacters = true;
+      let len = input[dartx.length];
+      if (len == 0) {
+        return ListOfint().new(0);
+      }
+      let extrasLen = 0;
+      for (let i = 0; i < dart.notNull(len); i++) {
+        let c = io._CryptoUtils._decodeTable[dartx._get](input[dartx.codeUnitAt](i));
+        if (dart.notNull(c) < 0) {
+          extrasLen++;
+          if (c == -2 && !dart.test(ignoreInvalidCharacters)) {
+            dart.throw(new core.FormatException(dart.str`Invalid character: ${input[dartx._get](i)}`));
+          }
+        }
+      }
+      if ((dart.notNull(len) - extrasLen)[dartx['%']](4) != 0) {
+        dart.throw(new core.FormatException(dart.str`Size of Base 64 characters in Input\n          must be a multiple of 4. Input: ${input}`));
+      }
+      let padLength = 0;
+      for (let i = dart.notNull(len) - 1; i >= 0; i--) {
+        let currentCodeUnit = input[dartx.codeUnitAt](i);
+        if (dart.notNull(io._CryptoUtils._decodeTable[dartx._get](currentCodeUnit)) > 0) break;
+        if (currentCodeUnit == io._CryptoUtils.PAD) padLength++;
+      }
+      let outputLen = ((dart.notNull(len) - extrasLen) * 6)[dartx['>>']](3) - padLength;
+      let out = ListOfint().new(outputLen);
+      for (let i = 0, o = 0; o < outputLen;) {
+        let x = 0;
+        for (let j = 4; j > 0;) {
+          let c = io._CryptoUtils._decodeTable[dartx._get](input[dartx.codeUnitAt](i++));
+          if (dart.notNull(c) >= 0) {
+            x = (x << 6 & 16777215 | dart.notNull(c)) >>> 0;
+            j--;
+          }
+        }
+        out[dartx._set](o++, x[dartx['>>']](16));
+        if (o < outputLen) {
+          out[dartx._set](o++, x >> 8 & 255);
+          if (o < outputLen) out[dartx._set](o++, x & 255);
+        }
+      }
+      return out;
+    }
+  };
+  dart.setSignature(io._CryptoUtils, {
+    sfields: () => ({
+      PAD: core.int,
+      CR: core.int,
+      LF: core.int,
+      LINE_LENGTH: core.int,
+      _encodeTable: core.String,
+      _encodeTableUrlSafe: core.String,
+      _decodeTable: ListOfint()
+    }),
+    statics: () => ({
+      bytesToHex: dart.definiteFunctionType(core.String, [ListOfint()]),
+      bytesToBase64: dart.definiteFunctionType(core.String, [ListOfint()], [core.bool, core.bool]),
+      base64StringToBytes: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.bool])
+    }),
+    names: ['bytesToHex', 'bytesToBase64', 'base64StringToBytes']
+  });
+  io._CryptoUtils.PAD = 61;
+  io._CryptoUtils.CR = 13;
+  io._CryptoUtils.LF = 10;
+  io._CryptoUtils.LINE_LENGTH = 76;
+  io._CryptoUtils._encodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+  io._CryptoUtils._encodeTableUrlSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+  io._CryptoUtils._decodeTable = dart.constList([-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, 62, -2, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, 0, -2, -2, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, 63, -2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], core.int);
+  io._MASK_8 = 255;
+  io._MASK_32 = 4294967295;
+  io._BITS_PER_BYTE = 8;
+  io._BYTES_PER_WORD = 4;
+  const _chunkSizeInWords = Symbol('_chunkSizeInWords');
+  const _digestSizeInWords = Symbol('_digestSizeInWords');
+  const _bigEndianWords = Symbol('_bigEndianWords');
+  const _pendingData = Symbol('_pendingData');
+  const _lengthInBytes = Symbol('_lengthInBytes');
+  const _currentChunk = Symbol('_currentChunk');
+  const _h = Symbol('_h');
+  const _digestCalled = Symbol('_digestCalled');
+  const _iterate = Symbol('_iterate');
+  const _resultAsBytes = Symbol('_resultAsBytes');
+  const _finalizeData = Symbol('_finalizeData');
+  const _add32 = Symbol('_add32');
+  const _roundUp = Symbol('_roundUp');
+  const _rotl32 = Symbol('_rotl32');
+  const _wordToBytes = Symbol('_wordToBytes');
+  const _bytesToChunk = Symbol('_bytesToChunk');
+  const _updateHash = Symbol('_updateHash');
+  io._HashBase = class _HashBase extends core.Object {
+    new(chunkSizeInWords, digestSizeInWords, bigEndianWords) {
+      this[_chunkSizeInWords] = chunkSizeInWords;
+      this[_digestSizeInWords] = digestSizeInWords;
+      this[_bigEndianWords] = bigEndianWords;
+      this[_pendingData] = JSArrayOfint().of([]);
+      this[_lengthInBytes] = 0;
+      this[_currentChunk] = null;
+      this[_h] = null;
+      this[_digestCalled] = false;
+      this[_currentChunk] = ListOfint().new(this[_chunkSizeInWords]);
+      this[_h] = ListOfint().new(this[_digestSizeInWords]);
+    }
+    add(data) {
+      if (dart.test(this[_digestCalled])) {
+        dart.throw(new core.StateError('Hash update method called after digest was retrieved'));
+      }
+      this[_lengthInBytes] = dart.notNull(this[_lengthInBytes]) + dart.notNull(data[dartx.length]);
+      this[_pendingData][dartx.addAll](data);
+      this[_iterate]();
+    }
+    close() {
+      if (dart.test(this[_digestCalled])) {
+        return ListOfint()._check(this[_resultAsBytes]());
+      }
+      this[_digestCalled] = true;
+      this[_finalizeData]();
+      this[_iterate]();
+      dart.assert(this[_pendingData][dartx.length] == 0);
+      return ListOfint()._check(this[_resultAsBytes]());
+    }
+    get blockSize() {
+      return dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+    }
+    [_add32](x, y) {
+      return dart.dsend(dart.dsend(x, '+', y), '&', io._MASK_32);
+    }
+    [_roundUp](val, n) {
+      return dart.dsend(dart.dsend(dart.dsend(val, '+', n), '-', 1), '&', dart.dsend(n, '_negate'));
+    }
+    [_rotl32](val, shift) {
+      let mod_shift = dart.notNull(shift) & 31;
+      return (val[dartx['<<']](mod_shift) & io._MASK_32 | ((dart.notNull(val) & io._MASK_32) >>> 0)[dartx['>>']](32 - mod_shift)) >>> 0;
+    }
+    [_resultAsBytes]() {
+      let result = [];
+      for (let i = 0; i < dart.notNull(this[_h][dartx.length]); i++) {
+        result[dartx.addAll](core.Iterable._check(this[_wordToBytes](this[_h][dartx._get](i))));
+      }
+      return result;
+    }
+    [_bytesToChunk](data, dataIndex) {
+      dart.assert(dart.notNull(data[dartx.length]) - dart.notNull(dataIndex) >= dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD);
+      for (let wordIndex = 0; wordIndex < dart.notNull(this[_chunkSizeInWords]); wordIndex++) {
+        let w3 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dataIndex) : data[dartx._get](dart.notNull(dataIndex) + 3);
+        let w2 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 1) : data[dartx._get](dart.notNull(dataIndex) + 2);
+        let w1 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 2) : data[dartx._get](dart.notNull(dataIndex) + 1);
+        let w0 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 3) : data[dartx._get](dataIndex);
+        dataIndex = dart.notNull(dataIndex) + 4;
+        let word = (dart.notNull(w3) & 255) << 24 >>> 0;
+        word = (word | (dart.notNull(w2) & io._MASK_8) << 16) >>> 0;
+        word = (word | (dart.notNull(w1) & io._MASK_8) << 8) >>> 0;
+        word = (word | dart.notNull(w0) & io._MASK_8) >>> 0;
+        this[_currentChunk][dartx._set](wordIndex, word);
+      }
+    }
+    [_wordToBytes](word) {
+      let bytes = ListOfint().new(io._BYTES_PER_WORD);
+      bytes[dartx._set](0, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 24 : 0) & io._MASK_8);
+      bytes[dartx._set](1, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 16 : 8) & io._MASK_8);
+      bytes[dartx._set](2, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 8 : 16) & io._MASK_8);
+      bytes[dartx._set](3, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 0 : 24) & io._MASK_8);
+      return bytes;
+    }
+    [_iterate]() {
+      let len = this[_pendingData][dartx.length];
+      let chunkSizeInBytes = dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+      if (dart.notNull(len) >= chunkSizeInBytes) {
+        let index = 0;
+        for (; dart.notNull(len) - index >= chunkSizeInBytes; index = index + chunkSizeInBytes) {
+          this[_bytesToChunk](this[_pendingData], index);
+          this[_updateHash](this[_currentChunk]);
+        }
+        this[_pendingData] = this[_pendingData][dartx.sublist](index, len);
+      }
+    }
+    [_finalizeData]() {
+      this[_pendingData][dartx.add](128);
+      let contentsLength = dart.notNull(this[_lengthInBytes]) + 9;
+      let chunkSizeInBytes = dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+      let finalizedLength = this[_roundUp](contentsLength, chunkSizeInBytes);
+      let zeroPadding = dart.dsend(finalizedLength, '-', contentsLength);
+      for (let i = 0; i < dart.notNull(core.num._check(zeroPadding)); i++) {
+        this[_pendingData][dartx.add](0);
+      }
+      let lengthInBits = dart.notNull(this[_lengthInBytes]) * io._BITS_PER_BYTE;
+      dart.assert(lengthInBits < dart.notNull(math.pow(2, 32)));
+      if (dart.test(this[_bigEndianWords])) {
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+      } else {
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+      }
+    }
+  };
+  dart.setSignature(io._HashBase, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HashBase, [core.int, core.int, core.bool])}),
+    fields: () => ({
+      [_chunkSizeInWords]: core.int,
+      [_digestSizeInWords]: core.int,
+      [_bigEndianWords]: core.bool,
+      [_lengthInBytes]: core.int,
+      [_pendingData]: ListOfint(),
+      [_currentChunk]: ListOfint(),
+      [_h]: ListOfint(),
+      [_digestCalled]: core.bool
+    }),
+    getters: () => ({blockSize: dart.definiteFunctionType(core.int, [])}),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.dynamic, [ListOfint()]),
+      close: dart.definiteFunctionType(core.List$(core.int), []),
+      [_add32]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
+      [_roundUp]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
+      [_rotl32]: dart.definiteFunctionType(core.int, [core.int, core.int]),
+      [_resultAsBytes]: dart.definiteFunctionType(dart.dynamic, []),
+      [_bytesToChunk]: dart.definiteFunctionType(dart.dynamic, [ListOfint(), core.int]),
+      [_wordToBytes]: dart.definiteFunctionType(dart.dynamic, [core.int]),
+      [_iterate]: dart.definiteFunctionType(dart.dynamic, []),
+      [_finalizeData]: dart.definiteFunctionType(dart.dynamic, [])
+    })
+  });
+  io._MD5 = class _MD5 extends io._HashBase {
+    new() {
+      super.new(16, 4, false);
+      this[_h][dartx._set](0, 1732584193);
+      this[_h][dartx._set](1, 4023233417);
+      this[_h][dartx._set](2, 2562383102);
+      this[_h][dartx._set](3, 271733878);
+    }
+    newInstance() {
+      return new io._MD5();
+    }
+    [_updateHash](m) {
+      dart.assert(m[dartx.length] == 16);
+      let a = this[_h][dartx._get](0);
+      let b = this[_h][dartx._get](1);
+      let c = this[_h][dartx._get](2);
+      let d = this[_h][dartx._get](3);
+      let t0 = null;
+      let t1 = null;
+      for (let i = 0; i < 64; i++) {
+        if (i < 16) {
+          t0 = (dart.notNull(b) & dart.notNull(c) | ~dart.notNull(b) & io._MASK_32 & dart.notNull(d)) >>> 0;
+          t1 = i;
+        } else if (i < 32) {
+          t0 = (dart.notNull(d) & dart.notNull(b) | ~dart.notNull(d) & io._MASK_32 & dart.notNull(c)) >>> 0;
+          t1 = (5 * i + 1)[dartx['%']](16);
+        } else if (i < 48) {
+          t0 = (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0;
+          t1 = (3 * i + 5)[dartx['%']](16);
+        } else {
+          t0 = (dart.notNull(c) ^ (dart.notNull(b) | ~dart.notNull(d) & io._MASK_32)) >>> 0;
+          t1 = (7 * i)[dartx['%']](16);
+        }
+        let temp = d;
+        d = c;
+        c = b;
+        b = core.int._check(this[_add32](b, this[_rotl32](core.int._check(this[_add32](this[_add32](a, t0), this[_add32](io._MD5._k[dartx._get](i), m[dartx._get](core.int._check(t1))))), io._MD5._r[dartx._get](i))));
+        a = temp;
+      }
+      this[_h][dartx._set](0, core.int._check(this[_add32](a, this[_h][dartx._get](0))));
+      this[_h][dartx._set](1, core.int._check(this[_add32](b, this[_h][dartx._get](1))));
+      this[_h][dartx._set](2, core.int._check(this[_add32](c, this[_h][dartx._get](2))));
+      this[_h][dartx._set](3, core.int._check(this[_add32](d, this[_h][dartx._get](3))));
+    }
+  };
+  dart.setSignature(io._MD5, {
+    constructors: () => ({new: dart.definiteFunctionType(io._MD5, [])}),
+    methods: () => ({
+      newInstance: dart.definiteFunctionType(io._MD5, []),
+      [_updateHash]: dart.definiteFunctionType(dart.void, [ListOfint()])
+    }),
+    sfields: () => ({
+      _k: ListOfint(),
+      _r: ListOfint()
+    })
+  });
+  io._MD5._k = dart.constList([3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426, 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134, 1804603682, 4254626195, 2792965006, 1236535329, 4129170786, 3225465664, 643717713, 3921069994, 3593408605, 38016083, 3634488961, 3889429448, 568446438, 3275163606, 4107603335, 1163531501, 2850285829, 4243563512, 1735328473, 2368359562, 4294588738, 2272392833, 1839030562, 4259657740, 2763975236, 1272893353, 4139469664, 3200236656, 681279174, 3936430074, 3572445317, 76029189, 3654602809, 3873151461, 530742520, 3299628645, 4096336452, 1126891415, 2878612391, 4237533241, 1700485571, 2399980690, 4293915773, 2240044497, 1873313359, 4264355552, 2734768916, 1309151649, 4149444226, 3174756917, 718787259, 3951481745], core.int);
+  io._MD5._r = dart.constList([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21], core.int);
+  const _w = Symbol('_w');
+  io._SHA1 = class _SHA1 extends io._HashBase {
+    new() {
+      this[_w] = ListOfint().new(80);
+      super.new(16, 5, true);
+      this[_h][dartx._set](0, 1732584193);
+      this[_h][dartx._set](1, 4023233417);
+      this[_h][dartx._set](2, 2562383102);
+      this[_h][dartx._set](3, 271733878);
+      this[_h][dartx._set](4, 3285377520);
+    }
+    newInstance() {
+      return new io._SHA1();
+    }
+    [_updateHash](m) {
+      dart.assert(m[dartx.length] == 16);
+      let a = this[_h][dartx._get](0);
+      let b = this[_h][dartx._get](1);
+      let c = this[_h][dartx._get](2);
+      let d = this[_h][dartx._get](3);
+      let e = this[_h][dartx._get](4);
+      for (let i = 0; i < 80; i++) {
+        if (i < 16) {
+          this[_w][dartx._set](i, m[dartx._get](i));
+        } else {
+          let n = (dart.notNull(this[_w][dartx._get](i - 3)) ^ dart.notNull(this[_w][dartx._get](i - 8)) ^ dart.notNull(this[_w][dartx._get](i - 14)) ^ dart.notNull(this[_w][dartx._get](i - 16))) >>> 0;
+          this[_w][dartx._set](i, this[_rotl32](n, 1));
+        }
+        let t = this[_add32](this[_add32](this[_rotl32](a, 5), e), this[_w][dartx._get](i));
+        if (i < 20) {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) & dart.notNull(c) | ~dart.notNull(b) & dart.notNull(d)) >>> 0), 1518500249);
+        } else if (i < 40) {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0), 1859775393);
+        } else if (i < 60) {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) & dart.notNull(c) | dart.notNull(b) & dart.notNull(d) | dart.notNull(c) & dart.notNull(d)) >>> 0), 2400959708);
+        } else {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0), 3395469782);
+        }
+        e = d;
+        d = c;
+        c = this[_rotl32](b, 30);
+        b = a;
+        a = core.int._check(dart.dsend(t, '&', io._MASK_32));
+      }
+      this[_h][dartx._set](0, core.int._check(this[_add32](a, this[_h][dartx._get](0))));
+      this[_h][dartx._set](1, core.int._check(this[_add32](b, this[_h][dartx._get](1))));
+      this[_h][dartx._set](2, core.int._check(this[_add32](c, this[_h][dartx._get](2))));
+      this[_h][dartx._set](3, core.int._check(this[_add32](d, this[_h][dartx._get](3))));
+      this[_h][dartx._set](4, core.int._check(this[_add32](e, this[_h][dartx._get](4))));
+    }
+  };
+  dart.setSignature(io._SHA1, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SHA1, [])}),
+    fields: () => ({[_w]: ListOfint()}),
+    methods: () => ({
+      newInstance: dart.definiteFunctionType(io._SHA1, []),
+      [_updateHash]: dart.definiteFunctionType(dart.void, [ListOfint()])
+    })
+  });
+  io.ZLibOption = class ZLibOption extends core.Object {};
+  dart.setSignature(io.ZLibOption, {
+    sfields: () => ({
+      MIN_WINDOW_BITS: core.int,
+      MAX_WINDOW_BITS: core.int,
+      DEFAULT_WINDOW_BITS: core.int,
+      MIN_LEVEL: core.int,
+      MAX_LEVEL: core.int,
+      DEFAULT_LEVEL: core.int,
+      MIN_MEM_LEVEL: core.int,
+      MAX_MEM_LEVEL: core.int,
+      DEFAULT_MEM_LEVEL: core.int,
+      STRATEGY_FILTERED: core.int,
+      STRATEGY_HUFFMAN_ONLY: core.int,
+      STRATEGY_RLE: core.int,
+      STRATEGY_FIXED: core.int,
+      STRATEGY_DEFAULT: core.int
+    })
+  });
+  io.ZLibOption.MIN_WINDOW_BITS = 8;
+  io.ZLibOption.MAX_WINDOW_BITS = 15;
+  io.ZLibOption.DEFAULT_WINDOW_BITS = 15;
+  io.ZLibOption.MIN_LEVEL = -1;
+  io.ZLibOption.MAX_LEVEL = 9;
+  io.ZLibOption.DEFAULT_LEVEL = 6;
+  io.ZLibOption.MIN_MEM_LEVEL = 1;
+  io.ZLibOption.MAX_MEM_LEVEL = 9;
+  io.ZLibOption.DEFAULT_MEM_LEVEL = 8;
+  io.ZLibOption.STRATEGY_FILTERED = 1;
+  io.ZLibOption.STRATEGY_HUFFMAN_ONLY = 2;
+  io.ZLibOption.STRATEGY_RLE = 3;
+  io.ZLibOption.STRATEGY_FIXED = 4;
+  io.ZLibOption.STRATEGY_DEFAULT = 0;
+  io.ZLibCodec = class ZLibCodec extends convert.Codec$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+      let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      let gzip = opts && 'gzip' in opts ? opts.gzip : false;
+      this.level = level;
+      this.windowBits = windowBits;
+      this.memLevel = memLevel;
+      this.strategy = strategy;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      this.gzip = gzip;
+      super.new();
+      io._validateZLibeLevel(this.level);
+      io._validateZLibMemLevel(this.memLevel);
+      io._validateZLibStrategy(this.strategy);
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    _default() {
+      this.level = io.ZLibOption.DEFAULT_LEVEL;
+      this.windowBits = io.ZLibOption.DEFAULT_WINDOW_BITS;
+      this.memLevel = io.ZLibOption.DEFAULT_MEM_LEVEL;
+      this.strategy = io.ZLibOption.STRATEGY_DEFAULT;
+      this.raw = false;
+      this.gzip = false;
+      this.dictionary = null;
+      super.new();
+    }
+    get encoder() {
+      return new io.ZLibEncoder({gzip: false, level: this.level, windowBits: this.windowBits, memLevel: this.memLevel, strategy: this.strategy, dictionary: this.dictionary, raw: this.raw});
+    }
+    get decoder() {
+      return new io.ZLibDecoder({windowBits: this.windowBits, dictionary: this.dictionary, raw: this.raw});
+    }
+  };
+  dart.addSimpleTypeTests(io.ZLibCodec);
+  dart.defineNamedConstructor(io.ZLibCodec, '_default');
+  dart.setSignature(io.ZLibCodec, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.ZLibCodec, [], {level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool, gzip: core.bool}),
+      _default: dart.definiteFunctionType(io.ZLibCodec, [])
+    }),
+    fields: () => ({
+      gzip: core.bool,
+      level: core.int,
+      memLevel: core.int,
+      strategy: core.int,
+      windowBits: core.int,
+      raw: core.bool,
+      dictionary: ListOfint()
+    }),
+    getters: () => ({
+      encoder: dart.definiteFunctionType(io.ZLibEncoder, []),
+      decoder: dart.definiteFunctionType(io.ZLibDecoder, [])
+    })
+  });
+  io.ZLIB = dart.const(new io.ZLibCodec._default());
+  io.GZipCodec = class GZipCodec extends convert.Codec$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+      let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      let gzip = opts && 'gzip' in opts ? opts.gzip : true;
+      this.level = level;
+      this.windowBits = windowBits;
+      this.memLevel = memLevel;
+      this.strategy = strategy;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      this.gzip = gzip;
+      super.new();
+      io._validateZLibeLevel(this.level);
+      io._validateZLibMemLevel(this.memLevel);
+      io._validateZLibStrategy(this.strategy);
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    _default() {
+      this.level = io.ZLibOption.DEFAULT_LEVEL;
+      this.windowBits = io.ZLibOption.DEFAULT_WINDOW_BITS;
+      this.memLevel = io.ZLibOption.DEFAULT_MEM_LEVEL;
+      this.strategy = io.ZLibOption.STRATEGY_DEFAULT;
+      this.raw = false;
+      this.gzip = true;
+      this.dictionary = null;
+      super.new();
+    }
+    get encoder() {
+      return new io.ZLibEncoder({gzip: true, level: this.level, windowBits: this.windowBits, memLevel: this.memLevel, strategy: this.strategy, dictionary: this.dictionary, raw: this.raw});
+    }
+    get decoder() {
+      return new io.ZLibDecoder({windowBits: this.windowBits, dictionary: this.dictionary, raw: this.raw});
+    }
+  };
+  dart.addSimpleTypeTests(io.GZipCodec);
+  dart.defineNamedConstructor(io.GZipCodec, '_default');
+  dart.setSignature(io.GZipCodec, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.GZipCodec, [], {level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool, gzip: core.bool}),
+      _default: dart.definiteFunctionType(io.GZipCodec, [])
+    }),
+    fields: () => ({
+      gzip: core.bool,
+      level: core.int,
+      memLevel: core.int,
+      strategy: core.int,
+      windowBits: core.int,
+      dictionary: ListOfint(),
+      raw: core.bool
+    }),
+    getters: () => ({
+      encoder: dart.definiteFunctionType(io.ZLibEncoder, []),
+      decoder: dart.definiteFunctionType(io.ZLibDecoder, [])
+    })
+  });
+  io.GZIP = dart.const(new io.GZipCodec._default());
+  io.ZLibEncoder = class ZLibEncoder extends convert.Converter$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let gzip = opts && 'gzip' in opts ? opts.gzip : false;
+      let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+      let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      this.gzip = gzip;
+      this.level = level;
+      this.windowBits = windowBits;
+      this.memLevel = memLevel;
+      this.strategy = strategy;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      super.new();
+      io._validateZLibeLevel(this.level);
+      io._validateZLibMemLevel(this.memLevel);
+      io._validateZLibStrategy(this.strategy);
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    convert(bytes) {
+      let sink = new io._BufferSink();
+      let _ = this.startChunkedConversion(sink);
+      _.add(bytes);
+      _.close();
+      return sink.builder.takeBytes();
+    }
+    startChunkedConversion(sink) {
+      if (!convert.ByteConversionSink.is(sink)) {
+        sink = convert.ByteConversionSink.from(sink);
+      }
+      return new io._ZLibEncoderSink(convert.ByteConversionSink._check(sink), this.gzip, this.level, this.windowBits, this.memLevel, this.strategy, this.dictionary, this.raw);
+    }
+  };
+  dart.addSimpleTypeTests(io.ZLibEncoder);
+  dart.setSignature(io.ZLibEncoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ZLibEncoder, [], {gzip: core.bool, level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool})}),
+    fields: () => ({
+      gzip: core.bool,
+      level: core.int,
+      memLevel: core.int,
+      strategy: core.int,
+      windowBits: core.int,
+      dictionary: ListOfint(),
+      raw: core.bool
+    }),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.List$(core.int), [ListOfint()]),
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfListOfint()])
+    })
+  });
+  io.ZLibDecoder = class ZLibDecoder extends convert.Converter$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      this.windowBits = windowBits;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      super.new();
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    convert(bytes) {
+      let sink = new io._BufferSink();
+      let _ = this.startChunkedConversion(sink);
+      _.add(bytes);
+      _.close();
+      return sink.builder.takeBytes();
+    }
+    startChunkedConversion(sink) {
+      if (!convert.ByteConversionSink.is(sink)) {
+        sink = convert.ByteConversionSink.from(sink);
+      }
+      return new io._ZLibDecoderSink(convert.ByteConversionSink._check(sink), this.windowBits, this.dictionary, this.raw);
+    }
+  };
+  dart.addSimpleTypeTests(io.ZLibDecoder);
+  dart.setSignature(io.ZLibDecoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ZLibDecoder, [], {windowBits: core.int, dictionary: ListOfint(), raw: core.bool})}),
+    fields: () => ({
+      windowBits: core.int,
+      dictionary: ListOfint(),
+      raw: core.bool
+    }),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.List$(core.int), [ListOfint()]),
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfListOfint()])
+    })
+  });
+  io._BufferSink = class _BufferSink extends convert.ByteConversionSink {
+    new() {
+      this.builder = io.BytesBuilder.new({copy: false});
+      super.new();
+    }
+    add(chunk) {
+      this.builder.add(chunk);
+    }
+    addSlice(chunk, start, end, isLast) {
+      if (typed_data.Uint8List.is(chunk)) {
+        let list = chunk;
+        this.builder.add(typed_data.Uint8List.view(list[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+      } else {
+        this.builder.add(chunk[dartx.sublist](start, end));
+      }
+    }
+    close() {}
+  };
+  dart.setSignature(io._BufferSink, {
+    fields: () => ({builder: io.BytesBuilder}),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+      close: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _sink$0 = Symbol('_sink');
+  const _filter$ = Symbol('_filter');
+  const _closed = Symbol('_closed');
+  const _empty = Symbol('_empty');
+  let const$52;
+  io._FilterSink = class _FilterSink extends convert.ByteConversionSink {
+    new(sink, filter) {
+      this[_sink$0] = sink;
+      this[_filter$] = filter;
+      this[_closed] = false;
+      this[_empty] = true;
+      super.new();
+    }
+    add(data) {
+      this.addSlice(data, 0, data[dartx.length], false);
+    }
+    addSlice(data, start, end, isLast) {
+      if (dart.test(this[_closed])) return;
+      if (end == null) dart.throw(new core.ArgumentError.notNull("end"));
+      core.RangeError.checkValidRange(start, end, data[dartx.length]);
+      try {
+        this[_empty] = false;
+        let bufferAndStart = io._ensureFastAndSerializableByteData(data, start, end);
+        this[_filter$].process(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+        let out = null;
+        while ((out = this[_filter$].processed({flush: false})) != null) {
+          this[_sink$0].add(ListOfint()._check(out));
+        }
+      } catch (e) {
+        this[_closed] = true;
+        throw e;
+      }
+
+      if (dart.test(isLast)) this.close();
+    }
+    close() {
+      if (dart.test(this[_closed])) return;
+      if (dart.test(this[_empty])) this[_filter$].process(const$52 || (const$52 = dart.constList([], core.int)), 0, 0);
+      try {
+        let out = null;
+        while ((out = this[_filter$].processed({end: true})) != null) {
+          this[_sink$0].add(ListOfint()._check(out));
+        }
+      } catch (e) {
+        this[_closed] = true;
+        dart.throw(e);
+      }
+
+      this[_closed] = true;
+      this[_sink$0].close();
+    }
+  };
+  dart.setSignature(io._FilterSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._FilterSink, [convert.ByteConversionSink, io._Filter])}),
+    fields: () => ({
+      [_filter$]: io._Filter,
+      [_sink$0]: convert.ByteConversionSink,
+      [_closed]: core.bool,
+      [_empty]: core.bool
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+      close: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._ZLibEncoderSink = class _ZLibEncoderSink extends io._FilterSink {
+    new(sink, gzip, level, windowBits, memLevel, strategy, dictionary, raw) {
+      super.new(sink, io._Filter._newZLibDeflateFilter(gzip, level, windowBits, memLevel, strategy, dictionary, raw));
+    }
+  };
+  dart.setSignature(io._ZLibEncoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ZLibEncoderSink, [convert.ByteConversionSink, core.bool, core.int, core.int, core.int, core.int, ListOfint(), core.bool])})
+  });
+  io._ZLibDecoderSink = class _ZLibDecoderSink extends io._FilterSink {
+    new(sink, windowBits, dictionary, raw) {
+      super.new(sink, io._Filter._newZLibInflateFilter(windowBits, dictionary, raw));
+    }
+  };
+  dart.setSignature(io._ZLibDecoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ZLibDecoderSink, [convert.ByteConversionSink, core.int, ListOfint(), core.bool])})
+  });
+  io._Filter = class _Filter extends core.Object {
+    static _newZLibDeflateFilter(gzip, level, windowBits, memLevel, strategy, dictionary, raw) {
+      dart.throw(new core.UnsupportedError("_newZLibDeflateFilter"));
+    }
+    static _newZLibInflateFilter(windowBits, dictionary, raw) {
+      dart.throw(new core.UnsupportedError("_newZLibInflateFilter"));
+    }
+  };
+  dart.setSignature(io._Filter, {
+    statics: () => ({
+      _newZLibDeflateFilter: dart.definiteFunctionType(io._Filter, [core.bool, core.int, core.int, core.int, core.int, ListOfint(), core.bool]),
+      _newZLibInflateFilter: dart.definiteFunctionType(io._Filter, [core.int, ListOfint(), core.bool])
+    }),
+    names: ['_newZLibDeflateFilter', '_newZLibInflateFilter']
+  });
+  io._validateZLibWindowBits = function(windowBits) {
+    if (io.ZLibOption.MIN_WINDOW_BITS > dart.notNull(windowBits) || io.ZLibOption.MAX_WINDOW_BITS < dart.notNull(windowBits)) {
+      dart.throw(new core.RangeError.range(windowBits, io.ZLibOption.MIN_WINDOW_BITS, io.ZLibOption.MAX_WINDOW_BITS));
+    }
+  };
+  dart.fn(io._validateZLibWindowBits, intTovoid());
+  io._validateZLibeLevel = function(level) {
+    if (io.ZLibOption.MIN_LEVEL > dart.notNull(level) || io.ZLibOption.MAX_LEVEL < dart.notNull(level)) {
+      dart.throw(new core.RangeError.range(level, io.ZLibOption.MIN_LEVEL, io.ZLibOption.MAX_LEVEL));
+    }
+  };
+  dart.fn(io._validateZLibeLevel, intTovoid());
+  io._validateZLibMemLevel = function(memLevel) {
+    if (io.ZLibOption.MIN_MEM_LEVEL > dart.notNull(memLevel) || io.ZLibOption.MAX_MEM_LEVEL < dart.notNull(memLevel)) {
+      dart.throw(new core.RangeError.range(memLevel, io.ZLibOption.MIN_MEM_LEVEL, io.ZLibOption.MAX_MEM_LEVEL));
+    }
+  };
+  dart.fn(io._validateZLibMemLevel, intTovoid());
+  let const$53;
+  io._validateZLibStrategy = function(strategy) {
+    let strategies = const$53 || (const$53 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
+    if (strategies[dartx.indexOf](strategy) == -1) {
+      dart.throw(new core.ArgumentError("Unsupported 'strategy'"));
+    }
+  };
+  dart.fn(io._validateZLibStrategy, intTovoid());
+  io.Directory = class Directory extends core.Object {
+    static new(path) {
+      return new io._Directory(path);
+    }
+    static fromUri(uri) {
+      return io.Directory.new(uri.toFilePath());
+    }
+    static get current() {
+      return io._Directory.current;
+    }
+    static set current(path) {
+      io._Directory.current = path;
+    }
+    static get systemTemp() {
+      return io._Directory.systemTemp;
+    }
+  };
+  io.Directory[dart.implements] = () => [io.FileSystemEntity];
+  dart.setSignature(io.Directory, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.Directory, [core.String]),
+      fromUri: dart.definiteFunctionType(io.Directory, [core.Uri])
+    }),
+    fields: () => ({path: core.String}),
+    sgetters: () => ({
+      current: dart.definiteFunctionType(io.Directory, []),
+      systemTemp: dart.definiteFunctionType(io.Directory, [])
+    }),
+    ssetters: () => ({current: dart.definiteFunctionType(dart.void, [dart.dynamic])})
+  });
+  const _isErrorResponse = Symbol('_isErrorResponse');
+  const _exceptionOrErrorFromResponse = Symbol('_exceptionOrErrorFromResponse');
+  const _absolutePath = Symbol('_absolutePath');
+  const _computeExistingIndex = Symbol('_computeExistingIndex');
+  const _delete = Symbol('_delete');
+  const _deleteSync = Symbol('_deleteSync');
+  const _type = Symbol('_type');
+  io.FileSystemEntity = class FileSystemEntity extends core.Object {
+    get uri() {
+      return core.Uri.file(this.path);
+    }
+    resolveSymbolicLinks() {
+      return io._IOService._dispatch(io._FILE_RESOLVE_SYMBOLIC_LINKS, JSArrayOfString().of([this.path])).then(core.String)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot resolve symbolic links", this.path));
+        }
+        return FutureOrOfString()._check(response);
+      }, dynamicToFutureOrOfString()));
+    }
+    resolveSymbolicLinksSync() {
+      let result = io.FileSystemEntity._resolveSymbolicLinks(this.path);
+      io.FileSystemEntity._throwIfError(result, "Cannot resolve symbolic links", this.path);
+      return core.String._check(result);
+    }
+    delete(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return this[_delete]({recursive: recursive});
+    }
+    deleteSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return this[_deleteSync]({recursive: recursive});
+    }
+    watch(opts) {
+      let events = opts && 'events' in opts ? opts.events : io.FileSystemEvent.ALL;
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return io._FileSystemWatcher._watch(io.FileSystemEntity._trimTrailingPathSeparators(this.path), events, recursive);
+    }
+    static identical(path1, path2) {
+      return io._IOService._dispatch(io._FILE_IDENTICAL, JSArrayOfString().of([path1, path2])).then(core.bool)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, dart.str`Error in FileSystemEntity.identical(${path1}, ${path2})`, ""));
+        }
+        return FutureOrOfbool()._check(response);
+      }, dynamicToFutureOrOfbool()));
+    }
+    get isAbsolute() {
+      if (dart.test(io.Platform.isWindows)) {
+        return this.path[dartx.startsWith](io.FileSystemEntity._absoluteWindowsPathPattern);
+      } else {
+        return this.path[dartx.startsWith]('/');
+      }
+    }
+    get [_absolutePath]() {
+      if (dart.test(this.isAbsolute)) return this.path;
+      let current = io.Directory.current.path;
+      if (dart.test(current[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(current[dartx.endsWith]('\\'))) {
+        return dart.str`${current}${this.path}`;
+      } else {
+        return dart.str`${current}${io.Platform.pathSeparator}${this.path}`;
+      }
+    }
+    static identicalSync(path1, path2) {
+      let result = io.FileSystemEntity._identical(path1, path2);
+      io.FileSystemEntity._throwIfError(result, 'Error in FileSystemEntity.identicalSync');
+      return core.bool._check(result);
+    }
+    static get isWatchSupported() {
+      return io._FileSystemWatcher.isSupported;
+    }
+    static type(path, opts) {
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      return io.FileSystemEntity._getTypeAsync(path, followLinks).then(io.FileSystemEntityType)(io.FileSystemEntityType._lookup);
+    }
+    static typeSync(path, opts) {
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      return io.FileSystemEntityType._lookup(io.FileSystemEntity._getTypeSync(path, followLinks));
+    }
+    static isLink(path) {
+      return io.FileSystemEntity._getTypeAsync(path, false).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.LINK[_type], intTobool()));
+    }
+    static isFile(path) {
+      return io.FileSystemEntity._getTypeAsync(path, true).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.FILE[_type], intTobool()));
+    }
+    static isDirectory(path) {
+      return io.FileSystemEntity._getTypeAsync(path, true).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.DIRECTORY[_type], intTobool()));
+    }
+    static isLinkSync(path) {
+      return io.FileSystemEntity._getTypeSync(path, false) == io.FileSystemEntityType.LINK[_type];
+    }
+    static isFileSync(path) {
+      return io.FileSystemEntity._getTypeSync(path, true) == io.FileSystemEntityType.FILE[_type];
+    }
+    static isDirectorySync(path) {
+      return io.FileSystemEntity._getTypeSync(path, true) == io.FileSystemEntityType.DIRECTORY[_type];
+    }
+    static _getType(path, followLinks) {
+      dart.throw(new core.UnsupportedError("FileSystemEntity._getType"));
+    }
+    static _identical(path1, path2) {
+      dart.throw(new core.UnsupportedError("FileSystemEntity._identical"));
+    }
+    static _resolveSymbolicLinks(path) {
+      dart.throw(new core.UnsupportedError("FileSystemEntity._resolveSymbolicLinks"));
+    }
+    static parentOf(path) {
+      let rootEnd = -1;
+      if (dart.test(io.Platform.isWindows)) {
+        if (dart.test(path[dartx.startsWith](io.FileSystemEntity._absoluteWindowsPathPattern))) {
+          rootEnd = path[dartx.indexOf](core.RegExp.new('[/\\\\]'), 2);
+          if (rootEnd == -1) return path;
+        } else if (dart.test(path[dartx.startsWith]('\\')) || dart.test(path[dartx.startsWith]('/'))) {
+          rootEnd = 0;
+        }
+      } else if (dart.test(path[dartx.startsWith]('/'))) {
+        rootEnd = 0;
+      }
+      let pos = path[dartx.lastIndexOf](io.FileSystemEntity._parentRegExp);
+      if (dart.notNull(pos) > dart.notNull(rootEnd)) {
+        return path[dartx.substring](0, dart.notNull(pos) + 1);
+      } else if (dart.notNull(rootEnd) > -1) {
+        return path[dartx.substring](0, dart.notNull(rootEnd) + 1);
+      } else {
+        return '.';
+      }
+    }
+    get parent() {
+      return io.Directory.new(io.FileSystemEntity.parentOf(this.path));
+    }
+    static _getTypeSync(path, followLinks) {
+      let result = io.FileSystemEntity._getType(path, followLinks);
+      io.FileSystemEntity._throwIfError(result, 'Error getting type of FileSystemEntity');
+      return core.int._check(result);
+    }
+    static _getTypeAsync(path, followLinks) {
+      return io._IOService._dispatch(io._FILE_TYPE, JSArrayOfObject().of([path, followLinks])).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Error getting type", path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    static _throwIfError(result, msg, path) {
+      if (path === void 0) path = null;
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException(msg, path, result));
+      } else if (core.ArgumentError.is(result)) {
+        dart.throw(result);
+      }
+    }
+    static _trimTrailingPathSeparators(path) {
+      if (!(typeof path == 'string')) return path;
+      if (dart.test(io.Platform.isWindows)) {
+        while (dart.notNull(path[dartx.length]) > 1 && (dart.test(path[dartx.endsWith](io.Platform.pathSeparator)) || dart.test(path[dartx.endsWith]('/')))) {
+          path = path[dartx.substring](0, dart.notNull(path[dartx.length]) - 1);
+        }
+      } else {
+        while (dart.notNull(path[dartx.length]) > 1 && dart.test(path[dartx.endsWith](io.Platform.pathSeparator))) {
+          path = path[dartx.substring](0, dart.notNull(path[dartx.length]) - 1);
+        }
+      }
+      return path;
+    }
+    static _ensureTrailingPathSeparators(path) {
+      if (!(typeof path == 'string')) return path;
+      if (dart.test(path[dartx.isEmpty])) path = '.';
+      if (dart.test(io.Platform.isWindows)) {
+        while (!dart.test(path[dartx.endsWith](io.Platform.pathSeparator)) && !dart.test(path[dartx.endsWith]('/'))) {
+          path = dart.str`${path}${io.Platform.pathSeparator}`;
+        }
+      } else {
+        while (!dart.test(path[dartx.endsWith](io.Platform.pathSeparator))) {
+          path = dart.str`${path}${io.Platform.pathSeparator}`;
+        }
+      }
+      return path;
+    }
+  };
+  dart.setSignature(io.FileSystemEntity, {
+    getters: () => ({
+      uri: dart.definiteFunctionType(core.Uri, []),
+      isAbsolute: dart.definiteFunctionType(core.bool, []),
+      [_absolutePath]: dart.definiteFunctionType(core.String, []),
+      parent: dart.definiteFunctionType(io.Directory, [])
+    }),
+    methods: () => ({
+      resolveSymbolicLinks: dart.definiteFunctionType(async.Future$(core.String), []),
+      resolveSymbolicLinksSync: dart.definiteFunctionType(core.String, []),
+      delete: dart.definiteFunctionType(async.Future$(io.FileSystemEntity), [], {recursive: core.bool}),
+      deleteSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [], {events: core.int, recursive: core.bool})
+    }),
+    sfields: () => ({
+      _absoluteWindowsPathPattern: core.RegExp,
+      _parentRegExp: core.RegExp
+    }),
+    sgetters: () => ({isWatchSupported: dart.definiteFunctionType(core.bool, [])}),
+    statics: () => ({
+      identical: dart.definiteFunctionType(async.Future$(core.bool), [core.String, core.String]),
+      identicalSync: dart.definiteFunctionType(core.bool, [core.String, core.String]),
+      type: dart.definiteFunctionType(async.Future$(io.FileSystemEntityType), [core.String], {followLinks: core.bool}),
+      typeSync: dart.definiteFunctionType(io.FileSystemEntityType, [core.String], {followLinks: core.bool}),
+      isLink: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+      isFile: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+      isDirectory: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+      isLinkSync: dart.definiteFunctionType(core.bool, [core.String]),
+      isFileSync: dart.definiteFunctionType(core.bool, [core.String]),
+      isDirectorySync: dart.definiteFunctionType(core.bool, [core.String]),
+      _getType: dart.definiteFunctionType(dart.dynamic, [core.String, core.bool]),
+      _identical: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _resolveSymbolicLinks: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      parentOf: dart.definiteFunctionType(core.String, [core.String]),
+      _getTypeSync: dart.definiteFunctionType(core.int, [core.String, core.bool]),
+      _getTypeAsync: dart.definiteFunctionType(async.Future$(core.int), [core.String, core.bool]),
+      _throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String], [core.String]),
+      _trimTrailingPathSeparators: dart.definiteFunctionType(core.String, [core.String]),
+      _ensureTrailingPathSeparators: dart.definiteFunctionType(core.String, [core.String])
+    }),
+    names: ['identical', 'identicalSync', 'type', 'typeSync', 'isLink', 'isFile', 'isDirectory', 'isLinkSync', 'isFileSync', 'isDirectorySync', '_getType', '_identical', '_resolveSymbolicLinks', 'parentOf', '_getTypeSync', '_getTypeAsync', '_throwIfError', '_trimTrailingPathSeparators', '_ensureTrailingPathSeparators']
+  });
+  dart.defineLazy(io.FileSystemEntity, {
+    get _absoluteWindowsPathPattern() {
+      return core.RegExp.new('^(\\\\\\\\|[a-zA-Z]:[/\\\\])');
+    },
+    get _parentRegExp() {
+      return dart.test(io.Platform.isWindows) ? core.RegExp.new('[^/\\\\][/\\\\]+[^/\\\\]') : core.RegExp.new('[^/]/+[^/]');
+    }
+  });
+  io._Directory = class _Directory extends io.FileSystemEntity {
+    new(path) {
+      this.path = path;
+      if (!(typeof this.path == 'string')) {
+        dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+      }
+    }
+    static _current() {
+      dart.throw(new core.UnsupportedError("Directory._current"));
+    }
+    static _setCurrent(path) {
+      dart.throw(new core.UnsupportedError("Directory_SetCurrent"));
+    }
+    static _createTemp(path) {
+      dart.throw(new core.UnsupportedError("Directory._createTemp"));
+    }
+    static _systemTemp() {
+      dart.throw(new core.UnsupportedError("Directory._systemTemp"));
+    }
+    static _exists(path) {
+      dart.throw(new core.UnsupportedError("Directory._exists"));
+    }
+    static _create(path) {
+      dart.throw(new core.UnsupportedError("Directory._create"));
+    }
+    static _deleteNative(path, recursive) {
+      dart.throw(new core.UnsupportedError("Directory._deleteNative"));
+    }
+    static _rename(path, newPath) {
+      dart.throw(new core.UnsupportedError("Directory._rename"));
+    }
+    static _fillWithDirectoryListing(list, path, recursive, followLinks) {
+      dart.throw(new core.UnsupportedError("Directory._fillWithDirectoryListing"));
+    }
+    static get current() {
+      let result = io._Directory._current();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Getting current working directory failed", "", result));
+      }
+      return new io._Directory(core.String._check(result));
+    }
+    static set current(path) {
+      if (io.Directory.is(path)) path = dart.dload(path, 'path');
+      let result = io._Directory._setCurrent(path);
+      if (core.ArgumentError.is(result)) dart.throw(result);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Setting current working directory failed", core.String._check(path), result));
+      }
+    }
+    get uri() {
+      return core.Uri.directory(this.path);
+    }
+    exists() {
+      return io._IOService._dispatch(io._DIRECTORY_EXISTS, JSArrayOfString().of([this.path])).then(core.bool)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Exists failed"));
+        }
+        return dart.equals(response, 1);
+      }, dynamicTobool$()));
+    }
+    existsSync() {
+      let result = io._Directory._exists(this.path);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Exists failed", this.path, result));
+      }
+      return dart.equals(result, 1);
+    }
+    get absolute() {
+      return io.Directory.new(this[_absolutePath]);
+    }
+    stat() {
+      return io.FileStat.stat(this.path);
+    }
+    statSync() {
+      return io.FileStat.statSync(this.path);
+    }
+    [_computeExistingIndex](dirsToCreate) {
+      let future = null;
+      let notFound = dirsToCreate[dartx.length];
+      for (let i = 0; i < dart.notNull(dirsToCreate[dartx.length]); i++) {
+        if (future == null) {
+          future = dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
+        } else {
+          future = dart.dsend(future, 'then', dart.fn(index => {
+            if (!dart.equals(index, notFound)) {
+              return async.Future.value(index);
+            }
+            return dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
+          }, dynamicTodynamic$()));
+        }
+      }
+      if (future == null) {
+        return FutureOfint().value(notFound);
+      } else {
+        return FutureOfint()._check(future);
+      }
+    }
+    create(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return this.exists().then(io.Directory)(dart.fn(exists => {
+          if (dart.test(exists)) return this;
+          if (this.path != this.parent.path) {
+            return this.parent.create({recursive: true}).then(io.Directory)(dart.fn(_ => this.create(), DirectoryToFutureOfDirectory()));
+          } else {
+            return this.create();
+          }
+        }, boolToFutureOrOfDirectory()));
+      } else {
+        return io._IOService._dispatch(io._DIRECTORY_CREATE, JSArrayOfString().of([this.path])).then(io._Directory)(dart.fn(response => {
+          if (dart.test(this[_isErrorResponse](response))) {
+            dart.throw(this[_exceptionOrErrorFromResponse](response, "Creation failed"));
+          }
+          return this;
+        }, dynamicTo_Directory()));
+      }
+    }
+    createSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        if (dart.test(this.existsSync())) return;
+        if (this.path != this.parent.path) {
+          this.parent.createSync({recursive: true});
+        }
+      }
+      let result = io._Directory._create(this.path);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Creation failed", this.path, result));
+      }
+    }
+    static get systemTemp() {
+      return io.Directory.new(io._Directory._systemTemp());
+    }
+    createTemp(prefix) {
+      if (prefix === void 0) prefix = null;
+      if (prefix == null) prefix = '';
+      if (this.path == '') {
+        dart.throw(new core.ArgumentError("Directory.createTemp called with an empty path. " + "To use the system temp directory, use Directory.systemTemp"));
+      }
+      let fullPrefix = null;
+      if (dart.test(this.path[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(this.path[dartx.endsWith]('\\'))) {
+        fullPrefix = dart.str`${this.path}${prefix}`;
+      } else {
+        fullPrefix = dart.str`${this.path}${io.Platform.pathSeparator}${prefix}`;
+      }
+      return io._IOService._dispatch(io._DIRECTORY_CREATE_TEMP, JSArrayOfString().of([fullPrefix])).then(io.Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Creation of temporary directory failed"));
+        }
+        return io.Directory.new(core.String._check(response));
+      }, dynamicToDirectory()));
+    }
+    createTempSync(prefix) {
+      if (prefix === void 0) prefix = null;
+      if (prefix == null) prefix = '';
+      if (this.path == '') {
+        dart.throw(new core.ArgumentError("Directory.createTemp called with an empty path. " + "To use the system temp directory, use Directory.systemTemp"));
+      }
+      let fullPrefix = null;
+      if (dart.test(this.path[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(this.path[dartx.endsWith]('\\'))) {
+        fullPrefix = dart.str`${this.path}${prefix}`;
+      } else {
+        fullPrefix = dart.str`${this.path}${io.Platform.pathSeparator}${prefix}`;
+      }
+      let result = io._Directory._createTemp(fullPrefix);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Creation of temporary directory failed", fullPrefix, result));
+      }
+      return io.Directory.new(core.String._check(result));
+    }
+    [_delete](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return io._IOService._dispatch(io._DIRECTORY_DELETE, JSArrayOfObject().of([this.path, recursive])).then(io._Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Deletion failed"));
+        }
+        return this;
+      }, dynamicTo_Directory()));
+    }
+    [_deleteSync](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let result = io._Directory._deleteNative(this.path, recursive);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Deletion failed", this.path, result));
+      }
+    }
+    rename(newPath) {
+      return io._IOService._dispatch(io._DIRECTORY_RENAME, JSArrayOfString().of([this.path, newPath])).then(io.Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Rename failed"));
+        }
+        return io.Directory.new(newPath);
+      }, dynamicToDirectory()));
+    }
+    renameSync(newPath) {
+      if (!(typeof newPath == 'string')) {
+        dart.throw(new core.ArgumentError());
+      }
+      let result = io._Directory._rename(this.path, newPath);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Rename failed", this.path, result));
+      }
+      return io.Directory.new(newPath);
+    }
+    list(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      return StreamOfFileSystemEntity()._check(new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream);
+    }
+    listSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      if (!(typeof recursive == 'boolean') || !(typeof followLinks == 'boolean')) {
+        dart.throw(new core.ArgumentError());
+      }
+      let result = JSArrayOfFileSystemEntity().of([]);
+      io._Directory._fillWithDirectoryListing(result, io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks);
+      return result;
+    }
+    toString() {
+      return dart.str`Directory: '${this.path}'`;
+    }
+    [_isErrorResponse](response) {
+      return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+    }
+    [_exceptionOrErrorFromResponse](response, message) {
+      dart.assert(this[_isErrorResponse](response));
+      switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+        case io._ILLEGAL_ARGUMENT_RESPONSE:
+        {
+          return new core.ArgumentError();
+        }
+        case io._OSERROR_RESPONSE:
+        {
+          let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+          return new io.FileSystemException(message, this.path, err);
+        }
+        default:
+        {
+          return core.Exception.new("Unknown error");
+        }
+      }
+    }
+  };
+  io._Directory[dart.implements] = () => [io.Directory];
+  dart.setSignature(io._Directory, {
+    constructors: () => ({new: dart.definiteFunctionType(io._Directory, [core.String])}),
+    fields: () => ({path: core.String}),
+    getters: () => ({absolute: dart.definiteFunctionType(io.Directory, [])}),
+    methods: () => ({
+      exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+      existsSync: dart.definiteFunctionType(core.bool, []),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+      statSync: dart.definiteFunctionType(io.FileStat, []),
+      [_computeExistingIndex]: dart.definiteFunctionType(async.Future$(core.int), [core.List]),
+      create: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
+      createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      createTemp: dart.definiteFunctionType(async.Future$(io.Directory), [], [core.String]),
+      createTempSync: dart.definiteFunctionType(io.Directory, [], [core.String]),
+      [_delete]: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
+      [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      rename: dart.definiteFunctionType(async.Future$(io.Directory), [core.String]),
+      renameSync: dart.definiteFunctionType(io.Directory, [core.String]),
+      list: dart.definiteFunctionType(async.Stream$(io.FileSystemEntity), [], {recursive: core.bool, followLinks: core.bool}),
+      listSync: dart.definiteFunctionType(core.List$(io.FileSystemEntity), [], {recursive: core.bool, followLinks: core.bool}),
+      [_isErrorResponse]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+      [_exceptionOrErrorFromResponse]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String])
+    }),
+    sgetters: () => ({
+      current: dart.definiteFunctionType(io.Directory, []),
+      systemTemp: dart.definiteFunctionType(io.Directory, [])
+    }),
+    ssetters: () => ({current: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+    statics: () => ({
+      _current: dart.definiteFunctionType(dart.dynamic, []),
+      _setCurrent: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]),
+      _createTemp: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _systemTemp: dart.definiteFunctionType(core.String, []),
+      _exists: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _create: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _deleteNative: dart.definiteFunctionType(dart.dynamic, [core.String, core.bool]),
+      _rename: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _fillWithDirectoryListing: dart.definiteFunctionType(dart.void, [ListOfFileSystemEntity(), core.String, core.bool, core.bool])
+    }),
+    names: ['_current', '_setCurrent', '_createTemp', '_systemTemp', '_exists', '_create', '_deleteNative', '_rename', '_fillWithDirectoryListing']
+  });
+  io._AsyncDirectoryListerOps = class _AsyncDirectoryListerOps extends core.Object {
+    static new(pointer) {
+      dart.throw(new core.UnsupportedError("Directory._list"));
+    }
+  };
+  dart.setSignature(io._AsyncDirectoryListerOps, {
+    constructors: () => ({new: dart.definiteFunctionType(io._AsyncDirectoryListerOps, [core.int])})
+  });
+  const _ops = Symbol('_ops');
+  const _pointer = Symbol('_pointer');
+  const _cleanup = Symbol('_cleanup');
+  io._AsyncDirectoryLister = class _AsyncDirectoryLister extends core.Object {
+    new(path, recursive, followLinks) {
+      this.closeCompleter = async.Completer.new();
+      this.path = path;
+      this.recursive = recursive;
+      this.followLinks = followLinks;
+      this.controller = null;
+      this.canceled = false;
+      this.nextRunning = false;
+      this.closed = false;
+      this[_ops] = null;
+      this.controller = async.StreamController.new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
+    }
+    [_pointer]() {
+      return this[_ops] == null ? null : this[_ops].getPointer();
+    }
+    get stream() {
+      return this.controller.stream;
+    }
+    onListen() {
+      io._IOService._dispatch(io._DIRECTORY_LIST_START, JSArrayOfObject().of([this.path, this.recursive, this.followLinks])).then(dart.dynamic)(dart.fn(response => {
+        if (typeof response == 'number') {
+          this[_ops] = io._AsyncDirectoryListerOps.new(response);
+          this.next();
+        } else if (core.Error.is(response)) {
+          this.controller.addError(response, response.stackTrace);
+          this.close();
+        } else {
+          this.error(response);
+          this.close();
+        }
+      }, dynamicToNull$()));
+    }
+    onResume() {
+      if (!dart.test(this.nextRunning)) {
+        this.next();
+      }
+    }
+    onCancel() {
+      this.canceled = true;
+      if (!dart.test(this.nextRunning)) {
+        this.close();
+      }
+      return this.closeCompleter.future;
+    }
+    next() {
+      if (dart.test(this.canceled)) {
+        this.close();
+        return;
+      }
+      if (dart.test(this.controller.isPaused) || dart.test(this.nextRunning)) {
+        return;
+      }
+      let pointer = this[_pointer]();
+      if (pointer == null) {
+        return;
+      }
+      this.nextRunning = true;
+      io._IOService._dispatch(io._DIRECTORY_LIST_NEXT, JSArrayOfint().of([pointer])).then(dart.dynamic)(dart.fn(result => {
+        this.nextRunning = false;
+        if (core.List.is(result)) {
+          this.next();
+          dart.assert(result[dartx.length][dartx['%']](2) == 0);
+          for (let i = 0; i < dart.notNull(result[dartx.length]); i++) {
+            dart.assert(i[dartx['%']](2) == 0);
+            switch (result[dartx._get](i++)) {
+              case io._AsyncDirectoryLister.LIST_FILE:
+              {
+                this.controller.add(io.File.new(core.String._check(result[dartx._get](i))));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_DIRECTORY:
+              {
+                this.controller.add(io.Directory.new(core.String._check(result[dartx._get](i))));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_LINK:
+              {
+                this.controller.add(io.Link.new(core.String._check(result[dartx._get](i))));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_ERROR:
+              {
+                this.error(result[dartx._get](i));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_DONE:
+              {
+                this.canceled = true;
+                return;
+              }
+            }
+          }
+        } else {
+          this.controller.addError(new io.FileSystemException("Internal error"));
+        }
+      }, dynamicToNull$()));
+    }
+    [_cleanup]() {
+      this.controller.close();
+      this.closeCompleter.complete();
+      this[_ops] = null;
+    }
+    close() {
+      if (dart.test(this.closed)) {
+        return;
+      }
+      if (dart.test(this.nextRunning)) {
+        return;
+      }
+      this.closed = true;
+      let pointer = this[_pointer]();
+      if (pointer == null) {
+        this[_cleanup]();
+      } else {
+        io._IOService._dispatch(io._DIRECTORY_LIST_STOP, JSArrayOfint().of([pointer])).whenComplete(dart.bind(this, _cleanup));
+      }
+    }
+    error(message) {
+      let errorType = dart.dindex(dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_ERROR), io._ERROR_RESPONSE_ERROR_TYPE);
+      if (dart.equals(errorType, io._ILLEGAL_ARGUMENT_RESPONSE)) {
+        this.controller.addError(new core.ArgumentError());
+      } else if (dart.equals(errorType, io._OSERROR_RESPONSE)) {
+        let responseError = dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_ERROR);
+        let err = new io.OSError(core.String._check(dart.dindex(responseError, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(responseError, io._OSERROR_RESPONSE_ERROR_CODE)));
+        let errorPath = dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_PATH);
+        if (errorPath == null) errorPath = this.path;
+        this.controller.addError(new io.FileSystemException("Directory listing failed", core.String._check(errorPath), err));
+      } else {
+        this.controller.addError(new io.FileSystemException("Internal error"));
+      }
+    }
+  };
+  dart.setSignature(io._AsyncDirectoryLister, {
+    constructors: () => ({new: dart.definiteFunctionType(io._AsyncDirectoryLister, [core.String, core.bool, core.bool])}),
+    fields: () => ({
+      path: core.String,
+      recursive: core.bool,
+      followLinks: core.bool,
+      controller: async.StreamController,
+      canceled: core.bool,
+      nextRunning: core.bool,
+      closed: core.bool,
+      [_ops]: io._AsyncDirectoryListerOps,
+      closeCompleter: async.Completer
+    }),
+    getters: () => ({stream: dart.definiteFunctionType(async.Stream, [])}),
+    methods: () => ({
+      [_pointer]: dart.definiteFunctionType(core.int, []),
+      onListen: dart.definiteFunctionType(dart.void, []),
+      onResume: dart.definiteFunctionType(dart.void, []),
+      onCancel: dart.definiteFunctionType(async.Future, []),
+      next: dart.definiteFunctionType(dart.void, []),
+      [_cleanup]: dart.definiteFunctionType(dart.void, []),
+      close: dart.definiteFunctionType(dart.void, []),
+      error: dart.definiteFunctionType(dart.void, [dart.dynamic])
+    }),
+    sfields: () => ({
+      LIST_FILE: core.int,
+      LIST_DIRECTORY: core.int,
+      LIST_LINK: core.int,
+      LIST_ERROR: core.int,
+      LIST_DONE: core.int,
+      RESPONSE_TYPE: core.int,
+      RESPONSE_PATH: core.int,
+      RESPONSE_COMPLETE: core.int,
+      RESPONSE_ERROR: core.int
+    })
+  });
+  io._AsyncDirectoryLister.LIST_FILE = 0;
+  io._AsyncDirectoryLister.LIST_DIRECTORY = 1;
+  io._AsyncDirectoryLister.LIST_LINK = 2;
+  io._AsyncDirectoryLister.LIST_ERROR = 3;
+  io._AsyncDirectoryLister.LIST_DONE = 4;
+  io._AsyncDirectoryLister.RESPONSE_TYPE = 0;
+  io._AsyncDirectoryLister.RESPONSE_PATH = 1;
+  io._AsyncDirectoryLister.RESPONSE_COMPLETE = 1;
+  io._AsyncDirectoryLister.RESPONSE_ERROR = 2;
+  io._EventHandler = class _EventHandler extends core.Object {
+    static _sendData(sender, sendPort, data) {
+      dart.throw(new core.UnsupportedError("EventHandler._sendData"));
+    }
+  };
+  dart.setSignature(io._EventHandler, {
+    statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate.SendPort, core.int])}),
+    names: ['_sendData']
+  });
+  const _mode = Symbol('_mode');
+  io.FileMode = class FileMode extends core.Object {
+    _internal(mode) {
+      this[_mode] = mode;
+    }
+  };
+  dart.defineNamedConstructor(io.FileMode, '_internal');
+  dart.setSignature(io.FileMode, {
+    constructors: () => ({_internal: dart.definiteFunctionType(io.FileMode, [core.int])}),
+    fields: () => ({[_mode]: core.int}),
+    sfields: () => ({
+      READ: io.FileMode,
+      WRITE: io.FileMode,
+      APPEND: io.FileMode,
+      WRITE_ONLY: io.FileMode,
+      WRITE_ONLY_APPEND: io.FileMode
+    })
+  });
+  dart.defineLazy(io.FileMode, {
+    get READ() {
+      return dart.const(new io.FileMode._internal(0));
+    },
+    get WRITE() {
+      return dart.const(new io.FileMode._internal(1));
+    },
+    get APPEND() {
+      return dart.const(new io.FileMode._internal(2));
+    },
+    get WRITE_ONLY() {
+      return dart.const(new io.FileMode._internal(3));
+    },
+    get WRITE_ONLY_APPEND() {
+      return dart.const(new io.FileMode._internal(4));
+    }
+  });
+  io.READ = io.FileMode.READ;
+  io.WRITE = io.FileMode.WRITE;
+  io.APPEND = io.FileMode.APPEND;
+  io.WRITE_ONLY = io.FileMode.WRITE_ONLY;
+  io.WRITE_ONLY_APPEND = io.FileMode.WRITE_ONLY_APPEND;
+  io.FileLock = class FileLock extends core.Object {
+    new(index) {
+      this.index = index;
+    }
+    toString() {
+      return {
+        0: "FileLock.SHARED",
+        1: "FileLock.EXCLUSIVE"
+      }[this.index];
+    }
+  };
+  dart.setSignature(io.FileLock, {
+    fields: () => ({index: core.int})
+  });
+  dart.defineEnumValues(io.FileLock, [
+    'SHARED',
+    'EXCLUSIVE'
+  ]);
+  io.File = class File extends core.Object {
+    static new(path) {
+      return new io._File(path);
+    }
+    static fromUri(uri) {
+      return io.File.new(uri.toFilePath());
+    }
+  };
+  io.File[dart.implements] = () => [io.FileSystemEntity];
+  dart.setSignature(io.File, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.File, [core.String]),
+      fromUri: dart.definiteFunctionType(io.File, [core.Uri])
+    })
+  });
+  io.RandomAccessFile = class RandomAccessFile extends core.Object {};
+  io.FileSystemException = class FileSystemException extends core.Object {
+    new(message, path, osError) {
+      if (message === void 0) message = "";
+      if (path === void 0) path = "";
+      if (osError === void 0) osError = null;
+      this.message = message;
+      this.path = path;
+      this.osError = osError;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write("FileSystemException");
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(dart.str`: ${this.message}`);
+        if (this.path != null) {
+          sb.write(dart.str`, path = '${this.path}'`);
+        }
+        if (this.osError != null) {
+          sb.write(dart.str` (${this.osError})`);
+        }
+      } else if (this.osError != null) {
+        sb.write(dart.str`: ${this.osError}`);
+        if (this.path != null) {
+          sb.write(dart.str`, path = '${this.path}'`);
+        }
+      } else if (this.path != null) {
+        sb.write(dart.str`: ${this.path}`);
+      }
+      return sb.toString();
+    }
+  };
+  io.FileSystemException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.FileSystemException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.FileSystemException, [], [core.String, core.String, io.OSError])}),
+    fields: () => ({
+      message: core.String,
+      path: core.String,
+      osError: io.OSError
+    })
+  });
+  io._BLOCK_SIZE = 64 * 1024;
+  const _closeCompleter = Symbol('_closeCompleter');
+  const _path$ = Symbol('_path');
+  const _position$0 = Symbol('_position');
+  const _end$0 = Symbol('_end');
+  const _controller$0 = Symbol('_controller');
+  const _openedFile = Symbol('_openedFile');
+  const _unsubscribed = Symbol('_unsubscribed');
+  const _readInProgress = Symbol('_readInProgress');
+  const _atEnd = Symbol('_atEnd');
+  const _setupController = Symbol('_setupController');
+  const _start$2 = Symbol('_start');
+  const _readBlock = Symbol('_readBlock');
+  const _closeFile = Symbol('_closeFile');
+  io._FileStream = class _FileStream extends async.Stream$(core.List$(core.int)) {
+    new(path, position, end) {
+      this[_closeCompleter] = async.Completer.new();
+      this[_path$] = path;
+      this[_position$0] = position;
+      this[_end$0] = end;
+      this[_controller$0] = null;
+      this[_openedFile] = null;
+      this[_unsubscribed] = false;
+      this[_readInProgress] = true;
+      this[_closed] = false;
+      this[_atEnd] = false;
+      super.new();
+      if (this[_position$0] == null) this[_position$0] = 0;
+    }
+    forStdin() {
+      this[_closeCompleter] = async.Completer.new();
+      this[_position$0] = 0;
+      this[_controller$0] = null;
+      this[_path$] = null;
+      this[_openedFile] = null;
+      this[_end$0] = null;
+      this[_unsubscribed] = false;
+      this[_readInProgress] = true;
+      this[_closed] = false;
+      this[_atEnd] = false;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      this[_setupController]();
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    [_setupController]() {
+      this[_controller$0] = StreamControllerOfListOfint().new({sync: true, onListen: dart.bind(this, _start$2), onResume: dart.bind(this, _readBlock), onCancel: dart.fn(() => {
+          this[_unsubscribed] = true;
+          return this[_closeFile]();
+        }, VoidToFuture())});
+    }
+    [_closeFile]() {
+      if (dart.test(this[_readInProgress]) || dart.test(this[_closed])) {
+        return this[_closeCompleter].future;
+      }
+      this[_closed] = true;
+      const done = (function() {
+        this[_closeCompleter].complete();
+        this[_controller$0].close();
+      }).bind(this);
+      dart.fn(done, VoidTovoid$());
+      this[_openedFile].close().catchError(dart.bind(this[_controller$0], 'addError')).whenComplete(done);
+      return this[_closeCompleter].future;
+    }
+    [_readBlock]() {
+      if (dart.test(this[_readInProgress])) return;
+      if (dart.test(this[_atEnd])) {
+        this[_closeFile]();
+        return;
+      }
+      this[_readInProgress] = true;
+      let readBytes = io._BLOCK_SIZE;
+      if (this[_end$0] != null) {
+        readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$0]) - dart.notNull(this[_position$0]));
+        if (dart.notNull(readBytes) < 0) {
+          this[_readInProgress] = false;
+          if (!dart.test(this[_unsubscribed])) {
+            this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$0]}`));
+            this[_closeFile]();
+            this[_unsubscribed] = true;
+          }
+          return;
+        }
+      }
+      this[_openedFile].read(readBytes).then(dart.dynamic)(dart.fn(block => {
+        this[_readInProgress] = false;
+        if (dart.test(this[_unsubscribed])) {
+          this[_closeFile]();
+          return;
+        }
+        this[_position$0] = dart.notNull(this[_position$0]) + dart.notNull(block[dartx.length]);
+        if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$0] != null && this[_position$0] == this[_end$0]) {
+          this[_atEnd] = true;
+        }
+        if (!dart.test(this[_atEnd]) && !dart.test(this[_controller$0].isPaused)) {
+          this[_readBlock]();
+        }
+        this[_controller$0].add(block);
+        if (dart.test(this[_atEnd])) {
+          this[_closeFile]();
+        }
+      }, ListOfintToNull())).catchError(dart.fn((e, s) => {
+        if (!dart.test(this[_unsubscribed])) {
+          this[_controller$0].addError(e, core.StackTrace._check(s));
+          this[_closeFile]();
+          this[_unsubscribed] = true;
+        }
+      }, dynamicAnddynamicToNull()));
+    }
+    [_start$2]() {
+      if (dart.notNull(this[_position$0]) < 0) {
+        this[_controller$0].addError(new core.RangeError(dart.str`Bad start position: ${this[_position$0]}`));
+        this[_controller$0].close();
+        this[_closeCompleter].complete();
+        return;
+      }
+      const onReady = (function(file) {
+        this[_openedFile] = file;
+        this[_readInProgress] = false;
+        this[_readBlock]();
+      }).bind(this);
+      dart.fn(onReady, RandomAccessFileTovoid());
+      const onOpenFile = (function(file) {
+        if (dart.notNull(this[_position$0]) > 0) {
+          file.setPosition(this[_position$0]).then(dart.void)(onReady, {onError: dart.fn((e, s) => {
+              this[_controller$0].addError(e, core.StackTrace._check(s));
+              this[_readInProgress] = false;
+              this[_closeFile]();
+            }, dynamicAnddynamicToNull())});
+        } else {
+          onReady(file);
+        }
+      }).bind(this);
+      dart.fn(onOpenFile, RandomAccessFileTovoid());
+      const openFailed = (function(error, stackTrace) {
+        this[_controller$0].addError(error, core.StackTrace._check(stackTrace));
+        this[_controller$0].close();
+        this[_closeCompleter].complete();
+      }).bind(this);
+      dart.fn(openFailed, dynamicAnddynamicTovoid$());
+      if (this[_path$] != null) {
+        io.File.new(this[_path$]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
+      } else {
+        try {
+          onOpenFile(io._File._openStdioSync(0));
+        } catch (e) {
+          let s = dart.stackTrace(e);
+          openFailed(e, s);
+        }
+
+      }
+    }
+  };
+  dart.addSimpleTypeTests(io._FileStream);
+  dart.defineNamedConstructor(io._FileStream, 'forStdin');
+  dart.setSignature(io._FileStream, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._FileStream, [core.String, core.int, core.int]),
+      forStdin: dart.definiteFunctionType(io._FileStream, [])
+    }),
+    fields: () => ({
+      [_controller$0]: StreamControllerOfListOfint(),
+      [_path$]: core.String,
+      [_openedFile]: io.RandomAccessFile,
+      [_position$0]: core.int,
+      [_end$0]: core.int,
+      [_closeCompleter]: async.Completer,
+      [_unsubscribed]: core.bool,
+      [_readInProgress]: core.bool,
+      [_closed]: core.bool,
+      [_atEnd]: core.bool
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      [_setupController]: dart.definiteFunctionType(dart.void, []),
+      [_closeFile]: dart.definiteFunctionType(async.Future, []),
+      [_readBlock]: dart.definiteFunctionType(dart.void, []),
+      [_start$2]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _file = Symbol('_file');
+  const _openFuture = Symbol('_openFuture');
+  io._FileStreamConsumer = class _FileStreamConsumer extends async.StreamConsumer$(core.List$(core.int)) {
+    new(file, mode) {
+      this[_file] = file;
+      this[_openFuture] = null;
+      this[_openFuture] = this[_file].open({mode: mode});
+    }
+    fromStdio(fd) {
+      this[_file] = null;
+      this[_openFuture] = null;
+      dart.assert(1 <= dart.notNull(fd) && dart.notNull(fd) <= 2);
+      this[_openFuture] = FutureOfRandomAccessFile().value(io._File._openStdioSync(fd));
+    }
+    addStream(stream) {
+      let completer = CompleterOfFile().sync();
+      this[_openFuture].then(dart.dynamic)(dart.fn(openedFile => {
+        let _subscription = null;
+        function error(e, stackTrace) {
+          if (stackTrace === void 0) stackTrace = null;
+          dart.dsend(_subscription, 'cancel');
+          openedFile.close();
+          completer.completeError(e, stackTrace);
+        }
+        dart.fn(error, dynamic__Tovoid());
+        _subscription = stream.listen(dart.fn(d => {
+          dart.dsend(_subscription, 'pause');
+          try {
+            openedFile.writeFrom(d, 0, d[dartx.length]).then(dart.dynamic)(dart.fn(_ => dart.dsend(_subscription, 'resume'), RandomAccessFileToFutureOr()), {onError: error});
+          } catch (e) {
+            let stackTrace = dart.stackTrace(e);
+            error(e, stackTrace);
+          }
+
+        }, ListOfintToNull()), {onDone: dart.fn(() => {
+            completer.complete(this[_file]);
+          }, VoidToNull()), onError: error, cancelOnError: true});
+      }, RandomAccessFileToNull())).catchError(dart.bind(completer, 'completeError'));
+      return completer.future;
+    }
+    close() {
+      return this[_openFuture].then(io.File)(dart.fn(openedFile => openedFile.close(), RandomAccessFileToFutureOfRandomAccessFile()));
+    }
+  };
+  dart.addSimpleTypeTests(io._FileStreamConsumer);
+  dart.defineNamedConstructor(io._FileStreamConsumer, 'fromStdio');
+  dart.setSignature(io._FileStreamConsumer, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._FileStreamConsumer, [io.File, io.FileMode]),
+      fromStdio: dart.definiteFunctionType(io._FileStreamConsumer, [core.int])
+    }),
+    fields: () => ({
+      [_file]: io.File,
+      [_openFuture]: FutureOfRandomAccessFile()
+    }),
+    methods: () => ({
+      addStream: dart.definiteFunctionType(async.Future$(io.File), [StreamOfListOfint()]),
+      close: dart.definiteFunctionType(async.Future$(io.File), [])
+    })
+  });
+  const _tryDecode = Symbol('_tryDecode');
+  let const$54;
+  let const$55;
+  io._File = class _File extends io.FileSystemEntity {
+    new(path) {
+      this.path = path;
+      if (!(typeof this.path == 'string')) {
+        dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+      }
+    }
+    exists() {
+      return io._IOService._dispatch(io._FILE_EXISTS, JSArrayOfString().of([this.path])).then(core.bool)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot check existence", this.path));
+        }
+        return FutureOrOfbool()._check(response);
+      }, dynamicToFutureOrOfbool()));
+    }
+    static _exists(path) {
+      dart.throw(new core.UnsupportedError("File._exists"));
+    }
+    existsSync() {
+      let result = io._File._exists(this.path);
+      io._File.throwIfError(result, "Cannot check existence of file", this.path);
+      return core.bool._check(result);
+    }
+    get absolute() {
+      return io.File.new(this[_absolutePath]);
+    }
+    stat() {
+      return io.FileStat.stat(this.path);
+    }
+    statSync() {
+      return io.FileStat.statSync(this.path);
+    }
+    create(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
+      return result.then(dart.dynamic)(dart.fn(_ => io._IOService._dispatch(io._FILE_CREATE, JSArrayOfString().of([this.path])), dynamicToFuture())).then(io._File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot create file", this.path));
+        }
+        return this;
+      }, dynamicTo_File()));
+    }
+    static _create(path) {
+      dart.throw(new core.UnsupportedError("File._create"));
+    }
+    static _createLink(path, target) {
+      dart.throw(new core.UnsupportedError("File._createLink"));
+    }
+    static _linkTarget(path) {
+      dart.throw(new core.UnsupportedError("File._linkTarget"));
+    }
+    createSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        this.parent.createSync({recursive: true});
+      }
+      let result = io._File._create(this.path);
+      io._File.throwIfError(result, "Cannot create file", this.path);
+    }
+    [_delete](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).delete({recursive: true}).then(io._File)(dart.fn(_ => this, FileSystemEntityTo_File()));
+      }
+      return io._IOService._dispatch(io._FILE_DELETE, JSArrayOfString().of([this.path])).then(io._File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot delete file", this.path));
+        }
+        return this;
+      }, dynamicTo_File()));
+    }
+    static _deleteNative(path) {
+      dart.throw(new core.UnsupportedError("File._deleteNative"));
+    }
+    static _deleteLinkNative(path) {
+      dart.throw(new core.UnsupportedError("File._deleteLinkNative"));
+    }
+    [_deleteSync](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).deleteSync({recursive: true});
+      }
+      let result = io._File._deleteNative(this.path);
+      io._File.throwIfError(result, "Cannot delete file", this.path);
+    }
+    rename(newPath) {
+      return io._IOService._dispatch(io._FILE_RENAME, JSArrayOfString().of([this.path, newPath])).then(io.File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, dart.str`Cannot rename file to '${newPath}'`, this.path));
+        }
+        return io.File.new(newPath);
+      }, dynamicToFile()));
+    }
+    static _rename(oldPath, newPath) {
+      dart.throw(new core.UnsupportedError("File._rename"));
+    }
+    static _renameLink(oldPath, newPath) {
+      dart.throw(new core.UnsupportedError("File._renameLink"));
+    }
+    renameSync(newPath) {
+      let result = io._File._rename(this.path, newPath);
+      io._File.throwIfError(result, dart.str`Cannot rename file to '${newPath}'`, this.path);
+      return io.File.new(newPath);
+    }
+    copy(newPath) {
+      return io._IOService._dispatch(io._FILE_COPY, JSArrayOfString().of([this.path, newPath])).then(io.File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, dart.str`Cannot copy file to '${newPath}'`, this.path));
+        }
+        return io.File.new(newPath);
+      }, dynamicToFile()));
+    }
+    static _copy(oldPath, newPath) {
+      dart.throw(new core.UnsupportedError("File._copy"));
+    }
+    copySync(newPath) {
+      let result = io._File._copy(this.path, newPath);
+      io._File.throwIfError(result, dart.str`Cannot copy file to '${newPath}'`, this.path);
+      return io.File.new(newPath);
+    }
+    open(opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.READ;
+      if (!dart.equals(mode, io.FileMode.READ) && !dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+        return FutureOfRandomAccessFile().error(new core.ArgumentError('Invalid file mode for this operation'));
+      }
+      return io._IOService._dispatch(io._FILE_OPEN, JSArrayOfObject().of([this.path, mode[_mode]])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot open file", this.path));
+        }
+        return new io._RandomAccessFile(core.int._check(response), this.path);
+      }, dynamicTo_RandomAccessFile()));
+    }
+    length() {
+      return io._IOService._dispatch(io._FILE_LENGTH_FROM_PATH, JSArrayOfString().of([this.path])).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot retrieve length of file", this.path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    static _lengthFromPath(path) {
+      dart.throw(new core.UnsupportedError("File._lengthFromPath"));
+    }
+    lengthSync() {
+      let result = io._File._lengthFromPath(this.path);
+      io._File.throwIfError(result, "Cannot retrieve length of file", this.path);
+      return core.int._check(result);
+    }
+    lastModified() {
+      return io._IOService._dispatch(io._FILE_LAST_MODIFIED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot retrieve modification time", this.path));
+        }
+        return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(response));
+      }, dynamicToDateTime()));
+    }
+    static _lastModified(path) {
+      dart.throw(new core.UnsupportedError("File._lastModified"));
+    }
+    lastModifiedSync() {
+      let ms = io._File._lastModified(this.path);
+      io._File.throwIfError(ms, "Cannot retrieve modification time", this.path);
+      return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
+    }
+    static _open(path, mode) {
+      dart.throw(new core.UnsupportedError("File._open"));
+    }
+    openSync(opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.READ;
+      if (!dart.equals(mode, io.FileMode.READ) && !dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+        dart.throw(new core.ArgumentError('Invalid file mode for this operation'));
+      }
+      let id = io._File._open(this.path, mode[_mode]);
+      io._File.throwIfError(id, "Cannot open file", this.path);
+      return new io._RandomAccessFile(core.int._check(id), this.path);
+    }
+    static _openStdio(fd) {
+      dart.throw(new core.UnsupportedError("File._openStdio"));
+    }
+    static _openStdioSync(fd) {
+      let id = io._File._openStdio(fd);
+      if (id == 0) {
+        dart.throw(new io.FileSystemException(dart.str`Cannot open stdio file for: ${fd}`));
+      }
+      return new io._RandomAccessFile(id, "");
+    }
+    openRead(start, end) {
+      if (start === void 0) start = null;
+      if (end === void 0) end = null;
+      return new io._FileStream(this.path, start, end);
+    }
+    openWrite(opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      if (!dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+        dart.throw(new core.ArgumentError('Invalid file mode for this operation'));
+      }
+      let consumer = new io._FileStreamConsumer(this, mode);
+      return io.IOSink.new(consumer, {encoding: encoding});
+    }
+    readAsBytes() {
+      function readDataChunked(file) {
+        let builder = io.BytesBuilder.new({copy: false});
+        let completer = async.Completer.new();
+        function read() {
+          dart.dsend(dart.dsend(file, 'read', io._BLOCK_SIZE), 'then', dart.fn(data => {
+            if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) {
+              builder.add(ListOfint()._check(data));
+              read();
+            } else {
+              completer.complete(builder.takeBytes());
+            }
+          }, dynamicToNull$()), {onError: dart.bind(completer, 'completeError')});
+        }
+        dart.fn(read, VoidTovoid$());
+        read();
+        return FutureOfListOfint()._check(completer.future);
+      }
+      dart.fn(readDataChunked, dynamicToFutureOfListOfint());
+      return this.open().then(ListOfint())(dart.fn(file => file.length().then(ListOfint())(dart.fn(length => {
+        if (length == 0) {
+          return readDataChunked(file);
+        }
+        return file.read(length);
+      }, intToFutureOfListOfint())).whenComplete(dart.bind(file, 'close')), RandomAccessFileToFutureOfListOfint()));
+    }
+    readAsBytesSync() {
+      let opened = this.openSync();
+      try {
+        let data = null;
+        let length = opened.lengthSync();
+        if (length == 0) {
+          let builder = io.BytesBuilder.new({copy: false});
+          do {
+            data = opened.readSync(io._BLOCK_SIZE);
+            if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) builder.add(ListOfint()._check(data));
+          } while (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0)));
+          data = builder.takeBytes();
+        } else {
+          data = opened.readSync(length);
+        }
+        return ListOfint()._check(data);
+      } finally {
+        opened.closeSync();
+      }
+    }
+    [_tryDecode](bytes, encoding) {
+      try {
+        return encoding.decode(bytes);
+      } catch (_) {
+        dart.throw(new io.FileSystemException(dart.str`Failed to decode data using encoding '${encoding.name}'`, this.path));
+      }
+
+    }
+    readAsString(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return this.readAsBytes().then(core.String)(dart.fn(bytes => this[_tryDecode](bytes, encoding), ListOfintToString()));
+    }
+    readAsStringSync(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return this[_tryDecode](this.readAsBytesSync(), encoding);
+    }
+    readAsLines(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$54 || (const$54 = dart.const(new convert.LineSplitter())), 'convert'));
+    }
+    readAsLinesSync(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return (const$55 || (const$55 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
+    }
+    writeAsBytes(bytes, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      return this.open({mode: mode}).then(io.File)(dart.fn(file => file.writeFrom(bytes, 0, bytes[dartx.length]).then(dart.dynamic)(dart.fn(_ => {
+        if (dart.test(flush)) return file.flush().then(io._File)(dart.fn(_ => this, RandomAccessFileTo_File()));
+        return this;
+      }, RandomAccessFileToObject())).whenComplete(dart.bind(file, 'close')), RandomAccessFileToFutureOrOfFile()));
+    }
+    writeAsBytesSync(bytes, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      let opened = this.openSync({mode: mode});
+      try {
+        opened.writeFromSync(bytes, 0, bytes[dartx.length]);
+        if (dart.test(flush)) opened.flushSync();
+      } finally {
+        opened.closeSync();
+      }
+    }
+    writeAsString(contents, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      try {
+        return this.writeAsBytes(encoding.encode(contents), {mode: mode, flush: flush});
+      } catch (e) {
+        return FutureOfFile().error(e);
+      }
+
+    }
+    writeAsStringSync(contents, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      this.writeAsBytesSync(encoding.encode(contents), {mode: mode, flush: flush});
+    }
+    toString() {
+      return dart.str`File: '${this.path}'`;
+    }
+    static throwIfError(result, msg, path) {
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException(msg, path, result));
+      }
+    }
+  };
+  io._File[dart.implements] = () => [io.File];
+  dart.setSignature(io._File, {
+    constructors: () => ({new: dart.definiteFunctionType(io._File, [core.String])}),
+    fields: () => ({path: core.String}),
+    getters: () => ({absolute: dart.definiteFunctionType(io.File, [])}),
+    methods: () => ({
+      exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+      existsSync: dart.definiteFunctionType(core.bool, []),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+      statSync: dart.definiteFunctionType(io.FileStat, []),
+      create: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
+      createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      [_delete]: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
+      [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      rename: dart.definiteFunctionType(async.Future$(io.File), [core.String]),
+      renameSync: dart.definiteFunctionType(io.File, [core.String]),
+      copy: dart.definiteFunctionType(async.Future$(io.File), [core.String]),
+      copySync: dart.definiteFunctionType(io.File, [core.String]),
+      open: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], {mode: io.FileMode}),
+      length: dart.definiteFunctionType(async.Future$(core.int), []),
+      lengthSync: dart.definiteFunctionType(core.int, []),
+      lastModified: dart.definiteFunctionType(async.Future$(core.DateTime), []),
+      lastModifiedSync: dart.definiteFunctionType(core.DateTime, []),
+      openSync: dart.definiteFunctionType(io.RandomAccessFile, [], {mode: io.FileMode}),
+      openRead: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [], [core.int, core.int]),
+      openWrite: dart.definiteFunctionType(io.IOSink, [], {mode: io.FileMode, encoding: convert.Encoding}),
+      readAsBytes: dart.definiteFunctionType(async.Future$(core.List$(core.int)), []),
+      readAsBytesSync: dart.definiteFunctionType(core.List$(core.int), []),
+      [_tryDecode]: dart.definiteFunctionType(core.String, [ListOfint(), convert.Encoding]),
+      readAsString: dart.definiteFunctionType(async.Future$(core.String), [], {encoding: convert.Encoding}),
+      readAsStringSync: dart.definiteFunctionType(core.String, [], {encoding: convert.Encoding}),
+      readAsLines: dart.definiteFunctionType(async.Future$(core.List$(core.String)), [], {encoding: convert.Encoding}),
+      readAsLinesSync: dart.definiteFunctionType(core.List$(core.String), [], {encoding: convert.Encoding}),
+      writeAsBytes: dart.definiteFunctionType(async.Future$(io.File), [ListOfint()], {mode: io.FileMode, flush: core.bool}),
+      writeAsBytesSync: dart.definiteFunctionType(dart.void, [ListOfint()], {mode: io.FileMode, flush: core.bool}),
+      writeAsString: dart.definiteFunctionType(async.Future$(io.File), [core.String], {mode: io.FileMode, encoding: convert.Encoding, flush: core.bool}),
+      writeAsStringSync: dart.definiteFunctionType(dart.void, [core.String], {mode: io.FileMode, encoding: convert.Encoding, flush: core.bool})
+    }),
+    statics: () => ({
+      _exists: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _create: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _createLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _linkTarget: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _deleteNative: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _deleteLinkNative: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _rename: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _renameLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _copy: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _lengthFromPath: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _lastModified: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _open: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
+      _openStdio: dart.definiteFunctionType(core.int, [core.int]),
+      _openStdioSync: dart.definiteFunctionType(io.RandomAccessFile, [core.int]),
+      throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String, core.String])
+    }),
+    names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
+  });
+  io._RandomAccessFileOps = class _RandomAccessFileOps extends core.Object {
+    static new(pointer) {
+      dart.throw(new core.UnsupportedError("RandomAccessFile"));
+    }
+  };
+  dart.setSignature(io._RandomAccessFileOps, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RandomAccessFileOps, [core.int])})
+  });
+  const _asyncDispatched = Symbol('_asyncDispatched');
+  const _fileService = Symbol('_fileService');
+  const _resourceInfo = Symbol('_resourceInfo');
+  const _maybeConnectHandler = Symbol('_maybeConnectHandler');
+  const _maybePerformCleanup = Symbol('_maybePerformCleanup');
+  const _dispatch = Symbol('_dispatch');
+  const _checkAvailable = Symbol('_checkAvailable');
+  io._RandomAccessFile = class _RandomAccessFile extends core.Object {
+    new(pointer, path) {
+      this.path = path;
+      this[_asyncDispatched] = false;
+      this[_fileService] = null;
+      this[_resourceInfo] = null;
+      this[_ops] = null;
+      this.closed = false;
+      this[_ops] = io._RandomAccessFileOps.new(pointer);
+      this[_resourceInfo] = new io._FileResourceInfo(this);
+      this[_maybeConnectHandler]();
+    }
+    [_maybePerformCleanup]() {
+      if (dart.test(this.closed)) {
+        io._FileResourceInfo.FileClosed(this[_resourceInfo]);
+      }
+    }
+    [_maybeConnectHandler]() {
+      if (!dart.test(io._RandomAccessFile._connectedResourceHandler)) {
+        developer.registerExtension('ext.dart.io.getOpenFiles', io._FileResourceInfo.getOpenFiles);
+        developer.registerExtension('ext.dart.io.getFileByID', io._FileResourceInfo.getFileInfoMapByID);
+        io._RandomAccessFile._connectedResourceHandler = true;
+      }
+    }
+    close() {
+      return this[_dispatch](io._FILE_CLOSE, [null], {markClosed: true}).then(io._RandomAccessFile)(dart.fn(result => {
+        if (!dart.equals(result, -1)) {
+          this.closed = dart.test(this.closed) || dart.equals(result, 0);
+          this[_maybePerformCleanup]();
+          return this;
+        } else {
+          dart.throw(new io.FileSystemException("Cannot close file", this.path));
+        }
+      }, dynamicTo_RandomAccessFile()));
+    }
+    closeSync() {
+      this[_checkAvailable]();
+      let id = this[_ops].close();
+      if (id == -1) {
+        dart.throw(new io.FileSystemException("Cannot close file", this.path));
+      }
+      this.closed = dart.test(this.closed) || id == 0;
+      this[_maybePerformCleanup]();
+    }
+    readByte() {
+      return this[_dispatch](io._FILE_READ_BYTE, [null]).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "readByte failed", this.path));
+        }
+        this[_resourceInfo].addRead(1);
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    readByteSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].readByte();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("readByte failed", this.path, result));
+      }
+      this[_resourceInfo].addRead(1);
+      return core.int._check(result);
+    }
+    read(bytes) {
+      if (!(typeof bytes == 'number')) {
+        dart.throw(new core.ArgumentError(bytes));
+      }
+      return this[_dispatch](io._FILE_READ, JSArrayOfint().of([null, bytes])).then(ListOfint())(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "read failed", this.path));
+        }
+        this[_resourceInfo].addRead(core.int._check(dart.dload(dart.dindex(response, 1), 'length')));
+        return FutureOrOfListOfint()._check(dart.dindex(response, 1));
+      }, dynamicToFutureOrOfListOfint()));
+    }
+    readSync(bytes) {
+      this[_checkAvailable]();
+      if (!(typeof bytes == 'number')) {
+        dart.throw(new core.ArgumentError(bytes));
+      }
+      let result = this[_ops].read(bytes);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("readSync failed", this.path, result));
+      }
+      this[_resourceInfo].addRead(core.int._check(dart.dload(result, 'length')));
+      return ListOfint()._check(result);
+    }
+    readInto(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return FutureOfint().value(0);
+      }
+      let length = dart.notNull(end) - dart.notNull(start);
+      return this[_dispatch](io._FILE_READ_INTO, JSArrayOfint().of([null, length])).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "readInto failed", this.path));
+        }
+        let read = dart.dindex(response, 1);
+        let data = dart.dindex(response, 2);
+        buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), IterableOfint()._check(data));
+        this[_resourceInfo].addRead(core.int._check(read));
+        return FutureOrOfint()._check(read);
+      }, dynamicToFutureOrOfint()));
+    }
+    readIntoSync(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      this[_checkAvailable]();
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return 0;
+      }
+      let result = this[_ops].readInto(buffer, start, end);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("readInto failed", this.path, result));
+      }
+      this[_resourceInfo].addRead(core.int._check(result));
+      return core.int._check(result);
+    }
+    writeByte(value) {
+      if (!(typeof value == 'number')) {
+        dart.throw(new core.ArgumentError(value));
+      }
+      return this[_dispatch](io._FILE_WRITE_BYTE, JSArrayOfint().of([null, value])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "writeByte failed", this.path));
+        }
+        this[_resourceInfo].addWrite(1);
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    writeByteSync(value) {
+      this[_checkAvailable]();
+      if (!(typeof value == 'number')) {
+        dart.throw(new core.ArgumentError(value));
+      }
+      let result = this[_ops].writeByte(value);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("writeByte failed", this.path, result));
+      }
+      this[_resourceInfo].addWrite(1);
+      return core.int._check(result);
+    }
+    writeFrom(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError("Invalid arguments to writeFrom"));
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return FutureOfRandomAccessFile().value(this);
+      }
+      let result = null;
+      try {
+        result = io._ensureFastAndSerializableByteData(buffer, start, end);
+      } catch (e) {
+        return FutureOfRandomAccessFile().error(e);
+      }
+
+      let request = core.List.new(4);
+      request[dartx._set](0, null);
+      request[dartx._set](1, result.buffer);
+      request[dartx._set](2, result.start);
+      request[dartx._set](3, dart.notNull(end) - (dart.notNull(start) - dart.notNull(result.start)));
+      return this[_dispatch](io._FILE_WRITE_FROM, request).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "writeFrom failed", this.path));
+        }
+        this[_resourceInfo].addWrite(dart.notNull(end) - (dart.notNull(start) - dart.notNull(result.start)));
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    writeFromSync(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      this[_checkAvailable]();
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError("Invalid arguments to writeFromSync"));
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return;
+      }
+      let bufferAndStart = io._ensureFastAndSerializableByteData(buffer, start, end);
+      let result = this[_ops].writeFrom(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("writeFrom failed", this.path, result));
+      }
+      this[_resourceInfo].addWrite(dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+    }
+    writeString(string, opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      if (!convert.Encoding.is(encoding)) {
+        dart.throw(new core.ArgumentError(encoding));
+      }
+      let data = encoding.encode(string);
+      return this.writeFrom(data, 0, data[dartx.length]);
+    }
+    writeStringSync(string, opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      if (!convert.Encoding.is(encoding)) {
+        dart.throw(new core.ArgumentError(encoding));
+      }
+      let data = encoding.encode(string);
+      this.writeFromSync(data, 0, data[dartx.length]);
+    }
+    position() {
+      return this[_dispatch](io._FILE_POSITION, [null]).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "position failed", this.path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    positionSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].position();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("position failed", this.path, result));
+      }
+      return core.int._check(result);
+    }
+    setPosition(position) {
+      return this[_dispatch](io._FILE_SET_POSITION, JSArrayOfint().of([null, position])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "setPosition failed", this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    setPositionSync(position) {
+      this[_checkAvailable]();
+      let result = this[_ops].setPosition(position);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("setPosition failed", this.path, result));
+      }
+    }
+    truncate(length) {
+      return this[_dispatch](io._FILE_TRUNCATE, JSArrayOfint().of([null, length])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "truncate failed", this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    truncateSync(length) {
+      this[_checkAvailable]();
+      let result = this[_ops].truncate(length);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("truncate failed", this.path, result));
+      }
+    }
+    length() {
+      return this[_dispatch](io._FILE_LENGTH, [null]).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "length failed", this.path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    lengthSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].length();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("length failed", this.path, result));
+      }
+      return core.int._check(result);
+    }
+    flush() {
+      return this[_dispatch](io._FILE_FLUSH, [null]).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "flush failed", this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    flushSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].flush();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("flush failed", this.path, result));
+      }
+    }
+    lock(mode, start, end) {
+      if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      if (!io.FileLock.is(mode) || !(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
+        dart.throw(new core.ArgumentError());
+      }
+      let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+      return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, lock, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, 'lock failed', this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    unlock(start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      if (!(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (start == end) {
+        dart.throw(new core.ArgumentError());
+      }
+      return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, io._RandomAccessFile.LOCK_UNLOCK, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, 'unlock failed', this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    lockSync(mode, start, end) {
+      if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      this[_checkAvailable]();
+      if (!io.FileLock.is(mode) || !(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
+        dart.throw(new core.ArgumentError());
+      }
+      let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+      let result = this[_ops].lock(lock, start, end);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException('lock failed', this.path, result));
+      }
+    }
+    unlockSync(start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      this[_checkAvailable]();
+      if (!(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (start == end) {
+        dart.throw(new core.ArgumentError());
+      }
+      let result = this[_ops].lock(io._RandomAccessFile.LOCK_UNLOCK, start, end);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException('unlock failed', this.path, result));
+      }
+    }
+    [_pointer]() {
+      return this[_ops].getPointer();
+    }
+    [_dispatch](request, data, opts) {
+      let markClosed = opts && 'markClosed' in opts ? opts.markClosed : false;
+      if (dart.test(this.closed)) {
+        return async.Future.error(new io.FileSystemException("File closed", this.path));
+      }
+      if (dart.test(this[_asyncDispatched])) {
+        let msg = "An async operation is currently pending";
+        return async.Future.error(new io.FileSystemException(msg, this.path));
+      }
+      if (dart.test(markClosed)) {
+        this.closed = true;
+      }
+      this[_asyncDispatched] = true;
+      data[dartx._set](0, this[_pointer]());
+      return io._IOService._dispatch(request, data).whenComplete(dart.fn(() => {
+        this[_asyncDispatched] = false;
+      }, VoidToNull()));
+    }
+    [_checkAvailable]() {
+      if (dart.test(this[_asyncDispatched])) {
+        dart.throw(new io.FileSystemException("An async operation is currently pending", this.path));
+      }
+      if (dart.test(this.closed)) {
+        dart.throw(new io.FileSystemException("File closed", this.path));
+      }
+    }
+  };
+  io._RandomAccessFile[dart.implements] = () => [io.RandomAccessFile];
+  dart.setSignature(io._RandomAccessFile, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RandomAccessFile, [core.int, core.String])}),
+    fields: () => ({
+      path: core.String,
+      [_asyncDispatched]: core.bool,
+      [_fileService]: isolate.SendPort,
+      [_resourceInfo]: io._FileResourceInfo,
+      [_ops]: io._RandomAccessFileOps,
+      closed: core.bool
+    }),
+    methods: () => ({
+      [_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
+      [_maybeConnectHandler]: dart.definiteFunctionType(dart.dynamic, []),
+      close: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
+      closeSync: dart.definiteFunctionType(dart.void, []),
+      readByte: dart.definiteFunctionType(async.Future$(core.int), []),
+      readByteSync: dart.definiteFunctionType(core.int, []),
+      read: dart.definiteFunctionType(async.Future$(core.List$(core.int)), [core.int]),
+      readSync: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+      readInto: dart.definiteFunctionType(async.Future$(core.int), [ListOfint()], [core.int, core.int]),
+      readIntoSync: dart.definiteFunctionType(core.int, [ListOfint()], [core.int, core.int]),
+      writeByte: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+      writeByteSync: dart.definiteFunctionType(core.int, [core.int]),
+      writeFrom: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [ListOfint()], [core.int, core.int]),
+      writeFromSync: dart.definiteFunctionType(dart.void, [ListOfint()], [core.int, core.int]),
+      writeString: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.String], {encoding: convert.Encoding}),
+      writeStringSync: dart.definiteFunctionType(dart.void, [core.String], {encoding: convert.Encoding}),
+      position: dart.definiteFunctionType(async.Future$(core.int), []),
+      positionSync: dart.definiteFunctionType(core.int, []),
+      setPosition: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+      setPositionSync: dart.definiteFunctionType(dart.void, [core.int]),
+      truncate: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+      truncateSync: dart.definiteFunctionType(dart.void, [core.int]),
+      length: dart.definiteFunctionType(async.Future$(core.int), []),
+      lengthSync: dart.definiteFunctionType(core.int, []),
+      flush: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
+      flushSync: dart.definiteFunctionType(dart.void, []),
+      lock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [io.FileLock, core.int, core.int]),
+      unlock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [core.int, core.int]),
+      lockSync: dart.definiteFunctionType(dart.void, [], [io.FileLock, core.int, core.int]),
+      unlockSync: dart.definiteFunctionType(dart.void, [], [core.int, core.int]),
+      [_pointer]: dart.definiteFunctionType(core.int, []),
+      [_dispatch]: dart.definiteFunctionType(async.Future, [core.int, core.List], {markClosed: core.bool}),
+      [_checkAvailable]: dart.definiteFunctionType(dart.void, [])
+    }),
+    sfields: () => ({
+      _connectedResourceHandler: core.bool,
+      LOCK_UNLOCK: core.int,
+      LOCK_SHARED: core.int,
+      LOCK_EXCLUSIVE: core.int
+    })
+  });
+  io._RandomAccessFile._connectedResourceHandler = false;
+  io._RandomAccessFile.LOCK_UNLOCK = 0;
+  io._RandomAccessFile.LOCK_SHARED = 1;
+  io._RandomAccessFile.LOCK_EXCLUSIVE = 2;
+  let const$56;
+  io.FileSystemEntityType = class FileSystemEntityType extends core.Object {
+    _internal(type) {
+      this[_type] = type;
+    }
+    static _lookup(type) {
+      return io.FileSystemEntityType._typeList[dartx._get](type);
+    }
+    toString() {
+      return (const$56 || (const$56 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemEntityType, '_internal');
+  dart.setSignature(io.FileSystemEntityType, {
+    constructors: () => ({_internal: dart.definiteFunctionType(io.FileSystemEntityType, [core.int])}),
+    fields: () => ({[_type]: core.int}),
+    sfields: () => ({
+      FILE: io.FileSystemEntityType,
+      DIRECTORY: io.FileSystemEntityType,
+      LINK: io.FileSystemEntityType,
+      NOT_FOUND: io.FileSystemEntityType,
+      _typeList: ListOfFileSystemEntityType()
+    }),
+    statics: () => ({_lookup: dart.definiteFunctionType(io.FileSystemEntityType, [core.int])}),
+    names: ['_lookup']
+  });
+  dart.defineLazy(io.FileSystemEntityType, {
+    get FILE() {
+      return dart.const(new io.FileSystemEntityType._internal(0));
+    },
+    get DIRECTORY() {
+      return dart.const(new io.FileSystemEntityType._internal(1));
+    },
+    get LINK() {
+      return dart.const(new io.FileSystemEntityType._internal(2));
+    },
+    get NOT_FOUND() {
+      return dart.const(new io.FileSystemEntityType._internal(3));
+    },
+    get _typeList() {
+      return dart.constList([io.FileSystemEntityType.FILE, io.FileSystemEntityType.DIRECTORY, io.FileSystemEntityType.LINK, io.FileSystemEntityType.NOT_FOUND], io.FileSystemEntityType);
+    }
+  });
+  let const$57;
+  io.FileStat = class FileStat extends core.Object {
+    _internal(changed, modified, accessed, type, mode, size) {
+      this.changed = changed;
+      this.modified = modified;
+      this.accessed = accessed;
+      this.type = type;
+      this.mode = mode;
+      this.size = size;
+    }
+    _internalNotFound() {
+      this.changed = null;
+      this.modified = null;
+      this.accessed = null;
+      this.type = io.FileSystemEntityType.NOT_FOUND;
+      this.mode = 0;
+      this.size = -1;
+    }
+    static _statSync(path) {
+      dart.throw(new core.UnsupportedError("FileStat.stat"));
+    }
+    static statSync(path) {
+      if (dart.test(io.Platform.isWindows)) {
+        path = io.FileSystemEntity._trimTrailingPathSeparators(path);
+      }
+      let data = io.FileStat._statSync(path);
+      if (io.OSError.is(data)) return io.FileStat._notFound;
+      return new io.FileStat._internal(new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._CHANGED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._MODIFIED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._ACCESSED_TIME))), io.FileSystemEntityType._lookup(core.int._check(dart.dindex(data, io.FileStat._TYPE))), core.int._check(dart.dindex(data, io.FileStat._MODE)), core.int._check(dart.dindex(data, io.FileStat._SIZE)));
+    }
+    static stat(path) {
+      if (dart.test(io.Platform.isWindows)) {
+        path = io.FileSystemEntity._trimTrailingPathSeparators(path);
+      }
+      return io._IOService._dispatch(io._FILE_STAT, JSArrayOfString().of([path])).then(io.FileStat)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          return io.FileStat._notFound;
+        }
+        let data = core.List._check(dart.dindex(response, 1));
+        return new io.FileStat._internal(new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._CHANGED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._MODIFIED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._ACCESSED_TIME))), io.FileSystemEntityType._lookup(core.int._check(data[dartx._get](io.FileStat._TYPE))), core.int._check(data[dartx._get](io.FileStat._MODE)), core.int._check(data[dartx._get](io.FileStat._SIZE)));
+      }, dynamicToFileStat()));
+    }
+    toString() {
+      return dart.str`FileStat: type ${this.type}\n          changed ${this.changed}\n          modified ${this.modified}\n          accessed ${this.accessed}\n          mode ${this.modeString()}\n          size ${this.size}`;
+    }
+    modeString() {
+      let permissions = dart.notNull(this.mode) & 4095;
+      let codes = const$57 || (const$57 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
+      let result = [];
+      if ((permissions & 2048) != 0) result[dartx.add]("(suid) ");
+      if ((permissions & 1024) != 0) result[dartx.add]("(guid) ");
+      if ((permissions & 512) != 0) result[dartx.add]("(sticky) ");
+      result[dartx.add](codes[dartx._get](permissions >> 6 & 7));
+      result[dartx.add](codes[dartx._get](permissions >> 3 & 7));
+      result[dartx.add](codes[dartx._get](permissions & 7));
+      return result[dartx.join]();
+    }
+  };
+  dart.defineNamedConstructor(io.FileStat, '_internal');
+  dart.defineNamedConstructor(io.FileStat, '_internalNotFound');
+  dart.setSignature(io.FileStat, {
+    constructors: () => ({
+      _internal: dart.definiteFunctionType(io.FileStat, [core.DateTime, core.DateTime, core.DateTime, io.FileSystemEntityType, core.int, core.int]),
+      _internalNotFound: dart.definiteFunctionType(io.FileStat, [])
+    }),
+    fields: () => ({
+      changed: core.DateTime,
+      modified: core.DateTime,
+      accessed: core.DateTime,
+      type: io.FileSystemEntityType,
+      mode: core.int,
+      size: core.int
+    }),
+    methods: () => ({modeString: dart.definiteFunctionType(core.String, [])}),
+    sfields: () => ({
+      _TYPE: core.int,
+      _CHANGED_TIME: core.int,
+      _MODIFIED_TIME: core.int,
+      _ACCESSED_TIME: core.int,
+      _MODE: core.int,
+      _SIZE: core.int,
+      _notFound: io.FileStat
+    }),
+    statics: () => ({
+      _statSync: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      statSync: dart.definiteFunctionType(io.FileStat, [core.String]),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), [core.String])
+    }),
+    names: ['_statSync', 'statSync', 'stat']
+  });
+  io.FileStat._TYPE = 0;
+  io.FileStat._CHANGED_TIME = 1;
+  io.FileStat._MODIFIED_TIME = 2;
+  io.FileStat._ACCESSED_TIME = 3;
+  io.FileStat._MODE = 4;
+  io.FileStat._SIZE = 5;
+  dart.defineLazy(io.FileStat, {
+    get _notFound() {
+      return dart.const(new io.FileStat._internalNotFound());
+    }
+  });
+  io.FileSystemEvent = class FileSystemEvent extends core.Object {
+    _(type, path, isDirectory) {
+      this.type = type;
+      this.path = path;
+      this.isDirectory = isDirectory;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemEvent, '_');
+  dart.setSignature(io.FileSystemEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemEvent, [core.int, core.String, core.bool])}),
+    fields: () => ({
+      type: core.int,
+      path: core.String,
+      isDirectory: core.bool
+    }),
+    sfields: () => ({
+      CREATE: core.int,
+      MODIFY: core.int,
+      DELETE: core.int,
+      MOVE: core.int,
+      ALL: core.int,
+      _MODIFY_ATTRIBUTES: core.int,
+      _DELETE_SELF: core.int,
+      _IS_DIR: core.int
+    })
+  });
+  io.FileSystemEvent.CREATE = 1 << 0;
+  io.FileSystemEvent.MODIFY = 1 << 1;
+  io.FileSystemEvent.DELETE = 1 << 2;
+  io.FileSystemEvent.MOVE = 1 << 3;
+  io.FileSystemEvent._MODIFY_ATTRIBUTES = 1 << 4;
+  io.FileSystemEvent._DELETE_SELF = 1 << 5;
+  io.FileSystemEvent._IS_DIR = 1 << 6;
+  dart.defineLazy(io.FileSystemEvent, {
+    get ALL() {
+      return io.FileSystemEvent.CREATE | io.FileSystemEvent.MODIFY | io.FileSystemEvent.DELETE | io.FileSystemEvent.MOVE;
+    }
+  });
+  io.FileSystemCreateEvent = class FileSystemCreateEvent extends io.FileSystemEvent {
+    _(path, isDirectory) {
+      super._(io.FileSystemEvent.CREATE, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      return dart.str`FileSystemCreateEvent('${this.path}')`;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemCreateEvent, '_');
+  dart.setSignature(io.FileSystemCreateEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemCreateEvent, [dart.dynamic, dart.dynamic])})
+  });
+  io.FileSystemModifyEvent = class FileSystemModifyEvent extends io.FileSystemEvent {
+    _(path, isDirectory, contentChanged) {
+      this.contentChanged = contentChanged;
+      super._(io.FileSystemEvent.MODIFY, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      return dart.str`FileSystemModifyEvent('${this.path}', contentChanged=${this.contentChanged})`;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemModifyEvent, '_');
+  dart.setSignature(io.FileSystemModifyEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemModifyEvent, [dart.dynamic, dart.dynamic, core.bool])}),
+    fields: () => ({contentChanged: core.bool})
+  });
+  io.FileSystemDeleteEvent = class FileSystemDeleteEvent extends io.FileSystemEvent {
+    _(path, isDirectory) {
+      super._(io.FileSystemEvent.DELETE, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      return dart.str`FileSystemDeleteEvent('${this.path}')`;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemDeleteEvent, '_');
+  dart.setSignature(io.FileSystemDeleteEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemDeleteEvent, [dart.dynamic, dart.dynamic])})
+  });
+  io.FileSystemMoveEvent = class FileSystemMoveEvent extends io.FileSystemEvent {
+    _(path, isDirectory, destination) {
+      this.destination = destination;
+      super._(io.FileSystemEvent.MOVE, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      let buffer = new core.StringBuffer();
+      buffer.write(dart.str`FileSystemMoveEvent('${this.path}'`);
+      if (this.destination != null) buffer.write(dart.str`, '${this.destination}'`);
+      buffer.write(')');
+      return buffer.toString();
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemMoveEvent, '_');
+  dart.setSignature(io.FileSystemMoveEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemMoveEvent, [dart.dynamic, dart.dynamic, core.String])}),
+    fields: () => ({destination: core.String})
+  });
+  io._FileSystemWatcher = class _FileSystemWatcher extends core.Object {
+    static _watch(path, events, recursive) {
+      dart.throw(new core.UnsupportedError("_FileSystemWatcher.watch"));
+    }
+    static get isSupported() {
+      dart.throw(new core.UnsupportedError("_FileSystemWatcher.isSupported"));
+    }
+  };
+  dart.setSignature(io._FileSystemWatcher, {
+    sgetters: () => ({isSupported: dart.definiteFunctionType(core.bool, [])}),
+    statics: () => ({_watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [core.String, core.int, core.bool])}),
+    names: ['_watch']
+  });
+  io.HttpStatus = class HttpStatus extends core.Object {};
+  dart.setSignature(io.HttpStatus, {
+    sfields: () => ({
+      CONTINUE: core.int,
+      SWITCHING_PROTOCOLS: core.int,
+      OK: core.int,
+      CREATED: core.int,
+      ACCEPTED: core.int,
+      NON_AUTHORITATIVE_INFORMATION: core.int,
+      NO_CONTENT: core.int,
+      RESET_CONTENT: core.int,
+      PARTIAL_CONTENT: core.int,
+      MULTIPLE_CHOICES: core.int,
+      MOVED_PERMANENTLY: core.int,
+      FOUND: core.int,
+      MOVED_TEMPORARILY: core.int,
+      SEE_OTHER: core.int,
+      NOT_MODIFIED: core.int,
+      USE_PROXY: core.int,
+      TEMPORARY_REDIRECT: core.int,
+      BAD_REQUEST: core.int,
+      UNAUTHORIZED: core.int,
+      PAYMENT_REQUIRED: core.int,
+      FORBIDDEN: core.int,
+      NOT_FOUND: core.int,
+      METHOD_NOT_ALLOWED: core.int,
+      NOT_ACCEPTABLE: core.int,
+      PROXY_AUTHENTICATION_REQUIRED: core.int,
+      REQUEST_TIMEOUT: core.int,
+      CONFLICT: core.int,
+      GONE: core.int,
+      LENGTH_REQUIRED: core.int,
+      PRECONDITION_FAILED: core.int,
+      REQUEST_ENTITY_TOO_LARGE: core.int,
+      REQUEST_URI_TOO_LONG: core.int,
+      UNSUPPORTED_MEDIA_TYPE: core.int,
+      REQUESTED_RANGE_NOT_SATISFIABLE: core.int,
+      EXPECTATION_FAILED: core.int,
+      INTERNAL_SERVER_ERROR: core.int,
+      NOT_IMPLEMENTED: core.int,
+      BAD_GATEWAY: core.int,
+      SERVICE_UNAVAILABLE: core.int,
+      GATEWAY_TIMEOUT: core.int,
+      HTTP_VERSION_NOT_SUPPORTED: core.int,
+      NETWORK_CONNECT_TIMEOUT_ERROR: core.int
+    })
+  });
+  io.HttpStatus.CONTINUE = 100;
+  io.HttpStatus.SWITCHING_PROTOCOLS = 101;
+  io.HttpStatus.OK = 200;
+  io.HttpStatus.CREATED = 201;
+  io.HttpStatus.ACCEPTED = 202;
+  io.HttpStatus.NON_AUTHORITATIVE_INFORMATION = 203;
+  io.HttpStatus.NO_CONTENT = 204;
+  io.HttpStatus.RESET_CONTENT = 205;
+  io.HttpStatus.PARTIAL_CONTENT = 206;
+  io.HttpStatus.MULTIPLE_CHOICES = 300;
+  io.HttpStatus.MOVED_PERMANENTLY = 301;
+  io.HttpStatus.FOUND = 302;
+  io.HttpStatus.MOVED_TEMPORARILY = 302;
+  io.HttpStatus.SEE_OTHER = 303;
+  io.HttpStatus.NOT_MODIFIED = 304;
+  io.HttpStatus.USE_PROXY = 305;
+  io.HttpStatus.TEMPORARY_REDIRECT = 307;
+  io.HttpStatus.BAD_REQUEST = 400;
+  io.HttpStatus.UNAUTHORIZED = 401;
+  io.HttpStatus.PAYMENT_REQUIRED = 402;
+  io.HttpStatus.FORBIDDEN = 403;
+  io.HttpStatus.NOT_FOUND = 404;
+  io.HttpStatus.METHOD_NOT_ALLOWED = 405;
+  io.HttpStatus.NOT_ACCEPTABLE = 406;
+  io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED = 407;
+  io.HttpStatus.REQUEST_TIMEOUT = 408;
+  io.HttpStatus.CONFLICT = 409;
+  io.HttpStatus.GONE = 410;
+  io.HttpStatus.LENGTH_REQUIRED = 411;
+  io.HttpStatus.PRECONDITION_FAILED = 412;
+  io.HttpStatus.REQUEST_ENTITY_TOO_LARGE = 413;
+  io.HttpStatus.REQUEST_URI_TOO_LONG = 414;
+  io.HttpStatus.UNSUPPORTED_MEDIA_TYPE = 415;
+  io.HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+  io.HttpStatus.EXPECTATION_FAILED = 417;
+  io.HttpStatus.INTERNAL_SERVER_ERROR = 500;
+  io.HttpStatus.NOT_IMPLEMENTED = 501;
+  io.HttpStatus.BAD_GATEWAY = 502;
+  io.HttpStatus.SERVICE_UNAVAILABLE = 503;
+  io.HttpStatus.GATEWAY_TIMEOUT = 504;
+  io.HttpStatus.HTTP_VERSION_NOT_SUPPORTED = 505;
+  io.HttpStatus.NETWORK_CONNECT_TIMEOUT_ERROR = 599;
+  io.HttpServer = class HttpServer extends core.Object {
+    static bind(address, port, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io._HttpServer.bind(address, port, backlog, v6Only, shared);
+    }
+    static bindSecure(address, port, context, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io._HttpServer.bindSecure(address, port, context, backlog, v6Only, requestClientCertificate, shared);
+    }
+    static listenOn(serverSocket) {
+      return new io._HttpServer.listenOn(serverSocket);
+    }
+  };
+  io.HttpServer[dart.implements] = () => [StreamOfHttpRequest()];
+  dart.setSignature(io.HttpServer, {
+    constructors: () => ({listenOn: dart.definiteFunctionType(io.HttpServer, [io.ServerSocket])}),
+    fields: () => ({
+      serverHeader: core.String,
+      autoCompress: core.bool,
+      idleTimeout: core.Duration
+    }),
+    statics: () => ({
+      bind: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool}),
+      bindSecure: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, shared: core.bool})
+    }),
+    names: ['bind', 'bindSecure']
+  });
+  io.HttpConnectionsInfo = class HttpConnectionsInfo extends core.Object {
+    new() {
+      this.total = 0;
+      this.active = 0;
+      this.idle = 0;
+      this.closing = 0;
+    }
+  };
+  dart.setSignature(io.HttpConnectionsInfo, {
+    fields: () => ({
+      total: core.int,
+      active: core.int,
+      idle: core.int,
+      closing: core.int
+    })
+  });
+  io.HttpHeaders = class HttpHeaders extends core.Object {
+    new() {
+      this.date = null;
+      this.expires = null;
+      this.ifModifiedSince = null;
+      this.host = null;
+      this.port = null;
+      this.contentType = null;
+      this.contentLength = null;
+      this.persistentConnection = null;
+      this.chunkedTransferEncoding = null;
+    }
+  };
+  dart.setSignature(io.HttpHeaders, {
+    fields: () => ({
+      date: core.DateTime,
+      expires: core.DateTime,
+      ifModifiedSince: core.DateTime,
+      host: core.String,
+      port: core.int,
+      contentType: io.ContentType,
+      contentLength: core.int,
+      persistentConnection: core.bool,
+      chunkedTransferEncoding: core.bool
+    }),
+    sfields: () => ({
+      ACCEPT: core.String,
+      ACCEPT_CHARSET: core.String,
+      ACCEPT_ENCODING: core.String,
+      ACCEPT_LANGUAGE: core.String,
+      ACCEPT_RANGES: core.String,
+      AGE: core.String,
+      ALLOW: core.String,
+      AUTHORIZATION: core.String,
+      CACHE_CONTROL: core.String,
+      CONNECTION: core.String,
+      CONTENT_ENCODING: core.String,
+      CONTENT_LANGUAGE: core.String,
+      CONTENT_LENGTH: core.String,
+      CONTENT_LOCATION: core.String,
+      CONTENT_MD5: core.String,
+      CONTENT_RANGE: core.String,
+      CONTENT_TYPE: core.String,
+      DATE: core.String,
+      ETAG: core.String,
+      EXPECT: core.String,
+      EXPIRES: core.String,
+      FROM: core.String,
+      HOST: core.String,
+      IF_MATCH: core.String,
+      IF_MODIFIED_SINCE: core.String,
+      IF_NONE_MATCH: core.String,
+      IF_RANGE: core.String,
+      IF_UNMODIFIED_SINCE: core.String,
+      LAST_MODIFIED: core.String,
+      LOCATION: core.String,
+      MAX_FORWARDS: core.String,
+      PRAGMA: core.String,
+      PROXY_AUTHENTICATE: core.String,
+      PROXY_AUTHORIZATION: core.String,
+      RANGE: core.String,
+      REFERER: core.String,
+      RETRY_AFTER: core.String,
+      SERVER: core.String,
+      TE: core.String,
+      TRAILER: core.String,
+      TRANSFER_ENCODING: core.String,
+      UPGRADE: core.String,
+      USER_AGENT: core.String,
+      VARY: core.String,
+      VIA: core.String,
+      WARNING: core.String,
+      WWW_AUTHENTICATE: core.String,
+      COOKIE: core.String,
+      SET_COOKIE: core.String,
+      GENERAL_HEADERS: ListOfString(),
+      ENTITY_HEADERS: ListOfString(),
+      RESPONSE_HEADERS: ListOfString(),
+      REQUEST_HEADERS: ListOfString()
+    })
+  });
+  io.HttpHeaders.ACCEPT = "accept";
+  io.HttpHeaders.ACCEPT_CHARSET = "accept-charset";
+  io.HttpHeaders.ACCEPT_ENCODING = "accept-encoding";
+  io.HttpHeaders.ACCEPT_LANGUAGE = "accept-language";
+  io.HttpHeaders.ACCEPT_RANGES = "accept-ranges";
+  io.HttpHeaders.AGE = "age";
+  io.HttpHeaders.ALLOW = "allow";
+  io.HttpHeaders.AUTHORIZATION = "authorization";
+  io.HttpHeaders.CACHE_CONTROL = "cache-control";
+  io.HttpHeaders.CONNECTION = "connection";
+  io.HttpHeaders.CONTENT_ENCODING = "content-encoding";
+  io.HttpHeaders.CONTENT_LANGUAGE = "content-language";
+  io.HttpHeaders.CONTENT_LENGTH = "content-length";
+  io.HttpHeaders.CONTENT_LOCATION = "content-location";
+  io.HttpHeaders.CONTENT_MD5 = "content-md5";
+  io.HttpHeaders.CONTENT_RANGE = "content-range";
+  io.HttpHeaders.CONTENT_TYPE = "content-type";
+  io.HttpHeaders.DATE = "date";
+  io.HttpHeaders.ETAG = "etag";
+  io.HttpHeaders.EXPECT = "expect";
+  io.HttpHeaders.EXPIRES = "expires";
+  io.HttpHeaders.FROM = "from";
+  io.HttpHeaders.HOST = "host";
+  io.HttpHeaders.IF_MATCH = "if-match";
+  io.HttpHeaders.IF_MODIFIED_SINCE = "if-modified-since";
+  io.HttpHeaders.IF_NONE_MATCH = "if-none-match";
+  io.HttpHeaders.IF_RANGE = "if-range";
+  io.HttpHeaders.IF_UNMODIFIED_SINCE = "if-unmodified-since";
+  io.HttpHeaders.LAST_MODIFIED = "last-modified";
+  io.HttpHeaders.LOCATION = "location";
+  io.HttpHeaders.MAX_FORWARDS = "max-forwards";
+  io.HttpHeaders.PRAGMA = "pragma";
+  io.HttpHeaders.PROXY_AUTHENTICATE = "proxy-authenticate";
+  io.HttpHeaders.PROXY_AUTHORIZATION = "proxy-authorization";
+  io.HttpHeaders.RANGE = "range";
+  io.HttpHeaders.REFERER = "referer";
+  io.HttpHeaders.RETRY_AFTER = "retry-after";
+  io.HttpHeaders.SERVER = "server";
+  io.HttpHeaders.TE = "te";
+  io.HttpHeaders.TRAILER = "trailer";
+  io.HttpHeaders.TRANSFER_ENCODING = "transfer-encoding";
+  io.HttpHeaders.UPGRADE = "upgrade";
+  io.HttpHeaders.USER_AGENT = "user-agent";
+  io.HttpHeaders.VARY = "vary";
+  io.HttpHeaders.VIA = "via";
+  io.HttpHeaders.WARNING = "warning";
+  io.HttpHeaders.WWW_AUTHENTICATE = "www-authenticate";
+  io.HttpHeaders.COOKIE = "cookie";
+  io.HttpHeaders.SET_COOKIE = "set-cookie";
+  dart.defineLazy(io.HttpHeaders, {
+    get GENERAL_HEADERS() {
+      return dart.constList([io.HttpHeaders.CACHE_CONTROL, io.HttpHeaders.CONNECTION, io.HttpHeaders.DATE, io.HttpHeaders.PRAGMA, io.HttpHeaders.TRAILER, io.HttpHeaders.TRANSFER_ENCODING, io.HttpHeaders.UPGRADE, io.HttpHeaders.VIA, io.HttpHeaders.WARNING], core.String);
+    },
+    get ENTITY_HEADERS() {
+      return dart.constList([io.HttpHeaders.ALLOW, io.HttpHeaders.CONTENT_ENCODING, io.HttpHeaders.CONTENT_LANGUAGE, io.HttpHeaders.CONTENT_LENGTH, io.HttpHeaders.CONTENT_LOCATION, io.HttpHeaders.CONTENT_MD5, io.HttpHeaders.CONTENT_RANGE, io.HttpHeaders.CONTENT_TYPE, io.HttpHeaders.EXPIRES, io.HttpHeaders.LAST_MODIFIED], core.String);
+    },
+    get RESPONSE_HEADERS() {
+      return dart.constList([io.HttpHeaders.ACCEPT_RANGES, io.HttpHeaders.AGE, io.HttpHeaders.ETAG, io.HttpHeaders.LOCATION, io.HttpHeaders.PROXY_AUTHENTICATE, io.HttpHeaders.RETRY_AFTER, io.HttpHeaders.SERVER, io.HttpHeaders.VARY, io.HttpHeaders.WWW_AUTHENTICATE], core.String);
+    },
+    get REQUEST_HEADERS() {
+      return dart.constList([io.HttpHeaders.ACCEPT, io.HttpHeaders.ACCEPT_CHARSET, io.HttpHeaders.ACCEPT_ENCODING, io.HttpHeaders.ACCEPT_LANGUAGE, io.HttpHeaders.AUTHORIZATION, io.HttpHeaders.EXPECT, io.HttpHeaders.FROM, io.HttpHeaders.HOST, io.HttpHeaders.IF_MATCH, io.HttpHeaders.IF_MODIFIED_SINCE, io.HttpHeaders.IF_NONE_MATCH, io.HttpHeaders.IF_RANGE, io.HttpHeaders.IF_UNMODIFIED_SINCE, io.HttpHeaders.MAX_FORWARDS, io.HttpHeaders.PROXY_AUTHORIZATION, io.HttpHeaders.RANGE, io.HttpHeaders.REFERER, io.HttpHeaders.TE, io.HttpHeaders.USER_AGENT], core.String);
+    }
+  });
+  io.HeaderValue = class HeaderValue extends core.Object {
+    static new(value, parameters) {
+      if (value === void 0) value = "";
+      if (parameters === void 0) parameters = null;
+      return new io._HeaderValue(value, parameters);
+    }
+    static parse(value, opts) {
+      let parameterSeparator = opts && 'parameterSeparator' in opts ? opts.parameterSeparator : ";";
+      let valueSeparator = opts && 'valueSeparator' in opts ? opts.valueSeparator : null;
+      let preserveBackslash = opts && 'preserveBackslash' in opts ? opts.preserveBackslash : false;
+      return io._HeaderValue.parse(value, {parameterSeparator: parameterSeparator, valueSeparator: valueSeparator, preserveBackslash: preserveBackslash});
+    }
+  };
+  dart.setSignature(io.HeaderValue, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HeaderValue, [], [core.String, MapOfString$String()])}),
+    statics: () => ({parse: dart.definiteFunctionType(io.HeaderValue, [core.String], {parameterSeparator: core.String, valueSeparator: core.String, preserveBackslash: core.bool})}),
+    names: ['parse']
+  });
+  io.HttpSession = class HttpSession extends core.Object {};
+  io.HttpSession[dart.implements] = () => [core.Map];
+  io.ContentType = class ContentType extends core.Object {
+    static new(primaryType, subType, opts) {
+      let charset = opts && 'charset' in opts ? opts.charset : null;
+      let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+      return new io._ContentType(primaryType, subType, charset, parameters);
+    }
+    static parse(value) {
+      return io._ContentType.parse(value);
+    }
+  };
+  io.ContentType[dart.implements] = () => [io.HeaderValue];
+  dart.setSignature(io.ContentType, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ContentType, [core.String, core.String], {charset: core.String, parameters: MapOfString$String()})}),
+    sfields: () => ({
+      TEXT: io.ContentType,
+      HTML: io.ContentType,
+      JSON: io.ContentType,
+      BINARY: io.ContentType
+    }),
+    statics: () => ({parse: dart.definiteFunctionType(io.ContentType, [core.String])}),
+    names: ['parse']
+  });
+  dart.defineLazy(io.ContentType, {
+    get TEXT() {
+      return io.ContentType.new("text", "plain", {charset: "utf-8"});
+    },
+    get HTML() {
+      return io.ContentType.new("text", "html", {charset: "utf-8"});
+    },
+    get JSON() {
+      return io.ContentType.new("application", "json", {charset: "utf-8"});
+    },
+    get BINARY() {
+      return io.ContentType.new("application", "octet-stream");
+    }
+  });
+  io.Cookie = class Cookie extends core.Object {
+    static new(name, value) {
+      if (name === void 0) name = null;
+      if (value === void 0) value = null;
+      return new io._Cookie(name, value);
+    }
+    static fromSetCookieValue(value) {
+      return new io._Cookie.fromSetCookieValue(value);
+    }
+  };
+  dart.setSignature(io.Cookie, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.Cookie, [], [core.String, core.String]),
+      fromSetCookieValue: dart.definiteFunctionType(io.Cookie, [core.String])
+    }),
+    fields: () => ({
+      name: core.String,
+      value: core.String,
+      expires: core.DateTime,
+      maxAge: core.int,
+      domain: core.String,
+      path: core.String,
+      secure: core.bool,
+      httpOnly: core.bool
+    })
+  });
+  io.HttpRequest = class HttpRequest extends core.Object {};
+  io.HttpRequest[dart.implements] = () => [StreamOfListOfint()];
+  io.HttpResponse = class HttpResponse extends core.Object {
+    new() {
+      this.contentLength = null;
+      this.statusCode = null;
+      this.reasonPhrase = null;
+      this.persistentConnection = null;
+      this.deadline = null;
+      this.bufferOutput = null;
+    }
+  };
+  io.HttpResponse[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io.HttpResponse, {
+    fields: () => ({
+      contentLength: core.int,
+      statusCode: core.int,
+      reasonPhrase: core.String,
+      persistentConnection: core.bool,
+      deadline: core.Duration,
+      bufferOutput: core.bool
+    })
+  });
+  io.HttpClient = class HttpClient extends core.Object {
+    static new(opts) {
+      let context = opts && 'context' in opts ? opts.context : null;
+      return new io._HttpClient(context);
+    }
+    static findProxyFromEnvironment(url, opts) {
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      return io._HttpClient._findProxyFromEnvironment(url, environment);
+    }
+  };
+  dart.setSignature(io.HttpClient, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpClient, [], {context: io.SecurityContext})}),
+    fields: () => ({
+      idleTimeout: core.Duration,
+      maxConnectionsPerHost: core.int,
+      autoUncompress: core.bool,
+      userAgent: core.String
+    }),
+    sfields: () => ({
+      DEFAULT_HTTP_PORT: core.int,
+      DEFAULT_HTTPS_PORT: core.int
+    }),
+    statics: () => ({findProxyFromEnvironment: dart.definiteFunctionType(core.String, [core.Uri], {environment: MapOfString$String()})}),
+    names: ['findProxyFromEnvironment']
+  });
+  io.HttpClient.DEFAULT_HTTP_PORT = 80;
+  io.HttpClient.DEFAULT_HTTPS_PORT = 443;
+  io.HttpClientRequest = class HttpClientRequest extends core.Object {
+    new() {
+      this.persistentConnection = null;
+      this.followRedirects = null;
+      this.maxRedirects = null;
+      this.contentLength = null;
+      this.bufferOutput = null;
+    }
+  };
+  io.HttpClientRequest[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io.HttpClientRequest, {
+    fields: () => ({
+      persistentConnection: core.bool,
+      followRedirects: core.bool,
+      maxRedirects: core.int,
+      contentLength: core.int,
+      bufferOutput: core.bool
+    })
+  });
+  io.HttpClientResponse = class HttpClientResponse extends core.Object {};
+  io.HttpClientResponse[dart.implements] = () => [StreamOfListOfint()];
+  io.HttpClientCredentials = class HttpClientCredentials extends core.Object {};
+  io.HttpClientBasicCredentials = class HttpClientBasicCredentials extends io.HttpClientCredentials {
+    static new(username, password) {
+      return new io._HttpClientBasicCredentials(username, password);
+    }
+  };
+  dart.setSignature(io.HttpClientBasicCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpClientBasicCredentials, [core.String, core.String])})
+  });
+  io.HttpClientDigestCredentials = class HttpClientDigestCredentials extends io.HttpClientCredentials {
+    static new(username, password) {
+      return new io._HttpClientDigestCredentials(username, password);
+    }
+  };
+  dart.setSignature(io.HttpClientDigestCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpClientDigestCredentials, [core.String, core.String])})
+  });
+  io.HttpConnectionInfo = class HttpConnectionInfo extends core.Object {};
+  io.RedirectInfo = class RedirectInfo extends core.Object {};
+  io.DetachedSocket = class DetachedSocket extends core.Object {};
+  io.HttpException = class HttpException extends core.Object {
+    new(message, opts) {
+      let uri = opts && 'uri' in opts ? opts.uri : null;
+      this.message = message;
+      this.uri = uri;
+    }
+    toString() {
+      let b = new core.StringBuffer();
+      b.write('HttpException: ');
+      b.write(this.message);
+      if (this.uri != null) {
+        b.write(dart.str`, uri = ${this.uri}`);
+      }
+      return b.toString();
+    }
+  };
+  io.HttpException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.HttpException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpException, [core.String], {uri: core.Uri})}),
+    fields: () => ({
+      message: core.String,
+      uri: core.Uri
+    })
+  });
+  io.RedirectException = class RedirectException extends core.Object {
+    new(message, redirects) {
+      this.message = message;
+      this.redirects = redirects;
+    }
+    toString() {
+      return dart.str`RedirectException: ${this.message}`;
+    }
+    get uri() {
+      return this.redirects[dartx.last].location;
+    }
+  };
+  io.RedirectException[dart.implements] = () => [io.HttpException];
+  dart.setSignature(io.RedirectException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.RedirectException, [core.String, ListOfRedirectInfo()])}),
+    fields: () => ({
+      message: core.String,
+      redirects: ListOfRedirectInfo()
+    }),
+    getters: () => ({uri: dart.definiteFunctionType(core.Uri, [])})
+  });
+  let const$58;
+  let const$59;
+  let const$60;
+  let const$61;
+  let const$62;
+  let const$63;
+  let const$64;
+  let const$65;
+  let const$66;
+  io.HttpDate = class HttpDate extends core.Object {
+    static format(date) {
+      let wkday = const$58 || (const$58 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+      let month = const$59 || (const$59 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+      let d = date.toUtc();
+      let sb = new core.StringBuffer();
+      sb.write(wkday[dartx._get](dart.notNull(d.weekday) - 1));
+      sb.write(", ");
+      sb.write(dart.notNull(d.day) <= 9 ? "0" : "");
+      sb.write(dart.toString(d.day));
+      sb.write(" ");
+      sb.write(month[dartx._get](dart.notNull(d.month) - 1));
+      sb.write(" ");
+      sb.write(dart.toString(d.year));
+      sb.write(dart.notNull(d.hour) <= 9 ? " 0" : " ");
+      sb.write(dart.toString(d.hour));
+      sb.write(dart.notNull(d.minute) <= 9 ? ":0" : ":");
+      sb.write(dart.toString(d.minute));
+      sb.write(dart.notNull(d.second) <= 9 ? ":0" : ":");
+      sb.write(dart.toString(d.second));
+      sb.write(" GMT");
+      return sb.toString();
+    }
+    static parse(date) {
+      let SP = 32;
+      let wkdays = const$60 || (const$60 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+      let weekdays = const$61 || (const$61 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
+      let months = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+      let wkdaysLowerCase = const$63 || (const$63 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
+      let weekdaysLowerCase = const$64 || (const$64 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
+      let monthsLowerCase = const$65 || (const$65 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+      let formatRfc1123 = 0;
+      let formatRfc850 = 1;
+      let formatAsctime = 2;
+      let index = 0;
+      let tmp = null;
+      let format = null;
+      function expect(s) {
+        if (dart.notNull(date[dartx.length]) - dart.notNull(index) < dart.notNull(s[dartx.length])) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        }
+        let tmp = date[dartx.substring](index, dart.notNull(index) + dart.notNull(s[dartx.length]));
+        if (tmp != s) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        }
+        index = dart.notNull(index) + dart.notNull(s[dartx.length]);
+      }
+      dart.fn(expect, StringTovoid$());
+      function expectWeekday() {
+        let weekday = null;
+        let pos = date[dartx.indexOf](",", index);
+        if (pos == -1) {
+          let pos = date[dartx.indexOf](" ", index);
+          if (pos == -1) dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+          tmp = date[dartx.substring](index, pos);
+          index = dart.notNull(pos) + 1;
+          weekday = wkdays[dartx.indexOf](tmp);
+          if (weekday != -1) {
+            format = formatAsctime;
+            return weekday;
+          }
+        } else {
+          tmp = date[dartx.substring](index, pos);
+          index = dart.notNull(pos) + 1;
+          weekday = wkdays[dartx.indexOf](tmp);
+          if (weekday != -1) {
+            format = formatRfc1123;
+            return weekday;
+          }
+          weekday = weekdays[dartx.indexOf](tmp);
+          if (weekday != -1) {
+            format = formatRfc850;
+            return weekday;
+          }
+        }
+        dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      }
+      dart.fn(expectWeekday, VoidToint());
+      function expectMonth(separator) {
+        let pos = date[dartx.indexOf](separator, index);
+        if (dart.notNull(pos) - dart.notNull(index) != 3) dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        tmp = date[dartx.substring](index, pos);
+        index = dart.notNull(pos) + 1;
+        let month = months[dartx.indexOf](tmp);
+        if (month != -1) return month;
+        dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      }
+      dart.fn(expectMonth, StringToint$());
+      function expectNum(separator) {
+        let pos = null;
+        if (dart.notNull(separator[dartx.length]) > 0) {
+          pos = date[dartx.indexOf](separator, index);
+        } else {
+          pos = date[dartx.length];
+        }
+        let tmp = date[dartx.substring](index, pos);
+        index = dart.notNull(pos) + dart.notNull(separator[dartx.length]);
+        try {
+          let value = core.int.parse(tmp);
+          return value;
+        } catch (e) {
+          if (core.FormatException.is(e)) {
+            dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+          } else
+            throw e;
+        }
+
+      }
+      dart.fn(expectNum, StringToint$());
+      function expectEnd() {
+        if (index != date[dartx.length]) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        }
+      }
+      dart.fn(expectEnd, VoidTovoid$());
+      let weekday = expectWeekday();
+      let day = null;
+      let month = null;
+      let year = null;
+      let hours = null;
+      let minutes = null;
+      let seconds = null;
+      if (format == formatAsctime) {
+        month = expectMonth(" ");
+        if (date[dartx.codeUnitAt](index) == SP) {
+          index = dart.notNull(index) + 1;
+        }
+        day = expectNum(" ");
+        hours = expectNum(":");
+        minutes = expectNum(":");
+        seconds = expectNum(" ");
+        year = expectNum("");
+      } else {
+        expect(" ");
+        day = expectNum(format == formatRfc1123 ? " " : "-");
+        month = expectMonth(format == formatRfc1123 ? " " : "-");
+        year = expectNum(" ");
+        hours = expectNum(":");
+        minutes = expectNum(":");
+        seconds = expectNum(" ");
+        expect("GMT");
+      }
+      expectEnd();
+      return new core.DateTime.utc(year, dart.notNull(month) + 1, day, hours, minutes, seconds, 0);
+    }
+    static _parseCookieDate(date) {
+      let monthsLowerCase = const$66 || (const$66 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+      let position = 0;
+      function error() {
+        dart.throw(new io.HttpException(dart.str`Invalid cookie date ${date}`));
+      }
+      dart.fn(error, VoidTovoid$());
+      function isEnd() {
+        return position == date[dartx.length];
+      }
+      dart.fn(isEnd, VoidTobool());
+      function isDelimiter(s) {
+        let char = s[dartx.codeUnitAt](0);
+        if (char == 9) return true;
+        if (dart.notNull(char) >= 32 && dart.notNull(char) <= 47) return true;
+        if (dart.notNull(char) >= 59 && dart.notNull(char) <= 64) return true;
+        if (dart.notNull(char) >= 91 && dart.notNull(char) <= 96) return true;
+        if (dart.notNull(char) >= 123 && dart.notNull(char) <= 126) return true;
+        return false;
+      }
+      dart.fn(isDelimiter, StringTobool$());
+      function isNonDelimiter(s) {
+        let char = s[dartx.codeUnitAt](0);
+        if (dart.notNull(char) >= 0 && dart.notNull(char) <= 8) return true;
+        if (dart.notNull(char) >= 10 && dart.notNull(char) <= 31) return true;
+        if (dart.notNull(char) >= 48 && dart.notNull(char) <= 57) return true;
+        if (char == 58) return true;
+        if (dart.notNull(char) >= 65 && dart.notNull(char) <= 90) return true;
+        if (dart.notNull(char) >= 97 && dart.notNull(char) <= 122) return true;
+        if (dart.notNull(char) >= 127 && dart.notNull(char) <= 255) return true;
+        return false;
+      }
+      dart.fn(isNonDelimiter, StringTobool$());
+      function isDigit(s) {
+        let char = s[dartx.codeUnitAt](0);
+        if (dart.notNull(char) > 47 && dart.notNull(char) < 58) return true;
+        return false;
+      }
+      dart.fn(isDigit, StringTobool$());
+      function getMonth(month) {
+        if (dart.notNull(month[dartx.length]) < 3) return -1;
+        return monthsLowerCase[dartx.indexOf](month[dartx.substring](0, 3));
+      }
+      dart.fn(getMonth, StringToint$());
+      function toInt(s) {
+        let index = 0;
+        for (; index < dart.notNull(s[dartx.length]) && dart.test(isDigit(s[dartx._get](index))); index++)
+          ;
+        return core.int.parse(s[dartx.substring](0, index));
+      }
+      dart.fn(toInt, StringToint$());
+      let tokens = [];
+      while (!dart.test(isEnd())) {
+        while (!dart.test(isEnd()) && dart.test(isDelimiter(date[dartx._get](position))))
+          position++;
+        let start = position;
+        while (!dart.test(isEnd()) && dart.test(isNonDelimiter(date[dartx._get](position))))
+          position++;
+        tokens[dartx.add](date[dartx.substring](start, position)[dartx.toLowerCase]());
+        while (!dart.test(isEnd()) && dart.test(isDelimiter(date[dartx._get](position))))
+          position++;
+      }
+      let timeStr = null;
+      let dayOfMonthStr = null;
+      let monthStr = null;
+      let yearStr = null;
+      for (let token of tokens) {
+        if (dart.test(dart.dsend(dart.dload(token, 'length'), '<', 1))) continue;
+        if (timeStr == null && dart.test(dart.dsend(dart.dload(token, 'length'), '>=', 5)) && dart.test(isDigit(core.String._check(dart.dindex(token, 0)))) && (dart.equals(dart.dindex(token, 1), ":") || dart.test(isDigit(core.String._check(dart.dindex(token, 1)))) && dart.equals(dart.dindex(token, 2), ":"))) {
+          timeStr = core.String._check(token);
+        } else if (dayOfMonthStr == null && dart.test(isDigit(core.String._check(dart.dindex(token, 0))))) {
+          dayOfMonthStr = core.String._check(token);
+        } else if (monthStr == null && dart.notNull(getMonth(core.String._check(token))) >= 0) {
+          monthStr = core.String._check(token);
+        } else if (yearStr == null && dart.test(dart.dsend(dart.dload(token, 'length'), '>=', 2)) && dart.test(isDigit(core.String._check(dart.dindex(token, 0)))) && dart.test(isDigit(core.String._check(dart.dindex(token, 1))))) {
+          yearStr = core.String._check(token);
+        }
+      }
+      if (timeStr == null || dayOfMonthStr == null || monthStr == null || yearStr == null) {
+        error();
+      }
+      let year = toInt(yearStr);
+      if (dart.notNull(year) >= 70 && dart.notNull(year) <= 99) {
+        year = dart.notNull(year) + 1900;
+      } else if (dart.notNull(year) >= 0 && dart.notNull(year) <= 69) {
+        year = dart.notNull(year) + 2000;
+      }
+      if (dart.notNull(year) < 1601) error();
+      let dayOfMonth = toInt(dayOfMonthStr);
+      if (dart.notNull(dayOfMonth) < 1 || dart.notNull(dayOfMonth) > 31) error();
+      let month = dart.notNull(getMonth(monthStr)) + 1;
+      let timeList = timeStr[dartx.split](":");
+      if (timeList[dartx.length] != 3) error();
+      let hour = toInt(timeList[dartx._get](0));
+      let minute = toInt(timeList[dartx._get](1));
+      let second = toInt(timeList[dartx._get](2));
+      if (dart.notNull(hour) > 23) error();
+      if (dart.notNull(minute) > 59) error();
+      if (dart.notNull(second) > 59) error();
+      return new core.DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0);
+    }
+  };
+  dart.setSignature(io.HttpDate, {
+    statics: () => ({
+      format: dart.definiteFunctionType(core.String, [core.DateTime]),
+      parse: dart.definiteFunctionType(core.DateTime, [core.String]),
+      _parseCookieDate: dart.definiteFunctionType(core.DateTime, [core.String])
+    }),
+    names: ['format', 'parse', '_parseCookieDate']
+  });
+  const _headers = Symbol('_headers');
+  const _defaultPortForScheme = Symbol('_defaultPortForScheme');
+  const _mutable = Symbol('_mutable');
+  const _noFoldingHeaders = Symbol('_noFoldingHeaders');
+  const _contentLength = Symbol('_contentLength');
+  const _persistentConnection = Symbol('_persistentConnection');
+  const _chunkedTransferEncoding = Symbol('_chunkedTransferEncoding');
+  const _host$ = Symbol('_host');
+  const _port$ = Symbol('_port');
+  const _checkMutable = Symbol('_checkMutable');
+  const _addAll = Symbol('_addAll');
+  const _add$2 = Symbol('_add');
+  const _set$ = Symbol('_set');
+  const _addValue = Symbol('_addValue');
+  const _updateHostHeader = Symbol('_updateHostHeader');
+  const _addDate = Symbol('_addDate');
+  const _addHost = Symbol('_addHost');
+  const _addExpires = Symbol('_addExpires');
+  const _addConnection = Symbol('_addConnection');
+  const _addContentType = Symbol('_addContentType');
+  const _addContentLength = Symbol('_addContentLength');
+  const _addTransferEncoding = Symbol('_addTransferEncoding');
+  const _addIfModifiedSince = Symbol('_addIfModifiedSince');
+  const _foldHeader = Symbol('_foldHeader');
+  const _finalize = Symbol('_finalize');
+  const _write = Symbol('_write');
+  const _parseCookies = Symbol('_parseCookies');
+  io._HttpHeaders = class _HttpHeaders extends core.Object {
+    new(protocolVersion, opts) {
+      let defaultPortForScheme = opts && 'defaultPortForScheme' in opts ? opts.defaultPortForScheme : io.HttpClient.DEFAULT_HTTP_PORT;
+      let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
+      this.protocolVersion = protocolVersion;
+      this[_headers] = HashMapOfString$ListOfString().new();
+      this[_defaultPortForScheme] = defaultPortForScheme;
+      this[_mutable] = true;
+      this[_noFoldingHeaders] = null;
+      this[_contentLength] = -1;
+      this[_persistentConnection] = true;
+      this[_chunkedTransferEncoding] = false;
+      this[_host$] = null;
+      this[_port$] = null;
+      if (initialHeaders != null) {
+        initialHeaders[_headers][dartx.forEach](dart.fn((name, value) => this[_headers][dartx._set](name, value), StringAndListOfStringToListOfString()));
+        this[_contentLength] = initialHeaders[_contentLength];
+        this[_persistentConnection] = initialHeaders[_persistentConnection];
+        this[_chunkedTransferEncoding] = initialHeaders[_chunkedTransferEncoding];
+        this[_host$] = initialHeaders[_host$];
+        this[_port$] = initialHeaders[_port$];
+      }
+      if (this.protocolVersion == "1.0") {
+        this[_persistentConnection] = false;
+        this[_chunkedTransferEncoding] = false;
+      }
+    }
+    _get(name) {
+      return this[_headers][dartx._get](name[dartx.toLowerCase]());
+    }
+    value(name) {
+      name = name[dartx.toLowerCase]();
+      let values = this[_headers][dartx._get](name);
+      if (values == null) return null;
+      if (dart.notNull(values[dartx.length]) > 1) {
+        dart.throw(new io.HttpException(dart.str`More than one value for header ${name}`));
+      }
+      return values[dartx._get](0);
+    }
+    add(name, value) {
+      this[_checkMutable]();
+      this[_addAll](io._HttpHeaders._validateField(name), value);
+    }
+    [_addAll](name, value) {
+      dart.assert(name == io._HttpHeaders._validateField(name));
+      if (core.Iterable.is(value)) {
+        for (let v of value) {
+          this[_add$2](name, io._HttpHeaders._validateValue(v));
+        }
+      } else {
+        this[_add$2](name, io._HttpHeaders._validateValue(value));
+      }
+    }
+    set(name, value) {
+      this[_checkMutable]();
+      name = io._HttpHeaders._validateField(name);
+      this[_headers][dartx.remove](name);
+      if (name == io.HttpHeaders.TRANSFER_ENCODING) {
+        this[_chunkedTransferEncoding] = false;
+      }
+      this[_addAll](name, value);
+    }
+    remove(name, value) {
+      this[_checkMutable]();
+      name = io._HttpHeaders._validateField(name);
+      value = io._HttpHeaders._validateValue(value);
+      let values = this[_headers][dartx._get](name);
+      if (values != null) {
+        let index = values[dartx.indexOf](core.String._check(value));
+        if (index != -1) {
+          values[dartx.removeRange](index, dart.notNull(index) + 1);
+        }
+        if (values[dartx.length] == 0) this[_headers][dartx.remove](name);
+      }
+      if (name == io.HttpHeaders.TRANSFER_ENCODING && dart.equals(value, "chunked")) {
+        this[_chunkedTransferEncoding] = false;
+      }
+    }
+    removeAll(name) {
+      this[_checkMutable]();
+      name = io._HttpHeaders._validateField(name);
+      this[_headers][dartx.remove](name);
+    }
+    forEach(f) {
+      this[_headers][dartx.forEach](f);
+    }
+    noFolding(name) {
+      if (this[_noFoldingHeaders] == null) this[_noFoldingHeaders] = ListOfString().new();
+      this[_noFoldingHeaders][dartx.add](name);
+    }
+    get persistentConnection() {
+      return this[_persistentConnection];
+    }
+    set persistentConnection(persistentConnection) {
+      this[_checkMutable]();
+      if (persistentConnection == this[_persistentConnection]) return;
+      if (dart.test(persistentConnection)) {
+        if (this.protocolVersion == "1.1") {
+          this.remove(io.HttpHeaders.CONNECTION, "close");
+        } else {
+          if (this[_contentLength] == -1) {
+            dart.throw(new io.HttpException("Trying to set 'Connection: Keep-Alive' on HTTP 1.0 headers with " + "no ContentLength"));
+          }
+          this.add(io.HttpHeaders.CONNECTION, "keep-alive");
+        }
+      } else {
+        if (this.protocolVersion == "1.1") {
+          this.add(io.HttpHeaders.CONNECTION, "close");
+        } else {
+          this.remove(io.HttpHeaders.CONNECTION, "keep-alive");
+        }
+      }
+      this[_persistentConnection] = persistentConnection;
+    }
+    get contentLength() {
+      return this[_contentLength];
+    }
+    set contentLength(contentLength) {
+      this[_checkMutable]();
+      if (this.protocolVersion == "1.0" && dart.test(this.persistentConnection) && contentLength == -1) {
+        dart.throw(new io.HttpException("Trying to clear ContentLength on HTTP 1.0 headers with " + "'Connection: Keep-Alive' set"));
+      }
+      if (this[_contentLength] == contentLength) return;
+      this[_contentLength] = contentLength;
+      if (dart.notNull(this[_contentLength]) >= 0) {
+        if (dart.test(this.chunkedTransferEncoding)) this.chunkedTransferEncoding = false;
+        this[_set$](io.HttpHeaders.CONTENT_LENGTH, dart.toString(contentLength));
+      } else {
+        this.removeAll(io.HttpHeaders.CONTENT_LENGTH);
+        if (this.protocolVersion == "1.1") {
+          this.chunkedTransferEncoding = true;
+        }
+      }
+    }
+    get chunkedTransferEncoding() {
+      return this[_chunkedTransferEncoding];
+    }
+    set chunkedTransferEncoding(chunkedTransferEncoding) {
+      this[_checkMutable]();
+      if (dart.test(chunkedTransferEncoding) && this.protocolVersion == "1.0") {
+        dart.throw(new io.HttpException("Trying to set 'Transfer-Encoding: Chunked' on HTTP 1.0 headers"));
+      }
+      if (chunkedTransferEncoding == this[_chunkedTransferEncoding]) return;
+      if (dart.test(chunkedTransferEncoding)) {
+        let values = this[_headers][dartx._get](io.HttpHeaders.TRANSFER_ENCODING);
+        if (values == null || values[dartx.last] != "chunked") {
+          this[_addValue](io.HttpHeaders.TRANSFER_ENCODING, "chunked");
+        }
+        this.contentLength = -1;
+      } else {
+        this.remove(io.HttpHeaders.TRANSFER_ENCODING, "chunked");
+      }
+      this[_chunkedTransferEncoding] = chunkedTransferEncoding;
+    }
+    get host() {
+      return this[_host$];
+    }
+    set host(host) {
+      this[_checkMutable]();
+      this[_host$] = host;
+      this[_updateHostHeader]();
+    }
+    get port() {
+      return this[_port$];
+    }
+    set port(port) {
+      this[_checkMutable]();
+      this[_port$] = port;
+      this[_updateHostHeader]();
+    }
+    get ifModifiedSince() {
+      let values = this[_headers][dartx._get](io.HttpHeaders.IF_MODIFIED_SINCE);
+      if (values != null) {
+        try {
+          return io.HttpDate.parse(values[dartx._get](0));
+        } catch (e) {
+          if (core.Exception.is(e)) {
+            return null;
+          } else
+            throw e;
+        }
+
+      }
+      return null;
+    }
+    set ifModifiedSince(ifModifiedSince) {
+      this[_checkMutable]();
+      let formatted = io.HttpDate.format(ifModifiedSince.toUtc());
+      this[_set$](io.HttpHeaders.IF_MODIFIED_SINCE, formatted);
+    }
+    get date() {
+      let values = this[_headers][dartx._get](io.HttpHeaders.DATE);
+      if (values != null) {
+        try {
+          return io.HttpDate.parse(values[dartx._get](0));
+        } catch (e) {
+          if (core.Exception.is(e)) {
+            return null;
+          } else
+            throw e;
+        }
+
+      }
+      return null;
+    }
+    set date(date) {
+      this[_checkMutable]();
+      let formatted = io.HttpDate.format(date.toUtc());
+      this[_set$]("date", formatted);
+    }
+    get expires() {
+      let values = this[_headers][dartx._get](io.HttpHeaders.EXPIRES);
+      if (values != null) {
+        try {
+          return io.HttpDate.parse(values[dartx._get](0));
+        } catch (e) {
+          if (core.Exception.is(e)) {
+            return null;
+          } else
+            throw e;
+        }
+
+      }
+      return null;
+    }
+    set expires(expires) {
+      this[_checkMutable]();
+      let formatted = io.HttpDate.format(expires.toUtc());
+      this[_set$](io.HttpHeaders.EXPIRES, formatted);
+    }
+    get contentType() {
+      let values = this[_headers][dartx._get]("content-type");
+      if (values != null) {
+        return io.ContentType.parse(values[dartx._get](0));
+      } else {
+        return null;
+      }
+    }
+    set contentType(contentType) {
+      this[_checkMutable]();
+      this[_set$](io.HttpHeaders.CONTENT_TYPE, dart.toString(contentType));
+    }
+    clear() {
+      this[_checkMutable]();
+      this[_headers][dartx.clear]();
+      this[_contentLength] = -1;
+      this[_persistentConnection] = true;
+      this[_chunkedTransferEncoding] = false;
+      this[_host$] = null;
+      this[_port$] = null;
+    }
+    [_add$2](name, value) {
+      dart.assert(name == io._HttpHeaders._validateField(name));
+      switch (name[dartx.length]) {
+        case 4:
+        {
+          if (io.HttpHeaders.DATE == name) {
+            this[_addDate](name, value);
+            return;
+          }
+          if (io.HttpHeaders.HOST == name) {
+            this[_addHost](name, value);
+            return;
+          }
+          break;
+        }
+        case 7:
+        {
+          if (io.HttpHeaders.EXPIRES == name) {
+            this[_addExpires](name, value);
+            return;
+          }
+          break;
+        }
+        case 10:
+        {
+          if (io.HttpHeaders.CONNECTION == name) {
+            this[_addConnection](name, value);
+            return;
+          }
+          break;
+        }
+        case 12:
+        {
+          if (io.HttpHeaders.CONTENT_TYPE == name) {
+            this[_addContentType](name, value);
+            return;
+          }
+          break;
+        }
+        case 14:
+        {
+          if (io.HttpHeaders.CONTENT_LENGTH == name) {
+            this[_addContentLength](name, value);
+            return;
+          }
+          break;
+        }
+        case 17:
+        {
+          if (io.HttpHeaders.TRANSFER_ENCODING == name) {
+            this[_addTransferEncoding](name, value);
+            return;
+          }
+          if (io.HttpHeaders.IF_MODIFIED_SINCE == name) {
+            this[_addIfModifiedSince](name, value);
+            return;
+          }
+        }
+      }
+      this[_addValue](name, value);
+    }
+    [_addContentLength](name, value) {
+      if (typeof value == 'number') {
+        this.contentLength = value;
+      } else if (typeof value == 'string') {
+        this.contentLength = core.int.parse(value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addTransferEncoding](name, value) {
+      if (dart.equals(value, "chunked")) {
+        this.chunkedTransferEncoding = true;
+      } else {
+        this[_addValue](io.HttpHeaders.TRANSFER_ENCODING, value);
+      }
+    }
+    [_addDate](name, value) {
+      if (core.DateTime.is(value)) {
+        this.date = value;
+      } else if (typeof value == 'string') {
+        this[_set$](io.HttpHeaders.DATE, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addExpires](name, value) {
+      if (core.DateTime.is(value)) {
+        this.expires = value;
+      } else if (typeof value == 'string') {
+        this[_set$](io.HttpHeaders.EXPIRES, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addIfModifiedSince](name, value) {
+      if (core.DateTime.is(value)) {
+        this.ifModifiedSince = value;
+      } else if (typeof value == 'string') {
+        this[_set$](io.HttpHeaders.IF_MODIFIED_SINCE, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addHost](name, value) {
+      if (typeof value == 'string') {
+        let pos = value[dartx.indexOf](":");
+        if (pos == -1) {
+          this[_host$] = value;
+          this[_port$] = io.HttpClient.DEFAULT_HTTP_PORT;
+        } else {
+          if (dart.notNull(pos) > 0) {
+            this[_host$] = value[dartx.substring](0, pos);
+          } else {
+            this[_host$] = null;
+          }
+          if (dart.notNull(pos) + 1 == value[dartx.length]) {
+            this[_port$] = io.HttpClient.DEFAULT_HTTP_PORT;
+          } else {
+            try {
+              this[_port$] = core.int.parse(value[dartx.substring](dart.notNull(pos) + 1));
+            } catch (e) {
+              if (core.FormatException.is(e)) {
+                this[_port$] = null;
+              } else
+                throw e;
+            }
+
+          }
+        }
+        this[_set$](io.HttpHeaders.HOST, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addConnection](name, value) {
+      let lowerCaseValue = dart.dsend(value, 'toLowerCase');
+      if (dart.equals(lowerCaseValue, 'close')) {
+        this[_persistentConnection] = false;
+      } else if (dart.equals(lowerCaseValue, 'keep-alive')) {
+        this[_persistentConnection] = true;
+      }
+      this[_addValue](name, value);
+    }
+    [_addContentType](name, value) {
+      this[_set$](io.HttpHeaders.CONTENT_TYPE, core.String._check(value));
+    }
+    [_addValue](name, value) {
+      let values = this[_headers][dartx._get](name);
+      if (values == null) {
+        values = ListOfString().new();
+        this[_headers][dartx._set](name, values);
+      }
+      if (core.DateTime.is(value)) {
+        values[dartx.add](io.HttpDate.format(value));
+      } else if (typeof value == 'string') {
+        values[dartx.add](value);
+      } else {
+        values[dartx.add](core.String._check(io._HttpHeaders._validateValue(dart.toString(value))));
+      }
+    }
+    [_set$](name, value) {
+      dart.assert(name == io._HttpHeaders._validateField(name));
+      let values = ListOfString().new();
+      this[_headers][dartx._set](name, values);
+      values[dartx.add](value);
+    }
+    [_checkMutable]() {
+      if (!dart.test(this[_mutable])) dart.throw(new io.HttpException("HTTP headers are not mutable"));
+    }
+    [_updateHostHeader]() {
+      let defaultPort = this[_port$] == null || this[_port$] == this[_defaultPortForScheme];
+      this[_set$]("host", defaultPort ? this.host : dart.str`${this.host}:${this[_port$]}`);
+    }
+    [_foldHeader](name) {
+      if (name == io.HttpHeaders.SET_COOKIE || this[_noFoldingHeaders] != null && this[_noFoldingHeaders][dartx.indexOf](name) != -1) {
+        return false;
+      }
+      return true;
+    }
+    [_finalize]() {
+      this[_mutable] = false;
+    }
+    [_write](buffer, offset) {
+      function write(bytes) {
+        let len = bytes[dartx.length];
+        for (let i = 0; i < dart.notNull(len); i++) {
+          buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+        }
+        offset = dart.notNull(offset) + dart.notNull(len);
+      }
+      dart.fn(write, ListOfintTovoid$());
+      for (let name of this[_headers][dartx.keys]) {
+        let values = this[_headers][dartx._get](name);
+        let fold = core.bool._check(this[_foldHeader](name));
+        let nameData = name[dartx.codeUnits];
+        write(nameData);
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.COLON);
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.SP);
+        for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
+          if (i > 0) {
+            if (dart.test(fold)) {
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.COMMA);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.SP);
+            } else {
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.CR);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.LF);
+              write(nameData);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.COLON);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.SP);
+            }
+          }
+          write(values[dartx._get](i)[dartx.codeUnits]);
+        }
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.CR);
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.LF);
+      }
+      return offset;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      this[_headers][dartx.forEach](dart.fn((name, values) => {
+        sb.write(name);
+        sb.write(": ");
+        let fold = core.bool._check(this[_foldHeader](name));
+        for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
+          if (i > 0) {
+            if (dart.test(fold)) {
+              sb.write(", ");
+            } else {
+              sb.write("\n");
+              sb.write(name);
+              sb.write(": ");
+            }
+          }
+          sb.write(values[dartx._get](i));
+        }
+        sb.write("\n");
+      }, StringAndListOfStringToNull()));
+      return sb.toString();
+    }
+    [_parseCookies]() {
+      let cookies = ListOfCookie().new();
+      function parseCookieString(s) {
+        let index = 0;
+        function done() {
+          return index == -1 || index == s[dartx.length];
+        }
+        dart.fn(done, VoidTobool());
+        function skipWS() {
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) != " " && s[dartx._get](index) != "\t") return;
+            index = dart.notNull(index) + 1;
+          }
+        }
+        dart.fn(skipWS, VoidTovoid$());
+        function parseName() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == "=") break;
+            index = dart.notNull(index) + 1;
+          }
+          return s[dartx.substring](start, index);
+        }
+        dart.fn(parseName, VoidToString$());
+        function parseValue() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == ";") break;
+            index = dart.notNull(index) + 1;
+          }
+          return s[dartx.substring](start, index);
+        }
+        dart.fn(parseValue, VoidToString$());
+        function expect(expected) {
+          if (dart.test(done())) return false;
+          if (s[dartx._get](index) != expected) return false;
+          index = dart.notNull(index) + 1;
+          return true;
+        }
+        dart.fn(expect, StringTobool$());
+        while (!dart.test(done())) {
+          skipWS();
+          if (dart.test(done())) return;
+          let name = parseName();
+          skipWS();
+          if (!dart.test(expect("="))) {
+            index = s[dartx.indexOf](';', index);
+            continue;
+          }
+          skipWS();
+          let value = parseValue();
+          try {
+            cookies[dartx.add](new io._Cookie(name, value));
+          } catch (_) {
+          }
+
+          skipWS();
+          if (dart.test(done())) return;
+          if (!dart.test(expect(";"))) {
+            index = s[dartx.indexOf](';', index);
+            continue;
+          }
+        }
+      }
+      dart.fn(parseCookieString, StringTovoid$());
+      let values = this[_headers][dartx._get](io.HttpHeaders.COOKIE);
+      if (values != null) {
+        values[dartx.forEach](dart.fn(headerValue => parseCookieString(headerValue), StringTovoid$()));
+      }
+      return cookies;
+    }
+    static _validateField(field) {
+      for (let i = 0; i < dart.notNull(field[dartx.length]); i++) {
+        if (!dart.test(io._HttpParser._isTokenChar(field[dartx.codeUnitAt](i)))) {
+          dart.throw(new core.FormatException(dart.str`Invalid HTTP header field name: ${convert.JSON.encode(field)}`));
+        }
+      }
+      return field[dartx.toLowerCase]();
+    }
+    static _validateValue(value) {
+      if (!(typeof value == 'string')) return value;
+      for (let i = 0; i < dart.notNull(core.num._check(dart.dload(value, 'length'))); i++) {
+        if (!dart.test(io._HttpParser._isValueChar(core.int._check(dart.dsend(value, 'codeUnitAt', i))))) {
+          dart.throw(new core.FormatException(dart.str`Invalid HTTP header field value: ${convert.JSON.encode(value)}`));
+        }
+      }
+      return value;
+    }
+  };
+  io._HttpHeaders[dart.implements] = () => [io.HttpHeaders];
+  dart.setSignature(io._HttpHeaders, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpHeaders, [core.String], {defaultPortForScheme: core.int, initialHeaders: io._HttpHeaders})}),
+    fields: () => ({
+      [_headers]: MapOfString$ListOfString(),
+      protocolVersion: core.String,
+      [_mutable]: core.bool,
+      [_noFoldingHeaders]: ListOfString(),
+      [_contentLength]: core.int,
+      [_persistentConnection]: core.bool,
+      [_chunkedTransferEncoding]: core.bool,
+      [_host$]: core.String,
+      [_port$]: core.int,
+      [_defaultPortForScheme]: core.int
+    }),
+    getters: () => ({
+      persistentConnection: dart.definiteFunctionType(core.bool, []),
+      contentLength: dart.definiteFunctionType(core.int, []),
+      chunkedTransferEncoding: dart.definiteFunctionType(core.bool, []),
+      host: dart.definiteFunctionType(core.String, []),
+      port: dart.definiteFunctionType(core.int, []),
+      ifModifiedSince: dart.definiteFunctionType(core.DateTime, []),
+      date: dart.definiteFunctionType(core.DateTime, []),
+      expires: dart.definiteFunctionType(core.DateTime, []),
+      contentType: dart.definiteFunctionType(io.ContentType, [])
+    }),
+    setters: () => ({
+      persistentConnection: dart.definiteFunctionType(dart.void, [core.bool]),
+      contentLength: dart.definiteFunctionType(dart.void, [core.int]),
+      chunkedTransferEncoding: dart.definiteFunctionType(dart.void, [core.bool]),
+      host: dart.definiteFunctionType(dart.void, [core.String]),
+      port: dart.definiteFunctionType(dart.void, [core.int]),
+      ifModifiedSince: dart.definiteFunctionType(dart.void, [core.DateTime]),
+      date: dart.definiteFunctionType(dart.void, [core.DateTime]),
+      expires: dart.definiteFunctionType(dart.void, [core.DateTime]),
+      contentType: dart.definiteFunctionType(dart.void, [io.ContentType])
+    }),
+    methods: () => ({
+      _get: dart.definiteFunctionType(core.List$(core.String), [core.String]),
+      value: dart.definiteFunctionType(core.String, [core.String]),
+      add: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      [_addAll]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      set: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      remove: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      removeAll: dart.definiteFunctionType(dart.void, [core.String]),
+      forEach: dart.definiteFunctionType(dart.void, [StringAndListOfStringTovoid()]),
+      noFolding: dart.definiteFunctionType(dart.void, [core.String]),
+      clear: dart.definiteFunctionType(dart.void, []),
+      [_add$2]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addContentLength]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addTransferEncoding]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addDate]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addExpires]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addIfModifiedSince]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addHost]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addConnection]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addContentType]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addValue]: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      [_set$]: dart.definiteFunctionType(dart.void, [core.String, core.String]),
+      [_checkMutable]: dart.definiteFunctionType(dart.dynamic, []),
+      [_updateHostHeader]: dart.definiteFunctionType(dart.dynamic, []),
+      [_foldHeader]: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      [_finalize]: dart.definiteFunctionType(dart.void, []),
+      [_write]: dart.definiteFunctionType(core.int, [typed_data.Uint8List, core.int]),
+      [_parseCookies]: dart.definiteFunctionType(core.List$(io.Cookie), [])
+    }),
+    statics: () => ({
+      _validateField: dart.definiteFunctionType(core.String, [core.String]),
+      _validateValue: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
+    }),
+    names: ['_validateField', '_validateValue']
+  });
+  const _value$1 = Symbol('_value');
+  const _parameters = Symbol('_parameters');
+  const _unmodifiableParameters = Symbol('_unmodifiableParameters');
+  const _parse = Symbol('_parse');
+  const _ensureParameters = Symbol('_ensureParameters');
+  io._HeaderValue = class _HeaderValue extends core.Object {
+    new(value, parameters) {
+      if (value === void 0) value = "";
+      if (parameters === void 0) parameters = null;
+      this[_value$1] = value;
+      this[_parameters] = null;
+      this[_unmodifiableParameters] = null;
+      if (parameters != null) {
+        this[_parameters] = HashMapOfString$String().from(parameters);
+      }
+    }
+    static parse(value, opts) {
+      let parameterSeparator = opts && 'parameterSeparator' in opts ? opts.parameterSeparator : ";";
+      let valueSeparator = opts && 'valueSeparator' in opts ? opts.valueSeparator : null;
+      let preserveBackslash = opts && 'preserveBackslash' in opts ? opts.preserveBackslash : false;
+      let result = new io._HeaderValue();
+      result[_parse](value, core.String._check(parameterSeparator), core.String._check(valueSeparator), core.bool._check(preserveBackslash));
+      return result;
+    }
+    get value() {
+      return this[_value$1];
+    }
+    [_ensureParameters]() {
+      if (this[_parameters] == null) {
+        this[_parameters] = HashMapOfString$String().new();
+      }
+    }
+    get parameters() {
+      this[_ensureParameters]();
+      if (this[_unmodifiableParameters] == null) {
+        this[_unmodifiableParameters] = new (UnmodifiableMapViewOfString$String())(this[_parameters]);
+      }
+      return this[_unmodifiableParameters];
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write(this[_value$1]);
+      if (this.parameters != null && dart.notNull(this.parameters[dartx.length]) > 0) {
+        this[_parameters][dartx.forEach](dart.fn((name, value) => {
+          sb.write("; ");
+          sb.write(name);
+          sb.write("=");
+          sb.write(value);
+        }, StringAndStringToNull()));
+      }
+      return sb.toString();
+    }
+    [_parse](s, parameterSeparator, valueSeparator, preserveBackslash) {
+      let index = 0;
+      function done() {
+        return index == s[dartx.length];
+      }
+      dart.fn(done, VoidTobool());
+      function skipWS() {
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) != " " && s[dartx._get](index) != "\t") return;
+          index++;
+        }
+      }
+      dart.fn(skipWS, VoidTovoid$());
+      function parseValue() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == valueSeparator || s[dartx._get](index) == parameterSeparator) break;
+          index++;
+        }
+        return s[dartx.substring](start, index);
+      }
+      dart.fn(parseValue, VoidToString$());
+      function expect(expected) {
+        if (dart.test(done()) || s[dartx._get](index) != expected) {
+          dart.throw(new io.HttpException("Failed to parse header value"));
+        }
+        index++;
+      }
+      dart.fn(expect, StringTovoid$());
+      function maybeExpect(expected) {
+        if (s[dartx._get](index) == expected) index++;
+      }
+      dart.fn(maybeExpect, StringTovoid$());
+      const parseParameters = (function() {
+        let parameters = HashMapOfString$String().new();
+        this[_parameters] = new (UnmodifiableMapViewOfString$String())(parameters);
+        function parseParameterName() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == "=" || s[dartx._get](index) == parameterSeparator || s[dartx._get](index) == valueSeparator) break;
+            index++;
+          }
+          return s[dartx.substring](start, index)[dartx.toLowerCase]();
+        }
+        dart.fn(parseParameterName, VoidToString$());
+        function parseParameterValue() {
+          if (!dart.test(done()) && s[dartx._get](index) == "\"") {
+            let sb = new core.StringBuffer();
+            index++;
+            while (!dart.test(done())) {
+              if (s[dartx._get](index) == "\\") {
+                if (index + 1 == s[dartx.length]) {
+                  dart.throw(new io.HttpException("Failed to parse header value"));
+                }
+                if (dart.test(preserveBackslash) && s[dartx._get](index + 1) != "\"") {
+                  sb.write(s[dartx._get](index));
+                }
+                index++;
+              } else if (s[dartx._get](index) == "\"") {
+                index++;
+                break;
+              }
+              sb.write(s[dartx._get](index));
+              index++;
+            }
+            return sb.toString();
+          } else {
+            let val = parseValue();
+            return val == "" ? null : val;
+          }
+        }
+        dart.fn(parseParameterValue, VoidToString$());
+        while (!dart.test(done())) {
+          skipWS();
+          if (dart.test(done())) return;
+          let name = parseParameterName();
+          skipWS();
+          if (dart.test(done())) {
+            parameters._set(name, null);
+            return;
+          }
+          maybeExpect("=");
+          skipWS();
+          if (dart.test(done())) {
+            parameters._set(name, null);
+            return;
+          }
+          let value = parseParameterValue();
+          if (name == 'charset' && io._ContentType.is(this)) {
+            value = value[dartx.toLowerCase]();
+          }
+          parameters._set(name, value);
+          skipWS();
+          if (dart.test(done())) return;
+          if (s[dartx._get](index) == valueSeparator) return;
+          expect(parameterSeparator);
+        }
+      }).bind(this);
+      dart.fn(parseParameters, VoidTovoid$());
+      skipWS();
+      this[_value$1] = parseValue();
+      skipWS();
+      if (dart.test(done())) return;
+      maybeExpect(parameterSeparator);
+      parseParameters();
+    }
+  };
+  io._HeaderValue[dart.implements] = () => [io.HeaderValue];
+  dart.setSignature(io._HeaderValue, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HeaderValue, [], [core.String, MapOfString$String()])}),
+    fields: () => ({
+      [_value$1]: core.String,
+      [_parameters]: MapOfString$String(),
+      [_unmodifiableParameters]: MapOfString$String()
+    }),
+    getters: () => ({
+      value: dart.definiteFunctionType(core.String, []),
+      parameters: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+    }),
+    methods: () => ({
+      [_ensureParameters]: dart.definiteFunctionType(dart.void, []),
+      [_parse]: dart.definiteFunctionType(dart.void, [core.String, core.String, core.String, core.bool])
+    }),
+    statics: () => ({parse: dart.definiteFunctionType(io._HeaderValue, [core.String], {parameterSeparator: dart.dynamic, valueSeparator: dart.dynamic, preserveBackslash: dart.dynamic})}),
+    names: ['parse']
+  });
+  const _primaryType = Symbol('_primaryType');
+  const _subType = Symbol('_subType');
+  io._ContentType = class _ContentType extends io._HeaderValue {
+    new(primaryType, subType, charset, parameters) {
+      this[_primaryType] = primaryType;
+      this[_subType] = subType;
+      super.new("");
+      if (this[_primaryType] == null) this[_primaryType] = "";
+      if (this[_subType] == null) this[_subType] = "";
+      this[_value$1] = dart.str`${this[_primaryType]}/${this[_subType]}`;
+      if (parameters != null) {
+        this[_ensureParameters]();
+        parameters[dartx.forEach](dart.fn((key, value) => {
+          let lowerCaseKey = key[dartx.toLowerCase]();
+          if (lowerCaseKey == "charset") {
+            value = value[dartx.toLowerCase]();
+          }
+          this[_parameters][dartx._set](lowerCaseKey, value);
+        }, StringAndStringToNull()));
+      }
+      if (charset != null) {
+        this[_ensureParameters]();
+        this[_parameters][dartx._set]("charset", charset[dartx.toLowerCase]());
+      }
+    }
+    _() {
+      this[_primaryType] = "";
+      this[_subType] = "";
+      super.new();
+    }
+    static parse(value) {
+      let result = new io._ContentType._();
+      result[_parse](value, ";", null, false);
+      let index = result[_value$1][dartx.indexOf]("/");
+      if (index == -1 || index == dart.notNull(result[_value$1][dartx.length]) - 1) {
+        result[_primaryType] = result[_value$1][dartx.trim]()[dartx.toLowerCase]();
+        result[_subType] = "";
+      } else {
+        result[_primaryType] = result[_value$1][dartx.substring](0, index)[dartx.trim]()[dartx.toLowerCase]();
+        result[_subType] = result[_value$1][dartx.substring](dart.notNull(index) + 1)[dartx.trim]()[dartx.toLowerCase]();
+      }
+      return result;
+    }
+    get mimeType() {
+      return dart.str`${this.primaryType}/${this.subType}`;
+    }
+    get primaryType() {
+      return this[_primaryType];
+    }
+    get subType() {
+      return this[_subType];
+    }
+    get charset() {
+      return this.parameters[dartx._get]("charset");
+    }
+  };
+  dart.defineNamedConstructor(io._ContentType, '_');
+  io._ContentType[dart.implements] = () => [io.ContentType];
+  dart.setSignature(io._ContentType, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._ContentType, [core.String, core.String, core.String, MapOfString$String()]),
+      _: dart.definiteFunctionType(io._ContentType, [])
+    }),
+    fields: () => ({
+      [_primaryType]: core.String,
+      [_subType]: core.String
+    }),
+    getters: () => ({
+      mimeType: dart.definiteFunctionType(core.String, []),
+      primaryType: dart.definiteFunctionType(core.String, []),
+      subType: dart.definiteFunctionType(core.String, []),
+      charset: dart.definiteFunctionType(core.String, [])
+    }),
+    statics: () => ({parse: dart.definiteFunctionType(io._ContentType, [core.String])}),
+    names: ['parse']
+  });
+  const _validate = Symbol('_validate');
+  const _parseSetCookieValue = Symbol('_parseSetCookieValue');
+  let const$67;
+  io._Cookie = class _Cookie extends core.Object {
+    new(name, value) {
+      if (name === void 0) name = null;
+      if (value === void 0) value = null;
+      this.name = name;
+      this.value = value;
+      this.expires = null;
+      this.maxAge = null;
+      this.domain = null;
+      this.path = null;
+      this.httpOnly = false;
+      this.secure = false;
+      this.httpOnly = true;
+      this[_validate]();
+    }
+    fromSetCookieValue(value) {
+      this.name = null;
+      this.value = null;
+      this.expires = null;
+      this.maxAge = null;
+      this.domain = null;
+      this.path = null;
+      this.httpOnly = false;
+      this.secure = false;
+      this[_parseSetCookieValue](value);
+    }
+    [_parseSetCookieValue](s) {
+      let index = 0;
+      function done() {
+        return index == s[dartx.length];
+      }
+      dart.fn(done, VoidTobool());
+      function parseName() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == "=") break;
+          index++;
+        }
+        return s[dartx.substring](start, index)[dartx.trim]();
+      }
+      dart.fn(parseName, VoidToString$());
+      function parseValue() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == ";") break;
+          index++;
+        }
+        return s[dartx.substring](start, index)[dartx.trim]();
+      }
+      dart.fn(parseValue, VoidToString$());
+      function expect(expected) {
+        if (dart.test(done())) dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+        if (s[dartx._get](index) != expected) {
+          dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+        }
+        index++;
+      }
+      dart.fn(expect, StringTovoid$());
+      const parseAttributes = (function() {
+        function parseAttributeName() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == "=" || s[dartx._get](index) == ";") break;
+            index++;
+          }
+          return s[dartx.substring](start, index)[dartx.trim]()[dartx.toLowerCase]();
+        }
+        dart.fn(parseAttributeName, VoidToString$());
+        function parseAttributeValue() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == ";") break;
+            index++;
+          }
+          return s[dartx.substring](start, index)[dartx.trim]()[dartx.toLowerCase]();
+        }
+        dart.fn(parseAttributeValue, VoidToString$());
+        while (!dart.test(done())) {
+          let name = parseAttributeName();
+          let value = "";
+          if (!dart.test(done()) && s[dartx._get](index) == "=") {
+            index++;
+            value = parseAttributeValue();
+          }
+          if (name == "expires") {
+            this.expires = io.HttpDate._parseCookieDate(value);
+          } else if (name == "max-age") {
+            this.maxAge = core.int.parse(value);
+          } else if (name == "domain") {
+            this.domain = value;
+          } else if (name == "path") {
+            this.path = value;
+          } else if (name == "httponly") {
+            this.httpOnly = true;
+          } else if (name == "secure") {
+            this.secure = true;
+          }
+          if (!dart.test(done())) index++;
+        }
+      }).bind(this);
+      dart.fn(parseAttributes, VoidTovoid$());
+      this.name = parseName();
+      if (dart.test(done()) || this.name[dartx.length] == 0) {
+        dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+      }
+      index++;
+      this.value = parseValue();
+      this[_validate]();
+      if (dart.test(done())) return;
+      index++;
+      parseAttributes();
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write(this.name);
+      sb.write("=");
+      sb.write(this.value);
+      if (this.expires != null) {
+        sb.write("; Expires=");
+        sb.write(io.HttpDate.format(this.expires));
+      }
+      if (this.maxAge != null) {
+        sb.write("; Max-Age=");
+        sb.write(this.maxAge);
+      }
+      if (this.domain != null) {
+        sb.write("; Domain=");
+        sb.write(this.domain);
+      }
+      if (this.path != null) {
+        sb.write("; Path=");
+        sb.write(this.path);
+      }
+      if (dart.test(this.secure)) sb.write("; Secure");
+      if (dart.test(this.httpOnly)) sb.write("; HttpOnly");
+      return sb.toString();
+    }
+    [_validate]() {
+      let SEPERATORS = const$67 || (const$67 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
+      for (let i = 0; i < dart.notNull(this.name[dartx.length]); i++) {
+        let codeUnit = this.name[dartx.codeUnits][dartx._get](i);
+        if (dart.notNull(codeUnit) <= 32 || dart.notNull(codeUnit) >= 127 || dart.notNull(SEPERATORS[dartx.indexOf](this.name[dartx._get](i))) >= 0) {
+          dart.throw(new core.FormatException(dart.str`Invalid character in cookie name, code unit: '${codeUnit}'`));
+        }
+      }
+      for (let i = 0; i < dart.notNull(this.value[dartx.length]); i++) {
+        let codeUnit = this.value[dartx.codeUnits][dartx._get](i);
+        if (!(codeUnit == 33 || dart.notNull(codeUnit) >= 35 && dart.notNull(codeUnit) <= 43 || dart.notNull(codeUnit) >= 45 && dart.notNull(codeUnit) <= 58 || dart.notNull(codeUnit) >= 60 && dart.notNull(codeUnit) <= 91 || dart.notNull(codeUnit) >= 93 && dart.notNull(codeUnit) <= 126)) {
+          dart.throw(new core.FormatException(dart.str`Invalid character in cookie value, code unit: '${codeUnit}'`));
+        }
+      }
+    }
+  };
+  dart.defineNamedConstructor(io._Cookie, 'fromSetCookieValue');
+  io._Cookie[dart.implements] = () => [io.Cookie];
+  dart.setSignature(io._Cookie, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._Cookie, [], [core.String, core.String]),
+      fromSetCookieValue: dart.definiteFunctionType(io._Cookie, [core.String])
+    }),
+    fields: () => ({
+      name: core.String,
+      value: core.String,
+      expires: core.DateTime,
+      maxAge: core.int,
+      domain: core.String,
+      path: core.String,
+      httpOnly: core.bool,
+      secure: core.bool
+    }),
+    methods: () => ({
+      [_parseSetCookieValue]: dart.definiteFunctionType(dart.void, [core.String]),
+      [_validate]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._OUTGOING_BUFFER_SIZE = 8 * 1024;
+  const _transferLength = Symbol('_transferLength');
+  const _dataCompleter = Symbol('_dataCompleter');
+  const _stream$ = Symbol('_stream');
+  io._HttpIncoming = class _HttpIncoming extends async.Stream$(core.List$(core.int)) {
+    get transferLength() {
+      return this[_transferLength];
+    }
+    new(headers, transferLength, stream) {
+      this[_dataCompleter] = async.Completer.new();
+      this.headers = headers;
+      this[_transferLength] = transferLength;
+      this[_stream$] = stream;
+      this.fullBodyRead = false;
+      this.upgraded = false;
+      this.statusCode = null;
+      this.reasonPhrase = null;
+      this.method = null;
+      this.uri = null;
+      this.hasSubscriber = false;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      this.hasSubscriber = true;
+      return this[_stream$].handleError(dart.fn(error => {
+        dart.throw(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this.uri}));
+      }, dynamicToNull$())).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get dataDone() {
+      return this[_dataCompleter].future;
+    }
+    close(closing) {
+      this.fullBodyRead = true;
+      this.hasSubscriber = true;
+      this[_dataCompleter].complete(closing);
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpIncoming);
+  dart.setSignature(io._HttpIncoming, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpIncoming, [io._HttpHeaders, core.int, StreamOfListOfint()])}),
+    fields: () => ({
+      [_transferLength]: core.int,
+      [_dataCompleter]: async.Completer,
+      [_stream$]: StreamOfListOfint(),
+      fullBodyRead: core.bool,
+      headers: io._HttpHeaders,
+      upgraded: core.bool,
+      statusCode: core.int,
+      reasonPhrase: core.String,
+      method: core.String,
+      uri: core.Uri,
+      hasSubscriber: core.bool
+    }),
+    getters: () => ({
+      transferLength: dart.definiteFunctionType(core.int, []),
+      dataDone: dart.definiteFunctionType(async.Future, [])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(dart.void, [core.bool])
+    })
+  });
+  const _incoming = Symbol('_incoming');
+  const _cookies = Symbol('_cookies');
+  io._HttpInboundMessage = class _HttpInboundMessage extends async.Stream$(core.List$(core.int)) {
+    new(incoming) {
+      this[_incoming] = incoming;
+      this[_cookies] = null;
+      super.new();
+    }
+    get cookies() {
+      if (this[_cookies] != null) return this[_cookies];
+      return this[_cookies] = this.headers[_parseCookies]();
+    }
+    get headers() {
+      return this[_incoming].headers;
+    }
+    get protocolVersion() {
+      return this.headers.protocolVersion;
+    }
+    get contentLength() {
+      return this.headers.contentLength;
+    }
+    get persistentConnection() {
+      return this.headers.persistentConnection;
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpInboundMessage);
+  dart.setSignature(io._HttpInboundMessage, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpInboundMessage, [io._HttpIncoming])}),
+    fields: () => ({
+      [_incoming]: io._HttpIncoming,
+      [_cookies]: ListOfCookie()
+    }),
+    getters: () => ({
+      cookies: dart.definiteFunctionType(core.List$(io.Cookie), []),
+      headers: dart.definiteFunctionType(io._HttpHeaders, []),
+      protocolVersion: dart.definiteFunctionType(core.String, []),
+      contentLength: dart.definiteFunctionType(core.int, []),
+      persistentConnection: dart.definiteFunctionType(core.bool, [])
+    })
+  });
+  const _httpServer = Symbol('_httpServer');
+  const _httpConnection = Symbol('_httpConnection');
+  const _session = Symbol('_session');
+  const _requestedUri = Symbol('_requestedUri');
+  const _sessionManagerInstance = Symbol('_sessionManagerInstance');
+  const _sessionManager = Symbol('_sessionManager');
+  const _markSeen = Symbol('_markSeen');
+  const _socket = Symbol('_socket');
+  const _destroyed = Symbol('_destroyed');
+  io._HttpRequest = class _HttpRequest extends io._HttpInboundMessage {
+    new(response, _incoming, httpServer, httpConnection) {
+      this.response = response;
+      this[_httpServer] = httpServer;
+      this[_httpConnection] = httpConnection;
+      this[_session] = null;
+      this[_requestedUri] = null;
+      super.new(_incoming);
+      if (this.headers.protocolVersion == "1.1") {
+        let _ = this.response.headers;
+        _.chunkedTransferEncoding = true;
+        _.persistentConnection = this.headers.persistentConnection;
+      }
+      if (this[_httpServer][_sessionManagerInstance] != null) {
+        let sessionIds = this.cookies[dartx.where](dart.fn(cookie => cookie.name[dartx.toUpperCase]() == io._DART_SESSION_ID, CookieTobool()))[dartx.map](core.String)(dart.fn(cookie => cookie.value, CookieToString()));
+        for (let sessionId of sessionIds) {
+          this[_session] = this[_httpServer][_sessionManager].getSession(sessionId);
+          if (this[_session] != null) {
+            this[_session][_markSeen]();
+            break;
+          }
+        }
+      }
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get uri() {
+      return this[_incoming].uri;
+    }
+    get requestedUri() {
+      if (this[_requestedUri] == null) {
+        let proto = this.headers._get('x-forwarded-proto');
+        let scheme = proto != null ? proto[dartx.first] : io.SecureSocket.is(this[_httpConnection][_socket]) ? "https" : "http";
+        let hostList = this.headers._get('x-forwarded-host');
+        let host = null;
+        if (hostList != null) {
+          host = hostList[dartx.first];
+        } else {
+          hostList = this.headers._get('host');
+          if (hostList != null) {
+            host = hostList[dartx.first];
+          } else {
+            host = dart.str`${this[_httpServer].address.host}:${this[_httpServer].port}`;
+          }
+        }
+        this[_requestedUri] = core.Uri.parse(dart.str`${scheme}://${host}${this.uri}`);
+      }
+      return this[_requestedUri];
+    }
+    get method() {
+      return this[_incoming].method;
+    }
+    get session() {
+      if (this[_session] != null) {
+        if (dart.test(this[_session][_destroyed])) {
+          this[_session] = null;
+          return this.session;
+        }
+        return this[_session];
+      }
+      return this[_session] = this[_httpServer][_sessionManager].createSession();
+    }
+    get connectionInfo() {
+      return this[_httpConnection].connectionInfo;
+    }
+    get certificate() {
+      let socket = this[_httpConnection][_socket];
+      if (io.SecureSocket.is(socket)) return socket.peerCertificate;
+      return null;
+    }
+  };
+  io._HttpRequest[dart.implements] = () => [io.HttpRequest];
+  dart.setSignature(io._HttpRequest, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpRequest, [io.HttpResponse, io._HttpIncoming, io._HttpServer, io._HttpConnection])}),
+    fields: () => ({
+      response: io.HttpResponse,
+      [_httpServer]: io._HttpServer,
+      [_httpConnection]: io._HttpConnection,
+      [_session]: io._HttpSession,
+      [_requestedUri]: core.Uri
+    }),
+    getters: () => ({
+      uri: dart.definiteFunctionType(core.Uri, []),
+      requestedUri: dart.definiteFunctionType(core.Uri, []),
+      method: dart.definiteFunctionType(core.String, []),
+      session: dart.definiteFunctionType(io.HttpSession, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      certificate: dart.definiteFunctionType(io.X509Certificate, [])
+    }),
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+  });
+  const _responseRedirects = Symbol('_responseRedirects');
+  const _httpRequest = Symbol('_httpRequest');
+  const _httpClient = Symbol('_httpClient');
+  const _httpClientConnection = Symbol('_httpClientConnection');
+  const _openUrlFromRequest = Symbol('_openUrlFromRequest');
+  const _connectionClosed = Symbol('_connectionClosed');
+  const _shouldAuthenticateProxy = Symbol('_shouldAuthenticateProxy');
+  const _shouldAuthenticate = Symbol('_shouldAuthenticate');
+  const _proxy = Symbol('_proxy');
+  const _findProxyCredentials = Symbol('_findProxyCredentials');
+  const _findCredentials = Symbol('_findCredentials');
+  const _removeProxyCredentials = Symbol('_removeProxyCredentials');
+  const _removeCredentials = Symbol('_removeCredentials');
+  const _authenticateProxy = Symbol('_authenticateProxy');
+  const _authenticate = Symbol('_authenticate');
+  io._HttpClientResponse = class _HttpClientResponse extends io._HttpInboundMessage {
+    get redirects() {
+      return this[_httpRequest][_responseRedirects];
+    }
+    new(_incoming, httpRequest, httpClient) {
+      this[_httpRequest] = httpRequest;
+      this[_httpClient] = httpClient;
+      super.new(_incoming);
+      _incoming.uri = this[_httpRequest].uri;
+    }
+    get statusCode() {
+      return this[_incoming].statusCode;
+    }
+    get reasonPhrase() {
+      return this[_incoming].reasonPhrase;
+    }
+    get certificate() {
+      let socket = this[_httpRequest][_httpClientConnection][_socket];
+      if (io.SecureSocket.is(socket)) return socket.peerCertificate;
+      dart.throw(new core.UnsupportedError("Socket is not a SecureSocket"));
+    }
+    get cookies() {
+      if (this[_cookies] != null) return this[_cookies];
+      this[_cookies] = ListOfCookie().new();
+      let values = this.headers._get(io.HttpHeaders.SET_COOKIE);
+      if (values != null) {
+        values[dartx.forEach](dart.fn(value => {
+          this[_cookies][dartx.add](io.Cookie.fromSetCookieValue(value));
+        }, StringToNull()));
+      }
+      return this[_cookies];
+    }
+    get isRedirect() {
+      if (this[_httpRequest].method == "GET" || this[_httpRequest].method == "HEAD") {
+        return this.statusCode == io.HttpStatus.MOVED_PERMANENTLY || this.statusCode == io.HttpStatus.FOUND || this.statusCode == io.HttpStatus.SEE_OTHER || this.statusCode == io.HttpStatus.TEMPORARY_REDIRECT;
+      } else if (this[_httpRequest].method == "POST") {
+        return this.statusCode == io.HttpStatus.SEE_OTHER;
+      }
+      return false;
+    }
+    redirect(method, url, followLoops) {
+      if (method === void 0) method = null;
+      if (url === void 0) url = null;
+      if (followLoops === void 0) followLoops = null;
+      if (method == null) {
+        if (this.statusCode == io.HttpStatus.SEE_OTHER && this[_httpRequest].method == "POST") {
+          method = "GET";
+        } else {
+          method = this[_httpRequest].method;
+        }
+      }
+      if (url == null) {
+        let location = this.headers.value(io.HttpHeaders.LOCATION);
+        if (location == null) {
+          dart.throw(new core.StateError("Response has no Location header for redirect"));
+        }
+        url = core.Uri.parse(location);
+      }
+      if (followLoops != true) {
+        for (let redirect of this.redirects) {
+          if (dart.equals(redirect.location, url)) {
+            return FutureOfHttpClientResponse().error(new io.RedirectException("Redirect loop detected", this.redirects));
+          }
+        }
+      }
+      return this[_httpClient][_openUrlFromRequest](method, url, this[_httpRequest]).then(io.HttpClientResponse)(dart.fn(request => {
+        let _ = request[_responseRedirects];
+        _[dartx.addAll](this.redirects);
+        _[dartx.add](new io._RedirectInfo(this.statusCode, method, url));
+        return request.close();
+      }, _HttpClientRequestToFutureOfHttpClientResponse()));
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      if (dart.test(this[_incoming].upgraded)) {
+        this[_httpRequest][_httpClientConnection].destroy();
+        return StreamSubscriptionOfListOfint()._check(async.Stream.fromIterable([]).listen(null, {onDone: onDone}));
+      }
+      let stream = this[_incoming];
+      if (dart.test(this[_httpClient].autoUncompress) && this.headers.value(io.HttpHeaders.CONTENT_ENCODING) == "gzip") {
+        stream = io._HttpIncoming._check(stream.transform(ListOfint())(io.GZIP.decoder));
+      }
+      return stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    detachSocket() {
+      this[_httpClient][_connectionClosed](this[_httpRequest][_httpClientConnection]);
+      return this[_httpRequest][_httpClientConnection].detachSocket();
+    }
+    get connectionInfo() {
+      return this[_httpRequest].connectionInfo;
+    }
+    get [_shouldAuthenticateProxy]() {
+      let challenge = this.headers._get(io.HttpHeaders.PROXY_AUTHENTICATE);
+      return this.statusCode == io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED && challenge != null && challenge[dartx.length] == 1;
+    }
+    get [_shouldAuthenticate]() {
+      let challenge = this.headers._get(io.HttpHeaders.WWW_AUTHENTICATE);
+      return this.statusCode == io.HttpStatus.UNAUTHORIZED && challenge != null && challenge[dartx.length] == 1;
+    }
+    [_authenticate](proxyAuth) {
+      const retry = (function() {
+        return this.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => this[_httpClient][_openUrlFromRequest](this[_httpRequest].method, this[_httpRequest].uri, this[_httpRequest]).then(io.HttpClientResponse)(dart.fn(request => request.close(), _HttpClientRequestToFutureOfHttpClientResponse())), dynamicToFutureOfHttpClientResponse()));
+      }).bind(this);
+      dart.fn(retry, VoidToFutureOfHttpClientResponse());
+      const authChallenge = (function() {
+        return dart.test(proxyAuth) ? this.headers._get(io.HttpHeaders.PROXY_AUTHENTICATE) : this.headers._get(io.HttpHeaders.WWW_AUTHENTICATE);
+      }).bind(this);
+      dart.fn(authChallenge, VoidToListOfString());
+      const findCredentials = (function(scheme) {
+        return dart.test(proxyAuth) ? this[_httpClient][_findProxyCredentials](this[_httpRequest][_proxy], scheme) : this[_httpClient][_findCredentials](this[_httpRequest].uri, scheme);
+      }).bind(this);
+      dart.fn(findCredentials, _AuthenticationSchemeTo_Credentials());
+      const removeCredentials = (function(cr) {
+        if (dart.test(proxyAuth)) {
+          this[_httpClient][_removeProxyCredentials](cr);
+        } else {
+          this[_httpClient][_removeCredentials](cr);
+        }
+      }).bind(this);
+      dart.fn(removeCredentials, _CredentialsTovoid());
+      const requestAuthentication = (function(scheme, realm) {
+        if (dart.test(proxyAuth)) {
+          if (this[_httpClient][_authenticateProxy] == null) {
+            return async.Future.value(false);
+          }
+          let proxy = this[_httpRequest][_proxy];
+          return async.Future._check(dart.dsend(this[_httpClient], _authenticateProxy, proxy.host, proxy.port, dart.toString(scheme), realm));
+        } else {
+          if (this[_httpClient][_authenticate] == null) {
+            return async.Future.value(false);
+          }
+          return async.Future._check(dart.dsend(this[_httpClient], _authenticate, this[_httpRequest].uri, dart.toString(scheme), realm));
+        }
+      }).bind(this);
+      dart.fn(requestAuthentication, _AuthenticationSchemeAndStringToFuture());
+      let challenge = authChallenge();
+      dart.assert(challenge != null || challenge[dartx.length] == 1);
+      let header = io._HeaderValue.parse(challenge[dartx._get](0), {parameterSeparator: ","});
+      let scheme = io._AuthenticationScheme.fromString(header.value);
+      let realm = header.parameters[dartx._get]("realm");
+      let cr = findCredentials(scheme);
+      if (cr != null) {
+        if (dart.equals(cr.scheme, io._AuthenticationScheme.BASIC) && !dart.test(cr.used)) {
+          return retry();
+        }
+        if (dart.equals(cr.scheme, io._AuthenticationScheme.DIGEST) && (header.parameters[dartx._get]("algorithm") == null || header.parameters[dartx._get]("algorithm")[dartx.toLowerCase]() == "md5")) {
+          if (cr.nonce == null || cr.nonce == header.parameters[dartx._get]("nonce")) {
+            if (cr.nonce == null) {
+              let _ = cr;
+              _.nonce = header.parameters[dartx._get]("nonce");
+              _.algorithm = "MD5";
+              _.qop = header.parameters[dartx._get]("qop");
+              _.nonceCount = 0;
+            }
+            return retry();
+          } else if (header.parameters[dartx._get]("stale") != null && header.parameters[dartx._get]("stale")[dartx.toLowerCase]() == "true") {
+            cr.nonce = header.parameters[dartx._get]("nonce");
+            return retry();
+          }
+        }
+      }
+      if (cr != null) {
+        removeCredentials(cr);
+        cr = null;
+      }
+      return requestAuthentication(scheme, realm).then(io.HttpClientResponse)(dart.fn(credsAvailable => {
+        if (dart.test(credsAvailable)) {
+          cr = this[_httpClient][_findCredentials](this[_httpRequest].uri, scheme);
+          return retry();
+        } else {
+          return this;
+        }
+      }, dynamicToFutureOrOfHttpClientResponse()));
+    }
+  };
+  io._HttpClientResponse[dart.implements] = () => [io.HttpClientResponse];
+  dart.setSignature(io._HttpClientResponse, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientResponse, [io._HttpIncoming, io._HttpClientRequest, io._HttpClient])}),
+    fields: () => ({
+      [_httpClient]: io._HttpClient,
+      [_httpRequest]: io._HttpClientRequest
+    }),
+    getters: () => ({
+      redirects: dart.definiteFunctionType(core.List$(io.RedirectInfo), []),
+      statusCode: dart.definiteFunctionType(core.int, []),
+      reasonPhrase: dart.definiteFunctionType(core.String, []),
+      certificate: dart.definiteFunctionType(io.X509Certificate, []),
+      isRedirect: dart.definiteFunctionType(core.bool, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      [_shouldAuthenticateProxy]: dart.definiteFunctionType(core.bool, []),
+      [_shouldAuthenticate]: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      redirect: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [], [core.String, core.Uri, core.bool]),
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      [_authenticate]: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [core.bool])
+    })
+  });
+  const _uri = Symbol('_uri');
+  const _outgoing = Symbol('_outgoing');
+  const _encodingSet = Symbol('_encodingSet');
+  const _bufferOutput = Symbol('_bufferOutput');
+  const _encodingMutable = Symbol('_encodingMutable');
+  const _encoding = Symbol('_encoding');
+  const _isConnectionClosed = Symbol('_isConnectionClosed');
+  const _doneCompleter = Symbol('_doneCompleter');
+  const _target$ = Symbol('_target');
+  const _controllerInstance = Symbol('_controllerInstance');
+  const _controllerCompleter = Symbol('_controllerCompleter');
+  const _isClosed$0 = Symbol('_isClosed');
+  const _isBound = Symbol('_isBound');
+  const _hasError$ = Symbol('_hasError');
+  const _closeTarget = Symbol('_closeTarget');
+  const _completeDoneValue = Symbol('_completeDoneValue');
+  const _completeDoneError = Symbol('_completeDoneError');
+  io._StreamSinkImpl$ = dart.generic(T => {
+    let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
+    let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
+    let StreamSinkOfT = () => (StreamSinkOfT = dart.constFn(async.StreamSink$(T)))();
+    let StreamConsumerOfT = () => (StreamConsumerOfT = dart.constFn(async.StreamConsumer$(T)))();
+    class _StreamSinkImpl extends core.Object {
+      new(target) {
+        this[_doneCompleter] = async.Completer.new();
+        this[_target$] = target;
+        this[_controllerInstance] = null;
+        this[_controllerCompleter] = null;
+        this[_isClosed$0] = false;
+        this[_isBound] = false;
+        this[_hasError$] = false;
+      }
+      add(data) {
+        T._check(data);
+        if (dart.test(this[_isClosed$0])) return;
+        this[_controller$0].add(data);
+      }
+      addError(error, stackTrace) {
+        if (stackTrace === void 0) stackTrace = null;
+        this[_controller$0].addError(error, stackTrace);
+      }
+      addStream(stream) {
+        StreamOfT()._check(stream);
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is already bound to a stream"));
+        }
+        this[_isBound] = true;
+        if (dart.test(this[_hasError$])) return this.done;
+        const targetAddStream = (function() {
+          return this[_target$].addStream(stream).whenComplete(dart.fn(() => {
+            this[_isBound] = false;
+          }, VoidToNull()));
+        }).bind(this);
+        dart.fn(targetAddStream, VoidToFuture());
+        if (this[_controllerInstance] == null) return targetAddStream();
+        let future = this[_controllerCompleter].future;
+        this[_controllerInstance].close();
+        return future.then(dart.dynamic)(dart.fn(_ => targetAddStream(), dynamicToFuture()));
+      }
+      flush() {
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is bound to a stream"));
+        }
+        if (this[_controllerInstance] == null) return async.Future.value(this);
+        this[_isBound] = true;
+        let future = this[_controllerCompleter].future;
+        this[_controllerInstance].close();
+        return future.whenComplete(dart.fn(() => {
+          this[_isBound] = false;
+        }, VoidToNull()));
+      }
+      close() {
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is bound to a stream"));
+        }
+        if (!dart.test(this[_isClosed$0])) {
+          this[_isClosed$0] = true;
+          if (this[_controllerInstance] != null) {
+            this[_controllerInstance].close();
+          } else {
+            this[_closeTarget]();
+          }
+        }
+        return this.done;
+      }
+      [_closeTarget]() {
+        this[_target$].close().then(dart.void)(dart.bind(this, _completeDoneValue), {onError: dart.bind(this, _completeDoneError)});
+      }
+      get done() {
+        return this[_doneCompleter].future;
+      }
+      [_completeDoneValue](value) {
+        if (!dart.test(this[_doneCompleter].isCompleted)) {
+          this[_doneCompleter].complete(value);
+        }
+      }
+      [_completeDoneError](error, stackTrace) {
+        if (!dart.test(this[_doneCompleter].isCompleted)) {
+          this[_hasError$] = true;
+          this[_doneCompleter].completeError(error, stackTrace);
+        }
+      }
+      get [_controller$0]() {
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is bound to a stream"));
+        }
+        if (dart.test(this[_isClosed$0])) {
+          dart.throw(new core.StateError("StreamSink is closed"));
+        }
+        if (this[_controllerInstance] == null) {
+          this[_controllerInstance] = StreamControllerOfT().new({sync: true});
+          this[_controllerCompleter] = async.Completer.new();
+          this[_target$].addStream(this[_controller$0].stream).then(dart.dynamic)(dart.fn(_ => {
+            if (dart.test(this[_isBound])) {
+              this[_controllerCompleter].complete(this);
+              this[_controllerCompleter] = null;
+              this[_controllerInstance] = null;
+            } else {
+              this[_closeTarget]();
+            }
+          }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
+              if (dart.test(this[_isBound])) {
+                this[_controllerCompleter].completeError(error, core.StackTrace._check(stackTrace));
+                this[_controllerCompleter] = null;
+                this[_controllerInstance] = null;
+              } else {
+                this[_completeDoneError](error, core.StackTrace._check(stackTrace));
+              }
+            }, dynamicAnddynamicToNull())});
+        }
+        return this[_controllerInstance];
+      }
+    }
+    dart.addTypeTests(_StreamSinkImpl);
+    _StreamSinkImpl[dart.implements] = () => [StreamSinkOfT()];
+    dart.setSignature(_StreamSinkImpl, {
+      constructors: () => ({new: dart.definiteFunctionType(io._StreamSinkImpl$(T), [StreamConsumerOfT()])}),
+      fields: () => ({
+        [_target$]: StreamConsumerOfT(),
+        [_doneCompleter]: async.Completer,
+        [_controllerInstance]: StreamControllerOfT(),
+        [_controllerCompleter]: async.Completer,
+        [_isClosed$0]: core.bool,
+        [_isBound]: core.bool,
+        [_hasError$]: core.bool
+      }),
+      getters: () => ({
+        done: dart.definiteFunctionType(async.Future, []),
+        [_controller$0]: dart.definiteFunctionType(async.StreamController$(T), [])
+      }),
+      methods: () => ({
+        add: dart.definiteFunctionType(dart.void, [T]),
+        addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+        addStream: dart.definiteFunctionType(async.Future, [StreamOfT()]),
+        flush: dart.definiteFunctionType(async.Future, []),
+        close: dart.definiteFunctionType(async.Future, []),
+        [_closeTarget]: dart.definiteFunctionType(dart.void, []),
+        [_completeDoneValue]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+        [_completeDoneError]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])
+      })
+    });
+    return _StreamSinkImpl;
+  });
+  io._StreamSinkImpl = _StreamSinkImpl();
+  io._IOSinkImpl = class _IOSinkImpl extends io._StreamSinkImpl$(core.List$(core.int)) {
+    new(target, encoding) {
+      this[_encoding] = encoding;
+      this[_encodingMutable] = true;
+      super.new(target);
+    }
+    get encoding() {
+      return this[_encoding];
+    }
+    set encoding(value) {
+      if (!dart.test(this[_encodingMutable])) {
+        dart.throw(new core.StateError("IOSink encoding is not mutable"));
+      }
+      this[_encoding] = value;
+    }
+    write(obj) {
+      let string = dart.str`${obj}`;
+      if (dart.test(string[dartx.isEmpty])) return;
+      this.add(this[_encoding].encode(string));
+    }
+    writeAll(objects, separator) {
+      if (separator === void 0) separator = "";
+      let iterator = objects[dartx.iterator];
+      if (!dart.test(iterator.moveNext())) return;
+      if (dart.test(separator[dartx.isEmpty])) {
+        do {
+          this.write(iterator.current);
+        } while (dart.test(iterator.moveNext()));
+      } else {
+        this.write(iterator.current);
+        while (dart.test(iterator.moveNext())) {
+          this.write(separator);
+          this.write(iterator.current);
+        }
+      }
+    }
+    writeln(object) {
+      if (object === void 0) object = "";
+      this.write(object);
+      this.write("\n");
+    }
+    writeCharCode(charCode) {
+      this.write(core.String.fromCharCode(charCode));
+    }
+  };
+  dart.addSimpleTypeTests(io._IOSinkImpl);
+  io._IOSinkImpl[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io._IOSinkImpl, {
+    constructors: () => ({new: dart.definiteFunctionType(io._IOSinkImpl, [StreamConsumerOfListOfint(), convert.Encoding])}),
+    fields: () => ({
+      [_encoding]: convert.Encoding,
+      [_encodingMutable]: core.bool
+    }),
+    getters: () => ({encoding: dart.definiteFunctionType(convert.Encoding, [])}),
+    setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+    methods: () => ({
+      write: dart.definiteFunctionType(dart.void, [core.Object]),
+      writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+      writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+      writeCharCode: dart.definiteFunctionType(dart.void, [core.int])
+    })
+  });
+  io._HttpOutboundMessage$ = dart.generic(T => {
+    class _HttpOutboundMessage extends io._IOSinkImpl {
+      new(uri, protocolVersion, outgoing, opts) {
+        let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
+        this[_uri] = uri;
+        this.headers = new io._HttpHeaders(protocolVersion, {defaultPortForScheme: uri.scheme == 'https' ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT, initialHeaders: initialHeaders});
+        this[_outgoing] = outgoing;
+        this[_encodingSet] = false;
+        this[_bufferOutput] = true;
+        super.new(outgoing, null);
+        this[_outgoing].outbound = this;
+        this[_encodingMutable] = false;
+      }
+      get contentLength() {
+        return this.headers.contentLength;
+      }
+      set contentLength(contentLength) {
+        this.headers.contentLength = contentLength;
+      }
+      get persistentConnection() {
+        return this.headers.persistentConnection;
+      }
+      set persistentConnection(p) {
+        this.headers.persistentConnection = p;
+      }
+      get bufferOutput() {
+        return this[_bufferOutput];
+      }
+      set bufferOutput(bufferOutput) {
+        if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+        this[_bufferOutput] = bufferOutput;
+      }
+      get encoding() {
+        if (dart.test(this[_encodingSet]) && dart.test(this[_outgoing].headersWritten)) {
+          return this[_encoding];
+        }
+        let charset = null;
+        if (this.headers.contentType != null && this.headers.contentType.charset != null) {
+          charset = this.headers.contentType.charset;
+        } else {
+          charset = "iso-8859-1";
+        }
+        return convert.Encoding.getByName(core.String._check(charset));
+      }
+      set encoding(value) {
+        super.encoding = value;
+      }
+      add(data) {
+        if (data[dartx.length] == 0) return;
+        super.add(data);
+      }
+      write(obj) {
+        if (!dart.test(this[_encodingSet])) {
+          this[_encoding] = this.encoding;
+          this[_encodingSet] = true;
+        }
+        super.write(obj);
+      }
+      get [_isConnectionClosed]() {
+        return false;
+      }
+    }
+    dart.addTypeTests(_HttpOutboundMessage);
+    dart.setSignature(_HttpOutboundMessage, {
+      constructors: () => ({new: dart.definiteFunctionType(io._HttpOutboundMessage$(T), [core.Uri, core.String, io._HttpOutgoing], {initialHeaders: io._HttpHeaders})}),
+      fields: () => ({
+        [_encodingSet]: core.bool,
+        [_bufferOutput]: core.bool,
+        [_uri]: core.Uri,
+        [_outgoing]: io._HttpOutgoing,
+        headers: io._HttpHeaders
+      }),
+      getters: () => ({
+        contentLength: dart.definiteFunctionType(core.int, []),
+        persistentConnection: dart.definiteFunctionType(core.bool, []),
+        bufferOutput: dart.definiteFunctionType(core.bool, []),
+        [_isConnectionClosed]: dart.definiteFunctionType(core.bool, [])
+      }),
+      setters: () => ({
+        contentLength: dart.definiteFunctionType(dart.void, [core.int]),
+        persistentConnection: dart.definiteFunctionType(dart.void, [core.bool]),
+        bufferOutput: dart.definiteFunctionType(dart.void, [core.bool])
+      })
+    });
+    return _HttpOutboundMessage;
+  });
+  io._HttpOutboundMessage = _HttpOutboundMessage();
+  const _statusCode = Symbol('_statusCode');
+  const _reasonPhrase = Symbol('_reasonPhrase');
+  const _deadline = Symbol('_deadline');
+  const _deadlineTimer = Symbol('_deadlineTimer');
+  const _isClosing = Symbol('_isClosing');
+  const _findReasonPhrase = Symbol('_findReasonPhrase');
+  const _isNew = Symbol('_isNew');
+  const _writeHeader = Symbol('_writeHeader');
+  io._HttpResponse = class _HttpResponse extends io._HttpOutboundMessage$(io.HttpResponse) {
+    new(uri, protocolVersion, outgoing, defaultHeaders, serverHeader) {
+      this[_statusCode] = 200;
+      this[_reasonPhrase] = null;
+      this[_cookies] = null;
+      this[_httpRequest] = null;
+      this[_deadline] = null;
+      this[_deadlineTimer] = null;
+      super.new(uri, protocolVersion, outgoing, {initialHeaders: io._HttpHeaders._check(defaultHeaders)});
+      if (serverHeader != null) this.headers.set('server', serverHeader);
+    }
+    get [_isConnectionClosed]() {
+      return this[_httpRequest][_httpConnection][_isClosing];
+    }
+    get cookies() {
+      if (this[_cookies] == null) this[_cookies] = ListOfCookie().new();
+      return this[_cookies];
+    }
+    get statusCode() {
+      return this[_statusCode];
+    }
+    set statusCode(statusCode) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this[_statusCode] = statusCode;
+    }
+    get reasonPhrase() {
+      return this[_findReasonPhrase](this.statusCode);
+    }
+    set reasonPhrase(reasonPhrase) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this[_reasonPhrase] = reasonPhrase;
+    }
+    redirect(location, opts) {
+      let status = opts && 'status' in opts ? opts.status : io.HttpStatus.MOVED_TEMPORARILY;
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this.statusCode = status;
+      this.headers.set("location", dart.toString(location));
+      return this.close();
+    }
+    detachSocket(opts) {
+      let writeHeaders = opts && 'writeHeaders' in opts ? opts.writeHeaders : true;
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Headers already sent"));
+      this.deadline = null;
+      let future = this[_httpRequest][_httpConnection].detachSocket();
+      if (dart.test(writeHeaders)) {
+        let headersFuture = this[_outgoing].writeHeaders({drainRequest: false, setOutgoing: false});
+        dart.assert(headersFuture == null);
+      } else {
+        this[_outgoing].headersWritten = true;
+      }
+      this.close();
+      this.done.catchError(dart.fn(_ => {
+      }, dynamicToNull$()));
+      return future;
+    }
+    get connectionInfo() {
+      return this[_httpRequest].connectionInfo;
+    }
+    get deadline() {
+      return this[_deadline];
+    }
+    set deadline(d) {
+      if (this[_deadlineTimer] != null) this[_deadlineTimer].cancel();
+      this[_deadline] = d;
+      if (this[_deadline] == null) return;
+      this[_deadlineTimer] = async.Timer.new(this[_deadline], dart.fn(() => {
+        this[_httpRequest][_httpConnection].destroy();
+      }, VoidToNull()));
+    }
+    [_writeHeader]() {
+      let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+      let offset = 0;
+      function write(bytes) {
+        let len = bytes[dartx.length];
+        for (let i = 0; i < dart.notNull(len); i++) {
+          buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+        }
+        offset = dart.notNull(offset) + dart.notNull(len);
+      }
+      dart.fn(write, ListOfintTovoid$());
+      if (this.headers.protocolVersion == "1.1") {
+        write(io._Const.HTTP11);
+      } else {
+        write(io._Const.HTTP10);
+      }
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(dart.toString(this.statusCode)[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(this.reasonPhrase[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      let session = this[_httpRequest][_session];
+      if (session != null && !dart.test(session[_destroyed])) {
+        session[_isNew] = false;
+        let found = false;
+        for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
+          if (this.cookies[dartx._get](i).name[dartx.toUpperCase]() == io._DART_SESSION_ID) {
+            let _ = this.cookies[dartx._get](i);
+            _.value = session.id;
+            _.httpOnly = true;
+            _.path = "/";
+            found = true;
+          }
+        }
+        if (!found) {
+          let cookie = io.Cookie.new(io._DART_SESSION_ID, session.id);
+          this.cookies[dartx.add](((() => {
+            cookie.httpOnly = true;
+            cookie.path = "/";
+            return cookie;
+          })()));
+        }
+      }
+      if (this[_cookies] != null) {
+        this[_cookies][dartx.forEach](dart.fn(cookie => {
+          this.headers.add(io.HttpHeaders.SET_COOKIE, cookie);
+        }, CookieToNull()));
+      }
+      this.headers[_finalize]();
+      offset = this.headers[_write](buffer, offset);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      this[_outgoing].setHeader(buffer, offset);
+    }
+    [_findReasonPhrase](statusCode) {
+      if (this[_reasonPhrase] != null) {
+        return this[_reasonPhrase];
+      }
+      switch (statusCode) {
+        case io.HttpStatus.CONTINUE:
+        {
+          return "Continue";
+        }
+        case io.HttpStatus.SWITCHING_PROTOCOLS:
+        {
+          return "Switching Protocols";
+        }
+        case io.HttpStatus.OK:
+        {
+          return "OK";
+        }
+        case io.HttpStatus.CREATED:
+        {
+          return "Created";
+        }
+        case io.HttpStatus.ACCEPTED:
+        {
+          return "Accepted";
+        }
+        case io.HttpStatus.NON_AUTHORITATIVE_INFORMATION:
+        {
+          return "Non-Authoritative Information";
+        }
+        case io.HttpStatus.NO_CONTENT:
+        {
+          return "No Content";
+        }
+        case io.HttpStatus.RESET_CONTENT:
+        {
+          return "Reset Content";
+        }
+        case io.HttpStatus.PARTIAL_CONTENT:
+        {
+          return "Partial Content";
+        }
+        case io.HttpStatus.MULTIPLE_CHOICES:
+        {
+          return "Multiple Choices";
+        }
+        case io.HttpStatus.MOVED_PERMANENTLY:
+        {
+          return "Moved Permanently";
+        }
+        case io.HttpStatus.FOUND:
+        {
+          return "Found";
+        }
+        case io.HttpStatus.SEE_OTHER:
+        {
+          return "See Other";
+        }
+        case io.HttpStatus.NOT_MODIFIED:
+        {
+          return "Not Modified";
+        }
+        case io.HttpStatus.USE_PROXY:
+        {
+          return "Use Proxy";
+        }
+        case io.HttpStatus.TEMPORARY_REDIRECT:
+        {
+          return "Temporary Redirect";
+        }
+        case io.HttpStatus.BAD_REQUEST:
+        {
+          return "Bad Request";
+        }
+        case io.HttpStatus.UNAUTHORIZED:
+        {
+          return "Unauthorized";
+        }
+        case io.HttpStatus.PAYMENT_REQUIRED:
+        {
+          return "Payment Required";
+        }
+        case io.HttpStatus.FORBIDDEN:
+        {
+          return "Forbidden";
+        }
+        case io.HttpStatus.NOT_FOUND:
+        {
+          return "Not Found";
+        }
+        case io.HttpStatus.METHOD_NOT_ALLOWED:
+        {
+          return "Method Not Allowed";
+        }
+        case io.HttpStatus.NOT_ACCEPTABLE:
+        {
+          return "Not Acceptable";
+        }
+        case io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED:
+        {
+          return "Proxy Authentication Required";
+        }
+        case io.HttpStatus.REQUEST_TIMEOUT:
+        {
+          return "Request Time-out";
+        }
+        case io.HttpStatus.CONFLICT:
+        {
+          return "Conflict";
+        }
+        case io.HttpStatus.GONE:
+        {
+          return "Gone";
+        }
+        case io.HttpStatus.LENGTH_REQUIRED:
+        {
+          return "Length Required";
+        }
+        case io.HttpStatus.PRECONDITION_FAILED:
+        {
+          return "Precondition Failed";
+        }
+        case io.HttpStatus.REQUEST_ENTITY_TOO_LARGE:
+        {
+          return "Request Entity Too Large";
+        }
+        case io.HttpStatus.REQUEST_URI_TOO_LONG:
+        {
+          return "Request-URI Too Large";
+        }
+        case io.HttpStatus.UNSUPPORTED_MEDIA_TYPE:
+        {
+          return "Unsupported Media Type";
+        }
+        case io.HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE:
+        {
+          return "Requested range not satisfiable";
+        }
+        case io.HttpStatus.EXPECTATION_FAILED:
+        {
+          return "Expectation Failed";
+        }
+        case io.HttpStatus.INTERNAL_SERVER_ERROR:
+        {
+          return "Internal Server Error";
+        }
+        case io.HttpStatus.NOT_IMPLEMENTED:
+        {
+          return "Not Implemented";
+        }
+        case io.HttpStatus.BAD_GATEWAY:
+        {
+          return "Bad Gateway";
+        }
+        case io.HttpStatus.SERVICE_UNAVAILABLE:
+        {
+          return "Service Unavailable";
+        }
+        case io.HttpStatus.GATEWAY_TIMEOUT:
+        {
+          return "Gateway Time-out";
+        }
+        case io.HttpStatus.HTTP_VERSION_NOT_SUPPORTED:
+        {
+          return "Http Version not supported";
+        }
+        default:
+        {
+          return dart.str`Status ${statusCode}`;
+        }
+      }
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpResponse);
+  io._HttpResponse[dart.implements] = () => [io.HttpResponse];
+  dart.setSignature(io._HttpResponse, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpResponse, [core.Uri, core.String, io._HttpOutgoing, io.HttpHeaders, core.String])}),
+    fields: () => ({
+      [_statusCode]: core.int,
+      [_reasonPhrase]: core.String,
+      [_cookies]: ListOfCookie(),
+      [_httpRequest]: io._HttpRequest,
+      [_deadline]: core.Duration,
+      [_deadlineTimer]: async.Timer
+    }),
+    getters: () => ({
+      cookies: dart.definiteFunctionType(core.List$(io.Cookie), []),
+      statusCode: dart.definiteFunctionType(core.int, []),
+      reasonPhrase: dart.definiteFunctionType(core.String, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      deadline: dart.definiteFunctionType(core.Duration, [])
+    }),
+    setters: () => ({
+      statusCode: dart.definiteFunctionType(dart.void, [core.int]),
+      reasonPhrase: dart.definiteFunctionType(dart.void, [core.String]),
+      deadline: dart.definiteFunctionType(dart.void, [core.Duration])
+    }),
+    methods: () => ({
+      redirect: dart.definiteFunctionType(async.Future, [core.Uri], {status: core.int}),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), [], {writeHeaders: core.bool}),
+      [_writeHeader]: dart.definiteFunctionType(dart.void, []),
+      [_findReasonPhrase]: dart.definiteFunctionType(core.String, [core.int])
+    })
+  });
+  const _responseCompleter = Symbol('_responseCompleter');
+  const _response = Symbol('_response');
+  const _followRedirects = Symbol('_followRedirects');
+  const _maxRedirects = Symbol('_maxRedirects');
+  const _onIncoming = Symbol('_onIncoming');
+  const _onError$ = Symbol('_onError');
+  const _proxyTunnel = Symbol('_proxyTunnel');
+  const _requestUri = Symbol('_requestUri');
+  io._HttpClientRequest = class _HttpClientRequest extends io._HttpOutboundMessage$(io.HttpClientResponse) {
+    new(outgoing, uri, method, proxy, httpClient, httpClientConnection) {
+      this.cookies = ListOfCookie().new();
+      this[_responseCompleter] = CompleterOfHttpClientResponse().new();
+      this[_responseRedirects] = JSArrayOfRedirectInfo().of([]);
+      this.method = method;
+      this[_proxy] = proxy;
+      this[_httpClient] = httpClient;
+      this[_httpClientConnection] = httpClientConnection;
+      this.uri = uri;
+      this[_response] = null;
+      this[_followRedirects] = true;
+      this[_maxRedirects] = 5;
+      super.new(uri, "1.1", outgoing);
+      if (this.method == "GET" || this.method == "HEAD") {
+        this.contentLength = 0;
+      } else {
+        this.headers.chunkedTransferEncoding = true;
+      }
+    }
+    get done() {
+      if (this[_response] == null) {
+        this[_response] = async.Future.wait(dart.dynamic)(JSArrayOfFuture().of([this[_responseCompleter].future, super.done]), {eagerError: true}).then(io.HttpClientResponse)(dart.fn(list => FutureOrOfHttpClientResponse()._check(list[dartx._get](0)), ListToFutureOrOfHttpClientResponse()));
+      }
+      return this[_response];
+    }
+    close() {
+      super.close();
+      return this.done;
+    }
+    get maxRedirects() {
+      return this[_maxRedirects];
+    }
+    set maxRedirects(maxRedirects) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Request already sent"));
+      this[_maxRedirects] = maxRedirects;
+    }
+    get followRedirects() {
+      return this[_followRedirects];
+    }
+    set followRedirects(followRedirects) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Request already sent"));
+      this[_followRedirects] = followRedirects;
+    }
+    get connectionInfo() {
+      return this[_httpClientConnection].connectionInfo;
+    }
+    [_onIncoming](incoming) {
+      let response = new io._HttpClientResponse(incoming, this, this[_httpClient]);
+      let future = null;
+      if (dart.test(this.followRedirects) && dart.test(response.isRedirect)) {
+        if (dart.notNull(response.redirects[dartx.length]) < dart.notNull(this.maxRedirects)) {
+          future = response.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => response.redirect(), dynamicToFutureOfHttpClientResponse()));
+        } else {
+          future = response.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => FutureOfHttpClientResponse().error(new io.RedirectException("Redirect limit exceeded", response.redirects)), dynamicToFutureOfHttpClientResponse()));
+        }
+      } else if (dart.test(response[_shouldAuthenticateProxy])) {
+        future = response[_authenticate](true);
+      } else if (dart.test(response[_shouldAuthenticate])) {
+        future = response[_authenticate](false);
+      } else {
+        future = FutureOfHttpClientResponse().value(response);
+      }
+      future.then(dart.void)(dart.fn(v => this[_responseCompleter].complete(v), HttpClientResponseTovoid()), {onError: dart.bind(this[_responseCompleter], 'completeError')});
+    }
+    [_onError$](error, stackTrace) {
+      this[_responseCompleter].completeError(error, stackTrace);
+    }
+    [_requestUri]() {
+      const uriStartingFromPath = (function() {
+        let result = this.uri.path;
+        if (dart.test(result[dartx.isEmpty])) result = "/";
+        if (dart.test(this.uri.hasQuery)) {
+          result = dart.str`${result}?${this.uri.query}`;
+        }
+        return result;
+      }).bind(this);
+      dart.fn(uriStartingFromPath, VoidToString$());
+      if (dart.test(this[_proxy].isDirect)) {
+        return uriStartingFromPath();
+      } else {
+        if (this.method == "CONNECT") {
+          return dart.str`${this.uri.host}:${this.uri.port}`;
+        } else {
+          if (dart.test(this[_httpClientConnection][_proxyTunnel])) {
+            return uriStartingFromPath();
+          } else {
+            return dart.toString(this.uri.removeFragment());
+          }
+        }
+      }
+    }
+    [_writeHeader]() {
+      let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+      let offset = 0;
+      function write(bytes) {
+        let len = bytes[dartx.length];
+        for (let i = 0; i < dart.notNull(len); i++) {
+          buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+        }
+        offset = dart.notNull(offset) + dart.notNull(len);
+      }
+      dart.fn(write, ListOfintTovoid$());
+      write(this.method[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(this[_requestUri]()[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(io._Const.HTTP11);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      if (!dart.test(this.cookies[dartx.isEmpty])) {
+        let sb = new core.StringBuffer();
+        for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
+          if (i > 0) sb.write("; ");
+          sb.write(this.cookies[dartx._get](i).name);
+          sb.write("=");
+          sb.write(this.cookies[dartx._get](i).value);
+        }
+        this.headers.add(io.HttpHeaders.COOKIE, sb.toString());
+      }
+      this.headers[_finalize]();
+      offset = this.headers[_write](buffer, offset);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      this[_outgoing].setHeader(buffer, offset);
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpClientRequest);
+  io._HttpClientRequest[dart.implements] = () => [io.HttpClientRequest];
+  dart.setSignature(io._HttpClientRequest, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientRequest, [io._HttpOutgoing, core.Uri, core.String, io._Proxy, io._HttpClient, io._HttpClientConnection])}),
+    fields: () => ({
+      method: core.String,
+      uri: core.Uri,
+      cookies: ListOfCookie(),
+      [_httpClient]: io._HttpClient,
+      [_httpClientConnection]: io._HttpClientConnection,
+      [_responseCompleter]: CompleterOfHttpClientResponse(),
+      [_proxy]: io._Proxy,
+      [_response]: FutureOfHttpClientResponse(),
+      [_followRedirects]: core.bool,
+      [_maxRedirects]: core.int,
+      [_responseRedirects]: ListOfRedirectInfo()
+    }),
+    getters: () => ({
+      done: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), []),
+      maxRedirects: dart.definiteFunctionType(core.int, []),
+      followRedirects: dart.definiteFunctionType(core.bool, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])
+    }),
+    setters: () => ({
+      maxRedirects: dart.definiteFunctionType(dart.void, [core.int]),
+      followRedirects: dart.definiteFunctionType(dart.void, [core.bool])
+    }),
+    methods: () => ({
+      close: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), []),
+      [_onIncoming]: dart.definiteFunctionType(dart.void, [io._HttpIncoming]),
+      [_onError$]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
+      [_requestUri]: dart.definiteFunctionType(core.String, []),
+      [_writeHeader]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _consume = Symbol('_consume');
+  io._HttpGZipSink = class _HttpGZipSink extends convert.ByteConversionSink {
+    new(consume) {
+      this[_consume] = consume;
+      super.new();
+    }
+    add(chunk) {
+      dart.dcall(this[_consume], chunk);
+    }
+    addSlice(chunk, start, end, isLast) {
+      if (typed_data.Uint8List.is(chunk)) {
+        dart.dcall(this[_consume], typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+      } else {
+        dart.dcall(this[_consume], chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
+      }
+    }
+    close() {}
+  };
+  dart.setSignature(io._HttpGZipSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpGZipSink, [core.Function])}),
+    fields: () => ({[_consume]: core.Function}),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+      close: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _closeFuture = Symbol('_closeFuture');
+  const _pendingChunkedFooter = Symbol('_pendingChunkedFooter');
+  const _bytesWritten = Symbol('_bytesWritten');
+  const _gzip = Symbol('_gzip');
+  const _gzipSink = Symbol('_gzipSink');
+  const _gzipAdd = Symbol('_gzipAdd');
+  const _gzipBuffer = Symbol('_gzipBuffer');
+  const _gzipBufferLength = Symbol('_gzipBufferLength');
+  const _socketError = Symbol('_socketError');
+  const _addGZipChunk = Symbol('_addGZipChunk');
+  const _addChunk$ = Symbol('_addChunk');
+  const _chunkHeader = Symbol('_chunkHeader');
+  const _ignoreError = Symbol('_ignoreError');
+  let const$68;
+  io._HttpOutgoing = class _HttpOutgoing extends core.Object {
+    new(socket) {
+      this[_doneCompleter] = async.Completer.new();
+      this.socket = socket;
+      this.ignoreBody = false;
+      this.headersWritten = false;
+      this[_buffer$] = null;
+      this[_length$2] = 0;
+      this[_closeFuture] = null;
+      this.chunked = false;
+      this[_pendingChunkedFooter] = 0;
+      this.contentLength = null;
+      this[_bytesWritten] = 0;
+      this[_gzip] = false;
+      this[_gzipSink] = null;
+      this[_gzipAdd] = null;
+      this[_gzipBuffer] = null;
+      this[_gzipBufferLength] = 0;
+      this[_socketError] = false;
+      this.outbound = null;
+    }
+    writeHeaders(opts) {
+      let drainRequest = opts && 'drainRequest' in opts ? opts.drainRequest : true;
+      let setOutgoing = opts && 'setOutgoing' in opts ? opts.setOutgoing : true;
+      const write = (function() {
+        try {
+          this.outbound[_writeHeader]();
+        } catch (_) {
+          return async.Future.error(new io.HttpException(dart.str`Headers size exceeded the of '${io._OUTGOING_BUFFER_SIZE}'` + " bytes"));
+        }
+
+        return null;
+      }).bind(this);
+      dart.fn(write, VoidToFuture());
+      if (dart.test(this.headersWritten)) return null;
+      this.headersWritten = true;
+      let drainFuture = null;
+      let gzip = false;
+      if (io._HttpResponse.is(this.outbound)) {
+        let response = io._HttpResponse._check(this.outbound);
+        if (dart.test(response[_httpRequest][_httpServer].autoCompress) && dart.test(this.outbound.bufferOutput) && dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+          let acceptEncodings = response[_httpRequest].headers._get(io.HttpHeaders.ACCEPT_ENCODING);
+          let contentEncoding = this.outbound.headers._get(io.HttpHeaders.CONTENT_ENCODING);
+          if (acceptEncodings != null && dart.test(acceptEncodings[dartx.expand](dart.dynamic)(dart.fn(list => core.Iterable._check(dart.dsend(list, 'split', ",")), dynamicToIterable()))[dartx.any](dart.fn(encoding => dart.equals(dart.dsend(dart.dsend(encoding, 'trim'), 'toLowerCase'), "gzip"), dynamicTobool$()))) && contentEncoding == null) {
+            this.outbound.headers.set(io.HttpHeaders.CONTENT_ENCODING, "gzip");
+            gzip = true;
+          }
+        }
+        if (dart.test(drainRequest) && !dart.test(response[_httpRequest][_incoming].hasSubscriber)) {
+          drainFuture = response[_httpRequest].drain(dart.dynamic)().catchError(dart.fn(_ => {
+          }, dynamicToNull$()));
+        }
+      } else {
+        drainRequest = false;
+      }
+      if (dart.test(this.ignoreBody)) {
+        return write();
+      }
+      if (dart.test(setOutgoing)) {
+        let contentLength = this.outbound.headers.contentLength;
+        if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+          this.chunked = true;
+          if (gzip) this.gzip = true;
+        } else if (dart.notNull(contentLength) >= 0) {
+          this.contentLength = contentLength;
+        }
+      }
+      if (drainFuture != null) {
+        return drainFuture.then(dart.dynamic)(dart.fn(_ => write(), dynamicToFuture()));
+      }
+      return write();
+    }
+    addStream(stream) {
+      if (dart.test(this[_socketError])) {
+        stream.listen(null).cancel();
+        return async.Future.value(this.outbound);
+      }
+      if (dart.test(this.ignoreBody)) {
+        stream.drain(dart.dynamic)().catchError(dart.fn(_ => {
+        }, dynamicToNull$()));
+        let future = this.writeHeaders();
+        if (future != null) {
+          return future.then(dart.dynamic)(dart.fn(_ => this.close(), dynamicToFuture()));
+        }
+        return this.close();
+      }
+      let sub = null;
+      let controller = async.StreamController.new({onPause: dart.fn(() => dart.dsend(sub, 'pause'), VoidTovoid$()), onResume: dart.fn(() => dart.dsend(sub, 'resume'), VoidTovoid$()), sync: true});
+      const onData = (function(data) {
+        if (dart.test(this[_socketError])) return;
+        if (dart.equals(dart.dload(data, 'length'), 0)) return;
+        if (dart.test(this.chunked)) {
+          if (dart.test(this[_gzip])) {
+            this[_gzipAdd] = dart.bind(controller, 'add');
+            this[_addGZipChunk](data, dart.bind(this[_gzipSink], 'add'));
+            this[_gzipAdd] = null;
+            return;
+          }
+          this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), dart.bind(controller, 'add'));
+          this[_pendingChunkedFooter] = 2;
+        } else {
+          if (this.contentLength != null) {
+            this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(core.num._check(dart.dload(data, 'length')));
+            if (dart.notNull(this[_bytesWritten]) > dart.notNull(this.contentLength)) {
+              controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(IterableOfint()._check(data))}]`));
+              return;
+            }
+          }
+        }
+        this[_addChunk$](data, dart.bind(controller, 'add'));
+      }).bind(this);
+      dart.fn(onData, dynamicTovoid$());
+      sub = stream.listen(onData, {onError: dart.bind(controller, 'addError'), onDone: dart.bind(controller, 'close'), cancelOnError: true});
+      if (!dart.test(this.headersWritten)) {
+        let future = this.writeHeaders();
+        if (future != null) {
+          dart.dsend(sub, 'pause', future);
+        }
+      }
+      return this.socket.addStream(StreamOfListOfint()._check(controller.stream)).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+          if (dart.test(this[_gzip])) this[_gzipSink].close();
+          this[_socketError] = true;
+          this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
+          if (dart.test(this[_ignoreError](error))) {
+            return this.outbound;
+          } else {
+            dart.throw(error);
+          }
+        }, dynamicAnddynamicTo_HttpOutboundMessage())});
+    }
+    close() {
+      if (this[_closeFuture] != null) return this[_closeFuture];
+      if (dart.test(this[_socketError])) return async.Future.value(this.outbound);
+      if (dart.test(this.outbound[_isConnectionClosed])) return async.Future.value(this.outbound);
+      if (!dart.test(this.headersWritten) && !dart.test(this.ignoreBody)) {
+        if (this.outbound.headers.contentLength == -1) {
+          this.outbound.headers.chunkedTransferEncoding = false;
+          this.outbound.headers.contentLength = 0;
+        } else if (dart.notNull(this.outbound.headers.contentLength) > 0) {
+          let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri]});
+          this[_doneCompleter].completeError(error);
+          return this[_closeFuture] = async.Future.error(error);
+        }
+      }
+      if (this.contentLength != null) {
+        if (dart.notNull(this[_bytesWritten]) < dart.notNull(this.contentLength)) {
+          let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri]});
+          this[_doneCompleter].completeError(error);
+          return this[_closeFuture] = async.Future.error(error);
+        }
+      }
+      const finalize = (function() {
+        if (dart.test(this.chunked)) {
+          if (dart.test(this[_gzip])) {
+            this[_gzipAdd] = dart.bind(this.socket, 'add');
+            if (dart.notNull(this[_gzipBufferLength]) > 0) {
+              this[_gzipSink].add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
+            }
+            this[_gzipBuffer] = null;
+            this[_gzipSink].close();
+            this[_gzipAdd] = null;
+          }
+          this[_addChunk$](this[_chunkHeader](0), dart.bind(this.socket, 'add'));
+        }
+        if (dart.notNull(this[_length$2]) > 0) {
+          this.socket.add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+        }
+        this[_buffer$] = null;
+        return this.socket.flush().then(io._HttpOutboundMessage)(dart.fn(_ => {
+          this[_doneCompleter].complete(this.socket);
+          return this.outbound;
+        }, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+            this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
+            if (dart.test(this[_ignoreError](error))) {
+              return this.outbound;
+            } else {
+              dart.throw(error);
+            }
+          }, dynamicAnddynamicTo_HttpOutboundMessage())});
+      }).bind(this);
+      dart.fn(finalize, VoidToFuture());
+      let future = this.writeHeaders();
+      if (future != null) {
+        return this[_closeFuture] = future.whenComplete(finalize);
+      }
+      return this[_closeFuture] = finalize();
+    }
+    get done() {
+      return this[_doneCompleter].future;
+    }
+    setHeader(data, length) {
+      dart.assert(this[_length$2] == 0);
+      dart.assert(data[dartx.length] == io._OUTGOING_BUFFER_SIZE);
+      this[_buffer$] = typed_data.Uint8List._check(data);
+      this[_length$2] = length;
+    }
+    set gzip(value) {
+      this[_gzip] = value;
+      if (dart.test(this[_gzip])) {
+        this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+        dart.assert(this[_gzipSink] == null);
+        this[_gzipSink] = new io.ZLibEncoder({gzip: true}).startChunkedConversion(new io._HttpGZipSink(dart.fn(data => {
+          if (this[_gzipAdd] == null) return;
+          this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), ListOfintTovoid()._check(this[_gzipAdd]));
+          this[_pendingChunkedFooter] = 2;
+          this[_addChunk$](data, ListOfintTovoid()._check(this[_gzipAdd]));
+        }, dynamicToNull$())));
+      }
+    }
+    [_ignoreError](error) {
+      return (io.SocketException.is(error) || io.TlsException.is(error)) && io.HttpResponse.is(this.outbound);
+    }
+    [_addGZipChunk](chunk, add) {
+      if (!dart.test(this.outbound.bufferOutput)) {
+        add(ListOfint()._check(chunk));
+        return;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])))) {
+        add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
+        this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+        this[_gzipBufferLength] = 0;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
+        add(ListOfint()._check(chunk));
+      } else {
+        this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.asInt(dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
+        this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+      }
+    }
+    [_addChunk$](chunk, add) {
+      if (!dart.test(this.outbound.bufferOutput)) {
+        if (this[_buffer$] != null) {
+          add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+          this[_buffer$] = null;
+          this[_length$2] = 0;
+        }
+        add(ListOfint()._check(chunk));
+        return;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])))) {
+        add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+        this[_buffer$] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+        this[_length$2] = 0;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
+        add(ListOfint()._check(chunk));
+      } else {
+        this[_buffer$][dartx.setRange](this[_length$2], dart.asInt(dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
+        this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+      }
+    }
+    [_chunkHeader](length) {
+      let hexDigits = const$68 || (const$68 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
+      if (length == 0) {
+        if (this[_pendingChunkedFooter] == 2) return io._HttpOutgoing._footerAndChunk0Length;
+        return io._HttpOutgoing._chunk0Length;
+      }
+      let size = this[_pendingChunkedFooter];
+      let len = length;
+      while (dart.notNull(len) > 0) {
+        size = dart.notNull(size) + 1;
+        len = len[dartx['>>']](4);
+      }
+      let footerAndHeader = typed_data.Uint8List.new(dart.notNull(size) + 2);
+      if (this[_pendingChunkedFooter] == 2) {
+        footerAndHeader[dartx._set](0, io._CharCode.CR);
+        footerAndHeader[dartx._set](1, io._CharCode.LF);
+      }
+      let index = size;
+      while (dart.notNull(index) > dart.notNull(this[_pendingChunkedFooter])) {
+        footerAndHeader[dartx._set]((index = dart.notNull(index) - 1), hexDigits[dartx._get](dart.notNull(length) & 15));
+        length = length[dartx['>>']](4);
+      }
+      footerAndHeader[dartx._set](dart.notNull(size) + 0, io._CharCode.CR);
+      footerAndHeader[dartx._set](dart.notNull(size) + 1, io._CharCode.LF);
+      return footerAndHeader;
+    }
+  };
+  io._HttpOutgoing[dart.implements] = () => [StreamConsumerOfListOfint()];
+  dart.setSignature(io._HttpOutgoing, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpOutgoing, [io.Socket])}),
+    fields: () => ({
+      [_doneCompleter]: async.Completer,
+      socket: io.Socket,
+      ignoreBody: core.bool,
+      headersWritten: core.bool,
+      [_buffer$]: typed_data.Uint8List,
+      [_length$2]: core.int,
+      [_closeFuture]: async.Future,
+      chunked: core.bool,
+      [_pendingChunkedFooter]: core.int,
+      contentLength: core.int,
+      [_bytesWritten]: core.int,
+      [_gzip]: core.bool,
+      [_gzipSink]: convert.ByteConversionSink,
+      [_gzipAdd]: core.Function,
+      [_gzipBuffer]: typed_data.Uint8List,
+      [_gzipBufferLength]: core.int,
+      [_socketError]: core.bool,
+      outbound: io._HttpOutboundMessage
+    }),
+    getters: () => ({done: dart.definiteFunctionType(async.Future, [])}),
+    setters: () => ({gzip: dart.definiteFunctionType(dart.void, [core.bool])}),
+    methods: () => ({
+      writeHeaders: dart.definiteFunctionType(async.Future, [], {drainRequest: core.bool, setOutgoing: core.bool}),
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+      close: dart.definiteFunctionType(async.Future, []),
+      setHeader: dart.definiteFunctionType(dart.void, [ListOfint(), core.int]),
+      [_ignoreError]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+      [_addGZipChunk]: dart.definiteFunctionType(dart.void, [dart.dynamic, ListOfintTovoid()]),
+      [_addChunk$]: dart.definiteFunctionType(dart.void, [dart.dynamic, ListOfintTovoid()]),
+      [_chunkHeader]: dart.definiteFunctionType(core.List$(core.int), [core.int])
+    }),
+    sfields: () => ({
+      _footerAndChunk0Length: ListOfint(),
+      _chunk0Length: ListOfint()
+    })
+  });
+  dart.defineLazy(io._HttpOutgoing, {
+    get _footerAndChunk0Length() {
+      return dart.constList([io._CharCode.CR, io._CharCode.LF, 48, io._CharCode.CR, io._CharCode.LF, io._CharCode.CR, io._CharCode.LF], core.int);
+    },
+    get _chunk0Length() {
+      return dart.constList([48, io._CharCode.CR, io._CharCode.LF, io._CharCode.CR, io._CharCode.LF], core.int);
+    }
+  });
+  const _context = Symbol('_context');
+  const _httpParser = Symbol('_httpParser');
+  const _subscription$ = Symbol('_subscription');
+  const _dispose = Symbol('_dispose');
+  const _idleTimer = Symbol('_idleTimer');
+  const _currentUri = Symbol('_currentUri');
+  const _nextResponseCompleter = Symbol('_nextResponseCompleter');
+  const _streamFuture = Symbol('_streamFuture');
+  const _proxyCredentials = Symbol('_proxyCredentials');
+  const _returnConnection = Symbol('_returnConnection');
+  io._HttpClientConnection = class _HttpClientConnection extends core.Object {
+    new(key, socket, httpClient, proxyTunnel, context) {
+      if (proxyTunnel === void 0) proxyTunnel = false;
+      if (context === void 0) context = null;
+      this.key = key;
+      this[_socket] = socket;
+      this[_httpClient] = httpClient;
+      this[_proxyTunnel] = proxyTunnel;
+      this[_context] = context;
+      this[_httpParser] = io._HttpParser.responseParser();
+      this[_subscription$] = null;
+      this[_dispose] = false;
+      this[_idleTimer] = null;
+      this.closed = false;
+      this[_currentUri] = null;
+      this[_nextResponseCompleter] = null;
+      this[_streamFuture] = null;
+      this[_httpParser].listenToStream(this[_socket]);
+      this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
+        this[_subscription$].pause();
+        if (this[_nextResponseCompleter] == null) {
+          dart.throw(new io.HttpException("Unexpected response (unsolicited response without request).", {uri: this[_currentUri]}));
+        }
+        if (incoming.statusCode == 100) {
+          incoming.drain(dart.dynamic)().then(dart.dynamic)(dart.fn(_ => {
+            this[_subscription$].resume();
+          }, dynamicToNull$())).catchError(dart.fn((error, stackTrace) => {
+            if (stackTrace === void 0) stackTrace = null;
+            this[_nextResponseCompleter].completeError(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this[_currentUri]}), stackTrace);
+            this[_nextResponseCompleter] = null;
+          }, dynamic__ToNull$()));
+        } else {
+          this[_nextResponseCompleter].complete(incoming);
+          this[_nextResponseCompleter] = null;
+        }
+      }, _HttpIncomingToNull()), {onError: dart.fn((error, stackTrace) => {
+          if (stackTrace === void 0) stackTrace = null;
+          if (this[_nextResponseCompleter] != null) {
+            this[_nextResponseCompleter].completeError(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this[_currentUri]}), stackTrace);
+            this[_nextResponseCompleter] = null;
+          }
+        }, dynamic__ToNull$()), onDone: dart.fn(() => {
+          if (this[_nextResponseCompleter] != null) {
+            this[_nextResponseCompleter].completeError(new io.HttpException("Connection closed before response was received", {uri: this[_currentUri]}));
+            this[_nextResponseCompleter] = null;
+          }
+          this.close();
+        }, VoidToNull())});
+    }
+    send(uri, port, method, proxy) {
+      if (dart.test(this.closed)) {
+        dart.throw(new io.HttpException("Socket closed before request was sent", {uri: uri}));
+      }
+      this[_currentUri] = uri;
+      this[_subscription$].pause();
+      let proxyCreds = null;
+      let creds = null;
+      let outgoing = new io._HttpOutgoing(this[_socket]);
+      let request = new io._HttpClientRequest(outgoing, uri, method, proxy, this[_httpClient], this);
+      let host = uri.host;
+      if (dart.test(host[dartx.contains](':'))) host = dart.str`[${host}]`;
+      request.headers.host = host;
+      request.headers.port = port;
+      request.headers[_add$2](io.HttpHeaders.ACCEPT_ENCODING, "gzip");
+      if (this[_httpClient].userAgent != null) {
+        request.headers[_add$2]('user-agent', this[_httpClient].userAgent);
+      }
+      if (dart.test(proxy.isAuthenticated)) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${proxy.username}:${proxy.password}`));
+        request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
+      } else if (!dart.test(proxy.isDirect) && dart.notNull(this[_httpClient][_proxyCredentials][dartx.length]) > 0) {
+        proxyCreds = this[_httpClient][_findProxyCredentials](proxy);
+        if (proxyCreds != null) {
+          proxyCreds.authorize(request);
+        }
+      }
+      if (uri.userInfo != null && !dart.test(uri.userInfo[dartx.isEmpty])) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(uri.userInfo));
+        request.headers.set(io.HttpHeaders.AUTHORIZATION, dart.str`Basic ${auth}`);
+      } else {
+        creds = this[_httpClient][_findCredentials](uri);
+        if (creds != null) {
+          creds.authorize(request);
+        }
+      }
+      this[_httpParser].isHead = method == "HEAD";
+      this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(s => {
+        this[_nextResponseCompleter] = CompleterOf_HttpIncoming().new();
+        this[_nextResponseCompleter].future.then(dart.dynamic)(dart.fn(incoming => {
+          this[_currentUri] = null;
+          incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
+            if (dart.test(incoming.upgraded)) {
+              this[_httpClient][_connectionClosed](this);
+              this.startTimer();
+              return;
+            }
+            if (dart.test(this.closed)) return;
+            if (!dart.test(closing) && !dart.test(this[_dispose]) && dart.test(incoming.headers.persistentConnection) && dart.test(request.persistentConnection)) {
+              this[_httpClient][_returnConnection](this);
+              this[_subscription$].resume();
+            } else {
+              this.destroy();
+            }
+          }, dynamicToNull$()));
+          if (proxyCreds != null && dart.equals(proxyCreds.scheme, io._AuthenticationScheme.DIGEST)) {
+            let authInfo = incoming.headers._get("proxy-authentication-info");
+            if (authInfo != null && authInfo[dartx.length] == 1) {
+              let header = io._HeaderValue.parse(authInfo[dartx._get](0), {parameterSeparator: ','});
+              let nextnonce = header.parameters[dartx._get]("nextnonce");
+              if (nextnonce != null) proxyCreds.nonce = nextnonce;
+            }
+          }
+          if (creds != null && dart.equals(creds.scheme, io._AuthenticationScheme.DIGEST)) {
+            let authInfo = incoming.headers._get("authentication-info");
+            if (authInfo != null && authInfo[dartx.length] == 1) {
+              let header = io._HeaderValue.parse(authInfo[dartx._get](0), {parameterSeparator: ','});
+              let nextnonce = header.parameters[dartx._get]("nextnonce");
+              if (nextnonce != null) creds.nonce = nextnonce;
+            }
+          }
+          request[_onIncoming](incoming);
+        }, _HttpIncomingToNull())).catchError(dart.fn(error => {
+          dart.throw(new io.HttpException("Connection closed before data was received", {uri: uri}));
+        }, dynamicToNull$()), {test: dart.fn(error => core.StateError.is(error), ObjectTobool())}).catchError(dart.fn((error, stackTrace) => {
+          this.destroy();
+          request[_onError$](error, core.StackTrace._check(stackTrace));
+        }, dynamicAnddynamicToNull()));
+        this[_subscription$].resume();
+        return s;
+      }, dynamicTodynamic$()), {onError: dart.fn(e => {
+          this.destroy();
+        }, dynamicToNull$())});
+      return request;
+    }
+    detachSocket() {
+      return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), dynamicTo_DetachedSocket()));
+    }
+    destroy() {
+      this.closed = true;
+      this[_httpClient][_connectionClosed](this);
+      this[_socket].destroy();
+    }
+    close() {
+      this.closed = true;
+      this[_httpClient][_connectionClosed](this);
+      this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), dynamicTovoid$()));
+    }
+    createProxyTunnel(host, port, proxy, callback) {
+      let request = this.send(core.Uri.new({host: core.String._check(host), port: core.int._check(port)}), core.int._check(port), "CONNECT", io._Proxy._check(proxy));
+      if (dart.test(dart.dload(proxy, 'isAuthenticated'))) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${dart.dload(proxy, 'username')}:${dart.dload(proxy, 'password')}`));
+        request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
+      }
+      return request.close().then(io.SecureSocket)(dart.fn(response => {
+        if (response.statusCode != io.HttpStatus.OK) {
+          dart.throw("Proxy failed to establish tunnel " + dart.str`(${response.statusCode} ${response.reasonPhrase})`);
+        }
+        let socket = io._HttpClientResponse.as(response)[_httpRequest][_httpClientConnection][_socket];
+        return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: X509CertificateTobool()._check(callback)});
+      }, HttpClientResponseToFutureOfSecureSocket())).then(io._HttpClientConnection)(dart.fn(secureSocket => {
+        let key = core.String._check(io._HttpClientConnection.makeKey(true, core.String._check(host), core.int._check(port)));
+        return new io._HttpClientConnection(key, secureSocket, request[_httpClient], true);
+      }, SecureSocketTo_HttpClientConnection()));
+    }
+    get connectionInfo() {
+      return io._HttpConnectionInfo.create(this[_socket]);
+    }
+    static makeKey(isSecure, host, port) {
+      return dart.test(isSecure) ? dart.str`ssh:${host}:${port}` : dart.str`${host}:${port}`;
+    }
+    stopTimer() {
+      if (this[_idleTimer] != null) {
+        this[_idleTimer].cancel();
+        this[_idleTimer] = null;
+      }
+    }
+    startTimer() {
+      dart.assert(this[_idleTimer] == null);
+      this[_idleTimer] = async.Timer.new(this[_httpClient].idleTimeout, dart.fn(() => {
+        this[_idleTimer] = null;
+        this.close();
+      }, VoidToNull()));
+    }
+  };
+  dart.setSignature(io._HttpClientConnection, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientConnection, [core.String, io.Socket, io._HttpClient], [core.bool, io.SecurityContext])}),
+    fields: () => ({
+      key: core.String,
+      [_socket]: io.Socket,
+      [_proxyTunnel]: core.bool,
+      [_context]: io.SecurityContext,
+      [_httpParser]: io._HttpParser,
+      [_subscription$]: async.StreamSubscription,
+      [_httpClient]: io._HttpClient,
+      [_dispose]: core.bool,
+      [_idleTimer]: async.Timer,
+      closed: core.bool,
+      [_currentUri]: core.Uri,
+      [_nextResponseCompleter]: CompleterOf_HttpIncoming(),
+      [_streamFuture]: async.Future
+    }),
+    getters: () => ({connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])}),
+    methods: () => ({
+      send: dart.definiteFunctionType(io._HttpClientRequest, [core.Uri, core.int, core.String, io._Proxy]),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      destroy: dart.definiteFunctionType(dart.void, []),
+      close: dart.definiteFunctionType(dart.void, []),
+      createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]),
+      stopTimer: dart.definiteFunctionType(dart.void, []),
+      startTimer: dart.definiteFunctionType(dart.void, [])
+    }),
+    statics: () => ({makeKey: dart.definiteFunctionType(dart.dynamic, [core.bool, core.String, core.int])}),
+    names: ['makeKey']
+  });
+  io._ConnectionInfo = class _ConnectionInfo extends core.Object {
+    new(connection, proxy) {
+      this.connection = connection;
+      this.proxy = proxy;
+    }
+  };
+  dart.setSignature(io._ConnectionInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ConnectionInfo, [io._HttpClientConnection, io._Proxy])}),
+    fields: () => ({
+      connection: io._HttpClientConnection,
+      proxy: io._Proxy
+    })
+  });
+  const _idle = Symbol('_idle');
+  const _active = Symbol('_active');
+  const _pending$ = Symbol('_pending');
+  const _connecting = Symbol('_connecting');
+  const _checkPending = Symbol('_checkPending');
+  const _connectionsChanged = Symbol('_connectionsChanged');
+  const _badCertificateCallback = Symbol('_badCertificateCallback');
+  const _getConnectionTarget = Symbol('_getConnectionTarget');
+  io._ConnectionTarget = class _ConnectionTarget extends core.Object {
+    new(key, host, port, isSecure, context) {
+      this[_idle] = HashSetOf_HttpClientConnection().new();
+      this[_active] = HashSetOf_HttpClientConnection().new();
+      this[_pending$] = new collection.ListQueue();
+      this.key = key;
+      this.host = host;
+      this.port = port;
+      this.isSecure = isSecure;
+      this.context = context;
+      this[_connecting] = 0;
+    }
+    get isEmpty() {
+      return dart.test(this[_idle].isEmpty) && dart.test(this[_active].isEmpty) && this[_connecting] == 0;
+    }
+    get hasIdle() {
+      return this[_idle].isNotEmpty;
+    }
+    get hasActive() {
+      return dart.test(this[_active].isNotEmpty) || dart.notNull(this[_connecting]) > 0;
+    }
+    takeIdle() {
+      dart.assert(this.hasIdle);
+      let connection = this[_idle].first;
+      this[_idle].remove(connection);
+      connection.stopTimer();
+      this[_active].add(connection);
+      return connection;
+    }
+    [_checkPending]() {
+      if (dart.test(this[_pending$].isNotEmpty)) {
+        dart.dcall(this[_pending$].removeFirst());
+      }
+    }
+    addNewActive(connection) {
+      this[_active].add(connection);
+    }
+    returnConnection(connection) {
+      dart.assert(this[_active].contains(connection));
+      this[_active].remove(connection);
+      this[_idle].add(connection);
+      connection.startTimer();
+      this[_checkPending]();
+    }
+    connectionClosed(connection) {
+      dart.assert(!dart.test(this[_active].contains(connection)) || !dart.test(this[_idle].contains(connection)));
+      this[_active].remove(connection);
+      this[_idle].remove(connection);
+      this[_checkPending]();
+    }
+    close(force) {
+      for (let c of this[_idle].toList()) {
+        c.close();
+      }
+      if (dart.test(force)) {
+        for (let c of this[_active].toList()) {
+          c.destroy();
+        }
+      }
+    }
+    connect(uriHost, uriPort, proxy, client) {
+      if (dart.test(this.hasIdle)) {
+        let connection = this.takeIdle();
+        client[_connectionsChanged]();
+        return FutureOf_ConnectionInfo().value(new io._ConnectionInfo(connection, proxy));
+      }
+      if (client.maxConnectionsPerHost != null && dart.notNull(this[_active].length) + dart.notNull(this[_connecting]) >= dart.notNull(client.maxConnectionsPerHost)) {
+        let completer = async.Completer.new();
+        this[_pending$].add(dart.fn(() => {
+          this.connect(uriHost, uriPort, proxy, client).then(dart.void)(dart.bind(completer, 'complete'), {onError: dart.bind(completer, 'completeError')});
+        }, VoidToNull()));
+        return FutureOf_ConnectionInfo()._check(completer.future);
+      }
+      let currentBadCertificateCallback = client[_badCertificateCallback];
+      function callback(certificate) {
+        if (currentBadCertificateCallback == null) return false;
+        return currentBadCertificateCallback(certificate, uriHost, uriPort);
+      }
+      dart.fn(callback, X509CertificateTobool$());
+      let socketFuture = dart.test(this.isSecure) && dart.test(proxy.isDirect) ? io.SecureSocket.connect(this.host, this.port, {context: this.context, onBadCertificate: callback}) : io.Socket.connect(this.host, this.port);
+      this[_connecting] = dart.notNull(this[_connecting]) + 1;
+      return socketFuture.then(io._ConnectionInfo)(dart.fn(socket => {
+        this[_connecting] = dart.notNull(this[_connecting]) - 1;
+        dart.dsend(socket, 'setOption', io.SocketOption.TCP_NODELAY, true);
+        let connection = new io._HttpClientConnection(this.key, io.Socket._check(socket), client, false, this.context);
+        if (dart.test(this.isSecure) && !dart.test(proxy.isDirect)) {
+          connection[_dispose] = true;
+          return connection.createProxyTunnel(uriHost, uriPort, proxy, callback).then(io._ConnectionInfo)(dart.fn(tunnel => {
+            client[_getConnectionTarget](uriHost, uriPort, true).addNewActive(tunnel);
+            return new io._ConnectionInfo(tunnel, proxy);
+          }, _HttpClientConnectionTo_ConnectionInfo()));
+        } else {
+          this.addNewActive(connection);
+          return new io._ConnectionInfo(connection, proxy);
+        }
+      }, dynamicToFutureOrOf_ConnectionInfo()), {onError: dart.fn(error => {
+          this[_connecting] = dart.notNull(this[_connecting]) - 1;
+          this[_checkPending]();
+          dart.throw(error);
+        }, dynamicToNull$())});
+    }
+  };
+  dart.setSignature(io._ConnectionTarget, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ConnectionTarget, [core.String, core.String, core.int, core.bool, io.SecurityContext])}),
+    fields: () => ({
+      key: core.String,
+      host: core.String,
+      port: core.int,
+      isSecure: core.bool,
+      context: io.SecurityContext,
+      [_idle]: SetOf_HttpClientConnection(),
+      [_active]: SetOf_HttpClientConnection(),
+      [_pending$]: collection.Queue,
+      [_connecting]: core.int
+    }),
+    getters: () => ({
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      hasIdle: dart.definiteFunctionType(core.bool, []),
+      hasActive: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      takeIdle: dart.definiteFunctionType(io._HttpClientConnection, []),
+      [_checkPending]: dart.definiteFunctionType(dart.dynamic, []),
+      addNewActive: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      returnConnection: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      connectionClosed: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      close: dart.definiteFunctionType(dart.void, [core.bool]),
+      connect: dart.definiteFunctionType(async.Future$(io._ConnectionInfo), [core.String, core.int, io._Proxy, io._HttpClient])
+    })
+  });
+  io.BadCertificateCallback = dart.typedef('BadCertificateCallback', () => dart.functionType(core.bool, [io.X509Certificate, core.String, core.int]));
+  const _idleTimeout = Symbol('_idleTimeout');
+  let const$69;
+  const _connectionTargets = Symbol('_connectionTargets');
+  const _credentials = Symbol('_credentials');
+  const _closing = Symbol('_closing');
+  const _closingForcefully = Symbol('_closingForcefully');
+  const _findProxy = Symbol('_findProxy');
+  const _openUrl = Symbol('_openUrl');
+  const _closeConnections = Symbol('_closeConnections');
+  let const$70;
+  const _getConnection = Symbol('_getConnection');
+  io._HttpClient = class _HttpClient extends core.Object {
+    get idleTimeout() {
+      return this[_idleTimeout];
+    }
+    new(context) {
+      this[_connectionTargets] = HashMapOfString$_ConnectionTarget().new();
+      this[_credentials] = JSArrayOf_Credentials().of([]);
+      this[_proxyCredentials] = JSArrayOf_ProxyCredentials().of([]);
+      this.userAgent = io._getHttpVersion();
+      this[_context] = context;
+      this[_closing] = false;
+      this[_closingForcefully] = false;
+      this[_authenticate] = null;
+      this[_authenticateProxy] = null;
+      this[_findProxy] = io.HttpClient.findProxyFromEnvironment;
+      this[_idleTimeout] = const$69 || (const$69 = dart.const(new core.Duration({seconds: 15})));
+      this[_badCertificateCallback] = null;
+      this.maxConnectionsPerHost = null;
+      this.autoUncompress = true;
+    }
+    set idleTimeout(timeout) {
+      this[_idleTimeout] = timeout;
+      for (let c of this[_connectionTargets][dartx.values]) {
+        for (let idle of c[_idle]) {
+          idle.stopTimer();
+          idle.startTimer();
+        }
+      }
+    }
+    set badCertificateCallback(callback) {
+      this[_badCertificateCallback] = callback;
+    }
+    open(method, host, port, path) {
+      let hashMark = 35;
+      let questionMark = 63;
+      let fragmentStart = path[dartx.length];
+      let queryStart = path[dartx.length];
+      for (let i = dart.notNull(path[dartx.length]) - 1; i >= 0; i--) {
+        let char = path[dartx.codeUnitAt](i);
+        if (char == hashMark) {
+          fragmentStart = i;
+          queryStart = i;
+        } else if (char == questionMark) {
+          queryStart = i;
+        }
+      }
+      let query = null;
+      if (dart.notNull(queryStart) < dart.notNull(fragmentStart)) {
+        query = path[dartx.substring](dart.notNull(queryStart) + 1, fragmentStart);
+        path = path[dartx.substring](0, queryStart);
+      }
+      let uri = core.Uri.new({scheme: "http", host: host, port: port, path: path, query: query});
+      return this[_openUrl](method, uri);
+    }
+    openUrl(method, url) {
+      return this[_openUrl](method, url);
+    }
+    get(host, port, path) {
+      return this.open("get", host, port, path);
+    }
+    getUrl(url) {
+      return this[_openUrl]("get", url);
+    }
+    post(host, port, path) {
+      return this.open("post", host, port, path);
+    }
+    postUrl(url) {
+      return this[_openUrl]("post", url);
+    }
+    put(host, port, path) {
+      return this.open("put", host, port, path);
+    }
+    putUrl(url) {
+      return this[_openUrl]("put", url);
+    }
+    delete(host, port, path) {
+      return this.open("delete", host, port, path);
+    }
+    deleteUrl(url) {
+      return this[_openUrl]("delete", url);
+    }
+    head(host, port, path) {
+      return this.open("head", host, port, path);
+    }
+    headUrl(url) {
+      return this[_openUrl]("head", url);
+    }
+    patch(host, port, path) {
+      return this.open("patch", host, port, path);
+    }
+    patchUrl(url) {
+      return this[_openUrl]("patch", url);
+    }
+    close(opts) {
+      let force = opts && 'force' in opts ? opts.force : false;
+      this[_closing] = true;
+      this[_closingForcefully] = force;
+      this[_closeConnections](this[_closingForcefully]);
+      dart.assert(!dart.test(this[_connectionTargets][dartx.values][dartx.any](dart.fn(s => s.hasIdle, _ConnectionTargetTobool()))));
+      dart.assert(!dart.test(force) || !dart.test(this[_connectionTargets][dartx.values][dartx.any](dart.fn(s => s[_active].isNotEmpty, _ConnectionTargetTobool()))));
+    }
+    set authenticate(f) {
+      this[_authenticate] = f;
+    }
+    addCredentials(url, realm, cr) {
+      this[_credentials][dartx.add](new io._SiteCredentials(url, realm, io._HttpClientCredentials._check(cr)));
+    }
+    set authenticateProxy(f) {
+      this[_authenticateProxy] = f;
+    }
+    addProxyCredentials(host, port, realm, cr) {
+      this[_proxyCredentials][dartx.add](new io._ProxyCredentials(host, port, realm, io._HttpClientCredentials._check(cr)));
+    }
+    set findProxy(f) {
+      return this[_findProxy] = f;
+    }
+    [_openUrl](method, uri) {
+      uri = uri.removeFragment();
+      if (method == null) {
+        dart.throw(new core.ArgumentError(method));
+      }
+      if (method != "CONNECT") {
+        if (dart.test(uri.host[dartx.isEmpty])) {
+          dart.throw(new core.ArgumentError(dart.str`No host specified in URI ${uri}`));
+        } else if (uri.scheme != "http" && uri.scheme != "https") {
+          dart.throw(new core.ArgumentError(dart.str`Unsupported scheme '${uri.scheme}' in URI ${uri}`));
+        }
+      }
+      let isSecure = uri.scheme == "https";
+      let port = uri.port;
+      if (port == 0) {
+        port = isSecure ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT;
+      }
+      let proxyConf = const$70 || (const$70 = dart.const(new io._ProxyConfiguration.direct()));
+      if (this[_findProxy] != null) {
+        try {
+          proxyConf = new io._ProxyConfiguration(core.String._check(dart.dcall(this[_findProxy], uri)));
+        } catch (error) {
+          let stackTrace = dart.stackTrace(error);
+          return FutureOf_HttpClientRequest().error(error, stackTrace);
+        }
+
+      }
+      return this[_getConnection](uri.host, port, proxyConf, isSecure).then(io._HttpClientRequest)(dart.fn(info => {
+        function send(info) {
+          return info.connection.send(uri, port, method[dartx.toUpperCase](), info.proxy);
+        }
+        dart.fn(send, _ConnectionInfoTo_HttpClientRequest());
+        if (dart.test(info.connection.closed)) {
+          return this[_getConnection](uri.host, port, proxyConf, isSecure).then(io._HttpClientRequest)(send);
+        }
+        return send(info);
+      }, _ConnectionInfoToFutureOrOf_HttpClientRequest()));
+    }
+    [_openUrlFromRequest](method, uri, previous) {
+      let resolved = previous.uri.resolveUri(uri);
+      return this[_openUrl](method, resolved).then(io._HttpClientRequest)(dart.fn(request => {
+        request.followRedirects = previous.followRedirects;
+        request.maxRedirects = previous.maxRedirects;
+        for (let header of previous.headers[_headers][dartx.keys]) {
+          if (request.headers._get(header) == null) {
+            request.headers.set(header, previous.headers._get(header));
+          }
+        }
+        request.headers.chunkedTransferEncoding = false;
+        request.contentLength = 0;
+        return request;
+      }, _HttpClientRequestTo_HttpClientRequest()));
+    }
+    [_returnConnection](connection) {
+      this[_connectionTargets][dartx._get](connection.key).returnConnection(connection);
+      this[_connectionsChanged]();
+    }
+    [_connectionClosed](connection) {
+      connection.stopTimer();
+      let connectionTarget = this[_connectionTargets][dartx._get](connection.key);
+      if (connectionTarget != null) {
+        connectionTarget.connectionClosed(connection);
+        if (dart.test(connectionTarget.isEmpty)) {
+          this[_connectionTargets][dartx.remove](connection.key);
+        }
+        this[_connectionsChanged]();
+      }
+    }
+    [_connectionsChanged]() {
+      if (dart.test(this[_closing])) {
+        this[_closeConnections](this[_closingForcefully]);
+      }
+    }
+    [_closeConnections](force) {
+      for (let connectionTarget of this[_connectionTargets][dartx.values][dartx.toList]()) {
+        connectionTarget.close(force);
+      }
+    }
+    [_getConnectionTarget](host, port, isSecure) {
+      let key = core.String._check(io._HttpClientConnection.makeKey(isSecure, host, port));
+      return this[_connectionTargets][dartx.putIfAbsent](key, dart.fn(() => new io._ConnectionTarget(key, host, port, isSecure, this[_context]), VoidTo_ConnectionTarget()));
+    }
+    [_getConnection](uriHost, uriPort, proxyConf, isSecure) {
+      let proxies = proxyConf.proxies[dartx.iterator];
+      const connect = (function(error) {
+        if (!dart.test(proxies.moveNext())) return FutureOf_ConnectionInfo().error(error);
+        let proxy = proxies.current;
+        let host = dart.test(proxy.isDirect) ? uriHost : proxy.host;
+        let port = dart.test(proxy.isDirect) ? uriPort : proxy.port;
+        return this[_getConnectionTarget](host, port, isSecure).connect(uriHost, uriPort, proxy, this).catchError(connect);
+      }).bind(this);
+      dart.fn(connect, dynamicToFutureOf_ConnectionInfo());
+      return FutureOf_ConnectionInfo().new(dart.fn(() => connect(new io.HttpException("No proxies given")), VoidToFutureOf_ConnectionInfo()));
+    }
+    [_findCredentials](url, scheme) {
+      if (scheme === void 0) scheme = null;
+      let cr = this[_credentials][dartx.fold](io._SiteCredentials)(null, dart.fn((prev, value) => {
+        let siteCredentials = io._SiteCredentials.as(value);
+        if (dart.test(siteCredentials.applies(url, scheme))) {
+          if (prev == null) return io._SiteCredentials._check(value);
+          return dart.notNull(siteCredentials.uri.path[dartx.length]) > dart.notNull(prev.uri.path[dartx.length]) ? siteCredentials : prev;
+        } else {
+          return prev;
+        }
+      }, _SiteCredentialsAnd_CredentialsTo_SiteCredentials()));
+      return cr;
+    }
+    [_findProxyCredentials](proxy, scheme) {
+      if (scheme === void 0) scheme = null;
+      let it = this[_proxyCredentials][dartx.iterator];
+      while (dart.test(it.moveNext())) {
+        if (dart.test(it.current.applies(proxy, scheme))) {
+          return it.current;
+        }
+      }
+      return null;
+    }
+    [_removeCredentials](cr) {
+      let index = this[_credentials][dartx.indexOf](cr);
+      if (index != -1) {
+        this[_credentials][dartx.removeAt](index);
+      }
+    }
+    [_removeProxyCredentials](cr) {
+      let index = this[_proxyCredentials][dartx.indexOf](io._ProxyCredentials._check(cr));
+      if (index != -1) {
+        this[_proxyCredentials][dartx.removeAt](index);
+      }
+    }
+    static _findProxyFromEnvironment(url, environment) {
+      function checkNoProxy(option) {
+        if (option == null) return null;
+        let names = option[dartx.split](",")[dartx.map](core.String)(dart.fn(s => s[dartx.trim](), StringToString$()))[dartx.iterator];
+        while (dart.test(names.moveNext())) {
+          let name = names.current;
+          if (dart.test(name[dartx.startsWith]("[")) && dart.test(name[dartx.endsWith]("]")) && dart.str`[${url.host}]` == name || dart.test(name[dartx.isNotEmpty]) && dart.test(url.host[dartx.endsWith](name))) {
+            return "DIRECT";
+          }
+        }
+        return null;
+      }
+      dart.fn(checkNoProxy, StringToString$());
+      function checkProxy(option) {
+        if (option == null) return null;
+        option = option[dartx.trim]();
+        if (dart.test(option[dartx.isEmpty])) return null;
+        let pos = option[dartx.indexOf]("://");
+        if (dart.notNull(pos) >= 0) {
+          option = option[dartx.substring](dart.notNull(pos) + 3);
+        }
+        pos = option[dartx.indexOf]("/");
+        if (dart.notNull(pos) >= 0) {
+          option = option[dartx.substring](0, pos);
+        }
+        if (option[dartx.indexOf]("[") == 0) {
+          let pos = option[dartx.lastIndexOf](":");
+          if (dart.notNull(option[dartx.indexOf]("]")) > dart.notNull(pos)) option = dart.str`${option}:1080`;
+        } else {
+          if (option[dartx.indexOf](":") == -1) option = dart.str`${option}:1080`;
+        }
+        return dart.str`PROXY ${option}`;
+      }
+      dart.fn(checkProxy, StringToString$());
+      if (environment == null) environment = io._HttpClient._platformEnvironmentCache;
+      let proxyCfg = null;
+      let noProxy = environment[dartx._get]("no_proxy");
+      if (noProxy == null) noProxy = environment[dartx._get]("NO_PROXY");
+      if ((proxyCfg = checkNoProxy(noProxy)) != null) {
+        return proxyCfg;
+      }
+      if (url.scheme == "http") {
+        let proxy = environment[dartx._get]("http_proxy");
+        if (proxy == null) proxy = environment[dartx._get]("HTTP_PROXY");
+        if ((proxyCfg = checkProxy(proxy)) != null) {
+          return proxyCfg;
+        }
+      } else if (url.scheme == "https") {
+        let proxy = environment[dartx._get]("https_proxy");
+        if (proxy == null) proxy = environment[dartx._get]("HTTPS_PROXY");
+        if ((proxyCfg = checkProxy(proxy)) != null) {
+          return proxyCfg;
+        }
+      }
+      return "DIRECT";
+    }
+  };
+  io._HttpClient[dart.implements] = () => [io.HttpClient];
+  dart.setSignature(io._HttpClient, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClient, [io.SecurityContext])}),
+    fields: () => ({
+      [_closing]: core.bool,
+      [_closingForcefully]: core.bool,
+      [_connectionTargets]: MapOfString$_ConnectionTarget(),
+      [_credentials]: ListOf_Credentials(),
+      [_proxyCredentials]: ListOf_ProxyCredentials(),
+      [_context]: io.SecurityContext,
+      [_authenticate]: core.Function,
+      [_authenticateProxy]: core.Function,
+      [_findProxy]: core.Function,
+      [_idleTimeout]: core.Duration,
+      [_badCertificateCallback]: io.BadCertificateCallback,
+      maxConnectionsPerHost: core.int,
+      autoUncompress: core.bool,
+      userAgent: core.String
+    }),
+    getters: () => ({idleTimeout: dart.definiteFunctionType(core.Duration, [])}),
+    setters: () => ({
+      idleTimeout: dart.definiteFunctionType(dart.void, [core.Duration]),
+      badCertificateCallback: dart.definiteFunctionType(dart.void, [X509CertificateAndStringAndintTobool()]),
+      authenticate: dart.definiteFunctionType(dart.void, [UriAndStringAndStringToFutureOfbool()]),
+      authenticateProxy: dart.definiteFunctionType(dart.void, [StringAndintAndString__ToFutureOfbool()]),
+      findProxy: dart.definiteFunctionType(dart.void, [UriToString()])
+    }),
+    methods: () => ({
+      open: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.String, core.int, core.String]),
+      openUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.Uri]),
+      get: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      getUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      post: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      postUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      put: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      putUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      delete: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      deleteUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      head: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      headUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      patch: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      patchUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      close: dart.definiteFunctionType(dart.void, [], {force: core.bool}),
+      addCredentials: dart.definiteFunctionType(dart.void, [core.Uri, core.String, io.HttpClientCredentials]),
+      addProxyCredentials: dart.definiteFunctionType(dart.void, [core.String, core.int, core.String, io.HttpClientCredentials]),
+      [_openUrl]: dart.definiteFunctionType(async.Future$(io._HttpClientRequest), [core.String, core.Uri]),
+      [_openUrlFromRequest]: dart.definiteFunctionType(async.Future$(io._HttpClientRequest), [core.String, core.Uri, io._HttpClientRequest]),
+      [_returnConnection]: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      [_connectionClosed]: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      [_connectionsChanged]: dart.definiteFunctionType(dart.void, []),
+      [_closeConnections]: dart.definiteFunctionType(dart.void, [core.bool]),
+      [_getConnectionTarget]: dart.definiteFunctionType(io._ConnectionTarget, [core.String, core.int, core.bool]),
+      [_getConnection]: dart.definiteFunctionType(async.Future$(io._ConnectionInfo), [core.String, core.int, io._ProxyConfiguration, core.bool]),
+      [_findCredentials]: dart.definiteFunctionType(io._SiteCredentials, [core.Uri], [io._AuthenticationScheme]),
+      [_findProxyCredentials]: dart.definiteFunctionType(io._ProxyCredentials, [io._Proxy], [io._AuthenticationScheme]),
+      [_removeCredentials]: dart.definiteFunctionType(dart.void, [io._Credentials]),
+      [_removeProxyCredentials]: dart.definiteFunctionType(dart.void, [io._Credentials])
+    }),
+    sfields: () => ({_platformEnvironmentCache: MapOfString$String()}),
+    statics: () => ({_findProxyFromEnvironment: dart.definiteFunctionType(core.String, [core.Uri, MapOfString$String()])}),
+    names: ['_findProxyFromEnvironment']
+  });
+  dart.defineLazy(io._HttpClient, {
+    get _platformEnvironmentCache() {
+      return io.Platform.environment;
+    },
+    set _platformEnvironmentCache(_) {}
+  });
+  const _state$1 = Symbol('_state');
+  const _idleMark = Symbol('_idleMark');
+  const _owner = Symbol('_owner');
+  const _serviceId = Symbol('_serviceId');
+  const _markActive = Symbol('_markActive');
+  const _markIdle = Symbol('_markIdle');
+  const _handleRequest = Symbol('_handleRequest');
+  const _isActive = Symbol('_isActive');
+  const _isIdle = Symbol('_isIdle');
+  const _isDetached = Symbol('_isDetached');
+  const _serviceTypePath = Symbol('_serviceTypePath');
+  const _serviceTypeName = Symbol('_serviceTypeName');
+  const _servicePath = Symbol('_servicePath');
+  const _serviceType = Symbol('_serviceType');
+  const _toJSON$ = Symbol('_toJSON');
+  const __serviceId = Symbol('__serviceId');
+  io._ServiceObject = class _ServiceObject extends core.Object {
+    new() {
+      this[__serviceId] = 0;
+    }
+    get [_serviceId]() {
+      if (this[__serviceId] == 0) this[__serviceId] = (() => {
+        let x = io._nextServiceId;
+        io._nextServiceId = dart.notNull(x) + 1;
+        return x;
+      })();
+      return this[__serviceId];
+    }
+    get [_servicePath]() {
+      return dart.str`${this[_serviceTypePath]}/${this[_serviceId]}`;
+    }
+    [_serviceType](ref) {
+      if (dart.test(ref)) return dart.str`@${this[_serviceTypeName]}`;
+      return this[_serviceTypeName];
+    }
+  };
+  dart.setSignature(io._ServiceObject, {
+    fields: () => ({[__serviceId]: core.int}),
+    getters: () => ({
+      [_serviceId]: dart.definiteFunctionType(core.int, []),
+      [_servicePath]: dart.definiteFunctionType(core.String, [])
+    }),
+    methods: () => ({[_serviceType]: dart.definiteFunctionType(core.String, [core.bool])})
+  });
+  io._HttpConnection = class _HttpConnection extends dart.mixin(collection.LinkedListEntry, io._ServiceObject) {
+    new(socket, httpServer) {
+      this[_socket] = socket;
+      this[_httpServer] = httpServer;
+      this[_httpParser] = io._HttpParser.requestParser();
+      this[_state$1] = io._HttpConnection._IDLE;
+      this[_subscription$] = null;
+      this[_idleMark] = false;
+      this[_streamFuture] = null;
+      super.new();
+      try {
+        dart.dput(this[_socket], _owner, this);
+      } catch (_) {
+        core.print(_);
+      }
+
+      io._HttpConnection._connections[dartx._set](this[_serviceId], this);
+      this[_httpParser].listenToStream(StreamOfListOfint()._check(this[_socket]));
+      this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
+        this[_httpServer][_markActive](this);
+        incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
+          if (dart.test(closing)) this.destroy();
+        }, dynamicToNull$()));
+        this[_subscription$].pause();
+        this[_state$1] = io._HttpConnection._ACTIVE;
+        let outgoing = new io._HttpOutgoing(io.Socket._check(this[_socket]));
+        let response = new io._HttpResponse(incoming.uri, incoming.headers.protocolVersion, outgoing, this[_httpServer].defaultResponseHeaders, this[_httpServer].serverHeader);
+        let request = new io._HttpRequest(response, incoming, this[_httpServer], this);
+        this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(_ => {
+          response.deadline = null;
+          if (this[_state$1] == io._HttpConnection._DETACHED) return;
+          if (dart.test(response.persistentConnection) && dart.test(request.persistentConnection) && dart.test(incoming.fullBodyRead) && !dart.test(this[_httpParser].upgrade) && !dart.test(this[_httpServer].closed)) {
+            this[_state$1] = io._HttpConnection._IDLE;
+            this[_idleMark] = false;
+            this[_httpServer][_markIdle](this);
+            this[_subscription$].resume();
+          } else {
+            this.destroy();
+          }
+        }, dynamicToNull$()), {onError: dart.fn(_ => {
+            this.destroy();
+          }, dynamicToNull$())});
+        outgoing.ignoreBody = request.method == "HEAD";
+        response[_httpRequest] = request;
+        this[_httpServer][_handleRequest](request);
+      }, _HttpIncomingToNull()), {onDone: dart.fn(() => {
+          this.destroy();
+        }, VoidToNull()), onError: dart.fn(error => {
+          this.destroy();
+        }, dynamicToNull$())});
+    }
+    markIdle() {
+      this[_idleMark] = true;
+    }
+    get isMarkedIdle() {
+      return this[_idleMark];
+    }
+    destroy() {
+      if (this[_state$1] == io._HttpConnection._CLOSING || this[_state$1] == io._HttpConnection._DETACHED) return;
+      this[_state$1] = io._HttpConnection._CLOSING;
+      dart.dsend(this[_socket], 'destroy');
+      this[_httpServer][_connectionClosed](this);
+      io._HttpConnection._connections[dartx.remove](this[_serviceId]);
+    }
+    detachSocket() {
+      this[_state$1] = io._HttpConnection._DETACHED;
+      this[_httpServer][_connectionClosed](this);
+      let detachedIncoming = this[_httpParser].detachIncoming();
+      return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => {
+        io._HttpConnection._connections[dartx.remove](this[_serviceId]);
+        return new io._DetachedSocket(this[_socket], detachedIncoming);
+      }, dynamicTo_DetachedSocket()));
+    }
+    get connectionInfo() {
+      return io._HttpConnectionInfo.create(io.Socket._check(this[_socket]));
+    }
+    get [_isActive]() {
+      return this[_state$1] == io._HttpConnection._ACTIVE;
+    }
+    get [_isIdle]() {
+      return this[_state$1] == io._HttpConnection._IDLE;
+    }
+    get [_isClosing]() {
+      return this[_state$1] == io._HttpConnection._CLOSING;
+    }
+    get [_isDetached]() {
+      return this[_state$1] == io._HttpConnection._DETACHED;
+    }
+    get [_serviceTypePath]() {
+      return 'io/http/serverconnections';
+    }
+    get [_serviceTypeName]() {
+      return 'HttpServerConnection';
+    }
+    [_toJSON$](ref) {
+      let name = dart.str`${dart.dload(dart.dload(this[_socket], 'address'), 'host')}:${dart.dload(this[_socket], 'port')} <-> ` + dart.str`${dart.dload(dart.dload(this[_socket], 'remoteAddress'), 'host')}:${dart.dload(this[_socket], 'remotePort')}`;
+      let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: name, user_name: name}, core.String, dart.dynamic);
+      if (dart.test(ref)) {
+        return r;
+      }
+      r[dartx._set]('server', this[_httpServer][_toJSON$](true));
+      try {
+        r[dartx._set]('socket', dart.dsend(this[_socket], _toJSON$, true));
+      } catch (_) {
+        r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+      }
+
+      switch (this[_state$1]) {
+        case io._HttpConnection._ACTIVE:
+        {
+          r[dartx._set]('state', "Active");
+          break;
+        }
+        case io._HttpConnection._IDLE:
+        {
+          r[dartx._set]('state', "Idle");
+          break;
+        }
+        case io._HttpConnection._CLOSING:
+        {
+          r[dartx._set]('state', "Closing");
+          break;
+        }
+        case io._HttpConnection._DETACHED:
+        {
+          r[dartx._set]('state', "Detached");
+          break;
+        }
+        default:
+        {
+          r[dartx._set]('state', 'Unknown');
+          break;
+        }
+      }
+      return r;
+    }
+  };
+  dart.setBaseClass(io._HttpConnection, dart.mixin(collection.LinkedListEntry$(io._HttpConnection), io._ServiceObject));
+  dart.addSimpleTypeTests(io._HttpConnection);
+  dart.setSignature(io._HttpConnection, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpConnection, [dart.dynamic, io._HttpServer])}),
+    fields: () => ({
+      [_socket]: dart.dynamic,
+      [_httpServer]: io._HttpServer,
+      [_httpParser]: io._HttpParser,
+      [_state$1]: core.int,
+      [_subscription$]: async.StreamSubscription,
+      [_idleMark]: core.bool,
+      [_streamFuture]: async.Future
+    }),
+    getters: () => ({
+      isMarkedIdle: dart.definiteFunctionType(core.bool, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      [_isActive]: dart.definiteFunctionType(core.bool, []),
+      [_isIdle]: dart.definiteFunctionType(core.bool, []),
+      [_isClosing]: dart.definiteFunctionType(core.bool, []),
+      [_isDetached]: dart.definiteFunctionType(core.bool, []),
+      [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+      [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+    }),
+    methods: () => ({
+      markIdle: dart.definiteFunctionType(dart.void, []),
+      destroy: dart.definiteFunctionType(dart.void, []),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      [_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
+    }),
+    sfields: () => ({
+      _ACTIVE: core.int,
+      _IDLE: core.int,
+      _CLOSING: core.int,
+      _DETACHED: core.int,
+      _connections: MapOfint$_HttpConnection()
+    })
+  });
+  io._HttpConnection._ACTIVE = 0;
+  io._HttpConnection._IDLE = 1;
+  io._HttpConnection._CLOSING = 2;
+  io._HttpConnection._DETACHED = 3;
+  dart.defineLazy(io._HttpConnection, {
+    get _connections() {
+      return HashMapOfint$_HttpConnection().new();
+    },
+    set _connections(_) {}
+  });
+  const _activeConnections = Symbol('_activeConnections');
+  const _idleConnections = Symbol('_idleConnections');
+  const _serverSocket = Symbol('_serverSocket');
+  const _closeServer = Symbol('_closeServer');
+  let const$71;
+  let const$72;
+  io._HttpServer = class _HttpServer extends dart.mixin(async.Stream$(io.HttpRequest), io._ServiceObject) {
+    static bind(address, port, backlog, v6Only, shared) {
+      return io.ServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), ServerSocketTo_HttpServer()));
+    }
+    static bindSecure(address, port, context, backlog, v6Only, requestClientCertificate, shared) {
+      return io.SecureServerSocket.bind(address, port, context, {backlog: backlog, v6Only: v6Only, requestClientCertificate: requestClientCertificate, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), SecureServerSocketTo_HttpServer()));
+    }
+    _(serverSocket, closeServer) {
+      this.defaultResponseHeaders = io._HttpServer._initDefaultResponseHeaders();
+      this[_activeConnections] = new (LinkedListOf_HttpConnection())();
+      this[_idleConnections] = new (LinkedListOf_HttpConnection())();
+      this[_serverSocket] = serverSocket;
+      this[_closeServer] = closeServer;
+      this.serverHeader = null;
+      this.autoCompress = false;
+      this[_idleTimeout] = null;
+      this[_idleTimer] = null;
+      this[_sessionManagerInstance] = null;
+      this.closed = false;
+      this[_controller$0] = null;
+      super.new();
+      this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
+      this.idleTimeout = const$71 || (const$71 = dart.const(new core.Duration({seconds: 120})));
+      io._HttpServer._servers[dartx._set](this[_serviceId], this);
+      dart.dput(this[_serverSocket], _owner, this);
+    }
+    listenOn(serverSocket) {
+      this.defaultResponseHeaders = io._HttpServer._initDefaultResponseHeaders();
+      this[_activeConnections] = new (LinkedListOf_HttpConnection())();
+      this[_idleConnections] = new (LinkedListOf_HttpConnection())();
+      this[_serverSocket] = serverSocket;
+      this[_closeServer] = false;
+      this.serverHeader = null;
+      this.autoCompress = false;
+      this[_idleTimeout] = null;
+      this[_idleTimer] = null;
+      this[_sessionManagerInstance] = null;
+      this.closed = false;
+      this[_controller$0] = null;
+      super.new();
+      this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
+      this.idleTimeout = const$72 || (const$72 = dart.const(new core.Duration({seconds: 120})));
+      io._HttpServer._servers[dartx._set](this[_serviceId], this);
+      try {
+        dart.dput(this[_serverSocket], _owner, this);
+      } catch (_) {
+      }
+
+    }
+    static _initDefaultResponseHeaders() {
+      let defaultResponseHeaders = new io._HttpHeaders('1.1');
+      defaultResponseHeaders.contentType = io.ContentType.TEXT;
+      defaultResponseHeaders.set('X-Frame-Options', 'SAMEORIGIN');
+      defaultResponseHeaders.set('X-Content-Type-Options', 'nosniff');
+      defaultResponseHeaders.set('X-XSS-Protection', '1; mode=block');
+      return defaultResponseHeaders;
+    }
+    get idleTimeout() {
+      return this[_idleTimeout];
+    }
+    set idleTimeout(duration) {
+      if (this[_idleTimer] != null) {
+        this[_idleTimer].cancel();
+        this[_idleTimer] = null;
+      }
+      this[_idleTimeout] = duration;
+      if (this[_idleTimeout] != null) {
+        this[_idleTimer] = async.Timer.periodic(this[_idleTimeout], dart.fn(_ => {
+          for (let idle of this[_idleConnections].toList()) {
+            if (dart.test(idle.isMarkedIdle)) {
+              idle.destroy();
+            } else {
+              idle.markIdle();
+            }
+          }
+        }, TimerToNull()));
+      }
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      dart.dsend(this[_serverSocket], 'listen', dart.fn(socket => {
+        socket.setOption(io.SocketOption.TCP_NODELAY, true);
+        let connection = new io._HttpConnection(socket, this);
+        this[_idleConnections].add(connection);
+      }, SocketToNull()), {onError: dart.fn((error, stackTrace) => {
+          if (!io.HandshakeException.is(error)) {
+            this[_controller$0].addError(error, core.StackTrace._check(stackTrace));
+          }
+        }, dynamicAnddynamicToNull()), onDone: dart.bind(this[_controller$0], 'close')});
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    close(opts) {
+      let force = opts && 'force' in opts ? opts.force : false;
+      this.closed = true;
+      let result = null;
+      if (this[_serverSocket] != null && dart.test(this[_closeServer])) {
+        result = async.Future._check(dart.dsend(this[_serverSocket], 'close'));
+      } else {
+        result = async.Future.value();
+      }
+      this.idleTimeout = null;
+      if (dart.test(force)) {
+        for (let c of this[_activeConnections].toList()) {
+          c.destroy();
+        }
+        dart.assert(this[_activeConnections].isEmpty);
+      }
+      for (let c of this[_idleConnections].toList()) {
+        c.destroy();
+      }
+      this[_maybePerformCleanup]();
+      return result;
+    }
+    [_maybePerformCleanup]() {
+      if (dart.test(this.closed) && dart.test(this[_idleConnections].isEmpty) && dart.test(this[_activeConnections].isEmpty) && this[_sessionManagerInstance] != null) {
+        this[_sessionManagerInstance].close();
+        this[_sessionManagerInstance] = null;
+        io._HttpServer._servers[dartx.remove](this[_serviceId]);
+      }
+    }
+    get port() {
+      if (dart.test(this.closed)) dart.throw(new io.HttpException("HttpServer is not bound to a socket"));
+      return core.int._check(dart.dload(this[_serverSocket], 'port'));
+    }
+    get address() {
+      if (dart.test(this.closed)) dart.throw(new io.HttpException("HttpServer is not bound to a socket"));
+      return io.InternetAddress._check(dart.dload(this[_serverSocket], 'address'));
+    }
+    set sessionTimeout(timeout) {
+      this[_sessionManager].sessionTimeout = timeout;
+    }
+    [_handleRequest](request) {
+      if (!dart.test(this.closed)) {
+        this[_controller$0].add(request);
+      } else {
+        request[_httpConnection].destroy();
+      }
+    }
+    [_connectionClosed](connection) {
+      connection.unlink();
+      this[_maybePerformCleanup]();
+    }
+    [_markIdle](connection) {
+      this[_activeConnections].remove(connection);
+      this[_idleConnections].add(connection);
+    }
+    [_markActive](connection) {
+      this[_idleConnections].remove(connection);
+      this[_activeConnections].add(connection);
+    }
+    get [_sessionManager]() {
+      if (this[_sessionManagerInstance] == null) {
+        this[_sessionManagerInstance] = new io._HttpSessionManager();
+      }
+      return this[_sessionManagerInstance];
+    }
+    connectionsInfo() {
+      let result = new io.HttpConnectionsInfo();
+      result.total = dart.notNull(this[_activeConnections].length) + dart.notNull(this[_idleConnections].length);
+      this[_activeConnections].forEach(dart.fn(conn => {
+        if (dart.test(conn[_isActive])) {
+          result.active = dart.notNull(result.active) + 1;
+        } else {
+          dart.assert(conn[_isClosing]);
+          result.closing = dart.notNull(result.closing) + 1;
+        }
+      }, _HttpConnectionToNull()));
+      this[_idleConnections].forEach(dart.fn(conn => {
+        result.idle = dart.notNull(result.idle) + 1;
+        dart.assert(conn[_isIdle]);
+      }, _HttpConnectionToNull()));
+      return result;
+    }
+    get [_serviceTypePath]() {
+      return 'io/http/servers';
+    }
+    get [_serviceTypeName]() {
+      return 'HttpServer';
+    }
+    [_toJSON$](ref) {
+      let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: dart.str`${this.address.host}:${this.port}`, user_name: dart.str`${this.address.host}:${this.port}`}, core.String, dart.dynamic);
+      if (dart.test(ref)) {
+        return r;
+      }
+      try {
+        r[dartx._set]('socket', dart.dsend(this[_serverSocket], _toJSON$, true));
+      } catch (_) {
+        r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+      }
+
+      r[dartx._set]('port', this.port);
+      r[dartx._set]('address', this.address.host);
+      r[dartx._set]('active', this[_activeConnections].map(core.Map)(dart.fn(c => c[_toJSON$](true), _HttpConnectionToMap()))[dartx.toList]());
+      r[dartx._set]('idle', this[_idleConnections].map(core.Map)(dart.fn(c => c[_toJSON$](true), _HttpConnectionToMap()))[dartx.toList]());
+      r[dartx._set]('closed', this.closed);
+      return r;
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpServer);
+  dart.defineNamedConstructor(io._HttpServer, '_');
+  dart.defineNamedConstructor(io._HttpServer, 'listenOn');
+  io._HttpServer[dart.implements] = () => [io.HttpServer];
+  dart.setSignature(io._HttpServer, {
+    constructors: () => ({
+      _: dart.definiteFunctionType(io._HttpServer, [dart.dynamic, core.bool]),
+      listenOn: dart.definiteFunctionType(io._HttpServer, [dart.dynamic])
+    }),
+    fields: () => ({
+      serverHeader: core.String,
+      defaultResponseHeaders: io.HttpHeaders,
+      autoCompress: core.bool,
+      [_idleTimeout]: core.Duration,
+      [_idleTimer]: async.Timer,
+      [_sessionManagerInstance]: io._HttpSessionManager,
+      closed: core.bool,
+      [_serverSocket]: dart.dynamic,
+      [_closeServer]: core.bool,
+      [_activeConnections]: LinkedListOf_HttpConnection(),
+      [_idleConnections]: LinkedListOf_HttpConnection(),
+      [_controller$0]: StreamControllerOfHttpRequest()
+    }),
+    getters: () => ({
+      idleTimeout: dart.definiteFunctionType(core.Duration, []),
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, []),
+      [_sessionManager]: dart.definiteFunctionType(io._HttpSessionManager, []),
+      [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+      [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+    }),
+    setters: () => ({
+      idleTimeout: dart.definiteFunctionType(dart.void, [core.Duration]),
+      sessionTimeout: dart.definiteFunctionType(dart.void, [core.int])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.HttpRequest), [HttpRequestTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(async.Future, [], {force: core.bool}),
+      [_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
+      [_handleRequest]: dart.definiteFunctionType(dart.void, [io._HttpRequest]),
+      [_connectionClosed]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+      [_markIdle]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+      [_markActive]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+      connectionsInfo: dart.definiteFunctionType(io.HttpConnectionsInfo, []),
+      [_toJSON$]: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [core.bool])
+    }),
+    sfields: () => ({_servers: MapOfint$_HttpServer()}),
+    statics: () => ({
+      bind: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, core.int, core.bool, core.bool]),
+      bindSecure: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, io.SecurityContext, core.int, core.bool, core.bool, core.bool]),
+      _initDefaultResponseHeaders: dart.definiteFunctionType(io.HttpHeaders, [])
+    }),
+    names: ['bind', 'bindSecure', '_initDefaultResponseHeaders']
+  });
+  dart.defineLazy(io._HttpServer, {
+    get _servers() {
+      return MapOfint$_HttpServer().new();
+    },
+    set _servers(_) {}
+  });
+  io._Proxy = class _Proxy extends core.Object {
+    new(host, port, username, password) {
+      this.host = host;
+      this.port = port;
+      this.username = username;
+      this.password = password;
+      this.isDirect = false;
+    }
+    direct() {
+      this.host = null;
+      this.port = null;
+      this.username = null;
+      this.password = null;
+      this.isDirect = true;
+    }
+    get isAuthenticated() {
+      return this.username != null;
+    }
+  };
+  dart.defineNamedConstructor(io._Proxy, 'direct');
+  dart.setSignature(io._Proxy, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._Proxy, [core.String, core.int, core.String, core.String]),
+      direct: dart.definiteFunctionType(io._Proxy, [])
+    }),
+    fields: () => ({
+      host: core.String,
+      port: core.int,
+      username: core.String,
+      password: core.String,
+      isDirect: core.bool
+    }),
+    getters: () => ({isAuthenticated: dart.definiteFunctionType(core.bool, [])})
+  });
+  let const$73;
+  let const$74;
+  io._ProxyConfiguration = class _ProxyConfiguration extends core.Object {
+    new(configuration) {
+      this.proxies = ListOf_Proxy().new();
+      if (configuration == null) {
+        dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+      }
+      let list = configuration[dartx.split](";");
+      list[dartx.forEach](dart.fn(proxy => {
+        proxy = proxy[dartx.trim]();
+        if (!dart.test(proxy[dartx.isEmpty])) {
+          if (dart.test(proxy[dartx.startsWith](io._ProxyConfiguration.PROXY_PREFIX))) {
+            let username = null;
+            let password = null;
+            proxy = proxy[dartx.substring](io._ProxyConfiguration.PROXY_PREFIX[dartx.length])[dartx.trim]();
+            let at = proxy[dartx.indexOf]("@");
+            if (at != -1) {
+              let userinfo = proxy[dartx.substring](0, at)[dartx.trim]();
+              proxy = proxy[dartx.substring](dart.notNull(at) + 1)[dartx.trim]();
+              let colon = userinfo[dartx.indexOf](":");
+              if (colon == -1 || colon == 0 || colon == dart.notNull(proxy[dartx.length]) - 1) {
+                dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+              }
+              username = userinfo[dartx.substring](0, colon)[dartx.trim]();
+              password = userinfo[dartx.substring](dart.notNull(colon) + 1)[dartx.trim]();
+            }
+            let colon = proxy[dartx.lastIndexOf](":");
+            if (colon == -1 || colon == 0 || colon == dart.notNull(proxy[dartx.length]) - 1) {
+              dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+            }
+            let host = proxy[dartx.substring](0, colon)[dartx.trim]();
+            if (dart.test(host[dartx.startsWith]("[")) && dart.test(host[dartx.endsWith]("]"))) {
+              host = host[dartx.substring](1, dart.notNull(host[dartx.length]) - 1);
+            }
+            let portString = proxy[dartx.substring](dart.notNull(colon) + 1)[dartx.trim]();
+            let port = null;
+            try {
+              port = core.int.parse(portString);
+            } catch (e) {
+              if (core.FormatException.is(e)) {
+                dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}, ` + dart.str`invalid port '${portString}'`));
+              } else
+                throw e;
+            }
+
+            this.proxies[dartx.add](new io._Proxy(host, port, username, password));
+          } else if (proxy[dartx.trim]() == io._ProxyConfiguration.DIRECT_PREFIX) {
+            this.proxies[dartx.add](new io._Proxy.direct());
+          } else {
+            dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+          }
+        }
+      }, StringToNull()));
+    }
+    direct() {
+      this.proxies = const$74 || (const$74 = dart.constList([const$73 || (const$73 = dart.const(new io._Proxy.direct()))], io._Proxy));
+    }
+  };
+  dart.defineNamedConstructor(io._ProxyConfiguration, 'direct');
+  dart.setSignature(io._ProxyConfiguration, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._ProxyConfiguration, [core.String]),
+      direct: dart.definiteFunctionType(io._ProxyConfiguration, [])
+    }),
+    fields: () => ({proxies: ListOf_Proxy()}),
+    sfields: () => ({
+      PROXY_PREFIX: core.String,
+      DIRECT_PREFIX: core.String
+    })
+  });
+  io._ProxyConfiguration.PROXY_PREFIX = "PROXY ";
+  io._ProxyConfiguration.DIRECT_PREFIX = "DIRECT";
+  io._HttpConnectionInfo = class _HttpConnectionInfo extends core.Object {
+    new() {
+      this.remoteAddress = null;
+      this.remotePort = null;
+      this.localPort = null;
+    }
+    static create(socket) {
+      if (socket == null) return null;
+      try {
+        let info = new io._HttpConnectionInfo();
+        info.remoteAddress = socket.remoteAddress;
+        info.remotePort = socket.remotePort;
+        info.localPort = socket.port;
+        return info;
+      } catch (e) {
+      }
+
+      return null;
+    }
+  };
+  io._HttpConnectionInfo[dart.implements] = () => [io.HttpConnectionInfo];
+  dart.setSignature(io._HttpConnectionInfo, {
+    fields: () => ({
+      remoteAddress: io.InternetAddress,
+      remotePort: core.int,
+      localPort: core.int
+    }),
+    statics: () => ({create: dart.definiteFunctionType(io._HttpConnectionInfo, [io.Socket])}),
+    names: ['create']
+  });
+  io._DetachedSocket = class _DetachedSocket extends async.Stream$(core.List$(core.int)) {
+    new(socket, incoming) {
+      this[_socket] = socket;
+      this[_incoming] = incoming;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get encoding() {
+      return convert.Encoding._check(dart.dload(this[_socket], 'encoding'));
+    }
+    set encoding(value) {
+      dart.dput(this[_socket], 'encoding', value);
+    }
+    write(obj) {
+      dart.dsend(this[_socket], 'write', obj);
+    }
+    writeln(obj) {
+      if (obj === void 0) obj = "";
+      dart.dsend(this[_socket], 'writeln', obj);
+    }
+    writeCharCode(charCode) {
+      dart.dsend(this[_socket], 'writeCharCode', charCode);
+    }
+    writeAll(objects, separator) {
+      if (separator === void 0) separator = "";
+      dart.dsend(this[_socket], 'writeAll', objects, separator);
+    }
+    add(bytes) {
+      dart.dsend(this[_socket], 'add', bytes);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      return dart.dsend(this[_socket], 'addError', error, stackTrace);
+    }
+    addStream(stream) {
+      return FutureOfSocket()._check(dart.dsend(this[_socket], 'addStream', stream));
+    }
+    destroy() {
+      dart.dsend(this[_socket], 'destroy');
+    }
+    flush() {
+      return async.Future._check(dart.dsend(this[_socket], 'flush'));
+    }
+    close() {
+      return async.Future._check(dart.dsend(this[_socket], 'close'));
+    }
+    get done() {
+      return FutureOfSocket()._check(dart.dload(this[_socket], 'done'));
+    }
+    get port() {
+      return core.int._check(dart.dload(this[_socket], 'port'));
+    }
+    get address() {
+      return io.InternetAddress._check(dart.dload(this[_socket], 'address'));
+    }
+    get remoteAddress() {
+      return io.InternetAddress._check(dart.dload(this[_socket], 'remoteAddress'));
+    }
+    get remotePort() {
+      return core.int._check(dart.dload(this[_socket], 'remotePort'));
+    }
+    setOption(option, enabled) {
+      return core.bool._check(dart.dsend(this[_socket], 'setOption', option, enabled));
+    }
+    [_toJSON$](ref) {
+      return core.Map._check(dart.dsend(this[_socket], _toJSON$, ref));
+    }
+    set [_owner](owner) {
+      dart.dput(this[_socket], _owner, owner);
+    }
+  };
+  dart.addSimpleTypeTests(io._DetachedSocket);
+  io._DetachedSocket[dart.implements] = () => [io.Socket];
+  dart.setSignature(io._DetachedSocket, {
+    constructors: () => ({new: dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic, StreamOfListOfint()])}),
+    fields: () => ({
+      [_incoming]: StreamOfListOfint(),
+      [_socket]: dart.dynamic
+    }),
+    getters: () => ({
+      encoding: dart.definiteFunctionType(convert.Encoding, []),
+      done: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, []),
+      remoteAddress: dart.definiteFunctionType(io.InternetAddress, []),
+      remotePort: dart.definiteFunctionType(core.int, [])
+    }),
+    setters: () => ({
+      encoding: dart.definiteFunctionType(dart.void, [convert.Encoding]),
+      [_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      write: dart.definiteFunctionType(dart.void, [core.Object]),
+      writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+      writeCharCode: dart.definiteFunctionType(dart.void, [core.int]),
+      writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future$(io.Socket), [StreamOfListOfint()]),
+      destroy: dart.definiteFunctionType(dart.void, []),
+      flush: dart.definiteFunctionType(async.Future, []),
+      close: dart.definiteFunctionType(async.Future, []),
+      setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
+      [_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
+    })
+  });
+  const _scheme = Symbol('_scheme');
+  io._AuthenticationScheme = class _AuthenticationScheme extends core.Object {
+    new(scheme) {
+      this[_scheme] = scheme;
+    }
+    static fromString(scheme) {
+      if (scheme[dartx.toLowerCase]() == "basic") return io._AuthenticationScheme.BASIC;
+      if (scheme[dartx.toLowerCase]() == "digest") return io._AuthenticationScheme.DIGEST;
+      return io._AuthenticationScheme.UNKNOWN;
+    }
+    toString() {
+      if (dart.equals(this, io._AuthenticationScheme.BASIC)) return "Basic";
+      if (dart.equals(this, io._AuthenticationScheme.DIGEST)) return "Digest";
+      return "Unknown";
+    }
+  };
+  dart.setSignature(io._AuthenticationScheme, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._AuthenticationScheme, [core.int]),
+      fromString: dart.definiteFunctionType(io._AuthenticationScheme, [core.String])
+    }),
+    fields: () => ({[_scheme]: core.int}),
+    sfields: () => ({
+      UNKNOWN: io._AuthenticationScheme,
+      BASIC: io._AuthenticationScheme,
+      DIGEST: io._AuthenticationScheme
+    })
+  });
+  dart.defineLazy(io._AuthenticationScheme, {
+    get UNKNOWN() {
+      return dart.const(new io._AuthenticationScheme(-1));
+    },
+    get BASIC() {
+      return dart.const(new io._AuthenticationScheme(0));
+    },
+    get DIGEST() {
+      return dart.const(new io._AuthenticationScheme(1));
+    }
+  });
+  io._Credentials = class _Credentials extends core.Object {
+    new(credentials, realm) {
+      this.credentials = credentials;
+      this.realm = realm;
+      this.used = false;
+      this.ha1 = null;
+      this.nonce = null;
+      this.algorithm = null;
+      this.qop = null;
+      this.nonceCount = null;
+      if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST)) {
+        let creds = io._HttpClientDigestCredentials._check(this.credentials);
+        let hasher = new io._MD5();
+        hasher.add(convert.UTF8.encode(creds.username));
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(this.realm[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(convert.UTF8.encode(creds.password));
+        this.ha1 = io._CryptoUtils.bytesToHex(hasher.close());
+      }
+    }
+    get scheme() {
+      return this.credentials.scheme;
+    }
+  };
+  dart.setSignature(io._Credentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._Credentials, [io._HttpClientCredentials, core.String])}),
+    fields: () => ({
+      credentials: io._HttpClientCredentials,
+      realm: core.String,
+      used: core.bool,
+      ha1: core.String,
+      nonce: core.String,
+      algorithm: core.String,
+      qop: core.String,
+      nonceCount: core.int
+    }),
+    getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])})
+  });
+  io._SiteCredentials = class _SiteCredentials extends io._Credentials {
+    new(uri, realm, creds) {
+      this.uri = uri;
+      super.new(creds, core.String._check(realm));
+    }
+    applies(uri, scheme) {
+      if (scheme != null && !dart.equals(this.credentials.scheme, scheme)) return false;
+      if (uri.host != this.uri.host) return false;
+      let thisPort = this.uri.port == 0 ? io.HttpClient.DEFAULT_HTTP_PORT : this.uri.port;
+      let otherPort = uri.port == 0 ? io.HttpClient.DEFAULT_HTTP_PORT : uri.port;
+      if (otherPort != thisPort) return false;
+      return uri.path[dartx.startsWith](this.uri.path);
+    }
+    authorize(request) {
+      if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST) && this.nonce == null) {
+        return;
+      }
+      this.credentials.authorize(this, request);
+      this.used = true;
+    }
+  };
+  dart.setSignature(io._SiteCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SiteCredentials, [core.Uri, dart.dynamic, io._HttpClientCredentials])}),
+    fields: () => ({uri: core.Uri}),
+    methods: () => ({
+      applies: dart.definiteFunctionType(core.bool, [core.Uri, io._AuthenticationScheme]),
+      authorize: dart.definiteFunctionType(dart.void, [io.HttpClientRequest])
+    })
+  });
+  io._ProxyCredentials = class _ProxyCredentials extends io._Credentials {
+    new(host, port, realm, creds) {
+      this.host = host;
+      this.port = port;
+      super.new(creds, core.String._check(realm));
+    }
+    applies(proxy, scheme) {
+      if (scheme != null && !dart.equals(this.credentials.scheme, scheme)) return false;
+      return proxy.host == this.host && proxy.port == this.port;
+    }
+    authorize(request) {
+      if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST) && this.nonce == null) {
+        return;
+      }
+      this.credentials.authorizeProxy(this, request);
+    }
+  };
+  dart.setSignature(io._ProxyCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ProxyCredentials, [core.String, core.int, dart.dynamic, io._HttpClientCredentials])}),
+    fields: () => ({
+      host: core.String,
+      port: core.int
+    }),
+    methods: () => ({
+      applies: dart.definiteFunctionType(core.bool, [io._Proxy, io._AuthenticationScheme]),
+      authorize: dart.definiteFunctionType(dart.void, [io.HttpClientRequest])
+    })
+  });
+  io._HttpClientCredentials = class _HttpClientCredentials extends core.Object {};
+  io._HttpClientCredentials[dart.implements] = () => [io.HttpClientCredentials];
+  io._HttpClientBasicCredentials = class _HttpClientBasicCredentials extends io._HttpClientCredentials {
+    new(username, password) {
+      this.username = username;
+      this.password = password;
+    }
+    get scheme() {
+      return io._AuthenticationScheme.BASIC;
+    }
+    authorization() {
+      let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${this.username}:${this.password}`));
+      return dart.str`Basic ${auth}`;
+    }
+    authorize(_, request) {
+      request.headers.set(io.HttpHeaders.AUTHORIZATION, this.authorization());
+    }
+    authorizeProxy(_, request) {
+      request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, this.authorization());
+    }
+  };
+  io._HttpClientBasicCredentials[dart.implements] = () => [io.HttpClientBasicCredentials];
+  dart.setSignature(io._HttpClientBasicCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientBasicCredentials, [core.String, core.String])}),
+    fields: () => ({
+      username: core.String,
+      password: core.String
+    }),
+    getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])}),
+    methods: () => ({
+      authorization: dart.definiteFunctionType(core.String, []),
+      authorize: dart.definiteFunctionType(dart.void, [io._Credentials, io.HttpClientRequest]),
+      authorizeProxy: dart.definiteFunctionType(dart.void, [io._ProxyCredentials, io.HttpClientRequest])
+    })
+  });
+  io._HttpClientDigestCredentials = class _HttpClientDigestCredentials extends io._HttpClientCredentials {
+    new(username, password) {
+      this.username = username;
+      this.password = password;
+    }
+    get scheme() {
+      return io._AuthenticationScheme.DIGEST;
+    }
+    authorization(credentials, request) {
+      let requestUri = request[_requestUri]();
+      let hasher = new io._MD5();
+      hasher.add(request.method[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(requestUri[dartx.codeUnits]);
+      let ha2 = io._CryptoUtils.bytesToHex(hasher.close());
+      let qop = null;
+      let cnonce = null;
+      let nc = null;
+      let x = null;
+      hasher = new io._MD5();
+      hasher.add(credentials.ha1[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      if (credentials.qop == "auth") {
+        qop = credentials.qop;
+        cnonce = io._CryptoUtils.bytesToHex(io._IOCrypto.getRandomBytes(4));
+        credentials.nonceCount = dart.notNull(credentials.nonceCount) + 1;
+        nc = credentials.nonceCount[dartx.toRadixString](16);
+        nc = dart.notNull("00000000"[dartx.substring](0, 8 - dart.notNull(nc[dartx.length]) + 1)) + dart.notNull(nc);
+        hasher.add(credentials.nonce[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(nc[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(cnonce[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(credentials.qop[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(ha2[dartx.codeUnits]);
+      } else {
+        hasher.add(credentials.nonce[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(ha2[dartx.codeUnits]);
+      }
+      let response = io._CryptoUtils.bytesToHex(hasher.close());
+      let buffer = new core.StringBuffer();
+      buffer.write('Digest ');
+      buffer.write(dart.str`username="${this.username}"`);
+      buffer.write(dart.str`, realm="${credentials.realm}"`);
+      buffer.write(dart.str`, nonce="${credentials.nonce}"`);
+      buffer.write(dart.str`, uri="${requestUri}"`);
+      buffer.write(dart.str`, algorithm="${credentials.algorithm}"`);
+      if (qop == "auth") {
+        buffer.write(dart.str`, qop="${qop}"`);
+        buffer.write(dart.str`, cnonce="${cnonce}"`);
+        buffer.write(dart.str`, nc="${nc}"`);
+      }
+      buffer.write(dart.str`, response="${response}"`);
+      return buffer.toString();
+    }
+    authorize(credentials, request) {
+      request.headers.set(io.HttpHeaders.AUTHORIZATION, this.authorization(credentials, io._HttpClientRequest._check(request)));
+    }
+    authorizeProxy(credentials, request) {
+      request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, this.authorization(credentials, io._HttpClientRequest._check(request)));
+    }
+  };
+  io._HttpClientDigestCredentials[dart.implements] = () => [io.HttpClientDigestCredentials];
+  dart.setSignature(io._HttpClientDigestCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientDigestCredentials, [core.String, core.String])}),
+    fields: () => ({
+      username: core.String,
+      password: core.String
+    }),
+    getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])}),
+    methods: () => ({
+      authorization: dart.definiteFunctionType(core.String, [io._Credentials, io._HttpClientRequest]),
+      authorize: dart.definiteFunctionType(dart.void, [io._Credentials, io.HttpClientRequest]),
+      authorizeProxy: dart.definiteFunctionType(dart.void, [io._ProxyCredentials, io.HttpClientRequest])
+    })
+  });
+  io._RedirectInfo = class _RedirectInfo extends core.Object {
+    new(statusCode, method, location) {
+      this.statusCode = statusCode;
+      this.method = method;
+      this.location = location;
+    }
+  };
+  io._RedirectInfo[dart.implements] = () => [io.RedirectInfo];
+  dart.setSignature(io._RedirectInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RedirectInfo, [core.int, core.String, core.Uri])}),
+    fields: () => ({
+      statusCode: core.int,
+      method: core.String,
+      location: core.Uri
+    })
+  });
+  io._getHttpVersion = function() {
+    let version = io.Platform.version;
+    let index = version[dartx.indexOf]('.', dart.notNull(version[dartx.indexOf]('.')) + 1);
+    version = version[dartx.substring](0, index);
+    return dart.str`Dart/${version} (dart:io)`;
+  };
+  dart.fn(io._getHttpVersion, VoidToString$());
+  io._Const = class _Const extends core.Object {};
+  dart.setSignature(io._Const, {
+    sfields: () => ({
+      HTTP: ListOfint(),
+      HTTP1DOT: ListOfint(),
+      HTTP10: ListOfint(),
+      HTTP11: ListOfint(),
+      T: core.bool,
+      F: core.bool,
+      SEPARATOR_MAP: ListOfbool()
+    })
+  });
+  io._Const.HTTP = dart.constList([72, 84, 84, 80], core.int);
+  io._Const.HTTP1DOT = dart.constList([72, 84, 84, 80, 47, 49, 46], core.int);
+  io._Const.HTTP10 = dart.constList([72, 84, 84, 80, 47, 49, 46, 48], core.int);
+  io._Const.HTTP11 = dart.constList([72, 84, 84, 80, 47, 49, 46, 49], core.int);
+  io._Const.T = true;
+  io._Const.F = false;
+  dart.defineLazy(io._Const, {
+    get SEPARATOR_MAP() {
+      return dart.constList([io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F], core.bool);
+    }
+  });
+  io._CharCode = class _CharCode extends core.Object {};
+  dart.setSignature(io._CharCode, {
+    sfields: () => ({
+      HT: core.int,
+      LF: core.int,
+      CR: core.int,
+      SP: core.int,
+      AMPERSAND: core.int,
+      COMMA: core.int,
+      DASH: core.int,
+      SLASH: core.int,
+      ZERO: core.int,
+      ONE: core.int,
+      COLON: core.int,
+      SEMI_COLON: core.int,
+      EQUAL: core.int
+    })
+  });
+  io._CharCode.HT = 9;
+  io._CharCode.LF = 10;
+  io._CharCode.CR = 13;
+  io._CharCode.SP = 32;
+  io._CharCode.AMPERSAND = 38;
+  io._CharCode.COMMA = 44;
+  io._CharCode.DASH = 45;
+  io._CharCode.SLASH = 47;
+  io._CharCode.ZERO = 48;
+  io._CharCode.ONE = 49;
+  io._CharCode.COLON = 58;
+  io._CharCode.SEMI_COLON = 59;
+  io._CharCode.EQUAL = 61;
+  io._State = class _State extends core.Object {};
+  dart.setSignature(io._State, {
+    sfields: () => ({
+      START: core.int,
+      METHOD_OR_RESPONSE_HTTP_VERSION: core.int,
+      RESPONSE_HTTP_VERSION: core.int,
+      REQUEST_LINE_METHOD: core.int,
+      REQUEST_LINE_URI: core.int,
+      REQUEST_LINE_HTTP_VERSION: core.int,
+      REQUEST_LINE_ENDING: core.int,
+      RESPONSE_LINE_STATUS_CODE: core.int,
+      RESPONSE_LINE_REASON_PHRASE: core.int,
+      RESPONSE_LINE_ENDING: core.int,
+      HEADER_START: core.int,
+      HEADER_FIELD: core.int,
+      HEADER_VALUE_START: core.int,
+      HEADER_VALUE: core.int,
+      HEADER_VALUE_FOLDING_OR_ENDING: core.int,
+      HEADER_VALUE_FOLD_OR_END: core.int,
+      HEADER_ENDING: core.int,
+      CHUNK_SIZE_STARTING_CR: core.int,
+      CHUNK_SIZE_STARTING_LF: core.int,
+      CHUNK_SIZE: core.int,
+      CHUNK_SIZE_EXTENSION: core.int,
+      CHUNK_SIZE_ENDING: core.int,
+      CHUNKED_BODY_DONE_CR: core.int,
+      CHUNKED_BODY_DONE_LF: core.int,
+      BODY: core.int,
+      CLOSED: core.int,
+      UPGRADED: core.int,
+      FAILURE: core.int,
+      FIRST_BODY_STATE: core.int
+    })
+  });
+  io._State.START = 0;
+  io._State.METHOD_OR_RESPONSE_HTTP_VERSION = 1;
+  io._State.RESPONSE_HTTP_VERSION = 2;
+  io._State.REQUEST_LINE_METHOD = 3;
+  io._State.REQUEST_LINE_URI = 4;
+  io._State.REQUEST_LINE_HTTP_VERSION = 5;
+  io._State.REQUEST_LINE_ENDING = 6;
+  io._State.RESPONSE_LINE_STATUS_CODE = 7;
+  io._State.RESPONSE_LINE_REASON_PHRASE = 8;
+  io._State.RESPONSE_LINE_ENDING = 9;
+  io._State.HEADER_START = 10;
+  io._State.HEADER_FIELD = 11;
+  io._State.HEADER_VALUE_START = 12;
+  io._State.HEADER_VALUE = 13;
+  io._State.HEADER_VALUE_FOLDING_OR_ENDING = 14;
+  io._State.HEADER_VALUE_FOLD_OR_END = 15;
+  io._State.HEADER_ENDING = 16;
+  io._State.CHUNK_SIZE_STARTING_CR = 17;
+  io._State.CHUNK_SIZE_STARTING_LF = 18;
+  io._State.CHUNK_SIZE = 19;
+  io._State.CHUNK_SIZE_EXTENSION = 20;
+  io._State.CHUNK_SIZE_ENDING = 21;
+  io._State.CHUNKED_BODY_DONE_CR = 22;
+  io._State.CHUNKED_BODY_DONE_LF = 23;
+  io._State.BODY = 24;
+  io._State.CLOSED = 25;
+  io._State.UPGRADED = 26;
+  io._State.FAILURE = 27;
+  dart.defineLazy(io._State, {
+    get FIRST_BODY_STATE() {
+      return io._State.CHUNK_SIZE_STARTING_CR;
+    }
+  });
+  io._HttpVersion = class _HttpVersion extends core.Object {};
+  dart.setSignature(io._HttpVersion, {
+    sfields: () => ({
+      UNDETERMINED: core.int,
+      HTTP10: core.int,
+      HTTP11: core.int
+    })
+  });
+  io._HttpVersion.UNDETERMINED = 0;
+  io._HttpVersion.HTTP10 = 1;
+  io._HttpVersion.HTTP11 = 2;
+  io._MessageType = class _MessageType extends core.Object {};
+  dart.setSignature(io._MessageType, {
+    sfields: () => ({
+      UNDETERMINED: core.int,
+      REQUEST: core.int,
+      RESPONSE: core.int
+    })
+  });
+  io._MessageType.UNDETERMINED = 0;
+  io._MessageType.REQUEST = 1;
+  io._MessageType.RESPONSE = 0;
+  const _injectData = Symbol('_injectData');
+  const _userOnData = Symbol('_userOnData');
+  const _isCanceled$ = Symbol('_isCanceled');
+  const _pauseCount$ = Symbol('_pauseCount');
+  const _scheduled = Symbol('_scheduled');
+  const _maybeScheduleData = Symbol('_maybeScheduleData');
+  io._HttpDetachedStreamSubscription = class _HttpDetachedStreamSubscription extends core.Object {
+    new(subscription, injectData, userOnData) {
+      this[_subscription$] = subscription;
+      this[_injectData] = injectData;
+      this[_userOnData] = userOnData;
+      this[_isCanceled$] = false;
+      this[_pauseCount$] = 1;
+      this[_scheduled] = false;
+    }
+    get isPaused() {
+      return this[_subscription$].isPaused;
+    }
+    asFuture(T) {
+      return futureValue => {
+        if (futureValue === void 0) futureValue = null;
+        return this[_subscription$].asFuture(T)(futureValue);
+      };
+    }
+    cancel() {
+      this[_isCanceled$] = true;
+      this[_injectData] = null;
+      return this[_subscription$].cancel();
+    }
+    onData(handleData) {
+      this[_userOnData] = handleData;
+      this[_subscription$].onData(handleData);
+    }
+    onDone(handleDone) {
+      this[_subscription$].onDone(handleDone);
+    }
+    onError(handleError) {
+      this[_subscription$].onError(handleError);
+    }
+    pause(resumeSignal) {
+      if (resumeSignal === void 0) resumeSignal = null;
+      if (this[_injectData] == null) {
+        this[_subscription$].pause(resumeSignal);
+      } else {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) + 1;
+        if (resumeSignal != null) {
+          resumeSignal.whenComplete(dart.bind(this, 'resume'));
+        }
+      }
+    }
+    resume() {
+      if (this[_injectData] == null) {
+        this[_subscription$].resume();
+      } else {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) - 1;
+        this[_maybeScheduleData]();
+      }
+    }
+    [_maybeScheduleData]() {
+      if (dart.test(this[_scheduled])) return;
+      if (this[_pauseCount$] != 0) return;
+      this[_scheduled] = true;
+      async.scheduleMicrotask(dart.fn(() => {
+        this[_scheduled] = false;
+        if (dart.notNull(this[_pauseCount$]) > 0 || dart.test(this[_isCanceled$])) return;
+        let data = this[_injectData];
+        this[_injectData] = null;
+        this[_subscription$].resume();
+        if (this[_userOnData] != null) {
+          dart.dcall(this[_userOnData], data);
+        }
+      }, VoidToNull()));
+    }
+  };
+  io._HttpDetachedStreamSubscription[dart.implements] = () => [StreamSubscriptionOfListOfint()];
+  dart.setSignature(io._HttpDetachedStreamSubscription, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpDetachedStreamSubscription, [StreamSubscriptionOfListOfint(), ListOfint(), core.Function])}),
+    fields: () => ({
+      [_subscription$]: StreamSubscriptionOfListOfint(),
+      [_injectData]: ListOfint(),
+      [_isCanceled$]: core.bool,
+      [_pauseCount$]: core.int,
+      [_userOnData]: core.Function,
+      [_scheduled]: core.bool
+    }),
+    getters: () => ({isPaused: dart.definiteFunctionType(core.bool, [])}),
+    methods: () => ({
+      asFuture: dart.definiteFunctionType(T => [async.Future$(T), [], [T]]),
+      cancel: dart.definiteFunctionType(async.Future, []),
+      onData: dart.definiteFunctionType(dart.void, [ListOfintTovoid()]),
+      onDone: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
+      onError: dart.definiteFunctionType(dart.void, [core.Function]),
+      pause: dart.definiteFunctionType(dart.void, [], [async.Future]),
+      resume: dart.definiteFunctionType(dart.void, []),
+      [_maybeScheduleData]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._HttpDetachedIncoming = class _HttpDetachedIncoming extends async.Stream$(core.List$(core.int)) {
+    new(subscription, bufferedData) {
+      this.subscription = subscription;
+      this.bufferedData = bufferedData;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      if (this.subscription != null) {
+        this.subscription.onData(onData);
+        this.subscription.onError(onError);
+        this.subscription.onDone(onDone);
+        if (this.bufferedData == null) {
+          return StreamSubscriptionOfListOfint()._check(((() => {
+            this.subscription.resume();
+            return this.subscription;
+          })()));
+        }
+        let _ = new io._HttpDetachedStreamSubscription(StreamSubscriptionOfListOfint()._check(this.subscription), this.bufferedData, onData);
+        _.resume();
+        return _;
+      } else {
+        return StreamOfint().fromIterable(this.bufferedData).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+      }
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpDetachedIncoming);
+  dart.setSignature(io._HttpDetachedIncoming, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpDetachedIncoming, [async.StreamSubscription, ListOfint()])}),
+    fields: () => ({
+      subscription: async.StreamSubscription,
+      bufferedData: ListOfint()
+    }),
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+  });
+  const _method$ = Symbol('_method');
+  const _uri_or_reason_phrase = Symbol('_uri_or_reason_phrase');
+  const _headerField = Symbol('_headerField');
+  const _headerValue = Symbol('_headerValue');
+  const _requestParser = Symbol('_requestParser');
+  const _parserCalled = Symbol('_parserCalled');
+  const _index$2 = Symbol('_index');
+  const _httpVersionIndex = Symbol('_httpVersionIndex');
+  const _messageType = Symbol('_messageType');
+  const _statusCodeLength = Symbol('_statusCodeLength');
+  const _httpVersion = Symbol('_httpVersion');
+  const _connectionUpgrade = Symbol('_connectionUpgrade');
+  const _chunked = Symbol('_chunked');
+  const _noMessageBody = Symbol('_noMessageBody');
+  const _remainingContent = Symbol('_remainingContent');
+  const _socketSubscription = Symbol('_socketSubscription');
+  const _paused = Symbol('_paused');
+  const _bodyPaused = Symbol('_bodyPaused');
+  const _bodyController = Symbol('_bodyController');
+  const _pauseStateChanged = Symbol('_pauseStateChanged');
+  const _reset = Symbol('_reset');
+  const _onData$ = Symbol('_onData');
+  const _onDone$ = Symbol('_onDone');
+  const _doParse = Symbol('_doParse');
+  const _reportError = Symbol('_reportError');
+  const _createIncoming = Symbol('_createIncoming');
+  const _closeIncoming = Symbol('_closeIncoming');
+  const _headersEnd = Symbol('_headersEnd');
+  const _expect = Symbol('_expect');
+  const _caseInsensitiveCompare = Symbol('_caseInsensitiveCompare');
+  const _expectHexDigit = Symbol('_expectHexDigit');
+  const _releaseBuffer = Symbol('_releaseBuffer');
+  io._HttpParser = class _HttpParser extends async.Stream$(io._HttpIncoming) {
+    static requestParser() {
+      return new io._HttpParser._(true);
+    }
+    static responseParser() {
+      return new io._HttpParser._(false);
+    }
+    _(requestParser) {
+      this[_method$] = JSArrayOfint().of([]);
+      this[_uri_or_reason_phrase] = JSArrayOfint().of([]);
+      this[_headerField] = JSArrayOfint().of([]);
+      this[_headerValue] = JSArrayOfint().of([]);
+      this[_requestParser] = requestParser;
+      this[_parserCalled] = false;
+      this[_buffer$] = null;
+      this[_index$2] = null;
+      this[_state$1] = null;
+      this[_httpVersionIndex] = null;
+      this[_messageType] = null;
+      this[_statusCode] = 0;
+      this[_statusCodeLength] = 0;
+      this[_httpVersion] = null;
+      this[_transferLength] = -1;
+      this[_persistentConnection] = null;
+      this[_connectionUpgrade] = null;
+      this[_chunked] = null;
+      this[_noMessageBody] = false;
+      this[_remainingContent] = -1;
+      this[_headers] = null;
+      this[_incoming] = null;
+      this[_socketSubscription] = null;
+      this[_paused] = true;
+      this[_bodyPaused] = false;
+      this[_controller$0] = null;
+      this[_bodyController] = null;
+      super.new();
+      this[_controller$0] = StreamControllerOf_HttpIncoming().new({sync: true, onListen: dart.fn(() => {
+          this[_paused] = false;
+        }, VoidToNull()), onPause: dart.fn(() => {
+          this[_paused] = true;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onResume: dart.fn(() => {
+          this[_paused] = false;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onCancel: dart.fn(() => {
+          if (this[_socketSubscription] != null) {
+            this[_socketSubscription].cancel();
+          }
+        }, VoidToNull())});
+      this[_reset]();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    listenToStream(stream) {
+      this[_socketSubscription] = stream.listen(dart.bind(this, _onData$), {onError: dart.bind(this[_controller$0], 'addError'), onDone: dart.bind(this, _onDone$)});
+    }
+    [_parse]() {
+      try {
+        this[_doParse]();
+      } catch (e) {
+        let s = dart.stackTrace(e);
+        this[_state$1] = io._State.FAILURE;
+        this[_reportError](e, s);
+      }
+
+    }
+    [_headersEnd]() {
+      this[_headers][_mutable] = false;
+      this[_transferLength] = this[_headers].contentLength;
+      if (dart.test(this[_chunked])) this[_transferLength] = -1;
+      if (this[_messageType] == io._MessageType.REQUEST && dart.notNull(this[_transferLength]) < 0 && this[_chunked] == false) {
+        this[_transferLength] = 0;
+      }
+      if (dart.test(this[_connectionUpgrade])) {
+        this[_state$1] = io._State.UPGRADED;
+        this[_transferLength] = 0;
+      }
+      this[_createIncoming](this[_transferLength]);
+      if (dart.test(this[_requestParser])) {
+        this[_incoming].method = core.String.fromCharCodes(this[_method$]);
+        this[_incoming].uri = core.Uri.parse(core.String.fromCharCodes(this[_uri_or_reason_phrase]));
+      } else {
+        this[_incoming].statusCode = this[_statusCode];
+        this[_incoming].reasonPhrase = core.String.fromCharCodes(this[_uri_or_reason_phrase]);
+      }
+      this[_method$][dartx.clear]();
+      this[_uri_or_reason_phrase][dartx.clear]();
+      if (dart.test(this[_connectionUpgrade])) {
+        this[_incoming].upgraded = true;
+        this[_parserCalled] = false;
+        let tmp = this[_incoming];
+        this[_closeIncoming]();
+        this[_controller$0].add(tmp);
+        return true;
+      }
+      if (this[_transferLength] == 0 || this[_messageType] == io._MessageType.RESPONSE && dart.test(this[_noMessageBody])) {
+        this[_reset]();
+        let tmp = this[_incoming];
+        this[_closeIncoming]();
+        this[_controller$0].add(tmp);
+        return false;
+      } else if (dart.test(this[_chunked])) {
+        this[_state$1] = io._State.CHUNK_SIZE;
+        this[_remainingContent] = 0;
+      } else if (dart.notNull(this[_transferLength]) > 0) {
+        this[_remainingContent] = this[_transferLength];
+        this[_state$1] = io._State.BODY;
+      } else {
+        this[_state$1] = io._State.BODY;
+      }
+      this[_parserCalled] = false;
+      this[_controller$0].add(this[_incoming]);
+      return true;
+    }
+    [_doParse]() {
+      dart.assert(!dart.test(this[_parserCalled]));
+      this[_parserCalled] = true;
+      if (this[_state$1] == io._State.CLOSED) {
+        dart.throw(new io.HttpException("Data on closed connection"));
+      }
+      if (this[_state$1] == io._State.FAILURE) {
+        dart.throw(new io.HttpException("Data on failed connection"));
+      }
+      while (this[_buffer$] != null && dart.notNull(this[_index$2]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
+        if (this[_incoming] != null && dart.test(this[_bodyPaused]) || this[_incoming] == null && dart.test(this[_paused])) {
+          this[_parserCalled] = false;
+          return;
+        }
+        let byte = this[_buffer$][dartx._get]((() => {
+          let x = this[_index$2];
+          this[_index$2] = dart.notNull(x) + 1;
+          return x;
+        })());
+        switch (this[_state$1]) {
+          case io._State.START:
+          {
+            if (byte == io._Const.HTTP[dartx._get](0)) {
+              this[_httpVersionIndex] = 1;
+              this[_state$1] = io._State.METHOD_OR_RESPONSE_HTTP_VERSION;
+            } else {
+              if (!dart.test(io._HttpParser._isTokenChar(byte))) {
+                dart.throw(new io.HttpException("Invalid request method"));
+              }
+              this[_method$][dartx.add](byte);
+              if (!dart.test(this[_requestParser])) {
+                dart.throw(new io.HttpException("Invalid response line"));
+              }
+              this[_state$1] = io._State.REQUEST_LINE_METHOD;
+            }
+            break;
+          }
+          case io._State.METHOD_OR_RESPONSE_HTTP_VERSION:
+          {
+            if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP[dartx.length]) && byte == io._Const.HTTP[dartx._get](this[_httpVersionIndex])) {
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP[dartx.length] && byte == io._CharCode.SLASH) {
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+              if (dart.test(this[_requestParser])) {
+                dart.throw(new io.HttpException("Invalid request line"));
+              }
+              this[_state$1] = io._State.RESPONSE_HTTP_VERSION;
+            } else {
+              for (let i = 0; i < dart.notNull(this[_httpVersionIndex]); i++) {
+                this[_method$][dartx.add](io._Const.HTTP[dartx._get](i));
+              }
+              if (byte == io._CharCode.SP) {
+                this[_state$1] = io._State.REQUEST_LINE_URI;
+              } else {
+                this[_method$][dartx.add](byte);
+                this[_httpVersion] = io._HttpVersion.UNDETERMINED;
+                if (!dart.test(this[_requestParser])) {
+                  dart.throw(new io.HttpException("Invalid response line"));
+                }
+                this[_state$1] = io._State.REQUEST_LINE_METHOD;
+              }
+            }
+            break;
+          }
+          case io._State.RESPONSE_HTTP_VERSION:
+          {
+            if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP1DOT[dartx.length])) {
+              this[_expect](byte, io._Const.HTTP1DOT[dartx._get](this[_httpVersionIndex]));
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length] && byte == io._CharCode.ONE) {
+              this[_httpVersion] = io._HttpVersion.HTTP11;
+              this[_persistentConnection] = true;
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length] && byte == io._CharCode.ZERO) {
+              this[_httpVersion] = io._HttpVersion.HTTP10;
+              this[_persistentConnection] = false;
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == dart.notNull(io._Const.HTTP1DOT[dartx.length]) + 1) {
+              this[_expect](byte, io._CharCode.SP);
+              this[_state$1] = io._State.RESPONSE_LINE_STATUS_CODE;
+            } else {
+              dart.throw(new io.HttpException("Invalid response line"));
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_METHOD:
+          {
+            if (byte == io._CharCode.SP) {
+              this[_state$1] = io._State.REQUEST_LINE_URI;
+            } else {
+              if (dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte)) || byte == io._CharCode.CR || byte == io._CharCode.LF) {
+                dart.throw(new io.HttpException("Invalid request method"));
+              }
+              this[_method$][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_URI:
+          {
+            if (byte == io._CharCode.SP) {
+              if (this[_uri_or_reason_phrase][dartx.length] == 0) {
+                dart.throw(new io.HttpException("Invalid request URI"));
+              }
+              this[_state$1] = io._State.REQUEST_LINE_HTTP_VERSION;
+              this[_httpVersionIndex] = 0;
+            } else {
+              if (byte == io._CharCode.CR || byte == io._CharCode.LF) {
+                dart.throw(new io.HttpException("Invalid request URI"));
+              }
+              this[_uri_or_reason_phrase][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_HTTP_VERSION:
+          {
+            if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP1DOT[dartx.length])) {
+              this[_expect](byte, io._Const.HTTP11[dartx._get](this[_httpVersionIndex]));
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length]) {
+              if (byte == io._CharCode.ONE) {
+                this[_httpVersion] = io._HttpVersion.HTTP11;
+                this[_persistentConnection] = true;
+                this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+              } else if (byte == io._CharCode.ZERO) {
+                this[_httpVersion] = io._HttpVersion.HTTP10;
+                this[_persistentConnection] = false;
+                this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+              } else {
+                dart.throw(new io.HttpException("Invalid response line"));
+              }
+            } else {
+              if (byte == io._CharCode.CR) {
+                this[_state$1] = io._State.REQUEST_LINE_ENDING;
+              } else {
+                this[_expect](byte, io._CharCode.LF);
+                this[_messageType] = io._MessageType.REQUEST;
+                this[_state$1] = io._State.HEADER_START;
+              }
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_messageType] = io._MessageType.REQUEST;
+            this[_state$1] = io._State.HEADER_START;
+            break;
+          }
+          case io._State.RESPONSE_LINE_STATUS_CODE:
+          {
+            if (byte == io._CharCode.SP) {
+              this[_state$1] = io._State.RESPONSE_LINE_REASON_PHRASE;
+            } else if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.RESPONSE_LINE_ENDING;
+            } else {
+              this[_statusCodeLength] = dart.notNull(this[_statusCodeLength]) + 1;
+              if (dart.notNull(byte) < 48 && 57 < dart.notNull(byte) || dart.notNull(this[_statusCodeLength]) > 3) {
+                dart.throw(new io.HttpException("Invalid response status code"));
+              } else {
+                this[_statusCode] = dart.notNull(this[_statusCode]) * 10 + dart.notNull(byte) - 48;
+              }
+            }
+            break;
+          }
+          case io._State.RESPONSE_LINE_REASON_PHRASE:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.RESPONSE_LINE_ENDING;
+            } else {
+              if (byte == io._CharCode.CR || byte == io._CharCode.LF) {
+                dart.throw(new io.HttpException("Invalid response reason phrase"));
+              }
+              this[_uri_or_reason_phrase][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.RESPONSE_LINE_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_messageType] == io._MessageType.RESPONSE;
+            if (dart.notNull(this[_statusCode]) < 100 || dart.notNull(this[_statusCode]) > 599) {
+              dart.throw(new io.HttpException("Invalid response status code"));
+            } else {
+              if (dart.notNull(this[_statusCode]) <= 199 || this[_statusCode] == 204 || this[_statusCode] == 304) {
+                this[_noMessageBody] = true;
+              }
+            }
+            this[_state$1] = io._State.HEADER_START;
+            break;
+          }
+          case io._State.HEADER_START:
+          {
+            this[_headers] = new io._HttpHeaders(this.version);
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.HEADER_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state$1] = io._State.HEADER_ENDING;
+              this[_index$2] = dart.notNull(this[_index$2]) - 1;
+            } else {
+              this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+              this[_state$1] = io._State.HEADER_FIELD;
+            }
+            break;
+          }
+          case io._State.HEADER_FIELD:
+          {
+            if (byte == io._CharCode.COLON) {
+              this[_state$1] = io._State.HEADER_VALUE_START;
+            } else {
+              if (!dart.test(io._HttpParser._isTokenChar(byte))) {
+                dart.throw(new io.HttpException("Invalid header field name"));
+              }
+              this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+            }
+            break;
+          }
+          case io._State.HEADER_VALUE_START:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLDING_OR_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLD_OR_END;
+            } else if (byte != io._CharCode.SP && byte != io._CharCode.HT) {
+              this[_headerValue][dartx.add](byte);
+              this[_state$1] = io._State.HEADER_VALUE;
+            }
+            break;
+          }
+          case io._State.HEADER_VALUE:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLDING_OR_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLD_OR_END;
+            } else {
+              this[_headerValue][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.HEADER_VALUE_FOLDING_OR_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_state$1] = io._State.HEADER_VALUE_FOLD_OR_END;
+            break;
+          }
+          case io._State.HEADER_VALUE_FOLD_OR_END:
+          {
+            if (byte == io._CharCode.SP || byte == io._CharCode.HT) {
+              this[_state$1] = io._State.HEADER_VALUE_START;
+            } else {
+              let headerField = core.String.fromCharCodes(this[_headerField]);
+              let headerValue = core.String.fromCharCodes(this[_headerValue]);
+              if (headerField == "transfer-encoding" && dart.test(this[_caseInsensitiveCompare]("chunked"[dartx.codeUnits], this[_headerValue]))) {
+                this[_chunked] = true;
+              }
+              if (headerField == "connection") {
+                let tokens = io._HttpParser._tokenizeFieldValue(headerValue);
+                for (let i = 0; i < dart.notNull(tokens[dartx.length]); i++) {
+                  if (dart.test(this[_caseInsensitiveCompare]("upgrade"[dartx.codeUnits], tokens[dartx._get](i)[dartx.codeUnits]))) {
+                    this[_connectionUpgrade] = true;
+                  }
+                  this[_headers][_add$2](headerField, tokens[dartx._get](i));
+                }
+              } else {
+                this[_headers][_add$2](headerField, headerValue);
+              }
+              this[_headerField][dartx.clear]();
+              this[_headerValue][dartx.clear]();
+              if (byte == io._CharCode.CR) {
+                this[_state$1] = io._State.HEADER_ENDING;
+              } else if (byte == io._CharCode.LF) {
+                this[_state$1] = io._State.HEADER_ENDING;
+                this[_index$2] = dart.notNull(this[_index$2]) - 1;
+              } else {
+                this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+                this[_state$1] = io._State.HEADER_FIELD;
+              }
+            }
+            break;
+          }
+          case io._State.HEADER_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            if (dart.test(this[_headersEnd]())) {
+              return;
+            } else {
+              break;
+            }
+            return;
+          }
+          case io._State.CHUNK_SIZE_STARTING_CR:
+          {
+            this[_expect](byte, io._CharCode.CR);
+            this[_state$1] = io._State.CHUNK_SIZE_STARTING_LF;
+            break;
+          }
+          case io._State.CHUNK_SIZE_STARTING_LF:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_state$1] = io._State.CHUNK_SIZE;
+            break;
+          }
+          case io._State.CHUNK_SIZE:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.CHUNK_SIZE_ENDING;
+            } else if (byte == io._CharCode.SEMI_COLON) {
+              this[_state$1] = io._State.CHUNK_SIZE_EXTENSION;
+            } else {
+              let value = this[_expectHexDigit](byte);
+              this[_remainingContent] = dart.notNull(this[_remainingContent]) * 16 + dart.notNull(value);
+            }
+            break;
+          }
+          case io._State.CHUNK_SIZE_EXTENSION:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.CHUNK_SIZE_ENDING;
+            }
+            break;
+          }
+          case io._State.CHUNK_SIZE_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            if (dart.notNull(this[_remainingContent]) > 0) {
+              this[_state$1] = io._State.BODY;
+            } else {
+              this[_state$1] = io._State.CHUNKED_BODY_DONE_CR;
+            }
+            break;
+          }
+          case io._State.CHUNKED_BODY_DONE_CR:
+          {
+            this[_expect](byte, io._CharCode.CR);
+            this[_state$1] = io._State.CHUNKED_BODY_DONE_LF;
+            break;
+          }
+          case io._State.CHUNKED_BODY_DONE_LF:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_reset]();
+            this[_closeIncoming]();
+            break;
+          }
+          case io._State.BODY:
+          {
+            this[_index$2] = dart.notNull(this[_index$2]) - 1;
+            let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$2]);
+            if (dart.notNull(this[_remainingContent]) >= 0 && dart.notNull(dataAvailable) > dart.notNull(this[_remainingContent])) {
+              dataAvailable = this[_remainingContent];
+            }
+            let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$2]), dataAvailable);
+            this[_bodyController].add(data);
+            if (this[_remainingContent] != -1) {
+              this[_remainingContent] = dart.notNull(this[_remainingContent]) - dart.notNull(data[dartx.length]);
+            }
+            this[_index$2] = dart.notNull(this[_index$2]) + dart.notNull(data[dartx.length]);
+            if (this[_remainingContent] == 0) {
+              if (!dart.test(this[_chunked])) {
+                this[_reset]();
+                this[_closeIncoming]();
+              } else {
+                this[_state$1] = io._State.CHUNK_SIZE_STARTING_CR;
+              }
+            }
+            break;
+          }
+          case io._State.FAILURE:
+          {
+            dart.assert(false);
+            break;
+          }
+          default:
+          {
+            dart.assert(false);
+            break;
+          }
+        }
+      }
+      this[_parserCalled] = false;
+      if (this[_buffer$] != null && this[_index$2] == this[_buffer$][dartx.length]) {
+        this[_releaseBuffer]();
+        if (this[_state$1] != io._State.UPGRADED && this[_state$1] != io._State.FAILURE) {
+          this[_socketSubscription].resume();
+        }
+      }
+    }
+    [_onData$](buffer) {
+      this[_socketSubscription].pause();
+      dart.assert(this[_buffer$] == null);
+      this[_buffer$] = typed_data.Uint8List._check(buffer);
+      this[_index$2] = 0;
+      this[_parse]();
+    }
+    [_onDone$]() {
+      this[_socketSubscription] = null;
+      if (this[_state$1] == io._State.CLOSED || this[_state$1] == io._State.FAILURE) return;
+      if (this[_incoming] != null) {
+        if (this[_state$1] != io._State.UPGRADED && !(this[_state$1] == io._State.START && !dart.test(this[_requestParser])) && !(this[_state$1] == io._State.BODY && !dart.test(this[_chunked]) && this[_transferLength] == -1)) {
+          this[_bodyController].addError(new io.HttpException("Connection closed while receiving data"));
+        }
+        this[_closeIncoming](true);
+        this[_controller$0].close();
+        return;
+      }
+      if (this[_state$1] == io._State.START) {
+        if (!dart.test(this[_requestParser])) {
+          this[_reportError](new io.HttpException("Connection closed before full header was received"));
+        }
+        this[_controller$0].close();
+        return;
+      }
+      if (this[_state$1] == io._State.UPGRADED) {
+        this[_controller$0].close();
+        return;
+      }
+      if (dart.notNull(this[_state$1]) < io._State.FIRST_BODY_STATE) {
+        this[_state$1] = io._State.FAILURE;
+        this[_reportError](new io.HttpException("Connection closed before full header was received"));
+        this[_controller$0].close();
+        return;
+      }
+      if (!dart.test(this[_chunked]) && this[_transferLength] == -1) {
+        this[_state$1] = io._State.CLOSED;
+      } else {
+        this[_state$1] = io._State.FAILURE;
+        this[_reportError](new io.HttpException("Connection closed before full body was received"));
+      }
+      this[_controller$0].close();
+    }
+    get version() {
+      switch (this[_httpVersion]) {
+        case io._HttpVersion.HTTP10:
+        {
+          return "1.0";
+        }
+        case io._HttpVersion.HTTP11:
+        {
+          return "1.1";
+        }
+      }
+      return null;
+    }
+    get messageType() {
+      return this[_messageType];
+    }
+    get transferLength() {
+      return this[_transferLength];
+    }
+    get upgrade() {
+      return dart.test(this[_connectionUpgrade]) && this[_state$1] == io._State.UPGRADED;
+    }
+    get persistentConnection() {
+      return this[_persistentConnection];
+    }
+    set isHead(value) {
+      if (dart.test(value)) this[_noMessageBody] = true;
+    }
+    detachIncoming() {
+      this[_state$1] = io._State.UPGRADED;
+      return new io._HttpDetachedIncoming(this[_socketSubscription], this.readUnparsedData());
+    }
+    readUnparsedData() {
+      if (this[_buffer$] == null) return null;
+      if (this[_index$2] == this[_buffer$][dartx.length]) return null;
+      let result = this[_buffer$][dartx.sublist](this[_index$2]);
+      this[_releaseBuffer]();
+      return result;
+    }
+    [_reset]() {
+      if (this[_state$1] == io._State.UPGRADED) return;
+      this[_state$1] = io._State.START;
+      this[_messageType] = io._MessageType.UNDETERMINED;
+      this[_headerField][dartx.clear]();
+      this[_headerValue][dartx.clear]();
+      this[_method$][dartx.clear]();
+      this[_uri_or_reason_phrase][dartx.clear]();
+      this[_statusCode] = 0;
+      this[_statusCodeLength] = 0;
+      this[_httpVersion] = io._HttpVersion.UNDETERMINED;
+      this[_transferLength] = -1;
+      this[_persistentConnection] = false;
+      this[_connectionUpgrade] = false;
+      this[_chunked] = false;
+      this[_noMessageBody] = false;
+      this[_remainingContent] = -1;
+      this[_headers] = null;
+    }
+    [_releaseBuffer]() {
+      this[_buffer$] = null;
+      this[_index$2] = null;
+    }
+    static _isTokenChar(byte) {
+      return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 && !dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte));
+    }
+    static _isValueChar(byte) {
+      return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 || byte == io._CharCode.SP || byte == io._CharCode.HT;
+    }
+    static _tokenizeFieldValue(headerValue) {
+      let tokens = ListOfString().new();
+      let start = 0;
+      let index = 0;
+      while (index < dart.notNull(headerValue[dartx.length])) {
+        if (headerValue[dartx._get](index) == ",") {
+          tokens[dartx.add](headerValue[dartx.substring](start, index));
+          start = index + 1;
+        } else if (headerValue[dartx._get](index) == " " || headerValue[dartx._get](index) == "\t") {
+          start++;
+        }
+        index++;
+      }
+      tokens[dartx.add](headerValue[dartx.substring](start, index));
+      return tokens;
+    }
+    static _toLowerCaseByte(x) {
+      return (dart.notNull(x) - 65 & 127) < 26 ? (dart.notNull(x) | 32) >>> 0 : x;
+    }
+    [_caseInsensitiveCompare](expected, value) {
+      if (expected[dartx.length] != value[dartx.length]) return false;
+      for (let i = 0; i < dart.notNull(expected[dartx.length]); i++) {
+        if (expected[dartx._get](i) != io._HttpParser._toLowerCaseByte(value[dartx._get](i))) return false;
+      }
+      return true;
+    }
+    [_expect](val1, val2) {
+      if (val1 != val2) {
+        dart.throw(new io.HttpException("Failed to parse HTTP"));
+      }
+    }
+    [_expectHexDigit](byte) {
+      if (48 <= dart.notNull(byte) && dart.notNull(byte) <= 57) {
+        return dart.notNull(byte) - 48;
+      } else if (65 <= dart.notNull(byte) && dart.notNull(byte) <= 70) {
+        return dart.notNull(byte) - 65 + 10;
+      } else if (97 <= dart.notNull(byte) && dart.notNull(byte) <= 102) {
+        return dart.notNull(byte) - 97 + 10;
+      } else {
+        dart.throw(new io.HttpException("Failed to parse HTTP"));
+      }
+    }
+    [_createIncoming](transferLength) {
+      dart.assert(this[_incoming] == null);
+      dart.assert(this[_bodyController] == null);
+      dart.assert(!dart.test(this[_bodyPaused]));
+      let incoming = null;
+      this[_bodyController] = StreamControllerOfListOfint().new({sync: true, onListen: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          dart.assert(this[_bodyPaused]);
+          this[_bodyPaused] = false;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onPause: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          dart.assert(!dart.test(this[_bodyPaused]));
+          this[_bodyPaused] = true;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onResume: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          dart.assert(this[_bodyPaused]);
+          this[_bodyPaused] = false;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onCancel: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          if (this[_socketSubscription] != null) {
+            this[_socketSubscription].cancel();
+          }
+          this[_closeIncoming](true);
+          this[_controller$0].close();
+        }, VoidToNull())});
+      incoming = this[_incoming] = new io._HttpIncoming(this[_headers], transferLength, this[_bodyController].stream);
+      this[_bodyPaused] = true;
+      this[_pauseStateChanged]();
+    }
+    [_closeIncoming](closing) {
+      if (closing === void 0) closing = false;
+      if (this[_incoming] == null) return;
+      let tmp = this[_incoming];
+      tmp.close(closing);
+      this[_incoming] = null;
+      if (this[_bodyController] != null) {
+        this[_bodyController].close();
+        this[_bodyController] = null;
+      }
+      this[_bodyPaused] = false;
+      this[_pauseStateChanged]();
+    }
+    [_pauseStateChanged]() {
+      if (this[_incoming] != null) {
+        if (!dart.test(this[_bodyPaused]) && !dart.test(this[_parserCalled])) {
+          this[_parse]();
+        }
+      } else {
+        if (!dart.test(this[_paused]) && !dart.test(this[_parserCalled])) {
+          this[_parse]();
+        }
+      }
+    }
+    [_reportError](error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      if (this[_socketSubscription] != null) this[_socketSubscription].cancel();
+      this[_state$1] = io._State.FAILURE;
+      this[_controller$0].addError(error, core.StackTrace._check(stackTrace));
+      this[_controller$0].close();
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpParser);
+  dart.defineNamedConstructor(io._HttpParser, '_');
+  dart.setSignature(io._HttpParser, {
+    constructors: () => ({
+      requestParser: dart.definiteFunctionType(io._HttpParser, []),
+      responseParser: dart.definiteFunctionType(io._HttpParser, []),
+      _: dart.definiteFunctionType(io._HttpParser, [core.bool])
+    }),
+    fields: () => ({
+      [_parserCalled]: core.bool,
+      [_buffer$]: typed_data.Uint8List,
+      [_index$2]: core.int,
+      [_requestParser]: core.bool,
+      [_state$1]: core.int,
+      [_httpVersionIndex]: core.int,
+      [_messageType]: core.int,
+      [_statusCode]: core.int,
+      [_statusCodeLength]: core.int,
+      [_method$]: ListOfint(),
+      [_uri_or_reason_phrase]: ListOfint(),
+      [_headerField]: ListOfint(),
+      [_headerValue]: ListOfint(),
+      [_httpVersion]: core.int,
+      [_transferLength]: core.int,
+      [_persistentConnection]: core.bool,
+      [_connectionUpgrade]: core.bool,
+      [_chunked]: core.bool,
+      [_noMessageBody]: core.bool,
+      [_remainingContent]: core.int,
+      [_headers]: io._HttpHeaders,
+      [_incoming]: io._HttpIncoming,
+      [_socketSubscription]: async.StreamSubscription,
+      [_paused]: core.bool,
+      [_bodyPaused]: core.bool,
+      [_controller$0]: StreamControllerOf_HttpIncoming(),
+      [_bodyController]: StreamControllerOfListOfint()
+    }),
+    getters: () => ({
+      version: dart.definiteFunctionType(core.String, []),
+      messageType: dart.definiteFunctionType(core.int, []),
+      transferLength: dart.definiteFunctionType(core.int, []),
+      upgrade: dart.definiteFunctionType(core.bool, []),
+      persistentConnection: dart.definiteFunctionType(core.bool, [])
+    }),
+    setters: () => ({isHead: dart.definiteFunctionType(dart.void, [core.bool])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io._HttpIncoming), [_HttpIncomingTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      listenToStream: dart.definiteFunctionType(dart.void, [StreamOfListOfint()]),
+      [_parse]: dart.definiteFunctionType(dart.void, []),
+      [_headersEnd]: dart.definiteFunctionType(core.bool, []),
+      [_doParse]: dart.definiteFunctionType(dart.void, []),
+      [_onData$]: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      [_onDone$]: dart.definiteFunctionType(dart.void, []),
+      detachIncoming: dart.definiteFunctionType(io._HttpDetachedIncoming, []),
+      readUnparsedData: dart.definiteFunctionType(core.List$(core.int), []),
+      [_reset]: dart.definiteFunctionType(dart.void, []),
+      [_releaseBuffer]: dart.definiteFunctionType(dart.void, []),
+      [_caseInsensitiveCompare]: dart.definiteFunctionType(core.bool, [ListOfint(), ListOfint()]),
+      [_expect]: dart.definiteFunctionType(core.int, [core.int, core.int]),
+      [_expectHexDigit]: dart.definiteFunctionType(core.int, [core.int]),
+      [_createIncoming]: dart.definiteFunctionType(dart.void, [core.int]),
+      [_closeIncoming]: dart.definiteFunctionType(dart.void, [], [core.bool]),
+      [_pauseStateChanged]: dart.definiteFunctionType(dart.void, []),
+      [_reportError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [dart.dynamic])
+    }),
+    statics: () => ({
+      _isTokenChar: dart.definiteFunctionType(core.bool, [core.int]),
+      _isValueChar: dart.definiteFunctionType(core.bool, [core.int]),
+      _tokenizeFieldValue: dart.definiteFunctionType(core.List$(core.String), [core.String]),
+      _toLowerCaseByte: dart.definiteFunctionType(core.int, [core.int])
+    }),
+    names: ['_isTokenChar', '_isValueChar', '_tokenizeFieldValue', '_toLowerCaseByte']
+  });
+  io._DART_SESSION_ID = "DARTSESSID";
+  const _data$ = Symbol('_data');
+  const _lastSeen = Symbol('_lastSeen');
+  const _timeoutCallback = Symbol('_timeoutCallback');
+  const _prev = Symbol('_prev');
+  const _next$1 = Symbol('_next');
+  const _removeFromTimeoutQueue = Symbol('_removeFromTimeoutQueue');
+  const _sessions = Symbol('_sessions');
+  const _bumpToEnd = Symbol('_bumpToEnd');
+  io._HttpSession = class _HttpSession extends core.Object {
+    new(sessionManager, id) {
+      this[_data$] = collection.HashMap.new();
+      this[_sessionManager] = sessionManager;
+      this.id = id;
+      this[_lastSeen] = new core.DateTime.now();
+      this[_destroyed] = false;
+      this[_isNew] = true;
+      this[_timeoutCallback] = null;
+      this[_prev] = null;
+      this[_next$1] = null;
+    }
+    destroy() {
+      this[_destroyed] = true;
+      this[_sessionManager][_removeFromTimeoutQueue](this);
+      this[_sessionManager][_sessions][dartx.remove](this.id);
+    }
+    [_markSeen]() {
+      this[_lastSeen] = new core.DateTime.now();
+      this[_sessionManager][_bumpToEnd](this);
+    }
+    get lastSeen() {
+      return this[_lastSeen];
+    }
+    get isNew() {
+      return this[_isNew];
+    }
+    set onTimeout(callback) {
+      this[_timeoutCallback] = callback;
+    }
+    containsValue(value) {
+      return this[_data$][dartx.containsValue](value);
+    }
+    containsKey(key) {
+      return this[_data$][dartx.containsKey](key);
+    }
+    _get(key) {
+      return this[_data$][dartx._get](key);
+    }
+    _set(key, value) {
+      this[_data$][dartx._set](key, value);
+      return value;
+    }
+    putIfAbsent(key, ifAbsent) {
+      return this[_data$][dartx.putIfAbsent](key, ifAbsent);
+    }
+    addAll(other) {
+      return this[_data$][dartx.addAll](other);
+    }
+    remove(key) {
+      return this[_data$][dartx.remove](key);
+    }
+    clear() {
+      this[_data$][dartx.clear]();
+    }
+    forEach(f) {
+      this[_data$][dartx.forEach](f);
+    }
+    get keys() {
+      return this[_data$][dartx.keys];
+    }
+    get values() {
+      return this[_data$][dartx.values];
+    }
+    get length() {
+      return this[_data$][dartx.length];
+    }
+    get isEmpty() {
+      return this[_data$][dartx.isEmpty];
+    }
+    get isNotEmpty() {
+      return this[_data$][dartx.isNotEmpty];
+    }
+    toString() {
+      return dart.str`HttpSession id:${this.id} ${this[_data$]}`;
+    }
+  };
+  io._HttpSession[dart.implements] = () => [io.HttpSession];
+  dart.setSignature(io._HttpSession, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpSession, [io._HttpSessionManager, core.String])}),
+    fields: () => ({
+      [_destroyed]: core.bool,
+      [_isNew]: core.bool,
+      [_lastSeen]: core.DateTime,
+      [_timeoutCallback]: core.Function,
+      [_sessionManager]: io._HttpSessionManager,
+      [_prev]: io._HttpSession,
+      [_next$1]: io._HttpSession,
+      id: core.String,
+      [_data$]: core.Map
+    }),
+    getters: () => ({
+      lastSeen: dart.definiteFunctionType(core.DateTime, []),
+      isNew: dart.definiteFunctionType(core.bool, []),
+      keys: dart.definiteFunctionType(core.Iterable, []),
+      values: dart.definiteFunctionType(core.Iterable, []),
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    setters: () => ({onTimeout: dart.definiteFunctionType(dart.void, [VoidTovoid()])}),
+    methods: () => ({
+      destroy: dart.definiteFunctionType(dart.void, []),
+      [_markSeen]: dart.definiteFunctionType(dart.void, []),
+      containsValue: dart.definiteFunctionType(core.bool, [core.Object]),
+      containsKey: dart.definiteFunctionType(core.bool, [core.Object]),
+      _get: dart.definiteFunctionType(dart.dynamic, [core.Object]),
+      _set: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic]),
+      putIfAbsent: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, VoidTodynamic()]),
+      addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+      remove: dart.definiteFunctionType(dart.dynamic, [core.Object]),
+      clear: dart.definiteFunctionType(dart.void, []),
+      forEach: dart.definiteFunctionType(dart.void, [dynamicAnddynamicTovoid()])
+    })
+  });
+  dart.defineExtensionMembers(io._HttpSession, [
+    'containsValue',
+    'containsKey',
+    '_get',
+    '_set',
+    'putIfAbsent',
+    'addAll',
+    'remove',
+    'clear',
+    'forEach',
+    'keys',
+    'values',
+    'length',
+    'isEmpty',
+    'isNotEmpty'
+  ]);
+  const _sessionTimeout = Symbol('_sessionTimeout');
+  const _head$ = Symbol('_head');
+  const _tail$ = Symbol('_tail');
+  const _timer = Symbol('_timer');
+  const _addToTimeoutQueue = Symbol('_addToTimeoutQueue');
+  const _stopTimer = Symbol('_stopTimer');
+  const _startTimer = Symbol('_startTimer');
+  const _timerTimeout = Symbol('_timerTimeout');
+  io._HttpSessionManager = class _HttpSessionManager extends core.Object {
+    new() {
+      this[_sessions] = dart.map({}, core.String, io._HttpSession);
+      this[_sessionTimeout] = 20 * 60;
+      this[_head$] = null;
+      this[_tail$] = null;
+      this[_timer] = null;
+    }
+    createSessionId() {
+      let _KEY_LENGTH = 16;
+      let data = io._IOCrypto.getRandomBytes(_KEY_LENGTH);
+      return io._CryptoUtils.bytesToHex(data);
+    }
+    getSession(id) {
+      return this[_sessions][dartx._get](id);
+    }
+    createSession() {
+      let id = this.createSessionId();
+      while (dart.test(this[_sessions][dartx.containsKey](id))) {
+        id = this.createSessionId();
+      }
+      let session = this[_sessions][dartx._set](id, new io._HttpSession(this, id));
+      this[_addToTimeoutQueue](session);
+      return session;
+    }
+    set sessionTimeout(timeout) {
+      this[_sessionTimeout] = timeout;
+      this[_stopTimer]();
+      this[_startTimer]();
+    }
+    close() {
+      this[_stopTimer]();
+    }
+    [_bumpToEnd](session) {
+      this[_removeFromTimeoutQueue](session);
+      this[_addToTimeoutQueue](session);
+    }
+    [_addToTimeoutQueue](session) {
+      if (this[_head$] == null) {
+        dart.assert(this[_tail$] == null);
+        this[_tail$] = this[_head$] = session;
+        this[_startTimer]();
+      } else {
+        dart.assert(this[_timer] != null);
+        dart.assert(this[_tail$] != null);
+        this[_tail$][_next$1] = session;
+        session[_prev] = this[_tail$];
+        this[_tail$] = session;
+      }
+    }
+    [_removeFromTimeoutQueue](session) {
+      if (session[_next$1] != null) {
+        session[_next$1][_prev] = session[_prev];
+      }
+      if (session[_prev] != null) {
+        session[_prev][_next$1] = session[_next$1];
+      }
+      if (dart.equals(this[_head$], session)) {
+        this[_head$] = session[_next$1];
+        this[_stopTimer]();
+        this[_startTimer]();
+      }
+      if (dart.equals(this[_tail$], session)) {
+        this[_tail$] = session[_prev];
+      }
+      session[_next$1] = session[_prev] = null;
+    }
+    [_timerTimeout]() {
+      this[_stopTimer]();
+      dart.assert(this[_head$] != null);
+      let session = this[_head$];
+      session.destroy();
+      if (session[_timeoutCallback] != null) {
+        dart.dsend(session, _timeoutCallback);
+      }
+    }
+    [_startTimer]() {
+      dart.assert(this[_timer] == null);
+      if (this[_head$] != null) {
+        let seconds = new core.DateTime.now().difference(this[_head$].lastSeen).inSeconds;
+        this[_timer] = async.Timer.new(new core.Duration({seconds: dart.notNull(this[_sessionTimeout]) - dart.notNull(seconds)}), dart.bind(this, _timerTimeout));
+      }
+    }
+    [_stopTimer]() {
+      if (this[_timer] != null) {
+        this[_timer].cancel();
+        this[_timer] = null;
+      }
+    }
+  };
+  dart.setSignature(io._HttpSessionManager, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpSessionManager, [])}),
+    fields: () => ({
+      [_sessions]: MapOfString$_HttpSession(),
+      [_sessionTimeout]: core.int,
+      [_head$]: io._HttpSession,
+      [_tail$]: io._HttpSession,
+      [_timer]: async.Timer
+    }),
+    setters: () => ({sessionTimeout: dart.definiteFunctionType(dart.void, [core.int])}),
+    methods: () => ({
+      createSessionId: dart.definiteFunctionType(core.String, []),
+      getSession: dart.definiteFunctionType(io._HttpSession, [core.String]),
+      createSession: dart.definiteFunctionType(io._HttpSession, []),
+      close: dart.definiteFunctionType(dart.void, []),
+      [_bumpToEnd]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+      [_addToTimeoutQueue]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+      [_removeFromTimeoutQueue]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+      [_timerTimeout]: dart.definiteFunctionType(dart.void, []),
+      [_startTimer]: dart.definiteFunctionType(dart.void, []),
+      [_stopTimer]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._IOResourceInfo = class _IOResourceInfo extends core.Object {
+    static get timestamp() {
+      return dart.notNull(io._IOResourceInfo._startTime) + dart.notNull(io._IOResourceInfo._sw.elapsedMicroseconds) / 1000;
+    }
+    new(type) {
+      this.type = type;
+      this.id = io._IOResourceInfo.getNextID();
+    }
+    get referenceValueMap() {
+      return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.String);
+    }
+    static getNextID() {
+      return (() => {
+        let x = io._IOResourceInfo._count;
+        io._IOResourceInfo._count = dart.notNull(x) + 1;
+        return x;
+      })();
+    }
+  };
+  dart.setSignature(io._IOResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._IOResourceInfo, [core.String])}),
+    fields: () => ({
+      type: core.String,
+      id: core.int
+    }),
+    getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    sfields: () => ({
+      _count: core.int,
+      _sw: core.Stopwatch,
+      _startTime: core.int
+    }),
+    sgetters: () => ({timestamp: dart.definiteFunctionType(core.double, [])}),
+    statics: () => ({getNextID: dart.definiteFunctionType(core.int, [])}),
+    names: ['getNextID']
+  });
+  io._IOResourceInfo._count = 0;
+  dart.defineLazy(io._IOResourceInfo, {
+    get _sw() {
+      return (() => {
+        let _ = new core.Stopwatch();
+        _.start();
+        return _;
+      })();
+    },
+    get _startTime() {
+      return new core.DateTime.now().millisecondsSinceEpoch;
+    }
+  });
+  io._ReadWriteResourceInfo = class _ReadWriteResourceInfo extends io._IOResourceInfo {
+    addRead(bytes) {
+      this.totalRead = dart.notNull(this.totalRead) + dart.notNull(bytes);
+      this.readCount = dart.notNull(this.readCount) + 1;
+      this.lastRead = io._IOResourceInfo.timestamp;
+    }
+    didRead() {
+      this.addRead(0);
+    }
+    addWrite(bytes) {
+      this.totalWritten = dart.notNull(this.totalWritten) + dart.notNull(bytes);
+      this.writeCount = dart.notNull(this.writeCount) + 1;
+      this.lastWrite = io._IOResourceInfo.timestamp;
+    }
+    new(type) {
+      this.totalRead = 0;
+      this.totalWritten = 0;
+      this.readCount = 0;
+      this.writeCount = 0;
+      this.lastRead = 0.0;
+      this.lastWrite = 0.0;
+      super.new(type);
+    }
+    get fullValueMap() {
+      return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.String);
+    }
+  };
+  dart.setSignature(io._ReadWriteResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ReadWriteResourceInfo, [core.String])}),
+    fields: () => ({
+      totalRead: core.int,
+      totalWritten: core.int,
+      readCount: core.int,
+      writeCount: core.int,
+      lastRead: core.double,
+      lastWrite: core.double
+    }),
+    getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    methods: () => ({
+      addRead: dart.definiteFunctionType(dart.void, [core.int]),
+      didRead: dart.definiteFunctionType(dart.void, []),
+      addWrite: dart.definiteFunctionType(dart.void, [core.int])
+    })
+  });
+  io._FileResourceInfo = class _FileResourceInfo extends io._ReadWriteResourceInfo {
+    new(file) {
+      this.file = file;
+      super.new(io._FileResourceInfo.TYPE);
+      io._FileResourceInfo.FileOpened(this);
+    }
+    static FileOpened(info) {
+      dart.assert(!dart.test(io._FileResourceInfo.openFiles[dartx.containsKey](info.id)));
+      io._FileResourceInfo.openFiles[dartx._set](info.id, info);
+    }
+    static FileClosed(info) {
+      dart.assert(io._FileResourceInfo.openFiles[dartx.containsKey](info.id));
+      io._FileResourceInfo.openFiles[dartx.remove](info.id);
+    }
+    static getOpenFilesList() {
+      return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$String())));
+    }
+    static getOpenFiles(func, params) {
+      dart.assert(dart.equals(func, 'ext.dart.io.getOpenFiles'));
+      let data = dart.map({type: '_openfiles', data: io._FileResourceInfo.getOpenFilesList()}, core.String, core.Object);
+      let json = convert.JSON.encode(data);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    getFileInfoMap() {
+      let result = this.fullValueMap;
+      return result;
+    }
+    static getFileInfoMapByID(func, params) {
+      dart.assert(dart.dsend(params, 'containsKey', 'id'));
+      let id = core.int.parse(core.String._check(dart.dindex(params, 'id')));
+      let result = dart.test(io._FileResourceInfo.openFiles[dartx.containsKey](id)) ? io._FileResourceInfo.openFiles[dartx._get](id).getFileInfoMap() : dart.map();
+      let json = convert.JSON.encode(result);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    get name() {
+      return dart.str`${dart.dload(this.file, 'path')}`;
+    }
+  };
+  dart.setSignature(io._FileResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._FileResourceInfo, [dart.dynamic])}),
+    fields: () => ({file: dart.dynamic}),
+    getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+    methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    sfields: () => ({
+      TYPE: core.String,
+      openFiles: MapOfint$_FileResourceInfo()
+    }),
+    statics: () => ({
+      FileOpened: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
+      FileClosed: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
+      getOpenFilesList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+      getOpenFiles: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic]),
+      getFileInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic])
+    }),
+    names: ['FileOpened', 'FileClosed', 'getOpenFilesList', 'getOpenFiles', 'getFileInfoMapByID']
+  });
+  io._FileResourceInfo.TYPE = '_file';
+  dart.defineLazy(io._FileResourceInfo, {
+    get openFiles() {
+      return MapOfint$_FileResourceInfo().new();
+    },
+    set openFiles(_) {}
+  });
+  const _arguments$0 = Symbol('_arguments');
+  const _workingDirectory = Symbol('_workingDirectory');
+  io._ProcessResourceInfo = class _ProcessResourceInfo extends io._IOResourceInfo {
+    new(process) {
+      this.process = process;
+      this.startedAt = io._IOResourceInfo.timestamp;
+      super.new(io._ProcessResourceInfo.TYPE);
+      io._ProcessResourceInfo.ProcessStarted(this);
+    }
+    get name() {
+      return core.String._check(dart.dload(this.process, _path$));
+    }
+    stopped() {
+      io._ProcessResourceInfo.ProcessStopped(this);
+    }
+    get fullValueMap() {
+      return dart.map({type: this.type, id: this.id, name: this.name, pid: core.String._check(dart.dload(this.process, 'pid')), startedAt: this.startedAt, arguments: core.String._check(dart.dload(this.process, _arguments$0)), workingDirectory: core.String._check(dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory))}, core.String, core.String);
+    }
+    static ProcessStarted(info) {
+      dart.assert(!dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id)));
+      io._ProcessResourceInfo.startedProcesses[dartx._set](info.id, info);
+    }
+    static ProcessStopped(info) {
+      dart.assert(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id));
+      io._ProcessResourceInfo.startedProcesses[dartx.remove](info.id);
+    }
+    static getStartedProcessesList() {
+      return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$String())));
+    }
+    static getStartedProcesses(func, params) {
+      dart.assert(func == 'ext.dart.io.getProcesses');
+      let data = dart.map({type: '_startedprocesses', data: io._ProcessResourceInfo.getStartedProcessesList()}, core.String, core.Object);
+      let json = convert.JSON.encode(data);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    static getProcessInfoMapById(func, params) {
+      let id = core.int.parse(params[dartx._get]('id'));
+      let result = dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](id)) ? io._ProcessResourceInfo.startedProcesses[dartx._get](id).fullValueMap : dart.map();
+      let json = convert.JSON.encode(result);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+  };
+  dart.setSignature(io._ProcessResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ProcessResourceInfo, [dart.dynamic])}),
+    fields: () => ({
+      process: dart.dynamic,
+      startedAt: core.double
+    }),
+    getters: () => ({
+      name: dart.definiteFunctionType(core.String, []),
+      fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+    }),
+    methods: () => ({stopped: dart.definiteFunctionType(dart.void, [])}),
+    sfields: () => ({
+      TYPE: core.String,
+      startedProcesses: MapOfint$_ProcessResourceInfo()
+    }),
+    statics: () => ({
+      ProcessStarted: dart.definiteFunctionType(dart.dynamic, [io._ProcessResourceInfo]),
+      ProcessStopped: dart.definiteFunctionType(dart.dynamic, [io._ProcessResourceInfo]),
+      getStartedProcessesList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+      getStartedProcesses: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
+      getProcessInfoMapById: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()])
+    }),
+    names: ['ProcessStarted', 'ProcessStopped', 'getStartedProcessesList', 'getStartedProcesses', 'getProcessInfoMapById']
+  });
+  io._ProcessResourceInfo.TYPE = '_process';
+  dart.defineLazy(io._ProcessResourceInfo, {
+    get startedProcesses() {
+      return MapOfint$_ProcessResourceInfo().new();
+    },
+    set startedProcesses(_) {}
+  });
+  io._SocketResourceInfo = class _SocketResourceInfo extends io._ReadWriteResourceInfo {
+    new(socket) {
+      this.socket = socket;
+      super.new(io._SocketResourceInfo.TYPE);
+      io._SocketResourceInfo.SocketOpened(this);
+    }
+    get name() {
+      if (dart.test(dart.dload(this.socket, 'isListening'))) {
+        return dart.str`listening:${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}`;
+      }
+      let remote = '';
+      try {
+        let remoteHost = dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host');
+        let remotePort = dart.dload(this.socket, 'remotePort');
+        remote = dart.str` -> ${remoteHost}:${remotePort}`;
+      } catch (e) {
+      }
+
+      return dart.str`${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}${remote}`;
+    }
+    static getOpenSocketsList() {
+      return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$String())));
+    }
+    getSocketInfoMap() {
+      let result = this.fullValueMap;
+      result[dartx._set]('socketType', dart.test(dart.dload(this.socket, 'isTcp')) ? io._SocketResourceInfo.TCP_STRING : io._SocketResourceInfo.UDP_STRING);
+      result[dartx._set]('listening', core.String._check(dart.dload(this.socket, 'isListening')));
+      result[dartx._set]('host', core.String._check(dart.dload(dart.dload(this.socket, 'address'), 'host')));
+      result[dartx._set]('port', core.String._check(dart.dload(this.socket, 'port')));
+      if (!dart.test(dart.dload(this.socket, 'isListening'))) {
+        try {
+          result[dartx._set]('remoteHost', core.String._check(dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host')));
+          result[dartx._set]('remotePort', core.String._check(dart.dload(this.socket, 'remotePort')));
+        } catch (e) {
+          result[dartx._set]('remotePort', 'NA');
+          result[dartx._set]('remoteHost', 'NA');
+        }
+
+      } else {
+        result[dartx._set]('remotePort', 'NA');
+        result[dartx._set]('remoteHost', 'NA');
+      }
+      result[dartx._set]('addressType', core.String._check(dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name')));
+      return result;
+    }
+    static getSocketInfoMapByID(func, params) {
+      dart.assert(params[dartx.containsKey]('id'));
+      let id = core.int.parse(params[dartx._get]('id'));
+      let result = dart.test(io._SocketResourceInfo.openSockets[dartx.containsKey](id)) ? io._SocketResourceInfo.openSockets[dartx._get](id).getSocketInfoMap() : dart.map();
+      let json = convert.JSON.encode(result);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    static getOpenSockets(func, params) {
+      dart.assert(dart.equals(func, 'ext.dart.io.getOpenSockets'));
+      let data = dart.map({type: '_opensockets', data: io._SocketResourceInfo.getOpenSocketsList()}, core.String, core.Object);
+      let json = convert.JSON.encode(data);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    static SocketOpened(info) {
+      dart.assert(!dart.test(io._SocketResourceInfo.openSockets[dartx.containsKey](info.id)));
+      io._SocketResourceInfo.openSockets[dartx._set](info.id, info);
+    }
+    static SocketClosed(info) {
+      dart.assert(io._SocketResourceInfo.openSockets[dartx.containsKey](info.id));
+      io._SocketResourceInfo.openSockets[dartx.remove](info.id);
+    }
+  };
+  dart.setSignature(io._SocketResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SocketResourceInfo, [dart.dynamic])}),
+    fields: () => ({socket: dart.dynamic}),
+    getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+    methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    sfields: () => ({
+      TCP_STRING: core.String,
+      UDP_STRING: core.String,
+      TYPE: core.String,
+      openSockets: MapOfint$_SocketResourceInfo()
+    }),
+    statics: () => ({
+      getOpenSocketsList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+      getSocketInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
+      getOpenSockets: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic]),
+      SocketOpened: dart.definiteFunctionType(dart.dynamic, [io._SocketResourceInfo]),
+      SocketClosed: dart.definiteFunctionType(dart.dynamic, [io._SocketResourceInfo])
+    }),
+    names: ['getOpenSocketsList', 'getSocketInfoMapByID', 'getOpenSockets', 'SocketOpened', 'SocketClosed']
+  });
+  io._SocketResourceInfo.TCP_STRING = 'TCP';
+  io._SocketResourceInfo.UDP_STRING = 'UDP';
+  io._SocketResourceInfo.TYPE = '_socket';
+  dart.defineLazy(io._SocketResourceInfo, {
+    get openSockets() {
+      return MapOfint$_SocketResourceInfo().new();
+    },
+    set openSockets(_) {}
+  });
+  io.IOSink = class IOSink extends core.Object {
+    static new(target, opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return new io._IOSinkImpl(target, encoding);
+    }
+  };
+  io.IOSink[dart.implements] = () => [StreamSinkOfListOfint(), core.StringSink];
+  dart.setSignature(io.IOSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io.IOSink, [StreamConsumerOfListOfint()], {encoding: convert.Encoding})}),
+    fields: () => ({encoding: convert.Encoding})
+  });
+  io._FILE_EXISTS = 0;
+  io._FILE_CREATE = 1;
+  io._FILE_DELETE = 2;
+  io._FILE_RENAME = 3;
+  io._FILE_COPY = 4;
+  io._FILE_OPEN = 5;
+  io._FILE_RESOLVE_SYMBOLIC_LINKS = 6;
+  io._FILE_CLOSE = 7;
+  io._FILE_POSITION = 8;
+  io._FILE_SET_POSITION = 9;
+  io._FILE_TRUNCATE = 10;
+  io._FILE_LENGTH = 11;
+  io._FILE_LENGTH_FROM_PATH = 12;
+  io._FILE_LAST_MODIFIED = 13;
+  io._FILE_FLUSH = 14;
+  io._FILE_READ_BYTE = 15;
+  io._FILE_WRITE_BYTE = 16;
+  io._FILE_READ = 17;
+  io._FILE_READ_INTO = 18;
+  io._FILE_WRITE_FROM = 19;
+  io._FILE_CREATE_LINK = 20;
+  io._FILE_DELETE_LINK = 21;
+  io._FILE_RENAME_LINK = 22;
+  io._FILE_LINK_TARGET = 23;
+  io._FILE_TYPE = 24;
+  io._FILE_IDENTICAL = 25;
+  io._FILE_STAT = 26;
+  io._FILE_LOCK = 27;
+  io._SOCKET_LOOKUP = 28;
+  io._SOCKET_LIST_INTERFACES = 29;
+  io._SOCKET_REVERSE_LOOKUP = 30;
+  io._DIRECTORY_CREATE = 31;
+  io._DIRECTORY_DELETE = 32;
+  io._DIRECTORY_EXISTS = 33;
+  io._DIRECTORY_CREATE_TEMP = 34;
+  io._DIRECTORY_LIST_START = 35;
+  io._DIRECTORY_LIST_NEXT = 36;
+  io._DIRECTORY_LIST_STOP = 37;
+  io._DIRECTORY_RENAME = 38;
+  io._SSL_PROCESS_FILTER = 39;
+  io._IOService = class _IOService extends core.Object {
+    static _dispatch(request, data) {
+      dart.throw(new core.UnsupportedError("_IOService._dispatch"));
+    }
+  };
+  dart.setSignature(io._IOService, {
+    statics: () => ({_dispatch: dart.definiteFunctionType(async.Future, [core.int, core.List])}),
+    names: ['_dispatch']
+  });
+  io.Link = class Link extends core.Object {
+    static new(path) {
+      return new io._Link(path);
+    }
+    static fromUri(uri) {
+      return io.Link.new(uri.toFilePath());
+    }
+  };
+  io.Link[dart.implements] = () => [io.FileSystemEntity];
+  dart.setSignature(io.Link, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.Link, [core.String]),
+      fromUri: dart.definiteFunctionType(io.Link, [core.Uri])
+    })
+  });
+  const _makeWindowsLinkTarget = Symbol('_makeWindowsLinkTarget');
+  const _exceptionFromResponse = Symbol('_exceptionFromResponse');
+  io._Link = class _Link extends io.FileSystemEntity {
+    new(path) {
+      this.path = path;
+      if (!(typeof this.path == 'string')) {
+        dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+      }
+    }
+    toString() {
+      return dart.str`Link: '${this.path}'`;
+    }
+    exists() {
+      return io.FileSystemEntity.isLink(this.path);
+    }
+    existsSync() {
+      return io.FileSystemEntity.isLinkSync(this.path);
+    }
+    get absolute() {
+      return io.Link.new(this[_absolutePath]);
+    }
+    stat() {
+      return io.FileStat.stat(this.path);
+    }
+    statSync() {
+      return io.FileStat.statSync(this.path);
+    }
+    create(target, opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(io.Platform.isWindows)) {
+        target = this[_makeWindowsLinkTarget](target);
+      }
+      let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
+      return result.then(dart.dynamic)(dart.fn(_ => io._IOService._dispatch(io._FILE_CREATE_LINK, JSArrayOfString().of([this.path, target])), dynamicToFuture())).then(io._Link)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, dart.str`Cannot create link to target '${target}'`, this.path));
+        }
+        return this;
+      }, dynamicTo_Link()));
+    }
+    createSync(target, opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        this.parent.createSync({recursive: true});
+      }
+      if (dart.test(io.Platform.isWindows)) {
+        target = this[_makeWindowsLinkTarget](target);
+      }
+      let result = io._File._createLink(this.path, target);
+      io._Link.throwIfError(result, "Cannot create link", this.path);
+    }
+    [_makeWindowsLinkTarget](target) {
+      let base = core.Uri.file(dart.str`${io.Directory.current.path}\\`);
+      let link = core.Uri.file(this.path);
+      let destination = core.Uri.file(target);
+      let result = base.resolveUri(link).resolveUri(destination).toFilePath();
+      if (dart.notNull(result[dartx.length]) > 3 && result[dartx._get](1) == ':' && result[dartx._get](2) == '\\') {
+        return dart.str`\\??\\${result}`;
+      } else {
+        dart.throw(new io.FileSystemException(dart.str`Target ${result} of Link.create on Windows cannot be converted` + ' to start with a drive letter.  Unexpected error.'));
+      }
+    }
+    updateSync(target) {
+      this.deleteSync();
+      this.createSync(target);
+    }
+    update(target) {
+      return this.delete().then(io.Link)(dart.fn(_ => this.create(target), FileSystemEntityToFutureOfLink()));
+    }
+    [_delete](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).delete({recursive: true}).then(io._Link)(dart.fn(_ => this, FileSystemEntityTo_Link()));
+      }
+      return io._IOService._dispatch(io._FILE_DELETE_LINK, JSArrayOfString().of([this.path])).then(io._Link)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, "Cannot delete link", this.path));
+        }
+        return this;
+      }, dynamicTo_Link()));
+    }
+    [_deleteSync](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).deleteSync({recursive: true});
+      }
+      let result = io._File._deleteLinkNative(this.path);
+      io._Link.throwIfError(result, "Cannot delete link", this.path);
+    }
+    rename(newPath) {
+      return io._IOService._dispatch(io._FILE_RENAME_LINK, JSArrayOfString().of([this.path, newPath])).then(io.Link)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, dart.str`Cannot rename link to '${newPath}'`, this.path));
+        }
+        return io.Link.new(newPath);
+      }, dynamicToLink()));
+    }
+    renameSync(newPath) {
+      let result = io._File._renameLink(this.path, newPath);
+      io._Link.throwIfError(result, dart.str`Cannot rename link '${this.path}' to '${newPath}'`);
+      return io.Link.new(newPath);
+    }
+    target() {
+      return io._IOService._dispatch(io._FILE_LINK_TARGET, JSArrayOfString().of([this.path])).then(core.String)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, "Cannot get target of link", this.path));
+        }
+        return FutureOrOfString()._check(response);
+      }, dynamicToFutureOrOfString()));
+    }
+    targetSync() {
+      let result = io._File._linkTarget(this.path);
+      io._Link.throwIfError(result, "Cannot read link", this.path);
+      return core.String._check(result);
+    }
+    static throwIfError(result, msg, path) {
+      if (path === void 0) path = "";
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException(msg, path, result));
+      }
+    }
+    [_isErrorResponse](response) {
+      return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+    }
+    [_exceptionFromResponse](response, message, path) {
+      dart.assert(this[_isErrorResponse](response));
+      switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+        case io._ILLEGAL_ARGUMENT_RESPONSE:
+        {
+          return new core.ArgumentError();
+        }
+        case io._OSERROR_RESPONSE:
+        {
+          let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+          return new io.FileSystemException(message, path, err);
+        }
+        default:
+        {
+          return core.Exception.new("Unknown error");
+        }
+      }
+    }
+  };
+  io._Link[dart.implements] = () => [io.Link];
+  dart.setSignature(io._Link, {
+    constructors: () => ({new: dart.definiteFunctionType(io._Link, [core.String])}),
+    fields: () => ({path: core.String}),
+    getters: () => ({absolute: dart.definiteFunctionType(io.Link, [])}),
+    methods: () => ({
+      exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+      existsSync: dart.definiteFunctionType(core.bool, []),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+      statSync: dart.definiteFunctionType(io.FileStat, []),
+      create: dart.definiteFunctionType(async.Future$(io.Link), [core.String], {recursive: core.bool}),
+      createSync: dart.definiteFunctionType(dart.void, [core.String], {recursive: core.bool}),
+      [_makeWindowsLinkTarget]: dart.definiteFunctionType(core.String, [core.String]),
+      updateSync: dart.definiteFunctionType(dart.void, [core.String]),
+      update: dart.definiteFunctionType(async.Future$(io.Link), [core.String]),
+      [_delete]: dart.definiteFunctionType(async.Future$(io.Link), [], {recursive: core.bool}),
+      [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      rename: dart.definiteFunctionType(async.Future$(io.Link), [core.String]),
+      renameSync: dart.definiteFunctionType(io.Link, [core.String]),
+      target: dart.definiteFunctionType(async.Future$(core.String), []),
+      targetSync: dart.definiteFunctionType(core.String, []),
+      [_isErrorResponse]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+      [_exceptionFromResponse]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])
+    }),
+    statics: () => ({throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String], [core.String])}),
+    names: ['throwIfError']
+  });
+  io.Platform = class Platform extends core.Object {
+    static get numberOfProcessors() {
+      return io.Platform._numberOfProcessors;
+    }
+    static get pathSeparator() {
+      return io.Platform._pathSeparator;
+    }
+    static get operatingSystem() {
+      return io.Platform._operatingSystem;
+    }
+    static get localHostname() {
+      return io.Platform._localHostname;
+    }
+    static get environment() {
+      return io._Platform.environment;
+    }
+    static get executable() {
+      return io._Platform.executable;
+    }
+    static get resolvedExecutable() {
+      return io._Platform.resolvedExecutable;
+    }
+    static get script() {
+      return io._Platform.script;
+    }
+    static get executableArguments() {
+      return io._Platform.executableArguments;
+    }
+    static get packageRoot() {
+      return io._Platform.packageRoot;
+    }
+    static get packageConfig() {
+      return io._Platform.packageConfig;
+    }
+    static get version() {
+      return io.Platform._version;
+    }
+  };
+  dart.setSignature(io.Platform, {
+    sfields: () => ({
+      _numberOfProcessors: core.int,
+      _pathSeparator: core.String,
+      _operatingSystem: core.String,
+      _localHostname: core.String,
+      _version: core.String,
+      isLinux: core.bool,
+      isMacOS: core.bool,
+      isWindows: core.bool,
+      isAndroid: core.bool,
+      isIOS: core.bool
+    }),
+    sgetters: () => ({
+      numberOfProcessors: dart.definiteFunctionType(core.int, []),
+      pathSeparator: dart.definiteFunctionType(core.String, []),
+      operatingSystem: dart.definiteFunctionType(core.String, []),
+      localHostname: dart.definiteFunctionType(core.String, []),
+      environment: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+      executable: dart.definiteFunctionType(core.String, []),
+      resolvedExecutable: dart.definiteFunctionType(core.String, []),
+      script: dart.definiteFunctionType(core.Uri, []),
+      executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+      packageRoot: dart.definiteFunctionType(core.String, []),
+      packageConfig: dart.definiteFunctionType(core.String, []),
+      version: dart.definiteFunctionType(core.String, [])
+    })
+  });
+  dart.defineLazy(io.Platform, {
+    get _numberOfProcessors() {
+      return io._Platform.numberOfProcessors;
+    },
+    get _pathSeparator() {
+      return io._Platform.pathSeparator;
+    },
+    get _operatingSystem() {
+      return io._Platform.operatingSystem;
+    },
+    get _localHostname() {
+      return io._Platform.localHostname;
+    },
+    get _version() {
+      return io._Platform.version;
+    },
+    get isLinux() {
+      return io.Platform._operatingSystem == "linux";
+    },
+    get isMacOS() {
+      return io.Platform._operatingSystem == "macos";
+    },
+    get isWindows() {
+      return io.Platform._operatingSystem == "windows";
+    },
+    get isAndroid() {
+      return io.Platform._operatingSystem == "android";
+    },
+    get isIOS() {
+      return io.Platform._operatingSystem == "ios";
+    }
+  });
+  io._Platform = class _Platform extends core.Object {
+    static _numberOfProcessors() {
+      dart.throw(new core.UnsupportedError("Platform._numberOfProcessors"));
+    }
+    static _pathSeparator() {
+      dart.throw(new core.UnsupportedError("Platform._pathSeparator"));
+    }
+    static _operatingSystem() {
+      dart.throw(new core.UnsupportedError("Platform._operatingSystem"));
+    }
+    static _localHostname() {
+      dart.throw(new core.UnsupportedError("Platform._localHostname"));
+    }
+    static _executable() {
+      dart.throw(new core.UnsupportedError("Platform._executable"));
+    }
+    static _resolvedExecutable() {
+      dart.throw(new core.UnsupportedError("Platform._resolvedExecutable"));
+    }
+    static _environment() {
+      dart.throw(new core.UnsupportedError("Platform._environment"));
+    }
+    static _executableArguments() {
+      dart.throw(new core.UnsupportedError("Platform._executableArguments"));
+    }
+    static _packageRoot() {
+      dart.throw(new core.UnsupportedError("Platform._packageRoot"));
+    }
+    static _packageConfig() {
+      dart.throw(new core.UnsupportedError("Platform._packageConfig"));
+    }
+    static _version() {
+      dart.throw(new core.UnsupportedError("Platform._version"));
+    }
+    static get numberOfProcessors() {
+      return io._Platform._numberOfProcessors();
+    }
+    static get pathSeparator() {
+      return io._Platform._pathSeparator();
+    }
+    static get operatingSystem() {
+      return io._Platform._operatingSystem();
+    }
+    static get localHostname() {
+      let result = io._Platform._localHostname();
+      if (io.OSError.is(result)) {
+        dart.throw(result);
+      } else {
+        return core.String._check(result);
+      }
+    }
+    static get executableArguments() {
+      return io._Platform._executableArguments();
+    }
+    static get environment() {
+      if (io._Platform._environmentCache == null) {
+        let env = io._Platform._environment();
+        if (!io.OSError.is(env)) {
+          let isWindows = io._Platform.operatingSystem == 'windows';
+          let result = isWindows ? new io._CaseInsensitiveStringMap() : core.Map.new();
+          for (let str of core.Iterable._check(env)) {
+            let equalsIndex = dart.dsend(str, 'indexOf', '=');
+            if (dart.test(dart.dsend(equalsIndex, '>', 0))) {
+              result[dartx._set](dart.dsend(str, 'substring', 0, equalsIndex), dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1)));
+            }
+          }
+          io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(MapOfString$String()._check(result));
+        } else {
+          io._Platform._environmentCache = env;
+        }
+      }
+      if (io.OSError.is(io._Platform._environmentCache)) {
+        dart.throw(io._Platform._environmentCache);
+      } else {
+        return MapOfString$String()._check(io._Platform._environmentCache);
+      }
+    }
+    static get version() {
+      return io._Platform._version();
+    }
+  };
+  dart.setSignature(io._Platform, {
+    sfields: () => ({
+      executable: core.String,
+      resolvedExecutable: core.String,
+      packageRoot: core.String,
+      packageConfig: core.String,
+      _environmentCache: dart.dynamic,
+      script: core.Uri
+    }),
+    sgetters: () => ({
+      numberOfProcessors: dart.definiteFunctionType(core.int, []),
+      pathSeparator: dart.definiteFunctionType(core.String, []),
+      operatingSystem: dart.definiteFunctionType(core.String, []),
+      localHostname: dart.definiteFunctionType(core.String, []),
+      executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+      environment: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+      version: dart.definiteFunctionType(core.String, [])
+    }),
+    statics: () => ({
+      _numberOfProcessors: dart.definiteFunctionType(core.int, []),
+      _pathSeparator: dart.definiteFunctionType(core.String, []),
+      _operatingSystem: dart.definiteFunctionType(core.String, []),
+      _localHostname: dart.definiteFunctionType(dart.dynamic, []),
+      _executable: dart.definiteFunctionType(dart.dynamic, []),
+      _resolvedExecutable: dart.definiteFunctionType(dart.dynamic, []),
+      _environment: dart.definiteFunctionType(dart.dynamic, []),
+      _executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+      _packageRoot: dart.definiteFunctionType(core.String, []),
+      _packageConfig: dart.definiteFunctionType(core.String, []),
+      _version: dart.definiteFunctionType(core.String, [])
+    }),
+    names: ['_numberOfProcessors', '_pathSeparator', '_operatingSystem', '_localHostname', '_executable', '_resolvedExecutable', '_environment', '_executableArguments', '_packageRoot', '_packageConfig', '_version']
+  });
+  io._Platform._environmentCache = null;
+  io._Platform.script = null;
+  dart.defineLazy(io._Platform, {
+    get executable() {
+      return core.String._check(io._Platform._executable());
+    },
+    set executable(_) {},
+    get resolvedExecutable() {
+      return core.String._check(io._Platform._resolvedExecutable());
+    },
+    set resolvedExecutable(_) {},
+    get packageRoot() {
+      return io._Platform._packageRoot();
+    },
+    set packageRoot(_) {},
+    get packageConfig() {
+      return io._Platform._packageConfig();
+    },
+    set packageConfig(_) {}
+  });
+  const _map$1 = Symbol('_map');
+  io._CaseInsensitiveStringMap$ = dart.generic(V => {
+    let MapOfString$V = () => (MapOfString$V = dart.constFn(core.Map$(core.String, V)))();
+    let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
+    let StringAndVTovoid = () => (StringAndVTovoid = dart.constFn(dart.functionType(dart.void, [core.String, V])))();
+    class _CaseInsensitiveStringMap extends core.Object {
+      new() {
+        this[_map$1] = MapOfString$V().new();
+      }
+      containsKey(key) {
+        return typeof key == 'string' && dart.test(this[_map$1][dartx.containsKey](key[dartx.toUpperCase]()));
+      }
+      containsValue(value) {
+        return this[_map$1][dartx.containsValue](value);
+      }
+      _get(key) {
+        return typeof key == 'string' ? this[_map$1][dartx._get](key[dartx.toUpperCase]()) : null;
+      }
+      _set(key, value) {
+        V._check(value);
+        this[_map$1][dartx._set](key[dartx.toUpperCase](), value);
+        return value;
+      }
+      putIfAbsent(key, ifAbsent) {
+        VoidToV()._check(ifAbsent);
+        return this[_map$1][dartx.putIfAbsent](key[dartx.toUpperCase](), ifAbsent);
+      }
+      addAll(other) {
+        other[dartx.forEach](dart.fn((key, value) => this._set(core.String._check(dart.dsend(key, 'toUpperCase')), V._check(value)), dynamicAnddynamicTovoid$()));
+      }
+      remove(key) {
+        return typeof key == 'string' ? this[_map$1][dartx.remove](key[dartx.toUpperCase]()) : null;
+      }
+      clear() {
+        this[_map$1][dartx.clear]();
+      }
+      forEach(f) {
+        this[_map$1][dartx.forEach](f);
+      }
+      get keys() {
+        return this[_map$1][dartx.keys];
+      }
+      get values() {
+        return this[_map$1][dartx.values];
+      }
+      get length() {
+        return this[_map$1][dartx.length];
+      }
+      get isEmpty() {
+        return this[_map$1][dartx.isEmpty];
+      }
+      get isNotEmpty() {
+        return this[_map$1][dartx.isNotEmpty];
+      }
+      toString() {
+        return dart.toString(this[_map$1]);
+      }
+    }
+    dart.addTypeTests(_CaseInsensitiveStringMap);
+    _CaseInsensitiveStringMap[dart.implements] = () => [MapOfString$V()];
+    dart.setSignature(_CaseInsensitiveStringMap, {
+      fields: () => ({[_map$1]: MapOfString$V()}),
+      getters: () => ({
+        keys: dart.definiteFunctionType(core.Iterable$(core.String), []),
+        values: dart.definiteFunctionType(core.Iterable$(V), []),
+        length: dart.definiteFunctionType(core.int, []),
+        isEmpty: dart.definiteFunctionType(core.bool, []),
+        isNotEmpty: dart.definiteFunctionType(core.bool, [])
+      }),
+      methods: () => ({
+        containsKey: dart.definiteFunctionType(core.bool, [core.Object]),
+        containsValue: dart.definiteFunctionType(core.bool, [core.Object]),
+        _get: dart.definiteFunctionType(V, [core.Object]),
+        _set: dart.definiteFunctionType(dart.void, [core.String, V]),
+        putIfAbsent: dart.definiteFunctionType(V, [core.String, VoidToV()]),
+        addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+        remove: dart.definiteFunctionType(V, [core.Object]),
+        clear: dart.definiteFunctionType(dart.void, []),
+        forEach: dart.definiteFunctionType(dart.void, [StringAndVTovoid()])
+      })
+    });
+    dart.defineExtensionMembers(_CaseInsensitiveStringMap, [
+      'containsKey',
+      'containsValue',
+      '_get',
+      '_set',
+      'putIfAbsent',
+      'addAll',
+      'remove',
+      'clear',
+      'forEach',
+      'keys',
+      'values',
+      'length',
+      'isEmpty',
+      'isNotEmpty'
+    ]);
+    return _CaseInsensitiveStringMap;
+  });
+  io._CaseInsensitiveStringMap = _CaseInsensitiveStringMap();
+  io._ProcessUtils = class _ProcessUtils extends core.Object {
+    static _exit(status) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._exit"));
+    }
+    static _setExitCode(status) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._setExitCode"));
+    }
+    static _getExitCode() {
+      dart.throw(new core.UnsupportedError("ProcessUtils._getExitCode"));
+    }
+    static _sleep(millis) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._sleep"));
+    }
+    static _pid(process) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._pid"));
+    }
+    static _watchSignal(signal) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._watchSignal"));
+    }
+  };
+  dart.setSignature(io._ProcessUtils, {
+    statics: () => ({
+      _exit: dart.definiteFunctionType(dart.void, [core.int]),
+      _setExitCode: dart.definiteFunctionType(dart.void, [core.int]),
+      _getExitCode: dart.definiteFunctionType(core.int, []),
+      _sleep: dart.definiteFunctionType(dart.void, [core.int]),
+      _pid: dart.definiteFunctionType(core.int, [io.Process]),
+      _watchSignal: dart.definiteFunctionType(async.Stream$(io.ProcessSignal), [io.ProcessSignal])
+    }),
+    names: ['_exit', '_setExitCode', '_getExitCode', '_sleep', '_pid', '_watchSignal']
+  });
+  io.exit = function(code) {
+    if (!(typeof code == 'number')) {
+      dart.throw(new core.ArgumentError("Integer value for exit code expected"));
+    }
+    io._ProcessUtils._exit(code);
+  };
+  dart.fn(io.exit, intTovoid());
+  dart.copyProperties(io, {
+    set exitCode(code) {
+      if (!(typeof code == 'number')) {
+        dart.throw(new core.ArgumentError("Integer value for exit code expected"));
+      }
+      io._ProcessUtils._setExitCode(code);
+    },
+    get exitCode() {
+      return io._ProcessUtils._getExitCode();
+    }
+  });
+  io.sleep = function(duration) {
+    let milliseconds = duration.inMilliseconds;
+    if (dart.notNull(milliseconds) < 0) {
+      dart.throw(new core.ArgumentError("sleep: duration cannot be negative"));
+    }
+    io._ProcessUtils._sleep(milliseconds);
+  };
+  dart.fn(io.sleep, DurationTovoid());
+  dart.copyProperties(io, {
+    get pid() {
+      return io._ProcessUtils._pid(null);
+    }
+  });
+  io.ProcessStartMode = class ProcessStartMode extends core.Object {
+    new(index) {
+      this.index = index;
+    }
+    toString() {
+      return {
+        0: "ProcessStartMode.NORMAL",
+        1: "ProcessStartMode.DETACHED",
+        2: "ProcessStartMode.DETACHED_WITH_STDIO"
+      }[this.index];
+    }
+  };
+  dart.setSignature(io.ProcessStartMode, {
+    fields: () => ({index: core.int})
+  });
+  dart.defineEnumValues(io.ProcessStartMode, [
+    'NORMAL',
+    'DETACHED',
+    'DETACHED_WITH_STDIO'
+  ]);
+  io.Process = class Process extends core.Object {
+    new() {
+      this.exitCode = null;
+    }
+    static start(executable, arguments$, opts) {
+      let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+      let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+      let mode = opts && 'mode' in opts ? opts.mode : io.ProcessStartMode.NORMAL;
+      dart.throw(new core.UnsupportedError("Process.start"));
+    }
+    static run(executable, arguments$, opts) {
+      let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+      let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+      let stdoutEncoding = opts && 'stdoutEncoding' in opts ? opts.stdoutEncoding : io.SYSTEM_ENCODING;
+      let stderrEncoding = opts && 'stderrEncoding' in opts ? opts.stderrEncoding : io.SYSTEM_ENCODING;
+      dart.throw(new core.UnsupportedError("Process.run"));
+    }
+    static runSync(executable, arguments$, opts) {
+      let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+      let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+      let stdoutEncoding = opts && 'stdoutEncoding' in opts ? opts.stdoutEncoding : io.SYSTEM_ENCODING;
+      let stderrEncoding = opts && 'stderrEncoding' in opts ? opts.stderrEncoding : io.SYSTEM_ENCODING;
+      dart.throw(new core.UnsupportedError("Process.runSync"));
+    }
+    static killPid(pid, signal) {
+      if (signal === void 0) signal = io.ProcessSignal.SIGTERM;
+      dart.throw(new core.UnsupportedError("Process.killPid"));
+    }
+  };
+  dart.setSignature(io.Process, {
+    fields: () => ({exitCode: FutureOfint()}),
+    statics: () => ({
+      start: dart.definiteFunctionType(async.Future$(io.Process), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, mode: io.ProcessStartMode}),
+      run: dart.definiteFunctionType(async.Future$(io.ProcessResult), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
+      runSync: dart.definiteFunctionType(io.ProcessResult, [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
+      killPid: dart.definiteFunctionType(core.bool, [core.int], [io.ProcessSignal])
+    }),
+    names: ['start', 'run', 'runSync', 'killPid']
+  });
+  io.ProcessResult = class ProcessResult extends core.Object {
+    new(pid, exitCode, stdout, stderr) {
+      this.pid = pid;
+      this.exitCode = exitCode;
+      this.stdout = stdout;
+      this.stderr = stderr;
+    }
+  };
+  dart.setSignature(io.ProcessResult, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ProcessResult, [core.int, core.int, dart.dynamic, dart.dynamic])}),
+    fields: () => ({
+      exitCode: core.int,
+      stdout: dart.dynamic,
+      stderr: dart.dynamic,
+      pid: core.int
+    })
+  });
+  const _signalNumber = Symbol('_signalNumber');
+  const _name$2 = Symbol('_name');
+  io.ProcessSignal = class ProcessSignal extends core.Object {
+    _(signalNumber, name) {
+      this[_signalNumber] = signalNumber;
+      this[_name$2] = name;
+    }
+    toString() {
+      return this[_name$2];
+    }
+    watch() {
+      return io._ProcessUtils._watchSignal(this);
+    }
+  };
+  dart.defineNamedConstructor(io.ProcessSignal, '_');
+  dart.setSignature(io.ProcessSignal, {
+    constructors: () => ({_: dart.definiteFunctionType(io.ProcessSignal, [core.int, core.String])}),
+    fields: () => ({
+      [_signalNumber]: core.int,
+      [_name$2]: core.String
+    }),
+    methods: () => ({watch: dart.definiteFunctionType(async.Stream$(io.ProcessSignal), [])}),
+    sfields: () => ({
+      SIGHUP: io.ProcessSignal,
+      SIGINT: io.ProcessSignal,
+      SIGQUIT: io.ProcessSignal,
+      SIGILL: io.ProcessSignal,
+      SIGTRAP: io.ProcessSignal,
+      SIGABRT: io.ProcessSignal,
+      SIGBUS: io.ProcessSignal,
+      SIGFPE: io.ProcessSignal,
+      SIGKILL: io.ProcessSignal,
+      SIGUSR1: io.ProcessSignal,
+      SIGSEGV: io.ProcessSignal,
+      SIGUSR2: io.ProcessSignal,
+      SIGPIPE: io.ProcessSignal,
+      SIGALRM: io.ProcessSignal,
+      SIGTERM: io.ProcessSignal,
+      SIGCHLD: io.ProcessSignal,
+      SIGCONT: io.ProcessSignal,
+      SIGSTOP: io.ProcessSignal,
+      SIGTSTP: io.ProcessSignal,
+      SIGTTIN: io.ProcessSignal,
+      SIGTTOU: io.ProcessSignal,
+      SIGURG: io.ProcessSignal,
+      SIGXCPU: io.ProcessSignal,
+      SIGXFSZ: io.ProcessSignal,
+      SIGVTALRM: io.ProcessSignal,
+      SIGPROF: io.ProcessSignal,
+      SIGWINCH: io.ProcessSignal,
+      SIGPOLL: io.ProcessSignal,
+      SIGSYS: io.ProcessSignal
+    })
+  });
+  dart.defineLazy(io.ProcessSignal, {
+    get SIGHUP() {
+      return dart.const(new io.ProcessSignal._(1, "SIGHUP"));
+    },
+    get SIGINT() {
+      return dart.const(new io.ProcessSignal._(2, "SIGINT"));
+    },
+    get SIGQUIT() {
+      return dart.const(new io.ProcessSignal._(3, "SIGQUIT"));
+    },
+    get SIGILL() {
+      return dart.const(new io.ProcessSignal._(4, "SIGILL"));
+    },
+    get SIGTRAP() {
+      return dart.const(new io.ProcessSignal._(5, "SIGTRAP"));
+    },
+    get SIGABRT() {
+      return dart.const(new io.ProcessSignal._(6, "SIGABRT"));
+    },
+    get SIGBUS() {
+      return dart.const(new io.ProcessSignal._(7, "SIGBUS"));
+    },
+    get SIGFPE() {
+      return dart.const(new io.ProcessSignal._(8, "SIGFPE"));
+    },
+    get SIGKILL() {
+      return dart.const(new io.ProcessSignal._(9, "SIGKILL"));
+    },
+    get SIGUSR1() {
+      return dart.const(new io.ProcessSignal._(10, "SIGUSR1"));
+    },
+    get SIGSEGV() {
+      return dart.const(new io.ProcessSignal._(11, "SIGSEGV"));
+    },
+    get SIGUSR2() {
+      return dart.const(new io.ProcessSignal._(12, "SIGUSR2"));
+    },
+    get SIGPIPE() {
+      return dart.const(new io.ProcessSignal._(13, "SIGPIPE"));
+    },
+    get SIGALRM() {
+      return dart.const(new io.ProcessSignal._(14, "SIGALRM"));
+    },
+    get SIGTERM() {
+      return dart.const(new io.ProcessSignal._(15, "SIGTERM"));
+    },
+    get SIGCHLD() {
+      return dart.const(new io.ProcessSignal._(17, "SIGCHLD"));
+    },
+    get SIGCONT() {
+      return dart.const(new io.ProcessSignal._(18, "SIGCONT"));
+    },
+    get SIGSTOP() {
+      return dart.const(new io.ProcessSignal._(19, "SIGSTOP"));
+    },
+    get SIGTSTP() {
+      return dart.const(new io.ProcessSignal._(20, "SIGTSTP"));
+    },
+    get SIGTTIN() {
+      return dart.const(new io.ProcessSignal._(21, "SIGTTIN"));
+    },
+    get SIGTTOU() {
+      return dart.const(new io.ProcessSignal._(22, "SIGTTOU"));
+    },
+    get SIGURG() {
+      return dart.const(new io.ProcessSignal._(23, "SIGURG"));
+    },
+    get SIGXCPU() {
+      return dart.const(new io.ProcessSignal._(24, "SIGXCPU"));
+    },
+    get SIGXFSZ() {
+      return dart.const(new io.ProcessSignal._(25, "SIGXFSZ"));
+    },
+    get SIGVTALRM() {
+      return dart.const(new io.ProcessSignal._(26, "SIGVTALRM"));
+    },
+    get SIGPROF() {
+      return dart.const(new io.ProcessSignal._(27, "SIGPROF"));
+    },
+    get SIGWINCH() {
+      return dart.const(new io.ProcessSignal._(28, "SIGWINCH"));
+    },
+    get SIGPOLL() {
+      return dart.const(new io.ProcessSignal._(29, "SIGPOLL"));
+    },
+    get SIGSYS() {
+      return dart.const(new io.ProcessSignal._(31, "SIGSYS"));
+    }
+  });
+  io.SignalException = class SignalException extends core.Object {
+    new(message, osError) {
+      if (osError === void 0) osError = null;
+      this.message = message;
+      this.osError = osError;
+    }
+    toString() {
+      let msg = "";
+      if (this.osError != null) {
+        msg = dart.str`, osError: ${this.osError}`;
+      }
+      return dart.str`SignalException: ${this.message}${msg}`;
+    }
+  };
+  io.SignalException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.SignalException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.SignalException, [core.String], [dart.dynamic])}),
+    fields: () => ({
+      message: core.String,
+      osError: dart.dynamic
+    })
+  });
+  io.ProcessException = class ProcessException extends core.Object {
+    new(executable, arguments$, message, errorCode) {
+      if (message === void 0) message = "";
+      if (errorCode === void 0) errorCode = 0;
+      this.executable = executable;
+      this.arguments = arguments$;
+      this.message = message;
+      this.errorCode = errorCode;
+    }
+    toString() {
+      let msg = this.message == null ? dart.str`OS error code: ${this.errorCode}` : this.message;
+      let args = this.arguments[dartx.join](' ');
+      return dart.str`ProcessException: ${msg}\n  Command: ${this.executable} ${args}`;
+    }
+  };
+  io.ProcessException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.ProcessException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ProcessException, [core.String, ListOfString()], [core.String, core.int])}),
+    fields: () => ({
+      executable: core.String,
+      arguments: ListOfString(),
+      message: core.String,
+      errorCode: core.int
+    })
+  });
+  const _detachRaw = Symbol('_detachRaw');
+  io.SecureSocket = class SecureSocket extends core.Object {
+    static _(rawSocket) {
+      dart.throw(new core.UnsupportedError("SecureSocket constructor"));
+    }
+    static connect(host, port, opts) {
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      return io.RawSecureSocket.connect(host, port, {context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols}).then(io.SecureSocket)(dart.fn(rawSocket => io.SecureSocket._(rawSocket), RawSecureSocketToSecureSocket()));
+    }
+    static secure(socket, opts) {
+      let host = opts && 'host' in opts ? opts.host : null;
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let completer = async.Completer.new();
+      dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket._check(dart.dindex(detachedRaw, 0)), {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
+        completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
+      }, dynamicToNull$()));
+      return FutureOfSecureSocket()._check(completer.future);
+    }
+    static secureServer(socket, context, opts) {
+      let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      let completer = async.Completer.new();
+      dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket._check(dart.dindex(detachedRaw, 0)), context, {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
+        completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
+      }, dynamicToNull$()));
+      return FutureOfSecureSocket()._check(completer.future);
+    }
+  };
+  io.SecureSocket[dart.implements] = () => [io.Socket];
+  dart.setSignature(io.SecureSocket, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SecureSocket, [io.RawSecureSocket])}),
+    statics: () => ({
+      connect: dart.definiteFunctionType(async.Future$(io.SecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      secure: dart.definiteFunctionType(async.Future$(io.SecureSocket), [io.Socket], {host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool()}),
+      secureServer: dart.definiteFunctionType(async.Future$(io.SecureSocket), [io.Socket, io.SecurityContext], {bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+    }),
+    names: ['connect', 'secure', 'secureServer']
+  });
+  io.SecureServerSocket = class SecureServerSocket extends async.Stream$(io.SecureSocket) {
+    _(socket) {
+      this[_socket] = socket;
+      super.new();
+    }
+    static bind(address, port, context, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io.RawSecureServerSocket.bind(address, port, context, {backlog: backlog, v6Only: v6Only, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols, shared: shared}).then(io.SecureServerSocket)(dart.fn(serverSocket => new io.SecureServerSocket._(serverSocket), RawSecureServerSocketToSecureServerSocket()));
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_socket].map(io.SecureSocket)(dart.fn(rawSocket => io.SecureSocket._(rawSocket), RawSecureSocketToSecureSocket())).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get port() {
+      return this[_socket].port;
+    }
+    get address() {
+      return this[_socket].address;
+    }
+    close() {
+      return this[_socket].close().then(io.SecureServerSocket)(dart.fn(_ => this, RawSecureServerSocketToSecureServerSocket()));
+    }
+    set [_owner](owner) {
+      this[_socket][_owner] = owner;
+    }
+  };
+  dart.addSimpleTypeTests(io.SecureServerSocket);
+  dart.defineNamedConstructor(io.SecureServerSocket, '_');
+  dart.setSignature(io.SecureServerSocket, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SecureServerSocket, [io.RawSecureServerSocket])}),
+    fields: () => ({[_socket]: io.RawSecureServerSocket}),
+    getters: () => ({
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, [])
+    }),
+    setters: () => ({[_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.SecureSocket), [SecureSocketTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(async.Future$(io.SecureServerSocket), [])
+    }),
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.SecureServerSocket), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString(), shared: core.bool})}),
+    names: ['bind']
+  });
+  const _onSubscriptionStateChange = Symbol('_onSubscriptionStateChange');
+  const _onPauseStateChange = Symbol('_onPauseStateChange');
+  io.RawSecureSocket = class RawSecureSocket extends core.Object {
+    static connect(host, port, opts) {
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      io._RawSecureSocket._verifyFields(host, port, false, false, false, onBadCertificate);
+      return io.RawSocket.connect(host, port).then(io.RawSecureSocket)(dart.fn(socket => io.RawSecureSocket.secure(socket, {context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols}), RawSocketToFutureOfRawSecureSocket()));
+    }
+    static secure(socket, opts) {
+      let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+      let host = opts && 'host' in opts ? opts.host : null;
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      socket.readEventsEnabled = false;
+      socket.writeEventsEnabled = false;
+      return io._RawSecureSocket.connect(host != null ? host : socket.address.host, socket.port, {is_server: false, socket: socket, subscription: subscription, context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols});
+    }
+    static secureServer(socket, context, opts) {
+      let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+      let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      socket.readEventsEnabled = false;
+      socket.writeEventsEnabled = false;
+      return io._RawSecureSocket.connect(socket.address, socket.remotePort, {context: context, is_server: true, socket: socket, subscription: subscription, bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols});
+    }
+  };
+  io.RawSecureSocket[dart.implements] = () => [io.RawSocket];
+  dart.setSignature(io.RawSecureSocket, {
+    statics: () => ({
+      connect: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: async.StreamSubscription, host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+    }),
+    names: ['connect', 'secure', 'secureServer']
+  });
+  io.RawSecureServerSocket = class RawSecureServerSocket extends async.Stream$(io.RawSecureSocket) {
+    _(socket, context, requestClientCertificate, requireClientCertificate, supportedProtocols) {
+      this[_socket] = socket;
+      this[_context] = context;
+      this.requestClientCertificate = requestClientCertificate;
+      this.requireClientCertificate = requireClientCertificate;
+      this.supportedProtocols = supportedProtocols;
+      this[_controller$0] = null;
+      this[_subscription$] = null;
+      this[_closed] = false;
+      super.new();
+      this[_controller$0] = StreamControllerOfRawSecureSocket().new({sync: true, onListen: dart.bind(this, _onSubscriptionStateChange), onPause: dart.bind(this, _onPauseStateChange), onResume: dart.bind(this, _onPauseStateChange), onCancel: dart.bind(this, _onSubscriptionStateChange)});
+    }
+    static bind(address, port, context, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io.RawServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io.RawSecureServerSocket)(dart.fn(serverSocket => new io.RawSecureServerSocket._(serverSocket, context, requestClientCertificate, requireClientCertificate, supportedProtocols), RawServerSocketToRawSecureServerSocket()));
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get port() {
+      return this[_socket].port;
+    }
+    get address() {
+      return this[_socket].address;
+    }
+    close() {
+      this[_closed] = true;
+      return this[_socket].close().then(io.RawSecureServerSocket)(dart.fn(_ => this, RawServerSocketToRawSecureServerSocket()));
+    }
+    [_onData$](connection) {
+      let remotePort = null;
+      try {
+        remotePort = connection.remotePort;
+      } catch (e) {
+        return;
+      }
+
+      io._RawSecureSocket.connect(connection.address, core.int._check(remotePort), {context: this[_context], is_server: true, socket: connection, requestClientCertificate: this.requestClientCertificate, requireClientCertificate: this.requireClientCertificate, supportedProtocols: this.supportedProtocols}).then(dart.dynamic)(dart.fn(secureConnection => {
+        if (dart.test(this[_closed])) {
+          secureConnection.close();
+        } else {
+          this[_controller$0].add(secureConnection);
+        }
+      }, RawSecureSocketToNull())).catchError(dart.fn((e, s) => {
+        if (!dart.test(this[_closed])) {
+          this[_controller$0].addError(e, core.StackTrace._check(s));
+        }
+      }, dynamicAnddynamicToNull()));
+    }
+    [_onPauseStateChange]() {
+      if (dart.test(this[_controller$0].isPaused)) {
+        this[_subscription$].pause();
+      } else {
+        this[_subscription$].resume();
+      }
+    }
+    [_onSubscriptionStateChange]() {
+      if (dart.test(this[_controller$0].hasListener)) {
+        this[_subscription$] = this[_socket].listen(dart.bind(this, _onData$), {onError: dart.bind(this[_controller$0], 'addError'), onDone: dart.bind(this[_controller$0], 'close')});
+      } else {
+        this.close();
+      }
+    }
+    set [_owner](owner) {
+      dart.dput(this[_socket], _owner, owner);
+    }
+  };
+  dart.addSimpleTypeTests(io.RawSecureServerSocket);
+  dart.defineNamedConstructor(io.RawSecureServerSocket, '_');
+  dart.setSignature(io.RawSecureServerSocket, {
+    constructors: () => ({_: dart.definiteFunctionType(io.RawSecureServerSocket, [io.RawServerSocket, io.SecurityContext, core.bool, core.bool, ListOfString()])}),
+    fields: () => ({
+      [_socket]: io.RawServerSocket,
+      [_controller$0]: StreamControllerOfRawSecureSocket(),
+      [_subscription$]: StreamSubscriptionOfRawSocket(),
+      [_context]: io.SecurityContext,
+      requestClientCertificate: core.bool,
+      requireClientCertificate: core.bool,
+      supportedProtocols: ListOfString(),
+      [_closed]: core.bool
+    }),
+    getters: () => ({
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, [])
+    }),
+    setters: () => ({[_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSecureSocket), [RawSecureSocketTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(async.Future$(io.RawSecureServerSocket), []),
+      [_onData$]: dart.definiteFunctionType(dart.void, [io.RawSocket]),
+      [_onPauseStateChange]: dart.definiteFunctionType(dart.void, []),
+      [_onSubscriptionStateChange]: dart.definiteFunctionType(dart.void, [])
+    }),
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawSecureServerSocket), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString(), shared: core.bool})}),
+    names: ['bind']
+  });
+  io.X509Certificate = class X509Certificate extends core.Object {
+    static _() {
+      dart.throw(new core.UnsupportedError("X509Certificate constructor"));
+    }
+  };
+  dart.setSignature(io.X509Certificate, {
+    constructors: () => ({_: dart.definiteFunctionType(io.X509Certificate, [])})
+  });
+  io._FilterStatus = class _FilterStatus extends core.Object {
+    new() {
+      this.progress = false;
+      this.readEmpty = true;
+      this.writeEmpty = true;
+      this.readPlaintextNoLongerEmpty = false;
+      this.writePlaintextNoLongerFull = false;
+      this.readEncryptedNoLongerFull = false;
+      this.writeEncryptedNoLongerEmpty = false;
+    }
+  };
+  dart.setSignature(io._FilterStatus, {
+    constructors: () => ({new: dart.definiteFunctionType(io._FilterStatus, [])}),
+    fields: () => ({
+      progress: core.bool,
+      readEmpty: core.bool,
+      writeEmpty: core.bool,
+      readPlaintextNoLongerEmpty: core.bool,
+      writePlaintextNoLongerFull: core.bool,
+      readEncryptedNoLongerFull: core.bool,
+      writeEncryptedNoLongerEmpty: core.bool
+    })
+  });
+  const _handshakeComplete = Symbol('_handshakeComplete');
+  const _status = Symbol('_status');
+  const _filterStatus = Symbol('_filterStatus');
+  const _secureFilter = Symbol('_secureFilter');
+  const _bufferedData = Symbol('_bufferedData');
+  const _bufferedDataIndex = Symbol('_bufferedDataIndex');
+  const _writeEventsEnabled = Symbol('_writeEventsEnabled');
+  const _readEventsEnabled = Symbol('_readEventsEnabled');
+  const _pendingReadEvent = Symbol('_pendingReadEvent');
+  const _socketClosedRead = Symbol('_socketClosedRead');
+  const _socketClosedWrite = Symbol('_socketClosedWrite');
+  const _closedRead = Symbol('_closedRead');
+  const _closedWrite = Symbol('_closedWrite');
+  const _connectPending = Symbol('_connectPending');
+  const _filterPending = Symbol('_filterPending');
+  const _filterActive = Symbol('_filterActive');
+  const _selectedProtocol = Symbol('_selectedProtocol');
+  const _secureHandshakeCompleteHandler = Symbol('_secureHandshakeCompleteHandler');
+  const _onBadCertificateWrapper = Symbol('_onBadCertificateWrapper');
+  const _eventDispatcher = Symbol('_eventDispatcher');
+  const _doneHandler = Symbol('_doneHandler');
+  const _secureHandshake = Symbol('_secureHandshake');
+  const _sendWriteEvent = Symbol('_sendWriteEvent');
+  const _completeCloseCompleter = Symbol('_completeCloseCompleter');
+  const _close$0 = Symbol('_close');
+  const _scheduleReadEvent = Symbol('_scheduleReadEvent');
+  const _scheduleFilter = Symbol('_scheduleFilter');
+  const _readHandler = Symbol('_readHandler');
+  const _writeHandler = Symbol('_writeHandler');
+  const _closeHandler = Symbol('_closeHandler');
+  const _readSocket = Symbol('_readSocket');
+  const _writeSocket = Symbol('_writeSocket');
+  const _tryFilter = Symbol('_tryFilter');
+  const _pushAllFilterStages = Symbol('_pushAllFilterStages');
+  const _readSocketOrBufferedData = Symbol('_readSocketOrBufferedData');
+  const _sendReadEvent = Symbol('_sendReadEvent');
+  let const$75;
+  io.RawSocketEvent = class RawSocketEvent extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+    toString() {
+      return (const$75 || (const$75 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
+    }
+  };
+  dart.defineNamedConstructor(io.RawSocketEvent, '_');
+  dart.setSignature(io.RawSocketEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.RawSocketEvent, [core.int])}),
+    fields: () => ({[_value$1]: core.int}),
+    sfields: () => ({
+      READ: io.RawSocketEvent,
+      WRITE: io.RawSocketEvent,
+      READ_CLOSED: io.RawSocketEvent,
+      CLOSED: io.RawSocketEvent
+    })
+  });
+  dart.defineLazy(io.RawSocketEvent, {
+    get READ() {
+      return dart.const(new io.RawSocketEvent._(0));
+    },
+    get WRITE() {
+      return dart.const(new io.RawSocketEvent._(1));
+    },
+    get READ_CLOSED() {
+      return dart.const(new io.RawSocketEvent._(2));
+    },
+    get CLOSED() {
+      return dart.const(new io.RawSocketEvent._(3));
+    }
+  });
+  io._RawSecureSocket = class _RawSecureSocket extends async.Stream$(io.RawSocketEvent) {
+    static _isBufferEncrypted(identifier) {
+      return dart.notNull(identifier) >= dart.notNull(io._RawSecureSocket.READ_ENCRYPTED);
+    }
+    static connect(host, requestedPort, opts) {
+      let is_server = opts && 'is_server' in opts ? opts.is_server : null;
+      let context = opts && 'context' in opts ? opts.context : null;
+      let socket = opts && 'socket' in opts ? opts.socket : null;
+      let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+      let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      io._RawSecureSocket._verifyFields(host, requestedPort, is_server, requestClientCertificate, requireClientCertificate, onBadCertificate);
+      if (io.InternetAddress.is(host)) host = dart.dload(host, 'host');
+      let address = socket.address;
+      if (host != null) {
+        address = io.InternetAddress._cloneWithNewHost(address, core.String._check(host));
+      }
+      return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, StreamSubscriptionOfRawSocketEvent()._check(subscription), bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
+    }
+    new(address, requestedPort, is_server, context, socket, socketSubscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols) {
+      this[_handshakeComplete] = CompleterOf_RawSecureSocket().new();
+      this[_status] = io._RawSecureSocket.HANDSHAKE;
+      this[_closeCompleter] = async.Completer.new();
+      this[_filterStatus] = new io._FilterStatus();
+      this[_secureFilter] = io._SecureFilter.new();
+      this.address = address;
+      this.is_server = is_server;
+      this.context = context;
+      this[_socket] = socket;
+      this[_socketSubscription] = socketSubscription;
+      this[_bufferedData] = bufferedData;
+      this.requestClientCertificate = requestClientCertificate;
+      this.requireClientCertificate = requireClientCertificate;
+      this.onBadCertificate = onBadCertificate;
+      this[_controller$0] = null;
+      this[_stream$] = null;
+      this[_bufferedDataIndex] = 0;
+      this[_writeEventsEnabled] = true;
+      this[_readEventsEnabled] = true;
+      this[_pauseCount$] = 0;
+      this[_pendingReadEvent] = false;
+      this[_socketClosedRead] = false;
+      this[_socketClosedWrite] = false;
+      this[_closedRead] = false;
+      this[_closedWrite] = false;
+      this[_connectPending] = true;
+      this[_filterPending] = false;
+      this[_filterActive] = false;
+      this[_selectedProtocol] = null;
+      super.new();
+      if (this.context == null) {
+        this.context = io.SecurityContext.defaultContext;
+      }
+      this[_controller$0] = StreamControllerOfRawSocketEvent().new({sync: true, onListen: dart.bind(this, _onSubscriptionStateChange), onPause: dart.bind(this, _onPauseStateChange), onResume: dart.bind(this, _onPauseStateChange), onCancel: dart.bind(this, _onSubscriptionStateChange)});
+      this[_stream$] = this[_controller$0].stream;
+      this[_secureFilter].init();
+      this[_secureFilter].registerHandshakeCompleteCallback(dart.bind(this, _secureHandshakeCompleteHandler));
+      if (this.onBadCertificate != null) {
+        this[_secureFilter].registerBadCertificateCallback(dart.bind(this, _onBadCertificateWrapper));
+      }
+      this[_socket].readEventsEnabled = true;
+      this[_socket].writeEventsEnabled = false;
+      if (this[_socketSubscription] == null) {
+        this[_socketSubscription] = this[_socket].listen(dart.bind(this, _eventDispatcher), {onError: dart.bind(this, _reportError), onDone: dart.bind(this, _doneHandler)});
+      } else {
+        if (dart.test(this[_socketSubscription].isPaused)) {
+          this[_socket].close();
+          dart.throw(new core.ArgumentError("Subscription passed to TLS upgrade is paused"));
+        }
+        let s = this[_socket];
+        if (dart.test(dart.dload(dart.dload(s, _socket), 'closedReadEventSent'))) {
+          this[_eventDispatcher](io.RawSocketEvent.READ_CLOSED);
+        }
+        let _ = this[_socketSubscription];
+        _.onData(dart.bind(this, _eventDispatcher));
+        _.onError(dart.bind(this, _reportError));
+        _.onDone(dart.bind(this, _doneHandler));
+      }
+      try {
+        let encodedProtocols = io.SecurityContext._protocolsToLengthEncoding(supportedProtocols);
+        this[_secureFilter].connect(this.address.host, this.context, this.is_server, dart.test(this.requestClientCertificate) || dart.test(this.requireClientCertificate), this.requireClientCertificate, encodedProtocols);
+        this[_secureHandshake]();
+      } catch (e) {
+        let s = dart.stackTrace(e);
+        this[_reportError](e, s);
+      }
+
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      this[_sendWriteEvent]();
+      return this[_stream$].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    static _verifyFields(host, requestedPort, is_server, requestClientCertificate, requireClientCertificate, onBadCertificate) {
+      if (!(typeof host == 'string') && !io.InternetAddress.is(host)) {
+        dart.throw(new core.ArgumentError("host is not a String or an InternetAddress"));
+      }
+      if (!(typeof requestedPort == 'number')) {
+        dart.throw(new core.ArgumentError("requestedPort is not an int"));
+      }
+      if (dart.notNull(requestedPort) < 0 || dart.notNull(requestedPort) > 65535) {
+        dart.throw(new core.ArgumentError("requestedPort is not in the range 0..65535"));
+      }
+      if (!(typeof requestClientCertificate == 'boolean')) {
+        dart.throw(new core.ArgumentError("requestClientCertificate is not a bool"));
+      }
+      if (!(typeof requireClientCertificate == 'boolean')) {
+        dart.throw(new core.ArgumentError("requireClientCertificate is not a bool"));
+      }
+      if (onBadCertificate != null && !core.Function.is(onBadCertificate)) {
+        dart.throw(new core.ArgumentError("onBadCertificate is not null or a Function"));
+      }
+    }
+    get port() {
+      return this[_socket].port;
+    }
+    get remoteAddress() {
+      return this[_socket].remoteAddress;
+    }
+    get remotePort() {
+      return this[_socket].remotePort;
+    }
+    set [_owner](owner) {
+      dart.dput(this[_socket], _owner, owner);
+    }
+    available() {
+      return this[_status] != io._RawSecureSocket.CONNECTED ? 0 : this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).length;
+    }
+    close() {
+      this.shutdown(io.SocketDirection.BOTH);
+      return FutureOfRawSecureSocket()._check(this[_closeCompleter].future);
+    }
+    [_completeCloseCompleter](dummy) {
+      if (dummy === void 0) dummy = null;
+      if (!dart.test(this[_closeCompleter].isCompleted)) this[_closeCompleter].complete(this);
+    }
+    [_close$0]() {
+      this[_closedWrite] = true;
+      this[_closedRead] = true;
+      if (this[_socket] != null) {
+        this[_socket].close().then(dart.void)(dart.bind(this, _completeCloseCompleter));
+      } else {
+        this[_completeCloseCompleter]();
+      }
+      this[_socketClosedWrite] = true;
+      this[_socketClosedRead] = true;
+      if (!dart.test(this[_filterActive]) && this[_secureFilter] != null) {
+        this[_secureFilter].destroy();
+        this[_secureFilter] = null;
+      }
+      if (this[_socketSubscription] != null) {
+        this[_socketSubscription].cancel();
+      }
+      this[_controller$0].close();
+      this[_status] = io._RawSecureSocket.CLOSED;
+    }
+    shutdown(direction) {
+      if (dart.equals(direction, io.SocketDirection.SEND) || dart.equals(direction, io.SocketDirection.BOTH)) {
+        this[_closedWrite] = true;
+        if (dart.test(this[_filterStatus].writeEmpty)) {
+          this[_socket].shutdown(io.SocketDirection.SEND);
+          this[_socketClosedWrite] = true;
+          if (dart.test(this[_closedRead])) {
+            this[_close$0]();
+          }
+        }
+      }
+      if (dart.equals(direction, io.SocketDirection.RECEIVE) || dart.equals(direction, io.SocketDirection.BOTH)) {
+        this[_closedRead] = true;
+        this[_socketClosedRead] = true;
+        this[_socket].shutdown(io.SocketDirection.RECEIVE);
+        if (dart.test(this[_socketClosedWrite])) {
+          this[_close$0]();
+        }
+      }
+    }
+    get writeEventsEnabled() {
+      return this[_writeEventsEnabled];
+    }
+    set writeEventsEnabled(value) {
+      this[_writeEventsEnabled] = value;
+      if (dart.test(value)) {
+        async.Timer.run(dart.fn(() => this[_sendWriteEvent](), VoidTovoid$()));
+      }
+    }
+    get readEventsEnabled() {
+      return this[_readEventsEnabled];
+    }
+    set readEventsEnabled(value) {
+      this[_readEventsEnabled] = value;
+      this[_scheduleReadEvent]();
+    }
+    read(length) {
+      if (length === void 0) length = null;
+      if (length != null && (!(typeof length == 'number') || dart.notNull(length) < 0)) {
+        dart.throw(new core.ArgumentError(dart.str`Invalid length parameter in SecureSocket.read (length: ${length})`));
+      }
+      if (dart.test(this[_closedRead])) {
+        dart.throw(new io.SocketException("Reading from a closed socket"));
+      }
+      if (this[_status] != io._RawSecureSocket.CONNECTED) {
+        return null;
+      }
+      let result = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).read(length);
+      this[_scheduleFilter]();
+      return result;
+    }
+    write(data, offset, bytes) {
+      if (offset === void 0) offset = null;
+      if (bytes === void 0) bytes = null;
+      if (bytes != null && (!(typeof bytes == 'number') || dart.notNull(bytes) < 0)) {
+        dart.throw(new core.ArgumentError(dart.str`Invalid bytes parameter in SecureSocket.read (bytes: ${bytes})`));
+      }
+      if (offset != null && (!(typeof offset == 'number') || dart.notNull(offset) < 0)) {
+        dart.throw(new core.ArgumentError(dart.str`Invalid offset parameter in SecureSocket.read (offset: ${offset})`));
+      }
+      if (dart.test(this[_closedWrite])) {
+        this[_controller$0].addError(new io.SocketException("Writing to a closed socket"));
+        return 0;
+      }
+      if (this[_status] != io._RawSecureSocket.CONNECTED) return 0;
+      if (offset == null) offset = 0;
+      if (bytes == null) bytes = dart.notNull(data[dartx.length]) - dart.notNull(offset);
+      let written = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).write(data, offset, bytes);
+      if (dart.notNull(written) > 0) {
+        this[_filterStatus].writeEmpty = false;
+      }
+      this[_scheduleFilter]();
+      return written;
+    }
+    get peerCertificate() {
+      return this[_secureFilter].peerCertificate;
+    }
+    get selectedProtocol() {
+      return this[_selectedProtocol];
+    }
+    [_onBadCertificateWrapper](certificate) {
+      if (this.onBadCertificate == null) return false;
+      let result = dart.dcall(this.onBadCertificate, certificate);
+      if (typeof result == 'boolean') return result;
+      dart.throw(new io.HandshakeException(dart.str`onBadCertificate callback returned non-boolean ${result}`));
+    }
+    setOption(option, enabled) {
+      if (this[_socket] == null) return false;
+      return this[_socket].setOption(option, enabled);
+    }
+    [_eventDispatcher](event) {
+      try {
+        if (dart.equals(event, io.RawSocketEvent.READ)) {
+          this[_readHandler]();
+        } else if (dart.equals(event, io.RawSocketEvent.WRITE)) {
+          this[_writeHandler]();
+        } else if (dart.equals(event, io.RawSocketEvent.READ_CLOSED)) {
+          this[_closeHandler]();
+        }
+      } catch (e) {
+        let stackTrace = dart.stackTrace(e);
+        this[_reportError](e, stackTrace);
+      }
+
+    }
+    [_readHandler]() {
+      this[_readSocket]();
+      this[_scheduleFilter]();
+    }
+    [_writeHandler]() {
+      this[_writeSocket]();
+      this[_scheduleFilter]();
+    }
+    [_doneHandler]() {
+      if (dart.test(this[_filterStatus].readEmpty)) {
+        this[_close$0]();
+      }
+    }
+    [_reportError](e, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      if (this[_status] == io._RawSecureSocket.CLOSED) {
+        return;
+      } else if (dart.test(this[_connectPending])) {
+        this[_handshakeComplete].completeError(e, stackTrace);
+      } else {
+        this[_controller$0].addError(e, stackTrace);
+      }
+      this[_close$0]();
+    }
+    [_closeHandler]() {
+      if (this[_status] == io._RawSecureSocket.CONNECTED) {
+        if (dart.test(this[_closedRead])) return;
+        this[_socketClosedRead] = true;
+        if (dart.test(this[_filterStatus].readEmpty)) {
+          this[_closedRead] = true;
+          this[_controller$0].add(io.RawSocketEvent.READ_CLOSED);
+          if (dart.test(this[_socketClosedWrite])) {
+            this[_close$0]();
+          }
+        } else {
+          this[_scheduleFilter]();
+        }
+      } else if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+        this[_socketClosedRead] = true;
+        if (dart.test(this[_filterStatus].readEmpty)) {
+          this[_reportError](new io.HandshakeException('Connection terminated during handshake'), null);
+        } else {
+          this[_secureHandshake]();
+        }
+      }
+    }
+    [_secureHandshake]() {
+      try {
+        this[_secureFilter].handshake();
+        this[_filterStatus].writeEmpty = false;
+        this[_readSocket]();
+        this[_writeSocket]();
+        this[_scheduleFilter]();
+      } catch (e) {
+        let stackTrace = dart.stackTrace(e);
+        this[_reportError](e, stackTrace);
+      }
+
+    }
+    renegotiate(opts) {
+      let useSessionCache = opts && 'useSessionCache' in opts ? opts.useSessionCache : true;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      if (this[_status] != io._RawSecureSocket.CONNECTED) {
+        dart.throw(new io.HandshakeException("Called renegotiate on a non-connected socket"));
+      }
+      this[_secureFilter].renegotiate(useSessionCache, requestClientCertificate, requireClientCertificate);
+      this[_status] = io._RawSecureSocket.HANDSHAKE;
+      this[_filterStatus].writeEmpty = false;
+      this[_scheduleFilter]();
+    }
+    [_secureHandshakeCompleteHandler]() {
+      this[_status] = io._RawSecureSocket.CONNECTED;
+      if (dart.test(this[_connectPending])) {
+        this[_connectPending] = false;
+        try {
+          this[_selectedProtocol] = this[_secureFilter].selectedProtocol();
+          async.Timer.run(dart.fn(() => this[_handshakeComplete].complete(this), VoidTovoid$()));
+        } catch (error) {
+          let stack = dart.stackTrace(error);
+          this[_handshakeComplete].completeError(error, stack);
+        }
+
+      }
+    }
+    [_onPauseStateChange]() {
+      if (dart.test(this[_controller$0].isPaused)) {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) + 1;
+      } else {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) - 1;
+        if (this[_pauseCount$] == 0) {
+          this[_scheduleReadEvent]();
+          this[_sendWriteEvent]();
+        }
+      }
+      if (!dart.test(this[_socketClosedRead]) || !dart.test(this[_socketClosedWrite])) {
+        if (dart.test(this[_controller$0].isPaused)) {
+          this[_socketSubscription].pause();
+        } else {
+          this[_socketSubscription].resume();
+        }
+      }
+    }
+    [_onSubscriptionStateChange]() {
+      if (dart.test(this[_controller$0].hasListener)) {
+      }
+    }
+    [_scheduleFilter]() {
+      this[_filterPending] = true;
+      this[_tryFilter]();
+    }
+    [_tryFilter]() {
+      if (this[_status] == io._RawSecureSocket.CLOSED) {
+        return;
+      }
+      if (dart.test(this[_filterPending]) && !dart.test(this[_filterActive])) {
+        this[_filterActive] = true;
+        this[_filterPending] = false;
+        this[_pushAllFilterStages]().then(dart.dynamic)(dart.fn(status => {
+          this[_filterStatus] = status;
+          this[_filterActive] = false;
+          if (this[_status] == io._RawSecureSocket.CLOSED) {
+            this[_secureFilter].destroy();
+            this[_secureFilter] = null;
+            return;
+          }
+          this[_socket].readEventsEnabled = true;
+          if (dart.test(this[_filterStatus].writeEmpty) && dart.test(this[_closedWrite]) && !dart.test(this[_socketClosedWrite])) {
+            this.shutdown(io.SocketDirection.SEND);
+            if (this[_status] == io._RawSecureSocket.CLOSED) {
+              return;
+            }
+          }
+          if (dart.test(this[_filterStatus].readEmpty) && dart.test(this[_socketClosedRead]) && !dart.test(this[_closedRead])) {
+            if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+              this[_secureFilter].handshake();
+              if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+                dart.throw(new io.HandshakeException('Connection terminated during handshake'));
+              }
+            }
+            this[_closeHandler]();
+          }
+          if (this[_status] == io._RawSecureSocket.CLOSED) {
+            return;
+          }
+          if (dart.test(this[_filterStatus].progress)) {
+            this[_filterPending] = true;
+            if (dart.test(this[_filterStatus].writeEncryptedNoLongerEmpty)) {
+              this[_writeSocket]();
+            }
+            if (dart.test(this[_filterStatus].writePlaintextNoLongerFull)) {
+              this[_sendWriteEvent]();
+            }
+            if (dart.test(this[_filterStatus].readEncryptedNoLongerFull)) {
+              this[_readSocket]();
+            }
+            if (dart.test(this[_filterStatus].readPlaintextNoLongerEmpty)) {
+              this[_scheduleReadEvent]();
+            }
+            if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+              this[_secureHandshake]();
+            }
+          }
+          this[_tryFilter]();
+        }, _FilterStatusToNull())).catchError(dart.bind(this, _reportError));
+      }
+    }
+    [_readSocketOrBufferedData](bytes) {
+      if (this[_bufferedData] != null) {
+        if (dart.notNull(bytes) > dart.notNull(this[_bufferedData][dartx.length]) - dart.notNull(this[_bufferedDataIndex])) {
+          bytes = dart.notNull(this[_bufferedData][dartx.length]) - dart.notNull(this[_bufferedDataIndex]);
+        }
+        let result = this[_bufferedData][dartx.sublist](this[_bufferedDataIndex], dart.notNull(this[_bufferedDataIndex]) + dart.notNull(bytes));
+        this[_bufferedDataIndex] = dart.notNull(this[_bufferedDataIndex]) + dart.notNull(bytes);
+        if (this[_bufferedData][dartx.length] == this[_bufferedDataIndex]) {
+          this[_bufferedData] = null;
+        }
+        return result;
+      } else if (!dart.test(this[_socketClosedRead])) {
+        return this[_socket].read(bytes);
+      } else {
+        return null;
+      }
+    }
+    [_readSocket]() {
+      if (this[_status] == io._RawSecureSocket.CLOSED) return;
+      let buffer = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_ENCRYPTED);
+      if (dart.notNull(buffer.writeFromSource(dart.bind(this, _readSocketOrBufferedData))) > 0) {
+        this[_filterStatus].readEmpty = false;
+      } else {
+        this[_socket].readEventsEnabled = false;
+      }
+    }
+    [_writeSocket]() {
+      if (dart.test(this[_socketClosedWrite])) return;
+      let buffer = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_ENCRYPTED);
+      if (dart.test(buffer.readToSocket(this[_socket]))) {
+        this[_socket].writeEventsEnabled = true;
+      }
+    }
+    [_scheduleReadEvent]() {
+      if (!dart.test(this[_pendingReadEvent]) && dart.test(this[_readEventsEnabled]) && this[_pauseCount$] == 0 && this[_secureFilter] != null && !dart.test(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).isEmpty)) {
+        this[_pendingReadEvent] = true;
+        async.Timer.run(dart.bind(this, _sendReadEvent));
+      }
+    }
+    [_sendReadEvent]() {
+      this[_pendingReadEvent] = false;
+      if (this[_status] != io._RawSecureSocket.CLOSED && dart.test(this[_readEventsEnabled]) && this[_pauseCount$] == 0 && this[_secureFilter] != null && !dart.test(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).isEmpty)) {
+        this[_controller$0].add(io.RawSocketEvent.READ);
+        this[_scheduleReadEvent]();
+      }
+    }
+    [_sendWriteEvent]() {
+      if (!dart.test(this[_closedWrite]) && dart.test(this[_writeEventsEnabled]) && this[_pauseCount$] == 0 && this[_secureFilter] != null && dart.notNull(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).free) > 0) {
+        this[_writeEventsEnabled] = false;
+        this[_controller$0].add(io.RawSocketEvent.WRITE);
+      }
+    }
+    [_pushAllFilterStages]() {
+      let wasInHandshake = this[_status] != io._RawSecureSocket.CONNECTED;
+      let args = core.List.new(2 + dart.notNull(io._RawSecureSocket.NUM_BUFFERS) * 2);
+      args[dartx._set](0, this[_secureFilter][_pointer]());
+      args[dartx._set](1, wasInHandshake);
+      let bufs = this[_secureFilter].buffers;
+      for (let i = 0; i < dart.notNull(io._RawSecureSocket.NUM_BUFFERS); ++i) {
+        args[dartx._set](2 * i + 2, bufs[dartx._get](i).start);
+        args[dartx._set](2 * i + 3, bufs[dartx._get](i).end);
+      }
+      return io._IOService._dispatch(io._SSL_PROCESS_FILTER, args).then(io._FilterStatus)(dart.fn(response => {
+        if (dart.equals(dart.dload(response, 'length'), 2)) {
+          if (wasInHandshake) {
+            this[_reportError](new io.HandshakeException(dart.str`${dart.dindex(response, 1)} error ${dart.dindex(response, 0)}`), null);
+          } else {
+            this[_reportError](new io.TlsException(dart.str`${dart.dindex(response, 1)} error ${dart.dindex(response, 0)}`), null);
+          }
+        }
+        function start(index) {
+          return core.int._check(dart.dindex(response, 2 * dart.notNull(index)));
+        }
+        dart.fn(start, intToint());
+        function end(index) {
+          return core.int._check(dart.dindex(response, 2 * dart.notNull(index) + 1));
+        }
+        dart.fn(end, intToint());
+        let status = new io._FilterStatus();
+        status.writeEmpty = dart.test(bufs[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).isEmpty) && start(io._RawSecureSocket.WRITE_ENCRYPTED) == end(io._RawSecureSocket.WRITE_ENCRYPTED);
+        if (wasInHandshake) status.writeEmpty = false;
+        status.readEmpty = dart.test(bufs[dartx._get](io._RawSecureSocket.READ_ENCRYPTED).isEmpty) && start(io._RawSecureSocket.READ_PLAINTEXT) == end(io._RawSecureSocket.READ_PLAINTEXT);
+        let buffer = bufs[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT);
+        let new_start = start(io._RawSecureSocket.WRITE_PLAINTEXT);
+        if (new_start != buffer.start) {
+          status.progress = true;
+          if (buffer.free == 0) {
+            status.writePlaintextNoLongerFull = true;
+          }
+          buffer.start = new_start;
+        }
+        buffer = bufs[dartx._get](io._RawSecureSocket.READ_ENCRYPTED);
+        new_start = start(io._RawSecureSocket.READ_ENCRYPTED);
+        if (new_start != buffer.start) {
+          status.progress = true;
+          if (buffer.free == 0) {
+            status.readEncryptedNoLongerFull = true;
+          }
+          buffer.start = new_start;
+        }
+        buffer = bufs[dartx._get](io._RawSecureSocket.WRITE_ENCRYPTED);
+        let new_end = end(io._RawSecureSocket.WRITE_ENCRYPTED);
+        if (new_end != buffer.end) {
+          status.progress = true;
+          if (buffer.length == 0) {
+            status.writeEncryptedNoLongerEmpty = true;
+          }
+          buffer.end = new_end;
+        }
+        buffer = bufs[dartx._get](io._RawSecureSocket.READ_PLAINTEXT);
+        new_end = end(io._RawSecureSocket.READ_PLAINTEXT);
+        if (new_end != buffer.end) {
+          status.progress = true;
+          if (buffer.length == 0) {
+            status.readPlaintextNoLongerEmpty = true;
+          }
+          buffer.end = new_end;
+        }
+        return status;
+      }, dynamicTo_FilterStatus()));
+    }
+  };
+  dart.addSimpleTypeTests(io._RawSecureSocket);
+  io._RawSecureSocket[dart.implements] = () => [io.RawSecureSocket];
+  dart.setSignature(io._RawSecureSocket, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RawSecureSocket, [io.InternetAddress, core.int, core.bool, io.SecurityContext, io.RawSocket, StreamSubscriptionOfRawSocketEvent(), ListOfint(), core.bool, core.bool, X509CertificateTodynamic(), ListOfString()])}),
+    fields: () => ({
+      [_socket]: io.RawSocket,
+      [_handshakeComplete]: CompleterOf_RawSecureSocket(),
+      [_controller$0]: StreamControllerOfRawSocketEvent(),
+      [_stream$]: StreamOfRawSocketEvent(),
+      [_socketSubscription]: StreamSubscriptionOfRawSocketEvent(),
+      [_bufferedData]: ListOfint(),
+      [_bufferedDataIndex]: core.int,
+      address: io.InternetAddress,
+      is_server: core.bool,
+      context: io.SecurityContext,
+      requestClientCertificate: core.bool,
+      requireClientCertificate: core.bool,
+      onBadCertificate: core.Function,
+      [_status]: core.int,
+      [_writeEventsEnabled]: core.bool,
+      [_readEventsEnabled]: core.bool,
+      [_pauseCount$]: core.int,
+      [_pendingReadEvent]: core.bool,
+      [_socketClosedRead]: core.bool,
+      [_socketClosedWrite]: core.bool,
+      [_closedRead]: core.bool,
+      [_closedWrite]: core.bool,
+      [_closeCompleter]: async.Completer,
+      [_filterStatus]: io._FilterStatus,
+      [_connectPending]: core.bool,
+      [_filterPending]: core.bool,
+      [_filterActive]: core.bool,
+      [_secureFilter]: io._SecureFilter,
+      [_selectedProtocol]: core.String
+    }),
+    getters: () => ({
+      port: dart.definiteFunctionType(core.int, []),
+      remoteAddress: dart.definiteFunctionType(io.InternetAddress, []),
+      remotePort: dart.definiteFunctionType(core.int, []),
+      writeEventsEnabled: dart.definiteFunctionType(core.bool, []),
+      readEventsEnabled: dart.definiteFunctionType(core.bool, []),
+      peerCertificate: dart.definiteFunctionType(io.X509Certificate, []),
+      selectedProtocol: dart.definiteFunctionType(core.String, [])
+    }),
+    setters: () => ({
+      [_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      writeEventsEnabled: dart.definiteFunctionType(dart.void, [core.bool]),
+      readEventsEnabled: dart.definiteFunctionType(dart.void, [core.bool])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSocketEvent), [RawSocketEventTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      available: dart.definiteFunctionType(core.int, []),
+      close: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), []),
+      [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [dart.dynamic]),
+      [_close$0]: dart.definiteFunctionType(dart.void, []),
+      shutdown: dart.definiteFunctionType(dart.void, [io.SocketDirection]),
+      read: dart.definiteFunctionType(core.List$(core.int), [], [core.int]),
+      write: dart.definiteFunctionType(core.int, [ListOfint()], [core.int, core.int]),
+      [_onBadCertificateWrapper]: dart.definiteFunctionType(core.bool, [io.X509Certificate]),
+      setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
+      [_eventDispatcher]: dart.definiteFunctionType(dart.void, [io.RawSocketEvent]),
+      [_readHandler]: dart.definiteFunctionType(dart.void, []),
+      [_writeHandler]: dart.definiteFunctionType(dart.void, []),
+      [_doneHandler]: dart.definiteFunctionType(dart.void, []),
+      [_reportError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      [_closeHandler]: dart.definiteFunctionType(dart.void, []),
+      [_secureHandshake]: dart.definiteFunctionType(dart.void, []),
+      renegotiate: dart.definiteFunctionType(dart.void, [], {useSessionCache: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool}),
+      [_secureHandshakeCompleteHandler]: dart.definiteFunctionType(dart.void, []),
+      [_onPauseStateChange]: dart.definiteFunctionType(dart.void, []),
+      [_onSubscriptionStateChange]: dart.definiteFunctionType(dart.void, []),
+      [_scheduleFilter]: dart.definiteFunctionType(dart.void, []),
+      [_tryFilter]: dart.definiteFunctionType(dart.void, []),
+      [_readSocketOrBufferedData]: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+      [_readSocket]: dart.definiteFunctionType(dart.void, []),
+      [_writeSocket]: dart.definiteFunctionType(dart.void, []),
+      [_scheduleReadEvent]: dart.definiteFunctionType(dart.dynamic, []),
+      [_sendReadEvent]: dart.definiteFunctionType(dart.dynamic, []),
+      [_sendWriteEvent]: dart.definiteFunctionType(dart.dynamic, []),
+      [_pushAllFilterStages]: dart.definiteFunctionType(async.Future$(io._FilterStatus), [])
+    }),
+    sfields: () => ({
+      HANDSHAKE: core.int,
+      CONNECTED: core.int,
+      CLOSED: core.int,
+      READ_PLAINTEXT: core.int,
+      WRITE_PLAINTEXT: core.int,
+      READ_ENCRYPTED: core.int,
+      WRITE_ENCRYPTED: core.int,
+      NUM_BUFFERS: core.int
+    }),
+    statics: () => ({
+      _isBufferEncrypted: dart.definiteFunctionType(core.bool, [core.int]),
+      connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      _verifyFields: dart.definiteFunctionType(dart.void, [dart.dynamic, core.int, core.bool, core.bool, core.bool, core.Function])
+    }),
+    names: ['_isBufferEncrypted', 'connect', '_verifyFields']
+  });
+  io._RawSecureSocket.HANDSHAKE = 201;
+  io._RawSecureSocket.CONNECTED = 202;
+  io._RawSecureSocket.CLOSED = 203;
+  io._RawSecureSocket.READ_PLAINTEXT = 0;
+  io._RawSecureSocket.WRITE_PLAINTEXT = 1;
+  io._RawSecureSocket.READ_ENCRYPTED = 2;
+  io._RawSecureSocket.WRITE_ENCRYPTED = 3;
+  io._RawSecureSocket.NUM_BUFFERS = 4;
+  io._ExternalBuffer = class _ExternalBuffer extends core.Object {
+    new(size) {
+      this.size = size;
+      this.data = null;
+      this.start = null;
+      this.end = null;
+      this.start = core.int._check(this.end = core.int._check(dart.dsend(this.size, '~/', 2)));
+    }
+    advanceStart(bytes) {
+      dart.assert(dart.notNull(this.start) > dart.notNull(this.end) || dart.notNull(this.start) + dart.notNull(bytes) <= dart.notNull(this.end));
+      this.start = dart.notNull(this.start) + dart.notNull(bytes);
+      if (dart.notNull(this.start) >= dart.notNull(core.num._check(this.size))) {
+        this.start = dart.notNull(this.start) - dart.notNull(core.num._check(this.size));
+        dart.assert(dart.notNull(this.start) <= dart.notNull(this.end));
+        dart.assert(dart.notNull(this.start) < dart.notNull(core.num._check(this.size)));
+      }
+    }
+    advanceEnd(bytes) {
+      dart.assert(dart.notNull(this.start) <= dart.notNull(this.end) || dart.notNull(this.start) > dart.notNull(this.end) + dart.notNull(bytes));
+      this.end = dart.notNull(this.end) + dart.notNull(bytes);
+      if (dart.notNull(this.end) >= dart.notNull(core.num._check(this.size))) {
+        this.end = dart.notNull(this.end) - dart.notNull(core.num._check(this.size));
+        dart.assert(dart.notNull(this.end) < dart.notNull(this.start));
+        dart.assert(dart.notNull(this.end) < dart.notNull(core.num._check(this.size)));
+      }
+    }
+    get isEmpty() {
+      return this.end == this.start;
+    }
+    get length() {
+      return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.dsend(dart.dsend(this.size, '+', this.end), '-', this.start) : dart.notNull(this.end) - dart.notNull(this.start));
+    }
+    get linearLength() {
+      return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.dsend(this.size, '-', this.start) : dart.notNull(this.end) - dart.notNull(this.start));
+    }
+    get free() {
+      return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.notNull(this.start) - dart.notNull(this.end) - 1 : dart.dsend(dart.dsend(dart.dsend(this.size, '+', this.start), '-', this.end), '-', 1));
+    }
+    get linearFree() {
+      if (dart.notNull(this.start) > dart.notNull(this.end)) return dart.notNull(this.start) - dart.notNull(this.end) - 1;
+      if (this.start == 0) return core.int._check(dart.dsend(dart.dsend(this.size, '-', this.end), '-', 1));
+      return core.int._check(dart.dsend(this.size, '-', this.end));
+    }
+    read(bytes) {
+      if (bytes == null) {
+        bytes = this.length;
+      } else {
+        bytes = math.min(core.int)(bytes, this.length);
+      }
+      if (bytes == 0) return null;
+      let result = typed_data.Uint8List.new(bytes);
+      let bytesRead = 0;
+      while (dart.notNull(bytesRead) < dart.notNull(bytes)) {
+        let toRead = math.min(core.int)(dart.notNull(bytes) - dart.notNull(bytesRead), this.linearLength);
+        result[dartx.setRange](bytesRead, dart.notNull(bytesRead) + dart.notNull(toRead), this.data, this.start);
+        this.advanceStart(toRead);
+        bytesRead = dart.notNull(bytesRead) + dart.notNull(toRead);
+      }
+      return result;
+    }
+    write(inputData, offset, bytes) {
+      if (dart.notNull(bytes) > dart.notNull(this.free)) {
+        bytes = this.free;
+      }
+      let written = 0;
+      let toWrite = math.min(core.int)(bytes, this.linearFree);
+      while (dart.notNull(toWrite) > 0) {
+        this.data[dartx.setRange](this.end, dart.notNull(this.end) + dart.notNull(toWrite), inputData, offset);
+        this.advanceEnd(toWrite);
+        offset = dart.notNull(offset) + dart.notNull(toWrite);
+        written = dart.notNull(written) + dart.notNull(toWrite);
+        toWrite = math.min(core.int)(dart.notNull(bytes) - dart.notNull(written), this.linearFree);
+      }
+      return written;
+    }
+    writeFromSource(getData) {
+      let written = 0;
+      let toWrite = this.linearFree;
+      while (dart.notNull(toWrite) > 0) {
+        let inputData = getData(toWrite);
+        if (inputData == null || inputData[dartx.length] == 0) break;
+        let len = inputData[dartx.length];
+        this.data[dartx.setRange](this.end, dart.notNull(this.end) + dart.notNull(len), inputData);
+        this.advanceEnd(len);
+        written = dart.notNull(written) + dart.notNull(len);
+        toWrite = this.linearFree;
+      }
+      return written;
+    }
+    readToSocket(socket) {
+      while (true) {
+        let toWrite = this.linearLength;
+        if (toWrite == 0) return false;
+        let bytes = socket.write(ListOfint()._check(this.data), this.start, toWrite);
+        this.advanceStart(bytes);
+        if (dart.notNull(bytes) < dart.notNull(toWrite)) {
+          return true;
+        }
+      }
+    }
+  };
+  dart.setSignature(io._ExternalBuffer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ExternalBuffer, [dart.dynamic])}),
+    fields: () => ({
+      data: core.List,
+      start: core.int,
+      end: core.int,
+      size: dart.dynamic
+    }),
+    getters: () => ({
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      length: dart.definiteFunctionType(core.int, []),
+      linearLength: dart.definiteFunctionType(core.int, []),
+      free: dart.definiteFunctionType(core.int, []),
+      linearFree: dart.definiteFunctionType(core.int, [])
+    }),
+    methods: () => ({
+      advanceStart: dart.definiteFunctionType(dart.void, [core.int]),
+      advanceEnd: dart.definiteFunctionType(dart.void, [core.int]),
+      read: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+      write: dart.definiteFunctionType(core.int, [ListOfint(), core.int, core.int]),
+      writeFromSource: dart.definiteFunctionType(core.int, [intToListOfint()]),
+      readToSocket: dart.definiteFunctionType(core.bool, [io.RawSocket])
+    })
+  });
+  io._SecureFilter = class _SecureFilter extends core.Object {
+    static new() {
+      dart.throw(new core.UnsupportedError("_SecureFilter._SecureFilter"));
+    }
+  };
+  dart.setSignature(io._SecureFilter, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SecureFilter, [])})
+  });
+  io.TlsException = class TlsException extends core.Object {
+    new(message, osError) {
+      if (message === void 0) message = "";
+      if (osError === void 0) osError = null;
+      TlsException.prototype._.call(this, "TlsException", message, osError);
+    }
+    _(type, message, osError) {
+      this.type = type;
+      this.message = message;
+      this.osError = osError;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write(this.type);
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(dart.str`: ${this.message}`);
+        if (this.osError != null) {
+          sb.write(dart.str` (${this.osError})`);
+        }
+      } else if (this.osError != null) {
+        sb.write(dart.str`: ${this.osError}`);
+      }
+      return sb.toString();
+    }
+  };
+  dart.defineNamedConstructor(io.TlsException, '_');
+  io.TlsException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.TlsException, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.TlsException, [], [core.String, io.OSError]),
+      _: dart.definiteFunctionType(io.TlsException, [core.String, core.String, io.OSError])
+    }),
+    fields: () => ({
+      type: core.String,
+      message: core.String,
+      osError: io.OSError
+    })
+  });
+  io.HandshakeException = class HandshakeException extends io.TlsException {
+    new(message, osError) {
+      if (message === void 0) message = "";
+      if (osError === void 0) osError = null;
+      super._("HandshakeException", message, osError);
+    }
+  };
+  dart.setSignature(io.HandshakeException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HandshakeException, [], [core.String, io.OSError])})
+  });
+  io.CertificateException = class CertificateException extends io.TlsException {
+    new(message, osError) {
+      if (message === void 0) message = "";
+      if (osError === void 0) osError = null;
+      super._("CertificateException", message, osError);
+    }
+  };
+  dart.setSignature(io.CertificateException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.CertificateException, [], [core.String, io.OSError])})
+  });
+  io.SecurityContext = class SecurityContext extends core.Object {
+    static new() {
+      dart.throw(new core.UnsupportedError("SecurityContext constructor"));
+    }
+    static get defaultContext() {
+      dart.throw(new core.UnsupportedError("default SecurityContext getter"));
+    }
+    static get alpnSupported() {
+      dart.throw(new core.UnsupportedError("SecurityContext alpnSupported getter"));
+    }
+    static _protocolsToLengthEncoding(protocols) {
+      if (protocols == null || protocols[dartx.length] == 0) {
+        return typed_data.Uint8List.new(0);
+      }
+      let protocolsLength = protocols[dartx.length];
+      let expectedLength = protocolsLength;
+      for (let i = 0; i < dart.notNull(protocolsLength); i++) {
+        let length = protocols[dartx._get](i)[dartx.length];
+        if (dart.notNull(length) > 0 && dart.notNull(length) <= 255) {
+          expectedLength = dart.notNull(expectedLength) + dart.notNull(length);
+        } else {
+          dart.throw(new core.ArgumentError(dart.str`Length of protocol must be between 1 and 255 (was: ${length}).`));
+        }
+      }
+      if (dart.notNull(expectedLength) >= 1 << 13) {
+        dart.throw(new core.ArgumentError('The maximum message length supported is 2^13-1.'));
+      }
+      let bytes = typed_data.Uint8List.new(expectedLength);
+      let bytesOffset = 0;
+      for (let i = 0; i < dart.notNull(protocolsLength); i++) {
+        let proto = protocols[dartx._get](i);
+        bytes[dartx._set](bytesOffset++, proto[dartx.length]);
+        let bits = 0;
+        for (let j = 0; j < dart.notNull(proto[dartx.length]); j++) {
+          let char = proto[dartx.codeUnitAt](j);
+          bits = (dart.notNull(bits) | dart.notNull(char)) >>> 0;
+          bytes[dartx._set](bytesOffset++, dart.notNull(char) & 255);
+        }
+        if (dart.notNull(bits) > 127) {
+          return io.SecurityContext._protocolsToLengthEncodingNonAsciiBailout(protocols);
+        }
+      }
+      return bytes;
+    }
+    static _protocolsToLengthEncodingNonAsciiBailout(protocols) {
+      function addProtocol(outBytes, protocol) {
+        let protocolBytes = convert.UTF8.encode(protocol);
+        let len = protocolBytes[dartx.length];
+        if (dart.notNull(len) > 255) {
+          dart.throw(new core.ArgumentError(dart.str`Length of protocol must be between 1 and 255 (was: ${len})`));
+        }
+        outBytes[dartx.add](len);
+        outBytes[dartx.addAll](protocolBytes);
+      }
+      dart.fn(addProtocol, ListOfintAndStringTovoid());
+      let bytes = JSArrayOfint().of([]);
+      for (let i = 0; i < dart.notNull(protocols[dartx.length]); i++) {
+        addProtocol(bytes, protocols[dartx._get](i));
+      }
+      if (dart.notNull(bytes[dartx.length]) >= 1 << 13) {
+        dart.throw(new core.ArgumentError('The maximum message length supported is 2^13-1.'));
+      }
+      return typed_data.Uint8List.fromList(bytes);
+    }
+  };
+  dart.setSignature(io.SecurityContext, {
+    constructors: () => ({new: dart.definiteFunctionType(io.SecurityContext, [])}),
+    sgetters: () => ({
+      defaultContext: dart.definiteFunctionType(io.SecurityContext, []),
+      alpnSupported: dart.definiteFunctionType(core.bool, [])
+    }),
+    statics: () => ({
+      _protocolsToLengthEncoding: dart.definiteFunctionType(typed_data.Uint8List, [ListOfString()]),
+      _protocolsToLengthEncodingNonAsciiBailout: dart.definiteFunctionType(typed_data.Uint8List, [ListOfString()])
+    }),
+    names: ['_protocolsToLengthEncoding', '_protocolsToLengthEncodingNonAsciiBailout']
+  });
+  io._nextServiceId = 1;
+  io.InternetAddressType = class InternetAddressType extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+    static _from(value) {
+      if (value == 0) return io.InternetAddressType.IP_V4;
+      if (value == 1) return io.InternetAddressType.IP_V6;
+      dart.throw(new core.ArgumentError(dart.str`Invalid type: ${value}`));
+    }
+    get name() {
+      switch (this[_value$1]) {
+        case -1:
+        {
+          return "ANY";
+        }
+        case 0:
+        {
+          return "IP_V4";
+        }
+        case 1:
+        {
+          return "IP_V6";
+        }
+        default:
+        {
+          dart.throw(new core.ArgumentError("Invalid InternetAddress"));
+        }
+      }
+    }
+    toString() {
+      return dart.str`InternetAddressType: ${this.name}`;
+    }
+  };
+  dart.defineNamedConstructor(io.InternetAddressType, '_');
+  dart.setSignature(io.InternetAddressType, {
+    constructors: () => ({
+      _: dart.definiteFunctionType(io.InternetAddressType, [core.int]),
+      _from: dart.definiteFunctionType(io.InternetAddressType, [core.int])
+    }),
+    fields: () => ({[_value$1]: core.int}),
+    getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+    sfields: () => ({
+      IP_V4: io.InternetAddressType,
+      IP_V6: io.InternetAddressType,
+      ANY: io.InternetAddressType
+    })
+  });
+  dart.defineLazy(io.InternetAddressType, {
+    get IP_V4() {
+      return dart.const(new io.InternetAddressType._(0));
+    },
+    get IP_V6() {
+      return dart.const(new io.InternetAddressType._(1));
+    },
+    get ANY() {
+      return dart.const(new io.InternetAddressType._(-1));
+    }
+  });
+  io.InternetAddress = class InternetAddress extends core.Object {
+    static get LOOPBACK_IP_V4() {
+      dart.throw(new core.UnsupportedError("InternetAddress.LOOPBACK_IP_V4"));
+    }
+    static get LOOPBACK_IP_V6() {
+      dart.throw(new core.UnsupportedError("InternetAddress.LOOPBACK_IP_V6"));
+    }
+    static get ANY_IP_V4() {
+      dart.throw(new core.UnsupportedError("InternetAddress.ANY_IP_V4"));
+    }
+    static get ANY_IP_V6() {
+      dart.throw(new core.UnsupportedError("InternetAddress.ANY_IP_V6"));
+    }
+    static new(address) {
+      dart.throw(new core.UnsupportedError("InternetAddress"));
+    }
+    static lookup(host, opts) {
+      let type = opts && 'type' in opts ? opts.type : io.InternetAddressType.ANY;
+      dart.throw(new core.UnsupportedError("InternetAddress.lookup"));
+    }
+    static _cloneWithNewHost(address, host) {
+      dart.throw(new core.UnsupportedError("InternetAddress._cloneWithNewHost"));
+    }
+  };
+  dart.setSignature(io.InternetAddress, {
+    constructors: () => ({new: dart.definiteFunctionType(io.InternetAddress, [core.String])}),
+    fields: () => ({type: io.InternetAddressType}),
+    sgetters: () => ({
+      LOOPBACK_IP_V4: dart.definiteFunctionType(io.InternetAddress, []),
+      LOOPBACK_IP_V6: dart.definiteFunctionType(io.InternetAddress, []),
+      ANY_IP_V4: dart.definiteFunctionType(io.InternetAddress, []),
+      ANY_IP_V6: dart.definiteFunctionType(io.InternetAddress, [])
+    }),
+    statics: () => ({
+      lookup: dart.definiteFunctionType(async.Future$(core.List$(io.InternetAddress)), [core.String], {type: io.InternetAddressType}),
+      _cloneWithNewHost: dart.definiteFunctionType(io.InternetAddress, [io.InternetAddress, core.String])
+    }),
+    names: ['lookup', '_cloneWithNewHost']
+  });
+  io.NetworkInterface = class NetworkInterface extends core.Object {
+    static get listSupported() {
+      dart.throw(new core.UnsupportedError("NetworkInterface.listSupported"));
+    }
+    static list(opts) {
+      let includeLoopback = opts && 'includeLoopback' in opts ? opts.includeLoopback : false;
+      let includeLinkLocal = opts && 'includeLinkLocal' in opts ? opts.includeLinkLocal : false;
+      let type = opts && 'type' in opts ? opts.type : io.InternetAddressType.ANY;
+      dart.throw(new core.UnsupportedError("NetworkInterface.list"));
+    }
+  };
+  dart.setSignature(io.NetworkInterface, {
+    sgetters: () => ({listSupported: dart.definiteFunctionType(core.bool, [])}),
+    statics: () => ({list: dart.definiteFunctionType(async.Future$(core.List$(io.NetworkInterface)), [], {includeLoopback: core.bool, includeLinkLocal: core.bool, type: io.InternetAddressType})}),
+    names: ['list']
+  });
+  io.RawServerSocket = class RawServerSocket extends core.Object {
+    static bind(address, port, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      dart.throw(new core.UnsupportedError("RawServerSocket.bind"));
+    }
+  };
+  io.RawServerSocket[dart.implements] = () => [StreamOfRawSocket()];
+  dart.setSignature(io.RawServerSocket, {
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawServerSocket), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool})}),
+    names: ['bind']
+  });
+  io.ServerSocket = class ServerSocket extends core.Object {
+    static bind(address, port, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      dart.throw(new core.UnsupportedError("ServerSocket.bind"));
+    }
+  };
+  io.ServerSocket[dart.implements] = () => [StreamOfSocket()];
+  dart.setSignature(io.ServerSocket, {
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.ServerSocket), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool})}),
+    names: ['bind']
+  });
+  io.SocketDirection = class SocketDirection extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+  };
+  dart.defineNamedConstructor(io.SocketDirection, '_');
+  dart.setSignature(io.SocketDirection, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SocketDirection, [dart.dynamic])}),
+    fields: () => ({[_value$1]: dart.dynamic}),
+    sfields: () => ({
+      RECEIVE: io.SocketDirection,
+      SEND: io.SocketDirection,
+      BOTH: io.SocketDirection
+    })
+  });
+  dart.defineLazy(io.SocketDirection, {
+    get RECEIVE() {
+      return dart.const(new io.SocketDirection._(0));
+    },
+    get SEND() {
+      return dart.const(new io.SocketDirection._(1));
+    },
+    get BOTH() {
+      return dart.const(new io.SocketDirection._(2));
+    }
+  });
+  io.SocketOption = class SocketOption extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+  };
+  dart.defineNamedConstructor(io.SocketOption, '_');
+  dart.setSignature(io.SocketOption, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SocketOption, [dart.dynamic])}),
+    fields: () => ({[_value$1]: dart.dynamic}),
+    sfields: () => ({
+      TCP_NODELAY: io.SocketOption,
+      _IP_MULTICAST_LOOP: io.SocketOption,
+      _IP_MULTICAST_HOPS: io.SocketOption,
+      _IP_MULTICAST_IF: io.SocketOption,
+      _IP_BROADCAST: io.SocketOption
+    })
+  });
+  dart.defineLazy(io.SocketOption, {
+    get TCP_NODELAY() {
+      return dart.const(new io.SocketOption._(0));
+    },
+    get _IP_MULTICAST_LOOP() {
+      return dart.const(new io.SocketOption._(1));
+    },
+    get _IP_MULTICAST_HOPS() {
+      return dart.const(new io.SocketOption._(2));
+    },
+    get _IP_MULTICAST_IF() {
+      return dart.const(new io.SocketOption._(3));
+    },
+    get _IP_BROADCAST() {
+      return dart.const(new io.SocketOption._(4));
+    }
+  });
+  io.RawSocket = class RawSocket extends core.Object {
+    new() {
+      this.readEventsEnabled = null;
+      this.writeEventsEnabled = null;
+    }
+    static connect(host, port, opts) {
+      let sourceAddress = opts && 'sourceAddress' in opts ? opts.sourceAddress : null;
+      dart.throw(new core.UnsupportedError("RawSocket constructor"));
+    }
+  };
+  io.RawSocket[dart.implements] = () => [StreamOfRawSocketEvent()];
+  dart.setSignature(io.RawSocket, {
+    fields: () => ({
+      readEventsEnabled: core.bool,
+      writeEventsEnabled: core.bool
+    }),
+    statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.RawSocket), [dart.dynamic, core.int], {sourceAddress: dart.dynamic})}),
+    names: ['connect']
+  });
+  io.Socket = class Socket extends core.Object {
+    static connect(host, port, opts) {
+      let sourceAddress = opts && 'sourceAddress' in opts ? opts.sourceAddress : null;
+      dart.throw(new core.UnsupportedError("Socket constructor"));
+    }
+  };
+  io.Socket[dart.implements] = () => [StreamOfListOfint(), io.IOSink];
+  dart.setSignature(io.Socket, {
+    statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.Socket), [dart.dynamic, core.int], {sourceAddress: dart.dynamic})}),
+    names: ['connect']
+  });
+  io.Datagram = class Datagram extends core.Object {
+    new(data, address, port) {
+      this.data = data;
+      this.address = address;
+      this.port = port;
+    }
+  };
+  dart.setSignature(io.Datagram, {
+    constructors: () => ({new: dart.definiteFunctionType(io.Datagram, [ListOfint(), io.InternetAddress, core.int])}),
+    fields: () => ({
+      data: ListOfint(),
+      address: io.InternetAddress,
+      port: core.int
+    })
+  });
+  io.RawDatagramSocket = class RawDatagramSocket extends async.Stream$(io.RawSocketEvent) {
+    new() {
+      this.readEventsEnabled = null;
+      this.writeEventsEnabled = null;
+      this.multicastLoopback = null;
+      this.multicastHops = null;
+      this.multicastInterface = null;
+      this.broadcastEnabled = null;
+      super.new();
+    }
+    static bind(host, port, opts) {
+      let reuseAddress = opts && 'reuseAddress' in opts ? opts.reuseAddress : true;
+      dart.throw(new core.UnsupportedError("RawDatagramSocket.bind"));
+    }
+  };
+  dart.addSimpleTypeTests(io.RawDatagramSocket);
+  dart.setSignature(io.RawDatagramSocket, {
+    fields: () => ({
+      readEventsEnabled: core.bool,
+      writeEventsEnabled: core.bool,
+      multicastLoopback: core.bool,
+      multicastHops: core.int,
+      multicastInterface: io.NetworkInterface,
+      broadcastEnabled: core.bool
+    }),
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawDatagramSocket), [dart.dynamic, core.int], {reuseAddress: core.bool})}),
+    names: ['bind']
+  });
+  io.SocketException = class SocketException extends core.Object {
+    new(message, opts) {
+      let osError = opts && 'osError' in opts ? opts.osError : null;
+      let address = opts && 'address' in opts ? opts.address : null;
+      let port = opts && 'port' in opts ? opts.port : null;
+      this.message = message;
+      this.osError = osError;
+      this.address = address;
+      this.port = port;
+    }
+    closed() {
+      this.message = 'Socket has been closed';
+      this.osError = null;
+      this.address = null;
+      this.port = null;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write("SocketException");
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(dart.str`: ${this.message}`);
+        if (this.osError != null) {
+          sb.write(dart.str` (${this.osError})`);
+        }
+      } else if (this.osError != null) {
+        sb.write(dart.str`: ${this.osError}`);
+      }
+      if (this.address != null) {
+        sb.write(dart.str`, address = ${this.address.host}`);
+      }
+      if (this.port != null) {
+        sb.write(dart.str`, port = ${this.port}`);
+      }
+      return sb.toString();
+    }
+  };
+  dart.defineNamedConstructor(io.SocketException, 'closed');
+  io.SocketException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.SocketException, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.SocketException, [core.String], {osError: io.OSError, address: io.InternetAddress, port: core.int}),
+      closed: dart.definiteFunctionType(io.SocketException, [])
+    }),
+    fields: () => ({
+      message: core.String,
+      osError: io.OSError,
+      address: io.InternetAddress,
+      port: core.int
+    })
+  });
+  io._STDIO_HANDLE_TYPE_TERMINAL = 0;
+  io._STDIO_HANDLE_TYPE_PIPE = 1;
+  io._STDIO_HANDLE_TYPE_FILE = 2;
+  io._STDIO_HANDLE_TYPE_SOCKET = 3;
+  io._STDIO_HANDLE_TYPE_OTHER = 4;
+  io._StdStream = class _StdStream extends async.Stream$(core.List$(core.int)) {
+    new(stream) {
+      this[_stream$] = stream;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_stream$].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+  };
+  dart.addSimpleTypeTests(io._StdStream);
+  dart.setSignature(io._StdStream, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StdStream, [StreamOfListOfint()])}),
+    fields: () => ({[_stream$]: StreamOfListOfint()}),
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+  });
+  io.Stdin = class Stdin extends io._StdStream {
+    _(stream) {
+      super.new(stream);
+    }
+    readLineSync(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : io.SYSTEM_ENCODING;
+      let retainNewlines = opts && 'retainNewlines' in opts ? opts.retainNewlines : false;
+      let CR = 13;
+      let LF = 10;
+      let line = [];
+      let crIsNewline = dart.test(io.Platform.isWindows) && dart.equals(io.stdioType(io.stdin), io.StdioType.TERMINAL) && !dart.test(/* Unimplemented unknown name */lineMode);
+      if (dart.test(retainNewlines)) {
+        let byte = null;
+        do {
+          byte = this.readByteSync();
+          if (dart.notNull(byte) < 0) {
+            break;
+          }
+          line[dartx.add](byte);
+        } while (byte != LF && !(byte == CR && crIsNewline));
+        if (dart.test(line[dartx.isEmpty])) {
+          return null;
+        }
+      } else if (crIsNewline) {
+        while (true) {
+          let byte = this.readByteSync();
+          if (dart.notNull(byte) < 0) {
+            if (dart.test(line[dartx.isEmpty])) return null;
+            break;
+          }
+          if (byte == LF || byte == CR) break;
+          line[dartx.add](byte);
+        }
+      } else {
+        outer:
+          while (true) {
+            let byte = this.readByteSync();
+            if (byte == LF) break;
+            if (byte == CR) {
+              do {
+                byte = this.readByteSync();
+                if (byte == LF) break outer;
+                line[dartx.add](CR);
+              } while (byte == CR);
+            }
+            if (dart.notNull(byte) < 0) {
+              if (dart.test(line[dartx.isEmpty])) return null;
+              break;
+            }
+            line[dartx.add](byte);
+          }
+      }
+      return encoding.decode(ListOfint()._check(line));
+    }
+    set echoMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.echoMode"));
+    }
+    set echoMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.echoMode"));
+    }
+    set lineMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.lineMode"));
+    }
+    set lineMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.lineMode"));
+    }
+    readByteSync() {
+      dart.throw(new core.UnsupportedError("Stdin.readByteSync"));
+    }
+  };
+  dart.defineNamedConstructor(io.Stdin, '_');
+  io.Stdin[dart.implements] = () => [StreamOfListOfint()];
+  dart.setSignature(io.Stdin, {
+    constructors: () => ({_: dart.definiteFunctionType(io.Stdin, [StreamOfListOfint()])}),
+    setters: () => ({
+      echoMode: dart.definiteFunctionType(dart.void, [core.bool]),
+      echoMode: dart.definiteFunctionType(dart.void, [core.bool]),
+      lineMode: dart.definiteFunctionType(dart.void, [core.bool]),
+      lineMode: dart.definiteFunctionType(dart.void, [core.bool])
+    }),
+    methods: () => ({
+      readLineSync: dart.definiteFunctionType(core.String, [], {encoding: convert.Encoding, retainNewlines: core.bool}),
+      readByteSync: dart.definiteFunctionType(core.int, [])
+    })
+  });
+  const _fd = Symbol('_fd');
+  const _nonBlocking = Symbol('_nonBlocking');
+  const _hasTerminal = Symbol('_hasTerminal');
+  const _terminalColumns = Symbol('_terminalColumns');
+  const _terminalLines = Symbol('_terminalLines');
+  io._StdSink = class _StdSink extends core.Object {
+    new(sink) {
+      this[_sink$0] = sink;
+    }
+    get encoding() {
+      return this[_sink$0].encoding;
+    }
+    set encoding(encoding) {
+      this[_sink$0].encoding = encoding;
+    }
+    write(object) {
+      this[_sink$0].write(object);
+    }
+    writeln(object) {
+      if (object === void 0) object = "";
+      this[_sink$0].writeln(object);
+    }
+    writeAll(objects, sep) {
+      if (sep === void 0) sep = "";
+      this[_sink$0].writeAll(objects, sep);
+    }
+    add(data) {
+      this[_sink$0].add(data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_sink$0].addError(error, stackTrace);
+    }
+    writeCharCode(charCode) {
+      this[_sink$0].writeCharCode(charCode);
+    }
+    addStream(stream) {
+      return this[_sink$0].addStream(stream);
+    }
+    flush() {
+      return this[_sink$0].flush();
+    }
+    close() {
+      return this[_sink$0].close();
+    }
+    get done() {
+      return this[_sink$0].done;
+    }
+  };
+  io._StdSink[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io._StdSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StdSink, [io.IOSink])}),
+    fields: () => ({[_sink$0]: io.IOSink}),
+    getters: () => ({
+      encoding: dart.definiteFunctionType(convert.Encoding, []),
+      done: dart.definiteFunctionType(async.Future, [])
+    }),
+    setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+    methods: () => ({
+      write: dart.definiteFunctionType(dart.void, [core.Object]),
+      writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+      writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      writeCharCode: dart.definiteFunctionType(dart.void, [core.int]),
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+      flush: dart.definiteFunctionType(async.Future, []),
+      close: dart.definiteFunctionType(async.Future, [])
+    })
+  });
+  io.Stdout = class Stdout extends io._StdSink {
+    _(sink, fd) {
+      this[_fd] = fd;
+      this[_nonBlocking] = null;
+      super.new(sink);
+    }
+    get hasTerminal() {
+      return this[_hasTerminal](this[_fd]);
+    }
+    get terminalColumns() {
+      return this[_terminalColumns](this[_fd]);
+    }
+    get terminalLines() {
+      return this[_terminalLines](this[_fd]);
+    }
+    [_hasTerminal](fd) {
+      dart.throw(new core.UnsupportedError("Stdout.hasTerminal"));
+    }
+    [_terminalColumns](fd) {
+      dart.throw(new core.UnsupportedError("Stdout.terminalColumns"));
+    }
+    [_terminalLines](fd) {
+      dart.throw(new core.UnsupportedError("Stdout.terminalLines"));
+    }
+    get nonBlocking() {
+      if (this[_nonBlocking] == null) {
+        this[_nonBlocking] = io.IOSink.new(new io._FileStreamConsumer.fromStdio(this[_fd]));
+      }
+      return this[_nonBlocking];
+    }
+  };
+  dart.defineNamedConstructor(io.Stdout, '_');
+  io.Stdout[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io.Stdout, {
+    constructors: () => ({_: dart.definiteFunctionType(io.Stdout, [io.IOSink, core.int])}),
+    fields: () => ({
+      [_fd]: core.int,
+      [_nonBlocking]: io.IOSink
+    }),
+    getters: () => ({
+      hasTerminal: dart.definiteFunctionType(core.bool, []),
+      terminalColumns: dart.definiteFunctionType(core.int, []),
+      terminalLines: dart.definiteFunctionType(core.int, []),
+      nonBlocking: dart.definiteFunctionType(io.IOSink, [])
+    }),
+    methods: () => ({
+      [_hasTerminal]: dart.definiteFunctionType(core.bool, [core.int]),
+      [_terminalColumns]: dart.definiteFunctionType(core.int, [core.int]),
+      [_terminalLines]: dart.definiteFunctionType(core.int, [core.int])
+    })
+  });
+  io.StdoutException = class StdoutException extends core.Object {
+    new(message, osError) {
+      if (osError === void 0) osError = null;
+      this.message = message;
+      this.osError = osError;
+    }
+    toString() {
+      return dart.str`StdoutException: ${this.message}${this.osError == null ? "" : dart.str`, ${this.osError}`}`;
+    }
+  };
+  io.StdoutException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.StdoutException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.StdoutException, [core.String], [io.OSError])}),
+    fields: () => ({
+      message: core.String,
+      osError: io.OSError
+    })
+  });
+  io._StdConsumer = class _StdConsumer extends core.Object {
+    new(fd) {
+      this[_file] = io._File._openStdioSync(fd);
+    }
+    addStream(stream) {
+      let completer = async.Completer.new();
+      let sub = null;
+      sub = stream.listen(dart.fn(data => {
+        try {
+          dart.dsend(this[_file], 'writeFromSync', data);
+        } catch (e) {
+          let s = dart.stackTrace(e);
+          dart.dsend(sub, 'cancel');
+          completer.completeError(e, s);
+        }
+
+      }, ListOfintToNull()), {onError: dart.bind(completer, 'completeError'), onDone: dart.bind(completer, 'complete'), cancelOnError: true});
+      return completer.future;
+    }
+    close() {
+      dart.dsend(this[_file], 'closeSync');
+      return async.Future.value();
+    }
+  };
+  io._StdConsumer[dart.implements] = () => [StreamConsumerOfListOfint()];
+  dart.setSignature(io._StdConsumer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StdConsumer, [core.int])}),
+    fields: () => ({[_file]: dart.dynamic}),
+    methods: () => ({
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+      close: dart.definiteFunctionType(async.Future, [])
+    })
+  });
+  io.StdioType = class StdioType extends core.Object {
+    _(name) {
+      this.name = name;
+    }
+    toString() {
+      return dart.str`StdioType: ${this.name}`;
+    }
+  };
+  dart.defineNamedConstructor(io.StdioType, '_');
+  dart.setSignature(io.StdioType, {
+    constructors: () => ({_: dart.definiteFunctionType(io.StdioType, [core.String])}),
+    fields: () => ({name: core.String}),
+    sfields: () => ({
+      TERMINAL: io.StdioType,
+      PIPE: io.StdioType,
+      FILE: io.StdioType,
+      OTHER: io.StdioType
+    })
+  });
+  dart.defineLazy(io.StdioType, {
+    get TERMINAL() {
+      return dart.const(new io.StdioType._("terminal"));
+    },
+    get PIPE() {
+      return dart.const(new io.StdioType._("pipe"));
+    },
+    get FILE() {
+      return dart.const(new io.StdioType._("file"));
+    },
+    get OTHER() {
+      return dart.const(new io.StdioType._("other"));
+    }
+  });
+  io._stdin = null;
+  io._stdout = null;
+  io._stderr = null;
+  dart.copyProperties(io, {
+    get stdin() {
+      if (io._stdin == null) {
+        io._stdin = io._StdIOUtils._getStdioInputStream();
+      }
+      return io._stdin;
+    }
+  });
+  dart.copyProperties(io, {
+    get stdout() {
+      if (io._stdout == null) {
+        io._stdout = io.Stdout._check(io._StdIOUtils._getStdioOutputStream(1));
+      }
+      return io._stdout;
+    }
+  });
+  dart.copyProperties(io, {
+    get stderr() {
+      if (io._stderr == null) {
+        io._stderr = io.Stdout._check(io._StdIOUtils._getStdioOutputStream(2));
+      }
+      return io._stderr;
+    }
+  });
+  io.stdioType = function(object) {
+    if (io._StdStream.is(object)) {
+      object = dart.dload(object, _stream$);
+    } else if (dart.equals(object, io.stdout) || dart.equals(object, io.stderr)) {
+      switch (io._StdIOUtils._getStdioHandleType(dart.equals(object, io.stdout) ? 1 : 2)) {
+        case io._STDIO_HANDLE_TYPE_TERMINAL:
+        {
+          return io.StdioType.TERMINAL;
+        }
+        case io._STDIO_HANDLE_TYPE_PIPE:
+        {
+          return io.StdioType.PIPE;
+        }
+        case io._STDIO_HANDLE_TYPE_FILE:
+        {
+          return io.StdioType.FILE;
+        }
+      }
+    }
+    if (io._FileStream.is(object)) {
+      return io.StdioType.FILE;
+    }
+    if (io.Socket.is(object)) {
+      let socketType = io._StdIOUtils._socketType(object);
+      if (socketType == null) return io.StdioType.OTHER;
+      switch (socketType) {
+        case io._STDIO_HANDLE_TYPE_TERMINAL:
+        {
+          return io.StdioType.TERMINAL;
+        }
+        case io._STDIO_HANDLE_TYPE_PIPE:
+        {
+          return io.StdioType.PIPE;
+        }
+        case io._STDIO_HANDLE_TYPE_FILE:
+        {
+          return io.StdioType.FILE;
+        }
+      }
+    }
+    if (io._IOSinkImpl.is(object)) {
+      try {
+        if (io._FileStreamConsumer.is(object[_target$])) {
+          return io.StdioType.FILE;
+        }
+      } catch (e) {
+      }
+
+    }
+    return io.StdioType.OTHER;
+  };
+  dart.fn(io.stdioType, dynamicToStdioType());
+  io._StdIOUtils = class _StdIOUtils extends core.Object {
+    static _getStdioOutputStream(fd) {
+      dart.throw(new core.UnsupportedError("StdIOUtils._getStdioOutputStream"));
+    }
+    static _getStdioInputStream() {
+      dart.throw(new core.UnsupportedError("StdIOUtils._getStdioInputStream"));
+    }
+    static _socketType(socket) {
+      dart.throw(new core.UnsupportedError("StdIOUtils._socketType"));
+    }
+    static _getStdioHandleType(fd) {
+      dart.throw(new core.UnsupportedError("StdIOUtils._getStdioHandleType"));
+    }
+  };
+  dart.setSignature(io._StdIOUtils, {
+    statics: () => ({
+      _getStdioOutputStream: dart.definiteFunctionType(dart.dynamic, [core.int]),
+      _getStdioInputStream: dart.definiteFunctionType(io.Stdin, []),
+      _socketType: dart.definiteFunctionType(core.int, [io.Socket]),
+      _getStdioHandleType: dart.definiteFunctionType(dart.dynamic, [core.int])
+    }),
+    names: ['_getStdioOutputStream', '_getStdioInputStream', '_socketType', '_getStdioHandleType']
+  });
+  let const$76;
+  let const$77;
+  let const$78;
+  let const$79;
+  io.SystemEncoding = class SystemEncoding extends convert.Encoding {
+    new() {
+      super.new();
+    }
+    get name() {
+      return 'system';
+    }
+    encode(input) {
+      return this.encoder.convert(input);
+    }
+    decode(encoded) {
+      return this.decoder.convert(encoded);
+    }
+    get encoder() {
+      if (io.Platform.operatingSystem == "windows") {
+        return const$76 || (const$76 = dart.const(new io._WindowsCodePageEncoder()));
+      } else {
+        return const$77 || (const$77 = dart.const(new convert.Utf8Encoder()));
+      }
+    }
+    get decoder() {
+      if (io.Platform.operatingSystem == "windows") {
+        return const$78 || (const$78 = dart.const(new io._WindowsCodePageDecoder()));
+      } else {
+        return const$79 || (const$79 = dart.const(new convert.Utf8Decoder()));
+      }
+    }
+  };
+  dart.setSignature(io.SystemEncoding, {
+    constructors: () => ({new: dart.definiteFunctionType(io.SystemEncoding, [])}),
+    getters: () => ({
+      name: dart.definiteFunctionType(core.String, []),
+      encoder: dart.definiteFunctionType(convert.Converter$(core.String, core.List$(core.int)), []),
+      decoder: dart.definiteFunctionType(convert.Converter$(core.List$(core.int), core.String), [])
+    })
+  });
+  io.SYSTEM_ENCODING = dart.const(new io.SystemEncoding());
+  io._WindowsCodePageEncoder = class _WindowsCodePageEncoder extends convert.Converter$(core.String, core.List$(core.int)) {
+    new() {
+      super.new();
+    }
+    convert(input) {
+      let encoded = io._WindowsCodePageEncoder._encodeString(input);
+      if (encoded == null) {
+        dart.throw(new core.FormatException("Invalid character for encoding"));
+      }
+      return encoded;
+    }
+    startChunkedConversion(sink) {
+      return new io._WindowsCodePageEncoderSink(sink);
+    }
+    static _encodeString(string) {
+      dart.throw(new core.UnsupportedError("_WindowsCodePageEncoder._encodeString"));
+    }
+  };
+  dart.addSimpleTypeTests(io._WindowsCodePageEncoder);
+  dart.setSignature(io._WindowsCodePageEncoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageEncoder, [])}),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.List$(core.int), [core.String]),
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
+    }),
+    statics: () => ({_encodeString: dart.definiteFunctionType(core.List$(core.int), [core.String])}),
+    names: ['_encodeString']
+  });
+  io._WindowsCodePageEncoderSink = class _WindowsCodePageEncoderSink extends convert.StringConversionSinkBase {
+    new(sink) {
+      this[_sink$0] = sink;
+    }
+    close() {
+      this[_sink$0].close();
+    }
+    add(string) {
+      let encoded = io._WindowsCodePageEncoder._encodeString(string);
+      if (encoded == null) {
+        dart.throw(new core.FormatException("Invalid character for encoding"));
+      }
+      this[_sink$0].add(encoded);
+    }
+    addSlice(source, start, end, isLast) {
+      if (start != 0 || end != source[dartx.length]) {
+        source = source[dartx.substring](start, end);
+      }
+      this.add(source);
+      if (dart.test(isLast)) this.close();
+    }
+  };
+  dart.setSignature(io._WindowsCodePageEncoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageEncoderSink, [SinkOfListOfint()])}),
+    fields: () => ({[_sink$0]: SinkOfListOfint()}),
+    methods: () => ({
+      close: dart.definiteFunctionType(dart.void, []),
+      addSlice: dart.definiteFunctionType(dart.void, [core.String, core.int, core.int, core.bool])
+    })
+  });
+  io._WindowsCodePageDecoder = class _WindowsCodePageDecoder extends convert.Converter$(core.List$(core.int), core.String) {
+    new() {
+      super.new();
+    }
+    convert(input) {
+      return io._WindowsCodePageDecoder._decodeBytes(input);
+    }
+    startChunkedConversion(sink) {
+      return new io._WindowsCodePageDecoderSink(sink);
+    }
+    static _decodeBytes(bytes) {
+      dart.throw(new core.UnsupportedError("_WindowsCodePageDecoder._decodeBytes"));
+    }
+  };
+  dart.addSimpleTypeTests(io._WindowsCodePageDecoder);
+  dart.setSignature(io._WindowsCodePageDecoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageDecoder, [])}),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.String, [ListOfint()]),
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])
+    }),
+    statics: () => ({_decodeBytes: dart.definiteFunctionType(core.String, [ListOfint()])}),
+    names: ['_decodeBytes']
+  });
+  io._WindowsCodePageDecoderSink = class _WindowsCodePageDecoderSink extends convert.ByteConversionSinkBase {
+    new(sink) {
+      this[_sink$0] = sink;
+      super.new();
+    }
+    close() {
+      this[_sink$0].close();
+    }
+    add(bytes) {
+      this[_sink$0].add(io._WindowsCodePageDecoder._decodeBytes(bytes));
+    }
+  };
+  dart.setSignature(io._WindowsCodePageDecoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageDecoderSink, [SinkOfString()])}),
+    fields: () => ({[_sink$0]: SinkOfString()}),
+    methods: () => ({
+      close: dart.definiteFunctionType(dart.void, []),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()])
+    })
+  });
+  io.WebSocketStatus = class WebSocketStatus extends core.Object {};
+  dart.setSignature(io.WebSocketStatus, {
+    sfields: () => ({
+      NORMAL_CLOSURE: core.int,
+      GOING_AWAY: core.int,
+      PROTOCOL_ERROR: core.int,
+      UNSUPPORTED_DATA: core.int,
+      RESERVED_1004: core.int,
+      NO_STATUS_RECEIVED: core.int,
+      ABNORMAL_CLOSURE: core.int,
+      INVALID_FRAME_PAYLOAD_DATA: core.int,
+      POLICY_VIOLATION: core.int,
+      MESSAGE_TOO_BIG: core.int,
+      MISSING_MANDATORY_EXTENSION: core.int,
+      INTERNAL_SERVER_ERROR: core.int,
+      RESERVED_1015: core.int
+    })
+  });
+  io.WebSocketStatus.NORMAL_CLOSURE = 1000;
+  io.WebSocketStatus.GOING_AWAY = 1001;
+  io.WebSocketStatus.PROTOCOL_ERROR = 1002;
+  io.WebSocketStatus.UNSUPPORTED_DATA = 1003;
+  io.WebSocketStatus.RESERVED_1004 = 1004;
+  io.WebSocketStatus.NO_STATUS_RECEIVED = 1005;
+  io.WebSocketStatus.ABNORMAL_CLOSURE = 1006;
+  io.WebSocketStatus.INVALID_FRAME_PAYLOAD_DATA = 1007;
+  io.WebSocketStatus.POLICY_VIOLATION = 1008;
+  io.WebSocketStatus.MESSAGE_TOO_BIG = 1009;
+  io.WebSocketStatus.MISSING_MANDATORY_EXTENSION = 1010;
+  io.WebSocketStatus.INTERNAL_SERVER_ERROR = 1011;
+  io.WebSocketStatus.RESERVED_1015 = 1015;
+  const _createServerResponseHeader = Symbol('_createServerResponseHeader');
+  const _createClientRequestHeader = Symbol('_createClientRequestHeader');
+  const _createHeader = Symbol('_createHeader');
+  io.CompressionOptions = class CompressionOptions extends core.Object {
+    new(opts) {
+      let clientNoContextTakeover = opts && 'clientNoContextTakeover' in opts ? opts.clientNoContextTakeover : false;
+      let serverNoContextTakeover = opts && 'serverNoContextTakeover' in opts ? opts.serverNoContextTakeover : false;
+      let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : null;
+      let serverMaxWindowBits = opts && 'serverMaxWindowBits' in opts ? opts.serverMaxWindowBits : null;
+      let enabled = opts && 'enabled' in opts ? opts.enabled : true;
+      this.clientNoContextTakeover = clientNoContextTakeover;
+      this.serverNoContextTakeover = serverNoContextTakeover;
+      this.clientMaxWindowBits = clientMaxWindowBits;
+      this.serverMaxWindowBits = serverMaxWindowBits;
+      this.enabled = enabled;
+    }
+    [_createServerResponseHeader](requested) {
+      let info = new io._CompressionMaxWindowBits();
+      let mwb = null;
+      let part = null;
+      if (dart.nullSafe(requested, _ => _.parameters) != null) {
+        part = requested.parameters[dartx._get](io._serverMaxWindowBits);
+      }
+      if (part != null) {
+        if (dart.notNull(part[dartx.length]) >= 2 && dart.test(part[dartx.startsWith]('0'))) {
+          dart.throw(new core.ArgumentError("Illegal 0 padding on value."));
+        } else {
+          mwb = this.serverMaxWindowBits == null ? core.int.parse(part, {onError: dart.fn(source => io._WebSocketImpl.DEFAULT_WINDOW_BITS, StringToint$())}) : this.serverMaxWindowBits;
+          info.headerValue = dart.str`; server_max_window_bits=${mwb}`;
+          info.maxWindowBits = mwb;
+        }
+      } else {
+        info.headerValue = "";
+        info.maxWindowBits = io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+      }
+      return info;
+    }
+    [_createClientRequestHeader](requested, size) {
+      let info = "";
+      if (requested != null) {
+        info = dart.str`; client_max_window_bits=${size}`;
+      } else {
+        if (this.clientMaxWindowBits == null) {
+          info = "; client_max_window_bits";
+        } else {
+          info = dart.str`; client_max_window_bits=${this.clientMaxWindowBits}`;
+        }
+        if (this.serverMaxWindowBits != null) {
+          info = info + dart.str`; server_max_window_bits=${this.serverMaxWindowBits}`;
+        }
+      }
+      return info;
+    }
+    [_createHeader](requested) {
+      if (requested === void 0) requested = null;
+      let info = new io._CompressionMaxWindowBits("", 0);
+      if (!dart.test(this.enabled)) {
+        return info;
+      }
+      info.headerValue = io._WebSocketImpl.PER_MESSAGE_DEFLATE;
+      if (dart.test(this.clientNoContextTakeover) && (requested == null || requested != null && dart.test(requested.parameters[dartx.containsKey](io._clientNoContextTakeover)))) {
+        info.headerValue = dart.notNull(info.headerValue) + "; client_no_context_takeover";
+      }
+      if (dart.test(this.serverNoContextTakeover) && (requested == null || requested != null && dart.test(requested.parameters[dartx.containsKey](io._serverNoContextTakeover)))) {
+        info.headerValue = dart.notNull(info.headerValue) + "; server_no_context_takeover";
+      }
+      let headerList = this[_createServerResponseHeader](requested);
+      info.headerValue = dart.notNull(info.headerValue) + dart.notNull(headerList.headerValue);
+      info.maxWindowBits = headerList.maxWindowBits;
+      info.headerValue = dart.notNull(info.headerValue) + dart.notNull(this[_createClientRequestHeader](requested, info.maxWindowBits));
+      return info;
+    }
+  };
+  dart.setSignature(io.CompressionOptions, {
+    constructors: () => ({new: dart.definiteFunctionType(io.CompressionOptions, [], {clientNoContextTakeover: core.bool, serverNoContextTakeover: core.bool, clientMaxWindowBits: core.int, serverMaxWindowBits: core.int, enabled: core.bool})}),
+    fields: () => ({
+      clientNoContextTakeover: core.bool,
+      serverNoContextTakeover: core.bool,
+      clientMaxWindowBits: core.int,
+      serverMaxWindowBits: core.int,
+      enabled: core.bool
+    }),
+    methods: () => ({
+      [_createServerResponseHeader]: dart.definiteFunctionType(io._CompressionMaxWindowBits, [io.HeaderValue]),
+      [_createClientRequestHeader]: dart.definiteFunctionType(core.String, [io.HeaderValue, core.int]),
+      [_createHeader]: dart.definiteFunctionType(io._CompressionMaxWindowBits, [], [io.HeaderValue])
+    }),
+    sfields: () => ({
+      DEFAULT: io.CompressionOptions,
+      OFF: io.CompressionOptions
+    })
+  });
+  dart.defineLazy(io.CompressionOptions, {
+    get DEFAULT() {
+      return dart.const(new io.CompressionOptions());
+    },
+    get OFF() {
+      return dart.const(new io.CompressionOptions({enabled: false}));
+    }
+  });
+  io.WebSocketTransformer = class WebSocketTransformer extends core.Object {
+    static new(opts) {
+      let protocolSelector = opts && 'protocolSelector' in opts ? opts.protocolSelector : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      return new io._WebSocketTransformerImpl(protocolSelector, compression);
+    }
+    static upgrade(request, opts) {
+      let protocolSelector = opts && 'protocolSelector' in opts ? opts.protocolSelector : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      return io._WebSocketTransformerImpl._upgrade(request, protocolSelector, compression);
+    }
+    static isUpgradeRequest(request) {
+      return io._WebSocketTransformerImpl._isUpgradeRequest(request);
+    }
+  };
+  io.WebSocketTransformer[dart.implements] = () => [StreamTransformerOfHttpRequest$WebSocket()];
+  dart.setSignature(io.WebSocketTransformer, {
+    constructors: () => ({new: dart.definiteFunctionType(io.WebSocketTransformer, [], {protocolSelector: ListOfStringTodynamic(), compression: io.CompressionOptions})}),
+    statics: () => ({
+      upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest], {protocolSelector: ListOfStringTodynamic(), compression: io.CompressionOptions}),
+      isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
+    }),
+    names: ['upgrade', 'isUpgradeRequest']
+  });
+  io.WebSocket = class WebSocket extends core.Object {
+    static connect(url, opts) {
+      let protocols = opts && 'protocols' in opts ? opts.protocols : null;
+      let headers = opts && 'headers' in opts ? opts.headers : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      return io._WebSocketImpl.connect(url, protocols, headers, {compression: compression});
+    }
+    new() {
+      this.pingInterval = null;
+    }
+    static fromUpgradedSocket(socket, opts) {
+      let protocol = opts && 'protocol' in opts ? opts.protocol : null;
+      let serverSide = opts && 'serverSide' in opts ? opts.serverSide : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      if (serverSide == null) {
+        dart.throw(new core.ArgumentError("The serverSide argument must be passed " + "explicitly to WebSocket.fromUpgradedSocket."));
+      }
+      return new io._WebSocketImpl._fromSocket(socket, protocol, compression, serverSide);
+    }
+  };
+  io.WebSocket[dart.implements] = () => [async.Stream, async.StreamSink];
+  dart.setSignature(io.WebSocket, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.WebSocket, []),
+      fromUpgradedSocket: dart.definiteFunctionType(io.WebSocket, [io.Socket], {protocol: core.String, serverSide: core.bool, compression: io.CompressionOptions})
+    }),
+    fields: () => ({pingInterval: core.Duration}),
+    sfields: () => ({
+      CONNECTING: core.int,
+      OPEN: core.int,
+      CLOSING: core.int,
+      CLOSED: core.int
+    }),
+    statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.WebSocket), [core.String], {protocols: IterableOfString(), headers: MapOfString$dynamic(), compression: io.CompressionOptions})}),
+    names: ['connect']
+  });
+  io.WebSocket.CONNECTING = 0;
+  io.WebSocket.OPEN = 1;
+  io.WebSocket.CLOSING = 2;
+  io.WebSocket.CLOSED = 3;
+  io.WebSocketException = class WebSocketException extends core.Object {
+    new(message) {
+      if (message === void 0) message = "";
+      this.message = message;
+    }
+    toString() {
+      return dart.str`WebSocketException: ${this.message}`;
+    }
+  };
+  io.WebSocketException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.WebSocketException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.WebSocketException, [], [core.String])}),
+    fields: () => ({message: core.String})
+  });
+  io._webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
+  io._clientNoContextTakeover = "client_no_context_takeover";
+  io._serverNoContextTakeover = "server_no_context_takeover";
+  io._clientMaxWindowBits = "client_max_window_bits";
+  io._serverMaxWindowBits = "server_max_window_bits";
+  io._WebSocketMessageType = class _WebSocketMessageType extends core.Object {};
+  dart.setSignature(io._WebSocketMessageType, {
+    sfields: () => ({
+      NONE: core.int,
+      TEXT: core.int,
+      BINARY: core.int
+    })
+  });
+  io._WebSocketMessageType.NONE = 0;
+  io._WebSocketMessageType.TEXT = 1;
+  io._WebSocketMessageType.BINARY = 2;
+  io._WebSocketOpcode = class _WebSocketOpcode extends core.Object {};
+  dart.setSignature(io._WebSocketOpcode, {
+    sfields: () => ({
+      CONTINUATION: core.int,
+      TEXT: core.int,
+      BINARY: core.int,
+      RESERVED_3: core.int,
+      RESERVED_4: core.int,
+      RESERVED_5: core.int,
+      RESERVED_6: core.int,
+      RESERVED_7: core.int,
+      CLOSE: core.int,
+      PING: core.int,
+      PONG: core.int,
+      RESERVED_B: core.int,
+      RESERVED_C: core.int,
+      RESERVED_D: core.int,
+      RESERVED_E: core.int,
+      RESERVED_F: core.int
+    })
+  });
+  io._WebSocketOpcode.CONTINUATION = 0;
+  io._WebSocketOpcode.TEXT = 1;
+  io._WebSocketOpcode.BINARY = 2;
+  io._WebSocketOpcode.RESERVED_3 = 3;
+  io._WebSocketOpcode.RESERVED_4 = 4;
+  io._WebSocketOpcode.RESERVED_5 = 5;
+  io._WebSocketOpcode.RESERVED_6 = 6;
+  io._WebSocketOpcode.RESERVED_7 = 7;
+  io._WebSocketOpcode.CLOSE = 8;
+  io._WebSocketOpcode.PING = 9;
+  io._WebSocketOpcode.PONG = 10;
+  io._WebSocketOpcode.RESERVED_B = 11;
+  io._WebSocketOpcode.RESERVED_C = 12;
+  io._WebSocketOpcode.RESERVED_D = 13;
+  io._WebSocketOpcode.RESERVED_E = 14;
+  io._WebSocketOpcode.RESERVED_F = 15;
+  io._CompressionMaxWindowBits = class _CompressionMaxWindowBits extends core.Object {
+    new(headerValue, maxWindowBits) {
+      if (headerValue === void 0) headerValue = null;
+      if (maxWindowBits === void 0) maxWindowBits = null;
+      this.headerValue = headerValue;
+      this.maxWindowBits = maxWindowBits;
+    }
+    toString() {
+      return this.headerValue;
+    }
+  };
+  dart.setSignature(io._CompressionMaxWindowBits, {
+    constructors: () => ({new: dart.definiteFunctionType(io._CompressionMaxWindowBits, [], [core.String, core.int])}),
+    fields: () => ({
+      headerValue: core.String,
+      maxWindowBits: core.int
+    })
+  });
+  const _maskingBytes = Symbol('_maskingBytes');
+  const _payload = Symbol('_payload');
+  const _serverSide = Symbol('_serverSide');
+  const _deflate = Symbol('_deflate');
+  const _fin = Symbol('_fin');
+  const _compressed = Symbol('_compressed');
+  const _opcode = Symbol('_opcode');
+  const _len = Symbol('_len');
+  const _masked = Symbol('_masked');
+  const _remainingLenBytes = Symbol('_remainingLenBytes');
+  const _remainingMaskingKeyBytes = Symbol('_remainingMaskingKeyBytes');
+  const _remainingPayloadBytes = Symbol('_remainingPayloadBytes');
+  const _unmaskingIndex = Symbol('_unmaskingIndex');
+  const _currentMessageType = Symbol('_currentMessageType');
+  const _eventSink$ = Symbol('_eventSink');
+  const _isControlFrame = Symbol('_isControlFrame');
+  const _lengthDone = Symbol('_lengthDone');
+  const _maskDone = Symbol('_maskDone');
+  const _unmask = Symbol('_unmask');
+  const _controlFrameEnd = Symbol('_controlFrameEnd');
+  const _messageFrameEnd = Symbol('_messageFrameEnd');
+  const _startPayload = Symbol('_startPayload');
+  const _prepareForNextFrame = Symbol('_prepareForNextFrame');
+  io._WebSocketProtocolTransformer = class _WebSocketProtocolTransformer extends core.Object {
+    new(serverSide, deflate) {
+      if (serverSide === void 0) serverSide = false;
+      if (deflate === void 0) deflate = null;
+      this[_maskingBytes] = core.List.new(4);
+      this[_payload] = io.BytesBuilder.new({copy: false});
+      this[_serverSide] = serverSide;
+      this[_deflate] = deflate;
+      this[_state$1] = io._WebSocketProtocolTransformer.START;
+      this[_fin] = false;
+      this[_compressed] = false;
+      this[_opcode] = -1;
+      this[_len] = -1;
+      this[_masked] = false;
+      this[_remainingLenBytes] = -1;
+      this[_remainingMaskingKeyBytes] = 4;
+      this[_remainingPayloadBytes] = -1;
+      this[_unmaskingIndex] = 0;
+      this[_currentMessageType] = io._WebSocketMessageType.NONE;
+      this.closeCode = io.WebSocketStatus.NO_STATUS_RECEIVED;
+      this.closeReason = "";
+      this[_eventSink$] = null;
+    }
+    bind(stream) {
+      return async.Stream.eventTransformed(stream, dart.fn(eventSink => {
+        if (this[_eventSink$] != null) {
+          dart.throw(new core.StateError("WebSocket transformer already used."));
+        }
+        this[_eventSink$] = eventSink;
+        return this;
+      }, EventSinkTo_WebSocketProtocolTransformer()));
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_eventSink$].addError(error, stackTrace);
+    }
+    close() {
+      this[_eventSink$].close();
+    }
+    add(bytes) {
+      let buffer = typed_data.Uint8List.is(bytes) ? bytes : typed_data.Uint8List.fromList(bytes);
+      let index = 0;
+      let lastIndex = buffer[dartx.length];
+      if (this[_state$1] == io._WebSocketProtocolTransformer.CLOSED) {
+        dart.throw(new io.WebSocketException("Data on closed connection"));
+      }
+      if (this[_state$1] == io._WebSocketProtocolTransformer.FAILURE) {
+        dart.throw(new io.WebSocketException("Data on failed connection"));
+      }
+      while (dart.notNull(index) < dart.notNull(lastIndex) && this[_state$1] != io._WebSocketProtocolTransformer.CLOSED && this[_state$1] != io._WebSocketProtocolTransformer.FAILURE) {
+        let byte = buffer[dartx._get](index);
+        if (dart.notNull(this[_state$1]) <= io._WebSocketProtocolTransformer.LEN_REST) {
+          if (this[_state$1] == io._WebSocketProtocolTransformer.START) {
+            this[_fin] = (dart.notNull(byte) & io._WebSocketProtocolTransformer.FIN) != 0;
+            if ((dart.notNull(byte) & (io._WebSocketProtocolTransformer.RSV2 | io._WebSocketProtocolTransformer.RSV3)) != 0) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            this[_opcode] = dart.notNull(byte) & io._WebSocketProtocolTransformer.OPCODE;
+            if (this[_opcode] != io._WebSocketOpcode.CONTINUATION) {
+              if ((dart.notNull(byte) & io._WebSocketProtocolTransformer.RSV1) != 0) {
+                this[_compressed] = true;
+              } else {
+                this[_compressed] = false;
+              }
+            }
+            if (dart.notNull(this[_opcode]) <= io._WebSocketOpcode.BINARY) {
+              if (this[_opcode] == io._WebSocketOpcode.CONTINUATION) {
+                if (this[_currentMessageType] == io._WebSocketMessageType.NONE) {
+                  dart.throw(new io.WebSocketException("Protocol error"));
+                }
+              } else {
+                dart.assert(this[_opcode] == io._WebSocketOpcode.TEXT || this[_opcode] == io._WebSocketOpcode.BINARY);
+                if (this[_currentMessageType] != io._WebSocketMessageType.NONE) {
+                  dart.throw(new io.WebSocketException("Protocol error"));
+                }
+                this[_currentMessageType] = this[_opcode];
+              }
+            } else if (dart.notNull(this[_opcode]) >= io._WebSocketOpcode.CLOSE && dart.notNull(this[_opcode]) <= io._WebSocketOpcode.PONG) {
+              if (!dart.test(this[_fin])) dart.throw(new io.WebSocketException("Protocol error"));
+            } else {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            this[_state$1] = io._WebSocketProtocolTransformer.LEN_FIRST;
+          } else if (this[_state$1] == io._WebSocketProtocolTransformer.LEN_FIRST) {
+            this[_masked] = (dart.notNull(byte) & 128) != 0;
+            this[_len] = dart.notNull(byte) & 127;
+            if (dart.test(this[_isControlFrame]()) && dart.notNull(this[_len]) > 125) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            if (this[_len] == 126) {
+              this[_len] = 0;
+              this[_remainingLenBytes] = 2;
+              this[_state$1] = io._WebSocketProtocolTransformer.LEN_REST;
+            } else if (this[_len] == 127) {
+              this[_len] = 0;
+              this[_remainingLenBytes] = 8;
+              this[_state$1] = io._WebSocketProtocolTransformer.LEN_REST;
+            } else {
+              dart.assert(dart.notNull(this[_len]) < 126);
+              this[_lengthDone]();
+            }
+          } else {
+            dart.assert(this[_state$1] == io._WebSocketProtocolTransformer.LEN_REST);
+            this[_len] = (dart.notNull(this[_len]) << 8 | dart.notNull(byte)) >>> 0;
+            this[_remainingLenBytes] = dart.notNull(this[_remainingLenBytes]) - 1;
+            if (this[_remainingLenBytes] == 0) {
+              this[_lengthDone]();
+            }
+          }
+        } else {
+          if (this[_state$1] == io._WebSocketProtocolTransformer.MASK) {
+            this[_maskingBytes][dartx._set](4 - (() => {
+              let x = this[_remainingMaskingKeyBytes];
+              this[_remainingMaskingKeyBytes] = dart.notNull(x) - 1;
+              return x;
+            })(), byte);
+            if (this[_remainingMaskingKeyBytes] == 0) {
+              this[_maskDone]();
+            }
+          } else {
+            dart.assert(this[_state$1] == io._WebSocketProtocolTransformer.PAYLOAD);
+            let payloadLength = math.min(core.int)(dart.notNull(lastIndex) - dart.notNull(index), this[_remainingPayloadBytes]);
+            this[_remainingPayloadBytes] = dart.notNull(this[_remainingPayloadBytes]) - dart.notNull(payloadLength);
+            if (dart.test(this[_masked])) {
+              this[_unmask](index, payloadLength, buffer);
+            }
+            this[_payload].add(typed_data.Uint8List.view(buffer[dartx.buffer], index, payloadLength));
+            index = dart.notNull(index) + dart.notNull(payloadLength);
+            if (dart.test(this[_isControlFrame]())) {
+              if (this[_remainingPayloadBytes] == 0) this[_controlFrameEnd]();
+            } else {
+              if (this[_currentMessageType] != io._WebSocketMessageType.TEXT && this[_currentMessageType] != io._WebSocketMessageType.BINARY) {
+                dart.throw(new io.WebSocketException("Protocol error"));
+              }
+              if (this[_remainingPayloadBytes] == 0) this[_messageFrameEnd]();
+            }
+            index = dart.notNull(index) - 1;
+          }
+        }
+        index = dart.notNull(index) + 1;
+      }
+    }
+    [_unmask](index, length, buffer) {
+      let BLOCK_SIZE = 16;
+      if (dart.notNull(length) >= BLOCK_SIZE) {
+        let startOffset = BLOCK_SIZE - (dart.notNull(index) & 15);
+        let end = dart.notNull(index) + startOffset;
+        for (let i = index; dart.notNull(i) < end; i = dart.notNull(i) + 1) {
+          buffer[dartx._set](i, (dart.notNull(buffer[dartx._get](i)) ^ dart.notNull(core.int._check(this[_maskingBytes][dartx._get]((() => {
+            let x = this[_unmaskingIndex];
+            this[_unmaskingIndex] = dart.notNull(x) + 1;
+            return x;
+          })() & 3)))) >>> 0);
+        }
+        index = dart.notNull(index) + startOffset;
+        length = dart.notNull(length) - startOffset;
+        let blockCount = (dart.notNull(length) / BLOCK_SIZE)[dartx.truncate]();
+        if (blockCount > 0) {
+          let mask = 0;
+          for (let i = 3; i >= 0; i--) {
+            mask = (mask << 8 | dart.notNull(core.int._check(this[_maskingBytes][dartx._get](dart.notNull(this[_unmaskingIndex]) + i & 3)))) >>> 0;
+          }
+          let blockMask = typed_data.Int32x4.new(mask, mask, mask, mask);
+          let blockBuffer = typed_data.Int32x4List.view(buffer[dartx.buffer], index, blockCount);
+          for (let i = 0; i < dart.notNull(blockBuffer.length); i++) {
+            blockBuffer._set(i, blockBuffer._get(i)['^'](blockMask));
+          }
+          let bytes = blockCount * BLOCK_SIZE;
+          index = dart.notNull(index) + bytes;
+          length = dart.notNull(length) - bytes;
+        }
+      }
+      let end = dart.notNull(index) + dart.notNull(length);
+      for (let i = index; dart.notNull(i) < end; i = dart.notNull(i) + 1) {
+        buffer[dartx._set](i, (dart.notNull(buffer[dartx._get](i)) ^ dart.notNull(core.int._check(this[_maskingBytes][dartx._get]((() => {
+          let x = this[_unmaskingIndex];
+          this[_unmaskingIndex] = dart.notNull(x) + 1;
+          return x;
+        })() & 3)))) >>> 0);
+      }
+    }
+    [_lengthDone]() {
+      if (dart.test(this[_masked])) {
+        if (!dart.test(this[_serverSide])) {
+          dart.throw(new io.WebSocketException("Received masked frame from server"));
+        }
+        this[_state$1] = io._WebSocketProtocolTransformer.MASK;
+      } else {
+        if (dart.test(this[_serverSide])) {
+          dart.throw(new io.WebSocketException("Received unmasked frame from client"));
+        }
+        this[_remainingPayloadBytes] = this[_len];
+        this[_startPayload]();
+      }
+    }
+    [_maskDone]() {
+      this[_remainingPayloadBytes] = this[_len];
+      this[_startPayload]();
+    }
+    [_startPayload]() {
+      if (this[_remainingPayloadBytes] == 0) {
+        if (dart.test(this[_isControlFrame]())) {
+          switch (this[_opcode]) {
+            case io._WebSocketOpcode.CLOSE:
+            {
+              this[_state$1] = io._WebSocketProtocolTransformer.CLOSED;
+              this[_eventSink$].close();
+              break;
+            }
+            case io._WebSocketOpcode.PING:
+            {
+              this[_eventSink$].add(new io._WebSocketPing());
+              break;
+            }
+            case io._WebSocketOpcode.PONG:
+            {
+              this[_eventSink$].add(new io._WebSocketPong());
+              break;
+            }
+          }
+          this[_prepareForNextFrame]();
+        } else {
+          this[_messageFrameEnd]();
+        }
+      } else {
+        this[_state$1] = io._WebSocketProtocolTransformer.PAYLOAD;
+      }
+    }
+    [_messageFrameEnd]() {
+      if (dart.test(this[_fin])) {
+        let bytes = this[_payload].takeBytes();
+        if (this[_deflate] != null && dart.test(this[_compressed])) {
+          bytes = this[_deflate].processIncomingMessage(bytes);
+        }
+        switch (this[_currentMessageType]) {
+          case io._WebSocketMessageType.TEXT:
+          {
+            this[_eventSink$].add(convert.UTF8.decode(bytes));
+            break;
+          }
+          case io._WebSocketMessageType.BINARY:
+          {
+            this[_eventSink$].add(bytes);
+            break;
+          }
+        }
+        this[_currentMessageType] = io._WebSocketMessageType.NONE;
+      }
+      this[_prepareForNextFrame]();
+    }
+    [_controlFrameEnd]() {
+      switch (this[_opcode]) {
+        case io._WebSocketOpcode.CLOSE:
+        {
+          this.closeCode = io.WebSocketStatus.NO_STATUS_RECEIVED;
+          let payload = this[_payload].takeBytes();
+          if (dart.notNull(payload[dartx.length]) > 0) {
+            if (payload[dartx.length] == 1) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            this.closeCode = (dart.notNull(payload[dartx._get](0)) << 8 | dart.notNull(payload[dartx._get](1))) >>> 0;
+            if (this.closeCode == io.WebSocketStatus.NO_STATUS_RECEIVED) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            if (dart.notNull(payload[dartx.length]) > 2) {
+              this.closeReason = convert.UTF8.decode(payload[dartx.sublist](2));
+            }
+          }
+          this[_state$1] = io._WebSocketProtocolTransformer.CLOSED;
+          this[_eventSink$].close();
+          break;
+        }
+        case io._WebSocketOpcode.PING:
+        {
+          this[_eventSink$].add(new io._WebSocketPing(this[_payload].takeBytes()));
+          break;
+        }
+        case io._WebSocketOpcode.PONG:
+        {
+          this[_eventSink$].add(new io._WebSocketPong(this[_payload].takeBytes()));
+          break;
+        }
+      }
+      this[_prepareForNextFrame]();
+    }
+    [_isControlFrame]() {
+      return this[_opcode] == io._WebSocketOpcode.CLOSE || this[_opcode] == io._WebSocketOpcode.PING || this[_opcode] == io._WebSocketOpcode.PONG;
+    }
+    [_prepareForNextFrame]() {
+      if (this[_state$1] != io._WebSocketProtocolTransformer.CLOSED && this[_state$1] != io._WebSocketProtocolTransformer.FAILURE) this[_state$1] = io._WebSocketProtocolTransformer.START;
+      this[_fin] = false;
+      this[_opcode] = -1;
+      this[_len] = -1;
+      this[_remainingLenBytes] = -1;
+      this[_remainingMaskingKeyBytes] = 4;
+      this[_remainingPayloadBytes] = -1;
+      this[_unmaskingIndex] = 0;
+    }
+  };
+  io._WebSocketProtocolTransformer[dart.implements] = () => [StreamTransformerOfListOfint$dynamic(), EventSinkOfUint8List()];
+  dart.setSignature(io._WebSocketProtocolTransformer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketProtocolTransformer, [], [core.bool, io._WebSocketPerMessageDeflate])}),
+    fields: () => ({
+      [_state$1]: core.int,
+      [_fin]: core.bool,
+      [_compressed]: core.bool,
+      [_opcode]: core.int,
+      [_len]: core.int,
+      [_masked]: core.bool,
+      [_remainingLenBytes]: core.int,
+      [_remainingMaskingKeyBytes]: core.int,
+      [_remainingPayloadBytes]: core.int,
+      [_unmaskingIndex]: core.int,
+      [_currentMessageType]: core.int,
+      closeCode: core.int,
+      closeReason: core.String,
+      [_eventSink$]: async.EventSink,
+      [_serverSide]: core.bool,
+      [_maskingBytes]: core.List,
+      [_payload]: io.BytesBuilder,
+      [_deflate]: io._WebSocketPerMessageDeflate
+    }),
+    methods: () => ({
+      bind: dart.definiteFunctionType(async.Stream, [async.Stream]),
+      addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
+      close: dart.definiteFunctionType(dart.void, []),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      [_unmask]: dart.definiteFunctionType(dart.void, [core.int, core.int, typed_data.Uint8List]),
+      [_lengthDone]: dart.definiteFunctionType(dart.void, []),
+      [_maskDone]: dart.definiteFunctionType(dart.void, []),
+      [_startPayload]: dart.definiteFunctionType(dart.void, []),
+      [_messageFrameEnd]: dart.definiteFunctionType(dart.void, []),
+      [_controlFrameEnd]: dart.definiteFunctionType(dart.void, []),
+      [_isControlFrame]: dart.definiteFunctionType(core.bool, []),
+      [_prepareForNextFrame]: dart.definiteFunctionType(dart.void, [])
+    }),
+    sfields: () => ({
+      START: core.int,
+      LEN_FIRST: core.int,
+      LEN_REST: core.int,
+      MASK: core.int,
+      PAYLOAD: core.int,
+      CLOSED: core.int,
+      FAILURE: core.int,
+      FIN: core.int,
+      RSV1: core.int,
+      RSV2: core.int,
+      RSV3: core.int,
+      OPCODE: core.int
+    })
+  });
+  io._WebSocketProtocolTransformer.START = 0;
+  io._WebSocketProtocolTransformer.LEN_FIRST = 1;
+  io._WebSocketProtocolTransformer.LEN_REST = 2;
+  io._WebSocketProtocolTransformer.MASK = 3;
+  io._WebSocketProtocolTransformer.PAYLOAD = 4;
+  io._WebSocketProtocolTransformer.CLOSED = 5;
+  io._WebSocketProtocolTransformer.FAILURE = 6;
+  io._WebSocketProtocolTransformer.FIN = 128;
+  io._WebSocketProtocolTransformer.RSV1 = 64;
+  io._WebSocketProtocolTransformer.RSV2 = 32;
+  io._WebSocketProtocolTransformer.RSV3 = 16;
+  io._WebSocketProtocolTransformer.OPCODE = 15;
+  io._WebSocketPing = class _WebSocketPing extends core.Object {
+    new(payload) {
+      if (payload === void 0) payload = null;
+      this.payload = payload;
+    }
+  };
+  dart.setSignature(io._WebSocketPing, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPing, [], [ListOfint()])}),
+    fields: () => ({payload: ListOfint()})
+  });
+  io._WebSocketPong = class _WebSocketPong extends core.Object {
+    new(payload) {
+      if (payload === void 0) payload = null;
+      this.payload = payload;
+    }
+  };
+  dart.setSignature(io._WebSocketPong, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPong, [], [ListOfint()])}),
+    fields: () => ({payload: ListOfint()})
+  });
+  const _protocolSelector = Symbol('_protocolSelector');
+  const _compression = Symbol('_compression');
+  io._WebSocketTransformerImpl = class _WebSocketTransformerImpl extends core.Object {
+    new(protocolSelector, compression) {
+      this[_controller$0] = StreamControllerOfWebSocket().new({sync: true});
+      this[_protocolSelector] = protocolSelector;
+      this[_compression] = compression;
+    }
+    bind(stream) {
+      stream.listen(dart.fn(request => {
+        io._WebSocketTransformerImpl._upgrade(request, this[_protocolSelector], this[_compression]).then(dart.void)(dart.fn(webSocket => this[_controller$0].add(webSocket), WebSocketTovoid())).catchError(dart.bind(this[_controller$0], 'addError'));
+      }, HttpRequestToNull()), {onDone: dart.fn(() => {
+          this[_controller$0].close();
+        }, VoidToNull())});
+      return this[_controller$0].stream;
+    }
+    static _upgrade(request, _protocolSelector, compression) {
+      let response = request.response;
+      if (!dart.test(io._WebSocketTransformerImpl._isUpgradeRequest(request))) {
+        response.statusCode = io.HttpStatus.BAD_REQUEST;
+        response.close();
+        return FutureOfWebSocket().error(new io.WebSocketException("Invalid WebSocket upgrade request"));
+      }
+      function upgrade(protocol) {
+        response.statusCode = io.HttpStatus.SWITCHING_PROTOCOLS;
+        response.headers.add(io.HttpHeaders.CONNECTION, "Upgrade");
+        response.headers.add(io.HttpHeaders.UPGRADE, "websocket");
+        let key = request.headers.value("Sec-WebSocket-Key");
+        let sha1 = new io._SHA1();
+        sha1.add(dart.str`${key}${io._webSocketGUID}`[dartx.codeUnits]);
+        let accept = io._CryptoUtils.bytesToBase64(sha1.close());
+        response.headers.add("Sec-WebSocket-Accept", accept);
+        if (protocol != null) {
+          response.headers.add("Sec-WebSocket-Protocol", protocol);
+        }
+        let deflate = io._WebSocketTransformerImpl._negotiateCompression(request, response, compression);
+        response.headers.contentLength = 0;
+        return response.detachSocket().then(io._WebSocketImpl)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
+      }
+      dart.fn(upgrade, StringToFuture());
+      let protocols = request.headers._get('Sec-WebSocket-Protocol');
+      if (protocols != null && _protocolSelector != null) {
+        protocols = io._HttpParser._tokenizeFieldValue(protocols[dartx.join](', '));
+        return async.Future.new(dart.fn(() => dart.dcall(_protocolSelector, protocols), VoidTodynamic$())).then(dart.dynamic)(dart.fn(protocol => {
+          if (dart.notNull(protocols[dartx.indexOf](core.String._check(protocol))) < 0) {
+            dart.throw(new io.WebSocketException("Selected protocol is not in the list of available protocols"));
+          }
+          return protocol;
+        }, dynamicTodynamic$())).catchError(dart.fn(error => {
+          response.statusCode = io.HttpStatus.INTERNAL_SERVER_ERROR;
+          response.close();
+          dart.throw(error);
+        }, dynamicToNull$())).then(io.WebSocket)(upgrade);
+      } else {
+        return FutureOfWebSocket()._check(upgrade(null));
+      }
+    }
+    static _negotiateCompression(request, response, compression) {
+      let extensionHeader = request.headers.value("Sec-WebSocket-Extensions");
+      let t = extensionHeader;
+      t == null ? extensionHeader = "" : t;
+      let hv = io.HeaderValue.parse(extensionHeader, {valueSeparator: ','});
+      if (dart.test(compression.enabled) && hv.value == io._WebSocketImpl.PER_MESSAGE_DEFLATE) {
+        let info = compression[_createHeader](hv);
+        response.headers.add("Sec-WebSocket-Extensions", info.headerValue);
+        let serverNoContextTakeover = dart.test(hv.parameters[dartx.containsKey](io._serverNoContextTakeover)) && dart.test(compression.serverNoContextTakeover);
+        let clientNoContextTakeover = dart.test(hv.parameters[dartx.containsKey](io._clientNoContextTakeover)) && dart.test(compression.clientNoContextTakeover);
+        let deflate = new io._WebSocketPerMessageDeflate({serverNoContextTakeover: serverNoContextTakeover, clientNoContextTakeover: clientNoContextTakeover, serverMaxWindowBits: info.maxWindowBits, clientMaxWindowBits: info.maxWindowBits, serverSide: true});
+        return deflate;
+      }
+      return null;
+    }
+    static _isUpgradeRequest(request) {
+      if (request.method != "GET") {
+        return false;
+      }
+      if (request.headers._get(io.HttpHeaders.CONNECTION) == null) {
+        return false;
+      }
+      let isUpgrade = false;
+      request.headers._get(io.HttpHeaders.CONNECTION)[dartx.forEach](dart.fn(value => {
+        if (value[dartx.toLowerCase]() == "upgrade") isUpgrade = true;
+      }, StringToNull()));
+      if (!isUpgrade) return false;
+      let upgrade = request.headers.value(io.HttpHeaders.UPGRADE);
+      if (upgrade == null || upgrade[dartx.toLowerCase]() != "websocket") {
+        return false;
+      }
+      let version = request.headers.value("Sec-WebSocket-Version");
+      if (version == null || version != "13") {
+        return false;
+      }
+      let key = request.headers.value("Sec-WebSocket-Key");
+      if (key == null) {
+        return false;
+      }
+      return true;
+    }
+  };
+  io._WebSocketTransformerImpl[dart.implements] = () => [io.WebSocketTransformer];
+  dart.setSignature(io._WebSocketTransformerImpl, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketTransformerImpl, [core.Function, io.CompressionOptions])}),
+    fields: () => ({
+      [_controller$0]: StreamControllerOfWebSocket(),
+      [_protocolSelector]: core.Function,
+      [_compression]: io.CompressionOptions
+    }),
+    methods: () => ({bind: dart.definiteFunctionType(async.Stream$(io.WebSocket), [StreamOfHttpRequest()])}),
+    statics: () => ({
+      _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, dart.dynamic, io.CompressionOptions]),
+      _negotiateCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpRequest, io.HttpResponse, io.CompressionOptions]),
+      _isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
+    }),
+    names: ['_upgrade', '_negotiateCompression', '_isUpgradeRequest']
+  });
+  const _ensureDecoder = Symbol('_ensureDecoder');
+  const _ensureEncoder = Symbol('_ensureEncoder');
+  let const$80;
+  io._WebSocketPerMessageDeflate = class _WebSocketPerMessageDeflate extends core.Object {
+    new(opts) {
+      let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+      let serverMaxWindowBits = opts && 'serverMaxWindowBits' in opts ? opts.serverMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+      let serverNoContextTakeover = opts && 'serverNoContextTakeover' in opts ? opts.serverNoContextTakeover : false;
+      let clientNoContextTakeover = opts && 'clientNoContextTakeover' in opts ? opts.clientNoContextTakeover : false;
+      let serverSide = opts && 'serverSide' in opts ? opts.serverSide : false;
+      this.clientMaxWindowBits = clientMaxWindowBits;
+      this.serverMaxWindowBits = serverMaxWindowBits;
+      this.serverNoContextTakeover = serverNoContextTakeover;
+      this.clientNoContextTakeover = clientNoContextTakeover;
+      this.serverSide = serverSide;
+      this.decoder = null;
+      this.encoder = null;
+    }
+    [_ensureDecoder]() {
+      if (this.decoder == null) {
+        this.decoder = io._Filter._newZLibInflateFilter(dart.test(this.serverSide) ? this.clientMaxWindowBits : this.serverMaxWindowBits, null, true);
+      }
+    }
+    [_ensureEncoder]() {
+      if (this.encoder == null) {
+        this.encoder = io._Filter._newZLibDeflateFilter(false, io.ZLibOption.DEFAULT_LEVEL, dart.test(this.serverSide) ? this.serverMaxWindowBits : this.clientMaxWindowBits, io.ZLibOption.DEFAULT_MEM_LEVEL, io.ZLibOption.STRATEGY_DEFAULT, null, true);
+      }
+    }
+    processIncomingMessage(msg) {
+      this[_ensureDecoder]();
+      let data = [];
+      data[dartx.addAll](msg);
+      data[dartx.addAll](const$80 || (const$80 = dart.constList([0, 0, 255, 255], core.int)));
+      this.decoder.process(ListOfint()._check(data), 0, data[dartx.length]);
+      let result = [];
+      let out = null;
+      while ((out = this.decoder.processed()) != null) {
+        result[dartx.addAll](core.Iterable._check(out));
+      }
+      if (dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || !dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
+        this.decoder = null;
+      }
+      return typed_data.Uint8List.fromList(ListOfint()._check(result));
+    }
+    processOutgoingMessage(msg) {
+      this[_ensureEncoder]();
+      let result = [];
+      let buffer = null;
+      let out = null;
+      if (!typed_data.Uint8List.is(msg)) {
+        for (let i = 0; i < dart.notNull(msg[dartx.length]); i++) {
+          if (dart.notNull(msg[dartx._get](i)) < 0 || 255 < dart.notNull(msg[dartx._get](i))) {
+            dart.throw(new core.ArgumentError("List element is not a byte value " + dart.str`(value ${msg[dartx._get](i)} at index ${i})`));
+          }
+        }
+        buffer = typed_data.Uint8List.fromList(msg);
+      } else {
+        buffer = typed_data.Uint8List._check(msg);
+      }
+      this.encoder.process(buffer, 0, buffer[dartx.length]);
+      while ((out = this.encoder.processed()) != null) {
+        result[dartx.addAll](core.Iterable._check(out));
+      }
+      if (!dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
+        this.encoder = null;
+      }
+      if (dart.notNull(result[dartx.length]) > 4) {
+        result = result[dartx.sublist](0, dart.notNull(result[dartx.length]) - 4);
+      }
+      return ListOfint()._check(result);
+    }
+  };
+  dart.setSignature(io._WebSocketPerMessageDeflate, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [], {clientMaxWindowBits: core.int, serverMaxWindowBits: core.int, serverNoContextTakeover: core.bool, clientNoContextTakeover: core.bool, serverSide: core.bool})}),
+    fields: () => ({
+      serverNoContextTakeover: core.bool,
+      clientNoContextTakeover: core.bool,
+      clientMaxWindowBits: core.int,
+      serverMaxWindowBits: core.int,
+      serverSide: core.bool,
+      decoder: io._Filter,
+      encoder: io._Filter
+    }),
+    methods: () => ({
+      [_ensureDecoder]: dart.definiteFunctionType(dart.void, []),
+      [_ensureEncoder]: dart.definiteFunctionType(dart.void, []),
+      processIncomingMessage: dart.definiteFunctionType(typed_data.Uint8List, [ListOfint()]),
+      processOutgoingMessage: dart.definiteFunctionType(core.List$(core.int), [ListOfint()])
+    })
+  });
+  const _deflateHelper = Symbol('_deflateHelper');
+  const _outCloseCode = Symbol('_outCloseCode');
+  const _outCloseReason = Symbol('_outCloseReason');
+  io._WebSocketOutgoingTransformer = class _WebSocketOutgoingTransformer extends core.Object {
+    new(webSocket) {
+      this.webSocket = webSocket;
+      this[_eventSink$] = null;
+      this[_deflateHelper] = null;
+      this[_deflateHelper] = this.webSocket[_deflate];
+    }
+    bind(stream) {
+      return StreamOfListOfint().eventTransformed(stream, dart.fn(eventSink => {
+        if (this[_eventSink$] != null) {
+          dart.throw(new core.StateError("WebSocket transformer already used"));
+        }
+        this[_eventSink$] = eventSink;
+        return this;
+      }, EventSinkOfListOfintTo_WebSocketOutgoingTransformer()));
+    }
+    add(message) {
+      if (io._WebSocketPong.is(message)) {
+        this.addFrame(io._WebSocketOpcode.PONG, message.payload);
+        return;
+      }
+      if (io._WebSocketPing.is(message)) {
+        this.addFrame(io._WebSocketOpcode.PING, message.payload);
+        return;
+      }
+      let data = null;
+      let opcode = null;
+      if (message != null) {
+        if (typeof message == 'string') {
+          opcode = io._WebSocketOpcode.TEXT;
+          data = convert.UTF8.encode(message);
+        } else {
+          if (ListOfint().is(message)) {
+            data = message;
+            opcode = io._WebSocketOpcode.BINARY;
+          } else {
+            dart.throw(new core.ArgumentError(message));
+          }
+        }
+        if (this[_deflateHelper] != null) {
+          data = this[_deflateHelper].processOutgoingMessage(data);
+        }
+      } else {
+        opcode = io._WebSocketOpcode.TEXT;
+      }
+      this.addFrame(opcode, data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_eventSink$].addError(error, stackTrace);
+    }
+    close() {
+      let code = this.webSocket[_outCloseCode];
+      let reason = this.webSocket[_outCloseReason];
+      let data = null;
+      if (code != null) {
+        data = ListOfint().new();
+        data[dartx.add](dart.notNull(code) >> 8 & 255);
+        data[dartx.add](dart.notNull(code) & 255);
+        if (reason != null) {
+          data[dartx.addAll](convert.UTF8.encode(reason));
+        }
+      }
+      this.addFrame(io._WebSocketOpcode.CLOSE, data);
+      this[_eventSink$].close();
+    }
+    addFrame(opcode, data) {
+      return io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
+        this[_eventSink$].add(e);
+      }, ListOfintToNull()));
+    }
+    static createFrame(opcode, data, serverSide, compressed) {
+      let mask = !dart.test(serverSide);
+      let dataLength = data == null ? 0 : data[dartx.length];
+      let headerSize = mask ? 6 : 2;
+      if (dart.notNull(dataLength) > 65535) {
+        headerSize = headerSize + 8;
+      } else if (dart.notNull(dataLength) > 125) {
+        headerSize = headerSize + 2;
+      }
+      let header = typed_data.Uint8List.new(headerSize);
+      let index = 0;
+      let hoc = (io._WebSocketProtocolTransformer.FIN | (dart.test(compressed) ? io._WebSocketProtocolTransformer.RSV1 : 0) | dart.notNull(opcode) & io._WebSocketProtocolTransformer.OPCODE) >>> 0;
+      header[dartx._set](index++, hoc);
+      let lengthBytes = 1;
+      if (dart.notNull(dataLength) > 65535) {
+        header[dartx._set](index++, 127);
+        lengthBytes = 8;
+      } else if (dart.notNull(dataLength) > 125) {
+        header[dartx._set](index++, 126);
+        lengthBytes = 2;
+      }
+      for (let i = 0; i < lengthBytes; i++) {
+        header[dartx._set](index++, dataLength[dartx['>>']]((lengthBytes - 1 - i) * 8) & 255);
+      }
+      if (mask) {
+        let i$ = 1;
+        header[dartx._set](i$, (dart.notNull(header[dartx._get](i$)) | 1 << 7) >>> 0);
+        let maskBytes = io._IOCrypto.getRandomBytes(4);
+        header[dartx.setRange](index, index + 4, maskBytes);
+        index = index + 4;
+        if (data != null) {
+          let list = null;
+          if (opcode == io._WebSocketOpcode.TEXT && typed_data.Uint8List.is(data)) {
+            list = data;
+          } else {
+            if (typed_data.Uint8List.is(data)) {
+              list = typed_data.Uint8List.fromList(data);
+            } else {
+              list = typed_data.Uint8List.new(data[dartx.length]);
+              for (let i = 0; i < dart.notNull(data[dartx.length]); i++) {
+                if (dart.notNull(data[dartx._get](i)) < 0 || 255 < dart.notNull(data[dartx._get](i))) {
+                  dart.throw(new core.ArgumentError("List element is not a byte value " + dart.str`(value ${data[dartx._get](i)} at index ${i})`));
+                }
+                list[dartx._set](i, data[dartx._get](i));
+              }
+            }
+          }
+          let BLOCK_SIZE = 16;
+          let blockCount = (dart.notNull(list[dartx.length]) / BLOCK_SIZE)[dartx.truncate]();
+          if (blockCount > 0) {
+            let mask = 0;
+            for (let i = 3; i >= 0; i--) {
+              mask = (mask << 8 | dart.notNull(maskBytes[dartx._get](i))) >>> 0;
+            }
+            let blockMask = typed_data.Int32x4.new(mask, mask, mask, mask);
+            let blockBuffer = typed_data.Int32x4List.view(list[dartx.buffer], 0, blockCount);
+            for (let i = 0; i < dart.notNull(blockBuffer.length); i++) {
+              blockBuffer._set(i, blockBuffer._get(i)['^'](blockMask));
+            }
+          }
+          for (let i = blockCount * BLOCK_SIZE; i < dart.notNull(list[dartx.length]); i++) {
+            list[dartx._set](i, (dart.notNull(list[dartx._get](i)) ^ dart.notNull(maskBytes[dartx._get](i & 3))) >>> 0);
+          }
+          data = list;
+        }
+      }
+      dart.assert(index == headerSize);
+      if (data == null) {
+        return JSArrayOfUint8List().of([header]);
+      } else {
+        return JSArrayOfListOfint().of([header, data]);
+      }
+    }
+  };
+  io._WebSocketOutgoingTransformer[dart.implements] = () => [StreamTransformerOfdynamic$ListOfint(), async.EventSink];
+  dart.setSignature(io._WebSocketOutgoingTransformer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [io._WebSocketImpl])}),
+    fields: () => ({
+      webSocket: io._WebSocketImpl,
+      [_eventSink$]: EventSinkOfListOfint(),
+      [_deflateHelper]: io._WebSocketPerMessageDeflate
+    }),
+    methods: () => ({
+      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [async.Stream]),
+      add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
+      close: dart.definiteFunctionType(dart.void, []),
+      addFrame: dart.definiteFunctionType(dart.void, [core.int, ListOfint()])
+    }),
+    statics: () => ({createFrame: dart.definiteFunctionType(core.Iterable$(core.List$(core.int)), [core.int, ListOfint(), core.bool, core.bool])}),
+    names: ['createFrame']
+  });
+  const _issuedPause = Symbol('_issuedPause');
+  const _completer = Symbol('_completer');
+  const _onListen$ = Symbol('_onListen');
+  const _onPause$ = Symbol('_onPause');
+  const _onResume$ = Symbol('_onResume');
+  const _cancel$ = Symbol('_cancel');
+  const _done$ = Symbol('_done');
+  const _ensureController = Symbol('_ensureController');
+  io._WebSocketConsumer = class _WebSocketConsumer extends core.Object {
+    new(webSocket, socket) {
+      this[_closeCompleter] = async.Completer.new();
+      this.webSocket = webSocket;
+      this.socket = socket;
+      this[_controller$0] = null;
+      this[_subscription$] = null;
+      this[_issuedPause] = false;
+      this[_closed] = false;
+      this[_completer] = null;
+    }
+    [_onListen$]() {
+      if (this[_subscription$] != null) {
+        this[_subscription$].cancel();
+      }
+    }
+    [_onPause$]() {
+      if (this[_subscription$] != null) {
+        this[_subscription$].pause();
+      } else {
+        this[_issuedPause] = true;
+      }
+    }
+    [_onResume$]() {
+      if (this[_subscription$] != null) {
+        this[_subscription$].resume();
+      } else {
+        this[_issuedPause] = false;
+      }
+    }
+    [_cancel$]() {
+      if (this[_subscription$] != null) {
+        let subscription = this[_subscription$];
+        this[_subscription$] = null;
+        subscription.cancel();
+      }
+    }
+    [_ensureController]() {
+      if (this[_controller$0] != null) return;
+      this[_controller$0] = async.StreamController.new({sync: true, onPause: dart.bind(this, _onPause$), onResume: dart.bind(this, _onResume$), onCancel: dart.bind(this, _onListen$)});
+      let stream = this[_controller$0].stream.transform(ListOfint())(new io._WebSocketOutgoingTransformer(this.webSocket));
+      this.socket.addStream(stream).then(dart.dynamic)(dart.fn(_ => {
+        this[_done$]();
+        this[_closeCompleter].complete(this.webSocket);
+      }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
+          this[_closed] = true;
+          this[_cancel$]();
+          if (core.ArgumentError.is(error)) {
+            if (!dart.test(this[_done$](error, stackTrace))) {
+              this[_closeCompleter].completeError(error, stackTrace);
+            }
+          } else {
+            this[_done$]();
+            this[_closeCompleter].complete(this.webSocket);
+          }
+        }, dynamicAndStackTraceToNull())});
+    }
+    [_done$](error, stackTrace) {
+      if (error === void 0) error = null;
+      if (stackTrace === void 0) stackTrace = null;
+      if (this[_completer] == null) return false;
+      if (error != null) {
+        this[_completer].completeError(error, stackTrace);
+      } else {
+        this[_completer].complete(this.webSocket);
+      }
+      this[_completer] = null;
+      return true;
+    }
+    addStream(stream) {
+      if (dart.test(this[_closed])) {
+        stream.listen(null).cancel();
+        return async.Future.value(this.webSocket);
+      }
+      this[_ensureController]();
+      this[_completer] = async.Completer.new();
+      this[_subscription$] = stream.listen(dart.fn(data => {
+        this[_controller$0].add(data);
+      }, dynamicToNull$()), {onDone: dart.bind(this, _done$), onError: dart.bind(this, _done$), cancelOnError: true});
+      if (dart.test(this[_issuedPause])) {
+        this[_subscription$].pause();
+        this[_issuedPause] = false;
+      }
+      return this[_completer].future;
+    }
+    close() {
+      this[_ensureController]();
+      const closeSocket = (function() {
+        return this.socket.close().catchError(dart.fn(_ => {
+        }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, dynamicTo_WebSocketImpl()));
+      }).bind(this);
+      dart.fn(closeSocket, VoidToFuture());
+      this[_controller$0].close();
+      return this[_closeCompleter].future.then(dart.dynamic)(dart.fn(_ => closeSocket(), dynamicToFuture()));
+    }
+    add(data) {
+      if (dart.test(this[_closed])) return;
+      this[_ensureController]();
+      this[_controller$0].add(data);
+    }
+    closeSocket() {
+      this[_closed] = true;
+      this[_cancel$]();
+      this.close();
+    }
+  };
+  io._WebSocketConsumer[dart.implements] = () => [async.StreamConsumer];
+  dart.setSignature(io._WebSocketConsumer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketConsumer, [io._WebSocketImpl, io.Socket])}),
+    fields: () => ({
+      webSocket: io._WebSocketImpl,
+      socket: io.Socket,
+      [_controller$0]: async.StreamController,
+      [_subscription$]: async.StreamSubscription,
+      [_issuedPause]: core.bool,
+      [_closed]: core.bool,
+      [_closeCompleter]: async.Completer,
+      [_completer]: async.Completer
+    }),
+    methods: () => ({
+      [_onListen$]: dart.definiteFunctionType(dart.void, []),
+      [_onPause$]: dart.definiteFunctionType(dart.void, []),
+      [_onResume$]: dart.definiteFunctionType(dart.void, []),
+      [_cancel$]: dart.definiteFunctionType(dart.void, []),
+      [_ensureController]: dart.definiteFunctionType(dart.dynamic, []),
+      [_done$]: dart.definiteFunctionType(core.bool, [], [dart.dynamic, core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
+      close: dart.definiteFunctionType(async.Future, []),
+      add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      closeSocket: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _readyState = Symbol('_readyState');
+  const _writeClosed = Symbol('_writeClosed');
+  const _closeCode = Symbol('_closeCode');
+  const _closeReason = Symbol('_closeReason');
+  const _pingInterval = Symbol('_pingInterval');
+  const _pingTimer = Symbol('_pingTimer');
+  const _consumer = Symbol('_consumer');
+  const _closeTimer = Symbol('_closeTimer');
+  let const$81;
+  io._WebSocketImpl = class _WebSocketImpl extends dart.mixin(async.Stream, io._ServiceObject) {
+    static connect(url, protocols, headers, opts) {
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      let uri = core.Uri.parse(url);
+      if (uri.scheme != "ws" && uri.scheme != "wss") {
+        dart.throw(new io.WebSocketException(dart.str`Unsupported URL scheme '${uri.scheme}'`));
+      }
+      let random = math.Random.new();
+      let nonceData = typed_data.Uint8List.new(16);
+      for (let i = 0; i < 16; i++) {
+        nonceData[dartx._set](i, random.nextInt(256));
+      }
+      let nonce = io._CryptoUtils.bytesToBase64(nonceData);
+      uri = core.Uri.new({scheme: uri.scheme == "wss" ? "https" : "http", userInfo: uri.userInfo, host: uri.host, port: uri.port, path: uri.path, query: uri.query, fragment: uri.fragment});
+      return io._WebSocketImpl._httpClient.openUrl("GET", uri).then(io.HttpClientResponse)(dart.fn(request => {
+        if (uri.userInfo != null && !dart.test(uri.userInfo[dartx.isEmpty])) {
+          let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(uri.userInfo));
+          request.headers.set(io.HttpHeaders.AUTHORIZATION, dart.str`Basic ${auth}`);
+        }
+        if (headers != null) {
+          headers[dartx.forEach](dart.fn((field, value) => request.headers.add(field, value), StringAnddynamicTovoid()));
+        }
+        let _ = request.headers;
+        _.set(io.HttpHeaders.CONNECTION, "Upgrade");
+        _.set(io.HttpHeaders.UPGRADE, "websocket");
+        _.set("Sec-WebSocket-Key", nonce);
+        _.set("Cache-Control", "no-cache");
+        _.set("Sec-WebSocket-Version", "13");
+        if (protocols != null) {
+          request.headers.add("Sec-WebSocket-Protocol", protocols[dartx.toList]());
+        }
+        if (dart.test(compression.enabled)) {
+          request.headers.add("Sec-WebSocket-Extensions", compression[_createHeader]());
+        }
+        return request.close();
+      }, HttpClientRequestToFutureOfHttpClientResponse())).then(io.WebSocket)(dart.fn(response => {
+        function error(message) {
+          response.detachSocket().then(dart.dynamic)(dart.fn(socket => {
+            socket.destroy();
+          }, SocketToNull()));
+          dart.throw(new io.WebSocketException(message));
+        }
+        dart.fn(error, StringTovoid$());
+        if (response.statusCode != io.HttpStatus.SWITCHING_PROTOCOLS || response.headers._get(io.HttpHeaders.CONNECTION) == null || !dart.test(response.headers._get(io.HttpHeaders.CONNECTION)[dartx.any](dart.fn(value => value[dartx.toLowerCase]() == "upgrade", StringTobool$()))) || response.headers.value(io.HttpHeaders.UPGRADE)[dartx.toLowerCase]() != "websocket") {
+          error(dart.str`Connection to '${uri}' was not upgraded to websocket`);
+        }
+        let accept = response.headers.value("Sec-WebSocket-Accept");
+        if (accept == null) {
+          error("Response did not contain a 'Sec-WebSocket-Accept' header");
+        }
+        let sha1 = new io._SHA1();
+        sha1.add(dart.str`${nonce}${io._webSocketGUID}`[dartx.codeUnits]);
+        let expectedAccept = sha1.close();
+        let receivedAccept = io._CryptoUtils.base64StringToBytes(accept);
+        if (expectedAccept[dartx.length] != receivedAccept[dartx.length]) {
+          error("Reasponse header 'Sec-WebSocket-Accept' is the wrong length");
+        }
+        for (let i = 0; i < dart.notNull(expectedAccept[dartx.length]); i++) {
+          if (expectedAccept[dartx._get](i) != receivedAccept[dartx._get](i)) {
+            error("Bad response 'Sec-WebSocket-Accept' header");
+          }
+        }
+        let protocol = response.headers.value('Sec-WebSocket-Protocol');
+        let deflate = io._WebSocketImpl.negotiateClientCompression(response, compression);
+        return response.detachSocket().then(io.WebSocket)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, false, deflate), SocketTo_WebSocketImpl()));
+      }, HttpClientResponseToFutureOfWebSocket()));
+    }
+    static negotiateClientCompression(response, compression) {
+      let extensionHeader = response.headers.value('Sec-WebSocket-Extensions');
+      if (extensionHeader == null) {
+        extensionHeader = "";
+      }
+      let hv = io.HeaderValue.parse(extensionHeader, {valueSeparator: ','});
+      if (dart.test(compression.enabled) && hv.value == io._WebSocketImpl.PER_MESSAGE_DEFLATE) {
+        let serverNoContextTakeover = hv.parameters[dartx.containsKey](io._serverNoContextTakeover);
+        let clientNoContextTakeover = hv.parameters[dartx.containsKey](io._clientNoContextTakeover);
+        function getWindowBits(type) {
+          let o = hv.parameters[dartx._get](type);
+          if (o == null) {
+            return io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+          }
+          return core.int.parse(o, {onError: dart.fn(s => io._WebSocketImpl.DEFAULT_WINDOW_BITS, StringToint$())});
+        }
+        dart.fn(getWindowBits, StringToint$());
+        return new io._WebSocketPerMessageDeflate({clientMaxWindowBits: getWindowBits(io._clientMaxWindowBits), serverMaxWindowBits: getWindowBits(io._serverMaxWindowBits), clientNoContextTakeover: clientNoContextTakeover, serverNoContextTakeover: serverNoContextTakeover});
+      }
+      return null;
+    }
+    _fromSocket(socket, protocol, compression, serverSide, deflate) {
+      if (serverSide === void 0) serverSide = false;
+      if (deflate === void 0) deflate = null;
+      this[_socket] = socket;
+      this.protocol = protocol;
+      this[_serverSide] = serverSide;
+      this[_controller$0] = null;
+      this[_subscription$] = null;
+      this[_sink$0] = null;
+      this[_readyState] = io.WebSocket.CONNECTING;
+      this[_writeClosed] = false;
+      this[_closeCode] = null;
+      this[_closeReason] = null;
+      this[_pingInterval] = null;
+      this[_pingTimer] = null;
+      this[_consumer] = null;
+      this[_outCloseCode] = null;
+      this[_outCloseReason] = null;
+      this[_closeTimer] = null;
+      this[_deflate] = null;
+      super.new();
+      this[_consumer] = new io._WebSocketConsumer(this, io.Socket._check(this[_socket]));
+      this[_sink$0] = new io._StreamSinkImpl(this[_consumer]);
+      this[_readyState] = io.WebSocket.OPEN;
+      this[_deflate] = deflate;
+      let transformer = new io._WebSocketProtocolTransformer(this[_serverSide], this[_deflate]);
+      this[_subscription$] = async.StreamSubscription._check(dart.dsend(dart.dsend(this[_socket], 'transform', transformer), 'listen', dart.fn(data => {
+        if (io._WebSocketPing.is(data)) {
+          if (!dart.test(this[_writeClosed])) this[_consumer].add(new io._WebSocketPong(data.payload));
+        } else if (io._WebSocketPong.is(data)) {
+          this.pingInterval = this[_pingInterval];
+        } else {
+          this[_controller$0].add(data);
+        }
+      }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
+          if (this[_closeTimer] != null) this[_closeTimer].cancel();
+          if (core.FormatException.is(error)) {
+            this[_close$0](io.WebSocketStatus.INVALID_FRAME_PAYLOAD_DATA);
+          } else {
+            this[_close$0](io.WebSocketStatus.PROTOCOL_ERROR);
+          }
+          this[_closeCode] = this[_outCloseCode];
+          this[_closeReason] = this[_outCloseReason];
+          this[_controller$0].close();
+        }, dynamicAnddynamicToNull()), onDone: dart.fn(() => {
+          if (this[_closeTimer] != null) this[_closeTimer].cancel();
+          if (this[_readyState] == io.WebSocket.OPEN) {
+            this[_readyState] = io.WebSocket.CLOSING;
+            if (!dart.test(io._WebSocketImpl._isReservedStatusCode(transformer.closeCode))) {
+              this[_close$0](transformer.closeCode, transformer.closeReason);
+            } else {
+              this[_close$0]();
+            }
+            this[_readyState] = io.WebSocket.CLOSED;
+          }
+          this[_closeCode] = transformer.closeCode;
+          this[_closeReason] = transformer.closeReason;
+          this[_controller$0].close();
+        }, VoidToNull()), cancelOnError: true}));
+      this[_subscription$].pause();
+      this[_controller$0] = async.StreamController.new({sync: true, onListen: dart.bind(this[_subscription$], 'resume'), onCancel: dart.fn(() => {
+          this[_subscription$].cancel();
+          this[_subscription$] = null;
+        }, VoidToNull()), onPause: dart.bind(this[_subscription$], 'pause'), onResume: dart.bind(this[_subscription$], 'resume')});
+      io._WebSocketImpl._webSockets[dartx._set](this[_serviceId], this);
+      try {
+        dart.dput(this[_socket], _owner, this);
+      } catch (_) {
+      }
+
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get pingInterval() {
+      return this[_pingInterval];
+    }
+    set pingInterval(interval) {
+      if (dart.test(this[_writeClosed])) return;
+      if (this[_pingTimer] != null) this[_pingTimer].cancel();
+      this[_pingInterval] = interval;
+      if (this[_pingInterval] == null) return;
+      this[_pingTimer] = async.Timer.new(this[_pingInterval], dart.fn(() => {
+        if (dart.test(this[_writeClosed])) return;
+        this[_consumer].add(new io._WebSocketPing());
+        this[_pingTimer] = async.Timer.new(this[_pingInterval], dart.fn(() => {
+          this[_close$0](io.WebSocketStatus.GOING_AWAY);
+        }, VoidToNull()));
+      }, VoidToNull()));
+    }
+    get readyState() {
+      return this[_readyState];
+    }
+    get extensions() {
+      return null;
+    }
+    get closeCode() {
+      return this[_closeCode];
+    }
+    get closeReason() {
+      return this[_closeReason];
+    }
+    add(data) {
+      this[_sink$0].add(data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_sink$0].addError(error, stackTrace);
+    }
+    addStream(stream) {
+      return this[_sink$0].addStream(stream);
+    }
+    get done() {
+      return this[_sink$0].done;
+    }
+    close(code, reason) {
+      if (code === void 0) code = null;
+      if (reason === void 0) reason = null;
+      if (dart.test(io._WebSocketImpl._isReservedStatusCode(code))) {
+        dart.throw(new io.WebSocketException(dart.str`Reserved status code ${code}`));
+      }
+      if (this[_outCloseCode] == null) {
+        this[_outCloseCode] = code;
+        this[_outCloseReason] = reason;
+      }
+      if (!dart.test(this[_controller$0].isClosed)) {
+        if (!dart.test(this[_controller$0].hasListener) && this[_subscription$] != null) {
+          this[_controller$0].stream.drain(dart.dynamic)().catchError(dart.fn(_ => dart.map(), dynamicToMap()));
+        }
+        if (this[_closeTimer] == null) {
+          this[_closeTimer] = async.Timer.new(const$81 || (const$81 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
+            this[_closeCode] = this[_outCloseCode];
+            this[_closeReason] = this[_outCloseReason];
+            if (this[_subscription$] != null) this[_subscription$].cancel();
+            this[_controller$0].close();
+            io._WebSocketImpl._webSockets[dartx.remove](this[_serviceId]);
+          }, VoidToNull()));
+        }
+      }
+      return this[_sink$0].close();
+    }
+    [_close$0](code, reason) {
+      if (code === void 0) code = null;
+      if (reason === void 0) reason = null;
+      if (dart.test(this[_writeClosed])) return;
+      if (this[_outCloseCode] == null) {
+        this[_outCloseCode] = code;
+        this[_outCloseReason] = reason;
+      }
+      this[_writeClosed] = true;
+      this[_consumer].closeSocket();
+      io._WebSocketImpl._webSockets[dartx.remove](this[_serviceId]);
+    }
+    get [_serviceTypePath]() {
+      return 'io/websockets';
+    }
+    get [_serviceTypeName]() {
+      return 'WebSocket';
+    }
+    [_toJSON$](ref) {
+      let name = dart.str`${dart.dload(dart.dload(this[_socket], 'address'), 'host')}:${dart.dload(this[_socket], 'port')}`;
+      let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: name, user_name: name}, core.String, dart.dynamic);
+      if (dart.test(ref)) {
+        return r;
+      }
+      try {
+        r[dartx._set]('socket', dart.dsend(this[_socket], _toJSON$, true));
+      } catch (_) {
+        r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+      }
+
+      return r;
+    }
+    static _isReservedStatusCode(code) {
+      return code != null && (dart.notNull(code) < io.WebSocketStatus.NORMAL_CLOSURE || code == io.WebSocketStatus.RESERVED_1004 || code == io.WebSocketStatus.NO_STATUS_RECEIVED || code == io.WebSocketStatus.ABNORMAL_CLOSURE || dart.notNull(code) > io.WebSocketStatus.INTERNAL_SERVER_ERROR && dart.notNull(code) < io.WebSocketStatus.RESERVED_1015 || dart.notNull(code) >= io.WebSocketStatus.RESERVED_1015 && dart.notNull(code) < 3000);
+    }
+  };
+  dart.addSimpleTypeTests(io._WebSocketImpl);
+  dart.defineNamedConstructor(io._WebSocketImpl, '_fromSocket');
+  io._WebSocketImpl[dart.implements] = () => [io.WebSocket];
+  dart.setSignature(io._WebSocketImpl, {
+    constructors: () => ({_fromSocket: dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic, core.String, io.CompressionOptions], [core.bool, io._WebSocketPerMessageDeflate])}),
+    fields: () => ({
+      protocol: core.String,
+      [_controller$0]: async.StreamController,
+      [_subscription$]: async.StreamSubscription,
+      [_sink$0]: async.StreamSink,
+      [_socket]: dart.dynamic,
+      [_serverSide]: core.bool,
+      [_readyState]: core.int,
+      [_writeClosed]: core.bool,
+      [_closeCode]: core.int,
+      [_closeReason]: core.String,
+      [_pingInterval]: core.Duration,
+      [_pingTimer]: async.Timer,
+      [_consumer]: io._WebSocketConsumer,
+      [_outCloseCode]: core.int,
+      [_outCloseReason]: core.String,
+      [_closeTimer]: async.Timer,
+      [_deflate]: io._WebSocketPerMessageDeflate
+    }),
+    getters: () => ({
+      pingInterval: dart.definiteFunctionType(core.Duration, []),
+      readyState: dart.definiteFunctionType(core.int, []),
+      extensions: dart.definiteFunctionType(core.String, []),
+      closeCode: dart.definiteFunctionType(core.int, []),
+      closeReason: dart.definiteFunctionType(core.String, []),
+      done: dart.definiteFunctionType(async.Future, []),
+      [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+      [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+    }),
+    setters: () => ({pingInterval: dart.definiteFunctionType(dart.void, [core.Duration])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
+      close: dart.definiteFunctionType(async.Future, [], [core.int, core.String]),
+      [_close$0]: dart.definiteFunctionType(dart.void, [], [core.int, core.String]),
+      [_toJSON$]: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [core.bool])
+    }),
+    sfields: () => ({
+      _webSockets: MapOfint$_WebSocketImpl(),
+      DEFAULT_WINDOW_BITS: core.int,
+      PER_MESSAGE_DEFLATE: core.String,
+      _httpClient: io.HttpClient
+    }),
+    statics: () => ({
+      connect: dart.definiteFunctionType(async.Future$(io.WebSocket), [core.String, IterableOfString(), MapOfString$dynamic()], {compression: io.CompressionOptions}),
+      negotiateClientCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpClientResponse, io.CompressionOptions]),
+      _isReservedStatusCode: dart.definiteFunctionType(core.bool, [core.int])
+    }),
+    names: ['connect', 'negotiateClientCompression', '_isReservedStatusCode']
+  });
+  io._WebSocketImpl.DEFAULT_WINDOW_BITS = 15;
+  io._WebSocketImpl.PER_MESSAGE_DEFLATE = "permessage-deflate";
+  dart.defineLazy(io._WebSocketImpl, {
+    get _webSockets() {
+      return MapOfint$_WebSocketImpl().new();
+    },
+    set _webSockets(_) {},
+    get _httpClient() {
+      return io.HttpClient.new();
+    }
+  });
   isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
     new(message) {
       this.message = message;
@@ -37352,11 +52555,11 @@
       controller = async.StreamController.broadcast({sync: true, onListen: dart.fn(() => {
           port = isolate.RawReceivePort.new(handleError);
           this.addErrorListener(port.sendPort);
-        }, VoidTovoid$()), onCancel: dart.fn(() => {
+        }, VoidToNull()), onCancel: dart.fn(() => {
           this.removeErrorListener(port.sendPort);
           port.close();
           port = null;
-        }, VoidTovoid$())});
+        }, VoidToNull())});
       return controller.stream;
     }
   };
@@ -37493,7 +52696,7 @@
   });
   dart.defineLazy(js, {
     get context() {
-      return js._wrapToDart(js._global);
+      return js.JsObject._check(js._wrapToDart(js._global));
     }
   });
   const _jsObject = Symbol('_jsObject');
@@ -37506,22 +52709,22 @@
       if (arguments$ === void 0) arguments$ = null;
       let ctor = constructor[_jsObject];
       if (arguments$ == null) {
-        return js._wrapToDart(new ctor());
+        return js.JsObject._check(js._wrapToDart(new ctor()));
       }
       let unwrapped = core.List.from(arguments$[dartx.map](dart.dynamic)(js._convertToJS));
-      return js._wrapToDart(new ctor(...unwrapped));
+      return js.JsObject._check(js._wrapToDart(new ctor(...unwrapped)));
     }
     static fromBrowserObject(object) {
       if (typeof object == 'number' || typeof object == 'string' || typeof object == 'boolean' || object == null) {
         dart.throw(new core.ArgumentError("object cannot be a num, string, bool, or null"));
       }
-      return js._wrapToDart(js._convertToJS(object));
+      return js.JsObject._check(js._wrapToDart(js._convertToJS(object)));
     }
     static jsify(object) {
       if (!core.Map.is(object) && !core.Iterable.is(object)) {
         dart.throw(new core.ArgumentError("object must be a Map or Iterable"));
       }
-      return js._wrapToDart(js.JsObject._convertDataTree(object));
+      return js.JsObject._check(js._wrapToDart(js.JsObject._convertDataTree(object)));
     }
     static _convertDataTree(data) {
       let _convertedObjects = collection.HashMap.identity();
@@ -37597,7 +52800,7 @@
       }
       if (args != null) args = core.List.from(args[dartx.map](dart.dynamic)(js._convertToJS));
       let fn = this[_jsObject][method];
-      if (!(fn instanceof Function)) {
+      if (typeof fn !== "function") {
         dart.throw(new core.NoSuchMethodError(this[_jsObject], core.Symbol.new(core.String._check(method)), args, dart.map({}, core.Symbol, dart.dynamic)));
       }
       return js._convertToDart(fn.apply(this[_jsObject], args));
@@ -37769,14 +52972,7 @@
         [_checkIndex]: dart.definiteFunctionType(dart.dynamic, [core.int]),
         [_checkInsertIndex]: dart.definiteFunctionType(dart.dynamic, [core.int]),
         _get: dart.definiteFunctionType(E, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [core.Object, E]),
-        add: dart.definiteFunctionType(dart.void, [E]),
-        addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
-        insert: dart.definiteFunctionType(dart.void, [core.int, E]),
-        removeAt: dart.definiteFunctionType(E, [core.int]),
-        removeLast: dart.definiteFunctionType(E, []),
-        setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()], [core.int]),
-        sort: dart.definiteFunctionType(dart.void, [], [EAndEToint()])
+        _set: dart.definiteFunctionType(dart.void, [core.Object, E])
       }),
       statics: () => ({_checkRange: dart.definiteFunctionType(dart.dynamic, [core.int, core.int, core.int])}),
       names: ['_checkRange']
@@ -37799,7 +52995,7 @@
   });
   js.JsArray = JsArray();
   js._isBrowserType = function(o) {
-    return o instanceof Blob || o instanceof Event || window.KeyRange && o instanceof KeyRange || o instanceof ImageData || o instanceof Node || window.TypedData && o instanceof TypedData || o instanceof Window;
+    return o instanceof Object && (o instanceof Blob || o instanceof Event || window.KeyRange && o instanceof KeyRange || window.IDBKeyRange && o instanceof IDBKeyRange || o instanceof ImageData || o instanceof Node || window.Int8Array && o instanceof Int8Array.__proto__ || o instanceof Window);
   };
   dart.fn(js._isBrowserType, dynamicTobool$());
   const _dartObj = Symbol('_dartObj');
@@ -37844,11 +53040,15 @@
     } else if (js._DartObject.is(o) && dart.jsobject != dart.getReifiedType(o)) {
       return o[_dartObj];
     } else {
-      return js._putIfAbsent(js._dartProxies, o, js._wrapToDart);
+      return js._wrapToDart(o);
     }
   };
   dart.fn(js._convertToDart, dynamicToObject());
   js._wrapToDart = function(o) {
+    return js._putIfAbsent(js._dartProxies, o, js._wrapToDartHelper);
+  };
+  dart.fn(js._wrapToDart, dynamicToObject());
+  js._wrapToDartHelper = function(o) {
     if (typeof o == "function") {
       return new js.JsFunction._fromJs(o);
     }
@@ -37857,7 +53057,7 @@
     }
     return new js.JsObject._fromJs(o);
   };
-  dart.fn(js._wrapToDart, dynamicToJsObject());
+  dart.fn(js._wrapToDartHelper, dynamicToObject());
   dart.defineLazy(js, {
     get _dartProxies() {
       return new WeakMap();
@@ -38222,11 +53422,11 @@
   math._Random._POW2_53_D = 1.0 * 9007199254740992;
   math._Random._POW2_27_D = 1.0 * (1 << 27);
   math._Random._MASK32 = 4294967295;
-  const _buffer$ = Symbol('_buffer');
+  const _buffer$0 = Symbol('_buffer');
   const _getRandomBytes = Symbol('_getRandomBytes');
   math._JSSecureRandom = class _JSSecureRandom extends core.Object {
     new() {
-      this[_buffer$] = typed_data.ByteData.new(8);
+      this[_buffer$0] = typed_data.ByteData.new(8);
       let crypto = self.crypto;
       if (crypto != null) {
         let getRandomValues = crypto.getRandomValues;
@@ -38237,18 +53437,18 @@
       dart.throw(new core.UnsupportedError("No source of cryptographically secure random numbers available."));
     }
     [_getRandomBytes](start, length) {
-      crypto.getRandomValues(this[_buffer$][dartx.buffer][dartx.asUint8List](start, length));
+      crypto.getRandomValues(this[_buffer$0][dartx.buffer][dartx.asUint8List](start, length));
     }
     nextBool() {
       this[_getRandomBytes](0, 1);
-      return this[_buffer$][dartx.getUint8](0)[dartx.isOdd];
+      return this[_buffer$0][dartx.getUint8](0)[dartx.isOdd];
     }
     nextDouble() {
       this[_getRandomBytes](1, 7);
-      this[_buffer$][dartx.setUint8](0, 63);
-      let highByte = this[_buffer$][dartx.getUint8](1);
-      this[_buffer$][dartx.setUint8](1, (dart.notNull(highByte) | 240) >>> 0);
-      let result = dart.notNull(this[_buffer$][dartx.getFloat64](0)) - 1.0;
+      this[_buffer$0][dartx.setUint8](0, 63);
+      let highByte = this[_buffer$0][dartx.getUint8](1);
+      this[_buffer$0][dartx.setUint8](1, (dart.notNull(highByte) | 240) >>> 0);
+      let result = dart.notNull(this[_buffer$0][dartx.getFloat64](0)) - 1.0;
       if ((dart.notNull(highByte) & 16) != 0) {
         result = result + 1.1102230246251565e-16;
       }
@@ -38268,12 +53468,12 @@
           }
         }
       }
-      this[_buffer$][dartx.setUint32](0, 0);
+      this[_buffer$0][dartx.setUint32](0, 0);
       let start = 4 - byteCount;
       let randomLimit = dart.asInt(math.pow(256, byteCount));
       while (true) {
         this[_getRandomBytes](start, byteCount);
-        let random = this[_buffer$][dartx.getUint32](0);
+        let random = this[_buffer$0][dartx.getUint32](0);
         if ((dart.notNull(max) & dart.notNull(max) - 1) == 0) {
           return (dart.notNull(random) & dart.notNull(max) - 1) >>> 0;
         }
@@ -38287,7 +53487,7 @@
   math._JSSecureRandom[dart.implements] = () => [math.Random];
   dart.setSignature(math._JSSecureRandom, {
     constructors: () => ({new: dart.definiteFunctionType(math._JSSecureRandom, [])}),
-    fields: () => ({[_buffer$]: typed_data.ByteData}),
+    fields: () => ({[_buffer$0]: typed_data.ByteData}),
     methods: () => ({
       [_getRandomBytes]: dart.definiteFunctionType(dart.void, [core.int, core.int]),
       nextBool: dart.definiteFunctionType(core.bool, []),
@@ -38385,11 +53585,11 @@
     return Point;
   });
   math.Point = Point$();
-  let const$52;
+  let const$82;
   math.Random = class Random extends core.Object {
     static new(seed) {
       if (seed === void 0) seed = null;
-      return seed == null ? const$52 || (const$52 = dart.const(new math._JSRandom())) : new math._Random(seed);
+      return seed == null ? const$82 || (const$82 = dart.const(new math._JSRandom())) : new math._Random(seed);
     }
     static secure() {
       return math.Random._secureRandom;
@@ -39249,7 +54449,7 @@
   indexed_db._idbKey = 'JSExtendableArray|=Object|num|String';
   indexed_db._annotation_Creates_IDBKey = dart.const(new _js_helper.Creates(indexed_db._idbKey));
   indexed_db._annotation_Returns_IDBKey = dart.const(new _js_helper.Returns(indexed_db._idbKey));
-  const _delete = Symbol('_delete');
+  const _delete$ = Symbol('_delete');
   const _update = Symbol('_update');
   const _update_1 = Symbol('_update_1');
   dart.defineExtensionNames([
@@ -39266,7 +54466,7 @@
   indexed_db.Cursor = class Cursor extends _interceptors.Interceptor {
     [dartx.delete]() {
       try {
-        return indexed_db._completeRequest(dart.dynamic)(this[_delete]());
+        return indexed_db._completeRequest(dart.dynamic)(this[_delete$]());
       } catch (e) {
         let stacktrace = dart.stackTrace(e);
         return async.Future.error(e, stacktrace);
@@ -39311,7 +54511,7 @@
     [dartx.continuePrimaryKey](...args) {
       return this.continuePrimaryKey.apply(this, args);
     }
-    [_delete](...args) {
+    [_delete$](...args) {
       return this.delete.apply(this, args);
     }
     [_update](value) {
@@ -39336,7 +54536,7 @@
       [dartx.next]: dart.definiteFunctionType(dart.void, [], [core.Object]),
       [dartx.advance]: dart.definiteFunctionType(dart.void, [core.int]),
       [dartx.continuePrimaryKey]: dart.definiteFunctionType(dart.void, [core.Object, core.Object]),
-      [_delete]: dart.definiteFunctionType(indexed_db.Request, []),
+      [_delete$]: dart.definiteFunctionType(indexed_db.Request, []),
       [_update]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
       [_update_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic])
     })
@@ -39624,7 +54824,7 @@
         let completer = CompleterOfIdbFactory().sync();
         request[dartx.onSuccess].listen(dart.fn(e => {
           completer.complete(this);
-        }, EventTovoid$()));
+        }, EventToNull()));
         request[dartx.onError].listen(dart.bind(completer, 'completeError'));
         return completer.future;
       } catch (e) {
@@ -39683,7 +54883,7 @@
       request[dartx.onSuccess].listen(dart.fn(e => {
         let result = indexed_db._cast(T)(request[dartx.result]);
         completer.complete(result);
-      }, EventTovoid$()));
+      }, EventToNull()));
       request[dartx.onError].listen(dart.bind(completer, 'completeError'));
       return completer.future;
     };
@@ -39911,7 +55111,7 @@
     names: ['bound_', 'lowerBound_', 'only_', 'upperBound_']
   });
   dart.registerExtension(dart.global.IDBKeyRange, indexed_db.KeyRange);
-  const _add$2 = Symbol('_add');
+  const _add$3 = Symbol('_add');
   const _clear$0 = Symbol('_clear');
   const _put = Symbol('_put');
   const _createIndex = Symbol('_createIndex');
@@ -39947,9 +55147,9 @@
       try {
         let request = null;
         if (key != null) {
-          request = this[_add$2](value, key);
+          request = this[_add$3](value, key);
         } else {
-          request = this[_add$2](value);
+          request = this[_add$3](value);
         }
         return indexed_db._completeRequest(dart.dynamic)(indexed_db.Request._check(request));
       } catch (e) {
@@ -39969,7 +55169,7 @@
     }
     [dartx.delete](key_OR_keyRange) {
       try {
-        return indexed_db._completeRequest(dart.dynamic)(this[_delete](key_OR_keyRange));
+        return indexed_db._completeRequest(dart.dynamic)(this[_delete$](key_OR_keyRange));
       } catch (e) {
         let stacktrace = dart.stackTrace(e);
         return async.Future.error(e, stacktrace);
@@ -40065,7 +55265,7 @@
     get [dartx.transaction]() {
       return this.transaction;
     }
-    [_add$2](value, key) {
+    [_add$3](value, key) {
       if (key === void 0) key = null;
       if (key != null) {
         let value_1 = html_common.convertDartToNative_SerializedScriptValue(value);
@@ -40101,7 +55301,7 @@
     [_createIndex_2](...args) {
       return this.createIndex.apply(this, args);
     }
-    [_delete](...args) {
+    [_delete$](...args) {
       return this.delete.apply(this, args);
     }
     [dartx.deleteIndex](...args) {
@@ -40155,7 +55355,7 @@
               cursor[dartx.next]();
             }
           }
-        }, EventTovoid$()));
+        }, EventToNull()));
         return controller.stream;
       };
     }
@@ -40178,7 +55378,7 @@
       [dartx.getObject]: dart.definiteFunctionType(async.Future, [dart.dynamic]),
       [dartx.openCursor]: dart.definiteFunctionType(async.Stream$(indexed_db.CursorWithValue), [], {key: dart.dynamic, range: indexed_db.KeyRange, direction: core.String, autoAdvance: core.bool}),
       [dartx.createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, dart.dynamic], {unique: core.bool, multiEntry: core.bool}),
-      [_add$2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
+      [_add$3]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
       [_add_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic, dart.dynamic]),
       [_add_2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
       [_clear$0]: dart.definiteFunctionType(indexed_db.Request, []),
@@ -40186,7 +55386,7 @@
       [_createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, core.Object], [core.Map]),
       [_createIndex_1]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic, dart.dynamic]),
       [_createIndex_2]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic]),
-      [_delete]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
+      [_delete$]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
       [dartx.deleteIndex]: dart.definiteFunctionType(dart.void, [core.String]),
       [_get$]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
       [dartx.getAll]: dart.definiteFunctionType(indexed_db.Request, [core.Object], [core.int]),
@@ -40328,15 +55528,15 @@
       let completer = CompleterOfDatabase().new();
       this[dartx.onComplete].first.then(dart.dynamic)(dart.fn(_ => {
         completer.complete(this[dartx.db]);
-      }, EventTodynamic()));
+      }, EventToNull()));
       this[dartx.onError].first.then(dart.dynamic)(dart.fn(e => {
         completer.completeError(e);
-      }, EventTodynamic()));
+      }, EventToNull()));
       this[dartx.onAbort].first.then(dart.dynamic)(dart.fn(e => {
         if (!dart.test(completer.isCompleted)) {
           completer.completeError(e);
         }
-      }, EventTodynamic()));
+      }, EventToNull()));
       return completer.future;
     }
     static _() {
@@ -40467,10 +55667,10 @@
       return html$.Event._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new Event(type, eventInitDict);
+      return new self.Event(type, eventInitDict);
     }
     static _create_2(type) {
-      return new Event(type);
+      return new self.Event(type);
     }
     get [dartx.bubbles]() {
       return this.bubbles;
@@ -43177,10 +58377,10 @@
       return html$.AnimationEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new AnimationEvent(type, eventInitDict);
+      return new self.AnimationEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new AnimationEvent(type);
+      return new self.AnimationEvent(type);
     }
     get [dartx.animationName]() {
       return this.animationName;
@@ -43222,10 +58422,10 @@
       return html$.AnimationPlayerEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new AnimationPlayerEvent(type, eventInitDict);
+      return new self.AnimationPlayerEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new AnimationPlayerEvent(type);
+      return new self.AnimationPlayerEvent(type);
     }
     get [dartx.currentTime]() {
       return this.currentTime;
@@ -43462,10 +58662,10 @@
       return html$.ApplicationCacheErrorEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ApplicationCacheErrorEvent(type, eventInitDict);
+      return new self.ApplicationCacheErrorEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ApplicationCacheErrorEvent(type);
+      return new self.ApplicationCacheErrorEvent(type);
     }
     get [dartx.message]() {
       return this.message;
@@ -44166,10 +59366,10 @@
       return html$.AutocompleteErrorEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new AutocompleteErrorEvent(type, eventInitDict);
+      return new self.AutocompleteErrorEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new AutocompleteErrorEvent(type);
+      return new self.AutocompleteErrorEvent(type);
     }
     get [dartx.reason]() {
       return this.reason;
@@ -44317,10 +59517,10 @@
       return html$.BeforeInstallPromptEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new BeforeInstallPromptEvent(type, eventInitDict);
+      return new self.BeforeInstallPromptEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new BeforeInstallPromptEvent(type);
+      return new self.BeforeInstallPromptEvent(type);
     }
     get [dartx.platforms]() {
       return this.platforms;
@@ -44402,10 +59602,10 @@
       return html$.Blob._check(html$.Blob._create_2(blobParts, bag));
     }
     static _create_1(parts) {
-      return new Blob(parts);
+      return new self.Blob(parts);
     }
     static _create_2(parts, bag) {
-      return new Blob(parts, bag);
+      return new self.Blob(parts, bag);
     }
     static _create_bag() {
       return {};
@@ -45891,7 +61091,7 @@
       return html$.CircularGeofencingRegion._create_1(init_1);
     }
     static _create_1(init) {
-      return new CircularGeofencingRegion(init);
+      return new self.CircularGeofencingRegion(init);
     }
     get [dartx.latitude]() {
       return this.latitude;
@@ -46053,10 +61253,10 @@
       return html$.CloseEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new CloseEvent(type, eventInitDict);
+      return new self.CloseEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new CloseEvent(type);
+      return new self.CloseEvent(type);
     }
     get [dartx.code]() {
       return this.code;
@@ -46137,10 +61337,10 @@
       return html$.UIEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new UIEvent(type, eventInitDict);
+      return new self.UIEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new UIEvent(type);
+      return new self.UIEvent(type);
     }
     get [_charCode]() {
       return this.charCode;
@@ -46219,10 +61419,10 @@
       return html$.CompositionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new CompositionEvent(type, eventInitDict);
+      return new self.CompositionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new CompositionEvent(type);
+      return new self.CompositionEvent(type);
     }
     get [dartx.data]() {
       return this.data;
@@ -46261,7 +61461,7 @@
       return html$.CompositorProxy._create_1(element, attributeArray);
     }
     static _create_1(element, attributeArray) {
-      return new CompositorProxy(element, attributeArray);
+      return new self.CompositorProxy(element, attributeArray);
     }
     get [dartx.opacity]() {
       return this.opacity;
@@ -46327,7 +61527,7 @@
       return html$.CompositorWorker._create_1(scriptUrl);
     }
     static _create_1(scriptUrl) {
-      return new CompositorWorker(scriptUrl);
+      return new self.CompositorWorker(scriptUrl);
     }
     [dartx.postMessage](message, transfer) {
       if (transfer === void 0) transfer = null;
@@ -46473,9 +61673,9 @@
       let completer = CompleterOfFileSystem().new();
       this[_webkitRequestFileSystem](type, size, dart.fn(value => {
         completer.complete(value);
-      }, FileSystemTovoid()), dart.fn(error => {
+      }, FileSystemToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.requestFileSystemSync](...args) {
@@ -46491,9 +61691,9 @@
       let completer = CompleterOfEntry().new();
       this[_webkitResolveLocalFileSystemUrl](url, dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), dart.fn(error => {
+      }, EntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.atob](...args) {
@@ -47434,7 +62634,7 @@
   const _pageBreakAfter = Symbol('_pageBreakAfter');
   const _pageBreakBefore = Symbol('_pageBreakBefore');
   const _pageBreakInside = Symbol('_pageBreakInside');
-  const _position$0 = Symbol('_position');
+  const _position$1 = Symbol('_position');
   const _quotes = Symbol('_quotes');
   const _right = Symbol('_right');
   const _tableLayout = Symbol('_tableLayout');
@@ -52733,15 +67933,15 @@
       this.pageBreakInside = value;
     }
     get [dartx.position]() {
-      return this[_position$0];
+      return this[_position$1];
     }
     set [dartx.position](value) {
-      this[_position$0] = value == null ? '' : value;
+      this[_position$1] = value == null ? '' : value;
     }
-    get [_position$0]() {
+    get [_position$1]() {
       return this.position;
     }
-    set [_position$0](value) {
+    set [_position$1](value) {
       this.position = value;
     }
     get [dartx.quotes]() {
@@ -53009,7 +68209,7 @@
       [_pageBreakAfter]: core.String,
       [_pageBreakBefore]: core.String,
       [_pageBreakInside]: core.String,
-      [_position$0]: core.String,
+      [_position$1]: core.String,
       [_quotes]: core.String,
       [_right]: core.String,
       [_tableLayout]: core.String,
@@ -53951,10 +69151,10 @@
       return html$.CustomEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new CustomEvent(type, eventInitDict);
+      return new self.CustomEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new CustomEvent(type);
+      return new self.CustomEvent(type);
     }
     get [_detail]() {
       return html_common.convertNativeToDart_SerializedScriptValue(this[_get__detail]);
@@ -54133,7 +69333,7 @@
       let completer = CompleterOfString().new();
       this[_getAsString](dart.fn(value => {
         completer.complete(value);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     [dartx.getAsEntry](...args) {
@@ -54269,10 +69469,10 @@
       return html$.DefaultSessionStartEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new DefaultSessionStartEvent(type, eventInitDict);
+      return new self.DefaultSessionStartEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new DefaultSessionStartEvent(type);
+      return new self.DefaultSessionStartEvent(type);
     }
     get [dartx.session]() {
       return this.session;
@@ -54422,10 +69622,10 @@
       return html$.DeviceLightEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new DeviceLightEvent(type, eventInitDict);
+      return new self.DeviceLightEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new DeviceLightEvent(type);
+      return new self.DeviceLightEvent(type);
     }
     get [dartx.value]() {
       return this.value;
@@ -54675,9 +69875,9 @@
       let completer = CompleterOfEntry().new();
       this[_copyTo](parent, {name: name, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [_getMetadata](...args) {
@@ -54687,9 +69887,9 @@
       let completer = CompleterOfMetadata().new();
       this[_getMetadata](dart.fn(value => {
         completer.complete(value);
-      }, MetadataTovoid()), dart.fn(error => {
+      }, MetadataToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [_getParent](...args) {
@@ -54699,9 +69899,9 @@
       let completer = CompleterOfEntry().new();
       this[_getParent](dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), dart.fn(error => {
+      }, EntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [_moveTo](...args) {
@@ -54712,9 +69912,9 @@
       let completer = CompleterOfEntry().new();
       this[_moveTo](parent, {name: name, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [_remove$](...args) {
@@ -54724,9 +69924,9 @@
       let completer = async.Completer.new();
       this[_remove$](dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.toUrl](...args) {
@@ -54825,9 +70025,9 @@
       let completer = CompleterOfEntry().new();
       this[__getDirectory](path, {options: options, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [__getFile](path, opts) {
@@ -54869,9 +70069,9 @@
       let completer = CompleterOfEntry().new();
       this[__getFile](path, {options: options, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [_removeRecursively](...args) {
@@ -54881,9 +70081,9 @@
       let completer = async.Completer.new();
       this[_removeRecursively](dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
   };
@@ -54927,9 +70127,9 @@
       let completer = CompleterOfListOfEntry().new();
       this[_readEntries](dart.fn(value => {
         completer.complete(value);
-      }, ListOfEntryTovoid()), dart.fn(error => {
+      }, ListOfEntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
   };
@@ -54963,7 +70163,7 @@
   dart.registerExtension(dart.global.HTMLDivElement, html$.DivElement);
   const _body = Symbol('_body');
   const _get_window = Symbol('_get_window');
-  const _head$ = Symbol('_head');
+  const _head$0 = Symbol('_head');
   const _lastModified = Symbol('_lastModified');
   const _preferredStylesheetSet = Symbol('_preferredStylesheetSet');
   const _referrer = Symbol('_referrer');
@@ -55152,7 +70352,7 @@
     get [dartx.fullscreenEnabled]() {
       return this.fullscreenEnabled;
     }
-    get [_head$]() {
+    get [_head$0]() {
       return this.head;
     }
     get [dartx.hidden]() {
@@ -55598,7 +70798,7 @@
       [dartx.fonts]: html$.FontFaceSet,
       [dartx.fullscreenElement]: html$.Element,
       [dartx.fullscreenEnabled]: core.bool,
-      [_head$]: html$.HeadElement,
+      [_head$0]: html$.HeadElement,
       [dartx.hidden]: core.bool,
       [dartx.implementation]: html$.DomImplementation,
       [_lastModified]: core.String,
@@ -57095,17 +72295,11 @@
   html$.DomStringList[dart.implements] = () => [ListOfString()];
   dart.setSignature(html$.DomStringList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.DomStringList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(core.String, []),
-      [dartx.last]: dart.definiteFunctionType(core.String, []),
-      [dartx.single]: dart.definiteFunctionType(core.String, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(core.String, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
-      [dartx.elementAt]: dart.definiteFunctionType(core.String, [core.int]),
       [__getter__]: dart.definiteFunctionType(core.String, [core.int]),
       [dartx.item]: dart.definiteFunctionType(core.String, [core.int])
     })
@@ -57130,7 +72324,7 @@
   dart.registerExtension(dart.global.EffectModel, html$.EffectModel);
   const _childElements = Symbol('_childElements');
   const _element$ = Symbol('_element');
-  const _filter$ = Symbol('_filter');
+  const _filter$0 = Symbol('_filter');
   html$._ChildrenElementList = class _ChildrenElementList extends collection.ListBase$(html$.Element) {
     _wrap(element) {
       this[_childElements] = html$.HtmlCollection._check(element[_children]);
@@ -57179,12 +72373,12 @@
       dart.throw(new core.UnsupportedError('Cannot shuffle element lists'));
     }
     removeWhere(test) {
-      this[_filter$](test, false);
+      this[_filter$0](test, false);
     }
     retainWhere(test) {
-      this[_filter$](test, true);
+      this[_filter$0](test, true);
     }
-    [_filter$](test, retainMatching) {
+    [_filter$0](test, retainMatching) {
       let removed = null;
       if (dart.test(retainMatching)) {
         removed = this[_element$][dartx.children][dartx.where](dart.fn(e => !dart.test(test(e)), ElementTobool$()));
@@ -57274,10 +72468,6 @@
     }),
     getters: () => ({
       length: dart.definiteFunctionType(core.int, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(html$.Element), []),
-      first: dart.definiteFunctionType(html$.Element, []),
-      last: dart.definiteFunctionType(html$.Element, []),
-      single: dart.definiteFunctionType(html$.Element, []),
       rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
@@ -57285,18 +72475,7 @@
       _get: dart.definiteFunctionType(html$.Element, [core.int]),
       _set: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
       add: dart.definiteFunctionType(html$.Element, [html$.Element]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfElement()]),
-      sort: dart.definiteFunctionType(dart.void, [], [ElementAndElementToint()]),
-      removeWhere: dart.definiteFunctionType(dart.void, [ElementTobool()]),
-      retainWhere: dart.definiteFunctionType(dart.void, [ElementTobool()]),
-      [_filter$]: dart.definiteFunctionType(dart.void, [ElementTobool(), core.bool]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()], [core.int]),
-      replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html$.Element]),
-      insert: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
-      setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfElement()]),
-      removeAt: dart.definiteFunctionType(html$.Element, [core.int]),
-      removeLast: dart.definiteFunctionType(html$.Element, [])
+      [_filter$0]: dart.definiteFunctionType(dart.void, [ElementTobool(), core.bool])
     })
   });
   dart.defineExtensionMembers(html$._ChildrenElementList, [
@@ -57611,9 +72790,6 @@
       fields: () => ({[_nodeList]: ListOfNode()}),
       getters: () => ({
         length: dart.definiteFunctionType(core.int, []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, []),
         classes: dart.definiteFunctionType(html$.CssClassSet, []),
         style: dart.definiteFunctionType(html$.CssStyleDeclarationBase, []),
         contentEdge: dart.definiteFunctionType(html$.CssRect, []),
@@ -57697,8 +72873,7 @@
       }),
       methods: () => ({
         _get: dart.definiteFunctionType(E, [core.int]),
-        _set: dart.definiteFunctionType(dart.void, [core.int, E]),
-        sort: dart.definiteFunctionType(dart.void, [], [ComparatorOfE()])
+        _set: dart.definiteFunctionType(dart.void, [core.int, E])
       })
     });
     dart.defineExtensionMembers(_FrozenElementList, [
@@ -57727,19 +72902,19 @@
     statics: () => ({createElement_tag: dart.definiteFunctionType(dart.dynamic, [core.String, core.String])}),
     names: ['createElement_tag']
   });
-  const _value$1 = Symbol('_value');
+  const _value$2 = Symbol('_value');
   html$.ScrollAlignment = class ScrollAlignment extends core.Object {
     _internal(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
     }
     toString() {
-      return dart.str`ScrollAlignment.${this[_value$1]}`;
+      return dart.str`ScrollAlignment.${this[_value$2]}`;
     }
   };
   dart.defineNamedConstructor(html$.ScrollAlignment, '_internal');
   dart.setSignature(html$.ScrollAlignment, {
     constructors: () => ({_internal: dart.definiteFunctionType(html$.ScrollAlignment, [dart.dynamic])}),
-    fields: () => ({[_value$1]: dart.dynamic}),
+    fields: () => ({[_value$2]: dart.dynamic}),
     sfields: () => ({
       TOP: html$.ScrollAlignment,
       CENTER: html$.ScrollAlignment,
@@ -57864,10 +73039,10 @@
       return html$.ErrorEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ErrorEvent(type, eventInitDict);
+      return new self.ErrorEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ErrorEvent(type);
+      return new self.ErrorEvent(type);
     }
     get [dartx.colno]() {
       return this.colno;
@@ -57931,10 +73106,10 @@
       return html$.EventSource._create_2(url);
     }
     static _create_1(url, eventSourceInitDict) {
-      return new EventSource(url, eventSourceInitDict);
+      return new self.EventSource(url, eventSourceInitDict);
     }
     static _create_2(url) {
-      return new EventSource(url);
+      return new self.EventSource(url);
     }
     get [dartx.readyState]() {
       return this.readyState;
@@ -58056,10 +73231,10 @@
       return html$.ExtendableEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ExtendableEvent(type, eventInitDict);
+      return new self.ExtendableEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ExtendableEvent(type);
+      return new self.ExtendableEvent(type);
     }
     [dartx.waitUntil](...args) {
       return this.waitUntil.apply(this, args);
@@ -58091,7 +73266,7 @@
       return html$.FederatedCredential._create_1(data_1);
     }
     static _create_1(data) {
-      return new FederatedCredential(data);
+      return new self.FederatedCredential(data);
     }
     get [dartx.protocol]() {
       return this.protocol;
@@ -58131,10 +73306,10 @@
       return html$.FetchEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new FetchEvent(type, eventInitDict);
+      return new self.FetchEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new FetchEvent(type);
+      return new self.FetchEvent(type);
     }
     get [dartx.isReload]() {
       return this.isReload;
@@ -58278,10 +73453,10 @@
       return html$.File._create_2(fileBits, fileName);
     }
     static _create_1(fileBits, fileName, options) {
-      return new File(fileBits, fileName, options);
+      return new self.File(fileBits, fileName, options);
     }
     static _create_2(fileBits, fileName) {
-      return new File(fileBits, fileName);
+      return new self.File(fileBits, fileName);
     }
     get [dartx.lastModified]() {
       return this.lastModified;
@@ -58320,7 +73495,7 @@
   dart.registerExtension(dart.global.File, html$.File);
   html$._FileCallback = dart.typedef('_FileCallback', () => dart.functionType(dart.void, [html$.File]));
   const _createWriter = Symbol('_createWriter');
-  const _file = Symbol('_file');
+  const _file$ = Symbol('_file');
   dart.defineExtensionNames([
     'createWriter',
     'file'
@@ -58336,21 +73511,21 @@
       let completer = CompleterOfFileWriter().new();
       this[_createWriter](dart.fn(value => {
         completer.complete(value);
-      }, FileWriterTovoid()), dart.fn(error => {
+      }, FileWriterToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
-    [_file](...args) {
+    [_file$](...args) {
       return this.file.apply(this, args);
     }
     [dartx.file]() {
-      let completer = CompleterOfFile().new();
-      this[_file](dart.fn(value => {
+      let completer = CompleterOfFile$().new();
+      this[_file$](dart.fn(value => {
         completer.complete(value);
-      }, FileTovoid()), dart.fn(error => {
+      }, FileToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
   };
@@ -58359,7 +73534,7 @@
     methods: () => ({
       [_createWriter]: dart.definiteFunctionType(dart.void, [html$._FileWriterCallback], [html$._ErrorCallback]),
       [dartx.createWriter]: dart.definiteFunctionType(async.Future$(html$.FileWriter), []),
-      [_file]: dart.definiteFunctionType(dart.void, [html$._FileCallback], [html$._ErrorCallback]),
+      [_file$]: dart.definiteFunctionType(dart.void, [html$._FileCallback], [html$._ErrorCallback]),
       [dartx.file]: dart.definiteFunctionType(async.Future$(html$.File), [])
     })
   });
@@ -58466,17 +73641,11 @@
   html$.FileList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfFile()];
   dart.setSignature(html$.FileList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.FileList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.File, []),
-      [dartx.last]: dart.definiteFunctionType(html$.File, []),
-      [dartx.single]: dart.definiteFunctionType(html$.File, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.File, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.File]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.File, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.File, [core.int])
     })
   });
@@ -58511,7 +73680,7 @@
       return html$.FileReader._create_1();
     }
     static _create_1() {
-      return new FileReader();
+      return new self.FileReader();
     }
     get [dartx.error]() {
       return this.error;
@@ -58795,10 +73964,10 @@
       return html$.FocusEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new FocusEvent(type, eventInitDict);
+      return new self.FocusEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new FocusEvent(type);
+      return new self.FocusEvent(type);
     }
     get [dartx.relatedTarget]() {
       return html$._convertNativeToDart_EventTarget(this[_get_relatedTarget]);
@@ -58846,10 +74015,10 @@
       return html$.FontFace._create_2(family, source);
     }
     static _create_1(family, source, descriptors) {
-      return new FontFace(family, source, descriptors);
+      return new self.FontFace(family, source, descriptors);
     }
     static _create_2(family, source) {
-      return new FontFace(family, source);
+      return new self.FontFace(family, source);
     }
     get [dartx.family]() {
       return this.family;
@@ -59020,10 +74189,10 @@
       return html$.FormData._create_2();
     }
     static _create_1(form) {
-      return new FormData(form);
+      return new self.FormData(form);
     }
     static _create_2() {
-      return new FormData();
+      return new self.FormData();
     }
     static get supported() {
       return !!window.FormData;
@@ -59314,10 +74483,10 @@
       return html$.GamepadEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new GamepadEvent(type, eventInitDict);
+      return new self.GamepadEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new GamepadEvent(type);
+      return new self.GamepadEvent(type);
     }
     get [dartx.gamepad]() {
       return this.gamepad;
@@ -59420,9 +74589,9 @@
       try {
         this[_getCurrentPosition](dart.fn(position => {
           completer.complete(this[_ensurePosition](position));
-        }, GeopositionTovoid()), dart.fn(error => {
+        }, GeopositionToNull()), dart.fn(error => {
           completer.completeError(error);
-        }, PositionErrorTovoid()), options);
+        }, PositionErrorToNull()), options);
       } catch (e) {
         let stacktrace = dart.stackTrace(e);
         completer.completeError(e, stacktrace);
@@ -59450,13 +74619,13 @@
           dart.assert(watchId == null);
           watchId = this[_watchPosition](dart.fn(position => {
             controller.add(this[_ensurePosition](position));
-          }, GeopositionTovoid()), dart.fn(error => {
+          }, GeopositionToNull()), dart.fn(error => {
             controller.addError(error);
-          }, PositionErrorTovoid()), options);
-        }, VoidTovoid$()), onCancel: dart.fn(() => {
+          }, PositionErrorToNull()), options);
+        }, VoidToNull()), onCancel: dart.fn(() => {
           dart.assert(watchId != null);
           this[_clearWatch](watchId);
-        }, VoidTodynamic$())});
+        }, VoidToNull())});
       return controller.stream;
     }
     [_ensurePosition](domPosition) {
@@ -60164,7 +75333,7 @@
       let oldUrl = opts && 'oldUrl' in opts ? opts.oldUrl : null;
       let newUrl = opts && 'newUrl' in opts ? opts.newUrl : null;
       let options = dart.map({canBubble: canBubble, cancelable: cancelable, oldURL: oldUrl, newURL: newUrl}, core.String, core.Object);
-      return new HashChangeEvent(type, html_common.convertDartToNative_Dictionary(options));
+      return new self.HashChangeEvent(type, html_common.convertDartToNative_Dictionary(options));
     }
     static _(type, eventInitDict) {
       if (eventInitDict === void 0) eventInitDict = null;
@@ -60175,10 +75344,10 @@
       return html$.HashChangeEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new HashChangeEvent(type, eventInitDict);
+      return new self.HashChangeEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new HashChangeEvent(type);
+      return new self.HashChangeEvent(type);
     }
     static get supported() {
       return html_common.Device.isEventTypeSupported('HashChangeEvent');
@@ -60253,16 +75422,16 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1() {
-      return new Headers();
+      return new self.Headers();
     }
     static _create_2(input) {
-      return new Headers(input);
+      return new self.Headers(input);
     }
     static _create_3(input) {
-      return new Headers(input);
+      return new self.Headers(input);
     }
     static _create_4(input) {
-      return new Headers(input);
+      return new self.Headers(input);
     }
   };
   dart.setSignature(html$.Headers, {
@@ -60544,17 +75713,11 @@
   html$.HtmlCollection[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
   dart.setSignature(html$.HtmlCollection, {
     constructors: () => ({_: dart.definiteFunctionType(html$.HtmlCollection, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Node, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx.namedItem]: dart.definiteFunctionType(core.Object, [core.String])
     })
@@ -60603,7 +75766,7 @@
       return html$.CanvasRenderingContext._check(this[_getCssCanvasContext](contextId, name, width, height));
     }
     get [dartx.head]() {
-      return this[_head$];
+      return this[_head$0];
     }
     get [dartx.lastModified]() {
       return this[_lastModified];
@@ -60866,7 +76029,7 @@
       let parts = [];
       data[dartx.forEach](dart.fn((key, value) => {
         parts[dartx.add](dart.str`${core.Uri.encodeQueryComponent(key)}=` + dart.str`${core.Uri.encodeQueryComponent(value)}`);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
       let formData = parts[dartx.join]('&');
       if (requestHeaders == null) {
         requestHeaders = dart.map({}, core.String, core.String);
@@ -60900,7 +76063,7 @@
       if (requestHeaders != null) {
         requestHeaders[dartx.forEach](dart.fn((header, value) => {
           xhr[dartx.setRequestHeader](header, value);
-        }, StringAndStringTovoid$()));
+        }, StringAndStringToNull()));
       }
       if (onProgress != null) {
         xhr[dartx.onProgress].listen(onProgress);
@@ -60915,7 +76078,7 @@
         } else {
           completer.completeError(e);
         }
-      }, ProgressEventTovoid$()));
+      }, ProgressEventToNull()));
       xhr[dartx.onError].listen(dart.bind(completer, 'completeError'));
       if (sendData != null) {
         xhr[dartx.send](sendData);
@@ -60952,13 +76115,13 @@
       }
       let xhr = new XDomainRequest();
       xhr.open(method, url);
-      xhr.onload = _js_helper.convertDartClosureToJS(dynamicTodynamic())(dart.fn(e => {
+      xhr.onload = _js_helper.convertDartClosureToJS(dynamicToNull())(dart.fn(e => {
         let response = xhr.responseText;
         completer.complete(response);
-      }, dynamicTodynamic$()), 1);
-      xhr.onerror = _js_helper.convertDartClosureToJS(dynamicTodynamic())(dart.fn(e => {
+      }, dynamicToNull$()), 1);
+      xhr.onerror = _js_helper.convertDartClosureToJS(dynamicToNull())(dart.fn(e => {
         completer.completeError(e);
-      }, dynamicTodynamic$()), 1);
+      }, dynamicToNull$()), 1);
       xhr.onprogress = {};
       xhr.ontimeout = {};
       xhr.timeout = Number.MAX_VALUE;
@@ -61289,13 +76452,13 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1(data_OR_sw, sh_OR_sw) {
-      return new ImageData(data_OR_sw, sh_OR_sw);
+      return new self.ImageData(data_OR_sw, sh_OR_sw);
     }
     static _create_2(data_OR_sw, sh_OR_sw) {
-      return new ImageData(data_OR_sw, sh_OR_sw);
+      return new self.ImageData(data_OR_sw, sh_OR_sw);
     }
     static _create_3(data_OR_sw, sh_OR_sw, sh) {
-      return new ImageData(data_OR_sw, sh_OR_sw, sh);
+      return new self.ImageData(data_OR_sw, sh_OR_sw, sh);
     }
     get [dartx.data]() {
       return this.data;
@@ -61494,10 +76657,10 @@
       return html$.InputDevice._create_2();
     }
     static _create_1(deviceInitDict) {
-      return new InputDevice(deviceInitDict);
+      return new self.InputDevice(deviceInitDict);
     }
     static _create_2() {
-      return new InputDevice();
+      return new self.InputDevice();
     }
     get [dartx.firesTouchEvents]() {
       return this.firesTouchEvents;
@@ -63215,10 +78378,10 @@
       return html$.KeyboardEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new KeyboardEvent(type, eventInitDict);
+      return new self.KeyboardEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new KeyboardEvent(type);
+      return new self.KeyboardEvent(type);
     }
     get [dartx.altKey]() {
       return this.altKey;
@@ -63316,13 +78479,13 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1(target, keyframes) {
-      return new KeyframeEffect(target, keyframes);
+      return new self.KeyframeEffect(target, keyframes);
     }
     static _create_2(target, keyframes, timing) {
-      return new KeyframeEffect(target, keyframes, timing);
+      return new self.KeyframeEffect(target, keyframes, timing);
     }
     static _create_3(target, keyframes, timing) {
-      return new KeyframeEffect(target, keyframes, timing);
+      return new self.KeyframeEffect(target, keyframes, timing);
     }
   };
   dart.setSignature(html$.KeyframeEffect, {
@@ -63862,7 +79025,7 @@
       return html$.MediaController._create_1();
     }
     static _create_1() {
-      return new MediaController();
+      return new self.MediaController();
     }
     get [dartx.buffered]() {
       return this.buffered;
@@ -64028,10 +79191,10 @@
       return html$.MediaEncryptedEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaEncryptedEvent(type, eventInitDict);
+      return new self.MediaEncryptedEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaEncryptedEvent(type);
+      return new self.MediaEncryptedEvent(type);
     }
     get [dartx.initData]() {
       return this.initData;
@@ -64141,10 +79304,10 @@
       return html$.MediaKeyEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaKeyEvent(type, eventInitDict);
+      return new self.MediaKeyEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaKeyEvent(type);
+      return new self.MediaKeyEvent(type);
     }
     get [dartx.defaultUrl]() {
       return this.defaultURL;
@@ -64206,10 +79369,10 @@
       return html$.MediaKeyMessageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaKeyMessageEvent(type, eventInitDict);
+      return new self.MediaKeyMessageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaKeyMessageEvent(type);
+      return new self.MediaKeyMessageEvent(type);
     }
     get [dartx.message]() {
       return this.message;
@@ -64472,10 +79635,10 @@
       return html$.MediaQueryListEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaQueryListEvent(type, eventInitDict);
+      return new self.MediaQueryListEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaQueryListEvent(type);
+      return new self.MediaQueryListEvent(type);
     }
     get [dartx.matches]() {
       return this.matches;
@@ -64512,7 +79675,7 @@
       return html$.MediaSession._create_1();
     }
     static _create_1() {
-      return new MediaSession();
+      return new self.MediaSession();
     }
     [dartx.activate](...args) {
       return this.activate.apply(this, args);
@@ -64551,7 +79714,7 @@
       return html$.MediaSource._create_1();
     }
     static _create_1() {
-      return new MediaSource();
+      return new self.MediaSource();
     }
     static get supported() {
       return !!window.MediaSource;
@@ -64640,13 +79803,13 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1() {
-      return new MediaStream();
+      return new self.MediaStream();
     }
     static _create_2(stream_OR_tracks) {
-      return new MediaStream(stream_OR_tracks);
+      return new self.MediaStream(stream_OR_tracks);
     }
     static _create_3(stream_OR_tracks) {
-      return new MediaStream(stream_OR_tracks);
+      return new self.MediaStream(stream_OR_tracks);
     }
     get [dartx.active]() {
       return this.active;
@@ -64764,10 +79927,10 @@
       return html$.MediaStreamEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaStreamEvent(type, eventInitDict);
+      return new self.MediaStreamEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaStreamEvent(type);
+      return new self.MediaStreamEvent(type);
     }
     static get supported() {
       return html_common.Device.isEventTypeSupported('MediaStreamEvent');
@@ -64835,7 +79998,7 @@
       let completer = CompleterOfListOfSourceInfo().new();
       html$.MediaStreamTrack._getSources(dart.fn(value => {
         completer.complete(value);
-      }, ListOfSourceInfoTovoid()));
+      }, ListOfSourceInfoToNull()));
       return completer.future;
     }
     [dartx.stop](...args) {
@@ -65112,7 +80275,7 @@
         source = html$.window;
       }
       if (!dart.test(html_common.Device.isIE)) {
-        return new MessageEvent(type, {bubbles: canBubble, cancelable: cancelable, data: data, origin: origin, lastEventId: lastEventId, source: source, ports: messagePorts});
+        return new self.MessageEvent(type, {bubbles: canBubble, cancelable: cancelable, data: data, origin: origin, lastEventId: lastEventId, source: source, ports: messagePorts});
       }
       let event = html$.MessageEvent._check(html$.document[_createEvent]("MessageEvent"));
       event[_initMessageEvent](type, canBubble, cancelable, data, origin, lastEventId, source, messagePorts);
@@ -65133,10 +80296,10 @@
       return html$.MessageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MessageEvent(type, eventInitDict);
+      return new self.MessageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MessageEvent(type);
+      return new self.MessageEvent(type);
     }
     get [dartx.lastEventId]() {
       return this.lastEventId;
@@ -65738,17 +80901,11 @@
   html$.MimeTypeArray[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfMimeType()];
   dart.setSignature(html$.MimeTypeArray, {
     constructors: () => ({_: dart.definiteFunctionType(html$.MimeTypeArray, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.MimeType, []),
-      [dartx.last]: dart.definiteFunctionType(html$.MimeType, []),
-      [dartx.single]: dart.definiteFunctionType(html$.MimeType, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.MimeType, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.MimeType]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.MimeType, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.MimeType, [core.int]),
       [dartx.namedItem]: dart.definiteFunctionType(html$.MimeType, [core.String])
     })
@@ -65857,10 +81014,10 @@
       return html$.MouseEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MouseEvent(type, eventInitDict);
+      return new self.MouseEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MouseEvent(type);
+      return new self.MouseEvent(type);
     }
     get [dartx.altKey]() {
       return this.altKey;
@@ -66062,7 +81219,7 @@
       function override(key, value) {
         if (value != null) html$.MutationObserver._add(parsedOptions, core.String._check(key), value);
       }
-      dart.fn(override, dynamicAnddynamicTodynamic$());
+      dart.fn(override, dynamicAnddynamicToNull());
       override('childList', childList);
       override('attributes', attributes);
       override('characterData', characterData);
@@ -66088,7 +81245,7 @@
     }
     static new(callback) {
       0;
-      return new (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver)(_js_helper.convertDartClosureToJS(html$._wrapZoneBinaryCallback)(html$._wrapBinaryZone(dart.dynamic, dart.dynamic, dart.dynamic)(callback), 2));
+      return new (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver)(_js_helper.convertDartClosureToJS(_wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void())(html$._wrapBinaryZone(ListOfMutationRecord(), html$.MutationObserver, dart.void)(callback), 2));
     }
   };
   dart.setSignature(html$.MutationObserver, {
@@ -66228,9 +81385,9 @@
       this[_ensureGetUserMedia]();
       this[_getUserMedia](html_common.convertDartToNative_SerializedScriptValue(options), dart.fn(stream => {
         completer.complete(stream);
-      }, MediaStreamTovoid()), dart.fn(error => {
+      }, MediaStreamToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, NavigatorUserMediaErrorTovoid()));
+      }, NavigatorUserMediaErrorToNull()));
       return completer.future;
     }
     [_ensureGetUserMedia]() {
@@ -66720,7 +81877,7 @@
       this[_this][_removeChild](node);
       return true;
     }
-    [_filter$](test, removeMatching) {
+    [_filter$0](test, removeMatching) {
       let child = this[_this][dartx.firstChild];
       while (child != null) {
         let nextChild = child[dartx.nextNode];
@@ -66731,10 +81888,10 @@
       }
     }
     removeWhere(test) {
-      this[_filter$](test, true);
+      this[_filter$0](test, true);
     }
     retainWhere(test) {
-      this[_filter$](test, false);
+      this[_filter$0](test, false);
     }
     clear() {
       this[_this][_clearChildren]();
@@ -66781,29 +81938,13 @@
     constructors: () => ({new: dart.definiteFunctionType(html$._ChildNodeListLazy, [html$.Node])}),
     fields: () => ({[_this]: html$.Node}),
     getters: () => ({
-      first: dart.definiteFunctionType(html$.Node, []),
-      last: dart.definiteFunctionType(html$.Node, []),
-      single: dart.definiteFunctionType(html$.Node, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(html$.Node), []),
       length: dart.definiteFunctionType(core.int, []),
       rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
-      add: dart.definiteFunctionType(dart.void, [html$.Node]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfNode()]),
-      insert: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfNode()]),
-      setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfNode()]),
-      removeLast: dart.definiteFunctionType(html$.Node, []),
-      removeAt: dart.definiteFunctionType(html$.Node, [core.int]),
-      [_filter$]: dart.definiteFunctionType(dart.void, [NodeTobool(), core.bool]),
-      removeWhere: dart.definiteFunctionType(dart.void, [NodeTobool()]),
-      retainWhere: dart.definiteFunctionType(dart.void, [NodeTobool()]),
+      [_filter$0]: dart.definiteFunctionType(dart.void, [NodeTobool(), core.bool]),
       _set: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      sort: dart.definiteFunctionType(dart.void, [], [ComparatorOfNode()]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfNode()], [core.int]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html$.Node]),
       _get: dart.definiteFunctionType(html$.Node, [core.int])
     })
   });
@@ -66980,17 +82121,11 @@
   html$.NodeList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
   dart.setSignature(html$.NodeList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.NodeList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Node, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Node, [core.int]),
       [_item]: dart.definiteFunctionType(html$.Node, [core.int])
     })
   });
@@ -67079,10 +82214,10 @@
       return html$.Notification._create_2(title);
     }
     static _create_1(title, options) {
-      return new Notification(title, options);
+      return new self.Notification(title, options);
     }
     static _create_2(title) {
-      return new Notification(title);
+      return new self.Notification(title);
     }
     static get supported() {
       return !!window.Notification;
@@ -67124,7 +82259,7 @@
       let completer = CompleterOfString().new();
       html$.Notification._requestPermission(dart.fn(value => {
         completer.complete(value);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     get [dartx.onClick]() {
@@ -67211,10 +82346,10 @@
       return html$.NotificationEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new NotificationEvent(type, eventInitDict);
+      return new self.NotificationEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new NotificationEvent(type);
+      return new self.NotificationEvent(type);
     }
     get [dartx.notification]() {
       return this.notification;
@@ -67711,10 +82846,10 @@
       return html$.PageTransitionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PageTransitionEvent(type, eventInitDict);
+      return new self.PageTransitionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PageTransitionEvent(type);
+      return new self.PageTransitionEvent(type);
     }
     get [dartx.persisted]() {
       return this.persisted;
@@ -67829,13 +82964,13 @@
       return html$.PasswordCredential._create_3(id, password);
     }
     static _create_1(id, password, name, iconURL) {
-      return new PasswordCredential(id, password, name, iconURL);
+      return new self.PasswordCredential(id, password, name, iconURL);
     }
     static _create_2(id, password, name) {
-      return new PasswordCredential(id, password, name);
+      return new self.PasswordCredential(id, password, name);
     }
     static _create_3(id, password) {
-      return new PasswordCredential(id, password);
+      return new self.PasswordCredential(id, password);
     }
     get [dartx.formData]() {
       return this.formData;
@@ -68385,7 +83520,7 @@
       return html$.PeriodicSyncEvent._create_1(type, init_1);
     }
     static _create_1(type, init) {
-      return new PeriodicSyncEvent(type, init);
+      return new self.PeriodicSyncEvent(type, init);
     }
     get [dartx.registration]() {
       return this.registration;
@@ -68671,17 +83806,11 @@
   html$.PluginArray[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfPlugin()];
   dart.setSignature(html$.PluginArray, {
     constructors: () => ({_: dart.definiteFunctionType(html$.PluginArray, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Plugin, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Plugin, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Plugin, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Plugin, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Plugin]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Plugin, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Plugin, [core.int]),
       [dartx.namedItem]: dart.definiteFunctionType(html$.Plugin, [core.String]),
       [dartx.refresh]: dart.definiteFunctionType(dart.void, [core.bool])
@@ -68754,10 +83883,10 @@
       return html$.PointerEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PointerEvent(type, eventInitDict);
+      return new self.PointerEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PointerEvent(type);
+      return new self.PointerEvent(type);
     }
     get [dartx.height]() {
       return this.height;
@@ -68822,10 +83951,10 @@
       return html$.PopStateEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PopStateEvent(type, eventInitDict);
+      return new self.PopStateEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PopStateEvent(type);
+      return new self.PopStateEvent(type);
     }
     get [dartx.state]() {
       return html_common.convertNativeToDart_SerializedScriptValue(this[_get_state]);
@@ -69142,10 +84271,10 @@
       return html$.ProgressEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ProgressEvent(type, eventInitDict);
+      return new self.ProgressEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ProgressEvent(type);
+      return new self.ProgressEvent(type);
     }
     get [dartx.lengthComputable]() {
       return this.lengthComputable;
@@ -69191,10 +84320,10 @@
       return html$.PromiseRejectionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PromiseRejectionEvent(type, eventInitDict);
+      return new self.PromiseRejectionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PromiseRejectionEvent(type);
+      return new self.PromiseRejectionEvent(type);
     }
     get [dartx.promise]() {
       return this.promise;
@@ -69235,10 +84364,10 @@
       return html$.PushEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PushEvent(type, eventInitDict);
+      return new self.PushEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PushEvent(type);
+      return new self.PushEvent(type);
     }
     get [dartx.data]() {
       return this.data;
@@ -69329,7 +84458,7 @@
       return html$.PushMessageData._create_1(message);
     }
     static _create_1(message) {
-      return new PushMessageData(message);
+      return new self.PushMessageData(message);
     }
     [dartx.arrayBuffer](...args) {
       return this.arrayBuffer.apply(this, args);
@@ -69726,10 +84855,10 @@
       return html$.RelatedEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new RelatedEvent(type, eventInitDict);
+      return new self.RelatedEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new RelatedEvent(type);
+      return new self.RelatedEvent(type);
     }
     get [dartx.relatedTarget]() {
       return html$._convertNativeToDart_EventTarget(this[_get_relatedTarget]);
@@ -70145,9 +85274,9 @@
       let completer = CompleterOfRtcSessionDescription().new();
       this[_createOffer](dart.fn(value => {
         completer.complete(value);
-      }, RtcSessionDescriptionTovoid()), dart.fn(error => {
+      }, RtcSessionDescriptionToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()), mediaConstraints);
+      }, StringToNull()), mediaConstraints);
       return completer.future;
     }
     [dartx.createAnswer](mediaConstraints) {
@@ -70155,16 +85284,16 @@
       let completer = CompleterOfRtcSessionDescription().new();
       this[_createAnswer](dart.fn(value => {
         completer.complete(value);
-      }, RtcSessionDescriptionTovoid()), dart.fn(error => {
+      }, RtcSessionDescriptionToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()), mediaConstraints);
+      }, StringToNull()), mediaConstraints);
       return completer.future;
     }
     [dartx.getStats](selector) {
       let completer = CompleterOfRtcStatsResponse().new();
       this[_getStats](dart.fn(value => {
         completer.complete(value);
-      }, RtcStatsResponseTovoid()), selector);
+      }, RtcStatsResponseToNull()), selector);
       return completer.future;
     }
     static _() {
@@ -70280,9 +85409,9 @@
       let completer = async.Completer.new();
       this[_setLocalDescription](description, dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     [_setRemoteDescription](...args) {
@@ -70292,9 +85421,9 @@
       let completer = async.Completer.new();
       this[_setRemoteDescription](description, dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     [dartx.updateIce](configuration, mediaConstraints) {
@@ -70798,31 +85927,31 @@
       return html$.ScrollState._create_9();
     }
     static _create_1(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding);
     }
     static _create_2(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning);
     }
     static _create_3(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase);
     }
     static _create_4(deltaX, deltaY, deltaGranularity, velocityX, velocityY) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY);
     }
     static _create_5(deltaX, deltaY, deltaGranularity, velocityX) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX);
     }
     static _create_6(deltaX, deltaY, deltaGranularity) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity);
     }
     static _create_7(deltaX, deltaY) {
-      return new ScrollState(deltaX, deltaY);
+      return new self.ScrollState(deltaX, deltaY);
     }
     static _create_8(deltaX) {
-      return new ScrollState(deltaX);
+      return new self.ScrollState(deltaX);
     }
     static _create_9() {
-      return new ScrollState();
+      return new self.ScrollState();
     }
     get [dartx.deltaGranularity]() {
       return this.deltaGranularity;
@@ -70915,10 +86044,10 @@
       return html$.SecurityPolicyViolationEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new SecurityPolicyViolationEvent(type, eventInitDict);
+      return new self.SecurityPolicyViolationEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new SecurityPolicyViolationEvent(type);
+      return new self.SecurityPolicyViolationEvent(type);
     }
     get [dartx.blockedUri]() {
       return this.blockedURI;
@@ -71456,10 +86585,10 @@
       return html$.ServicePortConnectEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ServicePortConnectEvent(type, eventInitDict);
+      return new self.ServicePortConnectEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ServicePortConnectEvent(type);
+      return new self.ServicePortConnectEvent(type);
     }
     get [dartx.origin]() {
       return this.origin;
@@ -71622,10 +86751,10 @@
       return html$.ServiceWorkerMessageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ServiceWorkerMessageEvent(type, eventInitDict);
+      return new self.ServiceWorkerMessageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ServiceWorkerMessageEvent(type);
+      return new self.ServiceWorkerMessageEvent(type);
     }
     get [dartx.lastEventId]() {
       return this.lastEventId;
@@ -71937,10 +87066,10 @@
       return html$.SharedWorker._create_2(scriptURL);
     }
     static _create_1(scriptURL, name) {
-      return new SharedWorker(scriptURL, name);
+      return new self.SharedWorker(scriptURL, name);
     }
     static _create_2(scriptURL) {
-      return new SharedWorker(scriptURL);
+      return new self.SharedWorker(scriptURL);
     }
     get [dartx.port]() {
       return this.port;
@@ -72153,17 +87282,11 @@
   html$.SourceBufferList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfSourceBuffer()];
   dart.setSignature(html$.SourceBufferList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.SourceBufferList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.SourceBuffer, []),
-      [dartx.last]: dart.definiteFunctionType(html$.SourceBuffer, []),
-      [dartx.single]: dart.definiteFunctionType(html$.SourceBuffer, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.SourceBuffer, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.SourceBuffer]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.SourceBuffer, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.SourceBuffer, [core.int])
     })
   });
@@ -72302,7 +87425,7 @@
       return html$.SpeechGrammar._create_1();
     }
     static _create_1() {
-      return new SpeechGrammar();
+      return new self.SpeechGrammar();
     }
     get [dartx.src]() {
       return this.src;
@@ -72351,7 +87474,7 @@
       return html$.SpeechGrammarList._create_1();
     }
     static _create_1() {
-      return new SpeechGrammarList();
+      return new self.SpeechGrammarList();
     }
     get [dartx.length]() {
       return this.length;
@@ -72407,17 +87530,11 @@
       _: dart.definiteFunctionType(html$.SpeechGrammarList, []),
       new: dart.definiteFunctionType(html$.SpeechGrammarList, [])
     }),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.SpeechGrammar, []),
-      [dartx.last]: dart.definiteFunctionType(html$.SpeechGrammar, []),
-      [dartx.single]: dart.definiteFunctionType(html$.SpeechGrammar, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.SpeechGrammar, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.SpeechGrammar]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.SpeechGrammar, [core.int]),
       [dartx.addFromString]: dart.definiteFunctionType(dart.void, [core.String], [core.num]),
       [dartx.addFromUri]: dart.definiteFunctionType(dart.void, [core.String], [core.num]),
       [dartx.item]: dart.definiteFunctionType(html$.SpeechGrammar, [core.int])
@@ -72667,10 +87784,10 @@
       return html$.SpeechRecognitionError._create_2(type);
     }
     static _create_1(type, initDict) {
-      return new SpeechRecognitionError(type, initDict);
+      return new self.SpeechRecognitionError(type, initDict);
     }
     static _create_2(type) {
-      return new SpeechRecognitionError(type);
+      return new self.SpeechRecognitionError(type);
     }
     get [dartx.error]() {
       return this.error;
@@ -72714,10 +87831,10 @@
       return html$.SpeechRecognitionEvent._create_2(type);
     }
     static _create_1(type, initDict) {
-      return new SpeechRecognitionEvent(type, initDict);
+      return new self.SpeechRecognitionEvent(type, initDict);
     }
     static _create_2(type) {
-      return new SpeechRecognitionEvent(type);
+      return new self.SpeechRecognitionEvent(type);
     }
     get [dartx.emma]() {
       return this.emma;
@@ -72893,10 +88010,10 @@
       return html$.SpeechSynthesisUtterance._create_2();
     }
     static _create_1(text) {
-      return new SpeechSynthesisUtterance(text);
+      return new self.SpeechSynthesisUtterance(text);
     }
     static _create_2() {
-      return new SpeechSynthesisUtterance();
+      return new self.SpeechSynthesisUtterance();
     }
     get [dartx.lang]() {
       return this.lang;
@@ -73102,7 +88219,7 @@
   const _setItem = Symbol('_setItem');
   const _removeItem = Symbol('_removeItem');
   const _key = Symbol('_key');
-  const _length$2 = Symbol('_length');
+  const _length$3 = Symbol('_length');
   const __delete__ = Symbol('__delete__');
   dart.defineExtensionNames([
     'addAll',
@@ -73124,7 +88241,7 @@
     [dartx.addAll](other) {
       other[dartx.forEach](dart.fn((k, v) => {
         this[dartx._set](k, v);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     [dartx.containsValue](value) {
       return this[dartx.values][dartx.any](dart.fn(e => dart.equals(e, value), StringTobool$()));
@@ -73169,7 +88286,7 @@
       return values;
     }
     get [dartx.length]() {
-      return this[_length$2];
+      return this[_length$3];
     }
     get [dartx.isEmpty]() {
       return this[_key](0) == null;
@@ -73180,7 +88297,7 @@
     static _() {
       dart.throw(new core.UnsupportedError("Not supported"));
     }
-    get [_length$2]() {
+    get [_length$3]() {
       return this.length;
     }
     [__delete__](...args) {
@@ -73211,7 +88328,7 @@
   html$.Storage[dart.implements] = () => [MapOfString$String()];
   dart.setSignature(html$.Storage, {
     constructors: () => ({_: dart.definiteFunctionType(html$.Storage, [])}),
-    fields: () => ({[_length$2]: core.int}),
+    fields: () => ({[_length$3]: core.int}),
     getters: () => ({
       [dartx.keys]: dart.definiteFunctionType(core.Iterable$(core.String), []),
       [dartx.values]: dart.definiteFunctionType(core.Iterable$(core.String), []),
@@ -73271,10 +88388,10 @@
       return html$.StorageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new StorageEvent(type, eventInitDict);
+      return new self.StorageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new StorageEvent(type);
+      return new self.StorageEvent(type);
     }
     get [dartx.key]() {
       return this.key;
@@ -73459,7 +88576,7 @@
       return html$.SyncEvent._create_1(type, init_1);
     }
     static _create_1(type, init) {
-      return new SyncEvent(type, init);
+      return new self.SyncEvent(type, init);
     }
     get [dartx.registration]() {
       return this.registration;
@@ -74615,17 +89732,11 @@
   html$.TextTrackCueList[dart.implements] = () => [ListOfTextTrackCue(), _js_helper.JavaScriptIndexingBehavior];
   dart.setSignature(html$.TextTrackCueList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.TextTrackCueList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.TextTrackCue, []),
-      [dartx.last]: dart.definiteFunctionType(html$.TextTrackCue, []),
-      [dartx.single]: dart.definiteFunctionType(html$.TextTrackCue, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.TextTrackCue, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.TextTrackCue]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.TextTrackCue, [core.int]),
       [dartx.getCueById]: dart.definiteFunctionType(html$.TextTrackCue, [core.String]),
       [dartx.item]: dart.definiteFunctionType(html$.TextTrackCue, [core.int])
     })
@@ -74705,9 +89816,6 @@
     constructors: () => ({_: dart.definiteFunctionType(html$.TextTrackList, [])}),
     getters: () => ({
       [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.TextTrack, []),
-      [dartx.last]: dart.definiteFunctionType(html$.TextTrack, []),
-      [dartx.single]: dart.definiteFunctionType(html$.TextTrack, []),
       [dartx.onAddTrack]: dart.definiteFunctionType(async.Stream$(html$.TrackEvent), []),
       [dartx.onChange]: dart.definiteFunctionType(async.Stream$(html$.Event), [])
     }),
@@ -74715,7 +89823,6 @@
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.TextTrack, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.TextTrack]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.TextTrack, [core.int]),
       [dartx.getTrackById]: dart.definiteFunctionType(html$.TextTrack, [core.String]),
       [dartx.item]: dart.definiteFunctionType(html$.TextTrack, [core.int])
     }),
@@ -75066,17 +90173,11 @@
       new: dart.definiteFunctionType(html$.TouchList, []),
       _: dart.definiteFunctionType(html$.TouchList, [])
     }),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Touch, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Touch, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Touch, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Touch, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Touch]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Touch, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Touch, [core.int])
     }),
     sgetters: () => ({supported: dart.definiteFunctionType(core.bool, [])})
@@ -75103,10 +90204,10 @@
       return html$.TrackDefault._create_2(type, language, label, kinds_1);
     }
     static _create_1(type, language, label, kinds, byteStreamTrackID) {
-      return new TrackDefault(type, language, label, kinds, byteStreamTrackID);
+      return new self.TrackDefault(type, language, label, kinds, byteStreamTrackID);
     }
     static _create_2(type, language, label, kinds) {
-      return new TrackDefault(type, language, label, kinds);
+      return new self.TrackDefault(type, language, label, kinds);
     }
     get [dartx.byteStreamTrackID]() {
       return this.byteStreamTrackID;
@@ -75159,10 +90260,10 @@
       return html$.TrackDefaultList._create_2();
     }
     static _create_1(trackDefaults) {
-      return new TrackDefaultList(trackDefaults);
+      return new self.TrackDefaultList(trackDefaults);
     }
     static _create_2() {
-      return new TrackDefaultList();
+      return new self.TrackDefaultList();
     }
     get [dartx.length]() {
       return this.length;
@@ -75296,10 +90397,10 @@
       return html$.TrackEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new TrackEvent(type, eventInitDict);
+      return new self.TrackEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new TrackEvent(type);
+      return new self.TrackEvent(type);
     }
     get [dartx.track]() {
       return this.track;
@@ -75336,10 +90437,10 @@
       return html$.TransitionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new TransitionEvent(type, eventInitDict);
+      return new self.TransitionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new TransitionEvent(type);
+      return new self.TransitionEvent(type);
     }
     get [dartx.elapsedTime]() {
       return this.elapsedTime;
@@ -75910,10 +91011,10 @@
       return html$.VRFieldOfView._create_2();
     }
     static _create_1(fov) {
-      return new VRFieldOfView(fov);
+      return new self.VRFieldOfView(fov);
     }
     static _create_2() {
-      return new VRFieldOfView();
+      return new self.VRFieldOfView();
     }
     get [dartx.downDegrees]() {
       return this.downDegrees;
@@ -76531,10 +91632,10 @@
       return html$.WebSocket._create_2(url);
     }
     static _create_1(url, protocols) {
-      return new WebSocket(url, protocols);
+      return new self.WebSocket(url, protocols);
     }
     static _create_2(url) {
-      return new WebSocket(url);
+      return new self.WebSocket(url);
     }
     static get supported() {
       return typeof window.WebSocket != "undefined";
@@ -76692,7 +91793,7 @@
       if (view == null) {
         view = html$.window;
       }
-      return new WheelEvent(type, html_common.convertDartToNative_Dictionary(options));
+      return new self.WheelEvent(type, html_common.convertDartToNative_Dictionary(options));
     }
     static _(type, eventInitDict) {
       if (eventInitDict === void 0) eventInitDict = null;
@@ -76703,10 +91804,10 @@
       return html$.WheelEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new WheelEvent(type, eventInitDict);
+      return new self.WheelEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new WheelEvent(type);
+      return new self.WheelEvent(type);
     }
     get [_deltaX]() {
       return this.deltaX;
@@ -76976,7 +92077,7 @@
       let completer = CompleterOfnum().sync();
       this[dartx.requestAnimationFrame](dart.fn(time => {
         completer.complete(time);
-      }, numTovoid()));
+      }, numToNull()));
       return completer.future;
     }
     get [dartx.document]() {
@@ -77431,9 +92532,9 @@
       let completer = CompleterOfFileSystem().new();
       this[__requestFileSystem](type, size, dart.fn(value => {
         completer.complete(value);
-      }, FileSystemTovoid()), dart.fn(error => {
+      }, FileSystemToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [_resolveLocalFileSystemUrl](...args) {
@@ -77443,9 +92544,9 @@
       let completer = CompleterOfEntry().new();
       this[_resolveLocalFileSystemUrl](url, dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), dart.fn(error => {
+      }, EntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.atob](...args) {
@@ -78130,12 +93231,12 @@
     }
     forTarget(e, opts) {
       let useCapture = opts && 'useCapture' in opts ? opts.useCapture : false;
-      let stream = new (_EventStreamOfEvent())(e, this[_eventType], useCapture);
+      let stream = new (_EventStreamOfBeforeUnloadEvent())(e, this[_eventType], useCapture);
       let controller = StreamControllerOfBeforeUnloadEvent().new({sync: true});
       stream.listen(dart.fn(event => {
         let wrapped = new html$._BeforeUnloadEvent(event);
         controller.add(wrapped);
-      }, EventTovoid$()));
+      }, BeforeUnloadEventToNull()));
       return controller.stream;
     }
     getEventType(target) {
@@ -78299,7 +93400,7 @@
       return html$.Worker._create_1(scriptUrl);
     }
     static _create_1(scriptUrl) {
-      return new Worker(scriptUrl);
+      return new self.Worker(scriptUrl);
     }
     static get supported() {
       return typeof window.Worker != "undefined";
@@ -78454,7 +93555,7 @@
       return html$.XPathEvaluator._create_1();
     }
     static _create_1() {
-      return new XPathEvaluator();
+      return new self.XPathEvaluator();
     }
     [dartx.createExpression](...args) {
       return this.createExpression.apply(this, args);
@@ -78950,17 +94051,11 @@
   html$._ClientRectList[dart.implements] = () => [ListOfRectangleOfnum()];
   dart.setSignature(html$._ClientRectList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._ClientRectList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(math.Rectangle$(core.num), []),
-      [dartx.last]: dart.definiteFunctionType(math.Rectangle$(core.num), []),
-      [dartx.single]: dart.definiteFunctionType(math.Rectangle$(core.num), [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, RectangleOfnum()]),
-      [dartx.elementAt]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
       [__getter__]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
       [dartx.item]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int])
     })
@@ -79027,17 +94122,11 @@
   html$._CssRuleList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfCssRule()];
   dart.setSignature(html$._CssRuleList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._CssRuleList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.CssRule, []),
-      [dartx.last]: dart.definiteFunctionType(html$.CssRule, []),
-      [dartx.single]: dart.definiteFunctionType(html$.CssRule, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.CssRule, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.CssRule]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.CssRule, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.CssRule, [core.int])
     })
   });
@@ -79280,17 +94369,11 @@
   html$._GamepadList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfGamepad()];
   dart.setSignature(html$._GamepadList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._GamepadList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Gamepad, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Gamepad, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Gamepad, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Gamepad, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Gamepad]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Gamepad, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Gamepad, [core.int])
     })
   });
@@ -79489,17 +94572,11 @@
   html$._NamedNodeMap[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
   dart.setSignature(html$._NamedNodeMap, {
     constructors: () => ({_: dart.definiteFunctionType(html$._NamedNodeMap, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Node, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx.getNamedItem]: dart.definiteFunctionType(html$._Attr, [core.String]),
       [dartx.getNamedItemNS]: dart.definiteFunctionType(html$._Attr, [core.String, core.String]),
       [dartx.item]: dart.definiteFunctionType(html$._Attr, [core.int]),
@@ -79699,17 +94776,11 @@
   html$._SpeechRecognitionResultList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfSpeechRecognitionResult()];
   dart.setSignature(html$._SpeechRecognitionResultList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._SpeechRecognitionResultList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.SpeechRecognitionResult, []),
-      [dartx.last]: dart.definiteFunctionType(html$.SpeechRecognitionResult, []),
-      [dartx.single]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.SpeechRecognitionResult]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [core.int])
     })
   });
@@ -79777,17 +94848,11 @@
   html$._StyleSheetList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfStyleSheet()];
   dart.setSignature(html$._StyleSheetList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._StyleSheetList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.StyleSheet, []),
-      [dartx.last]: dart.definiteFunctionType(html$.StyleSheet, []),
-      [dartx.single]: dart.definiteFunctionType(html$.StyleSheet, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.StyleSheet, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.StyleSheet]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.StyleSheet, [core.int]),
       [__getter__]: dart.definiteFunctionType(html$.CssStyleSheet, [core.String]),
       [dartx.item]: dart.definiteFunctionType(html$.StyleSheet, [core.int])
     })
@@ -79877,7 +94942,7 @@
     addAll(other) {
       other[dartx.forEach](dart.fn((k, v) => {
         this._set(k, v);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     containsValue(value) {
       for (let v of this.values) {
@@ -80064,7 +95129,7 @@
     addAll(other) {
       other[dartx.forEach](dart.fn((k, v) => {
         this._set(k, v);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     containsValue(value) {
       return this.values[dartx.any](dart.fn(v => dart.equals(v, value), StringTobool$()));
@@ -80095,7 +95160,7 @@
         if (dart.test(this[_matches](key))) {
           f(this[_strip](key), value);
         }
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     get keys() {
       let keys = JSArrayOfString().of([]);
@@ -80103,7 +95168,7 @@
         if (dart.test(this[_matches](key))) {
           keys[dartx.add](this[_strip](key));
         }
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
       return keys;
     }
     get values() {
@@ -80112,7 +95177,7 @@
         if (dart.test(this[_matches](key))) {
           values[dartx.add](value);
         }
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
       return values;
     }
     get length() {
@@ -81000,43 +96065,43 @@
   const _unit = Symbol('_unit');
   html$.Dimension = class Dimension extends core.Object {
     percent(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = '%';
     }
     px(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'px';
     }
     pc(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'pc';
     }
     pt(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'pt';
     }
     inch(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'in';
     }
     cm(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'cm';
     }
     mm(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'mm';
     }
     em(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'em';
     }
     ex(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'ex';
     }
     css(cssValue) {
-      this[_value$1] = null;
+      this[_value$2] = null;
       this[_unit] = null;
       if (cssValue == '') cssValue = '0px';
       if (dart.test(cssValue[dartx.endsWith]('%'))) {
@@ -81045,16 +96110,16 @@
         this[_unit] = cssValue[dartx.substring](dart.notNull(cssValue[dartx.length]) - 2);
       }
       if (dart.test(cssValue[dartx.contains]('.'))) {
-        this[_value$1] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+        this[_value$2] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
       } else {
-        this[_value$1] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+        this[_value$2] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
       }
     }
     toString() {
-      return dart.str`${this[_value$1]}${this[_unit]}`;
+      return dart.str`${this[_value$2]}${this[_unit]}`;
     }
     get value() {
-      return this[_value$1];
+      return this[_value$2];
     }
   };
   dart.defineNamedConstructor(html$.Dimension, 'percent');
@@ -81081,7 +96146,7 @@
       css: dart.definiteFunctionType(html$.Dimension, [core.String])
     }),
     fields: () => ({
-      [_value$1]: core.num,
+      [_value$2]: core.num,
       [_unit]: core.String
     }),
     getters: () => ({value: dart.definiteFunctionType(core.num, [])})
@@ -81133,7 +96198,7 @@
     return ElementStream;
   });
   html$.ElementStream = ElementStream();
-  const _target$ = Symbol('_target');
+  const _target$0 = Symbol('_target');
   const _useCapture = Symbol('_useCapture');
   html$._EventStream$ = dart.generic(T => {
     let _EventStreamSubscriptionOfT = () => (_EventStreamSubscriptionOfT = dart.constFn(html$._EventStreamSubscription$(T)))();
@@ -81142,7 +96207,7 @@
     let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     class _EventStream extends async.Stream$(T) {
       new(target, eventType, useCapture) {
-        this[_target$] = target;
+        this[_target$0] = target;
         this[_eventType] = eventType;
         this[_useCapture] = useCapture;
         super.new();
@@ -81159,20 +96224,17 @@
         let onError = opts && 'onError' in opts ? opts.onError : null;
         let onDone = opts && 'onDone' in opts ? opts.onDone : null;
         let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
-        return new (_EventStreamSubscriptionOfT())(this[_target$], this[_eventType], onData, this[_useCapture]);
+        return new (_EventStreamSubscriptionOfT())(this[_target$0], this[_eventType], onData, this[_useCapture]);
       }
     }
     dart.setSignature(_EventStream, {
       constructors: () => ({new: dart.definiteFunctionType(html$._EventStream$(T), [html$.EventTarget, core.String, core.bool])}),
       fields: () => ({
-        [_target$]: html$.EventTarget,
+        [_target$0]: html$.EventTarget,
         [_eventType]: core.String,
         [_useCapture]: core.bool
       }),
-      methods: () => ({
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
-        listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})
-      })
+      methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
     });
     return _EventStream;
   });
@@ -81199,7 +96261,7 @@
         }, TToT()));
       }
       capture(onData) {
-        return new (_EventStreamSubscriptionOfT())(this[_target$], this[_eventType], onData, true);
+        return new (_EventStreamSubscriptionOfT())(this[_target$0], this[_eventType], onData, true);
       }
     }
     _ElementEventStreamImpl[dart.implements] = () => [ElementStreamOfT()];
@@ -81273,8 +96335,7 @@
       methods: () => ({
         matches: dart.definiteFunctionType(async.Stream$(T), [core.String]),
         listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
-        capture: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()]),
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()})
+        capture: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()])
       })
     });
     return _ElementListEventStreamImpl;
@@ -81285,8 +96346,8 @@
     return _EventListener;
   });
   html$._EventListener = _EventListener();
-  const _onData$ = Symbol('_onData');
-  const _pauseCount$ = Symbol('_pauseCount');
+  const _onData$0 = Symbol('_onData');
+  const _pauseCount$0 = Symbol('_pauseCount');
   const _tryResume = Symbol('_tryResume');
   const _canceled = Symbol('_canceled');
   const _unlisten = Symbol('_unlisten');
@@ -81294,29 +96355,29 @@
     let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     class _EventStreamSubscription extends async.StreamSubscription$(T) {
       new(target, eventType, onData, useCapture) {
-        this[_target$] = target;
+        this[_target$0] = target;
         this[_eventType] = eventType;
         this[_useCapture] = useCapture;
-        this[_onData$] = html$._wrapZone(html$.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(onData));
-        this[_pauseCount$] = 0;
+        this[_onData$0] = onData == null ? null : html$._wrapZone(html$.Event, dart.dynamic)(dart.fn(e => dart.dcall(onData, e), EventTodynamic()));
+        this[_pauseCount$0] = 0;
         this[_tryResume]();
       }
       cancel() {
         if (dart.test(this[_canceled])) return null;
         this[_unlisten]();
-        this[_target$] = null;
-        this[_onData$] = null;
+        this[_target$0] = null;
+        this[_onData$0] = null;
         return null;
       }
       get [_canceled]() {
-        return this[_target$] == null;
+        return this[_target$0] == null;
       }
       onData(handleData) {
         if (dart.test(this[_canceled])) {
           dart.throw(new core.StateError("Subscription has been canceled."));
         }
         this[_unlisten]();
-        this[_onData$] = html$._wrapZone(html$.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(handleData));
+        this[_onData$0] = html$._wrapZone(html$.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(handleData));
         this[_tryResume]();
       }
       onError(handleError) {}
@@ -81324,43 +96385,45 @@
       pause(resumeSignal) {
         if (resumeSignal === void 0) resumeSignal = null;
         if (dart.test(this[_canceled])) return;
-        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) + 1;
+        this[_pauseCount$0] = dart.notNull(this[_pauseCount$0]) + 1;
         this[_unlisten]();
         if (resumeSignal != null) {
           resumeSignal.whenComplete(dart.bind(this, 'resume'));
         }
       }
       get isPaused() {
-        return dart.notNull(this[_pauseCount$]) > 0;
+        return dart.notNull(this[_pauseCount$0]) > 0;
       }
       resume() {
         if (dart.test(this[_canceled]) || !dart.test(this.isPaused)) return;
-        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) - 1;
+        this[_pauseCount$0] = dart.notNull(this[_pauseCount$0]) - 1;
         this[_tryResume]();
       }
       [_tryResume]() {
-        if (this[_onData$] != null && !dart.test(this.isPaused)) {
-          this[_target$][dartx.addEventListener](this[_eventType], this[_onData$], this[_useCapture]);
+        if (this[_onData$0] != null && !dart.test(this.isPaused)) {
+          this[_target$0][dartx.addEventListener](this[_eventType], this[_onData$0], this[_useCapture]);
         }
       }
       [_unlisten]() {
-        if (this[_onData$] != null) {
-          this[_target$][dartx.removeEventListener](this[_eventType], this[_onData$], this[_useCapture]);
+        if (this[_onData$0] != null) {
+          this[_target$0][dartx.removeEventListener](this[_eventType], this[_onData$0], this[_useCapture]);
         }
       }
-      asFuture(futureValue) {
-        if (futureValue === void 0) futureValue = null;
-        let completer = async.Completer.new();
-        return completer.future;
+      asFuture(E) {
+        return futureValue => {
+          if (futureValue === void 0) futureValue = null;
+          let completer = async.Completer$(E).new();
+          return completer.future;
+        };
       }
     }
     dart.setSignature(_EventStreamSubscription, {
       constructors: () => ({new: dart.definiteFunctionType(html$._EventStreamSubscription$(T), [html$.EventTarget, core.String, TTovoid(), core.bool])}),
       fields: () => ({
-        [_pauseCount$]: core.int,
-        [_target$]: html$.EventTarget,
+        [_pauseCount$0]: core.int,
+        [_target$0]: html$.EventTarget,
         [_eventType]: core.String,
-        [_onData$]: html$.EventListener,
+        [_onData$0]: html$.EventListener,
         [_useCapture]: core.bool
       }),
       getters: () => ({
@@ -81376,7 +96439,7 @@
         resume: dart.definiteFunctionType(dart.void, []),
         [_tryResume]: dart.definiteFunctionType(dart.void, []),
         [_unlisten]: dart.definiteFunctionType(dart.void, []),
-        asFuture: dart.definiteFunctionType(async.Future, [], [dart.dynamic])
+        asFuture: dart.definiteFunctionType(E => [async.Future$(E), [], [E]])
       })
     });
     return _EventStreamSubscription;
@@ -81391,7 +96454,7 @@
   });
   html$.CustomStream = CustomStream();
   const _streamController = Symbol('_streamController');
-  const _type = Symbol('_type');
+  const _type$ = Symbol('_type');
   html$._CustomEventStreamImpl$ = dart.generic(T => {
     let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
     let CustomStreamOfT = () => (CustomStreamOfT = dart.constFn(html$.CustomStream$(T)))();
@@ -81401,9 +96464,9 @@
     class _CustomEventStreamImpl extends async.Stream$(T) {
       new(type) {
         this[_streamController] = null;
-        this[_type] = null;
+        this[_type$] = null;
         super.new();
-        this[_type] = type;
+        this[_type$] = type;
         this[_streamController] = StreamControllerOfT().broadcast({sync: true});
       }
       listen(onData, opts) {
@@ -81422,7 +96485,7 @@
       }
       add(event) {
         T._check(event);
-        if (event[dartx.type] == this[_type]) this[_streamController].add(event);
+        if (event[dartx.type] == this[_type$]) this[_streamController].add(event);
       }
     }
     _CustomEventStreamImpl[dart.implements] = () => [CustomStreamOfT()];
@@ -81430,11 +96493,10 @@
       constructors: () => ({new: dart.definiteFunctionType(html$._CustomEventStreamImpl$(T), [core.String])}),
       fields: () => ({
         [_streamController]: StreamControllerOfT(),
-        [_type]: core.String
+        [_type$]: core.String
       }),
       methods: () => ({
         listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
         add: dart.definiteFunctionType(dart.void, [T])
       })
     });
@@ -81703,7 +96765,7 @@
       super.new(type);
     }
     add(event) {
-      if (event.type == this[_type]) {
+      if (event.type == this[_type$]) {
         event.currentTarget[dartx.dispatchEvent](event[_parent$]);
         this[_streamController].add(event);
       }
@@ -81712,11 +96774,10 @@
   dart.addSimpleTypeTests(html$._CustomKeyEventStreamImpl);
   html$._CustomKeyEventStreamImpl[dart.implements] = () => [CustomStreamOfKeyEvent()];
   dart.setSignature(html$._CustomKeyEventStreamImpl, {
-    constructors: () => ({new: dart.definiteFunctionType(html$._CustomKeyEventStreamImpl, [core.String])}),
-    methods: () => ({add: dart.definiteFunctionType(dart.void, [html$.KeyEvent])})
+    constructors: () => ({new: dart.definiteFunctionType(html$._CustomKeyEventStreamImpl, [core.String])})
   });
   const _subscriptions = Symbol('_subscriptions');
-  const _controller$0 = Symbol('_controller');
+  const _controller$1 = Symbol('_controller');
   html$._StreamPool$ = dart.generic(T => {
     let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
     let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
@@ -81725,16 +96786,16 @@
     class _StreamPool extends core.Object {
       broadcast() {
         this[_subscriptions] = MapOfStreamOfT$StreamSubscriptionOfT().new();
-        this[_controller$0] = null;
-        this[_controller$0] = StreamControllerOfT().broadcast({sync: true, onCancel: dart.bind(this, 'close')});
+        this[_controller$1] = null;
+        this[_controller$1] = StreamControllerOfT().broadcast({sync: true, onCancel: dart.bind(this, 'close')});
       }
       get stream() {
-        return this[_controller$0].stream;
+        return this[_controller$1].stream;
       }
       add(stream) {
         StreamOfT()._check(stream);
         if (dart.test(this[_subscriptions][dartx.containsKey](stream))) return;
-        this[_subscriptions][dartx._set](stream, stream.listen(dart.bind(this[_controller$0], 'add'), {onError: dart.bind(this[_controller$0], 'addError'), onDone: dart.fn(() => this.remove(stream), VoidTovoid$())}));
+        this[_subscriptions][dartx._set](stream, stream.listen(dart.bind(this[_controller$1], 'add'), {onError: dart.bind(this[_controller$1], 'addError'), onDone: dart.fn(() => this.remove(stream), VoidTovoid$())}));
       }
       remove(stream) {
         StreamOfT()._check(stream);
@@ -81746,7 +96807,7 @@
           subscription.cancel();
         }
         this[_subscriptions][dartx.clear]();
-        this[_controller$0].close();
+        this[_controller$1].close();
       }
     }
     dart.addTypeTests(_StreamPool);
@@ -81754,7 +96815,7 @@
     dart.setSignature(_StreamPool, {
       constructors: () => ({broadcast: dart.definiteFunctionType(html$._StreamPool$(T), [])}),
       fields: () => ({
-        [_controller$0]: StreamControllerOfT(),
+        [_controller$1]: StreamControllerOfT(),
         [_subscriptions]: MapOfStreamOfT$StreamSubscriptionOfT()
       }),
       getters: () => ({stream: dart.definiteFunctionType(async.Stream$(T), [])}),
@@ -82624,7 +97685,7 @@
   html$._KeyName.DEAD_VOICED_SOUND = "DeadVoicedSound";
   html$._KeyName.DEC_SEMIVOICED_SOUND = "DeadSemivoicedSound";
   html$._KeyName.UNIDENTIFIED = "Unidentified";
-  const _stream$ = Symbol('_stream');
+  const _stream$0 = Symbol('_stream');
   const _keyDownList = Symbol('_keyDownList');
   const _capsLockOn = Symbol('_capsLockOn');
   const _determineKeyCodeForKeypress = Symbol('_determineKeyCodeForKeypress');
@@ -82634,26 +97695,26 @@
   html$._KeyboardEventHandler = class _KeyboardEventHandler extends html$.EventStreamProvider$(html$.KeyEvent) {
     forTarget(e, opts) {
       let useCapture = opts && 'useCapture' in opts ? opts.useCapture : false;
-      let handler = new html$._KeyboardEventHandler.initializeAllEventListeners(this[_type], e);
-      return handler[_stream$];
+      let handler = new html$._KeyboardEventHandler.initializeAllEventListeners(this[_type$], e);
+      return handler[_stream$0];
     }
     new(type) {
       this[_keyDownList] = JSArrayOfKeyEvent().of([]);
-      this[_type] = type;
-      this[_stream$] = new html$._CustomKeyEventStreamImpl('event');
-      this[_target$] = null;
+      this[_type$] = type;
+      this[_stream$0] = new html$._CustomKeyEventStreamImpl('event');
+      this[_target$0] = null;
       super.new(html$._KeyboardEventHandler._EVENT_TYPE);
     }
     initializeAllEventListeners(type, target) {
       this[_keyDownList] = JSArrayOfKeyEvent().of([]);
-      this[_type] = type;
-      this[_target$] = target;
-      this[_stream$] = null;
+      this[_type$] = type;
+      this[_target$0] = target;
+      this[_stream$0] = null;
       super.new(html$._KeyboardEventHandler._EVENT_TYPE);
-      html$.Element.keyDownEvent.forTarget(this[_target$], {useCapture: true}).listen(dart.bind(this, 'processKeyDown'));
-      html$.Element.keyPressEvent.forTarget(this[_target$], {useCapture: true}).listen(dart.bind(this, 'processKeyPress'));
-      html$.Element.keyUpEvent.forTarget(this[_target$], {useCapture: true}).listen(dart.bind(this, 'processKeyUp'));
-      this[_stream$] = new html$._CustomKeyEventStreamImpl(this[_type]);
+      html$.Element.keyDownEvent.forTarget(this[_target$0], {useCapture: true}).listen(dart.bind(this, 'processKeyDown'));
+      html$.Element.keyPressEvent.forTarget(this[_target$0], {useCapture: true}).listen(dart.bind(this, 'processKeyPress'));
+      html$.Element.keyUpEvent.forTarget(this[_target$0], {useCapture: true}).listen(dart.bind(this, 'processKeyUp'));
+      this[_stream$0] = new html$._CustomKeyEventStreamImpl(this[_type$]);
     }
     get [_capsLockOn]() {
       return this[_keyDownList][dartx.any](dart.fn(element => element.keyCode == html$.KeyCode.CAPS_LOCK, KeyEventTobool()));
@@ -82846,7 +97907,7 @@
         this.processKeyPress(e);
       }
       this[_keyDownList][dartx.add](event);
-      this[_stream$].add(event);
+      this[_stream$0].add(event);
     }
     processKeyPress(event) {
       let e = new html$.KeyEvent.wrap(event);
@@ -82864,7 +97925,7 @@
         e[_shadowKeyCode] = html$._KeyboardEventHandler._keyIdentifier[dartx._get](e[_shadowKeyIdentifier]);
       }
       e[_shadowAltKey] = this[_keyDownList][dartx.any](dart.fn(element => element.altKey, KeyEventTobool()));
-      this[_stream$].add(e);
+      this[_stream$0].add(e);
     }
     processKeyUp(event) {
       let e = new html$.KeyEvent.wrap(event);
@@ -82879,7 +97940,7 @@
       } else if (dart.notNull(this[_keyDownList][dartx.length]) > 0) {
         this[_keyDownList][dartx.removeLast]();
       }
-      this[_stream$].add(e);
+      this[_stream$0].add(e);
     }
   };
   dart.addSimpleTypeTests(html$._KeyboardEventHandler);
@@ -82891,9 +97952,9 @@
     }),
     fields: () => ({
       [_keyDownList]: ListOfKeyEvent(),
-      [_type]: core.String,
-      [_target$]: html$.EventTarget,
-      [_stream$]: html$._CustomKeyEventStreamImpl
+      [_type$]: core.String,
+      [_target$0]: html$.EventTarget,
+      [_stream$0]: html$._CustomKeyEventStreamImpl
     }),
     getters: () => ({[_capsLockOn]: dart.definiteFunctionType(core.bool, [])}),
     methods: () => ({
@@ -83049,25 +98110,25 @@
       allowsAttribute: dart.definiteFunctionType(core.bool, [html$.Element, core.String, core.String])
     })
   });
-  let const$53;
-  let const$54;
-  let const$55;
-  let const$56;
-  let const$57;
-  let const$58;
-  let const$59;
-  let const$60;
-  let const$61;
-  let const$62;
+  let const$83;
+  let const$84;
+  let const$85;
+  let const$86;
+  let const$87;
+  let const$88;
+  let const$89;
+  let const$90;
+  let const$91;
+  let const$92;
   html$._SimpleNodeValidator = class _SimpleNodeValidator extends core.Object {
     static allowNavigation(uriPolicy) {
-      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$53 || (const$53 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$54 || (const$54 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$55 || (const$55 = dart.constList(['A::href', 'FORM::action'], core.String))});
+      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$83 || (const$83 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$84 || (const$84 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$85 || (const$85 = dart.constList(['A::href', 'FORM::action'], core.String))});
     }
     static allowImages(uriPolicy) {
-      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$56 || (const$56 = dart.constList(['IMG'], core.String)), allowedAttributes: const$57 || (const$57 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$58 || (const$58 = dart.constList(['IMG::src'], core.String))});
+      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['IMG'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['IMG::src'], core.String))});
     }
     static allowTextElements() {
-      return new html$._SimpleNodeValidator(null, {allowedElements: const$59 || (const$59 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
+      return new html$._SimpleNodeValidator(null, {allowedElements: const$89 || (const$89 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
     }
     new(uriPolicy, opts) {
       let allowedElements = opts && 'allowedElements' in opts ? opts.allowedElements : null;
@@ -83077,9 +98138,9 @@
       this.allowedAttributes = SetOfString().new();
       this.allowedUriAttributes = SetOfString().new();
       this.uriPolicy = uriPolicy;
-      this.allowedElements.addAll((allowedElements != null ? allowedElements : const$60 || (const$60 = dart.constList([], core.String))));
-      allowedAttributes = allowedAttributes != null ? allowedAttributes : const$61 || (const$61 = dart.constList([], core.String));
-      allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$62 || (const$62 = dart.constList([], core.String));
+      this.allowedElements.addAll((allowedElements != null ? allowedElements : const$90 || (const$90 = dart.constList([], core.String))));
+      allowedAttributes = allowedAttributes != null ? allowedAttributes : const$91 || (const$91 = dart.constList([], core.String));
+      allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$92 || (const$92 = dart.constList([], core.String));
       let legalAttributes = allowedAttributes[dartx.where](dart.fn(x => !dart.test(html$._Html5NodeValidator._uriAttributes[dartx.contains](x)), StringTobool$()));
       let extraUriAttributes = allowedAttributes[dartx.where](dart.fn(x => html$._Html5NodeValidator._uriAttributes[dartx.contains](x), StringTobool$()));
       this.allowedAttributes.addAll(legalAttributes);
@@ -83302,21 +98363,13 @@
       constructors: () => ({new: dart.definiteFunctionType(html$._WrappedList$(E), [ListOfNode()])}),
       fields: () => ({[_list$]: ListOfNode()}),
       getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
         length: dart.definiteFunctionType(core.int, []),
         rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
       }),
       setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
       methods: () => ({
-        add: dart.definiteFunctionType(dart.void, [E]),
         _get: dart.definiteFunctionType(E, [core.int]),
-        _set: dart.definiteFunctionType(dart.void, [core.int, E]),
-        sort: dart.definiteFunctionType(dart.void, [], [EAndEToint()]),
-        insert: dart.definiteFunctionType(dart.void, [core.int, E]),
-        removeAt: dart.definiteFunctionType(E, [core.int]),
-        setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()], [core.int]),
-        replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()]),
-        fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [E])
+        _set: dart.definiteFunctionType(dart.void, [core.int, E])
       })
     });
     dart.defineExtensionMembers(_WrappedList, [
@@ -83381,7 +98434,7 @@
         if (request[dartx.readyState] == html$.HttpRequest.DONE) {
           onComplete(request);
         }
-      }, ProgressEventTovoid$()));
+      }, ProgressEventToNull()));
       request[dartx.send]();
       return request;
     }
@@ -83398,19 +98451,19 @@
     class FixedSizeListIterator extends core.Object {
       new(array) {
         this[_array] = array;
-        this[_position$0] = -1;
-        this[_length$2] = array[dartx.length];
+        this[_position$1] = -1;
+        this[_length$3] = array[dartx.length];
         this[_current$4] = null;
       }
       moveNext() {
-        let nextPosition = dart.notNull(this[_position$0]) + 1;
-        if (nextPosition < dart.notNull(this[_length$2])) {
+        let nextPosition = dart.notNull(this[_position$1]) + 1;
+        if (nextPosition < dart.notNull(this[_length$3])) {
           this[_current$4] = this[_array][dartx._get](nextPosition);
-          this[_position$0] = nextPosition;
+          this[_position$1] = nextPosition;
           return true;
         }
         this[_current$4] = null;
-        this[_position$0] = this[_length$2];
+        this[_position$1] = this[_length$3];
         return false;
       }
       get current() {
@@ -83423,8 +98476,8 @@
       constructors: () => ({new: dart.definiteFunctionType(html$.FixedSizeListIterator$(T), [ListOfT()])}),
       fields: () => ({
         [_array]: ListOfT(),
-        [_length$2]: core.int,
-        [_position$0]: core.int,
+        [_length$3]: core.int,
+        [_position$1]: core.int,
         [_current$4]: T
       }),
       getters: () => ({current: dart.definiteFunctionType(T, [])}),
@@ -83439,18 +98492,18 @@
     class _VariableSizeListIterator extends core.Object {
       new(array) {
         this[_array] = array;
-        this[_position$0] = -1;
+        this[_position$1] = -1;
         this[_current$4] = null;
       }
       moveNext() {
-        let nextPosition = dart.notNull(this[_position$0]) + 1;
+        let nextPosition = dart.notNull(this[_position$1]) + 1;
         if (nextPosition < dart.notNull(this[_array][dartx.length])) {
           this[_current$4] = this[_array][dartx._get](nextPosition);
-          this[_position$0] = nextPosition;
+          this[_position$1] = nextPosition;
           return true;
         }
         this[_current$4] = null;
-        this[_position$0] = this[_array][dartx.length];
+        this[_position$1] = this[_array][dartx.length];
         return false;
       }
       get current() {
@@ -83463,7 +98516,7 @@
       constructors: () => ({new: dart.definiteFunctionType(html$._VariableSizeListIterator$(T), [ListOfT()])}),
       fields: () => ({
         [_array]: ListOfT(),
-        [_position$0]: core.int,
+        [_position$1]: core.int,
         [_current$4]: T
       }),
       getters: () => ({current: dart.definiteFunctionType(T, [])}),
@@ -84127,7 +99180,7 @@
         this.writeSlot(slot, copy);
         e[dartx.forEach](dart.fn((key, value) => {
           this.putIntoMap(copy, key, this.walk(value));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return copy;
       }
       if (core.List.is(e)) {
@@ -84336,7 +99389,7 @@
     }
     dict[dartx.forEach](dart.fn((key, value) => {
       object[key] = value;
-    }, StringAnddynamicTovoid()));
+    }, StringAnddynamicToNull()));
     return object;
   };
   dart.fn(html_common.convertDartToNative_Dictionary, Map__Todynamic());
@@ -84361,7 +99414,7 @@
     let mustCopy = opts && 'mustCopy' in opts ? opts.mustCopy : false;
     return new html_common._AcceptStructuredCloneDart2Js().convertNativeToDart_AcceptStructuredClone(object, {mustCopy: mustCopy});
   };
-  dart.fn(html_common.convertNativeToDart_AcceptStructuredClone, dynamic__Todynamic$());
+  dart.fn(html_common.convertNativeToDart_AcceptStructuredClone, dynamic__Todynamic());
   html_common._StructuredCloneDart2Js = class _StructuredCloneDart2Js extends html_common._StructuredClone {
     new() {
       super.new();
@@ -84669,25 +99722,12 @@
     getters: () => ({
       [_iterable$0]: dart.definiteFunctionType(core.Iterable$(html$.Element), []),
       [_filtered]: dart.definiteFunctionType(core.List$(html$.Element), []),
-      reversed: dart.definiteFunctionType(core.Iterable$(html$.Element), []),
       length: dart.definiteFunctionType(core.int, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(html$.Element), []),
       rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
-      forEach: dart.definiteFunctionType(dart.void, [ElementTovoid()]),
       _set: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
-      add: dart.definiteFunctionType(dart.void, [html$.Element]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfElement()]),
-      sort: dart.definiteFunctionType(dart.void, [], [ElementAndElementToint()]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()], [core.int]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html$.Element]),
-      replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()]),
-      removeLast: dart.definiteFunctionType(html$.Element, []),
-      insert: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
-      insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfElement()]),
-      removeAt: dart.definiteFunctionType(html$.Element, [core.int]),
       _get: dart.definiteFunctionType(html$.Element, [core.int])
     })
   });
@@ -88358,17 +103398,11 @@
   dart.setSignature(svg$.LengthList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.LengthList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.Length, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.Length, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.Length, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.Length, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.Length]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.Length, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.Length]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.Length, [svg$.Length]),
       [dartx.getItem]: dart.definiteFunctionType(svg$.Length, [core.int]),
@@ -88964,17 +103998,11 @@
   dart.setSignature(svg$.NumberList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.NumberList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.Number, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.Number, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.Number, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.Number, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.Number]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.Number, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.Number]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.Number, [svg$.Number]),
       [dartx.getItem]: dart.definiteFunctionType(svg$.Number, [core.int]),
@@ -89949,17 +104977,11 @@
   dart.setSignature(svg$.PathSegList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.PathSegList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.PathSeg, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.PathSeg, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.PathSeg, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.PathSeg, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.PathSeg]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.PathSeg, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.PathSeg]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.PathSeg, [svg$.PathSeg]),
       [dartx.getItem]: dart.definiteFunctionType(svg$.PathSeg, [core.int]),
@@ -90714,17 +105736,11 @@
   dart.setSignature(svg$.StringList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.StringList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(core.String, []),
-      [dartx.last]: dart.definiteFunctionType(core.String, []),
-      [dartx.single]: dart.definiteFunctionType(core.String, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(core.String, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
-      [dartx.elementAt]: dart.definiteFunctionType(core.String, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
       [dartx.appendItem]: dart.definiteFunctionType(core.String, [core.String]),
       [dartx.getItem]: dart.definiteFunctionType(core.String, [core.int]),
@@ -91598,17 +106614,11 @@
   dart.setSignature(svg$.TransformList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.TransformList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.Transform, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.Transform, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.Transform, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.Transform, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.Transform]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.Transform, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.Transform]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.Transform, [svg$.Transform]),
       [dartx.consolidate]: dart.definiteFunctionType(svg$.Transform, []),
@@ -92375,13 +107385,13 @@
       let completer = CompleterOfAudioBuffer().new();
       this[_decodeAudioData](audioData, dart.fn(value => {
         completer.complete(value);
-      }, AudioBufferTovoid()), dart.fn(error => {
+      }, AudioBufferToNull()), dart.fn(error => {
         if (error == null) {
           completer.completeError('');
         } else {
           completer.completeError(error);
         }
-      }, AudioBufferTovoid()));
+      }, AudioBufferToNull()));
       return completer.future;
     }
   };
@@ -92817,7 +107827,7 @@
       return web_audio.OfflineAudioContext._create_1(numberOfChannels, numberOfFrames, sampleRate);
     }
     static _create_1(numberOfChannels, numberOfFrames, sampleRate) {
-      return new OfflineAudioContext(numberOfChannels, numberOfFrames, sampleRate);
+      return new self.OfflineAudioContext(numberOfChannels, numberOfFrames, sampleRate);
     }
   };
   dart.setSignature(web_audio.OfflineAudioContext, {
@@ -95645,17 +110655,11 @@
   web_sql.SqlResultSetRowList[dart.implements] = () => [ListOfMap()];
   dart.setSignature(web_sql.SqlResultSetRowList, {
     constructors: () => ({_: dart.definiteFunctionType(web_sql.SqlResultSetRowList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(core.Map, []),
-      [dartx.last]: dart.definiteFunctionType(core.Map, []),
-      [dartx.single]: dart.definiteFunctionType(core.Map, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(core.Map, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.Map]),
-      [dartx.elementAt]: dart.definiteFunctionType(core.Map, [core.int]),
       [dartx.item]: dart.definiteFunctionType(core.Map, [core.int]),
       [_item_1]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
     })
@@ -95697,6 +110701,7 @@
     convert: convert,
     core: core,
     developer: developer,
+    io: io,
     isolate: isolate,
     js: js,
     js_util: js_util,
diff --git a/pkg/dev_compiler/lib/js/common/dart_sdk.js b/pkg/dev_compiler/lib/js/common/dart_sdk.js
index e025ec5..6e91b7b 100644
--- a/pkg/dev_compiler/lib/js/common/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/common/dart_sdk.js
@@ -18,6 +18,7 @@
   const convert = Object.create(null);
   const core = Object.create(null);
   const developer = Object.create(null);
+  const io = Object.create(null);
   const isolate = Object.create(null);
   const js = Object.create(null);
   const js_util = Object.create(null);
@@ -166,6 +167,8 @@
   let _AsyncBroadcastStreamController = () => (_AsyncBroadcastStreamController = dart.constFn(async._AsyncBroadcastStreamController$()))();
   let _AsBroadcastStreamController = () => (_AsBroadcastStreamController = dart.constFn(async._AsBroadcastStreamController$()))();
   let _DoneSubscription = () => (_DoneSubscription = dart.constFn(async._DoneSubscription$()))();
+  let FutureOr = () => (FutureOr = dart.constFn(async.FutureOr$()))();
+  let dynamicToFutureOr = () => (dynamicToFutureOr = dart.constFn(dart.functionType(async.FutureOr, [dart.dynamic])))();
   let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart.dynamic, [])))();
   let Future = () => (Future = dart.constFn(async.Future$()))();
   let Completer = () => (Completer = dart.constFn(async.Completer$()))();
@@ -383,6 +386,103 @@
   let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
   let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
   let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
+  let ListOfListOfint = () => (ListOfListOfint = dart.constFn(core.List$(ListOfint())))();
+  let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
+  let FutureOfDirectory = () => (FutureOfDirectory = dart.constFn(async.Future$(io.Directory)))();
+  let FutureOrOfDirectory = () => (FutureOrOfDirectory = dart.constFn(async.FutureOr$(io.Directory)))();
+  let StreamOfFileSystemEntity = () => (StreamOfFileSystemEntity = dart.constFn(async.Stream$(io.FileSystemEntity)))();
+  let JSArrayOfFileSystemEntity = () => (JSArrayOfFileSystemEntity = dart.constFn(_interceptors.JSArray$(io.FileSystemEntity)))();
+  let FutureOrOfString = () => (FutureOrOfString = dart.constFn(async.FutureOr$(core.String)))();
+  let FutureOrOfbool = () => (FutureOrOfbool = dart.constFn(async.FutureOr$(core.bool)))();
+  let FutureOrOfint = () => (FutureOrOfint = dart.constFn(async.FutureOr$(core.int)))();
+  let ListOfFileSystemEntity = () => (ListOfFileSystemEntity = dart.constFn(core.List$(io.FileSystemEntity)))();
+  let StreamControllerOfListOfint = () => (StreamControllerOfListOfint = dart.constFn(async.StreamController$(ListOfint())))();
+  let FutureOfRandomAccessFile = () => (FutureOfRandomAccessFile = dart.constFn(async.Future$(io.RandomAccessFile)))();
+  let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(io.File)))();
+  let FutureOfListOfint = () => (FutureOfListOfint = dart.constFn(async.Future$(ListOfint())))();
+  let FutureOrOfFile = () => (FutureOrOfFile = dart.constFn(async.FutureOr$(io.File)))();
+  let FutureOfFile = () => (FutureOfFile = dart.constFn(async.Future$(io.File)))();
+  let FutureOrOfListOfint = () => (FutureOrOfListOfint = dart.constFn(async.FutureOr$(ListOfint())))();
+  let ListOfFileSystemEntityType = () => (ListOfFileSystemEntityType = dart.constFn(core.List$(io.FileSystemEntityType)))();
+  let StreamOfHttpRequest = () => (StreamOfHttpRequest = dart.constFn(async.Stream$(io.HttpRequest)))();
+  let ListOfRedirectInfo = () => (ListOfRedirectInfo = dart.constFn(core.List$(io.RedirectInfo)))();
+  let HashMapOfString$ListOfString = () => (HashMapOfString$ListOfString = dart.constFn(collection.HashMap$(core.String, ListOfString())))();
+  let ListOfCookie = () => (ListOfCookie = dart.constFn(core.List$(io.Cookie)))();
+  let StringAndListOfStringTovoid = () => (StringAndListOfStringTovoid = dart.constFn(dart.functionType(dart.void, [core.String, ListOfString()])))();
+  let FutureOfHttpClientResponse = () => (FutureOfHttpClientResponse = dart.constFn(async.Future$(io.HttpClientResponse)))();
+  let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
+  let FutureOrOfHttpClientResponse = () => (FutureOrOfHttpClientResponse = dart.constFn(async.FutureOr$(io.HttpClientResponse)))();
+  let _StreamSinkImpl = () => (_StreamSinkImpl = dart.constFn(io._StreamSinkImpl$()))();
+  let StreamConsumerOfListOfint = () => (StreamConsumerOfListOfint = dart.constFn(async.StreamConsumer$(ListOfint())))();
+  let _HttpOutboundMessage = () => (_HttpOutboundMessage = dart.constFn(io._HttpOutboundMessage$()))();
+  let CompleterOfHttpClientResponse = () => (CompleterOfHttpClientResponse = dart.constFn(async.Completer$(io.HttpClientResponse)))();
+  let JSArrayOfRedirectInfo = () => (JSArrayOfRedirectInfo = dart.constFn(_interceptors.JSArray$(io.RedirectInfo)))();
+  let JSArrayOfFuture = () => (JSArrayOfFuture = dart.constFn(_interceptors.JSArray$(async.Future)))();
+  let CompleterOf_HttpIncoming = () => (CompleterOf_HttpIncoming = dart.constFn(async.Completer$(io._HttpIncoming)))();
+  let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
+  let FutureOfSecureSocket = () => (FutureOfSecureSocket = dart.constFn(async.Future$(io.SecureSocket)))();
+  let HashSetOf_HttpClientConnection = () => (HashSetOf_HttpClientConnection = dart.constFn(collection.HashSet$(io._HttpClientConnection)))();
+  let FutureOf_ConnectionInfo = () => (FutureOf_ConnectionInfo = dart.constFn(async.Future$(io._ConnectionInfo)))();
+  let FutureOrOf_ConnectionInfo = () => (FutureOrOf_ConnectionInfo = dart.constFn(async.FutureOr$(io._ConnectionInfo)))();
+  let SetOf_HttpClientConnection = () => (SetOf_HttpClientConnection = dart.constFn(core.Set$(io._HttpClientConnection)))();
+  let HashMapOfString$_ConnectionTarget = () => (HashMapOfString$_ConnectionTarget = dart.constFn(collection.HashMap$(core.String, io._ConnectionTarget)))();
+  let JSArrayOf_Credentials = () => (JSArrayOf_Credentials = dart.constFn(_interceptors.JSArray$(io._Credentials)))();
+  let JSArrayOf_ProxyCredentials = () => (JSArrayOf_ProxyCredentials = dart.constFn(_interceptors.JSArray$(io._ProxyCredentials)))();
+  let FutureOf_HttpClientRequest = () => (FutureOf_HttpClientRequest = dart.constFn(async.Future$(io._HttpClientRequest)))();
+  let FutureOrOf_HttpClientRequest = () => (FutureOrOf_HttpClientRequest = dart.constFn(async.FutureOr$(io._HttpClientRequest)))();
+  let X509CertificateAndStringAndintTobool = () => (X509CertificateAndStringAndintTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate, core.String, core.int])))();
+  let FutureOfbool = () => (FutureOfbool = dart.constFn(async.Future$(core.bool)))();
+  let UriAndStringAndStringToFutureOfbool = () => (UriAndStringAndStringToFutureOfbool = dart.constFn(dart.functionType(FutureOfbool(), [core.Uri, core.String, core.String])))();
+  let StringAndintAndString__ToFutureOfbool = () => (StringAndintAndString__ToFutureOfbool = dart.constFn(dart.functionType(FutureOfbool(), [core.String, core.int, core.String, core.String])))();
+  let UriToString = () => (UriToString = dart.constFn(dart.functionType(core.String, [core.Uri])))();
+  let MapOfString$_ConnectionTarget = () => (MapOfString$_ConnectionTarget = dart.constFn(core.Map$(core.String, io._ConnectionTarget)))();
+  let ListOf_Credentials = () => (ListOf_Credentials = dart.constFn(core.List$(io._Credentials)))();
+  let ListOf_ProxyCredentials = () => (ListOf_ProxyCredentials = dart.constFn(core.List$(io._ProxyCredentials)))();
+  let MapOfint$_HttpConnection = () => (MapOfint$_HttpConnection = dart.constFn(core.Map$(core.int, io._HttpConnection)))();
+  let HashMapOfint$_HttpConnection = () => (HashMapOfint$_HttpConnection = dart.constFn(collection.HashMap$(core.int, io._HttpConnection)))();
+  let LinkedListOf_HttpConnection = () => (LinkedListOf_HttpConnection = dart.constFn(collection.LinkedList$(io._HttpConnection)))();
+  let StreamControllerOfHttpRequest = () => (StreamControllerOfHttpRequest = dart.constFn(async.StreamController$(io.HttpRequest)))();
+  let HttpRequestTovoid = () => (HttpRequestTovoid = dart.constFn(dart.functionType(dart.void, [io.HttpRequest])))();
+  let MapOfint$_HttpServer = () => (MapOfint$_HttpServer = dart.constFn(core.Map$(core.int, io._HttpServer)))();
+  let ListOf_Proxy = () => (ListOf_Proxy = dart.constFn(core.List$(io._Proxy)))();
+  let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
+  let ListOfbool = () => (ListOfbool = dart.constFn(core.List$(core.bool)))();
+  let StreamOfint = () => (StreamOfint = dart.constFn(async.Stream$(core.int)))();
+  let StreamControllerOf_HttpIncoming = () => (StreamControllerOf_HttpIncoming = dart.constFn(async.StreamController$(io._HttpIncoming)))();
+  let _HttpIncomingTovoid = () => (_HttpIncomingTovoid = dart.constFn(dart.functionType(dart.void, [io._HttpIncoming])))();
+  let MapOfString$_HttpSession = () => (MapOfString$_HttpSession = dart.constFn(core.Map$(core.String, io._HttpSession)))();
+  let ListOfMapOfString$String = () => (ListOfMapOfString$String = dart.constFn(core.List$(MapOfString$String())))();
+  let FutureOfServiceExtensionResponse = () => (FutureOfServiceExtensionResponse = dart.constFn(async.Future$(developer.ServiceExtensionResponse)))();
+  let MapOfint$_FileResourceInfo = () => (MapOfint$_FileResourceInfo = dart.constFn(core.Map$(core.int, io._FileResourceInfo)))();
+  let MapOfint$_ProcessResourceInfo = () => (MapOfint$_ProcessResourceInfo = dart.constFn(core.Map$(core.int, io._ProcessResourceInfo)))();
+  let MapOfint$_SocketResourceInfo = () => (MapOfint$_SocketResourceInfo = dart.constFn(core.Map$(core.int, io._SocketResourceInfo)))();
+  let StreamSinkOfListOfint = () => (StreamSinkOfListOfint = dart.constFn(async.StreamSink$(ListOfint())))();
+  let FutureOfLink = () => (FutureOfLink = dart.constFn(async.Future$(io.Link)))();
+  let _CaseInsensitiveStringMap = () => (_CaseInsensitiveStringMap = dart.constFn(io._CaseInsensitiveStringMap$()))();
+  let FutureOfRawSecureSocket = () => (FutureOfRawSecureSocket = dart.constFn(async.Future$(io.RawSecureSocket)))();
+  let SecureSocketTovoid = () => (SecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.SecureSocket])))();
+  let StreamControllerOfRawSecureSocket = () => (StreamControllerOfRawSecureSocket = dart.constFn(async.StreamController$(io.RawSecureSocket)))();
+  let RawSecureSocketTovoid = () => (RawSecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSecureSocket])))();
+  let StreamSubscriptionOfRawSocket = () => (StreamSubscriptionOfRawSocket = dart.constFn(async.StreamSubscription$(io.RawSocket)))();
+  let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
+  let CompleterOf_RawSecureSocket = () => (CompleterOf_RawSecureSocket = dart.constFn(async.Completer$(io._RawSecureSocket)))();
+  let StreamControllerOfRawSocketEvent = () => (StreamControllerOfRawSocketEvent = dart.constFn(async.StreamController$(io.RawSocketEvent)))();
+  let RawSocketEventTovoid = () => (RawSocketEventTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSocketEvent])))();
+  let StreamOfRawSocketEvent = () => (StreamOfRawSocketEvent = dart.constFn(async.Stream$(io.RawSocketEvent)))();
+  let X509CertificateTodynamic = () => (X509CertificateTodynamic = dart.constFn(dart.functionType(dart.dynamic, [io.X509Certificate])))();
+  let intToListOfint = () => (intToListOfint = dart.constFn(dart.functionType(ListOfint(), [core.int])))();
+  let StreamOfRawSocket = () => (StreamOfRawSocket = dart.constFn(async.Stream$(io.RawSocket)))();
+  let StreamOfSocket = () => (StreamOfSocket = dart.constFn(async.Stream$(io.Socket)))();
+  let StreamTransformerOfHttpRequest$WebSocket = () => (StreamTransformerOfHttpRequest$WebSocket = dart.constFn(async.StreamTransformer$(io.HttpRequest, io.WebSocket)))();
+  let ListOfStringTodynamic = () => (ListOfStringTodynamic = dart.constFn(dart.functionType(dart.dynamic, [ListOfString()])))();
+  let StreamTransformerOfListOfint$dynamic = () => (StreamTransformerOfListOfint$dynamic = dart.constFn(async.StreamTransformer$(ListOfint(), dart.dynamic)))();
+  let EventSinkOfUint8List = () => (EventSinkOfUint8List = dart.constFn(async.EventSink$(typed_data.Uint8List)))();
+  let StreamControllerOfWebSocket = () => (StreamControllerOfWebSocket = dart.constFn(async.StreamController$(io.WebSocket)))();
+  let FutureOfWebSocket = () => (FutureOfWebSocket = dart.constFn(async.Future$(io.WebSocket)))();
+  let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
+  let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+  let StreamTransformerOfdynamic$ListOfint = () => (StreamTransformerOfdynamic$ListOfint = dart.constFn(async.StreamTransformer$(dart.dynamic, ListOfint())))();
+  let MapOfint$_WebSocketImpl = () => (MapOfint$_WebSocketImpl = dart.constFn(core.Map$(core.int, io._WebSocketImpl)))();
   let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
   let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
   let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@@ -399,7 +499,6 @@
   let FutureOfIdbFactory = () => (FutureOfIdbFactory = dart.constFn(async.Future$(indexed_db.IdbFactory)))();
   let FutureOfListOfString = () => (FutureOfListOfString = dart.constFn(async.Future$(ListOfString())))();
   let EventTovoid = () => (EventTovoid = dart.constFn(dart.functionType(dart.void, [html$.Event])))();
-  let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
   let CompleterOfDatabase = () => (CompleterOfDatabase = dart.constFn(async.Completer$(indexed_db.Database)))();
   let ListOfEventTarget = () => (ListOfEventTarget = dart.constFn(core.List$(html$.EventTarget)))();
   let RectangleOfint = () => (RectangleOfint = dart.constFn(math.Rectangle$(core.int)))();
@@ -433,8 +532,8 @@
   let CompleterOfString = () => (CompleterOfString = dart.constFn(async.Completer$(core.String)))();
   let CompleterOfMetadata = () => (CompleterOfMetadata = dart.constFn(async.Completer$(html$.Metadata)))();
   let CompleterOfListOfEntry = () => (CompleterOfListOfEntry = dart.constFn(async.Completer$(ListOfEntry())))();
-  let ListOfStyleSheet = () => (ListOfStyleSheet = dart.constFn(core.List$(html$.StyleSheet)))();
   let EventStreamProviderOfSecurityPolicyViolationEvent = () => (EventStreamProviderOfSecurityPolicyViolationEvent = dart.constFn(html$.EventStreamProvider$(html$.SecurityPolicyViolationEvent)))();
+  let ListOfStyleSheet = () => (ListOfStyleSheet = dart.constFn(core.List$(html$.StyleSheet)))();
   let ImmutableListMixin = () => (ImmutableListMixin = dart.constFn(html$.ImmutableListMixin$()))();
   let ElementAndElementToint = () => (ElementAndElementToint = dart.constFn(dart.functionType(core.int, [html$.Element, html$.Element])))();
   let ElementTobool = () => (ElementTobool = dart.constFn(dart.functionType(core.bool, [html$.Element])))();
@@ -443,13 +542,14 @@
   let _EventStreamOfEvent = () => (_EventStreamOfEvent = dart.constFn(html$._EventStream$(html$.Event)))();
   let _ElementEventStreamImplOfEvent = () => (_ElementEventStreamImplOfEvent = dart.constFn(html$._ElementEventStreamImpl$(html$.Event)))();
   let CompleterOfFileWriter = () => (CompleterOfFileWriter = dart.constFn(async.Completer$(html$.FileWriter)))();
-  let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(html$.File)))();
+  let CompleterOfFile$ = () => (CompleterOfFile$ = dart.constFn(async.Completer$(html$.File)))();
   let ListOfFontFace = () => (ListOfFontFace = dart.constFn(core.List$(html$.FontFace)))();
   let ListOfGamepadButton = () => (ListOfGamepadButton = dart.constFn(core.List$(html$.GamepadButton)))();
   let CompleterOfGeoposition = () => (CompleterOfGeoposition = dart.constFn(async.Completer$(html$.Geoposition)))();
   let StreamControllerOfGeoposition = () => (StreamControllerOfGeoposition = dart.constFn(async.StreamController$(html$.Geoposition)))();
   let _CustomEventStreamProviderOfEvent = () => (_CustomEventStreamProviderOfEvent = dart.constFn(html$._CustomEventStreamProvider$(html$.Event)))();
   let CompleterOfHttpRequest = () => (CompleterOfHttpRequest = dart.constFn(async.Completer$(html$.HttpRequest)))();
+  let dynamicToNull = () => (dynamicToNull = dart.constFn(dart.functionType(core.Null, [dart.dynamic])))();
   let ProgressEventTovoid = () => (ProgressEventTovoid = dart.constFn(dart.functionType(dart.void, [html$.ProgressEvent])))();
   let ListOfMap = () => (ListOfMap = dart.constFn(core.List$(core.Map)))();
   let ListOfMediaStreamTrack = () => (ListOfMediaStreamTrack = dart.constFn(core.List$(html$.MediaStreamTrack)))();
@@ -458,6 +558,7 @@
   let EventStreamProviderOfMidiMessageEvent = () => (EventStreamProviderOfMidiMessageEvent = dart.constFn(html$.EventStreamProvider$(html$.MidiMessageEvent)))();
   let ListOfMimeType = () => (ListOfMimeType = dart.constFn(core.List$(html$.MimeType)))();
   let ListOfMutationRecord = () => (ListOfMutationRecord = dart.constFn(core.List$(html$.MutationRecord)))();
+  let _wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void = () => (_wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void = dart.constFn(html$._wrapZoneBinaryCallback$(ListOfMutationRecord(), html$.MutationObserver, dart.void)))();
   let MapOfString$bool = () => (MapOfString$bool = dart.constFn(core.Map$(core.String, core.bool)))();
   let CompleterOfMediaStream = () => (CompleterOfMediaStream = dart.constFn(async.Completer$(html$.MediaStream)))();
   let NodeTobool = () => (NodeTobool = dart.constFn(dart.functionType(core.bool, [html$.Node])))();
@@ -465,7 +566,6 @@
   let ListOfPlugin = () => (ListOfPlugin = dart.constFn(core.List$(html$.Plugin)))();
   let EventStreamProviderOfRtcDtmfToneChangeEvent = () => (EventStreamProviderOfRtcDtmfToneChangeEvent = dart.constFn(html$.EventStreamProvider$(html$.RtcDtmfToneChangeEvent)))();
   let JSArrayOfMapOfString$String = () => (JSArrayOfMapOfString$String = dart.constFn(_interceptors.JSArray$(MapOfString$String())))();
-  let ListOfMapOfString$String = () => (ListOfMapOfString$String = dart.constFn(core.List$(MapOfString$String())))();
   let CompleterOfRtcSessionDescription = () => (CompleterOfRtcSessionDescription = dart.constFn(async.Completer$(html$.RtcSessionDescription)))();
   let CompleterOfRtcStatsResponse = () => (CompleterOfRtcStatsResponse = dart.constFn(async.Completer$(html$.RtcStatsResponse)))();
   let EventStreamProviderOfMediaStreamEvent = () => (EventStreamProviderOfMediaStreamEvent = dart.constFn(html$.EventStreamProvider$(html$.MediaStreamEvent)))();
@@ -496,6 +596,7 @@
   let EventStreamProviderOfDeviceOrientationEvent = () => (EventStreamProviderOfDeviceOrientationEvent = dart.constFn(html$.EventStreamProvider$(html$.DeviceOrientationEvent)))();
   let EventStreamProviderOfAnimationEvent = () => (EventStreamProviderOfAnimationEvent = dart.constFn(html$.EventStreamProvider$(html$.AnimationEvent)))();
   let EventStreamProviderOfBeforeUnloadEvent = () => (EventStreamProviderOfBeforeUnloadEvent = dart.constFn(html$.EventStreamProvider$(html$.BeforeUnloadEvent)))();
+  let _EventStreamOfBeforeUnloadEvent = () => (_EventStreamOfBeforeUnloadEvent = dart.constFn(html$._EventStream$(html$.BeforeUnloadEvent)))();
   let StreamControllerOfBeforeUnloadEvent = () => (StreamControllerOfBeforeUnloadEvent = dart.constFn(async.StreamController$(html$.BeforeUnloadEvent)))();
   let _ElementEventStreamImplOfBeforeUnloadEvent = () => (_ElementEventStreamImplOfBeforeUnloadEvent = dart.constFn(html$._ElementEventStreamImpl$(html$.BeforeUnloadEvent)))();
   let _ElementListEventStreamImplOfBeforeUnloadEvent = () => (_ElementListEventStreamImplOfBeforeUnloadEvent = dart.constFn(html$._ElementListEventStreamImpl$(html$.BeforeUnloadEvent)))();
@@ -545,6 +646,7 @@
   let dynamicTodynamic$ = () => (dynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))();
   let StringAndStringToint = () => (StringAndStringToint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.String])))();
   let VoidTo_MethodStats = () => (VoidTo_MethodStats = dart.constFn(dart.definiteFunctionType(dart._MethodStats, [])))();
+  let VoidToFunctionType = () => (VoidToFunctionType = dart.constFn(dart.definiteFunctionType(dart.FunctionType, [])))();
   let dynamicToString = () => (dynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic])))();
   let dynamicToListOfString = () => (dynamicToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [dart.dynamic])))();
   let dynamicToList = () => (dynamicToList = dart.constFn(dart.definiteFunctionType(core.List, [dart.dynamic])))();
@@ -553,13 +655,12 @@
   let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
   let dynamicAnddynamicToString = () => (dynamicAnddynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic])))();
   let dynamicAndStringTobool = () => (dynamicAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, core.String])))();
-  let intAnddynamicTovoid = () => (intAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, dart.dynamic])))();
+  let intAnddynamicToNull = () => (intAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.int, dart.dynamic])))();
   let ObjectAndObjectToObject = () => (ObjectAndObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object, core.Object])))();
   let StringTobool$ = () => (StringTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))();
   let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
-  let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
-  let StringAndObjectTovoid = () => (StringAndObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Object])))();
-  let dynamicAnddynamicTovoid$ = () => (dynamicAnddynamicTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])))();
+  let dynamicAnddynamicToNull = () => (dynamicAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, dart.dynamic])))();
+  let StringAndObjectToNull = () => (StringAndObjectToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.Object])))();
   let StringToNameValuePair = () => (StringToNameValuePair = dart.constFn(dart.definiteFunctionType(_debugger.NameValuePair, [core.String])))();
   let VoidTodynamic$ = () => (VoidTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
   let StringAndString__Todynamic = () => (StringAndString__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -573,18 +674,22 @@
   let FunctionTovoid = () => (FunctionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Function])))();
   let StringAndStringToString$ = () => (StringAndStringToString$ = dart.constFn(dart.definiteFunctionType(core.String, [core.String, core.String])))();
   let TypeAndStringTodynamic = () => (TypeAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.String])))();
+  let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
   let dynamicAnddynamicToint = () => (dynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])))();
   let ListOfEToListOfE = () => (ListOfEToListOfE = dart.constFn(dart.definiteFunctionType(E => [core.List$(E), [core.List$(E)]])))();
   let StringTovoid$ = () => (StringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
   let _IsolateContextAndFunctionTodynamic = () => (_IsolateContextAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_isolate_helper._IsolateContext, core.Function])))();
   let VoidTobool = () => (VoidTobool = dart.constFn(dart.definiteFunctionType(core.bool, [])))();
   let VoidTo_IsolateContext = () => (VoidTo_IsolateContext = dart.constFn(dart.definiteFunctionType(_isolate_helper._IsolateContext, [])))();
+  let VoidToNull = () => (VoidToNull = dart.constFn(dart.definiteFunctionType(core.Null, [])))();
+  let dynamicAnddynamicTovoid$ = () => (dynamicAnddynamicTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])))();
   let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
-  let ListTodynamic = () => (ListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.List])))();
-  let StringTodynamic = () => (StringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String])))();
-  let TimerTovoid$ = () => (TimerTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [async.Timer])))();
+  let ListToNull = () => (ListToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.List])))();
+  let StringToNull = () => (StringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String])))();
+  let dynamicToNull$ = () => (dynamicToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic])))();
+  let TimerToNull = () => (TimerToNull = dart.constFn(dart.definiteFunctionType(core.Null, [async.Timer])))();
   let dynamicToFuture = () => (dynamicToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [dart.dynamic])))();
-  let boolTodynamic = () => (boolTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.bool])))();
+  let boolToNull = () => (boolToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.bool])))();
   let dynamicAndStackTraceTovoid = () => (dynamicAndStackTraceTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])))();
   let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
   let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core.int, [])))();
@@ -627,7 +732,7 @@
   let dynamicToSymbol = () => (dynamicToSymbol = dart.constFn(dart.definiteFunctionType(core.Symbol, [dart.dynamic])))();
   let dynamicToMapOfSymbol$dynamic = () => (dynamicToMapOfSymbol$dynamic = dart.constFn(dart.definiteFunctionType(MapOfSymbol$dynamic(), [dart.dynamic])))();
   let TypeAndInvocationTodynamic = () => (TypeAndInvocationTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.Invocation])))();
-  let SymbolAnddynamicTovoid = () => (SymbolAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Symbol, dart.dynamic])))();
+  let SymbolAnddynamicToNull = () => (SymbolAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.Symbol, dart.dynamic])))();
   let MapOfSymbol$dynamicTodynamic = () => (MapOfSymbol$dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [MapOfSymbol$dynamic()])))();
   let dynamicToTypeMirror = () => (dynamicToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [dart.dynamic])))();
   let dynamicAnddynamicAnddynamicTovoid = () => (dynamicAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -640,12 +745,12 @@
   let VoidToObject$ = () => (VoidToObject$ = dart.constFn(dart.definiteFunctionType(core.Object, [])))();
   let _FutureAnddynamicAnddynamicTovoid = () => (_FutureAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async._Future, dart.dynamic, dart.dynamic])))();
   let ObjectToObject = () => (ObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object])))();
-  let dynamic__Todynamic = () => (dynamic__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], [dart.dynamic])))();
+  let dynamic__ToNull = () => (dynamic__ToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [dart.dynamic])))();
   let dynamicTo_Future = () => (dynamicTo_Future = dart.constFn(dart.definiteFunctionType(async._Future, [dart.dynamic])))();
   let _AsyncCallbackTovoid = () => (_AsyncCallbackTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async._AsyncCallback])))();
-  let FnTodynamic = () => (FnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTovoid()])))();
+  let FnToNull = () => (FnToNull = dart.constFn(dart.definiteFunctionType(core.Null, [VoidTovoid()])))();
   let _NotificationHandlerToFuture = () => (_NotificationHandlerToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [async._NotificationHandler])))();
-  let dynamicAndStackTraceTodynamic = () => (dynamicAndStackTraceTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.StackTrace])))();
+  let dynamicAndStackTraceToNull = () => (dynamicAndStackTraceToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, core.StackTrace])))();
   let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace])))();
   let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), ZoneBinaryCallbackOfdynamic$dynamic$StackTrace()])))();
   let StreamSubscriptionAnd_FutureAnddynamic__Tovoid = () => (StreamSubscriptionAnd_FutureAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic, core.StackTrace])))();
@@ -686,10 +791,11 @@
   let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
   let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
   let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
-  let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
+  let StringAnddynamicToNull = () => (StringAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, dart.dynamic])))();
   let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
   let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
   let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
+  let StringAndStringToNull = () => (StringAndStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.String])))();
   let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
   let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
   let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
@@ -704,9 +810,107 @@
   let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
   let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
   let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
+  let dynamicAndStringAndStringTodynamic = () => (dynamicAndStringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])))();
+  let ListAndintAndintTo_BufferAndStart = () => (ListAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int, core.int])))();
+  let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))();
+  let DirectoryToFutureOfDirectory = () => (DirectoryToFutureOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOfDirectory(), [io.Directory])))();
+  let boolToFutureOrOfDirectory = () => (boolToFutureOrOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOrOfDirectory(), [core.bool])))();
+  let dynamicTo_Directory = () => (dynamicTo_Directory = dart.constFn(dart.definiteFunctionType(io._Directory, [dart.dynamic])))();
+  let dynamicToDirectory = () => (dynamicToDirectory = dart.constFn(dart.definiteFunctionType(io.Directory, [dart.dynamic])))();
+  let dynamicToFutureOrOfString = () => (dynamicToFutureOrOfString = dart.constFn(dart.definiteFunctionType(FutureOrOfString(), [dart.dynamic])))();
+  let dynamicToFutureOrOfbool = () => (dynamicToFutureOrOfbool = dart.constFn(dart.definiteFunctionType(FutureOrOfbool(), [dart.dynamic])))();
+  let dynamicToFutureOrOfint = () => (dynamicToFutureOrOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfint(), [dart.dynamic])))();
+  let ListOfintToNull = () => (ListOfintToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfint()])))();
+  let RandomAccessFileTovoid = () => (RandomAccessFileTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.RandomAccessFile])))();
+  let RandomAccessFileToFutureOr = () => (RandomAccessFileToFutureOr = dart.constFn(dart.definiteFunctionType(async.FutureOr, [io.RandomAccessFile])))();
+  let RandomAccessFileToNull = () => (RandomAccessFileToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RandomAccessFile])))();
+  let RandomAccessFileToFutureOfRandomAccessFile = () => (RandomAccessFileToFutureOfRandomAccessFile = dart.constFn(dart.definiteFunctionType(FutureOfRandomAccessFile(), [io.RandomAccessFile])))();
+  let dynamicTo_File = () => (dynamicTo_File = dart.constFn(dart.definiteFunctionType(io._File, [dart.dynamic])))();
+  let FileSystemEntityTo_File = () => (FileSystemEntityTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.FileSystemEntity])))();
+  let dynamicToFile = () => (dynamicToFile = dart.constFn(dart.definiteFunctionType(io.File, [dart.dynamic])))();
+  let dynamicTo_RandomAccessFile = () => (dynamicTo_RandomAccessFile = dart.constFn(dart.definiteFunctionType(io._RandomAccessFile, [dart.dynamic])))();
+  let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
+  let dynamicToFutureOfListOfint = () => (dynamicToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [dart.dynamic])))();
+  let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
+  let RandomAccessFileToFutureOfListOfint = () => (RandomAccessFileToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [io.RandomAccessFile])))();
+  let ListOfintToString = () => (ListOfintToString = dart.constFn(dart.definiteFunctionType(core.String, [ListOfint()])))();
+  let RandomAccessFileTo_File = () => (RandomAccessFileTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.RandomAccessFile])))();
+  let RandomAccessFileToObject = () => (RandomAccessFileToObject = dart.constFn(dart.definiteFunctionType(core.Object, [io.RandomAccessFile])))();
+  let RandomAccessFileToFutureOrOfFile = () => (RandomAccessFileToFutureOrOfFile = dart.constFn(dart.definiteFunctionType(FutureOrOfFile(), [io.RandomAccessFile])))();
+  let dynamicToFutureOrOfListOfint = () => (dynamicToFutureOrOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfListOfint(), [dart.dynamic])))();
+  let dynamicToFileStat = () => (dynamicToFileStat = dart.constFn(dart.definiteFunctionType(io.FileStat, [dart.dynamic])))();
+  let StringAndListOfStringToListOfString = () => (StringAndListOfStringToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String, ListOfString()])))();
+  let ListOfintTovoid$ = () => (ListOfintTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
+  let StringAndListOfStringToNull = () => (StringAndListOfStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, ListOfString()])))();
+  let CookieToString = () => (CookieToString = dart.constFn(dart.definiteFunctionType(core.String, [io.Cookie])))();
+  let CookieTobool = () => (CookieTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io.Cookie])))();
+  let _HttpClientRequestToFutureOfHttpClientResponse = () => (_HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io._HttpClientRequest])))();
+  let dynamicToFutureOfHttpClientResponse = () => (dynamicToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [dart.dynamic])))();
+  let VoidToFutureOfHttpClientResponse = () => (VoidToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [])))();
+  let VoidToListOfString = () => (VoidToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [])))();
+  let _AuthenticationSchemeTo_Credentials = () => (_AuthenticationSchemeTo_Credentials = dart.constFn(dart.definiteFunctionType(io._Credentials, [io._AuthenticationScheme])))();
+  let _CredentialsTovoid = () => (_CredentialsTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io._Credentials])))();
+  let _AuthenticationSchemeAndStringToFuture = () => (_AuthenticationSchemeAndStringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [io._AuthenticationScheme, core.String])))();
+  let dynamicToFutureOrOfHttpClientResponse = () => (dynamicToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [dart.dynamic])))();
+  let CookieToNull = () => (CookieToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Cookie])))();
+  let ListToFutureOrOfHttpClientResponse = () => (ListToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [core.List])))();
+  let HttpClientResponseTovoid = () => (HttpClientResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.HttpClientResponse])))();
+  let dynamicToIterable = () => (dynamicToIterable = dart.constFn(dart.definiteFunctionType(core.Iterable, [dart.dynamic])))();
+  let dynamicTo_HttpOutboundMessage = () => (dynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic])))();
+  let dynamicAnddynamicTo_HttpOutboundMessage = () => (dynamicAnddynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic, dart.dynamic])))();
+  let dynamic__ToNull$ = () => (dynamic__ToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [core.StackTrace])))();
+  let _HttpIncomingToNull = () => (_HttpIncomingToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpIncoming])))();
+  let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
+  let SecureSocketTo_HttpClientConnection = () => (SecureSocketTo_HttpClientConnection = dart.constFn(dart.definiteFunctionType(io._HttpClientConnection, [io.SecureSocket])))();
+  let HttpClientResponseToFutureOfSecureSocket = () => (HttpClientResponseToFutureOfSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfSecureSocket(), [io.HttpClientResponse])))();
+  let X509CertificateTobool$ = () => (X509CertificateTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [io.X509Certificate])))();
+  let _HttpClientConnectionTo_ConnectionInfo = () => (_HttpClientConnectionTo_ConnectionInfo = dart.constFn(dart.definiteFunctionType(io._ConnectionInfo, [io._HttpClientConnection])))();
+  let dynamicToFutureOrOf_ConnectionInfo = () => (dynamicToFutureOrOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOrOf_ConnectionInfo(), [dart.dynamic])))();
+  let _ConnectionTargetTobool = () => (_ConnectionTargetTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io._ConnectionTarget])))();
+  let _ConnectionInfoTo_HttpClientRequest = () => (_ConnectionInfoTo_HttpClientRequest = dart.constFn(dart.definiteFunctionType(io._HttpClientRequest, [io._ConnectionInfo])))();
+  let _ConnectionInfoToFutureOrOf_HttpClientRequest = () => (_ConnectionInfoToFutureOrOf_HttpClientRequest = dart.constFn(dart.definiteFunctionType(FutureOrOf_HttpClientRequest(), [io._ConnectionInfo])))();
+  let _HttpClientRequestTo_HttpClientRequest = () => (_HttpClientRequestTo_HttpClientRequest = dart.constFn(dart.definiteFunctionType(io._HttpClientRequest, [io._HttpClientRequest])))();
+  let VoidTo_ConnectionTarget = () => (VoidTo_ConnectionTarget = dart.constFn(dart.definiteFunctionType(io._ConnectionTarget, [])))();
+  let dynamicToFutureOf_ConnectionInfo = () => (dynamicToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [dart.dynamic])))();
+  let VoidToFutureOf_ConnectionInfo = () => (VoidToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [])))();
+  let _SiteCredentialsAnd_CredentialsTo_SiteCredentials = () => (_SiteCredentialsAnd_CredentialsTo_SiteCredentials = dart.constFn(dart.definiteFunctionType(io._SiteCredentials, [io._SiteCredentials, io._Credentials])))();
+  let ServerSocketTo_HttpServer = () => (ServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.ServerSocket])))();
+  let SecureServerSocketTo_HttpServer = () => (SecureServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.SecureServerSocket])))();
+  let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
+  let _HttpConnectionToNull = () => (_HttpConnectionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpConnection])))();
+  let _HttpConnectionToMap = () => (_HttpConnectionToMap = dart.constFn(dart.definiteFunctionType(core.Map, [io._HttpConnection])))();
+  let _FileResourceInfoToMapOfString$String = () => (_FileResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._FileResourceInfo])))();
+  let _ProcessResourceInfoToMapOfString$String = () => (_ProcessResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._ProcessResourceInfo])))();
+  let _SocketResourceInfoToMapOfString$String = () => (_SocketResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._SocketResourceInfo])))();
+  let dynamicTo_Link = () => (dynamicTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [dart.dynamic])))();
+  let FileSystemEntityToFutureOfLink = () => (FileSystemEntityToFutureOfLink = dart.constFn(dart.definiteFunctionType(FutureOfLink(), [io.FileSystemEntity])))();
+  let FileSystemEntityTo_Link = () => (FileSystemEntityTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [io.FileSystemEntity])))();
+  let dynamicToLink = () => (dynamicToLink = dart.constFn(dart.definiteFunctionType(io.Link, [dart.dynamic])))();
+  let DurationTovoid = () => (DurationTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Duration])))();
+  let RawSecureServerSocketToSecureServerSocket = () => (RawSecureServerSocketToSecureServerSocket = dart.constFn(dart.definiteFunctionType(io.SecureServerSocket, [io.RawSecureServerSocket])))();
+  let RawSecureSocketToSecureSocket = () => (RawSecureSocketToSecureSocket = dart.constFn(dart.definiteFunctionType(io.SecureSocket, [io.RawSecureSocket])))();
+  let dynamicToFutureOfRawSecureSocket = () => (dynamicToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [dart.dynamic])))();
+  let RawServerSocketToRawSecureServerSocket = () => (RawServerSocketToRawSecureServerSocket = dart.constFn(dart.definiteFunctionType(io.RawSecureServerSocket, [io.RawServerSocket])))();
+  let RawSecureSocketToNull = () => (RawSecureSocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RawSecureSocket])))();
+  let RawSocketToFutureOfRawSecureSocket = () => (RawSocketToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [io.RawSocket])))();
+  let _FilterStatusToNull = () => (_FilterStatusToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._FilterStatus])))();
+  let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
+  let dynamicTo_FilterStatus = () => (dynamicTo_FilterStatus = dart.constFn(dart.definiteFunctionType(io._FilterStatus, [dart.dynamic])))();
+  let ListOfintAndStringTovoid = () => (ListOfintAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint(), core.String])))();
+  let dynamicToStdioType = () => (dynamicToStdioType = dart.constFn(dart.definiteFunctionType(io.StdioType, [dart.dynamic])))();
+  let EventSinkTo_WebSocketProtocolTransformer = () => (EventSinkTo_WebSocketProtocolTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketProtocolTransformer, [async.EventSink])))();
+  let WebSocketTovoid = () => (WebSocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.WebSocket])))();
+  let HttpRequestToNull = () => (HttpRequestToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.HttpRequest])))();
+  let SocketTo_WebSocketImpl = () => (SocketTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [io.Socket])))();
+  let StringToFuture = () => (StringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [core.String])))();
+  let EventSinkOfListOfintTo_WebSocketOutgoingTransformer = () => (EventSinkOfListOfintTo_WebSocketOutgoingTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [EventSinkOfListOfint()])))();
+  let dynamicTo_WebSocketImpl = () => (dynamicTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic])))();
+  let HttpClientResponseToFutureOfWebSocket = () => (HttpClientResponseToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [io.HttpClientResponse])))();
+  let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
+  let HttpClientRequestToFutureOfHttpClientResponse = () => (HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io.HttpClientRequest])))();
+  let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
   let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
   let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
-  let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
   let dynamicAnddynamicAndFnToObject = () => (dynamicAnddynamicAndFnToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic, dart.dynamic, dynamicTodynamic()])))();
   let FToF = () => (FToF = dart.constFn(dart.definiteFunctionType(F => [F, [F]])))();
   let FunctionToFunction = () => (FunctionToFunction = dart.constFn(dart.definiteFunctionType(core.Function, [core.Function])))();
@@ -721,35 +925,35 @@
   let VoidToMirrorSystem = () => (VoidToMirrorSystem = dart.constFn(dart.definiteFunctionType(mirrors.MirrorSystem, [])))();
   let ObjectToInstanceMirror = () => (ObjectToInstanceMirror = dart.constFn(dart.definiteFunctionType(mirrors.InstanceMirror, [core.Object])))();
   let TypeToClassMirror = () => (TypeToClassMirror = dart.constFn(dart.definiteFunctionType(mirrors.ClassMirror, [core.Type])))();
-  let EventTovoid$ = () => (EventTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Event])))();
+  let EventToNull = () => (EventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Event])))();
   let RequestToFutureOfT = () => (RequestToFutureOfT = dart.constFn(dart.definiteFunctionType(T => [async.Future$(T), [indexed_db.Request]])))();
   let dynamicToTo = () => (dynamicToTo = dart.constFn(dart.definiteFunctionType(To => [To, [dart.dynamic]])))();
-  let EventTodynamic = () => (EventTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.Event])))();
   let NodeTobool$ = () => (NodeTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [html$.Node])))();
   let MapOfString$dynamicTobool = () => (MapOfString$dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [MapOfString$dynamic()])))();
   let UriAndListOfStringAnddynamicToFutureOfIsolate = () => (UriAndListOfStringAnddynamicToFutureOfIsolate = dart.constFn(dart.definiteFunctionType(FutureOfIsolate(), [core.Uri, ListOfString(), dart.dynamic])))();
   let TypeAnddynamicTodynamic = () => (TypeAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, dart.dynamic])))();
-  let FileSystemTovoid = () => (FileSystemTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.FileSystem])))();
-  let FileErrorTovoid = () => (FileErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.FileError])))();
-  let EntryTovoid = () => (EntryTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Entry])))();
+  let FileSystemToNull = () => (FileSystemToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.FileSystem])))();
+  let FileErrorToNull = () => (FileErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.FileError])))();
+  let EntryToNull = () => (EntryToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Entry])))();
   let dynamicToCssStyleDeclaration = () => (dynamicToCssStyleDeclaration = dart.constFn(dart.definiteFunctionType(html$.CssStyleDeclaration, [dart.dynamic])))();
   let CssStyleDeclarationTovoid = () => (CssStyleDeclarationTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.CssStyleDeclaration])))();
-  let MetadataTovoid = () => (MetadataTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Metadata])))();
-  let ListOfEntryTovoid = () => (ListOfEntryTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfEntry()])))();
+  let MetadataToNull = () => (MetadataToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Metadata])))();
+  let ListOfEntryToNull = () => (ListOfEntryToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfEntry()])))();
   let ElementTobool$ = () => (ElementTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [html$.Element])))();
-  let FileWriterTovoid = () => (FileWriterTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.FileWriter])))();
-  let FileTovoid = () => (FileTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.File])))();
-  let GeopositionTovoid = () => (GeopositionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Geoposition])))();
-  let PositionErrorTovoid = () => (PositionErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.PositionError])))();
+  let FileWriterToNull = () => (FileWriterToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.FileWriter])))();
+  let FileToNull = () => (FileToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.File])))();
+  let GeopositionToNull = () => (GeopositionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Geoposition])))();
+  let PositionErrorToNull = () => (PositionErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.PositionError])))();
   let HttpRequestToString = () => (HttpRequestToString = dart.constFn(dart.definiteFunctionType(core.String, [html$.HttpRequest])))();
-  let ProgressEventTovoid$ = () => (ProgressEventTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [html$.ProgressEvent])))();
-  let ListOfSourceInfoTovoid = () => (ListOfSourceInfoTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfSourceInfo()])))();
-  let MediaStreamTovoid = () => (MediaStreamTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.MediaStream])))();
-  let NavigatorUserMediaErrorTovoid = () => (NavigatorUserMediaErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.NavigatorUserMediaError])))();
-  let RtcSessionDescriptionTovoid = () => (RtcSessionDescriptionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.RtcSessionDescription])))();
-  let RtcStatsResponseTovoid = () => (RtcStatsResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.RtcStatsResponse])))();
+  let ProgressEventToNull = () => (ProgressEventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.ProgressEvent])))();
+  let ListOfSourceInfoToNull = () => (ListOfSourceInfoToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfSourceInfo()])))();
+  let MediaStreamToNull = () => (MediaStreamToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.MediaStream])))();
+  let NavigatorUserMediaErrorToNull = () => (NavigatorUserMediaErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.NavigatorUserMediaError])))();
+  let RtcSessionDescriptionToNull = () => (RtcSessionDescriptionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.RtcSessionDescription])))();
+  let RtcStatsResponseToNull = () => (RtcStatsResponseToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.RtcStatsResponse])))();
   let OptionElementTobool = () => (OptionElementTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.OptionElement])))();
-  let numTovoid = () => (numTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.num])))();
+  let numToNull = () => (numToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.num])))();
+  let BeforeUnloadEventToNull = () => (BeforeUnloadEventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.BeforeUnloadEvent])))();
   let ElementTovoid$ = () => (ElementTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Element])))();
   let ElementToCssClassSet = () => (ElementToCssClassSet = dart.constFn(dart.definiteFunctionType(html$.CssClassSet, [html$.Element])))();
   let CssClassSetImplTovoid = () => (CssClassSetImplTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html_common.CssClassSetImpl])))();
@@ -757,6 +961,7 @@
   let SetOfStringTobool = () => (SetOfStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [SetOfString()])))();
   let SetOfStringTovoid = () => (SetOfStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [SetOfString()])))();
   let EventAndStringTobool = () => (EventAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.Event, core.String])))();
+  let EventTodynamic = () => (EventTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.Event])))();
   let KeyEventTobool = () => (KeyEventTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.KeyEvent])))();
   let NodeValidatorTobool = () => (NodeValidatorTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.NodeValidator])))();
   let NodeAndNodeToint = () => (NodeAndNodeToint = dart.constFn(dart.definiteFunctionType(core.int, [html$.Node, html$.Node])))();
@@ -772,14 +977,12 @@
   let NodeAndNodeTovoid = () => (NodeAndNodeTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Node, html$.Node])))();
   let dynamicToImageData = () => (dynamicToImageData = dart.constFn(dart.definiteFunctionType(html$.ImageData, [dart.dynamic])))();
   let ImageDataTodynamic = () => (ImageDataTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.ImageData])))();
-  let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
   let Map__Todynamic = () => (Map__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Map], [dynamicTovoid()])))();
   let ListOfStringToList = () => (ListOfStringToList = dart.constFn(dart.definiteFunctionType(core.List, [ListOfString()])))();
-  let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
   let DateTimeTodynamic = () => (DateTimeTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.DateTime])))();
-  let dynamic__Todynamic$ = () => (dynamic__Todynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], {mustCopy: dart.dynamic})))();
+  let dynamic__Todynamic = () => (dynamic__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], {mustCopy: dart.dynamic})))();
   let NodeToElement = () => (NodeToElement = dart.constFn(dart.definiteFunctionType(html$.Element, [html$.Node])))();
-  let AudioBufferTovoid = () => (AudioBufferTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [web_audio.AudioBuffer])))();
+  let AudioBufferToNull = () => (AudioBufferToNull = dart.constFn(dart.definiteFunctionType(core.Null, [web_audio.AudioBuffer])))();
   dart.mixin = function(base, ...mixins) {
     class Mixin extends base {}
     for (let m of mixins) {
@@ -798,6 +1001,27 @@
           dart.copyProperties(s, m[dart._methodSig]);
         }
         return s;
+      },
+      fields: () => {
+        let s = {};
+        for (let m of mixins) {
+          dart.copyProperties(s, m[dart._fieldSig]);
+        }
+        return s;
+      },
+      getters: () => {
+        let s = {};
+        for (let m of mixins) {
+          dart.copyProperties(s, m[dart._getterSig]);
+        }
+        return s;
+      },
+      setters: () => {
+        let s = {};
+        for (let m of mixins) {
+          dart.copyProperties(s, m[dart._setterSig]);
+        }
+        return s;
       }
     });
     Mixin[dart._mixins] = mixins;
@@ -900,15 +1124,33 @@
   dart.getGenericTypeCtor = function(value) {
     return value[dart._genericTypeCtor];
   };
-  dart.getMethodType = function(obj, name) {
-    let type = obj == null ? core.Object : obj.__proto__.constructor;
-    return dart.getMethodTypeFromType(type, name);
+  dart.getType = function(obj) {
+    return obj == null ? core.Object : obj.__proto__.constructor;
   };
-  dart.getMethodTypeFromType = function(type, name) {
+  dart.isJsInterop = function(obj) {
+    if (typeof obj === "function") {
+      return dart._getRuntimeType(obj) == null;
+    }
+    if (typeof obj !== "object") return false;
+    if (dart.getExtensionType(obj) != null) return false;
+    return !(obj instanceof core.Object);
+  };
+  dart.getMethodType = function(type, name) {
     let sigObj = type[dart._methodSig];
     if (sigObj === void 0) return void 0;
     return sigObj[name];
   };
+  dart.getFieldType = function(type, name) {
+    let sigObj = type[dart._fieldSig];
+    if (sigObj === void 0) return void 0;
+    let fieldType = sigObj[name];
+    return fieldType instanceof Array ? fieldType[0] : fieldType;
+  };
+  dart.getSetterType = function(type, name) {
+    let sigObj = type[dart._setterSig];
+    if (sigObj === void 0) return void 0;
+    return sigObj[name];
+  };
   dart.classGetConstructorType = function(cls, name) {
     if (!name) name = 'new';
     if (cls === void 0) return void 0;
@@ -920,7 +1162,7 @@
   dart.bind = function(obj, name, f) {
     if (f === void 0) f = obj[name];
     f = f.bind(obj);
-    let sig = dart.getMethodType(obj, name);
+    let sig = dart.getMethodType(dart.getType(obj), name);
     dart.assert(sig);
     dart.tag(f, sig);
     return f;
@@ -934,7 +1176,8 @@
   dart._setInstanceSignature = function(f, sigF, kind) {
     dart.defineMemoizedGetter(f, kind, () => {
       let sigObj = sigF();
-      sigObj.__proto__ = f.__proto__[kind];
+      let proto = f.__proto__;
+      sigObj.__proto__ = kind in proto ? proto[kind] : null;
       return sigObj;
     });
   };
@@ -995,8 +1238,22 @@
     dart._setStaticSetterSignature(f, staticSetters);
     dart._setStaticTypes(f, names);
   };
-  dart.hasMethod = function(obj, name) {
-    return dart.getMethodType(obj, name) !== void 0;
+  dart._hasSigEntry = function(type, sigF, name) {
+    let sigObj = type[sigF];
+    if (sigObj === void 0) return false;
+    return name in sigObj;
+  };
+  dart.hasMethod = function(type, name) {
+    return dart._hasSigEntry(type, dart._methodSig, name);
+  };
+  dart.hasGetter = function(type, name) {
+    return dart._hasSigEntry(type, dart._getterSig, name);
+  };
+  dart.hasSetter = function(type, name) {
+    return dart._hasSigEntry(type, dart._setterSig, name);
+  };
+  dart.hasField = function(type, name) {
+    return dart._hasSigEntry(type, dart._fieldSig, name);
   };
   dart.defineNamedConstructor = function(clazz, name) {
     let proto = clazz.prototype;
@@ -1057,9 +1314,15 @@
     if (!jsProto) return;
     jsProto[dart._extensionType] = dartExtType;
     dart._installProperties(jsProto, extProto);
-    let originalSigFn = dart.getOwnPropertyDescriptor(dartExtType, dart._methodSig).get;
-    dart.assert(originalSigFn);
-    dart.defineMemoizedGetter(jsType, dart._methodSig, originalSigFn);
+    function updateSig(sigF) {
+      let originalSigFn = dart.getOwnPropertyDescriptor(dartExtType, sigF).get;
+      dart.assert(originalSigFn);
+      dart.defineMemoizedGetter(jsType, sigF, originalSigFn);
+    }
+    updateSig(dart._methodSig);
+    updateSig(dart._fieldSig);
+    updateSig(dart._getterSig);
+    updateSig(dart._setterSig);
   };
   dart.defineExtensionMembers = function(type, methodNames) {
     let proto = type.prototype;
@@ -1067,14 +1330,23 @@
       let method = dart.getOwnPropertyDescriptor(proto, name);
       dart.defineProperty(proto, dart.getExtensionSymbol(name), method);
     }
-    let originalSigFn = dart.getOwnPropertyDescriptor(type, dart._methodSig).get;
-    dart.defineMemoizedGetter(type, dart._methodSig, function() {
-      let sig = originalSigFn();
-      for (let name of methodNames) {
-        sig[dart.getExtensionSymbol(name)] = sig[name];
-      }
-      return sig;
-    });
+    function upgradeSig(sigF) {
+      let originalSigFn = dart.getOwnPropertyDescriptor(type, sigF).get;
+      dart.defineMemoizedGetter(type, sigF, function() {
+        let sig = originalSigFn();
+        let propertyNames = Object.getOwnPropertyNames(sig);
+        for (let name of methodNames) {
+          if (name in sig) {
+            sig[dart.getExtensionSymbol(name)] = sig[name];
+          }
+        }
+        return sig;
+      });
+    }
+    upgradeSig(dart._methodSig);
+    upgradeSig(dart._fieldSig);
+    upgradeSig(dart._getterSig);
+    upgradeSig(dart._setterSig);
   };
   dart.setType = function(obj, type) {
     obj.__proto__ = type.prototype;
@@ -1190,7 +1462,7 @@
   };
   const _wrappedType = Symbol('_wrappedType');
   dart.unwrapType = function(obj) {
-    return dart.dload(obj, _wrappedType);
+    return obj[_wrappedType];
   };
   dart._getRuntimeType = function(value) {
     return value[dart._runtimeType];
@@ -1275,6 +1547,65 @@
       return dart._asInstanceOfLazyJSType(object, this);
     };
   };
+  dart._memoizeArray = function(map, arr, create) {
+    let len = arr.length;
+    map = dart._lookupNonTerminal(map, len);
+    for (var i = 0; i < len - 1; ++i) {
+      map = dart._lookupNonTerminal(map, arr[i]);
+    }
+    let result = map.get(arr[len - 1]);
+    if (result !== void 0) return result;
+    map.set(arr[len - 1], result = create());
+    return result;
+  };
+  dart._normalizeParameter = function(a) {
+    if (a instanceof Array) {
+      let result = [];
+      result.push(a[0] == dart.dynamic ? dart.bottom : a[0]);
+      result.push(a.slice(1));
+      return result;
+    }
+    return a == dart.dynamic ? dart.bottom : a;
+  };
+  dart._canonicalizeArray = function(definite, array, map) {
+    let arr = definite ? array : array.map(dart._normalizeParameter);
+    return dart._memoizeArray(map, arr, () => arr);
+  };
+  dart._canonicalizeNamed = function(definite, named, map) {
+    let key = [];
+    let names = dart.getOwnPropertyNames(named);
+    let r = {};
+    for (var i = 0; i < names.length; ++i) {
+      let name = names[i];
+      let type = named[name];
+      if (!definite) r[name] = type = dart._normalizeParameter(type);
+      key.push(name);
+      key.push(type);
+    }
+    if (!definite) named = r;
+    return dart._memoizeArray(map, key, () => named);
+  };
+  dart._lookupNonTerminal = function(map, key) {
+    let result = map.get(key);
+    if (result !== void 0) return result;
+    map.set(key, result = new Map());
+    return result;
+  };
+  dart._createSmall = function(count, definite, returnType, required) {
+    let map = dart._fnTypeSmallMap[count];
+    let args = definite ? required : required.map(dart._normalizeParameter);
+    for (var i = 0; i < count; ++i) {
+      map = dart._lookupNonTerminal(map, args[i]);
+    }
+    let result = map.get(returnType);
+    if (result !== void 0) return result;
+    result = new dart.FunctionType(returnType, args, [], {});
+    map.set(returnType, result);
+    return result;
+  };
+  dart.typedef = function(name, closure) {
+    return new dart.Typedef(name, closure);
+  };
   dart._functionType = function(definite, returnType, args, extra) {
     if (args === void 0 && extra === void 0) {
       const fnTypeParts = returnType;
@@ -1293,9 +1624,6 @@
   dart.definiteFunctionType = function(returnType, args, extra) {
     return dart._functionType(true, returnType, args, extra);
   };
-  dart.typedef = function(name, closure) {
-    return new dart.Typedef(name, closure);
-  };
   dart.typeName = function(type) {
     if (type === void 0) return "undefined type";
     if (type === null) return "null type";
@@ -1331,17 +1659,17 @@
   };
   dart.getImplicitFunctionType = function(type) {
     if (dart.test(dart.isFunctionType(type))) return type;
-    return dart.getMethodTypeFromType(type, 'call');
+    return dart.getMethodType(type, 'call');
   };
   dart.isFunctionType = function(type) {
     return type instanceof dart.AbstractFunctionType || type === core.Function;
   };
-  dart.isLazyJSSubtype = function(t1, t2, covariant) {
+  dart.isLazyJSSubtype = function(t1, t2, isCovariant) {
     if (dart.equals(t1, t2)) return true;
     if (t1[_jsTypeCallback] == null || t2[_jsTypeCallback] == null) return true;
-    return dart.isClassSubType(t1[_rawJSType], t2[_rawJSType], covariant);
+    return dart.isClassSubType(t1[_rawJSType], t2[_rawJSType], isCovariant);
   };
-  dart.isFunctionSubtype = function(ft1, ft2, covariant) {
+  dart.isFunctionSubtype = function(ft1, ft2, isCovariant) {
     if (ft2 === core.Function) {
       return true;
     }
@@ -1353,26 +1681,26 @@
     let args1 = ft1.args;
     let args2 = ft2.args;
     if (args1.length > args2.length) {
-      return covariant ? false : null;
+      return isCovariant ? false : null;
     }
     for (let i = 0; i < args1.length; ++i) {
-      if (!dart._isSubtype(args2[i], args1[i], !covariant)) {
+      if (!dart._isSubtype(args2[i], args1[i], !isCovariant)) {
         return null;
       }
     }
     let optionals1 = ft1.optionals;
     let optionals2 = ft2.optionals;
     if (args1.length + optionals1.length < args2.length + optionals2.length) {
-      return covariant ? false : null;
+      return isCovariant ? false : null;
     }
     let j = 0;
     for (let i = args1.length; i < args2.length; ++i, ++j) {
-      if (!dart._isSubtype(args2[i], optionals1[j], !covariant)) {
+      if (!dart._isSubtype(args2[i], optionals1[j], !isCovariant)) {
         return null;
       }
     }
     for (let i = 0; i < optionals2.length; ++i, ++j) {
-      if (!dart._isSubtype(optionals2[i], optionals1[j], !covariant)) {
+      if (!dart._isSubtype(optionals2[i], optionals1[j], !isCovariant)) {
         return null;
       }
     }
@@ -1384,15 +1712,14 @@
       let n1 = named1[name];
       let n2 = named2[name];
       if (n1 === void 0) {
-        return covariant ? false : null;
+        return isCovariant ? false : null;
       }
-      if (!dart._isSubtype(n2, n1, !covariant)) {
+      if (!dart._isSubtype(n2, n1, !isCovariant)) {
         return null;
       }
     }
-    if (ret2 === dart.void) return true;
-    if (ret1 === dart.void) return ret2 === dart.dynamic;
-    if (!dart._isSubtype(ret1, ret2, covariant)) return null;
+    if (ret1 === dart.void) return dart._isTop(ret2);
+    if (!dart._isSubtype(ret1, ret2, isCovariant)) return null;
     return true;
   };
   dart._subtypeMemo = function(f) {
@@ -1412,12 +1739,15 @@
     };
   };
   dart._isBottom = function(type) {
-    return type == dart.bottom;
+    return type == dart.bottom || type == core.Null;
   };
   dart._isTop = function(type) {
-    return type == core.Object || type == dart.dynamic;
+    if (dart.getGenericClass(type) === dart.getGenericClass(async.FutureOr)) {
+      return dart._isTop(dart.getGenericArgs(type)[0]);
+    }
+    return type == core.Object || type == dart.dynamic || type == dart.void;
   };
-  dart._isSubtype = function(t1, t2, covariant) {
+  dart._isSubtype = function(t1, t2, isCovariant) {
     if (t1 === t2) return true;
     if (dart._isTop(t2) || dart._isBottom(t1)) {
       return true;
@@ -1428,20 +1758,20 @@
       return false;
     }
     if (!(t1 instanceof dart.AbstractFunctionType) && !(t2 instanceof dart.AbstractFunctionType)) {
-      let result = dart.isClassSubType(t1, t2, covariant);
+      let result = dart.isClassSubType(t1, t2, isCovariant);
       if (result === true || result === null) return result;
     }
     t1 = dart.getImplicitFunctionType(t1);
     if (!t1) return false;
     if (dart.isFunctionType(t1) && dart.isFunctionType(t2)) {
-      return dart.isFunctionSubtype(t1, t2, covariant);
+      return dart.isFunctionSubtype(t1, t2, isCovariant);
     }
     if (t1 instanceof dart.LazyJSType && t2 instanceof dart.LazyJSType) {
-      return dart.isLazyJSSubtype(t1, t2, covariant);
+      return dart.isLazyJSSubtype(t1, t2, isCovariant);
     }
     return false;
   };
-  dart.isClassSubType = function(t1, t2, covariant) {
+  dart.isClassSubType = function(t1, t2, isCovariant) {
     if (t1 == t2) return true;
     if (t1 == core.Object) return false;
     if (t1 == null) return t2 == core.Object || t2 == dart.dynamic;
@@ -1459,16 +1789,25 @@
       }
       dart.assert(length == typeArguments2.length);
       for (let i = 0; i < length; ++i) {
-        let result = dart._isSubtype(typeArguments1[i], typeArguments2[i], covariant);
+        let result = dart._isSubtype(typeArguments1[i], typeArguments2[i], isCovariant);
         if (!result) {
           return result;
         }
       }
       return true;
     }
+    if (raw1 === dart.getGenericClass(async.FutureOr)) {
+      let t1TypeArg = dart.getGenericArgs(t1)[0];
+      let t1Future = dart.getGenericClass(async.Future)(t1TypeArg);
+      return dart.isSubtype(t1Future, t2) && dart.isSubtype(t1TypeArg, t2);
+    } else if (raw2 === dart.getGenericClass(async.FutureOr)) {
+      let t2TypeArg = dart.getGenericArgs(t2)[0];
+      let t2Future = dart.getGenericClass(async.Future)(t2TypeArg);
+      return dart.isSubtype(t1, t2Future) || dart.isSubtype(t1, t2TypeArg);
+    }
     let indefinite = false;
     function definitive(t1, t2) {
-      let result = dart.isClassSubType(t1, t2, covariant);
+      let result = dart.isClassSubType(t1, t2, isCovariant);
       if (result == null) {
         indefinite = true;
         return false;
@@ -1513,32 +1852,47 @@
     }
     return true;
   };
+  dart.trapRuntimeErrors = function(flag) {
+    dart._trapRuntimeErrors = flag;
+  };
   dart.throwCastError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.CastErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.CastErrorImplementation(object, found, expected));
   };
   dart.throwTypeError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.TypeErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.TypeErrorImplementation(object, found, expected));
   };
   dart.throwStrongModeCastError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.StrongModeCastError(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.StrongModeCastError(object, found, expected));
   };
   dart.throwStrongModeTypeError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.StrongModeTypeError(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.StrongModeTypeError(object, found, expected));
   };
   dart.throwUnimplementedError = function(message) {
-    debugger;
+    if (dart._trapRuntimeErrors) debugger;
     dart.throw(new core.UnimplementedError(message));
   };
-  dart.throwAssertionError = function() {
-    debugger;
-    dart.throw(new core.AssertionError());
+  dart.throwAssertionError = function(message) {
+    if (message === void 0) message = null;
+    return (() => {
+      if (dart._trapRuntimeErrors) debugger;
+      let error = message != null ? new _js_helper.AssertionErrorWithMessage(message()) : new core.AssertionError();
+      dart.throw(error);
+    })();
   };
   dart.throwNullValueError = function() {
-    debugger;
+    if (dart._trapRuntimeErrors) debugger;
     dart.throw(new core.NoSuchMethodError(null, new core.Symbol('<Unexpected Null Value>'), null, null, null));
   };
   dart.syncStar = function(gen, E, ...args) {
@@ -1562,7 +1916,7 @@
       }
       return future.then(dart.dynamic)(onValue, {onError: onError});
     }
-    return dart.getGenericClass(async.Future)(T).new(function() {
+    return dart.getGenericClass(async.Future)(T).microtask(function() {
       iter = gen.apply(null, args)[Symbol.iterator]();
       return onValue();
     });
@@ -1574,24 +1928,70 @@
     let f = dart._canonicalMember(obj, field);
     dart._trackCall(obj);
     if (f != null) {
-      if (dart.test(dart.hasMethod(obj, f))) return dart.bind(obj, f, void 0);
-      return obj[f];
+      let type = dart.getType(obj);
+      if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
+      if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
+      if (dart.test(dart.isJsInterop(obj))) return obj[f];
     }
-    return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(field), [], {isGetter: true}));
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
+  };
+  dart.dloadMirror = function(obj, field) {
+    let f = dart._canonicalMember(obj, field);
+    dart._trackCall(obj);
+    if (f != null) {
+      let type = dart.getType(obj);
+      if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
+      if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
+    }
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
+  };
+  dart._stripGenericArguments = function(type) {
+    let genericClass = dart.getGenericClass(type);
+    if (genericClass != null) return genericClass();
+    return type;
+  };
+  dart.dputMirror = function(obj, field, value) {
+    let f = dart._canonicalMember(obj, field);
+    dart._trackCall(obj);
+    if (f != null) {
+      let objType = dart.getType(obj);
+      let setterType = dart.getSetterType(objType, f);
+      if (setterType != void 0) {
+        return obj[f] = dart.check(value, dart._stripGenericArguments(setterType.args[0]));
+      } else {
+        let fieldType = dart.getFieldType(objType, f);
+        if (fieldType != void 0) {
+          return obj[f] = dart.check(value, dart._stripGenericArguments(fieldType));
+        }
+      }
+    }
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [value], {isSetter: true}));
   };
   dart.dput = function(obj, field, value) {
     let f = dart._canonicalMember(obj, field);
     dart._trackCall(obj);
     if (f != null) {
-      return obj[f] = value;
+      let objType = dart.getType(obj);
+      let setterType = dart.getSetterType(objType, f);
+      if (setterType != void 0) {
+        return obj[f] = dart.check(value, setterType.args[0]);
+      } else {
+        let fieldType = dart.getFieldType(objType, f);
+        if (fieldType != void 0) {
+          return obj[f] = dart.check(value, fieldType);
+        }
+        if (dart.test(dart.isJsInterop(obj))) {
+          return obj[f] = value;
+        }
+      }
     }
-    return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(field), [value], {isSetter: true}));
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [value], {isSetter: true}));
   };
   dart._checkApply = function(type, actuals) {
     if (actuals.length < type.args.length) return false;
     let index = 0;
     for (let i = 0; i < type.args.length; ++i) {
-      if (!dart.instanceOfOrNull(actuals[i], type.args[i])) return false;
+      dart.check(actuals[i], type.args[i]);
       ++index;
     }
     if (actuals.length == type.args.length) return true;
@@ -1599,7 +1999,7 @@
     if (type.optionals.length > 0) {
       if (extras > type.optionals.length) return false;
       for (let i = 0, j = index; i < extras; ++i, ++j) {
-        if (!dart.instanceOfOrNull(actuals[j], type.optionals[i])) return false;
+        dart.check(actuals[j], type.optionals[i]);
       }
       return true;
     }
@@ -1612,12 +2012,40 @@
       if (!dart.hasOwnProperty.call(type.named, name)) {
         return false;
       }
-      if (!dart.instanceOfOrNull(opts[name], type.named[name])) return false;
+      dart.check(opts[name], type.named[name]);
     }
     return true;
   };
+  dart._toSymbolName = function(symbol) {
+    let str = symbol.toString();
+    return str.substring(7, str.length - 1);
+  };
+  dart._toDisplayName = function(name) {
+    if (name[0] === '_') {
+      switch (name) {
+        case '_get':
+        {
+          return '[]';
+        }
+        case '_set':
+        {
+          return '[]=';
+        }
+        case '_negate':
+        {
+          return 'unary-';
+        }
+        case '_constructor':
+        case '_prototype':
+        {
+          return name.substring(1);
+        }
+      }
+    }
+    return name;
+  };
   dart._dartSymbol = function(name) {
-    return dart.const(core.Symbol.new(name.toString()));
+    return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.Symbol.es6(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
   };
   dart.extractNamedArgs = function(args) {
     if (args.length > 0) {
@@ -1636,7 +2064,7 @@
     }
     if (!(f instanceof Function)) {
       if (f != null) {
-        ftype = dart.getMethodType(f, 'call');
+        ftype = dart.getMethodType(dart.getType(f), 'call');
         f = f.call;
       }
       if (!(f instanceof Function)) {
@@ -1741,16 +2169,17 @@
       }
     }
     let actualTypeName = dart.typeName(actual);
-    let o = dart._callMethodStats[dartx.putIfAbsent](dart.str`${actualTypeName} <${src}>`, dart.fn(() => new dart._MethodStats(core.String._check(actualTypeName), src), VoidTo_MethodStats()));
+    let o = dart._callMethodStats[dartx.putIfAbsent](dart.str`${actualTypeName} <${src}>`, dart.fn(() => new dart._MethodStats(actualTypeName, src), VoidTo_MethodStats()));
     o.count = dart.notNull(o.count) + 1;
   };
   dart._callMethod = function(obj, name, typeArgs, args, displayName) {
     let symbol = dart._canonicalMember(obj, name);
     if (symbol == null) {
-      return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(displayName), core.List._check(args), {isMethod: true}));
+      return dart.noSuchMethod(obj, new dart.InvocationImpl(displayName, core.List._check(args), {isMethod: true}));
     }
     let f = obj != null ? obj[symbol] : null;
-    let ftype = dart.getMethodType(obj, symbol);
+    let type = dart.getType(obj);
+    let ftype = dart.getMethodType(type, symbol);
     return dart._checkAndCall(f, ftype, obj, typeArgs, args, displayName);
   };
   dart.dsend = function(obj, method, ...args) {
@@ -1795,6 +2224,9 @@
     return false;
   };
   dart.is = function(obj, type) {
+    if (obj == null) {
+      return type == core.Null || dart._isTop(type);
+    }
     let result = dart.strongInstanceOf(obj, type);
     if (result !== null) return result;
     let actual = dart.getReifiedType(obj);
@@ -1896,18 +2328,19 @@
       return map;
     })();
   };
-  dart.assert = function(condition) {
-    if (!condition) dart.throwAssertionError();
+  dart.assert = function(condition, message) {
+    if (message === void 0) message = null;
+    return (() => {
+      if (!condition) dart.throwAssertionError(message);
+    })();
   };
   dart.throw = function(obj) {
-    if (obj != null && (typeof obj == 'object' || typeof obj == 'function')) {
-      dart._stack.set(obj, new Error());
-    }
+    dart._stack = new Error();
     throw obj;
   };
   dart.getError = function(exception) {
-    var stack = dart._stack.get(exception);
-    return stack !== void 0 ? stack : exception;
+    var stack = dart._stack;
+    return stack !== null ? stack : exception;
   };
   dart.stackPrint = function(exception) {
     var error = dart.getError(exception);
@@ -2069,11 +2502,11 @@
     return Object.getOwnPropertySymbols(obj);
   };
   dart.throwStrongModeError = function(message) {
-    debugger;
+    if (dart.test(dart._trapRuntimeErrors)) debugger;
     throw new _js_helper.StrongModeErrorImplementation(message);
   };
   dart.throwInternalError = function(message) {
-    debugger;
+    if (dart.test(dart._trapRuntimeErrors)) debugger;
     throw Error(message);
   };
   dart.getOwnNamesAndSymbols = function(obj) {
@@ -2140,7 +2573,56 @@
   dart.copyProperties = function(to, from) {
     return dart.copyTheseProperties(to, from, dart.getOwnNamesAndSymbols(from));
   };
-  dart.global = typeof window == "undefined" ? global : window;
+  dart.global = (function() {
+    if (typeof NodeList !== "undefined") {
+      NodeList.prototype.get = function(i) {
+        return this[i];
+      };
+      NamedNodeMap.prototype.get = function(i) {
+        return this[i];
+      };
+      DOMTokenList.prototype.get = function(i) {
+        return this[i];
+      };
+      HTMLCollection.prototype.get = function(i) {
+        return this[i];
+      };
+      if (typeof PannerNode == "undefined") {
+        let audioContext;
+        if (typeof AudioContext == "undefined" && typeof webkitAudioContext != "undefined") {
+          audioContext = new webkitAudioContext();
+        } else {
+          audioContext = new AudioContext();
+          window.StereoPannerNode = audioContext.createStereoPanner().constructor;
+        }
+        window.PannerNode = audioContext.createPanner().constructor;
+      }
+      if (typeof AudioSourceNode == "undefined") {
+        window.AudioSourceNode = MediaElementAudioSourceNode.__proto__;
+      }
+      if (typeof FontFaceSet == "undefined") {
+        window.FontFaceSet = document.fonts.__proto__.constructor;
+      }
+      if (typeof MemoryInfo == "undefined") {
+        if (typeof window.performance.memory != "undefined") {
+          window.MemoryInfo = window.performance.memory.constructor;
+        }
+      }
+      if (typeof Geolocation == "undefined") {
+        navigator.geolocation.constructor;
+      }
+      if (typeof Animation == "undefined") {
+        let d = document.createElement('div');
+        if (typeof d.animate != "undefined") {
+          window.Animation = d.animate(d).constructor;
+        }
+      }
+      if (typeof SourceBufferList == "undefined") {
+        window.SourceBufferList = new MediaSource().sourceBuffers.constructor;
+      }
+    }
+    return typeof window == "undefined" ? global : window;
+  })();
   dart.JsSymbol = Symbol;
   dart._mixins = Symbol("mixins");
   dart.implements = Symbol("implements");
@@ -2292,198 +2774,189 @@
       this[_wrappedType] = wrappedType;
     }
     toString() {
-      return core.String._check(dart.typeName(this[_wrappedType]));
+      return dart.typeName(this[_wrappedType]);
     }
   };
   dart.setSignature(dart.WrappedType, {
     constructors: () => ({new: dart.definiteFunctionType(dart.WrappedType, [dart.dynamic])}),
     fields: () => ({[_wrappedType]: dart.dynamic})
   });
+  const _stringValue = Symbol('_stringValue');
   dart.AbstractFunctionType = class AbstractFunctionType extends dart.TypeRep {
-    constructor() {
-      super();
-      this._stringValue = null;
+    new() {
+      this[_stringValue] = null;
+      super.new();
     }
     toString() {
       return this.name;
     }
     get name() {
-      if (this._stringValue) return this._stringValue;
+      if (this[_stringValue] != null) return this[_stringValue];
       let buffer = '(';
       for (let i = 0; i < this.args.length; ++i) {
         if (i > 0) {
-          buffer += ', ';
+          buffer = dart.notNull(buffer) + ', ';
         }
-        buffer += dart.typeName(this.args[i]);
+        buffer = dart.notNull(buffer) + dart.notNull(dart.typeName(this.args[i]));
       }
       if (this.optionals.length > 0) {
-        if (this.args.length > 0) buffer += ', ';
-        buffer += '[';
+        if (this.args.length > 0) {
+          buffer = dart.notNull(buffer) + ', ';
+        }
+        buffer = dart.notNull(buffer) + '[';
         for (let i = 0; i < this.optionals.length; ++i) {
           if (i > 0) {
-            buffer += ', ';
+            buffer = dart.notNull(buffer) + ', ';
           }
-          buffer += dart.typeName(this.optionals[i]);
+          buffer = dart.notNull(buffer) + dart.notNull(dart.typeName(this.optionals[i]));
         }
-        buffer += ']';
+        buffer = dart.notNull(buffer) + ']';
       } else if (Object.keys(this.named).length > 0) {
-        if (this.args.length > 0) buffer += ', ';
-        buffer += '{';
-        let names = dart.getOwnPropertyNames(this.named).sort();
+        if (this.args.length > 0) {
+          buffer = dart.notNull(buffer) + ', ';
+        }
+        buffer = dart.notNull(buffer) + '{';
+        let names = dart.getOwnPropertyNames(this.named);
+        names.sort();
         for (let i = 0; i < names.length; ++i) {
           if (i > 0) {
-            buffer += ', ';
+            buffer = dart.notNull(buffer) + ', ';
           }
-          buffer += names[i] + ': ' + dart.typeName(this.named[names[i]]);
+          let typeNameString = dart.typeName(this.named[names[i]]);
+          buffer = dart.notNull(buffer) + dart.str`${names[i]}: ${typeNameString}`;
         }
-        buffer += '}';
+        buffer = dart.notNull(buffer) + '}';
       }
-      buffer += ') -> ' + dart.typeName(this.returnType);
-      this._stringValue = buffer;
+      let returnTypeName = dart.typeName(this.returnType);
+      buffer = dart.notNull(buffer) + dart.str`) -> ${returnTypeName}`;
+      this[_stringValue] = buffer;
       return buffer;
     }
   };
+  dart.setSignature(dart.AbstractFunctionType, {
+    constructors: () => ({new: dart.definiteFunctionType(dart.AbstractFunctionType, [])}),
+    fields: () => ({[_stringValue]: core.String})
+  });
   dart._fnTypeNamedArgMap = new Map();
   dart._fnTypeArrayArgMap = new Map();
   dart._fnTypeTypeMap = new Map();
   dart._fnTypeSmallMap = [new Map(), new Map(), new Map()];
+  const _process = Symbol('_process');
   dart.FunctionType = class FunctionType extends dart.AbstractFunctionType {
-    static _memoizeArray(map, arr, create) {
-      let len = arr.length;
-      map = FunctionType._lookupNonTerminal(map, len);
-      for (var i = 0; i < len - 1; ++i) {
-        map = FunctionType._lookupNonTerminal(map, arr[i]);
-      }
-      let result = map.get(arr[len - 1]);
-      if (result !== void 0) return result;
-      map.set(arr[len - 1], result = create());
-      return result;
-    }
-    static _normalizeParameter(a) {
-      if (a instanceof Array) {
-        let result = [];
-        result.push(a[0] == dart.dynamic ? dart.bottom : a[0]);
-        result.push(a.slice(1));
-        return result;
-      }
-      return a == dart.dynamic ? dart.bottom : a;
-    }
-    static _canonicalizeArray(definite, array, map) {
-      let arr = definite ? array : array.map(FunctionType._normalizeParameter);
-      return FunctionType._memoizeArray(map, arr, () => arr);
-    }
-    static _canonicalizeNamed(definite, named, map) {
-      let key = [];
-      let names = dart.getOwnPropertyNames(named);
-      let r = {};
-      for (var i = 0; i < names.length; ++i) {
-        let name = names[i];
-        let type = named[name];
-        if (!definite) r[name] = type = FunctionType._normalizeParameter(type);
-        key.push(name);
-        key.push(type);
-      }
-      if (!definite) named = r;
-      return FunctionType._memoizeArray(map, key, () => named);
-    }
-    static _lookupNonTerminal(map, key) {
-      let result = map.get(key);
-      if (result !== void 0) return result;
-      map.set(key, result = new Map());
-      return result;
-    }
-    static _createSmall(count, definite, returnType, required) {
-      let map = dart._fnTypeSmallMap[count];
-      let args = definite ? required : required.map(FunctionType._normalizeParameter);
-      for (var i = 0; i < count; ++i) {
-        map = FunctionType._lookupNonTerminal(map, args[i]);
-      }
-      let result = map.get(returnType);
-      if (result !== void 0) return result;
-      result = new FunctionType(returnType, args, [], {});
-      map.set(returnType, result);
-      return result;
-    }
     static create(definite, returnType, args, extra) {
       if (extra === void 0 && args.length < 3) {
-        return FunctionType._createSmall(args.length, definite, returnType, args);
+        return dart._createSmall(args.length, definite, returnType, args);
       }
-      args = FunctionType._canonicalizeArray(definite, args, dart._fnTypeArrayArgMap);
-      let keys;
-      let create;
+      args = dart._canonicalizeArray(definite, args, dart._fnTypeArrayArgMap);
+      let keys = null;
+      let create = null;
       if (extra === void 0) {
         keys = [returnType, args];
-        create = () => new FunctionType(returnType, args, [], {});
+        create = dart.fn(() => new dart.FunctionType(returnType, args, [], {}), VoidToFunctionType());
       } else if (extra instanceof Array) {
-        let optionals = FunctionType._canonicalizeArray(definite, extra, dart._fnTypeArrayArgMap);
+        let optionals = dart._canonicalizeArray(definite, extra, dart._fnTypeArrayArgMap);
         keys = [returnType, args, optionals];
-        create = () => new FunctionType(returnType, args, optionals, {});
+        create = dart.fn(() => new dart.FunctionType(returnType, args, optionals, {}), VoidToFunctionType());
       } else {
-        let named = FunctionType._canonicalizeNamed(definite, extra, dart._fnTypeNamedArgMap);
+        let named = dart._canonicalizeNamed(definite, extra, dart._fnTypeNamedArgMap);
         keys = [returnType, args, named];
-        create = () => new FunctionType(returnType, args, [], named);
+        create = dart.fn(() => new dart.FunctionType(returnType, args, [], named), VoidToFunctionType());
       }
-      return FunctionType._memoizeArray(dart._fnTypeTypeMap, keys, create);
+      return dart._memoizeArray(dart._fnTypeTypeMap, keys, create);
     }
-    constructor(returnType, args, optionals, named) {
-      super();
+    [_process](array, metadata) {
+      let result = [];
+      for (let i = 0; i < array.length; ++i) {
+        let arg = array[i];
+        if (arg instanceof Array) {
+          dart.dsend(metadata, 'add', arg.slice(1));
+          result[dartx.add](arg[0]);
+        } else {
+          metadata.push([]);
+          result.push(arg);
+        }
+      }
+      return result;
+    }
+    new(returnType, args, optionals, named) {
       this.returnType = returnType;
       this.args = args;
       this.optionals = optionals;
       this.named = named;
+      this.metadata = null;
+      super.new();
       this.metadata = [];
-      function process(array, metadata) {
-        var result = [];
-        for (var i = 0; i < array.length; ++i) {
-          var arg = array[i];
-          if (arg instanceof Array) {
-            metadata.push(arg.slice(1));
-            result.push(arg[0]);
-          } else {
-            metadata.push([]);
-            result.push(arg);
-          }
-        }
-        return result;
-      }
-      this.args = process(this.args, this.metadata);
-      this.optionals = process(this.optionals, this.metadata);
+      this.args = this[_process](this.args, this.metadata);
+      this.optionals = this[_process](this.optionals, this.metadata);
     }
   };
+  dart.setSignature(dart.FunctionType, {
+    constructors: () => ({new: dart.definiteFunctionType(dart.FunctionType, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])}),
+    fields: () => ({
+      returnType: dart.dynamic,
+      args: dart.dynamic,
+      optionals: dart.dynamic,
+      named: dart.dynamic,
+      metadata: dart.dynamic
+    }),
+    methods: () => ({[_process]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])}),
+    statics: () => ({create: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])}),
+    names: ['create']
+  });
+  const _name = Symbol('_name');
+  const _closure = Symbol('_closure');
+  const _functionType = Symbol('_functionType');
   dart.Typedef = class Typedef extends dart.AbstractFunctionType {
-    constructor(name, closure) {
-      super();
-      this._name = name;
-      this._closure = closure;
-      this._functionType = null;
+    new(name, closure) {
+      this[_name] = name;
+      this[_closure] = closure;
+      this[_functionType] = null;
+      super.new();
     }
     get name() {
-      return this._name;
+      return core.String._check(this[_name]);
     }
     get functionType() {
-      if (!this._functionType) {
-        this._functionType = this._closure();
+      if (this[_functionType] == null) {
+        this[_functionType] = this[_closure]();
       }
-      return this._functionType;
+      return this[_functionType];
     }
     get returnType() {
       return this.functionType.returnType;
     }
     get args() {
-      return this.functionType.args;
+      return core.List._check(this.functionType.args);
     }
     get optionals() {
-      return this.functionType.optionals;
+      return core.List._check(this.functionType.optionals);
     }
     get named() {
       return this.functionType.named;
     }
     get metadata() {
-      return this.functionType.metadata;
+      return core.List._check(this.functionType.metadata);
     }
   };
+  dart.setSignature(dart.Typedef, {
+    constructors: () => ({new: dart.definiteFunctionType(dart.Typedef, [dart.dynamic, dart.dynamic])}),
+    fields: () => ({
+      [_name]: dart.dynamic,
+      [_closure]: dart.dynamic,
+      [_functionType]: dart.AbstractFunctionType
+    }),
+    getters: () => ({
+      functionType: dart.definiteFunctionType(dart.AbstractFunctionType, []),
+      returnType: dart.definiteFunctionType(dart.dynamic, []),
+      args: dart.definiteFunctionType(core.List, []),
+      optionals: dart.definiteFunctionType(core.List, []),
+      named: dart.definiteFunctionType(dart.dynamic, []),
+      metadata: dart.definiteFunctionType(core.List, [])
+    })
+  });
   dart._typeFormalCount = Symbol("_typeFormalCount");
   dart.isSubtype = dart._subtypeMemo((t1, t2) => t1 === t2 || dart._isSubtype(t1, t2, true));
+  dart._trapRuntimeErrors = true;
   dart._jsIterator = Symbol("_jsIterator");
   dart._current = Symbol("_current");
   dart._AsyncStarStreamController = class _AsyncStarStreamController {
@@ -2616,7 +3089,7 @@
     }
   };
   dart.setSignature(dart.InvocationImpl, {
-    constructors: () => ({new: dart.definiteFunctionType(dart.InvocationImpl, [core.String, core.List], {namedArguments: dart.dynamic, isMethod: core.bool, isGetter: core.bool, isSetter: core.bool})}),
+    constructors: () => ({new: dart.definiteFunctionType(dart.InvocationImpl, [dart.dynamic, core.List], {namedArguments: dart.dynamic, isMethod: core.bool, isGetter: core.bool, isSetter: core.bool})}),
     fields: () => ({
       memberName: core.Symbol,
       positionalArguments: core.List,
@@ -2665,7 +3138,7 @@
       return false;
     });
   })();
-  dart._stack = new WeakMap();
+  dart._stack = null;
   dart._value = Symbol("_value");
   dart.constants = new Map();
   dart.constantLists = new Map();
@@ -2760,8 +3233,8 @@
   dart.lazyFn(_debugger.getObjectTypeName, () => dynamicToString());
   _debugger.getTypeName = function(type) {
     let name = dart.typeName(type);
-    if (dart.equals(name, 'JSArray<dynamic>') || dart.equals(name, 'JSObject<Array>')) return 'List<dynamic>';
-    return core.String._check(name);
+    if (name == 'JSArray<dynamic>' || name == 'JSObject<Array>') return 'List<dynamic>';
+    return name;
   };
   dart.lazyFn(_debugger.getTypeName, () => TypeToString());
   _debugger._getType = function(object) {
@@ -2864,7 +3337,7 @@
       if (dart.notNull(this.length) <= dart.notNull(_debugger._maxSpanLength)) {
         this.asMap()[dartx.forEach](dart.fn((i, element) => {
           children[dartx.add](new _debugger.NameValuePair({name: dart.toString(dart.notNull(i) + dart.notNull(this.start)), value: element}));
-        }, intAnddynamicTovoid()));
+        }, intAnddynamicToNull()));
       } else {
         for (let i = this.start; dart.notNull(i) < dart.notNull(this.end); i = dart.notNull(i) + dart.notNull(this.subsetSize)) {
           let subSpan = new _debugger.IterableSpan(i, math.min(core.int)(this.end, dart.notNull(this.subsetSize) + dart.notNull(i)), this.iterable);
@@ -3157,7 +3630,7 @@
         protoChain[dartx.add](current);
         current = _debugger.safeGetProperty(current, '__proto__');
       }
-      for (/* Unimplemented unknown name */current of protoChain) {
+      for (current of protoChain) {
         for (let symbol of _debugger.getOwnPropertySymbols(current)) {
           let dartName = _debugger.symbolName(symbol);
           if (dart.test(_debugger.hasMethod(object, dartName))) {
@@ -3173,7 +3646,7 @@
           properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
         }
       }
-      for (/* Unimplemented unknown name */current of protoChain) {
+      for (current of protoChain) {
         let className = dart.dload(dart.getReifiedType(current), 'name');
         for (let name of _debugger.getOwnPropertyNames(current)) {
           if (dart.test(_debugger.ObjectFormatter._customNames.contains(name)) || dart.equals(name, className)) continue;
@@ -3265,14 +3738,14 @@
         } else {
           nonGenericProperties._set(core.String._check(name), value);
         }
-      }, dynamicAnddynamicTodynamic$()));
+      }, dynamicAnddynamicToNull()));
       nonGenericProperties.forEach(dart.fn((name, value) => {
         if (core.Type.is(value)) {
           children.add(_debugger.NameValuePair._check(this.classChild(name, value)));
         } else {
           children.add(new _debugger.NameValuePair({name: name, value: value}));
         }
-      }, StringAndObjectTovoid()));
+      }, StringAndObjectToNull()));
       return children.toList();
     }
     recordGenericParameters(name, genericTypeConstructor) {
@@ -3309,7 +3782,7 @@
       return true;
     }
     preview(object) {
-      return core.String._check(dart.typeName(dart.getReifiedType(object)));
+      return dart.typeName(dart.getReifiedType(object));
     }
     children(object) {
       return JSArrayOfNameValuePair().of([new _debugger.NameValuePair({name: 'signature', value: this.preview(object)}), new _debugger.NameValuePair({name: 'JavaScript Function', value: object, config: _debugger.JsonMLConfig.skipDart})]);
@@ -3341,7 +3814,7 @@
       map[dartx.forEach](dart.fn((key, value) => {
         let entryWrapper = new _debugger.MapEntry({key: key, value: value});
         entries.add(new _debugger.NameValuePair({name: dart.toString(entries.length), value: entryWrapper}));
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
       _debugger.addMetadataChildren(object, entries);
       return entries.toList();
     }
@@ -7020,30 +7493,8 @@
     ListIterable[dart.implements] = () => [_internal.EfficientLength];
     dart.setSignature(ListIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_internal.ListIterable$(E), [])}),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
-      methods: () => ({
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-        every: dart.definiteFunctionType(core.bool, [ETobool()]),
-        any: dart.definiteFunctionType(core.bool, [ETobool()]),
-        firstWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        lastWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        singleWhere: dart.definiteFunctionType(E, [ETobool()]),
-        where: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        map: dart.definiteFunctionType(T => [core.Iterable$(T), [dart.functionType(T, [E])]]),
-        reduce: dart.definiteFunctionType(E, [dynamicAndEToE()]),
-        fold: dart.definiteFunctionType(T => [T, [T, dart.functionType(T, [T, E])]]),
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        skipWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        takeWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
-      })
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
+      methods: () => ({reduce: dart.definiteFunctionType(E, [dynamicAndEToE()])})
     });
     dart.defineExtensionMembers(ListIterable, [
       'forEach',
@@ -7169,12 +7620,6 @@
       getters: () => ({
         [_endIndex]: dart.definiteFunctionType(core.int, []),
         [_startIndex]: dart.definiteFunctionType(core.int, [])
-      }),
-      methods: () => ({
-        elementAt: dart.definiteFunctionType(E, [core.int]),
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool})
       })
     });
     dart.defineExtensionMembers(SubListIterable, [
@@ -7289,13 +7734,7 @@
         [_iterable$]: IterableOfS(),
         [_f]: _TransformationOfS$T()
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(T), []),
-        first: dart.definiteFunctionType(T, []),
-        last: dart.definiteFunctionType(T, []),
-        single: dart.definiteFunctionType(T, [])
-      }),
-      methods: () => ({elementAt: dart.definiteFunctionType(T, [core.int])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(T), [])})
     });
     dart.defineExtensionMembers(MappedIterable, [
       'elementAt',
@@ -7388,8 +7827,7 @@
       fields: () => ({
         [_source]: IterableOfS(),
         [_f]: _TransformationOfS$T()
-      }),
-      methods: () => ({elementAt: dart.definiteFunctionType(T, [core.int])})
+      })
     });
     dart.defineExtensionMembers(MappedListIterable, ['elementAt', 'length']);
     return MappedListIterable;
@@ -7738,8 +8176,7 @@
         [_iterable$]: IterableOfE(),
         [_skipCount]: core.int
       }),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({skip: dart.definiteFunctionType(core.Iterable$(E), [core.int])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(SkipIterable, ['skip', 'iterator']);
     return SkipIterable;
@@ -7965,31 +8402,8 @@
     EmptyIterable[dart.implements] = () => [_internal.EfficientLength];
     dart.setSignature(EmptyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_internal.EmptyIterable$(E), [])}),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
-      methods: () => ({
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-        elementAt: dart.definiteFunctionType(E, [core.int]),
-        every: dart.definiteFunctionType(core.bool, [ETobool()]),
-        any: dart.definiteFunctionType(core.bool, [ETobool()]),
-        firstWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        lastWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        where: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        map: dart.definiteFunctionType(T => [core.Iterable$(T), [dart.functionType(T, [E])]]),
-        reduce: dart.definiteFunctionType(E, [EAndEToE()]),
-        fold: dart.definiteFunctionType(T => [T, [T, dart.functionType(T, [T, E])]]),
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        skipWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        takeWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
-      })
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
+      methods: () => ({singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()})})
     });
     dart.defineExtensionMembers(EmptyIterable, [
       'forEach',
@@ -8188,8 +8602,7 @@
   dart.addSimpleTypeTests(_internal._ListIndicesIterable);
   dart.setSignature(_internal._ListIndicesIterable, {
     constructors: () => ({new: dart.definiteFunctionType(_internal._ListIndicesIterable, [core.List])}),
-    fields: () => ({[_backedList]: core.List}),
-    methods: () => ({elementAt: dart.definiteFunctionType(core.int, [core.int])})
+    fields: () => ({[_backedList]: core.List})
   });
   dart.defineExtensionMembers(_internal._ListIndicesIterable, ['elementAt', 'length']);
   const _values = Symbol('_values');
@@ -8318,8 +8731,7 @@
     }
     dart.setSignature(ReversedListIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_internal.ReversedListIterable$(E), [IterableOfE()])}),
-      fields: () => ({[_source]: IterableOfE()}),
-      methods: () => ({elementAt: dart.definiteFunctionType(E, [core.int])})
+      fields: () => ({[_source]: IterableOfE()})
     });
     dart.defineExtensionMembers(ReversedListIterable, ['elementAt', 'length']);
     return ReversedListIterable;
@@ -8700,41 +9112,41 @@
     names: ['sort', 'sortRange', '_doSort', '_insertionSort', '_dualPivotQuicksort']
   });
   _internal.Sort._INSERTION_SORT_THRESHOLD = 32;
-  const _name = Symbol('_name');
+  const _name$ = Symbol('_name');
   const _nativeSymbol = Symbol('_nativeSymbol');
   _internal.Symbol = class Symbol extends core.Object {
     new(name) {
-      this[_name] = name;
+      this[_name$] = name;
       this[_nativeSymbol] = null;
     }
     es6(name, nativeSymbol) {
-      this[_name] = name;
+      this[_name$] = name;
       this[_nativeSymbol] = nativeSymbol;
     }
     unvalidated(name) {
-      this[_name] = name;
+      this[_name$] = name;
       this[_nativeSymbol] = null;
     }
     validated(name) {
-      this[_name] = _internal.Symbol.validatePublicSymbol(name);
+      this[_name$] = _internal.Symbol.validatePublicSymbol(name);
       this[_nativeSymbol] = null;
     }
     ['=='](other) {
-      return _internal.Symbol.is(other) && this[_name] == other[_name] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
+      return _internal.Symbol.is(other) && this[_name$] == other[_name$] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
     }
     get hashCode() {
       let hash = this._hashCode;
       if (hash != null) return hash;
       let arbitraryPrime = 664597;
-      hash = 536870911 & arbitraryPrime * dart.notNull(dart.hashCode(this[_name]));
+      hash = 536870911 & arbitraryPrime * dart.notNull(dart.hashCode(this[_name$]));
       this._hashCode = hash;
       return hash;
     }
     toString() {
-      return dart.str`Symbol("${this[_name]}")`;
+      return dart.str`Symbol("${this[_name$]}")`;
     }
     static getName(symbol) {
-      return symbol[_name];
+      return symbol[_name$];
     }
     static getNativeSymbol(symbol) {
       return symbol[_nativeSymbol];
@@ -8762,7 +9174,7 @@
       validated: dart.definiteFunctionType(_internal.Symbol, [core.String])
     }),
     fields: () => ({
-      [_name]: core.String,
+      [_name$]: core.String,
       [_nativeSymbol]: dart.dynamic
     }),
     methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
@@ -8838,11 +9250,11 @@
     if (_isolate_helper._MainFunctionArgs.is(entry)) {
       rootContext.eval(dart.fn(() => {
         dart.dcall(entry, args);
-      }, VoidTodynamic$()));
+      }, VoidToNull()));
     } else if (_isolate_helper._MainFunctionArgsMessage.is(entry)) {
       rootContext.eval(dart.fn(() => {
         dart.dcall(entry, args, null);
-      }, VoidTodynamic$()));
+      }, VoidToNull()));
     } else {
       rootContext.eval(core.Function._check(entry));
     }
@@ -8899,13 +9311,14 @@
           f(a, e);
         };
       })(_isolate_helper.IsolateNatives._processWorkerMessage, this.mainManager);
-      self.onmessage = func;
-      self.dartPrint = self.dartPrint || (function(serialize) {
+      _isolate_helper.global.onmessage = func;
+      _isolate_helper.global.dartPrint = _isolate_helper.global.dartPrint || (function(serialize) {
         return function(object) {
-          if (self.console && self.console.log) {
-            self.console.log(object);
+          var _self = _isolate_helper.global;
+          if (_self.console && _self.console.log) {
+            _self.console.log(object);
           } else {
-            self.postMessage(serialize(object));
+            _self.postMessage(serialize(object));
           }
         };
       })(_isolate_helper._Manager._serializePrintMessage);
@@ -9056,8 +9469,8 @@
         if (dart.test(this.errorsAreFatal) && core.identical(this, _isolate_helper._globalState.rootContext)) {
           return;
         }
-        if (self.console && self.console.error) {
-          self.console.error(error, stackTrace);
+        if (_isolate_helper.global.console && _isolate_helper.global.console.error) {
+          _isolate_helper.global.console.error(error, stackTrace);
         } else {
           core.print(error);
           if (stackTrace != null) core.print(stackTrace);
@@ -9283,7 +9696,7 @@
           if (!dart.test(this.runIteration())) return;
           async.Timer.run(next);
         }).bind(this);
-        dart.fn(next, VoidTodynamic$());
+        dart.fn(next, VoidToNull());
         next();
       } else {
         while (dart.test(this.runIteration())) {
@@ -9344,13 +9757,13 @@
     methods: () => ({process: dart.definiteFunctionType(dart.void, [])})
   });
   dart.defineLazy(_isolate_helper, {
-    get _global() {
+    get global() {
       return typeof global == 'undefined' ? self : global;
     }
   });
   _isolate_helper._MainManagerStub = class _MainManagerStub extends core.Object {
     postMessage(msg) {
-      _isolate_helper._global.postMessage(msg);
+      _isolate_helper.global.postMessage(msg);
     }
   };
   dart.setSignature(_isolate_helper._MainManagerStub, {
@@ -9360,17 +9773,17 @@
   _isolate_helper._SPAWN_FAILED_SIGNAL = "spawn failed";
   dart.copyProperties(_isolate_helper, {
     get globalWindow() {
-      return _isolate_helper._global.window;
+      return _isolate_helper.global.window;
     }
   });
   dart.copyProperties(_isolate_helper, {
     get globalWorker() {
-      return _isolate_helper._global.Worker;
+      return _isolate_helper.global.Worker;
     }
   });
   dart.copyProperties(_isolate_helper, {
     get globalPostMessageDefined() {
-      return !!_isolate_helper._global.postMessage;
+      return !!_isolate_helper.global.postMessage;
     }
   });
   _isolate_helper._MainFunction = dart.typedef('_MainFunction', () => dart.functionType(dart.dynamic, []));
@@ -9436,7 +9849,7 @@
           let context = new _isolate_helper._IsolateContext();
           _isolate_helper._globalState.topEventLoop.enqueue(context, dart.fn(() => {
             _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate.SendPort._check(replyTo));
-          }, VoidTodynamic$()), 'worker-start');
+          }, VoidToNull()), 'worker-start');
           _isolate_helper._globalState.currentContext = context;
           _isolate_helper._globalState.topEventLoop.run();
           break;
@@ -9486,9 +9899,9 @@
       let replyPort = dart.dindex(msg, 'replyPort');
       _isolate_helper.IsolateNatives.spawn(core.String._check(dart.dindex(msg, 'functionName')), core.String._check(dart.dindex(msg, 'uri')), ListOfString()._check(dart.dindex(msg, 'args')), dart.dindex(msg, 'msg'), false, core.bool._check(dart.dindex(msg, 'isSpawnUri')), core.bool._check(dart.dindex(msg, 'startPaused'))).then(dart.dynamic)(dart.fn(msg => {
         dart.dsend(replyPort, 'send', msg);
-      }, ListTodynamic()), {onError: dart.fn(errorMessage => {
+      }, ListToNull()), {onError: dart.fn(errorMessage => {
           dart.dsend(replyPort, 'send', JSArrayOfString().of([_isolate_helper._SPAWN_FAILED_SIGNAL, errorMessage]));
-        }, StringTodynamic())});
+        }, StringToNull())});
     }
     static _log(msg) {
       if (dart.test(_isolate_helper._globalState.isWorker)) {
@@ -9504,7 +9917,7 @@
       }
     }
     static _consoleLog(msg) {
-      self.console.log(msg);
+      _isolate_helper.global.console.log(msg);
     }
     static _getJSFunctionFromName(functionName) {
       let globalFunctionsContainer = _foreign_helper.JS_EMBEDDED_GLOBAL("", _js_embedded_names.GLOBAL_FUNCTIONS);
@@ -9545,7 +9958,7 @@
           dart.assert(dart.equals(dart.dindex(msg, 0), _isolate_helper._SPAWN_FAILED_SIGNAL));
           completer.completeError(dart.dindex(msg, 1));
         }
-      }, dynamicTodynamic$()));
+      }, dynamicToNull$()));
       let signalReply = port.sendPort;
       if (dart.test(_isolate_helper._globalState.useWorkers) && !dart.test(isLight)) {
         _isolate_helper.IsolateNatives._startWorker(functionName, uri, args, message, isSpawnUri, startPaused, signalReply, dart.fn(message => completer.completeError(message), StringTovoid$()));
@@ -9571,7 +9984,7 @@
       _isolate_helper._globalState.topEventLoop.enqueue(new _isolate_helper._IsolateContext(), dart.fn(() => {
         let func = _isolate_helper.IsolateNatives._getJSFunctionFromName(functionName);
         _isolate_helper.IsolateNatives._startIsolate(core.Function._check(func), args, message, isSpawnUri, startPaused, replyPort);
-      }, VoidTodynamic$()), 'nonworker start');
+      }, VoidToNull()), 'nonworker start');
     }
     static get currentIsolate() {
       let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
@@ -9716,7 +10129,7 @@
         if (!dart.test(this[_receivePort][_isClosed])) {
           this[_receivePort][_add](msg);
         }
-      }, VoidTodynamic$()), dart.str`receive ${message}`);
+      }, VoidToNull()), dart.str`receive ${message}`);
     }
     ['=='](other) {
       return _isolate_helper._NativeJsSendPort.is(other) && dart.equals(this[_receivePort], other[_receivePort]);
@@ -9850,13 +10263,11 @@
     let _EmptyStreamOfT = () => (_EmptyStreamOfT = dart.constFn(async._EmptyStream$(T)))();
     let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
     let _StreamControllerOfT = () => (_StreamControllerOfT = dart.constFn(async._StreamController$(T)))();
-    let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
     let _GeneratedStreamImplOfT = () => (_GeneratedStreamImplOfT = dart.constFn(async._GeneratedStreamImpl$(T)))();
     let _IterablePendingEventsOfT = () => (_IterablePendingEventsOfT = dart.constFn(async._IterablePendingEvents$(T)))();
     let _BoundSinkStreamOfdynamic$T = () => (_BoundSinkStreamOfdynamic$T = dart.constFn(async._BoundSinkStream$(dart.dynamic, T)))();
     let _AsBroadcastStreamOfT = () => (_AsBroadcastStreamOfT = dart.constFn(async._AsBroadcastStream$(T)))();
     let _WhereStreamOfT = () => (_WhereStreamOfT = dart.constFn(async._WhereStream$(T)))();
-    let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     let _HandleErrorStreamOfT = () => (_HandleErrorStreamOfT = dart.constFn(async._HandleErrorStream$(T)))();
     let StreamConsumerOfT = () => (StreamConsumerOfT = dart.constFn(async.StreamConsumer$(T)))();
     let TAndTToT = () => (TAndTToT = dart.constFn(dart.functionType(T, [T, T])))();
@@ -9871,12 +10282,14 @@
     let _SkipStreamOfT = () => (_SkipStreamOfT = dart.constFn(async._SkipStream$(T)))();
     let _SkipWhileStreamOfT = () => (_SkipWhileStreamOfT = dart.constFn(async._SkipWhileStream$(T)))();
     let _DistinctStreamOfT = () => (_DistinctStreamOfT = dart.constFn(async._DistinctStream$(T)))();
+    let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     let EventSinkOfT = () => (EventSinkOfT = dart.constFn(async.EventSink$(T)))();
     let _SyncBroadcastStreamControllerOfT = () => (_SyncBroadcastStreamControllerOfT = dart.constFn(async._SyncBroadcastStreamController$(T)))();
     let _SyncStreamControllerOfT = () => (_SyncStreamControllerOfT = dart.constFn(async._SyncStreamController$(T)))();
     let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
     let StreamSubscriptionOfTTovoid = () => (StreamSubscriptionOfTTovoid = dart.constFn(dart.functionType(dart.void, [StreamSubscriptionOfT()])))();
     let TTobool = () => (TTobool = dart.constFn(dart.functionType(core.bool, [T])))();
+    let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
     let TAndTTobool = () => (TAndTTobool = dart.constFn(dart.functionType(core.bool, [T, T])))();
     let EventSinkOfTTovoid = () => (EventSinkOfTTovoid = dart.constFn(dart.functionType(dart.void, [EventSinkOfT()])))();
     let FutureOfT = () => (FutureOfT = dart.constFn(async.Future$(T)))();
@@ -9884,10 +10297,10 @@
     let IterableOfT = () => (IterableOfT = dart.constFn(core.Iterable$(T)))();
     let intToT = () => (intToT = dart.constFn(dart.functionType(T, [core.int])))();
     let EventSinkOfTToEventSink = () => (EventSinkOfTToEventSink = dart.constFn(dart.functionType(async.EventSink, [EventSinkOfT()])))();
-    let TTodynamic$ = () => (TTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [T])))();
+    let TToNull = () => (TToNull = dart.constFn(dart.definiteFunctionType(core.Null, [T])))();
     let VoidTo_IterablePendingEventsOfT = () => (VoidTo_IterablePendingEventsOfT = dart.constFn(dart.definiteFunctionType(_IterablePendingEventsOfT(), [])))();
-    let TTovoid$ = () => (TTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [T])))();
     let VoidToT = () => (VoidToT = dart.constFn(dart.definiteFunctionType(T, [])))();
+    let TTovoid$ = () => (TTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [T])))();
     class Stream extends core.Object {
       new() {
       }
@@ -9901,10 +10314,10 @@
         future.then(dart.dynamic)(dart.fn(value => {
           controller[_add$](value);
           controller[_closeUnchecked]();
-        }, TTodynamic$()), {onError: dart.fn((error, stackTrace) => {
+        }, TToNull()), {onError: dart.fn((error, stackTrace) => {
             controller[_addError](error, core.StackTrace._check(stackTrace));
             controller[_closeUnchecked]();
-          }, dynamicAnddynamicTodynamic$())});
+          }, dynamicAnddynamicToNull())});
         return controller.stream;
       }
       static fromFutures(futures) {
@@ -9915,13 +10328,13 @@
             controller[_add$](value);
             if (--count == 0) controller[_closeUnchecked]();
           }
-        }, TTodynamic$());
+        }, TToNull());
         let onError = dart.fn((error, stack) => {
           if (!dart.test(controller.isClosed)) {
             controller[_addError](error, core.StackTrace._check(stack));
             if (--count == 0) controller[_closeUnchecked]();
           }
-        }, dynamicAnddynamicTodynamic$());
+        }, dynamicAnddynamicToNull());
         for (let future of futures) {
           count++;
           future.then(dart.dynamic)(onValue, {onError: onError});
@@ -9958,17 +10371,17 @@
           dart.assert(timer == null);
           timer = async.Timer.periodic(period, dart.fn(timer => {
             sendEvent();
-          }, TimerTovoid$()));
+          }, TimerToNull()));
         }
         dart.fn(startPeriodicTimer, VoidTovoid$());
         controller = StreamControllerOfT().new({sync: true, onListen: dart.fn(() => {
             watch.start();
             startPeriodicTimer();
-          }, VoidTovoid$()), onPause: dart.fn(() => {
+          }, VoidToNull()), onPause: dart.fn(() => {
             timer.cancel();
             timer = null;
             watch.stop();
-          }, VoidTovoid$()), onResume: dart.fn(() => {
+          }, VoidToNull()), onResume: dart.fn(() => {
             dart.assert(timer == null);
             let elapsed = watch.elapsed;
             watch.start();
@@ -9976,11 +10389,11 @@
               timer = null;
               startPeriodicTimer();
               sendEvent();
-            }, VoidTovoid$()));
-          }, VoidTovoid$()), onCancel: dart.fn(() => {
+            }, VoidToNull()));
+          }, VoidToNull()), onCancel: dart.fn(() => {
             if (timer != null) timer.cancel();
             timer = null;
-          }, VoidTodynamic$())});
+          }, VoidToNull())});
         return controller.stream;
       }
       static eventTransformed(source, mapSink) {
@@ -10023,25 +10436,25 @@
 
               if (async.Future.is(newValue)) {
                 subscription.pause();
-                newValue.then(dart.dynamic)(add, {onError: addError}).whenComplete(dart.bind(subscription, 'resume'));
+                newValue.then(dart.void)(add, {onError: addError}).whenComplete(dart.bind(subscription, 'resume'));
               } else {
                 controller.add(E.as(newValue));
               }
-            }, TTovoid$()), {onError: addError, onDone: dart.bind(controller, 'close')});
+            }, TToNull()), {onError: addError, onDone: dart.bind(controller, 'close')});
           }).bind(this);
           dart.fn(onListen, VoidTovoid$());
           if (dart.test(this.isBroadcast)) {
             controller = async.StreamController$(E).broadcast({onListen: onListen, onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTovoid$()), sync: true});
+              }, VoidToNull()), sync: true});
           } else {
             controller = async.StreamController$(E).new({onListen: onListen, onPause: dart.fn(() => {
                 subscription.pause();
-              }, VoidTovoid$()), onResume: dart.fn(() => {
+              }, VoidToNull()), onResume: dart.fn(() => {
                 subscription.resume();
-              }, VoidTovoid$()), onCancel: dart.fn(() => {
+              }, VoidToNull()), onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTodynamic$()), sync: true});
+              }, VoidToNull()), sync: true});
           }
           return controller.stream;
         };
@@ -10067,21 +10480,21 @@
                 subscription.pause();
                 controller.addStream(newStream).whenComplete(dart.bind(subscription, 'resume'));
               }
-            }, TTovoid$()), {onError: dart.bind(eventSink, _addError), onDone: dart.bind(controller, 'close')});
+            }, TToNull()), {onError: dart.bind(eventSink, _addError), onDone: dart.bind(controller, 'close')});
           }).bind(this);
           dart.fn(onListen, VoidTovoid$());
           if (dart.test(this.isBroadcast)) {
             controller = async.StreamController$(E).broadcast({onListen: onListen, onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTovoid$()), sync: true});
+              }, VoidToNull()), sync: true});
           } else {
             controller = async.StreamController$(E).new({onListen: onListen, onPause: dart.fn(() => {
                 subscription.pause();
-              }, VoidTovoid$()), onResume: dart.fn(() => {
+              }, VoidToNull()), onResume: dart.fn(() => {
                 subscription.resume();
-              }, VoidTovoid$()), onCancel: dart.fn(() => {
+              }, VoidToNull()), onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTodynamic$()), sync: true});
+              }, VoidToNull()), sync: true});
           }
           return controller.stream;
         };
@@ -10115,12 +10528,12 @@
           if (seenFirst) {
             async._runUserCode(dart.fn(() => combine(value, element), VoidToT()), dart.fn(newValue => {
               value = newValue;
-            }, TTodynamic$()), async._cancelAndErrorClosure(subscription, result));
+            }, TToNull()), async._cancelAndErrorClosure(subscription, result));
           } else {
             value = element;
             seenFirst = true;
           }
-        }, TTovoid$()), {onError: dart.bind(result, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(result, _completeError), onDone: dart.fn(() => {
             if (!seenFirst) {
               try {
                 dart.throw(_internal.IterableElementError.noElement());
@@ -10132,7 +10545,7 @@
             } else {
               result[_complete](value);
             }
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return result;
       }
       fold(S) {
@@ -10143,12 +10556,12 @@
           subscription = this.listen(dart.fn(element => {
             async._runUserCode(dart.fn(() => combine(value, element), dart.definiteFunctionType(S, [])), dart.fn(newValue => {
               value = newValue;
-            }, dart.definiteFunctionType(dart.dynamic, [S])), async._cancelAndErrorClosure(subscription, result));
-          }, TTovoid$()), {onError: dart.fn((e, st) => {
+            }, dart.definiteFunctionType(core.Null, [S])), async._cancelAndErrorClosure(subscription, result));
+          }, TToNull()), {onError: dart.fn((e, st) => {
               result[_completeError](e, core.StackTrace._check(st));
-            }, dynamicAnddynamicTodynamic$()), onDone: dart.fn(() => {
+            }, dynamicAnddynamicToNull()), onDone: dart.fn(() => {
               result[_complete](value);
-            }, VoidTovoid$()), cancelOnError: true});
+            }, VoidToNull()), cancelOnError: true});
           return result;
         };
       }
@@ -10170,11 +10583,11 @@
             async._cancelAndErrorWithReplacement(subscription, result, e, s);
           }
 
-        }, TTovoid$()), {onError: dart.fn(e => {
+        }, TToNull()), {onError: dart.fn(e => {
             result[_completeError](e);
-          }, dynamicTodynamic$()), onDone: dart.fn(() => {
+          }, dynamicToNull$()), onDone: dart.fn(() => {
             result[_complete](buffer.toString());
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return result;
       }
       contains(needle) {
@@ -10185,10 +10598,10 @@
             if (dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, true);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](false);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       forEach(action) {
@@ -10196,10 +10609,10 @@
         let subscription = null;
         subscription = this.listen(dart.fn(element => {
           async._runUserCode(dart.fn(() => action(element), VoidTovoid$()), dart.fn(_ => {
-          }, dynamicTodynamic$()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, dynamicToNull$()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](null);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       every(test) {
@@ -10210,10 +10623,10 @@
             if (!dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, false);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](true);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       any(test) {
@@ -10224,10 +10637,10 @@
             if (dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, true);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](false);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get length() {
@@ -10235,9 +10648,9 @@
         let count = 0;
         this.listen(dart.fn(_ => {
           count++;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](count);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get isEmpty() {
@@ -10245,9 +10658,9 @@
         let subscription = null;
         subscription = this.listen(dart.fn(_ => {
           async._cancelAndValue(subscription, future, false);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](true);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       toList() {
@@ -10255,9 +10668,9 @@
         let future = new (_FutureOfListOfT())();
         this.listen(dart.fn(data => {
           result[dartx.add](data);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](result);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       toSet() {
@@ -10265,9 +10678,9 @@
         let future = new (_FutureOfSetOfT())();
         this.listen(dart.fn(data => {
           result.add(data);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](result);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       drain(E) {
@@ -10297,7 +10710,7 @@
         let subscription = null;
         subscription = this.listen(dart.fn(value => {
           async._cancelAndValue(subscription, future, value);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             try {
               dart.throw(_internal.IterableElementError.noElement());
             } catch (e) {
@@ -10305,7 +10718,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get last() {
@@ -10315,7 +10728,7 @@
         this.listen(dart.fn(value => {
           foundResult = true;
           result = value;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10327,7 +10740,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get single() {
@@ -10348,7 +10761,7 @@
           }
           foundResult = true;
           result = value;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10360,7 +10773,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       firstWhere(test, opts) {
@@ -10372,8 +10785,8 @@
             if (dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, value);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (defaultValue != null) {
               async._runUserCode(defaultValue, dart.bind(future, _complete), dart.bind(future, _completeError));
               return;
@@ -10385,7 +10798,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       lastWhere(test, opts) {
@@ -10400,8 +10813,8 @@
               foundResult = true;
               result = value;
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10417,7 +10830,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       singleWhere(test) {
@@ -10441,8 +10854,8 @@
               foundResult = true;
               result = value;
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10454,7 +10867,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       elementAt(index) {
@@ -10468,9 +10881,9 @@
             return;
           }
           elementIndex = elementIndex + 1;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_completeError](core.RangeError.index(index, this, "index", null, elementIndex));
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       timeout(timeLimit, opts) {
@@ -10504,7 +10917,7 @@
           if (onTimeout == null) {
             timeout = dart.fn(() => {
               controller.addError(new async.TimeoutException("No stream event", timeLimit), null);
-            }, VoidTovoid$());
+            }, VoidToNull());
           } else {
             let registeredOnTimeout = zone.registerUnaryCallback(dart.dynamic, EventSinkOfT())(onTimeout);
             let wrapper = new async._ControllerEventSinkWrapper(null);
@@ -10512,7 +10925,7 @@
               wrapper[_sink] = controller;
               zone.runUnaryGuarded(dart.dynamic, EventSinkOfT())(registeredOnTimeout, wrapper);
               wrapper[_sink] = null;
-            }, VoidTovoid$());
+            }, VoidToNull());
           }
           subscription = this.listen(onData, {onError: onError, onDone: onDone});
           timer = zone.createTimer(timeLimit, timeout);
@@ -10528,10 +10941,10 @@
         controller = dart.test(this.isBroadcast) ? new (_SyncBroadcastStreamControllerOfT())(onListen, onCancel) : new (_SyncStreamControllerOfT())(onListen, dart.fn(() => {
           timer.cancel();
           subscription.pause();
-        }, VoidTovoid$()), dart.fn(() => {
+        }, VoidToNull()), dart.fn(() => {
           subscription.resume();
           timer = zone.createTimer(timeLimit, timeout);
-        }, VoidTovoid$()), onCancel);
+        }, VoidToNull()), onCancel);
         return controller.stream;
       }
     }
@@ -10664,7 +11077,7 @@
         }).bind(this);
         dart.fn(internalCallback, VoidTovoid$());
         _isolate_helper.enterJsAsync();
-        this[_handle] = self.setTimeout(internalCallback, milliseconds);
+        this[_handle] = _isolate_helper.global.setTimeout(internalCallback, milliseconds);
       } else {
         dart.assert(dart.notNull(milliseconds) > 0);
         dart.throw(new core.UnsupportedError("Timer greater than 0."));
@@ -10676,9 +11089,9 @@
       this[_handle] = null;
       if (dart.test(_isolate_helper.hasTimer())) {
         _isolate_helper.enterJsAsync();
-        this[_handle] = self.setInterval(dart.fn(() => {
+        this[_handle] = _isolate_helper.global.setInterval(dart.fn(() => {
           callback(this);
-        }, VoidTodynamic$()), milliseconds);
+        }, VoidToNull()), milliseconds);
       } else {
         dart.throw(new core.UnsupportedError("Periodic timer."));
       }
@@ -10691,9 +11104,9 @@
         if (this[_handle] == null) return;
         _isolate_helper.leaveJsAsync();
         if (dart.test(this[_once])) {
-          self.clearTimeout(this[_handle]);
+          _isolate_helper.global.clearTimeout(this[_handle]);
         } else {
-          self.clearInterval(this[_handle]);
+          _isolate_helper.global.clearInterval(this[_handle]);
         }
         this[_handle] = null;
       } else {
@@ -10720,7 +11133,7 @@
     methods: () => ({cancel: dart.definiteFunctionType(dart.void, [])})
   });
   _isolate_helper.hasTimer = function() {
-    return self.setTimeout != null;
+    return _isolate_helper.global.setTimeout != null;
   };
   dart.lazyFn(_isolate_helper.hasTimer, () => VoidTobool());
   _isolate_helper.CapabilityImpl = class CapabilityImpl extends core.Object {
@@ -11881,6 +12294,30 @@
     constructors: () => ({new: dart.definiteFunctionType(_js_helper.RuntimeError, [dart.dynamic])}),
     fields: () => ({message: dart.dynamic})
   });
+  core.AssertionError = class AssertionError extends core.Error {
+    new() {
+      super.new();
+    }
+    toString() {
+      return "Assertion failed";
+    }
+  };
+  dart.setSignature(core.AssertionError, {
+    constructors: () => ({new: dart.definiteFunctionType(core.AssertionError, [])})
+  });
+  _js_helper.AssertionErrorWithMessage = class AssertionErrorWithMessage extends core.AssertionError {
+    new(message) {
+      this[_message] = message;
+      super.new();
+    }
+    toString() {
+      return dart.str`Assertion failed: ${this[_message]}`;
+    }
+  };
+  dart.setSignature(_js_helper.AssertionErrorWithMessage, {
+    constructors: () => ({new: dart.definiteFunctionType(_js_helper.AssertionErrorWithMessage, [core.Object])}),
+    fields: () => ({[_message]: core.Object})
+  });
   _js_helper.random64 = function() {
     let int32a = Math.random() * 0x100000000 >>> 0;
     let int32b = Math.random() * 0x100000000 >>> 0;
@@ -12011,17 +12448,6 @@
     return SyncIterable;
   });
   _js_helper.SyncIterable = SyncIterable();
-  core.AssertionError = class AssertionError extends core.Error {
-    new() {
-      super.new();
-    }
-    toString() {
-      return "Assertion failed";
-    }
-  };
-  dart.setSignature(core.AssertionError, {
-    constructors: () => ({new: dart.definiteFunctionType(core.AssertionError, [])})
-  });
   _js_helper.BooleanConversionAssertionError = class BooleanConversionAssertionError extends core.AssertionError {
     new() {
       super.new();
@@ -12096,14 +12522,14 @@
     let LinkedHashMapKeyIterableOfK = () => (LinkedHashMapKeyIterableOfK = dart.constFn(_js_helper.LinkedHashMapKeyIterable$(K)))();
     let MappedIterableOfK$V = () => (MappedIterableOfK$V = dart.constFn(_internal.MappedIterable$(K, V)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let LinkedHashMapCellOfK$V = () => (LinkedHashMapCellOfK$V = dart.constFn(_js_helper.LinkedHashMapCell$(K, V)))();
     let LinkedHashMapOfK$V = () => (LinkedHashMapOfK$V = dart.constFn(collection.LinkedHashMap$(K, V)))();
     let InternalMapOfK$V = () => (InternalMapOfK$V = dart.constFn(_js_helper.InternalMap$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
     let KToV = () => (KToV = dart.constFn(dart.definiteFunctionType(V, [K])))();
     let KTobool = () => (KTobool = dart.constFn(dart.definiteFunctionType(core.bool, [K])))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     class JsLinkedHashMap extends core.Object {
       new() {
         this[_length$0] = 0;
@@ -12158,7 +12584,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       _get(key) {
         if (dart.test(_js_helper.JsLinkedHashMap._isStringKey(key))) {
@@ -12472,12 +12898,6 @@
         return new Map();
       }
     }
-    dart.setSignature(Es6LinkedHashMap, {
-      methods: () => ({
-        [_getTableCell]: dart.definiteFunctionType(_js_helper.LinkedHashMapCell$(K, V), [dart.dynamic, dart.dynamic]),
-        [_getTableBucket]: dart.definiteFunctionType(core.List$(_js_helper.LinkedHashMapCell$(K, V)), [dart.dynamic, dart.dynamic])
-      })
-    });
     return Es6LinkedHashMap;
   });
   _js_helper.Es6LinkedHashMap = Es6LinkedHashMap();
@@ -12542,8 +12962,7 @@
     dart.setSignature(LinkedHashMapKeyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_js_helper.LinkedHashMapKeyIterable$(E), [JsLinkedHashMapOfE$dynamic()])}),
       fields: () => ({[_map]: JsLinkedHashMapOfE$dynamic()}),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(LinkedHashMapKeyIterable, [
       'contains',
@@ -12991,10 +13410,7 @@
       [_pattern]: core.String,
       [_index$0]: core.int
     }),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(core.Match), []),
-      first: dart.definiteFunctionType(core.Match, [])
-    })
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(core.Match), [])})
   });
   dart.defineExtensionMembers(_js_helper._StringAllMatchesIterable, ['iterator', 'first']);
   _js_helper._StringAllMatchesIterator = class _StringAllMatchesIterator extends core.Object {
@@ -13264,11 +13680,11 @@
     }
   });
   _js_mirrors._dload = function(obj, name) {
-    return _js_mirrors._dart.dload(obj, name);
+    return _js_mirrors._dart.dloadMirror(obj, name);
   };
   dart.lazyFn(_js_mirrors._dload, () => dynamicAndStringTodynamic());
   _js_mirrors._dput = function(obj, name, val) {
-    _js_mirrors._dart.dput(obj, name, val);
+    _js_mirrors._dart.dputMirror(obj, name, val);
   };
   dart.lazyFn(_js_mirrors._dput, () => dynamicAndStringAnddynamicTovoid());
   _js_mirrors._dcall = function(obj, args) {
@@ -13309,7 +13725,31 @@
     if (privateSymbol != null) {
       return privateSymbol;
     }
-    return _js_mirrors.getName(symbol);
+    let name = _js_mirrors.getName(symbol);
+    switch (name) {
+      case '[]':
+      {
+        name = '_get';
+        break;
+      }
+      case '[]=':
+      {
+        name = '_set';
+        break;
+      }
+      case 'unary-':
+      {
+        name = '_negate';
+        break;
+      }
+      case 'constructor':
+      case 'prototype':
+      {
+        name = dart.str`_${name}`;
+        break;
+      }
+    }
+    return name;
   };
   dart.lazyFn(_js_mirrors._getMember, () => SymbolTodynamic());
   _js_mirrors._getNameForESSymbol = function(member) {
@@ -13414,7 +13854,7 @@
     let obj = {};
     map[dartx.forEach](dart.fn((key, value) => {
       obj[_js_mirrors.getName(key)] = value;
-    }, SymbolAnddynamicTovoid()));
+    }, SymbolAnddynamicToNull()));
     return obj;
   };
   dart.lazyFn(_js_mirrors._toJsMap, () => MapOfSymbol$dynamicTodynamic());
@@ -13629,7 +14069,7 @@
         constructors[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         if (dart.test(constructors[dartx.isEmpty])) {
           let name = 'new';
           let ft = _js_mirrors._defaultConstructorType(_js_mirrors._unwrap(this[_cls]));
@@ -13644,23 +14084,23 @@
             t = dart.dindex(t, 0);
           }
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let methods = _js_mirrors._getMethods(unwrapped);
         methods[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let getters = _js_mirrors._getGetters(unwrapped);
         getters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let setters = _js_mirrors._getSetters(unwrapped);
         setters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
           symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let staticFields = _js_mirrors._getStaticFields(unwrapped);
         staticFields[dartx.forEach](dart.fn((symbol, t) => {
           let name = _js_mirrors.getName(symbol);
@@ -13670,22 +14110,22 @@
             t = dart.dindex(t, 0);
           }
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let statics = _js_mirrors._getStatics(unwrapped);
         statics[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let staticGetters = _js_mirrors._getStaticGetters(unwrapped);
         staticGetters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let staticSetters = _js_mirrors._getStaticSetters(unwrapped);
         staticSetters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         this[_declarations] = MapOfSymbol$DeclarationMirror().unmodifiable(this[_declarations]);
       }
       return this[_declarations];
@@ -13853,21 +14293,21 @@
     })
   });
   const _symbol = Symbol('_symbol');
-  const _name$ = Symbol('_name');
+  const _name$0 = Symbol('_name');
   _js_mirrors.JsVariableMirror = class JsVariableMirror extends _js_mirrors.JsMirror {
     get simpleName() {
       return this[_symbol];
     }
     _(symbol, t, annotations) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.type = _js_mirrors.reflectType(t);
       this.metadata = ListOfInstanceMirror().unmodifiable(annotations[dartx.map](mirrors.InstanceMirror)(dart.fn(a => _js_mirrors.reflect(a), dynamicToInstanceMirror())));
       this.isStatic = false;
       this.isFinal = false;
     }
     toString() {
-      return dart.str`VariableMirror on '${this[_name$]}'`;
+      return dart.str`VariableMirror on '${this[_name$0]}'`;
     }
     get qualifiedName() {
       return core.Symbol._check(this.noSuchMethod(new dart.InvocationImpl('qualifiedName', [], {isGetter: true})));
@@ -13894,7 +14334,7 @@
     constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.Symbol, core.Type, core.List])}),
     fields: () => ({
       [_symbol]: core.Symbol,
-      [_name$]: core.String,
+      [_name$0]: core.String,
       type: mirrors.TypeMirror,
       metadata: ListOfInstanceMirror(),
       isStatic: core.bool,
@@ -13907,7 +14347,7 @@
       super._(member, t, annotations);
     }
     toString() {
-      return dart.str`ParameterMirror on '${this[_name$]}'`;
+      return dart.str`ParameterMirror on '${this[_name$0]}'`;
     }
     get qualifiedName() {
       return core.Symbol._check(this.noSuchMethod(new dart.InvocationImpl('qualifiedName', [], {isGetter: true})));
@@ -13952,17 +14392,17 @@
   let const$4;
   _js_mirrors.JsMethodMirror = class JsMethodMirror extends _js_mirrors.JsMirror {
     get isSetter() {
-      return this[_name$][dartx.endsWith]('=');
+      return this[_name$0][dartx.endsWith]('=');
     }
     get isPrivate() {
-      return this[_name$][dartx.startsWith]('_');
+      return this[_name$0][dartx.startsWith]('_');
     }
     get simpleName() {
       return this[_symbol];
     }
     _constructor(cls, symbol, ftype) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.isConstructor = true;
       this.isStatic = false;
       this[_params] = null;
@@ -13972,7 +14412,7 @@
     }
     _instanceMethod(cls, symbol, ftype) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.isConstructor = false;
       this.isStatic = false;
       this[_params] = null;
@@ -13982,7 +14422,7 @@
     }
     _staticMethod(cls, symbol, ftype) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.isConstructor = false;
       this.isStatic = true;
       this[_params] = null;
@@ -14032,7 +14472,7 @@
       this[_params] = ListOfParameterMirror().unmodifiable(params);
     }
     toString() {
-      return dart.str`MethodMirror on '${this[_name$]}'`;
+      return dart.str`MethodMirror on '${this[_name$0]}'`;
     }
     get qualifiedName() {
       return core.Symbol._check(this.noSuchMethod(new dart.InvocationImpl('qualifiedName', [], {isGetter: true})));
@@ -14092,7 +14532,7 @@
     }),
     fields: () => ({
       [_symbol]: core.Symbol,
-      [_name$]: core.String,
+      [_name$0]: core.String,
       [_params]: ListOfParameterMirror(),
       [_metadata$]: ListOfInstanceMirror(),
       isConstructor: core.bool,
@@ -14939,8 +15379,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(typed_data.Float32x4, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float32x4]),
-      sublist: dart.definiteFunctionType(core.List$(typed_data.Float32x4), [core.int], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float32x4])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeFloat32x4List, [
@@ -15572,8 +16011,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(typed_data.Int32x4, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Int32x4]),
-      sublist: dart.definiteFunctionType(core.List$(typed_data.Int32x4), [core.int], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Int32x4])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeInt32x4List, [
@@ -15689,8 +16127,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(typed_data.Float64x2, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float64x2]),
-      sublist: dart.definiteFunctionType(core.List$(typed_data.Float64x2), [core.int], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float64x2])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeFloat64x2List, [
@@ -16055,8 +16492,7 @@
     getters: () => ({length: dart.definiteFunctionType(core.int, [])}),
     methods: () => ({
       _get: dart.definiteFunctionType(core.double, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, core.num]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfdouble()], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, core.num])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeTypedArrayOfDouble, ['_get', '_set', 'setRange', 'length']);
@@ -16089,10 +16525,7 @@
   _native_typed_data.NativeTypedArrayOfInt[dart.implements] = () => [ListOfint()];
   dart.setSignature(_native_typed_data.NativeTypedArrayOfInt, {
     getters: () => ({length: dart.definiteFunctionType(core.int, [])}),
-    methods: () => ({
-      _set: dart.definiteFunctionType(dart.void, [core.int, core.int]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfint()], [core.int])
-    })
+    methods: () => ({_set: dart.definiteFunctionType(dart.void, [core.int, core.int])})
   });
   dart.defineExtensionMembers(_native_typed_data.NativeTypedArrayOfInt, ['_set', 'setRange', 'length']);
   dart.defineExtensionNames([
@@ -16136,7 +16569,6 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [ListOfdouble()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({[dartx.sublist]: dart.definiteFunctionType(core.List$(core.double), [core.int], [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [dart.dynamic, dart.dynamic]),
@@ -16186,7 +16618,6 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [ListOfdouble()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({[dartx.sublist]: dart.definiteFunctionType(core.List$(core.double), [core.int], [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [dart.dynamic, dart.dynamic]),
@@ -16241,10 +16672,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [_native_typed_data.NativeByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [dart.dynamic, dart.dynamic]),
@@ -16299,10 +16727,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [dart.dynamic, dart.dynamic]),
@@ -16357,10 +16782,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [dart.dynamic, dart.dynamic]),
@@ -16415,10 +16837,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [dart.dynamic, dart.dynamic]),
@@ -16473,10 +16892,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [dart.dynamic, dart.dynamic]),
@@ -16538,10 +16954,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [dart.dynamic, dart.dynamic]),
@@ -16604,10 +17017,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [dart.dynamic, dart.dynamic]),
@@ -17300,6 +17710,8 @@
     return end;
   };
   dart.fn(_native_typed_data._checkValidRange, intAndintAndintToint());
+  async._Callback = dart.typedef('_Callback', () => dart.functionType(dart.void, []));
+  async._TakeCallback = dart.typedef('_TakeCallback', () => dart.functionType(dart.void, [async._Callback]));
   async._invokeErrorHandler = function(errorHandler, error, stackTrace) {
     if (async.ZoneBinaryCallback.is(errorHandler)) {
       return dart.dcall(errorHandler, error, stackTrace);
@@ -17419,10 +17831,7 @@
     dart.setSignature(_ControllerStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._ControllerStream$(T), [_StreamControllerLifecycleOfT()])}),
       fields: () => ({[_controller$]: _StreamControllerLifecycleOfT()}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        '==': dart.definiteFunctionType(core.bool, [core.Object])
-      })
+      methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])})
     });
     return _ControllerStream;
   });
@@ -17527,7 +17936,7 @@
       }
       onDone(handleDone) {
         if (handleDone == null) handleDone = async._nullDoneHandler;
-        this[_onDone] = this[_zone].registerCallback(dart.dynamic)(handleDone);
+        this[_onDone] = this[_zone].registerCallback(dart.void)(handleDone);
       }
       pause(resumeSignal) {
         if (resumeSignal === void 0) resumeSignal = null;
@@ -17566,11 +17975,11 @@
           let result = new (async._Future$(E))();
           this[_onDone] = dart.fn(() => {
             result[_complete](futureValue);
-          }, VoidTovoid$());
+          }, VoidToNull());
           this[_onError] = dart.fn((error, stackTrace) => {
             this.cancel();
             result[_completeError](error, core.StackTrace._check(stackTrace));
-          }, dynamicAnddynamicTodynamic$());
+          }, dynamicAnddynamicToNull());
           return result;
         };
       }
@@ -17680,7 +18089,7 @@
         dart.assert(!dart.test(this[_inCallback]));
         let wasInputPaused = this[_isInputPaused];
         this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-        this[_zone].runUnaryGuarded(dart.dynamic, T)(this[_onData], data);
+        this[_zone].runUnaryGuarded(dart.void, T)(this[_onData], data);
         this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
         this[_checkState](wasInputPaused);
       }
@@ -17721,7 +18130,7 @@
         const sendDone = (function() {
           if (!dart.test(this[_waitsForCancel])) return;
           this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_CANCELED | async._BufferingStreamSubscription._STATE_CLOSED | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-          this[_zone].runGuarded(dart.dynamic)(this[_onDone]);
+          this[_zone].runGuarded(dart.void)(this[_onDone]);
           this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
         }).bind(this);
         dart.fn(sendDone, VoidTovoid$());
@@ -17737,7 +18146,7 @@
         dart.assert(!dart.test(this[_inCallback]));
         let wasInputPaused = this[_isInputPaused];
         this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-        dart.dcall(callback);
+        callback();
         this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
         this[_checkState](wasInputPaused);
       }
@@ -17818,7 +18227,7 @@
         [_sendData]: dart.definiteFunctionType(dart.void, [T]),
         [_sendError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
         [_sendDone]: dart.definiteFunctionType(dart.void, []),
-        [_guardCallback]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+        [_guardCallback]: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
         [_checkState]: dart.definiteFunctionType(dart.void, [core.bool])
       }),
       sfields: () => ({
@@ -18246,7 +18655,7 @@
   async._SyncBroadcastStreamController$ = dart.generic(T => {
     let _BufferingStreamSubscriptionOfT = () => (_BufferingStreamSubscriptionOfT = dart.constFn(async._BufferingStreamSubscription$(T)))();
     let SynchronousStreamControllerOfT = () => (SynchronousStreamControllerOfT = dart.constFn(async.SynchronousStreamController$(T)))();
-    let _BufferingStreamSubscriptionOfTTovoid = () => (_BufferingStreamSubscriptionOfTTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [_BufferingStreamSubscriptionOfT()])))();
+    let _BufferingStreamSubscriptionOfTToNull = () => (_BufferingStreamSubscriptionOfTToNull = dart.constFn(dart.definiteFunctionType(core.Null, [_BufferingStreamSubscriptionOfT()])))();
     class _SyncBroadcastStreamController extends async._BroadcastStreamController$(T) {
       new(onListen, onCancel) {
         super.new(onListen, onCancel);
@@ -18275,19 +18684,19 @@
         }
         this[_forEachListener](dart.fn(subscription => {
           subscription[_add$](data);
-        }, _BufferingStreamSubscriptionOfTTovoid()));
+        }, _BufferingStreamSubscriptionOfTToNull()));
       }
       [_sendError](error, stackTrace) {
         if (dart.test(this[_isEmpty])) return;
         this[_forEachListener](dart.fn(subscription => {
           subscription[_addError](error, stackTrace);
-        }, _BufferingStreamSubscriptionOfTTovoid()));
+        }, _BufferingStreamSubscriptionOfTToNull()));
       }
       [_sendDone]() {
         if (!dart.test(this[_isEmpty])) {
           this[_forEachListener](dart.fn(subscription => {
             subscription[_close$]();
-          }, _BufferingStreamSubscriptionOfTTovoid()));
+          }, _BufferingStreamSubscriptionOfTToNull()));
         } else {
           dart.assert(this[_doneFuture] != null);
           dart.assert(this[_doneFuture][_mayComplete]);
@@ -18414,10 +18823,7 @@
       constructors: () => ({new: dart.definiteFunctionType(async._AsBroadcastStreamController$(T), [VoidTovoid(), VoidTovoid()])}),
       fields: () => ({[_pending]: _StreamImplEventsOfT()}),
       getters: () => ({[_hasPending]: dart.definiteFunctionType(core.bool, [])}),
-      methods: () => ({
-        [_addPendingEvent]: dart.definiteFunctionType(dart.void, [async._DelayedEvent]),
-        add: dart.definiteFunctionType(dart.void, [T])
-      })
+      methods: () => ({[_addPendingEvent]: dart.definiteFunctionType(dart.void, [async._DelayedEvent])})
     });
     return _AsBroadcastStreamController;
   });
@@ -18436,7 +18842,7 @@
       onDone(handleDone) {}
       pause(resumeSignal) {
         if (resumeSignal === void 0) resumeSignal = null;
-        if (resumeSignal != null) resumeSignal.then(dart.dynamic)(dart.bind(this, _resume));
+        if (resumeSignal != null) resumeSignal.then(dart.void)(dart.bind(this, _resume));
         this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
       }
       resume() {
@@ -18511,6 +18917,20 @@
     constructors: () => ({new: dart.definiteFunctionType(async.DeferredLoadException, [core.String])}),
     fields: () => ({[_s]: core.String})
   });
+  async.FutureOr$ = dart.generic(T => {
+    class FutureOr extends core.Object {
+      _() {
+        dart.throw(new core.UnsupportedError("FutureOr can't be instantiated"));
+      }
+    }
+    dart.addTypeTests(FutureOr);
+    dart.defineNamedConstructor(FutureOr, '_');
+    dart.setSignature(FutureOr, {
+      constructors: () => ({_: dart.definiteFunctionType(async.FutureOr$(T), [])})
+    });
+    return FutureOr;
+  });
+  async.FutureOr = FutureOr();
   const _completeWithValue = Symbol('_completeWithValue');
   let const$8;
   async.Future$ = dart.flattenFutures(dart.generic(T => {
@@ -18527,7 +18947,7 @@
             async._completeWithErrorCallback(result, e, s);
           }
 
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         return result;
       }
       static microtask(computation) {
@@ -18540,7 +18960,7 @@
             async._completeWithErrorCallback(result, e, s);
           }
 
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         return result;
       }
       static sync(computation) {
@@ -18574,13 +18994,13 @@
         let result = new (_FutureOfT())();
         async.Timer.new(duration, dart.fn(() => {
           try {
-            result[_complete](computation == null ? null : computation());
+            result[_complete](dart.nullSafe(computation, _ => _()));
           } catch (e) {
             let s = dart.stackTrace(e);
             async._completeWithErrorCallback(result, e, s);
           }
 
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         return result;
       }
       static wait(T) {
@@ -18600,7 +19020,7 @@
                   if (value != null) {
                     async.Future.sync(dart.fn(() => {
                       cleanUp(value);
-                    }, VoidTodynamic$()));
+                    }, VoidToNull()));
                   }
                 }
               }
@@ -18616,31 +19036,43 @@
             }
           }
           dart.fn(handleError, dynamicAnddynamicTovoid$());
-          for (let future of futures) {
-            let pos = remaining++;
-            future.then(dart.dynamic)(dart.fn(value => {
-              remaining--;
-              if (values != null) {
-                values[dartx._set](pos, value);
-                if (remaining == 0) {
-                  result[_completeWithValue](values);
+          try {
+            for (let future of futures) {
+              let pos = remaining;
+              future.then(dart.dynamic)(dart.fn(value => {
+                remaining--;
+                if (values != null) {
+                  values[dartx._set](pos, value);
+                  if (remaining == 0) {
+                    result[_completeWithValue](values);
+                  }
+                } else {
+                  if (cleanUp != null && value != null) {
+                    async.Future.sync(dart.fn(() => {
+                      cleanUp(value);
+                    }, VoidToNull()));
+                  }
+                  if (remaining == 0 && !dart.test(eagerError)) {
+                    result[_completeError](error, stackTrace);
+                  }
                 }
-              } else {
-                if (cleanUp != null && value != null) {
-                  async.Future.sync(dart.fn(() => {
-                    cleanUp(value);
-                  }, VoidTodynamic$()));
-                }
-                if (remaining == 0 && !dart.test(eagerError)) {
-                  result[_completeError](error, stackTrace);
-                }
-              }
-            }, dart.definiteFunctionType(dart.dynamic, [T])), {onError: handleError});
+              }, dart.definiteFunctionType(core.Null, [T])), {onError: handleError});
+              remaining++;
+            }
+            if (remaining == 0) {
+              return async.Future$(core.List$(T)).value(const$8 || (const$8 = dart.constList([], dart.dynamic)));
+            }
+            values = core.List$(T).new(remaining);
+          } catch (e) {
+            let st = dart.stackTrace(e);
+            if (remaining == 0 || dart.test(eagerError)) {
+              return async.Future$(core.List$(T)).error(e, st);
+            } else {
+              error = e;
+              stackTrace = st;
+            }
           }
-          if (remaining == 0) {
-            return async.Future$(core.List$(T)).value(const$8 || (const$8 = dart.constList([], dart.dynamic)));
-          }
-          values = core.List$(T).new(remaining);
+
           return result;
         };
       }
@@ -18649,10 +19081,10 @@
           let completer = async.Completer$(T).sync();
           let onValue = dart.fn(value => {
             if (!dart.test(completer.isCompleted)) completer.complete(value);
-          }, dart.definiteFunctionType(dart.dynamic, [T]));
+          }, dart.definiteFunctionType(core.Null, [T]));
           let onError = dart.fn((error, stack) => {
             if (!dart.test(completer.isCompleted)) completer.completeError(error, core.StackTrace._check(stack));
-          }, dynamicAnddynamicTodynamic$());
+          }, dynamicAnddynamicToNull());
           for (let future of futures) {
             future.then(dart.dynamic)(onValue, {onError: onError});
           }
@@ -18671,11 +19103,11 @@
         let nextIteration = null;
         nextIteration = async.Zone.current.bindUnaryCallback(dart.dynamic, core.bool)(dart.fn(keepGoing => {
           if (dart.test(keepGoing)) {
-            async.Future.sync(f).then(dart.dynamic)(dynamicTodynamic()._check(nextIteration), {onError: dart.bind(doneSignal, _completeError)});
+            async.Future.sync(f).then(dart.dynamic)(dynamicToFutureOr()._check(nextIteration), {onError: dart.bind(doneSignal, _completeError)});
           } else {
             doneSignal[_complete](null);
           }
-        }, boolTodynamic()), {runGuarded: true});
+        }, boolToNull()), {runGuarded: true});
         dart.dcall(nextIteration, true);
         return doneSignal;
       }
@@ -19012,6 +19444,7 @@
   const _setChained = Symbol('_setChained');
   const _thenNoZoneRegistration = Symbol('_thenNoZoneRegistration');
   const _setPendingComplete = Symbol('_setPendingComplete');
+  const _clearPendingComplete = Symbol('_clearPendingComplete');
   const _error = Symbol('_error');
   const _chainSource = Symbol('_chainSource');
   const _setValue = Symbol('_setValue');
@@ -19027,7 +19460,7 @@
     let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
     let FutureOfT = () => (FutureOfT = dart.constFn(async.Future$(T)))();
     let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
-    let TTodynamic$ = () => (TTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [T])))();
+    let TToNull = () => (TToNull = dart.constFn(dart.definiteFunctionType(core.Null, [T])))();
     class _Future extends core.Object {
       new() {
         this[_zone] = async.Zone.current;
@@ -19076,7 +19509,7 @@
           let currentZone = async.Zone.current;
           let registered = null;
           if (!core.identical(currentZone, async._ROOT_ZONE)) {
-            f = currentZone.registerUnaryCallback(dart.dynamic, T)(f);
+            f = currentZone.registerUnaryCallback(async.FutureOr$(E), T)(f);
             if (onError != null) {
               onError = async._registerErrorHandler(T)(onError, currentZone);
             }
@@ -19116,6 +19549,10 @@
         dart.assert(this[_mayComplete]);
         this[_state] = async._Future._PENDING_COMPLETE;
       }
+      [_clearPendingComplete]() {
+        dart.assert(this[_isPendingComplete]);
+        this[_state] = async._Future._INCOMPLETE;
+      }
       get [_error]() {
         dart.assert(this[_hasError]);
         return async.AsyncError._check(this[_resultOrListeners]);
@@ -19161,7 +19598,7 @@
           dart.assert(this[_isComplete]);
           this[_zone].scheduleMicrotask(dart.fn(() => {
             async._Future._propagateToListeners(this, listener);
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
       }
       [_prependListeners](listeners) {
@@ -19189,7 +19626,7 @@
           listeners = this[_reverseListeners](listeners);
           this[_zone].scheduleMicrotask(dart.fn(() => {
             async._Future._propagateToListeners(this, listeners);
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
       }
       [_removeListeners]() {
@@ -19216,17 +19653,18 @@
         try {
           source.then(dart.dynamic)(dart.fn(value => {
             dart.assert(target[_isPendingComplete]);
-            target[_completeWithValue](value);
-          }, dynamicTodynamic$()), {onError: dart.fn((error, stackTrace) => {
+            target[_clearPendingComplete]();
+            target[_complete](value);
+          }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
               if (stackTrace === void 0) stackTrace = null;
               dart.assert(target[_isPendingComplete]);
               target[_completeError](error, core.StackTrace._check(stackTrace));
-            }, dynamic__Todynamic())});
+            }, dynamic__ToNull())});
         } catch (e) {
           let s = dart.stackTrace(e);
           async.scheduleMicrotask(dart.fn(() => {
             target[_completeError](e, s);
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
 
       }
@@ -19284,7 +19722,7 @@
               this[_setPendingComplete]();
               this[_zone].scheduleMicrotask(dart.fn(() => {
                 async._Future._chainCoreFuture(coreFuture, this);
-              }, VoidTovoid$()));
+              }, VoidToNull()));
             } else {
               async._Future._chainCoreFuture(coreFuture, this);
             }
@@ -19297,14 +19735,14 @@
         this[_setPendingComplete]();
         this[_zone].scheduleMicrotask(dart.fn(() => {
           this[_completeWithValue](typedValue);
-        }, VoidTovoid$()));
+        }, VoidToNull()));
       }
       [_asyncCompleteError](error, stackTrace) {
         dart.assert(!dart.test(this[_isComplete]));
         this[_setPendingComplete]();
         this[_zone].scheduleMicrotask(dart.fn(() => {
           this[_completeError](error, stackTrace);
-        }, VoidTovoid$()));
+        }, VoidToNull()));
       }
       static _propagateToListeners(source, listeners) {
         while (true) {
@@ -19448,7 +19886,7 @@
         if (onTimeout == null) {
           timer = async.Timer.new(timeLimit, dart.fn(() => {
             result[_completeError](new async.TimeoutException("Future not completed", timeLimit));
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         } else {
           let zone = async.Zone.current;
           onTimeout = zone.registerCallback(dart.dynamic)(onTimeout);
@@ -19460,19 +19898,19 @@
               result[_completeError](e, s);
             }
 
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
         this.then(dart.dynamic)(dart.fn(v => {
           if (dart.test(timer.isActive)) {
             timer.cancel();
             result[_completeWithValue](v);
           }
-        }, TTodynamic$()), {onError: dart.fn((e, s) => {
+        }, TToNull()), {onError: dart.fn((e, s) => {
             if (dart.test(timer.isActive)) {
               timer.cancel();
               result[_completeError](e, core.StackTrace._check(s));
             }
-          }, dynamicAnddynamicTodynamic$())});
+          }, dynamicAnddynamicToNull())});
         return result;
       }
     }
@@ -19503,12 +19941,13 @@
       }),
       methods: () => ({
         [_setChained]: dart.definiteFunctionType(dart.void, [async._Future]),
-        then: dart.definiteFunctionType(E => [async.Future$(E), [TTodynamic()], {onError: core.Function}]),
+        then: dart.definiteFunctionType(E => [async.Future$(E), [dart.functionType(async.FutureOr$(E), [T])], {onError: core.Function}]),
         [_thenNoZoneRegistration]: dart.definiteFunctionType(E => [async.Future$(E), [TTodynamic(), core.Function]]),
         catchError: dart.definiteFunctionType(async.Future$(T), [core.Function], {test: dynamicTobool()}),
         whenComplete: dart.definiteFunctionType(async.Future$(T), [VoidTodynamic()]),
         asStream: dart.definiteFunctionType(async.Stream$(T), []),
         [_setPendingComplete]: dart.definiteFunctionType(dart.void, []),
+        [_clearPendingComplete]: dart.definiteFunctionType(dart.void, []),
         [_setValue]: dart.definiteFunctionType(dart.void, [T]),
         [_setErrorObject]: dart.definiteFunctionType(dart.void, [async.AsyncError]),
         [_setError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
@@ -19629,41 +20068,41 @@
     }
     let implementation = currentZone[_scheduleMicrotask];
     if (core.identical(async._ROOT_ZONE, implementation.zone) && dart.test(async._ROOT_ZONE.inSameErrorZone(currentZone))) {
-      async._rootScheduleMicrotask(null, null, currentZone, currentZone.registerCallback(dart.dynamic)(callback));
+      async._rootScheduleMicrotask(null, null, currentZone, currentZone.registerCallback(dart.void)(callback));
       return;
     }
-    async.Zone.current.scheduleMicrotask(async.Zone.current.bindCallback(dart.dynamic)(callback, {runGuarded: true}));
+    async.Zone.current.scheduleMicrotask(async.Zone.current.bindCallback(dart.void)(callback, {runGuarded: true}));
   };
   dart.fn(async.scheduleMicrotask, _AsyncCallbackTovoid());
   async._AsyncRun = class _AsyncRun extends core.Object {
     static _scheduleImmediate(callback) {
-      dart.dcall(async._AsyncRun._scheduleImmediateClosure, callback);
+      async._AsyncRun._scheduleImmediateClosure(callback);
     }
     static _initializeScheduleImmediate() {
-      if (self.scheduleImmediate != null) {
+      if (_isolate_helper.global.scheduleImmediate != null) {
         return async._AsyncRun._scheduleImmediateJsOverride;
       }
-      if (self.MutationObserver != null && self.document != null) {
-        let div = self.document.createElement("div");
-        let span = self.document.createElement("span");
+      if (_isolate_helper.global.MutationObserver != null && _isolate_helper.global.document != null) {
+        let div = _isolate_helper.global.document.createElement("div");
+        let span = _isolate_helper.global.document.createElement("span");
         let storedCallback = null;
         function internalCallback(_) {
           _isolate_helper.leaveJsAsync();
           let f = storedCallback;
           storedCallback = null;
-          dart.dcall(f);
+          f();
         }
-        dart.fn(internalCallback, dynamicTodynamic$());
+        dart.fn(internalCallback, dynamicToNull$());
         ;
-        let observer = new self.MutationObserver(internalCallback);
+        let observer = new _isolate_helper.global.MutationObserver(internalCallback);
         observer.observe(div, {childList: true});
         return dart.fn(callback => {
           dart.assert(storedCallback == null);
           _isolate_helper.enterJsAsync();
           storedCallback = callback;
           div.firstChild ? div.removeChild(span) : div.appendChild(span);
-        }, FnTodynamic());
-      } else if (self.setImmediate != null) {
+        }, FnToNull());
+      } else if (_isolate_helper.global.setImmediate != null) {
         return async._AsyncRun._scheduleImmediateWithSetImmediate;
       }
       return async._AsyncRun._scheduleImmediateWithTimer;
@@ -19673,30 +20112,30 @@
         _isolate_helper.leaveJsAsync();
         callback();
       }
-      dart.fn(internalCallback, VoidTodynamic$());
+      dart.fn(internalCallback, VoidToNull());
       ;
       _isolate_helper.enterJsAsync();
-      self.scheduleImmediate(internalCallback);
+      _isolate_helper.global.scheduleImmediate(internalCallback);
     }
     static _scheduleImmediateWithSetImmediate(callback) {
       function internalCallback() {
         _isolate_helper.leaveJsAsync();
         callback();
       }
-      dart.fn(internalCallback, VoidTodynamic$());
+      dart.fn(internalCallback, VoidToNull());
       ;
       _isolate_helper.enterJsAsync();
-      self.setImmediate(internalCallback);
+      _isolate_helper.global.setImmediate(internalCallback);
     }
     static _scheduleImmediateWithTimer(callback) {
       async.Timer._createTimer(core.Duration.ZERO, callback);
     }
   };
   dart.setSignature(async._AsyncRun, {
-    sfields: () => ({_scheduleImmediateClosure: core.Function}),
+    sfields: () => ({_scheduleImmediateClosure: async._TakeCallback}),
     statics: () => ({
       _scheduleImmediate: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
-      _initializeScheduleImmediate: dart.definiteFunctionType(core.Function, []),
+      _initializeScheduleImmediate: dart.definiteFunctionType(async._TakeCallback, []),
       _scheduleImmediateJsOverride: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
       _scheduleImmediateWithSetImmediate: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
       _scheduleImmediateWithTimer: dart.definiteFunctionType(dart.void, [VoidTovoid()])
@@ -19752,10 +20191,7 @@
     dart.setSignature(StreamView, {
       constructors: () => ({new: dart.definiteFunctionType(async.StreamView$(T), [StreamOfT()])}),
       fields: () => ({[_stream]: StreamOfT()}),
-      methods: () => ({
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
-        listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})
-      })
+      methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
     });
     return StreamView;
   });
@@ -20100,7 +20536,7 @@
         subscription[_setPendingEvents](pendingEvents);
         subscription[_guardCallback](dart.fn(() => {
           async._runGuarded(this.onListen);
-        }, VoidTodynamic$()));
+        }, VoidToNull()));
         return subscription;
       }
       [_recordCancel](subscription) {
@@ -20360,7 +20796,7 @@
         return dart.fn((e, s) => {
           controller[_addError](e, s);
           controller[_close$]();
-        }, dynamicAndStackTraceTodynamic());
+        }, dynamicAndStackTraceToNull());
       }
       pause() {
         this.addSubscription.pause();
@@ -20376,7 +20812,7 @@
         }
         return cancel.whenComplete(dart.fn(() => {
           this.addStreamFuture[_asyncComplete](null);
-        }, VoidTodynamic$()));
+        }, VoidToNull()));
       }
       complete() {
         this.addStreamFuture[_asyncComplete](null);
@@ -20460,8 +20896,7 @@
       fields: () => ({
         [_pending]: _EventGeneratorOfT(),
         [_isUsed]: core.bool
-      }),
-      methods: () => ({[_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool])})
+      })
     });
     return _GeneratedStreamImpl;
   });
@@ -20494,7 +20929,7 @@
           this[_state] = async._PendingEvents._STATE_UNSCHEDULED;
           if (oldState == async._PendingEvents._STATE_CANCELED) return;
           this.handleNext(dispatch);
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         this[_state] = async._PendingEvents._STATE_SCHEDULED;
       }
       cancelSchedule() {
@@ -20801,7 +21236,7 @@
           let result = new (async._Future$(E))();
           this[_onDone] = dart.fn(() => {
             result[_completeWithValue](null);
-          }, VoidTovoid$());
+          }, VoidToNull());
           return result;
         };
       }
@@ -20809,7 +21244,7 @@
         this[_state] = (dart.notNull(this[_state]) & ~async._DoneStreamSubscription._SCHEDULED) >>> 0;
         if (dart.test(this.isPaused)) return;
         this[_state] = (dart.notNull(this[_state]) | async._DoneStreamSubscription._DONE_SENT) >>> 0;
-        if (this[_onDone] != null) this[_zone].runGuarded(dart.dynamic)(this[_onDone]);
+        if (this[_onDone] != null) this[_zone].runGuarded(dart.void)(this[_onDone]);
       }
     }
     dart.addTypeTests(_DoneStreamSubscription);
@@ -20894,7 +21329,7 @@
       [_onCancel]() {
         let shutdown = this[_controller$] == null || dart.test(this[_controller$].isClosed);
         if (this[_onCancelHandler] != null) {
-          this[_zone].runUnary(dart.dynamic, _BroadcastSubscriptionWrapperOfT())(this[_onCancelHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
+          this[_zone].runUnary(dart.void, _BroadcastSubscriptionWrapperOfT())(this[_onCancelHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
         }
         if (shutdown) {
           if (this[_subscription] != null) {
@@ -20905,7 +21340,7 @@
       }
       [_onListen]() {
         if (this[_onListenHandler] != null) {
-          this[_zone].runUnary(dart.dynamic, _BroadcastSubscriptionWrapperOfT())(this[_onListenHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
+          this[_zone].runUnary(dart.void, _BroadcastSubscriptionWrapperOfT())(this[_onListenHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
         }
       }
       [_cancelSubscription]() {
@@ -21220,7 +21655,7 @@
   async._cancelAndErrorClosure = function(subscription, future) {
     return dart.fn((error, stackTrace) => {
       async._cancelAndError(subscription, future, error, stackTrace);
-    }, dynamicAndStackTraceTovoid());
+    }, dynamicAndStackTraceToNull());
   };
   dart.fn(async._cancelAndErrorClosure, StreamSubscriptionAnd_FutureTo_ErrorCallback());
   async._cancelAndValue = function(subscription, future, value) {
@@ -21340,7 +21775,6 @@
         [_subscription]: StreamSubscriptionOfS()
       }),
       methods: () => ({
-        [_add$]: dart.definiteFunctionType(dart.void, [T]),
         [_handleData]: dart.definiteFunctionType(dart.void, [S]),
         [_handleError]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
         [_handleDone]: dart.definiteFunctionType(dart.void, [])
@@ -21392,8 +21826,7 @@
     }
     dart.setSignature(_WhereStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._WhereStream$(T), [StreamOfT(), _PredicateOfT()])}),
-      fields: () => ({[_test]: _PredicateOfT()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])})
+      fields: () => ({[_test]: _PredicateOfT()})
     });
     return _WhereStream;
   });
@@ -21430,8 +21863,7 @@
     }
     dart.setSignature(_MapStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._MapStream$(S, T), [StreamOfS(), _TransformationOfS$T()])}),
-      fields: () => ({[_transform]: _TransformationOfS$T()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [S, _EventSinkOfT()])})
+      fields: () => ({[_transform]: _TransformationOfS$T()})
     });
     return _MapStream;
   });
@@ -21463,8 +21895,7 @@
     }
     dart.setSignature(_ExpandStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._ExpandStream$(S, T), [StreamOfS(), _TransformationOfS$IterableOfT()])}),
-      fields: () => ({[_expand]: _TransformationOfS$IterableOfT()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [S, _EventSinkOfT()])})
+      fields: () => ({[_expand]: _TransformationOfS$IterableOfT()})
     });
     return _ExpandStream;
   });
@@ -21553,11 +21984,7 @@
     }
     dart.setSignature(_TakeStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._TakeStream$(T), [StreamOfT(), core.int])}),
-      fields: () => ({[_count]: core.int}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-      })
+      fields: () => ({[_count]: core.int})
     });
     return _TakeStream;
   });
@@ -21631,8 +22058,7 @@
     }
     dart.setSignature(_TakeWhileStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._TakeWhileStream$(T), [StreamOfT(), _PredicateOfT()])}),
-      fields: () => ({[_test]: _PredicateOfT()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])})
+      fields: () => ({[_test]: _PredicateOfT()})
     });
     return _TakeWhileStream;
   });
@@ -21665,11 +22091,7 @@
     }
     dart.setSignature(_SkipStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._SkipStream$(T), [StreamOfT(), core.int])}),
-      fields: () => ({[_count]: core.int}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-      })
+      fields: () => ({[_count]: core.int})
     });
     return _SkipStream;
   });
@@ -21715,11 +22137,7 @@
     }
     dart.setSignature(_SkipWhileStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._SkipWhileStream$(T), [StreamOfT(), _PredicateOfT()])}),
-      fields: () => ({[_test]: _PredicateOfT()}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-      })
+      fields: () => ({[_test]: _PredicateOfT()})
     });
     return _SkipWhileStream;
   });
@@ -21773,7 +22191,6 @@
         [_equals]: _EqualityOfT(),
         [_previous$]: core.Object
       }),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])}),
       sfields: () => ({_SENTINEL: core.Object})
     });
     return _DistinctStream;
@@ -21914,7 +22331,6 @@
       }),
       getters: () => ({[_isSubscribed]: dart.definiteFunctionType(core.bool, [])}),
       methods: () => ({
-        [_add$]: dart.definiteFunctionType(dart.void, [T]),
         [_handleData]: dart.definiteFunctionType(dart.void, [S]),
         [_handleError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [dart.dynamic]),
         [_handleDone]: dart.definiteFunctionType(dart.void, [])
@@ -22082,7 +22498,6 @@
     }
     dart.setSignature(_StreamHandlerTransformer, {
       constructors: () => ({new: dart.definiteFunctionType(async._StreamHandlerTransformer$(S, T), [], {handleData: SAndEventSinkOfTTovoid(), handleError: ObjectAndStackTraceAndEventSinkOfTTovoid(), handleDone: EventSinkOfTTovoid()})}),
-      methods: () => ({bind: dart.definiteFunctionType(async.Stream$(T), [StreamOfS()])}),
       statics: () => ({
         _defaultHandleData: dart.definiteFunctionType(dart.void, [dart.dynamic, async.EventSink]),
         _defaultHandleError: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace, async.EventSink]),
@@ -22161,7 +22576,7 @@
       if (dart.equals(async.Zone.current, async.Zone.ROOT)) {
         return async.Zone.current.createTimer(duration, callback);
       }
-      return async.Zone.current.createTimer(duration, async.Zone.current.bindCallback(dart.dynamic)(callback, {runGuarded: true}));
+      return async.Zone.current.createTimer(duration, async.Zone.current.bindCallback(dart.void)(callback, {runGuarded: true}));
     }
     static periodic(duration, callback) {
       if (dart.equals(async.Zone.current, async.Zone.ROOT)) {
@@ -22822,7 +23237,7 @@
         if (error == null) error = new core.NullThrownError();
         if (stackTrace == null) dart.throw(error);
         async._rethrow(error, stackTrace);
-      }, VoidTovoid$()));
+      }, VoidToNull()));
     };
   };
   dart.lazyFn(async._rootHandleUncaughtError, () => ZoneAndZoneDelegateAndZone__ToR());
@@ -22900,7 +23315,7 @@
   dart.fn(async._rootScheduleMicrotask, ZoneAndZoneDelegateAndZone__Tovoid());
   async._rootCreateTimer = function(self, parent, zone, duration, callback) {
     if (!core.identical(async._ROOT_ZONE, zone)) {
-      callback = zone.bindCallback(dart.dynamic)(callback);
+      callback = zone.bindCallback(dart.void)(callback);
     }
     return async.Timer._createTimer(duration, callback);
   };
@@ -23258,13 +23673,13 @@
     let _HashMapKeyIterableOfK = () => (_HashMapKeyIterableOfK = dart.constFn(collection._HashMapKeyIterable$(K)))();
     let MappedIterableOfK$V = () => (MappedIterableOfK$V = dart.constFn(_internal.MappedIterable$(K, V)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let ListOfK = () => (ListOfK = dart.constFn(core.List$(K)))();
     let HashMapOfK$V = () => (HashMapOfK$V = dart.constFn(collection.HashMap$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
     let KToV = () => (KToV = dart.constFn(dart.definiteFunctionType(V, [K])))();
     let KTobool = () => (KTobool = dart.constFn(dart.definiteFunctionType(core.bool, [K])))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     class _HashMap extends core.Object {
       new() {
         this[_length$1] = 0;
@@ -23312,7 +23727,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       _get(key) {
         if (dart.test(collection._HashMap._isStringKey(key))) {
@@ -23663,11 +24078,6 @@
         [_equals$]: _EqualityOfK(),
         [_hashCode]: _HasherOfK(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        _get: dart.definiteFunctionType(V, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [K, V]),
-        remove: dart.definiteFunctionType(V, [core.Object])
       })
     });
     dart.defineExtensionMembers(_CustomHashMap, ['_get', '_set', 'containsKey', 'remove']);
@@ -23710,8 +24120,7 @@
     dart.setSignature(_HashMapKeyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(collection._HashMapKeyIterable$(E), [_HashMapOfE$dynamic()])}),
       fields: () => ({[_map$0]: _HashMapOfE$dynamic()}),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(_HashMapKeyIterable, [
       'contains',
@@ -23811,11 +24220,11 @@
   collection._Es6LinkedIdentityHashMap$ = dart.generic((K, V) => {
     let _Es6MapIterableOfK = () => (_Es6MapIterableOfK = dart.constFn(collection._Es6MapIterable$(K)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let InternalMapOfK$V = () => (InternalMapOfK$V = dart.constFn(_js_helper.InternalMap$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let _Es6MapIterableOfV = () => (_Es6MapIterableOfV = dart.constFn(collection._Es6MapIterable$(V)))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     let VTobool = () => (VTobool = dart.constFn(dart.definiteFunctionType(core.bool, [V])))();
     class _Es6LinkedIdentityHashMap extends collection._LinkedIdentityHashMap$(K, V) {
       new() {
@@ -23848,7 +24257,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       _get(key) {
         return this[_map$0].get(key);
@@ -23908,19 +24317,7 @@
         [_map$0]: dart.dynamic,
         [_modifications$]: core.int
       }),
-      getters: () => ({
-        keys: dart.definiteFunctionType(core.Iterable$(K), []),
-        values: dart.definiteFunctionType(core.Iterable$(V), [])
-      }),
-      methods: () => ({
-        addAll: dart.definiteFunctionType(dart.void, [MapOfK$V()]),
-        _get: dart.definiteFunctionType(V, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [K, V]),
-        putIfAbsent: dart.definiteFunctionType(V, [K, VoidToV()]),
-        remove: dart.definiteFunctionType(V, [core.Object]),
-        forEach: dart.definiteFunctionType(dart.void, [KAndVTovoid()]),
-        [_modified$]: dart.definiteFunctionType(dart.void, [])
-      })
+      methods: () => ({[_modified$]: dart.definiteFunctionType(dart.void, [])})
     });
     dart.defineExtensionMembers(_Es6LinkedIdentityHashMap, [
       'containsKey',
@@ -23990,8 +24387,7 @@
         [_map$0]: dart.dynamic,
         [_isKeys]: core.bool
       }),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(_Es6MapIterable, [
       'contains',
@@ -24110,11 +24506,6 @@
         [_equals$]: _EqualityOfK(),
         [_hashCode]: _HasherOfK(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        _get: dart.definiteFunctionType(V, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [K, V]),
-        remove: dart.definiteFunctionType(V, [core.Object])
       })
     });
     dart.defineExtensionMembers(_LinkedCustomHashMap, ['_get', '_set', 'containsKey', 'remove']);
@@ -24486,11 +24877,7 @@
       }
     }
     dart.setSignature(_HashSetBase, {
-      methods: () => ({
-        difference: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        intersection: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
-      })
+      methods: () => ({toSet: dart.definiteFunctionType(core.Set$(E), [])})
     });
     dart.defineExtensionMembers(_HashSetBase, ['toSet']);
     return _HashSetBase;
@@ -24740,7 +25127,6 @@
         [_lookup]: dart.definiteFunctionType(E, [core.Object]),
         add: dart.definiteFunctionType(core.bool, [E]),
         [_add$0]: dart.definiteFunctionType(core.bool, [E]),
-        addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
         [_remove]: dart.definiteFunctionType(core.bool, [core.Object]),
         [_computeElements]: dart.definiteFunctionType(core.List$(E), []),
@@ -24791,9 +25177,6 @@
         return -1;
       }
     }
-    dart.setSignature(_IdentityHashSet, {
-      methods: () => ({[_newSet]: dart.definiteFunctionType(core.Set$(E), [])})
-    });
     return _IdentityHashSet;
   });
   collection._IdentityHashSet = _IdentityHashSet();
@@ -24847,11 +25230,6 @@
         [_equality]: _EqualityOfE(),
         [_hasher]: _HasherOfE(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
-        add: dart.definiteFunctionType(core.bool, [E]),
-        lookup: dart.definiteFunctionType(E, [core.Object])
       })
     });
     dart.defineExtensionMembers(_CustomHashSet, ['contains']);
@@ -25183,9 +25561,7 @@
       }),
       getters: () => ({
         iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        length: dart.definiteFunctionType(core.int, []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, [])
+        length: dart.definiteFunctionType(core.int, [])
       }),
       methods: () => ({
         [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
@@ -25194,13 +25570,10 @@
         [_contains]: dart.definiteFunctionType(core.bool, [core.Object]),
         lookup: dart.definiteFunctionType(E, [core.Object]),
         [_lookup]: dart.definiteFunctionType(E, [core.Object]),
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
         add: dart.definiteFunctionType(core.bool, [E]),
         [_add$0]: dart.definiteFunctionType(core.bool, [E]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
         [_remove]: dart.definiteFunctionType(core.bool, [core.Object]),
-        removeWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
-        retainWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
         [_filterWhere]: dart.definiteFunctionType(dart.void, [ETobool(), core.bool]),
         [_addHashTableEntry$]: dart.definiteFunctionType(core.bool, [dart.dynamic, E]),
         [_removeHashTableEntry$]: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Object]),
@@ -25256,9 +25629,6 @@
         return -1;
       }
     }
-    dart.setSignature(_LinkedIdentityHashSet, {
-      methods: () => ({[_newSet]: dart.definiteFunctionType(core.Set$(E), [])})
-    });
     return _LinkedIdentityHashSet;
   });
   collection._LinkedIdentityHashSet = _LinkedIdentityHashSet();
@@ -25324,11 +25694,6 @@
         [_equality]: _EqualityOfE(),
         [_hasher]: _HasherOfE(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
-        add: dart.definiteFunctionType(core.bool, [E]),
-        lookup: dart.definiteFunctionType(E, [core.Object])
       })
     });
     dart.defineExtensionMembers(_LinkedCustomHashSet, ['contains']);
@@ -25492,7 +25857,7 @@
         let result = HashMapOfK$V().new();
         other[dartx.forEach](dart.fn((k, v) => {
           result._set(K.as(k), V.as(v));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return result;
       }
       static fromIterable(iterable, opts) {
@@ -26044,7 +26409,7 @@
         let result = LinkedHashMapOfK$V().new();
         other[dartx.forEach](dart.fn((k, v) => {
           result._set(K.as(k), V.as(v));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return result;
       }
       static fromIterable(iterable, opts) {
@@ -26274,19 +26639,13 @@
         [_length$1]: core.int,
         [_first$]: E
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
       methods: () => ({
         addFirst: dart.definiteFunctionType(dart.void, [E]),
         add: dart.definiteFunctionType(dart.void, [E]),
         addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         remove: dart.definiteFunctionType(core.bool, [E]),
         clear: dart.definiteFunctionType(dart.void, []),
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
         [_insertBefore$]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
         [_unlink$]: dart.definiteFunctionType(dart.void, [E])
       })
@@ -26578,12 +26937,7 @@
     dart.setSignature(_MapBaseValueIterable, {
       constructors: () => ({new: dart.definiteFunctionType(collection._MapBaseValueIterable$(K, V), [MapOfK$V()])}),
       fields: () => ({[_map$0]: MapOfK$V()}),
-      getters: () => ({
-        first: dart.definiteFunctionType(V, []),
-        single: dart.definiteFunctionType(V, []),
-        last: dart.definiteFunctionType(V, []),
-        iterator: dart.definiteFunctionType(core.Iterator$(V), [])
-      })
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
     });
     dart.defineExtensionMembers(_MapBaseValueIterable, [
       'length',
@@ -26810,7 +27164,7 @@
           result.write(k);
           result.write(': ');
           result.write(v);
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         result.write('}');
       } finally {
         dart.assert(core.identical(collection._toStringVisiting[dartx.last], m));
@@ -27256,12 +27610,7 @@
         [_sentinel]: _DoubleLinkedQueueSentinelOfE(),
         [_elementCount]: core.int
       }),
-      getters: () => ({
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, []),
-        iterator: dart.definiteFunctionType(collection._DoubleLinkedQueueIterator$(E), [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(collection._DoubleLinkedQueueIterator$(E), [])}),
       methods: () => ({
         addLast: dart.definiteFunctionType(dart.void, [E]),
         addFirst: dart.definiteFunctionType(dart.void, [E]),
@@ -27633,16 +27982,8 @@
         [_tail]: core.int,
         [_modificationCount]: core.int
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
       methods: () => ({
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-        elementAt: dart.definiteFunctionType(E, [core.int]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
         add: dart.definiteFunctionType(dart.void, [E]),
         addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
@@ -27950,16 +28291,16 @@
     let ComparatorOfK = () => (ComparatorOfK = dart.constFn(core.Comparator$(K)))();
     let SplayTreeMapOfK$V = () => (SplayTreeMapOfK$V = dart.constFn(collection.SplayTreeMap$(K, V)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let _SplayTreeNodeIteratorOfK = () => (_SplayTreeNodeIteratorOfK = dart.constFn(collection._SplayTreeNodeIterator$(K)))();
     let _SplayTreeKeyIterableOfK = () => (_SplayTreeKeyIterableOfK = dart.constFn(collection._SplayTreeKeyIterable$(K)))();
     let _SplayTreeValueIterableOfK$V = () => (_SplayTreeValueIterableOfK$V = dart.constFn(collection._SplayTreeValueIterable$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let dynamicToK = () => (dynamicToK = dart.constFn(dart.functionType(K, [dart.dynamic])))();
     let IterableOfK = () => (IterableOfK = dart.constFn(core.Iterable$(K)))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
     let dynamicToV = () => (dynamicToV = dart.constFn(dart.functionType(V, [dart.dynamic])))();
     let IterableOfV = () => (IterableOfV = dart.constFn(core.Iterable$(V)))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     class SplayTreeMap extends collection._SplayTree$(K, collection._SplayTreeMapNode$(K, V)) {
       new(compare, isValidKey) {
         if (compare === void 0) compare = null;
@@ -27982,7 +28323,7 @@
         let result = new (SplayTreeMapOfK$V())(compare, isValidKey);
         other[dartx.forEach](dart.fn((k, v) => {
           result._set(K.as(k), V.as(v));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return result;
       }
       static fromIterable(iterable, opts) {
@@ -28068,7 +28409,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       get isEmpty() {
         return this[_root] == null;
@@ -28343,8 +28684,7 @@
     dart.setSignature(_SplayTreeKeyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(collection._SplayTreeKeyIterable$(K), [_SplayTreeOfK$_SplayTreeNodeOfK()])}),
       fields: () => ({[_tree]: _SplayTreeOfK$_SplayTreeNodeOfK()}),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])}),
-      methods: () => ({toSet: dart.definiteFunctionType(core.Set$(K), [])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])})
     });
     dart.defineExtensionMembers(_SplayTreeKeyIterable, ['toSet', 'length', 'isEmpty', 'iterator']);
     return _SplayTreeKeyIterable;
@@ -28614,24 +28954,14 @@
         [_comparator]: ComparatorOfE(),
         [_validKey]: collection._Predicate
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
       methods: () => ({
         [_compare]: dart.definiteFunctionType(core.int, [E, E]),
         add: dart.definiteFunctionType(core.bool, [E]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
-        addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         lookup: dart.definiteFunctionType(E, [core.Object]),
-        intersection: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        difference: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        union: dart.definiteFunctionType(core.Set$(E), [SetOfE()]),
         [_clone]: dart.definiteFunctionType(collection.SplayTreeSet$(E), []),
-        [_copyNode]: dart.definiteFunctionType(collection._SplayTreeNode$(E), [_SplayTreeNodeOfE()]),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
+        [_copyNode]: dart.definiteFunctionType(collection._SplayTreeNode$(E), [_SplayTreeNodeOfE()])
       })
     });
     dart.defineExtensionMembers(SplayTreeSet, [
@@ -28698,7 +29028,7 @@
   const _data = Symbol('_data');
   const _isUpgraded = Symbol('_isUpgraded');
   const _upgradedMap = Symbol('_upgradedMap');
-  const _process = Symbol('_process');
+  const _process$ = Symbol('_process');
   const _upgrade = Symbol('_upgrade');
   convert._JsonMap = class _JsonMap extends core.Object {
     new(original) {
@@ -28713,7 +29043,7 @@
         return null;
       } else {
         let result = convert._JsonMap._getProperty(this[_processed], core.String._check(key));
-        if (dart.test(convert._JsonMap._isUnprocessed(result))) result = this[_process](core.String._check(key));
+        if (dart.test(convert._JsonMap._isUnprocessed(result))) result = this[_process$](core.String._check(key));
         return result;
       }
     }
@@ -28752,7 +29082,7 @@
     addAll(other) {
       other[dartx.forEach](dart.fn((key, value) => {
         this._set(key, value);
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
     }
     containsValue(value) {
       if (dart.test(this[_isUpgraded])) return this[_upgradedMap][dartx.containsValue](value);
@@ -28841,7 +29171,7 @@
       dart.assert(this[_isUpgraded]);
       return result;
     }
-    [_process](key) {
+    [_process$](key) {
       if (!dart.test(convert._JsonMap._hasProperty(this[_original], key))) return null;
       let result = convert._convertJsonToDartLazy(convert._JsonMap._getProperty(this[_original], key));
       return convert._JsonMap._setProperty(this[_processed], key, result);
@@ -28894,7 +29224,7 @@
       forEach: dart.definiteFunctionType(dart.void, [dynamicAnddynamicTovoid()]),
       [_computeKeys$]: dart.definiteFunctionType(core.List$(core.String), []),
       [_upgrade]: dart.definiteFunctionType(core.Map, []),
-      [_process]: dart.definiteFunctionType(dart.dynamic, [core.String])
+      [_process$]: dart.definiteFunctionType(dart.dynamic, [core.String])
     }),
     statics: () => ({
       _hasProperty: dart.definiteFunctionType(core.bool, [dart.dynamic, core.String]),
@@ -28945,7 +29275,6 @@
   dart.setSignature(convert._JsonMapKeyIterable, {
     constructors: () => ({new: dart.definiteFunctionType(convert._JsonMapKeyIterable, [convert._JsonMap])}),
     fields: () => ({[_parent]: convert._JsonMap}),
-    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator, [])}),
     methods: () => ({elementAt: dart.definiteFunctionType(core.String, [core.int])})
   });
   dart.defineExtensionMembers(convert._JsonMapKeyIterable, ['elementAt', 'contains', 'length', 'iterator']);
@@ -29370,8 +29699,7 @@
     fields: () => ({[_subsetMask]: core.int}),
     methods: () => ({
       convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
-      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfString()])
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
     })
   });
   convert.AsciiEncoder = class AsciiEncoder extends convert._UnicodeSubsetEncoder {
@@ -29461,8 +29789,7 @@
     }),
     methods: () => ({
       convert: dart.definiteFunctionType(core.String, [ListOfint()], [core.int, core.int]),
-      [_convertInvalid]: dart.definiteFunctionType(core.String, [ListOfint(), core.int, core.int]),
-      bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfListOfint()])
+      [_convertInvalid]: dart.definiteFunctionType(core.String, [ListOfint(), core.int, core.int])
     })
   });
   convert.AsciiDecoder = class AsciiDecoder extends convert._UnicodeSubsetDecoder {
@@ -29485,8 +29812,7 @@
     }
   };
   dart.setSignature(convert.AsciiDecoder, {
-    constructors: () => ({new: dart.definiteFunctionType(convert.AsciiDecoder, [], {allowInvalid: core.bool})}),
-    methods: () => ({startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])})
+    constructors: () => ({new: dart.definiteFunctionType(convert.AsciiDecoder, [], {allowInvalid: core.bool})})
   });
   const _utf8Sink = Symbol('_utf8Sink');
   let const$30;
@@ -30501,8 +30827,7 @@
       fields: () => ({[_codec]: CodecOfS$T()}),
       getters: () => ({
         encoder: dart.definiteFunctionType(convert.Converter$(T, S), []),
-        decoder: dart.definiteFunctionType(convert.Converter$(S, T), []),
-        inverted: dart.definiteFunctionType(convert.Codec$(S, T), [])
+        decoder: dart.definiteFunctionType(convert.Converter$(S, T), [])
       })
     });
     return _InvertedCodec;
@@ -30533,15 +30858,12 @@
         [_first$0]: ConverterOfS$M(),
         [_second]: ConverterOfM$T()
       }),
-      methods: () => ({
-        convert: dart.definiteFunctionType(T, [S]),
-        startChunkedConversion: dart.definiteFunctionType(core.Sink$(S), [SinkOfT()])
-      })
+      methods: () => ({convert: dart.definiteFunctionType(T, [S])})
     });
     return _FusedConverter;
   });
   convert._FusedConverter = _FusedConverter();
-  const _name$0 = Symbol('_name');
+  const _name$1 = Symbol('_name');
   let const$34;
   let const$35;
   let const$36;
@@ -30552,7 +30874,7 @@
   let const$41;
   convert.HtmlEscapeMode = class HtmlEscapeMode extends core.Object {
     _(name, escapeLtGt, escapeQuot, escapeApos, escapeSlash) {
-      this[_name$0] = name;
+      this[_name$1] = name;
       this.escapeLtGt = escapeLtGt;
       this.escapeQuot = escapeQuot;
       this.escapeApos = escapeApos;
@@ -30568,10 +30890,10 @@
       this.escapeQuot = escapeQuot;
       this.escapeApos = escapeApos;
       this.escapeSlash = escapeSlash;
-      this[_name$0] = name;
+      this[_name$1] = name;
     }
     toString() {
-      return this[_name$0];
+      return this[_name$1];
     }
   };
   dart.defineNamedConstructor(convert.HtmlEscapeMode, '_');
@@ -30581,7 +30903,7 @@
       new: dart.definiteFunctionType(convert.HtmlEscapeMode, [], {name: core.String, escapeLtGt: core.bool, escapeQuot: core.bool, escapeApos: core.bool, escapeSlash: core.bool})
     }),
     fields: () => ({
-      [_name$0]: core.String,
+      [_name$1]: core.String,
       escapeLtGt: core.bool,
       escapeQuot: core.bool,
       escapeApos: core.bool,
@@ -30855,9 +31177,7 @@
     }),
     methods: () => ({
       convert: dart.definiteFunctionType(core.String, [core.Object]),
-      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfString()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfObject()]),
-      fuse: dart.definiteFunctionType(T => [convert.Converter$(core.Object, T), [convert.Converter$(core.String, T)]])
+      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfString()])
     })
   });
   const _indent = Symbol('_indent');
@@ -30931,8 +31251,7 @@
     }),
     methods: () => ({
       convert: dart.definiteFunctionType(core.List$(core.int), [core.Object]),
-      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfListOfint()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfObject()])
+      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfListOfint()])
     }),
     sfields: () => ({DEFAULT_BUFFER_SIZE: core.int}),
     statics: () => ({_utf8Encode: dart.definiteFunctionType(core.List$(core.int), [core.String])}),
@@ -31039,8 +31358,7 @@
     fields: () => ({[_reviver]: convert._Reviver}),
     methods: () => ({
       convert: dart.definiteFunctionType(dart.dynamic, [core.String]),
-      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfObject()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.Object), [StreamOfString()])
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfObject()])
     })
   });
   convert._parseJson = function(source, reviver) {
@@ -31221,7 +31539,7 @@
         }
         keyValueList[dartx._set](i++, key);
         keyValueList[dartx._set](i++, value);
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
       if (!allStringKeys) return false;
       this.writeString('{');
       let separator = '"';
@@ -31322,7 +31640,7 @@
         }
         keyValueList[dartx._set](i++, key);
         keyValueList[dartx._set](i++, value);
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
       if (!allStringKeys) return false;
       this.writeString('{\n');
       this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1;
@@ -31637,8 +31955,7 @@
     }
   };
   dart.setSignature(convert.Latin1Decoder, {
-    constructors: () => ({new: dart.definiteFunctionType(convert.Latin1Decoder, [], {allowInvalid: core.bool})}),
-    methods: () => ({startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])})
+    constructors: () => ({new: dart.definiteFunctionType(convert.Latin1Decoder, [], {allowInvalid: core.bool})})
   });
   const _addSliceToSink = Symbol('_addSliceToSink');
   convert._Latin1DecoderSink = class _Latin1DecoderSink extends convert.ByteConversionSinkBase {
@@ -32226,8 +32543,7 @@
     constructors: () => ({new: dart.definiteFunctionType(convert.Utf8Encoder, [])}),
     methods: () => ({
       convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
-      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfString()])
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
     })
   });
   convert._Utf8Encoder = class _Utf8Encoder extends core.Object {
@@ -32472,9 +32788,7 @@
     fields: () => ({[_allowMalformed]: core.bool}),
     methods: () => ({
       convert: dart.definiteFunctionType(core.String, [ListOfint()], [core.int, core.int]),
-      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfListOfint()]),
-      fuse: dart.definiteFunctionType(T => [convert.Converter$(core.List$(core.int), T), [convert.Converter$(core.String, T)]])
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])
     }),
     statics: () => ({_convertIntercepted: dart.definiteFunctionType(core.String, [core.bool, ListOfint(), core.int, core.int])}),
     names: ['_convertIntercepted']
@@ -33572,7 +33886,7 @@
           sb.write(": ");
           sb.write(core.Error.safeToString(value));
           i++;
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
       }
       if (this[_existingArgumentNames] == null) {
         return dart.str`NoSuchMethodError : method not found: '${this[_memberName]}'\n` + dart.str`Receiver: ${core.Error.safeToString(this[_receiver$])}\n` + dart.str`Arguments: [${sb}]`;
@@ -33898,10 +34212,21 @@
       let result = dart.map({}, core.String, dart.dynamic);
       namedArguments[dartx.forEach](dart.fn((symbol, value) => {
         result[dartx._set](core._symbolToString(symbol), value);
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       return result;
     }
   };
+  core.Function.is = function is_Function(o) {
+    return typeof o == "function";
+  };
+  core.Function.as = function as_Function(o) {
+    if (typeof o == "function" || o == null) return o;
+    return dart.as(o, core.Function);
+  };
+  core.Function._check = function check_String(o) {
+    if (typeof o == "function" || o == null) return o;
+    return dart.check(o, core.Function);
+  };
   dart.setSignature(core.Function, {
     statics: () => ({
       apply: dart.definiteFunctionType(dart.dynamic, [core.Function, core.List], [MapOfSymbol$dynamic()]),
@@ -33980,10 +34305,6 @@
         [_generator$]: _GeneratorOfE()
       }),
       getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int])
-      }),
       statics: () => ({_id: dart.definiteFunctionType(core.int, [core.int])}),
       names: ['_id']
     });
@@ -34165,18 +34486,7 @@
       return new core._StringStackTrace(stackTraceString);
     }
     static get current() {
-      if (Error.captureStackTrace != null) {
-        let error = new Error();
-        Error.captureStackTrace(error);
-        return _js_helper.getTraceFromException(error);
-      }
-      try {
-        dart.throw('');
-      } catch (_) {
-        let stackTrace = dart.stackTrace(_);
-        return stackTrace;
-      }
-
+      return _js_helper.getTraceFromException(new Error());
     }
   };
   dart.setSignature(core.StackTrace, {
@@ -34310,10 +34620,7 @@
   dart.setSignature(core.Runes, {
     constructors: () => ({new: dart.definiteFunctionType(core.Runes, [core.String])}),
     fields: () => ({string: core.String}),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.RuneIterator, []),
-      last: dart.definiteFunctionType(core.int, [])
-    })
+    getters: () => ({iterator: dart.definiteFunctionType(core.RuneIterator, [])})
   });
   dart.defineExtensionMembers(core.Runes, ['iterator', 'last']);
   core._isLeadSurrogate = function(code) {
@@ -34889,7 +35196,7 @@
             dart.throw(new core.UnsupportedError(dart.str`Illegal path character ${segment}`));
           }
         }
-      }, StringTovoid$()));
+      }, StringToNull()));
     }
     static _checkWindowsPathReservedCharacters(segments, argumentError, firstSegment) {
       if (firstSegment === void 0) firstSegment = 0;
@@ -35246,7 +35553,7 @@
             writeParameter(key, value);
           }
         }
-      }, StringAnddynamicTovoid()));
+      }, StringAnddynamicToNull()));
       return result.toString();
     }
     static _makeFragment(fragment, start, end) {
@@ -36234,7 +36541,7 @@
         if (indices != null) indices[dartx.add](buffer.length);
         buffer.write('=');
         buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
-      }, StringAndStringTovoid$())));
+      }, StringAndStringToNull())));
     }
     static _validateMimeType(mimeType) {
       let slashIndex = -1;
@@ -37221,6 +37528,14902 @@
     return 0;
   };
   dart.fn(developer._getServiceMinorVersion, VoidToint());
+  io.BytesBuilder = class BytesBuilder extends core.Object {
+    static new(opts) {
+      let copy = opts && 'copy' in opts ? opts.copy : true;
+      if (dart.test(copy)) {
+        return new io._CopyingBytesBuilder();
+      } else {
+        return new io._BytesBuilder();
+      }
+    }
+  };
+  dart.setSignature(io.BytesBuilder, {
+    constructors: () => ({new: dart.definiteFunctionType(io.BytesBuilder, [], {copy: core.bool})})
+  });
+  const _length$2 = Symbol('_length');
+  const _buffer$ = Symbol('_buffer');
+  const _pow2roundup = Symbol('_pow2roundup');
+  io._CopyingBytesBuilder = class _CopyingBytesBuilder extends core.Object {
+    new() {
+      this[_length$2] = 0;
+      this[_buffer$] = null;
+    }
+    add(bytes) {
+      let bytesLength = bytes[dartx.length];
+      if (bytesLength == 0) return;
+      let required = dart.notNull(this[_length$2]) + dart.notNull(bytesLength);
+      if (this[_buffer$] == null) {
+        let size = this[_pow2roundup](required);
+        size = math.max(core.int)(size, io._CopyingBytesBuilder._INIT_SIZE);
+        this[_buffer$] = typed_data.Uint8List.new(size);
+      } else if (dart.notNull(this[_buffer$][dartx.length]) < required) {
+        let size = dart.notNull(this[_pow2roundup](required)) * 2;
+        let newBuffer = typed_data.Uint8List.new(size);
+        newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
+        this[_buffer$] = newBuffer;
+      }
+      dart.assert(dart.notNull(this[_buffer$][dartx.length]) >= required);
+      if (typed_data.Uint8List.is(bytes)) {
+        this[_buffer$][dartx.setRange](this[_length$2], required, bytes);
+      } else {
+        for (let i = 0; i < dart.notNull(bytesLength); i++) {
+          this[_buffer$][dartx._set](dart.notNull(this[_length$2]) + i, bytes[dartx._get](i));
+        }
+      }
+      this[_length$2] = required;
+    }
+    addByte(byte) {
+      this.add(JSArrayOfint().of([byte]));
+    }
+    takeBytes() {
+      if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+      let buffer = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]);
+      this.clear();
+      return buffer;
+    }
+    toBytes() {
+      if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+      return typed_data.Uint8List.fromList(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+    }
+    get length() {
+      return this[_length$2];
+    }
+    get isEmpty() {
+      return this[_length$2] == 0;
+    }
+    get isNotEmpty() {
+      return this[_length$2] != 0;
+    }
+    clear() {
+      this[_length$2] = 0;
+      this[_buffer$] = null;
+    }
+    [_pow2roundup](x) {
+      x = dart.notNull(x) - 1;
+      x = (dart.notNull(x) | x[dartx['>>']](1)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](2)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](4)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](8)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](16)) >>> 0;
+      return dart.notNull(x) + 1;
+    }
+  };
+  io._CopyingBytesBuilder[dart.implements] = () => [io.BytesBuilder];
+  dart.setSignature(io._CopyingBytesBuilder, {
+    fields: () => ({
+      [_length$2]: core.int,
+      [_buffer$]: typed_data.Uint8List
+    }),
+    getters: () => ({
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addByte: dart.definiteFunctionType(dart.void, [core.int]),
+      takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      toBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      clear: dart.definiteFunctionType(dart.void, []),
+      [_pow2roundup]: dart.definiteFunctionType(core.int, [core.int])
+    }),
+    sfields: () => ({_INIT_SIZE: core.int})
+  });
+  io._CopyingBytesBuilder._INIT_SIZE = 1024;
+  const _chunks = Symbol('_chunks');
+  io._BytesBuilder = class _BytesBuilder extends core.Object {
+    new() {
+      this[_chunks] = JSArrayOfListOfint().of([]);
+      this[_length$2] = 0;
+    }
+    add(bytes) {
+      if (!typed_data.Uint8List.is(bytes)) {
+        bytes = typed_data.Uint8List.fromList(bytes);
+      }
+      this[_chunks][dartx.add](bytes);
+      this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(bytes[dartx.length]);
+    }
+    addByte(byte) {
+      this.add(JSArrayOfint().of([byte]));
+    }
+    takeBytes() {
+      if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+      if (this[_chunks][dartx.length] == 1) {
+        let buffer = this[_chunks][dartx.single];
+        this.clear();
+        return buffer;
+      }
+      let buffer = typed_data.Uint8List.new(this[_length$2]);
+      let offset = 0;
+      for (let chunk of this[_chunks]) {
+        buffer[dartx.setRange](offset, dart.notNull(offset) + dart.notNull(chunk[dartx.length]), chunk);
+        offset = dart.notNull(offset) + dart.notNull(chunk[dartx.length]);
+      }
+      this.clear();
+      return buffer;
+    }
+    toBytes() {
+      if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+      let buffer = typed_data.Uint8List.new(this[_length$2]);
+      let offset = 0;
+      for (let chunk of this[_chunks]) {
+        buffer[dartx.setRange](offset, dart.notNull(offset) + dart.notNull(chunk[dartx.length]), chunk);
+        offset = dart.notNull(offset) + dart.notNull(chunk[dartx.length]);
+      }
+      return buffer;
+    }
+    get length() {
+      return this[_length$2];
+    }
+    get isEmpty() {
+      return this[_length$2] == 0;
+    }
+    get isNotEmpty() {
+      return this[_length$2] != 0;
+    }
+    clear() {
+      this[_length$2] = 0;
+      this[_chunks][dartx.clear]();
+    }
+  };
+  io._BytesBuilder[dart.implements] = () => [io.BytesBuilder];
+  dart.setSignature(io._BytesBuilder, {
+    fields: () => ({
+      [_length$2]: core.int,
+      [_chunks]: ListOfListOfint()
+    }),
+    getters: () => ({
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addByte: dart.definiteFunctionType(dart.void, [core.int]),
+      takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      toBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      clear: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._SUCCESS_RESPONSE = 0;
+  io._ILLEGAL_ARGUMENT_RESPONSE = 1;
+  io._OSERROR_RESPONSE = 2;
+  io._FILE_CLOSED_RESPONSE = 3;
+  io._ERROR_RESPONSE_ERROR_TYPE = 0;
+  io._OSERROR_RESPONSE_ERROR_CODE = 1;
+  io._OSERROR_RESPONSE_MESSAGE = 2;
+  io._isErrorResponse = function(response) {
+    return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+  };
+  dart.fn(io._isErrorResponse, dynamicTobool$());
+  io._exceptionFromResponse = function(response, message, path) {
+    dart.assert(io._isErrorResponse(response));
+    switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+      case io._ILLEGAL_ARGUMENT_RESPONSE:
+      {
+        return new core.ArgumentError();
+      }
+      case io._OSERROR_RESPONSE:
+      {
+        let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+        return new io.FileSystemException(message, path, err);
+      }
+      case io._FILE_CLOSED_RESPONSE:
+      {
+        return new io.FileSystemException("File closed", path);
+      }
+      default:
+      {
+        return core.Exception.new("Unknown error");
+      }
+    }
+  };
+  dart.fn(io._exceptionFromResponse, dynamicAndStringAndStringTodynamic());
+  io.IOException = class IOException extends core.Object {
+    toString() {
+      return "IOException";
+    }
+  };
+  io.IOException[dart.implements] = () => [core.Exception];
+  io.OSError = class OSError extends core.Object {
+    new(message, errorCode) {
+      if (message === void 0) message = "";
+      if (errorCode === void 0) errorCode = io.OSError.noErrorCode;
+      this.message = message;
+      this.errorCode = errorCode;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write("OS Error");
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(": ");
+        sb.write(this.message);
+        if (this.errorCode != io.OSError.noErrorCode) {
+          sb.write(", errno = ");
+          sb.write(dart.toString(this.errorCode));
+        }
+      } else if (this.errorCode != io.OSError.noErrorCode) {
+        sb.write(": errno = ");
+        sb.write(dart.toString(this.errorCode));
+      }
+      return sb.toString();
+    }
+  };
+  dart.setSignature(io.OSError, {
+    constructors: () => ({new: dart.definiteFunctionType(io.OSError, [], [core.String, core.int])}),
+    fields: () => ({
+      message: core.String,
+      errorCode: core.int
+    }),
+    sfields: () => ({noErrorCode: core.int})
+  });
+  io.OSError.noErrorCode = -1;
+  io._BufferAndStart = class _BufferAndStart extends core.Object {
+    new(buffer, start) {
+      this.buffer = buffer;
+      this.start = start;
+    }
+  };
+  dart.setSignature(io._BufferAndStart, {
+    constructors: () => ({new: dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int])}),
+    fields: () => ({
+      buffer: core.List,
+      start: core.int
+    })
+  });
+  io._ensureFastAndSerializableByteData = function(buffer, start, end) {
+    if (typed_data.Uint8List.is(buffer) || typed_data.Int8List.is(buffer)) {
+      return new io._BufferAndStart(buffer, start);
+    }
+    let length = dart.notNull(end) - dart.notNull(start);
+    let newBuffer = typed_data.Uint8List.new(length);
+    let j = start;
+    for (let i = 0; i < length; i++) {
+      let value = core.int._check(buffer[dartx._get](j));
+      if (!(typeof value == 'number')) {
+        dart.throw(new core.ArgumentError(dart.str`List element is not an integer at index ${j}`));
+      }
+      newBuffer[dartx._set](i, value);
+      j = dart.notNull(j) + 1;
+    }
+    return new io._BufferAndStart(newBuffer, 0);
+  };
+  dart.fn(io._ensureFastAndSerializableByteData, ListAndintAndintTo_BufferAndStart());
+  io._IOCrypto = class _IOCrypto extends core.Object {
+    static getRandomBytes(count) {
+      dart.throw(new core.UnsupportedError("_IOCrypto.getRandomBytes"));
+    }
+  };
+  dart.setSignature(io._IOCrypto, {
+    statics: () => ({getRandomBytes: dart.definiteFunctionType(typed_data.Uint8List, [core.int])}),
+    names: ['getRandomBytes']
+  });
+  io._CryptoUtils = class _CryptoUtils extends core.Object {
+    static bytesToHex(bytes) {
+      let result = new core.StringBuffer();
+      for (let part of bytes) {
+        result.write(dart.str`${dart.notNull(part) < 16 ? '0' : ''}${part[dartx.toRadixString](16)}`);
+      }
+      return result.toString();
+    }
+    static bytesToBase64(bytes, urlSafe, addLineSeparator) {
+      if (urlSafe === void 0) urlSafe = false;
+      if (addLineSeparator === void 0) addLineSeparator = false;
+      let len = bytes[dartx.length];
+      if (len == 0) {
+        return "";
+      }
+      let lookup = dart.test(urlSafe) ? io._CryptoUtils._encodeTableUrlSafe : io._CryptoUtils._encodeTable;
+      let remainderLength = dart.asInt(len[dartx.remainder](3));
+      let chunkLength = dart.notNull(len) - dart.notNull(remainderLength);
+      let outputLen = (dart.notNull(len) / 3)[dartx.truncate]() * 4 + (dart.notNull(remainderLength) > 0 ? 4 : 0);
+      if (dart.test(addLineSeparator)) {
+        outputLen = outputLen + (((outputLen - 1) / io._CryptoUtils.LINE_LENGTH)[dartx.truncate]() << 1 >>> 0);
+      }
+      let out = ListOfint().new(outputLen);
+      let j = 0, i = 0, c = 0;
+      while (i < chunkLength) {
+        let x = (dart.notNull(bytes[dartx._get](i++)) << 16 & 16777215 | dart.notNull(bytes[dartx._get](i++)) << 8 & 16777215 | dart.notNull(bytes[dartx._get](i++))) >>> 0;
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](18)));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x >> 12 & 63));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x >> 6 & 63));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x & 63));
+        if (dart.test(addLineSeparator) && ++c == 19 && j < outputLen - 2) {
+          out[dartx._set](j++, io._CryptoUtils.CR);
+          out[dartx._set](j++, io._CryptoUtils.LF);
+          c = 0;
+        }
+      }
+      if (remainderLength == 1) {
+        let x = bytes[dartx._get](i);
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](2)));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](dart.notNull(x) << 4 & 63));
+        out[dartx._set](j++, io._CryptoUtils.PAD);
+        out[dartx._set](j++, io._CryptoUtils.PAD);
+      } else if (remainderLength == 2) {
+        let x = bytes[dartx._get](i);
+        let y = bytes[dartx._get](i + 1);
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](2)));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt]((dart.notNull(x) << 4 | dart.notNull(y) >> 4) & 63));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](dart.notNull(y) << 2 & 63));
+        out[dartx._set](j++, io._CryptoUtils.PAD);
+      }
+      return core.String.fromCharCodes(out);
+    }
+    static base64StringToBytes(input, ignoreInvalidCharacters) {
+      if (ignoreInvalidCharacters === void 0) ignoreInvalidCharacters = true;
+      let len = input[dartx.length];
+      if (len == 0) {
+        return ListOfint().new(0);
+      }
+      let extrasLen = 0;
+      for (let i = 0; i < dart.notNull(len); i++) {
+        let c = io._CryptoUtils._decodeTable[dartx._get](input[dartx.codeUnitAt](i));
+        if (dart.notNull(c) < 0) {
+          extrasLen++;
+          if (c == -2 && !dart.test(ignoreInvalidCharacters)) {
+            dart.throw(new core.FormatException(dart.str`Invalid character: ${input[dartx._get](i)}`));
+          }
+        }
+      }
+      if ((dart.notNull(len) - extrasLen)[dartx['%']](4) != 0) {
+        dart.throw(new core.FormatException(dart.str`Size of Base 64 characters in Input\n          must be a multiple of 4. Input: ${input}`));
+      }
+      let padLength = 0;
+      for (let i = dart.notNull(len) - 1; i >= 0; i--) {
+        let currentCodeUnit = input[dartx.codeUnitAt](i);
+        if (dart.notNull(io._CryptoUtils._decodeTable[dartx._get](currentCodeUnit)) > 0) break;
+        if (currentCodeUnit == io._CryptoUtils.PAD) padLength++;
+      }
+      let outputLen = ((dart.notNull(len) - extrasLen) * 6)[dartx['>>']](3) - padLength;
+      let out = ListOfint().new(outputLen);
+      for (let i = 0, o = 0; o < outputLen;) {
+        let x = 0;
+        for (let j = 4; j > 0;) {
+          let c = io._CryptoUtils._decodeTable[dartx._get](input[dartx.codeUnitAt](i++));
+          if (dart.notNull(c) >= 0) {
+            x = (x << 6 & 16777215 | dart.notNull(c)) >>> 0;
+            j--;
+          }
+        }
+        out[dartx._set](o++, x[dartx['>>']](16));
+        if (o < outputLen) {
+          out[dartx._set](o++, x >> 8 & 255);
+          if (o < outputLen) out[dartx._set](o++, x & 255);
+        }
+      }
+      return out;
+    }
+  };
+  dart.setSignature(io._CryptoUtils, {
+    sfields: () => ({
+      PAD: core.int,
+      CR: core.int,
+      LF: core.int,
+      LINE_LENGTH: core.int,
+      _encodeTable: core.String,
+      _encodeTableUrlSafe: core.String,
+      _decodeTable: ListOfint()
+    }),
+    statics: () => ({
+      bytesToHex: dart.definiteFunctionType(core.String, [ListOfint()]),
+      bytesToBase64: dart.definiteFunctionType(core.String, [ListOfint()], [core.bool, core.bool]),
+      base64StringToBytes: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.bool])
+    }),
+    names: ['bytesToHex', 'bytesToBase64', 'base64StringToBytes']
+  });
+  io._CryptoUtils.PAD = 61;
+  io._CryptoUtils.CR = 13;
+  io._CryptoUtils.LF = 10;
+  io._CryptoUtils.LINE_LENGTH = 76;
+  io._CryptoUtils._encodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+  io._CryptoUtils._encodeTableUrlSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+  io._CryptoUtils._decodeTable = dart.constList([-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, 62, -2, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, 0, -2, -2, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, 63, -2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], core.int);
+  io._MASK_8 = 255;
+  io._MASK_32 = 4294967295;
+  io._BITS_PER_BYTE = 8;
+  io._BYTES_PER_WORD = 4;
+  const _chunkSizeInWords = Symbol('_chunkSizeInWords');
+  const _digestSizeInWords = Symbol('_digestSizeInWords');
+  const _bigEndianWords = Symbol('_bigEndianWords');
+  const _pendingData = Symbol('_pendingData');
+  const _lengthInBytes = Symbol('_lengthInBytes');
+  const _currentChunk = Symbol('_currentChunk');
+  const _h = Symbol('_h');
+  const _digestCalled = Symbol('_digestCalled');
+  const _iterate = Symbol('_iterate');
+  const _resultAsBytes = Symbol('_resultAsBytes');
+  const _finalizeData = Symbol('_finalizeData');
+  const _add32 = Symbol('_add32');
+  const _roundUp = Symbol('_roundUp');
+  const _rotl32 = Symbol('_rotl32');
+  const _wordToBytes = Symbol('_wordToBytes');
+  const _bytesToChunk = Symbol('_bytesToChunk');
+  const _updateHash = Symbol('_updateHash');
+  io._HashBase = class _HashBase extends core.Object {
+    new(chunkSizeInWords, digestSizeInWords, bigEndianWords) {
+      this[_chunkSizeInWords] = chunkSizeInWords;
+      this[_digestSizeInWords] = digestSizeInWords;
+      this[_bigEndianWords] = bigEndianWords;
+      this[_pendingData] = JSArrayOfint().of([]);
+      this[_lengthInBytes] = 0;
+      this[_currentChunk] = null;
+      this[_h] = null;
+      this[_digestCalled] = false;
+      this[_currentChunk] = ListOfint().new(this[_chunkSizeInWords]);
+      this[_h] = ListOfint().new(this[_digestSizeInWords]);
+    }
+    add(data) {
+      if (dart.test(this[_digestCalled])) {
+        dart.throw(new core.StateError('Hash update method called after digest was retrieved'));
+      }
+      this[_lengthInBytes] = dart.notNull(this[_lengthInBytes]) + dart.notNull(data[dartx.length]);
+      this[_pendingData][dartx.addAll](data);
+      this[_iterate]();
+    }
+    close() {
+      if (dart.test(this[_digestCalled])) {
+        return ListOfint()._check(this[_resultAsBytes]());
+      }
+      this[_digestCalled] = true;
+      this[_finalizeData]();
+      this[_iterate]();
+      dart.assert(this[_pendingData][dartx.length] == 0);
+      return ListOfint()._check(this[_resultAsBytes]());
+    }
+    get blockSize() {
+      return dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+    }
+    [_add32](x, y) {
+      return dart.dsend(dart.dsend(x, '+', y), '&', io._MASK_32);
+    }
+    [_roundUp](val, n) {
+      return dart.dsend(dart.dsend(dart.dsend(val, '+', n), '-', 1), '&', dart.dsend(n, '_negate'));
+    }
+    [_rotl32](val, shift) {
+      let mod_shift = dart.notNull(shift) & 31;
+      return (val[dartx['<<']](mod_shift) & io._MASK_32 | ((dart.notNull(val) & io._MASK_32) >>> 0)[dartx['>>']](32 - mod_shift)) >>> 0;
+    }
+    [_resultAsBytes]() {
+      let result = [];
+      for (let i = 0; i < dart.notNull(this[_h][dartx.length]); i++) {
+        result[dartx.addAll](core.Iterable._check(this[_wordToBytes](this[_h][dartx._get](i))));
+      }
+      return result;
+    }
+    [_bytesToChunk](data, dataIndex) {
+      dart.assert(dart.notNull(data[dartx.length]) - dart.notNull(dataIndex) >= dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD);
+      for (let wordIndex = 0; wordIndex < dart.notNull(this[_chunkSizeInWords]); wordIndex++) {
+        let w3 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dataIndex) : data[dartx._get](dart.notNull(dataIndex) + 3);
+        let w2 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 1) : data[dartx._get](dart.notNull(dataIndex) + 2);
+        let w1 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 2) : data[dartx._get](dart.notNull(dataIndex) + 1);
+        let w0 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 3) : data[dartx._get](dataIndex);
+        dataIndex = dart.notNull(dataIndex) + 4;
+        let word = (dart.notNull(w3) & 255) << 24 >>> 0;
+        word = (word | (dart.notNull(w2) & io._MASK_8) << 16) >>> 0;
+        word = (word | (dart.notNull(w1) & io._MASK_8) << 8) >>> 0;
+        word = (word | dart.notNull(w0) & io._MASK_8) >>> 0;
+        this[_currentChunk][dartx._set](wordIndex, word);
+      }
+    }
+    [_wordToBytes](word) {
+      let bytes = ListOfint().new(io._BYTES_PER_WORD);
+      bytes[dartx._set](0, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 24 : 0) & io._MASK_8);
+      bytes[dartx._set](1, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 16 : 8) & io._MASK_8);
+      bytes[dartx._set](2, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 8 : 16) & io._MASK_8);
+      bytes[dartx._set](3, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 0 : 24) & io._MASK_8);
+      return bytes;
+    }
+    [_iterate]() {
+      let len = this[_pendingData][dartx.length];
+      let chunkSizeInBytes = dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+      if (dart.notNull(len) >= chunkSizeInBytes) {
+        let index = 0;
+        for (; dart.notNull(len) - index >= chunkSizeInBytes; index = index + chunkSizeInBytes) {
+          this[_bytesToChunk](this[_pendingData], index);
+          this[_updateHash](this[_currentChunk]);
+        }
+        this[_pendingData] = this[_pendingData][dartx.sublist](index, len);
+      }
+    }
+    [_finalizeData]() {
+      this[_pendingData][dartx.add](128);
+      let contentsLength = dart.notNull(this[_lengthInBytes]) + 9;
+      let chunkSizeInBytes = dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+      let finalizedLength = this[_roundUp](contentsLength, chunkSizeInBytes);
+      let zeroPadding = dart.dsend(finalizedLength, '-', contentsLength);
+      for (let i = 0; i < dart.notNull(core.num._check(zeroPadding)); i++) {
+        this[_pendingData][dartx.add](0);
+      }
+      let lengthInBits = dart.notNull(this[_lengthInBytes]) * io._BITS_PER_BYTE;
+      dart.assert(lengthInBits < dart.notNull(math.pow(2, 32)));
+      if (dart.test(this[_bigEndianWords])) {
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+      } else {
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+      }
+    }
+  };
+  dart.setSignature(io._HashBase, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HashBase, [core.int, core.int, core.bool])}),
+    fields: () => ({
+      [_chunkSizeInWords]: core.int,
+      [_digestSizeInWords]: core.int,
+      [_bigEndianWords]: core.bool,
+      [_lengthInBytes]: core.int,
+      [_pendingData]: ListOfint(),
+      [_currentChunk]: ListOfint(),
+      [_h]: ListOfint(),
+      [_digestCalled]: core.bool
+    }),
+    getters: () => ({blockSize: dart.definiteFunctionType(core.int, [])}),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.dynamic, [ListOfint()]),
+      close: dart.definiteFunctionType(core.List$(core.int), []),
+      [_add32]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
+      [_roundUp]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
+      [_rotl32]: dart.definiteFunctionType(core.int, [core.int, core.int]),
+      [_resultAsBytes]: dart.definiteFunctionType(dart.dynamic, []),
+      [_bytesToChunk]: dart.definiteFunctionType(dart.dynamic, [ListOfint(), core.int]),
+      [_wordToBytes]: dart.definiteFunctionType(dart.dynamic, [core.int]),
+      [_iterate]: dart.definiteFunctionType(dart.dynamic, []),
+      [_finalizeData]: dart.definiteFunctionType(dart.dynamic, [])
+    })
+  });
+  io._MD5 = class _MD5 extends io._HashBase {
+    new() {
+      super.new(16, 4, false);
+      this[_h][dartx._set](0, 1732584193);
+      this[_h][dartx._set](1, 4023233417);
+      this[_h][dartx._set](2, 2562383102);
+      this[_h][dartx._set](3, 271733878);
+    }
+    newInstance() {
+      return new io._MD5();
+    }
+    [_updateHash](m) {
+      dart.assert(m[dartx.length] == 16);
+      let a = this[_h][dartx._get](0);
+      let b = this[_h][dartx._get](1);
+      let c = this[_h][dartx._get](2);
+      let d = this[_h][dartx._get](3);
+      let t0 = null;
+      let t1 = null;
+      for (let i = 0; i < 64; i++) {
+        if (i < 16) {
+          t0 = (dart.notNull(b) & dart.notNull(c) | ~dart.notNull(b) & io._MASK_32 & dart.notNull(d)) >>> 0;
+          t1 = i;
+        } else if (i < 32) {
+          t0 = (dart.notNull(d) & dart.notNull(b) | ~dart.notNull(d) & io._MASK_32 & dart.notNull(c)) >>> 0;
+          t1 = (5 * i + 1)[dartx['%']](16);
+        } else if (i < 48) {
+          t0 = (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0;
+          t1 = (3 * i + 5)[dartx['%']](16);
+        } else {
+          t0 = (dart.notNull(c) ^ (dart.notNull(b) | ~dart.notNull(d) & io._MASK_32)) >>> 0;
+          t1 = (7 * i)[dartx['%']](16);
+        }
+        let temp = d;
+        d = c;
+        c = b;
+        b = core.int._check(this[_add32](b, this[_rotl32](core.int._check(this[_add32](this[_add32](a, t0), this[_add32](io._MD5._k[dartx._get](i), m[dartx._get](core.int._check(t1))))), io._MD5._r[dartx._get](i))));
+        a = temp;
+      }
+      this[_h][dartx._set](0, core.int._check(this[_add32](a, this[_h][dartx._get](0))));
+      this[_h][dartx._set](1, core.int._check(this[_add32](b, this[_h][dartx._get](1))));
+      this[_h][dartx._set](2, core.int._check(this[_add32](c, this[_h][dartx._get](2))));
+      this[_h][dartx._set](3, core.int._check(this[_add32](d, this[_h][dartx._get](3))));
+    }
+  };
+  dart.setSignature(io._MD5, {
+    constructors: () => ({new: dart.definiteFunctionType(io._MD5, [])}),
+    methods: () => ({
+      newInstance: dart.definiteFunctionType(io._MD5, []),
+      [_updateHash]: dart.definiteFunctionType(dart.void, [ListOfint()])
+    }),
+    sfields: () => ({
+      _k: ListOfint(),
+      _r: ListOfint()
+    })
+  });
+  io._MD5._k = dart.constList([3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426, 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134, 1804603682, 4254626195, 2792965006, 1236535329, 4129170786, 3225465664, 643717713, 3921069994, 3593408605, 38016083, 3634488961, 3889429448, 568446438, 3275163606, 4107603335, 1163531501, 2850285829, 4243563512, 1735328473, 2368359562, 4294588738, 2272392833, 1839030562, 4259657740, 2763975236, 1272893353, 4139469664, 3200236656, 681279174, 3936430074, 3572445317, 76029189, 3654602809, 3873151461, 530742520, 3299628645, 4096336452, 1126891415, 2878612391, 4237533241, 1700485571, 2399980690, 4293915773, 2240044497, 1873313359, 4264355552, 2734768916, 1309151649, 4149444226, 3174756917, 718787259, 3951481745], core.int);
+  io._MD5._r = dart.constList([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21], core.int);
+  const _w = Symbol('_w');
+  io._SHA1 = class _SHA1 extends io._HashBase {
+    new() {
+      this[_w] = ListOfint().new(80);
+      super.new(16, 5, true);
+      this[_h][dartx._set](0, 1732584193);
+      this[_h][dartx._set](1, 4023233417);
+      this[_h][dartx._set](2, 2562383102);
+      this[_h][dartx._set](3, 271733878);
+      this[_h][dartx._set](4, 3285377520);
+    }
+    newInstance() {
+      return new io._SHA1();
+    }
+    [_updateHash](m) {
+      dart.assert(m[dartx.length] == 16);
+      let a = this[_h][dartx._get](0);
+      let b = this[_h][dartx._get](1);
+      let c = this[_h][dartx._get](2);
+      let d = this[_h][dartx._get](3);
+      let e = this[_h][dartx._get](4);
+      for (let i = 0; i < 80; i++) {
+        if (i < 16) {
+          this[_w][dartx._set](i, m[dartx._get](i));
+        } else {
+          let n = (dart.notNull(this[_w][dartx._get](i - 3)) ^ dart.notNull(this[_w][dartx._get](i - 8)) ^ dart.notNull(this[_w][dartx._get](i - 14)) ^ dart.notNull(this[_w][dartx._get](i - 16))) >>> 0;
+          this[_w][dartx._set](i, this[_rotl32](n, 1));
+        }
+        let t = this[_add32](this[_add32](this[_rotl32](a, 5), e), this[_w][dartx._get](i));
+        if (i < 20) {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) & dart.notNull(c) | ~dart.notNull(b) & dart.notNull(d)) >>> 0), 1518500249);
+        } else if (i < 40) {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0), 1859775393);
+        } else if (i < 60) {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) & dart.notNull(c) | dart.notNull(b) & dart.notNull(d) | dart.notNull(c) & dart.notNull(d)) >>> 0), 2400959708);
+        } else {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0), 3395469782);
+        }
+        e = d;
+        d = c;
+        c = this[_rotl32](b, 30);
+        b = a;
+        a = core.int._check(dart.dsend(t, '&', io._MASK_32));
+      }
+      this[_h][dartx._set](0, core.int._check(this[_add32](a, this[_h][dartx._get](0))));
+      this[_h][dartx._set](1, core.int._check(this[_add32](b, this[_h][dartx._get](1))));
+      this[_h][dartx._set](2, core.int._check(this[_add32](c, this[_h][dartx._get](2))));
+      this[_h][dartx._set](3, core.int._check(this[_add32](d, this[_h][dartx._get](3))));
+      this[_h][dartx._set](4, core.int._check(this[_add32](e, this[_h][dartx._get](4))));
+    }
+  };
+  dart.setSignature(io._SHA1, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SHA1, [])}),
+    fields: () => ({[_w]: ListOfint()}),
+    methods: () => ({
+      newInstance: dart.definiteFunctionType(io._SHA1, []),
+      [_updateHash]: dart.definiteFunctionType(dart.void, [ListOfint()])
+    })
+  });
+  io.ZLibOption = class ZLibOption extends core.Object {};
+  dart.setSignature(io.ZLibOption, {
+    sfields: () => ({
+      MIN_WINDOW_BITS: core.int,
+      MAX_WINDOW_BITS: core.int,
+      DEFAULT_WINDOW_BITS: core.int,
+      MIN_LEVEL: core.int,
+      MAX_LEVEL: core.int,
+      DEFAULT_LEVEL: core.int,
+      MIN_MEM_LEVEL: core.int,
+      MAX_MEM_LEVEL: core.int,
+      DEFAULT_MEM_LEVEL: core.int,
+      STRATEGY_FILTERED: core.int,
+      STRATEGY_HUFFMAN_ONLY: core.int,
+      STRATEGY_RLE: core.int,
+      STRATEGY_FIXED: core.int,
+      STRATEGY_DEFAULT: core.int
+    })
+  });
+  io.ZLibOption.MIN_WINDOW_BITS = 8;
+  io.ZLibOption.MAX_WINDOW_BITS = 15;
+  io.ZLibOption.DEFAULT_WINDOW_BITS = 15;
+  io.ZLibOption.MIN_LEVEL = -1;
+  io.ZLibOption.MAX_LEVEL = 9;
+  io.ZLibOption.DEFAULT_LEVEL = 6;
+  io.ZLibOption.MIN_MEM_LEVEL = 1;
+  io.ZLibOption.MAX_MEM_LEVEL = 9;
+  io.ZLibOption.DEFAULT_MEM_LEVEL = 8;
+  io.ZLibOption.STRATEGY_FILTERED = 1;
+  io.ZLibOption.STRATEGY_HUFFMAN_ONLY = 2;
+  io.ZLibOption.STRATEGY_RLE = 3;
+  io.ZLibOption.STRATEGY_FIXED = 4;
+  io.ZLibOption.STRATEGY_DEFAULT = 0;
+  io.ZLibCodec = class ZLibCodec extends convert.Codec$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+      let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      let gzip = opts && 'gzip' in opts ? opts.gzip : false;
+      this.level = level;
+      this.windowBits = windowBits;
+      this.memLevel = memLevel;
+      this.strategy = strategy;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      this.gzip = gzip;
+      super.new();
+      io._validateZLibeLevel(this.level);
+      io._validateZLibMemLevel(this.memLevel);
+      io._validateZLibStrategy(this.strategy);
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    _default() {
+      this.level = io.ZLibOption.DEFAULT_LEVEL;
+      this.windowBits = io.ZLibOption.DEFAULT_WINDOW_BITS;
+      this.memLevel = io.ZLibOption.DEFAULT_MEM_LEVEL;
+      this.strategy = io.ZLibOption.STRATEGY_DEFAULT;
+      this.raw = false;
+      this.gzip = false;
+      this.dictionary = null;
+      super.new();
+    }
+    get encoder() {
+      return new io.ZLibEncoder({gzip: false, level: this.level, windowBits: this.windowBits, memLevel: this.memLevel, strategy: this.strategy, dictionary: this.dictionary, raw: this.raw});
+    }
+    get decoder() {
+      return new io.ZLibDecoder({windowBits: this.windowBits, dictionary: this.dictionary, raw: this.raw});
+    }
+  };
+  dart.addSimpleTypeTests(io.ZLibCodec);
+  dart.defineNamedConstructor(io.ZLibCodec, '_default');
+  dart.setSignature(io.ZLibCodec, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.ZLibCodec, [], {level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool, gzip: core.bool}),
+      _default: dart.definiteFunctionType(io.ZLibCodec, [])
+    }),
+    fields: () => ({
+      gzip: core.bool,
+      level: core.int,
+      memLevel: core.int,
+      strategy: core.int,
+      windowBits: core.int,
+      raw: core.bool,
+      dictionary: ListOfint()
+    }),
+    getters: () => ({
+      encoder: dart.definiteFunctionType(io.ZLibEncoder, []),
+      decoder: dart.definiteFunctionType(io.ZLibDecoder, [])
+    })
+  });
+  io.ZLIB = dart.const(new io.ZLibCodec._default());
+  io.GZipCodec = class GZipCodec extends convert.Codec$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+      let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      let gzip = opts && 'gzip' in opts ? opts.gzip : true;
+      this.level = level;
+      this.windowBits = windowBits;
+      this.memLevel = memLevel;
+      this.strategy = strategy;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      this.gzip = gzip;
+      super.new();
+      io._validateZLibeLevel(this.level);
+      io._validateZLibMemLevel(this.memLevel);
+      io._validateZLibStrategy(this.strategy);
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    _default() {
+      this.level = io.ZLibOption.DEFAULT_LEVEL;
+      this.windowBits = io.ZLibOption.DEFAULT_WINDOW_BITS;
+      this.memLevel = io.ZLibOption.DEFAULT_MEM_LEVEL;
+      this.strategy = io.ZLibOption.STRATEGY_DEFAULT;
+      this.raw = false;
+      this.gzip = true;
+      this.dictionary = null;
+      super.new();
+    }
+    get encoder() {
+      return new io.ZLibEncoder({gzip: true, level: this.level, windowBits: this.windowBits, memLevel: this.memLevel, strategy: this.strategy, dictionary: this.dictionary, raw: this.raw});
+    }
+    get decoder() {
+      return new io.ZLibDecoder({windowBits: this.windowBits, dictionary: this.dictionary, raw: this.raw});
+    }
+  };
+  dart.addSimpleTypeTests(io.GZipCodec);
+  dart.defineNamedConstructor(io.GZipCodec, '_default');
+  dart.setSignature(io.GZipCodec, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.GZipCodec, [], {level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool, gzip: core.bool}),
+      _default: dart.definiteFunctionType(io.GZipCodec, [])
+    }),
+    fields: () => ({
+      gzip: core.bool,
+      level: core.int,
+      memLevel: core.int,
+      strategy: core.int,
+      windowBits: core.int,
+      dictionary: ListOfint(),
+      raw: core.bool
+    }),
+    getters: () => ({
+      encoder: dart.definiteFunctionType(io.ZLibEncoder, []),
+      decoder: dart.definiteFunctionType(io.ZLibDecoder, [])
+    })
+  });
+  io.GZIP = dart.const(new io.GZipCodec._default());
+  io.ZLibEncoder = class ZLibEncoder extends convert.Converter$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let gzip = opts && 'gzip' in opts ? opts.gzip : false;
+      let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+      let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      this.gzip = gzip;
+      this.level = level;
+      this.windowBits = windowBits;
+      this.memLevel = memLevel;
+      this.strategy = strategy;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      super.new();
+      io._validateZLibeLevel(this.level);
+      io._validateZLibMemLevel(this.memLevel);
+      io._validateZLibStrategy(this.strategy);
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    convert(bytes) {
+      let sink = new io._BufferSink();
+      let _ = this.startChunkedConversion(sink);
+      _.add(bytes);
+      _.close();
+      return sink.builder.takeBytes();
+    }
+    startChunkedConversion(sink) {
+      if (!convert.ByteConversionSink.is(sink)) {
+        sink = convert.ByteConversionSink.from(sink);
+      }
+      return new io._ZLibEncoderSink(convert.ByteConversionSink._check(sink), this.gzip, this.level, this.windowBits, this.memLevel, this.strategy, this.dictionary, this.raw);
+    }
+  };
+  dart.addSimpleTypeTests(io.ZLibEncoder);
+  dart.setSignature(io.ZLibEncoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ZLibEncoder, [], {gzip: core.bool, level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool})}),
+    fields: () => ({
+      gzip: core.bool,
+      level: core.int,
+      memLevel: core.int,
+      strategy: core.int,
+      windowBits: core.int,
+      dictionary: ListOfint(),
+      raw: core.bool
+    }),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.List$(core.int), [ListOfint()]),
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfListOfint()])
+    })
+  });
+  io.ZLibDecoder = class ZLibDecoder extends convert.Converter$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      this.windowBits = windowBits;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      super.new();
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    convert(bytes) {
+      let sink = new io._BufferSink();
+      let _ = this.startChunkedConversion(sink);
+      _.add(bytes);
+      _.close();
+      return sink.builder.takeBytes();
+    }
+    startChunkedConversion(sink) {
+      if (!convert.ByteConversionSink.is(sink)) {
+        sink = convert.ByteConversionSink.from(sink);
+      }
+      return new io._ZLibDecoderSink(convert.ByteConversionSink._check(sink), this.windowBits, this.dictionary, this.raw);
+    }
+  };
+  dart.addSimpleTypeTests(io.ZLibDecoder);
+  dart.setSignature(io.ZLibDecoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ZLibDecoder, [], {windowBits: core.int, dictionary: ListOfint(), raw: core.bool})}),
+    fields: () => ({
+      windowBits: core.int,
+      dictionary: ListOfint(),
+      raw: core.bool
+    }),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.List$(core.int), [ListOfint()]),
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfListOfint()])
+    })
+  });
+  io._BufferSink = class _BufferSink extends convert.ByteConversionSink {
+    new() {
+      this.builder = io.BytesBuilder.new({copy: false});
+      super.new();
+    }
+    add(chunk) {
+      this.builder.add(chunk);
+    }
+    addSlice(chunk, start, end, isLast) {
+      if (typed_data.Uint8List.is(chunk)) {
+        let list = chunk;
+        this.builder.add(typed_data.Uint8List.view(list[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+      } else {
+        this.builder.add(chunk[dartx.sublist](start, end));
+      }
+    }
+    close() {}
+  };
+  dart.setSignature(io._BufferSink, {
+    fields: () => ({builder: io.BytesBuilder}),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+      close: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _sink$0 = Symbol('_sink');
+  const _filter$ = Symbol('_filter');
+  const _closed = Symbol('_closed');
+  const _empty = Symbol('_empty');
+  let const$52;
+  io._FilterSink = class _FilterSink extends convert.ByteConversionSink {
+    new(sink, filter) {
+      this[_sink$0] = sink;
+      this[_filter$] = filter;
+      this[_closed] = false;
+      this[_empty] = true;
+      super.new();
+    }
+    add(data) {
+      this.addSlice(data, 0, data[dartx.length], false);
+    }
+    addSlice(data, start, end, isLast) {
+      if (dart.test(this[_closed])) return;
+      if (end == null) dart.throw(new core.ArgumentError.notNull("end"));
+      core.RangeError.checkValidRange(start, end, data[dartx.length]);
+      try {
+        this[_empty] = false;
+        let bufferAndStart = io._ensureFastAndSerializableByteData(data, start, end);
+        this[_filter$].process(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+        let out = null;
+        while ((out = this[_filter$].processed({flush: false})) != null) {
+          this[_sink$0].add(ListOfint()._check(out));
+        }
+      } catch (e) {
+        this[_closed] = true;
+        throw e;
+      }
+
+      if (dart.test(isLast)) this.close();
+    }
+    close() {
+      if (dart.test(this[_closed])) return;
+      if (dart.test(this[_empty])) this[_filter$].process(const$52 || (const$52 = dart.constList([], core.int)), 0, 0);
+      try {
+        let out = null;
+        while ((out = this[_filter$].processed({end: true})) != null) {
+          this[_sink$0].add(ListOfint()._check(out));
+        }
+      } catch (e) {
+        this[_closed] = true;
+        dart.throw(e);
+      }
+
+      this[_closed] = true;
+      this[_sink$0].close();
+    }
+  };
+  dart.setSignature(io._FilterSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._FilterSink, [convert.ByteConversionSink, io._Filter])}),
+    fields: () => ({
+      [_filter$]: io._Filter,
+      [_sink$0]: convert.ByteConversionSink,
+      [_closed]: core.bool,
+      [_empty]: core.bool
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+      close: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._ZLibEncoderSink = class _ZLibEncoderSink extends io._FilterSink {
+    new(sink, gzip, level, windowBits, memLevel, strategy, dictionary, raw) {
+      super.new(sink, io._Filter._newZLibDeflateFilter(gzip, level, windowBits, memLevel, strategy, dictionary, raw));
+    }
+  };
+  dart.setSignature(io._ZLibEncoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ZLibEncoderSink, [convert.ByteConversionSink, core.bool, core.int, core.int, core.int, core.int, ListOfint(), core.bool])})
+  });
+  io._ZLibDecoderSink = class _ZLibDecoderSink extends io._FilterSink {
+    new(sink, windowBits, dictionary, raw) {
+      super.new(sink, io._Filter._newZLibInflateFilter(windowBits, dictionary, raw));
+    }
+  };
+  dart.setSignature(io._ZLibDecoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ZLibDecoderSink, [convert.ByteConversionSink, core.int, ListOfint(), core.bool])})
+  });
+  io._Filter = class _Filter extends core.Object {
+    static _newZLibDeflateFilter(gzip, level, windowBits, memLevel, strategy, dictionary, raw) {
+      dart.throw(new core.UnsupportedError("_newZLibDeflateFilter"));
+    }
+    static _newZLibInflateFilter(windowBits, dictionary, raw) {
+      dart.throw(new core.UnsupportedError("_newZLibInflateFilter"));
+    }
+  };
+  dart.setSignature(io._Filter, {
+    statics: () => ({
+      _newZLibDeflateFilter: dart.definiteFunctionType(io._Filter, [core.bool, core.int, core.int, core.int, core.int, ListOfint(), core.bool]),
+      _newZLibInflateFilter: dart.definiteFunctionType(io._Filter, [core.int, ListOfint(), core.bool])
+    }),
+    names: ['_newZLibDeflateFilter', '_newZLibInflateFilter']
+  });
+  io._validateZLibWindowBits = function(windowBits) {
+    if (io.ZLibOption.MIN_WINDOW_BITS > dart.notNull(windowBits) || io.ZLibOption.MAX_WINDOW_BITS < dart.notNull(windowBits)) {
+      dart.throw(new core.RangeError.range(windowBits, io.ZLibOption.MIN_WINDOW_BITS, io.ZLibOption.MAX_WINDOW_BITS));
+    }
+  };
+  dart.fn(io._validateZLibWindowBits, intTovoid());
+  io._validateZLibeLevel = function(level) {
+    if (io.ZLibOption.MIN_LEVEL > dart.notNull(level) || io.ZLibOption.MAX_LEVEL < dart.notNull(level)) {
+      dart.throw(new core.RangeError.range(level, io.ZLibOption.MIN_LEVEL, io.ZLibOption.MAX_LEVEL));
+    }
+  };
+  dart.fn(io._validateZLibeLevel, intTovoid());
+  io._validateZLibMemLevel = function(memLevel) {
+    if (io.ZLibOption.MIN_MEM_LEVEL > dart.notNull(memLevel) || io.ZLibOption.MAX_MEM_LEVEL < dart.notNull(memLevel)) {
+      dart.throw(new core.RangeError.range(memLevel, io.ZLibOption.MIN_MEM_LEVEL, io.ZLibOption.MAX_MEM_LEVEL));
+    }
+  };
+  dart.fn(io._validateZLibMemLevel, intTovoid());
+  let const$53;
+  io._validateZLibStrategy = function(strategy) {
+    let strategies = const$53 || (const$53 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
+    if (strategies[dartx.indexOf](strategy) == -1) {
+      dart.throw(new core.ArgumentError("Unsupported 'strategy'"));
+    }
+  };
+  dart.fn(io._validateZLibStrategy, intTovoid());
+  io.Directory = class Directory extends core.Object {
+    static new(path) {
+      return new io._Directory(path);
+    }
+    static fromUri(uri) {
+      return io.Directory.new(uri.toFilePath());
+    }
+    static get current() {
+      return io._Directory.current;
+    }
+    static set current(path) {
+      io._Directory.current = path;
+    }
+    static get systemTemp() {
+      return io._Directory.systemTemp;
+    }
+  };
+  io.Directory[dart.implements] = () => [io.FileSystemEntity];
+  dart.setSignature(io.Directory, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.Directory, [core.String]),
+      fromUri: dart.definiteFunctionType(io.Directory, [core.Uri])
+    }),
+    fields: () => ({path: core.String}),
+    sgetters: () => ({
+      current: dart.definiteFunctionType(io.Directory, []),
+      systemTemp: dart.definiteFunctionType(io.Directory, [])
+    }),
+    ssetters: () => ({current: dart.definiteFunctionType(dart.void, [dart.dynamic])})
+  });
+  const _isErrorResponse = Symbol('_isErrorResponse');
+  const _exceptionOrErrorFromResponse = Symbol('_exceptionOrErrorFromResponse');
+  const _absolutePath = Symbol('_absolutePath');
+  const _computeExistingIndex = Symbol('_computeExistingIndex');
+  const _delete = Symbol('_delete');
+  const _deleteSync = Symbol('_deleteSync');
+  const _type = Symbol('_type');
+  io.FileSystemEntity = class FileSystemEntity extends core.Object {
+    get uri() {
+      return core.Uri.file(this.path);
+    }
+    resolveSymbolicLinks() {
+      return io._IOService._dispatch(io._FILE_RESOLVE_SYMBOLIC_LINKS, JSArrayOfString().of([this.path])).then(core.String)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot resolve symbolic links", this.path));
+        }
+        return FutureOrOfString()._check(response);
+      }, dynamicToFutureOrOfString()));
+    }
+    resolveSymbolicLinksSync() {
+      let result = io.FileSystemEntity._resolveSymbolicLinks(this.path);
+      io.FileSystemEntity._throwIfError(result, "Cannot resolve symbolic links", this.path);
+      return core.String._check(result);
+    }
+    delete(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return this[_delete]({recursive: recursive});
+    }
+    deleteSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return this[_deleteSync]({recursive: recursive});
+    }
+    watch(opts) {
+      let events = opts && 'events' in opts ? opts.events : io.FileSystemEvent.ALL;
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return io._FileSystemWatcher._watch(io.FileSystemEntity._trimTrailingPathSeparators(this.path), events, recursive);
+    }
+    static identical(path1, path2) {
+      return io._IOService._dispatch(io._FILE_IDENTICAL, JSArrayOfString().of([path1, path2])).then(core.bool)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, dart.str`Error in FileSystemEntity.identical(${path1}, ${path2})`, ""));
+        }
+        return FutureOrOfbool()._check(response);
+      }, dynamicToFutureOrOfbool()));
+    }
+    get isAbsolute() {
+      if (dart.test(io.Platform.isWindows)) {
+        return this.path[dartx.startsWith](io.FileSystemEntity._absoluteWindowsPathPattern);
+      } else {
+        return this.path[dartx.startsWith]('/');
+      }
+    }
+    get [_absolutePath]() {
+      if (dart.test(this.isAbsolute)) return this.path;
+      let current = io.Directory.current.path;
+      if (dart.test(current[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(current[dartx.endsWith]('\\'))) {
+        return dart.str`${current}${this.path}`;
+      } else {
+        return dart.str`${current}${io.Platform.pathSeparator}${this.path}`;
+      }
+    }
+    static identicalSync(path1, path2) {
+      let result = io.FileSystemEntity._identical(path1, path2);
+      io.FileSystemEntity._throwIfError(result, 'Error in FileSystemEntity.identicalSync');
+      return core.bool._check(result);
+    }
+    static get isWatchSupported() {
+      return io._FileSystemWatcher.isSupported;
+    }
+    static type(path, opts) {
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      return io.FileSystemEntity._getTypeAsync(path, followLinks).then(io.FileSystemEntityType)(io.FileSystemEntityType._lookup);
+    }
+    static typeSync(path, opts) {
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      return io.FileSystemEntityType._lookup(io.FileSystemEntity._getTypeSync(path, followLinks));
+    }
+    static isLink(path) {
+      return io.FileSystemEntity._getTypeAsync(path, false).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.LINK[_type], intTobool()));
+    }
+    static isFile(path) {
+      return io.FileSystemEntity._getTypeAsync(path, true).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.FILE[_type], intTobool()));
+    }
+    static isDirectory(path) {
+      return io.FileSystemEntity._getTypeAsync(path, true).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.DIRECTORY[_type], intTobool()));
+    }
+    static isLinkSync(path) {
+      return io.FileSystemEntity._getTypeSync(path, false) == io.FileSystemEntityType.LINK[_type];
+    }
+    static isFileSync(path) {
+      return io.FileSystemEntity._getTypeSync(path, true) == io.FileSystemEntityType.FILE[_type];
+    }
+    static isDirectorySync(path) {
+      return io.FileSystemEntity._getTypeSync(path, true) == io.FileSystemEntityType.DIRECTORY[_type];
+    }
+    static _getType(path, followLinks) {
+      dart.throw(new core.UnsupportedError("FileSystemEntity._getType"));
+    }
+    static _identical(path1, path2) {
+      dart.throw(new core.UnsupportedError("FileSystemEntity._identical"));
+    }
+    static _resolveSymbolicLinks(path) {
+      dart.throw(new core.UnsupportedError("FileSystemEntity._resolveSymbolicLinks"));
+    }
+    static parentOf(path) {
+      let rootEnd = -1;
+      if (dart.test(io.Platform.isWindows)) {
+        if (dart.test(path[dartx.startsWith](io.FileSystemEntity._absoluteWindowsPathPattern))) {
+          rootEnd = path[dartx.indexOf](core.RegExp.new('[/\\\\]'), 2);
+          if (rootEnd == -1) return path;
+        } else if (dart.test(path[dartx.startsWith]('\\')) || dart.test(path[dartx.startsWith]('/'))) {
+          rootEnd = 0;
+        }
+      } else if (dart.test(path[dartx.startsWith]('/'))) {
+        rootEnd = 0;
+      }
+      let pos = path[dartx.lastIndexOf](io.FileSystemEntity._parentRegExp);
+      if (dart.notNull(pos) > dart.notNull(rootEnd)) {
+        return path[dartx.substring](0, dart.notNull(pos) + 1);
+      } else if (dart.notNull(rootEnd) > -1) {
+        return path[dartx.substring](0, dart.notNull(rootEnd) + 1);
+      } else {
+        return '.';
+      }
+    }
+    get parent() {
+      return io.Directory.new(io.FileSystemEntity.parentOf(this.path));
+    }
+    static _getTypeSync(path, followLinks) {
+      let result = io.FileSystemEntity._getType(path, followLinks);
+      io.FileSystemEntity._throwIfError(result, 'Error getting type of FileSystemEntity');
+      return core.int._check(result);
+    }
+    static _getTypeAsync(path, followLinks) {
+      return io._IOService._dispatch(io._FILE_TYPE, JSArrayOfObject().of([path, followLinks])).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Error getting type", path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    static _throwIfError(result, msg, path) {
+      if (path === void 0) path = null;
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException(msg, path, result));
+      } else if (core.ArgumentError.is(result)) {
+        dart.throw(result);
+      }
+    }
+    static _trimTrailingPathSeparators(path) {
+      if (!(typeof path == 'string')) return path;
+      if (dart.test(io.Platform.isWindows)) {
+        while (dart.notNull(path[dartx.length]) > 1 && (dart.test(path[dartx.endsWith](io.Platform.pathSeparator)) || dart.test(path[dartx.endsWith]('/')))) {
+          path = path[dartx.substring](0, dart.notNull(path[dartx.length]) - 1);
+        }
+      } else {
+        while (dart.notNull(path[dartx.length]) > 1 && dart.test(path[dartx.endsWith](io.Platform.pathSeparator))) {
+          path = path[dartx.substring](0, dart.notNull(path[dartx.length]) - 1);
+        }
+      }
+      return path;
+    }
+    static _ensureTrailingPathSeparators(path) {
+      if (!(typeof path == 'string')) return path;
+      if (dart.test(path[dartx.isEmpty])) path = '.';
+      if (dart.test(io.Platform.isWindows)) {
+        while (!dart.test(path[dartx.endsWith](io.Platform.pathSeparator)) && !dart.test(path[dartx.endsWith]('/'))) {
+          path = dart.str`${path}${io.Platform.pathSeparator}`;
+        }
+      } else {
+        while (!dart.test(path[dartx.endsWith](io.Platform.pathSeparator))) {
+          path = dart.str`${path}${io.Platform.pathSeparator}`;
+        }
+      }
+      return path;
+    }
+  };
+  dart.setSignature(io.FileSystemEntity, {
+    getters: () => ({
+      uri: dart.definiteFunctionType(core.Uri, []),
+      isAbsolute: dart.definiteFunctionType(core.bool, []),
+      [_absolutePath]: dart.definiteFunctionType(core.String, []),
+      parent: dart.definiteFunctionType(io.Directory, [])
+    }),
+    methods: () => ({
+      resolveSymbolicLinks: dart.definiteFunctionType(async.Future$(core.String), []),
+      resolveSymbolicLinksSync: dart.definiteFunctionType(core.String, []),
+      delete: dart.definiteFunctionType(async.Future$(io.FileSystemEntity), [], {recursive: core.bool}),
+      deleteSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [], {events: core.int, recursive: core.bool})
+    }),
+    sfields: () => ({
+      _absoluteWindowsPathPattern: core.RegExp,
+      _parentRegExp: core.RegExp
+    }),
+    sgetters: () => ({isWatchSupported: dart.definiteFunctionType(core.bool, [])}),
+    statics: () => ({
+      identical: dart.definiteFunctionType(async.Future$(core.bool), [core.String, core.String]),
+      identicalSync: dart.definiteFunctionType(core.bool, [core.String, core.String]),
+      type: dart.definiteFunctionType(async.Future$(io.FileSystemEntityType), [core.String], {followLinks: core.bool}),
+      typeSync: dart.definiteFunctionType(io.FileSystemEntityType, [core.String], {followLinks: core.bool}),
+      isLink: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+      isFile: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+      isDirectory: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+      isLinkSync: dart.definiteFunctionType(core.bool, [core.String]),
+      isFileSync: dart.definiteFunctionType(core.bool, [core.String]),
+      isDirectorySync: dart.definiteFunctionType(core.bool, [core.String]),
+      _getType: dart.definiteFunctionType(dart.dynamic, [core.String, core.bool]),
+      _identical: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _resolveSymbolicLinks: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      parentOf: dart.definiteFunctionType(core.String, [core.String]),
+      _getTypeSync: dart.definiteFunctionType(core.int, [core.String, core.bool]),
+      _getTypeAsync: dart.definiteFunctionType(async.Future$(core.int), [core.String, core.bool]),
+      _throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String], [core.String]),
+      _trimTrailingPathSeparators: dart.definiteFunctionType(core.String, [core.String]),
+      _ensureTrailingPathSeparators: dart.definiteFunctionType(core.String, [core.String])
+    }),
+    names: ['identical', 'identicalSync', 'type', 'typeSync', 'isLink', 'isFile', 'isDirectory', 'isLinkSync', 'isFileSync', 'isDirectorySync', '_getType', '_identical', '_resolveSymbolicLinks', 'parentOf', '_getTypeSync', '_getTypeAsync', '_throwIfError', '_trimTrailingPathSeparators', '_ensureTrailingPathSeparators']
+  });
+  dart.defineLazy(io.FileSystemEntity, {
+    get _absoluteWindowsPathPattern() {
+      return core.RegExp.new('^(\\\\\\\\|[a-zA-Z]:[/\\\\])');
+    },
+    get _parentRegExp() {
+      return dart.test(io.Platform.isWindows) ? core.RegExp.new('[^/\\\\][/\\\\]+[^/\\\\]') : core.RegExp.new('[^/]/+[^/]');
+    }
+  });
+  io._Directory = class _Directory extends io.FileSystemEntity {
+    new(path) {
+      this.path = path;
+      if (!(typeof this.path == 'string')) {
+        dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+      }
+    }
+    static _current() {
+      dart.throw(new core.UnsupportedError("Directory._current"));
+    }
+    static _setCurrent(path) {
+      dart.throw(new core.UnsupportedError("Directory_SetCurrent"));
+    }
+    static _createTemp(path) {
+      dart.throw(new core.UnsupportedError("Directory._createTemp"));
+    }
+    static _systemTemp() {
+      dart.throw(new core.UnsupportedError("Directory._systemTemp"));
+    }
+    static _exists(path) {
+      dart.throw(new core.UnsupportedError("Directory._exists"));
+    }
+    static _create(path) {
+      dart.throw(new core.UnsupportedError("Directory._create"));
+    }
+    static _deleteNative(path, recursive) {
+      dart.throw(new core.UnsupportedError("Directory._deleteNative"));
+    }
+    static _rename(path, newPath) {
+      dart.throw(new core.UnsupportedError("Directory._rename"));
+    }
+    static _fillWithDirectoryListing(list, path, recursive, followLinks) {
+      dart.throw(new core.UnsupportedError("Directory._fillWithDirectoryListing"));
+    }
+    static get current() {
+      let result = io._Directory._current();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Getting current working directory failed", "", result));
+      }
+      return new io._Directory(core.String._check(result));
+    }
+    static set current(path) {
+      if (io.Directory.is(path)) path = dart.dload(path, 'path');
+      let result = io._Directory._setCurrent(path);
+      if (core.ArgumentError.is(result)) dart.throw(result);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Setting current working directory failed", core.String._check(path), result));
+      }
+    }
+    get uri() {
+      return core.Uri.directory(this.path);
+    }
+    exists() {
+      return io._IOService._dispatch(io._DIRECTORY_EXISTS, JSArrayOfString().of([this.path])).then(core.bool)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Exists failed"));
+        }
+        return dart.equals(response, 1);
+      }, dynamicTobool$()));
+    }
+    existsSync() {
+      let result = io._Directory._exists(this.path);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Exists failed", this.path, result));
+      }
+      return dart.equals(result, 1);
+    }
+    get absolute() {
+      return io.Directory.new(this[_absolutePath]);
+    }
+    stat() {
+      return io.FileStat.stat(this.path);
+    }
+    statSync() {
+      return io.FileStat.statSync(this.path);
+    }
+    [_computeExistingIndex](dirsToCreate) {
+      let future = null;
+      let notFound = dirsToCreate[dartx.length];
+      for (let i = 0; i < dart.notNull(dirsToCreate[dartx.length]); i++) {
+        if (future == null) {
+          future = dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
+        } else {
+          future = dart.dsend(future, 'then', dart.fn(index => {
+            if (!dart.equals(index, notFound)) {
+              return async.Future.value(index);
+            }
+            return dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
+          }, dynamicTodynamic$()));
+        }
+      }
+      if (future == null) {
+        return FutureOfint().value(notFound);
+      } else {
+        return FutureOfint()._check(future);
+      }
+    }
+    create(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return this.exists().then(io.Directory)(dart.fn(exists => {
+          if (dart.test(exists)) return this;
+          if (this.path != this.parent.path) {
+            return this.parent.create({recursive: true}).then(io.Directory)(dart.fn(_ => this.create(), DirectoryToFutureOfDirectory()));
+          } else {
+            return this.create();
+          }
+        }, boolToFutureOrOfDirectory()));
+      } else {
+        return io._IOService._dispatch(io._DIRECTORY_CREATE, JSArrayOfString().of([this.path])).then(io._Directory)(dart.fn(response => {
+          if (dart.test(this[_isErrorResponse](response))) {
+            dart.throw(this[_exceptionOrErrorFromResponse](response, "Creation failed"));
+          }
+          return this;
+        }, dynamicTo_Directory()));
+      }
+    }
+    createSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        if (dart.test(this.existsSync())) return;
+        if (this.path != this.parent.path) {
+          this.parent.createSync({recursive: true});
+        }
+      }
+      let result = io._Directory._create(this.path);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Creation failed", this.path, result));
+      }
+    }
+    static get systemTemp() {
+      return io.Directory.new(io._Directory._systemTemp());
+    }
+    createTemp(prefix) {
+      if (prefix === void 0) prefix = null;
+      if (prefix == null) prefix = '';
+      if (this.path == '') {
+        dart.throw(new core.ArgumentError("Directory.createTemp called with an empty path. " + "To use the system temp directory, use Directory.systemTemp"));
+      }
+      let fullPrefix = null;
+      if (dart.test(this.path[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(this.path[dartx.endsWith]('\\'))) {
+        fullPrefix = dart.str`${this.path}${prefix}`;
+      } else {
+        fullPrefix = dart.str`${this.path}${io.Platform.pathSeparator}${prefix}`;
+      }
+      return io._IOService._dispatch(io._DIRECTORY_CREATE_TEMP, JSArrayOfString().of([fullPrefix])).then(io.Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Creation of temporary directory failed"));
+        }
+        return io.Directory.new(core.String._check(response));
+      }, dynamicToDirectory()));
+    }
+    createTempSync(prefix) {
+      if (prefix === void 0) prefix = null;
+      if (prefix == null) prefix = '';
+      if (this.path == '') {
+        dart.throw(new core.ArgumentError("Directory.createTemp called with an empty path. " + "To use the system temp directory, use Directory.systemTemp"));
+      }
+      let fullPrefix = null;
+      if (dart.test(this.path[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(this.path[dartx.endsWith]('\\'))) {
+        fullPrefix = dart.str`${this.path}${prefix}`;
+      } else {
+        fullPrefix = dart.str`${this.path}${io.Platform.pathSeparator}${prefix}`;
+      }
+      let result = io._Directory._createTemp(fullPrefix);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Creation of temporary directory failed", fullPrefix, result));
+      }
+      return io.Directory.new(core.String._check(result));
+    }
+    [_delete](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return io._IOService._dispatch(io._DIRECTORY_DELETE, JSArrayOfObject().of([this.path, recursive])).then(io._Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Deletion failed"));
+        }
+        return this;
+      }, dynamicTo_Directory()));
+    }
+    [_deleteSync](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let result = io._Directory._deleteNative(this.path, recursive);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Deletion failed", this.path, result));
+      }
+    }
+    rename(newPath) {
+      return io._IOService._dispatch(io._DIRECTORY_RENAME, JSArrayOfString().of([this.path, newPath])).then(io.Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Rename failed"));
+        }
+        return io.Directory.new(newPath);
+      }, dynamicToDirectory()));
+    }
+    renameSync(newPath) {
+      if (!(typeof newPath == 'string')) {
+        dart.throw(new core.ArgumentError());
+      }
+      let result = io._Directory._rename(this.path, newPath);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Rename failed", this.path, result));
+      }
+      return io.Directory.new(newPath);
+    }
+    list(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      return StreamOfFileSystemEntity()._check(new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream);
+    }
+    listSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      if (!(typeof recursive == 'boolean') || !(typeof followLinks == 'boolean')) {
+        dart.throw(new core.ArgumentError());
+      }
+      let result = JSArrayOfFileSystemEntity().of([]);
+      io._Directory._fillWithDirectoryListing(result, io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks);
+      return result;
+    }
+    toString() {
+      return dart.str`Directory: '${this.path}'`;
+    }
+    [_isErrorResponse](response) {
+      return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+    }
+    [_exceptionOrErrorFromResponse](response, message) {
+      dart.assert(this[_isErrorResponse](response));
+      switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+        case io._ILLEGAL_ARGUMENT_RESPONSE:
+        {
+          return new core.ArgumentError();
+        }
+        case io._OSERROR_RESPONSE:
+        {
+          let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+          return new io.FileSystemException(message, this.path, err);
+        }
+        default:
+        {
+          return core.Exception.new("Unknown error");
+        }
+      }
+    }
+  };
+  io._Directory[dart.implements] = () => [io.Directory];
+  dart.setSignature(io._Directory, {
+    constructors: () => ({new: dart.definiteFunctionType(io._Directory, [core.String])}),
+    fields: () => ({path: core.String}),
+    getters: () => ({absolute: dart.definiteFunctionType(io.Directory, [])}),
+    methods: () => ({
+      exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+      existsSync: dart.definiteFunctionType(core.bool, []),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+      statSync: dart.definiteFunctionType(io.FileStat, []),
+      [_computeExistingIndex]: dart.definiteFunctionType(async.Future$(core.int), [core.List]),
+      create: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
+      createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      createTemp: dart.definiteFunctionType(async.Future$(io.Directory), [], [core.String]),
+      createTempSync: dart.definiteFunctionType(io.Directory, [], [core.String]),
+      [_delete]: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
+      [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      rename: dart.definiteFunctionType(async.Future$(io.Directory), [core.String]),
+      renameSync: dart.definiteFunctionType(io.Directory, [core.String]),
+      list: dart.definiteFunctionType(async.Stream$(io.FileSystemEntity), [], {recursive: core.bool, followLinks: core.bool}),
+      listSync: dart.definiteFunctionType(core.List$(io.FileSystemEntity), [], {recursive: core.bool, followLinks: core.bool}),
+      [_isErrorResponse]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+      [_exceptionOrErrorFromResponse]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String])
+    }),
+    sgetters: () => ({
+      current: dart.definiteFunctionType(io.Directory, []),
+      systemTemp: dart.definiteFunctionType(io.Directory, [])
+    }),
+    ssetters: () => ({current: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+    statics: () => ({
+      _current: dart.definiteFunctionType(dart.dynamic, []),
+      _setCurrent: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]),
+      _createTemp: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _systemTemp: dart.definiteFunctionType(core.String, []),
+      _exists: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _create: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _deleteNative: dart.definiteFunctionType(dart.dynamic, [core.String, core.bool]),
+      _rename: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _fillWithDirectoryListing: dart.definiteFunctionType(dart.void, [ListOfFileSystemEntity(), core.String, core.bool, core.bool])
+    }),
+    names: ['_current', '_setCurrent', '_createTemp', '_systemTemp', '_exists', '_create', '_deleteNative', '_rename', '_fillWithDirectoryListing']
+  });
+  io._AsyncDirectoryListerOps = class _AsyncDirectoryListerOps extends core.Object {
+    static new(pointer) {
+      dart.throw(new core.UnsupportedError("Directory._list"));
+    }
+  };
+  dart.setSignature(io._AsyncDirectoryListerOps, {
+    constructors: () => ({new: dart.definiteFunctionType(io._AsyncDirectoryListerOps, [core.int])})
+  });
+  const _ops = Symbol('_ops');
+  const _pointer = Symbol('_pointer');
+  const _cleanup = Symbol('_cleanup');
+  io._AsyncDirectoryLister = class _AsyncDirectoryLister extends core.Object {
+    new(path, recursive, followLinks) {
+      this.closeCompleter = async.Completer.new();
+      this.path = path;
+      this.recursive = recursive;
+      this.followLinks = followLinks;
+      this.controller = null;
+      this.canceled = false;
+      this.nextRunning = false;
+      this.closed = false;
+      this[_ops] = null;
+      this.controller = async.StreamController.new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
+    }
+    [_pointer]() {
+      return this[_ops] == null ? null : this[_ops].getPointer();
+    }
+    get stream() {
+      return this.controller.stream;
+    }
+    onListen() {
+      io._IOService._dispatch(io._DIRECTORY_LIST_START, JSArrayOfObject().of([this.path, this.recursive, this.followLinks])).then(dart.dynamic)(dart.fn(response => {
+        if (typeof response == 'number') {
+          this[_ops] = io._AsyncDirectoryListerOps.new(response);
+          this.next();
+        } else if (core.Error.is(response)) {
+          this.controller.addError(response, response.stackTrace);
+          this.close();
+        } else {
+          this.error(response);
+          this.close();
+        }
+      }, dynamicToNull$()));
+    }
+    onResume() {
+      if (!dart.test(this.nextRunning)) {
+        this.next();
+      }
+    }
+    onCancel() {
+      this.canceled = true;
+      if (!dart.test(this.nextRunning)) {
+        this.close();
+      }
+      return this.closeCompleter.future;
+    }
+    next() {
+      if (dart.test(this.canceled)) {
+        this.close();
+        return;
+      }
+      if (dart.test(this.controller.isPaused) || dart.test(this.nextRunning)) {
+        return;
+      }
+      let pointer = this[_pointer]();
+      if (pointer == null) {
+        return;
+      }
+      this.nextRunning = true;
+      io._IOService._dispatch(io._DIRECTORY_LIST_NEXT, JSArrayOfint().of([pointer])).then(dart.dynamic)(dart.fn(result => {
+        this.nextRunning = false;
+        if (core.List.is(result)) {
+          this.next();
+          dart.assert(result[dartx.length][dartx['%']](2) == 0);
+          for (let i = 0; i < dart.notNull(result[dartx.length]); i++) {
+            dart.assert(i[dartx['%']](2) == 0);
+            switch (result[dartx._get](i++)) {
+              case io._AsyncDirectoryLister.LIST_FILE:
+              {
+                this.controller.add(io.File.new(core.String._check(result[dartx._get](i))));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_DIRECTORY:
+              {
+                this.controller.add(io.Directory.new(core.String._check(result[dartx._get](i))));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_LINK:
+              {
+                this.controller.add(io.Link.new(core.String._check(result[dartx._get](i))));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_ERROR:
+              {
+                this.error(result[dartx._get](i));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_DONE:
+              {
+                this.canceled = true;
+                return;
+              }
+            }
+          }
+        } else {
+          this.controller.addError(new io.FileSystemException("Internal error"));
+        }
+      }, dynamicToNull$()));
+    }
+    [_cleanup]() {
+      this.controller.close();
+      this.closeCompleter.complete();
+      this[_ops] = null;
+    }
+    close() {
+      if (dart.test(this.closed)) {
+        return;
+      }
+      if (dart.test(this.nextRunning)) {
+        return;
+      }
+      this.closed = true;
+      let pointer = this[_pointer]();
+      if (pointer == null) {
+        this[_cleanup]();
+      } else {
+        io._IOService._dispatch(io._DIRECTORY_LIST_STOP, JSArrayOfint().of([pointer])).whenComplete(dart.bind(this, _cleanup));
+      }
+    }
+    error(message) {
+      let errorType = dart.dindex(dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_ERROR), io._ERROR_RESPONSE_ERROR_TYPE);
+      if (dart.equals(errorType, io._ILLEGAL_ARGUMENT_RESPONSE)) {
+        this.controller.addError(new core.ArgumentError());
+      } else if (dart.equals(errorType, io._OSERROR_RESPONSE)) {
+        let responseError = dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_ERROR);
+        let err = new io.OSError(core.String._check(dart.dindex(responseError, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(responseError, io._OSERROR_RESPONSE_ERROR_CODE)));
+        let errorPath = dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_PATH);
+        if (errorPath == null) errorPath = this.path;
+        this.controller.addError(new io.FileSystemException("Directory listing failed", core.String._check(errorPath), err));
+      } else {
+        this.controller.addError(new io.FileSystemException("Internal error"));
+      }
+    }
+  };
+  dart.setSignature(io._AsyncDirectoryLister, {
+    constructors: () => ({new: dart.definiteFunctionType(io._AsyncDirectoryLister, [core.String, core.bool, core.bool])}),
+    fields: () => ({
+      path: core.String,
+      recursive: core.bool,
+      followLinks: core.bool,
+      controller: async.StreamController,
+      canceled: core.bool,
+      nextRunning: core.bool,
+      closed: core.bool,
+      [_ops]: io._AsyncDirectoryListerOps,
+      closeCompleter: async.Completer
+    }),
+    getters: () => ({stream: dart.definiteFunctionType(async.Stream, [])}),
+    methods: () => ({
+      [_pointer]: dart.definiteFunctionType(core.int, []),
+      onListen: dart.definiteFunctionType(dart.void, []),
+      onResume: dart.definiteFunctionType(dart.void, []),
+      onCancel: dart.definiteFunctionType(async.Future, []),
+      next: dart.definiteFunctionType(dart.void, []),
+      [_cleanup]: dart.definiteFunctionType(dart.void, []),
+      close: dart.definiteFunctionType(dart.void, []),
+      error: dart.definiteFunctionType(dart.void, [dart.dynamic])
+    }),
+    sfields: () => ({
+      LIST_FILE: core.int,
+      LIST_DIRECTORY: core.int,
+      LIST_LINK: core.int,
+      LIST_ERROR: core.int,
+      LIST_DONE: core.int,
+      RESPONSE_TYPE: core.int,
+      RESPONSE_PATH: core.int,
+      RESPONSE_COMPLETE: core.int,
+      RESPONSE_ERROR: core.int
+    })
+  });
+  io._AsyncDirectoryLister.LIST_FILE = 0;
+  io._AsyncDirectoryLister.LIST_DIRECTORY = 1;
+  io._AsyncDirectoryLister.LIST_LINK = 2;
+  io._AsyncDirectoryLister.LIST_ERROR = 3;
+  io._AsyncDirectoryLister.LIST_DONE = 4;
+  io._AsyncDirectoryLister.RESPONSE_TYPE = 0;
+  io._AsyncDirectoryLister.RESPONSE_PATH = 1;
+  io._AsyncDirectoryLister.RESPONSE_COMPLETE = 1;
+  io._AsyncDirectoryLister.RESPONSE_ERROR = 2;
+  io._EventHandler = class _EventHandler extends core.Object {
+    static _sendData(sender, sendPort, data) {
+      dart.throw(new core.UnsupportedError("EventHandler._sendData"));
+    }
+  };
+  dart.setSignature(io._EventHandler, {
+    statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate.SendPort, core.int])}),
+    names: ['_sendData']
+  });
+  const _mode = Symbol('_mode');
+  io.FileMode = class FileMode extends core.Object {
+    _internal(mode) {
+      this[_mode] = mode;
+    }
+  };
+  dart.defineNamedConstructor(io.FileMode, '_internal');
+  dart.setSignature(io.FileMode, {
+    constructors: () => ({_internal: dart.definiteFunctionType(io.FileMode, [core.int])}),
+    fields: () => ({[_mode]: core.int}),
+    sfields: () => ({
+      READ: io.FileMode,
+      WRITE: io.FileMode,
+      APPEND: io.FileMode,
+      WRITE_ONLY: io.FileMode,
+      WRITE_ONLY_APPEND: io.FileMode
+    })
+  });
+  dart.defineLazy(io.FileMode, {
+    get READ() {
+      return dart.const(new io.FileMode._internal(0));
+    },
+    get WRITE() {
+      return dart.const(new io.FileMode._internal(1));
+    },
+    get APPEND() {
+      return dart.const(new io.FileMode._internal(2));
+    },
+    get WRITE_ONLY() {
+      return dart.const(new io.FileMode._internal(3));
+    },
+    get WRITE_ONLY_APPEND() {
+      return dart.const(new io.FileMode._internal(4));
+    }
+  });
+  io.READ = io.FileMode.READ;
+  io.WRITE = io.FileMode.WRITE;
+  io.APPEND = io.FileMode.APPEND;
+  io.WRITE_ONLY = io.FileMode.WRITE_ONLY;
+  io.WRITE_ONLY_APPEND = io.FileMode.WRITE_ONLY_APPEND;
+  io.FileLock = class FileLock extends core.Object {
+    new(index) {
+      this.index = index;
+    }
+    toString() {
+      return {
+        0: "FileLock.SHARED",
+        1: "FileLock.EXCLUSIVE"
+      }[this.index];
+    }
+  };
+  dart.setSignature(io.FileLock, {
+    fields: () => ({index: core.int})
+  });
+  dart.defineEnumValues(io.FileLock, [
+    'SHARED',
+    'EXCLUSIVE'
+  ]);
+  io.File = class File extends core.Object {
+    static new(path) {
+      return new io._File(path);
+    }
+    static fromUri(uri) {
+      return io.File.new(uri.toFilePath());
+    }
+  };
+  io.File[dart.implements] = () => [io.FileSystemEntity];
+  dart.setSignature(io.File, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.File, [core.String]),
+      fromUri: dart.definiteFunctionType(io.File, [core.Uri])
+    })
+  });
+  io.RandomAccessFile = class RandomAccessFile extends core.Object {};
+  io.FileSystemException = class FileSystemException extends core.Object {
+    new(message, path, osError) {
+      if (message === void 0) message = "";
+      if (path === void 0) path = "";
+      if (osError === void 0) osError = null;
+      this.message = message;
+      this.path = path;
+      this.osError = osError;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write("FileSystemException");
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(dart.str`: ${this.message}`);
+        if (this.path != null) {
+          sb.write(dart.str`, path = '${this.path}'`);
+        }
+        if (this.osError != null) {
+          sb.write(dart.str` (${this.osError})`);
+        }
+      } else if (this.osError != null) {
+        sb.write(dart.str`: ${this.osError}`);
+        if (this.path != null) {
+          sb.write(dart.str`, path = '${this.path}'`);
+        }
+      } else if (this.path != null) {
+        sb.write(dart.str`: ${this.path}`);
+      }
+      return sb.toString();
+    }
+  };
+  io.FileSystemException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.FileSystemException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.FileSystemException, [], [core.String, core.String, io.OSError])}),
+    fields: () => ({
+      message: core.String,
+      path: core.String,
+      osError: io.OSError
+    })
+  });
+  io._BLOCK_SIZE = 64 * 1024;
+  const _closeCompleter = Symbol('_closeCompleter');
+  const _path$ = Symbol('_path');
+  const _position$0 = Symbol('_position');
+  const _end$0 = Symbol('_end');
+  const _controller$0 = Symbol('_controller');
+  const _openedFile = Symbol('_openedFile');
+  const _unsubscribed = Symbol('_unsubscribed');
+  const _readInProgress = Symbol('_readInProgress');
+  const _atEnd = Symbol('_atEnd');
+  const _setupController = Symbol('_setupController');
+  const _start$2 = Symbol('_start');
+  const _readBlock = Symbol('_readBlock');
+  const _closeFile = Symbol('_closeFile');
+  io._FileStream = class _FileStream extends async.Stream$(core.List$(core.int)) {
+    new(path, position, end) {
+      this[_closeCompleter] = async.Completer.new();
+      this[_path$] = path;
+      this[_position$0] = position;
+      this[_end$0] = end;
+      this[_controller$0] = null;
+      this[_openedFile] = null;
+      this[_unsubscribed] = false;
+      this[_readInProgress] = true;
+      this[_closed] = false;
+      this[_atEnd] = false;
+      super.new();
+      if (this[_position$0] == null) this[_position$0] = 0;
+    }
+    forStdin() {
+      this[_closeCompleter] = async.Completer.new();
+      this[_position$0] = 0;
+      this[_controller$0] = null;
+      this[_path$] = null;
+      this[_openedFile] = null;
+      this[_end$0] = null;
+      this[_unsubscribed] = false;
+      this[_readInProgress] = true;
+      this[_closed] = false;
+      this[_atEnd] = false;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      this[_setupController]();
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    [_setupController]() {
+      this[_controller$0] = StreamControllerOfListOfint().new({sync: true, onListen: dart.bind(this, _start$2), onResume: dart.bind(this, _readBlock), onCancel: dart.fn(() => {
+          this[_unsubscribed] = true;
+          return this[_closeFile]();
+        }, VoidToFuture())});
+    }
+    [_closeFile]() {
+      if (dart.test(this[_readInProgress]) || dart.test(this[_closed])) {
+        return this[_closeCompleter].future;
+      }
+      this[_closed] = true;
+      const done = (function() {
+        this[_closeCompleter].complete();
+        this[_controller$0].close();
+      }).bind(this);
+      dart.fn(done, VoidTovoid$());
+      this[_openedFile].close().catchError(dart.bind(this[_controller$0], 'addError')).whenComplete(done);
+      return this[_closeCompleter].future;
+    }
+    [_readBlock]() {
+      if (dart.test(this[_readInProgress])) return;
+      if (dart.test(this[_atEnd])) {
+        this[_closeFile]();
+        return;
+      }
+      this[_readInProgress] = true;
+      let readBytes = io._BLOCK_SIZE;
+      if (this[_end$0] != null) {
+        readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$0]) - dart.notNull(this[_position$0]));
+        if (dart.notNull(readBytes) < 0) {
+          this[_readInProgress] = false;
+          if (!dart.test(this[_unsubscribed])) {
+            this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$0]}`));
+            this[_closeFile]();
+            this[_unsubscribed] = true;
+          }
+          return;
+        }
+      }
+      this[_openedFile].read(readBytes).then(dart.dynamic)(dart.fn(block => {
+        this[_readInProgress] = false;
+        if (dart.test(this[_unsubscribed])) {
+          this[_closeFile]();
+          return;
+        }
+        this[_position$0] = dart.notNull(this[_position$0]) + dart.notNull(block[dartx.length]);
+        if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$0] != null && this[_position$0] == this[_end$0]) {
+          this[_atEnd] = true;
+        }
+        if (!dart.test(this[_atEnd]) && !dart.test(this[_controller$0].isPaused)) {
+          this[_readBlock]();
+        }
+        this[_controller$0].add(block);
+        if (dart.test(this[_atEnd])) {
+          this[_closeFile]();
+        }
+      }, ListOfintToNull())).catchError(dart.fn((e, s) => {
+        if (!dart.test(this[_unsubscribed])) {
+          this[_controller$0].addError(e, core.StackTrace._check(s));
+          this[_closeFile]();
+          this[_unsubscribed] = true;
+        }
+      }, dynamicAnddynamicToNull()));
+    }
+    [_start$2]() {
+      if (dart.notNull(this[_position$0]) < 0) {
+        this[_controller$0].addError(new core.RangeError(dart.str`Bad start position: ${this[_position$0]}`));
+        this[_controller$0].close();
+        this[_closeCompleter].complete();
+        return;
+      }
+      const onReady = (function(file) {
+        this[_openedFile] = file;
+        this[_readInProgress] = false;
+        this[_readBlock]();
+      }).bind(this);
+      dart.fn(onReady, RandomAccessFileTovoid());
+      const onOpenFile = (function(file) {
+        if (dart.notNull(this[_position$0]) > 0) {
+          file.setPosition(this[_position$0]).then(dart.void)(onReady, {onError: dart.fn((e, s) => {
+              this[_controller$0].addError(e, core.StackTrace._check(s));
+              this[_readInProgress] = false;
+              this[_closeFile]();
+            }, dynamicAnddynamicToNull())});
+        } else {
+          onReady(file);
+        }
+      }).bind(this);
+      dart.fn(onOpenFile, RandomAccessFileTovoid());
+      const openFailed = (function(error, stackTrace) {
+        this[_controller$0].addError(error, core.StackTrace._check(stackTrace));
+        this[_controller$0].close();
+        this[_closeCompleter].complete();
+      }).bind(this);
+      dart.fn(openFailed, dynamicAnddynamicTovoid$());
+      if (this[_path$] != null) {
+        io.File.new(this[_path$]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
+      } else {
+        try {
+          onOpenFile(io._File._openStdioSync(0));
+        } catch (e) {
+          let s = dart.stackTrace(e);
+          openFailed(e, s);
+        }
+
+      }
+    }
+  };
+  dart.addSimpleTypeTests(io._FileStream);
+  dart.defineNamedConstructor(io._FileStream, 'forStdin');
+  dart.setSignature(io._FileStream, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._FileStream, [core.String, core.int, core.int]),
+      forStdin: dart.definiteFunctionType(io._FileStream, [])
+    }),
+    fields: () => ({
+      [_controller$0]: StreamControllerOfListOfint(),
+      [_path$]: core.String,
+      [_openedFile]: io.RandomAccessFile,
+      [_position$0]: core.int,
+      [_end$0]: core.int,
+      [_closeCompleter]: async.Completer,
+      [_unsubscribed]: core.bool,
+      [_readInProgress]: core.bool,
+      [_closed]: core.bool,
+      [_atEnd]: core.bool
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      [_setupController]: dart.definiteFunctionType(dart.void, []),
+      [_closeFile]: dart.definiteFunctionType(async.Future, []),
+      [_readBlock]: dart.definiteFunctionType(dart.void, []),
+      [_start$2]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _file = Symbol('_file');
+  const _openFuture = Symbol('_openFuture');
+  io._FileStreamConsumer = class _FileStreamConsumer extends async.StreamConsumer$(core.List$(core.int)) {
+    new(file, mode) {
+      this[_file] = file;
+      this[_openFuture] = null;
+      this[_openFuture] = this[_file].open({mode: mode});
+    }
+    fromStdio(fd) {
+      this[_file] = null;
+      this[_openFuture] = null;
+      dart.assert(1 <= dart.notNull(fd) && dart.notNull(fd) <= 2);
+      this[_openFuture] = FutureOfRandomAccessFile().value(io._File._openStdioSync(fd));
+    }
+    addStream(stream) {
+      let completer = CompleterOfFile().sync();
+      this[_openFuture].then(dart.dynamic)(dart.fn(openedFile => {
+        let _subscription = null;
+        function error(e, stackTrace) {
+          if (stackTrace === void 0) stackTrace = null;
+          dart.dsend(_subscription, 'cancel');
+          openedFile.close();
+          completer.completeError(e, stackTrace);
+        }
+        dart.fn(error, dynamic__Tovoid());
+        _subscription = stream.listen(dart.fn(d => {
+          dart.dsend(_subscription, 'pause');
+          try {
+            openedFile.writeFrom(d, 0, d[dartx.length]).then(dart.dynamic)(dart.fn(_ => dart.dsend(_subscription, 'resume'), RandomAccessFileToFutureOr()), {onError: error});
+          } catch (e) {
+            let stackTrace = dart.stackTrace(e);
+            error(e, stackTrace);
+          }
+
+        }, ListOfintToNull()), {onDone: dart.fn(() => {
+            completer.complete(this[_file]);
+          }, VoidToNull()), onError: error, cancelOnError: true});
+      }, RandomAccessFileToNull())).catchError(dart.bind(completer, 'completeError'));
+      return completer.future;
+    }
+    close() {
+      return this[_openFuture].then(io.File)(dart.fn(openedFile => openedFile.close(), RandomAccessFileToFutureOfRandomAccessFile()));
+    }
+  };
+  dart.addSimpleTypeTests(io._FileStreamConsumer);
+  dart.defineNamedConstructor(io._FileStreamConsumer, 'fromStdio');
+  dart.setSignature(io._FileStreamConsumer, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._FileStreamConsumer, [io.File, io.FileMode]),
+      fromStdio: dart.definiteFunctionType(io._FileStreamConsumer, [core.int])
+    }),
+    fields: () => ({
+      [_file]: io.File,
+      [_openFuture]: FutureOfRandomAccessFile()
+    }),
+    methods: () => ({
+      addStream: dart.definiteFunctionType(async.Future$(io.File), [StreamOfListOfint()]),
+      close: dart.definiteFunctionType(async.Future$(io.File), [])
+    })
+  });
+  const _tryDecode = Symbol('_tryDecode');
+  let const$54;
+  let const$55;
+  io._File = class _File extends io.FileSystemEntity {
+    new(path) {
+      this.path = path;
+      if (!(typeof this.path == 'string')) {
+        dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+      }
+    }
+    exists() {
+      return io._IOService._dispatch(io._FILE_EXISTS, JSArrayOfString().of([this.path])).then(core.bool)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot check existence", this.path));
+        }
+        return FutureOrOfbool()._check(response);
+      }, dynamicToFutureOrOfbool()));
+    }
+    static _exists(path) {
+      dart.throw(new core.UnsupportedError("File._exists"));
+    }
+    existsSync() {
+      let result = io._File._exists(this.path);
+      io._File.throwIfError(result, "Cannot check existence of file", this.path);
+      return core.bool._check(result);
+    }
+    get absolute() {
+      return io.File.new(this[_absolutePath]);
+    }
+    stat() {
+      return io.FileStat.stat(this.path);
+    }
+    statSync() {
+      return io.FileStat.statSync(this.path);
+    }
+    create(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
+      return result.then(dart.dynamic)(dart.fn(_ => io._IOService._dispatch(io._FILE_CREATE, JSArrayOfString().of([this.path])), dynamicToFuture())).then(io._File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot create file", this.path));
+        }
+        return this;
+      }, dynamicTo_File()));
+    }
+    static _create(path) {
+      dart.throw(new core.UnsupportedError("File._create"));
+    }
+    static _createLink(path, target) {
+      dart.throw(new core.UnsupportedError("File._createLink"));
+    }
+    static _linkTarget(path) {
+      dart.throw(new core.UnsupportedError("File._linkTarget"));
+    }
+    createSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        this.parent.createSync({recursive: true});
+      }
+      let result = io._File._create(this.path);
+      io._File.throwIfError(result, "Cannot create file", this.path);
+    }
+    [_delete](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).delete({recursive: true}).then(io._File)(dart.fn(_ => this, FileSystemEntityTo_File()));
+      }
+      return io._IOService._dispatch(io._FILE_DELETE, JSArrayOfString().of([this.path])).then(io._File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot delete file", this.path));
+        }
+        return this;
+      }, dynamicTo_File()));
+    }
+    static _deleteNative(path) {
+      dart.throw(new core.UnsupportedError("File._deleteNative"));
+    }
+    static _deleteLinkNative(path) {
+      dart.throw(new core.UnsupportedError("File._deleteLinkNative"));
+    }
+    [_deleteSync](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).deleteSync({recursive: true});
+      }
+      let result = io._File._deleteNative(this.path);
+      io._File.throwIfError(result, "Cannot delete file", this.path);
+    }
+    rename(newPath) {
+      return io._IOService._dispatch(io._FILE_RENAME, JSArrayOfString().of([this.path, newPath])).then(io.File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, dart.str`Cannot rename file to '${newPath}'`, this.path));
+        }
+        return io.File.new(newPath);
+      }, dynamicToFile()));
+    }
+    static _rename(oldPath, newPath) {
+      dart.throw(new core.UnsupportedError("File._rename"));
+    }
+    static _renameLink(oldPath, newPath) {
+      dart.throw(new core.UnsupportedError("File._renameLink"));
+    }
+    renameSync(newPath) {
+      let result = io._File._rename(this.path, newPath);
+      io._File.throwIfError(result, dart.str`Cannot rename file to '${newPath}'`, this.path);
+      return io.File.new(newPath);
+    }
+    copy(newPath) {
+      return io._IOService._dispatch(io._FILE_COPY, JSArrayOfString().of([this.path, newPath])).then(io.File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, dart.str`Cannot copy file to '${newPath}'`, this.path));
+        }
+        return io.File.new(newPath);
+      }, dynamicToFile()));
+    }
+    static _copy(oldPath, newPath) {
+      dart.throw(new core.UnsupportedError("File._copy"));
+    }
+    copySync(newPath) {
+      let result = io._File._copy(this.path, newPath);
+      io._File.throwIfError(result, dart.str`Cannot copy file to '${newPath}'`, this.path);
+      return io.File.new(newPath);
+    }
+    open(opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.READ;
+      if (!dart.equals(mode, io.FileMode.READ) && !dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+        return FutureOfRandomAccessFile().error(new core.ArgumentError('Invalid file mode for this operation'));
+      }
+      return io._IOService._dispatch(io._FILE_OPEN, JSArrayOfObject().of([this.path, mode[_mode]])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot open file", this.path));
+        }
+        return new io._RandomAccessFile(core.int._check(response), this.path);
+      }, dynamicTo_RandomAccessFile()));
+    }
+    length() {
+      return io._IOService._dispatch(io._FILE_LENGTH_FROM_PATH, JSArrayOfString().of([this.path])).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot retrieve length of file", this.path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    static _lengthFromPath(path) {
+      dart.throw(new core.UnsupportedError("File._lengthFromPath"));
+    }
+    lengthSync() {
+      let result = io._File._lengthFromPath(this.path);
+      io._File.throwIfError(result, "Cannot retrieve length of file", this.path);
+      return core.int._check(result);
+    }
+    lastModified() {
+      return io._IOService._dispatch(io._FILE_LAST_MODIFIED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot retrieve modification time", this.path));
+        }
+        return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(response));
+      }, dynamicToDateTime()));
+    }
+    static _lastModified(path) {
+      dart.throw(new core.UnsupportedError("File._lastModified"));
+    }
+    lastModifiedSync() {
+      let ms = io._File._lastModified(this.path);
+      io._File.throwIfError(ms, "Cannot retrieve modification time", this.path);
+      return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
+    }
+    static _open(path, mode) {
+      dart.throw(new core.UnsupportedError("File._open"));
+    }
+    openSync(opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.READ;
+      if (!dart.equals(mode, io.FileMode.READ) && !dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+        dart.throw(new core.ArgumentError('Invalid file mode for this operation'));
+      }
+      let id = io._File._open(this.path, mode[_mode]);
+      io._File.throwIfError(id, "Cannot open file", this.path);
+      return new io._RandomAccessFile(core.int._check(id), this.path);
+    }
+    static _openStdio(fd) {
+      dart.throw(new core.UnsupportedError("File._openStdio"));
+    }
+    static _openStdioSync(fd) {
+      let id = io._File._openStdio(fd);
+      if (id == 0) {
+        dart.throw(new io.FileSystemException(dart.str`Cannot open stdio file for: ${fd}`));
+      }
+      return new io._RandomAccessFile(id, "");
+    }
+    openRead(start, end) {
+      if (start === void 0) start = null;
+      if (end === void 0) end = null;
+      return new io._FileStream(this.path, start, end);
+    }
+    openWrite(opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      if (!dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+        dart.throw(new core.ArgumentError('Invalid file mode for this operation'));
+      }
+      let consumer = new io._FileStreamConsumer(this, mode);
+      return io.IOSink.new(consumer, {encoding: encoding});
+    }
+    readAsBytes() {
+      function readDataChunked(file) {
+        let builder = io.BytesBuilder.new({copy: false});
+        let completer = async.Completer.new();
+        function read() {
+          dart.dsend(dart.dsend(file, 'read', io._BLOCK_SIZE), 'then', dart.fn(data => {
+            if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) {
+              builder.add(ListOfint()._check(data));
+              read();
+            } else {
+              completer.complete(builder.takeBytes());
+            }
+          }, dynamicToNull$()), {onError: dart.bind(completer, 'completeError')});
+        }
+        dart.fn(read, VoidTovoid$());
+        read();
+        return FutureOfListOfint()._check(completer.future);
+      }
+      dart.fn(readDataChunked, dynamicToFutureOfListOfint());
+      return this.open().then(ListOfint())(dart.fn(file => file.length().then(ListOfint())(dart.fn(length => {
+        if (length == 0) {
+          return readDataChunked(file);
+        }
+        return file.read(length);
+      }, intToFutureOfListOfint())).whenComplete(dart.bind(file, 'close')), RandomAccessFileToFutureOfListOfint()));
+    }
+    readAsBytesSync() {
+      let opened = this.openSync();
+      try {
+        let data = null;
+        let length = opened.lengthSync();
+        if (length == 0) {
+          let builder = io.BytesBuilder.new({copy: false});
+          do {
+            data = opened.readSync(io._BLOCK_SIZE);
+            if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) builder.add(ListOfint()._check(data));
+          } while (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0)));
+          data = builder.takeBytes();
+        } else {
+          data = opened.readSync(length);
+        }
+        return ListOfint()._check(data);
+      } finally {
+        opened.closeSync();
+      }
+    }
+    [_tryDecode](bytes, encoding) {
+      try {
+        return encoding.decode(bytes);
+      } catch (_) {
+        dart.throw(new io.FileSystemException(dart.str`Failed to decode data using encoding '${encoding.name}'`, this.path));
+      }
+
+    }
+    readAsString(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return this.readAsBytes().then(core.String)(dart.fn(bytes => this[_tryDecode](bytes, encoding), ListOfintToString()));
+    }
+    readAsStringSync(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return this[_tryDecode](this.readAsBytesSync(), encoding);
+    }
+    readAsLines(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$54 || (const$54 = dart.const(new convert.LineSplitter())), 'convert'));
+    }
+    readAsLinesSync(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return (const$55 || (const$55 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
+    }
+    writeAsBytes(bytes, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      return this.open({mode: mode}).then(io.File)(dart.fn(file => file.writeFrom(bytes, 0, bytes[dartx.length]).then(dart.dynamic)(dart.fn(_ => {
+        if (dart.test(flush)) return file.flush().then(io._File)(dart.fn(_ => this, RandomAccessFileTo_File()));
+        return this;
+      }, RandomAccessFileToObject())).whenComplete(dart.bind(file, 'close')), RandomAccessFileToFutureOrOfFile()));
+    }
+    writeAsBytesSync(bytes, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      let opened = this.openSync({mode: mode});
+      try {
+        opened.writeFromSync(bytes, 0, bytes[dartx.length]);
+        if (dart.test(flush)) opened.flushSync();
+      } finally {
+        opened.closeSync();
+      }
+    }
+    writeAsString(contents, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      try {
+        return this.writeAsBytes(encoding.encode(contents), {mode: mode, flush: flush});
+      } catch (e) {
+        return FutureOfFile().error(e);
+      }
+
+    }
+    writeAsStringSync(contents, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      this.writeAsBytesSync(encoding.encode(contents), {mode: mode, flush: flush});
+    }
+    toString() {
+      return dart.str`File: '${this.path}'`;
+    }
+    static throwIfError(result, msg, path) {
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException(msg, path, result));
+      }
+    }
+  };
+  io._File[dart.implements] = () => [io.File];
+  dart.setSignature(io._File, {
+    constructors: () => ({new: dart.definiteFunctionType(io._File, [core.String])}),
+    fields: () => ({path: core.String}),
+    getters: () => ({absolute: dart.definiteFunctionType(io.File, [])}),
+    methods: () => ({
+      exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+      existsSync: dart.definiteFunctionType(core.bool, []),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+      statSync: dart.definiteFunctionType(io.FileStat, []),
+      create: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
+      createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      [_delete]: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
+      [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      rename: dart.definiteFunctionType(async.Future$(io.File), [core.String]),
+      renameSync: dart.definiteFunctionType(io.File, [core.String]),
+      copy: dart.definiteFunctionType(async.Future$(io.File), [core.String]),
+      copySync: dart.definiteFunctionType(io.File, [core.String]),
+      open: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], {mode: io.FileMode}),
+      length: dart.definiteFunctionType(async.Future$(core.int), []),
+      lengthSync: dart.definiteFunctionType(core.int, []),
+      lastModified: dart.definiteFunctionType(async.Future$(core.DateTime), []),
+      lastModifiedSync: dart.definiteFunctionType(core.DateTime, []),
+      openSync: dart.definiteFunctionType(io.RandomAccessFile, [], {mode: io.FileMode}),
+      openRead: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [], [core.int, core.int]),
+      openWrite: dart.definiteFunctionType(io.IOSink, [], {mode: io.FileMode, encoding: convert.Encoding}),
+      readAsBytes: dart.definiteFunctionType(async.Future$(core.List$(core.int)), []),
+      readAsBytesSync: dart.definiteFunctionType(core.List$(core.int), []),
+      [_tryDecode]: dart.definiteFunctionType(core.String, [ListOfint(), convert.Encoding]),
+      readAsString: dart.definiteFunctionType(async.Future$(core.String), [], {encoding: convert.Encoding}),
+      readAsStringSync: dart.definiteFunctionType(core.String, [], {encoding: convert.Encoding}),
+      readAsLines: dart.definiteFunctionType(async.Future$(core.List$(core.String)), [], {encoding: convert.Encoding}),
+      readAsLinesSync: dart.definiteFunctionType(core.List$(core.String), [], {encoding: convert.Encoding}),
+      writeAsBytes: dart.definiteFunctionType(async.Future$(io.File), [ListOfint()], {mode: io.FileMode, flush: core.bool}),
+      writeAsBytesSync: dart.definiteFunctionType(dart.void, [ListOfint()], {mode: io.FileMode, flush: core.bool}),
+      writeAsString: dart.definiteFunctionType(async.Future$(io.File), [core.String], {mode: io.FileMode, encoding: convert.Encoding, flush: core.bool}),
+      writeAsStringSync: dart.definiteFunctionType(dart.void, [core.String], {mode: io.FileMode, encoding: convert.Encoding, flush: core.bool})
+    }),
+    statics: () => ({
+      _exists: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _create: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _createLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _linkTarget: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _deleteNative: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _deleteLinkNative: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _rename: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _renameLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _copy: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _lengthFromPath: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _lastModified: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _open: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
+      _openStdio: dart.definiteFunctionType(core.int, [core.int]),
+      _openStdioSync: dart.definiteFunctionType(io.RandomAccessFile, [core.int]),
+      throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String, core.String])
+    }),
+    names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
+  });
+  io._RandomAccessFileOps = class _RandomAccessFileOps extends core.Object {
+    static new(pointer) {
+      dart.throw(new core.UnsupportedError("RandomAccessFile"));
+    }
+  };
+  dart.setSignature(io._RandomAccessFileOps, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RandomAccessFileOps, [core.int])})
+  });
+  const _asyncDispatched = Symbol('_asyncDispatched');
+  const _fileService = Symbol('_fileService');
+  const _resourceInfo = Symbol('_resourceInfo');
+  const _maybeConnectHandler = Symbol('_maybeConnectHandler');
+  const _maybePerformCleanup = Symbol('_maybePerformCleanup');
+  const _dispatch = Symbol('_dispatch');
+  const _checkAvailable = Symbol('_checkAvailable');
+  io._RandomAccessFile = class _RandomAccessFile extends core.Object {
+    new(pointer, path) {
+      this.path = path;
+      this[_asyncDispatched] = false;
+      this[_fileService] = null;
+      this[_resourceInfo] = null;
+      this[_ops] = null;
+      this.closed = false;
+      this[_ops] = io._RandomAccessFileOps.new(pointer);
+      this[_resourceInfo] = new io._FileResourceInfo(this);
+      this[_maybeConnectHandler]();
+    }
+    [_maybePerformCleanup]() {
+      if (dart.test(this.closed)) {
+        io._FileResourceInfo.FileClosed(this[_resourceInfo]);
+      }
+    }
+    [_maybeConnectHandler]() {
+      if (!dart.test(io._RandomAccessFile._connectedResourceHandler)) {
+        developer.registerExtension('ext.dart.io.getOpenFiles', io._FileResourceInfo.getOpenFiles);
+        developer.registerExtension('ext.dart.io.getFileByID', io._FileResourceInfo.getFileInfoMapByID);
+        io._RandomAccessFile._connectedResourceHandler = true;
+      }
+    }
+    close() {
+      return this[_dispatch](io._FILE_CLOSE, [null], {markClosed: true}).then(io._RandomAccessFile)(dart.fn(result => {
+        if (!dart.equals(result, -1)) {
+          this.closed = dart.test(this.closed) || dart.equals(result, 0);
+          this[_maybePerformCleanup]();
+          return this;
+        } else {
+          dart.throw(new io.FileSystemException("Cannot close file", this.path));
+        }
+      }, dynamicTo_RandomAccessFile()));
+    }
+    closeSync() {
+      this[_checkAvailable]();
+      let id = this[_ops].close();
+      if (id == -1) {
+        dart.throw(new io.FileSystemException("Cannot close file", this.path));
+      }
+      this.closed = dart.test(this.closed) || id == 0;
+      this[_maybePerformCleanup]();
+    }
+    readByte() {
+      return this[_dispatch](io._FILE_READ_BYTE, [null]).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "readByte failed", this.path));
+        }
+        this[_resourceInfo].addRead(1);
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    readByteSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].readByte();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("readByte failed", this.path, result));
+      }
+      this[_resourceInfo].addRead(1);
+      return core.int._check(result);
+    }
+    read(bytes) {
+      if (!(typeof bytes == 'number')) {
+        dart.throw(new core.ArgumentError(bytes));
+      }
+      return this[_dispatch](io._FILE_READ, JSArrayOfint().of([null, bytes])).then(ListOfint())(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "read failed", this.path));
+        }
+        this[_resourceInfo].addRead(core.int._check(dart.dload(dart.dindex(response, 1), 'length')));
+        return FutureOrOfListOfint()._check(dart.dindex(response, 1));
+      }, dynamicToFutureOrOfListOfint()));
+    }
+    readSync(bytes) {
+      this[_checkAvailable]();
+      if (!(typeof bytes == 'number')) {
+        dart.throw(new core.ArgumentError(bytes));
+      }
+      let result = this[_ops].read(bytes);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("readSync failed", this.path, result));
+      }
+      this[_resourceInfo].addRead(core.int._check(dart.dload(result, 'length')));
+      return ListOfint()._check(result);
+    }
+    readInto(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return FutureOfint().value(0);
+      }
+      let length = dart.notNull(end) - dart.notNull(start);
+      return this[_dispatch](io._FILE_READ_INTO, JSArrayOfint().of([null, length])).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "readInto failed", this.path));
+        }
+        let read = dart.dindex(response, 1);
+        let data = dart.dindex(response, 2);
+        buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), IterableOfint()._check(data));
+        this[_resourceInfo].addRead(core.int._check(read));
+        return FutureOrOfint()._check(read);
+      }, dynamicToFutureOrOfint()));
+    }
+    readIntoSync(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      this[_checkAvailable]();
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return 0;
+      }
+      let result = this[_ops].readInto(buffer, start, end);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("readInto failed", this.path, result));
+      }
+      this[_resourceInfo].addRead(core.int._check(result));
+      return core.int._check(result);
+    }
+    writeByte(value) {
+      if (!(typeof value == 'number')) {
+        dart.throw(new core.ArgumentError(value));
+      }
+      return this[_dispatch](io._FILE_WRITE_BYTE, JSArrayOfint().of([null, value])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "writeByte failed", this.path));
+        }
+        this[_resourceInfo].addWrite(1);
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    writeByteSync(value) {
+      this[_checkAvailable]();
+      if (!(typeof value == 'number')) {
+        dart.throw(new core.ArgumentError(value));
+      }
+      let result = this[_ops].writeByte(value);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("writeByte failed", this.path, result));
+      }
+      this[_resourceInfo].addWrite(1);
+      return core.int._check(result);
+    }
+    writeFrom(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError("Invalid arguments to writeFrom"));
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return FutureOfRandomAccessFile().value(this);
+      }
+      let result = null;
+      try {
+        result = io._ensureFastAndSerializableByteData(buffer, start, end);
+      } catch (e) {
+        return FutureOfRandomAccessFile().error(e);
+      }
+
+      let request = core.List.new(4);
+      request[dartx._set](0, null);
+      request[dartx._set](1, result.buffer);
+      request[dartx._set](2, result.start);
+      request[dartx._set](3, dart.notNull(end) - (dart.notNull(start) - dart.notNull(result.start)));
+      return this[_dispatch](io._FILE_WRITE_FROM, request).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "writeFrom failed", this.path));
+        }
+        this[_resourceInfo].addWrite(dart.notNull(end) - (dart.notNull(start) - dart.notNull(result.start)));
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    writeFromSync(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      this[_checkAvailable]();
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError("Invalid arguments to writeFromSync"));
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return;
+      }
+      let bufferAndStart = io._ensureFastAndSerializableByteData(buffer, start, end);
+      let result = this[_ops].writeFrom(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("writeFrom failed", this.path, result));
+      }
+      this[_resourceInfo].addWrite(dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+    }
+    writeString(string, opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      if (!convert.Encoding.is(encoding)) {
+        dart.throw(new core.ArgumentError(encoding));
+      }
+      let data = encoding.encode(string);
+      return this.writeFrom(data, 0, data[dartx.length]);
+    }
+    writeStringSync(string, opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      if (!convert.Encoding.is(encoding)) {
+        dart.throw(new core.ArgumentError(encoding));
+      }
+      let data = encoding.encode(string);
+      this.writeFromSync(data, 0, data[dartx.length]);
+    }
+    position() {
+      return this[_dispatch](io._FILE_POSITION, [null]).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "position failed", this.path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    positionSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].position();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("position failed", this.path, result));
+      }
+      return core.int._check(result);
+    }
+    setPosition(position) {
+      return this[_dispatch](io._FILE_SET_POSITION, JSArrayOfint().of([null, position])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "setPosition failed", this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    setPositionSync(position) {
+      this[_checkAvailable]();
+      let result = this[_ops].setPosition(position);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("setPosition failed", this.path, result));
+      }
+    }
+    truncate(length) {
+      return this[_dispatch](io._FILE_TRUNCATE, JSArrayOfint().of([null, length])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "truncate failed", this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    truncateSync(length) {
+      this[_checkAvailable]();
+      let result = this[_ops].truncate(length);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("truncate failed", this.path, result));
+      }
+    }
+    length() {
+      return this[_dispatch](io._FILE_LENGTH, [null]).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "length failed", this.path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    lengthSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].length();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("length failed", this.path, result));
+      }
+      return core.int._check(result);
+    }
+    flush() {
+      return this[_dispatch](io._FILE_FLUSH, [null]).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "flush failed", this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    flushSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].flush();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("flush failed", this.path, result));
+      }
+    }
+    lock(mode, start, end) {
+      if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      if (!io.FileLock.is(mode) || !(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
+        dart.throw(new core.ArgumentError());
+      }
+      let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+      return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, lock, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, 'lock failed', this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    unlock(start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      if (!(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (start == end) {
+        dart.throw(new core.ArgumentError());
+      }
+      return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, io._RandomAccessFile.LOCK_UNLOCK, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, 'unlock failed', this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    lockSync(mode, start, end) {
+      if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      this[_checkAvailable]();
+      if (!io.FileLock.is(mode) || !(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
+        dart.throw(new core.ArgumentError());
+      }
+      let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+      let result = this[_ops].lock(lock, start, end);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException('lock failed', this.path, result));
+      }
+    }
+    unlockSync(start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      this[_checkAvailable]();
+      if (!(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (start == end) {
+        dart.throw(new core.ArgumentError());
+      }
+      let result = this[_ops].lock(io._RandomAccessFile.LOCK_UNLOCK, start, end);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException('unlock failed', this.path, result));
+      }
+    }
+    [_pointer]() {
+      return this[_ops].getPointer();
+    }
+    [_dispatch](request, data, opts) {
+      let markClosed = opts && 'markClosed' in opts ? opts.markClosed : false;
+      if (dart.test(this.closed)) {
+        return async.Future.error(new io.FileSystemException("File closed", this.path));
+      }
+      if (dart.test(this[_asyncDispatched])) {
+        let msg = "An async operation is currently pending";
+        return async.Future.error(new io.FileSystemException(msg, this.path));
+      }
+      if (dart.test(markClosed)) {
+        this.closed = true;
+      }
+      this[_asyncDispatched] = true;
+      data[dartx._set](0, this[_pointer]());
+      return io._IOService._dispatch(request, data).whenComplete(dart.fn(() => {
+        this[_asyncDispatched] = false;
+      }, VoidToNull()));
+    }
+    [_checkAvailable]() {
+      if (dart.test(this[_asyncDispatched])) {
+        dart.throw(new io.FileSystemException("An async operation is currently pending", this.path));
+      }
+      if (dart.test(this.closed)) {
+        dart.throw(new io.FileSystemException("File closed", this.path));
+      }
+    }
+  };
+  io._RandomAccessFile[dart.implements] = () => [io.RandomAccessFile];
+  dart.setSignature(io._RandomAccessFile, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RandomAccessFile, [core.int, core.String])}),
+    fields: () => ({
+      path: core.String,
+      [_asyncDispatched]: core.bool,
+      [_fileService]: isolate.SendPort,
+      [_resourceInfo]: io._FileResourceInfo,
+      [_ops]: io._RandomAccessFileOps,
+      closed: core.bool
+    }),
+    methods: () => ({
+      [_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
+      [_maybeConnectHandler]: dart.definiteFunctionType(dart.dynamic, []),
+      close: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
+      closeSync: dart.definiteFunctionType(dart.void, []),
+      readByte: dart.definiteFunctionType(async.Future$(core.int), []),
+      readByteSync: dart.definiteFunctionType(core.int, []),
+      read: dart.definiteFunctionType(async.Future$(core.List$(core.int)), [core.int]),
+      readSync: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+      readInto: dart.definiteFunctionType(async.Future$(core.int), [ListOfint()], [core.int, core.int]),
+      readIntoSync: dart.definiteFunctionType(core.int, [ListOfint()], [core.int, core.int]),
+      writeByte: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+      writeByteSync: dart.definiteFunctionType(core.int, [core.int]),
+      writeFrom: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [ListOfint()], [core.int, core.int]),
+      writeFromSync: dart.definiteFunctionType(dart.void, [ListOfint()], [core.int, core.int]),
+      writeString: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.String], {encoding: convert.Encoding}),
+      writeStringSync: dart.definiteFunctionType(dart.void, [core.String], {encoding: convert.Encoding}),
+      position: dart.definiteFunctionType(async.Future$(core.int), []),
+      positionSync: dart.definiteFunctionType(core.int, []),
+      setPosition: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+      setPositionSync: dart.definiteFunctionType(dart.void, [core.int]),
+      truncate: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+      truncateSync: dart.definiteFunctionType(dart.void, [core.int]),
+      length: dart.definiteFunctionType(async.Future$(core.int), []),
+      lengthSync: dart.definiteFunctionType(core.int, []),
+      flush: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
+      flushSync: dart.definiteFunctionType(dart.void, []),
+      lock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [io.FileLock, core.int, core.int]),
+      unlock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [core.int, core.int]),
+      lockSync: dart.definiteFunctionType(dart.void, [], [io.FileLock, core.int, core.int]),
+      unlockSync: dart.definiteFunctionType(dart.void, [], [core.int, core.int]),
+      [_pointer]: dart.definiteFunctionType(core.int, []),
+      [_dispatch]: dart.definiteFunctionType(async.Future, [core.int, core.List], {markClosed: core.bool}),
+      [_checkAvailable]: dart.definiteFunctionType(dart.void, [])
+    }),
+    sfields: () => ({
+      _connectedResourceHandler: core.bool,
+      LOCK_UNLOCK: core.int,
+      LOCK_SHARED: core.int,
+      LOCK_EXCLUSIVE: core.int
+    })
+  });
+  io._RandomAccessFile._connectedResourceHandler = false;
+  io._RandomAccessFile.LOCK_UNLOCK = 0;
+  io._RandomAccessFile.LOCK_SHARED = 1;
+  io._RandomAccessFile.LOCK_EXCLUSIVE = 2;
+  let const$56;
+  io.FileSystemEntityType = class FileSystemEntityType extends core.Object {
+    _internal(type) {
+      this[_type] = type;
+    }
+    static _lookup(type) {
+      return io.FileSystemEntityType._typeList[dartx._get](type);
+    }
+    toString() {
+      return (const$56 || (const$56 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemEntityType, '_internal');
+  dart.setSignature(io.FileSystemEntityType, {
+    constructors: () => ({_internal: dart.definiteFunctionType(io.FileSystemEntityType, [core.int])}),
+    fields: () => ({[_type]: core.int}),
+    sfields: () => ({
+      FILE: io.FileSystemEntityType,
+      DIRECTORY: io.FileSystemEntityType,
+      LINK: io.FileSystemEntityType,
+      NOT_FOUND: io.FileSystemEntityType,
+      _typeList: ListOfFileSystemEntityType()
+    }),
+    statics: () => ({_lookup: dart.definiteFunctionType(io.FileSystemEntityType, [core.int])}),
+    names: ['_lookup']
+  });
+  dart.defineLazy(io.FileSystemEntityType, {
+    get FILE() {
+      return dart.const(new io.FileSystemEntityType._internal(0));
+    },
+    get DIRECTORY() {
+      return dart.const(new io.FileSystemEntityType._internal(1));
+    },
+    get LINK() {
+      return dart.const(new io.FileSystemEntityType._internal(2));
+    },
+    get NOT_FOUND() {
+      return dart.const(new io.FileSystemEntityType._internal(3));
+    },
+    get _typeList() {
+      return dart.constList([io.FileSystemEntityType.FILE, io.FileSystemEntityType.DIRECTORY, io.FileSystemEntityType.LINK, io.FileSystemEntityType.NOT_FOUND], io.FileSystemEntityType);
+    }
+  });
+  let const$57;
+  io.FileStat = class FileStat extends core.Object {
+    _internal(changed, modified, accessed, type, mode, size) {
+      this.changed = changed;
+      this.modified = modified;
+      this.accessed = accessed;
+      this.type = type;
+      this.mode = mode;
+      this.size = size;
+    }
+    _internalNotFound() {
+      this.changed = null;
+      this.modified = null;
+      this.accessed = null;
+      this.type = io.FileSystemEntityType.NOT_FOUND;
+      this.mode = 0;
+      this.size = -1;
+    }
+    static _statSync(path) {
+      dart.throw(new core.UnsupportedError("FileStat.stat"));
+    }
+    static statSync(path) {
+      if (dart.test(io.Platform.isWindows)) {
+        path = io.FileSystemEntity._trimTrailingPathSeparators(path);
+      }
+      let data = io.FileStat._statSync(path);
+      if (io.OSError.is(data)) return io.FileStat._notFound;
+      return new io.FileStat._internal(new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._CHANGED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._MODIFIED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._ACCESSED_TIME))), io.FileSystemEntityType._lookup(core.int._check(dart.dindex(data, io.FileStat._TYPE))), core.int._check(dart.dindex(data, io.FileStat._MODE)), core.int._check(dart.dindex(data, io.FileStat._SIZE)));
+    }
+    static stat(path) {
+      if (dart.test(io.Platform.isWindows)) {
+        path = io.FileSystemEntity._trimTrailingPathSeparators(path);
+      }
+      return io._IOService._dispatch(io._FILE_STAT, JSArrayOfString().of([path])).then(io.FileStat)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          return io.FileStat._notFound;
+        }
+        let data = core.List._check(dart.dindex(response, 1));
+        return new io.FileStat._internal(new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._CHANGED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._MODIFIED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._ACCESSED_TIME))), io.FileSystemEntityType._lookup(core.int._check(data[dartx._get](io.FileStat._TYPE))), core.int._check(data[dartx._get](io.FileStat._MODE)), core.int._check(data[dartx._get](io.FileStat._SIZE)));
+      }, dynamicToFileStat()));
+    }
+    toString() {
+      return dart.str`FileStat: type ${this.type}\n          changed ${this.changed}\n          modified ${this.modified}\n          accessed ${this.accessed}\n          mode ${this.modeString()}\n          size ${this.size}`;
+    }
+    modeString() {
+      let permissions = dart.notNull(this.mode) & 4095;
+      let codes = const$57 || (const$57 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
+      let result = [];
+      if ((permissions & 2048) != 0) result[dartx.add]("(suid) ");
+      if ((permissions & 1024) != 0) result[dartx.add]("(guid) ");
+      if ((permissions & 512) != 0) result[dartx.add]("(sticky) ");
+      result[dartx.add](codes[dartx._get](permissions >> 6 & 7));
+      result[dartx.add](codes[dartx._get](permissions >> 3 & 7));
+      result[dartx.add](codes[dartx._get](permissions & 7));
+      return result[dartx.join]();
+    }
+  };
+  dart.defineNamedConstructor(io.FileStat, '_internal');
+  dart.defineNamedConstructor(io.FileStat, '_internalNotFound');
+  dart.setSignature(io.FileStat, {
+    constructors: () => ({
+      _internal: dart.definiteFunctionType(io.FileStat, [core.DateTime, core.DateTime, core.DateTime, io.FileSystemEntityType, core.int, core.int]),
+      _internalNotFound: dart.definiteFunctionType(io.FileStat, [])
+    }),
+    fields: () => ({
+      changed: core.DateTime,
+      modified: core.DateTime,
+      accessed: core.DateTime,
+      type: io.FileSystemEntityType,
+      mode: core.int,
+      size: core.int
+    }),
+    methods: () => ({modeString: dart.definiteFunctionType(core.String, [])}),
+    sfields: () => ({
+      _TYPE: core.int,
+      _CHANGED_TIME: core.int,
+      _MODIFIED_TIME: core.int,
+      _ACCESSED_TIME: core.int,
+      _MODE: core.int,
+      _SIZE: core.int,
+      _notFound: io.FileStat
+    }),
+    statics: () => ({
+      _statSync: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      statSync: dart.definiteFunctionType(io.FileStat, [core.String]),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), [core.String])
+    }),
+    names: ['_statSync', 'statSync', 'stat']
+  });
+  io.FileStat._TYPE = 0;
+  io.FileStat._CHANGED_TIME = 1;
+  io.FileStat._MODIFIED_TIME = 2;
+  io.FileStat._ACCESSED_TIME = 3;
+  io.FileStat._MODE = 4;
+  io.FileStat._SIZE = 5;
+  dart.defineLazy(io.FileStat, {
+    get _notFound() {
+      return dart.const(new io.FileStat._internalNotFound());
+    }
+  });
+  io.FileSystemEvent = class FileSystemEvent extends core.Object {
+    _(type, path, isDirectory) {
+      this.type = type;
+      this.path = path;
+      this.isDirectory = isDirectory;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemEvent, '_');
+  dart.setSignature(io.FileSystemEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemEvent, [core.int, core.String, core.bool])}),
+    fields: () => ({
+      type: core.int,
+      path: core.String,
+      isDirectory: core.bool
+    }),
+    sfields: () => ({
+      CREATE: core.int,
+      MODIFY: core.int,
+      DELETE: core.int,
+      MOVE: core.int,
+      ALL: core.int,
+      _MODIFY_ATTRIBUTES: core.int,
+      _DELETE_SELF: core.int,
+      _IS_DIR: core.int
+    })
+  });
+  io.FileSystemEvent.CREATE = 1 << 0;
+  io.FileSystemEvent.MODIFY = 1 << 1;
+  io.FileSystemEvent.DELETE = 1 << 2;
+  io.FileSystemEvent.MOVE = 1 << 3;
+  io.FileSystemEvent._MODIFY_ATTRIBUTES = 1 << 4;
+  io.FileSystemEvent._DELETE_SELF = 1 << 5;
+  io.FileSystemEvent._IS_DIR = 1 << 6;
+  dart.defineLazy(io.FileSystemEvent, {
+    get ALL() {
+      return io.FileSystemEvent.CREATE | io.FileSystemEvent.MODIFY | io.FileSystemEvent.DELETE | io.FileSystemEvent.MOVE;
+    }
+  });
+  io.FileSystemCreateEvent = class FileSystemCreateEvent extends io.FileSystemEvent {
+    _(path, isDirectory) {
+      super._(io.FileSystemEvent.CREATE, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      return dart.str`FileSystemCreateEvent('${this.path}')`;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemCreateEvent, '_');
+  dart.setSignature(io.FileSystemCreateEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemCreateEvent, [dart.dynamic, dart.dynamic])})
+  });
+  io.FileSystemModifyEvent = class FileSystemModifyEvent extends io.FileSystemEvent {
+    _(path, isDirectory, contentChanged) {
+      this.contentChanged = contentChanged;
+      super._(io.FileSystemEvent.MODIFY, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      return dart.str`FileSystemModifyEvent('${this.path}', contentChanged=${this.contentChanged})`;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemModifyEvent, '_');
+  dart.setSignature(io.FileSystemModifyEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemModifyEvent, [dart.dynamic, dart.dynamic, core.bool])}),
+    fields: () => ({contentChanged: core.bool})
+  });
+  io.FileSystemDeleteEvent = class FileSystemDeleteEvent extends io.FileSystemEvent {
+    _(path, isDirectory) {
+      super._(io.FileSystemEvent.DELETE, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      return dart.str`FileSystemDeleteEvent('${this.path}')`;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemDeleteEvent, '_');
+  dart.setSignature(io.FileSystemDeleteEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemDeleteEvent, [dart.dynamic, dart.dynamic])})
+  });
+  io.FileSystemMoveEvent = class FileSystemMoveEvent extends io.FileSystemEvent {
+    _(path, isDirectory, destination) {
+      this.destination = destination;
+      super._(io.FileSystemEvent.MOVE, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      let buffer = new core.StringBuffer();
+      buffer.write(dart.str`FileSystemMoveEvent('${this.path}'`);
+      if (this.destination != null) buffer.write(dart.str`, '${this.destination}'`);
+      buffer.write(')');
+      return buffer.toString();
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemMoveEvent, '_');
+  dart.setSignature(io.FileSystemMoveEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemMoveEvent, [dart.dynamic, dart.dynamic, core.String])}),
+    fields: () => ({destination: core.String})
+  });
+  io._FileSystemWatcher = class _FileSystemWatcher extends core.Object {
+    static _watch(path, events, recursive) {
+      dart.throw(new core.UnsupportedError("_FileSystemWatcher.watch"));
+    }
+    static get isSupported() {
+      dart.throw(new core.UnsupportedError("_FileSystemWatcher.isSupported"));
+    }
+  };
+  dart.setSignature(io._FileSystemWatcher, {
+    sgetters: () => ({isSupported: dart.definiteFunctionType(core.bool, [])}),
+    statics: () => ({_watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [core.String, core.int, core.bool])}),
+    names: ['_watch']
+  });
+  io.HttpStatus = class HttpStatus extends core.Object {};
+  dart.setSignature(io.HttpStatus, {
+    sfields: () => ({
+      CONTINUE: core.int,
+      SWITCHING_PROTOCOLS: core.int,
+      OK: core.int,
+      CREATED: core.int,
+      ACCEPTED: core.int,
+      NON_AUTHORITATIVE_INFORMATION: core.int,
+      NO_CONTENT: core.int,
+      RESET_CONTENT: core.int,
+      PARTIAL_CONTENT: core.int,
+      MULTIPLE_CHOICES: core.int,
+      MOVED_PERMANENTLY: core.int,
+      FOUND: core.int,
+      MOVED_TEMPORARILY: core.int,
+      SEE_OTHER: core.int,
+      NOT_MODIFIED: core.int,
+      USE_PROXY: core.int,
+      TEMPORARY_REDIRECT: core.int,
+      BAD_REQUEST: core.int,
+      UNAUTHORIZED: core.int,
+      PAYMENT_REQUIRED: core.int,
+      FORBIDDEN: core.int,
+      NOT_FOUND: core.int,
+      METHOD_NOT_ALLOWED: core.int,
+      NOT_ACCEPTABLE: core.int,
+      PROXY_AUTHENTICATION_REQUIRED: core.int,
+      REQUEST_TIMEOUT: core.int,
+      CONFLICT: core.int,
+      GONE: core.int,
+      LENGTH_REQUIRED: core.int,
+      PRECONDITION_FAILED: core.int,
+      REQUEST_ENTITY_TOO_LARGE: core.int,
+      REQUEST_URI_TOO_LONG: core.int,
+      UNSUPPORTED_MEDIA_TYPE: core.int,
+      REQUESTED_RANGE_NOT_SATISFIABLE: core.int,
+      EXPECTATION_FAILED: core.int,
+      INTERNAL_SERVER_ERROR: core.int,
+      NOT_IMPLEMENTED: core.int,
+      BAD_GATEWAY: core.int,
+      SERVICE_UNAVAILABLE: core.int,
+      GATEWAY_TIMEOUT: core.int,
+      HTTP_VERSION_NOT_SUPPORTED: core.int,
+      NETWORK_CONNECT_TIMEOUT_ERROR: core.int
+    })
+  });
+  io.HttpStatus.CONTINUE = 100;
+  io.HttpStatus.SWITCHING_PROTOCOLS = 101;
+  io.HttpStatus.OK = 200;
+  io.HttpStatus.CREATED = 201;
+  io.HttpStatus.ACCEPTED = 202;
+  io.HttpStatus.NON_AUTHORITATIVE_INFORMATION = 203;
+  io.HttpStatus.NO_CONTENT = 204;
+  io.HttpStatus.RESET_CONTENT = 205;
+  io.HttpStatus.PARTIAL_CONTENT = 206;
+  io.HttpStatus.MULTIPLE_CHOICES = 300;
+  io.HttpStatus.MOVED_PERMANENTLY = 301;
+  io.HttpStatus.FOUND = 302;
+  io.HttpStatus.MOVED_TEMPORARILY = 302;
+  io.HttpStatus.SEE_OTHER = 303;
+  io.HttpStatus.NOT_MODIFIED = 304;
+  io.HttpStatus.USE_PROXY = 305;
+  io.HttpStatus.TEMPORARY_REDIRECT = 307;
+  io.HttpStatus.BAD_REQUEST = 400;
+  io.HttpStatus.UNAUTHORIZED = 401;
+  io.HttpStatus.PAYMENT_REQUIRED = 402;
+  io.HttpStatus.FORBIDDEN = 403;
+  io.HttpStatus.NOT_FOUND = 404;
+  io.HttpStatus.METHOD_NOT_ALLOWED = 405;
+  io.HttpStatus.NOT_ACCEPTABLE = 406;
+  io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED = 407;
+  io.HttpStatus.REQUEST_TIMEOUT = 408;
+  io.HttpStatus.CONFLICT = 409;
+  io.HttpStatus.GONE = 410;
+  io.HttpStatus.LENGTH_REQUIRED = 411;
+  io.HttpStatus.PRECONDITION_FAILED = 412;
+  io.HttpStatus.REQUEST_ENTITY_TOO_LARGE = 413;
+  io.HttpStatus.REQUEST_URI_TOO_LONG = 414;
+  io.HttpStatus.UNSUPPORTED_MEDIA_TYPE = 415;
+  io.HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+  io.HttpStatus.EXPECTATION_FAILED = 417;
+  io.HttpStatus.INTERNAL_SERVER_ERROR = 500;
+  io.HttpStatus.NOT_IMPLEMENTED = 501;
+  io.HttpStatus.BAD_GATEWAY = 502;
+  io.HttpStatus.SERVICE_UNAVAILABLE = 503;
+  io.HttpStatus.GATEWAY_TIMEOUT = 504;
+  io.HttpStatus.HTTP_VERSION_NOT_SUPPORTED = 505;
+  io.HttpStatus.NETWORK_CONNECT_TIMEOUT_ERROR = 599;
+  io.HttpServer = class HttpServer extends core.Object {
+    static bind(address, port, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io._HttpServer.bind(address, port, backlog, v6Only, shared);
+    }
+    static bindSecure(address, port, context, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io._HttpServer.bindSecure(address, port, context, backlog, v6Only, requestClientCertificate, shared);
+    }
+    static listenOn(serverSocket) {
+      return new io._HttpServer.listenOn(serverSocket);
+    }
+  };
+  io.HttpServer[dart.implements] = () => [StreamOfHttpRequest()];
+  dart.setSignature(io.HttpServer, {
+    constructors: () => ({listenOn: dart.definiteFunctionType(io.HttpServer, [io.ServerSocket])}),
+    fields: () => ({
+      serverHeader: core.String,
+      autoCompress: core.bool,
+      idleTimeout: core.Duration
+    }),
+    statics: () => ({
+      bind: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool}),
+      bindSecure: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, shared: core.bool})
+    }),
+    names: ['bind', 'bindSecure']
+  });
+  io.HttpConnectionsInfo = class HttpConnectionsInfo extends core.Object {
+    new() {
+      this.total = 0;
+      this.active = 0;
+      this.idle = 0;
+      this.closing = 0;
+    }
+  };
+  dart.setSignature(io.HttpConnectionsInfo, {
+    fields: () => ({
+      total: core.int,
+      active: core.int,
+      idle: core.int,
+      closing: core.int
+    })
+  });
+  io.HttpHeaders = class HttpHeaders extends core.Object {
+    new() {
+      this.date = null;
+      this.expires = null;
+      this.ifModifiedSince = null;
+      this.host = null;
+      this.port = null;
+      this.contentType = null;
+      this.contentLength = null;
+      this.persistentConnection = null;
+      this.chunkedTransferEncoding = null;
+    }
+  };
+  dart.setSignature(io.HttpHeaders, {
+    fields: () => ({
+      date: core.DateTime,
+      expires: core.DateTime,
+      ifModifiedSince: core.DateTime,
+      host: core.String,
+      port: core.int,
+      contentType: io.ContentType,
+      contentLength: core.int,
+      persistentConnection: core.bool,
+      chunkedTransferEncoding: core.bool
+    }),
+    sfields: () => ({
+      ACCEPT: core.String,
+      ACCEPT_CHARSET: core.String,
+      ACCEPT_ENCODING: core.String,
+      ACCEPT_LANGUAGE: core.String,
+      ACCEPT_RANGES: core.String,
+      AGE: core.String,
+      ALLOW: core.String,
+      AUTHORIZATION: core.String,
+      CACHE_CONTROL: core.String,
+      CONNECTION: core.String,
+      CONTENT_ENCODING: core.String,
+      CONTENT_LANGUAGE: core.String,
+      CONTENT_LENGTH: core.String,
+      CONTENT_LOCATION: core.String,
+      CONTENT_MD5: core.String,
+      CONTENT_RANGE: core.String,
+      CONTENT_TYPE: core.String,
+      DATE: core.String,
+      ETAG: core.String,
+      EXPECT: core.String,
+      EXPIRES: core.String,
+      FROM: core.String,
+      HOST: core.String,
+      IF_MATCH: core.String,
+      IF_MODIFIED_SINCE: core.String,
+      IF_NONE_MATCH: core.String,
+      IF_RANGE: core.String,
+      IF_UNMODIFIED_SINCE: core.String,
+      LAST_MODIFIED: core.String,
+      LOCATION: core.String,
+      MAX_FORWARDS: core.String,
+      PRAGMA: core.String,
+      PROXY_AUTHENTICATE: core.String,
+      PROXY_AUTHORIZATION: core.String,
+      RANGE: core.String,
+      REFERER: core.String,
+      RETRY_AFTER: core.String,
+      SERVER: core.String,
+      TE: core.String,
+      TRAILER: core.String,
+      TRANSFER_ENCODING: core.String,
+      UPGRADE: core.String,
+      USER_AGENT: core.String,
+      VARY: core.String,
+      VIA: core.String,
+      WARNING: core.String,
+      WWW_AUTHENTICATE: core.String,
+      COOKIE: core.String,
+      SET_COOKIE: core.String,
+      GENERAL_HEADERS: ListOfString(),
+      ENTITY_HEADERS: ListOfString(),
+      RESPONSE_HEADERS: ListOfString(),
+      REQUEST_HEADERS: ListOfString()
+    })
+  });
+  io.HttpHeaders.ACCEPT = "accept";
+  io.HttpHeaders.ACCEPT_CHARSET = "accept-charset";
+  io.HttpHeaders.ACCEPT_ENCODING = "accept-encoding";
+  io.HttpHeaders.ACCEPT_LANGUAGE = "accept-language";
+  io.HttpHeaders.ACCEPT_RANGES = "accept-ranges";
+  io.HttpHeaders.AGE = "age";
+  io.HttpHeaders.ALLOW = "allow";
+  io.HttpHeaders.AUTHORIZATION = "authorization";
+  io.HttpHeaders.CACHE_CONTROL = "cache-control";
+  io.HttpHeaders.CONNECTION = "connection";
+  io.HttpHeaders.CONTENT_ENCODING = "content-encoding";
+  io.HttpHeaders.CONTENT_LANGUAGE = "content-language";
+  io.HttpHeaders.CONTENT_LENGTH = "content-length";
+  io.HttpHeaders.CONTENT_LOCATION = "content-location";
+  io.HttpHeaders.CONTENT_MD5 = "content-md5";
+  io.HttpHeaders.CONTENT_RANGE = "content-range";
+  io.HttpHeaders.CONTENT_TYPE = "content-type";
+  io.HttpHeaders.DATE = "date";
+  io.HttpHeaders.ETAG = "etag";
+  io.HttpHeaders.EXPECT = "expect";
+  io.HttpHeaders.EXPIRES = "expires";
+  io.HttpHeaders.FROM = "from";
+  io.HttpHeaders.HOST = "host";
+  io.HttpHeaders.IF_MATCH = "if-match";
+  io.HttpHeaders.IF_MODIFIED_SINCE = "if-modified-since";
+  io.HttpHeaders.IF_NONE_MATCH = "if-none-match";
+  io.HttpHeaders.IF_RANGE = "if-range";
+  io.HttpHeaders.IF_UNMODIFIED_SINCE = "if-unmodified-since";
+  io.HttpHeaders.LAST_MODIFIED = "last-modified";
+  io.HttpHeaders.LOCATION = "location";
+  io.HttpHeaders.MAX_FORWARDS = "max-forwards";
+  io.HttpHeaders.PRAGMA = "pragma";
+  io.HttpHeaders.PROXY_AUTHENTICATE = "proxy-authenticate";
+  io.HttpHeaders.PROXY_AUTHORIZATION = "proxy-authorization";
+  io.HttpHeaders.RANGE = "range";
+  io.HttpHeaders.REFERER = "referer";
+  io.HttpHeaders.RETRY_AFTER = "retry-after";
+  io.HttpHeaders.SERVER = "server";
+  io.HttpHeaders.TE = "te";
+  io.HttpHeaders.TRAILER = "trailer";
+  io.HttpHeaders.TRANSFER_ENCODING = "transfer-encoding";
+  io.HttpHeaders.UPGRADE = "upgrade";
+  io.HttpHeaders.USER_AGENT = "user-agent";
+  io.HttpHeaders.VARY = "vary";
+  io.HttpHeaders.VIA = "via";
+  io.HttpHeaders.WARNING = "warning";
+  io.HttpHeaders.WWW_AUTHENTICATE = "www-authenticate";
+  io.HttpHeaders.COOKIE = "cookie";
+  io.HttpHeaders.SET_COOKIE = "set-cookie";
+  dart.defineLazy(io.HttpHeaders, {
+    get GENERAL_HEADERS() {
+      return dart.constList([io.HttpHeaders.CACHE_CONTROL, io.HttpHeaders.CONNECTION, io.HttpHeaders.DATE, io.HttpHeaders.PRAGMA, io.HttpHeaders.TRAILER, io.HttpHeaders.TRANSFER_ENCODING, io.HttpHeaders.UPGRADE, io.HttpHeaders.VIA, io.HttpHeaders.WARNING], core.String);
+    },
+    get ENTITY_HEADERS() {
+      return dart.constList([io.HttpHeaders.ALLOW, io.HttpHeaders.CONTENT_ENCODING, io.HttpHeaders.CONTENT_LANGUAGE, io.HttpHeaders.CONTENT_LENGTH, io.HttpHeaders.CONTENT_LOCATION, io.HttpHeaders.CONTENT_MD5, io.HttpHeaders.CONTENT_RANGE, io.HttpHeaders.CONTENT_TYPE, io.HttpHeaders.EXPIRES, io.HttpHeaders.LAST_MODIFIED], core.String);
+    },
+    get RESPONSE_HEADERS() {
+      return dart.constList([io.HttpHeaders.ACCEPT_RANGES, io.HttpHeaders.AGE, io.HttpHeaders.ETAG, io.HttpHeaders.LOCATION, io.HttpHeaders.PROXY_AUTHENTICATE, io.HttpHeaders.RETRY_AFTER, io.HttpHeaders.SERVER, io.HttpHeaders.VARY, io.HttpHeaders.WWW_AUTHENTICATE], core.String);
+    },
+    get REQUEST_HEADERS() {
+      return dart.constList([io.HttpHeaders.ACCEPT, io.HttpHeaders.ACCEPT_CHARSET, io.HttpHeaders.ACCEPT_ENCODING, io.HttpHeaders.ACCEPT_LANGUAGE, io.HttpHeaders.AUTHORIZATION, io.HttpHeaders.EXPECT, io.HttpHeaders.FROM, io.HttpHeaders.HOST, io.HttpHeaders.IF_MATCH, io.HttpHeaders.IF_MODIFIED_SINCE, io.HttpHeaders.IF_NONE_MATCH, io.HttpHeaders.IF_RANGE, io.HttpHeaders.IF_UNMODIFIED_SINCE, io.HttpHeaders.MAX_FORWARDS, io.HttpHeaders.PROXY_AUTHORIZATION, io.HttpHeaders.RANGE, io.HttpHeaders.REFERER, io.HttpHeaders.TE, io.HttpHeaders.USER_AGENT], core.String);
+    }
+  });
+  io.HeaderValue = class HeaderValue extends core.Object {
+    static new(value, parameters) {
+      if (value === void 0) value = "";
+      if (parameters === void 0) parameters = null;
+      return new io._HeaderValue(value, parameters);
+    }
+    static parse(value, opts) {
+      let parameterSeparator = opts && 'parameterSeparator' in opts ? opts.parameterSeparator : ";";
+      let valueSeparator = opts && 'valueSeparator' in opts ? opts.valueSeparator : null;
+      let preserveBackslash = opts && 'preserveBackslash' in opts ? opts.preserveBackslash : false;
+      return io._HeaderValue.parse(value, {parameterSeparator: parameterSeparator, valueSeparator: valueSeparator, preserveBackslash: preserveBackslash});
+    }
+  };
+  dart.setSignature(io.HeaderValue, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HeaderValue, [], [core.String, MapOfString$String()])}),
+    statics: () => ({parse: dart.definiteFunctionType(io.HeaderValue, [core.String], {parameterSeparator: core.String, valueSeparator: core.String, preserveBackslash: core.bool})}),
+    names: ['parse']
+  });
+  io.HttpSession = class HttpSession extends core.Object {};
+  io.HttpSession[dart.implements] = () => [core.Map];
+  io.ContentType = class ContentType extends core.Object {
+    static new(primaryType, subType, opts) {
+      let charset = opts && 'charset' in opts ? opts.charset : null;
+      let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+      return new io._ContentType(primaryType, subType, charset, parameters);
+    }
+    static parse(value) {
+      return io._ContentType.parse(value);
+    }
+  };
+  io.ContentType[dart.implements] = () => [io.HeaderValue];
+  dart.setSignature(io.ContentType, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ContentType, [core.String, core.String], {charset: core.String, parameters: MapOfString$String()})}),
+    sfields: () => ({
+      TEXT: io.ContentType,
+      HTML: io.ContentType,
+      JSON: io.ContentType,
+      BINARY: io.ContentType
+    }),
+    statics: () => ({parse: dart.definiteFunctionType(io.ContentType, [core.String])}),
+    names: ['parse']
+  });
+  dart.defineLazy(io.ContentType, {
+    get TEXT() {
+      return io.ContentType.new("text", "plain", {charset: "utf-8"});
+    },
+    get HTML() {
+      return io.ContentType.new("text", "html", {charset: "utf-8"});
+    },
+    get JSON() {
+      return io.ContentType.new("application", "json", {charset: "utf-8"});
+    },
+    get BINARY() {
+      return io.ContentType.new("application", "octet-stream");
+    }
+  });
+  io.Cookie = class Cookie extends core.Object {
+    static new(name, value) {
+      if (name === void 0) name = null;
+      if (value === void 0) value = null;
+      return new io._Cookie(name, value);
+    }
+    static fromSetCookieValue(value) {
+      return new io._Cookie.fromSetCookieValue(value);
+    }
+  };
+  dart.setSignature(io.Cookie, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.Cookie, [], [core.String, core.String]),
+      fromSetCookieValue: dart.definiteFunctionType(io.Cookie, [core.String])
+    }),
+    fields: () => ({
+      name: core.String,
+      value: core.String,
+      expires: core.DateTime,
+      maxAge: core.int,
+      domain: core.String,
+      path: core.String,
+      secure: core.bool,
+      httpOnly: core.bool
+    })
+  });
+  io.HttpRequest = class HttpRequest extends core.Object {};
+  io.HttpRequest[dart.implements] = () => [StreamOfListOfint()];
+  io.HttpResponse = class HttpResponse extends core.Object {
+    new() {
+      this.contentLength = null;
+      this.statusCode = null;
+      this.reasonPhrase = null;
+      this.persistentConnection = null;
+      this.deadline = null;
+      this.bufferOutput = null;
+    }
+  };
+  io.HttpResponse[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io.HttpResponse, {
+    fields: () => ({
+      contentLength: core.int,
+      statusCode: core.int,
+      reasonPhrase: core.String,
+      persistentConnection: core.bool,
+      deadline: core.Duration,
+      bufferOutput: core.bool
+    })
+  });
+  io.HttpClient = class HttpClient extends core.Object {
+    static new(opts) {
+      let context = opts && 'context' in opts ? opts.context : null;
+      return new io._HttpClient(context);
+    }
+    static findProxyFromEnvironment(url, opts) {
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      return io._HttpClient._findProxyFromEnvironment(url, environment);
+    }
+  };
+  dart.setSignature(io.HttpClient, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpClient, [], {context: io.SecurityContext})}),
+    fields: () => ({
+      idleTimeout: core.Duration,
+      maxConnectionsPerHost: core.int,
+      autoUncompress: core.bool,
+      userAgent: core.String
+    }),
+    sfields: () => ({
+      DEFAULT_HTTP_PORT: core.int,
+      DEFAULT_HTTPS_PORT: core.int
+    }),
+    statics: () => ({findProxyFromEnvironment: dart.definiteFunctionType(core.String, [core.Uri], {environment: MapOfString$String()})}),
+    names: ['findProxyFromEnvironment']
+  });
+  io.HttpClient.DEFAULT_HTTP_PORT = 80;
+  io.HttpClient.DEFAULT_HTTPS_PORT = 443;
+  io.HttpClientRequest = class HttpClientRequest extends core.Object {
+    new() {
+      this.persistentConnection = null;
+      this.followRedirects = null;
+      this.maxRedirects = null;
+      this.contentLength = null;
+      this.bufferOutput = null;
+    }
+  };
+  io.HttpClientRequest[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io.HttpClientRequest, {
+    fields: () => ({
+      persistentConnection: core.bool,
+      followRedirects: core.bool,
+      maxRedirects: core.int,
+      contentLength: core.int,
+      bufferOutput: core.bool
+    })
+  });
+  io.HttpClientResponse = class HttpClientResponse extends core.Object {};
+  io.HttpClientResponse[dart.implements] = () => [StreamOfListOfint()];
+  io.HttpClientCredentials = class HttpClientCredentials extends core.Object {};
+  io.HttpClientBasicCredentials = class HttpClientBasicCredentials extends io.HttpClientCredentials {
+    static new(username, password) {
+      return new io._HttpClientBasicCredentials(username, password);
+    }
+  };
+  dart.setSignature(io.HttpClientBasicCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpClientBasicCredentials, [core.String, core.String])})
+  });
+  io.HttpClientDigestCredentials = class HttpClientDigestCredentials extends io.HttpClientCredentials {
+    static new(username, password) {
+      return new io._HttpClientDigestCredentials(username, password);
+    }
+  };
+  dart.setSignature(io.HttpClientDigestCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpClientDigestCredentials, [core.String, core.String])})
+  });
+  io.HttpConnectionInfo = class HttpConnectionInfo extends core.Object {};
+  io.RedirectInfo = class RedirectInfo extends core.Object {};
+  io.DetachedSocket = class DetachedSocket extends core.Object {};
+  io.HttpException = class HttpException extends core.Object {
+    new(message, opts) {
+      let uri = opts && 'uri' in opts ? opts.uri : null;
+      this.message = message;
+      this.uri = uri;
+    }
+    toString() {
+      let b = new core.StringBuffer();
+      b.write('HttpException: ');
+      b.write(this.message);
+      if (this.uri != null) {
+        b.write(dart.str`, uri = ${this.uri}`);
+      }
+      return b.toString();
+    }
+  };
+  io.HttpException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.HttpException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpException, [core.String], {uri: core.Uri})}),
+    fields: () => ({
+      message: core.String,
+      uri: core.Uri
+    })
+  });
+  io.RedirectException = class RedirectException extends core.Object {
+    new(message, redirects) {
+      this.message = message;
+      this.redirects = redirects;
+    }
+    toString() {
+      return dart.str`RedirectException: ${this.message}`;
+    }
+    get uri() {
+      return this.redirects[dartx.last].location;
+    }
+  };
+  io.RedirectException[dart.implements] = () => [io.HttpException];
+  dart.setSignature(io.RedirectException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.RedirectException, [core.String, ListOfRedirectInfo()])}),
+    fields: () => ({
+      message: core.String,
+      redirects: ListOfRedirectInfo()
+    }),
+    getters: () => ({uri: dart.definiteFunctionType(core.Uri, [])})
+  });
+  let const$58;
+  let const$59;
+  let const$60;
+  let const$61;
+  let const$62;
+  let const$63;
+  let const$64;
+  let const$65;
+  let const$66;
+  io.HttpDate = class HttpDate extends core.Object {
+    static format(date) {
+      let wkday = const$58 || (const$58 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+      let month = const$59 || (const$59 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+      let d = date.toUtc();
+      let sb = new core.StringBuffer();
+      sb.write(wkday[dartx._get](dart.notNull(d.weekday) - 1));
+      sb.write(", ");
+      sb.write(dart.notNull(d.day) <= 9 ? "0" : "");
+      sb.write(dart.toString(d.day));
+      sb.write(" ");
+      sb.write(month[dartx._get](dart.notNull(d.month) - 1));
+      sb.write(" ");
+      sb.write(dart.toString(d.year));
+      sb.write(dart.notNull(d.hour) <= 9 ? " 0" : " ");
+      sb.write(dart.toString(d.hour));
+      sb.write(dart.notNull(d.minute) <= 9 ? ":0" : ":");
+      sb.write(dart.toString(d.minute));
+      sb.write(dart.notNull(d.second) <= 9 ? ":0" : ":");
+      sb.write(dart.toString(d.second));
+      sb.write(" GMT");
+      return sb.toString();
+    }
+    static parse(date) {
+      let SP = 32;
+      let wkdays = const$60 || (const$60 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+      let weekdays = const$61 || (const$61 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
+      let months = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+      let wkdaysLowerCase = const$63 || (const$63 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
+      let weekdaysLowerCase = const$64 || (const$64 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
+      let monthsLowerCase = const$65 || (const$65 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+      let formatRfc1123 = 0;
+      let formatRfc850 = 1;
+      let formatAsctime = 2;
+      let index = 0;
+      let tmp = null;
+      let format = null;
+      function expect(s) {
+        if (dart.notNull(date[dartx.length]) - dart.notNull(index) < dart.notNull(s[dartx.length])) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        }
+        let tmp = date[dartx.substring](index, dart.notNull(index) + dart.notNull(s[dartx.length]));
+        if (tmp != s) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        }
+        index = dart.notNull(index) + dart.notNull(s[dartx.length]);
+      }
+      dart.fn(expect, StringTovoid$());
+      function expectWeekday() {
+        let weekday = null;
+        let pos = date[dartx.indexOf](",", index);
+        if (pos == -1) {
+          let pos = date[dartx.indexOf](" ", index);
+          if (pos == -1) dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+          tmp = date[dartx.substring](index, pos);
+          index = dart.notNull(pos) + 1;
+          weekday = wkdays[dartx.indexOf](tmp);
+          if (weekday != -1) {
+            format = formatAsctime;
+            return weekday;
+          }
+        } else {
+          tmp = date[dartx.substring](index, pos);
+          index = dart.notNull(pos) + 1;
+          weekday = wkdays[dartx.indexOf](tmp);
+          if (weekday != -1) {
+            format = formatRfc1123;
+            return weekday;
+          }
+          weekday = weekdays[dartx.indexOf](tmp);
+          if (weekday != -1) {
+            format = formatRfc850;
+            return weekday;
+          }
+        }
+        dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      }
+      dart.fn(expectWeekday, VoidToint());
+      function expectMonth(separator) {
+        let pos = date[dartx.indexOf](separator, index);
+        if (dart.notNull(pos) - dart.notNull(index) != 3) dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        tmp = date[dartx.substring](index, pos);
+        index = dart.notNull(pos) + 1;
+        let month = months[dartx.indexOf](tmp);
+        if (month != -1) return month;
+        dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      }
+      dart.fn(expectMonth, StringToint$());
+      function expectNum(separator) {
+        let pos = null;
+        if (dart.notNull(separator[dartx.length]) > 0) {
+          pos = date[dartx.indexOf](separator, index);
+        } else {
+          pos = date[dartx.length];
+        }
+        let tmp = date[dartx.substring](index, pos);
+        index = dart.notNull(pos) + dart.notNull(separator[dartx.length]);
+        try {
+          let value = core.int.parse(tmp);
+          return value;
+        } catch (e) {
+          if (core.FormatException.is(e)) {
+            dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+          } else
+            throw e;
+        }
+
+      }
+      dart.fn(expectNum, StringToint$());
+      function expectEnd() {
+        if (index != date[dartx.length]) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        }
+      }
+      dart.fn(expectEnd, VoidTovoid$());
+      let weekday = expectWeekday();
+      let day = null;
+      let month = null;
+      let year = null;
+      let hours = null;
+      let minutes = null;
+      let seconds = null;
+      if (format == formatAsctime) {
+        month = expectMonth(" ");
+        if (date[dartx.codeUnitAt](index) == SP) {
+          index = dart.notNull(index) + 1;
+        }
+        day = expectNum(" ");
+        hours = expectNum(":");
+        minutes = expectNum(":");
+        seconds = expectNum(" ");
+        year = expectNum("");
+      } else {
+        expect(" ");
+        day = expectNum(format == formatRfc1123 ? " " : "-");
+        month = expectMonth(format == formatRfc1123 ? " " : "-");
+        year = expectNum(" ");
+        hours = expectNum(":");
+        minutes = expectNum(":");
+        seconds = expectNum(" ");
+        expect("GMT");
+      }
+      expectEnd();
+      return new core.DateTime.utc(year, dart.notNull(month) + 1, day, hours, minutes, seconds, 0);
+    }
+    static _parseCookieDate(date) {
+      let monthsLowerCase = const$66 || (const$66 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+      let position = 0;
+      function error() {
+        dart.throw(new io.HttpException(dart.str`Invalid cookie date ${date}`));
+      }
+      dart.fn(error, VoidTovoid$());
+      function isEnd() {
+        return position == date[dartx.length];
+      }
+      dart.fn(isEnd, VoidTobool());
+      function isDelimiter(s) {
+        let char = s[dartx.codeUnitAt](0);
+        if (char == 9) return true;
+        if (dart.notNull(char) >= 32 && dart.notNull(char) <= 47) return true;
+        if (dart.notNull(char) >= 59 && dart.notNull(char) <= 64) return true;
+        if (dart.notNull(char) >= 91 && dart.notNull(char) <= 96) return true;
+        if (dart.notNull(char) >= 123 && dart.notNull(char) <= 126) return true;
+        return false;
+      }
+      dart.fn(isDelimiter, StringTobool$());
+      function isNonDelimiter(s) {
+        let char = s[dartx.codeUnitAt](0);
+        if (dart.notNull(char) >= 0 && dart.notNull(char) <= 8) return true;
+        if (dart.notNull(char) >= 10 && dart.notNull(char) <= 31) return true;
+        if (dart.notNull(char) >= 48 && dart.notNull(char) <= 57) return true;
+        if (char == 58) return true;
+        if (dart.notNull(char) >= 65 && dart.notNull(char) <= 90) return true;
+        if (dart.notNull(char) >= 97 && dart.notNull(char) <= 122) return true;
+        if (dart.notNull(char) >= 127 && dart.notNull(char) <= 255) return true;
+        return false;
+      }
+      dart.fn(isNonDelimiter, StringTobool$());
+      function isDigit(s) {
+        let char = s[dartx.codeUnitAt](0);
+        if (dart.notNull(char) > 47 && dart.notNull(char) < 58) return true;
+        return false;
+      }
+      dart.fn(isDigit, StringTobool$());
+      function getMonth(month) {
+        if (dart.notNull(month[dartx.length]) < 3) return -1;
+        return monthsLowerCase[dartx.indexOf](month[dartx.substring](0, 3));
+      }
+      dart.fn(getMonth, StringToint$());
+      function toInt(s) {
+        let index = 0;
+        for (; index < dart.notNull(s[dartx.length]) && dart.test(isDigit(s[dartx._get](index))); index++)
+          ;
+        return core.int.parse(s[dartx.substring](0, index));
+      }
+      dart.fn(toInt, StringToint$());
+      let tokens = [];
+      while (!dart.test(isEnd())) {
+        while (!dart.test(isEnd()) && dart.test(isDelimiter(date[dartx._get](position))))
+          position++;
+        let start = position;
+        while (!dart.test(isEnd()) && dart.test(isNonDelimiter(date[dartx._get](position))))
+          position++;
+        tokens[dartx.add](date[dartx.substring](start, position)[dartx.toLowerCase]());
+        while (!dart.test(isEnd()) && dart.test(isDelimiter(date[dartx._get](position))))
+          position++;
+      }
+      let timeStr = null;
+      let dayOfMonthStr = null;
+      let monthStr = null;
+      let yearStr = null;
+      for (let token of tokens) {
+        if (dart.test(dart.dsend(dart.dload(token, 'length'), '<', 1))) continue;
+        if (timeStr == null && dart.test(dart.dsend(dart.dload(token, 'length'), '>=', 5)) && dart.test(isDigit(core.String._check(dart.dindex(token, 0)))) && (dart.equals(dart.dindex(token, 1), ":") || dart.test(isDigit(core.String._check(dart.dindex(token, 1)))) && dart.equals(dart.dindex(token, 2), ":"))) {
+          timeStr = core.String._check(token);
+        } else if (dayOfMonthStr == null && dart.test(isDigit(core.String._check(dart.dindex(token, 0))))) {
+          dayOfMonthStr = core.String._check(token);
+        } else if (monthStr == null && dart.notNull(getMonth(core.String._check(token))) >= 0) {
+          monthStr = core.String._check(token);
+        } else if (yearStr == null && dart.test(dart.dsend(dart.dload(token, 'length'), '>=', 2)) && dart.test(isDigit(core.String._check(dart.dindex(token, 0)))) && dart.test(isDigit(core.String._check(dart.dindex(token, 1))))) {
+          yearStr = core.String._check(token);
+        }
+      }
+      if (timeStr == null || dayOfMonthStr == null || monthStr == null || yearStr == null) {
+        error();
+      }
+      let year = toInt(yearStr);
+      if (dart.notNull(year) >= 70 && dart.notNull(year) <= 99) {
+        year = dart.notNull(year) + 1900;
+      } else if (dart.notNull(year) >= 0 && dart.notNull(year) <= 69) {
+        year = dart.notNull(year) + 2000;
+      }
+      if (dart.notNull(year) < 1601) error();
+      let dayOfMonth = toInt(dayOfMonthStr);
+      if (dart.notNull(dayOfMonth) < 1 || dart.notNull(dayOfMonth) > 31) error();
+      let month = dart.notNull(getMonth(monthStr)) + 1;
+      let timeList = timeStr[dartx.split](":");
+      if (timeList[dartx.length] != 3) error();
+      let hour = toInt(timeList[dartx._get](0));
+      let minute = toInt(timeList[dartx._get](1));
+      let second = toInt(timeList[dartx._get](2));
+      if (dart.notNull(hour) > 23) error();
+      if (dart.notNull(minute) > 59) error();
+      if (dart.notNull(second) > 59) error();
+      return new core.DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0);
+    }
+  };
+  dart.setSignature(io.HttpDate, {
+    statics: () => ({
+      format: dart.definiteFunctionType(core.String, [core.DateTime]),
+      parse: dart.definiteFunctionType(core.DateTime, [core.String]),
+      _parseCookieDate: dart.definiteFunctionType(core.DateTime, [core.String])
+    }),
+    names: ['format', 'parse', '_parseCookieDate']
+  });
+  const _headers = Symbol('_headers');
+  const _defaultPortForScheme = Symbol('_defaultPortForScheme');
+  const _mutable = Symbol('_mutable');
+  const _noFoldingHeaders = Symbol('_noFoldingHeaders');
+  const _contentLength = Symbol('_contentLength');
+  const _persistentConnection = Symbol('_persistentConnection');
+  const _chunkedTransferEncoding = Symbol('_chunkedTransferEncoding');
+  const _host$ = Symbol('_host');
+  const _port$ = Symbol('_port');
+  const _checkMutable = Symbol('_checkMutable');
+  const _addAll = Symbol('_addAll');
+  const _add$2 = Symbol('_add');
+  const _set$ = Symbol('_set');
+  const _addValue = Symbol('_addValue');
+  const _updateHostHeader = Symbol('_updateHostHeader');
+  const _addDate = Symbol('_addDate');
+  const _addHost = Symbol('_addHost');
+  const _addExpires = Symbol('_addExpires');
+  const _addConnection = Symbol('_addConnection');
+  const _addContentType = Symbol('_addContentType');
+  const _addContentLength = Symbol('_addContentLength');
+  const _addTransferEncoding = Symbol('_addTransferEncoding');
+  const _addIfModifiedSince = Symbol('_addIfModifiedSince');
+  const _foldHeader = Symbol('_foldHeader');
+  const _finalize = Symbol('_finalize');
+  const _write = Symbol('_write');
+  const _parseCookies = Symbol('_parseCookies');
+  io._HttpHeaders = class _HttpHeaders extends core.Object {
+    new(protocolVersion, opts) {
+      let defaultPortForScheme = opts && 'defaultPortForScheme' in opts ? opts.defaultPortForScheme : io.HttpClient.DEFAULT_HTTP_PORT;
+      let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
+      this.protocolVersion = protocolVersion;
+      this[_headers] = HashMapOfString$ListOfString().new();
+      this[_defaultPortForScheme] = defaultPortForScheme;
+      this[_mutable] = true;
+      this[_noFoldingHeaders] = null;
+      this[_contentLength] = -1;
+      this[_persistentConnection] = true;
+      this[_chunkedTransferEncoding] = false;
+      this[_host$] = null;
+      this[_port$] = null;
+      if (initialHeaders != null) {
+        initialHeaders[_headers][dartx.forEach](dart.fn((name, value) => this[_headers][dartx._set](name, value), StringAndListOfStringToListOfString()));
+        this[_contentLength] = initialHeaders[_contentLength];
+        this[_persistentConnection] = initialHeaders[_persistentConnection];
+        this[_chunkedTransferEncoding] = initialHeaders[_chunkedTransferEncoding];
+        this[_host$] = initialHeaders[_host$];
+        this[_port$] = initialHeaders[_port$];
+      }
+      if (this.protocolVersion == "1.0") {
+        this[_persistentConnection] = false;
+        this[_chunkedTransferEncoding] = false;
+      }
+    }
+    _get(name) {
+      return this[_headers][dartx._get](name[dartx.toLowerCase]());
+    }
+    value(name) {
+      name = name[dartx.toLowerCase]();
+      let values = this[_headers][dartx._get](name);
+      if (values == null) return null;
+      if (dart.notNull(values[dartx.length]) > 1) {
+        dart.throw(new io.HttpException(dart.str`More than one value for header ${name}`));
+      }
+      return values[dartx._get](0);
+    }
+    add(name, value) {
+      this[_checkMutable]();
+      this[_addAll](io._HttpHeaders._validateField(name), value);
+    }
+    [_addAll](name, value) {
+      dart.assert(name == io._HttpHeaders._validateField(name));
+      if (core.Iterable.is(value)) {
+        for (let v of value) {
+          this[_add$2](name, io._HttpHeaders._validateValue(v));
+        }
+      } else {
+        this[_add$2](name, io._HttpHeaders._validateValue(value));
+      }
+    }
+    set(name, value) {
+      this[_checkMutable]();
+      name = io._HttpHeaders._validateField(name);
+      this[_headers][dartx.remove](name);
+      if (name == io.HttpHeaders.TRANSFER_ENCODING) {
+        this[_chunkedTransferEncoding] = false;
+      }
+      this[_addAll](name, value);
+    }
+    remove(name, value) {
+      this[_checkMutable]();
+      name = io._HttpHeaders._validateField(name);
+      value = io._HttpHeaders._validateValue(value);
+      let values = this[_headers][dartx._get](name);
+      if (values != null) {
+        let index = values[dartx.indexOf](core.String._check(value));
+        if (index != -1) {
+          values[dartx.removeRange](index, dart.notNull(index) + 1);
+        }
+        if (values[dartx.length] == 0) this[_headers][dartx.remove](name);
+      }
+      if (name == io.HttpHeaders.TRANSFER_ENCODING && dart.equals(value, "chunked")) {
+        this[_chunkedTransferEncoding] = false;
+      }
+    }
+    removeAll(name) {
+      this[_checkMutable]();
+      name = io._HttpHeaders._validateField(name);
+      this[_headers][dartx.remove](name);
+    }
+    forEach(f) {
+      this[_headers][dartx.forEach](f);
+    }
+    noFolding(name) {
+      if (this[_noFoldingHeaders] == null) this[_noFoldingHeaders] = ListOfString().new();
+      this[_noFoldingHeaders][dartx.add](name);
+    }
+    get persistentConnection() {
+      return this[_persistentConnection];
+    }
+    set persistentConnection(persistentConnection) {
+      this[_checkMutable]();
+      if (persistentConnection == this[_persistentConnection]) return;
+      if (dart.test(persistentConnection)) {
+        if (this.protocolVersion == "1.1") {
+          this.remove(io.HttpHeaders.CONNECTION, "close");
+        } else {
+          if (this[_contentLength] == -1) {
+            dart.throw(new io.HttpException("Trying to set 'Connection: Keep-Alive' on HTTP 1.0 headers with " + "no ContentLength"));
+          }
+          this.add(io.HttpHeaders.CONNECTION, "keep-alive");
+        }
+      } else {
+        if (this.protocolVersion == "1.1") {
+          this.add(io.HttpHeaders.CONNECTION, "close");
+        } else {
+          this.remove(io.HttpHeaders.CONNECTION, "keep-alive");
+        }
+      }
+      this[_persistentConnection] = persistentConnection;
+    }
+    get contentLength() {
+      return this[_contentLength];
+    }
+    set contentLength(contentLength) {
+      this[_checkMutable]();
+      if (this.protocolVersion == "1.0" && dart.test(this.persistentConnection) && contentLength == -1) {
+        dart.throw(new io.HttpException("Trying to clear ContentLength on HTTP 1.0 headers with " + "'Connection: Keep-Alive' set"));
+      }
+      if (this[_contentLength] == contentLength) return;
+      this[_contentLength] = contentLength;
+      if (dart.notNull(this[_contentLength]) >= 0) {
+        if (dart.test(this.chunkedTransferEncoding)) this.chunkedTransferEncoding = false;
+        this[_set$](io.HttpHeaders.CONTENT_LENGTH, dart.toString(contentLength));
+      } else {
+        this.removeAll(io.HttpHeaders.CONTENT_LENGTH);
+        if (this.protocolVersion == "1.1") {
+          this.chunkedTransferEncoding = true;
+        }
+      }
+    }
+    get chunkedTransferEncoding() {
+      return this[_chunkedTransferEncoding];
+    }
+    set chunkedTransferEncoding(chunkedTransferEncoding) {
+      this[_checkMutable]();
+      if (dart.test(chunkedTransferEncoding) && this.protocolVersion == "1.0") {
+        dart.throw(new io.HttpException("Trying to set 'Transfer-Encoding: Chunked' on HTTP 1.0 headers"));
+      }
+      if (chunkedTransferEncoding == this[_chunkedTransferEncoding]) return;
+      if (dart.test(chunkedTransferEncoding)) {
+        let values = this[_headers][dartx._get](io.HttpHeaders.TRANSFER_ENCODING);
+        if (values == null || values[dartx.last] != "chunked") {
+          this[_addValue](io.HttpHeaders.TRANSFER_ENCODING, "chunked");
+        }
+        this.contentLength = -1;
+      } else {
+        this.remove(io.HttpHeaders.TRANSFER_ENCODING, "chunked");
+      }
+      this[_chunkedTransferEncoding] = chunkedTransferEncoding;
+    }
+    get host() {
+      return this[_host$];
+    }
+    set host(host) {
+      this[_checkMutable]();
+      this[_host$] = host;
+      this[_updateHostHeader]();
+    }
+    get port() {
+      return this[_port$];
+    }
+    set port(port) {
+      this[_checkMutable]();
+      this[_port$] = port;
+      this[_updateHostHeader]();
+    }
+    get ifModifiedSince() {
+      let values = this[_headers][dartx._get](io.HttpHeaders.IF_MODIFIED_SINCE);
+      if (values != null) {
+        try {
+          return io.HttpDate.parse(values[dartx._get](0));
+        } catch (e) {
+          if (core.Exception.is(e)) {
+            return null;
+          } else
+            throw e;
+        }
+
+      }
+      return null;
+    }
+    set ifModifiedSince(ifModifiedSince) {
+      this[_checkMutable]();
+      let formatted = io.HttpDate.format(ifModifiedSince.toUtc());
+      this[_set$](io.HttpHeaders.IF_MODIFIED_SINCE, formatted);
+    }
+    get date() {
+      let values = this[_headers][dartx._get](io.HttpHeaders.DATE);
+      if (values != null) {
+        try {
+          return io.HttpDate.parse(values[dartx._get](0));
+        } catch (e) {
+          if (core.Exception.is(e)) {
+            return null;
+          } else
+            throw e;
+        }
+
+      }
+      return null;
+    }
+    set date(date) {
+      this[_checkMutable]();
+      let formatted = io.HttpDate.format(date.toUtc());
+      this[_set$]("date", formatted);
+    }
+    get expires() {
+      let values = this[_headers][dartx._get](io.HttpHeaders.EXPIRES);
+      if (values != null) {
+        try {
+          return io.HttpDate.parse(values[dartx._get](0));
+        } catch (e) {
+          if (core.Exception.is(e)) {
+            return null;
+          } else
+            throw e;
+        }
+
+      }
+      return null;
+    }
+    set expires(expires) {
+      this[_checkMutable]();
+      let formatted = io.HttpDate.format(expires.toUtc());
+      this[_set$](io.HttpHeaders.EXPIRES, formatted);
+    }
+    get contentType() {
+      let values = this[_headers][dartx._get]("content-type");
+      if (values != null) {
+        return io.ContentType.parse(values[dartx._get](0));
+      } else {
+        return null;
+      }
+    }
+    set contentType(contentType) {
+      this[_checkMutable]();
+      this[_set$](io.HttpHeaders.CONTENT_TYPE, dart.toString(contentType));
+    }
+    clear() {
+      this[_checkMutable]();
+      this[_headers][dartx.clear]();
+      this[_contentLength] = -1;
+      this[_persistentConnection] = true;
+      this[_chunkedTransferEncoding] = false;
+      this[_host$] = null;
+      this[_port$] = null;
+    }
+    [_add$2](name, value) {
+      dart.assert(name == io._HttpHeaders._validateField(name));
+      switch (name[dartx.length]) {
+        case 4:
+        {
+          if (io.HttpHeaders.DATE == name) {
+            this[_addDate](name, value);
+            return;
+          }
+          if (io.HttpHeaders.HOST == name) {
+            this[_addHost](name, value);
+            return;
+          }
+          break;
+        }
+        case 7:
+        {
+          if (io.HttpHeaders.EXPIRES == name) {
+            this[_addExpires](name, value);
+            return;
+          }
+          break;
+        }
+        case 10:
+        {
+          if (io.HttpHeaders.CONNECTION == name) {
+            this[_addConnection](name, value);
+            return;
+          }
+          break;
+        }
+        case 12:
+        {
+          if (io.HttpHeaders.CONTENT_TYPE == name) {
+            this[_addContentType](name, value);
+            return;
+          }
+          break;
+        }
+        case 14:
+        {
+          if (io.HttpHeaders.CONTENT_LENGTH == name) {
+            this[_addContentLength](name, value);
+            return;
+          }
+          break;
+        }
+        case 17:
+        {
+          if (io.HttpHeaders.TRANSFER_ENCODING == name) {
+            this[_addTransferEncoding](name, value);
+            return;
+          }
+          if (io.HttpHeaders.IF_MODIFIED_SINCE == name) {
+            this[_addIfModifiedSince](name, value);
+            return;
+          }
+        }
+      }
+      this[_addValue](name, value);
+    }
+    [_addContentLength](name, value) {
+      if (typeof value == 'number') {
+        this.contentLength = value;
+      } else if (typeof value == 'string') {
+        this.contentLength = core.int.parse(value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addTransferEncoding](name, value) {
+      if (dart.equals(value, "chunked")) {
+        this.chunkedTransferEncoding = true;
+      } else {
+        this[_addValue](io.HttpHeaders.TRANSFER_ENCODING, value);
+      }
+    }
+    [_addDate](name, value) {
+      if (core.DateTime.is(value)) {
+        this.date = value;
+      } else if (typeof value == 'string') {
+        this[_set$](io.HttpHeaders.DATE, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addExpires](name, value) {
+      if (core.DateTime.is(value)) {
+        this.expires = value;
+      } else if (typeof value == 'string') {
+        this[_set$](io.HttpHeaders.EXPIRES, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addIfModifiedSince](name, value) {
+      if (core.DateTime.is(value)) {
+        this.ifModifiedSince = value;
+      } else if (typeof value == 'string') {
+        this[_set$](io.HttpHeaders.IF_MODIFIED_SINCE, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addHost](name, value) {
+      if (typeof value == 'string') {
+        let pos = value[dartx.indexOf](":");
+        if (pos == -1) {
+          this[_host$] = value;
+          this[_port$] = io.HttpClient.DEFAULT_HTTP_PORT;
+        } else {
+          if (dart.notNull(pos) > 0) {
+            this[_host$] = value[dartx.substring](0, pos);
+          } else {
+            this[_host$] = null;
+          }
+          if (dart.notNull(pos) + 1 == value[dartx.length]) {
+            this[_port$] = io.HttpClient.DEFAULT_HTTP_PORT;
+          } else {
+            try {
+              this[_port$] = core.int.parse(value[dartx.substring](dart.notNull(pos) + 1));
+            } catch (e) {
+              if (core.FormatException.is(e)) {
+                this[_port$] = null;
+              } else
+                throw e;
+            }
+
+          }
+        }
+        this[_set$](io.HttpHeaders.HOST, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addConnection](name, value) {
+      let lowerCaseValue = dart.dsend(value, 'toLowerCase');
+      if (dart.equals(lowerCaseValue, 'close')) {
+        this[_persistentConnection] = false;
+      } else if (dart.equals(lowerCaseValue, 'keep-alive')) {
+        this[_persistentConnection] = true;
+      }
+      this[_addValue](name, value);
+    }
+    [_addContentType](name, value) {
+      this[_set$](io.HttpHeaders.CONTENT_TYPE, core.String._check(value));
+    }
+    [_addValue](name, value) {
+      let values = this[_headers][dartx._get](name);
+      if (values == null) {
+        values = ListOfString().new();
+        this[_headers][dartx._set](name, values);
+      }
+      if (core.DateTime.is(value)) {
+        values[dartx.add](io.HttpDate.format(value));
+      } else if (typeof value == 'string') {
+        values[dartx.add](value);
+      } else {
+        values[dartx.add](core.String._check(io._HttpHeaders._validateValue(dart.toString(value))));
+      }
+    }
+    [_set$](name, value) {
+      dart.assert(name == io._HttpHeaders._validateField(name));
+      let values = ListOfString().new();
+      this[_headers][dartx._set](name, values);
+      values[dartx.add](value);
+    }
+    [_checkMutable]() {
+      if (!dart.test(this[_mutable])) dart.throw(new io.HttpException("HTTP headers are not mutable"));
+    }
+    [_updateHostHeader]() {
+      let defaultPort = this[_port$] == null || this[_port$] == this[_defaultPortForScheme];
+      this[_set$]("host", defaultPort ? this.host : dart.str`${this.host}:${this[_port$]}`);
+    }
+    [_foldHeader](name) {
+      if (name == io.HttpHeaders.SET_COOKIE || this[_noFoldingHeaders] != null && this[_noFoldingHeaders][dartx.indexOf](name) != -1) {
+        return false;
+      }
+      return true;
+    }
+    [_finalize]() {
+      this[_mutable] = false;
+    }
+    [_write](buffer, offset) {
+      function write(bytes) {
+        let len = bytes[dartx.length];
+        for (let i = 0; i < dart.notNull(len); i++) {
+          buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+        }
+        offset = dart.notNull(offset) + dart.notNull(len);
+      }
+      dart.fn(write, ListOfintTovoid$());
+      for (let name of this[_headers][dartx.keys]) {
+        let values = this[_headers][dartx._get](name);
+        let fold = core.bool._check(this[_foldHeader](name));
+        let nameData = name[dartx.codeUnits];
+        write(nameData);
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.COLON);
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.SP);
+        for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
+          if (i > 0) {
+            if (dart.test(fold)) {
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.COMMA);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.SP);
+            } else {
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.CR);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.LF);
+              write(nameData);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.COLON);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.SP);
+            }
+          }
+          write(values[dartx._get](i)[dartx.codeUnits]);
+        }
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.CR);
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.LF);
+      }
+      return offset;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      this[_headers][dartx.forEach](dart.fn((name, values) => {
+        sb.write(name);
+        sb.write(": ");
+        let fold = core.bool._check(this[_foldHeader](name));
+        for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
+          if (i > 0) {
+            if (dart.test(fold)) {
+              sb.write(", ");
+            } else {
+              sb.write("\n");
+              sb.write(name);
+              sb.write(": ");
+            }
+          }
+          sb.write(values[dartx._get](i));
+        }
+        sb.write("\n");
+      }, StringAndListOfStringToNull()));
+      return sb.toString();
+    }
+    [_parseCookies]() {
+      let cookies = ListOfCookie().new();
+      function parseCookieString(s) {
+        let index = 0;
+        function done() {
+          return index == -1 || index == s[dartx.length];
+        }
+        dart.fn(done, VoidTobool());
+        function skipWS() {
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) != " " && s[dartx._get](index) != "\t") return;
+            index = dart.notNull(index) + 1;
+          }
+        }
+        dart.fn(skipWS, VoidTovoid$());
+        function parseName() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == "=") break;
+            index = dart.notNull(index) + 1;
+          }
+          return s[dartx.substring](start, index);
+        }
+        dart.fn(parseName, VoidToString$());
+        function parseValue() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == ";") break;
+            index = dart.notNull(index) + 1;
+          }
+          return s[dartx.substring](start, index);
+        }
+        dart.fn(parseValue, VoidToString$());
+        function expect(expected) {
+          if (dart.test(done())) return false;
+          if (s[dartx._get](index) != expected) return false;
+          index = dart.notNull(index) + 1;
+          return true;
+        }
+        dart.fn(expect, StringTobool$());
+        while (!dart.test(done())) {
+          skipWS();
+          if (dart.test(done())) return;
+          let name = parseName();
+          skipWS();
+          if (!dart.test(expect("="))) {
+            index = s[dartx.indexOf](';', index);
+            continue;
+          }
+          skipWS();
+          let value = parseValue();
+          try {
+            cookies[dartx.add](new io._Cookie(name, value));
+          } catch (_) {
+          }
+
+          skipWS();
+          if (dart.test(done())) return;
+          if (!dart.test(expect(";"))) {
+            index = s[dartx.indexOf](';', index);
+            continue;
+          }
+        }
+      }
+      dart.fn(parseCookieString, StringTovoid$());
+      let values = this[_headers][dartx._get](io.HttpHeaders.COOKIE);
+      if (values != null) {
+        values[dartx.forEach](dart.fn(headerValue => parseCookieString(headerValue), StringTovoid$()));
+      }
+      return cookies;
+    }
+    static _validateField(field) {
+      for (let i = 0; i < dart.notNull(field[dartx.length]); i++) {
+        if (!dart.test(io._HttpParser._isTokenChar(field[dartx.codeUnitAt](i)))) {
+          dart.throw(new core.FormatException(dart.str`Invalid HTTP header field name: ${convert.JSON.encode(field)}`));
+        }
+      }
+      return field[dartx.toLowerCase]();
+    }
+    static _validateValue(value) {
+      if (!(typeof value == 'string')) return value;
+      for (let i = 0; i < dart.notNull(core.num._check(dart.dload(value, 'length'))); i++) {
+        if (!dart.test(io._HttpParser._isValueChar(core.int._check(dart.dsend(value, 'codeUnitAt', i))))) {
+          dart.throw(new core.FormatException(dart.str`Invalid HTTP header field value: ${convert.JSON.encode(value)}`));
+        }
+      }
+      return value;
+    }
+  };
+  io._HttpHeaders[dart.implements] = () => [io.HttpHeaders];
+  dart.setSignature(io._HttpHeaders, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpHeaders, [core.String], {defaultPortForScheme: core.int, initialHeaders: io._HttpHeaders})}),
+    fields: () => ({
+      [_headers]: MapOfString$ListOfString(),
+      protocolVersion: core.String,
+      [_mutable]: core.bool,
+      [_noFoldingHeaders]: ListOfString(),
+      [_contentLength]: core.int,
+      [_persistentConnection]: core.bool,
+      [_chunkedTransferEncoding]: core.bool,
+      [_host$]: core.String,
+      [_port$]: core.int,
+      [_defaultPortForScheme]: core.int
+    }),
+    getters: () => ({
+      persistentConnection: dart.definiteFunctionType(core.bool, []),
+      contentLength: dart.definiteFunctionType(core.int, []),
+      chunkedTransferEncoding: dart.definiteFunctionType(core.bool, []),
+      host: dart.definiteFunctionType(core.String, []),
+      port: dart.definiteFunctionType(core.int, []),
+      ifModifiedSince: dart.definiteFunctionType(core.DateTime, []),
+      date: dart.definiteFunctionType(core.DateTime, []),
+      expires: dart.definiteFunctionType(core.DateTime, []),
+      contentType: dart.definiteFunctionType(io.ContentType, [])
+    }),
+    setters: () => ({
+      persistentConnection: dart.definiteFunctionType(dart.void, [core.bool]),
+      contentLength: dart.definiteFunctionType(dart.void, [core.int]),
+      chunkedTransferEncoding: dart.definiteFunctionType(dart.void, [core.bool]),
+      host: dart.definiteFunctionType(dart.void, [core.String]),
+      port: dart.definiteFunctionType(dart.void, [core.int]),
+      ifModifiedSince: dart.definiteFunctionType(dart.void, [core.DateTime]),
+      date: dart.definiteFunctionType(dart.void, [core.DateTime]),
+      expires: dart.definiteFunctionType(dart.void, [core.DateTime]),
+      contentType: dart.definiteFunctionType(dart.void, [io.ContentType])
+    }),
+    methods: () => ({
+      _get: dart.definiteFunctionType(core.List$(core.String), [core.String]),
+      value: dart.definiteFunctionType(core.String, [core.String]),
+      add: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      [_addAll]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      set: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      remove: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      removeAll: dart.definiteFunctionType(dart.void, [core.String]),
+      forEach: dart.definiteFunctionType(dart.void, [StringAndListOfStringTovoid()]),
+      noFolding: dart.definiteFunctionType(dart.void, [core.String]),
+      clear: dart.definiteFunctionType(dart.void, []),
+      [_add$2]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addContentLength]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addTransferEncoding]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addDate]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addExpires]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addIfModifiedSince]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addHost]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addConnection]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addContentType]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addValue]: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      [_set$]: dart.definiteFunctionType(dart.void, [core.String, core.String]),
+      [_checkMutable]: dart.definiteFunctionType(dart.dynamic, []),
+      [_updateHostHeader]: dart.definiteFunctionType(dart.dynamic, []),
+      [_foldHeader]: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      [_finalize]: dart.definiteFunctionType(dart.void, []),
+      [_write]: dart.definiteFunctionType(core.int, [typed_data.Uint8List, core.int]),
+      [_parseCookies]: dart.definiteFunctionType(core.List$(io.Cookie), [])
+    }),
+    statics: () => ({
+      _validateField: dart.definiteFunctionType(core.String, [core.String]),
+      _validateValue: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
+    }),
+    names: ['_validateField', '_validateValue']
+  });
+  const _value$1 = Symbol('_value');
+  const _parameters = Symbol('_parameters');
+  const _unmodifiableParameters = Symbol('_unmodifiableParameters');
+  const _parse = Symbol('_parse');
+  const _ensureParameters = Symbol('_ensureParameters');
+  io._HeaderValue = class _HeaderValue extends core.Object {
+    new(value, parameters) {
+      if (value === void 0) value = "";
+      if (parameters === void 0) parameters = null;
+      this[_value$1] = value;
+      this[_parameters] = null;
+      this[_unmodifiableParameters] = null;
+      if (parameters != null) {
+        this[_parameters] = HashMapOfString$String().from(parameters);
+      }
+    }
+    static parse(value, opts) {
+      let parameterSeparator = opts && 'parameterSeparator' in opts ? opts.parameterSeparator : ";";
+      let valueSeparator = opts && 'valueSeparator' in opts ? opts.valueSeparator : null;
+      let preserveBackslash = opts && 'preserveBackslash' in opts ? opts.preserveBackslash : false;
+      let result = new io._HeaderValue();
+      result[_parse](value, core.String._check(parameterSeparator), core.String._check(valueSeparator), core.bool._check(preserveBackslash));
+      return result;
+    }
+    get value() {
+      return this[_value$1];
+    }
+    [_ensureParameters]() {
+      if (this[_parameters] == null) {
+        this[_parameters] = HashMapOfString$String().new();
+      }
+    }
+    get parameters() {
+      this[_ensureParameters]();
+      if (this[_unmodifiableParameters] == null) {
+        this[_unmodifiableParameters] = new (UnmodifiableMapViewOfString$String())(this[_parameters]);
+      }
+      return this[_unmodifiableParameters];
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write(this[_value$1]);
+      if (this.parameters != null && dart.notNull(this.parameters[dartx.length]) > 0) {
+        this[_parameters][dartx.forEach](dart.fn((name, value) => {
+          sb.write("; ");
+          sb.write(name);
+          sb.write("=");
+          sb.write(value);
+        }, StringAndStringToNull()));
+      }
+      return sb.toString();
+    }
+    [_parse](s, parameterSeparator, valueSeparator, preserveBackslash) {
+      let index = 0;
+      function done() {
+        return index == s[dartx.length];
+      }
+      dart.fn(done, VoidTobool());
+      function skipWS() {
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) != " " && s[dartx._get](index) != "\t") return;
+          index++;
+        }
+      }
+      dart.fn(skipWS, VoidTovoid$());
+      function parseValue() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == valueSeparator || s[dartx._get](index) == parameterSeparator) break;
+          index++;
+        }
+        return s[dartx.substring](start, index);
+      }
+      dart.fn(parseValue, VoidToString$());
+      function expect(expected) {
+        if (dart.test(done()) || s[dartx._get](index) != expected) {
+          dart.throw(new io.HttpException("Failed to parse header value"));
+        }
+        index++;
+      }
+      dart.fn(expect, StringTovoid$());
+      function maybeExpect(expected) {
+        if (s[dartx._get](index) == expected) index++;
+      }
+      dart.fn(maybeExpect, StringTovoid$());
+      const parseParameters = (function() {
+        let parameters = HashMapOfString$String().new();
+        this[_parameters] = new (UnmodifiableMapViewOfString$String())(parameters);
+        function parseParameterName() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == "=" || s[dartx._get](index) == parameterSeparator || s[dartx._get](index) == valueSeparator) break;
+            index++;
+          }
+          return s[dartx.substring](start, index)[dartx.toLowerCase]();
+        }
+        dart.fn(parseParameterName, VoidToString$());
+        function parseParameterValue() {
+          if (!dart.test(done()) && s[dartx._get](index) == "\"") {
+            let sb = new core.StringBuffer();
+            index++;
+            while (!dart.test(done())) {
+              if (s[dartx._get](index) == "\\") {
+                if (index + 1 == s[dartx.length]) {
+                  dart.throw(new io.HttpException("Failed to parse header value"));
+                }
+                if (dart.test(preserveBackslash) && s[dartx._get](index + 1) != "\"") {
+                  sb.write(s[dartx._get](index));
+                }
+                index++;
+              } else if (s[dartx._get](index) == "\"") {
+                index++;
+                break;
+              }
+              sb.write(s[dartx._get](index));
+              index++;
+            }
+            return sb.toString();
+          } else {
+            let val = parseValue();
+            return val == "" ? null : val;
+          }
+        }
+        dart.fn(parseParameterValue, VoidToString$());
+        while (!dart.test(done())) {
+          skipWS();
+          if (dart.test(done())) return;
+          let name = parseParameterName();
+          skipWS();
+          if (dart.test(done())) {
+            parameters._set(name, null);
+            return;
+          }
+          maybeExpect("=");
+          skipWS();
+          if (dart.test(done())) {
+            parameters._set(name, null);
+            return;
+          }
+          let value = parseParameterValue();
+          if (name == 'charset' && io._ContentType.is(this)) {
+            value = value[dartx.toLowerCase]();
+          }
+          parameters._set(name, value);
+          skipWS();
+          if (dart.test(done())) return;
+          if (s[dartx._get](index) == valueSeparator) return;
+          expect(parameterSeparator);
+        }
+      }).bind(this);
+      dart.fn(parseParameters, VoidTovoid$());
+      skipWS();
+      this[_value$1] = parseValue();
+      skipWS();
+      if (dart.test(done())) return;
+      maybeExpect(parameterSeparator);
+      parseParameters();
+    }
+  };
+  io._HeaderValue[dart.implements] = () => [io.HeaderValue];
+  dart.setSignature(io._HeaderValue, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HeaderValue, [], [core.String, MapOfString$String()])}),
+    fields: () => ({
+      [_value$1]: core.String,
+      [_parameters]: MapOfString$String(),
+      [_unmodifiableParameters]: MapOfString$String()
+    }),
+    getters: () => ({
+      value: dart.definiteFunctionType(core.String, []),
+      parameters: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+    }),
+    methods: () => ({
+      [_ensureParameters]: dart.definiteFunctionType(dart.void, []),
+      [_parse]: dart.definiteFunctionType(dart.void, [core.String, core.String, core.String, core.bool])
+    }),
+    statics: () => ({parse: dart.definiteFunctionType(io._HeaderValue, [core.String], {parameterSeparator: dart.dynamic, valueSeparator: dart.dynamic, preserveBackslash: dart.dynamic})}),
+    names: ['parse']
+  });
+  const _primaryType = Symbol('_primaryType');
+  const _subType = Symbol('_subType');
+  io._ContentType = class _ContentType extends io._HeaderValue {
+    new(primaryType, subType, charset, parameters) {
+      this[_primaryType] = primaryType;
+      this[_subType] = subType;
+      super.new("");
+      if (this[_primaryType] == null) this[_primaryType] = "";
+      if (this[_subType] == null) this[_subType] = "";
+      this[_value$1] = dart.str`${this[_primaryType]}/${this[_subType]}`;
+      if (parameters != null) {
+        this[_ensureParameters]();
+        parameters[dartx.forEach](dart.fn((key, value) => {
+          let lowerCaseKey = key[dartx.toLowerCase]();
+          if (lowerCaseKey == "charset") {
+            value = value[dartx.toLowerCase]();
+          }
+          this[_parameters][dartx._set](lowerCaseKey, value);
+        }, StringAndStringToNull()));
+      }
+      if (charset != null) {
+        this[_ensureParameters]();
+        this[_parameters][dartx._set]("charset", charset[dartx.toLowerCase]());
+      }
+    }
+    _() {
+      this[_primaryType] = "";
+      this[_subType] = "";
+      super.new();
+    }
+    static parse(value) {
+      let result = new io._ContentType._();
+      result[_parse](value, ";", null, false);
+      let index = result[_value$1][dartx.indexOf]("/");
+      if (index == -1 || index == dart.notNull(result[_value$1][dartx.length]) - 1) {
+        result[_primaryType] = result[_value$1][dartx.trim]()[dartx.toLowerCase]();
+        result[_subType] = "";
+      } else {
+        result[_primaryType] = result[_value$1][dartx.substring](0, index)[dartx.trim]()[dartx.toLowerCase]();
+        result[_subType] = result[_value$1][dartx.substring](dart.notNull(index) + 1)[dartx.trim]()[dartx.toLowerCase]();
+      }
+      return result;
+    }
+    get mimeType() {
+      return dart.str`${this.primaryType}/${this.subType}`;
+    }
+    get primaryType() {
+      return this[_primaryType];
+    }
+    get subType() {
+      return this[_subType];
+    }
+    get charset() {
+      return this.parameters[dartx._get]("charset");
+    }
+  };
+  dart.defineNamedConstructor(io._ContentType, '_');
+  io._ContentType[dart.implements] = () => [io.ContentType];
+  dart.setSignature(io._ContentType, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._ContentType, [core.String, core.String, core.String, MapOfString$String()]),
+      _: dart.definiteFunctionType(io._ContentType, [])
+    }),
+    fields: () => ({
+      [_primaryType]: core.String,
+      [_subType]: core.String
+    }),
+    getters: () => ({
+      mimeType: dart.definiteFunctionType(core.String, []),
+      primaryType: dart.definiteFunctionType(core.String, []),
+      subType: dart.definiteFunctionType(core.String, []),
+      charset: dart.definiteFunctionType(core.String, [])
+    }),
+    statics: () => ({parse: dart.definiteFunctionType(io._ContentType, [core.String])}),
+    names: ['parse']
+  });
+  const _validate = Symbol('_validate');
+  const _parseSetCookieValue = Symbol('_parseSetCookieValue');
+  let const$67;
+  io._Cookie = class _Cookie extends core.Object {
+    new(name, value) {
+      if (name === void 0) name = null;
+      if (value === void 0) value = null;
+      this.name = name;
+      this.value = value;
+      this.expires = null;
+      this.maxAge = null;
+      this.domain = null;
+      this.path = null;
+      this.httpOnly = false;
+      this.secure = false;
+      this.httpOnly = true;
+      this[_validate]();
+    }
+    fromSetCookieValue(value) {
+      this.name = null;
+      this.value = null;
+      this.expires = null;
+      this.maxAge = null;
+      this.domain = null;
+      this.path = null;
+      this.httpOnly = false;
+      this.secure = false;
+      this[_parseSetCookieValue](value);
+    }
+    [_parseSetCookieValue](s) {
+      let index = 0;
+      function done() {
+        return index == s[dartx.length];
+      }
+      dart.fn(done, VoidTobool());
+      function parseName() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == "=") break;
+          index++;
+        }
+        return s[dartx.substring](start, index)[dartx.trim]();
+      }
+      dart.fn(parseName, VoidToString$());
+      function parseValue() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == ";") break;
+          index++;
+        }
+        return s[dartx.substring](start, index)[dartx.trim]();
+      }
+      dart.fn(parseValue, VoidToString$());
+      function expect(expected) {
+        if (dart.test(done())) dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+        if (s[dartx._get](index) != expected) {
+          dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+        }
+        index++;
+      }
+      dart.fn(expect, StringTovoid$());
+      const parseAttributes = (function() {
+        function parseAttributeName() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == "=" || s[dartx._get](index) == ";") break;
+            index++;
+          }
+          return s[dartx.substring](start, index)[dartx.trim]()[dartx.toLowerCase]();
+        }
+        dart.fn(parseAttributeName, VoidToString$());
+        function parseAttributeValue() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == ";") break;
+            index++;
+          }
+          return s[dartx.substring](start, index)[dartx.trim]()[dartx.toLowerCase]();
+        }
+        dart.fn(parseAttributeValue, VoidToString$());
+        while (!dart.test(done())) {
+          let name = parseAttributeName();
+          let value = "";
+          if (!dart.test(done()) && s[dartx._get](index) == "=") {
+            index++;
+            value = parseAttributeValue();
+          }
+          if (name == "expires") {
+            this.expires = io.HttpDate._parseCookieDate(value);
+          } else if (name == "max-age") {
+            this.maxAge = core.int.parse(value);
+          } else if (name == "domain") {
+            this.domain = value;
+          } else if (name == "path") {
+            this.path = value;
+          } else if (name == "httponly") {
+            this.httpOnly = true;
+          } else if (name == "secure") {
+            this.secure = true;
+          }
+          if (!dart.test(done())) index++;
+        }
+      }).bind(this);
+      dart.fn(parseAttributes, VoidTovoid$());
+      this.name = parseName();
+      if (dart.test(done()) || this.name[dartx.length] == 0) {
+        dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+      }
+      index++;
+      this.value = parseValue();
+      this[_validate]();
+      if (dart.test(done())) return;
+      index++;
+      parseAttributes();
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write(this.name);
+      sb.write("=");
+      sb.write(this.value);
+      if (this.expires != null) {
+        sb.write("; Expires=");
+        sb.write(io.HttpDate.format(this.expires));
+      }
+      if (this.maxAge != null) {
+        sb.write("; Max-Age=");
+        sb.write(this.maxAge);
+      }
+      if (this.domain != null) {
+        sb.write("; Domain=");
+        sb.write(this.domain);
+      }
+      if (this.path != null) {
+        sb.write("; Path=");
+        sb.write(this.path);
+      }
+      if (dart.test(this.secure)) sb.write("; Secure");
+      if (dart.test(this.httpOnly)) sb.write("; HttpOnly");
+      return sb.toString();
+    }
+    [_validate]() {
+      let SEPERATORS = const$67 || (const$67 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
+      for (let i = 0; i < dart.notNull(this.name[dartx.length]); i++) {
+        let codeUnit = this.name[dartx.codeUnits][dartx._get](i);
+        if (dart.notNull(codeUnit) <= 32 || dart.notNull(codeUnit) >= 127 || dart.notNull(SEPERATORS[dartx.indexOf](this.name[dartx._get](i))) >= 0) {
+          dart.throw(new core.FormatException(dart.str`Invalid character in cookie name, code unit: '${codeUnit}'`));
+        }
+      }
+      for (let i = 0; i < dart.notNull(this.value[dartx.length]); i++) {
+        let codeUnit = this.value[dartx.codeUnits][dartx._get](i);
+        if (!(codeUnit == 33 || dart.notNull(codeUnit) >= 35 && dart.notNull(codeUnit) <= 43 || dart.notNull(codeUnit) >= 45 && dart.notNull(codeUnit) <= 58 || dart.notNull(codeUnit) >= 60 && dart.notNull(codeUnit) <= 91 || dart.notNull(codeUnit) >= 93 && dart.notNull(codeUnit) <= 126)) {
+          dart.throw(new core.FormatException(dart.str`Invalid character in cookie value, code unit: '${codeUnit}'`));
+        }
+      }
+    }
+  };
+  dart.defineNamedConstructor(io._Cookie, 'fromSetCookieValue');
+  io._Cookie[dart.implements] = () => [io.Cookie];
+  dart.setSignature(io._Cookie, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._Cookie, [], [core.String, core.String]),
+      fromSetCookieValue: dart.definiteFunctionType(io._Cookie, [core.String])
+    }),
+    fields: () => ({
+      name: core.String,
+      value: core.String,
+      expires: core.DateTime,
+      maxAge: core.int,
+      domain: core.String,
+      path: core.String,
+      httpOnly: core.bool,
+      secure: core.bool
+    }),
+    methods: () => ({
+      [_parseSetCookieValue]: dart.definiteFunctionType(dart.void, [core.String]),
+      [_validate]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._OUTGOING_BUFFER_SIZE = 8 * 1024;
+  const _transferLength = Symbol('_transferLength');
+  const _dataCompleter = Symbol('_dataCompleter');
+  const _stream$ = Symbol('_stream');
+  io._HttpIncoming = class _HttpIncoming extends async.Stream$(core.List$(core.int)) {
+    get transferLength() {
+      return this[_transferLength];
+    }
+    new(headers, transferLength, stream) {
+      this[_dataCompleter] = async.Completer.new();
+      this.headers = headers;
+      this[_transferLength] = transferLength;
+      this[_stream$] = stream;
+      this.fullBodyRead = false;
+      this.upgraded = false;
+      this.statusCode = null;
+      this.reasonPhrase = null;
+      this.method = null;
+      this.uri = null;
+      this.hasSubscriber = false;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      this.hasSubscriber = true;
+      return this[_stream$].handleError(dart.fn(error => {
+        dart.throw(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this.uri}));
+      }, dynamicToNull$())).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get dataDone() {
+      return this[_dataCompleter].future;
+    }
+    close(closing) {
+      this.fullBodyRead = true;
+      this.hasSubscriber = true;
+      this[_dataCompleter].complete(closing);
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpIncoming);
+  dart.setSignature(io._HttpIncoming, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpIncoming, [io._HttpHeaders, core.int, StreamOfListOfint()])}),
+    fields: () => ({
+      [_transferLength]: core.int,
+      [_dataCompleter]: async.Completer,
+      [_stream$]: StreamOfListOfint(),
+      fullBodyRead: core.bool,
+      headers: io._HttpHeaders,
+      upgraded: core.bool,
+      statusCode: core.int,
+      reasonPhrase: core.String,
+      method: core.String,
+      uri: core.Uri,
+      hasSubscriber: core.bool
+    }),
+    getters: () => ({
+      transferLength: dart.definiteFunctionType(core.int, []),
+      dataDone: dart.definiteFunctionType(async.Future, [])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(dart.void, [core.bool])
+    })
+  });
+  const _incoming = Symbol('_incoming');
+  const _cookies = Symbol('_cookies');
+  io._HttpInboundMessage = class _HttpInboundMessage extends async.Stream$(core.List$(core.int)) {
+    new(incoming) {
+      this[_incoming] = incoming;
+      this[_cookies] = null;
+      super.new();
+    }
+    get cookies() {
+      if (this[_cookies] != null) return this[_cookies];
+      return this[_cookies] = this.headers[_parseCookies]();
+    }
+    get headers() {
+      return this[_incoming].headers;
+    }
+    get protocolVersion() {
+      return this.headers.protocolVersion;
+    }
+    get contentLength() {
+      return this.headers.contentLength;
+    }
+    get persistentConnection() {
+      return this.headers.persistentConnection;
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpInboundMessage);
+  dart.setSignature(io._HttpInboundMessage, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpInboundMessage, [io._HttpIncoming])}),
+    fields: () => ({
+      [_incoming]: io._HttpIncoming,
+      [_cookies]: ListOfCookie()
+    }),
+    getters: () => ({
+      cookies: dart.definiteFunctionType(core.List$(io.Cookie), []),
+      headers: dart.definiteFunctionType(io._HttpHeaders, []),
+      protocolVersion: dart.definiteFunctionType(core.String, []),
+      contentLength: dart.definiteFunctionType(core.int, []),
+      persistentConnection: dart.definiteFunctionType(core.bool, [])
+    })
+  });
+  const _httpServer = Symbol('_httpServer');
+  const _httpConnection = Symbol('_httpConnection');
+  const _session = Symbol('_session');
+  const _requestedUri = Symbol('_requestedUri');
+  const _sessionManagerInstance = Symbol('_sessionManagerInstance');
+  const _sessionManager = Symbol('_sessionManager');
+  const _markSeen = Symbol('_markSeen');
+  const _socket = Symbol('_socket');
+  const _destroyed = Symbol('_destroyed');
+  io._HttpRequest = class _HttpRequest extends io._HttpInboundMessage {
+    new(response, _incoming, httpServer, httpConnection) {
+      this.response = response;
+      this[_httpServer] = httpServer;
+      this[_httpConnection] = httpConnection;
+      this[_session] = null;
+      this[_requestedUri] = null;
+      super.new(_incoming);
+      if (this.headers.protocolVersion == "1.1") {
+        let _ = this.response.headers;
+        _.chunkedTransferEncoding = true;
+        _.persistentConnection = this.headers.persistentConnection;
+      }
+      if (this[_httpServer][_sessionManagerInstance] != null) {
+        let sessionIds = this.cookies[dartx.where](dart.fn(cookie => cookie.name[dartx.toUpperCase]() == io._DART_SESSION_ID, CookieTobool()))[dartx.map](core.String)(dart.fn(cookie => cookie.value, CookieToString()));
+        for (let sessionId of sessionIds) {
+          this[_session] = this[_httpServer][_sessionManager].getSession(sessionId);
+          if (this[_session] != null) {
+            this[_session][_markSeen]();
+            break;
+          }
+        }
+      }
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get uri() {
+      return this[_incoming].uri;
+    }
+    get requestedUri() {
+      if (this[_requestedUri] == null) {
+        let proto = this.headers._get('x-forwarded-proto');
+        let scheme = proto != null ? proto[dartx.first] : io.SecureSocket.is(this[_httpConnection][_socket]) ? "https" : "http";
+        let hostList = this.headers._get('x-forwarded-host');
+        let host = null;
+        if (hostList != null) {
+          host = hostList[dartx.first];
+        } else {
+          hostList = this.headers._get('host');
+          if (hostList != null) {
+            host = hostList[dartx.first];
+          } else {
+            host = dart.str`${this[_httpServer].address.host}:${this[_httpServer].port}`;
+          }
+        }
+        this[_requestedUri] = core.Uri.parse(dart.str`${scheme}://${host}${this.uri}`);
+      }
+      return this[_requestedUri];
+    }
+    get method() {
+      return this[_incoming].method;
+    }
+    get session() {
+      if (this[_session] != null) {
+        if (dart.test(this[_session][_destroyed])) {
+          this[_session] = null;
+          return this.session;
+        }
+        return this[_session];
+      }
+      return this[_session] = this[_httpServer][_sessionManager].createSession();
+    }
+    get connectionInfo() {
+      return this[_httpConnection].connectionInfo;
+    }
+    get certificate() {
+      let socket = this[_httpConnection][_socket];
+      if (io.SecureSocket.is(socket)) return socket.peerCertificate;
+      return null;
+    }
+  };
+  io._HttpRequest[dart.implements] = () => [io.HttpRequest];
+  dart.setSignature(io._HttpRequest, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpRequest, [io.HttpResponse, io._HttpIncoming, io._HttpServer, io._HttpConnection])}),
+    fields: () => ({
+      response: io.HttpResponse,
+      [_httpServer]: io._HttpServer,
+      [_httpConnection]: io._HttpConnection,
+      [_session]: io._HttpSession,
+      [_requestedUri]: core.Uri
+    }),
+    getters: () => ({
+      uri: dart.definiteFunctionType(core.Uri, []),
+      requestedUri: dart.definiteFunctionType(core.Uri, []),
+      method: dart.definiteFunctionType(core.String, []),
+      session: dart.definiteFunctionType(io.HttpSession, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      certificate: dart.definiteFunctionType(io.X509Certificate, [])
+    }),
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+  });
+  const _responseRedirects = Symbol('_responseRedirects');
+  const _httpRequest = Symbol('_httpRequest');
+  const _httpClient = Symbol('_httpClient');
+  const _httpClientConnection = Symbol('_httpClientConnection');
+  const _openUrlFromRequest = Symbol('_openUrlFromRequest');
+  const _connectionClosed = Symbol('_connectionClosed');
+  const _shouldAuthenticateProxy = Symbol('_shouldAuthenticateProxy');
+  const _shouldAuthenticate = Symbol('_shouldAuthenticate');
+  const _proxy = Symbol('_proxy');
+  const _findProxyCredentials = Symbol('_findProxyCredentials');
+  const _findCredentials = Symbol('_findCredentials');
+  const _removeProxyCredentials = Symbol('_removeProxyCredentials');
+  const _removeCredentials = Symbol('_removeCredentials');
+  const _authenticateProxy = Symbol('_authenticateProxy');
+  const _authenticate = Symbol('_authenticate');
+  io._HttpClientResponse = class _HttpClientResponse extends io._HttpInboundMessage {
+    get redirects() {
+      return this[_httpRequest][_responseRedirects];
+    }
+    new(_incoming, httpRequest, httpClient) {
+      this[_httpRequest] = httpRequest;
+      this[_httpClient] = httpClient;
+      super.new(_incoming);
+      _incoming.uri = this[_httpRequest].uri;
+    }
+    get statusCode() {
+      return this[_incoming].statusCode;
+    }
+    get reasonPhrase() {
+      return this[_incoming].reasonPhrase;
+    }
+    get certificate() {
+      let socket = this[_httpRequest][_httpClientConnection][_socket];
+      if (io.SecureSocket.is(socket)) return socket.peerCertificate;
+      dart.throw(new core.UnsupportedError("Socket is not a SecureSocket"));
+    }
+    get cookies() {
+      if (this[_cookies] != null) return this[_cookies];
+      this[_cookies] = ListOfCookie().new();
+      let values = this.headers._get(io.HttpHeaders.SET_COOKIE);
+      if (values != null) {
+        values[dartx.forEach](dart.fn(value => {
+          this[_cookies][dartx.add](io.Cookie.fromSetCookieValue(value));
+        }, StringToNull()));
+      }
+      return this[_cookies];
+    }
+    get isRedirect() {
+      if (this[_httpRequest].method == "GET" || this[_httpRequest].method == "HEAD") {
+        return this.statusCode == io.HttpStatus.MOVED_PERMANENTLY || this.statusCode == io.HttpStatus.FOUND || this.statusCode == io.HttpStatus.SEE_OTHER || this.statusCode == io.HttpStatus.TEMPORARY_REDIRECT;
+      } else if (this[_httpRequest].method == "POST") {
+        return this.statusCode == io.HttpStatus.SEE_OTHER;
+      }
+      return false;
+    }
+    redirect(method, url, followLoops) {
+      if (method === void 0) method = null;
+      if (url === void 0) url = null;
+      if (followLoops === void 0) followLoops = null;
+      if (method == null) {
+        if (this.statusCode == io.HttpStatus.SEE_OTHER && this[_httpRequest].method == "POST") {
+          method = "GET";
+        } else {
+          method = this[_httpRequest].method;
+        }
+      }
+      if (url == null) {
+        let location = this.headers.value(io.HttpHeaders.LOCATION);
+        if (location == null) {
+          dart.throw(new core.StateError("Response has no Location header for redirect"));
+        }
+        url = core.Uri.parse(location);
+      }
+      if (followLoops != true) {
+        for (let redirect of this.redirects) {
+          if (dart.equals(redirect.location, url)) {
+            return FutureOfHttpClientResponse().error(new io.RedirectException("Redirect loop detected", this.redirects));
+          }
+        }
+      }
+      return this[_httpClient][_openUrlFromRequest](method, url, this[_httpRequest]).then(io.HttpClientResponse)(dart.fn(request => {
+        let _ = request[_responseRedirects];
+        _[dartx.addAll](this.redirects);
+        _[dartx.add](new io._RedirectInfo(this.statusCode, method, url));
+        return request.close();
+      }, _HttpClientRequestToFutureOfHttpClientResponse()));
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      if (dart.test(this[_incoming].upgraded)) {
+        this[_httpRequest][_httpClientConnection].destroy();
+        return StreamSubscriptionOfListOfint()._check(async.Stream.fromIterable([]).listen(null, {onDone: onDone}));
+      }
+      let stream = this[_incoming];
+      if (dart.test(this[_httpClient].autoUncompress) && this.headers.value(io.HttpHeaders.CONTENT_ENCODING) == "gzip") {
+        stream = io._HttpIncoming._check(stream.transform(ListOfint())(io.GZIP.decoder));
+      }
+      return stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    detachSocket() {
+      this[_httpClient][_connectionClosed](this[_httpRequest][_httpClientConnection]);
+      return this[_httpRequest][_httpClientConnection].detachSocket();
+    }
+    get connectionInfo() {
+      return this[_httpRequest].connectionInfo;
+    }
+    get [_shouldAuthenticateProxy]() {
+      let challenge = this.headers._get(io.HttpHeaders.PROXY_AUTHENTICATE);
+      return this.statusCode == io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED && challenge != null && challenge[dartx.length] == 1;
+    }
+    get [_shouldAuthenticate]() {
+      let challenge = this.headers._get(io.HttpHeaders.WWW_AUTHENTICATE);
+      return this.statusCode == io.HttpStatus.UNAUTHORIZED && challenge != null && challenge[dartx.length] == 1;
+    }
+    [_authenticate](proxyAuth) {
+      const retry = (function() {
+        return this.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => this[_httpClient][_openUrlFromRequest](this[_httpRequest].method, this[_httpRequest].uri, this[_httpRequest]).then(io.HttpClientResponse)(dart.fn(request => request.close(), _HttpClientRequestToFutureOfHttpClientResponse())), dynamicToFutureOfHttpClientResponse()));
+      }).bind(this);
+      dart.fn(retry, VoidToFutureOfHttpClientResponse());
+      const authChallenge = (function() {
+        return dart.test(proxyAuth) ? this.headers._get(io.HttpHeaders.PROXY_AUTHENTICATE) : this.headers._get(io.HttpHeaders.WWW_AUTHENTICATE);
+      }).bind(this);
+      dart.fn(authChallenge, VoidToListOfString());
+      const findCredentials = (function(scheme) {
+        return dart.test(proxyAuth) ? this[_httpClient][_findProxyCredentials](this[_httpRequest][_proxy], scheme) : this[_httpClient][_findCredentials](this[_httpRequest].uri, scheme);
+      }).bind(this);
+      dart.fn(findCredentials, _AuthenticationSchemeTo_Credentials());
+      const removeCredentials = (function(cr) {
+        if (dart.test(proxyAuth)) {
+          this[_httpClient][_removeProxyCredentials](cr);
+        } else {
+          this[_httpClient][_removeCredentials](cr);
+        }
+      }).bind(this);
+      dart.fn(removeCredentials, _CredentialsTovoid());
+      const requestAuthentication = (function(scheme, realm) {
+        if (dart.test(proxyAuth)) {
+          if (this[_httpClient][_authenticateProxy] == null) {
+            return async.Future.value(false);
+          }
+          let proxy = this[_httpRequest][_proxy];
+          return async.Future._check(dart.dsend(this[_httpClient], _authenticateProxy, proxy.host, proxy.port, dart.toString(scheme), realm));
+        } else {
+          if (this[_httpClient][_authenticate] == null) {
+            return async.Future.value(false);
+          }
+          return async.Future._check(dart.dsend(this[_httpClient], _authenticate, this[_httpRequest].uri, dart.toString(scheme), realm));
+        }
+      }).bind(this);
+      dart.fn(requestAuthentication, _AuthenticationSchemeAndStringToFuture());
+      let challenge = authChallenge();
+      dart.assert(challenge != null || challenge[dartx.length] == 1);
+      let header = io._HeaderValue.parse(challenge[dartx._get](0), {parameterSeparator: ","});
+      let scheme = io._AuthenticationScheme.fromString(header.value);
+      let realm = header.parameters[dartx._get]("realm");
+      let cr = findCredentials(scheme);
+      if (cr != null) {
+        if (dart.equals(cr.scheme, io._AuthenticationScheme.BASIC) && !dart.test(cr.used)) {
+          return retry();
+        }
+        if (dart.equals(cr.scheme, io._AuthenticationScheme.DIGEST) && (header.parameters[dartx._get]("algorithm") == null || header.parameters[dartx._get]("algorithm")[dartx.toLowerCase]() == "md5")) {
+          if (cr.nonce == null || cr.nonce == header.parameters[dartx._get]("nonce")) {
+            if (cr.nonce == null) {
+              let _ = cr;
+              _.nonce = header.parameters[dartx._get]("nonce");
+              _.algorithm = "MD5";
+              _.qop = header.parameters[dartx._get]("qop");
+              _.nonceCount = 0;
+            }
+            return retry();
+          } else if (header.parameters[dartx._get]("stale") != null && header.parameters[dartx._get]("stale")[dartx.toLowerCase]() == "true") {
+            cr.nonce = header.parameters[dartx._get]("nonce");
+            return retry();
+          }
+        }
+      }
+      if (cr != null) {
+        removeCredentials(cr);
+        cr = null;
+      }
+      return requestAuthentication(scheme, realm).then(io.HttpClientResponse)(dart.fn(credsAvailable => {
+        if (dart.test(credsAvailable)) {
+          cr = this[_httpClient][_findCredentials](this[_httpRequest].uri, scheme);
+          return retry();
+        } else {
+          return this;
+        }
+      }, dynamicToFutureOrOfHttpClientResponse()));
+    }
+  };
+  io._HttpClientResponse[dart.implements] = () => [io.HttpClientResponse];
+  dart.setSignature(io._HttpClientResponse, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientResponse, [io._HttpIncoming, io._HttpClientRequest, io._HttpClient])}),
+    fields: () => ({
+      [_httpClient]: io._HttpClient,
+      [_httpRequest]: io._HttpClientRequest
+    }),
+    getters: () => ({
+      redirects: dart.definiteFunctionType(core.List$(io.RedirectInfo), []),
+      statusCode: dart.definiteFunctionType(core.int, []),
+      reasonPhrase: dart.definiteFunctionType(core.String, []),
+      certificate: dart.definiteFunctionType(io.X509Certificate, []),
+      isRedirect: dart.definiteFunctionType(core.bool, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      [_shouldAuthenticateProxy]: dart.definiteFunctionType(core.bool, []),
+      [_shouldAuthenticate]: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      redirect: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [], [core.String, core.Uri, core.bool]),
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      [_authenticate]: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [core.bool])
+    })
+  });
+  const _uri = Symbol('_uri');
+  const _outgoing = Symbol('_outgoing');
+  const _encodingSet = Symbol('_encodingSet');
+  const _bufferOutput = Symbol('_bufferOutput');
+  const _encodingMutable = Symbol('_encodingMutable');
+  const _encoding = Symbol('_encoding');
+  const _isConnectionClosed = Symbol('_isConnectionClosed');
+  const _doneCompleter = Symbol('_doneCompleter');
+  const _target$ = Symbol('_target');
+  const _controllerInstance = Symbol('_controllerInstance');
+  const _controllerCompleter = Symbol('_controllerCompleter');
+  const _isClosed$0 = Symbol('_isClosed');
+  const _isBound = Symbol('_isBound');
+  const _hasError$ = Symbol('_hasError');
+  const _closeTarget = Symbol('_closeTarget');
+  const _completeDoneValue = Symbol('_completeDoneValue');
+  const _completeDoneError = Symbol('_completeDoneError');
+  io._StreamSinkImpl$ = dart.generic(T => {
+    let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
+    let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
+    let StreamSinkOfT = () => (StreamSinkOfT = dart.constFn(async.StreamSink$(T)))();
+    let StreamConsumerOfT = () => (StreamConsumerOfT = dart.constFn(async.StreamConsumer$(T)))();
+    class _StreamSinkImpl extends core.Object {
+      new(target) {
+        this[_doneCompleter] = async.Completer.new();
+        this[_target$] = target;
+        this[_controllerInstance] = null;
+        this[_controllerCompleter] = null;
+        this[_isClosed$0] = false;
+        this[_isBound] = false;
+        this[_hasError$] = false;
+      }
+      add(data) {
+        T._check(data);
+        if (dart.test(this[_isClosed$0])) return;
+        this[_controller$0].add(data);
+      }
+      addError(error, stackTrace) {
+        if (stackTrace === void 0) stackTrace = null;
+        this[_controller$0].addError(error, stackTrace);
+      }
+      addStream(stream) {
+        StreamOfT()._check(stream);
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is already bound to a stream"));
+        }
+        this[_isBound] = true;
+        if (dart.test(this[_hasError$])) return this.done;
+        const targetAddStream = (function() {
+          return this[_target$].addStream(stream).whenComplete(dart.fn(() => {
+            this[_isBound] = false;
+          }, VoidToNull()));
+        }).bind(this);
+        dart.fn(targetAddStream, VoidToFuture());
+        if (this[_controllerInstance] == null) return targetAddStream();
+        let future = this[_controllerCompleter].future;
+        this[_controllerInstance].close();
+        return future.then(dart.dynamic)(dart.fn(_ => targetAddStream(), dynamicToFuture()));
+      }
+      flush() {
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is bound to a stream"));
+        }
+        if (this[_controllerInstance] == null) return async.Future.value(this);
+        this[_isBound] = true;
+        let future = this[_controllerCompleter].future;
+        this[_controllerInstance].close();
+        return future.whenComplete(dart.fn(() => {
+          this[_isBound] = false;
+        }, VoidToNull()));
+      }
+      close() {
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is bound to a stream"));
+        }
+        if (!dart.test(this[_isClosed$0])) {
+          this[_isClosed$0] = true;
+          if (this[_controllerInstance] != null) {
+            this[_controllerInstance].close();
+          } else {
+            this[_closeTarget]();
+          }
+        }
+        return this.done;
+      }
+      [_closeTarget]() {
+        this[_target$].close().then(dart.void)(dart.bind(this, _completeDoneValue), {onError: dart.bind(this, _completeDoneError)});
+      }
+      get done() {
+        return this[_doneCompleter].future;
+      }
+      [_completeDoneValue](value) {
+        if (!dart.test(this[_doneCompleter].isCompleted)) {
+          this[_doneCompleter].complete(value);
+        }
+      }
+      [_completeDoneError](error, stackTrace) {
+        if (!dart.test(this[_doneCompleter].isCompleted)) {
+          this[_hasError$] = true;
+          this[_doneCompleter].completeError(error, stackTrace);
+        }
+      }
+      get [_controller$0]() {
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is bound to a stream"));
+        }
+        if (dart.test(this[_isClosed$0])) {
+          dart.throw(new core.StateError("StreamSink is closed"));
+        }
+        if (this[_controllerInstance] == null) {
+          this[_controllerInstance] = StreamControllerOfT().new({sync: true});
+          this[_controllerCompleter] = async.Completer.new();
+          this[_target$].addStream(this[_controller$0].stream).then(dart.dynamic)(dart.fn(_ => {
+            if (dart.test(this[_isBound])) {
+              this[_controllerCompleter].complete(this);
+              this[_controllerCompleter] = null;
+              this[_controllerInstance] = null;
+            } else {
+              this[_closeTarget]();
+            }
+          }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
+              if (dart.test(this[_isBound])) {
+                this[_controllerCompleter].completeError(error, core.StackTrace._check(stackTrace));
+                this[_controllerCompleter] = null;
+                this[_controllerInstance] = null;
+              } else {
+                this[_completeDoneError](error, core.StackTrace._check(stackTrace));
+              }
+            }, dynamicAnddynamicToNull())});
+        }
+        return this[_controllerInstance];
+      }
+    }
+    dart.addTypeTests(_StreamSinkImpl);
+    _StreamSinkImpl[dart.implements] = () => [StreamSinkOfT()];
+    dart.setSignature(_StreamSinkImpl, {
+      constructors: () => ({new: dart.definiteFunctionType(io._StreamSinkImpl$(T), [StreamConsumerOfT()])}),
+      fields: () => ({
+        [_target$]: StreamConsumerOfT(),
+        [_doneCompleter]: async.Completer,
+        [_controllerInstance]: StreamControllerOfT(),
+        [_controllerCompleter]: async.Completer,
+        [_isClosed$0]: core.bool,
+        [_isBound]: core.bool,
+        [_hasError$]: core.bool
+      }),
+      getters: () => ({
+        done: dart.definiteFunctionType(async.Future, []),
+        [_controller$0]: dart.definiteFunctionType(async.StreamController$(T), [])
+      }),
+      methods: () => ({
+        add: dart.definiteFunctionType(dart.void, [T]),
+        addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+        addStream: dart.definiteFunctionType(async.Future, [StreamOfT()]),
+        flush: dart.definiteFunctionType(async.Future, []),
+        close: dart.definiteFunctionType(async.Future, []),
+        [_closeTarget]: dart.definiteFunctionType(dart.void, []),
+        [_completeDoneValue]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+        [_completeDoneError]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])
+      })
+    });
+    return _StreamSinkImpl;
+  });
+  io._StreamSinkImpl = _StreamSinkImpl();
+  io._IOSinkImpl = class _IOSinkImpl extends io._StreamSinkImpl$(core.List$(core.int)) {
+    new(target, encoding) {
+      this[_encoding] = encoding;
+      this[_encodingMutable] = true;
+      super.new(target);
+    }
+    get encoding() {
+      return this[_encoding];
+    }
+    set encoding(value) {
+      if (!dart.test(this[_encodingMutable])) {
+        dart.throw(new core.StateError("IOSink encoding is not mutable"));
+      }
+      this[_encoding] = value;
+    }
+    write(obj) {
+      let string = dart.str`${obj}`;
+      if (dart.test(string[dartx.isEmpty])) return;
+      this.add(this[_encoding].encode(string));
+    }
+    writeAll(objects, separator) {
+      if (separator === void 0) separator = "";
+      let iterator = objects[dartx.iterator];
+      if (!dart.test(iterator.moveNext())) return;
+      if (dart.test(separator[dartx.isEmpty])) {
+        do {
+          this.write(iterator.current);
+        } while (dart.test(iterator.moveNext()));
+      } else {
+        this.write(iterator.current);
+        while (dart.test(iterator.moveNext())) {
+          this.write(separator);
+          this.write(iterator.current);
+        }
+      }
+    }
+    writeln(object) {
+      if (object === void 0) object = "";
+      this.write(object);
+      this.write("\n");
+    }
+    writeCharCode(charCode) {
+      this.write(core.String.fromCharCode(charCode));
+    }
+  };
+  dart.addSimpleTypeTests(io._IOSinkImpl);
+  io._IOSinkImpl[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io._IOSinkImpl, {
+    constructors: () => ({new: dart.definiteFunctionType(io._IOSinkImpl, [StreamConsumerOfListOfint(), convert.Encoding])}),
+    fields: () => ({
+      [_encoding]: convert.Encoding,
+      [_encodingMutable]: core.bool
+    }),
+    getters: () => ({encoding: dart.definiteFunctionType(convert.Encoding, [])}),
+    setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+    methods: () => ({
+      write: dart.definiteFunctionType(dart.void, [core.Object]),
+      writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+      writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+      writeCharCode: dart.definiteFunctionType(dart.void, [core.int])
+    })
+  });
+  io._HttpOutboundMessage$ = dart.generic(T => {
+    class _HttpOutboundMessage extends io._IOSinkImpl {
+      new(uri, protocolVersion, outgoing, opts) {
+        let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
+        this[_uri] = uri;
+        this.headers = new io._HttpHeaders(protocolVersion, {defaultPortForScheme: uri.scheme == 'https' ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT, initialHeaders: initialHeaders});
+        this[_outgoing] = outgoing;
+        this[_encodingSet] = false;
+        this[_bufferOutput] = true;
+        super.new(outgoing, null);
+        this[_outgoing].outbound = this;
+        this[_encodingMutable] = false;
+      }
+      get contentLength() {
+        return this.headers.contentLength;
+      }
+      set contentLength(contentLength) {
+        this.headers.contentLength = contentLength;
+      }
+      get persistentConnection() {
+        return this.headers.persistentConnection;
+      }
+      set persistentConnection(p) {
+        this.headers.persistentConnection = p;
+      }
+      get bufferOutput() {
+        return this[_bufferOutput];
+      }
+      set bufferOutput(bufferOutput) {
+        if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+        this[_bufferOutput] = bufferOutput;
+      }
+      get encoding() {
+        if (dart.test(this[_encodingSet]) && dart.test(this[_outgoing].headersWritten)) {
+          return this[_encoding];
+        }
+        let charset = null;
+        if (this.headers.contentType != null && this.headers.contentType.charset != null) {
+          charset = this.headers.contentType.charset;
+        } else {
+          charset = "iso-8859-1";
+        }
+        return convert.Encoding.getByName(core.String._check(charset));
+      }
+      set encoding(value) {
+        super.encoding = value;
+      }
+      add(data) {
+        if (data[dartx.length] == 0) return;
+        super.add(data);
+      }
+      write(obj) {
+        if (!dart.test(this[_encodingSet])) {
+          this[_encoding] = this.encoding;
+          this[_encodingSet] = true;
+        }
+        super.write(obj);
+      }
+      get [_isConnectionClosed]() {
+        return false;
+      }
+    }
+    dart.addTypeTests(_HttpOutboundMessage);
+    dart.setSignature(_HttpOutboundMessage, {
+      constructors: () => ({new: dart.definiteFunctionType(io._HttpOutboundMessage$(T), [core.Uri, core.String, io._HttpOutgoing], {initialHeaders: io._HttpHeaders})}),
+      fields: () => ({
+        [_encodingSet]: core.bool,
+        [_bufferOutput]: core.bool,
+        [_uri]: core.Uri,
+        [_outgoing]: io._HttpOutgoing,
+        headers: io._HttpHeaders
+      }),
+      getters: () => ({
+        contentLength: dart.definiteFunctionType(core.int, []),
+        persistentConnection: dart.definiteFunctionType(core.bool, []),
+        bufferOutput: dart.definiteFunctionType(core.bool, []),
+        [_isConnectionClosed]: dart.definiteFunctionType(core.bool, [])
+      }),
+      setters: () => ({
+        contentLength: dart.definiteFunctionType(dart.void, [core.int]),
+        persistentConnection: dart.definiteFunctionType(dart.void, [core.bool]),
+        bufferOutput: dart.definiteFunctionType(dart.void, [core.bool])
+      })
+    });
+    return _HttpOutboundMessage;
+  });
+  io._HttpOutboundMessage = _HttpOutboundMessage();
+  const _statusCode = Symbol('_statusCode');
+  const _reasonPhrase = Symbol('_reasonPhrase');
+  const _deadline = Symbol('_deadline');
+  const _deadlineTimer = Symbol('_deadlineTimer');
+  const _isClosing = Symbol('_isClosing');
+  const _findReasonPhrase = Symbol('_findReasonPhrase');
+  const _isNew = Symbol('_isNew');
+  const _writeHeader = Symbol('_writeHeader');
+  io._HttpResponse = class _HttpResponse extends io._HttpOutboundMessage$(io.HttpResponse) {
+    new(uri, protocolVersion, outgoing, defaultHeaders, serverHeader) {
+      this[_statusCode] = 200;
+      this[_reasonPhrase] = null;
+      this[_cookies] = null;
+      this[_httpRequest] = null;
+      this[_deadline] = null;
+      this[_deadlineTimer] = null;
+      super.new(uri, protocolVersion, outgoing, {initialHeaders: io._HttpHeaders._check(defaultHeaders)});
+      if (serverHeader != null) this.headers.set('server', serverHeader);
+    }
+    get [_isConnectionClosed]() {
+      return this[_httpRequest][_httpConnection][_isClosing];
+    }
+    get cookies() {
+      if (this[_cookies] == null) this[_cookies] = ListOfCookie().new();
+      return this[_cookies];
+    }
+    get statusCode() {
+      return this[_statusCode];
+    }
+    set statusCode(statusCode) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this[_statusCode] = statusCode;
+    }
+    get reasonPhrase() {
+      return this[_findReasonPhrase](this.statusCode);
+    }
+    set reasonPhrase(reasonPhrase) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this[_reasonPhrase] = reasonPhrase;
+    }
+    redirect(location, opts) {
+      let status = opts && 'status' in opts ? opts.status : io.HttpStatus.MOVED_TEMPORARILY;
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this.statusCode = status;
+      this.headers.set("location", dart.toString(location));
+      return this.close();
+    }
+    detachSocket(opts) {
+      let writeHeaders = opts && 'writeHeaders' in opts ? opts.writeHeaders : true;
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Headers already sent"));
+      this.deadline = null;
+      let future = this[_httpRequest][_httpConnection].detachSocket();
+      if (dart.test(writeHeaders)) {
+        let headersFuture = this[_outgoing].writeHeaders({drainRequest: false, setOutgoing: false});
+        dart.assert(headersFuture == null);
+      } else {
+        this[_outgoing].headersWritten = true;
+      }
+      this.close();
+      this.done.catchError(dart.fn(_ => {
+      }, dynamicToNull$()));
+      return future;
+    }
+    get connectionInfo() {
+      return this[_httpRequest].connectionInfo;
+    }
+    get deadline() {
+      return this[_deadline];
+    }
+    set deadline(d) {
+      if (this[_deadlineTimer] != null) this[_deadlineTimer].cancel();
+      this[_deadline] = d;
+      if (this[_deadline] == null) return;
+      this[_deadlineTimer] = async.Timer.new(this[_deadline], dart.fn(() => {
+        this[_httpRequest][_httpConnection].destroy();
+      }, VoidToNull()));
+    }
+    [_writeHeader]() {
+      let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+      let offset = 0;
+      function write(bytes) {
+        let len = bytes[dartx.length];
+        for (let i = 0; i < dart.notNull(len); i++) {
+          buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+        }
+        offset = dart.notNull(offset) + dart.notNull(len);
+      }
+      dart.fn(write, ListOfintTovoid$());
+      if (this.headers.protocolVersion == "1.1") {
+        write(io._Const.HTTP11);
+      } else {
+        write(io._Const.HTTP10);
+      }
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(dart.toString(this.statusCode)[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(this.reasonPhrase[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      let session = this[_httpRequest][_session];
+      if (session != null && !dart.test(session[_destroyed])) {
+        session[_isNew] = false;
+        let found = false;
+        for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
+          if (this.cookies[dartx._get](i).name[dartx.toUpperCase]() == io._DART_SESSION_ID) {
+            let _ = this.cookies[dartx._get](i);
+            _.value = session.id;
+            _.httpOnly = true;
+            _.path = "/";
+            found = true;
+          }
+        }
+        if (!found) {
+          let cookie = io.Cookie.new(io._DART_SESSION_ID, session.id);
+          this.cookies[dartx.add](((() => {
+            cookie.httpOnly = true;
+            cookie.path = "/";
+            return cookie;
+          })()));
+        }
+      }
+      if (this[_cookies] != null) {
+        this[_cookies][dartx.forEach](dart.fn(cookie => {
+          this.headers.add(io.HttpHeaders.SET_COOKIE, cookie);
+        }, CookieToNull()));
+      }
+      this.headers[_finalize]();
+      offset = this.headers[_write](buffer, offset);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      this[_outgoing].setHeader(buffer, offset);
+    }
+    [_findReasonPhrase](statusCode) {
+      if (this[_reasonPhrase] != null) {
+        return this[_reasonPhrase];
+      }
+      switch (statusCode) {
+        case io.HttpStatus.CONTINUE:
+        {
+          return "Continue";
+        }
+        case io.HttpStatus.SWITCHING_PROTOCOLS:
+        {
+          return "Switching Protocols";
+        }
+        case io.HttpStatus.OK:
+        {
+          return "OK";
+        }
+        case io.HttpStatus.CREATED:
+        {
+          return "Created";
+        }
+        case io.HttpStatus.ACCEPTED:
+        {
+          return "Accepted";
+        }
+        case io.HttpStatus.NON_AUTHORITATIVE_INFORMATION:
+        {
+          return "Non-Authoritative Information";
+        }
+        case io.HttpStatus.NO_CONTENT:
+        {
+          return "No Content";
+        }
+        case io.HttpStatus.RESET_CONTENT:
+        {
+          return "Reset Content";
+        }
+        case io.HttpStatus.PARTIAL_CONTENT:
+        {
+          return "Partial Content";
+        }
+        case io.HttpStatus.MULTIPLE_CHOICES:
+        {
+          return "Multiple Choices";
+        }
+        case io.HttpStatus.MOVED_PERMANENTLY:
+        {
+          return "Moved Permanently";
+        }
+        case io.HttpStatus.FOUND:
+        {
+          return "Found";
+        }
+        case io.HttpStatus.SEE_OTHER:
+        {
+          return "See Other";
+        }
+        case io.HttpStatus.NOT_MODIFIED:
+        {
+          return "Not Modified";
+        }
+        case io.HttpStatus.USE_PROXY:
+        {
+          return "Use Proxy";
+        }
+        case io.HttpStatus.TEMPORARY_REDIRECT:
+        {
+          return "Temporary Redirect";
+        }
+        case io.HttpStatus.BAD_REQUEST:
+        {
+          return "Bad Request";
+        }
+        case io.HttpStatus.UNAUTHORIZED:
+        {
+          return "Unauthorized";
+        }
+        case io.HttpStatus.PAYMENT_REQUIRED:
+        {
+          return "Payment Required";
+        }
+        case io.HttpStatus.FORBIDDEN:
+        {
+          return "Forbidden";
+        }
+        case io.HttpStatus.NOT_FOUND:
+        {
+          return "Not Found";
+        }
+        case io.HttpStatus.METHOD_NOT_ALLOWED:
+        {
+          return "Method Not Allowed";
+        }
+        case io.HttpStatus.NOT_ACCEPTABLE:
+        {
+          return "Not Acceptable";
+        }
+        case io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED:
+        {
+          return "Proxy Authentication Required";
+        }
+        case io.HttpStatus.REQUEST_TIMEOUT:
+        {
+          return "Request Time-out";
+        }
+        case io.HttpStatus.CONFLICT:
+        {
+          return "Conflict";
+        }
+        case io.HttpStatus.GONE:
+        {
+          return "Gone";
+        }
+        case io.HttpStatus.LENGTH_REQUIRED:
+        {
+          return "Length Required";
+        }
+        case io.HttpStatus.PRECONDITION_FAILED:
+        {
+          return "Precondition Failed";
+        }
+        case io.HttpStatus.REQUEST_ENTITY_TOO_LARGE:
+        {
+          return "Request Entity Too Large";
+        }
+        case io.HttpStatus.REQUEST_URI_TOO_LONG:
+        {
+          return "Request-URI Too Large";
+        }
+        case io.HttpStatus.UNSUPPORTED_MEDIA_TYPE:
+        {
+          return "Unsupported Media Type";
+        }
+        case io.HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE:
+        {
+          return "Requested range not satisfiable";
+        }
+        case io.HttpStatus.EXPECTATION_FAILED:
+        {
+          return "Expectation Failed";
+        }
+        case io.HttpStatus.INTERNAL_SERVER_ERROR:
+        {
+          return "Internal Server Error";
+        }
+        case io.HttpStatus.NOT_IMPLEMENTED:
+        {
+          return "Not Implemented";
+        }
+        case io.HttpStatus.BAD_GATEWAY:
+        {
+          return "Bad Gateway";
+        }
+        case io.HttpStatus.SERVICE_UNAVAILABLE:
+        {
+          return "Service Unavailable";
+        }
+        case io.HttpStatus.GATEWAY_TIMEOUT:
+        {
+          return "Gateway Time-out";
+        }
+        case io.HttpStatus.HTTP_VERSION_NOT_SUPPORTED:
+        {
+          return "Http Version not supported";
+        }
+        default:
+        {
+          return dart.str`Status ${statusCode}`;
+        }
+      }
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpResponse);
+  io._HttpResponse[dart.implements] = () => [io.HttpResponse];
+  dart.setSignature(io._HttpResponse, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpResponse, [core.Uri, core.String, io._HttpOutgoing, io.HttpHeaders, core.String])}),
+    fields: () => ({
+      [_statusCode]: core.int,
+      [_reasonPhrase]: core.String,
+      [_cookies]: ListOfCookie(),
+      [_httpRequest]: io._HttpRequest,
+      [_deadline]: core.Duration,
+      [_deadlineTimer]: async.Timer
+    }),
+    getters: () => ({
+      cookies: dart.definiteFunctionType(core.List$(io.Cookie), []),
+      statusCode: dart.definiteFunctionType(core.int, []),
+      reasonPhrase: dart.definiteFunctionType(core.String, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      deadline: dart.definiteFunctionType(core.Duration, [])
+    }),
+    setters: () => ({
+      statusCode: dart.definiteFunctionType(dart.void, [core.int]),
+      reasonPhrase: dart.definiteFunctionType(dart.void, [core.String]),
+      deadline: dart.definiteFunctionType(dart.void, [core.Duration])
+    }),
+    methods: () => ({
+      redirect: dart.definiteFunctionType(async.Future, [core.Uri], {status: core.int}),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), [], {writeHeaders: core.bool}),
+      [_writeHeader]: dart.definiteFunctionType(dart.void, []),
+      [_findReasonPhrase]: dart.definiteFunctionType(core.String, [core.int])
+    })
+  });
+  const _responseCompleter = Symbol('_responseCompleter');
+  const _response = Symbol('_response');
+  const _followRedirects = Symbol('_followRedirects');
+  const _maxRedirects = Symbol('_maxRedirects');
+  const _onIncoming = Symbol('_onIncoming');
+  const _onError$ = Symbol('_onError');
+  const _proxyTunnel = Symbol('_proxyTunnel');
+  const _requestUri = Symbol('_requestUri');
+  io._HttpClientRequest = class _HttpClientRequest extends io._HttpOutboundMessage$(io.HttpClientResponse) {
+    new(outgoing, uri, method, proxy, httpClient, httpClientConnection) {
+      this.cookies = ListOfCookie().new();
+      this[_responseCompleter] = CompleterOfHttpClientResponse().new();
+      this[_responseRedirects] = JSArrayOfRedirectInfo().of([]);
+      this.method = method;
+      this[_proxy] = proxy;
+      this[_httpClient] = httpClient;
+      this[_httpClientConnection] = httpClientConnection;
+      this.uri = uri;
+      this[_response] = null;
+      this[_followRedirects] = true;
+      this[_maxRedirects] = 5;
+      super.new(uri, "1.1", outgoing);
+      if (this.method == "GET" || this.method == "HEAD") {
+        this.contentLength = 0;
+      } else {
+        this.headers.chunkedTransferEncoding = true;
+      }
+    }
+    get done() {
+      if (this[_response] == null) {
+        this[_response] = async.Future.wait(dart.dynamic)(JSArrayOfFuture().of([this[_responseCompleter].future, super.done]), {eagerError: true}).then(io.HttpClientResponse)(dart.fn(list => FutureOrOfHttpClientResponse()._check(list[dartx._get](0)), ListToFutureOrOfHttpClientResponse()));
+      }
+      return this[_response];
+    }
+    close() {
+      super.close();
+      return this.done;
+    }
+    get maxRedirects() {
+      return this[_maxRedirects];
+    }
+    set maxRedirects(maxRedirects) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Request already sent"));
+      this[_maxRedirects] = maxRedirects;
+    }
+    get followRedirects() {
+      return this[_followRedirects];
+    }
+    set followRedirects(followRedirects) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Request already sent"));
+      this[_followRedirects] = followRedirects;
+    }
+    get connectionInfo() {
+      return this[_httpClientConnection].connectionInfo;
+    }
+    [_onIncoming](incoming) {
+      let response = new io._HttpClientResponse(incoming, this, this[_httpClient]);
+      let future = null;
+      if (dart.test(this.followRedirects) && dart.test(response.isRedirect)) {
+        if (dart.notNull(response.redirects[dartx.length]) < dart.notNull(this.maxRedirects)) {
+          future = response.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => response.redirect(), dynamicToFutureOfHttpClientResponse()));
+        } else {
+          future = response.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => FutureOfHttpClientResponse().error(new io.RedirectException("Redirect limit exceeded", response.redirects)), dynamicToFutureOfHttpClientResponse()));
+        }
+      } else if (dart.test(response[_shouldAuthenticateProxy])) {
+        future = response[_authenticate](true);
+      } else if (dart.test(response[_shouldAuthenticate])) {
+        future = response[_authenticate](false);
+      } else {
+        future = FutureOfHttpClientResponse().value(response);
+      }
+      future.then(dart.void)(dart.fn(v => this[_responseCompleter].complete(v), HttpClientResponseTovoid()), {onError: dart.bind(this[_responseCompleter], 'completeError')});
+    }
+    [_onError$](error, stackTrace) {
+      this[_responseCompleter].completeError(error, stackTrace);
+    }
+    [_requestUri]() {
+      const uriStartingFromPath = (function() {
+        let result = this.uri.path;
+        if (dart.test(result[dartx.isEmpty])) result = "/";
+        if (dart.test(this.uri.hasQuery)) {
+          result = dart.str`${result}?${this.uri.query}`;
+        }
+        return result;
+      }).bind(this);
+      dart.fn(uriStartingFromPath, VoidToString$());
+      if (dart.test(this[_proxy].isDirect)) {
+        return uriStartingFromPath();
+      } else {
+        if (this.method == "CONNECT") {
+          return dart.str`${this.uri.host}:${this.uri.port}`;
+        } else {
+          if (dart.test(this[_httpClientConnection][_proxyTunnel])) {
+            return uriStartingFromPath();
+          } else {
+            return dart.toString(this.uri.removeFragment());
+          }
+        }
+      }
+    }
+    [_writeHeader]() {
+      let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+      let offset = 0;
+      function write(bytes) {
+        let len = bytes[dartx.length];
+        for (let i = 0; i < dart.notNull(len); i++) {
+          buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+        }
+        offset = dart.notNull(offset) + dart.notNull(len);
+      }
+      dart.fn(write, ListOfintTovoid$());
+      write(this.method[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(this[_requestUri]()[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(io._Const.HTTP11);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      if (!dart.test(this.cookies[dartx.isEmpty])) {
+        let sb = new core.StringBuffer();
+        for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
+          if (i > 0) sb.write("; ");
+          sb.write(this.cookies[dartx._get](i).name);
+          sb.write("=");
+          sb.write(this.cookies[dartx._get](i).value);
+        }
+        this.headers.add(io.HttpHeaders.COOKIE, sb.toString());
+      }
+      this.headers[_finalize]();
+      offset = this.headers[_write](buffer, offset);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      this[_outgoing].setHeader(buffer, offset);
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpClientRequest);
+  io._HttpClientRequest[dart.implements] = () => [io.HttpClientRequest];
+  dart.setSignature(io._HttpClientRequest, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientRequest, [io._HttpOutgoing, core.Uri, core.String, io._Proxy, io._HttpClient, io._HttpClientConnection])}),
+    fields: () => ({
+      method: core.String,
+      uri: core.Uri,
+      cookies: ListOfCookie(),
+      [_httpClient]: io._HttpClient,
+      [_httpClientConnection]: io._HttpClientConnection,
+      [_responseCompleter]: CompleterOfHttpClientResponse(),
+      [_proxy]: io._Proxy,
+      [_response]: FutureOfHttpClientResponse(),
+      [_followRedirects]: core.bool,
+      [_maxRedirects]: core.int,
+      [_responseRedirects]: ListOfRedirectInfo()
+    }),
+    getters: () => ({
+      done: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), []),
+      maxRedirects: dart.definiteFunctionType(core.int, []),
+      followRedirects: dart.definiteFunctionType(core.bool, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])
+    }),
+    setters: () => ({
+      maxRedirects: dart.definiteFunctionType(dart.void, [core.int]),
+      followRedirects: dart.definiteFunctionType(dart.void, [core.bool])
+    }),
+    methods: () => ({
+      close: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), []),
+      [_onIncoming]: dart.definiteFunctionType(dart.void, [io._HttpIncoming]),
+      [_onError$]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
+      [_requestUri]: dart.definiteFunctionType(core.String, []),
+      [_writeHeader]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _consume = Symbol('_consume');
+  io._HttpGZipSink = class _HttpGZipSink extends convert.ByteConversionSink {
+    new(consume) {
+      this[_consume] = consume;
+      super.new();
+    }
+    add(chunk) {
+      dart.dcall(this[_consume], chunk);
+    }
+    addSlice(chunk, start, end, isLast) {
+      if (typed_data.Uint8List.is(chunk)) {
+        dart.dcall(this[_consume], typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+      } else {
+        dart.dcall(this[_consume], chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
+      }
+    }
+    close() {}
+  };
+  dart.setSignature(io._HttpGZipSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpGZipSink, [core.Function])}),
+    fields: () => ({[_consume]: core.Function}),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+      close: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _closeFuture = Symbol('_closeFuture');
+  const _pendingChunkedFooter = Symbol('_pendingChunkedFooter');
+  const _bytesWritten = Symbol('_bytesWritten');
+  const _gzip = Symbol('_gzip');
+  const _gzipSink = Symbol('_gzipSink');
+  const _gzipAdd = Symbol('_gzipAdd');
+  const _gzipBuffer = Symbol('_gzipBuffer');
+  const _gzipBufferLength = Symbol('_gzipBufferLength');
+  const _socketError = Symbol('_socketError');
+  const _addGZipChunk = Symbol('_addGZipChunk');
+  const _addChunk$ = Symbol('_addChunk');
+  const _chunkHeader = Symbol('_chunkHeader');
+  const _ignoreError = Symbol('_ignoreError');
+  let const$68;
+  io._HttpOutgoing = class _HttpOutgoing extends core.Object {
+    new(socket) {
+      this[_doneCompleter] = async.Completer.new();
+      this.socket = socket;
+      this.ignoreBody = false;
+      this.headersWritten = false;
+      this[_buffer$] = null;
+      this[_length$2] = 0;
+      this[_closeFuture] = null;
+      this.chunked = false;
+      this[_pendingChunkedFooter] = 0;
+      this.contentLength = null;
+      this[_bytesWritten] = 0;
+      this[_gzip] = false;
+      this[_gzipSink] = null;
+      this[_gzipAdd] = null;
+      this[_gzipBuffer] = null;
+      this[_gzipBufferLength] = 0;
+      this[_socketError] = false;
+      this.outbound = null;
+    }
+    writeHeaders(opts) {
+      let drainRequest = opts && 'drainRequest' in opts ? opts.drainRequest : true;
+      let setOutgoing = opts && 'setOutgoing' in opts ? opts.setOutgoing : true;
+      const write = (function() {
+        try {
+          this.outbound[_writeHeader]();
+        } catch (_) {
+          return async.Future.error(new io.HttpException(dart.str`Headers size exceeded the of '${io._OUTGOING_BUFFER_SIZE}'` + " bytes"));
+        }
+
+        return null;
+      }).bind(this);
+      dart.fn(write, VoidToFuture());
+      if (dart.test(this.headersWritten)) return null;
+      this.headersWritten = true;
+      let drainFuture = null;
+      let gzip = false;
+      if (io._HttpResponse.is(this.outbound)) {
+        let response = io._HttpResponse._check(this.outbound);
+        if (dart.test(response[_httpRequest][_httpServer].autoCompress) && dart.test(this.outbound.bufferOutput) && dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+          let acceptEncodings = response[_httpRequest].headers._get(io.HttpHeaders.ACCEPT_ENCODING);
+          let contentEncoding = this.outbound.headers._get(io.HttpHeaders.CONTENT_ENCODING);
+          if (acceptEncodings != null && dart.test(acceptEncodings[dartx.expand](dart.dynamic)(dart.fn(list => core.Iterable._check(dart.dsend(list, 'split', ",")), dynamicToIterable()))[dartx.any](dart.fn(encoding => dart.equals(dart.dsend(dart.dsend(encoding, 'trim'), 'toLowerCase'), "gzip"), dynamicTobool$()))) && contentEncoding == null) {
+            this.outbound.headers.set(io.HttpHeaders.CONTENT_ENCODING, "gzip");
+            gzip = true;
+          }
+        }
+        if (dart.test(drainRequest) && !dart.test(response[_httpRequest][_incoming].hasSubscriber)) {
+          drainFuture = response[_httpRequest].drain(dart.dynamic)().catchError(dart.fn(_ => {
+          }, dynamicToNull$()));
+        }
+      } else {
+        drainRequest = false;
+      }
+      if (dart.test(this.ignoreBody)) {
+        return write();
+      }
+      if (dart.test(setOutgoing)) {
+        let contentLength = this.outbound.headers.contentLength;
+        if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+          this.chunked = true;
+          if (gzip) this.gzip = true;
+        } else if (dart.notNull(contentLength) >= 0) {
+          this.contentLength = contentLength;
+        }
+      }
+      if (drainFuture != null) {
+        return drainFuture.then(dart.dynamic)(dart.fn(_ => write(), dynamicToFuture()));
+      }
+      return write();
+    }
+    addStream(stream) {
+      if (dart.test(this[_socketError])) {
+        stream.listen(null).cancel();
+        return async.Future.value(this.outbound);
+      }
+      if (dart.test(this.ignoreBody)) {
+        stream.drain(dart.dynamic)().catchError(dart.fn(_ => {
+        }, dynamicToNull$()));
+        let future = this.writeHeaders();
+        if (future != null) {
+          return future.then(dart.dynamic)(dart.fn(_ => this.close(), dynamicToFuture()));
+        }
+        return this.close();
+      }
+      let sub = null;
+      let controller = async.StreamController.new({onPause: dart.fn(() => dart.dsend(sub, 'pause'), VoidTovoid$()), onResume: dart.fn(() => dart.dsend(sub, 'resume'), VoidTovoid$()), sync: true});
+      const onData = (function(data) {
+        if (dart.test(this[_socketError])) return;
+        if (dart.equals(dart.dload(data, 'length'), 0)) return;
+        if (dart.test(this.chunked)) {
+          if (dart.test(this[_gzip])) {
+            this[_gzipAdd] = dart.bind(controller, 'add');
+            this[_addGZipChunk](data, dart.bind(this[_gzipSink], 'add'));
+            this[_gzipAdd] = null;
+            return;
+          }
+          this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), dart.bind(controller, 'add'));
+          this[_pendingChunkedFooter] = 2;
+        } else {
+          if (this.contentLength != null) {
+            this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(core.num._check(dart.dload(data, 'length')));
+            if (dart.notNull(this[_bytesWritten]) > dart.notNull(this.contentLength)) {
+              controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(IterableOfint()._check(data))}]`));
+              return;
+            }
+          }
+        }
+        this[_addChunk$](data, dart.bind(controller, 'add'));
+      }).bind(this);
+      dart.fn(onData, dynamicTovoid$());
+      sub = stream.listen(onData, {onError: dart.bind(controller, 'addError'), onDone: dart.bind(controller, 'close'), cancelOnError: true});
+      if (!dart.test(this.headersWritten)) {
+        let future = this.writeHeaders();
+        if (future != null) {
+          dart.dsend(sub, 'pause', future);
+        }
+      }
+      return this.socket.addStream(StreamOfListOfint()._check(controller.stream)).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+          if (dart.test(this[_gzip])) this[_gzipSink].close();
+          this[_socketError] = true;
+          this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
+          if (dart.test(this[_ignoreError](error))) {
+            return this.outbound;
+          } else {
+            dart.throw(error);
+          }
+        }, dynamicAnddynamicTo_HttpOutboundMessage())});
+    }
+    close() {
+      if (this[_closeFuture] != null) return this[_closeFuture];
+      if (dart.test(this[_socketError])) return async.Future.value(this.outbound);
+      if (dart.test(this.outbound[_isConnectionClosed])) return async.Future.value(this.outbound);
+      if (!dart.test(this.headersWritten) && !dart.test(this.ignoreBody)) {
+        if (this.outbound.headers.contentLength == -1) {
+          this.outbound.headers.chunkedTransferEncoding = false;
+          this.outbound.headers.contentLength = 0;
+        } else if (dart.notNull(this.outbound.headers.contentLength) > 0) {
+          let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri]});
+          this[_doneCompleter].completeError(error);
+          return this[_closeFuture] = async.Future.error(error);
+        }
+      }
+      if (this.contentLength != null) {
+        if (dart.notNull(this[_bytesWritten]) < dart.notNull(this.contentLength)) {
+          let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri]});
+          this[_doneCompleter].completeError(error);
+          return this[_closeFuture] = async.Future.error(error);
+        }
+      }
+      const finalize = (function() {
+        if (dart.test(this.chunked)) {
+          if (dart.test(this[_gzip])) {
+            this[_gzipAdd] = dart.bind(this.socket, 'add');
+            if (dart.notNull(this[_gzipBufferLength]) > 0) {
+              this[_gzipSink].add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
+            }
+            this[_gzipBuffer] = null;
+            this[_gzipSink].close();
+            this[_gzipAdd] = null;
+          }
+          this[_addChunk$](this[_chunkHeader](0), dart.bind(this.socket, 'add'));
+        }
+        if (dart.notNull(this[_length$2]) > 0) {
+          this.socket.add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+        }
+        this[_buffer$] = null;
+        return this.socket.flush().then(io._HttpOutboundMessage)(dart.fn(_ => {
+          this[_doneCompleter].complete(this.socket);
+          return this.outbound;
+        }, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+            this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
+            if (dart.test(this[_ignoreError](error))) {
+              return this.outbound;
+            } else {
+              dart.throw(error);
+            }
+          }, dynamicAnddynamicTo_HttpOutboundMessage())});
+      }).bind(this);
+      dart.fn(finalize, VoidToFuture());
+      let future = this.writeHeaders();
+      if (future != null) {
+        return this[_closeFuture] = future.whenComplete(finalize);
+      }
+      return this[_closeFuture] = finalize();
+    }
+    get done() {
+      return this[_doneCompleter].future;
+    }
+    setHeader(data, length) {
+      dart.assert(this[_length$2] == 0);
+      dart.assert(data[dartx.length] == io._OUTGOING_BUFFER_SIZE);
+      this[_buffer$] = typed_data.Uint8List._check(data);
+      this[_length$2] = length;
+    }
+    set gzip(value) {
+      this[_gzip] = value;
+      if (dart.test(this[_gzip])) {
+        this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+        dart.assert(this[_gzipSink] == null);
+        this[_gzipSink] = new io.ZLibEncoder({gzip: true}).startChunkedConversion(new io._HttpGZipSink(dart.fn(data => {
+          if (this[_gzipAdd] == null) return;
+          this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), ListOfintTovoid()._check(this[_gzipAdd]));
+          this[_pendingChunkedFooter] = 2;
+          this[_addChunk$](data, ListOfintTovoid()._check(this[_gzipAdd]));
+        }, dynamicToNull$())));
+      }
+    }
+    [_ignoreError](error) {
+      return (io.SocketException.is(error) || io.TlsException.is(error)) && io.HttpResponse.is(this.outbound);
+    }
+    [_addGZipChunk](chunk, add) {
+      if (!dart.test(this.outbound.bufferOutput)) {
+        add(ListOfint()._check(chunk));
+        return;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])))) {
+        add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
+        this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+        this[_gzipBufferLength] = 0;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
+        add(ListOfint()._check(chunk));
+      } else {
+        this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.asInt(dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
+        this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+      }
+    }
+    [_addChunk$](chunk, add) {
+      if (!dart.test(this.outbound.bufferOutput)) {
+        if (this[_buffer$] != null) {
+          add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+          this[_buffer$] = null;
+          this[_length$2] = 0;
+        }
+        add(ListOfint()._check(chunk));
+        return;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])))) {
+        add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+        this[_buffer$] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+        this[_length$2] = 0;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
+        add(ListOfint()._check(chunk));
+      } else {
+        this[_buffer$][dartx.setRange](this[_length$2], dart.asInt(dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
+        this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+      }
+    }
+    [_chunkHeader](length) {
+      let hexDigits = const$68 || (const$68 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
+      if (length == 0) {
+        if (this[_pendingChunkedFooter] == 2) return io._HttpOutgoing._footerAndChunk0Length;
+        return io._HttpOutgoing._chunk0Length;
+      }
+      let size = this[_pendingChunkedFooter];
+      let len = length;
+      while (dart.notNull(len) > 0) {
+        size = dart.notNull(size) + 1;
+        len = len[dartx['>>']](4);
+      }
+      let footerAndHeader = typed_data.Uint8List.new(dart.notNull(size) + 2);
+      if (this[_pendingChunkedFooter] == 2) {
+        footerAndHeader[dartx._set](0, io._CharCode.CR);
+        footerAndHeader[dartx._set](1, io._CharCode.LF);
+      }
+      let index = size;
+      while (dart.notNull(index) > dart.notNull(this[_pendingChunkedFooter])) {
+        footerAndHeader[dartx._set]((index = dart.notNull(index) - 1), hexDigits[dartx._get](dart.notNull(length) & 15));
+        length = length[dartx['>>']](4);
+      }
+      footerAndHeader[dartx._set](dart.notNull(size) + 0, io._CharCode.CR);
+      footerAndHeader[dartx._set](dart.notNull(size) + 1, io._CharCode.LF);
+      return footerAndHeader;
+    }
+  };
+  io._HttpOutgoing[dart.implements] = () => [StreamConsumerOfListOfint()];
+  dart.setSignature(io._HttpOutgoing, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpOutgoing, [io.Socket])}),
+    fields: () => ({
+      [_doneCompleter]: async.Completer,
+      socket: io.Socket,
+      ignoreBody: core.bool,
+      headersWritten: core.bool,
+      [_buffer$]: typed_data.Uint8List,
+      [_length$2]: core.int,
+      [_closeFuture]: async.Future,
+      chunked: core.bool,
+      [_pendingChunkedFooter]: core.int,
+      contentLength: core.int,
+      [_bytesWritten]: core.int,
+      [_gzip]: core.bool,
+      [_gzipSink]: convert.ByteConversionSink,
+      [_gzipAdd]: core.Function,
+      [_gzipBuffer]: typed_data.Uint8List,
+      [_gzipBufferLength]: core.int,
+      [_socketError]: core.bool,
+      outbound: io._HttpOutboundMessage
+    }),
+    getters: () => ({done: dart.definiteFunctionType(async.Future, [])}),
+    setters: () => ({gzip: dart.definiteFunctionType(dart.void, [core.bool])}),
+    methods: () => ({
+      writeHeaders: dart.definiteFunctionType(async.Future, [], {drainRequest: core.bool, setOutgoing: core.bool}),
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+      close: dart.definiteFunctionType(async.Future, []),
+      setHeader: dart.definiteFunctionType(dart.void, [ListOfint(), core.int]),
+      [_ignoreError]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+      [_addGZipChunk]: dart.definiteFunctionType(dart.void, [dart.dynamic, ListOfintTovoid()]),
+      [_addChunk$]: dart.definiteFunctionType(dart.void, [dart.dynamic, ListOfintTovoid()]),
+      [_chunkHeader]: dart.definiteFunctionType(core.List$(core.int), [core.int])
+    }),
+    sfields: () => ({
+      _footerAndChunk0Length: ListOfint(),
+      _chunk0Length: ListOfint()
+    })
+  });
+  dart.defineLazy(io._HttpOutgoing, {
+    get _footerAndChunk0Length() {
+      return dart.constList([io._CharCode.CR, io._CharCode.LF, 48, io._CharCode.CR, io._CharCode.LF, io._CharCode.CR, io._CharCode.LF], core.int);
+    },
+    get _chunk0Length() {
+      return dart.constList([48, io._CharCode.CR, io._CharCode.LF, io._CharCode.CR, io._CharCode.LF], core.int);
+    }
+  });
+  const _context = Symbol('_context');
+  const _httpParser = Symbol('_httpParser');
+  const _subscription$ = Symbol('_subscription');
+  const _dispose = Symbol('_dispose');
+  const _idleTimer = Symbol('_idleTimer');
+  const _currentUri = Symbol('_currentUri');
+  const _nextResponseCompleter = Symbol('_nextResponseCompleter');
+  const _streamFuture = Symbol('_streamFuture');
+  const _proxyCredentials = Symbol('_proxyCredentials');
+  const _returnConnection = Symbol('_returnConnection');
+  io._HttpClientConnection = class _HttpClientConnection extends core.Object {
+    new(key, socket, httpClient, proxyTunnel, context) {
+      if (proxyTunnel === void 0) proxyTunnel = false;
+      if (context === void 0) context = null;
+      this.key = key;
+      this[_socket] = socket;
+      this[_httpClient] = httpClient;
+      this[_proxyTunnel] = proxyTunnel;
+      this[_context] = context;
+      this[_httpParser] = io._HttpParser.responseParser();
+      this[_subscription$] = null;
+      this[_dispose] = false;
+      this[_idleTimer] = null;
+      this.closed = false;
+      this[_currentUri] = null;
+      this[_nextResponseCompleter] = null;
+      this[_streamFuture] = null;
+      this[_httpParser].listenToStream(this[_socket]);
+      this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
+        this[_subscription$].pause();
+        if (this[_nextResponseCompleter] == null) {
+          dart.throw(new io.HttpException("Unexpected response (unsolicited response without request).", {uri: this[_currentUri]}));
+        }
+        if (incoming.statusCode == 100) {
+          incoming.drain(dart.dynamic)().then(dart.dynamic)(dart.fn(_ => {
+            this[_subscription$].resume();
+          }, dynamicToNull$())).catchError(dart.fn((error, stackTrace) => {
+            if (stackTrace === void 0) stackTrace = null;
+            this[_nextResponseCompleter].completeError(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this[_currentUri]}), stackTrace);
+            this[_nextResponseCompleter] = null;
+          }, dynamic__ToNull$()));
+        } else {
+          this[_nextResponseCompleter].complete(incoming);
+          this[_nextResponseCompleter] = null;
+        }
+      }, _HttpIncomingToNull()), {onError: dart.fn((error, stackTrace) => {
+          if (stackTrace === void 0) stackTrace = null;
+          if (this[_nextResponseCompleter] != null) {
+            this[_nextResponseCompleter].completeError(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this[_currentUri]}), stackTrace);
+            this[_nextResponseCompleter] = null;
+          }
+        }, dynamic__ToNull$()), onDone: dart.fn(() => {
+          if (this[_nextResponseCompleter] != null) {
+            this[_nextResponseCompleter].completeError(new io.HttpException("Connection closed before response was received", {uri: this[_currentUri]}));
+            this[_nextResponseCompleter] = null;
+          }
+          this.close();
+        }, VoidToNull())});
+    }
+    send(uri, port, method, proxy) {
+      if (dart.test(this.closed)) {
+        dart.throw(new io.HttpException("Socket closed before request was sent", {uri: uri}));
+      }
+      this[_currentUri] = uri;
+      this[_subscription$].pause();
+      let proxyCreds = null;
+      let creds = null;
+      let outgoing = new io._HttpOutgoing(this[_socket]);
+      let request = new io._HttpClientRequest(outgoing, uri, method, proxy, this[_httpClient], this);
+      let host = uri.host;
+      if (dart.test(host[dartx.contains](':'))) host = dart.str`[${host}]`;
+      request.headers.host = host;
+      request.headers.port = port;
+      request.headers[_add$2](io.HttpHeaders.ACCEPT_ENCODING, "gzip");
+      if (this[_httpClient].userAgent != null) {
+        request.headers[_add$2]('user-agent', this[_httpClient].userAgent);
+      }
+      if (dart.test(proxy.isAuthenticated)) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${proxy.username}:${proxy.password}`));
+        request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
+      } else if (!dart.test(proxy.isDirect) && dart.notNull(this[_httpClient][_proxyCredentials][dartx.length]) > 0) {
+        proxyCreds = this[_httpClient][_findProxyCredentials](proxy);
+        if (proxyCreds != null) {
+          proxyCreds.authorize(request);
+        }
+      }
+      if (uri.userInfo != null && !dart.test(uri.userInfo[dartx.isEmpty])) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(uri.userInfo));
+        request.headers.set(io.HttpHeaders.AUTHORIZATION, dart.str`Basic ${auth}`);
+      } else {
+        creds = this[_httpClient][_findCredentials](uri);
+        if (creds != null) {
+          creds.authorize(request);
+        }
+      }
+      this[_httpParser].isHead = method == "HEAD";
+      this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(s => {
+        this[_nextResponseCompleter] = CompleterOf_HttpIncoming().new();
+        this[_nextResponseCompleter].future.then(dart.dynamic)(dart.fn(incoming => {
+          this[_currentUri] = null;
+          incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
+            if (dart.test(incoming.upgraded)) {
+              this[_httpClient][_connectionClosed](this);
+              this.startTimer();
+              return;
+            }
+            if (dart.test(this.closed)) return;
+            if (!dart.test(closing) && !dart.test(this[_dispose]) && dart.test(incoming.headers.persistentConnection) && dart.test(request.persistentConnection)) {
+              this[_httpClient][_returnConnection](this);
+              this[_subscription$].resume();
+            } else {
+              this.destroy();
+            }
+          }, dynamicToNull$()));
+          if (proxyCreds != null && dart.equals(proxyCreds.scheme, io._AuthenticationScheme.DIGEST)) {
+            let authInfo = incoming.headers._get("proxy-authentication-info");
+            if (authInfo != null && authInfo[dartx.length] == 1) {
+              let header = io._HeaderValue.parse(authInfo[dartx._get](0), {parameterSeparator: ','});
+              let nextnonce = header.parameters[dartx._get]("nextnonce");
+              if (nextnonce != null) proxyCreds.nonce = nextnonce;
+            }
+          }
+          if (creds != null && dart.equals(creds.scheme, io._AuthenticationScheme.DIGEST)) {
+            let authInfo = incoming.headers._get("authentication-info");
+            if (authInfo != null && authInfo[dartx.length] == 1) {
+              let header = io._HeaderValue.parse(authInfo[dartx._get](0), {parameterSeparator: ','});
+              let nextnonce = header.parameters[dartx._get]("nextnonce");
+              if (nextnonce != null) creds.nonce = nextnonce;
+            }
+          }
+          request[_onIncoming](incoming);
+        }, _HttpIncomingToNull())).catchError(dart.fn(error => {
+          dart.throw(new io.HttpException("Connection closed before data was received", {uri: uri}));
+        }, dynamicToNull$()), {test: dart.fn(error => core.StateError.is(error), ObjectTobool())}).catchError(dart.fn((error, stackTrace) => {
+          this.destroy();
+          request[_onError$](error, core.StackTrace._check(stackTrace));
+        }, dynamicAnddynamicToNull()));
+        this[_subscription$].resume();
+        return s;
+      }, dynamicTodynamic$()), {onError: dart.fn(e => {
+          this.destroy();
+        }, dynamicToNull$())});
+      return request;
+    }
+    detachSocket() {
+      return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), dynamicTo_DetachedSocket()));
+    }
+    destroy() {
+      this.closed = true;
+      this[_httpClient][_connectionClosed](this);
+      this[_socket].destroy();
+    }
+    close() {
+      this.closed = true;
+      this[_httpClient][_connectionClosed](this);
+      this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), dynamicTovoid$()));
+    }
+    createProxyTunnel(host, port, proxy, callback) {
+      let request = this.send(core.Uri.new({host: core.String._check(host), port: core.int._check(port)}), core.int._check(port), "CONNECT", io._Proxy._check(proxy));
+      if (dart.test(dart.dload(proxy, 'isAuthenticated'))) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${dart.dload(proxy, 'username')}:${dart.dload(proxy, 'password')}`));
+        request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
+      }
+      return request.close().then(io.SecureSocket)(dart.fn(response => {
+        if (response.statusCode != io.HttpStatus.OK) {
+          dart.throw("Proxy failed to establish tunnel " + dart.str`(${response.statusCode} ${response.reasonPhrase})`);
+        }
+        let socket = io._HttpClientResponse.as(response)[_httpRequest][_httpClientConnection][_socket];
+        return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: X509CertificateTobool()._check(callback)});
+      }, HttpClientResponseToFutureOfSecureSocket())).then(io._HttpClientConnection)(dart.fn(secureSocket => {
+        let key = core.String._check(io._HttpClientConnection.makeKey(true, core.String._check(host), core.int._check(port)));
+        return new io._HttpClientConnection(key, secureSocket, request[_httpClient], true);
+      }, SecureSocketTo_HttpClientConnection()));
+    }
+    get connectionInfo() {
+      return io._HttpConnectionInfo.create(this[_socket]);
+    }
+    static makeKey(isSecure, host, port) {
+      return dart.test(isSecure) ? dart.str`ssh:${host}:${port}` : dart.str`${host}:${port}`;
+    }
+    stopTimer() {
+      if (this[_idleTimer] != null) {
+        this[_idleTimer].cancel();
+        this[_idleTimer] = null;
+      }
+    }
+    startTimer() {
+      dart.assert(this[_idleTimer] == null);
+      this[_idleTimer] = async.Timer.new(this[_httpClient].idleTimeout, dart.fn(() => {
+        this[_idleTimer] = null;
+        this.close();
+      }, VoidToNull()));
+    }
+  };
+  dart.setSignature(io._HttpClientConnection, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientConnection, [core.String, io.Socket, io._HttpClient], [core.bool, io.SecurityContext])}),
+    fields: () => ({
+      key: core.String,
+      [_socket]: io.Socket,
+      [_proxyTunnel]: core.bool,
+      [_context]: io.SecurityContext,
+      [_httpParser]: io._HttpParser,
+      [_subscription$]: async.StreamSubscription,
+      [_httpClient]: io._HttpClient,
+      [_dispose]: core.bool,
+      [_idleTimer]: async.Timer,
+      closed: core.bool,
+      [_currentUri]: core.Uri,
+      [_nextResponseCompleter]: CompleterOf_HttpIncoming(),
+      [_streamFuture]: async.Future
+    }),
+    getters: () => ({connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])}),
+    methods: () => ({
+      send: dart.definiteFunctionType(io._HttpClientRequest, [core.Uri, core.int, core.String, io._Proxy]),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      destroy: dart.definiteFunctionType(dart.void, []),
+      close: dart.definiteFunctionType(dart.void, []),
+      createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]),
+      stopTimer: dart.definiteFunctionType(dart.void, []),
+      startTimer: dart.definiteFunctionType(dart.void, [])
+    }),
+    statics: () => ({makeKey: dart.definiteFunctionType(dart.dynamic, [core.bool, core.String, core.int])}),
+    names: ['makeKey']
+  });
+  io._ConnectionInfo = class _ConnectionInfo extends core.Object {
+    new(connection, proxy) {
+      this.connection = connection;
+      this.proxy = proxy;
+    }
+  };
+  dart.setSignature(io._ConnectionInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ConnectionInfo, [io._HttpClientConnection, io._Proxy])}),
+    fields: () => ({
+      connection: io._HttpClientConnection,
+      proxy: io._Proxy
+    })
+  });
+  const _idle = Symbol('_idle');
+  const _active = Symbol('_active');
+  const _pending$ = Symbol('_pending');
+  const _connecting = Symbol('_connecting');
+  const _checkPending = Symbol('_checkPending');
+  const _connectionsChanged = Symbol('_connectionsChanged');
+  const _badCertificateCallback = Symbol('_badCertificateCallback');
+  const _getConnectionTarget = Symbol('_getConnectionTarget');
+  io._ConnectionTarget = class _ConnectionTarget extends core.Object {
+    new(key, host, port, isSecure, context) {
+      this[_idle] = HashSetOf_HttpClientConnection().new();
+      this[_active] = HashSetOf_HttpClientConnection().new();
+      this[_pending$] = new collection.ListQueue();
+      this.key = key;
+      this.host = host;
+      this.port = port;
+      this.isSecure = isSecure;
+      this.context = context;
+      this[_connecting] = 0;
+    }
+    get isEmpty() {
+      return dart.test(this[_idle].isEmpty) && dart.test(this[_active].isEmpty) && this[_connecting] == 0;
+    }
+    get hasIdle() {
+      return this[_idle].isNotEmpty;
+    }
+    get hasActive() {
+      return dart.test(this[_active].isNotEmpty) || dart.notNull(this[_connecting]) > 0;
+    }
+    takeIdle() {
+      dart.assert(this.hasIdle);
+      let connection = this[_idle].first;
+      this[_idle].remove(connection);
+      connection.stopTimer();
+      this[_active].add(connection);
+      return connection;
+    }
+    [_checkPending]() {
+      if (dart.test(this[_pending$].isNotEmpty)) {
+        dart.dcall(this[_pending$].removeFirst());
+      }
+    }
+    addNewActive(connection) {
+      this[_active].add(connection);
+    }
+    returnConnection(connection) {
+      dart.assert(this[_active].contains(connection));
+      this[_active].remove(connection);
+      this[_idle].add(connection);
+      connection.startTimer();
+      this[_checkPending]();
+    }
+    connectionClosed(connection) {
+      dart.assert(!dart.test(this[_active].contains(connection)) || !dart.test(this[_idle].contains(connection)));
+      this[_active].remove(connection);
+      this[_idle].remove(connection);
+      this[_checkPending]();
+    }
+    close(force) {
+      for (let c of this[_idle].toList()) {
+        c.close();
+      }
+      if (dart.test(force)) {
+        for (let c of this[_active].toList()) {
+          c.destroy();
+        }
+      }
+    }
+    connect(uriHost, uriPort, proxy, client) {
+      if (dart.test(this.hasIdle)) {
+        let connection = this.takeIdle();
+        client[_connectionsChanged]();
+        return FutureOf_ConnectionInfo().value(new io._ConnectionInfo(connection, proxy));
+      }
+      if (client.maxConnectionsPerHost != null && dart.notNull(this[_active].length) + dart.notNull(this[_connecting]) >= dart.notNull(client.maxConnectionsPerHost)) {
+        let completer = async.Completer.new();
+        this[_pending$].add(dart.fn(() => {
+          this.connect(uriHost, uriPort, proxy, client).then(dart.void)(dart.bind(completer, 'complete'), {onError: dart.bind(completer, 'completeError')});
+        }, VoidToNull()));
+        return FutureOf_ConnectionInfo()._check(completer.future);
+      }
+      let currentBadCertificateCallback = client[_badCertificateCallback];
+      function callback(certificate) {
+        if (currentBadCertificateCallback == null) return false;
+        return currentBadCertificateCallback(certificate, uriHost, uriPort);
+      }
+      dart.fn(callback, X509CertificateTobool$());
+      let socketFuture = dart.test(this.isSecure) && dart.test(proxy.isDirect) ? io.SecureSocket.connect(this.host, this.port, {context: this.context, onBadCertificate: callback}) : io.Socket.connect(this.host, this.port);
+      this[_connecting] = dart.notNull(this[_connecting]) + 1;
+      return socketFuture.then(io._ConnectionInfo)(dart.fn(socket => {
+        this[_connecting] = dart.notNull(this[_connecting]) - 1;
+        dart.dsend(socket, 'setOption', io.SocketOption.TCP_NODELAY, true);
+        let connection = new io._HttpClientConnection(this.key, io.Socket._check(socket), client, false, this.context);
+        if (dart.test(this.isSecure) && !dart.test(proxy.isDirect)) {
+          connection[_dispose] = true;
+          return connection.createProxyTunnel(uriHost, uriPort, proxy, callback).then(io._ConnectionInfo)(dart.fn(tunnel => {
+            client[_getConnectionTarget](uriHost, uriPort, true).addNewActive(tunnel);
+            return new io._ConnectionInfo(tunnel, proxy);
+          }, _HttpClientConnectionTo_ConnectionInfo()));
+        } else {
+          this.addNewActive(connection);
+          return new io._ConnectionInfo(connection, proxy);
+        }
+      }, dynamicToFutureOrOf_ConnectionInfo()), {onError: dart.fn(error => {
+          this[_connecting] = dart.notNull(this[_connecting]) - 1;
+          this[_checkPending]();
+          dart.throw(error);
+        }, dynamicToNull$())});
+    }
+  };
+  dart.setSignature(io._ConnectionTarget, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ConnectionTarget, [core.String, core.String, core.int, core.bool, io.SecurityContext])}),
+    fields: () => ({
+      key: core.String,
+      host: core.String,
+      port: core.int,
+      isSecure: core.bool,
+      context: io.SecurityContext,
+      [_idle]: SetOf_HttpClientConnection(),
+      [_active]: SetOf_HttpClientConnection(),
+      [_pending$]: collection.Queue,
+      [_connecting]: core.int
+    }),
+    getters: () => ({
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      hasIdle: dart.definiteFunctionType(core.bool, []),
+      hasActive: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      takeIdle: dart.definiteFunctionType(io._HttpClientConnection, []),
+      [_checkPending]: dart.definiteFunctionType(dart.dynamic, []),
+      addNewActive: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      returnConnection: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      connectionClosed: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      close: dart.definiteFunctionType(dart.void, [core.bool]),
+      connect: dart.definiteFunctionType(async.Future$(io._ConnectionInfo), [core.String, core.int, io._Proxy, io._HttpClient])
+    })
+  });
+  io.BadCertificateCallback = dart.typedef('BadCertificateCallback', () => dart.functionType(core.bool, [io.X509Certificate, core.String, core.int]));
+  const _idleTimeout = Symbol('_idleTimeout');
+  let const$69;
+  const _connectionTargets = Symbol('_connectionTargets');
+  const _credentials = Symbol('_credentials');
+  const _closing = Symbol('_closing');
+  const _closingForcefully = Symbol('_closingForcefully');
+  const _findProxy = Symbol('_findProxy');
+  const _openUrl = Symbol('_openUrl');
+  const _closeConnections = Symbol('_closeConnections');
+  let const$70;
+  const _getConnection = Symbol('_getConnection');
+  io._HttpClient = class _HttpClient extends core.Object {
+    get idleTimeout() {
+      return this[_idleTimeout];
+    }
+    new(context) {
+      this[_connectionTargets] = HashMapOfString$_ConnectionTarget().new();
+      this[_credentials] = JSArrayOf_Credentials().of([]);
+      this[_proxyCredentials] = JSArrayOf_ProxyCredentials().of([]);
+      this.userAgent = io._getHttpVersion();
+      this[_context] = context;
+      this[_closing] = false;
+      this[_closingForcefully] = false;
+      this[_authenticate] = null;
+      this[_authenticateProxy] = null;
+      this[_findProxy] = io.HttpClient.findProxyFromEnvironment;
+      this[_idleTimeout] = const$69 || (const$69 = dart.const(new core.Duration({seconds: 15})));
+      this[_badCertificateCallback] = null;
+      this.maxConnectionsPerHost = null;
+      this.autoUncompress = true;
+    }
+    set idleTimeout(timeout) {
+      this[_idleTimeout] = timeout;
+      for (let c of this[_connectionTargets][dartx.values]) {
+        for (let idle of c[_idle]) {
+          idle.stopTimer();
+          idle.startTimer();
+        }
+      }
+    }
+    set badCertificateCallback(callback) {
+      this[_badCertificateCallback] = callback;
+    }
+    open(method, host, port, path) {
+      let hashMark = 35;
+      let questionMark = 63;
+      let fragmentStart = path[dartx.length];
+      let queryStart = path[dartx.length];
+      for (let i = dart.notNull(path[dartx.length]) - 1; i >= 0; i--) {
+        let char = path[dartx.codeUnitAt](i);
+        if (char == hashMark) {
+          fragmentStart = i;
+          queryStart = i;
+        } else if (char == questionMark) {
+          queryStart = i;
+        }
+      }
+      let query = null;
+      if (dart.notNull(queryStart) < dart.notNull(fragmentStart)) {
+        query = path[dartx.substring](dart.notNull(queryStart) + 1, fragmentStart);
+        path = path[dartx.substring](0, queryStart);
+      }
+      let uri = core.Uri.new({scheme: "http", host: host, port: port, path: path, query: query});
+      return this[_openUrl](method, uri);
+    }
+    openUrl(method, url) {
+      return this[_openUrl](method, url);
+    }
+    get(host, port, path) {
+      return this.open("get", host, port, path);
+    }
+    getUrl(url) {
+      return this[_openUrl]("get", url);
+    }
+    post(host, port, path) {
+      return this.open("post", host, port, path);
+    }
+    postUrl(url) {
+      return this[_openUrl]("post", url);
+    }
+    put(host, port, path) {
+      return this.open("put", host, port, path);
+    }
+    putUrl(url) {
+      return this[_openUrl]("put", url);
+    }
+    delete(host, port, path) {
+      return this.open("delete", host, port, path);
+    }
+    deleteUrl(url) {
+      return this[_openUrl]("delete", url);
+    }
+    head(host, port, path) {
+      return this.open("head", host, port, path);
+    }
+    headUrl(url) {
+      return this[_openUrl]("head", url);
+    }
+    patch(host, port, path) {
+      return this.open("patch", host, port, path);
+    }
+    patchUrl(url) {
+      return this[_openUrl]("patch", url);
+    }
+    close(opts) {
+      let force = opts && 'force' in opts ? opts.force : false;
+      this[_closing] = true;
+      this[_closingForcefully] = force;
+      this[_closeConnections](this[_closingForcefully]);
+      dart.assert(!dart.test(this[_connectionTargets][dartx.values][dartx.any](dart.fn(s => s.hasIdle, _ConnectionTargetTobool()))));
+      dart.assert(!dart.test(force) || !dart.test(this[_connectionTargets][dartx.values][dartx.any](dart.fn(s => s[_active].isNotEmpty, _ConnectionTargetTobool()))));
+    }
+    set authenticate(f) {
+      this[_authenticate] = f;
+    }
+    addCredentials(url, realm, cr) {
+      this[_credentials][dartx.add](new io._SiteCredentials(url, realm, io._HttpClientCredentials._check(cr)));
+    }
+    set authenticateProxy(f) {
+      this[_authenticateProxy] = f;
+    }
+    addProxyCredentials(host, port, realm, cr) {
+      this[_proxyCredentials][dartx.add](new io._ProxyCredentials(host, port, realm, io._HttpClientCredentials._check(cr)));
+    }
+    set findProxy(f) {
+      return this[_findProxy] = f;
+    }
+    [_openUrl](method, uri) {
+      uri = uri.removeFragment();
+      if (method == null) {
+        dart.throw(new core.ArgumentError(method));
+      }
+      if (method != "CONNECT") {
+        if (dart.test(uri.host[dartx.isEmpty])) {
+          dart.throw(new core.ArgumentError(dart.str`No host specified in URI ${uri}`));
+        } else if (uri.scheme != "http" && uri.scheme != "https") {
+          dart.throw(new core.ArgumentError(dart.str`Unsupported scheme '${uri.scheme}' in URI ${uri}`));
+        }
+      }
+      let isSecure = uri.scheme == "https";
+      let port = uri.port;
+      if (port == 0) {
+        port = isSecure ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT;
+      }
+      let proxyConf = const$70 || (const$70 = dart.const(new io._ProxyConfiguration.direct()));
+      if (this[_findProxy] != null) {
+        try {
+          proxyConf = new io._ProxyConfiguration(core.String._check(dart.dcall(this[_findProxy], uri)));
+        } catch (error) {
+          let stackTrace = dart.stackTrace(error);
+          return FutureOf_HttpClientRequest().error(error, stackTrace);
+        }
+
+      }
+      return this[_getConnection](uri.host, port, proxyConf, isSecure).then(io._HttpClientRequest)(dart.fn(info => {
+        function send(info) {
+          return info.connection.send(uri, port, method[dartx.toUpperCase](), info.proxy);
+        }
+        dart.fn(send, _ConnectionInfoTo_HttpClientRequest());
+        if (dart.test(info.connection.closed)) {
+          return this[_getConnection](uri.host, port, proxyConf, isSecure).then(io._HttpClientRequest)(send);
+        }
+        return send(info);
+      }, _ConnectionInfoToFutureOrOf_HttpClientRequest()));
+    }
+    [_openUrlFromRequest](method, uri, previous) {
+      let resolved = previous.uri.resolveUri(uri);
+      return this[_openUrl](method, resolved).then(io._HttpClientRequest)(dart.fn(request => {
+        request.followRedirects = previous.followRedirects;
+        request.maxRedirects = previous.maxRedirects;
+        for (let header of previous.headers[_headers][dartx.keys]) {
+          if (request.headers._get(header) == null) {
+            request.headers.set(header, previous.headers._get(header));
+          }
+        }
+        request.headers.chunkedTransferEncoding = false;
+        request.contentLength = 0;
+        return request;
+      }, _HttpClientRequestTo_HttpClientRequest()));
+    }
+    [_returnConnection](connection) {
+      this[_connectionTargets][dartx._get](connection.key).returnConnection(connection);
+      this[_connectionsChanged]();
+    }
+    [_connectionClosed](connection) {
+      connection.stopTimer();
+      let connectionTarget = this[_connectionTargets][dartx._get](connection.key);
+      if (connectionTarget != null) {
+        connectionTarget.connectionClosed(connection);
+        if (dart.test(connectionTarget.isEmpty)) {
+          this[_connectionTargets][dartx.remove](connection.key);
+        }
+        this[_connectionsChanged]();
+      }
+    }
+    [_connectionsChanged]() {
+      if (dart.test(this[_closing])) {
+        this[_closeConnections](this[_closingForcefully]);
+      }
+    }
+    [_closeConnections](force) {
+      for (let connectionTarget of this[_connectionTargets][dartx.values][dartx.toList]()) {
+        connectionTarget.close(force);
+      }
+    }
+    [_getConnectionTarget](host, port, isSecure) {
+      let key = core.String._check(io._HttpClientConnection.makeKey(isSecure, host, port));
+      return this[_connectionTargets][dartx.putIfAbsent](key, dart.fn(() => new io._ConnectionTarget(key, host, port, isSecure, this[_context]), VoidTo_ConnectionTarget()));
+    }
+    [_getConnection](uriHost, uriPort, proxyConf, isSecure) {
+      let proxies = proxyConf.proxies[dartx.iterator];
+      const connect = (function(error) {
+        if (!dart.test(proxies.moveNext())) return FutureOf_ConnectionInfo().error(error);
+        let proxy = proxies.current;
+        let host = dart.test(proxy.isDirect) ? uriHost : proxy.host;
+        let port = dart.test(proxy.isDirect) ? uriPort : proxy.port;
+        return this[_getConnectionTarget](host, port, isSecure).connect(uriHost, uriPort, proxy, this).catchError(connect);
+      }).bind(this);
+      dart.fn(connect, dynamicToFutureOf_ConnectionInfo());
+      return FutureOf_ConnectionInfo().new(dart.fn(() => connect(new io.HttpException("No proxies given")), VoidToFutureOf_ConnectionInfo()));
+    }
+    [_findCredentials](url, scheme) {
+      if (scheme === void 0) scheme = null;
+      let cr = this[_credentials][dartx.fold](io._SiteCredentials)(null, dart.fn((prev, value) => {
+        let siteCredentials = io._SiteCredentials.as(value);
+        if (dart.test(siteCredentials.applies(url, scheme))) {
+          if (prev == null) return io._SiteCredentials._check(value);
+          return dart.notNull(siteCredentials.uri.path[dartx.length]) > dart.notNull(prev.uri.path[dartx.length]) ? siteCredentials : prev;
+        } else {
+          return prev;
+        }
+      }, _SiteCredentialsAnd_CredentialsTo_SiteCredentials()));
+      return cr;
+    }
+    [_findProxyCredentials](proxy, scheme) {
+      if (scheme === void 0) scheme = null;
+      let it = this[_proxyCredentials][dartx.iterator];
+      while (dart.test(it.moveNext())) {
+        if (dart.test(it.current.applies(proxy, scheme))) {
+          return it.current;
+        }
+      }
+      return null;
+    }
+    [_removeCredentials](cr) {
+      let index = this[_credentials][dartx.indexOf](cr);
+      if (index != -1) {
+        this[_credentials][dartx.removeAt](index);
+      }
+    }
+    [_removeProxyCredentials](cr) {
+      let index = this[_proxyCredentials][dartx.indexOf](io._ProxyCredentials._check(cr));
+      if (index != -1) {
+        this[_proxyCredentials][dartx.removeAt](index);
+      }
+    }
+    static _findProxyFromEnvironment(url, environment) {
+      function checkNoProxy(option) {
+        if (option == null) return null;
+        let names = option[dartx.split](",")[dartx.map](core.String)(dart.fn(s => s[dartx.trim](), StringToString$()))[dartx.iterator];
+        while (dart.test(names.moveNext())) {
+          let name = names.current;
+          if (dart.test(name[dartx.startsWith]("[")) && dart.test(name[dartx.endsWith]("]")) && dart.str`[${url.host}]` == name || dart.test(name[dartx.isNotEmpty]) && dart.test(url.host[dartx.endsWith](name))) {
+            return "DIRECT";
+          }
+        }
+        return null;
+      }
+      dart.fn(checkNoProxy, StringToString$());
+      function checkProxy(option) {
+        if (option == null) return null;
+        option = option[dartx.trim]();
+        if (dart.test(option[dartx.isEmpty])) return null;
+        let pos = option[dartx.indexOf]("://");
+        if (dart.notNull(pos) >= 0) {
+          option = option[dartx.substring](dart.notNull(pos) + 3);
+        }
+        pos = option[dartx.indexOf]("/");
+        if (dart.notNull(pos) >= 0) {
+          option = option[dartx.substring](0, pos);
+        }
+        if (option[dartx.indexOf]("[") == 0) {
+          let pos = option[dartx.lastIndexOf](":");
+          if (dart.notNull(option[dartx.indexOf]("]")) > dart.notNull(pos)) option = dart.str`${option}:1080`;
+        } else {
+          if (option[dartx.indexOf](":") == -1) option = dart.str`${option}:1080`;
+        }
+        return dart.str`PROXY ${option}`;
+      }
+      dart.fn(checkProxy, StringToString$());
+      if (environment == null) environment = io._HttpClient._platformEnvironmentCache;
+      let proxyCfg = null;
+      let noProxy = environment[dartx._get]("no_proxy");
+      if (noProxy == null) noProxy = environment[dartx._get]("NO_PROXY");
+      if ((proxyCfg = checkNoProxy(noProxy)) != null) {
+        return proxyCfg;
+      }
+      if (url.scheme == "http") {
+        let proxy = environment[dartx._get]("http_proxy");
+        if (proxy == null) proxy = environment[dartx._get]("HTTP_PROXY");
+        if ((proxyCfg = checkProxy(proxy)) != null) {
+          return proxyCfg;
+        }
+      } else if (url.scheme == "https") {
+        let proxy = environment[dartx._get]("https_proxy");
+        if (proxy == null) proxy = environment[dartx._get]("HTTPS_PROXY");
+        if ((proxyCfg = checkProxy(proxy)) != null) {
+          return proxyCfg;
+        }
+      }
+      return "DIRECT";
+    }
+  };
+  io._HttpClient[dart.implements] = () => [io.HttpClient];
+  dart.setSignature(io._HttpClient, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClient, [io.SecurityContext])}),
+    fields: () => ({
+      [_closing]: core.bool,
+      [_closingForcefully]: core.bool,
+      [_connectionTargets]: MapOfString$_ConnectionTarget(),
+      [_credentials]: ListOf_Credentials(),
+      [_proxyCredentials]: ListOf_ProxyCredentials(),
+      [_context]: io.SecurityContext,
+      [_authenticate]: core.Function,
+      [_authenticateProxy]: core.Function,
+      [_findProxy]: core.Function,
+      [_idleTimeout]: core.Duration,
+      [_badCertificateCallback]: io.BadCertificateCallback,
+      maxConnectionsPerHost: core.int,
+      autoUncompress: core.bool,
+      userAgent: core.String
+    }),
+    getters: () => ({idleTimeout: dart.definiteFunctionType(core.Duration, [])}),
+    setters: () => ({
+      idleTimeout: dart.definiteFunctionType(dart.void, [core.Duration]),
+      badCertificateCallback: dart.definiteFunctionType(dart.void, [X509CertificateAndStringAndintTobool()]),
+      authenticate: dart.definiteFunctionType(dart.void, [UriAndStringAndStringToFutureOfbool()]),
+      authenticateProxy: dart.definiteFunctionType(dart.void, [StringAndintAndString__ToFutureOfbool()]),
+      findProxy: dart.definiteFunctionType(dart.void, [UriToString()])
+    }),
+    methods: () => ({
+      open: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.String, core.int, core.String]),
+      openUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.Uri]),
+      get: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      getUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      post: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      postUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      put: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      putUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      delete: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      deleteUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      head: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      headUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      patch: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      patchUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      close: dart.definiteFunctionType(dart.void, [], {force: core.bool}),
+      addCredentials: dart.definiteFunctionType(dart.void, [core.Uri, core.String, io.HttpClientCredentials]),
+      addProxyCredentials: dart.definiteFunctionType(dart.void, [core.String, core.int, core.String, io.HttpClientCredentials]),
+      [_openUrl]: dart.definiteFunctionType(async.Future$(io._HttpClientRequest), [core.String, core.Uri]),
+      [_openUrlFromRequest]: dart.definiteFunctionType(async.Future$(io._HttpClientRequest), [core.String, core.Uri, io._HttpClientRequest]),
+      [_returnConnection]: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      [_connectionClosed]: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      [_connectionsChanged]: dart.definiteFunctionType(dart.void, []),
+      [_closeConnections]: dart.definiteFunctionType(dart.void, [core.bool]),
+      [_getConnectionTarget]: dart.definiteFunctionType(io._ConnectionTarget, [core.String, core.int, core.bool]),
+      [_getConnection]: dart.definiteFunctionType(async.Future$(io._ConnectionInfo), [core.String, core.int, io._ProxyConfiguration, core.bool]),
+      [_findCredentials]: dart.definiteFunctionType(io._SiteCredentials, [core.Uri], [io._AuthenticationScheme]),
+      [_findProxyCredentials]: dart.definiteFunctionType(io._ProxyCredentials, [io._Proxy], [io._AuthenticationScheme]),
+      [_removeCredentials]: dart.definiteFunctionType(dart.void, [io._Credentials]),
+      [_removeProxyCredentials]: dart.definiteFunctionType(dart.void, [io._Credentials])
+    }),
+    sfields: () => ({_platformEnvironmentCache: MapOfString$String()}),
+    statics: () => ({_findProxyFromEnvironment: dart.definiteFunctionType(core.String, [core.Uri, MapOfString$String()])}),
+    names: ['_findProxyFromEnvironment']
+  });
+  dart.defineLazy(io._HttpClient, {
+    get _platformEnvironmentCache() {
+      return io.Platform.environment;
+    },
+    set _platformEnvironmentCache(_) {}
+  });
+  const _state$1 = Symbol('_state');
+  const _idleMark = Symbol('_idleMark');
+  const _owner = Symbol('_owner');
+  const _serviceId = Symbol('_serviceId');
+  const _markActive = Symbol('_markActive');
+  const _markIdle = Symbol('_markIdle');
+  const _handleRequest = Symbol('_handleRequest');
+  const _isActive = Symbol('_isActive');
+  const _isIdle = Symbol('_isIdle');
+  const _isDetached = Symbol('_isDetached');
+  const _serviceTypePath = Symbol('_serviceTypePath');
+  const _serviceTypeName = Symbol('_serviceTypeName');
+  const _servicePath = Symbol('_servicePath');
+  const _serviceType = Symbol('_serviceType');
+  const _toJSON$ = Symbol('_toJSON');
+  const __serviceId = Symbol('__serviceId');
+  io._ServiceObject = class _ServiceObject extends core.Object {
+    new() {
+      this[__serviceId] = 0;
+    }
+    get [_serviceId]() {
+      if (this[__serviceId] == 0) this[__serviceId] = (() => {
+        let x = io._nextServiceId;
+        io._nextServiceId = dart.notNull(x) + 1;
+        return x;
+      })();
+      return this[__serviceId];
+    }
+    get [_servicePath]() {
+      return dart.str`${this[_serviceTypePath]}/${this[_serviceId]}`;
+    }
+    [_serviceType](ref) {
+      if (dart.test(ref)) return dart.str`@${this[_serviceTypeName]}`;
+      return this[_serviceTypeName];
+    }
+  };
+  dart.setSignature(io._ServiceObject, {
+    fields: () => ({[__serviceId]: core.int}),
+    getters: () => ({
+      [_serviceId]: dart.definiteFunctionType(core.int, []),
+      [_servicePath]: dart.definiteFunctionType(core.String, [])
+    }),
+    methods: () => ({[_serviceType]: dart.definiteFunctionType(core.String, [core.bool])})
+  });
+  io._HttpConnection = class _HttpConnection extends dart.mixin(collection.LinkedListEntry, io._ServiceObject) {
+    new(socket, httpServer) {
+      this[_socket] = socket;
+      this[_httpServer] = httpServer;
+      this[_httpParser] = io._HttpParser.requestParser();
+      this[_state$1] = io._HttpConnection._IDLE;
+      this[_subscription$] = null;
+      this[_idleMark] = false;
+      this[_streamFuture] = null;
+      super.new();
+      try {
+        dart.dput(this[_socket], _owner, this);
+      } catch (_) {
+        core.print(_);
+      }
+
+      io._HttpConnection._connections[dartx._set](this[_serviceId], this);
+      this[_httpParser].listenToStream(StreamOfListOfint()._check(this[_socket]));
+      this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
+        this[_httpServer][_markActive](this);
+        incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
+          if (dart.test(closing)) this.destroy();
+        }, dynamicToNull$()));
+        this[_subscription$].pause();
+        this[_state$1] = io._HttpConnection._ACTIVE;
+        let outgoing = new io._HttpOutgoing(io.Socket._check(this[_socket]));
+        let response = new io._HttpResponse(incoming.uri, incoming.headers.protocolVersion, outgoing, this[_httpServer].defaultResponseHeaders, this[_httpServer].serverHeader);
+        let request = new io._HttpRequest(response, incoming, this[_httpServer], this);
+        this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(_ => {
+          response.deadline = null;
+          if (this[_state$1] == io._HttpConnection._DETACHED) return;
+          if (dart.test(response.persistentConnection) && dart.test(request.persistentConnection) && dart.test(incoming.fullBodyRead) && !dart.test(this[_httpParser].upgrade) && !dart.test(this[_httpServer].closed)) {
+            this[_state$1] = io._HttpConnection._IDLE;
+            this[_idleMark] = false;
+            this[_httpServer][_markIdle](this);
+            this[_subscription$].resume();
+          } else {
+            this.destroy();
+          }
+        }, dynamicToNull$()), {onError: dart.fn(_ => {
+            this.destroy();
+          }, dynamicToNull$())});
+        outgoing.ignoreBody = request.method == "HEAD";
+        response[_httpRequest] = request;
+        this[_httpServer][_handleRequest](request);
+      }, _HttpIncomingToNull()), {onDone: dart.fn(() => {
+          this.destroy();
+        }, VoidToNull()), onError: dart.fn(error => {
+          this.destroy();
+        }, dynamicToNull$())});
+    }
+    markIdle() {
+      this[_idleMark] = true;
+    }
+    get isMarkedIdle() {
+      return this[_idleMark];
+    }
+    destroy() {
+      if (this[_state$1] == io._HttpConnection._CLOSING || this[_state$1] == io._HttpConnection._DETACHED) return;
+      this[_state$1] = io._HttpConnection._CLOSING;
+      dart.dsend(this[_socket], 'destroy');
+      this[_httpServer][_connectionClosed](this);
+      io._HttpConnection._connections[dartx.remove](this[_serviceId]);
+    }
+    detachSocket() {
+      this[_state$1] = io._HttpConnection._DETACHED;
+      this[_httpServer][_connectionClosed](this);
+      let detachedIncoming = this[_httpParser].detachIncoming();
+      return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => {
+        io._HttpConnection._connections[dartx.remove](this[_serviceId]);
+        return new io._DetachedSocket(this[_socket], detachedIncoming);
+      }, dynamicTo_DetachedSocket()));
+    }
+    get connectionInfo() {
+      return io._HttpConnectionInfo.create(io.Socket._check(this[_socket]));
+    }
+    get [_isActive]() {
+      return this[_state$1] == io._HttpConnection._ACTIVE;
+    }
+    get [_isIdle]() {
+      return this[_state$1] == io._HttpConnection._IDLE;
+    }
+    get [_isClosing]() {
+      return this[_state$1] == io._HttpConnection._CLOSING;
+    }
+    get [_isDetached]() {
+      return this[_state$1] == io._HttpConnection._DETACHED;
+    }
+    get [_serviceTypePath]() {
+      return 'io/http/serverconnections';
+    }
+    get [_serviceTypeName]() {
+      return 'HttpServerConnection';
+    }
+    [_toJSON$](ref) {
+      let name = dart.str`${dart.dload(dart.dload(this[_socket], 'address'), 'host')}:${dart.dload(this[_socket], 'port')} <-> ` + dart.str`${dart.dload(dart.dload(this[_socket], 'remoteAddress'), 'host')}:${dart.dload(this[_socket], 'remotePort')}`;
+      let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: name, user_name: name}, core.String, dart.dynamic);
+      if (dart.test(ref)) {
+        return r;
+      }
+      r[dartx._set]('server', this[_httpServer][_toJSON$](true));
+      try {
+        r[dartx._set]('socket', dart.dsend(this[_socket], _toJSON$, true));
+      } catch (_) {
+        r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+      }
+
+      switch (this[_state$1]) {
+        case io._HttpConnection._ACTIVE:
+        {
+          r[dartx._set]('state', "Active");
+          break;
+        }
+        case io._HttpConnection._IDLE:
+        {
+          r[dartx._set]('state', "Idle");
+          break;
+        }
+        case io._HttpConnection._CLOSING:
+        {
+          r[dartx._set]('state', "Closing");
+          break;
+        }
+        case io._HttpConnection._DETACHED:
+        {
+          r[dartx._set]('state', "Detached");
+          break;
+        }
+        default:
+        {
+          r[dartx._set]('state', 'Unknown');
+          break;
+        }
+      }
+      return r;
+    }
+  };
+  dart.setBaseClass(io._HttpConnection, dart.mixin(collection.LinkedListEntry$(io._HttpConnection), io._ServiceObject));
+  dart.addSimpleTypeTests(io._HttpConnection);
+  dart.setSignature(io._HttpConnection, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpConnection, [dart.dynamic, io._HttpServer])}),
+    fields: () => ({
+      [_socket]: dart.dynamic,
+      [_httpServer]: io._HttpServer,
+      [_httpParser]: io._HttpParser,
+      [_state$1]: core.int,
+      [_subscription$]: async.StreamSubscription,
+      [_idleMark]: core.bool,
+      [_streamFuture]: async.Future
+    }),
+    getters: () => ({
+      isMarkedIdle: dart.definiteFunctionType(core.bool, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      [_isActive]: dart.definiteFunctionType(core.bool, []),
+      [_isIdle]: dart.definiteFunctionType(core.bool, []),
+      [_isClosing]: dart.definiteFunctionType(core.bool, []),
+      [_isDetached]: dart.definiteFunctionType(core.bool, []),
+      [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+      [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+    }),
+    methods: () => ({
+      markIdle: dart.definiteFunctionType(dart.void, []),
+      destroy: dart.definiteFunctionType(dart.void, []),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      [_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
+    }),
+    sfields: () => ({
+      _ACTIVE: core.int,
+      _IDLE: core.int,
+      _CLOSING: core.int,
+      _DETACHED: core.int,
+      _connections: MapOfint$_HttpConnection()
+    })
+  });
+  io._HttpConnection._ACTIVE = 0;
+  io._HttpConnection._IDLE = 1;
+  io._HttpConnection._CLOSING = 2;
+  io._HttpConnection._DETACHED = 3;
+  dart.defineLazy(io._HttpConnection, {
+    get _connections() {
+      return HashMapOfint$_HttpConnection().new();
+    },
+    set _connections(_) {}
+  });
+  const _activeConnections = Symbol('_activeConnections');
+  const _idleConnections = Symbol('_idleConnections');
+  const _serverSocket = Symbol('_serverSocket');
+  const _closeServer = Symbol('_closeServer');
+  let const$71;
+  let const$72;
+  io._HttpServer = class _HttpServer extends dart.mixin(async.Stream$(io.HttpRequest), io._ServiceObject) {
+    static bind(address, port, backlog, v6Only, shared) {
+      return io.ServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), ServerSocketTo_HttpServer()));
+    }
+    static bindSecure(address, port, context, backlog, v6Only, requestClientCertificate, shared) {
+      return io.SecureServerSocket.bind(address, port, context, {backlog: backlog, v6Only: v6Only, requestClientCertificate: requestClientCertificate, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), SecureServerSocketTo_HttpServer()));
+    }
+    _(serverSocket, closeServer) {
+      this.defaultResponseHeaders = io._HttpServer._initDefaultResponseHeaders();
+      this[_activeConnections] = new (LinkedListOf_HttpConnection())();
+      this[_idleConnections] = new (LinkedListOf_HttpConnection())();
+      this[_serverSocket] = serverSocket;
+      this[_closeServer] = closeServer;
+      this.serverHeader = null;
+      this.autoCompress = false;
+      this[_idleTimeout] = null;
+      this[_idleTimer] = null;
+      this[_sessionManagerInstance] = null;
+      this.closed = false;
+      this[_controller$0] = null;
+      super.new();
+      this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
+      this.idleTimeout = const$71 || (const$71 = dart.const(new core.Duration({seconds: 120})));
+      io._HttpServer._servers[dartx._set](this[_serviceId], this);
+      dart.dput(this[_serverSocket], _owner, this);
+    }
+    listenOn(serverSocket) {
+      this.defaultResponseHeaders = io._HttpServer._initDefaultResponseHeaders();
+      this[_activeConnections] = new (LinkedListOf_HttpConnection())();
+      this[_idleConnections] = new (LinkedListOf_HttpConnection())();
+      this[_serverSocket] = serverSocket;
+      this[_closeServer] = false;
+      this.serverHeader = null;
+      this.autoCompress = false;
+      this[_idleTimeout] = null;
+      this[_idleTimer] = null;
+      this[_sessionManagerInstance] = null;
+      this.closed = false;
+      this[_controller$0] = null;
+      super.new();
+      this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
+      this.idleTimeout = const$72 || (const$72 = dart.const(new core.Duration({seconds: 120})));
+      io._HttpServer._servers[dartx._set](this[_serviceId], this);
+      try {
+        dart.dput(this[_serverSocket], _owner, this);
+      } catch (_) {
+      }
+
+    }
+    static _initDefaultResponseHeaders() {
+      let defaultResponseHeaders = new io._HttpHeaders('1.1');
+      defaultResponseHeaders.contentType = io.ContentType.TEXT;
+      defaultResponseHeaders.set('X-Frame-Options', 'SAMEORIGIN');
+      defaultResponseHeaders.set('X-Content-Type-Options', 'nosniff');
+      defaultResponseHeaders.set('X-XSS-Protection', '1; mode=block');
+      return defaultResponseHeaders;
+    }
+    get idleTimeout() {
+      return this[_idleTimeout];
+    }
+    set idleTimeout(duration) {
+      if (this[_idleTimer] != null) {
+        this[_idleTimer].cancel();
+        this[_idleTimer] = null;
+      }
+      this[_idleTimeout] = duration;
+      if (this[_idleTimeout] != null) {
+        this[_idleTimer] = async.Timer.periodic(this[_idleTimeout], dart.fn(_ => {
+          for (let idle of this[_idleConnections].toList()) {
+            if (dart.test(idle.isMarkedIdle)) {
+              idle.destroy();
+            } else {
+              idle.markIdle();
+            }
+          }
+        }, TimerToNull()));
+      }
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      dart.dsend(this[_serverSocket], 'listen', dart.fn(socket => {
+        socket.setOption(io.SocketOption.TCP_NODELAY, true);
+        let connection = new io._HttpConnection(socket, this);
+        this[_idleConnections].add(connection);
+      }, SocketToNull()), {onError: dart.fn((error, stackTrace) => {
+          if (!io.HandshakeException.is(error)) {
+            this[_controller$0].addError(error, core.StackTrace._check(stackTrace));
+          }
+        }, dynamicAnddynamicToNull()), onDone: dart.bind(this[_controller$0], 'close')});
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    close(opts) {
+      let force = opts && 'force' in opts ? opts.force : false;
+      this.closed = true;
+      let result = null;
+      if (this[_serverSocket] != null && dart.test(this[_closeServer])) {
+        result = async.Future._check(dart.dsend(this[_serverSocket], 'close'));
+      } else {
+        result = async.Future.value();
+      }
+      this.idleTimeout = null;
+      if (dart.test(force)) {
+        for (let c of this[_activeConnections].toList()) {
+          c.destroy();
+        }
+        dart.assert(this[_activeConnections].isEmpty);
+      }
+      for (let c of this[_idleConnections].toList()) {
+        c.destroy();
+      }
+      this[_maybePerformCleanup]();
+      return result;
+    }
+    [_maybePerformCleanup]() {
+      if (dart.test(this.closed) && dart.test(this[_idleConnections].isEmpty) && dart.test(this[_activeConnections].isEmpty) && this[_sessionManagerInstance] != null) {
+        this[_sessionManagerInstance].close();
+        this[_sessionManagerInstance] = null;
+        io._HttpServer._servers[dartx.remove](this[_serviceId]);
+      }
+    }
+    get port() {
+      if (dart.test(this.closed)) dart.throw(new io.HttpException("HttpServer is not bound to a socket"));
+      return core.int._check(dart.dload(this[_serverSocket], 'port'));
+    }
+    get address() {
+      if (dart.test(this.closed)) dart.throw(new io.HttpException("HttpServer is not bound to a socket"));
+      return io.InternetAddress._check(dart.dload(this[_serverSocket], 'address'));
+    }
+    set sessionTimeout(timeout) {
+      this[_sessionManager].sessionTimeout = timeout;
+    }
+    [_handleRequest](request) {
+      if (!dart.test(this.closed)) {
+        this[_controller$0].add(request);
+      } else {
+        request[_httpConnection].destroy();
+      }
+    }
+    [_connectionClosed](connection) {
+      connection.unlink();
+      this[_maybePerformCleanup]();
+    }
+    [_markIdle](connection) {
+      this[_activeConnections].remove(connection);
+      this[_idleConnections].add(connection);
+    }
+    [_markActive](connection) {
+      this[_idleConnections].remove(connection);
+      this[_activeConnections].add(connection);
+    }
+    get [_sessionManager]() {
+      if (this[_sessionManagerInstance] == null) {
+        this[_sessionManagerInstance] = new io._HttpSessionManager();
+      }
+      return this[_sessionManagerInstance];
+    }
+    connectionsInfo() {
+      let result = new io.HttpConnectionsInfo();
+      result.total = dart.notNull(this[_activeConnections].length) + dart.notNull(this[_idleConnections].length);
+      this[_activeConnections].forEach(dart.fn(conn => {
+        if (dart.test(conn[_isActive])) {
+          result.active = dart.notNull(result.active) + 1;
+        } else {
+          dart.assert(conn[_isClosing]);
+          result.closing = dart.notNull(result.closing) + 1;
+        }
+      }, _HttpConnectionToNull()));
+      this[_idleConnections].forEach(dart.fn(conn => {
+        result.idle = dart.notNull(result.idle) + 1;
+        dart.assert(conn[_isIdle]);
+      }, _HttpConnectionToNull()));
+      return result;
+    }
+    get [_serviceTypePath]() {
+      return 'io/http/servers';
+    }
+    get [_serviceTypeName]() {
+      return 'HttpServer';
+    }
+    [_toJSON$](ref) {
+      let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: dart.str`${this.address.host}:${this.port}`, user_name: dart.str`${this.address.host}:${this.port}`}, core.String, dart.dynamic);
+      if (dart.test(ref)) {
+        return r;
+      }
+      try {
+        r[dartx._set]('socket', dart.dsend(this[_serverSocket], _toJSON$, true));
+      } catch (_) {
+        r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+      }
+
+      r[dartx._set]('port', this.port);
+      r[dartx._set]('address', this.address.host);
+      r[dartx._set]('active', this[_activeConnections].map(core.Map)(dart.fn(c => c[_toJSON$](true), _HttpConnectionToMap()))[dartx.toList]());
+      r[dartx._set]('idle', this[_idleConnections].map(core.Map)(dart.fn(c => c[_toJSON$](true), _HttpConnectionToMap()))[dartx.toList]());
+      r[dartx._set]('closed', this.closed);
+      return r;
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpServer);
+  dart.defineNamedConstructor(io._HttpServer, '_');
+  dart.defineNamedConstructor(io._HttpServer, 'listenOn');
+  io._HttpServer[dart.implements] = () => [io.HttpServer];
+  dart.setSignature(io._HttpServer, {
+    constructors: () => ({
+      _: dart.definiteFunctionType(io._HttpServer, [dart.dynamic, core.bool]),
+      listenOn: dart.definiteFunctionType(io._HttpServer, [dart.dynamic])
+    }),
+    fields: () => ({
+      serverHeader: core.String,
+      defaultResponseHeaders: io.HttpHeaders,
+      autoCompress: core.bool,
+      [_idleTimeout]: core.Duration,
+      [_idleTimer]: async.Timer,
+      [_sessionManagerInstance]: io._HttpSessionManager,
+      closed: core.bool,
+      [_serverSocket]: dart.dynamic,
+      [_closeServer]: core.bool,
+      [_activeConnections]: LinkedListOf_HttpConnection(),
+      [_idleConnections]: LinkedListOf_HttpConnection(),
+      [_controller$0]: StreamControllerOfHttpRequest()
+    }),
+    getters: () => ({
+      idleTimeout: dart.definiteFunctionType(core.Duration, []),
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, []),
+      [_sessionManager]: dart.definiteFunctionType(io._HttpSessionManager, []),
+      [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+      [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+    }),
+    setters: () => ({
+      idleTimeout: dart.definiteFunctionType(dart.void, [core.Duration]),
+      sessionTimeout: dart.definiteFunctionType(dart.void, [core.int])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.HttpRequest), [HttpRequestTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(async.Future, [], {force: core.bool}),
+      [_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
+      [_handleRequest]: dart.definiteFunctionType(dart.void, [io._HttpRequest]),
+      [_connectionClosed]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+      [_markIdle]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+      [_markActive]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+      connectionsInfo: dart.definiteFunctionType(io.HttpConnectionsInfo, []),
+      [_toJSON$]: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [core.bool])
+    }),
+    sfields: () => ({_servers: MapOfint$_HttpServer()}),
+    statics: () => ({
+      bind: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, core.int, core.bool, core.bool]),
+      bindSecure: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, io.SecurityContext, core.int, core.bool, core.bool, core.bool]),
+      _initDefaultResponseHeaders: dart.definiteFunctionType(io.HttpHeaders, [])
+    }),
+    names: ['bind', 'bindSecure', '_initDefaultResponseHeaders']
+  });
+  dart.defineLazy(io._HttpServer, {
+    get _servers() {
+      return MapOfint$_HttpServer().new();
+    },
+    set _servers(_) {}
+  });
+  io._Proxy = class _Proxy extends core.Object {
+    new(host, port, username, password) {
+      this.host = host;
+      this.port = port;
+      this.username = username;
+      this.password = password;
+      this.isDirect = false;
+    }
+    direct() {
+      this.host = null;
+      this.port = null;
+      this.username = null;
+      this.password = null;
+      this.isDirect = true;
+    }
+    get isAuthenticated() {
+      return this.username != null;
+    }
+  };
+  dart.defineNamedConstructor(io._Proxy, 'direct');
+  dart.setSignature(io._Proxy, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._Proxy, [core.String, core.int, core.String, core.String]),
+      direct: dart.definiteFunctionType(io._Proxy, [])
+    }),
+    fields: () => ({
+      host: core.String,
+      port: core.int,
+      username: core.String,
+      password: core.String,
+      isDirect: core.bool
+    }),
+    getters: () => ({isAuthenticated: dart.definiteFunctionType(core.bool, [])})
+  });
+  let const$73;
+  let const$74;
+  io._ProxyConfiguration = class _ProxyConfiguration extends core.Object {
+    new(configuration) {
+      this.proxies = ListOf_Proxy().new();
+      if (configuration == null) {
+        dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+      }
+      let list = configuration[dartx.split](";");
+      list[dartx.forEach](dart.fn(proxy => {
+        proxy = proxy[dartx.trim]();
+        if (!dart.test(proxy[dartx.isEmpty])) {
+          if (dart.test(proxy[dartx.startsWith](io._ProxyConfiguration.PROXY_PREFIX))) {
+            let username = null;
+            let password = null;
+            proxy = proxy[dartx.substring](io._ProxyConfiguration.PROXY_PREFIX[dartx.length])[dartx.trim]();
+            let at = proxy[dartx.indexOf]("@");
+            if (at != -1) {
+              let userinfo = proxy[dartx.substring](0, at)[dartx.trim]();
+              proxy = proxy[dartx.substring](dart.notNull(at) + 1)[dartx.trim]();
+              let colon = userinfo[dartx.indexOf](":");
+              if (colon == -1 || colon == 0 || colon == dart.notNull(proxy[dartx.length]) - 1) {
+                dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+              }
+              username = userinfo[dartx.substring](0, colon)[dartx.trim]();
+              password = userinfo[dartx.substring](dart.notNull(colon) + 1)[dartx.trim]();
+            }
+            let colon = proxy[dartx.lastIndexOf](":");
+            if (colon == -1 || colon == 0 || colon == dart.notNull(proxy[dartx.length]) - 1) {
+              dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+            }
+            let host = proxy[dartx.substring](0, colon)[dartx.trim]();
+            if (dart.test(host[dartx.startsWith]("[")) && dart.test(host[dartx.endsWith]("]"))) {
+              host = host[dartx.substring](1, dart.notNull(host[dartx.length]) - 1);
+            }
+            let portString = proxy[dartx.substring](dart.notNull(colon) + 1)[dartx.trim]();
+            let port = null;
+            try {
+              port = core.int.parse(portString);
+            } catch (e) {
+              if (core.FormatException.is(e)) {
+                dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}, ` + dart.str`invalid port '${portString}'`));
+              } else
+                throw e;
+            }
+
+            this.proxies[dartx.add](new io._Proxy(host, port, username, password));
+          } else if (proxy[dartx.trim]() == io._ProxyConfiguration.DIRECT_PREFIX) {
+            this.proxies[dartx.add](new io._Proxy.direct());
+          } else {
+            dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+          }
+        }
+      }, StringToNull()));
+    }
+    direct() {
+      this.proxies = const$74 || (const$74 = dart.constList([const$73 || (const$73 = dart.const(new io._Proxy.direct()))], io._Proxy));
+    }
+  };
+  dart.defineNamedConstructor(io._ProxyConfiguration, 'direct');
+  dart.setSignature(io._ProxyConfiguration, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._ProxyConfiguration, [core.String]),
+      direct: dart.definiteFunctionType(io._ProxyConfiguration, [])
+    }),
+    fields: () => ({proxies: ListOf_Proxy()}),
+    sfields: () => ({
+      PROXY_PREFIX: core.String,
+      DIRECT_PREFIX: core.String
+    })
+  });
+  io._ProxyConfiguration.PROXY_PREFIX = "PROXY ";
+  io._ProxyConfiguration.DIRECT_PREFIX = "DIRECT";
+  io._HttpConnectionInfo = class _HttpConnectionInfo extends core.Object {
+    new() {
+      this.remoteAddress = null;
+      this.remotePort = null;
+      this.localPort = null;
+    }
+    static create(socket) {
+      if (socket == null) return null;
+      try {
+        let info = new io._HttpConnectionInfo();
+        info.remoteAddress = socket.remoteAddress;
+        info.remotePort = socket.remotePort;
+        info.localPort = socket.port;
+        return info;
+      } catch (e) {
+      }
+
+      return null;
+    }
+  };
+  io._HttpConnectionInfo[dart.implements] = () => [io.HttpConnectionInfo];
+  dart.setSignature(io._HttpConnectionInfo, {
+    fields: () => ({
+      remoteAddress: io.InternetAddress,
+      remotePort: core.int,
+      localPort: core.int
+    }),
+    statics: () => ({create: dart.definiteFunctionType(io._HttpConnectionInfo, [io.Socket])}),
+    names: ['create']
+  });
+  io._DetachedSocket = class _DetachedSocket extends async.Stream$(core.List$(core.int)) {
+    new(socket, incoming) {
+      this[_socket] = socket;
+      this[_incoming] = incoming;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get encoding() {
+      return convert.Encoding._check(dart.dload(this[_socket], 'encoding'));
+    }
+    set encoding(value) {
+      dart.dput(this[_socket], 'encoding', value);
+    }
+    write(obj) {
+      dart.dsend(this[_socket], 'write', obj);
+    }
+    writeln(obj) {
+      if (obj === void 0) obj = "";
+      dart.dsend(this[_socket], 'writeln', obj);
+    }
+    writeCharCode(charCode) {
+      dart.dsend(this[_socket], 'writeCharCode', charCode);
+    }
+    writeAll(objects, separator) {
+      if (separator === void 0) separator = "";
+      dart.dsend(this[_socket], 'writeAll', objects, separator);
+    }
+    add(bytes) {
+      dart.dsend(this[_socket], 'add', bytes);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      return dart.dsend(this[_socket], 'addError', error, stackTrace);
+    }
+    addStream(stream) {
+      return FutureOfSocket()._check(dart.dsend(this[_socket], 'addStream', stream));
+    }
+    destroy() {
+      dart.dsend(this[_socket], 'destroy');
+    }
+    flush() {
+      return async.Future._check(dart.dsend(this[_socket], 'flush'));
+    }
+    close() {
+      return async.Future._check(dart.dsend(this[_socket], 'close'));
+    }
+    get done() {
+      return FutureOfSocket()._check(dart.dload(this[_socket], 'done'));
+    }
+    get port() {
+      return core.int._check(dart.dload(this[_socket], 'port'));
+    }
+    get address() {
+      return io.InternetAddress._check(dart.dload(this[_socket], 'address'));
+    }
+    get remoteAddress() {
+      return io.InternetAddress._check(dart.dload(this[_socket], 'remoteAddress'));
+    }
+    get remotePort() {
+      return core.int._check(dart.dload(this[_socket], 'remotePort'));
+    }
+    setOption(option, enabled) {
+      return core.bool._check(dart.dsend(this[_socket], 'setOption', option, enabled));
+    }
+    [_toJSON$](ref) {
+      return core.Map._check(dart.dsend(this[_socket], _toJSON$, ref));
+    }
+    set [_owner](owner) {
+      dart.dput(this[_socket], _owner, owner);
+    }
+  };
+  dart.addSimpleTypeTests(io._DetachedSocket);
+  io._DetachedSocket[dart.implements] = () => [io.Socket];
+  dart.setSignature(io._DetachedSocket, {
+    constructors: () => ({new: dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic, StreamOfListOfint()])}),
+    fields: () => ({
+      [_incoming]: StreamOfListOfint(),
+      [_socket]: dart.dynamic
+    }),
+    getters: () => ({
+      encoding: dart.definiteFunctionType(convert.Encoding, []),
+      done: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, []),
+      remoteAddress: dart.definiteFunctionType(io.InternetAddress, []),
+      remotePort: dart.definiteFunctionType(core.int, [])
+    }),
+    setters: () => ({
+      encoding: dart.definiteFunctionType(dart.void, [convert.Encoding]),
+      [_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      write: dart.definiteFunctionType(dart.void, [core.Object]),
+      writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+      writeCharCode: dart.definiteFunctionType(dart.void, [core.int]),
+      writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future$(io.Socket), [StreamOfListOfint()]),
+      destroy: dart.definiteFunctionType(dart.void, []),
+      flush: dart.definiteFunctionType(async.Future, []),
+      close: dart.definiteFunctionType(async.Future, []),
+      setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
+      [_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
+    })
+  });
+  const _scheme = Symbol('_scheme');
+  io._AuthenticationScheme = class _AuthenticationScheme extends core.Object {
+    new(scheme) {
+      this[_scheme] = scheme;
+    }
+    static fromString(scheme) {
+      if (scheme[dartx.toLowerCase]() == "basic") return io._AuthenticationScheme.BASIC;
+      if (scheme[dartx.toLowerCase]() == "digest") return io._AuthenticationScheme.DIGEST;
+      return io._AuthenticationScheme.UNKNOWN;
+    }
+    toString() {
+      if (dart.equals(this, io._AuthenticationScheme.BASIC)) return "Basic";
+      if (dart.equals(this, io._AuthenticationScheme.DIGEST)) return "Digest";
+      return "Unknown";
+    }
+  };
+  dart.setSignature(io._AuthenticationScheme, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._AuthenticationScheme, [core.int]),
+      fromString: dart.definiteFunctionType(io._AuthenticationScheme, [core.String])
+    }),
+    fields: () => ({[_scheme]: core.int}),
+    sfields: () => ({
+      UNKNOWN: io._AuthenticationScheme,
+      BASIC: io._AuthenticationScheme,
+      DIGEST: io._AuthenticationScheme
+    })
+  });
+  dart.defineLazy(io._AuthenticationScheme, {
+    get UNKNOWN() {
+      return dart.const(new io._AuthenticationScheme(-1));
+    },
+    get BASIC() {
+      return dart.const(new io._AuthenticationScheme(0));
+    },
+    get DIGEST() {
+      return dart.const(new io._AuthenticationScheme(1));
+    }
+  });
+  io._Credentials = class _Credentials extends core.Object {
+    new(credentials, realm) {
+      this.credentials = credentials;
+      this.realm = realm;
+      this.used = false;
+      this.ha1 = null;
+      this.nonce = null;
+      this.algorithm = null;
+      this.qop = null;
+      this.nonceCount = null;
+      if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST)) {
+        let creds = io._HttpClientDigestCredentials._check(this.credentials);
+        let hasher = new io._MD5();
+        hasher.add(convert.UTF8.encode(creds.username));
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(this.realm[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(convert.UTF8.encode(creds.password));
+        this.ha1 = io._CryptoUtils.bytesToHex(hasher.close());
+      }
+    }
+    get scheme() {
+      return this.credentials.scheme;
+    }
+  };
+  dart.setSignature(io._Credentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._Credentials, [io._HttpClientCredentials, core.String])}),
+    fields: () => ({
+      credentials: io._HttpClientCredentials,
+      realm: core.String,
+      used: core.bool,
+      ha1: core.String,
+      nonce: core.String,
+      algorithm: core.String,
+      qop: core.String,
+      nonceCount: core.int
+    }),
+    getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])})
+  });
+  io._SiteCredentials = class _SiteCredentials extends io._Credentials {
+    new(uri, realm, creds) {
+      this.uri = uri;
+      super.new(creds, core.String._check(realm));
+    }
+    applies(uri, scheme) {
+      if (scheme != null && !dart.equals(this.credentials.scheme, scheme)) return false;
+      if (uri.host != this.uri.host) return false;
+      let thisPort = this.uri.port == 0 ? io.HttpClient.DEFAULT_HTTP_PORT : this.uri.port;
+      let otherPort = uri.port == 0 ? io.HttpClient.DEFAULT_HTTP_PORT : uri.port;
+      if (otherPort != thisPort) return false;
+      return uri.path[dartx.startsWith](this.uri.path);
+    }
+    authorize(request) {
+      if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST) && this.nonce == null) {
+        return;
+      }
+      this.credentials.authorize(this, request);
+      this.used = true;
+    }
+  };
+  dart.setSignature(io._SiteCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SiteCredentials, [core.Uri, dart.dynamic, io._HttpClientCredentials])}),
+    fields: () => ({uri: core.Uri}),
+    methods: () => ({
+      applies: dart.definiteFunctionType(core.bool, [core.Uri, io._AuthenticationScheme]),
+      authorize: dart.definiteFunctionType(dart.void, [io.HttpClientRequest])
+    })
+  });
+  io._ProxyCredentials = class _ProxyCredentials extends io._Credentials {
+    new(host, port, realm, creds) {
+      this.host = host;
+      this.port = port;
+      super.new(creds, core.String._check(realm));
+    }
+    applies(proxy, scheme) {
+      if (scheme != null && !dart.equals(this.credentials.scheme, scheme)) return false;
+      return proxy.host == this.host && proxy.port == this.port;
+    }
+    authorize(request) {
+      if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST) && this.nonce == null) {
+        return;
+      }
+      this.credentials.authorizeProxy(this, request);
+    }
+  };
+  dart.setSignature(io._ProxyCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ProxyCredentials, [core.String, core.int, dart.dynamic, io._HttpClientCredentials])}),
+    fields: () => ({
+      host: core.String,
+      port: core.int
+    }),
+    methods: () => ({
+      applies: dart.definiteFunctionType(core.bool, [io._Proxy, io._AuthenticationScheme]),
+      authorize: dart.definiteFunctionType(dart.void, [io.HttpClientRequest])
+    })
+  });
+  io._HttpClientCredentials = class _HttpClientCredentials extends core.Object {};
+  io._HttpClientCredentials[dart.implements] = () => [io.HttpClientCredentials];
+  io._HttpClientBasicCredentials = class _HttpClientBasicCredentials extends io._HttpClientCredentials {
+    new(username, password) {
+      this.username = username;
+      this.password = password;
+    }
+    get scheme() {
+      return io._AuthenticationScheme.BASIC;
+    }
+    authorization() {
+      let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${this.username}:${this.password}`));
+      return dart.str`Basic ${auth}`;
+    }
+    authorize(_, request) {
+      request.headers.set(io.HttpHeaders.AUTHORIZATION, this.authorization());
+    }
+    authorizeProxy(_, request) {
+      request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, this.authorization());
+    }
+  };
+  io._HttpClientBasicCredentials[dart.implements] = () => [io.HttpClientBasicCredentials];
+  dart.setSignature(io._HttpClientBasicCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientBasicCredentials, [core.String, core.String])}),
+    fields: () => ({
+      username: core.String,
+      password: core.String
+    }),
+    getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])}),
+    methods: () => ({
+      authorization: dart.definiteFunctionType(core.String, []),
+      authorize: dart.definiteFunctionType(dart.void, [io._Credentials, io.HttpClientRequest]),
+      authorizeProxy: dart.definiteFunctionType(dart.void, [io._ProxyCredentials, io.HttpClientRequest])
+    })
+  });
+  io._HttpClientDigestCredentials = class _HttpClientDigestCredentials extends io._HttpClientCredentials {
+    new(username, password) {
+      this.username = username;
+      this.password = password;
+    }
+    get scheme() {
+      return io._AuthenticationScheme.DIGEST;
+    }
+    authorization(credentials, request) {
+      let requestUri = request[_requestUri]();
+      let hasher = new io._MD5();
+      hasher.add(request.method[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(requestUri[dartx.codeUnits]);
+      let ha2 = io._CryptoUtils.bytesToHex(hasher.close());
+      let qop = null;
+      let cnonce = null;
+      let nc = null;
+      let x = null;
+      hasher = new io._MD5();
+      hasher.add(credentials.ha1[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      if (credentials.qop == "auth") {
+        qop = credentials.qop;
+        cnonce = io._CryptoUtils.bytesToHex(io._IOCrypto.getRandomBytes(4));
+        credentials.nonceCount = dart.notNull(credentials.nonceCount) + 1;
+        nc = credentials.nonceCount[dartx.toRadixString](16);
+        nc = dart.notNull("00000000"[dartx.substring](0, 8 - dart.notNull(nc[dartx.length]) + 1)) + dart.notNull(nc);
+        hasher.add(credentials.nonce[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(nc[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(cnonce[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(credentials.qop[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(ha2[dartx.codeUnits]);
+      } else {
+        hasher.add(credentials.nonce[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(ha2[dartx.codeUnits]);
+      }
+      let response = io._CryptoUtils.bytesToHex(hasher.close());
+      let buffer = new core.StringBuffer();
+      buffer.write('Digest ');
+      buffer.write(dart.str`username="${this.username}"`);
+      buffer.write(dart.str`, realm="${credentials.realm}"`);
+      buffer.write(dart.str`, nonce="${credentials.nonce}"`);
+      buffer.write(dart.str`, uri="${requestUri}"`);
+      buffer.write(dart.str`, algorithm="${credentials.algorithm}"`);
+      if (qop == "auth") {
+        buffer.write(dart.str`, qop="${qop}"`);
+        buffer.write(dart.str`, cnonce="${cnonce}"`);
+        buffer.write(dart.str`, nc="${nc}"`);
+      }
+      buffer.write(dart.str`, response="${response}"`);
+      return buffer.toString();
+    }
+    authorize(credentials, request) {
+      request.headers.set(io.HttpHeaders.AUTHORIZATION, this.authorization(credentials, io._HttpClientRequest._check(request)));
+    }
+    authorizeProxy(credentials, request) {
+      request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, this.authorization(credentials, io._HttpClientRequest._check(request)));
+    }
+  };
+  io._HttpClientDigestCredentials[dart.implements] = () => [io.HttpClientDigestCredentials];
+  dart.setSignature(io._HttpClientDigestCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientDigestCredentials, [core.String, core.String])}),
+    fields: () => ({
+      username: core.String,
+      password: core.String
+    }),
+    getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])}),
+    methods: () => ({
+      authorization: dart.definiteFunctionType(core.String, [io._Credentials, io._HttpClientRequest]),
+      authorize: dart.definiteFunctionType(dart.void, [io._Credentials, io.HttpClientRequest]),
+      authorizeProxy: dart.definiteFunctionType(dart.void, [io._ProxyCredentials, io.HttpClientRequest])
+    })
+  });
+  io._RedirectInfo = class _RedirectInfo extends core.Object {
+    new(statusCode, method, location) {
+      this.statusCode = statusCode;
+      this.method = method;
+      this.location = location;
+    }
+  };
+  io._RedirectInfo[dart.implements] = () => [io.RedirectInfo];
+  dart.setSignature(io._RedirectInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RedirectInfo, [core.int, core.String, core.Uri])}),
+    fields: () => ({
+      statusCode: core.int,
+      method: core.String,
+      location: core.Uri
+    })
+  });
+  io._getHttpVersion = function() {
+    let version = io.Platform.version;
+    let index = version[dartx.indexOf]('.', dart.notNull(version[dartx.indexOf]('.')) + 1);
+    version = version[dartx.substring](0, index);
+    return dart.str`Dart/${version} (dart:io)`;
+  };
+  dart.fn(io._getHttpVersion, VoidToString$());
+  io._Const = class _Const extends core.Object {};
+  dart.setSignature(io._Const, {
+    sfields: () => ({
+      HTTP: ListOfint(),
+      HTTP1DOT: ListOfint(),
+      HTTP10: ListOfint(),
+      HTTP11: ListOfint(),
+      T: core.bool,
+      F: core.bool,
+      SEPARATOR_MAP: ListOfbool()
+    })
+  });
+  io._Const.HTTP = dart.constList([72, 84, 84, 80], core.int);
+  io._Const.HTTP1DOT = dart.constList([72, 84, 84, 80, 47, 49, 46], core.int);
+  io._Const.HTTP10 = dart.constList([72, 84, 84, 80, 47, 49, 46, 48], core.int);
+  io._Const.HTTP11 = dart.constList([72, 84, 84, 80, 47, 49, 46, 49], core.int);
+  io._Const.T = true;
+  io._Const.F = false;
+  dart.defineLazy(io._Const, {
+    get SEPARATOR_MAP() {
+      return dart.constList([io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F], core.bool);
+    }
+  });
+  io._CharCode = class _CharCode extends core.Object {};
+  dart.setSignature(io._CharCode, {
+    sfields: () => ({
+      HT: core.int,
+      LF: core.int,
+      CR: core.int,
+      SP: core.int,
+      AMPERSAND: core.int,
+      COMMA: core.int,
+      DASH: core.int,
+      SLASH: core.int,
+      ZERO: core.int,
+      ONE: core.int,
+      COLON: core.int,
+      SEMI_COLON: core.int,
+      EQUAL: core.int
+    })
+  });
+  io._CharCode.HT = 9;
+  io._CharCode.LF = 10;
+  io._CharCode.CR = 13;
+  io._CharCode.SP = 32;
+  io._CharCode.AMPERSAND = 38;
+  io._CharCode.COMMA = 44;
+  io._CharCode.DASH = 45;
+  io._CharCode.SLASH = 47;
+  io._CharCode.ZERO = 48;
+  io._CharCode.ONE = 49;
+  io._CharCode.COLON = 58;
+  io._CharCode.SEMI_COLON = 59;
+  io._CharCode.EQUAL = 61;
+  io._State = class _State extends core.Object {};
+  dart.setSignature(io._State, {
+    sfields: () => ({
+      START: core.int,
+      METHOD_OR_RESPONSE_HTTP_VERSION: core.int,
+      RESPONSE_HTTP_VERSION: core.int,
+      REQUEST_LINE_METHOD: core.int,
+      REQUEST_LINE_URI: core.int,
+      REQUEST_LINE_HTTP_VERSION: core.int,
+      REQUEST_LINE_ENDING: core.int,
+      RESPONSE_LINE_STATUS_CODE: core.int,
+      RESPONSE_LINE_REASON_PHRASE: core.int,
+      RESPONSE_LINE_ENDING: core.int,
+      HEADER_START: core.int,
+      HEADER_FIELD: core.int,
+      HEADER_VALUE_START: core.int,
+      HEADER_VALUE: core.int,
+      HEADER_VALUE_FOLDING_OR_ENDING: core.int,
+      HEADER_VALUE_FOLD_OR_END: core.int,
+      HEADER_ENDING: core.int,
+      CHUNK_SIZE_STARTING_CR: core.int,
+      CHUNK_SIZE_STARTING_LF: core.int,
+      CHUNK_SIZE: core.int,
+      CHUNK_SIZE_EXTENSION: core.int,
+      CHUNK_SIZE_ENDING: core.int,
+      CHUNKED_BODY_DONE_CR: core.int,
+      CHUNKED_BODY_DONE_LF: core.int,
+      BODY: core.int,
+      CLOSED: core.int,
+      UPGRADED: core.int,
+      FAILURE: core.int,
+      FIRST_BODY_STATE: core.int
+    })
+  });
+  io._State.START = 0;
+  io._State.METHOD_OR_RESPONSE_HTTP_VERSION = 1;
+  io._State.RESPONSE_HTTP_VERSION = 2;
+  io._State.REQUEST_LINE_METHOD = 3;
+  io._State.REQUEST_LINE_URI = 4;
+  io._State.REQUEST_LINE_HTTP_VERSION = 5;
+  io._State.REQUEST_LINE_ENDING = 6;
+  io._State.RESPONSE_LINE_STATUS_CODE = 7;
+  io._State.RESPONSE_LINE_REASON_PHRASE = 8;
+  io._State.RESPONSE_LINE_ENDING = 9;
+  io._State.HEADER_START = 10;
+  io._State.HEADER_FIELD = 11;
+  io._State.HEADER_VALUE_START = 12;
+  io._State.HEADER_VALUE = 13;
+  io._State.HEADER_VALUE_FOLDING_OR_ENDING = 14;
+  io._State.HEADER_VALUE_FOLD_OR_END = 15;
+  io._State.HEADER_ENDING = 16;
+  io._State.CHUNK_SIZE_STARTING_CR = 17;
+  io._State.CHUNK_SIZE_STARTING_LF = 18;
+  io._State.CHUNK_SIZE = 19;
+  io._State.CHUNK_SIZE_EXTENSION = 20;
+  io._State.CHUNK_SIZE_ENDING = 21;
+  io._State.CHUNKED_BODY_DONE_CR = 22;
+  io._State.CHUNKED_BODY_DONE_LF = 23;
+  io._State.BODY = 24;
+  io._State.CLOSED = 25;
+  io._State.UPGRADED = 26;
+  io._State.FAILURE = 27;
+  dart.defineLazy(io._State, {
+    get FIRST_BODY_STATE() {
+      return io._State.CHUNK_SIZE_STARTING_CR;
+    }
+  });
+  io._HttpVersion = class _HttpVersion extends core.Object {};
+  dart.setSignature(io._HttpVersion, {
+    sfields: () => ({
+      UNDETERMINED: core.int,
+      HTTP10: core.int,
+      HTTP11: core.int
+    })
+  });
+  io._HttpVersion.UNDETERMINED = 0;
+  io._HttpVersion.HTTP10 = 1;
+  io._HttpVersion.HTTP11 = 2;
+  io._MessageType = class _MessageType extends core.Object {};
+  dart.setSignature(io._MessageType, {
+    sfields: () => ({
+      UNDETERMINED: core.int,
+      REQUEST: core.int,
+      RESPONSE: core.int
+    })
+  });
+  io._MessageType.UNDETERMINED = 0;
+  io._MessageType.REQUEST = 1;
+  io._MessageType.RESPONSE = 0;
+  const _injectData = Symbol('_injectData');
+  const _userOnData = Symbol('_userOnData');
+  const _isCanceled$ = Symbol('_isCanceled');
+  const _pauseCount$ = Symbol('_pauseCount');
+  const _scheduled = Symbol('_scheduled');
+  const _maybeScheduleData = Symbol('_maybeScheduleData');
+  io._HttpDetachedStreamSubscription = class _HttpDetachedStreamSubscription extends core.Object {
+    new(subscription, injectData, userOnData) {
+      this[_subscription$] = subscription;
+      this[_injectData] = injectData;
+      this[_userOnData] = userOnData;
+      this[_isCanceled$] = false;
+      this[_pauseCount$] = 1;
+      this[_scheduled] = false;
+    }
+    get isPaused() {
+      return this[_subscription$].isPaused;
+    }
+    asFuture(T) {
+      return futureValue => {
+        if (futureValue === void 0) futureValue = null;
+        return this[_subscription$].asFuture(T)(futureValue);
+      };
+    }
+    cancel() {
+      this[_isCanceled$] = true;
+      this[_injectData] = null;
+      return this[_subscription$].cancel();
+    }
+    onData(handleData) {
+      this[_userOnData] = handleData;
+      this[_subscription$].onData(handleData);
+    }
+    onDone(handleDone) {
+      this[_subscription$].onDone(handleDone);
+    }
+    onError(handleError) {
+      this[_subscription$].onError(handleError);
+    }
+    pause(resumeSignal) {
+      if (resumeSignal === void 0) resumeSignal = null;
+      if (this[_injectData] == null) {
+        this[_subscription$].pause(resumeSignal);
+      } else {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) + 1;
+        if (resumeSignal != null) {
+          resumeSignal.whenComplete(dart.bind(this, 'resume'));
+        }
+      }
+    }
+    resume() {
+      if (this[_injectData] == null) {
+        this[_subscription$].resume();
+      } else {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) - 1;
+        this[_maybeScheduleData]();
+      }
+    }
+    [_maybeScheduleData]() {
+      if (dart.test(this[_scheduled])) return;
+      if (this[_pauseCount$] != 0) return;
+      this[_scheduled] = true;
+      async.scheduleMicrotask(dart.fn(() => {
+        this[_scheduled] = false;
+        if (dart.notNull(this[_pauseCount$]) > 0 || dart.test(this[_isCanceled$])) return;
+        let data = this[_injectData];
+        this[_injectData] = null;
+        this[_subscription$].resume();
+        if (this[_userOnData] != null) {
+          dart.dcall(this[_userOnData], data);
+        }
+      }, VoidToNull()));
+    }
+  };
+  io._HttpDetachedStreamSubscription[dart.implements] = () => [StreamSubscriptionOfListOfint()];
+  dart.setSignature(io._HttpDetachedStreamSubscription, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpDetachedStreamSubscription, [StreamSubscriptionOfListOfint(), ListOfint(), core.Function])}),
+    fields: () => ({
+      [_subscription$]: StreamSubscriptionOfListOfint(),
+      [_injectData]: ListOfint(),
+      [_isCanceled$]: core.bool,
+      [_pauseCount$]: core.int,
+      [_userOnData]: core.Function,
+      [_scheduled]: core.bool
+    }),
+    getters: () => ({isPaused: dart.definiteFunctionType(core.bool, [])}),
+    methods: () => ({
+      asFuture: dart.definiteFunctionType(T => [async.Future$(T), [], [T]]),
+      cancel: dart.definiteFunctionType(async.Future, []),
+      onData: dart.definiteFunctionType(dart.void, [ListOfintTovoid()]),
+      onDone: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
+      onError: dart.definiteFunctionType(dart.void, [core.Function]),
+      pause: dart.definiteFunctionType(dart.void, [], [async.Future]),
+      resume: dart.definiteFunctionType(dart.void, []),
+      [_maybeScheduleData]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._HttpDetachedIncoming = class _HttpDetachedIncoming extends async.Stream$(core.List$(core.int)) {
+    new(subscription, bufferedData) {
+      this.subscription = subscription;
+      this.bufferedData = bufferedData;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      if (this.subscription != null) {
+        this.subscription.onData(onData);
+        this.subscription.onError(onError);
+        this.subscription.onDone(onDone);
+        if (this.bufferedData == null) {
+          return StreamSubscriptionOfListOfint()._check(((() => {
+            this.subscription.resume();
+            return this.subscription;
+          })()));
+        }
+        let _ = new io._HttpDetachedStreamSubscription(StreamSubscriptionOfListOfint()._check(this.subscription), this.bufferedData, onData);
+        _.resume();
+        return _;
+      } else {
+        return StreamOfint().fromIterable(this.bufferedData).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+      }
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpDetachedIncoming);
+  dart.setSignature(io._HttpDetachedIncoming, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpDetachedIncoming, [async.StreamSubscription, ListOfint()])}),
+    fields: () => ({
+      subscription: async.StreamSubscription,
+      bufferedData: ListOfint()
+    }),
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+  });
+  const _method$ = Symbol('_method');
+  const _uri_or_reason_phrase = Symbol('_uri_or_reason_phrase');
+  const _headerField = Symbol('_headerField');
+  const _headerValue = Symbol('_headerValue');
+  const _requestParser = Symbol('_requestParser');
+  const _parserCalled = Symbol('_parserCalled');
+  const _index$2 = Symbol('_index');
+  const _httpVersionIndex = Symbol('_httpVersionIndex');
+  const _messageType = Symbol('_messageType');
+  const _statusCodeLength = Symbol('_statusCodeLength');
+  const _httpVersion = Symbol('_httpVersion');
+  const _connectionUpgrade = Symbol('_connectionUpgrade');
+  const _chunked = Symbol('_chunked');
+  const _noMessageBody = Symbol('_noMessageBody');
+  const _remainingContent = Symbol('_remainingContent');
+  const _socketSubscription = Symbol('_socketSubscription');
+  const _paused = Symbol('_paused');
+  const _bodyPaused = Symbol('_bodyPaused');
+  const _bodyController = Symbol('_bodyController');
+  const _pauseStateChanged = Symbol('_pauseStateChanged');
+  const _reset = Symbol('_reset');
+  const _onData$ = Symbol('_onData');
+  const _onDone$ = Symbol('_onDone');
+  const _doParse = Symbol('_doParse');
+  const _reportError = Symbol('_reportError');
+  const _createIncoming = Symbol('_createIncoming');
+  const _closeIncoming = Symbol('_closeIncoming');
+  const _headersEnd = Symbol('_headersEnd');
+  const _expect = Symbol('_expect');
+  const _caseInsensitiveCompare = Symbol('_caseInsensitiveCompare');
+  const _expectHexDigit = Symbol('_expectHexDigit');
+  const _releaseBuffer = Symbol('_releaseBuffer');
+  io._HttpParser = class _HttpParser extends async.Stream$(io._HttpIncoming) {
+    static requestParser() {
+      return new io._HttpParser._(true);
+    }
+    static responseParser() {
+      return new io._HttpParser._(false);
+    }
+    _(requestParser) {
+      this[_method$] = JSArrayOfint().of([]);
+      this[_uri_or_reason_phrase] = JSArrayOfint().of([]);
+      this[_headerField] = JSArrayOfint().of([]);
+      this[_headerValue] = JSArrayOfint().of([]);
+      this[_requestParser] = requestParser;
+      this[_parserCalled] = false;
+      this[_buffer$] = null;
+      this[_index$2] = null;
+      this[_state$1] = null;
+      this[_httpVersionIndex] = null;
+      this[_messageType] = null;
+      this[_statusCode] = 0;
+      this[_statusCodeLength] = 0;
+      this[_httpVersion] = null;
+      this[_transferLength] = -1;
+      this[_persistentConnection] = null;
+      this[_connectionUpgrade] = null;
+      this[_chunked] = null;
+      this[_noMessageBody] = false;
+      this[_remainingContent] = -1;
+      this[_headers] = null;
+      this[_incoming] = null;
+      this[_socketSubscription] = null;
+      this[_paused] = true;
+      this[_bodyPaused] = false;
+      this[_controller$0] = null;
+      this[_bodyController] = null;
+      super.new();
+      this[_controller$0] = StreamControllerOf_HttpIncoming().new({sync: true, onListen: dart.fn(() => {
+          this[_paused] = false;
+        }, VoidToNull()), onPause: dart.fn(() => {
+          this[_paused] = true;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onResume: dart.fn(() => {
+          this[_paused] = false;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onCancel: dart.fn(() => {
+          if (this[_socketSubscription] != null) {
+            this[_socketSubscription].cancel();
+          }
+        }, VoidToNull())});
+      this[_reset]();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    listenToStream(stream) {
+      this[_socketSubscription] = stream.listen(dart.bind(this, _onData$), {onError: dart.bind(this[_controller$0], 'addError'), onDone: dart.bind(this, _onDone$)});
+    }
+    [_parse]() {
+      try {
+        this[_doParse]();
+      } catch (e) {
+        let s = dart.stackTrace(e);
+        this[_state$1] = io._State.FAILURE;
+        this[_reportError](e, s);
+      }
+
+    }
+    [_headersEnd]() {
+      this[_headers][_mutable] = false;
+      this[_transferLength] = this[_headers].contentLength;
+      if (dart.test(this[_chunked])) this[_transferLength] = -1;
+      if (this[_messageType] == io._MessageType.REQUEST && dart.notNull(this[_transferLength]) < 0 && this[_chunked] == false) {
+        this[_transferLength] = 0;
+      }
+      if (dart.test(this[_connectionUpgrade])) {
+        this[_state$1] = io._State.UPGRADED;
+        this[_transferLength] = 0;
+      }
+      this[_createIncoming](this[_transferLength]);
+      if (dart.test(this[_requestParser])) {
+        this[_incoming].method = core.String.fromCharCodes(this[_method$]);
+        this[_incoming].uri = core.Uri.parse(core.String.fromCharCodes(this[_uri_or_reason_phrase]));
+      } else {
+        this[_incoming].statusCode = this[_statusCode];
+        this[_incoming].reasonPhrase = core.String.fromCharCodes(this[_uri_or_reason_phrase]);
+      }
+      this[_method$][dartx.clear]();
+      this[_uri_or_reason_phrase][dartx.clear]();
+      if (dart.test(this[_connectionUpgrade])) {
+        this[_incoming].upgraded = true;
+        this[_parserCalled] = false;
+        let tmp = this[_incoming];
+        this[_closeIncoming]();
+        this[_controller$0].add(tmp);
+        return true;
+      }
+      if (this[_transferLength] == 0 || this[_messageType] == io._MessageType.RESPONSE && dart.test(this[_noMessageBody])) {
+        this[_reset]();
+        let tmp = this[_incoming];
+        this[_closeIncoming]();
+        this[_controller$0].add(tmp);
+        return false;
+      } else if (dart.test(this[_chunked])) {
+        this[_state$1] = io._State.CHUNK_SIZE;
+        this[_remainingContent] = 0;
+      } else if (dart.notNull(this[_transferLength]) > 0) {
+        this[_remainingContent] = this[_transferLength];
+        this[_state$1] = io._State.BODY;
+      } else {
+        this[_state$1] = io._State.BODY;
+      }
+      this[_parserCalled] = false;
+      this[_controller$0].add(this[_incoming]);
+      return true;
+    }
+    [_doParse]() {
+      dart.assert(!dart.test(this[_parserCalled]));
+      this[_parserCalled] = true;
+      if (this[_state$1] == io._State.CLOSED) {
+        dart.throw(new io.HttpException("Data on closed connection"));
+      }
+      if (this[_state$1] == io._State.FAILURE) {
+        dart.throw(new io.HttpException("Data on failed connection"));
+      }
+      while (this[_buffer$] != null && dart.notNull(this[_index$2]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
+        if (this[_incoming] != null && dart.test(this[_bodyPaused]) || this[_incoming] == null && dart.test(this[_paused])) {
+          this[_parserCalled] = false;
+          return;
+        }
+        let byte = this[_buffer$][dartx._get]((() => {
+          let x = this[_index$2];
+          this[_index$2] = dart.notNull(x) + 1;
+          return x;
+        })());
+        switch (this[_state$1]) {
+          case io._State.START:
+          {
+            if (byte == io._Const.HTTP[dartx._get](0)) {
+              this[_httpVersionIndex] = 1;
+              this[_state$1] = io._State.METHOD_OR_RESPONSE_HTTP_VERSION;
+            } else {
+              if (!dart.test(io._HttpParser._isTokenChar(byte))) {
+                dart.throw(new io.HttpException("Invalid request method"));
+              }
+              this[_method$][dartx.add](byte);
+              if (!dart.test(this[_requestParser])) {
+                dart.throw(new io.HttpException("Invalid response line"));
+              }
+              this[_state$1] = io._State.REQUEST_LINE_METHOD;
+            }
+            break;
+          }
+          case io._State.METHOD_OR_RESPONSE_HTTP_VERSION:
+          {
+            if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP[dartx.length]) && byte == io._Const.HTTP[dartx._get](this[_httpVersionIndex])) {
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP[dartx.length] && byte == io._CharCode.SLASH) {
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+              if (dart.test(this[_requestParser])) {
+                dart.throw(new io.HttpException("Invalid request line"));
+              }
+              this[_state$1] = io._State.RESPONSE_HTTP_VERSION;
+            } else {
+              for (let i = 0; i < dart.notNull(this[_httpVersionIndex]); i++) {
+                this[_method$][dartx.add](io._Const.HTTP[dartx._get](i));
+              }
+              if (byte == io._CharCode.SP) {
+                this[_state$1] = io._State.REQUEST_LINE_URI;
+              } else {
+                this[_method$][dartx.add](byte);
+                this[_httpVersion] = io._HttpVersion.UNDETERMINED;
+                if (!dart.test(this[_requestParser])) {
+                  dart.throw(new io.HttpException("Invalid response line"));
+                }
+                this[_state$1] = io._State.REQUEST_LINE_METHOD;
+              }
+            }
+            break;
+          }
+          case io._State.RESPONSE_HTTP_VERSION:
+          {
+            if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP1DOT[dartx.length])) {
+              this[_expect](byte, io._Const.HTTP1DOT[dartx._get](this[_httpVersionIndex]));
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length] && byte == io._CharCode.ONE) {
+              this[_httpVersion] = io._HttpVersion.HTTP11;
+              this[_persistentConnection] = true;
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length] && byte == io._CharCode.ZERO) {
+              this[_httpVersion] = io._HttpVersion.HTTP10;
+              this[_persistentConnection] = false;
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == dart.notNull(io._Const.HTTP1DOT[dartx.length]) + 1) {
+              this[_expect](byte, io._CharCode.SP);
+              this[_state$1] = io._State.RESPONSE_LINE_STATUS_CODE;
+            } else {
+              dart.throw(new io.HttpException("Invalid response line"));
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_METHOD:
+          {
+            if (byte == io._CharCode.SP) {
+              this[_state$1] = io._State.REQUEST_LINE_URI;
+            } else {
+              if (dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte)) || byte == io._CharCode.CR || byte == io._CharCode.LF) {
+                dart.throw(new io.HttpException("Invalid request method"));
+              }
+              this[_method$][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_URI:
+          {
+            if (byte == io._CharCode.SP) {
+              if (this[_uri_or_reason_phrase][dartx.length] == 0) {
+                dart.throw(new io.HttpException("Invalid request URI"));
+              }
+              this[_state$1] = io._State.REQUEST_LINE_HTTP_VERSION;
+              this[_httpVersionIndex] = 0;
+            } else {
+              if (byte == io._CharCode.CR || byte == io._CharCode.LF) {
+                dart.throw(new io.HttpException("Invalid request URI"));
+              }
+              this[_uri_or_reason_phrase][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_HTTP_VERSION:
+          {
+            if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP1DOT[dartx.length])) {
+              this[_expect](byte, io._Const.HTTP11[dartx._get](this[_httpVersionIndex]));
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length]) {
+              if (byte == io._CharCode.ONE) {
+                this[_httpVersion] = io._HttpVersion.HTTP11;
+                this[_persistentConnection] = true;
+                this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+              } else if (byte == io._CharCode.ZERO) {
+                this[_httpVersion] = io._HttpVersion.HTTP10;
+                this[_persistentConnection] = false;
+                this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+              } else {
+                dart.throw(new io.HttpException("Invalid response line"));
+              }
+            } else {
+              if (byte == io._CharCode.CR) {
+                this[_state$1] = io._State.REQUEST_LINE_ENDING;
+              } else {
+                this[_expect](byte, io._CharCode.LF);
+                this[_messageType] = io._MessageType.REQUEST;
+                this[_state$1] = io._State.HEADER_START;
+              }
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_messageType] = io._MessageType.REQUEST;
+            this[_state$1] = io._State.HEADER_START;
+            break;
+          }
+          case io._State.RESPONSE_LINE_STATUS_CODE:
+          {
+            if (byte == io._CharCode.SP) {
+              this[_state$1] = io._State.RESPONSE_LINE_REASON_PHRASE;
+            } else if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.RESPONSE_LINE_ENDING;
+            } else {
+              this[_statusCodeLength] = dart.notNull(this[_statusCodeLength]) + 1;
+              if (dart.notNull(byte) < 48 && 57 < dart.notNull(byte) || dart.notNull(this[_statusCodeLength]) > 3) {
+                dart.throw(new io.HttpException("Invalid response status code"));
+              } else {
+                this[_statusCode] = dart.notNull(this[_statusCode]) * 10 + dart.notNull(byte) - 48;
+              }
+            }
+            break;
+          }
+          case io._State.RESPONSE_LINE_REASON_PHRASE:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.RESPONSE_LINE_ENDING;
+            } else {
+              if (byte == io._CharCode.CR || byte == io._CharCode.LF) {
+                dart.throw(new io.HttpException("Invalid response reason phrase"));
+              }
+              this[_uri_or_reason_phrase][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.RESPONSE_LINE_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_messageType] == io._MessageType.RESPONSE;
+            if (dart.notNull(this[_statusCode]) < 100 || dart.notNull(this[_statusCode]) > 599) {
+              dart.throw(new io.HttpException("Invalid response status code"));
+            } else {
+              if (dart.notNull(this[_statusCode]) <= 199 || this[_statusCode] == 204 || this[_statusCode] == 304) {
+                this[_noMessageBody] = true;
+              }
+            }
+            this[_state$1] = io._State.HEADER_START;
+            break;
+          }
+          case io._State.HEADER_START:
+          {
+            this[_headers] = new io._HttpHeaders(this.version);
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.HEADER_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state$1] = io._State.HEADER_ENDING;
+              this[_index$2] = dart.notNull(this[_index$2]) - 1;
+            } else {
+              this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+              this[_state$1] = io._State.HEADER_FIELD;
+            }
+            break;
+          }
+          case io._State.HEADER_FIELD:
+          {
+            if (byte == io._CharCode.COLON) {
+              this[_state$1] = io._State.HEADER_VALUE_START;
+            } else {
+              if (!dart.test(io._HttpParser._isTokenChar(byte))) {
+                dart.throw(new io.HttpException("Invalid header field name"));
+              }
+              this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+            }
+            break;
+          }
+          case io._State.HEADER_VALUE_START:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLDING_OR_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLD_OR_END;
+            } else if (byte != io._CharCode.SP && byte != io._CharCode.HT) {
+              this[_headerValue][dartx.add](byte);
+              this[_state$1] = io._State.HEADER_VALUE;
+            }
+            break;
+          }
+          case io._State.HEADER_VALUE:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLDING_OR_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLD_OR_END;
+            } else {
+              this[_headerValue][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.HEADER_VALUE_FOLDING_OR_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_state$1] = io._State.HEADER_VALUE_FOLD_OR_END;
+            break;
+          }
+          case io._State.HEADER_VALUE_FOLD_OR_END:
+          {
+            if (byte == io._CharCode.SP || byte == io._CharCode.HT) {
+              this[_state$1] = io._State.HEADER_VALUE_START;
+            } else {
+              let headerField = core.String.fromCharCodes(this[_headerField]);
+              let headerValue = core.String.fromCharCodes(this[_headerValue]);
+              if (headerField == "transfer-encoding" && dart.test(this[_caseInsensitiveCompare]("chunked"[dartx.codeUnits], this[_headerValue]))) {
+                this[_chunked] = true;
+              }
+              if (headerField == "connection") {
+                let tokens = io._HttpParser._tokenizeFieldValue(headerValue);
+                for (let i = 0; i < dart.notNull(tokens[dartx.length]); i++) {
+                  if (dart.test(this[_caseInsensitiveCompare]("upgrade"[dartx.codeUnits], tokens[dartx._get](i)[dartx.codeUnits]))) {
+                    this[_connectionUpgrade] = true;
+                  }
+                  this[_headers][_add$2](headerField, tokens[dartx._get](i));
+                }
+              } else {
+                this[_headers][_add$2](headerField, headerValue);
+              }
+              this[_headerField][dartx.clear]();
+              this[_headerValue][dartx.clear]();
+              if (byte == io._CharCode.CR) {
+                this[_state$1] = io._State.HEADER_ENDING;
+              } else if (byte == io._CharCode.LF) {
+                this[_state$1] = io._State.HEADER_ENDING;
+                this[_index$2] = dart.notNull(this[_index$2]) - 1;
+              } else {
+                this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+                this[_state$1] = io._State.HEADER_FIELD;
+              }
+            }
+            break;
+          }
+          case io._State.HEADER_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            if (dart.test(this[_headersEnd]())) {
+              return;
+            } else {
+              break;
+            }
+            return;
+          }
+          case io._State.CHUNK_SIZE_STARTING_CR:
+          {
+            this[_expect](byte, io._CharCode.CR);
+            this[_state$1] = io._State.CHUNK_SIZE_STARTING_LF;
+            break;
+          }
+          case io._State.CHUNK_SIZE_STARTING_LF:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_state$1] = io._State.CHUNK_SIZE;
+            break;
+          }
+          case io._State.CHUNK_SIZE:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.CHUNK_SIZE_ENDING;
+            } else if (byte == io._CharCode.SEMI_COLON) {
+              this[_state$1] = io._State.CHUNK_SIZE_EXTENSION;
+            } else {
+              let value = this[_expectHexDigit](byte);
+              this[_remainingContent] = dart.notNull(this[_remainingContent]) * 16 + dart.notNull(value);
+            }
+            break;
+          }
+          case io._State.CHUNK_SIZE_EXTENSION:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.CHUNK_SIZE_ENDING;
+            }
+            break;
+          }
+          case io._State.CHUNK_SIZE_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            if (dart.notNull(this[_remainingContent]) > 0) {
+              this[_state$1] = io._State.BODY;
+            } else {
+              this[_state$1] = io._State.CHUNKED_BODY_DONE_CR;
+            }
+            break;
+          }
+          case io._State.CHUNKED_BODY_DONE_CR:
+          {
+            this[_expect](byte, io._CharCode.CR);
+            this[_state$1] = io._State.CHUNKED_BODY_DONE_LF;
+            break;
+          }
+          case io._State.CHUNKED_BODY_DONE_LF:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_reset]();
+            this[_closeIncoming]();
+            break;
+          }
+          case io._State.BODY:
+          {
+            this[_index$2] = dart.notNull(this[_index$2]) - 1;
+            let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$2]);
+            if (dart.notNull(this[_remainingContent]) >= 0 && dart.notNull(dataAvailable) > dart.notNull(this[_remainingContent])) {
+              dataAvailable = this[_remainingContent];
+            }
+            let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$2]), dataAvailable);
+            this[_bodyController].add(data);
+            if (this[_remainingContent] != -1) {
+              this[_remainingContent] = dart.notNull(this[_remainingContent]) - dart.notNull(data[dartx.length]);
+            }
+            this[_index$2] = dart.notNull(this[_index$2]) + dart.notNull(data[dartx.length]);
+            if (this[_remainingContent] == 0) {
+              if (!dart.test(this[_chunked])) {
+                this[_reset]();
+                this[_closeIncoming]();
+              } else {
+                this[_state$1] = io._State.CHUNK_SIZE_STARTING_CR;
+              }
+            }
+            break;
+          }
+          case io._State.FAILURE:
+          {
+            dart.assert(false);
+            break;
+          }
+          default:
+          {
+            dart.assert(false);
+            break;
+          }
+        }
+      }
+      this[_parserCalled] = false;
+      if (this[_buffer$] != null && this[_index$2] == this[_buffer$][dartx.length]) {
+        this[_releaseBuffer]();
+        if (this[_state$1] != io._State.UPGRADED && this[_state$1] != io._State.FAILURE) {
+          this[_socketSubscription].resume();
+        }
+      }
+    }
+    [_onData$](buffer) {
+      this[_socketSubscription].pause();
+      dart.assert(this[_buffer$] == null);
+      this[_buffer$] = typed_data.Uint8List._check(buffer);
+      this[_index$2] = 0;
+      this[_parse]();
+    }
+    [_onDone$]() {
+      this[_socketSubscription] = null;
+      if (this[_state$1] == io._State.CLOSED || this[_state$1] == io._State.FAILURE) return;
+      if (this[_incoming] != null) {
+        if (this[_state$1] != io._State.UPGRADED && !(this[_state$1] == io._State.START && !dart.test(this[_requestParser])) && !(this[_state$1] == io._State.BODY && !dart.test(this[_chunked]) && this[_transferLength] == -1)) {
+          this[_bodyController].addError(new io.HttpException("Connection closed while receiving data"));
+        }
+        this[_closeIncoming](true);
+        this[_controller$0].close();
+        return;
+      }
+      if (this[_state$1] == io._State.START) {
+        if (!dart.test(this[_requestParser])) {
+          this[_reportError](new io.HttpException("Connection closed before full header was received"));
+        }
+        this[_controller$0].close();
+        return;
+      }
+      if (this[_state$1] == io._State.UPGRADED) {
+        this[_controller$0].close();
+        return;
+      }
+      if (dart.notNull(this[_state$1]) < io._State.FIRST_BODY_STATE) {
+        this[_state$1] = io._State.FAILURE;
+        this[_reportError](new io.HttpException("Connection closed before full header was received"));
+        this[_controller$0].close();
+        return;
+      }
+      if (!dart.test(this[_chunked]) && this[_transferLength] == -1) {
+        this[_state$1] = io._State.CLOSED;
+      } else {
+        this[_state$1] = io._State.FAILURE;
+        this[_reportError](new io.HttpException("Connection closed before full body was received"));
+      }
+      this[_controller$0].close();
+    }
+    get version() {
+      switch (this[_httpVersion]) {
+        case io._HttpVersion.HTTP10:
+        {
+          return "1.0";
+        }
+        case io._HttpVersion.HTTP11:
+        {
+          return "1.1";
+        }
+      }
+      return null;
+    }
+    get messageType() {
+      return this[_messageType];
+    }
+    get transferLength() {
+      return this[_transferLength];
+    }
+    get upgrade() {
+      return dart.test(this[_connectionUpgrade]) && this[_state$1] == io._State.UPGRADED;
+    }
+    get persistentConnection() {
+      return this[_persistentConnection];
+    }
+    set isHead(value) {
+      if (dart.test(value)) this[_noMessageBody] = true;
+    }
+    detachIncoming() {
+      this[_state$1] = io._State.UPGRADED;
+      return new io._HttpDetachedIncoming(this[_socketSubscription], this.readUnparsedData());
+    }
+    readUnparsedData() {
+      if (this[_buffer$] == null) return null;
+      if (this[_index$2] == this[_buffer$][dartx.length]) return null;
+      let result = this[_buffer$][dartx.sublist](this[_index$2]);
+      this[_releaseBuffer]();
+      return result;
+    }
+    [_reset]() {
+      if (this[_state$1] == io._State.UPGRADED) return;
+      this[_state$1] = io._State.START;
+      this[_messageType] = io._MessageType.UNDETERMINED;
+      this[_headerField][dartx.clear]();
+      this[_headerValue][dartx.clear]();
+      this[_method$][dartx.clear]();
+      this[_uri_or_reason_phrase][dartx.clear]();
+      this[_statusCode] = 0;
+      this[_statusCodeLength] = 0;
+      this[_httpVersion] = io._HttpVersion.UNDETERMINED;
+      this[_transferLength] = -1;
+      this[_persistentConnection] = false;
+      this[_connectionUpgrade] = false;
+      this[_chunked] = false;
+      this[_noMessageBody] = false;
+      this[_remainingContent] = -1;
+      this[_headers] = null;
+    }
+    [_releaseBuffer]() {
+      this[_buffer$] = null;
+      this[_index$2] = null;
+    }
+    static _isTokenChar(byte) {
+      return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 && !dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte));
+    }
+    static _isValueChar(byte) {
+      return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 || byte == io._CharCode.SP || byte == io._CharCode.HT;
+    }
+    static _tokenizeFieldValue(headerValue) {
+      let tokens = ListOfString().new();
+      let start = 0;
+      let index = 0;
+      while (index < dart.notNull(headerValue[dartx.length])) {
+        if (headerValue[dartx._get](index) == ",") {
+          tokens[dartx.add](headerValue[dartx.substring](start, index));
+          start = index + 1;
+        } else if (headerValue[dartx._get](index) == " " || headerValue[dartx._get](index) == "\t") {
+          start++;
+        }
+        index++;
+      }
+      tokens[dartx.add](headerValue[dartx.substring](start, index));
+      return tokens;
+    }
+    static _toLowerCaseByte(x) {
+      return (dart.notNull(x) - 65 & 127) < 26 ? (dart.notNull(x) | 32) >>> 0 : x;
+    }
+    [_caseInsensitiveCompare](expected, value) {
+      if (expected[dartx.length] != value[dartx.length]) return false;
+      for (let i = 0; i < dart.notNull(expected[dartx.length]); i++) {
+        if (expected[dartx._get](i) != io._HttpParser._toLowerCaseByte(value[dartx._get](i))) return false;
+      }
+      return true;
+    }
+    [_expect](val1, val2) {
+      if (val1 != val2) {
+        dart.throw(new io.HttpException("Failed to parse HTTP"));
+      }
+    }
+    [_expectHexDigit](byte) {
+      if (48 <= dart.notNull(byte) && dart.notNull(byte) <= 57) {
+        return dart.notNull(byte) - 48;
+      } else if (65 <= dart.notNull(byte) && dart.notNull(byte) <= 70) {
+        return dart.notNull(byte) - 65 + 10;
+      } else if (97 <= dart.notNull(byte) && dart.notNull(byte) <= 102) {
+        return dart.notNull(byte) - 97 + 10;
+      } else {
+        dart.throw(new io.HttpException("Failed to parse HTTP"));
+      }
+    }
+    [_createIncoming](transferLength) {
+      dart.assert(this[_incoming] == null);
+      dart.assert(this[_bodyController] == null);
+      dart.assert(!dart.test(this[_bodyPaused]));
+      let incoming = null;
+      this[_bodyController] = StreamControllerOfListOfint().new({sync: true, onListen: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          dart.assert(this[_bodyPaused]);
+          this[_bodyPaused] = false;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onPause: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          dart.assert(!dart.test(this[_bodyPaused]));
+          this[_bodyPaused] = true;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onResume: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          dart.assert(this[_bodyPaused]);
+          this[_bodyPaused] = false;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onCancel: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          if (this[_socketSubscription] != null) {
+            this[_socketSubscription].cancel();
+          }
+          this[_closeIncoming](true);
+          this[_controller$0].close();
+        }, VoidToNull())});
+      incoming = this[_incoming] = new io._HttpIncoming(this[_headers], transferLength, this[_bodyController].stream);
+      this[_bodyPaused] = true;
+      this[_pauseStateChanged]();
+    }
+    [_closeIncoming](closing) {
+      if (closing === void 0) closing = false;
+      if (this[_incoming] == null) return;
+      let tmp = this[_incoming];
+      tmp.close(closing);
+      this[_incoming] = null;
+      if (this[_bodyController] != null) {
+        this[_bodyController].close();
+        this[_bodyController] = null;
+      }
+      this[_bodyPaused] = false;
+      this[_pauseStateChanged]();
+    }
+    [_pauseStateChanged]() {
+      if (this[_incoming] != null) {
+        if (!dart.test(this[_bodyPaused]) && !dart.test(this[_parserCalled])) {
+          this[_parse]();
+        }
+      } else {
+        if (!dart.test(this[_paused]) && !dart.test(this[_parserCalled])) {
+          this[_parse]();
+        }
+      }
+    }
+    [_reportError](error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      if (this[_socketSubscription] != null) this[_socketSubscription].cancel();
+      this[_state$1] = io._State.FAILURE;
+      this[_controller$0].addError(error, core.StackTrace._check(stackTrace));
+      this[_controller$0].close();
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpParser);
+  dart.defineNamedConstructor(io._HttpParser, '_');
+  dart.setSignature(io._HttpParser, {
+    constructors: () => ({
+      requestParser: dart.definiteFunctionType(io._HttpParser, []),
+      responseParser: dart.definiteFunctionType(io._HttpParser, []),
+      _: dart.definiteFunctionType(io._HttpParser, [core.bool])
+    }),
+    fields: () => ({
+      [_parserCalled]: core.bool,
+      [_buffer$]: typed_data.Uint8List,
+      [_index$2]: core.int,
+      [_requestParser]: core.bool,
+      [_state$1]: core.int,
+      [_httpVersionIndex]: core.int,
+      [_messageType]: core.int,
+      [_statusCode]: core.int,
+      [_statusCodeLength]: core.int,
+      [_method$]: ListOfint(),
+      [_uri_or_reason_phrase]: ListOfint(),
+      [_headerField]: ListOfint(),
+      [_headerValue]: ListOfint(),
+      [_httpVersion]: core.int,
+      [_transferLength]: core.int,
+      [_persistentConnection]: core.bool,
+      [_connectionUpgrade]: core.bool,
+      [_chunked]: core.bool,
+      [_noMessageBody]: core.bool,
+      [_remainingContent]: core.int,
+      [_headers]: io._HttpHeaders,
+      [_incoming]: io._HttpIncoming,
+      [_socketSubscription]: async.StreamSubscription,
+      [_paused]: core.bool,
+      [_bodyPaused]: core.bool,
+      [_controller$0]: StreamControllerOf_HttpIncoming(),
+      [_bodyController]: StreamControllerOfListOfint()
+    }),
+    getters: () => ({
+      version: dart.definiteFunctionType(core.String, []),
+      messageType: dart.definiteFunctionType(core.int, []),
+      transferLength: dart.definiteFunctionType(core.int, []),
+      upgrade: dart.definiteFunctionType(core.bool, []),
+      persistentConnection: dart.definiteFunctionType(core.bool, [])
+    }),
+    setters: () => ({isHead: dart.definiteFunctionType(dart.void, [core.bool])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io._HttpIncoming), [_HttpIncomingTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      listenToStream: dart.definiteFunctionType(dart.void, [StreamOfListOfint()]),
+      [_parse]: dart.definiteFunctionType(dart.void, []),
+      [_headersEnd]: dart.definiteFunctionType(core.bool, []),
+      [_doParse]: dart.definiteFunctionType(dart.void, []),
+      [_onData$]: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      [_onDone$]: dart.definiteFunctionType(dart.void, []),
+      detachIncoming: dart.definiteFunctionType(io._HttpDetachedIncoming, []),
+      readUnparsedData: dart.definiteFunctionType(core.List$(core.int), []),
+      [_reset]: dart.definiteFunctionType(dart.void, []),
+      [_releaseBuffer]: dart.definiteFunctionType(dart.void, []),
+      [_caseInsensitiveCompare]: dart.definiteFunctionType(core.bool, [ListOfint(), ListOfint()]),
+      [_expect]: dart.definiteFunctionType(core.int, [core.int, core.int]),
+      [_expectHexDigit]: dart.definiteFunctionType(core.int, [core.int]),
+      [_createIncoming]: dart.definiteFunctionType(dart.void, [core.int]),
+      [_closeIncoming]: dart.definiteFunctionType(dart.void, [], [core.bool]),
+      [_pauseStateChanged]: dart.definiteFunctionType(dart.void, []),
+      [_reportError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [dart.dynamic])
+    }),
+    statics: () => ({
+      _isTokenChar: dart.definiteFunctionType(core.bool, [core.int]),
+      _isValueChar: dart.definiteFunctionType(core.bool, [core.int]),
+      _tokenizeFieldValue: dart.definiteFunctionType(core.List$(core.String), [core.String]),
+      _toLowerCaseByte: dart.definiteFunctionType(core.int, [core.int])
+    }),
+    names: ['_isTokenChar', '_isValueChar', '_tokenizeFieldValue', '_toLowerCaseByte']
+  });
+  io._DART_SESSION_ID = "DARTSESSID";
+  const _data$ = Symbol('_data');
+  const _lastSeen = Symbol('_lastSeen');
+  const _timeoutCallback = Symbol('_timeoutCallback');
+  const _prev = Symbol('_prev');
+  const _next$1 = Symbol('_next');
+  const _removeFromTimeoutQueue = Symbol('_removeFromTimeoutQueue');
+  const _sessions = Symbol('_sessions');
+  const _bumpToEnd = Symbol('_bumpToEnd');
+  io._HttpSession = class _HttpSession extends core.Object {
+    new(sessionManager, id) {
+      this[_data$] = collection.HashMap.new();
+      this[_sessionManager] = sessionManager;
+      this.id = id;
+      this[_lastSeen] = new core.DateTime.now();
+      this[_destroyed] = false;
+      this[_isNew] = true;
+      this[_timeoutCallback] = null;
+      this[_prev] = null;
+      this[_next$1] = null;
+    }
+    destroy() {
+      this[_destroyed] = true;
+      this[_sessionManager][_removeFromTimeoutQueue](this);
+      this[_sessionManager][_sessions][dartx.remove](this.id);
+    }
+    [_markSeen]() {
+      this[_lastSeen] = new core.DateTime.now();
+      this[_sessionManager][_bumpToEnd](this);
+    }
+    get lastSeen() {
+      return this[_lastSeen];
+    }
+    get isNew() {
+      return this[_isNew];
+    }
+    set onTimeout(callback) {
+      this[_timeoutCallback] = callback;
+    }
+    containsValue(value) {
+      return this[_data$][dartx.containsValue](value);
+    }
+    containsKey(key) {
+      return this[_data$][dartx.containsKey](key);
+    }
+    _get(key) {
+      return this[_data$][dartx._get](key);
+    }
+    _set(key, value) {
+      this[_data$][dartx._set](key, value);
+      return value;
+    }
+    putIfAbsent(key, ifAbsent) {
+      return this[_data$][dartx.putIfAbsent](key, ifAbsent);
+    }
+    addAll(other) {
+      return this[_data$][dartx.addAll](other);
+    }
+    remove(key) {
+      return this[_data$][dartx.remove](key);
+    }
+    clear() {
+      this[_data$][dartx.clear]();
+    }
+    forEach(f) {
+      this[_data$][dartx.forEach](f);
+    }
+    get keys() {
+      return this[_data$][dartx.keys];
+    }
+    get values() {
+      return this[_data$][dartx.values];
+    }
+    get length() {
+      return this[_data$][dartx.length];
+    }
+    get isEmpty() {
+      return this[_data$][dartx.isEmpty];
+    }
+    get isNotEmpty() {
+      return this[_data$][dartx.isNotEmpty];
+    }
+    toString() {
+      return dart.str`HttpSession id:${this.id} ${this[_data$]}`;
+    }
+  };
+  io._HttpSession[dart.implements] = () => [io.HttpSession];
+  dart.setSignature(io._HttpSession, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpSession, [io._HttpSessionManager, core.String])}),
+    fields: () => ({
+      [_destroyed]: core.bool,
+      [_isNew]: core.bool,
+      [_lastSeen]: core.DateTime,
+      [_timeoutCallback]: core.Function,
+      [_sessionManager]: io._HttpSessionManager,
+      [_prev]: io._HttpSession,
+      [_next$1]: io._HttpSession,
+      id: core.String,
+      [_data$]: core.Map
+    }),
+    getters: () => ({
+      lastSeen: dart.definiteFunctionType(core.DateTime, []),
+      isNew: dart.definiteFunctionType(core.bool, []),
+      keys: dart.definiteFunctionType(core.Iterable, []),
+      values: dart.definiteFunctionType(core.Iterable, []),
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    setters: () => ({onTimeout: dart.definiteFunctionType(dart.void, [VoidTovoid()])}),
+    methods: () => ({
+      destroy: dart.definiteFunctionType(dart.void, []),
+      [_markSeen]: dart.definiteFunctionType(dart.void, []),
+      containsValue: dart.definiteFunctionType(core.bool, [core.Object]),
+      containsKey: dart.definiteFunctionType(core.bool, [core.Object]),
+      _get: dart.definiteFunctionType(dart.dynamic, [core.Object]),
+      _set: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic]),
+      putIfAbsent: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, VoidTodynamic()]),
+      addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+      remove: dart.definiteFunctionType(dart.dynamic, [core.Object]),
+      clear: dart.definiteFunctionType(dart.void, []),
+      forEach: dart.definiteFunctionType(dart.void, [dynamicAnddynamicTovoid()])
+    })
+  });
+  dart.defineExtensionMembers(io._HttpSession, [
+    'containsValue',
+    'containsKey',
+    '_get',
+    '_set',
+    'putIfAbsent',
+    'addAll',
+    'remove',
+    'clear',
+    'forEach',
+    'keys',
+    'values',
+    'length',
+    'isEmpty',
+    'isNotEmpty'
+  ]);
+  const _sessionTimeout = Symbol('_sessionTimeout');
+  const _head$ = Symbol('_head');
+  const _tail$ = Symbol('_tail');
+  const _timer = Symbol('_timer');
+  const _addToTimeoutQueue = Symbol('_addToTimeoutQueue');
+  const _stopTimer = Symbol('_stopTimer');
+  const _startTimer = Symbol('_startTimer');
+  const _timerTimeout = Symbol('_timerTimeout');
+  io._HttpSessionManager = class _HttpSessionManager extends core.Object {
+    new() {
+      this[_sessions] = dart.map({}, core.String, io._HttpSession);
+      this[_sessionTimeout] = 20 * 60;
+      this[_head$] = null;
+      this[_tail$] = null;
+      this[_timer] = null;
+    }
+    createSessionId() {
+      let _KEY_LENGTH = 16;
+      let data = io._IOCrypto.getRandomBytes(_KEY_LENGTH);
+      return io._CryptoUtils.bytesToHex(data);
+    }
+    getSession(id) {
+      return this[_sessions][dartx._get](id);
+    }
+    createSession() {
+      let id = this.createSessionId();
+      while (dart.test(this[_sessions][dartx.containsKey](id))) {
+        id = this.createSessionId();
+      }
+      let session = this[_sessions][dartx._set](id, new io._HttpSession(this, id));
+      this[_addToTimeoutQueue](session);
+      return session;
+    }
+    set sessionTimeout(timeout) {
+      this[_sessionTimeout] = timeout;
+      this[_stopTimer]();
+      this[_startTimer]();
+    }
+    close() {
+      this[_stopTimer]();
+    }
+    [_bumpToEnd](session) {
+      this[_removeFromTimeoutQueue](session);
+      this[_addToTimeoutQueue](session);
+    }
+    [_addToTimeoutQueue](session) {
+      if (this[_head$] == null) {
+        dart.assert(this[_tail$] == null);
+        this[_tail$] = this[_head$] = session;
+        this[_startTimer]();
+      } else {
+        dart.assert(this[_timer] != null);
+        dart.assert(this[_tail$] != null);
+        this[_tail$][_next$1] = session;
+        session[_prev] = this[_tail$];
+        this[_tail$] = session;
+      }
+    }
+    [_removeFromTimeoutQueue](session) {
+      if (session[_next$1] != null) {
+        session[_next$1][_prev] = session[_prev];
+      }
+      if (session[_prev] != null) {
+        session[_prev][_next$1] = session[_next$1];
+      }
+      if (dart.equals(this[_head$], session)) {
+        this[_head$] = session[_next$1];
+        this[_stopTimer]();
+        this[_startTimer]();
+      }
+      if (dart.equals(this[_tail$], session)) {
+        this[_tail$] = session[_prev];
+      }
+      session[_next$1] = session[_prev] = null;
+    }
+    [_timerTimeout]() {
+      this[_stopTimer]();
+      dart.assert(this[_head$] != null);
+      let session = this[_head$];
+      session.destroy();
+      if (session[_timeoutCallback] != null) {
+        dart.dsend(session, _timeoutCallback);
+      }
+    }
+    [_startTimer]() {
+      dart.assert(this[_timer] == null);
+      if (this[_head$] != null) {
+        let seconds = new core.DateTime.now().difference(this[_head$].lastSeen).inSeconds;
+        this[_timer] = async.Timer.new(new core.Duration({seconds: dart.notNull(this[_sessionTimeout]) - dart.notNull(seconds)}), dart.bind(this, _timerTimeout));
+      }
+    }
+    [_stopTimer]() {
+      if (this[_timer] != null) {
+        this[_timer].cancel();
+        this[_timer] = null;
+      }
+    }
+  };
+  dart.setSignature(io._HttpSessionManager, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpSessionManager, [])}),
+    fields: () => ({
+      [_sessions]: MapOfString$_HttpSession(),
+      [_sessionTimeout]: core.int,
+      [_head$]: io._HttpSession,
+      [_tail$]: io._HttpSession,
+      [_timer]: async.Timer
+    }),
+    setters: () => ({sessionTimeout: dart.definiteFunctionType(dart.void, [core.int])}),
+    methods: () => ({
+      createSessionId: dart.definiteFunctionType(core.String, []),
+      getSession: dart.definiteFunctionType(io._HttpSession, [core.String]),
+      createSession: dart.definiteFunctionType(io._HttpSession, []),
+      close: dart.definiteFunctionType(dart.void, []),
+      [_bumpToEnd]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+      [_addToTimeoutQueue]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+      [_removeFromTimeoutQueue]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+      [_timerTimeout]: dart.definiteFunctionType(dart.void, []),
+      [_startTimer]: dart.definiteFunctionType(dart.void, []),
+      [_stopTimer]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._IOResourceInfo = class _IOResourceInfo extends core.Object {
+    static get timestamp() {
+      return dart.notNull(io._IOResourceInfo._startTime) + dart.notNull(io._IOResourceInfo._sw.elapsedMicroseconds) / 1000;
+    }
+    new(type) {
+      this.type = type;
+      this.id = io._IOResourceInfo.getNextID();
+    }
+    get referenceValueMap() {
+      return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.String);
+    }
+    static getNextID() {
+      return (() => {
+        let x = io._IOResourceInfo._count;
+        io._IOResourceInfo._count = dart.notNull(x) + 1;
+        return x;
+      })();
+    }
+  };
+  dart.setSignature(io._IOResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._IOResourceInfo, [core.String])}),
+    fields: () => ({
+      type: core.String,
+      id: core.int
+    }),
+    getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    sfields: () => ({
+      _count: core.int,
+      _sw: core.Stopwatch,
+      _startTime: core.int
+    }),
+    sgetters: () => ({timestamp: dart.definiteFunctionType(core.double, [])}),
+    statics: () => ({getNextID: dart.definiteFunctionType(core.int, [])}),
+    names: ['getNextID']
+  });
+  io._IOResourceInfo._count = 0;
+  dart.defineLazy(io._IOResourceInfo, {
+    get _sw() {
+      return (() => {
+        let _ = new core.Stopwatch();
+        _.start();
+        return _;
+      })();
+    },
+    get _startTime() {
+      return new core.DateTime.now().millisecondsSinceEpoch;
+    }
+  });
+  io._ReadWriteResourceInfo = class _ReadWriteResourceInfo extends io._IOResourceInfo {
+    addRead(bytes) {
+      this.totalRead = dart.notNull(this.totalRead) + dart.notNull(bytes);
+      this.readCount = dart.notNull(this.readCount) + 1;
+      this.lastRead = io._IOResourceInfo.timestamp;
+    }
+    didRead() {
+      this.addRead(0);
+    }
+    addWrite(bytes) {
+      this.totalWritten = dart.notNull(this.totalWritten) + dart.notNull(bytes);
+      this.writeCount = dart.notNull(this.writeCount) + 1;
+      this.lastWrite = io._IOResourceInfo.timestamp;
+    }
+    new(type) {
+      this.totalRead = 0;
+      this.totalWritten = 0;
+      this.readCount = 0;
+      this.writeCount = 0;
+      this.lastRead = 0.0;
+      this.lastWrite = 0.0;
+      super.new(type);
+    }
+    get fullValueMap() {
+      return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.String);
+    }
+  };
+  dart.setSignature(io._ReadWriteResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ReadWriteResourceInfo, [core.String])}),
+    fields: () => ({
+      totalRead: core.int,
+      totalWritten: core.int,
+      readCount: core.int,
+      writeCount: core.int,
+      lastRead: core.double,
+      lastWrite: core.double
+    }),
+    getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    methods: () => ({
+      addRead: dart.definiteFunctionType(dart.void, [core.int]),
+      didRead: dart.definiteFunctionType(dart.void, []),
+      addWrite: dart.definiteFunctionType(dart.void, [core.int])
+    })
+  });
+  io._FileResourceInfo = class _FileResourceInfo extends io._ReadWriteResourceInfo {
+    new(file) {
+      this.file = file;
+      super.new(io._FileResourceInfo.TYPE);
+      io._FileResourceInfo.FileOpened(this);
+    }
+    static FileOpened(info) {
+      dart.assert(!dart.test(io._FileResourceInfo.openFiles[dartx.containsKey](info.id)));
+      io._FileResourceInfo.openFiles[dartx._set](info.id, info);
+    }
+    static FileClosed(info) {
+      dart.assert(io._FileResourceInfo.openFiles[dartx.containsKey](info.id));
+      io._FileResourceInfo.openFiles[dartx.remove](info.id);
+    }
+    static getOpenFilesList() {
+      return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$String())));
+    }
+    static getOpenFiles(func, params) {
+      dart.assert(dart.equals(func, 'ext.dart.io.getOpenFiles'));
+      let data = dart.map({type: '_openfiles', data: io._FileResourceInfo.getOpenFilesList()}, core.String, core.Object);
+      let json = convert.JSON.encode(data);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    getFileInfoMap() {
+      let result = this.fullValueMap;
+      return result;
+    }
+    static getFileInfoMapByID(func, params) {
+      dart.assert(dart.dsend(params, 'containsKey', 'id'));
+      let id = core.int.parse(core.String._check(dart.dindex(params, 'id')));
+      let result = dart.test(io._FileResourceInfo.openFiles[dartx.containsKey](id)) ? io._FileResourceInfo.openFiles[dartx._get](id).getFileInfoMap() : dart.map();
+      let json = convert.JSON.encode(result);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    get name() {
+      return dart.str`${dart.dload(this.file, 'path')}`;
+    }
+  };
+  dart.setSignature(io._FileResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._FileResourceInfo, [dart.dynamic])}),
+    fields: () => ({file: dart.dynamic}),
+    getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+    methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    sfields: () => ({
+      TYPE: core.String,
+      openFiles: MapOfint$_FileResourceInfo()
+    }),
+    statics: () => ({
+      FileOpened: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
+      FileClosed: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
+      getOpenFilesList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+      getOpenFiles: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic]),
+      getFileInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic])
+    }),
+    names: ['FileOpened', 'FileClosed', 'getOpenFilesList', 'getOpenFiles', 'getFileInfoMapByID']
+  });
+  io._FileResourceInfo.TYPE = '_file';
+  dart.defineLazy(io._FileResourceInfo, {
+    get openFiles() {
+      return MapOfint$_FileResourceInfo().new();
+    },
+    set openFiles(_) {}
+  });
+  const _arguments$0 = Symbol('_arguments');
+  const _workingDirectory = Symbol('_workingDirectory');
+  io._ProcessResourceInfo = class _ProcessResourceInfo extends io._IOResourceInfo {
+    new(process) {
+      this.process = process;
+      this.startedAt = io._IOResourceInfo.timestamp;
+      super.new(io._ProcessResourceInfo.TYPE);
+      io._ProcessResourceInfo.ProcessStarted(this);
+    }
+    get name() {
+      return core.String._check(dart.dload(this.process, _path$));
+    }
+    stopped() {
+      io._ProcessResourceInfo.ProcessStopped(this);
+    }
+    get fullValueMap() {
+      return dart.map({type: this.type, id: this.id, name: this.name, pid: core.String._check(dart.dload(this.process, 'pid')), startedAt: this.startedAt, arguments: core.String._check(dart.dload(this.process, _arguments$0)), workingDirectory: core.String._check(dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory))}, core.String, core.String);
+    }
+    static ProcessStarted(info) {
+      dart.assert(!dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id)));
+      io._ProcessResourceInfo.startedProcesses[dartx._set](info.id, info);
+    }
+    static ProcessStopped(info) {
+      dart.assert(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id));
+      io._ProcessResourceInfo.startedProcesses[dartx.remove](info.id);
+    }
+    static getStartedProcessesList() {
+      return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$String())));
+    }
+    static getStartedProcesses(func, params) {
+      dart.assert(func == 'ext.dart.io.getProcesses');
+      let data = dart.map({type: '_startedprocesses', data: io._ProcessResourceInfo.getStartedProcessesList()}, core.String, core.Object);
+      let json = convert.JSON.encode(data);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    static getProcessInfoMapById(func, params) {
+      let id = core.int.parse(params[dartx._get]('id'));
+      let result = dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](id)) ? io._ProcessResourceInfo.startedProcesses[dartx._get](id).fullValueMap : dart.map();
+      let json = convert.JSON.encode(result);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+  };
+  dart.setSignature(io._ProcessResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ProcessResourceInfo, [dart.dynamic])}),
+    fields: () => ({
+      process: dart.dynamic,
+      startedAt: core.double
+    }),
+    getters: () => ({
+      name: dart.definiteFunctionType(core.String, []),
+      fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+    }),
+    methods: () => ({stopped: dart.definiteFunctionType(dart.void, [])}),
+    sfields: () => ({
+      TYPE: core.String,
+      startedProcesses: MapOfint$_ProcessResourceInfo()
+    }),
+    statics: () => ({
+      ProcessStarted: dart.definiteFunctionType(dart.dynamic, [io._ProcessResourceInfo]),
+      ProcessStopped: dart.definiteFunctionType(dart.dynamic, [io._ProcessResourceInfo]),
+      getStartedProcessesList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+      getStartedProcesses: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
+      getProcessInfoMapById: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()])
+    }),
+    names: ['ProcessStarted', 'ProcessStopped', 'getStartedProcessesList', 'getStartedProcesses', 'getProcessInfoMapById']
+  });
+  io._ProcessResourceInfo.TYPE = '_process';
+  dart.defineLazy(io._ProcessResourceInfo, {
+    get startedProcesses() {
+      return MapOfint$_ProcessResourceInfo().new();
+    },
+    set startedProcesses(_) {}
+  });
+  io._SocketResourceInfo = class _SocketResourceInfo extends io._ReadWriteResourceInfo {
+    new(socket) {
+      this.socket = socket;
+      super.new(io._SocketResourceInfo.TYPE);
+      io._SocketResourceInfo.SocketOpened(this);
+    }
+    get name() {
+      if (dart.test(dart.dload(this.socket, 'isListening'))) {
+        return dart.str`listening:${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}`;
+      }
+      let remote = '';
+      try {
+        let remoteHost = dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host');
+        let remotePort = dart.dload(this.socket, 'remotePort');
+        remote = dart.str` -> ${remoteHost}:${remotePort}`;
+      } catch (e) {
+      }
+
+      return dart.str`${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}${remote}`;
+    }
+    static getOpenSocketsList() {
+      return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$String())));
+    }
+    getSocketInfoMap() {
+      let result = this.fullValueMap;
+      result[dartx._set]('socketType', dart.test(dart.dload(this.socket, 'isTcp')) ? io._SocketResourceInfo.TCP_STRING : io._SocketResourceInfo.UDP_STRING);
+      result[dartx._set]('listening', core.String._check(dart.dload(this.socket, 'isListening')));
+      result[dartx._set]('host', core.String._check(dart.dload(dart.dload(this.socket, 'address'), 'host')));
+      result[dartx._set]('port', core.String._check(dart.dload(this.socket, 'port')));
+      if (!dart.test(dart.dload(this.socket, 'isListening'))) {
+        try {
+          result[dartx._set]('remoteHost', core.String._check(dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host')));
+          result[dartx._set]('remotePort', core.String._check(dart.dload(this.socket, 'remotePort')));
+        } catch (e) {
+          result[dartx._set]('remotePort', 'NA');
+          result[dartx._set]('remoteHost', 'NA');
+        }
+
+      } else {
+        result[dartx._set]('remotePort', 'NA');
+        result[dartx._set]('remoteHost', 'NA');
+      }
+      result[dartx._set]('addressType', core.String._check(dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name')));
+      return result;
+    }
+    static getSocketInfoMapByID(func, params) {
+      dart.assert(params[dartx.containsKey]('id'));
+      let id = core.int.parse(params[dartx._get]('id'));
+      let result = dart.test(io._SocketResourceInfo.openSockets[dartx.containsKey](id)) ? io._SocketResourceInfo.openSockets[dartx._get](id).getSocketInfoMap() : dart.map();
+      let json = convert.JSON.encode(result);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    static getOpenSockets(func, params) {
+      dart.assert(dart.equals(func, 'ext.dart.io.getOpenSockets'));
+      let data = dart.map({type: '_opensockets', data: io._SocketResourceInfo.getOpenSocketsList()}, core.String, core.Object);
+      let json = convert.JSON.encode(data);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    static SocketOpened(info) {
+      dart.assert(!dart.test(io._SocketResourceInfo.openSockets[dartx.containsKey](info.id)));
+      io._SocketResourceInfo.openSockets[dartx._set](info.id, info);
+    }
+    static SocketClosed(info) {
+      dart.assert(io._SocketResourceInfo.openSockets[dartx.containsKey](info.id));
+      io._SocketResourceInfo.openSockets[dartx.remove](info.id);
+    }
+  };
+  dart.setSignature(io._SocketResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SocketResourceInfo, [dart.dynamic])}),
+    fields: () => ({socket: dart.dynamic}),
+    getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+    methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    sfields: () => ({
+      TCP_STRING: core.String,
+      UDP_STRING: core.String,
+      TYPE: core.String,
+      openSockets: MapOfint$_SocketResourceInfo()
+    }),
+    statics: () => ({
+      getOpenSocketsList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+      getSocketInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
+      getOpenSockets: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic]),
+      SocketOpened: dart.definiteFunctionType(dart.dynamic, [io._SocketResourceInfo]),
+      SocketClosed: dart.definiteFunctionType(dart.dynamic, [io._SocketResourceInfo])
+    }),
+    names: ['getOpenSocketsList', 'getSocketInfoMapByID', 'getOpenSockets', 'SocketOpened', 'SocketClosed']
+  });
+  io._SocketResourceInfo.TCP_STRING = 'TCP';
+  io._SocketResourceInfo.UDP_STRING = 'UDP';
+  io._SocketResourceInfo.TYPE = '_socket';
+  dart.defineLazy(io._SocketResourceInfo, {
+    get openSockets() {
+      return MapOfint$_SocketResourceInfo().new();
+    },
+    set openSockets(_) {}
+  });
+  io.IOSink = class IOSink extends core.Object {
+    static new(target, opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return new io._IOSinkImpl(target, encoding);
+    }
+  };
+  io.IOSink[dart.implements] = () => [StreamSinkOfListOfint(), core.StringSink];
+  dart.setSignature(io.IOSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io.IOSink, [StreamConsumerOfListOfint()], {encoding: convert.Encoding})}),
+    fields: () => ({encoding: convert.Encoding})
+  });
+  io._FILE_EXISTS = 0;
+  io._FILE_CREATE = 1;
+  io._FILE_DELETE = 2;
+  io._FILE_RENAME = 3;
+  io._FILE_COPY = 4;
+  io._FILE_OPEN = 5;
+  io._FILE_RESOLVE_SYMBOLIC_LINKS = 6;
+  io._FILE_CLOSE = 7;
+  io._FILE_POSITION = 8;
+  io._FILE_SET_POSITION = 9;
+  io._FILE_TRUNCATE = 10;
+  io._FILE_LENGTH = 11;
+  io._FILE_LENGTH_FROM_PATH = 12;
+  io._FILE_LAST_MODIFIED = 13;
+  io._FILE_FLUSH = 14;
+  io._FILE_READ_BYTE = 15;
+  io._FILE_WRITE_BYTE = 16;
+  io._FILE_READ = 17;
+  io._FILE_READ_INTO = 18;
+  io._FILE_WRITE_FROM = 19;
+  io._FILE_CREATE_LINK = 20;
+  io._FILE_DELETE_LINK = 21;
+  io._FILE_RENAME_LINK = 22;
+  io._FILE_LINK_TARGET = 23;
+  io._FILE_TYPE = 24;
+  io._FILE_IDENTICAL = 25;
+  io._FILE_STAT = 26;
+  io._FILE_LOCK = 27;
+  io._SOCKET_LOOKUP = 28;
+  io._SOCKET_LIST_INTERFACES = 29;
+  io._SOCKET_REVERSE_LOOKUP = 30;
+  io._DIRECTORY_CREATE = 31;
+  io._DIRECTORY_DELETE = 32;
+  io._DIRECTORY_EXISTS = 33;
+  io._DIRECTORY_CREATE_TEMP = 34;
+  io._DIRECTORY_LIST_START = 35;
+  io._DIRECTORY_LIST_NEXT = 36;
+  io._DIRECTORY_LIST_STOP = 37;
+  io._DIRECTORY_RENAME = 38;
+  io._SSL_PROCESS_FILTER = 39;
+  io._IOService = class _IOService extends core.Object {
+    static _dispatch(request, data) {
+      dart.throw(new core.UnsupportedError("_IOService._dispatch"));
+    }
+  };
+  dart.setSignature(io._IOService, {
+    statics: () => ({_dispatch: dart.definiteFunctionType(async.Future, [core.int, core.List])}),
+    names: ['_dispatch']
+  });
+  io.Link = class Link extends core.Object {
+    static new(path) {
+      return new io._Link(path);
+    }
+    static fromUri(uri) {
+      return io.Link.new(uri.toFilePath());
+    }
+  };
+  io.Link[dart.implements] = () => [io.FileSystemEntity];
+  dart.setSignature(io.Link, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.Link, [core.String]),
+      fromUri: dart.definiteFunctionType(io.Link, [core.Uri])
+    })
+  });
+  const _makeWindowsLinkTarget = Symbol('_makeWindowsLinkTarget');
+  const _exceptionFromResponse = Symbol('_exceptionFromResponse');
+  io._Link = class _Link extends io.FileSystemEntity {
+    new(path) {
+      this.path = path;
+      if (!(typeof this.path == 'string')) {
+        dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+      }
+    }
+    toString() {
+      return dart.str`Link: '${this.path}'`;
+    }
+    exists() {
+      return io.FileSystemEntity.isLink(this.path);
+    }
+    existsSync() {
+      return io.FileSystemEntity.isLinkSync(this.path);
+    }
+    get absolute() {
+      return io.Link.new(this[_absolutePath]);
+    }
+    stat() {
+      return io.FileStat.stat(this.path);
+    }
+    statSync() {
+      return io.FileStat.statSync(this.path);
+    }
+    create(target, opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(io.Platform.isWindows)) {
+        target = this[_makeWindowsLinkTarget](target);
+      }
+      let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
+      return result.then(dart.dynamic)(dart.fn(_ => io._IOService._dispatch(io._FILE_CREATE_LINK, JSArrayOfString().of([this.path, target])), dynamicToFuture())).then(io._Link)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, dart.str`Cannot create link to target '${target}'`, this.path));
+        }
+        return this;
+      }, dynamicTo_Link()));
+    }
+    createSync(target, opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        this.parent.createSync({recursive: true});
+      }
+      if (dart.test(io.Platform.isWindows)) {
+        target = this[_makeWindowsLinkTarget](target);
+      }
+      let result = io._File._createLink(this.path, target);
+      io._Link.throwIfError(result, "Cannot create link", this.path);
+    }
+    [_makeWindowsLinkTarget](target) {
+      let base = core.Uri.file(dart.str`${io.Directory.current.path}\\`);
+      let link = core.Uri.file(this.path);
+      let destination = core.Uri.file(target);
+      let result = base.resolveUri(link).resolveUri(destination).toFilePath();
+      if (dart.notNull(result[dartx.length]) > 3 && result[dartx._get](1) == ':' && result[dartx._get](2) == '\\') {
+        return dart.str`\\??\\${result}`;
+      } else {
+        dart.throw(new io.FileSystemException(dart.str`Target ${result} of Link.create on Windows cannot be converted` + ' to start with a drive letter.  Unexpected error.'));
+      }
+    }
+    updateSync(target) {
+      this.deleteSync();
+      this.createSync(target);
+    }
+    update(target) {
+      return this.delete().then(io.Link)(dart.fn(_ => this.create(target), FileSystemEntityToFutureOfLink()));
+    }
+    [_delete](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).delete({recursive: true}).then(io._Link)(dart.fn(_ => this, FileSystemEntityTo_Link()));
+      }
+      return io._IOService._dispatch(io._FILE_DELETE_LINK, JSArrayOfString().of([this.path])).then(io._Link)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, "Cannot delete link", this.path));
+        }
+        return this;
+      }, dynamicTo_Link()));
+    }
+    [_deleteSync](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).deleteSync({recursive: true});
+      }
+      let result = io._File._deleteLinkNative(this.path);
+      io._Link.throwIfError(result, "Cannot delete link", this.path);
+    }
+    rename(newPath) {
+      return io._IOService._dispatch(io._FILE_RENAME_LINK, JSArrayOfString().of([this.path, newPath])).then(io.Link)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, dart.str`Cannot rename link to '${newPath}'`, this.path));
+        }
+        return io.Link.new(newPath);
+      }, dynamicToLink()));
+    }
+    renameSync(newPath) {
+      let result = io._File._renameLink(this.path, newPath);
+      io._Link.throwIfError(result, dart.str`Cannot rename link '${this.path}' to '${newPath}'`);
+      return io.Link.new(newPath);
+    }
+    target() {
+      return io._IOService._dispatch(io._FILE_LINK_TARGET, JSArrayOfString().of([this.path])).then(core.String)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, "Cannot get target of link", this.path));
+        }
+        return FutureOrOfString()._check(response);
+      }, dynamicToFutureOrOfString()));
+    }
+    targetSync() {
+      let result = io._File._linkTarget(this.path);
+      io._Link.throwIfError(result, "Cannot read link", this.path);
+      return core.String._check(result);
+    }
+    static throwIfError(result, msg, path) {
+      if (path === void 0) path = "";
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException(msg, path, result));
+      }
+    }
+    [_isErrorResponse](response) {
+      return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+    }
+    [_exceptionFromResponse](response, message, path) {
+      dart.assert(this[_isErrorResponse](response));
+      switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+        case io._ILLEGAL_ARGUMENT_RESPONSE:
+        {
+          return new core.ArgumentError();
+        }
+        case io._OSERROR_RESPONSE:
+        {
+          let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+          return new io.FileSystemException(message, path, err);
+        }
+        default:
+        {
+          return core.Exception.new("Unknown error");
+        }
+      }
+    }
+  };
+  io._Link[dart.implements] = () => [io.Link];
+  dart.setSignature(io._Link, {
+    constructors: () => ({new: dart.definiteFunctionType(io._Link, [core.String])}),
+    fields: () => ({path: core.String}),
+    getters: () => ({absolute: dart.definiteFunctionType(io.Link, [])}),
+    methods: () => ({
+      exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+      existsSync: dart.definiteFunctionType(core.bool, []),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+      statSync: dart.definiteFunctionType(io.FileStat, []),
+      create: dart.definiteFunctionType(async.Future$(io.Link), [core.String], {recursive: core.bool}),
+      createSync: dart.definiteFunctionType(dart.void, [core.String], {recursive: core.bool}),
+      [_makeWindowsLinkTarget]: dart.definiteFunctionType(core.String, [core.String]),
+      updateSync: dart.definiteFunctionType(dart.void, [core.String]),
+      update: dart.definiteFunctionType(async.Future$(io.Link), [core.String]),
+      [_delete]: dart.definiteFunctionType(async.Future$(io.Link), [], {recursive: core.bool}),
+      [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      rename: dart.definiteFunctionType(async.Future$(io.Link), [core.String]),
+      renameSync: dart.definiteFunctionType(io.Link, [core.String]),
+      target: dart.definiteFunctionType(async.Future$(core.String), []),
+      targetSync: dart.definiteFunctionType(core.String, []),
+      [_isErrorResponse]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+      [_exceptionFromResponse]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])
+    }),
+    statics: () => ({throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String], [core.String])}),
+    names: ['throwIfError']
+  });
+  io.Platform = class Platform extends core.Object {
+    static get numberOfProcessors() {
+      return io.Platform._numberOfProcessors;
+    }
+    static get pathSeparator() {
+      return io.Platform._pathSeparator;
+    }
+    static get operatingSystem() {
+      return io.Platform._operatingSystem;
+    }
+    static get localHostname() {
+      return io.Platform._localHostname;
+    }
+    static get environment() {
+      return io._Platform.environment;
+    }
+    static get executable() {
+      return io._Platform.executable;
+    }
+    static get resolvedExecutable() {
+      return io._Platform.resolvedExecutable;
+    }
+    static get script() {
+      return io._Platform.script;
+    }
+    static get executableArguments() {
+      return io._Platform.executableArguments;
+    }
+    static get packageRoot() {
+      return io._Platform.packageRoot;
+    }
+    static get packageConfig() {
+      return io._Platform.packageConfig;
+    }
+    static get version() {
+      return io.Platform._version;
+    }
+  };
+  dart.setSignature(io.Platform, {
+    sfields: () => ({
+      _numberOfProcessors: core.int,
+      _pathSeparator: core.String,
+      _operatingSystem: core.String,
+      _localHostname: core.String,
+      _version: core.String,
+      isLinux: core.bool,
+      isMacOS: core.bool,
+      isWindows: core.bool,
+      isAndroid: core.bool,
+      isIOS: core.bool
+    }),
+    sgetters: () => ({
+      numberOfProcessors: dart.definiteFunctionType(core.int, []),
+      pathSeparator: dart.definiteFunctionType(core.String, []),
+      operatingSystem: dart.definiteFunctionType(core.String, []),
+      localHostname: dart.definiteFunctionType(core.String, []),
+      environment: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+      executable: dart.definiteFunctionType(core.String, []),
+      resolvedExecutable: dart.definiteFunctionType(core.String, []),
+      script: dart.definiteFunctionType(core.Uri, []),
+      executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+      packageRoot: dart.definiteFunctionType(core.String, []),
+      packageConfig: dart.definiteFunctionType(core.String, []),
+      version: dart.definiteFunctionType(core.String, [])
+    })
+  });
+  dart.defineLazy(io.Platform, {
+    get _numberOfProcessors() {
+      return io._Platform.numberOfProcessors;
+    },
+    get _pathSeparator() {
+      return io._Platform.pathSeparator;
+    },
+    get _operatingSystem() {
+      return io._Platform.operatingSystem;
+    },
+    get _localHostname() {
+      return io._Platform.localHostname;
+    },
+    get _version() {
+      return io._Platform.version;
+    },
+    get isLinux() {
+      return io.Platform._operatingSystem == "linux";
+    },
+    get isMacOS() {
+      return io.Platform._operatingSystem == "macos";
+    },
+    get isWindows() {
+      return io.Platform._operatingSystem == "windows";
+    },
+    get isAndroid() {
+      return io.Platform._operatingSystem == "android";
+    },
+    get isIOS() {
+      return io.Platform._operatingSystem == "ios";
+    }
+  });
+  io._Platform = class _Platform extends core.Object {
+    static _numberOfProcessors() {
+      dart.throw(new core.UnsupportedError("Platform._numberOfProcessors"));
+    }
+    static _pathSeparator() {
+      dart.throw(new core.UnsupportedError("Platform._pathSeparator"));
+    }
+    static _operatingSystem() {
+      dart.throw(new core.UnsupportedError("Platform._operatingSystem"));
+    }
+    static _localHostname() {
+      dart.throw(new core.UnsupportedError("Platform._localHostname"));
+    }
+    static _executable() {
+      dart.throw(new core.UnsupportedError("Platform._executable"));
+    }
+    static _resolvedExecutable() {
+      dart.throw(new core.UnsupportedError("Platform._resolvedExecutable"));
+    }
+    static _environment() {
+      dart.throw(new core.UnsupportedError("Platform._environment"));
+    }
+    static _executableArguments() {
+      dart.throw(new core.UnsupportedError("Platform._executableArguments"));
+    }
+    static _packageRoot() {
+      dart.throw(new core.UnsupportedError("Platform._packageRoot"));
+    }
+    static _packageConfig() {
+      dart.throw(new core.UnsupportedError("Platform._packageConfig"));
+    }
+    static _version() {
+      dart.throw(new core.UnsupportedError("Platform._version"));
+    }
+    static get numberOfProcessors() {
+      return io._Platform._numberOfProcessors();
+    }
+    static get pathSeparator() {
+      return io._Platform._pathSeparator();
+    }
+    static get operatingSystem() {
+      return io._Platform._operatingSystem();
+    }
+    static get localHostname() {
+      let result = io._Platform._localHostname();
+      if (io.OSError.is(result)) {
+        dart.throw(result);
+      } else {
+        return core.String._check(result);
+      }
+    }
+    static get executableArguments() {
+      return io._Platform._executableArguments();
+    }
+    static get environment() {
+      if (io._Platform._environmentCache == null) {
+        let env = io._Platform._environment();
+        if (!io.OSError.is(env)) {
+          let isWindows = io._Platform.operatingSystem == 'windows';
+          let result = isWindows ? new io._CaseInsensitiveStringMap() : core.Map.new();
+          for (let str of core.Iterable._check(env)) {
+            let equalsIndex = dart.dsend(str, 'indexOf', '=');
+            if (dart.test(dart.dsend(equalsIndex, '>', 0))) {
+              result[dartx._set](dart.dsend(str, 'substring', 0, equalsIndex), dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1)));
+            }
+          }
+          io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(MapOfString$String()._check(result));
+        } else {
+          io._Platform._environmentCache = env;
+        }
+      }
+      if (io.OSError.is(io._Platform._environmentCache)) {
+        dart.throw(io._Platform._environmentCache);
+      } else {
+        return MapOfString$String()._check(io._Platform._environmentCache);
+      }
+    }
+    static get version() {
+      return io._Platform._version();
+    }
+  };
+  dart.setSignature(io._Platform, {
+    sfields: () => ({
+      executable: core.String,
+      resolvedExecutable: core.String,
+      packageRoot: core.String,
+      packageConfig: core.String,
+      _environmentCache: dart.dynamic,
+      script: core.Uri
+    }),
+    sgetters: () => ({
+      numberOfProcessors: dart.definiteFunctionType(core.int, []),
+      pathSeparator: dart.definiteFunctionType(core.String, []),
+      operatingSystem: dart.definiteFunctionType(core.String, []),
+      localHostname: dart.definiteFunctionType(core.String, []),
+      executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+      environment: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+      version: dart.definiteFunctionType(core.String, [])
+    }),
+    statics: () => ({
+      _numberOfProcessors: dart.definiteFunctionType(core.int, []),
+      _pathSeparator: dart.definiteFunctionType(core.String, []),
+      _operatingSystem: dart.definiteFunctionType(core.String, []),
+      _localHostname: dart.definiteFunctionType(dart.dynamic, []),
+      _executable: dart.definiteFunctionType(dart.dynamic, []),
+      _resolvedExecutable: dart.definiteFunctionType(dart.dynamic, []),
+      _environment: dart.definiteFunctionType(dart.dynamic, []),
+      _executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+      _packageRoot: dart.definiteFunctionType(core.String, []),
+      _packageConfig: dart.definiteFunctionType(core.String, []),
+      _version: dart.definiteFunctionType(core.String, [])
+    }),
+    names: ['_numberOfProcessors', '_pathSeparator', '_operatingSystem', '_localHostname', '_executable', '_resolvedExecutable', '_environment', '_executableArguments', '_packageRoot', '_packageConfig', '_version']
+  });
+  io._Platform._environmentCache = null;
+  io._Platform.script = null;
+  dart.defineLazy(io._Platform, {
+    get executable() {
+      return core.String._check(io._Platform._executable());
+    },
+    set executable(_) {},
+    get resolvedExecutable() {
+      return core.String._check(io._Platform._resolvedExecutable());
+    },
+    set resolvedExecutable(_) {},
+    get packageRoot() {
+      return io._Platform._packageRoot();
+    },
+    set packageRoot(_) {},
+    get packageConfig() {
+      return io._Platform._packageConfig();
+    },
+    set packageConfig(_) {}
+  });
+  const _map$1 = Symbol('_map');
+  io._CaseInsensitiveStringMap$ = dart.generic(V => {
+    let MapOfString$V = () => (MapOfString$V = dart.constFn(core.Map$(core.String, V)))();
+    let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
+    let StringAndVTovoid = () => (StringAndVTovoid = dart.constFn(dart.functionType(dart.void, [core.String, V])))();
+    class _CaseInsensitiveStringMap extends core.Object {
+      new() {
+        this[_map$1] = MapOfString$V().new();
+      }
+      containsKey(key) {
+        return typeof key == 'string' && dart.test(this[_map$1][dartx.containsKey](key[dartx.toUpperCase]()));
+      }
+      containsValue(value) {
+        return this[_map$1][dartx.containsValue](value);
+      }
+      _get(key) {
+        return typeof key == 'string' ? this[_map$1][dartx._get](key[dartx.toUpperCase]()) : null;
+      }
+      _set(key, value) {
+        V._check(value);
+        this[_map$1][dartx._set](key[dartx.toUpperCase](), value);
+        return value;
+      }
+      putIfAbsent(key, ifAbsent) {
+        VoidToV()._check(ifAbsent);
+        return this[_map$1][dartx.putIfAbsent](key[dartx.toUpperCase](), ifAbsent);
+      }
+      addAll(other) {
+        other[dartx.forEach](dart.fn((key, value) => this._set(core.String._check(dart.dsend(key, 'toUpperCase')), V._check(value)), dynamicAnddynamicTovoid$()));
+      }
+      remove(key) {
+        return typeof key == 'string' ? this[_map$1][dartx.remove](key[dartx.toUpperCase]()) : null;
+      }
+      clear() {
+        this[_map$1][dartx.clear]();
+      }
+      forEach(f) {
+        this[_map$1][dartx.forEach](f);
+      }
+      get keys() {
+        return this[_map$1][dartx.keys];
+      }
+      get values() {
+        return this[_map$1][dartx.values];
+      }
+      get length() {
+        return this[_map$1][dartx.length];
+      }
+      get isEmpty() {
+        return this[_map$1][dartx.isEmpty];
+      }
+      get isNotEmpty() {
+        return this[_map$1][dartx.isNotEmpty];
+      }
+      toString() {
+        return dart.toString(this[_map$1]);
+      }
+    }
+    dart.addTypeTests(_CaseInsensitiveStringMap);
+    _CaseInsensitiveStringMap[dart.implements] = () => [MapOfString$V()];
+    dart.setSignature(_CaseInsensitiveStringMap, {
+      fields: () => ({[_map$1]: MapOfString$V()}),
+      getters: () => ({
+        keys: dart.definiteFunctionType(core.Iterable$(core.String), []),
+        values: dart.definiteFunctionType(core.Iterable$(V), []),
+        length: dart.definiteFunctionType(core.int, []),
+        isEmpty: dart.definiteFunctionType(core.bool, []),
+        isNotEmpty: dart.definiteFunctionType(core.bool, [])
+      }),
+      methods: () => ({
+        containsKey: dart.definiteFunctionType(core.bool, [core.Object]),
+        containsValue: dart.definiteFunctionType(core.bool, [core.Object]),
+        _get: dart.definiteFunctionType(V, [core.Object]),
+        _set: dart.definiteFunctionType(dart.void, [core.String, V]),
+        putIfAbsent: dart.definiteFunctionType(V, [core.String, VoidToV()]),
+        addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+        remove: dart.definiteFunctionType(V, [core.Object]),
+        clear: dart.definiteFunctionType(dart.void, []),
+        forEach: dart.definiteFunctionType(dart.void, [StringAndVTovoid()])
+      })
+    });
+    dart.defineExtensionMembers(_CaseInsensitiveStringMap, [
+      'containsKey',
+      'containsValue',
+      '_get',
+      '_set',
+      'putIfAbsent',
+      'addAll',
+      'remove',
+      'clear',
+      'forEach',
+      'keys',
+      'values',
+      'length',
+      'isEmpty',
+      'isNotEmpty'
+    ]);
+    return _CaseInsensitiveStringMap;
+  });
+  io._CaseInsensitiveStringMap = _CaseInsensitiveStringMap();
+  io._ProcessUtils = class _ProcessUtils extends core.Object {
+    static _exit(status) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._exit"));
+    }
+    static _setExitCode(status) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._setExitCode"));
+    }
+    static _getExitCode() {
+      dart.throw(new core.UnsupportedError("ProcessUtils._getExitCode"));
+    }
+    static _sleep(millis) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._sleep"));
+    }
+    static _pid(process) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._pid"));
+    }
+    static _watchSignal(signal) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._watchSignal"));
+    }
+  };
+  dart.setSignature(io._ProcessUtils, {
+    statics: () => ({
+      _exit: dart.definiteFunctionType(dart.void, [core.int]),
+      _setExitCode: dart.definiteFunctionType(dart.void, [core.int]),
+      _getExitCode: dart.definiteFunctionType(core.int, []),
+      _sleep: dart.definiteFunctionType(dart.void, [core.int]),
+      _pid: dart.definiteFunctionType(core.int, [io.Process]),
+      _watchSignal: dart.definiteFunctionType(async.Stream$(io.ProcessSignal), [io.ProcessSignal])
+    }),
+    names: ['_exit', '_setExitCode', '_getExitCode', '_sleep', '_pid', '_watchSignal']
+  });
+  io.exit = function(code) {
+    if (!(typeof code == 'number')) {
+      dart.throw(new core.ArgumentError("Integer value for exit code expected"));
+    }
+    io._ProcessUtils._exit(code);
+  };
+  dart.fn(io.exit, intTovoid());
+  dart.copyProperties(io, {
+    set exitCode(code) {
+      if (!(typeof code == 'number')) {
+        dart.throw(new core.ArgumentError("Integer value for exit code expected"));
+      }
+      io._ProcessUtils._setExitCode(code);
+    },
+    get exitCode() {
+      return io._ProcessUtils._getExitCode();
+    }
+  });
+  io.sleep = function(duration) {
+    let milliseconds = duration.inMilliseconds;
+    if (dart.notNull(milliseconds) < 0) {
+      dart.throw(new core.ArgumentError("sleep: duration cannot be negative"));
+    }
+    io._ProcessUtils._sleep(milliseconds);
+  };
+  dart.fn(io.sleep, DurationTovoid());
+  dart.copyProperties(io, {
+    get pid() {
+      return io._ProcessUtils._pid(null);
+    }
+  });
+  io.ProcessStartMode = class ProcessStartMode extends core.Object {
+    new(index) {
+      this.index = index;
+    }
+    toString() {
+      return {
+        0: "ProcessStartMode.NORMAL",
+        1: "ProcessStartMode.DETACHED",
+        2: "ProcessStartMode.DETACHED_WITH_STDIO"
+      }[this.index];
+    }
+  };
+  dart.setSignature(io.ProcessStartMode, {
+    fields: () => ({index: core.int})
+  });
+  dart.defineEnumValues(io.ProcessStartMode, [
+    'NORMAL',
+    'DETACHED',
+    'DETACHED_WITH_STDIO'
+  ]);
+  io.Process = class Process extends core.Object {
+    new() {
+      this.exitCode = null;
+    }
+    static start(executable, arguments$, opts) {
+      let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+      let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+      let mode = opts && 'mode' in opts ? opts.mode : io.ProcessStartMode.NORMAL;
+      dart.throw(new core.UnsupportedError("Process.start"));
+    }
+    static run(executable, arguments$, opts) {
+      let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+      let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+      let stdoutEncoding = opts && 'stdoutEncoding' in opts ? opts.stdoutEncoding : io.SYSTEM_ENCODING;
+      let stderrEncoding = opts && 'stderrEncoding' in opts ? opts.stderrEncoding : io.SYSTEM_ENCODING;
+      dart.throw(new core.UnsupportedError("Process.run"));
+    }
+    static runSync(executable, arguments$, opts) {
+      let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+      let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+      let stdoutEncoding = opts && 'stdoutEncoding' in opts ? opts.stdoutEncoding : io.SYSTEM_ENCODING;
+      let stderrEncoding = opts && 'stderrEncoding' in opts ? opts.stderrEncoding : io.SYSTEM_ENCODING;
+      dart.throw(new core.UnsupportedError("Process.runSync"));
+    }
+    static killPid(pid, signal) {
+      if (signal === void 0) signal = io.ProcessSignal.SIGTERM;
+      dart.throw(new core.UnsupportedError("Process.killPid"));
+    }
+  };
+  dart.setSignature(io.Process, {
+    fields: () => ({exitCode: FutureOfint()}),
+    statics: () => ({
+      start: dart.definiteFunctionType(async.Future$(io.Process), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, mode: io.ProcessStartMode}),
+      run: dart.definiteFunctionType(async.Future$(io.ProcessResult), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
+      runSync: dart.definiteFunctionType(io.ProcessResult, [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
+      killPid: dart.definiteFunctionType(core.bool, [core.int], [io.ProcessSignal])
+    }),
+    names: ['start', 'run', 'runSync', 'killPid']
+  });
+  io.ProcessResult = class ProcessResult extends core.Object {
+    new(pid, exitCode, stdout, stderr) {
+      this.pid = pid;
+      this.exitCode = exitCode;
+      this.stdout = stdout;
+      this.stderr = stderr;
+    }
+  };
+  dart.setSignature(io.ProcessResult, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ProcessResult, [core.int, core.int, dart.dynamic, dart.dynamic])}),
+    fields: () => ({
+      exitCode: core.int,
+      stdout: dart.dynamic,
+      stderr: dart.dynamic,
+      pid: core.int
+    })
+  });
+  const _signalNumber = Symbol('_signalNumber');
+  const _name$2 = Symbol('_name');
+  io.ProcessSignal = class ProcessSignal extends core.Object {
+    _(signalNumber, name) {
+      this[_signalNumber] = signalNumber;
+      this[_name$2] = name;
+    }
+    toString() {
+      return this[_name$2];
+    }
+    watch() {
+      return io._ProcessUtils._watchSignal(this);
+    }
+  };
+  dart.defineNamedConstructor(io.ProcessSignal, '_');
+  dart.setSignature(io.ProcessSignal, {
+    constructors: () => ({_: dart.definiteFunctionType(io.ProcessSignal, [core.int, core.String])}),
+    fields: () => ({
+      [_signalNumber]: core.int,
+      [_name$2]: core.String
+    }),
+    methods: () => ({watch: dart.definiteFunctionType(async.Stream$(io.ProcessSignal), [])}),
+    sfields: () => ({
+      SIGHUP: io.ProcessSignal,
+      SIGINT: io.ProcessSignal,
+      SIGQUIT: io.ProcessSignal,
+      SIGILL: io.ProcessSignal,
+      SIGTRAP: io.ProcessSignal,
+      SIGABRT: io.ProcessSignal,
+      SIGBUS: io.ProcessSignal,
+      SIGFPE: io.ProcessSignal,
+      SIGKILL: io.ProcessSignal,
+      SIGUSR1: io.ProcessSignal,
+      SIGSEGV: io.ProcessSignal,
+      SIGUSR2: io.ProcessSignal,
+      SIGPIPE: io.ProcessSignal,
+      SIGALRM: io.ProcessSignal,
+      SIGTERM: io.ProcessSignal,
+      SIGCHLD: io.ProcessSignal,
+      SIGCONT: io.ProcessSignal,
+      SIGSTOP: io.ProcessSignal,
+      SIGTSTP: io.ProcessSignal,
+      SIGTTIN: io.ProcessSignal,
+      SIGTTOU: io.ProcessSignal,
+      SIGURG: io.ProcessSignal,
+      SIGXCPU: io.ProcessSignal,
+      SIGXFSZ: io.ProcessSignal,
+      SIGVTALRM: io.ProcessSignal,
+      SIGPROF: io.ProcessSignal,
+      SIGWINCH: io.ProcessSignal,
+      SIGPOLL: io.ProcessSignal,
+      SIGSYS: io.ProcessSignal
+    })
+  });
+  dart.defineLazy(io.ProcessSignal, {
+    get SIGHUP() {
+      return dart.const(new io.ProcessSignal._(1, "SIGHUP"));
+    },
+    get SIGINT() {
+      return dart.const(new io.ProcessSignal._(2, "SIGINT"));
+    },
+    get SIGQUIT() {
+      return dart.const(new io.ProcessSignal._(3, "SIGQUIT"));
+    },
+    get SIGILL() {
+      return dart.const(new io.ProcessSignal._(4, "SIGILL"));
+    },
+    get SIGTRAP() {
+      return dart.const(new io.ProcessSignal._(5, "SIGTRAP"));
+    },
+    get SIGABRT() {
+      return dart.const(new io.ProcessSignal._(6, "SIGABRT"));
+    },
+    get SIGBUS() {
+      return dart.const(new io.ProcessSignal._(7, "SIGBUS"));
+    },
+    get SIGFPE() {
+      return dart.const(new io.ProcessSignal._(8, "SIGFPE"));
+    },
+    get SIGKILL() {
+      return dart.const(new io.ProcessSignal._(9, "SIGKILL"));
+    },
+    get SIGUSR1() {
+      return dart.const(new io.ProcessSignal._(10, "SIGUSR1"));
+    },
+    get SIGSEGV() {
+      return dart.const(new io.ProcessSignal._(11, "SIGSEGV"));
+    },
+    get SIGUSR2() {
+      return dart.const(new io.ProcessSignal._(12, "SIGUSR2"));
+    },
+    get SIGPIPE() {
+      return dart.const(new io.ProcessSignal._(13, "SIGPIPE"));
+    },
+    get SIGALRM() {
+      return dart.const(new io.ProcessSignal._(14, "SIGALRM"));
+    },
+    get SIGTERM() {
+      return dart.const(new io.ProcessSignal._(15, "SIGTERM"));
+    },
+    get SIGCHLD() {
+      return dart.const(new io.ProcessSignal._(17, "SIGCHLD"));
+    },
+    get SIGCONT() {
+      return dart.const(new io.ProcessSignal._(18, "SIGCONT"));
+    },
+    get SIGSTOP() {
+      return dart.const(new io.ProcessSignal._(19, "SIGSTOP"));
+    },
+    get SIGTSTP() {
+      return dart.const(new io.ProcessSignal._(20, "SIGTSTP"));
+    },
+    get SIGTTIN() {
+      return dart.const(new io.ProcessSignal._(21, "SIGTTIN"));
+    },
+    get SIGTTOU() {
+      return dart.const(new io.ProcessSignal._(22, "SIGTTOU"));
+    },
+    get SIGURG() {
+      return dart.const(new io.ProcessSignal._(23, "SIGURG"));
+    },
+    get SIGXCPU() {
+      return dart.const(new io.ProcessSignal._(24, "SIGXCPU"));
+    },
+    get SIGXFSZ() {
+      return dart.const(new io.ProcessSignal._(25, "SIGXFSZ"));
+    },
+    get SIGVTALRM() {
+      return dart.const(new io.ProcessSignal._(26, "SIGVTALRM"));
+    },
+    get SIGPROF() {
+      return dart.const(new io.ProcessSignal._(27, "SIGPROF"));
+    },
+    get SIGWINCH() {
+      return dart.const(new io.ProcessSignal._(28, "SIGWINCH"));
+    },
+    get SIGPOLL() {
+      return dart.const(new io.ProcessSignal._(29, "SIGPOLL"));
+    },
+    get SIGSYS() {
+      return dart.const(new io.ProcessSignal._(31, "SIGSYS"));
+    }
+  });
+  io.SignalException = class SignalException extends core.Object {
+    new(message, osError) {
+      if (osError === void 0) osError = null;
+      this.message = message;
+      this.osError = osError;
+    }
+    toString() {
+      let msg = "";
+      if (this.osError != null) {
+        msg = dart.str`, osError: ${this.osError}`;
+      }
+      return dart.str`SignalException: ${this.message}${msg}`;
+    }
+  };
+  io.SignalException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.SignalException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.SignalException, [core.String], [dart.dynamic])}),
+    fields: () => ({
+      message: core.String,
+      osError: dart.dynamic
+    })
+  });
+  io.ProcessException = class ProcessException extends core.Object {
+    new(executable, arguments$, message, errorCode) {
+      if (message === void 0) message = "";
+      if (errorCode === void 0) errorCode = 0;
+      this.executable = executable;
+      this.arguments = arguments$;
+      this.message = message;
+      this.errorCode = errorCode;
+    }
+    toString() {
+      let msg = this.message == null ? dart.str`OS error code: ${this.errorCode}` : this.message;
+      let args = this.arguments[dartx.join](' ');
+      return dart.str`ProcessException: ${msg}\n  Command: ${this.executable} ${args}`;
+    }
+  };
+  io.ProcessException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.ProcessException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ProcessException, [core.String, ListOfString()], [core.String, core.int])}),
+    fields: () => ({
+      executable: core.String,
+      arguments: ListOfString(),
+      message: core.String,
+      errorCode: core.int
+    })
+  });
+  const _detachRaw = Symbol('_detachRaw');
+  io.SecureSocket = class SecureSocket extends core.Object {
+    static _(rawSocket) {
+      dart.throw(new core.UnsupportedError("SecureSocket constructor"));
+    }
+    static connect(host, port, opts) {
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      return io.RawSecureSocket.connect(host, port, {context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols}).then(io.SecureSocket)(dart.fn(rawSocket => io.SecureSocket._(rawSocket), RawSecureSocketToSecureSocket()));
+    }
+    static secure(socket, opts) {
+      let host = opts && 'host' in opts ? opts.host : null;
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let completer = async.Completer.new();
+      dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket._check(dart.dindex(detachedRaw, 0)), {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
+        completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
+      }, dynamicToNull$()));
+      return FutureOfSecureSocket()._check(completer.future);
+    }
+    static secureServer(socket, context, opts) {
+      let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      let completer = async.Completer.new();
+      dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket._check(dart.dindex(detachedRaw, 0)), context, {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
+        completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
+      }, dynamicToNull$()));
+      return FutureOfSecureSocket()._check(completer.future);
+    }
+  };
+  io.SecureSocket[dart.implements] = () => [io.Socket];
+  dart.setSignature(io.SecureSocket, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SecureSocket, [io.RawSecureSocket])}),
+    statics: () => ({
+      connect: dart.definiteFunctionType(async.Future$(io.SecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      secure: dart.definiteFunctionType(async.Future$(io.SecureSocket), [io.Socket], {host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool()}),
+      secureServer: dart.definiteFunctionType(async.Future$(io.SecureSocket), [io.Socket, io.SecurityContext], {bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+    }),
+    names: ['connect', 'secure', 'secureServer']
+  });
+  io.SecureServerSocket = class SecureServerSocket extends async.Stream$(io.SecureSocket) {
+    _(socket) {
+      this[_socket] = socket;
+      super.new();
+    }
+    static bind(address, port, context, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io.RawSecureServerSocket.bind(address, port, context, {backlog: backlog, v6Only: v6Only, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols, shared: shared}).then(io.SecureServerSocket)(dart.fn(serverSocket => new io.SecureServerSocket._(serverSocket), RawSecureServerSocketToSecureServerSocket()));
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_socket].map(io.SecureSocket)(dart.fn(rawSocket => io.SecureSocket._(rawSocket), RawSecureSocketToSecureSocket())).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get port() {
+      return this[_socket].port;
+    }
+    get address() {
+      return this[_socket].address;
+    }
+    close() {
+      return this[_socket].close().then(io.SecureServerSocket)(dart.fn(_ => this, RawSecureServerSocketToSecureServerSocket()));
+    }
+    set [_owner](owner) {
+      this[_socket][_owner] = owner;
+    }
+  };
+  dart.addSimpleTypeTests(io.SecureServerSocket);
+  dart.defineNamedConstructor(io.SecureServerSocket, '_');
+  dart.setSignature(io.SecureServerSocket, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SecureServerSocket, [io.RawSecureServerSocket])}),
+    fields: () => ({[_socket]: io.RawSecureServerSocket}),
+    getters: () => ({
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, [])
+    }),
+    setters: () => ({[_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.SecureSocket), [SecureSocketTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(async.Future$(io.SecureServerSocket), [])
+    }),
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.SecureServerSocket), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString(), shared: core.bool})}),
+    names: ['bind']
+  });
+  const _onSubscriptionStateChange = Symbol('_onSubscriptionStateChange');
+  const _onPauseStateChange = Symbol('_onPauseStateChange');
+  io.RawSecureSocket = class RawSecureSocket extends core.Object {
+    static connect(host, port, opts) {
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      io._RawSecureSocket._verifyFields(host, port, false, false, false, onBadCertificate);
+      return io.RawSocket.connect(host, port).then(io.RawSecureSocket)(dart.fn(socket => io.RawSecureSocket.secure(socket, {context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols}), RawSocketToFutureOfRawSecureSocket()));
+    }
+    static secure(socket, opts) {
+      let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+      let host = opts && 'host' in opts ? opts.host : null;
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      socket.readEventsEnabled = false;
+      socket.writeEventsEnabled = false;
+      return io._RawSecureSocket.connect(host != null ? host : socket.address.host, socket.port, {is_server: false, socket: socket, subscription: subscription, context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols});
+    }
+    static secureServer(socket, context, opts) {
+      let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+      let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      socket.readEventsEnabled = false;
+      socket.writeEventsEnabled = false;
+      return io._RawSecureSocket.connect(socket.address, socket.remotePort, {context: context, is_server: true, socket: socket, subscription: subscription, bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols});
+    }
+  };
+  io.RawSecureSocket[dart.implements] = () => [io.RawSocket];
+  dart.setSignature(io.RawSecureSocket, {
+    statics: () => ({
+      connect: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: async.StreamSubscription, host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+    }),
+    names: ['connect', 'secure', 'secureServer']
+  });
+  io.RawSecureServerSocket = class RawSecureServerSocket extends async.Stream$(io.RawSecureSocket) {
+    _(socket, context, requestClientCertificate, requireClientCertificate, supportedProtocols) {
+      this[_socket] = socket;
+      this[_context] = context;
+      this.requestClientCertificate = requestClientCertificate;
+      this.requireClientCertificate = requireClientCertificate;
+      this.supportedProtocols = supportedProtocols;
+      this[_controller$0] = null;
+      this[_subscription$] = null;
+      this[_closed] = false;
+      super.new();
+      this[_controller$0] = StreamControllerOfRawSecureSocket().new({sync: true, onListen: dart.bind(this, _onSubscriptionStateChange), onPause: dart.bind(this, _onPauseStateChange), onResume: dart.bind(this, _onPauseStateChange), onCancel: dart.bind(this, _onSubscriptionStateChange)});
+    }
+    static bind(address, port, context, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io.RawServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io.RawSecureServerSocket)(dart.fn(serverSocket => new io.RawSecureServerSocket._(serverSocket, context, requestClientCertificate, requireClientCertificate, supportedProtocols), RawServerSocketToRawSecureServerSocket()));
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get port() {
+      return this[_socket].port;
+    }
+    get address() {
+      return this[_socket].address;
+    }
+    close() {
+      this[_closed] = true;
+      return this[_socket].close().then(io.RawSecureServerSocket)(dart.fn(_ => this, RawServerSocketToRawSecureServerSocket()));
+    }
+    [_onData$](connection) {
+      let remotePort = null;
+      try {
+        remotePort = connection.remotePort;
+      } catch (e) {
+        return;
+      }
+
+      io._RawSecureSocket.connect(connection.address, core.int._check(remotePort), {context: this[_context], is_server: true, socket: connection, requestClientCertificate: this.requestClientCertificate, requireClientCertificate: this.requireClientCertificate, supportedProtocols: this.supportedProtocols}).then(dart.dynamic)(dart.fn(secureConnection => {
+        if (dart.test(this[_closed])) {
+          secureConnection.close();
+        } else {
+          this[_controller$0].add(secureConnection);
+        }
+      }, RawSecureSocketToNull())).catchError(dart.fn((e, s) => {
+        if (!dart.test(this[_closed])) {
+          this[_controller$0].addError(e, core.StackTrace._check(s));
+        }
+      }, dynamicAnddynamicToNull()));
+    }
+    [_onPauseStateChange]() {
+      if (dart.test(this[_controller$0].isPaused)) {
+        this[_subscription$].pause();
+      } else {
+        this[_subscription$].resume();
+      }
+    }
+    [_onSubscriptionStateChange]() {
+      if (dart.test(this[_controller$0].hasListener)) {
+        this[_subscription$] = this[_socket].listen(dart.bind(this, _onData$), {onError: dart.bind(this[_controller$0], 'addError'), onDone: dart.bind(this[_controller$0], 'close')});
+      } else {
+        this.close();
+      }
+    }
+    set [_owner](owner) {
+      dart.dput(this[_socket], _owner, owner);
+    }
+  };
+  dart.addSimpleTypeTests(io.RawSecureServerSocket);
+  dart.defineNamedConstructor(io.RawSecureServerSocket, '_');
+  dart.setSignature(io.RawSecureServerSocket, {
+    constructors: () => ({_: dart.definiteFunctionType(io.RawSecureServerSocket, [io.RawServerSocket, io.SecurityContext, core.bool, core.bool, ListOfString()])}),
+    fields: () => ({
+      [_socket]: io.RawServerSocket,
+      [_controller$0]: StreamControllerOfRawSecureSocket(),
+      [_subscription$]: StreamSubscriptionOfRawSocket(),
+      [_context]: io.SecurityContext,
+      requestClientCertificate: core.bool,
+      requireClientCertificate: core.bool,
+      supportedProtocols: ListOfString(),
+      [_closed]: core.bool
+    }),
+    getters: () => ({
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, [])
+    }),
+    setters: () => ({[_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSecureSocket), [RawSecureSocketTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(async.Future$(io.RawSecureServerSocket), []),
+      [_onData$]: dart.definiteFunctionType(dart.void, [io.RawSocket]),
+      [_onPauseStateChange]: dart.definiteFunctionType(dart.void, []),
+      [_onSubscriptionStateChange]: dart.definiteFunctionType(dart.void, [])
+    }),
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawSecureServerSocket), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString(), shared: core.bool})}),
+    names: ['bind']
+  });
+  io.X509Certificate = class X509Certificate extends core.Object {
+    static _() {
+      dart.throw(new core.UnsupportedError("X509Certificate constructor"));
+    }
+  };
+  dart.setSignature(io.X509Certificate, {
+    constructors: () => ({_: dart.definiteFunctionType(io.X509Certificate, [])})
+  });
+  io._FilterStatus = class _FilterStatus extends core.Object {
+    new() {
+      this.progress = false;
+      this.readEmpty = true;
+      this.writeEmpty = true;
+      this.readPlaintextNoLongerEmpty = false;
+      this.writePlaintextNoLongerFull = false;
+      this.readEncryptedNoLongerFull = false;
+      this.writeEncryptedNoLongerEmpty = false;
+    }
+  };
+  dart.setSignature(io._FilterStatus, {
+    constructors: () => ({new: dart.definiteFunctionType(io._FilterStatus, [])}),
+    fields: () => ({
+      progress: core.bool,
+      readEmpty: core.bool,
+      writeEmpty: core.bool,
+      readPlaintextNoLongerEmpty: core.bool,
+      writePlaintextNoLongerFull: core.bool,
+      readEncryptedNoLongerFull: core.bool,
+      writeEncryptedNoLongerEmpty: core.bool
+    })
+  });
+  const _handshakeComplete = Symbol('_handshakeComplete');
+  const _status = Symbol('_status');
+  const _filterStatus = Symbol('_filterStatus');
+  const _secureFilter = Symbol('_secureFilter');
+  const _bufferedData = Symbol('_bufferedData');
+  const _bufferedDataIndex = Symbol('_bufferedDataIndex');
+  const _writeEventsEnabled = Symbol('_writeEventsEnabled');
+  const _readEventsEnabled = Symbol('_readEventsEnabled');
+  const _pendingReadEvent = Symbol('_pendingReadEvent');
+  const _socketClosedRead = Symbol('_socketClosedRead');
+  const _socketClosedWrite = Symbol('_socketClosedWrite');
+  const _closedRead = Symbol('_closedRead');
+  const _closedWrite = Symbol('_closedWrite');
+  const _connectPending = Symbol('_connectPending');
+  const _filterPending = Symbol('_filterPending');
+  const _filterActive = Symbol('_filterActive');
+  const _selectedProtocol = Symbol('_selectedProtocol');
+  const _secureHandshakeCompleteHandler = Symbol('_secureHandshakeCompleteHandler');
+  const _onBadCertificateWrapper = Symbol('_onBadCertificateWrapper');
+  const _eventDispatcher = Symbol('_eventDispatcher');
+  const _doneHandler = Symbol('_doneHandler');
+  const _secureHandshake = Symbol('_secureHandshake');
+  const _sendWriteEvent = Symbol('_sendWriteEvent');
+  const _completeCloseCompleter = Symbol('_completeCloseCompleter');
+  const _close$0 = Symbol('_close');
+  const _scheduleReadEvent = Symbol('_scheduleReadEvent');
+  const _scheduleFilter = Symbol('_scheduleFilter');
+  const _readHandler = Symbol('_readHandler');
+  const _writeHandler = Symbol('_writeHandler');
+  const _closeHandler = Symbol('_closeHandler');
+  const _readSocket = Symbol('_readSocket');
+  const _writeSocket = Symbol('_writeSocket');
+  const _tryFilter = Symbol('_tryFilter');
+  const _pushAllFilterStages = Symbol('_pushAllFilterStages');
+  const _readSocketOrBufferedData = Symbol('_readSocketOrBufferedData');
+  const _sendReadEvent = Symbol('_sendReadEvent');
+  let const$75;
+  io.RawSocketEvent = class RawSocketEvent extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+    toString() {
+      return (const$75 || (const$75 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
+    }
+  };
+  dart.defineNamedConstructor(io.RawSocketEvent, '_');
+  dart.setSignature(io.RawSocketEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.RawSocketEvent, [core.int])}),
+    fields: () => ({[_value$1]: core.int}),
+    sfields: () => ({
+      READ: io.RawSocketEvent,
+      WRITE: io.RawSocketEvent,
+      READ_CLOSED: io.RawSocketEvent,
+      CLOSED: io.RawSocketEvent
+    })
+  });
+  dart.defineLazy(io.RawSocketEvent, {
+    get READ() {
+      return dart.const(new io.RawSocketEvent._(0));
+    },
+    get WRITE() {
+      return dart.const(new io.RawSocketEvent._(1));
+    },
+    get READ_CLOSED() {
+      return dart.const(new io.RawSocketEvent._(2));
+    },
+    get CLOSED() {
+      return dart.const(new io.RawSocketEvent._(3));
+    }
+  });
+  io._RawSecureSocket = class _RawSecureSocket extends async.Stream$(io.RawSocketEvent) {
+    static _isBufferEncrypted(identifier) {
+      return dart.notNull(identifier) >= dart.notNull(io._RawSecureSocket.READ_ENCRYPTED);
+    }
+    static connect(host, requestedPort, opts) {
+      let is_server = opts && 'is_server' in opts ? opts.is_server : null;
+      let context = opts && 'context' in opts ? opts.context : null;
+      let socket = opts && 'socket' in opts ? opts.socket : null;
+      let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+      let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      io._RawSecureSocket._verifyFields(host, requestedPort, is_server, requestClientCertificate, requireClientCertificate, onBadCertificate);
+      if (io.InternetAddress.is(host)) host = dart.dload(host, 'host');
+      let address = socket.address;
+      if (host != null) {
+        address = io.InternetAddress._cloneWithNewHost(address, core.String._check(host));
+      }
+      return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, StreamSubscriptionOfRawSocketEvent()._check(subscription), bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
+    }
+    new(address, requestedPort, is_server, context, socket, socketSubscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols) {
+      this[_handshakeComplete] = CompleterOf_RawSecureSocket().new();
+      this[_status] = io._RawSecureSocket.HANDSHAKE;
+      this[_closeCompleter] = async.Completer.new();
+      this[_filterStatus] = new io._FilterStatus();
+      this[_secureFilter] = io._SecureFilter.new();
+      this.address = address;
+      this.is_server = is_server;
+      this.context = context;
+      this[_socket] = socket;
+      this[_socketSubscription] = socketSubscription;
+      this[_bufferedData] = bufferedData;
+      this.requestClientCertificate = requestClientCertificate;
+      this.requireClientCertificate = requireClientCertificate;
+      this.onBadCertificate = onBadCertificate;
+      this[_controller$0] = null;
+      this[_stream$] = null;
+      this[_bufferedDataIndex] = 0;
+      this[_writeEventsEnabled] = true;
+      this[_readEventsEnabled] = true;
+      this[_pauseCount$] = 0;
+      this[_pendingReadEvent] = false;
+      this[_socketClosedRead] = false;
+      this[_socketClosedWrite] = false;
+      this[_closedRead] = false;
+      this[_closedWrite] = false;
+      this[_connectPending] = true;
+      this[_filterPending] = false;
+      this[_filterActive] = false;
+      this[_selectedProtocol] = null;
+      super.new();
+      if (this.context == null) {
+        this.context = io.SecurityContext.defaultContext;
+      }
+      this[_controller$0] = StreamControllerOfRawSocketEvent().new({sync: true, onListen: dart.bind(this, _onSubscriptionStateChange), onPause: dart.bind(this, _onPauseStateChange), onResume: dart.bind(this, _onPauseStateChange), onCancel: dart.bind(this, _onSubscriptionStateChange)});
+      this[_stream$] = this[_controller$0].stream;
+      this[_secureFilter].init();
+      this[_secureFilter].registerHandshakeCompleteCallback(dart.bind(this, _secureHandshakeCompleteHandler));
+      if (this.onBadCertificate != null) {
+        this[_secureFilter].registerBadCertificateCallback(dart.bind(this, _onBadCertificateWrapper));
+      }
+      this[_socket].readEventsEnabled = true;
+      this[_socket].writeEventsEnabled = false;
+      if (this[_socketSubscription] == null) {
+        this[_socketSubscription] = this[_socket].listen(dart.bind(this, _eventDispatcher), {onError: dart.bind(this, _reportError), onDone: dart.bind(this, _doneHandler)});
+      } else {
+        if (dart.test(this[_socketSubscription].isPaused)) {
+          this[_socket].close();
+          dart.throw(new core.ArgumentError("Subscription passed to TLS upgrade is paused"));
+        }
+        let s = this[_socket];
+        if (dart.test(dart.dload(dart.dload(s, _socket), 'closedReadEventSent'))) {
+          this[_eventDispatcher](io.RawSocketEvent.READ_CLOSED);
+        }
+        let _ = this[_socketSubscription];
+        _.onData(dart.bind(this, _eventDispatcher));
+        _.onError(dart.bind(this, _reportError));
+        _.onDone(dart.bind(this, _doneHandler));
+      }
+      try {
+        let encodedProtocols = io.SecurityContext._protocolsToLengthEncoding(supportedProtocols);
+        this[_secureFilter].connect(this.address.host, this.context, this.is_server, dart.test(this.requestClientCertificate) || dart.test(this.requireClientCertificate), this.requireClientCertificate, encodedProtocols);
+        this[_secureHandshake]();
+      } catch (e) {
+        let s = dart.stackTrace(e);
+        this[_reportError](e, s);
+      }
+
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      this[_sendWriteEvent]();
+      return this[_stream$].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    static _verifyFields(host, requestedPort, is_server, requestClientCertificate, requireClientCertificate, onBadCertificate) {
+      if (!(typeof host == 'string') && !io.InternetAddress.is(host)) {
+        dart.throw(new core.ArgumentError("host is not a String or an InternetAddress"));
+      }
+      if (!(typeof requestedPort == 'number')) {
+        dart.throw(new core.ArgumentError("requestedPort is not an int"));
+      }
+      if (dart.notNull(requestedPort) < 0 || dart.notNull(requestedPort) > 65535) {
+        dart.throw(new core.ArgumentError("requestedPort is not in the range 0..65535"));
+      }
+      if (!(typeof requestClientCertificate == 'boolean')) {
+        dart.throw(new core.ArgumentError("requestClientCertificate is not a bool"));
+      }
+      if (!(typeof requireClientCertificate == 'boolean')) {
+        dart.throw(new core.ArgumentError("requireClientCertificate is not a bool"));
+      }
+      if (onBadCertificate != null && !core.Function.is(onBadCertificate)) {
+        dart.throw(new core.ArgumentError("onBadCertificate is not null or a Function"));
+      }
+    }
+    get port() {
+      return this[_socket].port;
+    }
+    get remoteAddress() {
+      return this[_socket].remoteAddress;
+    }
+    get remotePort() {
+      return this[_socket].remotePort;
+    }
+    set [_owner](owner) {
+      dart.dput(this[_socket], _owner, owner);
+    }
+    available() {
+      return this[_status] != io._RawSecureSocket.CONNECTED ? 0 : this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).length;
+    }
+    close() {
+      this.shutdown(io.SocketDirection.BOTH);
+      return FutureOfRawSecureSocket()._check(this[_closeCompleter].future);
+    }
+    [_completeCloseCompleter](dummy) {
+      if (dummy === void 0) dummy = null;
+      if (!dart.test(this[_closeCompleter].isCompleted)) this[_closeCompleter].complete(this);
+    }
+    [_close$0]() {
+      this[_closedWrite] = true;
+      this[_closedRead] = true;
+      if (this[_socket] != null) {
+        this[_socket].close().then(dart.void)(dart.bind(this, _completeCloseCompleter));
+      } else {
+        this[_completeCloseCompleter]();
+      }
+      this[_socketClosedWrite] = true;
+      this[_socketClosedRead] = true;
+      if (!dart.test(this[_filterActive]) && this[_secureFilter] != null) {
+        this[_secureFilter].destroy();
+        this[_secureFilter] = null;
+      }
+      if (this[_socketSubscription] != null) {
+        this[_socketSubscription].cancel();
+      }
+      this[_controller$0].close();
+      this[_status] = io._RawSecureSocket.CLOSED;
+    }
+    shutdown(direction) {
+      if (dart.equals(direction, io.SocketDirection.SEND) || dart.equals(direction, io.SocketDirection.BOTH)) {
+        this[_closedWrite] = true;
+        if (dart.test(this[_filterStatus].writeEmpty)) {
+          this[_socket].shutdown(io.SocketDirection.SEND);
+          this[_socketClosedWrite] = true;
+          if (dart.test(this[_closedRead])) {
+            this[_close$0]();
+          }
+        }
+      }
+      if (dart.equals(direction, io.SocketDirection.RECEIVE) || dart.equals(direction, io.SocketDirection.BOTH)) {
+        this[_closedRead] = true;
+        this[_socketClosedRead] = true;
+        this[_socket].shutdown(io.SocketDirection.RECEIVE);
+        if (dart.test(this[_socketClosedWrite])) {
+          this[_close$0]();
+        }
+      }
+    }
+    get writeEventsEnabled() {
+      return this[_writeEventsEnabled];
+    }
+    set writeEventsEnabled(value) {
+      this[_writeEventsEnabled] = value;
+      if (dart.test(value)) {
+        async.Timer.run(dart.fn(() => this[_sendWriteEvent](), VoidTovoid$()));
+      }
+    }
+    get readEventsEnabled() {
+      return this[_readEventsEnabled];
+    }
+    set readEventsEnabled(value) {
+      this[_readEventsEnabled] = value;
+      this[_scheduleReadEvent]();
+    }
+    read(length) {
+      if (length === void 0) length = null;
+      if (length != null && (!(typeof length == 'number') || dart.notNull(length) < 0)) {
+        dart.throw(new core.ArgumentError(dart.str`Invalid length parameter in SecureSocket.read (length: ${length})`));
+      }
+      if (dart.test(this[_closedRead])) {
+        dart.throw(new io.SocketException("Reading from a closed socket"));
+      }
+      if (this[_status] != io._RawSecureSocket.CONNECTED) {
+        return null;
+      }
+      let result = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).read(length);
+      this[_scheduleFilter]();
+      return result;
+    }
+    write(data, offset, bytes) {
+      if (offset === void 0) offset = null;
+      if (bytes === void 0) bytes = null;
+      if (bytes != null && (!(typeof bytes == 'number') || dart.notNull(bytes) < 0)) {
+        dart.throw(new core.ArgumentError(dart.str`Invalid bytes parameter in SecureSocket.read (bytes: ${bytes})`));
+      }
+      if (offset != null && (!(typeof offset == 'number') || dart.notNull(offset) < 0)) {
+        dart.throw(new core.ArgumentError(dart.str`Invalid offset parameter in SecureSocket.read (offset: ${offset})`));
+      }
+      if (dart.test(this[_closedWrite])) {
+        this[_controller$0].addError(new io.SocketException("Writing to a closed socket"));
+        return 0;
+      }
+      if (this[_status] != io._RawSecureSocket.CONNECTED) return 0;
+      if (offset == null) offset = 0;
+      if (bytes == null) bytes = dart.notNull(data[dartx.length]) - dart.notNull(offset);
+      let written = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).write(data, offset, bytes);
+      if (dart.notNull(written) > 0) {
+        this[_filterStatus].writeEmpty = false;
+      }
+      this[_scheduleFilter]();
+      return written;
+    }
+    get peerCertificate() {
+      return this[_secureFilter].peerCertificate;
+    }
+    get selectedProtocol() {
+      return this[_selectedProtocol];
+    }
+    [_onBadCertificateWrapper](certificate) {
+      if (this.onBadCertificate == null) return false;
+      let result = dart.dcall(this.onBadCertificate, certificate);
+      if (typeof result == 'boolean') return result;
+      dart.throw(new io.HandshakeException(dart.str`onBadCertificate callback returned non-boolean ${result}`));
+    }
+    setOption(option, enabled) {
+      if (this[_socket] == null) return false;
+      return this[_socket].setOption(option, enabled);
+    }
+    [_eventDispatcher](event) {
+      try {
+        if (dart.equals(event, io.RawSocketEvent.READ)) {
+          this[_readHandler]();
+        } else if (dart.equals(event, io.RawSocketEvent.WRITE)) {
+          this[_writeHandler]();
+        } else if (dart.equals(event, io.RawSocketEvent.READ_CLOSED)) {
+          this[_closeHandler]();
+        }
+      } catch (e) {
+        let stackTrace = dart.stackTrace(e);
+        this[_reportError](e, stackTrace);
+      }
+
+    }
+    [_readHandler]() {
+      this[_readSocket]();
+      this[_scheduleFilter]();
+    }
+    [_writeHandler]() {
+      this[_writeSocket]();
+      this[_scheduleFilter]();
+    }
+    [_doneHandler]() {
+      if (dart.test(this[_filterStatus].readEmpty)) {
+        this[_close$0]();
+      }
+    }
+    [_reportError](e, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      if (this[_status] == io._RawSecureSocket.CLOSED) {
+        return;
+      } else if (dart.test(this[_connectPending])) {
+        this[_handshakeComplete].completeError(e, stackTrace);
+      } else {
+        this[_controller$0].addError(e, stackTrace);
+      }
+      this[_close$0]();
+    }
+    [_closeHandler]() {
+      if (this[_status] == io._RawSecureSocket.CONNECTED) {
+        if (dart.test(this[_closedRead])) return;
+        this[_socketClosedRead] = true;
+        if (dart.test(this[_filterStatus].readEmpty)) {
+          this[_closedRead] = true;
+          this[_controller$0].add(io.RawSocketEvent.READ_CLOSED);
+          if (dart.test(this[_socketClosedWrite])) {
+            this[_close$0]();
+          }
+        } else {
+          this[_scheduleFilter]();
+        }
+      } else if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+        this[_socketClosedRead] = true;
+        if (dart.test(this[_filterStatus].readEmpty)) {
+          this[_reportError](new io.HandshakeException('Connection terminated during handshake'), null);
+        } else {
+          this[_secureHandshake]();
+        }
+      }
+    }
+    [_secureHandshake]() {
+      try {
+        this[_secureFilter].handshake();
+        this[_filterStatus].writeEmpty = false;
+        this[_readSocket]();
+        this[_writeSocket]();
+        this[_scheduleFilter]();
+      } catch (e) {
+        let stackTrace = dart.stackTrace(e);
+        this[_reportError](e, stackTrace);
+      }
+
+    }
+    renegotiate(opts) {
+      let useSessionCache = opts && 'useSessionCache' in opts ? opts.useSessionCache : true;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      if (this[_status] != io._RawSecureSocket.CONNECTED) {
+        dart.throw(new io.HandshakeException("Called renegotiate on a non-connected socket"));
+      }
+      this[_secureFilter].renegotiate(useSessionCache, requestClientCertificate, requireClientCertificate);
+      this[_status] = io._RawSecureSocket.HANDSHAKE;
+      this[_filterStatus].writeEmpty = false;
+      this[_scheduleFilter]();
+    }
+    [_secureHandshakeCompleteHandler]() {
+      this[_status] = io._RawSecureSocket.CONNECTED;
+      if (dart.test(this[_connectPending])) {
+        this[_connectPending] = false;
+        try {
+          this[_selectedProtocol] = this[_secureFilter].selectedProtocol();
+          async.Timer.run(dart.fn(() => this[_handshakeComplete].complete(this), VoidTovoid$()));
+        } catch (error) {
+          let stack = dart.stackTrace(error);
+          this[_handshakeComplete].completeError(error, stack);
+        }
+
+      }
+    }
+    [_onPauseStateChange]() {
+      if (dart.test(this[_controller$0].isPaused)) {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) + 1;
+      } else {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) - 1;
+        if (this[_pauseCount$] == 0) {
+          this[_scheduleReadEvent]();
+          this[_sendWriteEvent]();
+        }
+      }
+      if (!dart.test(this[_socketClosedRead]) || !dart.test(this[_socketClosedWrite])) {
+        if (dart.test(this[_controller$0].isPaused)) {
+          this[_socketSubscription].pause();
+        } else {
+          this[_socketSubscription].resume();
+        }
+      }
+    }
+    [_onSubscriptionStateChange]() {
+      if (dart.test(this[_controller$0].hasListener)) {
+      }
+    }
+    [_scheduleFilter]() {
+      this[_filterPending] = true;
+      this[_tryFilter]();
+    }
+    [_tryFilter]() {
+      if (this[_status] == io._RawSecureSocket.CLOSED) {
+        return;
+      }
+      if (dart.test(this[_filterPending]) && !dart.test(this[_filterActive])) {
+        this[_filterActive] = true;
+        this[_filterPending] = false;
+        this[_pushAllFilterStages]().then(dart.dynamic)(dart.fn(status => {
+          this[_filterStatus] = status;
+          this[_filterActive] = false;
+          if (this[_status] == io._RawSecureSocket.CLOSED) {
+            this[_secureFilter].destroy();
+            this[_secureFilter] = null;
+            return;
+          }
+          this[_socket].readEventsEnabled = true;
+          if (dart.test(this[_filterStatus].writeEmpty) && dart.test(this[_closedWrite]) && !dart.test(this[_socketClosedWrite])) {
+            this.shutdown(io.SocketDirection.SEND);
+            if (this[_status] == io._RawSecureSocket.CLOSED) {
+              return;
+            }
+          }
+          if (dart.test(this[_filterStatus].readEmpty) && dart.test(this[_socketClosedRead]) && !dart.test(this[_closedRead])) {
+            if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+              this[_secureFilter].handshake();
+              if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+                dart.throw(new io.HandshakeException('Connection terminated during handshake'));
+              }
+            }
+            this[_closeHandler]();
+          }
+          if (this[_status] == io._RawSecureSocket.CLOSED) {
+            return;
+          }
+          if (dart.test(this[_filterStatus].progress)) {
+            this[_filterPending] = true;
+            if (dart.test(this[_filterStatus].writeEncryptedNoLongerEmpty)) {
+              this[_writeSocket]();
+            }
+            if (dart.test(this[_filterStatus].writePlaintextNoLongerFull)) {
+              this[_sendWriteEvent]();
+            }
+            if (dart.test(this[_filterStatus].readEncryptedNoLongerFull)) {
+              this[_readSocket]();
+            }
+            if (dart.test(this[_filterStatus].readPlaintextNoLongerEmpty)) {
+              this[_scheduleReadEvent]();
+            }
+            if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+              this[_secureHandshake]();
+            }
+          }
+          this[_tryFilter]();
+        }, _FilterStatusToNull())).catchError(dart.bind(this, _reportError));
+      }
+    }
+    [_readSocketOrBufferedData](bytes) {
+      if (this[_bufferedData] != null) {
+        if (dart.notNull(bytes) > dart.notNull(this[_bufferedData][dartx.length]) - dart.notNull(this[_bufferedDataIndex])) {
+          bytes = dart.notNull(this[_bufferedData][dartx.length]) - dart.notNull(this[_bufferedDataIndex]);
+        }
+        let result = this[_bufferedData][dartx.sublist](this[_bufferedDataIndex], dart.notNull(this[_bufferedDataIndex]) + dart.notNull(bytes));
+        this[_bufferedDataIndex] = dart.notNull(this[_bufferedDataIndex]) + dart.notNull(bytes);
+        if (this[_bufferedData][dartx.length] == this[_bufferedDataIndex]) {
+          this[_bufferedData] = null;
+        }
+        return result;
+      } else if (!dart.test(this[_socketClosedRead])) {
+        return this[_socket].read(bytes);
+      } else {
+        return null;
+      }
+    }
+    [_readSocket]() {
+      if (this[_status] == io._RawSecureSocket.CLOSED) return;
+      let buffer = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_ENCRYPTED);
+      if (dart.notNull(buffer.writeFromSource(dart.bind(this, _readSocketOrBufferedData))) > 0) {
+        this[_filterStatus].readEmpty = false;
+      } else {
+        this[_socket].readEventsEnabled = false;
+      }
+    }
+    [_writeSocket]() {
+      if (dart.test(this[_socketClosedWrite])) return;
+      let buffer = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_ENCRYPTED);
+      if (dart.test(buffer.readToSocket(this[_socket]))) {
+        this[_socket].writeEventsEnabled = true;
+      }
+    }
+    [_scheduleReadEvent]() {
+      if (!dart.test(this[_pendingReadEvent]) && dart.test(this[_readEventsEnabled]) && this[_pauseCount$] == 0 && this[_secureFilter] != null && !dart.test(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).isEmpty)) {
+        this[_pendingReadEvent] = true;
+        async.Timer.run(dart.bind(this, _sendReadEvent));
+      }
+    }
+    [_sendReadEvent]() {
+      this[_pendingReadEvent] = false;
+      if (this[_status] != io._RawSecureSocket.CLOSED && dart.test(this[_readEventsEnabled]) && this[_pauseCount$] == 0 && this[_secureFilter] != null && !dart.test(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).isEmpty)) {
+        this[_controller$0].add(io.RawSocketEvent.READ);
+        this[_scheduleReadEvent]();
+      }
+    }
+    [_sendWriteEvent]() {
+      if (!dart.test(this[_closedWrite]) && dart.test(this[_writeEventsEnabled]) && this[_pauseCount$] == 0 && this[_secureFilter] != null && dart.notNull(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).free) > 0) {
+        this[_writeEventsEnabled] = false;
+        this[_controller$0].add(io.RawSocketEvent.WRITE);
+      }
+    }
+    [_pushAllFilterStages]() {
+      let wasInHandshake = this[_status] != io._RawSecureSocket.CONNECTED;
+      let args = core.List.new(2 + dart.notNull(io._RawSecureSocket.NUM_BUFFERS) * 2);
+      args[dartx._set](0, this[_secureFilter][_pointer]());
+      args[dartx._set](1, wasInHandshake);
+      let bufs = this[_secureFilter].buffers;
+      for (let i = 0; i < dart.notNull(io._RawSecureSocket.NUM_BUFFERS); ++i) {
+        args[dartx._set](2 * i + 2, bufs[dartx._get](i).start);
+        args[dartx._set](2 * i + 3, bufs[dartx._get](i).end);
+      }
+      return io._IOService._dispatch(io._SSL_PROCESS_FILTER, args).then(io._FilterStatus)(dart.fn(response => {
+        if (dart.equals(dart.dload(response, 'length'), 2)) {
+          if (wasInHandshake) {
+            this[_reportError](new io.HandshakeException(dart.str`${dart.dindex(response, 1)} error ${dart.dindex(response, 0)}`), null);
+          } else {
+            this[_reportError](new io.TlsException(dart.str`${dart.dindex(response, 1)} error ${dart.dindex(response, 0)}`), null);
+          }
+        }
+        function start(index) {
+          return core.int._check(dart.dindex(response, 2 * dart.notNull(index)));
+        }
+        dart.fn(start, intToint());
+        function end(index) {
+          return core.int._check(dart.dindex(response, 2 * dart.notNull(index) + 1));
+        }
+        dart.fn(end, intToint());
+        let status = new io._FilterStatus();
+        status.writeEmpty = dart.test(bufs[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).isEmpty) && start(io._RawSecureSocket.WRITE_ENCRYPTED) == end(io._RawSecureSocket.WRITE_ENCRYPTED);
+        if (wasInHandshake) status.writeEmpty = false;
+        status.readEmpty = dart.test(bufs[dartx._get](io._RawSecureSocket.READ_ENCRYPTED).isEmpty) && start(io._RawSecureSocket.READ_PLAINTEXT) == end(io._RawSecureSocket.READ_PLAINTEXT);
+        let buffer = bufs[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT);
+        let new_start = start(io._RawSecureSocket.WRITE_PLAINTEXT);
+        if (new_start != buffer.start) {
+          status.progress = true;
+          if (buffer.free == 0) {
+            status.writePlaintextNoLongerFull = true;
+          }
+          buffer.start = new_start;
+        }
+        buffer = bufs[dartx._get](io._RawSecureSocket.READ_ENCRYPTED);
+        new_start = start(io._RawSecureSocket.READ_ENCRYPTED);
+        if (new_start != buffer.start) {
+          status.progress = true;
+          if (buffer.free == 0) {
+            status.readEncryptedNoLongerFull = true;
+          }
+          buffer.start = new_start;
+        }
+        buffer = bufs[dartx._get](io._RawSecureSocket.WRITE_ENCRYPTED);
+        let new_end = end(io._RawSecureSocket.WRITE_ENCRYPTED);
+        if (new_end != buffer.end) {
+          status.progress = true;
+          if (buffer.length == 0) {
+            status.writeEncryptedNoLongerEmpty = true;
+          }
+          buffer.end = new_end;
+        }
+        buffer = bufs[dartx._get](io._RawSecureSocket.READ_PLAINTEXT);
+        new_end = end(io._RawSecureSocket.READ_PLAINTEXT);
+        if (new_end != buffer.end) {
+          status.progress = true;
+          if (buffer.length == 0) {
+            status.readPlaintextNoLongerEmpty = true;
+          }
+          buffer.end = new_end;
+        }
+        return status;
+      }, dynamicTo_FilterStatus()));
+    }
+  };
+  dart.addSimpleTypeTests(io._RawSecureSocket);
+  io._RawSecureSocket[dart.implements] = () => [io.RawSecureSocket];
+  dart.setSignature(io._RawSecureSocket, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RawSecureSocket, [io.InternetAddress, core.int, core.bool, io.SecurityContext, io.RawSocket, StreamSubscriptionOfRawSocketEvent(), ListOfint(), core.bool, core.bool, X509CertificateTodynamic(), ListOfString()])}),
+    fields: () => ({
+      [_socket]: io.RawSocket,
+      [_handshakeComplete]: CompleterOf_RawSecureSocket(),
+      [_controller$0]: StreamControllerOfRawSocketEvent(),
+      [_stream$]: StreamOfRawSocketEvent(),
+      [_socketSubscription]: StreamSubscriptionOfRawSocketEvent(),
+      [_bufferedData]: ListOfint(),
+      [_bufferedDataIndex]: core.int,
+      address: io.InternetAddress,
+      is_server: core.bool,
+      context: io.SecurityContext,
+      requestClientCertificate: core.bool,
+      requireClientCertificate: core.bool,
+      onBadCertificate: core.Function,
+      [_status]: core.int,
+      [_writeEventsEnabled]: core.bool,
+      [_readEventsEnabled]: core.bool,
+      [_pauseCount$]: core.int,
+      [_pendingReadEvent]: core.bool,
+      [_socketClosedRead]: core.bool,
+      [_socketClosedWrite]: core.bool,
+      [_closedRead]: core.bool,
+      [_closedWrite]: core.bool,
+      [_closeCompleter]: async.Completer,
+      [_filterStatus]: io._FilterStatus,
+      [_connectPending]: core.bool,
+      [_filterPending]: core.bool,
+      [_filterActive]: core.bool,
+      [_secureFilter]: io._SecureFilter,
+      [_selectedProtocol]: core.String
+    }),
+    getters: () => ({
+      port: dart.definiteFunctionType(core.int, []),
+      remoteAddress: dart.definiteFunctionType(io.InternetAddress, []),
+      remotePort: dart.definiteFunctionType(core.int, []),
+      writeEventsEnabled: dart.definiteFunctionType(core.bool, []),
+      readEventsEnabled: dart.definiteFunctionType(core.bool, []),
+      peerCertificate: dart.definiteFunctionType(io.X509Certificate, []),
+      selectedProtocol: dart.definiteFunctionType(core.String, [])
+    }),
+    setters: () => ({
+      [_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      writeEventsEnabled: dart.definiteFunctionType(dart.void, [core.bool]),
+      readEventsEnabled: dart.definiteFunctionType(dart.void, [core.bool])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSocketEvent), [RawSocketEventTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      available: dart.definiteFunctionType(core.int, []),
+      close: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), []),
+      [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [dart.dynamic]),
+      [_close$0]: dart.definiteFunctionType(dart.void, []),
+      shutdown: dart.definiteFunctionType(dart.void, [io.SocketDirection]),
+      read: dart.definiteFunctionType(core.List$(core.int), [], [core.int]),
+      write: dart.definiteFunctionType(core.int, [ListOfint()], [core.int, core.int]),
+      [_onBadCertificateWrapper]: dart.definiteFunctionType(core.bool, [io.X509Certificate]),
+      setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
+      [_eventDispatcher]: dart.definiteFunctionType(dart.void, [io.RawSocketEvent]),
+      [_readHandler]: dart.definiteFunctionType(dart.void, []),
+      [_writeHandler]: dart.definiteFunctionType(dart.void, []),
+      [_doneHandler]: dart.definiteFunctionType(dart.void, []),
+      [_reportError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      [_closeHandler]: dart.definiteFunctionType(dart.void, []),
+      [_secureHandshake]: dart.definiteFunctionType(dart.void, []),
+      renegotiate: dart.definiteFunctionType(dart.void, [], {useSessionCache: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool}),
+      [_secureHandshakeCompleteHandler]: dart.definiteFunctionType(dart.void, []),
+      [_onPauseStateChange]: dart.definiteFunctionType(dart.void, []),
+      [_onSubscriptionStateChange]: dart.definiteFunctionType(dart.void, []),
+      [_scheduleFilter]: dart.definiteFunctionType(dart.void, []),
+      [_tryFilter]: dart.definiteFunctionType(dart.void, []),
+      [_readSocketOrBufferedData]: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+      [_readSocket]: dart.definiteFunctionType(dart.void, []),
+      [_writeSocket]: dart.definiteFunctionType(dart.void, []),
+      [_scheduleReadEvent]: dart.definiteFunctionType(dart.dynamic, []),
+      [_sendReadEvent]: dart.definiteFunctionType(dart.dynamic, []),
+      [_sendWriteEvent]: dart.definiteFunctionType(dart.dynamic, []),
+      [_pushAllFilterStages]: dart.definiteFunctionType(async.Future$(io._FilterStatus), [])
+    }),
+    sfields: () => ({
+      HANDSHAKE: core.int,
+      CONNECTED: core.int,
+      CLOSED: core.int,
+      READ_PLAINTEXT: core.int,
+      WRITE_PLAINTEXT: core.int,
+      READ_ENCRYPTED: core.int,
+      WRITE_ENCRYPTED: core.int,
+      NUM_BUFFERS: core.int
+    }),
+    statics: () => ({
+      _isBufferEncrypted: dart.definiteFunctionType(core.bool, [core.int]),
+      connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      _verifyFields: dart.definiteFunctionType(dart.void, [dart.dynamic, core.int, core.bool, core.bool, core.bool, core.Function])
+    }),
+    names: ['_isBufferEncrypted', 'connect', '_verifyFields']
+  });
+  io._RawSecureSocket.HANDSHAKE = 201;
+  io._RawSecureSocket.CONNECTED = 202;
+  io._RawSecureSocket.CLOSED = 203;
+  io._RawSecureSocket.READ_PLAINTEXT = 0;
+  io._RawSecureSocket.WRITE_PLAINTEXT = 1;
+  io._RawSecureSocket.READ_ENCRYPTED = 2;
+  io._RawSecureSocket.WRITE_ENCRYPTED = 3;
+  io._RawSecureSocket.NUM_BUFFERS = 4;
+  io._ExternalBuffer = class _ExternalBuffer extends core.Object {
+    new(size) {
+      this.size = size;
+      this.data = null;
+      this.start = null;
+      this.end = null;
+      this.start = core.int._check(this.end = core.int._check(dart.dsend(this.size, '~/', 2)));
+    }
+    advanceStart(bytes) {
+      dart.assert(dart.notNull(this.start) > dart.notNull(this.end) || dart.notNull(this.start) + dart.notNull(bytes) <= dart.notNull(this.end));
+      this.start = dart.notNull(this.start) + dart.notNull(bytes);
+      if (dart.notNull(this.start) >= dart.notNull(core.num._check(this.size))) {
+        this.start = dart.notNull(this.start) - dart.notNull(core.num._check(this.size));
+        dart.assert(dart.notNull(this.start) <= dart.notNull(this.end));
+        dart.assert(dart.notNull(this.start) < dart.notNull(core.num._check(this.size)));
+      }
+    }
+    advanceEnd(bytes) {
+      dart.assert(dart.notNull(this.start) <= dart.notNull(this.end) || dart.notNull(this.start) > dart.notNull(this.end) + dart.notNull(bytes));
+      this.end = dart.notNull(this.end) + dart.notNull(bytes);
+      if (dart.notNull(this.end) >= dart.notNull(core.num._check(this.size))) {
+        this.end = dart.notNull(this.end) - dart.notNull(core.num._check(this.size));
+        dart.assert(dart.notNull(this.end) < dart.notNull(this.start));
+        dart.assert(dart.notNull(this.end) < dart.notNull(core.num._check(this.size)));
+      }
+    }
+    get isEmpty() {
+      return this.end == this.start;
+    }
+    get length() {
+      return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.dsend(dart.dsend(this.size, '+', this.end), '-', this.start) : dart.notNull(this.end) - dart.notNull(this.start));
+    }
+    get linearLength() {
+      return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.dsend(this.size, '-', this.start) : dart.notNull(this.end) - dart.notNull(this.start));
+    }
+    get free() {
+      return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.notNull(this.start) - dart.notNull(this.end) - 1 : dart.dsend(dart.dsend(dart.dsend(this.size, '+', this.start), '-', this.end), '-', 1));
+    }
+    get linearFree() {
+      if (dart.notNull(this.start) > dart.notNull(this.end)) return dart.notNull(this.start) - dart.notNull(this.end) - 1;
+      if (this.start == 0) return core.int._check(dart.dsend(dart.dsend(this.size, '-', this.end), '-', 1));
+      return core.int._check(dart.dsend(this.size, '-', this.end));
+    }
+    read(bytes) {
+      if (bytes == null) {
+        bytes = this.length;
+      } else {
+        bytes = math.min(core.int)(bytes, this.length);
+      }
+      if (bytes == 0) return null;
+      let result = typed_data.Uint8List.new(bytes);
+      let bytesRead = 0;
+      while (dart.notNull(bytesRead) < dart.notNull(bytes)) {
+        let toRead = math.min(core.int)(dart.notNull(bytes) - dart.notNull(bytesRead), this.linearLength);
+        result[dartx.setRange](bytesRead, dart.notNull(bytesRead) + dart.notNull(toRead), this.data, this.start);
+        this.advanceStart(toRead);
+        bytesRead = dart.notNull(bytesRead) + dart.notNull(toRead);
+      }
+      return result;
+    }
+    write(inputData, offset, bytes) {
+      if (dart.notNull(bytes) > dart.notNull(this.free)) {
+        bytes = this.free;
+      }
+      let written = 0;
+      let toWrite = math.min(core.int)(bytes, this.linearFree);
+      while (dart.notNull(toWrite) > 0) {
+        this.data[dartx.setRange](this.end, dart.notNull(this.end) + dart.notNull(toWrite), inputData, offset);
+        this.advanceEnd(toWrite);
+        offset = dart.notNull(offset) + dart.notNull(toWrite);
+        written = dart.notNull(written) + dart.notNull(toWrite);
+        toWrite = math.min(core.int)(dart.notNull(bytes) - dart.notNull(written), this.linearFree);
+      }
+      return written;
+    }
+    writeFromSource(getData) {
+      let written = 0;
+      let toWrite = this.linearFree;
+      while (dart.notNull(toWrite) > 0) {
+        let inputData = getData(toWrite);
+        if (inputData == null || inputData[dartx.length] == 0) break;
+        let len = inputData[dartx.length];
+        this.data[dartx.setRange](this.end, dart.notNull(this.end) + dart.notNull(len), inputData);
+        this.advanceEnd(len);
+        written = dart.notNull(written) + dart.notNull(len);
+        toWrite = this.linearFree;
+      }
+      return written;
+    }
+    readToSocket(socket) {
+      while (true) {
+        let toWrite = this.linearLength;
+        if (toWrite == 0) return false;
+        let bytes = socket.write(ListOfint()._check(this.data), this.start, toWrite);
+        this.advanceStart(bytes);
+        if (dart.notNull(bytes) < dart.notNull(toWrite)) {
+          return true;
+        }
+      }
+    }
+  };
+  dart.setSignature(io._ExternalBuffer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ExternalBuffer, [dart.dynamic])}),
+    fields: () => ({
+      data: core.List,
+      start: core.int,
+      end: core.int,
+      size: dart.dynamic
+    }),
+    getters: () => ({
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      length: dart.definiteFunctionType(core.int, []),
+      linearLength: dart.definiteFunctionType(core.int, []),
+      free: dart.definiteFunctionType(core.int, []),
+      linearFree: dart.definiteFunctionType(core.int, [])
+    }),
+    methods: () => ({
+      advanceStart: dart.definiteFunctionType(dart.void, [core.int]),
+      advanceEnd: dart.definiteFunctionType(dart.void, [core.int]),
+      read: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+      write: dart.definiteFunctionType(core.int, [ListOfint(), core.int, core.int]),
+      writeFromSource: dart.definiteFunctionType(core.int, [intToListOfint()]),
+      readToSocket: dart.definiteFunctionType(core.bool, [io.RawSocket])
+    })
+  });
+  io._SecureFilter = class _SecureFilter extends core.Object {
+    static new() {
+      dart.throw(new core.UnsupportedError("_SecureFilter._SecureFilter"));
+    }
+  };
+  dart.setSignature(io._SecureFilter, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SecureFilter, [])})
+  });
+  io.TlsException = class TlsException extends core.Object {
+    new(message, osError) {
+      if (message === void 0) message = "";
+      if (osError === void 0) osError = null;
+      TlsException.prototype._.call(this, "TlsException", message, osError);
+    }
+    _(type, message, osError) {
+      this.type = type;
+      this.message = message;
+      this.osError = osError;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write(this.type);
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(dart.str`: ${this.message}`);
+        if (this.osError != null) {
+          sb.write(dart.str` (${this.osError})`);
+        }
+      } else if (this.osError != null) {
+        sb.write(dart.str`: ${this.osError}`);
+      }
+      return sb.toString();
+    }
+  };
+  dart.defineNamedConstructor(io.TlsException, '_');
+  io.TlsException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.TlsException, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.TlsException, [], [core.String, io.OSError]),
+      _: dart.definiteFunctionType(io.TlsException, [core.String, core.String, io.OSError])
+    }),
+    fields: () => ({
+      type: core.String,
+      message: core.String,
+      osError: io.OSError
+    })
+  });
+  io.HandshakeException = class HandshakeException extends io.TlsException {
+    new(message, osError) {
+      if (message === void 0) message = "";
+      if (osError === void 0) osError = null;
+      super._("HandshakeException", message, osError);
+    }
+  };
+  dart.setSignature(io.HandshakeException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HandshakeException, [], [core.String, io.OSError])})
+  });
+  io.CertificateException = class CertificateException extends io.TlsException {
+    new(message, osError) {
+      if (message === void 0) message = "";
+      if (osError === void 0) osError = null;
+      super._("CertificateException", message, osError);
+    }
+  };
+  dart.setSignature(io.CertificateException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.CertificateException, [], [core.String, io.OSError])})
+  });
+  io.SecurityContext = class SecurityContext extends core.Object {
+    static new() {
+      dart.throw(new core.UnsupportedError("SecurityContext constructor"));
+    }
+    static get defaultContext() {
+      dart.throw(new core.UnsupportedError("default SecurityContext getter"));
+    }
+    static get alpnSupported() {
+      dart.throw(new core.UnsupportedError("SecurityContext alpnSupported getter"));
+    }
+    static _protocolsToLengthEncoding(protocols) {
+      if (protocols == null || protocols[dartx.length] == 0) {
+        return typed_data.Uint8List.new(0);
+      }
+      let protocolsLength = protocols[dartx.length];
+      let expectedLength = protocolsLength;
+      for (let i = 0; i < dart.notNull(protocolsLength); i++) {
+        let length = protocols[dartx._get](i)[dartx.length];
+        if (dart.notNull(length) > 0 && dart.notNull(length) <= 255) {
+          expectedLength = dart.notNull(expectedLength) + dart.notNull(length);
+        } else {
+          dart.throw(new core.ArgumentError(dart.str`Length of protocol must be between 1 and 255 (was: ${length}).`));
+        }
+      }
+      if (dart.notNull(expectedLength) >= 1 << 13) {
+        dart.throw(new core.ArgumentError('The maximum message length supported is 2^13-1.'));
+      }
+      let bytes = typed_data.Uint8List.new(expectedLength);
+      let bytesOffset = 0;
+      for (let i = 0; i < dart.notNull(protocolsLength); i++) {
+        let proto = protocols[dartx._get](i);
+        bytes[dartx._set](bytesOffset++, proto[dartx.length]);
+        let bits = 0;
+        for (let j = 0; j < dart.notNull(proto[dartx.length]); j++) {
+          let char = proto[dartx.codeUnitAt](j);
+          bits = (dart.notNull(bits) | dart.notNull(char)) >>> 0;
+          bytes[dartx._set](bytesOffset++, dart.notNull(char) & 255);
+        }
+        if (dart.notNull(bits) > 127) {
+          return io.SecurityContext._protocolsToLengthEncodingNonAsciiBailout(protocols);
+        }
+      }
+      return bytes;
+    }
+    static _protocolsToLengthEncodingNonAsciiBailout(protocols) {
+      function addProtocol(outBytes, protocol) {
+        let protocolBytes = convert.UTF8.encode(protocol);
+        let len = protocolBytes[dartx.length];
+        if (dart.notNull(len) > 255) {
+          dart.throw(new core.ArgumentError(dart.str`Length of protocol must be between 1 and 255 (was: ${len})`));
+        }
+        outBytes[dartx.add](len);
+        outBytes[dartx.addAll](protocolBytes);
+      }
+      dart.fn(addProtocol, ListOfintAndStringTovoid());
+      let bytes = JSArrayOfint().of([]);
+      for (let i = 0; i < dart.notNull(protocols[dartx.length]); i++) {
+        addProtocol(bytes, protocols[dartx._get](i));
+      }
+      if (dart.notNull(bytes[dartx.length]) >= 1 << 13) {
+        dart.throw(new core.ArgumentError('The maximum message length supported is 2^13-1.'));
+      }
+      return typed_data.Uint8List.fromList(bytes);
+    }
+  };
+  dart.setSignature(io.SecurityContext, {
+    constructors: () => ({new: dart.definiteFunctionType(io.SecurityContext, [])}),
+    sgetters: () => ({
+      defaultContext: dart.definiteFunctionType(io.SecurityContext, []),
+      alpnSupported: dart.definiteFunctionType(core.bool, [])
+    }),
+    statics: () => ({
+      _protocolsToLengthEncoding: dart.definiteFunctionType(typed_data.Uint8List, [ListOfString()]),
+      _protocolsToLengthEncodingNonAsciiBailout: dart.definiteFunctionType(typed_data.Uint8List, [ListOfString()])
+    }),
+    names: ['_protocolsToLengthEncoding', '_protocolsToLengthEncodingNonAsciiBailout']
+  });
+  io._nextServiceId = 1;
+  io.InternetAddressType = class InternetAddressType extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+    static _from(value) {
+      if (value == 0) return io.InternetAddressType.IP_V4;
+      if (value == 1) return io.InternetAddressType.IP_V6;
+      dart.throw(new core.ArgumentError(dart.str`Invalid type: ${value}`));
+    }
+    get name() {
+      switch (this[_value$1]) {
+        case -1:
+        {
+          return "ANY";
+        }
+        case 0:
+        {
+          return "IP_V4";
+        }
+        case 1:
+        {
+          return "IP_V6";
+        }
+        default:
+        {
+          dart.throw(new core.ArgumentError("Invalid InternetAddress"));
+        }
+      }
+    }
+    toString() {
+      return dart.str`InternetAddressType: ${this.name}`;
+    }
+  };
+  dart.defineNamedConstructor(io.InternetAddressType, '_');
+  dart.setSignature(io.InternetAddressType, {
+    constructors: () => ({
+      _: dart.definiteFunctionType(io.InternetAddressType, [core.int]),
+      _from: dart.definiteFunctionType(io.InternetAddressType, [core.int])
+    }),
+    fields: () => ({[_value$1]: core.int}),
+    getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+    sfields: () => ({
+      IP_V4: io.InternetAddressType,
+      IP_V6: io.InternetAddressType,
+      ANY: io.InternetAddressType
+    })
+  });
+  dart.defineLazy(io.InternetAddressType, {
+    get IP_V4() {
+      return dart.const(new io.InternetAddressType._(0));
+    },
+    get IP_V6() {
+      return dart.const(new io.InternetAddressType._(1));
+    },
+    get ANY() {
+      return dart.const(new io.InternetAddressType._(-1));
+    }
+  });
+  io.InternetAddress = class InternetAddress extends core.Object {
+    static get LOOPBACK_IP_V4() {
+      dart.throw(new core.UnsupportedError("InternetAddress.LOOPBACK_IP_V4"));
+    }
+    static get LOOPBACK_IP_V6() {
+      dart.throw(new core.UnsupportedError("InternetAddress.LOOPBACK_IP_V6"));
+    }
+    static get ANY_IP_V4() {
+      dart.throw(new core.UnsupportedError("InternetAddress.ANY_IP_V4"));
+    }
+    static get ANY_IP_V6() {
+      dart.throw(new core.UnsupportedError("InternetAddress.ANY_IP_V6"));
+    }
+    static new(address) {
+      dart.throw(new core.UnsupportedError("InternetAddress"));
+    }
+    static lookup(host, opts) {
+      let type = opts && 'type' in opts ? opts.type : io.InternetAddressType.ANY;
+      dart.throw(new core.UnsupportedError("InternetAddress.lookup"));
+    }
+    static _cloneWithNewHost(address, host) {
+      dart.throw(new core.UnsupportedError("InternetAddress._cloneWithNewHost"));
+    }
+  };
+  dart.setSignature(io.InternetAddress, {
+    constructors: () => ({new: dart.definiteFunctionType(io.InternetAddress, [core.String])}),
+    fields: () => ({type: io.InternetAddressType}),
+    sgetters: () => ({
+      LOOPBACK_IP_V4: dart.definiteFunctionType(io.InternetAddress, []),
+      LOOPBACK_IP_V6: dart.definiteFunctionType(io.InternetAddress, []),
+      ANY_IP_V4: dart.definiteFunctionType(io.InternetAddress, []),
+      ANY_IP_V6: dart.definiteFunctionType(io.InternetAddress, [])
+    }),
+    statics: () => ({
+      lookup: dart.definiteFunctionType(async.Future$(core.List$(io.InternetAddress)), [core.String], {type: io.InternetAddressType}),
+      _cloneWithNewHost: dart.definiteFunctionType(io.InternetAddress, [io.InternetAddress, core.String])
+    }),
+    names: ['lookup', '_cloneWithNewHost']
+  });
+  io.NetworkInterface = class NetworkInterface extends core.Object {
+    static get listSupported() {
+      dart.throw(new core.UnsupportedError("NetworkInterface.listSupported"));
+    }
+    static list(opts) {
+      let includeLoopback = opts && 'includeLoopback' in opts ? opts.includeLoopback : false;
+      let includeLinkLocal = opts && 'includeLinkLocal' in opts ? opts.includeLinkLocal : false;
+      let type = opts && 'type' in opts ? opts.type : io.InternetAddressType.ANY;
+      dart.throw(new core.UnsupportedError("NetworkInterface.list"));
+    }
+  };
+  dart.setSignature(io.NetworkInterface, {
+    sgetters: () => ({listSupported: dart.definiteFunctionType(core.bool, [])}),
+    statics: () => ({list: dart.definiteFunctionType(async.Future$(core.List$(io.NetworkInterface)), [], {includeLoopback: core.bool, includeLinkLocal: core.bool, type: io.InternetAddressType})}),
+    names: ['list']
+  });
+  io.RawServerSocket = class RawServerSocket extends core.Object {
+    static bind(address, port, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      dart.throw(new core.UnsupportedError("RawServerSocket.bind"));
+    }
+  };
+  io.RawServerSocket[dart.implements] = () => [StreamOfRawSocket()];
+  dart.setSignature(io.RawServerSocket, {
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawServerSocket), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool})}),
+    names: ['bind']
+  });
+  io.ServerSocket = class ServerSocket extends core.Object {
+    static bind(address, port, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      dart.throw(new core.UnsupportedError("ServerSocket.bind"));
+    }
+  };
+  io.ServerSocket[dart.implements] = () => [StreamOfSocket()];
+  dart.setSignature(io.ServerSocket, {
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.ServerSocket), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool})}),
+    names: ['bind']
+  });
+  io.SocketDirection = class SocketDirection extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+  };
+  dart.defineNamedConstructor(io.SocketDirection, '_');
+  dart.setSignature(io.SocketDirection, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SocketDirection, [dart.dynamic])}),
+    fields: () => ({[_value$1]: dart.dynamic}),
+    sfields: () => ({
+      RECEIVE: io.SocketDirection,
+      SEND: io.SocketDirection,
+      BOTH: io.SocketDirection
+    })
+  });
+  dart.defineLazy(io.SocketDirection, {
+    get RECEIVE() {
+      return dart.const(new io.SocketDirection._(0));
+    },
+    get SEND() {
+      return dart.const(new io.SocketDirection._(1));
+    },
+    get BOTH() {
+      return dart.const(new io.SocketDirection._(2));
+    }
+  });
+  io.SocketOption = class SocketOption extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+  };
+  dart.defineNamedConstructor(io.SocketOption, '_');
+  dart.setSignature(io.SocketOption, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SocketOption, [dart.dynamic])}),
+    fields: () => ({[_value$1]: dart.dynamic}),
+    sfields: () => ({
+      TCP_NODELAY: io.SocketOption,
+      _IP_MULTICAST_LOOP: io.SocketOption,
+      _IP_MULTICAST_HOPS: io.SocketOption,
+      _IP_MULTICAST_IF: io.SocketOption,
+      _IP_BROADCAST: io.SocketOption
+    })
+  });
+  dart.defineLazy(io.SocketOption, {
+    get TCP_NODELAY() {
+      return dart.const(new io.SocketOption._(0));
+    },
+    get _IP_MULTICAST_LOOP() {
+      return dart.const(new io.SocketOption._(1));
+    },
+    get _IP_MULTICAST_HOPS() {
+      return dart.const(new io.SocketOption._(2));
+    },
+    get _IP_MULTICAST_IF() {
+      return dart.const(new io.SocketOption._(3));
+    },
+    get _IP_BROADCAST() {
+      return dart.const(new io.SocketOption._(4));
+    }
+  });
+  io.RawSocket = class RawSocket extends core.Object {
+    new() {
+      this.readEventsEnabled = null;
+      this.writeEventsEnabled = null;
+    }
+    static connect(host, port, opts) {
+      let sourceAddress = opts && 'sourceAddress' in opts ? opts.sourceAddress : null;
+      dart.throw(new core.UnsupportedError("RawSocket constructor"));
+    }
+  };
+  io.RawSocket[dart.implements] = () => [StreamOfRawSocketEvent()];
+  dart.setSignature(io.RawSocket, {
+    fields: () => ({
+      readEventsEnabled: core.bool,
+      writeEventsEnabled: core.bool
+    }),
+    statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.RawSocket), [dart.dynamic, core.int], {sourceAddress: dart.dynamic})}),
+    names: ['connect']
+  });
+  io.Socket = class Socket extends core.Object {
+    static connect(host, port, opts) {
+      let sourceAddress = opts && 'sourceAddress' in opts ? opts.sourceAddress : null;
+      dart.throw(new core.UnsupportedError("Socket constructor"));
+    }
+  };
+  io.Socket[dart.implements] = () => [StreamOfListOfint(), io.IOSink];
+  dart.setSignature(io.Socket, {
+    statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.Socket), [dart.dynamic, core.int], {sourceAddress: dart.dynamic})}),
+    names: ['connect']
+  });
+  io.Datagram = class Datagram extends core.Object {
+    new(data, address, port) {
+      this.data = data;
+      this.address = address;
+      this.port = port;
+    }
+  };
+  dart.setSignature(io.Datagram, {
+    constructors: () => ({new: dart.definiteFunctionType(io.Datagram, [ListOfint(), io.InternetAddress, core.int])}),
+    fields: () => ({
+      data: ListOfint(),
+      address: io.InternetAddress,
+      port: core.int
+    })
+  });
+  io.RawDatagramSocket = class RawDatagramSocket extends async.Stream$(io.RawSocketEvent) {
+    new() {
+      this.readEventsEnabled = null;
+      this.writeEventsEnabled = null;
+      this.multicastLoopback = null;
+      this.multicastHops = null;
+      this.multicastInterface = null;
+      this.broadcastEnabled = null;
+      super.new();
+    }
+    static bind(host, port, opts) {
+      let reuseAddress = opts && 'reuseAddress' in opts ? opts.reuseAddress : true;
+      dart.throw(new core.UnsupportedError("RawDatagramSocket.bind"));
+    }
+  };
+  dart.addSimpleTypeTests(io.RawDatagramSocket);
+  dart.setSignature(io.RawDatagramSocket, {
+    fields: () => ({
+      readEventsEnabled: core.bool,
+      writeEventsEnabled: core.bool,
+      multicastLoopback: core.bool,
+      multicastHops: core.int,
+      multicastInterface: io.NetworkInterface,
+      broadcastEnabled: core.bool
+    }),
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawDatagramSocket), [dart.dynamic, core.int], {reuseAddress: core.bool})}),
+    names: ['bind']
+  });
+  io.SocketException = class SocketException extends core.Object {
+    new(message, opts) {
+      let osError = opts && 'osError' in opts ? opts.osError : null;
+      let address = opts && 'address' in opts ? opts.address : null;
+      let port = opts && 'port' in opts ? opts.port : null;
+      this.message = message;
+      this.osError = osError;
+      this.address = address;
+      this.port = port;
+    }
+    closed() {
+      this.message = 'Socket has been closed';
+      this.osError = null;
+      this.address = null;
+      this.port = null;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write("SocketException");
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(dart.str`: ${this.message}`);
+        if (this.osError != null) {
+          sb.write(dart.str` (${this.osError})`);
+        }
+      } else if (this.osError != null) {
+        sb.write(dart.str`: ${this.osError}`);
+      }
+      if (this.address != null) {
+        sb.write(dart.str`, address = ${this.address.host}`);
+      }
+      if (this.port != null) {
+        sb.write(dart.str`, port = ${this.port}`);
+      }
+      return sb.toString();
+    }
+  };
+  dart.defineNamedConstructor(io.SocketException, 'closed');
+  io.SocketException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.SocketException, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.SocketException, [core.String], {osError: io.OSError, address: io.InternetAddress, port: core.int}),
+      closed: dart.definiteFunctionType(io.SocketException, [])
+    }),
+    fields: () => ({
+      message: core.String,
+      osError: io.OSError,
+      address: io.InternetAddress,
+      port: core.int
+    })
+  });
+  io._STDIO_HANDLE_TYPE_TERMINAL = 0;
+  io._STDIO_HANDLE_TYPE_PIPE = 1;
+  io._STDIO_HANDLE_TYPE_FILE = 2;
+  io._STDIO_HANDLE_TYPE_SOCKET = 3;
+  io._STDIO_HANDLE_TYPE_OTHER = 4;
+  io._StdStream = class _StdStream extends async.Stream$(core.List$(core.int)) {
+    new(stream) {
+      this[_stream$] = stream;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_stream$].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+  };
+  dart.addSimpleTypeTests(io._StdStream);
+  dart.setSignature(io._StdStream, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StdStream, [StreamOfListOfint()])}),
+    fields: () => ({[_stream$]: StreamOfListOfint()}),
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+  });
+  io.Stdin = class Stdin extends io._StdStream {
+    _(stream) {
+      super.new(stream);
+    }
+    readLineSync(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : io.SYSTEM_ENCODING;
+      let retainNewlines = opts && 'retainNewlines' in opts ? opts.retainNewlines : false;
+      let CR = 13;
+      let LF = 10;
+      let line = [];
+      let crIsNewline = dart.test(io.Platform.isWindows) && dart.equals(io.stdioType(io.stdin), io.StdioType.TERMINAL) && !dart.test(/* Unimplemented unknown name */lineMode);
+      if (dart.test(retainNewlines)) {
+        let byte = null;
+        do {
+          byte = this.readByteSync();
+          if (dart.notNull(byte) < 0) {
+            break;
+          }
+          line[dartx.add](byte);
+        } while (byte != LF && !(byte == CR && crIsNewline));
+        if (dart.test(line[dartx.isEmpty])) {
+          return null;
+        }
+      } else if (crIsNewline) {
+        while (true) {
+          let byte = this.readByteSync();
+          if (dart.notNull(byte) < 0) {
+            if (dart.test(line[dartx.isEmpty])) return null;
+            break;
+          }
+          if (byte == LF || byte == CR) break;
+          line[dartx.add](byte);
+        }
+      } else {
+        outer:
+          while (true) {
+            let byte = this.readByteSync();
+            if (byte == LF) break;
+            if (byte == CR) {
+              do {
+                byte = this.readByteSync();
+                if (byte == LF) break outer;
+                line[dartx.add](CR);
+              } while (byte == CR);
+            }
+            if (dart.notNull(byte) < 0) {
+              if (dart.test(line[dartx.isEmpty])) return null;
+              break;
+            }
+            line[dartx.add](byte);
+          }
+      }
+      return encoding.decode(ListOfint()._check(line));
+    }
+    set echoMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.echoMode"));
+    }
+    set echoMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.echoMode"));
+    }
+    set lineMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.lineMode"));
+    }
+    set lineMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.lineMode"));
+    }
+    readByteSync() {
+      dart.throw(new core.UnsupportedError("Stdin.readByteSync"));
+    }
+  };
+  dart.defineNamedConstructor(io.Stdin, '_');
+  io.Stdin[dart.implements] = () => [StreamOfListOfint()];
+  dart.setSignature(io.Stdin, {
+    constructors: () => ({_: dart.definiteFunctionType(io.Stdin, [StreamOfListOfint()])}),
+    setters: () => ({
+      echoMode: dart.definiteFunctionType(dart.void, [core.bool]),
+      echoMode: dart.definiteFunctionType(dart.void, [core.bool]),
+      lineMode: dart.definiteFunctionType(dart.void, [core.bool]),
+      lineMode: dart.definiteFunctionType(dart.void, [core.bool])
+    }),
+    methods: () => ({
+      readLineSync: dart.definiteFunctionType(core.String, [], {encoding: convert.Encoding, retainNewlines: core.bool}),
+      readByteSync: dart.definiteFunctionType(core.int, [])
+    })
+  });
+  const _fd = Symbol('_fd');
+  const _nonBlocking = Symbol('_nonBlocking');
+  const _hasTerminal = Symbol('_hasTerminal');
+  const _terminalColumns = Symbol('_terminalColumns');
+  const _terminalLines = Symbol('_terminalLines');
+  io._StdSink = class _StdSink extends core.Object {
+    new(sink) {
+      this[_sink$0] = sink;
+    }
+    get encoding() {
+      return this[_sink$0].encoding;
+    }
+    set encoding(encoding) {
+      this[_sink$0].encoding = encoding;
+    }
+    write(object) {
+      this[_sink$0].write(object);
+    }
+    writeln(object) {
+      if (object === void 0) object = "";
+      this[_sink$0].writeln(object);
+    }
+    writeAll(objects, sep) {
+      if (sep === void 0) sep = "";
+      this[_sink$0].writeAll(objects, sep);
+    }
+    add(data) {
+      this[_sink$0].add(data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_sink$0].addError(error, stackTrace);
+    }
+    writeCharCode(charCode) {
+      this[_sink$0].writeCharCode(charCode);
+    }
+    addStream(stream) {
+      return this[_sink$0].addStream(stream);
+    }
+    flush() {
+      return this[_sink$0].flush();
+    }
+    close() {
+      return this[_sink$0].close();
+    }
+    get done() {
+      return this[_sink$0].done;
+    }
+  };
+  io._StdSink[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io._StdSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StdSink, [io.IOSink])}),
+    fields: () => ({[_sink$0]: io.IOSink}),
+    getters: () => ({
+      encoding: dart.definiteFunctionType(convert.Encoding, []),
+      done: dart.definiteFunctionType(async.Future, [])
+    }),
+    setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+    methods: () => ({
+      write: dart.definiteFunctionType(dart.void, [core.Object]),
+      writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+      writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      writeCharCode: dart.definiteFunctionType(dart.void, [core.int]),
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+      flush: dart.definiteFunctionType(async.Future, []),
+      close: dart.definiteFunctionType(async.Future, [])
+    })
+  });
+  io.Stdout = class Stdout extends io._StdSink {
+    _(sink, fd) {
+      this[_fd] = fd;
+      this[_nonBlocking] = null;
+      super.new(sink);
+    }
+    get hasTerminal() {
+      return this[_hasTerminal](this[_fd]);
+    }
+    get terminalColumns() {
+      return this[_terminalColumns](this[_fd]);
+    }
+    get terminalLines() {
+      return this[_terminalLines](this[_fd]);
+    }
+    [_hasTerminal](fd) {
+      dart.throw(new core.UnsupportedError("Stdout.hasTerminal"));
+    }
+    [_terminalColumns](fd) {
+      dart.throw(new core.UnsupportedError("Stdout.terminalColumns"));
+    }
+    [_terminalLines](fd) {
+      dart.throw(new core.UnsupportedError("Stdout.terminalLines"));
+    }
+    get nonBlocking() {
+      if (this[_nonBlocking] == null) {
+        this[_nonBlocking] = io.IOSink.new(new io._FileStreamConsumer.fromStdio(this[_fd]));
+      }
+      return this[_nonBlocking];
+    }
+  };
+  dart.defineNamedConstructor(io.Stdout, '_');
+  io.Stdout[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io.Stdout, {
+    constructors: () => ({_: dart.definiteFunctionType(io.Stdout, [io.IOSink, core.int])}),
+    fields: () => ({
+      [_fd]: core.int,
+      [_nonBlocking]: io.IOSink
+    }),
+    getters: () => ({
+      hasTerminal: dart.definiteFunctionType(core.bool, []),
+      terminalColumns: dart.definiteFunctionType(core.int, []),
+      terminalLines: dart.definiteFunctionType(core.int, []),
+      nonBlocking: dart.definiteFunctionType(io.IOSink, [])
+    }),
+    methods: () => ({
+      [_hasTerminal]: dart.definiteFunctionType(core.bool, [core.int]),
+      [_terminalColumns]: dart.definiteFunctionType(core.int, [core.int]),
+      [_terminalLines]: dart.definiteFunctionType(core.int, [core.int])
+    })
+  });
+  io.StdoutException = class StdoutException extends core.Object {
+    new(message, osError) {
+      if (osError === void 0) osError = null;
+      this.message = message;
+      this.osError = osError;
+    }
+    toString() {
+      return dart.str`StdoutException: ${this.message}${this.osError == null ? "" : dart.str`, ${this.osError}`}`;
+    }
+  };
+  io.StdoutException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.StdoutException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.StdoutException, [core.String], [io.OSError])}),
+    fields: () => ({
+      message: core.String,
+      osError: io.OSError
+    })
+  });
+  io._StdConsumer = class _StdConsumer extends core.Object {
+    new(fd) {
+      this[_file] = io._File._openStdioSync(fd);
+    }
+    addStream(stream) {
+      let completer = async.Completer.new();
+      let sub = null;
+      sub = stream.listen(dart.fn(data => {
+        try {
+          dart.dsend(this[_file], 'writeFromSync', data);
+        } catch (e) {
+          let s = dart.stackTrace(e);
+          dart.dsend(sub, 'cancel');
+          completer.completeError(e, s);
+        }
+
+      }, ListOfintToNull()), {onError: dart.bind(completer, 'completeError'), onDone: dart.bind(completer, 'complete'), cancelOnError: true});
+      return completer.future;
+    }
+    close() {
+      dart.dsend(this[_file], 'closeSync');
+      return async.Future.value();
+    }
+  };
+  io._StdConsumer[dart.implements] = () => [StreamConsumerOfListOfint()];
+  dart.setSignature(io._StdConsumer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StdConsumer, [core.int])}),
+    fields: () => ({[_file]: dart.dynamic}),
+    methods: () => ({
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+      close: dart.definiteFunctionType(async.Future, [])
+    })
+  });
+  io.StdioType = class StdioType extends core.Object {
+    _(name) {
+      this.name = name;
+    }
+    toString() {
+      return dart.str`StdioType: ${this.name}`;
+    }
+  };
+  dart.defineNamedConstructor(io.StdioType, '_');
+  dart.setSignature(io.StdioType, {
+    constructors: () => ({_: dart.definiteFunctionType(io.StdioType, [core.String])}),
+    fields: () => ({name: core.String}),
+    sfields: () => ({
+      TERMINAL: io.StdioType,
+      PIPE: io.StdioType,
+      FILE: io.StdioType,
+      OTHER: io.StdioType
+    })
+  });
+  dart.defineLazy(io.StdioType, {
+    get TERMINAL() {
+      return dart.const(new io.StdioType._("terminal"));
+    },
+    get PIPE() {
+      return dart.const(new io.StdioType._("pipe"));
+    },
+    get FILE() {
+      return dart.const(new io.StdioType._("file"));
+    },
+    get OTHER() {
+      return dart.const(new io.StdioType._("other"));
+    }
+  });
+  io._stdin = null;
+  io._stdout = null;
+  io._stderr = null;
+  dart.copyProperties(io, {
+    get stdin() {
+      if (io._stdin == null) {
+        io._stdin = io._StdIOUtils._getStdioInputStream();
+      }
+      return io._stdin;
+    }
+  });
+  dart.copyProperties(io, {
+    get stdout() {
+      if (io._stdout == null) {
+        io._stdout = io.Stdout._check(io._StdIOUtils._getStdioOutputStream(1));
+      }
+      return io._stdout;
+    }
+  });
+  dart.copyProperties(io, {
+    get stderr() {
+      if (io._stderr == null) {
+        io._stderr = io.Stdout._check(io._StdIOUtils._getStdioOutputStream(2));
+      }
+      return io._stderr;
+    }
+  });
+  io.stdioType = function(object) {
+    if (io._StdStream.is(object)) {
+      object = dart.dload(object, _stream$);
+    } else if (dart.equals(object, io.stdout) || dart.equals(object, io.stderr)) {
+      switch (io._StdIOUtils._getStdioHandleType(dart.equals(object, io.stdout) ? 1 : 2)) {
+        case io._STDIO_HANDLE_TYPE_TERMINAL:
+        {
+          return io.StdioType.TERMINAL;
+        }
+        case io._STDIO_HANDLE_TYPE_PIPE:
+        {
+          return io.StdioType.PIPE;
+        }
+        case io._STDIO_HANDLE_TYPE_FILE:
+        {
+          return io.StdioType.FILE;
+        }
+      }
+    }
+    if (io._FileStream.is(object)) {
+      return io.StdioType.FILE;
+    }
+    if (io.Socket.is(object)) {
+      let socketType = io._StdIOUtils._socketType(object);
+      if (socketType == null) return io.StdioType.OTHER;
+      switch (socketType) {
+        case io._STDIO_HANDLE_TYPE_TERMINAL:
+        {
+          return io.StdioType.TERMINAL;
+        }
+        case io._STDIO_HANDLE_TYPE_PIPE:
+        {
+          return io.StdioType.PIPE;
+        }
+        case io._STDIO_HANDLE_TYPE_FILE:
+        {
+          return io.StdioType.FILE;
+        }
+      }
+    }
+    if (io._IOSinkImpl.is(object)) {
+      try {
+        if (io._FileStreamConsumer.is(object[_target$])) {
+          return io.StdioType.FILE;
+        }
+      } catch (e) {
+      }
+
+    }
+    return io.StdioType.OTHER;
+  };
+  dart.fn(io.stdioType, dynamicToStdioType());
+  io._StdIOUtils = class _StdIOUtils extends core.Object {
+    static _getStdioOutputStream(fd) {
+      dart.throw(new core.UnsupportedError("StdIOUtils._getStdioOutputStream"));
+    }
+    static _getStdioInputStream() {
+      dart.throw(new core.UnsupportedError("StdIOUtils._getStdioInputStream"));
+    }
+    static _socketType(socket) {
+      dart.throw(new core.UnsupportedError("StdIOUtils._socketType"));
+    }
+    static _getStdioHandleType(fd) {
+      dart.throw(new core.UnsupportedError("StdIOUtils._getStdioHandleType"));
+    }
+  };
+  dart.setSignature(io._StdIOUtils, {
+    statics: () => ({
+      _getStdioOutputStream: dart.definiteFunctionType(dart.dynamic, [core.int]),
+      _getStdioInputStream: dart.definiteFunctionType(io.Stdin, []),
+      _socketType: dart.definiteFunctionType(core.int, [io.Socket]),
+      _getStdioHandleType: dart.definiteFunctionType(dart.dynamic, [core.int])
+    }),
+    names: ['_getStdioOutputStream', '_getStdioInputStream', '_socketType', '_getStdioHandleType']
+  });
+  let const$76;
+  let const$77;
+  let const$78;
+  let const$79;
+  io.SystemEncoding = class SystemEncoding extends convert.Encoding {
+    new() {
+      super.new();
+    }
+    get name() {
+      return 'system';
+    }
+    encode(input) {
+      return this.encoder.convert(input);
+    }
+    decode(encoded) {
+      return this.decoder.convert(encoded);
+    }
+    get encoder() {
+      if (io.Platform.operatingSystem == "windows") {
+        return const$76 || (const$76 = dart.const(new io._WindowsCodePageEncoder()));
+      } else {
+        return const$77 || (const$77 = dart.const(new convert.Utf8Encoder()));
+      }
+    }
+    get decoder() {
+      if (io.Platform.operatingSystem == "windows") {
+        return const$78 || (const$78 = dart.const(new io._WindowsCodePageDecoder()));
+      } else {
+        return const$79 || (const$79 = dart.const(new convert.Utf8Decoder()));
+      }
+    }
+  };
+  dart.setSignature(io.SystemEncoding, {
+    constructors: () => ({new: dart.definiteFunctionType(io.SystemEncoding, [])}),
+    getters: () => ({
+      name: dart.definiteFunctionType(core.String, []),
+      encoder: dart.definiteFunctionType(convert.Converter$(core.String, core.List$(core.int)), []),
+      decoder: dart.definiteFunctionType(convert.Converter$(core.List$(core.int), core.String), [])
+    })
+  });
+  io.SYSTEM_ENCODING = dart.const(new io.SystemEncoding());
+  io._WindowsCodePageEncoder = class _WindowsCodePageEncoder extends convert.Converter$(core.String, core.List$(core.int)) {
+    new() {
+      super.new();
+    }
+    convert(input) {
+      let encoded = io._WindowsCodePageEncoder._encodeString(input);
+      if (encoded == null) {
+        dart.throw(new core.FormatException("Invalid character for encoding"));
+      }
+      return encoded;
+    }
+    startChunkedConversion(sink) {
+      return new io._WindowsCodePageEncoderSink(sink);
+    }
+    static _encodeString(string) {
+      dart.throw(new core.UnsupportedError("_WindowsCodePageEncoder._encodeString"));
+    }
+  };
+  dart.addSimpleTypeTests(io._WindowsCodePageEncoder);
+  dart.setSignature(io._WindowsCodePageEncoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageEncoder, [])}),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.List$(core.int), [core.String]),
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
+    }),
+    statics: () => ({_encodeString: dart.definiteFunctionType(core.List$(core.int), [core.String])}),
+    names: ['_encodeString']
+  });
+  io._WindowsCodePageEncoderSink = class _WindowsCodePageEncoderSink extends convert.StringConversionSinkBase {
+    new(sink) {
+      this[_sink$0] = sink;
+    }
+    close() {
+      this[_sink$0].close();
+    }
+    add(string) {
+      let encoded = io._WindowsCodePageEncoder._encodeString(string);
+      if (encoded == null) {
+        dart.throw(new core.FormatException("Invalid character for encoding"));
+      }
+      this[_sink$0].add(encoded);
+    }
+    addSlice(source, start, end, isLast) {
+      if (start != 0 || end != source[dartx.length]) {
+        source = source[dartx.substring](start, end);
+      }
+      this.add(source);
+      if (dart.test(isLast)) this.close();
+    }
+  };
+  dart.setSignature(io._WindowsCodePageEncoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageEncoderSink, [SinkOfListOfint()])}),
+    fields: () => ({[_sink$0]: SinkOfListOfint()}),
+    methods: () => ({
+      close: dart.definiteFunctionType(dart.void, []),
+      addSlice: dart.definiteFunctionType(dart.void, [core.String, core.int, core.int, core.bool])
+    })
+  });
+  io._WindowsCodePageDecoder = class _WindowsCodePageDecoder extends convert.Converter$(core.List$(core.int), core.String) {
+    new() {
+      super.new();
+    }
+    convert(input) {
+      return io._WindowsCodePageDecoder._decodeBytes(input);
+    }
+    startChunkedConversion(sink) {
+      return new io._WindowsCodePageDecoderSink(sink);
+    }
+    static _decodeBytes(bytes) {
+      dart.throw(new core.UnsupportedError("_WindowsCodePageDecoder._decodeBytes"));
+    }
+  };
+  dart.addSimpleTypeTests(io._WindowsCodePageDecoder);
+  dart.setSignature(io._WindowsCodePageDecoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageDecoder, [])}),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.String, [ListOfint()]),
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])
+    }),
+    statics: () => ({_decodeBytes: dart.definiteFunctionType(core.String, [ListOfint()])}),
+    names: ['_decodeBytes']
+  });
+  io._WindowsCodePageDecoderSink = class _WindowsCodePageDecoderSink extends convert.ByteConversionSinkBase {
+    new(sink) {
+      this[_sink$0] = sink;
+      super.new();
+    }
+    close() {
+      this[_sink$0].close();
+    }
+    add(bytes) {
+      this[_sink$0].add(io._WindowsCodePageDecoder._decodeBytes(bytes));
+    }
+  };
+  dart.setSignature(io._WindowsCodePageDecoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageDecoderSink, [SinkOfString()])}),
+    fields: () => ({[_sink$0]: SinkOfString()}),
+    methods: () => ({
+      close: dart.definiteFunctionType(dart.void, []),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()])
+    })
+  });
+  io.WebSocketStatus = class WebSocketStatus extends core.Object {};
+  dart.setSignature(io.WebSocketStatus, {
+    sfields: () => ({
+      NORMAL_CLOSURE: core.int,
+      GOING_AWAY: core.int,
+      PROTOCOL_ERROR: core.int,
+      UNSUPPORTED_DATA: core.int,
+      RESERVED_1004: core.int,
+      NO_STATUS_RECEIVED: core.int,
+      ABNORMAL_CLOSURE: core.int,
+      INVALID_FRAME_PAYLOAD_DATA: core.int,
+      POLICY_VIOLATION: core.int,
+      MESSAGE_TOO_BIG: core.int,
+      MISSING_MANDATORY_EXTENSION: core.int,
+      INTERNAL_SERVER_ERROR: core.int,
+      RESERVED_1015: core.int
+    })
+  });
+  io.WebSocketStatus.NORMAL_CLOSURE = 1000;
+  io.WebSocketStatus.GOING_AWAY = 1001;
+  io.WebSocketStatus.PROTOCOL_ERROR = 1002;
+  io.WebSocketStatus.UNSUPPORTED_DATA = 1003;
+  io.WebSocketStatus.RESERVED_1004 = 1004;
+  io.WebSocketStatus.NO_STATUS_RECEIVED = 1005;
+  io.WebSocketStatus.ABNORMAL_CLOSURE = 1006;
+  io.WebSocketStatus.INVALID_FRAME_PAYLOAD_DATA = 1007;
+  io.WebSocketStatus.POLICY_VIOLATION = 1008;
+  io.WebSocketStatus.MESSAGE_TOO_BIG = 1009;
+  io.WebSocketStatus.MISSING_MANDATORY_EXTENSION = 1010;
+  io.WebSocketStatus.INTERNAL_SERVER_ERROR = 1011;
+  io.WebSocketStatus.RESERVED_1015 = 1015;
+  const _createServerResponseHeader = Symbol('_createServerResponseHeader');
+  const _createClientRequestHeader = Symbol('_createClientRequestHeader');
+  const _createHeader = Symbol('_createHeader');
+  io.CompressionOptions = class CompressionOptions extends core.Object {
+    new(opts) {
+      let clientNoContextTakeover = opts && 'clientNoContextTakeover' in opts ? opts.clientNoContextTakeover : false;
+      let serverNoContextTakeover = opts && 'serverNoContextTakeover' in opts ? opts.serverNoContextTakeover : false;
+      let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : null;
+      let serverMaxWindowBits = opts && 'serverMaxWindowBits' in opts ? opts.serverMaxWindowBits : null;
+      let enabled = opts && 'enabled' in opts ? opts.enabled : true;
+      this.clientNoContextTakeover = clientNoContextTakeover;
+      this.serverNoContextTakeover = serverNoContextTakeover;
+      this.clientMaxWindowBits = clientMaxWindowBits;
+      this.serverMaxWindowBits = serverMaxWindowBits;
+      this.enabled = enabled;
+    }
+    [_createServerResponseHeader](requested) {
+      let info = new io._CompressionMaxWindowBits();
+      let mwb = null;
+      let part = null;
+      if (dart.nullSafe(requested, _ => _.parameters) != null) {
+        part = requested.parameters[dartx._get](io._serverMaxWindowBits);
+      }
+      if (part != null) {
+        if (dart.notNull(part[dartx.length]) >= 2 && dart.test(part[dartx.startsWith]('0'))) {
+          dart.throw(new core.ArgumentError("Illegal 0 padding on value."));
+        } else {
+          mwb = this.serverMaxWindowBits == null ? core.int.parse(part, {onError: dart.fn(source => io._WebSocketImpl.DEFAULT_WINDOW_BITS, StringToint$())}) : this.serverMaxWindowBits;
+          info.headerValue = dart.str`; server_max_window_bits=${mwb}`;
+          info.maxWindowBits = mwb;
+        }
+      } else {
+        info.headerValue = "";
+        info.maxWindowBits = io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+      }
+      return info;
+    }
+    [_createClientRequestHeader](requested, size) {
+      let info = "";
+      if (requested != null) {
+        info = dart.str`; client_max_window_bits=${size}`;
+      } else {
+        if (this.clientMaxWindowBits == null) {
+          info = "; client_max_window_bits";
+        } else {
+          info = dart.str`; client_max_window_bits=${this.clientMaxWindowBits}`;
+        }
+        if (this.serverMaxWindowBits != null) {
+          info = info + dart.str`; server_max_window_bits=${this.serverMaxWindowBits}`;
+        }
+      }
+      return info;
+    }
+    [_createHeader](requested) {
+      if (requested === void 0) requested = null;
+      let info = new io._CompressionMaxWindowBits("", 0);
+      if (!dart.test(this.enabled)) {
+        return info;
+      }
+      info.headerValue = io._WebSocketImpl.PER_MESSAGE_DEFLATE;
+      if (dart.test(this.clientNoContextTakeover) && (requested == null || requested != null && dart.test(requested.parameters[dartx.containsKey](io._clientNoContextTakeover)))) {
+        info.headerValue = dart.notNull(info.headerValue) + "; client_no_context_takeover";
+      }
+      if (dart.test(this.serverNoContextTakeover) && (requested == null || requested != null && dart.test(requested.parameters[dartx.containsKey](io._serverNoContextTakeover)))) {
+        info.headerValue = dart.notNull(info.headerValue) + "; server_no_context_takeover";
+      }
+      let headerList = this[_createServerResponseHeader](requested);
+      info.headerValue = dart.notNull(info.headerValue) + dart.notNull(headerList.headerValue);
+      info.maxWindowBits = headerList.maxWindowBits;
+      info.headerValue = dart.notNull(info.headerValue) + dart.notNull(this[_createClientRequestHeader](requested, info.maxWindowBits));
+      return info;
+    }
+  };
+  dart.setSignature(io.CompressionOptions, {
+    constructors: () => ({new: dart.definiteFunctionType(io.CompressionOptions, [], {clientNoContextTakeover: core.bool, serverNoContextTakeover: core.bool, clientMaxWindowBits: core.int, serverMaxWindowBits: core.int, enabled: core.bool})}),
+    fields: () => ({
+      clientNoContextTakeover: core.bool,
+      serverNoContextTakeover: core.bool,
+      clientMaxWindowBits: core.int,
+      serverMaxWindowBits: core.int,
+      enabled: core.bool
+    }),
+    methods: () => ({
+      [_createServerResponseHeader]: dart.definiteFunctionType(io._CompressionMaxWindowBits, [io.HeaderValue]),
+      [_createClientRequestHeader]: dart.definiteFunctionType(core.String, [io.HeaderValue, core.int]),
+      [_createHeader]: dart.definiteFunctionType(io._CompressionMaxWindowBits, [], [io.HeaderValue])
+    }),
+    sfields: () => ({
+      DEFAULT: io.CompressionOptions,
+      OFF: io.CompressionOptions
+    })
+  });
+  dart.defineLazy(io.CompressionOptions, {
+    get DEFAULT() {
+      return dart.const(new io.CompressionOptions());
+    },
+    get OFF() {
+      return dart.const(new io.CompressionOptions({enabled: false}));
+    }
+  });
+  io.WebSocketTransformer = class WebSocketTransformer extends core.Object {
+    static new(opts) {
+      let protocolSelector = opts && 'protocolSelector' in opts ? opts.protocolSelector : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      return new io._WebSocketTransformerImpl(protocolSelector, compression);
+    }
+    static upgrade(request, opts) {
+      let protocolSelector = opts && 'protocolSelector' in opts ? opts.protocolSelector : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      return io._WebSocketTransformerImpl._upgrade(request, protocolSelector, compression);
+    }
+    static isUpgradeRequest(request) {
+      return io._WebSocketTransformerImpl._isUpgradeRequest(request);
+    }
+  };
+  io.WebSocketTransformer[dart.implements] = () => [StreamTransformerOfHttpRequest$WebSocket()];
+  dart.setSignature(io.WebSocketTransformer, {
+    constructors: () => ({new: dart.definiteFunctionType(io.WebSocketTransformer, [], {protocolSelector: ListOfStringTodynamic(), compression: io.CompressionOptions})}),
+    statics: () => ({
+      upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest], {protocolSelector: ListOfStringTodynamic(), compression: io.CompressionOptions}),
+      isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
+    }),
+    names: ['upgrade', 'isUpgradeRequest']
+  });
+  io.WebSocket = class WebSocket extends core.Object {
+    static connect(url, opts) {
+      let protocols = opts && 'protocols' in opts ? opts.protocols : null;
+      let headers = opts && 'headers' in opts ? opts.headers : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      return io._WebSocketImpl.connect(url, protocols, headers, {compression: compression});
+    }
+    new() {
+      this.pingInterval = null;
+    }
+    static fromUpgradedSocket(socket, opts) {
+      let protocol = opts && 'protocol' in opts ? opts.protocol : null;
+      let serverSide = opts && 'serverSide' in opts ? opts.serverSide : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      if (serverSide == null) {
+        dart.throw(new core.ArgumentError("The serverSide argument must be passed " + "explicitly to WebSocket.fromUpgradedSocket."));
+      }
+      return new io._WebSocketImpl._fromSocket(socket, protocol, compression, serverSide);
+    }
+  };
+  io.WebSocket[dart.implements] = () => [async.Stream, async.StreamSink];
+  dart.setSignature(io.WebSocket, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.WebSocket, []),
+      fromUpgradedSocket: dart.definiteFunctionType(io.WebSocket, [io.Socket], {protocol: core.String, serverSide: core.bool, compression: io.CompressionOptions})
+    }),
+    fields: () => ({pingInterval: core.Duration}),
+    sfields: () => ({
+      CONNECTING: core.int,
+      OPEN: core.int,
+      CLOSING: core.int,
+      CLOSED: core.int
+    }),
+    statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.WebSocket), [core.String], {protocols: IterableOfString(), headers: MapOfString$dynamic(), compression: io.CompressionOptions})}),
+    names: ['connect']
+  });
+  io.WebSocket.CONNECTING = 0;
+  io.WebSocket.OPEN = 1;
+  io.WebSocket.CLOSING = 2;
+  io.WebSocket.CLOSED = 3;
+  io.WebSocketException = class WebSocketException extends core.Object {
+    new(message) {
+      if (message === void 0) message = "";
+      this.message = message;
+    }
+    toString() {
+      return dart.str`WebSocketException: ${this.message}`;
+    }
+  };
+  io.WebSocketException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.WebSocketException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.WebSocketException, [], [core.String])}),
+    fields: () => ({message: core.String})
+  });
+  io._webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
+  io._clientNoContextTakeover = "client_no_context_takeover";
+  io._serverNoContextTakeover = "server_no_context_takeover";
+  io._clientMaxWindowBits = "client_max_window_bits";
+  io._serverMaxWindowBits = "server_max_window_bits";
+  io._WebSocketMessageType = class _WebSocketMessageType extends core.Object {};
+  dart.setSignature(io._WebSocketMessageType, {
+    sfields: () => ({
+      NONE: core.int,
+      TEXT: core.int,
+      BINARY: core.int
+    })
+  });
+  io._WebSocketMessageType.NONE = 0;
+  io._WebSocketMessageType.TEXT = 1;
+  io._WebSocketMessageType.BINARY = 2;
+  io._WebSocketOpcode = class _WebSocketOpcode extends core.Object {};
+  dart.setSignature(io._WebSocketOpcode, {
+    sfields: () => ({
+      CONTINUATION: core.int,
+      TEXT: core.int,
+      BINARY: core.int,
+      RESERVED_3: core.int,
+      RESERVED_4: core.int,
+      RESERVED_5: core.int,
+      RESERVED_6: core.int,
+      RESERVED_7: core.int,
+      CLOSE: core.int,
+      PING: core.int,
+      PONG: core.int,
+      RESERVED_B: core.int,
+      RESERVED_C: core.int,
+      RESERVED_D: core.int,
+      RESERVED_E: core.int,
+      RESERVED_F: core.int
+    })
+  });
+  io._WebSocketOpcode.CONTINUATION = 0;
+  io._WebSocketOpcode.TEXT = 1;
+  io._WebSocketOpcode.BINARY = 2;
+  io._WebSocketOpcode.RESERVED_3 = 3;
+  io._WebSocketOpcode.RESERVED_4 = 4;
+  io._WebSocketOpcode.RESERVED_5 = 5;
+  io._WebSocketOpcode.RESERVED_6 = 6;
+  io._WebSocketOpcode.RESERVED_7 = 7;
+  io._WebSocketOpcode.CLOSE = 8;
+  io._WebSocketOpcode.PING = 9;
+  io._WebSocketOpcode.PONG = 10;
+  io._WebSocketOpcode.RESERVED_B = 11;
+  io._WebSocketOpcode.RESERVED_C = 12;
+  io._WebSocketOpcode.RESERVED_D = 13;
+  io._WebSocketOpcode.RESERVED_E = 14;
+  io._WebSocketOpcode.RESERVED_F = 15;
+  io._CompressionMaxWindowBits = class _CompressionMaxWindowBits extends core.Object {
+    new(headerValue, maxWindowBits) {
+      if (headerValue === void 0) headerValue = null;
+      if (maxWindowBits === void 0) maxWindowBits = null;
+      this.headerValue = headerValue;
+      this.maxWindowBits = maxWindowBits;
+    }
+    toString() {
+      return this.headerValue;
+    }
+  };
+  dart.setSignature(io._CompressionMaxWindowBits, {
+    constructors: () => ({new: dart.definiteFunctionType(io._CompressionMaxWindowBits, [], [core.String, core.int])}),
+    fields: () => ({
+      headerValue: core.String,
+      maxWindowBits: core.int
+    })
+  });
+  const _maskingBytes = Symbol('_maskingBytes');
+  const _payload = Symbol('_payload');
+  const _serverSide = Symbol('_serverSide');
+  const _deflate = Symbol('_deflate');
+  const _fin = Symbol('_fin');
+  const _compressed = Symbol('_compressed');
+  const _opcode = Symbol('_opcode');
+  const _len = Symbol('_len');
+  const _masked = Symbol('_masked');
+  const _remainingLenBytes = Symbol('_remainingLenBytes');
+  const _remainingMaskingKeyBytes = Symbol('_remainingMaskingKeyBytes');
+  const _remainingPayloadBytes = Symbol('_remainingPayloadBytes');
+  const _unmaskingIndex = Symbol('_unmaskingIndex');
+  const _currentMessageType = Symbol('_currentMessageType');
+  const _eventSink$ = Symbol('_eventSink');
+  const _isControlFrame = Symbol('_isControlFrame');
+  const _lengthDone = Symbol('_lengthDone');
+  const _maskDone = Symbol('_maskDone');
+  const _unmask = Symbol('_unmask');
+  const _controlFrameEnd = Symbol('_controlFrameEnd');
+  const _messageFrameEnd = Symbol('_messageFrameEnd');
+  const _startPayload = Symbol('_startPayload');
+  const _prepareForNextFrame = Symbol('_prepareForNextFrame');
+  io._WebSocketProtocolTransformer = class _WebSocketProtocolTransformer extends core.Object {
+    new(serverSide, deflate) {
+      if (serverSide === void 0) serverSide = false;
+      if (deflate === void 0) deflate = null;
+      this[_maskingBytes] = core.List.new(4);
+      this[_payload] = io.BytesBuilder.new({copy: false});
+      this[_serverSide] = serverSide;
+      this[_deflate] = deflate;
+      this[_state$1] = io._WebSocketProtocolTransformer.START;
+      this[_fin] = false;
+      this[_compressed] = false;
+      this[_opcode] = -1;
+      this[_len] = -1;
+      this[_masked] = false;
+      this[_remainingLenBytes] = -1;
+      this[_remainingMaskingKeyBytes] = 4;
+      this[_remainingPayloadBytes] = -1;
+      this[_unmaskingIndex] = 0;
+      this[_currentMessageType] = io._WebSocketMessageType.NONE;
+      this.closeCode = io.WebSocketStatus.NO_STATUS_RECEIVED;
+      this.closeReason = "";
+      this[_eventSink$] = null;
+    }
+    bind(stream) {
+      return async.Stream.eventTransformed(stream, dart.fn(eventSink => {
+        if (this[_eventSink$] != null) {
+          dart.throw(new core.StateError("WebSocket transformer already used."));
+        }
+        this[_eventSink$] = eventSink;
+        return this;
+      }, EventSinkTo_WebSocketProtocolTransformer()));
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_eventSink$].addError(error, stackTrace);
+    }
+    close() {
+      this[_eventSink$].close();
+    }
+    add(bytes) {
+      let buffer = typed_data.Uint8List.is(bytes) ? bytes : typed_data.Uint8List.fromList(bytes);
+      let index = 0;
+      let lastIndex = buffer[dartx.length];
+      if (this[_state$1] == io._WebSocketProtocolTransformer.CLOSED) {
+        dart.throw(new io.WebSocketException("Data on closed connection"));
+      }
+      if (this[_state$1] == io._WebSocketProtocolTransformer.FAILURE) {
+        dart.throw(new io.WebSocketException("Data on failed connection"));
+      }
+      while (dart.notNull(index) < dart.notNull(lastIndex) && this[_state$1] != io._WebSocketProtocolTransformer.CLOSED && this[_state$1] != io._WebSocketProtocolTransformer.FAILURE) {
+        let byte = buffer[dartx._get](index);
+        if (dart.notNull(this[_state$1]) <= io._WebSocketProtocolTransformer.LEN_REST) {
+          if (this[_state$1] == io._WebSocketProtocolTransformer.START) {
+            this[_fin] = (dart.notNull(byte) & io._WebSocketProtocolTransformer.FIN) != 0;
+            if ((dart.notNull(byte) & (io._WebSocketProtocolTransformer.RSV2 | io._WebSocketProtocolTransformer.RSV3)) != 0) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            this[_opcode] = dart.notNull(byte) & io._WebSocketProtocolTransformer.OPCODE;
+            if (this[_opcode] != io._WebSocketOpcode.CONTINUATION) {
+              if ((dart.notNull(byte) & io._WebSocketProtocolTransformer.RSV1) != 0) {
+                this[_compressed] = true;
+              } else {
+                this[_compressed] = false;
+              }
+            }
+            if (dart.notNull(this[_opcode]) <= io._WebSocketOpcode.BINARY) {
+              if (this[_opcode] == io._WebSocketOpcode.CONTINUATION) {
+                if (this[_currentMessageType] == io._WebSocketMessageType.NONE) {
+                  dart.throw(new io.WebSocketException("Protocol error"));
+                }
+              } else {
+                dart.assert(this[_opcode] == io._WebSocketOpcode.TEXT || this[_opcode] == io._WebSocketOpcode.BINARY);
+                if (this[_currentMessageType] != io._WebSocketMessageType.NONE) {
+                  dart.throw(new io.WebSocketException("Protocol error"));
+                }
+                this[_currentMessageType] = this[_opcode];
+              }
+            } else if (dart.notNull(this[_opcode]) >= io._WebSocketOpcode.CLOSE && dart.notNull(this[_opcode]) <= io._WebSocketOpcode.PONG) {
+              if (!dart.test(this[_fin])) dart.throw(new io.WebSocketException("Protocol error"));
+            } else {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            this[_state$1] = io._WebSocketProtocolTransformer.LEN_FIRST;
+          } else if (this[_state$1] == io._WebSocketProtocolTransformer.LEN_FIRST) {
+            this[_masked] = (dart.notNull(byte) & 128) != 0;
+            this[_len] = dart.notNull(byte) & 127;
+            if (dart.test(this[_isControlFrame]()) && dart.notNull(this[_len]) > 125) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            if (this[_len] == 126) {
+              this[_len] = 0;
+              this[_remainingLenBytes] = 2;
+              this[_state$1] = io._WebSocketProtocolTransformer.LEN_REST;
+            } else if (this[_len] == 127) {
+              this[_len] = 0;
+              this[_remainingLenBytes] = 8;
+              this[_state$1] = io._WebSocketProtocolTransformer.LEN_REST;
+            } else {
+              dart.assert(dart.notNull(this[_len]) < 126);
+              this[_lengthDone]();
+            }
+          } else {
+            dart.assert(this[_state$1] == io._WebSocketProtocolTransformer.LEN_REST);
+            this[_len] = (dart.notNull(this[_len]) << 8 | dart.notNull(byte)) >>> 0;
+            this[_remainingLenBytes] = dart.notNull(this[_remainingLenBytes]) - 1;
+            if (this[_remainingLenBytes] == 0) {
+              this[_lengthDone]();
+            }
+          }
+        } else {
+          if (this[_state$1] == io._WebSocketProtocolTransformer.MASK) {
+            this[_maskingBytes][dartx._set](4 - (() => {
+              let x = this[_remainingMaskingKeyBytes];
+              this[_remainingMaskingKeyBytes] = dart.notNull(x) - 1;
+              return x;
+            })(), byte);
+            if (this[_remainingMaskingKeyBytes] == 0) {
+              this[_maskDone]();
+            }
+          } else {
+            dart.assert(this[_state$1] == io._WebSocketProtocolTransformer.PAYLOAD);
+            let payloadLength = math.min(core.int)(dart.notNull(lastIndex) - dart.notNull(index), this[_remainingPayloadBytes]);
+            this[_remainingPayloadBytes] = dart.notNull(this[_remainingPayloadBytes]) - dart.notNull(payloadLength);
+            if (dart.test(this[_masked])) {
+              this[_unmask](index, payloadLength, buffer);
+            }
+            this[_payload].add(typed_data.Uint8List.view(buffer[dartx.buffer], index, payloadLength));
+            index = dart.notNull(index) + dart.notNull(payloadLength);
+            if (dart.test(this[_isControlFrame]())) {
+              if (this[_remainingPayloadBytes] == 0) this[_controlFrameEnd]();
+            } else {
+              if (this[_currentMessageType] != io._WebSocketMessageType.TEXT && this[_currentMessageType] != io._WebSocketMessageType.BINARY) {
+                dart.throw(new io.WebSocketException("Protocol error"));
+              }
+              if (this[_remainingPayloadBytes] == 0) this[_messageFrameEnd]();
+            }
+            index = dart.notNull(index) - 1;
+          }
+        }
+        index = dart.notNull(index) + 1;
+      }
+    }
+    [_unmask](index, length, buffer) {
+      let BLOCK_SIZE = 16;
+      if (dart.notNull(length) >= BLOCK_SIZE) {
+        let startOffset = BLOCK_SIZE - (dart.notNull(index) & 15);
+        let end = dart.notNull(index) + startOffset;
+        for (let i = index; dart.notNull(i) < end; i = dart.notNull(i) + 1) {
+          buffer[dartx._set](i, (dart.notNull(buffer[dartx._get](i)) ^ dart.notNull(core.int._check(this[_maskingBytes][dartx._get]((() => {
+            let x = this[_unmaskingIndex];
+            this[_unmaskingIndex] = dart.notNull(x) + 1;
+            return x;
+          })() & 3)))) >>> 0);
+        }
+        index = dart.notNull(index) + startOffset;
+        length = dart.notNull(length) - startOffset;
+        let blockCount = (dart.notNull(length) / BLOCK_SIZE)[dartx.truncate]();
+        if (blockCount > 0) {
+          let mask = 0;
+          for (let i = 3; i >= 0; i--) {
+            mask = (mask << 8 | dart.notNull(core.int._check(this[_maskingBytes][dartx._get](dart.notNull(this[_unmaskingIndex]) + i & 3)))) >>> 0;
+          }
+          let blockMask = typed_data.Int32x4.new(mask, mask, mask, mask);
+          let blockBuffer = typed_data.Int32x4List.view(buffer[dartx.buffer], index, blockCount);
+          for (let i = 0; i < dart.notNull(blockBuffer.length); i++) {
+            blockBuffer._set(i, blockBuffer._get(i)['^'](blockMask));
+          }
+          let bytes = blockCount * BLOCK_SIZE;
+          index = dart.notNull(index) + bytes;
+          length = dart.notNull(length) - bytes;
+        }
+      }
+      let end = dart.notNull(index) + dart.notNull(length);
+      for (let i = index; dart.notNull(i) < end; i = dart.notNull(i) + 1) {
+        buffer[dartx._set](i, (dart.notNull(buffer[dartx._get](i)) ^ dart.notNull(core.int._check(this[_maskingBytes][dartx._get]((() => {
+          let x = this[_unmaskingIndex];
+          this[_unmaskingIndex] = dart.notNull(x) + 1;
+          return x;
+        })() & 3)))) >>> 0);
+      }
+    }
+    [_lengthDone]() {
+      if (dart.test(this[_masked])) {
+        if (!dart.test(this[_serverSide])) {
+          dart.throw(new io.WebSocketException("Received masked frame from server"));
+        }
+        this[_state$1] = io._WebSocketProtocolTransformer.MASK;
+      } else {
+        if (dart.test(this[_serverSide])) {
+          dart.throw(new io.WebSocketException("Received unmasked frame from client"));
+        }
+        this[_remainingPayloadBytes] = this[_len];
+        this[_startPayload]();
+      }
+    }
+    [_maskDone]() {
+      this[_remainingPayloadBytes] = this[_len];
+      this[_startPayload]();
+    }
+    [_startPayload]() {
+      if (this[_remainingPayloadBytes] == 0) {
+        if (dart.test(this[_isControlFrame]())) {
+          switch (this[_opcode]) {
+            case io._WebSocketOpcode.CLOSE:
+            {
+              this[_state$1] = io._WebSocketProtocolTransformer.CLOSED;
+              this[_eventSink$].close();
+              break;
+            }
+            case io._WebSocketOpcode.PING:
+            {
+              this[_eventSink$].add(new io._WebSocketPing());
+              break;
+            }
+            case io._WebSocketOpcode.PONG:
+            {
+              this[_eventSink$].add(new io._WebSocketPong());
+              break;
+            }
+          }
+          this[_prepareForNextFrame]();
+        } else {
+          this[_messageFrameEnd]();
+        }
+      } else {
+        this[_state$1] = io._WebSocketProtocolTransformer.PAYLOAD;
+      }
+    }
+    [_messageFrameEnd]() {
+      if (dart.test(this[_fin])) {
+        let bytes = this[_payload].takeBytes();
+        if (this[_deflate] != null && dart.test(this[_compressed])) {
+          bytes = this[_deflate].processIncomingMessage(bytes);
+        }
+        switch (this[_currentMessageType]) {
+          case io._WebSocketMessageType.TEXT:
+          {
+            this[_eventSink$].add(convert.UTF8.decode(bytes));
+            break;
+          }
+          case io._WebSocketMessageType.BINARY:
+          {
+            this[_eventSink$].add(bytes);
+            break;
+          }
+        }
+        this[_currentMessageType] = io._WebSocketMessageType.NONE;
+      }
+      this[_prepareForNextFrame]();
+    }
+    [_controlFrameEnd]() {
+      switch (this[_opcode]) {
+        case io._WebSocketOpcode.CLOSE:
+        {
+          this.closeCode = io.WebSocketStatus.NO_STATUS_RECEIVED;
+          let payload = this[_payload].takeBytes();
+          if (dart.notNull(payload[dartx.length]) > 0) {
+            if (payload[dartx.length] == 1) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            this.closeCode = (dart.notNull(payload[dartx._get](0)) << 8 | dart.notNull(payload[dartx._get](1))) >>> 0;
+            if (this.closeCode == io.WebSocketStatus.NO_STATUS_RECEIVED) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            if (dart.notNull(payload[dartx.length]) > 2) {
+              this.closeReason = convert.UTF8.decode(payload[dartx.sublist](2));
+            }
+          }
+          this[_state$1] = io._WebSocketProtocolTransformer.CLOSED;
+          this[_eventSink$].close();
+          break;
+        }
+        case io._WebSocketOpcode.PING:
+        {
+          this[_eventSink$].add(new io._WebSocketPing(this[_payload].takeBytes()));
+          break;
+        }
+        case io._WebSocketOpcode.PONG:
+        {
+          this[_eventSink$].add(new io._WebSocketPong(this[_payload].takeBytes()));
+          break;
+        }
+      }
+      this[_prepareForNextFrame]();
+    }
+    [_isControlFrame]() {
+      return this[_opcode] == io._WebSocketOpcode.CLOSE || this[_opcode] == io._WebSocketOpcode.PING || this[_opcode] == io._WebSocketOpcode.PONG;
+    }
+    [_prepareForNextFrame]() {
+      if (this[_state$1] != io._WebSocketProtocolTransformer.CLOSED && this[_state$1] != io._WebSocketProtocolTransformer.FAILURE) this[_state$1] = io._WebSocketProtocolTransformer.START;
+      this[_fin] = false;
+      this[_opcode] = -1;
+      this[_len] = -1;
+      this[_remainingLenBytes] = -1;
+      this[_remainingMaskingKeyBytes] = 4;
+      this[_remainingPayloadBytes] = -1;
+      this[_unmaskingIndex] = 0;
+    }
+  };
+  io._WebSocketProtocolTransformer[dart.implements] = () => [StreamTransformerOfListOfint$dynamic(), EventSinkOfUint8List()];
+  dart.setSignature(io._WebSocketProtocolTransformer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketProtocolTransformer, [], [core.bool, io._WebSocketPerMessageDeflate])}),
+    fields: () => ({
+      [_state$1]: core.int,
+      [_fin]: core.bool,
+      [_compressed]: core.bool,
+      [_opcode]: core.int,
+      [_len]: core.int,
+      [_masked]: core.bool,
+      [_remainingLenBytes]: core.int,
+      [_remainingMaskingKeyBytes]: core.int,
+      [_remainingPayloadBytes]: core.int,
+      [_unmaskingIndex]: core.int,
+      [_currentMessageType]: core.int,
+      closeCode: core.int,
+      closeReason: core.String,
+      [_eventSink$]: async.EventSink,
+      [_serverSide]: core.bool,
+      [_maskingBytes]: core.List,
+      [_payload]: io.BytesBuilder,
+      [_deflate]: io._WebSocketPerMessageDeflate
+    }),
+    methods: () => ({
+      bind: dart.definiteFunctionType(async.Stream, [async.Stream]),
+      addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
+      close: dart.definiteFunctionType(dart.void, []),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      [_unmask]: dart.definiteFunctionType(dart.void, [core.int, core.int, typed_data.Uint8List]),
+      [_lengthDone]: dart.definiteFunctionType(dart.void, []),
+      [_maskDone]: dart.definiteFunctionType(dart.void, []),
+      [_startPayload]: dart.definiteFunctionType(dart.void, []),
+      [_messageFrameEnd]: dart.definiteFunctionType(dart.void, []),
+      [_controlFrameEnd]: dart.definiteFunctionType(dart.void, []),
+      [_isControlFrame]: dart.definiteFunctionType(core.bool, []),
+      [_prepareForNextFrame]: dart.definiteFunctionType(dart.void, [])
+    }),
+    sfields: () => ({
+      START: core.int,
+      LEN_FIRST: core.int,
+      LEN_REST: core.int,
+      MASK: core.int,
+      PAYLOAD: core.int,
+      CLOSED: core.int,
+      FAILURE: core.int,
+      FIN: core.int,
+      RSV1: core.int,
+      RSV2: core.int,
+      RSV3: core.int,
+      OPCODE: core.int
+    })
+  });
+  io._WebSocketProtocolTransformer.START = 0;
+  io._WebSocketProtocolTransformer.LEN_FIRST = 1;
+  io._WebSocketProtocolTransformer.LEN_REST = 2;
+  io._WebSocketProtocolTransformer.MASK = 3;
+  io._WebSocketProtocolTransformer.PAYLOAD = 4;
+  io._WebSocketProtocolTransformer.CLOSED = 5;
+  io._WebSocketProtocolTransformer.FAILURE = 6;
+  io._WebSocketProtocolTransformer.FIN = 128;
+  io._WebSocketProtocolTransformer.RSV1 = 64;
+  io._WebSocketProtocolTransformer.RSV2 = 32;
+  io._WebSocketProtocolTransformer.RSV3 = 16;
+  io._WebSocketProtocolTransformer.OPCODE = 15;
+  io._WebSocketPing = class _WebSocketPing extends core.Object {
+    new(payload) {
+      if (payload === void 0) payload = null;
+      this.payload = payload;
+    }
+  };
+  dart.setSignature(io._WebSocketPing, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPing, [], [ListOfint()])}),
+    fields: () => ({payload: ListOfint()})
+  });
+  io._WebSocketPong = class _WebSocketPong extends core.Object {
+    new(payload) {
+      if (payload === void 0) payload = null;
+      this.payload = payload;
+    }
+  };
+  dart.setSignature(io._WebSocketPong, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPong, [], [ListOfint()])}),
+    fields: () => ({payload: ListOfint()})
+  });
+  const _protocolSelector = Symbol('_protocolSelector');
+  const _compression = Symbol('_compression');
+  io._WebSocketTransformerImpl = class _WebSocketTransformerImpl extends core.Object {
+    new(protocolSelector, compression) {
+      this[_controller$0] = StreamControllerOfWebSocket().new({sync: true});
+      this[_protocolSelector] = protocolSelector;
+      this[_compression] = compression;
+    }
+    bind(stream) {
+      stream.listen(dart.fn(request => {
+        io._WebSocketTransformerImpl._upgrade(request, this[_protocolSelector], this[_compression]).then(dart.void)(dart.fn(webSocket => this[_controller$0].add(webSocket), WebSocketTovoid())).catchError(dart.bind(this[_controller$0], 'addError'));
+      }, HttpRequestToNull()), {onDone: dart.fn(() => {
+          this[_controller$0].close();
+        }, VoidToNull())});
+      return this[_controller$0].stream;
+    }
+    static _upgrade(request, _protocolSelector, compression) {
+      let response = request.response;
+      if (!dart.test(io._WebSocketTransformerImpl._isUpgradeRequest(request))) {
+        response.statusCode = io.HttpStatus.BAD_REQUEST;
+        response.close();
+        return FutureOfWebSocket().error(new io.WebSocketException("Invalid WebSocket upgrade request"));
+      }
+      function upgrade(protocol) {
+        response.statusCode = io.HttpStatus.SWITCHING_PROTOCOLS;
+        response.headers.add(io.HttpHeaders.CONNECTION, "Upgrade");
+        response.headers.add(io.HttpHeaders.UPGRADE, "websocket");
+        let key = request.headers.value("Sec-WebSocket-Key");
+        let sha1 = new io._SHA1();
+        sha1.add(dart.str`${key}${io._webSocketGUID}`[dartx.codeUnits]);
+        let accept = io._CryptoUtils.bytesToBase64(sha1.close());
+        response.headers.add("Sec-WebSocket-Accept", accept);
+        if (protocol != null) {
+          response.headers.add("Sec-WebSocket-Protocol", protocol);
+        }
+        let deflate = io._WebSocketTransformerImpl._negotiateCompression(request, response, compression);
+        response.headers.contentLength = 0;
+        return response.detachSocket().then(io._WebSocketImpl)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
+      }
+      dart.fn(upgrade, StringToFuture());
+      let protocols = request.headers._get('Sec-WebSocket-Protocol');
+      if (protocols != null && _protocolSelector != null) {
+        protocols = io._HttpParser._tokenizeFieldValue(protocols[dartx.join](', '));
+        return async.Future.new(dart.fn(() => dart.dcall(_protocolSelector, protocols), VoidTodynamic$())).then(dart.dynamic)(dart.fn(protocol => {
+          if (dart.notNull(protocols[dartx.indexOf](core.String._check(protocol))) < 0) {
+            dart.throw(new io.WebSocketException("Selected protocol is not in the list of available protocols"));
+          }
+          return protocol;
+        }, dynamicTodynamic$())).catchError(dart.fn(error => {
+          response.statusCode = io.HttpStatus.INTERNAL_SERVER_ERROR;
+          response.close();
+          dart.throw(error);
+        }, dynamicToNull$())).then(io.WebSocket)(upgrade);
+      } else {
+        return FutureOfWebSocket()._check(upgrade(null));
+      }
+    }
+    static _negotiateCompression(request, response, compression) {
+      let extensionHeader = request.headers.value("Sec-WebSocket-Extensions");
+      let t = extensionHeader;
+      t == null ? extensionHeader = "" : t;
+      let hv = io.HeaderValue.parse(extensionHeader, {valueSeparator: ','});
+      if (dart.test(compression.enabled) && hv.value == io._WebSocketImpl.PER_MESSAGE_DEFLATE) {
+        let info = compression[_createHeader](hv);
+        response.headers.add("Sec-WebSocket-Extensions", info.headerValue);
+        let serverNoContextTakeover = dart.test(hv.parameters[dartx.containsKey](io._serverNoContextTakeover)) && dart.test(compression.serverNoContextTakeover);
+        let clientNoContextTakeover = dart.test(hv.parameters[dartx.containsKey](io._clientNoContextTakeover)) && dart.test(compression.clientNoContextTakeover);
+        let deflate = new io._WebSocketPerMessageDeflate({serverNoContextTakeover: serverNoContextTakeover, clientNoContextTakeover: clientNoContextTakeover, serverMaxWindowBits: info.maxWindowBits, clientMaxWindowBits: info.maxWindowBits, serverSide: true});
+        return deflate;
+      }
+      return null;
+    }
+    static _isUpgradeRequest(request) {
+      if (request.method != "GET") {
+        return false;
+      }
+      if (request.headers._get(io.HttpHeaders.CONNECTION) == null) {
+        return false;
+      }
+      let isUpgrade = false;
+      request.headers._get(io.HttpHeaders.CONNECTION)[dartx.forEach](dart.fn(value => {
+        if (value[dartx.toLowerCase]() == "upgrade") isUpgrade = true;
+      }, StringToNull()));
+      if (!isUpgrade) return false;
+      let upgrade = request.headers.value(io.HttpHeaders.UPGRADE);
+      if (upgrade == null || upgrade[dartx.toLowerCase]() != "websocket") {
+        return false;
+      }
+      let version = request.headers.value("Sec-WebSocket-Version");
+      if (version == null || version != "13") {
+        return false;
+      }
+      let key = request.headers.value("Sec-WebSocket-Key");
+      if (key == null) {
+        return false;
+      }
+      return true;
+    }
+  };
+  io._WebSocketTransformerImpl[dart.implements] = () => [io.WebSocketTransformer];
+  dart.setSignature(io._WebSocketTransformerImpl, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketTransformerImpl, [core.Function, io.CompressionOptions])}),
+    fields: () => ({
+      [_controller$0]: StreamControllerOfWebSocket(),
+      [_protocolSelector]: core.Function,
+      [_compression]: io.CompressionOptions
+    }),
+    methods: () => ({bind: dart.definiteFunctionType(async.Stream$(io.WebSocket), [StreamOfHttpRequest()])}),
+    statics: () => ({
+      _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, dart.dynamic, io.CompressionOptions]),
+      _negotiateCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpRequest, io.HttpResponse, io.CompressionOptions]),
+      _isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
+    }),
+    names: ['_upgrade', '_negotiateCompression', '_isUpgradeRequest']
+  });
+  const _ensureDecoder = Symbol('_ensureDecoder');
+  const _ensureEncoder = Symbol('_ensureEncoder');
+  let const$80;
+  io._WebSocketPerMessageDeflate = class _WebSocketPerMessageDeflate extends core.Object {
+    new(opts) {
+      let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+      let serverMaxWindowBits = opts && 'serverMaxWindowBits' in opts ? opts.serverMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+      let serverNoContextTakeover = opts && 'serverNoContextTakeover' in opts ? opts.serverNoContextTakeover : false;
+      let clientNoContextTakeover = opts && 'clientNoContextTakeover' in opts ? opts.clientNoContextTakeover : false;
+      let serverSide = opts && 'serverSide' in opts ? opts.serverSide : false;
+      this.clientMaxWindowBits = clientMaxWindowBits;
+      this.serverMaxWindowBits = serverMaxWindowBits;
+      this.serverNoContextTakeover = serverNoContextTakeover;
+      this.clientNoContextTakeover = clientNoContextTakeover;
+      this.serverSide = serverSide;
+      this.decoder = null;
+      this.encoder = null;
+    }
+    [_ensureDecoder]() {
+      if (this.decoder == null) {
+        this.decoder = io._Filter._newZLibInflateFilter(dart.test(this.serverSide) ? this.clientMaxWindowBits : this.serverMaxWindowBits, null, true);
+      }
+    }
+    [_ensureEncoder]() {
+      if (this.encoder == null) {
+        this.encoder = io._Filter._newZLibDeflateFilter(false, io.ZLibOption.DEFAULT_LEVEL, dart.test(this.serverSide) ? this.serverMaxWindowBits : this.clientMaxWindowBits, io.ZLibOption.DEFAULT_MEM_LEVEL, io.ZLibOption.STRATEGY_DEFAULT, null, true);
+      }
+    }
+    processIncomingMessage(msg) {
+      this[_ensureDecoder]();
+      let data = [];
+      data[dartx.addAll](msg);
+      data[dartx.addAll](const$80 || (const$80 = dart.constList([0, 0, 255, 255], core.int)));
+      this.decoder.process(ListOfint()._check(data), 0, data[dartx.length]);
+      let result = [];
+      let out = null;
+      while ((out = this.decoder.processed()) != null) {
+        result[dartx.addAll](core.Iterable._check(out));
+      }
+      if (dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || !dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
+        this.decoder = null;
+      }
+      return typed_data.Uint8List.fromList(ListOfint()._check(result));
+    }
+    processOutgoingMessage(msg) {
+      this[_ensureEncoder]();
+      let result = [];
+      let buffer = null;
+      let out = null;
+      if (!typed_data.Uint8List.is(msg)) {
+        for (let i = 0; i < dart.notNull(msg[dartx.length]); i++) {
+          if (dart.notNull(msg[dartx._get](i)) < 0 || 255 < dart.notNull(msg[dartx._get](i))) {
+            dart.throw(new core.ArgumentError("List element is not a byte value " + dart.str`(value ${msg[dartx._get](i)} at index ${i})`));
+          }
+        }
+        buffer = typed_data.Uint8List.fromList(msg);
+      } else {
+        buffer = typed_data.Uint8List._check(msg);
+      }
+      this.encoder.process(buffer, 0, buffer[dartx.length]);
+      while ((out = this.encoder.processed()) != null) {
+        result[dartx.addAll](core.Iterable._check(out));
+      }
+      if (!dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
+        this.encoder = null;
+      }
+      if (dart.notNull(result[dartx.length]) > 4) {
+        result = result[dartx.sublist](0, dart.notNull(result[dartx.length]) - 4);
+      }
+      return ListOfint()._check(result);
+    }
+  };
+  dart.setSignature(io._WebSocketPerMessageDeflate, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [], {clientMaxWindowBits: core.int, serverMaxWindowBits: core.int, serverNoContextTakeover: core.bool, clientNoContextTakeover: core.bool, serverSide: core.bool})}),
+    fields: () => ({
+      serverNoContextTakeover: core.bool,
+      clientNoContextTakeover: core.bool,
+      clientMaxWindowBits: core.int,
+      serverMaxWindowBits: core.int,
+      serverSide: core.bool,
+      decoder: io._Filter,
+      encoder: io._Filter
+    }),
+    methods: () => ({
+      [_ensureDecoder]: dart.definiteFunctionType(dart.void, []),
+      [_ensureEncoder]: dart.definiteFunctionType(dart.void, []),
+      processIncomingMessage: dart.definiteFunctionType(typed_data.Uint8List, [ListOfint()]),
+      processOutgoingMessage: dart.definiteFunctionType(core.List$(core.int), [ListOfint()])
+    })
+  });
+  const _deflateHelper = Symbol('_deflateHelper');
+  const _outCloseCode = Symbol('_outCloseCode');
+  const _outCloseReason = Symbol('_outCloseReason');
+  io._WebSocketOutgoingTransformer = class _WebSocketOutgoingTransformer extends core.Object {
+    new(webSocket) {
+      this.webSocket = webSocket;
+      this[_eventSink$] = null;
+      this[_deflateHelper] = null;
+      this[_deflateHelper] = this.webSocket[_deflate];
+    }
+    bind(stream) {
+      return StreamOfListOfint().eventTransformed(stream, dart.fn(eventSink => {
+        if (this[_eventSink$] != null) {
+          dart.throw(new core.StateError("WebSocket transformer already used"));
+        }
+        this[_eventSink$] = eventSink;
+        return this;
+      }, EventSinkOfListOfintTo_WebSocketOutgoingTransformer()));
+    }
+    add(message) {
+      if (io._WebSocketPong.is(message)) {
+        this.addFrame(io._WebSocketOpcode.PONG, message.payload);
+        return;
+      }
+      if (io._WebSocketPing.is(message)) {
+        this.addFrame(io._WebSocketOpcode.PING, message.payload);
+        return;
+      }
+      let data = null;
+      let opcode = null;
+      if (message != null) {
+        if (typeof message == 'string') {
+          opcode = io._WebSocketOpcode.TEXT;
+          data = convert.UTF8.encode(message);
+        } else {
+          if (ListOfint().is(message)) {
+            data = message;
+            opcode = io._WebSocketOpcode.BINARY;
+          } else {
+            dart.throw(new core.ArgumentError(message));
+          }
+        }
+        if (this[_deflateHelper] != null) {
+          data = this[_deflateHelper].processOutgoingMessage(data);
+        }
+      } else {
+        opcode = io._WebSocketOpcode.TEXT;
+      }
+      this.addFrame(opcode, data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_eventSink$].addError(error, stackTrace);
+    }
+    close() {
+      let code = this.webSocket[_outCloseCode];
+      let reason = this.webSocket[_outCloseReason];
+      let data = null;
+      if (code != null) {
+        data = ListOfint().new();
+        data[dartx.add](dart.notNull(code) >> 8 & 255);
+        data[dartx.add](dart.notNull(code) & 255);
+        if (reason != null) {
+          data[dartx.addAll](convert.UTF8.encode(reason));
+        }
+      }
+      this.addFrame(io._WebSocketOpcode.CLOSE, data);
+      this[_eventSink$].close();
+    }
+    addFrame(opcode, data) {
+      return io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
+        this[_eventSink$].add(e);
+      }, ListOfintToNull()));
+    }
+    static createFrame(opcode, data, serverSide, compressed) {
+      let mask = !dart.test(serverSide);
+      let dataLength = data == null ? 0 : data[dartx.length];
+      let headerSize = mask ? 6 : 2;
+      if (dart.notNull(dataLength) > 65535) {
+        headerSize = headerSize + 8;
+      } else if (dart.notNull(dataLength) > 125) {
+        headerSize = headerSize + 2;
+      }
+      let header = typed_data.Uint8List.new(headerSize);
+      let index = 0;
+      let hoc = (io._WebSocketProtocolTransformer.FIN | (dart.test(compressed) ? io._WebSocketProtocolTransformer.RSV1 : 0) | dart.notNull(opcode) & io._WebSocketProtocolTransformer.OPCODE) >>> 0;
+      header[dartx._set](index++, hoc);
+      let lengthBytes = 1;
+      if (dart.notNull(dataLength) > 65535) {
+        header[dartx._set](index++, 127);
+        lengthBytes = 8;
+      } else if (dart.notNull(dataLength) > 125) {
+        header[dartx._set](index++, 126);
+        lengthBytes = 2;
+      }
+      for (let i = 0; i < lengthBytes; i++) {
+        header[dartx._set](index++, dataLength[dartx['>>']]((lengthBytes - 1 - i) * 8) & 255);
+      }
+      if (mask) {
+        let i$ = 1;
+        header[dartx._set](i$, (dart.notNull(header[dartx._get](i$)) | 1 << 7) >>> 0);
+        let maskBytes = io._IOCrypto.getRandomBytes(4);
+        header[dartx.setRange](index, index + 4, maskBytes);
+        index = index + 4;
+        if (data != null) {
+          let list = null;
+          if (opcode == io._WebSocketOpcode.TEXT && typed_data.Uint8List.is(data)) {
+            list = data;
+          } else {
+            if (typed_data.Uint8List.is(data)) {
+              list = typed_data.Uint8List.fromList(data);
+            } else {
+              list = typed_data.Uint8List.new(data[dartx.length]);
+              for (let i = 0; i < dart.notNull(data[dartx.length]); i++) {
+                if (dart.notNull(data[dartx._get](i)) < 0 || 255 < dart.notNull(data[dartx._get](i))) {
+                  dart.throw(new core.ArgumentError("List element is not a byte value " + dart.str`(value ${data[dartx._get](i)} at index ${i})`));
+                }
+                list[dartx._set](i, data[dartx._get](i));
+              }
+            }
+          }
+          let BLOCK_SIZE = 16;
+          let blockCount = (dart.notNull(list[dartx.length]) / BLOCK_SIZE)[dartx.truncate]();
+          if (blockCount > 0) {
+            let mask = 0;
+            for (let i = 3; i >= 0; i--) {
+              mask = (mask << 8 | dart.notNull(maskBytes[dartx._get](i))) >>> 0;
+            }
+            let blockMask = typed_data.Int32x4.new(mask, mask, mask, mask);
+            let blockBuffer = typed_data.Int32x4List.view(list[dartx.buffer], 0, blockCount);
+            for (let i = 0; i < dart.notNull(blockBuffer.length); i++) {
+              blockBuffer._set(i, blockBuffer._get(i)['^'](blockMask));
+            }
+          }
+          for (let i = blockCount * BLOCK_SIZE; i < dart.notNull(list[dartx.length]); i++) {
+            list[dartx._set](i, (dart.notNull(list[dartx._get](i)) ^ dart.notNull(maskBytes[dartx._get](i & 3))) >>> 0);
+          }
+          data = list;
+        }
+      }
+      dart.assert(index == headerSize);
+      if (data == null) {
+        return JSArrayOfUint8List().of([header]);
+      } else {
+        return JSArrayOfListOfint().of([header, data]);
+      }
+    }
+  };
+  io._WebSocketOutgoingTransformer[dart.implements] = () => [StreamTransformerOfdynamic$ListOfint(), async.EventSink];
+  dart.setSignature(io._WebSocketOutgoingTransformer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [io._WebSocketImpl])}),
+    fields: () => ({
+      webSocket: io._WebSocketImpl,
+      [_eventSink$]: EventSinkOfListOfint(),
+      [_deflateHelper]: io._WebSocketPerMessageDeflate
+    }),
+    methods: () => ({
+      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [async.Stream]),
+      add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
+      close: dart.definiteFunctionType(dart.void, []),
+      addFrame: dart.definiteFunctionType(dart.void, [core.int, ListOfint()])
+    }),
+    statics: () => ({createFrame: dart.definiteFunctionType(core.Iterable$(core.List$(core.int)), [core.int, ListOfint(), core.bool, core.bool])}),
+    names: ['createFrame']
+  });
+  const _issuedPause = Symbol('_issuedPause');
+  const _completer = Symbol('_completer');
+  const _onListen$ = Symbol('_onListen');
+  const _onPause$ = Symbol('_onPause');
+  const _onResume$ = Symbol('_onResume');
+  const _cancel$ = Symbol('_cancel');
+  const _done$ = Symbol('_done');
+  const _ensureController = Symbol('_ensureController');
+  io._WebSocketConsumer = class _WebSocketConsumer extends core.Object {
+    new(webSocket, socket) {
+      this[_closeCompleter] = async.Completer.new();
+      this.webSocket = webSocket;
+      this.socket = socket;
+      this[_controller$0] = null;
+      this[_subscription$] = null;
+      this[_issuedPause] = false;
+      this[_closed] = false;
+      this[_completer] = null;
+    }
+    [_onListen$]() {
+      if (this[_subscription$] != null) {
+        this[_subscription$].cancel();
+      }
+    }
+    [_onPause$]() {
+      if (this[_subscription$] != null) {
+        this[_subscription$].pause();
+      } else {
+        this[_issuedPause] = true;
+      }
+    }
+    [_onResume$]() {
+      if (this[_subscription$] != null) {
+        this[_subscription$].resume();
+      } else {
+        this[_issuedPause] = false;
+      }
+    }
+    [_cancel$]() {
+      if (this[_subscription$] != null) {
+        let subscription = this[_subscription$];
+        this[_subscription$] = null;
+        subscription.cancel();
+      }
+    }
+    [_ensureController]() {
+      if (this[_controller$0] != null) return;
+      this[_controller$0] = async.StreamController.new({sync: true, onPause: dart.bind(this, _onPause$), onResume: dart.bind(this, _onResume$), onCancel: dart.bind(this, _onListen$)});
+      let stream = this[_controller$0].stream.transform(ListOfint())(new io._WebSocketOutgoingTransformer(this.webSocket));
+      this.socket.addStream(stream).then(dart.dynamic)(dart.fn(_ => {
+        this[_done$]();
+        this[_closeCompleter].complete(this.webSocket);
+      }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
+          this[_closed] = true;
+          this[_cancel$]();
+          if (core.ArgumentError.is(error)) {
+            if (!dart.test(this[_done$](error, stackTrace))) {
+              this[_closeCompleter].completeError(error, stackTrace);
+            }
+          } else {
+            this[_done$]();
+            this[_closeCompleter].complete(this.webSocket);
+          }
+        }, dynamicAndStackTraceToNull())});
+    }
+    [_done$](error, stackTrace) {
+      if (error === void 0) error = null;
+      if (stackTrace === void 0) stackTrace = null;
+      if (this[_completer] == null) return false;
+      if (error != null) {
+        this[_completer].completeError(error, stackTrace);
+      } else {
+        this[_completer].complete(this.webSocket);
+      }
+      this[_completer] = null;
+      return true;
+    }
+    addStream(stream) {
+      if (dart.test(this[_closed])) {
+        stream.listen(null).cancel();
+        return async.Future.value(this.webSocket);
+      }
+      this[_ensureController]();
+      this[_completer] = async.Completer.new();
+      this[_subscription$] = stream.listen(dart.fn(data => {
+        this[_controller$0].add(data);
+      }, dynamicToNull$()), {onDone: dart.bind(this, _done$), onError: dart.bind(this, _done$), cancelOnError: true});
+      if (dart.test(this[_issuedPause])) {
+        this[_subscription$].pause();
+        this[_issuedPause] = false;
+      }
+      return this[_completer].future;
+    }
+    close() {
+      this[_ensureController]();
+      const closeSocket = (function() {
+        return this.socket.close().catchError(dart.fn(_ => {
+        }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, dynamicTo_WebSocketImpl()));
+      }).bind(this);
+      dart.fn(closeSocket, VoidToFuture());
+      this[_controller$0].close();
+      return this[_closeCompleter].future.then(dart.dynamic)(dart.fn(_ => closeSocket(), dynamicToFuture()));
+    }
+    add(data) {
+      if (dart.test(this[_closed])) return;
+      this[_ensureController]();
+      this[_controller$0].add(data);
+    }
+    closeSocket() {
+      this[_closed] = true;
+      this[_cancel$]();
+      this.close();
+    }
+  };
+  io._WebSocketConsumer[dart.implements] = () => [async.StreamConsumer];
+  dart.setSignature(io._WebSocketConsumer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketConsumer, [io._WebSocketImpl, io.Socket])}),
+    fields: () => ({
+      webSocket: io._WebSocketImpl,
+      socket: io.Socket,
+      [_controller$0]: async.StreamController,
+      [_subscription$]: async.StreamSubscription,
+      [_issuedPause]: core.bool,
+      [_closed]: core.bool,
+      [_closeCompleter]: async.Completer,
+      [_completer]: async.Completer
+    }),
+    methods: () => ({
+      [_onListen$]: dart.definiteFunctionType(dart.void, []),
+      [_onPause$]: dart.definiteFunctionType(dart.void, []),
+      [_onResume$]: dart.definiteFunctionType(dart.void, []),
+      [_cancel$]: dart.definiteFunctionType(dart.void, []),
+      [_ensureController]: dart.definiteFunctionType(dart.dynamic, []),
+      [_done$]: dart.definiteFunctionType(core.bool, [], [dart.dynamic, core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
+      close: dart.definiteFunctionType(async.Future, []),
+      add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      closeSocket: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _readyState = Symbol('_readyState');
+  const _writeClosed = Symbol('_writeClosed');
+  const _closeCode = Symbol('_closeCode');
+  const _closeReason = Symbol('_closeReason');
+  const _pingInterval = Symbol('_pingInterval');
+  const _pingTimer = Symbol('_pingTimer');
+  const _consumer = Symbol('_consumer');
+  const _closeTimer = Symbol('_closeTimer');
+  let const$81;
+  io._WebSocketImpl = class _WebSocketImpl extends dart.mixin(async.Stream, io._ServiceObject) {
+    static connect(url, protocols, headers, opts) {
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      let uri = core.Uri.parse(url);
+      if (uri.scheme != "ws" && uri.scheme != "wss") {
+        dart.throw(new io.WebSocketException(dart.str`Unsupported URL scheme '${uri.scheme}'`));
+      }
+      let random = math.Random.new();
+      let nonceData = typed_data.Uint8List.new(16);
+      for (let i = 0; i < 16; i++) {
+        nonceData[dartx._set](i, random.nextInt(256));
+      }
+      let nonce = io._CryptoUtils.bytesToBase64(nonceData);
+      uri = core.Uri.new({scheme: uri.scheme == "wss" ? "https" : "http", userInfo: uri.userInfo, host: uri.host, port: uri.port, path: uri.path, query: uri.query, fragment: uri.fragment});
+      return io._WebSocketImpl._httpClient.openUrl("GET", uri).then(io.HttpClientResponse)(dart.fn(request => {
+        if (uri.userInfo != null && !dart.test(uri.userInfo[dartx.isEmpty])) {
+          let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(uri.userInfo));
+          request.headers.set(io.HttpHeaders.AUTHORIZATION, dart.str`Basic ${auth}`);
+        }
+        if (headers != null) {
+          headers[dartx.forEach](dart.fn((field, value) => request.headers.add(field, value), StringAnddynamicTovoid()));
+        }
+        let _ = request.headers;
+        _.set(io.HttpHeaders.CONNECTION, "Upgrade");
+        _.set(io.HttpHeaders.UPGRADE, "websocket");
+        _.set("Sec-WebSocket-Key", nonce);
+        _.set("Cache-Control", "no-cache");
+        _.set("Sec-WebSocket-Version", "13");
+        if (protocols != null) {
+          request.headers.add("Sec-WebSocket-Protocol", protocols[dartx.toList]());
+        }
+        if (dart.test(compression.enabled)) {
+          request.headers.add("Sec-WebSocket-Extensions", compression[_createHeader]());
+        }
+        return request.close();
+      }, HttpClientRequestToFutureOfHttpClientResponse())).then(io.WebSocket)(dart.fn(response => {
+        function error(message) {
+          response.detachSocket().then(dart.dynamic)(dart.fn(socket => {
+            socket.destroy();
+          }, SocketToNull()));
+          dart.throw(new io.WebSocketException(message));
+        }
+        dart.fn(error, StringTovoid$());
+        if (response.statusCode != io.HttpStatus.SWITCHING_PROTOCOLS || response.headers._get(io.HttpHeaders.CONNECTION) == null || !dart.test(response.headers._get(io.HttpHeaders.CONNECTION)[dartx.any](dart.fn(value => value[dartx.toLowerCase]() == "upgrade", StringTobool$()))) || response.headers.value(io.HttpHeaders.UPGRADE)[dartx.toLowerCase]() != "websocket") {
+          error(dart.str`Connection to '${uri}' was not upgraded to websocket`);
+        }
+        let accept = response.headers.value("Sec-WebSocket-Accept");
+        if (accept == null) {
+          error("Response did not contain a 'Sec-WebSocket-Accept' header");
+        }
+        let sha1 = new io._SHA1();
+        sha1.add(dart.str`${nonce}${io._webSocketGUID}`[dartx.codeUnits]);
+        let expectedAccept = sha1.close();
+        let receivedAccept = io._CryptoUtils.base64StringToBytes(accept);
+        if (expectedAccept[dartx.length] != receivedAccept[dartx.length]) {
+          error("Reasponse header 'Sec-WebSocket-Accept' is the wrong length");
+        }
+        for (let i = 0; i < dart.notNull(expectedAccept[dartx.length]); i++) {
+          if (expectedAccept[dartx._get](i) != receivedAccept[dartx._get](i)) {
+            error("Bad response 'Sec-WebSocket-Accept' header");
+          }
+        }
+        let protocol = response.headers.value('Sec-WebSocket-Protocol');
+        let deflate = io._WebSocketImpl.negotiateClientCompression(response, compression);
+        return response.detachSocket().then(io.WebSocket)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, false, deflate), SocketTo_WebSocketImpl()));
+      }, HttpClientResponseToFutureOfWebSocket()));
+    }
+    static negotiateClientCompression(response, compression) {
+      let extensionHeader = response.headers.value('Sec-WebSocket-Extensions');
+      if (extensionHeader == null) {
+        extensionHeader = "";
+      }
+      let hv = io.HeaderValue.parse(extensionHeader, {valueSeparator: ','});
+      if (dart.test(compression.enabled) && hv.value == io._WebSocketImpl.PER_MESSAGE_DEFLATE) {
+        let serverNoContextTakeover = hv.parameters[dartx.containsKey](io._serverNoContextTakeover);
+        let clientNoContextTakeover = hv.parameters[dartx.containsKey](io._clientNoContextTakeover);
+        function getWindowBits(type) {
+          let o = hv.parameters[dartx._get](type);
+          if (o == null) {
+            return io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+          }
+          return core.int.parse(o, {onError: dart.fn(s => io._WebSocketImpl.DEFAULT_WINDOW_BITS, StringToint$())});
+        }
+        dart.fn(getWindowBits, StringToint$());
+        return new io._WebSocketPerMessageDeflate({clientMaxWindowBits: getWindowBits(io._clientMaxWindowBits), serverMaxWindowBits: getWindowBits(io._serverMaxWindowBits), clientNoContextTakeover: clientNoContextTakeover, serverNoContextTakeover: serverNoContextTakeover});
+      }
+      return null;
+    }
+    _fromSocket(socket, protocol, compression, serverSide, deflate) {
+      if (serverSide === void 0) serverSide = false;
+      if (deflate === void 0) deflate = null;
+      this[_socket] = socket;
+      this.protocol = protocol;
+      this[_serverSide] = serverSide;
+      this[_controller$0] = null;
+      this[_subscription$] = null;
+      this[_sink$0] = null;
+      this[_readyState] = io.WebSocket.CONNECTING;
+      this[_writeClosed] = false;
+      this[_closeCode] = null;
+      this[_closeReason] = null;
+      this[_pingInterval] = null;
+      this[_pingTimer] = null;
+      this[_consumer] = null;
+      this[_outCloseCode] = null;
+      this[_outCloseReason] = null;
+      this[_closeTimer] = null;
+      this[_deflate] = null;
+      super.new();
+      this[_consumer] = new io._WebSocketConsumer(this, io.Socket._check(this[_socket]));
+      this[_sink$0] = new io._StreamSinkImpl(this[_consumer]);
+      this[_readyState] = io.WebSocket.OPEN;
+      this[_deflate] = deflate;
+      let transformer = new io._WebSocketProtocolTransformer(this[_serverSide], this[_deflate]);
+      this[_subscription$] = async.StreamSubscription._check(dart.dsend(dart.dsend(this[_socket], 'transform', transformer), 'listen', dart.fn(data => {
+        if (io._WebSocketPing.is(data)) {
+          if (!dart.test(this[_writeClosed])) this[_consumer].add(new io._WebSocketPong(data.payload));
+        } else if (io._WebSocketPong.is(data)) {
+          this.pingInterval = this[_pingInterval];
+        } else {
+          this[_controller$0].add(data);
+        }
+      }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
+          if (this[_closeTimer] != null) this[_closeTimer].cancel();
+          if (core.FormatException.is(error)) {
+            this[_close$0](io.WebSocketStatus.INVALID_FRAME_PAYLOAD_DATA);
+          } else {
+            this[_close$0](io.WebSocketStatus.PROTOCOL_ERROR);
+          }
+          this[_closeCode] = this[_outCloseCode];
+          this[_closeReason] = this[_outCloseReason];
+          this[_controller$0].close();
+        }, dynamicAnddynamicToNull()), onDone: dart.fn(() => {
+          if (this[_closeTimer] != null) this[_closeTimer].cancel();
+          if (this[_readyState] == io.WebSocket.OPEN) {
+            this[_readyState] = io.WebSocket.CLOSING;
+            if (!dart.test(io._WebSocketImpl._isReservedStatusCode(transformer.closeCode))) {
+              this[_close$0](transformer.closeCode, transformer.closeReason);
+            } else {
+              this[_close$0]();
+            }
+            this[_readyState] = io.WebSocket.CLOSED;
+          }
+          this[_closeCode] = transformer.closeCode;
+          this[_closeReason] = transformer.closeReason;
+          this[_controller$0].close();
+        }, VoidToNull()), cancelOnError: true}));
+      this[_subscription$].pause();
+      this[_controller$0] = async.StreamController.new({sync: true, onListen: dart.bind(this[_subscription$], 'resume'), onCancel: dart.fn(() => {
+          this[_subscription$].cancel();
+          this[_subscription$] = null;
+        }, VoidToNull()), onPause: dart.bind(this[_subscription$], 'pause'), onResume: dart.bind(this[_subscription$], 'resume')});
+      io._WebSocketImpl._webSockets[dartx._set](this[_serviceId], this);
+      try {
+        dart.dput(this[_socket], _owner, this);
+      } catch (_) {
+      }
+
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get pingInterval() {
+      return this[_pingInterval];
+    }
+    set pingInterval(interval) {
+      if (dart.test(this[_writeClosed])) return;
+      if (this[_pingTimer] != null) this[_pingTimer].cancel();
+      this[_pingInterval] = interval;
+      if (this[_pingInterval] == null) return;
+      this[_pingTimer] = async.Timer.new(this[_pingInterval], dart.fn(() => {
+        if (dart.test(this[_writeClosed])) return;
+        this[_consumer].add(new io._WebSocketPing());
+        this[_pingTimer] = async.Timer.new(this[_pingInterval], dart.fn(() => {
+          this[_close$0](io.WebSocketStatus.GOING_AWAY);
+        }, VoidToNull()));
+      }, VoidToNull()));
+    }
+    get readyState() {
+      return this[_readyState];
+    }
+    get extensions() {
+      return null;
+    }
+    get closeCode() {
+      return this[_closeCode];
+    }
+    get closeReason() {
+      return this[_closeReason];
+    }
+    add(data) {
+      this[_sink$0].add(data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_sink$0].addError(error, stackTrace);
+    }
+    addStream(stream) {
+      return this[_sink$0].addStream(stream);
+    }
+    get done() {
+      return this[_sink$0].done;
+    }
+    close(code, reason) {
+      if (code === void 0) code = null;
+      if (reason === void 0) reason = null;
+      if (dart.test(io._WebSocketImpl._isReservedStatusCode(code))) {
+        dart.throw(new io.WebSocketException(dart.str`Reserved status code ${code}`));
+      }
+      if (this[_outCloseCode] == null) {
+        this[_outCloseCode] = code;
+        this[_outCloseReason] = reason;
+      }
+      if (!dart.test(this[_controller$0].isClosed)) {
+        if (!dart.test(this[_controller$0].hasListener) && this[_subscription$] != null) {
+          this[_controller$0].stream.drain(dart.dynamic)().catchError(dart.fn(_ => dart.map(), dynamicToMap()));
+        }
+        if (this[_closeTimer] == null) {
+          this[_closeTimer] = async.Timer.new(const$81 || (const$81 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
+            this[_closeCode] = this[_outCloseCode];
+            this[_closeReason] = this[_outCloseReason];
+            if (this[_subscription$] != null) this[_subscription$].cancel();
+            this[_controller$0].close();
+            io._WebSocketImpl._webSockets[dartx.remove](this[_serviceId]);
+          }, VoidToNull()));
+        }
+      }
+      return this[_sink$0].close();
+    }
+    [_close$0](code, reason) {
+      if (code === void 0) code = null;
+      if (reason === void 0) reason = null;
+      if (dart.test(this[_writeClosed])) return;
+      if (this[_outCloseCode] == null) {
+        this[_outCloseCode] = code;
+        this[_outCloseReason] = reason;
+      }
+      this[_writeClosed] = true;
+      this[_consumer].closeSocket();
+      io._WebSocketImpl._webSockets[dartx.remove](this[_serviceId]);
+    }
+    get [_serviceTypePath]() {
+      return 'io/websockets';
+    }
+    get [_serviceTypeName]() {
+      return 'WebSocket';
+    }
+    [_toJSON$](ref) {
+      let name = dart.str`${dart.dload(dart.dload(this[_socket], 'address'), 'host')}:${dart.dload(this[_socket], 'port')}`;
+      let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: name, user_name: name}, core.String, dart.dynamic);
+      if (dart.test(ref)) {
+        return r;
+      }
+      try {
+        r[dartx._set]('socket', dart.dsend(this[_socket], _toJSON$, true));
+      } catch (_) {
+        r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+      }
+
+      return r;
+    }
+    static _isReservedStatusCode(code) {
+      return code != null && (dart.notNull(code) < io.WebSocketStatus.NORMAL_CLOSURE || code == io.WebSocketStatus.RESERVED_1004 || code == io.WebSocketStatus.NO_STATUS_RECEIVED || code == io.WebSocketStatus.ABNORMAL_CLOSURE || dart.notNull(code) > io.WebSocketStatus.INTERNAL_SERVER_ERROR && dart.notNull(code) < io.WebSocketStatus.RESERVED_1015 || dart.notNull(code) >= io.WebSocketStatus.RESERVED_1015 && dart.notNull(code) < 3000);
+    }
+  };
+  dart.addSimpleTypeTests(io._WebSocketImpl);
+  dart.defineNamedConstructor(io._WebSocketImpl, '_fromSocket');
+  io._WebSocketImpl[dart.implements] = () => [io.WebSocket];
+  dart.setSignature(io._WebSocketImpl, {
+    constructors: () => ({_fromSocket: dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic, core.String, io.CompressionOptions], [core.bool, io._WebSocketPerMessageDeflate])}),
+    fields: () => ({
+      protocol: core.String,
+      [_controller$0]: async.StreamController,
+      [_subscription$]: async.StreamSubscription,
+      [_sink$0]: async.StreamSink,
+      [_socket]: dart.dynamic,
+      [_serverSide]: core.bool,
+      [_readyState]: core.int,
+      [_writeClosed]: core.bool,
+      [_closeCode]: core.int,
+      [_closeReason]: core.String,
+      [_pingInterval]: core.Duration,
+      [_pingTimer]: async.Timer,
+      [_consumer]: io._WebSocketConsumer,
+      [_outCloseCode]: core.int,
+      [_outCloseReason]: core.String,
+      [_closeTimer]: async.Timer,
+      [_deflate]: io._WebSocketPerMessageDeflate
+    }),
+    getters: () => ({
+      pingInterval: dart.definiteFunctionType(core.Duration, []),
+      readyState: dart.definiteFunctionType(core.int, []),
+      extensions: dart.definiteFunctionType(core.String, []),
+      closeCode: dart.definiteFunctionType(core.int, []),
+      closeReason: dart.definiteFunctionType(core.String, []),
+      done: dart.definiteFunctionType(async.Future, []),
+      [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+      [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+    }),
+    setters: () => ({pingInterval: dart.definiteFunctionType(dart.void, [core.Duration])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
+      close: dart.definiteFunctionType(async.Future, [], [core.int, core.String]),
+      [_close$0]: dart.definiteFunctionType(dart.void, [], [core.int, core.String]),
+      [_toJSON$]: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [core.bool])
+    }),
+    sfields: () => ({
+      _webSockets: MapOfint$_WebSocketImpl(),
+      DEFAULT_WINDOW_BITS: core.int,
+      PER_MESSAGE_DEFLATE: core.String,
+      _httpClient: io.HttpClient
+    }),
+    statics: () => ({
+      connect: dart.definiteFunctionType(async.Future$(io.WebSocket), [core.String, IterableOfString(), MapOfString$dynamic()], {compression: io.CompressionOptions}),
+      negotiateClientCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpClientResponse, io.CompressionOptions]),
+      _isReservedStatusCode: dart.definiteFunctionType(core.bool, [core.int])
+    }),
+    names: ['connect', 'negotiateClientCompression', '_isReservedStatusCode']
+  });
+  io._WebSocketImpl.DEFAULT_WINDOW_BITS = 15;
+  io._WebSocketImpl.PER_MESSAGE_DEFLATE = "permessage-deflate";
+  dart.defineLazy(io._WebSocketImpl, {
+    get _webSockets() {
+      return MapOfint$_WebSocketImpl().new();
+    },
+    set _webSockets(_) {},
+    get _httpClient() {
+      return io.HttpClient.new();
+    }
+  });
   isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
     new(message) {
       this.message = message;
@@ -37352,11 +52555,11 @@
       controller = async.StreamController.broadcast({sync: true, onListen: dart.fn(() => {
           port = isolate.RawReceivePort.new(handleError);
           this.addErrorListener(port.sendPort);
-        }, VoidTovoid$()), onCancel: dart.fn(() => {
+        }, VoidToNull()), onCancel: dart.fn(() => {
           this.removeErrorListener(port.sendPort);
           port.close();
           port = null;
-        }, VoidTovoid$())});
+        }, VoidToNull())});
       return controller.stream;
     }
   };
@@ -37493,7 +52696,7 @@
   });
   dart.defineLazy(js, {
     get context() {
-      return js._wrapToDart(js._global);
+      return js.JsObject._check(js._wrapToDart(js._global));
     }
   });
   const _jsObject = Symbol('_jsObject');
@@ -37506,22 +52709,22 @@
       if (arguments$ === void 0) arguments$ = null;
       let ctor = constructor[_jsObject];
       if (arguments$ == null) {
-        return js._wrapToDart(new ctor());
+        return js.JsObject._check(js._wrapToDart(new ctor()));
       }
       let unwrapped = core.List.from(arguments$[dartx.map](dart.dynamic)(js._convertToJS));
-      return js._wrapToDart(new ctor(...unwrapped));
+      return js.JsObject._check(js._wrapToDart(new ctor(...unwrapped)));
     }
     static fromBrowserObject(object) {
       if (typeof object == 'number' || typeof object == 'string' || typeof object == 'boolean' || object == null) {
         dart.throw(new core.ArgumentError("object cannot be a num, string, bool, or null"));
       }
-      return js._wrapToDart(js._convertToJS(object));
+      return js.JsObject._check(js._wrapToDart(js._convertToJS(object)));
     }
     static jsify(object) {
       if (!core.Map.is(object) && !core.Iterable.is(object)) {
         dart.throw(new core.ArgumentError("object must be a Map or Iterable"));
       }
-      return js._wrapToDart(js.JsObject._convertDataTree(object));
+      return js.JsObject._check(js._wrapToDart(js.JsObject._convertDataTree(object)));
     }
     static _convertDataTree(data) {
       let _convertedObjects = collection.HashMap.identity();
@@ -37597,7 +52800,7 @@
       }
       if (args != null) args = core.List.from(args[dartx.map](dart.dynamic)(js._convertToJS));
       let fn = this[_jsObject][method];
-      if (!(fn instanceof Function)) {
+      if (typeof fn !== "function") {
         dart.throw(new core.NoSuchMethodError(this[_jsObject], core.Symbol.new(core.String._check(method)), args, dart.map({}, core.Symbol, dart.dynamic)));
       }
       return js._convertToDart(fn.apply(this[_jsObject], args));
@@ -37769,14 +52972,7 @@
         [_checkIndex]: dart.definiteFunctionType(dart.dynamic, [core.int]),
         [_checkInsertIndex]: dart.definiteFunctionType(dart.dynamic, [core.int]),
         _get: dart.definiteFunctionType(E, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [core.Object, E]),
-        add: dart.definiteFunctionType(dart.void, [E]),
-        addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
-        insert: dart.definiteFunctionType(dart.void, [core.int, E]),
-        removeAt: dart.definiteFunctionType(E, [core.int]),
-        removeLast: dart.definiteFunctionType(E, []),
-        setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()], [core.int]),
-        sort: dart.definiteFunctionType(dart.void, [], [EAndEToint()])
+        _set: dart.definiteFunctionType(dart.void, [core.Object, E])
       }),
       statics: () => ({_checkRange: dart.definiteFunctionType(dart.dynamic, [core.int, core.int, core.int])}),
       names: ['_checkRange']
@@ -37799,7 +52995,7 @@
   });
   js.JsArray = JsArray();
   js._isBrowserType = function(o) {
-    return o instanceof Blob || o instanceof Event || window.KeyRange && o instanceof KeyRange || o instanceof ImageData || o instanceof Node || window.TypedData && o instanceof TypedData || o instanceof Window;
+    return o instanceof Object && (o instanceof Blob || o instanceof Event || window.KeyRange && o instanceof KeyRange || window.IDBKeyRange && o instanceof IDBKeyRange || o instanceof ImageData || o instanceof Node || window.Int8Array && o instanceof Int8Array.__proto__ || o instanceof Window);
   };
   dart.fn(js._isBrowserType, dynamicTobool$());
   const _dartObj = Symbol('_dartObj');
@@ -37844,11 +53040,15 @@
     } else if (js._DartObject.is(o) && dart.jsobject != dart.getReifiedType(o)) {
       return o[_dartObj];
     } else {
-      return js._putIfAbsent(js._dartProxies, o, js._wrapToDart);
+      return js._wrapToDart(o);
     }
   };
   dart.fn(js._convertToDart, dynamicToObject());
   js._wrapToDart = function(o) {
+    return js._putIfAbsent(js._dartProxies, o, js._wrapToDartHelper);
+  };
+  dart.fn(js._wrapToDart, dynamicToObject());
+  js._wrapToDartHelper = function(o) {
     if (typeof o == "function") {
       return new js.JsFunction._fromJs(o);
     }
@@ -37857,7 +53057,7 @@
     }
     return new js.JsObject._fromJs(o);
   };
-  dart.fn(js._wrapToDart, dynamicToJsObject());
+  dart.fn(js._wrapToDartHelper, dynamicToObject());
   dart.defineLazy(js, {
     get _dartProxies() {
       return new WeakMap();
@@ -38222,11 +53422,11 @@
   math._Random._POW2_53_D = 1.0 * 9007199254740992;
   math._Random._POW2_27_D = 1.0 * (1 << 27);
   math._Random._MASK32 = 4294967295;
-  const _buffer$ = Symbol('_buffer');
+  const _buffer$0 = Symbol('_buffer');
   const _getRandomBytes = Symbol('_getRandomBytes');
   math._JSSecureRandom = class _JSSecureRandom extends core.Object {
     new() {
-      this[_buffer$] = typed_data.ByteData.new(8);
+      this[_buffer$0] = typed_data.ByteData.new(8);
       let crypto = self.crypto;
       if (crypto != null) {
         let getRandomValues = crypto.getRandomValues;
@@ -38237,18 +53437,18 @@
       dart.throw(new core.UnsupportedError("No source of cryptographically secure random numbers available."));
     }
     [_getRandomBytes](start, length) {
-      crypto.getRandomValues(this[_buffer$][dartx.buffer][dartx.asUint8List](start, length));
+      crypto.getRandomValues(this[_buffer$0][dartx.buffer][dartx.asUint8List](start, length));
     }
     nextBool() {
       this[_getRandomBytes](0, 1);
-      return this[_buffer$][dartx.getUint8](0)[dartx.isOdd];
+      return this[_buffer$0][dartx.getUint8](0)[dartx.isOdd];
     }
     nextDouble() {
       this[_getRandomBytes](1, 7);
-      this[_buffer$][dartx.setUint8](0, 63);
-      let highByte = this[_buffer$][dartx.getUint8](1);
-      this[_buffer$][dartx.setUint8](1, (dart.notNull(highByte) | 240) >>> 0);
-      let result = dart.notNull(this[_buffer$][dartx.getFloat64](0)) - 1.0;
+      this[_buffer$0][dartx.setUint8](0, 63);
+      let highByte = this[_buffer$0][dartx.getUint8](1);
+      this[_buffer$0][dartx.setUint8](1, (dart.notNull(highByte) | 240) >>> 0);
+      let result = dart.notNull(this[_buffer$0][dartx.getFloat64](0)) - 1.0;
       if ((dart.notNull(highByte) & 16) != 0) {
         result = result + 1.1102230246251565e-16;
       }
@@ -38268,12 +53468,12 @@
           }
         }
       }
-      this[_buffer$][dartx.setUint32](0, 0);
+      this[_buffer$0][dartx.setUint32](0, 0);
       let start = 4 - byteCount;
       let randomLimit = dart.asInt(math.pow(256, byteCount));
       while (true) {
         this[_getRandomBytes](start, byteCount);
-        let random = this[_buffer$][dartx.getUint32](0);
+        let random = this[_buffer$0][dartx.getUint32](0);
         if ((dart.notNull(max) & dart.notNull(max) - 1) == 0) {
           return (dart.notNull(random) & dart.notNull(max) - 1) >>> 0;
         }
@@ -38287,7 +53487,7 @@
   math._JSSecureRandom[dart.implements] = () => [math.Random];
   dart.setSignature(math._JSSecureRandom, {
     constructors: () => ({new: dart.definiteFunctionType(math._JSSecureRandom, [])}),
-    fields: () => ({[_buffer$]: typed_data.ByteData}),
+    fields: () => ({[_buffer$0]: typed_data.ByteData}),
     methods: () => ({
       [_getRandomBytes]: dart.definiteFunctionType(dart.void, [core.int, core.int]),
       nextBool: dart.definiteFunctionType(core.bool, []),
@@ -38385,11 +53585,11 @@
     return Point;
   });
   math.Point = Point$();
-  let const$52;
+  let const$82;
   math.Random = class Random extends core.Object {
     static new(seed) {
       if (seed === void 0) seed = null;
-      return seed == null ? const$52 || (const$52 = dart.const(new math._JSRandom())) : new math._Random(seed);
+      return seed == null ? const$82 || (const$82 = dart.const(new math._JSRandom())) : new math._Random(seed);
     }
     static secure() {
       return math.Random._secureRandom;
@@ -39249,7 +54449,7 @@
   indexed_db._idbKey = 'JSExtendableArray|=Object|num|String';
   indexed_db._annotation_Creates_IDBKey = dart.const(new _js_helper.Creates(indexed_db._idbKey));
   indexed_db._annotation_Returns_IDBKey = dart.const(new _js_helper.Returns(indexed_db._idbKey));
-  const _delete = Symbol('_delete');
+  const _delete$ = Symbol('_delete');
   const _update = Symbol('_update');
   const _update_1 = Symbol('_update_1');
   dart.defineExtensionNames([
@@ -39266,7 +54466,7 @@
   indexed_db.Cursor = class Cursor extends _interceptors.Interceptor {
     [dartx.delete]() {
       try {
-        return indexed_db._completeRequest(dart.dynamic)(this[_delete]());
+        return indexed_db._completeRequest(dart.dynamic)(this[_delete$]());
       } catch (e) {
         let stacktrace = dart.stackTrace(e);
         return async.Future.error(e, stacktrace);
@@ -39311,7 +54511,7 @@
     [dartx.continuePrimaryKey](...args) {
       return this.continuePrimaryKey.apply(this, args);
     }
-    [_delete](...args) {
+    [_delete$](...args) {
       return this.delete.apply(this, args);
     }
     [_update](value) {
@@ -39336,7 +54536,7 @@
       [dartx.next]: dart.definiteFunctionType(dart.void, [], [core.Object]),
       [dartx.advance]: dart.definiteFunctionType(dart.void, [core.int]),
       [dartx.continuePrimaryKey]: dart.definiteFunctionType(dart.void, [core.Object, core.Object]),
-      [_delete]: dart.definiteFunctionType(indexed_db.Request, []),
+      [_delete$]: dart.definiteFunctionType(indexed_db.Request, []),
       [_update]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
       [_update_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic])
     })
@@ -39624,7 +54824,7 @@
         let completer = CompleterOfIdbFactory().sync();
         request[dartx.onSuccess].listen(dart.fn(e => {
           completer.complete(this);
-        }, EventTovoid$()));
+        }, EventToNull()));
         request[dartx.onError].listen(dart.bind(completer, 'completeError'));
         return completer.future;
       } catch (e) {
@@ -39683,7 +54883,7 @@
       request[dartx.onSuccess].listen(dart.fn(e => {
         let result = indexed_db._cast(T)(request[dartx.result]);
         completer.complete(result);
-      }, EventTovoid$()));
+      }, EventToNull()));
       request[dartx.onError].listen(dart.bind(completer, 'completeError'));
       return completer.future;
     };
@@ -39911,7 +55111,7 @@
     names: ['bound_', 'lowerBound_', 'only_', 'upperBound_']
   });
   dart.registerExtension(dart.global.IDBKeyRange, indexed_db.KeyRange);
-  const _add$2 = Symbol('_add');
+  const _add$3 = Symbol('_add');
   const _clear$0 = Symbol('_clear');
   const _put = Symbol('_put');
   const _createIndex = Symbol('_createIndex');
@@ -39947,9 +55147,9 @@
       try {
         let request = null;
         if (key != null) {
-          request = this[_add$2](value, key);
+          request = this[_add$3](value, key);
         } else {
-          request = this[_add$2](value);
+          request = this[_add$3](value);
         }
         return indexed_db._completeRequest(dart.dynamic)(indexed_db.Request._check(request));
       } catch (e) {
@@ -39969,7 +55169,7 @@
     }
     [dartx.delete](key_OR_keyRange) {
       try {
-        return indexed_db._completeRequest(dart.dynamic)(this[_delete](key_OR_keyRange));
+        return indexed_db._completeRequest(dart.dynamic)(this[_delete$](key_OR_keyRange));
       } catch (e) {
         let stacktrace = dart.stackTrace(e);
         return async.Future.error(e, stacktrace);
@@ -40065,7 +55265,7 @@
     get [dartx.transaction]() {
       return this.transaction;
     }
-    [_add$2](value, key) {
+    [_add$3](value, key) {
       if (key === void 0) key = null;
       if (key != null) {
         let value_1 = html_common.convertDartToNative_SerializedScriptValue(value);
@@ -40101,7 +55301,7 @@
     [_createIndex_2](...args) {
       return this.createIndex.apply(this, args);
     }
-    [_delete](...args) {
+    [_delete$](...args) {
       return this.delete.apply(this, args);
     }
     [dartx.deleteIndex](...args) {
@@ -40155,7 +55355,7 @@
               cursor[dartx.next]();
             }
           }
-        }, EventTovoid$()));
+        }, EventToNull()));
         return controller.stream;
       };
     }
@@ -40178,7 +55378,7 @@
       [dartx.getObject]: dart.definiteFunctionType(async.Future, [dart.dynamic]),
       [dartx.openCursor]: dart.definiteFunctionType(async.Stream$(indexed_db.CursorWithValue), [], {key: dart.dynamic, range: indexed_db.KeyRange, direction: core.String, autoAdvance: core.bool}),
       [dartx.createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, dart.dynamic], {unique: core.bool, multiEntry: core.bool}),
-      [_add$2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
+      [_add$3]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
       [_add_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic, dart.dynamic]),
       [_add_2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
       [_clear$0]: dart.definiteFunctionType(indexed_db.Request, []),
@@ -40186,7 +55386,7 @@
       [_createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, core.Object], [core.Map]),
       [_createIndex_1]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic, dart.dynamic]),
       [_createIndex_2]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic]),
-      [_delete]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
+      [_delete$]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
       [dartx.deleteIndex]: dart.definiteFunctionType(dart.void, [core.String]),
       [_get$]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
       [dartx.getAll]: dart.definiteFunctionType(indexed_db.Request, [core.Object], [core.int]),
@@ -40328,15 +55528,15 @@
       let completer = CompleterOfDatabase().new();
       this[dartx.onComplete].first.then(dart.dynamic)(dart.fn(_ => {
         completer.complete(this[dartx.db]);
-      }, EventTodynamic()));
+      }, EventToNull()));
       this[dartx.onError].first.then(dart.dynamic)(dart.fn(e => {
         completer.completeError(e);
-      }, EventTodynamic()));
+      }, EventToNull()));
       this[dartx.onAbort].first.then(dart.dynamic)(dart.fn(e => {
         if (!dart.test(completer.isCompleted)) {
           completer.completeError(e);
         }
-      }, EventTodynamic()));
+      }, EventToNull()));
       return completer.future;
     }
     static _() {
@@ -40467,10 +55667,10 @@
       return html$.Event._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new Event(type, eventInitDict);
+      return new self.Event(type, eventInitDict);
     }
     static _create_2(type) {
-      return new Event(type);
+      return new self.Event(type);
     }
     get [dartx.bubbles]() {
       return this.bubbles;
@@ -43177,10 +58377,10 @@
       return html$.AnimationEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new AnimationEvent(type, eventInitDict);
+      return new self.AnimationEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new AnimationEvent(type);
+      return new self.AnimationEvent(type);
     }
     get [dartx.animationName]() {
       return this.animationName;
@@ -43222,10 +58422,10 @@
       return html$.AnimationPlayerEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new AnimationPlayerEvent(type, eventInitDict);
+      return new self.AnimationPlayerEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new AnimationPlayerEvent(type);
+      return new self.AnimationPlayerEvent(type);
     }
     get [dartx.currentTime]() {
       return this.currentTime;
@@ -43462,10 +58662,10 @@
       return html$.ApplicationCacheErrorEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ApplicationCacheErrorEvent(type, eventInitDict);
+      return new self.ApplicationCacheErrorEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ApplicationCacheErrorEvent(type);
+      return new self.ApplicationCacheErrorEvent(type);
     }
     get [dartx.message]() {
       return this.message;
@@ -44166,10 +59366,10 @@
       return html$.AutocompleteErrorEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new AutocompleteErrorEvent(type, eventInitDict);
+      return new self.AutocompleteErrorEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new AutocompleteErrorEvent(type);
+      return new self.AutocompleteErrorEvent(type);
     }
     get [dartx.reason]() {
       return this.reason;
@@ -44317,10 +59517,10 @@
       return html$.BeforeInstallPromptEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new BeforeInstallPromptEvent(type, eventInitDict);
+      return new self.BeforeInstallPromptEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new BeforeInstallPromptEvent(type);
+      return new self.BeforeInstallPromptEvent(type);
     }
     get [dartx.platforms]() {
       return this.platforms;
@@ -44402,10 +59602,10 @@
       return html$.Blob._check(html$.Blob._create_2(blobParts, bag));
     }
     static _create_1(parts) {
-      return new Blob(parts);
+      return new self.Blob(parts);
     }
     static _create_2(parts, bag) {
-      return new Blob(parts, bag);
+      return new self.Blob(parts, bag);
     }
     static _create_bag() {
       return {};
@@ -45891,7 +61091,7 @@
       return html$.CircularGeofencingRegion._create_1(init_1);
     }
     static _create_1(init) {
-      return new CircularGeofencingRegion(init);
+      return new self.CircularGeofencingRegion(init);
     }
     get [dartx.latitude]() {
       return this.latitude;
@@ -46053,10 +61253,10 @@
       return html$.CloseEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new CloseEvent(type, eventInitDict);
+      return new self.CloseEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new CloseEvent(type);
+      return new self.CloseEvent(type);
     }
     get [dartx.code]() {
       return this.code;
@@ -46137,10 +61337,10 @@
       return html$.UIEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new UIEvent(type, eventInitDict);
+      return new self.UIEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new UIEvent(type);
+      return new self.UIEvent(type);
     }
     get [_charCode]() {
       return this.charCode;
@@ -46219,10 +61419,10 @@
       return html$.CompositionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new CompositionEvent(type, eventInitDict);
+      return new self.CompositionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new CompositionEvent(type);
+      return new self.CompositionEvent(type);
     }
     get [dartx.data]() {
       return this.data;
@@ -46261,7 +61461,7 @@
       return html$.CompositorProxy._create_1(element, attributeArray);
     }
     static _create_1(element, attributeArray) {
-      return new CompositorProxy(element, attributeArray);
+      return new self.CompositorProxy(element, attributeArray);
     }
     get [dartx.opacity]() {
       return this.opacity;
@@ -46327,7 +61527,7 @@
       return html$.CompositorWorker._create_1(scriptUrl);
     }
     static _create_1(scriptUrl) {
-      return new CompositorWorker(scriptUrl);
+      return new self.CompositorWorker(scriptUrl);
     }
     [dartx.postMessage](message, transfer) {
       if (transfer === void 0) transfer = null;
@@ -46473,9 +61673,9 @@
       let completer = CompleterOfFileSystem().new();
       this[_webkitRequestFileSystem](type, size, dart.fn(value => {
         completer.complete(value);
-      }, FileSystemTovoid()), dart.fn(error => {
+      }, FileSystemToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.requestFileSystemSync](...args) {
@@ -46491,9 +61691,9 @@
       let completer = CompleterOfEntry().new();
       this[_webkitResolveLocalFileSystemUrl](url, dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), dart.fn(error => {
+      }, EntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.atob](...args) {
@@ -47434,7 +62634,7 @@
   const _pageBreakAfter = Symbol('_pageBreakAfter');
   const _pageBreakBefore = Symbol('_pageBreakBefore');
   const _pageBreakInside = Symbol('_pageBreakInside');
-  const _position$0 = Symbol('_position');
+  const _position$1 = Symbol('_position');
   const _quotes = Symbol('_quotes');
   const _right = Symbol('_right');
   const _tableLayout = Symbol('_tableLayout');
@@ -52733,15 +67933,15 @@
       this.pageBreakInside = value;
     }
     get [dartx.position]() {
-      return this[_position$0];
+      return this[_position$1];
     }
     set [dartx.position](value) {
-      this[_position$0] = value == null ? '' : value;
+      this[_position$1] = value == null ? '' : value;
     }
-    get [_position$0]() {
+    get [_position$1]() {
       return this.position;
     }
-    set [_position$0](value) {
+    set [_position$1](value) {
       this.position = value;
     }
     get [dartx.quotes]() {
@@ -53009,7 +68209,7 @@
       [_pageBreakAfter]: core.String,
       [_pageBreakBefore]: core.String,
       [_pageBreakInside]: core.String,
-      [_position$0]: core.String,
+      [_position$1]: core.String,
       [_quotes]: core.String,
       [_right]: core.String,
       [_tableLayout]: core.String,
@@ -53951,10 +69151,10 @@
       return html$.CustomEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new CustomEvent(type, eventInitDict);
+      return new self.CustomEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new CustomEvent(type);
+      return new self.CustomEvent(type);
     }
     get [_detail]() {
       return html_common.convertNativeToDart_SerializedScriptValue(this[_get__detail]);
@@ -54133,7 +69333,7 @@
       let completer = CompleterOfString().new();
       this[_getAsString](dart.fn(value => {
         completer.complete(value);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     [dartx.getAsEntry](...args) {
@@ -54269,10 +69469,10 @@
       return html$.DefaultSessionStartEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new DefaultSessionStartEvent(type, eventInitDict);
+      return new self.DefaultSessionStartEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new DefaultSessionStartEvent(type);
+      return new self.DefaultSessionStartEvent(type);
     }
     get [dartx.session]() {
       return this.session;
@@ -54422,10 +69622,10 @@
       return html$.DeviceLightEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new DeviceLightEvent(type, eventInitDict);
+      return new self.DeviceLightEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new DeviceLightEvent(type);
+      return new self.DeviceLightEvent(type);
     }
     get [dartx.value]() {
       return this.value;
@@ -54675,9 +69875,9 @@
       let completer = CompleterOfEntry().new();
       this[_copyTo](parent, {name: name, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [_getMetadata](...args) {
@@ -54687,9 +69887,9 @@
       let completer = CompleterOfMetadata().new();
       this[_getMetadata](dart.fn(value => {
         completer.complete(value);
-      }, MetadataTovoid()), dart.fn(error => {
+      }, MetadataToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [_getParent](...args) {
@@ -54699,9 +69899,9 @@
       let completer = CompleterOfEntry().new();
       this[_getParent](dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), dart.fn(error => {
+      }, EntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [_moveTo](...args) {
@@ -54712,9 +69912,9 @@
       let completer = CompleterOfEntry().new();
       this[_moveTo](parent, {name: name, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [_remove$](...args) {
@@ -54724,9 +69924,9 @@
       let completer = async.Completer.new();
       this[_remove$](dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.toUrl](...args) {
@@ -54825,9 +70025,9 @@
       let completer = CompleterOfEntry().new();
       this[__getDirectory](path, {options: options, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [__getFile](path, opts) {
@@ -54869,9 +70069,9 @@
       let completer = CompleterOfEntry().new();
       this[__getFile](path, {options: options, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [_removeRecursively](...args) {
@@ -54881,9 +70081,9 @@
       let completer = async.Completer.new();
       this[_removeRecursively](dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
   };
@@ -54927,9 +70127,9 @@
       let completer = CompleterOfListOfEntry().new();
       this[_readEntries](dart.fn(value => {
         completer.complete(value);
-      }, ListOfEntryTovoid()), dart.fn(error => {
+      }, ListOfEntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
   };
@@ -54963,7 +70163,7 @@
   dart.registerExtension(dart.global.HTMLDivElement, html$.DivElement);
   const _body = Symbol('_body');
   const _get_window = Symbol('_get_window');
-  const _head$ = Symbol('_head');
+  const _head$0 = Symbol('_head');
   const _lastModified = Symbol('_lastModified');
   const _preferredStylesheetSet = Symbol('_preferredStylesheetSet');
   const _referrer = Symbol('_referrer');
@@ -55152,7 +70352,7 @@
     get [dartx.fullscreenEnabled]() {
       return this.fullscreenEnabled;
     }
-    get [_head$]() {
+    get [_head$0]() {
       return this.head;
     }
     get [dartx.hidden]() {
@@ -55598,7 +70798,7 @@
       [dartx.fonts]: html$.FontFaceSet,
       [dartx.fullscreenElement]: html$.Element,
       [dartx.fullscreenEnabled]: core.bool,
-      [_head$]: html$.HeadElement,
+      [_head$0]: html$.HeadElement,
       [dartx.hidden]: core.bool,
       [dartx.implementation]: html$.DomImplementation,
       [_lastModified]: core.String,
@@ -57095,17 +72295,11 @@
   html$.DomStringList[dart.implements] = () => [ListOfString()];
   dart.setSignature(html$.DomStringList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.DomStringList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(core.String, []),
-      [dartx.last]: dart.definiteFunctionType(core.String, []),
-      [dartx.single]: dart.definiteFunctionType(core.String, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(core.String, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
-      [dartx.elementAt]: dart.definiteFunctionType(core.String, [core.int]),
       [__getter__]: dart.definiteFunctionType(core.String, [core.int]),
       [dartx.item]: dart.definiteFunctionType(core.String, [core.int])
     })
@@ -57130,7 +72324,7 @@
   dart.registerExtension(dart.global.EffectModel, html$.EffectModel);
   const _childElements = Symbol('_childElements');
   const _element$ = Symbol('_element');
-  const _filter$ = Symbol('_filter');
+  const _filter$0 = Symbol('_filter');
   html$._ChildrenElementList = class _ChildrenElementList extends collection.ListBase$(html$.Element) {
     _wrap(element) {
       this[_childElements] = html$.HtmlCollection._check(element[_children]);
@@ -57179,12 +72373,12 @@
       dart.throw(new core.UnsupportedError('Cannot shuffle element lists'));
     }
     removeWhere(test) {
-      this[_filter$](test, false);
+      this[_filter$0](test, false);
     }
     retainWhere(test) {
-      this[_filter$](test, true);
+      this[_filter$0](test, true);
     }
-    [_filter$](test, retainMatching) {
+    [_filter$0](test, retainMatching) {
       let removed = null;
       if (dart.test(retainMatching)) {
         removed = this[_element$][dartx.children][dartx.where](dart.fn(e => !dart.test(test(e)), ElementTobool$()));
@@ -57274,10 +72468,6 @@
     }),
     getters: () => ({
       length: dart.definiteFunctionType(core.int, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(html$.Element), []),
-      first: dart.definiteFunctionType(html$.Element, []),
-      last: dart.definiteFunctionType(html$.Element, []),
-      single: dart.definiteFunctionType(html$.Element, []),
       rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
@@ -57285,18 +72475,7 @@
       _get: dart.definiteFunctionType(html$.Element, [core.int]),
       _set: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
       add: dart.definiteFunctionType(html$.Element, [html$.Element]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfElement()]),
-      sort: dart.definiteFunctionType(dart.void, [], [ElementAndElementToint()]),
-      removeWhere: dart.definiteFunctionType(dart.void, [ElementTobool()]),
-      retainWhere: dart.definiteFunctionType(dart.void, [ElementTobool()]),
-      [_filter$]: dart.definiteFunctionType(dart.void, [ElementTobool(), core.bool]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()], [core.int]),
-      replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html$.Element]),
-      insert: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
-      setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfElement()]),
-      removeAt: dart.definiteFunctionType(html$.Element, [core.int]),
-      removeLast: dart.definiteFunctionType(html$.Element, [])
+      [_filter$0]: dart.definiteFunctionType(dart.void, [ElementTobool(), core.bool])
     })
   });
   dart.defineExtensionMembers(html$._ChildrenElementList, [
@@ -57611,9 +72790,6 @@
       fields: () => ({[_nodeList]: ListOfNode()}),
       getters: () => ({
         length: dart.definiteFunctionType(core.int, []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, []),
         classes: dart.definiteFunctionType(html$.CssClassSet, []),
         style: dart.definiteFunctionType(html$.CssStyleDeclarationBase, []),
         contentEdge: dart.definiteFunctionType(html$.CssRect, []),
@@ -57697,8 +72873,7 @@
       }),
       methods: () => ({
         _get: dart.definiteFunctionType(E, [core.int]),
-        _set: dart.definiteFunctionType(dart.void, [core.int, E]),
-        sort: dart.definiteFunctionType(dart.void, [], [ComparatorOfE()])
+        _set: dart.definiteFunctionType(dart.void, [core.int, E])
       })
     });
     dart.defineExtensionMembers(_FrozenElementList, [
@@ -57727,19 +72902,19 @@
     statics: () => ({createElement_tag: dart.definiteFunctionType(dart.dynamic, [core.String, core.String])}),
     names: ['createElement_tag']
   });
-  const _value$1 = Symbol('_value');
+  const _value$2 = Symbol('_value');
   html$.ScrollAlignment = class ScrollAlignment extends core.Object {
     _internal(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
     }
     toString() {
-      return dart.str`ScrollAlignment.${this[_value$1]}`;
+      return dart.str`ScrollAlignment.${this[_value$2]}`;
     }
   };
   dart.defineNamedConstructor(html$.ScrollAlignment, '_internal');
   dart.setSignature(html$.ScrollAlignment, {
     constructors: () => ({_internal: dart.definiteFunctionType(html$.ScrollAlignment, [dart.dynamic])}),
-    fields: () => ({[_value$1]: dart.dynamic}),
+    fields: () => ({[_value$2]: dart.dynamic}),
     sfields: () => ({
       TOP: html$.ScrollAlignment,
       CENTER: html$.ScrollAlignment,
@@ -57864,10 +73039,10 @@
       return html$.ErrorEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ErrorEvent(type, eventInitDict);
+      return new self.ErrorEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ErrorEvent(type);
+      return new self.ErrorEvent(type);
     }
     get [dartx.colno]() {
       return this.colno;
@@ -57931,10 +73106,10 @@
       return html$.EventSource._create_2(url);
     }
     static _create_1(url, eventSourceInitDict) {
-      return new EventSource(url, eventSourceInitDict);
+      return new self.EventSource(url, eventSourceInitDict);
     }
     static _create_2(url) {
-      return new EventSource(url);
+      return new self.EventSource(url);
     }
     get [dartx.readyState]() {
       return this.readyState;
@@ -58056,10 +73231,10 @@
       return html$.ExtendableEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ExtendableEvent(type, eventInitDict);
+      return new self.ExtendableEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ExtendableEvent(type);
+      return new self.ExtendableEvent(type);
     }
     [dartx.waitUntil](...args) {
       return this.waitUntil.apply(this, args);
@@ -58091,7 +73266,7 @@
       return html$.FederatedCredential._create_1(data_1);
     }
     static _create_1(data) {
-      return new FederatedCredential(data);
+      return new self.FederatedCredential(data);
     }
     get [dartx.protocol]() {
       return this.protocol;
@@ -58131,10 +73306,10 @@
       return html$.FetchEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new FetchEvent(type, eventInitDict);
+      return new self.FetchEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new FetchEvent(type);
+      return new self.FetchEvent(type);
     }
     get [dartx.isReload]() {
       return this.isReload;
@@ -58278,10 +73453,10 @@
       return html$.File._create_2(fileBits, fileName);
     }
     static _create_1(fileBits, fileName, options) {
-      return new File(fileBits, fileName, options);
+      return new self.File(fileBits, fileName, options);
     }
     static _create_2(fileBits, fileName) {
-      return new File(fileBits, fileName);
+      return new self.File(fileBits, fileName);
     }
     get [dartx.lastModified]() {
       return this.lastModified;
@@ -58320,7 +73495,7 @@
   dart.registerExtension(dart.global.File, html$.File);
   html$._FileCallback = dart.typedef('_FileCallback', () => dart.functionType(dart.void, [html$.File]));
   const _createWriter = Symbol('_createWriter');
-  const _file = Symbol('_file');
+  const _file$ = Symbol('_file');
   dart.defineExtensionNames([
     'createWriter',
     'file'
@@ -58336,21 +73511,21 @@
       let completer = CompleterOfFileWriter().new();
       this[_createWriter](dart.fn(value => {
         completer.complete(value);
-      }, FileWriterTovoid()), dart.fn(error => {
+      }, FileWriterToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
-    [_file](...args) {
+    [_file$](...args) {
       return this.file.apply(this, args);
     }
     [dartx.file]() {
-      let completer = CompleterOfFile().new();
-      this[_file](dart.fn(value => {
+      let completer = CompleterOfFile$().new();
+      this[_file$](dart.fn(value => {
         completer.complete(value);
-      }, FileTovoid()), dart.fn(error => {
+      }, FileToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
   };
@@ -58359,7 +73534,7 @@
     methods: () => ({
       [_createWriter]: dart.definiteFunctionType(dart.void, [html$._FileWriterCallback], [html$._ErrorCallback]),
       [dartx.createWriter]: dart.definiteFunctionType(async.Future$(html$.FileWriter), []),
-      [_file]: dart.definiteFunctionType(dart.void, [html$._FileCallback], [html$._ErrorCallback]),
+      [_file$]: dart.definiteFunctionType(dart.void, [html$._FileCallback], [html$._ErrorCallback]),
       [dartx.file]: dart.definiteFunctionType(async.Future$(html$.File), [])
     })
   });
@@ -58466,17 +73641,11 @@
   html$.FileList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfFile()];
   dart.setSignature(html$.FileList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.FileList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.File, []),
-      [dartx.last]: dart.definiteFunctionType(html$.File, []),
-      [dartx.single]: dart.definiteFunctionType(html$.File, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.File, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.File]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.File, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.File, [core.int])
     })
   });
@@ -58511,7 +73680,7 @@
       return html$.FileReader._create_1();
     }
     static _create_1() {
-      return new FileReader();
+      return new self.FileReader();
     }
     get [dartx.error]() {
       return this.error;
@@ -58795,10 +73964,10 @@
       return html$.FocusEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new FocusEvent(type, eventInitDict);
+      return new self.FocusEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new FocusEvent(type);
+      return new self.FocusEvent(type);
     }
     get [dartx.relatedTarget]() {
       return html$._convertNativeToDart_EventTarget(this[_get_relatedTarget]);
@@ -58846,10 +74015,10 @@
       return html$.FontFace._create_2(family, source);
     }
     static _create_1(family, source, descriptors) {
-      return new FontFace(family, source, descriptors);
+      return new self.FontFace(family, source, descriptors);
     }
     static _create_2(family, source) {
-      return new FontFace(family, source);
+      return new self.FontFace(family, source);
     }
     get [dartx.family]() {
       return this.family;
@@ -59020,10 +74189,10 @@
       return html$.FormData._create_2();
     }
     static _create_1(form) {
-      return new FormData(form);
+      return new self.FormData(form);
     }
     static _create_2() {
-      return new FormData();
+      return new self.FormData();
     }
     static get supported() {
       return !!window.FormData;
@@ -59314,10 +74483,10 @@
       return html$.GamepadEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new GamepadEvent(type, eventInitDict);
+      return new self.GamepadEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new GamepadEvent(type);
+      return new self.GamepadEvent(type);
     }
     get [dartx.gamepad]() {
       return this.gamepad;
@@ -59420,9 +74589,9 @@
       try {
         this[_getCurrentPosition](dart.fn(position => {
           completer.complete(this[_ensurePosition](position));
-        }, GeopositionTovoid()), dart.fn(error => {
+        }, GeopositionToNull()), dart.fn(error => {
           completer.completeError(error);
-        }, PositionErrorTovoid()), options);
+        }, PositionErrorToNull()), options);
       } catch (e) {
         let stacktrace = dart.stackTrace(e);
         completer.completeError(e, stacktrace);
@@ -59450,13 +74619,13 @@
           dart.assert(watchId == null);
           watchId = this[_watchPosition](dart.fn(position => {
             controller.add(this[_ensurePosition](position));
-          }, GeopositionTovoid()), dart.fn(error => {
+          }, GeopositionToNull()), dart.fn(error => {
             controller.addError(error);
-          }, PositionErrorTovoid()), options);
-        }, VoidTovoid$()), onCancel: dart.fn(() => {
+          }, PositionErrorToNull()), options);
+        }, VoidToNull()), onCancel: dart.fn(() => {
           dart.assert(watchId != null);
           this[_clearWatch](watchId);
-        }, VoidTodynamic$())});
+        }, VoidToNull())});
       return controller.stream;
     }
     [_ensurePosition](domPosition) {
@@ -60164,7 +75333,7 @@
       let oldUrl = opts && 'oldUrl' in opts ? opts.oldUrl : null;
       let newUrl = opts && 'newUrl' in opts ? opts.newUrl : null;
       let options = dart.map({canBubble: canBubble, cancelable: cancelable, oldURL: oldUrl, newURL: newUrl}, core.String, core.Object);
-      return new HashChangeEvent(type, html_common.convertDartToNative_Dictionary(options));
+      return new self.HashChangeEvent(type, html_common.convertDartToNative_Dictionary(options));
     }
     static _(type, eventInitDict) {
       if (eventInitDict === void 0) eventInitDict = null;
@@ -60175,10 +75344,10 @@
       return html$.HashChangeEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new HashChangeEvent(type, eventInitDict);
+      return new self.HashChangeEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new HashChangeEvent(type);
+      return new self.HashChangeEvent(type);
     }
     static get supported() {
       return html_common.Device.isEventTypeSupported('HashChangeEvent');
@@ -60253,16 +75422,16 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1() {
-      return new Headers();
+      return new self.Headers();
     }
     static _create_2(input) {
-      return new Headers(input);
+      return new self.Headers(input);
     }
     static _create_3(input) {
-      return new Headers(input);
+      return new self.Headers(input);
     }
     static _create_4(input) {
-      return new Headers(input);
+      return new self.Headers(input);
     }
   };
   dart.setSignature(html$.Headers, {
@@ -60544,17 +75713,11 @@
   html$.HtmlCollection[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
   dart.setSignature(html$.HtmlCollection, {
     constructors: () => ({_: dart.definiteFunctionType(html$.HtmlCollection, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Node, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx.namedItem]: dart.definiteFunctionType(core.Object, [core.String])
     })
@@ -60603,7 +75766,7 @@
       return html$.CanvasRenderingContext._check(this[_getCssCanvasContext](contextId, name, width, height));
     }
     get [dartx.head]() {
-      return this[_head$];
+      return this[_head$0];
     }
     get [dartx.lastModified]() {
       return this[_lastModified];
@@ -60866,7 +76029,7 @@
       let parts = [];
       data[dartx.forEach](dart.fn((key, value) => {
         parts[dartx.add](dart.str`${core.Uri.encodeQueryComponent(key)}=` + dart.str`${core.Uri.encodeQueryComponent(value)}`);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
       let formData = parts[dartx.join]('&');
       if (requestHeaders == null) {
         requestHeaders = dart.map({}, core.String, core.String);
@@ -60900,7 +76063,7 @@
       if (requestHeaders != null) {
         requestHeaders[dartx.forEach](dart.fn((header, value) => {
           xhr[dartx.setRequestHeader](header, value);
-        }, StringAndStringTovoid$()));
+        }, StringAndStringToNull()));
       }
       if (onProgress != null) {
         xhr[dartx.onProgress].listen(onProgress);
@@ -60915,7 +76078,7 @@
         } else {
           completer.completeError(e);
         }
-      }, ProgressEventTovoid$()));
+      }, ProgressEventToNull()));
       xhr[dartx.onError].listen(dart.bind(completer, 'completeError'));
       if (sendData != null) {
         xhr[dartx.send](sendData);
@@ -60952,13 +76115,13 @@
       }
       let xhr = new XDomainRequest();
       xhr.open(method, url);
-      xhr.onload = _js_helper.convertDartClosureToJS(dynamicTodynamic())(dart.fn(e => {
+      xhr.onload = _js_helper.convertDartClosureToJS(dynamicToNull())(dart.fn(e => {
         let response = xhr.responseText;
         completer.complete(response);
-      }, dynamicTodynamic$()), 1);
-      xhr.onerror = _js_helper.convertDartClosureToJS(dynamicTodynamic())(dart.fn(e => {
+      }, dynamicToNull$()), 1);
+      xhr.onerror = _js_helper.convertDartClosureToJS(dynamicToNull())(dart.fn(e => {
         completer.completeError(e);
-      }, dynamicTodynamic$()), 1);
+      }, dynamicToNull$()), 1);
       xhr.onprogress = {};
       xhr.ontimeout = {};
       xhr.timeout = Number.MAX_VALUE;
@@ -61289,13 +76452,13 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1(data_OR_sw, sh_OR_sw) {
-      return new ImageData(data_OR_sw, sh_OR_sw);
+      return new self.ImageData(data_OR_sw, sh_OR_sw);
     }
     static _create_2(data_OR_sw, sh_OR_sw) {
-      return new ImageData(data_OR_sw, sh_OR_sw);
+      return new self.ImageData(data_OR_sw, sh_OR_sw);
     }
     static _create_3(data_OR_sw, sh_OR_sw, sh) {
-      return new ImageData(data_OR_sw, sh_OR_sw, sh);
+      return new self.ImageData(data_OR_sw, sh_OR_sw, sh);
     }
     get [dartx.data]() {
       return this.data;
@@ -61494,10 +76657,10 @@
       return html$.InputDevice._create_2();
     }
     static _create_1(deviceInitDict) {
-      return new InputDevice(deviceInitDict);
+      return new self.InputDevice(deviceInitDict);
     }
     static _create_2() {
-      return new InputDevice();
+      return new self.InputDevice();
     }
     get [dartx.firesTouchEvents]() {
       return this.firesTouchEvents;
@@ -63215,10 +78378,10 @@
       return html$.KeyboardEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new KeyboardEvent(type, eventInitDict);
+      return new self.KeyboardEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new KeyboardEvent(type);
+      return new self.KeyboardEvent(type);
     }
     get [dartx.altKey]() {
       return this.altKey;
@@ -63316,13 +78479,13 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1(target, keyframes) {
-      return new KeyframeEffect(target, keyframes);
+      return new self.KeyframeEffect(target, keyframes);
     }
     static _create_2(target, keyframes, timing) {
-      return new KeyframeEffect(target, keyframes, timing);
+      return new self.KeyframeEffect(target, keyframes, timing);
     }
     static _create_3(target, keyframes, timing) {
-      return new KeyframeEffect(target, keyframes, timing);
+      return new self.KeyframeEffect(target, keyframes, timing);
     }
   };
   dart.setSignature(html$.KeyframeEffect, {
@@ -63862,7 +79025,7 @@
       return html$.MediaController._create_1();
     }
     static _create_1() {
-      return new MediaController();
+      return new self.MediaController();
     }
     get [dartx.buffered]() {
       return this.buffered;
@@ -64028,10 +79191,10 @@
       return html$.MediaEncryptedEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaEncryptedEvent(type, eventInitDict);
+      return new self.MediaEncryptedEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaEncryptedEvent(type);
+      return new self.MediaEncryptedEvent(type);
     }
     get [dartx.initData]() {
       return this.initData;
@@ -64141,10 +79304,10 @@
       return html$.MediaKeyEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaKeyEvent(type, eventInitDict);
+      return new self.MediaKeyEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaKeyEvent(type);
+      return new self.MediaKeyEvent(type);
     }
     get [dartx.defaultUrl]() {
       return this.defaultURL;
@@ -64206,10 +79369,10 @@
       return html$.MediaKeyMessageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaKeyMessageEvent(type, eventInitDict);
+      return new self.MediaKeyMessageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaKeyMessageEvent(type);
+      return new self.MediaKeyMessageEvent(type);
     }
     get [dartx.message]() {
       return this.message;
@@ -64472,10 +79635,10 @@
       return html$.MediaQueryListEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaQueryListEvent(type, eventInitDict);
+      return new self.MediaQueryListEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaQueryListEvent(type);
+      return new self.MediaQueryListEvent(type);
     }
     get [dartx.matches]() {
       return this.matches;
@@ -64512,7 +79675,7 @@
       return html$.MediaSession._create_1();
     }
     static _create_1() {
-      return new MediaSession();
+      return new self.MediaSession();
     }
     [dartx.activate](...args) {
       return this.activate.apply(this, args);
@@ -64551,7 +79714,7 @@
       return html$.MediaSource._create_1();
     }
     static _create_1() {
-      return new MediaSource();
+      return new self.MediaSource();
     }
     static get supported() {
       return !!window.MediaSource;
@@ -64640,13 +79803,13 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1() {
-      return new MediaStream();
+      return new self.MediaStream();
     }
     static _create_2(stream_OR_tracks) {
-      return new MediaStream(stream_OR_tracks);
+      return new self.MediaStream(stream_OR_tracks);
     }
     static _create_3(stream_OR_tracks) {
-      return new MediaStream(stream_OR_tracks);
+      return new self.MediaStream(stream_OR_tracks);
     }
     get [dartx.active]() {
       return this.active;
@@ -64764,10 +79927,10 @@
       return html$.MediaStreamEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaStreamEvent(type, eventInitDict);
+      return new self.MediaStreamEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaStreamEvent(type);
+      return new self.MediaStreamEvent(type);
     }
     static get supported() {
       return html_common.Device.isEventTypeSupported('MediaStreamEvent');
@@ -64835,7 +79998,7 @@
       let completer = CompleterOfListOfSourceInfo().new();
       html$.MediaStreamTrack._getSources(dart.fn(value => {
         completer.complete(value);
-      }, ListOfSourceInfoTovoid()));
+      }, ListOfSourceInfoToNull()));
       return completer.future;
     }
     [dartx.stop](...args) {
@@ -65112,7 +80275,7 @@
         source = html$.window;
       }
       if (!dart.test(html_common.Device.isIE)) {
-        return new MessageEvent(type, {bubbles: canBubble, cancelable: cancelable, data: data, origin: origin, lastEventId: lastEventId, source: source, ports: messagePorts});
+        return new self.MessageEvent(type, {bubbles: canBubble, cancelable: cancelable, data: data, origin: origin, lastEventId: lastEventId, source: source, ports: messagePorts});
       }
       let event = html$.MessageEvent._check(html$.document[_createEvent]("MessageEvent"));
       event[_initMessageEvent](type, canBubble, cancelable, data, origin, lastEventId, source, messagePorts);
@@ -65133,10 +80296,10 @@
       return html$.MessageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MessageEvent(type, eventInitDict);
+      return new self.MessageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MessageEvent(type);
+      return new self.MessageEvent(type);
     }
     get [dartx.lastEventId]() {
       return this.lastEventId;
@@ -65738,17 +80901,11 @@
   html$.MimeTypeArray[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfMimeType()];
   dart.setSignature(html$.MimeTypeArray, {
     constructors: () => ({_: dart.definiteFunctionType(html$.MimeTypeArray, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.MimeType, []),
-      [dartx.last]: dart.definiteFunctionType(html$.MimeType, []),
-      [dartx.single]: dart.definiteFunctionType(html$.MimeType, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.MimeType, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.MimeType]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.MimeType, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.MimeType, [core.int]),
       [dartx.namedItem]: dart.definiteFunctionType(html$.MimeType, [core.String])
     })
@@ -65857,10 +81014,10 @@
       return html$.MouseEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MouseEvent(type, eventInitDict);
+      return new self.MouseEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MouseEvent(type);
+      return new self.MouseEvent(type);
     }
     get [dartx.altKey]() {
       return this.altKey;
@@ -66062,7 +81219,7 @@
       function override(key, value) {
         if (value != null) html$.MutationObserver._add(parsedOptions, core.String._check(key), value);
       }
-      dart.fn(override, dynamicAnddynamicTodynamic$());
+      dart.fn(override, dynamicAnddynamicToNull());
       override('childList', childList);
       override('attributes', attributes);
       override('characterData', characterData);
@@ -66088,7 +81245,7 @@
     }
     static new(callback) {
       0;
-      return new (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver)(_js_helper.convertDartClosureToJS(html$._wrapZoneBinaryCallback)(html$._wrapBinaryZone(dart.dynamic, dart.dynamic, dart.dynamic)(callback), 2));
+      return new (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver)(_js_helper.convertDartClosureToJS(_wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void())(html$._wrapBinaryZone(ListOfMutationRecord(), html$.MutationObserver, dart.void)(callback), 2));
     }
   };
   dart.setSignature(html$.MutationObserver, {
@@ -66228,9 +81385,9 @@
       this[_ensureGetUserMedia]();
       this[_getUserMedia](html_common.convertDartToNative_SerializedScriptValue(options), dart.fn(stream => {
         completer.complete(stream);
-      }, MediaStreamTovoid()), dart.fn(error => {
+      }, MediaStreamToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, NavigatorUserMediaErrorTovoid()));
+      }, NavigatorUserMediaErrorToNull()));
       return completer.future;
     }
     [_ensureGetUserMedia]() {
@@ -66720,7 +81877,7 @@
       this[_this][_removeChild](node);
       return true;
     }
-    [_filter$](test, removeMatching) {
+    [_filter$0](test, removeMatching) {
       let child = this[_this][dartx.firstChild];
       while (child != null) {
         let nextChild = child[dartx.nextNode];
@@ -66731,10 +81888,10 @@
       }
     }
     removeWhere(test) {
-      this[_filter$](test, true);
+      this[_filter$0](test, true);
     }
     retainWhere(test) {
-      this[_filter$](test, false);
+      this[_filter$0](test, false);
     }
     clear() {
       this[_this][_clearChildren]();
@@ -66781,29 +81938,13 @@
     constructors: () => ({new: dart.definiteFunctionType(html$._ChildNodeListLazy, [html$.Node])}),
     fields: () => ({[_this]: html$.Node}),
     getters: () => ({
-      first: dart.definiteFunctionType(html$.Node, []),
-      last: dart.definiteFunctionType(html$.Node, []),
-      single: dart.definiteFunctionType(html$.Node, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(html$.Node), []),
       length: dart.definiteFunctionType(core.int, []),
       rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
-      add: dart.definiteFunctionType(dart.void, [html$.Node]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfNode()]),
-      insert: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfNode()]),
-      setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfNode()]),
-      removeLast: dart.definiteFunctionType(html$.Node, []),
-      removeAt: dart.definiteFunctionType(html$.Node, [core.int]),
-      [_filter$]: dart.definiteFunctionType(dart.void, [NodeTobool(), core.bool]),
-      removeWhere: dart.definiteFunctionType(dart.void, [NodeTobool()]),
-      retainWhere: dart.definiteFunctionType(dart.void, [NodeTobool()]),
+      [_filter$0]: dart.definiteFunctionType(dart.void, [NodeTobool(), core.bool]),
       _set: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      sort: dart.definiteFunctionType(dart.void, [], [ComparatorOfNode()]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfNode()], [core.int]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html$.Node]),
       _get: dart.definiteFunctionType(html$.Node, [core.int])
     })
   });
@@ -66980,17 +82121,11 @@
   html$.NodeList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
   dart.setSignature(html$.NodeList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.NodeList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Node, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Node, [core.int]),
       [_item]: dart.definiteFunctionType(html$.Node, [core.int])
     })
   });
@@ -67079,10 +82214,10 @@
       return html$.Notification._create_2(title);
     }
     static _create_1(title, options) {
-      return new Notification(title, options);
+      return new self.Notification(title, options);
     }
     static _create_2(title) {
-      return new Notification(title);
+      return new self.Notification(title);
     }
     static get supported() {
       return !!window.Notification;
@@ -67124,7 +82259,7 @@
       let completer = CompleterOfString().new();
       html$.Notification._requestPermission(dart.fn(value => {
         completer.complete(value);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     get [dartx.onClick]() {
@@ -67211,10 +82346,10 @@
       return html$.NotificationEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new NotificationEvent(type, eventInitDict);
+      return new self.NotificationEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new NotificationEvent(type);
+      return new self.NotificationEvent(type);
     }
     get [dartx.notification]() {
       return this.notification;
@@ -67711,10 +82846,10 @@
       return html$.PageTransitionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PageTransitionEvent(type, eventInitDict);
+      return new self.PageTransitionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PageTransitionEvent(type);
+      return new self.PageTransitionEvent(type);
     }
     get [dartx.persisted]() {
       return this.persisted;
@@ -67829,13 +82964,13 @@
       return html$.PasswordCredential._create_3(id, password);
     }
     static _create_1(id, password, name, iconURL) {
-      return new PasswordCredential(id, password, name, iconURL);
+      return new self.PasswordCredential(id, password, name, iconURL);
     }
     static _create_2(id, password, name) {
-      return new PasswordCredential(id, password, name);
+      return new self.PasswordCredential(id, password, name);
     }
     static _create_3(id, password) {
-      return new PasswordCredential(id, password);
+      return new self.PasswordCredential(id, password);
     }
     get [dartx.formData]() {
       return this.formData;
@@ -68385,7 +83520,7 @@
       return html$.PeriodicSyncEvent._create_1(type, init_1);
     }
     static _create_1(type, init) {
-      return new PeriodicSyncEvent(type, init);
+      return new self.PeriodicSyncEvent(type, init);
     }
     get [dartx.registration]() {
       return this.registration;
@@ -68671,17 +83806,11 @@
   html$.PluginArray[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfPlugin()];
   dart.setSignature(html$.PluginArray, {
     constructors: () => ({_: dart.definiteFunctionType(html$.PluginArray, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Plugin, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Plugin, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Plugin, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Plugin, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Plugin]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Plugin, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Plugin, [core.int]),
       [dartx.namedItem]: dart.definiteFunctionType(html$.Plugin, [core.String]),
       [dartx.refresh]: dart.definiteFunctionType(dart.void, [core.bool])
@@ -68754,10 +83883,10 @@
       return html$.PointerEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PointerEvent(type, eventInitDict);
+      return new self.PointerEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PointerEvent(type);
+      return new self.PointerEvent(type);
     }
     get [dartx.height]() {
       return this.height;
@@ -68822,10 +83951,10 @@
       return html$.PopStateEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PopStateEvent(type, eventInitDict);
+      return new self.PopStateEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PopStateEvent(type);
+      return new self.PopStateEvent(type);
     }
     get [dartx.state]() {
       return html_common.convertNativeToDart_SerializedScriptValue(this[_get_state]);
@@ -69142,10 +84271,10 @@
       return html$.ProgressEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ProgressEvent(type, eventInitDict);
+      return new self.ProgressEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ProgressEvent(type);
+      return new self.ProgressEvent(type);
     }
     get [dartx.lengthComputable]() {
       return this.lengthComputable;
@@ -69191,10 +84320,10 @@
       return html$.PromiseRejectionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PromiseRejectionEvent(type, eventInitDict);
+      return new self.PromiseRejectionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PromiseRejectionEvent(type);
+      return new self.PromiseRejectionEvent(type);
     }
     get [dartx.promise]() {
       return this.promise;
@@ -69235,10 +84364,10 @@
       return html$.PushEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PushEvent(type, eventInitDict);
+      return new self.PushEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PushEvent(type);
+      return new self.PushEvent(type);
     }
     get [dartx.data]() {
       return this.data;
@@ -69329,7 +84458,7 @@
       return html$.PushMessageData._create_1(message);
     }
     static _create_1(message) {
-      return new PushMessageData(message);
+      return new self.PushMessageData(message);
     }
     [dartx.arrayBuffer](...args) {
       return this.arrayBuffer.apply(this, args);
@@ -69726,10 +84855,10 @@
       return html$.RelatedEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new RelatedEvent(type, eventInitDict);
+      return new self.RelatedEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new RelatedEvent(type);
+      return new self.RelatedEvent(type);
     }
     get [dartx.relatedTarget]() {
       return html$._convertNativeToDart_EventTarget(this[_get_relatedTarget]);
@@ -70145,9 +85274,9 @@
       let completer = CompleterOfRtcSessionDescription().new();
       this[_createOffer](dart.fn(value => {
         completer.complete(value);
-      }, RtcSessionDescriptionTovoid()), dart.fn(error => {
+      }, RtcSessionDescriptionToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()), mediaConstraints);
+      }, StringToNull()), mediaConstraints);
       return completer.future;
     }
     [dartx.createAnswer](mediaConstraints) {
@@ -70155,16 +85284,16 @@
       let completer = CompleterOfRtcSessionDescription().new();
       this[_createAnswer](dart.fn(value => {
         completer.complete(value);
-      }, RtcSessionDescriptionTovoid()), dart.fn(error => {
+      }, RtcSessionDescriptionToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()), mediaConstraints);
+      }, StringToNull()), mediaConstraints);
       return completer.future;
     }
     [dartx.getStats](selector) {
       let completer = CompleterOfRtcStatsResponse().new();
       this[_getStats](dart.fn(value => {
         completer.complete(value);
-      }, RtcStatsResponseTovoid()), selector);
+      }, RtcStatsResponseToNull()), selector);
       return completer.future;
     }
     static _() {
@@ -70280,9 +85409,9 @@
       let completer = async.Completer.new();
       this[_setLocalDescription](description, dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     [_setRemoteDescription](...args) {
@@ -70292,9 +85421,9 @@
       let completer = async.Completer.new();
       this[_setRemoteDescription](description, dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     [dartx.updateIce](configuration, mediaConstraints) {
@@ -70798,31 +85927,31 @@
       return html$.ScrollState._create_9();
     }
     static _create_1(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding);
     }
     static _create_2(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning);
     }
     static _create_3(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase);
     }
     static _create_4(deltaX, deltaY, deltaGranularity, velocityX, velocityY) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY);
     }
     static _create_5(deltaX, deltaY, deltaGranularity, velocityX) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX);
     }
     static _create_6(deltaX, deltaY, deltaGranularity) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity);
     }
     static _create_7(deltaX, deltaY) {
-      return new ScrollState(deltaX, deltaY);
+      return new self.ScrollState(deltaX, deltaY);
     }
     static _create_8(deltaX) {
-      return new ScrollState(deltaX);
+      return new self.ScrollState(deltaX);
     }
     static _create_9() {
-      return new ScrollState();
+      return new self.ScrollState();
     }
     get [dartx.deltaGranularity]() {
       return this.deltaGranularity;
@@ -70915,10 +86044,10 @@
       return html$.SecurityPolicyViolationEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new SecurityPolicyViolationEvent(type, eventInitDict);
+      return new self.SecurityPolicyViolationEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new SecurityPolicyViolationEvent(type);
+      return new self.SecurityPolicyViolationEvent(type);
     }
     get [dartx.blockedUri]() {
       return this.blockedURI;
@@ -71456,10 +86585,10 @@
       return html$.ServicePortConnectEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ServicePortConnectEvent(type, eventInitDict);
+      return new self.ServicePortConnectEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ServicePortConnectEvent(type);
+      return new self.ServicePortConnectEvent(type);
     }
     get [dartx.origin]() {
       return this.origin;
@@ -71622,10 +86751,10 @@
       return html$.ServiceWorkerMessageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ServiceWorkerMessageEvent(type, eventInitDict);
+      return new self.ServiceWorkerMessageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ServiceWorkerMessageEvent(type);
+      return new self.ServiceWorkerMessageEvent(type);
     }
     get [dartx.lastEventId]() {
       return this.lastEventId;
@@ -71937,10 +87066,10 @@
       return html$.SharedWorker._create_2(scriptURL);
     }
     static _create_1(scriptURL, name) {
-      return new SharedWorker(scriptURL, name);
+      return new self.SharedWorker(scriptURL, name);
     }
     static _create_2(scriptURL) {
-      return new SharedWorker(scriptURL);
+      return new self.SharedWorker(scriptURL);
     }
     get [dartx.port]() {
       return this.port;
@@ -72153,17 +87282,11 @@
   html$.SourceBufferList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfSourceBuffer()];
   dart.setSignature(html$.SourceBufferList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.SourceBufferList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.SourceBuffer, []),
-      [dartx.last]: dart.definiteFunctionType(html$.SourceBuffer, []),
-      [dartx.single]: dart.definiteFunctionType(html$.SourceBuffer, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.SourceBuffer, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.SourceBuffer]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.SourceBuffer, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.SourceBuffer, [core.int])
     })
   });
@@ -72302,7 +87425,7 @@
       return html$.SpeechGrammar._create_1();
     }
     static _create_1() {
-      return new SpeechGrammar();
+      return new self.SpeechGrammar();
     }
     get [dartx.src]() {
       return this.src;
@@ -72351,7 +87474,7 @@
       return html$.SpeechGrammarList._create_1();
     }
     static _create_1() {
-      return new SpeechGrammarList();
+      return new self.SpeechGrammarList();
     }
     get [dartx.length]() {
       return this.length;
@@ -72407,17 +87530,11 @@
       _: dart.definiteFunctionType(html$.SpeechGrammarList, []),
       new: dart.definiteFunctionType(html$.SpeechGrammarList, [])
     }),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.SpeechGrammar, []),
-      [dartx.last]: dart.definiteFunctionType(html$.SpeechGrammar, []),
-      [dartx.single]: dart.definiteFunctionType(html$.SpeechGrammar, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.SpeechGrammar, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.SpeechGrammar]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.SpeechGrammar, [core.int]),
       [dartx.addFromString]: dart.definiteFunctionType(dart.void, [core.String], [core.num]),
       [dartx.addFromUri]: dart.definiteFunctionType(dart.void, [core.String], [core.num]),
       [dartx.item]: dart.definiteFunctionType(html$.SpeechGrammar, [core.int])
@@ -72667,10 +87784,10 @@
       return html$.SpeechRecognitionError._create_2(type);
     }
     static _create_1(type, initDict) {
-      return new SpeechRecognitionError(type, initDict);
+      return new self.SpeechRecognitionError(type, initDict);
     }
     static _create_2(type) {
-      return new SpeechRecognitionError(type);
+      return new self.SpeechRecognitionError(type);
     }
     get [dartx.error]() {
       return this.error;
@@ -72714,10 +87831,10 @@
       return html$.SpeechRecognitionEvent._create_2(type);
     }
     static _create_1(type, initDict) {
-      return new SpeechRecognitionEvent(type, initDict);
+      return new self.SpeechRecognitionEvent(type, initDict);
     }
     static _create_2(type) {
-      return new SpeechRecognitionEvent(type);
+      return new self.SpeechRecognitionEvent(type);
     }
     get [dartx.emma]() {
       return this.emma;
@@ -72893,10 +88010,10 @@
       return html$.SpeechSynthesisUtterance._create_2();
     }
     static _create_1(text) {
-      return new SpeechSynthesisUtterance(text);
+      return new self.SpeechSynthesisUtterance(text);
     }
     static _create_2() {
-      return new SpeechSynthesisUtterance();
+      return new self.SpeechSynthesisUtterance();
     }
     get [dartx.lang]() {
       return this.lang;
@@ -73102,7 +88219,7 @@
   const _setItem = Symbol('_setItem');
   const _removeItem = Symbol('_removeItem');
   const _key = Symbol('_key');
-  const _length$2 = Symbol('_length');
+  const _length$3 = Symbol('_length');
   const __delete__ = Symbol('__delete__');
   dart.defineExtensionNames([
     'addAll',
@@ -73124,7 +88241,7 @@
     [dartx.addAll](other) {
       other[dartx.forEach](dart.fn((k, v) => {
         this[dartx._set](k, v);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     [dartx.containsValue](value) {
       return this[dartx.values][dartx.any](dart.fn(e => dart.equals(e, value), StringTobool$()));
@@ -73169,7 +88286,7 @@
       return values;
     }
     get [dartx.length]() {
-      return this[_length$2];
+      return this[_length$3];
     }
     get [dartx.isEmpty]() {
       return this[_key](0) == null;
@@ -73180,7 +88297,7 @@
     static _() {
       dart.throw(new core.UnsupportedError("Not supported"));
     }
-    get [_length$2]() {
+    get [_length$3]() {
       return this.length;
     }
     [__delete__](...args) {
@@ -73211,7 +88328,7 @@
   html$.Storage[dart.implements] = () => [MapOfString$String()];
   dart.setSignature(html$.Storage, {
     constructors: () => ({_: dart.definiteFunctionType(html$.Storage, [])}),
-    fields: () => ({[_length$2]: core.int}),
+    fields: () => ({[_length$3]: core.int}),
     getters: () => ({
       [dartx.keys]: dart.definiteFunctionType(core.Iterable$(core.String), []),
       [dartx.values]: dart.definiteFunctionType(core.Iterable$(core.String), []),
@@ -73271,10 +88388,10 @@
       return html$.StorageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new StorageEvent(type, eventInitDict);
+      return new self.StorageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new StorageEvent(type);
+      return new self.StorageEvent(type);
     }
     get [dartx.key]() {
       return this.key;
@@ -73459,7 +88576,7 @@
       return html$.SyncEvent._create_1(type, init_1);
     }
     static _create_1(type, init) {
-      return new SyncEvent(type, init);
+      return new self.SyncEvent(type, init);
     }
     get [dartx.registration]() {
       return this.registration;
@@ -74615,17 +89732,11 @@
   html$.TextTrackCueList[dart.implements] = () => [ListOfTextTrackCue(), _js_helper.JavaScriptIndexingBehavior];
   dart.setSignature(html$.TextTrackCueList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.TextTrackCueList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.TextTrackCue, []),
-      [dartx.last]: dart.definiteFunctionType(html$.TextTrackCue, []),
-      [dartx.single]: dart.definiteFunctionType(html$.TextTrackCue, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.TextTrackCue, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.TextTrackCue]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.TextTrackCue, [core.int]),
       [dartx.getCueById]: dart.definiteFunctionType(html$.TextTrackCue, [core.String]),
       [dartx.item]: dart.definiteFunctionType(html$.TextTrackCue, [core.int])
     })
@@ -74705,9 +89816,6 @@
     constructors: () => ({_: dart.definiteFunctionType(html$.TextTrackList, [])}),
     getters: () => ({
       [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.TextTrack, []),
-      [dartx.last]: dart.definiteFunctionType(html$.TextTrack, []),
-      [dartx.single]: dart.definiteFunctionType(html$.TextTrack, []),
       [dartx.onAddTrack]: dart.definiteFunctionType(async.Stream$(html$.TrackEvent), []),
       [dartx.onChange]: dart.definiteFunctionType(async.Stream$(html$.Event), [])
     }),
@@ -74715,7 +89823,6 @@
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.TextTrack, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.TextTrack]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.TextTrack, [core.int]),
       [dartx.getTrackById]: dart.definiteFunctionType(html$.TextTrack, [core.String]),
       [dartx.item]: dart.definiteFunctionType(html$.TextTrack, [core.int])
     }),
@@ -75066,17 +90173,11 @@
       new: dart.definiteFunctionType(html$.TouchList, []),
       _: dart.definiteFunctionType(html$.TouchList, [])
     }),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Touch, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Touch, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Touch, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Touch, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Touch]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Touch, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Touch, [core.int])
     }),
     sgetters: () => ({supported: dart.definiteFunctionType(core.bool, [])})
@@ -75103,10 +90204,10 @@
       return html$.TrackDefault._create_2(type, language, label, kinds_1);
     }
     static _create_1(type, language, label, kinds, byteStreamTrackID) {
-      return new TrackDefault(type, language, label, kinds, byteStreamTrackID);
+      return new self.TrackDefault(type, language, label, kinds, byteStreamTrackID);
     }
     static _create_2(type, language, label, kinds) {
-      return new TrackDefault(type, language, label, kinds);
+      return new self.TrackDefault(type, language, label, kinds);
     }
     get [dartx.byteStreamTrackID]() {
       return this.byteStreamTrackID;
@@ -75159,10 +90260,10 @@
       return html$.TrackDefaultList._create_2();
     }
     static _create_1(trackDefaults) {
-      return new TrackDefaultList(trackDefaults);
+      return new self.TrackDefaultList(trackDefaults);
     }
     static _create_2() {
-      return new TrackDefaultList();
+      return new self.TrackDefaultList();
     }
     get [dartx.length]() {
       return this.length;
@@ -75296,10 +90397,10 @@
       return html$.TrackEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new TrackEvent(type, eventInitDict);
+      return new self.TrackEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new TrackEvent(type);
+      return new self.TrackEvent(type);
     }
     get [dartx.track]() {
       return this.track;
@@ -75336,10 +90437,10 @@
       return html$.TransitionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new TransitionEvent(type, eventInitDict);
+      return new self.TransitionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new TransitionEvent(type);
+      return new self.TransitionEvent(type);
     }
     get [dartx.elapsedTime]() {
       return this.elapsedTime;
@@ -75910,10 +91011,10 @@
       return html$.VRFieldOfView._create_2();
     }
     static _create_1(fov) {
-      return new VRFieldOfView(fov);
+      return new self.VRFieldOfView(fov);
     }
     static _create_2() {
-      return new VRFieldOfView();
+      return new self.VRFieldOfView();
     }
     get [dartx.downDegrees]() {
       return this.downDegrees;
@@ -76531,10 +91632,10 @@
       return html$.WebSocket._create_2(url);
     }
     static _create_1(url, protocols) {
-      return new WebSocket(url, protocols);
+      return new self.WebSocket(url, protocols);
     }
     static _create_2(url) {
-      return new WebSocket(url);
+      return new self.WebSocket(url);
     }
     static get supported() {
       return typeof window.WebSocket != "undefined";
@@ -76692,7 +91793,7 @@
       if (view == null) {
         view = html$.window;
       }
-      return new WheelEvent(type, html_common.convertDartToNative_Dictionary(options));
+      return new self.WheelEvent(type, html_common.convertDartToNative_Dictionary(options));
     }
     static _(type, eventInitDict) {
       if (eventInitDict === void 0) eventInitDict = null;
@@ -76703,10 +91804,10 @@
       return html$.WheelEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new WheelEvent(type, eventInitDict);
+      return new self.WheelEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new WheelEvent(type);
+      return new self.WheelEvent(type);
     }
     get [_deltaX]() {
       return this.deltaX;
@@ -76976,7 +92077,7 @@
       let completer = CompleterOfnum().sync();
       this[dartx.requestAnimationFrame](dart.fn(time => {
         completer.complete(time);
-      }, numTovoid()));
+      }, numToNull()));
       return completer.future;
     }
     get [dartx.document]() {
@@ -77431,9 +92532,9 @@
       let completer = CompleterOfFileSystem().new();
       this[__requestFileSystem](type, size, dart.fn(value => {
         completer.complete(value);
-      }, FileSystemTovoid()), dart.fn(error => {
+      }, FileSystemToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [_resolveLocalFileSystemUrl](...args) {
@@ -77443,9 +92544,9 @@
       let completer = CompleterOfEntry().new();
       this[_resolveLocalFileSystemUrl](url, dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), dart.fn(error => {
+      }, EntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.atob](...args) {
@@ -78130,12 +93231,12 @@
     }
     forTarget(e, opts) {
       let useCapture = opts && 'useCapture' in opts ? opts.useCapture : false;
-      let stream = new (_EventStreamOfEvent())(e, this[_eventType], useCapture);
+      let stream = new (_EventStreamOfBeforeUnloadEvent())(e, this[_eventType], useCapture);
       let controller = StreamControllerOfBeforeUnloadEvent().new({sync: true});
       stream.listen(dart.fn(event => {
         let wrapped = new html$._BeforeUnloadEvent(event);
         controller.add(wrapped);
-      }, EventTovoid$()));
+      }, BeforeUnloadEventToNull()));
       return controller.stream;
     }
     getEventType(target) {
@@ -78299,7 +93400,7 @@
       return html$.Worker._create_1(scriptUrl);
     }
     static _create_1(scriptUrl) {
-      return new Worker(scriptUrl);
+      return new self.Worker(scriptUrl);
     }
     static get supported() {
       return typeof window.Worker != "undefined";
@@ -78454,7 +93555,7 @@
       return html$.XPathEvaluator._create_1();
     }
     static _create_1() {
-      return new XPathEvaluator();
+      return new self.XPathEvaluator();
     }
     [dartx.createExpression](...args) {
       return this.createExpression.apply(this, args);
@@ -78950,17 +94051,11 @@
   html$._ClientRectList[dart.implements] = () => [ListOfRectangleOfnum()];
   dart.setSignature(html$._ClientRectList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._ClientRectList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(math.Rectangle$(core.num), []),
-      [dartx.last]: dart.definiteFunctionType(math.Rectangle$(core.num), []),
-      [dartx.single]: dart.definiteFunctionType(math.Rectangle$(core.num), [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, RectangleOfnum()]),
-      [dartx.elementAt]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
       [__getter__]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
       [dartx.item]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int])
     })
@@ -79027,17 +94122,11 @@
   html$._CssRuleList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfCssRule()];
   dart.setSignature(html$._CssRuleList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._CssRuleList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.CssRule, []),
-      [dartx.last]: dart.definiteFunctionType(html$.CssRule, []),
-      [dartx.single]: dart.definiteFunctionType(html$.CssRule, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.CssRule, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.CssRule]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.CssRule, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.CssRule, [core.int])
     })
   });
@@ -79280,17 +94369,11 @@
   html$._GamepadList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfGamepad()];
   dart.setSignature(html$._GamepadList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._GamepadList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Gamepad, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Gamepad, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Gamepad, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Gamepad, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Gamepad]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Gamepad, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Gamepad, [core.int])
     })
   });
@@ -79489,17 +94572,11 @@
   html$._NamedNodeMap[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
   dart.setSignature(html$._NamedNodeMap, {
     constructors: () => ({_: dart.definiteFunctionType(html$._NamedNodeMap, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Node, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx.getNamedItem]: dart.definiteFunctionType(html$._Attr, [core.String]),
       [dartx.getNamedItemNS]: dart.definiteFunctionType(html$._Attr, [core.String, core.String]),
       [dartx.item]: dart.definiteFunctionType(html$._Attr, [core.int]),
@@ -79699,17 +94776,11 @@
   html$._SpeechRecognitionResultList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfSpeechRecognitionResult()];
   dart.setSignature(html$._SpeechRecognitionResultList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._SpeechRecognitionResultList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.SpeechRecognitionResult, []),
-      [dartx.last]: dart.definiteFunctionType(html$.SpeechRecognitionResult, []),
-      [dartx.single]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.SpeechRecognitionResult]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [core.int])
     })
   });
@@ -79777,17 +94848,11 @@
   html$._StyleSheetList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfStyleSheet()];
   dart.setSignature(html$._StyleSheetList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._StyleSheetList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.StyleSheet, []),
-      [dartx.last]: dart.definiteFunctionType(html$.StyleSheet, []),
-      [dartx.single]: dart.definiteFunctionType(html$.StyleSheet, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.StyleSheet, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.StyleSheet]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.StyleSheet, [core.int]),
       [__getter__]: dart.definiteFunctionType(html$.CssStyleSheet, [core.String]),
       [dartx.item]: dart.definiteFunctionType(html$.StyleSheet, [core.int])
     })
@@ -79877,7 +94942,7 @@
     addAll(other) {
       other[dartx.forEach](dart.fn((k, v) => {
         this._set(k, v);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     containsValue(value) {
       for (let v of this.values) {
@@ -80064,7 +95129,7 @@
     addAll(other) {
       other[dartx.forEach](dart.fn((k, v) => {
         this._set(k, v);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     containsValue(value) {
       return this.values[dartx.any](dart.fn(v => dart.equals(v, value), StringTobool$()));
@@ -80095,7 +95160,7 @@
         if (dart.test(this[_matches](key))) {
           f(this[_strip](key), value);
         }
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     get keys() {
       let keys = JSArrayOfString().of([]);
@@ -80103,7 +95168,7 @@
         if (dart.test(this[_matches](key))) {
           keys[dartx.add](this[_strip](key));
         }
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
       return keys;
     }
     get values() {
@@ -80112,7 +95177,7 @@
         if (dart.test(this[_matches](key))) {
           values[dartx.add](value);
         }
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
       return values;
     }
     get length() {
@@ -81000,43 +96065,43 @@
   const _unit = Symbol('_unit');
   html$.Dimension = class Dimension extends core.Object {
     percent(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = '%';
     }
     px(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'px';
     }
     pc(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'pc';
     }
     pt(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'pt';
     }
     inch(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'in';
     }
     cm(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'cm';
     }
     mm(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'mm';
     }
     em(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'em';
     }
     ex(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'ex';
     }
     css(cssValue) {
-      this[_value$1] = null;
+      this[_value$2] = null;
       this[_unit] = null;
       if (cssValue == '') cssValue = '0px';
       if (dart.test(cssValue[dartx.endsWith]('%'))) {
@@ -81045,16 +96110,16 @@
         this[_unit] = cssValue[dartx.substring](dart.notNull(cssValue[dartx.length]) - 2);
       }
       if (dart.test(cssValue[dartx.contains]('.'))) {
-        this[_value$1] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+        this[_value$2] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
       } else {
-        this[_value$1] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+        this[_value$2] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
       }
     }
     toString() {
-      return dart.str`${this[_value$1]}${this[_unit]}`;
+      return dart.str`${this[_value$2]}${this[_unit]}`;
     }
     get value() {
-      return this[_value$1];
+      return this[_value$2];
     }
   };
   dart.defineNamedConstructor(html$.Dimension, 'percent');
@@ -81081,7 +96146,7 @@
       css: dart.definiteFunctionType(html$.Dimension, [core.String])
     }),
     fields: () => ({
-      [_value$1]: core.num,
+      [_value$2]: core.num,
       [_unit]: core.String
     }),
     getters: () => ({value: dart.definiteFunctionType(core.num, [])})
@@ -81133,7 +96198,7 @@
     return ElementStream;
   });
   html$.ElementStream = ElementStream();
-  const _target$ = Symbol('_target');
+  const _target$0 = Symbol('_target');
   const _useCapture = Symbol('_useCapture');
   html$._EventStream$ = dart.generic(T => {
     let _EventStreamSubscriptionOfT = () => (_EventStreamSubscriptionOfT = dart.constFn(html$._EventStreamSubscription$(T)))();
@@ -81142,7 +96207,7 @@
     let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     class _EventStream extends async.Stream$(T) {
       new(target, eventType, useCapture) {
-        this[_target$] = target;
+        this[_target$0] = target;
         this[_eventType] = eventType;
         this[_useCapture] = useCapture;
         super.new();
@@ -81159,20 +96224,17 @@
         let onError = opts && 'onError' in opts ? opts.onError : null;
         let onDone = opts && 'onDone' in opts ? opts.onDone : null;
         let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
-        return new (_EventStreamSubscriptionOfT())(this[_target$], this[_eventType], onData, this[_useCapture]);
+        return new (_EventStreamSubscriptionOfT())(this[_target$0], this[_eventType], onData, this[_useCapture]);
       }
     }
     dart.setSignature(_EventStream, {
       constructors: () => ({new: dart.definiteFunctionType(html$._EventStream$(T), [html$.EventTarget, core.String, core.bool])}),
       fields: () => ({
-        [_target$]: html$.EventTarget,
+        [_target$0]: html$.EventTarget,
         [_eventType]: core.String,
         [_useCapture]: core.bool
       }),
-      methods: () => ({
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
-        listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})
-      })
+      methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
     });
     return _EventStream;
   });
@@ -81199,7 +96261,7 @@
         }, TToT()));
       }
       capture(onData) {
-        return new (_EventStreamSubscriptionOfT())(this[_target$], this[_eventType], onData, true);
+        return new (_EventStreamSubscriptionOfT())(this[_target$0], this[_eventType], onData, true);
       }
     }
     _ElementEventStreamImpl[dart.implements] = () => [ElementStreamOfT()];
@@ -81273,8 +96335,7 @@
       methods: () => ({
         matches: dart.definiteFunctionType(async.Stream$(T), [core.String]),
         listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
-        capture: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()]),
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()})
+        capture: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()])
       })
     });
     return _ElementListEventStreamImpl;
@@ -81285,8 +96346,8 @@
     return _EventListener;
   });
   html$._EventListener = _EventListener();
-  const _onData$ = Symbol('_onData');
-  const _pauseCount$ = Symbol('_pauseCount');
+  const _onData$0 = Symbol('_onData');
+  const _pauseCount$0 = Symbol('_pauseCount');
   const _tryResume = Symbol('_tryResume');
   const _canceled = Symbol('_canceled');
   const _unlisten = Symbol('_unlisten');
@@ -81294,29 +96355,29 @@
     let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     class _EventStreamSubscription extends async.StreamSubscription$(T) {
       new(target, eventType, onData, useCapture) {
-        this[_target$] = target;
+        this[_target$0] = target;
         this[_eventType] = eventType;
         this[_useCapture] = useCapture;
-        this[_onData$] = html$._wrapZone(html$.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(onData));
-        this[_pauseCount$] = 0;
+        this[_onData$0] = onData == null ? null : html$._wrapZone(html$.Event, dart.dynamic)(dart.fn(e => dart.dcall(onData, e), EventTodynamic()));
+        this[_pauseCount$0] = 0;
         this[_tryResume]();
       }
       cancel() {
         if (dart.test(this[_canceled])) return null;
         this[_unlisten]();
-        this[_target$] = null;
-        this[_onData$] = null;
+        this[_target$0] = null;
+        this[_onData$0] = null;
         return null;
       }
       get [_canceled]() {
-        return this[_target$] == null;
+        return this[_target$0] == null;
       }
       onData(handleData) {
         if (dart.test(this[_canceled])) {
           dart.throw(new core.StateError("Subscription has been canceled."));
         }
         this[_unlisten]();
-        this[_onData$] = html$._wrapZone(html$.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(handleData));
+        this[_onData$0] = html$._wrapZone(html$.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(handleData));
         this[_tryResume]();
       }
       onError(handleError) {}
@@ -81324,43 +96385,45 @@
       pause(resumeSignal) {
         if (resumeSignal === void 0) resumeSignal = null;
         if (dart.test(this[_canceled])) return;
-        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) + 1;
+        this[_pauseCount$0] = dart.notNull(this[_pauseCount$0]) + 1;
         this[_unlisten]();
         if (resumeSignal != null) {
           resumeSignal.whenComplete(dart.bind(this, 'resume'));
         }
       }
       get isPaused() {
-        return dart.notNull(this[_pauseCount$]) > 0;
+        return dart.notNull(this[_pauseCount$0]) > 0;
       }
       resume() {
         if (dart.test(this[_canceled]) || !dart.test(this.isPaused)) return;
-        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) - 1;
+        this[_pauseCount$0] = dart.notNull(this[_pauseCount$0]) - 1;
         this[_tryResume]();
       }
       [_tryResume]() {
-        if (this[_onData$] != null && !dart.test(this.isPaused)) {
-          this[_target$][dartx.addEventListener](this[_eventType], this[_onData$], this[_useCapture]);
+        if (this[_onData$0] != null && !dart.test(this.isPaused)) {
+          this[_target$0][dartx.addEventListener](this[_eventType], this[_onData$0], this[_useCapture]);
         }
       }
       [_unlisten]() {
-        if (this[_onData$] != null) {
-          this[_target$][dartx.removeEventListener](this[_eventType], this[_onData$], this[_useCapture]);
+        if (this[_onData$0] != null) {
+          this[_target$0][dartx.removeEventListener](this[_eventType], this[_onData$0], this[_useCapture]);
         }
       }
-      asFuture(futureValue) {
-        if (futureValue === void 0) futureValue = null;
-        let completer = async.Completer.new();
-        return completer.future;
+      asFuture(E) {
+        return futureValue => {
+          if (futureValue === void 0) futureValue = null;
+          let completer = async.Completer$(E).new();
+          return completer.future;
+        };
       }
     }
     dart.setSignature(_EventStreamSubscription, {
       constructors: () => ({new: dart.definiteFunctionType(html$._EventStreamSubscription$(T), [html$.EventTarget, core.String, TTovoid(), core.bool])}),
       fields: () => ({
-        [_pauseCount$]: core.int,
-        [_target$]: html$.EventTarget,
+        [_pauseCount$0]: core.int,
+        [_target$0]: html$.EventTarget,
         [_eventType]: core.String,
-        [_onData$]: html$.EventListener,
+        [_onData$0]: html$.EventListener,
         [_useCapture]: core.bool
       }),
       getters: () => ({
@@ -81376,7 +96439,7 @@
         resume: dart.definiteFunctionType(dart.void, []),
         [_tryResume]: dart.definiteFunctionType(dart.void, []),
         [_unlisten]: dart.definiteFunctionType(dart.void, []),
-        asFuture: dart.definiteFunctionType(async.Future, [], [dart.dynamic])
+        asFuture: dart.definiteFunctionType(E => [async.Future$(E), [], [E]])
       })
     });
     return _EventStreamSubscription;
@@ -81391,7 +96454,7 @@
   });
   html$.CustomStream = CustomStream();
   const _streamController = Symbol('_streamController');
-  const _type = Symbol('_type');
+  const _type$ = Symbol('_type');
   html$._CustomEventStreamImpl$ = dart.generic(T => {
     let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
     let CustomStreamOfT = () => (CustomStreamOfT = dart.constFn(html$.CustomStream$(T)))();
@@ -81401,9 +96464,9 @@
     class _CustomEventStreamImpl extends async.Stream$(T) {
       new(type) {
         this[_streamController] = null;
-        this[_type] = null;
+        this[_type$] = null;
         super.new();
-        this[_type] = type;
+        this[_type$] = type;
         this[_streamController] = StreamControllerOfT().broadcast({sync: true});
       }
       listen(onData, opts) {
@@ -81422,7 +96485,7 @@
       }
       add(event) {
         T._check(event);
-        if (event[dartx.type] == this[_type]) this[_streamController].add(event);
+        if (event[dartx.type] == this[_type$]) this[_streamController].add(event);
       }
     }
     _CustomEventStreamImpl[dart.implements] = () => [CustomStreamOfT()];
@@ -81430,11 +96493,10 @@
       constructors: () => ({new: dart.definiteFunctionType(html$._CustomEventStreamImpl$(T), [core.String])}),
       fields: () => ({
         [_streamController]: StreamControllerOfT(),
-        [_type]: core.String
+        [_type$]: core.String
       }),
       methods: () => ({
         listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
         add: dart.definiteFunctionType(dart.void, [T])
       })
     });
@@ -81703,7 +96765,7 @@
       super.new(type);
     }
     add(event) {
-      if (event.type == this[_type]) {
+      if (event.type == this[_type$]) {
         event.currentTarget[dartx.dispatchEvent](event[_parent$]);
         this[_streamController].add(event);
       }
@@ -81712,11 +96774,10 @@
   dart.addSimpleTypeTests(html$._CustomKeyEventStreamImpl);
   html$._CustomKeyEventStreamImpl[dart.implements] = () => [CustomStreamOfKeyEvent()];
   dart.setSignature(html$._CustomKeyEventStreamImpl, {
-    constructors: () => ({new: dart.definiteFunctionType(html$._CustomKeyEventStreamImpl, [core.String])}),
-    methods: () => ({add: dart.definiteFunctionType(dart.void, [html$.KeyEvent])})
+    constructors: () => ({new: dart.definiteFunctionType(html$._CustomKeyEventStreamImpl, [core.String])})
   });
   const _subscriptions = Symbol('_subscriptions');
-  const _controller$0 = Symbol('_controller');
+  const _controller$1 = Symbol('_controller');
   html$._StreamPool$ = dart.generic(T => {
     let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
     let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
@@ -81725,16 +96786,16 @@
     class _StreamPool extends core.Object {
       broadcast() {
         this[_subscriptions] = MapOfStreamOfT$StreamSubscriptionOfT().new();
-        this[_controller$0] = null;
-        this[_controller$0] = StreamControllerOfT().broadcast({sync: true, onCancel: dart.bind(this, 'close')});
+        this[_controller$1] = null;
+        this[_controller$1] = StreamControllerOfT().broadcast({sync: true, onCancel: dart.bind(this, 'close')});
       }
       get stream() {
-        return this[_controller$0].stream;
+        return this[_controller$1].stream;
       }
       add(stream) {
         StreamOfT()._check(stream);
         if (dart.test(this[_subscriptions][dartx.containsKey](stream))) return;
-        this[_subscriptions][dartx._set](stream, stream.listen(dart.bind(this[_controller$0], 'add'), {onError: dart.bind(this[_controller$0], 'addError'), onDone: dart.fn(() => this.remove(stream), VoidTovoid$())}));
+        this[_subscriptions][dartx._set](stream, stream.listen(dart.bind(this[_controller$1], 'add'), {onError: dart.bind(this[_controller$1], 'addError'), onDone: dart.fn(() => this.remove(stream), VoidTovoid$())}));
       }
       remove(stream) {
         StreamOfT()._check(stream);
@@ -81746,7 +96807,7 @@
           subscription.cancel();
         }
         this[_subscriptions][dartx.clear]();
-        this[_controller$0].close();
+        this[_controller$1].close();
       }
     }
     dart.addTypeTests(_StreamPool);
@@ -81754,7 +96815,7 @@
     dart.setSignature(_StreamPool, {
       constructors: () => ({broadcast: dart.definiteFunctionType(html$._StreamPool$(T), [])}),
       fields: () => ({
-        [_controller$0]: StreamControllerOfT(),
+        [_controller$1]: StreamControllerOfT(),
         [_subscriptions]: MapOfStreamOfT$StreamSubscriptionOfT()
       }),
       getters: () => ({stream: dart.definiteFunctionType(async.Stream$(T), [])}),
@@ -82624,7 +97685,7 @@
   html$._KeyName.DEAD_VOICED_SOUND = "DeadVoicedSound";
   html$._KeyName.DEC_SEMIVOICED_SOUND = "DeadSemivoicedSound";
   html$._KeyName.UNIDENTIFIED = "Unidentified";
-  const _stream$ = Symbol('_stream');
+  const _stream$0 = Symbol('_stream');
   const _keyDownList = Symbol('_keyDownList');
   const _capsLockOn = Symbol('_capsLockOn');
   const _determineKeyCodeForKeypress = Symbol('_determineKeyCodeForKeypress');
@@ -82634,26 +97695,26 @@
   html$._KeyboardEventHandler = class _KeyboardEventHandler extends html$.EventStreamProvider$(html$.KeyEvent) {
     forTarget(e, opts) {
       let useCapture = opts && 'useCapture' in opts ? opts.useCapture : false;
-      let handler = new html$._KeyboardEventHandler.initializeAllEventListeners(this[_type], e);
-      return handler[_stream$];
+      let handler = new html$._KeyboardEventHandler.initializeAllEventListeners(this[_type$], e);
+      return handler[_stream$0];
     }
     new(type) {
       this[_keyDownList] = JSArrayOfKeyEvent().of([]);
-      this[_type] = type;
-      this[_stream$] = new html$._CustomKeyEventStreamImpl('event');
-      this[_target$] = null;
+      this[_type$] = type;
+      this[_stream$0] = new html$._CustomKeyEventStreamImpl('event');
+      this[_target$0] = null;
       super.new(html$._KeyboardEventHandler._EVENT_TYPE);
     }
     initializeAllEventListeners(type, target) {
       this[_keyDownList] = JSArrayOfKeyEvent().of([]);
-      this[_type] = type;
-      this[_target$] = target;
-      this[_stream$] = null;
+      this[_type$] = type;
+      this[_target$0] = target;
+      this[_stream$0] = null;
       super.new(html$._KeyboardEventHandler._EVENT_TYPE);
-      html$.Element.keyDownEvent.forTarget(this[_target$], {useCapture: true}).listen(dart.bind(this, 'processKeyDown'));
-      html$.Element.keyPressEvent.forTarget(this[_target$], {useCapture: true}).listen(dart.bind(this, 'processKeyPress'));
-      html$.Element.keyUpEvent.forTarget(this[_target$], {useCapture: true}).listen(dart.bind(this, 'processKeyUp'));
-      this[_stream$] = new html$._CustomKeyEventStreamImpl(this[_type]);
+      html$.Element.keyDownEvent.forTarget(this[_target$0], {useCapture: true}).listen(dart.bind(this, 'processKeyDown'));
+      html$.Element.keyPressEvent.forTarget(this[_target$0], {useCapture: true}).listen(dart.bind(this, 'processKeyPress'));
+      html$.Element.keyUpEvent.forTarget(this[_target$0], {useCapture: true}).listen(dart.bind(this, 'processKeyUp'));
+      this[_stream$0] = new html$._CustomKeyEventStreamImpl(this[_type$]);
     }
     get [_capsLockOn]() {
       return this[_keyDownList][dartx.any](dart.fn(element => element.keyCode == html$.KeyCode.CAPS_LOCK, KeyEventTobool()));
@@ -82846,7 +97907,7 @@
         this.processKeyPress(e);
       }
       this[_keyDownList][dartx.add](event);
-      this[_stream$].add(event);
+      this[_stream$0].add(event);
     }
     processKeyPress(event) {
       let e = new html$.KeyEvent.wrap(event);
@@ -82864,7 +97925,7 @@
         e[_shadowKeyCode] = html$._KeyboardEventHandler._keyIdentifier[dartx._get](e[_shadowKeyIdentifier]);
       }
       e[_shadowAltKey] = this[_keyDownList][dartx.any](dart.fn(element => element.altKey, KeyEventTobool()));
-      this[_stream$].add(e);
+      this[_stream$0].add(e);
     }
     processKeyUp(event) {
       let e = new html$.KeyEvent.wrap(event);
@@ -82879,7 +97940,7 @@
       } else if (dart.notNull(this[_keyDownList][dartx.length]) > 0) {
         this[_keyDownList][dartx.removeLast]();
       }
-      this[_stream$].add(e);
+      this[_stream$0].add(e);
     }
   };
   dart.addSimpleTypeTests(html$._KeyboardEventHandler);
@@ -82891,9 +97952,9 @@
     }),
     fields: () => ({
       [_keyDownList]: ListOfKeyEvent(),
-      [_type]: core.String,
-      [_target$]: html$.EventTarget,
-      [_stream$]: html$._CustomKeyEventStreamImpl
+      [_type$]: core.String,
+      [_target$0]: html$.EventTarget,
+      [_stream$0]: html$._CustomKeyEventStreamImpl
     }),
     getters: () => ({[_capsLockOn]: dart.definiteFunctionType(core.bool, [])}),
     methods: () => ({
@@ -83049,25 +98110,25 @@
       allowsAttribute: dart.definiteFunctionType(core.bool, [html$.Element, core.String, core.String])
     })
   });
-  let const$53;
-  let const$54;
-  let const$55;
-  let const$56;
-  let const$57;
-  let const$58;
-  let const$59;
-  let const$60;
-  let const$61;
-  let const$62;
+  let const$83;
+  let const$84;
+  let const$85;
+  let const$86;
+  let const$87;
+  let const$88;
+  let const$89;
+  let const$90;
+  let const$91;
+  let const$92;
   html$._SimpleNodeValidator = class _SimpleNodeValidator extends core.Object {
     static allowNavigation(uriPolicy) {
-      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$53 || (const$53 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$54 || (const$54 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$55 || (const$55 = dart.constList(['A::href', 'FORM::action'], core.String))});
+      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$83 || (const$83 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$84 || (const$84 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$85 || (const$85 = dart.constList(['A::href', 'FORM::action'], core.String))});
     }
     static allowImages(uriPolicy) {
-      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$56 || (const$56 = dart.constList(['IMG'], core.String)), allowedAttributes: const$57 || (const$57 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$58 || (const$58 = dart.constList(['IMG::src'], core.String))});
+      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['IMG'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['IMG::src'], core.String))});
     }
     static allowTextElements() {
-      return new html$._SimpleNodeValidator(null, {allowedElements: const$59 || (const$59 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
+      return new html$._SimpleNodeValidator(null, {allowedElements: const$89 || (const$89 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
     }
     new(uriPolicy, opts) {
       let allowedElements = opts && 'allowedElements' in opts ? opts.allowedElements : null;
@@ -83077,9 +98138,9 @@
       this.allowedAttributes = SetOfString().new();
       this.allowedUriAttributes = SetOfString().new();
       this.uriPolicy = uriPolicy;
-      this.allowedElements.addAll((allowedElements != null ? allowedElements : const$60 || (const$60 = dart.constList([], core.String))));
-      allowedAttributes = allowedAttributes != null ? allowedAttributes : const$61 || (const$61 = dart.constList([], core.String));
-      allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$62 || (const$62 = dart.constList([], core.String));
+      this.allowedElements.addAll((allowedElements != null ? allowedElements : const$90 || (const$90 = dart.constList([], core.String))));
+      allowedAttributes = allowedAttributes != null ? allowedAttributes : const$91 || (const$91 = dart.constList([], core.String));
+      allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$92 || (const$92 = dart.constList([], core.String));
       let legalAttributes = allowedAttributes[dartx.where](dart.fn(x => !dart.test(html$._Html5NodeValidator._uriAttributes[dartx.contains](x)), StringTobool$()));
       let extraUriAttributes = allowedAttributes[dartx.where](dart.fn(x => html$._Html5NodeValidator._uriAttributes[dartx.contains](x), StringTobool$()));
       this.allowedAttributes.addAll(legalAttributes);
@@ -83302,21 +98363,13 @@
       constructors: () => ({new: dart.definiteFunctionType(html$._WrappedList$(E), [ListOfNode()])}),
       fields: () => ({[_list$]: ListOfNode()}),
       getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
         length: dart.definiteFunctionType(core.int, []),
         rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
       }),
       setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
       methods: () => ({
-        add: dart.definiteFunctionType(dart.void, [E]),
         _get: dart.definiteFunctionType(E, [core.int]),
-        _set: dart.definiteFunctionType(dart.void, [core.int, E]),
-        sort: dart.definiteFunctionType(dart.void, [], [EAndEToint()]),
-        insert: dart.definiteFunctionType(dart.void, [core.int, E]),
-        removeAt: dart.definiteFunctionType(E, [core.int]),
-        setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()], [core.int]),
-        replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()]),
-        fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [E])
+        _set: dart.definiteFunctionType(dart.void, [core.int, E])
       })
     });
     dart.defineExtensionMembers(_WrappedList, [
@@ -83381,7 +98434,7 @@
         if (request[dartx.readyState] == html$.HttpRequest.DONE) {
           onComplete(request);
         }
-      }, ProgressEventTovoid$()));
+      }, ProgressEventToNull()));
       request[dartx.send]();
       return request;
     }
@@ -83398,19 +98451,19 @@
     class FixedSizeListIterator extends core.Object {
       new(array) {
         this[_array] = array;
-        this[_position$0] = -1;
-        this[_length$2] = array[dartx.length];
+        this[_position$1] = -1;
+        this[_length$3] = array[dartx.length];
         this[_current$4] = null;
       }
       moveNext() {
-        let nextPosition = dart.notNull(this[_position$0]) + 1;
-        if (nextPosition < dart.notNull(this[_length$2])) {
+        let nextPosition = dart.notNull(this[_position$1]) + 1;
+        if (nextPosition < dart.notNull(this[_length$3])) {
           this[_current$4] = this[_array][dartx._get](nextPosition);
-          this[_position$0] = nextPosition;
+          this[_position$1] = nextPosition;
           return true;
         }
         this[_current$4] = null;
-        this[_position$0] = this[_length$2];
+        this[_position$1] = this[_length$3];
         return false;
       }
       get current() {
@@ -83423,8 +98476,8 @@
       constructors: () => ({new: dart.definiteFunctionType(html$.FixedSizeListIterator$(T), [ListOfT()])}),
       fields: () => ({
         [_array]: ListOfT(),
-        [_length$2]: core.int,
-        [_position$0]: core.int,
+        [_length$3]: core.int,
+        [_position$1]: core.int,
         [_current$4]: T
       }),
       getters: () => ({current: dart.definiteFunctionType(T, [])}),
@@ -83439,18 +98492,18 @@
     class _VariableSizeListIterator extends core.Object {
       new(array) {
         this[_array] = array;
-        this[_position$0] = -1;
+        this[_position$1] = -1;
         this[_current$4] = null;
       }
       moveNext() {
-        let nextPosition = dart.notNull(this[_position$0]) + 1;
+        let nextPosition = dart.notNull(this[_position$1]) + 1;
         if (nextPosition < dart.notNull(this[_array][dartx.length])) {
           this[_current$4] = this[_array][dartx._get](nextPosition);
-          this[_position$0] = nextPosition;
+          this[_position$1] = nextPosition;
           return true;
         }
         this[_current$4] = null;
-        this[_position$0] = this[_array][dartx.length];
+        this[_position$1] = this[_array][dartx.length];
         return false;
       }
       get current() {
@@ -83463,7 +98516,7 @@
       constructors: () => ({new: dart.definiteFunctionType(html$._VariableSizeListIterator$(T), [ListOfT()])}),
       fields: () => ({
         [_array]: ListOfT(),
-        [_position$0]: core.int,
+        [_position$1]: core.int,
         [_current$4]: T
       }),
       getters: () => ({current: dart.definiteFunctionType(T, [])}),
@@ -84127,7 +99180,7 @@
         this.writeSlot(slot, copy);
         e[dartx.forEach](dart.fn((key, value) => {
           this.putIntoMap(copy, key, this.walk(value));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return copy;
       }
       if (core.List.is(e)) {
@@ -84336,7 +99389,7 @@
     }
     dict[dartx.forEach](dart.fn((key, value) => {
       object[key] = value;
-    }, StringAnddynamicTovoid()));
+    }, StringAnddynamicToNull()));
     return object;
   };
   dart.fn(html_common.convertDartToNative_Dictionary, Map__Todynamic());
@@ -84361,7 +99414,7 @@
     let mustCopy = opts && 'mustCopy' in opts ? opts.mustCopy : false;
     return new html_common._AcceptStructuredCloneDart2Js().convertNativeToDart_AcceptStructuredClone(object, {mustCopy: mustCopy});
   };
-  dart.fn(html_common.convertNativeToDart_AcceptStructuredClone, dynamic__Todynamic$());
+  dart.fn(html_common.convertNativeToDart_AcceptStructuredClone, dynamic__Todynamic());
   html_common._StructuredCloneDart2Js = class _StructuredCloneDart2Js extends html_common._StructuredClone {
     new() {
       super.new();
@@ -84669,25 +99722,12 @@
     getters: () => ({
       [_iterable$0]: dart.definiteFunctionType(core.Iterable$(html$.Element), []),
       [_filtered]: dart.definiteFunctionType(core.List$(html$.Element), []),
-      reversed: dart.definiteFunctionType(core.Iterable$(html$.Element), []),
       length: dart.definiteFunctionType(core.int, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(html$.Element), []),
       rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
-      forEach: dart.definiteFunctionType(dart.void, [ElementTovoid()]),
       _set: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
-      add: dart.definiteFunctionType(dart.void, [html$.Element]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfElement()]),
-      sort: dart.definiteFunctionType(dart.void, [], [ElementAndElementToint()]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()], [core.int]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html$.Element]),
-      replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()]),
-      removeLast: dart.definiteFunctionType(html$.Element, []),
-      insert: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
-      insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfElement()]),
-      removeAt: dart.definiteFunctionType(html$.Element, [core.int]),
       _get: dart.definiteFunctionType(html$.Element, [core.int])
     })
   });
@@ -88358,17 +103398,11 @@
   dart.setSignature(svg$.LengthList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.LengthList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.Length, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.Length, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.Length, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.Length, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.Length]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.Length, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.Length]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.Length, [svg$.Length]),
       [dartx.getItem]: dart.definiteFunctionType(svg$.Length, [core.int]),
@@ -88964,17 +103998,11 @@
   dart.setSignature(svg$.NumberList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.NumberList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.Number, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.Number, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.Number, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.Number, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.Number]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.Number, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.Number]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.Number, [svg$.Number]),
       [dartx.getItem]: dart.definiteFunctionType(svg$.Number, [core.int]),
@@ -89949,17 +104977,11 @@
   dart.setSignature(svg$.PathSegList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.PathSegList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.PathSeg, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.PathSeg, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.PathSeg, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.PathSeg, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.PathSeg]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.PathSeg, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.PathSeg]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.PathSeg, [svg$.PathSeg]),
       [dartx.getItem]: dart.definiteFunctionType(svg$.PathSeg, [core.int]),
@@ -90714,17 +105736,11 @@
   dart.setSignature(svg$.StringList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.StringList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(core.String, []),
-      [dartx.last]: dart.definiteFunctionType(core.String, []),
-      [dartx.single]: dart.definiteFunctionType(core.String, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(core.String, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
-      [dartx.elementAt]: dart.definiteFunctionType(core.String, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
       [dartx.appendItem]: dart.definiteFunctionType(core.String, [core.String]),
       [dartx.getItem]: dart.definiteFunctionType(core.String, [core.int]),
@@ -91598,17 +106614,11 @@
   dart.setSignature(svg$.TransformList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.TransformList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.Transform, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.Transform, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.Transform, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.Transform, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.Transform]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.Transform, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.Transform]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.Transform, [svg$.Transform]),
       [dartx.consolidate]: dart.definiteFunctionType(svg$.Transform, []),
@@ -92375,13 +107385,13 @@
       let completer = CompleterOfAudioBuffer().new();
       this[_decodeAudioData](audioData, dart.fn(value => {
         completer.complete(value);
-      }, AudioBufferTovoid()), dart.fn(error => {
+      }, AudioBufferToNull()), dart.fn(error => {
         if (error == null) {
           completer.completeError('');
         } else {
           completer.completeError(error);
         }
-      }, AudioBufferTovoid()));
+      }, AudioBufferToNull()));
       return completer.future;
     }
   };
@@ -92817,7 +107827,7 @@
       return web_audio.OfflineAudioContext._create_1(numberOfChannels, numberOfFrames, sampleRate);
     }
     static _create_1(numberOfChannels, numberOfFrames, sampleRate) {
-      return new OfflineAudioContext(numberOfChannels, numberOfFrames, sampleRate);
+      return new self.OfflineAudioContext(numberOfChannels, numberOfFrames, sampleRate);
     }
   };
   dart.setSignature(web_audio.OfflineAudioContext, {
@@ -95645,17 +110655,11 @@
   web_sql.SqlResultSetRowList[dart.implements] = () => [ListOfMap()];
   dart.setSignature(web_sql.SqlResultSetRowList, {
     constructors: () => ({_: dart.definiteFunctionType(web_sql.SqlResultSetRowList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(core.Map, []),
-      [dartx.last]: dart.definiteFunctionType(core.Map, []),
-      [dartx.single]: dart.definiteFunctionType(core.Map, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(core.Map, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.Map]),
-      [dartx.elementAt]: dart.definiteFunctionType(core.Map, [core.int]),
       [dartx.item]: dart.definiteFunctionType(core.Map, [core.int]),
       [_item_1]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
     })
@@ -95696,6 +110700,7 @@
   exports.convert = convert;
   exports.core = core;
   exports.developer = developer;
+  exports.io = io;
   exports.isolate = isolate;
   exports.js = js;
   exports.js_util = js_util;
diff --git a/pkg/dev_compiler/lib/js/es6/dart_sdk.js b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
index 658981b..9f9e9f3 100644
--- a/pkg/dev_compiler/lib/js/es6/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
@@ -16,6 +16,7 @@
 export const convert = Object.create(null);
 export const core = Object.create(null);
 export const developer = Object.create(null);
+export const io = Object.create(null);
 export const isolate = Object.create(null);
 export const js = Object.create(null);
 export const js_util = Object.create(null);
@@ -164,6 +165,8 @@
 let _AsyncBroadcastStreamController = () => (_AsyncBroadcastStreamController = dart.constFn(async._AsyncBroadcastStreamController$()))();
 let _AsBroadcastStreamController = () => (_AsBroadcastStreamController = dart.constFn(async._AsBroadcastStreamController$()))();
 let _DoneSubscription = () => (_DoneSubscription = dart.constFn(async._DoneSubscription$()))();
+let FutureOr = () => (FutureOr = dart.constFn(async.FutureOr$()))();
+let dynamicToFutureOr = () => (dynamicToFutureOr = dart.constFn(dart.functionType(async.FutureOr, [dart.dynamic])))();
 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart.dynamic, [])))();
 let Future = () => (Future = dart.constFn(async.Future$()))();
 let Completer = () => (Completer = dart.constFn(async.Completer$()))();
@@ -381,6 +384,103 @@
 let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
 let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
 let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
+let ListOfListOfint = () => (ListOfListOfint = dart.constFn(core.List$(ListOfint())))();
+let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
+let FutureOfDirectory = () => (FutureOfDirectory = dart.constFn(async.Future$(io.Directory)))();
+let FutureOrOfDirectory = () => (FutureOrOfDirectory = dart.constFn(async.FutureOr$(io.Directory)))();
+let StreamOfFileSystemEntity = () => (StreamOfFileSystemEntity = dart.constFn(async.Stream$(io.FileSystemEntity)))();
+let JSArrayOfFileSystemEntity = () => (JSArrayOfFileSystemEntity = dart.constFn(_interceptors.JSArray$(io.FileSystemEntity)))();
+let FutureOrOfString = () => (FutureOrOfString = dart.constFn(async.FutureOr$(core.String)))();
+let FutureOrOfbool = () => (FutureOrOfbool = dart.constFn(async.FutureOr$(core.bool)))();
+let FutureOrOfint = () => (FutureOrOfint = dart.constFn(async.FutureOr$(core.int)))();
+let ListOfFileSystemEntity = () => (ListOfFileSystemEntity = dart.constFn(core.List$(io.FileSystemEntity)))();
+let StreamControllerOfListOfint = () => (StreamControllerOfListOfint = dart.constFn(async.StreamController$(ListOfint())))();
+let FutureOfRandomAccessFile = () => (FutureOfRandomAccessFile = dart.constFn(async.Future$(io.RandomAccessFile)))();
+let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(io.File)))();
+let FutureOfListOfint = () => (FutureOfListOfint = dart.constFn(async.Future$(ListOfint())))();
+let FutureOrOfFile = () => (FutureOrOfFile = dart.constFn(async.FutureOr$(io.File)))();
+let FutureOfFile = () => (FutureOfFile = dart.constFn(async.Future$(io.File)))();
+let FutureOrOfListOfint = () => (FutureOrOfListOfint = dart.constFn(async.FutureOr$(ListOfint())))();
+let ListOfFileSystemEntityType = () => (ListOfFileSystemEntityType = dart.constFn(core.List$(io.FileSystemEntityType)))();
+let StreamOfHttpRequest = () => (StreamOfHttpRequest = dart.constFn(async.Stream$(io.HttpRequest)))();
+let ListOfRedirectInfo = () => (ListOfRedirectInfo = dart.constFn(core.List$(io.RedirectInfo)))();
+let HashMapOfString$ListOfString = () => (HashMapOfString$ListOfString = dart.constFn(collection.HashMap$(core.String, ListOfString())))();
+let ListOfCookie = () => (ListOfCookie = dart.constFn(core.List$(io.Cookie)))();
+let StringAndListOfStringTovoid = () => (StringAndListOfStringTovoid = dart.constFn(dart.functionType(dart.void, [core.String, ListOfString()])))();
+let FutureOfHttpClientResponse = () => (FutureOfHttpClientResponse = dart.constFn(async.Future$(io.HttpClientResponse)))();
+let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
+let FutureOrOfHttpClientResponse = () => (FutureOrOfHttpClientResponse = dart.constFn(async.FutureOr$(io.HttpClientResponse)))();
+let _StreamSinkImpl = () => (_StreamSinkImpl = dart.constFn(io._StreamSinkImpl$()))();
+let StreamConsumerOfListOfint = () => (StreamConsumerOfListOfint = dart.constFn(async.StreamConsumer$(ListOfint())))();
+let _HttpOutboundMessage = () => (_HttpOutboundMessage = dart.constFn(io._HttpOutboundMessage$()))();
+let CompleterOfHttpClientResponse = () => (CompleterOfHttpClientResponse = dart.constFn(async.Completer$(io.HttpClientResponse)))();
+let JSArrayOfRedirectInfo = () => (JSArrayOfRedirectInfo = dart.constFn(_interceptors.JSArray$(io.RedirectInfo)))();
+let JSArrayOfFuture = () => (JSArrayOfFuture = dart.constFn(_interceptors.JSArray$(async.Future)))();
+let CompleterOf_HttpIncoming = () => (CompleterOf_HttpIncoming = dart.constFn(async.Completer$(io._HttpIncoming)))();
+let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
+let FutureOfSecureSocket = () => (FutureOfSecureSocket = dart.constFn(async.Future$(io.SecureSocket)))();
+let HashSetOf_HttpClientConnection = () => (HashSetOf_HttpClientConnection = dart.constFn(collection.HashSet$(io._HttpClientConnection)))();
+let FutureOf_ConnectionInfo = () => (FutureOf_ConnectionInfo = dart.constFn(async.Future$(io._ConnectionInfo)))();
+let FutureOrOf_ConnectionInfo = () => (FutureOrOf_ConnectionInfo = dart.constFn(async.FutureOr$(io._ConnectionInfo)))();
+let SetOf_HttpClientConnection = () => (SetOf_HttpClientConnection = dart.constFn(core.Set$(io._HttpClientConnection)))();
+let HashMapOfString$_ConnectionTarget = () => (HashMapOfString$_ConnectionTarget = dart.constFn(collection.HashMap$(core.String, io._ConnectionTarget)))();
+let JSArrayOf_Credentials = () => (JSArrayOf_Credentials = dart.constFn(_interceptors.JSArray$(io._Credentials)))();
+let JSArrayOf_ProxyCredentials = () => (JSArrayOf_ProxyCredentials = dart.constFn(_interceptors.JSArray$(io._ProxyCredentials)))();
+let FutureOf_HttpClientRequest = () => (FutureOf_HttpClientRequest = dart.constFn(async.Future$(io._HttpClientRequest)))();
+let FutureOrOf_HttpClientRequest = () => (FutureOrOf_HttpClientRequest = dart.constFn(async.FutureOr$(io._HttpClientRequest)))();
+let X509CertificateAndStringAndintTobool = () => (X509CertificateAndStringAndintTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate, core.String, core.int])))();
+let FutureOfbool = () => (FutureOfbool = dart.constFn(async.Future$(core.bool)))();
+let UriAndStringAndStringToFutureOfbool = () => (UriAndStringAndStringToFutureOfbool = dart.constFn(dart.functionType(FutureOfbool(), [core.Uri, core.String, core.String])))();
+let StringAndintAndString__ToFutureOfbool = () => (StringAndintAndString__ToFutureOfbool = dart.constFn(dart.functionType(FutureOfbool(), [core.String, core.int, core.String, core.String])))();
+let UriToString = () => (UriToString = dart.constFn(dart.functionType(core.String, [core.Uri])))();
+let MapOfString$_ConnectionTarget = () => (MapOfString$_ConnectionTarget = dart.constFn(core.Map$(core.String, io._ConnectionTarget)))();
+let ListOf_Credentials = () => (ListOf_Credentials = dart.constFn(core.List$(io._Credentials)))();
+let ListOf_ProxyCredentials = () => (ListOf_ProxyCredentials = dart.constFn(core.List$(io._ProxyCredentials)))();
+let MapOfint$_HttpConnection = () => (MapOfint$_HttpConnection = dart.constFn(core.Map$(core.int, io._HttpConnection)))();
+let HashMapOfint$_HttpConnection = () => (HashMapOfint$_HttpConnection = dart.constFn(collection.HashMap$(core.int, io._HttpConnection)))();
+let LinkedListOf_HttpConnection = () => (LinkedListOf_HttpConnection = dart.constFn(collection.LinkedList$(io._HttpConnection)))();
+let StreamControllerOfHttpRequest = () => (StreamControllerOfHttpRequest = dart.constFn(async.StreamController$(io.HttpRequest)))();
+let HttpRequestTovoid = () => (HttpRequestTovoid = dart.constFn(dart.functionType(dart.void, [io.HttpRequest])))();
+let MapOfint$_HttpServer = () => (MapOfint$_HttpServer = dart.constFn(core.Map$(core.int, io._HttpServer)))();
+let ListOf_Proxy = () => (ListOf_Proxy = dart.constFn(core.List$(io._Proxy)))();
+let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
+let ListOfbool = () => (ListOfbool = dart.constFn(core.List$(core.bool)))();
+let StreamOfint = () => (StreamOfint = dart.constFn(async.Stream$(core.int)))();
+let StreamControllerOf_HttpIncoming = () => (StreamControllerOf_HttpIncoming = dart.constFn(async.StreamController$(io._HttpIncoming)))();
+let _HttpIncomingTovoid = () => (_HttpIncomingTovoid = dart.constFn(dart.functionType(dart.void, [io._HttpIncoming])))();
+let MapOfString$_HttpSession = () => (MapOfString$_HttpSession = dart.constFn(core.Map$(core.String, io._HttpSession)))();
+let ListOfMapOfString$String = () => (ListOfMapOfString$String = dart.constFn(core.List$(MapOfString$String())))();
+let FutureOfServiceExtensionResponse = () => (FutureOfServiceExtensionResponse = dart.constFn(async.Future$(developer.ServiceExtensionResponse)))();
+let MapOfint$_FileResourceInfo = () => (MapOfint$_FileResourceInfo = dart.constFn(core.Map$(core.int, io._FileResourceInfo)))();
+let MapOfint$_ProcessResourceInfo = () => (MapOfint$_ProcessResourceInfo = dart.constFn(core.Map$(core.int, io._ProcessResourceInfo)))();
+let MapOfint$_SocketResourceInfo = () => (MapOfint$_SocketResourceInfo = dart.constFn(core.Map$(core.int, io._SocketResourceInfo)))();
+let StreamSinkOfListOfint = () => (StreamSinkOfListOfint = dart.constFn(async.StreamSink$(ListOfint())))();
+let FutureOfLink = () => (FutureOfLink = dart.constFn(async.Future$(io.Link)))();
+let _CaseInsensitiveStringMap = () => (_CaseInsensitiveStringMap = dart.constFn(io._CaseInsensitiveStringMap$()))();
+let FutureOfRawSecureSocket = () => (FutureOfRawSecureSocket = dart.constFn(async.Future$(io.RawSecureSocket)))();
+let SecureSocketTovoid = () => (SecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.SecureSocket])))();
+let StreamControllerOfRawSecureSocket = () => (StreamControllerOfRawSecureSocket = dart.constFn(async.StreamController$(io.RawSecureSocket)))();
+let RawSecureSocketTovoid = () => (RawSecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSecureSocket])))();
+let StreamSubscriptionOfRawSocket = () => (StreamSubscriptionOfRawSocket = dart.constFn(async.StreamSubscription$(io.RawSocket)))();
+let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
+let CompleterOf_RawSecureSocket = () => (CompleterOf_RawSecureSocket = dart.constFn(async.Completer$(io._RawSecureSocket)))();
+let StreamControllerOfRawSocketEvent = () => (StreamControllerOfRawSocketEvent = dart.constFn(async.StreamController$(io.RawSocketEvent)))();
+let RawSocketEventTovoid = () => (RawSocketEventTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSocketEvent])))();
+let StreamOfRawSocketEvent = () => (StreamOfRawSocketEvent = dart.constFn(async.Stream$(io.RawSocketEvent)))();
+let X509CertificateTodynamic = () => (X509CertificateTodynamic = dart.constFn(dart.functionType(dart.dynamic, [io.X509Certificate])))();
+let intToListOfint = () => (intToListOfint = dart.constFn(dart.functionType(ListOfint(), [core.int])))();
+let StreamOfRawSocket = () => (StreamOfRawSocket = dart.constFn(async.Stream$(io.RawSocket)))();
+let StreamOfSocket = () => (StreamOfSocket = dart.constFn(async.Stream$(io.Socket)))();
+let StreamTransformerOfHttpRequest$WebSocket = () => (StreamTransformerOfHttpRequest$WebSocket = dart.constFn(async.StreamTransformer$(io.HttpRequest, io.WebSocket)))();
+let ListOfStringTodynamic = () => (ListOfStringTodynamic = dart.constFn(dart.functionType(dart.dynamic, [ListOfString()])))();
+let StreamTransformerOfListOfint$dynamic = () => (StreamTransformerOfListOfint$dynamic = dart.constFn(async.StreamTransformer$(ListOfint(), dart.dynamic)))();
+let EventSinkOfUint8List = () => (EventSinkOfUint8List = dart.constFn(async.EventSink$(typed_data.Uint8List)))();
+let StreamControllerOfWebSocket = () => (StreamControllerOfWebSocket = dart.constFn(async.StreamController$(io.WebSocket)))();
+let FutureOfWebSocket = () => (FutureOfWebSocket = dart.constFn(async.Future$(io.WebSocket)))();
+let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
+let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+let StreamTransformerOfdynamic$ListOfint = () => (StreamTransformerOfdynamic$ListOfint = dart.constFn(async.StreamTransformer$(dart.dynamic, ListOfint())))();
+let MapOfint$_WebSocketImpl = () => (MapOfint$_WebSocketImpl = dart.constFn(core.Map$(core.int, io._WebSocketImpl)))();
 let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
 let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
 let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@@ -397,7 +497,6 @@
 let FutureOfIdbFactory = () => (FutureOfIdbFactory = dart.constFn(async.Future$(indexed_db.IdbFactory)))();
 let FutureOfListOfString = () => (FutureOfListOfString = dart.constFn(async.Future$(ListOfString())))();
 let EventTovoid = () => (EventTovoid = dart.constFn(dart.functionType(dart.void, [html.Event])))();
-let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
 let CompleterOfDatabase = () => (CompleterOfDatabase = dart.constFn(async.Completer$(indexed_db.Database)))();
 let ListOfEventTarget = () => (ListOfEventTarget = dart.constFn(core.List$(html.EventTarget)))();
 let RectangleOfint = () => (RectangleOfint = dart.constFn(math.Rectangle$(core.int)))();
@@ -431,8 +530,8 @@
 let CompleterOfString = () => (CompleterOfString = dart.constFn(async.Completer$(core.String)))();
 let CompleterOfMetadata = () => (CompleterOfMetadata = dart.constFn(async.Completer$(html.Metadata)))();
 let CompleterOfListOfEntry = () => (CompleterOfListOfEntry = dart.constFn(async.Completer$(ListOfEntry())))();
-let ListOfStyleSheet = () => (ListOfStyleSheet = dart.constFn(core.List$(html.StyleSheet)))();
 let EventStreamProviderOfSecurityPolicyViolationEvent = () => (EventStreamProviderOfSecurityPolicyViolationEvent = dart.constFn(html.EventStreamProvider$(html.SecurityPolicyViolationEvent)))();
+let ListOfStyleSheet = () => (ListOfStyleSheet = dart.constFn(core.List$(html.StyleSheet)))();
 let ImmutableListMixin = () => (ImmutableListMixin = dart.constFn(html.ImmutableListMixin$()))();
 let ElementAndElementToint = () => (ElementAndElementToint = dart.constFn(dart.functionType(core.int, [html.Element, html.Element])))();
 let ElementTobool = () => (ElementTobool = dart.constFn(dart.functionType(core.bool, [html.Element])))();
@@ -448,6 +547,7 @@
 let StreamControllerOfGeoposition = () => (StreamControllerOfGeoposition = dart.constFn(async.StreamController$(html.Geoposition)))();
 let _CustomEventStreamProviderOfEvent = () => (_CustomEventStreamProviderOfEvent = dart.constFn(html._CustomEventStreamProvider$(html.Event)))();
 let CompleterOfHttpRequest = () => (CompleterOfHttpRequest = dart.constFn(async.Completer$(html.HttpRequest)))();
+let dynamicToNull = () => (dynamicToNull = dart.constFn(dart.functionType(core.Null, [dart.dynamic])))();
 let ProgressEventTovoid = () => (ProgressEventTovoid = dart.constFn(dart.functionType(dart.void, [html.ProgressEvent])))();
 let ListOfMap = () => (ListOfMap = dart.constFn(core.List$(core.Map)))();
 let ListOfMediaStreamTrack = () => (ListOfMediaStreamTrack = dart.constFn(core.List$(html.MediaStreamTrack)))();
@@ -456,6 +556,7 @@
 let EventStreamProviderOfMidiMessageEvent = () => (EventStreamProviderOfMidiMessageEvent = dart.constFn(html.EventStreamProvider$(html.MidiMessageEvent)))();
 let ListOfMimeType = () => (ListOfMimeType = dart.constFn(core.List$(html.MimeType)))();
 let ListOfMutationRecord = () => (ListOfMutationRecord = dart.constFn(core.List$(html.MutationRecord)))();
+let _wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void = () => (_wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void = dart.constFn(html._wrapZoneBinaryCallback$(ListOfMutationRecord(), html.MutationObserver, dart.void)))();
 let MapOfString$bool = () => (MapOfString$bool = dart.constFn(core.Map$(core.String, core.bool)))();
 let CompleterOfMediaStream = () => (CompleterOfMediaStream = dart.constFn(async.Completer$(html.MediaStream)))();
 let NodeTobool = () => (NodeTobool = dart.constFn(dart.functionType(core.bool, [html.Node])))();
@@ -463,7 +564,6 @@
 let ListOfPlugin = () => (ListOfPlugin = dart.constFn(core.List$(html.Plugin)))();
 let EventStreamProviderOfRtcDtmfToneChangeEvent = () => (EventStreamProviderOfRtcDtmfToneChangeEvent = dart.constFn(html.EventStreamProvider$(html.RtcDtmfToneChangeEvent)))();
 let JSArrayOfMapOfString$String = () => (JSArrayOfMapOfString$String = dart.constFn(_interceptors.JSArray$(MapOfString$String())))();
-let ListOfMapOfString$String = () => (ListOfMapOfString$String = dart.constFn(core.List$(MapOfString$String())))();
 let CompleterOfRtcSessionDescription = () => (CompleterOfRtcSessionDescription = dart.constFn(async.Completer$(html.RtcSessionDescription)))();
 let CompleterOfRtcStatsResponse = () => (CompleterOfRtcStatsResponse = dart.constFn(async.Completer$(html.RtcStatsResponse)))();
 let EventStreamProviderOfMediaStreamEvent = () => (EventStreamProviderOfMediaStreamEvent = dart.constFn(html.EventStreamProvider$(html.MediaStreamEvent)))();
@@ -494,6 +594,7 @@
 let EventStreamProviderOfDeviceOrientationEvent = () => (EventStreamProviderOfDeviceOrientationEvent = dart.constFn(html.EventStreamProvider$(html.DeviceOrientationEvent)))();
 let EventStreamProviderOfAnimationEvent = () => (EventStreamProviderOfAnimationEvent = dart.constFn(html.EventStreamProvider$(html.AnimationEvent)))();
 let EventStreamProviderOfBeforeUnloadEvent = () => (EventStreamProviderOfBeforeUnloadEvent = dart.constFn(html.EventStreamProvider$(html.BeforeUnloadEvent)))();
+let _EventStreamOfBeforeUnloadEvent = () => (_EventStreamOfBeforeUnloadEvent = dart.constFn(html._EventStream$(html.BeforeUnloadEvent)))();
 let StreamControllerOfBeforeUnloadEvent = () => (StreamControllerOfBeforeUnloadEvent = dart.constFn(async.StreamController$(html.BeforeUnloadEvent)))();
 let _ElementEventStreamImplOfBeforeUnloadEvent = () => (_ElementEventStreamImplOfBeforeUnloadEvent = dart.constFn(html._ElementEventStreamImpl$(html.BeforeUnloadEvent)))();
 let _ElementListEventStreamImplOfBeforeUnloadEvent = () => (_ElementListEventStreamImplOfBeforeUnloadEvent = dart.constFn(html._ElementListEventStreamImpl$(html.BeforeUnloadEvent)))();
@@ -543,6 +644,7 @@
 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))();
 let StringAndStringToint = () => (StringAndStringToint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.String])))();
 let VoidTo_MethodStats = () => (VoidTo_MethodStats = dart.constFn(dart.definiteFunctionType(dart._MethodStats, [])))();
+let VoidToFunctionType = () => (VoidToFunctionType = dart.constFn(dart.definiteFunctionType(dart.FunctionType, [])))();
 let dynamicToString = () => (dynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic])))();
 let dynamicToListOfString = () => (dynamicToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [dart.dynamic])))();
 let dynamicToList = () => (dynamicToList = dart.constFn(dart.definiteFunctionType(core.List, [dart.dynamic])))();
@@ -551,13 +653,12 @@
 let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
 let dynamicAnddynamicToString = () => (dynamicAnddynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic])))();
 let dynamicAndStringTobool = () => (dynamicAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, core.String])))();
-let intAnddynamicTovoid = () => (intAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, dart.dynamic])))();
+let intAnddynamicToNull = () => (intAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.int, dart.dynamic])))();
 let ObjectAndObjectToObject = () => (ObjectAndObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object, core.Object])))();
 let StringTobool = () => (StringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))();
 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
-let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
-let StringAndObjectTovoid = () => (StringAndObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Object])))();
-let dynamicAnddynamicTovoid = () => (dynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])))();
+let dynamicAnddynamicToNull = () => (dynamicAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, dart.dynamic])))();
+let StringAndObjectToNull = () => (StringAndObjectToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.Object])))();
 let StringToNameValuePair = () => (StringToNameValuePair = dart.constFn(dart.definiteFunctionType(_debugger.NameValuePair, [core.String])))();
 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
 let StringAndString__Todynamic = () => (StringAndString__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -571,18 +672,22 @@
 let FunctionTovoid = () => (FunctionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Function])))();
 let StringAndStringToString = () => (StringAndStringToString = dart.constFn(dart.definiteFunctionType(core.String, [core.String, core.String])))();
 let TypeAndStringTodynamic = () => (TypeAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.String])))();
+let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
 let dynamicAnddynamicToint = () => (dynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])))();
 let ListOfEToListOfE = () => (ListOfEToListOfE = dart.constFn(dart.definiteFunctionType(E => [core.List$(E), [core.List$(E)]])))();
 let StringTovoid = () => (StringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
 let _IsolateContextAndFunctionTodynamic = () => (_IsolateContextAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_isolate_helper._IsolateContext, core.Function])))();
 let VoidTobool = () => (VoidTobool = dart.constFn(dart.definiteFunctionType(core.bool, [])))();
 let VoidTo_IsolateContext = () => (VoidTo_IsolateContext = dart.constFn(dart.definiteFunctionType(_isolate_helper._IsolateContext, [])))();
+let VoidToNull = () => (VoidToNull = dart.constFn(dart.definiteFunctionType(core.Null, [])))();
+let dynamicAnddynamicTovoid = () => (dynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])))();
 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
-let ListTodynamic = () => (ListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.List])))();
-let StringTodynamic = () => (StringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String])))();
-let TimerTovoid = () => (TimerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.Timer])))();
+let ListToNull = () => (ListToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.List])))();
+let StringToNull = () => (StringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String])))();
+let dynamicToNull = () => (dynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic])))();
+let TimerToNull = () => (TimerToNull = dart.constFn(dart.definiteFunctionType(core.Null, [async.Timer])))();
 let dynamicToFuture = () => (dynamicToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [dart.dynamic])))();
-let boolTodynamic = () => (boolTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.bool])))();
+let boolToNull = () => (boolToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.bool])))();
 let dynamicAndStackTraceTovoid = () => (dynamicAndStackTraceTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])))();
 let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
 let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core.int, [])))();
@@ -625,7 +730,7 @@
 let dynamicToSymbol = () => (dynamicToSymbol = dart.constFn(dart.definiteFunctionType(core.Symbol, [dart.dynamic])))();
 let dynamicToMapOfSymbol$dynamic = () => (dynamicToMapOfSymbol$dynamic = dart.constFn(dart.definiteFunctionType(MapOfSymbol$dynamic(), [dart.dynamic])))();
 let TypeAndInvocationTodynamic = () => (TypeAndInvocationTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.Invocation])))();
-let SymbolAnddynamicTovoid = () => (SymbolAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Symbol, dart.dynamic])))();
+let SymbolAnddynamicToNull = () => (SymbolAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.Symbol, dart.dynamic])))();
 let MapOfSymbol$dynamicTodynamic = () => (MapOfSymbol$dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [MapOfSymbol$dynamic()])))();
 let dynamicToTypeMirror = () => (dynamicToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [dart.dynamic])))();
 let dynamicAnddynamicAnddynamicTovoid = () => (dynamicAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -638,12 +743,12 @@
 let VoidToObject = () => (VoidToObject = dart.constFn(dart.definiteFunctionType(core.Object, [])))();
 let _FutureAnddynamicAnddynamicTovoid = () => (_FutureAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async._Future, dart.dynamic, dart.dynamic])))();
 let ObjectToObject = () => (ObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object])))();
-let dynamic__Todynamic = () => (dynamic__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], [dart.dynamic])))();
+let dynamic__ToNull = () => (dynamic__ToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [dart.dynamic])))();
 let dynamicTo_Future = () => (dynamicTo_Future = dart.constFn(dart.definiteFunctionType(async._Future, [dart.dynamic])))();
 let _AsyncCallbackTovoid = () => (_AsyncCallbackTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async._AsyncCallback])))();
-let FnTodynamic = () => (FnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTovoid()])))();
+let FnToNull = () => (FnToNull = dart.constFn(dart.definiteFunctionType(core.Null, [VoidTovoid()])))();
 let _NotificationHandlerToFuture = () => (_NotificationHandlerToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [async._NotificationHandler])))();
-let dynamicAndStackTraceTodynamic = () => (dynamicAndStackTraceTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.StackTrace])))();
+let dynamicAndStackTraceToNull = () => (dynamicAndStackTraceToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, core.StackTrace])))();
 let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace])))();
 let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), ZoneBinaryCallbackOfdynamic$dynamic$StackTrace()])))();
 let StreamSubscriptionAnd_FutureAnddynamic__Tovoid = () => (StreamSubscriptionAnd_FutureAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic, core.StackTrace])))();
@@ -684,10 +789,11 @@
 let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
 let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
 let StringAndStringTovoid = () => (StringAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
-let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
+let StringAnddynamicToNull = () => (StringAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, dart.dynamic])))();
 let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
 let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
 let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
+let StringAndStringToNull = () => (StringAndStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.String])))();
 let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
 let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
 let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
@@ -702,9 +808,107 @@
 let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
 let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
 let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
+let dynamicAndStringAndStringTodynamic = () => (dynamicAndStringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])))();
+let ListAndintAndintTo_BufferAndStart = () => (ListAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int, core.int])))();
+let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))();
+let DirectoryToFutureOfDirectory = () => (DirectoryToFutureOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOfDirectory(), [io.Directory])))();
+let boolToFutureOrOfDirectory = () => (boolToFutureOrOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOrOfDirectory(), [core.bool])))();
+let dynamicTo_Directory = () => (dynamicTo_Directory = dart.constFn(dart.definiteFunctionType(io._Directory, [dart.dynamic])))();
+let dynamicToDirectory = () => (dynamicToDirectory = dart.constFn(dart.definiteFunctionType(io.Directory, [dart.dynamic])))();
+let dynamicToFutureOrOfString = () => (dynamicToFutureOrOfString = dart.constFn(dart.definiteFunctionType(FutureOrOfString(), [dart.dynamic])))();
+let dynamicToFutureOrOfbool = () => (dynamicToFutureOrOfbool = dart.constFn(dart.definiteFunctionType(FutureOrOfbool(), [dart.dynamic])))();
+let dynamicToFutureOrOfint = () => (dynamicToFutureOrOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfint(), [dart.dynamic])))();
+let ListOfintToNull = () => (ListOfintToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfint()])))();
+let RandomAccessFileTovoid = () => (RandomAccessFileTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.RandomAccessFile])))();
+let RandomAccessFileToFutureOr = () => (RandomAccessFileToFutureOr = dart.constFn(dart.definiteFunctionType(async.FutureOr, [io.RandomAccessFile])))();
+let RandomAccessFileToNull = () => (RandomAccessFileToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RandomAccessFile])))();
+let RandomAccessFileToFutureOfRandomAccessFile = () => (RandomAccessFileToFutureOfRandomAccessFile = dart.constFn(dart.definiteFunctionType(FutureOfRandomAccessFile(), [io.RandomAccessFile])))();
+let dynamicTo_File = () => (dynamicTo_File = dart.constFn(dart.definiteFunctionType(io._File, [dart.dynamic])))();
+let FileSystemEntityTo_File = () => (FileSystemEntityTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.FileSystemEntity])))();
+let dynamicToFile = () => (dynamicToFile = dart.constFn(dart.definiteFunctionType(io.File, [dart.dynamic])))();
+let dynamicTo_RandomAccessFile = () => (dynamicTo_RandomAccessFile = dart.constFn(dart.definiteFunctionType(io._RandomAccessFile, [dart.dynamic])))();
+let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
+let dynamicToFutureOfListOfint = () => (dynamicToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [dart.dynamic])))();
+let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
+let RandomAccessFileToFutureOfListOfint = () => (RandomAccessFileToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [io.RandomAccessFile])))();
+let ListOfintToString = () => (ListOfintToString = dart.constFn(dart.definiteFunctionType(core.String, [ListOfint()])))();
+let RandomAccessFileTo_File = () => (RandomAccessFileTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.RandomAccessFile])))();
+let RandomAccessFileToObject = () => (RandomAccessFileToObject = dart.constFn(dart.definiteFunctionType(core.Object, [io.RandomAccessFile])))();
+let RandomAccessFileToFutureOrOfFile = () => (RandomAccessFileToFutureOrOfFile = dart.constFn(dart.definiteFunctionType(FutureOrOfFile(), [io.RandomAccessFile])))();
+let dynamicToFutureOrOfListOfint = () => (dynamicToFutureOrOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfListOfint(), [dart.dynamic])))();
+let dynamicToFileStat = () => (dynamicToFileStat = dart.constFn(dart.definiteFunctionType(io.FileStat, [dart.dynamic])))();
+let StringAndListOfStringToListOfString = () => (StringAndListOfStringToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String, ListOfString()])))();
+let ListOfintTovoid = () => (ListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
+let StringAndListOfStringToNull = () => (StringAndListOfStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, ListOfString()])))();
+let CookieToString = () => (CookieToString = dart.constFn(dart.definiteFunctionType(core.String, [io.Cookie])))();
+let CookieTobool = () => (CookieTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io.Cookie])))();
+let _HttpClientRequestToFutureOfHttpClientResponse = () => (_HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io._HttpClientRequest])))();
+let dynamicToFutureOfHttpClientResponse = () => (dynamicToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [dart.dynamic])))();
+let VoidToFutureOfHttpClientResponse = () => (VoidToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [])))();
+let VoidToListOfString = () => (VoidToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [])))();
+let _AuthenticationSchemeTo_Credentials = () => (_AuthenticationSchemeTo_Credentials = dart.constFn(dart.definiteFunctionType(io._Credentials, [io._AuthenticationScheme])))();
+let _CredentialsTovoid = () => (_CredentialsTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io._Credentials])))();
+let _AuthenticationSchemeAndStringToFuture = () => (_AuthenticationSchemeAndStringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [io._AuthenticationScheme, core.String])))();
+let dynamicToFutureOrOfHttpClientResponse = () => (dynamicToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [dart.dynamic])))();
+let CookieToNull = () => (CookieToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Cookie])))();
+let ListToFutureOrOfHttpClientResponse = () => (ListToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [core.List])))();
+let HttpClientResponseTovoid = () => (HttpClientResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.HttpClientResponse])))();
+let dynamicToIterable = () => (dynamicToIterable = dart.constFn(dart.definiteFunctionType(core.Iterable, [dart.dynamic])))();
+let dynamicTo_HttpOutboundMessage = () => (dynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic])))();
+let dynamicAnddynamicTo_HttpOutboundMessage = () => (dynamicAnddynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic, dart.dynamic])))();
+let dynamic__ToNull = () => (dynamic__ToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [core.StackTrace])))();
+let _HttpIncomingToNull = () => (_HttpIncomingToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpIncoming])))();
+let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
+let SecureSocketTo_HttpClientConnection = () => (SecureSocketTo_HttpClientConnection = dart.constFn(dart.definiteFunctionType(io._HttpClientConnection, [io.SecureSocket])))();
+let HttpClientResponseToFutureOfSecureSocket = () => (HttpClientResponseToFutureOfSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfSecureSocket(), [io.HttpClientResponse])))();
+let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io.X509Certificate])))();
+let _HttpClientConnectionTo_ConnectionInfo = () => (_HttpClientConnectionTo_ConnectionInfo = dart.constFn(dart.definiteFunctionType(io._ConnectionInfo, [io._HttpClientConnection])))();
+let dynamicToFutureOrOf_ConnectionInfo = () => (dynamicToFutureOrOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOrOf_ConnectionInfo(), [dart.dynamic])))();
+let _ConnectionTargetTobool = () => (_ConnectionTargetTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io._ConnectionTarget])))();
+let _ConnectionInfoTo_HttpClientRequest = () => (_ConnectionInfoTo_HttpClientRequest = dart.constFn(dart.definiteFunctionType(io._HttpClientRequest, [io._ConnectionInfo])))();
+let _ConnectionInfoToFutureOrOf_HttpClientRequest = () => (_ConnectionInfoToFutureOrOf_HttpClientRequest = dart.constFn(dart.definiteFunctionType(FutureOrOf_HttpClientRequest(), [io._ConnectionInfo])))();
+let _HttpClientRequestTo_HttpClientRequest = () => (_HttpClientRequestTo_HttpClientRequest = dart.constFn(dart.definiteFunctionType(io._HttpClientRequest, [io._HttpClientRequest])))();
+let VoidTo_ConnectionTarget = () => (VoidTo_ConnectionTarget = dart.constFn(dart.definiteFunctionType(io._ConnectionTarget, [])))();
+let dynamicToFutureOf_ConnectionInfo = () => (dynamicToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [dart.dynamic])))();
+let VoidToFutureOf_ConnectionInfo = () => (VoidToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [])))();
+let _SiteCredentialsAnd_CredentialsTo_SiteCredentials = () => (_SiteCredentialsAnd_CredentialsTo_SiteCredentials = dart.constFn(dart.definiteFunctionType(io._SiteCredentials, [io._SiteCredentials, io._Credentials])))();
+let ServerSocketTo_HttpServer = () => (ServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.ServerSocket])))();
+let SecureServerSocketTo_HttpServer = () => (SecureServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.SecureServerSocket])))();
+let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
+let _HttpConnectionToNull = () => (_HttpConnectionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpConnection])))();
+let _HttpConnectionToMap = () => (_HttpConnectionToMap = dart.constFn(dart.definiteFunctionType(core.Map, [io._HttpConnection])))();
+let _FileResourceInfoToMapOfString$String = () => (_FileResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._FileResourceInfo])))();
+let _ProcessResourceInfoToMapOfString$String = () => (_ProcessResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._ProcessResourceInfo])))();
+let _SocketResourceInfoToMapOfString$String = () => (_SocketResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._SocketResourceInfo])))();
+let dynamicTo_Link = () => (dynamicTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [dart.dynamic])))();
+let FileSystemEntityToFutureOfLink = () => (FileSystemEntityToFutureOfLink = dart.constFn(dart.definiteFunctionType(FutureOfLink(), [io.FileSystemEntity])))();
+let FileSystemEntityTo_Link = () => (FileSystemEntityTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [io.FileSystemEntity])))();
+let dynamicToLink = () => (dynamicToLink = dart.constFn(dart.definiteFunctionType(io.Link, [dart.dynamic])))();
+let DurationTovoid = () => (DurationTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Duration])))();
+let RawSecureServerSocketToSecureServerSocket = () => (RawSecureServerSocketToSecureServerSocket = dart.constFn(dart.definiteFunctionType(io.SecureServerSocket, [io.RawSecureServerSocket])))();
+let RawSecureSocketToSecureSocket = () => (RawSecureSocketToSecureSocket = dart.constFn(dart.definiteFunctionType(io.SecureSocket, [io.RawSecureSocket])))();
+let dynamicToFutureOfRawSecureSocket = () => (dynamicToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [dart.dynamic])))();
+let RawServerSocketToRawSecureServerSocket = () => (RawServerSocketToRawSecureServerSocket = dart.constFn(dart.definiteFunctionType(io.RawSecureServerSocket, [io.RawServerSocket])))();
+let RawSecureSocketToNull = () => (RawSecureSocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RawSecureSocket])))();
+let RawSocketToFutureOfRawSecureSocket = () => (RawSocketToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [io.RawSocket])))();
+let _FilterStatusToNull = () => (_FilterStatusToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._FilterStatus])))();
+let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
+let dynamicTo_FilterStatus = () => (dynamicTo_FilterStatus = dart.constFn(dart.definiteFunctionType(io._FilterStatus, [dart.dynamic])))();
+let ListOfintAndStringTovoid = () => (ListOfintAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint(), core.String])))();
+let dynamicToStdioType = () => (dynamicToStdioType = dart.constFn(dart.definiteFunctionType(io.StdioType, [dart.dynamic])))();
+let EventSinkTo_WebSocketProtocolTransformer = () => (EventSinkTo_WebSocketProtocolTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketProtocolTransformer, [async.EventSink])))();
+let WebSocketTovoid = () => (WebSocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.WebSocket])))();
+let HttpRequestToNull = () => (HttpRequestToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.HttpRequest])))();
+let SocketTo_WebSocketImpl = () => (SocketTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [io.Socket])))();
+let StringToFuture = () => (StringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [core.String])))();
+let EventSinkOfListOfintTo_WebSocketOutgoingTransformer = () => (EventSinkOfListOfintTo_WebSocketOutgoingTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [EventSinkOfListOfint()])))();
+let dynamicTo_WebSocketImpl = () => (dynamicTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic])))();
+let HttpClientResponseToFutureOfWebSocket = () => (HttpClientResponseToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [io.HttpClientResponse])))();
+let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
+let HttpClientRequestToFutureOfHttpClientResponse = () => (HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io.HttpClientRequest])))();
+let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
 let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
 let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
-let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
 let dynamicAnddynamicAndFnToObject = () => (dynamicAnddynamicAndFnToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic, dart.dynamic, dynamicTodynamic()])))();
 let FToF = () => (FToF = dart.constFn(dart.definiteFunctionType(F => [F, [F]])))();
 let FunctionToFunction = () => (FunctionToFunction = dart.constFn(dart.definiteFunctionType(core.Function, [core.Function])))();
@@ -719,35 +923,35 @@
 let VoidToMirrorSystem = () => (VoidToMirrorSystem = dart.constFn(dart.definiteFunctionType(mirrors.MirrorSystem, [])))();
 let ObjectToInstanceMirror = () => (ObjectToInstanceMirror = dart.constFn(dart.definiteFunctionType(mirrors.InstanceMirror, [core.Object])))();
 let TypeToClassMirror = () => (TypeToClassMirror = dart.constFn(dart.definiteFunctionType(mirrors.ClassMirror, [core.Type])))();
-let EventTovoid = () => (EventTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.Event])))();
+let EventToNull = () => (EventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.Event])))();
 let RequestToFutureOfT = () => (RequestToFutureOfT = dart.constFn(dart.definiteFunctionType(T => [async.Future$(T), [indexed_db.Request]])))();
 let dynamicToTo = () => (dynamicToTo = dart.constFn(dart.definiteFunctionType(To => [To, [dart.dynamic]])))();
-let EventTodynamic = () => (EventTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html.Event])))();
 let NodeTobool = () => (NodeTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html.Node])))();
 let MapOfString$dynamicTobool = () => (MapOfString$dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [MapOfString$dynamic()])))();
 let UriAndListOfStringAnddynamicToFutureOfIsolate = () => (UriAndListOfStringAnddynamicToFutureOfIsolate = dart.constFn(dart.definiteFunctionType(FutureOfIsolate(), [core.Uri, ListOfString(), dart.dynamic])))();
 let TypeAnddynamicTodynamic = () => (TypeAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, dart.dynamic])))();
-let FileSystemTovoid = () => (FileSystemTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.FileSystem])))();
-let FileErrorTovoid = () => (FileErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.FileError])))();
-let EntryTovoid = () => (EntryTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.Entry])))();
+let FileSystemToNull = () => (FileSystemToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.FileSystem])))();
+let FileErrorToNull = () => (FileErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.FileError])))();
+let EntryToNull = () => (EntryToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.Entry])))();
 let dynamicToCssStyleDeclaration = () => (dynamicToCssStyleDeclaration = dart.constFn(dart.definiteFunctionType(html.CssStyleDeclaration, [dart.dynamic])))();
 let CssStyleDeclarationTovoid = () => (CssStyleDeclarationTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.CssStyleDeclaration])))();
-let MetadataTovoid = () => (MetadataTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.Metadata])))();
-let ListOfEntryTovoid = () => (ListOfEntryTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfEntry()])))();
+let MetadataToNull = () => (MetadataToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.Metadata])))();
+let ListOfEntryToNull = () => (ListOfEntryToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfEntry()])))();
 let ElementTobool = () => (ElementTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html.Element])))();
-let FileWriterTovoid = () => (FileWriterTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.FileWriter])))();
-let FileTovoid = () => (FileTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.File])))();
-let GeopositionTovoid = () => (GeopositionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.Geoposition])))();
-let PositionErrorTovoid = () => (PositionErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.PositionError])))();
+let FileWriterToNull = () => (FileWriterToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.FileWriter])))();
+let FileToNull = () => (FileToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.File])))();
+let GeopositionToNull = () => (GeopositionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.Geoposition])))();
+let PositionErrorToNull = () => (PositionErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.PositionError])))();
 let HttpRequestToString = () => (HttpRequestToString = dart.constFn(dart.definiteFunctionType(core.String, [html.HttpRequest])))();
-let ProgressEventTovoid = () => (ProgressEventTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.ProgressEvent])))();
-let ListOfSourceInfoTovoid = () => (ListOfSourceInfoTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfSourceInfo()])))();
-let MediaStreamTovoid = () => (MediaStreamTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.MediaStream])))();
-let NavigatorUserMediaErrorTovoid = () => (NavigatorUserMediaErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.NavigatorUserMediaError])))();
-let RtcSessionDescriptionTovoid = () => (RtcSessionDescriptionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.RtcSessionDescription])))();
-let RtcStatsResponseTovoid = () => (RtcStatsResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.RtcStatsResponse])))();
+let ProgressEventToNull = () => (ProgressEventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.ProgressEvent])))();
+let ListOfSourceInfoToNull = () => (ListOfSourceInfoToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfSourceInfo()])))();
+let MediaStreamToNull = () => (MediaStreamToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.MediaStream])))();
+let NavigatorUserMediaErrorToNull = () => (NavigatorUserMediaErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.NavigatorUserMediaError])))();
+let RtcSessionDescriptionToNull = () => (RtcSessionDescriptionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.RtcSessionDescription])))();
+let RtcStatsResponseToNull = () => (RtcStatsResponseToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.RtcStatsResponse])))();
 let OptionElementTobool = () => (OptionElementTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html.OptionElement])))();
-let numTovoid = () => (numTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.num])))();
+let numToNull = () => (numToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.num])))();
+let BeforeUnloadEventToNull = () => (BeforeUnloadEventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html.BeforeUnloadEvent])))();
 let ElementTovoid = () => (ElementTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.Element])))();
 let ElementToCssClassSet = () => (ElementToCssClassSet = dart.constFn(dart.definiteFunctionType(html.CssClassSet, [html.Element])))();
 let CssClassSetImplTovoid = () => (CssClassSetImplTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html_common.CssClassSetImpl])))();
@@ -755,6 +959,7 @@
 let SetOfStringTobool = () => (SetOfStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [SetOfString()])))();
 let SetOfStringTovoid = () => (SetOfStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [SetOfString()])))();
 let EventAndStringTobool = () => (EventAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html.Event, core.String])))();
+let EventTodynamic = () => (EventTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html.Event])))();
 let KeyEventTobool = () => (KeyEventTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html.KeyEvent])))();
 let NodeValidatorTobool = () => (NodeValidatorTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html.NodeValidator])))();
 let NodeAndNodeToint = () => (NodeAndNodeToint = dart.constFn(dart.definiteFunctionType(core.int, [html.Node, html.Node])))();
@@ -770,14 +975,12 @@
 let NodeAndNodeTovoid = () => (NodeAndNodeTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.Node, html.Node])))();
 let dynamicToImageData = () => (dynamicToImageData = dart.constFn(dart.definiteFunctionType(html.ImageData, [dart.dynamic])))();
 let ImageDataTodynamic = () => (ImageDataTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html.ImageData])))();
-let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
 let Map__Todynamic = () => (Map__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Map], [dynamicTovoid()])))();
 let ListOfStringToList = () => (ListOfStringToList = dart.constFn(dart.definiteFunctionType(core.List, [ListOfString()])))();
-let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
 let DateTimeTodynamic = () => (DateTimeTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.DateTime])))();
 let dynamic__Todynamic = () => (dynamic__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], {mustCopy: dart.dynamic})))();
 let NodeToElement = () => (NodeToElement = dart.constFn(dart.definiteFunctionType(html.Element, [html.Node])))();
-let AudioBufferTovoid = () => (AudioBufferTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [web_audio.AudioBuffer])))();
+let AudioBufferToNull = () => (AudioBufferToNull = dart.constFn(dart.definiteFunctionType(core.Null, [web_audio.AudioBuffer])))();
 dart.mixin = function(base, ...mixins) {
   class Mixin extends base {}
   for (let m of mixins) {
@@ -796,6 +999,27 @@
         dart.copyProperties(s, m[dart._methodSig]);
       }
       return s;
+    },
+    fields: () => {
+      let s = {};
+      for (let m of mixins) {
+        dart.copyProperties(s, m[dart._fieldSig]);
+      }
+      return s;
+    },
+    getters: () => {
+      let s = {};
+      for (let m of mixins) {
+        dart.copyProperties(s, m[dart._getterSig]);
+      }
+      return s;
+    },
+    setters: () => {
+      let s = {};
+      for (let m of mixins) {
+        dart.copyProperties(s, m[dart._setterSig]);
+      }
+      return s;
     }
   });
   Mixin[dart._mixins] = mixins;
@@ -898,15 +1122,33 @@
 dart.getGenericTypeCtor = function(value) {
   return value[dart._genericTypeCtor];
 };
-dart.getMethodType = function(obj, name) {
-  let type = obj == null ? core.Object : obj.__proto__.constructor;
-  return dart.getMethodTypeFromType(type, name);
+dart.getType = function(obj) {
+  return obj == null ? core.Object : obj.__proto__.constructor;
 };
-dart.getMethodTypeFromType = function(type, name) {
+dart.isJsInterop = function(obj) {
+  if (typeof obj === "function") {
+    return dart._getRuntimeType(obj) == null;
+  }
+  if (typeof obj !== "object") return false;
+  if (dart.getExtensionType(obj) != null) return false;
+  return !(obj instanceof core.Object);
+};
+dart.getMethodType = function(type, name) {
   let sigObj = type[dart._methodSig];
   if (sigObj === void 0) return void 0;
   return sigObj[name];
 };
+dart.getFieldType = function(type, name) {
+  let sigObj = type[dart._fieldSig];
+  if (sigObj === void 0) return void 0;
+  let fieldType = sigObj[name];
+  return fieldType instanceof Array ? fieldType[0] : fieldType;
+};
+dart.getSetterType = function(type, name) {
+  let sigObj = type[dart._setterSig];
+  if (sigObj === void 0) return void 0;
+  return sigObj[name];
+};
 dart.classGetConstructorType = function(cls, name) {
   if (!name) name = 'new';
   if (cls === void 0) return void 0;
@@ -918,7 +1160,7 @@
 dart.bind = function(obj, name, f) {
   if (f === void 0) f = obj[name];
   f = f.bind(obj);
-  let sig = dart.getMethodType(obj, name);
+  let sig = dart.getMethodType(dart.getType(obj), name);
   dart.assert(sig);
   dart.tag(f, sig);
   return f;
@@ -932,7 +1174,8 @@
 dart._setInstanceSignature = function(f, sigF, kind) {
   dart.defineMemoizedGetter(f, kind, () => {
     let sigObj = sigF();
-    sigObj.__proto__ = f.__proto__[kind];
+    let proto = f.__proto__;
+    sigObj.__proto__ = kind in proto ? proto[kind] : null;
     return sigObj;
   });
 };
@@ -993,8 +1236,22 @@
   dart._setStaticSetterSignature(f, staticSetters);
   dart._setStaticTypes(f, names);
 };
-dart.hasMethod = function(obj, name) {
-  return dart.getMethodType(obj, name) !== void 0;
+dart._hasSigEntry = function(type, sigF, name) {
+  let sigObj = type[sigF];
+  if (sigObj === void 0) return false;
+  return name in sigObj;
+};
+dart.hasMethod = function(type, name) {
+  return dart._hasSigEntry(type, dart._methodSig, name);
+};
+dart.hasGetter = function(type, name) {
+  return dart._hasSigEntry(type, dart._getterSig, name);
+};
+dart.hasSetter = function(type, name) {
+  return dart._hasSigEntry(type, dart._setterSig, name);
+};
+dart.hasField = function(type, name) {
+  return dart._hasSigEntry(type, dart._fieldSig, name);
 };
 dart.defineNamedConstructor = function(clazz, name) {
   let proto = clazz.prototype;
@@ -1055,9 +1312,15 @@
   if (!jsProto) return;
   jsProto[dart._extensionType] = dartExtType;
   dart._installProperties(jsProto, extProto);
-  let originalSigFn = dart.getOwnPropertyDescriptor(dartExtType, dart._methodSig).get;
-  dart.assert(originalSigFn);
-  dart.defineMemoizedGetter(jsType, dart._methodSig, originalSigFn);
+  function updateSig(sigF) {
+    let originalSigFn = dart.getOwnPropertyDescriptor(dartExtType, sigF).get;
+    dart.assert(originalSigFn);
+    dart.defineMemoizedGetter(jsType, sigF, originalSigFn);
+  }
+  updateSig(dart._methodSig);
+  updateSig(dart._fieldSig);
+  updateSig(dart._getterSig);
+  updateSig(dart._setterSig);
 };
 dart.defineExtensionMembers = function(type, methodNames) {
   let proto = type.prototype;
@@ -1065,14 +1328,23 @@
     let method = dart.getOwnPropertyDescriptor(proto, name);
     dart.defineProperty(proto, dart.getExtensionSymbol(name), method);
   }
-  let originalSigFn = dart.getOwnPropertyDescriptor(type, dart._methodSig).get;
-  dart.defineMemoizedGetter(type, dart._methodSig, function() {
-    let sig = originalSigFn();
-    for (let name of methodNames) {
-      sig[dart.getExtensionSymbol(name)] = sig[name];
-    }
-    return sig;
-  });
+  function upgradeSig(sigF) {
+    let originalSigFn = dart.getOwnPropertyDescriptor(type, sigF).get;
+    dart.defineMemoizedGetter(type, sigF, function() {
+      let sig = originalSigFn();
+      let propertyNames = Object.getOwnPropertyNames(sig);
+      for (let name of methodNames) {
+        if (name in sig) {
+          sig[dart.getExtensionSymbol(name)] = sig[name];
+        }
+      }
+      return sig;
+    });
+  }
+  upgradeSig(dart._methodSig);
+  upgradeSig(dart._fieldSig);
+  upgradeSig(dart._getterSig);
+  upgradeSig(dart._setterSig);
 };
 dart.setType = function(obj, type) {
   obj.__proto__ = type.prototype;
@@ -1188,7 +1460,7 @@
 };
 const _wrappedType = Symbol('_wrappedType');
 dart.unwrapType = function(obj) {
-  return dart.dload(obj, _wrappedType);
+  return obj[_wrappedType];
 };
 dart._getRuntimeType = function(value) {
   return value[dart._runtimeType];
@@ -1273,6 +1545,65 @@
     return dart._asInstanceOfLazyJSType(object, this);
   };
 };
+dart._memoizeArray = function(map, arr, create) {
+  let len = arr.length;
+  map = dart._lookupNonTerminal(map, len);
+  for (var i = 0; i < len - 1; ++i) {
+    map = dart._lookupNonTerminal(map, arr[i]);
+  }
+  let result = map.get(arr[len - 1]);
+  if (result !== void 0) return result;
+  map.set(arr[len - 1], result = create());
+  return result;
+};
+dart._normalizeParameter = function(a) {
+  if (a instanceof Array) {
+    let result = [];
+    result.push(a[0] == dart.dynamic ? dart.bottom : a[0]);
+    result.push(a.slice(1));
+    return result;
+  }
+  return a == dart.dynamic ? dart.bottom : a;
+};
+dart._canonicalizeArray = function(definite, array, map) {
+  let arr = definite ? array : array.map(dart._normalizeParameter);
+  return dart._memoizeArray(map, arr, () => arr);
+};
+dart._canonicalizeNamed = function(definite, named, map) {
+  let key = [];
+  let names = dart.getOwnPropertyNames(named);
+  let r = {};
+  for (var i = 0; i < names.length; ++i) {
+    let name = names[i];
+    let type = named[name];
+    if (!definite) r[name] = type = dart._normalizeParameter(type);
+    key.push(name);
+    key.push(type);
+  }
+  if (!definite) named = r;
+  return dart._memoizeArray(map, key, () => named);
+};
+dart._lookupNonTerminal = function(map, key) {
+  let result = map.get(key);
+  if (result !== void 0) return result;
+  map.set(key, result = new Map());
+  return result;
+};
+dart._createSmall = function(count, definite, returnType, required) {
+  let map = dart._fnTypeSmallMap[count];
+  let args = definite ? required : required.map(dart._normalizeParameter);
+  for (var i = 0; i < count; ++i) {
+    map = dart._lookupNonTerminal(map, args[i]);
+  }
+  let result = map.get(returnType);
+  if (result !== void 0) return result;
+  result = new dart.FunctionType(returnType, args, [], {});
+  map.set(returnType, result);
+  return result;
+};
+dart.typedef = function(name, closure) {
+  return new dart.Typedef(name, closure);
+};
 dart._functionType = function(definite, returnType, args, extra) {
   if (args === void 0 && extra === void 0) {
     const fnTypeParts = returnType;
@@ -1291,9 +1622,6 @@
 dart.definiteFunctionType = function(returnType, args, extra) {
   return dart._functionType(true, returnType, args, extra);
 };
-dart.typedef = function(name, closure) {
-  return new dart.Typedef(name, closure);
-};
 dart.typeName = function(type) {
   if (type === void 0) return "undefined type";
   if (type === null) return "null type";
@@ -1329,17 +1657,17 @@
 };
 dart.getImplicitFunctionType = function(type) {
   if (dart.test(dart.isFunctionType(type))) return type;
-  return dart.getMethodTypeFromType(type, 'call');
+  return dart.getMethodType(type, 'call');
 };
 dart.isFunctionType = function(type) {
   return type instanceof dart.AbstractFunctionType || type === core.Function;
 };
-dart.isLazyJSSubtype = function(t1, t2, covariant) {
+dart.isLazyJSSubtype = function(t1, t2, isCovariant) {
   if (dart.equals(t1, t2)) return true;
   if (t1[_jsTypeCallback] == null || t2[_jsTypeCallback] == null) return true;
-  return dart.isClassSubType(t1[_rawJSType], t2[_rawJSType], covariant);
+  return dart.isClassSubType(t1[_rawJSType], t2[_rawJSType], isCovariant);
 };
-dart.isFunctionSubtype = function(ft1, ft2, covariant) {
+dart.isFunctionSubtype = function(ft1, ft2, isCovariant) {
   if (ft2 === core.Function) {
     return true;
   }
@@ -1351,26 +1679,26 @@
   let args1 = ft1.args;
   let args2 = ft2.args;
   if (args1.length > args2.length) {
-    return covariant ? false : null;
+    return isCovariant ? false : null;
   }
   for (let i = 0; i < args1.length; ++i) {
-    if (!dart._isSubtype(args2[i], args1[i], !covariant)) {
+    if (!dart._isSubtype(args2[i], args1[i], !isCovariant)) {
       return null;
     }
   }
   let optionals1 = ft1.optionals;
   let optionals2 = ft2.optionals;
   if (args1.length + optionals1.length < args2.length + optionals2.length) {
-    return covariant ? false : null;
+    return isCovariant ? false : null;
   }
   let j = 0;
   for (let i = args1.length; i < args2.length; ++i, ++j) {
-    if (!dart._isSubtype(args2[i], optionals1[j], !covariant)) {
+    if (!dart._isSubtype(args2[i], optionals1[j], !isCovariant)) {
       return null;
     }
   }
   for (let i = 0; i < optionals2.length; ++i, ++j) {
-    if (!dart._isSubtype(optionals2[i], optionals1[j], !covariant)) {
+    if (!dart._isSubtype(optionals2[i], optionals1[j], !isCovariant)) {
       return null;
     }
   }
@@ -1382,15 +1710,14 @@
     let n1 = named1[name];
     let n2 = named2[name];
     if (n1 === void 0) {
-      return covariant ? false : null;
+      return isCovariant ? false : null;
     }
-    if (!dart._isSubtype(n2, n1, !covariant)) {
+    if (!dart._isSubtype(n2, n1, !isCovariant)) {
       return null;
     }
   }
-  if (ret2 === dart.void) return true;
-  if (ret1 === dart.void) return ret2 === dart.dynamic;
-  if (!dart._isSubtype(ret1, ret2, covariant)) return null;
+  if (ret1 === dart.void) return dart._isTop(ret2);
+  if (!dart._isSubtype(ret1, ret2, isCovariant)) return null;
   return true;
 };
 dart._subtypeMemo = function(f) {
@@ -1410,12 +1737,15 @@
   };
 };
 dart._isBottom = function(type) {
-  return type == dart.bottom;
+  return type == dart.bottom || type == core.Null;
 };
 dart._isTop = function(type) {
-  return type == core.Object || type == dart.dynamic;
+  if (dart.getGenericClass(type) === dart.getGenericClass(async.FutureOr)) {
+    return dart._isTop(dart.getGenericArgs(type)[0]);
+  }
+  return type == core.Object || type == dart.dynamic || type == dart.void;
 };
-dart._isSubtype = function(t1, t2, covariant) {
+dart._isSubtype = function(t1, t2, isCovariant) {
   if (t1 === t2) return true;
   if (dart._isTop(t2) || dart._isBottom(t1)) {
     return true;
@@ -1426,20 +1756,20 @@
     return false;
   }
   if (!(t1 instanceof dart.AbstractFunctionType) && !(t2 instanceof dart.AbstractFunctionType)) {
-    let result = dart.isClassSubType(t1, t2, covariant);
+    let result = dart.isClassSubType(t1, t2, isCovariant);
     if (result === true || result === null) return result;
   }
   t1 = dart.getImplicitFunctionType(t1);
   if (!t1) return false;
   if (dart.isFunctionType(t1) && dart.isFunctionType(t2)) {
-    return dart.isFunctionSubtype(t1, t2, covariant);
+    return dart.isFunctionSubtype(t1, t2, isCovariant);
   }
   if (t1 instanceof dart.LazyJSType && t2 instanceof dart.LazyJSType) {
-    return dart.isLazyJSSubtype(t1, t2, covariant);
+    return dart.isLazyJSSubtype(t1, t2, isCovariant);
   }
   return false;
 };
-dart.isClassSubType = function(t1, t2, covariant) {
+dart.isClassSubType = function(t1, t2, isCovariant) {
   if (t1 == t2) return true;
   if (t1 == core.Object) return false;
   if (t1 == null) return t2 == core.Object || t2 == dart.dynamic;
@@ -1457,16 +1787,25 @@
     }
     dart.assert(length == typeArguments2.length);
     for (let i = 0; i < length; ++i) {
-      let result = dart._isSubtype(typeArguments1[i], typeArguments2[i], covariant);
+      let result = dart._isSubtype(typeArguments1[i], typeArguments2[i], isCovariant);
       if (!result) {
         return result;
       }
     }
     return true;
   }
+  if (raw1 === dart.getGenericClass(async.FutureOr)) {
+    let t1TypeArg = dart.getGenericArgs(t1)[0];
+    let t1Future = dart.getGenericClass(async.Future)(t1TypeArg);
+    return dart.isSubtype(t1Future, t2) && dart.isSubtype(t1TypeArg, t2);
+  } else if (raw2 === dart.getGenericClass(async.FutureOr)) {
+    let t2TypeArg = dart.getGenericArgs(t2)[0];
+    let t2Future = dart.getGenericClass(async.Future)(t2TypeArg);
+    return dart.isSubtype(t1, t2Future) || dart.isSubtype(t1, t2TypeArg);
+  }
   let indefinite = false;
   function definitive(t1, t2) {
-    let result = dart.isClassSubType(t1, t2, covariant);
+    let result = dart.isClassSubType(t1, t2, isCovariant);
     if (result == null) {
       indefinite = true;
       return false;
@@ -1511,32 +1850,47 @@
   }
   return true;
 };
+dart.trapRuntimeErrors = function(flag) {
+  dart._trapRuntimeErrors = flag;
+};
 dart.throwCastError = function(object, actual, type) {
-  debugger;
-  dart.throw(new _js_helper.CastErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
+  var found = dart.typeName(actual);
+  var expected = dart.typeName(type);
+  if (dart._trapRuntimeErrors) debugger;
+  dart.throw(new _js_helper.CastErrorImplementation(object, found, expected));
 };
 dart.throwTypeError = function(object, actual, type) {
-  debugger;
-  dart.throw(new _js_helper.TypeErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
+  var found = dart.typeName(actual);
+  var expected = dart.typeName(type);
+  if (dart._trapRuntimeErrors) debugger;
+  dart.throw(new _js_helper.TypeErrorImplementation(object, found, expected));
 };
 dart.throwStrongModeCastError = function(object, actual, type) {
-  debugger;
-  dart.throw(new _js_helper.StrongModeCastError(object, dart.typeName(actual), dart.typeName(type)));
+  var found = dart.typeName(actual);
+  var expected = dart.typeName(type);
+  if (dart._trapRuntimeErrors) debugger;
+  dart.throw(new _js_helper.StrongModeCastError(object, found, expected));
 };
 dart.throwStrongModeTypeError = function(object, actual, type) {
-  debugger;
-  dart.throw(new _js_helper.StrongModeTypeError(object, dart.typeName(actual), dart.typeName(type)));
+  var found = dart.typeName(actual);
+  var expected = dart.typeName(type);
+  if (dart._trapRuntimeErrors) debugger;
+  dart.throw(new _js_helper.StrongModeTypeError(object, found, expected));
 };
 dart.throwUnimplementedError = function(message) {
-  debugger;
+  if (dart._trapRuntimeErrors) debugger;
   dart.throw(new core.UnimplementedError(message));
 };
-dart.throwAssertionError = function() {
-  debugger;
-  dart.throw(new core.AssertionError());
+dart.throwAssertionError = function(message) {
+  if (message === void 0) message = null;
+  return (() => {
+    if (dart._trapRuntimeErrors) debugger;
+    let error = message != null ? new _js_helper.AssertionErrorWithMessage(message()) : new core.AssertionError();
+    dart.throw(error);
+  })();
 };
 dart.throwNullValueError = function() {
-  debugger;
+  if (dart._trapRuntimeErrors) debugger;
   dart.throw(new core.NoSuchMethodError(null, new core.Symbol('<Unexpected Null Value>'), null, null, null));
 };
 dart.syncStar = function(gen, E, ...args) {
@@ -1560,7 +1914,7 @@
     }
     return future.then(dart.dynamic)(onValue, {onError: onError});
   }
-  return dart.getGenericClass(async.Future)(T).new(function() {
+  return dart.getGenericClass(async.Future)(T).microtask(function() {
     iter = gen.apply(null, args)[Symbol.iterator]();
     return onValue();
   });
@@ -1572,24 +1926,70 @@
   let f = dart._canonicalMember(obj, field);
   dart._trackCall(obj);
   if (f != null) {
-    if (dart.test(dart.hasMethod(obj, f))) return dart.bind(obj, f, void 0);
-    return obj[f];
+    let type = dart.getType(obj);
+    if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
+    if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
+    if (dart.test(dart.isJsInterop(obj))) return obj[f];
   }
-  return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(field), [], {isGetter: true}));
+  return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
+};
+dart.dloadMirror = function(obj, field) {
+  let f = dart._canonicalMember(obj, field);
+  dart._trackCall(obj);
+  if (f != null) {
+    let type = dart.getType(obj);
+    if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
+    if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
+  }
+  return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
+};
+dart._stripGenericArguments = function(type) {
+  let genericClass = dart.getGenericClass(type);
+  if (genericClass != null) return genericClass();
+  return type;
+};
+dart.dputMirror = function(obj, field, value) {
+  let f = dart._canonicalMember(obj, field);
+  dart._trackCall(obj);
+  if (f != null) {
+    let objType = dart.getType(obj);
+    let setterType = dart.getSetterType(objType, f);
+    if (setterType != void 0) {
+      return obj[f] = dart.check(value, dart._stripGenericArguments(setterType.args[0]));
+    } else {
+      let fieldType = dart.getFieldType(objType, f);
+      if (fieldType != void 0) {
+        return obj[f] = dart.check(value, dart._stripGenericArguments(fieldType));
+      }
+    }
+  }
+  return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [value], {isSetter: true}));
 };
 dart.dput = function(obj, field, value) {
   let f = dart._canonicalMember(obj, field);
   dart._trackCall(obj);
   if (f != null) {
-    return obj[f] = value;
+    let objType = dart.getType(obj);
+    let setterType = dart.getSetterType(objType, f);
+    if (setterType != void 0) {
+      return obj[f] = dart.check(value, setterType.args[0]);
+    } else {
+      let fieldType = dart.getFieldType(objType, f);
+      if (fieldType != void 0) {
+        return obj[f] = dart.check(value, fieldType);
+      }
+      if (dart.test(dart.isJsInterop(obj))) {
+        return obj[f] = value;
+      }
+    }
   }
-  return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(field), [value], {isSetter: true}));
+  return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [value], {isSetter: true}));
 };
 dart._checkApply = function(type, actuals) {
   if (actuals.length < type.args.length) return false;
   let index = 0;
   for (let i = 0; i < type.args.length; ++i) {
-    if (!dart.instanceOfOrNull(actuals[i], type.args[i])) return false;
+    dart.check(actuals[i], type.args[i]);
     ++index;
   }
   if (actuals.length == type.args.length) return true;
@@ -1597,7 +1997,7 @@
   if (type.optionals.length > 0) {
     if (extras > type.optionals.length) return false;
     for (let i = 0, j = index; i < extras; ++i, ++j) {
-      if (!dart.instanceOfOrNull(actuals[j], type.optionals[i])) return false;
+      dart.check(actuals[j], type.optionals[i]);
     }
     return true;
   }
@@ -1610,12 +2010,40 @@
     if (!dart.hasOwnProperty.call(type.named, name)) {
       return false;
     }
-    if (!dart.instanceOfOrNull(opts[name], type.named[name])) return false;
+    dart.check(opts[name], type.named[name]);
   }
   return true;
 };
+dart._toSymbolName = function(symbol) {
+  let str = symbol.toString();
+  return str.substring(7, str.length - 1);
+};
+dart._toDisplayName = function(name) {
+  if (name[0] === '_') {
+    switch (name) {
+      case '_get':
+      {
+        return '[]';
+      }
+      case '_set':
+      {
+        return '[]=';
+      }
+      case '_negate':
+      {
+        return 'unary-';
+      }
+      case '_constructor':
+      case '_prototype':
+      {
+        return name.substring(1);
+      }
+    }
+  }
+  return name;
+};
 dart._dartSymbol = function(name) {
-  return dart.const(core.Symbol.new(name.toString()));
+  return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.Symbol.es6(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
 };
 dart.extractNamedArgs = function(args) {
   if (args.length > 0) {
@@ -1634,7 +2062,7 @@
   }
   if (!(f instanceof Function)) {
     if (f != null) {
-      ftype = dart.getMethodType(f, 'call');
+      ftype = dart.getMethodType(dart.getType(f), 'call');
       f = f.call;
     }
     if (!(f instanceof Function)) {
@@ -1739,16 +2167,17 @@
     }
   }
   let actualTypeName = dart.typeName(actual);
-  let o = dart._callMethodStats[dartx.putIfAbsent](dart.str`${actualTypeName} <${src}>`, dart.fn(() => new dart._MethodStats(core.String._check(actualTypeName), src), VoidTo_MethodStats()));
+  let o = dart._callMethodStats[dartx.putIfAbsent](dart.str`${actualTypeName} <${src}>`, dart.fn(() => new dart._MethodStats(actualTypeName, src), VoidTo_MethodStats()));
   o.count = dart.notNull(o.count) + 1;
 };
 dart._callMethod = function(obj, name, typeArgs, args, displayName) {
   let symbol = dart._canonicalMember(obj, name);
   if (symbol == null) {
-    return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(displayName), core.List._check(args), {isMethod: true}));
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(displayName, core.List._check(args), {isMethod: true}));
   }
   let f = obj != null ? obj[symbol] : null;
-  let ftype = dart.getMethodType(obj, symbol);
+  let type = dart.getType(obj);
+  let ftype = dart.getMethodType(type, symbol);
   return dart._checkAndCall(f, ftype, obj, typeArgs, args, displayName);
 };
 dart.dsend = function(obj, method, ...args) {
@@ -1793,6 +2222,9 @@
   return false;
 };
 dart.is = function(obj, type) {
+  if (obj == null) {
+    return type == core.Null || dart._isTop(type);
+  }
   let result = dart.strongInstanceOf(obj, type);
   if (result !== null) return result;
   let actual = dart.getReifiedType(obj);
@@ -1894,18 +2326,19 @@
     return map;
   })();
 };
-dart.assert = function(condition) {
-  if (!condition) dart.throwAssertionError();
+dart.assert = function(condition, message) {
+  if (message === void 0) message = null;
+  return (() => {
+    if (!condition) dart.throwAssertionError(message);
+  })();
 };
 dart.throw = function(obj) {
-  if (obj != null && (typeof obj == 'object' || typeof obj == 'function')) {
-    dart._stack.set(obj, new Error());
-  }
+  dart._stack = new Error();
   throw obj;
 };
 dart.getError = function(exception) {
-  var stack = dart._stack.get(exception);
-  return stack !== void 0 ? stack : exception;
+  var stack = dart._stack;
+  return stack !== null ? stack : exception;
 };
 dart.stackPrint = function(exception) {
   var error = dart.getError(exception);
@@ -2067,11 +2500,11 @@
   return Object.getOwnPropertySymbols(obj);
 };
 dart.throwStrongModeError = function(message) {
-  debugger;
+  if (dart.test(dart._trapRuntimeErrors)) debugger;
   throw new _js_helper.StrongModeErrorImplementation(message);
 };
 dart.throwInternalError = function(message) {
-  debugger;
+  if (dart.test(dart._trapRuntimeErrors)) debugger;
   throw Error(message);
 };
 dart.getOwnNamesAndSymbols = function(obj) {
@@ -2138,7 +2571,56 @@
 dart.copyProperties = function(to, from) {
   return dart.copyTheseProperties(to, from, dart.getOwnNamesAndSymbols(from));
 };
-dart.global = typeof window == "undefined" ? global : window;
+dart.global = (function() {
+  if (typeof NodeList !== "undefined") {
+    NodeList.prototype.get = function(i) {
+      return this[i];
+    };
+    NamedNodeMap.prototype.get = function(i) {
+      return this[i];
+    };
+    DOMTokenList.prototype.get = function(i) {
+      return this[i];
+    };
+    HTMLCollection.prototype.get = function(i) {
+      return this[i];
+    };
+    if (typeof PannerNode == "undefined") {
+      let audioContext;
+      if (typeof AudioContext == "undefined" && typeof webkitAudioContext != "undefined") {
+        audioContext = new webkitAudioContext();
+      } else {
+        audioContext = new AudioContext();
+        window.StereoPannerNode = audioContext.createStereoPanner().constructor;
+      }
+      window.PannerNode = audioContext.createPanner().constructor;
+    }
+    if (typeof AudioSourceNode == "undefined") {
+      window.AudioSourceNode = MediaElementAudioSourceNode.__proto__;
+    }
+    if (typeof FontFaceSet == "undefined") {
+      window.FontFaceSet = document.fonts.__proto__.constructor;
+    }
+    if (typeof MemoryInfo == "undefined") {
+      if (typeof window.performance.memory != "undefined") {
+        window.MemoryInfo = window.performance.memory.constructor;
+      }
+    }
+    if (typeof Geolocation == "undefined") {
+      navigator.geolocation.constructor;
+    }
+    if (typeof Animation == "undefined") {
+      let d = document.createElement('div');
+      if (typeof d.animate != "undefined") {
+        window.Animation = d.animate(d).constructor;
+      }
+    }
+    if (typeof SourceBufferList == "undefined") {
+      window.SourceBufferList = new MediaSource().sourceBuffers.constructor;
+    }
+  }
+  return typeof window == "undefined" ? global : window;
+})();
 dart.JsSymbol = Symbol;
 dart._mixins = Symbol("mixins");
 dart.implements = Symbol("implements");
@@ -2290,198 +2772,189 @@
     this[_wrappedType] = wrappedType;
   }
   toString() {
-    return core.String._check(dart.typeName(this[_wrappedType]));
+    return dart.typeName(this[_wrappedType]);
   }
 };
 dart.setSignature(dart.WrappedType, {
   constructors: () => ({new: dart.definiteFunctionType(dart.WrappedType, [dart.dynamic])}),
   fields: () => ({[_wrappedType]: dart.dynamic})
 });
+const _stringValue = Symbol('_stringValue');
 dart.AbstractFunctionType = class AbstractFunctionType extends dart.TypeRep {
-  constructor() {
-    super();
-    this._stringValue = null;
+  new() {
+    this[_stringValue] = null;
+    super.new();
   }
   toString() {
     return this.name;
   }
   get name() {
-    if (this._stringValue) return this._stringValue;
+    if (this[_stringValue] != null) return this[_stringValue];
     let buffer = '(';
     for (let i = 0; i < this.args.length; ++i) {
       if (i > 0) {
-        buffer += ', ';
+        buffer = dart.notNull(buffer) + ', ';
       }
-      buffer += dart.typeName(this.args[i]);
+      buffer = dart.notNull(buffer) + dart.notNull(dart.typeName(this.args[i]));
     }
     if (this.optionals.length > 0) {
-      if (this.args.length > 0) buffer += ', ';
-      buffer += '[';
+      if (this.args.length > 0) {
+        buffer = dart.notNull(buffer) + ', ';
+      }
+      buffer = dart.notNull(buffer) + '[';
       for (let i = 0; i < this.optionals.length; ++i) {
         if (i > 0) {
-          buffer += ', ';
+          buffer = dart.notNull(buffer) + ', ';
         }
-        buffer += dart.typeName(this.optionals[i]);
+        buffer = dart.notNull(buffer) + dart.notNull(dart.typeName(this.optionals[i]));
       }
-      buffer += ']';
+      buffer = dart.notNull(buffer) + ']';
     } else if (Object.keys(this.named).length > 0) {
-      if (this.args.length > 0) buffer += ', ';
-      buffer += '{';
-      let names = dart.getOwnPropertyNames(this.named).sort();
+      if (this.args.length > 0) {
+        buffer = dart.notNull(buffer) + ', ';
+      }
+      buffer = dart.notNull(buffer) + '{';
+      let names = dart.getOwnPropertyNames(this.named);
+      names.sort();
       for (let i = 0; i < names.length; ++i) {
         if (i > 0) {
-          buffer += ', ';
+          buffer = dart.notNull(buffer) + ', ';
         }
-        buffer += names[i] + ': ' + dart.typeName(this.named[names[i]]);
+        let typeNameString = dart.typeName(this.named[names[i]]);
+        buffer = dart.notNull(buffer) + dart.str`${names[i]}: ${typeNameString}`;
       }
-      buffer += '}';
+      buffer = dart.notNull(buffer) + '}';
     }
-    buffer += ') -> ' + dart.typeName(this.returnType);
-    this._stringValue = buffer;
+    let returnTypeName = dart.typeName(this.returnType);
+    buffer = dart.notNull(buffer) + dart.str`) -> ${returnTypeName}`;
+    this[_stringValue] = buffer;
     return buffer;
   }
 };
+dart.setSignature(dart.AbstractFunctionType, {
+  constructors: () => ({new: dart.definiteFunctionType(dart.AbstractFunctionType, [])}),
+  fields: () => ({[_stringValue]: core.String})
+});
 dart._fnTypeNamedArgMap = new Map();
 dart._fnTypeArrayArgMap = new Map();
 dart._fnTypeTypeMap = new Map();
 dart._fnTypeSmallMap = [new Map(), new Map(), new Map()];
+const _process = Symbol('_process');
 dart.FunctionType = class FunctionType extends dart.AbstractFunctionType {
-  static _memoizeArray(map, arr, create) {
-    let len = arr.length;
-    map = FunctionType._lookupNonTerminal(map, len);
-    for (var i = 0; i < len - 1; ++i) {
-      map = FunctionType._lookupNonTerminal(map, arr[i]);
-    }
-    let result = map.get(arr[len - 1]);
-    if (result !== void 0) return result;
-    map.set(arr[len - 1], result = create());
-    return result;
-  }
-  static _normalizeParameter(a) {
-    if (a instanceof Array) {
-      let result = [];
-      result.push(a[0] == dart.dynamic ? dart.bottom : a[0]);
-      result.push(a.slice(1));
-      return result;
-    }
-    return a == dart.dynamic ? dart.bottom : a;
-  }
-  static _canonicalizeArray(definite, array, map) {
-    let arr = definite ? array : array.map(FunctionType._normalizeParameter);
-    return FunctionType._memoizeArray(map, arr, () => arr);
-  }
-  static _canonicalizeNamed(definite, named, map) {
-    let key = [];
-    let names = dart.getOwnPropertyNames(named);
-    let r = {};
-    for (var i = 0; i < names.length; ++i) {
-      let name = names[i];
-      let type = named[name];
-      if (!definite) r[name] = type = FunctionType._normalizeParameter(type);
-      key.push(name);
-      key.push(type);
-    }
-    if (!definite) named = r;
-    return FunctionType._memoizeArray(map, key, () => named);
-  }
-  static _lookupNonTerminal(map, key) {
-    let result = map.get(key);
-    if (result !== void 0) return result;
-    map.set(key, result = new Map());
-    return result;
-  }
-  static _createSmall(count, definite, returnType, required) {
-    let map = dart._fnTypeSmallMap[count];
-    let args = definite ? required : required.map(FunctionType._normalizeParameter);
-    for (var i = 0; i < count; ++i) {
-      map = FunctionType._lookupNonTerminal(map, args[i]);
-    }
-    let result = map.get(returnType);
-    if (result !== void 0) return result;
-    result = new FunctionType(returnType, args, [], {});
-    map.set(returnType, result);
-    return result;
-  }
   static create(definite, returnType, args, extra) {
     if (extra === void 0 && args.length < 3) {
-      return FunctionType._createSmall(args.length, definite, returnType, args);
+      return dart._createSmall(args.length, definite, returnType, args);
     }
-    args = FunctionType._canonicalizeArray(definite, args, dart._fnTypeArrayArgMap);
-    let keys;
-    let create;
+    args = dart._canonicalizeArray(definite, args, dart._fnTypeArrayArgMap);
+    let keys = null;
+    let create = null;
     if (extra === void 0) {
       keys = [returnType, args];
-      create = () => new FunctionType(returnType, args, [], {});
+      create = dart.fn(() => new dart.FunctionType(returnType, args, [], {}), VoidToFunctionType());
     } else if (extra instanceof Array) {
-      let optionals = FunctionType._canonicalizeArray(definite, extra, dart._fnTypeArrayArgMap);
+      let optionals = dart._canonicalizeArray(definite, extra, dart._fnTypeArrayArgMap);
       keys = [returnType, args, optionals];
-      create = () => new FunctionType(returnType, args, optionals, {});
+      create = dart.fn(() => new dart.FunctionType(returnType, args, optionals, {}), VoidToFunctionType());
     } else {
-      let named = FunctionType._canonicalizeNamed(definite, extra, dart._fnTypeNamedArgMap);
+      let named = dart._canonicalizeNamed(definite, extra, dart._fnTypeNamedArgMap);
       keys = [returnType, args, named];
-      create = () => new FunctionType(returnType, args, [], named);
+      create = dart.fn(() => new dart.FunctionType(returnType, args, [], named), VoidToFunctionType());
     }
-    return FunctionType._memoizeArray(dart._fnTypeTypeMap, keys, create);
+    return dart._memoizeArray(dart._fnTypeTypeMap, keys, create);
   }
-  constructor(returnType, args, optionals, named) {
-    super();
+  [_process](array, metadata) {
+    let result = [];
+    for (let i = 0; i < array.length; ++i) {
+      let arg = array[i];
+      if (arg instanceof Array) {
+        dart.dsend(metadata, 'add', arg.slice(1));
+        result[dartx.add](arg[0]);
+      } else {
+        metadata.push([]);
+        result.push(arg);
+      }
+    }
+    return result;
+  }
+  new(returnType, args, optionals, named) {
     this.returnType = returnType;
     this.args = args;
     this.optionals = optionals;
     this.named = named;
+    this.metadata = null;
+    super.new();
     this.metadata = [];
-    function process(array, metadata) {
-      var result = [];
-      for (var i = 0; i < array.length; ++i) {
-        var arg = array[i];
-        if (arg instanceof Array) {
-          metadata.push(arg.slice(1));
-          result.push(arg[0]);
-        } else {
-          metadata.push([]);
-          result.push(arg);
-        }
-      }
-      return result;
-    }
-    this.args = process(this.args, this.metadata);
-    this.optionals = process(this.optionals, this.metadata);
+    this.args = this[_process](this.args, this.metadata);
+    this.optionals = this[_process](this.optionals, this.metadata);
   }
 };
+dart.setSignature(dart.FunctionType, {
+  constructors: () => ({new: dart.definiteFunctionType(dart.FunctionType, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])}),
+  fields: () => ({
+    returnType: dart.dynamic,
+    args: dart.dynamic,
+    optionals: dart.dynamic,
+    named: dart.dynamic,
+    metadata: dart.dynamic
+  }),
+  methods: () => ({[_process]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])}),
+  statics: () => ({create: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])}),
+  names: ['create']
+});
+const _name = Symbol('_name');
+const _closure = Symbol('_closure');
+const _functionType = Symbol('_functionType');
 dart.Typedef = class Typedef extends dart.AbstractFunctionType {
-  constructor(name, closure) {
-    super();
-    this._name = name;
-    this._closure = closure;
-    this._functionType = null;
+  new(name, closure) {
+    this[_name] = name;
+    this[_closure] = closure;
+    this[_functionType] = null;
+    super.new();
   }
   get name() {
-    return this._name;
+    return core.String._check(this[_name]);
   }
   get functionType() {
-    if (!this._functionType) {
-      this._functionType = this._closure();
+    if (this[_functionType] == null) {
+      this[_functionType] = this[_closure]();
     }
-    return this._functionType;
+    return this[_functionType];
   }
   get returnType() {
     return this.functionType.returnType;
   }
   get args() {
-    return this.functionType.args;
+    return core.List._check(this.functionType.args);
   }
   get optionals() {
-    return this.functionType.optionals;
+    return core.List._check(this.functionType.optionals);
   }
   get named() {
     return this.functionType.named;
   }
   get metadata() {
-    return this.functionType.metadata;
+    return core.List._check(this.functionType.metadata);
   }
 };
+dart.setSignature(dart.Typedef, {
+  constructors: () => ({new: dart.definiteFunctionType(dart.Typedef, [dart.dynamic, dart.dynamic])}),
+  fields: () => ({
+    [_name]: dart.dynamic,
+    [_closure]: dart.dynamic,
+    [_functionType]: dart.AbstractFunctionType
+  }),
+  getters: () => ({
+    functionType: dart.definiteFunctionType(dart.AbstractFunctionType, []),
+    returnType: dart.definiteFunctionType(dart.dynamic, []),
+    args: dart.definiteFunctionType(core.List, []),
+    optionals: dart.definiteFunctionType(core.List, []),
+    named: dart.definiteFunctionType(dart.dynamic, []),
+    metadata: dart.definiteFunctionType(core.List, [])
+  })
+});
 dart._typeFormalCount = Symbol("_typeFormalCount");
 dart.isSubtype = dart._subtypeMemo((t1, t2) => t1 === t2 || dart._isSubtype(t1, t2, true));
+dart._trapRuntimeErrors = true;
 dart._jsIterator = Symbol("_jsIterator");
 dart._current = Symbol("_current");
 dart._AsyncStarStreamController = class _AsyncStarStreamController {
@@ -2614,7 +3087,7 @@
   }
 };
 dart.setSignature(dart.InvocationImpl, {
-  constructors: () => ({new: dart.definiteFunctionType(dart.InvocationImpl, [core.String, core.List], {namedArguments: dart.dynamic, isMethod: core.bool, isGetter: core.bool, isSetter: core.bool})}),
+  constructors: () => ({new: dart.definiteFunctionType(dart.InvocationImpl, [dart.dynamic, core.List], {namedArguments: dart.dynamic, isMethod: core.bool, isGetter: core.bool, isSetter: core.bool})}),
   fields: () => ({
     memberName: core.Symbol,
     positionalArguments: core.List,
@@ -2663,7 +3136,7 @@
     return false;
   });
 })();
-dart._stack = new WeakMap();
+dart._stack = null;
 dart._value = Symbol("_value");
 dart.constants = new Map();
 dart.constantLists = new Map();
@@ -2758,8 +3231,8 @@
 dart.lazyFn(_debugger.getObjectTypeName, () => dynamicToString());
 _debugger.getTypeName = function(type) {
   let name = dart.typeName(type);
-  if (dart.equals(name, 'JSArray<dynamic>') || dart.equals(name, 'JSObject<Array>')) return 'List<dynamic>';
-  return core.String._check(name);
+  if (name == 'JSArray<dynamic>' || name == 'JSObject<Array>') return 'List<dynamic>';
+  return name;
 };
 dart.lazyFn(_debugger.getTypeName, () => TypeToString());
 _debugger._getType = function(object) {
@@ -2862,7 +3335,7 @@
     if (dart.notNull(this.length) <= dart.notNull(_debugger._maxSpanLength)) {
       this.asMap()[dartx.forEach](dart.fn((i, element) => {
         children[dartx.add](new _debugger.NameValuePair({name: dart.toString(dart.notNull(i) + dart.notNull(this.start)), value: element}));
-      }, intAnddynamicTovoid()));
+      }, intAnddynamicToNull()));
     } else {
       for (let i = this.start; dart.notNull(i) < dart.notNull(this.end); i = dart.notNull(i) + dart.notNull(this.subsetSize)) {
         let subSpan = new _debugger.IterableSpan(i, math.min(core.int)(this.end, dart.notNull(this.subsetSize) + dart.notNull(i)), this.iterable);
@@ -3155,7 +3628,7 @@
       protoChain[dartx.add](current);
       current = _debugger.safeGetProperty(current, '__proto__');
     }
-    for (/* Unimplemented unknown name */current of protoChain) {
+    for (current of protoChain) {
       for (let symbol of _debugger.getOwnPropertySymbols(current)) {
         let dartName = _debugger.symbolName(symbol);
         if (dart.test(_debugger.hasMethod(object, dartName))) {
@@ -3171,7 +3644,7 @@
         properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
       }
     }
-    for (/* Unimplemented unknown name */current of protoChain) {
+    for (current of protoChain) {
       let className = dart.dload(dart.getReifiedType(current), 'name');
       for (let name of _debugger.getOwnPropertyNames(current)) {
         if (dart.test(_debugger.ObjectFormatter._customNames.contains(name)) || dart.equals(name, className)) continue;
@@ -3263,14 +3736,14 @@
       } else {
         nonGenericProperties._set(core.String._check(name), value);
       }
-    }, dynamicAnddynamicTodynamic()));
+    }, dynamicAnddynamicToNull()));
     nonGenericProperties.forEach(dart.fn((name, value) => {
       if (core.Type.is(value)) {
         children.add(_debugger.NameValuePair._check(this.classChild(name, value)));
       } else {
         children.add(new _debugger.NameValuePair({name: name, value: value}));
       }
-    }, StringAndObjectTovoid()));
+    }, StringAndObjectToNull()));
     return children.toList();
   }
   recordGenericParameters(name, genericTypeConstructor) {
@@ -3307,7 +3780,7 @@
     return true;
   }
   preview(object) {
-    return core.String._check(dart.typeName(dart.getReifiedType(object)));
+    return dart.typeName(dart.getReifiedType(object));
   }
   children(object) {
     return JSArrayOfNameValuePair().of([new _debugger.NameValuePair({name: 'signature', value: this.preview(object)}), new _debugger.NameValuePair({name: 'JavaScript Function', value: object, config: _debugger.JsonMLConfig.skipDart})]);
@@ -3339,7 +3812,7 @@
     map[dartx.forEach](dart.fn((key, value) => {
       let entryWrapper = new _debugger.MapEntry({key: key, value: value});
       entries.add(new _debugger.NameValuePair({name: dart.toString(entries.length), value: entryWrapper}));
-    }, dynamicAnddynamicTovoid()));
+    }, dynamicAnddynamicToNull()));
     _debugger.addMetadataChildren(object, entries);
     return entries.toList();
   }
@@ -7018,30 +7491,8 @@
   ListIterable[dart.implements] = () => [_internal.EfficientLength];
   dart.setSignature(ListIterable, {
     constructors: () => ({new: dart.definiteFunctionType(_internal.ListIterable$(E), [])}),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-      first: dart.definiteFunctionType(E, []),
-      last: dart.definiteFunctionType(E, []),
-      single: dart.definiteFunctionType(E, [])
-    }),
-    methods: () => ({
-      forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-      every: dart.definiteFunctionType(core.bool, [ETobool()]),
-      any: dart.definiteFunctionType(core.bool, [ETobool()]),
-      firstWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-      lastWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-      singleWhere: dart.definiteFunctionType(E, [ETobool()]),
-      where: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-      map: dart.definiteFunctionType(T => [core.Iterable$(T), [dart.functionType(T, [E])]]),
-      reduce: dart.definiteFunctionType(E, [dynamicAndEToE()]),
-      fold: dart.definiteFunctionType(T => [T, [T, dart.functionType(T, [T, E])]]),
-      skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-      skipWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-      take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-      takeWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-      toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
-      toSet: dart.definiteFunctionType(core.Set$(E), [])
-    })
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
+    methods: () => ({reduce: dart.definiteFunctionType(E, [dynamicAndEToE()])})
   });
   dart.defineExtensionMembers(ListIterable, [
     'forEach',
@@ -7167,12 +7618,6 @@
     getters: () => ({
       [_endIndex]: dart.definiteFunctionType(core.int, []),
       [_startIndex]: dart.definiteFunctionType(core.int, [])
-    }),
-    methods: () => ({
-      elementAt: dart.definiteFunctionType(E, [core.int]),
-      skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-      take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-      toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool})
     })
   });
   dart.defineExtensionMembers(SubListIterable, [
@@ -7287,13 +7732,7 @@
       [_iterable]: IterableOfS(),
       [_f]: _TransformationOfS$T()
     }),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(T), []),
-      first: dart.definiteFunctionType(T, []),
-      last: dart.definiteFunctionType(T, []),
-      single: dart.definiteFunctionType(T, [])
-    }),
-    methods: () => ({elementAt: dart.definiteFunctionType(T, [core.int])})
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(T), [])})
   });
   dart.defineExtensionMembers(MappedIterable, [
     'elementAt',
@@ -7386,8 +7825,7 @@
     fields: () => ({
       [_source]: IterableOfS(),
       [_f]: _TransformationOfS$T()
-    }),
-    methods: () => ({elementAt: dart.definiteFunctionType(T, [core.int])})
+    })
   });
   dart.defineExtensionMembers(MappedListIterable, ['elementAt', 'length']);
   return MappedListIterable;
@@ -7736,8 +8174,7 @@
       [_iterable]: IterableOfE(),
       [_skipCount]: core.int
     }),
-    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-    methods: () => ({skip: dart.definiteFunctionType(core.Iterable$(E), [core.int])})
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
   });
   dart.defineExtensionMembers(SkipIterable, ['skip', 'iterator']);
   return SkipIterable;
@@ -7963,31 +8400,8 @@
   EmptyIterable[dart.implements] = () => [_internal.EfficientLength];
   dart.setSignature(EmptyIterable, {
     constructors: () => ({new: dart.definiteFunctionType(_internal.EmptyIterable$(E), [])}),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-      first: dart.definiteFunctionType(E, []),
-      last: dart.definiteFunctionType(E, []),
-      single: dart.definiteFunctionType(E, [])
-    }),
-    methods: () => ({
-      forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-      elementAt: dart.definiteFunctionType(E, [core.int]),
-      every: dart.definiteFunctionType(core.bool, [ETobool()]),
-      any: dart.definiteFunctionType(core.bool, [ETobool()]),
-      firstWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-      lastWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-      singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-      where: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-      map: dart.definiteFunctionType(T => [core.Iterable$(T), [dart.functionType(T, [E])]]),
-      reduce: dart.definiteFunctionType(E, [EAndEToE()]),
-      fold: dart.definiteFunctionType(T => [T, [T, dart.functionType(T, [T, E])]]),
-      skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-      skipWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-      take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-      takeWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-      toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
-      toSet: dart.definiteFunctionType(core.Set$(E), [])
-    })
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
+    methods: () => ({singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()})})
   });
   dart.defineExtensionMembers(EmptyIterable, [
     'forEach',
@@ -8186,8 +8600,7 @@
 dart.addSimpleTypeTests(_internal._ListIndicesIterable);
 dart.setSignature(_internal._ListIndicesIterable, {
   constructors: () => ({new: dart.definiteFunctionType(_internal._ListIndicesIterable, [core.List])}),
-  fields: () => ({[_backedList]: core.List}),
-  methods: () => ({elementAt: dart.definiteFunctionType(core.int, [core.int])})
+  fields: () => ({[_backedList]: core.List})
 });
 dart.defineExtensionMembers(_internal._ListIndicesIterable, ['elementAt', 'length']);
 const _values = Symbol('_values');
@@ -8316,8 +8729,7 @@
   }
   dart.setSignature(ReversedListIterable, {
     constructors: () => ({new: dart.definiteFunctionType(_internal.ReversedListIterable$(E), [IterableOfE()])}),
-    fields: () => ({[_source]: IterableOfE()}),
-    methods: () => ({elementAt: dart.definiteFunctionType(E, [core.int])})
+    fields: () => ({[_source]: IterableOfE()})
   });
   dart.defineExtensionMembers(ReversedListIterable, ['elementAt', 'length']);
   return ReversedListIterable;
@@ -8836,11 +9248,11 @@
   if (_isolate_helper._MainFunctionArgs.is(entry)) {
     rootContext.eval(dart.fn(() => {
       dart.dcall(entry, args);
-    }, VoidTodynamic()));
+    }, VoidToNull()));
   } else if (_isolate_helper._MainFunctionArgsMessage.is(entry)) {
     rootContext.eval(dart.fn(() => {
       dart.dcall(entry, args, null);
-    }, VoidTodynamic()));
+    }, VoidToNull()));
   } else {
     rootContext.eval(core.Function._check(entry));
   }
@@ -8897,13 +9309,14 @@
         f(a, e);
       };
     })(_isolate_helper.IsolateNatives._processWorkerMessage, this.mainManager);
-    self.onmessage = func;
-    self.dartPrint = self.dartPrint || (function(serialize) {
+    _isolate_helper.global.onmessage = func;
+    _isolate_helper.global.dartPrint = _isolate_helper.global.dartPrint || (function(serialize) {
       return function(object) {
-        if (self.console && self.console.log) {
-          self.console.log(object);
+        var _self = _isolate_helper.global;
+        if (_self.console && _self.console.log) {
+          _self.console.log(object);
         } else {
-          self.postMessage(serialize(object));
+          _self.postMessage(serialize(object));
         }
       };
     })(_isolate_helper._Manager._serializePrintMessage);
@@ -9054,8 +9467,8 @@
       if (dart.test(this.errorsAreFatal) && core.identical(this, _isolate_helper._globalState.rootContext)) {
         return;
       }
-      if (self.console && self.console.error) {
-        self.console.error(error, stackTrace);
+      if (_isolate_helper.global.console && _isolate_helper.global.console.error) {
+        _isolate_helper.global.console.error(error, stackTrace);
       } else {
         core.print(error);
         if (stackTrace != null) core.print(stackTrace);
@@ -9281,7 +9694,7 @@
         if (!dart.test(this.runIteration())) return;
         async.Timer.run(next);
       }).bind(this);
-      dart.fn(next, VoidTodynamic());
+      dart.fn(next, VoidToNull());
       next();
     } else {
       while (dart.test(this.runIteration())) {
@@ -9342,13 +9755,13 @@
   methods: () => ({process: dart.definiteFunctionType(dart.void, [])})
 });
 dart.defineLazy(_isolate_helper, {
-  get _global() {
+  get global() {
     return typeof global == 'undefined' ? self : global;
   }
 });
 _isolate_helper._MainManagerStub = class _MainManagerStub extends core.Object {
   postMessage(msg) {
-    _isolate_helper._global.postMessage(msg);
+    _isolate_helper.global.postMessage(msg);
   }
 };
 dart.setSignature(_isolate_helper._MainManagerStub, {
@@ -9358,17 +9771,17 @@
 _isolate_helper._SPAWN_FAILED_SIGNAL = "spawn failed";
 dart.copyProperties(_isolate_helper, {
   get globalWindow() {
-    return _isolate_helper._global.window;
+    return _isolate_helper.global.window;
   }
 });
 dart.copyProperties(_isolate_helper, {
   get globalWorker() {
-    return _isolate_helper._global.Worker;
+    return _isolate_helper.global.Worker;
   }
 });
 dart.copyProperties(_isolate_helper, {
   get globalPostMessageDefined() {
-    return !!_isolate_helper._global.postMessage;
+    return !!_isolate_helper.global.postMessage;
   }
 });
 _isolate_helper._MainFunction = dart.typedef('_MainFunction', () => dart.functionType(dart.dynamic, []));
@@ -9434,7 +9847,7 @@
         let context = new _isolate_helper._IsolateContext();
         _isolate_helper._globalState.topEventLoop.enqueue(context, dart.fn(() => {
           _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate.SendPort._check(replyTo));
-        }, VoidTodynamic()), 'worker-start');
+        }, VoidToNull()), 'worker-start');
         _isolate_helper._globalState.currentContext = context;
         _isolate_helper._globalState.topEventLoop.run();
         break;
@@ -9484,9 +9897,9 @@
     let replyPort = dart.dindex(msg, 'replyPort');
     _isolate_helper.IsolateNatives.spawn(core.String._check(dart.dindex(msg, 'functionName')), core.String._check(dart.dindex(msg, 'uri')), ListOfString()._check(dart.dindex(msg, 'args')), dart.dindex(msg, 'msg'), false, core.bool._check(dart.dindex(msg, 'isSpawnUri')), core.bool._check(dart.dindex(msg, 'startPaused'))).then(dart.dynamic)(dart.fn(msg => {
       dart.dsend(replyPort, 'send', msg);
-    }, ListTodynamic()), {onError: dart.fn(errorMessage => {
+    }, ListToNull()), {onError: dart.fn(errorMessage => {
         dart.dsend(replyPort, 'send', JSArrayOfString().of([_isolate_helper._SPAWN_FAILED_SIGNAL, errorMessage]));
-      }, StringTodynamic())});
+      }, StringToNull())});
   }
   static _log(msg) {
     if (dart.test(_isolate_helper._globalState.isWorker)) {
@@ -9502,7 +9915,7 @@
     }
   }
   static _consoleLog(msg) {
-    self.console.log(msg);
+    _isolate_helper.global.console.log(msg);
   }
   static _getJSFunctionFromName(functionName) {
     let globalFunctionsContainer = _foreign_helper.JS_EMBEDDED_GLOBAL("", _js_embedded_names.GLOBAL_FUNCTIONS);
@@ -9543,7 +9956,7 @@
         dart.assert(dart.equals(dart.dindex(msg, 0), _isolate_helper._SPAWN_FAILED_SIGNAL));
         completer.completeError(dart.dindex(msg, 1));
       }
-    }, dynamicTodynamic()));
+    }, dynamicToNull()));
     let signalReply = port.sendPort;
     if (dart.test(_isolate_helper._globalState.useWorkers) && !dart.test(isLight)) {
       _isolate_helper.IsolateNatives._startWorker(functionName, uri, args, message, isSpawnUri, startPaused, signalReply, dart.fn(message => completer.completeError(message), StringTovoid()));
@@ -9569,7 +9982,7 @@
     _isolate_helper._globalState.topEventLoop.enqueue(new _isolate_helper._IsolateContext(), dart.fn(() => {
       let func = _isolate_helper.IsolateNatives._getJSFunctionFromName(functionName);
       _isolate_helper.IsolateNatives._startIsolate(core.Function._check(func), args, message, isSpawnUri, startPaused, replyPort);
-    }, VoidTodynamic()), 'nonworker start');
+    }, VoidToNull()), 'nonworker start');
   }
   static get currentIsolate() {
     let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
@@ -9714,7 +10127,7 @@
       if (!dart.test(this[_receivePort][_isClosed])) {
         this[_receivePort][_add](msg);
       }
-    }, VoidTodynamic()), dart.str`receive ${message}`);
+    }, VoidToNull()), dart.str`receive ${message}`);
   }
   ['=='](other) {
     return _isolate_helper._NativeJsSendPort.is(other) && dart.equals(this[_receivePort], other[_receivePort]);
@@ -9848,13 +10261,11 @@
   let _EmptyStreamOfT = () => (_EmptyStreamOfT = dart.constFn(async._EmptyStream$(T)))();
   let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
   let _StreamControllerOfT = () => (_StreamControllerOfT = dart.constFn(async._StreamController$(T)))();
-  let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
   let _GeneratedStreamImplOfT = () => (_GeneratedStreamImplOfT = dart.constFn(async._GeneratedStreamImpl$(T)))();
   let _IterablePendingEventsOfT = () => (_IterablePendingEventsOfT = dart.constFn(async._IterablePendingEvents$(T)))();
   let _BoundSinkStreamOfdynamic$T = () => (_BoundSinkStreamOfdynamic$T = dart.constFn(async._BoundSinkStream$(dart.dynamic, T)))();
   let _AsBroadcastStreamOfT = () => (_AsBroadcastStreamOfT = dart.constFn(async._AsBroadcastStream$(T)))();
   let _WhereStreamOfT = () => (_WhereStreamOfT = dart.constFn(async._WhereStream$(T)))();
-  let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
   let _HandleErrorStreamOfT = () => (_HandleErrorStreamOfT = dart.constFn(async._HandleErrorStream$(T)))();
   let StreamConsumerOfT = () => (StreamConsumerOfT = dart.constFn(async.StreamConsumer$(T)))();
   let TAndTToT = () => (TAndTToT = dart.constFn(dart.functionType(T, [T, T])))();
@@ -9869,12 +10280,14 @@
   let _SkipStreamOfT = () => (_SkipStreamOfT = dart.constFn(async._SkipStream$(T)))();
   let _SkipWhileStreamOfT = () => (_SkipWhileStreamOfT = dart.constFn(async._SkipWhileStream$(T)))();
   let _DistinctStreamOfT = () => (_DistinctStreamOfT = dart.constFn(async._DistinctStream$(T)))();
+  let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
   let EventSinkOfT = () => (EventSinkOfT = dart.constFn(async.EventSink$(T)))();
   let _SyncBroadcastStreamControllerOfT = () => (_SyncBroadcastStreamControllerOfT = dart.constFn(async._SyncBroadcastStreamController$(T)))();
   let _SyncStreamControllerOfT = () => (_SyncStreamControllerOfT = dart.constFn(async._SyncStreamController$(T)))();
   let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
   let StreamSubscriptionOfTTovoid = () => (StreamSubscriptionOfTTovoid = dart.constFn(dart.functionType(dart.void, [StreamSubscriptionOfT()])))();
   let TTobool = () => (TTobool = dart.constFn(dart.functionType(core.bool, [T])))();
+  let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
   let TAndTTobool = () => (TAndTTobool = dart.constFn(dart.functionType(core.bool, [T, T])))();
   let EventSinkOfTTovoid = () => (EventSinkOfTTovoid = dart.constFn(dart.functionType(dart.void, [EventSinkOfT()])))();
   let FutureOfT = () => (FutureOfT = dart.constFn(async.Future$(T)))();
@@ -9882,10 +10295,10 @@
   let IterableOfT = () => (IterableOfT = dart.constFn(core.Iterable$(T)))();
   let intToT = () => (intToT = dart.constFn(dart.functionType(T, [core.int])))();
   let EventSinkOfTToEventSink = () => (EventSinkOfTToEventSink = dart.constFn(dart.functionType(async.EventSink, [EventSinkOfT()])))();
-  let TTodynamic$ = () => (TTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [T])))();
+  let TToNull = () => (TToNull = dart.constFn(dart.definiteFunctionType(core.Null, [T])))();
   let VoidTo_IterablePendingEventsOfT = () => (VoidTo_IterablePendingEventsOfT = dart.constFn(dart.definiteFunctionType(_IterablePendingEventsOfT(), [])))();
-  let TTovoid$ = () => (TTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [T])))();
   let VoidToT = () => (VoidToT = dart.constFn(dart.definiteFunctionType(T, [])))();
+  let TTovoid$ = () => (TTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [T])))();
   class Stream extends core.Object {
     new() {
     }
@@ -9899,10 +10312,10 @@
       future.then(dart.dynamic)(dart.fn(value => {
         controller[_add](value);
         controller[_closeUnchecked]();
-      }, TTodynamic$()), {onError: dart.fn((error, stackTrace) => {
+      }, TToNull()), {onError: dart.fn((error, stackTrace) => {
           controller[_addError](error, core.StackTrace._check(stackTrace));
           controller[_closeUnchecked]();
-        }, dynamicAnddynamicTodynamic())});
+        }, dynamicAnddynamicToNull())});
       return controller.stream;
     }
     static fromFutures(futures) {
@@ -9913,13 +10326,13 @@
           controller[_add](value);
           if (--count == 0) controller[_closeUnchecked]();
         }
-      }, TTodynamic$());
+      }, TToNull());
       let onError = dart.fn((error, stack) => {
         if (!dart.test(controller.isClosed)) {
           controller[_addError](error, core.StackTrace._check(stack));
           if (--count == 0) controller[_closeUnchecked]();
         }
-      }, dynamicAnddynamicTodynamic());
+      }, dynamicAnddynamicToNull());
       for (let future of futures) {
         count++;
         future.then(dart.dynamic)(onValue, {onError: onError});
@@ -9956,17 +10369,17 @@
         dart.assert(timer == null);
         timer = async.Timer.periodic(period, dart.fn(timer => {
           sendEvent();
-        }, TimerTovoid()));
+        }, TimerToNull()));
       }
       dart.fn(startPeriodicTimer, VoidTovoid());
       controller = StreamControllerOfT().new({sync: true, onListen: dart.fn(() => {
           watch.start();
           startPeriodicTimer();
-        }, VoidTovoid()), onPause: dart.fn(() => {
+        }, VoidToNull()), onPause: dart.fn(() => {
           timer.cancel();
           timer = null;
           watch.stop();
-        }, VoidTovoid()), onResume: dart.fn(() => {
+        }, VoidToNull()), onResume: dart.fn(() => {
           dart.assert(timer == null);
           let elapsed = watch.elapsed;
           watch.start();
@@ -9974,11 +10387,11 @@
             timer = null;
             startPeriodicTimer();
             sendEvent();
-          }, VoidTovoid()));
-        }, VoidTovoid()), onCancel: dart.fn(() => {
+          }, VoidToNull()));
+        }, VoidToNull()), onCancel: dart.fn(() => {
           if (timer != null) timer.cancel();
           timer = null;
-        }, VoidTodynamic())});
+        }, VoidToNull())});
       return controller.stream;
     }
     static eventTransformed(source, mapSink) {
@@ -10021,25 +10434,25 @@
 
             if (async.Future.is(newValue)) {
               subscription.pause();
-              newValue.then(dart.dynamic)(add, {onError: addError}).whenComplete(dart.bind(subscription, 'resume'));
+              newValue.then(dart.void)(add, {onError: addError}).whenComplete(dart.bind(subscription, 'resume'));
             } else {
               controller.add(E.as(newValue));
             }
-          }, TTovoid$()), {onError: addError, onDone: dart.bind(controller, 'close')});
+          }, TToNull()), {onError: addError, onDone: dart.bind(controller, 'close')});
         }).bind(this);
         dart.fn(onListen, VoidTovoid());
         if (dart.test(this.isBroadcast)) {
           controller = async.StreamController$(E).broadcast({onListen: onListen, onCancel: dart.fn(() => {
               subscription.cancel();
-            }, VoidTovoid()), sync: true});
+            }, VoidToNull()), sync: true});
         } else {
           controller = async.StreamController$(E).new({onListen: onListen, onPause: dart.fn(() => {
               subscription.pause();
-            }, VoidTovoid()), onResume: dart.fn(() => {
+            }, VoidToNull()), onResume: dart.fn(() => {
               subscription.resume();
-            }, VoidTovoid()), onCancel: dart.fn(() => {
+            }, VoidToNull()), onCancel: dart.fn(() => {
               subscription.cancel();
-            }, VoidTodynamic()), sync: true});
+            }, VoidToNull()), sync: true});
         }
         return controller.stream;
       };
@@ -10065,21 +10478,21 @@
               subscription.pause();
               controller.addStream(newStream).whenComplete(dart.bind(subscription, 'resume'));
             }
-          }, TTovoid$()), {onError: dart.bind(eventSink, _addError), onDone: dart.bind(controller, 'close')});
+          }, TToNull()), {onError: dart.bind(eventSink, _addError), onDone: dart.bind(controller, 'close')});
         }).bind(this);
         dart.fn(onListen, VoidTovoid());
         if (dart.test(this.isBroadcast)) {
           controller = async.StreamController$(E).broadcast({onListen: onListen, onCancel: dart.fn(() => {
               subscription.cancel();
-            }, VoidTovoid()), sync: true});
+            }, VoidToNull()), sync: true});
         } else {
           controller = async.StreamController$(E).new({onListen: onListen, onPause: dart.fn(() => {
               subscription.pause();
-            }, VoidTovoid()), onResume: dart.fn(() => {
+            }, VoidToNull()), onResume: dart.fn(() => {
               subscription.resume();
-            }, VoidTovoid()), onCancel: dart.fn(() => {
+            }, VoidToNull()), onCancel: dart.fn(() => {
               subscription.cancel();
-            }, VoidTodynamic()), sync: true});
+            }, VoidToNull()), sync: true});
         }
         return controller.stream;
       };
@@ -10113,12 +10526,12 @@
         if (seenFirst) {
           async._runUserCode(dart.fn(() => combine(value, element), VoidToT()), dart.fn(newValue => {
             value = newValue;
-          }, TTodynamic$()), async._cancelAndErrorClosure(subscription, result));
+          }, TToNull()), async._cancelAndErrorClosure(subscription, result));
         } else {
           value = element;
           seenFirst = true;
         }
-      }, TTovoid$()), {onError: dart.bind(result, _completeError), onDone: dart.fn(() => {
+      }, TToNull()), {onError: dart.bind(result, _completeError), onDone: dart.fn(() => {
           if (!seenFirst) {
             try {
               dart.throw(_internal.IterableElementError.noElement());
@@ -10130,7 +10543,7 @@
           } else {
             result[_complete](value);
           }
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return result;
     }
     fold(S) {
@@ -10141,12 +10554,12 @@
         subscription = this.listen(dart.fn(element => {
           async._runUserCode(dart.fn(() => combine(value, element), dart.definiteFunctionType(S, [])), dart.fn(newValue => {
             value = newValue;
-          }, dart.definiteFunctionType(dart.dynamic, [S])), async._cancelAndErrorClosure(subscription, result));
-        }, TTovoid$()), {onError: dart.fn((e, st) => {
+          }, dart.definiteFunctionType(core.Null, [S])), async._cancelAndErrorClosure(subscription, result));
+        }, TToNull()), {onError: dart.fn((e, st) => {
             result[_completeError](e, core.StackTrace._check(st));
-          }, dynamicAnddynamicTodynamic()), onDone: dart.fn(() => {
+          }, dynamicAnddynamicToNull()), onDone: dart.fn(() => {
             result[_complete](value);
-          }, VoidTovoid()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return result;
       };
     }
@@ -10168,11 +10581,11 @@
           async._cancelAndErrorWithReplacement(subscription, result, e, s);
         }
 
-      }, TTovoid$()), {onError: dart.fn(e => {
+      }, TToNull()), {onError: dart.fn(e => {
           result[_completeError](e);
-        }, dynamicTodynamic()), onDone: dart.fn(() => {
+        }, dynamicToNull()), onDone: dart.fn(() => {
           result[_complete](buffer.toString());
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return result;
     }
     contains(needle) {
@@ -10183,10 +10596,10 @@
           if (dart.test(isMatch)) {
             async._cancelAndValue(subscription, future, true);
           }
-        }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           future[_complete](false);
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     forEach(action) {
@@ -10194,10 +10607,10 @@
       let subscription = null;
       subscription = this.listen(dart.fn(element => {
         async._runUserCode(dart.fn(() => action(element), VoidTovoid()), dart.fn(_ => {
-        }, dynamicTodynamic()), async._cancelAndErrorClosure(subscription, future));
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, dynamicToNull()), async._cancelAndErrorClosure(subscription, future));
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           future[_complete](null);
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     every(test) {
@@ -10208,10 +10621,10 @@
           if (!dart.test(isMatch)) {
             async._cancelAndValue(subscription, future, false);
           }
-        }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           future[_complete](true);
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     any(test) {
@@ -10222,10 +10635,10 @@
           if (dart.test(isMatch)) {
             async._cancelAndValue(subscription, future, true);
           }
-        }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           future[_complete](false);
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     get length() {
@@ -10233,9 +10646,9 @@
       let count = 0;
       this.listen(dart.fn(_ => {
         count++;
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           future[_complete](count);
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     get isEmpty() {
@@ -10243,9 +10656,9 @@
       let subscription = null;
       subscription = this.listen(dart.fn(_ => {
         async._cancelAndValue(subscription, future, false);
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           future[_complete](true);
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     toList() {
@@ -10253,9 +10666,9 @@
       let future = new (_FutureOfListOfT())();
       this.listen(dart.fn(data => {
         result[dartx.add](data);
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           future[_complete](result);
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     toSet() {
@@ -10263,9 +10676,9 @@
       let future = new (_FutureOfSetOfT())();
       this.listen(dart.fn(data => {
         result.add(data);
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           future[_complete](result);
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     drain(E) {
@@ -10295,7 +10708,7 @@
       let subscription = null;
       subscription = this.listen(dart.fn(value => {
         async._cancelAndValue(subscription, future, value);
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           try {
             dart.throw(_internal.IterableElementError.noElement());
           } catch (e) {
@@ -10303,7 +10716,7 @@
             async._completeWithErrorCallback(future, e, s);
           }
 
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     get last() {
@@ -10313,7 +10726,7 @@
       this.listen(dart.fn(value => {
         foundResult = true;
         result = value;
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           if (foundResult) {
             future[_complete](result);
             return;
@@ -10325,7 +10738,7 @@
             async._completeWithErrorCallback(future, e, s);
           }
 
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     get single() {
@@ -10346,7 +10759,7 @@
         }
         foundResult = true;
         result = value;
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           if (foundResult) {
             future[_complete](result);
             return;
@@ -10358,7 +10771,7 @@
             async._completeWithErrorCallback(future, e, s);
           }
 
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     firstWhere(test, opts) {
@@ -10370,8 +10783,8 @@
           if (dart.test(isMatch)) {
             async._cancelAndValue(subscription, future, value);
           }
-        }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           if (defaultValue != null) {
             async._runUserCode(defaultValue, dart.bind(future, _complete), dart.bind(future, _completeError));
             return;
@@ -10383,7 +10796,7 @@
             async._completeWithErrorCallback(future, e, s);
           }
 
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     lastWhere(test, opts) {
@@ -10398,8 +10811,8 @@
             foundResult = true;
             result = value;
           }
-        }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           if (foundResult) {
             future[_complete](result);
             return;
@@ -10415,7 +10828,7 @@
             async._completeWithErrorCallback(future, e, s);
           }
 
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     singleWhere(test) {
@@ -10439,8 +10852,8 @@
             foundResult = true;
             result = value;
           }
-        }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           if (foundResult) {
             future[_complete](result);
             return;
@@ -10452,7 +10865,7 @@
             async._completeWithErrorCallback(future, e, s);
           }
 
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     elementAt(index) {
@@ -10466,9 +10879,9 @@
           return;
         }
         elementIndex = elementIndex + 1;
-      }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+      }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
           future[_completeError](core.RangeError.index(index, this, "index", null, elementIndex));
-        }, VoidTovoid()), cancelOnError: true});
+        }, VoidToNull()), cancelOnError: true});
       return future;
     }
     timeout(timeLimit, opts) {
@@ -10502,7 +10915,7 @@
         if (onTimeout == null) {
           timeout = dart.fn(() => {
             controller.addError(new async.TimeoutException("No stream event", timeLimit), null);
-          }, VoidTovoid());
+          }, VoidToNull());
         } else {
           let registeredOnTimeout = zone.registerUnaryCallback(dart.dynamic, EventSinkOfT())(onTimeout);
           let wrapper = new async._ControllerEventSinkWrapper(null);
@@ -10510,7 +10923,7 @@
             wrapper[_sink] = controller;
             zone.runUnaryGuarded(dart.dynamic, EventSinkOfT())(registeredOnTimeout, wrapper);
             wrapper[_sink] = null;
-          }, VoidTovoid());
+          }, VoidToNull());
         }
         subscription = this.listen(onData, {onError: onError, onDone: onDone});
         timer = zone.createTimer(timeLimit, timeout);
@@ -10526,10 +10939,10 @@
       controller = dart.test(this.isBroadcast) ? new (_SyncBroadcastStreamControllerOfT())(onListen, onCancel) : new (_SyncStreamControllerOfT())(onListen, dart.fn(() => {
         timer.cancel();
         subscription.pause();
-      }, VoidTovoid()), dart.fn(() => {
+      }, VoidToNull()), dart.fn(() => {
         subscription.resume();
         timer = zone.createTimer(timeLimit, timeout);
-      }, VoidTovoid()), onCancel);
+      }, VoidToNull()), onCancel);
       return controller.stream;
     }
   }
@@ -10662,7 +11075,7 @@
       }).bind(this);
       dart.fn(internalCallback, VoidTovoid());
       _isolate_helper.enterJsAsync();
-      this[_handle] = self.setTimeout(internalCallback, milliseconds);
+      this[_handle] = _isolate_helper.global.setTimeout(internalCallback, milliseconds);
     } else {
       dart.assert(dart.notNull(milliseconds) > 0);
       dart.throw(new core.UnsupportedError("Timer greater than 0."));
@@ -10674,9 +11087,9 @@
     this[_handle] = null;
     if (dart.test(_isolate_helper.hasTimer())) {
       _isolate_helper.enterJsAsync();
-      this[_handle] = self.setInterval(dart.fn(() => {
+      this[_handle] = _isolate_helper.global.setInterval(dart.fn(() => {
         callback(this);
-      }, VoidTodynamic()), milliseconds);
+      }, VoidToNull()), milliseconds);
     } else {
       dart.throw(new core.UnsupportedError("Periodic timer."));
     }
@@ -10689,9 +11102,9 @@
       if (this[_handle] == null) return;
       _isolate_helper.leaveJsAsync();
       if (dart.test(this[_once])) {
-        self.clearTimeout(this[_handle]);
+        _isolate_helper.global.clearTimeout(this[_handle]);
       } else {
-        self.clearInterval(this[_handle]);
+        _isolate_helper.global.clearInterval(this[_handle]);
       }
       this[_handle] = null;
     } else {
@@ -10718,7 +11131,7 @@
   methods: () => ({cancel: dart.definiteFunctionType(dart.void, [])})
 });
 _isolate_helper.hasTimer = function() {
-  return self.setTimeout != null;
+  return _isolate_helper.global.setTimeout != null;
 };
 dart.lazyFn(_isolate_helper.hasTimer, () => VoidTobool());
 _isolate_helper.CapabilityImpl = class CapabilityImpl extends core.Object {
@@ -11879,6 +12292,30 @@
   constructors: () => ({new: dart.definiteFunctionType(_js_helper.RuntimeError, [dart.dynamic])}),
   fields: () => ({message: dart.dynamic})
 });
+core.AssertionError = class AssertionError extends core.Error {
+  new() {
+    super.new();
+  }
+  toString() {
+    return "Assertion failed";
+  }
+};
+dart.setSignature(core.AssertionError, {
+  constructors: () => ({new: dart.definiteFunctionType(core.AssertionError, [])})
+});
+_js_helper.AssertionErrorWithMessage = class AssertionErrorWithMessage extends core.AssertionError {
+  new(message) {
+    this[_message] = message;
+    super.new();
+  }
+  toString() {
+    return dart.str`Assertion failed: ${this[_message]}`;
+  }
+};
+dart.setSignature(_js_helper.AssertionErrorWithMessage, {
+  constructors: () => ({new: dart.definiteFunctionType(_js_helper.AssertionErrorWithMessage, [core.Object])}),
+  fields: () => ({[_message]: core.Object})
+});
 _js_helper.random64 = function() {
   let int32a = Math.random() * 0x100000000 >>> 0;
   let int32b = Math.random() * 0x100000000 >>> 0;
@@ -12009,17 +12446,6 @@
   return SyncIterable;
 });
 _js_helper.SyncIterable = SyncIterable();
-core.AssertionError = class AssertionError extends core.Error {
-  new() {
-    super.new();
-  }
-  toString() {
-    return "Assertion failed";
-  }
-};
-dart.setSignature(core.AssertionError, {
-  constructors: () => ({new: dart.definiteFunctionType(core.AssertionError, [])})
-});
 _js_helper.BooleanConversionAssertionError = class BooleanConversionAssertionError extends core.AssertionError {
   new() {
     super.new();
@@ -12094,14 +12520,14 @@
   let LinkedHashMapKeyIterableOfK = () => (LinkedHashMapKeyIterableOfK = dart.constFn(_js_helper.LinkedHashMapKeyIterable$(K)))();
   let MappedIterableOfK$V = () => (MappedIterableOfK$V = dart.constFn(_internal.MappedIterable$(K, V)))();
   let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-  let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
   let LinkedHashMapCellOfK$V = () => (LinkedHashMapCellOfK$V = dart.constFn(_js_helper.LinkedHashMapCell$(K, V)))();
   let LinkedHashMapOfK$V = () => (LinkedHashMapOfK$V = dart.constFn(collection.LinkedHashMap$(K, V)))();
   let InternalMapOfK$V = () => (InternalMapOfK$V = dart.constFn(_js_helper.InternalMap$(K, V)))();
+  let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
   let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
   let KToV = () => (KToV = dart.constFn(dart.definiteFunctionType(V, [K])))();
   let KTobool = () => (KTobool = dart.constFn(dart.definiteFunctionType(core.bool, [K])))();
-  let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+  let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
   class JsLinkedHashMap extends core.Object {
     new() {
       this[_length] = 0;
@@ -12156,7 +12582,7 @@
       MapOfK$V()._check(other);
       other[dartx.forEach](dart.fn((key, value) => {
         this._set(key, value);
-      }, KAndVTovoid$()));
+      }, KAndVToNull()));
     }
     _get(key) {
       if (dart.test(_js_helper.JsLinkedHashMap._isStringKey(key))) {
@@ -12470,12 +12896,6 @@
       return new Map();
     }
   }
-  dart.setSignature(Es6LinkedHashMap, {
-    methods: () => ({
-      [_getTableCell]: dart.definiteFunctionType(_js_helper.LinkedHashMapCell$(K, V), [dart.dynamic, dart.dynamic]),
-      [_getTableBucket]: dart.definiteFunctionType(core.List$(_js_helper.LinkedHashMapCell$(K, V)), [dart.dynamic, dart.dynamic])
-    })
-  });
   return Es6LinkedHashMap;
 });
 _js_helper.Es6LinkedHashMap = Es6LinkedHashMap();
@@ -12540,8 +12960,7 @@
   dart.setSignature(LinkedHashMapKeyIterable, {
     constructors: () => ({new: dart.definiteFunctionType(_js_helper.LinkedHashMapKeyIterable$(E), [JsLinkedHashMapOfE$dynamic()])}),
     fields: () => ({[_map]: JsLinkedHashMapOfE$dynamic()}),
-    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-    methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
   });
   dart.defineExtensionMembers(LinkedHashMapKeyIterable, [
     'contains',
@@ -12989,10 +13408,7 @@
     [_pattern]: core.String,
     [_index]: core.int
   }),
-  getters: () => ({
-    iterator: dart.definiteFunctionType(core.Iterator$(core.Match), []),
-    first: dart.definiteFunctionType(core.Match, [])
-  })
+  getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(core.Match), [])})
 });
 dart.defineExtensionMembers(_js_helper._StringAllMatchesIterable, ['iterator', 'first']);
 _js_helper._StringAllMatchesIterator = class _StringAllMatchesIterator extends core.Object {
@@ -13262,11 +13678,11 @@
   }
 });
 _js_mirrors._dload = function(obj, name) {
-  return _js_mirrors._dart.dload(obj, name);
+  return _js_mirrors._dart.dloadMirror(obj, name);
 };
 dart.lazyFn(_js_mirrors._dload, () => dynamicAndStringTodynamic());
 _js_mirrors._dput = function(obj, name, val) {
-  _js_mirrors._dart.dput(obj, name, val);
+  _js_mirrors._dart.dputMirror(obj, name, val);
 };
 dart.lazyFn(_js_mirrors._dput, () => dynamicAndStringAnddynamicTovoid());
 _js_mirrors._dcall = function(obj, args) {
@@ -13307,7 +13723,31 @@
   if (privateSymbol != null) {
     return privateSymbol;
   }
-  return _js_mirrors.getName(symbol);
+  let name = _js_mirrors.getName(symbol);
+  switch (name) {
+    case '[]':
+    {
+      name = '_get';
+      break;
+    }
+    case '[]=':
+    {
+      name = '_set';
+      break;
+    }
+    case 'unary-':
+    {
+      name = '_negate';
+      break;
+    }
+    case 'constructor':
+    case 'prototype':
+    {
+      name = dart.str`_${name}`;
+      break;
+    }
+  }
+  return name;
 };
 dart.lazyFn(_js_mirrors._getMember, () => SymbolTodynamic());
 _js_mirrors._getNameForESSymbol = function(member) {
@@ -13412,7 +13852,7 @@
   let obj = {};
   map[dartx.forEach](dart.fn((key, value) => {
     obj[_js_mirrors.getName(key)] = value;
-  }, SymbolAnddynamicTovoid()));
+  }, SymbolAnddynamicToNull()));
   return obj;
 };
 dart.lazyFn(_js_mirrors._toJsMap, () => MapOfSymbol$dynamicTodynamic());
@@ -13627,7 +14067,7 @@
       constructors[dartx.forEach](dart.fn((symbol, ft) => {
         let name = _js_mirrors.getName(symbol);
         this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       if (dart.test(constructors[dartx.isEmpty])) {
         let name = 'new';
         let ft = _js_mirrors._defaultConstructorType(_js_mirrors._unwrap(this[_cls]));
@@ -13642,23 +14082,23 @@
           t = dart.dindex(t, 0);
         }
         this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       let methods = _js_mirrors._getMethods(unwrapped);
       methods[dartx.forEach](dart.fn((symbol, ft) => {
         let name = _js_mirrors.getName(symbol);
         this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       let getters = _js_mirrors._getGetters(unwrapped);
       getters[dartx.forEach](dart.fn((symbol, ft) => {
         let name = _js_mirrors.getName(symbol);
         this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       let setters = _js_mirrors._getSetters(unwrapped);
       setters[dartx.forEach](dart.fn((symbol, ft) => {
         let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
         symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
         this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       let staticFields = _js_mirrors._getStaticFields(unwrapped);
       staticFields[dartx.forEach](dart.fn((symbol, t) => {
         let name = _js_mirrors.getName(symbol);
@@ -13668,22 +14108,22 @@
           t = dart.dindex(t, 0);
         }
         this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       let statics = _js_mirrors._getStatics(unwrapped);
       statics[dartx.forEach](dart.fn((symbol, ft) => {
         let name = _js_mirrors.getName(symbol);
         this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       let staticGetters = _js_mirrors._getStaticGetters(unwrapped);
       staticGetters[dartx.forEach](dart.fn((symbol, ft) => {
         let name = _js_mirrors.getName(symbol);
         this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       let staticSetters = _js_mirrors._getStaticSetters(unwrapped);
       staticSetters[dartx.forEach](dart.fn((symbol, ft) => {
         let name = _js_mirrors.getName(symbol);
         this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       this[_declarations] = MapOfSymbol$DeclarationMirror().unmodifiable(this[_declarations]);
     }
     return this[_declarations];
@@ -14937,8 +15377,7 @@
   }),
   methods: () => ({
     _get: dart.definiteFunctionType(typed_data.Float32x4, [core.int]),
-    _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float32x4]),
-    sublist: dart.definiteFunctionType(core.List$(typed_data.Float32x4), [core.int], [core.int])
+    _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float32x4])
   })
 });
 dart.defineExtensionMembers(_native_typed_data.NativeFloat32x4List, [
@@ -15570,8 +16009,7 @@
   }),
   methods: () => ({
     _get: dart.definiteFunctionType(typed_data.Int32x4, [core.int]),
-    _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Int32x4]),
-    sublist: dart.definiteFunctionType(core.List$(typed_data.Int32x4), [core.int], [core.int])
+    _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Int32x4])
   })
 });
 dart.defineExtensionMembers(_native_typed_data.NativeInt32x4List, [
@@ -15687,8 +16125,7 @@
   }),
   methods: () => ({
     _get: dart.definiteFunctionType(typed_data.Float64x2, [core.int]),
-    _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float64x2]),
-    sublist: dart.definiteFunctionType(core.List$(typed_data.Float64x2), [core.int], [core.int])
+    _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float64x2])
   })
 });
 dart.defineExtensionMembers(_native_typed_data.NativeFloat64x2List, [
@@ -16053,8 +16490,7 @@
   getters: () => ({length: dart.definiteFunctionType(core.int, [])}),
   methods: () => ({
     _get: dart.definiteFunctionType(core.double, [core.int]),
-    _set: dart.definiteFunctionType(dart.void, [core.int, core.num]),
-    setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfdouble()], [core.int])
+    _set: dart.definiteFunctionType(dart.void, [core.int, core.num])
   })
 });
 dart.defineExtensionMembers(_native_typed_data.NativeTypedArrayOfDouble, ['_get', '_set', 'setRange', 'length']);
@@ -16087,10 +16523,7 @@
 _native_typed_data.NativeTypedArrayOfInt[dart.implements] = () => [ListOfint()];
 dart.setSignature(_native_typed_data.NativeTypedArrayOfInt, {
   getters: () => ({length: dart.definiteFunctionType(core.int, [])}),
-  methods: () => ({
-    _set: dart.definiteFunctionType(dart.void, [core.int, core.int]),
-    setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfint()], [core.int])
-  })
+  methods: () => ({_set: dart.definiteFunctionType(dart.void, [core.int, core.int])})
 });
 dart.defineExtensionMembers(_native_typed_data.NativeTypedArrayOfInt, ['_set', 'setRange', 'length']);
 dart.defineExtensionNames([
@@ -16134,7 +16567,6 @@
     fromList: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [ListOfdouble()]),
     view: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [typed_data.ByteBuffer, core.int, core.int])
   }),
-  methods: () => ({[dartx.sublist]: dart.definiteFunctionType(core.List$(core.double), [core.int], [core.int])}),
   statics: () => ({
     _create1: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [dart.dynamic]),
     _create2: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [dart.dynamic, dart.dynamic]),
@@ -16184,7 +16616,6 @@
     fromList: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [ListOfdouble()]),
     view: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [typed_data.ByteBuffer, core.int, core.int])
   }),
-  methods: () => ({[dartx.sublist]: dart.definiteFunctionType(core.List$(core.double), [core.int], [core.int])}),
   statics: () => ({
     _create1: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [dart.dynamic]),
     _create2: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [dart.dynamic, dart.dynamic]),
@@ -16239,10 +16670,7 @@
     fromList: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [ListOfint()]),
     view: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [_native_typed_data.NativeByteBuffer, core.int, core.int])
   }),
-  methods: () => ({
-    [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-    [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-  }),
+  methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
   statics: () => ({
     _create1: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [dart.dynamic]),
     _create2: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [dart.dynamic, dart.dynamic]),
@@ -16297,10 +16725,7 @@
     fromList: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [ListOfint()]),
     view: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [typed_data.ByteBuffer, core.int, core.int])
   }),
-  methods: () => ({
-    [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-    [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-  }),
+  methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
   statics: () => ({
     _create1: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [dart.dynamic]),
     _create2: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [dart.dynamic, dart.dynamic]),
@@ -16355,10 +16780,7 @@
     fromList: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [ListOfint()]),
     view: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [typed_data.ByteBuffer, core.int, core.int])
   }),
-  methods: () => ({
-    [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-    [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-  }),
+  methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
   statics: () => ({
     _create1: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [dart.dynamic]),
     _create2: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [dart.dynamic, dart.dynamic]),
@@ -16413,10 +16835,7 @@
     fromList: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [ListOfint()]),
     view: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [typed_data.ByteBuffer, core.int, core.int])
   }),
-  methods: () => ({
-    [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-    [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-  }),
+  methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
   statics: () => ({
     _create1: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [dart.dynamic]),
     _create2: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [dart.dynamic, dart.dynamic]),
@@ -16471,10 +16890,7 @@
     fromList: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [ListOfint()]),
     view: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [typed_data.ByteBuffer, core.int, core.int])
   }),
-  methods: () => ({
-    [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-    [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-  }),
+  methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
   statics: () => ({
     _create1: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [dart.dynamic]),
     _create2: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [dart.dynamic, dart.dynamic]),
@@ -16536,10 +16952,7 @@
     fromList: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [ListOfint()]),
     view: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [typed_data.ByteBuffer, core.int, core.int])
   }),
-  methods: () => ({
-    [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-    [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-  }),
+  methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
   statics: () => ({
     _create1: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [dart.dynamic]),
     _create2: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [dart.dynamic, dart.dynamic]),
@@ -16602,10 +17015,7 @@
     fromList: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [ListOfint()]),
     view: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [typed_data.ByteBuffer, core.int, core.int])
   }),
-  methods: () => ({
-    [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-    [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-  }),
+  methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
   statics: () => ({
     _create1: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [dart.dynamic]),
     _create2: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [dart.dynamic, dart.dynamic]),
@@ -17298,6 +17708,8 @@
   return end;
 };
 dart.fn(_native_typed_data._checkValidRange, intAndintAndintToint());
+async._Callback = dart.typedef('_Callback', () => dart.functionType(dart.void, []));
+async._TakeCallback = dart.typedef('_TakeCallback', () => dart.functionType(dart.void, [async._Callback]));
 async._invokeErrorHandler = function(errorHandler, error, stackTrace) {
   if (async.ZoneBinaryCallback.is(errorHandler)) {
     return dart.dcall(errorHandler, error, stackTrace);
@@ -17417,10 +17829,7 @@
   dart.setSignature(_ControllerStream, {
     constructors: () => ({new: dart.definiteFunctionType(async._ControllerStream$(T), [_StreamControllerLifecycleOfT()])}),
     fields: () => ({[_controller]: _StreamControllerLifecycleOfT()}),
-    methods: () => ({
-      [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-      '==': dart.definiteFunctionType(core.bool, [core.Object])
-    })
+    methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])})
   });
   return _ControllerStream;
 });
@@ -17525,7 +17934,7 @@
     }
     onDone(handleDone) {
       if (handleDone == null) handleDone = async._nullDoneHandler;
-      this[_onDone] = this[_zone].registerCallback(dart.dynamic)(handleDone);
+      this[_onDone] = this[_zone].registerCallback(dart.void)(handleDone);
     }
     pause(resumeSignal) {
       if (resumeSignal === void 0) resumeSignal = null;
@@ -17564,11 +17973,11 @@
         let result = new (async._Future$(E))();
         this[_onDone] = dart.fn(() => {
           result[_complete](futureValue);
-        }, VoidTovoid());
+        }, VoidToNull());
         this[_onError] = dart.fn((error, stackTrace) => {
           this.cancel();
           result[_completeError](error, core.StackTrace._check(stackTrace));
-        }, dynamicAnddynamicTodynamic());
+        }, dynamicAnddynamicToNull());
         return result;
       };
     }
@@ -17678,7 +18087,7 @@
       dart.assert(!dart.test(this[_inCallback]));
       let wasInputPaused = this[_isInputPaused];
       this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-      this[_zone].runUnaryGuarded(dart.dynamic, T)(this[_onData], data);
+      this[_zone].runUnaryGuarded(dart.void, T)(this[_onData], data);
       this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
       this[_checkState](wasInputPaused);
     }
@@ -17719,7 +18128,7 @@
       const sendDone = (function() {
         if (!dart.test(this[_waitsForCancel])) return;
         this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_CANCELED | async._BufferingStreamSubscription._STATE_CLOSED | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-        this[_zone].runGuarded(dart.dynamic)(this[_onDone]);
+        this[_zone].runGuarded(dart.void)(this[_onDone]);
         this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
       }).bind(this);
       dart.fn(sendDone, VoidTovoid());
@@ -17735,7 +18144,7 @@
       dart.assert(!dart.test(this[_inCallback]));
       let wasInputPaused = this[_isInputPaused];
       this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-      dart.dcall(callback);
+      callback();
       this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
       this[_checkState](wasInputPaused);
     }
@@ -17816,7 +18225,7 @@
       [_sendData]: dart.definiteFunctionType(dart.void, [T]),
       [_sendError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
       [_sendDone]: dart.definiteFunctionType(dart.void, []),
-      [_guardCallback]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      [_guardCallback]: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
       [_checkState]: dart.definiteFunctionType(dart.void, [core.bool])
     }),
     sfields: () => ({
@@ -18244,7 +18653,7 @@
 async._SyncBroadcastStreamController$ = dart.generic(T => {
   let _BufferingStreamSubscriptionOfT = () => (_BufferingStreamSubscriptionOfT = dart.constFn(async._BufferingStreamSubscription$(T)))();
   let SynchronousStreamControllerOfT = () => (SynchronousStreamControllerOfT = dart.constFn(async.SynchronousStreamController$(T)))();
-  let _BufferingStreamSubscriptionOfTTovoid = () => (_BufferingStreamSubscriptionOfTTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [_BufferingStreamSubscriptionOfT()])))();
+  let _BufferingStreamSubscriptionOfTToNull = () => (_BufferingStreamSubscriptionOfTToNull = dart.constFn(dart.definiteFunctionType(core.Null, [_BufferingStreamSubscriptionOfT()])))();
   class _SyncBroadcastStreamController extends async._BroadcastStreamController$(T) {
     new(onListen, onCancel) {
       super.new(onListen, onCancel);
@@ -18273,19 +18682,19 @@
       }
       this[_forEachListener](dart.fn(subscription => {
         subscription[_add](data);
-      }, _BufferingStreamSubscriptionOfTTovoid()));
+      }, _BufferingStreamSubscriptionOfTToNull()));
     }
     [_sendError](error, stackTrace) {
       if (dart.test(this[_isEmpty])) return;
       this[_forEachListener](dart.fn(subscription => {
         subscription[_addError](error, stackTrace);
-      }, _BufferingStreamSubscriptionOfTTovoid()));
+      }, _BufferingStreamSubscriptionOfTToNull()));
     }
     [_sendDone]() {
       if (!dart.test(this[_isEmpty])) {
         this[_forEachListener](dart.fn(subscription => {
           subscription[_close]();
-        }, _BufferingStreamSubscriptionOfTTovoid()));
+        }, _BufferingStreamSubscriptionOfTToNull()));
       } else {
         dart.assert(this[_doneFuture] != null);
         dart.assert(this[_doneFuture][_mayComplete]);
@@ -18412,10 +18821,7 @@
     constructors: () => ({new: dart.definiteFunctionType(async._AsBroadcastStreamController$(T), [VoidTovoid(), VoidTovoid()])}),
     fields: () => ({[_pending]: _StreamImplEventsOfT()}),
     getters: () => ({[_hasPending]: dart.definiteFunctionType(core.bool, [])}),
-    methods: () => ({
-      [_addPendingEvent]: dart.definiteFunctionType(dart.void, [async._DelayedEvent]),
-      add: dart.definiteFunctionType(dart.void, [T])
-    })
+    methods: () => ({[_addPendingEvent]: dart.definiteFunctionType(dart.void, [async._DelayedEvent])})
   });
   return _AsBroadcastStreamController;
 });
@@ -18434,7 +18840,7 @@
     onDone(handleDone) {}
     pause(resumeSignal) {
       if (resumeSignal === void 0) resumeSignal = null;
-      if (resumeSignal != null) resumeSignal.then(dart.dynamic)(dart.bind(this, _resume));
+      if (resumeSignal != null) resumeSignal.then(dart.void)(dart.bind(this, _resume));
       this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
     }
     resume() {
@@ -18509,6 +18915,20 @@
   constructors: () => ({new: dart.definiteFunctionType(async.DeferredLoadException, [core.String])}),
   fields: () => ({[_s]: core.String})
 });
+async.FutureOr$ = dart.generic(T => {
+  class FutureOr extends core.Object {
+    _() {
+      dart.throw(new core.UnsupportedError("FutureOr can't be instantiated"));
+    }
+  }
+  dart.addTypeTests(FutureOr);
+  dart.defineNamedConstructor(FutureOr, '_');
+  dart.setSignature(FutureOr, {
+    constructors: () => ({_: dart.definiteFunctionType(async.FutureOr$(T), [])})
+  });
+  return FutureOr;
+});
+async.FutureOr = FutureOr();
 const _completeWithValue = Symbol('_completeWithValue');
 let const;
 async.Future$ = dart.flattenFutures(dart.generic(T => {
@@ -18525,7 +18945,7 @@
           async._completeWithErrorCallback(result, e, s);
         }
 
-      }, VoidTovoid()));
+      }, VoidToNull()));
       return result;
     }
     static microtask(computation) {
@@ -18538,7 +18958,7 @@
           async._completeWithErrorCallback(result, e, s);
         }
 
-      }, VoidTovoid()));
+      }, VoidToNull()));
       return result;
     }
     static sync(computation) {
@@ -18572,13 +18992,13 @@
       let result = new (_FutureOfT())();
       async.Timer.new(duration, dart.fn(() => {
         try {
-          result[_complete](computation == null ? null : computation());
+          result[_complete](dart.nullSafe(computation, _ => _()));
         } catch (e) {
           let s = dart.stackTrace(e);
           async._completeWithErrorCallback(result, e, s);
         }
 
-      }, VoidTovoid()));
+      }, VoidToNull()));
       return result;
     }
     static wait(T) {
@@ -18598,7 +19018,7 @@
                 if (value != null) {
                   async.Future.sync(dart.fn(() => {
                     cleanUp(value);
-                  }, VoidTodynamic()));
+                  }, VoidToNull()));
                 }
               }
             }
@@ -18614,31 +19034,43 @@
           }
         }
         dart.fn(handleError, dynamicAnddynamicTovoid());
-        for (let future of futures) {
-          let pos = remaining++;
-          future.then(dart.dynamic)(dart.fn(value => {
-            remaining--;
-            if (values != null) {
-              values[dartx._set](pos, value);
-              if (remaining == 0) {
-                result[_completeWithValue](values);
+        try {
+          for (let future of futures) {
+            let pos = remaining;
+            future.then(dart.dynamic)(dart.fn(value => {
+              remaining--;
+              if (values != null) {
+                values[dartx._set](pos, value);
+                if (remaining == 0) {
+                  result[_completeWithValue](values);
+                }
+              } else {
+                if (cleanUp != null && value != null) {
+                  async.Future.sync(dart.fn(() => {
+                    cleanUp(value);
+                  }, VoidToNull()));
+                }
+                if (remaining == 0 && !dart.test(eagerError)) {
+                  result[_completeError](error, stackTrace);
+                }
               }
-            } else {
-              if (cleanUp != null && value != null) {
-                async.Future.sync(dart.fn(() => {
-                  cleanUp(value);
-                }, VoidTodynamic()));
-              }
-              if (remaining == 0 && !dart.test(eagerError)) {
-                result[_completeError](error, stackTrace);
-              }
-            }
-          }, dart.definiteFunctionType(dart.dynamic, [T])), {onError: handleError});
+            }, dart.definiteFunctionType(core.Null, [T])), {onError: handleError});
+            remaining++;
+          }
+          if (remaining == 0) {
+            return async.Future$(core.List$(T)).value(const || (const = dart.constList([], dart.dynamic)));
+          }
+          values = core.List$(T).new(remaining);
+        } catch (e) {
+          let st = dart.stackTrace(e);
+          if (remaining == 0 || dart.test(eagerError)) {
+            return async.Future$(core.List$(T)).error(e, st);
+          } else {
+            error = e;
+            stackTrace = st;
+          }
         }
-        if (remaining == 0) {
-          return async.Future$(core.List$(T)).value(const || (const = dart.constList([], dart.dynamic)));
-        }
-        values = core.List$(T).new(remaining);
+
         return result;
       };
     }
@@ -18647,10 +19079,10 @@
         let completer = async.Completer$(T).sync();
         let onValue = dart.fn(value => {
           if (!dart.test(completer.isCompleted)) completer.complete(value);
-        }, dart.definiteFunctionType(dart.dynamic, [T]));
+        }, dart.definiteFunctionType(core.Null, [T]));
         let onError = dart.fn((error, stack) => {
           if (!dart.test(completer.isCompleted)) completer.completeError(error, core.StackTrace._check(stack));
-        }, dynamicAnddynamicTodynamic());
+        }, dynamicAnddynamicToNull());
         for (let future of futures) {
           future.then(dart.dynamic)(onValue, {onError: onError});
         }
@@ -18669,11 +19101,11 @@
       let nextIteration = null;
       nextIteration = async.Zone.current.bindUnaryCallback(dart.dynamic, core.bool)(dart.fn(keepGoing => {
         if (dart.test(keepGoing)) {
-          async.Future.sync(f).then(dart.dynamic)(dynamicTodynamic()._check(nextIteration), {onError: dart.bind(doneSignal, _completeError)});
+          async.Future.sync(f).then(dart.dynamic)(dynamicToFutureOr()._check(nextIteration), {onError: dart.bind(doneSignal, _completeError)});
         } else {
           doneSignal[_complete](null);
         }
-      }, boolTodynamic()), {runGuarded: true});
+      }, boolToNull()), {runGuarded: true});
       dart.dcall(nextIteration, true);
       return doneSignal;
     }
@@ -19010,6 +19442,7 @@
 const _setChained = Symbol('_setChained');
 const _thenNoZoneRegistration = Symbol('_thenNoZoneRegistration');
 const _setPendingComplete = Symbol('_setPendingComplete');
+const _clearPendingComplete = Symbol('_clearPendingComplete');
 const _error = Symbol('_error');
 const _chainSource = Symbol('_chainSource');
 const _setValue = Symbol('_setValue');
@@ -19025,7 +19458,7 @@
   let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
   let FutureOfT = () => (FutureOfT = dart.constFn(async.Future$(T)))();
   let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
-  let TTodynamic$ = () => (TTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [T])))();
+  let TToNull = () => (TToNull = dart.constFn(dart.definiteFunctionType(core.Null, [T])))();
   class _Future extends core.Object {
     new() {
       this[_zone] = async.Zone.current;
@@ -19074,7 +19507,7 @@
         let currentZone = async.Zone.current;
         let registered = null;
         if (!core.identical(currentZone, async._ROOT_ZONE)) {
-          f = currentZone.registerUnaryCallback(dart.dynamic, T)(f);
+          f = currentZone.registerUnaryCallback(async.FutureOr$(E), T)(f);
           if (onError != null) {
             onError = async._registerErrorHandler(T)(onError, currentZone);
           }
@@ -19114,6 +19547,10 @@
       dart.assert(this[_mayComplete]);
       this[_state] = async._Future._PENDING_COMPLETE;
     }
+    [_clearPendingComplete]() {
+      dart.assert(this[_isPendingComplete]);
+      this[_state] = async._Future._INCOMPLETE;
+    }
     get [_error]() {
       dart.assert(this[_hasError]);
       return async.AsyncError._check(this[_resultOrListeners]);
@@ -19159,7 +19596,7 @@
         dart.assert(this[_isComplete]);
         this[_zone].scheduleMicrotask(dart.fn(() => {
           async._Future._propagateToListeners(this, listener);
-        }, VoidTovoid()));
+        }, VoidToNull()));
       }
     }
     [_prependListeners](listeners) {
@@ -19187,7 +19624,7 @@
         listeners = this[_reverseListeners](listeners);
         this[_zone].scheduleMicrotask(dart.fn(() => {
           async._Future._propagateToListeners(this, listeners);
-        }, VoidTovoid()));
+        }, VoidToNull()));
       }
     }
     [_removeListeners]() {
@@ -19214,17 +19651,18 @@
       try {
         source.then(dart.dynamic)(dart.fn(value => {
           dart.assert(target[_isPendingComplete]);
-          target[_completeWithValue](value);
-        }, dynamicTodynamic()), {onError: dart.fn((error, stackTrace) => {
+          target[_clearPendingComplete]();
+          target[_complete](value);
+        }, dynamicToNull()), {onError: dart.fn((error, stackTrace) => {
             if (stackTrace === void 0) stackTrace = null;
             dart.assert(target[_isPendingComplete]);
             target[_completeError](error, core.StackTrace._check(stackTrace));
-          }, dynamic__Todynamic())});
+          }, dynamic__ToNull())});
       } catch (e) {
         let s = dart.stackTrace(e);
         async.scheduleMicrotask(dart.fn(() => {
           target[_completeError](e, s);
-        }, VoidTovoid()));
+        }, VoidToNull()));
       }
 
     }
@@ -19282,7 +19720,7 @@
             this[_setPendingComplete]();
             this[_zone].scheduleMicrotask(dart.fn(() => {
               async._Future._chainCoreFuture(coreFuture, this);
-            }, VoidTovoid()));
+            }, VoidToNull()));
           } else {
             async._Future._chainCoreFuture(coreFuture, this);
           }
@@ -19295,14 +19733,14 @@
       this[_setPendingComplete]();
       this[_zone].scheduleMicrotask(dart.fn(() => {
         this[_completeWithValue](typedValue);
-      }, VoidTovoid()));
+      }, VoidToNull()));
     }
     [_asyncCompleteError](error, stackTrace) {
       dart.assert(!dart.test(this[_isComplete]));
       this[_setPendingComplete]();
       this[_zone].scheduleMicrotask(dart.fn(() => {
         this[_completeError](error, stackTrace);
-      }, VoidTovoid()));
+      }, VoidToNull()));
     }
     static _propagateToListeners(source, listeners) {
       while (true) {
@@ -19446,7 +19884,7 @@
       if (onTimeout == null) {
         timer = async.Timer.new(timeLimit, dart.fn(() => {
           result[_completeError](new async.TimeoutException("Future not completed", timeLimit));
-        }, VoidTovoid()));
+        }, VoidToNull()));
       } else {
         let zone = async.Zone.current;
         onTimeout = zone.registerCallback(dart.dynamic)(onTimeout);
@@ -19458,19 +19896,19 @@
             result[_completeError](e, s);
           }
 
-        }, VoidTovoid()));
+        }, VoidToNull()));
       }
       this.then(dart.dynamic)(dart.fn(v => {
         if (dart.test(timer.isActive)) {
           timer.cancel();
           result[_completeWithValue](v);
         }
-      }, TTodynamic$()), {onError: dart.fn((e, s) => {
+      }, TToNull()), {onError: dart.fn((e, s) => {
           if (dart.test(timer.isActive)) {
             timer.cancel();
             result[_completeError](e, core.StackTrace._check(s));
           }
-        }, dynamicAnddynamicTodynamic())});
+        }, dynamicAnddynamicToNull())});
       return result;
     }
   }
@@ -19501,12 +19939,13 @@
     }),
     methods: () => ({
       [_setChained]: dart.definiteFunctionType(dart.void, [async._Future]),
-      then: dart.definiteFunctionType(E => [async.Future$(E), [TTodynamic()], {onError: core.Function}]),
+      then: dart.definiteFunctionType(E => [async.Future$(E), [dart.functionType(async.FutureOr$(E), [T])], {onError: core.Function}]),
       [_thenNoZoneRegistration]: dart.definiteFunctionType(E => [async.Future$(E), [TTodynamic(), core.Function]]),
       catchError: dart.definiteFunctionType(async.Future$(T), [core.Function], {test: dynamicTobool()}),
       whenComplete: dart.definiteFunctionType(async.Future$(T), [VoidTodynamic()]),
       asStream: dart.definiteFunctionType(async.Stream$(T), []),
       [_setPendingComplete]: dart.definiteFunctionType(dart.void, []),
+      [_clearPendingComplete]: dart.definiteFunctionType(dart.void, []),
       [_setValue]: dart.definiteFunctionType(dart.void, [T]),
       [_setErrorObject]: dart.definiteFunctionType(dart.void, [async.AsyncError]),
       [_setError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
@@ -19627,41 +20066,41 @@
   }
   let implementation = currentZone[_scheduleMicrotask];
   if (core.identical(async._ROOT_ZONE, implementation.zone) && dart.test(async._ROOT_ZONE.inSameErrorZone(currentZone))) {
-    async._rootScheduleMicrotask(null, null, currentZone, currentZone.registerCallback(dart.dynamic)(callback));
+    async._rootScheduleMicrotask(null, null, currentZone, currentZone.registerCallback(dart.void)(callback));
     return;
   }
-  async.Zone.current.scheduleMicrotask(async.Zone.current.bindCallback(dart.dynamic)(callback, {runGuarded: true}));
+  async.Zone.current.scheduleMicrotask(async.Zone.current.bindCallback(dart.void)(callback, {runGuarded: true}));
 };
 dart.fn(async.scheduleMicrotask, _AsyncCallbackTovoid());
 async._AsyncRun = class _AsyncRun extends core.Object {
   static _scheduleImmediate(callback) {
-    dart.dcall(async._AsyncRun._scheduleImmediateClosure, callback);
+    async._AsyncRun._scheduleImmediateClosure(callback);
   }
   static _initializeScheduleImmediate() {
-    if (self.scheduleImmediate != null) {
+    if (_isolate_helper.global.scheduleImmediate != null) {
       return async._AsyncRun._scheduleImmediateJsOverride;
     }
-    if (self.MutationObserver != null && self.document != null) {
-      let div = self.document.createElement("div");
-      let span = self.document.createElement("span");
+    if (_isolate_helper.global.MutationObserver != null && _isolate_helper.global.document != null) {
+      let div = _isolate_helper.global.document.createElement("div");
+      let span = _isolate_helper.global.document.createElement("span");
       let storedCallback = null;
       function internalCallback(_) {
         _isolate_helper.leaveJsAsync();
         let f = storedCallback;
         storedCallback = null;
-        dart.dcall(f);
+        f();
       }
-      dart.fn(internalCallback, dynamicTodynamic());
+      dart.fn(internalCallback, dynamicToNull());
       ;
-      let observer = new self.MutationObserver(internalCallback);
+      let observer = new _isolate_helper.global.MutationObserver(internalCallback);
       observer.observe(div, {childList: true});
       return dart.fn(callback => {
         dart.assert(storedCallback == null);
         _isolate_helper.enterJsAsync();
         storedCallback = callback;
         div.firstChild ? div.removeChild(span) : div.appendChild(span);
-      }, FnTodynamic());
-    } else if (self.setImmediate != null) {
+      }, FnToNull());
+    } else if (_isolate_helper.global.setImmediate != null) {
       return async._AsyncRun._scheduleImmediateWithSetImmediate;
     }
     return async._AsyncRun._scheduleImmediateWithTimer;
@@ -19671,30 +20110,30 @@
       _isolate_helper.leaveJsAsync();
       callback();
     }
-    dart.fn(internalCallback, VoidTodynamic());
+    dart.fn(internalCallback, VoidToNull());
     ;
     _isolate_helper.enterJsAsync();
-    self.scheduleImmediate(internalCallback);
+    _isolate_helper.global.scheduleImmediate(internalCallback);
   }
   static _scheduleImmediateWithSetImmediate(callback) {
     function internalCallback() {
       _isolate_helper.leaveJsAsync();
       callback();
     }
-    dart.fn(internalCallback, VoidTodynamic());
+    dart.fn(internalCallback, VoidToNull());
     ;
     _isolate_helper.enterJsAsync();
-    self.setImmediate(internalCallback);
+    _isolate_helper.global.setImmediate(internalCallback);
   }
   static _scheduleImmediateWithTimer(callback) {
     async.Timer._createTimer(core.Duration.ZERO, callback);
   }
 };
 dart.setSignature(async._AsyncRun, {
-  sfields: () => ({_scheduleImmediateClosure: core.Function}),
+  sfields: () => ({_scheduleImmediateClosure: async._TakeCallback}),
   statics: () => ({
     _scheduleImmediate: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
-    _initializeScheduleImmediate: dart.definiteFunctionType(core.Function, []),
+    _initializeScheduleImmediate: dart.definiteFunctionType(async._TakeCallback, []),
     _scheduleImmediateJsOverride: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
     _scheduleImmediateWithSetImmediate: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
     _scheduleImmediateWithTimer: dart.definiteFunctionType(dart.void, [VoidTovoid()])
@@ -19750,10 +20189,7 @@
   dart.setSignature(StreamView, {
     constructors: () => ({new: dart.definiteFunctionType(async.StreamView$(T), [StreamOfT()])}),
     fields: () => ({[_stream]: StreamOfT()}),
-    methods: () => ({
-      asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
-      listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})
-    })
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
   });
   return StreamView;
 });
@@ -20098,7 +20534,7 @@
       subscription[_setPendingEvents](pendingEvents);
       subscription[_guardCallback](dart.fn(() => {
         async._runGuarded(this.onListen);
-      }, VoidTodynamic()));
+      }, VoidToNull()));
       return subscription;
     }
     [_recordCancel](subscription) {
@@ -20358,7 +20794,7 @@
       return dart.fn((e, s) => {
         controller[_addError](e, s);
         controller[_close]();
-      }, dynamicAndStackTraceTodynamic());
+      }, dynamicAndStackTraceToNull());
     }
     pause() {
       this.addSubscription.pause();
@@ -20374,7 +20810,7 @@
       }
       return cancel.whenComplete(dart.fn(() => {
         this.addStreamFuture[_asyncComplete](null);
-      }, VoidTodynamic()));
+      }, VoidToNull()));
     }
     complete() {
       this.addStreamFuture[_asyncComplete](null);
@@ -20458,8 +20894,7 @@
     fields: () => ({
       [_pending]: _EventGeneratorOfT(),
       [_isUsed]: core.bool
-    }),
-    methods: () => ({[_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool])})
+    })
   });
   return _GeneratedStreamImpl;
 });
@@ -20492,7 +20927,7 @@
         this[_state] = async._PendingEvents._STATE_UNSCHEDULED;
         if (oldState == async._PendingEvents._STATE_CANCELED) return;
         this.handleNext(dispatch);
-      }, VoidTovoid()));
+      }, VoidToNull()));
       this[_state] = async._PendingEvents._STATE_SCHEDULED;
     }
     cancelSchedule() {
@@ -20799,7 +21234,7 @@
         let result = new (async._Future$(E))();
         this[_onDone] = dart.fn(() => {
           result[_completeWithValue](null);
-        }, VoidTovoid());
+        }, VoidToNull());
         return result;
       };
     }
@@ -20807,7 +21242,7 @@
       this[_state] = (dart.notNull(this[_state]) & ~async._DoneStreamSubscription._SCHEDULED) >>> 0;
       if (dart.test(this.isPaused)) return;
       this[_state] = (dart.notNull(this[_state]) | async._DoneStreamSubscription._DONE_SENT) >>> 0;
-      if (this[_onDone] != null) this[_zone].runGuarded(dart.dynamic)(this[_onDone]);
+      if (this[_onDone] != null) this[_zone].runGuarded(dart.void)(this[_onDone]);
     }
   }
   dart.addTypeTests(_DoneStreamSubscription);
@@ -20892,7 +21327,7 @@
     [_onCancel]() {
       let shutdown = this[_controller] == null || dart.test(this[_controller].isClosed);
       if (this[_onCancelHandler] != null) {
-        this[_zone].runUnary(dart.dynamic, _BroadcastSubscriptionWrapperOfT())(this[_onCancelHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
+        this[_zone].runUnary(dart.void, _BroadcastSubscriptionWrapperOfT())(this[_onCancelHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
       }
       if (shutdown) {
         if (this[_subscription] != null) {
@@ -20903,7 +21338,7 @@
     }
     [_onListen]() {
       if (this[_onListenHandler] != null) {
-        this[_zone].runUnary(dart.dynamic, _BroadcastSubscriptionWrapperOfT())(this[_onListenHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
+        this[_zone].runUnary(dart.void, _BroadcastSubscriptionWrapperOfT())(this[_onListenHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
       }
     }
     [_cancelSubscription]() {
@@ -21218,7 +21653,7 @@
 async._cancelAndErrorClosure = function(subscription, future) {
   return dart.fn((error, stackTrace) => {
     async._cancelAndError(subscription, future, error, stackTrace);
-  }, dynamicAndStackTraceTovoid());
+  }, dynamicAndStackTraceToNull());
 };
 dart.fn(async._cancelAndErrorClosure, StreamSubscriptionAnd_FutureTo_ErrorCallback());
 async._cancelAndValue = function(subscription, future, value) {
@@ -21338,7 +21773,6 @@
       [_subscription]: StreamSubscriptionOfS()
     }),
     methods: () => ({
-      [_add]: dart.definiteFunctionType(dart.void, [T]),
       [_handleData]: dart.definiteFunctionType(dart.void, [S]),
       [_handleError]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
       [_handleDone]: dart.definiteFunctionType(dart.void, [])
@@ -21390,8 +21824,7 @@
   }
   dart.setSignature(_WhereStream, {
     constructors: () => ({new: dart.definiteFunctionType(async._WhereStream$(T), [StreamOfT(), _PredicateOfT()])}),
-    fields: () => ({[_test]: _PredicateOfT()}),
-    methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])})
+    fields: () => ({[_test]: _PredicateOfT()})
   });
   return _WhereStream;
 });
@@ -21428,8 +21861,7 @@
   }
   dart.setSignature(_MapStream, {
     constructors: () => ({new: dart.definiteFunctionType(async._MapStream$(S, T), [StreamOfS(), _TransformationOfS$T()])}),
-    fields: () => ({[_transform]: _TransformationOfS$T()}),
-    methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [S, _EventSinkOfT()])})
+    fields: () => ({[_transform]: _TransformationOfS$T()})
   });
   return _MapStream;
 });
@@ -21461,8 +21893,7 @@
   }
   dart.setSignature(_ExpandStream, {
     constructors: () => ({new: dart.definiteFunctionType(async._ExpandStream$(S, T), [StreamOfS(), _TransformationOfS$IterableOfT()])}),
-    fields: () => ({[_expand]: _TransformationOfS$IterableOfT()}),
-    methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [S, _EventSinkOfT()])})
+    fields: () => ({[_expand]: _TransformationOfS$IterableOfT()})
   });
   return _ExpandStream;
 });
@@ -21551,11 +21982,7 @@
   }
   dart.setSignature(_TakeStream, {
     constructors: () => ({new: dart.definiteFunctionType(async._TakeStream$(T), [StreamOfT(), core.int])}),
-    fields: () => ({[_count]: core.int}),
-    methods: () => ({
-      [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-      [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-    })
+    fields: () => ({[_count]: core.int})
   });
   return _TakeStream;
 });
@@ -21629,8 +22056,7 @@
   }
   dart.setSignature(_TakeWhileStream, {
     constructors: () => ({new: dart.definiteFunctionType(async._TakeWhileStream$(T), [StreamOfT(), _PredicateOfT()])}),
-    fields: () => ({[_test]: _PredicateOfT()}),
-    methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])})
+    fields: () => ({[_test]: _PredicateOfT()})
   });
   return _TakeWhileStream;
 });
@@ -21663,11 +22089,7 @@
   }
   dart.setSignature(_SkipStream, {
     constructors: () => ({new: dart.definiteFunctionType(async._SkipStream$(T), [StreamOfT(), core.int])}),
-    fields: () => ({[_count]: core.int}),
-    methods: () => ({
-      [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-      [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-    })
+    fields: () => ({[_count]: core.int})
   });
   return _SkipStream;
 });
@@ -21713,11 +22135,7 @@
   }
   dart.setSignature(_SkipWhileStream, {
     constructors: () => ({new: dart.definiteFunctionType(async._SkipWhileStream$(T), [StreamOfT(), _PredicateOfT()])}),
-    fields: () => ({[_test]: _PredicateOfT()}),
-    methods: () => ({
-      [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-      [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-    })
+    fields: () => ({[_test]: _PredicateOfT()})
   });
   return _SkipWhileStream;
 });
@@ -21771,7 +22189,6 @@
       [_equals]: _EqualityOfT(),
       [_previous]: core.Object
     }),
-    methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])}),
     sfields: () => ({_SENTINEL: core.Object})
   });
   return _DistinctStream;
@@ -21912,7 +22329,6 @@
     }),
     getters: () => ({[_isSubscribed]: dart.definiteFunctionType(core.bool, [])}),
     methods: () => ({
-      [_add]: dart.definiteFunctionType(dart.void, [T]),
       [_handleData]: dart.definiteFunctionType(dart.void, [S]),
       [_handleError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [dart.dynamic]),
       [_handleDone]: dart.definiteFunctionType(dart.void, [])
@@ -22080,7 +22496,6 @@
   }
   dart.setSignature(_StreamHandlerTransformer, {
     constructors: () => ({new: dart.definiteFunctionType(async._StreamHandlerTransformer$(S, T), [], {handleData: SAndEventSinkOfTTovoid(), handleError: ObjectAndStackTraceAndEventSinkOfTTovoid(), handleDone: EventSinkOfTTovoid()})}),
-    methods: () => ({bind: dart.definiteFunctionType(async.Stream$(T), [StreamOfS()])}),
     statics: () => ({
       _defaultHandleData: dart.definiteFunctionType(dart.void, [dart.dynamic, async.EventSink]),
       _defaultHandleError: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace, async.EventSink]),
@@ -22159,7 +22574,7 @@
     if (dart.equals(async.Zone.current, async.Zone.ROOT)) {
       return async.Zone.current.createTimer(duration, callback);
     }
-    return async.Zone.current.createTimer(duration, async.Zone.current.bindCallback(dart.dynamic)(callback, {runGuarded: true}));
+    return async.Zone.current.createTimer(duration, async.Zone.current.bindCallback(dart.void)(callback, {runGuarded: true}));
   }
   static periodic(duration, callback) {
     if (dart.equals(async.Zone.current, async.Zone.ROOT)) {
@@ -22820,7 +23235,7 @@
       if (error == null) error = new core.NullThrownError();
       if (stackTrace == null) dart.throw(error);
       async._rethrow(error, stackTrace);
-    }, VoidTovoid()));
+    }, VoidToNull()));
   };
 };
 dart.lazyFn(async._rootHandleUncaughtError, () => ZoneAndZoneDelegateAndZone__ToR());
@@ -22898,7 +23313,7 @@
 dart.fn(async._rootScheduleMicrotask, ZoneAndZoneDelegateAndZone__Tovoid());
 async._rootCreateTimer = function(self, parent, zone, duration, callback) {
   if (!core.identical(async._ROOT_ZONE, zone)) {
-    callback = zone.bindCallback(dart.dynamic)(callback);
+    callback = zone.bindCallback(dart.void)(callback);
   }
   return async.Timer._createTimer(duration, callback);
 };
@@ -23256,13 +23671,13 @@
   let _HashMapKeyIterableOfK = () => (_HashMapKeyIterableOfK = dart.constFn(collection._HashMapKeyIterable$(K)))();
   let MappedIterableOfK$V = () => (MappedIterableOfK$V = dart.constFn(_internal.MappedIterable$(K, V)))();
   let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-  let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
   let ListOfK = () => (ListOfK = dart.constFn(core.List$(K)))();
   let HashMapOfK$V = () => (HashMapOfK$V = dart.constFn(collection.HashMap$(K, V)))();
+  let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
   let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
   let KToV = () => (KToV = dart.constFn(dart.definiteFunctionType(V, [K])))();
   let KTobool = () => (KTobool = dart.constFn(dart.definiteFunctionType(core.bool, [K])))();
-  let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+  let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
   class _HashMap extends core.Object {
     new() {
       this[_length] = 0;
@@ -23310,7 +23725,7 @@
       MapOfK$V()._check(other);
       other[dartx.forEach](dart.fn((key, value) => {
         this._set(key, value);
-      }, KAndVTovoid$()));
+      }, KAndVToNull()));
     }
     _get(key) {
       if (dart.test(collection._HashMap._isStringKey(key))) {
@@ -23661,11 +24076,6 @@
       [_equals]: _EqualityOfK(),
       [_hashCode]: _HasherOfK(),
       [_validKey]: _PredicateOfObject()
-    }),
-    methods: () => ({
-      _get: dart.definiteFunctionType(V, [core.Object]),
-      _set: dart.definiteFunctionType(dart.void, [K, V]),
-      remove: dart.definiteFunctionType(V, [core.Object])
     })
   });
   dart.defineExtensionMembers(_CustomHashMap, ['_get', '_set', 'containsKey', 'remove']);
@@ -23708,8 +24118,7 @@
   dart.setSignature(_HashMapKeyIterable, {
     constructors: () => ({new: dart.definiteFunctionType(collection._HashMapKeyIterable$(E), [_HashMapOfE$dynamic()])}),
     fields: () => ({[_map]: _HashMapOfE$dynamic()}),
-    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-    methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
   });
   dart.defineExtensionMembers(_HashMapKeyIterable, [
     'contains',
@@ -23809,11 +24218,11 @@
 collection._Es6LinkedIdentityHashMap$ = dart.generic((K, V) => {
   let _Es6MapIterableOfK = () => (_Es6MapIterableOfK = dart.constFn(collection._Es6MapIterable$(K)))();
   let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-  let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
   let InternalMapOfK$V = () => (InternalMapOfK$V = dart.constFn(_js_helper.InternalMap$(K, V)))();
+  let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
   let _Es6MapIterableOfV = () => (_Es6MapIterableOfV = dart.constFn(collection._Es6MapIterable$(V)))();
   let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
-  let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+  let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
   let VTobool = () => (VTobool = dart.constFn(dart.definiteFunctionType(core.bool, [V])))();
   class _Es6LinkedIdentityHashMap extends collection._LinkedIdentityHashMap$(K, V) {
     new() {
@@ -23846,7 +24255,7 @@
       MapOfK$V()._check(other);
       other[dartx.forEach](dart.fn((key, value) => {
         this._set(key, value);
-      }, KAndVTovoid$()));
+      }, KAndVToNull()));
     }
     _get(key) {
       return this[_map].get(key);
@@ -23906,19 +24315,7 @@
       [_map]: dart.dynamic,
       [_modifications]: core.int
     }),
-    getters: () => ({
-      keys: dart.definiteFunctionType(core.Iterable$(K), []),
-      values: dart.definiteFunctionType(core.Iterable$(V), [])
-    }),
-    methods: () => ({
-      addAll: dart.definiteFunctionType(dart.void, [MapOfK$V()]),
-      _get: dart.definiteFunctionType(V, [core.Object]),
-      _set: dart.definiteFunctionType(dart.void, [K, V]),
-      putIfAbsent: dart.definiteFunctionType(V, [K, VoidToV()]),
-      remove: dart.definiteFunctionType(V, [core.Object]),
-      forEach: dart.definiteFunctionType(dart.void, [KAndVTovoid()]),
-      [_modified]: dart.definiteFunctionType(dart.void, [])
-    })
+    methods: () => ({[_modified]: dart.definiteFunctionType(dart.void, [])})
   });
   dart.defineExtensionMembers(_Es6LinkedIdentityHashMap, [
     'containsKey',
@@ -23988,8 +24385,7 @@
       [_map]: dart.dynamic,
       [_isKeys]: core.bool
     }),
-    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-    methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
   });
   dart.defineExtensionMembers(_Es6MapIterable, [
     'contains',
@@ -24108,11 +24504,6 @@
       [_equals]: _EqualityOfK(),
       [_hashCode]: _HasherOfK(),
       [_validKey]: _PredicateOfObject()
-    }),
-    methods: () => ({
-      _get: dart.definiteFunctionType(V, [core.Object]),
-      _set: dart.definiteFunctionType(dart.void, [K, V]),
-      remove: dart.definiteFunctionType(V, [core.Object])
     })
   });
   dart.defineExtensionMembers(_LinkedCustomHashMap, ['_get', '_set', 'containsKey', 'remove']);
@@ -24484,11 +24875,7 @@
     }
   }
   dart.setSignature(_HashSetBase, {
-    methods: () => ({
-      difference: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-      intersection: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-      toSet: dart.definiteFunctionType(core.Set$(E), [])
-    })
+    methods: () => ({toSet: dart.definiteFunctionType(core.Set$(E), [])})
   });
   dart.defineExtensionMembers(_HashSetBase, ['toSet']);
   return _HashSetBase;
@@ -24738,7 +25125,6 @@
       [_lookup]: dart.definiteFunctionType(E, [core.Object]),
       add: dart.definiteFunctionType(core.bool, [E]),
       [_add]: dart.definiteFunctionType(core.bool, [E]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
       remove: dart.definiteFunctionType(core.bool, [core.Object]),
       [_remove]: dart.definiteFunctionType(core.bool, [core.Object]),
       [_computeElements]: dart.definiteFunctionType(core.List$(E), []),
@@ -24789,9 +25175,6 @@
       return -1;
     }
   }
-  dart.setSignature(_IdentityHashSet, {
-    methods: () => ({[_newSet]: dart.definiteFunctionType(core.Set$(E), [])})
-  });
   return _IdentityHashSet;
 });
 collection._IdentityHashSet = _IdentityHashSet();
@@ -24845,11 +25228,6 @@
       [_equality]: _EqualityOfE(),
       [_hasher]: _HasherOfE(),
       [_validKey]: _PredicateOfObject()
-    }),
-    methods: () => ({
-      [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
-      add: dart.definiteFunctionType(core.bool, [E]),
-      lookup: dart.definiteFunctionType(E, [core.Object])
     })
   });
   dart.defineExtensionMembers(_CustomHashSet, ['contains']);
@@ -25181,9 +25559,7 @@
     }),
     getters: () => ({
       iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-      length: dart.definiteFunctionType(core.int, []),
-      first: dart.definiteFunctionType(E, []),
-      last: dart.definiteFunctionType(E, [])
+      length: dart.definiteFunctionType(core.int, [])
     }),
     methods: () => ({
       [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
@@ -25192,13 +25568,10 @@
       [_contains]: dart.definiteFunctionType(core.bool, [core.Object]),
       lookup: dart.definiteFunctionType(E, [core.Object]),
       [_lookup]: dart.definiteFunctionType(E, [core.Object]),
-      forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
       add: dart.definiteFunctionType(core.bool, [E]),
       [_add]: dart.definiteFunctionType(core.bool, [E]),
       remove: dart.definiteFunctionType(core.bool, [core.Object]),
       [_remove]: dart.definiteFunctionType(core.bool, [core.Object]),
-      removeWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
-      retainWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
       [_filterWhere]: dart.definiteFunctionType(dart.void, [ETobool(), core.bool]),
       [_addHashTableEntry]: dart.definiteFunctionType(core.bool, [dart.dynamic, E]),
       [_removeHashTableEntry]: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Object]),
@@ -25254,9 +25627,6 @@
       return -1;
     }
   }
-  dart.setSignature(_LinkedIdentityHashSet, {
-    methods: () => ({[_newSet]: dart.definiteFunctionType(core.Set$(E), [])})
-  });
   return _LinkedIdentityHashSet;
 });
 collection._LinkedIdentityHashSet = _LinkedIdentityHashSet();
@@ -25322,11 +25692,6 @@
       [_equality]: _EqualityOfE(),
       [_hasher]: _HasherOfE(),
       [_validKey]: _PredicateOfObject()
-    }),
-    methods: () => ({
-      [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
-      add: dart.definiteFunctionType(core.bool, [E]),
-      lookup: dart.definiteFunctionType(E, [core.Object])
     })
   });
   dart.defineExtensionMembers(_LinkedCustomHashSet, ['contains']);
@@ -25490,7 +25855,7 @@
       let result = HashMapOfK$V().new();
       other[dartx.forEach](dart.fn((k, v) => {
         result._set(K.as(k), V.as(v));
-      }, dynamicAnddynamicTovoid()));
+      }, dynamicAnddynamicToNull()));
       return result;
     }
     static fromIterable(iterable, opts) {
@@ -26042,7 +26407,7 @@
       let result = LinkedHashMapOfK$V().new();
       other[dartx.forEach](dart.fn((k, v) => {
         result._set(K.as(k), V.as(v));
-      }, dynamicAnddynamicTovoid()));
+      }, dynamicAnddynamicToNull()));
       return result;
     }
     static fromIterable(iterable, opts) {
@@ -26272,19 +26637,13 @@
       [_length]: core.int,
       [_first]: E
     }),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-      first: dart.definiteFunctionType(E, []),
-      last: dart.definiteFunctionType(E, []),
-      single: dart.definiteFunctionType(E, [])
-    }),
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
     methods: () => ({
       addFirst: dart.definiteFunctionType(dart.void, [E]),
       add: dart.definiteFunctionType(dart.void, [E]),
       addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
       remove: dart.definiteFunctionType(core.bool, [E]),
       clear: dart.definiteFunctionType(dart.void, []),
-      forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
       [_insertBefore]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
       [_unlink]: dart.definiteFunctionType(dart.void, [E])
     })
@@ -26576,12 +26935,7 @@
   dart.setSignature(_MapBaseValueIterable, {
     constructors: () => ({new: dart.definiteFunctionType(collection._MapBaseValueIterable$(K, V), [MapOfK$V()])}),
     fields: () => ({[_map]: MapOfK$V()}),
-    getters: () => ({
-      first: dart.definiteFunctionType(V, []),
-      single: dart.definiteFunctionType(V, []),
-      last: dart.definiteFunctionType(V, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(V), [])
-    })
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
   });
   dart.defineExtensionMembers(_MapBaseValueIterable, [
     'length',
@@ -26808,7 +27162,7 @@
         result.write(k);
         result.write(': ');
         result.write(v);
-      }, dynamicAnddynamicTovoid()));
+      }, dynamicAnddynamicToNull()));
       result.write('}');
     } finally {
       dart.assert(core.identical(collection._toStringVisiting[dartx.last], m));
@@ -27254,12 +27608,7 @@
       [_sentinel]: _DoubleLinkedQueueSentinelOfE(),
       [_elementCount]: core.int
     }),
-    getters: () => ({
-      first: dart.definiteFunctionType(E, []),
-      last: dart.definiteFunctionType(E, []),
-      single: dart.definiteFunctionType(E, []),
-      iterator: dart.definiteFunctionType(collection._DoubleLinkedQueueIterator$(E), [])
-    }),
+    getters: () => ({iterator: dart.definiteFunctionType(collection._DoubleLinkedQueueIterator$(E), [])}),
     methods: () => ({
       addLast: dart.definiteFunctionType(dart.void, [E]),
       addFirst: dart.definiteFunctionType(dart.void, [E]),
@@ -27631,16 +27980,8 @@
       [_tail]: core.int,
       [_modificationCount]: core.int
     }),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-      first: dart.definiteFunctionType(E, []),
-      last: dart.definiteFunctionType(E, []),
-      single: dart.definiteFunctionType(E, [])
-    }),
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
     methods: () => ({
-      forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-      elementAt: dart.definiteFunctionType(E, [core.int]),
-      toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
       add: dart.definiteFunctionType(dart.void, [E]),
       addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
       remove: dart.definiteFunctionType(core.bool, [core.Object]),
@@ -27948,16 +28289,16 @@
   let ComparatorOfK = () => (ComparatorOfK = dart.constFn(core.Comparator$(K)))();
   let SplayTreeMapOfK$V = () => (SplayTreeMapOfK$V = dart.constFn(collection.SplayTreeMap$(K, V)))();
   let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-  let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
   let _SplayTreeNodeIteratorOfK = () => (_SplayTreeNodeIteratorOfK = dart.constFn(collection._SplayTreeNodeIterator$(K)))();
   let _SplayTreeKeyIterableOfK = () => (_SplayTreeKeyIterableOfK = dart.constFn(collection._SplayTreeKeyIterable$(K)))();
   let _SplayTreeValueIterableOfK$V = () => (_SplayTreeValueIterableOfK$V = dart.constFn(collection._SplayTreeValueIterable$(K, V)))();
+  let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
   let dynamicToK = () => (dynamicToK = dart.constFn(dart.functionType(K, [dart.dynamic])))();
   let IterableOfK = () => (IterableOfK = dart.constFn(core.Iterable$(K)))();
   let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
   let dynamicToV = () => (dynamicToV = dart.constFn(dart.functionType(V, [dart.dynamic])))();
   let IterableOfV = () => (IterableOfV = dart.constFn(core.Iterable$(V)))();
-  let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+  let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
   class SplayTreeMap extends collection._SplayTree$(K, collection._SplayTreeMapNode$(K, V)) {
     new(compare, isValidKey) {
       if (compare === void 0) compare = null;
@@ -27980,7 +28321,7 @@
       let result = new (SplayTreeMapOfK$V())(compare, isValidKey);
       other[dartx.forEach](dart.fn((k, v) => {
         result._set(K.as(k), V.as(v));
-      }, dynamicAnddynamicTovoid()));
+      }, dynamicAnddynamicToNull()));
       return result;
     }
     static fromIterable(iterable, opts) {
@@ -28066,7 +28407,7 @@
       MapOfK$V()._check(other);
       other[dartx.forEach](dart.fn((key, value) => {
         this._set(key, value);
-      }, KAndVTovoid$()));
+      }, KAndVToNull()));
     }
     get isEmpty() {
       return this[_root] == null;
@@ -28341,8 +28682,7 @@
   dart.setSignature(_SplayTreeKeyIterable, {
     constructors: () => ({new: dart.definiteFunctionType(collection._SplayTreeKeyIterable$(K), [_SplayTreeOfK$_SplayTreeNodeOfK()])}),
     fields: () => ({[_tree]: _SplayTreeOfK$_SplayTreeNodeOfK()}),
-    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])}),
-    methods: () => ({toSet: dart.definiteFunctionType(core.Set$(K), [])})
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])})
   });
   dart.defineExtensionMembers(_SplayTreeKeyIterable, ['toSet', 'length', 'isEmpty', 'iterator']);
   return _SplayTreeKeyIterable;
@@ -28612,24 +28952,14 @@
       [_comparator]: ComparatorOfE(),
       [_validKey]: collection._Predicate
     }),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-      first: dart.definiteFunctionType(E, []),
-      last: dart.definiteFunctionType(E, []),
-      single: dart.definiteFunctionType(E, [])
-    }),
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
     methods: () => ({
       [_compare]: dart.definiteFunctionType(core.int, [E, E]),
       add: dart.definiteFunctionType(core.bool, [E]),
       remove: dart.definiteFunctionType(core.bool, [core.Object]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
       lookup: dart.definiteFunctionType(E, [core.Object]),
-      intersection: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-      difference: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-      union: dart.definiteFunctionType(core.Set$(E), [SetOfE()]),
       [_clone]: dart.definiteFunctionType(collection.SplayTreeSet$(E), []),
-      [_copyNode]: dart.definiteFunctionType(collection._SplayTreeNode$(E), [_SplayTreeNodeOfE()]),
-      toSet: dart.definiteFunctionType(core.Set$(E), [])
+      [_copyNode]: dart.definiteFunctionType(collection._SplayTreeNode$(E), [_SplayTreeNodeOfE()])
     })
   });
   dart.defineExtensionMembers(SplayTreeSet, [
@@ -28750,7 +29080,7 @@
   addAll(other) {
     other[dartx.forEach](dart.fn((key, value) => {
       this._set(key, value);
-    }, dynamicAnddynamicTovoid()));
+    }, dynamicAnddynamicToNull()));
   }
   containsValue(value) {
     if (dart.test(this[_isUpgraded])) return this[_upgradedMap][dartx.containsValue](value);
@@ -28943,7 +29273,6 @@
 dart.setSignature(convert._JsonMapKeyIterable, {
   constructors: () => ({new: dart.definiteFunctionType(convert._JsonMapKeyIterable, [convert._JsonMap])}),
   fields: () => ({[_parent]: convert._JsonMap}),
-  getters: () => ({iterator: dart.definiteFunctionType(core.Iterator, [])}),
   methods: () => ({elementAt: dart.definiteFunctionType(core.String, [core.int])})
 });
 dart.defineExtensionMembers(convert._JsonMapKeyIterable, ['elementAt', 'contains', 'length', 'iterator']);
@@ -29368,8 +29697,7 @@
   fields: () => ({[_subsetMask]: core.int}),
   methods: () => ({
     convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
-    startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()]),
-    bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfString()])
+    startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
   })
 });
 convert.AsciiEncoder = class AsciiEncoder extends convert._UnicodeSubsetEncoder {
@@ -29459,8 +29787,7 @@
   }),
   methods: () => ({
     convert: dart.definiteFunctionType(core.String, [ListOfint()], [core.int, core.int]),
-    [_convertInvalid]: dart.definiteFunctionType(core.String, [ListOfint(), core.int, core.int]),
-    bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfListOfint()])
+    [_convertInvalid]: dart.definiteFunctionType(core.String, [ListOfint(), core.int, core.int])
   })
 });
 convert.AsciiDecoder = class AsciiDecoder extends convert._UnicodeSubsetDecoder {
@@ -29483,8 +29810,7 @@
   }
 };
 dart.setSignature(convert.AsciiDecoder, {
-  constructors: () => ({new: dart.definiteFunctionType(convert.AsciiDecoder, [], {allowInvalid: core.bool})}),
-  methods: () => ({startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])})
+  constructors: () => ({new: dart.definiteFunctionType(convert.AsciiDecoder, [], {allowInvalid: core.bool})})
 });
 const _utf8Sink = Symbol('_utf8Sink');
 let const;
@@ -30499,8 +30825,7 @@
     fields: () => ({[_codec]: CodecOfS$T()}),
     getters: () => ({
       encoder: dart.definiteFunctionType(convert.Converter$(T, S), []),
-      decoder: dart.definiteFunctionType(convert.Converter$(S, T), []),
-      inverted: dart.definiteFunctionType(convert.Codec$(S, T), [])
+      decoder: dart.definiteFunctionType(convert.Converter$(S, T), [])
     })
   });
   return _InvertedCodec;
@@ -30531,10 +30856,7 @@
       [_first]: ConverterOfS$M(),
       [_second]: ConverterOfM$T()
     }),
-    methods: () => ({
-      convert: dart.definiteFunctionType(T, [S]),
-      startChunkedConversion: dart.definiteFunctionType(core.Sink$(S), [SinkOfT()])
-    })
+    methods: () => ({convert: dart.definiteFunctionType(T, [S])})
   });
   return _FusedConverter;
 });
@@ -30853,9 +31175,7 @@
   }),
   methods: () => ({
     convert: dart.definiteFunctionType(core.String, [core.Object]),
-    startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfString()]),
-    bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfObject()]),
-    fuse: dart.definiteFunctionType(T => [convert.Converter$(core.Object, T), [convert.Converter$(core.String, T)]])
+    startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfString()])
   })
 });
 const _indent = Symbol('_indent');
@@ -30929,8 +31249,7 @@
   }),
   methods: () => ({
     convert: dart.definiteFunctionType(core.List$(core.int), [core.Object]),
-    startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfListOfint()]),
-    bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfObject()])
+    startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfListOfint()])
   }),
   sfields: () => ({DEFAULT_BUFFER_SIZE: core.int}),
   statics: () => ({_utf8Encode: dart.definiteFunctionType(core.List$(core.int), [core.String])}),
@@ -31037,8 +31356,7 @@
   fields: () => ({[_reviver]: convert._Reviver}),
   methods: () => ({
     convert: dart.definiteFunctionType(dart.dynamic, [core.String]),
-    startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfObject()]),
-    bind: dart.definiteFunctionType(async.Stream$(core.Object), [StreamOfString()])
+    startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfObject()])
   })
 });
 convert._parseJson = function(source, reviver) {
@@ -31219,7 +31537,7 @@
       }
       keyValueList[dartx._set](i++, key);
       keyValueList[dartx._set](i++, value);
-    }, dynamicAnddynamicTovoid()));
+    }, dynamicAnddynamicToNull()));
     if (!allStringKeys) return false;
     this.writeString('{');
     let separator = '"';
@@ -31320,7 +31638,7 @@
       }
       keyValueList[dartx._set](i++, key);
       keyValueList[dartx._set](i++, value);
-    }, dynamicAnddynamicTovoid()));
+    }, dynamicAnddynamicToNull()));
     if (!allStringKeys) return false;
     this.writeString('{\n');
     this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1;
@@ -31635,8 +31953,7 @@
   }
 };
 dart.setSignature(convert.Latin1Decoder, {
-  constructors: () => ({new: dart.definiteFunctionType(convert.Latin1Decoder, [], {allowInvalid: core.bool})}),
-  methods: () => ({startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])})
+  constructors: () => ({new: dart.definiteFunctionType(convert.Latin1Decoder, [], {allowInvalid: core.bool})})
 });
 const _addSliceToSink = Symbol('_addSliceToSink');
 convert._Latin1DecoderSink = class _Latin1DecoderSink extends convert.ByteConversionSinkBase {
@@ -32224,8 +32541,7 @@
   constructors: () => ({new: dart.definiteFunctionType(convert.Utf8Encoder, [])}),
   methods: () => ({
     convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
-    startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()]),
-    bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfString()])
+    startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
   })
 });
 convert._Utf8Encoder = class _Utf8Encoder extends core.Object {
@@ -32470,9 +32786,7 @@
   fields: () => ({[_allowMalformed]: core.bool}),
   methods: () => ({
     convert: dart.definiteFunctionType(core.String, [ListOfint()], [core.int, core.int]),
-    startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()]),
-    bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfListOfint()]),
-    fuse: dart.definiteFunctionType(T => [convert.Converter$(core.List$(core.int), T), [convert.Converter$(core.String, T)]])
+    startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])
   }),
   statics: () => ({_convertIntercepted: dart.definiteFunctionType(core.String, [core.bool, ListOfint(), core.int, core.int])}),
   names: ['_convertIntercepted']
@@ -33570,7 +33884,7 @@
         sb.write(": ");
         sb.write(core.Error.safeToString(value));
         i++;
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
     }
     if (this[_existingArgumentNames] == null) {
       return dart.str`NoSuchMethodError : method not found: '${this[_memberName]}'\n` + dart.str`Receiver: ${core.Error.safeToString(this[_receiver])}\n` + dart.str`Arguments: [${sb}]`;
@@ -33896,10 +34210,21 @@
     let result = dart.map({}, core.String, dart.dynamic);
     namedArguments[dartx.forEach](dart.fn((symbol, value) => {
       result[dartx._set](core._symbolToString(symbol), value);
-    }, SymbolAnddynamicTovoid()));
+    }, SymbolAnddynamicToNull()));
     return result;
   }
 };
+core.Function.is = function is_Function(o) {
+  return typeof o == "function";
+};
+core.Function.as = function as_Function(o) {
+  if (typeof o == "function" || o == null) return o;
+  return dart.as(o, core.Function);
+};
+core.Function._check = function check_String(o) {
+  if (typeof o == "function" || o == null) return o;
+  return dart.check(o, core.Function);
+};
 dart.setSignature(core.Function, {
   statics: () => ({
     apply: dart.definiteFunctionType(dart.dynamic, [core.Function, core.List], [MapOfSymbol$dynamic()]),
@@ -33978,10 +34303,6 @@
       [_generator]: _GeneratorOfE()
     }),
     getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-    methods: () => ({
-      skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-      take: dart.definiteFunctionType(core.Iterable$(E), [core.int])
-    }),
     statics: () => ({_id: dart.definiteFunctionType(core.int, [core.int])}),
     names: ['_id']
   });
@@ -34163,18 +34484,7 @@
     return new core._StringStackTrace(stackTraceString);
   }
   static get current() {
-    if (Error.captureStackTrace != null) {
-      let error = new Error();
-      Error.captureStackTrace(error);
-      return _js_helper.getTraceFromException(error);
-    }
-    try {
-      dart.throw('');
-    } catch (_) {
-      let stackTrace = dart.stackTrace(_);
-      return stackTrace;
-    }
-
+    return _js_helper.getTraceFromException(new Error());
   }
 };
 dart.setSignature(core.StackTrace, {
@@ -34308,10 +34618,7 @@
 dart.setSignature(core.Runes, {
   constructors: () => ({new: dart.definiteFunctionType(core.Runes, [core.String])}),
   fields: () => ({string: core.String}),
-  getters: () => ({
-    iterator: dart.definiteFunctionType(core.RuneIterator, []),
-    last: dart.definiteFunctionType(core.int, [])
-  })
+  getters: () => ({iterator: dart.definiteFunctionType(core.RuneIterator, [])})
 });
 dart.defineExtensionMembers(core.Runes, ['iterator', 'last']);
 core._isLeadSurrogate = function(code) {
@@ -34887,7 +35194,7 @@
           dart.throw(new core.UnsupportedError(dart.str`Illegal path character ${segment}`));
         }
       }
-    }, StringTovoid()));
+    }, StringToNull()));
   }
   static _checkWindowsPathReservedCharacters(segments, argumentError, firstSegment) {
     if (firstSegment === void 0) firstSegment = 0;
@@ -35244,7 +35551,7 @@
           writeParameter(key, value);
         }
       }
-    }, StringAnddynamicTovoid()));
+    }, StringAnddynamicToNull()));
     return result.toString();
   }
   static _makeFragment(fragment, start, end) {
@@ -36232,7 +36539,7 @@
       if (indices != null) indices[dartx.add](buffer.length);
       buffer.write('=');
       buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
-    }, StringAndStringTovoid())));
+    }, StringAndStringToNull())));
   }
   static _validateMimeType(mimeType) {
     let slashIndex = -1;
@@ -37219,6 +37526,14902 @@
   return 0;
 };
 dart.fn(developer._getServiceMinorVersion, VoidToint());
+io.BytesBuilder = class BytesBuilder extends core.Object {
+  static new(opts) {
+    let copy = opts && 'copy' in opts ? opts.copy : true;
+    if (dart.test(copy)) {
+      return new io._CopyingBytesBuilder();
+    } else {
+      return new io._BytesBuilder();
+    }
+  }
+};
+dart.setSignature(io.BytesBuilder, {
+  constructors: () => ({new: dart.definiteFunctionType(io.BytesBuilder, [], {copy: core.bool})})
+});
+const _length = Symbol('_length');
+const _buffer = Symbol('_buffer');
+const _pow2roundup = Symbol('_pow2roundup');
+io._CopyingBytesBuilder = class _CopyingBytesBuilder extends core.Object {
+  new() {
+    this[_length] = 0;
+    this[_buffer] = null;
+  }
+  add(bytes) {
+    let bytesLength = bytes[dartx.length];
+    if (bytesLength == 0) return;
+    let required = dart.notNull(this[_length]) + dart.notNull(bytesLength);
+    if (this[_buffer] == null) {
+      let size = this[_pow2roundup](required);
+      size = math.max(core.int)(size, io._CopyingBytesBuilder._INIT_SIZE);
+      this[_buffer] = typed_data.Uint8List.new(size);
+    } else if (dart.notNull(this[_buffer][dartx.length]) < required) {
+      let size = dart.notNull(this[_pow2roundup](required)) * 2;
+      let newBuffer = typed_data.Uint8List.new(size);
+      newBuffer[dartx.setRange](0, this[_buffer][dartx.length], this[_buffer]);
+      this[_buffer] = newBuffer;
+    }
+    dart.assert(dart.notNull(this[_buffer][dartx.length]) >= required);
+    if (typed_data.Uint8List.is(bytes)) {
+      this[_buffer][dartx.setRange](this[_length], required, bytes);
+    } else {
+      for (let i = 0; i < dart.notNull(bytesLength); i++) {
+        this[_buffer][dartx._set](dart.notNull(this[_length]) + i, bytes[dartx._get](i));
+      }
+    }
+    this[_length] = required;
+  }
+  addByte(byte) {
+    this.add(JSArrayOfint().of([byte]));
+  }
+  takeBytes() {
+    if (this[_buffer] == null) return typed_data.Uint8List.new(0);
+    let buffer = typed_data.Uint8List.view(this[_buffer][dartx.buffer], 0, this[_length]);
+    this.clear();
+    return buffer;
+  }
+  toBytes() {
+    if (this[_buffer] == null) return typed_data.Uint8List.new(0);
+    return typed_data.Uint8List.fromList(typed_data.Uint8List.view(this[_buffer][dartx.buffer], 0, this[_length]));
+  }
+  get length() {
+    return this[_length];
+  }
+  get isEmpty() {
+    return this[_length] == 0;
+  }
+  get isNotEmpty() {
+    return this[_length] != 0;
+  }
+  clear() {
+    this[_length] = 0;
+    this[_buffer] = null;
+  }
+  [_pow2roundup](x) {
+    x = dart.notNull(x) - 1;
+    x = (dart.notNull(x) | x[dartx['>>']](1)) >>> 0;
+    x = (dart.notNull(x) | x[dartx['>>']](2)) >>> 0;
+    x = (dart.notNull(x) | x[dartx['>>']](4)) >>> 0;
+    x = (dart.notNull(x) | x[dartx['>>']](8)) >>> 0;
+    x = (dart.notNull(x) | x[dartx['>>']](16)) >>> 0;
+    return dart.notNull(x) + 1;
+  }
+};
+io._CopyingBytesBuilder[dart.implements] = () => [io.BytesBuilder];
+dart.setSignature(io._CopyingBytesBuilder, {
+  fields: () => ({
+    [_length]: core.int,
+    [_buffer]: typed_data.Uint8List
+  }),
+  getters: () => ({
+    length: dart.definiteFunctionType(core.int, []),
+    isEmpty: dart.definiteFunctionType(core.bool, []),
+    isNotEmpty: dart.definiteFunctionType(core.bool, [])
+  }),
+  methods: () => ({
+    add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+    addByte: dart.definiteFunctionType(dart.void, [core.int]),
+    takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
+    toBytes: dart.definiteFunctionType(core.List$(core.int), []),
+    clear: dart.definiteFunctionType(dart.void, []),
+    [_pow2roundup]: dart.definiteFunctionType(core.int, [core.int])
+  }),
+  sfields: () => ({_INIT_SIZE: core.int})
+});
+io._CopyingBytesBuilder._INIT_SIZE = 1024;
+const _chunks = Symbol('_chunks');
+io._BytesBuilder = class _BytesBuilder extends core.Object {
+  new() {
+    this[_chunks] = JSArrayOfListOfint().of([]);
+    this[_length] = 0;
+  }
+  add(bytes) {
+    if (!typed_data.Uint8List.is(bytes)) {
+      bytes = typed_data.Uint8List.fromList(bytes);
+    }
+    this[_chunks][dartx.add](bytes);
+    this[_length] = dart.notNull(this[_length]) + dart.notNull(bytes[dartx.length]);
+  }
+  addByte(byte) {
+    this.add(JSArrayOfint().of([byte]));
+  }
+  takeBytes() {
+    if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+    if (this[_chunks][dartx.length] == 1) {
+      let buffer = this[_chunks][dartx.single];
+      this.clear();
+      return buffer;
+    }
+    let buffer = typed_data.Uint8List.new(this[_length]);
+    let offset = 0;
+    for (let chunk of this[_chunks]) {
+      buffer[dartx.setRange](offset, dart.notNull(offset) + dart.notNull(chunk[dartx.length]), chunk);
+      offset = dart.notNull(offset) + dart.notNull(chunk[dartx.length]);
+    }
+    this.clear();
+    return buffer;
+  }
+  toBytes() {
+    if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+    let buffer = typed_data.Uint8List.new(this[_length]);
+    let offset = 0;
+    for (let chunk of this[_chunks]) {
+      buffer[dartx.setRange](offset, dart.notNull(offset) + dart.notNull(chunk[dartx.length]), chunk);
+      offset = dart.notNull(offset) + dart.notNull(chunk[dartx.length]);
+    }
+    return buffer;
+  }
+  get length() {
+    return this[_length];
+  }
+  get isEmpty() {
+    return this[_length] == 0;
+  }
+  get isNotEmpty() {
+    return this[_length] != 0;
+  }
+  clear() {
+    this[_length] = 0;
+    this[_chunks][dartx.clear]();
+  }
+};
+io._BytesBuilder[dart.implements] = () => [io.BytesBuilder];
+dart.setSignature(io._BytesBuilder, {
+  fields: () => ({
+    [_length]: core.int,
+    [_chunks]: ListOfListOfint()
+  }),
+  getters: () => ({
+    length: dart.definiteFunctionType(core.int, []),
+    isEmpty: dart.definiteFunctionType(core.bool, []),
+    isNotEmpty: dart.definiteFunctionType(core.bool, [])
+  }),
+  methods: () => ({
+    add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+    addByte: dart.definiteFunctionType(dart.void, [core.int]),
+    takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
+    toBytes: dart.definiteFunctionType(core.List$(core.int), []),
+    clear: dart.definiteFunctionType(dart.void, [])
+  })
+});
+io._SUCCESS_RESPONSE = 0;
+io._ILLEGAL_ARGUMENT_RESPONSE = 1;
+io._OSERROR_RESPONSE = 2;
+io._FILE_CLOSED_RESPONSE = 3;
+io._ERROR_RESPONSE_ERROR_TYPE = 0;
+io._OSERROR_RESPONSE_ERROR_CODE = 1;
+io._OSERROR_RESPONSE_MESSAGE = 2;
+io._isErrorResponse = function(response) {
+  return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+};
+dart.fn(io._isErrorResponse, dynamicTobool());
+io._exceptionFromResponse = function(response, message, path) {
+  dart.assert(io._isErrorResponse(response));
+  switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+    case io._ILLEGAL_ARGUMENT_RESPONSE:
+    {
+      return new core.ArgumentError();
+    }
+    case io._OSERROR_RESPONSE:
+    {
+      let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+      return new io.FileSystemException(message, path, err);
+    }
+    case io._FILE_CLOSED_RESPONSE:
+    {
+      return new io.FileSystemException("File closed", path);
+    }
+    default:
+    {
+      return core.Exception.new("Unknown error");
+    }
+  }
+};
+dart.fn(io._exceptionFromResponse, dynamicAndStringAndStringTodynamic());
+io.IOException = class IOException extends core.Object {
+  toString() {
+    return "IOException";
+  }
+};
+io.IOException[dart.implements] = () => [core.Exception];
+io.OSError = class OSError extends core.Object {
+  new(message, errorCode) {
+    if (message === void 0) message = "";
+    if (errorCode === void 0) errorCode = io.OSError.noErrorCode;
+    this.message = message;
+    this.errorCode = errorCode;
+  }
+  toString() {
+    let sb = new core.StringBuffer();
+    sb.write("OS Error");
+    if (!dart.test(this.message[dartx.isEmpty])) {
+      sb.write(": ");
+      sb.write(this.message);
+      if (this.errorCode != io.OSError.noErrorCode) {
+        sb.write(", errno = ");
+        sb.write(dart.toString(this.errorCode));
+      }
+    } else if (this.errorCode != io.OSError.noErrorCode) {
+      sb.write(": errno = ");
+      sb.write(dart.toString(this.errorCode));
+    }
+    return sb.toString();
+  }
+};
+dart.setSignature(io.OSError, {
+  constructors: () => ({new: dart.definiteFunctionType(io.OSError, [], [core.String, core.int])}),
+  fields: () => ({
+    message: core.String,
+    errorCode: core.int
+  }),
+  sfields: () => ({noErrorCode: core.int})
+});
+io.OSError.noErrorCode = -1;
+io._BufferAndStart = class _BufferAndStart extends core.Object {
+  new(buffer, start) {
+    this.buffer = buffer;
+    this.start = start;
+  }
+};
+dart.setSignature(io._BufferAndStart, {
+  constructors: () => ({new: dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int])}),
+  fields: () => ({
+    buffer: core.List,
+    start: core.int
+  })
+});
+io._ensureFastAndSerializableByteData = function(buffer, start, end) {
+  if (typed_data.Uint8List.is(buffer) || typed_data.Int8List.is(buffer)) {
+    return new io._BufferAndStart(buffer, start);
+  }
+  let length = dart.notNull(end) - dart.notNull(start);
+  let newBuffer = typed_data.Uint8List.new(length);
+  let j = start;
+  for (let i = 0; i < length; i++) {
+    let value = core.int._check(buffer[dartx._get](j));
+    if (!(typeof value == 'number')) {
+      dart.throw(new core.ArgumentError(dart.str`List element is not an integer at index ${j}`));
+    }
+    newBuffer[dartx._set](i, value);
+    j = dart.notNull(j) + 1;
+  }
+  return new io._BufferAndStart(newBuffer, 0);
+};
+dart.fn(io._ensureFastAndSerializableByteData, ListAndintAndintTo_BufferAndStart());
+io._IOCrypto = class _IOCrypto extends core.Object {
+  static getRandomBytes(count) {
+    dart.throw(new core.UnsupportedError("_IOCrypto.getRandomBytes"));
+  }
+};
+dart.setSignature(io._IOCrypto, {
+  statics: () => ({getRandomBytes: dart.definiteFunctionType(typed_data.Uint8List, [core.int])}),
+  names: ['getRandomBytes']
+});
+io._CryptoUtils = class _CryptoUtils extends core.Object {
+  static bytesToHex(bytes) {
+    let result = new core.StringBuffer();
+    for (let part of bytes) {
+      result.write(dart.str`${dart.notNull(part) < 16 ? '0' : ''}${part[dartx.toRadixString](16)}`);
+    }
+    return result.toString();
+  }
+  static bytesToBase64(bytes, urlSafe, addLineSeparator) {
+    if (urlSafe === void 0) urlSafe = false;
+    if (addLineSeparator === void 0) addLineSeparator = false;
+    let len = bytes[dartx.length];
+    if (len == 0) {
+      return "";
+    }
+    let lookup = dart.test(urlSafe) ? io._CryptoUtils._encodeTableUrlSafe : io._CryptoUtils._encodeTable;
+    let remainderLength = dart.asInt(len[dartx.remainder](3));
+    let chunkLength = dart.notNull(len) - dart.notNull(remainderLength);
+    let outputLen = (dart.notNull(len) / 3)[dartx.truncate]() * 4 + (dart.notNull(remainderLength) > 0 ? 4 : 0);
+    if (dart.test(addLineSeparator)) {
+      outputLen = outputLen + (((outputLen - 1) / io._CryptoUtils.LINE_LENGTH)[dartx.truncate]() << 1 >>> 0);
+    }
+    let out = ListOfint().new(outputLen);
+    let j = 0, i = 0, c = 0;
+    while (i < chunkLength) {
+      let x = (dart.notNull(bytes[dartx._get](i++)) << 16 & 16777215 | dart.notNull(bytes[dartx._get](i++)) << 8 & 16777215 | dart.notNull(bytes[dartx._get](i++))) >>> 0;
+      out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](18)));
+      out[dartx._set](j++, lookup[dartx.codeUnitAt](x >> 12 & 63));
+      out[dartx._set](j++, lookup[dartx.codeUnitAt](x >> 6 & 63));
+      out[dartx._set](j++, lookup[dartx.codeUnitAt](x & 63));
+      if (dart.test(addLineSeparator) && ++c == 19 && j < outputLen - 2) {
+        out[dartx._set](j++, io._CryptoUtils.CR);
+        out[dartx._set](j++, io._CryptoUtils.LF);
+        c = 0;
+      }
+    }
+    if (remainderLength == 1) {
+      let x = bytes[dartx._get](i);
+      out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](2)));
+      out[dartx._set](j++, lookup[dartx.codeUnitAt](dart.notNull(x) << 4 & 63));
+      out[dartx._set](j++, io._CryptoUtils.PAD);
+      out[dartx._set](j++, io._CryptoUtils.PAD);
+    } else if (remainderLength == 2) {
+      let x = bytes[dartx._get](i);
+      let y = bytes[dartx._get](i + 1);
+      out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](2)));
+      out[dartx._set](j++, lookup[dartx.codeUnitAt]((dart.notNull(x) << 4 | dart.notNull(y) >> 4) & 63));
+      out[dartx._set](j++, lookup[dartx.codeUnitAt](dart.notNull(y) << 2 & 63));
+      out[dartx._set](j++, io._CryptoUtils.PAD);
+    }
+    return core.String.fromCharCodes(out);
+  }
+  static base64StringToBytes(input, ignoreInvalidCharacters) {
+    if (ignoreInvalidCharacters === void 0) ignoreInvalidCharacters = true;
+    let len = input[dartx.length];
+    if (len == 0) {
+      return ListOfint().new(0);
+    }
+    let extrasLen = 0;
+    for (let i = 0; i < dart.notNull(len); i++) {
+      let c = io._CryptoUtils._decodeTable[dartx._get](input[dartx.codeUnitAt](i));
+      if (dart.notNull(c) < 0) {
+        extrasLen++;
+        if (c == -2 && !dart.test(ignoreInvalidCharacters)) {
+          dart.throw(new core.FormatException(dart.str`Invalid character: ${input[dartx._get](i)}`));
+        }
+      }
+    }
+    if ((dart.notNull(len) - extrasLen)[dartx['%']](4) != 0) {
+      dart.throw(new core.FormatException(dart.str`Size of Base 64 characters in Input\n          must be a multiple of 4. Input: ${input}`));
+    }
+    let padLength = 0;
+    for (let i = dart.notNull(len) - 1; i >= 0; i--) {
+      let currentCodeUnit = input[dartx.codeUnitAt](i);
+      if (dart.notNull(io._CryptoUtils._decodeTable[dartx._get](currentCodeUnit)) > 0) break;
+      if (currentCodeUnit == io._CryptoUtils.PAD) padLength++;
+    }
+    let outputLen = ((dart.notNull(len) - extrasLen) * 6)[dartx['>>']](3) - padLength;
+    let out = ListOfint().new(outputLen);
+    for (let i = 0, o = 0; o < outputLen;) {
+      let x = 0;
+      for (let j = 4; j > 0;) {
+        let c = io._CryptoUtils._decodeTable[dartx._get](input[dartx.codeUnitAt](i++));
+        if (dart.notNull(c) >= 0) {
+          x = (x << 6 & 16777215 | dart.notNull(c)) >>> 0;
+          j--;
+        }
+      }
+      out[dartx._set](o++, x[dartx['>>']](16));
+      if (o < outputLen) {
+        out[dartx._set](o++, x >> 8 & 255);
+        if (o < outputLen) out[dartx._set](o++, x & 255);
+      }
+    }
+    return out;
+  }
+};
+dart.setSignature(io._CryptoUtils, {
+  sfields: () => ({
+    PAD: core.int,
+    CR: core.int,
+    LF: core.int,
+    LINE_LENGTH: core.int,
+    _encodeTable: core.String,
+    _encodeTableUrlSafe: core.String,
+    _decodeTable: ListOfint()
+  }),
+  statics: () => ({
+    bytesToHex: dart.definiteFunctionType(core.String, [ListOfint()]),
+    bytesToBase64: dart.definiteFunctionType(core.String, [ListOfint()], [core.bool, core.bool]),
+    base64StringToBytes: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.bool])
+  }),
+  names: ['bytesToHex', 'bytesToBase64', 'base64StringToBytes']
+});
+io._CryptoUtils.PAD = 61;
+io._CryptoUtils.CR = 13;
+io._CryptoUtils.LF = 10;
+io._CryptoUtils.LINE_LENGTH = 76;
+io._CryptoUtils._encodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+io._CryptoUtils._encodeTableUrlSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+io._CryptoUtils._decodeTable = dart.constList([-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, 62, -2, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, 0, -2, -2, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, 63, -2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], core.int);
+io._MASK_8 = 255;
+io._MASK_32 = 4294967295;
+io._BITS_PER_BYTE = 8;
+io._BYTES_PER_WORD = 4;
+const _chunkSizeInWords = Symbol('_chunkSizeInWords');
+const _digestSizeInWords = Symbol('_digestSizeInWords');
+const _bigEndianWords = Symbol('_bigEndianWords');
+const _pendingData = Symbol('_pendingData');
+const _lengthInBytes = Symbol('_lengthInBytes');
+const _currentChunk = Symbol('_currentChunk');
+const _h = Symbol('_h');
+const _digestCalled = Symbol('_digestCalled');
+const _iterate = Symbol('_iterate');
+const _resultAsBytes = Symbol('_resultAsBytes');
+const _finalizeData = Symbol('_finalizeData');
+const _add32 = Symbol('_add32');
+const _roundUp = Symbol('_roundUp');
+const _rotl32 = Symbol('_rotl32');
+const _wordToBytes = Symbol('_wordToBytes');
+const _bytesToChunk = Symbol('_bytesToChunk');
+const _updateHash = Symbol('_updateHash');
+io._HashBase = class _HashBase extends core.Object {
+  new(chunkSizeInWords, digestSizeInWords, bigEndianWords) {
+    this[_chunkSizeInWords] = chunkSizeInWords;
+    this[_digestSizeInWords] = digestSizeInWords;
+    this[_bigEndianWords] = bigEndianWords;
+    this[_pendingData] = JSArrayOfint().of([]);
+    this[_lengthInBytes] = 0;
+    this[_currentChunk] = null;
+    this[_h] = null;
+    this[_digestCalled] = false;
+    this[_currentChunk] = ListOfint().new(this[_chunkSizeInWords]);
+    this[_h] = ListOfint().new(this[_digestSizeInWords]);
+  }
+  add(data) {
+    if (dart.test(this[_digestCalled])) {
+      dart.throw(new core.StateError('Hash update method called after digest was retrieved'));
+    }
+    this[_lengthInBytes] = dart.notNull(this[_lengthInBytes]) + dart.notNull(data[dartx.length]);
+    this[_pendingData][dartx.addAll](data);
+    this[_iterate]();
+  }
+  close() {
+    if (dart.test(this[_digestCalled])) {
+      return ListOfint()._check(this[_resultAsBytes]());
+    }
+    this[_digestCalled] = true;
+    this[_finalizeData]();
+    this[_iterate]();
+    dart.assert(this[_pendingData][dartx.length] == 0);
+    return ListOfint()._check(this[_resultAsBytes]());
+  }
+  get blockSize() {
+    return dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+  }
+  [_add32](x, y) {
+    return dart.dsend(dart.dsend(x, '+', y), '&', io._MASK_32);
+  }
+  [_roundUp](val, n) {
+    return dart.dsend(dart.dsend(dart.dsend(val, '+', n), '-', 1), '&', dart.dsend(n, '_negate'));
+  }
+  [_rotl32](val, shift) {
+    let mod_shift = dart.notNull(shift) & 31;
+    return (val[dartx['<<']](mod_shift) & io._MASK_32 | ((dart.notNull(val) & io._MASK_32) >>> 0)[dartx['>>']](32 - mod_shift)) >>> 0;
+  }
+  [_resultAsBytes]() {
+    let result = [];
+    for (let i = 0; i < dart.notNull(this[_h][dartx.length]); i++) {
+      result[dartx.addAll](core.Iterable._check(this[_wordToBytes](this[_h][dartx._get](i))));
+    }
+    return result;
+  }
+  [_bytesToChunk](data, dataIndex) {
+    dart.assert(dart.notNull(data[dartx.length]) - dart.notNull(dataIndex) >= dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD);
+    for (let wordIndex = 0; wordIndex < dart.notNull(this[_chunkSizeInWords]); wordIndex++) {
+      let w3 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dataIndex) : data[dartx._get](dart.notNull(dataIndex) + 3);
+      let w2 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 1) : data[dartx._get](dart.notNull(dataIndex) + 2);
+      let w1 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 2) : data[dartx._get](dart.notNull(dataIndex) + 1);
+      let w0 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 3) : data[dartx._get](dataIndex);
+      dataIndex = dart.notNull(dataIndex) + 4;
+      let word = (dart.notNull(w3) & 255) << 24 >>> 0;
+      word = (word | (dart.notNull(w2) & io._MASK_8) << 16) >>> 0;
+      word = (word | (dart.notNull(w1) & io._MASK_8) << 8) >>> 0;
+      word = (word | dart.notNull(w0) & io._MASK_8) >>> 0;
+      this[_currentChunk][dartx._set](wordIndex, word);
+    }
+  }
+  [_wordToBytes](word) {
+    let bytes = ListOfint().new(io._BYTES_PER_WORD);
+    bytes[dartx._set](0, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 24 : 0) & io._MASK_8);
+    bytes[dartx._set](1, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 16 : 8) & io._MASK_8);
+    bytes[dartx._set](2, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 8 : 16) & io._MASK_8);
+    bytes[dartx._set](3, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 0 : 24) & io._MASK_8);
+    return bytes;
+  }
+  [_iterate]() {
+    let len = this[_pendingData][dartx.length];
+    let chunkSizeInBytes = dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+    if (dart.notNull(len) >= chunkSizeInBytes) {
+      let index = 0;
+      for (; dart.notNull(len) - index >= chunkSizeInBytes; index = index + chunkSizeInBytes) {
+        this[_bytesToChunk](this[_pendingData], index);
+        this[_updateHash](this[_currentChunk]);
+      }
+      this[_pendingData] = this[_pendingData][dartx.sublist](index, len);
+    }
+  }
+  [_finalizeData]() {
+    this[_pendingData][dartx.add](128);
+    let contentsLength = dart.notNull(this[_lengthInBytes]) + 9;
+    let chunkSizeInBytes = dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+    let finalizedLength = this[_roundUp](contentsLength, chunkSizeInBytes);
+    let zeroPadding = dart.dsend(finalizedLength, '-', contentsLength);
+    for (let i = 0; i < dart.notNull(core.num._check(zeroPadding)); i++) {
+      this[_pendingData][dartx.add](0);
+    }
+    let lengthInBits = dart.notNull(this[_lengthInBytes]) * io._BITS_PER_BYTE;
+    dart.assert(lengthInBits < dart.notNull(math.pow(2, 32)));
+    if (dart.test(this[_bigEndianWords])) {
+      this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+      this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+    } else {
+      this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+      this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+    }
+  }
+};
+dart.setSignature(io._HashBase, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HashBase, [core.int, core.int, core.bool])}),
+  fields: () => ({
+    [_chunkSizeInWords]: core.int,
+    [_digestSizeInWords]: core.int,
+    [_bigEndianWords]: core.bool,
+    [_lengthInBytes]: core.int,
+    [_pendingData]: ListOfint(),
+    [_currentChunk]: ListOfint(),
+    [_h]: ListOfint(),
+    [_digestCalled]: core.bool
+  }),
+  getters: () => ({blockSize: dart.definiteFunctionType(core.int, [])}),
+  methods: () => ({
+    add: dart.definiteFunctionType(dart.dynamic, [ListOfint()]),
+    close: dart.definiteFunctionType(core.List$(core.int), []),
+    [_add32]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
+    [_roundUp]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
+    [_rotl32]: dart.definiteFunctionType(core.int, [core.int, core.int]),
+    [_resultAsBytes]: dart.definiteFunctionType(dart.dynamic, []),
+    [_bytesToChunk]: dart.definiteFunctionType(dart.dynamic, [ListOfint(), core.int]),
+    [_wordToBytes]: dart.definiteFunctionType(dart.dynamic, [core.int]),
+    [_iterate]: dart.definiteFunctionType(dart.dynamic, []),
+    [_finalizeData]: dart.definiteFunctionType(dart.dynamic, [])
+  })
+});
+io._MD5 = class _MD5 extends io._HashBase {
+  new() {
+    super.new(16, 4, false);
+    this[_h][dartx._set](0, 1732584193);
+    this[_h][dartx._set](1, 4023233417);
+    this[_h][dartx._set](2, 2562383102);
+    this[_h][dartx._set](3, 271733878);
+  }
+  newInstance() {
+    return new io._MD5();
+  }
+  [_updateHash](m) {
+    dart.assert(m[dartx.length] == 16);
+    let a = this[_h][dartx._get](0);
+    let b = this[_h][dartx._get](1);
+    let c = this[_h][dartx._get](2);
+    let d = this[_h][dartx._get](3);
+    let t0 = null;
+    let t1 = null;
+    for (let i = 0; i < 64; i++) {
+      if (i < 16) {
+        t0 = (dart.notNull(b) & dart.notNull(c) | ~dart.notNull(b) & io._MASK_32 & dart.notNull(d)) >>> 0;
+        t1 = i;
+      } else if (i < 32) {
+        t0 = (dart.notNull(d) & dart.notNull(b) | ~dart.notNull(d) & io._MASK_32 & dart.notNull(c)) >>> 0;
+        t1 = (5 * i + 1)[dartx['%']](16);
+      } else if (i < 48) {
+        t0 = (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0;
+        t1 = (3 * i + 5)[dartx['%']](16);
+      } else {
+        t0 = (dart.notNull(c) ^ (dart.notNull(b) | ~dart.notNull(d) & io._MASK_32)) >>> 0;
+        t1 = (7 * i)[dartx['%']](16);
+      }
+      let temp = d;
+      d = c;
+      c = b;
+      b = core.int._check(this[_add32](b, this[_rotl32](core.int._check(this[_add32](this[_add32](a, t0), this[_add32](io._MD5._k[dartx._get](i), m[dartx._get](core.int._check(t1))))), io._MD5._r[dartx._get](i))));
+      a = temp;
+    }
+    this[_h][dartx._set](0, core.int._check(this[_add32](a, this[_h][dartx._get](0))));
+    this[_h][dartx._set](1, core.int._check(this[_add32](b, this[_h][dartx._get](1))));
+    this[_h][dartx._set](2, core.int._check(this[_add32](c, this[_h][dartx._get](2))));
+    this[_h][dartx._set](3, core.int._check(this[_add32](d, this[_h][dartx._get](3))));
+  }
+};
+dart.setSignature(io._MD5, {
+  constructors: () => ({new: dart.definiteFunctionType(io._MD5, [])}),
+  methods: () => ({
+    newInstance: dart.definiteFunctionType(io._MD5, []),
+    [_updateHash]: dart.definiteFunctionType(dart.void, [ListOfint()])
+  }),
+  sfields: () => ({
+    _k: ListOfint(),
+    _r: ListOfint()
+  })
+});
+io._MD5._k = dart.constList([3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426, 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134, 1804603682, 4254626195, 2792965006, 1236535329, 4129170786, 3225465664, 643717713, 3921069994, 3593408605, 38016083, 3634488961, 3889429448, 568446438, 3275163606, 4107603335, 1163531501, 2850285829, 4243563512, 1735328473, 2368359562, 4294588738, 2272392833, 1839030562, 4259657740, 2763975236, 1272893353, 4139469664, 3200236656, 681279174, 3936430074, 3572445317, 76029189, 3654602809, 3873151461, 530742520, 3299628645, 4096336452, 1126891415, 2878612391, 4237533241, 1700485571, 2399980690, 4293915773, 2240044497, 1873313359, 4264355552, 2734768916, 1309151649, 4149444226, 3174756917, 718787259, 3951481745], core.int);
+io._MD5._r = dart.constList([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21], core.int);
+const _w = Symbol('_w');
+io._SHA1 = class _SHA1 extends io._HashBase {
+  new() {
+    this[_w] = ListOfint().new(80);
+    super.new(16, 5, true);
+    this[_h][dartx._set](0, 1732584193);
+    this[_h][dartx._set](1, 4023233417);
+    this[_h][dartx._set](2, 2562383102);
+    this[_h][dartx._set](3, 271733878);
+    this[_h][dartx._set](4, 3285377520);
+  }
+  newInstance() {
+    return new io._SHA1();
+  }
+  [_updateHash](m) {
+    dart.assert(m[dartx.length] == 16);
+    let a = this[_h][dartx._get](0);
+    let b = this[_h][dartx._get](1);
+    let c = this[_h][dartx._get](2);
+    let d = this[_h][dartx._get](3);
+    let e = this[_h][dartx._get](4);
+    for (let i = 0; i < 80; i++) {
+      if (i < 16) {
+        this[_w][dartx._set](i, m[dartx._get](i));
+      } else {
+        let n = (dart.notNull(this[_w][dartx._get](i - 3)) ^ dart.notNull(this[_w][dartx._get](i - 8)) ^ dart.notNull(this[_w][dartx._get](i - 14)) ^ dart.notNull(this[_w][dartx._get](i - 16))) >>> 0;
+        this[_w][dartx._set](i, this[_rotl32](n, 1));
+      }
+      let t = this[_add32](this[_add32](this[_rotl32](a, 5), e), this[_w][dartx._get](i));
+      if (i < 20) {
+        t = this[_add32](this[_add32](t, (dart.notNull(b) & dart.notNull(c) | ~dart.notNull(b) & dart.notNull(d)) >>> 0), 1518500249);
+      } else if (i < 40) {
+        t = this[_add32](this[_add32](t, (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0), 1859775393);
+      } else if (i < 60) {
+        t = this[_add32](this[_add32](t, (dart.notNull(b) & dart.notNull(c) | dart.notNull(b) & dart.notNull(d) | dart.notNull(c) & dart.notNull(d)) >>> 0), 2400959708);
+      } else {
+        t = this[_add32](this[_add32](t, (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0), 3395469782);
+      }
+      e = d;
+      d = c;
+      c = this[_rotl32](b, 30);
+      b = a;
+      a = core.int._check(dart.dsend(t, '&', io._MASK_32));
+    }
+    this[_h][dartx._set](0, core.int._check(this[_add32](a, this[_h][dartx._get](0))));
+    this[_h][dartx._set](1, core.int._check(this[_add32](b, this[_h][dartx._get](1))));
+    this[_h][dartx._set](2, core.int._check(this[_add32](c, this[_h][dartx._get](2))));
+    this[_h][dartx._set](3, core.int._check(this[_add32](d, this[_h][dartx._get](3))));
+    this[_h][dartx._set](4, core.int._check(this[_add32](e, this[_h][dartx._get](4))));
+  }
+};
+dart.setSignature(io._SHA1, {
+  constructors: () => ({new: dart.definiteFunctionType(io._SHA1, [])}),
+  fields: () => ({[_w]: ListOfint()}),
+  methods: () => ({
+    newInstance: dart.definiteFunctionType(io._SHA1, []),
+    [_updateHash]: dart.definiteFunctionType(dart.void, [ListOfint()])
+  })
+});
+io.ZLibOption = class ZLibOption extends core.Object {};
+dart.setSignature(io.ZLibOption, {
+  sfields: () => ({
+    MIN_WINDOW_BITS: core.int,
+    MAX_WINDOW_BITS: core.int,
+    DEFAULT_WINDOW_BITS: core.int,
+    MIN_LEVEL: core.int,
+    MAX_LEVEL: core.int,
+    DEFAULT_LEVEL: core.int,
+    MIN_MEM_LEVEL: core.int,
+    MAX_MEM_LEVEL: core.int,
+    DEFAULT_MEM_LEVEL: core.int,
+    STRATEGY_FILTERED: core.int,
+    STRATEGY_HUFFMAN_ONLY: core.int,
+    STRATEGY_RLE: core.int,
+    STRATEGY_FIXED: core.int,
+    STRATEGY_DEFAULT: core.int
+  })
+});
+io.ZLibOption.MIN_WINDOW_BITS = 8;
+io.ZLibOption.MAX_WINDOW_BITS = 15;
+io.ZLibOption.DEFAULT_WINDOW_BITS = 15;
+io.ZLibOption.MIN_LEVEL = -1;
+io.ZLibOption.MAX_LEVEL = 9;
+io.ZLibOption.DEFAULT_LEVEL = 6;
+io.ZLibOption.MIN_MEM_LEVEL = 1;
+io.ZLibOption.MAX_MEM_LEVEL = 9;
+io.ZLibOption.DEFAULT_MEM_LEVEL = 8;
+io.ZLibOption.STRATEGY_FILTERED = 1;
+io.ZLibOption.STRATEGY_HUFFMAN_ONLY = 2;
+io.ZLibOption.STRATEGY_RLE = 3;
+io.ZLibOption.STRATEGY_FIXED = 4;
+io.ZLibOption.STRATEGY_DEFAULT = 0;
+io.ZLibCodec = class ZLibCodec extends convert.Codec$(core.List$(core.int), core.List$(core.int)) {
+  new(opts) {
+    let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+    let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+    let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+    let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+    let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+    let raw = opts && 'raw' in opts ? opts.raw : false;
+    let gzip = opts && 'gzip' in opts ? opts.gzip : false;
+    this.level = level;
+    this.windowBits = windowBits;
+    this.memLevel = memLevel;
+    this.strategy = strategy;
+    this.dictionary = dictionary;
+    this.raw = raw;
+    this.gzip = gzip;
+    super.new();
+    io._validateZLibeLevel(this.level);
+    io._validateZLibMemLevel(this.memLevel);
+    io._validateZLibStrategy(this.strategy);
+    io._validateZLibWindowBits(this.windowBits);
+  }
+  _default() {
+    this.level = io.ZLibOption.DEFAULT_LEVEL;
+    this.windowBits = io.ZLibOption.DEFAULT_WINDOW_BITS;
+    this.memLevel = io.ZLibOption.DEFAULT_MEM_LEVEL;
+    this.strategy = io.ZLibOption.STRATEGY_DEFAULT;
+    this.raw = false;
+    this.gzip = false;
+    this.dictionary = null;
+    super.new();
+  }
+  get encoder() {
+    return new io.ZLibEncoder({gzip: false, level: this.level, windowBits: this.windowBits, memLevel: this.memLevel, strategy: this.strategy, dictionary: this.dictionary, raw: this.raw});
+  }
+  get decoder() {
+    return new io.ZLibDecoder({windowBits: this.windowBits, dictionary: this.dictionary, raw: this.raw});
+  }
+};
+dart.addSimpleTypeTests(io.ZLibCodec);
+dart.defineNamedConstructor(io.ZLibCodec, '_default');
+dart.setSignature(io.ZLibCodec, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io.ZLibCodec, [], {level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool, gzip: core.bool}),
+    _default: dart.definiteFunctionType(io.ZLibCodec, [])
+  }),
+  fields: () => ({
+    gzip: core.bool,
+    level: core.int,
+    memLevel: core.int,
+    strategy: core.int,
+    windowBits: core.int,
+    raw: core.bool,
+    dictionary: ListOfint()
+  }),
+  getters: () => ({
+    encoder: dart.definiteFunctionType(io.ZLibEncoder, []),
+    decoder: dart.definiteFunctionType(io.ZLibDecoder, [])
+  })
+});
+io.ZLIB = dart.const(new io.ZLibCodec._default());
+io.GZipCodec = class GZipCodec extends convert.Codec$(core.List$(core.int), core.List$(core.int)) {
+  new(opts) {
+    let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+    let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+    let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+    let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+    let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+    let raw = opts && 'raw' in opts ? opts.raw : false;
+    let gzip = opts && 'gzip' in opts ? opts.gzip : true;
+    this.level = level;
+    this.windowBits = windowBits;
+    this.memLevel = memLevel;
+    this.strategy = strategy;
+    this.dictionary = dictionary;
+    this.raw = raw;
+    this.gzip = gzip;
+    super.new();
+    io._validateZLibeLevel(this.level);
+    io._validateZLibMemLevel(this.memLevel);
+    io._validateZLibStrategy(this.strategy);
+    io._validateZLibWindowBits(this.windowBits);
+  }
+  _default() {
+    this.level = io.ZLibOption.DEFAULT_LEVEL;
+    this.windowBits = io.ZLibOption.DEFAULT_WINDOW_BITS;
+    this.memLevel = io.ZLibOption.DEFAULT_MEM_LEVEL;
+    this.strategy = io.ZLibOption.STRATEGY_DEFAULT;
+    this.raw = false;
+    this.gzip = true;
+    this.dictionary = null;
+    super.new();
+  }
+  get encoder() {
+    return new io.ZLibEncoder({gzip: true, level: this.level, windowBits: this.windowBits, memLevel: this.memLevel, strategy: this.strategy, dictionary: this.dictionary, raw: this.raw});
+  }
+  get decoder() {
+    return new io.ZLibDecoder({windowBits: this.windowBits, dictionary: this.dictionary, raw: this.raw});
+  }
+};
+dart.addSimpleTypeTests(io.GZipCodec);
+dart.defineNamedConstructor(io.GZipCodec, '_default');
+dart.setSignature(io.GZipCodec, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io.GZipCodec, [], {level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool, gzip: core.bool}),
+    _default: dart.definiteFunctionType(io.GZipCodec, [])
+  }),
+  fields: () => ({
+    gzip: core.bool,
+    level: core.int,
+    memLevel: core.int,
+    strategy: core.int,
+    windowBits: core.int,
+    dictionary: ListOfint(),
+    raw: core.bool
+  }),
+  getters: () => ({
+    encoder: dart.definiteFunctionType(io.ZLibEncoder, []),
+    decoder: dart.definiteFunctionType(io.ZLibDecoder, [])
+  })
+});
+io.GZIP = dart.const(new io.GZipCodec._default());
+io.ZLibEncoder = class ZLibEncoder extends convert.Converter$(core.List$(core.int), core.List$(core.int)) {
+  new(opts) {
+    let gzip = opts && 'gzip' in opts ? opts.gzip : false;
+    let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+    let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+    let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+    let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+    let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+    let raw = opts && 'raw' in opts ? opts.raw : false;
+    this.gzip = gzip;
+    this.level = level;
+    this.windowBits = windowBits;
+    this.memLevel = memLevel;
+    this.strategy = strategy;
+    this.dictionary = dictionary;
+    this.raw = raw;
+    super.new();
+    io._validateZLibeLevel(this.level);
+    io._validateZLibMemLevel(this.memLevel);
+    io._validateZLibStrategy(this.strategy);
+    io._validateZLibWindowBits(this.windowBits);
+  }
+  convert(bytes) {
+    let sink = new io._BufferSink();
+    let _ = this.startChunkedConversion(sink);
+    _.add(bytes);
+    _.close();
+    return sink.builder.takeBytes();
+  }
+  startChunkedConversion(sink) {
+    if (!convert.ByteConversionSink.is(sink)) {
+      sink = convert.ByteConversionSink.from(sink);
+    }
+    return new io._ZLibEncoderSink(convert.ByteConversionSink._check(sink), this.gzip, this.level, this.windowBits, this.memLevel, this.strategy, this.dictionary, this.raw);
+  }
+};
+dart.addSimpleTypeTests(io.ZLibEncoder);
+dart.setSignature(io.ZLibEncoder, {
+  constructors: () => ({new: dart.definiteFunctionType(io.ZLibEncoder, [], {gzip: core.bool, level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool})}),
+  fields: () => ({
+    gzip: core.bool,
+    level: core.int,
+    memLevel: core.int,
+    strategy: core.int,
+    windowBits: core.int,
+    dictionary: ListOfint(),
+    raw: core.bool
+  }),
+  methods: () => ({
+    convert: dart.definiteFunctionType(core.List$(core.int), [ListOfint()]),
+    startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfListOfint()])
+  })
+});
+io.ZLibDecoder = class ZLibDecoder extends convert.Converter$(core.List$(core.int), core.List$(core.int)) {
+  new(opts) {
+    let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+    let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+    let raw = opts && 'raw' in opts ? opts.raw : false;
+    this.windowBits = windowBits;
+    this.dictionary = dictionary;
+    this.raw = raw;
+    super.new();
+    io._validateZLibWindowBits(this.windowBits);
+  }
+  convert(bytes) {
+    let sink = new io._BufferSink();
+    let _ = this.startChunkedConversion(sink);
+    _.add(bytes);
+    _.close();
+    return sink.builder.takeBytes();
+  }
+  startChunkedConversion(sink) {
+    if (!convert.ByteConversionSink.is(sink)) {
+      sink = convert.ByteConversionSink.from(sink);
+    }
+    return new io._ZLibDecoderSink(convert.ByteConversionSink._check(sink), this.windowBits, this.dictionary, this.raw);
+  }
+};
+dart.addSimpleTypeTests(io.ZLibDecoder);
+dart.setSignature(io.ZLibDecoder, {
+  constructors: () => ({new: dart.definiteFunctionType(io.ZLibDecoder, [], {windowBits: core.int, dictionary: ListOfint(), raw: core.bool})}),
+  fields: () => ({
+    windowBits: core.int,
+    dictionary: ListOfint(),
+    raw: core.bool
+  }),
+  methods: () => ({
+    convert: dart.definiteFunctionType(core.List$(core.int), [ListOfint()]),
+    startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfListOfint()])
+  })
+});
+io._BufferSink = class _BufferSink extends convert.ByteConversionSink {
+  new() {
+    this.builder = io.BytesBuilder.new({copy: false});
+    super.new();
+  }
+  add(chunk) {
+    this.builder.add(chunk);
+  }
+  addSlice(chunk, start, end, isLast) {
+    if (typed_data.Uint8List.is(chunk)) {
+      let list = chunk;
+      this.builder.add(typed_data.Uint8List.view(list[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+    } else {
+      this.builder.add(chunk[dartx.sublist](start, end));
+    }
+  }
+  close() {}
+};
+dart.setSignature(io._BufferSink, {
+  fields: () => ({builder: io.BytesBuilder}),
+  methods: () => ({
+    add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+    addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+    close: dart.definiteFunctionType(dart.void, [])
+  })
+});
+const _sink = Symbol('_sink');
+const _filter = Symbol('_filter');
+const _closed = Symbol('_closed');
+const _empty = Symbol('_empty');
+let const;
+io._FilterSink = class _FilterSink extends convert.ByteConversionSink {
+  new(sink, filter) {
+    this[_sink] = sink;
+    this[_filter] = filter;
+    this[_closed] = false;
+    this[_empty] = true;
+    super.new();
+  }
+  add(data) {
+    this.addSlice(data, 0, data[dartx.length], false);
+  }
+  addSlice(data, start, end, isLast) {
+    if (dart.test(this[_closed])) return;
+    if (end == null) dart.throw(new core.ArgumentError.notNull("end"));
+    core.RangeError.checkValidRange(start, end, data[dartx.length]);
+    try {
+      this[_empty] = false;
+      let bufferAndStart = io._ensureFastAndSerializableByteData(data, start, end);
+      this[_filter].process(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+      let out = null;
+      while ((out = this[_filter].processed({flush: false})) != null) {
+        this[_sink].add(ListOfint()._check(out));
+      }
+    } catch (e) {
+      this[_closed] = true;
+      throw e;
+    }
+
+    if (dart.test(isLast)) this.close();
+  }
+  close() {
+    if (dart.test(this[_closed])) return;
+    if (dart.test(this[_empty])) this[_filter].process(const || (const = dart.constList([], core.int)), 0, 0);
+    try {
+      let out = null;
+      while ((out = this[_filter].processed({end: true})) != null) {
+        this[_sink].add(ListOfint()._check(out));
+      }
+    } catch (e) {
+      this[_closed] = true;
+      dart.throw(e);
+    }
+
+    this[_closed] = true;
+    this[_sink].close();
+  }
+};
+dart.setSignature(io._FilterSink, {
+  constructors: () => ({new: dart.definiteFunctionType(io._FilterSink, [convert.ByteConversionSink, io._Filter])}),
+  fields: () => ({
+    [_filter]: io._Filter,
+    [_sink]: convert.ByteConversionSink,
+    [_closed]: core.bool,
+    [_empty]: core.bool
+  }),
+  methods: () => ({
+    add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+    addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+    close: dart.definiteFunctionType(dart.void, [])
+  })
+});
+io._ZLibEncoderSink = class _ZLibEncoderSink extends io._FilterSink {
+  new(sink, gzip, level, windowBits, memLevel, strategy, dictionary, raw) {
+    super.new(sink, io._Filter._newZLibDeflateFilter(gzip, level, windowBits, memLevel, strategy, dictionary, raw));
+  }
+};
+dart.setSignature(io._ZLibEncoderSink, {
+  constructors: () => ({new: dart.definiteFunctionType(io._ZLibEncoderSink, [convert.ByteConversionSink, core.bool, core.int, core.int, core.int, core.int, ListOfint(), core.bool])})
+});
+io._ZLibDecoderSink = class _ZLibDecoderSink extends io._FilterSink {
+  new(sink, windowBits, dictionary, raw) {
+    super.new(sink, io._Filter._newZLibInflateFilter(windowBits, dictionary, raw));
+  }
+};
+dart.setSignature(io._ZLibDecoderSink, {
+  constructors: () => ({new: dart.definiteFunctionType(io._ZLibDecoderSink, [convert.ByteConversionSink, core.int, ListOfint(), core.bool])})
+});
+io._Filter = class _Filter extends core.Object {
+  static _newZLibDeflateFilter(gzip, level, windowBits, memLevel, strategy, dictionary, raw) {
+    dart.throw(new core.UnsupportedError("_newZLibDeflateFilter"));
+  }
+  static _newZLibInflateFilter(windowBits, dictionary, raw) {
+    dart.throw(new core.UnsupportedError("_newZLibInflateFilter"));
+  }
+};
+dart.setSignature(io._Filter, {
+  statics: () => ({
+    _newZLibDeflateFilter: dart.definiteFunctionType(io._Filter, [core.bool, core.int, core.int, core.int, core.int, ListOfint(), core.bool]),
+    _newZLibInflateFilter: dart.definiteFunctionType(io._Filter, [core.int, ListOfint(), core.bool])
+  }),
+  names: ['_newZLibDeflateFilter', '_newZLibInflateFilter']
+});
+io._validateZLibWindowBits = function(windowBits) {
+  if (io.ZLibOption.MIN_WINDOW_BITS > dart.notNull(windowBits) || io.ZLibOption.MAX_WINDOW_BITS < dart.notNull(windowBits)) {
+    dart.throw(new core.RangeError.range(windowBits, io.ZLibOption.MIN_WINDOW_BITS, io.ZLibOption.MAX_WINDOW_BITS));
+  }
+};
+dart.fn(io._validateZLibWindowBits, intTovoid());
+io._validateZLibeLevel = function(level) {
+  if (io.ZLibOption.MIN_LEVEL > dart.notNull(level) || io.ZLibOption.MAX_LEVEL < dart.notNull(level)) {
+    dart.throw(new core.RangeError.range(level, io.ZLibOption.MIN_LEVEL, io.ZLibOption.MAX_LEVEL));
+  }
+};
+dart.fn(io._validateZLibeLevel, intTovoid());
+io._validateZLibMemLevel = function(memLevel) {
+  if (io.ZLibOption.MIN_MEM_LEVEL > dart.notNull(memLevel) || io.ZLibOption.MAX_MEM_LEVEL < dart.notNull(memLevel)) {
+    dart.throw(new core.RangeError.range(memLevel, io.ZLibOption.MIN_MEM_LEVEL, io.ZLibOption.MAX_MEM_LEVEL));
+  }
+};
+dart.fn(io._validateZLibMemLevel, intTovoid());
+let const;
+io._validateZLibStrategy = function(strategy) {
+  let strategies = const || (const = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
+  if (strategies[dartx.indexOf](strategy) == -1) {
+    dart.throw(new core.ArgumentError("Unsupported 'strategy'"));
+  }
+};
+dart.fn(io._validateZLibStrategy, intTovoid());
+io.Directory = class Directory extends core.Object {
+  static new(path) {
+    return new io._Directory(path);
+  }
+  static fromUri(uri) {
+    return io.Directory.new(uri.toFilePath());
+  }
+  static get current() {
+    return io._Directory.current;
+  }
+  static set current(path) {
+    io._Directory.current = path;
+  }
+  static get systemTemp() {
+    return io._Directory.systemTemp;
+  }
+};
+io.Directory[dart.implements] = () => [io.FileSystemEntity];
+dart.setSignature(io.Directory, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io.Directory, [core.String]),
+    fromUri: dart.definiteFunctionType(io.Directory, [core.Uri])
+  }),
+  fields: () => ({path: core.String}),
+  sgetters: () => ({
+    current: dart.definiteFunctionType(io.Directory, []),
+    systemTemp: dart.definiteFunctionType(io.Directory, [])
+  }),
+  ssetters: () => ({current: dart.definiteFunctionType(dart.void, [dart.dynamic])})
+});
+const _isErrorResponse = Symbol('_isErrorResponse');
+const _exceptionOrErrorFromResponse = Symbol('_exceptionOrErrorFromResponse');
+const _absolutePath = Symbol('_absolutePath');
+const _computeExistingIndex = Symbol('_computeExistingIndex');
+const _delete = Symbol('_delete');
+const _deleteSync = Symbol('_deleteSync');
+const _type = Symbol('_type');
+io.FileSystemEntity = class FileSystemEntity extends core.Object {
+  get uri() {
+    return core.Uri.file(this.path);
+  }
+  resolveSymbolicLinks() {
+    return io._IOService._dispatch(io._FILE_RESOLVE_SYMBOLIC_LINKS, JSArrayOfString().of([this.path])).then(core.String)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "Cannot resolve symbolic links", this.path));
+      }
+      return FutureOrOfString()._check(response);
+    }, dynamicToFutureOrOfString()));
+  }
+  resolveSymbolicLinksSync() {
+    let result = io.FileSystemEntity._resolveSymbolicLinks(this.path);
+    io.FileSystemEntity._throwIfError(result, "Cannot resolve symbolic links", this.path);
+    return core.String._check(result);
+  }
+  delete(opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    return this[_delete]({recursive: recursive});
+  }
+  deleteSync(opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    return this[_deleteSync]({recursive: recursive});
+  }
+  watch(opts) {
+    let events = opts && 'events' in opts ? opts.events : io.FileSystemEvent.ALL;
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    return io._FileSystemWatcher._watch(io.FileSystemEntity._trimTrailingPathSeparators(this.path), events, recursive);
+  }
+  static identical(path1, path2) {
+    return io._IOService._dispatch(io._FILE_IDENTICAL, JSArrayOfString().of([path1, path2])).then(core.bool)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, dart.str`Error in FileSystemEntity.identical(${path1}, ${path2})`, ""));
+      }
+      return FutureOrOfbool()._check(response);
+    }, dynamicToFutureOrOfbool()));
+  }
+  get isAbsolute() {
+    if (dart.test(io.Platform.isWindows)) {
+      return this.path[dartx.startsWith](io.FileSystemEntity._absoluteWindowsPathPattern);
+    } else {
+      return this.path[dartx.startsWith]('/');
+    }
+  }
+  get [_absolutePath]() {
+    if (dart.test(this.isAbsolute)) return this.path;
+    let current = io.Directory.current.path;
+    if (dart.test(current[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(current[dartx.endsWith]('\\'))) {
+      return dart.str`${current}${this.path}`;
+    } else {
+      return dart.str`${current}${io.Platform.pathSeparator}${this.path}`;
+    }
+  }
+  static identicalSync(path1, path2) {
+    let result = io.FileSystemEntity._identical(path1, path2);
+    io.FileSystemEntity._throwIfError(result, 'Error in FileSystemEntity.identicalSync');
+    return core.bool._check(result);
+  }
+  static get isWatchSupported() {
+    return io._FileSystemWatcher.isSupported;
+  }
+  static type(path, opts) {
+    let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+    return io.FileSystemEntity._getTypeAsync(path, followLinks).then(io.FileSystemEntityType)(io.FileSystemEntityType._lookup);
+  }
+  static typeSync(path, opts) {
+    let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+    return io.FileSystemEntityType._lookup(io.FileSystemEntity._getTypeSync(path, followLinks));
+  }
+  static isLink(path) {
+    return io.FileSystemEntity._getTypeAsync(path, false).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.LINK[_type], intTobool()));
+  }
+  static isFile(path) {
+    return io.FileSystemEntity._getTypeAsync(path, true).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.FILE[_type], intTobool()));
+  }
+  static isDirectory(path) {
+    return io.FileSystemEntity._getTypeAsync(path, true).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.DIRECTORY[_type], intTobool()));
+  }
+  static isLinkSync(path) {
+    return io.FileSystemEntity._getTypeSync(path, false) == io.FileSystemEntityType.LINK[_type];
+  }
+  static isFileSync(path) {
+    return io.FileSystemEntity._getTypeSync(path, true) == io.FileSystemEntityType.FILE[_type];
+  }
+  static isDirectorySync(path) {
+    return io.FileSystemEntity._getTypeSync(path, true) == io.FileSystemEntityType.DIRECTORY[_type];
+  }
+  static _getType(path, followLinks) {
+    dart.throw(new core.UnsupportedError("FileSystemEntity._getType"));
+  }
+  static _identical(path1, path2) {
+    dart.throw(new core.UnsupportedError("FileSystemEntity._identical"));
+  }
+  static _resolveSymbolicLinks(path) {
+    dart.throw(new core.UnsupportedError("FileSystemEntity._resolveSymbolicLinks"));
+  }
+  static parentOf(path) {
+    let rootEnd = -1;
+    if (dart.test(io.Platform.isWindows)) {
+      if (dart.test(path[dartx.startsWith](io.FileSystemEntity._absoluteWindowsPathPattern))) {
+        rootEnd = path[dartx.indexOf](core.RegExp.new('[/\\\\]'), 2);
+        if (rootEnd == -1) return path;
+      } else if (dart.test(path[dartx.startsWith]('\\')) || dart.test(path[dartx.startsWith]('/'))) {
+        rootEnd = 0;
+      }
+    } else if (dart.test(path[dartx.startsWith]('/'))) {
+      rootEnd = 0;
+    }
+    let pos = path[dartx.lastIndexOf](io.FileSystemEntity._parentRegExp);
+    if (dart.notNull(pos) > dart.notNull(rootEnd)) {
+      return path[dartx.substring](0, dart.notNull(pos) + 1);
+    } else if (dart.notNull(rootEnd) > -1) {
+      return path[dartx.substring](0, dart.notNull(rootEnd) + 1);
+    } else {
+      return '.';
+    }
+  }
+  get parent() {
+    return io.Directory.new(io.FileSystemEntity.parentOf(this.path));
+  }
+  static _getTypeSync(path, followLinks) {
+    let result = io.FileSystemEntity._getType(path, followLinks);
+    io.FileSystemEntity._throwIfError(result, 'Error getting type of FileSystemEntity');
+    return core.int._check(result);
+  }
+  static _getTypeAsync(path, followLinks) {
+    return io._IOService._dispatch(io._FILE_TYPE, JSArrayOfObject().of([path, followLinks])).then(core.int)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "Error getting type", path));
+      }
+      return FutureOrOfint()._check(response);
+    }, dynamicToFutureOrOfint()));
+  }
+  static _throwIfError(result, msg, path) {
+    if (path === void 0) path = null;
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException(msg, path, result));
+    } else if (core.ArgumentError.is(result)) {
+      dart.throw(result);
+    }
+  }
+  static _trimTrailingPathSeparators(path) {
+    if (!(typeof path == 'string')) return path;
+    if (dart.test(io.Platform.isWindows)) {
+      while (dart.notNull(path[dartx.length]) > 1 && (dart.test(path[dartx.endsWith](io.Platform.pathSeparator)) || dart.test(path[dartx.endsWith]('/')))) {
+        path = path[dartx.substring](0, dart.notNull(path[dartx.length]) - 1);
+      }
+    } else {
+      while (dart.notNull(path[dartx.length]) > 1 && dart.test(path[dartx.endsWith](io.Platform.pathSeparator))) {
+        path = path[dartx.substring](0, dart.notNull(path[dartx.length]) - 1);
+      }
+    }
+    return path;
+  }
+  static _ensureTrailingPathSeparators(path) {
+    if (!(typeof path == 'string')) return path;
+    if (dart.test(path[dartx.isEmpty])) path = '.';
+    if (dart.test(io.Platform.isWindows)) {
+      while (!dart.test(path[dartx.endsWith](io.Platform.pathSeparator)) && !dart.test(path[dartx.endsWith]('/'))) {
+        path = dart.str`${path}${io.Platform.pathSeparator}`;
+      }
+    } else {
+      while (!dart.test(path[dartx.endsWith](io.Platform.pathSeparator))) {
+        path = dart.str`${path}${io.Platform.pathSeparator}`;
+      }
+    }
+    return path;
+  }
+};
+dart.setSignature(io.FileSystemEntity, {
+  getters: () => ({
+    uri: dart.definiteFunctionType(core.Uri, []),
+    isAbsolute: dart.definiteFunctionType(core.bool, []),
+    [_absolutePath]: dart.definiteFunctionType(core.String, []),
+    parent: dart.definiteFunctionType(io.Directory, [])
+  }),
+  methods: () => ({
+    resolveSymbolicLinks: dart.definiteFunctionType(async.Future$(core.String), []),
+    resolveSymbolicLinksSync: dart.definiteFunctionType(core.String, []),
+    delete: dart.definiteFunctionType(async.Future$(io.FileSystemEntity), [], {recursive: core.bool}),
+    deleteSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+    watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [], {events: core.int, recursive: core.bool})
+  }),
+  sfields: () => ({
+    _absoluteWindowsPathPattern: core.RegExp,
+    _parentRegExp: core.RegExp
+  }),
+  sgetters: () => ({isWatchSupported: dart.definiteFunctionType(core.bool, [])}),
+  statics: () => ({
+    identical: dart.definiteFunctionType(async.Future$(core.bool), [core.String, core.String]),
+    identicalSync: dart.definiteFunctionType(core.bool, [core.String, core.String]),
+    type: dart.definiteFunctionType(async.Future$(io.FileSystemEntityType), [core.String], {followLinks: core.bool}),
+    typeSync: dart.definiteFunctionType(io.FileSystemEntityType, [core.String], {followLinks: core.bool}),
+    isLink: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+    isFile: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+    isDirectory: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+    isLinkSync: dart.definiteFunctionType(core.bool, [core.String]),
+    isFileSync: dart.definiteFunctionType(core.bool, [core.String]),
+    isDirectorySync: dart.definiteFunctionType(core.bool, [core.String]),
+    _getType: dart.definiteFunctionType(dart.dynamic, [core.String, core.bool]),
+    _identical: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+    _resolveSymbolicLinks: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    parentOf: dart.definiteFunctionType(core.String, [core.String]),
+    _getTypeSync: dart.definiteFunctionType(core.int, [core.String, core.bool]),
+    _getTypeAsync: dart.definiteFunctionType(async.Future$(core.int), [core.String, core.bool]),
+    _throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String], [core.String]),
+    _trimTrailingPathSeparators: dart.definiteFunctionType(core.String, [core.String]),
+    _ensureTrailingPathSeparators: dart.definiteFunctionType(core.String, [core.String])
+  }),
+  names: ['identical', 'identicalSync', 'type', 'typeSync', 'isLink', 'isFile', 'isDirectory', 'isLinkSync', 'isFileSync', 'isDirectorySync', '_getType', '_identical', '_resolveSymbolicLinks', 'parentOf', '_getTypeSync', '_getTypeAsync', '_throwIfError', '_trimTrailingPathSeparators', '_ensureTrailingPathSeparators']
+});
+dart.defineLazy(io.FileSystemEntity, {
+  get _absoluteWindowsPathPattern() {
+    return core.RegExp.new('^(\\\\\\\\|[a-zA-Z]:[/\\\\])');
+  },
+  get _parentRegExp() {
+    return dart.test(io.Platform.isWindows) ? core.RegExp.new('[^/\\\\][/\\\\]+[^/\\\\]') : core.RegExp.new('[^/]/+[^/]');
+  }
+});
+io._Directory = class _Directory extends io.FileSystemEntity {
+  new(path) {
+    this.path = path;
+    if (!(typeof this.path == 'string')) {
+      dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+    }
+  }
+  static _current() {
+    dart.throw(new core.UnsupportedError("Directory._current"));
+  }
+  static _setCurrent(path) {
+    dart.throw(new core.UnsupportedError("Directory_SetCurrent"));
+  }
+  static _createTemp(path) {
+    dart.throw(new core.UnsupportedError("Directory._createTemp"));
+  }
+  static _systemTemp() {
+    dart.throw(new core.UnsupportedError("Directory._systemTemp"));
+  }
+  static _exists(path) {
+    dart.throw(new core.UnsupportedError("Directory._exists"));
+  }
+  static _create(path) {
+    dart.throw(new core.UnsupportedError("Directory._create"));
+  }
+  static _deleteNative(path, recursive) {
+    dart.throw(new core.UnsupportedError("Directory._deleteNative"));
+  }
+  static _rename(path, newPath) {
+    dart.throw(new core.UnsupportedError("Directory._rename"));
+  }
+  static _fillWithDirectoryListing(list, path, recursive, followLinks) {
+    dart.throw(new core.UnsupportedError("Directory._fillWithDirectoryListing"));
+  }
+  static get current() {
+    let result = io._Directory._current();
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("Getting current working directory failed", "", result));
+    }
+    return new io._Directory(core.String._check(result));
+  }
+  static set current(path) {
+    if (io.Directory.is(path)) path = dart.dload(path, 'path');
+    let result = io._Directory._setCurrent(path);
+    if (core.ArgumentError.is(result)) dart.throw(result);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("Setting current working directory failed", core.String._check(path), result));
+    }
+  }
+  get uri() {
+    return core.Uri.directory(this.path);
+  }
+  exists() {
+    return io._IOService._dispatch(io._DIRECTORY_EXISTS, JSArrayOfString().of([this.path])).then(core.bool)(dart.fn(response => {
+      if (dart.test(this[_isErrorResponse](response))) {
+        dart.throw(this[_exceptionOrErrorFromResponse](response, "Exists failed"));
+      }
+      return dart.equals(response, 1);
+    }, dynamicTobool()));
+  }
+  existsSync() {
+    let result = io._Directory._exists(this.path);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("Exists failed", this.path, result));
+    }
+    return dart.equals(result, 1);
+  }
+  get absolute() {
+    return io.Directory.new(this[_absolutePath]);
+  }
+  stat() {
+    return io.FileStat.stat(this.path);
+  }
+  statSync() {
+    return io.FileStat.statSync(this.path);
+  }
+  [_computeExistingIndex](dirsToCreate) {
+    let future = null;
+    let notFound = dirsToCreate[dartx.length];
+    for (let i = 0; i < dart.notNull(dirsToCreate[dartx.length]); i++) {
+      if (future == null) {
+        future = dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
+      } else {
+        future = dart.dsend(future, 'then', dart.fn(index => {
+          if (!dart.equals(index, notFound)) {
+            return async.Future.value(index);
+          }
+          return dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
+        }, dynamicTodynamic()));
+      }
+    }
+    if (future == null) {
+      return FutureOfint().value(notFound);
+    } else {
+      return FutureOfint()._check(future);
+    }
+  }
+  create(opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    if (dart.test(recursive)) {
+      return this.exists().then(io.Directory)(dart.fn(exists => {
+        if (dart.test(exists)) return this;
+        if (this.path != this.parent.path) {
+          return this.parent.create({recursive: true}).then(io.Directory)(dart.fn(_ => this.create(), DirectoryToFutureOfDirectory()));
+        } else {
+          return this.create();
+        }
+      }, boolToFutureOrOfDirectory()));
+    } else {
+      return io._IOService._dispatch(io._DIRECTORY_CREATE, JSArrayOfString().of([this.path])).then(io._Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Creation failed"));
+        }
+        return this;
+      }, dynamicTo_Directory()));
+    }
+  }
+  createSync(opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    if (dart.test(recursive)) {
+      if (dart.test(this.existsSync())) return;
+      if (this.path != this.parent.path) {
+        this.parent.createSync({recursive: true});
+      }
+    }
+    let result = io._Directory._create(this.path);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("Creation failed", this.path, result));
+    }
+  }
+  static get systemTemp() {
+    return io.Directory.new(io._Directory._systemTemp());
+  }
+  createTemp(prefix) {
+    if (prefix === void 0) prefix = null;
+    if (prefix == null) prefix = '';
+    if (this.path == '') {
+      dart.throw(new core.ArgumentError("Directory.createTemp called with an empty path. " + "To use the system temp directory, use Directory.systemTemp"));
+    }
+    let fullPrefix = null;
+    if (dart.test(this.path[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(this.path[dartx.endsWith]('\\'))) {
+      fullPrefix = dart.str`${this.path}${prefix}`;
+    } else {
+      fullPrefix = dart.str`${this.path}${io.Platform.pathSeparator}${prefix}`;
+    }
+    return io._IOService._dispatch(io._DIRECTORY_CREATE_TEMP, JSArrayOfString().of([fullPrefix])).then(io.Directory)(dart.fn(response => {
+      if (dart.test(this[_isErrorResponse](response))) {
+        dart.throw(this[_exceptionOrErrorFromResponse](response, "Creation of temporary directory failed"));
+      }
+      return io.Directory.new(core.String._check(response));
+    }, dynamicToDirectory()));
+  }
+  createTempSync(prefix) {
+    if (prefix === void 0) prefix = null;
+    if (prefix == null) prefix = '';
+    if (this.path == '') {
+      dart.throw(new core.ArgumentError("Directory.createTemp called with an empty path. " + "To use the system temp directory, use Directory.systemTemp"));
+    }
+    let fullPrefix = null;
+    if (dart.test(this.path[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(this.path[dartx.endsWith]('\\'))) {
+      fullPrefix = dart.str`${this.path}${prefix}`;
+    } else {
+      fullPrefix = dart.str`${this.path}${io.Platform.pathSeparator}${prefix}`;
+    }
+    let result = io._Directory._createTemp(fullPrefix);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("Creation of temporary directory failed", fullPrefix, result));
+    }
+    return io.Directory.new(core.String._check(result));
+  }
+  [_delete](opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    return io._IOService._dispatch(io._DIRECTORY_DELETE, JSArrayOfObject().of([this.path, recursive])).then(io._Directory)(dart.fn(response => {
+      if (dart.test(this[_isErrorResponse](response))) {
+        dart.throw(this[_exceptionOrErrorFromResponse](response, "Deletion failed"));
+      }
+      return this;
+    }, dynamicTo_Directory()));
+  }
+  [_deleteSync](opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    let result = io._Directory._deleteNative(this.path, recursive);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("Deletion failed", this.path, result));
+    }
+  }
+  rename(newPath) {
+    return io._IOService._dispatch(io._DIRECTORY_RENAME, JSArrayOfString().of([this.path, newPath])).then(io.Directory)(dart.fn(response => {
+      if (dart.test(this[_isErrorResponse](response))) {
+        dart.throw(this[_exceptionOrErrorFromResponse](response, "Rename failed"));
+      }
+      return io.Directory.new(newPath);
+    }, dynamicToDirectory()));
+  }
+  renameSync(newPath) {
+    if (!(typeof newPath == 'string')) {
+      dart.throw(new core.ArgumentError());
+    }
+    let result = io._Directory._rename(this.path, newPath);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("Rename failed", this.path, result));
+    }
+    return io.Directory.new(newPath);
+  }
+  list(opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+    return StreamOfFileSystemEntity()._check(new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream);
+  }
+  listSync(opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+    if (!(typeof recursive == 'boolean') || !(typeof followLinks == 'boolean')) {
+      dart.throw(new core.ArgumentError());
+    }
+    let result = JSArrayOfFileSystemEntity().of([]);
+    io._Directory._fillWithDirectoryListing(result, io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks);
+    return result;
+  }
+  toString() {
+    return dart.str`Directory: '${this.path}'`;
+  }
+  [_isErrorResponse](response) {
+    return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+  }
+  [_exceptionOrErrorFromResponse](response, message) {
+    dart.assert(this[_isErrorResponse](response));
+    switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+      case io._ILLEGAL_ARGUMENT_RESPONSE:
+      {
+        return new core.ArgumentError();
+      }
+      case io._OSERROR_RESPONSE:
+      {
+        let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+        return new io.FileSystemException(message, this.path, err);
+      }
+      default:
+      {
+        return core.Exception.new("Unknown error");
+      }
+    }
+  }
+};
+io._Directory[dart.implements] = () => [io.Directory];
+dart.setSignature(io._Directory, {
+  constructors: () => ({new: dart.definiteFunctionType(io._Directory, [core.String])}),
+  fields: () => ({path: core.String}),
+  getters: () => ({absolute: dart.definiteFunctionType(io.Directory, [])}),
+  methods: () => ({
+    exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+    existsSync: dart.definiteFunctionType(core.bool, []),
+    stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+    statSync: dart.definiteFunctionType(io.FileStat, []),
+    [_computeExistingIndex]: dart.definiteFunctionType(async.Future$(core.int), [core.List]),
+    create: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
+    createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+    createTemp: dart.definiteFunctionType(async.Future$(io.Directory), [], [core.String]),
+    createTempSync: dart.definiteFunctionType(io.Directory, [], [core.String]),
+    [_delete]: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
+    [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+    rename: dart.definiteFunctionType(async.Future$(io.Directory), [core.String]),
+    renameSync: dart.definiteFunctionType(io.Directory, [core.String]),
+    list: dart.definiteFunctionType(async.Stream$(io.FileSystemEntity), [], {recursive: core.bool, followLinks: core.bool}),
+    listSync: dart.definiteFunctionType(core.List$(io.FileSystemEntity), [], {recursive: core.bool, followLinks: core.bool}),
+    [_isErrorResponse]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+    [_exceptionOrErrorFromResponse]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String])
+  }),
+  sgetters: () => ({
+    current: dart.definiteFunctionType(io.Directory, []),
+    systemTemp: dart.definiteFunctionType(io.Directory, [])
+  }),
+  ssetters: () => ({current: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+  statics: () => ({
+    _current: dart.definiteFunctionType(dart.dynamic, []),
+    _setCurrent: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]),
+    _createTemp: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _systemTemp: dart.definiteFunctionType(core.String, []),
+    _exists: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _create: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _deleteNative: dart.definiteFunctionType(dart.dynamic, [core.String, core.bool]),
+    _rename: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+    _fillWithDirectoryListing: dart.definiteFunctionType(dart.void, [ListOfFileSystemEntity(), core.String, core.bool, core.bool])
+  }),
+  names: ['_current', '_setCurrent', '_createTemp', '_systemTemp', '_exists', '_create', '_deleteNative', '_rename', '_fillWithDirectoryListing']
+});
+io._AsyncDirectoryListerOps = class _AsyncDirectoryListerOps extends core.Object {
+  static new(pointer) {
+    dart.throw(new core.UnsupportedError("Directory._list"));
+  }
+};
+dart.setSignature(io._AsyncDirectoryListerOps, {
+  constructors: () => ({new: dart.definiteFunctionType(io._AsyncDirectoryListerOps, [core.int])})
+});
+const _ops = Symbol('_ops');
+const _pointer = Symbol('_pointer');
+const _cleanup = Symbol('_cleanup');
+io._AsyncDirectoryLister = class _AsyncDirectoryLister extends core.Object {
+  new(path, recursive, followLinks) {
+    this.closeCompleter = async.Completer.new();
+    this.path = path;
+    this.recursive = recursive;
+    this.followLinks = followLinks;
+    this.controller = null;
+    this.canceled = false;
+    this.nextRunning = false;
+    this.closed = false;
+    this[_ops] = null;
+    this.controller = async.StreamController.new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
+  }
+  [_pointer]() {
+    return this[_ops] == null ? null : this[_ops].getPointer();
+  }
+  get stream() {
+    return this.controller.stream;
+  }
+  onListen() {
+    io._IOService._dispatch(io._DIRECTORY_LIST_START, JSArrayOfObject().of([this.path, this.recursive, this.followLinks])).then(dart.dynamic)(dart.fn(response => {
+      if (typeof response == 'number') {
+        this[_ops] = io._AsyncDirectoryListerOps.new(response);
+        this.next();
+      } else if (core.Error.is(response)) {
+        this.controller.addError(response, response.stackTrace);
+        this.close();
+      } else {
+        this.error(response);
+        this.close();
+      }
+    }, dynamicToNull()));
+  }
+  onResume() {
+    if (!dart.test(this.nextRunning)) {
+      this.next();
+    }
+  }
+  onCancel() {
+    this.canceled = true;
+    if (!dart.test(this.nextRunning)) {
+      this.close();
+    }
+    return this.closeCompleter.future;
+  }
+  next() {
+    if (dart.test(this.canceled)) {
+      this.close();
+      return;
+    }
+    if (dart.test(this.controller.isPaused) || dart.test(this.nextRunning)) {
+      return;
+    }
+    let pointer = this[_pointer]();
+    if (pointer == null) {
+      return;
+    }
+    this.nextRunning = true;
+    io._IOService._dispatch(io._DIRECTORY_LIST_NEXT, JSArrayOfint().of([pointer])).then(dart.dynamic)(dart.fn(result => {
+      this.nextRunning = false;
+      if (core.List.is(result)) {
+        this.next();
+        dart.assert(result[dartx.length][dartx['%']](2) == 0);
+        for (let i = 0; i < dart.notNull(result[dartx.length]); i++) {
+          dart.assert(i[dartx['%']](2) == 0);
+          switch (result[dartx._get](i++)) {
+            case io._AsyncDirectoryLister.LIST_FILE:
+            {
+              this.controller.add(io.File.new(core.String._check(result[dartx._get](i))));
+              break;
+            }
+            case io._AsyncDirectoryLister.LIST_DIRECTORY:
+            {
+              this.controller.add(io.Directory.new(core.String._check(result[dartx._get](i))));
+              break;
+            }
+            case io._AsyncDirectoryLister.LIST_LINK:
+            {
+              this.controller.add(io.Link.new(core.String._check(result[dartx._get](i))));
+              break;
+            }
+            case io._AsyncDirectoryLister.LIST_ERROR:
+            {
+              this.error(result[dartx._get](i));
+              break;
+            }
+            case io._AsyncDirectoryLister.LIST_DONE:
+            {
+              this.canceled = true;
+              return;
+            }
+          }
+        }
+      } else {
+        this.controller.addError(new io.FileSystemException("Internal error"));
+      }
+    }, dynamicToNull()));
+  }
+  [_cleanup]() {
+    this.controller.close();
+    this.closeCompleter.complete();
+    this[_ops] = null;
+  }
+  close() {
+    if (dart.test(this.closed)) {
+      return;
+    }
+    if (dart.test(this.nextRunning)) {
+      return;
+    }
+    this.closed = true;
+    let pointer = this[_pointer]();
+    if (pointer == null) {
+      this[_cleanup]();
+    } else {
+      io._IOService._dispatch(io._DIRECTORY_LIST_STOP, JSArrayOfint().of([pointer])).whenComplete(dart.bind(this, _cleanup));
+    }
+  }
+  error(message) {
+    let errorType = dart.dindex(dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_ERROR), io._ERROR_RESPONSE_ERROR_TYPE);
+    if (dart.equals(errorType, io._ILLEGAL_ARGUMENT_RESPONSE)) {
+      this.controller.addError(new core.ArgumentError());
+    } else if (dart.equals(errorType, io._OSERROR_RESPONSE)) {
+      let responseError = dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_ERROR);
+      let err = new io.OSError(core.String._check(dart.dindex(responseError, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(responseError, io._OSERROR_RESPONSE_ERROR_CODE)));
+      let errorPath = dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_PATH);
+      if (errorPath == null) errorPath = this.path;
+      this.controller.addError(new io.FileSystemException("Directory listing failed", core.String._check(errorPath), err));
+    } else {
+      this.controller.addError(new io.FileSystemException("Internal error"));
+    }
+  }
+};
+dart.setSignature(io._AsyncDirectoryLister, {
+  constructors: () => ({new: dart.definiteFunctionType(io._AsyncDirectoryLister, [core.String, core.bool, core.bool])}),
+  fields: () => ({
+    path: core.String,
+    recursive: core.bool,
+    followLinks: core.bool,
+    controller: async.StreamController,
+    canceled: core.bool,
+    nextRunning: core.bool,
+    closed: core.bool,
+    [_ops]: io._AsyncDirectoryListerOps,
+    closeCompleter: async.Completer
+  }),
+  getters: () => ({stream: dart.definiteFunctionType(async.Stream, [])}),
+  methods: () => ({
+    [_pointer]: dart.definiteFunctionType(core.int, []),
+    onListen: dart.definiteFunctionType(dart.void, []),
+    onResume: dart.definiteFunctionType(dart.void, []),
+    onCancel: dart.definiteFunctionType(async.Future, []),
+    next: dart.definiteFunctionType(dart.void, []),
+    [_cleanup]: dart.definiteFunctionType(dart.void, []),
+    close: dart.definiteFunctionType(dart.void, []),
+    error: dart.definiteFunctionType(dart.void, [dart.dynamic])
+  }),
+  sfields: () => ({
+    LIST_FILE: core.int,
+    LIST_DIRECTORY: core.int,
+    LIST_LINK: core.int,
+    LIST_ERROR: core.int,
+    LIST_DONE: core.int,
+    RESPONSE_TYPE: core.int,
+    RESPONSE_PATH: core.int,
+    RESPONSE_COMPLETE: core.int,
+    RESPONSE_ERROR: core.int
+  })
+});
+io._AsyncDirectoryLister.LIST_FILE = 0;
+io._AsyncDirectoryLister.LIST_DIRECTORY = 1;
+io._AsyncDirectoryLister.LIST_LINK = 2;
+io._AsyncDirectoryLister.LIST_ERROR = 3;
+io._AsyncDirectoryLister.LIST_DONE = 4;
+io._AsyncDirectoryLister.RESPONSE_TYPE = 0;
+io._AsyncDirectoryLister.RESPONSE_PATH = 1;
+io._AsyncDirectoryLister.RESPONSE_COMPLETE = 1;
+io._AsyncDirectoryLister.RESPONSE_ERROR = 2;
+io._EventHandler = class _EventHandler extends core.Object {
+  static _sendData(sender, sendPort, data) {
+    dart.throw(new core.UnsupportedError("EventHandler._sendData"));
+  }
+};
+dart.setSignature(io._EventHandler, {
+  statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate.SendPort, core.int])}),
+  names: ['_sendData']
+});
+const _mode = Symbol('_mode');
+io.FileMode = class FileMode extends core.Object {
+  _internal(mode) {
+    this[_mode] = mode;
+  }
+};
+dart.defineNamedConstructor(io.FileMode, '_internal');
+dart.setSignature(io.FileMode, {
+  constructors: () => ({_internal: dart.definiteFunctionType(io.FileMode, [core.int])}),
+  fields: () => ({[_mode]: core.int}),
+  sfields: () => ({
+    READ: io.FileMode,
+    WRITE: io.FileMode,
+    APPEND: io.FileMode,
+    WRITE_ONLY: io.FileMode,
+    WRITE_ONLY_APPEND: io.FileMode
+  })
+});
+dart.defineLazy(io.FileMode, {
+  get READ() {
+    return dart.const(new io.FileMode._internal(0));
+  },
+  get WRITE() {
+    return dart.const(new io.FileMode._internal(1));
+  },
+  get APPEND() {
+    return dart.const(new io.FileMode._internal(2));
+  },
+  get WRITE_ONLY() {
+    return dart.const(new io.FileMode._internal(3));
+  },
+  get WRITE_ONLY_APPEND() {
+    return dart.const(new io.FileMode._internal(4));
+  }
+});
+io.READ = io.FileMode.READ;
+io.WRITE = io.FileMode.WRITE;
+io.APPEND = io.FileMode.APPEND;
+io.WRITE_ONLY = io.FileMode.WRITE_ONLY;
+io.WRITE_ONLY_APPEND = io.FileMode.WRITE_ONLY_APPEND;
+io.FileLock = class FileLock extends core.Object {
+  new(index) {
+    this.index = index;
+  }
+  toString() {
+    return {
+      0: "FileLock.SHARED",
+      1: "FileLock.EXCLUSIVE"
+    }[this.index];
+  }
+};
+dart.setSignature(io.FileLock, {
+  fields: () => ({index: core.int})
+});
+dart.defineEnumValues(io.FileLock, [
+  'SHARED',
+  'EXCLUSIVE'
+]);
+io.File = class File extends core.Object {
+  static new(path) {
+    return new io._File(path);
+  }
+  static fromUri(uri) {
+    return io.File.new(uri.toFilePath());
+  }
+};
+io.File[dart.implements] = () => [io.FileSystemEntity];
+dart.setSignature(io.File, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io.File, [core.String]),
+    fromUri: dart.definiteFunctionType(io.File, [core.Uri])
+  })
+});
+io.RandomAccessFile = class RandomAccessFile extends core.Object {};
+io.FileSystemException = class FileSystemException extends core.Object {
+  new(message, path, osError) {
+    if (message === void 0) message = "";
+    if (path === void 0) path = "";
+    if (osError === void 0) osError = null;
+    this.message = message;
+    this.path = path;
+    this.osError = osError;
+  }
+  toString() {
+    let sb = new core.StringBuffer();
+    sb.write("FileSystemException");
+    if (!dart.test(this.message[dartx.isEmpty])) {
+      sb.write(dart.str`: ${this.message}`);
+      if (this.path != null) {
+        sb.write(dart.str`, path = '${this.path}'`);
+      }
+      if (this.osError != null) {
+        sb.write(dart.str` (${this.osError})`);
+      }
+    } else if (this.osError != null) {
+      sb.write(dart.str`: ${this.osError}`);
+      if (this.path != null) {
+        sb.write(dart.str`, path = '${this.path}'`);
+      }
+    } else if (this.path != null) {
+      sb.write(dart.str`: ${this.path}`);
+    }
+    return sb.toString();
+  }
+};
+io.FileSystemException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.FileSystemException, {
+  constructors: () => ({new: dart.definiteFunctionType(io.FileSystemException, [], [core.String, core.String, io.OSError])}),
+  fields: () => ({
+    message: core.String,
+    path: core.String,
+    osError: io.OSError
+  })
+});
+io._BLOCK_SIZE = 64 * 1024;
+const _closeCompleter = Symbol('_closeCompleter');
+const _path = Symbol('_path');
+const _position = Symbol('_position');
+const _end = Symbol('_end');
+const _controller = Symbol('_controller');
+const _openedFile = Symbol('_openedFile');
+const _unsubscribed = Symbol('_unsubscribed');
+const _readInProgress = Symbol('_readInProgress');
+const _atEnd = Symbol('_atEnd');
+const _setupController = Symbol('_setupController');
+const _start = Symbol('_start');
+const _readBlock = Symbol('_readBlock');
+const _closeFile = Symbol('_closeFile');
+io._FileStream = class _FileStream extends async.Stream$(core.List$(core.int)) {
+  new(path, position, end) {
+    this[_closeCompleter] = async.Completer.new();
+    this[_path] = path;
+    this[_position] = position;
+    this[_end] = end;
+    this[_controller] = null;
+    this[_openedFile] = null;
+    this[_unsubscribed] = false;
+    this[_readInProgress] = true;
+    this[_closed] = false;
+    this[_atEnd] = false;
+    super.new();
+    if (this[_position] == null) this[_position] = 0;
+  }
+  forStdin() {
+    this[_closeCompleter] = async.Completer.new();
+    this[_position] = 0;
+    this[_controller] = null;
+    this[_path] = null;
+    this[_openedFile] = null;
+    this[_end] = null;
+    this[_unsubscribed] = false;
+    this[_readInProgress] = true;
+    this[_closed] = false;
+    this[_atEnd] = false;
+    super.new();
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    this[_setupController]();
+    return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  [_setupController]() {
+    this[_controller] = StreamControllerOfListOfint().new({sync: true, onListen: dart.bind(this, _start), onResume: dart.bind(this, _readBlock), onCancel: dart.fn(() => {
+        this[_unsubscribed] = true;
+        return this[_closeFile]();
+      }, VoidToFuture())});
+  }
+  [_closeFile]() {
+    if (dart.test(this[_readInProgress]) || dart.test(this[_closed])) {
+      return this[_closeCompleter].future;
+    }
+    this[_closed] = true;
+    const done = (function() {
+      this[_closeCompleter].complete();
+      this[_controller].close();
+    }).bind(this);
+    dart.fn(done, VoidTovoid());
+    this[_openedFile].close().catchError(dart.bind(this[_controller], 'addError')).whenComplete(done);
+    return this[_closeCompleter].future;
+  }
+  [_readBlock]() {
+    if (dart.test(this[_readInProgress])) return;
+    if (dart.test(this[_atEnd])) {
+      this[_closeFile]();
+      return;
+    }
+    this[_readInProgress] = true;
+    let readBytes = io._BLOCK_SIZE;
+    if (this[_end] != null) {
+      readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end]) - dart.notNull(this[_position]));
+      if (dart.notNull(readBytes) < 0) {
+        this[_readInProgress] = false;
+        if (!dart.test(this[_unsubscribed])) {
+          this[_controller].addError(new core.RangeError(dart.str`Bad end position: ${this[_end]}`));
+          this[_closeFile]();
+          this[_unsubscribed] = true;
+        }
+        return;
+      }
+    }
+    this[_openedFile].read(readBytes).then(dart.dynamic)(dart.fn(block => {
+      this[_readInProgress] = false;
+      if (dart.test(this[_unsubscribed])) {
+        this[_closeFile]();
+        return;
+      }
+      this[_position] = dart.notNull(this[_position]) + dart.notNull(block[dartx.length]);
+      if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end] != null && this[_position] == this[_end]) {
+        this[_atEnd] = true;
+      }
+      if (!dart.test(this[_atEnd]) && !dart.test(this[_controller].isPaused)) {
+        this[_readBlock]();
+      }
+      this[_controller].add(block);
+      if (dart.test(this[_atEnd])) {
+        this[_closeFile]();
+      }
+    }, ListOfintToNull())).catchError(dart.fn((e, s) => {
+      if (!dart.test(this[_unsubscribed])) {
+        this[_controller].addError(e, core.StackTrace._check(s));
+        this[_closeFile]();
+        this[_unsubscribed] = true;
+      }
+    }, dynamicAnddynamicToNull()));
+  }
+  [_start]() {
+    if (dart.notNull(this[_position]) < 0) {
+      this[_controller].addError(new core.RangeError(dart.str`Bad start position: ${this[_position]}`));
+      this[_controller].close();
+      this[_closeCompleter].complete();
+      return;
+    }
+    const onReady = (function(file) {
+      this[_openedFile] = file;
+      this[_readInProgress] = false;
+      this[_readBlock]();
+    }).bind(this);
+    dart.fn(onReady, RandomAccessFileTovoid());
+    const onOpenFile = (function(file) {
+      if (dart.notNull(this[_position]) > 0) {
+        file.setPosition(this[_position]).then(dart.void)(onReady, {onError: dart.fn((e, s) => {
+            this[_controller].addError(e, core.StackTrace._check(s));
+            this[_readInProgress] = false;
+            this[_closeFile]();
+          }, dynamicAnddynamicToNull())});
+      } else {
+        onReady(file);
+      }
+    }).bind(this);
+    dart.fn(onOpenFile, RandomAccessFileTovoid());
+    const openFailed = (function(error, stackTrace) {
+      this[_controller].addError(error, core.StackTrace._check(stackTrace));
+      this[_controller].close();
+      this[_closeCompleter].complete();
+    }).bind(this);
+    dart.fn(openFailed, dynamicAnddynamicTovoid());
+    if (this[_path] != null) {
+      io.File.new(this[_path]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
+    } else {
+      try {
+        onOpenFile(io._File._openStdioSync(0));
+      } catch (e) {
+        let s = dart.stackTrace(e);
+        openFailed(e, s);
+      }
+
+    }
+  }
+};
+dart.addSimpleTypeTests(io._FileStream);
+dart.defineNamedConstructor(io._FileStream, 'forStdin');
+dart.setSignature(io._FileStream, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io._FileStream, [core.String, core.int, core.int]),
+    forStdin: dart.definiteFunctionType(io._FileStream, [])
+  }),
+  fields: () => ({
+    [_controller]: StreamControllerOfListOfint(),
+    [_path]: core.String,
+    [_openedFile]: io.RandomAccessFile,
+    [_position]: core.int,
+    [_end]: core.int,
+    [_closeCompleter]: async.Completer,
+    [_unsubscribed]: core.bool,
+    [_readInProgress]: core.bool,
+    [_closed]: core.bool,
+    [_atEnd]: core.bool
+  }),
+  methods: () => ({
+    listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    [_setupController]: dart.definiteFunctionType(dart.void, []),
+    [_closeFile]: dart.definiteFunctionType(async.Future, []),
+    [_readBlock]: dart.definiteFunctionType(dart.void, []),
+    [_start]: dart.definiteFunctionType(dart.void, [])
+  })
+});
+const _file = Symbol('_file');
+const _openFuture = Symbol('_openFuture');
+io._FileStreamConsumer = class _FileStreamConsumer extends async.StreamConsumer$(core.List$(core.int)) {
+  new(file, mode) {
+    this[_file] = file;
+    this[_openFuture] = null;
+    this[_openFuture] = this[_file].open({mode: mode});
+  }
+  fromStdio(fd) {
+    this[_file] = null;
+    this[_openFuture] = null;
+    dart.assert(1 <= dart.notNull(fd) && dart.notNull(fd) <= 2);
+    this[_openFuture] = FutureOfRandomAccessFile().value(io._File._openStdioSync(fd));
+  }
+  addStream(stream) {
+    let completer = CompleterOfFile().sync();
+    this[_openFuture].then(dart.dynamic)(dart.fn(openedFile => {
+      let _subscription = null;
+      function error(e, stackTrace) {
+        if (stackTrace === void 0) stackTrace = null;
+        dart.dsend(_subscription, 'cancel');
+        openedFile.close();
+        completer.completeError(e, stackTrace);
+      }
+      dart.fn(error, dynamic__Tovoid());
+      _subscription = stream.listen(dart.fn(d => {
+        dart.dsend(_subscription, 'pause');
+        try {
+          openedFile.writeFrom(d, 0, d[dartx.length]).then(dart.dynamic)(dart.fn(_ => dart.dsend(_subscription, 'resume'), RandomAccessFileToFutureOr()), {onError: error});
+        } catch (e) {
+          let stackTrace = dart.stackTrace(e);
+          error(e, stackTrace);
+        }
+
+      }, ListOfintToNull()), {onDone: dart.fn(() => {
+          completer.complete(this[_file]);
+        }, VoidToNull()), onError: error, cancelOnError: true});
+    }, RandomAccessFileToNull())).catchError(dart.bind(completer, 'completeError'));
+    return completer.future;
+  }
+  close() {
+    return this[_openFuture].then(io.File)(dart.fn(openedFile => openedFile.close(), RandomAccessFileToFutureOfRandomAccessFile()));
+  }
+};
+dart.addSimpleTypeTests(io._FileStreamConsumer);
+dart.defineNamedConstructor(io._FileStreamConsumer, 'fromStdio');
+dart.setSignature(io._FileStreamConsumer, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io._FileStreamConsumer, [io.File, io.FileMode]),
+    fromStdio: dart.definiteFunctionType(io._FileStreamConsumer, [core.int])
+  }),
+  fields: () => ({
+    [_file]: io.File,
+    [_openFuture]: FutureOfRandomAccessFile()
+  }),
+  methods: () => ({
+    addStream: dart.definiteFunctionType(async.Future$(io.File), [StreamOfListOfint()]),
+    close: dart.definiteFunctionType(async.Future$(io.File), [])
+  })
+});
+const _tryDecode = Symbol('_tryDecode');
+let const;
+let const;
+io._File = class _File extends io.FileSystemEntity {
+  new(path) {
+    this.path = path;
+    if (!(typeof this.path == 'string')) {
+      dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+    }
+  }
+  exists() {
+    return io._IOService._dispatch(io._FILE_EXISTS, JSArrayOfString().of([this.path])).then(core.bool)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "Cannot check existence", this.path));
+      }
+      return FutureOrOfbool()._check(response);
+    }, dynamicToFutureOrOfbool()));
+  }
+  static _exists(path) {
+    dart.throw(new core.UnsupportedError("File._exists"));
+  }
+  existsSync() {
+    let result = io._File._exists(this.path);
+    io._File.throwIfError(result, "Cannot check existence of file", this.path);
+    return core.bool._check(result);
+  }
+  get absolute() {
+    return io.File.new(this[_absolutePath]);
+  }
+  stat() {
+    return io.FileStat.stat(this.path);
+  }
+  statSync() {
+    return io.FileStat.statSync(this.path);
+  }
+  create(opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
+    return result.then(dart.dynamic)(dart.fn(_ => io._IOService._dispatch(io._FILE_CREATE, JSArrayOfString().of([this.path])), dynamicToFuture())).then(io._File)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "Cannot create file", this.path));
+      }
+      return this;
+    }, dynamicTo_File()));
+  }
+  static _create(path) {
+    dart.throw(new core.UnsupportedError("File._create"));
+  }
+  static _createLink(path, target) {
+    dart.throw(new core.UnsupportedError("File._createLink"));
+  }
+  static _linkTarget(path) {
+    dart.throw(new core.UnsupportedError("File._linkTarget"));
+  }
+  createSync(opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    if (dart.test(recursive)) {
+      this.parent.createSync({recursive: true});
+    }
+    let result = io._File._create(this.path);
+    io._File.throwIfError(result, "Cannot create file", this.path);
+  }
+  [_delete](opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    if (dart.test(recursive)) {
+      return io.Directory.new(this.path).delete({recursive: true}).then(io._File)(dart.fn(_ => this, FileSystemEntityTo_File()));
+    }
+    return io._IOService._dispatch(io._FILE_DELETE, JSArrayOfString().of([this.path])).then(io._File)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "Cannot delete file", this.path));
+      }
+      return this;
+    }, dynamicTo_File()));
+  }
+  static _deleteNative(path) {
+    dart.throw(new core.UnsupportedError("File._deleteNative"));
+  }
+  static _deleteLinkNative(path) {
+    dart.throw(new core.UnsupportedError("File._deleteLinkNative"));
+  }
+  [_deleteSync](opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    if (dart.test(recursive)) {
+      return io.Directory.new(this.path).deleteSync({recursive: true});
+    }
+    let result = io._File._deleteNative(this.path);
+    io._File.throwIfError(result, "Cannot delete file", this.path);
+  }
+  rename(newPath) {
+    return io._IOService._dispatch(io._FILE_RENAME, JSArrayOfString().of([this.path, newPath])).then(io.File)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, dart.str`Cannot rename file to '${newPath}'`, this.path));
+      }
+      return io.File.new(newPath);
+    }, dynamicToFile()));
+  }
+  static _rename(oldPath, newPath) {
+    dart.throw(new core.UnsupportedError("File._rename"));
+  }
+  static _renameLink(oldPath, newPath) {
+    dart.throw(new core.UnsupportedError("File._renameLink"));
+  }
+  renameSync(newPath) {
+    let result = io._File._rename(this.path, newPath);
+    io._File.throwIfError(result, dart.str`Cannot rename file to '${newPath}'`, this.path);
+    return io.File.new(newPath);
+  }
+  copy(newPath) {
+    return io._IOService._dispatch(io._FILE_COPY, JSArrayOfString().of([this.path, newPath])).then(io.File)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, dart.str`Cannot copy file to '${newPath}'`, this.path));
+      }
+      return io.File.new(newPath);
+    }, dynamicToFile()));
+  }
+  static _copy(oldPath, newPath) {
+    dart.throw(new core.UnsupportedError("File._copy"));
+  }
+  copySync(newPath) {
+    let result = io._File._copy(this.path, newPath);
+    io._File.throwIfError(result, dart.str`Cannot copy file to '${newPath}'`, this.path);
+    return io.File.new(newPath);
+  }
+  open(opts) {
+    let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.READ;
+    if (!dart.equals(mode, io.FileMode.READ) && !dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+      return FutureOfRandomAccessFile().error(new core.ArgumentError('Invalid file mode for this operation'));
+    }
+    return io._IOService._dispatch(io._FILE_OPEN, JSArrayOfObject().of([this.path, mode[_mode]])).then(io._RandomAccessFile)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "Cannot open file", this.path));
+      }
+      return new io._RandomAccessFile(core.int._check(response), this.path);
+    }, dynamicTo_RandomAccessFile()));
+  }
+  length() {
+    return io._IOService._dispatch(io._FILE_LENGTH_FROM_PATH, JSArrayOfString().of([this.path])).then(core.int)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "Cannot retrieve length of file", this.path));
+      }
+      return FutureOrOfint()._check(response);
+    }, dynamicToFutureOrOfint()));
+  }
+  static _lengthFromPath(path) {
+    dart.throw(new core.UnsupportedError("File._lengthFromPath"));
+  }
+  lengthSync() {
+    let result = io._File._lengthFromPath(this.path);
+    io._File.throwIfError(result, "Cannot retrieve length of file", this.path);
+    return core.int._check(result);
+  }
+  lastModified() {
+    return io._IOService._dispatch(io._FILE_LAST_MODIFIED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "Cannot retrieve modification time", this.path));
+      }
+      return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(response));
+    }, dynamicToDateTime()));
+  }
+  static _lastModified(path) {
+    dart.throw(new core.UnsupportedError("File._lastModified"));
+  }
+  lastModifiedSync() {
+    let ms = io._File._lastModified(this.path);
+    io._File.throwIfError(ms, "Cannot retrieve modification time", this.path);
+    return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
+  }
+  static _open(path, mode) {
+    dart.throw(new core.UnsupportedError("File._open"));
+  }
+  openSync(opts) {
+    let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.READ;
+    if (!dart.equals(mode, io.FileMode.READ) && !dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+      dart.throw(new core.ArgumentError('Invalid file mode for this operation'));
+    }
+    let id = io._File._open(this.path, mode[_mode]);
+    io._File.throwIfError(id, "Cannot open file", this.path);
+    return new io._RandomAccessFile(core.int._check(id), this.path);
+  }
+  static _openStdio(fd) {
+    dart.throw(new core.UnsupportedError("File._openStdio"));
+  }
+  static _openStdioSync(fd) {
+    let id = io._File._openStdio(fd);
+    if (id == 0) {
+      dart.throw(new io.FileSystemException(dart.str`Cannot open stdio file for: ${fd}`));
+    }
+    return new io._RandomAccessFile(id, "");
+  }
+  openRead(start, end) {
+    if (start === void 0) start = null;
+    if (end === void 0) end = null;
+    return new io._FileStream(this.path, start, end);
+  }
+  openWrite(opts) {
+    let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    if (!dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+      dart.throw(new core.ArgumentError('Invalid file mode for this operation'));
+    }
+    let consumer = new io._FileStreamConsumer(this, mode);
+    return io.IOSink.new(consumer, {encoding: encoding});
+  }
+  readAsBytes() {
+    function readDataChunked(file) {
+      let builder = io.BytesBuilder.new({copy: false});
+      let completer = async.Completer.new();
+      function read() {
+        dart.dsend(dart.dsend(file, 'read', io._BLOCK_SIZE), 'then', dart.fn(data => {
+          if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) {
+            builder.add(ListOfint()._check(data));
+            read();
+          } else {
+            completer.complete(builder.takeBytes());
+          }
+        }, dynamicToNull()), {onError: dart.bind(completer, 'completeError')});
+      }
+      dart.fn(read, VoidTovoid());
+      read();
+      return FutureOfListOfint()._check(completer.future);
+    }
+    dart.fn(readDataChunked, dynamicToFutureOfListOfint());
+    return this.open().then(ListOfint())(dart.fn(file => file.length().then(ListOfint())(dart.fn(length => {
+      if (length == 0) {
+        return readDataChunked(file);
+      }
+      return file.read(length);
+    }, intToFutureOfListOfint())).whenComplete(dart.bind(file, 'close')), RandomAccessFileToFutureOfListOfint()));
+  }
+  readAsBytesSync() {
+    let opened = this.openSync();
+    try {
+      let data = null;
+      let length = opened.lengthSync();
+      if (length == 0) {
+        let builder = io.BytesBuilder.new({copy: false});
+        do {
+          data = opened.readSync(io._BLOCK_SIZE);
+          if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) builder.add(ListOfint()._check(data));
+        } while (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0)));
+        data = builder.takeBytes();
+      } else {
+        data = opened.readSync(length);
+      }
+      return ListOfint()._check(data);
+    } finally {
+      opened.closeSync();
+    }
+  }
+  [_tryDecode](bytes, encoding) {
+    try {
+      return encoding.decode(bytes);
+    } catch (_) {
+      dart.throw(new io.FileSystemException(dart.str`Failed to decode data using encoding '${encoding.name}'`, this.path));
+    }
+
+  }
+  readAsString(opts) {
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    return this.readAsBytes().then(core.String)(dart.fn(bytes => this[_tryDecode](bytes, encoding), ListOfintToString()));
+  }
+  readAsStringSync(opts) {
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    return this[_tryDecode](this.readAsBytesSync(), encoding);
+  }
+  readAsLines(opts) {
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const || (const = dart.const(new convert.LineSplitter())), 'convert'));
+  }
+  readAsLinesSync(opts) {
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    return (const || (const = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
+  }
+  writeAsBytes(bytes, opts) {
+    let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+    let flush = opts && 'flush' in opts ? opts.flush : false;
+    return this.open({mode: mode}).then(io.File)(dart.fn(file => file.writeFrom(bytes, 0, bytes[dartx.length]).then(dart.dynamic)(dart.fn(_ => {
+      if (dart.test(flush)) return file.flush().then(io._File)(dart.fn(_ => this, RandomAccessFileTo_File()));
+      return this;
+    }, RandomAccessFileToObject())).whenComplete(dart.bind(file, 'close')), RandomAccessFileToFutureOrOfFile()));
+  }
+  writeAsBytesSync(bytes, opts) {
+    let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+    let flush = opts && 'flush' in opts ? opts.flush : false;
+    let opened = this.openSync({mode: mode});
+    try {
+      opened.writeFromSync(bytes, 0, bytes[dartx.length]);
+      if (dart.test(flush)) opened.flushSync();
+    } finally {
+      opened.closeSync();
+    }
+  }
+  writeAsString(contents, opts) {
+    let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    let flush = opts && 'flush' in opts ? opts.flush : false;
+    try {
+      return this.writeAsBytes(encoding.encode(contents), {mode: mode, flush: flush});
+    } catch (e) {
+      return FutureOfFile().error(e);
+    }
+
+  }
+  writeAsStringSync(contents, opts) {
+    let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    let flush = opts && 'flush' in opts ? opts.flush : false;
+    this.writeAsBytesSync(encoding.encode(contents), {mode: mode, flush: flush});
+  }
+  toString() {
+    return dart.str`File: '${this.path}'`;
+  }
+  static throwIfError(result, msg, path) {
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException(msg, path, result));
+    }
+  }
+};
+io._File[dart.implements] = () => [io.File];
+dart.setSignature(io._File, {
+  constructors: () => ({new: dart.definiteFunctionType(io._File, [core.String])}),
+  fields: () => ({path: core.String}),
+  getters: () => ({absolute: dart.definiteFunctionType(io.File, [])}),
+  methods: () => ({
+    exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+    existsSync: dart.definiteFunctionType(core.bool, []),
+    stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+    statSync: dart.definiteFunctionType(io.FileStat, []),
+    create: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
+    createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+    [_delete]: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
+    [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+    rename: dart.definiteFunctionType(async.Future$(io.File), [core.String]),
+    renameSync: dart.definiteFunctionType(io.File, [core.String]),
+    copy: dart.definiteFunctionType(async.Future$(io.File), [core.String]),
+    copySync: dart.definiteFunctionType(io.File, [core.String]),
+    open: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], {mode: io.FileMode}),
+    length: dart.definiteFunctionType(async.Future$(core.int), []),
+    lengthSync: dart.definiteFunctionType(core.int, []),
+    lastModified: dart.definiteFunctionType(async.Future$(core.DateTime), []),
+    lastModifiedSync: dart.definiteFunctionType(core.DateTime, []),
+    openSync: dart.definiteFunctionType(io.RandomAccessFile, [], {mode: io.FileMode}),
+    openRead: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [], [core.int, core.int]),
+    openWrite: dart.definiteFunctionType(io.IOSink, [], {mode: io.FileMode, encoding: convert.Encoding}),
+    readAsBytes: dart.definiteFunctionType(async.Future$(core.List$(core.int)), []),
+    readAsBytesSync: dart.definiteFunctionType(core.List$(core.int), []),
+    [_tryDecode]: dart.definiteFunctionType(core.String, [ListOfint(), convert.Encoding]),
+    readAsString: dart.definiteFunctionType(async.Future$(core.String), [], {encoding: convert.Encoding}),
+    readAsStringSync: dart.definiteFunctionType(core.String, [], {encoding: convert.Encoding}),
+    readAsLines: dart.definiteFunctionType(async.Future$(core.List$(core.String)), [], {encoding: convert.Encoding}),
+    readAsLinesSync: dart.definiteFunctionType(core.List$(core.String), [], {encoding: convert.Encoding}),
+    writeAsBytes: dart.definiteFunctionType(async.Future$(io.File), [ListOfint()], {mode: io.FileMode, flush: core.bool}),
+    writeAsBytesSync: dart.definiteFunctionType(dart.void, [ListOfint()], {mode: io.FileMode, flush: core.bool}),
+    writeAsString: dart.definiteFunctionType(async.Future$(io.File), [core.String], {mode: io.FileMode, encoding: convert.Encoding, flush: core.bool}),
+    writeAsStringSync: dart.definiteFunctionType(dart.void, [core.String], {mode: io.FileMode, encoding: convert.Encoding, flush: core.bool})
+  }),
+  statics: () => ({
+    _exists: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _create: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _createLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+    _linkTarget: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _deleteNative: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _deleteLinkNative: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _rename: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+    _renameLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+    _copy: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+    _lengthFromPath: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _lastModified: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    _open: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
+    _openStdio: dart.definiteFunctionType(core.int, [core.int]),
+    _openStdioSync: dart.definiteFunctionType(io.RandomAccessFile, [core.int]),
+    throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String, core.String])
+  }),
+  names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
+});
+io._RandomAccessFileOps = class _RandomAccessFileOps extends core.Object {
+  static new(pointer) {
+    dart.throw(new core.UnsupportedError("RandomAccessFile"));
+  }
+};
+dart.setSignature(io._RandomAccessFileOps, {
+  constructors: () => ({new: dart.definiteFunctionType(io._RandomAccessFileOps, [core.int])})
+});
+const _asyncDispatched = Symbol('_asyncDispatched');
+const _fileService = Symbol('_fileService');
+const _resourceInfo = Symbol('_resourceInfo');
+const _maybeConnectHandler = Symbol('_maybeConnectHandler');
+const _maybePerformCleanup = Symbol('_maybePerformCleanup');
+const _dispatch = Symbol('_dispatch');
+const _checkAvailable = Symbol('_checkAvailable');
+io._RandomAccessFile = class _RandomAccessFile extends core.Object {
+  new(pointer, path) {
+    this.path = path;
+    this[_asyncDispatched] = false;
+    this[_fileService] = null;
+    this[_resourceInfo] = null;
+    this[_ops] = null;
+    this.closed = false;
+    this[_ops] = io._RandomAccessFileOps.new(pointer);
+    this[_resourceInfo] = new io._FileResourceInfo(this);
+    this[_maybeConnectHandler]();
+  }
+  [_maybePerformCleanup]() {
+    if (dart.test(this.closed)) {
+      io._FileResourceInfo.FileClosed(this[_resourceInfo]);
+    }
+  }
+  [_maybeConnectHandler]() {
+    if (!dart.test(io._RandomAccessFile._connectedResourceHandler)) {
+      developer.registerExtension('ext.dart.io.getOpenFiles', io._FileResourceInfo.getOpenFiles);
+      developer.registerExtension('ext.dart.io.getFileByID', io._FileResourceInfo.getFileInfoMapByID);
+      io._RandomAccessFile._connectedResourceHandler = true;
+    }
+  }
+  close() {
+    return this[_dispatch](io._FILE_CLOSE, [null], {markClosed: true}).then(io._RandomAccessFile)(dart.fn(result => {
+      if (!dart.equals(result, -1)) {
+        this.closed = dart.test(this.closed) || dart.equals(result, 0);
+        this[_maybePerformCleanup]();
+        return this;
+      } else {
+        dart.throw(new io.FileSystemException("Cannot close file", this.path));
+      }
+    }, dynamicTo_RandomAccessFile()));
+  }
+  closeSync() {
+    this[_checkAvailable]();
+    let id = this[_ops].close();
+    if (id == -1) {
+      dart.throw(new io.FileSystemException("Cannot close file", this.path));
+    }
+    this.closed = dart.test(this.closed) || id == 0;
+    this[_maybePerformCleanup]();
+  }
+  readByte() {
+    return this[_dispatch](io._FILE_READ_BYTE, [null]).then(core.int)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "readByte failed", this.path));
+      }
+      this[_resourceInfo].addRead(1);
+      return FutureOrOfint()._check(response);
+    }, dynamicToFutureOrOfint()));
+  }
+  readByteSync() {
+    this[_checkAvailable]();
+    let result = this[_ops].readByte();
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("readByte failed", this.path, result));
+    }
+    this[_resourceInfo].addRead(1);
+    return core.int._check(result);
+  }
+  read(bytes) {
+    if (!(typeof bytes == 'number')) {
+      dart.throw(new core.ArgumentError(bytes));
+    }
+    return this[_dispatch](io._FILE_READ, JSArrayOfint().of([null, bytes])).then(ListOfint())(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "read failed", this.path));
+      }
+      this[_resourceInfo].addRead(core.int._check(dart.dload(dart.dindex(response, 1), 'length')));
+      return FutureOrOfListOfint()._check(dart.dindex(response, 1));
+    }, dynamicToFutureOrOfListOfint()));
+  }
+  readSync(bytes) {
+    this[_checkAvailable]();
+    if (!(typeof bytes == 'number')) {
+      dart.throw(new core.ArgumentError(bytes));
+    }
+    let result = this[_ops].read(bytes);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("readSync failed", this.path, result));
+    }
+    this[_resourceInfo].addRead(core.int._check(dart.dload(result, 'length')));
+    return ListOfint()._check(result);
+  }
+  readInto(buffer, start, end) {
+    if (start === void 0) start = 0;
+    if (end === void 0) end = null;
+    if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+      dart.throw(new core.ArgumentError());
+    }
+    end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+    if (end == start) {
+      return FutureOfint().value(0);
+    }
+    let length = dart.notNull(end) - dart.notNull(start);
+    return this[_dispatch](io._FILE_READ_INTO, JSArrayOfint().of([null, length])).then(core.int)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "readInto failed", this.path));
+      }
+      let read = dart.dindex(response, 1);
+      let data = dart.dindex(response, 2);
+      buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), IterableOfint()._check(data));
+      this[_resourceInfo].addRead(core.int._check(read));
+      return FutureOrOfint()._check(read);
+    }, dynamicToFutureOrOfint()));
+  }
+  readIntoSync(buffer, start, end) {
+    if (start === void 0) start = 0;
+    if (end === void 0) end = null;
+    this[_checkAvailable]();
+    if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+      dart.throw(new core.ArgumentError());
+    }
+    end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+    if (end == start) {
+      return 0;
+    }
+    let result = this[_ops].readInto(buffer, start, end);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("readInto failed", this.path, result));
+    }
+    this[_resourceInfo].addRead(core.int._check(result));
+    return core.int._check(result);
+  }
+  writeByte(value) {
+    if (!(typeof value == 'number')) {
+      dart.throw(new core.ArgumentError(value));
+    }
+    return this[_dispatch](io._FILE_WRITE_BYTE, JSArrayOfint().of([null, value])).then(io._RandomAccessFile)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "writeByte failed", this.path));
+      }
+      this[_resourceInfo].addWrite(1);
+      return this;
+    }, dynamicTo_RandomAccessFile()));
+  }
+  writeByteSync(value) {
+    this[_checkAvailable]();
+    if (!(typeof value == 'number')) {
+      dart.throw(new core.ArgumentError(value));
+    }
+    let result = this[_ops].writeByte(value);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("writeByte failed", this.path, result));
+    }
+    this[_resourceInfo].addWrite(1);
+    return core.int._check(result);
+  }
+  writeFrom(buffer, start, end) {
+    if (start === void 0) start = 0;
+    if (end === void 0) end = null;
+    if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+      dart.throw(new core.ArgumentError("Invalid arguments to writeFrom"));
+    }
+    end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+    if (end == start) {
+      return FutureOfRandomAccessFile().value(this);
+    }
+    let result = null;
+    try {
+      result = io._ensureFastAndSerializableByteData(buffer, start, end);
+    } catch (e) {
+      return FutureOfRandomAccessFile().error(e);
+    }
+
+    let request = core.List.new(4);
+    request[dartx._set](0, null);
+    request[dartx._set](1, result.buffer);
+    request[dartx._set](2, result.start);
+    request[dartx._set](3, dart.notNull(end) - (dart.notNull(start) - dart.notNull(result.start)));
+    return this[_dispatch](io._FILE_WRITE_FROM, request).then(io._RandomAccessFile)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "writeFrom failed", this.path));
+      }
+      this[_resourceInfo].addWrite(dart.notNull(end) - (dart.notNull(start) - dart.notNull(result.start)));
+      return this;
+    }, dynamicTo_RandomAccessFile()));
+  }
+  writeFromSync(buffer, start, end) {
+    if (start === void 0) start = 0;
+    if (end === void 0) end = null;
+    this[_checkAvailable]();
+    if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+      dart.throw(new core.ArgumentError("Invalid arguments to writeFromSync"));
+    }
+    end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+    if (end == start) {
+      return;
+    }
+    let bufferAndStart = io._ensureFastAndSerializableByteData(buffer, start, end);
+    let result = this[_ops].writeFrom(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("writeFrom failed", this.path, result));
+    }
+    this[_resourceInfo].addWrite(dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+  }
+  writeString(string, opts) {
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    if (!convert.Encoding.is(encoding)) {
+      dart.throw(new core.ArgumentError(encoding));
+    }
+    let data = encoding.encode(string);
+    return this.writeFrom(data, 0, data[dartx.length]);
+  }
+  writeStringSync(string, opts) {
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    if (!convert.Encoding.is(encoding)) {
+      dart.throw(new core.ArgumentError(encoding));
+    }
+    let data = encoding.encode(string);
+    this.writeFromSync(data, 0, data[dartx.length]);
+  }
+  position() {
+    return this[_dispatch](io._FILE_POSITION, [null]).then(core.int)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "position failed", this.path));
+      }
+      return FutureOrOfint()._check(response);
+    }, dynamicToFutureOrOfint()));
+  }
+  positionSync() {
+    this[_checkAvailable]();
+    let result = this[_ops].position();
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("position failed", this.path, result));
+    }
+    return core.int._check(result);
+  }
+  setPosition(position) {
+    return this[_dispatch](io._FILE_SET_POSITION, JSArrayOfint().of([null, position])).then(io._RandomAccessFile)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "setPosition failed", this.path));
+      }
+      return this;
+    }, dynamicTo_RandomAccessFile()));
+  }
+  setPositionSync(position) {
+    this[_checkAvailable]();
+    let result = this[_ops].setPosition(position);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("setPosition failed", this.path, result));
+    }
+  }
+  truncate(length) {
+    return this[_dispatch](io._FILE_TRUNCATE, JSArrayOfint().of([null, length])).then(io._RandomAccessFile)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "truncate failed", this.path));
+      }
+      return this;
+    }, dynamicTo_RandomAccessFile()));
+  }
+  truncateSync(length) {
+    this[_checkAvailable]();
+    let result = this[_ops].truncate(length);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("truncate failed", this.path, result));
+    }
+  }
+  length() {
+    return this[_dispatch](io._FILE_LENGTH, [null]).then(core.int)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "length failed", this.path));
+      }
+      return FutureOrOfint()._check(response);
+    }, dynamicToFutureOrOfint()));
+  }
+  lengthSync() {
+    this[_checkAvailable]();
+    let result = this[_ops].length();
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("length failed", this.path, result));
+    }
+    return core.int._check(result);
+  }
+  flush() {
+    return this[_dispatch](io._FILE_FLUSH, [null]).then(io._RandomAccessFile)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, "flush failed", this.path));
+      }
+      return this;
+    }, dynamicTo_RandomAccessFile()));
+  }
+  flushSync() {
+    this[_checkAvailable]();
+    let result = this[_ops].flush();
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException("flush failed", this.path, result));
+    }
+  }
+  lock(mode, start, end) {
+    if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
+    if (start === void 0) start = 0;
+    if (end === void 0) end = -1;
+    if (!io.FileLock.is(mode) || !(typeof start == 'number') || !(typeof end == 'number')) {
+      dart.throw(new core.ArgumentError());
+    }
+    if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
+      dart.throw(new core.ArgumentError());
+    }
+    let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+    return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, lock, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, 'lock failed', this.path));
+      }
+      return this;
+    }, dynamicTo_RandomAccessFile()));
+  }
+  unlock(start, end) {
+    if (start === void 0) start = 0;
+    if (end === void 0) end = -1;
+    if (!(typeof start == 'number') || !(typeof end == 'number')) {
+      dart.throw(new core.ArgumentError());
+    }
+    if (start == end) {
+      dart.throw(new core.ArgumentError());
+    }
+    return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, io._RandomAccessFile.LOCK_UNLOCK, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        dart.throw(io._exceptionFromResponse(response, 'unlock failed', this.path));
+      }
+      return this;
+    }, dynamicTo_RandomAccessFile()));
+  }
+  lockSync(mode, start, end) {
+    if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
+    if (start === void 0) start = 0;
+    if (end === void 0) end = -1;
+    this[_checkAvailable]();
+    if (!io.FileLock.is(mode) || !(typeof start == 'number') || !(typeof end == 'number')) {
+      dart.throw(new core.ArgumentError());
+    }
+    if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
+      dart.throw(new core.ArgumentError());
+    }
+    let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+    let result = this[_ops].lock(lock, start, end);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException('lock failed', this.path, result));
+    }
+  }
+  unlockSync(start, end) {
+    if (start === void 0) start = 0;
+    if (end === void 0) end = -1;
+    this[_checkAvailable]();
+    if (!(typeof start == 'number') || !(typeof end == 'number')) {
+      dart.throw(new core.ArgumentError());
+    }
+    if (start == end) {
+      dart.throw(new core.ArgumentError());
+    }
+    let result = this[_ops].lock(io._RandomAccessFile.LOCK_UNLOCK, start, end);
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException('unlock failed', this.path, result));
+    }
+  }
+  [_pointer]() {
+    return this[_ops].getPointer();
+  }
+  [_dispatch](request, data, opts) {
+    let markClosed = opts && 'markClosed' in opts ? opts.markClosed : false;
+    if (dart.test(this.closed)) {
+      return async.Future.error(new io.FileSystemException("File closed", this.path));
+    }
+    if (dart.test(this[_asyncDispatched])) {
+      let msg = "An async operation is currently pending";
+      return async.Future.error(new io.FileSystemException(msg, this.path));
+    }
+    if (dart.test(markClosed)) {
+      this.closed = true;
+    }
+    this[_asyncDispatched] = true;
+    data[dartx._set](0, this[_pointer]());
+    return io._IOService._dispatch(request, data).whenComplete(dart.fn(() => {
+      this[_asyncDispatched] = false;
+    }, VoidToNull()));
+  }
+  [_checkAvailable]() {
+    if (dart.test(this[_asyncDispatched])) {
+      dart.throw(new io.FileSystemException("An async operation is currently pending", this.path));
+    }
+    if (dart.test(this.closed)) {
+      dart.throw(new io.FileSystemException("File closed", this.path));
+    }
+  }
+};
+io._RandomAccessFile[dart.implements] = () => [io.RandomAccessFile];
+dart.setSignature(io._RandomAccessFile, {
+  constructors: () => ({new: dart.definiteFunctionType(io._RandomAccessFile, [core.int, core.String])}),
+  fields: () => ({
+    path: core.String,
+    [_asyncDispatched]: core.bool,
+    [_fileService]: isolate.SendPort,
+    [_resourceInfo]: io._FileResourceInfo,
+    [_ops]: io._RandomAccessFileOps,
+    closed: core.bool
+  }),
+  methods: () => ({
+    [_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
+    [_maybeConnectHandler]: dart.definiteFunctionType(dart.dynamic, []),
+    close: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
+    closeSync: dart.definiteFunctionType(dart.void, []),
+    readByte: dart.definiteFunctionType(async.Future$(core.int), []),
+    readByteSync: dart.definiteFunctionType(core.int, []),
+    read: dart.definiteFunctionType(async.Future$(core.List$(core.int)), [core.int]),
+    readSync: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+    readInto: dart.definiteFunctionType(async.Future$(core.int), [ListOfint()], [core.int, core.int]),
+    readIntoSync: dart.definiteFunctionType(core.int, [ListOfint()], [core.int, core.int]),
+    writeByte: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+    writeByteSync: dart.definiteFunctionType(core.int, [core.int]),
+    writeFrom: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [ListOfint()], [core.int, core.int]),
+    writeFromSync: dart.definiteFunctionType(dart.void, [ListOfint()], [core.int, core.int]),
+    writeString: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.String], {encoding: convert.Encoding}),
+    writeStringSync: dart.definiteFunctionType(dart.void, [core.String], {encoding: convert.Encoding}),
+    position: dart.definiteFunctionType(async.Future$(core.int), []),
+    positionSync: dart.definiteFunctionType(core.int, []),
+    setPosition: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+    setPositionSync: dart.definiteFunctionType(dart.void, [core.int]),
+    truncate: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+    truncateSync: dart.definiteFunctionType(dart.void, [core.int]),
+    length: dart.definiteFunctionType(async.Future$(core.int), []),
+    lengthSync: dart.definiteFunctionType(core.int, []),
+    flush: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
+    flushSync: dart.definiteFunctionType(dart.void, []),
+    lock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [io.FileLock, core.int, core.int]),
+    unlock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [core.int, core.int]),
+    lockSync: dart.definiteFunctionType(dart.void, [], [io.FileLock, core.int, core.int]),
+    unlockSync: dart.definiteFunctionType(dart.void, [], [core.int, core.int]),
+    [_pointer]: dart.definiteFunctionType(core.int, []),
+    [_dispatch]: dart.definiteFunctionType(async.Future, [core.int, core.List], {markClosed: core.bool}),
+    [_checkAvailable]: dart.definiteFunctionType(dart.void, [])
+  }),
+  sfields: () => ({
+    _connectedResourceHandler: core.bool,
+    LOCK_UNLOCK: core.int,
+    LOCK_SHARED: core.int,
+    LOCK_EXCLUSIVE: core.int
+  })
+});
+io._RandomAccessFile._connectedResourceHandler = false;
+io._RandomAccessFile.LOCK_UNLOCK = 0;
+io._RandomAccessFile.LOCK_SHARED = 1;
+io._RandomAccessFile.LOCK_EXCLUSIVE = 2;
+let const;
+io.FileSystemEntityType = class FileSystemEntityType extends core.Object {
+  _internal(type) {
+    this[_type] = type;
+  }
+  static _lookup(type) {
+    return io.FileSystemEntityType._typeList[dartx._get](type);
+  }
+  toString() {
+    return (const || (const = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
+  }
+};
+dart.defineNamedConstructor(io.FileSystemEntityType, '_internal');
+dart.setSignature(io.FileSystemEntityType, {
+  constructors: () => ({_internal: dart.definiteFunctionType(io.FileSystemEntityType, [core.int])}),
+  fields: () => ({[_type]: core.int}),
+  sfields: () => ({
+    FILE: io.FileSystemEntityType,
+    DIRECTORY: io.FileSystemEntityType,
+    LINK: io.FileSystemEntityType,
+    NOT_FOUND: io.FileSystemEntityType,
+    _typeList: ListOfFileSystemEntityType()
+  }),
+  statics: () => ({_lookup: dart.definiteFunctionType(io.FileSystemEntityType, [core.int])}),
+  names: ['_lookup']
+});
+dart.defineLazy(io.FileSystemEntityType, {
+  get FILE() {
+    return dart.const(new io.FileSystemEntityType._internal(0));
+  },
+  get DIRECTORY() {
+    return dart.const(new io.FileSystemEntityType._internal(1));
+  },
+  get LINK() {
+    return dart.const(new io.FileSystemEntityType._internal(2));
+  },
+  get NOT_FOUND() {
+    return dart.const(new io.FileSystemEntityType._internal(3));
+  },
+  get _typeList() {
+    return dart.constList([io.FileSystemEntityType.FILE, io.FileSystemEntityType.DIRECTORY, io.FileSystemEntityType.LINK, io.FileSystemEntityType.NOT_FOUND], io.FileSystemEntityType);
+  }
+});
+let const;
+io.FileStat = class FileStat extends core.Object {
+  _internal(changed, modified, accessed, type, mode, size) {
+    this.changed = changed;
+    this.modified = modified;
+    this.accessed = accessed;
+    this.type = type;
+    this.mode = mode;
+    this.size = size;
+  }
+  _internalNotFound() {
+    this.changed = null;
+    this.modified = null;
+    this.accessed = null;
+    this.type = io.FileSystemEntityType.NOT_FOUND;
+    this.mode = 0;
+    this.size = -1;
+  }
+  static _statSync(path) {
+    dart.throw(new core.UnsupportedError("FileStat.stat"));
+  }
+  static statSync(path) {
+    if (dart.test(io.Platform.isWindows)) {
+      path = io.FileSystemEntity._trimTrailingPathSeparators(path);
+    }
+    let data = io.FileStat._statSync(path);
+    if (io.OSError.is(data)) return io.FileStat._notFound;
+    return new io.FileStat._internal(new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._CHANGED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._MODIFIED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._ACCESSED_TIME))), io.FileSystemEntityType._lookup(core.int._check(dart.dindex(data, io.FileStat._TYPE))), core.int._check(dart.dindex(data, io.FileStat._MODE)), core.int._check(dart.dindex(data, io.FileStat._SIZE)));
+  }
+  static stat(path) {
+    if (dart.test(io.Platform.isWindows)) {
+      path = io.FileSystemEntity._trimTrailingPathSeparators(path);
+    }
+    return io._IOService._dispatch(io._FILE_STAT, JSArrayOfString().of([path])).then(io.FileStat)(dart.fn(response => {
+      if (dart.test(io._isErrorResponse(response))) {
+        return io.FileStat._notFound;
+      }
+      let data = core.List._check(dart.dindex(response, 1));
+      return new io.FileStat._internal(new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._CHANGED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._MODIFIED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._ACCESSED_TIME))), io.FileSystemEntityType._lookup(core.int._check(data[dartx._get](io.FileStat._TYPE))), core.int._check(data[dartx._get](io.FileStat._MODE)), core.int._check(data[dartx._get](io.FileStat._SIZE)));
+    }, dynamicToFileStat()));
+  }
+  toString() {
+    return dart.str`FileStat: type ${this.type}\n          changed ${this.changed}\n          modified ${this.modified}\n          accessed ${this.accessed}\n          mode ${this.modeString()}\n          size ${this.size}`;
+  }
+  modeString() {
+    let permissions = dart.notNull(this.mode) & 4095;
+    let codes = const || (const = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
+    let result = [];
+    if ((permissions & 2048) != 0) result[dartx.add]("(suid) ");
+    if ((permissions & 1024) != 0) result[dartx.add]("(guid) ");
+    if ((permissions & 512) != 0) result[dartx.add]("(sticky) ");
+    result[dartx.add](codes[dartx._get](permissions >> 6 & 7));
+    result[dartx.add](codes[dartx._get](permissions >> 3 & 7));
+    result[dartx.add](codes[dartx._get](permissions & 7));
+    return result[dartx.join]();
+  }
+};
+dart.defineNamedConstructor(io.FileStat, '_internal');
+dart.defineNamedConstructor(io.FileStat, '_internalNotFound');
+dart.setSignature(io.FileStat, {
+  constructors: () => ({
+    _internal: dart.definiteFunctionType(io.FileStat, [core.DateTime, core.DateTime, core.DateTime, io.FileSystemEntityType, core.int, core.int]),
+    _internalNotFound: dart.definiteFunctionType(io.FileStat, [])
+  }),
+  fields: () => ({
+    changed: core.DateTime,
+    modified: core.DateTime,
+    accessed: core.DateTime,
+    type: io.FileSystemEntityType,
+    mode: core.int,
+    size: core.int
+  }),
+  methods: () => ({modeString: dart.definiteFunctionType(core.String, [])}),
+  sfields: () => ({
+    _TYPE: core.int,
+    _CHANGED_TIME: core.int,
+    _MODIFIED_TIME: core.int,
+    _ACCESSED_TIME: core.int,
+    _MODE: core.int,
+    _SIZE: core.int,
+    _notFound: io.FileStat
+  }),
+  statics: () => ({
+    _statSync: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    statSync: dart.definiteFunctionType(io.FileStat, [core.String]),
+    stat: dart.definiteFunctionType(async.Future$(io.FileStat), [core.String])
+  }),
+  names: ['_statSync', 'statSync', 'stat']
+});
+io.FileStat._TYPE = 0;
+io.FileStat._CHANGED_TIME = 1;
+io.FileStat._MODIFIED_TIME = 2;
+io.FileStat._ACCESSED_TIME = 3;
+io.FileStat._MODE = 4;
+io.FileStat._SIZE = 5;
+dart.defineLazy(io.FileStat, {
+  get _notFound() {
+    return dart.const(new io.FileStat._internalNotFound());
+  }
+});
+io.FileSystemEvent = class FileSystemEvent extends core.Object {
+  _(type, path, isDirectory) {
+    this.type = type;
+    this.path = path;
+    this.isDirectory = isDirectory;
+  }
+};
+dart.defineNamedConstructor(io.FileSystemEvent, '_');
+dart.setSignature(io.FileSystemEvent, {
+  constructors: () => ({_: dart.definiteFunctionType(io.FileSystemEvent, [core.int, core.String, core.bool])}),
+  fields: () => ({
+    type: core.int,
+    path: core.String,
+    isDirectory: core.bool
+  }),
+  sfields: () => ({
+    CREATE: core.int,
+    MODIFY: core.int,
+    DELETE: core.int,
+    MOVE: core.int,
+    ALL: core.int,
+    _MODIFY_ATTRIBUTES: core.int,
+    _DELETE_SELF: core.int,
+    _IS_DIR: core.int
+  })
+});
+io.FileSystemEvent.CREATE = 1 << 0;
+io.FileSystemEvent.MODIFY = 1 << 1;
+io.FileSystemEvent.DELETE = 1 << 2;
+io.FileSystemEvent.MOVE = 1 << 3;
+io.FileSystemEvent._MODIFY_ATTRIBUTES = 1 << 4;
+io.FileSystemEvent._DELETE_SELF = 1 << 5;
+io.FileSystemEvent._IS_DIR = 1 << 6;
+dart.defineLazy(io.FileSystemEvent, {
+  get ALL() {
+    return io.FileSystemEvent.CREATE | io.FileSystemEvent.MODIFY | io.FileSystemEvent.DELETE | io.FileSystemEvent.MOVE;
+  }
+});
+io.FileSystemCreateEvent = class FileSystemCreateEvent extends io.FileSystemEvent {
+  _(path, isDirectory) {
+    super._(io.FileSystemEvent.CREATE, core.String._check(path), core.bool._check(isDirectory));
+  }
+  toString() {
+    return dart.str`FileSystemCreateEvent('${this.path}')`;
+  }
+};
+dart.defineNamedConstructor(io.FileSystemCreateEvent, '_');
+dart.setSignature(io.FileSystemCreateEvent, {
+  constructors: () => ({_: dart.definiteFunctionType(io.FileSystemCreateEvent, [dart.dynamic, dart.dynamic])})
+});
+io.FileSystemModifyEvent = class FileSystemModifyEvent extends io.FileSystemEvent {
+  _(path, isDirectory, contentChanged) {
+    this.contentChanged = contentChanged;
+    super._(io.FileSystemEvent.MODIFY, core.String._check(path), core.bool._check(isDirectory));
+  }
+  toString() {
+    return dart.str`FileSystemModifyEvent('${this.path}', contentChanged=${this.contentChanged})`;
+  }
+};
+dart.defineNamedConstructor(io.FileSystemModifyEvent, '_');
+dart.setSignature(io.FileSystemModifyEvent, {
+  constructors: () => ({_: dart.definiteFunctionType(io.FileSystemModifyEvent, [dart.dynamic, dart.dynamic, core.bool])}),
+  fields: () => ({contentChanged: core.bool})
+});
+io.FileSystemDeleteEvent = class FileSystemDeleteEvent extends io.FileSystemEvent {
+  _(path, isDirectory) {
+    super._(io.FileSystemEvent.DELETE, core.String._check(path), core.bool._check(isDirectory));
+  }
+  toString() {
+    return dart.str`FileSystemDeleteEvent('${this.path}')`;
+  }
+};
+dart.defineNamedConstructor(io.FileSystemDeleteEvent, '_');
+dart.setSignature(io.FileSystemDeleteEvent, {
+  constructors: () => ({_: dart.definiteFunctionType(io.FileSystemDeleteEvent, [dart.dynamic, dart.dynamic])})
+});
+io.FileSystemMoveEvent = class FileSystemMoveEvent extends io.FileSystemEvent {
+  _(path, isDirectory, destination) {
+    this.destination = destination;
+    super._(io.FileSystemEvent.MOVE, core.String._check(path), core.bool._check(isDirectory));
+  }
+  toString() {
+    let buffer = new core.StringBuffer();
+    buffer.write(dart.str`FileSystemMoveEvent('${this.path}'`);
+    if (this.destination != null) buffer.write(dart.str`, '${this.destination}'`);
+    buffer.write(')');
+    return buffer.toString();
+  }
+};
+dart.defineNamedConstructor(io.FileSystemMoveEvent, '_');
+dart.setSignature(io.FileSystemMoveEvent, {
+  constructors: () => ({_: dart.definiteFunctionType(io.FileSystemMoveEvent, [dart.dynamic, dart.dynamic, core.String])}),
+  fields: () => ({destination: core.String})
+});
+io._FileSystemWatcher = class _FileSystemWatcher extends core.Object {
+  static _watch(path, events, recursive) {
+    dart.throw(new core.UnsupportedError("_FileSystemWatcher.watch"));
+  }
+  static get isSupported() {
+    dart.throw(new core.UnsupportedError("_FileSystemWatcher.isSupported"));
+  }
+};
+dart.setSignature(io._FileSystemWatcher, {
+  sgetters: () => ({isSupported: dart.definiteFunctionType(core.bool, [])}),
+  statics: () => ({_watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [core.String, core.int, core.bool])}),
+  names: ['_watch']
+});
+io.HttpStatus = class HttpStatus extends core.Object {};
+dart.setSignature(io.HttpStatus, {
+  sfields: () => ({
+    CONTINUE: core.int,
+    SWITCHING_PROTOCOLS: core.int,
+    OK: core.int,
+    CREATED: core.int,
+    ACCEPTED: core.int,
+    NON_AUTHORITATIVE_INFORMATION: core.int,
+    NO_CONTENT: core.int,
+    RESET_CONTENT: core.int,
+    PARTIAL_CONTENT: core.int,
+    MULTIPLE_CHOICES: core.int,
+    MOVED_PERMANENTLY: core.int,
+    FOUND: core.int,
+    MOVED_TEMPORARILY: core.int,
+    SEE_OTHER: core.int,
+    NOT_MODIFIED: core.int,
+    USE_PROXY: core.int,
+    TEMPORARY_REDIRECT: core.int,
+    BAD_REQUEST: core.int,
+    UNAUTHORIZED: core.int,
+    PAYMENT_REQUIRED: core.int,
+    FORBIDDEN: core.int,
+    NOT_FOUND: core.int,
+    METHOD_NOT_ALLOWED: core.int,
+    NOT_ACCEPTABLE: core.int,
+    PROXY_AUTHENTICATION_REQUIRED: core.int,
+    REQUEST_TIMEOUT: core.int,
+    CONFLICT: core.int,
+    GONE: core.int,
+    LENGTH_REQUIRED: core.int,
+    PRECONDITION_FAILED: core.int,
+    REQUEST_ENTITY_TOO_LARGE: core.int,
+    REQUEST_URI_TOO_LONG: core.int,
+    UNSUPPORTED_MEDIA_TYPE: core.int,
+    REQUESTED_RANGE_NOT_SATISFIABLE: core.int,
+    EXPECTATION_FAILED: core.int,
+    INTERNAL_SERVER_ERROR: core.int,
+    NOT_IMPLEMENTED: core.int,
+    BAD_GATEWAY: core.int,
+    SERVICE_UNAVAILABLE: core.int,
+    GATEWAY_TIMEOUT: core.int,
+    HTTP_VERSION_NOT_SUPPORTED: core.int,
+    NETWORK_CONNECT_TIMEOUT_ERROR: core.int
+  })
+});
+io.HttpStatus.CONTINUE = 100;
+io.HttpStatus.SWITCHING_PROTOCOLS = 101;
+io.HttpStatus.OK = 200;
+io.HttpStatus.CREATED = 201;
+io.HttpStatus.ACCEPTED = 202;
+io.HttpStatus.NON_AUTHORITATIVE_INFORMATION = 203;
+io.HttpStatus.NO_CONTENT = 204;
+io.HttpStatus.RESET_CONTENT = 205;
+io.HttpStatus.PARTIAL_CONTENT = 206;
+io.HttpStatus.MULTIPLE_CHOICES = 300;
+io.HttpStatus.MOVED_PERMANENTLY = 301;
+io.HttpStatus.FOUND = 302;
+io.HttpStatus.MOVED_TEMPORARILY = 302;
+io.HttpStatus.SEE_OTHER = 303;
+io.HttpStatus.NOT_MODIFIED = 304;
+io.HttpStatus.USE_PROXY = 305;
+io.HttpStatus.TEMPORARY_REDIRECT = 307;
+io.HttpStatus.BAD_REQUEST = 400;
+io.HttpStatus.UNAUTHORIZED = 401;
+io.HttpStatus.PAYMENT_REQUIRED = 402;
+io.HttpStatus.FORBIDDEN = 403;
+io.HttpStatus.NOT_FOUND = 404;
+io.HttpStatus.METHOD_NOT_ALLOWED = 405;
+io.HttpStatus.NOT_ACCEPTABLE = 406;
+io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED = 407;
+io.HttpStatus.REQUEST_TIMEOUT = 408;
+io.HttpStatus.CONFLICT = 409;
+io.HttpStatus.GONE = 410;
+io.HttpStatus.LENGTH_REQUIRED = 411;
+io.HttpStatus.PRECONDITION_FAILED = 412;
+io.HttpStatus.REQUEST_ENTITY_TOO_LARGE = 413;
+io.HttpStatus.REQUEST_URI_TOO_LONG = 414;
+io.HttpStatus.UNSUPPORTED_MEDIA_TYPE = 415;
+io.HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+io.HttpStatus.EXPECTATION_FAILED = 417;
+io.HttpStatus.INTERNAL_SERVER_ERROR = 500;
+io.HttpStatus.NOT_IMPLEMENTED = 501;
+io.HttpStatus.BAD_GATEWAY = 502;
+io.HttpStatus.SERVICE_UNAVAILABLE = 503;
+io.HttpStatus.GATEWAY_TIMEOUT = 504;
+io.HttpStatus.HTTP_VERSION_NOT_SUPPORTED = 505;
+io.HttpStatus.NETWORK_CONNECT_TIMEOUT_ERROR = 599;
+io.HttpServer = class HttpServer extends core.Object {
+  static bind(address, port, opts) {
+    let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+    let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+    let shared = opts && 'shared' in opts ? opts.shared : false;
+    return io._HttpServer.bind(address, port, backlog, v6Only, shared);
+  }
+  static bindSecure(address, port, context, opts) {
+    let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+    let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+    let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+    let shared = opts && 'shared' in opts ? opts.shared : false;
+    return io._HttpServer.bindSecure(address, port, context, backlog, v6Only, requestClientCertificate, shared);
+  }
+  static listenOn(serverSocket) {
+    return new io._HttpServer.listenOn(serverSocket);
+  }
+};
+io.HttpServer[dart.implements] = () => [StreamOfHttpRequest()];
+dart.setSignature(io.HttpServer, {
+  constructors: () => ({listenOn: dart.definiteFunctionType(io.HttpServer, [io.ServerSocket])}),
+  fields: () => ({
+    serverHeader: core.String,
+    autoCompress: core.bool,
+    idleTimeout: core.Duration
+  }),
+  statics: () => ({
+    bind: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool}),
+    bindSecure: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, shared: core.bool})
+  }),
+  names: ['bind', 'bindSecure']
+});
+io.HttpConnectionsInfo = class HttpConnectionsInfo extends core.Object {
+  new() {
+    this.total = 0;
+    this.active = 0;
+    this.idle = 0;
+    this.closing = 0;
+  }
+};
+dart.setSignature(io.HttpConnectionsInfo, {
+  fields: () => ({
+    total: core.int,
+    active: core.int,
+    idle: core.int,
+    closing: core.int
+  })
+});
+io.HttpHeaders = class HttpHeaders extends core.Object {
+  new() {
+    this.date = null;
+    this.expires = null;
+    this.ifModifiedSince = null;
+    this.host = null;
+    this.port = null;
+    this.contentType = null;
+    this.contentLength = null;
+    this.persistentConnection = null;
+    this.chunkedTransferEncoding = null;
+  }
+};
+dart.setSignature(io.HttpHeaders, {
+  fields: () => ({
+    date: core.DateTime,
+    expires: core.DateTime,
+    ifModifiedSince: core.DateTime,
+    host: core.String,
+    port: core.int,
+    contentType: io.ContentType,
+    contentLength: core.int,
+    persistentConnection: core.bool,
+    chunkedTransferEncoding: core.bool
+  }),
+  sfields: () => ({
+    ACCEPT: core.String,
+    ACCEPT_CHARSET: core.String,
+    ACCEPT_ENCODING: core.String,
+    ACCEPT_LANGUAGE: core.String,
+    ACCEPT_RANGES: core.String,
+    AGE: core.String,
+    ALLOW: core.String,
+    AUTHORIZATION: core.String,
+    CACHE_CONTROL: core.String,
+    CONNECTION: core.String,
+    CONTENT_ENCODING: core.String,
+    CONTENT_LANGUAGE: core.String,
+    CONTENT_LENGTH: core.String,
+    CONTENT_LOCATION: core.String,
+    CONTENT_MD5: core.String,
+    CONTENT_RANGE: core.String,
+    CONTENT_TYPE: core.String,
+    DATE: core.String,
+    ETAG: core.String,
+    EXPECT: core.String,
+    EXPIRES: core.String,
+    FROM: core.String,
+    HOST: core.String,
+    IF_MATCH: core.String,
+    IF_MODIFIED_SINCE: core.String,
+    IF_NONE_MATCH: core.String,
+    IF_RANGE: core.String,
+    IF_UNMODIFIED_SINCE: core.String,
+    LAST_MODIFIED: core.String,
+    LOCATION: core.String,
+    MAX_FORWARDS: core.String,
+    PRAGMA: core.String,
+    PROXY_AUTHENTICATE: core.String,
+    PROXY_AUTHORIZATION: core.String,
+    RANGE: core.String,
+    REFERER: core.String,
+    RETRY_AFTER: core.String,
+    SERVER: core.String,
+    TE: core.String,
+    TRAILER: core.String,
+    TRANSFER_ENCODING: core.String,
+    UPGRADE: core.String,
+    USER_AGENT: core.String,
+    VARY: core.String,
+    VIA: core.String,
+    WARNING: core.String,
+    WWW_AUTHENTICATE: core.String,
+    COOKIE: core.String,
+    SET_COOKIE: core.String,
+    GENERAL_HEADERS: ListOfString(),
+    ENTITY_HEADERS: ListOfString(),
+    RESPONSE_HEADERS: ListOfString(),
+    REQUEST_HEADERS: ListOfString()
+  })
+});
+io.HttpHeaders.ACCEPT = "accept";
+io.HttpHeaders.ACCEPT_CHARSET = "accept-charset";
+io.HttpHeaders.ACCEPT_ENCODING = "accept-encoding";
+io.HttpHeaders.ACCEPT_LANGUAGE = "accept-language";
+io.HttpHeaders.ACCEPT_RANGES = "accept-ranges";
+io.HttpHeaders.AGE = "age";
+io.HttpHeaders.ALLOW = "allow";
+io.HttpHeaders.AUTHORIZATION = "authorization";
+io.HttpHeaders.CACHE_CONTROL = "cache-control";
+io.HttpHeaders.CONNECTION = "connection";
+io.HttpHeaders.CONTENT_ENCODING = "content-encoding";
+io.HttpHeaders.CONTENT_LANGUAGE = "content-language";
+io.HttpHeaders.CONTENT_LENGTH = "content-length";
+io.HttpHeaders.CONTENT_LOCATION = "content-location";
+io.HttpHeaders.CONTENT_MD5 = "content-md5";
+io.HttpHeaders.CONTENT_RANGE = "content-range";
+io.HttpHeaders.CONTENT_TYPE = "content-type";
+io.HttpHeaders.DATE = "date";
+io.HttpHeaders.ETAG = "etag";
+io.HttpHeaders.EXPECT = "expect";
+io.HttpHeaders.EXPIRES = "expires";
+io.HttpHeaders.FROM = "from";
+io.HttpHeaders.HOST = "host";
+io.HttpHeaders.IF_MATCH = "if-match";
+io.HttpHeaders.IF_MODIFIED_SINCE = "if-modified-since";
+io.HttpHeaders.IF_NONE_MATCH = "if-none-match";
+io.HttpHeaders.IF_RANGE = "if-range";
+io.HttpHeaders.IF_UNMODIFIED_SINCE = "if-unmodified-since";
+io.HttpHeaders.LAST_MODIFIED = "last-modified";
+io.HttpHeaders.LOCATION = "location";
+io.HttpHeaders.MAX_FORWARDS = "max-forwards";
+io.HttpHeaders.PRAGMA = "pragma";
+io.HttpHeaders.PROXY_AUTHENTICATE = "proxy-authenticate";
+io.HttpHeaders.PROXY_AUTHORIZATION = "proxy-authorization";
+io.HttpHeaders.RANGE = "range";
+io.HttpHeaders.REFERER = "referer";
+io.HttpHeaders.RETRY_AFTER = "retry-after";
+io.HttpHeaders.SERVER = "server";
+io.HttpHeaders.TE = "te";
+io.HttpHeaders.TRAILER = "trailer";
+io.HttpHeaders.TRANSFER_ENCODING = "transfer-encoding";
+io.HttpHeaders.UPGRADE = "upgrade";
+io.HttpHeaders.USER_AGENT = "user-agent";
+io.HttpHeaders.VARY = "vary";
+io.HttpHeaders.VIA = "via";
+io.HttpHeaders.WARNING = "warning";
+io.HttpHeaders.WWW_AUTHENTICATE = "www-authenticate";
+io.HttpHeaders.COOKIE = "cookie";
+io.HttpHeaders.SET_COOKIE = "set-cookie";
+dart.defineLazy(io.HttpHeaders, {
+  get GENERAL_HEADERS() {
+    return dart.constList([io.HttpHeaders.CACHE_CONTROL, io.HttpHeaders.CONNECTION, io.HttpHeaders.DATE, io.HttpHeaders.PRAGMA, io.HttpHeaders.TRAILER, io.HttpHeaders.TRANSFER_ENCODING, io.HttpHeaders.UPGRADE, io.HttpHeaders.VIA, io.HttpHeaders.WARNING], core.String);
+  },
+  get ENTITY_HEADERS() {
+    return dart.constList([io.HttpHeaders.ALLOW, io.HttpHeaders.CONTENT_ENCODING, io.HttpHeaders.CONTENT_LANGUAGE, io.HttpHeaders.CONTENT_LENGTH, io.HttpHeaders.CONTENT_LOCATION, io.HttpHeaders.CONTENT_MD5, io.HttpHeaders.CONTENT_RANGE, io.HttpHeaders.CONTENT_TYPE, io.HttpHeaders.EXPIRES, io.HttpHeaders.LAST_MODIFIED], core.String);
+  },
+  get RESPONSE_HEADERS() {
+    return dart.constList([io.HttpHeaders.ACCEPT_RANGES, io.HttpHeaders.AGE, io.HttpHeaders.ETAG, io.HttpHeaders.LOCATION, io.HttpHeaders.PROXY_AUTHENTICATE, io.HttpHeaders.RETRY_AFTER, io.HttpHeaders.SERVER, io.HttpHeaders.VARY, io.HttpHeaders.WWW_AUTHENTICATE], core.String);
+  },
+  get REQUEST_HEADERS() {
+    return dart.constList([io.HttpHeaders.ACCEPT, io.HttpHeaders.ACCEPT_CHARSET, io.HttpHeaders.ACCEPT_ENCODING, io.HttpHeaders.ACCEPT_LANGUAGE, io.HttpHeaders.AUTHORIZATION, io.HttpHeaders.EXPECT, io.HttpHeaders.FROM, io.HttpHeaders.HOST, io.HttpHeaders.IF_MATCH, io.HttpHeaders.IF_MODIFIED_SINCE, io.HttpHeaders.IF_NONE_MATCH, io.HttpHeaders.IF_RANGE, io.HttpHeaders.IF_UNMODIFIED_SINCE, io.HttpHeaders.MAX_FORWARDS, io.HttpHeaders.PROXY_AUTHORIZATION, io.HttpHeaders.RANGE, io.HttpHeaders.REFERER, io.HttpHeaders.TE, io.HttpHeaders.USER_AGENT], core.String);
+  }
+});
+io.HeaderValue = class HeaderValue extends core.Object {
+  static new(value, parameters) {
+    if (value === void 0) value = "";
+    if (parameters === void 0) parameters = null;
+    return new io._HeaderValue(value, parameters);
+  }
+  static parse(value, opts) {
+    let parameterSeparator = opts && 'parameterSeparator' in opts ? opts.parameterSeparator : ";";
+    let valueSeparator = opts && 'valueSeparator' in opts ? opts.valueSeparator : null;
+    let preserveBackslash = opts && 'preserveBackslash' in opts ? opts.preserveBackslash : false;
+    return io._HeaderValue.parse(value, {parameterSeparator: parameterSeparator, valueSeparator: valueSeparator, preserveBackslash: preserveBackslash});
+  }
+};
+dart.setSignature(io.HeaderValue, {
+  constructors: () => ({new: dart.definiteFunctionType(io.HeaderValue, [], [core.String, MapOfString$String()])}),
+  statics: () => ({parse: dart.definiteFunctionType(io.HeaderValue, [core.String], {parameterSeparator: core.String, valueSeparator: core.String, preserveBackslash: core.bool})}),
+  names: ['parse']
+});
+io.HttpSession = class HttpSession extends core.Object {};
+io.HttpSession[dart.implements] = () => [core.Map];
+io.ContentType = class ContentType extends core.Object {
+  static new(primaryType, subType, opts) {
+    let charset = opts && 'charset' in opts ? opts.charset : null;
+    let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+    return new io._ContentType(primaryType, subType, charset, parameters);
+  }
+  static parse(value) {
+    return io._ContentType.parse(value);
+  }
+};
+io.ContentType[dart.implements] = () => [io.HeaderValue];
+dart.setSignature(io.ContentType, {
+  constructors: () => ({new: dart.definiteFunctionType(io.ContentType, [core.String, core.String], {charset: core.String, parameters: MapOfString$String()})}),
+  sfields: () => ({
+    TEXT: io.ContentType,
+    HTML: io.ContentType,
+    JSON: io.ContentType,
+    BINARY: io.ContentType
+  }),
+  statics: () => ({parse: dart.definiteFunctionType(io.ContentType, [core.String])}),
+  names: ['parse']
+});
+dart.defineLazy(io.ContentType, {
+  get TEXT() {
+    return io.ContentType.new("text", "plain", {charset: "utf-8"});
+  },
+  get HTML() {
+    return io.ContentType.new("text", "html", {charset: "utf-8"});
+  },
+  get JSON() {
+    return io.ContentType.new("application", "json", {charset: "utf-8"});
+  },
+  get BINARY() {
+    return io.ContentType.new("application", "octet-stream");
+  }
+});
+io.Cookie = class Cookie extends core.Object {
+  static new(name, value) {
+    if (name === void 0) name = null;
+    if (value === void 0) value = null;
+    return new io._Cookie(name, value);
+  }
+  static fromSetCookieValue(value) {
+    return new io._Cookie.fromSetCookieValue(value);
+  }
+};
+dart.setSignature(io.Cookie, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io.Cookie, [], [core.String, core.String]),
+    fromSetCookieValue: dart.definiteFunctionType(io.Cookie, [core.String])
+  }),
+  fields: () => ({
+    name: core.String,
+    value: core.String,
+    expires: core.DateTime,
+    maxAge: core.int,
+    domain: core.String,
+    path: core.String,
+    secure: core.bool,
+    httpOnly: core.bool
+  })
+});
+io.HttpRequest = class HttpRequest extends core.Object {};
+io.HttpRequest[dart.implements] = () => [StreamOfListOfint()];
+io.HttpResponse = class HttpResponse extends core.Object {
+  new() {
+    this.contentLength = null;
+    this.statusCode = null;
+    this.reasonPhrase = null;
+    this.persistentConnection = null;
+    this.deadline = null;
+    this.bufferOutput = null;
+  }
+};
+io.HttpResponse[dart.implements] = () => [io.IOSink];
+dart.setSignature(io.HttpResponse, {
+  fields: () => ({
+    contentLength: core.int,
+    statusCode: core.int,
+    reasonPhrase: core.String,
+    persistentConnection: core.bool,
+    deadline: core.Duration,
+    bufferOutput: core.bool
+  })
+});
+io.HttpClient = class HttpClient extends core.Object {
+  static new(opts) {
+    let context = opts && 'context' in opts ? opts.context : null;
+    return new io._HttpClient(context);
+  }
+  static findProxyFromEnvironment(url, opts) {
+    let environment = opts && 'environment' in opts ? opts.environment : null;
+    return io._HttpClient._findProxyFromEnvironment(url, environment);
+  }
+};
+dart.setSignature(io.HttpClient, {
+  constructors: () => ({new: dart.definiteFunctionType(io.HttpClient, [], {context: io.SecurityContext})}),
+  fields: () => ({
+    idleTimeout: core.Duration,
+    maxConnectionsPerHost: core.int,
+    autoUncompress: core.bool,
+    userAgent: core.String
+  }),
+  sfields: () => ({
+    DEFAULT_HTTP_PORT: core.int,
+    DEFAULT_HTTPS_PORT: core.int
+  }),
+  statics: () => ({findProxyFromEnvironment: dart.definiteFunctionType(core.String, [core.Uri], {environment: MapOfString$String()})}),
+  names: ['findProxyFromEnvironment']
+});
+io.HttpClient.DEFAULT_HTTP_PORT = 80;
+io.HttpClient.DEFAULT_HTTPS_PORT = 443;
+io.HttpClientRequest = class HttpClientRequest extends core.Object {
+  new() {
+    this.persistentConnection = null;
+    this.followRedirects = null;
+    this.maxRedirects = null;
+    this.contentLength = null;
+    this.bufferOutput = null;
+  }
+};
+io.HttpClientRequest[dart.implements] = () => [io.IOSink];
+dart.setSignature(io.HttpClientRequest, {
+  fields: () => ({
+    persistentConnection: core.bool,
+    followRedirects: core.bool,
+    maxRedirects: core.int,
+    contentLength: core.int,
+    bufferOutput: core.bool
+  })
+});
+io.HttpClientResponse = class HttpClientResponse extends core.Object {};
+io.HttpClientResponse[dart.implements] = () => [StreamOfListOfint()];
+io.HttpClientCredentials = class HttpClientCredentials extends core.Object {};
+io.HttpClientBasicCredentials = class HttpClientBasicCredentials extends io.HttpClientCredentials {
+  static new(username, password) {
+    return new io._HttpClientBasicCredentials(username, password);
+  }
+};
+dart.setSignature(io.HttpClientBasicCredentials, {
+  constructors: () => ({new: dart.definiteFunctionType(io.HttpClientBasicCredentials, [core.String, core.String])})
+});
+io.HttpClientDigestCredentials = class HttpClientDigestCredentials extends io.HttpClientCredentials {
+  static new(username, password) {
+    return new io._HttpClientDigestCredentials(username, password);
+  }
+};
+dart.setSignature(io.HttpClientDigestCredentials, {
+  constructors: () => ({new: dart.definiteFunctionType(io.HttpClientDigestCredentials, [core.String, core.String])})
+});
+io.HttpConnectionInfo = class HttpConnectionInfo extends core.Object {};
+io.RedirectInfo = class RedirectInfo extends core.Object {};
+io.DetachedSocket = class DetachedSocket extends core.Object {};
+io.HttpException = class HttpException extends core.Object {
+  new(message, opts) {
+    let uri = opts && 'uri' in opts ? opts.uri : null;
+    this.message = message;
+    this.uri = uri;
+  }
+  toString() {
+    let b = new core.StringBuffer();
+    b.write('HttpException: ');
+    b.write(this.message);
+    if (this.uri != null) {
+      b.write(dart.str`, uri = ${this.uri}`);
+    }
+    return b.toString();
+  }
+};
+io.HttpException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.HttpException, {
+  constructors: () => ({new: dart.definiteFunctionType(io.HttpException, [core.String], {uri: core.Uri})}),
+  fields: () => ({
+    message: core.String,
+    uri: core.Uri
+  })
+});
+io.RedirectException = class RedirectException extends core.Object {
+  new(message, redirects) {
+    this.message = message;
+    this.redirects = redirects;
+  }
+  toString() {
+    return dart.str`RedirectException: ${this.message}`;
+  }
+  get uri() {
+    return this.redirects[dartx.last].location;
+  }
+};
+io.RedirectException[dart.implements] = () => [io.HttpException];
+dart.setSignature(io.RedirectException, {
+  constructors: () => ({new: dart.definiteFunctionType(io.RedirectException, [core.String, ListOfRedirectInfo()])}),
+  fields: () => ({
+    message: core.String,
+    redirects: ListOfRedirectInfo()
+  }),
+  getters: () => ({uri: dart.definiteFunctionType(core.Uri, [])})
+});
+let const;
+let const;
+let const;
+let const;
+let const;
+let const;
+let const;
+let const;
+let const;
+io.HttpDate = class HttpDate extends core.Object {
+  static format(date) {
+    let wkday = const || (const = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+    let month = const || (const = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+    let d = date.toUtc();
+    let sb = new core.StringBuffer();
+    sb.write(wkday[dartx._get](dart.notNull(d.weekday) - 1));
+    sb.write(", ");
+    sb.write(dart.notNull(d.day) <= 9 ? "0" : "");
+    sb.write(dart.toString(d.day));
+    sb.write(" ");
+    sb.write(month[dartx._get](dart.notNull(d.month) - 1));
+    sb.write(" ");
+    sb.write(dart.toString(d.year));
+    sb.write(dart.notNull(d.hour) <= 9 ? " 0" : " ");
+    sb.write(dart.toString(d.hour));
+    sb.write(dart.notNull(d.minute) <= 9 ? ":0" : ":");
+    sb.write(dart.toString(d.minute));
+    sb.write(dart.notNull(d.second) <= 9 ? ":0" : ":");
+    sb.write(dart.toString(d.second));
+    sb.write(" GMT");
+    return sb.toString();
+  }
+  static parse(date) {
+    let SP = 32;
+    let wkdays = const || (const = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+    let weekdays = const || (const = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
+    let months = const || (const = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+    let wkdaysLowerCase = const || (const = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
+    let weekdaysLowerCase = const || (const = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
+    let monthsLowerCase = const || (const = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+    let formatRfc1123 = 0;
+    let formatRfc850 = 1;
+    let formatAsctime = 2;
+    let index = 0;
+    let tmp = null;
+    let format = null;
+    function expect(s) {
+      if (dart.notNull(date[dartx.length]) - dart.notNull(index) < dart.notNull(s[dartx.length])) {
+        dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      }
+      let tmp = date[dartx.substring](index, dart.notNull(index) + dart.notNull(s[dartx.length]));
+      if (tmp != s) {
+        dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      }
+      index = dart.notNull(index) + dart.notNull(s[dartx.length]);
+    }
+    dart.fn(expect, StringTovoid());
+    function expectWeekday() {
+      let weekday = null;
+      let pos = date[dartx.indexOf](",", index);
+      if (pos == -1) {
+        let pos = date[dartx.indexOf](" ", index);
+        if (pos == -1) dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        tmp = date[dartx.substring](index, pos);
+        index = dart.notNull(pos) + 1;
+        weekday = wkdays[dartx.indexOf](tmp);
+        if (weekday != -1) {
+          format = formatAsctime;
+          return weekday;
+        }
+      } else {
+        tmp = date[dartx.substring](index, pos);
+        index = dart.notNull(pos) + 1;
+        weekday = wkdays[dartx.indexOf](tmp);
+        if (weekday != -1) {
+          format = formatRfc1123;
+          return weekday;
+        }
+        weekday = weekdays[dartx.indexOf](tmp);
+        if (weekday != -1) {
+          format = formatRfc850;
+          return weekday;
+        }
+      }
+      dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+    }
+    dart.fn(expectWeekday, VoidToint());
+    function expectMonth(separator) {
+      let pos = date[dartx.indexOf](separator, index);
+      if (dart.notNull(pos) - dart.notNull(index) != 3) dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      tmp = date[dartx.substring](index, pos);
+      index = dart.notNull(pos) + 1;
+      let month = months[dartx.indexOf](tmp);
+      if (month != -1) return month;
+      dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+    }
+    dart.fn(expectMonth, StringToint());
+    function expectNum(separator) {
+      let pos = null;
+      if (dart.notNull(separator[dartx.length]) > 0) {
+        pos = date[dartx.indexOf](separator, index);
+      } else {
+        pos = date[dartx.length];
+      }
+      let tmp = date[dartx.substring](index, pos);
+      index = dart.notNull(pos) + dart.notNull(separator[dartx.length]);
+      try {
+        let value = core.int.parse(tmp);
+        return value;
+      } catch (e) {
+        if (core.FormatException.is(e)) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        } else
+          throw e;
+      }
+
+    }
+    dart.fn(expectNum, StringToint());
+    function expectEnd() {
+      if (index != date[dartx.length]) {
+        dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      }
+    }
+    dart.fn(expectEnd, VoidTovoid());
+    let weekday = expectWeekday();
+    let day = null;
+    let month = null;
+    let year = null;
+    let hours = null;
+    let minutes = null;
+    let seconds = null;
+    if (format == formatAsctime) {
+      month = expectMonth(" ");
+      if (date[dartx.codeUnitAt](index) == SP) {
+        index = dart.notNull(index) + 1;
+      }
+      day = expectNum(" ");
+      hours = expectNum(":");
+      minutes = expectNum(":");
+      seconds = expectNum(" ");
+      year = expectNum("");
+    } else {
+      expect(" ");
+      day = expectNum(format == formatRfc1123 ? " " : "-");
+      month = expectMonth(format == formatRfc1123 ? " " : "-");
+      year = expectNum(" ");
+      hours = expectNum(":");
+      minutes = expectNum(":");
+      seconds = expectNum(" ");
+      expect("GMT");
+    }
+    expectEnd();
+    return new core.DateTime.utc(year, dart.notNull(month) + 1, day, hours, minutes, seconds, 0);
+  }
+  static _parseCookieDate(date) {
+    let monthsLowerCase = const || (const = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+    let position = 0;
+    function error() {
+      dart.throw(new io.HttpException(dart.str`Invalid cookie date ${date}`));
+    }
+    dart.fn(error, VoidTovoid());
+    function isEnd() {
+      return position == date[dartx.length];
+    }
+    dart.fn(isEnd, VoidTobool());
+    function isDelimiter(s) {
+      let char = s[dartx.codeUnitAt](0);
+      if (char == 9) return true;
+      if (dart.notNull(char) >= 32 && dart.notNull(char) <= 47) return true;
+      if (dart.notNull(char) >= 59 && dart.notNull(char) <= 64) return true;
+      if (dart.notNull(char) >= 91 && dart.notNull(char) <= 96) return true;
+      if (dart.notNull(char) >= 123 && dart.notNull(char) <= 126) return true;
+      return false;
+    }
+    dart.fn(isDelimiter, StringTobool());
+    function isNonDelimiter(s) {
+      let char = s[dartx.codeUnitAt](0);
+      if (dart.notNull(char) >= 0 && dart.notNull(char) <= 8) return true;
+      if (dart.notNull(char) >= 10 && dart.notNull(char) <= 31) return true;
+      if (dart.notNull(char) >= 48 && dart.notNull(char) <= 57) return true;
+      if (char == 58) return true;
+      if (dart.notNull(char) >= 65 && dart.notNull(char) <= 90) return true;
+      if (dart.notNull(char) >= 97 && dart.notNull(char) <= 122) return true;
+      if (dart.notNull(char) >= 127 && dart.notNull(char) <= 255) return true;
+      return false;
+    }
+    dart.fn(isNonDelimiter, StringTobool());
+    function isDigit(s) {
+      let char = s[dartx.codeUnitAt](0);
+      if (dart.notNull(char) > 47 && dart.notNull(char) < 58) return true;
+      return false;
+    }
+    dart.fn(isDigit, StringTobool());
+    function getMonth(month) {
+      if (dart.notNull(month[dartx.length]) < 3) return -1;
+      return monthsLowerCase[dartx.indexOf](month[dartx.substring](0, 3));
+    }
+    dart.fn(getMonth, StringToint());
+    function toInt(s) {
+      let index = 0;
+      for (; index < dart.notNull(s[dartx.length]) && dart.test(isDigit(s[dartx._get](index))); index++)
+        ;
+      return core.int.parse(s[dartx.substring](0, index));
+    }
+    dart.fn(toInt, StringToint());
+    let tokens = [];
+    while (!dart.test(isEnd())) {
+      while (!dart.test(isEnd()) && dart.test(isDelimiter(date[dartx._get](position))))
+        position++;
+      let start = position;
+      while (!dart.test(isEnd()) && dart.test(isNonDelimiter(date[dartx._get](position))))
+        position++;
+      tokens[dartx.add](date[dartx.substring](start, position)[dartx.toLowerCase]());
+      while (!dart.test(isEnd()) && dart.test(isDelimiter(date[dartx._get](position))))
+        position++;
+    }
+    let timeStr = null;
+    let dayOfMonthStr = null;
+    let monthStr = null;
+    let yearStr = null;
+    for (let token of tokens) {
+      if (dart.test(dart.dsend(dart.dload(token, 'length'), '<', 1))) continue;
+      if (timeStr == null && dart.test(dart.dsend(dart.dload(token, 'length'), '>=', 5)) && dart.test(isDigit(core.String._check(dart.dindex(token, 0)))) && (dart.equals(dart.dindex(token, 1), ":") || dart.test(isDigit(core.String._check(dart.dindex(token, 1)))) && dart.equals(dart.dindex(token, 2), ":"))) {
+        timeStr = core.String._check(token);
+      } else if (dayOfMonthStr == null && dart.test(isDigit(core.String._check(dart.dindex(token, 0))))) {
+        dayOfMonthStr = core.String._check(token);
+      } else if (monthStr == null && dart.notNull(getMonth(core.String._check(token))) >= 0) {
+        monthStr = core.String._check(token);
+      } else if (yearStr == null && dart.test(dart.dsend(dart.dload(token, 'length'), '>=', 2)) && dart.test(isDigit(core.String._check(dart.dindex(token, 0)))) && dart.test(isDigit(core.String._check(dart.dindex(token, 1))))) {
+        yearStr = core.String._check(token);
+      }
+    }
+    if (timeStr == null || dayOfMonthStr == null || monthStr == null || yearStr == null) {
+      error();
+    }
+    let year = toInt(yearStr);
+    if (dart.notNull(year) >= 70 && dart.notNull(year) <= 99) {
+      year = dart.notNull(year) + 1900;
+    } else if (dart.notNull(year) >= 0 && dart.notNull(year) <= 69) {
+      year = dart.notNull(year) + 2000;
+    }
+    if (dart.notNull(year) < 1601) error();
+    let dayOfMonth = toInt(dayOfMonthStr);
+    if (dart.notNull(dayOfMonth) < 1 || dart.notNull(dayOfMonth) > 31) error();
+    let month = dart.notNull(getMonth(monthStr)) + 1;
+    let timeList = timeStr[dartx.split](":");
+    if (timeList[dartx.length] != 3) error();
+    let hour = toInt(timeList[dartx._get](0));
+    let minute = toInt(timeList[dartx._get](1));
+    let second = toInt(timeList[dartx._get](2));
+    if (dart.notNull(hour) > 23) error();
+    if (dart.notNull(minute) > 59) error();
+    if (dart.notNull(second) > 59) error();
+    return new core.DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0);
+  }
+};
+dart.setSignature(io.HttpDate, {
+  statics: () => ({
+    format: dart.definiteFunctionType(core.String, [core.DateTime]),
+    parse: dart.definiteFunctionType(core.DateTime, [core.String]),
+    _parseCookieDate: dart.definiteFunctionType(core.DateTime, [core.String])
+  }),
+  names: ['format', 'parse', '_parseCookieDate']
+});
+const _headers = Symbol('_headers');
+const _defaultPortForScheme = Symbol('_defaultPortForScheme');
+const _mutable = Symbol('_mutable');
+const _noFoldingHeaders = Symbol('_noFoldingHeaders');
+const _contentLength = Symbol('_contentLength');
+const _persistentConnection = Symbol('_persistentConnection');
+const _chunkedTransferEncoding = Symbol('_chunkedTransferEncoding');
+const _host = Symbol('_host');
+const _port = Symbol('_port');
+const _checkMutable = Symbol('_checkMutable');
+const _addAll = Symbol('_addAll');
+const _add = Symbol('_add');
+const _set = Symbol('_set');
+const _addValue = Symbol('_addValue');
+const _updateHostHeader = Symbol('_updateHostHeader');
+const _addDate = Symbol('_addDate');
+const _addHost = Symbol('_addHost');
+const _addExpires = Symbol('_addExpires');
+const _addConnection = Symbol('_addConnection');
+const _addContentType = Symbol('_addContentType');
+const _addContentLength = Symbol('_addContentLength');
+const _addTransferEncoding = Symbol('_addTransferEncoding');
+const _addIfModifiedSince = Symbol('_addIfModifiedSince');
+const _foldHeader = Symbol('_foldHeader');
+const _finalize = Symbol('_finalize');
+const _write = Symbol('_write');
+const _parseCookies = Symbol('_parseCookies');
+io._HttpHeaders = class _HttpHeaders extends core.Object {
+  new(protocolVersion, opts) {
+    let defaultPortForScheme = opts && 'defaultPortForScheme' in opts ? opts.defaultPortForScheme : io.HttpClient.DEFAULT_HTTP_PORT;
+    let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
+    this.protocolVersion = protocolVersion;
+    this[_headers] = HashMapOfString$ListOfString().new();
+    this[_defaultPortForScheme] = defaultPortForScheme;
+    this[_mutable] = true;
+    this[_noFoldingHeaders] = null;
+    this[_contentLength] = -1;
+    this[_persistentConnection] = true;
+    this[_chunkedTransferEncoding] = false;
+    this[_host] = null;
+    this[_port] = null;
+    if (initialHeaders != null) {
+      initialHeaders[_headers][dartx.forEach](dart.fn((name, value) => this[_headers][dartx._set](name, value), StringAndListOfStringToListOfString()));
+      this[_contentLength] = initialHeaders[_contentLength];
+      this[_persistentConnection] = initialHeaders[_persistentConnection];
+      this[_chunkedTransferEncoding] = initialHeaders[_chunkedTransferEncoding];
+      this[_host] = initialHeaders[_host];
+      this[_port] = initialHeaders[_port];
+    }
+    if (this.protocolVersion == "1.0") {
+      this[_persistentConnection] = false;
+      this[_chunkedTransferEncoding] = false;
+    }
+  }
+  _get(name) {
+    return this[_headers][dartx._get](name[dartx.toLowerCase]());
+  }
+  value(name) {
+    name = name[dartx.toLowerCase]();
+    let values = this[_headers][dartx._get](name);
+    if (values == null) return null;
+    if (dart.notNull(values[dartx.length]) > 1) {
+      dart.throw(new io.HttpException(dart.str`More than one value for header ${name}`));
+    }
+    return values[dartx._get](0);
+  }
+  add(name, value) {
+    this[_checkMutable]();
+    this[_addAll](io._HttpHeaders._validateField(name), value);
+  }
+  [_addAll](name, value) {
+    dart.assert(name == io._HttpHeaders._validateField(name));
+    if (core.Iterable.is(value)) {
+      for (let v of value) {
+        this[_add](name, io._HttpHeaders._validateValue(v));
+      }
+    } else {
+      this[_add](name, io._HttpHeaders._validateValue(value));
+    }
+  }
+  set(name, value) {
+    this[_checkMutable]();
+    name = io._HttpHeaders._validateField(name);
+    this[_headers][dartx.remove](name);
+    if (name == io.HttpHeaders.TRANSFER_ENCODING) {
+      this[_chunkedTransferEncoding] = false;
+    }
+    this[_addAll](name, value);
+  }
+  remove(name, value) {
+    this[_checkMutable]();
+    name = io._HttpHeaders._validateField(name);
+    value = io._HttpHeaders._validateValue(value);
+    let values = this[_headers][dartx._get](name);
+    if (values != null) {
+      let index = values[dartx.indexOf](core.String._check(value));
+      if (index != -1) {
+        values[dartx.removeRange](index, dart.notNull(index) + 1);
+      }
+      if (values[dartx.length] == 0) this[_headers][dartx.remove](name);
+    }
+    if (name == io.HttpHeaders.TRANSFER_ENCODING && dart.equals(value, "chunked")) {
+      this[_chunkedTransferEncoding] = false;
+    }
+  }
+  removeAll(name) {
+    this[_checkMutable]();
+    name = io._HttpHeaders._validateField(name);
+    this[_headers][dartx.remove](name);
+  }
+  forEach(f) {
+    this[_headers][dartx.forEach](f);
+  }
+  noFolding(name) {
+    if (this[_noFoldingHeaders] == null) this[_noFoldingHeaders] = ListOfString().new();
+    this[_noFoldingHeaders][dartx.add](name);
+  }
+  get persistentConnection() {
+    return this[_persistentConnection];
+  }
+  set persistentConnection(persistentConnection) {
+    this[_checkMutable]();
+    if (persistentConnection == this[_persistentConnection]) return;
+    if (dart.test(persistentConnection)) {
+      if (this.protocolVersion == "1.1") {
+        this.remove(io.HttpHeaders.CONNECTION, "close");
+      } else {
+        if (this[_contentLength] == -1) {
+          dart.throw(new io.HttpException("Trying to set 'Connection: Keep-Alive' on HTTP 1.0 headers with " + "no ContentLength"));
+        }
+        this.add(io.HttpHeaders.CONNECTION, "keep-alive");
+      }
+    } else {
+      if (this.protocolVersion == "1.1") {
+        this.add(io.HttpHeaders.CONNECTION, "close");
+      } else {
+        this.remove(io.HttpHeaders.CONNECTION, "keep-alive");
+      }
+    }
+    this[_persistentConnection] = persistentConnection;
+  }
+  get contentLength() {
+    return this[_contentLength];
+  }
+  set contentLength(contentLength) {
+    this[_checkMutable]();
+    if (this.protocolVersion == "1.0" && dart.test(this.persistentConnection) && contentLength == -1) {
+      dart.throw(new io.HttpException("Trying to clear ContentLength on HTTP 1.0 headers with " + "'Connection: Keep-Alive' set"));
+    }
+    if (this[_contentLength] == contentLength) return;
+    this[_contentLength] = contentLength;
+    if (dart.notNull(this[_contentLength]) >= 0) {
+      if (dart.test(this.chunkedTransferEncoding)) this.chunkedTransferEncoding = false;
+      this[_set](io.HttpHeaders.CONTENT_LENGTH, dart.toString(contentLength));
+    } else {
+      this.removeAll(io.HttpHeaders.CONTENT_LENGTH);
+      if (this.protocolVersion == "1.1") {
+        this.chunkedTransferEncoding = true;
+      }
+    }
+  }
+  get chunkedTransferEncoding() {
+    return this[_chunkedTransferEncoding];
+  }
+  set chunkedTransferEncoding(chunkedTransferEncoding) {
+    this[_checkMutable]();
+    if (dart.test(chunkedTransferEncoding) && this.protocolVersion == "1.0") {
+      dart.throw(new io.HttpException("Trying to set 'Transfer-Encoding: Chunked' on HTTP 1.0 headers"));
+    }
+    if (chunkedTransferEncoding == this[_chunkedTransferEncoding]) return;
+    if (dart.test(chunkedTransferEncoding)) {
+      let values = this[_headers][dartx._get](io.HttpHeaders.TRANSFER_ENCODING);
+      if (values == null || values[dartx.last] != "chunked") {
+        this[_addValue](io.HttpHeaders.TRANSFER_ENCODING, "chunked");
+      }
+      this.contentLength = -1;
+    } else {
+      this.remove(io.HttpHeaders.TRANSFER_ENCODING, "chunked");
+    }
+    this[_chunkedTransferEncoding] = chunkedTransferEncoding;
+  }
+  get host() {
+    return this[_host];
+  }
+  set host(host) {
+    this[_checkMutable]();
+    this[_host] = host;
+    this[_updateHostHeader]();
+  }
+  get port() {
+    return this[_port];
+  }
+  set port(port) {
+    this[_checkMutable]();
+    this[_port] = port;
+    this[_updateHostHeader]();
+  }
+  get ifModifiedSince() {
+    let values = this[_headers][dartx._get](io.HttpHeaders.IF_MODIFIED_SINCE);
+    if (values != null) {
+      try {
+        return io.HttpDate.parse(values[dartx._get](0));
+      } catch (e) {
+        if (core.Exception.is(e)) {
+          return null;
+        } else
+          throw e;
+      }
+
+    }
+    return null;
+  }
+  set ifModifiedSince(ifModifiedSince) {
+    this[_checkMutable]();
+    let formatted = io.HttpDate.format(ifModifiedSince.toUtc());
+    this[_set](io.HttpHeaders.IF_MODIFIED_SINCE, formatted);
+  }
+  get date() {
+    let values = this[_headers][dartx._get](io.HttpHeaders.DATE);
+    if (values != null) {
+      try {
+        return io.HttpDate.parse(values[dartx._get](0));
+      } catch (e) {
+        if (core.Exception.is(e)) {
+          return null;
+        } else
+          throw e;
+      }
+
+    }
+    return null;
+  }
+  set date(date) {
+    this[_checkMutable]();
+    let formatted = io.HttpDate.format(date.toUtc());
+    this[_set]("date", formatted);
+  }
+  get expires() {
+    let values = this[_headers][dartx._get](io.HttpHeaders.EXPIRES);
+    if (values != null) {
+      try {
+        return io.HttpDate.parse(values[dartx._get](0));
+      } catch (e) {
+        if (core.Exception.is(e)) {
+          return null;
+        } else
+          throw e;
+      }
+
+    }
+    return null;
+  }
+  set expires(expires) {
+    this[_checkMutable]();
+    let formatted = io.HttpDate.format(expires.toUtc());
+    this[_set](io.HttpHeaders.EXPIRES, formatted);
+  }
+  get contentType() {
+    let values = this[_headers][dartx._get]("content-type");
+    if (values != null) {
+      return io.ContentType.parse(values[dartx._get](0));
+    } else {
+      return null;
+    }
+  }
+  set contentType(contentType) {
+    this[_checkMutable]();
+    this[_set](io.HttpHeaders.CONTENT_TYPE, dart.toString(contentType));
+  }
+  clear() {
+    this[_checkMutable]();
+    this[_headers][dartx.clear]();
+    this[_contentLength] = -1;
+    this[_persistentConnection] = true;
+    this[_chunkedTransferEncoding] = false;
+    this[_host] = null;
+    this[_port] = null;
+  }
+  [_add](name, value) {
+    dart.assert(name == io._HttpHeaders._validateField(name));
+    switch (name[dartx.length]) {
+      case 4:
+      {
+        if (io.HttpHeaders.DATE == name) {
+          this[_addDate](name, value);
+          return;
+        }
+        if (io.HttpHeaders.HOST == name) {
+          this[_addHost](name, value);
+          return;
+        }
+        break;
+      }
+      case 7:
+      {
+        if (io.HttpHeaders.EXPIRES == name) {
+          this[_addExpires](name, value);
+          return;
+        }
+        break;
+      }
+      case 10:
+      {
+        if (io.HttpHeaders.CONNECTION == name) {
+          this[_addConnection](name, value);
+          return;
+        }
+        break;
+      }
+      case 12:
+      {
+        if (io.HttpHeaders.CONTENT_TYPE == name) {
+          this[_addContentType](name, value);
+          return;
+        }
+        break;
+      }
+      case 14:
+      {
+        if (io.HttpHeaders.CONTENT_LENGTH == name) {
+          this[_addContentLength](name, value);
+          return;
+        }
+        break;
+      }
+      case 17:
+      {
+        if (io.HttpHeaders.TRANSFER_ENCODING == name) {
+          this[_addTransferEncoding](name, value);
+          return;
+        }
+        if (io.HttpHeaders.IF_MODIFIED_SINCE == name) {
+          this[_addIfModifiedSince](name, value);
+          return;
+        }
+      }
+    }
+    this[_addValue](name, value);
+  }
+  [_addContentLength](name, value) {
+    if (typeof value == 'number') {
+      this.contentLength = value;
+    } else if (typeof value == 'string') {
+      this.contentLength = core.int.parse(value);
+    } else {
+      dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+    }
+  }
+  [_addTransferEncoding](name, value) {
+    if (dart.equals(value, "chunked")) {
+      this.chunkedTransferEncoding = true;
+    } else {
+      this[_addValue](io.HttpHeaders.TRANSFER_ENCODING, value);
+    }
+  }
+  [_addDate](name, value) {
+    if (core.DateTime.is(value)) {
+      this.date = value;
+    } else if (typeof value == 'string') {
+      this[_set](io.HttpHeaders.DATE, value);
+    } else {
+      dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+    }
+  }
+  [_addExpires](name, value) {
+    if (core.DateTime.is(value)) {
+      this.expires = value;
+    } else if (typeof value == 'string') {
+      this[_set](io.HttpHeaders.EXPIRES, value);
+    } else {
+      dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+    }
+  }
+  [_addIfModifiedSince](name, value) {
+    if (core.DateTime.is(value)) {
+      this.ifModifiedSince = value;
+    } else if (typeof value == 'string') {
+      this[_set](io.HttpHeaders.IF_MODIFIED_SINCE, value);
+    } else {
+      dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+    }
+  }
+  [_addHost](name, value) {
+    if (typeof value == 'string') {
+      let pos = value[dartx.indexOf](":");
+      if (pos == -1) {
+        this[_host] = value;
+        this[_port] = io.HttpClient.DEFAULT_HTTP_PORT;
+      } else {
+        if (dart.notNull(pos) > 0) {
+          this[_host] = value[dartx.substring](0, pos);
+        } else {
+          this[_host] = null;
+        }
+        if (dart.notNull(pos) + 1 == value[dartx.length]) {
+          this[_port] = io.HttpClient.DEFAULT_HTTP_PORT;
+        } else {
+          try {
+            this[_port] = core.int.parse(value[dartx.substring](dart.notNull(pos) + 1));
+          } catch (e) {
+            if (core.FormatException.is(e)) {
+              this[_port] = null;
+            } else
+              throw e;
+          }
+
+        }
+      }
+      this[_set](io.HttpHeaders.HOST, value);
+    } else {
+      dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+    }
+  }
+  [_addConnection](name, value) {
+    let lowerCaseValue = dart.dsend(value, 'toLowerCase');
+    if (dart.equals(lowerCaseValue, 'close')) {
+      this[_persistentConnection] = false;
+    } else if (dart.equals(lowerCaseValue, 'keep-alive')) {
+      this[_persistentConnection] = true;
+    }
+    this[_addValue](name, value);
+  }
+  [_addContentType](name, value) {
+    this[_set](io.HttpHeaders.CONTENT_TYPE, core.String._check(value));
+  }
+  [_addValue](name, value) {
+    let values = this[_headers][dartx._get](name);
+    if (values == null) {
+      values = ListOfString().new();
+      this[_headers][dartx._set](name, values);
+    }
+    if (core.DateTime.is(value)) {
+      values[dartx.add](io.HttpDate.format(value));
+    } else if (typeof value == 'string') {
+      values[dartx.add](value);
+    } else {
+      values[dartx.add](core.String._check(io._HttpHeaders._validateValue(dart.toString(value))));
+    }
+  }
+  [_set](name, value) {
+    dart.assert(name == io._HttpHeaders._validateField(name));
+    let values = ListOfString().new();
+    this[_headers][dartx._set](name, values);
+    values[dartx.add](value);
+  }
+  [_checkMutable]() {
+    if (!dart.test(this[_mutable])) dart.throw(new io.HttpException("HTTP headers are not mutable"));
+  }
+  [_updateHostHeader]() {
+    let defaultPort = this[_port] == null || this[_port] == this[_defaultPortForScheme];
+    this[_set]("host", defaultPort ? this.host : dart.str`${this.host}:${this[_port]}`);
+  }
+  [_foldHeader](name) {
+    if (name == io.HttpHeaders.SET_COOKIE || this[_noFoldingHeaders] != null && this[_noFoldingHeaders][dartx.indexOf](name) != -1) {
+      return false;
+    }
+    return true;
+  }
+  [_finalize]() {
+    this[_mutable] = false;
+  }
+  [_write](buffer, offset) {
+    function write(bytes) {
+      let len = bytes[dartx.length];
+      for (let i = 0; i < dart.notNull(len); i++) {
+        buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+      }
+      offset = dart.notNull(offset) + dart.notNull(len);
+    }
+    dart.fn(write, ListOfintTovoid());
+    for (let name of this[_headers][dartx.keys]) {
+      let values = this[_headers][dartx._get](name);
+      let fold = core.bool._check(this[_foldHeader](name));
+      let nameData = name[dartx.codeUnits];
+      write(nameData);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.COLON);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
+        if (i > 0) {
+          if (dart.test(fold)) {
+            buffer[dartx._set]((() => {
+              let x = offset;
+              offset = dart.notNull(x) + 1;
+              return x;
+            })(), io._CharCode.COMMA);
+            buffer[dartx._set]((() => {
+              let x = offset;
+              offset = dart.notNull(x) + 1;
+              return x;
+            })(), io._CharCode.SP);
+          } else {
+            buffer[dartx._set]((() => {
+              let x = offset;
+              offset = dart.notNull(x) + 1;
+              return x;
+            })(), io._CharCode.CR);
+            buffer[dartx._set]((() => {
+              let x = offset;
+              offset = dart.notNull(x) + 1;
+              return x;
+            })(), io._CharCode.LF);
+            write(nameData);
+            buffer[dartx._set]((() => {
+              let x = offset;
+              offset = dart.notNull(x) + 1;
+              return x;
+            })(), io._CharCode.COLON);
+            buffer[dartx._set]((() => {
+              let x = offset;
+              offset = dart.notNull(x) + 1;
+              return x;
+            })(), io._CharCode.SP);
+          }
+        }
+        write(values[dartx._get](i)[dartx.codeUnits]);
+      }
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+    }
+    return offset;
+  }
+  toString() {
+    let sb = new core.StringBuffer();
+    this[_headers][dartx.forEach](dart.fn((name, values) => {
+      sb.write(name);
+      sb.write(": ");
+      let fold = core.bool._check(this[_foldHeader](name));
+      for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
+        if (i > 0) {
+          if (dart.test(fold)) {
+            sb.write(", ");
+          } else {
+            sb.write("\n");
+            sb.write(name);
+            sb.write(": ");
+          }
+        }
+        sb.write(values[dartx._get](i));
+      }
+      sb.write("\n");
+    }, StringAndListOfStringToNull()));
+    return sb.toString();
+  }
+  [_parseCookies]() {
+    let cookies = ListOfCookie().new();
+    function parseCookieString(s) {
+      let index = 0;
+      function done() {
+        return index == -1 || index == s[dartx.length];
+      }
+      dart.fn(done, VoidTobool());
+      function skipWS() {
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) != " " && s[dartx._get](index) != "\t") return;
+          index = dart.notNull(index) + 1;
+        }
+      }
+      dart.fn(skipWS, VoidTovoid());
+      function parseName() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == "=") break;
+          index = dart.notNull(index) + 1;
+        }
+        return s[dartx.substring](start, index);
+      }
+      dart.fn(parseName, VoidToString());
+      function parseValue() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == ";") break;
+          index = dart.notNull(index) + 1;
+        }
+        return s[dartx.substring](start, index);
+      }
+      dart.fn(parseValue, VoidToString());
+      function expect(expected) {
+        if (dart.test(done())) return false;
+        if (s[dartx._get](index) != expected) return false;
+        index = dart.notNull(index) + 1;
+        return true;
+      }
+      dart.fn(expect, StringTobool());
+      while (!dart.test(done())) {
+        skipWS();
+        if (dart.test(done())) return;
+        let name = parseName();
+        skipWS();
+        if (!dart.test(expect("="))) {
+          index = s[dartx.indexOf](';', index);
+          continue;
+        }
+        skipWS();
+        let value = parseValue();
+        try {
+          cookies[dartx.add](new io._Cookie(name, value));
+        } catch (_) {
+        }
+
+        skipWS();
+        if (dart.test(done())) return;
+        if (!dart.test(expect(";"))) {
+          index = s[dartx.indexOf](';', index);
+          continue;
+        }
+      }
+    }
+    dart.fn(parseCookieString, StringTovoid());
+    let values = this[_headers][dartx._get](io.HttpHeaders.COOKIE);
+    if (values != null) {
+      values[dartx.forEach](dart.fn(headerValue => parseCookieString(headerValue), StringTovoid()));
+    }
+    return cookies;
+  }
+  static _validateField(field) {
+    for (let i = 0; i < dart.notNull(field[dartx.length]); i++) {
+      if (!dart.test(io._HttpParser._isTokenChar(field[dartx.codeUnitAt](i)))) {
+        dart.throw(new core.FormatException(dart.str`Invalid HTTP header field name: ${convert.JSON.encode(field)}`));
+      }
+    }
+    return field[dartx.toLowerCase]();
+  }
+  static _validateValue(value) {
+    if (!(typeof value == 'string')) return value;
+    for (let i = 0; i < dart.notNull(core.num._check(dart.dload(value, 'length'))); i++) {
+      if (!dart.test(io._HttpParser._isValueChar(core.int._check(dart.dsend(value, 'codeUnitAt', i))))) {
+        dart.throw(new core.FormatException(dart.str`Invalid HTTP header field value: ${convert.JSON.encode(value)}`));
+      }
+    }
+    return value;
+  }
+};
+io._HttpHeaders[dart.implements] = () => [io.HttpHeaders];
+dart.setSignature(io._HttpHeaders, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpHeaders, [core.String], {defaultPortForScheme: core.int, initialHeaders: io._HttpHeaders})}),
+  fields: () => ({
+    [_headers]: MapOfString$ListOfString(),
+    protocolVersion: core.String,
+    [_mutable]: core.bool,
+    [_noFoldingHeaders]: ListOfString(),
+    [_contentLength]: core.int,
+    [_persistentConnection]: core.bool,
+    [_chunkedTransferEncoding]: core.bool,
+    [_host]: core.String,
+    [_port]: core.int,
+    [_defaultPortForScheme]: core.int
+  }),
+  getters: () => ({
+    persistentConnection: dart.definiteFunctionType(core.bool, []),
+    contentLength: dart.definiteFunctionType(core.int, []),
+    chunkedTransferEncoding: dart.definiteFunctionType(core.bool, []),
+    host: dart.definiteFunctionType(core.String, []),
+    port: dart.definiteFunctionType(core.int, []),
+    ifModifiedSince: dart.definiteFunctionType(core.DateTime, []),
+    date: dart.definiteFunctionType(core.DateTime, []),
+    expires: dart.definiteFunctionType(core.DateTime, []),
+    contentType: dart.definiteFunctionType(io.ContentType, [])
+  }),
+  setters: () => ({
+    persistentConnection: dart.definiteFunctionType(dart.void, [core.bool]),
+    contentLength: dart.definiteFunctionType(dart.void, [core.int]),
+    chunkedTransferEncoding: dart.definiteFunctionType(dart.void, [core.bool]),
+    host: dart.definiteFunctionType(dart.void, [core.String]),
+    port: dart.definiteFunctionType(dart.void, [core.int]),
+    ifModifiedSince: dart.definiteFunctionType(dart.void, [core.DateTime]),
+    date: dart.definiteFunctionType(dart.void, [core.DateTime]),
+    expires: dart.definiteFunctionType(dart.void, [core.DateTime]),
+    contentType: dart.definiteFunctionType(dart.void, [io.ContentType])
+  }),
+  methods: () => ({
+    _get: dart.definiteFunctionType(core.List$(core.String), [core.String]),
+    value: dart.definiteFunctionType(core.String, [core.String]),
+    add: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+    [_addAll]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    set: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+    remove: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+    removeAll: dart.definiteFunctionType(dart.void, [core.String]),
+    forEach: dart.definiteFunctionType(dart.void, [StringAndListOfStringTovoid()]),
+    noFolding: dart.definiteFunctionType(dart.void, [core.String]),
+    clear: dart.definiteFunctionType(dart.void, []),
+    [_add]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    [_addContentLength]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    [_addTransferEncoding]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    [_addDate]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    [_addExpires]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    [_addIfModifiedSince]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    [_addHost]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    [_addConnection]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    [_addContentType]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+    [_addValue]: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+    [_set]: dart.definiteFunctionType(dart.void, [core.String, core.String]),
+    [_checkMutable]: dart.definiteFunctionType(dart.dynamic, []),
+    [_updateHostHeader]: dart.definiteFunctionType(dart.dynamic, []),
+    [_foldHeader]: dart.definiteFunctionType(dart.dynamic, [core.String]),
+    [_finalize]: dart.definiteFunctionType(dart.void, []),
+    [_write]: dart.definiteFunctionType(core.int, [typed_data.Uint8List, core.int]),
+    [_parseCookies]: dart.definiteFunctionType(core.List$(io.Cookie), [])
+  }),
+  statics: () => ({
+    _validateField: dart.definiteFunctionType(core.String, [core.String]),
+    _validateValue: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
+  }),
+  names: ['_validateField', '_validateValue']
+});
+const _value = Symbol('_value');
+const _parameters = Symbol('_parameters');
+const _unmodifiableParameters = Symbol('_unmodifiableParameters');
+const _parse = Symbol('_parse');
+const _ensureParameters = Symbol('_ensureParameters');
+io._HeaderValue = class _HeaderValue extends core.Object {
+  new(value, parameters) {
+    if (value === void 0) value = "";
+    if (parameters === void 0) parameters = null;
+    this[_value] = value;
+    this[_parameters] = null;
+    this[_unmodifiableParameters] = null;
+    if (parameters != null) {
+      this[_parameters] = HashMapOfString$String().from(parameters);
+    }
+  }
+  static parse(value, opts) {
+    let parameterSeparator = opts && 'parameterSeparator' in opts ? opts.parameterSeparator : ";";
+    let valueSeparator = opts && 'valueSeparator' in opts ? opts.valueSeparator : null;
+    let preserveBackslash = opts && 'preserveBackslash' in opts ? opts.preserveBackslash : false;
+    let result = new io._HeaderValue();
+    result[_parse](value, core.String._check(parameterSeparator), core.String._check(valueSeparator), core.bool._check(preserveBackslash));
+    return result;
+  }
+  get value() {
+    return this[_value];
+  }
+  [_ensureParameters]() {
+    if (this[_parameters] == null) {
+      this[_parameters] = HashMapOfString$String().new();
+    }
+  }
+  get parameters() {
+    this[_ensureParameters]();
+    if (this[_unmodifiableParameters] == null) {
+      this[_unmodifiableParameters] = new (UnmodifiableMapViewOfString$String())(this[_parameters]);
+    }
+    return this[_unmodifiableParameters];
+  }
+  toString() {
+    let sb = new core.StringBuffer();
+    sb.write(this[_value]);
+    if (this.parameters != null && dart.notNull(this.parameters[dartx.length]) > 0) {
+      this[_parameters][dartx.forEach](dart.fn((name, value) => {
+        sb.write("; ");
+        sb.write(name);
+        sb.write("=");
+        sb.write(value);
+      }, StringAndStringToNull()));
+    }
+    return sb.toString();
+  }
+  [_parse](s, parameterSeparator, valueSeparator, preserveBackslash) {
+    let index = 0;
+    function done() {
+      return index == s[dartx.length];
+    }
+    dart.fn(done, VoidTobool());
+    function skipWS() {
+      while (!dart.test(done())) {
+        if (s[dartx._get](index) != " " && s[dartx._get](index) != "\t") return;
+        index++;
+      }
+    }
+    dart.fn(skipWS, VoidTovoid());
+    function parseValue() {
+      let start = index;
+      while (!dart.test(done())) {
+        if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == valueSeparator || s[dartx._get](index) == parameterSeparator) break;
+        index++;
+      }
+      return s[dartx.substring](start, index);
+    }
+    dart.fn(parseValue, VoidToString());
+    function expect(expected) {
+      if (dart.test(done()) || s[dartx._get](index) != expected) {
+        dart.throw(new io.HttpException("Failed to parse header value"));
+      }
+      index++;
+    }
+    dart.fn(expect, StringTovoid());
+    function maybeExpect(expected) {
+      if (s[dartx._get](index) == expected) index++;
+    }
+    dart.fn(maybeExpect, StringTovoid());
+    const parseParameters = (function() {
+      let parameters = HashMapOfString$String().new();
+      this[_parameters] = new (UnmodifiableMapViewOfString$String())(parameters);
+      function parseParameterName() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == "=" || s[dartx._get](index) == parameterSeparator || s[dartx._get](index) == valueSeparator) break;
+          index++;
+        }
+        return s[dartx.substring](start, index)[dartx.toLowerCase]();
+      }
+      dart.fn(parseParameterName, VoidToString());
+      function parseParameterValue() {
+        if (!dart.test(done()) && s[dartx._get](index) == "\"") {
+          let sb = new core.StringBuffer();
+          index++;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == "\\") {
+              if (index + 1 == s[dartx.length]) {
+                dart.throw(new io.HttpException("Failed to parse header value"));
+              }
+              if (dart.test(preserveBackslash) && s[dartx._get](index + 1) != "\"") {
+                sb.write(s[dartx._get](index));
+              }
+              index++;
+            } else if (s[dartx._get](index) == "\"") {
+              index++;
+              break;
+            }
+            sb.write(s[dartx._get](index));
+            index++;
+          }
+          return sb.toString();
+        } else {
+          let val = parseValue();
+          return val == "" ? null : val;
+        }
+      }
+      dart.fn(parseParameterValue, VoidToString());
+      while (!dart.test(done())) {
+        skipWS();
+        if (dart.test(done())) return;
+        let name = parseParameterName();
+        skipWS();
+        if (dart.test(done())) {
+          parameters._set(name, null);
+          return;
+        }
+        maybeExpect("=");
+        skipWS();
+        if (dart.test(done())) {
+          parameters._set(name, null);
+          return;
+        }
+        let value = parseParameterValue();
+        if (name == 'charset' && io._ContentType.is(this)) {
+          value = value[dartx.toLowerCase]();
+        }
+        parameters._set(name, value);
+        skipWS();
+        if (dart.test(done())) return;
+        if (s[dartx._get](index) == valueSeparator) return;
+        expect(parameterSeparator);
+      }
+    }).bind(this);
+    dart.fn(parseParameters, VoidTovoid());
+    skipWS();
+    this[_value] = parseValue();
+    skipWS();
+    if (dart.test(done())) return;
+    maybeExpect(parameterSeparator);
+    parseParameters();
+  }
+};
+io._HeaderValue[dart.implements] = () => [io.HeaderValue];
+dart.setSignature(io._HeaderValue, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HeaderValue, [], [core.String, MapOfString$String()])}),
+  fields: () => ({
+    [_value]: core.String,
+    [_parameters]: MapOfString$String(),
+    [_unmodifiableParameters]: MapOfString$String()
+  }),
+  getters: () => ({
+    value: dart.definiteFunctionType(core.String, []),
+    parameters: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+  }),
+  methods: () => ({
+    [_ensureParameters]: dart.definiteFunctionType(dart.void, []),
+    [_parse]: dart.definiteFunctionType(dart.void, [core.String, core.String, core.String, core.bool])
+  }),
+  statics: () => ({parse: dart.definiteFunctionType(io._HeaderValue, [core.String], {parameterSeparator: dart.dynamic, valueSeparator: dart.dynamic, preserveBackslash: dart.dynamic})}),
+  names: ['parse']
+});
+const _primaryType = Symbol('_primaryType');
+const _subType = Symbol('_subType');
+io._ContentType = class _ContentType extends io._HeaderValue {
+  new(primaryType, subType, charset, parameters) {
+    this[_primaryType] = primaryType;
+    this[_subType] = subType;
+    super.new("");
+    if (this[_primaryType] == null) this[_primaryType] = "";
+    if (this[_subType] == null) this[_subType] = "";
+    this[_value] = dart.str`${this[_primaryType]}/${this[_subType]}`;
+    if (parameters != null) {
+      this[_ensureParameters]();
+      parameters[dartx.forEach](dart.fn((key, value) => {
+        let lowerCaseKey = key[dartx.toLowerCase]();
+        if (lowerCaseKey == "charset") {
+          value = value[dartx.toLowerCase]();
+        }
+        this[_parameters][dartx._set](lowerCaseKey, value);
+      }, StringAndStringToNull()));
+    }
+    if (charset != null) {
+      this[_ensureParameters]();
+      this[_parameters][dartx._set]("charset", charset[dartx.toLowerCase]());
+    }
+  }
+  _() {
+    this[_primaryType] = "";
+    this[_subType] = "";
+    super.new();
+  }
+  static parse(value) {
+    let result = new io._ContentType._();
+    result[_parse](value, ";", null, false);
+    let index = result[_value][dartx.indexOf]("/");
+    if (index == -1 || index == dart.notNull(result[_value][dartx.length]) - 1) {
+      result[_primaryType] = result[_value][dartx.trim]()[dartx.toLowerCase]();
+      result[_subType] = "";
+    } else {
+      result[_primaryType] = result[_value][dartx.substring](0, index)[dartx.trim]()[dartx.toLowerCase]();
+      result[_subType] = result[_value][dartx.substring](dart.notNull(index) + 1)[dartx.trim]()[dartx.toLowerCase]();
+    }
+    return result;
+  }
+  get mimeType() {
+    return dart.str`${this.primaryType}/${this.subType}`;
+  }
+  get primaryType() {
+    return this[_primaryType];
+  }
+  get subType() {
+    return this[_subType];
+  }
+  get charset() {
+    return this.parameters[dartx._get]("charset");
+  }
+};
+dart.defineNamedConstructor(io._ContentType, '_');
+io._ContentType[dart.implements] = () => [io.ContentType];
+dart.setSignature(io._ContentType, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io._ContentType, [core.String, core.String, core.String, MapOfString$String()]),
+    _: dart.definiteFunctionType(io._ContentType, [])
+  }),
+  fields: () => ({
+    [_primaryType]: core.String,
+    [_subType]: core.String
+  }),
+  getters: () => ({
+    mimeType: dart.definiteFunctionType(core.String, []),
+    primaryType: dart.definiteFunctionType(core.String, []),
+    subType: dart.definiteFunctionType(core.String, []),
+    charset: dart.definiteFunctionType(core.String, [])
+  }),
+  statics: () => ({parse: dart.definiteFunctionType(io._ContentType, [core.String])}),
+  names: ['parse']
+});
+const _validate = Symbol('_validate');
+const _parseSetCookieValue = Symbol('_parseSetCookieValue');
+let const;
+io._Cookie = class _Cookie extends core.Object {
+  new(name, value) {
+    if (name === void 0) name = null;
+    if (value === void 0) value = null;
+    this.name = name;
+    this.value = value;
+    this.expires = null;
+    this.maxAge = null;
+    this.domain = null;
+    this.path = null;
+    this.httpOnly = false;
+    this.secure = false;
+    this.httpOnly = true;
+    this[_validate]();
+  }
+  fromSetCookieValue(value) {
+    this.name = null;
+    this.value = null;
+    this.expires = null;
+    this.maxAge = null;
+    this.domain = null;
+    this.path = null;
+    this.httpOnly = false;
+    this.secure = false;
+    this[_parseSetCookieValue](value);
+  }
+  [_parseSetCookieValue](s) {
+    let index = 0;
+    function done() {
+      return index == s[dartx.length];
+    }
+    dart.fn(done, VoidTobool());
+    function parseName() {
+      let start = index;
+      while (!dart.test(done())) {
+        if (s[dartx._get](index) == "=") break;
+        index++;
+      }
+      return s[dartx.substring](start, index)[dartx.trim]();
+    }
+    dart.fn(parseName, VoidToString());
+    function parseValue() {
+      let start = index;
+      while (!dart.test(done())) {
+        if (s[dartx._get](index) == ";") break;
+        index++;
+      }
+      return s[dartx.substring](start, index)[dartx.trim]();
+    }
+    dart.fn(parseValue, VoidToString());
+    function expect(expected) {
+      if (dart.test(done())) dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+      if (s[dartx._get](index) != expected) {
+        dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+      }
+      index++;
+    }
+    dart.fn(expect, StringTovoid());
+    const parseAttributes = (function() {
+      function parseAttributeName() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == "=" || s[dartx._get](index) == ";") break;
+          index++;
+        }
+        return s[dartx.substring](start, index)[dartx.trim]()[dartx.toLowerCase]();
+      }
+      dart.fn(parseAttributeName, VoidToString());
+      function parseAttributeValue() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == ";") break;
+          index++;
+        }
+        return s[dartx.substring](start, index)[dartx.trim]()[dartx.toLowerCase]();
+      }
+      dart.fn(parseAttributeValue, VoidToString());
+      while (!dart.test(done())) {
+        let name = parseAttributeName();
+        let value = "";
+        if (!dart.test(done()) && s[dartx._get](index) == "=") {
+          index++;
+          value = parseAttributeValue();
+        }
+        if (name == "expires") {
+          this.expires = io.HttpDate._parseCookieDate(value);
+        } else if (name == "max-age") {
+          this.maxAge = core.int.parse(value);
+        } else if (name == "domain") {
+          this.domain = value;
+        } else if (name == "path") {
+          this.path = value;
+        } else if (name == "httponly") {
+          this.httpOnly = true;
+        } else if (name == "secure") {
+          this.secure = true;
+        }
+        if (!dart.test(done())) index++;
+      }
+    }).bind(this);
+    dart.fn(parseAttributes, VoidTovoid());
+    this.name = parseName();
+    if (dart.test(done()) || this.name[dartx.length] == 0) {
+      dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+    }
+    index++;
+    this.value = parseValue();
+    this[_validate]();
+    if (dart.test(done())) return;
+    index++;
+    parseAttributes();
+  }
+  toString() {
+    let sb = new core.StringBuffer();
+    sb.write(this.name);
+    sb.write("=");
+    sb.write(this.value);
+    if (this.expires != null) {
+      sb.write("; Expires=");
+      sb.write(io.HttpDate.format(this.expires));
+    }
+    if (this.maxAge != null) {
+      sb.write("; Max-Age=");
+      sb.write(this.maxAge);
+    }
+    if (this.domain != null) {
+      sb.write("; Domain=");
+      sb.write(this.domain);
+    }
+    if (this.path != null) {
+      sb.write("; Path=");
+      sb.write(this.path);
+    }
+    if (dart.test(this.secure)) sb.write("; Secure");
+    if (dart.test(this.httpOnly)) sb.write("; HttpOnly");
+    return sb.toString();
+  }
+  [_validate]() {
+    let SEPERATORS = const || (const = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
+    for (let i = 0; i < dart.notNull(this.name[dartx.length]); i++) {
+      let codeUnit = this.name[dartx.codeUnits][dartx._get](i);
+      if (dart.notNull(codeUnit) <= 32 || dart.notNull(codeUnit) >= 127 || dart.notNull(SEPERATORS[dartx.indexOf](this.name[dartx._get](i))) >= 0) {
+        dart.throw(new core.FormatException(dart.str`Invalid character in cookie name, code unit: '${codeUnit}'`));
+      }
+    }
+    for (let i = 0; i < dart.notNull(this.value[dartx.length]); i++) {
+      let codeUnit = this.value[dartx.codeUnits][dartx._get](i);
+      if (!(codeUnit == 33 || dart.notNull(codeUnit) >= 35 && dart.notNull(codeUnit) <= 43 || dart.notNull(codeUnit) >= 45 && dart.notNull(codeUnit) <= 58 || dart.notNull(codeUnit) >= 60 && dart.notNull(codeUnit) <= 91 || dart.notNull(codeUnit) >= 93 && dart.notNull(codeUnit) <= 126)) {
+        dart.throw(new core.FormatException(dart.str`Invalid character in cookie value, code unit: '${codeUnit}'`));
+      }
+    }
+  }
+};
+dart.defineNamedConstructor(io._Cookie, 'fromSetCookieValue');
+io._Cookie[dart.implements] = () => [io.Cookie];
+dart.setSignature(io._Cookie, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io._Cookie, [], [core.String, core.String]),
+    fromSetCookieValue: dart.definiteFunctionType(io._Cookie, [core.String])
+  }),
+  fields: () => ({
+    name: core.String,
+    value: core.String,
+    expires: core.DateTime,
+    maxAge: core.int,
+    domain: core.String,
+    path: core.String,
+    httpOnly: core.bool,
+    secure: core.bool
+  }),
+  methods: () => ({
+    [_parseSetCookieValue]: dart.definiteFunctionType(dart.void, [core.String]),
+    [_validate]: dart.definiteFunctionType(dart.void, [])
+  })
+});
+io._OUTGOING_BUFFER_SIZE = 8 * 1024;
+const _transferLength = Symbol('_transferLength');
+const _dataCompleter = Symbol('_dataCompleter');
+const _stream = Symbol('_stream');
+io._HttpIncoming = class _HttpIncoming extends async.Stream$(core.List$(core.int)) {
+  get transferLength() {
+    return this[_transferLength];
+  }
+  new(headers, transferLength, stream) {
+    this[_dataCompleter] = async.Completer.new();
+    this.headers = headers;
+    this[_transferLength] = transferLength;
+    this[_stream] = stream;
+    this.fullBodyRead = false;
+    this.upgraded = false;
+    this.statusCode = null;
+    this.reasonPhrase = null;
+    this.method = null;
+    this.uri = null;
+    this.hasSubscriber = false;
+    super.new();
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    this.hasSubscriber = true;
+    return this[_stream].handleError(dart.fn(error => {
+      dart.throw(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this.uri}));
+    }, dynamicToNull())).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  get dataDone() {
+    return this[_dataCompleter].future;
+  }
+  close(closing) {
+    this.fullBodyRead = true;
+    this.hasSubscriber = true;
+    this[_dataCompleter].complete(closing);
+  }
+};
+dart.addSimpleTypeTests(io._HttpIncoming);
+dart.setSignature(io._HttpIncoming, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpIncoming, [io._HttpHeaders, core.int, StreamOfListOfint()])}),
+  fields: () => ({
+    [_transferLength]: core.int,
+    [_dataCompleter]: async.Completer,
+    [_stream]: StreamOfListOfint(),
+    fullBodyRead: core.bool,
+    headers: io._HttpHeaders,
+    upgraded: core.bool,
+    statusCode: core.int,
+    reasonPhrase: core.String,
+    method: core.String,
+    uri: core.Uri,
+    hasSubscriber: core.bool
+  }),
+  getters: () => ({
+    transferLength: dart.definiteFunctionType(core.int, []),
+    dataDone: dart.definiteFunctionType(async.Future, [])
+  }),
+  methods: () => ({
+    listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    close: dart.definiteFunctionType(dart.void, [core.bool])
+  })
+});
+const _incoming = Symbol('_incoming');
+const _cookies = Symbol('_cookies');
+io._HttpInboundMessage = class _HttpInboundMessage extends async.Stream$(core.List$(core.int)) {
+  new(incoming) {
+    this[_incoming] = incoming;
+    this[_cookies] = null;
+    super.new();
+  }
+  get cookies() {
+    if (this[_cookies] != null) return this[_cookies];
+    return this[_cookies] = this.headers[_parseCookies]();
+  }
+  get headers() {
+    return this[_incoming].headers;
+  }
+  get protocolVersion() {
+    return this.headers.protocolVersion;
+  }
+  get contentLength() {
+    return this.headers.contentLength;
+  }
+  get persistentConnection() {
+    return this.headers.persistentConnection;
+  }
+};
+dart.addSimpleTypeTests(io._HttpInboundMessage);
+dart.setSignature(io._HttpInboundMessage, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpInboundMessage, [io._HttpIncoming])}),
+  fields: () => ({
+    [_incoming]: io._HttpIncoming,
+    [_cookies]: ListOfCookie()
+  }),
+  getters: () => ({
+    cookies: dart.definiteFunctionType(core.List$(io.Cookie), []),
+    headers: dart.definiteFunctionType(io._HttpHeaders, []),
+    protocolVersion: dart.definiteFunctionType(core.String, []),
+    contentLength: dart.definiteFunctionType(core.int, []),
+    persistentConnection: dart.definiteFunctionType(core.bool, [])
+  })
+});
+const _httpServer = Symbol('_httpServer');
+const _httpConnection = Symbol('_httpConnection');
+const _session = Symbol('_session');
+const _requestedUri = Symbol('_requestedUri');
+const _sessionManagerInstance = Symbol('_sessionManagerInstance');
+const _sessionManager = Symbol('_sessionManager');
+const _markSeen = Symbol('_markSeen');
+const _socket = Symbol('_socket');
+const _destroyed = Symbol('_destroyed');
+io._HttpRequest = class _HttpRequest extends io._HttpInboundMessage {
+  new(response, _incoming, httpServer, httpConnection) {
+    this.response = response;
+    this[_httpServer] = httpServer;
+    this[_httpConnection] = httpConnection;
+    this[_session] = null;
+    this[_requestedUri] = null;
+    super.new(_incoming);
+    if (this.headers.protocolVersion == "1.1") {
+      let _ = this.response.headers;
+      _.chunkedTransferEncoding = true;
+      _.persistentConnection = this.headers.persistentConnection;
+    }
+    if (this[_httpServer][_sessionManagerInstance] != null) {
+      let sessionIds = this.cookies[dartx.where](dart.fn(cookie => cookie.name[dartx.toUpperCase]() == io._DART_SESSION_ID, CookieTobool()))[dartx.map](core.String)(dart.fn(cookie => cookie.value, CookieToString()));
+      for (let sessionId of sessionIds) {
+        this[_session] = this[_httpServer][_sessionManager].getSession(sessionId);
+        if (this[_session] != null) {
+          this[_session][_markSeen]();
+          break;
+        }
+      }
+    }
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  get uri() {
+    return this[_incoming].uri;
+  }
+  get requestedUri() {
+    if (this[_requestedUri] == null) {
+      let proto = this.headers._get('x-forwarded-proto');
+      let scheme = proto != null ? proto[dartx.first] : io.SecureSocket.is(this[_httpConnection][_socket]) ? "https" : "http";
+      let hostList = this.headers._get('x-forwarded-host');
+      let host = null;
+      if (hostList != null) {
+        host = hostList[dartx.first];
+      } else {
+        hostList = this.headers._get('host');
+        if (hostList != null) {
+          host = hostList[dartx.first];
+        } else {
+          host = dart.str`${this[_httpServer].address.host}:${this[_httpServer].port}`;
+        }
+      }
+      this[_requestedUri] = core.Uri.parse(dart.str`${scheme}://${host}${this.uri}`);
+    }
+    return this[_requestedUri];
+  }
+  get method() {
+    return this[_incoming].method;
+  }
+  get session() {
+    if (this[_session] != null) {
+      if (dart.test(this[_session][_destroyed])) {
+        this[_session] = null;
+        return this.session;
+      }
+      return this[_session];
+    }
+    return this[_session] = this[_httpServer][_sessionManager].createSession();
+  }
+  get connectionInfo() {
+    return this[_httpConnection].connectionInfo;
+  }
+  get certificate() {
+    let socket = this[_httpConnection][_socket];
+    if (io.SecureSocket.is(socket)) return socket.peerCertificate;
+    return null;
+  }
+};
+io._HttpRequest[dart.implements] = () => [io.HttpRequest];
+dart.setSignature(io._HttpRequest, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpRequest, [io.HttpResponse, io._HttpIncoming, io._HttpServer, io._HttpConnection])}),
+  fields: () => ({
+    response: io.HttpResponse,
+    [_httpServer]: io._HttpServer,
+    [_httpConnection]: io._HttpConnection,
+    [_session]: io._HttpSession,
+    [_requestedUri]: core.Uri
+  }),
+  getters: () => ({
+    uri: dart.definiteFunctionType(core.Uri, []),
+    requestedUri: dart.definiteFunctionType(core.Uri, []),
+    method: dart.definiteFunctionType(core.String, []),
+    session: dart.definiteFunctionType(io.HttpSession, []),
+    connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+    certificate: dart.definiteFunctionType(io.X509Certificate, [])
+  }),
+  methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+});
+const _responseRedirects = Symbol('_responseRedirects');
+const _httpRequest = Symbol('_httpRequest');
+const _httpClient = Symbol('_httpClient');
+const _httpClientConnection = Symbol('_httpClientConnection');
+const _openUrlFromRequest = Symbol('_openUrlFromRequest');
+const _connectionClosed = Symbol('_connectionClosed');
+const _shouldAuthenticateProxy = Symbol('_shouldAuthenticateProxy');
+const _shouldAuthenticate = Symbol('_shouldAuthenticate');
+const _proxy = Symbol('_proxy');
+const _findProxyCredentials = Symbol('_findProxyCredentials');
+const _findCredentials = Symbol('_findCredentials');
+const _removeProxyCredentials = Symbol('_removeProxyCredentials');
+const _removeCredentials = Symbol('_removeCredentials');
+const _authenticateProxy = Symbol('_authenticateProxy');
+const _authenticate = Symbol('_authenticate');
+io._HttpClientResponse = class _HttpClientResponse extends io._HttpInboundMessage {
+  get redirects() {
+    return this[_httpRequest][_responseRedirects];
+  }
+  new(_incoming, httpRequest, httpClient) {
+    this[_httpRequest] = httpRequest;
+    this[_httpClient] = httpClient;
+    super.new(_incoming);
+    _incoming.uri = this[_httpRequest].uri;
+  }
+  get statusCode() {
+    return this[_incoming].statusCode;
+  }
+  get reasonPhrase() {
+    return this[_incoming].reasonPhrase;
+  }
+  get certificate() {
+    let socket = this[_httpRequest][_httpClientConnection][_socket];
+    if (io.SecureSocket.is(socket)) return socket.peerCertificate;
+    dart.throw(new core.UnsupportedError("Socket is not a SecureSocket"));
+  }
+  get cookies() {
+    if (this[_cookies] != null) return this[_cookies];
+    this[_cookies] = ListOfCookie().new();
+    let values = this.headers._get(io.HttpHeaders.SET_COOKIE);
+    if (values != null) {
+      values[dartx.forEach](dart.fn(value => {
+        this[_cookies][dartx.add](io.Cookie.fromSetCookieValue(value));
+      }, StringToNull()));
+    }
+    return this[_cookies];
+  }
+  get isRedirect() {
+    if (this[_httpRequest].method == "GET" || this[_httpRequest].method == "HEAD") {
+      return this.statusCode == io.HttpStatus.MOVED_PERMANENTLY || this.statusCode == io.HttpStatus.FOUND || this.statusCode == io.HttpStatus.SEE_OTHER || this.statusCode == io.HttpStatus.TEMPORARY_REDIRECT;
+    } else if (this[_httpRequest].method == "POST") {
+      return this.statusCode == io.HttpStatus.SEE_OTHER;
+    }
+    return false;
+  }
+  redirect(method, url, followLoops) {
+    if (method === void 0) method = null;
+    if (url === void 0) url = null;
+    if (followLoops === void 0) followLoops = null;
+    if (method == null) {
+      if (this.statusCode == io.HttpStatus.SEE_OTHER && this[_httpRequest].method == "POST") {
+        method = "GET";
+      } else {
+        method = this[_httpRequest].method;
+      }
+    }
+    if (url == null) {
+      let location = this.headers.value(io.HttpHeaders.LOCATION);
+      if (location == null) {
+        dart.throw(new core.StateError("Response has no Location header for redirect"));
+      }
+      url = core.Uri.parse(location);
+    }
+    if (followLoops != true) {
+      for (let redirect of this.redirects) {
+        if (dart.equals(redirect.location, url)) {
+          return FutureOfHttpClientResponse().error(new io.RedirectException("Redirect loop detected", this.redirects));
+        }
+      }
+    }
+    return this[_httpClient][_openUrlFromRequest](method, url, this[_httpRequest]).then(io.HttpClientResponse)(dart.fn(request => {
+      let _ = request[_responseRedirects];
+      _[dartx.addAll](this.redirects);
+      _[dartx.add](new io._RedirectInfo(this.statusCode, method, url));
+      return request.close();
+    }, _HttpClientRequestToFutureOfHttpClientResponse()));
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    if (dart.test(this[_incoming].upgraded)) {
+      this[_httpRequest][_httpClientConnection].destroy();
+      return StreamSubscriptionOfListOfint()._check(async.Stream.fromIterable([]).listen(null, {onDone: onDone}));
+    }
+    let stream = this[_incoming];
+    if (dart.test(this[_httpClient].autoUncompress) && this.headers.value(io.HttpHeaders.CONTENT_ENCODING) == "gzip") {
+      stream = io._HttpIncoming._check(stream.transform(ListOfint())(io.GZIP.decoder));
+    }
+    return stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  detachSocket() {
+    this[_httpClient][_connectionClosed](this[_httpRequest][_httpClientConnection]);
+    return this[_httpRequest][_httpClientConnection].detachSocket();
+  }
+  get connectionInfo() {
+    return this[_httpRequest].connectionInfo;
+  }
+  get [_shouldAuthenticateProxy]() {
+    let challenge = this.headers._get(io.HttpHeaders.PROXY_AUTHENTICATE);
+    return this.statusCode == io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED && challenge != null && challenge[dartx.length] == 1;
+  }
+  get [_shouldAuthenticate]() {
+    let challenge = this.headers._get(io.HttpHeaders.WWW_AUTHENTICATE);
+    return this.statusCode == io.HttpStatus.UNAUTHORIZED && challenge != null && challenge[dartx.length] == 1;
+  }
+  [_authenticate](proxyAuth) {
+    const retry = (function() {
+      return this.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => this[_httpClient][_openUrlFromRequest](this[_httpRequest].method, this[_httpRequest].uri, this[_httpRequest]).then(io.HttpClientResponse)(dart.fn(request => request.close(), _HttpClientRequestToFutureOfHttpClientResponse())), dynamicToFutureOfHttpClientResponse()));
+    }).bind(this);
+    dart.fn(retry, VoidToFutureOfHttpClientResponse());
+    const authChallenge = (function() {
+      return dart.test(proxyAuth) ? this.headers._get(io.HttpHeaders.PROXY_AUTHENTICATE) : this.headers._get(io.HttpHeaders.WWW_AUTHENTICATE);
+    }).bind(this);
+    dart.fn(authChallenge, VoidToListOfString());
+    const findCredentials = (function(scheme) {
+      return dart.test(proxyAuth) ? this[_httpClient][_findProxyCredentials](this[_httpRequest][_proxy], scheme) : this[_httpClient][_findCredentials](this[_httpRequest].uri, scheme);
+    }).bind(this);
+    dart.fn(findCredentials, _AuthenticationSchemeTo_Credentials());
+    const removeCredentials = (function(cr) {
+      if (dart.test(proxyAuth)) {
+        this[_httpClient][_removeProxyCredentials](cr);
+      } else {
+        this[_httpClient][_removeCredentials](cr);
+      }
+    }).bind(this);
+    dart.fn(removeCredentials, _CredentialsTovoid());
+    const requestAuthentication = (function(scheme, realm) {
+      if (dart.test(proxyAuth)) {
+        if (this[_httpClient][_authenticateProxy] == null) {
+          return async.Future.value(false);
+        }
+        let proxy = this[_httpRequest][_proxy];
+        return async.Future._check(dart.dsend(this[_httpClient], _authenticateProxy, proxy.host, proxy.port, dart.toString(scheme), realm));
+      } else {
+        if (this[_httpClient][_authenticate] == null) {
+          return async.Future.value(false);
+        }
+        return async.Future._check(dart.dsend(this[_httpClient], _authenticate, this[_httpRequest].uri, dart.toString(scheme), realm));
+      }
+    }).bind(this);
+    dart.fn(requestAuthentication, _AuthenticationSchemeAndStringToFuture());
+    let challenge = authChallenge();
+    dart.assert(challenge != null || challenge[dartx.length] == 1);
+    let header = io._HeaderValue.parse(challenge[dartx._get](0), {parameterSeparator: ","});
+    let scheme = io._AuthenticationScheme.fromString(header.value);
+    let realm = header.parameters[dartx._get]("realm");
+    let cr = findCredentials(scheme);
+    if (cr != null) {
+      if (dart.equals(cr.scheme, io._AuthenticationScheme.BASIC) && !dart.test(cr.used)) {
+        return retry();
+      }
+      if (dart.equals(cr.scheme, io._AuthenticationScheme.DIGEST) && (header.parameters[dartx._get]("algorithm") == null || header.parameters[dartx._get]("algorithm")[dartx.toLowerCase]() == "md5")) {
+        if (cr.nonce == null || cr.nonce == header.parameters[dartx._get]("nonce")) {
+          if (cr.nonce == null) {
+            let _ = cr;
+            _.nonce = header.parameters[dartx._get]("nonce");
+            _.algorithm = "MD5";
+            _.qop = header.parameters[dartx._get]("qop");
+            _.nonceCount = 0;
+          }
+          return retry();
+        } else if (header.parameters[dartx._get]("stale") != null && header.parameters[dartx._get]("stale")[dartx.toLowerCase]() == "true") {
+          cr.nonce = header.parameters[dartx._get]("nonce");
+          return retry();
+        }
+      }
+    }
+    if (cr != null) {
+      removeCredentials(cr);
+      cr = null;
+    }
+    return requestAuthentication(scheme, realm).then(io.HttpClientResponse)(dart.fn(credsAvailable => {
+      if (dart.test(credsAvailable)) {
+        cr = this[_httpClient][_findCredentials](this[_httpRequest].uri, scheme);
+        return retry();
+      } else {
+        return this;
+      }
+    }, dynamicToFutureOrOfHttpClientResponse()));
+  }
+};
+io._HttpClientResponse[dart.implements] = () => [io.HttpClientResponse];
+dart.setSignature(io._HttpClientResponse, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpClientResponse, [io._HttpIncoming, io._HttpClientRequest, io._HttpClient])}),
+  fields: () => ({
+    [_httpClient]: io._HttpClient,
+    [_httpRequest]: io._HttpClientRequest
+  }),
+  getters: () => ({
+    redirects: dart.definiteFunctionType(core.List$(io.RedirectInfo), []),
+    statusCode: dart.definiteFunctionType(core.int, []),
+    reasonPhrase: dart.definiteFunctionType(core.String, []),
+    certificate: dart.definiteFunctionType(io.X509Certificate, []),
+    isRedirect: dart.definiteFunctionType(core.bool, []),
+    connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+    [_shouldAuthenticateProxy]: dart.definiteFunctionType(core.bool, []),
+    [_shouldAuthenticate]: dart.definiteFunctionType(core.bool, [])
+  }),
+  methods: () => ({
+    redirect: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [], [core.String, core.Uri, core.bool]),
+    listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+    [_authenticate]: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [core.bool])
+  })
+});
+const _uri = Symbol('_uri');
+const _outgoing = Symbol('_outgoing');
+const _encodingSet = Symbol('_encodingSet');
+const _bufferOutput = Symbol('_bufferOutput');
+const _encodingMutable = Symbol('_encodingMutable');
+const _encoding = Symbol('_encoding');
+const _isConnectionClosed = Symbol('_isConnectionClosed');
+const _doneCompleter = Symbol('_doneCompleter');
+const _target = Symbol('_target');
+const _controllerInstance = Symbol('_controllerInstance');
+const _controllerCompleter = Symbol('_controllerCompleter');
+const _isClosed = Symbol('_isClosed');
+const _isBound = Symbol('_isBound');
+const _hasError = Symbol('_hasError');
+const _closeTarget = Symbol('_closeTarget');
+const _completeDoneValue = Symbol('_completeDoneValue');
+const _completeDoneError = Symbol('_completeDoneError');
+io._StreamSinkImpl$ = dart.generic(T => {
+  let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
+  let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
+  let StreamSinkOfT = () => (StreamSinkOfT = dart.constFn(async.StreamSink$(T)))();
+  let StreamConsumerOfT = () => (StreamConsumerOfT = dart.constFn(async.StreamConsumer$(T)))();
+  class _StreamSinkImpl extends core.Object {
+    new(target) {
+      this[_doneCompleter] = async.Completer.new();
+      this[_target] = target;
+      this[_controllerInstance] = null;
+      this[_controllerCompleter] = null;
+      this[_isClosed] = false;
+      this[_isBound] = false;
+      this[_hasError] = false;
+    }
+    add(data) {
+      T._check(data);
+      if (dart.test(this[_isClosed])) return;
+      this[_controller].add(data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_controller].addError(error, stackTrace);
+    }
+    addStream(stream) {
+      StreamOfT()._check(stream);
+      if (dart.test(this[_isBound])) {
+        dart.throw(new core.StateError("StreamSink is already bound to a stream"));
+      }
+      this[_isBound] = true;
+      if (dart.test(this[_hasError])) return this.done;
+      const targetAddStream = (function() {
+        return this[_target].addStream(stream).whenComplete(dart.fn(() => {
+          this[_isBound] = false;
+        }, VoidToNull()));
+      }).bind(this);
+      dart.fn(targetAddStream, VoidToFuture());
+      if (this[_controllerInstance] == null) return targetAddStream();
+      let future = this[_controllerCompleter].future;
+      this[_controllerInstance].close();
+      return future.then(dart.dynamic)(dart.fn(_ => targetAddStream(), dynamicToFuture()));
+    }
+    flush() {
+      if (dart.test(this[_isBound])) {
+        dart.throw(new core.StateError("StreamSink is bound to a stream"));
+      }
+      if (this[_controllerInstance] == null) return async.Future.value(this);
+      this[_isBound] = true;
+      let future = this[_controllerCompleter].future;
+      this[_controllerInstance].close();
+      return future.whenComplete(dart.fn(() => {
+        this[_isBound] = false;
+      }, VoidToNull()));
+    }
+    close() {
+      if (dart.test(this[_isBound])) {
+        dart.throw(new core.StateError("StreamSink is bound to a stream"));
+      }
+      if (!dart.test(this[_isClosed])) {
+        this[_isClosed] = true;
+        if (this[_controllerInstance] != null) {
+          this[_controllerInstance].close();
+        } else {
+          this[_closeTarget]();
+        }
+      }
+      return this.done;
+    }
+    [_closeTarget]() {
+      this[_target].close().then(dart.void)(dart.bind(this, _completeDoneValue), {onError: dart.bind(this, _completeDoneError)});
+    }
+    get done() {
+      return this[_doneCompleter].future;
+    }
+    [_completeDoneValue](value) {
+      if (!dart.test(this[_doneCompleter].isCompleted)) {
+        this[_doneCompleter].complete(value);
+      }
+    }
+    [_completeDoneError](error, stackTrace) {
+      if (!dart.test(this[_doneCompleter].isCompleted)) {
+        this[_hasError] = true;
+        this[_doneCompleter].completeError(error, stackTrace);
+      }
+    }
+    get [_controller]() {
+      if (dart.test(this[_isBound])) {
+        dart.throw(new core.StateError("StreamSink is bound to a stream"));
+      }
+      if (dart.test(this[_isClosed])) {
+        dart.throw(new core.StateError("StreamSink is closed"));
+      }
+      if (this[_controllerInstance] == null) {
+        this[_controllerInstance] = StreamControllerOfT().new({sync: true});
+        this[_controllerCompleter] = async.Completer.new();
+        this[_target].addStream(this[_controller].stream).then(dart.dynamic)(dart.fn(_ => {
+          if (dart.test(this[_isBound])) {
+            this[_controllerCompleter].complete(this);
+            this[_controllerCompleter] = null;
+            this[_controllerInstance] = null;
+          } else {
+            this[_closeTarget]();
+          }
+        }, dynamicToNull()), {onError: dart.fn((error, stackTrace) => {
+            if (dart.test(this[_isBound])) {
+              this[_controllerCompleter].completeError(error, core.StackTrace._check(stackTrace));
+              this[_controllerCompleter] = null;
+              this[_controllerInstance] = null;
+            } else {
+              this[_completeDoneError](error, core.StackTrace._check(stackTrace));
+            }
+          }, dynamicAnddynamicToNull())});
+      }
+      return this[_controllerInstance];
+    }
+  }
+  dart.addTypeTests(_StreamSinkImpl);
+  _StreamSinkImpl[dart.implements] = () => [StreamSinkOfT()];
+  dart.setSignature(_StreamSinkImpl, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StreamSinkImpl$(T), [StreamConsumerOfT()])}),
+    fields: () => ({
+      [_target]: StreamConsumerOfT(),
+      [_doneCompleter]: async.Completer,
+      [_controllerInstance]: StreamControllerOfT(),
+      [_controllerCompleter]: async.Completer,
+      [_isClosed]: core.bool,
+      [_isBound]: core.bool,
+      [_hasError]: core.bool
+    }),
+    getters: () => ({
+      done: dart.definiteFunctionType(async.Future, []),
+      [_controller]: dart.definiteFunctionType(async.StreamController$(T), [])
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [T]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfT()]),
+      flush: dart.definiteFunctionType(async.Future, []),
+      close: dart.definiteFunctionType(async.Future, []),
+      [_closeTarget]: dart.definiteFunctionType(dart.void, []),
+      [_completeDoneValue]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      [_completeDoneError]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])
+    })
+  });
+  return _StreamSinkImpl;
+});
+io._StreamSinkImpl = _StreamSinkImpl();
+io._IOSinkImpl = class _IOSinkImpl extends io._StreamSinkImpl$(core.List$(core.int)) {
+  new(target, encoding) {
+    this[_encoding] = encoding;
+    this[_encodingMutable] = true;
+    super.new(target);
+  }
+  get encoding() {
+    return this[_encoding];
+  }
+  set encoding(value) {
+    if (!dart.test(this[_encodingMutable])) {
+      dart.throw(new core.StateError("IOSink encoding is not mutable"));
+    }
+    this[_encoding] = value;
+  }
+  write(obj) {
+    let string = dart.str`${obj}`;
+    if (dart.test(string[dartx.isEmpty])) return;
+    this.add(this[_encoding].encode(string));
+  }
+  writeAll(objects, separator) {
+    if (separator === void 0) separator = "";
+    let iterator = objects[dartx.iterator];
+    if (!dart.test(iterator.moveNext())) return;
+    if (dart.test(separator[dartx.isEmpty])) {
+      do {
+        this.write(iterator.current);
+      } while (dart.test(iterator.moveNext()));
+    } else {
+      this.write(iterator.current);
+      while (dart.test(iterator.moveNext())) {
+        this.write(separator);
+        this.write(iterator.current);
+      }
+    }
+  }
+  writeln(object) {
+    if (object === void 0) object = "";
+    this.write(object);
+    this.write("\n");
+  }
+  writeCharCode(charCode) {
+    this.write(core.String.fromCharCode(charCode));
+  }
+};
+dart.addSimpleTypeTests(io._IOSinkImpl);
+io._IOSinkImpl[dart.implements] = () => [io.IOSink];
+dart.setSignature(io._IOSinkImpl, {
+  constructors: () => ({new: dart.definiteFunctionType(io._IOSinkImpl, [StreamConsumerOfListOfint(), convert.Encoding])}),
+  fields: () => ({
+    [_encoding]: convert.Encoding,
+    [_encodingMutable]: core.bool
+  }),
+  getters: () => ({encoding: dart.definiteFunctionType(convert.Encoding, [])}),
+  setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+  methods: () => ({
+    write: dart.definiteFunctionType(dart.void, [core.Object]),
+    writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+    writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+    writeCharCode: dart.definiteFunctionType(dart.void, [core.int])
+  })
+});
+io._HttpOutboundMessage$ = dart.generic(T => {
+  class _HttpOutboundMessage extends io._IOSinkImpl {
+    new(uri, protocolVersion, outgoing, opts) {
+      let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
+      this[_uri] = uri;
+      this.headers = new io._HttpHeaders(protocolVersion, {defaultPortForScheme: uri.scheme == 'https' ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT, initialHeaders: initialHeaders});
+      this[_outgoing] = outgoing;
+      this[_encodingSet] = false;
+      this[_bufferOutput] = true;
+      super.new(outgoing, null);
+      this[_outgoing].outbound = this;
+      this[_encodingMutable] = false;
+    }
+    get contentLength() {
+      return this.headers.contentLength;
+    }
+    set contentLength(contentLength) {
+      this.headers.contentLength = contentLength;
+    }
+    get persistentConnection() {
+      return this.headers.persistentConnection;
+    }
+    set persistentConnection(p) {
+      this.headers.persistentConnection = p;
+    }
+    get bufferOutput() {
+      return this[_bufferOutput];
+    }
+    set bufferOutput(bufferOutput) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this[_bufferOutput] = bufferOutput;
+    }
+    get encoding() {
+      if (dart.test(this[_encodingSet]) && dart.test(this[_outgoing].headersWritten)) {
+        return this[_encoding];
+      }
+      let charset = null;
+      if (this.headers.contentType != null && this.headers.contentType.charset != null) {
+        charset = this.headers.contentType.charset;
+      } else {
+        charset = "iso-8859-1";
+      }
+      return convert.Encoding.getByName(core.String._check(charset));
+    }
+    set encoding(value) {
+      super.encoding = value;
+    }
+    add(data) {
+      if (data[dartx.length] == 0) return;
+      super.add(data);
+    }
+    write(obj) {
+      if (!dart.test(this[_encodingSet])) {
+        this[_encoding] = this.encoding;
+        this[_encodingSet] = true;
+      }
+      super.write(obj);
+    }
+    get [_isConnectionClosed]() {
+      return false;
+    }
+  }
+  dart.addTypeTests(_HttpOutboundMessage);
+  dart.setSignature(_HttpOutboundMessage, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpOutboundMessage$(T), [core.Uri, core.String, io._HttpOutgoing], {initialHeaders: io._HttpHeaders})}),
+    fields: () => ({
+      [_encodingSet]: core.bool,
+      [_bufferOutput]: core.bool,
+      [_uri]: core.Uri,
+      [_outgoing]: io._HttpOutgoing,
+      headers: io._HttpHeaders
+    }),
+    getters: () => ({
+      contentLength: dart.definiteFunctionType(core.int, []),
+      persistentConnection: dart.definiteFunctionType(core.bool, []),
+      bufferOutput: dart.definiteFunctionType(core.bool, []),
+      [_isConnectionClosed]: dart.definiteFunctionType(core.bool, [])
+    }),
+    setters: () => ({
+      contentLength: dart.definiteFunctionType(dart.void, [core.int]),
+      persistentConnection: dart.definiteFunctionType(dart.void, [core.bool]),
+      bufferOutput: dart.definiteFunctionType(dart.void, [core.bool])
+    })
+  });
+  return _HttpOutboundMessage;
+});
+io._HttpOutboundMessage = _HttpOutboundMessage();
+const _statusCode = Symbol('_statusCode');
+const _reasonPhrase = Symbol('_reasonPhrase');
+const _deadline = Symbol('_deadline');
+const _deadlineTimer = Symbol('_deadlineTimer');
+const _isClosing = Symbol('_isClosing');
+const _findReasonPhrase = Symbol('_findReasonPhrase');
+const _isNew = Symbol('_isNew');
+const _writeHeader = Symbol('_writeHeader');
+io._HttpResponse = class _HttpResponse extends io._HttpOutboundMessage$(io.HttpResponse) {
+  new(uri, protocolVersion, outgoing, defaultHeaders, serverHeader) {
+    this[_statusCode] = 200;
+    this[_reasonPhrase] = null;
+    this[_cookies] = null;
+    this[_httpRequest] = null;
+    this[_deadline] = null;
+    this[_deadlineTimer] = null;
+    super.new(uri, protocolVersion, outgoing, {initialHeaders: io._HttpHeaders._check(defaultHeaders)});
+    if (serverHeader != null) this.headers.set('server', serverHeader);
+  }
+  get [_isConnectionClosed]() {
+    return this[_httpRequest][_httpConnection][_isClosing];
+  }
+  get cookies() {
+    if (this[_cookies] == null) this[_cookies] = ListOfCookie().new();
+    return this[_cookies];
+  }
+  get statusCode() {
+    return this[_statusCode];
+  }
+  set statusCode(statusCode) {
+    if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+    this[_statusCode] = statusCode;
+  }
+  get reasonPhrase() {
+    return this[_findReasonPhrase](this.statusCode);
+  }
+  set reasonPhrase(reasonPhrase) {
+    if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+    this[_reasonPhrase] = reasonPhrase;
+  }
+  redirect(location, opts) {
+    let status = opts && 'status' in opts ? opts.status : io.HttpStatus.MOVED_TEMPORARILY;
+    if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+    this.statusCode = status;
+    this.headers.set("location", dart.toString(location));
+    return this.close();
+  }
+  detachSocket(opts) {
+    let writeHeaders = opts && 'writeHeaders' in opts ? opts.writeHeaders : true;
+    if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Headers already sent"));
+    this.deadline = null;
+    let future = this[_httpRequest][_httpConnection].detachSocket();
+    if (dart.test(writeHeaders)) {
+      let headersFuture = this[_outgoing].writeHeaders({drainRequest: false, setOutgoing: false});
+      dart.assert(headersFuture == null);
+    } else {
+      this[_outgoing].headersWritten = true;
+    }
+    this.close();
+    this.done.catchError(dart.fn(_ => {
+    }, dynamicToNull()));
+    return future;
+  }
+  get connectionInfo() {
+    return this[_httpRequest].connectionInfo;
+  }
+  get deadline() {
+    return this[_deadline];
+  }
+  set deadline(d) {
+    if (this[_deadlineTimer] != null) this[_deadlineTimer].cancel();
+    this[_deadline] = d;
+    if (this[_deadline] == null) return;
+    this[_deadlineTimer] = async.Timer.new(this[_deadline], dart.fn(() => {
+      this[_httpRequest][_httpConnection].destroy();
+    }, VoidToNull()));
+  }
+  [_writeHeader]() {
+    let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+    let offset = 0;
+    function write(bytes) {
+      let len = bytes[dartx.length];
+      for (let i = 0; i < dart.notNull(len); i++) {
+        buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+      }
+      offset = dart.notNull(offset) + dart.notNull(len);
+    }
+    dart.fn(write, ListOfintTovoid());
+    if (this.headers.protocolVersion == "1.1") {
+      write(io._Const.HTTP11);
+    } else {
+      write(io._Const.HTTP10);
+    }
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.SP);
+    write(dart.toString(this.statusCode)[dartx.codeUnits]);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.SP);
+    write(this.reasonPhrase[dartx.codeUnits]);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.CR);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.LF);
+    let session = this[_httpRequest][_session];
+    if (session != null && !dart.test(session[_destroyed])) {
+      session[_isNew] = false;
+      let found = false;
+      for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
+        if (this.cookies[dartx._get](i).name[dartx.toUpperCase]() == io._DART_SESSION_ID) {
+          let _ = this.cookies[dartx._get](i);
+          _.value = session.id;
+          _.httpOnly = true;
+          _.path = "/";
+          found = true;
+        }
+      }
+      if (!found) {
+        let cookie = io.Cookie.new(io._DART_SESSION_ID, session.id);
+        this.cookies[dartx.add](((() => {
+          cookie.httpOnly = true;
+          cookie.path = "/";
+          return cookie;
+        })()));
+      }
+    }
+    if (this[_cookies] != null) {
+      this[_cookies][dartx.forEach](dart.fn(cookie => {
+        this.headers.add(io.HttpHeaders.SET_COOKIE, cookie);
+      }, CookieToNull()));
+    }
+    this.headers[_finalize]();
+    offset = this.headers[_write](buffer, offset);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.CR);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.LF);
+    this[_outgoing].setHeader(buffer, offset);
+  }
+  [_findReasonPhrase](statusCode) {
+    if (this[_reasonPhrase] != null) {
+      return this[_reasonPhrase];
+    }
+    switch (statusCode) {
+      case io.HttpStatus.CONTINUE:
+      {
+        return "Continue";
+      }
+      case io.HttpStatus.SWITCHING_PROTOCOLS:
+      {
+        return "Switching Protocols";
+      }
+      case io.HttpStatus.OK:
+      {
+        return "OK";
+      }
+      case io.HttpStatus.CREATED:
+      {
+        return "Created";
+      }
+      case io.HttpStatus.ACCEPTED:
+      {
+        return "Accepted";
+      }
+      case io.HttpStatus.NON_AUTHORITATIVE_INFORMATION:
+      {
+        return "Non-Authoritative Information";
+      }
+      case io.HttpStatus.NO_CONTENT:
+      {
+        return "No Content";
+      }
+      case io.HttpStatus.RESET_CONTENT:
+      {
+        return "Reset Content";
+      }
+      case io.HttpStatus.PARTIAL_CONTENT:
+      {
+        return "Partial Content";
+      }
+      case io.HttpStatus.MULTIPLE_CHOICES:
+      {
+        return "Multiple Choices";
+      }
+      case io.HttpStatus.MOVED_PERMANENTLY:
+      {
+        return "Moved Permanently";
+      }
+      case io.HttpStatus.FOUND:
+      {
+        return "Found";
+      }
+      case io.HttpStatus.SEE_OTHER:
+      {
+        return "See Other";
+      }
+      case io.HttpStatus.NOT_MODIFIED:
+      {
+        return "Not Modified";
+      }
+      case io.HttpStatus.USE_PROXY:
+      {
+        return "Use Proxy";
+      }
+      case io.HttpStatus.TEMPORARY_REDIRECT:
+      {
+        return "Temporary Redirect";
+      }
+      case io.HttpStatus.BAD_REQUEST:
+      {
+        return "Bad Request";
+      }
+      case io.HttpStatus.UNAUTHORIZED:
+      {
+        return "Unauthorized";
+      }
+      case io.HttpStatus.PAYMENT_REQUIRED:
+      {
+        return "Payment Required";
+      }
+      case io.HttpStatus.FORBIDDEN:
+      {
+        return "Forbidden";
+      }
+      case io.HttpStatus.NOT_FOUND:
+      {
+        return "Not Found";
+      }
+      case io.HttpStatus.METHOD_NOT_ALLOWED:
+      {
+        return "Method Not Allowed";
+      }
+      case io.HttpStatus.NOT_ACCEPTABLE:
+      {
+        return "Not Acceptable";
+      }
+      case io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED:
+      {
+        return "Proxy Authentication Required";
+      }
+      case io.HttpStatus.REQUEST_TIMEOUT:
+      {
+        return "Request Time-out";
+      }
+      case io.HttpStatus.CONFLICT:
+      {
+        return "Conflict";
+      }
+      case io.HttpStatus.GONE:
+      {
+        return "Gone";
+      }
+      case io.HttpStatus.LENGTH_REQUIRED:
+      {
+        return "Length Required";
+      }
+      case io.HttpStatus.PRECONDITION_FAILED:
+      {
+        return "Precondition Failed";
+      }
+      case io.HttpStatus.REQUEST_ENTITY_TOO_LARGE:
+      {
+        return "Request Entity Too Large";
+      }
+      case io.HttpStatus.REQUEST_URI_TOO_LONG:
+      {
+        return "Request-URI Too Large";
+      }
+      case io.HttpStatus.UNSUPPORTED_MEDIA_TYPE:
+      {
+        return "Unsupported Media Type";
+      }
+      case io.HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE:
+      {
+        return "Requested range not satisfiable";
+      }
+      case io.HttpStatus.EXPECTATION_FAILED:
+      {
+        return "Expectation Failed";
+      }
+      case io.HttpStatus.INTERNAL_SERVER_ERROR:
+      {
+        return "Internal Server Error";
+      }
+      case io.HttpStatus.NOT_IMPLEMENTED:
+      {
+        return "Not Implemented";
+      }
+      case io.HttpStatus.BAD_GATEWAY:
+      {
+        return "Bad Gateway";
+      }
+      case io.HttpStatus.SERVICE_UNAVAILABLE:
+      {
+        return "Service Unavailable";
+      }
+      case io.HttpStatus.GATEWAY_TIMEOUT:
+      {
+        return "Gateway Time-out";
+      }
+      case io.HttpStatus.HTTP_VERSION_NOT_SUPPORTED:
+      {
+        return "Http Version not supported";
+      }
+      default:
+      {
+        return dart.str`Status ${statusCode}`;
+      }
+    }
+  }
+};
+dart.addSimpleTypeTests(io._HttpResponse);
+io._HttpResponse[dart.implements] = () => [io.HttpResponse];
+dart.setSignature(io._HttpResponse, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpResponse, [core.Uri, core.String, io._HttpOutgoing, io.HttpHeaders, core.String])}),
+  fields: () => ({
+    [_statusCode]: core.int,
+    [_reasonPhrase]: core.String,
+    [_cookies]: ListOfCookie(),
+    [_httpRequest]: io._HttpRequest,
+    [_deadline]: core.Duration,
+    [_deadlineTimer]: async.Timer
+  }),
+  getters: () => ({
+    cookies: dart.definiteFunctionType(core.List$(io.Cookie), []),
+    statusCode: dart.definiteFunctionType(core.int, []),
+    reasonPhrase: dart.definiteFunctionType(core.String, []),
+    connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+    deadline: dart.definiteFunctionType(core.Duration, [])
+  }),
+  setters: () => ({
+    statusCode: dart.definiteFunctionType(dart.void, [core.int]),
+    reasonPhrase: dart.definiteFunctionType(dart.void, [core.String]),
+    deadline: dart.definiteFunctionType(dart.void, [core.Duration])
+  }),
+  methods: () => ({
+    redirect: dart.definiteFunctionType(async.Future, [core.Uri], {status: core.int}),
+    detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), [], {writeHeaders: core.bool}),
+    [_writeHeader]: dart.definiteFunctionType(dart.void, []),
+    [_findReasonPhrase]: dart.definiteFunctionType(core.String, [core.int])
+  })
+});
+const _responseCompleter = Symbol('_responseCompleter');
+const _response = Symbol('_response');
+const _followRedirects = Symbol('_followRedirects');
+const _maxRedirects = Symbol('_maxRedirects');
+const _onIncoming = Symbol('_onIncoming');
+const _onError = Symbol('_onError');
+const _proxyTunnel = Symbol('_proxyTunnel');
+const _requestUri = Symbol('_requestUri');
+io._HttpClientRequest = class _HttpClientRequest extends io._HttpOutboundMessage$(io.HttpClientResponse) {
+  new(outgoing, uri, method, proxy, httpClient, httpClientConnection) {
+    this.cookies = ListOfCookie().new();
+    this[_responseCompleter] = CompleterOfHttpClientResponse().new();
+    this[_responseRedirects] = JSArrayOfRedirectInfo().of([]);
+    this.method = method;
+    this[_proxy] = proxy;
+    this[_httpClient] = httpClient;
+    this[_httpClientConnection] = httpClientConnection;
+    this.uri = uri;
+    this[_response] = null;
+    this[_followRedirects] = true;
+    this[_maxRedirects] = 5;
+    super.new(uri, "1.1", outgoing);
+    if (this.method == "GET" || this.method == "HEAD") {
+      this.contentLength = 0;
+    } else {
+      this.headers.chunkedTransferEncoding = true;
+    }
+  }
+  get done() {
+    if (this[_response] == null) {
+      this[_response] = async.Future.wait(dart.dynamic)(JSArrayOfFuture().of([this[_responseCompleter].future, super.done]), {eagerError: true}).then(io.HttpClientResponse)(dart.fn(list => FutureOrOfHttpClientResponse()._check(list[dartx._get](0)), ListToFutureOrOfHttpClientResponse()));
+    }
+    return this[_response];
+  }
+  close() {
+    super.close();
+    return this.done;
+  }
+  get maxRedirects() {
+    return this[_maxRedirects];
+  }
+  set maxRedirects(maxRedirects) {
+    if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Request already sent"));
+    this[_maxRedirects] = maxRedirects;
+  }
+  get followRedirects() {
+    return this[_followRedirects];
+  }
+  set followRedirects(followRedirects) {
+    if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Request already sent"));
+    this[_followRedirects] = followRedirects;
+  }
+  get connectionInfo() {
+    return this[_httpClientConnection].connectionInfo;
+  }
+  [_onIncoming](incoming) {
+    let response = new io._HttpClientResponse(incoming, this, this[_httpClient]);
+    let future = null;
+    if (dart.test(this.followRedirects) && dart.test(response.isRedirect)) {
+      if (dart.notNull(response.redirects[dartx.length]) < dart.notNull(this.maxRedirects)) {
+        future = response.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => response.redirect(), dynamicToFutureOfHttpClientResponse()));
+      } else {
+        future = response.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => FutureOfHttpClientResponse().error(new io.RedirectException("Redirect limit exceeded", response.redirects)), dynamicToFutureOfHttpClientResponse()));
+      }
+    } else if (dart.test(response[_shouldAuthenticateProxy])) {
+      future = response[_authenticate](true);
+    } else if (dart.test(response[_shouldAuthenticate])) {
+      future = response[_authenticate](false);
+    } else {
+      future = FutureOfHttpClientResponse().value(response);
+    }
+    future.then(dart.void)(dart.fn(v => this[_responseCompleter].complete(v), HttpClientResponseTovoid()), {onError: dart.bind(this[_responseCompleter], 'completeError')});
+  }
+  [_onError](error, stackTrace) {
+    this[_responseCompleter].completeError(error, stackTrace);
+  }
+  [_requestUri]() {
+    const uriStartingFromPath = (function() {
+      let result = this.uri.path;
+      if (dart.test(result[dartx.isEmpty])) result = "/";
+      if (dart.test(this.uri.hasQuery)) {
+        result = dart.str`${result}?${this.uri.query}`;
+      }
+      return result;
+    }).bind(this);
+    dart.fn(uriStartingFromPath, VoidToString());
+    if (dart.test(this[_proxy].isDirect)) {
+      return uriStartingFromPath();
+    } else {
+      if (this.method == "CONNECT") {
+        return dart.str`${this.uri.host}:${this.uri.port}`;
+      } else {
+        if (dart.test(this[_httpClientConnection][_proxyTunnel])) {
+          return uriStartingFromPath();
+        } else {
+          return dart.toString(this.uri.removeFragment());
+        }
+      }
+    }
+  }
+  [_writeHeader]() {
+    let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+    let offset = 0;
+    function write(bytes) {
+      let len = bytes[dartx.length];
+      for (let i = 0; i < dart.notNull(len); i++) {
+        buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+      }
+      offset = dart.notNull(offset) + dart.notNull(len);
+    }
+    dart.fn(write, ListOfintTovoid());
+    write(this.method[dartx.codeUnits]);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.SP);
+    write(this[_requestUri]()[dartx.codeUnits]);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.SP);
+    write(io._Const.HTTP11);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.CR);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.LF);
+    if (!dart.test(this.cookies[dartx.isEmpty])) {
+      let sb = new core.StringBuffer();
+      for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
+        if (i > 0) sb.write("; ");
+        sb.write(this.cookies[dartx._get](i).name);
+        sb.write("=");
+        sb.write(this.cookies[dartx._get](i).value);
+      }
+      this.headers.add(io.HttpHeaders.COOKIE, sb.toString());
+    }
+    this.headers[_finalize]();
+    offset = this.headers[_write](buffer, offset);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.CR);
+    buffer[dartx._set]((() => {
+      let x = offset;
+      offset = dart.notNull(x) + 1;
+      return x;
+    })(), io._CharCode.LF);
+    this[_outgoing].setHeader(buffer, offset);
+  }
+};
+dart.addSimpleTypeTests(io._HttpClientRequest);
+io._HttpClientRequest[dart.implements] = () => [io.HttpClientRequest];
+dart.setSignature(io._HttpClientRequest, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpClientRequest, [io._HttpOutgoing, core.Uri, core.String, io._Proxy, io._HttpClient, io._HttpClientConnection])}),
+  fields: () => ({
+    method: core.String,
+    uri: core.Uri,
+    cookies: ListOfCookie(),
+    [_httpClient]: io._HttpClient,
+    [_httpClientConnection]: io._HttpClientConnection,
+    [_responseCompleter]: CompleterOfHttpClientResponse(),
+    [_proxy]: io._Proxy,
+    [_response]: FutureOfHttpClientResponse(),
+    [_followRedirects]: core.bool,
+    [_maxRedirects]: core.int,
+    [_responseRedirects]: ListOfRedirectInfo()
+  }),
+  getters: () => ({
+    done: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), []),
+    maxRedirects: dart.definiteFunctionType(core.int, []),
+    followRedirects: dart.definiteFunctionType(core.bool, []),
+    connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])
+  }),
+  setters: () => ({
+    maxRedirects: dart.definiteFunctionType(dart.void, [core.int]),
+    followRedirects: dart.definiteFunctionType(dart.void, [core.bool])
+  }),
+  methods: () => ({
+    close: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), []),
+    [_onIncoming]: dart.definiteFunctionType(dart.void, [io._HttpIncoming]),
+    [_onError]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
+    [_requestUri]: dart.definiteFunctionType(core.String, []),
+    [_writeHeader]: dart.definiteFunctionType(dart.void, [])
+  })
+});
+const _consume = Symbol('_consume');
+io._HttpGZipSink = class _HttpGZipSink extends convert.ByteConversionSink {
+  new(consume) {
+    this[_consume] = consume;
+    super.new();
+  }
+  add(chunk) {
+    dart.dcall(this[_consume], chunk);
+  }
+  addSlice(chunk, start, end, isLast) {
+    if (typed_data.Uint8List.is(chunk)) {
+      dart.dcall(this[_consume], typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+    } else {
+      dart.dcall(this[_consume], chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
+    }
+  }
+  close() {}
+};
+dart.setSignature(io._HttpGZipSink, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpGZipSink, [core.Function])}),
+  fields: () => ({[_consume]: core.Function}),
+  methods: () => ({
+    add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+    addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+    close: dart.definiteFunctionType(dart.void, [])
+  })
+});
+const _closeFuture = Symbol('_closeFuture');
+const _pendingChunkedFooter = Symbol('_pendingChunkedFooter');
+const _bytesWritten = Symbol('_bytesWritten');
+const _gzip = Symbol('_gzip');
+const _gzipSink = Symbol('_gzipSink');
+const _gzipAdd = Symbol('_gzipAdd');
+const _gzipBuffer = Symbol('_gzipBuffer');
+const _gzipBufferLength = Symbol('_gzipBufferLength');
+const _socketError = Symbol('_socketError');
+const _addGZipChunk = Symbol('_addGZipChunk');
+const _addChunk = Symbol('_addChunk');
+const _chunkHeader = Symbol('_chunkHeader');
+const _ignoreError = Symbol('_ignoreError');
+let const;
+io._HttpOutgoing = class _HttpOutgoing extends core.Object {
+  new(socket) {
+    this[_doneCompleter] = async.Completer.new();
+    this.socket = socket;
+    this.ignoreBody = false;
+    this.headersWritten = false;
+    this[_buffer] = null;
+    this[_length] = 0;
+    this[_closeFuture] = null;
+    this.chunked = false;
+    this[_pendingChunkedFooter] = 0;
+    this.contentLength = null;
+    this[_bytesWritten] = 0;
+    this[_gzip] = false;
+    this[_gzipSink] = null;
+    this[_gzipAdd] = null;
+    this[_gzipBuffer] = null;
+    this[_gzipBufferLength] = 0;
+    this[_socketError] = false;
+    this.outbound = null;
+  }
+  writeHeaders(opts) {
+    let drainRequest = opts && 'drainRequest' in opts ? opts.drainRequest : true;
+    let setOutgoing = opts && 'setOutgoing' in opts ? opts.setOutgoing : true;
+    const write = (function() {
+      try {
+        this.outbound[_writeHeader]();
+      } catch (_) {
+        return async.Future.error(new io.HttpException(dart.str`Headers size exceeded the of '${io._OUTGOING_BUFFER_SIZE}'` + " bytes"));
+      }
+
+      return null;
+    }).bind(this);
+    dart.fn(write, VoidToFuture());
+    if (dart.test(this.headersWritten)) return null;
+    this.headersWritten = true;
+    let drainFuture = null;
+    let gzip = false;
+    if (io._HttpResponse.is(this.outbound)) {
+      let response = io._HttpResponse._check(this.outbound);
+      if (dart.test(response[_httpRequest][_httpServer].autoCompress) && dart.test(this.outbound.bufferOutput) && dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+        let acceptEncodings = response[_httpRequest].headers._get(io.HttpHeaders.ACCEPT_ENCODING);
+        let contentEncoding = this.outbound.headers._get(io.HttpHeaders.CONTENT_ENCODING);
+        if (acceptEncodings != null && dart.test(acceptEncodings[dartx.expand](dart.dynamic)(dart.fn(list => core.Iterable._check(dart.dsend(list, 'split', ",")), dynamicToIterable()))[dartx.any](dart.fn(encoding => dart.equals(dart.dsend(dart.dsend(encoding, 'trim'), 'toLowerCase'), "gzip"), dynamicTobool()))) && contentEncoding == null) {
+          this.outbound.headers.set(io.HttpHeaders.CONTENT_ENCODING, "gzip");
+          gzip = true;
+        }
+      }
+      if (dart.test(drainRequest) && !dart.test(response[_httpRequest][_incoming].hasSubscriber)) {
+        drainFuture = response[_httpRequest].drain(dart.dynamic)().catchError(dart.fn(_ => {
+        }, dynamicToNull()));
+      }
+    } else {
+      drainRequest = false;
+    }
+    if (dart.test(this.ignoreBody)) {
+      return write();
+    }
+    if (dart.test(setOutgoing)) {
+      let contentLength = this.outbound.headers.contentLength;
+      if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+        this.chunked = true;
+        if (gzip) this.gzip = true;
+      } else if (dart.notNull(contentLength) >= 0) {
+        this.contentLength = contentLength;
+      }
+    }
+    if (drainFuture != null) {
+      return drainFuture.then(dart.dynamic)(dart.fn(_ => write(), dynamicToFuture()));
+    }
+    return write();
+  }
+  addStream(stream) {
+    if (dart.test(this[_socketError])) {
+      stream.listen(null).cancel();
+      return async.Future.value(this.outbound);
+    }
+    if (dart.test(this.ignoreBody)) {
+      stream.drain(dart.dynamic)().catchError(dart.fn(_ => {
+      }, dynamicToNull()));
+      let future = this.writeHeaders();
+      if (future != null) {
+        return future.then(dart.dynamic)(dart.fn(_ => this.close(), dynamicToFuture()));
+      }
+      return this.close();
+    }
+    let sub = null;
+    let controller = async.StreamController.new({onPause: dart.fn(() => dart.dsend(sub, 'pause'), VoidTovoid()), onResume: dart.fn(() => dart.dsend(sub, 'resume'), VoidTovoid()), sync: true});
+    const onData = (function(data) {
+      if (dart.test(this[_socketError])) return;
+      if (dart.equals(dart.dload(data, 'length'), 0)) return;
+      if (dart.test(this.chunked)) {
+        if (dart.test(this[_gzip])) {
+          this[_gzipAdd] = dart.bind(controller, 'add');
+          this[_addGZipChunk](data, dart.bind(this[_gzipSink], 'add'));
+          this[_gzipAdd] = null;
+          return;
+        }
+        this[_addChunk](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), dart.bind(controller, 'add'));
+        this[_pendingChunkedFooter] = 2;
+      } else {
+        if (this.contentLength != null) {
+          this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(core.num._check(dart.dload(data, 'length')));
+          if (dart.notNull(this[_bytesWritten]) > dart.notNull(this.contentLength)) {
+            controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(IterableOfint()._check(data))}]`));
+            return;
+          }
+        }
+      }
+      this[_addChunk](data, dart.bind(controller, 'add'));
+    }).bind(this);
+    dart.fn(onData, dynamicTovoid());
+    sub = stream.listen(onData, {onError: dart.bind(controller, 'addError'), onDone: dart.bind(controller, 'close'), cancelOnError: true});
+    if (!dart.test(this.headersWritten)) {
+      let future = this.writeHeaders();
+      if (future != null) {
+        dart.dsend(sub, 'pause', future);
+      }
+    }
+    return this.socket.addStream(StreamOfListOfint()._check(controller.stream)).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+        if (dart.test(this[_gzip])) this[_gzipSink].close();
+        this[_socketError] = true;
+        this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
+        if (dart.test(this[_ignoreError](error))) {
+          return this.outbound;
+        } else {
+          dart.throw(error);
+        }
+      }, dynamicAnddynamicTo_HttpOutboundMessage())});
+  }
+  close() {
+    if (this[_closeFuture] != null) return this[_closeFuture];
+    if (dart.test(this[_socketError])) return async.Future.value(this.outbound);
+    if (dart.test(this.outbound[_isConnectionClosed])) return async.Future.value(this.outbound);
+    if (!dart.test(this.headersWritten) && !dart.test(this.ignoreBody)) {
+      if (this.outbound.headers.contentLength == -1) {
+        this.outbound.headers.chunkedTransferEncoding = false;
+        this.outbound.headers.contentLength = 0;
+      } else if (dart.notNull(this.outbound.headers.contentLength) > 0) {
+        let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri]});
+        this[_doneCompleter].completeError(error);
+        return this[_closeFuture] = async.Future.error(error);
+      }
+    }
+    if (this.contentLength != null) {
+      if (dart.notNull(this[_bytesWritten]) < dart.notNull(this.contentLength)) {
+        let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri]});
+        this[_doneCompleter].completeError(error);
+        return this[_closeFuture] = async.Future.error(error);
+      }
+    }
+    const finalize = (function() {
+      if (dart.test(this.chunked)) {
+        if (dart.test(this[_gzip])) {
+          this[_gzipAdd] = dart.bind(this.socket, 'add');
+          if (dart.notNull(this[_gzipBufferLength]) > 0) {
+            this[_gzipSink].add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
+          }
+          this[_gzipBuffer] = null;
+          this[_gzipSink].close();
+          this[_gzipAdd] = null;
+        }
+        this[_addChunk](this[_chunkHeader](0), dart.bind(this.socket, 'add'));
+      }
+      if (dart.notNull(this[_length]) > 0) {
+        this.socket.add(typed_data.Uint8List.view(this[_buffer][dartx.buffer], 0, this[_length]));
+      }
+      this[_buffer] = null;
+      return this.socket.flush().then(io._HttpOutboundMessage)(dart.fn(_ => {
+        this[_doneCompleter].complete(this.socket);
+        return this.outbound;
+      }, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+          this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
+          if (dart.test(this[_ignoreError](error))) {
+            return this.outbound;
+          } else {
+            dart.throw(error);
+          }
+        }, dynamicAnddynamicTo_HttpOutboundMessage())});
+    }).bind(this);
+    dart.fn(finalize, VoidToFuture());
+    let future = this.writeHeaders();
+    if (future != null) {
+      return this[_closeFuture] = future.whenComplete(finalize);
+    }
+    return this[_closeFuture] = finalize();
+  }
+  get done() {
+    return this[_doneCompleter].future;
+  }
+  setHeader(data, length) {
+    dart.assert(this[_length] == 0);
+    dart.assert(data[dartx.length] == io._OUTGOING_BUFFER_SIZE);
+    this[_buffer] = typed_data.Uint8List._check(data);
+    this[_length] = length;
+  }
+  set gzip(value) {
+    this[_gzip] = value;
+    if (dart.test(this[_gzip])) {
+      this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+      dart.assert(this[_gzipSink] == null);
+      this[_gzipSink] = new io.ZLibEncoder({gzip: true}).startChunkedConversion(new io._HttpGZipSink(dart.fn(data => {
+        if (this[_gzipAdd] == null) return;
+        this[_addChunk](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), ListOfintTovoid()._check(this[_gzipAdd]));
+        this[_pendingChunkedFooter] = 2;
+        this[_addChunk](data, ListOfintTovoid()._check(this[_gzipAdd]));
+      }, dynamicToNull())));
+    }
+  }
+  [_ignoreError](error) {
+    return (io.SocketException.is(error) || io.TlsException.is(error)) && io.HttpResponse.is(this.outbound);
+  }
+  [_addGZipChunk](chunk, add) {
+    if (!dart.test(this.outbound.bufferOutput)) {
+      add(ListOfint()._check(chunk));
+      return;
+    }
+    if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])))) {
+      add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
+      this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+      this[_gzipBufferLength] = 0;
+    }
+    if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
+      add(ListOfint()._check(chunk));
+    } else {
+      this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.asInt(dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
+      this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+    }
+  }
+  [_addChunk](chunk, add) {
+    if (!dart.test(this.outbound.bufferOutput)) {
+      if (this[_buffer] != null) {
+        add(typed_data.Uint8List.view(this[_buffer][dartx.buffer], 0, this[_length]));
+        this[_buffer] = null;
+        this[_length] = 0;
+      }
+      add(ListOfint()._check(chunk));
+      return;
+    }
+    if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_buffer][dartx.length]) - dart.notNull(this[_length])))) {
+      add(typed_data.Uint8List.view(this[_buffer][dartx.buffer], 0, this[_length]));
+      this[_buffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+      this[_length] = 0;
+    }
+    if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
+      add(ListOfint()._check(chunk));
+    } else {
+      this[_buffer][dartx.setRange](this[_length], dart.asInt(dart.notNull(this[_length]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
+      this[_length] = dart.notNull(this[_length]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+    }
+  }
+  [_chunkHeader](length) {
+    let hexDigits = const || (const = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
+    if (length == 0) {
+      if (this[_pendingChunkedFooter] == 2) return io._HttpOutgoing._footerAndChunk0Length;
+      return io._HttpOutgoing._chunk0Length;
+    }
+    let size = this[_pendingChunkedFooter];
+    let len = length;
+    while (dart.notNull(len) > 0) {
+      size = dart.notNull(size) + 1;
+      len = len[dartx['>>']](4);
+    }
+    let footerAndHeader = typed_data.Uint8List.new(dart.notNull(size) + 2);
+    if (this[_pendingChunkedFooter] == 2) {
+      footerAndHeader[dartx._set](0, io._CharCode.CR);
+      footerAndHeader[dartx._set](1, io._CharCode.LF);
+    }
+    let index = size;
+    while (dart.notNull(index) > dart.notNull(this[_pendingChunkedFooter])) {
+      footerAndHeader[dartx._set]((index = dart.notNull(index) - 1), hexDigits[dartx._get](dart.notNull(length) & 15));
+      length = length[dartx['>>']](4);
+    }
+    footerAndHeader[dartx._set](dart.notNull(size) + 0, io._CharCode.CR);
+    footerAndHeader[dartx._set](dart.notNull(size) + 1, io._CharCode.LF);
+    return footerAndHeader;
+  }
+};
+io._HttpOutgoing[dart.implements] = () => [StreamConsumerOfListOfint()];
+dart.setSignature(io._HttpOutgoing, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpOutgoing, [io.Socket])}),
+  fields: () => ({
+    [_doneCompleter]: async.Completer,
+    socket: io.Socket,
+    ignoreBody: core.bool,
+    headersWritten: core.bool,
+    [_buffer]: typed_data.Uint8List,
+    [_length]: core.int,
+    [_closeFuture]: async.Future,
+    chunked: core.bool,
+    [_pendingChunkedFooter]: core.int,
+    contentLength: core.int,
+    [_bytesWritten]: core.int,
+    [_gzip]: core.bool,
+    [_gzipSink]: convert.ByteConversionSink,
+    [_gzipAdd]: core.Function,
+    [_gzipBuffer]: typed_data.Uint8List,
+    [_gzipBufferLength]: core.int,
+    [_socketError]: core.bool,
+    outbound: io._HttpOutboundMessage
+  }),
+  getters: () => ({done: dart.definiteFunctionType(async.Future, [])}),
+  setters: () => ({gzip: dart.definiteFunctionType(dart.void, [core.bool])}),
+  methods: () => ({
+    writeHeaders: dart.definiteFunctionType(async.Future, [], {drainRequest: core.bool, setOutgoing: core.bool}),
+    addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+    close: dart.definiteFunctionType(async.Future, []),
+    setHeader: dart.definiteFunctionType(dart.void, [ListOfint(), core.int]),
+    [_ignoreError]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+    [_addGZipChunk]: dart.definiteFunctionType(dart.void, [dart.dynamic, ListOfintTovoid()]),
+    [_addChunk]: dart.definiteFunctionType(dart.void, [dart.dynamic, ListOfintTovoid()]),
+    [_chunkHeader]: dart.definiteFunctionType(core.List$(core.int), [core.int])
+  }),
+  sfields: () => ({
+    _footerAndChunk0Length: ListOfint(),
+    _chunk0Length: ListOfint()
+  })
+});
+dart.defineLazy(io._HttpOutgoing, {
+  get _footerAndChunk0Length() {
+    return dart.constList([io._CharCode.CR, io._CharCode.LF, 48, io._CharCode.CR, io._CharCode.LF, io._CharCode.CR, io._CharCode.LF], core.int);
+  },
+  get _chunk0Length() {
+    return dart.constList([48, io._CharCode.CR, io._CharCode.LF, io._CharCode.CR, io._CharCode.LF], core.int);
+  }
+});
+const _context = Symbol('_context');
+const _httpParser = Symbol('_httpParser');
+const _subscription = Symbol('_subscription');
+const _dispose = Symbol('_dispose');
+const _idleTimer = Symbol('_idleTimer');
+const _currentUri = Symbol('_currentUri');
+const _nextResponseCompleter = Symbol('_nextResponseCompleter');
+const _streamFuture = Symbol('_streamFuture');
+const _proxyCredentials = Symbol('_proxyCredentials');
+const _returnConnection = Symbol('_returnConnection');
+io._HttpClientConnection = class _HttpClientConnection extends core.Object {
+  new(key, socket, httpClient, proxyTunnel, context) {
+    if (proxyTunnel === void 0) proxyTunnel = false;
+    if (context === void 0) context = null;
+    this.key = key;
+    this[_socket] = socket;
+    this[_httpClient] = httpClient;
+    this[_proxyTunnel] = proxyTunnel;
+    this[_context] = context;
+    this[_httpParser] = io._HttpParser.responseParser();
+    this[_subscription] = null;
+    this[_dispose] = false;
+    this[_idleTimer] = null;
+    this.closed = false;
+    this[_currentUri] = null;
+    this[_nextResponseCompleter] = null;
+    this[_streamFuture] = null;
+    this[_httpParser].listenToStream(this[_socket]);
+    this[_subscription] = this[_httpParser].listen(dart.fn(incoming => {
+      this[_subscription].pause();
+      if (this[_nextResponseCompleter] == null) {
+        dart.throw(new io.HttpException("Unexpected response (unsolicited response without request).", {uri: this[_currentUri]}));
+      }
+      if (incoming.statusCode == 100) {
+        incoming.drain(dart.dynamic)().then(dart.dynamic)(dart.fn(_ => {
+          this[_subscription].resume();
+        }, dynamicToNull())).catchError(dart.fn((error, stackTrace) => {
+          if (stackTrace === void 0) stackTrace = null;
+          this[_nextResponseCompleter].completeError(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this[_currentUri]}), stackTrace);
+          this[_nextResponseCompleter] = null;
+        }, dynamic__ToNull()));
+      } else {
+        this[_nextResponseCompleter].complete(incoming);
+        this[_nextResponseCompleter] = null;
+      }
+    }, _HttpIncomingToNull()), {onError: dart.fn((error, stackTrace) => {
+        if (stackTrace === void 0) stackTrace = null;
+        if (this[_nextResponseCompleter] != null) {
+          this[_nextResponseCompleter].completeError(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this[_currentUri]}), stackTrace);
+          this[_nextResponseCompleter] = null;
+        }
+      }, dynamic__ToNull()), onDone: dart.fn(() => {
+        if (this[_nextResponseCompleter] != null) {
+          this[_nextResponseCompleter].completeError(new io.HttpException("Connection closed before response was received", {uri: this[_currentUri]}));
+          this[_nextResponseCompleter] = null;
+        }
+        this.close();
+      }, VoidToNull())});
+  }
+  send(uri, port, method, proxy) {
+    if (dart.test(this.closed)) {
+      dart.throw(new io.HttpException("Socket closed before request was sent", {uri: uri}));
+    }
+    this[_currentUri] = uri;
+    this[_subscription].pause();
+    let proxyCreds = null;
+    let creds = null;
+    let outgoing = new io._HttpOutgoing(this[_socket]);
+    let request = new io._HttpClientRequest(outgoing, uri, method, proxy, this[_httpClient], this);
+    let host = uri.host;
+    if (dart.test(host[dartx.contains](':'))) host = dart.str`[${host}]`;
+    request.headers.host = host;
+    request.headers.port = port;
+    request.headers[_add](io.HttpHeaders.ACCEPT_ENCODING, "gzip");
+    if (this[_httpClient].userAgent != null) {
+      request.headers[_add]('user-agent', this[_httpClient].userAgent);
+    }
+    if (dart.test(proxy.isAuthenticated)) {
+      let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${proxy.username}:${proxy.password}`));
+      request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
+    } else if (!dart.test(proxy.isDirect) && dart.notNull(this[_httpClient][_proxyCredentials][dartx.length]) > 0) {
+      proxyCreds = this[_httpClient][_findProxyCredentials](proxy);
+      if (proxyCreds != null) {
+        proxyCreds.authorize(request);
+      }
+    }
+    if (uri.userInfo != null && !dart.test(uri.userInfo[dartx.isEmpty])) {
+      let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(uri.userInfo));
+      request.headers.set(io.HttpHeaders.AUTHORIZATION, dart.str`Basic ${auth}`);
+    } else {
+      creds = this[_httpClient][_findCredentials](uri);
+      if (creds != null) {
+        creds.authorize(request);
+      }
+    }
+    this[_httpParser].isHead = method == "HEAD";
+    this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(s => {
+      this[_nextResponseCompleter] = CompleterOf_HttpIncoming().new();
+      this[_nextResponseCompleter].future.then(dart.dynamic)(dart.fn(incoming => {
+        this[_currentUri] = null;
+        incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
+          if (dart.test(incoming.upgraded)) {
+            this[_httpClient][_connectionClosed](this);
+            this.startTimer();
+            return;
+          }
+          if (dart.test(this.closed)) return;
+          if (!dart.test(closing) && !dart.test(this[_dispose]) && dart.test(incoming.headers.persistentConnection) && dart.test(request.persistentConnection)) {
+            this[_httpClient][_returnConnection](this);
+            this[_subscription].resume();
+          } else {
+            this.destroy();
+          }
+        }, dynamicToNull()));
+        if (proxyCreds != null && dart.equals(proxyCreds.scheme, io._AuthenticationScheme.DIGEST)) {
+          let authInfo = incoming.headers._get("proxy-authentication-info");
+          if (authInfo != null && authInfo[dartx.length] == 1) {
+            let header = io._HeaderValue.parse(authInfo[dartx._get](0), {parameterSeparator: ','});
+            let nextnonce = header.parameters[dartx._get]("nextnonce");
+            if (nextnonce != null) proxyCreds.nonce = nextnonce;
+          }
+        }
+        if (creds != null && dart.equals(creds.scheme, io._AuthenticationScheme.DIGEST)) {
+          let authInfo = incoming.headers._get("authentication-info");
+          if (authInfo != null && authInfo[dartx.length] == 1) {
+            let header = io._HeaderValue.parse(authInfo[dartx._get](0), {parameterSeparator: ','});
+            let nextnonce = header.parameters[dartx._get]("nextnonce");
+            if (nextnonce != null) creds.nonce = nextnonce;
+          }
+        }
+        request[_onIncoming](incoming);
+      }, _HttpIncomingToNull())).catchError(dart.fn(error => {
+        dart.throw(new io.HttpException("Connection closed before data was received", {uri: uri}));
+      }, dynamicToNull()), {test: dart.fn(error => core.StateError.is(error), ObjectTobool())}).catchError(dart.fn((error, stackTrace) => {
+        this.destroy();
+        request[_onError](error, core.StackTrace._check(stackTrace));
+      }, dynamicAnddynamicToNull()));
+      this[_subscription].resume();
+      return s;
+    }, dynamicTodynamic()), {onError: dart.fn(e => {
+        this.destroy();
+      }, dynamicToNull())});
+    return request;
+  }
+  detachSocket() {
+    return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), dynamicTo_DetachedSocket()));
+  }
+  destroy() {
+    this.closed = true;
+    this[_httpClient][_connectionClosed](this);
+    this[_socket].destroy();
+  }
+  close() {
+    this.closed = true;
+    this[_httpClient][_connectionClosed](this);
+    this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), dynamicTovoid()));
+  }
+  createProxyTunnel(host, port, proxy, callback) {
+    let request = this.send(core.Uri.new({host: core.String._check(host), port: core.int._check(port)}), core.int._check(port), "CONNECT", io._Proxy._check(proxy));
+    if (dart.test(dart.dload(proxy, 'isAuthenticated'))) {
+      let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${dart.dload(proxy, 'username')}:${dart.dload(proxy, 'password')}`));
+      request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
+    }
+    return request.close().then(io.SecureSocket)(dart.fn(response => {
+      if (response.statusCode != io.HttpStatus.OK) {
+        dart.throw("Proxy failed to establish tunnel " + dart.str`(${response.statusCode} ${response.reasonPhrase})`);
+      }
+      let socket = io._HttpClientResponse.as(response)[_httpRequest][_httpClientConnection][_socket];
+      return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: X509CertificateTobool()._check(callback)});
+    }, HttpClientResponseToFutureOfSecureSocket())).then(io._HttpClientConnection)(dart.fn(secureSocket => {
+      let key = core.String._check(io._HttpClientConnection.makeKey(true, core.String._check(host), core.int._check(port)));
+      return new io._HttpClientConnection(key, secureSocket, request[_httpClient], true);
+    }, SecureSocketTo_HttpClientConnection()));
+  }
+  get connectionInfo() {
+    return io._HttpConnectionInfo.create(this[_socket]);
+  }
+  static makeKey(isSecure, host, port) {
+    return dart.test(isSecure) ? dart.str`ssh:${host}:${port}` : dart.str`${host}:${port}`;
+  }
+  stopTimer() {
+    if (this[_idleTimer] != null) {
+      this[_idleTimer].cancel();
+      this[_idleTimer] = null;
+    }
+  }
+  startTimer() {
+    dart.assert(this[_idleTimer] == null);
+    this[_idleTimer] = async.Timer.new(this[_httpClient].idleTimeout, dart.fn(() => {
+      this[_idleTimer] = null;
+      this.close();
+    }, VoidToNull()));
+  }
+};
+dart.setSignature(io._HttpClientConnection, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpClientConnection, [core.String, io.Socket, io._HttpClient], [core.bool, io.SecurityContext])}),
+  fields: () => ({
+    key: core.String,
+    [_socket]: io.Socket,
+    [_proxyTunnel]: core.bool,
+    [_context]: io.SecurityContext,
+    [_httpParser]: io._HttpParser,
+    [_subscription]: async.StreamSubscription,
+    [_httpClient]: io._HttpClient,
+    [_dispose]: core.bool,
+    [_idleTimer]: async.Timer,
+    closed: core.bool,
+    [_currentUri]: core.Uri,
+    [_nextResponseCompleter]: CompleterOf_HttpIncoming(),
+    [_streamFuture]: async.Future
+  }),
+  getters: () => ({connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])}),
+  methods: () => ({
+    send: dart.definiteFunctionType(io._HttpClientRequest, [core.Uri, core.int, core.String, io._Proxy]),
+    detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+    destroy: dart.definiteFunctionType(dart.void, []),
+    close: dart.definiteFunctionType(dart.void, []),
+    createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]),
+    stopTimer: dart.definiteFunctionType(dart.void, []),
+    startTimer: dart.definiteFunctionType(dart.void, [])
+  }),
+  statics: () => ({makeKey: dart.definiteFunctionType(dart.dynamic, [core.bool, core.String, core.int])}),
+  names: ['makeKey']
+});
+io._ConnectionInfo = class _ConnectionInfo extends core.Object {
+  new(connection, proxy) {
+    this.connection = connection;
+    this.proxy = proxy;
+  }
+};
+dart.setSignature(io._ConnectionInfo, {
+  constructors: () => ({new: dart.definiteFunctionType(io._ConnectionInfo, [io._HttpClientConnection, io._Proxy])}),
+  fields: () => ({
+    connection: io._HttpClientConnection,
+    proxy: io._Proxy
+  })
+});
+const _idle = Symbol('_idle');
+const _active = Symbol('_active');
+const _pending = Symbol('_pending');
+const _connecting = Symbol('_connecting');
+const _checkPending = Symbol('_checkPending');
+const _connectionsChanged = Symbol('_connectionsChanged');
+const _badCertificateCallback = Symbol('_badCertificateCallback');
+const _getConnectionTarget = Symbol('_getConnectionTarget');
+io._ConnectionTarget = class _ConnectionTarget extends core.Object {
+  new(key, host, port, isSecure, context) {
+    this[_idle] = HashSetOf_HttpClientConnection().new();
+    this[_active] = HashSetOf_HttpClientConnection().new();
+    this[_pending] = new collection.ListQueue();
+    this.key = key;
+    this.host = host;
+    this.port = port;
+    this.isSecure = isSecure;
+    this.context = context;
+    this[_connecting] = 0;
+  }
+  get isEmpty() {
+    return dart.test(this[_idle].isEmpty) && dart.test(this[_active].isEmpty) && this[_connecting] == 0;
+  }
+  get hasIdle() {
+    return this[_idle].isNotEmpty;
+  }
+  get hasActive() {
+    return dart.test(this[_active].isNotEmpty) || dart.notNull(this[_connecting]) > 0;
+  }
+  takeIdle() {
+    dart.assert(this.hasIdle);
+    let connection = this[_idle].first;
+    this[_idle].remove(connection);
+    connection.stopTimer();
+    this[_active].add(connection);
+    return connection;
+  }
+  [_checkPending]() {
+    if (dart.test(this[_pending].isNotEmpty)) {
+      dart.dcall(this[_pending].removeFirst());
+    }
+  }
+  addNewActive(connection) {
+    this[_active].add(connection);
+  }
+  returnConnection(connection) {
+    dart.assert(this[_active].contains(connection));
+    this[_active].remove(connection);
+    this[_idle].add(connection);
+    connection.startTimer();
+    this[_checkPending]();
+  }
+  connectionClosed(connection) {
+    dart.assert(!dart.test(this[_active].contains(connection)) || !dart.test(this[_idle].contains(connection)));
+    this[_active].remove(connection);
+    this[_idle].remove(connection);
+    this[_checkPending]();
+  }
+  close(force) {
+    for (let c of this[_idle].toList()) {
+      c.close();
+    }
+    if (dart.test(force)) {
+      for (let c of this[_active].toList()) {
+        c.destroy();
+      }
+    }
+  }
+  connect(uriHost, uriPort, proxy, client) {
+    if (dart.test(this.hasIdle)) {
+      let connection = this.takeIdle();
+      client[_connectionsChanged]();
+      return FutureOf_ConnectionInfo().value(new io._ConnectionInfo(connection, proxy));
+    }
+    if (client.maxConnectionsPerHost != null && dart.notNull(this[_active].length) + dart.notNull(this[_connecting]) >= dart.notNull(client.maxConnectionsPerHost)) {
+      let completer = async.Completer.new();
+      this[_pending].add(dart.fn(() => {
+        this.connect(uriHost, uriPort, proxy, client).then(dart.void)(dart.bind(completer, 'complete'), {onError: dart.bind(completer, 'completeError')});
+      }, VoidToNull()));
+      return FutureOf_ConnectionInfo()._check(completer.future);
+    }
+    let currentBadCertificateCallback = client[_badCertificateCallback];
+    function callback(certificate) {
+      if (currentBadCertificateCallback == null) return false;
+      return currentBadCertificateCallback(certificate, uriHost, uriPort);
+    }
+    dart.fn(callback, X509CertificateTobool());
+    let socketFuture = dart.test(this.isSecure) && dart.test(proxy.isDirect) ? io.SecureSocket.connect(this.host, this.port, {context: this.context, onBadCertificate: callback}) : io.Socket.connect(this.host, this.port);
+    this[_connecting] = dart.notNull(this[_connecting]) + 1;
+    return socketFuture.then(io._ConnectionInfo)(dart.fn(socket => {
+      this[_connecting] = dart.notNull(this[_connecting]) - 1;
+      dart.dsend(socket, 'setOption', io.SocketOption.TCP_NODELAY, true);
+      let connection = new io._HttpClientConnection(this.key, io.Socket._check(socket), client, false, this.context);
+      if (dart.test(this.isSecure) && !dart.test(proxy.isDirect)) {
+        connection[_dispose] = true;
+        return connection.createProxyTunnel(uriHost, uriPort, proxy, callback).then(io._ConnectionInfo)(dart.fn(tunnel => {
+          client[_getConnectionTarget](uriHost, uriPort, true).addNewActive(tunnel);
+          return new io._ConnectionInfo(tunnel, proxy);
+        }, _HttpClientConnectionTo_ConnectionInfo()));
+      } else {
+        this.addNewActive(connection);
+        return new io._ConnectionInfo(connection, proxy);
+      }
+    }, dynamicToFutureOrOf_ConnectionInfo()), {onError: dart.fn(error => {
+        this[_connecting] = dart.notNull(this[_connecting]) - 1;
+        this[_checkPending]();
+        dart.throw(error);
+      }, dynamicToNull())});
+  }
+};
+dart.setSignature(io._ConnectionTarget, {
+  constructors: () => ({new: dart.definiteFunctionType(io._ConnectionTarget, [core.String, core.String, core.int, core.bool, io.SecurityContext])}),
+  fields: () => ({
+    key: core.String,
+    host: core.String,
+    port: core.int,
+    isSecure: core.bool,
+    context: io.SecurityContext,
+    [_idle]: SetOf_HttpClientConnection(),
+    [_active]: SetOf_HttpClientConnection(),
+    [_pending]: collection.Queue,
+    [_connecting]: core.int
+  }),
+  getters: () => ({
+    isEmpty: dart.definiteFunctionType(core.bool, []),
+    hasIdle: dart.definiteFunctionType(core.bool, []),
+    hasActive: dart.definiteFunctionType(core.bool, [])
+  }),
+  methods: () => ({
+    takeIdle: dart.definiteFunctionType(io._HttpClientConnection, []),
+    [_checkPending]: dart.definiteFunctionType(dart.dynamic, []),
+    addNewActive: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+    returnConnection: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+    connectionClosed: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+    close: dart.definiteFunctionType(dart.void, [core.bool]),
+    connect: dart.definiteFunctionType(async.Future$(io._ConnectionInfo), [core.String, core.int, io._Proxy, io._HttpClient])
+  })
+});
+io.BadCertificateCallback = dart.typedef('BadCertificateCallback', () => dart.functionType(core.bool, [io.X509Certificate, core.String, core.int]));
+const _idleTimeout = Symbol('_idleTimeout');
+let const;
+const _connectionTargets = Symbol('_connectionTargets');
+const _credentials = Symbol('_credentials');
+const _closing = Symbol('_closing');
+const _closingForcefully = Symbol('_closingForcefully');
+const _findProxy = Symbol('_findProxy');
+const _openUrl = Symbol('_openUrl');
+const _closeConnections = Symbol('_closeConnections');
+let const;
+const _getConnection = Symbol('_getConnection');
+io._HttpClient = class _HttpClient extends core.Object {
+  get idleTimeout() {
+    return this[_idleTimeout];
+  }
+  new(context) {
+    this[_connectionTargets] = HashMapOfString$_ConnectionTarget().new();
+    this[_credentials] = JSArrayOf_Credentials().of([]);
+    this[_proxyCredentials] = JSArrayOf_ProxyCredentials().of([]);
+    this.userAgent = io._getHttpVersion();
+    this[_context] = context;
+    this[_closing] = false;
+    this[_closingForcefully] = false;
+    this[_authenticate] = null;
+    this[_authenticateProxy] = null;
+    this[_findProxy] = io.HttpClient.findProxyFromEnvironment;
+    this[_idleTimeout] = const || (const = dart.const(new core.Duration({seconds: 15})));
+    this[_badCertificateCallback] = null;
+    this.maxConnectionsPerHost = null;
+    this.autoUncompress = true;
+  }
+  set idleTimeout(timeout) {
+    this[_idleTimeout] = timeout;
+    for (let c of this[_connectionTargets][dartx.values]) {
+      for (let idle of c[_idle]) {
+        idle.stopTimer();
+        idle.startTimer();
+      }
+    }
+  }
+  set badCertificateCallback(callback) {
+    this[_badCertificateCallback] = callback;
+  }
+  open(method, host, port, path) {
+    let hashMark = 35;
+    let questionMark = 63;
+    let fragmentStart = path[dartx.length];
+    let queryStart = path[dartx.length];
+    for (let i = dart.notNull(path[dartx.length]) - 1; i >= 0; i--) {
+      let char = path[dartx.codeUnitAt](i);
+      if (char == hashMark) {
+        fragmentStart = i;
+        queryStart = i;
+      } else if (char == questionMark) {
+        queryStart = i;
+      }
+    }
+    let query = null;
+    if (dart.notNull(queryStart) < dart.notNull(fragmentStart)) {
+      query = path[dartx.substring](dart.notNull(queryStart) + 1, fragmentStart);
+      path = path[dartx.substring](0, queryStart);
+    }
+    let uri = core.Uri.new({scheme: "http", host: host, port: port, path: path, query: query});
+    return this[_openUrl](method, uri);
+  }
+  openUrl(method, url) {
+    return this[_openUrl](method, url);
+  }
+  get(host, port, path) {
+    return this.open("get", host, port, path);
+  }
+  getUrl(url) {
+    return this[_openUrl]("get", url);
+  }
+  post(host, port, path) {
+    return this.open("post", host, port, path);
+  }
+  postUrl(url) {
+    return this[_openUrl]("post", url);
+  }
+  put(host, port, path) {
+    return this.open("put", host, port, path);
+  }
+  putUrl(url) {
+    return this[_openUrl]("put", url);
+  }
+  delete(host, port, path) {
+    return this.open("delete", host, port, path);
+  }
+  deleteUrl(url) {
+    return this[_openUrl]("delete", url);
+  }
+  head(host, port, path) {
+    return this.open("head", host, port, path);
+  }
+  headUrl(url) {
+    return this[_openUrl]("head", url);
+  }
+  patch(host, port, path) {
+    return this.open("patch", host, port, path);
+  }
+  patchUrl(url) {
+    return this[_openUrl]("patch", url);
+  }
+  close(opts) {
+    let force = opts && 'force' in opts ? opts.force : false;
+    this[_closing] = true;
+    this[_closingForcefully] = force;
+    this[_closeConnections](this[_closingForcefully]);
+    dart.assert(!dart.test(this[_connectionTargets][dartx.values][dartx.any](dart.fn(s => s.hasIdle, _ConnectionTargetTobool()))));
+    dart.assert(!dart.test(force) || !dart.test(this[_connectionTargets][dartx.values][dartx.any](dart.fn(s => s[_active].isNotEmpty, _ConnectionTargetTobool()))));
+  }
+  set authenticate(f) {
+    this[_authenticate] = f;
+  }
+  addCredentials(url, realm, cr) {
+    this[_credentials][dartx.add](new io._SiteCredentials(url, realm, io._HttpClientCredentials._check(cr)));
+  }
+  set authenticateProxy(f) {
+    this[_authenticateProxy] = f;
+  }
+  addProxyCredentials(host, port, realm, cr) {
+    this[_proxyCredentials][dartx.add](new io._ProxyCredentials(host, port, realm, io._HttpClientCredentials._check(cr)));
+  }
+  set findProxy(f) {
+    return this[_findProxy] = f;
+  }
+  [_openUrl](method, uri) {
+    uri = uri.removeFragment();
+    if (method == null) {
+      dart.throw(new core.ArgumentError(method));
+    }
+    if (method != "CONNECT") {
+      if (dart.test(uri.host[dartx.isEmpty])) {
+        dart.throw(new core.ArgumentError(dart.str`No host specified in URI ${uri}`));
+      } else if (uri.scheme != "http" && uri.scheme != "https") {
+        dart.throw(new core.ArgumentError(dart.str`Unsupported scheme '${uri.scheme}' in URI ${uri}`));
+      }
+    }
+    let isSecure = uri.scheme == "https";
+    let port = uri.port;
+    if (port == 0) {
+      port = isSecure ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT;
+    }
+    let proxyConf = const || (const = dart.const(new io._ProxyConfiguration.direct()));
+    if (this[_findProxy] != null) {
+      try {
+        proxyConf = new io._ProxyConfiguration(core.String._check(dart.dcall(this[_findProxy], uri)));
+      } catch (error) {
+        let stackTrace = dart.stackTrace(error);
+        return FutureOf_HttpClientRequest().error(error, stackTrace);
+      }
+
+    }
+    return this[_getConnection](uri.host, port, proxyConf, isSecure).then(io._HttpClientRequest)(dart.fn(info => {
+      function send(info) {
+        return info.connection.send(uri, port, method[dartx.toUpperCase](), info.proxy);
+      }
+      dart.fn(send, _ConnectionInfoTo_HttpClientRequest());
+      if (dart.test(info.connection.closed)) {
+        return this[_getConnection](uri.host, port, proxyConf, isSecure).then(io._HttpClientRequest)(send);
+      }
+      return send(info);
+    }, _ConnectionInfoToFutureOrOf_HttpClientRequest()));
+  }
+  [_openUrlFromRequest](method, uri, previous) {
+    let resolved = previous.uri.resolveUri(uri);
+    return this[_openUrl](method, resolved).then(io._HttpClientRequest)(dart.fn(request => {
+      request.followRedirects = previous.followRedirects;
+      request.maxRedirects = previous.maxRedirects;
+      for (let header of previous.headers[_headers][dartx.keys]) {
+        if (request.headers._get(header) == null) {
+          request.headers.set(header, previous.headers._get(header));
+        }
+      }
+      request.headers.chunkedTransferEncoding = false;
+      request.contentLength = 0;
+      return request;
+    }, _HttpClientRequestTo_HttpClientRequest()));
+  }
+  [_returnConnection](connection) {
+    this[_connectionTargets][dartx._get](connection.key).returnConnection(connection);
+    this[_connectionsChanged]();
+  }
+  [_connectionClosed](connection) {
+    connection.stopTimer();
+    let connectionTarget = this[_connectionTargets][dartx._get](connection.key);
+    if (connectionTarget != null) {
+      connectionTarget.connectionClosed(connection);
+      if (dart.test(connectionTarget.isEmpty)) {
+        this[_connectionTargets][dartx.remove](connection.key);
+      }
+      this[_connectionsChanged]();
+    }
+  }
+  [_connectionsChanged]() {
+    if (dart.test(this[_closing])) {
+      this[_closeConnections](this[_closingForcefully]);
+    }
+  }
+  [_closeConnections](force) {
+    for (let connectionTarget of this[_connectionTargets][dartx.values][dartx.toList]()) {
+      connectionTarget.close(force);
+    }
+  }
+  [_getConnectionTarget](host, port, isSecure) {
+    let key = core.String._check(io._HttpClientConnection.makeKey(isSecure, host, port));
+    return this[_connectionTargets][dartx.putIfAbsent](key, dart.fn(() => new io._ConnectionTarget(key, host, port, isSecure, this[_context]), VoidTo_ConnectionTarget()));
+  }
+  [_getConnection](uriHost, uriPort, proxyConf, isSecure) {
+    let proxies = proxyConf.proxies[dartx.iterator];
+    const connect = (function(error) {
+      if (!dart.test(proxies.moveNext())) return FutureOf_ConnectionInfo().error(error);
+      let proxy = proxies.current;
+      let host = dart.test(proxy.isDirect) ? uriHost : proxy.host;
+      let port = dart.test(proxy.isDirect) ? uriPort : proxy.port;
+      return this[_getConnectionTarget](host, port, isSecure).connect(uriHost, uriPort, proxy, this).catchError(connect);
+    }).bind(this);
+    dart.fn(connect, dynamicToFutureOf_ConnectionInfo());
+    return FutureOf_ConnectionInfo().new(dart.fn(() => connect(new io.HttpException("No proxies given")), VoidToFutureOf_ConnectionInfo()));
+  }
+  [_findCredentials](url, scheme) {
+    if (scheme === void 0) scheme = null;
+    let cr = this[_credentials][dartx.fold](io._SiteCredentials)(null, dart.fn((prev, value) => {
+      let siteCredentials = io._SiteCredentials.as(value);
+      if (dart.test(siteCredentials.applies(url, scheme))) {
+        if (prev == null) return io._SiteCredentials._check(value);
+        return dart.notNull(siteCredentials.uri.path[dartx.length]) > dart.notNull(prev.uri.path[dartx.length]) ? siteCredentials : prev;
+      } else {
+        return prev;
+      }
+    }, _SiteCredentialsAnd_CredentialsTo_SiteCredentials()));
+    return cr;
+  }
+  [_findProxyCredentials](proxy, scheme) {
+    if (scheme === void 0) scheme = null;
+    let it = this[_proxyCredentials][dartx.iterator];
+    while (dart.test(it.moveNext())) {
+      if (dart.test(it.current.applies(proxy, scheme))) {
+        return it.current;
+      }
+    }
+    return null;
+  }
+  [_removeCredentials](cr) {
+    let index = this[_credentials][dartx.indexOf](cr);
+    if (index != -1) {
+      this[_credentials][dartx.removeAt](index);
+    }
+  }
+  [_removeProxyCredentials](cr) {
+    let index = this[_proxyCredentials][dartx.indexOf](io._ProxyCredentials._check(cr));
+    if (index != -1) {
+      this[_proxyCredentials][dartx.removeAt](index);
+    }
+  }
+  static _findProxyFromEnvironment(url, environment) {
+    function checkNoProxy(option) {
+      if (option == null) return null;
+      let names = option[dartx.split](",")[dartx.map](core.String)(dart.fn(s => s[dartx.trim](), StringToString()))[dartx.iterator];
+      while (dart.test(names.moveNext())) {
+        let name = names.current;
+        if (dart.test(name[dartx.startsWith]("[")) && dart.test(name[dartx.endsWith]("]")) && dart.str`[${url.host}]` == name || dart.test(name[dartx.isNotEmpty]) && dart.test(url.host[dartx.endsWith](name))) {
+          return "DIRECT";
+        }
+      }
+      return null;
+    }
+    dart.fn(checkNoProxy, StringToString());
+    function checkProxy(option) {
+      if (option == null) return null;
+      option = option[dartx.trim]();
+      if (dart.test(option[dartx.isEmpty])) return null;
+      let pos = option[dartx.indexOf]("://");
+      if (dart.notNull(pos) >= 0) {
+        option = option[dartx.substring](dart.notNull(pos) + 3);
+      }
+      pos = option[dartx.indexOf]("/");
+      if (dart.notNull(pos) >= 0) {
+        option = option[dartx.substring](0, pos);
+      }
+      if (option[dartx.indexOf]("[") == 0) {
+        let pos = option[dartx.lastIndexOf](":");
+        if (dart.notNull(option[dartx.indexOf]("]")) > dart.notNull(pos)) option = dart.str`${option}:1080`;
+      } else {
+        if (option[dartx.indexOf](":") == -1) option = dart.str`${option}:1080`;
+      }
+      return dart.str`PROXY ${option}`;
+    }
+    dart.fn(checkProxy, StringToString());
+    if (environment == null) environment = io._HttpClient._platformEnvironmentCache;
+    let proxyCfg = null;
+    let noProxy = environment[dartx._get]("no_proxy");
+    if (noProxy == null) noProxy = environment[dartx._get]("NO_PROXY");
+    if ((proxyCfg = checkNoProxy(noProxy)) != null) {
+      return proxyCfg;
+    }
+    if (url.scheme == "http") {
+      let proxy = environment[dartx._get]("http_proxy");
+      if (proxy == null) proxy = environment[dartx._get]("HTTP_PROXY");
+      if ((proxyCfg = checkProxy(proxy)) != null) {
+        return proxyCfg;
+      }
+    } else if (url.scheme == "https") {
+      let proxy = environment[dartx._get]("https_proxy");
+      if (proxy == null) proxy = environment[dartx._get]("HTTPS_PROXY");
+      if ((proxyCfg = checkProxy(proxy)) != null) {
+        return proxyCfg;
+      }
+    }
+    return "DIRECT";
+  }
+};
+io._HttpClient[dart.implements] = () => [io.HttpClient];
+dart.setSignature(io._HttpClient, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpClient, [io.SecurityContext])}),
+  fields: () => ({
+    [_closing]: core.bool,
+    [_closingForcefully]: core.bool,
+    [_connectionTargets]: MapOfString$_ConnectionTarget(),
+    [_credentials]: ListOf_Credentials(),
+    [_proxyCredentials]: ListOf_ProxyCredentials(),
+    [_context]: io.SecurityContext,
+    [_authenticate]: core.Function,
+    [_authenticateProxy]: core.Function,
+    [_findProxy]: core.Function,
+    [_idleTimeout]: core.Duration,
+    [_badCertificateCallback]: io.BadCertificateCallback,
+    maxConnectionsPerHost: core.int,
+    autoUncompress: core.bool,
+    userAgent: core.String
+  }),
+  getters: () => ({idleTimeout: dart.definiteFunctionType(core.Duration, [])}),
+  setters: () => ({
+    idleTimeout: dart.definiteFunctionType(dart.void, [core.Duration]),
+    badCertificateCallback: dart.definiteFunctionType(dart.void, [X509CertificateAndStringAndintTobool()]),
+    authenticate: dart.definiteFunctionType(dart.void, [UriAndStringAndStringToFutureOfbool()]),
+    authenticateProxy: dart.definiteFunctionType(dart.void, [StringAndintAndString__ToFutureOfbool()]),
+    findProxy: dart.definiteFunctionType(dart.void, [UriToString()])
+  }),
+  methods: () => ({
+    open: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.String, core.int, core.String]),
+    openUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.Uri]),
+    get: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+    getUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+    post: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+    postUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+    put: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+    putUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+    delete: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+    deleteUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+    head: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+    headUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+    patch: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+    patchUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+    close: dart.definiteFunctionType(dart.void, [], {force: core.bool}),
+    addCredentials: dart.definiteFunctionType(dart.void, [core.Uri, core.String, io.HttpClientCredentials]),
+    addProxyCredentials: dart.definiteFunctionType(dart.void, [core.String, core.int, core.String, io.HttpClientCredentials]),
+    [_openUrl]: dart.definiteFunctionType(async.Future$(io._HttpClientRequest), [core.String, core.Uri]),
+    [_openUrlFromRequest]: dart.definiteFunctionType(async.Future$(io._HttpClientRequest), [core.String, core.Uri, io._HttpClientRequest]),
+    [_returnConnection]: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+    [_connectionClosed]: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+    [_connectionsChanged]: dart.definiteFunctionType(dart.void, []),
+    [_closeConnections]: dart.definiteFunctionType(dart.void, [core.bool]),
+    [_getConnectionTarget]: dart.definiteFunctionType(io._ConnectionTarget, [core.String, core.int, core.bool]),
+    [_getConnection]: dart.definiteFunctionType(async.Future$(io._ConnectionInfo), [core.String, core.int, io._ProxyConfiguration, core.bool]),
+    [_findCredentials]: dart.definiteFunctionType(io._SiteCredentials, [core.Uri], [io._AuthenticationScheme]),
+    [_findProxyCredentials]: dart.definiteFunctionType(io._ProxyCredentials, [io._Proxy], [io._AuthenticationScheme]),
+    [_removeCredentials]: dart.definiteFunctionType(dart.void, [io._Credentials]),
+    [_removeProxyCredentials]: dart.definiteFunctionType(dart.void, [io._Credentials])
+  }),
+  sfields: () => ({_platformEnvironmentCache: MapOfString$String()}),
+  statics: () => ({_findProxyFromEnvironment: dart.definiteFunctionType(core.String, [core.Uri, MapOfString$String()])}),
+  names: ['_findProxyFromEnvironment']
+});
+dart.defineLazy(io._HttpClient, {
+  get _platformEnvironmentCache() {
+    return io.Platform.environment;
+  },
+  set _platformEnvironmentCache(_) {}
+});
+const _state = Symbol('_state');
+const _idleMark = Symbol('_idleMark');
+const _owner = Symbol('_owner');
+const _serviceId = Symbol('_serviceId');
+const _markActive = Symbol('_markActive');
+const _markIdle = Symbol('_markIdle');
+const _handleRequest = Symbol('_handleRequest');
+const _isActive = Symbol('_isActive');
+const _isIdle = Symbol('_isIdle');
+const _isDetached = Symbol('_isDetached');
+const _serviceTypePath = Symbol('_serviceTypePath');
+const _serviceTypeName = Symbol('_serviceTypeName');
+const _servicePath = Symbol('_servicePath');
+const _serviceType = Symbol('_serviceType');
+const _toJSON = Symbol('_toJSON');
+const __serviceId = Symbol('__serviceId');
+io._ServiceObject = class _ServiceObject extends core.Object {
+  new() {
+    this[__serviceId] = 0;
+  }
+  get [_serviceId]() {
+    if (this[__serviceId] == 0) this[__serviceId] = (() => {
+      let x = io._nextServiceId;
+      io._nextServiceId = dart.notNull(x) + 1;
+      return x;
+    })();
+    return this[__serviceId];
+  }
+  get [_servicePath]() {
+    return dart.str`${this[_serviceTypePath]}/${this[_serviceId]}`;
+  }
+  [_serviceType](ref) {
+    if (dart.test(ref)) return dart.str`@${this[_serviceTypeName]}`;
+    return this[_serviceTypeName];
+  }
+};
+dart.setSignature(io._ServiceObject, {
+  fields: () => ({[__serviceId]: core.int}),
+  getters: () => ({
+    [_serviceId]: dart.definiteFunctionType(core.int, []),
+    [_servicePath]: dart.definiteFunctionType(core.String, [])
+  }),
+  methods: () => ({[_serviceType]: dart.definiteFunctionType(core.String, [core.bool])})
+});
+io._HttpConnection = class _HttpConnection extends dart.mixin(collection.LinkedListEntry, io._ServiceObject) {
+  new(socket, httpServer) {
+    this[_socket] = socket;
+    this[_httpServer] = httpServer;
+    this[_httpParser] = io._HttpParser.requestParser();
+    this[_state] = io._HttpConnection._IDLE;
+    this[_subscription] = null;
+    this[_idleMark] = false;
+    this[_streamFuture] = null;
+    super.new();
+    try {
+      dart.dput(this[_socket], _owner, this);
+    } catch (_) {
+      core.print(_);
+    }
+
+    io._HttpConnection._connections[dartx._set](this[_serviceId], this);
+    this[_httpParser].listenToStream(StreamOfListOfint()._check(this[_socket]));
+    this[_subscription] = this[_httpParser].listen(dart.fn(incoming => {
+      this[_httpServer][_markActive](this);
+      incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
+        if (dart.test(closing)) this.destroy();
+      }, dynamicToNull()));
+      this[_subscription].pause();
+      this[_state] = io._HttpConnection._ACTIVE;
+      let outgoing = new io._HttpOutgoing(io.Socket._check(this[_socket]));
+      let response = new io._HttpResponse(incoming.uri, incoming.headers.protocolVersion, outgoing, this[_httpServer].defaultResponseHeaders, this[_httpServer].serverHeader);
+      let request = new io._HttpRequest(response, incoming, this[_httpServer], this);
+      this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(_ => {
+        response.deadline = null;
+        if (this[_state] == io._HttpConnection._DETACHED) return;
+        if (dart.test(response.persistentConnection) && dart.test(request.persistentConnection) && dart.test(incoming.fullBodyRead) && !dart.test(this[_httpParser].upgrade) && !dart.test(this[_httpServer].closed)) {
+          this[_state] = io._HttpConnection._IDLE;
+          this[_idleMark] = false;
+          this[_httpServer][_markIdle](this);
+          this[_subscription].resume();
+        } else {
+          this.destroy();
+        }
+      }, dynamicToNull()), {onError: dart.fn(_ => {
+          this.destroy();
+        }, dynamicToNull())});
+      outgoing.ignoreBody = request.method == "HEAD";
+      response[_httpRequest] = request;
+      this[_httpServer][_handleRequest](request);
+    }, _HttpIncomingToNull()), {onDone: dart.fn(() => {
+        this.destroy();
+      }, VoidToNull()), onError: dart.fn(error => {
+        this.destroy();
+      }, dynamicToNull())});
+  }
+  markIdle() {
+    this[_idleMark] = true;
+  }
+  get isMarkedIdle() {
+    return this[_idleMark];
+  }
+  destroy() {
+    if (this[_state] == io._HttpConnection._CLOSING || this[_state] == io._HttpConnection._DETACHED) return;
+    this[_state] = io._HttpConnection._CLOSING;
+    dart.dsend(this[_socket], 'destroy');
+    this[_httpServer][_connectionClosed](this);
+    io._HttpConnection._connections[dartx.remove](this[_serviceId]);
+  }
+  detachSocket() {
+    this[_state] = io._HttpConnection._DETACHED;
+    this[_httpServer][_connectionClosed](this);
+    let detachedIncoming = this[_httpParser].detachIncoming();
+    return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => {
+      io._HttpConnection._connections[dartx.remove](this[_serviceId]);
+      return new io._DetachedSocket(this[_socket], detachedIncoming);
+    }, dynamicTo_DetachedSocket()));
+  }
+  get connectionInfo() {
+    return io._HttpConnectionInfo.create(io.Socket._check(this[_socket]));
+  }
+  get [_isActive]() {
+    return this[_state] == io._HttpConnection._ACTIVE;
+  }
+  get [_isIdle]() {
+    return this[_state] == io._HttpConnection._IDLE;
+  }
+  get [_isClosing]() {
+    return this[_state] == io._HttpConnection._CLOSING;
+  }
+  get [_isDetached]() {
+    return this[_state] == io._HttpConnection._DETACHED;
+  }
+  get [_serviceTypePath]() {
+    return 'io/http/serverconnections';
+  }
+  get [_serviceTypeName]() {
+    return 'HttpServerConnection';
+  }
+  [_toJSON](ref) {
+    let name = dart.str`${dart.dload(dart.dload(this[_socket], 'address'), 'host')}:${dart.dload(this[_socket], 'port')} <-> ` + dart.str`${dart.dload(dart.dload(this[_socket], 'remoteAddress'), 'host')}:${dart.dload(this[_socket], 'remotePort')}`;
+    let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: name, user_name: name}, core.String, dart.dynamic);
+    if (dart.test(ref)) {
+      return r;
+    }
+    r[dartx._set]('server', this[_httpServer][_toJSON](true));
+    try {
+      r[dartx._set]('socket', dart.dsend(this[_socket], _toJSON, true));
+    } catch (_) {
+      r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+    }
+
+    switch (this[_state]) {
+      case io._HttpConnection._ACTIVE:
+      {
+        r[dartx._set]('state', "Active");
+        break;
+      }
+      case io._HttpConnection._IDLE:
+      {
+        r[dartx._set]('state', "Idle");
+        break;
+      }
+      case io._HttpConnection._CLOSING:
+      {
+        r[dartx._set]('state', "Closing");
+        break;
+      }
+      case io._HttpConnection._DETACHED:
+      {
+        r[dartx._set]('state', "Detached");
+        break;
+      }
+      default:
+      {
+        r[dartx._set]('state', 'Unknown');
+        break;
+      }
+    }
+    return r;
+  }
+};
+dart.setBaseClass(io._HttpConnection, dart.mixin(collection.LinkedListEntry$(io._HttpConnection), io._ServiceObject));
+dart.addSimpleTypeTests(io._HttpConnection);
+dart.setSignature(io._HttpConnection, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpConnection, [dart.dynamic, io._HttpServer])}),
+  fields: () => ({
+    [_socket]: dart.dynamic,
+    [_httpServer]: io._HttpServer,
+    [_httpParser]: io._HttpParser,
+    [_state]: core.int,
+    [_subscription]: async.StreamSubscription,
+    [_idleMark]: core.bool,
+    [_streamFuture]: async.Future
+  }),
+  getters: () => ({
+    isMarkedIdle: dart.definiteFunctionType(core.bool, []),
+    connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+    [_isActive]: dart.definiteFunctionType(core.bool, []),
+    [_isIdle]: dart.definiteFunctionType(core.bool, []),
+    [_isClosing]: dart.definiteFunctionType(core.bool, []),
+    [_isDetached]: dart.definiteFunctionType(core.bool, []),
+    [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+    [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+  }),
+  methods: () => ({
+    markIdle: dart.definiteFunctionType(dart.void, []),
+    destroy: dart.definiteFunctionType(dart.void, []),
+    detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+    [_toJSON]: dart.definiteFunctionType(core.Map, [core.bool])
+  }),
+  sfields: () => ({
+    _ACTIVE: core.int,
+    _IDLE: core.int,
+    _CLOSING: core.int,
+    _DETACHED: core.int,
+    _connections: MapOfint$_HttpConnection()
+  })
+});
+io._HttpConnection._ACTIVE = 0;
+io._HttpConnection._IDLE = 1;
+io._HttpConnection._CLOSING = 2;
+io._HttpConnection._DETACHED = 3;
+dart.defineLazy(io._HttpConnection, {
+  get _connections() {
+    return HashMapOfint$_HttpConnection().new();
+  },
+  set _connections(_) {}
+});
+const _activeConnections = Symbol('_activeConnections');
+const _idleConnections = Symbol('_idleConnections');
+const _serverSocket = Symbol('_serverSocket');
+const _closeServer = Symbol('_closeServer');
+let const;
+let const;
+io._HttpServer = class _HttpServer extends dart.mixin(async.Stream$(io.HttpRequest), io._ServiceObject) {
+  static bind(address, port, backlog, v6Only, shared) {
+    return io.ServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), ServerSocketTo_HttpServer()));
+  }
+  static bindSecure(address, port, context, backlog, v6Only, requestClientCertificate, shared) {
+    return io.SecureServerSocket.bind(address, port, context, {backlog: backlog, v6Only: v6Only, requestClientCertificate: requestClientCertificate, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), SecureServerSocketTo_HttpServer()));
+  }
+  _(serverSocket, closeServer) {
+    this.defaultResponseHeaders = io._HttpServer._initDefaultResponseHeaders();
+    this[_activeConnections] = new (LinkedListOf_HttpConnection())();
+    this[_idleConnections] = new (LinkedListOf_HttpConnection())();
+    this[_serverSocket] = serverSocket;
+    this[_closeServer] = closeServer;
+    this.serverHeader = null;
+    this.autoCompress = false;
+    this[_idleTimeout] = null;
+    this[_idleTimer] = null;
+    this[_sessionManagerInstance] = null;
+    this.closed = false;
+    this[_controller] = null;
+    super.new();
+    this[_controller] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
+    this.idleTimeout = const || (const = dart.const(new core.Duration({seconds: 120})));
+    io._HttpServer._servers[dartx._set](this[_serviceId], this);
+    dart.dput(this[_serverSocket], _owner, this);
+  }
+  listenOn(serverSocket) {
+    this.defaultResponseHeaders = io._HttpServer._initDefaultResponseHeaders();
+    this[_activeConnections] = new (LinkedListOf_HttpConnection())();
+    this[_idleConnections] = new (LinkedListOf_HttpConnection())();
+    this[_serverSocket] = serverSocket;
+    this[_closeServer] = false;
+    this.serverHeader = null;
+    this.autoCompress = false;
+    this[_idleTimeout] = null;
+    this[_idleTimer] = null;
+    this[_sessionManagerInstance] = null;
+    this.closed = false;
+    this[_controller] = null;
+    super.new();
+    this[_controller] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
+    this.idleTimeout = const || (const = dart.const(new core.Duration({seconds: 120})));
+    io._HttpServer._servers[dartx._set](this[_serviceId], this);
+    try {
+      dart.dput(this[_serverSocket], _owner, this);
+    } catch (_) {
+    }
+
+  }
+  static _initDefaultResponseHeaders() {
+    let defaultResponseHeaders = new io._HttpHeaders('1.1');
+    defaultResponseHeaders.contentType = io.ContentType.TEXT;
+    defaultResponseHeaders.set('X-Frame-Options', 'SAMEORIGIN');
+    defaultResponseHeaders.set('X-Content-Type-Options', 'nosniff');
+    defaultResponseHeaders.set('X-XSS-Protection', '1; mode=block');
+    return defaultResponseHeaders;
+  }
+  get idleTimeout() {
+    return this[_idleTimeout];
+  }
+  set idleTimeout(duration) {
+    if (this[_idleTimer] != null) {
+      this[_idleTimer].cancel();
+      this[_idleTimer] = null;
+    }
+    this[_idleTimeout] = duration;
+    if (this[_idleTimeout] != null) {
+      this[_idleTimer] = async.Timer.periodic(this[_idleTimeout], dart.fn(_ => {
+        for (let idle of this[_idleConnections].toList()) {
+          if (dart.test(idle.isMarkedIdle)) {
+            idle.destroy();
+          } else {
+            idle.markIdle();
+          }
+        }
+      }, TimerToNull()));
+    }
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    dart.dsend(this[_serverSocket], 'listen', dart.fn(socket => {
+      socket.setOption(io.SocketOption.TCP_NODELAY, true);
+      let connection = new io._HttpConnection(socket, this);
+      this[_idleConnections].add(connection);
+    }, SocketToNull()), {onError: dart.fn((error, stackTrace) => {
+        if (!io.HandshakeException.is(error)) {
+          this[_controller].addError(error, core.StackTrace._check(stackTrace));
+        }
+      }, dynamicAnddynamicToNull()), onDone: dart.bind(this[_controller], 'close')});
+    return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  close(opts) {
+    let force = opts && 'force' in opts ? opts.force : false;
+    this.closed = true;
+    let result = null;
+    if (this[_serverSocket] != null && dart.test(this[_closeServer])) {
+      result = async.Future._check(dart.dsend(this[_serverSocket], 'close'));
+    } else {
+      result = async.Future.value();
+    }
+    this.idleTimeout = null;
+    if (dart.test(force)) {
+      for (let c of this[_activeConnections].toList()) {
+        c.destroy();
+      }
+      dart.assert(this[_activeConnections].isEmpty);
+    }
+    for (let c of this[_idleConnections].toList()) {
+      c.destroy();
+    }
+    this[_maybePerformCleanup]();
+    return result;
+  }
+  [_maybePerformCleanup]() {
+    if (dart.test(this.closed) && dart.test(this[_idleConnections].isEmpty) && dart.test(this[_activeConnections].isEmpty) && this[_sessionManagerInstance] != null) {
+      this[_sessionManagerInstance].close();
+      this[_sessionManagerInstance] = null;
+      io._HttpServer._servers[dartx.remove](this[_serviceId]);
+    }
+  }
+  get port() {
+    if (dart.test(this.closed)) dart.throw(new io.HttpException("HttpServer is not bound to a socket"));
+    return core.int._check(dart.dload(this[_serverSocket], 'port'));
+  }
+  get address() {
+    if (dart.test(this.closed)) dart.throw(new io.HttpException("HttpServer is not bound to a socket"));
+    return io.InternetAddress._check(dart.dload(this[_serverSocket], 'address'));
+  }
+  set sessionTimeout(timeout) {
+    this[_sessionManager].sessionTimeout = timeout;
+  }
+  [_handleRequest](request) {
+    if (!dart.test(this.closed)) {
+      this[_controller].add(request);
+    } else {
+      request[_httpConnection].destroy();
+    }
+  }
+  [_connectionClosed](connection) {
+    connection.unlink();
+    this[_maybePerformCleanup]();
+  }
+  [_markIdle](connection) {
+    this[_activeConnections].remove(connection);
+    this[_idleConnections].add(connection);
+  }
+  [_markActive](connection) {
+    this[_idleConnections].remove(connection);
+    this[_activeConnections].add(connection);
+  }
+  get [_sessionManager]() {
+    if (this[_sessionManagerInstance] == null) {
+      this[_sessionManagerInstance] = new io._HttpSessionManager();
+    }
+    return this[_sessionManagerInstance];
+  }
+  connectionsInfo() {
+    let result = new io.HttpConnectionsInfo();
+    result.total = dart.notNull(this[_activeConnections].length) + dart.notNull(this[_idleConnections].length);
+    this[_activeConnections].forEach(dart.fn(conn => {
+      if (dart.test(conn[_isActive])) {
+        result.active = dart.notNull(result.active) + 1;
+      } else {
+        dart.assert(conn[_isClosing]);
+        result.closing = dart.notNull(result.closing) + 1;
+      }
+    }, _HttpConnectionToNull()));
+    this[_idleConnections].forEach(dart.fn(conn => {
+      result.idle = dart.notNull(result.idle) + 1;
+      dart.assert(conn[_isIdle]);
+    }, _HttpConnectionToNull()));
+    return result;
+  }
+  get [_serviceTypePath]() {
+    return 'io/http/servers';
+  }
+  get [_serviceTypeName]() {
+    return 'HttpServer';
+  }
+  [_toJSON](ref) {
+    let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: dart.str`${this.address.host}:${this.port}`, user_name: dart.str`${this.address.host}:${this.port}`}, core.String, dart.dynamic);
+    if (dart.test(ref)) {
+      return r;
+    }
+    try {
+      r[dartx._set]('socket', dart.dsend(this[_serverSocket], _toJSON, true));
+    } catch (_) {
+      r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+    }
+
+    r[dartx._set]('port', this.port);
+    r[dartx._set]('address', this.address.host);
+    r[dartx._set]('active', this[_activeConnections].map(core.Map)(dart.fn(c => c[_toJSON](true), _HttpConnectionToMap()))[dartx.toList]());
+    r[dartx._set]('idle', this[_idleConnections].map(core.Map)(dart.fn(c => c[_toJSON](true), _HttpConnectionToMap()))[dartx.toList]());
+    r[dartx._set]('closed', this.closed);
+    return r;
+  }
+};
+dart.addSimpleTypeTests(io._HttpServer);
+dart.defineNamedConstructor(io._HttpServer, '_');
+dart.defineNamedConstructor(io._HttpServer, 'listenOn');
+io._HttpServer[dart.implements] = () => [io.HttpServer];
+dart.setSignature(io._HttpServer, {
+  constructors: () => ({
+    _: dart.definiteFunctionType(io._HttpServer, [dart.dynamic, core.bool]),
+    listenOn: dart.definiteFunctionType(io._HttpServer, [dart.dynamic])
+  }),
+  fields: () => ({
+    serverHeader: core.String,
+    defaultResponseHeaders: io.HttpHeaders,
+    autoCompress: core.bool,
+    [_idleTimeout]: core.Duration,
+    [_idleTimer]: async.Timer,
+    [_sessionManagerInstance]: io._HttpSessionManager,
+    closed: core.bool,
+    [_serverSocket]: dart.dynamic,
+    [_closeServer]: core.bool,
+    [_activeConnections]: LinkedListOf_HttpConnection(),
+    [_idleConnections]: LinkedListOf_HttpConnection(),
+    [_controller]: StreamControllerOfHttpRequest()
+  }),
+  getters: () => ({
+    idleTimeout: dart.definiteFunctionType(core.Duration, []),
+    port: dart.definiteFunctionType(core.int, []),
+    address: dart.definiteFunctionType(io.InternetAddress, []),
+    [_sessionManager]: dart.definiteFunctionType(io._HttpSessionManager, []),
+    [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+    [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+  }),
+  setters: () => ({
+    idleTimeout: dart.definiteFunctionType(dart.void, [core.Duration]),
+    sessionTimeout: dart.definiteFunctionType(dart.void, [core.int])
+  }),
+  methods: () => ({
+    listen: dart.definiteFunctionType(async.StreamSubscription$(io.HttpRequest), [HttpRequestTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    close: dart.definiteFunctionType(async.Future, [], {force: core.bool}),
+    [_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
+    [_handleRequest]: dart.definiteFunctionType(dart.void, [io._HttpRequest]),
+    [_connectionClosed]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+    [_markIdle]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+    [_markActive]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+    connectionsInfo: dart.definiteFunctionType(io.HttpConnectionsInfo, []),
+    [_toJSON]: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [core.bool])
+  }),
+  sfields: () => ({_servers: MapOfint$_HttpServer()}),
+  statics: () => ({
+    bind: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, core.int, core.bool, core.bool]),
+    bindSecure: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, io.SecurityContext, core.int, core.bool, core.bool, core.bool]),
+    _initDefaultResponseHeaders: dart.definiteFunctionType(io.HttpHeaders, [])
+  }),
+  names: ['bind', 'bindSecure', '_initDefaultResponseHeaders']
+});
+dart.defineLazy(io._HttpServer, {
+  get _servers() {
+    return MapOfint$_HttpServer().new();
+  },
+  set _servers(_) {}
+});
+io._Proxy = class _Proxy extends core.Object {
+  new(host, port, username, password) {
+    this.host = host;
+    this.port = port;
+    this.username = username;
+    this.password = password;
+    this.isDirect = false;
+  }
+  direct() {
+    this.host = null;
+    this.port = null;
+    this.username = null;
+    this.password = null;
+    this.isDirect = true;
+  }
+  get isAuthenticated() {
+    return this.username != null;
+  }
+};
+dart.defineNamedConstructor(io._Proxy, 'direct');
+dart.setSignature(io._Proxy, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io._Proxy, [core.String, core.int, core.String, core.String]),
+    direct: dart.definiteFunctionType(io._Proxy, [])
+  }),
+  fields: () => ({
+    host: core.String,
+    port: core.int,
+    username: core.String,
+    password: core.String,
+    isDirect: core.bool
+  }),
+  getters: () => ({isAuthenticated: dart.definiteFunctionType(core.bool, [])})
+});
+let const;
+let const;
+io._ProxyConfiguration = class _ProxyConfiguration extends core.Object {
+  new(configuration) {
+    this.proxies = ListOf_Proxy().new();
+    if (configuration == null) {
+      dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+    }
+    let list = configuration[dartx.split](";");
+    list[dartx.forEach](dart.fn(proxy => {
+      proxy = proxy[dartx.trim]();
+      if (!dart.test(proxy[dartx.isEmpty])) {
+        if (dart.test(proxy[dartx.startsWith](io._ProxyConfiguration.PROXY_PREFIX))) {
+          let username = null;
+          let password = null;
+          proxy = proxy[dartx.substring](io._ProxyConfiguration.PROXY_PREFIX[dartx.length])[dartx.trim]();
+          let at = proxy[dartx.indexOf]("@");
+          if (at != -1) {
+            let userinfo = proxy[dartx.substring](0, at)[dartx.trim]();
+            proxy = proxy[dartx.substring](dart.notNull(at) + 1)[dartx.trim]();
+            let colon = userinfo[dartx.indexOf](":");
+            if (colon == -1 || colon == 0 || colon == dart.notNull(proxy[dartx.length]) - 1) {
+              dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+            }
+            username = userinfo[dartx.substring](0, colon)[dartx.trim]();
+            password = userinfo[dartx.substring](dart.notNull(colon) + 1)[dartx.trim]();
+          }
+          let colon = proxy[dartx.lastIndexOf](":");
+          if (colon == -1 || colon == 0 || colon == dart.notNull(proxy[dartx.length]) - 1) {
+            dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+          }
+          let host = proxy[dartx.substring](0, colon)[dartx.trim]();
+          if (dart.test(host[dartx.startsWith]("[")) && dart.test(host[dartx.endsWith]("]"))) {
+            host = host[dartx.substring](1, dart.notNull(host[dartx.length]) - 1);
+          }
+          let portString = proxy[dartx.substring](dart.notNull(colon) + 1)[dartx.trim]();
+          let port = null;
+          try {
+            port = core.int.parse(portString);
+          } catch (e) {
+            if (core.FormatException.is(e)) {
+              dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}, ` + dart.str`invalid port '${portString}'`));
+            } else
+              throw e;
+          }
+
+          this.proxies[dartx.add](new io._Proxy(host, port, username, password));
+        } else if (proxy[dartx.trim]() == io._ProxyConfiguration.DIRECT_PREFIX) {
+          this.proxies[dartx.add](new io._Proxy.direct());
+        } else {
+          dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+        }
+      }
+    }, StringToNull()));
+  }
+  direct() {
+    this.proxies = const || (const = dart.constList([const || (const = dart.const(new io._Proxy.direct()))], io._Proxy));
+  }
+};
+dart.defineNamedConstructor(io._ProxyConfiguration, 'direct');
+dart.setSignature(io._ProxyConfiguration, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io._ProxyConfiguration, [core.String]),
+    direct: dart.definiteFunctionType(io._ProxyConfiguration, [])
+  }),
+  fields: () => ({proxies: ListOf_Proxy()}),
+  sfields: () => ({
+    PROXY_PREFIX: core.String,
+    DIRECT_PREFIX: core.String
+  })
+});
+io._ProxyConfiguration.PROXY_PREFIX = "PROXY ";
+io._ProxyConfiguration.DIRECT_PREFIX = "DIRECT";
+io._HttpConnectionInfo = class _HttpConnectionInfo extends core.Object {
+  new() {
+    this.remoteAddress = null;
+    this.remotePort = null;
+    this.localPort = null;
+  }
+  static create(socket) {
+    if (socket == null) return null;
+    try {
+      let info = new io._HttpConnectionInfo();
+      info.remoteAddress = socket.remoteAddress;
+      info.remotePort = socket.remotePort;
+      info.localPort = socket.port;
+      return info;
+    } catch (e) {
+    }
+
+    return null;
+  }
+};
+io._HttpConnectionInfo[dart.implements] = () => [io.HttpConnectionInfo];
+dart.setSignature(io._HttpConnectionInfo, {
+  fields: () => ({
+    remoteAddress: io.InternetAddress,
+    remotePort: core.int,
+    localPort: core.int
+  }),
+  statics: () => ({create: dart.definiteFunctionType(io._HttpConnectionInfo, [io.Socket])}),
+  names: ['create']
+});
+io._DetachedSocket = class _DetachedSocket extends async.Stream$(core.List$(core.int)) {
+  new(socket, incoming) {
+    this[_socket] = socket;
+    this[_incoming] = incoming;
+    super.new();
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  get encoding() {
+    return convert.Encoding._check(dart.dload(this[_socket], 'encoding'));
+  }
+  set encoding(value) {
+    dart.dput(this[_socket], 'encoding', value);
+  }
+  write(obj) {
+    dart.dsend(this[_socket], 'write', obj);
+  }
+  writeln(obj) {
+    if (obj === void 0) obj = "";
+    dart.dsend(this[_socket], 'writeln', obj);
+  }
+  writeCharCode(charCode) {
+    dart.dsend(this[_socket], 'writeCharCode', charCode);
+  }
+  writeAll(objects, separator) {
+    if (separator === void 0) separator = "";
+    dart.dsend(this[_socket], 'writeAll', objects, separator);
+  }
+  add(bytes) {
+    dart.dsend(this[_socket], 'add', bytes);
+  }
+  addError(error, stackTrace) {
+    if (stackTrace === void 0) stackTrace = null;
+    return dart.dsend(this[_socket], 'addError', error, stackTrace);
+  }
+  addStream(stream) {
+    return FutureOfSocket()._check(dart.dsend(this[_socket], 'addStream', stream));
+  }
+  destroy() {
+    dart.dsend(this[_socket], 'destroy');
+  }
+  flush() {
+    return async.Future._check(dart.dsend(this[_socket], 'flush'));
+  }
+  close() {
+    return async.Future._check(dart.dsend(this[_socket], 'close'));
+  }
+  get done() {
+    return FutureOfSocket()._check(dart.dload(this[_socket], 'done'));
+  }
+  get port() {
+    return core.int._check(dart.dload(this[_socket], 'port'));
+  }
+  get address() {
+    return io.InternetAddress._check(dart.dload(this[_socket], 'address'));
+  }
+  get remoteAddress() {
+    return io.InternetAddress._check(dart.dload(this[_socket], 'remoteAddress'));
+  }
+  get remotePort() {
+    return core.int._check(dart.dload(this[_socket], 'remotePort'));
+  }
+  setOption(option, enabled) {
+    return core.bool._check(dart.dsend(this[_socket], 'setOption', option, enabled));
+  }
+  [_toJSON](ref) {
+    return core.Map._check(dart.dsend(this[_socket], _toJSON, ref));
+  }
+  set [_owner](owner) {
+    dart.dput(this[_socket], _owner, owner);
+  }
+};
+dart.addSimpleTypeTests(io._DetachedSocket);
+io._DetachedSocket[dart.implements] = () => [io.Socket];
+dart.setSignature(io._DetachedSocket, {
+  constructors: () => ({new: dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic, StreamOfListOfint()])}),
+  fields: () => ({
+    [_incoming]: StreamOfListOfint(),
+    [_socket]: dart.dynamic
+  }),
+  getters: () => ({
+    encoding: dart.definiteFunctionType(convert.Encoding, []),
+    done: dart.definiteFunctionType(async.Future$(io.Socket), []),
+    port: dart.definiteFunctionType(core.int, []),
+    address: dart.definiteFunctionType(io.InternetAddress, []),
+    remoteAddress: dart.definiteFunctionType(io.InternetAddress, []),
+    remotePort: dart.definiteFunctionType(core.int, [])
+  }),
+  setters: () => ({
+    encoding: dart.definiteFunctionType(dart.void, [convert.Encoding]),
+    [_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])
+  }),
+  methods: () => ({
+    listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    write: dart.definiteFunctionType(dart.void, [core.Object]),
+    writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+    writeCharCode: dart.definiteFunctionType(dart.void, [core.int]),
+    writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+    add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+    addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+    addStream: dart.definiteFunctionType(async.Future$(io.Socket), [StreamOfListOfint()]),
+    destroy: dart.definiteFunctionType(dart.void, []),
+    flush: dart.definiteFunctionType(async.Future, []),
+    close: dart.definiteFunctionType(async.Future, []),
+    setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
+    [_toJSON]: dart.definiteFunctionType(core.Map, [core.bool])
+  })
+});
+const _scheme = Symbol('_scheme');
+io._AuthenticationScheme = class _AuthenticationScheme extends core.Object {
+  new(scheme) {
+    this[_scheme] = scheme;
+  }
+  static fromString(scheme) {
+    if (scheme[dartx.toLowerCase]() == "basic") return io._AuthenticationScheme.BASIC;
+    if (scheme[dartx.toLowerCase]() == "digest") return io._AuthenticationScheme.DIGEST;
+    return io._AuthenticationScheme.UNKNOWN;
+  }
+  toString() {
+    if (dart.equals(this, io._AuthenticationScheme.BASIC)) return "Basic";
+    if (dart.equals(this, io._AuthenticationScheme.DIGEST)) return "Digest";
+    return "Unknown";
+  }
+};
+dart.setSignature(io._AuthenticationScheme, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io._AuthenticationScheme, [core.int]),
+    fromString: dart.definiteFunctionType(io._AuthenticationScheme, [core.String])
+  }),
+  fields: () => ({[_scheme]: core.int}),
+  sfields: () => ({
+    UNKNOWN: io._AuthenticationScheme,
+    BASIC: io._AuthenticationScheme,
+    DIGEST: io._AuthenticationScheme
+  })
+});
+dart.defineLazy(io._AuthenticationScheme, {
+  get UNKNOWN() {
+    return dart.const(new io._AuthenticationScheme(-1));
+  },
+  get BASIC() {
+    return dart.const(new io._AuthenticationScheme(0));
+  },
+  get DIGEST() {
+    return dart.const(new io._AuthenticationScheme(1));
+  }
+});
+io._Credentials = class _Credentials extends core.Object {
+  new(credentials, realm) {
+    this.credentials = credentials;
+    this.realm = realm;
+    this.used = false;
+    this.ha1 = null;
+    this.nonce = null;
+    this.algorithm = null;
+    this.qop = null;
+    this.nonceCount = null;
+    if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST)) {
+      let creds = io._HttpClientDigestCredentials._check(this.credentials);
+      let hasher = new io._MD5();
+      hasher.add(convert.UTF8.encode(creds.username));
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(this.realm[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(convert.UTF8.encode(creds.password));
+      this.ha1 = io._CryptoUtils.bytesToHex(hasher.close());
+    }
+  }
+  get scheme() {
+    return this.credentials.scheme;
+  }
+};
+dart.setSignature(io._Credentials, {
+  constructors: () => ({new: dart.definiteFunctionType(io._Credentials, [io._HttpClientCredentials, core.String])}),
+  fields: () => ({
+    credentials: io._HttpClientCredentials,
+    realm: core.String,
+    used: core.bool,
+    ha1: core.String,
+    nonce: core.String,
+    algorithm: core.String,
+    qop: core.String,
+    nonceCount: core.int
+  }),
+  getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])})
+});
+io._SiteCredentials = class _SiteCredentials extends io._Credentials {
+  new(uri, realm, creds) {
+    this.uri = uri;
+    super.new(creds, core.String._check(realm));
+  }
+  applies(uri, scheme) {
+    if (scheme != null && !dart.equals(this.credentials.scheme, scheme)) return false;
+    if (uri.host != this.uri.host) return false;
+    let thisPort = this.uri.port == 0 ? io.HttpClient.DEFAULT_HTTP_PORT : this.uri.port;
+    let otherPort = uri.port == 0 ? io.HttpClient.DEFAULT_HTTP_PORT : uri.port;
+    if (otherPort != thisPort) return false;
+    return uri.path[dartx.startsWith](this.uri.path);
+  }
+  authorize(request) {
+    if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST) && this.nonce == null) {
+      return;
+    }
+    this.credentials.authorize(this, request);
+    this.used = true;
+  }
+};
+dart.setSignature(io._SiteCredentials, {
+  constructors: () => ({new: dart.definiteFunctionType(io._SiteCredentials, [core.Uri, dart.dynamic, io._HttpClientCredentials])}),
+  fields: () => ({uri: core.Uri}),
+  methods: () => ({
+    applies: dart.definiteFunctionType(core.bool, [core.Uri, io._AuthenticationScheme]),
+    authorize: dart.definiteFunctionType(dart.void, [io.HttpClientRequest])
+  })
+});
+io._ProxyCredentials = class _ProxyCredentials extends io._Credentials {
+  new(host, port, realm, creds) {
+    this.host = host;
+    this.port = port;
+    super.new(creds, core.String._check(realm));
+  }
+  applies(proxy, scheme) {
+    if (scheme != null && !dart.equals(this.credentials.scheme, scheme)) return false;
+    return proxy.host == this.host && proxy.port == this.port;
+  }
+  authorize(request) {
+    if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST) && this.nonce == null) {
+      return;
+    }
+    this.credentials.authorizeProxy(this, request);
+  }
+};
+dart.setSignature(io._ProxyCredentials, {
+  constructors: () => ({new: dart.definiteFunctionType(io._ProxyCredentials, [core.String, core.int, dart.dynamic, io._HttpClientCredentials])}),
+  fields: () => ({
+    host: core.String,
+    port: core.int
+  }),
+  methods: () => ({
+    applies: dart.definiteFunctionType(core.bool, [io._Proxy, io._AuthenticationScheme]),
+    authorize: dart.definiteFunctionType(dart.void, [io.HttpClientRequest])
+  })
+});
+io._HttpClientCredentials = class _HttpClientCredentials extends core.Object {};
+io._HttpClientCredentials[dart.implements] = () => [io.HttpClientCredentials];
+io._HttpClientBasicCredentials = class _HttpClientBasicCredentials extends io._HttpClientCredentials {
+  new(username, password) {
+    this.username = username;
+    this.password = password;
+  }
+  get scheme() {
+    return io._AuthenticationScheme.BASIC;
+  }
+  authorization() {
+    let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${this.username}:${this.password}`));
+    return dart.str`Basic ${auth}`;
+  }
+  authorize(_, request) {
+    request.headers.set(io.HttpHeaders.AUTHORIZATION, this.authorization());
+  }
+  authorizeProxy(_, request) {
+    request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, this.authorization());
+  }
+};
+io._HttpClientBasicCredentials[dart.implements] = () => [io.HttpClientBasicCredentials];
+dart.setSignature(io._HttpClientBasicCredentials, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpClientBasicCredentials, [core.String, core.String])}),
+  fields: () => ({
+    username: core.String,
+    password: core.String
+  }),
+  getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])}),
+  methods: () => ({
+    authorization: dart.definiteFunctionType(core.String, []),
+    authorize: dart.definiteFunctionType(dart.void, [io._Credentials, io.HttpClientRequest]),
+    authorizeProxy: dart.definiteFunctionType(dart.void, [io._ProxyCredentials, io.HttpClientRequest])
+  })
+});
+io._HttpClientDigestCredentials = class _HttpClientDigestCredentials extends io._HttpClientCredentials {
+  new(username, password) {
+    this.username = username;
+    this.password = password;
+  }
+  get scheme() {
+    return io._AuthenticationScheme.DIGEST;
+  }
+  authorization(credentials, request) {
+    let requestUri = request[_requestUri]();
+    let hasher = new io._MD5();
+    hasher.add(request.method[dartx.codeUnits]);
+    hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+    hasher.add(requestUri[dartx.codeUnits]);
+    let ha2 = io._CryptoUtils.bytesToHex(hasher.close());
+    let qop = null;
+    let cnonce = null;
+    let nc = null;
+    let x = null;
+    hasher = new io._MD5();
+    hasher.add(credentials.ha1[dartx.codeUnits]);
+    hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+    if (credentials.qop == "auth") {
+      qop = credentials.qop;
+      cnonce = io._CryptoUtils.bytesToHex(io._IOCrypto.getRandomBytes(4));
+      credentials.nonceCount = dart.notNull(credentials.nonceCount) + 1;
+      nc = credentials.nonceCount[dartx.toRadixString](16);
+      nc = dart.notNull("00000000"[dartx.substring](0, 8 - dart.notNull(nc[dartx.length]) + 1)) + dart.notNull(nc);
+      hasher.add(credentials.nonce[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(nc[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(cnonce[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(credentials.qop[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(ha2[dartx.codeUnits]);
+    } else {
+      hasher.add(credentials.nonce[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(ha2[dartx.codeUnits]);
+    }
+    let response = io._CryptoUtils.bytesToHex(hasher.close());
+    let buffer = new core.StringBuffer();
+    buffer.write('Digest ');
+    buffer.write(dart.str`username="${this.username}"`);
+    buffer.write(dart.str`, realm="${credentials.realm}"`);
+    buffer.write(dart.str`, nonce="${credentials.nonce}"`);
+    buffer.write(dart.str`, uri="${requestUri}"`);
+    buffer.write(dart.str`, algorithm="${credentials.algorithm}"`);
+    if (qop == "auth") {
+      buffer.write(dart.str`, qop="${qop}"`);
+      buffer.write(dart.str`, cnonce="${cnonce}"`);
+      buffer.write(dart.str`, nc="${nc}"`);
+    }
+    buffer.write(dart.str`, response="${response}"`);
+    return buffer.toString();
+  }
+  authorize(credentials, request) {
+    request.headers.set(io.HttpHeaders.AUTHORIZATION, this.authorization(credentials, io._HttpClientRequest._check(request)));
+  }
+  authorizeProxy(credentials, request) {
+    request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, this.authorization(credentials, io._HttpClientRequest._check(request)));
+  }
+};
+io._HttpClientDigestCredentials[dart.implements] = () => [io.HttpClientDigestCredentials];
+dart.setSignature(io._HttpClientDigestCredentials, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpClientDigestCredentials, [core.String, core.String])}),
+  fields: () => ({
+    username: core.String,
+    password: core.String
+  }),
+  getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])}),
+  methods: () => ({
+    authorization: dart.definiteFunctionType(core.String, [io._Credentials, io._HttpClientRequest]),
+    authorize: dart.definiteFunctionType(dart.void, [io._Credentials, io.HttpClientRequest]),
+    authorizeProxy: dart.definiteFunctionType(dart.void, [io._ProxyCredentials, io.HttpClientRequest])
+  })
+});
+io._RedirectInfo = class _RedirectInfo extends core.Object {
+  new(statusCode, method, location) {
+    this.statusCode = statusCode;
+    this.method = method;
+    this.location = location;
+  }
+};
+io._RedirectInfo[dart.implements] = () => [io.RedirectInfo];
+dart.setSignature(io._RedirectInfo, {
+  constructors: () => ({new: dart.definiteFunctionType(io._RedirectInfo, [core.int, core.String, core.Uri])}),
+  fields: () => ({
+    statusCode: core.int,
+    method: core.String,
+    location: core.Uri
+  })
+});
+io._getHttpVersion = function() {
+  let version = io.Platform.version;
+  let index = version[dartx.indexOf]('.', dart.notNull(version[dartx.indexOf]('.')) + 1);
+  version = version[dartx.substring](0, index);
+  return dart.str`Dart/${version} (dart:io)`;
+};
+dart.fn(io._getHttpVersion, VoidToString());
+io._Const = class _Const extends core.Object {};
+dart.setSignature(io._Const, {
+  sfields: () => ({
+    HTTP: ListOfint(),
+    HTTP1DOT: ListOfint(),
+    HTTP10: ListOfint(),
+    HTTP11: ListOfint(),
+    T: core.bool,
+    F: core.bool,
+    SEPARATOR_MAP: ListOfbool()
+  })
+});
+io._Const.HTTP = dart.constList([72, 84, 84, 80], core.int);
+io._Const.HTTP1DOT = dart.constList([72, 84, 84, 80, 47, 49, 46], core.int);
+io._Const.HTTP10 = dart.constList([72, 84, 84, 80, 47, 49, 46, 48], core.int);
+io._Const.HTTP11 = dart.constList([72, 84, 84, 80, 47, 49, 46, 49], core.int);
+io._Const.T = true;
+io._Const.F = false;
+dart.defineLazy(io._Const, {
+  get SEPARATOR_MAP() {
+    return dart.constList([io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F], core.bool);
+  }
+});
+io._CharCode = class _CharCode extends core.Object {};
+dart.setSignature(io._CharCode, {
+  sfields: () => ({
+    HT: core.int,
+    LF: core.int,
+    CR: core.int,
+    SP: core.int,
+    AMPERSAND: core.int,
+    COMMA: core.int,
+    DASH: core.int,
+    SLASH: core.int,
+    ZERO: core.int,
+    ONE: core.int,
+    COLON: core.int,
+    SEMI_COLON: core.int,
+    EQUAL: core.int
+  })
+});
+io._CharCode.HT = 9;
+io._CharCode.LF = 10;
+io._CharCode.CR = 13;
+io._CharCode.SP = 32;
+io._CharCode.AMPERSAND = 38;
+io._CharCode.COMMA = 44;
+io._CharCode.DASH = 45;
+io._CharCode.SLASH = 47;
+io._CharCode.ZERO = 48;
+io._CharCode.ONE = 49;
+io._CharCode.COLON = 58;
+io._CharCode.SEMI_COLON = 59;
+io._CharCode.EQUAL = 61;
+io._State = class _State extends core.Object {};
+dart.setSignature(io._State, {
+  sfields: () => ({
+    START: core.int,
+    METHOD_OR_RESPONSE_HTTP_VERSION: core.int,
+    RESPONSE_HTTP_VERSION: core.int,
+    REQUEST_LINE_METHOD: core.int,
+    REQUEST_LINE_URI: core.int,
+    REQUEST_LINE_HTTP_VERSION: core.int,
+    REQUEST_LINE_ENDING: core.int,
+    RESPONSE_LINE_STATUS_CODE: core.int,
+    RESPONSE_LINE_REASON_PHRASE: core.int,
+    RESPONSE_LINE_ENDING: core.int,
+    HEADER_START: core.int,
+    HEADER_FIELD: core.int,
+    HEADER_VALUE_START: core.int,
+    HEADER_VALUE: core.int,
+    HEADER_VALUE_FOLDING_OR_ENDING: core.int,
+    HEADER_VALUE_FOLD_OR_END: core.int,
+    HEADER_ENDING: core.int,
+    CHUNK_SIZE_STARTING_CR: core.int,
+    CHUNK_SIZE_STARTING_LF: core.int,
+    CHUNK_SIZE: core.int,
+    CHUNK_SIZE_EXTENSION: core.int,
+    CHUNK_SIZE_ENDING: core.int,
+    CHUNKED_BODY_DONE_CR: core.int,
+    CHUNKED_BODY_DONE_LF: core.int,
+    BODY: core.int,
+    CLOSED: core.int,
+    UPGRADED: core.int,
+    FAILURE: core.int,
+    FIRST_BODY_STATE: core.int
+  })
+});
+io._State.START = 0;
+io._State.METHOD_OR_RESPONSE_HTTP_VERSION = 1;
+io._State.RESPONSE_HTTP_VERSION = 2;
+io._State.REQUEST_LINE_METHOD = 3;
+io._State.REQUEST_LINE_URI = 4;
+io._State.REQUEST_LINE_HTTP_VERSION = 5;
+io._State.REQUEST_LINE_ENDING = 6;
+io._State.RESPONSE_LINE_STATUS_CODE = 7;
+io._State.RESPONSE_LINE_REASON_PHRASE = 8;
+io._State.RESPONSE_LINE_ENDING = 9;
+io._State.HEADER_START = 10;
+io._State.HEADER_FIELD = 11;
+io._State.HEADER_VALUE_START = 12;
+io._State.HEADER_VALUE = 13;
+io._State.HEADER_VALUE_FOLDING_OR_ENDING = 14;
+io._State.HEADER_VALUE_FOLD_OR_END = 15;
+io._State.HEADER_ENDING = 16;
+io._State.CHUNK_SIZE_STARTING_CR = 17;
+io._State.CHUNK_SIZE_STARTING_LF = 18;
+io._State.CHUNK_SIZE = 19;
+io._State.CHUNK_SIZE_EXTENSION = 20;
+io._State.CHUNK_SIZE_ENDING = 21;
+io._State.CHUNKED_BODY_DONE_CR = 22;
+io._State.CHUNKED_BODY_DONE_LF = 23;
+io._State.BODY = 24;
+io._State.CLOSED = 25;
+io._State.UPGRADED = 26;
+io._State.FAILURE = 27;
+dart.defineLazy(io._State, {
+  get FIRST_BODY_STATE() {
+    return io._State.CHUNK_SIZE_STARTING_CR;
+  }
+});
+io._HttpVersion = class _HttpVersion extends core.Object {};
+dart.setSignature(io._HttpVersion, {
+  sfields: () => ({
+    UNDETERMINED: core.int,
+    HTTP10: core.int,
+    HTTP11: core.int
+  })
+});
+io._HttpVersion.UNDETERMINED = 0;
+io._HttpVersion.HTTP10 = 1;
+io._HttpVersion.HTTP11 = 2;
+io._MessageType = class _MessageType extends core.Object {};
+dart.setSignature(io._MessageType, {
+  sfields: () => ({
+    UNDETERMINED: core.int,
+    REQUEST: core.int,
+    RESPONSE: core.int
+  })
+});
+io._MessageType.UNDETERMINED = 0;
+io._MessageType.REQUEST = 1;
+io._MessageType.RESPONSE = 0;
+const _injectData = Symbol('_injectData');
+const _userOnData = Symbol('_userOnData');
+const _isCanceled = Symbol('_isCanceled');
+const _pauseCount = Symbol('_pauseCount');
+const _scheduled = Symbol('_scheduled');
+const _maybeScheduleData = Symbol('_maybeScheduleData');
+io._HttpDetachedStreamSubscription = class _HttpDetachedStreamSubscription extends core.Object {
+  new(subscription, injectData, userOnData) {
+    this[_subscription] = subscription;
+    this[_injectData] = injectData;
+    this[_userOnData] = userOnData;
+    this[_isCanceled] = false;
+    this[_pauseCount] = 1;
+    this[_scheduled] = false;
+  }
+  get isPaused() {
+    return this[_subscription].isPaused;
+  }
+  asFuture(T) {
+    return futureValue => {
+      if (futureValue === void 0) futureValue = null;
+      return this[_subscription].asFuture(T)(futureValue);
+    };
+  }
+  cancel() {
+    this[_isCanceled] = true;
+    this[_injectData] = null;
+    return this[_subscription].cancel();
+  }
+  onData(handleData) {
+    this[_userOnData] = handleData;
+    this[_subscription].onData(handleData);
+  }
+  onDone(handleDone) {
+    this[_subscription].onDone(handleDone);
+  }
+  onError(handleError) {
+    this[_subscription].onError(handleError);
+  }
+  pause(resumeSignal) {
+    if (resumeSignal === void 0) resumeSignal = null;
+    if (this[_injectData] == null) {
+      this[_subscription].pause(resumeSignal);
+    } else {
+      this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
+      if (resumeSignal != null) {
+        resumeSignal.whenComplete(dart.bind(this, 'resume'));
+      }
+    }
+  }
+  resume() {
+    if (this[_injectData] == null) {
+      this[_subscription].resume();
+    } else {
+      this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1;
+      this[_maybeScheduleData]();
+    }
+  }
+  [_maybeScheduleData]() {
+    if (dart.test(this[_scheduled])) return;
+    if (this[_pauseCount] != 0) return;
+    this[_scheduled] = true;
+    async.scheduleMicrotask(dart.fn(() => {
+      this[_scheduled] = false;
+      if (dart.notNull(this[_pauseCount]) > 0 || dart.test(this[_isCanceled])) return;
+      let data = this[_injectData];
+      this[_injectData] = null;
+      this[_subscription].resume();
+      if (this[_userOnData] != null) {
+        dart.dcall(this[_userOnData], data);
+      }
+    }, VoidToNull()));
+  }
+};
+io._HttpDetachedStreamSubscription[dart.implements] = () => [StreamSubscriptionOfListOfint()];
+dart.setSignature(io._HttpDetachedStreamSubscription, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpDetachedStreamSubscription, [StreamSubscriptionOfListOfint(), ListOfint(), core.Function])}),
+  fields: () => ({
+    [_subscription]: StreamSubscriptionOfListOfint(),
+    [_injectData]: ListOfint(),
+    [_isCanceled]: core.bool,
+    [_pauseCount]: core.int,
+    [_userOnData]: core.Function,
+    [_scheduled]: core.bool
+  }),
+  getters: () => ({isPaused: dart.definiteFunctionType(core.bool, [])}),
+  methods: () => ({
+    asFuture: dart.definiteFunctionType(T => [async.Future$(T), [], [T]]),
+    cancel: dart.definiteFunctionType(async.Future, []),
+    onData: dart.definiteFunctionType(dart.void, [ListOfintTovoid()]),
+    onDone: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
+    onError: dart.definiteFunctionType(dart.void, [core.Function]),
+    pause: dart.definiteFunctionType(dart.void, [], [async.Future]),
+    resume: dart.definiteFunctionType(dart.void, []),
+    [_maybeScheduleData]: dart.definiteFunctionType(dart.void, [])
+  })
+});
+io._HttpDetachedIncoming = class _HttpDetachedIncoming extends async.Stream$(core.List$(core.int)) {
+  new(subscription, bufferedData) {
+    this.subscription = subscription;
+    this.bufferedData = bufferedData;
+    super.new();
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    if (this.subscription != null) {
+      this.subscription.onData(onData);
+      this.subscription.onError(onError);
+      this.subscription.onDone(onDone);
+      if (this.bufferedData == null) {
+        return StreamSubscriptionOfListOfint()._check(((() => {
+          this.subscription.resume();
+          return this.subscription;
+        })()));
+      }
+      let _ = new io._HttpDetachedStreamSubscription(StreamSubscriptionOfListOfint()._check(this.subscription), this.bufferedData, onData);
+      _.resume();
+      return _;
+    } else {
+      return StreamOfint().fromIterable(this.bufferedData).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+  }
+};
+dart.addSimpleTypeTests(io._HttpDetachedIncoming);
+dart.setSignature(io._HttpDetachedIncoming, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpDetachedIncoming, [async.StreamSubscription, ListOfint()])}),
+  fields: () => ({
+    subscription: async.StreamSubscription,
+    bufferedData: ListOfint()
+  }),
+  methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+});
+const _method = Symbol('_method');
+const _uri_or_reason_phrase = Symbol('_uri_or_reason_phrase');
+const _headerField = Symbol('_headerField');
+const _headerValue = Symbol('_headerValue');
+const _requestParser = Symbol('_requestParser');
+const _parserCalled = Symbol('_parserCalled');
+const _index = Symbol('_index');
+const _httpVersionIndex = Symbol('_httpVersionIndex');
+const _messageType = Symbol('_messageType');
+const _statusCodeLength = Symbol('_statusCodeLength');
+const _httpVersion = Symbol('_httpVersion');
+const _connectionUpgrade = Symbol('_connectionUpgrade');
+const _chunked = Symbol('_chunked');
+const _noMessageBody = Symbol('_noMessageBody');
+const _remainingContent = Symbol('_remainingContent');
+const _socketSubscription = Symbol('_socketSubscription');
+const _paused = Symbol('_paused');
+const _bodyPaused = Symbol('_bodyPaused');
+const _bodyController = Symbol('_bodyController');
+const _pauseStateChanged = Symbol('_pauseStateChanged');
+const _reset = Symbol('_reset');
+const _onData = Symbol('_onData');
+const _onDone = Symbol('_onDone');
+const _doParse = Symbol('_doParse');
+const _reportError = Symbol('_reportError');
+const _createIncoming = Symbol('_createIncoming');
+const _closeIncoming = Symbol('_closeIncoming');
+const _headersEnd = Symbol('_headersEnd');
+const _expect = Symbol('_expect');
+const _caseInsensitiveCompare = Symbol('_caseInsensitiveCompare');
+const _expectHexDigit = Symbol('_expectHexDigit');
+const _releaseBuffer = Symbol('_releaseBuffer');
+io._HttpParser = class _HttpParser extends async.Stream$(io._HttpIncoming) {
+  static requestParser() {
+    return new io._HttpParser._(true);
+  }
+  static responseParser() {
+    return new io._HttpParser._(false);
+  }
+  _(requestParser) {
+    this[_method] = JSArrayOfint().of([]);
+    this[_uri_or_reason_phrase] = JSArrayOfint().of([]);
+    this[_headerField] = JSArrayOfint().of([]);
+    this[_headerValue] = JSArrayOfint().of([]);
+    this[_requestParser] = requestParser;
+    this[_parserCalled] = false;
+    this[_buffer] = null;
+    this[_index] = null;
+    this[_state] = null;
+    this[_httpVersionIndex] = null;
+    this[_messageType] = null;
+    this[_statusCode] = 0;
+    this[_statusCodeLength] = 0;
+    this[_httpVersion] = null;
+    this[_transferLength] = -1;
+    this[_persistentConnection] = null;
+    this[_connectionUpgrade] = null;
+    this[_chunked] = null;
+    this[_noMessageBody] = false;
+    this[_remainingContent] = -1;
+    this[_headers] = null;
+    this[_incoming] = null;
+    this[_socketSubscription] = null;
+    this[_paused] = true;
+    this[_bodyPaused] = false;
+    this[_controller] = null;
+    this[_bodyController] = null;
+    super.new();
+    this[_controller] = StreamControllerOf_HttpIncoming().new({sync: true, onListen: dart.fn(() => {
+        this[_paused] = false;
+      }, VoidToNull()), onPause: dart.fn(() => {
+        this[_paused] = true;
+        this[_pauseStateChanged]();
+      }, VoidToNull()), onResume: dart.fn(() => {
+        this[_paused] = false;
+        this[_pauseStateChanged]();
+      }, VoidToNull()), onCancel: dart.fn(() => {
+        if (this[_socketSubscription] != null) {
+          this[_socketSubscription].cancel();
+        }
+      }, VoidToNull())});
+    this[_reset]();
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  listenToStream(stream) {
+    this[_socketSubscription] = stream.listen(dart.bind(this, _onData), {onError: dart.bind(this[_controller], 'addError'), onDone: dart.bind(this, _onDone)});
+  }
+  [_parse]() {
+    try {
+      this[_doParse]();
+    } catch (e) {
+      let s = dart.stackTrace(e);
+      this[_state] = io._State.FAILURE;
+      this[_reportError](e, s);
+    }
+
+  }
+  [_headersEnd]() {
+    this[_headers][_mutable] = false;
+    this[_transferLength] = this[_headers].contentLength;
+    if (dart.test(this[_chunked])) this[_transferLength] = -1;
+    if (this[_messageType] == io._MessageType.REQUEST && dart.notNull(this[_transferLength]) < 0 && this[_chunked] == false) {
+      this[_transferLength] = 0;
+    }
+    if (dart.test(this[_connectionUpgrade])) {
+      this[_state] = io._State.UPGRADED;
+      this[_transferLength] = 0;
+    }
+    this[_createIncoming](this[_transferLength]);
+    if (dart.test(this[_requestParser])) {
+      this[_incoming].method = core.String.fromCharCodes(this[_method]);
+      this[_incoming].uri = core.Uri.parse(core.String.fromCharCodes(this[_uri_or_reason_phrase]));
+    } else {
+      this[_incoming].statusCode = this[_statusCode];
+      this[_incoming].reasonPhrase = core.String.fromCharCodes(this[_uri_or_reason_phrase]);
+    }
+    this[_method][dartx.clear]();
+    this[_uri_or_reason_phrase][dartx.clear]();
+    if (dart.test(this[_connectionUpgrade])) {
+      this[_incoming].upgraded = true;
+      this[_parserCalled] = false;
+      let tmp = this[_incoming];
+      this[_closeIncoming]();
+      this[_controller].add(tmp);
+      return true;
+    }
+    if (this[_transferLength] == 0 || this[_messageType] == io._MessageType.RESPONSE && dart.test(this[_noMessageBody])) {
+      this[_reset]();
+      let tmp = this[_incoming];
+      this[_closeIncoming]();
+      this[_controller].add(tmp);
+      return false;
+    } else if (dart.test(this[_chunked])) {
+      this[_state] = io._State.CHUNK_SIZE;
+      this[_remainingContent] = 0;
+    } else if (dart.notNull(this[_transferLength]) > 0) {
+      this[_remainingContent] = this[_transferLength];
+      this[_state] = io._State.BODY;
+    } else {
+      this[_state] = io._State.BODY;
+    }
+    this[_parserCalled] = false;
+    this[_controller].add(this[_incoming]);
+    return true;
+  }
+  [_doParse]() {
+    dart.assert(!dart.test(this[_parserCalled]));
+    this[_parserCalled] = true;
+    if (this[_state] == io._State.CLOSED) {
+      dart.throw(new io.HttpException("Data on closed connection"));
+    }
+    if (this[_state] == io._State.FAILURE) {
+      dart.throw(new io.HttpException("Data on failed connection"));
+    }
+    while (this[_buffer] != null && dart.notNull(this[_index]) < dart.notNull(this[_buffer][dartx.length]) && this[_state] != io._State.FAILURE && this[_state] != io._State.UPGRADED) {
+      if (this[_incoming] != null && dart.test(this[_bodyPaused]) || this[_incoming] == null && dart.test(this[_paused])) {
+        this[_parserCalled] = false;
+        return;
+      }
+      let byte = this[_buffer][dartx._get]((() => {
+        let x = this[_index];
+        this[_index] = dart.notNull(x) + 1;
+        return x;
+      })());
+      switch (this[_state]) {
+        case io._State.START:
+        {
+          if (byte == io._Const.HTTP[dartx._get](0)) {
+            this[_httpVersionIndex] = 1;
+            this[_state] = io._State.METHOD_OR_RESPONSE_HTTP_VERSION;
+          } else {
+            if (!dart.test(io._HttpParser._isTokenChar(byte))) {
+              dart.throw(new io.HttpException("Invalid request method"));
+            }
+            this[_method][dartx.add](byte);
+            if (!dart.test(this[_requestParser])) {
+              dart.throw(new io.HttpException("Invalid response line"));
+            }
+            this[_state] = io._State.REQUEST_LINE_METHOD;
+          }
+          break;
+        }
+        case io._State.METHOD_OR_RESPONSE_HTTP_VERSION:
+        {
+          if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP[dartx.length]) && byte == io._Const.HTTP[dartx._get](this[_httpVersionIndex])) {
+            this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+          } else if (this[_httpVersionIndex] == io._Const.HTTP[dartx.length] && byte == io._CharCode.SLASH) {
+            this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            if (dart.test(this[_requestParser])) {
+              dart.throw(new io.HttpException("Invalid request line"));
+            }
+            this[_state] = io._State.RESPONSE_HTTP_VERSION;
+          } else {
+            for (let i = 0; i < dart.notNull(this[_httpVersionIndex]); i++) {
+              this[_method][dartx.add](io._Const.HTTP[dartx._get](i));
+            }
+            if (byte == io._CharCode.SP) {
+              this[_state] = io._State.REQUEST_LINE_URI;
+            } else {
+              this[_method][dartx.add](byte);
+              this[_httpVersion] = io._HttpVersion.UNDETERMINED;
+              if (!dart.test(this[_requestParser])) {
+                dart.throw(new io.HttpException("Invalid response line"));
+              }
+              this[_state] = io._State.REQUEST_LINE_METHOD;
+            }
+          }
+          break;
+        }
+        case io._State.RESPONSE_HTTP_VERSION:
+        {
+          if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP1DOT[dartx.length])) {
+            this[_expect](byte, io._Const.HTTP1DOT[dartx._get](this[_httpVersionIndex]));
+            this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+          } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length] && byte == io._CharCode.ONE) {
+            this[_httpVersion] = io._HttpVersion.HTTP11;
+            this[_persistentConnection] = true;
+            this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+          } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length] && byte == io._CharCode.ZERO) {
+            this[_httpVersion] = io._HttpVersion.HTTP10;
+            this[_persistentConnection] = false;
+            this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+          } else if (this[_httpVersionIndex] == dart.notNull(io._Const.HTTP1DOT[dartx.length]) + 1) {
+            this[_expect](byte, io._CharCode.SP);
+            this[_state] = io._State.RESPONSE_LINE_STATUS_CODE;
+          } else {
+            dart.throw(new io.HttpException("Invalid response line"));
+          }
+          break;
+        }
+        case io._State.REQUEST_LINE_METHOD:
+        {
+          if (byte == io._CharCode.SP) {
+            this[_state] = io._State.REQUEST_LINE_URI;
+          } else {
+            if (dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte)) || byte == io._CharCode.CR || byte == io._CharCode.LF) {
+              dart.throw(new io.HttpException("Invalid request method"));
+            }
+            this[_method][dartx.add](byte);
+          }
+          break;
+        }
+        case io._State.REQUEST_LINE_URI:
+        {
+          if (byte == io._CharCode.SP) {
+            if (this[_uri_or_reason_phrase][dartx.length] == 0) {
+              dart.throw(new io.HttpException("Invalid request URI"));
+            }
+            this[_state] = io._State.REQUEST_LINE_HTTP_VERSION;
+            this[_httpVersionIndex] = 0;
+          } else {
+            if (byte == io._CharCode.CR || byte == io._CharCode.LF) {
+              dart.throw(new io.HttpException("Invalid request URI"));
+            }
+            this[_uri_or_reason_phrase][dartx.add](byte);
+          }
+          break;
+        }
+        case io._State.REQUEST_LINE_HTTP_VERSION:
+        {
+          if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP1DOT[dartx.length])) {
+            this[_expect](byte, io._Const.HTTP11[dartx._get](this[_httpVersionIndex]));
+            this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+          } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length]) {
+            if (byte == io._CharCode.ONE) {
+              this[_httpVersion] = io._HttpVersion.HTTP11;
+              this[_persistentConnection] = true;
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (byte == io._CharCode.ZERO) {
+              this[_httpVersion] = io._HttpVersion.HTTP10;
+              this[_persistentConnection] = false;
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else {
+              dart.throw(new io.HttpException("Invalid response line"));
+            }
+          } else {
+            if (byte == io._CharCode.CR) {
+              this[_state] = io._State.REQUEST_LINE_ENDING;
+            } else {
+              this[_expect](byte, io._CharCode.LF);
+              this[_messageType] = io._MessageType.REQUEST;
+              this[_state] = io._State.HEADER_START;
+            }
+          }
+          break;
+        }
+        case io._State.REQUEST_LINE_ENDING:
+        {
+          this[_expect](byte, io._CharCode.LF);
+          this[_messageType] = io._MessageType.REQUEST;
+          this[_state] = io._State.HEADER_START;
+          break;
+        }
+        case io._State.RESPONSE_LINE_STATUS_CODE:
+        {
+          if (byte == io._CharCode.SP) {
+            this[_state] = io._State.RESPONSE_LINE_REASON_PHRASE;
+          } else if (byte == io._CharCode.CR) {
+            this[_state] = io._State.RESPONSE_LINE_ENDING;
+          } else {
+            this[_statusCodeLength] = dart.notNull(this[_statusCodeLength]) + 1;
+            if (dart.notNull(byte) < 48 && 57 < dart.notNull(byte) || dart.notNull(this[_statusCodeLength]) > 3) {
+              dart.throw(new io.HttpException("Invalid response status code"));
+            } else {
+              this[_statusCode] = dart.notNull(this[_statusCode]) * 10 + dart.notNull(byte) - 48;
+            }
+          }
+          break;
+        }
+        case io._State.RESPONSE_LINE_REASON_PHRASE:
+        {
+          if (byte == io._CharCode.CR) {
+            this[_state] = io._State.RESPONSE_LINE_ENDING;
+          } else {
+            if (byte == io._CharCode.CR || byte == io._CharCode.LF) {
+              dart.throw(new io.HttpException("Invalid response reason phrase"));
+            }
+            this[_uri_or_reason_phrase][dartx.add](byte);
+          }
+          break;
+        }
+        case io._State.RESPONSE_LINE_ENDING:
+        {
+          this[_expect](byte, io._CharCode.LF);
+          this[_messageType] == io._MessageType.RESPONSE;
+          if (dart.notNull(this[_statusCode]) < 100 || dart.notNull(this[_statusCode]) > 599) {
+            dart.throw(new io.HttpException("Invalid response status code"));
+          } else {
+            if (dart.notNull(this[_statusCode]) <= 199 || this[_statusCode] == 204 || this[_statusCode] == 304) {
+              this[_noMessageBody] = true;
+            }
+          }
+          this[_state] = io._State.HEADER_START;
+          break;
+        }
+        case io._State.HEADER_START:
+        {
+          this[_headers] = new io._HttpHeaders(this.version);
+          if (byte == io._CharCode.CR) {
+            this[_state] = io._State.HEADER_ENDING;
+          } else if (byte == io._CharCode.LF) {
+            this[_state] = io._State.HEADER_ENDING;
+            this[_index] = dart.notNull(this[_index]) - 1;
+          } else {
+            this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+            this[_state] = io._State.HEADER_FIELD;
+          }
+          break;
+        }
+        case io._State.HEADER_FIELD:
+        {
+          if (byte == io._CharCode.COLON) {
+            this[_state] = io._State.HEADER_VALUE_START;
+          } else {
+            if (!dart.test(io._HttpParser._isTokenChar(byte))) {
+              dart.throw(new io.HttpException("Invalid header field name"));
+            }
+            this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+          }
+          break;
+        }
+        case io._State.HEADER_VALUE_START:
+        {
+          if (byte == io._CharCode.CR) {
+            this[_state] = io._State.HEADER_VALUE_FOLDING_OR_ENDING;
+          } else if (byte == io._CharCode.LF) {
+            this[_state] = io._State.HEADER_VALUE_FOLD_OR_END;
+          } else if (byte != io._CharCode.SP && byte != io._CharCode.HT) {
+            this[_headerValue][dartx.add](byte);
+            this[_state] = io._State.HEADER_VALUE;
+          }
+          break;
+        }
+        case io._State.HEADER_VALUE:
+        {
+          if (byte == io._CharCode.CR) {
+            this[_state] = io._State.HEADER_VALUE_FOLDING_OR_ENDING;
+          } else if (byte == io._CharCode.LF) {
+            this[_state] = io._State.HEADER_VALUE_FOLD_OR_END;
+          } else {
+            this[_headerValue][dartx.add](byte);
+          }
+          break;
+        }
+        case io._State.HEADER_VALUE_FOLDING_OR_ENDING:
+        {
+          this[_expect](byte, io._CharCode.LF);
+          this[_state] = io._State.HEADER_VALUE_FOLD_OR_END;
+          break;
+        }
+        case io._State.HEADER_VALUE_FOLD_OR_END:
+        {
+          if (byte == io._CharCode.SP || byte == io._CharCode.HT) {
+            this[_state] = io._State.HEADER_VALUE_START;
+          } else {
+            let headerField = core.String.fromCharCodes(this[_headerField]);
+            let headerValue = core.String.fromCharCodes(this[_headerValue]);
+            if (headerField == "transfer-encoding" && dart.test(this[_caseInsensitiveCompare]("chunked"[dartx.codeUnits], this[_headerValue]))) {
+              this[_chunked] = true;
+            }
+            if (headerField == "connection") {
+              let tokens = io._HttpParser._tokenizeFieldValue(headerValue);
+              for (let i = 0; i < dart.notNull(tokens[dartx.length]); i++) {
+                if (dart.test(this[_caseInsensitiveCompare]("upgrade"[dartx.codeUnits], tokens[dartx._get](i)[dartx.codeUnits]))) {
+                  this[_connectionUpgrade] = true;
+                }
+                this[_headers][_add](headerField, tokens[dartx._get](i));
+              }
+            } else {
+              this[_headers][_add](headerField, headerValue);
+            }
+            this[_headerField][dartx.clear]();
+            this[_headerValue][dartx.clear]();
+            if (byte == io._CharCode.CR) {
+              this[_state] = io._State.HEADER_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state] = io._State.HEADER_ENDING;
+              this[_index] = dart.notNull(this[_index]) - 1;
+            } else {
+              this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+              this[_state] = io._State.HEADER_FIELD;
+            }
+          }
+          break;
+        }
+        case io._State.HEADER_ENDING:
+        {
+          this[_expect](byte, io._CharCode.LF);
+          if (dart.test(this[_headersEnd]())) {
+            return;
+          } else {
+            break;
+          }
+          return;
+        }
+        case io._State.CHUNK_SIZE_STARTING_CR:
+        {
+          this[_expect](byte, io._CharCode.CR);
+          this[_state] = io._State.CHUNK_SIZE_STARTING_LF;
+          break;
+        }
+        case io._State.CHUNK_SIZE_STARTING_LF:
+        {
+          this[_expect](byte, io._CharCode.LF);
+          this[_state] = io._State.CHUNK_SIZE;
+          break;
+        }
+        case io._State.CHUNK_SIZE:
+        {
+          if (byte == io._CharCode.CR) {
+            this[_state] = io._State.CHUNK_SIZE_ENDING;
+          } else if (byte == io._CharCode.SEMI_COLON) {
+            this[_state] = io._State.CHUNK_SIZE_EXTENSION;
+          } else {
+            let value = this[_expectHexDigit](byte);
+            this[_remainingContent] = dart.notNull(this[_remainingContent]) * 16 + dart.notNull(value);
+          }
+          break;
+        }
+        case io._State.CHUNK_SIZE_EXTENSION:
+        {
+          if (byte == io._CharCode.CR) {
+            this[_state] = io._State.CHUNK_SIZE_ENDING;
+          }
+          break;
+        }
+        case io._State.CHUNK_SIZE_ENDING:
+        {
+          this[_expect](byte, io._CharCode.LF);
+          if (dart.notNull(this[_remainingContent]) > 0) {
+            this[_state] = io._State.BODY;
+          } else {
+            this[_state] = io._State.CHUNKED_BODY_DONE_CR;
+          }
+          break;
+        }
+        case io._State.CHUNKED_BODY_DONE_CR:
+        {
+          this[_expect](byte, io._CharCode.CR);
+          this[_state] = io._State.CHUNKED_BODY_DONE_LF;
+          break;
+        }
+        case io._State.CHUNKED_BODY_DONE_LF:
+        {
+          this[_expect](byte, io._CharCode.LF);
+          this[_reset]();
+          this[_closeIncoming]();
+          break;
+        }
+        case io._State.BODY:
+        {
+          this[_index] = dart.notNull(this[_index]) - 1;
+          let dataAvailable = dart.notNull(this[_buffer][dartx.length]) - dart.notNull(this[_index]);
+          if (dart.notNull(this[_remainingContent]) >= 0 && dart.notNull(dataAvailable) > dart.notNull(this[_remainingContent])) {
+            dataAvailable = this[_remainingContent];
+          }
+          let data = typed_data.Uint8List.view(this[_buffer][dartx.buffer], dart.notNull(this[_buffer][dartx.offsetInBytes]) + dart.notNull(this[_index]), dataAvailable);
+          this[_bodyController].add(data);
+          if (this[_remainingContent] != -1) {
+            this[_remainingContent] = dart.notNull(this[_remainingContent]) - dart.notNull(data[dartx.length]);
+          }
+          this[_index] = dart.notNull(this[_index]) + dart.notNull(data[dartx.length]);
+          if (this[_remainingContent] == 0) {
+            if (!dart.test(this[_chunked])) {
+              this[_reset]();
+              this[_closeIncoming]();
+            } else {
+              this[_state] = io._State.CHUNK_SIZE_STARTING_CR;
+            }
+          }
+          break;
+        }
+        case io._State.FAILURE:
+        {
+          dart.assert(false);
+          break;
+        }
+        default:
+        {
+          dart.assert(false);
+          break;
+        }
+      }
+    }
+    this[_parserCalled] = false;
+    if (this[_buffer] != null && this[_index] == this[_buffer][dartx.length]) {
+      this[_releaseBuffer]();
+      if (this[_state] != io._State.UPGRADED && this[_state] != io._State.FAILURE) {
+        this[_socketSubscription].resume();
+      }
+    }
+  }
+  [_onData](buffer) {
+    this[_socketSubscription].pause();
+    dart.assert(this[_buffer] == null);
+    this[_buffer] = typed_data.Uint8List._check(buffer);
+    this[_index] = 0;
+    this[_parse]();
+  }
+  [_onDone]() {
+    this[_socketSubscription] = null;
+    if (this[_state] == io._State.CLOSED || this[_state] == io._State.FAILURE) return;
+    if (this[_incoming] != null) {
+      if (this[_state] != io._State.UPGRADED && !(this[_state] == io._State.START && !dart.test(this[_requestParser])) && !(this[_state] == io._State.BODY && !dart.test(this[_chunked]) && this[_transferLength] == -1)) {
+        this[_bodyController].addError(new io.HttpException("Connection closed while receiving data"));
+      }
+      this[_closeIncoming](true);
+      this[_controller].close();
+      return;
+    }
+    if (this[_state] == io._State.START) {
+      if (!dart.test(this[_requestParser])) {
+        this[_reportError](new io.HttpException("Connection closed before full header was received"));
+      }
+      this[_controller].close();
+      return;
+    }
+    if (this[_state] == io._State.UPGRADED) {
+      this[_controller].close();
+      return;
+    }
+    if (dart.notNull(this[_state]) < io._State.FIRST_BODY_STATE) {
+      this[_state] = io._State.FAILURE;
+      this[_reportError](new io.HttpException("Connection closed before full header was received"));
+      this[_controller].close();
+      return;
+    }
+    if (!dart.test(this[_chunked]) && this[_transferLength] == -1) {
+      this[_state] = io._State.CLOSED;
+    } else {
+      this[_state] = io._State.FAILURE;
+      this[_reportError](new io.HttpException("Connection closed before full body was received"));
+    }
+    this[_controller].close();
+  }
+  get version() {
+    switch (this[_httpVersion]) {
+      case io._HttpVersion.HTTP10:
+      {
+        return "1.0";
+      }
+      case io._HttpVersion.HTTP11:
+      {
+        return "1.1";
+      }
+    }
+    return null;
+  }
+  get messageType() {
+    return this[_messageType];
+  }
+  get transferLength() {
+    return this[_transferLength];
+  }
+  get upgrade() {
+    return dart.test(this[_connectionUpgrade]) && this[_state] == io._State.UPGRADED;
+  }
+  get persistentConnection() {
+    return this[_persistentConnection];
+  }
+  set isHead(value) {
+    if (dart.test(value)) this[_noMessageBody] = true;
+  }
+  detachIncoming() {
+    this[_state] = io._State.UPGRADED;
+    return new io._HttpDetachedIncoming(this[_socketSubscription], this.readUnparsedData());
+  }
+  readUnparsedData() {
+    if (this[_buffer] == null) return null;
+    if (this[_index] == this[_buffer][dartx.length]) return null;
+    let result = this[_buffer][dartx.sublist](this[_index]);
+    this[_releaseBuffer]();
+    return result;
+  }
+  [_reset]() {
+    if (this[_state] == io._State.UPGRADED) return;
+    this[_state] = io._State.START;
+    this[_messageType] = io._MessageType.UNDETERMINED;
+    this[_headerField][dartx.clear]();
+    this[_headerValue][dartx.clear]();
+    this[_method][dartx.clear]();
+    this[_uri_or_reason_phrase][dartx.clear]();
+    this[_statusCode] = 0;
+    this[_statusCodeLength] = 0;
+    this[_httpVersion] = io._HttpVersion.UNDETERMINED;
+    this[_transferLength] = -1;
+    this[_persistentConnection] = false;
+    this[_connectionUpgrade] = false;
+    this[_chunked] = false;
+    this[_noMessageBody] = false;
+    this[_remainingContent] = -1;
+    this[_headers] = null;
+  }
+  [_releaseBuffer]() {
+    this[_buffer] = null;
+    this[_index] = null;
+  }
+  static _isTokenChar(byte) {
+    return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 && !dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte));
+  }
+  static _isValueChar(byte) {
+    return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 || byte == io._CharCode.SP || byte == io._CharCode.HT;
+  }
+  static _tokenizeFieldValue(headerValue) {
+    let tokens = ListOfString().new();
+    let start = 0;
+    let index = 0;
+    while (index < dart.notNull(headerValue[dartx.length])) {
+      if (headerValue[dartx._get](index) == ",") {
+        tokens[dartx.add](headerValue[dartx.substring](start, index));
+        start = index + 1;
+      } else if (headerValue[dartx._get](index) == " " || headerValue[dartx._get](index) == "\t") {
+        start++;
+      }
+      index++;
+    }
+    tokens[dartx.add](headerValue[dartx.substring](start, index));
+    return tokens;
+  }
+  static _toLowerCaseByte(x) {
+    return (dart.notNull(x) - 65 & 127) < 26 ? (dart.notNull(x) | 32) >>> 0 : x;
+  }
+  [_caseInsensitiveCompare](expected, value) {
+    if (expected[dartx.length] != value[dartx.length]) return false;
+    for (let i = 0; i < dart.notNull(expected[dartx.length]); i++) {
+      if (expected[dartx._get](i) != io._HttpParser._toLowerCaseByte(value[dartx._get](i))) return false;
+    }
+    return true;
+  }
+  [_expect](val1, val2) {
+    if (val1 != val2) {
+      dart.throw(new io.HttpException("Failed to parse HTTP"));
+    }
+  }
+  [_expectHexDigit](byte) {
+    if (48 <= dart.notNull(byte) && dart.notNull(byte) <= 57) {
+      return dart.notNull(byte) - 48;
+    } else if (65 <= dart.notNull(byte) && dart.notNull(byte) <= 70) {
+      return dart.notNull(byte) - 65 + 10;
+    } else if (97 <= dart.notNull(byte) && dart.notNull(byte) <= 102) {
+      return dart.notNull(byte) - 97 + 10;
+    } else {
+      dart.throw(new io.HttpException("Failed to parse HTTP"));
+    }
+  }
+  [_createIncoming](transferLength) {
+    dart.assert(this[_incoming] == null);
+    dart.assert(this[_bodyController] == null);
+    dart.assert(!dart.test(this[_bodyPaused]));
+    let incoming = null;
+    this[_bodyController] = StreamControllerOfListOfint().new({sync: true, onListen: dart.fn(() => {
+        if (!dart.equals(incoming, this[_incoming])) return;
+        dart.assert(this[_bodyPaused]);
+        this[_bodyPaused] = false;
+        this[_pauseStateChanged]();
+      }, VoidToNull()), onPause: dart.fn(() => {
+        if (!dart.equals(incoming, this[_incoming])) return;
+        dart.assert(!dart.test(this[_bodyPaused]));
+        this[_bodyPaused] = true;
+        this[_pauseStateChanged]();
+      }, VoidToNull()), onResume: dart.fn(() => {
+        if (!dart.equals(incoming, this[_incoming])) return;
+        dart.assert(this[_bodyPaused]);
+        this[_bodyPaused] = false;
+        this[_pauseStateChanged]();
+      }, VoidToNull()), onCancel: dart.fn(() => {
+        if (!dart.equals(incoming, this[_incoming])) return;
+        if (this[_socketSubscription] != null) {
+          this[_socketSubscription].cancel();
+        }
+        this[_closeIncoming](true);
+        this[_controller].close();
+      }, VoidToNull())});
+    incoming = this[_incoming] = new io._HttpIncoming(this[_headers], transferLength, this[_bodyController].stream);
+    this[_bodyPaused] = true;
+    this[_pauseStateChanged]();
+  }
+  [_closeIncoming](closing) {
+    if (closing === void 0) closing = false;
+    if (this[_incoming] == null) return;
+    let tmp = this[_incoming];
+    tmp.close(closing);
+    this[_incoming] = null;
+    if (this[_bodyController] != null) {
+      this[_bodyController].close();
+      this[_bodyController] = null;
+    }
+    this[_bodyPaused] = false;
+    this[_pauseStateChanged]();
+  }
+  [_pauseStateChanged]() {
+    if (this[_incoming] != null) {
+      if (!dart.test(this[_bodyPaused]) && !dart.test(this[_parserCalled])) {
+        this[_parse]();
+      }
+    } else {
+      if (!dart.test(this[_paused]) && !dart.test(this[_parserCalled])) {
+        this[_parse]();
+      }
+    }
+  }
+  [_reportError](error, stackTrace) {
+    if (stackTrace === void 0) stackTrace = null;
+    if (this[_socketSubscription] != null) this[_socketSubscription].cancel();
+    this[_state] = io._State.FAILURE;
+    this[_controller].addError(error, core.StackTrace._check(stackTrace));
+    this[_controller].close();
+  }
+};
+dart.addSimpleTypeTests(io._HttpParser);
+dart.defineNamedConstructor(io._HttpParser, '_');
+dart.setSignature(io._HttpParser, {
+  constructors: () => ({
+    requestParser: dart.definiteFunctionType(io._HttpParser, []),
+    responseParser: dart.definiteFunctionType(io._HttpParser, []),
+    _: dart.definiteFunctionType(io._HttpParser, [core.bool])
+  }),
+  fields: () => ({
+    [_parserCalled]: core.bool,
+    [_buffer]: typed_data.Uint8List,
+    [_index]: core.int,
+    [_requestParser]: core.bool,
+    [_state]: core.int,
+    [_httpVersionIndex]: core.int,
+    [_messageType]: core.int,
+    [_statusCode]: core.int,
+    [_statusCodeLength]: core.int,
+    [_method]: ListOfint(),
+    [_uri_or_reason_phrase]: ListOfint(),
+    [_headerField]: ListOfint(),
+    [_headerValue]: ListOfint(),
+    [_httpVersion]: core.int,
+    [_transferLength]: core.int,
+    [_persistentConnection]: core.bool,
+    [_connectionUpgrade]: core.bool,
+    [_chunked]: core.bool,
+    [_noMessageBody]: core.bool,
+    [_remainingContent]: core.int,
+    [_headers]: io._HttpHeaders,
+    [_incoming]: io._HttpIncoming,
+    [_socketSubscription]: async.StreamSubscription,
+    [_paused]: core.bool,
+    [_bodyPaused]: core.bool,
+    [_controller]: StreamControllerOf_HttpIncoming(),
+    [_bodyController]: StreamControllerOfListOfint()
+  }),
+  getters: () => ({
+    version: dart.definiteFunctionType(core.String, []),
+    messageType: dart.definiteFunctionType(core.int, []),
+    transferLength: dart.definiteFunctionType(core.int, []),
+    upgrade: dart.definiteFunctionType(core.bool, []),
+    persistentConnection: dart.definiteFunctionType(core.bool, [])
+  }),
+  setters: () => ({isHead: dart.definiteFunctionType(dart.void, [core.bool])}),
+  methods: () => ({
+    listen: dart.definiteFunctionType(async.StreamSubscription$(io._HttpIncoming), [_HttpIncomingTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    listenToStream: dart.definiteFunctionType(dart.void, [StreamOfListOfint()]),
+    [_parse]: dart.definiteFunctionType(dart.void, []),
+    [_headersEnd]: dart.definiteFunctionType(core.bool, []),
+    [_doParse]: dart.definiteFunctionType(dart.void, []),
+    [_onData]: dart.definiteFunctionType(dart.void, [ListOfint()]),
+    [_onDone]: dart.definiteFunctionType(dart.void, []),
+    detachIncoming: dart.definiteFunctionType(io._HttpDetachedIncoming, []),
+    readUnparsedData: dart.definiteFunctionType(core.List$(core.int), []),
+    [_reset]: dart.definiteFunctionType(dart.void, []),
+    [_releaseBuffer]: dart.definiteFunctionType(dart.void, []),
+    [_caseInsensitiveCompare]: dart.definiteFunctionType(core.bool, [ListOfint(), ListOfint()]),
+    [_expect]: dart.definiteFunctionType(core.int, [core.int, core.int]),
+    [_expectHexDigit]: dart.definiteFunctionType(core.int, [core.int]),
+    [_createIncoming]: dart.definiteFunctionType(dart.void, [core.int]),
+    [_closeIncoming]: dart.definiteFunctionType(dart.void, [], [core.bool]),
+    [_pauseStateChanged]: dart.definiteFunctionType(dart.void, []),
+    [_reportError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [dart.dynamic])
+  }),
+  statics: () => ({
+    _isTokenChar: dart.definiteFunctionType(core.bool, [core.int]),
+    _isValueChar: dart.definiteFunctionType(core.bool, [core.int]),
+    _tokenizeFieldValue: dart.definiteFunctionType(core.List$(core.String), [core.String]),
+    _toLowerCaseByte: dart.definiteFunctionType(core.int, [core.int])
+  }),
+  names: ['_isTokenChar', '_isValueChar', '_tokenizeFieldValue', '_toLowerCaseByte']
+});
+io._DART_SESSION_ID = "DARTSESSID";
+const _data = Symbol('_data');
+const _lastSeen = Symbol('_lastSeen');
+const _timeoutCallback = Symbol('_timeoutCallback');
+const _prev = Symbol('_prev');
+const _next = Symbol('_next');
+const _removeFromTimeoutQueue = Symbol('_removeFromTimeoutQueue');
+const _sessions = Symbol('_sessions');
+const _bumpToEnd = Symbol('_bumpToEnd');
+io._HttpSession = class _HttpSession extends core.Object {
+  new(sessionManager, id) {
+    this[_data] = collection.HashMap.new();
+    this[_sessionManager] = sessionManager;
+    this.id = id;
+    this[_lastSeen] = new core.DateTime.now();
+    this[_destroyed] = false;
+    this[_isNew] = true;
+    this[_timeoutCallback] = null;
+    this[_prev] = null;
+    this[_next] = null;
+  }
+  destroy() {
+    this[_destroyed] = true;
+    this[_sessionManager][_removeFromTimeoutQueue](this);
+    this[_sessionManager][_sessions][dartx.remove](this.id);
+  }
+  [_markSeen]() {
+    this[_lastSeen] = new core.DateTime.now();
+    this[_sessionManager][_bumpToEnd](this);
+  }
+  get lastSeen() {
+    return this[_lastSeen];
+  }
+  get isNew() {
+    return this[_isNew];
+  }
+  set onTimeout(callback) {
+    this[_timeoutCallback] = callback;
+  }
+  containsValue(value) {
+    return this[_data][dartx.containsValue](value);
+  }
+  containsKey(key) {
+    return this[_data][dartx.containsKey](key);
+  }
+  _get(key) {
+    return this[_data][dartx._get](key);
+  }
+  _set(key, value) {
+    this[_data][dartx._set](key, value);
+    return value;
+  }
+  putIfAbsent(key, ifAbsent) {
+    return this[_data][dartx.putIfAbsent](key, ifAbsent);
+  }
+  addAll(other) {
+    return this[_data][dartx.addAll](other);
+  }
+  remove(key) {
+    return this[_data][dartx.remove](key);
+  }
+  clear() {
+    this[_data][dartx.clear]();
+  }
+  forEach(f) {
+    this[_data][dartx.forEach](f);
+  }
+  get keys() {
+    return this[_data][dartx.keys];
+  }
+  get values() {
+    return this[_data][dartx.values];
+  }
+  get length() {
+    return this[_data][dartx.length];
+  }
+  get isEmpty() {
+    return this[_data][dartx.isEmpty];
+  }
+  get isNotEmpty() {
+    return this[_data][dartx.isNotEmpty];
+  }
+  toString() {
+    return dart.str`HttpSession id:${this.id} ${this[_data]}`;
+  }
+};
+io._HttpSession[dart.implements] = () => [io.HttpSession];
+dart.setSignature(io._HttpSession, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpSession, [io._HttpSessionManager, core.String])}),
+  fields: () => ({
+    [_destroyed]: core.bool,
+    [_isNew]: core.bool,
+    [_lastSeen]: core.DateTime,
+    [_timeoutCallback]: core.Function,
+    [_sessionManager]: io._HttpSessionManager,
+    [_prev]: io._HttpSession,
+    [_next]: io._HttpSession,
+    id: core.String,
+    [_data]: core.Map
+  }),
+  getters: () => ({
+    lastSeen: dart.definiteFunctionType(core.DateTime, []),
+    isNew: dart.definiteFunctionType(core.bool, []),
+    keys: dart.definiteFunctionType(core.Iterable, []),
+    values: dart.definiteFunctionType(core.Iterable, []),
+    length: dart.definiteFunctionType(core.int, []),
+    isEmpty: dart.definiteFunctionType(core.bool, []),
+    isNotEmpty: dart.definiteFunctionType(core.bool, [])
+  }),
+  setters: () => ({onTimeout: dart.definiteFunctionType(dart.void, [VoidTovoid()])}),
+  methods: () => ({
+    destroy: dart.definiteFunctionType(dart.void, []),
+    [_markSeen]: dart.definiteFunctionType(dart.void, []),
+    containsValue: dart.definiteFunctionType(core.bool, [core.Object]),
+    containsKey: dart.definiteFunctionType(core.bool, [core.Object]),
+    _get: dart.definiteFunctionType(dart.dynamic, [core.Object]),
+    _set: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic]),
+    putIfAbsent: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, VoidTodynamic()]),
+    addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+    remove: dart.definiteFunctionType(dart.dynamic, [core.Object]),
+    clear: dart.definiteFunctionType(dart.void, []),
+    forEach: dart.definiteFunctionType(dart.void, [dynamicAnddynamicTovoid()])
+  })
+});
+dart.defineExtensionMembers(io._HttpSession, [
+  'containsValue',
+  'containsKey',
+  '_get',
+  '_set',
+  'putIfAbsent',
+  'addAll',
+  'remove',
+  'clear',
+  'forEach',
+  'keys',
+  'values',
+  'length',
+  'isEmpty',
+  'isNotEmpty'
+]);
+const _sessionTimeout = Symbol('_sessionTimeout');
+const _head = Symbol('_head');
+const _tail = Symbol('_tail');
+const _timer = Symbol('_timer');
+const _addToTimeoutQueue = Symbol('_addToTimeoutQueue');
+const _stopTimer = Symbol('_stopTimer');
+const _startTimer = Symbol('_startTimer');
+const _timerTimeout = Symbol('_timerTimeout');
+io._HttpSessionManager = class _HttpSessionManager extends core.Object {
+  new() {
+    this[_sessions] = dart.map({}, core.String, io._HttpSession);
+    this[_sessionTimeout] = 20 * 60;
+    this[_head] = null;
+    this[_tail] = null;
+    this[_timer] = null;
+  }
+  createSessionId() {
+    let _KEY_LENGTH = 16;
+    let data = io._IOCrypto.getRandomBytes(_KEY_LENGTH);
+    return io._CryptoUtils.bytesToHex(data);
+  }
+  getSession(id) {
+    return this[_sessions][dartx._get](id);
+  }
+  createSession() {
+    let id = this.createSessionId();
+    while (dart.test(this[_sessions][dartx.containsKey](id))) {
+      id = this.createSessionId();
+    }
+    let session = this[_sessions][dartx._set](id, new io._HttpSession(this, id));
+    this[_addToTimeoutQueue](session);
+    return session;
+  }
+  set sessionTimeout(timeout) {
+    this[_sessionTimeout] = timeout;
+    this[_stopTimer]();
+    this[_startTimer]();
+  }
+  close() {
+    this[_stopTimer]();
+  }
+  [_bumpToEnd](session) {
+    this[_removeFromTimeoutQueue](session);
+    this[_addToTimeoutQueue](session);
+  }
+  [_addToTimeoutQueue](session) {
+    if (this[_head] == null) {
+      dart.assert(this[_tail] == null);
+      this[_tail] = this[_head] = session;
+      this[_startTimer]();
+    } else {
+      dart.assert(this[_timer] != null);
+      dart.assert(this[_tail] != null);
+      this[_tail][_next] = session;
+      session[_prev] = this[_tail];
+      this[_tail] = session;
+    }
+  }
+  [_removeFromTimeoutQueue](session) {
+    if (session[_next] != null) {
+      session[_next][_prev] = session[_prev];
+    }
+    if (session[_prev] != null) {
+      session[_prev][_next] = session[_next];
+    }
+    if (dart.equals(this[_head], session)) {
+      this[_head] = session[_next];
+      this[_stopTimer]();
+      this[_startTimer]();
+    }
+    if (dart.equals(this[_tail], session)) {
+      this[_tail] = session[_prev];
+    }
+    session[_next] = session[_prev] = null;
+  }
+  [_timerTimeout]() {
+    this[_stopTimer]();
+    dart.assert(this[_head] != null);
+    let session = this[_head];
+    session.destroy();
+    if (session[_timeoutCallback] != null) {
+      dart.dsend(session, _timeoutCallback);
+    }
+  }
+  [_startTimer]() {
+    dart.assert(this[_timer] == null);
+    if (this[_head] != null) {
+      let seconds = new core.DateTime.now().difference(this[_head].lastSeen).inSeconds;
+      this[_timer] = async.Timer.new(new core.Duration({seconds: dart.notNull(this[_sessionTimeout]) - dart.notNull(seconds)}), dart.bind(this, _timerTimeout));
+    }
+  }
+  [_stopTimer]() {
+    if (this[_timer] != null) {
+      this[_timer].cancel();
+      this[_timer] = null;
+    }
+  }
+};
+dart.setSignature(io._HttpSessionManager, {
+  constructors: () => ({new: dart.definiteFunctionType(io._HttpSessionManager, [])}),
+  fields: () => ({
+    [_sessions]: MapOfString$_HttpSession(),
+    [_sessionTimeout]: core.int,
+    [_head]: io._HttpSession,
+    [_tail]: io._HttpSession,
+    [_timer]: async.Timer
+  }),
+  setters: () => ({sessionTimeout: dart.definiteFunctionType(dart.void, [core.int])}),
+  methods: () => ({
+    createSessionId: dart.definiteFunctionType(core.String, []),
+    getSession: dart.definiteFunctionType(io._HttpSession, [core.String]),
+    createSession: dart.definiteFunctionType(io._HttpSession, []),
+    close: dart.definiteFunctionType(dart.void, []),
+    [_bumpToEnd]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+    [_addToTimeoutQueue]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+    [_removeFromTimeoutQueue]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+    [_timerTimeout]: dart.definiteFunctionType(dart.void, []),
+    [_startTimer]: dart.definiteFunctionType(dart.void, []),
+    [_stopTimer]: dart.definiteFunctionType(dart.void, [])
+  })
+});
+io._IOResourceInfo = class _IOResourceInfo extends core.Object {
+  static get timestamp() {
+    return dart.notNull(io._IOResourceInfo._startTime) + dart.notNull(io._IOResourceInfo._sw.elapsedMicroseconds) / 1000;
+  }
+  new(type) {
+    this.type = type;
+    this.id = io._IOResourceInfo.getNextID();
+  }
+  get referenceValueMap() {
+    return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.String);
+  }
+  static getNextID() {
+    return (() => {
+      let x = io._IOResourceInfo._count;
+      io._IOResourceInfo._count = dart.notNull(x) + 1;
+      return x;
+    })();
+  }
+};
+dart.setSignature(io._IOResourceInfo, {
+  constructors: () => ({new: dart.definiteFunctionType(io._IOResourceInfo, [core.String])}),
+  fields: () => ({
+    type: core.String,
+    id: core.int
+  }),
+  getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+  sfields: () => ({
+    _count: core.int,
+    _sw: core.Stopwatch,
+    _startTime: core.int
+  }),
+  sgetters: () => ({timestamp: dart.definiteFunctionType(core.double, [])}),
+  statics: () => ({getNextID: dart.definiteFunctionType(core.int, [])}),
+  names: ['getNextID']
+});
+io._IOResourceInfo._count = 0;
+dart.defineLazy(io._IOResourceInfo, {
+  get _sw() {
+    return (() => {
+      let _ = new core.Stopwatch();
+      _.start();
+      return _;
+    })();
+  },
+  get _startTime() {
+    return new core.DateTime.now().millisecondsSinceEpoch;
+  }
+});
+io._ReadWriteResourceInfo = class _ReadWriteResourceInfo extends io._IOResourceInfo {
+  addRead(bytes) {
+    this.totalRead = dart.notNull(this.totalRead) + dart.notNull(bytes);
+    this.readCount = dart.notNull(this.readCount) + 1;
+    this.lastRead = io._IOResourceInfo.timestamp;
+  }
+  didRead() {
+    this.addRead(0);
+  }
+  addWrite(bytes) {
+    this.totalWritten = dart.notNull(this.totalWritten) + dart.notNull(bytes);
+    this.writeCount = dart.notNull(this.writeCount) + 1;
+    this.lastWrite = io._IOResourceInfo.timestamp;
+  }
+  new(type) {
+    this.totalRead = 0;
+    this.totalWritten = 0;
+    this.readCount = 0;
+    this.writeCount = 0;
+    this.lastRead = 0.0;
+    this.lastWrite = 0.0;
+    super.new(type);
+  }
+  get fullValueMap() {
+    return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.String);
+  }
+};
+dart.setSignature(io._ReadWriteResourceInfo, {
+  constructors: () => ({new: dart.definiteFunctionType(io._ReadWriteResourceInfo, [core.String])}),
+  fields: () => ({
+    totalRead: core.int,
+    totalWritten: core.int,
+    readCount: core.int,
+    writeCount: core.int,
+    lastRead: core.double,
+    lastWrite: core.double
+  }),
+  getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+  methods: () => ({
+    addRead: dart.definiteFunctionType(dart.void, [core.int]),
+    didRead: dart.definiteFunctionType(dart.void, []),
+    addWrite: dart.definiteFunctionType(dart.void, [core.int])
+  })
+});
+io._FileResourceInfo = class _FileResourceInfo extends io._ReadWriteResourceInfo {
+  new(file) {
+    this.file = file;
+    super.new(io._FileResourceInfo.TYPE);
+    io._FileResourceInfo.FileOpened(this);
+  }
+  static FileOpened(info) {
+    dart.assert(!dart.test(io._FileResourceInfo.openFiles[dartx.containsKey](info.id)));
+    io._FileResourceInfo.openFiles[dartx._set](info.id, info);
+  }
+  static FileClosed(info) {
+    dart.assert(io._FileResourceInfo.openFiles[dartx.containsKey](info.id));
+    io._FileResourceInfo.openFiles[dartx.remove](info.id);
+  }
+  static getOpenFilesList() {
+    return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$String())));
+  }
+  static getOpenFiles(func, params) {
+    dart.assert(dart.equals(func, 'ext.dart.io.getOpenFiles'));
+    let data = dart.map({type: '_openfiles', data: io._FileResourceInfo.getOpenFilesList()}, core.String, core.Object);
+    let json = convert.JSON.encode(data);
+    return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+  }
+  getFileInfoMap() {
+    let result = this.fullValueMap;
+    return result;
+  }
+  static getFileInfoMapByID(func, params) {
+    dart.assert(dart.dsend(params, 'containsKey', 'id'));
+    let id = core.int.parse(core.String._check(dart.dindex(params, 'id')));
+    let result = dart.test(io._FileResourceInfo.openFiles[dartx.containsKey](id)) ? io._FileResourceInfo.openFiles[dartx._get](id).getFileInfoMap() : dart.map();
+    let json = convert.JSON.encode(result);
+    return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+  }
+  get name() {
+    return dart.str`${dart.dload(this.file, 'path')}`;
+  }
+};
+dart.setSignature(io._FileResourceInfo, {
+  constructors: () => ({new: dart.definiteFunctionType(io._FileResourceInfo, [dart.dynamic])}),
+  fields: () => ({file: dart.dynamic}),
+  getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+  methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+  sfields: () => ({
+    TYPE: core.String,
+    openFiles: MapOfint$_FileResourceInfo()
+  }),
+  statics: () => ({
+    FileOpened: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
+    FileClosed: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
+    getOpenFilesList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+    getOpenFiles: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic]),
+    getFileInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic])
+  }),
+  names: ['FileOpened', 'FileClosed', 'getOpenFilesList', 'getOpenFiles', 'getFileInfoMapByID']
+});
+io._FileResourceInfo.TYPE = '_file';
+dart.defineLazy(io._FileResourceInfo, {
+  get openFiles() {
+    return MapOfint$_FileResourceInfo().new();
+  },
+  set openFiles(_) {}
+});
+const _arguments = Symbol('_arguments');
+const _workingDirectory = Symbol('_workingDirectory');
+io._ProcessResourceInfo = class _ProcessResourceInfo extends io._IOResourceInfo {
+  new(process) {
+    this.process = process;
+    this.startedAt = io._IOResourceInfo.timestamp;
+    super.new(io._ProcessResourceInfo.TYPE);
+    io._ProcessResourceInfo.ProcessStarted(this);
+  }
+  get name() {
+    return core.String._check(dart.dload(this.process, _path));
+  }
+  stopped() {
+    io._ProcessResourceInfo.ProcessStopped(this);
+  }
+  get fullValueMap() {
+    return dart.map({type: this.type, id: this.id, name: this.name, pid: core.String._check(dart.dload(this.process, 'pid')), startedAt: this.startedAt, arguments: core.String._check(dart.dload(this.process, _arguments)), workingDirectory: core.String._check(dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory))}, core.String, core.String);
+  }
+  static ProcessStarted(info) {
+    dart.assert(!dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id)));
+    io._ProcessResourceInfo.startedProcesses[dartx._set](info.id, info);
+  }
+  static ProcessStopped(info) {
+    dart.assert(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id));
+    io._ProcessResourceInfo.startedProcesses[dartx.remove](info.id);
+  }
+  static getStartedProcessesList() {
+    return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$String())));
+  }
+  static getStartedProcesses(func, params) {
+    dart.assert(func == 'ext.dart.io.getProcesses');
+    let data = dart.map({type: '_startedprocesses', data: io._ProcessResourceInfo.getStartedProcessesList()}, core.String, core.Object);
+    let json = convert.JSON.encode(data);
+    return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+  }
+  static getProcessInfoMapById(func, params) {
+    let id = core.int.parse(params[dartx._get]('id'));
+    let result = dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](id)) ? io._ProcessResourceInfo.startedProcesses[dartx._get](id).fullValueMap : dart.map();
+    let json = convert.JSON.encode(result);
+    return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+  }
+};
+dart.setSignature(io._ProcessResourceInfo, {
+  constructors: () => ({new: dart.definiteFunctionType(io._ProcessResourceInfo, [dart.dynamic])}),
+  fields: () => ({
+    process: dart.dynamic,
+    startedAt: core.double
+  }),
+  getters: () => ({
+    name: dart.definiteFunctionType(core.String, []),
+    fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+  }),
+  methods: () => ({stopped: dart.definiteFunctionType(dart.void, [])}),
+  sfields: () => ({
+    TYPE: core.String,
+    startedProcesses: MapOfint$_ProcessResourceInfo()
+  }),
+  statics: () => ({
+    ProcessStarted: dart.definiteFunctionType(dart.dynamic, [io._ProcessResourceInfo]),
+    ProcessStopped: dart.definiteFunctionType(dart.dynamic, [io._ProcessResourceInfo]),
+    getStartedProcessesList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+    getStartedProcesses: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
+    getProcessInfoMapById: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()])
+  }),
+  names: ['ProcessStarted', 'ProcessStopped', 'getStartedProcessesList', 'getStartedProcesses', 'getProcessInfoMapById']
+});
+io._ProcessResourceInfo.TYPE = '_process';
+dart.defineLazy(io._ProcessResourceInfo, {
+  get startedProcesses() {
+    return MapOfint$_ProcessResourceInfo().new();
+  },
+  set startedProcesses(_) {}
+});
+io._SocketResourceInfo = class _SocketResourceInfo extends io._ReadWriteResourceInfo {
+  new(socket) {
+    this.socket = socket;
+    super.new(io._SocketResourceInfo.TYPE);
+    io._SocketResourceInfo.SocketOpened(this);
+  }
+  get name() {
+    if (dart.test(dart.dload(this.socket, 'isListening'))) {
+      return dart.str`listening:${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}`;
+    }
+    let remote = '';
+    try {
+      let remoteHost = dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host');
+      let remotePort = dart.dload(this.socket, 'remotePort');
+      remote = dart.str` -> ${remoteHost}:${remotePort}`;
+    } catch (e) {
+    }
+
+    return dart.str`${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}${remote}`;
+  }
+  static getOpenSocketsList() {
+    return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$String())));
+  }
+  getSocketInfoMap() {
+    let result = this.fullValueMap;
+    result[dartx._set]('socketType', dart.test(dart.dload(this.socket, 'isTcp')) ? io._SocketResourceInfo.TCP_STRING : io._SocketResourceInfo.UDP_STRING);
+    result[dartx._set]('listening', core.String._check(dart.dload(this.socket, 'isListening')));
+    result[dartx._set]('host', core.String._check(dart.dload(dart.dload(this.socket, 'address'), 'host')));
+    result[dartx._set]('port', core.String._check(dart.dload(this.socket, 'port')));
+    if (!dart.test(dart.dload(this.socket, 'isListening'))) {
+      try {
+        result[dartx._set]('remoteHost', core.String._check(dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host')));
+        result[dartx._set]('remotePort', core.String._check(dart.dload(this.socket, 'remotePort')));
+      } catch (e) {
+        result[dartx._set]('remotePort', 'NA');
+        result[dartx._set]('remoteHost', 'NA');
+      }
+
+    } else {
+      result[dartx._set]('remotePort', 'NA');
+      result[dartx._set]('remoteHost', 'NA');
+    }
+    result[dartx._set]('addressType', core.String._check(dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name')));
+    return result;
+  }
+  static getSocketInfoMapByID(func, params) {
+    dart.assert(params[dartx.containsKey]('id'));
+    let id = core.int.parse(params[dartx._get]('id'));
+    let result = dart.test(io._SocketResourceInfo.openSockets[dartx.containsKey](id)) ? io._SocketResourceInfo.openSockets[dartx._get](id).getSocketInfoMap() : dart.map();
+    let json = convert.JSON.encode(result);
+    return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+  }
+  static getOpenSockets(func, params) {
+    dart.assert(dart.equals(func, 'ext.dart.io.getOpenSockets'));
+    let data = dart.map({type: '_opensockets', data: io._SocketResourceInfo.getOpenSocketsList()}, core.String, core.Object);
+    let json = convert.JSON.encode(data);
+    return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+  }
+  static SocketOpened(info) {
+    dart.assert(!dart.test(io._SocketResourceInfo.openSockets[dartx.containsKey](info.id)));
+    io._SocketResourceInfo.openSockets[dartx._set](info.id, info);
+  }
+  static SocketClosed(info) {
+    dart.assert(io._SocketResourceInfo.openSockets[dartx.containsKey](info.id));
+    io._SocketResourceInfo.openSockets[dartx.remove](info.id);
+  }
+};
+dart.setSignature(io._SocketResourceInfo, {
+  constructors: () => ({new: dart.definiteFunctionType(io._SocketResourceInfo, [dart.dynamic])}),
+  fields: () => ({socket: dart.dynamic}),
+  getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+  methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+  sfields: () => ({
+    TCP_STRING: core.String,
+    UDP_STRING: core.String,
+    TYPE: core.String,
+    openSockets: MapOfint$_SocketResourceInfo()
+  }),
+  statics: () => ({
+    getOpenSocketsList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+    getSocketInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
+    getOpenSockets: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic]),
+    SocketOpened: dart.definiteFunctionType(dart.dynamic, [io._SocketResourceInfo]),
+    SocketClosed: dart.definiteFunctionType(dart.dynamic, [io._SocketResourceInfo])
+  }),
+  names: ['getOpenSocketsList', 'getSocketInfoMapByID', 'getOpenSockets', 'SocketOpened', 'SocketClosed']
+});
+io._SocketResourceInfo.TCP_STRING = 'TCP';
+io._SocketResourceInfo.UDP_STRING = 'UDP';
+io._SocketResourceInfo.TYPE = '_socket';
+dart.defineLazy(io._SocketResourceInfo, {
+  get openSockets() {
+    return MapOfint$_SocketResourceInfo().new();
+  },
+  set openSockets(_) {}
+});
+io.IOSink = class IOSink extends core.Object {
+  static new(target, opts) {
+    let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+    return new io._IOSinkImpl(target, encoding);
+  }
+};
+io.IOSink[dart.implements] = () => [StreamSinkOfListOfint(), core.StringSink];
+dart.setSignature(io.IOSink, {
+  constructors: () => ({new: dart.definiteFunctionType(io.IOSink, [StreamConsumerOfListOfint()], {encoding: convert.Encoding})}),
+  fields: () => ({encoding: convert.Encoding})
+});
+io._FILE_EXISTS = 0;
+io._FILE_CREATE = 1;
+io._FILE_DELETE = 2;
+io._FILE_RENAME = 3;
+io._FILE_COPY = 4;
+io._FILE_OPEN = 5;
+io._FILE_RESOLVE_SYMBOLIC_LINKS = 6;
+io._FILE_CLOSE = 7;
+io._FILE_POSITION = 8;
+io._FILE_SET_POSITION = 9;
+io._FILE_TRUNCATE = 10;
+io._FILE_LENGTH = 11;
+io._FILE_LENGTH_FROM_PATH = 12;
+io._FILE_LAST_MODIFIED = 13;
+io._FILE_FLUSH = 14;
+io._FILE_READ_BYTE = 15;
+io._FILE_WRITE_BYTE = 16;
+io._FILE_READ = 17;
+io._FILE_READ_INTO = 18;
+io._FILE_WRITE_FROM = 19;
+io._FILE_CREATE_LINK = 20;
+io._FILE_DELETE_LINK = 21;
+io._FILE_RENAME_LINK = 22;
+io._FILE_LINK_TARGET = 23;
+io._FILE_TYPE = 24;
+io._FILE_IDENTICAL = 25;
+io._FILE_STAT = 26;
+io._FILE_LOCK = 27;
+io._SOCKET_LOOKUP = 28;
+io._SOCKET_LIST_INTERFACES = 29;
+io._SOCKET_REVERSE_LOOKUP = 30;
+io._DIRECTORY_CREATE = 31;
+io._DIRECTORY_DELETE = 32;
+io._DIRECTORY_EXISTS = 33;
+io._DIRECTORY_CREATE_TEMP = 34;
+io._DIRECTORY_LIST_START = 35;
+io._DIRECTORY_LIST_NEXT = 36;
+io._DIRECTORY_LIST_STOP = 37;
+io._DIRECTORY_RENAME = 38;
+io._SSL_PROCESS_FILTER = 39;
+io._IOService = class _IOService extends core.Object {
+  static _dispatch(request, data) {
+    dart.throw(new core.UnsupportedError("_IOService._dispatch"));
+  }
+};
+dart.setSignature(io._IOService, {
+  statics: () => ({_dispatch: dart.definiteFunctionType(async.Future, [core.int, core.List])}),
+  names: ['_dispatch']
+});
+io.Link = class Link extends core.Object {
+  static new(path) {
+    return new io._Link(path);
+  }
+  static fromUri(uri) {
+    return io.Link.new(uri.toFilePath());
+  }
+};
+io.Link[dart.implements] = () => [io.FileSystemEntity];
+dart.setSignature(io.Link, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io.Link, [core.String]),
+    fromUri: dart.definiteFunctionType(io.Link, [core.Uri])
+  })
+});
+const _makeWindowsLinkTarget = Symbol('_makeWindowsLinkTarget');
+const _exceptionFromResponse = Symbol('_exceptionFromResponse');
+io._Link = class _Link extends io.FileSystemEntity {
+  new(path) {
+    this.path = path;
+    if (!(typeof this.path == 'string')) {
+      dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+    }
+  }
+  toString() {
+    return dart.str`Link: '${this.path}'`;
+  }
+  exists() {
+    return io.FileSystemEntity.isLink(this.path);
+  }
+  existsSync() {
+    return io.FileSystemEntity.isLinkSync(this.path);
+  }
+  get absolute() {
+    return io.Link.new(this[_absolutePath]);
+  }
+  stat() {
+    return io.FileStat.stat(this.path);
+  }
+  statSync() {
+    return io.FileStat.statSync(this.path);
+  }
+  create(target, opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    if (dart.test(io.Platform.isWindows)) {
+      target = this[_makeWindowsLinkTarget](target);
+    }
+    let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
+    return result.then(dart.dynamic)(dart.fn(_ => io._IOService._dispatch(io._FILE_CREATE_LINK, JSArrayOfString().of([this.path, target])), dynamicToFuture())).then(io._Link)(dart.fn(response => {
+      if (dart.test(this[_isErrorResponse](response))) {
+        dart.throw(this[_exceptionFromResponse](response, dart.str`Cannot create link to target '${target}'`, this.path));
+      }
+      return this;
+    }, dynamicTo_Link()));
+  }
+  createSync(target, opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    if (dart.test(recursive)) {
+      this.parent.createSync({recursive: true});
+    }
+    if (dart.test(io.Platform.isWindows)) {
+      target = this[_makeWindowsLinkTarget](target);
+    }
+    let result = io._File._createLink(this.path, target);
+    io._Link.throwIfError(result, "Cannot create link", this.path);
+  }
+  [_makeWindowsLinkTarget](target) {
+    let base = core.Uri.file(dart.str`${io.Directory.current.path}\\`);
+    let link = core.Uri.file(this.path);
+    let destination = core.Uri.file(target);
+    let result = base.resolveUri(link).resolveUri(destination).toFilePath();
+    if (dart.notNull(result[dartx.length]) > 3 && result[dartx._get](1) == ':' && result[dartx._get](2) == '\\') {
+      return dart.str`\\??\\${result}`;
+    } else {
+      dart.throw(new io.FileSystemException(dart.str`Target ${result} of Link.create on Windows cannot be converted` + ' to start with a drive letter.  Unexpected error.'));
+    }
+  }
+  updateSync(target) {
+    this.deleteSync();
+    this.createSync(target);
+  }
+  update(target) {
+    return this.delete().then(io.Link)(dart.fn(_ => this.create(target), FileSystemEntityToFutureOfLink()));
+  }
+  [_delete](opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    if (dart.test(recursive)) {
+      return io.Directory.new(this.path).delete({recursive: true}).then(io._Link)(dart.fn(_ => this, FileSystemEntityTo_Link()));
+    }
+    return io._IOService._dispatch(io._FILE_DELETE_LINK, JSArrayOfString().of([this.path])).then(io._Link)(dart.fn(response => {
+      if (dart.test(this[_isErrorResponse](response))) {
+        dart.throw(this[_exceptionFromResponse](response, "Cannot delete link", this.path));
+      }
+      return this;
+    }, dynamicTo_Link()));
+  }
+  [_deleteSync](opts) {
+    let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+    if (dart.test(recursive)) {
+      return io.Directory.new(this.path).deleteSync({recursive: true});
+    }
+    let result = io._File._deleteLinkNative(this.path);
+    io._Link.throwIfError(result, "Cannot delete link", this.path);
+  }
+  rename(newPath) {
+    return io._IOService._dispatch(io._FILE_RENAME_LINK, JSArrayOfString().of([this.path, newPath])).then(io.Link)(dart.fn(response => {
+      if (dart.test(this[_isErrorResponse](response))) {
+        dart.throw(this[_exceptionFromResponse](response, dart.str`Cannot rename link to '${newPath}'`, this.path));
+      }
+      return io.Link.new(newPath);
+    }, dynamicToLink()));
+  }
+  renameSync(newPath) {
+    let result = io._File._renameLink(this.path, newPath);
+    io._Link.throwIfError(result, dart.str`Cannot rename link '${this.path}' to '${newPath}'`);
+    return io.Link.new(newPath);
+  }
+  target() {
+    return io._IOService._dispatch(io._FILE_LINK_TARGET, JSArrayOfString().of([this.path])).then(core.String)(dart.fn(response => {
+      if (dart.test(this[_isErrorResponse](response))) {
+        dart.throw(this[_exceptionFromResponse](response, "Cannot get target of link", this.path));
+      }
+      return FutureOrOfString()._check(response);
+    }, dynamicToFutureOrOfString()));
+  }
+  targetSync() {
+    let result = io._File._linkTarget(this.path);
+    io._Link.throwIfError(result, "Cannot read link", this.path);
+    return core.String._check(result);
+  }
+  static throwIfError(result, msg, path) {
+    if (path === void 0) path = "";
+    if (io.OSError.is(result)) {
+      dart.throw(new io.FileSystemException(msg, path, result));
+    }
+  }
+  [_isErrorResponse](response) {
+    return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+  }
+  [_exceptionFromResponse](response, message, path) {
+    dart.assert(this[_isErrorResponse](response));
+    switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+      case io._ILLEGAL_ARGUMENT_RESPONSE:
+      {
+        return new core.ArgumentError();
+      }
+      case io._OSERROR_RESPONSE:
+      {
+        let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+        return new io.FileSystemException(message, path, err);
+      }
+      default:
+      {
+        return core.Exception.new("Unknown error");
+      }
+    }
+  }
+};
+io._Link[dart.implements] = () => [io.Link];
+dart.setSignature(io._Link, {
+  constructors: () => ({new: dart.definiteFunctionType(io._Link, [core.String])}),
+  fields: () => ({path: core.String}),
+  getters: () => ({absolute: dart.definiteFunctionType(io.Link, [])}),
+  methods: () => ({
+    exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+    existsSync: dart.definiteFunctionType(core.bool, []),
+    stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+    statSync: dart.definiteFunctionType(io.FileStat, []),
+    create: dart.definiteFunctionType(async.Future$(io.Link), [core.String], {recursive: core.bool}),
+    createSync: dart.definiteFunctionType(dart.void, [core.String], {recursive: core.bool}),
+    [_makeWindowsLinkTarget]: dart.definiteFunctionType(core.String, [core.String]),
+    updateSync: dart.definiteFunctionType(dart.void, [core.String]),
+    update: dart.definiteFunctionType(async.Future$(io.Link), [core.String]),
+    [_delete]: dart.definiteFunctionType(async.Future$(io.Link), [], {recursive: core.bool}),
+    [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+    rename: dart.definiteFunctionType(async.Future$(io.Link), [core.String]),
+    renameSync: dart.definiteFunctionType(io.Link, [core.String]),
+    target: dart.definiteFunctionType(async.Future$(core.String), []),
+    targetSync: dart.definiteFunctionType(core.String, []),
+    [_isErrorResponse]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+    [_exceptionFromResponse]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])
+  }),
+  statics: () => ({throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String], [core.String])}),
+  names: ['throwIfError']
+});
+io.Platform = class Platform extends core.Object {
+  static get numberOfProcessors() {
+    return io.Platform._numberOfProcessors;
+  }
+  static get pathSeparator() {
+    return io.Platform._pathSeparator;
+  }
+  static get operatingSystem() {
+    return io.Platform._operatingSystem;
+  }
+  static get localHostname() {
+    return io.Platform._localHostname;
+  }
+  static get environment() {
+    return io._Platform.environment;
+  }
+  static get executable() {
+    return io._Platform.executable;
+  }
+  static get resolvedExecutable() {
+    return io._Platform.resolvedExecutable;
+  }
+  static get script() {
+    return io._Platform.script;
+  }
+  static get executableArguments() {
+    return io._Platform.executableArguments;
+  }
+  static get packageRoot() {
+    return io._Platform.packageRoot;
+  }
+  static get packageConfig() {
+    return io._Platform.packageConfig;
+  }
+  static get version() {
+    return io.Platform._version;
+  }
+};
+dart.setSignature(io.Platform, {
+  sfields: () => ({
+    _numberOfProcessors: core.int,
+    _pathSeparator: core.String,
+    _operatingSystem: core.String,
+    _localHostname: core.String,
+    _version: core.String,
+    isLinux: core.bool,
+    isMacOS: core.bool,
+    isWindows: core.bool,
+    isAndroid: core.bool,
+    isIOS: core.bool
+  }),
+  sgetters: () => ({
+    numberOfProcessors: dart.definiteFunctionType(core.int, []),
+    pathSeparator: dart.definiteFunctionType(core.String, []),
+    operatingSystem: dart.definiteFunctionType(core.String, []),
+    localHostname: dart.definiteFunctionType(core.String, []),
+    environment: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+    executable: dart.definiteFunctionType(core.String, []),
+    resolvedExecutable: dart.definiteFunctionType(core.String, []),
+    script: dart.definiteFunctionType(core.Uri, []),
+    executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+    packageRoot: dart.definiteFunctionType(core.String, []),
+    packageConfig: dart.definiteFunctionType(core.String, []),
+    version: dart.definiteFunctionType(core.String, [])
+  })
+});
+dart.defineLazy(io.Platform, {
+  get _numberOfProcessors() {
+    return io._Platform.numberOfProcessors;
+  },
+  get _pathSeparator() {
+    return io._Platform.pathSeparator;
+  },
+  get _operatingSystem() {
+    return io._Platform.operatingSystem;
+  },
+  get _localHostname() {
+    return io._Platform.localHostname;
+  },
+  get _version() {
+    return io._Platform.version;
+  },
+  get isLinux() {
+    return io.Platform._operatingSystem == "linux";
+  },
+  get isMacOS() {
+    return io.Platform._operatingSystem == "macos";
+  },
+  get isWindows() {
+    return io.Platform._operatingSystem == "windows";
+  },
+  get isAndroid() {
+    return io.Platform._operatingSystem == "android";
+  },
+  get isIOS() {
+    return io.Platform._operatingSystem == "ios";
+  }
+});
+io._Platform = class _Platform extends core.Object {
+  static _numberOfProcessors() {
+    dart.throw(new core.UnsupportedError("Platform._numberOfProcessors"));
+  }
+  static _pathSeparator() {
+    dart.throw(new core.UnsupportedError("Platform._pathSeparator"));
+  }
+  static _operatingSystem() {
+    dart.throw(new core.UnsupportedError("Platform._operatingSystem"));
+  }
+  static _localHostname() {
+    dart.throw(new core.UnsupportedError("Platform._localHostname"));
+  }
+  static _executable() {
+    dart.throw(new core.UnsupportedError("Platform._executable"));
+  }
+  static _resolvedExecutable() {
+    dart.throw(new core.UnsupportedError("Platform._resolvedExecutable"));
+  }
+  static _environment() {
+    dart.throw(new core.UnsupportedError("Platform._environment"));
+  }
+  static _executableArguments() {
+    dart.throw(new core.UnsupportedError("Platform._executableArguments"));
+  }
+  static _packageRoot() {
+    dart.throw(new core.UnsupportedError("Platform._packageRoot"));
+  }
+  static _packageConfig() {
+    dart.throw(new core.UnsupportedError("Platform._packageConfig"));
+  }
+  static _version() {
+    dart.throw(new core.UnsupportedError("Platform._version"));
+  }
+  static get numberOfProcessors() {
+    return io._Platform._numberOfProcessors();
+  }
+  static get pathSeparator() {
+    return io._Platform._pathSeparator();
+  }
+  static get operatingSystem() {
+    return io._Platform._operatingSystem();
+  }
+  static get localHostname() {
+    let result = io._Platform._localHostname();
+    if (io.OSError.is(result)) {
+      dart.throw(result);
+    } else {
+      return core.String._check(result);
+    }
+  }
+  static get executableArguments() {
+    return io._Platform._executableArguments();
+  }
+  static get environment() {
+    if (io._Platform._environmentCache == null) {
+      let env = io._Platform._environment();
+      if (!io.OSError.is(env)) {
+        let isWindows = io._Platform.operatingSystem == 'windows';
+        let result = isWindows ? new io._CaseInsensitiveStringMap() : core.Map.new();
+        for (let str of core.Iterable._check(env)) {
+          let equalsIndex = dart.dsend(str, 'indexOf', '=');
+          if (dart.test(dart.dsend(equalsIndex, '>', 0))) {
+            result[dartx._set](dart.dsend(str, 'substring', 0, equalsIndex), dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1)));
+          }
+        }
+        io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(MapOfString$String()._check(result));
+      } else {
+        io._Platform._environmentCache = env;
+      }
+    }
+    if (io.OSError.is(io._Platform._environmentCache)) {
+      dart.throw(io._Platform._environmentCache);
+    } else {
+      return MapOfString$String()._check(io._Platform._environmentCache);
+    }
+  }
+  static get version() {
+    return io._Platform._version();
+  }
+};
+dart.setSignature(io._Platform, {
+  sfields: () => ({
+    executable: core.String,
+    resolvedExecutable: core.String,
+    packageRoot: core.String,
+    packageConfig: core.String,
+    _environmentCache: dart.dynamic,
+    script: core.Uri
+  }),
+  sgetters: () => ({
+    numberOfProcessors: dart.definiteFunctionType(core.int, []),
+    pathSeparator: dart.definiteFunctionType(core.String, []),
+    operatingSystem: dart.definiteFunctionType(core.String, []),
+    localHostname: dart.definiteFunctionType(core.String, []),
+    executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+    environment: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+    version: dart.definiteFunctionType(core.String, [])
+  }),
+  statics: () => ({
+    _numberOfProcessors: dart.definiteFunctionType(core.int, []),
+    _pathSeparator: dart.definiteFunctionType(core.String, []),
+    _operatingSystem: dart.definiteFunctionType(core.String, []),
+    _localHostname: dart.definiteFunctionType(dart.dynamic, []),
+    _executable: dart.definiteFunctionType(dart.dynamic, []),
+    _resolvedExecutable: dart.definiteFunctionType(dart.dynamic, []),
+    _environment: dart.definiteFunctionType(dart.dynamic, []),
+    _executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+    _packageRoot: dart.definiteFunctionType(core.String, []),
+    _packageConfig: dart.definiteFunctionType(core.String, []),
+    _version: dart.definiteFunctionType(core.String, [])
+  }),
+  names: ['_numberOfProcessors', '_pathSeparator', '_operatingSystem', '_localHostname', '_executable', '_resolvedExecutable', '_environment', '_executableArguments', '_packageRoot', '_packageConfig', '_version']
+});
+io._Platform._environmentCache = null;
+io._Platform.script = null;
+dart.defineLazy(io._Platform, {
+  get executable() {
+    return core.String._check(io._Platform._executable());
+  },
+  set executable(_) {},
+  get resolvedExecutable() {
+    return core.String._check(io._Platform._resolvedExecutable());
+  },
+  set resolvedExecutable(_) {},
+  get packageRoot() {
+    return io._Platform._packageRoot();
+  },
+  set packageRoot(_) {},
+  get packageConfig() {
+    return io._Platform._packageConfig();
+  },
+  set packageConfig(_) {}
+});
+const _map = Symbol('_map');
+io._CaseInsensitiveStringMap$ = dart.generic(V => {
+  let MapOfString$V = () => (MapOfString$V = dart.constFn(core.Map$(core.String, V)))();
+  let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
+  let StringAndVTovoid = () => (StringAndVTovoid = dart.constFn(dart.functionType(dart.void, [core.String, V])))();
+  class _CaseInsensitiveStringMap extends core.Object {
+    new() {
+      this[_map] = MapOfString$V().new();
+    }
+    containsKey(key) {
+      return typeof key == 'string' && dart.test(this[_map][dartx.containsKey](key[dartx.toUpperCase]()));
+    }
+    containsValue(value) {
+      return this[_map][dartx.containsValue](value);
+    }
+    _get(key) {
+      return typeof key == 'string' ? this[_map][dartx._get](key[dartx.toUpperCase]()) : null;
+    }
+    _set(key, value) {
+      V._check(value);
+      this[_map][dartx._set](key[dartx.toUpperCase](), value);
+      return value;
+    }
+    putIfAbsent(key, ifAbsent) {
+      VoidToV()._check(ifAbsent);
+      return this[_map][dartx.putIfAbsent](key[dartx.toUpperCase](), ifAbsent);
+    }
+    addAll(other) {
+      other[dartx.forEach](dart.fn((key, value) => this._set(core.String._check(dart.dsend(key, 'toUpperCase')), V._check(value)), dynamicAnddynamicTovoid()));
+    }
+    remove(key) {
+      return typeof key == 'string' ? this[_map][dartx.remove](key[dartx.toUpperCase]()) : null;
+    }
+    clear() {
+      this[_map][dartx.clear]();
+    }
+    forEach(f) {
+      this[_map][dartx.forEach](f);
+    }
+    get keys() {
+      return this[_map][dartx.keys];
+    }
+    get values() {
+      return this[_map][dartx.values];
+    }
+    get length() {
+      return this[_map][dartx.length];
+    }
+    get isEmpty() {
+      return this[_map][dartx.isEmpty];
+    }
+    get isNotEmpty() {
+      return this[_map][dartx.isNotEmpty];
+    }
+    toString() {
+      return dart.toString(this[_map]);
+    }
+  }
+  dart.addTypeTests(_CaseInsensitiveStringMap);
+  _CaseInsensitiveStringMap[dart.implements] = () => [MapOfString$V()];
+  dart.setSignature(_CaseInsensitiveStringMap, {
+    fields: () => ({[_map]: MapOfString$V()}),
+    getters: () => ({
+      keys: dart.definiteFunctionType(core.Iterable$(core.String), []),
+      values: dart.definiteFunctionType(core.Iterable$(V), []),
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      containsKey: dart.definiteFunctionType(core.bool, [core.Object]),
+      containsValue: dart.definiteFunctionType(core.bool, [core.Object]),
+      _get: dart.definiteFunctionType(V, [core.Object]),
+      _set: dart.definiteFunctionType(dart.void, [core.String, V]),
+      putIfAbsent: dart.definiteFunctionType(V, [core.String, VoidToV()]),
+      addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+      remove: dart.definiteFunctionType(V, [core.Object]),
+      clear: dart.definiteFunctionType(dart.void, []),
+      forEach: dart.definiteFunctionType(dart.void, [StringAndVTovoid()])
+    })
+  });
+  dart.defineExtensionMembers(_CaseInsensitiveStringMap, [
+    'containsKey',
+    'containsValue',
+    '_get',
+    '_set',
+    'putIfAbsent',
+    'addAll',
+    'remove',
+    'clear',
+    'forEach',
+    'keys',
+    'values',
+    'length',
+    'isEmpty',
+    'isNotEmpty'
+  ]);
+  return _CaseInsensitiveStringMap;
+});
+io._CaseInsensitiveStringMap = _CaseInsensitiveStringMap();
+io._ProcessUtils = class _ProcessUtils extends core.Object {
+  static _exit(status) {
+    dart.throw(new core.UnsupportedError("ProcessUtils._exit"));
+  }
+  static _setExitCode(status) {
+    dart.throw(new core.UnsupportedError("ProcessUtils._setExitCode"));
+  }
+  static _getExitCode() {
+    dart.throw(new core.UnsupportedError("ProcessUtils._getExitCode"));
+  }
+  static _sleep(millis) {
+    dart.throw(new core.UnsupportedError("ProcessUtils._sleep"));
+  }
+  static _pid(process) {
+    dart.throw(new core.UnsupportedError("ProcessUtils._pid"));
+  }
+  static _watchSignal(signal) {
+    dart.throw(new core.UnsupportedError("ProcessUtils._watchSignal"));
+  }
+};
+dart.setSignature(io._ProcessUtils, {
+  statics: () => ({
+    _exit: dart.definiteFunctionType(dart.void, [core.int]),
+    _setExitCode: dart.definiteFunctionType(dart.void, [core.int]),
+    _getExitCode: dart.definiteFunctionType(core.int, []),
+    _sleep: dart.definiteFunctionType(dart.void, [core.int]),
+    _pid: dart.definiteFunctionType(core.int, [io.Process]),
+    _watchSignal: dart.definiteFunctionType(async.Stream$(io.ProcessSignal), [io.ProcessSignal])
+  }),
+  names: ['_exit', '_setExitCode', '_getExitCode', '_sleep', '_pid', '_watchSignal']
+});
+io.exit = function(code) {
+  if (!(typeof code == 'number')) {
+    dart.throw(new core.ArgumentError("Integer value for exit code expected"));
+  }
+  io._ProcessUtils._exit(code);
+};
+dart.fn(io.exit, intTovoid());
+dart.copyProperties(io, {
+  set exitCode(code) {
+    if (!(typeof code == 'number')) {
+      dart.throw(new core.ArgumentError("Integer value for exit code expected"));
+    }
+    io._ProcessUtils._setExitCode(code);
+  },
+  get exitCode() {
+    return io._ProcessUtils._getExitCode();
+  }
+});
+io.sleep = function(duration) {
+  let milliseconds = duration.inMilliseconds;
+  if (dart.notNull(milliseconds) < 0) {
+    dart.throw(new core.ArgumentError("sleep: duration cannot be negative"));
+  }
+  io._ProcessUtils._sleep(milliseconds);
+};
+dart.fn(io.sleep, DurationTovoid());
+dart.copyProperties(io, {
+  get pid() {
+    return io._ProcessUtils._pid(null);
+  }
+});
+io.ProcessStartMode = class ProcessStartMode extends core.Object {
+  new(index) {
+    this.index = index;
+  }
+  toString() {
+    return {
+      0: "ProcessStartMode.NORMAL",
+      1: "ProcessStartMode.DETACHED",
+      2: "ProcessStartMode.DETACHED_WITH_STDIO"
+    }[this.index];
+  }
+};
+dart.setSignature(io.ProcessStartMode, {
+  fields: () => ({index: core.int})
+});
+dart.defineEnumValues(io.ProcessStartMode, [
+  'NORMAL',
+  'DETACHED',
+  'DETACHED_WITH_STDIO'
+]);
+io.Process = class Process extends core.Object {
+  new() {
+    this.exitCode = null;
+  }
+  static start(executable, arguments$, opts) {
+    let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+    let environment = opts && 'environment' in opts ? opts.environment : null;
+    let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+    let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+    let mode = opts && 'mode' in opts ? opts.mode : io.ProcessStartMode.NORMAL;
+    dart.throw(new core.UnsupportedError("Process.start"));
+  }
+  static run(executable, arguments$, opts) {
+    let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+    let environment = opts && 'environment' in opts ? opts.environment : null;
+    let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+    let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+    let stdoutEncoding = opts && 'stdoutEncoding' in opts ? opts.stdoutEncoding : io.SYSTEM_ENCODING;
+    let stderrEncoding = opts && 'stderrEncoding' in opts ? opts.stderrEncoding : io.SYSTEM_ENCODING;
+    dart.throw(new core.UnsupportedError("Process.run"));
+  }
+  static runSync(executable, arguments$, opts) {
+    let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+    let environment = opts && 'environment' in opts ? opts.environment : null;
+    let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+    let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+    let stdoutEncoding = opts && 'stdoutEncoding' in opts ? opts.stdoutEncoding : io.SYSTEM_ENCODING;
+    let stderrEncoding = opts && 'stderrEncoding' in opts ? opts.stderrEncoding : io.SYSTEM_ENCODING;
+    dart.throw(new core.UnsupportedError("Process.runSync"));
+  }
+  static killPid(pid, signal) {
+    if (signal === void 0) signal = io.ProcessSignal.SIGTERM;
+    dart.throw(new core.UnsupportedError("Process.killPid"));
+  }
+};
+dart.setSignature(io.Process, {
+  fields: () => ({exitCode: FutureOfint()}),
+  statics: () => ({
+    start: dart.definiteFunctionType(async.Future$(io.Process), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, mode: io.ProcessStartMode}),
+    run: dart.definiteFunctionType(async.Future$(io.ProcessResult), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
+    runSync: dart.definiteFunctionType(io.ProcessResult, [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
+    killPid: dart.definiteFunctionType(core.bool, [core.int], [io.ProcessSignal])
+  }),
+  names: ['start', 'run', 'runSync', 'killPid']
+});
+io.ProcessResult = class ProcessResult extends core.Object {
+  new(pid, exitCode, stdout, stderr) {
+    this.pid = pid;
+    this.exitCode = exitCode;
+    this.stdout = stdout;
+    this.stderr = stderr;
+  }
+};
+dart.setSignature(io.ProcessResult, {
+  constructors: () => ({new: dart.definiteFunctionType(io.ProcessResult, [core.int, core.int, dart.dynamic, dart.dynamic])}),
+  fields: () => ({
+    exitCode: core.int,
+    stdout: dart.dynamic,
+    stderr: dart.dynamic,
+    pid: core.int
+  })
+});
+const _signalNumber = Symbol('_signalNumber');
+const _name = Symbol('_name');
+io.ProcessSignal = class ProcessSignal extends core.Object {
+  _(signalNumber, name) {
+    this[_signalNumber] = signalNumber;
+    this[_name] = name;
+  }
+  toString() {
+    return this[_name];
+  }
+  watch() {
+    return io._ProcessUtils._watchSignal(this);
+  }
+};
+dart.defineNamedConstructor(io.ProcessSignal, '_');
+dart.setSignature(io.ProcessSignal, {
+  constructors: () => ({_: dart.definiteFunctionType(io.ProcessSignal, [core.int, core.String])}),
+  fields: () => ({
+    [_signalNumber]: core.int,
+    [_name]: core.String
+  }),
+  methods: () => ({watch: dart.definiteFunctionType(async.Stream$(io.ProcessSignal), [])}),
+  sfields: () => ({
+    SIGHUP: io.ProcessSignal,
+    SIGINT: io.ProcessSignal,
+    SIGQUIT: io.ProcessSignal,
+    SIGILL: io.ProcessSignal,
+    SIGTRAP: io.ProcessSignal,
+    SIGABRT: io.ProcessSignal,
+    SIGBUS: io.ProcessSignal,
+    SIGFPE: io.ProcessSignal,
+    SIGKILL: io.ProcessSignal,
+    SIGUSR1: io.ProcessSignal,
+    SIGSEGV: io.ProcessSignal,
+    SIGUSR2: io.ProcessSignal,
+    SIGPIPE: io.ProcessSignal,
+    SIGALRM: io.ProcessSignal,
+    SIGTERM: io.ProcessSignal,
+    SIGCHLD: io.ProcessSignal,
+    SIGCONT: io.ProcessSignal,
+    SIGSTOP: io.ProcessSignal,
+    SIGTSTP: io.ProcessSignal,
+    SIGTTIN: io.ProcessSignal,
+    SIGTTOU: io.ProcessSignal,
+    SIGURG: io.ProcessSignal,
+    SIGXCPU: io.ProcessSignal,
+    SIGXFSZ: io.ProcessSignal,
+    SIGVTALRM: io.ProcessSignal,
+    SIGPROF: io.ProcessSignal,
+    SIGWINCH: io.ProcessSignal,
+    SIGPOLL: io.ProcessSignal,
+    SIGSYS: io.ProcessSignal
+  })
+});
+dart.defineLazy(io.ProcessSignal, {
+  get SIGHUP() {
+    return dart.const(new io.ProcessSignal._(1, "SIGHUP"));
+  },
+  get SIGINT() {
+    return dart.const(new io.ProcessSignal._(2, "SIGINT"));
+  },
+  get SIGQUIT() {
+    return dart.const(new io.ProcessSignal._(3, "SIGQUIT"));
+  },
+  get SIGILL() {
+    return dart.const(new io.ProcessSignal._(4, "SIGILL"));
+  },
+  get SIGTRAP() {
+    return dart.const(new io.ProcessSignal._(5, "SIGTRAP"));
+  },
+  get SIGABRT() {
+    return dart.const(new io.ProcessSignal._(6, "SIGABRT"));
+  },
+  get SIGBUS() {
+    return dart.const(new io.ProcessSignal._(7, "SIGBUS"));
+  },
+  get SIGFPE() {
+    return dart.const(new io.ProcessSignal._(8, "SIGFPE"));
+  },
+  get SIGKILL() {
+    return dart.const(new io.ProcessSignal._(9, "SIGKILL"));
+  },
+  get SIGUSR1() {
+    return dart.const(new io.ProcessSignal._(10, "SIGUSR1"));
+  },
+  get SIGSEGV() {
+    return dart.const(new io.ProcessSignal._(11, "SIGSEGV"));
+  },
+  get SIGUSR2() {
+    return dart.const(new io.ProcessSignal._(12, "SIGUSR2"));
+  },
+  get SIGPIPE() {
+    return dart.const(new io.ProcessSignal._(13, "SIGPIPE"));
+  },
+  get SIGALRM() {
+    return dart.const(new io.ProcessSignal._(14, "SIGALRM"));
+  },
+  get SIGTERM() {
+    return dart.const(new io.ProcessSignal._(15, "SIGTERM"));
+  },
+  get SIGCHLD() {
+    return dart.const(new io.ProcessSignal._(17, "SIGCHLD"));
+  },
+  get SIGCONT() {
+    return dart.const(new io.ProcessSignal._(18, "SIGCONT"));
+  },
+  get SIGSTOP() {
+    return dart.const(new io.ProcessSignal._(19, "SIGSTOP"));
+  },
+  get SIGTSTP() {
+    return dart.const(new io.ProcessSignal._(20, "SIGTSTP"));
+  },
+  get SIGTTIN() {
+    return dart.const(new io.ProcessSignal._(21, "SIGTTIN"));
+  },
+  get SIGTTOU() {
+    return dart.const(new io.ProcessSignal._(22, "SIGTTOU"));
+  },
+  get SIGURG() {
+    return dart.const(new io.ProcessSignal._(23, "SIGURG"));
+  },
+  get SIGXCPU() {
+    return dart.const(new io.ProcessSignal._(24, "SIGXCPU"));
+  },
+  get SIGXFSZ() {
+    return dart.const(new io.ProcessSignal._(25, "SIGXFSZ"));
+  },
+  get SIGVTALRM() {
+    return dart.const(new io.ProcessSignal._(26, "SIGVTALRM"));
+  },
+  get SIGPROF() {
+    return dart.const(new io.ProcessSignal._(27, "SIGPROF"));
+  },
+  get SIGWINCH() {
+    return dart.const(new io.ProcessSignal._(28, "SIGWINCH"));
+  },
+  get SIGPOLL() {
+    return dart.const(new io.ProcessSignal._(29, "SIGPOLL"));
+  },
+  get SIGSYS() {
+    return dart.const(new io.ProcessSignal._(31, "SIGSYS"));
+  }
+});
+io.SignalException = class SignalException extends core.Object {
+  new(message, osError) {
+    if (osError === void 0) osError = null;
+    this.message = message;
+    this.osError = osError;
+  }
+  toString() {
+    let msg = "";
+    if (this.osError != null) {
+      msg = dart.str`, osError: ${this.osError}`;
+    }
+    return dart.str`SignalException: ${this.message}${msg}`;
+  }
+};
+io.SignalException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.SignalException, {
+  constructors: () => ({new: dart.definiteFunctionType(io.SignalException, [core.String], [dart.dynamic])}),
+  fields: () => ({
+    message: core.String,
+    osError: dart.dynamic
+  })
+});
+io.ProcessException = class ProcessException extends core.Object {
+  new(executable, arguments$, message, errorCode) {
+    if (message === void 0) message = "";
+    if (errorCode === void 0) errorCode = 0;
+    this.executable = executable;
+    this.arguments = arguments$;
+    this.message = message;
+    this.errorCode = errorCode;
+  }
+  toString() {
+    let msg = this.message == null ? dart.str`OS error code: ${this.errorCode}` : this.message;
+    let args = this.arguments[dartx.join](' ');
+    return dart.str`ProcessException: ${msg}\n  Command: ${this.executable} ${args}`;
+  }
+};
+io.ProcessException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.ProcessException, {
+  constructors: () => ({new: dart.definiteFunctionType(io.ProcessException, [core.String, ListOfString()], [core.String, core.int])}),
+  fields: () => ({
+    executable: core.String,
+    arguments: ListOfString(),
+    message: core.String,
+    errorCode: core.int
+  })
+});
+const _detachRaw = Symbol('_detachRaw');
+io.SecureSocket = class SecureSocket extends core.Object {
+  static _(rawSocket) {
+    dart.throw(new core.UnsupportedError("SecureSocket constructor"));
+  }
+  static connect(host, port, opts) {
+    let context = opts && 'context' in opts ? opts.context : null;
+    let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+    let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+    return io.RawSecureSocket.connect(host, port, {context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols}).then(io.SecureSocket)(dart.fn(rawSocket => io.SecureSocket._(rawSocket), RawSecureSocketToSecureSocket()));
+  }
+  static secure(socket, opts) {
+    let host = opts && 'host' in opts ? opts.host : null;
+    let context = opts && 'context' in opts ? opts.context : null;
+    let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+    let completer = async.Completer.new();
+    dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket._check(dart.dindex(detachedRaw, 0)), {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
+      completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
+    }, dynamicToNull()));
+    return FutureOfSecureSocket()._check(completer.future);
+  }
+  static secureServer(socket, context, opts) {
+    let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+    let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+    let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+    let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+    let completer = async.Completer.new();
+    dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket._check(dart.dindex(detachedRaw, 0)), context, {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
+      completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
+    }, dynamicToNull()));
+    return FutureOfSecureSocket()._check(completer.future);
+  }
+};
+io.SecureSocket[dart.implements] = () => [io.Socket];
+dart.setSignature(io.SecureSocket, {
+  constructors: () => ({_: dart.definiteFunctionType(io.SecureSocket, [io.RawSecureSocket])}),
+  statics: () => ({
+    connect: dart.definiteFunctionType(async.Future$(io.SecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+    secure: dart.definiteFunctionType(async.Future$(io.SecureSocket), [io.Socket], {host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool()}),
+    secureServer: dart.definiteFunctionType(async.Future$(io.SecureSocket), [io.Socket, io.SecurityContext], {bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+  }),
+  names: ['connect', 'secure', 'secureServer']
+});
+io.SecureServerSocket = class SecureServerSocket extends async.Stream$(io.SecureSocket) {
+  _(socket) {
+    this[_socket] = socket;
+    super.new();
+  }
+  static bind(address, port, context, opts) {
+    let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+    let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+    let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+    let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+    let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+    let shared = opts && 'shared' in opts ? opts.shared : false;
+    return io.RawSecureServerSocket.bind(address, port, context, {backlog: backlog, v6Only: v6Only, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols, shared: shared}).then(io.SecureServerSocket)(dart.fn(serverSocket => new io.SecureServerSocket._(serverSocket), RawSecureServerSocketToSecureServerSocket()));
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    return this[_socket].map(io.SecureSocket)(dart.fn(rawSocket => io.SecureSocket._(rawSocket), RawSecureSocketToSecureSocket())).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  get port() {
+    return this[_socket].port;
+  }
+  get address() {
+    return this[_socket].address;
+  }
+  close() {
+    return this[_socket].close().then(io.SecureServerSocket)(dart.fn(_ => this, RawSecureServerSocketToSecureServerSocket()));
+  }
+  set [_owner](owner) {
+    this[_socket][_owner] = owner;
+  }
+};
+dart.addSimpleTypeTests(io.SecureServerSocket);
+dart.defineNamedConstructor(io.SecureServerSocket, '_');
+dart.setSignature(io.SecureServerSocket, {
+  constructors: () => ({_: dart.definiteFunctionType(io.SecureServerSocket, [io.RawSecureServerSocket])}),
+  fields: () => ({[_socket]: io.RawSecureServerSocket}),
+  getters: () => ({
+    port: dart.definiteFunctionType(core.int, []),
+    address: dart.definiteFunctionType(io.InternetAddress, [])
+  }),
+  setters: () => ({[_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+  methods: () => ({
+    listen: dart.definiteFunctionType(async.StreamSubscription$(io.SecureSocket), [SecureSocketTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    close: dart.definiteFunctionType(async.Future$(io.SecureServerSocket), [])
+  }),
+  statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.SecureServerSocket), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString(), shared: core.bool})}),
+  names: ['bind']
+});
+const _onSubscriptionStateChange = Symbol('_onSubscriptionStateChange');
+const _onPauseStateChange = Symbol('_onPauseStateChange');
+io.RawSecureSocket = class RawSecureSocket extends core.Object {
+  static connect(host, port, opts) {
+    let context = opts && 'context' in opts ? opts.context : null;
+    let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+    let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+    io._RawSecureSocket._verifyFields(host, port, false, false, false, onBadCertificate);
+    return io.RawSocket.connect(host, port).then(io.RawSecureSocket)(dart.fn(socket => io.RawSecureSocket.secure(socket, {context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols}), RawSocketToFutureOfRawSecureSocket()));
+  }
+  static secure(socket, opts) {
+    let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+    let host = opts && 'host' in opts ? opts.host : null;
+    let context = opts && 'context' in opts ? opts.context : null;
+    let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+    let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+    socket.readEventsEnabled = false;
+    socket.writeEventsEnabled = false;
+    return io._RawSecureSocket.connect(host != null ? host : socket.address.host, socket.port, {is_server: false, socket: socket, subscription: subscription, context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols});
+  }
+  static secureServer(socket, context, opts) {
+    let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+    let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+    let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+    let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+    let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+    socket.readEventsEnabled = false;
+    socket.writeEventsEnabled = false;
+    return io._RawSecureSocket.connect(socket.address, socket.remotePort, {context: context, is_server: true, socket: socket, subscription: subscription, bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols});
+  }
+};
+io.RawSecureSocket[dart.implements] = () => [io.RawSocket];
+dart.setSignature(io.RawSecureSocket, {
+  statics: () => ({
+    connect: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+    secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: async.StreamSubscription, host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+    secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+  }),
+  names: ['connect', 'secure', 'secureServer']
+});
+io.RawSecureServerSocket = class RawSecureServerSocket extends async.Stream$(io.RawSecureSocket) {
+  _(socket, context, requestClientCertificate, requireClientCertificate, supportedProtocols) {
+    this[_socket] = socket;
+    this[_context] = context;
+    this.requestClientCertificate = requestClientCertificate;
+    this.requireClientCertificate = requireClientCertificate;
+    this.supportedProtocols = supportedProtocols;
+    this[_controller] = null;
+    this[_subscription] = null;
+    this[_closed] = false;
+    super.new();
+    this[_controller] = StreamControllerOfRawSecureSocket().new({sync: true, onListen: dart.bind(this, _onSubscriptionStateChange), onPause: dart.bind(this, _onPauseStateChange), onResume: dart.bind(this, _onPauseStateChange), onCancel: dart.bind(this, _onSubscriptionStateChange)});
+  }
+  static bind(address, port, context, opts) {
+    let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+    let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+    let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+    let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+    let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+    let shared = opts && 'shared' in opts ? opts.shared : false;
+    return io.RawServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io.RawSecureServerSocket)(dart.fn(serverSocket => new io.RawSecureServerSocket._(serverSocket, context, requestClientCertificate, requireClientCertificate, supportedProtocols), RawServerSocketToRawSecureServerSocket()));
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  get port() {
+    return this[_socket].port;
+  }
+  get address() {
+    return this[_socket].address;
+  }
+  close() {
+    this[_closed] = true;
+    return this[_socket].close().then(io.RawSecureServerSocket)(dart.fn(_ => this, RawServerSocketToRawSecureServerSocket()));
+  }
+  [_onData](connection) {
+    let remotePort = null;
+    try {
+      remotePort = connection.remotePort;
+    } catch (e) {
+      return;
+    }
+
+    io._RawSecureSocket.connect(connection.address, core.int._check(remotePort), {context: this[_context], is_server: true, socket: connection, requestClientCertificate: this.requestClientCertificate, requireClientCertificate: this.requireClientCertificate, supportedProtocols: this.supportedProtocols}).then(dart.dynamic)(dart.fn(secureConnection => {
+      if (dart.test(this[_closed])) {
+        secureConnection.close();
+      } else {
+        this[_controller].add(secureConnection);
+      }
+    }, RawSecureSocketToNull())).catchError(dart.fn((e, s) => {
+      if (!dart.test(this[_closed])) {
+        this[_controller].addError(e, core.StackTrace._check(s));
+      }
+    }, dynamicAnddynamicToNull()));
+  }
+  [_onPauseStateChange]() {
+    if (dart.test(this[_controller].isPaused)) {
+      this[_subscription].pause();
+    } else {
+      this[_subscription].resume();
+    }
+  }
+  [_onSubscriptionStateChange]() {
+    if (dart.test(this[_controller].hasListener)) {
+      this[_subscription] = this[_socket].listen(dart.bind(this, _onData), {onError: dart.bind(this[_controller], 'addError'), onDone: dart.bind(this[_controller], 'close')});
+    } else {
+      this.close();
+    }
+  }
+  set [_owner](owner) {
+    dart.dput(this[_socket], _owner, owner);
+  }
+};
+dart.addSimpleTypeTests(io.RawSecureServerSocket);
+dart.defineNamedConstructor(io.RawSecureServerSocket, '_');
+dart.setSignature(io.RawSecureServerSocket, {
+  constructors: () => ({_: dart.definiteFunctionType(io.RawSecureServerSocket, [io.RawServerSocket, io.SecurityContext, core.bool, core.bool, ListOfString()])}),
+  fields: () => ({
+    [_socket]: io.RawServerSocket,
+    [_controller]: StreamControllerOfRawSecureSocket(),
+    [_subscription]: StreamSubscriptionOfRawSocket(),
+    [_context]: io.SecurityContext,
+    requestClientCertificate: core.bool,
+    requireClientCertificate: core.bool,
+    supportedProtocols: ListOfString(),
+    [_closed]: core.bool
+  }),
+  getters: () => ({
+    port: dart.definiteFunctionType(core.int, []),
+    address: dart.definiteFunctionType(io.InternetAddress, [])
+  }),
+  setters: () => ({[_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+  methods: () => ({
+    listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSecureSocket), [RawSecureSocketTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    close: dart.definiteFunctionType(async.Future$(io.RawSecureServerSocket), []),
+    [_onData]: dart.definiteFunctionType(dart.void, [io.RawSocket]),
+    [_onPauseStateChange]: dart.definiteFunctionType(dart.void, []),
+    [_onSubscriptionStateChange]: dart.definiteFunctionType(dart.void, [])
+  }),
+  statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawSecureServerSocket), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString(), shared: core.bool})}),
+  names: ['bind']
+});
+io.X509Certificate = class X509Certificate extends core.Object {
+  static _() {
+    dart.throw(new core.UnsupportedError("X509Certificate constructor"));
+  }
+};
+dart.setSignature(io.X509Certificate, {
+  constructors: () => ({_: dart.definiteFunctionType(io.X509Certificate, [])})
+});
+io._FilterStatus = class _FilterStatus extends core.Object {
+  new() {
+    this.progress = false;
+    this.readEmpty = true;
+    this.writeEmpty = true;
+    this.readPlaintextNoLongerEmpty = false;
+    this.writePlaintextNoLongerFull = false;
+    this.readEncryptedNoLongerFull = false;
+    this.writeEncryptedNoLongerEmpty = false;
+  }
+};
+dart.setSignature(io._FilterStatus, {
+  constructors: () => ({new: dart.definiteFunctionType(io._FilterStatus, [])}),
+  fields: () => ({
+    progress: core.bool,
+    readEmpty: core.bool,
+    writeEmpty: core.bool,
+    readPlaintextNoLongerEmpty: core.bool,
+    writePlaintextNoLongerFull: core.bool,
+    readEncryptedNoLongerFull: core.bool,
+    writeEncryptedNoLongerEmpty: core.bool
+  })
+});
+const _handshakeComplete = Symbol('_handshakeComplete');
+const _status = Symbol('_status');
+const _filterStatus = Symbol('_filterStatus');
+const _secureFilter = Symbol('_secureFilter');
+const _bufferedData = Symbol('_bufferedData');
+const _bufferedDataIndex = Symbol('_bufferedDataIndex');
+const _writeEventsEnabled = Symbol('_writeEventsEnabled');
+const _readEventsEnabled = Symbol('_readEventsEnabled');
+const _pendingReadEvent = Symbol('_pendingReadEvent');
+const _socketClosedRead = Symbol('_socketClosedRead');
+const _socketClosedWrite = Symbol('_socketClosedWrite');
+const _closedRead = Symbol('_closedRead');
+const _closedWrite = Symbol('_closedWrite');
+const _connectPending = Symbol('_connectPending');
+const _filterPending = Symbol('_filterPending');
+const _filterActive = Symbol('_filterActive');
+const _selectedProtocol = Symbol('_selectedProtocol');
+const _secureHandshakeCompleteHandler = Symbol('_secureHandshakeCompleteHandler');
+const _onBadCertificateWrapper = Symbol('_onBadCertificateWrapper');
+const _eventDispatcher = Symbol('_eventDispatcher');
+const _doneHandler = Symbol('_doneHandler');
+const _secureHandshake = Symbol('_secureHandshake');
+const _sendWriteEvent = Symbol('_sendWriteEvent');
+const _completeCloseCompleter = Symbol('_completeCloseCompleter');
+const _close = Symbol('_close');
+const _scheduleReadEvent = Symbol('_scheduleReadEvent');
+const _scheduleFilter = Symbol('_scheduleFilter');
+const _readHandler = Symbol('_readHandler');
+const _writeHandler = Symbol('_writeHandler');
+const _closeHandler = Symbol('_closeHandler');
+const _readSocket = Symbol('_readSocket');
+const _writeSocket = Symbol('_writeSocket');
+const _tryFilter = Symbol('_tryFilter');
+const _pushAllFilterStages = Symbol('_pushAllFilterStages');
+const _readSocketOrBufferedData = Symbol('_readSocketOrBufferedData');
+const _sendReadEvent = Symbol('_sendReadEvent');
+let const;
+io.RawSocketEvent = class RawSocketEvent extends core.Object {
+  _(value) {
+    this[_value] = value;
+  }
+  toString() {
+    return (const || (const = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value]);
+  }
+};
+dart.defineNamedConstructor(io.RawSocketEvent, '_');
+dart.setSignature(io.RawSocketEvent, {
+  constructors: () => ({_: dart.definiteFunctionType(io.RawSocketEvent, [core.int])}),
+  fields: () => ({[_value]: core.int}),
+  sfields: () => ({
+    READ: io.RawSocketEvent,
+    WRITE: io.RawSocketEvent,
+    READ_CLOSED: io.RawSocketEvent,
+    CLOSED: io.RawSocketEvent
+  })
+});
+dart.defineLazy(io.RawSocketEvent, {
+  get READ() {
+    return dart.const(new io.RawSocketEvent._(0));
+  },
+  get WRITE() {
+    return dart.const(new io.RawSocketEvent._(1));
+  },
+  get READ_CLOSED() {
+    return dart.const(new io.RawSocketEvent._(2));
+  },
+  get CLOSED() {
+    return dart.const(new io.RawSocketEvent._(3));
+  }
+});
+io._RawSecureSocket = class _RawSecureSocket extends async.Stream$(io.RawSocketEvent) {
+  static _isBufferEncrypted(identifier) {
+    return dart.notNull(identifier) >= dart.notNull(io._RawSecureSocket.READ_ENCRYPTED);
+  }
+  static connect(host, requestedPort, opts) {
+    let is_server = opts && 'is_server' in opts ? opts.is_server : null;
+    let context = opts && 'context' in opts ? opts.context : null;
+    let socket = opts && 'socket' in opts ? opts.socket : null;
+    let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+    let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+    let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+    let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+    let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+    let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+    io._RawSecureSocket._verifyFields(host, requestedPort, is_server, requestClientCertificate, requireClientCertificate, onBadCertificate);
+    if (io.InternetAddress.is(host)) host = dart.dload(host, 'host');
+    let address = socket.address;
+    if (host != null) {
+      address = io.InternetAddress._cloneWithNewHost(address, core.String._check(host));
+    }
+    return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, StreamSubscriptionOfRawSocketEvent()._check(subscription), bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
+  }
+  new(address, requestedPort, is_server, context, socket, socketSubscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols) {
+    this[_handshakeComplete] = CompleterOf_RawSecureSocket().new();
+    this[_status] = io._RawSecureSocket.HANDSHAKE;
+    this[_closeCompleter] = async.Completer.new();
+    this[_filterStatus] = new io._FilterStatus();
+    this[_secureFilter] = io._SecureFilter.new();
+    this.address = address;
+    this.is_server = is_server;
+    this.context = context;
+    this[_socket] = socket;
+    this[_socketSubscription] = socketSubscription;
+    this[_bufferedData] = bufferedData;
+    this.requestClientCertificate = requestClientCertificate;
+    this.requireClientCertificate = requireClientCertificate;
+    this.onBadCertificate = onBadCertificate;
+    this[_controller] = null;
+    this[_stream] = null;
+    this[_bufferedDataIndex] = 0;
+    this[_writeEventsEnabled] = true;
+    this[_readEventsEnabled] = true;
+    this[_pauseCount] = 0;
+    this[_pendingReadEvent] = false;
+    this[_socketClosedRead] = false;
+    this[_socketClosedWrite] = false;
+    this[_closedRead] = false;
+    this[_closedWrite] = false;
+    this[_connectPending] = true;
+    this[_filterPending] = false;
+    this[_filterActive] = false;
+    this[_selectedProtocol] = null;
+    super.new();
+    if (this.context == null) {
+      this.context = io.SecurityContext.defaultContext;
+    }
+    this[_controller] = StreamControllerOfRawSocketEvent().new({sync: true, onListen: dart.bind(this, _onSubscriptionStateChange), onPause: dart.bind(this, _onPauseStateChange), onResume: dart.bind(this, _onPauseStateChange), onCancel: dart.bind(this, _onSubscriptionStateChange)});
+    this[_stream] = this[_controller].stream;
+    this[_secureFilter].init();
+    this[_secureFilter].registerHandshakeCompleteCallback(dart.bind(this, _secureHandshakeCompleteHandler));
+    if (this.onBadCertificate != null) {
+      this[_secureFilter].registerBadCertificateCallback(dart.bind(this, _onBadCertificateWrapper));
+    }
+    this[_socket].readEventsEnabled = true;
+    this[_socket].writeEventsEnabled = false;
+    if (this[_socketSubscription] == null) {
+      this[_socketSubscription] = this[_socket].listen(dart.bind(this, _eventDispatcher), {onError: dart.bind(this, _reportError), onDone: dart.bind(this, _doneHandler)});
+    } else {
+      if (dart.test(this[_socketSubscription].isPaused)) {
+        this[_socket].close();
+        dart.throw(new core.ArgumentError("Subscription passed to TLS upgrade is paused"));
+      }
+      let s = this[_socket];
+      if (dart.test(dart.dload(dart.dload(s, _socket), 'closedReadEventSent'))) {
+        this[_eventDispatcher](io.RawSocketEvent.READ_CLOSED);
+      }
+      let _ = this[_socketSubscription];
+      _.onData(dart.bind(this, _eventDispatcher));
+      _.onError(dart.bind(this, _reportError));
+      _.onDone(dart.bind(this, _doneHandler));
+    }
+    try {
+      let encodedProtocols = io.SecurityContext._protocolsToLengthEncoding(supportedProtocols);
+      this[_secureFilter].connect(this.address.host, this.context, this.is_server, dart.test(this.requestClientCertificate) || dart.test(this.requireClientCertificate), this.requireClientCertificate, encodedProtocols);
+      this[_secureHandshake]();
+    } catch (e) {
+      let s = dart.stackTrace(e);
+      this[_reportError](e, s);
+    }
+
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    this[_sendWriteEvent]();
+    return this[_stream].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  static _verifyFields(host, requestedPort, is_server, requestClientCertificate, requireClientCertificate, onBadCertificate) {
+    if (!(typeof host == 'string') && !io.InternetAddress.is(host)) {
+      dart.throw(new core.ArgumentError("host is not a String or an InternetAddress"));
+    }
+    if (!(typeof requestedPort == 'number')) {
+      dart.throw(new core.ArgumentError("requestedPort is not an int"));
+    }
+    if (dart.notNull(requestedPort) < 0 || dart.notNull(requestedPort) > 65535) {
+      dart.throw(new core.ArgumentError("requestedPort is not in the range 0..65535"));
+    }
+    if (!(typeof requestClientCertificate == 'boolean')) {
+      dart.throw(new core.ArgumentError("requestClientCertificate is not a bool"));
+    }
+    if (!(typeof requireClientCertificate == 'boolean')) {
+      dart.throw(new core.ArgumentError("requireClientCertificate is not a bool"));
+    }
+    if (onBadCertificate != null && !core.Function.is(onBadCertificate)) {
+      dart.throw(new core.ArgumentError("onBadCertificate is not null or a Function"));
+    }
+  }
+  get port() {
+    return this[_socket].port;
+  }
+  get remoteAddress() {
+    return this[_socket].remoteAddress;
+  }
+  get remotePort() {
+    return this[_socket].remotePort;
+  }
+  set [_owner](owner) {
+    dart.dput(this[_socket], _owner, owner);
+  }
+  available() {
+    return this[_status] != io._RawSecureSocket.CONNECTED ? 0 : this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).length;
+  }
+  close() {
+    this.shutdown(io.SocketDirection.BOTH);
+    return FutureOfRawSecureSocket()._check(this[_closeCompleter].future);
+  }
+  [_completeCloseCompleter](dummy) {
+    if (dummy === void 0) dummy = null;
+    if (!dart.test(this[_closeCompleter].isCompleted)) this[_closeCompleter].complete(this);
+  }
+  [_close]() {
+    this[_closedWrite] = true;
+    this[_closedRead] = true;
+    if (this[_socket] != null) {
+      this[_socket].close().then(dart.void)(dart.bind(this, _completeCloseCompleter));
+    } else {
+      this[_completeCloseCompleter]();
+    }
+    this[_socketClosedWrite] = true;
+    this[_socketClosedRead] = true;
+    if (!dart.test(this[_filterActive]) && this[_secureFilter] != null) {
+      this[_secureFilter].destroy();
+      this[_secureFilter] = null;
+    }
+    if (this[_socketSubscription] != null) {
+      this[_socketSubscription].cancel();
+    }
+    this[_controller].close();
+    this[_status] = io._RawSecureSocket.CLOSED;
+  }
+  shutdown(direction) {
+    if (dart.equals(direction, io.SocketDirection.SEND) || dart.equals(direction, io.SocketDirection.BOTH)) {
+      this[_closedWrite] = true;
+      if (dart.test(this[_filterStatus].writeEmpty)) {
+        this[_socket].shutdown(io.SocketDirection.SEND);
+        this[_socketClosedWrite] = true;
+        if (dart.test(this[_closedRead])) {
+          this[_close]();
+        }
+      }
+    }
+    if (dart.equals(direction, io.SocketDirection.RECEIVE) || dart.equals(direction, io.SocketDirection.BOTH)) {
+      this[_closedRead] = true;
+      this[_socketClosedRead] = true;
+      this[_socket].shutdown(io.SocketDirection.RECEIVE);
+      if (dart.test(this[_socketClosedWrite])) {
+        this[_close]();
+      }
+    }
+  }
+  get writeEventsEnabled() {
+    return this[_writeEventsEnabled];
+  }
+  set writeEventsEnabled(value) {
+    this[_writeEventsEnabled] = value;
+    if (dart.test(value)) {
+      async.Timer.run(dart.fn(() => this[_sendWriteEvent](), VoidTovoid()));
+    }
+  }
+  get readEventsEnabled() {
+    return this[_readEventsEnabled];
+  }
+  set readEventsEnabled(value) {
+    this[_readEventsEnabled] = value;
+    this[_scheduleReadEvent]();
+  }
+  read(length) {
+    if (length === void 0) length = null;
+    if (length != null && (!(typeof length == 'number') || dart.notNull(length) < 0)) {
+      dart.throw(new core.ArgumentError(dart.str`Invalid length parameter in SecureSocket.read (length: ${length})`));
+    }
+    if (dart.test(this[_closedRead])) {
+      dart.throw(new io.SocketException("Reading from a closed socket"));
+    }
+    if (this[_status] != io._RawSecureSocket.CONNECTED) {
+      return null;
+    }
+    let result = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).read(length);
+    this[_scheduleFilter]();
+    return result;
+  }
+  write(data, offset, bytes) {
+    if (offset === void 0) offset = null;
+    if (bytes === void 0) bytes = null;
+    if (bytes != null && (!(typeof bytes == 'number') || dart.notNull(bytes) < 0)) {
+      dart.throw(new core.ArgumentError(dart.str`Invalid bytes parameter in SecureSocket.read (bytes: ${bytes})`));
+    }
+    if (offset != null && (!(typeof offset == 'number') || dart.notNull(offset) < 0)) {
+      dart.throw(new core.ArgumentError(dart.str`Invalid offset parameter in SecureSocket.read (offset: ${offset})`));
+    }
+    if (dart.test(this[_closedWrite])) {
+      this[_controller].addError(new io.SocketException("Writing to a closed socket"));
+      return 0;
+    }
+    if (this[_status] != io._RawSecureSocket.CONNECTED) return 0;
+    if (offset == null) offset = 0;
+    if (bytes == null) bytes = dart.notNull(data[dartx.length]) - dart.notNull(offset);
+    let written = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).write(data, offset, bytes);
+    if (dart.notNull(written) > 0) {
+      this[_filterStatus].writeEmpty = false;
+    }
+    this[_scheduleFilter]();
+    return written;
+  }
+  get peerCertificate() {
+    return this[_secureFilter].peerCertificate;
+  }
+  get selectedProtocol() {
+    return this[_selectedProtocol];
+  }
+  [_onBadCertificateWrapper](certificate) {
+    if (this.onBadCertificate == null) return false;
+    let result = dart.dcall(this.onBadCertificate, certificate);
+    if (typeof result == 'boolean') return result;
+    dart.throw(new io.HandshakeException(dart.str`onBadCertificate callback returned non-boolean ${result}`));
+  }
+  setOption(option, enabled) {
+    if (this[_socket] == null) return false;
+    return this[_socket].setOption(option, enabled);
+  }
+  [_eventDispatcher](event) {
+    try {
+      if (dart.equals(event, io.RawSocketEvent.READ)) {
+        this[_readHandler]();
+      } else if (dart.equals(event, io.RawSocketEvent.WRITE)) {
+        this[_writeHandler]();
+      } else if (dart.equals(event, io.RawSocketEvent.READ_CLOSED)) {
+        this[_closeHandler]();
+      }
+    } catch (e) {
+      let stackTrace = dart.stackTrace(e);
+      this[_reportError](e, stackTrace);
+    }
+
+  }
+  [_readHandler]() {
+    this[_readSocket]();
+    this[_scheduleFilter]();
+  }
+  [_writeHandler]() {
+    this[_writeSocket]();
+    this[_scheduleFilter]();
+  }
+  [_doneHandler]() {
+    if (dart.test(this[_filterStatus].readEmpty)) {
+      this[_close]();
+    }
+  }
+  [_reportError](e, stackTrace) {
+    if (stackTrace === void 0) stackTrace = null;
+    if (this[_status] == io._RawSecureSocket.CLOSED) {
+      return;
+    } else if (dart.test(this[_connectPending])) {
+      this[_handshakeComplete].completeError(e, stackTrace);
+    } else {
+      this[_controller].addError(e, stackTrace);
+    }
+    this[_close]();
+  }
+  [_closeHandler]() {
+    if (this[_status] == io._RawSecureSocket.CONNECTED) {
+      if (dart.test(this[_closedRead])) return;
+      this[_socketClosedRead] = true;
+      if (dart.test(this[_filterStatus].readEmpty)) {
+        this[_closedRead] = true;
+        this[_controller].add(io.RawSocketEvent.READ_CLOSED);
+        if (dart.test(this[_socketClosedWrite])) {
+          this[_close]();
+        }
+      } else {
+        this[_scheduleFilter]();
+      }
+    } else if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+      this[_socketClosedRead] = true;
+      if (dart.test(this[_filterStatus].readEmpty)) {
+        this[_reportError](new io.HandshakeException('Connection terminated during handshake'), null);
+      } else {
+        this[_secureHandshake]();
+      }
+    }
+  }
+  [_secureHandshake]() {
+    try {
+      this[_secureFilter].handshake();
+      this[_filterStatus].writeEmpty = false;
+      this[_readSocket]();
+      this[_writeSocket]();
+      this[_scheduleFilter]();
+    } catch (e) {
+      let stackTrace = dart.stackTrace(e);
+      this[_reportError](e, stackTrace);
+    }
+
+  }
+  renegotiate(opts) {
+    let useSessionCache = opts && 'useSessionCache' in opts ? opts.useSessionCache : true;
+    let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+    let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+    if (this[_status] != io._RawSecureSocket.CONNECTED) {
+      dart.throw(new io.HandshakeException("Called renegotiate on a non-connected socket"));
+    }
+    this[_secureFilter].renegotiate(useSessionCache, requestClientCertificate, requireClientCertificate);
+    this[_status] = io._RawSecureSocket.HANDSHAKE;
+    this[_filterStatus].writeEmpty = false;
+    this[_scheduleFilter]();
+  }
+  [_secureHandshakeCompleteHandler]() {
+    this[_status] = io._RawSecureSocket.CONNECTED;
+    if (dart.test(this[_connectPending])) {
+      this[_connectPending] = false;
+      try {
+        this[_selectedProtocol] = this[_secureFilter].selectedProtocol();
+        async.Timer.run(dart.fn(() => this[_handshakeComplete].complete(this), VoidTovoid()));
+      } catch (error) {
+        let stack = dart.stackTrace(error);
+        this[_handshakeComplete].completeError(error, stack);
+      }
+
+    }
+  }
+  [_onPauseStateChange]() {
+    if (dart.test(this[_controller].isPaused)) {
+      this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
+    } else {
+      this[_pauseCount] = dart.notNull(this[_pauseCount]) - 1;
+      if (this[_pauseCount] == 0) {
+        this[_scheduleReadEvent]();
+        this[_sendWriteEvent]();
+      }
+    }
+    if (!dart.test(this[_socketClosedRead]) || !dart.test(this[_socketClosedWrite])) {
+      if (dart.test(this[_controller].isPaused)) {
+        this[_socketSubscription].pause();
+      } else {
+        this[_socketSubscription].resume();
+      }
+    }
+  }
+  [_onSubscriptionStateChange]() {
+    if (dart.test(this[_controller].hasListener)) {
+    }
+  }
+  [_scheduleFilter]() {
+    this[_filterPending] = true;
+    this[_tryFilter]();
+  }
+  [_tryFilter]() {
+    if (this[_status] == io._RawSecureSocket.CLOSED) {
+      return;
+    }
+    if (dart.test(this[_filterPending]) && !dart.test(this[_filterActive])) {
+      this[_filterActive] = true;
+      this[_filterPending] = false;
+      this[_pushAllFilterStages]().then(dart.dynamic)(dart.fn(status => {
+        this[_filterStatus] = status;
+        this[_filterActive] = false;
+        if (this[_status] == io._RawSecureSocket.CLOSED) {
+          this[_secureFilter].destroy();
+          this[_secureFilter] = null;
+          return;
+        }
+        this[_socket].readEventsEnabled = true;
+        if (dart.test(this[_filterStatus].writeEmpty) && dart.test(this[_closedWrite]) && !dart.test(this[_socketClosedWrite])) {
+          this.shutdown(io.SocketDirection.SEND);
+          if (this[_status] == io._RawSecureSocket.CLOSED) {
+            return;
+          }
+        }
+        if (dart.test(this[_filterStatus].readEmpty) && dart.test(this[_socketClosedRead]) && !dart.test(this[_closedRead])) {
+          if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+            this[_secureFilter].handshake();
+            if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+              dart.throw(new io.HandshakeException('Connection terminated during handshake'));
+            }
+          }
+          this[_closeHandler]();
+        }
+        if (this[_status] == io._RawSecureSocket.CLOSED) {
+          return;
+        }
+        if (dart.test(this[_filterStatus].progress)) {
+          this[_filterPending] = true;
+          if (dart.test(this[_filterStatus].writeEncryptedNoLongerEmpty)) {
+            this[_writeSocket]();
+          }
+          if (dart.test(this[_filterStatus].writePlaintextNoLongerFull)) {
+            this[_sendWriteEvent]();
+          }
+          if (dart.test(this[_filterStatus].readEncryptedNoLongerFull)) {
+            this[_readSocket]();
+          }
+          if (dart.test(this[_filterStatus].readPlaintextNoLongerEmpty)) {
+            this[_scheduleReadEvent]();
+          }
+          if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+            this[_secureHandshake]();
+          }
+        }
+        this[_tryFilter]();
+      }, _FilterStatusToNull())).catchError(dart.bind(this, _reportError));
+    }
+  }
+  [_readSocketOrBufferedData](bytes) {
+    if (this[_bufferedData] != null) {
+      if (dart.notNull(bytes) > dart.notNull(this[_bufferedData][dartx.length]) - dart.notNull(this[_bufferedDataIndex])) {
+        bytes = dart.notNull(this[_bufferedData][dartx.length]) - dart.notNull(this[_bufferedDataIndex]);
+      }
+      let result = this[_bufferedData][dartx.sublist](this[_bufferedDataIndex], dart.notNull(this[_bufferedDataIndex]) + dart.notNull(bytes));
+      this[_bufferedDataIndex] = dart.notNull(this[_bufferedDataIndex]) + dart.notNull(bytes);
+      if (this[_bufferedData][dartx.length] == this[_bufferedDataIndex]) {
+        this[_bufferedData] = null;
+      }
+      return result;
+    } else if (!dart.test(this[_socketClosedRead])) {
+      return this[_socket].read(bytes);
+    } else {
+      return null;
+    }
+  }
+  [_readSocket]() {
+    if (this[_status] == io._RawSecureSocket.CLOSED) return;
+    let buffer = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_ENCRYPTED);
+    if (dart.notNull(buffer.writeFromSource(dart.bind(this, _readSocketOrBufferedData))) > 0) {
+      this[_filterStatus].readEmpty = false;
+    } else {
+      this[_socket].readEventsEnabled = false;
+    }
+  }
+  [_writeSocket]() {
+    if (dart.test(this[_socketClosedWrite])) return;
+    let buffer = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_ENCRYPTED);
+    if (dart.test(buffer.readToSocket(this[_socket]))) {
+      this[_socket].writeEventsEnabled = true;
+    }
+  }
+  [_scheduleReadEvent]() {
+    if (!dart.test(this[_pendingReadEvent]) && dart.test(this[_readEventsEnabled]) && this[_pauseCount] == 0 && this[_secureFilter] != null && !dart.test(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).isEmpty)) {
+      this[_pendingReadEvent] = true;
+      async.Timer.run(dart.bind(this, _sendReadEvent));
+    }
+  }
+  [_sendReadEvent]() {
+    this[_pendingReadEvent] = false;
+    if (this[_status] != io._RawSecureSocket.CLOSED && dart.test(this[_readEventsEnabled]) && this[_pauseCount] == 0 && this[_secureFilter] != null && !dart.test(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).isEmpty)) {
+      this[_controller].add(io.RawSocketEvent.READ);
+      this[_scheduleReadEvent]();
+    }
+  }
+  [_sendWriteEvent]() {
+    if (!dart.test(this[_closedWrite]) && dart.test(this[_writeEventsEnabled]) && this[_pauseCount] == 0 && this[_secureFilter] != null && dart.notNull(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).free) > 0) {
+      this[_writeEventsEnabled] = false;
+      this[_controller].add(io.RawSocketEvent.WRITE);
+    }
+  }
+  [_pushAllFilterStages]() {
+    let wasInHandshake = this[_status] != io._RawSecureSocket.CONNECTED;
+    let args = core.List.new(2 + dart.notNull(io._RawSecureSocket.NUM_BUFFERS) * 2);
+    args[dartx._set](0, this[_secureFilter][_pointer]());
+    args[dartx._set](1, wasInHandshake);
+    let bufs = this[_secureFilter].buffers;
+    for (let i = 0; i < dart.notNull(io._RawSecureSocket.NUM_BUFFERS); ++i) {
+      args[dartx._set](2 * i + 2, bufs[dartx._get](i).start);
+      args[dartx._set](2 * i + 3, bufs[dartx._get](i).end);
+    }
+    return io._IOService._dispatch(io._SSL_PROCESS_FILTER, args).then(io._FilterStatus)(dart.fn(response => {
+      if (dart.equals(dart.dload(response, 'length'), 2)) {
+        if (wasInHandshake) {
+          this[_reportError](new io.HandshakeException(dart.str`${dart.dindex(response, 1)} error ${dart.dindex(response, 0)}`), null);
+        } else {
+          this[_reportError](new io.TlsException(dart.str`${dart.dindex(response, 1)} error ${dart.dindex(response, 0)}`), null);
+        }
+      }
+      function start(index) {
+        return core.int._check(dart.dindex(response, 2 * dart.notNull(index)));
+      }
+      dart.fn(start, intToint());
+      function end(index) {
+        return core.int._check(dart.dindex(response, 2 * dart.notNull(index) + 1));
+      }
+      dart.fn(end, intToint());
+      let status = new io._FilterStatus();
+      status.writeEmpty = dart.test(bufs[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).isEmpty) && start(io._RawSecureSocket.WRITE_ENCRYPTED) == end(io._RawSecureSocket.WRITE_ENCRYPTED);
+      if (wasInHandshake) status.writeEmpty = false;
+      status.readEmpty = dart.test(bufs[dartx._get](io._RawSecureSocket.READ_ENCRYPTED).isEmpty) && start(io._RawSecureSocket.READ_PLAINTEXT) == end(io._RawSecureSocket.READ_PLAINTEXT);
+      let buffer = bufs[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT);
+      let new_start = start(io._RawSecureSocket.WRITE_PLAINTEXT);
+      if (new_start != buffer.start) {
+        status.progress = true;
+        if (buffer.free == 0) {
+          status.writePlaintextNoLongerFull = true;
+        }
+        buffer.start = new_start;
+      }
+      buffer = bufs[dartx._get](io._RawSecureSocket.READ_ENCRYPTED);
+      new_start = start(io._RawSecureSocket.READ_ENCRYPTED);
+      if (new_start != buffer.start) {
+        status.progress = true;
+        if (buffer.free == 0) {
+          status.readEncryptedNoLongerFull = true;
+        }
+        buffer.start = new_start;
+      }
+      buffer = bufs[dartx._get](io._RawSecureSocket.WRITE_ENCRYPTED);
+      let new_end = end(io._RawSecureSocket.WRITE_ENCRYPTED);
+      if (new_end != buffer.end) {
+        status.progress = true;
+        if (buffer.length == 0) {
+          status.writeEncryptedNoLongerEmpty = true;
+        }
+        buffer.end = new_end;
+      }
+      buffer = bufs[dartx._get](io._RawSecureSocket.READ_PLAINTEXT);
+      new_end = end(io._RawSecureSocket.READ_PLAINTEXT);
+      if (new_end != buffer.end) {
+        status.progress = true;
+        if (buffer.length == 0) {
+          status.readPlaintextNoLongerEmpty = true;
+        }
+        buffer.end = new_end;
+      }
+      return status;
+    }, dynamicTo_FilterStatus()));
+  }
+};
+dart.addSimpleTypeTests(io._RawSecureSocket);
+io._RawSecureSocket[dart.implements] = () => [io.RawSecureSocket];
+dart.setSignature(io._RawSecureSocket, {
+  constructors: () => ({new: dart.definiteFunctionType(io._RawSecureSocket, [io.InternetAddress, core.int, core.bool, io.SecurityContext, io.RawSocket, StreamSubscriptionOfRawSocketEvent(), ListOfint(), core.bool, core.bool, X509CertificateTodynamic(), ListOfString()])}),
+  fields: () => ({
+    [_socket]: io.RawSocket,
+    [_handshakeComplete]: CompleterOf_RawSecureSocket(),
+    [_controller]: StreamControllerOfRawSocketEvent(),
+    [_stream]: StreamOfRawSocketEvent(),
+    [_socketSubscription]: StreamSubscriptionOfRawSocketEvent(),
+    [_bufferedData]: ListOfint(),
+    [_bufferedDataIndex]: core.int,
+    address: io.InternetAddress,
+    is_server: core.bool,
+    context: io.SecurityContext,
+    requestClientCertificate: core.bool,
+    requireClientCertificate: core.bool,
+    onBadCertificate: core.Function,
+    [_status]: core.int,
+    [_writeEventsEnabled]: core.bool,
+    [_readEventsEnabled]: core.bool,
+    [_pauseCount]: core.int,
+    [_pendingReadEvent]: core.bool,
+    [_socketClosedRead]: core.bool,
+    [_socketClosedWrite]: core.bool,
+    [_closedRead]: core.bool,
+    [_closedWrite]: core.bool,
+    [_closeCompleter]: async.Completer,
+    [_filterStatus]: io._FilterStatus,
+    [_connectPending]: core.bool,
+    [_filterPending]: core.bool,
+    [_filterActive]: core.bool,
+    [_secureFilter]: io._SecureFilter,
+    [_selectedProtocol]: core.String
+  }),
+  getters: () => ({
+    port: dart.definiteFunctionType(core.int, []),
+    remoteAddress: dart.definiteFunctionType(io.InternetAddress, []),
+    remotePort: dart.definiteFunctionType(core.int, []),
+    writeEventsEnabled: dart.definiteFunctionType(core.bool, []),
+    readEventsEnabled: dart.definiteFunctionType(core.bool, []),
+    peerCertificate: dart.definiteFunctionType(io.X509Certificate, []),
+    selectedProtocol: dart.definiteFunctionType(core.String, [])
+  }),
+  setters: () => ({
+    [_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+    writeEventsEnabled: dart.definiteFunctionType(dart.void, [core.bool]),
+    readEventsEnabled: dart.definiteFunctionType(dart.void, [core.bool])
+  }),
+  methods: () => ({
+    listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSocketEvent), [RawSocketEventTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    available: dart.definiteFunctionType(core.int, []),
+    close: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), []),
+    [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [dart.dynamic]),
+    [_close]: dart.definiteFunctionType(dart.void, []),
+    shutdown: dart.definiteFunctionType(dart.void, [io.SocketDirection]),
+    read: dart.definiteFunctionType(core.List$(core.int), [], [core.int]),
+    write: dart.definiteFunctionType(core.int, [ListOfint()], [core.int, core.int]),
+    [_onBadCertificateWrapper]: dart.definiteFunctionType(core.bool, [io.X509Certificate]),
+    setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
+    [_eventDispatcher]: dart.definiteFunctionType(dart.void, [io.RawSocketEvent]),
+    [_readHandler]: dart.definiteFunctionType(dart.void, []),
+    [_writeHandler]: dart.definiteFunctionType(dart.void, []),
+    [_doneHandler]: dart.definiteFunctionType(dart.void, []),
+    [_reportError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+    [_closeHandler]: dart.definiteFunctionType(dart.void, []),
+    [_secureHandshake]: dart.definiteFunctionType(dart.void, []),
+    renegotiate: dart.definiteFunctionType(dart.void, [], {useSessionCache: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool}),
+    [_secureHandshakeCompleteHandler]: dart.definiteFunctionType(dart.void, []),
+    [_onPauseStateChange]: dart.definiteFunctionType(dart.void, []),
+    [_onSubscriptionStateChange]: dart.definiteFunctionType(dart.void, []),
+    [_scheduleFilter]: dart.definiteFunctionType(dart.void, []),
+    [_tryFilter]: dart.definiteFunctionType(dart.void, []),
+    [_readSocketOrBufferedData]: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+    [_readSocket]: dart.definiteFunctionType(dart.void, []),
+    [_writeSocket]: dart.definiteFunctionType(dart.void, []),
+    [_scheduleReadEvent]: dart.definiteFunctionType(dart.dynamic, []),
+    [_sendReadEvent]: dart.definiteFunctionType(dart.dynamic, []),
+    [_sendWriteEvent]: dart.definiteFunctionType(dart.dynamic, []),
+    [_pushAllFilterStages]: dart.definiteFunctionType(async.Future$(io._FilterStatus), [])
+  }),
+  sfields: () => ({
+    HANDSHAKE: core.int,
+    CONNECTED: core.int,
+    CLOSED: core.int,
+    READ_PLAINTEXT: core.int,
+    WRITE_PLAINTEXT: core.int,
+    READ_ENCRYPTED: core.int,
+    WRITE_ENCRYPTED: core.int,
+    NUM_BUFFERS: core.int
+  }),
+  statics: () => ({
+    _isBufferEncrypted: dart.definiteFunctionType(core.bool, [core.int]),
+    connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+    _verifyFields: dart.definiteFunctionType(dart.void, [dart.dynamic, core.int, core.bool, core.bool, core.bool, core.Function])
+  }),
+  names: ['_isBufferEncrypted', 'connect', '_verifyFields']
+});
+io._RawSecureSocket.HANDSHAKE = 201;
+io._RawSecureSocket.CONNECTED = 202;
+io._RawSecureSocket.CLOSED = 203;
+io._RawSecureSocket.READ_PLAINTEXT = 0;
+io._RawSecureSocket.WRITE_PLAINTEXT = 1;
+io._RawSecureSocket.READ_ENCRYPTED = 2;
+io._RawSecureSocket.WRITE_ENCRYPTED = 3;
+io._RawSecureSocket.NUM_BUFFERS = 4;
+io._ExternalBuffer = class _ExternalBuffer extends core.Object {
+  new(size) {
+    this.size = size;
+    this.data = null;
+    this.start = null;
+    this.end = null;
+    this.start = core.int._check(this.end = core.int._check(dart.dsend(this.size, '~/', 2)));
+  }
+  advanceStart(bytes) {
+    dart.assert(dart.notNull(this.start) > dart.notNull(this.end) || dart.notNull(this.start) + dart.notNull(bytes) <= dart.notNull(this.end));
+    this.start = dart.notNull(this.start) + dart.notNull(bytes);
+    if (dart.notNull(this.start) >= dart.notNull(core.num._check(this.size))) {
+      this.start = dart.notNull(this.start) - dart.notNull(core.num._check(this.size));
+      dart.assert(dart.notNull(this.start) <= dart.notNull(this.end));
+      dart.assert(dart.notNull(this.start) < dart.notNull(core.num._check(this.size)));
+    }
+  }
+  advanceEnd(bytes) {
+    dart.assert(dart.notNull(this.start) <= dart.notNull(this.end) || dart.notNull(this.start) > dart.notNull(this.end) + dart.notNull(bytes));
+    this.end = dart.notNull(this.end) + dart.notNull(bytes);
+    if (dart.notNull(this.end) >= dart.notNull(core.num._check(this.size))) {
+      this.end = dart.notNull(this.end) - dart.notNull(core.num._check(this.size));
+      dart.assert(dart.notNull(this.end) < dart.notNull(this.start));
+      dart.assert(dart.notNull(this.end) < dart.notNull(core.num._check(this.size)));
+    }
+  }
+  get isEmpty() {
+    return this.end == this.start;
+  }
+  get length() {
+    return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.dsend(dart.dsend(this.size, '+', this.end), '-', this.start) : dart.notNull(this.end) - dart.notNull(this.start));
+  }
+  get linearLength() {
+    return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.dsend(this.size, '-', this.start) : dart.notNull(this.end) - dart.notNull(this.start));
+  }
+  get free() {
+    return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.notNull(this.start) - dart.notNull(this.end) - 1 : dart.dsend(dart.dsend(dart.dsend(this.size, '+', this.start), '-', this.end), '-', 1));
+  }
+  get linearFree() {
+    if (dart.notNull(this.start) > dart.notNull(this.end)) return dart.notNull(this.start) - dart.notNull(this.end) - 1;
+    if (this.start == 0) return core.int._check(dart.dsend(dart.dsend(this.size, '-', this.end), '-', 1));
+    return core.int._check(dart.dsend(this.size, '-', this.end));
+  }
+  read(bytes) {
+    if (bytes == null) {
+      bytes = this.length;
+    } else {
+      bytes = math.min(core.int)(bytes, this.length);
+    }
+    if (bytes == 0) return null;
+    let result = typed_data.Uint8List.new(bytes);
+    let bytesRead = 0;
+    while (dart.notNull(bytesRead) < dart.notNull(bytes)) {
+      let toRead = math.min(core.int)(dart.notNull(bytes) - dart.notNull(bytesRead), this.linearLength);
+      result[dartx.setRange](bytesRead, dart.notNull(bytesRead) + dart.notNull(toRead), this.data, this.start);
+      this.advanceStart(toRead);
+      bytesRead = dart.notNull(bytesRead) + dart.notNull(toRead);
+    }
+    return result;
+  }
+  write(inputData, offset, bytes) {
+    if (dart.notNull(bytes) > dart.notNull(this.free)) {
+      bytes = this.free;
+    }
+    let written = 0;
+    let toWrite = math.min(core.int)(bytes, this.linearFree);
+    while (dart.notNull(toWrite) > 0) {
+      this.data[dartx.setRange](this.end, dart.notNull(this.end) + dart.notNull(toWrite), inputData, offset);
+      this.advanceEnd(toWrite);
+      offset = dart.notNull(offset) + dart.notNull(toWrite);
+      written = dart.notNull(written) + dart.notNull(toWrite);
+      toWrite = math.min(core.int)(dart.notNull(bytes) - dart.notNull(written), this.linearFree);
+    }
+    return written;
+  }
+  writeFromSource(getData) {
+    let written = 0;
+    let toWrite = this.linearFree;
+    while (dart.notNull(toWrite) > 0) {
+      let inputData = getData(toWrite);
+      if (inputData == null || inputData[dartx.length] == 0) break;
+      let len = inputData[dartx.length];
+      this.data[dartx.setRange](this.end, dart.notNull(this.end) + dart.notNull(len), inputData);
+      this.advanceEnd(len);
+      written = dart.notNull(written) + dart.notNull(len);
+      toWrite = this.linearFree;
+    }
+    return written;
+  }
+  readToSocket(socket) {
+    while (true) {
+      let toWrite = this.linearLength;
+      if (toWrite == 0) return false;
+      let bytes = socket.write(ListOfint()._check(this.data), this.start, toWrite);
+      this.advanceStart(bytes);
+      if (dart.notNull(bytes) < dart.notNull(toWrite)) {
+        return true;
+      }
+    }
+  }
+};
+dart.setSignature(io._ExternalBuffer, {
+  constructors: () => ({new: dart.definiteFunctionType(io._ExternalBuffer, [dart.dynamic])}),
+  fields: () => ({
+    data: core.List,
+    start: core.int,
+    end: core.int,
+    size: dart.dynamic
+  }),
+  getters: () => ({
+    isEmpty: dart.definiteFunctionType(core.bool, []),
+    length: dart.definiteFunctionType(core.int, []),
+    linearLength: dart.definiteFunctionType(core.int, []),
+    free: dart.definiteFunctionType(core.int, []),
+    linearFree: dart.definiteFunctionType(core.int, [])
+  }),
+  methods: () => ({
+    advanceStart: dart.definiteFunctionType(dart.void, [core.int]),
+    advanceEnd: dart.definiteFunctionType(dart.void, [core.int]),
+    read: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+    write: dart.definiteFunctionType(core.int, [ListOfint(), core.int, core.int]),
+    writeFromSource: dart.definiteFunctionType(core.int, [intToListOfint()]),
+    readToSocket: dart.definiteFunctionType(core.bool, [io.RawSocket])
+  })
+});
+io._SecureFilter = class _SecureFilter extends core.Object {
+  static new() {
+    dart.throw(new core.UnsupportedError("_SecureFilter._SecureFilter"));
+  }
+};
+dart.setSignature(io._SecureFilter, {
+  constructors: () => ({new: dart.definiteFunctionType(io._SecureFilter, [])})
+});
+io.TlsException = class TlsException extends core.Object {
+  new(message, osError) {
+    if (message === void 0) message = "";
+    if (osError === void 0) osError = null;
+    TlsException.prototype._.call(this, "TlsException", message, osError);
+  }
+  _(type, message, osError) {
+    this.type = type;
+    this.message = message;
+    this.osError = osError;
+  }
+  toString() {
+    let sb = new core.StringBuffer();
+    sb.write(this.type);
+    if (!dart.test(this.message[dartx.isEmpty])) {
+      sb.write(dart.str`: ${this.message}`);
+      if (this.osError != null) {
+        sb.write(dart.str` (${this.osError})`);
+      }
+    } else if (this.osError != null) {
+      sb.write(dart.str`: ${this.osError}`);
+    }
+    return sb.toString();
+  }
+};
+dart.defineNamedConstructor(io.TlsException, '_');
+io.TlsException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.TlsException, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io.TlsException, [], [core.String, io.OSError]),
+    _: dart.definiteFunctionType(io.TlsException, [core.String, core.String, io.OSError])
+  }),
+  fields: () => ({
+    type: core.String,
+    message: core.String,
+    osError: io.OSError
+  })
+});
+io.HandshakeException = class HandshakeException extends io.TlsException {
+  new(message, osError) {
+    if (message === void 0) message = "";
+    if (osError === void 0) osError = null;
+    super._("HandshakeException", message, osError);
+  }
+};
+dart.setSignature(io.HandshakeException, {
+  constructors: () => ({new: dart.definiteFunctionType(io.HandshakeException, [], [core.String, io.OSError])})
+});
+io.CertificateException = class CertificateException extends io.TlsException {
+  new(message, osError) {
+    if (message === void 0) message = "";
+    if (osError === void 0) osError = null;
+    super._("CertificateException", message, osError);
+  }
+};
+dart.setSignature(io.CertificateException, {
+  constructors: () => ({new: dart.definiteFunctionType(io.CertificateException, [], [core.String, io.OSError])})
+});
+io.SecurityContext = class SecurityContext extends core.Object {
+  static new() {
+    dart.throw(new core.UnsupportedError("SecurityContext constructor"));
+  }
+  static get defaultContext() {
+    dart.throw(new core.UnsupportedError("default SecurityContext getter"));
+  }
+  static get alpnSupported() {
+    dart.throw(new core.UnsupportedError("SecurityContext alpnSupported getter"));
+  }
+  static _protocolsToLengthEncoding(protocols) {
+    if (protocols == null || protocols[dartx.length] == 0) {
+      return typed_data.Uint8List.new(0);
+    }
+    let protocolsLength = protocols[dartx.length];
+    let expectedLength = protocolsLength;
+    for (let i = 0; i < dart.notNull(protocolsLength); i++) {
+      let length = protocols[dartx._get](i)[dartx.length];
+      if (dart.notNull(length) > 0 && dart.notNull(length) <= 255) {
+        expectedLength = dart.notNull(expectedLength) + dart.notNull(length);
+      } else {
+        dart.throw(new core.ArgumentError(dart.str`Length of protocol must be between 1 and 255 (was: ${length}).`));
+      }
+    }
+    if (dart.notNull(expectedLength) >= 1 << 13) {
+      dart.throw(new core.ArgumentError('The maximum message length supported is 2^13-1.'));
+    }
+    let bytes = typed_data.Uint8List.new(expectedLength);
+    let bytesOffset = 0;
+    for (let i = 0; i < dart.notNull(protocolsLength); i++) {
+      let proto = protocols[dartx._get](i);
+      bytes[dartx._set](bytesOffset++, proto[dartx.length]);
+      let bits = 0;
+      for (let j = 0; j < dart.notNull(proto[dartx.length]); j++) {
+        let char = proto[dartx.codeUnitAt](j);
+        bits = (dart.notNull(bits) | dart.notNull(char)) >>> 0;
+        bytes[dartx._set](bytesOffset++, dart.notNull(char) & 255);
+      }
+      if (dart.notNull(bits) > 127) {
+        return io.SecurityContext._protocolsToLengthEncodingNonAsciiBailout(protocols);
+      }
+    }
+    return bytes;
+  }
+  static _protocolsToLengthEncodingNonAsciiBailout(protocols) {
+    function addProtocol(outBytes, protocol) {
+      let protocolBytes = convert.UTF8.encode(protocol);
+      let len = protocolBytes[dartx.length];
+      if (dart.notNull(len) > 255) {
+        dart.throw(new core.ArgumentError(dart.str`Length of protocol must be between 1 and 255 (was: ${len})`));
+      }
+      outBytes[dartx.add](len);
+      outBytes[dartx.addAll](protocolBytes);
+    }
+    dart.fn(addProtocol, ListOfintAndStringTovoid());
+    let bytes = JSArrayOfint().of([]);
+    for (let i = 0; i < dart.notNull(protocols[dartx.length]); i++) {
+      addProtocol(bytes, protocols[dartx._get](i));
+    }
+    if (dart.notNull(bytes[dartx.length]) >= 1 << 13) {
+      dart.throw(new core.ArgumentError('The maximum message length supported is 2^13-1.'));
+    }
+    return typed_data.Uint8List.fromList(bytes);
+  }
+};
+dart.setSignature(io.SecurityContext, {
+  constructors: () => ({new: dart.definiteFunctionType(io.SecurityContext, [])}),
+  sgetters: () => ({
+    defaultContext: dart.definiteFunctionType(io.SecurityContext, []),
+    alpnSupported: dart.definiteFunctionType(core.bool, [])
+  }),
+  statics: () => ({
+    _protocolsToLengthEncoding: dart.definiteFunctionType(typed_data.Uint8List, [ListOfString()]),
+    _protocolsToLengthEncodingNonAsciiBailout: dart.definiteFunctionType(typed_data.Uint8List, [ListOfString()])
+  }),
+  names: ['_protocolsToLengthEncoding', '_protocolsToLengthEncodingNonAsciiBailout']
+});
+io._nextServiceId = 1;
+io.InternetAddressType = class InternetAddressType extends core.Object {
+  _(value) {
+    this[_value] = value;
+  }
+  static _from(value) {
+    if (value == 0) return io.InternetAddressType.IP_V4;
+    if (value == 1) return io.InternetAddressType.IP_V6;
+    dart.throw(new core.ArgumentError(dart.str`Invalid type: ${value}`));
+  }
+  get name() {
+    switch (this[_value]) {
+      case -1:
+      {
+        return "ANY";
+      }
+      case 0:
+      {
+        return "IP_V4";
+      }
+      case 1:
+      {
+        return "IP_V6";
+      }
+      default:
+      {
+        dart.throw(new core.ArgumentError("Invalid InternetAddress"));
+      }
+    }
+  }
+  toString() {
+    return dart.str`InternetAddressType: ${this.name}`;
+  }
+};
+dart.defineNamedConstructor(io.InternetAddressType, '_');
+dart.setSignature(io.InternetAddressType, {
+  constructors: () => ({
+    _: dart.definiteFunctionType(io.InternetAddressType, [core.int]),
+    _from: dart.definiteFunctionType(io.InternetAddressType, [core.int])
+  }),
+  fields: () => ({[_value]: core.int}),
+  getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+  sfields: () => ({
+    IP_V4: io.InternetAddressType,
+    IP_V6: io.InternetAddressType,
+    ANY: io.InternetAddressType
+  })
+});
+dart.defineLazy(io.InternetAddressType, {
+  get IP_V4() {
+    return dart.const(new io.InternetAddressType._(0));
+  },
+  get IP_V6() {
+    return dart.const(new io.InternetAddressType._(1));
+  },
+  get ANY() {
+    return dart.const(new io.InternetAddressType._(-1));
+  }
+});
+io.InternetAddress = class InternetAddress extends core.Object {
+  static get LOOPBACK_IP_V4() {
+    dart.throw(new core.UnsupportedError("InternetAddress.LOOPBACK_IP_V4"));
+  }
+  static get LOOPBACK_IP_V6() {
+    dart.throw(new core.UnsupportedError("InternetAddress.LOOPBACK_IP_V6"));
+  }
+  static get ANY_IP_V4() {
+    dart.throw(new core.UnsupportedError("InternetAddress.ANY_IP_V4"));
+  }
+  static get ANY_IP_V6() {
+    dart.throw(new core.UnsupportedError("InternetAddress.ANY_IP_V6"));
+  }
+  static new(address) {
+    dart.throw(new core.UnsupportedError("InternetAddress"));
+  }
+  static lookup(host, opts) {
+    let type = opts && 'type' in opts ? opts.type : io.InternetAddressType.ANY;
+    dart.throw(new core.UnsupportedError("InternetAddress.lookup"));
+  }
+  static _cloneWithNewHost(address, host) {
+    dart.throw(new core.UnsupportedError("InternetAddress._cloneWithNewHost"));
+  }
+};
+dart.setSignature(io.InternetAddress, {
+  constructors: () => ({new: dart.definiteFunctionType(io.InternetAddress, [core.String])}),
+  fields: () => ({type: io.InternetAddressType}),
+  sgetters: () => ({
+    LOOPBACK_IP_V4: dart.definiteFunctionType(io.InternetAddress, []),
+    LOOPBACK_IP_V6: dart.definiteFunctionType(io.InternetAddress, []),
+    ANY_IP_V4: dart.definiteFunctionType(io.InternetAddress, []),
+    ANY_IP_V6: dart.definiteFunctionType(io.InternetAddress, [])
+  }),
+  statics: () => ({
+    lookup: dart.definiteFunctionType(async.Future$(core.List$(io.InternetAddress)), [core.String], {type: io.InternetAddressType}),
+    _cloneWithNewHost: dart.definiteFunctionType(io.InternetAddress, [io.InternetAddress, core.String])
+  }),
+  names: ['lookup', '_cloneWithNewHost']
+});
+io.NetworkInterface = class NetworkInterface extends core.Object {
+  static get listSupported() {
+    dart.throw(new core.UnsupportedError("NetworkInterface.listSupported"));
+  }
+  static list(opts) {
+    let includeLoopback = opts && 'includeLoopback' in opts ? opts.includeLoopback : false;
+    let includeLinkLocal = opts && 'includeLinkLocal' in opts ? opts.includeLinkLocal : false;
+    let type = opts && 'type' in opts ? opts.type : io.InternetAddressType.ANY;
+    dart.throw(new core.UnsupportedError("NetworkInterface.list"));
+  }
+};
+dart.setSignature(io.NetworkInterface, {
+  sgetters: () => ({listSupported: dart.definiteFunctionType(core.bool, [])}),
+  statics: () => ({list: dart.definiteFunctionType(async.Future$(core.List$(io.NetworkInterface)), [], {includeLoopback: core.bool, includeLinkLocal: core.bool, type: io.InternetAddressType})}),
+  names: ['list']
+});
+io.RawServerSocket = class RawServerSocket extends core.Object {
+  static bind(address, port, opts) {
+    let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+    let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+    let shared = opts && 'shared' in opts ? opts.shared : false;
+    dart.throw(new core.UnsupportedError("RawServerSocket.bind"));
+  }
+};
+io.RawServerSocket[dart.implements] = () => [StreamOfRawSocket()];
+dart.setSignature(io.RawServerSocket, {
+  statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawServerSocket), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool})}),
+  names: ['bind']
+});
+io.ServerSocket = class ServerSocket extends core.Object {
+  static bind(address, port, opts) {
+    let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+    let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+    let shared = opts && 'shared' in opts ? opts.shared : false;
+    dart.throw(new core.UnsupportedError("ServerSocket.bind"));
+  }
+};
+io.ServerSocket[dart.implements] = () => [StreamOfSocket()];
+dart.setSignature(io.ServerSocket, {
+  statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.ServerSocket), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool})}),
+  names: ['bind']
+});
+io.SocketDirection = class SocketDirection extends core.Object {
+  _(value) {
+    this[_value] = value;
+  }
+};
+dart.defineNamedConstructor(io.SocketDirection, '_');
+dart.setSignature(io.SocketDirection, {
+  constructors: () => ({_: dart.definiteFunctionType(io.SocketDirection, [dart.dynamic])}),
+  fields: () => ({[_value]: dart.dynamic}),
+  sfields: () => ({
+    RECEIVE: io.SocketDirection,
+    SEND: io.SocketDirection,
+    BOTH: io.SocketDirection
+  })
+});
+dart.defineLazy(io.SocketDirection, {
+  get RECEIVE() {
+    return dart.const(new io.SocketDirection._(0));
+  },
+  get SEND() {
+    return dart.const(new io.SocketDirection._(1));
+  },
+  get BOTH() {
+    return dart.const(new io.SocketDirection._(2));
+  }
+});
+io.SocketOption = class SocketOption extends core.Object {
+  _(value) {
+    this[_value] = value;
+  }
+};
+dart.defineNamedConstructor(io.SocketOption, '_');
+dart.setSignature(io.SocketOption, {
+  constructors: () => ({_: dart.definiteFunctionType(io.SocketOption, [dart.dynamic])}),
+  fields: () => ({[_value]: dart.dynamic}),
+  sfields: () => ({
+    TCP_NODELAY: io.SocketOption,
+    _IP_MULTICAST_LOOP: io.SocketOption,
+    _IP_MULTICAST_HOPS: io.SocketOption,
+    _IP_MULTICAST_IF: io.SocketOption,
+    _IP_BROADCAST: io.SocketOption
+  })
+});
+dart.defineLazy(io.SocketOption, {
+  get TCP_NODELAY() {
+    return dart.const(new io.SocketOption._(0));
+  },
+  get _IP_MULTICAST_LOOP() {
+    return dart.const(new io.SocketOption._(1));
+  },
+  get _IP_MULTICAST_HOPS() {
+    return dart.const(new io.SocketOption._(2));
+  },
+  get _IP_MULTICAST_IF() {
+    return dart.const(new io.SocketOption._(3));
+  },
+  get _IP_BROADCAST() {
+    return dart.const(new io.SocketOption._(4));
+  }
+});
+io.RawSocket = class RawSocket extends core.Object {
+  new() {
+    this.readEventsEnabled = null;
+    this.writeEventsEnabled = null;
+  }
+  static connect(host, port, opts) {
+    let sourceAddress = opts && 'sourceAddress' in opts ? opts.sourceAddress : null;
+    dart.throw(new core.UnsupportedError("RawSocket constructor"));
+  }
+};
+io.RawSocket[dart.implements] = () => [StreamOfRawSocketEvent()];
+dart.setSignature(io.RawSocket, {
+  fields: () => ({
+    readEventsEnabled: core.bool,
+    writeEventsEnabled: core.bool
+  }),
+  statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.RawSocket), [dart.dynamic, core.int], {sourceAddress: dart.dynamic})}),
+  names: ['connect']
+});
+io.Socket = class Socket extends core.Object {
+  static connect(host, port, opts) {
+    let sourceAddress = opts && 'sourceAddress' in opts ? opts.sourceAddress : null;
+    dart.throw(new core.UnsupportedError("Socket constructor"));
+  }
+};
+io.Socket[dart.implements] = () => [StreamOfListOfint(), io.IOSink];
+dart.setSignature(io.Socket, {
+  statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.Socket), [dart.dynamic, core.int], {sourceAddress: dart.dynamic})}),
+  names: ['connect']
+});
+io.Datagram = class Datagram extends core.Object {
+  new(data, address, port) {
+    this.data = data;
+    this.address = address;
+    this.port = port;
+  }
+};
+dart.setSignature(io.Datagram, {
+  constructors: () => ({new: dart.definiteFunctionType(io.Datagram, [ListOfint(), io.InternetAddress, core.int])}),
+  fields: () => ({
+    data: ListOfint(),
+    address: io.InternetAddress,
+    port: core.int
+  })
+});
+io.RawDatagramSocket = class RawDatagramSocket extends async.Stream$(io.RawSocketEvent) {
+  new() {
+    this.readEventsEnabled = null;
+    this.writeEventsEnabled = null;
+    this.multicastLoopback = null;
+    this.multicastHops = null;
+    this.multicastInterface = null;
+    this.broadcastEnabled = null;
+    super.new();
+  }
+  static bind(host, port, opts) {
+    let reuseAddress = opts && 'reuseAddress' in opts ? opts.reuseAddress : true;
+    dart.throw(new core.UnsupportedError("RawDatagramSocket.bind"));
+  }
+};
+dart.addSimpleTypeTests(io.RawDatagramSocket);
+dart.setSignature(io.RawDatagramSocket, {
+  fields: () => ({
+    readEventsEnabled: core.bool,
+    writeEventsEnabled: core.bool,
+    multicastLoopback: core.bool,
+    multicastHops: core.int,
+    multicastInterface: io.NetworkInterface,
+    broadcastEnabled: core.bool
+  }),
+  statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawDatagramSocket), [dart.dynamic, core.int], {reuseAddress: core.bool})}),
+  names: ['bind']
+});
+io.SocketException = class SocketException extends core.Object {
+  new(message, opts) {
+    let osError = opts && 'osError' in opts ? opts.osError : null;
+    let address = opts && 'address' in opts ? opts.address : null;
+    let port = opts && 'port' in opts ? opts.port : null;
+    this.message = message;
+    this.osError = osError;
+    this.address = address;
+    this.port = port;
+  }
+  closed() {
+    this.message = 'Socket has been closed';
+    this.osError = null;
+    this.address = null;
+    this.port = null;
+  }
+  toString() {
+    let sb = new core.StringBuffer();
+    sb.write("SocketException");
+    if (!dart.test(this.message[dartx.isEmpty])) {
+      sb.write(dart.str`: ${this.message}`);
+      if (this.osError != null) {
+        sb.write(dart.str` (${this.osError})`);
+      }
+    } else if (this.osError != null) {
+      sb.write(dart.str`: ${this.osError}`);
+    }
+    if (this.address != null) {
+      sb.write(dart.str`, address = ${this.address.host}`);
+    }
+    if (this.port != null) {
+      sb.write(dart.str`, port = ${this.port}`);
+    }
+    return sb.toString();
+  }
+};
+dart.defineNamedConstructor(io.SocketException, 'closed');
+io.SocketException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.SocketException, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io.SocketException, [core.String], {osError: io.OSError, address: io.InternetAddress, port: core.int}),
+    closed: dart.definiteFunctionType(io.SocketException, [])
+  }),
+  fields: () => ({
+    message: core.String,
+    osError: io.OSError,
+    address: io.InternetAddress,
+    port: core.int
+  })
+});
+io._STDIO_HANDLE_TYPE_TERMINAL = 0;
+io._STDIO_HANDLE_TYPE_PIPE = 1;
+io._STDIO_HANDLE_TYPE_FILE = 2;
+io._STDIO_HANDLE_TYPE_SOCKET = 3;
+io._STDIO_HANDLE_TYPE_OTHER = 4;
+io._StdStream = class _StdStream extends async.Stream$(core.List$(core.int)) {
+  new(stream) {
+    this[_stream] = stream;
+    super.new();
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    return this[_stream].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+};
+dart.addSimpleTypeTests(io._StdStream);
+dart.setSignature(io._StdStream, {
+  constructors: () => ({new: dart.definiteFunctionType(io._StdStream, [StreamOfListOfint()])}),
+  fields: () => ({[_stream]: StreamOfListOfint()}),
+  methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+});
+io.Stdin = class Stdin extends io._StdStream {
+  _(stream) {
+    super.new(stream);
+  }
+  readLineSync(opts) {
+    let encoding = opts && 'encoding' in opts ? opts.encoding : io.SYSTEM_ENCODING;
+    let retainNewlines = opts && 'retainNewlines' in opts ? opts.retainNewlines : false;
+    let CR = 13;
+    let LF = 10;
+    let line = [];
+    let crIsNewline = dart.test(io.Platform.isWindows) && dart.equals(io.stdioType(io.stdin), io.StdioType.TERMINAL) && !dart.test(/* Unimplemented unknown name */lineMode);
+    if (dart.test(retainNewlines)) {
+      let byte = null;
+      do {
+        byte = this.readByteSync();
+        if (dart.notNull(byte) < 0) {
+          break;
+        }
+        line[dartx.add](byte);
+      } while (byte != LF && !(byte == CR && crIsNewline));
+      if (dart.test(line[dartx.isEmpty])) {
+        return null;
+      }
+    } else if (crIsNewline) {
+      while (true) {
+        let byte = this.readByteSync();
+        if (dart.notNull(byte) < 0) {
+          if (dart.test(line[dartx.isEmpty])) return null;
+          break;
+        }
+        if (byte == LF || byte == CR) break;
+        line[dartx.add](byte);
+      }
+    } else {
+      outer:
+        while (true) {
+          let byte = this.readByteSync();
+          if (byte == LF) break;
+          if (byte == CR) {
+            do {
+              byte = this.readByteSync();
+              if (byte == LF) break outer;
+              line[dartx.add](CR);
+            } while (byte == CR);
+          }
+          if (dart.notNull(byte) < 0) {
+            if (dart.test(line[dartx.isEmpty])) return null;
+            break;
+          }
+          line[dartx.add](byte);
+        }
+    }
+    return encoding.decode(ListOfint()._check(line));
+  }
+  set echoMode(enabled) {
+    dart.throw(new core.UnsupportedError("Stdin.echoMode"));
+  }
+  set echoMode(enabled) {
+    dart.throw(new core.UnsupportedError("Stdin.echoMode"));
+  }
+  set lineMode(enabled) {
+    dart.throw(new core.UnsupportedError("Stdin.lineMode"));
+  }
+  set lineMode(enabled) {
+    dart.throw(new core.UnsupportedError("Stdin.lineMode"));
+  }
+  readByteSync() {
+    dart.throw(new core.UnsupportedError("Stdin.readByteSync"));
+  }
+};
+dart.defineNamedConstructor(io.Stdin, '_');
+io.Stdin[dart.implements] = () => [StreamOfListOfint()];
+dart.setSignature(io.Stdin, {
+  constructors: () => ({_: dart.definiteFunctionType(io.Stdin, [StreamOfListOfint()])}),
+  setters: () => ({
+    echoMode: dart.definiteFunctionType(dart.void, [core.bool]),
+    echoMode: dart.definiteFunctionType(dart.void, [core.bool]),
+    lineMode: dart.definiteFunctionType(dart.void, [core.bool]),
+    lineMode: dart.definiteFunctionType(dart.void, [core.bool])
+  }),
+  methods: () => ({
+    readLineSync: dart.definiteFunctionType(core.String, [], {encoding: convert.Encoding, retainNewlines: core.bool}),
+    readByteSync: dart.definiteFunctionType(core.int, [])
+  })
+});
+const _fd = Symbol('_fd');
+const _nonBlocking = Symbol('_nonBlocking');
+const _hasTerminal = Symbol('_hasTerminal');
+const _terminalColumns = Symbol('_terminalColumns');
+const _terminalLines = Symbol('_terminalLines');
+io._StdSink = class _StdSink extends core.Object {
+  new(sink) {
+    this[_sink] = sink;
+  }
+  get encoding() {
+    return this[_sink].encoding;
+  }
+  set encoding(encoding) {
+    this[_sink].encoding = encoding;
+  }
+  write(object) {
+    this[_sink].write(object);
+  }
+  writeln(object) {
+    if (object === void 0) object = "";
+    this[_sink].writeln(object);
+  }
+  writeAll(objects, sep) {
+    if (sep === void 0) sep = "";
+    this[_sink].writeAll(objects, sep);
+  }
+  add(data) {
+    this[_sink].add(data);
+  }
+  addError(error, stackTrace) {
+    if (stackTrace === void 0) stackTrace = null;
+    this[_sink].addError(error, stackTrace);
+  }
+  writeCharCode(charCode) {
+    this[_sink].writeCharCode(charCode);
+  }
+  addStream(stream) {
+    return this[_sink].addStream(stream);
+  }
+  flush() {
+    return this[_sink].flush();
+  }
+  close() {
+    return this[_sink].close();
+  }
+  get done() {
+    return this[_sink].done;
+  }
+};
+io._StdSink[dart.implements] = () => [io.IOSink];
+dart.setSignature(io._StdSink, {
+  constructors: () => ({new: dart.definiteFunctionType(io._StdSink, [io.IOSink])}),
+  fields: () => ({[_sink]: io.IOSink}),
+  getters: () => ({
+    encoding: dart.definiteFunctionType(convert.Encoding, []),
+    done: dart.definiteFunctionType(async.Future, [])
+  }),
+  setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+  methods: () => ({
+    write: dart.definiteFunctionType(dart.void, [core.Object]),
+    writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+    writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+    add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+    addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+    writeCharCode: dart.definiteFunctionType(dart.void, [core.int]),
+    addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+    flush: dart.definiteFunctionType(async.Future, []),
+    close: dart.definiteFunctionType(async.Future, [])
+  })
+});
+io.Stdout = class Stdout extends io._StdSink {
+  _(sink, fd) {
+    this[_fd] = fd;
+    this[_nonBlocking] = null;
+    super.new(sink);
+  }
+  get hasTerminal() {
+    return this[_hasTerminal](this[_fd]);
+  }
+  get terminalColumns() {
+    return this[_terminalColumns](this[_fd]);
+  }
+  get terminalLines() {
+    return this[_terminalLines](this[_fd]);
+  }
+  [_hasTerminal](fd) {
+    dart.throw(new core.UnsupportedError("Stdout.hasTerminal"));
+  }
+  [_terminalColumns](fd) {
+    dart.throw(new core.UnsupportedError("Stdout.terminalColumns"));
+  }
+  [_terminalLines](fd) {
+    dart.throw(new core.UnsupportedError("Stdout.terminalLines"));
+  }
+  get nonBlocking() {
+    if (this[_nonBlocking] == null) {
+      this[_nonBlocking] = io.IOSink.new(new io._FileStreamConsumer.fromStdio(this[_fd]));
+    }
+    return this[_nonBlocking];
+  }
+};
+dart.defineNamedConstructor(io.Stdout, '_');
+io.Stdout[dart.implements] = () => [io.IOSink];
+dart.setSignature(io.Stdout, {
+  constructors: () => ({_: dart.definiteFunctionType(io.Stdout, [io.IOSink, core.int])}),
+  fields: () => ({
+    [_fd]: core.int,
+    [_nonBlocking]: io.IOSink
+  }),
+  getters: () => ({
+    hasTerminal: dart.definiteFunctionType(core.bool, []),
+    terminalColumns: dart.definiteFunctionType(core.int, []),
+    terminalLines: dart.definiteFunctionType(core.int, []),
+    nonBlocking: dart.definiteFunctionType(io.IOSink, [])
+  }),
+  methods: () => ({
+    [_hasTerminal]: dart.definiteFunctionType(core.bool, [core.int]),
+    [_terminalColumns]: dart.definiteFunctionType(core.int, [core.int]),
+    [_terminalLines]: dart.definiteFunctionType(core.int, [core.int])
+  })
+});
+io.StdoutException = class StdoutException extends core.Object {
+  new(message, osError) {
+    if (osError === void 0) osError = null;
+    this.message = message;
+    this.osError = osError;
+  }
+  toString() {
+    return dart.str`StdoutException: ${this.message}${this.osError == null ? "" : dart.str`, ${this.osError}`}`;
+  }
+};
+io.StdoutException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.StdoutException, {
+  constructors: () => ({new: dart.definiteFunctionType(io.StdoutException, [core.String], [io.OSError])}),
+  fields: () => ({
+    message: core.String,
+    osError: io.OSError
+  })
+});
+io._StdConsumer = class _StdConsumer extends core.Object {
+  new(fd) {
+    this[_file] = io._File._openStdioSync(fd);
+  }
+  addStream(stream) {
+    let completer = async.Completer.new();
+    let sub = null;
+    sub = stream.listen(dart.fn(data => {
+      try {
+        dart.dsend(this[_file], 'writeFromSync', data);
+      } catch (e) {
+        let s = dart.stackTrace(e);
+        dart.dsend(sub, 'cancel');
+        completer.completeError(e, s);
+      }
+
+    }, ListOfintToNull()), {onError: dart.bind(completer, 'completeError'), onDone: dart.bind(completer, 'complete'), cancelOnError: true});
+    return completer.future;
+  }
+  close() {
+    dart.dsend(this[_file], 'closeSync');
+    return async.Future.value();
+  }
+};
+io._StdConsumer[dart.implements] = () => [StreamConsumerOfListOfint()];
+dart.setSignature(io._StdConsumer, {
+  constructors: () => ({new: dart.definiteFunctionType(io._StdConsumer, [core.int])}),
+  fields: () => ({[_file]: dart.dynamic}),
+  methods: () => ({
+    addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+    close: dart.definiteFunctionType(async.Future, [])
+  })
+});
+io.StdioType = class StdioType extends core.Object {
+  _(name) {
+    this.name = name;
+  }
+  toString() {
+    return dart.str`StdioType: ${this.name}`;
+  }
+};
+dart.defineNamedConstructor(io.StdioType, '_');
+dart.setSignature(io.StdioType, {
+  constructors: () => ({_: dart.definiteFunctionType(io.StdioType, [core.String])}),
+  fields: () => ({name: core.String}),
+  sfields: () => ({
+    TERMINAL: io.StdioType,
+    PIPE: io.StdioType,
+    FILE: io.StdioType,
+    OTHER: io.StdioType
+  })
+});
+dart.defineLazy(io.StdioType, {
+  get TERMINAL() {
+    return dart.const(new io.StdioType._("terminal"));
+  },
+  get PIPE() {
+    return dart.const(new io.StdioType._("pipe"));
+  },
+  get FILE() {
+    return dart.const(new io.StdioType._("file"));
+  },
+  get OTHER() {
+    return dart.const(new io.StdioType._("other"));
+  }
+});
+io._stdin = null;
+io._stdout = null;
+io._stderr = null;
+dart.copyProperties(io, {
+  get stdin() {
+    if (io._stdin == null) {
+      io._stdin = io._StdIOUtils._getStdioInputStream();
+    }
+    return io._stdin;
+  }
+});
+dart.copyProperties(io, {
+  get stdout() {
+    if (io._stdout == null) {
+      io._stdout = io.Stdout._check(io._StdIOUtils._getStdioOutputStream(1));
+    }
+    return io._stdout;
+  }
+});
+dart.copyProperties(io, {
+  get stderr() {
+    if (io._stderr == null) {
+      io._stderr = io.Stdout._check(io._StdIOUtils._getStdioOutputStream(2));
+    }
+    return io._stderr;
+  }
+});
+io.stdioType = function(object) {
+  if (io._StdStream.is(object)) {
+    object = dart.dload(object, _stream);
+  } else if (dart.equals(object, io.stdout) || dart.equals(object, io.stderr)) {
+    switch (io._StdIOUtils._getStdioHandleType(dart.equals(object, io.stdout) ? 1 : 2)) {
+      case io._STDIO_HANDLE_TYPE_TERMINAL:
+      {
+        return io.StdioType.TERMINAL;
+      }
+      case io._STDIO_HANDLE_TYPE_PIPE:
+      {
+        return io.StdioType.PIPE;
+      }
+      case io._STDIO_HANDLE_TYPE_FILE:
+      {
+        return io.StdioType.FILE;
+      }
+    }
+  }
+  if (io._FileStream.is(object)) {
+    return io.StdioType.FILE;
+  }
+  if (io.Socket.is(object)) {
+    let socketType = io._StdIOUtils._socketType(object);
+    if (socketType == null) return io.StdioType.OTHER;
+    switch (socketType) {
+      case io._STDIO_HANDLE_TYPE_TERMINAL:
+      {
+        return io.StdioType.TERMINAL;
+      }
+      case io._STDIO_HANDLE_TYPE_PIPE:
+      {
+        return io.StdioType.PIPE;
+      }
+      case io._STDIO_HANDLE_TYPE_FILE:
+      {
+        return io.StdioType.FILE;
+      }
+    }
+  }
+  if (io._IOSinkImpl.is(object)) {
+    try {
+      if (io._FileStreamConsumer.is(object[_target])) {
+        return io.StdioType.FILE;
+      }
+    } catch (e) {
+    }
+
+  }
+  return io.StdioType.OTHER;
+};
+dart.fn(io.stdioType, dynamicToStdioType());
+io._StdIOUtils = class _StdIOUtils extends core.Object {
+  static _getStdioOutputStream(fd) {
+    dart.throw(new core.UnsupportedError("StdIOUtils._getStdioOutputStream"));
+  }
+  static _getStdioInputStream() {
+    dart.throw(new core.UnsupportedError("StdIOUtils._getStdioInputStream"));
+  }
+  static _socketType(socket) {
+    dart.throw(new core.UnsupportedError("StdIOUtils._socketType"));
+  }
+  static _getStdioHandleType(fd) {
+    dart.throw(new core.UnsupportedError("StdIOUtils._getStdioHandleType"));
+  }
+};
+dart.setSignature(io._StdIOUtils, {
+  statics: () => ({
+    _getStdioOutputStream: dart.definiteFunctionType(dart.dynamic, [core.int]),
+    _getStdioInputStream: dart.definiteFunctionType(io.Stdin, []),
+    _socketType: dart.definiteFunctionType(core.int, [io.Socket]),
+    _getStdioHandleType: dart.definiteFunctionType(dart.dynamic, [core.int])
+  }),
+  names: ['_getStdioOutputStream', '_getStdioInputStream', '_socketType', '_getStdioHandleType']
+});
+let const;
+let const;
+let const;
+let const;
+io.SystemEncoding = class SystemEncoding extends convert.Encoding {
+  new() {
+    super.new();
+  }
+  get name() {
+    return 'system';
+  }
+  encode(input) {
+    return this.encoder.convert(input);
+  }
+  decode(encoded) {
+    return this.decoder.convert(encoded);
+  }
+  get encoder() {
+    if (io.Platform.operatingSystem == "windows") {
+      return const || (const = dart.const(new io._WindowsCodePageEncoder()));
+    } else {
+      return const || (const = dart.const(new convert.Utf8Encoder()));
+    }
+  }
+  get decoder() {
+    if (io.Platform.operatingSystem == "windows") {
+      return const || (const = dart.const(new io._WindowsCodePageDecoder()));
+    } else {
+      return const || (const = dart.const(new convert.Utf8Decoder()));
+    }
+  }
+};
+dart.setSignature(io.SystemEncoding, {
+  constructors: () => ({new: dart.definiteFunctionType(io.SystemEncoding, [])}),
+  getters: () => ({
+    name: dart.definiteFunctionType(core.String, []),
+    encoder: dart.definiteFunctionType(convert.Converter$(core.String, core.List$(core.int)), []),
+    decoder: dart.definiteFunctionType(convert.Converter$(core.List$(core.int), core.String), [])
+  })
+});
+io.SYSTEM_ENCODING = dart.const(new io.SystemEncoding());
+io._WindowsCodePageEncoder = class _WindowsCodePageEncoder extends convert.Converter$(core.String, core.List$(core.int)) {
+  new() {
+    super.new();
+  }
+  convert(input) {
+    let encoded = io._WindowsCodePageEncoder._encodeString(input);
+    if (encoded == null) {
+      dart.throw(new core.FormatException("Invalid character for encoding"));
+    }
+    return encoded;
+  }
+  startChunkedConversion(sink) {
+    return new io._WindowsCodePageEncoderSink(sink);
+  }
+  static _encodeString(string) {
+    dart.throw(new core.UnsupportedError("_WindowsCodePageEncoder._encodeString"));
+  }
+};
+dart.addSimpleTypeTests(io._WindowsCodePageEncoder);
+dart.setSignature(io._WindowsCodePageEncoder, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageEncoder, [])}),
+  methods: () => ({
+    convert: dart.definiteFunctionType(core.List$(core.int), [core.String]),
+    startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
+  }),
+  statics: () => ({_encodeString: dart.definiteFunctionType(core.List$(core.int), [core.String])}),
+  names: ['_encodeString']
+});
+io._WindowsCodePageEncoderSink = class _WindowsCodePageEncoderSink extends convert.StringConversionSinkBase {
+  new(sink) {
+    this[_sink] = sink;
+  }
+  close() {
+    this[_sink].close();
+  }
+  add(string) {
+    let encoded = io._WindowsCodePageEncoder._encodeString(string);
+    if (encoded == null) {
+      dart.throw(new core.FormatException("Invalid character for encoding"));
+    }
+    this[_sink].add(encoded);
+  }
+  addSlice(source, start, end, isLast) {
+    if (start != 0 || end != source[dartx.length]) {
+      source = source[dartx.substring](start, end);
+    }
+    this.add(source);
+    if (dart.test(isLast)) this.close();
+  }
+};
+dart.setSignature(io._WindowsCodePageEncoderSink, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageEncoderSink, [SinkOfListOfint()])}),
+  fields: () => ({[_sink]: SinkOfListOfint()}),
+  methods: () => ({
+    close: dart.definiteFunctionType(dart.void, []),
+    addSlice: dart.definiteFunctionType(dart.void, [core.String, core.int, core.int, core.bool])
+  })
+});
+io._WindowsCodePageDecoder = class _WindowsCodePageDecoder extends convert.Converter$(core.List$(core.int), core.String) {
+  new() {
+    super.new();
+  }
+  convert(input) {
+    return io._WindowsCodePageDecoder._decodeBytes(input);
+  }
+  startChunkedConversion(sink) {
+    return new io._WindowsCodePageDecoderSink(sink);
+  }
+  static _decodeBytes(bytes) {
+    dart.throw(new core.UnsupportedError("_WindowsCodePageDecoder._decodeBytes"));
+  }
+};
+dart.addSimpleTypeTests(io._WindowsCodePageDecoder);
+dart.setSignature(io._WindowsCodePageDecoder, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageDecoder, [])}),
+  methods: () => ({
+    convert: dart.definiteFunctionType(core.String, [ListOfint()]),
+    startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])
+  }),
+  statics: () => ({_decodeBytes: dart.definiteFunctionType(core.String, [ListOfint()])}),
+  names: ['_decodeBytes']
+});
+io._WindowsCodePageDecoderSink = class _WindowsCodePageDecoderSink extends convert.ByteConversionSinkBase {
+  new(sink) {
+    this[_sink] = sink;
+    super.new();
+  }
+  close() {
+    this[_sink].close();
+  }
+  add(bytes) {
+    this[_sink].add(io._WindowsCodePageDecoder._decodeBytes(bytes));
+  }
+};
+dart.setSignature(io._WindowsCodePageDecoderSink, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageDecoderSink, [SinkOfString()])}),
+  fields: () => ({[_sink]: SinkOfString()}),
+  methods: () => ({
+    close: dart.definiteFunctionType(dart.void, []),
+    add: dart.definiteFunctionType(dart.void, [ListOfint()])
+  })
+});
+io.WebSocketStatus = class WebSocketStatus extends core.Object {};
+dart.setSignature(io.WebSocketStatus, {
+  sfields: () => ({
+    NORMAL_CLOSURE: core.int,
+    GOING_AWAY: core.int,
+    PROTOCOL_ERROR: core.int,
+    UNSUPPORTED_DATA: core.int,
+    RESERVED_1004: core.int,
+    NO_STATUS_RECEIVED: core.int,
+    ABNORMAL_CLOSURE: core.int,
+    INVALID_FRAME_PAYLOAD_DATA: core.int,
+    POLICY_VIOLATION: core.int,
+    MESSAGE_TOO_BIG: core.int,
+    MISSING_MANDATORY_EXTENSION: core.int,
+    INTERNAL_SERVER_ERROR: core.int,
+    RESERVED_1015: core.int
+  })
+});
+io.WebSocketStatus.NORMAL_CLOSURE = 1000;
+io.WebSocketStatus.GOING_AWAY = 1001;
+io.WebSocketStatus.PROTOCOL_ERROR = 1002;
+io.WebSocketStatus.UNSUPPORTED_DATA = 1003;
+io.WebSocketStatus.RESERVED_1004 = 1004;
+io.WebSocketStatus.NO_STATUS_RECEIVED = 1005;
+io.WebSocketStatus.ABNORMAL_CLOSURE = 1006;
+io.WebSocketStatus.INVALID_FRAME_PAYLOAD_DATA = 1007;
+io.WebSocketStatus.POLICY_VIOLATION = 1008;
+io.WebSocketStatus.MESSAGE_TOO_BIG = 1009;
+io.WebSocketStatus.MISSING_MANDATORY_EXTENSION = 1010;
+io.WebSocketStatus.INTERNAL_SERVER_ERROR = 1011;
+io.WebSocketStatus.RESERVED_1015 = 1015;
+const _createServerResponseHeader = Symbol('_createServerResponseHeader');
+const _createClientRequestHeader = Symbol('_createClientRequestHeader');
+const _createHeader = Symbol('_createHeader');
+io.CompressionOptions = class CompressionOptions extends core.Object {
+  new(opts) {
+    let clientNoContextTakeover = opts && 'clientNoContextTakeover' in opts ? opts.clientNoContextTakeover : false;
+    let serverNoContextTakeover = opts && 'serverNoContextTakeover' in opts ? opts.serverNoContextTakeover : false;
+    let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : null;
+    let serverMaxWindowBits = opts && 'serverMaxWindowBits' in opts ? opts.serverMaxWindowBits : null;
+    let enabled = opts && 'enabled' in opts ? opts.enabled : true;
+    this.clientNoContextTakeover = clientNoContextTakeover;
+    this.serverNoContextTakeover = serverNoContextTakeover;
+    this.clientMaxWindowBits = clientMaxWindowBits;
+    this.serverMaxWindowBits = serverMaxWindowBits;
+    this.enabled = enabled;
+  }
+  [_createServerResponseHeader](requested) {
+    let info = new io._CompressionMaxWindowBits();
+    let mwb = null;
+    let part = null;
+    if (dart.nullSafe(requested, _ => _.parameters) != null) {
+      part = requested.parameters[dartx._get](io._serverMaxWindowBits);
+    }
+    if (part != null) {
+      if (dart.notNull(part[dartx.length]) >= 2 && dart.test(part[dartx.startsWith]('0'))) {
+        dart.throw(new core.ArgumentError("Illegal 0 padding on value."));
+      } else {
+        mwb = this.serverMaxWindowBits == null ? core.int.parse(part, {onError: dart.fn(source => io._WebSocketImpl.DEFAULT_WINDOW_BITS, StringToint())}) : this.serverMaxWindowBits;
+        info.headerValue = dart.str`; server_max_window_bits=${mwb}`;
+        info.maxWindowBits = mwb;
+      }
+    } else {
+      info.headerValue = "";
+      info.maxWindowBits = io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+    }
+    return info;
+  }
+  [_createClientRequestHeader](requested, size) {
+    let info = "";
+    if (requested != null) {
+      info = dart.str`; client_max_window_bits=${size}`;
+    } else {
+      if (this.clientMaxWindowBits == null) {
+        info = "; client_max_window_bits";
+      } else {
+        info = dart.str`; client_max_window_bits=${this.clientMaxWindowBits}`;
+      }
+      if (this.serverMaxWindowBits != null) {
+        info = info + dart.str`; server_max_window_bits=${this.serverMaxWindowBits}`;
+      }
+    }
+    return info;
+  }
+  [_createHeader](requested) {
+    if (requested === void 0) requested = null;
+    let info = new io._CompressionMaxWindowBits("", 0);
+    if (!dart.test(this.enabled)) {
+      return info;
+    }
+    info.headerValue = io._WebSocketImpl.PER_MESSAGE_DEFLATE;
+    if (dart.test(this.clientNoContextTakeover) && (requested == null || requested != null && dart.test(requested.parameters[dartx.containsKey](io._clientNoContextTakeover)))) {
+      info.headerValue = dart.notNull(info.headerValue) + "; client_no_context_takeover";
+    }
+    if (dart.test(this.serverNoContextTakeover) && (requested == null || requested != null && dart.test(requested.parameters[dartx.containsKey](io._serverNoContextTakeover)))) {
+      info.headerValue = dart.notNull(info.headerValue) + "; server_no_context_takeover";
+    }
+    let headerList = this[_createServerResponseHeader](requested);
+    info.headerValue = dart.notNull(info.headerValue) + dart.notNull(headerList.headerValue);
+    info.maxWindowBits = headerList.maxWindowBits;
+    info.headerValue = dart.notNull(info.headerValue) + dart.notNull(this[_createClientRequestHeader](requested, info.maxWindowBits));
+    return info;
+  }
+};
+dart.setSignature(io.CompressionOptions, {
+  constructors: () => ({new: dart.definiteFunctionType(io.CompressionOptions, [], {clientNoContextTakeover: core.bool, serverNoContextTakeover: core.bool, clientMaxWindowBits: core.int, serverMaxWindowBits: core.int, enabled: core.bool})}),
+  fields: () => ({
+    clientNoContextTakeover: core.bool,
+    serverNoContextTakeover: core.bool,
+    clientMaxWindowBits: core.int,
+    serverMaxWindowBits: core.int,
+    enabled: core.bool
+  }),
+  methods: () => ({
+    [_createServerResponseHeader]: dart.definiteFunctionType(io._CompressionMaxWindowBits, [io.HeaderValue]),
+    [_createClientRequestHeader]: dart.definiteFunctionType(core.String, [io.HeaderValue, core.int]),
+    [_createHeader]: dart.definiteFunctionType(io._CompressionMaxWindowBits, [], [io.HeaderValue])
+  }),
+  sfields: () => ({
+    DEFAULT: io.CompressionOptions,
+    OFF: io.CompressionOptions
+  })
+});
+dart.defineLazy(io.CompressionOptions, {
+  get DEFAULT() {
+    return dart.const(new io.CompressionOptions());
+  },
+  get OFF() {
+    return dart.const(new io.CompressionOptions({enabled: false}));
+  }
+});
+io.WebSocketTransformer = class WebSocketTransformer extends core.Object {
+  static new(opts) {
+    let protocolSelector = opts && 'protocolSelector' in opts ? opts.protocolSelector : null;
+    let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+    return new io._WebSocketTransformerImpl(protocolSelector, compression);
+  }
+  static upgrade(request, opts) {
+    let protocolSelector = opts && 'protocolSelector' in opts ? opts.protocolSelector : null;
+    let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+    return io._WebSocketTransformerImpl._upgrade(request, protocolSelector, compression);
+  }
+  static isUpgradeRequest(request) {
+    return io._WebSocketTransformerImpl._isUpgradeRequest(request);
+  }
+};
+io.WebSocketTransformer[dart.implements] = () => [StreamTransformerOfHttpRequest$WebSocket()];
+dart.setSignature(io.WebSocketTransformer, {
+  constructors: () => ({new: dart.definiteFunctionType(io.WebSocketTransformer, [], {protocolSelector: ListOfStringTodynamic(), compression: io.CompressionOptions})}),
+  statics: () => ({
+    upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest], {protocolSelector: ListOfStringTodynamic(), compression: io.CompressionOptions}),
+    isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
+  }),
+  names: ['upgrade', 'isUpgradeRequest']
+});
+io.WebSocket = class WebSocket extends core.Object {
+  static connect(url, opts) {
+    let protocols = opts && 'protocols' in opts ? opts.protocols : null;
+    let headers = opts && 'headers' in opts ? opts.headers : null;
+    let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+    return io._WebSocketImpl.connect(url, protocols, headers, {compression: compression});
+  }
+  new() {
+    this.pingInterval = null;
+  }
+  static fromUpgradedSocket(socket, opts) {
+    let protocol = opts && 'protocol' in opts ? opts.protocol : null;
+    let serverSide = opts && 'serverSide' in opts ? opts.serverSide : null;
+    let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+    if (serverSide == null) {
+      dart.throw(new core.ArgumentError("The serverSide argument must be passed " + "explicitly to WebSocket.fromUpgradedSocket."));
+    }
+    return new io._WebSocketImpl._fromSocket(socket, protocol, compression, serverSide);
+  }
+};
+io.WebSocket[dart.implements] = () => [async.Stream, async.StreamSink];
+dart.setSignature(io.WebSocket, {
+  constructors: () => ({
+    new: dart.definiteFunctionType(io.WebSocket, []),
+    fromUpgradedSocket: dart.definiteFunctionType(io.WebSocket, [io.Socket], {protocol: core.String, serverSide: core.bool, compression: io.CompressionOptions})
+  }),
+  fields: () => ({pingInterval: core.Duration}),
+  sfields: () => ({
+    CONNECTING: core.int,
+    OPEN: core.int,
+    CLOSING: core.int,
+    CLOSED: core.int
+  }),
+  statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.WebSocket), [core.String], {protocols: IterableOfString(), headers: MapOfString$dynamic(), compression: io.CompressionOptions})}),
+  names: ['connect']
+});
+io.WebSocket.CONNECTING = 0;
+io.WebSocket.OPEN = 1;
+io.WebSocket.CLOSING = 2;
+io.WebSocket.CLOSED = 3;
+io.WebSocketException = class WebSocketException extends core.Object {
+  new(message) {
+    if (message === void 0) message = "";
+    this.message = message;
+  }
+  toString() {
+    return dart.str`WebSocketException: ${this.message}`;
+  }
+};
+io.WebSocketException[dart.implements] = () => [io.IOException];
+dart.setSignature(io.WebSocketException, {
+  constructors: () => ({new: dart.definiteFunctionType(io.WebSocketException, [], [core.String])}),
+  fields: () => ({message: core.String})
+});
+io._webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
+io._clientNoContextTakeover = "client_no_context_takeover";
+io._serverNoContextTakeover = "server_no_context_takeover";
+io._clientMaxWindowBits = "client_max_window_bits";
+io._serverMaxWindowBits = "server_max_window_bits";
+io._WebSocketMessageType = class _WebSocketMessageType extends core.Object {};
+dart.setSignature(io._WebSocketMessageType, {
+  sfields: () => ({
+    NONE: core.int,
+    TEXT: core.int,
+    BINARY: core.int
+  })
+});
+io._WebSocketMessageType.NONE = 0;
+io._WebSocketMessageType.TEXT = 1;
+io._WebSocketMessageType.BINARY = 2;
+io._WebSocketOpcode = class _WebSocketOpcode extends core.Object {};
+dart.setSignature(io._WebSocketOpcode, {
+  sfields: () => ({
+    CONTINUATION: core.int,
+    TEXT: core.int,
+    BINARY: core.int,
+    RESERVED_3: core.int,
+    RESERVED_4: core.int,
+    RESERVED_5: core.int,
+    RESERVED_6: core.int,
+    RESERVED_7: core.int,
+    CLOSE: core.int,
+    PING: core.int,
+    PONG: core.int,
+    RESERVED_B: core.int,
+    RESERVED_C: core.int,
+    RESERVED_D: core.int,
+    RESERVED_E: core.int,
+    RESERVED_F: core.int
+  })
+});
+io._WebSocketOpcode.CONTINUATION = 0;
+io._WebSocketOpcode.TEXT = 1;
+io._WebSocketOpcode.BINARY = 2;
+io._WebSocketOpcode.RESERVED_3 = 3;
+io._WebSocketOpcode.RESERVED_4 = 4;
+io._WebSocketOpcode.RESERVED_5 = 5;
+io._WebSocketOpcode.RESERVED_6 = 6;
+io._WebSocketOpcode.RESERVED_7 = 7;
+io._WebSocketOpcode.CLOSE = 8;
+io._WebSocketOpcode.PING = 9;
+io._WebSocketOpcode.PONG = 10;
+io._WebSocketOpcode.RESERVED_B = 11;
+io._WebSocketOpcode.RESERVED_C = 12;
+io._WebSocketOpcode.RESERVED_D = 13;
+io._WebSocketOpcode.RESERVED_E = 14;
+io._WebSocketOpcode.RESERVED_F = 15;
+io._CompressionMaxWindowBits = class _CompressionMaxWindowBits extends core.Object {
+  new(headerValue, maxWindowBits) {
+    if (headerValue === void 0) headerValue = null;
+    if (maxWindowBits === void 0) maxWindowBits = null;
+    this.headerValue = headerValue;
+    this.maxWindowBits = maxWindowBits;
+  }
+  toString() {
+    return this.headerValue;
+  }
+};
+dart.setSignature(io._CompressionMaxWindowBits, {
+  constructors: () => ({new: dart.definiteFunctionType(io._CompressionMaxWindowBits, [], [core.String, core.int])}),
+  fields: () => ({
+    headerValue: core.String,
+    maxWindowBits: core.int
+  })
+});
+const _maskingBytes = Symbol('_maskingBytes');
+const _payload = Symbol('_payload');
+const _serverSide = Symbol('_serverSide');
+const _deflate = Symbol('_deflate');
+const _fin = Symbol('_fin');
+const _compressed = Symbol('_compressed');
+const _opcode = Symbol('_opcode');
+const _len = Symbol('_len');
+const _masked = Symbol('_masked');
+const _remainingLenBytes = Symbol('_remainingLenBytes');
+const _remainingMaskingKeyBytes = Symbol('_remainingMaskingKeyBytes');
+const _remainingPayloadBytes = Symbol('_remainingPayloadBytes');
+const _unmaskingIndex = Symbol('_unmaskingIndex');
+const _currentMessageType = Symbol('_currentMessageType');
+const _eventSink = Symbol('_eventSink');
+const _isControlFrame = Symbol('_isControlFrame');
+const _lengthDone = Symbol('_lengthDone');
+const _maskDone = Symbol('_maskDone');
+const _unmask = Symbol('_unmask');
+const _controlFrameEnd = Symbol('_controlFrameEnd');
+const _messageFrameEnd = Symbol('_messageFrameEnd');
+const _startPayload = Symbol('_startPayload');
+const _prepareForNextFrame = Symbol('_prepareForNextFrame');
+io._WebSocketProtocolTransformer = class _WebSocketProtocolTransformer extends core.Object {
+  new(serverSide, deflate) {
+    if (serverSide === void 0) serverSide = false;
+    if (deflate === void 0) deflate = null;
+    this[_maskingBytes] = core.List.new(4);
+    this[_payload] = io.BytesBuilder.new({copy: false});
+    this[_serverSide] = serverSide;
+    this[_deflate] = deflate;
+    this[_state] = io._WebSocketProtocolTransformer.START;
+    this[_fin] = false;
+    this[_compressed] = false;
+    this[_opcode] = -1;
+    this[_len] = -1;
+    this[_masked] = false;
+    this[_remainingLenBytes] = -1;
+    this[_remainingMaskingKeyBytes] = 4;
+    this[_remainingPayloadBytes] = -1;
+    this[_unmaskingIndex] = 0;
+    this[_currentMessageType] = io._WebSocketMessageType.NONE;
+    this.closeCode = io.WebSocketStatus.NO_STATUS_RECEIVED;
+    this.closeReason = "";
+    this[_eventSink] = null;
+  }
+  bind(stream) {
+    return async.Stream.eventTransformed(stream, dart.fn(eventSink => {
+      if (this[_eventSink] != null) {
+        dart.throw(new core.StateError("WebSocket transformer already used."));
+      }
+      this[_eventSink] = eventSink;
+      return this;
+    }, EventSinkTo_WebSocketProtocolTransformer()));
+  }
+  addError(error, stackTrace) {
+    if (stackTrace === void 0) stackTrace = null;
+    this[_eventSink].addError(error, stackTrace);
+  }
+  close() {
+    this[_eventSink].close();
+  }
+  add(bytes) {
+    let buffer = typed_data.Uint8List.is(bytes) ? bytes : typed_data.Uint8List.fromList(bytes);
+    let index = 0;
+    let lastIndex = buffer[dartx.length];
+    if (this[_state] == io._WebSocketProtocolTransformer.CLOSED) {
+      dart.throw(new io.WebSocketException("Data on closed connection"));
+    }
+    if (this[_state] == io._WebSocketProtocolTransformer.FAILURE) {
+      dart.throw(new io.WebSocketException("Data on failed connection"));
+    }
+    while (dart.notNull(index) < dart.notNull(lastIndex) && this[_state] != io._WebSocketProtocolTransformer.CLOSED && this[_state] != io._WebSocketProtocolTransformer.FAILURE) {
+      let byte = buffer[dartx._get](index);
+      if (dart.notNull(this[_state]) <= io._WebSocketProtocolTransformer.LEN_REST) {
+        if (this[_state] == io._WebSocketProtocolTransformer.START) {
+          this[_fin] = (dart.notNull(byte) & io._WebSocketProtocolTransformer.FIN) != 0;
+          if ((dart.notNull(byte) & (io._WebSocketProtocolTransformer.RSV2 | io._WebSocketProtocolTransformer.RSV3)) != 0) {
+            dart.throw(new io.WebSocketException("Protocol error"));
+          }
+          this[_opcode] = dart.notNull(byte) & io._WebSocketProtocolTransformer.OPCODE;
+          if (this[_opcode] != io._WebSocketOpcode.CONTINUATION) {
+            if ((dart.notNull(byte) & io._WebSocketProtocolTransformer.RSV1) != 0) {
+              this[_compressed] = true;
+            } else {
+              this[_compressed] = false;
+            }
+          }
+          if (dart.notNull(this[_opcode]) <= io._WebSocketOpcode.BINARY) {
+            if (this[_opcode] == io._WebSocketOpcode.CONTINUATION) {
+              if (this[_currentMessageType] == io._WebSocketMessageType.NONE) {
+                dart.throw(new io.WebSocketException("Protocol error"));
+              }
+            } else {
+              dart.assert(this[_opcode] == io._WebSocketOpcode.TEXT || this[_opcode] == io._WebSocketOpcode.BINARY);
+              if (this[_currentMessageType] != io._WebSocketMessageType.NONE) {
+                dart.throw(new io.WebSocketException("Protocol error"));
+              }
+              this[_currentMessageType] = this[_opcode];
+            }
+          } else if (dart.notNull(this[_opcode]) >= io._WebSocketOpcode.CLOSE && dart.notNull(this[_opcode]) <= io._WebSocketOpcode.PONG) {
+            if (!dart.test(this[_fin])) dart.throw(new io.WebSocketException("Protocol error"));
+          } else {
+            dart.throw(new io.WebSocketException("Protocol error"));
+          }
+          this[_state] = io._WebSocketProtocolTransformer.LEN_FIRST;
+        } else if (this[_state] == io._WebSocketProtocolTransformer.LEN_FIRST) {
+          this[_masked] = (dart.notNull(byte) & 128) != 0;
+          this[_len] = dart.notNull(byte) & 127;
+          if (dart.test(this[_isControlFrame]()) && dart.notNull(this[_len]) > 125) {
+            dart.throw(new io.WebSocketException("Protocol error"));
+          }
+          if (this[_len] == 126) {
+            this[_len] = 0;
+            this[_remainingLenBytes] = 2;
+            this[_state] = io._WebSocketProtocolTransformer.LEN_REST;
+          } else if (this[_len] == 127) {
+            this[_len] = 0;
+            this[_remainingLenBytes] = 8;
+            this[_state] = io._WebSocketProtocolTransformer.LEN_REST;
+          } else {
+            dart.assert(dart.notNull(this[_len]) < 126);
+            this[_lengthDone]();
+          }
+        } else {
+          dart.assert(this[_state] == io._WebSocketProtocolTransformer.LEN_REST);
+          this[_len] = (dart.notNull(this[_len]) << 8 | dart.notNull(byte)) >>> 0;
+          this[_remainingLenBytes] = dart.notNull(this[_remainingLenBytes]) - 1;
+          if (this[_remainingLenBytes] == 0) {
+            this[_lengthDone]();
+          }
+        }
+      } else {
+        if (this[_state] == io._WebSocketProtocolTransformer.MASK) {
+          this[_maskingBytes][dartx._set](4 - (() => {
+            let x = this[_remainingMaskingKeyBytes];
+            this[_remainingMaskingKeyBytes] = dart.notNull(x) - 1;
+            return x;
+          })(), byte);
+          if (this[_remainingMaskingKeyBytes] == 0) {
+            this[_maskDone]();
+          }
+        } else {
+          dart.assert(this[_state] == io._WebSocketProtocolTransformer.PAYLOAD);
+          let payloadLength = math.min(core.int)(dart.notNull(lastIndex) - dart.notNull(index), this[_remainingPayloadBytes]);
+          this[_remainingPayloadBytes] = dart.notNull(this[_remainingPayloadBytes]) - dart.notNull(payloadLength);
+          if (dart.test(this[_masked])) {
+            this[_unmask](index, payloadLength, buffer);
+          }
+          this[_payload].add(typed_data.Uint8List.view(buffer[dartx.buffer], index, payloadLength));
+          index = dart.notNull(index) + dart.notNull(payloadLength);
+          if (dart.test(this[_isControlFrame]())) {
+            if (this[_remainingPayloadBytes] == 0) this[_controlFrameEnd]();
+          } else {
+            if (this[_currentMessageType] != io._WebSocketMessageType.TEXT && this[_currentMessageType] != io._WebSocketMessageType.BINARY) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            if (this[_remainingPayloadBytes] == 0) this[_messageFrameEnd]();
+          }
+          index = dart.notNull(index) - 1;
+        }
+      }
+      index = dart.notNull(index) + 1;
+    }
+  }
+  [_unmask](index, length, buffer) {
+    let BLOCK_SIZE = 16;
+    if (dart.notNull(length) >= BLOCK_SIZE) {
+      let startOffset = BLOCK_SIZE - (dart.notNull(index) & 15);
+      let end = dart.notNull(index) + startOffset;
+      for (let i = index; dart.notNull(i) < end; i = dart.notNull(i) + 1) {
+        buffer[dartx._set](i, (dart.notNull(buffer[dartx._get](i)) ^ dart.notNull(core.int._check(this[_maskingBytes][dartx._get]((() => {
+          let x = this[_unmaskingIndex];
+          this[_unmaskingIndex] = dart.notNull(x) + 1;
+          return x;
+        })() & 3)))) >>> 0);
+      }
+      index = dart.notNull(index) + startOffset;
+      length = dart.notNull(length) - startOffset;
+      let blockCount = (dart.notNull(length) / BLOCK_SIZE)[dartx.truncate]();
+      if (blockCount > 0) {
+        let mask = 0;
+        for (let i = 3; i >= 0; i--) {
+          mask = (mask << 8 | dart.notNull(core.int._check(this[_maskingBytes][dartx._get](dart.notNull(this[_unmaskingIndex]) + i & 3)))) >>> 0;
+        }
+        let blockMask = typed_data.Int32x4.new(mask, mask, mask, mask);
+        let blockBuffer = typed_data.Int32x4List.view(buffer[dartx.buffer], index, blockCount);
+        for (let i = 0; i < dart.notNull(blockBuffer.length); i++) {
+          blockBuffer._set(i, blockBuffer._get(i)['^'](blockMask));
+        }
+        let bytes = blockCount * BLOCK_SIZE;
+        index = dart.notNull(index) + bytes;
+        length = dart.notNull(length) - bytes;
+      }
+    }
+    let end = dart.notNull(index) + dart.notNull(length);
+    for (let i = index; dart.notNull(i) < end; i = dart.notNull(i) + 1) {
+      buffer[dartx._set](i, (dart.notNull(buffer[dartx._get](i)) ^ dart.notNull(core.int._check(this[_maskingBytes][dartx._get]((() => {
+        let x = this[_unmaskingIndex];
+        this[_unmaskingIndex] = dart.notNull(x) + 1;
+        return x;
+      })() & 3)))) >>> 0);
+    }
+  }
+  [_lengthDone]() {
+    if (dart.test(this[_masked])) {
+      if (!dart.test(this[_serverSide])) {
+        dart.throw(new io.WebSocketException("Received masked frame from server"));
+      }
+      this[_state] = io._WebSocketProtocolTransformer.MASK;
+    } else {
+      if (dart.test(this[_serverSide])) {
+        dart.throw(new io.WebSocketException("Received unmasked frame from client"));
+      }
+      this[_remainingPayloadBytes] = this[_len];
+      this[_startPayload]();
+    }
+  }
+  [_maskDone]() {
+    this[_remainingPayloadBytes] = this[_len];
+    this[_startPayload]();
+  }
+  [_startPayload]() {
+    if (this[_remainingPayloadBytes] == 0) {
+      if (dart.test(this[_isControlFrame]())) {
+        switch (this[_opcode]) {
+          case io._WebSocketOpcode.CLOSE:
+          {
+            this[_state] = io._WebSocketProtocolTransformer.CLOSED;
+            this[_eventSink].close();
+            break;
+          }
+          case io._WebSocketOpcode.PING:
+          {
+            this[_eventSink].add(new io._WebSocketPing());
+            break;
+          }
+          case io._WebSocketOpcode.PONG:
+          {
+            this[_eventSink].add(new io._WebSocketPong());
+            break;
+          }
+        }
+        this[_prepareForNextFrame]();
+      } else {
+        this[_messageFrameEnd]();
+      }
+    } else {
+      this[_state] = io._WebSocketProtocolTransformer.PAYLOAD;
+    }
+  }
+  [_messageFrameEnd]() {
+    if (dart.test(this[_fin])) {
+      let bytes = this[_payload].takeBytes();
+      if (this[_deflate] != null && dart.test(this[_compressed])) {
+        bytes = this[_deflate].processIncomingMessage(bytes);
+      }
+      switch (this[_currentMessageType]) {
+        case io._WebSocketMessageType.TEXT:
+        {
+          this[_eventSink].add(convert.UTF8.decode(bytes));
+          break;
+        }
+        case io._WebSocketMessageType.BINARY:
+        {
+          this[_eventSink].add(bytes);
+          break;
+        }
+      }
+      this[_currentMessageType] = io._WebSocketMessageType.NONE;
+    }
+    this[_prepareForNextFrame]();
+  }
+  [_controlFrameEnd]() {
+    switch (this[_opcode]) {
+      case io._WebSocketOpcode.CLOSE:
+      {
+        this.closeCode = io.WebSocketStatus.NO_STATUS_RECEIVED;
+        let payload = this[_payload].takeBytes();
+        if (dart.notNull(payload[dartx.length]) > 0) {
+          if (payload[dartx.length] == 1) {
+            dart.throw(new io.WebSocketException("Protocol error"));
+          }
+          this.closeCode = (dart.notNull(payload[dartx._get](0)) << 8 | dart.notNull(payload[dartx._get](1))) >>> 0;
+          if (this.closeCode == io.WebSocketStatus.NO_STATUS_RECEIVED) {
+            dart.throw(new io.WebSocketException("Protocol error"));
+          }
+          if (dart.notNull(payload[dartx.length]) > 2) {
+            this.closeReason = convert.UTF8.decode(payload[dartx.sublist](2));
+          }
+        }
+        this[_state] = io._WebSocketProtocolTransformer.CLOSED;
+        this[_eventSink].close();
+        break;
+      }
+      case io._WebSocketOpcode.PING:
+      {
+        this[_eventSink].add(new io._WebSocketPing(this[_payload].takeBytes()));
+        break;
+      }
+      case io._WebSocketOpcode.PONG:
+      {
+        this[_eventSink].add(new io._WebSocketPong(this[_payload].takeBytes()));
+        break;
+      }
+    }
+    this[_prepareForNextFrame]();
+  }
+  [_isControlFrame]() {
+    return this[_opcode] == io._WebSocketOpcode.CLOSE || this[_opcode] == io._WebSocketOpcode.PING || this[_opcode] == io._WebSocketOpcode.PONG;
+  }
+  [_prepareForNextFrame]() {
+    if (this[_state] != io._WebSocketProtocolTransformer.CLOSED && this[_state] != io._WebSocketProtocolTransformer.FAILURE) this[_state] = io._WebSocketProtocolTransformer.START;
+    this[_fin] = false;
+    this[_opcode] = -1;
+    this[_len] = -1;
+    this[_remainingLenBytes] = -1;
+    this[_remainingMaskingKeyBytes] = 4;
+    this[_remainingPayloadBytes] = -1;
+    this[_unmaskingIndex] = 0;
+  }
+};
+io._WebSocketProtocolTransformer[dart.implements] = () => [StreamTransformerOfListOfint$dynamic(), EventSinkOfUint8List()];
+dart.setSignature(io._WebSocketProtocolTransformer, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WebSocketProtocolTransformer, [], [core.bool, io._WebSocketPerMessageDeflate])}),
+  fields: () => ({
+    [_state]: core.int,
+    [_fin]: core.bool,
+    [_compressed]: core.bool,
+    [_opcode]: core.int,
+    [_len]: core.int,
+    [_masked]: core.bool,
+    [_remainingLenBytes]: core.int,
+    [_remainingMaskingKeyBytes]: core.int,
+    [_remainingPayloadBytes]: core.int,
+    [_unmaskingIndex]: core.int,
+    [_currentMessageType]: core.int,
+    closeCode: core.int,
+    closeReason: core.String,
+    [_eventSink]: async.EventSink,
+    [_serverSide]: core.bool,
+    [_maskingBytes]: core.List,
+    [_payload]: io.BytesBuilder,
+    [_deflate]: io._WebSocketPerMessageDeflate
+  }),
+  methods: () => ({
+    bind: dart.definiteFunctionType(async.Stream, [async.Stream]),
+    addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
+    close: dart.definiteFunctionType(dart.void, []),
+    add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+    [_unmask]: dart.definiteFunctionType(dart.void, [core.int, core.int, typed_data.Uint8List]),
+    [_lengthDone]: dart.definiteFunctionType(dart.void, []),
+    [_maskDone]: dart.definiteFunctionType(dart.void, []),
+    [_startPayload]: dart.definiteFunctionType(dart.void, []),
+    [_messageFrameEnd]: dart.definiteFunctionType(dart.void, []),
+    [_controlFrameEnd]: dart.definiteFunctionType(dart.void, []),
+    [_isControlFrame]: dart.definiteFunctionType(core.bool, []),
+    [_prepareForNextFrame]: dart.definiteFunctionType(dart.void, [])
+  }),
+  sfields: () => ({
+    START: core.int,
+    LEN_FIRST: core.int,
+    LEN_REST: core.int,
+    MASK: core.int,
+    PAYLOAD: core.int,
+    CLOSED: core.int,
+    FAILURE: core.int,
+    FIN: core.int,
+    RSV1: core.int,
+    RSV2: core.int,
+    RSV3: core.int,
+    OPCODE: core.int
+  })
+});
+io._WebSocketProtocolTransformer.START = 0;
+io._WebSocketProtocolTransformer.LEN_FIRST = 1;
+io._WebSocketProtocolTransformer.LEN_REST = 2;
+io._WebSocketProtocolTransformer.MASK = 3;
+io._WebSocketProtocolTransformer.PAYLOAD = 4;
+io._WebSocketProtocolTransformer.CLOSED = 5;
+io._WebSocketProtocolTransformer.FAILURE = 6;
+io._WebSocketProtocolTransformer.FIN = 128;
+io._WebSocketProtocolTransformer.RSV1 = 64;
+io._WebSocketProtocolTransformer.RSV2 = 32;
+io._WebSocketProtocolTransformer.RSV3 = 16;
+io._WebSocketProtocolTransformer.OPCODE = 15;
+io._WebSocketPing = class _WebSocketPing extends core.Object {
+  new(payload) {
+    if (payload === void 0) payload = null;
+    this.payload = payload;
+  }
+};
+dart.setSignature(io._WebSocketPing, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPing, [], [ListOfint()])}),
+  fields: () => ({payload: ListOfint()})
+});
+io._WebSocketPong = class _WebSocketPong extends core.Object {
+  new(payload) {
+    if (payload === void 0) payload = null;
+    this.payload = payload;
+  }
+};
+dart.setSignature(io._WebSocketPong, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPong, [], [ListOfint()])}),
+  fields: () => ({payload: ListOfint()})
+});
+const _protocolSelector = Symbol('_protocolSelector');
+const _compression = Symbol('_compression');
+io._WebSocketTransformerImpl = class _WebSocketTransformerImpl extends core.Object {
+  new(protocolSelector, compression) {
+    this[_controller] = StreamControllerOfWebSocket().new({sync: true});
+    this[_protocolSelector] = protocolSelector;
+    this[_compression] = compression;
+  }
+  bind(stream) {
+    stream.listen(dart.fn(request => {
+      io._WebSocketTransformerImpl._upgrade(request, this[_protocolSelector], this[_compression]).then(dart.void)(dart.fn(webSocket => this[_controller].add(webSocket), WebSocketTovoid())).catchError(dart.bind(this[_controller], 'addError'));
+    }, HttpRequestToNull()), {onDone: dart.fn(() => {
+        this[_controller].close();
+      }, VoidToNull())});
+    return this[_controller].stream;
+  }
+  static _upgrade(request, _protocolSelector, compression) {
+    let response = request.response;
+    if (!dart.test(io._WebSocketTransformerImpl._isUpgradeRequest(request))) {
+      response.statusCode = io.HttpStatus.BAD_REQUEST;
+      response.close();
+      return FutureOfWebSocket().error(new io.WebSocketException("Invalid WebSocket upgrade request"));
+    }
+    function upgrade(protocol) {
+      response.statusCode = io.HttpStatus.SWITCHING_PROTOCOLS;
+      response.headers.add(io.HttpHeaders.CONNECTION, "Upgrade");
+      response.headers.add(io.HttpHeaders.UPGRADE, "websocket");
+      let key = request.headers.value("Sec-WebSocket-Key");
+      let sha1 = new io._SHA1();
+      sha1.add(dart.str`${key}${io._webSocketGUID}`[dartx.codeUnits]);
+      let accept = io._CryptoUtils.bytesToBase64(sha1.close());
+      response.headers.add("Sec-WebSocket-Accept", accept);
+      if (protocol != null) {
+        response.headers.add("Sec-WebSocket-Protocol", protocol);
+      }
+      let deflate = io._WebSocketTransformerImpl._negotiateCompression(request, response, compression);
+      response.headers.contentLength = 0;
+      return response.detachSocket().then(io._WebSocketImpl)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
+    }
+    dart.fn(upgrade, StringToFuture());
+    let protocols = request.headers._get('Sec-WebSocket-Protocol');
+    if (protocols != null && _protocolSelector != null) {
+      protocols = io._HttpParser._tokenizeFieldValue(protocols[dartx.join](', '));
+      return async.Future.new(dart.fn(() => dart.dcall(_protocolSelector, protocols), VoidTodynamic())).then(dart.dynamic)(dart.fn(protocol => {
+        if (dart.notNull(protocols[dartx.indexOf](core.String._check(protocol))) < 0) {
+          dart.throw(new io.WebSocketException("Selected protocol is not in the list of available protocols"));
+        }
+        return protocol;
+      }, dynamicTodynamic())).catchError(dart.fn(error => {
+        response.statusCode = io.HttpStatus.INTERNAL_SERVER_ERROR;
+        response.close();
+        dart.throw(error);
+      }, dynamicToNull())).then(io.WebSocket)(upgrade);
+    } else {
+      return FutureOfWebSocket()._check(upgrade(null));
+    }
+  }
+  static _negotiateCompression(request, response, compression) {
+    let extensionHeader = request.headers.value("Sec-WebSocket-Extensions");
+    let t = extensionHeader;
+    t == null ? extensionHeader = "" : t;
+    let hv = io.HeaderValue.parse(extensionHeader, {valueSeparator: ','});
+    if (dart.test(compression.enabled) && hv.value == io._WebSocketImpl.PER_MESSAGE_DEFLATE) {
+      let info = compression[_createHeader](hv);
+      response.headers.add("Sec-WebSocket-Extensions", info.headerValue);
+      let serverNoContextTakeover = dart.test(hv.parameters[dartx.containsKey](io._serverNoContextTakeover)) && dart.test(compression.serverNoContextTakeover);
+      let clientNoContextTakeover = dart.test(hv.parameters[dartx.containsKey](io._clientNoContextTakeover)) && dart.test(compression.clientNoContextTakeover);
+      let deflate = new io._WebSocketPerMessageDeflate({serverNoContextTakeover: serverNoContextTakeover, clientNoContextTakeover: clientNoContextTakeover, serverMaxWindowBits: info.maxWindowBits, clientMaxWindowBits: info.maxWindowBits, serverSide: true});
+      return deflate;
+    }
+    return null;
+  }
+  static _isUpgradeRequest(request) {
+    if (request.method != "GET") {
+      return false;
+    }
+    if (request.headers._get(io.HttpHeaders.CONNECTION) == null) {
+      return false;
+    }
+    let isUpgrade = false;
+    request.headers._get(io.HttpHeaders.CONNECTION)[dartx.forEach](dart.fn(value => {
+      if (value[dartx.toLowerCase]() == "upgrade") isUpgrade = true;
+    }, StringToNull()));
+    if (!isUpgrade) return false;
+    let upgrade = request.headers.value(io.HttpHeaders.UPGRADE);
+    if (upgrade == null || upgrade[dartx.toLowerCase]() != "websocket") {
+      return false;
+    }
+    let version = request.headers.value("Sec-WebSocket-Version");
+    if (version == null || version != "13") {
+      return false;
+    }
+    let key = request.headers.value("Sec-WebSocket-Key");
+    if (key == null) {
+      return false;
+    }
+    return true;
+  }
+};
+io._WebSocketTransformerImpl[dart.implements] = () => [io.WebSocketTransformer];
+dart.setSignature(io._WebSocketTransformerImpl, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WebSocketTransformerImpl, [core.Function, io.CompressionOptions])}),
+  fields: () => ({
+    [_controller]: StreamControllerOfWebSocket(),
+    [_protocolSelector]: core.Function,
+    [_compression]: io.CompressionOptions
+  }),
+  methods: () => ({bind: dart.definiteFunctionType(async.Stream$(io.WebSocket), [StreamOfHttpRequest()])}),
+  statics: () => ({
+    _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, dart.dynamic, io.CompressionOptions]),
+    _negotiateCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpRequest, io.HttpResponse, io.CompressionOptions]),
+    _isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
+  }),
+  names: ['_upgrade', '_negotiateCompression', '_isUpgradeRequest']
+});
+const _ensureDecoder = Symbol('_ensureDecoder');
+const _ensureEncoder = Symbol('_ensureEncoder');
+let const;
+io._WebSocketPerMessageDeflate = class _WebSocketPerMessageDeflate extends core.Object {
+  new(opts) {
+    let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+    let serverMaxWindowBits = opts && 'serverMaxWindowBits' in opts ? opts.serverMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+    let serverNoContextTakeover = opts && 'serverNoContextTakeover' in opts ? opts.serverNoContextTakeover : false;
+    let clientNoContextTakeover = opts && 'clientNoContextTakeover' in opts ? opts.clientNoContextTakeover : false;
+    let serverSide = opts && 'serverSide' in opts ? opts.serverSide : false;
+    this.clientMaxWindowBits = clientMaxWindowBits;
+    this.serverMaxWindowBits = serverMaxWindowBits;
+    this.serverNoContextTakeover = serverNoContextTakeover;
+    this.clientNoContextTakeover = clientNoContextTakeover;
+    this.serverSide = serverSide;
+    this.decoder = null;
+    this.encoder = null;
+  }
+  [_ensureDecoder]() {
+    if (this.decoder == null) {
+      this.decoder = io._Filter._newZLibInflateFilter(dart.test(this.serverSide) ? this.clientMaxWindowBits : this.serverMaxWindowBits, null, true);
+    }
+  }
+  [_ensureEncoder]() {
+    if (this.encoder == null) {
+      this.encoder = io._Filter._newZLibDeflateFilter(false, io.ZLibOption.DEFAULT_LEVEL, dart.test(this.serverSide) ? this.serverMaxWindowBits : this.clientMaxWindowBits, io.ZLibOption.DEFAULT_MEM_LEVEL, io.ZLibOption.STRATEGY_DEFAULT, null, true);
+    }
+  }
+  processIncomingMessage(msg) {
+    this[_ensureDecoder]();
+    let data = [];
+    data[dartx.addAll](msg);
+    data[dartx.addAll](const || (const = dart.constList([0, 0, 255, 255], core.int)));
+    this.decoder.process(ListOfint()._check(data), 0, data[dartx.length]);
+    let result = [];
+    let out = null;
+    while ((out = this.decoder.processed()) != null) {
+      result[dartx.addAll](core.Iterable._check(out));
+    }
+    if (dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || !dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
+      this.decoder = null;
+    }
+    return typed_data.Uint8List.fromList(ListOfint()._check(result));
+  }
+  processOutgoingMessage(msg) {
+    this[_ensureEncoder]();
+    let result = [];
+    let buffer = null;
+    let out = null;
+    if (!typed_data.Uint8List.is(msg)) {
+      for (let i = 0; i < dart.notNull(msg[dartx.length]); i++) {
+        if (dart.notNull(msg[dartx._get](i)) < 0 || 255 < dart.notNull(msg[dartx._get](i))) {
+          dart.throw(new core.ArgumentError("List element is not a byte value " + dart.str`(value ${msg[dartx._get](i)} at index ${i})`));
+        }
+      }
+      buffer = typed_data.Uint8List.fromList(msg);
+    } else {
+      buffer = typed_data.Uint8List._check(msg);
+    }
+    this.encoder.process(buffer, 0, buffer[dartx.length]);
+    while ((out = this.encoder.processed()) != null) {
+      result[dartx.addAll](core.Iterable._check(out));
+    }
+    if (!dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
+      this.encoder = null;
+    }
+    if (dart.notNull(result[dartx.length]) > 4) {
+      result = result[dartx.sublist](0, dart.notNull(result[dartx.length]) - 4);
+    }
+    return ListOfint()._check(result);
+  }
+};
+dart.setSignature(io._WebSocketPerMessageDeflate, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [], {clientMaxWindowBits: core.int, serverMaxWindowBits: core.int, serverNoContextTakeover: core.bool, clientNoContextTakeover: core.bool, serverSide: core.bool})}),
+  fields: () => ({
+    serverNoContextTakeover: core.bool,
+    clientNoContextTakeover: core.bool,
+    clientMaxWindowBits: core.int,
+    serverMaxWindowBits: core.int,
+    serverSide: core.bool,
+    decoder: io._Filter,
+    encoder: io._Filter
+  }),
+  methods: () => ({
+    [_ensureDecoder]: dart.definiteFunctionType(dart.void, []),
+    [_ensureEncoder]: dart.definiteFunctionType(dart.void, []),
+    processIncomingMessage: dart.definiteFunctionType(typed_data.Uint8List, [ListOfint()]),
+    processOutgoingMessage: dart.definiteFunctionType(core.List$(core.int), [ListOfint()])
+  })
+});
+const _deflateHelper = Symbol('_deflateHelper');
+const _outCloseCode = Symbol('_outCloseCode');
+const _outCloseReason = Symbol('_outCloseReason');
+io._WebSocketOutgoingTransformer = class _WebSocketOutgoingTransformer extends core.Object {
+  new(webSocket) {
+    this.webSocket = webSocket;
+    this[_eventSink] = null;
+    this[_deflateHelper] = null;
+    this[_deflateHelper] = this.webSocket[_deflate];
+  }
+  bind(stream) {
+    return StreamOfListOfint().eventTransformed(stream, dart.fn(eventSink => {
+      if (this[_eventSink] != null) {
+        dart.throw(new core.StateError("WebSocket transformer already used"));
+      }
+      this[_eventSink] = eventSink;
+      return this;
+    }, EventSinkOfListOfintTo_WebSocketOutgoingTransformer()));
+  }
+  add(message) {
+    if (io._WebSocketPong.is(message)) {
+      this.addFrame(io._WebSocketOpcode.PONG, message.payload);
+      return;
+    }
+    if (io._WebSocketPing.is(message)) {
+      this.addFrame(io._WebSocketOpcode.PING, message.payload);
+      return;
+    }
+    let data = null;
+    let opcode = null;
+    if (message != null) {
+      if (typeof message == 'string') {
+        opcode = io._WebSocketOpcode.TEXT;
+        data = convert.UTF8.encode(message);
+      } else {
+        if (ListOfint().is(message)) {
+          data = message;
+          opcode = io._WebSocketOpcode.BINARY;
+        } else {
+          dart.throw(new core.ArgumentError(message));
+        }
+      }
+      if (this[_deflateHelper] != null) {
+        data = this[_deflateHelper].processOutgoingMessage(data);
+      }
+    } else {
+      opcode = io._WebSocketOpcode.TEXT;
+    }
+    this.addFrame(opcode, data);
+  }
+  addError(error, stackTrace) {
+    if (stackTrace === void 0) stackTrace = null;
+    this[_eventSink].addError(error, stackTrace);
+  }
+  close() {
+    let code = this.webSocket[_outCloseCode];
+    let reason = this.webSocket[_outCloseReason];
+    let data = null;
+    if (code != null) {
+      data = ListOfint().new();
+      data[dartx.add](dart.notNull(code) >> 8 & 255);
+      data[dartx.add](dart.notNull(code) & 255);
+      if (reason != null) {
+        data[dartx.addAll](convert.UTF8.encode(reason));
+      }
+    }
+    this.addFrame(io._WebSocketOpcode.CLOSE, data);
+    this[_eventSink].close();
+  }
+  addFrame(opcode, data) {
+    return io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
+      this[_eventSink].add(e);
+    }, ListOfintToNull()));
+  }
+  static createFrame(opcode, data, serverSide, compressed) {
+    let mask = !dart.test(serverSide);
+    let dataLength = data == null ? 0 : data[dartx.length];
+    let headerSize = mask ? 6 : 2;
+    if (dart.notNull(dataLength) > 65535) {
+      headerSize = headerSize + 8;
+    } else if (dart.notNull(dataLength) > 125) {
+      headerSize = headerSize + 2;
+    }
+    let header = typed_data.Uint8List.new(headerSize);
+    let index = 0;
+    let hoc = (io._WebSocketProtocolTransformer.FIN | (dart.test(compressed) ? io._WebSocketProtocolTransformer.RSV1 : 0) | dart.notNull(opcode) & io._WebSocketProtocolTransformer.OPCODE) >>> 0;
+    header[dartx._set](index++, hoc);
+    let lengthBytes = 1;
+    if (dart.notNull(dataLength) > 65535) {
+      header[dartx._set](index++, 127);
+      lengthBytes = 8;
+    } else if (dart.notNull(dataLength) > 125) {
+      header[dartx._set](index++, 126);
+      lengthBytes = 2;
+    }
+    for (let i = 0; i < lengthBytes; i++) {
+      header[dartx._set](index++, dataLength[dartx['>>']]((lengthBytes - 1 - i) * 8) & 255);
+    }
+    if (mask) {
+      let i$ = 1;
+      header[dartx._set](i$, (dart.notNull(header[dartx._get](i$)) | 1 << 7) >>> 0);
+      let maskBytes = io._IOCrypto.getRandomBytes(4);
+      header[dartx.setRange](index, index + 4, maskBytes);
+      index = index + 4;
+      if (data != null) {
+        let list = null;
+        if (opcode == io._WebSocketOpcode.TEXT && typed_data.Uint8List.is(data)) {
+          list = data;
+        } else {
+          if (typed_data.Uint8List.is(data)) {
+            list = typed_data.Uint8List.fromList(data);
+          } else {
+            list = typed_data.Uint8List.new(data[dartx.length]);
+            for (let i = 0; i < dart.notNull(data[dartx.length]); i++) {
+              if (dart.notNull(data[dartx._get](i)) < 0 || 255 < dart.notNull(data[dartx._get](i))) {
+                dart.throw(new core.ArgumentError("List element is not a byte value " + dart.str`(value ${data[dartx._get](i)} at index ${i})`));
+              }
+              list[dartx._set](i, data[dartx._get](i));
+            }
+          }
+        }
+        let BLOCK_SIZE = 16;
+        let blockCount = (dart.notNull(list[dartx.length]) / BLOCK_SIZE)[dartx.truncate]();
+        if (blockCount > 0) {
+          let mask = 0;
+          for (let i = 3; i >= 0; i--) {
+            mask = (mask << 8 | dart.notNull(maskBytes[dartx._get](i))) >>> 0;
+          }
+          let blockMask = typed_data.Int32x4.new(mask, mask, mask, mask);
+          let blockBuffer = typed_data.Int32x4List.view(list[dartx.buffer], 0, blockCount);
+          for (let i = 0; i < dart.notNull(blockBuffer.length); i++) {
+            blockBuffer._set(i, blockBuffer._get(i)['^'](blockMask));
+          }
+        }
+        for (let i = blockCount * BLOCK_SIZE; i < dart.notNull(list[dartx.length]); i++) {
+          list[dartx._set](i, (dart.notNull(list[dartx._get](i)) ^ dart.notNull(maskBytes[dartx._get](i & 3))) >>> 0);
+        }
+        data = list;
+      }
+    }
+    dart.assert(index == headerSize);
+    if (data == null) {
+      return JSArrayOfUint8List().of([header]);
+    } else {
+      return JSArrayOfListOfint().of([header, data]);
+    }
+  }
+};
+io._WebSocketOutgoingTransformer[dart.implements] = () => [StreamTransformerOfdynamic$ListOfint(), async.EventSink];
+dart.setSignature(io._WebSocketOutgoingTransformer, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [io._WebSocketImpl])}),
+  fields: () => ({
+    webSocket: io._WebSocketImpl,
+    [_eventSink]: EventSinkOfListOfint(),
+    [_deflateHelper]: io._WebSocketPerMessageDeflate
+  }),
+  methods: () => ({
+    bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [async.Stream]),
+    add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+    addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
+    close: dart.definiteFunctionType(dart.void, []),
+    addFrame: dart.definiteFunctionType(dart.void, [core.int, ListOfint()])
+  }),
+  statics: () => ({createFrame: dart.definiteFunctionType(core.Iterable$(core.List$(core.int)), [core.int, ListOfint(), core.bool, core.bool])}),
+  names: ['createFrame']
+});
+const _issuedPause = Symbol('_issuedPause');
+const _completer = Symbol('_completer');
+const _onListen = Symbol('_onListen');
+const _onPause = Symbol('_onPause');
+const _onResume = Symbol('_onResume');
+const _cancel = Symbol('_cancel');
+const _done = Symbol('_done');
+const _ensureController = Symbol('_ensureController');
+io._WebSocketConsumer = class _WebSocketConsumer extends core.Object {
+  new(webSocket, socket) {
+    this[_closeCompleter] = async.Completer.new();
+    this.webSocket = webSocket;
+    this.socket = socket;
+    this[_controller] = null;
+    this[_subscription] = null;
+    this[_issuedPause] = false;
+    this[_closed] = false;
+    this[_completer] = null;
+  }
+  [_onListen]() {
+    if (this[_subscription] != null) {
+      this[_subscription].cancel();
+    }
+  }
+  [_onPause]() {
+    if (this[_subscription] != null) {
+      this[_subscription].pause();
+    } else {
+      this[_issuedPause] = true;
+    }
+  }
+  [_onResume]() {
+    if (this[_subscription] != null) {
+      this[_subscription].resume();
+    } else {
+      this[_issuedPause] = false;
+    }
+  }
+  [_cancel]() {
+    if (this[_subscription] != null) {
+      let subscription = this[_subscription];
+      this[_subscription] = null;
+      subscription.cancel();
+    }
+  }
+  [_ensureController]() {
+    if (this[_controller] != null) return;
+    this[_controller] = async.StreamController.new({sync: true, onPause: dart.bind(this, _onPause), onResume: dart.bind(this, _onResume), onCancel: dart.bind(this, _onListen)});
+    let stream = this[_controller].stream.transform(ListOfint())(new io._WebSocketOutgoingTransformer(this.webSocket));
+    this.socket.addStream(stream).then(dart.dynamic)(dart.fn(_ => {
+      this[_done]();
+      this[_closeCompleter].complete(this.webSocket);
+    }, dynamicToNull()), {onError: dart.fn((error, stackTrace) => {
+        this[_closed] = true;
+        this[_cancel]();
+        if (core.ArgumentError.is(error)) {
+          if (!dart.test(this[_done](error, stackTrace))) {
+            this[_closeCompleter].completeError(error, stackTrace);
+          }
+        } else {
+          this[_done]();
+          this[_closeCompleter].complete(this.webSocket);
+        }
+      }, dynamicAndStackTraceToNull())});
+  }
+  [_done](error, stackTrace) {
+    if (error === void 0) error = null;
+    if (stackTrace === void 0) stackTrace = null;
+    if (this[_completer] == null) return false;
+    if (error != null) {
+      this[_completer].completeError(error, stackTrace);
+    } else {
+      this[_completer].complete(this.webSocket);
+    }
+    this[_completer] = null;
+    return true;
+  }
+  addStream(stream) {
+    if (dart.test(this[_closed])) {
+      stream.listen(null).cancel();
+      return async.Future.value(this.webSocket);
+    }
+    this[_ensureController]();
+    this[_completer] = async.Completer.new();
+    this[_subscription] = stream.listen(dart.fn(data => {
+      this[_controller].add(data);
+    }, dynamicToNull()), {onDone: dart.bind(this, _done), onError: dart.bind(this, _done), cancelOnError: true});
+    if (dart.test(this[_issuedPause])) {
+      this[_subscription].pause();
+      this[_issuedPause] = false;
+    }
+    return this[_completer].future;
+  }
+  close() {
+    this[_ensureController]();
+    const closeSocket = (function() {
+      return this.socket.close().catchError(dart.fn(_ => {
+      }, dynamicToNull())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, dynamicTo_WebSocketImpl()));
+    }).bind(this);
+    dart.fn(closeSocket, VoidToFuture());
+    this[_controller].close();
+    return this[_closeCompleter].future.then(dart.dynamic)(dart.fn(_ => closeSocket(), dynamicToFuture()));
+  }
+  add(data) {
+    if (dart.test(this[_closed])) return;
+    this[_ensureController]();
+    this[_controller].add(data);
+  }
+  closeSocket() {
+    this[_closed] = true;
+    this[_cancel]();
+    this.close();
+  }
+};
+io._WebSocketConsumer[dart.implements] = () => [async.StreamConsumer];
+dart.setSignature(io._WebSocketConsumer, {
+  constructors: () => ({new: dart.definiteFunctionType(io._WebSocketConsumer, [io._WebSocketImpl, io.Socket])}),
+  fields: () => ({
+    webSocket: io._WebSocketImpl,
+    socket: io.Socket,
+    [_controller]: async.StreamController,
+    [_subscription]: async.StreamSubscription,
+    [_issuedPause]: core.bool,
+    [_closed]: core.bool,
+    [_closeCompleter]: async.Completer,
+    [_completer]: async.Completer
+  }),
+  methods: () => ({
+    [_onListen]: dart.definiteFunctionType(dart.void, []),
+    [_onPause]: dart.definiteFunctionType(dart.void, []),
+    [_onResume]: dart.definiteFunctionType(dart.void, []),
+    [_cancel]: dart.definiteFunctionType(dart.void, []),
+    [_ensureController]: dart.definiteFunctionType(dart.dynamic, []),
+    [_done]: dart.definiteFunctionType(core.bool, [], [dart.dynamic, core.StackTrace]),
+    addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
+    close: dart.definiteFunctionType(async.Future, []),
+    add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+    closeSocket: dart.definiteFunctionType(dart.void, [])
+  })
+});
+const _readyState = Symbol('_readyState');
+const _writeClosed = Symbol('_writeClosed');
+const _closeCode = Symbol('_closeCode');
+const _closeReason = Symbol('_closeReason');
+const _pingInterval = Symbol('_pingInterval');
+const _pingTimer = Symbol('_pingTimer');
+const _consumer = Symbol('_consumer');
+const _closeTimer = Symbol('_closeTimer');
+let const;
+io._WebSocketImpl = class _WebSocketImpl extends dart.mixin(async.Stream, io._ServiceObject) {
+  static connect(url, protocols, headers, opts) {
+    let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+    let uri = core.Uri.parse(url);
+    if (uri.scheme != "ws" && uri.scheme != "wss") {
+      dart.throw(new io.WebSocketException(dart.str`Unsupported URL scheme '${uri.scheme}'`));
+    }
+    let random = math.Random.new();
+    let nonceData = typed_data.Uint8List.new(16);
+    for (let i = 0; i < 16; i++) {
+      nonceData[dartx._set](i, random.nextInt(256));
+    }
+    let nonce = io._CryptoUtils.bytesToBase64(nonceData);
+    uri = core.Uri.new({scheme: uri.scheme == "wss" ? "https" : "http", userInfo: uri.userInfo, host: uri.host, port: uri.port, path: uri.path, query: uri.query, fragment: uri.fragment});
+    return io._WebSocketImpl._httpClient.openUrl("GET", uri).then(io.HttpClientResponse)(dart.fn(request => {
+      if (uri.userInfo != null && !dart.test(uri.userInfo[dartx.isEmpty])) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(uri.userInfo));
+        request.headers.set(io.HttpHeaders.AUTHORIZATION, dart.str`Basic ${auth}`);
+      }
+      if (headers != null) {
+        headers[dartx.forEach](dart.fn((field, value) => request.headers.add(field, value), StringAnddynamicTovoid()));
+      }
+      let _ = request.headers;
+      _.set(io.HttpHeaders.CONNECTION, "Upgrade");
+      _.set(io.HttpHeaders.UPGRADE, "websocket");
+      _.set("Sec-WebSocket-Key", nonce);
+      _.set("Cache-Control", "no-cache");
+      _.set("Sec-WebSocket-Version", "13");
+      if (protocols != null) {
+        request.headers.add("Sec-WebSocket-Protocol", protocols[dartx.toList]());
+      }
+      if (dart.test(compression.enabled)) {
+        request.headers.add("Sec-WebSocket-Extensions", compression[_createHeader]());
+      }
+      return request.close();
+    }, HttpClientRequestToFutureOfHttpClientResponse())).then(io.WebSocket)(dart.fn(response => {
+      function error(message) {
+        response.detachSocket().then(dart.dynamic)(dart.fn(socket => {
+          socket.destroy();
+        }, SocketToNull()));
+        dart.throw(new io.WebSocketException(message));
+      }
+      dart.fn(error, StringTovoid());
+      if (response.statusCode != io.HttpStatus.SWITCHING_PROTOCOLS || response.headers._get(io.HttpHeaders.CONNECTION) == null || !dart.test(response.headers._get(io.HttpHeaders.CONNECTION)[dartx.any](dart.fn(value => value[dartx.toLowerCase]() == "upgrade", StringTobool()))) || response.headers.value(io.HttpHeaders.UPGRADE)[dartx.toLowerCase]() != "websocket") {
+        error(dart.str`Connection to '${uri}' was not upgraded to websocket`);
+      }
+      let accept = response.headers.value("Sec-WebSocket-Accept");
+      if (accept == null) {
+        error("Response did not contain a 'Sec-WebSocket-Accept' header");
+      }
+      let sha1 = new io._SHA1();
+      sha1.add(dart.str`${nonce}${io._webSocketGUID}`[dartx.codeUnits]);
+      let expectedAccept = sha1.close();
+      let receivedAccept = io._CryptoUtils.base64StringToBytes(accept);
+      if (expectedAccept[dartx.length] != receivedAccept[dartx.length]) {
+        error("Reasponse header 'Sec-WebSocket-Accept' is the wrong length");
+      }
+      for (let i = 0; i < dart.notNull(expectedAccept[dartx.length]); i++) {
+        if (expectedAccept[dartx._get](i) != receivedAccept[dartx._get](i)) {
+          error("Bad response 'Sec-WebSocket-Accept' header");
+        }
+      }
+      let protocol = response.headers.value('Sec-WebSocket-Protocol');
+      let deflate = io._WebSocketImpl.negotiateClientCompression(response, compression);
+      return response.detachSocket().then(io.WebSocket)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, false, deflate), SocketTo_WebSocketImpl()));
+    }, HttpClientResponseToFutureOfWebSocket()));
+  }
+  static negotiateClientCompression(response, compression) {
+    let extensionHeader = response.headers.value('Sec-WebSocket-Extensions');
+    if (extensionHeader == null) {
+      extensionHeader = "";
+    }
+    let hv = io.HeaderValue.parse(extensionHeader, {valueSeparator: ','});
+    if (dart.test(compression.enabled) && hv.value == io._WebSocketImpl.PER_MESSAGE_DEFLATE) {
+      let serverNoContextTakeover = hv.parameters[dartx.containsKey](io._serverNoContextTakeover);
+      let clientNoContextTakeover = hv.parameters[dartx.containsKey](io._clientNoContextTakeover);
+      function getWindowBits(type) {
+        let o = hv.parameters[dartx._get](type);
+        if (o == null) {
+          return io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+        }
+        return core.int.parse(o, {onError: dart.fn(s => io._WebSocketImpl.DEFAULT_WINDOW_BITS, StringToint())});
+      }
+      dart.fn(getWindowBits, StringToint());
+      return new io._WebSocketPerMessageDeflate({clientMaxWindowBits: getWindowBits(io._clientMaxWindowBits), serverMaxWindowBits: getWindowBits(io._serverMaxWindowBits), clientNoContextTakeover: clientNoContextTakeover, serverNoContextTakeover: serverNoContextTakeover});
+    }
+    return null;
+  }
+  _fromSocket(socket, protocol, compression, serverSide, deflate) {
+    if (serverSide === void 0) serverSide = false;
+    if (deflate === void 0) deflate = null;
+    this[_socket] = socket;
+    this.protocol = protocol;
+    this[_serverSide] = serverSide;
+    this[_controller] = null;
+    this[_subscription] = null;
+    this[_sink] = null;
+    this[_readyState] = io.WebSocket.CONNECTING;
+    this[_writeClosed] = false;
+    this[_closeCode] = null;
+    this[_closeReason] = null;
+    this[_pingInterval] = null;
+    this[_pingTimer] = null;
+    this[_consumer] = null;
+    this[_outCloseCode] = null;
+    this[_outCloseReason] = null;
+    this[_closeTimer] = null;
+    this[_deflate] = null;
+    super.new();
+    this[_consumer] = new io._WebSocketConsumer(this, io.Socket._check(this[_socket]));
+    this[_sink] = new io._StreamSinkImpl(this[_consumer]);
+    this[_readyState] = io.WebSocket.OPEN;
+    this[_deflate] = deflate;
+    let transformer = new io._WebSocketProtocolTransformer(this[_serverSide], this[_deflate]);
+    this[_subscription] = async.StreamSubscription._check(dart.dsend(dart.dsend(this[_socket], 'transform', transformer), 'listen', dart.fn(data => {
+      if (io._WebSocketPing.is(data)) {
+        if (!dart.test(this[_writeClosed])) this[_consumer].add(new io._WebSocketPong(data.payload));
+      } else if (io._WebSocketPong.is(data)) {
+        this.pingInterval = this[_pingInterval];
+      } else {
+        this[_controller].add(data);
+      }
+    }, dynamicToNull()), {onError: dart.fn((error, stackTrace) => {
+        if (this[_closeTimer] != null) this[_closeTimer].cancel();
+        if (core.FormatException.is(error)) {
+          this[_close](io.WebSocketStatus.INVALID_FRAME_PAYLOAD_DATA);
+        } else {
+          this[_close](io.WebSocketStatus.PROTOCOL_ERROR);
+        }
+        this[_closeCode] = this[_outCloseCode];
+        this[_closeReason] = this[_outCloseReason];
+        this[_controller].close();
+      }, dynamicAnddynamicToNull()), onDone: dart.fn(() => {
+        if (this[_closeTimer] != null) this[_closeTimer].cancel();
+        if (this[_readyState] == io.WebSocket.OPEN) {
+          this[_readyState] = io.WebSocket.CLOSING;
+          if (!dart.test(io._WebSocketImpl._isReservedStatusCode(transformer.closeCode))) {
+            this[_close](transformer.closeCode, transformer.closeReason);
+          } else {
+            this[_close]();
+          }
+          this[_readyState] = io.WebSocket.CLOSED;
+        }
+        this[_closeCode] = transformer.closeCode;
+        this[_closeReason] = transformer.closeReason;
+        this[_controller].close();
+      }, VoidToNull()), cancelOnError: true}));
+    this[_subscription].pause();
+    this[_controller] = async.StreamController.new({sync: true, onListen: dart.bind(this[_subscription], 'resume'), onCancel: dart.fn(() => {
+        this[_subscription].cancel();
+        this[_subscription] = null;
+      }, VoidToNull()), onPause: dart.bind(this[_subscription], 'pause'), onResume: dart.bind(this[_subscription], 'resume')});
+    io._WebSocketImpl._webSockets[dartx._set](this[_serviceId], this);
+    try {
+      dart.dput(this[_socket], _owner, this);
+    } catch (_) {
+    }
+
+  }
+  listen(onData, opts) {
+    let onError = opts && 'onError' in opts ? opts.onError : null;
+    let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+    let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+    return this[_controller].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+  }
+  get pingInterval() {
+    return this[_pingInterval];
+  }
+  set pingInterval(interval) {
+    if (dart.test(this[_writeClosed])) return;
+    if (this[_pingTimer] != null) this[_pingTimer].cancel();
+    this[_pingInterval] = interval;
+    if (this[_pingInterval] == null) return;
+    this[_pingTimer] = async.Timer.new(this[_pingInterval], dart.fn(() => {
+      if (dart.test(this[_writeClosed])) return;
+      this[_consumer].add(new io._WebSocketPing());
+      this[_pingTimer] = async.Timer.new(this[_pingInterval], dart.fn(() => {
+        this[_close](io.WebSocketStatus.GOING_AWAY);
+      }, VoidToNull()));
+    }, VoidToNull()));
+  }
+  get readyState() {
+    return this[_readyState];
+  }
+  get extensions() {
+    return null;
+  }
+  get closeCode() {
+    return this[_closeCode];
+  }
+  get closeReason() {
+    return this[_closeReason];
+  }
+  add(data) {
+    this[_sink].add(data);
+  }
+  addError(error, stackTrace) {
+    if (stackTrace === void 0) stackTrace = null;
+    this[_sink].addError(error, stackTrace);
+  }
+  addStream(stream) {
+    return this[_sink].addStream(stream);
+  }
+  get done() {
+    return this[_sink].done;
+  }
+  close(code, reason) {
+    if (code === void 0) code = null;
+    if (reason === void 0) reason = null;
+    if (dart.test(io._WebSocketImpl._isReservedStatusCode(code))) {
+      dart.throw(new io.WebSocketException(dart.str`Reserved status code ${code}`));
+    }
+    if (this[_outCloseCode] == null) {
+      this[_outCloseCode] = code;
+      this[_outCloseReason] = reason;
+    }
+    if (!dart.test(this[_controller].isClosed)) {
+      if (!dart.test(this[_controller].hasListener) && this[_subscription] != null) {
+        this[_controller].stream.drain(dart.dynamic)().catchError(dart.fn(_ => dart.map(), dynamicToMap()));
+      }
+      if (this[_closeTimer] == null) {
+        this[_closeTimer] = async.Timer.new(const || (const = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
+          this[_closeCode] = this[_outCloseCode];
+          this[_closeReason] = this[_outCloseReason];
+          if (this[_subscription] != null) this[_subscription].cancel();
+          this[_controller].close();
+          io._WebSocketImpl._webSockets[dartx.remove](this[_serviceId]);
+        }, VoidToNull()));
+      }
+    }
+    return this[_sink].close();
+  }
+  [_close](code, reason) {
+    if (code === void 0) code = null;
+    if (reason === void 0) reason = null;
+    if (dart.test(this[_writeClosed])) return;
+    if (this[_outCloseCode] == null) {
+      this[_outCloseCode] = code;
+      this[_outCloseReason] = reason;
+    }
+    this[_writeClosed] = true;
+    this[_consumer].closeSocket();
+    io._WebSocketImpl._webSockets[dartx.remove](this[_serviceId]);
+  }
+  get [_serviceTypePath]() {
+    return 'io/websockets';
+  }
+  get [_serviceTypeName]() {
+    return 'WebSocket';
+  }
+  [_toJSON](ref) {
+    let name = dart.str`${dart.dload(dart.dload(this[_socket], 'address'), 'host')}:${dart.dload(this[_socket], 'port')}`;
+    let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: name, user_name: name}, core.String, dart.dynamic);
+    if (dart.test(ref)) {
+      return r;
+    }
+    try {
+      r[dartx._set]('socket', dart.dsend(this[_socket], _toJSON, true));
+    } catch (_) {
+      r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+    }
+
+    return r;
+  }
+  static _isReservedStatusCode(code) {
+    return code != null && (dart.notNull(code) < io.WebSocketStatus.NORMAL_CLOSURE || code == io.WebSocketStatus.RESERVED_1004 || code == io.WebSocketStatus.NO_STATUS_RECEIVED || code == io.WebSocketStatus.ABNORMAL_CLOSURE || dart.notNull(code) > io.WebSocketStatus.INTERNAL_SERVER_ERROR && dart.notNull(code) < io.WebSocketStatus.RESERVED_1015 || dart.notNull(code) >= io.WebSocketStatus.RESERVED_1015 && dart.notNull(code) < 3000);
+  }
+};
+dart.addSimpleTypeTests(io._WebSocketImpl);
+dart.defineNamedConstructor(io._WebSocketImpl, '_fromSocket');
+io._WebSocketImpl[dart.implements] = () => [io.WebSocket];
+dart.setSignature(io._WebSocketImpl, {
+  constructors: () => ({_fromSocket: dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic, core.String, io.CompressionOptions], [core.bool, io._WebSocketPerMessageDeflate])}),
+  fields: () => ({
+    protocol: core.String,
+    [_controller]: async.StreamController,
+    [_subscription]: async.StreamSubscription,
+    [_sink]: async.StreamSink,
+    [_socket]: dart.dynamic,
+    [_serverSide]: core.bool,
+    [_readyState]: core.int,
+    [_writeClosed]: core.bool,
+    [_closeCode]: core.int,
+    [_closeReason]: core.String,
+    [_pingInterval]: core.Duration,
+    [_pingTimer]: async.Timer,
+    [_consumer]: io._WebSocketConsumer,
+    [_outCloseCode]: core.int,
+    [_outCloseReason]: core.String,
+    [_closeTimer]: async.Timer,
+    [_deflate]: io._WebSocketPerMessageDeflate
+  }),
+  getters: () => ({
+    pingInterval: dart.definiteFunctionType(core.Duration, []),
+    readyState: dart.definiteFunctionType(core.int, []),
+    extensions: dart.definiteFunctionType(core.String, []),
+    closeCode: dart.definiteFunctionType(core.int, []),
+    closeReason: dart.definiteFunctionType(core.String, []),
+    done: dart.definiteFunctionType(async.Future, []),
+    [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+    [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+  }),
+  setters: () => ({pingInterval: dart.definiteFunctionType(dart.void, [core.Duration])}),
+  methods: () => ({
+    listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+    add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+    addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+    addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
+    close: dart.definiteFunctionType(async.Future, [], [core.int, core.String]),
+    [_close]: dart.definiteFunctionType(dart.void, [], [core.int, core.String]),
+    [_toJSON]: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [core.bool])
+  }),
+  sfields: () => ({
+    _webSockets: MapOfint$_WebSocketImpl(),
+    DEFAULT_WINDOW_BITS: core.int,
+    PER_MESSAGE_DEFLATE: core.String,
+    _httpClient: io.HttpClient
+  }),
+  statics: () => ({
+    connect: dart.definiteFunctionType(async.Future$(io.WebSocket), [core.String, IterableOfString(), MapOfString$dynamic()], {compression: io.CompressionOptions}),
+    negotiateClientCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpClientResponse, io.CompressionOptions]),
+    _isReservedStatusCode: dart.definiteFunctionType(core.bool, [core.int])
+  }),
+  names: ['connect', 'negotiateClientCompression', '_isReservedStatusCode']
+});
+io._WebSocketImpl.DEFAULT_WINDOW_BITS = 15;
+io._WebSocketImpl.PER_MESSAGE_DEFLATE = "permessage-deflate";
+dart.defineLazy(io._WebSocketImpl, {
+  get _webSockets() {
+    return MapOfint$_WebSocketImpl().new();
+  },
+  set _webSockets(_) {},
+  get _httpClient() {
+    return io.HttpClient.new();
+  }
+});
 isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
   new(message) {
     this.message = message;
@@ -37350,11 +52553,11 @@
     controller = async.StreamController.broadcast({sync: true, onListen: dart.fn(() => {
         port = isolate.RawReceivePort.new(handleError);
         this.addErrorListener(port.sendPort);
-      }, VoidTovoid()), onCancel: dart.fn(() => {
+      }, VoidToNull()), onCancel: dart.fn(() => {
         this.removeErrorListener(port.sendPort);
         port.close();
         port = null;
-      }, VoidTovoid())});
+      }, VoidToNull())});
     return controller.stream;
   }
 };
@@ -37491,7 +52694,7 @@
 });
 dart.defineLazy(js, {
   get context() {
-    return js._wrapToDart(js._global);
+    return js.JsObject._check(js._wrapToDart(js._global));
   }
 });
 const _jsObject = Symbol('_jsObject');
@@ -37504,22 +52707,22 @@
     if (arguments$ === void 0) arguments$ = null;
     let ctor = constructor[_jsObject];
     if (arguments$ == null) {
-      return js._wrapToDart(new ctor());
+      return js.JsObject._check(js._wrapToDart(new ctor()));
     }
     let unwrapped = core.List.from(arguments$[dartx.map](dart.dynamic)(js._convertToJS));
-    return js._wrapToDart(new ctor(...unwrapped));
+    return js.JsObject._check(js._wrapToDart(new ctor(...unwrapped)));
   }
   static fromBrowserObject(object) {
     if (typeof object == 'number' || typeof object == 'string' || typeof object == 'boolean' || object == null) {
       dart.throw(new core.ArgumentError("object cannot be a num, string, bool, or null"));
     }
-    return js._wrapToDart(js._convertToJS(object));
+    return js.JsObject._check(js._wrapToDart(js._convertToJS(object)));
   }
   static jsify(object) {
     if (!core.Map.is(object) && !core.Iterable.is(object)) {
       dart.throw(new core.ArgumentError("object must be a Map or Iterable"));
     }
-    return js._wrapToDart(js.JsObject._convertDataTree(object));
+    return js.JsObject._check(js._wrapToDart(js.JsObject._convertDataTree(object)));
   }
   static _convertDataTree(data) {
     let _convertedObjects = collection.HashMap.identity();
@@ -37595,7 +52798,7 @@
     }
     if (args != null) args = core.List.from(args[dartx.map](dart.dynamic)(js._convertToJS));
     let fn = this[_jsObject][method];
-    if (!(fn instanceof Function)) {
+    if (typeof fn !== "function") {
       dart.throw(new core.NoSuchMethodError(this[_jsObject], core.Symbol.new(core.String._check(method)), args, dart.map({}, core.Symbol, dart.dynamic)));
     }
     return js._convertToDart(fn.apply(this[_jsObject], args));
@@ -37767,14 +52970,7 @@
       [_checkIndex]: dart.definiteFunctionType(dart.dynamic, [core.int]),
       [_checkInsertIndex]: dart.definiteFunctionType(dart.dynamic, [core.int]),
       _get: dart.definiteFunctionType(E, [core.Object]),
-      _set: dart.definiteFunctionType(dart.void, [core.Object, E]),
-      add: dart.definiteFunctionType(dart.void, [E]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
-      insert: dart.definiteFunctionType(dart.void, [core.int, E]),
-      removeAt: dart.definiteFunctionType(E, [core.int]),
-      removeLast: dart.definiteFunctionType(E, []),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()], [core.int]),
-      sort: dart.definiteFunctionType(dart.void, [], [EAndEToint()])
+      _set: dart.definiteFunctionType(dart.void, [core.Object, E])
     }),
     statics: () => ({_checkRange: dart.definiteFunctionType(dart.dynamic, [core.int, core.int, core.int])}),
     names: ['_checkRange']
@@ -37797,7 +52993,7 @@
 });
 js.JsArray = JsArray();
 js._isBrowserType = function(o) {
-  return o instanceof Blob || o instanceof Event || window.KeyRange && o instanceof KeyRange || o instanceof ImageData || o instanceof Node || window.TypedData && o instanceof TypedData || o instanceof Window;
+  return o instanceof Object && (o instanceof Blob || o instanceof Event || window.KeyRange && o instanceof KeyRange || window.IDBKeyRange && o instanceof IDBKeyRange || o instanceof ImageData || o instanceof Node || window.Int8Array && o instanceof Int8Array.__proto__ || o instanceof Window);
 };
 dart.fn(js._isBrowserType, dynamicTobool());
 const _dartObj = Symbol('_dartObj');
@@ -37842,11 +53038,15 @@
   } else if (js._DartObject.is(o) && dart.jsobject != dart.getReifiedType(o)) {
     return o[_dartObj];
   } else {
-    return js._putIfAbsent(js._dartProxies, o, js._wrapToDart);
+    return js._wrapToDart(o);
   }
 };
 dart.fn(js._convertToDart, dynamicToObject());
 js._wrapToDart = function(o) {
+  return js._putIfAbsent(js._dartProxies, o, js._wrapToDartHelper);
+};
+dart.fn(js._wrapToDart, dynamicToObject());
+js._wrapToDartHelper = function(o) {
   if (typeof o == "function") {
     return new js.JsFunction._fromJs(o);
   }
@@ -37855,7 +53055,7 @@
   }
   return new js.JsObject._fromJs(o);
 };
-dart.fn(js._wrapToDart, dynamicToJsObject());
+dart.fn(js._wrapToDartHelper, dynamicToObject());
 dart.defineLazy(js, {
   get _dartProxies() {
     return new WeakMap();
@@ -39622,7 +54822,7 @@
       let completer = CompleterOfIdbFactory().sync();
       request[dartx.onSuccess].listen(dart.fn(e => {
         completer.complete(this);
-      }, EventTovoid()));
+      }, EventToNull()));
       request[dartx.onError].listen(dart.bind(completer, 'completeError'));
       return completer.future;
     } catch (e) {
@@ -39681,7 +54881,7 @@
     request[dartx.onSuccess].listen(dart.fn(e => {
       let result = indexed_db._cast(T)(request[dartx.result]);
       completer.complete(result);
-    }, EventTovoid()));
+    }, EventToNull()));
     request[dartx.onError].listen(dart.bind(completer, 'completeError'));
     return completer.future;
   };
@@ -40153,7 +55353,7 @@
             cursor[dartx.next]();
           }
         }
-      }, EventTovoid()));
+      }, EventToNull()));
       return controller.stream;
     };
   }
@@ -40326,15 +55526,15 @@
     let completer = CompleterOfDatabase().new();
     this[dartx.onComplete].first.then(dart.dynamic)(dart.fn(_ => {
       completer.complete(this[dartx.db]);
-    }, EventTodynamic()));
+    }, EventToNull()));
     this[dartx.onError].first.then(dart.dynamic)(dart.fn(e => {
       completer.completeError(e);
-    }, EventTodynamic()));
+    }, EventToNull()));
     this[dartx.onAbort].first.then(dart.dynamic)(dart.fn(e => {
       if (!dart.test(completer.isCompleted)) {
         completer.completeError(e);
       }
-    }, EventTodynamic()));
+    }, EventToNull()));
     return completer.future;
   }
   static _() {
@@ -40465,10 +55665,10 @@
     return html.Event._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new Event(type, eventInitDict);
+    return new self.Event(type, eventInitDict);
   }
   static _create_2(type) {
-    return new Event(type);
+    return new self.Event(type);
   }
   get [dartx.bubbles]() {
     return this.bubbles;
@@ -43175,10 +58375,10 @@
     return html.AnimationEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new AnimationEvent(type, eventInitDict);
+    return new self.AnimationEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new AnimationEvent(type);
+    return new self.AnimationEvent(type);
   }
   get [dartx.animationName]() {
     return this.animationName;
@@ -43220,10 +58420,10 @@
     return html.AnimationPlayerEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new AnimationPlayerEvent(type, eventInitDict);
+    return new self.AnimationPlayerEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new AnimationPlayerEvent(type);
+    return new self.AnimationPlayerEvent(type);
   }
   get [dartx.currentTime]() {
     return this.currentTime;
@@ -43460,10 +58660,10 @@
     return html.ApplicationCacheErrorEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new ApplicationCacheErrorEvent(type, eventInitDict);
+    return new self.ApplicationCacheErrorEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new ApplicationCacheErrorEvent(type);
+    return new self.ApplicationCacheErrorEvent(type);
   }
   get [dartx.message]() {
     return this.message;
@@ -44164,10 +59364,10 @@
     return html.AutocompleteErrorEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new AutocompleteErrorEvent(type, eventInitDict);
+    return new self.AutocompleteErrorEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new AutocompleteErrorEvent(type);
+    return new self.AutocompleteErrorEvent(type);
   }
   get [dartx.reason]() {
     return this.reason;
@@ -44315,10 +59515,10 @@
     return html.BeforeInstallPromptEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new BeforeInstallPromptEvent(type, eventInitDict);
+    return new self.BeforeInstallPromptEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new BeforeInstallPromptEvent(type);
+    return new self.BeforeInstallPromptEvent(type);
   }
   get [dartx.platforms]() {
     return this.platforms;
@@ -44400,10 +59600,10 @@
     return html.Blob._check(html.Blob._create_2(blobParts, bag));
   }
   static _create_1(parts) {
-    return new Blob(parts);
+    return new self.Blob(parts);
   }
   static _create_2(parts, bag) {
-    return new Blob(parts, bag);
+    return new self.Blob(parts, bag);
   }
   static _create_bag() {
     return {};
@@ -45889,7 +61089,7 @@
     return html.CircularGeofencingRegion._create_1(init_1);
   }
   static _create_1(init) {
-    return new CircularGeofencingRegion(init);
+    return new self.CircularGeofencingRegion(init);
   }
   get [dartx.latitude]() {
     return this.latitude;
@@ -46051,10 +61251,10 @@
     return html.CloseEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new CloseEvent(type, eventInitDict);
+    return new self.CloseEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new CloseEvent(type);
+    return new self.CloseEvent(type);
   }
   get [dartx.code]() {
     return this.code;
@@ -46135,10 +61335,10 @@
     return html.UIEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new UIEvent(type, eventInitDict);
+    return new self.UIEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new UIEvent(type);
+    return new self.UIEvent(type);
   }
   get [_charCode]() {
     return this.charCode;
@@ -46217,10 +61417,10 @@
     return html.CompositionEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new CompositionEvent(type, eventInitDict);
+    return new self.CompositionEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new CompositionEvent(type);
+    return new self.CompositionEvent(type);
   }
   get [dartx.data]() {
     return this.data;
@@ -46259,7 +61459,7 @@
     return html.CompositorProxy._create_1(element, attributeArray);
   }
   static _create_1(element, attributeArray) {
-    return new CompositorProxy(element, attributeArray);
+    return new self.CompositorProxy(element, attributeArray);
   }
   get [dartx.opacity]() {
     return this.opacity;
@@ -46325,7 +61525,7 @@
     return html.CompositorWorker._create_1(scriptUrl);
   }
   static _create_1(scriptUrl) {
-    return new CompositorWorker(scriptUrl);
+    return new self.CompositorWorker(scriptUrl);
   }
   [dartx.postMessage](message, transfer) {
     if (transfer === void 0) transfer = null;
@@ -46471,9 +61671,9 @@
     let completer = CompleterOfFileSystem().new();
     this[_webkitRequestFileSystem](type, size, dart.fn(value => {
       completer.complete(value);
-    }, FileSystemTovoid()), dart.fn(error => {
+    }, FileSystemToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
   [dartx.requestFileSystemSync](...args) {
@@ -46489,9 +61689,9 @@
     let completer = CompleterOfEntry().new();
     this[_webkitResolveLocalFileSystemUrl](url, dart.fn(value => {
       completer.complete(value);
-    }, EntryTovoid()), dart.fn(error => {
+    }, EntryToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
   [dartx.atob](...args) {
@@ -53949,10 +69149,10 @@
     return html.CustomEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new CustomEvent(type, eventInitDict);
+    return new self.CustomEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new CustomEvent(type);
+    return new self.CustomEvent(type);
   }
   get [_detail]() {
     return html_common.convertNativeToDart_SerializedScriptValue(this[_get__detail]);
@@ -54131,7 +69331,7 @@
     let completer = CompleterOfString().new();
     this[_getAsString](dart.fn(value => {
       completer.complete(value);
-    }, StringTovoid()));
+    }, StringToNull()));
     return completer.future;
   }
   [dartx.getAsEntry](...args) {
@@ -54267,10 +69467,10 @@
     return html.DefaultSessionStartEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new DefaultSessionStartEvent(type, eventInitDict);
+    return new self.DefaultSessionStartEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new DefaultSessionStartEvent(type);
+    return new self.DefaultSessionStartEvent(type);
   }
   get [dartx.session]() {
     return this.session;
@@ -54420,10 +69620,10 @@
     return html.DeviceLightEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new DeviceLightEvent(type, eventInitDict);
+    return new self.DeviceLightEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new DeviceLightEvent(type);
+    return new self.DeviceLightEvent(type);
   }
   get [dartx.value]() {
     return this.value;
@@ -54673,9 +69873,9 @@
     let completer = CompleterOfEntry().new();
     this[_copyTo](parent, {name: name, successCallback: dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), errorCallback: dart.fn(error => {
+      }, EntryToNull()), errorCallback: dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid())});
+      }, FileErrorToNull())});
     return completer.future;
   }
   [_getMetadata](...args) {
@@ -54685,9 +69885,9 @@
     let completer = CompleterOfMetadata().new();
     this[_getMetadata](dart.fn(value => {
       completer.complete(value);
-    }, MetadataTovoid()), dart.fn(error => {
+    }, MetadataToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
   [_getParent](...args) {
@@ -54697,9 +69897,9 @@
     let completer = CompleterOfEntry().new();
     this[_getParent](dart.fn(value => {
       completer.complete(value);
-    }, EntryTovoid()), dart.fn(error => {
+    }, EntryToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
   [_moveTo](...args) {
@@ -54710,9 +69910,9 @@
     let completer = CompleterOfEntry().new();
     this[_moveTo](parent, {name: name, successCallback: dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), errorCallback: dart.fn(error => {
+      }, EntryToNull()), errorCallback: dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid())});
+      }, FileErrorToNull())});
     return completer.future;
   }
   [_remove](...args) {
@@ -54722,9 +69922,9 @@
     let completer = async.Completer.new();
     this[_remove](dart.fn(() => {
       completer.complete();
-    }, VoidTovoid()), dart.fn(error => {
+    }, VoidToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
   [dartx.toUrl](...args) {
@@ -54823,9 +70023,9 @@
     let completer = CompleterOfEntry().new();
     this[__getDirectory](path, {options: options, successCallback: dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), errorCallback: dart.fn(error => {
+      }, EntryToNull()), errorCallback: dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid())});
+      }, FileErrorToNull())});
     return completer.future;
   }
   [__getFile](path, opts) {
@@ -54867,9 +70067,9 @@
     let completer = CompleterOfEntry().new();
     this[__getFile](path, {options: options, successCallback: dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), errorCallback: dart.fn(error => {
+      }, EntryToNull()), errorCallback: dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid())});
+      }, FileErrorToNull())});
     return completer.future;
   }
   [_removeRecursively](...args) {
@@ -54879,9 +70079,9 @@
     let completer = async.Completer.new();
     this[_removeRecursively](dart.fn(() => {
       completer.complete();
-    }, VoidTovoid()), dart.fn(error => {
+    }, VoidToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
 };
@@ -54925,9 +70125,9 @@
     let completer = CompleterOfListOfEntry().new();
     this[_readEntries](dart.fn(value => {
       completer.complete(value);
-    }, ListOfEntryTovoid()), dart.fn(error => {
+    }, ListOfEntryToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
 };
@@ -57093,17 +72293,11 @@
 html.DomStringList[dart.implements] = () => [ListOfString()];
 dart.setSignature(html.DomStringList, {
   constructors: () => ({_: dart.definiteFunctionType(html.DomStringList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(core.String, []),
-    [dartx.last]: dart.definiteFunctionType(core.String, []),
-    [dartx.single]: dart.definiteFunctionType(core.String, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(core.String, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
-    [dartx.elementAt]: dart.definiteFunctionType(core.String, [core.int]),
     [__getter__]: dart.definiteFunctionType(core.String, [core.int]),
     [dartx.item]: dart.definiteFunctionType(core.String, [core.int])
   })
@@ -57272,10 +72466,6 @@
   }),
   getters: () => ({
     length: dart.definiteFunctionType(core.int, []),
-    iterator: dart.definiteFunctionType(core.Iterator$(html.Element), []),
-    first: dart.definiteFunctionType(html.Element, []),
-    last: dart.definiteFunctionType(html.Element, []),
-    single: dart.definiteFunctionType(html.Element, []),
     rawList: dart.definiteFunctionType(core.List$(html.Node), [])
   }),
   setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
@@ -57283,18 +72473,7 @@
     _get: dart.definiteFunctionType(html.Element, [core.int]),
     _set: dart.definiteFunctionType(dart.void, [core.int, html.Element]),
     add: dart.definiteFunctionType(html.Element, [html.Element]),
-    addAll: dart.definiteFunctionType(dart.void, [IterableOfElement()]),
-    sort: dart.definiteFunctionType(dart.void, [], [ElementAndElementToint()]),
-    removeWhere: dart.definiteFunctionType(dart.void, [ElementTobool()]),
-    retainWhere: dart.definiteFunctionType(dart.void, [ElementTobool()]),
-    [_filter]: dart.definiteFunctionType(dart.void, [ElementTobool(), core.bool]),
-    setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()], [core.int]),
-    replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()]),
-    fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html.Element]),
-    insert: dart.definiteFunctionType(dart.void, [core.int, html.Element]),
-    setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfElement()]),
-    removeAt: dart.definiteFunctionType(html.Element, [core.int]),
-    removeLast: dart.definiteFunctionType(html.Element, [])
+    [_filter]: dart.definiteFunctionType(dart.void, [ElementTobool(), core.bool])
   })
 });
 dart.defineExtensionMembers(html._ChildrenElementList, [
@@ -57609,9 +72788,6 @@
     fields: () => ({[_nodeList]: ListOfNode()}),
     getters: () => ({
       length: dart.definiteFunctionType(core.int, []),
-      first: dart.definiteFunctionType(E, []),
-      last: dart.definiteFunctionType(E, []),
-      single: dart.definiteFunctionType(E, []),
       classes: dart.definiteFunctionType(html.CssClassSet, []),
       style: dart.definiteFunctionType(html.CssStyleDeclarationBase, []),
       contentEdge: dart.definiteFunctionType(html.CssRect, []),
@@ -57695,8 +72871,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(E, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, E]),
-      sort: dart.definiteFunctionType(dart.void, [], [ComparatorOfE()])
+      _set: dart.definiteFunctionType(dart.void, [core.int, E])
     })
   });
   dart.defineExtensionMembers(_FrozenElementList, [
@@ -57862,10 +73037,10 @@
     return html.ErrorEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new ErrorEvent(type, eventInitDict);
+    return new self.ErrorEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new ErrorEvent(type);
+    return new self.ErrorEvent(type);
   }
   get [dartx.colno]() {
     return this.colno;
@@ -57929,10 +73104,10 @@
     return html.EventSource._create_2(url);
   }
   static _create_1(url, eventSourceInitDict) {
-    return new EventSource(url, eventSourceInitDict);
+    return new self.EventSource(url, eventSourceInitDict);
   }
   static _create_2(url) {
-    return new EventSource(url);
+    return new self.EventSource(url);
   }
   get [dartx.readyState]() {
     return this.readyState;
@@ -58054,10 +73229,10 @@
     return html.ExtendableEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new ExtendableEvent(type, eventInitDict);
+    return new self.ExtendableEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new ExtendableEvent(type);
+    return new self.ExtendableEvent(type);
   }
   [dartx.waitUntil](...args) {
     return this.waitUntil.apply(this, args);
@@ -58089,7 +73264,7 @@
     return html.FederatedCredential._create_1(data_1);
   }
   static _create_1(data) {
-    return new FederatedCredential(data);
+    return new self.FederatedCredential(data);
   }
   get [dartx.protocol]() {
     return this.protocol;
@@ -58129,10 +73304,10 @@
     return html.FetchEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new FetchEvent(type, eventInitDict);
+    return new self.FetchEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new FetchEvent(type);
+    return new self.FetchEvent(type);
   }
   get [dartx.isReload]() {
     return this.isReload;
@@ -58276,10 +73451,10 @@
     return html.File._create_2(fileBits, fileName);
   }
   static _create_1(fileBits, fileName, options) {
-    return new File(fileBits, fileName, options);
+    return new self.File(fileBits, fileName, options);
   }
   static _create_2(fileBits, fileName) {
-    return new File(fileBits, fileName);
+    return new self.File(fileBits, fileName);
   }
   get [dartx.lastModified]() {
     return this.lastModified;
@@ -58334,9 +73509,9 @@
     let completer = CompleterOfFileWriter().new();
     this[_createWriter](dart.fn(value => {
       completer.complete(value);
-    }, FileWriterTovoid()), dart.fn(error => {
+    }, FileWriterToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
   [_file](...args) {
@@ -58346,9 +73521,9 @@
     let completer = CompleterOfFile().new();
     this[_file](dart.fn(value => {
       completer.complete(value);
-    }, FileTovoid()), dart.fn(error => {
+    }, FileToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
 };
@@ -58464,17 +73639,11 @@
 html.FileList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfFile()];
 dart.setSignature(html.FileList, {
   constructors: () => ({_: dart.definiteFunctionType(html.FileList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.File, []),
-    [dartx.last]: dart.definiteFunctionType(html.File, []),
-    [dartx.single]: dart.definiteFunctionType(html.File, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.File, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.File]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.File, [core.int]),
     [dartx.item]: dart.definiteFunctionType(html.File, [core.int])
   })
 });
@@ -58509,7 +73678,7 @@
     return html.FileReader._create_1();
   }
   static _create_1() {
-    return new FileReader();
+    return new self.FileReader();
   }
   get [dartx.error]() {
     return this.error;
@@ -58793,10 +73962,10 @@
     return html.FocusEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new FocusEvent(type, eventInitDict);
+    return new self.FocusEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new FocusEvent(type);
+    return new self.FocusEvent(type);
   }
   get [dartx.relatedTarget]() {
     return html._convertNativeToDart_EventTarget(this[_get_relatedTarget]);
@@ -58844,10 +74013,10 @@
     return html.FontFace._create_2(family, source);
   }
   static _create_1(family, source, descriptors) {
-    return new FontFace(family, source, descriptors);
+    return new self.FontFace(family, source, descriptors);
   }
   static _create_2(family, source) {
-    return new FontFace(family, source);
+    return new self.FontFace(family, source);
   }
   get [dartx.family]() {
     return this.family;
@@ -59018,10 +74187,10 @@
     return html.FormData._create_2();
   }
   static _create_1(form) {
-    return new FormData(form);
+    return new self.FormData(form);
   }
   static _create_2() {
-    return new FormData();
+    return new self.FormData();
   }
   static get supported() {
     return !!window.FormData;
@@ -59312,10 +74481,10 @@
     return html.GamepadEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new GamepadEvent(type, eventInitDict);
+    return new self.GamepadEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new GamepadEvent(type);
+    return new self.GamepadEvent(type);
   }
   get [dartx.gamepad]() {
     return this.gamepad;
@@ -59418,9 +74587,9 @@
     try {
       this[_getCurrentPosition](dart.fn(position => {
         completer.complete(this[_ensurePosition](position));
-      }, GeopositionTovoid()), dart.fn(error => {
+      }, GeopositionToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, PositionErrorTovoid()), options);
+      }, PositionErrorToNull()), options);
     } catch (e) {
       let stacktrace = dart.stackTrace(e);
       completer.completeError(e, stacktrace);
@@ -59448,13 +74617,13 @@
         dart.assert(watchId == null);
         watchId = this[_watchPosition](dart.fn(position => {
           controller.add(this[_ensurePosition](position));
-        }, GeopositionTovoid()), dart.fn(error => {
+        }, GeopositionToNull()), dart.fn(error => {
           controller.addError(error);
-        }, PositionErrorTovoid()), options);
-      }, VoidTovoid()), onCancel: dart.fn(() => {
+        }, PositionErrorToNull()), options);
+      }, VoidToNull()), onCancel: dart.fn(() => {
         dart.assert(watchId != null);
         this[_clearWatch](watchId);
-      }, VoidTodynamic())});
+      }, VoidToNull())});
     return controller.stream;
   }
   [_ensurePosition](domPosition) {
@@ -60162,7 +75331,7 @@
     let oldUrl = opts && 'oldUrl' in opts ? opts.oldUrl : null;
     let newUrl = opts && 'newUrl' in opts ? opts.newUrl : null;
     let options = dart.map({canBubble: canBubble, cancelable: cancelable, oldURL: oldUrl, newURL: newUrl}, core.String, core.Object);
-    return new HashChangeEvent(type, html_common.convertDartToNative_Dictionary(options));
+    return new self.HashChangeEvent(type, html_common.convertDartToNative_Dictionary(options));
   }
   static _(type, eventInitDict) {
     if (eventInitDict === void 0) eventInitDict = null;
@@ -60173,10 +75342,10 @@
     return html.HashChangeEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new HashChangeEvent(type, eventInitDict);
+    return new self.HashChangeEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new HashChangeEvent(type);
+    return new self.HashChangeEvent(type);
   }
   static get supported() {
     return html_common.Device.isEventTypeSupported('HashChangeEvent');
@@ -60251,16 +75420,16 @@
     dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
   }
   static _create_1() {
-    return new Headers();
+    return new self.Headers();
   }
   static _create_2(input) {
-    return new Headers(input);
+    return new self.Headers(input);
   }
   static _create_3(input) {
-    return new Headers(input);
+    return new self.Headers(input);
   }
   static _create_4(input) {
-    return new Headers(input);
+    return new self.Headers(input);
   }
 };
 dart.setSignature(html.Headers, {
@@ -60542,17 +75711,11 @@
 html.HtmlCollection[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
 dart.setSignature(html.HtmlCollection, {
   constructors: () => ({_: dart.definiteFunctionType(html.HtmlCollection, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.Node, []),
-    [dartx.last]: dart.definiteFunctionType(html.Node, []),
-    [dartx.single]: dart.definiteFunctionType(html.Node, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.Node, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.Node]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.Node, [core.int]),
     [dartx.item]: dart.definiteFunctionType(html.Node, [core.int]),
     [dartx.namedItem]: dart.definiteFunctionType(core.Object, [core.String])
   })
@@ -60864,7 +76027,7 @@
     let parts = [];
     data[dartx.forEach](dart.fn((key, value) => {
       parts[dartx.add](dart.str`${core.Uri.encodeQueryComponent(key)}=` + dart.str`${core.Uri.encodeQueryComponent(value)}`);
-    }, StringAndStringTovoid()));
+    }, StringAndStringToNull()));
     let formData = parts[dartx.join]('&');
     if (requestHeaders == null) {
       requestHeaders = dart.map({}, core.String, core.String);
@@ -60898,7 +76061,7 @@
     if (requestHeaders != null) {
       requestHeaders[dartx.forEach](dart.fn((header, value) => {
         xhr[dartx.setRequestHeader](header, value);
-      }, StringAndStringTovoid()));
+      }, StringAndStringToNull()));
     }
     if (onProgress != null) {
       xhr[dartx.onProgress].listen(onProgress);
@@ -60913,7 +76076,7 @@
       } else {
         completer.completeError(e);
       }
-    }, ProgressEventTovoid()));
+    }, ProgressEventToNull()));
     xhr[dartx.onError].listen(dart.bind(completer, 'completeError'));
     if (sendData != null) {
       xhr[dartx.send](sendData);
@@ -60950,13 +76113,13 @@
     }
     let xhr = new XDomainRequest();
     xhr.open(method, url);
-    xhr.onload = _js_helper.convertDartClosureToJS(dynamicTodynamic())(dart.fn(e => {
+    xhr.onload = _js_helper.convertDartClosureToJS(dynamicToNull())(dart.fn(e => {
       let response = xhr.responseText;
       completer.complete(response);
-    }, dynamicTodynamic()), 1);
-    xhr.onerror = _js_helper.convertDartClosureToJS(dynamicTodynamic())(dart.fn(e => {
+    }, dynamicToNull()), 1);
+    xhr.onerror = _js_helper.convertDartClosureToJS(dynamicToNull())(dart.fn(e => {
       completer.completeError(e);
-    }, dynamicTodynamic()), 1);
+    }, dynamicToNull()), 1);
     xhr.onprogress = {};
     xhr.ontimeout = {};
     xhr.timeout = Number.MAX_VALUE;
@@ -61287,13 +76450,13 @@
     dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
   }
   static _create_1(data_OR_sw, sh_OR_sw) {
-    return new ImageData(data_OR_sw, sh_OR_sw);
+    return new self.ImageData(data_OR_sw, sh_OR_sw);
   }
   static _create_2(data_OR_sw, sh_OR_sw) {
-    return new ImageData(data_OR_sw, sh_OR_sw);
+    return new self.ImageData(data_OR_sw, sh_OR_sw);
   }
   static _create_3(data_OR_sw, sh_OR_sw, sh) {
-    return new ImageData(data_OR_sw, sh_OR_sw, sh);
+    return new self.ImageData(data_OR_sw, sh_OR_sw, sh);
   }
   get [dartx.data]() {
     return this.data;
@@ -61492,10 +76655,10 @@
     return html.InputDevice._create_2();
   }
   static _create_1(deviceInitDict) {
-    return new InputDevice(deviceInitDict);
+    return new self.InputDevice(deviceInitDict);
   }
   static _create_2() {
-    return new InputDevice();
+    return new self.InputDevice();
   }
   get [dartx.firesTouchEvents]() {
     return this.firesTouchEvents;
@@ -63213,10 +78376,10 @@
     return html.KeyboardEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new KeyboardEvent(type, eventInitDict);
+    return new self.KeyboardEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new KeyboardEvent(type);
+    return new self.KeyboardEvent(type);
   }
   get [dartx.altKey]() {
     return this.altKey;
@@ -63314,13 +78477,13 @@
     dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
   }
   static _create_1(target, keyframes) {
-    return new KeyframeEffect(target, keyframes);
+    return new self.KeyframeEffect(target, keyframes);
   }
   static _create_2(target, keyframes, timing) {
-    return new KeyframeEffect(target, keyframes, timing);
+    return new self.KeyframeEffect(target, keyframes, timing);
   }
   static _create_3(target, keyframes, timing) {
-    return new KeyframeEffect(target, keyframes, timing);
+    return new self.KeyframeEffect(target, keyframes, timing);
   }
 };
 dart.setSignature(html.KeyframeEffect, {
@@ -63860,7 +79023,7 @@
     return html.MediaController._create_1();
   }
   static _create_1() {
-    return new MediaController();
+    return new self.MediaController();
   }
   get [dartx.buffered]() {
     return this.buffered;
@@ -64026,10 +79189,10 @@
     return html.MediaEncryptedEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new MediaEncryptedEvent(type, eventInitDict);
+    return new self.MediaEncryptedEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new MediaEncryptedEvent(type);
+    return new self.MediaEncryptedEvent(type);
   }
   get [dartx.initData]() {
     return this.initData;
@@ -64139,10 +79302,10 @@
     return html.MediaKeyEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new MediaKeyEvent(type, eventInitDict);
+    return new self.MediaKeyEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new MediaKeyEvent(type);
+    return new self.MediaKeyEvent(type);
   }
   get [dartx.defaultUrl]() {
     return this.defaultURL;
@@ -64204,10 +79367,10 @@
     return html.MediaKeyMessageEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new MediaKeyMessageEvent(type, eventInitDict);
+    return new self.MediaKeyMessageEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new MediaKeyMessageEvent(type);
+    return new self.MediaKeyMessageEvent(type);
   }
   get [dartx.message]() {
     return this.message;
@@ -64470,10 +79633,10 @@
     return html.MediaQueryListEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new MediaQueryListEvent(type, eventInitDict);
+    return new self.MediaQueryListEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new MediaQueryListEvent(type);
+    return new self.MediaQueryListEvent(type);
   }
   get [dartx.matches]() {
     return this.matches;
@@ -64510,7 +79673,7 @@
     return html.MediaSession._create_1();
   }
   static _create_1() {
-    return new MediaSession();
+    return new self.MediaSession();
   }
   [dartx.activate](...args) {
     return this.activate.apply(this, args);
@@ -64549,7 +79712,7 @@
     return html.MediaSource._create_1();
   }
   static _create_1() {
-    return new MediaSource();
+    return new self.MediaSource();
   }
   static get supported() {
     return !!window.MediaSource;
@@ -64638,13 +79801,13 @@
     dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
   }
   static _create_1() {
-    return new MediaStream();
+    return new self.MediaStream();
   }
   static _create_2(stream_OR_tracks) {
-    return new MediaStream(stream_OR_tracks);
+    return new self.MediaStream(stream_OR_tracks);
   }
   static _create_3(stream_OR_tracks) {
-    return new MediaStream(stream_OR_tracks);
+    return new self.MediaStream(stream_OR_tracks);
   }
   get [dartx.active]() {
     return this.active;
@@ -64762,10 +79925,10 @@
     return html.MediaStreamEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new MediaStreamEvent(type, eventInitDict);
+    return new self.MediaStreamEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new MediaStreamEvent(type);
+    return new self.MediaStreamEvent(type);
   }
   static get supported() {
     return html_common.Device.isEventTypeSupported('MediaStreamEvent');
@@ -64833,7 +79996,7 @@
     let completer = CompleterOfListOfSourceInfo().new();
     html.MediaStreamTrack._getSources(dart.fn(value => {
       completer.complete(value);
-    }, ListOfSourceInfoTovoid()));
+    }, ListOfSourceInfoToNull()));
     return completer.future;
   }
   [dartx.stop](...args) {
@@ -65110,7 +80273,7 @@
       source = html.window;
     }
     if (!dart.test(html_common.Device.isIE)) {
-      return new MessageEvent(type, {bubbles: canBubble, cancelable: cancelable, data: data, origin: origin, lastEventId: lastEventId, source: source, ports: messagePorts});
+      return new self.MessageEvent(type, {bubbles: canBubble, cancelable: cancelable, data: data, origin: origin, lastEventId: lastEventId, source: source, ports: messagePorts});
     }
     let event = html.MessageEvent._check(html.document[_createEvent]("MessageEvent"));
     event[_initMessageEvent](type, canBubble, cancelable, data, origin, lastEventId, source, messagePorts);
@@ -65131,10 +80294,10 @@
     return html.MessageEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new MessageEvent(type, eventInitDict);
+    return new self.MessageEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new MessageEvent(type);
+    return new self.MessageEvent(type);
   }
   get [dartx.lastEventId]() {
     return this.lastEventId;
@@ -65736,17 +80899,11 @@
 html.MimeTypeArray[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfMimeType()];
 dart.setSignature(html.MimeTypeArray, {
   constructors: () => ({_: dart.definiteFunctionType(html.MimeTypeArray, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.MimeType, []),
-    [dartx.last]: dart.definiteFunctionType(html.MimeType, []),
-    [dartx.single]: dart.definiteFunctionType(html.MimeType, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.MimeType, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.MimeType]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.MimeType, [core.int]),
     [dartx.item]: dart.definiteFunctionType(html.MimeType, [core.int]),
     [dartx.namedItem]: dart.definiteFunctionType(html.MimeType, [core.String])
   })
@@ -65855,10 +81012,10 @@
     return html.MouseEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new MouseEvent(type, eventInitDict);
+    return new self.MouseEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new MouseEvent(type);
+    return new self.MouseEvent(type);
   }
   get [dartx.altKey]() {
     return this.altKey;
@@ -66060,7 +81217,7 @@
     function override(key, value) {
       if (value != null) html.MutationObserver._add(parsedOptions, core.String._check(key), value);
     }
-    dart.fn(override, dynamicAnddynamicTodynamic());
+    dart.fn(override, dynamicAnddynamicToNull());
     override('childList', childList);
     override('attributes', attributes);
     override('characterData', characterData);
@@ -66086,7 +81243,7 @@
   }
   static new(callback) {
     0;
-    return new (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver)(_js_helper.convertDartClosureToJS(html._wrapZoneBinaryCallback)(html._wrapBinaryZone(dart.dynamic, dart.dynamic, dart.dynamic)(callback), 2));
+    return new (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver)(_js_helper.convertDartClosureToJS(_wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void())(html._wrapBinaryZone(ListOfMutationRecord(), html.MutationObserver, dart.void)(callback), 2));
   }
 };
 dart.setSignature(html.MutationObserver, {
@@ -66226,9 +81383,9 @@
     this[_ensureGetUserMedia]();
     this[_getUserMedia](html_common.convertDartToNative_SerializedScriptValue(options), dart.fn(stream => {
       completer.complete(stream);
-    }, MediaStreamTovoid()), dart.fn(error => {
+    }, MediaStreamToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, NavigatorUserMediaErrorTovoid()));
+    }, NavigatorUserMediaErrorToNull()));
     return completer.future;
   }
   [_ensureGetUserMedia]() {
@@ -66779,29 +81936,13 @@
   constructors: () => ({new: dart.definiteFunctionType(html._ChildNodeListLazy, [html.Node])}),
   fields: () => ({[_this]: html.Node}),
   getters: () => ({
-    first: dart.definiteFunctionType(html.Node, []),
-    last: dart.definiteFunctionType(html.Node, []),
-    single: dart.definiteFunctionType(html.Node, []),
-    iterator: dart.definiteFunctionType(core.Iterator$(html.Node), []),
     length: dart.definiteFunctionType(core.int, []),
     rawList: dart.definiteFunctionType(core.List$(html.Node), [])
   }),
   setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
-    add: dart.definiteFunctionType(dart.void, [html.Node]),
-    addAll: dart.definiteFunctionType(dart.void, [IterableOfNode()]),
-    insert: dart.definiteFunctionType(dart.void, [core.int, html.Node]),
-    insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfNode()]),
-    setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfNode()]),
-    removeLast: dart.definiteFunctionType(html.Node, []),
-    removeAt: dart.definiteFunctionType(html.Node, [core.int]),
     [_filter]: dart.definiteFunctionType(dart.void, [NodeTobool(), core.bool]),
-    removeWhere: dart.definiteFunctionType(dart.void, [NodeTobool()]),
-    retainWhere: dart.definiteFunctionType(dart.void, [NodeTobool()]),
     _set: dart.definiteFunctionType(dart.void, [core.int, html.Node]),
-    sort: dart.definiteFunctionType(dart.void, [], [ComparatorOfNode()]),
-    setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfNode()], [core.int]),
-    fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html.Node]),
     _get: dart.definiteFunctionType(html.Node, [core.int])
   })
 });
@@ -66978,17 +82119,11 @@
 html.NodeList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
 dart.setSignature(html.NodeList, {
   constructors: () => ({_: dart.definiteFunctionType(html.NodeList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.Node, []),
-    [dartx.last]: dart.definiteFunctionType(html.Node, []),
-    [dartx.single]: dart.definiteFunctionType(html.Node, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.Node, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.Node]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.Node, [core.int]),
     [_item]: dart.definiteFunctionType(html.Node, [core.int])
   })
 });
@@ -67077,10 +82212,10 @@
     return html.Notification._create_2(title);
   }
   static _create_1(title, options) {
-    return new Notification(title, options);
+    return new self.Notification(title, options);
   }
   static _create_2(title) {
-    return new Notification(title);
+    return new self.Notification(title);
   }
   static get supported() {
     return !!window.Notification;
@@ -67122,7 +82257,7 @@
     let completer = CompleterOfString().new();
     html.Notification._requestPermission(dart.fn(value => {
       completer.complete(value);
-    }, StringTovoid()));
+    }, StringToNull()));
     return completer.future;
   }
   get [dartx.onClick]() {
@@ -67209,10 +82344,10 @@
     return html.NotificationEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new NotificationEvent(type, eventInitDict);
+    return new self.NotificationEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new NotificationEvent(type);
+    return new self.NotificationEvent(type);
   }
   get [dartx.notification]() {
     return this.notification;
@@ -67709,10 +82844,10 @@
     return html.PageTransitionEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new PageTransitionEvent(type, eventInitDict);
+    return new self.PageTransitionEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new PageTransitionEvent(type);
+    return new self.PageTransitionEvent(type);
   }
   get [dartx.persisted]() {
     return this.persisted;
@@ -67827,13 +82962,13 @@
     return html.PasswordCredential._create_3(id, password);
   }
   static _create_1(id, password, name, iconURL) {
-    return new PasswordCredential(id, password, name, iconURL);
+    return new self.PasswordCredential(id, password, name, iconURL);
   }
   static _create_2(id, password, name) {
-    return new PasswordCredential(id, password, name);
+    return new self.PasswordCredential(id, password, name);
   }
   static _create_3(id, password) {
-    return new PasswordCredential(id, password);
+    return new self.PasswordCredential(id, password);
   }
   get [dartx.formData]() {
     return this.formData;
@@ -68383,7 +83518,7 @@
     return html.PeriodicSyncEvent._create_1(type, init_1);
   }
   static _create_1(type, init) {
-    return new PeriodicSyncEvent(type, init);
+    return new self.PeriodicSyncEvent(type, init);
   }
   get [dartx.registration]() {
     return this.registration;
@@ -68669,17 +83804,11 @@
 html.PluginArray[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfPlugin()];
 dart.setSignature(html.PluginArray, {
   constructors: () => ({_: dart.definiteFunctionType(html.PluginArray, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.Plugin, []),
-    [dartx.last]: dart.definiteFunctionType(html.Plugin, []),
-    [dartx.single]: dart.definiteFunctionType(html.Plugin, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.Plugin, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.Plugin]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.Plugin, [core.int]),
     [dartx.item]: dart.definiteFunctionType(html.Plugin, [core.int]),
     [dartx.namedItem]: dart.definiteFunctionType(html.Plugin, [core.String]),
     [dartx.refresh]: dart.definiteFunctionType(dart.void, [core.bool])
@@ -68752,10 +83881,10 @@
     return html.PointerEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new PointerEvent(type, eventInitDict);
+    return new self.PointerEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new PointerEvent(type);
+    return new self.PointerEvent(type);
   }
   get [dartx.height]() {
     return this.height;
@@ -68820,10 +83949,10 @@
     return html.PopStateEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new PopStateEvent(type, eventInitDict);
+    return new self.PopStateEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new PopStateEvent(type);
+    return new self.PopStateEvent(type);
   }
   get [dartx.state]() {
     return html_common.convertNativeToDart_SerializedScriptValue(this[_get_state]);
@@ -69140,10 +84269,10 @@
     return html.ProgressEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new ProgressEvent(type, eventInitDict);
+    return new self.ProgressEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new ProgressEvent(type);
+    return new self.ProgressEvent(type);
   }
   get [dartx.lengthComputable]() {
     return this.lengthComputable;
@@ -69189,10 +84318,10 @@
     return html.PromiseRejectionEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new PromiseRejectionEvent(type, eventInitDict);
+    return new self.PromiseRejectionEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new PromiseRejectionEvent(type);
+    return new self.PromiseRejectionEvent(type);
   }
   get [dartx.promise]() {
     return this.promise;
@@ -69233,10 +84362,10 @@
     return html.PushEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new PushEvent(type, eventInitDict);
+    return new self.PushEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new PushEvent(type);
+    return new self.PushEvent(type);
   }
   get [dartx.data]() {
     return this.data;
@@ -69327,7 +84456,7 @@
     return html.PushMessageData._create_1(message);
   }
   static _create_1(message) {
-    return new PushMessageData(message);
+    return new self.PushMessageData(message);
   }
   [dartx.arrayBuffer](...args) {
     return this.arrayBuffer.apply(this, args);
@@ -69724,10 +84853,10 @@
     return html.RelatedEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new RelatedEvent(type, eventInitDict);
+    return new self.RelatedEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new RelatedEvent(type);
+    return new self.RelatedEvent(type);
   }
   get [dartx.relatedTarget]() {
     return html._convertNativeToDart_EventTarget(this[_get_relatedTarget]);
@@ -70143,9 +85272,9 @@
     let completer = CompleterOfRtcSessionDescription().new();
     this[_createOffer](dart.fn(value => {
       completer.complete(value);
-    }, RtcSessionDescriptionTovoid()), dart.fn(error => {
+    }, RtcSessionDescriptionToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, StringTovoid()), mediaConstraints);
+    }, StringToNull()), mediaConstraints);
     return completer.future;
   }
   [dartx.createAnswer](mediaConstraints) {
@@ -70153,16 +85282,16 @@
     let completer = CompleterOfRtcSessionDescription().new();
     this[_createAnswer](dart.fn(value => {
       completer.complete(value);
-    }, RtcSessionDescriptionTovoid()), dart.fn(error => {
+    }, RtcSessionDescriptionToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, StringTovoid()), mediaConstraints);
+    }, StringToNull()), mediaConstraints);
     return completer.future;
   }
   [dartx.getStats](selector) {
     let completer = CompleterOfRtcStatsResponse().new();
     this[_getStats](dart.fn(value => {
       completer.complete(value);
-    }, RtcStatsResponseTovoid()), selector);
+    }, RtcStatsResponseToNull()), selector);
     return completer.future;
   }
   static _() {
@@ -70278,9 +85407,9 @@
     let completer = async.Completer.new();
     this[_setLocalDescription](description, dart.fn(() => {
       completer.complete();
-    }, VoidTovoid()), dart.fn(error => {
+    }, VoidToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, StringTovoid()));
+    }, StringToNull()));
     return completer.future;
   }
   [_setRemoteDescription](...args) {
@@ -70290,9 +85419,9 @@
     let completer = async.Completer.new();
     this[_setRemoteDescription](description, dart.fn(() => {
       completer.complete();
-    }, VoidTovoid()), dart.fn(error => {
+    }, VoidToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, StringTovoid()));
+    }, StringToNull()));
     return completer.future;
   }
   [dartx.updateIce](configuration, mediaConstraints) {
@@ -70796,31 +85925,31 @@
     return html.ScrollState._create_9();
   }
   static _create_1(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding) {
-    return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding);
+    return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding);
   }
   static _create_2(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning) {
-    return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning);
+    return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning);
   }
   static _create_3(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase) {
-    return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase);
+    return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase);
   }
   static _create_4(deltaX, deltaY, deltaGranularity, velocityX, velocityY) {
-    return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY);
+    return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY);
   }
   static _create_5(deltaX, deltaY, deltaGranularity, velocityX) {
-    return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX);
+    return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX);
   }
   static _create_6(deltaX, deltaY, deltaGranularity) {
-    return new ScrollState(deltaX, deltaY, deltaGranularity);
+    return new self.ScrollState(deltaX, deltaY, deltaGranularity);
   }
   static _create_7(deltaX, deltaY) {
-    return new ScrollState(deltaX, deltaY);
+    return new self.ScrollState(deltaX, deltaY);
   }
   static _create_8(deltaX) {
-    return new ScrollState(deltaX);
+    return new self.ScrollState(deltaX);
   }
   static _create_9() {
-    return new ScrollState();
+    return new self.ScrollState();
   }
   get [dartx.deltaGranularity]() {
     return this.deltaGranularity;
@@ -70913,10 +86042,10 @@
     return html.SecurityPolicyViolationEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new SecurityPolicyViolationEvent(type, eventInitDict);
+    return new self.SecurityPolicyViolationEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new SecurityPolicyViolationEvent(type);
+    return new self.SecurityPolicyViolationEvent(type);
   }
   get [dartx.blockedUri]() {
     return this.blockedURI;
@@ -71454,10 +86583,10 @@
     return html.ServicePortConnectEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new ServicePortConnectEvent(type, eventInitDict);
+    return new self.ServicePortConnectEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new ServicePortConnectEvent(type);
+    return new self.ServicePortConnectEvent(type);
   }
   get [dartx.origin]() {
     return this.origin;
@@ -71620,10 +86749,10 @@
     return html.ServiceWorkerMessageEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new ServiceWorkerMessageEvent(type, eventInitDict);
+    return new self.ServiceWorkerMessageEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new ServiceWorkerMessageEvent(type);
+    return new self.ServiceWorkerMessageEvent(type);
   }
   get [dartx.lastEventId]() {
     return this.lastEventId;
@@ -71935,10 +87064,10 @@
     return html.SharedWorker._create_2(scriptURL);
   }
   static _create_1(scriptURL, name) {
-    return new SharedWorker(scriptURL, name);
+    return new self.SharedWorker(scriptURL, name);
   }
   static _create_2(scriptURL) {
-    return new SharedWorker(scriptURL);
+    return new self.SharedWorker(scriptURL);
   }
   get [dartx.port]() {
     return this.port;
@@ -72151,17 +87280,11 @@
 html.SourceBufferList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfSourceBuffer()];
 dart.setSignature(html.SourceBufferList, {
   constructors: () => ({_: dart.definiteFunctionType(html.SourceBufferList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.SourceBuffer, []),
-    [dartx.last]: dart.definiteFunctionType(html.SourceBuffer, []),
-    [dartx.single]: dart.definiteFunctionType(html.SourceBuffer, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.SourceBuffer, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.SourceBuffer]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.SourceBuffer, [core.int]),
     [dartx.item]: dart.definiteFunctionType(html.SourceBuffer, [core.int])
   })
 });
@@ -72300,7 +87423,7 @@
     return html.SpeechGrammar._create_1();
   }
   static _create_1() {
-    return new SpeechGrammar();
+    return new self.SpeechGrammar();
   }
   get [dartx.src]() {
     return this.src;
@@ -72349,7 +87472,7 @@
     return html.SpeechGrammarList._create_1();
   }
   static _create_1() {
-    return new SpeechGrammarList();
+    return new self.SpeechGrammarList();
   }
   get [dartx.length]() {
     return this.length;
@@ -72405,17 +87528,11 @@
     _: dart.definiteFunctionType(html.SpeechGrammarList, []),
     new: dart.definiteFunctionType(html.SpeechGrammarList, [])
   }),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.SpeechGrammar, []),
-    [dartx.last]: dart.definiteFunctionType(html.SpeechGrammar, []),
-    [dartx.single]: dart.definiteFunctionType(html.SpeechGrammar, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.SpeechGrammar, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.SpeechGrammar]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.SpeechGrammar, [core.int]),
     [dartx.addFromString]: dart.definiteFunctionType(dart.void, [core.String], [core.num]),
     [dartx.addFromUri]: dart.definiteFunctionType(dart.void, [core.String], [core.num]),
     [dartx.item]: dart.definiteFunctionType(html.SpeechGrammar, [core.int])
@@ -72665,10 +87782,10 @@
     return html.SpeechRecognitionError._create_2(type);
   }
   static _create_1(type, initDict) {
-    return new SpeechRecognitionError(type, initDict);
+    return new self.SpeechRecognitionError(type, initDict);
   }
   static _create_2(type) {
-    return new SpeechRecognitionError(type);
+    return new self.SpeechRecognitionError(type);
   }
   get [dartx.error]() {
     return this.error;
@@ -72712,10 +87829,10 @@
     return html.SpeechRecognitionEvent._create_2(type);
   }
   static _create_1(type, initDict) {
-    return new SpeechRecognitionEvent(type, initDict);
+    return new self.SpeechRecognitionEvent(type, initDict);
   }
   static _create_2(type) {
-    return new SpeechRecognitionEvent(type);
+    return new self.SpeechRecognitionEvent(type);
   }
   get [dartx.emma]() {
     return this.emma;
@@ -72891,10 +88008,10 @@
     return html.SpeechSynthesisUtterance._create_2();
   }
   static _create_1(text) {
-    return new SpeechSynthesisUtterance(text);
+    return new self.SpeechSynthesisUtterance(text);
   }
   static _create_2() {
-    return new SpeechSynthesisUtterance();
+    return new self.SpeechSynthesisUtterance();
   }
   get [dartx.lang]() {
     return this.lang;
@@ -73122,7 +88239,7 @@
   [dartx.addAll](other) {
     other[dartx.forEach](dart.fn((k, v) => {
       this[dartx._set](k, v);
-    }, StringAndStringTovoid()));
+    }, StringAndStringToNull()));
   }
   [dartx.containsValue](value) {
     return this[dartx.values][dartx.any](dart.fn(e => dart.equals(e, value), StringTobool()));
@@ -73269,10 +88386,10 @@
     return html.StorageEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new StorageEvent(type, eventInitDict);
+    return new self.StorageEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new StorageEvent(type);
+    return new self.StorageEvent(type);
   }
   get [dartx.key]() {
     return this.key;
@@ -73457,7 +88574,7 @@
     return html.SyncEvent._create_1(type, init_1);
   }
   static _create_1(type, init) {
-    return new SyncEvent(type, init);
+    return new self.SyncEvent(type, init);
   }
   get [dartx.registration]() {
     return this.registration;
@@ -74613,17 +89730,11 @@
 html.TextTrackCueList[dart.implements] = () => [ListOfTextTrackCue(), _js_helper.JavaScriptIndexingBehavior];
 dart.setSignature(html.TextTrackCueList, {
   constructors: () => ({_: dart.definiteFunctionType(html.TextTrackCueList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.TextTrackCue, []),
-    [dartx.last]: dart.definiteFunctionType(html.TextTrackCue, []),
-    [dartx.single]: dart.definiteFunctionType(html.TextTrackCue, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.TextTrackCue, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.TextTrackCue]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.TextTrackCue, [core.int]),
     [dartx.getCueById]: dart.definiteFunctionType(html.TextTrackCue, [core.String]),
     [dartx.item]: dart.definiteFunctionType(html.TextTrackCue, [core.int])
   })
@@ -74703,9 +89814,6 @@
   constructors: () => ({_: dart.definiteFunctionType(html.TextTrackList, [])}),
   getters: () => ({
     [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.TextTrack, []),
-    [dartx.last]: dart.definiteFunctionType(html.TextTrack, []),
-    [dartx.single]: dart.definiteFunctionType(html.TextTrack, []),
     [dartx.onAddTrack]: dart.definiteFunctionType(async.Stream$(html.TrackEvent), []),
     [dartx.onChange]: dart.definiteFunctionType(async.Stream$(html.Event), [])
   }),
@@ -74713,7 +89821,6 @@
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.TextTrack, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.TextTrack]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.TextTrack, [core.int]),
     [dartx.getTrackById]: dart.definiteFunctionType(html.TextTrack, [core.String]),
     [dartx.item]: dart.definiteFunctionType(html.TextTrack, [core.int])
   }),
@@ -75064,17 +90171,11 @@
     new: dart.definiteFunctionType(html.TouchList, []),
     _: dart.definiteFunctionType(html.TouchList, [])
   }),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.Touch, []),
-    [dartx.last]: dart.definiteFunctionType(html.Touch, []),
-    [dartx.single]: dart.definiteFunctionType(html.Touch, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.Touch, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.Touch]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.Touch, [core.int]),
     [dartx.item]: dart.definiteFunctionType(html.Touch, [core.int])
   }),
   sgetters: () => ({supported: dart.definiteFunctionType(core.bool, [])})
@@ -75101,10 +90202,10 @@
     return html.TrackDefault._create_2(type, language, label, kinds_1);
   }
   static _create_1(type, language, label, kinds, byteStreamTrackID) {
-    return new TrackDefault(type, language, label, kinds, byteStreamTrackID);
+    return new self.TrackDefault(type, language, label, kinds, byteStreamTrackID);
   }
   static _create_2(type, language, label, kinds) {
-    return new TrackDefault(type, language, label, kinds);
+    return new self.TrackDefault(type, language, label, kinds);
   }
   get [dartx.byteStreamTrackID]() {
     return this.byteStreamTrackID;
@@ -75157,10 +90258,10 @@
     return html.TrackDefaultList._create_2();
   }
   static _create_1(trackDefaults) {
-    return new TrackDefaultList(trackDefaults);
+    return new self.TrackDefaultList(trackDefaults);
   }
   static _create_2() {
-    return new TrackDefaultList();
+    return new self.TrackDefaultList();
   }
   get [dartx.length]() {
     return this.length;
@@ -75294,10 +90395,10 @@
     return html.TrackEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new TrackEvent(type, eventInitDict);
+    return new self.TrackEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new TrackEvent(type);
+    return new self.TrackEvent(type);
   }
   get [dartx.track]() {
     return this.track;
@@ -75334,10 +90435,10 @@
     return html.TransitionEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new TransitionEvent(type, eventInitDict);
+    return new self.TransitionEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new TransitionEvent(type);
+    return new self.TransitionEvent(type);
   }
   get [dartx.elapsedTime]() {
     return this.elapsedTime;
@@ -75908,10 +91009,10 @@
     return html.VRFieldOfView._create_2();
   }
   static _create_1(fov) {
-    return new VRFieldOfView(fov);
+    return new self.VRFieldOfView(fov);
   }
   static _create_2() {
-    return new VRFieldOfView();
+    return new self.VRFieldOfView();
   }
   get [dartx.downDegrees]() {
     return this.downDegrees;
@@ -76529,10 +91630,10 @@
     return html.WebSocket._create_2(url);
   }
   static _create_1(url, protocols) {
-    return new WebSocket(url, protocols);
+    return new self.WebSocket(url, protocols);
   }
   static _create_2(url) {
-    return new WebSocket(url);
+    return new self.WebSocket(url);
   }
   static get supported() {
     return typeof window.WebSocket != "undefined";
@@ -76690,7 +91791,7 @@
     if (view == null) {
       view = html.window;
     }
-    return new WheelEvent(type, html_common.convertDartToNative_Dictionary(options));
+    return new self.WheelEvent(type, html_common.convertDartToNative_Dictionary(options));
   }
   static _(type, eventInitDict) {
     if (eventInitDict === void 0) eventInitDict = null;
@@ -76701,10 +91802,10 @@
     return html.WheelEvent._create_2(type);
   }
   static _create_1(type, eventInitDict) {
-    return new WheelEvent(type, eventInitDict);
+    return new self.WheelEvent(type, eventInitDict);
   }
   static _create_2(type) {
-    return new WheelEvent(type);
+    return new self.WheelEvent(type);
   }
   get [_deltaX]() {
     return this.deltaX;
@@ -76974,7 +92075,7 @@
     let completer = CompleterOfnum().sync();
     this[dartx.requestAnimationFrame](dart.fn(time => {
       completer.complete(time);
-    }, numTovoid()));
+    }, numToNull()));
     return completer.future;
   }
   get [dartx.document]() {
@@ -77429,9 +92530,9 @@
     let completer = CompleterOfFileSystem().new();
     this[__requestFileSystem](type, size, dart.fn(value => {
       completer.complete(value);
-    }, FileSystemTovoid()), dart.fn(error => {
+    }, FileSystemToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
   [_resolveLocalFileSystemUrl](...args) {
@@ -77441,9 +92542,9 @@
     let completer = CompleterOfEntry().new();
     this[_resolveLocalFileSystemUrl](url, dart.fn(value => {
       completer.complete(value);
-    }, EntryTovoid()), dart.fn(error => {
+    }, EntryToNull()), dart.fn(error => {
       completer.completeError(error);
-    }, FileErrorTovoid()));
+    }, FileErrorToNull()));
     return completer.future;
   }
   [dartx.atob](...args) {
@@ -78128,12 +93229,12 @@
   }
   forTarget(e, opts) {
     let useCapture = opts && 'useCapture' in opts ? opts.useCapture : false;
-    let stream = new (_EventStreamOfEvent())(e, this[_eventType], useCapture);
+    let stream = new (_EventStreamOfBeforeUnloadEvent())(e, this[_eventType], useCapture);
     let controller = StreamControllerOfBeforeUnloadEvent().new({sync: true});
     stream.listen(dart.fn(event => {
       let wrapped = new html._BeforeUnloadEvent(event);
       controller.add(wrapped);
-    }, EventTovoid()));
+    }, BeforeUnloadEventToNull()));
     return controller.stream;
   }
   getEventType(target) {
@@ -78297,7 +93398,7 @@
     return html.Worker._create_1(scriptUrl);
   }
   static _create_1(scriptUrl) {
-    return new Worker(scriptUrl);
+    return new self.Worker(scriptUrl);
   }
   static get supported() {
     return typeof window.Worker != "undefined";
@@ -78452,7 +93553,7 @@
     return html.XPathEvaluator._create_1();
   }
   static _create_1() {
-    return new XPathEvaluator();
+    return new self.XPathEvaluator();
   }
   [dartx.createExpression](...args) {
     return this.createExpression.apply(this, args);
@@ -78948,17 +94049,11 @@
 html._ClientRectList[dart.implements] = () => [ListOfRectangleOfnum()];
 dart.setSignature(html._ClientRectList, {
   constructors: () => ({_: dart.definiteFunctionType(html._ClientRectList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(math.Rectangle$(core.num), []),
-    [dartx.last]: dart.definiteFunctionType(math.Rectangle$(core.num), []),
-    [dartx.single]: dart.definiteFunctionType(math.Rectangle$(core.num), [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, RectangleOfnum()]),
-    [dartx.elementAt]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
     [__getter__]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
     [dartx.item]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int])
   })
@@ -79025,17 +94120,11 @@
 html._CssRuleList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfCssRule()];
 dart.setSignature(html._CssRuleList, {
   constructors: () => ({_: dart.definiteFunctionType(html._CssRuleList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.CssRule, []),
-    [dartx.last]: dart.definiteFunctionType(html.CssRule, []),
-    [dartx.single]: dart.definiteFunctionType(html.CssRule, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.CssRule, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.CssRule]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.CssRule, [core.int]),
     [dartx.item]: dart.definiteFunctionType(html.CssRule, [core.int])
   })
 });
@@ -79278,17 +94367,11 @@
 html._GamepadList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfGamepad()];
 dart.setSignature(html._GamepadList, {
   constructors: () => ({_: dart.definiteFunctionType(html._GamepadList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.Gamepad, []),
-    [dartx.last]: dart.definiteFunctionType(html.Gamepad, []),
-    [dartx.single]: dart.definiteFunctionType(html.Gamepad, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.Gamepad, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.Gamepad]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.Gamepad, [core.int]),
     [dartx.item]: dart.definiteFunctionType(html.Gamepad, [core.int])
   })
 });
@@ -79487,17 +94570,11 @@
 html._NamedNodeMap[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
 dart.setSignature(html._NamedNodeMap, {
   constructors: () => ({_: dart.definiteFunctionType(html._NamedNodeMap, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.Node, []),
-    [dartx.last]: dart.definiteFunctionType(html.Node, []),
-    [dartx.single]: dart.definiteFunctionType(html.Node, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.Node, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.Node]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.Node, [core.int]),
     [dartx.getNamedItem]: dart.definiteFunctionType(html._Attr, [core.String]),
     [dartx.getNamedItemNS]: dart.definiteFunctionType(html._Attr, [core.String, core.String]),
     [dartx.item]: dart.definiteFunctionType(html._Attr, [core.int]),
@@ -79697,17 +94774,11 @@
 html._SpeechRecognitionResultList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfSpeechRecognitionResult()];
 dart.setSignature(html._SpeechRecognitionResultList, {
   constructors: () => ({_: dart.definiteFunctionType(html._SpeechRecognitionResultList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.SpeechRecognitionResult, []),
-    [dartx.last]: dart.definiteFunctionType(html.SpeechRecognitionResult, []),
-    [dartx.single]: dart.definiteFunctionType(html.SpeechRecognitionResult, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.SpeechRecognitionResult, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.SpeechRecognitionResult]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.SpeechRecognitionResult, [core.int]),
     [dartx.item]: dart.definiteFunctionType(html.SpeechRecognitionResult, [core.int])
   })
 });
@@ -79775,17 +94846,11 @@
 html._StyleSheetList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfStyleSheet()];
 dart.setSignature(html._StyleSheetList, {
   constructors: () => ({_: dart.definiteFunctionType(html._StyleSheetList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(html.StyleSheet, []),
-    [dartx.last]: dart.definiteFunctionType(html.StyleSheet, []),
-    [dartx.single]: dart.definiteFunctionType(html.StyleSheet, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(html.StyleSheet, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html.StyleSheet]),
-    [dartx.elementAt]: dart.definiteFunctionType(html.StyleSheet, [core.int]),
     [__getter__]: dart.definiteFunctionType(html.CssStyleSheet, [core.String]),
     [dartx.item]: dart.definiteFunctionType(html.StyleSheet, [core.int])
   })
@@ -79875,7 +94940,7 @@
   addAll(other) {
     other[dartx.forEach](dart.fn((k, v) => {
       this._set(k, v);
-    }, StringAndStringTovoid()));
+    }, StringAndStringToNull()));
   }
   containsValue(value) {
     for (let v of this.values) {
@@ -80062,7 +95127,7 @@
   addAll(other) {
     other[dartx.forEach](dart.fn((k, v) => {
       this._set(k, v);
-    }, StringAndStringTovoid()));
+    }, StringAndStringToNull()));
   }
   containsValue(value) {
     return this.values[dartx.any](dart.fn(v => dart.equals(v, value), StringTobool()));
@@ -80093,7 +95158,7 @@
       if (dart.test(this[_matches](key))) {
         f(this[_strip](key), value);
       }
-    }, StringAndStringTovoid()));
+    }, StringAndStringToNull()));
   }
   get keys() {
     let keys = JSArrayOfString().of([]);
@@ -80101,7 +95166,7 @@
       if (dart.test(this[_matches](key))) {
         keys[dartx.add](this[_strip](key));
       }
-    }, StringAndStringTovoid()));
+    }, StringAndStringToNull()));
     return keys;
   }
   get values() {
@@ -80110,7 +95175,7 @@
       if (dart.test(this[_matches](key))) {
         values[dartx.add](value);
       }
-    }, StringAndStringTovoid()));
+    }, StringAndStringToNull()));
     return values;
   }
   get length() {
@@ -81167,10 +96232,7 @@
       [_eventType]: core.String,
       [_useCapture]: core.bool
     }),
-    methods: () => ({
-      asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
-      listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})
-    })
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
   });
   return _EventStream;
 });
@@ -81271,8 +96333,7 @@
     methods: () => ({
       matches: dart.definiteFunctionType(async.Stream$(T), [core.String]),
       listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
-      capture: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()]),
-      asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()})
+      capture: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()])
     })
   });
   return _ElementListEventStreamImpl;
@@ -81295,7 +96356,7 @@
       this[_target] = target;
       this[_eventType] = eventType;
       this[_useCapture] = useCapture;
-      this[_onData] = html._wrapZone(html.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(onData));
+      this[_onData] = onData == null ? null : html._wrapZone(html.Event, dart.dynamic)(dart.fn(e => dart.dcall(onData, e), EventTodynamic()));
       this[_pauseCount] = 0;
       this[_tryResume]();
     }
@@ -81346,10 +96407,12 @@
         this[_target][dartx.removeEventListener](this[_eventType], this[_onData], this[_useCapture]);
       }
     }
-    asFuture(futureValue) {
-      if (futureValue === void 0) futureValue = null;
-      let completer = async.Completer.new();
-      return completer.future;
+    asFuture(E) {
+      return futureValue => {
+        if (futureValue === void 0) futureValue = null;
+        let completer = async.Completer$(E).new();
+        return completer.future;
+      };
     }
   }
   dart.setSignature(_EventStreamSubscription, {
@@ -81374,7 +96437,7 @@
       resume: dart.definiteFunctionType(dart.void, []),
       [_tryResume]: dart.definiteFunctionType(dart.void, []),
       [_unlisten]: dart.definiteFunctionType(dart.void, []),
-      asFuture: dart.definiteFunctionType(async.Future, [], [dart.dynamic])
+      asFuture: dart.definiteFunctionType(E => [async.Future$(E), [], [E]])
     })
   });
   return _EventStreamSubscription;
@@ -81432,7 +96495,6 @@
     }),
     methods: () => ({
       listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
-      asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
       add: dart.definiteFunctionType(dart.void, [T])
     })
   });
@@ -81710,8 +96772,7 @@
 dart.addSimpleTypeTests(html._CustomKeyEventStreamImpl);
 html._CustomKeyEventStreamImpl[dart.implements] = () => [CustomStreamOfKeyEvent()];
 dart.setSignature(html._CustomKeyEventStreamImpl, {
-  constructors: () => ({new: dart.definiteFunctionType(html._CustomKeyEventStreamImpl, [core.String])}),
-  methods: () => ({add: dart.definiteFunctionType(dart.void, [html.KeyEvent])})
+  constructors: () => ({new: dart.definiteFunctionType(html._CustomKeyEventStreamImpl, [core.String])})
 });
 const _subscriptions = Symbol('_subscriptions');
 const _controller = Symbol('_controller');
@@ -83300,21 +98361,13 @@
     constructors: () => ({new: dart.definiteFunctionType(html._WrappedList$(E), [ListOfNode()])}),
     fields: () => ({[_list]: ListOfNode()}),
     getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(E), []),
       length: dart.definiteFunctionType(core.int, []),
       rawList: dart.definiteFunctionType(core.List$(html.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
-      add: dart.definiteFunctionType(dart.void, [E]),
       _get: dart.definiteFunctionType(E, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, E]),
-      sort: dart.definiteFunctionType(dart.void, [], [EAndEToint()]),
-      insert: dart.definiteFunctionType(dart.void, [core.int, E]),
-      removeAt: dart.definiteFunctionType(E, [core.int]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()], [core.int]),
-      replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [E])
+      _set: dart.definiteFunctionType(dart.void, [core.int, E])
     })
   });
   dart.defineExtensionMembers(_WrappedList, [
@@ -83379,7 +98432,7 @@
       if (request[dartx.readyState] == html.HttpRequest.DONE) {
         onComplete(request);
       }
-    }, ProgressEventTovoid()));
+    }, ProgressEventToNull()));
     request[dartx.send]();
     return request;
   }
@@ -84125,7 +99178,7 @@
       this.writeSlot(slot, copy);
       e[dartx.forEach](dart.fn((key, value) => {
         this.putIntoMap(copy, key, this.walk(value));
-      }, dynamicAnddynamicTovoid()));
+      }, dynamicAnddynamicToNull()));
       return copy;
     }
     if (core.List.is(e)) {
@@ -84334,7 +99387,7 @@
   }
   dict[dartx.forEach](dart.fn((key, value) => {
     object[key] = value;
-  }, StringAnddynamicTovoid()));
+  }, StringAnddynamicToNull()));
   return object;
 };
 dart.fn(html_common.convertDartToNative_Dictionary, Map__Todynamic());
@@ -84667,25 +99720,12 @@
   getters: () => ({
     [_iterable]: dart.definiteFunctionType(core.Iterable$(html.Element), []),
     [_filtered]: dart.definiteFunctionType(core.List$(html.Element), []),
-    reversed: dart.definiteFunctionType(core.Iterable$(html.Element), []),
     length: dart.definiteFunctionType(core.int, []),
-    iterator: dart.definiteFunctionType(core.Iterator$(html.Element), []),
     rawList: dart.definiteFunctionType(core.List$(html.Node), [])
   }),
   setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
-    forEach: dart.definiteFunctionType(dart.void, [ElementTovoid()]),
     _set: dart.definiteFunctionType(dart.void, [core.int, html.Element]),
-    add: dart.definiteFunctionType(dart.void, [html.Element]),
-    addAll: dart.definiteFunctionType(dart.void, [IterableOfElement()]),
-    sort: dart.definiteFunctionType(dart.void, [], [ElementAndElementToint()]),
-    setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()], [core.int]),
-    fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html.Element]),
-    replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()]),
-    removeLast: dart.definiteFunctionType(html.Element, []),
-    insert: dart.definiteFunctionType(dart.void, [core.int, html.Element]),
-    insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfElement()]),
-    removeAt: dart.definiteFunctionType(html.Element, [core.int]),
     _get: dart.definiteFunctionType(html.Element, [core.int])
   })
 });
@@ -88356,17 +103396,11 @@
 dart.setSignature(svg.LengthList, {
   constructors: () => ({_: dart.definiteFunctionType(svg.LengthList, [])}),
   fields: () => ({[dartx.numberOfItems]: core.int}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(svg.Length, []),
-    [dartx.last]: dart.definiteFunctionType(svg.Length, []),
-    [dartx.single]: dart.definiteFunctionType(svg.Length, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(svg.Length, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg.Length]),
-    [dartx.elementAt]: dart.definiteFunctionType(svg.Length, [core.int]),
     [__setter__]: dart.definiteFunctionType(dart.void, [core.int, svg.Length]),
     [dartx.appendItem]: dart.definiteFunctionType(svg.Length, [svg.Length]),
     [dartx.getItem]: dart.definiteFunctionType(svg.Length, [core.int]),
@@ -88962,17 +103996,11 @@
 dart.setSignature(svg.NumberList, {
   constructors: () => ({_: dart.definiteFunctionType(svg.NumberList, [])}),
   fields: () => ({[dartx.numberOfItems]: core.int}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(svg.Number, []),
-    [dartx.last]: dart.definiteFunctionType(svg.Number, []),
-    [dartx.single]: dart.definiteFunctionType(svg.Number, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(svg.Number, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg.Number]),
-    [dartx.elementAt]: dart.definiteFunctionType(svg.Number, [core.int]),
     [__setter__]: dart.definiteFunctionType(dart.void, [core.int, svg.Number]),
     [dartx.appendItem]: dart.definiteFunctionType(svg.Number, [svg.Number]),
     [dartx.getItem]: dart.definiteFunctionType(svg.Number, [core.int]),
@@ -89947,17 +104975,11 @@
 dart.setSignature(svg.PathSegList, {
   constructors: () => ({_: dart.definiteFunctionType(svg.PathSegList, [])}),
   fields: () => ({[dartx.numberOfItems]: core.int}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(svg.PathSeg, []),
-    [dartx.last]: dart.definiteFunctionType(svg.PathSeg, []),
-    [dartx.single]: dart.definiteFunctionType(svg.PathSeg, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(svg.PathSeg, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg.PathSeg]),
-    [dartx.elementAt]: dart.definiteFunctionType(svg.PathSeg, [core.int]),
     [__setter__]: dart.definiteFunctionType(dart.void, [core.int, svg.PathSeg]),
     [dartx.appendItem]: dart.definiteFunctionType(svg.PathSeg, [svg.PathSeg]),
     [dartx.getItem]: dart.definiteFunctionType(svg.PathSeg, [core.int]),
@@ -90712,17 +105734,11 @@
 dart.setSignature(svg.StringList, {
   constructors: () => ({_: dart.definiteFunctionType(svg.StringList, [])}),
   fields: () => ({[dartx.numberOfItems]: core.int}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(core.String, []),
-    [dartx.last]: dart.definiteFunctionType(core.String, []),
-    [dartx.single]: dart.definiteFunctionType(core.String, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(core.String, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
-    [dartx.elementAt]: dart.definiteFunctionType(core.String, [core.int]),
     [__setter__]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
     [dartx.appendItem]: dart.definiteFunctionType(core.String, [core.String]),
     [dartx.getItem]: dart.definiteFunctionType(core.String, [core.int]),
@@ -91596,17 +106612,11 @@
 dart.setSignature(svg.TransformList, {
   constructors: () => ({_: dart.definiteFunctionType(svg.TransformList, [])}),
   fields: () => ({[dartx.numberOfItems]: core.int}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(svg.Transform, []),
-    [dartx.last]: dart.definiteFunctionType(svg.Transform, []),
-    [dartx.single]: dart.definiteFunctionType(svg.Transform, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(svg.Transform, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg.Transform]),
-    [dartx.elementAt]: dart.definiteFunctionType(svg.Transform, [core.int]),
     [__setter__]: dart.definiteFunctionType(dart.void, [core.int, svg.Transform]),
     [dartx.appendItem]: dart.definiteFunctionType(svg.Transform, [svg.Transform]),
     [dartx.consolidate]: dart.definiteFunctionType(svg.Transform, []),
@@ -92373,13 +107383,13 @@
     let completer = CompleterOfAudioBuffer().new();
     this[_decodeAudioData](audioData, dart.fn(value => {
       completer.complete(value);
-    }, AudioBufferTovoid()), dart.fn(error => {
+    }, AudioBufferToNull()), dart.fn(error => {
       if (error == null) {
         completer.completeError('');
       } else {
         completer.completeError(error);
       }
-    }, AudioBufferTovoid()));
+    }, AudioBufferToNull()));
     return completer.future;
   }
 };
@@ -92815,7 +107825,7 @@
     return web_audio.OfflineAudioContext._create_1(numberOfChannels, numberOfFrames, sampleRate);
   }
   static _create_1(numberOfChannels, numberOfFrames, sampleRate) {
-    return new OfflineAudioContext(numberOfChannels, numberOfFrames, sampleRate);
+    return new self.OfflineAudioContext(numberOfChannels, numberOfFrames, sampleRate);
   }
 };
 dart.setSignature(web_audio.OfflineAudioContext, {
@@ -95643,17 +110653,11 @@
 web_sql.SqlResultSetRowList[dart.implements] = () => [ListOfMap()];
 dart.setSignature(web_sql.SqlResultSetRowList, {
   constructors: () => ({_: dart.definiteFunctionType(web_sql.SqlResultSetRowList, [])}),
-  getters: () => ({
-    [dartx.length]: dart.definiteFunctionType(core.int, []),
-    [dartx.first]: dart.definiteFunctionType(core.Map, []),
-    [dartx.last]: dart.definiteFunctionType(core.Map, []),
-    [dartx.single]: dart.definiteFunctionType(core.Map, [])
-  }),
+  getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
   setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
   methods: () => ({
     [dartx._get]: dart.definiteFunctionType(core.Map, [core.int]),
     [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.Map]),
-    [dartx.elementAt]: dart.definiteFunctionType(core.Map, [core.int]),
     [dartx.item]: dart.definiteFunctionType(core.Map, [core.int]),
     [_item_1]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
   })
diff --git a/pkg/dev_compiler/lib/js/legacy/dart_library.js b/pkg/dev_compiler/lib/js/legacy/dart_library.js
index d8dfd96..e940863 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_library.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_library.js
@@ -4,8 +4,9 @@
 
 /* This file defines the module loader for the dart runtime.
 */
-
-var dart_library =
+var dart_library;
+if (!dart_library) {
+dart_library =
   typeof module != "undefined" && module.exports || {};
 
 (function (dart_library) {
@@ -93,7 +94,12 @@
   };
 
   function library(name, defaultValue, imports, loader) {
-    let result = new LibraryLoader(name, defaultValue, imports, loader);
+    let result = libraries.get(name);
+    if (result) {
+      console.warn('Already loaded ' + name);
+      return result;
+    }
+    result = new LibraryLoader(name, defaultValue, imports, loader);
     libraries.set(name, result);
     return result;
   }
@@ -109,11 +115,20 @@
   }
   dart_library.import = import_;
 
+  var _currentIsolate = false;
+
   function start(moduleName, libraryName) {
     if (libraryName == null) libraryName = moduleName;
     let library = import_(moduleName)[libraryName];
     let dart_sdk = import_('dart_sdk');
-    dart_sdk._isolate_helper.startRootIsolate(library.main, []);
+    if (!_currentIsolate) {
+      // Create isolate and run main.
+      _currentIsolate = true;
+      dart_sdk._isolate_helper.startRootIsolate(library.main, []);
+    } else {
+      // Main isolate is already initialized - just run main.
+      library.main();
+    }
   }
   dart_library.start = start;
 
@@ -125,55 +140,10 @@
     // Force import of core.
     var dart_sdk = import_('dart_sdk');
 
-    // TODO(vsm): DOM facades?
-    // See: https://github.com/dart-lang/dev_compiler/issues/173
-    if (typeof NodeList !== "undefined") {
-      NodeList.prototype.get = function(i) { return this[i]; };
-      NamedNodeMap.prototype.get = function(i) { return this[i]; };
-      DOMTokenList.prototype.get = function(i) { return this[i]; };
-      HTMLCollection.prototype.get = function(i) { return this[i]; };
-      // Expose constructors for DOM types dart:html needs to assume are
-      // available on window.
-      if (typeof PannerNode == "undefined") {
-        let audioContext;
-        if (typeof AudioContext == "undefined" &&
-            (typeof webkitAudioContext != "undefined")) {
-          audioContext = new webkitAudioContext();
-        } else {
-          audioContext = new AudioContext();
-          window.StereoPannerNode =
-              audioContext.createStereoPanner().constructor;
-        }
-        window.PannerNode = audioContext.createPanner().constructor;
-      }
-      if (typeof AudioSourceNode == "undefined") {
-        window.AudioSourceNode = MediaElementAudioSourceNode.constructor;
-      }
-      if (typeof FontFaceSet == "undefined") {
-        window.FontFaceSet = document.fonts.__proto__.constructor;
-      }
-      if (typeof MemoryInfo == "undefined") {
-        if (typeof window.performance.memory != "undefined") {
-          window.MemoryInfo = window.performance.memory.constructor;
-        }
-      }
-      if (typeof Geolocation == "undefined") {
-        navigator.geolocation.constructor;
-      }
-      if (typeof Animation == "undefined") {
-        let d = document.createElement('div');
-        if (typeof d.animate != "undefined") {
-          window.Animation = d.animate(d).constructor;
-        }
-      }
-      if (typeof SourceBufferList == "undefined") {
-        window.SourceBufferList = new MediaSource().sourceBuffers.constructor;
-      }
-    }
-
     // This import is only needed for chrome debugging. We should provide an
     // option to compile without it.
     dart_sdk._debugger.registerDevtoolsFormatter();
   }
 
 })(dart_library);
+}
diff --git a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
index 53d7785..5d65992 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
@@ -19,6 +19,7 @@
   const convert = Object.create(null);
   const core = Object.create(null);
   const developer = Object.create(null);
+  const io = Object.create(null);
   const isolate = Object.create(null);
   const js = Object.create(null);
   const js_util = Object.create(null);
@@ -167,6 +168,8 @@
   let _AsyncBroadcastStreamController = () => (_AsyncBroadcastStreamController = dart.constFn(async._AsyncBroadcastStreamController$()))();
   let _AsBroadcastStreamController = () => (_AsBroadcastStreamController = dart.constFn(async._AsBroadcastStreamController$()))();
   let _DoneSubscription = () => (_DoneSubscription = dart.constFn(async._DoneSubscription$()))();
+  let FutureOr = () => (FutureOr = dart.constFn(async.FutureOr$()))();
+  let dynamicToFutureOr = () => (dynamicToFutureOr = dart.constFn(dart.functionType(async.FutureOr, [dart.dynamic])))();
   let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.functionType(dart.dynamic, [])))();
   let Future = () => (Future = dart.constFn(async.Future$()))();
   let Completer = () => (Completer = dart.constFn(async.Completer$()))();
@@ -384,6 +387,103 @@
   let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
   let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
   let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
+  let ListOfListOfint = () => (ListOfListOfint = dart.constFn(core.List$(ListOfint())))();
+  let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
+  let FutureOfDirectory = () => (FutureOfDirectory = dart.constFn(async.Future$(io.Directory)))();
+  let FutureOrOfDirectory = () => (FutureOrOfDirectory = dart.constFn(async.FutureOr$(io.Directory)))();
+  let StreamOfFileSystemEntity = () => (StreamOfFileSystemEntity = dart.constFn(async.Stream$(io.FileSystemEntity)))();
+  let JSArrayOfFileSystemEntity = () => (JSArrayOfFileSystemEntity = dart.constFn(_interceptors.JSArray$(io.FileSystemEntity)))();
+  let FutureOrOfString = () => (FutureOrOfString = dart.constFn(async.FutureOr$(core.String)))();
+  let FutureOrOfbool = () => (FutureOrOfbool = dart.constFn(async.FutureOr$(core.bool)))();
+  let FutureOrOfint = () => (FutureOrOfint = dart.constFn(async.FutureOr$(core.int)))();
+  let ListOfFileSystemEntity = () => (ListOfFileSystemEntity = dart.constFn(core.List$(io.FileSystemEntity)))();
+  let StreamControllerOfListOfint = () => (StreamControllerOfListOfint = dart.constFn(async.StreamController$(ListOfint())))();
+  let FutureOfRandomAccessFile = () => (FutureOfRandomAccessFile = dart.constFn(async.Future$(io.RandomAccessFile)))();
+  let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(io.File)))();
+  let FutureOfListOfint = () => (FutureOfListOfint = dart.constFn(async.Future$(ListOfint())))();
+  let FutureOrOfFile = () => (FutureOrOfFile = dart.constFn(async.FutureOr$(io.File)))();
+  let FutureOfFile = () => (FutureOfFile = dart.constFn(async.Future$(io.File)))();
+  let FutureOrOfListOfint = () => (FutureOrOfListOfint = dart.constFn(async.FutureOr$(ListOfint())))();
+  let ListOfFileSystemEntityType = () => (ListOfFileSystemEntityType = dart.constFn(core.List$(io.FileSystemEntityType)))();
+  let StreamOfHttpRequest = () => (StreamOfHttpRequest = dart.constFn(async.Stream$(io.HttpRequest)))();
+  let ListOfRedirectInfo = () => (ListOfRedirectInfo = dart.constFn(core.List$(io.RedirectInfo)))();
+  let HashMapOfString$ListOfString = () => (HashMapOfString$ListOfString = dart.constFn(collection.HashMap$(core.String, ListOfString())))();
+  let ListOfCookie = () => (ListOfCookie = dart.constFn(core.List$(io.Cookie)))();
+  let StringAndListOfStringTovoid = () => (StringAndListOfStringTovoid = dart.constFn(dart.functionType(dart.void, [core.String, ListOfString()])))();
+  let FutureOfHttpClientResponse = () => (FutureOfHttpClientResponse = dart.constFn(async.Future$(io.HttpClientResponse)))();
+  let StreamSubscriptionOfListOfint = () => (StreamSubscriptionOfListOfint = dart.constFn(async.StreamSubscription$(ListOfint())))();
+  let FutureOrOfHttpClientResponse = () => (FutureOrOfHttpClientResponse = dart.constFn(async.FutureOr$(io.HttpClientResponse)))();
+  let _StreamSinkImpl = () => (_StreamSinkImpl = dart.constFn(io._StreamSinkImpl$()))();
+  let StreamConsumerOfListOfint = () => (StreamConsumerOfListOfint = dart.constFn(async.StreamConsumer$(ListOfint())))();
+  let _HttpOutboundMessage = () => (_HttpOutboundMessage = dart.constFn(io._HttpOutboundMessage$()))();
+  let CompleterOfHttpClientResponse = () => (CompleterOfHttpClientResponse = dart.constFn(async.Completer$(io.HttpClientResponse)))();
+  let JSArrayOfRedirectInfo = () => (JSArrayOfRedirectInfo = dart.constFn(_interceptors.JSArray$(io.RedirectInfo)))();
+  let JSArrayOfFuture = () => (JSArrayOfFuture = dart.constFn(_interceptors.JSArray$(async.Future)))();
+  let CompleterOf_HttpIncoming = () => (CompleterOf_HttpIncoming = dart.constFn(async.Completer$(io._HttpIncoming)))();
+  let X509CertificateTobool = () => (X509CertificateTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate])))();
+  let FutureOfSecureSocket = () => (FutureOfSecureSocket = dart.constFn(async.Future$(io.SecureSocket)))();
+  let HashSetOf_HttpClientConnection = () => (HashSetOf_HttpClientConnection = dart.constFn(collection.HashSet$(io._HttpClientConnection)))();
+  let FutureOf_ConnectionInfo = () => (FutureOf_ConnectionInfo = dart.constFn(async.Future$(io._ConnectionInfo)))();
+  let FutureOrOf_ConnectionInfo = () => (FutureOrOf_ConnectionInfo = dart.constFn(async.FutureOr$(io._ConnectionInfo)))();
+  let SetOf_HttpClientConnection = () => (SetOf_HttpClientConnection = dart.constFn(core.Set$(io._HttpClientConnection)))();
+  let HashMapOfString$_ConnectionTarget = () => (HashMapOfString$_ConnectionTarget = dart.constFn(collection.HashMap$(core.String, io._ConnectionTarget)))();
+  let JSArrayOf_Credentials = () => (JSArrayOf_Credentials = dart.constFn(_interceptors.JSArray$(io._Credentials)))();
+  let JSArrayOf_ProxyCredentials = () => (JSArrayOf_ProxyCredentials = dart.constFn(_interceptors.JSArray$(io._ProxyCredentials)))();
+  let FutureOf_HttpClientRequest = () => (FutureOf_HttpClientRequest = dart.constFn(async.Future$(io._HttpClientRequest)))();
+  let FutureOrOf_HttpClientRequest = () => (FutureOrOf_HttpClientRequest = dart.constFn(async.FutureOr$(io._HttpClientRequest)))();
+  let X509CertificateAndStringAndintTobool = () => (X509CertificateAndStringAndintTobool = dart.constFn(dart.functionType(core.bool, [io.X509Certificate, core.String, core.int])))();
+  let FutureOfbool = () => (FutureOfbool = dart.constFn(async.Future$(core.bool)))();
+  let UriAndStringAndStringToFutureOfbool = () => (UriAndStringAndStringToFutureOfbool = dart.constFn(dart.functionType(FutureOfbool(), [core.Uri, core.String, core.String])))();
+  let StringAndintAndString__ToFutureOfbool = () => (StringAndintAndString__ToFutureOfbool = dart.constFn(dart.functionType(FutureOfbool(), [core.String, core.int, core.String, core.String])))();
+  let UriToString = () => (UriToString = dart.constFn(dart.functionType(core.String, [core.Uri])))();
+  let MapOfString$_ConnectionTarget = () => (MapOfString$_ConnectionTarget = dart.constFn(core.Map$(core.String, io._ConnectionTarget)))();
+  let ListOf_Credentials = () => (ListOf_Credentials = dart.constFn(core.List$(io._Credentials)))();
+  let ListOf_ProxyCredentials = () => (ListOf_ProxyCredentials = dart.constFn(core.List$(io._ProxyCredentials)))();
+  let MapOfint$_HttpConnection = () => (MapOfint$_HttpConnection = dart.constFn(core.Map$(core.int, io._HttpConnection)))();
+  let HashMapOfint$_HttpConnection = () => (HashMapOfint$_HttpConnection = dart.constFn(collection.HashMap$(core.int, io._HttpConnection)))();
+  let LinkedListOf_HttpConnection = () => (LinkedListOf_HttpConnection = dart.constFn(collection.LinkedList$(io._HttpConnection)))();
+  let StreamControllerOfHttpRequest = () => (StreamControllerOfHttpRequest = dart.constFn(async.StreamController$(io.HttpRequest)))();
+  let HttpRequestTovoid = () => (HttpRequestTovoid = dart.constFn(dart.functionType(dart.void, [io.HttpRequest])))();
+  let MapOfint$_HttpServer = () => (MapOfint$_HttpServer = dart.constFn(core.Map$(core.int, io._HttpServer)))();
+  let ListOf_Proxy = () => (ListOf_Proxy = dart.constFn(core.List$(io._Proxy)))();
+  let FutureOfSocket = () => (FutureOfSocket = dart.constFn(async.Future$(io.Socket)))();
+  let ListOfbool = () => (ListOfbool = dart.constFn(core.List$(core.bool)))();
+  let StreamOfint = () => (StreamOfint = dart.constFn(async.Stream$(core.int)))();
+  let StreamControllerOf_HttpIncoming = () => (StreamControllerOf_HttpIncoming = dart.constFn(async.StreamController$(io._HttpIncoming)))();
+  let _HttpIncomingTovoid = () => (_HttpIncomingTovoid = dart.constFn(dart.functionType(dart.void, [io._HttpIncoming])))();
+  let MapOfString$_HttpSession = () => (MapOfString$_HttpSession = dart.constFn(core.Map$(core.String, io._HttpSession)))();
+  let ListOfMapOfString$String = () => (ListOfMapOfString$String = dart.constFn(core.List$(MapOfString$String())))();
+  let FutureOfServiceExtensionResponse = () => (FutureOfServiceExtensionResponse = dart.constFn(async.Future$(developer.ServiceExtensionResponse)))();
+  let MapOfint$_FileResourceInfo = () => (MapOfint$_FileResourceInfo = dart.constFn(core.Map$(core.int, io._FileResourceInfo)))();
+  let MapOfint$_ProcessResourceInfo = () => (MapOfint$_ProcessResourceInfo = dart.constFn(core.Map$(core.int, io._ProcessResourceInfo)))();
+  let MapOfint$_SocketResourceInfo = () => (MapOfint$_SocketResourceInfo = dart.constFn(core.Map$(core.int, io._SocketResourceInfo)))();
+  let StreamSinkOfListOfint = () => (StreamSinkOfListOfint = dart.constFn(async.StreamSink$(ListOfint())))();
+  let FutureOfLink = () => (FutureOfLink = dart.constFn(async.Future$(io.Link)))();
+  let _CaseInsensitiveStringMap = () => (_CaseInsensitiveStringMap = dart.constFn(io._CaseInsensitiveStringMap$()))();
+  let FutureOfRawSecureSocket = () => (FutureOfRawSecureSocket = dart.constFn(async.Future$(io.RawSecureSocket)))();
+  let SecureSocketTovoid = () => (SecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.SecureSocket])))();
+  let StreamControllerOfRawSecureSocket = () => (StreamControllerOfRawSecureSocket = dart.constFn(async.StreamController$(io.RawSecureSocket)))();
+  let RawSecureSocketTovoid = () => (RawSecureSocketTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSecureSocket])))();
+  let StreamSubscriptionOfRawSocket = () => (StreamSubscriptionOfRawSocket = dart.constFn(async.StreamSubscription$(io.RawSocket)))();
+  let StreamSubscriptionOfRawSocketEvent = () => (StreamSubscriptionOfRawSocketEvent = dart.constFn(async.StreamSubscription$(io.RawSocketEvent)))();
+  let CompleterOf_RawSecureSocket = () => (CompleterOf_RawSecureSocket = dart.constFn(async.Completer$(io._RawSecureSocket)))();
+  let StreamControllerOfRawSocketEvent = () => (StreamControllerOfRawSocketEvent = dart.constFn(async.StreamController$(io.RawSocketEvent)))();
+  let RawSocketEventTovoid = () => (RawSocketEventTovoid = dart.constFn(dart.functionType(dart.void, [io.RawSocketEvent])))();
+  let StreamOfRawSocketEvent = () => (StreamOfRawSocketEvent = dart.constFn(async.Stream$(io.RawSocketEvent)))();
+  let X509CertificateTodynamic = () => (X509CertificateTodynamic = dart.constFn(dart.functionType(dart.dynamic, [io.X509Certificate])))();
+  let intToListOfint = () => (intToListOfint = dart.constFn(dart.functionType(ListOfint(), [core.int])))();
+  let StreamOfRawSocket = () => (StreamOfRawSocket = dart.constFn(async.Stream$(io.RawSocket)))();
+  let StreamOfSocket = () => (StreamOfSocket = dart.constFn(async.Stream$(io.Socket)))();
+  let StreamTransformerOfHttpRequest$WebSocket = () => (StreamTransformerOfHttpRequest$WebSocket = dart.constFn(async.StreamTransformer$(io.HttpRequest, io.WebSocket)))();
+  let ListOfStringTodynamic = () => (ListOfStringTodynamic = dart.constFn(dart.functionType(dart.dynamic, [ListOfString()])))();
+  let StreamTransformerOfListOfint$dynamic = () => (StreamTransformerOfListOfint$dynamic = dart.constFn(async.StreamTransformer$(ListOfint(), dart.dynamic)))();
+  let EventSinkOfUint8List = () => (EventSinkOfUint8List = dart.constFn(async.EventSink$(typed_data.Uint8List)))();
+  let StreamControllerOfWebSocket = () => (StreamControllerOfWebSocket = dart.constFn(async.StreamController$(io.WebSocket)))();
+  let FutureOfWebSocket = () => (FutureOfWebSocket = dart.constFn(async.Future$(io.WebSocket)))();
+  let EventSinkOfListOfint = () => (EventSinkOfListOfint = dart.constFn(async.EventSink$(ListOfint())))();
+  let JSArrayOfUint8List = () => (JSArrayOfUint8List = dart.constFn(_interceptors.JSArray$(typed_data.Uint8List)))();
+  let StreamTransformerOfdynamic$ListOfint = () => (StreamTransformerOfdynamic$ListOfint = dart.constFn(async.StreamTransformer$(dart.dynamic, ListOfint())))();
+  let MapOfint$_WebSocketImpl = () => (MapOfint$_WebSocketImpl = dart.constFn(core.Map$(core.int, io._WebSocketImpl)))();
   let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
   let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
   let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@@ -400,7 +500,6 @@
   let FutureOfIdbFactory = () => (FutureOfIdbFactory = dart.constFn(async.Future$(indexed_db.IdbFactory)))();
   let FutureOfListOfString = () => (FutureOfListOfString = dart.constFn(async.Future$(ListOfString())))();
   let EventTovoid = () => (EventTovoid = dart.constFn(dart.functionType(dart.void, [html$.Event])))();
-  let FutureOfint = () => (FutureOfint = dart.constFn(async.Future$(core.int)))();
   let CompleterOfDatabase = () => (CompleterOfDatabase = dart.constFn(async.Completer$(indexed_db.Database)))();
   let ListOfEventTarget = () => (ListOfEventTarget = dart.constFn(core.List$(html$.EventTarget)))();
   let RectangleOfint = () => (RectangleOfint = dart.constFn(math.Rectangle$(core.int)))();
@@ -434,8 +533,8 @@
   let CompleterOfString = () => (CompleterOfString = dart.constFn(async.Completer$(core.String)))();
   let CompleterOfMetadata = () => (CompleterOfMetadata = dart.constFn(async.Completer$(html$.Metadata)))();
   let CompleterOfListOfEntry = () => (CompleterOfListOfEntry = dart.constFn(async.Completer$(ListOfEntry())))();
-  let ListOfStyleSheet = () => (ListOfStyleSheet = dart.constFn(core.List$(html$.StyleSheet)))();
   let EventStreamProviderOfSecurityPolicyViolationEvent = () => (EventStreamProviderOfSecurityPolicyViolationEvent = dart.constFn(html$.EventStreamProvider$(html$.SecurityPolicyViolationEvent)))();
+  let ListOfStyleSheet = () => (ListOfStyleSheet = dart.constFn(core.List$(html$.StyleSheet)))();
   let ImmutableListMixin = () => (ImmutableListMixin = dart.constFn(html$.ImmutableListMixin$()))();
   let ElementAndElementToint = () => (ElementAndElementToint = dart.constFn(dart.functionType(core.int, [html$.Element, html$.Element])))();
   let ElementTobool = () => (ElementTobool = dart.constFn(dart.functionType(core.bool, [html$.Element])))();
@@ -444,13 +543,14 @@
   let _EventStreamOfEvent = () => (_EventStreamOfEvent = dart.constFn(html$._EventStream$(html$.Event)))();
   let _ElementEventStreamImplOfEvent = () => (_ElementEventStreamImplOfEvent = dart.constFn(html$._ElementEventStreamImpl$(html$.Event)))();
   let CompleterOfFileWriter = () => (CompleterOfFileWriter = dart.constFn(async.Completer$(html$.FileWriter)))();
-  let CompleterOfFile = () => (CompleterOfFile = dart.constFn(async.Completer$(html$.File)))();
+  let CompleterOfFile$ = () => (CompleterOfFile$ = dart.constFn(async.Completer$(html$.File)))();
   let ListOfFontFace = () => (ListOfFontFace = dart.constFn(core.List$(html$.FontFace)))();
   let ListOfGamepadButton = () => (ListOfGamepadButton = dart.constFn(core.List$(html$.GamepadButton)))();
   let CompleterOfGeoposition = () => (CompleterOfGeoposition = dart.constFn(async.Completer$(html$.Geoposition)))();
   let StreamControllerOfGeoposition = () => (StreamControllerOfGeoposition = dart.constFn(async.StreamController$(html$.Geoposition)))();
   let _CustomEventStreamProviderOfEvent = () => (_CustomEventStreamProviderOfEvent = dart.constFn(html$._CustomEventStreamProvider$(html$.Event)))();
   let CompleterOfHttpRequest = () => (CompleterOfHttpRequest = dart.constFn(async.Completer$(html$.HttpRequest)))();
+  let dynamicToNull = () => (dynamicToNull = dart.constFn(dart.functionType(core.Null, [dart.dynamic])))();
   let ProgressEventTovoid = () => (ProgressEventTovoid = dart.constFn(dart.functionType(dart.void, [html$.ProgressEvent])))();
   let ListOfMap = () => (ListOfMap = dart.constFn(core.List$(core.Map)))();
   let ListOfMediaStreamTrack = () => (ListOfMediaStreamTrack = dart.constFn(core.List$(html$.MediaStreamTrack)))();
@@ -459,6 +559,7 @@
   let EventStreamProviderOfMidiMessageEvent = () => (EventStreamProviderOfMidiMessageEvent = dart.constFn(html$.EventStreamProvider$(html$.MidiMessageEvent)))();
   let ListOfMimeType = () => (ListOfMimeType = dart.constFn(core.List$(html$.MimeType)))();
   let ListOfMutationRecord = () => (ListOfMutationRecord = dart.constFn(core.List$(html$.MutationRecord)))();
+  let _wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void = () => (_wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void = dart.constFn(html$._wrapZoneBinaryCallback$(ListOfMutationRecord(), html$.MutationObserver, dart.void)))();
   let MapOfString$bool = () => (MapOfString$bool = dart.constFn(core.Map$(core.String, core.bool)))();
   let CompleterOfMediaStream = () => (CompleterOfMediaStream = dart.constFn(async.Completer$(html$.MediaStream)))();
   let NodeTobool = () => (NodeTobool = dart.constFn(dart.functionType(core.bool, [html$.Node])))();
@@ -466,7 +567,6 @@
   let ListOfPlugin = () => (ListOfPlugin = dart.constFn(core.List$(html$.Plugin)))();
   let EventStreamProviderOfRtcDtmfToneChangeEvent = () => (EventStreamProviderOfRtcDtmfToneChangeEvent = dart.constFn(html$.EventStreamProvider$(html$.RtcDtmfToneChangeEvent)))();
   let JSArrayOfMapOfString$String = () => (JSArrayOfMapOfString$String = dart.constFn(_interceptors.JSArray$(MapOfString$String())))();
-  let ListOfMapOfString$String = () => (ListOfMapOfString$String = dart.constFn(core.List$(MapOfString$String())))();
   let CompleterOfRtcSessionDescription = () => (CompleterOfRtcSessionDescription = dart.constFn(async.Completer$(html$.RtcSessionDescription)))();
   let CompleterOfRtcStatsResponse = () => (CompleterOfRtcStatsResponse = dart.constFn(async.Completer$(html$.RtcStatsResponse)))();
   let EventStreamProviderOfMediaStreamEvent = () => (EventStreamProviderOfMediaStreamEvent = dart.constFn(html$.EventStreamProvider$(html$.MediaStreamEvent)))();
@@ -497,6 +597,7 @@
   let EventStreamProviderOfDeviceOrientationEvent = () => (EventStreamProviderOfDeviceOrientationEvent = dart.constFn(html$.EventStreamProvider$(html$.DeviceOrientationEvent)))();
   let EventStreamProviderOfAnimationEvent = () => (EventStreamProviderOfAnimationEvent = dart.constFn(html$.EventStreamProvider$(html$.AnimationEvent)))();
   let EventStreamProviderOfBeforeUnloadEvent = () => (EventStreamProviderOfBeforeUnloadEvent = dart.constFn(html$.EventStreamProvider$(html$.BeforeUnloadEvent)))();
+  let _EventStreamOfBeforeUnloadEvent = () => (_EventStreamOfBeforeUnloadEvent = dart.constFn(html$._EventStream$(html$.BeforeUnloadEvent)))();
   let StreamControllerOfBeforeUnloadEvent = () => (StreamControllerOfBeforeUnloadEvent = dart.constFn(async.StreamController$(html$.BeforeUnloadEvent)))();
   let _ElementEventStreamImplOfBeforeUnloadEvent = () => (_ElementEventStreamImplOfBeforeUnloadEvent = dart.constFn(html$._ElementEventStreamImpl$(html$.BeforeUnloadEvent)))();
   let _ElementListEventStreamImplOfBeforeUnloadEvent = () => (_ElementListEventStreamImplOfBeforeUnloadEvent = dart.constFn(html$._ElementListEventStreamImpl$(html$.BeforeUnloadEvent)))();
@@ -546,6 +647,7 @@
   let dynamicTodynamic$ = () => (dynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic])))();
   let StringAndStringToint = () => (StringAndStringToint = dart.constFn(dart.definiteFunctionType(core.int, [core.String, core.String])))();
   let VoidTo_MethodStats = () => (VoidTo_MethodStats = dart.constFn(dart.definiteFunctionType(dart._MethodStats, [])))();
+  let VoidToFunctionType = () => (VoidToFunctionType = dart.constFn(dart.definiteFunctionType(dart.FunctionType, [])))();
   let dynamicToString = () => (dynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic])))();
   let dynamicToListOfString = () => (dynamicToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [dart.dynamic])))();
   let dynamicToList = () => (dynamicToList = dart.constFn(dart.definiteFunctionType(core.List, [dart.dynamic])))();
@@ -554,13 +656,12 @@
   let dynamicToObject = () => (dynamicToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic])))();
   let dynamicAnddynamicToString = () => (dynamicAnddynamicToString = dart.constFn(dart.definiteFunctionType(core.String, [dart.dynamic, dart.dynamic])))();
   let dynamicAndStringTobool = () => (dynamicAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic, core.String])))();
-  let intAnddynamicTovoid = () => (intAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, dart.dynamic])))();
+  let intAnddynamicToNull = () => (intAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.int, dart.dynamic])))();
   let ObjectAndObjectToObject = () => (ObjectAndObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object, core.Object])))();
   let StringTobool$ = () => (StringTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [core.String])))();
   let dynamicTobool$ = () => (dynamicTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
-  let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
-  let StringAndObjectTovoid = () => (StringAndObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Object])))();
-  let dynamicAnddynamicTovoid$ = () => (dynamicAnddynamicTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])))();
+  let dynamicAnddynamicToNull = () => (dynamicAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, dart.dynamic])))();
+  let StringAndObjectToNull = () => (StringAndObjectToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.Object])))();
   let StringToNameValuePair = () => (StringToNameValuePair = dart.constFn(dart.definiteFunctionType(_debugger.NameValuePair, [core.String])))();
   let VoidTodynamic$ = () => (VoidTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
   let StringAndString__Todynamic = () => (StringAndString__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String], [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -574,18 +675,22 @@
   let FunctionTovoid = () => (FunctionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Function])))();
   let StringAndStringToString$ = () => (StringAndStringToString$ = dart.constFn(dart.definiteFunctionType(core.String, [core.String, core.String])))();
   let TypeAndStringTodynamic = () => (TypeAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.String])))();
+  let dynamicAnddynamicTodynamic$ = () => (dynamicAnddynamicTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))();
   let dynamicAnddynamicToint = () => (dynamicAnddynamicToint = dart.constFn(dart.definiteFunctionType(core.int, [dart.dynamic, dart.dynamic])))();
   let ListOfEToListOfE = () => (ListOfEToListOfE = dart.constFn(dart.definiteFunctionType(E => [core.List$(E), [core.List$(E)]])))();
   let StringTovoid$ = () => (StringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
   let _IsolateContextAndFunctionTodynamic = () => (_IsolateContextAndFunctionTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [_isolate_helper._IsolateContext, core.Function])))();
   let VoidTobool = () => (VoidTobool = dart.constFn(dart.definiteFunctionType(core.bool, [])))();
   let VoidTo_IsolateContext = () => (VoidTo_IsolateContext = dart.constFn(dart.definiteFunctionType(_isolate_helper._IsolateContext, [])))();
+  let VoidToNull = () => (VoidToNull = dart.constFn(dart.definiteFunctionType(core.Null, [])))();
+  let dynamicAnddynamicTovoid$ = () => (dynamicAnddynamicTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])))();
   let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
-  let ListTodynamic = () => (ListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.List])))();
-  let StringTodynamic = () => (StringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String])))();
-  let TimerTovoid$ = () => (TimerTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [async.Timer])))();
+  let ListToNull = () => (ListToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.List])))();
+  let StringToNull = () => (StringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String])))();
+  let dynamicToNull$ = () => (dynamicToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic])))();
+  let TimerToNull = () => (TimerToNull = dart.constFn(dart.definiteFunctionType(core.Null, [async.Timer])))();
   let dynamicToFuture = () => (dynamicToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [dart.dynamic])))();
-  let boolTodynamic = () => (boolTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.bool])))();
+  let boolToNull = () => (boolToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.bool])))();
   let dynamicAndStackTraceTovoid = () => (dynamicAndStackTraceTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])))();
   let VoidToFuture = () => (VoidToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [])))();
   let VoidToint = () => (VoidToint = dart.constFn(dart.definiteFunctionType(core.int, [])))();
@@ -628,7 +733,7 @@
   let dynamicToSymbol = () => (dynamicToSymbol = dart.constFn(dart.definiteFunctionType(core.Symbol, [dart.dynamic])))();
   let dynamicToMapOfSymbol$dynamic = () => (dynamicToMapOfSymbol$dynamic = dart.constFn(dart.definiteFunctionType(MapOfSymbol$dynamic(), [dart.dynamic])))();
   let TypeAndInvocationTodynamic = () => (TypeAndInvocationTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.Invocation])))();
-  let SymbolAnddynamicTovoid = () => (SymbolAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Symbol, dart.dynamic])))();
+  let SymbolAnddynamicToNull = () => (SymbolAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.Symbol, dart.dynamic])))();
   let MapOfSymbol$dynamicTodynamic = () => (MapOfSymbol$dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [MapOfSymbol$dynamic()])))();
   let dynamicToTypeMirror = () => (dynamicToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [dart.dynamic])))();
   let dynamicAnddynamicAnddynamicTovoid = () => (dynamicAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, dart.dynamic])))();
@@ -641,12 +746,12 @@
   let VoidToObject$ = () => (VoidToObject$ = dart.constFn(dart.definiteFunctionType(core.Object, [])))();
   let _FutureAnddynamicAnddynamicTovoid = () => (_FutureAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async._Future, dart.dynamic, dart.dynamic])))();
   let ObjectToObject = () => (ObjectToObject = dart.constFn(dart.definiteFunctionType(core.Object, [core.Object])))();
-  let dynamic__Todynamic = () => (dynamic__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], [dart.dynamic])))();
+  let dynamic__ToNull = () => (dynamic__ToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [dart.dynamic])))();
   let dynamicTo_Future = () => (dynamicTo_Future = dart.constFn(dart.definiteFunctionType(async._Future, [dart.dynamic])))();
   let _AsyncCallbackTovoid = () => (_AsyncCallbackTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async._AsyncCallback])))();
-  let FnTodynamic = () => (FnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTovoid()])))();
+  let FnToNull = () => (FnToNull = dart.constFn(dart.definiteFunctionType(core.Null, [VoidTovoid()])))();
   let _NotificationHandlerToFuture = () => (_NotificationHandlerToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [async._NotificationHandler])))();
-  let dynamicAndStackTraceTodynamic = () => (dynamicAndStackTraceTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.StackTrace])))();
+  let dynamicAndStackTraceToNull = () => (dynamicAndStackTraceToNull = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic, core.StackTrace])))();
   let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace])))();
   let FnAndFnAndFnTodynamic = () => (FnAndFnAndFnTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [VoidTodynamic(), dynamicTodynamic(), ZoneBinaryCallbackOfdynamic$dynamic$StackTrace()])))();
   let StreamSubscriptionAnd_FutureAnddynamic__Tovoid = () => (StreamSubscriptionAnd_FutureAnddynamic__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [async.StreamSubscription, async._Future, dart.dynamic, core.StackTrace])))();
@@ -687,10 +792,11 @@
   let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
   let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
   let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
-  let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
+  let StringAnddynamicToNull = () => (StringAnddynamicToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, dart.dynamic])))();
   let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
   let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
   let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
+  let StringAndStringToNull = () => (StringAndStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, core.String])))();
   let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
   let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
   let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
@@ -705,9 +811,107 @@
   let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
   let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
   let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
+  let dynamicAndStringAndStringTodynamic = () => (dynamicAndStringAndStringTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])))();
+  let ListAndintAndintTo_BufferAndStart = () => (ListAndintAndintTo_BufferAndStart = dart.constFn(dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int, core.int])))();
+  let intTovoid = () => (intTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int])))();
+  let DirectoryToFutureOfDirectory = () => (DirectoryToFutureOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOfDirectory(), [io.Directory])))();
+  let boolToFutureOrOfDirectory = () => (boolToFutureOrOfDirectory = dart.constFn(dart.definiteFunctionType(FutureOrOfDirectory(), [core.bool])))();
+  let dynamicTo_Directory = () => (dynamicTo_Directory = dart.constFn(dart.definiteFunctionType(io._Directory, [dart.dynamic])))();
+  let dynamicToDirectory = () => (dynamicToDirectory = dart.constFn(dart.definiteFunctionType(io.Directory, [dart.dynamic])))();
+  let dynamicToFutureOrOfString = () => (dynamicToFutureOrOfString = dart.constFn(dart.definiteFunctionType(FutureOrOfString(), [dart.dynamic])))();
+  let dynamicToFutureOrOfbool = () => (dynamicToFutureOrOfbool = dart.constFn(dart.definiteFunctionType(FutureOrOfbool(), [dart.dynamic])))();
+  let dynamicToFutureOrOfint = () => (dynamicToFutureOrOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfint(), [dart.dynamic])))();
+  let ListOfintToNull = () => (ListOfintToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfint()])))();
+  let RandomAccessFileTovoid = () => (RandomAccessFileTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.RandomAccessFile])))();
+  let RandomAccessFileToFutureOr = () => (RandomAccessFileToFutureOr = dart.constFn(dart.definiteFunctionType(async.FutureOr, [io.RandomAccessFile])))();
+  let RandomAccessFileToNull = () => (RandomAccessFileToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RandomAccessFile])))();
+  let RandomAccessFileToFutureOfRandomAccessFile = () => (RandomAccessFileToFutureOfRandomAccessFile = dart.constFn(dart.definiteFunctionType(FutureOfRandomAccessFile(), [io.RandomAccessFile])))();
+  let dynamicTo_File = () => (dynamicTo_File = dart.constFn(dart.definiteFunctionType(io._File, [dart.dynamic])))();
+  let FileSystemEntityTo_File = () => (FileSystemEntityTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.FileSystemEntity])))();
+  let dynamicToFile = () => (dynamicToFile = dart.constFn(dart.definiteFunctionType(io.File, [dart.dynamic])))();
+  let dynamicTo_RandomAccessFile = () => (dynamicTo_RandomAccessFile = dart.constFn(dart.definiteFunctionType(io._RandomAccessFile, [dart.dynamic])))();
+  let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
+  let dynamicToFutureOfListOfint = () => (dynamicToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [dart.dynamic])))();
+  let intToFutureOfListOfint = () => (intToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [core.int])))();
+  let RandomAccessFileToFutureOfListOfint = () => (RandomAccessFileToFutureOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOfListOfint(), [io.RandomAccessFile])))();
+  let ListOfintToString = () => (ListOfintToString = dart.constFn(dart.definiteFunctionType(core.String, [ListOfint()])))();
+  let RandomAccessFileTo_File = () => (RandomAccessFileTo_File = dart.constFn(dart.definiteFunctionType(io._File, [io.RandomAccessFile])))();
+  let RandomAccessFileToObject = () => (RandomAccessFileToObject = dart.constFn(dart.definiteFunctionType(core.Object, [io.RandomAccessFile])))();
+  let RandomAccessFileToFutureOrOfFile = () => (RandomAccessFileToFutureOrOfFile = dart.constFn(dart.definiteFunctionType(FutureOrOfFile(), [io.RandomAccessFile])))();
+  let dynamicToFutureOrOfListOfint = () => (dynamicToFutureOrOfListOfint = dart.constFn(dart.definiteFunctionType(FutureOrOfListOfint(), [dart.dynamic])))();
+  let dynamicToFileStat = () => (dynamicToFileStat = dart.constFn(dart.definiteFunctionType(io.FileStat, [dart.dynamic])))();
+  let StringAndListOfStringToListOfString = () => (StringAndListOfStringToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [core.String, ListOfString()])))();
+  let ListOfintTovoid$ = () => (ListOfintTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint()])))();
+  let StringAndListOfStringToNull = () => (StringAndListOfStringToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.String, ListOfString()])))();
+  let CookieToString = () => (CookieToString = dart.constFn(dart.definiteFunctionType(core.String, [io.Cookie])))();
+  let CookieTobool = () => (CookieTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io.Cookie])))();
+  let _HttpClientRequestToFutureOfHttpClientResponse = () => (_HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io._HttpClientRequest])))();
+  let dynamicToFutureOfHttpClientResponse = () => (dynamicToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [dart.dynamic])))();
+  let VoidToFutureOfHttpClientResponse = () => (VoidToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [])))();
+  let VoidToListOfString = () => (VoidToListOfString = dart.constFn(dart.definiteFunctionType(ListOfString(), [])))();
+  let _AuthenticationSchemeTo_Credentials = () => (_AuthenticationSchemeTo_Credentials = dart.constFn(dart.definiteFunctionType(io._Credentials, [io._AuthenticationScheme])))();
+  let _CredentialsTovoid = () => (_CredentialsTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io._Credentials])))();
+  let _AuthenticationSchemeAndStringToFuture = () => (_AuthenticationSchemeAndStringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [io._AuthenticationScheme, core.String])))();
+  let dynamicToFutureOrOfHttpClientResponse = () => (dynamicToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [dart.dynamic])))();
+  let CookieToNull = () => (CookieToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Cookie])))();
+  let ListToFutureOrOfHttpClientResponse = () => (ListToFutureOrOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOrOfHttpClientResponse(), [core.List])))();
+  let HttpClientResponseTovoid = () => (HttpClientResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.HttpClientResponse])))();
+  let dynamicToIterable = () => (dynamicToIterable = dart.constFn(dart.definiteFunctionType(core.Iterable, [dart.dynamic])))();
+  let dynamicTo_HttpOutboundMessage = () => (dynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic])))();
+  let dynamicAnddynamicTo_HttpOutboundMessage = () => (dynamicAnddynamicTo_HttpOutboundMessage = dart.constFn(dart.definiteFunctionType(io._HttpOutboundMessage, [dart.dynamic, dart.dynamic])))();
+  let dynamic__ToNull$ = () => (dynamic__ToNull$ = dart.constFn(dart.definiteFunctionType(core.Null, [dart.dynamic], [core.StackTrace])))();
+  let _HttpIncomingToNull = () => (_HttpIncomingToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpIncoming])))();
+  let dynamicTo_DetachedSocket = () => (dynamicTo_DetachedSocket = dart.constFn(dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic])))();
+  let SecureSocketTo_HttpClientConnection = () => (SecureSocketTo_HttpClientConnection = dart.constFn(dart.definiteFunctionType(io._HttpClientConnection, [io.SecureSocket])))();
+  let HttpClientResponseToFutureOfSecureSocket = () => (HttpClientResponseToFutureOfSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfSecureSocket(), [io.HttpClientResponse])))();
+  let X509CertificateTobool$ = () => (X509CertificateTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [io.X509Certificate])))();
+  let _HttpClientConnectionTo_ConnectionInfo = () => (_HttpClientConnectionTo_ConnectionInfo = dart.constFn(dart.definiteFunctionType(io._ConnectionInfo, [io._HttpClientConnection])))();
+  let dynamicToFutureOrOf_ConnectionInfo = () => (dynamicToFutureOrOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOrOf_ConnectionInfo(), [dart.dynamic])))();
+  let _ConnectionTargetTobool = () => (_ConnectionTargetTobool = dart.constFn(dart.definiteFunctionType(core.bool, [io._ConnectionTarget])))();
+  let _ConnectionInfoTo_HttpClientRequest = () => (_ConnectionInfoTo_HttpClientRequest = dart.constFn(dart.definiteFunctionType(io._HttpClientRequest, [io._ConnectionInfo])))();
+  let _ConnectionInfoToFutureOrOf_HttpClientRequest = () => (_ConnectionInfoToFutureOrOf_HttpClientRequest = dart.constFn(dart.definiteFunctionType(FutureOrOf_HttpClientRequest(), [io._ConnectionInfo])))();
+  let _HttpClientRequestTo_HttpClientRequest = () => (_HttpClientRequestTo_HttpClientRequest = dart.constFn(dart.definiteFunctionType(io._HttpClientRequest, [io._HttpClientRequest])))();
+  let VoidTo_ConnectionTarget = () => (VoidTo_ConnectionTarget = dart.constFn(dart.definiteFunctionType(io._ConnectionTarget, [])))();
+  let dynamicToFutureOf_ConnectionInfo = () => (dynamicToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [dart.dynamic])))();
+  let VoidToFutureOf_ConnectionInfo = () => (VoidToFutureOf_ConnectionInfo = dart.constFn(dart.definiteFunctionType(FutureOf_ConnectionInfo(), [])))();
+  let _SiteCredentialsAnd_CredentialsTo_SiteCredentials = () => (_SiteCredentialsAnd_CredentialsTo_SiteCredentials = dart.constFn(dart.definiteFunctionType(io._SiteCredentials, [io._SiteCredentials, io._Credentials])))();
+  let ServerSocketTo_HttpServer = () => (ServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.ServerSocket])))();
+  let SecureServerSocketTo_HttpServer = () => (SecureServerSocketTo_HttpServer = dart.constFn(dart.definiteFunctionType(io._HttpServer, [io.SecureServerSocket])))();
+  let SocketToNull = () => (SocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.Socket])))();
+  let _HttpConnectionToNull = () => (_HttpConnectionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._HttpConnection])))();
+  let _HttpConnectionToMap = () => (_HttpConnectionToMap = dart.constFn(dart.definiteFunctionType(core.Map, [io._HttpConnection])))();
+  let _FileResourceInfoToMapOfString$String = () => (_FileResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._FileResourceInfo])))();
+  let _ProcessResourceInfoToMapOfString$String = () => (_ProcessResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._ProcessResourceInfo])))();
+  let _SocketResourceInfoToMapOfString$String = () => (_SocketResourceInfoToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [io._SocketResourceInfo])))();
+  let dynamicTo_Link = () => (dynamicTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [dart.dynamic])))();
+  let FileSystemEntityToFutureOfLink = () => (FileSystemEntityToFutureOfLink = dart.constFn(dart.definiteFunctionType(FutureOfLink(), [io.FileSystemEntity])))();
+  let FileSystemEntityTo_Link = () => (FileSystemEntityTo_Link = dart.constFn(dart.definiteFunctionType(io._Link, [io.FileSystemEntity])))();
+  let dynamicToLink = () => (dynamicToLink = dart.constFn(dart.definiteFunctionType(io.Link, [dart.dynamic])))();
+  let DurationTovoid = () => (DurationTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Duration])))();
+  let RawSecureServerSocketToSecureServerSocket = () => (RawSecureServerSocketToSecureServerSocket = dart.constFn(dart.definiteFunctionType(io.SecureServerSocket, [io.RawSecureServerSocket])))();
+  let RawSecureSocketToSecureSocket = () => (RawSecureSocketToSecureSocket = dart.constFn(dart.definiteFunctionType(io.SecureSocket, [io.RawSecureSocket])))();
+  let dynamicToFutureOfRawSecureSocket = () => (dynamicToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [dart.dynamic])))();
+  let RawServerSocketToRawSecureServerSocket = () => (RawServerSocketToRawSecureServerSocket = dart.constFn(dart.definiteFunctionType(io.RawSecureServerSocket, [io.RawServerSocket])))();
+  let RawSecureSocketToNull = () => (RawSecureSocketToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.RawSecureSocket])))();
+  let RawSocketToFutureOfRawSecureSocket = () => (RawSocketToFutureOfRawSecureSocket = dart.constFn(dart.definiteFunctionType(FutureOfRawSecureSocket(), [io.RawSocket])))();
+  let _FilterStatusToNull = () => (_FilterStatusToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io._FilterStatus])))();
+  let intToint = () => (intToint = dart.constFn(dart.definiteFunctionType(core.int, [core.int])))();
+  let dynamicTo_FilterStatus = () => (dynamicTo_FilterStatus = dart.constFn(dart.definiteFunctionType(io._FilterStatus, [dart.dynamic])))();
+  let ListOfintAndStringTovoid = () => (ListOfintAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfint(), core.String])))();
+  let dynamicToStdioType = () => (dynamicToStdioType = dart.constFn(dart.definiteFunctionType(io.StdioType, [dart.dynamic])))();
+  let EventSinkTo_WebSocketProtocolTransformer = () => (EventSinkTo_WebSocketProtocolTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketProtocolTransformer, [async.EventSink])))();
+  let WebSocketTovoid = () => (WebSocketTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [io.WebSocket])))();
+  let HttpRequestToNull = () => (HttpRequestToNull = dart.constFn(dart.definiteFunctionType(core.Null, [io.HttpRequest])))();
+  let SocketTo_WebSocketImpl = () => (SocketTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [io.Socket])))();
+  let StringToFuture = () => (StringToFuture = dart.constFn(dart.definiteFunctionType(async.Future, [core.String])))();
+  let EventSinkOfListOfintTo_WebSocketOutgoingTransformer = () => (EventSinkOfListOfintTo_WebSocketOutgoingTransformer = dart.constFn(dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [EventSinkOfListOfint()])))();
+  let dynamicTo_WebSocketImpl = () => (dynamicTo_WebSocketImpl = dart.constFn(dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic])))();
+  let HttpClientResponseToFutureOfWebSocket = () => (HttpClientResponseToFutureOfWebSocket = dart.constFn(dart.definiteFunctionType(FutureOfWebSocket(), [io.HttpClientResponse])))();
+  let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
+  let HttpClientRequestToFutureOfHttpClientResponse = () => (HttpClientRequestToFutureOfHttpClientResponse = dart.constFn(dart.definiteFunctionType(FutureOfHttpClientResponse(), [io.HttpClientRequest])))();
+  let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
   let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
   let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
-  let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
   let dynamicAnddynamicAndFnToObject = () => (dynamicAnddynamicAndFnToObject = dart.constFn(dart.definiteFunctionType(core.Object, [dart.dynamic, dart.dynamic, dynamicTodynamic()])))();
   let FToF = () => (FToF = dart.constFn(dart.definiteFunctionType(F => [F, [F]])))();
   let FunctionToFunction = () => (FunctionToFunction = dart.constFn(dart.definiteFunctionType(core.Function, [core.Function])))();
@@ -722,35 +926,35 @@
   let VoidToMirrorSystem = () => (VoidToMirrorSystem = dart.constFn(dart.definiteFunctionType(mirrors.MirrorSystem, [])))();
   let ObjectToInstanceMirror = () => (ObjectToInstanceMirror = dart.constFn(dart.definiteFunctionType(mirrors.InstanceMirror, [core.Object])))();
   let TypeToClassMirror = () => (TypeToClassMirror = dart.constFn(dart.definiteFunctionType(mirrors.ClassMirror, [core.Type])))();
-  let EventTovoid$ = () => (EventTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Event])))();
+  let EventToNull = () => (EventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Event])))();
   let RequestToFutureOfT = () => (RequestToFutureOfT = dart.constFn(dart.definiteFunctionType(T => [async.Future$(T), [indexed_db.Request]])))();
   let dynamicToTo = () => (dynamicToTo = dart.constFn(dart.definiteFunctionType(To => [To, [dart.dynamic]])))();
-  let EventTodynamic = () => (EventTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.Event])))();
   let NodeTobool$ = () => (NodeTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [html$.Node])))();
   let MapOfString$dynamicTobool = () => (MapOfString$dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [MapOfString$dynamic()])))();
   let UriAndListOfStringAnddynamicToFutureOfIsolate = () => (UriAndListOfStringAnddynamicToFutureOfIsolate = dart.constFn(dart.definiteFunctionType(FutureOfIsolate(), [core.Uri, ListOfString(), dart.dynamic])))();
   let TypeAnddynamicTodynamic = () => (TypeAnddynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, dart.dynamic])))();
-  let FileSystemTovoid = () => (FileSystemTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.FileSystem])))();
-  let FileErrorTovoid = () => (FileErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.FileError])))();
-  let EntryTovoid = () => (EntryTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Entry])))();
+  let FileSystemToNull = () => (FileSystemToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.FileSystem])))();
+  let FileErrorToNull = () => (FileErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.FileError])))();
+  let EntryToNull = () => (EntryToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Entry])))();
   let dynamicToCssStyleDeclaration = () => (dynamicToCssStyleDeclaration = dart.constFn(dart.definiteFunctionType(html$.CssStyleDeclaration, [dart.dynamic])))();
   let CssStyleDeclarationTovoid = () => (CssStyleDeclarationTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.CssStyleDeclaration])))();
-  let MetadataTovoid = () => (MetadataTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Metadata])))();
-  let ListOfEntryTovoid = () => (ListOfEntryTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfEntry()])))();
+  let MetadataToNull = () => (MetadataToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Metadata])))();
+  let ListOfEntryToNull = () => (ListOfEntryToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfEntry()])))();
   let ElementTobool$ = () => (ElementTobool$ = dart.constFn(dart.definiteFunctionType(core.bool, [html$.Element])))();
-  let FileWriterTovoid = () => (FileWriterTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.FileWriter])))();
-  let FileTovoid = () => (FileTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.File])))();
-  let GeopositionTovoid = () => (GeopositionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Geoposition])))();
-  let PositionErrorTovoid = () => (PositionErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.PositionError])))();
+  let FileWriterToNull = () => (FileWriterToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.FileWriter])))();
+  let FileToNull = () => (FileToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.File])))();
+  let GeopositionToNull = () => (GeopositionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.Geoposition])))();
+  let PositionErrorToNull = () => (PositionErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.PositionError])))();
   let HttpRequestToString = () => (HttpRequestToString = dart.constFn(dart.definiteFunctionType(core.String, [html$.HttpRequest])))();
-  let ProgressEventTovoid$ = () => (ProgressEventTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [html$.ProgressEvent])))();
-  let ListOfSourceInfoTovoid = () => (ListOfSourceInfoTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [ListOfSourceInfo()])))();
-  let MediaStreamTovoid = () => (MediaStreamTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.MediaStream])))();
-  let NavigatorUserMediaErrorTovoid = () => (NavigatorUserMediaErrorTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.NavigatorUserMediaError])))();
-  let RtcSessionDescriptionTovoid = () => (RtcSessionDescriptionTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.RtcSessionDescription])))();
-  let RtcStatsResponseTovoid = () => (RtcStatsResponseTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.RtcStatsResponse])))();
+  let ProgressEventToNull = () => (ProgressEventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.ProgressEvent])))();
+  let ListOfSourceInfoToNull = () => (ListOfSourceInfoToNull = dart.constFn(dart.definiteFunctionType(core.Null, [ListOfSourceInfo()])))();
+  let MediaStreamToNull = () => (MediaStreamToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.MediaStream])))();
+  let NavigatorUserMediaErrorToNull = () => (NavigatorUserMediaErrorToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.NavigatorUserMediaError])))();
+  let RtcSessionDescriptionToNull = () => (RtcSessionDescriptionToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.RtcSessionDescription])))();
+  let RtcStatsResponseToNull = () => (RtcStatsResponseToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.RtcStatsResponse])))();
   let OptionElementTobool = () => (OptionElementTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.OptionElement])))();
-  let numTovoid = () => (numTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.num])))();
+  let numToNull = () => (numToNull = dart.constFn(dart.definiteFunctionType(core.Null, [core.num])))();
+  let BeforeUnloadEventToNull = () => (BeforeUnloadEventToNull = dart.constFn(dart.definiteFunctionType(core.Null, [html$.BeforeUnloadEvent])))();
   let ElementTovoid$ = () => (ElementTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Element])))();
   let ElementToCssClassSet = () => (ElementToCssClassSet = dart.constFn(dart.definiteFunctionType(html$.CssClassSet, [html$.Element])))();
   let CssClassSetImplTovoid = () => (CssClassSetImplTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html_common.CssClassSetImpl])))();
@@ -758,6 +962,7 @@
   let SetOfStringTobool = () => (SetOfStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [SetOfString()])))();
   let SetOfStringTovoid = () => (SetOfStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [SetOfString()])))();
   let EventAndStringTobool = () => (EventAndStringTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.Event, core.String])))();
+  let EventTodynamic = () => (EventTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.Event])))();
   let KeyEventTobool = () => (KeyEventTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.KeyEvent])))();
   let NodeValidatorTobool = () => (NodeValidatorTobool = dart.constFn(dart.definiteFunctionType(core.bool, [html$.NodeValidator])))();
   let NodeAndNodeToint = () => (NodeAndNodeToint = dart.constFn(dart.definiteFunctionType(core.int, [html$.Node, html$.Node])))();
@@ -773,14 +978,12 @@
   let NodeAndNodeTovoid = () => (NodeAndNodeTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Node, html$.Node])))();
   let dynamicToImageData = () => (dynamicToImageData = dart.constFn(dart.definiteFunctionType(html$.ImageData, [dart.dynamic])))();
   let ImageDataTodynamic = () => (ImageDataTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.ImageData])))();
-  let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
   let Map__Todynamic = () => (Map__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Map], [dynamicTovoid()])))();
   let ListOfStringToList = () => (ListOfStringToList = dart.constFn(dart.definiteFunctionType(core.List, [ListOfString()])))();
-  let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
   let DateTimeTodynamic = () => (DateTimeTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.DateTime])))();
-  let dynamic__Todynamic$ = () => (dynamic__Todynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], {mustCopy: dart.dynamic})))();
+  let dynamic__Todynamic = () => (dynamic__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic], {mustCopy: dart.dynamic})))();
   let NodeToElement = () => (NodeToElement = dart.constFn(dart.definiteFunctionType(html$.Element, [html$.Node])))();
-  let AudioBufferTovoid = () => (AudioBufferTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [web_audio.AudioBuffer])))();
+  let AudioBufferToNull = () => (AudioBufferToNull = dart.constFn(dart.definiteFunctionType(core.Null, [web_audio.AudioBuffer])))();
   dart.mixin = function(base, ...mixins) {
     class Mixin extends base {}
     for (let m of mixins) {
@@ -799,6 +1002,27 @@
           dart.copyProperties(s, m[dart._methodSig]);
         }
         return s;
+      },
+      fields: () => {
+        let s = {};
+        for (let m of mixins) {
+          dart.copyProperties(s, m[dart._fieldSig]);
+        }
+        return s;
+      },
+      getters: () => {
+        let s = {};
+        for (let m of mixins) {
+          dart.copyProperties(s, m[dart._getterSig]);
+        }
+        return s;
+      },
+      setters: () => {
+        let s = {};
+        for (let m of mixins) {
+          dart.copyProperties(s, m[dart._setterSig]);
+        }
+        return s;
       }
     });
     Mixin[dart._mixins] = mixins;
@@ -901,15 +1125,33 @@
   dart.getGenericTypeCtor = function(value) {
     return value[dart._genericTypeCtor];
   };
-  dart.getMethodType = function(obj, name) {
-    let type = obj == null ? core.Object : obj.__proto__.constructor;
-    return dart.getMethodTypeFromType(type, name);
+  dart.getType = function(obj) {
+    return obj == null ? core.Object : obj.__proto__.constructor;
   };
-  dart.getMethodTypeFromType = function(type, name) {
+  dart.isJsInterop = function(obj) {
+    if (typeof obj === "function") {
+      return dart._getRuntimeType(obj) == null;
+    }
+    if (typeof obj !== "object") return false;
+    if (dart.getExtensionType(obj) != null) return false;
+    return !(obj instanceof core.Object);
+  };
+  dart.getMethodType = function(type, name) {
     let sigObj = type[dart._methodSig];
     if (sigObj === void 0) return void 0;
     return sigObj[name];
   };
+  dart.getFieldType = function(type, name) {
+    let sigObj = type[dart._fieldSig];
+    if (sigObj === void 0) return void 0;
+    let fieldType = sigObj[name];
+    return fieldType instanceof Array ? fieldType[0] : fieldType;
+  };
+  dart.getSetterType = function(type, name) {
+    let sigObj = type[dart._setterSig];
+    if (sigObj === void 0) return void 0;
+    return sigObj[name];
+  };
   dart.classGetConstructorType = function(cls, name) {
     if (!name) name = 'new';
     if (cls === void 0) return void 0;
@@ -921,7 +1163,7 @@
   dart.bind = function(obj, name, f) {
     if (f === void 0) f = obj[name];
     f = f.bind(obj);
-    let sig = dart.getMethodType(obj, name);
+    let sig = dart.getMethodType(dart.getType(obj), name);
     dart.assert(sig);
     dart.tag(f, sig);
     return f;
@@ -935,7 +1177,8 @@
   dart._setInstanceSignature = function(f, sigF, kind) {
     dart.defineMemoizedGetter(f, kind, () => {
       let sigObj = sigF();
-      sigObj.__proto__ = f.__proto__[kind];
+      let proto = f.__proto__;
+      sigObj.__proto__ = kind in proto ? proto[kind] : null;
       return sigObj;
     });
   };
@@ -996,8 +1239,22 @@
     dart._setStaticSetterSignature(f, staticSetters);
     dart._setStaticTypes(f, names);
   };
-  dart.hasMethod = function(obj, name) {
-    return dart.getMethodType(obj, name) !== void 0;
+  dart._hasSigEntry = function(type, sigF, name) {
+    let sigObj = type[sigF];
+    if (sigObj === void 0) return false;
+    return name in sigObj;
+  };
+  dart.hasMethod = function(type, name) {
+    return dart._hasSigEntry(type, dart._methodSig, name);
+  };
+  dart.hasGetter = function(type, name) {
+    return dart._hasSigEntry(type, dart._getterSig, name);
+  };
+  dart.hasSetter = function(type, name) {
+    return dart._hasSigEntry(type, dart._setterSig, name);
+  };
+  dart.hasField = function(type, name) {
+    return dart._hasSigEntry(type, dart._fieldSig, name);
   };
   dart.defineNamedConstructor = function(clazz, name) {
     let proto = clazz.prototype;
@@ -1058,9 +1315,15 @@
     if (!jsProto) return;
     jsProto[dart._extensionType] = dartExtType;
     dart._installProperties(jsProto, extProto);
-    let originalSigFn = dart.getOwnPropertyDescriptor(dartExtType, dart._methodSig).get;
-    dart.assert(originalSigFn);
-    dart.defineMemoizedGetter(jsType, dart._methodSig, originalSigFn);
+    function updateSig(sigF) {
+      let originalSigFn = dart.getOwnPropertyDescriptor(dartExtType, sigF).get;
+      dart.assert(originalSigFn);
+      dart.defineMemoizedGetter(jsType, sigF, originalSigFn);
+    }
+    updateSig(dart._methodSig);
+    updateSig(dart._fieldSig);
+    updateSig(dart._getterSig);
+    updateSig(dart._setterSig);
   };
   dart.defineExtensionMembers = function(type, methodNames) {
     let proto = type.prototype;
@@ -1068,14 +1331,23 @@
       let method = dart.getOwnPropertyDescriptor(proto, name);
       dart.defineProperty(proto, dart.getExtensionSymbol(name), method);
     }
-    let originalSigFn = dart.getOwnPropertyDescriptor(type, dart._methodSig).get;
-    dart.defineMemoizedGetter(type, dart._methodSig, function() {
-      let sig = originalSigFn();
-      for (let name of methodNames) {
-        sig[dart.getExtensionSymbol(name)] = sig[name];
-      }
-      return sig;
-    });
+    function upgradeSig(sigF) {
+      let originalSigFn = dart.getOwnPropertyDescriptor(type, sigF).get;
+      dart.defineMemoizedGetter(type, sigF, function() {
+        let sig = originalSigFn();
+        let propertyNames = Object.getOwnPropertyNames(sig);
+        for (let name of methodNames) {
+          if (name in sig) {
+            sig[dart.getExtensionSymbol(name)] = sig[name];
+          }
+        }
+        return sig;
+      });
+    }
+    upgradeSig(dart._methodSig);
+    upgradeSig(dart._fieldSig);
+    upgradeSig(dart._getterSig);
+    upgradeSig(dart._setterSig);
   };
   dart.setType = function(obj, type) {
     obj.__proto__ = type.prototype;
@@ -1191,7 +1463,7 @@
   };
   const _wrappedType = Symbol('_wrappedType');
   dart.unwrapType = function(obj) {
-    return dart.dload(obj, _wrappedType);
+    return obj[_wrappedType];
   };
   dart._getRuntimeType = function(value) {
     return value[dart._runtimeType];
@@ -1276,6 +1548,65 @@
       return dart._asInstanceOfLazyJSType(object, this);
     };
   };
+  dart._memoizeArray = function(map, arr, create) {
+    let len = arr.length;
+    map = dart._lookupNonTerminal(map, len);
+    for (var i = 0; i < len - 1; ++i) {
+      map = dart._lookupNonTerminal(map, arr[i]);
+    }
+    let result = map.get(arr[len - 1]);
+    if (result !== void 0) return result;
+    map.set(arr[len - 1], result = create());
+    return result;
+  };
+  dart._normalizeParameter = function(a) {
+    if (a instanceof Array) {
+      let result = [];
+      result.push(a[0] == dart.dynamic ? dart.bottom : a[0]);
+      result.push(a.slice(1));
+      return result;
+    }
+    return a == dart.dynamic ? dart.bottom : a;
+  };
+  dart._canonicalizeArray = function(definite, array, map) {
+    let arr = definite ? array : array.map(dart._normalizeParameter);
+    return dart._memoizeArray(map, arr, () => arr);
+  };
+  dart._canonicalizeNamed = function(definite, named, map) {
+    let key = [];
+    let names = dart.getOwnPropertyNames(named);
+    let r = {};
+    for (var i = 0; i < names.length; ++i) {
+      let name = names[i];
+      let type = named[name];
+      if (!definite) r[name] = type = dart._normalizeParameter(type);
+      key.push(name);
+      key.push(type);
+    }
+    if (!definite) named = r;
+    return dart._memoizeArray(map, key, () => named);
+  };
+  dart._lookupNonTerminal = function(map, key) {
+    let result = map.get(key);
+    if (result !== void 0) return result;
+    map.set(key, result = new Map());
+    return result;
+  };
+  dart._createSmall = function(count, definite, returnType, required) {
+    let map = dart._fnTypeSmallMap[count];
+    let args = definite ? required : required.map(dart._normalizeParameter);
+    for (var i = 0; i < count; ++i) {
+      map = dart._lookupNonTerminal(map, args[i]);
+    }
+    let result = map.get(returnType);
+    if (result !== void 0) return result;
+    result = new dart.FunctionType(returnType, args, [], {});
+    map.set(returnType, result);
+    return result;
+  };
+  dart.typedef = function(name, closure) {
+    return new dart.Typedef(name, closure);
+  };
   dart._functionType = function(definite, returnType, args, extra) {
     if (args === void 0 && extra === void 0) {
       const fnTypeParts = returnType;
@@ -1294,9 +1625,6 @@
   dart.definiteFunctionType = function(returnType, args, extra) {
     return dart._functionType(true, returnType, args, extra);
   };
-  dart.typedef = function(name, closure) {
-    return new dart.Typedef(name, closure);
-  };
   dart.typeName = function(type) {
     if (type === void 0) return "undefined type";
     if (type === null) return "null type";
@@ -1332,17 +1660,17 @@
   };
   dart.getImplicitFunctionType = function(type) {
     if (dart.test(dart.isFunctionType(type))) return type;
-    return dart.getMethodTypeFromType(type, 'call');
+    return dart.getMethodType(type, 'call');
   };
   dart.isFunctionType = function(type) {
     return type instanceof dart.AbstractFunctionType || type === core.Function;
   };
-  dart.isLazyJSSubtype = function(t1, t2, covariant) {
+  dart.isLazyJSSubtype = function(t1, t2, isCovariant) {
     if (dart.equals(t1, t2)) return true;
     if (t1[_jsTypeCallback] == null || t2[_jsTypeCallback] == null) return true;
-    return dart.isClassSubType(t1[_rawJSType], t2[_rawJSType], covariant);
+    return dart.isClassSubType(t1[_rawJSType], t2[_rawJSType], isCovariant);
   };
-  dart.isFunctionSubtype = function(ft1, ft2, covariant) {
+  dart.isFunctionSubtype = function(ft1, ft2, isCovariant) {
     if (ft2 === core.Function) {
       return true;
     }
@@ -1354,26 +1682,26 @@
     let args1 = ft1.args;
     let args2 = ft2.args;
     if (args1.length > args2.length) {
-      return covariant ? false : null;
+      return isCovariant ? false : null;
     }
     for (let i = 0; i < args1.length; ++i) {
-      if (!dart._isSubtype(args2[i], args1[i], !covariant)) {
+      if (!dart._isSubtype(args2[i], args1[i], !isCovariant)) {
         return null;
       }
     }
     let optionals1 = ft1.optionals;
     let optionals2 = ft2.optionals;
     if (args1.length + optionals1.length < args2.length + optionals2.length) {
-      return covariant ? false : null;
+      return isCovariant ? false : null;
     }
     let j = 0;
     for (let i = args1.length; i < args2.length; ++i, ++j) {
-      if (!dart._isSubtype(args2[i], optionals1[j], !covariant)) {
+      if (!dart._isSubtype(args2[i], optionals1[j], !isCovariant)) {
         return null;
       }
     }
     for (let i = 0; i < optionals2.length; ++i, ++j) {
-      if (!dart._isSubtype(optionals2[i], optionals1[j], !covariant)) {
+      if (!dart._isSubtype(optionals2[i], optionals1[j], !isCovariant)) {
         return null;
       }
     }
@@ -1385,15 +1713,14 @@
       let n1 = named1[name];
       let n2 = named2[name];
       if (n1 === void 0) {
-        return covariant ? false : null;
+        return isCovariant ? false : null;
       }
-      if (!dart._isSubtype(n2, n1, !covariant)) {
+      if (!dart._isSubtype(n2, n1, !isCovariant)) {
         return null;
       }
     }
-    if (ret2 === dart.void) return true;
-    if (ret1 === dart.void) return ret2 === dart.dynamic;
-    if (!dart._isSubtype(ret1, ret2, covariant)) return null;
+    if (ret1 === dart.void) return dart._isTop(ret2);
+    if (!dart._isSubtype(ret1, ret2, isCovariant)) return null;
     return true;
   };
   dart._subtypeMemo = function(f) {
@@ -1413,12 +1740,15 @@
     };
   };
   dart._isBottom = function(type) {
-    return type == dart.bottom;
+    return type == dart.bottom || type == core.Null;
   };
   dart._isTop = function(type) {
-    return type == core.Object || type == dart.dynamic;
+    if (dart.getGenericClass(type) === dart.getGenericClass(async.FutureOr)) {
+      return dart._isTop(dart.getGenericArgs(type)[0]);
+    }
+    return type == core.Object || type == dart.dynamic || type == dart.void;
   };
-  dart._isSubtype = function(t1, t2, covariant) {
+  dart._isSubtype = function(t1, t2, isCovariant) {
     if (t1 === t2) return true;
     if (dart._isTop(t2) || dart._isBottom(t1)) {
       return true;
@@ -1429,20 +1759,20 @@
       return false;
     }
     if (!(t1 instanceof dart.AbstractFunctionType) && !(t2 instanceof dart.AbstractFunctionType)) {
-      let result = dart.isClassSubType(t1, t2, covariant);
+      let result = dart.isClassSubType(t1, t2, isCovariant);
       if (result === true || result === null) return result;
     }
     t1 = dart.getImplicitFunctionType(t1);
     if (!t1) return false;
     if (dart.isFunctionType(t1) && dart.isFunctionType(t2)) {
-      return dart.isFunctionSubtype(t1, t2, covariant);
+      return dart.isFunctionSubtype(t1, t2, isCovariant);
     }
     if (t1 instanceof dart.LazyJSType && t2 instanceof dart.LazyJSType) {
-      return dart.isLazyJSSubtype(t1, t2, covariant);
+      return dart.isLazyJSSubtype(t1, t2, isCovariant);
     }
     return false;
   };
-  dart.isClassSubType = function(t1, t2, covariant) {
+  dart.isClassSubType = function(t1, t2, isCovariant) {
     if (t1 == t2) return true;
     if (t1 == core.Object) return false;
     if (t1 == null) return t2 == core.Object || t2 == dart.dynamic;
@@ -1460,16 +1790,25 @@
       }
       dart.assert(length == typeArguments2.length);
       for (let i = 0; i < length; ++i) {
-        let result = dart._isSubtype(typeArguments1[i], typeArguments2[i], covariant);
+        let result = dart._isSubtype(typeArguments1[i], typeArguments2[i], isCovariant);
         if (!result) {
           return result;
         }
       }
       return true;
     }
+    if (raw1 === dart.getGenericClass(async.FutureOr)) {
+      let t1TypeArg = dart.getGenericArgs(t1)[0];
+      let t1Future = dart.getGenericClass(async.Future)(t1TypeArg);
+      return dart.isSubtype(t1Future, t2) && dart.isSubtype(t1TypeArg, t2);
+    } else if (raw2 === dart.getGenericClass(async.FutureOr)) {
+      let t2TypeArg = dart.getGenericArgs(t2)[0];
+      let t2Future = dart.getGenericClass(async.Future)(t2TypeArg);
+      return dart.isSubtype(t1, t2Future) || dart.isSubtype(t1, t2TypeArg);
+    }
     let indefinite = false;
     function definitive(t1, t2) {
-      let result = dart.isClassSubType(t1, t2, covariant);
+      let result = dart.isClassSubType(t1, t2, isCovariant);
       if (result == null) {
         indefinite = true;
         return false;
@@ -1514,32 +1853,47 @@
     }
     return true;
   };
+  dart.trapRuntimeErrors = function(flag) {
+    dart._trapRuntimeErrors = flag;
+  };
   dart.throwCastError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.CastErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.CastErrorImplementation(object, found, expected));
   };
   dart.throwTypeError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.TypeErrorImplementation(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.TypeErrorImplementation(object, found, expected));
   };
   dart.throwStrongModeCastError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.StrongModeCastError(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.StrongModeCastError(object, found, expected));
   };
   dart.throwStrongModeTypeError = function(object, actual, type) {
-    debugger;
-    dart.throw(new _js_helper.StrongModeTypeError(object, dart.typeName(actual), dart.typeName(type)));
+    var found = dart.typeName(actual);
+    var expected = dart.typeName(type);
+    if (dart._trapRuntimeErrors) debugger;
+    dart.throw(new _js_helper.StrongModeTypeError(object, found, expected));
   };
   dart.throwUnimplementedError = function(message) {
-    debugger;
+    if (dart._trapRuntimeErrors) debugger;
     dart.throw(new core.UnimplementedError(message));
   };
-  dart.throwAssertionError = function() {
-    debugger;
-    dart.throw(new core.AssertionError());
+  dart.throwAssertionError = function(message) {
+    if (message === void 0) message = null;
+    return (() => {
+      if (dart._trapRuntimeErrors) debugger;
+      let error = message != null ? new _js_helper.AssertionErrorWithMessage(message()) : new core.AssertionError();
+      dart.throw(error);
+    })();
   };
   dart.throwNullValueError = function() {
-    debugger;
+    if (dart._trapRuntimeErrors) debugger;
     dart.throw(new core.NoSuchMethodError(null, new core.Symbol('<Unexpected Null Value>'), null, null, null));
   };
   dart.syncStar = function(gen, E, ...args) {
@@ -1563,7 +1917,7 @@
       }
       return future.then(dart.dynamic)(onValue, {onError: onError});
     }
-    return dart.getGenericClass(async.Future)(T).new(function() {
+    return dart.getGenericClass(async.Future)(T).microtask(function() {
       iter = gen.apply(null, args)[Symbol.iterator]();
       return onValue();
     });
@@ -1575,24 +1929,70 @@
     let f = dart._canonicalMember(obj, field);
     dart._trackCall(obj);
     if (f != null) {
-      if (dart.test(dart.hasMethod(obj, f))) return dart.bind(obj, f, void 0);
-      return obj[f];
+      let type = dart.getType(obj);
+      if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
+      if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
+      if (dart.test(dart.isJsInterop(obj))) return obj[f];
     }
-    return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(field), [], {isGetter: true}));
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
+  };
+  dart.dloadMirror = function(obj, field) {
+    let f = dart._canonicalMember(obj, field);
+    dart._trackCall(obj);
+    if (f != null) {
+      let type = dart.getType(obj);
+      if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
+      if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
+    }
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
+  };
+  dart._stripGenericArguments = function(type) {
+    let genericClass = dart.getGenericClass(type);
+    if (genericClass != null) return genericClass();
+    return type;
+  };
+  dart.dputMirror = function(obj, field, value) {
+    let f = dart._canonicalMember(obj, field);
+    dart._trackCall(obj);
+    if (f != null) {
+      let objType = dart.getType(obj);
+      let setterType = dart.getSetterType(objType, f);
+      if (setterType != void 0) {
+        return obj[f] = dart.check(value, dart._stripGenericArguments(setterType.args[0]));
+      } else {
+        let fieldType = dart.getFieldType(objType, f);
+        if (fieldType != void 0) {
+          return obj[f] = dart.check(value, dart._stripGenericArguments(fieldType));
+        }
+      }
+    }
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [value], {isSetter: true}));
   };
   dart.dput = function(obj, field, value) {
     let f = dart._canonicalMember(obj, field);
     dart._trackCall(obj);
     if (f != null) {
-      return obj[f] = value;
+      let objType = dart.getType(obj);
+      let setterType = dart.getSetterType(objType, f);
+      if (setterType != void 0) {
+        return obj[f] = dart.check(value, setterType.args[0]);
+      } else {
+        let fieldType = dart.getFieldType(objType, f);
+        if (fieldType != void 0) {
+          return obj[f] = dart.check(value, fieldType);
+        }
+        if (dart.test(dart.isJsInterop(obj))) {
+          return obj[f] = value;
+        }
+      }
     }
-    return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(field), [value], {isSetter: true}));
+    return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [value], {isSetter: true}));
   };
   dart._checkApply = function(type, actuals) {
     if (actuals.length < type.args.length) return false;
     let index = 0;
     for (let i = 0; i < type.args.length; ++i) {
-      if (!dart.instanceOfOrNull(actuals[i], type.args[i])) return false;
+      dart.check(actuals[i], type.args[i]);
       ++index;
     }
     if (actuals.length == type.args.length) return true;
@@ -1600,7 +2000,7 @@
     if (type.optionals.length > 0) {
       if (extras > type.optionals.length) return false;
       for (let i = 0, j = index; i < extras; ++i, ++j) {
-        if (!dart.instanceOfOrNull(actuals[j], type.optionals[i])) return false;
+        dart.check(actuals[j], type.optionals[i]);
       }
       return true;
     }
@@ -1613,12 +2013,40 @@
       if (!dart.hasOwnProperty.call(type.named, name)) {
         return false;
       }
-      if (!dart.instanceOfOrNull(opts[name], type.named[name])) return false;
+      dart.check(opts[name], type.named[name]);
     }
     return true;
   };
+  dart._toSymbolName = function(symbol) {
+    let str = symbol.toString();
+    return str.substring(7, str.length - 1);
+  };
+  dart._toDisplayName = function(name) {
+    if (name[0] === '_') {
+      switch (name) {
+        case '_get':
+        {
+          return '[]';
+        }
+        case '_set':
+        {
+          return '[]=';
+        }
+        case '_negate':
+        {
+          return 'unary-';
+        }
+        case '_constructor':
+        case '_prototype':
+        {
+          return name.substring(1);
+        }
+      }
+    }
+    return name;
+  };
   dart._dartSymbol = function(name) {
-    return dart.const(core.Symbol.new(name.toString()));
+    return core.Symbol._check(typeof name === "symbol" ? dart.const(new _internal.Symbol.es6(dart._toSymbolName(name), name)) : dart.const(core.Symbol.new(dart._toDisplayName(name))));
   };
   dart.extractNamedArgs = function(args) {
     if (args.length > 0) {
@@ -1637,7 +2065,7 @@
     }
     if (!(f instanceof Function)) {
       if (f != null) {
-        ftype = dart.getMethodType(f, 'call');
+        ftype = dart.getMethodType(dart.getType(f), 'call');
         f = f.call;
       }
       if (!(f instanceof Function)) {
@@ -1742,16 +2170,17 @@
       }
     }
     let actualTypeName = dart.typeName(actual);
-    let o = dart._callMethodStats[dartx.putIfAbsent](dart.str`${actualTypeName} <${src}>`, dart.fn(() => new dart._MethodStats(core.String._check(actualTypeName), src), VoidTo_MethodStats()));
+    let o = dart._callMethodStats[dartx.putIfAbsent](dart.str`${actualTypeName} <${src}>`, dart.fn(() => new dart._MethodStats(actualTypeName, src), VoidTo_MethodStats()));
     o.count = dart.notNull(o.count) + 1;
   };
   dart._callMethod = function(obj, name, typeArgs, args, displayName) {
     let symbol = dart._canonicalMember(obj, name);
     if (symbol == null) {
-      return dart.noSuchMethod(obj, new dart.InvocationImpl(core.String._check(displayName), core.List._check(args), {isMethod: true}));
+      return dart.noSuchMethod(obj, new dart.InvocationImpl(displayName, core.List._check(args), {isMethod: true}));
     }
     let f = obj != null ? obj[symbol] : null;
-    let ftype = dart.getMethodType(obj, symbol);
+    let type = dart.getType(obj);
+    let ftype = dart.getMethodType(type, symbol);
     return dart._checkAndCall(f, ftype, obj, typeArgs, args, displayName);
   };
   dart.dsend = function(obj, method, ...args) {
@@ -1796,6 +2225,9 @@
     return false;
   };
   dart.is = function(obj, type) {
+    if (obj == null) {
+      return type == core.Null || dart._isTop(type);
+    }
     let result = dart.strongInstanceOf(obj, type);
     if (result !== null) return result;
     let actual = dart.getReifiedType(obj);
@@ -1897,18 +2329,19 @@
       return map;
     })();
   };
-  dart.assert = function(condition) {
-    if (!condition) dart.throwAssertionError();
+  dart.assert = function(condition, message) {
+    if (message === void 0) message = null;
+    return (() => {
+      if (!condition) dart.throwAssertionError(message);
+    })();
   };
   dart.throw = function(obj) {
-    if (obj != null && (typeof obj == 'object' || typeof obj == 'function')) {
-      dart._stack.set(obj, new Error());
-    }
+    dart._stack = new Error();
     throw obj;
   };
   dart.getError = function(exception) {
-    var stack = dart._stack.get(exception);
-    return stack !== void 0 ? stack : exception;
+    var stack = dart._stack;
+    return stack !== null ? stack : exception;
   };
   dart.stackPrint = function(exception) {
     var error = dart.getError(exception);
@@ -2070,11 +2503,11 @@
     return Object.getOwnPropertySymbols(obj);
   };
   dart.throwStrongModeError = function(message) {
-    debugger;
+    if (dart.test(dart._trapRuntimeErrors)) debugger;
     throw new _js_helper.StrongModeErrorImplementation(message);
   };
   dart.throwInternalError = function(message) {
-    debugger;
+    if (dart.test(dart._trapRuntimeErrors)) debugger;
     throw Error(message);
   };
   dart.getOwnNamesAndSymbols = function(obj) {
@@ -2141,7 +2574,56 @@
   dart.copyProperties = function(to, from) {
     return dart.copyTheseProperties(to, from, dart.getOwnNamesAndSymbols(from));
   };
-  dart.global = typeof window == "undefined" ? global : window;
+  dart.global = (function() {
+    if (typeof NodeList !== "undefined") {
+      NodeList.prototype.get = function(i) {
+        return this[i];
+      };
+      NamedNodeMap.prototype.get = function(i) {
+        return this[i];
+      };
+      DOMTokenList.prototype.get = function(i) {
+        return this[i];
+      };
+      HTMLCollection.prototype.get = function(i) {
+        return this[i];
+      };
+      if (typeof PannerNode == "undefined") {
+        let audioContext;
+        if (typeof AudioContext == "undefined" && typeof webkitAudioContext != "undefined") {
+          audioContext = new webkitAudioContext();
+        } else {
+          audioContext = new AudioContext();
+          window.StereoPannerNode = audioContext.createStereoPanner().constructor;
+        }
+        window.PannerNode = audioContext.createPanner().constructor;
+      }
+      if (typeof AudioSourceNode == "undefined") {
+        window.AudioSourceNode = MediaElementAudioSourceNode.__proto__;
+      }
+      if (typeof FontFaceSet == "undefined") {
+        window.FontFaceSet = document.fonts.__proto__.constructor;
+      }
+      if (typeof MemoryInfo == "undefined") {
+        if (typeof window.performance.memory != "undefined") {
+          window.MemoryInfo = window.performance.memory.constructor;
+        }
+      }
+      if (typeof Geolocation == "undefined") {
+        navigator.geolocation.constructor;
+      }
+      if (typeof Animation == "undefined") {
+        let d = document.createElement('div');
+        if (typeof d.animate != "undefined") {
+          window.Animation = d.animate(d).constructor;
+        }
+      }
+      if (typeof SourceBufferList == "undefined") {
+        window.SourceBufferList = new MediaSource().sourceBuffers.constructor;
+      }
+    }
+    return typeof window == "undefined" ? global : window;
+  })();
   dart.JsSymbol = Symbol;
   dart._mixins = Symbol("mixins");
   dart.implements = Symbol("implements");
@@ -2293,198 +2775,189 @@
       this[_wrappedType] = wrappedType;
     }
     toString() {
-      return core.String._check(dart.typeName(this[_wrappedType]));
+      return dart.typeName(this[_wrappedType]);
     }
   };
   dart.setSignature(dart.WrappedType, {
     constructors: () => ({new: dart.definiteFunctionType(dart.WrappedType, [dart.dynamic])}),
     fields: () => ({[_wrappedType]: dart.dynamic})
   });
+  const _stringValue = Symbol('_stringValue');
   dart.AbstractFunctionType = class AbstractFunctionType extends dart.TypeRep {
-    constructor() {
-      super();
-      this._stringValue = null;
+    new() {
+      this[_stringValue] = null;
+      super.new();
     }
     toString() {
       return this.name;
     }
     get name() {
-      if (this._stringValue) return this._stringValue;
+      if (this[_stringValue] != null) return this[_stringValue];
       let buffer = '(';
       for (let i = 0; i < this.args.length; ++i) {
         if (i > 0) {
-          buffer += ', ';
+          buffer = dart.notNull(buffer) + ', ';
         }
-        buffer += dart.typeName(this.args[i]);
+        buffer = dart.notNull(buffer) + dart.notNull(dart.typeName(this.args[i]));
       }
       if (this.optionals.length > 0) {
-        if (this.args.length > 0) buffer += ', ';
-        buffer += '[';
+        if (this.args.length > 0) {
+          buffer = dart.notNull(buffer) + ', ';
+        }
+        buffer = dart.notNull(buffer) + '[';
         for (let i = 0; i < this.optionals.length; ++i) {
           if (i > 0) {
-            buffer += ', ';
+            buffer = dart.notNull(buffer) + ', ';
           }
-          buffer += dart.typeName(this.optionals[i]);
+          buffer = dart.notNull(buffer) + dart.notNull(dart.typeName(this.optionals[i]));
         }
-        buffer += ']';
+        buffer = dart.notNull(buffer) + ']';
       } else if (Object.keys(this.named).length > 0) {
-        if (this.args.length > 0) buffer += ', ';
-        buffer += '{';
-        let names = dart.getOwnPropertyNames(this.named).sort();
+        if (this.args.length > 0) {
+          buffer = dart.notNull(buffer) + ', ';
+        }
+        buffer = dart.notNull(buffer) + '{';
+        let names = dart.getOwnPropertyNames(this.named);
+        names.sort();
         for (let i = 0; i < names.length; ++i) {
           if (i > 0) {
-            buffer += ', ';
+            buffer = dart.notNull(buffer) + ', ';
           }
-          buffer += names[i] + ': ' + dart.typeName(this.named[names[i]]);
+          let typeNameString = dart.typeName(this.named[names[i]]);
+          buffer = dart.notNull(buffer) + dart.str`${names[i]}: ${typeNameString}`;
         }
-        buffer += '}';
+        buffer = dart.notNull(buffer) + '}';
       }
-      buffer += ') -> ' + dart.typeName(this.returnType);
-      this._stringValue = buffer;
+      let returnTypeName = dart.typeName(this.returnType);
+      buffer = dart.notNull(buffer) + dart.str`) -> ${returnTypeName}`;
+      this[_stringValue] = buffer;
       return buffer;
     }
   };
+  dart.setSignature(dart.AbstractFunctionType, {
+    constructors: () => ({new: dart.definiteFunctionType(dart.AbstractFunctionType, [])}),
+    fields: () => ({[_stringValue]: core.String})
+  });
   dart._fnTypeNamedArgMap = new Map();
   dart._fnTypeArrayArgMap = new Map();
   dart._fnTypeTypeMap = new Map();
   dart._fnTypeSmallMap = [new Map(), new Map(), new Map()];
+  const _process = Symbol('_process');
   dart.FunctionType = class FunctionType extends dart.AbstractFunctionType {
-    static _memoizeArray(map, arr, create) {
-      let len = arr.length;
-      map = FunctionType._lookupNonTerminal(map, len);
-      for (var i = 0; i < len - 1; ++i) {
-        map = FunctionType._lookupNonTerminal(map, arr[i]);
-      }
-      let result = map.get(arr[len - 1]);
-      if (result !== void 0) return result;
-      map.set(arr[len - 1], result = create());
-      return result;
-    }
-    static _normalizeParameter(a) {
-      if (a instanceof Array) {
-        let result = [];
-        result.push(a[0] == dart.dynamic ? dart.bottom : a[0]);
-        result.push(a.slice(1));
-        return result;
-      }
-      return a == dart.dynamic ? dart.bottom : a;
-    }
-    static _canonicalizeArray(definite, array, map) {
-      let arr = definite ? array : array.map(FunctionType._normalizeParameter);
-      return FunctionType._memoizeArray(map, arr, () => arr);
-    }
-    static _canonicalizeNamed(definite, named, map) {
-      let key = [];
-      let names = dart.getOwnPropertyNames(named);
-      let r = {};
-      for (var i = 0; i < names.length; ++i) {
-        let name = names[i];
-        let type = named[name];
-        if (!definite) r[name] = type = FunctionType._normalizeParameter(type);
-        key.push(name);
-        key.push(type);
-      }
-      if (!definite) named = r;
-      return FunctionType._memoizeArray(map, key, () => named);
-    }
-    static _lookupNonTerminal(map, key) {
-      let result = map.get(key);
-      if (result !== void 0) return result;
-      map.set(key, result = new Map());
-      return result;
-    }
-    static _createSmall(count, definite, returnType, required) {
-      let map = dart._fnTypeSmallMap[count];
-      let args = definite ? required : required.map(FunctionType._normalizeParameter);
-      for (var i = 0; i < count; ++i) {
-        map = FunctionType._lookupNonTerminal(map, args[i]);
-      }
-      let result = map.get(returnType);
-      if (result !== void 0) return result;
-      result = new FunctionType(returnType, args, [], {});
-      map.set(returnType, result);
-      return result;
-    }
     static create(definite, returnType, args, extra) {
       if (extra === void 0 && args.length < 3) {
-        return FunctionType._createSmall(args.length, definite, returnType, args);
+        return dart._createSmall(args.length, definite, returnType, args);
       }
-      args = FunctionType._canonicalizeArray(definite, args, dart._fnTypeArrayArgMap);
-      let keys;
-      let create;
+      args = dart._canonicalizeArray(definite, args, dart._fnTypeArrayArgMap);
+      let keys = null;
+      let create = null;
       if (extra === void 0) {
         keys = [returnType, args];
-        create = () => new FunctionType(returnType, args, [], {});
+        create = dart.fn(() => new dart.FunctionType(returnType, args, [], {}), VoidToFunctionType());
       } else if (extra instanceof Array) {
-        let optionals = FunctionType._canonicalizeArray(definite, extra, dart._fnTypeArrayArgMap);
+        let optionals = dart._canonicalizeArray(definite, extra, dart._fnTypeArrayArgMap);
         keys = [returnType, args, optionals];
-        create = () => new FunctionType(returnType, args, optionals, {});
+        create = dart.fn(() => new dart.FunctionType(returnType, args, optionals, {}), VoidToFunctionType());
       } else {
-        let named = FunctionType._canonicalizeNamed(definite, extra, dart._fnTypeNamedArgMap);
+        let named = dart._canonicalizeNamed(definite, extra, dart._fnTypeNamedArgMap);
         keys = [returnType, args, named];
-        create = () => new FunctionType(returnType, args, [], named);
+        create = dart.fn(() => new dart.FunctionType(returnType, args, [], named), VoidToFunctionType());
       }
-      return FunctionType._memoizeArray(dart._fnTypeTypeMap, keys, create);
+      return dart._memoizeArray(dart._fnTypeTypeMap, keys, create);
     }
-    constructor(returnType, args, optionals, named) {
-      super();
+    [_process](array, metadata) {
+      let result = [];
+      for (let i = 0; i < array.length; ++i) {
+        let arg = array[i];
+        if (arg instanceof Array) {
+          dart.dsend(metadata, 'add', arg.slice(1));
+          result[dartx.add](arg[0]);
+        } else {
+          metadata.push([]);
+          result.push(arg);
+        }
+      }
+      return result;
+    }
+    new(returnType, args, optionals, named) {
       this.returnType = returnType;
       this.args = args;
       this.optionals = optionals;
       this.named = named;
+      this.metadata = null;
+      super.new();
       this.metadata = [];
-      function process(array, metadata) {
-        var result = [];
-        for (var i = 0; i < array.length; ++i) {
-          var arg = array[i];
-          if (arg instanceof Array) {
-            metadata.push(arg.slice(1));
-            result.push(arg[0]);
-          } else {
-            metadata.push([]);
-            result.push(arg);
-          }
-        }
-        return result;
-      }
-      this.args = process(this.args, this.metadata);
-      this.optionals = process(this.optionals, this.metadata);
+      this.args = this[_process](this.args, this.metadata);
+      this.optionals = this[_process](this.optionals, this.metadata);
     }
   };
+  dart.setSignature(dart.FunctionType, {
+    constructors: () => ({new: dart.definiteFunctionType(dart.FunctionType, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])}),
+    fields: () => ({
+      returnType: dart.dynamic,
+      args: dart.dynamic,
+      optionals: dart.dynamic,
+      named: dart.dynamic,
+      metadata: dart.dynamic
+    }),
+    methods: () => ({[_process]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])}),
+    statics: () => ({create: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic])}),
+    names: ['create']
+  });
+  const _name = Symbol('_name');
+  const _closure = Symbol('_closure');
+  const _functionType = Symbol('_functionType');
   dart.Typedef = class Typedef extends dart.AbstractFunctionType {
-    constructor(name, closure) {
-      super();
-      this._name = name;
-      this._closure = closure;
-      this._functionType = null;
+    new(name, closure) {
+      this[_name] = name;
+      this[_closure] = closure;
+      this[_functionType] = null;
+      super.new();
     }
     get name() {
-      return this._name;
+      return core.String._check(this[_name]);
     }
     get functionType() {
-      if (!this._functionType) {
-        this._functionType = this._closure();
+      if (this[_functionType] == null) {
+        this[_functionType] = this[_closure]();
       }
-      return this._functionType;
+      return this[_functionType];
     }
     get returnType() {
       return this.functionType.returnType;
     }
     get args() {
-      return this.functionType.args;
+      return core.List._check(this.functionType.args);
     }
     get optionals() {
-      return this.functionType.optionals;
+      return core.List._check(this.functionType.optionals);
     }
     get named() {
       return this.functionType.named;
     }
     get metadata() {
-      return this.functionType.metadata;
+      return core.List._check(this.functionType.metadata);
     }
   };
+  dart.setSignature(dart.Typedef, {
+    constructors: () => ({new: dart.definiteFunctionType(dart.Typedef, [dart.dynamic, dart.dynamic])}),
+    fields: () => ({
+      [_name]: dart.dynamic,
+      [_closure]: dart.dynamic,
+      [_functionType]: dart.AbstractFunctionType
+    }),
+    getters: () => ({
+      functionType: dart.definiteFunctionType(dart.AbstractFunctionType, []),
+      returnType: dart.definiteFunctionType(dart.dynamic, []),
+      args: dart.definiteFunctionType(core.List, []),
+      optionals: dart.definiteFunctionType(core.List, []),
+      named: dart.definiteFunctionType(dart.dynamic, []),
+      metadata: dart.definiteFunctionType(core.List, [])
+    })
+  });
   dart._typeFormalCount = Symbol("_typeFormalCount");
   dart.isSubtype = dart._subtypeMemo((t1, t2) => t1 === t2 || dart._isSubtype(t1, t2, true));
+  dart._trapRuntimeErrors = true;
   dart._jsIterator = Symbol("_jsIterator");
   dart._current = Symbol("_current");
   dart._AsyncStarStreamController = class _AsyncStarStreamController {
@@ -2617,7 +3090,7 @@
     }
   };
   dart.setSignature(dart.InvocationImpl, {
-    constructors: () => ({new: dart.definiteFunctionType(dart.InvocationImpl, [core.String, core.List], {namedArguments: dart.dynamic, isMethod: core.bool, isGetter: core.bool, isSetter: core.bool})}),
+    constructors: () => ({new: dart.definiteFunctionType(dart.InvocationImpl, [dart.dynamic, core.List], {namedArguments: dart.dynamic, isMethod: core.bool, isGetter: core.bool, isSetter: core.bool})}),
     fields: () => ({
       memberName: core.Symbol,
       positionalArguments: core.List,
@@ -2666,7 +3139,7 @@
       return false;
     });
   })();
-  dart._stack = new WeakMap();
+  dart._stack = null;
   dart._value = Symbol("_value");
   dart.constants = new Map();
   dart.constantLists = new Map();
@@ -2761,8 +3234,8 @@
   dart.lazyFn(_debugger.getObjectTypeName, () => dynamicToString());
   _debugger.getTypeName = function(type) {
     let name = dart.typeName(type);
-    if (dart.equals(name, 'JSArray<dynamic>') || dart.equals(name, 'JSObject<Array>')) return 'List<dynamic>';
-    return core.String._check(name);
+    if (name == 'JSArray<dynamic>' || name == 'JSObject<Array>') return 'List<dynamic>';
+    return name;
   };
   dart.lazyFn(_debugger.getTypeName, () => TypeToString());
   _debugger._getType = function(object) {
@@ -2865,7 +3338,7 @@
       if (dart.notNull(this.length) <= dart.notNull(_debugger._maxSpanLength)) {
         this.asMap()[dartx.forEach](dart.fn((i, element) => {
           children[dartx.add](new _debugger.NameValuePair({name: dart.toString(dart.notNull(i) + dart.notNull(this.start)), value: element}));
-        }, intAnddynamicTovoid()));
+        }, intAnddynamicToNull()));
       } else {
         for (let i = this.start; dart.notNull(i) < dart.notNull(this.end); i = dart.notNull(i) + dart.notNull(this.subsetSize)) {
           let subSpan = new _debugger.IterableSpan(i, math.min(core.int)(this.end, dart.notNull(this.subsetSize) + dart.notNull(i)), this.iterable);
@@ -3158,7 +3631,7 @@
         protoChain[dartx.add](current);
         current = _debugger.safeGetProperty(current, '__proto__');
       }
-      for (/* Unimplemented unknown name */current of protoChain) {
+      for (current of protoChain) {
         for (let symbol of _debugger.getOwnPropertySymbols(current)) {
           let dartName = _debugger.symbolName(symbol);
           if (dart.test(_debugger.hasMethod(object, dartName))) {
@@ -3174,7 +3647,7 @@
           properties.add(new _debugger.NameValuePair({name: dartName, value: value}));
         }
       }
-      for (/* Unimplemented unknown name */current of protoChain) {
+      for (current of protoChain) {
         let className = dart.dload(dart.getReifiedType(current), 'name');
         for (let name of _debugger.getOwnPropertyNames(current)) {
           if (dart.test(_debugger.ObjectFormatter._customNames.contains(name)) || dart.equals(name, className)) continue;
@@ -3266,14 +3739,14 @@
         } else {
           nonGenericProperties._set(core.String._check(name), value);
         }
-      }, dynamicAnddynamicTodynamic$()));
+      }, dynamicAnddynamicToNull()));
       nonGenericProperties.forEach(dart.fn((name, value) => {
         if (core.Type.is(value)) {
           children.add(_debugger.NameValuePair._check(this.classChild(name, value)));
         } else {
           children.add(new _debugger.NameValuePair({name: name, value: value}));
         }
-      }, StringAndObjectTovoid()));
+      }, StringAndObjectToNull()));
       return children.toList();
     }
     recordGenericParameters(name, genericTypeConstructor) {
@@ -3310,7 +3783,7 @@
       return true;
     }
     preview(object) {
-      return core.String._check(dart.typeName(dart.getReifiedType(object)));
+      return dart.typeName(dart.getReifiedType(object));
     }
     children(object) {
       return JSArrayOfNameValuePair().of([new _debugger.NameValuePair({name: 'signature', value: this.preview(object)}), new _debugger.NameValuePair({name: 'JavaScript Function', value: object, config: _debugger.JsonMLConfig.skipDart})]);
@@ -3342,7 +3815,7 @@
       map[dartx.forEach](dart.fn((key, value) => {
         let entryWrapper = new _debugger.MapEntry({key: key, value: value});
         entries.add(new _debugger.NameValuePair({name: dart.toString(entries.length), value: entryWrapper}));
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
       _debugger.addMetadataChildren(object, entries);
       return entries.toList();
     }
@@ -7021,30 +7494,8 @@
     ListIterable[dart.implements] = () => [_internal.EfficientLength];
     dart.setSignature(ListIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_internal.ListIterable$(E), [])}),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
-      methods: () => ({
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-        every: dart.definiteFunctionType(core.bool, [ETobool()]),
-        any: dart.definiteFunctionType(core.bool, [ETobool()]),
-        firstWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        lastWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        singleWhere: dart.definiteFunctionType(E, [ETobool()]),
-        where: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        map: dart.definiteFunctionType(T => [core.Iterable$(T), [dart.functionType(T, [E])]]),
-        reduce: dart.definiteFunctionType(E, [dynamicAndEToE()]),
-        fold: dart.definiteFunctionType(T => [T, [T, dart.functionType(T, [T, E])]]),
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        skipWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        takeWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
-      })
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
+      methods: () => ({reduce: dart.definiteFunctionType(E, [dynamicAndEToE()])})
     });
     dart.defineExtensionMembers(ListIterable, [
       'forEach',
@@ -7170,12 +7621,6 @@
       getters: () => ({
         [_endIndex]: dart.definiteFunctionType(core.int, []),
         [_startIndex]: dart.definiteFunctionType(core.int, [])
-      }),
-      methods: () => ({
-        elementAt: dart.definiteFunctionType(E, [core.int]),
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool})
       })
     });
     dart.defineExtensionMembers(SubListIterable, [
@@ -7290,13 +7735,7 @@
         [_iterable$]: IterableOfS(),
         [_f]: _TransformationOfS$T()
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(T), []),
-        first: dart.definiteFunctionType(T, []),
-        last: dart.definiteFunctionType(T, []),
-        single: dart.definiteFunctionType(T, [])
-      }),
-      methods: () => ({elementAt: dart.definiteFunctionType(T, [core.int])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(T), [])})
     });
     dart.defineExtensionMembers(MappedIterable, [
       'elementAt',
@@ -7389,8 +7828,7 @@
       fields: () => ({
         [_source]: IterableOfS(),
         [_f]: _TransformationOfS$T()
-      }),
-      methods: () => ({elementAt: dart.definiteFunctionType(T, [core.int])})
+      })
     });
     dart.defineExtensionMembers(MappedListIterable, ['elementAt', 'length']);
     return MappedListIterable;
@@ -7739,8 +8177,7 @@
         [_iterable$]: IterableOfE(),
         [_skipCount]: core.int
       }),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({skip: dart.definiteFunctionType(core.Iterable$(E), [core.int])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(SkipIterable, ['skip', 'iterator']);
     return SkipIterable;
@@ -7966,31 +8403,8 @@
     EmptyIterable[dart.implements] = () => [_internal.EfficientLength];
     dart.setSignature(EmptyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_internal.EmptyIterable$(E), [])}),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
-      methods: () => ({
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-        elementAt: dart.definiteFunctionType(E, [core.int]),
-        every: dart.definiteFunctionType(core.bool, [ETobool()]),
-        any: dart.definiteFunctionType(core.bool, [ETobool()]),
-        firstWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        lastWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()}),
-        where: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        map: dart.definiteFunctionType(T => [core.Iterable$(T), [dart.functionType(T, [E])]]),
-        reduce: dart.definiteFunctionType(E, [EAndEToE()]),
-        fold: dart.definiteFunctionType(T => [T, [T, dart.functionType(T, [T, E])]]),
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        skipWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        takeWhile: dart.definiteFunctionType(core.Iterable$(E), [ETobool()]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
-      })
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
+      methods: () => ({singleWhere: dart.definiteFunctionType(E, [ETobool()], {orElse: VoidToE()})})
     });
     dart.defineExtensionMembers(EmptyIterable, [
       'forEach',
@@ -8189,8 +8603,7 @@
   dart.addSimpleTypeTests(_internal._ListIndicesIterable);
   dart.setSignature(_internal._ListIndicesIterable, {
     constructors: () => ({new: dart.definiteFunctionType(_internal._ListIndicesIterable, [core.List])}),
-    fields: () => ({[_backedList]: core.List}),
-    methods: () => ({elementAt: dart.definiteFunctionType(core.int, [core.int])})
+    fields: () => ({[_backedList]: core.List})
   });
   dart.defineExtensionMembers(_internal._ListIndicesIterable, ['elementAt', 'length']);
   const _values = Symbol('_values');
@@ -8319,8 +8732,7 @@
     }
     dart.setSignature(ReversedListIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_internal.ReversedListIterable$(E), [IterableOfE()])}),
-      fields: () => ({[_source]: IterableOfE()}),
-      methods: () => ({elementAt: dart.definiteFunctionType(E, [core.int])})
+      fields: () => ({[_source]: IterableOfE()})
     });
     dart.defineExtensionMembers(ReversedListIterable, ['elementAt', 'length']);
     return ReversedListIterable;
@@ -8701,41 +9113,41 @@
     names: ['sort', 'sortRange', '_doSort', '_insertionSort', '_dualPivotQuicksort']
   });
   _internal.Sort._INSERTION_SORT_THRESHOLD = 32;
-  const _name = Symbol('_name');
+  const _name$ = Symbol('_name');
   const _nativeSymbol = Symbol('_nativeSymbol');
   _internal.Symbol = class Symbol extends core.Object {
     new(name) {
-      this[_name] = name;
+      this[_name$] = name;
       this[_nativeSymbol] = null;
     }
     es6(name, nativeSymbol) {
-      this[_name] = name;
+      this[_name$] = name;
       this[_nativeSymbol] = nativeSymbol;
     }
     unvalidated(name) {
-      this[_name] = name;
+      this[_name$] = name;
       this[_nativeSymbol] = null;
     }
     validated(name) {
-      this[_name] = _internal.Symbol.validatePublicSymbol(name);
+      this[_name$] = _internal.Symbol.validatePublicSymbol(name);
       this[_nativeSymbol] = null;
     }
     ['=='](other) {
-      return _internal.Symbol.is(other) && this[_name] == other[_name] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
+      return _internal.Symbol.is(other) && this[_name$] == other[_name$] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
     }
     get hashCode() {
       let hash = this._hashCode;
       if (hash != null) return hash;
       let arbitraryPrime = 664597;
-      hash = 536870911 & arbitraryPrime * dart.notNull(dart.hashCode(this[_name]));
+      hash = 536870911 & arbitraryPrime * dart.notNull(dart.hashCode(this[_name$]));
       this._hashCode = hash;
       return hash;
     }
     toString() {
-      return dart.str`Symbol("${this[_name]}")`;
+      return dart.str`Symbol("${this[_name$]}")`;
     }
     static getName(symbol) {
-      return symbol[_name];
+      return symbol[_name$];
     }
     static getNativeSymbol(symbol) {
       return symbol[_nativeSymbol];
@@ -8763,7 +9175,7 @@
       validated: dart.definiteFunctionType(_internal.Symbol, [core.String])
     }),
     fields: () => ({
-      [_name]: core.String,
+      [_name$]: core.String,
       [_nativeSymbol]: dart.dynamic
     }),
     methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
@@ -8839,11 +9251,11 @@
     if (_isolate_helper._MainFunctionArgs.is(entry)) {
       rootContext.eval(dart.fn(() => {
         dart.dcall(entry, args);
-      }, VoidTodynamic$()));
+      }, VoidToNull()));
     } else if (_isolate_helper._MainFunctionArgsMessage.is(entry)) {
       rootContext.eval(dart.fn(() => {
         dart.dcall(entry, args, null);
-      }, VoidTodynamic$()));
+      }, VoidToNull()));
     } else {
       rootContext.eval(core.Function._check(entry));
     }
@@ -8900,13 +9312,14 @@
           f(a, e);
         };
       })(_isolate_helper.IsolateNatives._processWorkerMessage, this.mainManager);
-      self.onmessage = func;
-      self.dartPrint = self.dartPrint || (function(serialize) {
+      _isolate_helper.global.onmessage = func;
+      _isolate_helper.global.dartPrint = _isolate_helper.global.dartPrint || (function(serialize) {
         return function(object) {
-          if (self.console && self.console.log) {
-            self.console.log(object);
+          var _self = _isolate_helper.global;
+          if (_self.console && _self.console.log) {
+            _self.console.log(object);
           } else {
-            self.postMessage(serialize(object));
+            _self.postMessage(serialize(object));
           }
         };
       })(_isolate_helper._Manager._serializePrintMessage);
@@ -9057,8 +9470,8 @@
         if (dart.test(this.errorsAreFatal) && core.identical(this, _isolate_helper._globalState.rootContext)) {
           return;
         }
-        if (self.console && self.console.error) {
-          self.console.error(error, stackTrace);
+        if (_isolate_helper.global.console && _isolate_helper.global.console.error) {
+          _isolate_helper.global.console.error(error, stackTrace);
         } else {
           core.print(error);
           if (stackTrace != null) core.print(stackTrace);
@@ -9284,7 +9697,7 @@
           if (!dart.test(this.runIteration())) return;
           async.Timer.run(next);
         }).bind(this);
-        dart.fn(next, VoidTodynamic$());
+        dart.fn(next, VoidToNull());
         next();
       } else {
         while (dart.test(this.runIteration())) {
@@ -9345,13 +9758,13 @@
     methods: () => ({process: dart.definiteFunctionType(dart.void, [])})
   });
   dart.defineLazy(_isolate_helper, {
-    get _global() {
+    get global() {
       return typeof global == 'undefined' ? self : global;
     }
   });
   _isolate_helper._MainManagerStub = class _MainManagerStub extends core.Object {
     postMessage(msg) {
-      _isolate_helper._global.postMessage(msg);
+      _isolate_helper.global.postMessage(msg);
     }
   };
   dart.setSignature(_isolate_helper._MainManagerStub, {
@@ -9361,17 +9774,17 @@
   _isolate_helper._SPAWN_FAILED_SIGNAL = "spawn failed";
   dart.copyProperties(_isolate_helper, {
     get globalWindow() {
-      return _isolate_helper._global.window;
+      return _isolate_helper.global.window;
     }
   });
   dart.copyProperties(_isolate_helper, {
     get globalWorker() {
-      return _isolate_helper._global.Worker;
+      return _isolate_helper.global.Worker;
     }
   });
   dart.copyProperties(_isolate_helper, {
     get globalPostMessageDefined() {
-      return !!_isolate_helper._global.postMessage;
+      return !!_isolate_helper.global.postMessage;
     }
   });
   _isolate_helper._MainFunction = dart.typedef('_MainFunction', () => dart.functionType(dart.dynamic, []));
@@ -9437,7 +9850,7 @@
           let context = new _isolate_helper._IsolateContext();
           _isolate_helper._globalState.topEventLoop.enqueue(context, dart.fn(() => {
             _isolate_helper.IsolateNatives._startIsolate(entryPoint, ListOfString()._check(args), message, core.bool._check(isSpawnUri), core.bool._check(startPaused), isolate.SendPort._check(replyTo));
-          }, VoidTodynamic$()), 'worker-start');
+          }, VoidToNull()), 'worker-start');
           _isolate_helper._globalState.currentContext = context;
           _isolate_helper._globalState.topEventLoop.run();
           break;
@@ -9487,9 +9900,9 @@
       let replyPort = dart.dindex(msg, 'replyPort');
       _isolate_helper.IsolateNatives.spawn(core.String._check(dart.dindex(msg, 'functionName')), core.String._check(dart.dindex(msg, 'uri')), ListOfString()._check(dart.dindex(msg, 'args')), dart.dindex(msg, 'msg'), false, core.bool._check(dart.dindex(msg, 'isSpawnUri')), core.bool._check(dart.dindex(msg, 'startPaused'))).then(dart.dynamic)(dart.fn(msg => {
         dart.dsend(replyPort, 'send', msg);
-      }, ListTodynamic()), {onError: dart.fn(errorMessage => {
+      }, ListToNull()), {onError: dart.fn(errorMessage => {
           dart.dsend(replyPort, 'send', JSArrayOfString().of([_isolate_helper._SPAWN_FAILED_SIGNAL, errorMessage]));
-        }, StringTodynamic())});
+        }, StringToNull())});
     }
     static _log(msg) {
       if (dart.test(_isolate_helper._globalState.isWorker)) {
@@ -9505,7 +9918,7 @@
       }
     }
     static _consoleLog(msg) {
-      self.console.log(msg);
+      _isolate_helper.global.console.log(msg);
     }
     static _getJSFunctionFromName(functionName) {
       let globalFunctionsContainer = _foreign_helper.JS_EMBEDDED_GLOBAL("", _js_embedded_names.GLOBAL_FUNCTIONS);
@@ -9546,7 +9959,7 @@
           dart.assert(dart.equals(dart.dindex(msg, 0), _isolate_helper._SPAWN_FAILED_SIGNAL));
           completer.completeError(dart.dindex(msg, 1));
         }
-      }, dynamicTodynamic$()));
+      }, dynamicToNull$()));
       let signalReply = port.sendPort;
       if (dart.test(_isolate_helper._globalState.useWorkers) && !dart.test(isLight)) {
         _isolate_helper.IsolateNatives._startWorker(functionName, uri, args, message, isSpawnUri, startPaused, signalReply, dart.fn(message => completer.completeError(message), StringTovoid$()));
@@ -9572,7 +9985,7 @@
       _isolate_helper._globalState.topEventLoop.enqueue(new _isolate_helper._IsolateContext(), dart.fn(() => {
         let func = _isolate_helper.IsolateNatives._getJSFunctionFromName(functionName);
         _isolate_helper.IsolateNatives._startIsolate(core.Function._check(func), args, message, isSpawnUri, startPaused, replyPort);
-      }, VoidTodynamic$()), 'nonworker start');
+      }, VoidToNull()), 'nonworker start');
     }
     static get currentIsolate() {
       let context = _isolate_helper._IsolateContext._check(_foreign_helper.JS_CURRENT_ISOLATE_CONTEXT());
@@ -9717,7 +10130,7 @@
         if (!dart.test(this[_receivePort][_isClosed])) {
           this[_receivePort][_add](msg);
         }
-      }, VoidTodynamic$()), dart.str`receive ${message}`);
+      }, VoidToNull()), dart.str`receive ${message}`);
     }
     ['=='](other) {
       return _isolate_helper._NativeJsSendPort.is(other) && dart.equals(this[_receivePort], other[_receivePort]);
@@ -9851,13 +10264,11 @@
     let _EmptyStreamOfT = () => (_EmptyStreamOfT = dart.constFn(async._EmptyStream$(T)))();
     let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
     let _StreamControllerOfT = () => (_StreamControllerOfT = dart.constFn(async._StreamController$(T)))();
-    let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
     let _GeneratedStreamImplOfT = () => (_GeneratedStreamImplOfT = dart.constFn(async._GeneratedStreamImpl$(T)))();
     let _IterablePendingEventsOfT = () => (_IterablePendingEventsOfT = dart.constFn(async._IterablePendingEvents$(T)))();
     let _BoundSinkStreamOfdynamic$T = () => (_BoundSinkStreamOfdynamic$T = dart.constFn(async._BoundSinkStream$(dart.dynamic, T)))();
     let _AsBroadcastStreamOfT = () => (_AsBroadcastStreamOfT = dart.constFn(async._AsBroadcastStream$(T)))();
     let _WhereStreamOfT = () => (_WhereStreamOfT = dart.constFn(async._WhereStream$(T)))();
-    let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     let _HandleErrorStreamOfT = () => (_HandleErrorStreamOfT = dart.constFn(async._HandleErrorStream$(T)))();
     let StreamConsumerOfT = () => (StreamConsumerOfT = dart.constFn(async.StreamConsumer$(T)))();
     let TAndTToT = () => (TAndTToT = dart.constFn(dart.functionType(T, [T, T])))();
@@ -9872,12 +10283,14 @@
     let _SkipStreamOfT = () => (_SkipStreamOfT = dart.constFn(async._SkipStream$(T)))();
     let _SkipWhileStreamOfT = () => (_SkipWhileStreamOfT = dart.constFn(async._SkipWhileStream$(T)))();
     let _DistinctStreamOfT = () => (_DistinctStreamOfT = dart.constFn(async._DistinctStream$(T)))();
+    let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     let EventSinkOfT = () => (EventSinkOfT = dart.constFn(async.EventSink$(T)))();
     let _SyncBroadcastStreamControllerOfT = () => (_SyncBroadcastStreamControllerOfT = dart.constFn(async._SyncBroadcastStreamController$(T)))();
     let _SyncStreamControllerOfT = () => (_SyncStreamControllerOfT = dart.constFn(async._SyncStreamController$(T)))();
     let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
     let StreamSubscriptionOfTTovoid = () => (StreamSubscriptionOfTTovoid = dart.constFn(dart.functionType(dart.void, [StreamSubscriptionOfT()])))();
     let TTobool = () => (TTobool = dart.constFn(dart.functionType(core.bool, [T])))();
+    let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
     let TAndTTobool = () => (TAndTTobool = dart.constFn(dart.functionType(core.bool, [T, T])))();
     let EventSinkOfTTovoid = () => (EventSinkOfTTovoid = dart.constFn(dart.functionType(dart.void, [EventSinkOfT()])))();
     let FutureOfT = () => (FutureOfT = dart.constFn(async.Future$(T)))();
@@ -9885,10 +10298,10 @@
     let IterableOfT = () => (IterableOfT = dart.constFn(core.Iterable$(T)))();
     let intToT = () => (intToT = dart.constFn(dart.functionType(T, [core.int])))();
     let EventSinkOfTToEventSink = () => (EventSinkOfTToEventSink = dart.constFn(dart.functionType(async.EventSink, [EventSinkOfT()])))();
-    let TTodynamic$ = () => (TTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [T])))();
+    let TToNull = () => (TToNull = dart.constFn(dart.definiteFunctionType(core.Null, [T])))();
     let VoidTo_IterablePendingEventsOfT = () => (VoidTo_IterablePendingEventsOfT = dart.constFn(dart.definiteFunctionType(_IterablePendingEventsOfT(), [])))();
-    let TTovoid$ = () => (TTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [T])))();
     let VoidToT = () => (VoidToT = dart.constFn(dart.definiteFunctionType(T, [])))();
+    let TTovoid$ = () => (TTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [T])))();
     class Stream extends core.Object {
       new() {
       }
@@ -9902,10 +10315,10 @@
         future.then(dart.dynamic)(dart.fn(value => {
           controller[_add$](value);
           controller[_closeUnchecked]();
-        }, TTodynamic$()), {onError: dart.fn((error, stackTrace) => {
+        }, TToNull()), {onError: dart.fn((error, stackTrace) => {
             controller[_addError](error, core.StackTrace._check(stackTrace));
             controller[_closeUnchecked]();
-          }, dynamicAnddynamicTodynamic$())});
+          }, dynamicAnddynamicToNull())});
         return controller.stream;
       }
       static fromFutures(futures) {
@@ -9916,13 +10329,13 @@
             controller[_add$](value);
             if (--count == 0) controller[_closeUnchecked]();
           }
-        }, TTodynamic$());
+        }, TToNull());
         let onError = dart.fn((error, stack) => {
           if (!dart.test(controller.isClosed)) {
             controller[_addError](error, core.StackTrace._check(stack));
             if (--count == 0) controller[_closeUnchecked]();
           }
-        }, dynamicAnddynamicTodynamic$());
+        }, dynamicAnddynamicToNull());
         for (let future of futures) {
           count++;
           future.then(dart.dynamic)(onValue, {onError: onError});
@@ -9959,17 +10372,17 @@
           dart.assert(timer == null);
           timer = async.Timer.periodic(period, dart.fn(timer => {
             sendEvent();
-          }, TimerTovoid$()));
+          }, TimerToNull()));
         }
         dart.fn(startPeriodicTimer, VoidTovoid$());
         controller = StreamControllerOfT().new({sync: true, onListen: dart.fn(() => {
             watch.start();
             startPeriodicTimer();
-          }, VoidTovoid$()), onPause: dart.fn(() => {
+          }, VoidToNull()), onPause: dart.fn(() => {
             timer.cancel();
             timer = null;
             watch.stop();
-          }, VoidTovoid$()), onResume: dart.fn(() => {
+          }, VoidToNull()), onResume: dart.fn(() => {
             dart.assert(timer == null);
             let elapsed = watch.elapsed;
             watch.start();
@@ -9977,11 +10390,11 @@
               timer = null;
               startPeriodicTimer();
               sendEvent();
-            }, VoidTovoid$()));
-          }, VoidTovoid$()), onCancel: dart.fn(() => {
+            }, VoidToNull()));
+          }, VoidToNull()), onCancel: dart.fn(() => {
             if (timer != null) timer.cancel();
             timer = null;
-          }, VoidTodynamic$())});
+          }, VoidToNull())});
         return controller.stream;
       }
       static eventTransformed(source, mapSink) {
@@ -10024,25 +10437,25 @@
 
               if (async.Future.is(newValue)) {
                 subscription.pause();
-                newValue.then(dart.dynamic)(add, {onError: addError}).whenComplete(dart.bind(subscription, 'resume'));
+                newValue.then(dart.void)(add, {onError: addError}).whenComplete(dart.bind(subscription, 'resume'));
               } else {
                 controller.add(E.as(newValue));
               }
-            }, TTovoid$()), {onError: addError, onDone: dart.bind(controller, 'close')});
+            }, TToNull()), {onError: addError, onDone: dart.bind(controller, 'close')});
           }).bind(this);
           dart.fn(onListen, VoidTovoid$());
           if (dart.test(this.isBroadcast)) {
             controller = async.StreamController$(E).broadcast({onListen: onListen, onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTovoid$()), sync: true});
+              }, VoidToNull()), sync: true});
           } else {
             controller = async.StreamController$(E).new({onListen: onListen, onPause: dart.fn(() => {
                 subscription.pause();
-              }, VoidTovoid$()), onResume: dart.fn(() => {
+              }, VoidToNull()), onResume: dart.fn(() => {
                 subscription.resume();
-              }, VoidTovoid$()), onCancel: dart.fn(() => {
+              }, VoidToNull()), onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTodynamic$()), sync: true});
+              }, VoidToNull()), sync: true});
           }
           return controller.stream;
         };
@@ -10068,21 +10481,21 @@
                 subscription.pause();
                 controller.addStream(newStream).whenComplete(dart.bind(subscription, 'resume'));
               }
-            }, TTovoid$()), {onError: dart.bind(eventSink, _addError), onDone: dart.bind(controller, 'close')});
+            }, TToNull()), {onError: dart.bind(eventSink, _addError), onDone: dart.bind(controller, 'close')});
           }).bind(this);
           dart.fn(onListen, VoidTovoid$());
           if (dart.test(this.isBroadcast)) {
             controller = async.StreamController$(E).broadcast({onListen: onListen, onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTovoid$()), sync: true});
+              }, VoidToNull()), sync: true});
           } else {
             controller = async.StreamController$(E).new({onListen: onListen, onPause: dart.fn(() => {
                 subscription.pause();
-              }, VoidTovoid$()), onResume: dart.fn(() => {
+              }, VoidToNull()), onResume: dart.fn(() => {
                 subscription.resume();
-              }, VoidTovoid$()), onCancel: dart.fn(() => {
+              }, VoidToNull()), onCancel: dart.fn(() => {
                 subscription.cancel();
-              }, VoidTodynamic$()), sync: true});
+              }, VoidToNull()), sync: true});
           }
           return controller.stream;
         };
@@ -10116,12 +10529,12 @@
           if (seenFirst) {
             async._runUserCode(dart.fn(() => combine(value, element), VoidToT()), dart.fn(newValue => {
               value = newValue;
-            }, TTodynamic$()), async._cancelAndErrorClosure(subscription, result));
+            }, TToNull()), async._cancelAndErrorClosure(subscription, result));
           } else {
             value = element;
             seenFirst = true;
           }
-        }, TTovoid$()), {onError: dart.bind(result, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(result, _completeError), onDone: dart.fn(() => {
             if (!seenFirst) {
               try {
                 dart.throw(_internal.IterableElementError.noElement());
@@ -10133,7 +10546,7 @@
             } else {
               result[_complete](value);
             }
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return result;
       }
       fold(S) {
@@ -10144,12 +10557,12 @@
           subscription = this.listen(dart.fn(element => {
             async._runUserCode(dart.fn(() => combine(value, element), dart.definiteFunctionType(S, [])), dart.fn(newValue => {
               value = newValue;
-            }, dart.definiteFunctionType(dart.dynamic, [S])), async._cancelAndErrorClosure(subscription, result));
-          }, TTovoid$()), {onError: dart.fn((e, st) => {
+            }, dart.definiteFunctionType(core.Null, [S])), async._cancelAndErrorClosure(subscription, result));
+          }, TToNull()), {onError: dart.fn((e, st) => {
               result[_completeError](e, core.StackTrace._check(st));
-            }, dynamicAnddynamicTodynamic$()), onDone: dart.fn(() => {
+            }, dynamicAnddynamicToNull()), onDone: dart.fn(() => {
               result[_complete](value);
-            }, VoidTovoid$()), cancelOnError: true});
+            }, VoidToNull()), cancelOnError: true});
           return result;
         };
       }
@@ -10171,11 +10584,11 @@
             async._cancelAndErrorWithReplacement(subscription, result, e, s);
           }
 
-        }, TTovoid$()), {onError: dart.fn(e => {
+        }, TToNull()), {onError: dart.fn(e => {
             result[_completeError](e);
-          }, dynamicTodynamic$()), onDone: dart.fn(() => {
+          }, dynamicToNull$()), onDone: dart.fn(() => {
             result[_complete](buffer.toString());
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return result;
       }
       contains(needle) {
@@ -10186,10 +10599,10 @@
             if (dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, true);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](false);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       forEach(action) {
@@ -10197,10 +10610,10 @@
         let subscription = null;
         subscription = this.listen(dart.fn(element => {
           async._runUserCode(dart.fn(() => action(element), VoidTovoid$()), dart.fn(_ => {
-          }, dynamicTodynamic$()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, dynamicToNull$()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](null);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       every(test) {
@@ -10211,10 +10624,10 @@
             if (!dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, false);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](true);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       any(test) {
@@ -10225,10 +10638,10 @@
             if (dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, true);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](false);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get length() {
@@ -10236,9 +10649,9 @@
         let count = 0;
         this.listen(dart.fn(_ => {
           count++;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](count);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get isEmpty() {
@@ -10246,9 +10659,9 @@
         let subscription = null;
         subscription = this.listen(dart.fn(_ => {
           async._cancelAndValue(subscription, future, false);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](true);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       toList() {
@@ -10256,9 +10669,9 @@
         let future = new (_FutureOfListOfT())();
         this.listen(dart.fn(data => {
           result[dartx.add](data);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](result);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       toSet() {
@@ -10266,9 +10679,9 @@
         let future = new (_FutureOfSetOfT())();
         this.listen(dart.fn(data => {
           result.add(data);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_complete](result);
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       drain(E) {
@@ -10298,7 +10711,7 @@
         let subscription = null;
         subscription = this.listen(dart.fn(value => {
           async._cancelAndValue(subscription, future, value);
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             try {
               dart.throw(_internal.IterableElementError.noElement());
             } catch (e) {
@@ -10306,7 +10719,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get last() {
@@ -10316,7 +10729,7 @@
         this.listen(dart.fn(value => {
           foundResult = true;
           result = value;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10328,7 +10741,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       get single() {
@@ -10349,7 +10762,7 @@
           }
           foundResult = true;
           result = value;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10361,7 +10774,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       firstWhere(test, opts) {
@@ -10373,8 +10786,8 @@
             if (dart.test(isMatch)) {
               async._cancelAndValue(subscription, future, value);
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (defaultValue != null) {
               async._runUserCode(defaultValue, dart.bind(future, _complete), dart.bind(future, _completeError));
               return;
@@ -10386,7 +10799,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       lastWhere(test, opts) {
@@ -10401,8 +10814,8 @@
               foundResult = true;
               result = value;
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10418,7 +10831,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       singleWhere(test) {
@@ -10442,8 +10855,8 @@
               foundResult = true;
               result = value;
             }
-          }, boolTodynamic()), async._cancelAndErrorClosure(subscription, future));
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+          }, boolToNull()), async._cancelAndErrorClosure(subscription, future));
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             if (foundResult) {
               future[_complete](result);
               return;
@@ -10455,7 +10868,7 @@
               async._completeWithErrorCallback(future, e, s);
             }
 
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       elementAt(index) {
@@ -10469,9 +10882,9 @@
             return;
           }
           elementIndex = elementIndex + 1;
-        }, TTovoid$()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
+        }, TToNull()), {onError: dart.bind(future, _completeError), onDone: dart.fn(() => {
             future[_completeError](core.RangeError.index(index, this, "index", null, elementIndex));
-          }, VoidTovoid$()), cancelOnError: true});
+          }, VoidToNull()), cancelOnError: true});
         return future;
       }
       timeout(timeLimit, opts) {
@@ -10505,7 +10918,7 @@
           if (onTimeout == null) {
             timeout = dart.fn(() => {
               controller.addError(new async.TimeoutException("No stream event", timeLimit), null);
-            }, VoidTovoid$());
+            }, VoidToNull());
           } else {
             let registeredOnTimeout = zone.registerUnaryCallback(dart.dynamic, EventSinkOfT())(onTimeout);
             let wrapper = new async._ControllerEventSinkWrapper(null);
@@ -10513,7 +10926,7 @@
               wrapper[_sink] = controller;
               zone.runUnaryGuarded(dart.dynamic, EventSinkOfT())(registeredOnTimeout, wrapper);
               wrapper[_sink] = null;
-            }, VoidTovoid$());
+            }, VoidToNull());
           }
           subscription = this.listen(onData, {onError: onError, onDone: onDone});
           timer = zone.createTimer(timeLimit, timeout);
@@ -10529,10 +10942,10 @@
         controller = dart.test(this.isBroadcast) ? new (_SyncBroadcastStreamControllerOfT())(onListen, onCancel) : new (_SyncStreamControllerOfT())(onListen, dart.fn(() => {
           timer.cancel();
           subscription.pause();
-        }, VoidTovoid$()), dart.fn(() => {
+        }, VoidToNull()), dart.fn(() => {
           subscription.resume();
           timer = zone.createTimer(timeLimit, timeout);
-        }, VoidTovoid$()), onCancel);
+        }, VoidToNull()), onCancel);
         return controller.stream;
       }
     }
@@ -10665,7 +11078,7 @@
         }).bind(this);
         dart.fn(internalCallback, VoidTovoid$());
         _isolate_helper.enterJsAsync();
-        this[_handle] = self.setTimeout(internalCallback, milliseconds);
+        this[_handle] = _isolate_helper.global.setTimeout(internalCallback, milliseconds);
       } else {
         dart.assert(dart.notNull(milliseconds) > 0);
         dart.throw(new core.UnsupportedError("Timer greater than 0."));
@@ -10677,9 +11090,9 @@
       this[_handle] = null;
       if (dart.test(_isolate_helper.hasTimer())) {
         _isolate_helper.enterJsAsync();
-        this[_handle] = self.setInterval(dart.fn(() => {
+        this[_handle] = _isolate_helper.global.setInterval(dart.fn(() => {
           callback(this);
-        }, VoidTodynamic$()), milliseconds);
+        }, VoidToNull()), milliseconds);
       } else {
         dart.throw(new core.UnsupportedError("Periodic timer."));
       }
@@ -10692,9 +11105,9 @@
         if (this[_handle] == null) return;
         _isolate_helper.leaveJsAsync();
         if (dart.test(this[_once])) {
-          self.clearTimeout(this[_handle]);
+          _isolate_helper.global.clearTimeout(this[_handle]);
         } else {
-          self.clearInterval(this[_handle]);
+          _isolate_helper.global.clearInterval(this[_handle]);
         }
         this[_handle] = null;
       } else {
@@ -10721,7 +11134,7 @@
     methods: () => ({cancel: dart.definiteFunctionType(dart.void, [])})
   });
   _isolate_helper.hasTimer = function() {
-    return self.setTimeout != null;
+    return _isolate_helper.global.setTimeout != null;
   };
   dart.lazyFn(_isolate_helper.hasTimer, () => VoidTobool());
   _isolate_helper.CapabilityImpl = class CapabilityImpl extends core.Object {
@@ -11882,6 +12295,30 @@
     constructors: () => ({new: dart.definiteFunctionType(_js_helper.RuntimeError, [dart.dynamic])}),
     fields: () => ({message: dart.dynamic})
   });
+  core.AssertionError = class AssertionError extends core.Error {
+    new() {
+      super.new();
+    }
+    toString() {
+      return "Assertion failed";
+    }
+  };
+  dart.setSignature(core.AssertionError, {
+    constructors: () => ({new: dart.definiteFunctionType(core.AssertionError, [])})
+  });
+  _js_helper.AssertionErrorWithMessage = class AssertionErrorWithMessage extends core.AssertionError {
+    new(message) {
+      this[_message] = message;
+      super.new();
+    }
+    toString() {
+      return dart.str`Assertion failed: ${this[_message]}`;
+    }
+  };
+  dart.setSignature(_js_helper.AssertionErrorWithMessage, {
+    constructors: () => ({new: dart.definiteFunctionType(_js_helper.AssertionErrorWithMessage, [core.Object])}),
+    fields: () => ({[_message]: core.Object})
+  });
   _js_helper.random64 = function() {
     let int32a = Math.random() * 0x100000000 >>> 0;
     let int32b = Math.random() * 0x100000000 >>> 0;
@@ -12012,17 +12449,6 @@
     return SyncIterable;
   });
   _js_helper.SyncIterable = SyncIterable();
-  core.AssertionError = class AssertionError extends core.Error {
-    new() {
-      super.new();
-    }
-    toString() {
-      return "Assertion failed";
-    }
-  };
-  dart.setSignature(core.AssertionError, {
-    constructors: () => ({new: dart.definiteFunctionType(core.AssertionError, [])})
-  });
   _js_helper.BooleanConversionAssertionError = class BooleanConversionAssertionError extends core.AssertionError {
     new() {
       super.new();
@@ -12097,14 +12523,14 @@
     let LinkedHashMapKeyIterableOfK = () => (LinkedHashMapKeyIterableOfK = dart.constFn(_js_helper.LinkedHashMapKeyIterable$(K)))();
     let MappedIterableOfK$V = () => (MappedIterableOfK$V = dart.constFn(_internal.MappedIterable$(K, V)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let LinkedHashMapCellOfK$V = () => (LinkedHashMapCellOfK$V = dart.constFn(_js_helper.LinkedHashMapCell$(K, V)))();
     let LinkedHashMapOfK$V = () => (LinkedHashMapOfK$V = dart.constFn(collection.LinkedHashMap$(K, V)))();
     let InternalMapOfK$V = () => (InternalMapOfK$V = dart.constFn(_js_helper.InternalMap$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
     let KToV = () => (KToV = dart.constFn(dart.definiteFunctionType(V, [K])))();
     let KTobool = () => (KTobool = dart.constFn(dart.definiteFunctionType(core.bool, [K])))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     class JsLinkedHashMap extends core.Object {
       new() {
         this[_length$0] = 0;
@@ -12159,7 +12585,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       _get(key) {
         if (dart.test(_js_helper.JsLinkedHashMap._isStringKey(key))) {
@@ -12473,12 +12899,6 @@
         return new Map();
       }
     }
-    dart.setSignature(Es6LinkedHashMap, {
-      methods: () => ({
-        [_getTableCell]: dart.definiteFunctionType(_js_helper.LinkedHashMapCell$(K, V), [dart.dynamic, dart.dynamic]),
-        [_getTableBucket]: dart.definiteFunctionType(core.List$(_js_helper.LinkedHashMapCell$(K, V)), [dart.dynamic, dart.dynamic])
-      })
-    });
     return Es6LinkedHashMap;
   });
   _js_helper.Es6LinkedHashMap = Es6LinkedHashMap();
@@ -12543,8 +12963,7 @@
     dart.setSignature(LinkedHashMapKeyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(_js_helper.LinkedHashMapKeyIterable$(E), [JsLinkedHashMapOfE$dynamic()])}),
       fields: () => ({[_map]: JsLinkedHashMapOfE$dynamic()}),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(LinkedHashMapKeyIterable, [
       'contains',
@@ -12992,10 +13411,7 @@
       [_pattern]: core.String,
       [_index$0]: core.int
     }),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.Iterator$(core.Match), []),
-      first: dart.definiteFunctionType(core.Match, [])
-    })
+    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(core.Match), [])})
   });
   dart.defineExtensionMembers(_js_helper._StringAllMatchesIterable, ['iterator', 'first']);
   _js_helper._StringAllMatchesIterator = class _StringAllMatchesIterator extends core.Object {
@@ -13265,11 +13681,11 @@
     }
   });
   _js_mirrors._dload = function(obj, name) {
-    return _js_mirrors._dart.dload(obj, name);
+    return _js_mirrors._dart.dloadMirror(obj, name);
   };
   dart.lazyFn(_js_mirrors._dload, () => dynamicAndStringTodynamic());
   _js_mirrors._dput = function(obj, name, val) {
-    _js_mirrors._dart.dput(obj, name, val);
+    _js_mirrors._dart.dputMirror(obj, name, val);
   };
   dart.lazyFn(_js_mirrors._dput, () => dynamicAndStringAnddynamicTovoid());
   _js_mirrors._dcall = function(obj, args) {
@@ -13310,7 +13726,31 @@
     if (privateSymbol != null) {
       return privateSymbol;
     }
-    return _js_mirrors.getName(symbol);
+    let name = _js_mirrors.getName(symbol);
+    switch (name) {
+      case '[]':
+      {
+        name = '_get';
+        break;
+      }
+      case '[]=':
+      {
+        name = '_set';
+        break;
+      }
+      case 'unary-':
+      {
+        name = '_negate';
+        break;
+      }
+      case 'constructor':
+      case 'prototype':
+      {
+        name = dart.str`_${name}`;
+        break;
+      }
+    }
+    return name;
   };
   dart.lazyFn(_js_mirrors._getMember, () => SymbolTodynamic());
   _js_mirrors._getNameForESSymbol = function(member) {
@@ -13415,7 +13855,7 @@
     let obj = {};
     map[dartx.forEach](dart.fn((key, value) => {
       obj[_js_mirrors.getName(key)] = value;
-    }, SymbolAnddynamicTovoid()));
+    }, SymbolAnddynamicToNull()));
     return obj;
   };
   dart.lazyFn(_js_mirrors._toJsMap, () => MapOfSymbol$dynamicTodynamic());
@@ -13630,7 +14070,7 @@
         constructors[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         if (dart.test(constructors[dartx.isEmpty])) {
           let name = 'new';
           let ft = _js_mirrors._defaultConstructorType(_js_mirrors._unwrap(this[_cls]));
@@ -13645,23 +14085,23 @@
             t = dart.dindex(t, 0);
           }
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let methods = _js_mirrors._getMethods(unwrapped);
         methods[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let getters = _js_mirrors._getGetters(unwrapped);
         getters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let setters = _js_mirrors._getSetters(unwrapped);
         setters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
           symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let staticFields = _js_mirrors._getStaticFields(unwrapped);
         staticFields[dartx.forEach](dart.fn((symbol, t) => {
           let name = _js_mirrors.getName(symbol);
@@ -13671,22 +14111,22 @@
             t = dart.dindex(t, 0);
           }
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let statics = _js_mirrors._getStatics(unwrapped);
         statics[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let staticGetters = _js_mirrors._getStaticGetters(unwrapped);
         staticGetters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         let staticSetters = _js_mirrors._getStaticSetters(unwrapped);
         staticSetters[dartx.forEach](dart.fn((symbol, ft) => {
           let name = _js_mirrors.getName(symbol);
           this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
         this[_declarations] = MapOfSymbol$DeclarationMirror().unmodifiable(this[_declarations]);
       }
       return this[_declarations];
@@ -13854,21 +14294,21 @@
     })
   });
   const _symbol = Symbol('_symbol');
-  const _name$ = Symbol('_name');
+  const _name$0 = Symbol('_name');
   _js_mirrors.JsVariableMirror = class JsVariableMirror extends _js_mirrors.JsMirror {
     get simpleName() {
       return this[_symbol];
     }
     _(symbol, t, annotations) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.type = _js_mirrors.reflectType(t);
       this.metadata = ListOfInstanceMirror().unmodifiable(annotations[dartx.map](mirrors.InstanceMirror)(dart.fn(a => _js_mirrors.reflect(a), dynamicToInstanceMirror())));
       this.isStatic = false;
       this.isFinal = false;
     }
     toString() {
-      return dart.str`VariableMirror on '${this[_name$]}'`;
+      return dart.str`VariableMirror on '${this[_name$0]}'`;
     }
     get qualifiedName() {
       return core.Symbol._check(this.noSuchMethod(new dart.InvocationImpl('qualifiedName', [], {isGetter: true})));
@@ -13895,7 +14335,7 @@
     constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.Symbol, core.Type, core.List])}),
     fields: () => ({
       [_symbol]: core.Symbol,
-      [_name$]: core.String,
+      [_name$0]: core.String,
       type: mirrors.TypeMirror,
       metadata: ListOfInstanceMirror(),
       isStatic: core.bool,
@@ -13908,7 +14348,7 @@
       super._(member, t, annotations);
     }
     toString() {
-      return dart.str`ParameterMirror on '${this[_name$]}'`;
+      return dart.str`ParameterMirror on '${this[_name$0]}'`;
     }
     get qualifiedName() {
       return core.Symbol._check(this.noSuchMethod(new dart.InvocationImpl('qualifiedName', [], {isGetter: true})));
@@ -13953,17 +14393,17 @@
   let const$4;
   _js_mirrors.JsMethodMirror = class JsMethodMirror extends _js_mirrors.JsMirror {
     get isSetter() {
-      return this[_name$][dartx.endsWith]('=');
+      return this[_name$0][dartx.endsWith]('=');
     }
     get isPrivate() {
-      return this[_name$][dartx.startsWith]('_');
+      return this[_name$0][dartx.startsWith]('_');
     }
     get simpleName() {
       return this[_symbol];
     }
     _constructor(cls, symbol, ftype) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.isConstructor = true;
       this.isStatic = false;
       this[_params] = null;
@@ -13973,7 +14413,7 @@
     }
     _instanceMethod(cls, symbol, ftype) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.isConstructor = false;
       this.isStatic = false;
       this[_params] = null;
@@ -13983,7 +14423,7 @@
     }
     _staticMethod(cls, symbol, ftype) {
       this[_symbol] = symbol;
-      this[_name$] = _js_mirrors.getName(symbol);
+      this[_name$0] = _js_mirrors.getName(symbol);
       this.isConstructor = false;
       this.isStatic = true;
       this[_params] = null;
@@ -14033,7 +14473,7 @@
       this[_params] = ListOfParameterMirror().unmodifiable(params);
     }
     toString() {
-      return dart.str`MethodMirror on '${this[_name$]}'`;
+      return dart.str`MethodMirror on '${this[_name$0]}'`;
     }
     get qualifiedName() {
       return core.Symbol._check(this.noSuchMethod(new dart.InvocationImpl('qualifiedName', [], {isGetter: true})));
@@ -14093,7 +14533,7 @@
     }),
     fields: () => ({
       [_symbol]: core.Symbol,
-      [_name$]: core.String,
+      [_name$0]: core.String,
       [_params]: ListOfParameterMirror(),
       [_metadata$]: ListOfInstanceMirror(),
       isConstructor: core.bool,
@@ -14940,8 +15380,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(typed_data.Float32x4, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float32x4]),
-      sublist: dart.definiteFunctionType(core.List$(typed_data.Float32x4), [core.int], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float32x4])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeFloat32x4List, [
@@ -15573,8 +16012,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(typed_data.Int32x4, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Int32x4]),
-      sublist: dart.definiteFunctionType(core.List$(typed_data.Int32x4), [core.int], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Int32x4])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeInt32x4List, [
@@ -15690,8 +16128,7 @@
     }),
     methods: () => ({
       _get: dart.definiteFunctionType(typed_data.Float64x2, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float64x2]),
-      sublist: dart.definiteFunctionType(core.List$(typed_data.Float64x2), [core.int], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, typed_data.Float64x2])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeFloat64x2List, [
@@ -16056,8 +16493,7 @@
     getters: () => ({length: dart.definiteFunctionType(core.int, [])}),
     methods: () => ({
       _get: dart.definiteFunctionType(core.double, [core.int]),
-      _set: dart.definiteFunctionType(dart.void, [core.int, core.num]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfdouble()], [core.int])
+      _set: dart.definiteFunctionType(dart.void, [core.int, core.num])
     })
   });
   dart.defineExtensionMembers(_native_typed_data.NativeTypedArrayOfDouble, ['_get', '_set', 'setRange', 'length']);
@@ -16090,10 +16526,7 @@
   _native_typed_data.NativeTypedArrayOfInt[dart.implements] = () => [ListOfint()];
   dart.setSignature(_native_typed_data.NativeTypedArrayOfInt, {
     getters: () => ({length: dart.definiteFunctionType(core.int, [])}),
-    methods: () => ({
-      _set: dart.definiteFunctionType(dart.void, [core.int, core.int]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfint()], [core.int])
-    })
+    methods: () => ({_set: dart.definiteFunctionType(dart.void, [core.int, core.int])})
   });
   dart.defineExtensionMembers(_native_typed_data.NativeTypedArrayOfInt, ['_set', 'setRange', 'length']);
   dart.defineExtensionNames([
@@ -16137,7 +16570,6 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [ListOfdouble()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({[dartx.sublist]: dart.definiteFunctionType(core.List$(core.double), [core.int], [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeFloat32List, [dart.dynamic, dart.dynamic]),
@@ -16187,7 +16619,6 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [ListOfdouble()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({[dartx.sublist]: dart.definiteFunctionType(core.List$(core.double), [core.int], [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeFloat64List, [dart.dynamic, dart.dynamic]),
@@ -16242,10 +16673,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [_native_typed_data.NativeByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeInt16List, [dart.dynamic, dart.dynamic]),
@@ -16300,10 +16728,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeInt32List, [dart.dynamic, dart.dynamic]),
@@ -16358,10 +16783,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeInt8List, [dart.dynamic, dart.dynamic]),
@@ -16416,10 +16838,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint16List, [dart.dynamic, dart.dynamic]),
@@ -16474,10 +16893,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint32List, [dart.dynamic, dart.dynamic]),
@@ -16539,10 +16955,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint8ClampedList, [dart.dynamic, dart.dynamic]),
@@ -16605,10 +17018,7 @@
       fromList: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [ListOfint()]),
       view: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [typed_data.ByteBuffer, core.int, core.int])
     }),
-    methods: () => ({
-      [dartx._get]: dart.definiteFunctionType(core.int, [core.int]),
-      [dartx.sublist]: dart.definiteFunctionType(core.List$(core.int), [core.int], [core.int])
-    }),
+    methods: () => ({[dartx._get]: dart.definiteFunctionType(core.int, [core.int])}),
     statics: () => ({
       _create1: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [dart.dynamic]),
       _create2: dart.definiteFunctionType(_native_typed_data.NativeUint8List, [dart.dynamic, dart.dynamic]),
@@ -17301,6 +17711,8 @@
     return end;
   };
   dart.fn(_native_typed_data._checkValidRange, intAndintAndintToint());
+  async._Callback = dart.typedef('_Callback', () => dart.functionType(dart.void, []));
+  async._TakeCallback = dart.typedef('_TakeCallback', () => dart.functionType(dart.void, [async._Callback]));
   async._invokeErrorHandler = function(errorHandler, error, stackTrace) {
     if (async.ZoneBinaryCallback.is(errorHandler)) {
       return dart.dcall(errorHandler, error, stackTrace);
@@ -17420,10 +17832,7 @@
     dart.setSignature(_ControllerStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._ControllerStream$(T), [_StreamControllerLifecycleOfT()])}),
       fields: () => ({[_controller$]: _StreamControllerLifecycleOfT()}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        '==': dart.definiteFunctionType(core.bool, [core.Object])
-      })
+      methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])})
     });
     return _ControllerStream;
   });
@@ -17528,7 +17937,7 @@
       }
       onDone(handleDone) {
         if (handleDone == null) handleDone = async._nullDoneHandler;
-        this[_onDone] = this[_zone].registerCallback(dart.dynamic)(handleDone);
+        this[_onDone] = this[_zone].registerCallback(dart.void)(handleDone);
       }
       pause(resumeSignal) {
         if (resumeSignal === void 0) resumeSignal = null;
@@ -17567,11 +17976,11 @@
           let result = new (async._Future$(E))();
           this[_onDone] = dart.fn(() => {
             result[_complete](futureValue);
-          }, VoidTovoid$());
+          }, VoidToNull());
           this[_onError] = dart.fn((error, stackTrace) => {
             this.cancel();
             result[_completeError](error, core.StackTrace._check(stackTrace));
-          }, dynamicAnddynamicTodynamic$());
+          }, dynamicAnddynamicToNull());
           return result;
         };
       }
@@ -17681,7 +18090,7 @@
         dart.assert(!dart.test(this[_inCallback]));
         let wasInputPaused = this[_isInputPaused];
         this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-        this[_zone].runUnaryGuarded(dart.dynamic, T)(this[_onData], data);
+        this[_zone].runUnaryGuarded(dart.void, T)(this[_onData], data);
         this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
         this[_checkState](wasInputPaused);
       }
@@ -17722,7 +18131,7 @@
         const sendDone = (function() {
           if (!dart.test(this[_waitsForCancel])) return;
           this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_CANCELED | async._BufferingStreamSubscription._STATE_CLOSED | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-          this[_zone].runGuarded(dart.dynamic)(this[_onDone]);
+          this[_zone].runGuarded(dart.void)(this[_onDone]);
           this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
         }).bind(this);
         dart.fn(sendDone, VoidTovoid$());
@@ -17738,7 +18147,7 @@
         dart.assert(!dart.test(this[_inCallback]));
         let wasInputPaused = this[_isInputPaused];
         this[_state] = (dart.notNull(this[_state]) | async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
-        dart.dcall(callback);
+        callback();
         this[_state] = (dart.notNull(this[_state]) & ~async._BufferingStreamSubscription._STATE_IN_CALLBACK) >>> 0;
         this[_checkState](wasInputPaused);
       }
@@ -17819,7 +18228,7 @@
         [_sendData]: dart.definiteFunctionType(dart.void, [T]),
         [_sendError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
         [_sendDone]: dart.definiteFunctionType(dart.void, []),
-        [_guardCallback]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+        [_guardCallback]: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
         [_checkState]: dart.definiteFunctionType(dart.void, [core.bool])
       }),
       sfields: () => ({
@@ -18247,7 +18656,7 @@
   async._SyncBroadcastStreamController$ = dart.generic(T => {
     let _BufferingStreamSubscriptionOfT = () => (_BufferingStreamSubscriptionOfT = dart.constFn(async._BufferingStreamSubscription$(T)))();
     let SynchronousStreamControllerOfT = () => (SynchronousStreamControllerOfT = dart.constFn(async.SynchronousStreamController$(T)))();
-    let _BufferingStreamSubscriptionOfTTovoid = () => (_BufferingStreamSubscriptionOfTTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [_BufferingStreamSubscriptionOfT()])))();
+    let _BufferingStreamSubscriptionOfTToNull = () => (_BufferingStreamSubscriptionOfTToNull = dart.constFn(dart.definiteFunctionType(core.Null, [_BufferingStreamSubscriptionOfT()])))();
     class _SyncBroadcastStreamController extends async._BroadcastStreamController$(T) {
       new(onListen, onCancel) {
         super.new(onListen, onCancel);
@@ -18276,19 +18685,19 @@
         }
         this[_forEachListener](dart.fn(subscription => {
           subscription[_add$](data);
-        }, _BufferingStreamSubscriptionOfTTovoid()));
+        }, _BufferingStreamSubscriptionOfTToNull()));
       }
       [_sendError](error, stackTrace) {
         if (dart.test(this[_isEmpty])) return;
         this[_forEachListener](dart.fn(subscription => {
           subscription[_addError](error, stackTrace);
-        }, _BufferingStreamSubscriptionOfTTovoid()));
+        }, _BufferingStreamSubscriptionOfTToNull()));
       }
       [_sendDone]() {
         if (!dart.test(this[_isEmpty])) {
           this[_forEachListener](dart.fn(subscription => {
             subscription[_close$]();
-          }, _BufferingStreamSubscriptionOfTTovoid()));
+          }, _BufferingStreamSubscriptionOfTToNull()));
         } else {
           dart.assert(this[_doneFuture] != null);
           dart.assert(this[_doneFuture][_mayComplete]);
@@ -18415,10 +18824,7 @@
       constructors: () => ({new: dart.definiteFunctionType(async._AsBroadcastStreamController$(T), [VoidTovoid(), VoidTovoid()])}),
       fields: () => ({[_pending]: _StreamImplEventsOfT()}),
       getters: () => ({[_hasPending]: dart.definiteFunctionType(core.bool, [])}),
-      methods: () => ({
-        [_addPendingEvent]: dart.definiteFunctionType(dart.void, [async._DelayedEvent]),
-        add: dart.definiteFunctionType(dart.void, [T])
-      })
+      methods: () => ({[_addPendingEvent]: dart.definiteFunctionType(dart.void, [async._DelayedEvent])})
     });
     return _AsBroadcastStreamController;
   });
@@ -18437,7 +18843,7 @@
       onDone(handleDone) {}
       pause(resumeSignal) {
         if (resumeSignal === void 0) resumeSignal = null;
-        if (resumeSignal != null) resumeSignal.then(dart.dynamic)(dart.bind(this, _resume));
+        if (resumeSignal != null) resumeSignal.then(dart.void)(dart.bind(this, _resume));
         this[_pauseCount] = dart.notNull(this[_pauseCount]) + 1;
       }
       resume() {
@@ -18512,6 +18918,20 @@
     constructors: () => ({new: dart.definiteFunctionType(async.DeferredLoadException, [core.String])}),
     fields: () => ({[_s]: core.String})
   });
+  async.FutureOr$ = dart.generic(T => {
+    class FutureOr extends core.Object {
+      _() {
+        dart.throw(new core.UnsupportedError("FutureOr can't be instantiated"));
+      }
+    }
+    dart.addTypeTests(FutureOr);
+    dart.defineNamedConstructor(FutureOr, '_');
+    dart.setSignature(FutureOr, {
+      constructors: () => ({_: dart.definiteFunctionType(async.FutureOr$(T), [])})
+    });
+    return FutureOr;
+  });
+  async.FutureOr = FutureOr();
   const _completeWithValue = Symbol('_completeWithValue');
   let const$8;
   async.Future$ = dart.flattenFutures(dart.generic(T => {
@@ -18528,7 +18948,7 @@
             async._completeWithErrorCallback(result, e, s);
           }
 
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         return result;
       }
       static microtask(computation) {
@@ -18541,7 +18961,7 @@
             async._completeWithErrorCallback(result, e, s);
           }
 
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         return result;
       }
       static sync(computation) {
@@ -18575,13 +18995,13 @@
         let result = new (_FutureOfT())();
         async.Timer.new(duration, dart.fn(() => {
           try {
-            result[_complete](computation == null ? null : computation());
+            result[_complete](dart.nullSafe(computation, _ => _()));
           } catch (e) {
             let s = dart.stackTrace(e);
             async._completeWithErrorCallback(result, e, s);
           }
 
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         return result;
       }
       static wait(T) {
@@ -18601,7 +19021,7 @@
                   if (value != null) {
                     async.Future.sync(dart.fn(() => {
                       cleanUp(value);
-                    }, VoidTodynamic$()));
+                    }, VoidToNull()));
                   }
                 }
               }
@@ -18617,31 +19037,43 @@
             }
           }
           dart.fn(handleError, dynamicAnddynamicTovoid$());
-          for (let future of futures) {
-            let pos = remaining++;
-            future.then(dart.dynamic)(dart.fn(value => {
-              remaining--;
-              if (values != null) {
-                values[dartx._set](pos, value);
-                if (remaining == 0) {
-                  result[_completeWithValue](values);
+          try {
+            for (let future of futures) {
+              let pos = remaining;
+              future.then(dart.dynamic)(dart.fn(value => {
+                remaining--;
+                if (values != null) {
+                  values[dartx._set](pos, value);
+                  if (remaining == 0) {
+                    result[_completeWithValue](values);
+                  }
+                } else {
+                  if (cleanUp != null && value != null) {
+                    async.Future.sync(dart.fn(() => {
+                      cleanUp(value);
+                    }, VoidToNull()));
+                  }
+                  if (remaining == 0 && !dart.test(eagerError)) {
+                    result[_completeError](error, stackTrace);
+                  }
                 }
-              } else {
-                if (cleanUp != null && value != null) {
-                  async.Future.sync(dart.fn(() => {
-                    cleanUp(value);
-                  }, VoidTodynamic$()));
-                }
-                if (remaining == 0 && !dart.test(eagerError)) {
-                  result[_completeError](error, stackTrace);
-                }
-              }
-            }, dart.definiteFunctionType(dart.dynamic, [T])), {onError: handleError});
+              }, dart.definiteFunctionType(core.Null, [T])), {onError: handleError});
+              remaining++;
+            }
+            if (remaining == 0) {
+              return async.Future$(core.List$(T)).value(const$8 || (const$8 = dart.constList([], dart.dynamic)));
+            }
+            values = core.List$(T).new(remaining);
+          } catch (e) {
+            let st = dart.stackTrace(e);
+            if (remaining == 0 || dart.test(eagerError)) {
+              return async.Future$(core.List$(T)).error(e, st);
+            } else {
+              error = e;
+              stackTrace = st;
+            }
           }
-          if (remaining == 0) {
-            return async.Future$(core.List$(T)).value(const$8 || (const$8 = dart.constList([], dart.dynamic)));
-          }
-          values = core.List$(T).new(remaining);
+
           return result;
         };
       }
@@ -18650,10 +19082,10 @@
           let completer = async.Completer$(T).sync();
           let onValue = dart.fn(value => {
             if (!dart.test(completer.isCompleted)) completer.complete(value);
-          }, dart.definiteFunctionType(dart.dynamic, [T]));
+          }, dart.definiteFunctionType(core.Null, [T]));
           let onError = dart.fn((error, stack) => {
             if (!dart.test(completer.isCompleted)) completer.completeError(error, core.StackTrace._check(stack));
-          }, dynamicAnddynamicTodynamic$());
+          }, dynamicAnddynamicToNull());
           for (let future of futures) {
             future.then(dart.dynamic)(onValue, {onError: onError});
           }
@@ -18672,11 +19104,11 @@
         let nextIteration = null;
         nextIteration = async.Zone.current.bindUnaryCallback(dart.dynamic, core.bool)(dart.fn(keepGoing => {
           if (dart.test(keepGoing)) {
-            async.Future.sync(f).then(dart.dynamic)(dynamicTodynamic()._check(nextIteration), {onError: dart.bind(doneSignal, _completeError)});
+            async.Future.sync(f).then(dart.dynamic)(dynamicToFutureOr()._check(nextIteration), {onError: dart.bind(doneSignal, _completeError)});
           } else {
             doneSignal[_complete](null);
           }
-        }, boolTodynamic()), {runGuarded: true});
+        }, boolToNull()), {runGuarded: true});
         dart.dcall(nextIteration, true);
         return doneSignal;
       }
@@ -19013,6 +19445,7 @@
   const _setChained = Symbol('_setChained');
   const _thenNoZoneRegistration = Symbol('_thenNoZoneRegistration');
   const _setPendingComplete = Symbol('_setPendingComplete');
+  const _clearPendingComplete = Symbol('_clearPendingComplete');
   const _error = Symbol('_error');
   const _chainSource = Symbol('_chainSource');
   const _setValue = Symbol('_setValue');
@@ -19028,7 +19461,7 @@
     let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
     let FutureOfT = () => (FutureOfT = dart.constFn(async.Future$(T)))();
     let TTodynamic = () => (TTodynamic = dart.constFn(dart.functionType(dart.dynamic, [T])))();
-    let TTodynamic$ = () => (TTodynamic$ = dart.constFn(dart.definiteFunctionType(dart.dynamic, [T])))();
+    let TToNull = () => (TToNull = dart.constFn(dart.definiteFunctionType(core.Null, [T])))();
     class _Future extends core.Object {
       new() {
         this[_zone] = async.Zone.current;
@@ -19077,7 +19510,7 @@
           let currentZone = async.Zone.current;
           let registered = null;
           if (!core.identical(currentZone, async._ROOT_ZONE)) {
-            f = currentZone.registerUnaryCallback(dart.dynamic, T)(f);
+            f = currentZone.registerUnaryCallback(async.FutureOr$(E), T)(f);
             if (onError != null) {
               onError = async._registerErrorHandler(T)(onError, currentZone);
             }
@@ -19117,6 +19550,10 @@
         dart.assert(this[_mayComplete]);
         this[_state] = async._Future._PENDING_COMPLETE;
       }
+      [_clearPendingComplete]() {
+        dart.assert(this[_isPendingComplete]);
+        this[_state] = async._Future._INCOMPLETE;
+      }
       get [_error]() {
         dart.assert(this[_hasError]);
         return async.AsyncError._check(this[_resultOrListeners]);
@@ -19162,7 +19599,7 @@
           dart.assert(this[_isComplete]);
           this[_zone].scheduleMicrotask(dart.fn(() => {
             async._Future._propagateToListeners(this, listener);
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
       }
       [_prependListeners](listeners) {
@@ -19190,7 +19627,7 @@
           listeners = this[_reverseListeners](listeners);
           this[_zone].scheduleMicrotask(dart.fn(() => {
             async._Future._propagateToListeners(this, listeners);
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
       }
       [_removeListeners]() {
@@ -19217,17 +19654,18 @@
         try {
           source.then(dart.dynamic)(dart.fn(value => {
             dart.assert(target[_isPendingComplete]);
-            target[_completeWithValue](value);
-          }, dynamicTodynamic$()), {onError: dart.fn((error, stackTrace) => {
+            target[_clearPendingComplete]();
+            target[_complete](value);
+          }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
               if (stackTrace === void 0) stackTrace = null;
               dart.assert(target[_isPendingComplete]);
               target[_completeError](error, core.StackTrace._check(stackTrace));
-            }, dynamic__Todynamic())});
+            }, dynamic__ToNull())});
         } catch (e) {
           let s = dart.stackTrace(e);
           async.scheduleMicrotask(dart.fn(() => {
             target[_completeError](e, s);
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
 
       }
@@ -19285,7 +19723,7 @@
               this[_setPendingComplete]();
               this[_zone].scheduleMicrotask(dart.fn(() => {
                 async._Future._chainCoreFuture(coreFuture, this);
-              }, VoidTovoid$()));
+              }, VoidToNull()));
             } else {
               async._Future._chainCoreFuture(coreFuture, this);
             }
@@ -19298,14 +19736,14 @@
         this[_setPendingComplete]();
         this[_zone].scheduleMicrotask(dart.fn(() => {
           this[_completeWithValue](typedValue);
-        }, VoidTovoid$()));
+        }, VoidToNull()));
       }
       [_asyncCompleteError](error, stackTrace) {
         dart.assert(!dart.test(this[_isComplete]));
         this[_setPendingComplete]();
         this[_zone].scheduleMicrotask(dart.fn(() => {
           this[_completeError](error, stackTrace);
-        }, VoidTovoid$()));
+        }, VoidToNull()));
       }
       static _propagateToListeners(source, listeners) {
         while (true) {
@@ -19449,7 +19887,7 @@
         if (onTimeout == null) {
           timer = async.Timer.new(timeLimit, dart.fn(() => {
             result[_completeError](new async.TimeoutException("Future not completed", timeLimit));
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         } else {
           let zone = async.Zone.current;
           onTimeout = zone.registerCallback(dart.dynamic)(onTimeout);
@@ -19461,19 +19899,19 @@
               result[_completeError](e, s);
             }
 
-          }, VoidTovoid$()));
+          }, VoidToNull()));
         }
         this.then(dart.dynamic)(dart.fn(v => {
           if (dart.test(timer.isActive)) {
             timer.cancel();
             result[_completeWithValue](v);
           }
-        }, TTodynamic$()), {onError: dart.fn((e, s) => {
+        }, TToNull()), {onError: dart.fn((e, s) => {
             if (dart.test(timer.isActive)) {
               timer.cancel();
               result[_completeError](e, core.StackTrace._check(s));
             }
-          }, dynamicAnddynamicTodynamic$())});
+          }, dynamicAnddynamicToNull())});
         return result;
       }
     }
@@ -19504,12 +19942,13 @@
       }),
       methods: () => ({
         [_setChained]: dart.definiteFunctionType(dart.void, [async._Future]),
-        then: dart.definiteFunctionType(E => [async.Future$(E), [TTodynamic()], {onError: core.Function}]),
+        then: dart.definiteFunctionType(E => [async.Future$(E), [dart.functionType(async.FutureOr$(E), [T])], {onError: core.Function}]),
         [_thenNoZoneRegistration]: dart.definiteFunctionType(E => [async.Future$(E), [TTodynamic(), core.Function]]),
         catchError: dart.definiteFunctionType(async.Future$(T), [core.Function], {test: dynamicTobool()}),
         whenComplete: dart.definiteFunctionType(async.Future$(T), [VoidTodynamic()]),
         asStream: dart.definiteFunctionType(async.Stream$(T), []),
         [_setPendingComplete]: dart.definiteFunctionType(dart.void, []),
+        [_clearPendingComplete]: dart.definiteFunctionType(dart.void, []),
         [_setValue]: dart.definiteFunctionType(dart.void, [T]),
         [_setErrorObject]: dart.definiteFunctionType(dart.void, [async.AsyncError]),
         [_setError]: dart.definiteFunctionType(dart.void, [core.Object, core.StackTrace]),
@@ -19630,41 +20069,41 @@
     }
     let implementation = currentZone[_scheduleMicrotask];
     if (core.identical(async._ROOT_ZONE, implementation.zone) && dart.test(async._ROOT_ZONE.inSameErrorZone(currentZone))) {
-      async._rootScheduleMicrotask(null, null, currentZone, currentZone.registerCallback(dart.dynamic)(callback));
+      async._rootScheduleMicrotask(null, null, currentZone, currentZone.registerCallback(dart.void)(callback));
       return;
     }
-    async.Zone.current.scheduleMicrotask(async.Zone.current.bindCallback(dart.dynamic)(callback, {runGuarded: true}));
+    async.Zone.current.scheduleMicrotask(async.Zone.current.bindCallback(dart.void)(callback, {runGuarded: true}));
   };
   dart.fn(async.scheduleMicrotask, _AsyncCallbackTovoid());
   async._AsyncRun = class _AsyncRun extends core.Object {
     static _scheduleImmediate(callback) {
-      dart.dcall(async._AsyncRun._scheduleImmediateClosure, callback);
+      async._AsyncRun._scheduleImmediateClosure(callback);
     }
     static _initializeScheduleImmediate() {
-      if (self.scheduleImmediate != null) {
+      if (_isolate_helper.global.scheduleImmediate != null) {
         return async._AsyncRun._scheduleImmediateJsOverride;
       }
-      if (self.MutationObserver != null && self.document != null) {
-        let div = self.document.createElement("div");
-        let span = self.document.createElement("span");
+      if (_isolate_helper.global.MutationObserver != null && _isolate_helper.global.document != null) {
+        let div = _isolate_helper.global.document.createElement("div");
+        let span = _isolate_helper.global.document.createElement("span");
         let storedCallback = null;
         function internalCallback(_) {
           _isolate_helper.leaveJsAsync();
           let f = storedCallback;
           storedCallback = null;
-          dart.dcall(f);
+          f();
         }
-        dart.fn(internalCallback, dynamicTodynamic$());
+        dart.fn(internalCallback, dynamicToNull$());
         ;
-        let observer = new self.MutationObserver(internalCallback);
+        let observer = new _isolate_helper.global.MutationObserver(internalCallback);
         observer.observe(div, {childList: true});
         return dart.fn(callback => {
           dart.assert(storedCallback == null);
           _isolate_helper.enterJsAsync();
           storedCallback = callback;
           div.firstChild ? div.removeChild(span) : div.appendChild(span);
-        }, FnTodynamic());
-      } else if (self.setImmediate != null) {
+        }, FnToNull());
+      } else if (_isolate_helper.global.setImmediate != null) {
         return async._AsyncRun._scheduleImmediateWithSetImmediate;
       }
       return async._AsyncRun._scheduleImmediateWithTimer;
@@ -19674,30 +20113,30 @@
         _isolate_helper.leaveJsAsync();
         callback();
       }
-      dart.fn(internalCallback, VoidTodynamic$());
+      dart.fn(internalCallback, VoidToNull());
       ;
       _isolate_helper.enterJsAsync();
-      self.scheduleImmediate(internalCallback);
+      _isolate_helper.global.scheduleImmediate(internalCallback);
     }
     static _scheduleImmediateWithSetImmediate(callback) {
       function internalCallback() {
         _isolate_helper.leaveJsAsync();
         callback();
       }
-      dart.fn(internalCallback, VoidTodynamic$());
+      dart.fn(internalCallback, VoidToNull());
       ;
       _isolate_helper.enterJsAsync();
-      self.setImmediate(internalCallback);
+      _isolate_helper.global.setImmediate(internalCallback);
     }
     static _scheduleImmediateWithTimer(callback) {
       async.Timer._createTimer(core.Duration.ZERO, callback);
     }
   };
   dart.setSignature(async._AsyncRun, {
-    sfields: () => ({_scheduleImmediateClosure: core.Function}),
+    sfields: () => ({_scheduleImmediateClosure: async._TakeCallback}),
     statics: () => ({
       _scheduleImmediate: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
-      _initializeScheduleImmediate: dart.definiteFunctionType(core.Function, []),
+      _initializeScheduleImmediate: dart.definiteFunctionType(async._TakeCallback, []),
       _scheduleImmediateJsOverride: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
       _scheduleImmediateWithSetImmediate: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
       _scheduleImmediateWithTimer: dart.definiteFunctionType(dart.void, [VoidTovoid()])
@@ -19753,10 +20192,7 @@
     dart.setSignature(StreamView, {
       constructors: () => ({new: dart.definiteFunctionType(async.StreamView$(T), [StreamOfT()])}),
       fields: () => ({[_stream]: StreamOfT()}),
-      methods: () => ({
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
-        listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})
-      })
+      methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
     });
     return StreamView;
   });
@@ -20101,7 +20537,7 @@
         subscription[_setPendingEvents](pendingEvents);
         subscription[_guardCallback](dart.fn(() => {
           async._runGuarded(this.onListen);
-        }, VoidTodynamic$()));
+        }, VoidToNull()));
         return subscription;
       }
       [_recordCancel](subscription) {
@@ -20361,7 +20797,7 @@
         return dart.fn((e, s) => {
           controller[_addError](e, s);
           controller[_close$]();
-        }, dynamicAndStackTraceTodynamic());
+        }, dynamicAndStackTraceToNull());
       }
       pause() {
         this.addSubscription.pause();
@@ -20377,7 +20813,7 @@
         }
         return cancel.whenComplete(dart.fn(() => {
           this.addStreamFuture[_asyncComplete](null);
-        }, VoidTodynamic$()));
+        }, VoidToNull()));
       }
       complete() {
         this.addStreamFuture[_asyncComplete](null);
@@ -20461,8 +20897,7 @@
       fields: () => ({
         [_pending]: _EventGeneratorOfT(),
         [_isUsed]: core.bool
-      }),
-      methods: () => ({[_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool])})
+      })
     });
     return _GeneratedStreamImpl;
   });
@@ -20495,7 +20930,7 @@
           this[_state] = async._PendingEvents._STATE_UNSCHEDULED;
           if (oldState == async._PendingEvents._STATE_CANCELED) return;
           this.handleNext(dispatch);
-        }, VoidTovoid$()));
+        }, VoidToNull()));
         this[_state] = async._PendingEvents._STATE_SCHEDULED;
       }
       cancelSchedule() {
@@ -20802,7 +21237,7 @@
           let result = new (async._Future$(E))();
           this[_onDone] = dart.fn(() => {
             result[_completeWithValue](null);
-          }, VoidTovoid$());
+          }, VoidToNull());
           return result;
         };
       }
@@ -20810,7 +21245,7 @@
         this[_state] = (dart.notNull(this[_state]) & ~async._DoneStreamSubscription._SCHEDULED) >>> 0;
         if (dart.test(this.isPaused)) return;
         this[_state] = (dart.notNull(this[_state]) | async._DoneStreamSubscription._DONE_SENT) >>> 0;
-        if (this[_onDone] != null) this[_zone].runGuarded(dart.dynamic)(this[_onDone]);
+        if (this[_onDone] != null) this[_zone].runGuarded(dart.void)(this[_onDone]);
       }
     }
     dart.addTypeTests(_DoneStreamSubscription);
@@ -20895,7 +21330,7 @@
       [_onCancel]() {
         let shutdown = this[_controller$] == null || dart.test(this[_controller$].isClosed);
         if (this[_onCancelHandler] != null) {
-          this[_zone].runUnary(dart.dynamic, _BroadcastSubscriptionWrapperOfT())(this[_onCancelHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
+          this[_zone].runUnary(dart.void, _BroadcastSubscriptionWrapperOfT())(this[_onCancelHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
         }
         if (shutdown) {
           if (this[_subscription] != null) {
@@ -20906,7 +21341,7 @@
       }
       [_onListen]() {
         if (this[_onListenHandler] != null) {
-          this[_zone].runUnary(dart.dynamic, _BroadcastSubscriptionWrapperOfT())(this[_onListenHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
+          this[_zone].runUnary(dart.void, _BroadcastSubscriptionWrapperOfT())(this[_onListenHandler], new (_BroadcastSubscriptionWrapperOfT())(this));
         }
       }
       [_cancelSubscription]() {
@@ -21221,7 +21656,7 @@
   async._cancelAndErrorClosure = function(subscription, future) {
     return dart.fn((error, stackTrace) => {
       async._cancelAndError(subscription, future, error, stackTrace);
-    }, dynamicAndStackTraceTovoid());
+    }, dynamicAndStackTraceToNull());
   };
   dart.fn(async._cancelAndErrorClosure, StreamSubscriptionAnd_FutureTo_ErrorCallback());
   async._cancelAndValue = function(subscription, future, value) {
@@ -21341,7 +21776,6 @@
         [_subscription]: StreamSubscriptionOfS()
       }),
       methods: () => ({
-        [_add$]: dart.definiteFunctionType(dart.void, [T]),
         [_handleData]: dart.definiteFunctionType(dart.void, [S]),
         [_handleError]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
         [_handleDone]: dart.definiteFunctionType(dart.void, [])
@@ -21393,8 +21827,7 @@
     }
     dart.setSignature(_WhereStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._WhereStream$(T), [StreamOfT(), _PredicateOfT()])}),
-      fields: () => ({[_test]: _PredicateOfT()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])})
+      fields: () => ({[_test]: _PredicateOfT()})
     });
     return _WhereStream;
   });
@@ -21431,8 +21864,7 @@
     }
     dart.setSignature(_MapStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._MapStream$(S, T), [StreamOfS(), _TransformationOfS$T()])}),
-      fields: () => ({[_transform]: _TransformationOfS$T()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [S, _EventSinkOfT()])})
+      fields: () => ({[_transform]: _TransformationOfS$T()})
     });
     return _MapStream;
   });
@@ -21464,8 +21896,7 @@
     }
     dart.setSignature(_ExpandStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._ExpandStream$(S, T), [StreamOfS(), _TransformationOfS$IterableOfT()])}),
-      fields: () => ({[_expand]: _TransformationOfS$IterableOfT()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [S, _EventSinkOfT()])})
+      fields: () => ({[_expand]: _TransformationOfS$IterableOfT()})
     });
     return _ExpandStream;
   });
@@ -21554,11 +21985,7 @@
     }
     dart.setSignature(_TakeStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._TakeStream$(T), [StreamOfT(), core.int])}),
-      fields: () => ({[_count]: core.int}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-      })
+      fields: () => ({[_count]: core.int})
     });
     return _TakeStream;
   });
@@ -21632,8 +22059,7 @@
     }
     dart.setSignature(_TakeWhileStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._TakeWhileStream$(T), [StreamOfT(), _PredicateOfT()])}),
-      fields: () => ({[_test]: _PredicateOfT()}),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])})
+      fields: () => ({[_test]: _PredicateOfT()})
     });
     return _TakeWhileStream;
   });
@@ -21666,11 +22092,7 @@
     }
     dart.setSignature(_SkipStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._SkipStream$(T), [StreamOfT(), core.int])}),
-      fields: () => ({[_count]: core.int}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-      })
+      fields: () => ({[_count]: core.int})
     });
     return _SkipStream;
   });
@@ -21716,11 +22138,7 @@
     }
     dart.setSignature(_SkipWhileStream, {
       constructors: () => ({new: dart.definiteFunctionType(async._SkipWhileStream$(T), [StreamOfT(), _PredicateOfT()])}),
-      fields: () => ({[_test]: _PredicateOfT()}),
-      methods: () => ({
-        [_createSubscription]: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid(), core.Function, VoidTovoid(), core.bool]),
-        [_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])
-      })
+      fields: () => ({[_test]: _PredicateOfT()})
     });
     return _SkipWhileStream;
   });
@@ -21774,7 +22192,6 @@
         [_equals]: _EqualityOfT(),
         [_previous$]: core.Object
       }),
-      methods: () => ({[_handleData]: dart.definiteFunctionType(dart.void, [T, _EventSinkOfT()])}),
       sfields: () => ({_SENTINEL: core.Object})
     });
     return _DistinctStream;
@@ -21915,7 +22332,6 @@
       }),
       getters: () => ({[_isSubscribed]: dart.definiteFunctionType(core.bool, [])}),
       methods: () => ({
-        [_add$]: dart.definiteFunctionType(dart.void, [T]),
         [_handleData]: dart.definiteFunctionType(dart.void, [S]),
         [_handleError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [dart.dynamic]),
         [_handleDone]: dart.definiteFunctionType(dart.void, [])
@@ -22083,7 +22499,6 @@
     }
     dart.setSignature(_StreamHandlerTransformer, {
       constructors: () => ({new: dart.definiteFunctionType(async._StreamHandlerTransformer$(S, T), [], {handleData: SAndEventSinkOfTTovoid(), handleError: ObjectAndStackTraceAndEventSinkOfTTovoid(), handleDone: EventSinkOfTTovoid()})}),
-      methods: () => ({bind: dart.definiteFunctionType(async.Stream$(T), [StreamOfS()])}),
       statics: () => ({
         _defaultHandleData: dart.definiteFunctionType(dart.void, [dart.dynamic, async.EventSink]),
         _defaultHandleError: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace, async.EventSink]),
@@ -22162,7 +22577,7 @@
       if (dart.equals(async.Zone.current, async.Zone.ROOT)) {
         return async.Zone.current.createTimer(duration, callback);
       }
-      return async.Zone.current.createTimer(duration, async.Zone.current.bindCallback(dart.dynamic)(callback, {runGuarded: true}));
+      return async.Zone.current.createTimer(duration, async.Zone.current.bindCallback(dart.void)(callback, {runGuarded: true}));
     }
     static periodic(duration, callback) {
       if (dart.equals(async.Zone.current, async.Zone.ROOT)) {
@@ -22823,7 +23238,7 @@
         if (error == null) error = new core.NullThrownError();
         if (stackTrace == null) dart.throw(error);
         async._rethrow(error, stackTrace);
-      }, VoidTovoid$()));
+      }, VoidToNull()));
     };
   };
   dart.lazyFn(async._rootHandleUncaughtError, () => ZoneAndZoneDelegateAndZone__ToR());
@@ -22901,7 +23316,7 @@
   dart.fn(async._rootScheduleMicrotask, ZoneAndZoneDelegateAndZone__Tovoid());
   async._rootCreateTimer = function(self, parent, zone, duration, callback) {
     if (!core.identical(async._ROOT_ZONE, zone)) {
-      callback = zone.bindCallback(dart.dynamic)(callback);
+      callback = zone.bindCallback(dart.void)(callback);
     }
     return async.Timer._createTimer(duration, callback);
   };
@@ -23259,13 +23674,13 @@
     let _HashMapKeyIterableOfK = () => (_HashMapKeyIterableOfK = dart.constFn(collection._HashMapKeyIterable$(K)))();
     let MappedIterableOfK$V = () => (MappedIterableOfK$V = dart.constFn(_internal.MappedIterable$(K, V)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let ListOfK = () => (ListOfK = dart.constFn(core.List$(K)))();
     let HashMapOfK$V = () => (HashMapOfK$V = dart.constFn(collection.HashMap$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
     let KToV = () => (KToV = dart.constFn(dart.definiteFunctionType(V, [K])))();
     let KTobool = () => (KTobool = dart.constFn(dart.definiteFunctionType(core.bool, [K])))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     class _HashMap extends core.Object {
       new() {
         this[_length$1] = 0;
@@ -23313,7 +23728,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       _get(key) {
         if (dart.test(collection._HashMap._isStringKey(key))) {
@@ -23664,11 +24079,6 @@
         [_equals$]: _EqualityOfK(),
         [_hashCode]: _HasherOfK(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        _get: dart.definiteFunctionType(V, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [K, V]),
-        remove: dart.definiteFunctionType(V, [core.Object])
       })
     });
     dart.defineExtensionMembers(_CustomHashMap, ['_get', '_set', 'containsKey', 'remove']);
@@ -23711,8 +24121,7 @@
     dart.setSignature(_HashMapKeyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(collection._HashMapKeyIterable$(E), [_HashMapOfE$dynamic()])}),
       fields: () => ({[_map$0]: _HashMapOfE$dynamic()}),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(_HashMapKeyIterable, [
       'contains',
@@ -23812,11 +24221,11 @@
   collection._Es6LinkedIdentityHashMap$ = dart.generic((K, V) => {
     let _Es6MapIterableOfK = () => (_Es6MapIterableOfK = dart.constFn(collection._Es6MapIterable$(K)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let InternalMapOfK$V = () => (InternalMapOfK$V = dart.constFn(_js_helper.InternalMap$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let _Es6MapIterableOfV = () => (_Es6MapIterableOfV = dart.constFn(collection._Es6MapIterable$(V)))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     let VTobool = () => (VTobool = dart.constFn(dart.definiteFunctionType(core.bool, [V])))();
     class _Es6LinkedIdentityHashMap extends collection._LinkedIdentityHashMap$(K, V) {
       new() {
@@ -23849,7 +24258,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       _get(key) {
         return this[_map$0].get(key);
@@ -23909,19 +24318,7 @@
         [_map$0]: dart.dynamic,
         [_modifications$]: core.int
       }),
-      getters: () => ({
-        keys: dart.definiteFunctionType(core.Iterable$(K), []),
-        values: dart.definiteFunctionType(core.Iterable$(V), [])
-      }),
-      methods: () => ({
-        addAll: dart.definiteFunctionType(dart.void, [MapOfK$V()]),
-        _get: dart.definiteFunctionType(V, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [K, V]),
-        putIfAbsent: dart.definiteFunctionType(V, [K, VoidToV()]),
-        remove: dart.definiteFunctionType(V, [core.Object]),
-        forEach: dart.definiteFunctionType(dart.void, [KAndVTovoid()]),
-        [_modified$]: dart.definiteFunctionType(dart.void, [])
-      })
+      methods: () => ({[_modified$]: dart.definiteFunctionType(dart.void, [])})
     });
     dart.defineExtensionMembers(_Es6LinkedIdentityHashMap, [
       'containsKey',
@@ -23991,8 +24388,7 @@
         [_map$0]: dart.dynamic,
         [_isKeys]: core.bool
       }),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({forEach: dart.definiteFunctionType(dart.void, [ETovoid()])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])})
     });
     dart.defineExtensionMembers(_Es6MapIterable, [
       'contains',
@@ -24111,11 +24507,6 @@
         [_equals$]: _EqualityOfK(),
         [_hashCode]: _HasherOfK(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        _get: dart.definiteFunctionType(V, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [K, V]),
-        remove: dart.definiteFunctionType(V, [core.Object])
       })
     });
     dart.defineExtensionMembers(_LinkedCustomHashMap, ['_get', '_set', 'containsKey', 'remove']);
@@ -24487,11 +24878,7 @@
       }
     }
     dart.setSignature(_HashSetBase, {
-      methods: () => ({
-        difference: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        intersection: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
-      })
+      methods: () => ({toSet: dart.definiteFunctionType(core.Set$(E), [])})
     });
     dart.defineExtensionMembers(_HashSetBase, ['toSet']);
     return _HashSetBase;
@@ -24741,7 +25128,6 @@
         [_lookup]: dart.definiteFunctionType(E, [core.Object]),
         add: dart.definiteFunctionType(core.bool, [E]),
         [_add$0]: dart.definiteFunctionType(core.bool, [E]),
-        addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
         [_remove]: dart.definiteFunctionType(core.bool, [core.Object]),
         [_computeElements]: dart.definiteFunctionType(core.List$(E), []),
@@ -24792,9 +25178,6 @@
         return -1;
       }
     }
-    dart.setSignature(_IdentityHashSet, {
-      methods: () => ({[_newSet]: dart.definiteFunctionType(core.Set$(E), [])})
-    });
     return _IdentityHashSet;
   });
   collection._IdentityHashSet = _IdentityHashSet();
@@ -24848,11 +25231,6 @@
         [_equality]: _EqualityOfE(),
         [_hasher]: _HasherOfE(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
-        add: dart.definiteFunctionType(core.bool, [E]),
-        lookup: dart.definiteFunctionType(E, [core.Object])
       })
     });
     dart.defineExtensionMembers(_CustomHashSet, ['contains']);
@@ -25184,9 +25562,7 @@
       }),
       getters: () => ({
         iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        length: dart.definiteFunctionType(core.int, []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, [])
+        length: dart.definiteFunctionType(core.int, [])
       }),
       methods: () => ({
         [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
@@ -25195,13 +25571,10 @@
         [_contains]: dart.definiteFunctionType(core.bool, [core.Object]),
         lookup: dart.definiteFunctionType(E, [core.Object]),
         [_lookup]: dart.definiteFunctionType(E, [core.Object]),
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
         add: dart.definiteFunctionType(core.bool, [E]),
         [_add$0]: dart.definiteFunctionType(core.bool, [E]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
         [_remove]: dart.definiteFunctionType(core.bool, [core.Object]),
-        removeWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
-        retainWhere: dart.definiteFunctionType(dart.void, [ETobool()]),
         [_filterWhere]: dart.definiteFunctionType(dart.void, [ETobool(), core.bool]),
         [_addHashTableEntry$]: dart.definiteFunctionType(core.bool, [dart.dynamic, E]),
         [_removeHashTableEntry$]: dart.definiteFunctionType(core.bool, [dart.dynamic, core.Object]),
@@ -25257,9 +25630,6 @@
         return -1;
       }
     }
-    dart.setSignature(_LinkedIdentityHashSet, {
-      methods: () => ({[_newSet]: dart.definiteFunctionType(core.Set$(E), [])})
-    });
     return _LinkedIdentityHashSet;
   });
   collection._LinkedIdentityHashSet = _LinkedIdentityHashSet();
@@ -25325,11 +25695,6 @@
         [_equality]: _EqualityOfE(),
         [_hasher]: _HasherOfE(),
         [_validKey]: _PredicateOfObject()
-      }),
-      methods: () => ({
-        [_newSet]: dart.definiteFunctionType(core.Set$(E), []),
-        add: dart.definiteFunctionType(core.bool, [E]),
-        lookup: dart.definiteFunctionType(E, [core.Object])
       })
     });
     dart.defineExtensionMembers(_LinkedCustomHashSet, ['contains']);
@@ -25493,7 +25858,7 @@
         let result = HashMapOfK$V().new();
         other[dartx.forEach](dart.fn((k, v) => {
           result._set(K.as(k), V.as(v));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return result;
       }
       static fromIterable(iterable, opts) {
@@ -26045,7 +26410,7 @@
         let result = LinkedHashMapOfK$V().new();
         other[dartx.forEach](dart.fn((k, v) => {
           result._set(K.as(k), V.as(v));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return result;
       }
       static fromIterable(iterable, opts) {
@@ -26275,19 +26640,13 @@
         [_length$1]: core.int,
         [_first$]: E
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
       methods: () => ({
         addFirst: dart.definiteFunctionType(dart.void, [E]),
         add: dart.definiteFunctionType(dart.void, [E]),
         addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         remove: dart.definiteFunctionType(core.bool, [E]),
         clear: dart.definiteFunctionType(dart.void, []),
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
         [_insertBefore$]: dart.definiteFunctionType(dart.void, [E, E], {updateFirst: core.bool}),
         [_unlink$]: dart.definiteFunctionType(dart.void, [E])
       })
@@ -26579,12 +26938,7 @@
     dart.setSignature(_MapBaseValueIterable, {
       constructors: () => ({new: dart.definiteFunctionType(collection._MapBaseValueIterable$(K, V), [MapOfK$V()])}),
       fields: () => ({[_map$0]: MapOfK$V()}),
-      getters: () => ({
-        first: dart.definiteFunctionType(V, []),
-        single: dart.definiteFunctionType(V, []),
-        last: dart.definiteFunctionType(V, []),
-        iterator: dart.definiteFunctionType(core.Iterator$(V), [])
-      })
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(V), [])})
     });
     dart.defineExtensionMembers(_MapBaseValueIterable, [
       'length',
@@ -26811,7 +27165,7 @@
           result.write(k);
           result.write(': ');
           result.write(v);
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         result.write('}');
       } finally {
         dart.assert(core.identical(collection._toStringVisiting[dartx.last], m));
@@ -27257,12 +27611,7 @@
         [_sentinel]: _DoubleLinkedQueueSentinelOfE(),
         [_elementCount]: core.int
       }),
-      getters: () => ({
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, []),
-        iterator: dart.definiteFunctionType(collection._DoubleLinkedQueueIterator$(E), [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(collection._DoubleLinkedQueueIterator$(E), [])}),
       methods: () => ({
         addLast: dart.definiteFunctionType(dart.void, [E]),
         addFirst: dart.definiteFunctionType(dart.void, [E]),
@@ -27634,16 +27983,8 @@
         [_tail]: core.int,
         [_modificationCount]: core.int
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
       methods: () => ({
-        forEach: dart.definiteFunctionType(dart.void, [ETovoid()]),
-        elementAt: dart.definiteFunctionType(E, [core.int]),
-        toList: dart.definiteFunctionType(core.List$(E), [], {growable: core.bool}),
         add: dart.definiteFunctionType(dart.void, [E]),
         addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
@@ -27951,16 +28292,16 @@
     let ComparatorOfK = () => (ComparatorOfK = dart.constFn(core.Comparator$(K)))();
     let SplayTreeMapOfK$V = () => (SplayTreeMapOfK$V = dart.constFn(collection.SplayTreeMap$(K, V)))();
     let MapOfK$V = () => (MapOfK$V = dart.constFn(core.Map$(K, V)))();
-    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let _SplayTreeNodeIteratorOfK = () => (_SplayTreeNodeIteratorOfK = dart.constFn(collection._SplayTreeNodeIterator$(K)))();
     let _SplayTreeKeyIterableOfK = () => (_SplayTreeKeyIterableOfK = dart.constFn(collection._SplayTreeKeyIterable$(K)))();
     let _SplayTreeValueIterableOfK$V = () => (_SplayTreeValueIterableOfK$V = dart.constFn(collection._SplayTreeValueIterable$(K, V)))();
+    let KAndVTovoid = () => (KAndVTovoid = dart.constFn(dart.functionType(dart.void, [K, V])))();
     let dynamicToK = () => (dynamicToK = dart.constFn(dart.functionType(K, [dart.dynamic])))();
     let IterableOfK = () => (IterableOfK = dart.constFn(core.Iterable$(K)))();
     let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
     let dynamicToV = () => (dynamicToV = dart.constFn(dart.functionType(V, [dart.dynamic])))();
     let IterableOfV = () => (IterableOfV = dart.constFn(core.Iterable$(V)))();
-    let KAndVTovoid$ = () => (KAndVTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [K, V])))();
+    let KAndVToNull = () => (KAndVToNull = dart.constFn(dart.definiteFunctionType(core.Null, [K, V])))();
     class SplayTreeMap extends collection._SplayTree$(K, collection._SplayTreeMapNode$(K, V)) {
       new(compare, isValidKey) {
         if (compare === void 0) compare = null;
@@ -27983,7 +28324,7 @@
         let result = new (SplayTreeMapOfK$V())(compare, isValidKey);
         other[dartx.forEach](dart.fn((k, v) => {
           result._set(K.as(k), V.as(v));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return result;
       }
       static fromIterable(iterable, opts) {
@@ -28069,7 +28410,7 @@
         MapOfK$V()._check(other);
         other[dartx.forEach](dart.fn((key, value) => {
           this._set(key, value);
-        }, KAndVTovoid$()));
+        }, KAndVToNull()));
       }
       get isEmpty() {
         return this[_root] == null;
@@ -28344,8 +28685,7 @@
     dart.setSignature(_SplayTreeKeyIterable, {
       constructors: () => ({new: dart.definiteFunctionType(collection._SplayTreeKeyIterable$(K), [_SplayTreeOfK$_SplayTreeNodeOfK()])}),
       fields: () => ({[_tree]: _SplayTreeOfK$_SplayTreeNodeOfK()}),
-      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])}),
-      methods: () => ({toSet: dart.definiteFunctionType(core.Set$(K), [])})
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(K), [])})
     });
     dart.defineExtensionMembers(_SplayTreeKeyIterable, ['toSet', 'length', 'isEmpty', 'iterator']);
     return _SplayTreeKeyIterable;
@@ -28615,24 +28955,14 @@
         [_comparator]: ComparatorOfE(),
         [_validKey]: collection._Predicate
       }),
-      getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, [])
-      }),
+      getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
       methods: () => ({
         [_compare]: dart.definiteFunctionType(core.int, [E, E]),
         add: dart.definiteFunctionType(core.bool, [E]),
         remove: dart.definiteFunctionType(core.bool, [core.Object]),
-        addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
         lookup: dart.definiteFunctionType(E, [core.Object]),
-        intersection: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        difference: dart.definiteFunctionType(core.Set$(E), [SetOfObject()]),
-        union: dart.definiteFunctionType(core.Set$(E), [SetOfE()]),
         [_clone]: dart.definiteFunctionType(collection.SplayTreeSet$(E), []),
-        [_copyNode]: dart.definiteFunctionType(collection._SplayTreeNode$(E), [_SplayTreeNodeOfE()]),
-        toSet: dart.definiteFunctionType(core.Set$(E), [])
+        [_copyNode]: dart.definiteFunctionType(collection._SplayTreeNode$(E), [_SplayTreeNodeOfE()])
       })
     });
     dart.defineExtensionMembers(SplayTreeSet, [
@@ -28699,7 +29029,7 @@
   const _data = Symbol('_data');
   const _isUpgraded = Symbol('_isUpgraded');
   const _upgradedMap = Symbol('_upgradedMap');
-  const _process = Symbol('_process');
+  const _process$ = Symbol('_process');
   const _upgrade = Symbol('_upgrade');
   convert._JsonMap = class _JsonMap extends core.Object {
     new(original) {
@@ -28714,7 +29044,7 @@
         return null;
       } else {
         let result = convert._JsonMap._getProperty(this[_processed], core.String._check(key));
-        if (dart.test(convert._JsonMap._isUnprocessed(result))) result = this[_process](core.String._check(key));
+        if (dart.test(convert._JsonMap._isUnprocessed(result))) result = this[_process$](core.String._check(key));
         return result;
       }
     }
@@ -28753,7 +29083,7 @@
     addAll(other) {
       other[dartx.forEach](dart.fn((key, value) => {
         this._set(key, value);
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
     }
     containsValue(value) {
       if (dart.test(this[_isUpgraded])) return this[_upgradedMap][dartx.containsValue](value);
@@ -28842,7 +29172,7 @@
       dart.assert(this[_isUpgraded]);
       return result;
     }
-    [_process](key) {
+    [_process$](key) {
       if (!dart.test(convert._JsonMap._hasProperty(this[_original], key))) return null;
       let result = convert._convertJsonToDartLazy(convert._JsonMap._getProperty(this[_original], key));
       return convert._JsonMap._setProperty(this[_processed], key, result);
@@ -28895,7 +29225,7 @@
       forEach: dart.definiteFunctionType(dart.void, [dynamicAnddynamicTovoid()]),
       [_computeKeys$]: dart.definiteFunctionType(core.List$(core.String), []),
       [_upgrade]: dart.definiteFunctionType(core.Map, []),
-      [_process]: dart.definiteFunctionType(dart.dynamic, [core.String])
+      [_process$]: dart.definiteFunctionType(dart.dynamic, [core.String])
     }),
     statics: () => ({
       _hasProperty: dart.definiteFunctionType(core.bool, [dart.dynamic, core.String]),
@@ -28946,7 +29276,6 @@
   dart.setSignature(convert._JsonMapKeyIterable, {
     constructors: () => ({new: dart.definiteFunctionType(convert._JsonMapKeyIterable, [convert._JsonMap])}),
     fields: () => ({[_parent]: convert._JsonMap}),
-    getters: () => ({iterator: dart.definiteFunctionType(core.Iterator, [])}),
     methods: () => ({elementAt: dart.definiteFunctionType(core.String, [core.int])})
   });
   dart.defineExtensionMembers(convert._JsonMapKeyIterable, ['elementAt', 'contains', 'length', 'iterator']);
@@ -29371,8 +29700,7 @@
     fields: () => ({[_subsetMask]: core.int}),
     methods: () => ({
       convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
-      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfString()])
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
     })
   });
   convert.AsciiEncoder = class AsciiEncoder extends convert._UnicodeSubsetEncoder {
@@ -29462,8 +29790,7 @@
     }),
     methods: () => ({
       convert: dart.definiteFunctionType(core.String, [ListOfint()], [core.int, core.int]),
-      [_convertInvalid]: dart.definiteFunctionType(core.String, [ListOfint(), core.int, core.int]),
-      bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfListOfint()])
+      [_convertInvalid]: dart.definiteFunctionType(core.String, [ListOfint(), core.int, core.int])
     })
   });
   convert.AsciiDecoder = class AsciiDecoder extends convert._UnicodeSubsetDecoder {
@@ -29486,8 +29813,7 @@
     }
   };
   dart.setSignature(convert.AsciiDecoder, {
-    constructors: () => ({new: dart.definiteFunctionType(convert.AsciiDecoder, [], {allowInvalid: core.bool})}),
-    methods: () => ({startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])})
+    constructors: () => ({new: dart.definiteFunctionType(convert.AsciiDecoder, [], {allowInvalid: core.bool})})
   });
   const _utf8Sink = Symbol('_utf8Sink');
   let const$30;
@@ -30502,8 +30828,7 @@
       fields: () => ({[_codec]: CodecOfS$T()}),
       getters: () => ({
         encoder: dart.definiteFunctionType(convert.Converter$(T, S), []),
-        decoder: dart.definiteFunctionType(convert.Converter$(S, T), []),
-        inverted: dart.definiteFunctionType(convert.Codec$(S, T), [])
+        decoder: dart.definiteFunctionType(convert.Converter$(S, T), [])
       })
     });
     return _InvertedCodec;
@@ -30534,15 +30859,12 @@
         [_first$0]: ConverterOfS$M(),
         [_second]: ConverterOfM$T()
       }),
-      methods: () => ({
-        convert: dart.definiteFunctionType(T, [S]),
-        startChunkedConversion: dart.definiteFunctionType(core.Sink$(S), [SinkOfT()])
-      })
+      methods: () => ({convert: dart.definiteFunctionType(T, [S])})
     });
     return _FusedConverter;
   });
   convert._FusedConverter = _FusedConverter();
-  const _name$0 = Symbol('_name');
+  const _name$1 = Symbol('_name');
   let const$34;
   let const$35;
   let const$36;
@@ -30553,7 +30875,7 @@
   let const$41;
   convert.HtmlEscapeMode = class HtmlEscapeMode extends core.Object {
     _(name, escapeLtGt, escapeQuot, escapeApos, escapeSlash) {
-      this[_name$0] = name;
+      this[_name$1] = name;
       this.escapeLtGt = escapeLtGt;
       this.escapeQuot = escapeQuot;
       this.escapeApos = escapeApos;
@@ -30569,10 +30891,10 @@
       this.escapeQuot = escapeQuot;
       this.escapeApos = escapeApos;
       this.escapeSlash = escapeSlash;
-      this[_name$0] = name;
+      this[_name$1] = name;
     }
     toString() {
-      return this[_name$0];
+      return this[_name$1];
     }
   };
   dart.defineNamedConstructor(convert.HtmlEscapeMode, '_');
@@ -30582,7 +30904,7 @@
       new: dart.definiteFunctionType(convert.HtmlEscapeMode, [], {name: core.String, escapeLtGt: core.bool, escapeQuot: core.bool, escapeApos: core.bool, escapeSlash: core.bool})
     }),
     fields: () => ({
-      [_name$0]: core.String,
+      [_name$1]: core.String,
       escapeLtGt: core.bool,
       escapeQuot: core.bool,
       escapeApos: core.bool,
@@ -30856,9 +31178,7 @@
     }),
     methods: () => ({
       convert: dart.definiteFunctionType(core.String, [core.Object]),
-      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfString()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfObject()]),
-      fuse: dart.definiteFunctionType(T => [convert.Converter$(core.Object, T), [convert.Converter$(core.String, T)]])
+      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfString()])
     })
   });
   const _indent = Symbol('_indent');
@@ -30932,8 +31252,7 @@
     }),
     methods: () => ({
       convert: dart.definiteFunctionType(core.List$(core.int), [core.Object]),
-      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfListOfint()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfObject()])
+      startChunkedConversion: dart.definiteFunctionType(convert.ChunkedConversionSink$(core.Object), [SinkOfListOfint()])
     }),
     sfields: () => ({DEFAULT_BUFFER_SIZE: core.int}),
     statics: () => ({_utf8Encode: dart.definiteFunctionType(core.List$(core.int), [core.String])}),
@@ -31040,8 +31359,7 @@
     fields: () => ({[_reviver]: convert._Reviver}),
     methods: () => ({
       convert: dart.definiteFunctionType(dart.dynamic, [core.String]),
-      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfObject()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.Object), [StreamOfString()])
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfObject()])
     })
   });
   convert._parseJson = function(source, reviver) {
@@ -31222,7 +31540,7 @@
         }
         keyValueList[dartx._set](i++, key);
         keyValueList[dartx._set](i++, value);
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
       if (!allStringKeys) return false;
       this.writeString('{');
       let separator = '"';
@@ -31323,7 +31641,7 @@
         }
         keyValueList[dartx._set](i++, key);
         keyValueList[dartx._set](i++, value);
-      }, dynamicAnddynamicTovoid$()));
+      }, dynamicAnddynamicToNull()));
       if (!allStringKeys) return false;
       this.writeString('{\n');
       this[_indentLevel] = dart.notNull(this[_indentLevel]) + 1;
@@ -31638,8 +31956,7 @@
     }
   };
   dart.setSignature(convert.Latin1Decoder, {
-    constructors: () => ({new: dart.definiteFunctionType(convert.Latin1Decoder, [], {allowInvalid: core.bool})}),
-    methods: () => ({startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])})
+    constructors: () => ({new: dart.definiteFunctionType(convert.Latin1Decoder, [], {allowInvalid: core.bool})})
   });
   const _addSliceToSink = Symbol('_addSliceToSink');
   convert._Latin1DecoderSink = class _Latin1DecoderSink extends convert.ByteConversionSinkBase {
@@ -32227,8 +32544,7 @@
     constructors: () => ({new: dart.definiteFunctionType(convert.Utf8Encoder, [])}),
     methods: () => ({
       convert: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.int, core.int]),
-      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [StreamOfString()])
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
     })
   });
   convert._Utf8Encoder = class _Utf8Encoder extends core.Object {
@@ -32473,9 +32789,7 @@
     fields: () => ({[_allowMalformed]: core.bool}),
     methods: () => ({
       convert: dart.definiteFunctionType(core.String, [ListOfint()], [core.int, core.int]),
-      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()]),
-      bind: dart.definiteFunctionType(async.Stream$(core.String), [StreamOfListOfint()]),
-      fuse: dart.definiteFunctionType(T => [convert.Converter$(core.List$(core.int), T), [convert.Converter$(core.String, T)]])
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])
     }),
     statics: () => ({_convertIntercepted: dart.definiteFunctionType(core.String, [core.bool, ListOfint(), core.int, core.int])}),
     names: ['_convertIntercepted']
@@ -33573,7 +33887,7 @@
           sb.write(": ");
           sb.write(core.Error.safeToString(value));
           i++;
-        }, SymbolAnddynamicTovoid()));
+        }, SymbolAnddynamicToNull()));
       }
       if (this[_existingArgumentNames] == null) {
         return dart.str`NoSuchMethodError : method not found: '${this[_memberName]}'\n` + dart.str`Receiver: ${core.Error.safeToString(this[_receiver$])}\n` + dart.str`Arguments: [${sb}]`;
@@ -33899,10 +34213,21 @@
       let result = dart.map({}, core.String, dart.dynamic);
       namedArguments[dartx.forEach](dart.fn((symbol, value) => {
         result[dartx._set](core._symbolToString(symbol), value);
-      }, SymbolAnddynamicTovoid()));
+      }, SymbolAnddynamicToNull()));
       return result;
     }
   };
+  core.Function.is = function is_Function(o) {
+    return typeof o == "function";
+  };
+  core.Function.as = function as_Function(o) {
+    if (typeof o == "function" || o == null) return o;
+    return dart.as(o, core.Function);
+  };
+  core.Function._check = function check_String(o) {
+    if (typeof o == "function" || o == null) return o;
+    return dart.check(o, core.Function);
+  };
   dart.setSignature(core.Function, {
     statics: () => ({
       apply: dart.definiteFunctionType(dart.dynamic, [core.Function, core.List], [MapOfSymbol$dynamic()]),
@@ -33981,10 +34306,6 @@
         [_generator$]: _GeneratorOfE()
       }),
       getters: () => ({iterator: dart.definiteFunctionType(core.Iterator$(E), [])}),
-      methods: () => ({
-        skip: dart.definiteFunctionType(core.Iterable$(E), [core.int]),
-        take: dart.definiteFunctionType(core.Iterable$(E), [core.int])
-      }),
       statics: () => ({_id: dart.definiteFunctionType(core.int, [core.int])}),
       names: ['_id']
     });
@@ -34166,18 +34487,7 @@
       return new core._StringStackTrace(stackTraceString);
     }
     static get current() {
-      if (Error.captureStackTrace != null) {
-        let error = new Error();
-        Error.captureStackTrace(error);
-        return _js_helper.getTraceFromException(error);
-      }
-      try {
-        dart.throw('');
-      } catch (_) {
-        let stackTrace = dart.stackTrace(_);
-        return stackTrace;
-      }
-
+      return _js_helper.getTraceFromException(new Error());
     }
   };
   dart.setSignature(core.StackTrace, {
@@ -34311,10 +34621,7 @@
   dart.setSignature(core.Runes, {
     constructors: () => ({new: dart.definiteFunctionType(core.Runes, [core.String])}),
     fields: () => ({string: core.String}),
-    getters: () => ({
-      iterator: dart.definiteFunctionType(core.RuneIterator, []),
-      last: dart.definiteFunctionType(core.int, [])
-    })
+    getters: () => ({iterator: dart.definiteFunctionType(core.RuneIterator, [])})
   });
   dart.defineExtensionMembers(core.Runes, ['iterator', 'last']);
   core._isLeadSurrogate = function(code) {
@@ -34890,7 +35197,7 @@
             dart.throw(new core.UnsupportedError(dart.str`Illegal path character ${segment}`));
           }
         }
-      }, StringTovoid$()));
+      }, StringToNull()));
     }
     static _checkWindowsPathReservedCharacters(segments, argumentError, firstSegment) {
       if (firstSegment === void 0) firstSegment = 0;
@@ -35247,7 +35554,7 @@
             writeParameter(key, value);
           }
         }
-      }, StringAnddynamicTovoid()));
+      }, StringAnddynamicToNull()));
       return result.toString();
     }
     static _makeFragment(fragment, start, end) {
@@ -36235,7 +36542,7 @@
         if (indices != null) indices[dartx.add](buffer.length);
         buffer.write('=');
         buffer.write(core.Uri._uriEncode(core.UriData._tokenCharTable, value, convert.UTF8, false));
-      }, StringAndStringTovoid$())));
+      }, StringAndStringToNull())));
     }
     static _validateMimeType(mimeType) {
       let slashIndex = -1;
@@ -37222,6 +37529,14902 @@
     return 0;
   };
   dart.fn(developer._getServiceMinorVersion, VoidToint());
+  io.BytesBuilder = class BytesBuilder extends core.Object {
+    static new(opts) {
+      let copy = opts && 'copy' in opts ? opts.copy : true;
+      if (dart.test(copy)) {
+        return new io._CopyingBytesBuilder();
+      } else {
+        return new io._BytesBuilder();
+      }
+    }
+  };
+  dart.setSignature(io.BytesBuilder, {
+    constructors: () => ({new: dart.definiteFunctionType(io.BytesBuilder, [], {copy: core.bool})})
+  });
+  const _length$2 = Symbol('_length');
+  const _buffer$ = Symbol('_buffer');
+  const _pow2roundup = Symbol('_pow2roundup');
+  io._CopyingBytesBuilder = class _CopyingBytesBuilder extends core.Object {
+    new() {
+      this[_length$2] = 0;
+      this[_buffer$] = null;
+    }
+    add(bytes) {
+      let bytesLength = bytes[dartx.length];
+      if (bytesLength == 0) return;
+      let required = dart.notNull(this[_length$2]) + dart.notNull(bytesLength);
+      if (this[_buffer$] == null) {
+        let size = this[_pow2roundup](required);
+        size = math.max(core.int)(size, io._CopyingBytesBuilder._INIT_SIZE);
+        this[_buffer$] = typed_data.Uint8List.new(size);
+      } else if (dart.notNull(this[_buffer$][dartx.length]) < required) {
+        let size = dart.notNull(this[_pow2roundup](required)) * 2;
+        let newBuffer = typed_data.Uint8List.new(size);
+        newBuffer[dartx.setRange](0, this[_buffer$][dartx.length], this[_buffer$]);
+        this[_buffer$] = newBuffer;
+      }
+      dart.assert(dart.notNull(this[_buffer$][dartx.length]) >= required);
+      if (typed_data.Uint8List.is(bytes)) {
+        this[_buffer$][dartx.setRange](this[_length$2], required, bytes);
+      } else {
+        for (let i = 0; i < dart.notNull(bytesLength); i++) {
+          this[_buffer$][dartx._set](dart.notNull(this[_length$2]) + i, bytes[dartx._get](i));
+        }
+      }
+      this[_length$2] = required;
+    }
+    addByte(byte) {
+      this.add(JSArrayOfint().of([byte]));
+    }
+    takeBytes() {
+      if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+      let buffer = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]);
+      this.clear();
+      return buffer;
+    }
+    toBytes() {
+      if (this[_buffer$] == null) return typed_data.Uint8List.new(0);
+      return typed_data.Uint8List.fromList(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+    }
+    get length() {
+      return this[_length$2];
+    }
+    get isEmpty() {
+      return this[_length$2] == 0;
+    }
+    get isNotEmpty() {
+      return this[_length$2] != 0;
+    }
+    clear() {
+      this[_length$2] = 0;
+      this[_buffer$] = null;
+    }
+    [_pow2roundup](x) {
+      x = dart.notNull(x) - 1;
+      x = (dart.notNull(x) | x[dartx['>>']](1)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](2)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](4)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](8)) >>> 0;
+      x = (dart.notNull(x) | x[dartx['>>']](16)) >>> 0;
+      return dart.notNull(x) + 1;
+    }
+  };
+  io._CopyingBytesBuilder[dart.implements] = () => [io.BytesBuilder];
+  dart.setSignature(io._CopyingBytesBuilder, {
+    fields: () => ({
+      [_length$2]: core.int,
+      [_buffer$]: typed_data.Uint8List
+    }),
+    getters: () => ({
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addByte: dart.definiteFunctionType(dart.void, [core.int]),
+      takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      toBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      clear: dart.definiteFunctionType(dart.void, []),
+      [_pow2roundup]: dart.definiteFunctionType(core.int, [core.int])
+    }),
+    sfields: () => ({_INIT_SIZE: core.int})
+  });
+  io._CopyingBytesBuilder._INIT_SIZE = 1024;
+  const _chunks = Symbol('_chunks');
+  io._BytesBuilder = class _BytesBuilder extends core.Object {
+    new() {
+      this[_chunks] = JSArrayOfListOfint().of([]);
+      this[_length$2] = 0;
+    }
+    add(bytes) {
+      if (!typed_data.Uint8List.is(bytes)) {
+        bytes = typed_data.Uint8List.fromList(bytes);
+      }
+      this[_chunks][dartx.add](bytes);
+      this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(bytes[dartx.length]);
+    }
+    addByte(byte) {
+      this.add(JSArrayOfint().of([byte]));
+    }
+    takeBytes() {
+      if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+      if (this[_chunks][dartx.length] == 1) {
+        let buffer = this[_chunks][dartx.single];
+        this.clear();
+        return buffer;
+      }
+      let buffer = typed_data.Uint8List.new(this[_length$2]);
+      let offset = 0;
+      for (let chunk of this[_chunks]) {
+        buffer[dartx.setRange](offset, dart.notNull(offset) + dart.notNull(chunk[dartx.length]), chunk);
+        offset = dart.notNull(offset) + dart.notNull(chunk[dartx.length]);
+      }
+      this.clear();
+      return buffer;
+    }
+    toBytes() {
+      if (this[_chunks][dartx.length] == 0) return typed_data.Uint8List.new(0);
+      let buffer = typed_data.Uint8List.new(this[_length$2]);
+      let offset = 0;
+      for (let chunk of this[_chunks]) {
+        buffer[dartx.setRange](offset, dart.notNull(offset) + dart.notNull(chunk[dartx.length]), chunk);
+        offset = dart.notNull(offset) + dart.notNull(chunk[dartx.length]);
+      }
+      return buffer;
+    }
+    get length() {
+      return this[_length$2];
+    }
+    get isEmpty() {
+      return this[_length$2] == 0;
+    }
+    get isNotEmpty() {
+      return this[_length$2] != 0;
+    }
+    clear() {
+      this[_length$2] = 0;
+      this[_chunks][dartx.clear]();
+    }
+  };
+  io._BytesBuilder[dart.implements] = () => [io.BytesBuilder];
+  dart.setSignature(io._BytesBuilder, {
+    fields: () => ({
+      [_length$2]: core.int,
+      [_chunks]: ListOfListOfint()
+    }),
+    getters: () => ({
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addByte: dart.definiteFunctionType(dart.void, [core.int]),
+      takeBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      toBytes: dart.definiteFunctionType(core.List$(core.int), []),
+      clear: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._SUCCESS_RESPONSE = 0;
+  io._ILLEGAL_ARGUMENT_RESPONSE = 1;
+  io._OSERROR_RESPONSE = 2;
+  io._FILE_CLOSED_RESPONSE = 3;
+  io._ERROR_RESPONSE_ERROR_TYPE = 0;
+  io._OSERROR_RESPONSE_ERROR_CODE = 1;
+  io._OSERROR_RESPONSE_MESSAGE = 2;
+  io._isErrorResponse = function(response) {
+    return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+  };
+  dart.fn(io._isErrorResponse, dynamicTobool$());
+  io._exceptionFromResponse = function(response, message, path) {
+    dart.assert(io._isErrorResponse(response));
+    switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+      case io._ILLEGAL_ARGUMENT_RESPONSE:
+      {
+        return new core.ArgumentError();
+      }
+      case io._OSERROR_RESPONSE:
+      {
+        let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+        return new io.FileSystemException(message, path, err);
+      }
+      case io._FILE_CLOSED_RESPONSE:
+      {
+        return new io.FileSystemException("File closed", path);
+      }
+      default:
+      {
+        return core.Exception.new("Unknown error");
+      }
+    }
+  };
+  dart.fn(io._exceptionFromResponse, dynamicAndStringAndStringTodynamic());
+  io.IOException = class IOException extends core.Object {
+    toString() {
+      return "IOException";
+    }
+  };
+  io.IOException[dart.implements] = () => [core.Exception];
+  io.OSError = class OSError extends core.Object {
+    new(message, errorCode) {
+      if (message === void 0) message = "";
+      if (errorCode === void 0) errorCode = io.OSError.noErrorCode;
+      this.message = message;
+      this.errorCode = errorCode;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write("OS Error");
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(": ");
+        sb.write(this.message);
+        if (this.errorCode != io.OSError.noErrorCode) {
+          sb.write(", errno = ");
+          sb.write(dart.toString(this.errorCode));
+        }
+      } else if (this.errorCode != io.OSError.noErrorCode) {
+        sb.write(": errno = ");
+        sb.write(dart.toString(this.errorCode));
+      }
+      return sb.toString();
+    }
+  };
+  dart.setSignature(io.OSError, {
+    constructors: () => ({new: dart.definiteFunctionType(io.OSError, [], [core.String, core.int])}),
+    fields: () => ({
+      message: core.String,
+      errorCode: core.int
+    }),
+    sfields: () => ({noErrorCode: core.int})
+  });
+  io.OSError.noErrorCode = -1;
+  io._BufferAndStart = class _BufferAndStart extends core.Object {
+    new(buffer, start) {
+      this.buffer = buffer;
+      this.start = start;
+    }
+  };
+  dart.setSignature(io._BufferAndStart, {
+    constructors: () => ({new: dart.definiteFunctionType(io._BufferAndStart, [core.List, core.int])}),
+    fields: () => ({
+      buffer: core.List,
+      start: core.int
+    })
+  });
+  io._ensureFastAndSerializableByteData = function(buffer, start, end) {
+    if (typed_data.Uint8List.is(buffer) || typed_data.Int8List.is(buffer)) {
+      return new io._BufferAndStart(buffer, start);
+    }
+    let length = dart.notNull(end) - dart.notNull(start);
+    let newBuffer = typed_data.Uint8List.new(length);
+    let j = start;
+    for (let i = 0; i < length; i++) {
+      let value = core.int._check(buffer[dartx._get](j));
+      if (!(typeof value == 'number')) {
+        dart.throw(new core.ArgumentError(dart.str`List element is not an integer at index ${j}`));
+      }
+      newBuffer[dartx._set](i, value);
+      j = dart.notNull(j) + 1;
+    }
+    return new io._BufferAndStart(newBuffer, 0);
+  };
+  dart.fn(io._ensureFastAndSerializableByteData, ListAndintAndintTo_BufferAndStart());
+  io._IOCrypto = class _IOCrypto extends core.Object {
+    static getRandomBytes(count) {
+      dart.throw(new core.UnsupportedError("_IOCrypto.getRandomBytes"));
+    }
+  };
+  dart.setSignature(io._IOCrypto, {
+    statics: () => ({getRandomBytes: dart.definiteFunctionType(typed_data.Uint8List, [core.int])}),
+    names: ['getRandomBytes']
+  });
+  io._CryptoUtils = class _CryptoUtils extends core.Object {
+    static bytesToHex(bytes) {
+      let result = new core.StringBuffer();
+      for (let part of bytes) {
+        result.write(dart.str`${dart.notNull(part) < 16 ? '0' : ''}${part[dartx.toRadixString](16)}`);
+      }
+      return result.toString();
+    }
+    static bytesToBase64(bytes, urlSafe, addLineSeparator) {
+      if (urlSafe === void 0) urlSafe = false;
+      if (addLineSeparator === void 0) addLineSeparator = false;
+      let len = bytes[dartx.length];
+      if (len == 0) {
+        return "";
+      }
+      let lookup = dart.test(urlSafe) ? io._CryptoUtils._encodeTableUrlSafe : io._CryptoUtils._encodeTable;
+      let remainderLength = dart.asInt(len[dartx.remainder](3));
+      let chunkLength = dart.notNull(len) - dart.notNull(remainderLength);
+      let outputLen = (dart.notNull(len) / 3)[dartx.truncate]() * 4 + (dart.notNull(remainderLength) > 0 ? 4 : 0);
+      if (dart.test(addLineSeparator)) {
+        outputLen = outputLen + (((outputLen - 1) / io._CryptoUtils.LINE_LENGTH)[dartx.truncate]() << 1 >>> 0);
+      }
+      let out = ListOfint().new(outputLen);
+      let j = 0, i = 0, c = 0;
+      while (i < chunkLength) {
+        let x = (dart.notNull(bytes[dartx._get](i++)) << 16 & 16777215 | dart.notNull(bytes[dartx._get](i++)) << 8 & 16777215 | dart.notNull(bytes[dartx._get](i++))) >>> 0;
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](18)));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x >> 12 & 63));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x >> 6 & 63));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x & 63));
+        if (dart.test(addLineSeparator) && ++c == 19 && j < outputLen - 2) {
+          out[dartx._set](j++, io._CryptoUtils.CR);
+          out[dartx._set](j++, io._CryptoUtils.LF);
+          c = 0;
+        }
+      }
+      if (remainderLength == 1) {
+        let x = bytes[dartx._get](i);
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](2)));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](dart.notNull(x) << 4 & 63));
+        out[dartx._set](j++, io._CryptoUtils.PAD);
+        out[dartx._set](j++, io._CryptoUtils.PAD);
+      } else if (remainderLength == 2) {
+        let x = bytes[dartx._get](i);
+        let y = bytes[dartx._get](i + 1);
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](x[dartx['>>']](2)));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt]((dart.notNull(x) << 4 | dart.notNull(y) >> 4) & 63));
+        out[dartx._set](j++, lookup[dartx.codeUnitAt](dart.notNull(y) << 2 & 63));
+        out[dartx._set](j++, io._CryptoUtils.PAD);
+      }
+      return core.String.fromCharCodes(out);
+    }
+    static base64StringToBytes(input, ignoreInvalidCharacters) {
+      if (ignoreInvalidCharacters === void 0) ignoreInvalidCharacters = true;
+      let len = input[dartx.length];
+      if (len == 0) {
+        return ListOfint().new(0);
+      }
+      let extrasLen = 0;
+      for (let i = 0; i < dart.notNull(len); i++) {
+        let c = io._CryptoUtils._decodeTable[dartx._get](input[dartx.codeUnitAt](i));
+        if (dart.notNull(c) < 0) {
+          extrasLen++;
+          if (c == -2 && !dart.test(ignoreInvalidCharacters)) {
+            dart.throw(new core.FormatException(dart.str`Invalid character: ${input[dartx._get](i)}`));
+          }
+        }
+      }
+      if ((dart.notNull(len) - extrasLen)[dartx['%']](4) != 0) {
+        dart.throw(new core.FormatException(dart.str`Size of Base 64 characters in Input\n          must be a multiple of 4. Input: ${input}`));
+      }
+      let padLength = 0;
+      for (let i = dart.notNull(len) - 1; i >= 0; i--) {
+        let currentCodeUnit = input[dartx.codeUnitAt](i);
+        if (dart.notNull(io._CryptoUtils._decodeTable[dartx._get](currentCodeUnit)) > 0) break;
+        if (currentCodeUnit == io._CryptoUtils.PAD) padLength++;
+      }
+      let outputLen = ((dart.notNull(len) - extrasLen) * 6)[dartx['>>']](3) - padLength;
+      let out = ListOfint().new(outputLen);
+      for (let i = 0, o = 0; o < outputLen;) {
+        let x = 0;
+        for (let j = 4; j > 0;) {
+          let c = io._CryptoUtils._decodeTable[dartx._get](input[dartx.codeUnitAt](i++));
+          if (dart.notNull(c) >= 0) {
+            x = (x << 6 & 16777215 | dart.notNull(c)) >>> 0;
+            j--;
+          }
+        }
+        out[dartx._set](o++, x[dartx['>>']](16));
+        if (o < outputLen) {
+          out[dartx._set](o++, x >> 8 & 255);
+          if (o < outputLen) out[dartx._set](o++, x & 255);
+        }
+      }
+      return out;
+    }
+  };
+  dart.setSignature(io._CryptoUtils, {
+    sfields: () => ({
+      PAD: core.int,
+      CR: core.int,
+      LF: core.int,
+      LINE_LENGTH: core.int,
+      _encodeTable: core.String,
+      _encodeTableUrlSafe: core.String,
+      _decodeTable: ListOfint()
+    }),
+    statics: () => ({
+      bytesToHex: dart.definiteFunctionType(core.String, [ListOfint()]),
+      bytesToBase64: dart.definiteFunctionType(core.String, [ListOfint()], [core.bool, core.bool]),
+      base64StringToBytes: dart.definiteFunctionType(core.List$(core.int), [core.String], [core.bool])
+    }),
+    names: ['bytesToHex', 'bytesToBase64', 'base64StringToBytes']
+  });
+  io._CryptoUtils.PAD = 61;
+  io._CryptoUtils.CR = 13;
+  io._CryptoUtils.LF = 10;
+  io._CryptoUtils.LINE_LENGTH = 76;
+  io._CryptoUtils._encodeTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+  io._CryptoUtils._encodeTableUrlSafe = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+  io._CryptoUtils._decodeTable = dart.constList([-2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -1, -2, -2, -1, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, 62, -2, 62, -2, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -2, -2, -2, 0, -2, -2, -2, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -2, -2, -2, -2, 63, -2, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2], core.int);
+  io._MASK_8 = 255;
+  io._MASK_32 = 4294967295;
+  io._BITS_PER_BYTE = 8;
+  io._BYTES_PER_WORD = 4;
+  const _chunkSizeInWords = Symbol('_chunkSizeInWords');
+  const _digestSizeInWords = Symbol('_digestSizeInWords');
+  const _bigEndianWords = Symbol('_bigEndianWords');
+  const _pendingData = Symbol('_pendingData');
+  const _lengthInBytes = Symbol('_lengthInBytes');
+  const _currentChunk = Symbol('_currentChunk');
+  const _h = Symbol('_h');
+  const _digestCalled = Symbol('_digestCalled');
+  const _iterate = Symbol('_iterate');
+  const _resultAsBytes = Symbol('_resultAsBytes');
+  const _finalizeData = Symbol('_finalizeData');
+  const _add32 = Symbol('_add32');
+  const _roundUp = Symbol('_roundUp');
+  const _rotl32 = Symbol('_rotl32');
+  const _wordToBytes = Symbol('_wordToBytes');
+  const _bytesToChunk = Symbol('_bytesToChunk');
+  const _updateHash = Symbol('_updateHash');
+  io._HashBase = class _HashBase extends core.Object {
+    new(chunkSizeInWords, digestSizeInWords, bigEndianWords) {
+      this[_chunkSizeInWords] = chunkSizeInWords;
+      this[_digestSizeInWords] = digestSizeInWords;
+      this[_bigEndianWords] = bigEndianWords;
+      this[_pendingData] = JSArrayOfint().of([]);
+      this[_lengthInBytes] = 0;
+      this[_currentChunk] = null;
+      this[_h] = null;
+      this[_digestCalled] = false;
+      this[_currentChunk] = ListOfint().new(this[_chunkSizeInWords]);
+      this[_h] = ListOfint().new(this[_digestSizeInWords]);
+    }
+    add(data) {
+      if (dart.test(this[_digestCalled])) {
+        dart.throw(new core.StateError('Hash update method called after digest was retrieved'));
+      }
+      this[_lengthInBytes] = dart.notNull(this[_lengthInBytes]) + dart.notNull(data[dartx.length]);
+      this[_pendingData][dartx.addAll](data);
+      this[_iterate]();
+    }
+    close() {
+      if (dart.test(this[_digestCalled])) {
+        return ListOfint()._check(this[_resultAsBytes]());
+      }
+      this[_digestCalled] = true;
+      this[_finalizeData]();
+      this[_iterate]();
+      dart.assert(this[_pendingData][dartx.length] == 0);
+      return ListOfint()._check(this[_resultAsBytes]());
+    }
+    get blockSize() {
+      return dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+    }
+    [_add32](x, y) {
+      return dart.dsend(dart.dsend(x, '+', y), '&', io._MASK_32);
+    }
+    [_roundUp](val, n) {
+      return dart.dsend(dart.dsend(dart.dsend(val, '+', n), '-', 1), '&', dart.dsend(n, '_negate'));
+    }
+    [_rotl32](val, shift) {
+      let mod_shift = dart.notNull(shift) & 31;
+      return (val[dartx['<<']](mod_shift) & io._MASK_32 | ((dart.notNull(val) & io._MASK_32) >>> 0)[dartx['>>']](32 - mod_shift)) >>> 0;
+    }
+    [_resultAsBytes]() {
+      let result = [];
+      for (let i = 0; i < dart.notNull(this[_h][dartx.length]); i++) {
+        result[dartx.addAll](core.Iterable._check(this[_wordToBytes](this[_h][dartx._get](i))));
+      }
+      return result;
+    }
+    [_bytesToChunk](data, dataIndex) {
+      dart.assert(dart.notNull(data[dartx.length]) - dart.notNull(dataIndex) >= dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD);
+      for (let wordIndex = 0; wordIndex < dart.notNull(this[_chunkSizeInWords]); wordIndex++) {
+        let w3 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dataIndex) : data[dartx._get](dart.notNull(dataIndex) + 3);
+        let w2 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 1) : data[dartx._get](dart.notNull(dataIndex) + 2);
+        let w1 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 2) : data[dartx._get](dart.notNull(dataIndex) + 1);
+        let w0 = dart.test(this[_bigEndianWords]) ? data[dartx._get](dart.notNull(dataIndex) + 3) : data[dartx._get](dataIndex);
+        dataIndex = dart.notNull(dataIndex) + 4;
+        let word = (dart.notNull(w3) & 255) << 24 >>> 0;
+        word = (word | (dart.notNull(w2) & io._MASK_8) << 16) >>> 0;
+        word = (word | (dart.notNull(w1) & io._MASK_8) << 8) >>> 0;
+        word = (word | dart.notNull(w0) & io._MASK_8) >>> 0;
+        this[_currentChunk][dartx._set](wordIndex, word);
+      }
+    }
+    [_wordToBytes](word) {
+      let bytes = ListOfint().new(io._BYTES_PER_WORD);
+      bytes[dartx._set](0, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 24 : 0) & io._MASK_8);
+      bytes[dartx._set](1, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 16 : 8) & io._MASK_8);
+      bytes[dartx._set](2, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 8 : 16) & io._MASK_8);
+      bytes[dartx._set](3, word[dartx['>>']](dart.test(this[_bigEndianWords]) ? 0 : 24) & io._MASK_8);
+      return bytes;
+    }
+    [_iterate]() {
+      let len = this[_pendingData][dartx.length];
+      let chunkSizeInBytes = dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+      if (dart.notNull(len) >= chunkSizeInBytes) {
+        let index = 0;
+        for (; dart.notNull(len) - index >= chunkSizeInBytes; index = index + chunkSizeInBytes) {
+          this[_bytesToChunk](this[_pendingData], index);
+          this[_updateHash](this[_currentChunk]);
+        }
+        this[_pendingData] = this[_pendingData][dartx.sublist](index, len);
+      }
+    }
+    [_finalizeData]() {
+      this[_pendingData][dartx.add](128);
+      let contentsLength = dart.notNull(this[_lengthInBytes]) + 9;
+      let chunkSizeInBytes = dart.notNull(this[_chunkSizeInWords]) * io._BYTES_PER_WORD;
+      let finalizedLength = this[_roundUp](contentsLength, chunkSizeInBytes);
+      let zeroPadding = dart.dsend(finalizedLength, '-', contentsLength);
+      for (let i = 0; i < dart.notNull(core.num._check(zeroPadding)); i++) {
+        this[_pendingData][dartx.add](0);
+      }
+      let lengthInBits = dart.notNull(this[_lengthInBytes]) * io._BITS_PER_BYTE;
+      dart.assert(lengthInBits < dart.notNull(math.pow(2, 32)));
+      if (dart.test(this[_bigEndianWords])) {
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+      } else {
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes]((lengthInBits & io._MASK_32) >>> 0)));
+        this[_pendingData][dartx.addAll](IterableOfint()._check(this[_wordToBytes](0)));
+      }
+    }
+  };
+  dart.setSignature(io._HashBase, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HashBase, [core.int, core.int, core.bool])}),
+    fields: () => ({
+      [_chunkSizeInWords]: core.int,
+      [_digestSizeInWords]: core.int,
+      [_bigEndianWords]: core.bool,
+      [_lengthInBytes]: core.int,
+      [_pendingData]: ListOfint(),
+      [_currentChunk]: ListOfint(),
+      [_h]: ListOfint(),
+      [_digestCalled]: core.bool
+    }),
+    getters: () => ({blockSize: dart.definiteFunctionType(core.int, [])}),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.dynamic, [ListOfint()]),
+      close: dart.definiteFunctionType(core.List$(core.int), []),
+      [_add32]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
+      [_roundUp]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic]),
+      [_rotl32]: dart.definiteFunctionType(core.int, [core.int, core.int]),
+      [_resultAsBytes]: dart.definiteFunctionType(dart.dynamic, []),
+      [_bytesToChunk]: dart.definiteFunctionType(dart.dynamic, [ListOfint(), core.int]),
+      [_wordToBytes]: dart.definiteFunctionType(dart.dynamic, [core.int]),
+      [_iterate]: dart.definiteFunctionType(dart.dynamic, []),
+      [_finalizeData]: dart.definiteFunctionType(dart.dynamic, [])
+    })
+  });
+  io._MD5 = class _MD5 extends io._HashBase {
+    new() {
+      super.new(16, 4, false);
+      this[_h][dartx._set](0, 1732584193);
+      this[_h][dartx._set](1, 4023233417);
+      this[_h][dartx._set](2, 2562383102);
+      this[_h][dartx._set](3, 271733878);
+    }
+    newInstance() {
+      return new io._MD5();
+    }
+    [_updateHash](m) {
+      dart.assert(m[dartx.length] == 16);
+      let a = this[_h][dartx._get](0);
+      let b = this[_h][dartx._get](1);
+      let c = this[_h][dartx._get](2);
+      let d = this[_h][dartx._get](3);
+      let t0 = null;
+      let t1 = null;
+      for (let i = 0; i < 64; i++) {
+        if (i < 16) {
+          t0 = (dart.notNull(b) & dart.notNull(c) | ~dart.notNull(b) & io._MASK_32 & dart.notNull(d)) >>> 0;
+          t1 = i;
+        } else if (i < 32) {
+          t0 = (dart.notNull(d) & dart.notNull(b) | ~dart.notNull(d) & io._MASK_32 & dart.notNull(c)) >>> 0;
+          t1 = (5 * i + 1)[dartx['%']](16);
+        } else if (i < 48) {
+          t0 = (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0;
+          t1 = (3 * i + 5)[dartx['%']](16);
+        } else {
+          t0 = (dart.notNull(c) ^ (dart.notNull(b) | ~dart.notNull(d) & io._MASK_32)) >>> 0;
+          t1 = (7 * i)[dartx['%']](16);
+        }
+        let temp = d;
+        d = c;
+        c = b;
+        b = core.int._check(this[_add32](b, this[_rotl32](core.int._check(this[_add32](this[_add32](a, t0), this[_add32](io._MD5._k[dartx._get](i), m[dartx._get](core.int._check(t1))))), io._MD5._r[dartx._get](i))));
+        a = temp;
+      }
+      this[_h][dartx._set](0, core.int._check(this[_add32](a, this[_h][dartx._get](0))));
+      this[_h][dartx._set](1, core.int._check(this[_add32](b, this[_h][dartx._get](1))));
+      this[_h][dartx._set](2, core.int._check(this[_add32](c, this[_h][dartx._get](2))));
+      this[_h][dartx._set](3, core.int._check(this[_add32](d, this[_h][dartx._get](3))));
+    }
+  };
+  dart.setSignature(io._MD5, {
+    constructors: () => ({new: dart.definiteFunctionType(io._MD5, [])}),
+    methods: () => ({
+      newInstance: dart.definiteFunctionType(io._MD5, []),
+      [_updateHash]: dart.definiteFunctionType(dart.void, [ListOfint()])
+    }),
+    sfields: () => ({
+      _k: ListOfint(),
+      _r: ListOfint()
+    })
+  });
+  io._MD5._k = dart.constList([3614090360, 3905402710, 606105819, 3250441966, 4118548399, 1200080426, 2821735955, 4249261313, 1770035416, 2336552879, 4294925233, 2304563134, 1804603682, 4254626195, 2792965006, 1236535329, 4129170786, 3225465664, 643717713, 3921069994, 3593408605, 38016083, 3634488961, 3889429448, 568446438, 3275163606, 4107603335, 1163531501, 2850285829, 4243563512, 1735328473, 2368359562, 4294588738, 2272392833, 1839030562, 4259657740, 2763975236, 1272893353, 4139469664, 3200236656, 681279174, 3936430074, 3572445317, 76029189, 3654602809, 3873151461, 530742520, 3299628645, 4096336452, 1126891415, 2878612391, 4237533241, 1700485571, 2399980690, 4293915773, 2240044497, 1873313359, 4264355552, 2734768916, 1309151649, 4149444226, 3174756917, 718787259, 3951481745], core.int);
+  io._MD5._r = dart.constList([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21], core.int);
+  const _w = Symbol('_w');
+  io._SHA1 = class _SHA1 extends io._HashBase {
+    new() {
+      this[_w] = ListOfint().new(80);
+      super.new(16, 5, true);
+      this[_h][dartx._set](0, 1732584193);
+      this[_h][dartx._set](1, 4023233417);
+      this[_h][dartx._set](2, 2562383102);
+      this[_h][dartx._set](3, 271733878);
+      this[_h][dartx._set](4, 3285377520);
+    }
+    newInstance() {
+      return new io._SHA1();
+    }
+    [_updateHash](m) {
+      dart.assert(m[dartx.length] == 16);
+      let a = this[_h][dartx._get](0);
+      let b = this[_h][dartx._get](1);
+      let c = this[_h][dartx._get](2);
+      let d = this[_h][dartx._get](3);
+      let e = this[_h][dartx._get](4);
+      for (let i = 0; i < 80; i++) {
+        if (i < 16) {
+          this[_w][dartx._set](i, m[dartx._get](i));
+        } else {
+          let n = (dart.notNull(this[_w][dartx._get](i - 3)) ^ dart.notNull(this[_w][dartx._get](i - 8)) ^ dart.notNull(this[_w][dartx._get](i - 14)) ^ dart.notNull(this[_w][dartx._get](i - 16))) >>> 0;
+          this[_w][dartx._set](i, this[_rotl32](n, 1));
+        }
+        let t = this[_add32](this[_add32](this[_rotl32](a, 5), e), this[_w][dartx._get](i));
+        if (i < 20) {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) & dart.notNull(c) | ~dart.notNull(b) & dart.notNull(d)) >>> 0), 1518500249);
+        } else if (i < 40) {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0), 1859775393);
+        } else if (i < 60) {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) & dart.notNull(c) | dart.notNull(b) & dart.notNull(d) | dart.notNull(c) & dart.notNull(d)) >>> 0), 2400959708);
+        } else {
+          t = this[_add32](this[_add32](t, (dart.notNull(b) ^ dart.notNull(c) ^ dart.notNull(d)) >>> 0), 3395469782);
+        }
+        e = d;
+        d = c;
+        c = this[_rotl32](b, 30);
+        b = a;
+        a = core.int._check(dart.dsend(t, '&', io._MASK_32));
+      }
+      this[_h][dartx._set](0, core.int._check(this[_add32](a, this[_h][dartx._get](0))));
+      this[_h][dartx._set](1, core.int._check(this[_add32](b, this[_h][dartx._get](1))));
+      this[_h][dartx._set](2, core.int._check(this[_add32](c, this[_h][dartx._get](2))));
+      this[_h][dartx._set](3, core.int._check(this[_add32](d, this[_h][dartx._get](3))));
+      this[_h][dartx._set](4, core.int._check(this[_add32](e, this[_h][dartx._get](4))));
+    }
+  };
+  dart.setSignature(io._SHA1, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SHA1, [])}),
+    fields: () => ({[_w]: ListOfint()}),
+    methods: () => ({
+      newInstance: dart.definiteFunctionType(io._SHA1, []),
+      [_updateHash]: dart.definiteFunctionType(dart.void, [ListOfint()])
+    })
+  });
+  io.ZLibOption = class ZLibOption extends core.Object {};
+  dart.setSignature(io.ZLibOption, {
+    sfields: () => ({
+      MIN_WINDOW_BITS: core.int,
+      MAX_WINDOW_BITS: core.int,
+      DEFAULT_WINDOW_BITS: core.int,
+      MIN_LEVEL: core.int,
+      MAX_LEVEL: core.int,
+      DEFAULT_LEVEL: core.int,
+      MIN_MEM_LEVEL: core.int,
+      MAX_MEM_LEVEL: core.int,
+      DEFAULT_MEM_LEVEL: core.int,
+      STRATEGY_FILTERED: core.int,
+      STRATEGY_HUFFMAN_ONLY: core.int,
+      STRATEGY_RLE: core.int,
+      STRATEGY_FIXED: core.int,
+      STRATEGY_DEFAULT: core.int
+    })
+  });
+  io.ZLibOption.MIN_WINDOW_BITS = 8;
+  io.ZLibOption.MAX_WINDOW_BITS = 15;
+  io.ZLibOption.DEFAULT_WINDOW_BITS = 15;
+  io.ZLibOption.MIN_LEVEL = -1;
+  io.ZLibOption.MAX_LEVEL = 9;
+  io.ZLibOption.DEFAULT_LEVEL = 6;
+  io.ZLibOption.MIN_MEM_LEVEL = 1;
+  io.ZLibOption.MAX_MEM_LEVEL = 9;
+  io.ZLibOption.DEFAULT_MEM_LEVEL = 8;
+  io.ZLibOption.STRATEGY_FILTERED = 1;
+  io.ZLibOption.STRATEGY_HUFFMAN_ONLY = 2;
+  io.ZLibOption.STRATEGY_RLE = 3;
+  io.ZLibOption.STRATEGY_FIXED = 4;
+  io.ZLibOption.STRATEGY_DEFAULT = 0;
+  io.ZLibCodec = class ZLibCodec extends convert.Codec$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+      let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      let gzip = opts && 'gzip' in opts ? opts.gzip : false;
+      this.level = level;
+      this.windowBits = windowBits;
+      this.memLevel = memLevel;
+      this.strategy = strategy;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      this.gzip = gzip;
+      super.new();
+      io._validateZLibeLevel(this.level);
+      io._validateZLibMemLevel(this.memLevel);
+      io._validateZLibStrategy(this.strategy);
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    _default() {
+      this.level = io.ZLibOption.DEFAULT_LEVEL;
+      this.windowBits = io.ZLibOption.DEFAULT_WINDOW_BITS;
+      this.memLevel = io.ZLibOption.DEFAULT_MEM_LEVEL;
+      this.strategy = io.ZLibOption.STRATEGY_DEFAULT;
+      this.raw = false;
+      this.gzip = false;
+      this.dictionary = null;
+      super.new();
+    }
+    get encoder() {
+      return new io.ZLibEncoder({gzip: false, level: this.level, windowBits: this.windowBits, memLevel: this.memLevel, strategy: this.strategy, dictionary: this.dictionary, raw: this.raw});
+    }
+    get decoder() {
+      return new io.ZLibDecoder({windowBits: this.windowBits, dictionary: this.dictionary, raw: this.raw});
+    }
+  };
+  dart.addSimpleTypeTests(io.ZLibCodec);
+  dart.defineNamedConstructor(io.ZLibCodec, '_default');
+  dart.setSignature(io.ZLibCodec, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.ZLibCodec, [], {level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool, gzip: core.bool}),
+      _default: dart.definiteFunctionType(io.ZLibCodec, [])
+    }),
+    fields: () => ({
+      gzip: core.bool,
+      level: core.int,
+      memLevel: core.int,
+      strategy: core.int,
+      windowBits: core.int,
+      raw: core.bool,
+      dictionary: ListOfint()
+    }),
+    getters: () => ({
+      encoder: dart.definiteFunctionType(io.ZLibEncoder, []),
+      decoder: dart.definiteFunctionType(io.ZLibDecoder, [])
+    })
+  });
+  io.ZLIB = dart.const(new io.ZLibCodec._default());
+  io.GZipCodec = class GZipCodec extends convert.Codec$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+      let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      let gzip = opts && 'gzip' in opts ? opts.gzip : true;
+      this.level = level;
+      this.windowBits = windowBits;
+      this.memLevel = memLevel;
+      this.strategy = strategy;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      this.gzip = gzip;
+      super.new();
+      io._validateZLibeLevel(this.level);
+      io._validateZLibMemLevel(this.memLevel);
+      io._validateZLibStrategy(this.strategy);
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    _default() {
+      this.level = io.ZLibOption.DEFAULT_LEVEL;
+      this.windowBits = io.ZLibOption.DEFAULT_WINDOW_BITS;
+      this.memLevel = io.ZLibOption.DEFAULT_MEM_LEVEL;
+      this.strategy = io.ZLibOption.STRATEGY_DEFAULT;
+      this.raw = false;
+      this.gzip = true;
+      this.dictionary = null;
+      super.new();
+    }
+    get encoder() {
+      return new io.ZLibEncoder({gzip: true, level: this.level, windowBits: this.windowBits, memLevel: this.memLevel, strategy: this.strategy, dictionary: this.dictionary, raw: this.raw});
+    }
+    get decoder() {
+      return new io.ZLibDecoder({windowBits: this.windowBits, dictionary: this.dictionary, raw: this.raw});
+    }
+  };
+  dart.addSimpleTypeTests(io.GZipCodec);
+  dart.defineNamedConstructor(io.GZipCodec, '_default');
+  dart.setSignature(io.GZipCodec, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.GZipCodec, [], {level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool, gzip: core.bool}),
+      _default: dart.definiteFunctionType(io.GZipCodec, [])
+    }),
+    fields: () => ({
+      gzip: core.bool,
+      level: core.int,
+      memLevel: core.int,
+      strategy: core.int,
+      windowBits: core.int,
+      dictionary: ListOfint(),
+      raw: core.bool
+    }),
+    getters: () => ({
+      encoder: dart.definiteFunctionType(io.ZLibEncoder, []),
+      decoder: dart.definiteFunctionType(io.ZLibDecoder, [])
+    })
+  });
+  io.GZIP = dart.const(new io.GZipCodec._default());
+  io.ZLibEncoder = class ZLibEncoder extends convert.Converter$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let gzip = opts && 'gzip' in opts ? opts.gzip : false;
+      let level = opts && 'level' in opts ? opts.level : io.ZLibOption.DEFAULT_LEVEL;
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let memLevel = opts && 'memLevel' in opts ? opts.memLevel : io.ZLibOption.DEFAULT_MEM_LEVEL;
+      let strategy = opts && 'strategy' in opts ? opts.strategy : io.ZLibOption.STRATEGY_DEFAULT;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      this.gzip = gzip;
+      this.level = level;
+      this.windowBits = windowBits;
+      this.memLevel = memLevel;
+      this.strategy = strategy;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      super.new();
+      io._validateZLibeLevel(this.level);
+      io._validateZLibMemLevel(this.memLevel);
+      io._validateZLibStrategy(this.strategy);
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    convert(bytes) {
+      let sink = new io._BufferSink();
+      let _ = this.startChunkedConversion(sink);
+      _.add(bytes);
+      _.close();
+      return sink.builder.takeBytes();
+    }
+    startChunkedConversion(sink) {
+      if (!convert.ByteConversionSink.is(sink)) {
+        sink = convert.ByteConversionSink.from(sink);
+      }
+      return new io._ZLibEncoderSink(convert.ByteConversionSink._check(sink), this.gzip, this.level, this.windowBits, this.memLevel, this.strategy, this.dictionary, this.raw);
+    }
+  };
+  dart.addSimpleTypeTests(io.ZLibEncoder);
+  dart.setSignature(io.ZLibEncoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ZLibEncoder, [], {gzip: core.bool, level: core.int, windowBits: core.int, memLevel: core.int, strategy: core.int, dictionary: ListOfint(), raw: core.bool})}),
+    fields: () => ({
+      gzip: core.bool,
+      level: core.int,
+      memLevel: core.int,
+      strategy: core.int,
+      windowBits: core.int,
+      dictionary: ListOfint(),
+      raw: core.bool
+    }),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.List$(core.int), [ListOfint()]),
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfListOfint()])
+    })
+  });
+  io.ZLibDecoder = class ZLibDecoder extends convert.Converter$(core.List$(core.int), core.List$(core.int)) {
+    new(opts) {
+      let windowBits = opts && 'windowBits' in opts ? opts.windowBits : io.ZLibOption.DEFAULT_WINDOW_BITS;
+      let dictionary = opts && 'dictionary' in opts ? opts.dictionary : null;
+      let raw = opts && 'raw' in opts ? opts.raw : false;
+      this.windowBits = windowBits;
+      this.dictionary = dictionary;
+      this.raw = raw;
+      super.new();
+      io._validateZLibWindowBits(this.windowBits);
+    }
+    convert(bytes) {
+      let sink = new io._BufferSink();
+      let _ = this.startChunkedConversion(sink);
+      _.add(bytes);
+      _.close();
+      return sink.builder.takeBytes();
+    }
+    startChunkedConversion(sink) {
+      if (!convert.ByteConversionSink.is(sink)) {
+        sink = convert.ByteConversionSink.from(sink);
+      }
+      return new io._ZLibDecoderSink(convert.ByteConversionSink._check(sink), this.windowBits, this.dictionary, this.raw);
+    }
+  };
+  dart.addSimpleTypeTests(io.ZLibDecoder);
+  dart.setSignature(io.ZLibDecoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ZLibDecoder, [], {windowBits: core.int, dictionary: ListOfint(), raw: core.bool})}),
+    fields: () => ({
+      windowBits: core.int,
+      dictionary: ListOfint(),
+      raw: core.bool
+    }),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.List$(core.int), [ListOfint()]),
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfListOfint()])
+    })
+  });
+  io._BufferSink = class _BufferSink extends convert.ByteConversionSink {
+    new() {
+      this.builder = io.BytesBuilder.new({copy: false});
+      super.new();
+    }
+    add(chunk) {
+      this.builder.add(chunk);
+    }
+    addSlice(chunk, start, end, isLast) {
+      if (typed_data.Uint8List.is(chunk)) {
+        let list = chunk;
+        this.builder.add(typed_data.Uint8List.view(list[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+      } else {
+        this.builder.add(chunk[dartx.sublist](start, end));
+      }
+    }
+    close() {}
+  };
+  dart.setSignature(io._BufferSink, {
+    fields: () => ({builder: io.BytesBuilder}),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+      close: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _sink$0 = Symbol('_sink');
+  const _filter$ = Symbol('_filter');
+  const _closed = Symbol('_closed');
+  const _empty = Symbol('_empty');
+  let const$52;
+  io._FilterSink = class _FilterSink extends convert.ByteConversionSink {
+    new(sink, filter) {
+      this[_sink$0] = sink;
+      this[_filter$] = filter;
+      this[_closed] = false;
+      this[_empty] = true;
+      super.new();
+    }
+    add(data) {
+      this.addSlice(data, 0, data[dartx.length], false);
+    }
+    addSlice(data, start, end, isLast) {
+      if (dart.test(this[_closed])) return;
+      if (end == null) dart.throw(new core.ArgumentError.notNull("end"));
+      core.RangeError.checkValidRange(start, end, data[dartx.length]);
+      try {
+        this[_empty] = false;
+        let bufferAndStart = io._ensureFastAndSerializableByteData(data, start, end);
+        this[_filter$].process(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+        let out = null;
+        while ((out = this[_filter$].processed({flush: false})) != null) {
+          this[_sink$0].add(ListOfint()._check(out));
+        }
+      } catch (e) {
+        this[_closed] = true;
+        throw e;
+      }
+
+      if (dart.test(isLast)) this.close();
+    }
+    close() {
+      if (dart.test(this[_closed])) return;
+      if (dart.test(this[_empty])) this[_filter$].process(const$52 || (const$52 = dart.constList([], core.int)), 0, 0);
+      try {
+        let out = null;
+        while ((out = this[_filter$].processed({end: true})) != null) {
+          this[_sink$0].add(ListOfint()._check(out));
+        }
+      } catch (e) {
+        this[_closed] = true;
+        dart.throw(e);
+      }
+
+      this[_closed] = true;
+      this[_sink$0].close();
+    }
+  };
+  dart.setSignature(io._FilterSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._FilterSink, [convert.ByteConversionSink, io._Filter])}),
+    fields: () => ({
+      [_filter$]: io._Filter,
+      [_sink$0]: convert.ByteConversionSink,
+      [_closed]: core.bool,
+      [_empty]: core.bool
+    }),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+      close: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._ZLibEncoderSink = class _ZLibEncoderSink extends io._FilterSink {
+    new(sink, gzip, level, windowBits, memLevel, strategy, dictionary, raw) {
+      super.new(sink, io._Filter._newZLibDeflateFilter(gzip, level, windowBits, memLevel, strategy, dictionary, raw));
+    }
+  };
+  dart.setSignature(io._ZLibEncoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ZLibEncoderSink, [convert.ByteConversionSink, core.bool, core.int, core.int, core.int, core.int, ListOfint(), core.bool])})
+  });
+  io._ZLibDecoderSink = class _ZLibDecoderSink extends io._FilterSink {
+    new(sink, windowBits, dictionary, raw) {
+      super.new(sink, io._Filter._newZLibInflateFilter(windowBits, dictionary, raw));
+    }
+  };
+  dart.setSignature(io._ZLibDecoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ZLibDecoderSink, [convert.ByteConversionSink, core.int, ListOfint(), core.bool])})
+  });
+  io._Filter = class _Filter extends core.Object {
+    static _newZLibDeflateFilter(gzip, level, windowBits, memLevel, strategy, dictionary, raw) {
+      dart.throw(new core.UnsupportedError("_newZLibDeflateFilter"));
+    }
+    static _newZLibInflateFilter(windowBits, dictionary, raw) {
+      dart.throw(new core.UnsupportedError("_newZLibInflateFilter"));
+    }
+  };
+  dart.setSignature(io._Filter, {
+    statics: () => ({
+      _newZLibDeflateFilter: dart.definiteFunctionType(io._Filter, [core.bool, core.int, core.int, core.int, core.int, ListOfint(), core.bool]),
+      _newZLibInflateFilter: dart.definiteFunctionType(io._Filter, [core.int, ListOfint(), core.bool])
+    }),
+    names: ['_newZLibDeflateFilter', '_newZLibInflateFilter']
+  });
+  io._validateZLibWindowBits = function(windowBits) {
+    if (io.ZLibOption.MIN_WINDOW_BITS > dart.notNull(windowBits) || io.ZLibOption.MAX_WINDOW_BITS < dart.notNull(windowBits)) {
+      dart.throw(new core.RangeError.range(windowBits, io.ZLibOption.MIN_WINDOW_BITS, io.ZLibOption.MAX_WINDOW_BITS));
+    }
+  };
+  dart.fn(io._validateZLibWindowBits, intTovoid());
+  io._validateZLibeLevel = function(level) {
+    if (io.ZLibOption.MIN_LEVEL > dart.notNull(level) || io.ZLibOption.MAX_LEVEL < dart.notNull(level)) {
+      dart.throw(new core.RangeError.range(level, io.ZLibOption.MIN_LEVEL, io.ZLibOption.MAX_LEVEL));
+    }
+  };
+  dart.fn(io._validateZLibeLevel, intTovoid());
+  io._validateZLibMemLevel = function(memLevel) {
+    if (io.ZLibOption.MIN_MEM_LEVEL > dart.notNull(memLevel) || io.ZLibOption.MAX_MEM_LEVEL < dart.notNull(memLevel)) {
+      dart.throw(new core.RangeError.range(memLevel, io.ZLibOption.MIN_MEM_LEVEL, io.ZLibOption.MAX_MEM_LEVEL));
+    }
+  };
+  dart.fn(io._validateZLibMemLevel, intTovoid());
+  let const$53;
+  io._validateZLibStrategy = function(strategy) {
+    let strategies = const$53 || (const$53 = dart.constList([io.ZLibOption.STRATEGY_FILTERED, io.ZLibOption.STRATEGY_HUFFMAN_ONLY, io.ZLibOption.STRATEGY_RLE, io.ZLibOption.STRATEGY_FIXED, io.ZLibOption.STRATEGY_DEFAULT], core.int));
+    if (strategies[dartx.indexOf](strategy) == -1) {
+      dart.throw(new core.ArgumentError("Unsupported 'strategy'"));
+    }
+  };
+  dart.fn(io._validateZLibStrategy, intTovoid());
+  io.Directory = class Directory extends core.Object {
+    static new(path) {
+      return new io._Directory(path);
+    }
+    static fromUri(uri) {
+      return io.Directory.new(uri.toFilePath());
+    }
+    static get current() {
+      return io._Directory.current;
+    }
+    static set current(path) {
+      io._Directory.current = path;
+    }
+    static get systemTemp() {
+      return io._Directory.systemTemp;
+    }
+  };
+  io.Directory[dart.implements] = () => [io.FileSystemEntity];
+  dart.setSignature(io.Directory, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.Directory, [core.String]),
+      fromUri: dart.definiteFunctionType(io.Directory, [core.Uri])
+    }),
+    fields: () => ({path: core.String}),
+    sgetters: () => ({
+      current: dart.definiteFunctionType(io.Directory, []),
+      systemTemp: dart.definiteFunctionType(io.Directory, [])
+    }),
+    ssetters: () => ({current: dart.definiteFunctionType(dart.void, [dart.dynamic])})
+  });
+  const _isErrorResponse = Symbol('_isErrorResponse');
+  const _exceptionOrErrorFromResponse = Symbol('_exceptionOrErrorFromResponse');
+  const _absolutePath = Symbol('_absolutePath');
+  const _computeExistingIndex = Symbol('_computeExistingIndex');
+  const _delete = Symbol('_delete');
+  const _deleteSync = Symbol('_deleteSync');
+  const _type = Symbol('_type');
+  io.FileSystemEntity = class FileSystemEntity extends core.Object {
+    get uri() {
+      return core.Uri.file(this.path);
+    }
+    resolveSymbolicLinks() {
+      return io._IOService._dispatch(io._FILE_RESOLVE_SYMBOLIC_LINKS, JSArrayOfString().of([this.path])).then(core.String)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot resolve symbolic links", this.path));
+        }
+        return FutureOrOfString()._check(response);
+      }, dynamicToFutureOrOfString()));
+    }
+    resolveSymbolicLinksSync() {
+      let result = io.FileSystemEntity._resolveSymbolicLinks(this.path);
+      io.FileSystemEntity._throwIfError(result, "Cannot resolve symbolic links", this.path);
+      return core.String._check(result);
+    }
+    delete(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return this[_delete]({recursive: recursive});
+    }
+    deleteSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return this[_deleteSync]({recursive: recursive});
+    }
+    watch(opts) {
+      let events = opts && 'events' in opts ? opts.events : io.FileSystemEvent.ALL;
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return io._FileSystemWatcher._watch(io.FileSystemEntity._trimTrailingPathSeparators(this.path), events, recursive);
+    }
+    static identical(path1, path2) {
+      return io._IOService._dispatch(io._FILE_IDENTICAL, JSArrayOfString().of([path1, path2])).then(core.bool)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, dart.str`Error in FileSystemEntity.identical(${path1}, ${path2})`, ""));
+        }
+        return FutureOrOfbool()._check(response);
+      }, dynamicToFutureOrOfbool()));
+    }
+    get isAbsolute() {
+      if (dart.test(io.Platform.isWindows)) {
+        return this.path[dartx.startsWith](io.FileSystemEntity._absoluteWindowsPathPattern);
+      } else {
+        return this.path[dartx.startsWith]('/');
+      }
+    }
+    get [_absolutePath]() {
+      if (dart.test(this.isAbsolute)) return this.path;
+      let current = io.Directory.current.path;
+      if (dart.test(current[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(current[dartx.endsWith]('\\'))) {
+        return dart.str`${current}${this.path}`;
+      } else {
+        return dart.str`${current}${io.Platform.pathSeparator}${this.path}`;
+      }
+    }
+    static identicalSync(path1, path2) {
+      let result = io.FileSystemEntity._identical(path1, path2);
+      io.FileSystemEntity._throwIfError(result, 'Error in FileSystemEntity.identicalSync');
+      return core.bool._check(result);
+    }
+    static get isWatchSupported() {
+      return io._FileSystemWatcher.isSupported;
+    }
+    static type(path, opts) {
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      return io.FileSystemEntity._getTypeAsync(path, followLinks).then(io.FileSystemEntityType)(io.FileSystemEntityType._lookup);
+    }
+    static typeSync(path, opts) {
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      return io.FileSystemEntityType._lookup(io.FileSystemEntity._getTypeSync(path, followLinks));
+    }
+    static isLink(path) {
+      return io.FileSystemEntity._getTypeAsync(path, false).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.LINK[_type], intTobool()));
+    }
+    static isFile(path) {
+      return io.FileSystemEntity._getTypeAsync(path, true).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.FILE[_type], intTobool()));
+    }
+    static isDirectory(path) {
+      return io.FileSystemEntity._getTypeAsync(path, true).then(core.bool)(dart.fn(type => type == io.FileSystemEntityType.DIRECTORY[_type], intTobool()));
+    }
+    static isLinkSync(path) {
+      return io.FileSystemEntity._getTypeSync(path, false) == io.FileSystemEntityType.LINK[_type];
+    }
+    static isFileSync(path) {
+      return io.FileSystemEntity._getTypeSync(path, true) == io.FileSystemEntityType.FILE[_type];
+    }
+    static isDirectorySync(path) {
+      return io.FileSystemEntity._getTypeSync(path, true) == io.FileSystemEntityType.DIRECTORY[_type];
+    }
+    static _getType(path, followLinks) {
+      dart.throw(new core.UnsupportedError("FileSystemEntity._getType"));
+    }
+    static _identical(path1, path2) {
+      dart.throw(new core.UnsupportedError("FileSystemEntity._identical"));
+    }
+    static _resolveSymbolicLinks(path) {
+      dart.throw(new core.UnsupportedError("FileSystemEntity._resolveSymbolicLinks"));
+    }
+    static parentOf(path) {
+      let rootEnd = -1;
+      if (dart.test(io.Platform.isWindows)) {
+        if (dart.test(path[dartx.startsWith](io.FileSystemEntity._absoluteWindowsPathPattern))) {
+          rootEnd = path[dartx.indexOf](core.RegExp.new('[/\\\\]'), 2);
+          if (rootEnd == -1) return path;
+        } else if (dart.test(path[dartx.startsWith]('\\')) || dart.test(path[dartx.startsWith]('/'))) {
+          rootEnd = 0;
+        }
+      } else if (dart.test(path[dartx.startsWith]('/'))) {
+        rootEnd = 0;
+      }
+      let pos = path[dartx.lastIndexOf](io.FileSystemEntity._parentRegExp);
+      if (dart.notNull(pos) > dart.notNull(rootEnd)) {
+        return path[dartx.substring](0, dart.notNull(pos) + 1);
+      } else if (dart.notNull(rootEnd) > -1) {
+        return path[dartx.substring](0, dart.notNull(rootEnd) + 1);
+      } else {
+        return '.';
+      }
+    }
+    get parent() {
+      return io.Directory.new(io.FileSystemEntity.parentOf(this.path));
+    }
+    static _getTypeSync(path, followLinks) {
+      let result = io.FileSystemEntity._getType(path, followLinks);
+      io.FileSystemEntity._throwIfError(result, 'Error getting type of FileSystemEntity');
+      return core.int._check(result);
+    }
+    static _getTypeAsync(path, followLinks) {
+      return io._IOService._dispatch(io._FILE_TYPE, JSArrayOfObject().of([path, followLinks])).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Error getting type", path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    static _throwIfError(result, msg, path) {
+      if (path === void 0) path = null;
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException(msg, path, result));
+      } else if (core.ArgumentError.is(result)) {
+        dart.throw(result);
+      }
+    }
+    static _trimTrailingPathSeparators(path) {
+      if (!(typeof path == 'string')) return path;
+      if (dart.test(io.Platform.isWindows)) {
+        while (dart.notNull(path[dartx.length]) > 1 && (dart.test(path[dartx.endsWith](io.Platform.pathSeparator)) || dart.test(path[dartx.endsWith]('/')))) {
+          path = path[dartx.substring](0, dart.notNull(path[dartx.length]) - 1);
+        }
+      } else {
+        while (dart.notNull(path[dartx.length]) > 1 && dart.test(path[dartx.endsWith](io.Platform.pathSeparator))) {
+          path = path[dartx.substring](0, dart.notNull(path[dartx.length]) - 1);
+        }
+      }
+      return path;
+    }
+    static _ensureTrailingPathSeparators(path) {
+      if (!(typeof path == 'string')) return path;
+      if (dart.test(path[dartx.isEmpty])) path = '.';
+      if (dart.test(io.Platform.isWindows)) {
+        while (!dart.test(path[dartx.endsWith](io.Platform.pathSeparator)) && !dart.test(path[dartx.endsWith]('/'))) {
+          path = dart.str`${path}${io.Platform.pathSeparator}`;
+        }
+      } else {
+        while (!dart.test(path[dartx.endsWith](io.Platform.pathSeparator))) {
+          path = dart.str`${path}${io.Platform.pathSeparator}`;
+        }
+      }
+      return path;
+    }
+  };
+  dart.setSignature(io.FileSystemEntity, {
+    getters: () => ({
+      uri: dart.definiteFunctionType(core.Uri, []),
+      isAbsolute: dart.definiteFunctionType(core.bool, []),
+      [_absolutePath]: dart.definiteFunctionType(core.String, []),
+      parent: dart.definiteFunctionType(io.Directory, [])
+    }),
+    methods: () => ({
+      resolveSymbolicLinks: dart.definiteFunctionType(async.Future$(core.String), []),
+      resolveSymbolicLinksSync: dart.definiteFunctionType(core.String, []),
+      delete: dart.definiteFunctionType(async.Future$(io.FileSystemEntity), [], {recursive: core.bool}),
+      deleteSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [], {events: core.int, recursive: core.bool})
+    }),
+    sfields: () => ({
+      _absoluteWindowsPathPattern: core.RegExp,
+      _parentRegExp: core.RegExp
+    }),
+    sgetters: () => ({isWatchSupported: dart.definiteFunctionType(core.bool, [])}),
+    statics: () => ({
+      identical: dart.definiteFunctionType(async.Future$(core.bool), [core.String, core.String]),
+      identicalSync: dart.definiteFunctionType(core.bool, [core.String, core.String]),
+      type: dart.definiteFunctionType(async.Future$(io.FileSystemEntityType), [core.String], {followLinks: core.bool}),
+      typeSync: dart.definiteFunctionType(io.FileSystemEntityType, [core.String], {followLinks: core.bool}),
+      isLink: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+      isFile: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+      isDirectory: dart.definiteFunctionType(async.Future$(core.bool), [core.String]),
+      isLinkSync: dart.definiteFunctionType(core.bool, [core.String]),
+      isFileSync: dart.definiteFunctionType(core.bool, [core.String]),
+      isDirectorySync: dart.definiteFunctionType(core.bool, [core.String]),
+      _getType: dart.definiteFunctionType(dart.dynamic, [core.String, core.bool]),
+      _identical: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _resolveSymbolicLinks: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      parentOf: dart.definiteFunctionType(core.String, [core.String]),
+      _getTypeSync: dart.definiteFunctionType(core.int, [core.String, core.bool]),
+      _getTypeAsync: dart.definiteFunctionType(async.Future$(core.int), [core.String, core.bool]),
+      _throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String], [core.String]),
+      _trimTrailingPathSeparators: dart.definiteFunctionType(core.String, [core.String]),
+      _ensureTrailingPathSeparators: dart.definiteFunctionType(core.String, [core.String])
+    }),
+    names: ['identical', 'identicalSync', 'type', 'typeSync', 'isLink', 'isFile', 'isDirectory', 'isLinkSync', 'isFileSync', 'isDirectorySync', '_getType', '_identical', '_resolveSymbolicLinks', 'parentOf', '_getTypeSync', '_getTypeAsync', '_throwIfError', '_trimTrailingPathSeparators', '_ensureTrailingPathSeparators']
+  });
+  dart.defineLazy(io.FileSystemEntity, {
+    get _absoluteWindowsPathPattern() {
+      return core.RegExp.new('^(\\\\\\\\|[a-zA-Z]:[/\\\\])');
+    },
+    get _parentRegExp() {
+      return dart.test(io.Platform.isWindows) ? core.RegExp.new('[^/\\\\][/\\\\]+[^/\\\\]') : core.RegExp.new('[^/]/+[^/]');
+    }
+  });
+  io._Directory = class _Directory extends io.FileSystemEntity {
+    new(path) {
+      this.path = path;
+      if (!(typeof this.path == 'string')) {
+        dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+      }
+    }
+    static _current() {
+      dart.throw(new core.UnsupportedError("Directory._current"));
+    }
+    static _setCurrent(path) {
+      dart.throw(new core.UnsupportedError("Directory_SetCurrent"));
+    }
+    static _createTemp(path) {
+      dart.throw(new core.UnsupportedError("Directory._createTemp"));
+    }
+    static _systemTemp() {
+      dart.throw(new core.UnsupportedError("Directory._systemTemp"));
+    }
+    static _exists(path) {
+      dart.throw(new core.UnsupportedError("Directory._exists"));
+    }
+    static _create(path) {
+      dart.throw(new core.UnsupportedError("Directory._create"));
+    }
+    static _deleteNative(path, recursive) {
+      dart.throw(new core.UnsupportedError("Directory._deleteNative"));
+    }
+    static _rename(path, newPath) {
+      dart.throw(new core.UnsupportedError("Directory._rename"));
+    }
+    static _fillWithDirectoryListing(list, path, recursive, followLinks) {
+      dart.throw(new core.UnsupportedError("Directory._fillWithDirectoryListing"));
+    }
+    static get current() {
+      let result = io._Directory._current();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Getting current working directory failed", "", result));
+      }
+      return new io._Directory(core.String._check(result));
+    }
+    static set current(path) {
+      if (io.Directory.is(path)) path = dart.dload(path, 'path');
+      let result = io._Directory._setCurrent(path);
+      if (core.ArgumentError.is(result)) dart.throw(result);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Setting current working directory failed", core.String._check(path), result));
+      }
+    }
+    get uri() {
+      return core.Uri.directory(this.path);
+    }
+    exists() {
+      return io._IOService._dispatch(io._DIRECTORY_EXISTS, JSArrayOfString().of([this.path])).then(core.bool)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Exists failed"));
+        }
+        return dart.equals(response, 1);
+      }, dynamicTobool$()));
+    }
+    existsSync() {
+      let result = io._Directory._exists(this.path);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Exists failed", this.path, result));
+      }
+      return dart.equals(result, 1);
+    }
+    get absolute() {
+      return io.Directory.new(this[_absolutePath]);
+    }
+    stat() {
+      return io.FileStat.stat(this.path);
+    }
+    statSync() {
+      return io.FileStat.statSync(this.path);
+    }
+    [_computeExistingIndex](dirsToCreate) {
+      let future = null;
+      let notFound = dirsToCreate[dartx.length];
+      for (let i = 0; i < dart.notNull(dirsToCreate[dartx.length]); i++) {
+        if (future == null) {
+          future = dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
+        } else {
+          future = dart.dsend(future, 'then', dart.fn(index => {
+            if (!dart.equals(index, notFound)) {
+              return async.Future.value(index);
+            }
+            return dart.dsend(dart.dsend(dirsToCreate[dartx._get](i), 'exists'), 'then', dart.fn(e => dart.test(e) ? i : notFound, dynamicToint()));
+          }, dynamicTodynamic$()));
+        }
+      }
+      if (future == null) {
+        return FutureOfint().value(notFound);
+      } else {
+        return FutureOfint()._check(future);
+      }
+    }
+    create(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return this.exists().then(io.Directory)(dart.fn(exists => {
+          if (dart.test(exists)) return this;
+          if (this.path != this.parent.path) {
+            return this.parent.create({recursive: true}).then(io.Directory)(dart.fn(_ => this.create(), DirectoryToFutureOfDirectory()));
+          } else {
+            return this.create();
+          }
+        }, boolToFutureOrOfDirectory()));
+      } else {
+        return io._IOService._dispatch(io._DIRECTORY_CREATE, JSArrayOfString().of([this.path])).then(io._Directory)(dart.fn(response => {
+          if (dart.test(this[_isErrorResponse](response))) {
+            dart.throw(this[_exceptionOrErrorFromResponse](response, "Creation failed"));
+          }
+          return this;
+        }, dynamicTo_Directory()));
+      }
+    }
+    createSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        if (dart.test(this.existsSync())) return;
+        if (this.path != this.parent.path) {
+          this.parent.createSync({recursive: true});
+        }
+      }
+      let result = io._Directory._create(this.path);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Creation failed", this.path, result));
+      }
+    }
+    static get systemTemp() {
+      return io.Directory.new(io._Directory._systemTemp());
+    }
+    createTemp(prefix) {
+      if (prefix === void 0) prefix = null;
+      if (prefix == null) prefix = '';
+      if (this.path == '') {
+        dart.throw(new core.ArgumentError("Directory.createTemp called with an empty path. " + "To use the system temp directory, use Directory.systemTemp"));
+      }
+      let fullPrefix = null;
+      if (dart.test(this.path[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(this.path[dartx.endsWith]('\\'))) {
+        fullPrefix = dart.str`${this.path}${prefix}`;
+      } else {
+        fullPrefix = dart.str`${this.path}${io.Platform.pathSeparator}${prefix}`;
+      }
+      return io._IOService._dispatch(io._DIRECTORY_CREATE_TEMP, JSArrayOfString().of([fullPrefix])).then(io.Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Creation of temporary directory failed"));
+        }
+        return io.Directory.new(core.String._check(response));
+      }, dynamicToDirectory()));
+    }
+    createTempSync(prefix) {
+      if (prefix === void 0) prefix = null;
+      if (prefix == null) prefix = '';
+      if (this.path == '') {
+        dart.throw(new core.ArgumentError("Directory.createTemp called with an empty path. " + "To use the system temp directory, use Directory.systemTemp"));
+      }
+      let fullPrefix = null;
+      if (dart.test(this.path[dartx.endsWith]('/')) || dart.test(io.Platform.isWindows) && dart.test(this.path[dartx.endsWith]('\\'))) {
+        fullPrefix = dart.str`${this.path}${prefix}`;
+      } else {
+        fullPrefix = dart.str`${this.path}${io.Platform.pathSeparator}${prefix}`;
+      }
+      let result = io._Directory._createTemp(fullPrefix);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Creation of temporary directory failed", fullPrefix, result));
+      }
+      return io.Directory.new(core.String._check(result));
+    }
+    [_delete](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      return io._IOService._dispatch(io._DIRECTORY_DELETE, JSArrayOfObject().of([this.path, recursive])).then(io._Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Deletion failed"));
+        }
+        return this;
+      }, dynamicTo_Directory()));
+    }
+    [_deleteSync](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let result = io._Directory._deleteNative(this.path, recursive);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Deletion failed", this.path, result));
+      }
+    }
+    rename(newPath) {
+      return io._IOService._dispatch(io._DIRECTORY_RENAME, JSArrayOfString().of([this.path, newPath])).then(io.Directory)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionOrErrorFromResponse](response, "Rename failed"));
+        }
+        return io.Directory.new(newPath);
+      }, dynamicToDirectory()));
+    }
+    renameSync(newPath) {
+      if (!(typeof newPath == 'string')) {
+        dart.throw(new core.ArgumentError());
+      }
+      let result = io._Directory._rename(this.path, newPath);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("Rename failed", this.path, result));
+      }
+      return io.Directory.new(newPath);
+    }
+    list(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      return StreamOfFileSystemEntity()._check(new io._AsyncDirectoryLister(io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks).stream);
+    }
+    listSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let followLinks = opts && 'followLinks' in opts ? opts.followLinks : true;
+      if (!(typeof recursive == 'boolean') || !(typeof followLinks == 'boolean')) {
+        dart.throw(new core.ArgumentError());
+      }
+      let result = JSArrayOfFileSystemEntity().of([]);
+      io._Directory._fillWithDirectoryListing(result, io.FileSystemEntity._ensureTrailingPathSeparators(this.path), recursive, followLinks);
+      return result;
+    }
+    toString() {
+      return dart.str`Directory: '${this.path}'`;
+    }
+    [_isErrorResponse](response) {
+      return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+    }
+    [_exceptionOrErrorFromResponse](response, message) {
+      dart.assert(this[_isErrorResponse](response));
+      switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+        case io._ILLEGAL_ARGUMENT_RESPONSE:
+        {
+          return new core.ArgumentError();
+        }
+        case io._OSERROR_RESPONSE:
+        {
+          let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+          return new io.FileSystemException(message, this.path, err);
+        }
+        default:
+        {
+          return core.Exception.new("Unknown error");
+        }
+      }
+    }
+  };
+  io._Directory[dart.implements] = () => [io.Directory];
+  dart.setSignature(io._Directory, {
+    constructors: () => ({new: dart.definiteFunctionType(io._Directory, [core.String])}),
+    fields: () => ({path: core.String}),
+    getters: () => ({absolute: dart.definiteFunctionType(io.Directory, [])}),
+    methods: () => ({
+      exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+      existsSync: dart.definiteFunctionType(core.bool, []),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+      statSync: dart.definiteFunctionType(io.FileStat, []),
+      [_computeExistingIndex]: dart.definiteFunctionType(async.Future$(core.int), [core.List]),
+      create: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
+      createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      createTemp: dart.definiteFunctionType(async.Future$(io.Directory), [], [core.String]),
+      createTempSync: dart.definiteFunctionType(io.Directory, [], [core.String]),
+      [_delete]: dart.definiteFunctionType(async.Future$(io.Directory), [], {recursive: core.bool}),
+      [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      rename: dart.definiteFunctionType(async.Future$(io.Directory), [core.String]),
+      renameSync: dart.definiteFunctionType(io.Directory, [core.String]),
+      list: dart.definiteFunctionType(async.Stream$(io.FileSystemEntity), [], {recursive: core.bool, followLinks: core.bool}),
+      listSync: dart.definiteFunctionType(core.List$(io.FileSystemEntity), [], {recursive: core.bool, followLinks: core.bool}),
+      [_isErrorResponse]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+      [_exceptionOrErrorFromResponse]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String])
+    }),
+    sgetters: () => ({
+      current: dart.definiteFunctionType(io.Directory, []),
+      systemTemp: dart.definiteFunctionType(io.Directory, [])
+    }),
+    ssetters: () => ({current: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+    statics: () => ({
+      _current: dart.definiteFunctionType(dart.dynamic, []),
+      _setCurrent: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]),
+      _createTemp: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _systemTemp: dart.definiteFunctionType(core.String, []),
+      _exists: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _create: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _deleteNative: dart.definiteFunctionType(dart.dynamic, [core.String, core.bool]),
+      _rename: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _fillWithDirectoryListing: dart.definiteFunctionType(dart.void, [ListOfFileSystemEntity(), core.String, core.bool, core.bool])
+    }),
+    names: ['_current', '_setCurrent', '_createTemp', '_systemTemp', '_exists', '_create', '_deleteNative', '_rename', '_fillWithDirectoryListing']
+  });
+  io._AsyncDirectoryListerOps = class _AsyncDirectoryListerOps extends core.Object {
+    static new(pointer) {
+      dart.throw(new core.UnsupportedError("Directory._list"));
+    }
+  };
+  dart.setSignature(io._AsyncDirectoryListerOps, {
+    constructors: () => ({new: dart.definiteFunctionType(io._AsyncDirectoryListerOps, [core.int])})
+  });
+  const _ops = Symbol('_ops');
+  const _pointer = Symbol('_pointer');
+  const _cleanup = Symbol('_cleanup');
+  io._AsyncDirectoryLister = class _AsyncDirectoryLister extends core.Object {
+    new(path, recursive, followLinks) {
+      this.closeCompleter = async.Completer.new();
+      this.path = path;
+      this.recursive = recursive;
+      this.followLinks = followLinks;
+      this.controller = null;
+      this.canceled = false;
+      this.nextRunning = false;
+      this.closed = false;
+      this[_ops] = null;
+      this.controller = async.StreamController.new({onListen: dart.bind(this, 'onListen'), onResume: dart.bind(this, 'onResume'), onCancel: dart.bind(this, 'onCancel'), sync: true});
+    }
+    [_pointer]() {
+      return this[_ops] == null ? null : this[_ops].getPointer();
+    }
+    get stream() {
+      return this.controller.stream;
+    }
+    onListen() {
+      io._IOService._dispatch(io._DIRECTORY_LIST_START, JSArrayOfObject().of([this.path, this.recursive, this.followLinks])).then(dart.dynamic)(dart.fn(response => {
+        if (typeof response == 'number') {
+          this[_ops] = io._AsyncDirectoryListerOps.new(response);
+          this.next();
+        } else if (core.Error.is(response)) {
+          this.controller.addError(response, response.stackTrace);
+          this.close();
+        } else {
+          this.error(response);
+          this.close();
+        }
+      }, dynamicToNull$()));
+    }
+    onResume() {
+      if (!dart.test(this.nextRunning)) {
+        this.next();
+      }
+    }
+    onCancel() {
+      this.canceled = true;
+      if (!dart.test(this.nextRunning)) {
+        this.close();
+      }
+      return this.closeCompleter.future;
+    }
+    next() {
+      if (dart.test(this.canceled)) {
+        this.close();
+        return;
+      }
+      if (dart.test(this.controller.isPaused) || dart.test(this.nextRunning)) {
+        return;
+      }
+      let pointer = this[_pointer]();
+      if (pointer == null) {
+        return;
+      }
+      this.nextRunning = true;
+      io._IOService._dispatch(io._DIRECTORY_LIST_NEXT, JSArrayOfint().of([pointer])).then(dart.dynamic)(dart.fn(result => {
+        this.nextRunning = false;
+        if (core.List.is(result)) {
+          this.next();
+          dart.assert(result[dartx.length][dartx['%']](2) == 0);
+          for (let i = 0; i < dart.notNull(result[dartx.length]); i++) {
+            dart.assert(i[dartx['%']](2) == 0);
+            switch (result[dartx._get](i++)) {
+              case io._AsyncDirectoryLister.LIST_FILE:
+              {
+                this.controller.add(io.File.new(core.String._check(result[dartx._get](i))));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_DIRECTORY:
+              {
+                this.controller.add(io.Directory.new(core.String._check(result[dartx._get](i))));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_LINK:
+              {
+                this.controller.add(io.Link.new(core.String._check(result[dartx._get](i))));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_ERROR:
+              {
+                this.error(result[dartx._get](i));
+                break;
+              }
+              case io._AsyncDirectoryLister.LIST_DONE:
+              {
+                this.canceled = true;
+                return;
+              }
+            }
+          }
+        } else {
+          this.controller.addError(new io.FileSystemException("Internal error"));
+        }
+      }, dynamicToNull$()));
+    }
+    [_cleanup]() {
+      this.controller.close();
+      this.closeCompleter.complete();
+      this[_ops] = null;
+    }
+    close() {
+      if (dart.test(this.closed)) {
+        return;
+      }
+      if (dart.test(this.nextRunning)) {
+        return;
+      }
+      this.closed = true;
+      let pointer = this[_pointer]();
+      if (pointer == null) {
+        this[_cleanup]();
+      } else {
+        io._IOService._dispatch(io._DIRECTORY_LIST_STOP, JSArrayOfint().of([pointer])).whenComplete(dart.bind(this, _cleanup));
+      }
+    }
+    error(message) {
+      let errorType = dart.dindex(dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_ERROR), io._ERROR_RESPONSE_ERROR_TYPE);
+      if (dart.equals(errorType, io._ILLEGAL_ARGUMENT_RESPONSE)) {
+        this.controller.addError(new core.ArgumentError());
+      } else if (dart.equals(errorType, io._OSERROR_RESPONSE)) {
+        let responseError = dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_ERROR);
+        let err = new io.OSError(core.String._check(dart.dindex(responseError, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(responseError, io._OSERROR_RESPONSE_ERROR_CODE)));
+        let errorPath = dart.dindex(message, io._AsyncDirectoryLister.RESPONSE_PATH);
+        if (errorPath == null) errorPath = this.path;
+        this.controller.addError(new io.FileSystemException("Directory listing failed", core.String._check(errorPath), err));
+      } else {
+        this.controller.addError(new io.FileSystemException("Internal error"));
+      }
+    }
+  };
+  dart.setSignature(io._AsyncDirectoryLister, {
+    constructors: () => ({new: dart.definiteFunctionType(io._AsyncDirectoryLister, [core.String, core.bool, core.bool])}),
+    fields: () => ({
+      path: core.String,
+      recursive: core.bool,
+      followLinks: core.bool,
+      controller: async.StreamController,
+      canceled: core.bool,
+      nextRunning: core.bool,
+      closed: core.bool,
+      [_ops]: io._AsyncDirectoryListerOps,
+      closeCompleter: async.Completer
+    }),
+    getters: () => ({stream: dart.definiteFunctionType(async.Stream, [])}),
+    methods: () => ({
+      [_pointer]: dart.definiteFunctionType(core.int, []),
+      onListen: dart.definiteFunctionType(dart.void, []),
+      onResume: dart.definiteFunctionType(dart.void, []),
+      onCancel: dart.definiteFunctionType(async.Future, []),
+      next: dart.definiteFunctionType(dart.void, []),
+      [_cleanup]: dart.definiteFunctionType(dart.void, []),
+      close: dart.definiteFunctionType(dart.void, []),
+      error: dart.definiteFunctionType(dart.void, [dart.dynamic])
+    }),
+    sfields: () => ({
+      LIST_FILE: core.int,
+      LIST_DIRECTORY: core.int,
+      LIST_LINK: core.int,
+      LIST_ERROR: core.int,
+      LIST_DONE: core.int,
+      RESPONSE_TYPE: core.int,
+      RESPONSE_PATH: core.int,
+      RESPONSE_COMPLETE: core.int,
+      RESPONSE_ERROR: core.int
+    })
+  });
+  io._AsyncDirectoryLister.LIST_FILE = 0;
+  io._AsyncDirectoryLister.LIST_DIRECTORY = 1;
+  io._AsyncDirectoryLister.LIST_LINK = 2;
+  io._AsyncDirectoryLister.LIST_ERROR = 3;
+  io._AsyncDirectoryLister.LIST_DONE = 4;
+  io._AsyncDirectoryLister.RESPONSE_TYPE = 0;
+  io._AsyncDirectoryLister.RESPONSE_PATH = 1;
+  io._AsyncDirectoryLister.RESPONSE_COMPLETE = 1;
+  io._AsyncDirectoryLister.RESPONSE_ERROR = 2;
+  io._EventHandler = class _EventHandler extends core.Object {
+    static _sendData(sender, sendPort, data) {
+      dart.throw(new core.UnsupportedError("EventHandler._sendData"));
+    }
+  };
+  dart.setSignature(io._EventHandler, {
+    statics: () => ({_sendData: dart.definiteFunctionType(dart.void, [core.Object, isolate.SendPort, core.int])}),
+    names: ['_sendData']
+  });
+  const _mode = Symbol('_mode');
+  io.FileMode = class FileMode extends core.Object {
+    _internal(mode) {
+      this[_mode] = mode;
+    }
+  };
+  dart.defineNamedConstructor(io.FileMode, '_internal');
+  dart.setSignature(io.FileMode, {
+    constructors: () => ({_internal: dart.definiteFunctionType(io.FileMode, [core.int])}),
+    fields: () => ({[_mode]: core.int}),
+    sfields: () => ({
+      READ: io.FileMode,
+      WRITE: io.FileMode,
+      APPEND: io.FileMode,
+      WRITE_ONLY: io.FileMode,
+      WRITE_ONLY_APPEND: io.FileMode
+    })
+  });
+  dart.defineLazy(io.FileMode, {
+    get READ() {
+      return dart.const(new io.FileMode._internal(0));
+    },
+    get WRITE() {
+      return dart.const(new io.FileMode._internal(1));
+    },
+    get APPEND() {
+      return dart.const(new io.FileMode._internal(2));
+    },
+    get WRITE_ONLY() {
+      return dart.const(new io.FileMode._internal(3));
+    },
+    get WRITE_ONLY_APPEND() {
+      return dart.const(new io.FileMode._internal(4));
+    }
+  });
+  io.READ = io.FileMode.READ;
+  io.WRITE = io.FileMode.WRITE;
+  io.APPEND = io.FileMode.APPEND;
+  io.WRITE_ONLY = io.FileMode.WRITE_ONLY;
+  io.WRITE_ONLY_APPEND = io.FileMode.WRITE_ONLY_APPEND;
+  io.FileLock = class FileLock extends core.Object {
+    new(index) {
+      this.index = index;
+    }
+    toString() {
+      return {
+        0: "FileLock.SHARED",
+        1: "FileLock.EXCLUSIVE"
+      }[this.index];
+    }
+  };
+  dart.setSignature(io.FileLock, {
+    fields: () => ({index: core.int})
+  });
+  dart.defineEnumValues(io.FileLock, [
+    'SHARED',
+    'EXCLUSIVE'
+  ]);
+  io.File = class File extends core.Object {
+    static new(path) {
+      return new io._File(path);
+    }
+    static fromUri(uri) {
+      return io.File.new(uri.toFilePath());
+    }
+  };
+  io.File[dart.implements] = () => [io.FileSystemEntity];
+  dart.setSignature(io.File, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.File, [core.String]),
+      fromUri: dart.definiteFunctionType(io.File, [core.Uri])
+    })
+  });
+  io.RandomAccessFile = class RandomAccessFile extends core.Object {};
+  io.FileSystemException = class FileSystemException extends core.Object {
+    new(message, path, osError) {
+      if (message === void 0) message = "";
+      if (path === void 0) path = "";
+      if (osError === void 0) osError = null;
+      this.message = message;
+      this.path = path;
+      this.osError = osError;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write("FileSystemException");
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(dart.str`: ${this.message}`);
+        if (this.path != null) {
+          sb.write(dart.str`, path = '${this.path}'`);
+        }
+        if (this.osError != null) {
+          sb.write(dart.str` (${this.osError})`);
+        }
+      } else if (this.osError != null) {
+        sb.write(dart.str`: ${this.osError}`);
+        if (this.path != null) {
+          sb.write(dart.str`, path = '${this.path}'`);
+        }
+      } else if (this.path != null) {
+        sb.write(dart.str`: ${this.path}`);
+      }
+      return sb.toString();
+    }
+  };
+  io.FileSystemException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.FileSystemException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.FileSystemException, [], [core.String, core.String, io.OSError])}),
+    fields: () => ({
+      message: core.String,
+      path: core.String,
+      osError: io.OSError
+    })
+  });
+  io._BLOCK_SIZE = 64 * 1024;
+  const _closeCompleter = Symbol('_closeCompleter');
+  const _path$ = Symbol('_path');
+  const _position$0 = Symbol('_position');
+  const _end$0 = Symbol('_end');
+  const _controller$0 = Symbol('_controller');
+  const _openedFile = Symbol('_openedFile');
+  const _unsubscribed = Symbol('_unsubscribed');
+  const _readInProgress = Symbol('_readInProgress');
+  const _atEnd = Symbol('_atEnd');
+  const _setupController = Symbol('_setupController');
+  const _start$2 = Symbol('_start');
+  const _readBlock = Symbol('_readBlock');
+  const _closeFile = Symbol('_closeFile');
+  io._FileStream = class _FileStream extends async.Stream$(core.List$(core.int)) {
+    new(path, position, end) {
+      this[_closeCompleter] = async.Completer.new();
+      this[_path$] = path;
+      this[_position$0] = position;
+      this[_end$0] = end;
+      this[_controller$0] = null;
+      this[_openedFile] = null;
+      this[_unsubscribed] = false;
+      this[_readInProgress] = true;
+      this[_closed] = false;
+      this[_atEnd] = false;
+      super.new();
+      if (this[_position$0] == null) this[_position$0] = 0;
+    }
+    forStdin() {
+      this[_closeCompleter] = async.Completer.new();
+      this[_position$0] = 0;
+      this[_controller$0] = null;
+      this[_path$] = null;
+      this[_openedFile] = null;
+      this[_end$0] = null;
+      this[_unsubscribed] = false;
+      this[_readInProgress] = true;
+      this[_closed] = false;
+      this[_atEnd] = false;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      this[_setupController]();
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    [_setupController]() {
+      this[_controller$0] = StreamControllerOfListOfint().new({sync: true, onListen: dart.bind(this, _start$2), onResume: dart.bind(this, _readBlock), onCancel: dart.fn(() => {
+          this[_unsubscribed] = true;
+          return this[_closeFile]();
+        }, VoidToFuture())});
+    }
+    [_closeFile]() {
+      if (dart.test(this[_readInProgress]) || dart.test(this[_closed])) {
+        return this[_closeCompleter].future;
+      }
+      this[_closed] = true;
+      const done = (function() {
+        this[_closeCompleter].complete();
+        this[_controller$0].close();
+      }).bind(this);
+      dart.fn(done, VoidTovoid$());
+      this[_openedFile].close().catchError(dart.bind(this[_controller$0], 'addError')).whenComplete(done);
+      return this[_closeCompleter].future;
+    }
+    [_readBlock]() {
+      if (dart.test(this[_readInProgress])) return;
+      if (dart.test(this[_atEnd])) {
+        this[_closeFile]();
+        return;
+      }
+      this[_readInProgress] = true;
+      let readBytes = io._BLOCK_SIZE;
+      if (this[_end$0] != null) {
+        readBytes = math.min(core.int)(readBytes, dart.notNull(this[_end$0]) - dart.notNull(this[_position$0]));
+        if (dart.notNull(readBytes) < 0) {
+          this[_readInProgress] = false;
+          if (!dart.test(this[_unsubscribed])) {
+            this[_controller$0].addError(new core.RangeError(dart.str`Bad end position: ${this[_end$0]}`));
+            this[_closeFile]();
+            this[_unsubscribed] = true;
+          }
+          return;
+        }
+      }
+      this[_openedFile].read(readBytes).then(dart.dynamic)(dart.fn(block => {
+        this[_readInProgress] = false;
+        if (dart.test(this[_unsubscribed])) {
+          this[_closeFile]();
+          return;
+        }
+        this[_position$0] = dart.notNull(this[_position$0]) + dart.notNull(block[dartx.length]);
+        if (dart.notNull(block[dartx.length]) < dart.notNull(readBytes) || this[_end$0] != null && this[_position$0] == this[_end$0]) {
+          this[_atEnd] = true;
+        }
+        if (!dart.test(this[_atEnd]) && !dart.test(this[_controller$0].isPaused)) {
+          this[_readBlock]();
+        }
+        this[_controller$0].add(block);
+        if (dart.test(this[_atEnd])) {
+          this[_closeFile]();
+        }
+      }, ListOfintToNull())).catchError(dart.fn((e, s) => {
+        if (!dart.test(this[_unsubscribed])) {
+          this[_controller$0].addError(e, core.StackTrace._check(s));
+          this[_closeFile]();
+          this[_unsubscribed] = true;
+        }
+      }, dynamicAnddynamicToNull()));
+    }
+    [_start$2]() {
+      if (dart.notNull(this[_position$0]) < 0) {
+        this[_controller$0].addError(new core.RangeError(dart.str`Bad start position: ${this[_position$0]}`));
+        this[_controller$0].close();
+        this[_closeCompleter].complete();
+        return;
+      }
+      const onReady = (function(file) {
+        this[_openedFile] = file;
+        this[_readInProgress] = false;
+        this[_readBlock]();
+      }).bind(this);
+      dart.fn(onReady, RandomAccessFileTovoid());
+      const onOpenFile = (function(file) {
+        if (dart.notNull(this[_position$0]) > 0) {
+          file.setPosition(this[_position$0]).then(dart.void)(onReady, {onError: dart.fn((e, s) => {
+              this[_controller$0].addError(e, core.StackTrace._check(s));
+              this[_readInProgress] = false;
+              this[_closeFile]();
+            }, dynamicAnddynamicToNull())});
+        } else {
+          onReady(file);
+        }
+      }).bind(this);
+      dart.fn(onOpenFile, RandomAccessFileTovoid());
+      const openFailed = (function(error, stackTrace) {
+        this[_controller$0].addError(error, core.StackTrace._check(stackTrace));
+        this[_controller$0].close();
+        this[_closeCompleter].complete();
+      }).bind(this);
+      dart.fn(openFailed, dynamicAnddynamicTovoid$());
+      if (this[_path$] != null) {
+        io.File.new(this[_path$]).open({mode: io.FileMode.READ}).then(dart.void)(onOpenFile, {onError: openFailed});
+      } else {
+        try {
+          onOpenFile(io._File._openStdioSync(0));
+        } catch (e) {
+          let s = dart.stackTrace(e);
+          openFailed(e, s);
+        }
+
+      }
+    }
+  };
+  dart.addSimpleTypeTests(io._FileStream);
+  dart.defineNamedConstructor(io._FileStream, 'forStdin');
+  dart.setSignature(io._FileStream, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._FileStream, [core.String, core.int, core.int]),
+      forStdin: dart.definiteFunctionType(io._FileStream, [])
+    }),
+    fields: () => ({
+      [_controller$0]: StreamControllerOfListOfint(),
+      [_path$]: core.String,
+      [_openedFile]: io.RandomAccessFile,
+      [_position$0]: core.int,
+      [_end$0]: core.int,
+      [_closeCompleter]: async.Completer,
+      [_unsubscribed]: core.bool,
+      [_readInProgress]: core.bool,
+      [_closed]: core.bool,
+      [_atEnd]: core.bool
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      [_setupController]: dart.definiteFunctionType(dart.void, []),
+      [_closeFile]: dart.definiteFunctionType(async.Future, []),
+      [_readBlock]: dart.definiteFunctionType(dart.void, []),
+      [_start$2]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _file = Symbol('_file');
+  const _openFuture = Symbol('_openFuture');
+  io._FileStreamConsumer = class _FileStreamConsumer extends async.StreamConsumer$(core.List$(core.int)) {
+    new(file, mode) {
+      this[_file] = file;
+      this[_openFuture] = null;
+      this[_openFuture] = this[_file].open({mode: mode});
+    }
+    fromStdio(fd) {
+      this[_file] = null;
+      this[_openFuture] = null;
+      dart.assert(1 <= dart.notNull(fd) && dart.notNull(fd) <= 2);
+      this[_openFuture] = FutureOfRandomAccessFile().value(io._File._openStdioSync(fd));
+    }
+    addStream(stream) {
+      let completer = CompleterOfFile().sync();
+      this[_openFuture].then(dart.dynamic)(dart.fn(openedFile => {
+        let _subscription = null;
+        function error(e, stackTrace) {
+          if (stackTrace === void 0) stackTrace = null;
+          dart.dsend(_subscription, 'cancel');
+          openedFile.close();
+          completer.completeError(e, stackTrace);
+        }
+        dart.fn(error, dynamic__Tovoid());
+        _subscription = stream.listen(dart.fn(d => {
+          dart.dsend(_subscription, 'pause');
+          try {
+            openedFile.writeFrom(d, 0, d[dartx.length]).then(dart.dynamic)(dart.fn(_ => dart.dsend(_subscription, 'resume'), RandomAccessFileToFutureOr()), {onError: error});
+          } catch (e) {
+            let stackTrace = dart.stackTrace(e);
+            error(e, stackTrace);
+          }
+
+        }, ListOfintToNull()), {onDone: dart.fn(() => {
+            completer.complete(this[_file]);
+          }, VoidToNull()), onError: error, cancelOnError: true});
+      }, RandomAccessFileToNull())).catchError(dart.bind(completer, 'completeError'));
+      return completer.future;
+    }
+    close() {
+      return this[_openFuture].then(io.File)(dart.fn(openedFile => openedFile.close(), RandomAccessFileToFutureOfRandomAccessFile()));
+    }
+  };
+  dart.addSimpleTypeTests(io._FileStreamConsumer);
+  dart.defineNamedConstructor(io._FileStreamConsumer, 'fromStdio');
+  dart.setSignature(io._FileStreamConsumer, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._FileStreamConsumer, [io.File, io.FileMode]),
+      fromStdio: dart.definiteFunctionType(io._FileStreamConsumer, [core.int])
+    }),
+    fields: () => ({
+      [_file]: io.File,
+      [_openFuture]: FutureOfRandomAccessFile()
+    }),
+    methods: () => ({
+      addStream: dart.definiteFunctionType(async.Future$(io.File), [StreamOfListOfint()]),
+      close: dart.definiteFunctionType(async.Future$(io.File), [])
+    })
+  });
+  const _tryDecode = Symbol('_tryDecode');
+  let const$54;
+  let const$55;
+  io._File = class _File extends io.FileSystemEntity {
+    new(path) {
+      this.path = path;
+      if (!(typeof this.path == 'string')) {
+        dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+      }
+    }
+    exists() {
+      return io._IOService._dispatch(io._FILE_EXISTS, JSArrayOfString().of([this.path])).then(core.bool)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot check existence", this.path));
+        }
+        return FutureOrOfbool()._check(response);
+      }, dynamicToFutureOrOfbool()));
+    }
+    static _exists(path) {
+      dart.throw(new core.UnsupportedError("File._exists"));
+    }
+    existsSync() {
+      let result = io._File._exists(this.path);
+      io._File.throwIfError(result, "Cannot check existence of file", this.path);
+      return core.bool._check(result);
+    }
+    get absolute() {
+      return io.File.new(this[_absolutePath]);
+    }
+    stat() {
+      return io.FileStat.stat(this.path);
+    }
+    statSync() {
+      return io.FileStat.statSync(this.path);
+    }
+    create(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
+      return result.then(dart.dynamic)(dart.fn(_ => io._IOService._dispatch(io._FILE_CREATE, JSArrayOfString().of([this.path])), dynamicToFuture())).then(io._File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot create file", this.path));
+        }
+        return this;
+      }, dynamicTo_File()));
+    }
+    static _create(path) {
+      dart.throw(new core.UnsupportedError("File._create"));
+    }
+    static _createLink(path, target) {
+      dart.throw(new core.UnsupportedError("File._createLink"));
+    }
+    static _linkTarget(path) {
+      dart.throw(new core.UnsupportedError("File._linkTarget"));
+    }
+    createSync(opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        this.parent.createSync({recursive: true});
+      }
+      let result = io._File._create(this.path);
+      io._File.throwIfError(result, "Cannot create file", this.path);
+    }
+    [_delete](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).delete({recursive: true}).then(io._File)(dart.fn(_ => this, FileSystemEntityTo_File()));
+      }
+      return io._IOService._dispatch(io._FILE_DELETE, JSArrayOfString().of([this.path])).then(io._File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot delete file", this.path));
+        }
+        return this;
+      }, dynamicTo_File()));
+    }
+    static _deleteNative(path) {
+      dart.throw(new core.UnsupportedError("File._deleteNative"));
+    }
+    static _deleteLinkNative(path) {
+      dart.throw(new core.UnsupportedError("File._deleteLinkNative"));
+    }
+    [_deleteSync](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).deleteSync({recursive: true});
+      }
+      let result = io._File._deleteNative(this.path);
+      io._File.throwIfError(result, "Cannot delete file", this.path);
+    }
+    rename(newPath) {
+      return io._IOService._dispatch(io._FILE_RENAME, JSArrayOfString().of([this.path, newPath])).then(io.File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, dart.str`Cannot rename file to '${newPath}'`, this.path));
+        }
+        return io.File.new(newPath);
+      }, dynamicToFile()));
+    }
+    static _rename(oldPath, newPath) {
+      dart.throw(new core.UnsupportedError("File._rename"));
+    }
+    static _renameLink(oldPath, newPath) {
+      dart.throw(new core.UnsupportedError("File._renameLink"));
+    }
+    renameSync(newPath) {
+      let result = io._File._rename(this.path, newPath);
+      io._File.throwIfError(result, dart.str`Cannot rename file to '${newPath}'`, this.path);
+      return io.File.new(newPath);
+    }
+    copy(newPath) {
+      return io._IOService._dispatch(io._FILE_COPY, JSArrayOfString().of([this.path, newPath])).then(io.File)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, dart.str`Cannot copy file to '${newPath}'`, this.path));
+        }
+        return io.File.new(newPath);
+      }, dynamicToFile()));
+    }
+    static _copy(oldPath, newPath) {
+      dart.throw(new core.UnsupportedError("File._copy"));
+    }
+    copySync(newPath) {
+      let result = io._File._copy(this.path, newPath);
+      io._File.throwIfError(result, dart.str`Cannot copy file to '${newPath}'`, this.path);
+      return io.File.new(newPath);
+    }
+    open(opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.READ;
+      if (!dart.equals(mode, io.FileMode.READ) && !dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+        return FutureOfRandomAccessFile().error(new core.ArgumentError('Invalid file mode for this operation'));
+      }
+      return io._IOService._dispatch(io._FILE_OPEN, JSArrayOfObject().of([this.path, mode[_mode]])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot open file", this.path));
+        }
+        return new io._RandomAccessFile(core.int._check(response), this.path);
+      }, dynamicTo_RandomAccessFile()));
+    }
+    length() {
+      return io._IOService._dispatch(io._FILE_LENGTH_FROM_PATH, JSArrayOfString().of([this.path])).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot retrieve length of file", this.path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    static _lengthFromPath(path) {
+      dart.throw(new core.UnsupportedError("File._lengthFromPath"));
+    }
+    lengthSync() {
+      let result = io._File._lengthFromPath(this.path);
+      io._File.throwIfError(result, "Cannot retrieve length of file", this.path);
+      return core.int._check(result);
+    }
+    lastModified() {
+      return io._IOService._dispatch(io._FILE_LAST_MODIFIED, JSArrayOfString().of([this.path])).then(core.DateTime)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "Cannot retrieve modification time", this.path));
+        }
+        return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(response));
+      }, dynamicToDateTime()));
+    }
+    static _lastModified(path) {
+      dart.throw(new core.UnsupportedError("File._lastModified"));
+    }
+    lastModifiedSync() {
+      let ms = io._File._lastModified(this.path);
+      io._File.throwIfError(ms, "Cannot retrieve modification time", this.path);
+      return new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(ms));
+    }
+    static _open(path, mode) {
+      dart.throw(new core.UnsupportedError("File._open"));
+    }
+    openSync(opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.READ;
+      if (!dart.equals(mode, io.FileMode.READ) && !dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+        dart.throw(new core.ArgumentError('Invalid file mode for this operation'));
+      }
+      let id = io._File._open(this.path, mode[_mode]);
+      io._File.throwIfError(id, "Cannot open file", this.path);
+      return new io._RandomAccessFile(core.int._check(id), this.path);
+    }
+    static _openStdio(fd) {
+      dart.throw(new core.UnsupportedError("File._openStdio"));
+    }
+    static _openStdioSync(fd) {
+      let id = io._File._openStdio(fd);
+      if (id == 0) {
+        dart.throw(new io.FileSystemException(dart.str`Cannot open stdio file for: ${fd}`));
+      }
+      return new io._RandomAccessFile(id, "");
+    }
+    openRead(start, end) {
+      if (start === void 0) start = null;
+      if (end === void 0) end = null;
+      return new io._FileStream(this.path, start, end);
+    }
+    openWrite(opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      if (!dart.equals(mode, io.FileMode.WRITE) && !dart.equals(mode, io.FileMode.APPEND) && !dart.equals(mode, io.FileMode.WRITE_ONLY) && !dart.equals(mode, io.FileMode.WRITE_ONLY_APPEND)) {
+        dart.throw(new core.ArgumentError('Invalid file mode for this operation'));
+      }
+      let consumer = new io._FileStreamConsumer(this, mode);
+      return io.IOSink.new(consumer, {encoding: encoding});
+    }
+    readAsBytes() {
+      function readDataChunked(file) {
+        let builder = io.BytesBuilder.new({copy: false});
+        let completer = async.Completer.new();
+        function read() {
+          dart.dsend(dart.dsend(file, 'read', io._BLOCK_SIZE), 'then', dart.fn(data => {
+            if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) {
+              builder.add(ListOfint()._check(data));
+              read();
+            } else {
+              completer.complete(builder.takeBytes());
+            }
+          }, dynamicToNull$()), {onError: dart.bind(completer, 'completeError')});
+        }
+        dart.fn(read, VoidTovoid$());
+        read();
+        return FutureOfListOfint()._check(completer.future);
+      }
+      dart.fn(readDataChunked, dynamicToFutureOfListOfint());
+      return this.open().then(ListOfint())(dart.fn(file => file.length().then(ListOfint())(dart.fn(length => {
+        if (length == 0) {
+          return readDataChunked(file);
+        }
+        return file.read(length);
+      }, intToFutureOfListOfint())).whenComplete(dart.bind(file, 'close')), RandomAccessFileToFutureOfListOfint()));
+    }
+    readAsBytesSync() {
+      let opened = this.openSync();
+      try {
+        let data = null;
+        let length = opened.lengthSync();
+        if (length == 0) {
+          let builder = io.BytesBuilder.new({copy: false});
+          do {
+            data = opened.readSync(io._BLOCK_SIZE);
+            if (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0))) builder.add(ListOfint()._check(data));
+          } while (dart.test(dart.dsend(dart.dload(data, 'length'), '>', 0)));
+          data = builder.takeBytes();
+        } else {
+          data = opened.readSync(length);
+        }
+        return ListOfint()._check(data);
+      } finally {
+        opened.closeSync();
+      }
+    }
+    [_tryDecode](bytes, encoding) {
+      try {
+        return encoding.decode(bytes);
+      } catch (_) {
+        dart.throw(new io.FileSystemException(dart.str`Failed to decode data using encoding '${encoding.name}'`, this.path));
+      }
+
+    }
+    readAsString(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return this.readAsBytes().then(core.String)(dart.fn(bytes => this[_tryDecode](bytes, encoding), ListOfintToString()));
+    }
+    readAsStringSync(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return this[_tryDecode](this.readAsBytesSync(), encoding);
+    }
+    readAsLines(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return this.readAsString({encoding: encoding}).then(ListOfString())(dart.bind(const$54 || (const$54 = dart.const(new convert.LineSplitter())), 'convert'));
+    }
+    readAsLinesSync(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return (const$55 || (const$55 = dart.const(new convert.LineSplitter()))).convert(this.readAsStringSync({encoding: encoding}));
+    }
+    writeAsBytes(bytes, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      return this.open({mode: mode}).then(io.File)(dart.fn(file => file.writeFrom(bytes, 0, bytes[dartx.length]).then(dart.dynamic)(dart.fn(_ => {
+        if (dart.test(flush)) return file.flush().then(io._File)(dart.fn(_ => this, RandomAccessFileTo_File()));
+        return this;
+      }, RandomAccessFileToObject())).whenComplete(dart.bind(file, 'close')), RandomAccessFileToFutureOrOfFile()));
+    }
+    writeAsBytesSync(bytes, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      let opened = this.openSync({mode: mode});
+      try {
+        opened.writeFromSync(bytes, 0, bytes[dartx.length]);
+        if (dart.test(flush)) opened.flushSync();
+      } finally {
+        opened.closeSync();
+      }
+    }
+    writeAsString(contents, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      try {
+        return this.writeAsBytes(encoding.encode(contents), {mode: mode, flush: flush});
+      } catch (e) {
+        return FutureOfFile().error(e);
+      }
+
+    }
+    writeAsStringSync(contents, opts) {
+      let mode = opts && 'mode' in opts ? opts.mode : io.FileMode.WRITE;
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      let flush = opts && 'flush' in opts ? opts.flush : false;
+      this.writeAsBytesSync(encoding.encode(contents), {mode: mode, flush: flush});
+    }
+    toString() {
+      return dart.str`File: '${this.path}'`;
+    }
+    static throwIfError(result, msg, path) {
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException(msg, path, result));
+      }
+    }
+  };
+  io._File[dart.implements] = () => [io.File];
+  dart.setSignature(io._File, {
+    constructors: () => ({new: dart.definiteFunctionType(io._File, [core.String])}),
+    fields: () => ({path: core.String}),
+    getters: () => ({absolute: dart.definiteFunctionType(io.File, [])}),
+    methods: () => ({
+      exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+      existsSync: dart.definiteFunctionType(core.bool, []),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+      statSync: dart.definiteFunctionType(io.FileStat, []),
+      create: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
+      createSync: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      [_delete]: dart.definiteFunctionType(async.Future$(io.File), [], {recursive: core.bool}),
+      [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      rename: dart.definiteFunctionType(async.Future$(io.File), [core.String]),
+      renameSync: dart.definiteFunctionType(io.File, [core.String]),
+      copy: dart.definiteFunctionType(async.Future$(io.File), [core.String]),
+      copySync: dart.definiteFunctionType(io.File, [core.String]),
+      open: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], {mode: io.FileMode}),
+      length: dart.definiteFunctionType(async.Future$(core.int), []),
+      lengthSync: dart.definiteFunctionType(core.int, []),
+      lastModified: dart.definiteFunctionType(async.Future$(core.DateTime), []),
+      lastModifiedSync: dart.definiteFunctionType(core.DateTime, []),
+      openSync: dart.definiteFunctionType(io.RandomAccessFile, [], {mode: io.FileMode}),
+      openRead: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [], [core.int, core.int]),
+      openWrite: dart.definiteFunctionType(io.IOSink, [], {mode: io.FileMode, encoding: convert.Encoding}),
+      readAsBytes: dart.definiteFunctionType(async.Future$(core.List$(core.int)), []),
+      readAsBytesSync: dart.definiteFunctionType(core.List$(core.int), []),
+      [_tryDecode]: dart.definiteFunctionType(core.String, [ListOfint(), convert.Encoding]),
+      readAsString: dart.definiteFunctionType(async.Future$(core.String), [], {encoding: convert.Encoding}),
+      readAsStringSync: dart.definiteFunctionType(core.String, [], {encoding: convert.Encoding}),
+      readAsLines: dart.definiteFunctionType(async.Future$(core.List$(core.String)), [], {encoding: convert.Encoding}),
+      readAsLinesSync: dart.definiteFunctionType(core.List$(core.String), [], {encoding: convert.Encoding}),
+      writeAsBytes: dart.definiteFunctionType(async.Future$(io.File), [ListOfint()], {mode: io.FileMode, flush: core.bool}),
+      writeAsBytesSync: dart.definiteFunctionType(dart.void, [ListOfint()], {mode: io.FileMode, flush: core.bool}),
+      writeAsString: dart.definiteFunctionType(async.Future$(io.File), [core.String], {mode: io.FileMode, encoding: convert.Encoding, flush: core.bool}),
+      writeAsStringSync: dart.definiteFunctionType(dart.void, [core.String], {mode: io.FileMode, encoding: convert.Encoding, flush: core.bool})
+    }),
+    statics: () => ({
+      _exists: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _create: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _createLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _linkTarget: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _deleteNative: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _deleteLinkNative: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _rename: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _renameLink: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _copy: dart.definiteFunctionType(dart.dynamic, [core.String, core.String]),
+      _lengthFromPath: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _lastModified: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      _open: dart.definiteFunctionType(dart.dynamic, [core.String, core.int]),
+      _openStdio: dart.definiteFunctionType(core.int, [core.int]),
+      _openStdioSync: dart.definiteFunctionType(io.RandomAccessFile, [core.int]),
+      throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String, core.String])
+    }),
+    names: ['_exists', '_create', '_createLink', '_linkTarget', '_deleteNative', '_deleteLinkNative', '_rename', '_renameLink', '_copy', '_lengthFromPath', '_lastModified', '_open', '_openStdio', '_openStdioSync', 'throwIfError']
+  });
+  io._RandomAccessFileOps = class _RandomAccessFileOps extends core.Object {
+    static new(pointer) {
+      dart.throw(new core.UnsupportedError("RandomAccessFile"));
+    }
+  };
+  dart.setSignature(io._RandomAccessFileOps, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RandomAccessFileOps, [core.int])})
+  });
+  const _asyncDispatched = Symbol('_asyncDispatched');
+  const _fileService = Symbol('_fileService');
+  const _resourceInfo = Symbol('_resourceInfo');
+  const _maybeConnectHandler = Symbol('_maybeConnectHandler');
+  const _maybePerformCleanup = Symbol('_maybePerformCleanup');
+  const _dispatch = Symbol('_dispatch');
+  const _checkAvailable = Symbol('_checkAvailable');
+  io._RandomAccessFile = class _RandomAccessFile extends core.Object {
+    new(pointer, path) {
+      this.path = path;
+      this[_asyncDispatched] = false;
+      this[_fileService] = null;
+      this[_resourceInfo] = null;
+      this[_ops] = null;
+      this.closed = false;
+      this[_ops] = io._RandomAccessFileOps.new(pointer);
+      this[_resourceInfo] = new io._FileResourceInfo(this);
+      this[_maybeConnectHandler]();
+    }
+    [_maybePerformCleanup]() {
+      if (dart.test(this.closed)) {
+        io._FileResourceInfo.FileClosed(this[_resourceInfo]);
+      }
+    }
+    [_maybeConnectHandler]() {
+      if (!dart.test(io._RandomAccessFile._connectedResourceHandler)) {
+        developer.registerExtension('ext.dart.io.getOpenFiles', io._FileResourceInfo.getOpenFiles);
+        developer.registerExtension('ext.dart.io.getFileByID', io._FileResourceInfo.getFileInfoMapByID);
+        io._RandomAccessFile._connectedResourceHandler = true;
+      }
+    }
+    close() {
+      return this[_dispatch](io._FILE_CLOSE, [null], {markClosed: true}).then(io._RandomAccessFile)(dart.fn(result => {
+        if (!dart.equals(result, -1)) {
+          this.closed = dart.test(this.closed) || dart.equals(result, 0);
+          this[_maybePerformCleanup]();
+          return this;
+        } else {
+          dart.throw(new io.FileSystemException("Cannot close file", this.path));
+        }
+      }, dynamicTo_RandomAccessFile()));
+    }
+    closeSync() {
+      this[_checkAvailable]();
+      let id = this[_ops].close();
+      if (id == -1) {
+        dart.throw(new io.FileSystemException("Cannot close file", this.path));
+      }
+      this.closed = dart.test(this.closed) || id == 0;
+      this[_maybePerformCleanup]();
+    }
+    readByte() {
+      return this[_dispatch](io._FILE_READ_BYTE, [null]).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "readByte failed", this.path));
+        }
+        this[_resourceInfo].addRead(1);
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    readByteSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].readByte();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("readByte failed", this.path, result));
+      }
+      this[_resourceInfo].addRead(1);
+      return core.int._check(result);
+    }
+    read(bytes) {
+      if (!(typeof bytes == 'number')) {
+        dart.throw(new core.ArgumentError(bytes));
+      }
+      return this[_dispatch](io._FILE_READ, JSArrayOfint().of([null, bytes])).then(ListOfint())(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "read failed", this.path));
+        }
+        this[_resourceInfo].addRead(core.int._check(dart.dload(dart.dindex(response, 1), 'length')));
+        return FutureOrOfListOfint()._check(dart.dindex(response, 1));
+      }, dynamicToFutureOrOfListOfint()));
+    }
+    readSync(bytes) {
+      this[_checkAvailable]();
+      if (!(typeof bytes == 'number')) {
+        dart.throw(new core.ArgumentError(bytes));
+      }
+      let result = this[_ops].read(bytes);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("readSync failed", this.path, result));
+      }
+      this[_resourceInfo].addRead(core.int._check(dart.dload(result, 'length')));
+      return ListOfint()._check(result);
+    }
+    readInto(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return FutureOfint().value(0);
+      }
+      let length = dart.notNull(end) - dart.notNull(start);
+      return this[_dispatch](io._FILE_READ_INTO, JSArrayOfint().of([null, length])).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "readInto failed", this.path));
+        }
+        let read = dart.dindex(response, 1);
+        let data = dart.dindex(response, 2);
+        buffer[dartx.setRange](start, dart.asInt(dart.notNull(start) + dart.notNull(core.num._check(read))), IterableOfint()._check(data));
+        this[_resourceInfo].addRead(core.int._check(read));
+        return FutureOrOfint()._check(read);
+      }, dynamicToFutureOrOfint()));
+    }
+    readIntoSync(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      this[_checkAvailable]();
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return 0;
+      }
+      let result = this[_ops].readInto(buffer, start, end);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("readInto failed", this.path, result));
+      }
+      this[_resourceInfo].addRead(core.int._check(result));
+      return core.int._check(result);
+    }
+    writeByte(value) {
+      if (!(typeof value == 'number')) {
+        dart.throw(new core.ArgumentError(value));
+      }
+      return this[_dispatch](io._FILE_WRITE_BYTE, JSArrayOfint().of([null, value])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "writeByte failed", this.path));
+        }
+        this[_resourceInfo].addWrite(1);
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    writeByteSync(value) {
+      this[_checkAvailable]();
+      if (!(typeof value == 'number')) {
+        dart.throw(new core.ArgumentError(value));
+      }
+      let result = this[_ops].writeByte(value);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("writeByte failed", this.path, result));
+      }
+      this[_resourceInfo].addWrite(1);
+      return core.int._check(result);
+    }
+    writeFrom(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError("Invalid arguments to writeFrom"));
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return FutureOfRandomAccessFile().value(this);
+      }
+      let result = null;
+      try {
+        result = io._ensureFastAndSerializableByteData(buffer, start, end);
+      } catch (e) {
+        return FutureOfRandomAccessFile().error(e);
+      }
+
+      let request = core.List.new(4);
+      request[dartx._set](0, null);
+      request[dartx._set](1, result.buffer);
+      request[dartx._set](2, result.start);
+      request[dartx._set](3, dart.notNull(end) - (dart.notNull(start) - dart.notNull(result.start)));
+      return this[_dispatch](io._FILE_WRITE_FROM, request).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "writeFrom failed", this.path));
+        }
+        this[_resourceInfo].addWrite(dart.notNull(end) - (dart.notNull(start) - dart.notNull(result.start)));
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    writeFromSync(buffer, start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = null;
+      this[_checkAvailable]();
+      if (!core.List.is(buffer) || start != null && !(typeof start == 'number') || end != null && !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError("Invalid arguments to writeFromSync"));
+      }
+      end = core.RangeError.checkValidRange(start, end, buffer[dartx.length]);
+      if (end == start) {
+        return;
+      }
+      let bufferAndStart = io._ensureFastAndSerializableByteData(buffer, start, end);
+      let result = this[_ops].writeFrom(ListOfint()._check(bufferAndStart.buffer), bufferAndStart.start, dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("writeFrom failed", this.path, result));
+      }
+      this[_resourceInfo].addWrite(dart.notNull(end) - (dart.notNull(start) - dart.notNull(bufferAndStart.start)));
+    }
+    writeString(string, opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      if (!convert.Encoding.is(encoding)) {
+        dart.throw(new core.ArgumentError(encoding));
+      }
+      let data = encoding.encode(string);
+      return this.writeFrom(data, 0, data[dartx.length]);
+    }
+    writeStringSync(string, opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      if (!convert.Encoding.is(encoding)) {
+        dart.throw(new core.ArgumentError(encoding));
+      }
+      let data = encoding.encode(string);
+      this.writeFromSync(data, 0, data[dartx.length]);
+    }
+    position() {
+      return this[_dispatch](io._FILE_POSITION, [null]).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "position failed", this.path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    positionSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].position();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("position failed", this.path, result));
+      }
+      return core.int._check(result);
+    }
+    setPosition(position) {
+      return this[_dispatch](io._FILE_SET_POSITION, JSArrayOfint().of([null, position])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "setPosition failed", this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    setPositionSync(position) {
+      this[_checkAvailable]();
+      let result = this[_ops].setPosition(position);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("setPosition failed", this.path, result));
+      }
+    }
+    truncate(length) {
+      return this[_dispatch](io._FILE_TRUNCATE, JSArrayOfint().of([null, length])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "truncate failed", this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    truncateSync(length) {
+      this[_checkAvailable]();
+      let result = this[_ops].truncate(length);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("truncate failed", this.path, result));
+      }
+    }
+    length() {
+      return this[_dispatch](io._FILE_LENGTH, [null]).then(core.int)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "length failed", this.path));
+        }
+        return FutureOrOfint()._check(response);
+      }, dynamicToFutureOrOfint()));
+    }
+    lengthSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].length();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("length failed", this.path, result));
+      }
+      return core.int._check(result);
+    }
+    flush() {
+      return this[_dispatch](io._FILE_FLUSH, [null]).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, "flush failed", this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    flushSync() {
+      this[_checkAvailable]();
+      let result = this[_ops].flush();
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException("flush failed", this.path, result));
+      }
+    }
+    lock(mode, start, end) {
+      if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      if (!io.FileLock.is(mode) || !(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
+        dart.throw(new core.ArgumentError());
+      }
+      let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+      return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, lock, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, 'lock failed', this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    unlock(start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      if (!(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (start == end) {
+        dart.throw(new core.ArgumentError());
+      }
+      return this[_dispatch](io._FILE_LOCK, JSArrayOfint().of([null, io._RandomAccessFile.LOCK_UNLOCK, start, end])).then(io._RandomAccessFile)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          dart.throw(io._exceptionFromResponse(response, 'unlock failed', this.path));
+        }
+        return this;
+      }, dynamicTo_RandomAccessFile()));
+    }
+    lockSync(mode, start, end) {
+      if (mode === void 0) mode = io.FileLock.EXCLUSIVE;
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      this[_checkAvailable]();
+      if (!io.FileLock.is(mode) || !(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (dart.notNull(start) < 0 || dart.notNull(end) < -1 || end != -1 && dart.notNull(start) >= dart.notNull(end)) {
+        dart.throw(new core.ArgumentError());
+      }
+      let lock = dart.equals(mode, io.FileLock.EXCLUSIVE) ? io._RandomAccessFile.LOCK_EXCLUSIVE : io._RandomAccessFile.LOCK_SHARED;
+      let result = this[_ops].lock(lock, start, end);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException('lock failed', this.path, result));
+      }
+    }
+    unlockSync(start, end) {
+      if (start === void 0) start = 0;
+      if (end === void 0) end = -1;
+      this[_checkAvailable]();
+      if (!(typeof start == 'number') || !(typeof end == 'number')) {
+        dart.throw(new core.ArgumentError());
+      }
+      if (start == end) {
+        dart.throw(new core.ArgumentError());
+      }
+      let result = this[_ops].lock(io._RandomAccessFile.LOCK_UNLOCK, start, end);
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException('unlock failed', this.path, result));
+      }
+    }
+    [_pointer]() {
+      return this[_ops].getPointer();
+    }
+    [_dispatch](request, data, opts) {
+      let markClosed = opts && 'markClosed' in opts ? opts.markClosed : false;
+      if (dart.test(this.closed)) {
+        return async.Future.error(new io.FileSystemException("File closed", this.path));
+      }
+      if (dart.test(this[_asyncDispatched])) {
+        let msg = "An async operation is currently pending";
+        return async.Future.error(new io.FileSystemException(msg, this.path));
+      }
+      if (dart.test(markClosed)) {
+        this.closed = true;
+      }
+      this[_asyncDispatched] = true;
+      data[dartx._set](0, this[_pointer]());
+      return io._IOService._dispatch(request, data).whenComplete(dart.fn(() => {
+        this[_asyncDispatched] = false;
+      }, VoidToNull()));
+    }
+    [_checkAvailable]() {
+      if (dart.test(this[_asyncDispatched])) {
+        dart.throw(new io.FileSystemException("An async operation is currently pending", this.path));
+      }
+      if (dart.test(this.closed)) {
+        dart.throw(new io.FileSystemException("File closed", this.path));
+      }
+    }
+  };
+  io._RandomAccessFile[dart.implements] = () => [io.RandomAccessFile];
+  dart.setSignature(io._RandomAccessFile, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RandomAccessFile, [core.int, core.String])}),
+    fields: () => ({
+      path: core.String,
+      [_asyncDispatched]: core.bool,
+      [_fileService]: isolate.SendPort,
+      [_resourceInfo]: io._FileResourceInfo,
+      [_ops]: io._RandomAccessFileOps,
+      closed: core.bool
+    }),
+    methods: () => ({
+      [_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
+      [_maybeConnectHandler]: dart.definiteFunctionType(dart.dynamic, []),
+      close: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
+      closeSync: dart.definiteFunctionType(dart.void, []),
+      readByte: dart.definiteFunctionType(async.Future$(core.int), []),
+      readByteSync: dart.definiteFunctionType(core.int, []),
+      read: dart.definiteFunctionType(async.Future$(core.List$(core.int)), [core.int]),
+      readSync: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+      readInto: dart.definiteFunctionType(async.Future$(core.int), [ListOfint()], [core.int, core.int]),
+      readIntoSync: dart.definiteFunctionType(core.int, [ListOfint()], [core.int, core.int]),
+      writeByte: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+      writeByteSync: dart.definiteFunctionType(core.int, [core.int]),
+      writeFrom: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [ListOfint()], [core.int, core.int]),
+      writeFromSync: dart.definiteFunctionType(dart.void, [ListOfint()], [core.int, core.int]),
+      writeString: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.String], {encoding: convert.Encoding}),
+      writeStringSync: dart.definiteFunctionType(dart.void, [core.String], {encoding: convert.Encoding}),
+      position: dart.definiteFunctionType(async.Future$(core.int), []),
+      positionSync: dart.definiteFunctionType(core.int, []),
+      setPosition: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+      setPositionSync: dart.definiteFunctionType(dart.void, [core.int]),
+      truncate: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [core.int]),
+      truncateSync: dart.definiteFunctionType(dart.void, [core.int]),
+      length: dart.definiteFunctionType(async.Future$(core.int), []),
+      lengthSync: dart.definiteFunctionType(core.int, []),
+      flush: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), []),
+      flushSync: dart.definiteFunctionType(dart.void, []),
+      lock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [io.FileLock, core.int, core.int]),
+      unlock: dart.definiteFunctionType(async.Future$(io.RandomAccessFile), [], [core.int, core.int]),
+      lockSync: dart.definiteFunctionType(dart.void, [], [io.FileLock, core.int, core.int]),
+      unlockSync: dart.definiteFunctionType(dart.void, [], [core.int, core.int]),
+      [_pointer]: dart.definiteFunctionType(core.int, []),
+      [_dispatch]: dart.definiteFunctionType(async.Future, [core.int, core.List], {markClosed: core.bool}),
+      [_checkAvailable]: dart.definiteFunctionType(dart.void, [])
+    }),
+    sfields: () => ({
+      _connectedResourceHandler: core.bool,
+      LOCK_UNLOCK: core.int,
+      LOCK_SHARED: core.int,
+      LOCK_EXCLUSIVE: core.int
+    })
+  });
+  io._RandomAccessFile._connectedResourceHandler = false;
+  io._RandomAccessFile.LOCK_UNLOCK = 0;
+  io._RandomAccessFile.LOCK_SHARED = 1;
+  io._RandomAccessFile.LOCK_EXCLUSIVE = 2;
+  let const$56;
+  io.FileSystemEntityType = class FileSystemEntityType extends core.Object {
+    _internal(type) {
+      this[_type] = type;
+    }
+    static _lookup(type) {
+      return io.FileSystemEntityType._typeList[dartx._get](type);
+    }
+    toString() {
+      return (const$56 || (const$56 = dart.constList(['FILE', 'DIRECTORY', 'LINK', 'NOT_FOUND'], core.String)))[dartx._get](this[_type]);
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemEntityType, '_internal');
+  dart.setSignature(io.FileSystemEntityType, {
+    constructors: () => ({_internal: dart.definiteFunctionType(io.FileSystemEntityType, [core.int])}),
+    fields: () => ({[_type]: core.int}),
+    sfields: () => ({
+      FILE: io.FileSystemEntityType,
+      DIRECTORY: io.FileSystemEntityType,
+      LINK: io.FileSystemEntityType,
+      NOT_FOUND: io.FileSystemEntityType,
+      _typeList: ListOfFileSystemEntityType()
+    }),
+    statics: () => ({_lookup: dart.definiteFunctionType(io.FileSystemEntityType, [core.int])}),
+    names: ['_lookup']
+  });
+  dart.defineLazy(io.FileSystemEntityType, {
+    get FILE() {
+      return dart.const(new io.FileSystemEntityType._internal(0));
+    },
+    get DIRECTORY() {
+      return dart.const(new io.FileSystemEntityType._internal(1));
+    },
+    get LINK() {
+      return dart.const(new io.FileSystemEntityType._internal(2));
+    },
+    get NOT_FOUND() {
+      return dart.const(new io.FileSystemEntityType._internal(3));
+    },
+    get _typeList() {
+      return dart.constList([io.FileSystemEntityType.FILE, io.FileSystemEntityType.DIRECTORY, io.FileSystemEntityType.LINK, io.FileSystemEntityType.NOT_FOUND], io.FileSystemEntityType);
+    }
+  });
+  let const$57;
+  io.FileStat = class FileStat extends core.Object {
+    _internal(changed, modified, accessed, type, mode, size) {
+      this.changed = changed;
+      this.modified = modified;
+      this.accessed = accessed;
+      this.type = type;
+      this.mode = mode;
+      this.size = size;
+    }
+    _internalNotFound() {
+      this.changed = null;
+      this.modified = null;
+      this.accessed = null;
+      this.type = io.FileSystemEntityType.NOT_FOUND;
+      this.mode = 0;
+      this.size = -1;
+    }
+    static _statSync(path) {
+      dart.throw(new core.UnsupportedError("FileStat.stat"));
+    }
+    static statSync(path) {
+      if (dart.test(io.Platform.isWindows)) {
+        path = io.FileSystemEntity._trimTrailingPathSeparators(path);
+      }
+      let data = io.FileStat._statSync(path);
+      if (io.OSError.is(data)) return io.FileStat._notFound;
+      return new io.FileStat._internal(new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._CHANGED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._MODIFIED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(dart.dindex(data, io.FileStat._ACCESSED_TIME))), io.FileSystemEntityType._lookup(core.int._check(dart.dindex(data, io.FileStat._TYPE))), core.int._check(dart.dindex(data, io.FileStat._MODE)), core.int._check(dart.dindex(data, io.FileStat._SIZE)));
+    }
+    static stat(path) {
+      if (dart.test(io.Platform.isWindows)) {
+        path = io.FileSystemEntity._trimTrailingPathSeparators(path);
+      }
+      return io._IOService._dispatch(io._FILE_STAT, JSArrayOfString().of([path])).then(io.FileStat)(dart.fn(response => {
+        if (dart.test(io._isErrorResponse(response))) {
+          return io.FileStat._notFound;
+        }
+        let data = core.List._check(dart.dindex(response, 1));
+        return new io.FileStat._internal(new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._CHANGED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._MODIFIED_TIME))), new core.DateTime.fromMillisecondsSinceEpoch(core.int._check(data[dartx._get](io.FileStat._ACCESSED_TIME))), io.FileSystemEntityType._lookup(core.int._check(data[dartx._get](io.FileStat._TYPE))), core.int._check(data[dartx._get](io.FileStat._MODE)), core.int._check(data[dartx._get](io.FileStat._SIZE)));
+      }, dynamicToFileStat()));
+    }
+    toString() {
+      return dart.str`FileStat: type ${this.type}\n          changed ${this.changed}\n          modified ${this.modified}\n          accessed ${this.accessed}\n          mode ${this.modeString()}\n          size ${this.size}`;
+    }
+    modeString() {
+      let permissions = dart.notNull(this.mode) & 4095;
+      let codes = const$57 || (const$57 = dart.constList(['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'], core.String));
+      let result = [];
+      if ((permissions & 2048) != 0) result[dartx.add]("(suid) ");
+      if ((permissions & 1024) != 0) result[dartx.add]("(guid) ");
+      if ((permissions & 512) != 0) result[dartx.add]("(sticky) ");
+      result[dartx.add](codes[dartx._get](permissions >> 6 & 7));
+      result[dartx.add](codes[dartx._get](permissions >> 3 & 7));
+      result[dartx.add](codes[dartx._get](permissions & 7));
+      return result[dartx.join]();
+    }
+  };
+  dart.defineNamedConstructor(io.FileStat, '_internal');
+  dart.defineNamedConstructor(io.FileStat, '_internalNotFound');
+  dart.setSignature(io.FileStat, {
+    constructors: () => ({
+      _internal: dart.definiteFunctionType(io.FileStat, [core.DateTime, core.DateTime, core.DateTime, io.FileSystemEntityType, core.int, core.int]),
+      _internalNotFound: dart.definiteFunctionType(io.FileStat, [])
+    }),
+    fields: () => ({
+      changed: core.DateTime,
+      modified: core.DateTime,
+      accessed: core.DateTime,
+      type: io.FileSystemEntityType,
+      mode: core.int,
+      size: core.int
+    }),
+    methods: () => ({modeString: dart.definiteFunctionType(core.String, [])}),
+    sfields: () => ({
+      _TYPE: core.int,
+      _CHANGED_TIME: core.int,
+      _MODIFIED_TIME: core.int,
+      _ACCESSED_TIME: core.int,
+      _MODE: core.int,
+      _SIZE: core.int,
+      _notFound: io.FileStat
+    }),
+    statics: () => ({
+      _statSync: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      statSync: dart.definiteFunctionType(io.FileStat, [core.String]),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), [core.String])
+    }),
+    names: ['_statSync', 'statSync', 'stat']
+  });
+  io.FileStat._TYPE = 0;
+  io.FileStat._CHANGED_TIME = 1;
+  io.FileStat._MODIFIED_TIME = 2;
+  io.FileStat._ACCESSED_TIME = 3;
+  io.FileStat._MODE = 4;
+  io.FileStat._SIZE = 5;
+  dart.defineLazy(io.FileStat, {
+    get _notFound() {
+      return dart.const(new io.FileStat._internalNotFound());
+    }
+  });
+  io.FileSystemEvent = class FileSystemEvent extends core.Object {
+    _(type, path, isDirectory) {
+      this.type = type;
+      this.path = path;
+      this.isDirectory = isDirectory;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemEvent, '_');
+  dart.setSignature(io.FileSystemEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemEvent, [core.int, core.String, core.bool])}),
+    fields: () => ({
+      type: core.int,
+      path: core.String,
+      isDirectory: core.bool
+    }),
+    sfields: () => ({
+      CREATE: core.int,
+      MODIFY: core.int,
+      DELETE: core.int,
+      MOVE: core.int,
+      ALL: core.int,
+      _MODIFY_ATTRIBUTES: core.int,
+      _DELETE_SELF: core.int,
+      _IS_DIR: core.int
+    })
+  });
+  io.FileSystemEvent.CREATE = 1 << 0;
+  io.FileSystemEvent.MODIFY = 1 << 1;
+  io.FileSystemEvent.DELETE = 1 << 2;
+  io.FileSystemEvent.MOVE = 1 << 3;
+  io.FileSystemEvent._MODIFY_ATTRIBUTES = 1 << 4;
+  io.FileSystemEvent._DELETE_SELF = 1 << 5;
+  io.FileSystemEvent._IS_DIR = 1 << 6;
+  dart.defineLazy(io.FileSystemEvent, {
+    get ALL() {
+      return io.FileSystemEvent.CREATE | io.FileSystemEvent.MODIFY | io.FileSystemEvent.DELETE | io.FileSystemEvent.MOVE;
+    }
+  });
+  io.FileSystemCreateEvent = class FileSystemCreateEvent extends io.FileSystemEvent {
+    _(path, isDirectory) {
+      super._(io.FileSystemEvent.CREATE, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      return dart.str`FileSystemCreateEvent('${this.path}')`;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemCreateEvent, '_');
+  dart.setSignature(io.FileSystemCreateEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemCreateEvent, [dart.dynamic, dart.dynamic])})
+  });
+  io.FileSystemModifyEvent = class FileSystemModifyEvent extends io.FileSystemEvent {
+    _(path, isDirectory, contentChanged) {
+      this.contentChanged = contentChanged;
+      super._(io.FileSystemEvent.MODIFY, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      return dart.str`FileSystemModifyEvent('${this.path}', contentChanged=${this.contentChanged})`;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemModifyEvent, '_');
+  dart.setSignature(io.FileSystemModifyEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemModifyEvent, [dart.dynamic, dart.dynamic, core.bool])}),
+    fields: () => ({contentChanged: core.bool})
+  });
+  io.FileSystemDeleteEvent = class FileSystemDeleteEvent extends io.FileSystemEvent {
+    _(path, isDirectory) {
+      super._(io.FileSystemEvent.DELETE, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      return dart.str`FileSystemDeleteEvent('${this.path}')`;
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemDeleteEvent, '_');
+  dart.setSignature(io.FileSystemDeleteEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemDeleteEvent, [dart.dynamic, dart.dynamic])})
+  });
+  io.FileSystemMoveEvent = class FileSystemMoveEvent extends io.FileSystemEvent {
+    _(path, isDirectory, destination) {
+      this.destination = destination;
+      super._(io.FileSystemEvent.MOVE, core.String._check(path), core.bool._check(isDirectory));
+    }
+    toString() {
+      let buffer = new core.StringBuffer();
+      buffer.write(dart.str`FileSystemMoveEvent('${this.path}'`);
+      if (this.destination != null) buffer.write(dart.str`, '${this.destination}'`);
+      buffer.write(')');
+      return buffer.toString();
+    }
+  };
+  dart.defineNamedConstructor(io.FileSystemMoveEvent, '_');
+  dart.setSignature(io.FileSystemMoveEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.FileSystemMoveEvent, [dart.dynamic, dart.dynamic, core.String])}),
+    fields: () => ({destination: core.String})
+  });
+  io._FileSystemWatcher = class _FileSystemWatcher extends core.Object {
+    static _watch(path, events, recursive) {
+      dart.throw(new core.UnsupportedError("_FileSystemWatcher.watch"));
+    }
+    static get isSupported() {
+      dart.throw(new core.UnsupportedError("_FileSystemWatcher.isSupported"));
+    }
+  };
+  dart.setSignature(io._FileSystemWatcher, {
+    sgetters: () => ({isSupported: dart.definiteFunctionType(core.bool, [])}),
+    statics: () => ({_watch: dart.definiteFunctionType(async.Stream$(io.FileSystemEvent), [core.String, core.int, core.bool])}),
+    names: ['_watch']
+  });
+  io.HttpStatus = class HttpStatus extends core.Object {};
+  dart.setSignature(io.HttpStatus, {
+    sfields: () => ({
+      CONTINUE: core.int,
+      SWITCHING_PROTOCOLS: core.int,
+      OK: core.int,
+      CREATED: core.int,
+      ACCEPTED: core.int,
+      NON_AUTHORITATIVE_INFORMATION: core.int,
+      NO_CONTENT: core.int,
+      RESET_CONTENT: core.int,
+      PARTIAL_CONTENT: core.int,
+      MULTIPLE_CHOICES: core.int,
+      MOVED_PERMANENTLY: core.int,
+      FOUND: core.int,
+      MOVED_TEMPORARILY: core.int,
+      SEE_OTHER: core.int,
+      NOT_MODIFIED: core.int,
+      USE_PROXY: core.int,
+      TEMPORARY_REDIRECT: core.int,
+      BAD_REQUEST: core.int,
+      UNAUTHORIZED: core.int,
+      PAYMENT_REQUIRED: core.int,
+      FORBIDDEN: core.int,
+      NOT_FOUND: core.int,
+      METHOD_NOT_ALLOWED: core.int,
+      NOT_ACCEPTABLE: core.int,
+      PROXY_AUTHENTICATION_REQUIRED: core.int,
+      REQUEST_TIMEOUT: core.int,
+      CONFLICT: core.int,
+      GONE: core.int,
+      LENGTH_REQUIRED: core.int,
+      PRECONDITION_FAILED: core.int,
+      REQUEST_ENTITY_TOO_LARGE: core.int,
+      REQUEST_URI_TOO_LONG: core.int,
+      UNSUPPORTED_MEDIA_TYPE: core.int,
+      REQUESTED_RANGE_NOT_SATISFIABLE: core.int,
+      EXPECTATION_FAILED: core.int,
+      INTERNAL_SERVER_ERROR: core.int,
+      NOT_IMPLEMENTED: core.int,
+      BAD_GATEWAY: core.int,
+      SERVICE_UNAVAILABLE: core.int,
+      GATEWAY_TIMEOUT: core.int,
+      HTTP_VERSION_NOT_SUPPORTED: core.int,
+      NETWORK_CONNECT_TIMEOUT_ERROR: core.int
+    })
+  });
+  io.HttpStatus.CONTINUE = 100;
+  io.HttpStatus.SWITCHING_PROTOCOLS = 101;
+  io.HttpStatus.OK = 200;
+  io.HttpStatus.CREATED = 201;
+  io.HttpStatus.ACCEPTED = 202;
+  io.HttpStatus.NON_AUTHORITATIVE_INFORMATION = 203;
+  io.HttpStatus.NO_CONTENT = 204;
+  io.HttpStatus.RESET_CONTENT = 205;
+  io.HttpStatus.PARTIAL_CONTENT = 206;
+  io.HttpStatus.MULTIPLE_CHOICES = 300;
+  io.HttpStatus.MOVED_PERMANENTLY = 301;
+  io.HttpStatus.FOUND = 302;
+  io.HttpStatus.MOVED_TEMPORARILY = 302;
+  io.HttpStatus.SEE_OTHER = 303;
+  io.HttpStatus.NOT_MODIFIED = 304;
+  io.HttpStatus.USE_PROXY = 305;
+  io.HttpStatus.TEMPORARY_REDIRECT = 307;
+  io.HttpStatus.BAD_REQUEST = 400;
+  io.HttpStatus.UNAUTHORIZED = 401;
+  io.HttpStatus.PAYMENT_REQUIRED = 402;
+  io.HttpStatus.FORBIDDEN = 403;
+  io.HttpStatus.NOT_FOUND = 404;
+  io.HttpStatus.METHOD_NOT_ALLOWED = 405;
+  io.HttpStatus.NOT_ACCEPTABLE = 406;
+  io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED = 407;
+  io.HttpStatus.REQUEST_TIMEOUT = 408;
+  io.HttpStatus.CONFLICT = 409;
+  io.HttpStatus.GONE = 410;
+  io.HttpStatus.LENGTH_REQUIRED = 411;
+  io.HttpStatus.PRECONDITION_FAILED = 412;
+  io.HttpStatus.REQUEST_ENTITY_TOO_LARGE = 413;
+  io.HttpStatus.REQUEST_URI_TOO_LONG = 414;
+  io.HttpStatus.UNSUPPORTED_MEDIA_TYPE = 415;
+  io.HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE = 416;
+  io.HttpStatus.EXPECTATION_FAILED = 417;
+  io.HttpStatus.INTERNAL_SERVER_ERROR = 500;
+  io.HttpStatus.NOT_IMPLEMENTED = 501;
+  io.HttpStatus.BAD_GATEWAY = 502;
+  io.HttpStatus.SERVICE_UNAVAILABLE = 503;
+  io.HttpStatus.GATEWAY_TIMEOUT = 504;
+  io.HttpStatus.HTTP_VERSION_NOT_SUPPORTED = 505;
+  io.HttpStatus.NETWORK_CONNECT_TIMEOUT_ERROR = 599;
+  io.HttpServer = class HttpServer extends core.Object {
+    static bind(address, port, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io._HttpServer.bind(address, port, backlog, v6Only, shared);
+    }
+    static bindSecure(address, port, context, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io._HttpServer.bindSecure(address, port, context, backlog, v6Only, requestClientCertificate, shared);
+    }
+    static listenOn(serverSocket) {
+      return new io._HttpServer.listenOn(serverSocket);
+    }
+  };
+  io.HttpServer[dart.implements] = () => [StreamOfHttpRequest()];
+  dart.setSignature(io.HttpServer, {
+    constructors: () => ({listenOn: dart.definiteFunctionType(io.HttpServer, [io.ServerSocket])}),
+    fields: () => ({
+      serverHeader: core.String,
+      autoCompress: core.bool,
+      idleTimeout: core.Duration
+    }),
+    statics: () => ({
+      bind: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool}),
+      bindSecure: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, shared: core.bool})
+    }),
+    names: ['bind', 'bindSecure']
+  });
+  io.HttpConnectionsInfo = class HttpConnectionsInfo extends core.Object {
+    new() {
+      this.total = 0;
+      this.active = 0;
+      this.idle = 0;
+      this.closing = 0;
+    }
+  };
+  dart.setSignature(io.HttpConnectionsInfo, {
+    fields: () => ({
+      total: core.int,
+      active: core.int,
+      idle: core.int,
+      closing: core.int
+    })
+  });
+  io.HttpHeaders = class HttpHeaders extends core.Object {
+    new() {
+      this.date = null;
+      this.expires = null;
+      this.ifModifiedSince = null;
+      this.host = null;
+      this.port = null;
+      this.contentType = null;
+      this.contentLength = null;
+      this.persistentConnection = null;
+      this.chunkedTransferEncoding = null;
+    }
+  };
+  dart.setSignature(io.HttpHeaders, {
+    fields: () => ({
+      date: core.DateTime,
+      expires: core.DateTime,
+      ifModifiedSince: core.DateTime,
+      host: core.String,
+      port: core.int,
+      contentType: io.ContentType,
+      contentLength: core.int,
+      persistentConnection: core.bool,
+      chunkedTransferEncoding: core.bool
+    }),
+    sfields: () => ({
+      ACCEPT: core.String,
+      ACCEPT_CHARSET: core.String,
+      ACCEPT_ENCODING: core.String,
+      ACCEPT_LANGUAGE: core.String,
+      ACCEPT_RANGES: core.String,
+      AGE: core.String,
+      ALLOW: core.String,
+      AUTHORIZATION: core.String,
+      CACHE_CONTROL: core.String,
+      CONNECTION: core.String,
+      CONTENT_ENCODING: core.String,
+      CONTENT_LANGUAGE: core.String,
+      CONTENT_LENGTH: core.String,
+      CONTENT_LOCATION: core.String,
+      CONTENT_MD5: core.String,
+      CONTENT_RANGE: core.String,
+      CONTENT_TYPE: core.String,
+      DATE: core.String,
+      ETAG: core.String,
+      EXPECT: core.String,
+      EXPIRES: core.String,
+      FROM: core.String,
+      HOST: core.String,
+      IF_MATCH: core.String,
+      IF_MODIFIED_SINCE: core.String,
+      IF_NONE_MATCH: core.String,
+      IF_RANGE: core.String,
+      IF_UNMODIFIED_SINCE: core.String,
+      LAST_MODIFIED: core.String,
+      LOCATION: core.String,
+      MAX_FORWARDS: core.String,
+      PRAGMA: core.String,
+      PROXY_AUTHENTICATE: core.String,
+      PROXY_AUTHORIZATION: core.String,
+      RANGE: core.String,
+      REFERER: core.String,
+      RETRY_AFTER: core.String,
+      SERVER: core.String,
+      TE: core.String,
+      TRAILER: core.String,
+      TRANSFER_ENCODING: core.String,
+      UPGRADE: core.String,
+      USER_AGENT: core.String,
+      VARY: core.String,
+      VIA: core.String,
+      WARNING: core.String,
+      WWW_AUTHENTICATE: core.String,
+      COOKIE: core.String,
+      SET_COOKIE: core.String,
+      GENERAL_HEADERS: ListOfString(),
+      ENTITY_HEADERS: ListOfString(),
+      RESPONSE_HEADERS: ListOfString(),
+      REQUEST_HEADERS: ListOfString()
+    })
+  });
+  io.HttpHeaders.ACCEPT = "accept";
+  io.HttpHeaders.ACCEPT_CHARSET = "accept-charset";
+  io.HttpHeaders.ACCEPT_ENCODING = "accept-encoding";
+  io.HttpHeaders.ACCEPT_LANGUAGE = "accept-language";
+  io.HttpHeaders.ACCEPT_RANGES = "accept-ranges";
+  io.HttpHeaders.AGE = "age";
+  io.HttpHeaders.ALLOW = "allow";
+  io.HttpHeaders.AUTHORIZATION = "authorization";
+  io.HttpHeaders.CACHE_CONTROL = "cache-control";
+  io.HttpHeaders.CONNECTION = "connection";
+  io.HttpHeaders.CONTENT_ENCODING = "content-encoding";
+  io.HttpHeaders.CONTENT_LANGUAGE = "content-language";
+  io.HttpHeaders.CONTENT_LENGTH = "content-length";
+  io.HttpHeaders.CONTENT_LOCATION = "content-location";
+  io.HttpHeaders.CONTENT_MD5 = "content-md5";
+  io.HttpHeaders.CONTENT_RANGE = "content-range";
+  io.HttpHeaders.CONTENT_TYPE = "content-type";
+  io.HttpHeaders.DATE = "date";
+  io.HttpHeaders.ETAG = "etag";
+  io.HttpHeaders.EXPECT = "expect";
+  io.HttpHeaders.EXPIRES = "expires";
+  io.HttpHeaders.FROM = "from";
+  io.HttpHeaders.HOST = "host";
+  io.HttpHeaders.IF_MATCH = "if-match";
+  io.HttpHeaders.IF_MODIFIED_SINCE = "if-modified-since";
+  io.HttpHeaders.IF_NONE_MATCH = "if-none-match";
+  io.HttpHeaders.IF_RANGE = "if-range";
+  io.HttpHeaders.IF_UNMODIFIED_SINCE = "if-unmodified-since";
+  io.HttpHeaders.LAST_MODIFIED = "last-modified";
+  io.HttpHeaders.LOCATION = "location";
+  io.HttpHeaders.MAX_FORWARDS = "max-forwards";
+  io.HttpHeaders.PRAGMA = "pragma";
+  io.HttpHeaders.PROXY_AUTHENTICATE = "proxy-authenticate";
+  io.HttpHeaders.PROXY_AUTHORIZATION = "proxy-authorization";
+  io.HttpHeaders.RANGE = "range";
+  io.HttpHeaders.REFERER = "referer";
+  io.HttpHeaders.RETRY_AFTER = "retry-after";
+  io.HttpHeaders.SERVER = "server";
+  io.HttpHeaders.TE = "te";
+  io.HttpHeaders.TRAILER = "trailer";
+  io.HttpHeaders.TRANSFER_ENCODING = "transfer-encoding";
+  io.HttpHeaders.UPGRADE = "upgrade";
+  io.HttpHeaders.USER_AGENT = "user-agent";
+  io.HttpHeaders.VARY = "vary";
+  io.HttpHeaders.VIA = "via";
+  io.HttpHeaders.WARNING = "warning";
+  io.HttpHeaders.WWW_AUTHENTICATE = "www-authenticate";
+  io.HttpHeaders.COOKIE = "cookie";
+  io.HttpHeaders.SET_COOKIE = "set-cookie";
+  dart.defineLazy(io.HttpHeaders, {
+    get GENERAL_HEADERS() {
+      return dart.constList([io.HttpHeaders.CACHE_CONTROL, io.HttpHeaders.CONNECTION, io.HttpHeaders.DATE, io.HttpHeaders.PRAGMA, io.HttpHeaders.TRAILER, io.HttpHeaders.TRANSFER_ENCODING, io.HttpHeaders.UPGRADE, io.HttpHeaders.VIA, io.HttpHeaders.WARNING], core.String);
+    },
+    get ENTITY_HEADERS() {
+      return dart.constList([io.HttpHeaders.ALLOW, io.HttpHeaders.CONTENT_ENCODING, io.HttpHeaders.CONTENT_LANGUAGE, io.HttpHeaders.CONTENT_LENGTH, io.HttpHeaders.CONTENT_LOCATION, io.HttpHeaders.CONTENT_MD5, io.HttpHeaders.CONTENT_RANGE, io.HttpHeaders.CONTENT_TYPE, io.HttpHeaders.EXPIRES, io.HttpHeaders.LAST_MODIFIED], core.String);
+    },
+    get RESPONSE_HEADERS() {
+      return dart.constList([io.HttpHeaders.ACCEPT_RANGES, io.HttpHeaders.AGE, io.HttpHeaders.ETAG, io.HttpHeaders.LOCATION, io.HttpHeaders.PROXY_AUTHENTICATE, io.HttpHeaders.RETRY_AFTER, io.HttpHeaders.SERVER, io.HttpHeaders.VARY, io.HttpHeaders.WWW_AUTHENTICATE], core.String);
+    },
+    get REQUEST_HEADERS() {
+      return dart.constList([io.HttpHeaders.ACCEPT, io.HttpHeaders.ACCEPT_CHARSET, io.HttpHeaders.ACCEPT_ENCODING, io.HttpHeaders.ACCEPT_LANGUAGE, io.HttpHeaders.AUTHORIZATION, io.HttpHeaders.EXPECT, io.HttpHeaders.FROM, io.HttpHeaders.HOST, io.HttpHeaders.IF_MATCH, io.HttpHeaders.IF_MODIFIED_SINCE, io.HttpHeaders.IF_NONE_MATCH, io.HttpHeaders.IF_RANGE, io.HttpHeaders.IF_UNMODIFIED_SINCE, io.HttpHeaders.MAX_FORWARDS, io.HttpHeaders.PROXY_AUTHORIZATION, io.HttpHeaders.RANGE, io.HttpHeaders.REFERER, io.HttpHeaders.TE, io.HttpHeaders.USER_AGENT], core.String);
+    }
+  });
+  io.HeaderValue = class HeaderValue extends core.Object {
+    static new(value, parameters) {
+      if (value === void 0) value = "";
+      if (parameters === void 0) parameters = null;
+      return new io._HeaderValue(value, parameters);
+    }
+    static parse(value, opts) {
+      let parameterSeparator = opts && 'parameterSeparator' in opts ? opts.parameterSeparator : ";";
+      let valueSeparator = opts && 'valueSeparator' in opts ? opts.valueSeparator : null;
+      let preserveBackslash = opts && 'preserveBackslash' in opts ? opts.preserveBackslash : false;
+      return io._HeaderValue.parse(value, {parameterSeparator: parameterSeparator, valueSeparator: valueSeparator, preserveBackslash: preserveBackslash});
+    }
+  };
+  dart.setSignature(io.HeaderValue, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HeaderValue, [], [core.String, MapOfString$String()])}),
+    statics: () => ({parse: dart.definiteFunctionType(io.HeaderValue, [core.String], {parameterSeparator: core.String, valueSeparator: core.String, preserveBackslash: core.bool})}),
+    names: ['parse']
+  });
+  io.HttpSession = class HttpSession extends core.Object {};
+  io.HttpSession[dart.implements] = () => [core.Map];
+  io.ContentType = class ContentType extends core.Object {
+    static new(primaryType, subType, opts) {
+      let charset = opts && 'charset' in opts ? opts.charset : null;
+      let parameters = opts && 'parameters' in opts ? opts.parameters : null;
+      return new io._ContentType(primaryType, subType, charset, parameters);
+    }
+    static parse(value) {
+      return io._ContentType.parse(value);
+    }
+  };
+  io.ContentType[dart.implements] = () => [io.HeaderValue];
+  dart.setSignature(io.ContentType, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ContentType, [core.String, core.String], {charset: core.String, parameters: MapOfString$String()})}),
+    sfields: () => ({
+      TEXT: io.ContentType,
+      HTML: io.ContentType,
+      JSON: io.ContentType,
+      BINARY: io.ContentType
+    }),
+    statics: () => ({parse: dart.definiteFunctionType(io.ContentType, [core.String])}),
+    names: ['parse']
+  });
+  dart.defineLazy(io.ContentType, {
+    get TEXT() {
+      return io.ContentType.new("text", "plain", {charset: "utf-8"});
+    },
+    get HTML() {
+      return io.ContentType.new("text", "html", {charset: "utf-8"});
+    },
+    get JSON() {
+      return io.ContentType.new("application", "json", {charset: "utf-8"});
+    },
+    get BINARY() {
+      return io.ContentType.new("application", "octet-stream");
+    }
+  });
+  io.Cookie = class Cookie extends core.Object {
+    static new(name, value) {
+      if (name === void 0) name = null;
+      if (value === void 0) value = null;
+      return new io._Cookie(name, value);
+    }
+    static fromSetCookieValue(value) {
+      return new io._Cookie.fromSetCookieValue(value);
+    }
+  };
+  dart.setSignature(io.Cookie, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.Cookie, [], [core.String, core.String]),
+      fromSetCookieValue: dart.definiteFunctionType(io.Cookie, [core.String])
+    }),
+    fields: () => ({
+      name: core.String,
+      value: core.String,
+      expires: core.DateTime,
+      maxAge: core.int,
+      domain: core.String,
+      path: core.String,
+      secure: core.bool,
+      httpOnly: core.bool
+    })
+  });
+  io.HttpRequest = class HttpRequest extends core.Object {};
+  io.HttpRequest[dart.implements] = () => [StreamOfListOfint()];
+  io.HttpResponse = class HttpResponse extends core.Object {
+    new() {
+      this.contentLength = null;
+      this.statusCode = null;
+      this.reasonPhrase = null;
+      this.persistentConnection = null;
+      this.deadline = null;
+      this.bufferOutput = null;
+    }
+  };
+  io.HttpResponse[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io.HttpResponse, {
+    fields: () => ({
+      contentLength: core.int,
+      statusCode: core.int,
+      reasonPhrase: core.String,
+      persistentConnection: core.bool,
+      deadline: core.Duration,
+      bufferOutput: core.bool
+    })
+  });
+  io.HttpClient = class HttpClient extends core.Object {
+    static new(opts) {
+      let context = opts && 'context' in opts ? opts.context : null;
+      return new io._HttpClient(context);
+    }
+    static findProxyFromEnvironment(url, opts) {
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      return io._HttpClient._findProxyFromEnvironment(url, environment);
+    }
+  };
+  dart.setSignature(io.HttpClient, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpClient, [], {context: io.SecurityContext})}),
+    fields: () => ({
+      idleTimeout: core.Duration,
+      maxConnectionsPerHost: core.int,
+      autoUncompress: core.bool,
+      userAgent: core.String
+    }),
+    sfields: () => ({
+      DEFAULT_HTTP_PORT: core.int,
+      DEFAULT_HTTPS_PORT: core.int
+    }),
+    statics: () => ({findProxyFromEnvironment: dart.definiteFunctionType(core.String, [core.Uri], {environment: MapOfString$String()})}),
+    names: ['findProxyFromEnvironment']
+  });
+  io.HttpClient.DEFAULT_HTTP_PORT = 80;
+  io.HttpClient.DEFAULT_HTTPS_PORT = 443;
+  io.HttpClientRequest = class HttpClientRequest extends core.Object {
+    new() {
+      this.persistentConnection = null;
+      this.followRedirects = null;
+      this.maxRedirects = null;
+      this.contentLength = null;
+      this.bufferOutput = null;
+    }
+  };
+  io.HttpClientRequest[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io.HttpClientRequest, {
+    fields: () => ({
+      persistentConnection: core.bool,
+      followRedirects: core.bool,
+      maxRedirects: core.int,
+      contentLength: core.int,
+      bufferOutput: core.bool
+    })
+  });
+  io.HttpClientResponse = class HttpClientResponse extends core.Object {};
+  io.HttpClientResponse[dart.implements] = () => [StreamOfListOfint()];
+  io.HttpClientCredentials = class HttpClientCredentials extends core.Object {};
+  io.HttpClientBasicCredentials = class HttpClientBasicCredentials extends io.HttpClientCredentials {
+    static new(username, password) {
+      return new io._HttpClientBasicCredentials(username, password);
+    }
+  };
+  dart.setSignature(io.HttpClientBasicCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpClientBasicCredentials, [core.String, core.String])})
+  });
+  io.HttpClientDigestCredentials = class HttpClientDigestCredentials extends io.HttpClientCredentials {
+    static new(username, password) {
+      return new io._HttpClientDigestCredentials(username, password);
+    }
+  };
+  dart.setSignature(io.HttpClientDigestCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpClientDigestCredentials, [core.String, core.String])})
+  });
+  io.HttpConnectionInfo = class HttpConnectionInfo extends core.Object {};
+  io.RedirectInfo = class RedirectInfo extends core.Object {};
+  io.DetachedSocket = class DetachedSocket extends core.Object {};
+  io.HttpException = class HttpException extends core.Object {
+    new(message, opts) {
+      let uri = opts && 'uri' in opts ? opts.uri : null;
+      this.message = message;
+      this.uri = uri;
+    }
+    toString() {
+      let b = new core.StringBuffer();
+      b.write('HttpException: ');
+      b.write(this.message);
+      if (this.uri != null) {
+        b.write(dart.str`, uri = ${this.uri}`);
+      }
+      return b.toString();
+    }
+  };
+  io.HttpException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.HttpException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HttpException, [core.String], {uri: core.Uri})}),
+    fields: () => ({
+      message: core.String,
+      uri: core.Uri
+    })
+  });
+  io.RedirectException = class RedirectException extends core.Object {
+    new(message, redirects) {
+      this.message = message;
+      this.redirects = redirects;
+    }
+    toString() {
+      return dart.str`RedirectException: ${this.message}`;
+    }
+    get uri() {
+      return this.redirects[dartx.last].location;
+    }
+  };
+  io.RedirectException[dart.implements] = () => [io.HttpException];
+  dart.setSignature(io.RedirectException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.RedirectException, [core.String, ListOfRedirectInfo()])}),
+    fields: () => ({
+      message: core.String,
+      redirects: ListOfRedirectInfo()
+    }),
+    getters: () => ({uri: dart.definiteFunctionType(core.Uri, [])})
+  });
+  let const$58;
+  let const$59;
+  let const$60;
+  let const$61;
+  let const$62;
+  let const$63;
+  let const$64;
+  let const$65;
+  let const$66;
+  io.HttpDate = class HttpDate extends core.Object {
+    static format(date) {
+      let wkday = const$58 || (const$58 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+      let month = const$59 || (const$59 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+      let d = date.toUtc();
+      let sb = new core.StringBuffer();
+      sb.write(wkday[dartx._get](dart.notNull(d.weekday) - 1));
+      sb.write(", ");
+      sb.write(dart.notNull(d.day) <= 9 ? "0" : "");
+      sb.write(dart.toString(d.day));
+      sb.write(" ");
+      sb.write(month[dartx._get](dart.notNull(d.month) - 1));
+      sb.write(" ");
+      sb.write(dart.toString(d.year));
+      sb.write(dart.notNull(d.hour) <= 9 ? " 0" : " ");
+      sb.write(dart.toString(d.hour));
+      sb.write(dart.notNull(d.minute) <= 9 ? ":0" : ":");
+      sb.write(dart.toString(d.minute));
+      sb.write(dart.notNull(d.second) <= 9 ? ":0" : ":");
+      sb.write(dart.toString(d.second));
+      sb.write(" GMT");
+      return sb.toString();
+    }
+    static parse(date) {
+      let SP = 32;
+      let wkdays = const$60 || (const$60 = dart.constList(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], core.String));
+      let weekdays = const$61 || (const$61 = dart.constList(["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], core.String));
+      let months = const$62 || (const$62 = dart.constList(["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], core.String));
+      let wkdaysLowerCase = const$63 || (const$63 = dart.constList(["mon", "tue", "wed", "thu", "fri", "sat", "sun"], core.String));
+      let weekdaysLowerCase = const$64 || (const$64 = dart.constList(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"], core.String));
+      let monthsLowerCase = const$65 || (const$65 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+      let formatRfc1123 = 0;
+      let formatRfc850 = 1;
+      let formatAsctime = 2;
+      let index = 0;
+      let tmp = null;
+      let format = null;
+      function expect(s) {
+        if (dart.notNull(date[dartx.length]) - dart.notNull(index) < dart.notNull(s[dartx.length])) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        }
+        let tmp = date[dartx.substring](index, dart.notNull(index) + dart.notNull(s[dartx.length]));
+        if (tmp != s) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        }
+        index = dart.notNull(index) + dart.notNull(s[dartx.length]);
+      }
+      dart.fn(expect, StringTovoid$());
+      function expectWeekday() {
+        let weekday = null;
+        let pos = date[dartx.indexOf](",", index);
+        if (pos == -1) {
+          let pos = date[dartx.indexOf](" ", index);
+          if (pos == -1) dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+          tmp = date[dartx.substring](index, pos);
+          index = dart.notNull(pos) + 1;
+          weekday = wkdays[dartx.indexOf](tmp);
+          if (weekday != -1) {
+            format = formatAsctime;
+            return weekday;
+          }
+        } else {
+          tmp = date[dartx.substring](index, pos);
+          index = dart.notNull(pos) + 1;
+          weekday = wkdays[dartx.indexOf](tmp);
+          if (weekday != -1) {
+            format = formatRfc1123;
+            return weekday;
+          }
+          weekday = weekdays[dartx.indexOf](tmp);
+          if (weekday != -1) {
+            format = formatRfc850;
+            return weekday;
+          }
+        }
+        dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      }
+      dart.fn(expectWeekday, VoidToint());
+      function expectMonth(separator) {
+        let pos = date[dartx.indexOf](separator, index);
+        if (dart.notNull(pos) - dart.notNull(index) != 3) dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        tmp = date[dartx.substring](index, pos);
+        index = dart.notNull(pos) + 1;
+        let month = months[dartx.indexOf](tmp);
+        if (month != -1) return month;
+        dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+      }
+      dart.fn(expectMonth, StringToint$());
+      function expectNum(separator) {
+        let pos = null;
+        if (dart.notNull(separator[dartx.length]) > 0) {
+          pos = date[dartx.indexOf](separator, index);
+        } else {
+          pos = date[dartx.length];
+        }
+        let tmp = date[dartx.substring](index, pos);
+        index = dart.notNull(pos) + dart.notNull(separator[dartx.length]);
+        try {
+          let value = core.int.parse(tmp);
+          return value;
+        } catch (e) {
+          if (core.FormatException.is(e)) {
+            dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+          } else
+            throw e;
+        }
+
+      }
+      dart.fn(expectNum, StringToint$());
+      function expectEnd() {
+        if (index != date[dartx.length]) {
+          dart.throw(new io.HttpException(dart.str`Invalid HTTP date ${date}`));
+        }
+      }
+      dart.fn(expectEnd, VoidTovoid$());
+      let weekday = expectWeekday();
+      let day = null;
+      let month = null;
+      let year = null;
+      let hours = null;
+      let minutes = null;
+      let seconds = null;
+      if (format == formatAsctime) {
+        month = expectMonth(" ");
+        if (date[dartx.codeUnitAt](index) == SP) {
+          index = dart.notNull(index) + 1;
+        }
+        day = expectNum(" ");
+        hours = expectNum(":");
+        minutes = expectNum(":");
+        seconds = expectNum(" ");
+        year = expectNum("");
+      } else {
+        expect(" ");
+        day = expectNum(format == formatRfc1123 ? " " : "-");
+        month = expectMonth(format == formatRfc1123 ? " " : "-");
+        year = expectNum(" ");
+        hours = expectNum(":");
+        minutes = expectNum(":");
+        seconds = expectNum(" ");
+        expect("GMT");
+      }
+      expectEnd();
+      return new core.DateTime.utc(year, dart.notNull(month) + 1, day, hours, minutes, seconds, 0);
+    }
+    static _parseCookieDate(date) {
+      let monthsLowerCase = const$66 || (const$66 = dart.constList(["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], core.String));
+      let position = 0;
+      function error() {
+        dart.throw(new io.HttpException(dart.str`Invalid cookie date ${date}`));
+      }
+      dart.fn(error, VoidTovoid$());
+      function isEnd() {
+        return position == date[dartx.length];
+      }
+      dart.fn(isEnd, VoidTobool());
+      function isDelimiter(s) {
+        let char = s[dartx.codeUnitAt](0);
+        if (char == 9) return true;
+        if (dart.notNull(char) >= 32 && dart.notNull(char) <= 47) return true;
+        if (dart.notNull(char) >= 59 && dart.notNull(char) <= 64) return true;
+        if (dart.notNull(char) >= 91 && dart.notNull(char) <= 96) return true;
+        if (dart.notNull(char) >= 123 && dart.notNull(char) <= 126) return true;
+        return false;
+      }
+      dart.fn(isDelimiter, StringTobool$());
+      function isNonDelimiter(s) {
+        let char = s[dartx.codeUnitAt](0);
+        if (dart.notNull(char) >= 0 && dart.notNull(char) <= 8) return true;
+        if (dart.notNull(char) >= 10 && dart.notNull(char) <= 31) return true;
+        if (dart.notNull(char) >= 48 && dart.notNull(char) <= 57) return true;
+        if (char == 58) return true;
+        if (dart.notNull(char) >= 65 && dart.notNull(char) <= 90) return true;
+        if (dart.notNull(char) >= 97 && dart.notNull(char) <= 122) return true;
+        if (dart.notNull(char) >= 127 && dart.notNull(char) <= 255) return true;
+        return false;
+      }
+      dart.fn(isNonDelimiter, StringTobool$());
+      function isDigit(s) {
+        let char = s[dartx.codeUnitAt](0);
+        if (dart.notNull(char) > 47 && dart.notNull(char) < 58) return true;
+        return false;
+      }
+      dart.fn(isDigit, StringTobool$());
+      function getMonth(month) {
+        if (dart.notNull(month[dartx.length]) < 3) return -1;
+        return monthsLowerCase[dartx.indexOf](month[dartx.substring](0, 3));
+      }
+      dart.fn(getMonth, StringToint$());
+      function toInt(s) {
+        let index = 0;
+        for (; index < dart.notNull(s[dartx.length]) && dart.test(isDigit(s[dartx._get](index))); index++)
+          ;
+        return core.int.parse(s[dartx.substring](0, index));
+      }
+      dart.fn(toInt, StringToint$());
+      let tokens = [];
+      while (!dart.test(isEnd())) {
+        while (!dart.test(isEnd()) && dart.test(isDelimiter(date[dartx._get](position))))
+          position++;
+        let start = position;
+        while (!dart.test(isEnd()) && dart.test(isNonDelimiter(date[dartx._get](position))))
+          position++;
+        tokens[dartx.add](date[dartx.substring](start, position)[dartx.toLowerCase]());
+        while (!dart.test(isEnd()) && dart.test(isDelimiter(date[dartx._get](position))))
+          position++;
+      }
+      let timeStr = null;
+      let dayOfMonthStr = null;
+      let monthStr = null;
+      let yearStr = null;
+      for (let token of tokens) {
+        if (dart.test(dart.dsend(dart.dload(token, 'length'), '<', 1))) continue;
+        if (timeStr == null && dart.test(dart.dsend(dart.dload(token, 'length'), '>=', 5)) && dart.test(isDigit(core.String._check(dart.dindex(token, 0)))) && (dart.equals(dart.dindex(token, 1), ":") || dart.test(isDigit(core.String._check(dart.dindex(token, 1)))) && dart.equals(dart.dindex(token, 2), ":"))) {
+          timeStr = core.String._check(token);
+        } else if (dayOfMonthStr == null && dart.test(isDigit(core.String._check(dart.dindex(token, 0))))) {
+          dayOfMonthStr = core.String._check(token);
+        } else if (monthStr == null && dart.notNull(getMonth(core.String._check(token))) >= 0) {
+          monthStr = core.String._check(token);
+        } else if (yearStr == null && dart.test(dart.dsend(dart.dload(token, 'length'), '>=', 2)) && dart.test(isDigit(core.String._check(dart.dindex(token, 0)))) && dart.test(isDigit(core.String._check(dart.dindex(token, 1))))) {
+          yearStr = core.String._check(token);
+        }
+      }
+      if (timeStr == null || dayOfMonthStr == null || monthStr == null || yearStr == null) {
+        error();
+      }
+      let year = toInt(yearStr);
+      if (dart.notNull(year) >= 70 && dart.notNull(year) <= 99) {
+        year = dart.notNull(year) + 1900;
+      } else if (dart.notNull(year) >= 0 && dart.notNull(year) <= 69) {
+        year = dart.notNull(year) + 2000;
+      }
+      if (dart.notNull(year) < 1601) error();
+      let dayOfMonth = toInt(dayOfMonthStr);
+      if (dart.notNull(dayOfMonth) < 1 || dart.notNull(dayOfMonth) > 31) error();
+      let month = dart.notNull(getMonth(monthStr)) + 1;
+      let timeList = timeStr[dartx.split](":");
+      if (timeList[dartx.length] != 3) error();
+      let hour = toInt(timeList[dartx._get](0));
+      let minute = toInt(timeList[dartx._get](1));
+      let second = toInt(timeList[dartx._get](2));
+      if (dart.notNull(hour) > 23) error();
+      if (dart.notNull(minute) > 59) error();
+      if (dart.notNull(second) > 59) error();
+      return new core.DateTime.utc(year, month, dayOfMonth, hour, minute, second, 0);
+    }
+  };
+  dart.setSignature(io.HttpDate, {
+    statics: () => ({
+      format: dart.definiteFunctionType(core.String, [core.DateTime]),
+      parse: dart.definiteFunctionType(core.DateTime, [core.String]),
+      _parseCookieDate: dart.definiteFunctionType(core.DateTime, [core.String])
+    }),
+    names: ['format', 'parse', '_parseCookieDate']
+  });
+  const _headers = Symbol('_headers');
+  const _defaultPortForScheme = Symbol('_defaultPortForScheme');
+  const _mutable = Symbol('_mutable');
+  const _noFoldingHeaders = Symbol('_noFoldingHeaders');
+  const _contentLength = Symbol('_contentLength');
+  const _persistentConnection = Symbol('_persistentConnection');
+  const _chunkedTransferEncoding = Symbol('_chunkedTransferEncoding');
+  const _host$ = Symbol('_host');
+  const _port$ = Symbol('_port');
+  const _checkMutable = Symbol('_checkMutable');
+  const _addAll = Symbol('_addAll');
+  const _add$2 = Symbol('_add');
+  const _set$ = Symbol('_set');
+  const _addValue = Symbol('_addValue');
+  const _updateHostHeader = Symbol('_updateHostHeader');
+  const _addDate = Symbol('_addDate');
+  const _addHost = Symbol('_addHost');
+  const _addExpires = Symbol('_addExpires');
+  const _addConnection = Symbol('_addConnection');
+  const _addContentType = Symbol('_addContentType');
+  const _addContentLength = Symbol('_addContentLength');
+  const _addTransferEncoding = Symbol('_addTransferEncoding');
+  const _addIfModifiedSince = Symbol('_addIfModifiedSince');
+  const _foldHeader = Symbol('_foldHeader');
+  const _finalize = Symbol('_finalize');
+  const _write = Symbol('_write');
+  const _parseCookies = Symbol('_parseCookies');
+  io._HttpHeaders = class _HttpHeaders extends core.Object {
+    new(protocolVersion, opts) {
+      let defaultPortForScheme = opts && 'defaultPortForScheme' in opts ? opts.defaultPortForScheme : io.HttpClient.DEFAULT_HTTP_PORT;
+      let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
+      this.protocolVersion = protocolVersion;
+      this[_headers] = HashMapOfString$ListOfString().new();
+      this[_defaultPortForScheme] = defaultPortForScheme;
+      this[_mutable] = true;
+      this[_noFoldingHeaders] = null;
+      this[_contentLength] = -1;
+      this[_persistentConnection] = true;
+      this[_chunkedTransferEncoding] = false;
+      this[_host$] = null;
+      this[_port$] = null;
+      if (initialHeaders != null) {
+        initialHeaders[_headers][dartx.forEach](dart.fn((name, value) => this[_headers][dartx._set](name, value), StringAndListOfStringToListOfString()));
+        this[_contentLength] = initialHeaders[_contentLength];
+        this[_persistentConnection] = initialHeaders[_persistentConnection];
+        this[_chunkedTransferEncoding] = initialHeaders[_chunkedTransferEncoding];
+        this[_host$] = initialHeaders[_host$];
+        this[_port$] = initialHeaders[_port$];
+      }
+      if (this.protocolVersion == "1.0") {
+        this[_persistentConnection] = false;
+        this[_chunkedTransferEncoding] = false;
+      }
+    }
+    _get(name) {
+      return this[_headers][dartx._get](name[dartx.toLowerCase]());
+    }
+    value(name) {
+      name = name[dartx.toLowerCase]();
+      let values = this[_headers][dartx._get](name);
+      if (values == null) return null;
+      if (dart.notNull(values[dartx.length]) > 1) {
+        dart.throw(new io.HttpException(dart.str`More than one value for header ${name}`));
+      }
+      return values[dartx._get](0);
+    }
+    add(name, value) {
+      this[_checkMutable]();
+      this[_addAll](io._HttpHeaders._validateField(name), value);
+    }
+    [_addAll](name, value) {
+      dart.assert(name == io._HttpHeaders._validateField(name));
+      if (core.Iterable.is(value)) {
+        for (let v of value) {
+          this[_add$2](name, io._HttpHeaders._validateValue(v));
+        }
+      } else {
+        this[_add$2](name, io._HttpHeaders._validateValue(value));
+      }
+    }
+    set(name, value) {
+      this[_checkMutable]();
+      name = io._HttpHeaders._validateField(name);
+      this[_headers][dartx.remove](name);
+      if (name == io.HttpHeaders.TRANSFER_ENCODING) {
+        this[_chunkedTransferEncoding] = false;
+      }
+      this[_addAll](name, value);
+    }
+    remove(name, value) {
+      this[_checkMutable]();
+      name = io._HttpHeaders._validateField(name);
+      value = io._HttpHeaders._validateValue(value);
+      let values = this[_headers][dartx._get](name);
+      if (values != null) {
+        let index = values[dartx.indexOf](core.String._check(value));
+        if (index != -1) {
+          values[dartx.removeRange](index, dart.notNull(index) + 1);
+        }
+        if (values[dartx.length] == 0) this[_headers][dartx.remove](name);
+      }
+      if (name == io.HttpHeaders.TRANSFER_ENCODING && dart.equals(value, "chunked")) {
+        this[_chunkedTransferEncoding] = false;
+      }
+    }
+    removeAll(name) {
+      this[_checkMutable]();
+      name = io._HttpHeaders._validateField(name);
+      this[_headers][dartx.remove](name);
+    }
+    forEach(f) {
+      this[_headers][dartx.forEach](f);
+    }
+    noFolding(name) {
+      if (this[_noFoldingHeaders] == null) this[_noFoldingHeaders] = ListOfString().new();
+      this[_noFoldingHeaders][dartx.add](name);
+    }
+    get persistentConnection() {
+      return this[_persistentConnection];
+    }
+    set persistentConnection(persistentConnection) {
+      this[_checkMutable]();
+      if (persistentConnection == this[_persistentConnection]) return;
+      if (dart.test(persistentConnection)) {
+        if (this.protocolVersion == "1.1") {
+          this.remove(io.HttpHeaders.CONNECTION, "close");
+        } else {
+          if (this[_contentLength] == -1) {
+            dart.throw(new io.HttpException("Trying to set 'Connection: Keep-Alive' on HTTP 1.0 headers with " + "no ContentLength"));
+          }
+          this.add(io.HttpHeaders.CONNECTION, "keep-alive");
+        }
+      } else {
+        if (this.protocolVersion == "1.1") {
+          this.add(io.HttpHeaders.CONNECTION, "close");
+        } else {
+          this.remove(io.HttpHeaders.CONNECTION, "keep-alive");
+        }
+      }
+      this[_persistentConnection] = persistentConnection;
+    }
+    get contentLength() {
+      return this[_contentLength];
+    }
+    set contentLength(contentLength) {
+      this[_checkMutable]();
+      if (this.protocolVersion == "1.0" && dart.test(this.persistentConnection) && contentLength == -1) {
+        dart.throw(new io.HttpException("Trying to clear ContentLength on HTTP 1.0 headers with " + "'Connection: Keep-Alive' set"));
+      }
+      if (this[_contentLength] == contentLength) return;
+      this[_contentLength] = contentLength;
+      if (dart.notNull(this[_contentLength]) >= 0) {
+        if (dart.test(this.chunkedTransferEncoding)) this.chunkedTransferEncoding = false;
+        this[_set$](io.HttpHeaders.CONTENT_LENGTH, dart.toString(contentLength));
+      } else {
+        this.removeAll(io.HttpHeaders.CONTENT_LENGTH);
+        if (this.protocolVersion == "1.1") {
+          this.chunkedTransferEncoding = true;
+        }
+      }
+    }
+    get chunkedTransferEncoding() {
+      return this[_chunkedTransferEncoding];
+    }
+    set chunkedTransferEncoding(chunkedTransferEncoding) {
+      this[_checkMutable]();
+      if (dart.test(chunkedTransferEncoding) && this.protocolVersion == "1.0") {
+        dart.throw(new io.HttpException("Trying to set 'Transfer-Encoding: Chunked' on HTTP 1.0 headers"));
+      }
+      if (chunkedTransferEncoding == this[_chunkedTransferEncoding]) return;
+      if (dart.test(chunkedTransferEncoding)) {
+        let values = this[_headers][dartx._get](io.HttpHeaders.TRANSFER_ENCODING);
+        if (values == null || values[dartx.last] != "chunked") {
+          this[_addValue](io.HttpHeaders.TRANSFER_ENCODING, "chunked");
+        }
+        this.contentLength = -1;
+      } else {
+        this.remove(io.HttpHeaders.TRANSFER_ENCODING, "chunked");
+      }
+      this[_chunkedTransferEncoding] = chunkedTransferEncoding;
+    }
+    get host() {
+      return this[_host$];
+    }
+    set host(host) {
+      this[_checkMutable]();
+      this[_host$] = host;
+      this[_updateHostHeader]();
+    }
+    get port() {
+      return this[_port$];
+    }
+    set port(port) {
+      this[_checkMutable]();
+      this[_port$] = port;
+      this[_updateHostHeader]();
+    }
+    get ifModifiedSince() {
+      let values = this[_headers][dartx._get](io.HttpHeaders.IF_MODIFIED_SINCE);
+      if (values != null) {
+        try {
+          return io.HttpDate.parse(values[dartx._get](0));
+        } catch (e) {
+          if (core.Exception.is(e)) {
+            return null;
+          } else
+            throw e;
+        }
+
+      }
+      return null;
+    }
+    set ifModifiedSince(ifModifiedSince) {
+      this[_checkMutable]();
+      let formatted = io.HttpDate.format(ifModifiedSince.toUtc());
+      this[_set$](io.HttpHeaders.IF_MODIFIED_SINCE, formatted);
+    }
+    get date() {
+      let values = this[_headers][dartx._get](io.HttpHeaders.DATE);
+      if (values != null) {
+        try {
+          return io.HttpDate.parse(values[dartx._get](0));
+        } catch (e) {
+          if (core.Exception.is(e)) {
+            return null;
+          } else
+            throw e;
+        }
+
+      }
+      return null;
+    }
+    set date(date) {
+      this[_checkMutable]();
+      let formatted = io.HttpDate.format(date.toUtc());
+      this[_set$]("date", formatted);
+    }
+    get expires() {
+      let values = this[_headers][dartx._get](io.HttpHeaders.EXPIRES);
+      if (values != null) {
+        try {
+          return io.HttpDate.parse(values[dartx._get](0));
+        } catch (e) {
+          if (core.Exception.is(e)) {
+            return null;
+          } else
+            throw e;
+        }
+
+      }
+      return null;
+    }
+    set expires(expires) {
+      this[_checkMutable]();
+      let formatted = io.HttpDate.format(expires.toUtc());
+      this[_set$](io.HttpHeaders.EXPIRES, formatted);
+    }
+    get contentType() {
+      let values = this[_headers][dartx._get]("content-type");
+      if (values != null) {
+        return io.ContentType.parse(values[dartx._get](0));
+      } else {
+        return null;
+      }
+    }
+    set contentType(contentType) {
+      this[_checkMutable]();
+      this[_set$](io.HttpHeaders.CONTENT_TYPE, dart.toString(contentType));
+    }
+    clear() {
+      this[_checkMutable]();
+      this[_headers][dartx.clear]();
+      this[_contentLength] = -1;
+      this[_persistentConnection] = true;
+      this[_chunkedTransferEncoding] = false;
+      this[_host$] = null;
+      this[_port$] = null;
+    }
+    [_add$2](name, value) {
+      dart.assert(name == io._HttpHeaders._validateField(name));
+      switch (name[dartx.length]) {
+        case 4:
+        {
+          if (io.HttpHeaders.DATE == name) {
+            this[_addDate](name, value);
+            return;
+          }
+          if (io.HttpHeaders.HOST == name) {
+            this[_addHost](name, value);
+            return;
+          }
+          break;
+        }
+        case 7:
+        {
+          if (io.HttpHeaders.EXPIRES == name) {
+            this[_addExpires](name, value);
+            return;
+          }
+          break;
+        }
+        case 10:
+        {
+          if (io.HttpHeaders.CONNECTION == name) {
+            this[_addConnection](name, value);
+            return;
+          }
+          break;
+        }
+        case 12:
+        {
+          if (io.HttpHeaders.CONTENT_TYPE == name) {
+            this[_addContentType](name, value);
+            return;
+          }
+          break;
+        }
+        case 14:
+        {
+          if (io.HttpHeaders.CONTENT_LENGTH == name) {
+            this[_addContentLength](name, value);
+            return;
+          }
+          break;
+        }
+        case 17:
+        {
+          if (io.HttpHeaders.TRANSFER_ENCODING == name) {
+            this[_addTransferEncoding](name, value);
+            return;
+          }
+          if (io.HttpHeaders.IF_MODIFIED_SINCE == name) {
+            this[_addIfModifiedSince](name, value);
+            return;
+          }
+        }
+      }
+      this[_addValue](name, value);
+    }
+    [_addContentLength](name, value) {
+      if (typeof value == 'number') {
+        this.contentLength = value;
+      } else if (typeof value == 'string') {
+        this.contentLength = core.int.parse(value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addTransferEncoding](name, value) {
+      if (dart.equals(value, "chunked")) {
+        this.chunkedTransferEncoding = true;
+      } else {
+        this[_addValue](io.HttpHeaders.TRANSFER_ENCODING, value);
+      }
+    }
+    [_addDate](name, value) {
+      if (core.DateTime.is(value)) {
+        this.date = value;
+      } else if (typeof value == 'string') {
+        this[_set$](io.HttpHeaders.DATE, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addExpires](name, value) {
+      if (core.DateTime.is(value)) {
+        this.expires = value;
+      } else if (typeof value == 'string') {
+        this[_set$](io.HttpHeaders.EXPIRES, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addIfModifiedSince](name, value) {
+      if (core.DateTime.is(value)) {
+        this.ifModifiedSince = value;
+      } else if (typeof value == 'string') {
+        this[_set$](io.HttpHeaders.IF_MODIFIED_SINCE, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addHost](name, value) {
+      if (typeof value == 'string') {
+        let pos = value[dartx.indexOf](":");
+        if (pos == -1) {
+          this[_host$] = value;
+          this[_port$] = io.HttpClient.DEFAULT_HTTP_PORT;
+        } else {
+          if (dart.notNull(pos) > 0) {
+            this[_host$] = value[dartx.substring](0, pos);
+          } else {
+            this[_host$] = null;
+          }
+          if (dart.notNull(pos) + 1 == value[dartx.length]) {
+            this[_port$] = io.HttpClient.DEFAULT_HTTP_PORT;
+          } else {
+            try {
+              this[_port$] = core.int.parse(value[dartx.substring](dart.notNull(pos) + 1));
+            } catch (e) {
+              if (core.FormatException.is(e)) {
+                this[_port$] = null;
+              } else
+                throw e;
+            }
+
+          }
+        }
+        this[_set$](io.HttpHeaders.HOST, value);
+      } else {
+        dart.throw(new io.HttpException(dart.str`Unexpected type for header named ${name}`));
+      }
+    }
+    [_addConnection](name, value) {
+      let lowerCaseValue = dart.dsend(value, 'toLowerCase');
+      if (dart.equals(lowerCaseValue, 'close')) {
+        this[_persistentConnection] = false;
+      } else if (dart.equals(lowerCaseValue, 'keep-alive')) {
+        this[_persistentConnection] = true;
+      }
+      this[_addValue](name, value);
+    }
+    [_addContentType](name, value) {
+      this[_set$](io.HttpHeaders.CONTENT_TYPE, core.String._check(value));
+    }
+    [_addValue](name, value) {
+      let values = this[_headers][dartx._get](name);
+      if (values == null) {
+        values = ListOfString().new();
+        this[_headers][dartx._set](name, values);
+      }
+      if (core.DateTime.is(value)) {
+        values[dartx.add](io.HttpDate.format(value));
+      } else if (typeof value == 'string') {
+        values[dartx.add](value);
+      } else {
+        values[dartx.add](core.String._check(io._HttpHeaders._validateValue(dart.toString(value))));
+      }
+    }
+    [_set$](name, value) {
+      dart.assert(name == io._HttpHeaders._validateField(name));
+      let values = ListOfString().new();
+      this[_headers][dartx._set](name, values);
+      values[dartx.add](value);
+    }
+    [_checkMutable]() {
+      if (!dart.test(this[_mutable])) dart.throw(new io.HttpException("HTTP headers are not mutable"));
+    }
+    [_updateHostHeader]() {
+      let defaultPort = this[_port$] == null || this[_port$] == this[_defaultPortForScheme];
+      this[_set$]("host", defaultPort ? this.host : dart.str`${this.host}:${this[_port$]}`);
+    }
+    [_foldHeader](name) {
+      if (name == io.HttpHeaders.SET_COOKIE || this[_noFoldingHeaders] != null && this[_noFoldingHeaders][dartx.indexOf](name) != -1) {
+        return false;
+      }
+      return true;
+    }
+    [_finalize]() {
+      this[_mutable] = false;
+    }
+    [_write](buffer, offset) {
+      function write(bytes) {
+        let len = bytes[dartx.length];
+        for (let i = 0; i < dart.notNull(len); i++) {
+          buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+        }
+        offset = dart.notNull(offset) + dart.notNull(len);
+      }
+      dart.fn(write, ListOfintTovoid$());
+      for (let name of this[_headers][dartx.keys]) {
+        let values = this[_headers][dartx._get](name);
+        let fold = core.bool._check(this[_foldHeader](name));
+        let nameData = name[dartx.codeUnits];
+        write(nameData);
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.COLON);
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.SP);
+        for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
+          if (i > 0) {
+            if (dart.test(fold)) {
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.COMMA);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.SP);
+            } else {
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.CR);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.LF);
+              write(nameData);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.COLON);
+              buffer[dartx._set]((() => {
+                let x = offset;
+                offset = dart.notNull(x) + 1;
+                return x;
+              })(), io._CharCode.SP);
+            }
+          }
+          write(values[dartx._get](i)[dartx.codeUnits]);
+        }
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.CR);
+        buffer[dartx._set]((() => {
+          let x = offset;
+          offset = dart.notNull(x) + 1;
+          return x;
+        })(), io._CharCode.LF);
+      }
+      return offset;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      this[_headers][dartx.forEach](dart.fn((name, values) => {
+        sb.write(name);
+        sb.write(": ");
+        let fold = core.bool._check(this[_foldHeader](name));
+        for (let i = 0; i < dart.notNull(values[dartx.length]); i++) {
+          if (i > 0) {
+            if (dart.test(fold)) {
+              sb.write(", ");
+            } else {
+              sb.write("\n");
+              sb.write(name);
+              sb.write(": ");
+            }
+          }
+          sb.write(values[dartx._get](i));
+        }
+        sb.write("\n");
+      }, StringAndListOfStringToNull()));
+      return sb.toString();
+    }
+    [_parseCookies]() {
+      let cookies = ListOfCookie().new();
+      function parseCookieString(s) {
+        let index = 0;
+        function done() {
+          return index == -1 || index == s[dartx.length];
+        }
+        dart.fn(done, VoidTobool());
+        function skipWS() {
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) != " " && s[dartx._get](index) != "\t") return;
+            index = dart.notNull(index) + 1;
+          }
+        }
+        dart.fn(skipWS, VoidTovoid$());
+        function parseName() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == "=") break;
+            index = dart.notNull(index) + 1;
+          }
+          return s[dartx.substring](start, index);
+        }
+        dart.fn(parseName, VoidToString$());
+        function parseValue() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == ";") break;
+            index = dart.notNull(index) + 1;
+          }
+          return s[dartx.substring](start, index);
+        }
+        dart.fn(parseValue, VoidToString$());
+        function expect(expected) {
+          if (dart.test(done())) return false;
+          if (s[dartx._get](index) != expected) return false;
+          index = dart.notNull(index) + 1;
+          return true;
+        }
+        dart.fn(expect, StringTobool$());
+        while (!dart.test(done())) {
+          skipWS();
+          if (dart.test(done())) return;
+          let name = parseName();
+          skipWS();
+          if (!dart.test(expect("="))) {
+            index = s[dartx.indexOf](';', index);
+            continue;
+          }
+          skipWS();
+          let value = parseValue();
+          try {
+            cookies[dartx.add](new io._Cookie(name, value));
+          } catch (_) {
+          }
+
+          skipWS();
+          if (dart.test(done())) return;
+          if (!dart.test(expect(";"))) {
+            index = s[dartx.indexOf](';', index);
+            continue;
+          }
+        }
+      }
+      dart.fn(parseCookieString, StringTovoid$());
+      let values = this[_headers][dartx._get](io.HttpHeaders.COOKIE);
+      if (values != null) {
+        values[dartx.forEach](dart.fn(headerValue => parseCookieString(headerValue), StringTovoid$()));
+      }
+      return cookies;
+    }
+    static _validateField(field) {
+      for (let i = 0; i < dart.notNull(field[dartx.length]); i++) {
+        if (!dart.test(io._HttpParser._isTokenChar(field[dartx.codeUnitAt](i)))) {
+          dart.throw(new core.FormatException(dart.str`Invalid HTTP header field name: ${convert.JSON.encode(field)}`));
+        }
+      }
+      return field[dartx.toLowerCase]();
+    }
+    static _validateValue(value) {
+      if (!(typeof value == 'string')) return value;
+      for (let i = 0; i < dart.notNull(core.num._check(dart.dload(value, 'length'))); i++) {
+        if (!dart.test(io._HttpParser._isValueChar(core.int._check(dart.dsend(value, 'codeUnitAt', i))))) {
+          dart.throw(new core.FormatException(dart.str`Invalid HTTP header field value: ${convert.JSON.encode(value)}`));
+        }
+      }
+      return value;
+    }
+  };
+  io._HttpHeaders[dart.implements] = () => [io.HttpHeaders];
+  dart.setSignature(io._HttpHeaders, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpHeaders, [core.String], {defaultPortForScheme: core.int, initialHeaders: io._HttpHeaders})}),
+    fields: () => ({
+      [_headers]: MapOfString$ListOfString(),
+      protocolVersion: core.String,
+      [_mutable]: core.bool,
+      [_noFoldingHeaders]: ListOfString(),
+      [_contentLength]: core.int,
+      [_persistentConnection]: core.bool,
+      [_chunkedTransferEncoding]: core.bool,
+      [_host$]: core.String,
+      [_port$]: core.int,
+      [_defaultPortForScheme]: core.int
+    }),
+    getters: () => ({
+      persistentConnection: dart.definiteFunctionType(core.bool, []),
+      contentLength: dart.definiteFunctionType(core.int, []),
+      chunkedTransferEncoding: dart.definiteFunctionType(core.bool, []),
+      host: dart.definiteFunctionType(core.String, []),
+      port: dart.definiteFunctionType(core.int, []),
+      ifModifiedSince: dart.definiteFunctionType(core.DateTime, []),
+      date: dart.definiteFunctionType(core.DateTime, []),
+      expires: dart.definiteFunctionType(core.DateTime, []),
+      contentType: dart.definiteFunctionType(io.ContentType, [])
+    }),
+    setters: () => ({
+      persistentConnection: dart.definiteFunctionType(dart.void, [core.bool]),
+      contentLength: dart.definiteFunctionType(dart.void, [core.int]),
+      chunkedTransferEncoding: dart.definiteFunctionType(dart.void, [core.bool]),
+      host: dart.definiteFunctionType(dart.void, [core.String]),
+      port: dart.definiteFunctionType(dart.void, [core.int]),
+      ifModifiedSince: dart.definiteFunctionType(dart.void, [core.DateTime]),
+      date: dart.definiteFunctionType(dart.void, [core.DateTime]),
+      expires: dart.definiteFunctionType(dart.void, [core.DateTime]),
+      contentType: dart.definiteFunctionType(dart.void, [io.ContentType])
+    }),
+    methods: () => ({
+      _get: dart.definiteFunctionType(core.List$(core.String), [core.String]),
+      value: dart.definiteFunctionType(core.String, [core.String]),
+      add: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      [_addAll]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      set: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      remove: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      removeAll: dart.definiteFunctionType(dart.void, [core.String]),
+      forEach: dart.definiteFunctionType(dart.void, [StringAndListOfStringTovoid()]),
+      noFolding: dart.definiteFunctionType(dart.void, [core.String]),
+      clear: dart.definiteFunctionType(dart.void, []),
+      [_add$2]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addContentLength]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addTransferEncoding]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addDate]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addExpires]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addIfModifiedSince]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addHost]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addConnection]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addContentType]: dart.definiteFunctionType(dart.void, [core.String, dart.dynamic]),
+      [_addValue]: dart.definiteFunctionType(dart.void, [core.String, core.Object]),
+      [_set$]: dart.definiteFunctionType(dart.void, [core.String, core.String]),
+      [_checkMutable]: dart.definiteFunctionType(dart.dynamic, []),
+      [_updateHostHeader]: dart.definiteFunctionType(dart.dynamic, []),
+      [_foldHeader]: dart.definiteFunctionType(dart.dynamic, [core.String]),
+      [_finalize]: dart.definiteFunctionType(dart.void, []),
+      [_write]: dart.definiteFunctionType(core.int, [typed_data.Uint8List, core.int]),
+      [_parseCookies]: dart.definiteFunctionType(core.List$(io.Cookie), [])
+    }),
+    statics: () => ({
+      _validateField: dart.definiteFunctionType(core.String, [core.String]),
+      _validateValue: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
+    }),
+    names: ['_validateField', '_validateValue']
+  });
+  const _value$1 = Symbol('_value');
+  const _parameters = Symbol('_parameters');
+  const _unmodifiableParameters = Symbol('_unmodifiableParameters');
+  const _parse = Symbol('_parse');
+  const _ensureParameters = Symbol('_ensureParameters');
+  io._HeaderValue = class _HeaderValue extends core.Object {
+    new(value, parameters) {
+      if (value === void 0) value = "";
+      if (parameters === void 0) parameters = null;
+      this[_value$1] = value;
+      this[_parameters] = null;
+      this[_unmodifiableParameters] = null;
+      if (parameters != null) {
+        this[_parameters] = HashMapOfString$String().from(parameters);
+      }
+    }
+    static parse(value, opts) {
+      let parameterSeparator = opts && 'parameterSeparator' in opts ? opts.parameterSeparator : ";";
+      let valueSeparator = opts && 'valueSeparator' in opts ? opts.valueSeparator : null;
+      let preserveBackslash = opts && 'preserveBackslash' in opts ? opts.preserveBackslash : false;
+      let result = new io._HeaderValue();
+      result[_parse](value, core.String._check(parameterSeparator), core.String._check(valueSeparator), core.bool._check(preserveBackslash));
+      return result;
+    }
+    get value() {
+      return this[_value$1];
+    }
+    [_ensureParameters]() {
+      if (this[_parameters] == null) {
+        this[_parameters] = HashMapOfString$String().new();
+      }
+    }
+    get parameters() {
+      this[_ensureParameters]();
+      if (this[_unmodifiableParameters] == null) {
+        this[_unmodifiableParameters] = new (UnmodifiableMapViewOfString$String())(this[_parameters]);
+      }
+      return this[_unmodifiableParameters];
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write(this[_value$1]);
+      if (this.parameters != null && dart.notNull(this.parameters[dartx.length]) > 0) {
+        this[_parameters][dartx.forEach](dart.fn((name, value) => {
+          sb.write("; ");
+          sb.write(name);
+          sb.write("=");
+          sb.write(value);
+        }, StringAndStringToNull()));
+      }
+      return sb.toString();
+    }
+    [_parse](s, parameterSeparator, valueSeparator, preserveBackslash) {
+      let index = 0;
+      function done() {
+        return index == s[dartx.length];
+      }
+      dart.fn(done, VoidTobool());
+      function skipWS() {
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) != " " && s[dartx._get](index) != "\t") return;
+          index++;
+        }
+      }
+      dart.fn(skipWS, VoidTovoid$());
+      function parseValue() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == valueSeparator || s[dartx._get](index) == parameterSeparator) break;
+          index++;
+        }
+        return s[dartx.substring](start, index);
+      }
+      dart.fn(parseValue, VoidToString$());
+      function expect(expected) {
+        if (dart.test(done()) || s[dartx._get](index) != expected) {
+          dart.throw(new io.HttpException("Failed to parse header value"));
+        }
+        index++;
+      }
+      dart.fn(expect, StringTovoid$());
+      function maybeExpect(expected) {
+        if (s[dartx._get](index) == expected) index++;
+      }
+      dart.fn(maybeExpect, StringTovoid$());
+      const parseParameters = (function() {
+        let parameters = HashMapOfString$String().new();
+        this[_parameters] = new (UnmodifiableMapViewOfString$String())(parameters);
+        function parseParameterName() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == " " || s[dartx._get](index) == "\t" || s[dartx._get](index) == "=" || s[dartx._get](index) == parameterSeparator || s[dartx._get](index) == valueSeparator) break;
+            index++;
+          }
+          return s[dartx.substring](start, index)[dartx.toLowerCase]();
+        }
+        dart.fn(parseParameterName, VoidToString$());
+        function parseParameterValue() {
+          if (!dart.test(done()) && s[dartx._get](index) == "\"") {
+            let sb = new core.StringBuffer();
+            index++;
+            while (!dart.test(done())) {
+              if (s[dartx._get](index) == "\\") {
+                if (index + 1 == s[dartx.length]) {
+                  dart.throw(new io.HttpException("Failed to parse header value"));
+                }
+                if (dart.test(preserveBackslash) && s[dartx._get](index + 1) != "\"") {
+                  sb.write(s[dartx._get](index));
+                }
+                index++;
+              } else if (s[dartx._get](index) == "\"") {
+                index++;
+                break;
+              }
+              sb.write(s[dartx._get](index));
+              index++;
+            }
+            return sb.toString();
+          } else {
+            let val = parseValue();
+            return val == "" ? null : val;
+          }
+        }
+        dart.fn(parseParameterValue, VoidToString$());
+        while (!dart.test(done())) {
+          skipWS();
+          if (dart.test(done())) return;
+          let name = parseParameterName();
+          skipWS();
+          if (dart.test(done())) {
+            parameters._set(name, null);
+            return;
+          }
+          maybeExpect("=");
+          skipWS();
+          if (dart.test(done())) {
+            parameters._set(name, null);
+            return;
+          }
+          let value = parseParameterValue();
+          if (name == 'charset' && io._ContentType.is(this)) {
+            value = value[dartx.toLowerCase]();
+          }
+          parameters._set(name, value);
+          skipWS();
+          if (dart.test(done())) return;
+          if (s[dartx._get](index) == valueSeparator) return;
+          expect(parameterSeparator);
+        }
+      }).bind(this);
+      dart.fn(parseParameters, VoidTovoid$());
+      skipWS();
+      this[_value$1] = parseValue();
+      skipWS();
+      if (dart.test(done())) return;
+      maybeExpect(parameterSeparator);
+      parseParameters();
+    }
+  };
+  io._HeaderValue[dart.implements] = () => [io.HeaderValue];
+  dart.setSignature(io._HeaderValue, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HeaderValue, [], [core.String, MapOfString$String()])}),
+    fields: () => ({
+      [_value$1]: core.String,
+      [_parameters]: MapOfString$String(),
+      [_unmodifiableParameters]: MapOfString$String()
+    }),
+    getters: () => ({
+      value: dart.definiteFunctionType(core.String, []),
+      parameters: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+    }),
+    methods: () => ({
+      [_ensureParameters]: dart.definiteFunctionType(dart.void, []),
+      [_parse]: dart.definiteFunctionType(dart.void, [core.String, core.String, core.String, core.bool])
+    }),
+    statics: () => ({parse: dart.definiteFunctionType(io._HeaderValue, [core.String], {parameterSeparator: dart.dynamic, valueSeparator: dart.dynamic, preserveBackslash: dart.dynamic})}),
+    names: ['parse']
+  });
+  const _primaryType = Symbol('_primaryType');
+  const _subType = Symbol('_subType');
+  io._ContentType = class _ContentType extends io._HeaderValue {
+    new(primaryType, subType, charset, parameters) {
+      this[_primaryType] = primaryType;
+      this[_subType] = subType;
+      super.new("");
+      if (this[_primaryType] == null) this[_primaryType] = "";
+      if (this[_subType] == null) this[_subType] = "";
+      this[_value$1] = dart.str`${this[_primaryType]}/${this[_subType]}`;
+      if (parameters != null) {
+        this[_ensureParameters]();
+        parameters[dartx.forEach](dart.fn((key, value) => {
+          let lowerCaseKey = key[dartx.toLowerCase]();
+          if (lowerCaseKey == "charset") {
+            value = value[dartx.toLowerCase]();
+          }
+          this[_parameters][dartx._set](lowerCaseKey, value);
+        }, StringAndStringToNull()));
+      }
+      if (charset != null) {
+        this[_ensureParameters]();
+        this[_parameters][dartx._set]("charset", charset[dartx.toLowerCase]());
+      }
+    }
+    _() {
+      this[_primaryType] = "";
+      this[_subType] = "";
+      super.new();
+    }
+    static parse(value) {
+      let result = new io._ContentType._();
+      result[_parse](value, ";", null, false);
+      let index = result[_value$1][dartx.indexOf]("/");
+      if (index == -1 || index == dart.notNull(result[_value$1][dartx.length]) - 1) {
+        result[_primaryType] = result[_value$1][dartx.trim]()[dartx.toLowerCase]();
+        result[_subType] = "";
+      } else {
+        result[_primaryType] = result[_value$1][dartx.substring](0, index)[dartx.trim]()[dartx.toLowerCase]();
+        result[_subType] = result[_value$1][dartx.substring](dart.notNull(index) + 1)[dartx.trim]()[dartx.toLowerCase]();
+      }
+      return result;
+    }
+    get mimeType() {
+      return dart.str`${this.primaryType}/${this.subType}`;
+    }
+    get primaryType() {
+      return this[_primaryType];
+    }
+    get subType() {
+      return this[_subType];
+    }
+    get charset() {
+      return this.parameters[dartx._get]("charset");
+    }
+  };
+  dart.defineNamedConstructor(io._ContentType, '_');
+  io._ContentType[dart.implements] = () => [io.ContentType];
+  dart.setSignature(io._ContentType, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._ContentType, [core.String, core.String, core.String, MapOfString$String()]),
+      _: dart.definiteFunctionType(io._ContentType, [])
+    }),
+    fields: () => ({
+      [_primaryType]: core.String,
+      [_subType]: core.String
+    }),
+    getters: () => ({
+      mimeType: dart.definiteFunctionType(core.String, []),
+      primaryType: dart.definiteFunctionType(core.String, []),
+      subType: dart.definiteFunctionType(core.String, []),
+      charset: dart.definiteFunctionType(core.String, [])
+    }),
+    statics: () => ({parse: dart.definiteFunctionType(io._ContentType, [core.String])}),
+    names: ['parse']
+  });
+  const _validate = Symbol('_validate');
+  const _parseSetCookieValue = Symbol('_parseSetCookieValue');
+  let const$67;
+  io._Cookie = class _Cookie extends core.Object {
+    new(name, value) {
+      if (name === void 0) name = null;
+      if (value === void 0) value = null;
+      this.name = name;
+      this.value = value;
+      this.expires = null;
+      this.maxAge = null;
+      this.domain = null;
+      this.path = null;
+      this.httpOnly = false;
+      this.secure = false;
+      this.httpOnly = true;
+      this[_validate]();
+    }
+    fromSetCookieValue(value) {
+      this.name = null;
+      this.value = null;
+      this.expires = null;
+      this.maxAge = null;
+      this.domain = null;
+      this.path = null;
+      this.httpOnly = false;
+      this.secure = false;
+      this[_parseSetCookieValue](value);
+    }
+    [_parseSetCookieValue](s) {
+      let index = 0;
+      function done() {
+        return index == s[dartx.length];
+      }
+      dart.fn(done, VoidTobool());
+      function parseName() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == "=") break;
+          index++;
+        }
+        return s[dartx.substring](start, index)[dartx.trim]();
+      }
+      dart.fn(parseName, VoidToString$());
+      function parseValue() {
+        let start = index;
+        while (!dart.test(done())) {
+          if (s[dartx._get](index) == ";") break;
+          index++;
+        }
+        return s[dartx.substring](start, index)[dartx.trim]();
+      }
+      dart.fn(parseValue, VoidToString$());
+      function expect(expected) {
+        if (dart.test(done())) dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+        if (s[dartx._get](index) != expected) {
+          dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+        }
+        index++;
+      }
+      dart.fn(expect, StringTovoid$());
+      const parseAttributes = (function() {
+        function parseAttributeName() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == "=" || s[dartx._get](index) == ";") break;
+            index++;
+          }
+          return s[dartx.substring](start, index)[dartx.trim]()[dartx.toLowerCase]();
+        }
+        dart.fn(parseAttributeName, VoidToString$());
+        function parseAttributeValue() {
+          let start = index;
+          while (!dart.test(done())) {
+            if (s[dartx._get](index) == ";") break;
+            index++;
+          }
+          return s[dartx.substring](start, index)[dartx.trim]()[dartx.toLowerCase]();
+        }
+        dart.fn(parseAttributeValue, VoidToString$());
+        while (!dart.test(done())) {
+          let name = parseAttributeName();
+          let value = "";
+          if (!dart.test(done()) && s[dartx._get](index) == "=") {
+            index++;
+            value = parseAttributeValue();
+          }
+          if (name == "expires") {
+            this.expires = io.HttpDate._parseCookieDate(value);
+          } else if (name == "max-age") {
+            this.maxAge = core.int.parse(value);
+          } else if (name == "domain") {
+            this.domain = value;
+          } else if (name == "path") {
+            this.path = value;
+          } else if (name == "httponly") {
+            this.httpOnly = true;
+          } else if (name == "secure") {
+            this.secure = true;
+          }
+          if (!dart.test(done())) index++;
+        }
+      }).bind(this);
+      dart.fn(parseAttributes, VoidTovoid$());
+      this.name = parseName();
+      if (dart.test(done()) || this.name[dartx.length] == 0) {
+        dart.throw(new io.HttpException(dart.str`Failed to parse header value [${s}]`));
+      }
+      index++;
+      this.value = parseValue();
+      this[_validate]();
+      if (dart.test(done())) return;
+      index++;
+      parseAttributes();
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write(this.name);
+      sb.write("=");
+      sb.write(this.value);
+      if (this.expires != null) {
+        sb.write("; Expires=");
+        sb.write(io.HttpDate.format(this.expires));
+      }
+      if (this.maxAge != null) {
+        sb.write("; Max-Age=");
+        sb.write(this.maxAge);
+      }
+      if (this.domain != null) {
+        sb.write("; Domain=");
+        sb.write(this.domain);
+      }
+      if (this.path != null) {
+        sb.write("; Path=");
+        sb.write(this.path);
+      }
+      if (dart.test(this.secure)) sb.write("; Secure");
+      if (dart.test(this.httpOnly)) sb.write("; HttpOnly");
+      return sb.toString();
+    }
+    [_validate]() {
+      let SEPERATORS = const$67 || (const$67 = dart.constList(["(", ")", "<", ">", "@", ",", ";", ":", "\\", '"', "/", "[", "]", "?", "=", "{", "}"], core.String));
+      for (let i = 0; i < dart.notNull(this.name[dartx.length]); i++) {
+        let codeUnit = this.name[dartx.codeUnits][dartx._get](i);
+        if (dart.notNull(codeUnit) <= 32 || dart.notNull(codeUnit) >= 127 || dart.notNull(SEPERATORS[dartx.indexOf](this.name[dartx._get](i))) >= 0) {
+          dart.throw(new core.FormatException(dart.str`Invalid character in cookie name, code unit: '${codeUnit}'`));
+        }
+      }
+      for (let i = 0; i < dart.notNull(this.value[dartx.length]); i++) {
+        let codeUnit = this.value[dartx.codeUnits][dartx._get](i);
+        if (!(codeUnit == 33 || dart.notNull(codeUnit) >= 35 && dart.notNull(codeUnit) <= 43 || dart.notNull(codeUnit) >= 45 && dart.notNull(codeUnit) <= 58 || dart.notNull(codeUnit) >= 60 && dart.notNull(codeUnit) <= 91 || dart.notNull(codeUnit) >= 93 && dart.notNull(codeUnit) <= 126)) {
+          dart.throw(new core.FormatException(dart.str`Invalid character in cookie value, code unit: '${codeUnit}'`));
+        }
+      }
+    }
+  };
+  dart.defineNamedConstructor(io._Cookie, 'fromSetCookieValue');
+  io._Cookie[dart.implements] = () => [io.Cookie];
+  dart.setSignature(io._Cookie, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._Cookie, [], [core.String, core.String]),
+      fromSetCookieValue: dart.definiteFunctionType(io._Cookie, [core.String])
+    }),
+    fields: () => ({
+      name: core.String,
+      value: core.String,
+      expires: core.DateTime,
+      maxAge: core.int,
+      domain: core.String,
+      path: core.String,
+      httpOnly: core.bool,
+      secure: core.bool
+    }),
+    methods: () => ({
+      [_parseSetCookieValue]: dart.definiteFunctionType(dart.void, [core.String]),
+      [_validate]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._OUTGOING_BUFFER_SIZE = 8 * 1024;
+  const _transferLength = Symbol('_transferLength');
+  const _dataCompleter = Symbol('_dataCompleter');
+  const _stream$ = Symbol('_stream');
+  io._HttpIncoming = class _HttpIncoming extends async.Stream$(core.List$(core.int)) {
+    get transferLength() {
+      return this[_transferLength];
+    }
+    new(headers, transferLength, stream) {
+      this[_dataCompleter] = async.Completer.new();
+      this.headers = headers;
+      this[_transferLength] = transferLength;
+      this[_stream$] = stream;
+      this.fullBodyRead = false;
+      this.upgraded = false;
+      this.statusCode = null;
+      this.reasonPhrase = null;
+      this.method = null;
+      this.uri = null;
+      this.hasSubscriber = false;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      this.hasSubscriber = true;
+      return this[_stream$].handleError(dart.fn(error => {
+        dart.throw(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this.uri}));
+      }, dynamicToNull$())).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get dataDone() {
+      return this[_dataCompleter].future;
+    }
+    close(closing) {
+      this.fullBodyRead = true;
+      this.hasSubscriber = true;
+      this[_dataCompleter].complete(closing);
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpIncoming);
+  dart.setSignature(io._HttpIncoming, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpIncoming, [io._HttpHeaders, core.int, StreamOfListOfint()])}),
+    fields: () => ({
+      [_transferLength]: core.int,
+      [_dataCompleter]: async.Completer,
+      [_stream$]: StreamOfListOfint(),
+      fullBodyRead: core.bool,
+      headers: io._HttpHeaders,
+      upgraded: core.bool,
+      statusCode: core.int,
+      reasonPhrase: core.String,
+      method: core.String,
+      uri: core.Uri,
+      hasSubscriber: core.bool
+    }),
+    getters: () => ({
+      transferLength: dart.definiteFunctionType(core.int, []),
+      dataDone: dart.definiteFunctionType(async.Future, [])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(dart.void, [core.bool])
+    })
+  });
+  const _incoming = Symbol('_incoming');
+  const _cookies = Symbol('_cookies');
+  io._HttpInboundMessage = class _HttpInboundMessage extends async.Stream$(core.List$(core.int)) {
+    new(incoming) {
+      this[_incoming] = incoming;
+      this[_cookies] = null;
+      super.new();
+    }
+    get cookies() {
+      if (this[_cookies] != null) return this[_cookies];
+      return this[_cookies] = this.headers[_parseCookies]();
+    }
+    get headers() {
+      return this[_incoming].headers;
+    }
+    get protocolVersion() {
+      return this.headers.protocolVersion;
+    }
+    get contentLength() {
+      return this.headers.contentLength;
+    }
+    get persistentConnection() {
+      return this.headers.persistentConnection;
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpInboundMessage);
+  dart.setSignature(io._HttpInboundMessage, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpInboundMessage, [io._HttpIncoming])}),
+    fields: () => ({
+      [_incoming]: io._HttpIncoming,
+      [_cookies]: ListOfCookie()
+    }),
+    getters: () => ({
+      cookies: dart.definiteFunctionType(core.List$(io.Cookie), []),
+      headers: dart.definiteFunctionType(io._HttpHeaders, []),
+      protocolVersion: dart.definiteFunctionType(core.String, []),
+      contentLength: dart.definiteFunctionType(core.int, []),
+      persistentConnection: dart.definiteFunctionType(core.bool, [])
+    })
+  });
+  const _httpServer = Symbol('_httpServer');
+  const _httpConnection = Symbol('_httpConnection');
+  const _session = Symbol('_session');
+  const _requestedUri = Symbol('_requestedUri');
+  const _sessionManagerInstance = Symbol('_sessionManagerInstance');
+  const _sessionManager = Symbol('_sessionManager');
+  const _markSeen = Symbol('_markSeen');
+  const _socket = Symbol('_socket');
+  const _destroyed = Symbol('_destroyed');
+  io._HttpRequest = class _HttpRequest extends io._HttpInboundMessage {
+    new(response, _incoming, httpServer, httpConnection) {
+      this.response = response;
+      this[_httpServer] = httpServer;
+      this[_httpConnection] = httpConnection;
+      this[_session] = null;
+      this[_requestedUri] = null;
+      super.new(_incoming);
+      if (this.headers.protocolVersion == "1.1") {
+        let _ = this.response.headers;
+        _.chunkedTransferEncoding = true;
+        _.persistentConnection = this.headers.persistentConnection;
+      }
+      if (this[_httpServer][_sessionManagerInstance] != null) {
+        let sessionIds = this.cookies[dartx.where](dart.fn(cookie => cookie.name[dartx.toUpperCase]() == io._DART_SESSION_ID, CookieTobool()))[dartx.map](core.String)(dart.fn(cookie => cookie.value, CookieToString()));
+        for (let sessionId of sessionIds) {
+          this[_session] = this[_httpServer][_sessionManager].getSession(sessionId);
+          if (this[_session] != null) {
+            this[_session][_markSeen]();
+            break;
+          }
+        }
+      }
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get uri() {
+      return this[_incoming].uri;
+    }
+    get requestedUri() {
+      if (this[_requestedUri] == null) {
+        let proto = this.headers._get('x-forwarded-proto');
+        let scheme = proto != null ? proto[dartx.first] : io.SecureSocket.is(this[_httpConnection][_socket]) ? "https" : "http";
+        let hostList = this.headers._get('x-forwarded-host');
+        let host = null;
+        if (hostList != null) {
+          host = hostList[dartx.first];
+        } else {
+          hostList = this.headers._get('host');
+          if (hostList != null) {
+            host = hostList[dartx.first];
+          } else {
+            host = dart.str`${this[_httpServer].address.host}:${this[_httpServer].port}`;
+          }
+        }
+        this[_requestedUri] = core.Uri.parse(dart.str`${scheme}://${host}${this.uri}`);
+      }
+      return this[_requestedUri];
+    }
+    get method() {
+      return this[_incoming].method;
+    }
+    get session() {
+      if (this[_session] != null) {
+        if (dart.test(this[_session][_destroyed])) {
+          this[_session] = null;
+          return this.session;
+        }
+        return this[_session];
+      }
+      return this[_session] = this[_httpServer][_sessionManager].createSession();
+    }
+    get connectionInfo() {
+      return this[_httpConnection].connectionInfo;
+    }
+    get certificate() {
+      let socket = this[_httpConnection][_socket];
+      if (io.SecureSocket.is(socket)) return socket.peerCertificate;
+      return null;
+    }
+  };
+  io._HttpRequest[dart.implements] = () => [io.HttpRequest];
+  dart.setSignature(io._HttpRequest, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpRequest, [io.HttpResponse, io._HttpIncoming, io._HttpServer, io._HttpConnection])}),
+    fields: () => ({
+      response: io.HttpResponse,
+      [_httpServer]: io._HttpServer,
+      [_httpConnection]: io._HttpConnection,
+      [_session]: io._HttpSession,
+      [_requestedUri]: core.Uri
+    }),
+    getters: () => ({
+      uri: dart.definiteFunctionType(core.Uri, []),
+      requestedUri: dart.definiteFunctionType(core.Uri, []),
+      method: dart.definiteFunctionType(core.String, []),
+      session: dart.definiteFunctionType(io.HttpSession, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      certificate: dart.definiteFunctionType(io.X509Certificate, [])
+    }),
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+  });
+  const _responseRedirects = Symbol('_responseRedirects');
+  const _httpRequest = Symbol('_httpRequest');
+  const _httpClient = Symbol('_httpClient');
+  const _httpClientConnection = Symbol('_httpClientConnection');
+  const _openUrlFromRequest = Symbol('_openUrlFromRequest');
+  const _connectionClosed = Symbol('_connectionClosed');
+  const _shouldAuthenticateProxy = Symbol('_shouldAuthenticateProxy');
+  const _shouldAuthenticate = Symbol('_shouldAuthenticate');
+  const _proxy = Symbol('_proxy');
+  const _findProxyCredentials = Symbol('_findProxyCredentials');
+  const _findCredentials = Symbol('_findCredentials');
+  const _removeProxyCredentials = Symbol('_removeProxyCredentials');
+  const _removeCredentials = Symbol('_removeCredentials');
+  const _authenticateProxy = Symbol('_authenticateProxy');
+  const _authenticate = Symbol('_authenticate');
+  io._HttpClientResponse = class _HttpClientResponse extends io._HttpInboundMessage {
+    get redirects() {
+      return this[_httpRequest][_responseRedirects];
+    }
+    new(_incoming, httpRequest, httpClient) {
+      this[_httpRequest] = httpRequest;
+      this[_httpClient] = httpClient;
+      super.new(_incoming);
+      _incoming.uri = this[_httpRequest].uri;
+    }
+    get statusCode() {
+      return this[_incoming].statusCode;
+    }
+    get reasonPhrase() {
+      return this[_incoming].reasonPhrase;
+    }
+    get certificate() {
+      let socket = this[_httpRequest][_httpClientConnection][_socket];
+      if (io.SecureSocket.is(socket)) return socket.peerCertificate;
+      dart.throw(new core.UnsupportedError("Socket is not a SecureSocket"));
+    }
+    get cookies() {
+      if (this[_cookies] != null) return this[_cookies];
+      this[_cookies] = ListOfCookie().new();
+      let values = this.headers._get(io.HttpHeaders.SET_COOKIE);
+      if (values != null) {
+        values[dartx.forEach](dart.fn(value => {
+          this[_cookies][dartx.add](io.Cookie.fromSetCookieValue(value));
+        }, StringToNull()));
+      }
+      return this[_cookies];
+    }
+    get isRedirect() {
+      if (this[_httpRequest].method == "GET" || this[_httpRequest].method == "HEAD") {
+        return this.statusCode == io.HttpStatus.MOVED_PERMANENTLY || this.statusCode == io.HttpStatus.FOUND || this.statusCode == io.HttpStatus.SEE_OTHER || this.statusCode == io.HttpStatus.TEMPORARY_REDIRECT;
+      } else if (this[_httpRequest].method == "POST") {
+        return this.statusCode == io.HttpStatus.SEE_OTHER;
+      }
+      return false;
+    }
+    redirect(method, url, followLoops) {
+      if (method === void 0) method = null;
+      if (url === void 0) url = null;
+      if (followLoops === void 0) followLoops = null;
+      if (method == null) {
+        if (this.statusCode == io.HttpStatus.SEE_OTHER && this[_httpRequest].method == "POST") {
+          method = "GET";
+        } else {
+          method = this[_httpRequest].method;
+        }
+      }
+      if (url == null) {
+        let location = this.headers.value(io.HttpHeaders.LOCATION);
+        if (location == null) {
+          dart.throw(new core.StateError("Response has no Location header for redirect"));
+        }
+        url = core.Uri.parse(location);
+      }
+      if (followLoops != true) {
+        for (let redirect of this.redirects) {
+          if (dart.equals(redirect.location, url)) {
+            return FutureOfHttpClientResponse().error(new io.RedirectException("Redirect loop detected", this.redirects));
+          }
+        }
+      }
+      return this[_httpClient][_openUrlFromRequest](method, url, this[_httpRequest]).then(io.HttpClientResponse)(dart.fn(request => {
+        let _ = request[_responseRedirects];
+        _[dartx.addAll](this.redirects);
+        _[dartx.add](new io._RedirectInfo(this.statusCode, method, url));
+        return request.close();
+      }, _HttpClientRequestToFutureOfHttpClientResponse()));
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      if (dart.test(this[_incoming].upgraded)) {
+        this[_httpRequest][_httpClientConnection].destroy();
+        return StreamSubscriptionOfListOfint()._check(async.Stream.fromIterable([]).listen(null, {onDone: onDone}));
+      }
+      let stream = this[_incoming];
+      if (dart.test(this[_httpClient].autoUncompress) && this.headers.value(io.HttpHeaders.CONTENT_ENCODING) == "gzip") {
+        stream = io._HttpIncoming._check(stream.transform(ListOfint())(io.GZIP.decoder));
+      }
+      return stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    detachSocket() {
+      this[_httpClient][_connectionClosed](this[_httpRequest][_httpClientConnection]);
+      return this[_httpRequest][_httpClientConnection].detachSocket();
+    }
+    get connectionInfo() {
+      return this[_httpRequest].connectionInfo;
+    }
+    get [_shouldAuthenticateProxy]() {
+      let challenge = this.headers._get(io.HttpHeaders.PROXY_AUTHENTICATE);
+      return this.statusCode == io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED && challenge != null && challenge[dartx.length] == 1;
+    }
+    get [_shouldAuthenticate]() {
+      let challenge = this.headers._get(io.HttpHeaders.WWW_AUTHENTICATE);
+      return this.statusCode == io.HttpStatus.UNAUTHORIZED && challenge != null && challenge[dartx.length] == 1;
+    }
+    [_authenticate](proxyAuth) {
+      const retry = (function() {
+        return this.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => this[_httpClient][_openUrlFromRequest](this[_httpRequest].method, this[_httpRequest].uri, this[_httpRequest]).then(io.HttpClientResponse)(dart.fn(request => request.close(), _HttpClientRequestToFutureOfHttpClientResponse())), dynamicToFutureOfHttpClientResponse()));
+      }).bind(this);
+      dart.fn(retry, VoidToFutureOfHttpClientResponse());
+      const authChallenge = (function() {
+        return dart.test(proxyAuth) ? this.headers._get(io.HttpHeaders.PROXY_AUTHENTICATE) : this.headers._get(io.HttpHeaders.WWW_AUTHENTICATE);
+      }).bind(this);
+      dart.fn(authChallenge, VoidToListOfString());
+      const findCredentials = (function(scheme) {
+        return dart.test(proxyAuth) ? this[_httpClient][_findProxyCredentials](this[_httpRequest][_proxy], scheme) : this[_httpClient][_findCredentials](this[_httpRequest].uri, scheme);
+      }).bind(this);
+      dart.fn(findCredentials, _AuthenticationSchemeTo_Credentials());
+      const removeCredentials = (function(cr) {
+        if (dart.test(proxyAuth)) {
+          this[_httpClient][_removeProxyCredentials](cr);
+        } else {
+          this[_httpClient][_removeCredentials](cr);
+        }
+      }).bind(this);
+      dart.fn(removeCredentials, _CredentialsTovoid());
+      const requestAuthentication = (function(scheme, realm) {
+        if (dart.test(proxyAuth)) {
+          if (this[_httpClient][_authenticateProxy] == null) {
+            return async.Future.value(false);
+          }
+          let proxy = this[_httpRequest][_proxy];
+          return async.Future._check(dart.dsend(this[_httpClient], _authenticateProxy, proxy.host, proxy.port, dart.toString(scheme), realm));
+        } else {
+          if (this[_httpClient][_authenticate] == null) {
+            return async.Future.value(false);
+          }
+          return async.Future._check(dart.dsend(this[_httpClient], _authenticate, this[_httpRequest].uri, dart.toString(scheme), realm));
+        }
+      }).bind(this);
+      dart.fn(requestAuthentication, _AuthenticationSchemeAndStringToFuture());
+      let challenge = authChallenge();
+      dart.assert(challenge != null || challenge[dartx.length] == 1);
+      let header = io._HeaderValue.parse(challenge[dartx._get](0), {parameterSeparator: ","});
+      let scheme = io._AuthenticationScheme.fromString(header.value);
+      let realm = header.parameters[dartx._get]("realm");
+      let cr = findCredentials(scheme);
+      if (cr != null) {
+        if (dart.equals(cr.scheme, io._AuthenticationScheme.BASIC) && !dart.test(cr.used)) {
+          return retry();
+        }
+        if (dart.equals(cr.scheme, io._AuthenticationScheme.DIGEST) && (header.parameters[dartx._get]("algorithm") == null || header.parameters[dartx._get]("algorithm")[dartx.toLowerCase]() == "md5")) {
+          if (cr.nonce == null || cr.nonce == header.parameters[dartx._get]("nonce")) {
+            if (cr.nonce == null) {
+              let _ = cr;
+              _.nonce = header.parameters[dartx._get]("nonce");
+              _.algorithm = "MD5";
+              _.qop = header.parameters[dartx._get]("qop");
+              _.nonceCount = 0;
+            }
+            return retry();
+          } else if (header.parameters[dartx._get]("stale") != null && header.parameters[dartx._get]("stale")[dartx.toLowerCase]() == "true") {
+            cr.nonce = header.parameters[dartx._get]("nonce");
+            return retry();
+          }
+        }
+      }
+      if (cr != null) {
+        removeCredentials(cr);
+        cr = null;
+      }
+      return requestAuthentication(scheme, realm).then(io.HttpClientResponse)(dart.fn(credsAvailable => {
+        if (dart.test(credsAvailable)) {
+          cr = this[_httpClient][_findCredentials](this[_httpRequest].uri, scheme);
+          return retry();
+        } else {
+          return this;
+        }
+      }, dynamicToFutureOrOfHttpClientResponse()));
+    }
+  };
+  io._HttpClientResponse[dart.implements] = () => [io.HttpClientResponse];
+  dart.setSignature(io._HttpClientResponse, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientResponse, [io._HttpIncoming, io._HttpClientRequest, io._HttpClient])}),
+    fields: () => ({
+      [_httpClient]: io._HttpClient,
+      [_httpRequest]: io._HttpClientRequest
+    }),
+    getters: () => ({
+      redirects: dart.definiteFunctionType(core.List$(io.RedirectInfo), []),
+      statusCode: dart.definiteFunctionType(core.int, []),
+      reasonPhrase: dart.definiteFunctionType(core.String, []),
+      certificate: dart.definiteFunctionType(io.X509Certificate, []),
+      isRedirect: dart.definiteFunctionType(core.bool, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      [_shouldAuthenticateProxy]: dart.definiteFunctionType(core.bool, []),
+      [_shouldAuthenticate]: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      redirect: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [], [core.String, core.Uri, core.bool]),
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      [_authenticate]: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), [core.bool])
+    })
+  });
+  const _uri = Symbol('_uri');
+  const _outgoing = Symbol('_outgoing');
+  const _encodingSet = Symbol('_encodingSet');
+  const _bufferOutput = Symbol('_bufferOutput');
+  const _encodingMutable = Symbol('_encodingMutable');
+  const _encoding = Symbol('_encoding');
+  const _isConnectionClosed = Symbol('_isConnectionClosed');
+  const _doneCompleter = Symbol('_doneCompleter');
+  const _target$ = Symbol('_target');
+  const _controllerInstance = Symbol('_controllerInstance');
+  const _controllerCompleter = Symbol('_controllerCompleter');
+  const _isClosed$0 = Symbol('_isClosed');
+  const _isBound = Symbol('_isBound');
+  const _hasError$ = Symbol('_hasError');
+  const _closeTarget = Symbol('_closeTarget');
+  const _completeDoneValue = Symbol('_completeDoneValue');
+  const _completeDoneError = Symbol('_completeDoneError');
+  io._StreamSinkImpl$ = dart.generic(T => {
+    let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
+    let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
+    let StreamSinkOfT = () => (StreamSinkOfT = dart.constFn(async.StreamSink$(T)))();
+    let StreamConsumerOfT = () => (StreamConsumerOfT = dart.constFn(async.StreamConsumer$(T)))();
+    class _StreamSinkImpl extends core.Object {
+      new(target) {
+        this[_doneCompleter] = async.Completer.new();
+        this[_target$] = target;
+        this[_controllerInstance] = null;
+        this[_controllerCompleter] = null;
+        this[_isClosed$0] = false;
+        this[_isBound] = false;
+        this[_hasError$] = false;
+      }
+      add(data) {
+        T._check(data);
+        if (dart.test(this[_isClosed$0])) return;
+        this[_controller$0].add(data);
+      }
+      addError(error, stackTrace) {
+        if (stackTrace === void 0) stackTrace = null;
+        this[_controller$0].addError(error, stackTrace);
+      }
+      addStream(stream) {
+        StreamOfT()._check(stream);
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is already bound to a stream"));
+        }
+        this[_isBound] = true;
+        if (dart.test(this[_hasError$])) return this.done;
+        const targetAddStream = (function() {
+          return this[_target$].addStream(stream).whenComplete(dart.fn(() => {
+            this[_isBound] = false;
+          }, VoidToNull()));
+        }).bind(this);
+        dart.fn(targetAddStream, VoidToFuture());
+        if (this[_controllerInstance] == null) return targetAddStream();
+        let future = this[_controllerCompleter].future;
+        this[_controllerInstance].close();
+        return future.then(dart.dynamic)(dart.fn(_ => targetAddStream(), dynamicToFuture()));
+      }
+      flush() {
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is bound to a stream"));
+        }
+        if (this[_controllerInstance] == null) return async.Future.value(this);
+        this[_isBound] = true;
+        let future = this[_controllerCompleter].future;
+        this[_controllerInstance].close();
+        return future.whenComplete(dart.fn(() => {
+          this[_isBound] = false;
+        }, VoidToNull()));
+      }
+      close() {
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is bound to a stream"));
+        }
+        if (!dart.test(this[_isClosed$0])) {
+          this[_isClosed$0] = true;
+          if (this[_controllerInstance] != null) {
+            this[_controllerInstance].close();
+          } else {
+            this[_closeTarget]();
+          }
+        }
+        return this.done;
+      }
+      [_closeTarget]() {
+        this[_target$].close().then(dart.void)(dart.bind(this, _completeDoneValue), {onError: dart.bind(this, _completeDoneError)});
+      }
+      get done() {
+        return this[_doneCompleter].future;
+      }
+      [_completeDoneValue](value) {
+        if (!dart.test(this[_doneCompleter].isCompleted)) {
+          this[_doneCompleter].complete(value);
+        }
+      }
+      [_completeDoneError](error, stackTrace) {
+        if (!dart.test(this[_doneCompleter].isCompleted)) {
+          this[_hasError$] = true;
+          this[_doneCompleter].completeError(error, stackTrace);
+        }
+      }
+      get [_controller$0]() {
+        if (dart.test(this[_isBound])) {
+          dart.throw(new core.StateError("StreamSink is bound to a stream"));
+        }
+        if (dart.test(this[_isClosed$0])) {
+          dart.throw(new core.StateError("StreamSink is closed"));
+        }
+        if (this[_controllerInstance] == null) {
+          this[_controllerInstance] = StreamControllerOfT().new({sync: true});
+          this[_controllerCompleter] = async.Completer.new();
+          this[_target$].addStream(this[_controller$0].stream).then(dart.dynamic)(dart.fn(_ => {
+            if (dart.test(this[_isBound])) {
+              this[_controllerCompleter].complete(this);
+              this[_controllerCompleter] = null;
+              this[_controllerInstance] = null;
+            } else {
+              this[_closeTarget]();
+            }
+          }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
+              if (dart.test(this[_isBound])) {
+                this[_controllerCompleter].completeError(error, core.StackTrace._check(stackTrace));
+                this[_controllerCompleter] = null;
+                this[_controllerInstance] = null;
+              } else {
+                this[_completeDoneError](error, core.StackTrace._check(stackTrace));
+              }
+            }, dynamicAnddynamicToNull())});
+        }
+        return this[_controllerInstance];
+      }
+    }
+    dart.addTypeTests(_StreamSinkImpl);
+    _StreamSinkImpl[dart.implements] = () => [StreamSinkOfT()];
+    dart.setSignature(_StreamSinkImpl, {
+      constructors: () => ({new: dart.definiteFunctionType(io._StreamSinkImpl$(T), [StreamConsumerOfT()])}),
+      fields: () => ({
+        [_target$]: StreamConsumerOfT(),
+        [_doneCompleter]: async.Completer,
+        [_controllerInstance]: StreamControllerOfT(),
+        [_controllerCompleter]: async.Completer,
+        [_isClosed$0]: core.bool,
+        [_isBound]: core.bool,
+        [_hasError$]: core.bool
+      }),
+      getters: () => ({
+        done: dart.definiteFunctionType(async.Future, []),
+        [_controller$0]: dart.definiteFunctionType(async.StreamController$(T), [])
+      }),
+      methods: () => ({
+        add: dart.definiteFunctionType(dart.void, [T]),
+        addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+        addStream: dart.definiteFunctionType(async.Future, [StreamOfT()]),
+        flush: dart.definiteFunctionType(async.Future, []),
+        close: dart.definiteFunctionType(async.Future, []),
+        [_closeTarget]: dart.definiteFunctionType(dart.void, []),
+        [_completeDoneValue]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+        [_completeDoneError]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace])
+      })
+    });
+    return _StreamSinkImpl;
+  });
+  io._StreamSinkImpl = _StreamSinkImpl();
+  io._IOSinkImpl = class _IOSinkImpl extends io._StreamSinkImpl$(core.List$(core.int)) {
+    new(target, encoding) {
+      this[_encoding] = encoding;
+      this[_encodingMutable] = true;
+      super.new(target);
+    }
+    get encoding() {
+      return this[_encoding];
+    }
+    set encoding(value) {
+      if (!dart.test(this[_encodingMutable])) {
+        dart.throw(new core.StateError("IOSink encoding is not mutable"));
+      }
+      this[_encoding] = value;
+    }
+    write(obj) {
+      let string = dart.str`${obj}`;
+      if (dart.test(string[dartx.isEmpty])) return;
+      this.add(this[_encoding].encode(string));
+    }
+    writeAll(objects, separator) {
+      if (separator === void 0) separator = "";
+      let iterator = objects[dartx.iterator];
+      if (!dart.test(iterator.moveNext())) return;
+      if (dart.test(separator[dartx.isEmpty])) {
+        do {
+          this.write(iterator.current);
+        } while (dart.test(iterator.moveNext()));
+      } else {
+        this.write(iterator.current);
+        while (dart.test(iterator.moveNext())) {
+          this.write(separator);
+          this.write(iterator.current);
+        }
+      }
+    }
+    writeln(object) {
+      if (object === void 0) object = "";
+      this.write(object);
+      this.write("\n");
+    }
+    writeCharCode(charCode) {
+      this.write(core.String.fromCharCode(charCode));
+    }
+  };
+  dart.addSimpleTypeTests(io._IOSinkImpl);
+  io._IOSinkImpl[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io._IOSinkImpl, {
+    constructors: () => ({new: dart.definiteFunctionType(io._IOSinkImpl, [StreamConsumerOfListOfint(), convert.Encoding])}),
+    fields: () => ({
+      [_encoding]: convert.Encoding,
+      [_encodingMutable]: core.bool
+    }),
+    getters: () => ({encoding: dart.definiteFunctionType(convert.Encoding, [])}),
+    setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+    methods: () => ({
+      write: dart.definiteFunctionType(dart.void, [core.Object]),
+      writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+      writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+      writeCharCode: dart.definiteFunctionType(dart.void, [core.int])
+    })
+  });
+  io._HttpOutboundMessage$ = dart.generic(T => {
+    class _HttpOutboundMessage extends io._IOSinkImpl {
+      new(uri, protocolVersion, outgoing, opts) {
+        let initialHeaders = opts && 'initialHeaders' in opts ? opts.initialHeaders : null;
+        this[_uri] = uri;
+        this.headers = new io._HttpHeaders(protocolVersion, {defaultPortForScheme: uri.scheme == 'https' ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT, initialHeaders: initialHeaders});
+        this[_outgoing] = outgoing;
+        this[_encodingSet] = false;
+        this[_bufferOutput] = true;
+        super.new(outgoing, null);
+        this[_outgoing].outbound = this;
+        this[_encodingMutable] = false;
+      }
+      get contentLength() {
+        return this.headers.contentLength;
+      }
+      set contentLength(contentLength) {
+        this.headers.contentLength = contentLength;
+      }
+      get persistentConnection() {
+        return this.headers.persistentConnection;
+      }
+      set persistentConnection(p) {
+        this.headers.persistentConnection = p;
+      }
+      get bufferOutput() {
+        return this[_bufferOutput];
+      }
+      set bufferOutput(bufferOutput) {
+        if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+        this[_bufferOutput] = bufferOutput;
+      }
+      get encoding() {
+        if (dart.test(this[_encodingSet]) && dart.test(this[_outgoing].headersWritten)) {
+          return this[_encoding];
+        }
+        let charset = null;
+        if (this.headers.contentType != null && this.headers.contentType.charset != null) {
+          charset = this.headers.contentType.charset;
+        } else {
+          charset = "iso-8859-1";
+        }
+        return convert.Encoding.getByName(core.String._check(charset));
+      }
+      set encoding(value) {
+        super.encoding = value;
+      }
+      add(data) {
+        if (data[dartx.length] == 0) return;
+        super.add(data);
+      }
+      write(obj) {
+        if (!dart.test(this[_encodingSet])) {
+          this[_encoding] = this.encoding;
+          this[_encodingSet] = true;
+        }
+        super.write(obj);
+      }
+      get [_isConnectionClosed]() {
+        return false;
+      }
+    }
+    dart.addTypeTests(_HttpOutboundMessage);
+    dart.setSignature(_HttpOutboundMessage, {
+      constructors: () => ({new: dart.definiteFunctionType(io._HttpOutboundMessage$(T), [core.Uri, core.String, io._HttpOutgoing], {initialHeaders: io._HttpHeaders})}),
+      fields: () => ({
+        [_encodingSet]: core.bool,
+        [_bufferOutput]: core.bool,
+        [_uri]: core.Uri,
+        [_outgoing]: io._HttpOutgoing,
+        headers: io._HttpHeaders
+      }),
+      getters: () => ({
+        contentLength: dart.definiteFunctionType(core.int, []),
+        persistentConnection: dart.definiteFunctionType(core.bool, []),
+        bufferOutput: dart.definiteFunctionType(core.bool, []),
+        [_isConnectionClosed]: dart.definiteFunctionType(core.bool, [])
+      }),
+      setters: () => ({
+        contentLength: dart.definiteFunctionType(dart.void, [core.int]),
+        persistentConnection: dart.definiteFunctionType(dart.void, [core.bool]),
+        bufferOutput: dart.definiteFunctionType(dart.void, [core.bool])
+      })
+    });
+    return _HttpOutboundMessage;
+  });
+  io._HttpOutboundMessage = _HttpOutboundMessage();
+  const _statusCode = Symbol('_statusCode');
+  const _reasonPhrase = Symbol('_reasonPhrase');
+  const _deadline = Symbol('_deadline');
+  const _deadlineTimer = Symbol('_deadlineTimer');
+  const _isClosing = Symbol('_isClosing');
+  const _findReasonPhrase = Symbol('_findReasonPhrase');
+  const _isNew = Symbol('_isNew');
+  const _writeHeader = Symbol('_writeHeader');
+  io._HttpResponse = class _HttpResponse extends io._HttpOutboundMessage$(io.HttpResponse) {
+    new(uri, protocolVersion, outgoing, defaultHeaders, serverHeader) {
+      this[_statusCode] = 200;
+      this[_reasonPhrase] = null;
+      this[_cookies] = null;
+      this[_httpRequest] = null;
+      this[_deadline] = null;
+      this[_deadlineTimer] = null;
+      super.new(uri, protocolVersion, outgoing, {initialHeaders: io._HttpHeaders._check(defaultHeaders)});
+      if (serverHeader != null) this.headers.set('server', serverHeader);
+    }
+    get [_isConnectionClosed]() {
+      return this[_httpRequest][_httpConnection][_isClosing];
+    }
+    get cookies() {
+      if (this[_cookies] == null) this[_cookies] = ListOfCookie().new();
+      return this[_cookies];
+    }
+    get statusCode() {
+      return this[_statusCode];
+    }
+    set statusCode(statusCode) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this[_statusCode] = statusCode;
+    }
+    get reasonPhrase() {
+      return this[_findReasonPhrase](this.statusCode);
+    }
+    set reasonPhrase(reasonPhrase) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this[_reasonPhrase] = reasonPhrase;
+    }
+    redirect(location, opts) {
+      let status = opts && 'status' in opts ? opts.status : io.HttpStatus.MOVED_TEMPORARILY;
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Header already sent"));
+      this.statusCode = status;
+      this.headers.set("location", dart.toString(location));
+      return this.close();
+    }
+    detachSocket(opts) {
+      let writeHeaders = opts && 'writeHeaders' in opts ? opts.writeHeaders : true;
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Headers already sent"));
+      this.deadline = null;
+      let future = this[_httpRequest][_httpConnection].detachSocket();
+      if (dart.test(writeHeaders)) {
+        let headersFuture = this[_outgoing].writeHeaders({drainRequest: false, setOutgoing: false});
+        dart.assert(headersFuture == null);
+      } else {
+        this[_outgoing].headersWritten = true;
+      }
+      this.close();
+      this.done.catchError(dart.fn(_ => {
+      }, dynamicToNull$()));
+      return future;
+    }
+    get connectionInfo() {
+      return this[_httpRequest].connectionInfo;
+    }
+    get deadline() {
+      return this[_deadline];
+    }
+    set deadline(d) {
+      if (this[_deadlineTimer] != null) this[_deadlineTimer].cancel();
+      this[_deadline] = d;
+      if (this[_deadline] == null) return;
+      this[_deadlineTimer] = async.Timer.new(this[_deadline], dart.fn(() => {
+        this[_httpRequest][_httpConnection].destroy();
+      }, VoidToNull()));
+    }
+    [_writeHeader]() {
+      let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+      let offset = 0;
+      function write(bytes) {
+        let len = bytes[dartx.length];
+        for (let i = 0; i < dart.notNull(len); i++) {
+          buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+        }
+        offset = dart.notNull(offset) + dart.notNull(len);
+      }
+      dart.fn(write, ListOfintTovoid$());
+      if (this.headers.protocolVersion == "1.1") {
+        write(io._Const.HTTP11);
+      } else {
+        write(io._Const.HTTP10);
+      }
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(dart.toString(this.statusCode)[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(this.reasonPhrase[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      let session = this[_httpRequest][_session];
+      if (session != null && !dart.test(session[_destroyed])) {
+        session[_isNew] = false;
+        let found = false;
+        for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
+          if (this.cookies[dartx._get](i).name[dartx.toUpperCase]() == io._DART_SESSION_ID) {
+            let _ = this.cookies[dartx._get](i);
+            _.value = session.id;
+            _.httpOnly = true;
+            _.path = "/";
+            found = true;
+          }
+        }
+        if (!found) {
+          let cookie = io.Cookie.new(io._DART_SESSION_ID, session.id);
+          this.cookies[dartx.add](((() => {
+            cookie.httpOnly = true;
+            cookie.path = "/";
+            return cookie;
+          })()));
+        }
+      }
+      if (this[_cookies] != null) {
+        this[_cookies][dartx.forEach](dart.fn(cookie => {
+          this.headers.add(io.HttpHeaders.SET_COOKIE, cookie);
+        }, CookieToNull()));
+      }
+      this.headers[_finalize]();
+      offset = this.headers[_write](buffer, offset);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      this[_outgoing].setHeader(buffer, offset);
+    }
+    [_findReasonPhrase](statusCode) {
+      if (this[_reasonPhrase] != null) {
+        return this[_reasonPhrase];
+      }
+      switch (statusCode) {
+        case io.HttpStatus.CONTINUE:
+        {
+          return "Continue";
+        }
+        case io.HttpStatus.SWITCHING_PROTOCOLS:
+        {
+          return "Switching Protocols";
+        }
+        case io.HttpStatus.OK:
+        {
+          return "OK";
+        }
+        case io.HttpStatus.CREATED:
+        {
+          return "Created";
+        }
+        case io.HttpStatus.ACCEPTED:
+        {
+          return "Accepted";
+        }
+        case io.HttpStatus.NON_AUTHORITATIVE_INFORMATION:
+        {
+          return "Non-Authoritative Information";
+        }
+        case io.HttpStatus.NO_CONTENT:
+        {
+          return "No Content";
+        }
+        case io.HttpStatus.RESET_CONTENT:
+        {
+          return "Reset Content";
+        }
+        case io.HttpStatus.PARTIAL_CONTENT:
+        {
+          return "Partial Content";
+        }
+        case io.HttpStatus.MULTIPLE_CHOICES:
+        {
+          return "Multiple Choices";
+        }
+        case io.HttpStatus.MOVED_PERMANENTLY:
+        {
+          return "Moved Permanently";
+        }
+        case io.HttpStatus.FOUND:
+        {
+          return "Found";
+        }
+        case io.HttpStatus.SEE_OTHER:
+        {
+          return "See Other";
+        }
+        case io.HttpStatus.NOT_MODIFIED:
+        {
+          return "Not Modified";
+        }
+        case io.HttpStatus.USE_PROXY:
+        {
+          return "Use Proxy";
+        }
+        case io.HttpStatus.TEMPORARY_REDIRECT:
+        {
+          return "Temporary Redirect";
+        }
+        case io.HttpStatus.BAD_REQUEST:
+        {
+          return "Bad Request";
+        }
+        case io.HttpStatus.UNAUTHORIZED:
+        {
+          return "Unauthorized";
+        }
+        case io.HttpStatus.PAYMENT_REQUIRED:
+        {
+          return "Payment Required";
+        }
+        case io.HttpStatus.FORBIDDEN:
+        {
+          return "Forbidden";
+        }
+        case io.HttpStatus.NOT_FOUND:
+        {
+          return "Not Found";
+        }
+        case io.HttpStatus.METHOD_NOT_ALLOWED:
+        {
+          return "Method Not Allowed";
+        }
+        case io.HttpStatus.NOT_ACCEPTABLE:
+        {
+          return "Not Acceptable";
+        }
+        case io.HttpStatus.PROXY_AUTHENTICATION_REQUIRED:
+        {
+          return "Proxy Authentication Required";
+        }
+        case io.HttpStatus.REQUEST_TIMEOUT:
+        {
+          return "Request Time-out";
+        }
+        case io.HttpStatus.CONFLICT:
+        {
+          return "Conflict";
+        }
+        case io.HttpStatus.GONE:
+        {
+          return "Gone";
+        }
+        case io.HttpStatus.LENGTH_REQUIRED:
+        {
+          return "Length Required";
+        }
+        case io.HttpStatus.PRECONDITION_FAILED:
+        {
+          return "Precondition Failed";
+        }
+        case io.HttpStatus.REQUEST_ENTITY_TOO_LARGE:
+        {
+          return "Request Entity Too Large";
+        }
+        case io.HttpStatus.REQUEST_URI_TOO_LONG:
+        {
+          return "Request-URI Too Large";
+        }
+        case io.HttpStatus.UNSUPPORTED_MEDIA_TYPE:
+        {
+          return "Unsupported Media Type";
+        }
+        case io.HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE:
+        {
+          return "Requested range not satisfiable";
+        }
+        case io.HttpStatus.EXPECTATION_FAILED:
+        {
+          return "Expectation Failed";
+        }
+        case io.HttpStatus.INTERNAL_SERVER_ERROR:
+        {
+          return "Internal Server Error";
+        }
+        case io.HttpStatus.NOT_IMPLEMENTED:
+        {
+          return "Not Implemented";
+        }
+        case io.HttpStatus.BAD_GATEWAY:
+        {
+          return "Bad Gateway";
+        }
+        case io.HttpStatus.SERVICE_UNAVAILABLE:
+        {
+          return "Service Unavailable";
+        }
+        case io.HttpStatus.GATEWAY_TIMEOUT:
+        {
+          return "Gateway Time-out";
+        }
+        case io.HttpStatus.HTTP_VERSION_NOT_SUPPORTED:
+        {
+          return "Http Version not supported";
+        }
+        default:
+        {
+          return dart.str`Status ${statusCode}`;
+        }
+      }
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpResponse);
+  io._HttpResponse[dart.implements] = () => [io.HttpResponse];
+  dart.setSignature(io._HttpResponse, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpResponse, [core.Uri, core.String, io._HttpOutgoing, io.HttpHeaders, core.String])}),
+    fields: () => ({
+      [_statusCode]: core.int,
+      [_reasonPhrase]: core.String,
+      [_cookies]: ListOfCookie(),
+      [_httpRequest]: io._HttpRequest,
+      [_deadline]: core.Duration,
+      [_deadlineTimer]: async.Timer
+    }),
+    getters: () => ({
+      cookies: dart.definiteFunctionType(core.List$(io.Cookie), []),
+      statusCode: dart.definiteFunctionType(core.int, []),
+      reasonPhrase: dart.definiteFunctionType(core.String, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      deadline: dart.definiteFunctionType(core.Duration, [])
+    }),
+    setters: () => ({
+      statusCode: dart.definiteFunctionType(dart.void, [core.int]),
+      reasonPhrase: dart.definiteFunctionType(dart.void, [core.String]),
+      deadline: dart.definiteFunctionType(dart.void, [core.Duration])
+    }),
+    methods: () => ({
+      redirect: dart.definiteFunctionType(async.Future, [core.Uri], {status: core.int}),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), [], {writeHeaders: core.bool}),
+      [_writeHeader]: dart.definiteFunctionType(dart.void, []),
+      [_findReasonPhrase]: dart.definiteFunctionType(core.String, [core.int])
+    })
+  });
+  const _responseCompleter = Symbol('_responseCompleter');
+  const _response = Symbol('_response');
+  const _followRedirects = Symbol('_followRedirects');
+  const _maxRedirects = Symbol('_maxRedirects');
+  const _onIncoming = Symbol('_onIncoming');
+  const _onError$ = Symbol('_onError');
+  const _proxyTunnel = Symbol('_proxyTunnel');
+  const _requestUri = Symbol('_requestUri');
+  io._HttpClientRequest = class _HttpClientRequest extends io._HttpOutboundMessage$(io.HttpClientResponse) {
+    new(outgoing, uri, method, proxy, httpClient, httpClientConnection) {
+      this.cookies = ListOfCookie().new();
+      this[_responseCompleter] = CompleterOfHttpClientResponse().new();
+      this[_responseRedirects] = JSArrayOfRedirectInfo().of([]);
+      this.method = method;
+      this[_proxy] = proxy;
+      this[_httpClient] = httpClient;
+      this[_httpClientConnection] = httpClientConnection;
+      this.uri = uri;
+      this[_response] = null;
+      this[_followRedirects] = true;
+      this[_maxRedirects] = 5;
+      super.new(uri, "1.1", outgoing);
+      if (this.method == "GET" || this.method == "HEAD") {
+        this.contentLength = 0;
+      } else {
+        this.headers.chunkedTransferEncoding = true;
+      }
+    }
+    get done() {
+      if (this[_response] == null) {
+        this[_response] = async.Future.wait(dart.dynamic)(JSArrayOfFuture().of([this[_responseCompleter].future, super.done]), {eagerError: true}).then(io.HttpClientResponse)(dart.fn(list => FutureOrOfHttpClientResponse()._check(list[dartx._get](0)), ListToFutureOrOfHttpClientResponse()));
+      }
+      return this[_response];
+    }
+    close() {
+      super.close();
+      return this.done;
+    }
+    get maxRedirects() {
+      return this[_maxRedirects];
+    }
+    set maxRedirects(maxRedirects) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Request already sent"));
+      this[_maxRedirects] = maxRedirects;
+    }
+    get followRedirects() {
+      return this[_followRedirects];
+    }
+    set followRedirects(followRedirects) {
+      if (dart.test(this[_outgoing].headersWritten)) dart.throw(new core.StateError("Request already sent"));
+      this[_followRedirects] = followRedirects;
+    }
+    get connectionInfo() {
+      return this[_httpClientConnection].connectionInfo;
+    }
+    [_onIncoming](incoming) {
+      let response = new io._HttpClientResponse(incoming, this, this[_httpClient]);
+      let future = null;
+      if (dart.test(this.followRedirects) && dart.test(response.isRedirect)) {
+        if (dart.notNull(response.redirects[dartx.length]) < dart.notNull(this.maxRedirects)) {
+          future = response.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => response.redirect(), dynamicToFutureOfHttpClientResponse()));
+        } else {
+          future = response.drain(dart.dynamic)().then(io.HttpClientResponse)(dart.fn(_ => FutureOfHttpClientResponse().error(new io.RedirectException("Redirect limit exceeded", response.redirects)), dynamicToFutureOfHttpClientResponse()));
+        }
+      } else if (dart.test(response[_shouldAuthenticateProxy])) {
+        future = response[_authenticate](true);
+      } else if (dart.test(response[_shouldAuthenticate])) {
+        future = response[_authenticate](false);
+      } else {
+        future = FutureOfHttpClientResponse().value(response);
+      }
+      future.then(dart.void)(dart.fn(v => this[_responseCompleter].complete(v), HttpClientResponseTovoid()), {onError: dart.bind(this[_responseCompleter], 'completeError')});
+    }
+    [_onError$](error, stackTrace) {
+      this[_responseCompleter].completeError(error, stackTrace);
+    }
+    [_requestUri]() {
+      const uriStartingFromPath = (function() {
+        let result = this.uri.path;
+        if (dart.test(result[dartx.isEmpty])) result = "/";
+        if (dart.test(this.uri.hasQuery)) {
+          result = dart.str`${result}?${this.uri.query}`;
+        }
+        return result;
+      }).bind(this);
+      dart.fn(uriStartingFromPath, VoidToString$());
+      if (dart.test(this[_proxy].isDirect)) {
+        return uriStartingFromPath();
+      } else {
+        if (this.method == "CONNECT") {
+          return dart.str`${this.uri.host}:${this.uri.port}`;
+        } else {
+          if (dart.test(this[_httpClientConnection][_proxyTunnel])) {
+            return uriStartingFromPath();
+          } else {
+            return dart.toString(this.uri.removeFragment());
+          }
+        }
+      }
+    }
+    [_writeHeader]() {
+      let buffer = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+      let offset = 0;
+      function write(bytes) {
+        let len = bytes[dartx.length];
+        for (let i = 0; i < dart.notNull(len); i++) {
+          buffer[dartx._set](dart.notNull(offset) + i, bytes[dartx._get](i));
+        }
+        offset = dart.notNull(offset) + dart.notNull(len);
+      }
+      dart.fn(write, ListOfintTovoid$());
+      write(this.method[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(this[_requestUri]()[dartx.codeUnits]);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.SP);
+      write(io._Const.HTTP11);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      if (!dart.test(this.cookies[dartx.isEmpty])) {
+        let sb = new core.StringBuffer();
+        for (let i = 0; i < dart.notNull(this.cookies[dartx.length]); i++) {
+          if (i > 0) sb.write("; ");
+          sb.write(this.cookies[dartx._get](i).name);
+          sb.write("=");
+          sb.write(this.cookies[dartx._get](i).value);
+        }
+        this.headers.add(io.HttpHeaders.COOKIE, sb.toString());
+      }
+      this.headers[_finalize]();
+      offset = this.headers[_write](buffer, offset);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.CR);
+      buffer[dartx._set]((() => {
+        let x = offset;
+        offset = dart.notNull(x) + 1;
+        return x;
+      })(), io._CharCode.LF);
+      this[_outgoing].setHeader(buffer, offset);
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpClientRequest);
+  io._HttpClientRequest[dart.implements] = () => [io.HttpClientRequest];
+  dart.setSignature(io._HttpClientRequest, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientRequest, [io._HttpOutgoing, core.Uri, core.String, io._Proxy, io._HttpClient, io._HttpClientConnection])}),
+    fields: () => ({
+      method: core.String,
+      uri: core.Uri,
+      cookies: ListOfCookie(),
+      [_httpClient]: io._HttpClient,
+      [_httpClientConnection]: io._HttpClientConnection,
+      [_responseCompleter]: CompleterOfHttpClientResponse(),
+      [_proxy]: io._Proxy,
+      [_response]: FutureOfHttpClientResponse(),
+      [_followRedirects]: core.bool,
+      [_maxRedirects]: core.int,
+      [_responseRedirects]: ListOfRedirectInfo()
+    }),
+    getters: () => ({
+      done: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), []),
+      maxRedirects: dart.definiteFunctionType(core.int, []),
+      followRedirects: dart.definiteFunctionType(core.bool, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])
+    }),
+    setters: () => ({
+      maxRedirects: dart.definiteFunctionType(dart.void, [core.int]),
+      followRedirects: dart.definiteFunctionType(dart.void, [core.bool])
+    }),
+    methods: () => ({
+      close: dart.definiteFunctionType(async.Future$(io.HttpClientResponse), []),
+      [_onIncoming]: dart.definiteFunctionType(dart.void, [io._HttpIncoming]),
+      [_onError$]: dart.definiteFunctionType(dart.void, [dart.dynamic, core.StackTrace]),
+      [_requestUri]: dart.definiteFunctionType(core.String, []),
+      [_writeHeader]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _consume = Symbol('_consume');
+  io._HttpGZipSink = class _HttpGZipSink extends convert.ByteConversionSink {
+    new(consume) {
+      this[_consume] = consume;
+      super.new();
+    }
+    add(chunk) {
+      dart.dcall(this[_consume], chunk);
+    }
+    addSlice(chunk, start, end, isLast) {
+      if (typed_data.Uint8List.is(chunk)) {
+        dart.dcall(this[_consume], typed_data.Uint8List.view(chunk[dartx.buffer], start, dart.notNull(end) - dart.notNull(start)));
+      } else {
+        dart.dcall(this[_consume], chunk[dartx.sublist](start, dart.notNull(end) - dart.notNull(start)));
+      }
+    }
+    close() {}
+  };
+  dart.setSignature(io._HttpGZipSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpGZipSink, [core.Function])}),
+    fields: () => ({[_consume]: core.Function}),
+    methods: () => ({
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addSlice: dart.definiteFunctionType(dart.void, [ListOfint(), core.int, core.int, core.bool]),
+      close: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _closeFuture = Symbol('_closeFuture');
+  const _pendingChunkedFooter = Symbol('_pendingChunkedFooter');
+  const _bytesWritten = Symbol('_bytesWritten');
+  const _gzip = Symbol('_gzip');
+  const _gzipSink = Symbol('_gzipSink');
+  const _gzipAdd = Symbol('_gzipAdd');
+  const _gzipBuffer = Symbol('_gzipBuffer');
+  const _gzipBufferLength = Symbol('_gzipBufferLength');
+  const _socketError = Symbol('_socketError');
+  const _addGZipChunk = Symbol('_addGZipChunk');
+  const _addChunk$ = Symbol('_addChunk');
+  const _chunkHeader = Symbol('_chunkHeader');
+  const _ignoreError = Symbol('_ignoreError');
+  let const$68;
+  io._HttpOutgoing = class _HttpOutgoing extends core.Object {
+    new(socket) {
+      this[_doneCompleter] = async.Completer.new();
+      this.socket = socket;
+      this.ignoreBody = false;
+      this.headersWritten = false;
+      this[_buffer$] = null;
+      this[_length$2] = 0;
+      this[_closeFuture] = null;
+      this.chunked = false;
+      this[_pendingChunkedFooter] = 0;
+      this.contentLength = null;
+      this[_bytesWritten] = 0;
+      this[_gzip] = false;
+      this[_gzipSink] = null;
+      this[_gzipAdd] = null;
+      this[_gzipBuffer] = null;
+      this[_gzipBufferLength] = 0;
+      this[_socketError] = false;
+      this.outbound = null;
+    }
+    writeHeaders(opts) {
+      let drainRequest = opts && 'drainRequest' in opts ? opts.drainRequest : true;
+      let setOutgoing = opts && 'setOutgoing' in opts ? opts.setOutgoing : true;
+      const write = (function() {
+        try {
+          this.outbound[_writeHeader]();
+        } catch (_) {
+          return async.Future.error(new io.HttpException(dart.str`Headers size exceeded the of '${io._OUTGOING_BUFFER_SIZE}'` + " bytes"));
+        }
+
+        return null;
+      }).bind(this);
+      dart.fn(write, VoidToFuture());
+      if (dart.test(this.headersWritten)) return null;
+      this.headersWritten = true;
+      let drainFuture = null;
+      let gzip = false;
+      if (io._HttpResponse.is(this.outbound)) {
+        let response = io._HttpResponse._check(this.outbound);
+        if (dart.test(response[_httpRequest][_httpServer].autoCompress) && dart.test(this.outbound.bufferOutput) && dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+          let acceptEncodings = response[_httpRequest].headers._get(io.HttpHeaders.ACCEPT_ENCODING);
+          let contentEncoding = this.outbound.headers._get(io.HttpHeaders.CONTENT_ENCODING);
+          if (acceptEncodings != null && dart.test(acceptEncodings[dartx.expand](dart.dynamic)(dart.fn(list => core.Iterable._check(dart.dsend(list, 'split', ",")), dynamicToIterable()))[dartx.any](dart.fn(encoding => dart.equals(dart.dsend(dart.dsend(encoding, 'trim'), 'toLowerCase'), "gzip"), dynamicTobool$()))) && contentEncoding == null) {
+            this.outbound.headers.set(io.HttpHeaders.CONTENT_ENCODING, "gzip");
+            gzip = true;
+          }
+        }
+        if (dart.test(drainRequest) && !dart.test(response[_httpRequest][_incoming].hasSubscriber)) {
+          drainFuture = response[_httpRequest].drain(dart.dynamic)().catchError(dart.fn(_ => {
+          }, dynamicToNull$()));
+        }
+      } else {
+        drainRequest = false;
+      }
+      if (dart.test(this.ignoreBody)) {
+        return write();
+      }
+      if (dart.test(setOutgoing)) {
+        let contentLength = this.outbound.headers.contentLength;
+        if (dart.test(this.outbound.headers.chunkedTransferEncoding)) {
+          this.chunked = true;
+          if (gzip) this.gzip = true;
+        } else if (dart.notNull(contentLength) >= 0) {
+          this.contentLength = contentLength;
+        }
+      }
+      if (drainFuture != null) {
+        return drainFuture.then(dart.dynamic)(dart.fn(_ => write(), dynamicToFuture()));
+      }
+      return write();
+    }
+    addStream(stream) {
+      if (dart.test(this[_socketError])) {
+        stream.listen(null).cancel();
+        return async.Future.value(this.outbound);
+      }
+      if (dart.test(this.ignoreBody)) {
+        stream.drain(dart.dynamic)().catchError(dart.fn(_ => {
+        }, dynamicToNull$()));
+        let future = this.writeHeaders();
+        if (future != null) {
+          return future.then(dart.dynamic)(dart.fn(_ => this.close(), dynamicToFuture()));
+        }
+        return this.close();
+      }
+      let sub = null;
+      let controller = async.StreamController.new({onPause: dart.fn(() => dart.dsend(sub, 'pause'), VoidTovoid$()), onResume: dart.fn(() => dart.dsend(sub, 'resume'), VoidTovoid$()), sync: true});
+      const onData = (function(data) {
+        if (dart.test(this[_socketError])) return;
+        if (dart.equals(dart.dload(data, 'length'), 0)) return;
+        if (dart.test(this.chunked)) {
+          if (dart.test(this[_gzip])) {
+            this[_gzipAdd] = dart.bind(controller, 'add');
+            this[_addGZipChunk](data, dart.bind(this[_gzipSink], 'add'));
+            this[_gzipAdd] = null;
+            return;
+          }
+          this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), dart.bind(controller, 'add'));
+          this[_pendingChunkedFooter] = 2;
+        } else {
+          if (this.contentLength != null) {
+            this[_bytesWritten] = dart.notNull(this[_bytesWritten]) + dart.notNull(core.num._check(dart.dload(data, 'length')));
+            if (dart.notNull(this[_bytesWritten]) > dart.notNull(this.contentLength)) {
+              controller.addError(new io.HttpException("Content size exceeds specified contentLength. " + dart.str`${this[_bytesWritten]} bytes written while expected ` + dart.str`${this.contentLength}. ` + dart.str`[${core.String.fromCharCodes(IterableOfint()._check(data))}]`));
+              return;
+            }
+          }
+        }
+        this[_addChunk$](data, dart.bind(controller, 'add'));
+      }).bind(this);
+      dart.fn(onData, dynamicTovoid$());
+      sub = stream.listen(onData, {onError: dart.bind(controller, 'addError'), onDone: dart.bind(controller, 'close'), cancelOnError: true});
+      if (!dart.test(this.headersWritten)) {
+        let future = this.writeHeaders();
+        if (future != null) {
+          dart.dsend(sub, 'pause', future);
+        }
+      }
+      return this.socket.addStream(StreamOfListOfint()._check(controller.stream)).then(io._HttpOutboundMessage)(dart.fn(_ => this.outbound, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+          if (dart.test(this[_gzip])) this[_gzipSink].close();
+          this[_socketError] = true;
+          this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
+          if (dart.test(this[_ignoreError](error))) {
+            return this.outbound;
+          } else {
+            dart.throw(error);
+          }
+        }, dynamicAnddynamicTo_HttpOutboundMessage())});
+    }
+    close() {
+      if (this[_closeFuture] != null) return this[_closeFuture];
+      if (dart.test(this[_socketError])) return async.Future.value(this.outbound);
+      if (dart.test(this.outbound[_isConnectionClosed])) return async.Future.value(this.outbound);
+      if (!dart.test(this.headersWritten) && !dart.test(this.ignoreBody)) {
+        if (this.outbound.headers.contentLength == -1) {
+          this.outbound.headers.chunkedTransferEncoding = false;
+          this.outbound.headers.contentLength = 0;
+        } else if (dart.notNull(this.outbound.headers.contentLength) > 0) {
+          let error = new io.HttpException("No content even though contentLength was specified to be " + dart.str`greater than 0: ${this.outbound.headers.contentLength}.`, {uri: this.outbound[_uri]});
+          this[_doneCompleter].completeError(error);
+          return this[_closeFuture] = async.Future.error(error);
+        }
+      }
+      if (this.contentLength != null) {
+        if (dart.notNull(this[_bytesWritten]) < dart.notNull(this.contentLength)) {
+          let error = new io.HttpException("Content size below specified contentLength. " + dart.str` ${this[_bytesWritten]} bytes written but expected ` + dart.str`${this.contentLength}.`, {uri: this.outbound[_uri]});
+          this[_doneCompleter].completeError(error);
+          return this[_closeFuture] = async.Future.error(error);
+        }
+      }
+      const finalize = (function() {
+        if (dart.test(this.chunked)) {
+          if (dart.test(this[_gzip])) {
+            this[_gzipAdd] = dart.bind(this.socket, 'add');
+            if (dart.notNull(this[_gzipBufferLength]) > 0) {
+              this[_gzipSink].add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
+            }
+            this[_gzipBuffer] = null;
+            this[_gzipSink].close();
+            this[_gzipAdd] = null;
+          }
+          this[_addChunk$](this[_chunkHeader](0), dart.bind(this.socket, 'add'));
+        }
+        if (dart.notNull(this[_length$2]) > 0) {
+          this.socket.add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+        }
+        this[_buffer$] = null;
+        return this.socket.flush().then(io._HttpOutboundMessage)(dart.fn(_ => {
+          this[_doneCompleter].complete(this.socket);
+          return this.outbound;
+        }, dynamicTo_HttpOutboundMessage()), {onError: dart.fn((error, stackTrace) => {
+            this[_doneCompleter].completeError(error, core.StackTrace._check(stackTrace));
+            if (dart.test(this[_ignoreError](error))) {
+              return this.outbound;
+            } else {
+              dart.throw(error);
+            }
+          }, dynamicAnddynamicTo_HttpOutboundMessage())});
+      }).bind(this);
+      dart.fn(finalize, VoidToFuture());
+      let future = this.writeHeaders();
+      if (future != null) {
+        return this[_closeFuture] = future.whenComplete(finalize);
+      }
+      return this[_closeFuture] = finalize();
+    }
+    get done() {
+      return this[_doneCompleter].future;
+    }
+    setHeader(data, length) {
+      dart.assert(this[_length$2] == 0);
+      dart.assert(data[dartx.length] == io._OUTGOING_BUFFER_SIZE);
+      this[_buffer$] = typed_data.Uint8List._check(data);
+      this[_length$2] = length;
+    }
+    set gzip(value) {
+      this[_gzip] = value;
+      if (dart.test(this[_gzip])) {
+        this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+        dart.assert(this[_gzipSink] == null);
+        this[_gzipSink] = new io.ZLibEncoder({gzip: true}).startChunkedConversion(new io._HttpGZipSink(dart.fn(data => {
+          if (this[_gzipAdd] == null) return;
+          this[_addChunk$](this[_chunkHeader](core.int._check(dart.dload(data, 'length'))), ListOfintTovoid()._check(this[_gzipAdd]));
+          this[_pendingChunkedFooter] = 2;
+          this[_addChunk$](data, ListOfintTovoid()._check(this[_gzipAdd]));
+        }, dynamicToNull$())));
+      }
+    }
+    [_ignoreError](error) {
+      return (io.SocketException.is(error) || io.TlsException.is(error)) && io.HttpResponse.is(this.outbound);
+    }
+    [_addGZipChunk](chunk, add) {
+      if (!dart.test(this.outbound.bufferOutput)) {
+        add(ListOfint()._check(chunk));
+        return;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_gzipBuffer][dartx.length]) - dart.notNull(this[_gzipBufferLength])))) {
+        add(typed_data.Uint8List.view(this[_gzipBuffer][dartx.buffer], 0, this[_gzipBufferLength]));
+        this[_gzipBuffer] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+        this[_gzipBufferLength] = 0;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
+        add(ListOfint()._check(chunk));
+      } else {
+        this[_gzipBuffer][dartx.setRange](this[_gzipBufferLength], dart.asInt(dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
+        this[_gzipBufferLength] = dart.notNull(this[_gzipBufferLength]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+      }
+    }
+    [_addChunk$](chunk, add) {
+      if (!dart.test(this.outbound.bufferOutput)) {
+        if (this[_buffer$] != null) {
+          add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+          this[_buffer$] = null;
+          this[_length$2] = 0;
+        }
+        add(ListOfint()._check(chunk));
+        return;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_length$2])))) {
+        add(typed_data.Uint8List.view(this[_buffer$][dartx.buffer], 0, this[_length$2]));
+        this[_buffer$] = typed_data.Uint8List.new(io._OUTGOING_BUFFER_SIZE);
+        this[_length$2] = 0;
+      }
+      if (dart.test(dart.dsend(dart.dload(chunk, 'length'), '>', io._OUTGOING_BUFFER_SIZE))) {
+        add(ListOfint()._check(chunk));
+      } else {
+        this[_buffer$][dartx.setRange](this[_length$2], dart.asInt(dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')))), IterableOfint()._check(chunk));
+        this[_length$2] = dart.notNull(this[_length$2]) + dart.notNull(core.num._check(dart.dload(chunk, 'length')));
+      }
+    }
+    [_chunkHeader](length) {
+      let hexDigits = const$68 || (const$68 = dart.constList([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70], core.int));
+      if (length == 0) {
+        if (this[_pendingChunkedFooter] == 2) return io._HttpOutgoing._footerAndChunk0Length;
+        return io._HttpOutgoing._chunk0Length;
+      }
+      let size = this[_pendingChunkedFooter];
+      let len = length;
+      while (dart.notNull(len) > 0) {
+        size = dart.notNull(size) + 1;
+        len = len[dartx['>>']](4);
+      }
+      let footerAndHeader = typed_data.Uint8List.new(dart.notNull(size) + 2);
+      if (this[_pendingChunkedFooter] == 2) {
+        footerAndHeader[dartx._set](0, io._CharCode.CR);
+        footerAndHeader[dartx._set](1, io._CharCode.LF);
+      }
+      let index = size;
+      while (dart.notNull(index) > dart.notNull(this[_pendingChunkedFooter])) {
+        footerAndHeader[dartx._set]((index = dart.notNull(index) - 1), hexDigits[dartx._get](dart.notNull(length) & 15));
+        length = length[dartx['>>']](4);
+      }
+      footerAndHeader[dartx._set](dart.notNull(size) + 0, io._CharCode.CR);
+      footerAndHeader[dartx._set](dart.notNull(size) + 1, io._CharCode.LF);
+      return footerAndHeader;
+    }
+  };
+  io._HttpOutgoing[dart.implements] = () => [StreamConsumerOfListOfint()];
+  dart.setSignature(io._HttpOutgoing, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpOutgoing, [io.Socket])}),
+    fields: () => ({
+      [_doneCompleter]: async.Completer,
+      socket: io.Socket,
+      ignoreBody: core.bool,
+      headersWritten: core.bool,
+      [_buffer$]: typed_data.Uint8List,
+      [_length$2]: core.int,
+      [_closeFuture]: async.Future,
+      chunked: core.bool,
+      [_pendingChunkedFooter]: core.int,
+      contentLength: core.int,
+      [_bytesWritten]: core.int,
+      [_gzip]: core.bool,
+      [_gzipSink]: convert.ByteConversionSink,
+      [_gzipAdd]: core.Function,
+      [_gzipBuffer]: typed_data.Uint8List,
+      [_gzipBufferLength]: core.int,
+      [_socketError]: core.bool,
+      outbound: io._HttpOutboundMessage
+    }),
+    getters: () => ({done: dart.definiteFunctionType(async.Future, [])}),
+    setters: () => ({gzip: dart.definiteFunctionType(dart.void, [core.bool])}),
+    methods: () => ({
+      writeHeaders: dart.definiteFunctionType(async.Future, [], {drainRequest: core.bool, setOutgoing: core.bool}),
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+      close: dart.definiteFunctionType(async.Future, []),
+      setHeader: dart.definiteFunctionType(dart.void, [ListOfint(), core.int]),
+      [_ignoreError]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+      [_addGZipChunk]: dart.definiteFunctionType(dart.void, [dart.dynamic, ListOfintTovoid()]),
+      [_addChunk$]: dart.definiteFunctionType(dart.void, [dart.dynamic, ListOfintTovoid()]),
+      [_chunkHeader]: dart.definiteFunctionType(core.List$(core.int), [core.int])
+    }),
+    sfields: () => ({
+      _footerAndChunk0Length: ListOfint(),
+      _chunk0Length: ListOfint()
+    })
+  });
+  dart.defineLazy(io._HttpOutgoing, {
+    get _footerAndChunk0Length() {
+      return dart.constList([io._CharCode.CR, io._CharCode.LF, 48, io._CharCode.CR, io._CharCode.LF, io._CharCode.CR, io._CharCode.LF], core.int);
+    },
+    get _chunk0Length() {
+      return dart.constList([48, io._CharCode.CR, io._CharCode.LF, io._CharCode.CR, io._CharCode.LF], core.int);
+    }
+  });
+  const _context = Symbol('_context');
+  const _httpParser = Symbol('_httpParser');
+  const _subscription$ = Symbol('_subscription');
+  const _dispose = Symbol('_dispose');
+  const _idleTimer = Symbol('_idleTimer');
+  const _currentUri = Symbol('_currentUri');
+  const _nextResponseCompleter = Symbol('_nextResponseCompleter');
+  const _streamFuture = Symbol('_streamFuture');
+  const _proxyCredentials = Symbol('_proxyCredentials');
+  const _returnConnection = Symbol('_returnConnection');
+  io._HttpClientConnection = class _HttpClientConnection extends core.Object {
+    new(key, socket, httpClient, proxyTunnel, context) {
+      if (proxyTunnel === void 0) proxyTunnel = false;
+      if (context === void 0) context = null;
+      this.key = key;
+      this[_socket] = socket;
+      this[_httpClient] = httpClient;
+      this[_proxyTunnel] = proxyTunnel;
+      this[_context] = context;
+      this[_httpParser] = io._HttpParser.responseParser();
+      this[_subscription$] = null;
+      this[_dispose] = false;
+      this[_idleTimer] = null;
+      this.closed = false;
+      this[_currentUri] = null;
+      this[_nextResponseCompleter] = null;
+      this[_streamFuture] = null;
+      this[_httpParser].listenToStream(this[_socket]);
+      this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
+        this[_subscription$].pause();
+        if (this[_nextResponseCompleter] == null) {
+          dart.throw(new io.HttpException("Unexpected response (unsolicited response without request).", {uri: this[_currentUri]}));
+        }
+        if (incoming.statusCode == 100) {
+          incoming.drain(dart.dynamic)().then(dart.dynamic)(dart.fn(_ => {
+            this[_subscription$].resume();
+          }, dynamicToNull$())).catchError(dart.fn((error, stackTrace) => {
+            if (stackTrace === void 0) stackTrace = null;
+            this[_nextResponseCompleter].completeError(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this[_currentUri]}), stackTrace);
+            this[_nextResponseCompleter] = null;
+          }, dynamic__ToNull$()));
+        } else {
+          this[_nextResponseCompleter].complete(incoming);
+          this[_nextResponseCompleter] = null;
+        }
+      }, _HttpIncomingToNull()), {onError: dart.fn((error, stackTrace) => {
+          if (stackTrace === void 0) stackTrace = null;
+          if (this[_nextResponseCompleter] != null) {
+            this[_nextResponseCompleter].completeError(new io.HttpException(core.String._check(dart.dload(error, 'message')), {uri: this[_currentUri]}), stackTrace);
+            this[_nextResponseCompleter] = null;
+          }
+        }, dynamic__ToNull$()), onDone: dart.fn(() => {
+          if (this[_nextResponseCompleter] != null) {
+            this[_nextResponseCompleter].completeError(new io.HttpException("Connection closed before response was received", {uri: this[_currentUri]}));
+            this[_nextResponseCompleter] = null;
+          }
+          this.close();
+        }, VoidToNull())});
+    }
+    send(uri, port, method, proxy) {
+      if (dart.test(this.closed)) {
+        dart.throw(new io.HttpException("Socket closed before request was sent", {uri: uri}));
+      }
+      this[_currentUri] = uri;
+      this[_subscription$].pause();
+      let proxyCreds = null;
+      let creds = null;
+      let outgoing = new io._HttpOutgoing(this[_socket]);
+      let request = new io._HttpClientRequest(outgoing, uri, method, proxy, this[_httpClient], this);
+      let host = uri.host;
+      if (dart.test(host[dartx.contains](':'))) host = dart.str`[${host}]`;
+      request.headers.host = host;
+      request.headers.port = port;
+      request.headers[_add$2](io.HttpHeaders.ACCEPT_ENCODING, "gzip");
+      if (this[_httpClient].userAgent != null) {
+        request.headers[_add$2]('user-agent', this[_httpClient].userAgent);
+      }
+      if (dart.test(proxy.isAuthenticated)) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${proxy.username}:${proxy.password}`));
+        request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
+      } else if (!dart.test(proxy.isDirect) && dart.notNull(this[_httpClient][_proxyCredentials][dartx.length]) > 0) {
+        proxyCreds = this[_httpClient][_findProxyCredentials](proxy);
+        if (proxyCreds != null) {
+          proxyCreds.authorize(request);
+        }
+      }
+      if (uri.userInfo != null && !dart.test(uri.userInfo[dartx.isEmpty])) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(uri.userInfo));
+        request.headers.set(io.HttpHeaders.AUTHORIZATION, dart.str`Basic ${auth}`);
+      } else {
+        creds = this[_httpClient][_findCredentials](uri);
+        if (creds != null) {
+          creds.authorize(request);
+        }
+      }
+      this[_httpParser].isHead = method == "HEAD";
+      this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(s => {
+        this[_nextResponseCompleter] = CompleterOf_HttpIncoming().new();
+        this[_nextResponseCompleter].future.then(dart.dynamic)(dart.fn(incoming => {
+          this[_currentUri] = null;
+          incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
+            if (dart.test(incoming.upgraded)) {
+              this[_httpClient][_connectionClosed](this);
+              this.startTimer();
+              return;
+            }
+            if (dart.test(this.closed)) return;
+            if (!dart.test(closing) && !dart.test(this[_dispose]) && dart.test(incoming.headers.persistentConnection) && dart.test(request.persistentConnection)) {
+              this[_httpClient][_returnConnection](this);
+              this[_subscription$].resume();
+            } else {
+              this.destroy();
+            }
+          }, dynamicToNull$()));
+          if (proxyCreds != null && dart.equals(proxyCreds.scheme, io._AuthenticationScheme.DIGEST)) {
+            let authInfo = incoming.headers._get("proxy-authentication-info");
+            if (authInfo != null && authInfo[dartx.length] == 1) {
+              let header = io._HeaderValue.parse(authInfo[dartx._get](0), {parameterSeparator: ','});
+              let nextnonce = header.parameters[dartx._get]("nextnonce");
+              if (nextnonce != null) proxyCreds.nonce = nextnonce;
+            }
+          }
+          if (creds != null && dart.equals(creds.scheme, io._AuthenticationScheme.DIGEST)) {
+            let authInfo = incoming.headers._get("authentication-info");
+            if (authInfo != null && authInfo[dartx.length] == 1) {
+              let header = io._HeaderValue.parse(authInfo[dartx._get](0), {parameterSeparator: ','});
+              let nextnonce = header.parameters[dartx._get]("nextnonce");
+              if (nextnonce != null) creds.nonce = nextnonce;
+            }
+          }
+          request[_onIncoming](incoming);
+        }, _HttpIncomingToNull())).catchError(dart.fn(error => {
+          dart.throw(new io.HttpException("Connection closed before data was received", {uri: uri}));
+        }, dynamicToNull$()), {test: dart.fn(error => core.StateError.is(error), ObjectTobool())}).catchError(dart.fn((error, stackTrace) => {
+          this.destroy();
+          request[_onError$](error, core.StackTrace._check(stackTrace));
+        }, dynamicAnddynamicToNull()));
+        this[_subscription$].resume();
+        return s;
+      }, dynamicTodynamic$()), {onError: dart.fn(e => {
+          this.destroy();
+        }, dynamicToNull$())});
+      return request;
+    }
+    detachSocket() {
+      return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => new io._DetachedSocket(this[_socket], this[_httpParser].detachIncoming()), dynamicTo_DetachedSocket()));
+    }
+    destroy() {
+      this.closed = true;
+      this[_httpClient][_connectionClosed](this);
+      this[_socket].destroy();
+    }
+    close() {
+      this.closed = true;
+      this[_httpClient][_connectionClosed](this);
+      this[_streamFuture].then(dart.void)(dart.fn(_ => this[_socket].destroy(), dynamicTovoid$()));
+    }
+    createProxyTunnel(host, port, proxy, callback) {
+      let request = this.send(core.Uri.new({host: core.String._check(host), port: core.int._check(port)}), core.int._check(port), "CONNECT", io._Proxy._check(proxy));
+      if (dart.test(dart.dload(proxy, 'isAuthenticated'))) {
+        let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${dart.dload(proxy, 'username')}:${dart.dload(proxy, 'password')}`));
+        request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, dart.str`Basic ${auth}`);
+      }
+      return request.close().then(io.SecureSocket)(dart.fn(response => {
+        if (response.statusCode != io.HttpStatus.OK) {
+          dart.throw("Proxy failed to establish tunnel " + dart.str`(${response.statusCode} ${response.reasonPhrase})`);
+        }
+        let socket = io._HttpClientResponse.as(response)[_httpRequest][_httpClientConnection][_socket];
+        return io.SecureSocket.secure(socket, {host: host, context: this[_context], onBadCertificate: X509CertificateTobool()._check(callback)});
+      }, HttpClientResponseToFutureOfSecureSocket())).then(io._HttpClientConnection)(dart.fn(secureSocket => {
+        let key = core.String._check(io._HttpClientConnection.makeKey(true, core.String._check(host), core.int._check(port)));
+        return new io._HttpClientConnection(key, secureSocket, request[_httpClient], true);
+      }, SecureSocketTo_HttpClientConnection()));
+    }
+    get connectionInfo() {
+      return io._HttpConnectionInfo.create(this[_socket]);
+    }
+    static makeKey(isSecure, host, port) {
+      return dart.test(isSecure) ? dart.str`ssh:${host}:${port}` : dart.str`${host}:${port}`;
+    }
+    stopTimer() {
+      if (this[_idleTimer] != null) {
+        this[_idleTimer].cancel();
+        this[_idleTimer] = null;
+      }
+    }
+    startTimer() {
+      dart.assert(this[_idleTimer] == null);
+      this[_idleTimer] = async.Timer.new(this[_httpClient].idleTimeout, dart.fn(() => {
+        this[_idleTimer] = null;
+        this.close();
+      }, VoidToNull()));
+    }
+  };
+  dart.setSignature(io._HttpClientConnection, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientConnection, [core.String, io.Socket, io._HttpClient], [core.bool, io.SecurityContext])}),
+    fields: () => ({
+      key: core.String,
+      [_socket]: io.Socket,
+      [_proxyTunnel]: core.bool,
+      [_context]: io.SecurityContext,
+      [_httpParser]: io._HttpParser,
+      [_subscription$]: async.StreamSubscription,
+      [_httpClient]: io._HttpClient,
+      [_dispose]: core.bool,
+      [_idleTimer]: async.Timer,
+      closed: core.bool,
+      [_currentUri]: core.Uri,
+      [_nextResponseCompleter]: CompleterOf_HttpIncoming(),
+      [_streamFuture]: async.Future
+    }),
+    getters: () => ({connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, [])}),
+    methods: () => ({
+      send: dart.definiteFunctionType(io._HttpClientRequest, [core.Uri, core.int, core.String, io._Proxy]),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      destroy: dart.definiteFunctionType(dart.void, []),
+      close: dart.definiteFunctionType(dart.void, []),
+      createProxyTunnel: dart.definiteFunctionType(async.Future$(io._HttpClientConnection), [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]),
+      stopTimer: dart.definiteFunctionType(dart.void, []),
+      startTimer: dart.definiteFunctionType(dart.void, [])
+    }),
+    statics: () => ({makeKey: dart.definiteFunctionType(dart.dynamic, [core.bool, core.String, core.int])}),
+    names: ['makeKey']
+  });
+  io._ConnectionInfo = class _ConnectionInfo extends core.Object {
+    new(connection, proxy) {
+      this.connection = connection;
+      this.proxy = proxy;
+    }
+  };
+  dart.setSignature(io._ConnectionInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ConnectionInfo, [io._HttpClientConnection, io._Proxy])}),
+    fields: () => ({
+      connection: io._HttpClientConnection,
+      proxy: io._Proxy
+    })
+  });
+  const _idle = Symbol('_idle');
+  const _active = Symbol('_active');
+  const _pending$ = Symbol('_pending');
+  const _connecting = Symbol('_connecting');
+  const _checkPending = Symbol('_checkPending');
+  const _connectionsChanged = Symbol('_connectionsChanged');
+  const _badCertificateCallback = Symbol('_badCertificateCallback');
+  const _getConnectionTarget = Symbol('_getConnectionTarget');
+  io._ConnectionTarget = class _ConnectionTarget extends core.Object {
+    new(key, host, port, isSecure, context) {
+      this[_idle] = HashSetOf_HttpClientConnection().new();
+      this[_active] = HashSetOf_HttpClientConnection().new();
+      this[_pending$] = new collection.ListQueue();
+      this.key = key;
+      this.host = host;
+      this.port = port;
+      this.isSecure = isSecure;
+      this.context = context;
+      this[_connecting] = 0;
+    }
+    get isEmpty() {
+      return dart.test(this[_idle].isEmpty) && dart.test(this[_active].isEmpty) && this[_connecting] == 0;
+    }
+    get hasIdle() {
+      return this[_idle].isNotEmpty;
+    }
+    get hasActive() {
+      return dart.test(this[_active].isNotEmpty) || dart.notNull(this[_connecting]) > 0;
+    }
+    takeIdle() {
+      dart.assert(this.hasIdle);
+      let connection = this[_idle].first;
+      this[_idle].remove(connection);
+      connection.stopTimer();
+      this[_active].add(connection);
+      return connection;
+    }
+    [_checkPending]() {
+      if (dart.test(this[_pending$].isNotEmpty)) {
+        dart.dcall(this[_pending$].removeFirst());
+      }
+    }
+    addNewActive(connection) {
+      this[_active].add(connection);
+    }
+    returnConnection(connection) {
+      dart.assert(this[_active].contains(connection));
+      this[_active].remove(connection);
+      this[_idle].add(connection);
+      connection.startTimer();
+      this[_checkPending]();
+    }
+    connectionClosed(connection) {
+      dart.assert(!dart.test(this[_active].contains(connection)) || !dart.test(this[_idle].contains(connection)));
+      this[_active].remove(connection);
+      this[_idle].remove(connection);
+      this[_checkPending]();
+    }
+    close(force) {
+      for (let c of this[_idle].toList()) {
+        c.close();
+      }
+      if (dart.test(force)) {
+        for (let c of this[_active].toList()) {
+          c.destroy();
+        }
+      }
+    }
+    connect(uriHost, uriPort, proxy, client) {
+      if (dart.test(this.hasIdle)) {
+        let connection = this.takeIdle();
+        client[_connectionsChanged]();
+        return FutureOf_ConnectionInfo().value(new io._ConnectionInfo(connection, proxy));
+      }
+      if (client.maxConnectionsPerHost != null && dart.notNull(this[_active].length) + dart.notNull(this[_connecting]) >= dart.notNull(client.maxConnectionsPerHost)) {
+        let completer = async.Completer.new();
+        this[_pending$].add(dart.fn(() => {
+          this.connect(uriHost, uriPort, proxy, client).then(dart.void)(dart.bind(completer, 'complete'), {onError: dart.bind(completer, 'completeError')});
+        }, VoidToNull()));
+        return FutureOf_ConnectionInfo()._check(completer.future);
+      }
+      let currentBadCertificateCallback = client[_badCertificateCallback];
+      function callback(certificate) {
+        if (currentBadCertificateCallback == null) return false;
+        return currentBadCertificateCallback(certificate, uriHost, uriPort);
+      }
+      dart.fn(callback, X509CertificateTobool$());
+      let socketFuture = dart.test(this.isSecure) && dart.test(proxy.isDirect) ? io.SecureSocket.connect(this.host, this.port, {context: this.context, onBadCertificate: callback}) : io.Socket.connect(this.host, this.port);
+      this[_connecting] = dart.notNull(this[_connecting]) + 1;
+      return socketFuture.then(io._ConnectionInfo)(dart.fn(socket => {
+        this[_connecting] = dart.notNull(this[_connecting]) - 1;
+        dart.dsend(socket, 'setOption', io.SocketOption.TCP_NODELAY, true);
+        let connection = new io._HttpClientConnection(this.key, io.Socket._check(socket), client, false, this.context);
+        if (dart.test(this.isSecure) && !dart.test(proxy.isDirect)) {
+          connection[_dispose] = true;
+          return connection.createProxyTunnel(uriHost, uriPort, proxy, callback).then(io._ConnectionInfo)(dart.fn(tunnel => {
+            client[_getConnectionTarget](uriHost, uriPort, true).addNewActive(tunnel);
+            return new io._ConnectionInfo(tunnel, proxy);
+          }, _HttpClientConnectionTo_ConnectionInfo()));
+        } else {
+          this.addNewActive(connection);
+          return new io._ConnectionInfo(connection, proxy);
+        }
+      }, dynamicToFutureOrOf_ConnectionInfo()), {onError: dart.fn(error => {
+          this[_connecting] = dart.notNull(this[_connecting]) - 1;
+          this[_checkPending]();
+          dart.throw(error);
+        }, dynamicToNull$())});
+    }
+  };
+  dart.setSignature(io._ConnectionTarget, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ConnectionTarget, [core.String, core.String, core.int, core.bool, io.SecurityContext])}),
+    fields: () => ({
+      key: core.String,
+      host: core.String,
+      port: core.int,
+      isSecure: core.bool,
+      context: io.SecurityContext,
+      [_idle]: SetOf_HttpClientConnection(),
+      [_active]: SetOf_HttpClientConnection(),
+      [_pending$]: collection.Queue,
+      [_connecting]: core.int
+    }),
+    getters: () => ({
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      hasIdle: dart.definiteFunctionType(core.bool, []),
+      hasActive: dart.definiteFunctionType(core.bool, [])
+    }),
+    methods: () => ({
+      takeIdle: dart.definiteFunctionType(io._HttpClientConnection, []),
+      [_checkPending]: dart.definiteFunctionType(dart.dynamic, []),
+      addNewActive: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      returnConnection: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      connectionClosed: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      close: dart.definiteFunctionType(dart.void, [core.bool]),
+      connect: dart.definiteFunctionType(async.Future$(io._ConnectionInfo), [core.String, core.int, io._Proxy, io._HttpClient])
+    })
+  });
+  io.BadCertificateCallback = dart.typedef('BadCertificateCallback', () => dart.functionType(core.bool, [io.X509Certificate, core.String, core.int]));
+  const _idleTimeout = Symbol('_idleTimeout');
+  let const$69;
+  const _connectionTargets = Symbol('_connectionTargets');
+  const _credentials = Symbol('_credentials');
+  const _closing = Symbol('_closing');
+  const _closingForcefully = Symbol('_closingForcefully');
+  const _findProxy = Symbol('_findProxy');
+  const _openUrl = Symbol('_openUrl');
+  const _closeConnections = Symbol('_closeConnections');
+  let const$70;
+  const _getConnection = Symbol('_getConnection');
+  io._HttpClient = class _HttpClient extends core.Object {
+    get idleTimeout() {
+      return this[_idleTimeout];
+    }
+    new(context) {
+      this[_connectionTargets] = HashMapOfString$_ConnectionTarget().new();
+      this[_credentials] = JSArrayOf_Credentials().of([]);
+      this[_proxyCredentials] = JSArrayOf_ProxyCredentials().of([]);
+      this.userAgent = io._getHttpVersion();
+      this[_context] = context;
+      this[_closing] = false;
+      this[_closingForcefully] = false;
+      this[_authenticate] = null;
+      this[_authenticateProxy] = null;
+      this[_findProxy] = io.HttpClient.findProxyFromEnvironment;
+      this[_idleTimeout] = const$69 || (const$69 = dart.const(new core.Duration({seconds: 15})));
+      this[_badCertificateCallback] = null;
+      this.maxConnectionsPerHost = null;
+      this.autoUncompress = true;
+    }
+    set idleTimeout(timeout) {
+      this[_idleTimeout] = timeout;
+      for (let c of this[_connectionTargets][dartx.values]) {
+        for (let idle of c[_idle]) {
+          idle.stopTimer();
+          idle.startTimer();
+        }
+      }
+    }
+    set badCertificateCallback(callback) {
+      this[_badCertificateCallback] = callback;
+    }
+    open(method, host, port, path) {
+      let hashMark = 35;
+      let questionMark = 63;
+      let fragmentStart = path[dartx.length];
+      let queryStart = path[dartx.length];
+      for (let i = dart.notNull(path[dartx.length]) - 1; i >= 0; i--) {
+        let char = path[dartx.codeUnitAt](i);
+        if (char == hashMark) {
+          fragmentStart = i;
+          queryStart = i;
+        } else if (char == questionMark) {
+          queryStart = i;
+        }
+      }
+      let query = null;
+      if (dart.notNull(queryStart) < dart.notNull(fragmentStart)) {
+        query = path[dartx.substring](dart.notNull(queryStart) + 1, fragmentStart);
+        path = path[dartx.substring](0, queryStart);
+      }
+      let uri = core.Uri.new({scheme: "http", host: host, port: port, path: path, query: query});
+      return this[_openUrl](method, uri);
+    }
+    openUrl(method, url) {
+      return this[_openUrl](method, url);
+    }
+    get(host, port, path) {
+      return this.open("get", host, port, path);
+    }
+    getUrl(url) {
+      return this[_openUrl]("get", url);
+    }
+    post(host, port, path) {
+      return this.open("post", host, port, path);
+    }
+    postUrl(url) {
+      return this[_openUrl]("post", url);
+    }
+    put(host, port, path) {
+      return this.open("put", host, port, path);
+    }
+    putUrl(url) {
+      return this[_openUrl]("put", url);
+    }
+    delete(host, port, path) {
+      return this.open("delete", host, port, path);
+    }
+    deleteUrl(url) {
+      return this[_openUrl]("delete", url);
+    }
+    head(host, port, path) {
+      return this.open("head", host, port, path);
+    }
+    headUrl(url) {
+      return this[_openUrl]("head", url);
+    }
+    patch(host, port, path) {
+      return this.open("patch", host, port, path);
+    }
+    patchUrl(url) {
+      return this[_openUrl]("patch", url);
+    }
+    close(opts) {
+      let force = opts && 'force' in opts ? opts.force : false;
+      this[_closing] = true;
+      this[_closingForcefully] = force;
+      this[_closeConnections](this[_closingForcefully]);
+      dart.assert(!dart.test(this[_connectionTargets][dartx.values][dartx.any](dart.fn(s => s.hasIdle, _ConnectionTargetTobool()))));
+      dart.assert(!dart.test(force) || !dart.test(this[_connectionTargets][dartx.values][dartx.any](dart.fn(s => s[_active].isNotEmpty, _ConnectionTargetTobool()))));
+    }
+    set authenticate(f) {
+      this[_authenticate] = f;
+    }
+    addCredentials(url, realm, cr) {
+      this[_credentials][dartx.add](new io._SiteCredentials(url, realm, io._HttpClientCredentials._check(cr)));
+    }
+    set authenticateProxy(f) {
+      this[_authenticateProxy] = f;
+    }
+    addProxyCredentials(host, port, realm, cr) {
+      this[_proxyCredentials][dartx.add](new io._ProxyCredentials(host, port, realm, io._HttpClientCredentials._check(cr)));
+    }
+    set findProxy(f) {
+      return this[_findProxy] = f;
+    }
+    [_openUrl](method, uri) {
+      uri = uri.removeFragment();
+      if (method == null) {
+        dart.throw(new core.ArgumentError(method));
+      }
+      if (method != "CONNECT") {
+        if (dart.test(uri.host[dartx.isEmpty])) {
+          dart.throw(new core.ArgumentError(dart.str`No host specified in URI ${uri}`));
+        } else if (uri.scheme != "http" && uri.scheme != "https") {
+          dart.throw(new core.ArgumentError(dart.str`Unsupported scheme '${uri.scheme}' in URI ${uri}`));
+        }
+      }
+      let isSecure = uri.scheme == "https";
+      let port = uri.port;
+      if (port == 0) {
+        port = isSecure ? io.HttpClient.DEFAULT_HTTPS_PORT : io.HttpClient.DEFAULT_HTTP_PORT;
+      }
+      let proxyConf = const$70 || (const$70 = dart.const(new io._ProxyConfiguration.direct()));
+      if (this[_findProxy] != null) {
+        try {
+          proxyConf = new io._ProxyConfiguration(core.String._check(dart.dcall(this[_findProxy], uri)));
+        } catch (error) {
+          let stackTrace = dart.stackTrace(error);
+          return FutureOf_HttpClientRequest().error(error, stackTrace);
+        }
+
+      }
+      return this[_getConnection](uri.host, port, proxyConf, isSecure).then(io._HttpClientRequest)(dart.fn(info => {
+        function send(info) {
+          return info.connection.send(uri, port, method[dartx.toUpperCase](), info.proxy);
+        }
+        dart.fn(send, _ConnectionInfoTo_HttpClientRequest());
+        if (dart.test(info.connection.closed)) {
+          return this[_getConnection](uri.host, port, proxyConf, isSecure).then(io._HttpClientRequest)(send);
+        }
+        return send(info);
+      }, _ConnectionInfoToFutureOrOf_HttpClientRequest()));
+    }
+    [_openUrlFromRequest](method, uri, previous) {
+      let resolved = previous.uri.resolveUri(uri);
+      return this[_openUrl](method, resolved).then(io._HttpClientRequest)(dart.fn(request => {
+        request.followRedirects = previous.followRedirects;
+        request.maxRedirects = previous.maxRedirects;
+        for (let header of previous.headers[_headers][dartx.keys]) {
+          if (request.headers._get(header) == null) {
+            request.headers.set(header, previous.headers._get(header));
+          }
+        }
+        request.headers.chunkedTransferEncoding = false;
+        request.contentLength = 0;
+        return request;
+      }, _HttpClientRequestTo_HttpClientRequest()));
+    }
+    [_returnConnection](connection) {
+      this[_connectionTargets][dartx._get](connection.key).returnConnection(connection);
+      this[_connectionsChanged]();
+    }
+    [_connectionClosed](connection) {
+      connection.stopTimer();
+      let connectionTarget = this[_connectionTargets][dartx._get](connection.key);
+      if (connectionTarget != null) {
+        connectionTarget.connectionClosed(connection);
+        if (dart.test(connectionTarget.isEmpty)) {
+          this[_connectionTargets][dartx.remove](connection.key);
+        }
+        this[_connectionsChanged]();
+      }
+    }
+    [_connectionsChanged]() {
+      if (dart.test(this[_closing])) {
+        this[_closeConnections](this[_closingForcefully]);
+      }
+    }
+    [_closeConnections](force) {
+      for (let connectionTarget of this[_connectionTargets][dartx.values][dartx.toList]()) {
+        connectionTarget.close(force);
+      }
+    }
+    [_getConnectionTarget](host, port, isSecure) {
+      let key = core.String._check(io._HttpClientConnection.makeKey(isSecure, host, port));
+      return this[_connectionTargets][dartx.putIfAbsent](key, dart.fn(() => new io._ConnectionTarget(key, host, port, isSecure, this[_context]), VoidTo_ConnectionTarget()));
+    }
+    [_getConnection](uriHost, uriPort, proxyConf, isSecure) {
+      let proxies = proxyConf.proxies[dartx.iterator];
+      const connect = (function(error) {
+        if (!dart.test(proxies.moveNext())) return FutureOf_ConnectionInfo().error(error);
+        let proxy = proxies.current;
+        let host = dart.test(proxy.isDirect) ? uriHost : proxy.host;
+        let port = dart.test(proxy.isDirect) ? uriPort : proxy.port;
+        return this[_getConnectionTarget](host, port, isSecure).connect(uriHost, uriPort, proxy, this).catchError(connect);
+      }).bind(this);
+      dart.fn(connect, dynamicToFutureOf_ConnectionInfo());
+      return FutureOf_ConnectionInfo().new(dart.fn(() => connect(new io.HttpException("No proxies given")), VoidToFutureOf_ConnectionInfo()));
+    }
+    [_findCredentials](url, scheme) {
+      if (scheme === void 0) scheme = null;
+      let cr = this[_credentials][dartx.fold](io._SiteCredentials)(null, dart.fn((prev, value) => {
+        let siteCredentials = io._SiteCredentials.as(value);
+        if (dart.test(siteCredentials.applies(url, scheme))) {
+          if (prev == null) return io._SiteCredentials._check(value);
+          return dart.notNull(siteCredentials.uri.path[dartx.length]) > dart.notNull(prev.uri.path[dartx.length]) ? siteCredentials : prev;
+        } else {
+          return prev;
+        }
+      }, _SiteCredentialsAnd_CredentialsTo_SiteCredentials()));
+      return cr;
+    }
+    [_findProxyCredentials](proxy, scheme) {
+      if (scheme === void 0) scheme = null;
+      let it = this[_proxyCredentials][dartx.iterator];
+      while (dart.test(it.moveNext())) {
+        if (dart.test(it.current.applies(proxy, scheme))) {
+          return it.current;
+        }
+      }
+      return null;
+    }
+    [_removeCredentials](cr) {
+      let index = this[_credentials][dartx.indexOf](cr);
+      if (index != -1) {
+        this[_credentials][dartx.removeAt](index);
+      }
+    }
+    [_removeProxyCredentials](cr) {
+      let index = this[_proxyCredentials][dartx.indexOf](io._ProxyCredentials._check(cr));
+      if (index != -1) {
+        this[_proxyCredentials][dartx.removeAt](index);
+      }
+    }
+    static _findProxyFromEnvironment(url, environment) {
+      function checkNoProxy(option) {
+        if (option == null) return null;
+        let names = option[dartx.split](",")[dartx.map](core.String)(dart.fn(s => s[dartx.trim](), StringToString$()))[dartx.iterator];
+        while (dart.test(names.moveNext())) {
+          let name = names.current;
+          if (dart.test(name[dartx.startsWith]("[")) && dart.test(name[dartx.endsWith]("]")) && dart.str`[${url.host}]` == name || dart.test(name[dartx.isNotEmpty]) && dart.test(url.host[dartx.endsWith](name))) {
+            return "DIRECT";
+          }
+        }
+        return null;
+      }
+      dart.fn(checkNoProxy, StringToString$());
+      function checkProxy(option) {
+        if (option == null) return null;
+        option = option[dartx.trim]();
+        if (dart.test(option[dartx.isEmpty])) return null;
+        let pos = option[dartx.indexOf]("://");
+        if (dart.notNull(pos) >= 0) {
+          option = option[dartx.substring](dart.notNull(pos) + 3);
+        }
+        pos = option[dartx.indexOf]("/");
+        if (dart.notNull(pos) >= 0) {
+          option = option[dartx.substring](0, pos);
+        }
+        if (option[dartx.indexOf]("[") == 0) {
+          let pos = option[dartx.lastIndexOf](":");
+          if (dart.notNull(option[dartx.indexOf]("]")) > dart.notNull(pos)) option = dart.str`${option}:1080`;
+        } else {
+          if (option[dartx.indexOf](":") == -1) option = dart.str`${option}:1080`;
+        }
+        return dart.str`PROXY ${option}`;
+      }
+      dart.fn(checkProxy, StringToString$());
+      if (environment == null) environment = io._HttpClient._platformEnvironmentCache;
+      let proxyCfg = null;
+      let noProxy = environment[dartx._get]("no_proxy");
+      if (noProxy == null) noProxy = environment[dartx._get]("NO_PROXY");
+      if ((proxyCfg = checkNoProxy(noProxy)) != null) {
+        return proxyCfg;
+      }
+      if (url.scheme == "http") {
+        let proxy = environment[dartx._get]("http_proxy");
+        if (proxy == null) proxy = environment[dartx._get]("HTTP_PROXY");
+        if ((proxyCfg = checkProxy(proxy)) != null) {
+          return proxyCfg;
+        }
+      } else if (url.scheme == "https") {
+        let proxy = environment[dartx._get]("https_proxy");
+        if (proxy == null) proxy = environment[dartx._get]("HTTPS_PROXY");
+        if ((proxyCfg = checkProxy(proxy)) != null) {
+          return proxyCfg;
+        }
+      }
+      return "DIRECT";
+    }
+  };
+  io._HttpClient[dart.implements] = () => [io.HttpClient];
+  dart.setSignature(io._HttpClient, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClient, [io.SecurityContext])}),
+    fields: () => ({
+      [_closing]: core.bool,
+      [_closingForcefully]: core.bool,
+      [_connectionTargets]: MapOfString$_ConnectionTarget(),
+      [_credentials]: ListOf_Credentials(),
+      [_proxyCredentials]: ListOf_ProxyCredentials(),
+      [_context]: io.SecurityContext,
+      [_authenticate]: core.Function,
+      [_authenticateProxy]: core.Function,
+      [_findProxy]: core.Function,
+      [_idleTimeout]: core.Duration,
+      [_badCertificateCallback]: io.BadCertificateCallback,
+      maxConnectionsPerHost: core.int,
+      autoUncompress: core.bool,
+      userAgent: core.String
+    }),
+    getters: () => ({idleTimeout: dart.definiteFunctionType(core.Duration, [])}),
+    setters: () => ({
+      idleTimeout: dart.definiteFunctionType(dart.void, [core.Duration]),
+      badCertificateCallback: dart.definiteFunctionType(dart.void, [X509CertificateAndStringAndintTobool()]),
+      authenticate: dart.definiteFunctionType(dart.void, [UriAndStringAndStringToFutureOfbool()]),
+      authenticateProxy: dart.definiteFunctionType(dart.void, [StringAndintAndString__ToFutureOfbool()]),
+      findProxy: dart.definiteFunctionType(dart.void, [UriToString()])
+    }),
+    methods: () => ({
+      open: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.String, core.int, core.String]),
+      openUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.Uri]),
+      get: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      getUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      post: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      postUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      put: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      putUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      delete: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      deleteUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      head: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      headUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      patch: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.String, core.int, core.String]),
+      patchUrl: dart.definiteFunctionType(async.Future$(io.HttpClientRequest), [core.Uri]),
+      close: dart.definiteFunctionType(dart.void, [], {force: core.bool}),
+      addCredentials: dart.definiteFunctionType(dart.void, [core.Uri, core.String, io.HttpClientCredentials]),
+      addProxyCredentials: dart.definiteFunctionType(dart.void, [core.String, core.int, core.String, io.HttpClientCredentials]),
+      [_openUrl]: dart.definiteFunctionType(async.Future$(io._HttpClientRequest), [core.String, core.Uri]),
+      [_openUrlFromRequest]: dart.definiteFunctionType(async.Future$(io._HttpClientRequest), [core.String, core.Uri, io._HttpClientRequest]),
+      [_returnConnection]: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      [_connectionClosed]: dart.definiteFunctionType(dart.void, [io._HttpClientConnection]),
+      [_connectionsChanged]: dart.definiteFunctionType(dart.void, []),
+      [_closeConnections]: dart.definiteFunctionType(dart.void, [core.bool]),
+      [_getConnectionTarget]: dart.definiteFunctionType(io._ConnectionTarget, [core.String, core.int, core.bool]),
+      [_getConnection]: dart.definiteFunctionType(async.Future$(io._ConnectionInfo), [core.String, core.int, io._ProxyConfiguration, core.bool]),
+      [_findCredentials]: dart.definiteFunctionType(io._SiteCredentials, [core.Uri], [io._AuthenticationScheme]),
+      [_findProxyCredentials]: dart.definiteFunctionType(io._ProxyCredentials, [io._Proxy], [io._AuthenticationScheme]),
+      [_removeCredentials]: dart.definiteFunctionType(dart.void, [io._Credentials]),
+      [_removeProxyCredentials]: dart.definiteFunctionType(dart.void, [io._Credentials])
+    }),
+    sfields: () => ({_platformEnvironmentCache: MapOfString$String()}),
+    statics: () => ({_findProxyFromEnvironment: dart.definiteFunctionType(core.String, [core.Uri, MapOfString$String()])}),
+    names: ['_findProxyFromEnvironment']
+  });
+  dart.defineLazy(io._HttpClient, {
+    get _platformEnvironmentCache() {
+      return io.Platform.environment;
+    },
+    set _platformEnvironmentCache(_) {}
+  });
+  const _state$1 = Symbol('_state');
+  const _idleMark = Symbol('_idleMark');
+  const _owner = Symbol('_owner');
+  const _serviceId = Symbol('_serviceId');
+  const _markActive = Symbol('_markActive');
+  const _markIdle = Symbol('_markIdle');
+  const _handleRequest = Symbol('_handleRequest');
+  const _isActive = Symbol('_isActive');
+  const _isIdle = Symbol('_isIdle');
+  const _isDetached = Symbol('_isDetached');
+  const _serviceTypePath = Symbol('_serviceTypePath');
+  const _serviceTypeName = Symbol('_serviceTypeName');
+  const _servicePath = Symbol('_servicePath');
+  const _serviceType = Symbol('_serviceType');
+  const _toJSON$ = Symbol('_toJSON');
+  const __serviceId = Symbol('__serviceId');
+  io._ServiceObject = class _ServiceObject extends core.Object {
+    new() {
+      this[__serviceId] = 0;
+    }
+    get [_serviceId]() {
+      if (this[__serviceId] == 0) this[__serviceId] = (() => {
+        let x = io._nextServiceId;
+        io._nextServiceId = dart.notNull(x) + 1;
+        return x;
+      })();
+      return this[__serviceId];
+    }
+    get [_servicePath]() {
+      return dart.str`${this[_serviceTypePath]}/${this[_serviceId]}`;
+    }
+    [_serviceType](ref) {
+      if (dart.test(ref)) return dart.str`@${this[_serviceTypeName]}`;
+      return this[_serviceTypeName];
+    }
+  };
+  dart.setSignature(io._ServiceObject, {
+    fields: () => ({[__serviceId]: core.int}),
+    getters: () => ({
+      [_serviceId]: dart.definiteFunctionType(core.int, []),
+      [_servicePath]: dart.definiteFunctionType(core.String, [])
+    }),
+    methods: () => ({[_serviceType]: dart.definiteFunctionType(core.String, [core.bool])})
+  });
+  io._HttpConnection = class _HttpConnection extends dart.mixin(collection.LinkedListEntry, io._ServiceObject) {
+    new(socket, httpServer) {
+      this[_socket] = socket;
+      this[_httpServer] = httpServer;
+      this[_httpParser] = io._HttpParser.requestParser();
+      this[_state$1] = io._HttpConnection._IDLE;
+      this[_subscription$] = null;
+      this[_idleMark] = false;
+      this[_streamFuture] = null;
+      super.new();
+      try {
+        dart.dput(this[_socket], _owner, this);
+      } catch (_) {
+        core.print(_);
+      }
+
+      io._HttpConnection._connections[dartx._set](this[_serviceId], this);
+      this[_httpParser].listenToStream(StreamOfListOfint()._check(this[_socket]));
+      this[_subscription$] = this[_httpParser].listen(dart.fn(incoming => {
+        this[_httpServer][_markActive](this);
+        incoming.dataDone.then(dart.dynamic)(dart.fn(closing => {
+          if (dart.test(closing)) this.destroy();
+        }, dynamicToNull$()));
+        this[_subscription$].pause();
+        this[_state$1] = io._HttpConnection._ACTIVE;
+        let outgoing = new io._HttpOutgoing(io.Socket._check(this[_socket]));
+        let response = new io._HttpResponse(incoming.uri, incoming.headers.protocolVersion, outgoing, this[_httpServer].defaultResponseHeaders, this[_httpServer].serverHeader);
+        let request = new io._HttpRequest(response, incoming, this[_httpServer], this);
+        this[_streamFuture] = outgoing.done.then(dart.dynamic)(dart.fn(_ => {
+          response.deadline = null;
+          if (this[_state$1] == io._HttpConnection._DETACHED) return;
+          if (dart.test(response.persistentConnection) && dart.test(request.persistentConnection) && dart.test(incoming.fullBodyRead) && !dart.test(this[_httpParser].upgrade) && !dart.test(this[_httpServer].closed)) {
+            this[_state$1] = io._HttpConnection._IDLE;
+            this[_idleMark] = false;
+            this[_httpServer][_markIdle](this);
+            this[_subscription$].resume();
+          } else {
+            this.destroy();
+          }
+        }, dynamicToNull$()), {onError: dart.fn(_ => {
+            this.destroy();
+          }, dynamicToNull$())});
+        outgoing.ignoreBody = request.method == "HEAD";
+        response[_httpRequest] = request;
+        this[_httpServer][_handleRequest](request);
+      }, _HttpIncomingToNull()), {onDone: dart.fn(() => {
+          this.destroy();
+        }, VoidToNull()), onError: dart.fn(error => {
+          this.destroy();
+        }, dynamicToNull$())});
+    }
+    markIdle() {
+      this[_idleMark] = true;
+    }
+    get isMarkedIdle() {
+      return this[_idleMark];
+    }
+    destroy() {
+      if (this[_state$1] == io._HttpConnection._CLOSING || this[_state$1] == io._HttpConnection._DETACHED) return;
+      this[_state$1] = io._HttpConnection._CLOSING;
+      dart.dsend(this[_socket], 'destroy');
+      this[_httpServer][_connectionClosed](this);
+      io._HttpConnection._connections[dartx.remove](this[_serviceId]);
+    }
+    detachSocket() {
+      this[_state$1] = io._HttpConnection._DETACHED;
+      this[_httpServer][_connectionClosed](this);
+      let detachedIncoming = this[_httpParser].detachIncoming();
+      return this[_streamFuture].then(io._DetachedSocket)(dart.fn(_ => {
+        io._HttpConnection._connections[dartx.remove](this[_serviceId]);
+        return new io._DetachedSocket(this[_socket], detachedIncoming);
+      }, dynamicTo_DetachedSocket()));
+    }
+    get connectionInfo() {
+      return io._HttpConnectionInfo.create(io.Socket._check(this[_socket]));
+    }
+    get [_isActive]() {
+      return this[_state$1] == io._HttpConnection._ACTIVE;
+    }
+    get [_isIdle]() {
+      return this[_state$1] == io._HttpConnection._IDLE;
+    }
+    get [_isClosing]() {
+      return this[_state$1] == io._HttpConnection._CLOSING;
+    }
+    get [_isDetached]() {
+      return this[_state$1] == io._HttpConnection._DETACHED;
+    }
+    get [_serviceTypePath]() {
+      return 'io/http/serverconnections';
+    }
+    get [_serviceTypeName]() {
+      return 'HttpServerConnection';
+    }
+    [_toJSON$](ref) {
+      let name = dart.str`${dart.dload(dart.dload(this[_socket], 'address'), 'host')}:${dart.dload(this[_socket], 'port')} <-> ` + dart.str`${dart.dload(dart.dload(this[_socket], 'remoteAddress'), 'host')}:${dart.dload(this[_socket], 'remotePort')}`;
+      let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: name, user_name: name}, core.String, dart.dynamic);
+      if (dart.test(ref)) {
+        return r;
+      }
+      r[dartx._set]('server', this[_httpServer][_toJSON$](true));
+      try {
+        r[dartx._set]('socket', dart.dsend(this[_socket], _toJSON$, true));
+      } catch (_) {
+        r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+      }
+
+      switch (this[_state$1]) {
+        case io._HttpConnection._ACTIVE:
+        {
+          r[dartx._set]('state', "Active");
+          break;
+        }
+        case io._HttpConnection._IDLE:
+        {
+          r[dartx._set]('state', "Idle");
+          break;
+        }
+        case io._HttpConnection._CLOSING:
+        {
+          r[dartx._set]('state', "Closing");
+          break;
+        }
+        case io._HttpConnection._DETACHED:
+        {
+          r[dartx._set]('state', "Detached");
+          break;
+        }
+        default:
+        {
+          r[dartx._set]('state', 'Unknown');
+          break;
+        }
+      }
+      return r;
+    }
+  };
+  dart.setBaseClass(io._HttpConnection, dart.mixin(collection.LinkedListEntry$(io._HttpConnection), io._ServiceObject));
+  dart.addSimpleTypeTests(io._HttpConnection);
+  dart.setSignature(io._HttpConnection, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpConnection, [dart.dynamic, io._HttpServer])}),
+    fields: () => ({
+      [_socket]: dart.dynamic,
+      [_httpServer]: io._HttpServer,
+      [_httpParser]: io._HttpParser,
+      [_state$1]: core.int,
+      [_subscription$]: async.StreamSubscription,
+      [_idleMark]: core.bool,
+      [_streamFuture]: async.Future
+    }),
+    getters: () => ({
+      isMarkedIdle: dart.definiteFunctionType(core.bool, []),
+      connectionInfo: dart.definiteFunctionType(io.HttpConnectionInfo, []),
+      [_isActive]: dart.definiteFunctionType(core.bool, []),
+      [_isIdle]: dart.definiteFunctionType(core.bool, []),
+      [_isClosing]: dart.definiteFunctionType(core.bool, []),
+      [_isDetached]: dart.definiteFunctionType(core.bool, []),
+      [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+      [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+    }),
+    methods: () => ({
+      markIdle: dart.definiteFunctionType(dart.void, []),
+      destroy: dart.definiteFunctionType(dart.void, []),
+      detachSocket: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      [_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
+    }),
+    sfields: () => ({
+      _ACTIVE: core.int,
+      _IDLE: core.int,
+      _CLOSING: core.int,
+      _DETACHED: core.int,
+      _connections: MapOfint$_HttpConnection()
+    })
+  });
+  io._HttpConnection._ACTIVE = 0;
+  io._HttpConnection._IDLE = 1;
+  io._HttpConnection._CLOSING = 2;
+  io._HttpConnection._DETACHED = 3;
+  dart.defineLazy(io._HttpConnection, {
+    get _connections() {
+      return HashMapOfint$_HttpConnection().new();
+    },
+    set _connections(_) {}
+  });
+  const _activeConnections = Symbol('_activeConnections');
+  const _idleConnections = Symbol('_idleConnections');
+  const _serverSocket = Symbol('_serverSocket');
+  const _closeServer = Symbol('_closeServer');
+  let const$71;
+  let const$72;
+  io._HttpServer = class _HttpServer extends dart.mixin(async.Stream$(io.HttpRequest), io._ServiceObject) {
+    static bind(address, port, backlog, v6Only, shared) {
+      return io.ServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), ServerSocketTo_HttpServer()));
+    }
+    static bindSecure(address, port, context, backlog, v6Only, requestClientCertificate, shared) {
+      return io.SecureServerSocket.bind(address, port, context, {backlog: backlog, v6Only: v6Only, requestClientCertificate: requestClientCertificate, shared: shared}).then(io._HttpServer)(dart.fn(socket => new io._HttpServer._(socket, true), SecureServerSocketTo_HttpServer()));
+    }
+    _(serverSocket, closeServer) {
+      this.defaultResponseHeaders = io._HttpServer._initDefaultResponseHeaders();
+      this[_activeConnections] = new (LinkedListOf_HttpConnection())();
+      this[_idleConnections] = new (LinkedListOf_HttpConnection())();
+      this[_serverSocket] = serverSocket;
+      this[_closeServer] = closeServer;
+      this.serverHeader = null;
+      this.autoCompress = false;
+      this[_idleTimeout] = null;
+      this[_idleTimer] = null;
+      this[_sessionManagerInstance] = null;
+      this.closed = false;
+      this[_controller$0] = null;
+      super.new();
+      this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
+      this.idleTimeout = const$71 || (const$71 = dart.const(new core.Duration({seconds: 120})));
+      io._HttpServer._servers[dartx._set](this[_serviceId], this);
+      dart.dput(this[_serverSocket], _owner, this);
+    }
+    listenOn(serverSocket) {
+      this.defaultResponseHeaders = io._HttpServer._initDefaultResponseHeaders();
+      this[_activeConnections] = new (LinkedListOf_HttpConnection())();
+      this[_idleConnections] = new (LinkedListOf_HttpConnection())();
+      this[_serverSocket] = serverSocket;
+      this[_closeServer] = false;
+      this.serverHeader = null;
+      this.autoCompress = false;
+      this[_idleTimeout] = null;
+      this[_idleTimer] = null;
+      this[_sessionManagerInstance] = null;
+      this.closed = false;
+      this[_controller$0] = null;
+      super.new();
+      this[_controller$0] = StreamControllerOfHttpRequest().new({sync: true, onCancel: dart.bind(this, 'close')});
+      this.idleTimeout = const$72 || (const$72 = dart.const(new core.Duration({seconds: 120})));
+      io._HttpServer._servers[dartx._set](this[_serviceId], this);
+      try {
+        dart.dput(this[_serverSocket], _owner, this);
+      } catch (_) {
+      }
+
+    }
+    static _initDefaultResponseHeaders() {
+      let defaultResponseHeaders = new io._HttpHeaders('1.1');
+      defaultResponseHeaders.contentType = io.ContentType.TEXT;
+      defaultResponseHeaders.set('X-Frame-Options', 'SAMEORIGIN');
+      defaultResponseHeaders.set('X-Content-Type-Options', 'nosniff');
+      defaultResponseHeaders.set('X-XSS-Protection', '1; mode=block');
+      return defaultResponseHeaders;
+    }
+    get idleTimeout() {
+      return this[_idleTimeout];
+    }
+    set idleTimeout(duration) {
+      if (this[_idleTimer] != null) {
+        this[_idleTimer].cancel();
+        this[_idleTimer] = null;
+      }
+      this[_idleTimeout] = duration;
+      if (this[_idleTimeout] != null) {
+        this[_idleTimer] = async.Timer.periodic(this[_idleTimeout], dart.fn(_ => {
+          for (let idle of this[_idleConnections].toList()) {
+            if (dart.test(idle.isMarkedIdle)) {
+              idle.destroy();
+            } else {
+              idle.markIdle();
+            }
+          }
+        }, TimerToNull()));
+      }
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      dart.dsend(this[_serverSocket], 'listen', dart.fn(socket => {
+        socket.setOption(io.SocketOption.TCP_NODELAY, true);
+        let connection = new io._HttpConnection(socket, this);
+        this[_idleConnections].add(connection);
+      }, SocketToNull()), {onError: dart.fn((error, stackTrace) => {
+          if (!io.HandshakeException.is(error)) {
+            this[_controller$0].addError(error, core.StackTrace._check(stackTrace));
+          }
+        }, dynamicAnddynamicToNull()), onDone: dart.bind(this[_controller$0], 'close')});
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    close(opts) {
+      let force = opts && 'force' in opts ? opts.force : false;
+      this.closed = true;
+      let result = null;
+      if (this[_serverSocket] != null && dart.test(this[_closeServer])) {
+        result = async.Future._check(dart.dsend(this[_serverSocket], 'close'));
+      } else {
+        result = async.Future.value();
+      }
+      this.idleTimeout = null;
+      if (dart.test(force)) {
+        for (let c of this[_activeConnections].toList()) {
+          c.destroy();
+        }
+        dart.assert(this[_activeConnections].isEmpty);
+      }
+      for (let c of this[_idleConnections].toList()) {
+        c.destroy();
+      }
+      this[_maybePerformCleanup]();
+      return result;
+    }
+    [_maybePerformCleanup]() {
+      if (dart.test(this.closed) && dart.test(this[_idleConnections].isEmpty) && dart.test(this[_activeConnections].isEmpty) && this[_sessionManagerInstance] != null) {
+        this[_sessionManagerInstance].close();
+        this[_sessionManagerInstance] = null;
+        io._HttpServer._servers[dartx.remove](this[_serviceId]);
+      }
+    }
+    get port() {
+      if (dart.test(this.closed)) dart.throw(new io.HttpException("HttpServer is not bound to a socket"));
+      return core.int._check(dart.dload(this[_serverSocket], 'port'));
+    }
+    get address() {
+      if (dart.test(this.closed)) dart.throw(new io.HttpException("HttpServer is not bound to a socket"));
+      return io.InternetAddress._check(dart.dload(this[_serverSocket], 'address'));
+    }
+    set sessionTimeout(timeout) {
+      this[_sessionManager].sessionTimeout = timeout;
+    }
+    [_handleRequest](request) {
+      if (!dart.test(this.closed)) {
+        this[_controller$0].add(request);
+      } else {
+        request[_httpConnection].destroy();
+      }
+    }
+    [_connectionClosed](connection) {
+      connection.unlink();
+      this[_maybePerformCleanup]();
+    }
+    [_markIdle](connection) {
+      this[_activeConnections].remove(connection);
+      this[_idleConnections].add(connection);
+    }
+    [_markActive](connection) {
+      this[_idleConnections].remove(connection);
+      this[_activeConnections].add(connection);
+    }
+    get [_sessionManager]() {
+      if (this[_sessionManagerInstance] == null) {
+        this[_sessionManagerInstance] = new io._HttpSessionManager();
+      }
+      return this[_sessionManagerInstance];
+    }
+    connectionsInfo() {
+      let result = new io.HttpConnectionsInfo();
+      result.total = dart.notNull(this[_activeConnections].length) + dart.notNull(this[_idleConnections].length);
+      this[_activeConnections].forEach(dart.fn(conn => {
+        if (dart.test(conn[_isActive])) {
+          result.active = dart.notNull(result.active) + 1;
+        } else {
+          dart.assert(conn[_isClosing]);
+          result.closing = dart.notNull(result.closing) + 1;
+        }
+      }, _HttpConnectionToNull()));
+      this[_idleConnections].forEach(dart.fn(conn => {
+        result.idle = dart.notNull(result.idle) + 1;
+        dart.assert(conn[_isIdle]);
+      }, _HttpConnectionToNull()));
+      return result;
+    }
+    get [_serviceTypePath]() {
+      return 'io/http/servers';
+    }
+    get [_serviceTypeName]() {
+      return 'HttpServer';
+    }
+    [_toJSON$](ref) {
+      let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: dart.str`${this.address.host}:${this.port}`, user_name: dart.str`${this.address.host}:${this.port}`}, core.String, dart.dynamic);
+      if (dart.test(ref)) {
+        return r;
+      }
+      try {
+        r[dartx._set]('socket', dart.dsend(this[_serverSocket], _toJSON$, true));
+      } catch (_) {
+        r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+      }
+
+      r[dartx._set]('port', this.port);
+      r[dartx._set]('address', this.address.host);
+      r[dartx._set]('active', this[_activeConnections].map(core.Map)(dart.fn(c => c[_toJSON$](true), _HttpConnectionToMap()))[dartx.toList]());
+      r[dartx._set]('idle', this[_idleConnections].map(core.Map)(dart.fn(c => c[_toJSON$](true), _HttpConnectionToMap()))[dartx.toList]());
+      r[dartx._set]('closed', this.closed);
+      return r;
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpServer);
+  dart.defineNamedConstructor(io._HttpServer, '_');
+  dart.defineNamedConstructor(io._HttpServer, 'listenOn');
+  io._HttpServer[dart.implements] = () => [io.HttpServer];
+  dart.setSignature(io._HttpServer, {
+    constructors: () => ({
+      _: dart.definiteFunctionType(io._HttpServer, [dart.dynamic, core.bool]),
+      listenOn: dart.definiteFunctionType(io._HttpServer, [dart.dynamic])
+    }),
+    fields: () => ({
+      serverHeader: core.String,
+      defaultResponseHeaders: io.HttpHeaders,
+      autoCompress: core.bool,
+      [_idleTimeout]: core.Duration,
+      [_idleTimer]: async.Timer,
+      [_sessionManagerInstance]: io._HttpSessionManager,
+      closed: core.bool,
+      [_serverSocket]: dart.dynamic,
+      [_closeServer]: core.bool,
+      [_activeConnections]: LinkedListOf_HttpConnection(),
+      [_idleConnections]: LinkedListOf_HttpConnection(),
+      [_controller$0]: StreamControllerOfHttpRequest()
+    }),
+    getters: () => ({
+      idleTimeout: dart.definiteFunctionType(core.Duration, []),
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, []),
+      [_sessionManager]: dart.definiteFunctionType(io._HttpSessionManager, []),
+      [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+      [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+    }),
+    setters: () => ({
+      idleTimeout: dart.definiteFunctionType(dart.void, [core.Duration]),
+      sessionTimeout: dart.definiteFunctionType(dart.void, [core.int])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.HttpRequest), [HttpRequestTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(async.Future, [], {force: core.bool}),
+      [_maybePerformCleanup]: dart.definiteFunctionType(dart.void, []),
+      [_handleRequest]: dart.definiteFunctionType(dart.void, [io._HttpRequest]),
+      [_connectionClosed]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+      [_markIdle]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+      [_markActive]: dart.definiteFunctionType(dart.void, [io._HttpConnection]),
+      connectionsInfo: dart.definiteFunctionType(io.HttpConnectionsInfo, []),
+      [_toJSON$]: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [core.bool])
+    }),
+    sfields: () => ({_servers: MapOfint$_HttpServer()}),
+    statics: () => ({
+      bind: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, core.int, core.bool, core.bool]),
+      bindSecure: dart.definiteFunctionType(async.Future$(io.HttpServer), [dart.dynamic, core.int, io.SecurityContext, core.int, core.bool, core.bool, core.bool]),
+      _initDefaultResponseHeaders: dart.definiteFunctionType(io.HttpHeaders, [])
+    }),
+    names: ['bind', 'bindSecure', '_initDefaultResponseHeaders']
+  });
+  dart.defineLazy(io._HttpServer, {
+    get _servers() {
+      return MapOfint$_HttpServer().new();
+    },
+    set _servers(_) {}
+  });
+  io._Proxy = class _Proxy extends core.Object {
+    new(host, port, username, password) {
+      this.host = host;
+      this.port = port;
+      this.username = username;
+      this.password = password;
+      this.isDirect = false;
+    }
+    direct() {
+      this.host = null;
+      this.port = null;
+      this.username = null;
+      this.password = null;
+      this.isDirect = true;
+    }
+    get isAuthenticated() {
+      return this.username != null;
+    }
+  };
+  dart.defineNamedConstructor(io._Proxy, 'direct');
+  dart.setSignature(io._Proxy, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._Proxy, [core.String, core.int, core.String, core.String]),
+      direct: dart.definiteFunctionType(io._Proxy, [])
+    }),
+    fields: () => ({
+      host: core.String,
+      port: core.int,
+      username: core.String,
+      password: core.String,
+      isDirect: core.bool
+    }),
+    getters: () => ({isAuthenticated: dart.definiteFunctionType(core.bool, [])})
+  });
+  let const$73;
+  let const$74;
+  io._ProxyConfiguration = class _ProxyConfiguration extends core.Object {
+    new(configuration) {
+      this.proxies = ListOf_Proxy().new();
+      if (configuration == null) {
+        dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+      }
+      let list = configuration[dartx.split](";");
+      list[dartx.forEach](dart.fn(proxy => {
+        proxy = proxy[dartx.trim]();
+        if (!dart.test(proxy[dartx.isEmpty])) {
+          if (dart.test(proxy[dartx.startsWith](io._ProxyConfiguration.PROXY_PREFIX))) {
+            let username = null;
+            let password = null;
+            proxy = proxy[dartx.substring](io._ProxyConfiguration.PROXY_PREFIX[dartx.length])[dartx.trim]();
+            let at = proxy[dartx.indexOf]("@");
+            if (at != -1) {
+              let userinfo = proxy[dartx.substring](0, at)[dartx.trim]();
+              proxy = proxy[dartx.substring](dart.notNull(at) + 1)[dartx.trim]();
+              let colon = userinfo[dartx.indexOf](":");
+              if (colon == -1 || colon == 0 || colon == dart.notNull(proxy[dartx.length]) - 1) {
+                dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+              }
+              username = userinfo[dartx.substring](0, colon)[dartx.trim]();
+              password = userinfo[dartx.substring](dart.notNull(colon) + 1)[dartx.trim]();
+            }
+            let colon = proxy[dartx.lastIndexOf](":");
+            if (colon == -1 || colon == 0 || colon == dart.notNull(proxy[dartx.length]) - 1) {
+              dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+            }
+            let host = proxy[dartx.substring](0, colon)[dartx.trim]();
+            if (dart.test(host[dartx.startsWith]("[")) && dart.test(host[dartx.endsWith]("]"))) {
+              host = host[dartx.substring](1, dart.notNull(host[dartx.length]) - 1);
+            }
+            let portString = proxy[dartx.substring](dart.notNull(colon) + 1)[dartx.trim]();
+            let port = null;
+            try {
+              port = core.int.parse(portString);
+            } catch (e) {
+              if (core.FormatException.is(e)) {
+                dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}, ` + dart.str`invalid port '${portString}'`));
+              } else
+                throw e;
+            }
+
+            this.proxies[dartx.add](new io._Proxy(host, port, username, password));
+          } else if (proxy[dartx.trim]() == io._ProxyConfiguration.DIRECT_PREFIX) {
+            this.proxies[dartx.add](new io._Proxy.direct());
+          } else {
+            dart.throw(new io.HttpException(dart.str`Invalid proxy configuration ${configuration}`));
+          }
+        }
+      }, StringToNull()));
+    }
+    direct() {
+      this.proxies = const$74 || (const$74 = dart.constList([const$73 || (const$73 = dart.const(new io._Proxy.direct()))], io._Proxy));
+    }
+  };
+  dart.defineNamedConstructor(io._ProxyConfiguration, 'direct');
+  dart.setSignature(io._ProxyConfiguration, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._ProxyConfiguration, [core.String]),
+      direct: dart.definiteFunctionType(io._ProxyConfiguration, [])
+    }),
+    fields: () => ({proxies: ListOf_Proxy()}),
+    sfields: () => ({
+      PROXY_PREFIX: core.String,
+      DIRECT_PREFIX: core.String
+    })
+  });
+  io._ProxyConfiguration.PROXY_PREFIX = "PROXY ";
+  io._ProxyConfiguration.DIRECT_PREFIX = "DIRECT";
+  io._HttpConnectionInfo = class _HttpConnectionInfo extends core.Object {
+    new() {
+      this.remoteAddress = null;
+      this.remotePort = null;
+      this.localPort = null;
+    }
+    static create(socket) {
+      if (socket == null) return null;
+      try {
+        let info = new io._HttpConnectionInfo();
+        info.remoteAddress = socket.remoteAddress;
+        info.remotePort = socket.remotePort;
+        info.localPort = socket.port;
+        return info;
+      } catch (e) {
+      }
+
+      return null;
+    }
+  };
+  io._HttpConnectionInfo[dart.implements] = () => [io.HttpConnectionInfo];
+  dart.setSignature(io._HttpConnectionInfo, {
+    fields: () => ({
+      remoteAddress: io.InternetAddress,
+      remotePort: core.int,
+      localPort: core.int
+    }),
+    statics: () => ({create: dart.definiteFunctionType(io._HttpConnectionInfo, [io.Socket])}),
+    names: ['create']
+  });
+  io._DetachedSocket = class _DetachedSocket extends async.Stream$(core.List$(core.int)) {
+    new(socket, incoming) {
+      this[_socket] = socket;
+      this[_incoming] = incoming;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_incoming].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get encoding() {
+      return convert.Encoding._check(dart.dload(this[_socket], 'encoding'));
+    }
+    set encoding(value) {
+      dart.dput(this[_socket], 'encoding', value);
+    }
+    write(obj) {
+      dart.dsend(this[_socket], 'write', obj);
+    }
+    writeln(obj) {
+      if (obj === void 0) obj = "";
+      dart.dsend(this[_socket], 'writeln', obj);
+    }
+    writeCharCode(charCode) {
+      dart.dsend(this[_socket], 'writeCharCode', charCode);
+    }
+    writeAll(objects, separator) {
+      if (separator === void 0) separator = "";
+      dart.dsend(this[_socket], 'writeAll', objects, separator);
+    }
+    add(bytes) {
+      dart.dsend(this[_socket], 'add', bytes);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      return dart.dsend(this[_socket], 'addError', error, stackTrace);
+    }
+    addStream(stream) {
+      return FutureOfSocket()._check(dart.dsend(this[_socket], 'addStream', stream));
+    }
+    destroy() {
+      dart.dsend(this[_socket], 'destroy');
+    }
+    flush() {
+      return async.Future._check(dart.dsend(this[_socket], 'flush'));
+    }
+    close() {
+      return async.Future._check(dart.dsend(this[_socket], 'close'));
+    }
+    get done() {
+      return FutureOfSocket()._check(dart.dload(this[_socket], 'done'));
+    }
+    get port() {
+      return core.int._check(dart.dload(this[_socket], 'port'));
+    }
+    get address() {
+      return io.InternetAddress._check(dart.dload(this[_socket], 'address'));
+    }
+    get remoteAddress() {
+      return io.InternetAddress._check(dart.dload(this[_socket], 'remoteAddress'));
+    }
+    get remotePort() {
+      return core.int._check(dart.dload(this[_socket], 'remotePort'));
+    }
+    setOption(option, enabled) {
+      return core.bool._check(dart.dsend(this[_socket], 'setOption', option, enabled));
+    }
+    [_toJSON$](ref) {
+      return core.Map._check(dart.dsend(this[_socket], _toJSON$, ref));
+    }
+    set [_owner](owner) {
+      dart.dput(this[_socket], _owner, owner);
+    }
+  };
+  dart.addSimpleTypeTests(io._DetachedSocket);
+  io._DetachedSocket[dart.implements] = () => [io.Socket];
+  dart.setSignature(io._DetachedSocket, {
+    constructors: () => ({new: dart.definiteFunctionType(io._DetachedSocket, [dart.dynamic, StreamOfListOfint()])}),
+    fields: () => ({
+      [_incoming]: StreamOfListOfint(),
+      [_socket]: dart.dynamic
+    }),
+    getters: () => ({
+      encoding: dart.definiteFunctionType(convert.Encoding, []),
+      done: dart.definiteFunctionType(async.Future$(io.Socket), []),
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, []),
+      remoteAddress: dart.definiteFunctionType(io.InternetAddress, []),
+      remotePort: dart.definiteFunctionType(core.int, [])
+    }),
+    setters: () => ({
+      encoding: dart.definiteFunctionType(dart.void, [convert.Encoding]),
+      [_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      write: dart.definiteFunctionType(dart.void, [core.Object]),
+      writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+      writeCharCode: dart.definiteFunctionType(dart.void, [core.int]),
+      writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future$(io.Socket), [StreamOfListOfint()]),
+      destroy: dart.definiteFunctionType(dart.void, []),
+      flush: dart.definiteFunctionType(async.Future, []),
+      close: dart.definiteFunctionType(async.Future, []),
+      setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
+      [_toJSON$]: dart.definiteFunctionType(core.Map, [core.bool])
+    })
+  });
+  const _scheme = Symbol('_scheme');
+  io._AuthenticationScheme = class _AuthenticationScheme extends core.Object {
+    new(scheme) {
+      this[_scheme] = scheme;
+    }
+    static fromString(scheme) {
+      if (scheme[dartx.toLowerCase]() == "basic") return io._AuthenticationScheme.BASIC;
+      if (scheme[dartx.toLowerCase]() == "digest") return io._AuthenticationScheme.DIGEST;
+      return io._AuthenticationScheme.UNKNOWN;
+    }
+    toString() {
+      if (dart.equals(this, io._AuthenticationScheme.BASIC)) return "Basic";
+      if (dart.equals(this, io._AuthenticationScheme.DIGEST)) return "Digest";
+      return "Unknown";
+    }
+  };
+  dart.setSignature(io._AuthenticationScheme, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io._AuthenticationScheme, [core.int]),
+      fromString: dart.definiteFunctionType(io._AuthenticationScheme, [core.String])
+    }),
+    fields: () => ({[_scheme]: core.int}),
+    sfields: () => ({
+      UNKNOWN: io._AuthenticationScheme,
+      BASIC: io._AuthenticationScheme,
+      DIGEST: io._AuthenticationScheme
+    })
+  });
+  dart.defineLazy(io._AuthenticationScheme, {
+    get UNKNOWN() {
+      return dart.const(new io._AuthenticationScheme(-1));
+    },
+    get BASIC() {
+      return dart.const(new io._AuthenticationScheme(0));
+    },
+    get DIGEST() {
+      return dart.const(new io._AuthenticationScheme(1));
+    }
+  });
+  io._Credentials = class _Credentials extends core.Object {
+    new(credentials, realm) {
+      this.credentials = credentials;
+      this.realm = realm;
+      this.used = false;
+      this.ha1 = null;
+      this.nonce = null;
+      this.algorithm = null;
+      this.qop = null;
+      this.nonceCount = null;
+      if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST)) {
+        let creds = io._HttpClientDigestCredentials._check(this.credentials);
+        let hasher = new io._MD5();
+        hasher.add(convert.UTF8.encode(creds.username));
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(this.realm[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(convert.UTF8.encode(creds.password));
+        this.ha1 = io._CryptoUtils.bytesToHex(hasher.close());
+      }
+    }
+    get scheme() {
+      return this.credentials.scheme;
+    }
+  };
+  dart.setSignature(io._Credentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._Credentials, [io._HttpClientCredentials, core.String])}),
+    fields: () => ({
+      credentials: io._HttpClientCredentials,
+      realm: core.String,
+      used: core.bool,
+      ha1: core.String,
+      nonce: core.String,
+      algorithm: core.String,
+      qop: core.String,
+      nonceCount: core.int
+    }),
+    getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])})
+  });
+  io._SiteCredentials = class _SiteCredentials extends io._Credentials {
+    new(uri, realm, creds) {
+      this.uri = uri;
+      super.new(creds, core.String._check(realm));
+    }
+    applies(uri, scheme) {
+      if (scheme != null && !dart.equals(this.credentials.scheme, scheme)) return false;
+      if (uri.host != this.uri.host) return false;
+      let thisPort = this.uri.port == 0 ? io.HttpClient.DEFAULT_HTTP_PORT : this.uri.port;
+      let otherPort = uri.port == 0 ? io.HttpClient.DEFAULT_HTTP_PORT : uri.port;
+      if (otherPort != thisPort) return false;
+      return uri.path[dartx.startsWith](this.uri.path);
+    }
+    authorize(request) {
+      if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST) && this.nonce == null) {
+        return;
+      }
+      this.credentials.authorize(this, request);
+      this.used = true;
+    }
+  };
+  dart.setSignature(io._SiteCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SiteCredentials, [core.Uri, dart.dynamic, io._HttpClientCredentials])}),
+    fields: () => ({uri: core.Uri}),
+    methods: () => ({
+      applies: dart.definiteFunctionType(core.bool, [core.Uri, io._AuthenticationScheme]),
+      authorize: dart.definiteFunctionType(dart.void, [io.HttpClientRequest])
+    })
+  });
+  io._ProxyCredentials = class _ProxyCredentials extends io._Credentials {
+    new(host, port, realm, creds) {
+      this.host = host;
+      this.port = port;
+      super.new(creds, core.String._check(realm));
+    }
+    applies(proxy, scheme) {
+      if (scheme != null && !dart.equals(this.credentials.scheme, scheme)) return false;
+      return proxy.host == this.host && proxy.port == this.port;
+    }
+    authorize(request) {
+      if (dart.equals(this.credentials.scheme, io._AuthenticationScheme.DIGEST) && this.nonce == null) {
+        return;
+      }
+      this.credentials.authorizeProxy(this, request);
+    }
+  };
+  dart.setSignature(io._ProxyCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ProxyCredentials, [core.String, core.int, dart.dynamic, io._HttpClientCredentials])}),
+    fields: () => ({
+      host: core.String,
+      port: core.int
+    }),
+    methods: () => ({
+      applies: dart.definiteFunctionType(core.bool, [io._Proxy, io._AuthenticationScheme]),
+      authorize: dart.definiteFunctionType(dart.void, [io.HttpClientRequest])
+    })
+  });
+  io._HttpClientCredentials = class _HttpClientCredentials extends core.Object {};
+  io._HttpClientCredentials[dart.implements] = () => [io.HttpClientCredentials];
+  io._HttpClientBasicCredentials = class _HttpClientBasicCredentials extends io._HttpClientCredentials {
+    new(username, password) {
+      this.username = username;
+      this.password = password;
+    }
+    get scheme() {
+      return io._AuthenticationScheme.BASIC;
+    }
+    authorization() {
+      let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(dart.str`${this.username}:${this.password}`));
+      return dart.str`Basic ${auth}`;
+    }
+    authorize(_, request) {
+      request.headers.set(io.HttpHeaders.AUTHORIZATION, this.authorization());
+    }
+    authorizeProxy(_, request) {
+      request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, this.authorization());
+    }
+  };
+  io._HttpClientBasicCredentials[dart.implements] = () => [io.HttpClientBasicCredentials];
+  dart.setSignature(io._HttpClientBasicCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientBasicCredentials, [core.String, core.String])}),
+    fields: () => ({
+      username: core.String,
+      password: core.String
+    }),
+    getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])}),
+    methods: () => ({
+      authorization: dart.definiteFunctionType(core.String, []),
+      authorize: dart.definiteFunctionType(dart.void, [io._Credentials, io.HttpClientRequest]),
+      authorizeProxy: dart.definiteFunctionType(dart.void, [io._ProxyCredentials, io.HttpClientRequest])
+    })
+  });
+  io._HttpClientDigestCredentials = class _HttpClientDigestCredentials extends io._HttpClientCredentials {
+    new(username, password) {
+      this.username = username;
+      this.password = password;
+    }
+    get scheme() {
+      return io._AuthenticationScheme.DIGEST;
+    }
+    authorization(credentials, request) {
+      let requestUri = request[_requestUri]();
+      let hasher = new io._MD5();
+      hasher.add(request.method[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      hasher.add(requestUri[dartx.codeUnits]);
+      let ha2 = io._CryptoUtils.bytesToHex(hasher.close());
+      let qop = null;
+      let cnonce = null;
+      let nc = null;
+      let x = null;
+      hasher = new io._MD5();
+      hasher.add(credentials.ha1[dartx.codeUnits]);
+      hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+      if (credentials.qop == "auth") {
+        qop = credentials.qop;
+        cnonce = io._CryptoUtils.bytesToHex(io._IOCrypto.getRandomBytes(4));
+        credentials.nonceCount = dart.notNull(credentials.nonceCount) + 1;
+        nc = credentials.nonceCount[dartx.toRadixString](16);
+        nc = dart.notNull("00000000"[dartx.substring](0, 8 - dart.notNull(nc[dartx.length]) + 1)) + dart.notNull(nc);
+        hasher.add(credentials.nonce[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(nc[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(cnonce[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(credentials.qop[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(ha2[dartx.codeUnits]);
+      } else {
+        hasher.add(credentials.nonce[dartx.codeUnits]);
+        hasher.add(JSArrayOfint().of([io._CharCode.COLON]));
+        hasher.add(ha2[dartx.codeUnits]);
+      }
+      let response = io._CryptoUtils.bytesToHex(hasher.close());
+      let buffer = new core.StringBuffer();
+      buffer.write('Digest ');
+      buffer.write(dart.str`username="${this.username}"`);
+      buffer.write(dart.str`, realm="${credentials.realm}"`);
+      buffer.write(dart.str`, nonce="${credentials.nonce}"`);
+      buffer.write(dart.str`, uri="${requestUri}"`);
+      buffer.write(dart.str`, algorithm="${credentials.algorithm}"`);
+      if (qop == "auth") {
+        buffer.write(dart.str`, qop="${qop}"`);
+        buffer.write(dart.str`, cnonce="${cnonce}"`);
+        buffer.write(dart.str`, nc="${nc}"`);
+      }
+      buffer.write(dart.str`, response="${response}"`);
+      return buffer.toString();
+    }
+    authorize(credentials, request) {
+      request.headers.set(io.HttpHeaders.AUTHORIZATION, this.authorization(credentials, io._HttpClientRequest._check(request)));
+    }
+    authorizeProxy(credentials, request) {
+      request.headers.set(io.HttpHeaders.PROXY_AUTHORIZATION, this.authorization(credentials, io._HttpClientRequest._check(request)));
+    }
+  };
+  io._HttpClientDigestCredentials[dart.implements] = () => [io.HttpClientDigestCredentials];
+  dart.setSignature(io._HttpClientDigestCredentials, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpClientDigestCredentials, [core.String, core.String])}),
+    fields: () => ({
+      username: core.String,
+      password: core.String
+    }),
+    getters: () => ({scheme: dart.definiteFunctionType(io._AuthenticationScheme, [])}),
+    methods: () => ({
+      authorization: dart.definiteFunctionType(core.String, [io._Credentials, io._HttpClientRequest]),
+      authorize: dart.definiteFunctionType(dart.void, [io._Credentials, io.HttpClientRequest]),
+      authorizeProxy: dart.definiteFunctionType(dart.void, [io._ProxyCredentials, io.HttpClientRequest])
+    })
+  });
+  io._RedirectInfo = class _RedirectInfo extends core.Object {
+    new(statusCode, method, location) {
+      this.statusCode = statusCode;
+      this.method = method;
+      this.location = location;
+    }
+  };
+  io._RedirectInfo[dart.implements] = () => [io.RedirectInfo];
+  dart.setSignature(io._RedirectInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RedirectInfo, [core.int, core.String, core.Uri])}),
+    fields: () => ({
+      statusCode: core.int,
+      method: core.String,
+      location: core.Uri
+    })
+  });
+  io._getHttpVersion = function() {
+    let version = io.Platform.version;
+    let index = version[dartx.indexOf]('.', dart.notNull(version[dartx.indexOf]('.')) + 1);
+    version = version[dartx.substring](0, index);
+    return dart.str`Dart/${version} (dart:io)`;
+  };
+  dart.fn(io._getHttpVersion, VoidToString$());
+  io._Const = class _Const extends core.Object {};
+  dart.setSignature(io._Const, {
+    sfields: () => ({
+      HTTP: ListOfint(),
+      HTTP1DOT: ListOfint(),
+      HTTP10: ListOfint(),
+      HTTP11: ListOfint(),
+      T: core.bool,
+      F: core.bool,
+      SEPARATOR_MAP: ListOfbool()
+    })
+  });
+  io._Const.HTTP = dart.constList([72, 84, 84, 80], core.int);
+  io._Const.HTTP1DOT = dart.constList([72, 84, 84, 80, 47, 49, 46], core.int);
+  io._Const.HTTP10 = dart.constList([72, 84, 84, 80, 47, 49, 46, 48], core.int);
+  io._Const.HTTP11 = dart.constList([72, 84, 84, 80, 47, 49, 46, 49], core.int);
+  io._Const.T = true;
+  io._Const.F = false;
+  dart.defineLazy(io._Const, {
+    get SEPARATOR_MAP() {
+      return dart.constList([io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.T, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.T, io._Const.F, io._Const.T, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F, io._Const.F], core.bool);
+    }
+  });
+  io._CharCode = class _CharCode extends core.Object {};
+  dart.setSignature(io._CharCode, {
+    sfields: () => ({
+      HT: core.int,
+      LF: core.int,
+      CR: core.int,
+      SP: core.int,
+      AMPERSAND: core.int,
+      COMMA: core.int,
+      DASH: core.int,
+      SLASH: core.int,
+      ZERO: core.int,
+      ONE: core.int,
+      COLON: core.int,
+      SEMI_COLON: core.int,
+      EQUAL: core.int
+    })
+  });
+  io._CharCode.HT = 9;
+  io._CharCode.LF = 10;
+  io._CharCode.CR = 13;
+  io._CharCode.SP = 32;
+  io._CharCode.AMPERSAND = 38;
+  io._CharCode.COMMA = 44;
+  io._CharCode.DASH = 45;
+  io._CharCode.SLASH = 47;
+  io._CharCode.ZERO = 48;
+  io._CharCode.ONE = 49;
+  io._CharCode.COLON = 58;
+  io._CharCode.SEMI_COLON = 59;
+  io._CharCode.EQUAL = 61;
+  io._State = class _State extends core.Object {};
+  dart.setSignature(io._State, {
+    sfields: () => ({
+      START: core.int,
+      METHOD_OR_RESPONSE_HTTP_VERSION: core.int,
+      RESPONSE_HTTP_VERSION: core.int,
+      REQUEST_LINE_METHOD: core.int,
+      REQUEST_LINE_URI: core.int,
+      REQUEST_LINE_HTTP_VERSION: core.int,
+      REQUEST_LINE_ENDING: core.int,
+      RESPONSE_LINE_STATUS_CODE: core.int,
+      RESPONSE_LINE_REASON_PHRASE: core.int,
+      RESPONSE_LINE_ENDING: core.int,
+      HEADER_START: core.int,
+      HEADER_FIELD: core.int,
+      HEADER_VALUE_START: core.int,
+      HEADER_VALUE: core.int,
+      HEADER_VALUE_FOLDING_OR_ENDING: core.int,
+      HEADER_VALUE_FOLD_OR_END: core.int,
+      HEADER_ENDING: core.int,
+      CHUNK_SIZE_STARTING_CR: core.int,
+      CHUNK_SIZE_STARTING_LF: core.int,
+      CHUNK_SIZE: core.int,
+      CHUNK_SIZE_EXTENSION: core.int,
+      CHUNK_SIZE_ENDING: core.int,
+      CHUNKED_BODY_DONE_CR: core.int,
+      CHUNKED_BODY_DONE_LF: core.int,
+      BODY: core.int,
+      CLOSED: core.int,
+      UPGRADED: core.int,
+      FAILURE: core.int,
+      FIRST_BODY_STATE: core.int
+    })
+  });
+  io._State.START = 0;
+  io._State.METHOD_OR_RESPONSE_HTTP_VERSION = 1;
+  io._State.RESPONSE_HTTP_VERSION = 2;
+  io._State.REQUEST_LINE_METHOD = 3;
+  io._State.REQUEST_LINE_URI = 4;
+  io._State.REQUEST_LINE_HTTP_VERSION = 5;
+  io._State.REQUEST_LINE_ENDING = 6;
+  io._State.RESPONSE_LINE_STATUS_CODE = 7;
+  io._State.RESPONSE_LINE_REASON_PHRASE = 8;
+  io._State.RESPONSE_LINE_ENDING = 9;
+  io._State.HEADER_START = 10;
+  io._State.HEADER_FIELD = 11;
+  io._State.HEADER_VALUE_START = 12;
+  io._State.HEADER_VALUE = 13;
+  io._State.HEADER_VALUE_FOLDING_OR_ENDING = 14;
+  io._State.HEADER_VALUE_FOLD_OR_END = 15;
+  io._State.HEADER_ENDING = 16;
+  io._State.CHUNK_SIZE_STARTING_CR = 17;
+  io._State.CHUNK_SIZE_STARTING_LF = 18;
+  io._State.CHUNK_SIZE = 19;
+  io._State.CHUNK_SIZE_EXTENSION = 20;
+  io._State.CHUNK_SIZE_ENDING = 21;
+  io._State.CHUNKED_BODY_DONE_CR = 22;
+  io._State.CHUNKED_BODY_DONE_LF = 23;
+  io._State.BODY = 24;
+  io._State.CLOSED = 25;
+  io._State.UPGRADED = 26;
+  io._State.FAILURE = 27;
+  dart.defineLazy(io._State, {
+    get FIRST_BODY_STATE() {
+      return io._State.CHUNK_SIZE_STARTING_CR;
+    }
+  });
+  io._HttpVersion = class _HttpVersion extends core.Object {};
+  dart.setSignature(io._HttpVersion, {
+    sfields: () => ({
+      UNDETERMINED: core.int,
+      HTTP10: core.int,
+      HTTP11: core.int
+    })
+  });
+  io._HttpVersion.UNDETERMINED = 0;
+  io._HttpVersion.HTTP10 = 1;
+  io._HttpVersion.HTTP11 = 2;
+  io._MessageType = class _MessageType extends core.Object {};
+  dart.setSignature(io._MessageType, {
+    sfields: () => ({
+      UNDETERMINED: core.int,
+      REQUEST: core.int,
+      RESPONSE: core.int
+    })
+  });
+  io._MessageType.UNDETERMINED = 0;
+  io._MessageType.REQUEST = 1;
+  io._MessageType.RESPONSE = 0;
+  const _injectData = Symbol('_injectData');
+  const _userOnData = Symbol('_userOnData');
+  const _isCanceled$ = Symbol('_isCanceled');
+  const _pauseCount$ = Symbol('_pauseCount');
+  const _scheduled = Symbol('_scheduled');
+  const _maybeScheduleData = Symbol('_maybeScheduleData');
+  io._HttpDetachedStreamSubscription = class _HttpDetachedStreamSubscription extends core.Object {
+    new(subscription, injectData, userOnData) {
+      this[_subscription$] = subscription;
+      this[_injectData] = injectData;
+      this[_userOnData] = userOnData;
+      this[_isCanceled$] = false;
+      this[_pauseCount$] = 1;
+      this[_scheduled] = false;
+    }
+    get isPaused() {
+      return this[_subscription$].isPaused;
+    }
+    asFuture(T) {
+      return futureValue => {
+        if (futureValue === void 0) futureValue = null;
+        return this[_subscription$].asFuture(T)(futureValue);
+      };
+    }
+    cancel() {
+      this[_isCanceled$] = true;
+      this[_injectData] = null;
+      return this[_subscription$].cancel();
+    }
+    onData(handleData) {
+      this[_userOnData] = handleData;
+      this[_subscription$].onData(handleData);
+    }
+    onDone(handleDone) {
+      this[_subscription$].onDone(handleDone);
+    }
+    onError(handleError) {
+      this[_subscription$].onError(handleError);
+    }
+    pause(resumeSignal) {
+      if (resumeSignal === void 0) resumeSignal = null;
+      if (this[_injectData] == null) {
+        this[_subscription$].pause(resumeSignal);
+      } else {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) + 1;
+        if (resumeSignal != null) {
+          resumeSignal.whenComplete(dart.bind(this, 'resume'));
+        }
+      }
+    }
+    resume() {
+      if (this[_injectData] == null) {
+        this[_subscription$].resume();
+      } else {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) - 1;
+        this[_maybeScheduleData]();
+      }
+    }
+    [_maybeScheduleData]() {
+      if (dart.test(this[_scheduled])) return;
+      if (this[_pauseCount$] != 0) return;
+      this[_scheduled] = true;
+      async.scheduleMicrotask(dart.fn(() => {
+        this[_scheduled] = false;
+        if (dart.notNull(this[_pauseCount$]) > 0 || dart.test(this[_isCanceled$])) return;
+        let data = this[_injectData];
+        this[_injectData] = null;
+        this[_subscription$].resume();
+        if (this[_userOnData] != null) {
+          dart.dcall(this[_userOnData], data);
+        }
+      }, VoidToNull()));
+    }
+  };
+  io._HttpDetachedStreamSubscription[dart.implements] = () => [StreamSubscriptionOfListOfint()];
+  dart.setSignature(io._HttpDetachedStreamSubscription, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpDetachedStreamSubscription, [StreamSubscriptionOfListOfint(), ListOfint(), core.Function])}),
+    fields: () => ({
+      [_subscription$]: StreamSubscriptionOfListOfint(),
+      [_injectData]: ListOfint(),
+      [_isCanceled$]: core.bool,
+      [_pauseCount$]: core.int,
+      [_userOnData]: core.Function,
+      [_scheduled]: core.bool
+    }),
+    getters: () => ({isPaused: dart.definiteFunctionType(core.bool, [])}),
+    methods: () => ({
+      asFuture: dart.definiteFunctionType(T => [async.Future$(T), [], [T]]),
+      cancel: dart.definiteFunctionType(async.Future, []),
+      onData: dart.definiteFunctionType(dart.void, [ListOfintTovoid()]),
+      onDone: dart.definiteFunctionType(dart.void, [VoidTovoid()]),
+      onError: dart.definiteFunctionType(dart.void, [core.Function]),
+      pause: dart.definiteFunctionType(dart.void, [], [async.Future]),
+      resume: dart.definiteFunctionType(dart.void, []),
+      [_maybeScheduleData]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._HttpDetachedIncoming = class _HttpDetachedIncoming extends async.Stream$(core.List$(core.int)) {
+    new(subscription, bufferedData) {
+      this.subscription = subscription;
+      this.bufferedData = bufferedData;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      if (this.subscription != null) {
+        this.subscription.onData(onData);
+        this.subscription.onError(onError);
+        this.subscription.onDone(onDone);
+        if (this.bufferedData == null) {
+          return StreamSubscriptionOfListOfint()._check(((() => {
+            this.subscription.resume();
+            return this.subscription;
+          })()));
+        }
+        let _ = new io._HttpDetachedStreamSubscription(StreamSubscriptionOfListOfint()._check(this.subscription), this.bufferedData, onData);
+        _.resume();
+        return _;
+      } else {
+        return StreamOfint().fromIterable(this.bufferedData).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+      }
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpDetachedIncoming);
+  dart.setSignature(io._HttpDetachedIncoming, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpDetachedIncoming, [async.StreamSubscription, ListOfint()])}),
+    fields: () => ({
+      subscription: async.StreamSubscription,
+      bufferedData: ListOfint()
+    }),
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+  });
+  const _method$ = Symbol('_method');
+  const _uri_or_reason_phrase = Symbol('_uri_or_reason_phrase');
+  const _headerField = Symbol('_headerField');
+  const _headerValue = Symbol('_headerValue');
+  const _requestParser = Symbol('_requestParser');
+  const _parserCalled = Symbol('_parserCalled');
+  const _index$2 = Symbol('_index');
+  const _httpVersionIndex = Symbol('_httpVersionIndex');
+  const _messageType = Symbol('_messageType');
+  const _statusCodeLength = Symbol('_statusCodeLength');
+  const _httpVersion = Symbol('_httpVersion');
+  const _connectionUpgrade = Symbol('_connectionUpgrade');
+  const _chunked = Symbol('_chunked');
+  const _noMessageBody = Symbol('_noMessageBody');
+  const _remainingContent = Symbol('_remainingContent');
+  const _socketSubscription = Symbol('_socketSubscription');
+  const _paused = Symbol('_paused');
+  const _bodyPaused = Symbol('_bodyPaused');
+  const _bodyController = Symbol('_bodyController');
+  const _pauseStateChanged = Symbol('_pauseStateChanged');
+  const _reset = Symbol('_reset');
+  const _onData$ = Symbol('_onData');
+  const _onDone$ = Symbol('_onDone');
+  const _doParse = Symbol('_doParse');
+  const _reportError = Symbol('_reportError');
+  const _createIncoming = Symbol('_createIncoming');
+  const _closeIncoming = Symbol('_closeIncoming');
+  const _headersEnd = Symbol('_headersEnd');
+  const _expect = Symbol('_expect');
+  const _caseInsensitiveCompare = Symbol('_caseInsensitiveCompare');
+  const _expectHexDigit = Symbol('_expectHexDigit');
+  const _releaseBuffer = Symbol('_releaseBuffer');
+  io._HttpParser = class _HttpParser extends async.Stream$(io._HttpIncoming) {
+    static requestParser() {
+      return new io._HttpParser._(true);
+    }
+    static responseParser() {
+      return new io._HttpParser._(false);
+    }
+    _(requestParser) {
+      this[_method$] = JSArrayOfint().of([]);
+      this[_uri_or_reason_phrase] = JSArrayOfint().of([]);
+      this[_headerField] = JSArrayOfint().of([]);
+      this[_headerValue] = JSArrayOfint().of([]);
+      this[_requestParser] = requestParser;
+      this[_parserCalled] = false;
+      this[_buffer$] = null;
+      this[_index$2] = null;
+      this[_state$1] = null;
+      this[_httpVersionIndex] = null;
+      this[_messageType] = null;
+      this[_statusCode] = 0;
+      this[_statusCodeLength] = 0;
+      this[_httpVersion] = null;
+      this[_transferLength] = -1;
+      this[_persistentConnection] = null;
+      this[_connectionUpgrade] = null;
+      this[_chunked] = null;
+      this[_noMessageBody] = false;
+      this[_remainingContent] = -1;
+      this[_headers] = null;
+      this[_incoming] = null;
+      this[_socketSubscription] = null;
+      this[_paused] = true;
+      this[_bodyPaused] = false;
+      this[_controller$0] = null;
+      this[_bodyController] = null;
+      super.new();
+      this[_controller$0] = StreamControllerOf_HttpIncoming().new({sync: true, onListen: dart.fn(() => {
+          this[_paused] = false;
+        }, VoidToNull()), onPause: dart.fn(() => {
+          this[_paused] = true;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onResume: dart.fn(() => {
+          this[_paused] = false;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onCancel: dart.fn(() => {
+          if (this[_socketSubscription] != null) {
+            this[_socketSubscription].cancel();
+          }
+        }, VoidToNull())});
+      this[_reset]();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    listenToStream(stream) {
+      this[_socketSubscription] = stream.listen(dart.bind(this, _onData$), {onError: dart.bind(this[_controller$0], 'addError'), onDone: dart.bind(this, _onDone$)});
+    }
+    [_parse]() {
+      try {
+        this[_doParse]();
+      } catch (e) {
+        let s = dart.stackTrace(e);
+        this[_state$1] = io._State.FAILURE;
+        this[_reportError](e, s);
+      }
+
+    }
+    [_headersEnd]() {
+      this[_headers][_mutable] = false;
+      this[_transferLength] = this[_headers].contentLength;
+      if (dart.test(this[_chunked])) this[_transferLength] = -1;
+      if (this[_messageType] == io._MessageType.REQUEST && dart.notNull(this[_transferLength]) < 0 && this[_chunked] == false) {
+        this[_transferLength] = 0;
+      }
+      if (dart.test(this[_connectionUpgrade])) {
+        this[_state$1] = io._State.UPGRADED;
+        this[_transferLength] = 0;
+      }
+      this[_createIncoming](this[_transferLength]);
+      if (dart.test(this[_requestParser])) {
+        this[_incoming].method = core.String.fromCharCodes(this[_method$]);
+        this[_incoming].uri = core.Uri.parse(core.String.fromCharCodes(this[_uri_or_reason_phrase]));
+      } else {
+        this[_incoming].statusCode = this[_statusCode];
+        this[_incoming].reasonPhrase = core.String.fromCharCodes(this[_uri_or_reason_phrase]);
+      }
+      this[_method$][dartx.clear]();
+      this[_uri_or_reason_phrase][dartx.clear]();
+      if (dart.test(this[_connectionUpgrade])) {
+        this[_incoming].upgraded = true;
+        this[_parserCalled] = false;
+        let tmp = this[_incoming];
+        this[_closeIncoming]();
+        this[_controller$0].add(tmp);
+        return true;
+      }
+      if (this[_transferLength] == 0 || this[_messageType] == io._MessageType.RESPONSE && dart.test(this[_noMessageBody])) {
+        this[_reset]();
+        let tmp = this[_incoming];
+        this[_closeIncoming]();
+        this[_controller$0].add(tmp);
+        return false;
+      } else if (dart.test(this[_chunked])) {
+        this[_state$1] = io._State.CHUNK_SIZE;
+        this[_remainingContent] = 0;
+      } else if (dart.notNull(this[_transferLength]) > 0) {
+        this[_remainingContent] = this[_transferLength];
+        this[_state$1] = io._State.BODY;
+      } else {
+        this[_state$1] = io._State.BODY;
+      }
+      this[_parserCalled] = false;
+      this[_controller$0].add(this[_incoming]);
+      return true;
+    }
+    [_doParse]() {
+      dart.assert(!dart.test(this[_parserCalled]));
+      this[_parserCalled] = true;
+      if (this[_state$1] == io._State.CLOSED) {
+        dart.throw(new io.HttpException("Data on closed connection"));
+      }
+      if (this[_state$1] == io._State.FAILURE) {
+        dart.throw(new io.HttpException("Data on failed connection"));
+      }
+      while (this[_buffer$] != null && dart.notNull(this[_index$2]) < dart.notNull(this[_buffer$][dartx.length]) && this[_state$1] != io._State.FAILURE && this[_state$1] != io._State.UPGRADED) {
+        if (this[_incoming] != null && dart.test(this[_bodyPaused]) || this[_incoming] == null && dart.test(this[_paused])) {
+          this[_parserCalled] = false;
+          return;
+        }
+        let byte = this[_buffer$][dartx._get]((() => {
+          let x = this[_index$2];
+          this[_index$2] = dart.notNull(x) + 1;
+          return x;
+        })());
+        switch (this[_state$1]) {
+          case io._State.START:
+          {
+            if (byte == io._Const.HTTP[dartx._get](0)) {
+              this[_httpVersionIndex] = 1;
+              this[_state$1] = io._State.METHOD_OR_RESPONSE_HTTP_VERSION;
+            } else {
+              if (!dart.test(io._HttpParser._isTokenChar(byte))) {
+                dart.throw(new io.HttpException("Invalid request method"));
+              }
+              this[_method$][dartx.add](byte);
+              if (!dart.test(this[_requestParser])) {
+                dart.throw(new io.HttpException("Invalid response line"));
+              }
+              this[_state$1] = io._State.REQUEST_LINE_METHOD;
+            }
+            break;
+          }
+          case io._State.METHOD_OR_RESPONSE_HTTP_VERSION:
+          {
+            if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP[dartx.length]) && byte == io._Const.HTTP[dartx._get](this[_httpVersionIndex])) {
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP[dartx.length] && byte == io._CharCode.SLASH) {
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+              if (dart.test(this[_requestParser])) {
+                dart.throw(new io.HttpException("Invalid request line"));
+              }
+              this[_state$1] = io._State.RESPONSE_HTTP_VERSION;
+            } else {
+              for (let i = 0; i < dart.notNull(this[_httpVersionIndex]); i++) {
+                this[_method$][dartx.add](io._Const.HTTP[dartx._get](i));
+              }
+              if (byte == io._CharCode.SP) {
+                this[_state$1] = io._State.REQUEST_LINE_URI;
+              } else {
+                this[_method$][dartx.add](byte);
+                this[_httpVersion] = io._HttpVersion.UNDETERMINED;
+                if (!dart.test(this[_requestParser])) {
+                  dart.throw(new io.HttpException("Invalid response line"));
+                }
+                this[_state$1] = io._State.REQUEST_LINE_METHOD;
+              }
+            }
+            break;
+          }
+          case io._State.RESPONSE_HTTP_VERSION:
+          {
+            if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP1DOT[dartx.length])) {
+              this[_expect](byte, io._Const.HTTP1DOT[dartx._get](this[_httpVersionIndex]));
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length] && byte == io._CharCode.ONE) {
+              this[_httpVersion] = io._HttpVersion.HTTP11;
+              this[_persistentConnection] = true;
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length] && byte == io._CharCode.ZERO) {
+              this[_httpVersion] = io._HttpVersion.HTTP10;
+              this[_persistentConnection] = false;
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == dart.notNull(io._Const.HTTP1DOT[dartx.length]) + 1) {
+              this[_expect](byte, io._CharCode.SP);
+              this[_state$1] = io._State.RESPONSE_LINE_STATUS_CODE;
+            } else {
+              dart.throw(new io.HttpException("Invalid response line"));
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_METHOD:
+          {
+            if (byte == io._CharCode.SP) {
+              this[_state$1] = io._State.REQUEST_LINE_URI;
+            } else {
+              if (dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte)) || byte == io._CharCode.CR || byte == io._CharCode.LF) {
+                dart.throw(new io.HttpException("Invalid request method"));
+              }
+              this[_method$][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_URI:
+          {
+            if (byte == io._CharCode.SP) {
+              if (this[_uri_or_reason_phrase][dartx.length] == 0) {
+                dart.throw(new io.HttpException("Invalid request URI"));
+              }
+              this[_state$1] = io._State.REQUEST_LINE_HTTP_VERSION;
+              this[_httpVersionIndex] = 0;
+            } else {
+              if (byte == io._CharCode.CR || byte == io._CharCode.LF) {
+                dart.throw(new io.HttpException("Invalid request URI"));
+              }
+              this[_uri_or_reason_phrase][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_HTTP_VERSION:
+          {
+            if (dart.notNull(this[_httpVersionIndex]) < dart.notNull(io._Const.HTTP1DOT[dartx.length])) {
+              this[_expect](byte, io._Const.HTTP11[dartx._get](this[_httpVersionIndex]));
+              this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+            } else if (this[_httpVersionIndex] == io._Const.HTTP1DOT[dartx.length]) {
+              if (byte == io._CharCode.ONE) {
+                this[_httpVersion] = io._HttpVersion.HTTP11;
+                this[_persistentConnection] = true;
+                this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+              } else if (byte == io._CharCode.ZERO) {
+                this[_httpVersion] = io._HttpVersion.HTTP10;
+                this[_persistentConnection] = false;
+                this[_httpVersionIndex] = dart.notNull(this[_httpVersionIndex]) + 1;
+              } else {
+                dart.throw(new io.HttpException("Invalid response line"));
+              }
+            } else {
+              if (byte == io._CharCode.CR) {
+                this[_state$1] = io._State.REQUEST_LINE_ENDING;
+              } else {
+                this[_expect](byte, io._CharCode.LF);
+                this[_messageType] = io._MessageType.REQUEST;
+                this[_state$1] = io._State.HEADER_START;
+              }
+            }
+            break;
+          }
+          case io._State.REQUEST_LINE_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_messageType] = io._MessageType.REQUEST;
+            this[_state$1] = io._State.HEADER_START;
+            break;
+          }
+          case io._State.RESPONSE_LINE_STATUS_CODE:
+          {
+            if (byte == io._CharCode.SP) {
+              this[_state$1] = io._State.RESPONSE_LINE_REASON_PHRASE;
+            } else if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.RESPONSE_LINE_ENDING;
+            } else {
+              this[_statusCodeLength] = dart.notNull(this[_statusCodeLength]) + 1;
+              if (dart.notNull(byte) < 48 && 57 < dart.notNull(byte) || dart.notNull(this[_statusCodeLength]) > 3) {
+                dart.throw(new io.HttpException("Invalid response status code"));
+              } else {
+                this[_statusCode] = dart.notNull(this[_statusCode]) * 10 + dart.notNull(byte) - 48;
+              }
+            }
+            break;
+          }
+          case io._State.RESPONSE_LINE_REASON_PHRASE:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.RESPONSE_LINE_ENDING;
+            } else {
+              if (byte == io._CharCode.CR || byte == io._CharCode.LF) {
+                dart.throw(new io.HttpException("Invalid response reason phrase"));
+              }
+              this[_uri_or_reason_phrase][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.RESPONSE_LINE_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_messageType] == io._MessageType.RESPONSE;
+            if (dart.notNull(this[_statusCode]) < 100 || dart.notNull(this[_statusCode]) > 599) {
+              dart.throw(new io.HttpException("Invalid response status code"));
+            } else {
+              if (dart.notNull(this[_statusCode]) <= 199 || this[_statusCode] == 204 || this[_statusCode] == 304) {
+                this[_noMessageBody] = true;
+              }
+            }
+            this[_state$1] = io._State.HEADER_START;
+            break;
+          }
+          case io._State.HEADER_START:
+          {
+            this[_headers] = new io._HttpHeaders(this.version);
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.HEADER_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state$1] = io._State.HEADER_ENDING;
+              this[_index$2] = dart.notNull(this[_index$2]) - 1;
+            } else {
+              this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+              this[_state$1] = io._State.HEADER_FIELD;
+            }
+            break;
+          }
+          case io._State.HEADER_FIELD:
+          {
+            if (byte == io._CharCode.COLON) {
+              this[_state$1] = io._State.HEADER_VALUE_START;
+            } else {
+              if (!dart.test(io._HttpParser._isTokenChar(byte))) {
+                dart.throw(new io.HttpException("Invalid header field name"));
+              }
+              this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+            }
+            break;
+          }
+          case io._State.HEADER_VALUE_START:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLDING_OR_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLD_OR_END;
+            } else if (byte != io._CharCode.SP && byte != io._CharCode.HT) {
+              this[_headerValue][dartx.add](byte);
+              this[_state$1] = io._State.HEADER_VALUE;
+            }
+            break;
+          }
+          case io._State.HEADER_VALUE:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLDING_OR_ENDING;
+            } else if (byte == io._CharCode.LF) {
+              this[_state$1] = io._State.HEADER_VALUE_FOLD_OR_END;
+            } else {
+              this[_headerValue][dartx.add](byte);
+            }
+            break;
+          }
+          case io._State.HEADER_VALUE_FOLDING_OR_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_state$1] = io._State.HEADER_VALUE_FOLD_OR_END;
+            break;
+          }
+          case io._State.HEADER_VALUE_FOLD_OR_END:
+          {
+            if (byte == io._CharCode.SP || byte == io._CharCode.HT) {
+              this[_state$1] = io._State.HEADER_VALUE_START;
+            } else {
+              let headerField = core.String.fromCharCodes(this[_headerField]);
+              let headerValue = core.String.fromCharCodes(this[_headerValue]);
+              if (headerField == "transfer-encoding" && dart.test(this[_caseInsensitiveCompare]("chunked"[dartx.codeUnits], this[_headerValue]))) {
+                this[_chunked] = true;
+              }
+              if (headerField == "connection") {
+                let tokens = io._HttpParser._tokenizeFieldValue(headerValue);
+                for (let i = 0; i < dart.notNull(tokens[dartx.length]); i++) {
+                  if (dart.test(this[_caseInsensitiveCompare]("upgrade"[dartx.codeUnits], tokens[dartx._get](i)[dartx.codeUnits]))) {
+                    this[_connectionUpgrade] = true;
+                  }
+                  this[_headers][_add$2](headerField, tokens[dartx._get](i));
+                }
+              } else {
+                this[_headers][_add$2](headerField, headerValue);
+              }
+              this[_headerField][dartx.clear]();
+              this[_headerValue][dartx.clear]();
+              if (byte == io._CharCode.CR) {
+                this[_state$1] = io._State.HEADER_ENDING;
+              } else if (byte == io._CharCode.LF) {
+                this[_state$1] = io._State.HEADER_ENDING;
+                this[_index$2] = dart.notNull(this[_index$2]) - 1;
+              } else {
+                this[_headerField][dartx.add](io._HttpParser._toLowerCaseByte(byte));
+                this[_state$1] = io._State.HEADER_FIELD;
+              }
+            }
+            break;
+          }
+          case io._State.HEADER_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            if (dart.test(this[_headersEnd]())) {
+              return;
+            } else {
+              break;
+            }
+            return;
+          }
+          case io._State.CHUNK_SIZE_STARTING_CR:
+          {
+            this[_expect](byte, io._CharCode.CR);
+            this[_state$1] = io._State.CHUNK_SIZE_STARTING_LF;
+            break;
+          }
+          case io._State.CHUNK_SIZE_STARTING_LF:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_state$1] = io._State.CHUNK_SIZE;
+            break;
+          }
+          case io._State.CHUNK_SIZE:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.CHUNK_SIZE_ENDING;
+            } else if (byte == io._CharCode.SEMI_COLON) {
+              this[_state$1] = io._State.CHUNK_SIZE_EXTENSION;
+            } else {
+              let value = this[_expectHexDigit](byte);
+              this[_remainingContent] = dart.notNull(this[_remainingContent]) * 16 + dart.notNull(value);
+            }
+            break;
+          }
+          case io._State.CHUNK_SIZE_EXTENSION:
+          {
+            if (byte == io._CharCode.CR) {
+              this[_state$1] = io._State.CHUNK_SIZE_ENDING;
+            }
+            break;
+          }
+          case io._State.CHUNK_SIZE_ENDING:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            if (dart.notNull(this[_remainingContent]) > 0) {
+              this[_state$1] = io._State.BODY;
+            } else {
+              this[_state$1] = io._State.CHUNKED_BODY_DONE_CR;
+            }
+            break;
+          }
+          case io._State.CHUNKED_BODY_DONE_CR:
+          {
+            this[_expect](byte, io._CharCode.CR);
+            this[_state$1] = io._State.CHUNKED_BODY_DONE_LF;
+            break;
+          }
+          case io._State.CHUNKED_BODY_DONE_LF:
+          {
+            this[_expect](byte, io._CharCode.LF);
+            this[_reset]();
+            this[_closeIncoming]();
+            break;
+          }
+          case io._State.BODY:
+          {
+            this[_index$2] = dart.notNull(this[_index$2]) - 1;
+            let dataAvailable = dart.notNull(this[_buffer$][dartx.length]) - dart.notNull(this[_index$2]);
+            if (dart.notNull(this[_remainingContent]) >= 0 && dart.notNull(dataAvailable) > dart.notNull(this[_remainingContent])) {
+              dataAvailable = this[_remainingContent];
+            }
+            let data = typed_data.Uint8List.view(this[_buffer$][dartx.buffer], dart.notNull(this[_buffer$][dartx.offsetInBytes]) + dart.notNull(this[_index$2]), dataAvailable);
+            this[_bodyController].add(data);
+            if (this[_remainingContent] != -1) {
+              this[_remainingContent] = dart.notNull(this[_remainingContent]) - dart.notNull(data[dartx.length]);
+            }
+            this[_index$2] = dart.notNull(this[_index$2]) + dart.notNull(data[dartx.length]);
+            if (this[_remainingContent] == 0) {
+              if (!dart.test(this[_chunked])) {
+                this[_reset]();
+                this[_closeIncoming]();
+              } else {
+                this[_state$1] = io._State.CHUNK_SIZE_STARTING_CR;
+              }
+            }
+            break;
+          }
+          case io._State.FAILURE:
+          {
+            dart.assert(false);
+            break;
+          }
+          default:
+          {
+            dart.assert(false);
+            break;
+          }
+        }
+      }
+      this[_parserCalled] = false;
+      if (this[_buffer$] != null && this[_index$2] == this[_buffer$][dartx.length]) {
+        this[_releaseBuffer]();
+        if (this[_state$1] != io._State.UPGRADED && this[_state$1] != io._State.FAILURE) {
+          this[_socketSubscription].resume();
+        }
+      }
+    }
+    [_onData$](buffer) {
+      this[_socketSubscription].pause();
+      dart.assert(this[_buffer$] == null);
+      this[_buffer$] = typed_data.Uint8List._check(buffer);
+      this[_index$2] = 0;
+      this[_parse]();
+    }
+    [_onDone$]() {
+      this[_socketSubscription] = null;
+      if (this[_state$1] == io._State.CLOSED || this[_state$1] == io._State.FAILURE) return;
+      if (this[_incoming] != null) {
+        if (this[_state$1] != io._State.UPGRADED && !(this[_state$1] == io._State.START && !dart.test(this[_requestParser])) && !(this[_state$1] == io._State.BODY && !dart.test(this[_chunked]) && this[_transferLength] == -1)) {
+          this[_bodyController].addError(new io.HttpException("Connection closed while receiving data"));
+        }
+        this[_closeIncoming](true);
+        this[_controller$0].close();
+        return;
+      }
+      if (this[_state$1] == io._State.START) {
+        if (!dart.test(this[_requestParser])) {
+          this[_reportError](new io.HttpException("Connection closed before full header was received"));
+        }
+        this[_controller$0].close();
+        return;
+      }
+      if (this[_state$1] == io._State.UPGRADED) {
+        this[_controller$0].close();
+        return;
+      }
+      if (dart.notNull(this[_state$1]) < io._State.FIRST_BODY_STATE) {
+        this[_state$1] = io._State.FAILURE;
+        this[_reportError](new io.HttpException("Connection closed before full header was received"));
+        this[_controller$0].close();
+        return;
+      }
+      if (!dart.test(this[_chunked]) && this[_transferLength] == -1) {
+        this[_state$1] = io._State.CLOSED;
+      } else {
+        this[_state$1] = io._State.FAILURE;
+        this[_reportError](new io.HttpException("Connection closed before full body was received"));
+      }
+      this[_controller$0].close();
+    }
+    get version() {
+      switch (this[_httpVersion]) {
+        case io._HttpVersion.HTTP10:
+        {
+          return "1.0";
+        }
+        case io._HttpVersion.HTTP11:
+        {
+          return "1.1";
+        }
+      }
+      return null;
+    }
+    get messageType() {
+      return this[_messageType];
+    }
+    get transferLength() {
+      return this[_transferLength];
+    }
+    get upgrade() {
+      return dart.test(this[_connectionUpgrade]) && this[_state$1] == io._State.UPGRADED;
+    }
+    get persistentConnection() {
+      return this[_persistentConnection];
+    }
+    set isHead(value) {
+      if (dart.test(value)) this[_noMessageBody] = true;
+    }
+    detachIncoming() {
+      this[_state$1] = io._State.UPGRADED;
+      return new io._HttpDetachedIncoming(this[_socketSubscription], this.readUnparsedData());
+    }
+    readUnparsedData() {
+      if (this[_buffer$] == null) return null;
+      if (this[_index$2] == this[_buffer$][dartx.length]) return null;
+      let result = this[_buffer$][dartx.sublist](this[_index$2]);
+      this[_releaseBuffer]();
+      return result;
+    }
+    [_reset]() {
+      if (this[_state$1] == io._State.UPGRADED) return;
+      this[_state$1] = io._State.START;
+      this[_messageType] = io._MessageType.UNDETERMINED;
+      this[_headerField][dartx.clear]();
+      this[_headerValue][dartx.clear]();
+      this[_method$][dartx.clear]();
+      this[_uri_or_reason_phrase][dartx.clear]();
+      this[_statusCode] = 0;
+      this[_statusCodeLength] = 0;
+      this[_httpVersion] = io._HttpVersion.UNDETERMINED;
+      this[_transferLength] = -1;
+      this[_persistentConnection] = false;
+      this[_connectionUpgrade] = false;
+      this[_chunked] = false;
+      this[_noMessageBody] = false;
+      this[_remainingContent] = -1;
+      this[_headers] = null;
+    }
+    [_releaseBuffer]() {
+      this[_buffer$] = null;
+      this[_index$2] = null;
+    }
+    static _isTokenChar(byte) {
+      return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 && !dart.test(io._Const.SEPARATOR_MAP[dartx._get](byte));
+    }
+    static _isValueChar(byte) {
+      return dart.notNull(byte) > 31 && dart.notNull(byte) < 128 || byte == io._CharCode.SP || byte == io._CharCode.HT;
+    }
+    static _tokenizeFieldValue(headerValue) {
+      let tokens = ListOfString().new();
+      let start = 0;
+      let index = 0;
+      while (index < dart.notNull(headerValue[dartx.length])) {
+        if (headerValue[dartx._get](index) == ",") {
+          tokens[dartx.add](headerValue[dartx.substring](start, index));
+          start = index + 1;
+        } else if (headerValue[dartx._get](index) == " " || headerValue[dartx._get](index) == "\t") {
+          start++;
+        }
+        index++;
+      }
+      tokens[dartx.add](headerValue[dartx.substring](start, index));
+      return tokens;
+    }
+    static _toLowerCaseByte(x) {
+      return (dart.notNull(x) - 65 & 127) < 26 ? (dart.notNull(x) | 32) >>> 0 : x;
+    }
+    [_caseInsensitiveCompare](expected, value) {
+      if (expected[dartx.length] != value[dartx.length]) return false;
+      for (let i = 0; i < dart.notNull(expected[dartx.length]); i++) {
+        if (expected[dartx._get](i) != io._HttpParser._toLowerCaseByte(value[dartx._get](i))) return false;
+      }
+      return true;
+    }
+    [_expect](val1, val2) {
+      if (val1 != val2) {
+        dart.throw(new io.HttpException("Failed to parse HTTP"));
+      }
+    }
+    [_expectHexDigit](byte) {
+      if (48 <= dart.notNull(byte) && dart.notNull(byte) <= 57) {
+        return dart.notNull(byte) - 48;
+      } else if (65 <= dart.notNull(byte) && dart.notNull(byte) <= 70) {
+        return dart.notNull(byte) - 65 + 10;
+      } else if (97 <= dart.notNull(byte) && dart.notNull(byte) <= 102) {
+        return dart.notNull(byte) - 97 + 10;
+      } else {
+        dart.throw(new io.HttpException("Failed to parse HTTP"));
+      }
+    }
+    [_createIncoming](transferLength) {
+      dart.assert(this[_incoming] == null);
+      dart.assert(this[_bodyController] == null);
+      dart.assert(!dart.test(this[_bodyPaused]));
+      let incoming = null;
+      this[_bodyController] = StreamControllerOfListOfint().new({sync: true, onListen: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          dart.assert(this[_bodyPaused]);
+          this[_bodyPaused] = false;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onPause: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          dart.assert(!dart.test(this[_bodyPaused]));
+          this[_bodyPaused] = true;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onResume: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          dart.assert(this[_bodyPaused]);
+          this[_bodyPaused] = false;
+          this[_pauseStateChanged]();
+        }, VoidToNull()), onCancel: dart.fn(() => {
+          if (!dart.equals(incoming, this[_incoming])) return;
+          if (this[_socketSubscription] != null) {
+            this[_socketSubscription].cancel();
+          }
+          this[_closeIncoming](true);
+          this[_controller$0].close();
+        }, VoidToNull())});
+      incoming = this[_incoming] = new io._HttpIncoming(this[_headers], transferLength, this[_bodyController].stream);
+      this[_bodyPaused] = true;
+      this[_pauseStateChanged]();
+    }
+    [_closeIncoming](closing) {
+      if (closing === void 0) closing = false;
+      if (this[_incoming] == null) return;
+      let tmp = this[_incoming];
+      tmp.close(closing);
+      this[_incoming] = null;
+      if (this[_bodyController] != null) {
+        this[_bodyController].close();
+        this[_bodyController] = null;
+      }
+      this[_bodyPaused] = false;
+      this[_pauseStateChanged]();
+    }
+    [_pauseStateChanged]() {
+      if (this[_incoming] != null) {
+        if (!dart.test(this[_bodyPaused]) && !dart.test(this[_parserCalled])) {
+          this[_parse]();
+        }
+      } else {
+        if (!dart.test(this[_paused]) && !dart.test(this[_parserCalled])) {
+          this[_parse]();
+        }
+      }
+    }
+    [_reportError](error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      if (this[_socketSubscription] != null) this[_socketSubscription].cancel();
+      this[_state$1] = io._State.FAILURE;
+      this[_controller$0].addError(error, core.StackTrace._check(stackTrace));
+      this[_controller$0].close();
+    }
+  };
+  dart.addSimpleTypeTests(io._HttpParser);
+  dart.defineNamedConstructor(io._HttpParser, '_');
+  dart.setSignature(io._HttpParser, {
+    constructors: () => ({
+      requestParser: dart.definiteFunctionType(io._HttpParser, []),
+      responseParser: dart.definiteFunctionType(io._HttpParser, []),
+      _: dart.definiteFunctionType(io._HttpParser, [core.bool])
+    }),
+    fields: () => ({
+      [_parserCalled]: core.bool,
+      [_buffer$]: typed_data.Uint8List,
+      [_index$2]: core.int,
+      [_requestParser]: core.bool,
+      [_state$1]: core.int,
+      [_httpVersionIndex]: core.int,
+      [_messageType]: core.int,
+      [_statusCode]: core.int,
+      [_statusCodeLength]: core.int,
+      [_method$]: ListOfint(),
+      [_uri_or_reason_phrase]: ListOfint(),
+      [_headerField]: ListOfint(),
+      [_headerValue]: ListOfint(),
+      [_httpVersion]: core.int,
+      [_transferLength]: core.int,
+      [_persistentConnection]: core.bool,
+      [_connectionUpgrade]: core.bool,
+      [_chunked]: core.bool,
+      [_noMessageBody]: core.bool,
+      [_remainingContent]: core.int,
+      [_headers]: io._HttpHeaders,
+      [_incoming]: io._HttpIncoming,
+      [_socketSubscription]: async.StreamSubscription,
+      [_paused]: core.bool,
+      [_bodyPaused]: core.bool,
+      [_controller$0]: StreamControllerOf_HttpIncoming(),
+      [_bodyController]: StreamControllerOfListOfint()
+    }),
+    getters: () => ({
+      version: dart.definiteFunctionType(core.String, []),
+      messageType: dart.definiteFunctionType(core.int, []),
+      transferLength: dart.definiteFunctionType(core.int, []),
+      upgrade: dart.definiteFunctionType(core.bool, []),
+      persistentConnection: dart.definiteFunctionType(core.bool, [])
+    }),
+    setters: () => ({isHead: dart.definiteFunctionType(dart.void, [core.bool])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io._HttpIncoming), [_HttpIncomingTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      listenToStream: dart.definiteFunctionType(dart.void, [StreamOfListOfint()]),
+      [_parse]: dart.definiteFunctionType(dart.void, []),
+      [_headersEnd]: dart.definiteFunctionType(core.bool, []),
+      [_doParse]: dart.definiteFunctionType(dart.void, []),
+      [_onData$]: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      [_onDone$]: dart.definiteFunctionType(dart.void, []),
+      detachIncoming: dart.definiteFunctionType(io._HttpDetachedIncoming, []),
+      readUnparsedData: dart.definiteFunctionType(core.List$(core.int), []),
+      [_reset]: dart.definiteFunctionType(dart.void, []),
+      [_releaseBuffer]: dart.definiteFunctionType(dart.void, []),
+      [_caseInsensitiveCompare]: dart.definiteFunctionType(core.bool, [ListOfint(), ListOfint()]),
+      [_expect]: dart.definiteFunctionType(core.int, [core.int, core.int]),
+      [_expectHexDigit]: dart.definiteFunctionType(core.int, [core.int]),
+      [_createIncoming]: dart.definiteFunctionType(dart.void, [core.int]),
+      [_closeIncoming]: dart.definiteFunctionType(dart.void, [], [core.bool]),
+      [_pauseStateChanged]: dart.definiteFunctionType(dart.void, []),
+      [_reportError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [dart.dynamic])
+    }),
+    statics: () => ({
+      _isTokenChar: dart.definiteFunctionType(core.bool, [core.int]),
+      _isValueChar: dart.definiteFunctionType(core.bool, [core.int]),
+      _tokenizeFieldValue: dart.definiteFunctionType(core.List$(core.String), [core.String]),
+      _toLowerCaseByte: dart.definiteFunctionType(core.int, [core.int])
+    }),
+    names: ['_isTokenChar', '_isValueChar', '_tokenizeFieldValue', '_toLowerCaseByte']
+  });
+  io._DART_SESSION_ID = "DARTSESSID";
+  const _data$ = Symbol('_data');
+  const _lastSeen = Symbol('_lastSeen');
+  const _timeoutCallback = Symbol('_timeoutCallback');
+  const _prev = Symbol('_prev');
+  const _next$1 = Symbol('_next');
+  const _removeFromTimeoutQueue = Symbol('_removeFromTimeoutQueue');
+  const _sessions = Symbol('_sessions');
+  const _bumpToEnd = Symbol('_bumpToEnd');
+  io._HttpSession = class _HttpSession extends core.Object {
+    new(sessionManager, id) {
+      this[_data$] = collection.HashMap.new();
+      this[_sessionManager] = sessionManager;
+      this.id = id;
+      this[_lastSeen] = new core.DateTime.now();
+      this[_destroyed] = false;
+      this[_isNew] = true;
+      this[_timeoutCallback] = null;
+      this[_prev] = null;
+      this[_next$1] = null;
+    }
+    destroy() {
+      this[_destroyed] = true;
+      this[_sessionManager][_removeFromTimeoutQueue](this);
+      this[_sessionManager][_sessions][dartx.remove](this.id);
+    }
+    [_markSeen]() {
+      this[_lastSeen] = new core.DateTime.now();
+      this[_sessionManager][_bumpToEnd](this);
+    }
+    get lastSeen() {
+      return this[_lastSeen];
+    }
+    get isNew() {
+      return this[_isNew];
+    }
+    set onTimeout(callback) {
+      this[_timeoutCallback] = callback;
+    }
+    containsValue(value) {
+      return this[_data$][dartx.containsValue](value);
+    }
+    containsKey(key) {
+      return this[_data$][dartx.containsKey](key);
+    }
+    _get(key) {
+      return this[_data$][dartx._get](key);
+    }
+    _set(key, value) {
+      this[_data$][dartx._set](key, value);
+      return value;
+    }
+    putIfAbsent(key, ifAbsent) {
+      return this[_data$][dartx.putIfAbsent](key, ifAbsent);
+    }
+    addAll(other) {
+      return this[_data$][dartx.addAll](other);
+    }
+    remove(key) {
+      return this[_data$][dartx.remove](key);
+    }
+    clear() {
+      this[_data$][dartx.clear]();
+    }
+    forEach(f) {
+      this[_data$][dartx.forEach](f);
+    }
+    get keys() {
+      return this[_data$][dartx.keys];
+    }
+    get values() {
+      return this[_data$][dartx.values];
+    }
+    get length() {
+      return this[_data$][dartx.length];
+    }
+    get isEmpty() {
+      return this[_data$][dartx.isEmpty];
+    }
+    get isNotEmpty() {
+      return this[_data$][dartx.isNotEmpty];
+    }
+    toString() {
+      return dart.str`HttpSession id:${this.id} ${this[_data$]}`;
+    }
+  };
+  io._HttpSession[dart.implements] = () => [io.HttpSession];
+  dart.setSignature(io._HttpSession, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpSession, [io._HttpSessionManager, core.String])}),
+    fields: () => ({
+      [_destroyed]: core.bool,
+      [_isNew]: core.bool,
+      [_lastSeen]: core.DateTime,
+      [_timeoutCallback]: core.Function,
+      [_sessionManager]: io._HttpSessionManager,
+      [_prev]: io._HttpSession,
+      [_next$1]: io._HttpSession,
+      id: core.String,
+      [_data$]: core.Map
+    }),
+    getters: () => ({
+      lastSeen: dart.definiteFunctionType(core.DateTime, []),
+      isNew: dart.definiteFunctionType(core.bool, []),
+      keys: dart.definiteFunctionType(core.Iterable, []),
+      values: dart.definiteFunctionType(core.Iterable, []),
+      length: dart.definiteFunctionType(core.int, []),
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      isNotEmpty: dart.definiteFunctionType(core.bool, [])
+    }),
+    setters: () => ({onTimeout: dart.definiteFunctionType(dart.void, [VoidTovoid()])}),
+    methods: () => ({
+      destroy: dart.definiteFunctionType(dart.void, []),
+      [_markSeen]: dart.definiteFunctionType(dart.void, []),
+      containsValue: dart.definiteFunctionType(core.bool, [core.Object]),
+      containsKey: dart.definiteFunctionType(core.bool, [core.Object]),
+      _get: dart.definiteFunctionType(dart.dynamic, [core.Object]),
+      _set: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic]),
+      putIfAbsent: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, VoidTodynamic()]),
+      addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+      remove: dart.definiteFunctionType(dart.dynamic, [core.Object]),
+      clear: dart.definiteFunctionType(dart.void, []),
+      forEach: dart.definiteFunctionType(dart.void, [dynamicAnddynamicTovoid()])
+    })
+  });
+  dart.defineExtensionMembers(io._HttpSession, [
+    'containsValue',
+    'containsKey',
+    '_get',
+    '_set',
+    'putIfAbsent',
+    'addAll',
+    'remove',
+    'clear',
+    'forEach',
+    'keys',
+    'values',
+    'length',
+    'isEmpty',
+    'isNotEmpty'
+  ]);
+  const _sessionTimeout = Symbol('_sessionTimeout');
+  const _head$ = Symbol('_head');
+  const _tail$ = Symbol('_tail');
+  const _timer = Symbol('_timer');
+  const _addToTimeoutQueue = Symbol('_addToTimeoutQueue');
+  const _stopTimer = Symbol('_stopTimer');
+  const _startTimer = Symbol('_startTimer');
+  const _timerTimeout = Symbol('_timerTimeout');
+  io._HttpSessionManager = class _HttpSessionManager extends core.Object {
+    new() {
+      this[_sessions] = dart.map({}, core.String, io._HttpSession);
+      this[_sessionTimeout] = 20 * 60;
+      this[_head$] = null;
+      this[_tail$] = null;
+      this[_timer] = null;
+    }
+    createSessionId() {
+      let _KEY_LENGTH = 16;
+      let data = io._IOCrypto.getRandomBytes(_KEY_LENGTH);
+      return io._CryptoUtils.bytesToHex(data);
+    }
+    getSession(id) {
+      return this[_sessions][dartx._get](id);
+    }
+    createSession() {
+      let id = this.createSessionId();
+      while (dart.test(this[_sessions][dartx.containsKey](id))) {
+        id = this.createSessionId();
+      }
+      let session = this[_sessions][dartx._set](id, new io._HttpSession(this, id));
+      this[_addToTimeoutQueue](session);
+      return session;
+    }
+    set sessionTimeout(timeout) {
+      this[_sessionTimeout] = timeout;
+      this[_stopTimer]();
+      this[_startTimer]();
+    }
+    close() {
+      this[_stopTimer]();
+    }
+    [_bumpToEnd](session) {
+      this[_removeFromTimeoutQueue](session);
+      this[_addToTimeoutQueue](session);
+    }
+    [_addToTimeoutQueue](session) {
+      if (this[_head$] == null) {
+        dart.assert(this[_tail$] == null);
+        this[_tail$] = this[_head$] = session;
+        this[_startTimer]();
+      } else {
+        dart.assert(this[_timer] != null);
+        dart.assert(this[_tail$] != null);
+        this[_tail$][_next$1] = session;
+        session[_prev] = this[_tail$];
+        this[_tail$] = session;
+      }
+    }
+    [_removeFromTimeoutQueue](session) {
+      if (session[_next$1] != null) {
+        session[_next$1][_prev] = session[_prev];
+      }
+      if (session[_prev] != null) {
+        session[_prev][_next$1] = session[_next$1];
+      }
+      if (dart.equals(this[_head$], session)) {
+        this[_head$] = session[_next$1];
+        this[_stopTimer]();
+        this[_startTimer]();
+      }
+      if (dart.equals(this[_tail$], session)) {
+        this[_tail$] = session[_prev];
+      }
+      session[_next$1] = session[_prev] = null;
+    }
+    [_timerTimeout]() {
+      this[_stopTimer]();
+      dart.assert(this[_head$] != null);
+      let session = this[_head$];
+      session.destroy();
+      if (session[_timeoutCallback] != null) {
+        dart.dsend(session, _timeoutCallback);
+      }
+    }
+    [_startTimer]() {
+      dart.assert(this[_timer] == null);
+      if (this[_head$] != null) {
+        let seconds = new core.DateTime.now().difference(this[_head$].lastSeen).inSeconds;
+        this[_timer] = async.Timer.new(new core.Duration({seconds: dart.notNull(this[_sessionTimeout]) - dart.notNull(seconds)}), dart.bind(this, _timerTimeout));
+      }
+    }
+    [_stopTimer]() {
+      if (this[_timer] != null) {
+        this[_timer].cancel();
+        this[_timer] = null;
+      }
+    }
+  };
+  dart.setSignature(io._HttpSessionManager, {
+    constructors: () => ({new: dart.definiteFunctionType(io._HttpSessionManager, [])}),
+    fields: () => ({
+      [_sessions]: MapOfString$_HttpSession(),
+      [_sessionTimeout]: core.int,
+      [_head$]: io._HttpSession,
+      [_tail$]: io._HttpSession,
+      [_timer]: async.Timer
+    }),
+    setters: () => ({sessionTimeout: dart.definiteFunctionType(dart.void, [core.int])}),
+    methods: () => ({
+      createSessionId: dart.definiteFunctionType(core.String, []),
+      getSession: dart.definiteFunctionType(io._HttpSession, [core.String]),
+      createSession: dart.definiteFunctionType(io._HttpSession, []),
+      close: dart.definiteFunctionType(dart.void, []),
+      [_bumpToEnd]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+      [_addToTimeoutQueue]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+      [_removeFromTimeoutQueue]: dart.definiteFunctionType(dart.void, [io._HttpSession]),
+      [_timerTimeout]: dart.definiteFunctionType(dart.void, []),
+      [_startTimer]: dart.definiteFunctionType(dart.void, []),
+      [_stopTimer]: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  io._IOResourceInfo = class _IOResourceInfo extends core.Object {
+    static get timestamp() {
+      return dart.notNull(io._IOResourceInfo._startTime) + dart.notNull(io._IOResourceInfo._sw.elapsedMicroseconds) / 1000;
+    }
+    new(type) {
+      this.type = type;
+      this.id = io._IOResourceInfo.getNextID();
+    }
+    get referenceValueMap() {
+      return dart.map({type: dart.str`@${this.type}`, id: this.id, name: this.name}, core.String, core.String);
+    }
+    static getNextID() {
+      return (() => {
+        let x = io._IOResourceInfo._count;
+        io._IOResourceInfo._count = dart.notNull(x) + 1;
+        return x;
+      })();
+    }
+  };
+  dart.setSignature(io._IOResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._IOResourceInfo, [core.String])}),
+    fields: () => ({
+      type: core.String,
+      id: core.int
+    }),
+    getters: () => ({referenceValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    sfields: () => ({
+      _count: core.int,
+      _sw: core.Stopwatch,
+      _startTime: core.int
+    }),
+    sgetters: () => ({timestamp: dart.definiteFunctionType(core.double, [])}),
+    statics: () => ({getNextID: dart.definiteFunctionType(core.int, [])}),
+    names: ['getNextID']
+  });
+  io._IOResourceInfo._count = 0;
+  dart.defineLazy(io._IOResourceInfo, {
+    get _sw() {
+      return (() => {
+        let _ = new core.Stopwatch();
+        _.start();
+        return _;
+      })();
+    },
+    get _startTime() {
+      return new core.DateTime.now().millisecondsSinceEpoch;
+    }
+  });
+  io._ReadWriteResourceInfo = class _ReadWriteResourceInfo extends io._IOResourceInfo {
+    addRead(bytes) {
+      this.totalRead = dart.notNull(this.totalRead) + dart.notNull(bytes);
+      this.readCount = dart.notNull(this.readCount) + 1;
+      this.lastRead = io._IOResourceInfo.timestamp;
+    }
+    didRead() {
+      this.addRead(0);
+    }
+    addWrite(bytes) {
+      this.totalWritten = dart.notNull(this.totalWritten) + dart.notNull(bytes);
+      this.writeCount = dart.notNull(this.writeCount) + 1;
+      this.lastWrite = io._IOResourceInfo.timestamp;
+    }
+    new(type) {
+      this.totalRead = 0;
+      this.totalWritten = 0;
+      this.readCount = 0;
+      this.writeCount = 0;
+      this.lastRead = 0.0;
+      this.lastWrite = 0.0;
+      super.new(type);
+    }
+    get fullValueMap() {
+      return dart.map({type: this.type, id: this.id, name: this.name, totalRead: this.totalRead, totalWritten: this.totalWritten, readCount: this.readCount, writeCount: this.writeCount, lastRead: this.lastRead, lastWrite: this.lastWrite}, core.String, core.String);
+    }
+  };
+  dart.setSignature(io._ReadWriteResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ReadWriteResourceInfo, [core.String])}),
+    fields: () => ({
+      totalRead: core.int,
+      totalWritten: core.int,
+      readCount: core.int,
+      writeCount: core.int,
+      lastRead: core.double,
+      lastWrite: core.double
+    }),
+    getters: () => ({fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    methods: () => ({
+      addRead: dart.definiteFunctionType(dart.void, [core.int]),
+      didRead: dart.definiteFunctionType(dart.void, []),
+      addWrite: dart.definiteFunctionType(dart.void, [core.int])
+    })
+  });
+  io._FileResourceInfo = class _FileResourceInfo extends io._ReadWriteResourceInfo {
+    new(file) {
+      this.file = file;
+      super.new(io._FileResourceInfo.TYPE);
+      io._FileResourceInfo.FileOpened(this);
+    }
+    static FileOpened(info) {
+      dart.assert(!dart.test(io._FileResourceInfo.openFiles[dartx.containsKey](info.id)));
+      io._FileResourceInfo.openFiles[dartx._set](info.id, info);
+    }
+    static FileClosed(info) {
+      dart.assert(io._FileResourceInfo.openFiles[dartx.containsKey](info.id));
+      io._FileResourceInfo.openFiles[dartx.remove](info.id);
+    }
+    static getOpenFilesList() {
+      return ListOfMapOfString$String().from(io._FileResourceInfo.openFiles[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _FileResourceInfoToMapOfString$String())));
+    }
+    static getOpenFiles(func, params) {
+      dart.assert(dart.equals(func, 'ext.dart.io.getOpenFiles'));
+      let data = dart.map({type: '_openfiles', data: io._FileResourceInfo.getOpenFilesList()}, core.String, core.Object);
+      let json = convert.JSON.encode(data);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    getFileInfoMap() {
+      let result = this.fullValueMap;
+      return result;
+    }
+    static getFileInfoMapByID(func, params) {
+      dart.assert(dart.dsend(params, 'containsKey', 'id'));
+      let id = core.int.parse(core.String._check(dart.dindex(params, 'id')));
+      let result = dart.test(io._FileResourceInfo.openFiles[dartx.containsKey](id)) ? io._FileResourceInfo.openFiles[dartx._get](id).getFileInfoMap() : dart.map();
+      let json = convert.JSON.encode(result);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    get name() {
+      return dart.str`${dart.dload(this.file, 'path')}`;
+    }
+  };
+  dart.setSignature(io._FileResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._FileResourceInfo, [dart.dynamic])}),
+    fields: () => ({file: dart.dynamic}),
+    getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+    methods: () => ({getFileInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    sfields: () => ({
+      TYPE: core.String,
+      openFiles: MapOfint$_FileResourceInfo()
+    }),
+    statics: () => ({
+      FileOpened: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
+      FileClosed: dart.definiteFunctionType(dart.dynamic, [io._FileResourceInfo]),
+      getOpenFilesList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+      getOpenFiles: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic]),
+      getFileInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic])
+    }),
+    names: ['FileOpened', 'FileClosed', 'getOpenFilesList', 'getOpenFiles', 'getFileInfoMapByID']
+  });
+  io._FileResourceInfo.TYPE = '_file';
+  dart.defineLazy(io._FileResourceInfo, {
+    get openFiles() {
+      return MapOfint$_FileResourceInfo().new();
+    },
+    set openFiles(_) {}
+  });
+  const _arguments$0 = Symbol('_arguments');
+  const _workingDirectory = Symbol('_workingDirectory');
+  io._ProcessResourceInfo = class _ProcessResourceInfo extends io._IOResourceInfo {
+    new(process) {
+      this.process = process;
+      this.startedAt = io._IOResourceInfo.timestamp;
+      super.new(io._ProcessResourceInfo.TYPE);
+      io._ProcessResourceInfo.ProcessStarted(this);
+    }
+    get name() {
+      return core.String._check(dart.dload(this.process, _path$));
+    }
+    stopped() {
+      io._ProcessResourceInfo.ProcessStopped(this);
+    }
+    get fullValueMap() {
+      return dart.map({type: this.type, id: this.id, name: this.name, pid: core.String._check(dart.dload(this.process, 'pid')), startedAt: this.startedAt, arguments: core.String._check(dart.dload(this.process, _arguments$0)), workingDirectory: core.String._check(dart.dload(this.process, _workingDirectory) == null ? '.' : dart.dload(this.process, _workingDirectory))}, core.String, core.String);
+    }
+    static ProcessStarted(info) {
+      dart.assert(!dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id)));
+      io._ProcessResourceInfo.startedProcesses[dartx._set](info.id, info);
+    }
+    static ProcessStopped(info) {
+      dart.assert(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](info.id));
+      io._ProcessResourceInfo.startedProcesses[dartx.remove](info.id);
+    }
+    static getStartedProcessesList() {
+      return ListOfMapOfString$String().from(io._ProcessResourceInfo.startedProcesses[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _ProcessResourceInfoToMapOfString$String())));
+    }
+    static getStartedProcesses(func, params) {
+      dart.assert(func == 'ext.dart.io.getProcesses');
+      let data = dart.map({type: '_startedprocesses', data: io._ProcessResourceInfo.getStartedProcessesList()}, core.String, core.Object);
+      let json = convert.JSON.encode(data);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    static getProcessInfoMapById(func, params) {
+      let id = core.int.parse(params[dartx._get]('id'));
+      let result = dart.test(io._ProcessResourceInfo.startedProcesses[dartx.containsKey](id)) ? io._ProcessResourceInfo.startedProcesses[dartx._get](id).fullValueMap : dart.map();
+      let json = convert.JSON.encode(result);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+  };
+  dart.setSignature(io._ProcessResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ProcessResourceInfo, [dart.dynamic])}),
+    fields: () => ({
+      process: dart.dynamic,
+      startedAt: core.double
+    }),
+    getters: () => ({
+      name: dart.definiteFunctionType(core.String, []),
+      fullValueMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])
+    }),
+    methods: () => ({stopped: dart.definiteFunctionType(dart.void, [])}),
+    sfields: () => ({
+      TYPE: core.String,
+      startedProcesses: MapOfint$_ProcessResourceInfo()
+    }),
+    statics: () => ({
+      ProcessStarted: dart.definiteFunctionType(dart.dynamic, [io._ProcessResourceInfo]),
+      ProcessStopped: dart.definiteFunctionType(dart.dynamic, [io._ProcessResourceInfo]),
+      getStartedProcessesList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+      getStartedProcesses: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
+      getProcessInfoMapById: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()])
+    }),
+    names: ['ProcessStarted', 'ProcessStopped', 'getStartedProcessesList', 'getStartedProcesses', 'getProcessInfoMapById']
+  });
+  io._ProcessResourceInfo.TYPE = '_process';
+  dart.defineLazy(io._ProcessResourceInfo, {
+    get startedProcesses() {
+      return MapOfint$_ProcessResourceInfo().new();
+    },
+    set startedProcesses(_) {}
+  });
+  io._SocketResourceInfo = class _SocketResourceInfo extends io._ReadWriteResourceInfo {
+    new(socket) {
+      this.socket = socket;
+      super.new(io._SocketResourceInfo.TYPE);
+      io._SocketResourceInfo.SocketOpened(this);
+    }
+    get name() {
+      if (dart.test(dart.dload(this.socket, 'isListening'))) {
+        return dart.str`listening:${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}`;
+      }
+      let remote = '';
+      try {
+        let remoteHost = dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host');
+        let remotePort = dart.dload(this.socket, 'remotePort');
+        remote = dart.str` -> ${remoteHost}:${remotePort}`;
+      } catch (e) {
+      }
+
+      return dart.str`${dart.dload(dart.dload(this.socket, 'address'), 'host')}:${dart.dload(this.socket, 'port')}${remote}`;
+    }
+    static getOpenSocketsList() {
+      return ListOfMapOfString$String().from(io._SocketResourceInfo.openSockets[dartx.values][dartx.map](MapOfString$String())(dart.fn(e => e.referenceValueMap, _SocketResourceInfoToMapOfString$String())));
+    }
+    getSocketInfoMap() {
+      let result = this.fullValueMap;
+      result[dartx._set]('socketType', dart.test(dart.dload(this.socket, 'isTcp')) ? io._SocketResourceInfo.TCP_STRING : io._SocketResourceInfo.UDP_STRING);
+      result[dartx._set]('listening', core.String._check(dart.dload(this.socket, 'isListening')));
+      result[dartx._set]('host', core.String._check(dart.dload(dart.dload(this.socket, 'address'), 'host')));
+      result[dartx._set]('port', core.String._check(dart.dload(this.socket, 'port')));
+      if (!dart.test(dart.dload(this.socket, 'isListening'))) {
+        try {
+          result[dartx._set]('remoteHost', core.String._check(dart.dload(dart.dload(this.socket, 'remoteAddress'), 'host')));
+          result[dartx._set]('remotePort', core.String._check(dart.dload(this.socket, 'remotePort')));
+        } catch (e) {
+          result[dartx._set]('remotePort', 'NA');
+          result[dartx._set]('remoteHost', 'NA');
+        }
+
+      } else {
+        result[dartx._set]('remotePort', 'NA');
+        result[dartx._set]('remoteHost', 'NA');
+      }
+      result[dartx._set]('addressType', core.String._check(dart.dload(dart.dload(dart.dload(this.socket, 'address'), 'type'), 'name')));
+      return result;
+    }
+    static getSocketInfoMapByID(func, params) {
+      dart.assert(params[dartx.containsKey]('id'));
+      let id = core.int.parse(params[dartx._get]('id'));
+      let result = dart.test(io._SocketResourceInfo.openSockets[dartx.containsKey](id)) ? io._SocketResourceInfo.openSockets[dartx._get](id).getSocketInfoMap() : dart.map();
+      let json = convert.JSON.encode(result);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    static getOpenSockets(func, params) {
+      dart.assert(dart.equals(func, 'ext.dart.io.getOpenSockets'));
+      let data = dart.map({type: '_opensockets', data: io._SocketResourceInfo.getOpenSocketsList()}, core.String, core.Object);
+      let json = convert.JSON.encode(data);
+      return FutureOfServiceExtensionResponse().value(new developer.ServiceExtensionResponse.result(json));
+    }
+    static SocketOpened(info) {
+      dart.assert(!dart.test(io._SocketResourceInfo.openSockets[dartx.containsKey](info.id)));
+      io._SocketResourceInfo.openSockets[dartx._set](info.id, info);
+    }
+    static SocketClosed(info) {
+      dart.assert(io._SocketResourceInfo.openSockets[dartx.containsKey](info.id));
+      io._SocketResourceInfo.openSockets[dartx.remove](info.id);
+    }
+  };
+  dart.setSignature(io._SocketResourceInfo, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SocketResourceInfo, [dart.dynamic])}),
+    fields: () => ({socket: dart.dynamic}),
+    getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+    methods: () => ({getSocketInfoMap: dart.definiteFunctionType(core.Map$(core.String, core.String), [])}),
+    sfields: () => ({
+      TCP_STRING: core.String,
+      UDP_STRING: core.String,
+      TYPE: core.String,
+      openSockets: MapOfint$_SocketResourceInfo()
+    }),
+    statics: () => ({
+      getOpenSocketsList: dart.definiteFunctionType(core.Iterable$(core.Map$(core.String, core.String)), []),
+      getSocketInfoMapByID: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]),
+      getOpenSockets: dart.definiteFunctionType(async.Future$(developer.ServiceExtensionResponse), [dart.dynamic, dart.dynamic]),
+      SocketOpened: dart.definiteFunctionType(dart.dynamic, [io._SocketResourceInfo]),
+      SocketClosed: dart.definiteFunctionType(dart.dynamic, [io._SocketResourceInfo])
+    }),
+    names: ['getOpenSocketsList', 'getSocketInfoMapByID', 'getOpenSockets', 'SocketOpened', 'SocketClosed']
+  });
+  io._SocketResourceInfo.TCP_STRING = 'TCP';
+  io._SocketResourceInfo.UDP_STRING = 'UDP';
+  io._SocketResourceInfo.TYPE = '_socket';
+  dart.defineLazy(io._SocketResourceInfo, {
+    get openSockets() {
+      return MapOfint$_SocketResourceInfo().new();
+    },
+    set openSockets(_) {}
+  });
+  io.IOSink = class IOSink extends core.Object {
+    static new(target, opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : convert.UTF8;
+      return new io._IOSinkImpl(target, encoding);
+    }
+  };
+  io.IOSink[dart.implements] = () => [StreamSinkOfListOfint(), core.StringSink];
+  dart.setSignature(io.IOSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io.IOSink, [StreamConsumerOfListOfint()], {encoding: convert.Encoding})}),
+    fields: () => ({encoding: convert.Encoding})
+  });
+  io._FILE_EXISTS = 0;
+  io._FILE_CREATE = 1;
+  io._FILE_DELETE = 2;
+  io._FILE_RENAME = 3;
+  io._FILE_COPY = 4;
+  io._FILE_OPEN = 5;
+  io._FILE_RESOLVE_SYMBOLIC_LINKS = 6;
+  io._FILE_CLOSE = 7;
+  io._FILE_POSITION = 8;
+  io._FILE_SET_POSITION = 9;
+  io._FILE_TRUNCATE = 10;
+  io._FILE_LENGTH = 11;
+  io._FILE_LENGTH_FROM_PATH = 12;
+  io._FILE_LAST_MODIFIED = 13;
+  io._FILE_FLUSH = 14;
+  io._FILE_READ_BYTE = 15;
+  io._FILE_WRITE_BYTE = 16;
+  io._FILE_READ = 17;
+  io._FILE_READ_INTO = 18;
+  io._FILE_WRITE_FROM = 19;
+  io._FILE_CREATE_LINK = 20;
+  io._FILE_DELETE_LINK = 21;
+  io._FILE_RENAME_LINK = 22;
+  io._FILE_LINK_TARGET = 23;
+  io._FILE_TYPE = 24;
+  io._FILE_IDENTICAL = 25;
+  io._FILE_STAT = 26;
+  io._FILE_LOCK = 27;
+  io._SOCKET_LOOKUP = 28;
+  io._SOCKET_LIST_INTERFACES = 29;
+  io._SOCKET_REVERSE_LOOKUP = 30;
+  io._DIRECTORY_CREATE = 31;
+  io._DIRECTORY_DELETE = 32;
+  io._DIRECTORY_EXISTS = 33;
+  io._DIRECTORY_CREATE_TEMP = 34;
+  io._DIRECTORY_LIST_START = 35;
+  io._DIRECTORY_LIST_NEXT = 36;
+  io._DIRECTORY_LIST_STOP = 37;
+  io._DIRECTORY_RENAME = 38;
+  io._SSL_PROCESS_FILTER = 39;
+  io._IOService = class _IOService extends core.Object {
+    static _dispatch(request, data) {
+      dart.throw(new core.UnsupportedError("_IOService._dispatch"));
+    }
+  };
+  dart.setSignature(io._IOService, {
+    statics: () => ({_dispatch: dart.definiteFunctionType(async.Future, [core.int, core.List])}),
+    names: ['_dispatch']
+  });
+  io.Link = class Link extends core.Object {
+    static new(path) {
+      return new io._Link(path);
+    }
+    static fromUri(uri) {
+      return io.Link.new(uri.toFilePath());
+    }
+  };
+  io.Link[dart.implements] = () => [io.FileSystemEntity];
+  dart.setSignature(io.Link, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.Link, [core.String]),
+      fromUri: dart.definiteFunctionType(io.Link, [core.Uri])
+    })
+  });
+  const _makeWindowsLinkTarget = Symbol('_makeWindowsLinkTarget');
+  const _exceptionFromResponse = Symbol('_exceptionFromResponse');
+  io._Link = class _Link extends io.FileSystemEntity {
+    new(path) {
+      this.path = path;
+      if (!(typeof this.path == 'string')) {
+        dart.throw(new core.ArgumentError(dart.str`${core.Error.safeToString(this.path)} ` + 'is not a String'));
+      }
+    }
+    toString() {
+      return dart.str`Link: '${this.path}'`;
+    }
+    exists() {
+      return io.FileSystemEntity.isLink(this.path);
+    }
+    existsSync() {
+      return io.FileSystemEntity.isLinkSync(this.path);
+    }
+    get absolute() {
+      return io.Link.new(this[_absolutePath]);
+    }
+    stat() {
+      return io.FileStat.stat(this.path);
+    }
+    statSync() {
+      return io.FileStat.statSync(this.path);
+    }
+    create(target, opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(io.Platform.isWindows)) {
+        target = this[_makeWindowsLinkTarget](target);
+      }
+      let result = dart.test(recursive) ? this.parent.create({recursive: true}) : async.Future.value(null);
+      return result.then(dart.dynamic)(dart.fn(_ => io._IOService._dispatch(io._FILE_CREATE_LINK, JSArrayOfString().of([this.path, target])), dynamicToFuture())).then(io._Link)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, dart.str`Cannot create link to target '${target}'`, this.path));
+        }
+        return this;
+      }, dynamicTo_Link()));
+    }
+    createSync(target, opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        this.parent.createSync({recursive: true});
+      }
+      if (dart.test(io.Platform.isWindows)) {
+        target = this[_makeWindowsLinkTarget](target);
+      }
+      let result = io._File._createLink(this.path, target);
+      io._Link.throwIfError(result, "Cannot create link", this.path);
+    }
+    [_makeWindowsLinkTarget](target) {
+      let base = core.Uri.file(dart.str`${io.Directory.current.path}\\`);
+      let link = core.Uri.file(this.path);
+      let destination = core.Uri.file(target);
+      let result = base.resolveUri(link).resolveUri(destination).toFilePath();
+      if (dart.notNull(result[dartx.length]) > 3 && result[dartx._get](1) == ':' && result[dartx._get](2) == '\\') {
+        return dart.str`\\??\\${result}`;
+      } else {
+        dart.throw(new io.FileSystemException(dart.str`Target ${result} of Link.create on Windows cannot be converted` + ' to start with a drive letter.  Unexpected error.'));
+      }
+    }
+    updateSync(target) {
+      this.deleteSync();
+      this.createSync(target);
+    }
+    update(target) {
+      return this.delete().then(io.Link)(dart.fn(_ => this.create(target), FileSystemEntityToFutureOfLink()));
+    }
+    [_delete](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).delete({recursive: true}).then(io._Link)(dart.fn(_ => this, FileSystemEntityTo_Link()));
+      }
+      return io._IOService._dispatch(io._FILE_DELETE_LINK, JSArrayOfString().of([this.path])).then(io._Link)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, "Cannot delete link", this.path));
+        }
+        return this;
+      }, dynamicTo_Link()));
+    }
+    [_deleteSync](opts) {
+      let recursive = opts && 'recursive' in opts ? opts.recursive : false;
+      if (dart.test(recursive)) {
+        return io.Directory.new(this.path).deleteSync({recursive: true});
+      }
+      let result = io._File._deleteLinkNative(this.path);
+      io._Link.throwIfError(result, "Cannot delete link", this.path);
+    }
+    rename(newPath) {
+      return io._IOService._dispatch(io._FILE_RENAME_LINK, JSArrayOfString().of([this.path, newPath])).then(io.Link)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, dart.str`Cannot rename link to '${newPath}'`, this.path));
+        }
+        return io.Link.new(newPath);
+      }, dynamicToLink()));
+    }
+    renameSync(newPath) {
+      let result = io._File._renameLink(this.path, newPath);
+      io._Link.throwIfError(result, dart.str`Cannot rename link '${this.path}' to '${newPath}'`);
+      return io.Link.new(newPath);
+    }
+    target() {
+      return io._IOService._dispatch(io._FILE_LINK_TARGET, JSArrayOfString().of([this.path])).then(core.String)(dart.fn(response => {
+        if (dart.test(this[_isErrorResponse](response))) {
+          dart.throw(this[_exceptionFromResponse](response, "Cannot get target of link", this.path));
+        }
+        return FutureOrOfString()._check(response);
+      }, dynamicToFutureOrOfString()));
+    }
+    targetSync() {
+      let result = io._File._linkTarget(this.path);
+      io._Link.throwIfError(result, "Cannot read link", this.path);
+      return core.String._check(result);
+    }
+    static throwIfError(result, msg, path) {
+      if (path === void 0) path = "";
+      if (io.OSError.is(result)) {
+        dart.throw(new io.FileSystemException(msg, path, result));
+      }
+    }
+    [_isErrorResponse](response) {
+      return core.List.is(response) && !dart.equals(response[dartx._get](0), io._SUCCESS_RESPONSE);
+    }
+    [_exceptionFromResponse](response, message, path) {
+      dart.assert(this[_isErrorResponse](response));
+      switch (dart.dindex(response, io._ERROR_RESPONSE_ERROR_TYPE)) {
+        case io._ILLEGAL_ARGUMENT_RESPONSE:
+        {
+          return new core.ArgumentError();
+        }
+        case io._OSERROR_RESPONSE:
+        {
+          let err = new io.OSError(core.String._check(dart.dindex(response, io._OSERROR_RESPONSE_MESSAGE)), core.int._check(dart.dindex(response, io._OSERROR_RESPONSE_ERROR_CODE)));
+          return new io.FileSystemException(message, path, err);
+        }
+        default:
+        {
+          return core.Exception.new("Unknown error");
+        }
+      }
+    }
+  };
+  io._Link[dart.implements] = () => [io.Link];
+  dart.setSignature(io._Link, {
+    constructors: () => ({new: dart.definiteFunctionType(io._Link, [core.String])}),
+    fields: () => ({path: core.String}),
+    getters: () => ({absolute: dart.definiteFunctionType(io.Link, [])}),
+    methods: () => ({
+      exists: dart.definiteFunctionType(async.Future$(core.bool), []),
+      existsSync: dart.definiteFunctionType(core.bool, []),
+      stat: dart.definiteFunctionType(async.Future$(io.FileStat), []),
+      statSync: dart.definiteFunctionType(io.FileStat, []),
+      create: dart.definiteFunctionType(async.Future$(io.Link), [core.String], {recursive: core.bool}),
+      createSync: dart.definiteFunctionType(dart.void, [core.String], {recursive: core.bool}),
+      [_makeWindowsLinkTarget]: dart.definiteFunctionType(core.String, [core.String]),
+      updateSync: dart.definiteFunctionType(dart.void, [core.String]),
+      update: dart.definiteFunctionType(async.Future$(io.Link), [core.String]),
+      [_delete]: dart.definiteFunctionType(async.Future$(io.Link), [], {recursive: core.bool}),
+      [_deleteSync]: dart.definiteFunctionType(dart.void, [], {recursive: core.bool}),
+      rename: dart.definiteFunctionType(async.Future$(io.Link), [core.String]),
+      renameSync: dart.definiteFunctionType(io.Link, [core.String]),
+      target: dart.definiteFunctionType(async.Future$(core.String), []),
+      targetSync: dart.definiteFunctionType(core.String, []),
+      [_isErrorResponse]: dart.definiteFunctionType(core.bool, [dart.dynamic]),
+      [_exceptionFromResponse]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.String])
+    }),
+    statics: () => ({throwIfError: dart.definiteFunctionType(dart.dynamic, [core.Object, core.String], [core.String])}),
+    names: ['throwIfError']
+  });
+  io.Platform = class Platform extends core.Object {
+    static get numberOfProcessors() {
+      return io.Platform._numberOfProcessors;
+    }
+    static get pathSeparator() {
+      return io.Platform._pathSeparator;
+    }
+    static get operatingSystem() {
+      return io.Platform._operatingSystem;
+    }
+    static get localHostname() {
+      return io.Platform._localHostname;
+    }
+    static get environment() {
+      return io._Platform.environment;
+    }
+    static get executable() {
+      return io._Platform.executable;
+    }
+    static get resolvedExecutable() {
+      return io._Platform.resolvedExecutable;
+    }
+    static get script() {
+      return io._Platform.script;
+    }
+    static get executableArguments() {
+      return io._Platform.executableArguments;
+    }
+    static get packageRoot() {
+      return io._Platform.packageRoot;
+    }
+    static get packageConfig() {
+      return io._Platform.packageConfig;
+    }
+    static get version() {
+      return io.Platform._version;
+    }
+  };
+  dart.setSignature(io.Platform, {
+    sfields: () => ({
+      _numberOfProcessors: core.int,
+      _pathSeparator: core.String,
+      _operatingSystem: core.String,
+      _localHostname: core.String,
+      _version: core.String,
+      isLinux: core.bool,
+      isMacOS: core.bool,
+      isWindows: core.bool,
+      isAndroid: core.bool,
+      isIOS: core.bool
+    }),
+    sgetters: () => ({
+      numberOfProcessors: dart.definiteFunctionType(core.int, []),
+      pathSeparator: dart.definiteFunctionType(core.String, []),
+      operatingSystem: dart.definiteFunctionType(core.String, []),
+      localHostname: dart.definiteFunctionType(core.String, []),
+      environment: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+      executable: dart.definiteFunctionType(core.String, []),
+      resolvedExecutable: dart.definiteFunctionType(core.String, []),
+      script: dart.definiteFunctionType(core.Uri, []),
+      executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+      packageRoot: dart.definiteFunctionType(core.String, []),
+      packageConfig: dart.definiteFunctionType(core.String, []),
+      version: dart.definiteFunctionType(core.String, [])
+    })
+  });
+  dart.defineLazy(io.Platform, {
+    get _numberOfProcessors() {
+      return io._Platform.numberOfProcessors;
+    },
+    get _pathSeparator() {
+      return io._Platform.pathSeparator;
+    },
+    get _operatingSystem() {
+      return io._Platform.operatingSystem;
+    },
+    get _localHostname() {
+      return io._Platform.localHostname;
+    },
+    get _version() {
+      return io._Platform.version;
+    },
+    get isLinux() {
+      return io.Platform._operatingSystem == "linux";
+    },
+    get isMacOS() {
+      return io.Platform._operatingSystem == "macos";
+    },
+    get isWindows() {
+      return io.Platform._operatingSystem == "windows";
+    },
+    get isAndroid() {
+      return io.Platform._operatingSystem == "android";
+    },
+    get isIOS() {
+      return io.Platform._operatingSystem == "ios";
+    }
+  });
+  io._Platform = class _Platform extends core.Object {
+    static _numberOfProcessors() {
+      dart.throw(new core.UnsupportedError("Platform._numberOfProcessors"));
+    }
+    static _pathSeparator() {
+      dart.throw(new core.UnsupportedError("Platform._pathSeparator"));
+    }
+    static _operatingSystem() {
+      dart.throw(new core.UnsupportedError("Platform._operatingSystem"));
+    }
+    static _localHostname() {
+      dart.throw(new core.UnsupportedError("Platform._localHostname"));
+    }
+    static _executable() {
+      dart.throw(new core.UnsupportedError("Platform._executable"));
+    }
+    static _resolvedExecutable() {
+      dart.throw(new core.UnsupportedError("Platform._resolvedExecutable"));
+    }
+    static _environment() {
+      dart.throw(new core.UnsupportedError("Platform._environment"));
+    }
+    static _executableArguments() {
+      dart.throw(new core.UnsupportedError("Platform._executableArguments"));
+    }
+    static _packageRoot() {
+      dart.throw(new core.UnsupportedError("Platform._packageRoot"));
+    }
+    static _packageConfig() {
+      dart.throw(new core.UnsupportedError("Platform._packageConfig"));
+    }
+    static _version() {
+      dart.throw(new core.UnsupportedError("Platform._version"));
+    }
+    static get numberOfProcessors() {
+      return io._Platform._numberOfProcessors();
+    }
+    static get pathSeparator() {
+      return io._Platform._pathSeparator();
+    }
+    static get operatingSystem() {
+      return io._Platform._operatingSystem();
+    }
+    static get localHostname() {
+      let result = io._Platform._localHostname();
+      if (io.OSError.is(result)) {
+        dart.throw(result);
+      } else {
+        return core.String._check(result);
+      }
+    }
+    static get executableArguments() {
+      return io._Platform._executableArguments();
+    }
+    static get environment() {
+      if (io._Platform._environmentCache == null) {
+        let env = io._Platform._environment();
+        if (!io.OSError.is(env)) {
+          let isWindows = io._Platform.operatingSystem == 'windows';
+          let result = isWindows ? new io._CaseInsensitiveStringMap() : core.Map.new();
+          for (let str of core.Iterable._check(env)) {
+            let equalsIndex = dart.dsend(str, 'indexOf', '=');
+            if (dart.test(dart.dsend(equalsIndex, '>', 0))) {
+              result[dartx._set](dart.dsend(str, 'substring', 0, equalsIndex), dart.dsend(str, 'substring', dart.dsend(equalsIndex, '+', 1)));
+            }
+          }
+          io._Platform._environmentCache = new (UnmodifiableMapViewOfString$String())(MapOfString$String()._check(result));
+        } else {
+          io._Platform._environmentCache = env;
+        }
+      }
+      if (io.OSError.is(io._Platform._environmentCache)) {
+        dart.throw(io._Platform._environmentCache);
+      } else {
+        return MapOfString$String()._check(io._Platform._environmentCache);
+      }
+    }
+    static get version() {
+      return io._Platform._version();
+    }
+  };
+  dart.setSignature(io._Platform, {
+    sfields: () => ({
+      executable: core.String,
+      resolvedExecutable: core.String,
+      packageRoot: core.String,
+      packageConfig: core.String,
+      _environmentCache: dart.dynamic,
+      script: core.Uri
+    }),
+    sgetters: () => ({
+      numberOfProcessors: dart.definiteFunctionType(core.int, []),
+      pathSeparator: dart.definiteFunctionType(core.String, []),
+      operatingSystem: dart.definiteFunctionType(core.String, []),
+      localHostname: dart.definiteFunctionType(core.String, []),
+      executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+      environment: dart.definiteFunctionType(core.Map$(core.String, core.String), []),
+      version: dart.definiteFunctionType(core.String, [])
+    }),
+    statics: () => ({
+      _numberOfProcessors: dart.definiteFunctionType(core.int, []),
+      _pathSeparator: dart.definiteFunctionType(core.String, []),
+      _operatingSystem: dart.definiteFunctionType(core.String, []),
+      _localHostname: dart.definiteFunctionType(dart.dynamic, []),
+      _executable: dart.definiteFunctionType(dart.dynamic, []),
+      _resolvedExecutable: dart.definiteFunctionType(dart.dynamic, []),
+      _environment: dart.definiteFunctionType(dart.dynamic, []),
+      _executableArguments: dart.definiteFunctionType(core.List$(core.String), []),
+      _packageRoot: dart.definiteFunctionType(core.String, []),
+      _packageConfig: dart.definiteFunctionType(core.String, []),
+      _version: dart.definiteFunctionType(core.String, [])
+    }),
+    names: ['_numberOfProcessors', '_pathSeparator', '_operatingSystem', '_localHostname', '_executable', '_resolvedExecutable', '_environment', '_executableArguments', '_packageRoot', '_packageConfig', '_version']
+  });
+  io._Platform._environmentCache = null;
+  io._Platform.script = null;
+  dart.defineLazy(io._Platform, {
+    get executable() {
+      return core.String._check(io._Platform._executable());
+    },
+    set executable(_) {},
+    get resolvedExecutable() {
+      return core.String._check(io._Platform._resolvedExecutable());
+    },
+    set resolvedExecutable(_) {},
+    get packageRoot() {
+      return io._Platform._packageRoot();
+    },
+    set packageRoot(_) {},
+    get packageConfig() {
+      return io._Platform._packageConfig();
+    },
+    set packageConfig(_) {}
+  });
+  const _map$1 = Symbol('_map');
+  io._CaseInsensitiveStringMap$ = dart.generic(V => {
+    let MapOfString$V = () => (MapOfString$V = dart.constFn(core.Map$(core.String, V)))();
+    let VoidToV = () => (VoidToV = dart.constFn(dart.functionType(V, [])))();
+    let StringAndVTovoid = () => (StringAndVTovoid = dart.constFn(dart.functionType(dart.void, [core.String, V])))();
+    class _CaseInsensitiveStringMap extends core.Object {
+      new() {
+        this[_map$1] = MapOfString$V().new();
+      }
+      containsKey(key) {
+        return typeof key == 'string' && dart.test(this[_map$1][dartx.containsKey](key[dartx.toUpperCase]()));
+      }
+      containsValue(value) {
+        return this[_map$1][dartx.containsValue](value);
+      }
+      _get(key) {
+        return typeof key == 'string' ? this[_map$1][dartx._get](key[dartx.toUpperCase]()) : null;
+      }
+      _set(key, value) {
+        V._check(value);
+        this[_map$1][dartx._set](key[dartx.toUpperCase](), value);
+        return value;
+      }
+      putIfAbsent(key, ifAbsent) {
+        VoidToV()._check(ifAbsent);
+        return this[_map$1][dartx.putIfAbsent](key[dartx.toUpperCase](), ifAbsent);
+      }
+      addAll(other) {
+        other[dartx.forEach](dart.fn((key, value) => this._set(core.String._check(dart.dsend(key, 'toUpperCase')), V._check(value)), dynamicAnddynamicTovoid$()));
+      }
+      remove(key) {
+        return typeof key == 'string' ? this[_map$1][dartx.remove](key[dartx.toUpperCase]()) : null;
+      }
+      clear() {
+        this[_map$1][dartx.clear]();
+      }
+      forEach(f) {
+        this[_map$1][dartx.forEach](f);
+      }
+      get keys() {
+        return this[_map$1][dartx.keys];
+      }
+      get values() {
+        return this[_map$1][dartx.values];
+      }
+      get length() {
+        return this[_map$1][dartx.length];
+      }
+      get isEmpty() {
+        return this[_map$1][dartx.isEmpty];
+      }
+      get isNotEmpty() {
+        return this[_map$1][dartx.isNotEmpty];
+      }
+      toString() {
+        return dart.toString(this[_map$1]);
+      }
+    }
+    dart.addTypeTests(_CaseInsensitiveStringMap);
+    _CaseInsensitiveStringMap[dart.implements] = () => [MapOfString$V()];
+    dart.setSignature(_CaseInsensitiveStringMap, {
+      fields: () => ({[_map$1]: MapOfString$V()}),
+      getters: () => ({
+        keys: dart.definiteFunctionType(core.Iterable$(core.String), []),
+        values: dart.definiteFunctionType(core.Iterable$(V), []),
+        length: dart.definiteFunctionType(core.int, []),
+        isEmpty: dart.definiteFunctionType(core.bool, []),
+        isNotEmpty: dart.definiteFunctionType(core.bool, [])
+      }),
+      methods: () => ({
+        containsKey: dart.definiteFunctionType(core.bool, [core.Object]),
+        containsValue: dart.definiteFunctionType(core.bool, [core.Object]),
+        _get: dart.definiteFunctionType(V, [core.Object]),
+        _set: dart.definiteFunctionType(dart.void, [core.String, V]),
+        putIfAbsent: dart.definiteFunctionType(V, [core.String, VoidToV()]),
+        addAll: dart.definiteFunctionType(dart.void, [core.Map]),
+        remove: dart.definiteFunctionType(V, [core.Object]),
+        clear: dart.definiteFunctionType(dart.void, []),
+        forEach: dart.definiteFunctionType(dart.void, [StringAndVTovoid()])
+      })
+    });
+    dart.defineExtensionMembers(_CaseInsensitiveStringMap, [
+      'containsKey',
+      'containsValue',
+      '_get',
+      '_set',
+      'putIfAbsent',
+      'addAll',
+      'remove',
+      'clear',
+      'forEach',
+      'keys',
+      'values',
+      'length',
+      'isEmpty',
+      'isNotEmpty'
+    ]);
+    return _CaseInsensitiveStringMap;
+  });
+  io._CaseInsensitiveStringMap = _CaseInsensitiveStringMap();
+  io._ProcessUtils = class _ProcessUtils extends core.Object {
+    static _exit(status) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._exit"));
+    }
+    static _setExitCode(status) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._setExitCode"));
+    }
+    static _getExitCode() {
+      dart.throw(new core.UnsupportedError("ProcessUtils._getExitCode"));
+    }
+    static _sleep(millis) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._sleep"));
+    }
+    static _pid(process) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._pid"));
+    }
+    static _watchSignal(signal) {
+      dart.throw(new core.UnsupportedError("ProcessUtils._watchSignal"));
+    }
+  };
+  dart.setSignature(io._ProcessUtils, {
+    statics: () => ({
+      _exit: dart.definiteFunctionType(dart.void, [core.int]),
+      _setExitCode: dart.definiteFunctionType(dart.void, [core.int]),
+      _getExitCode: dart.definiteFunctionType(core.int, []),
+      _sleep: dart.definiteFunctionType(dart.void, [core.int]),
+      _pid: dart.definiteFunctionType(core.int, [io.Process]),
+      _watchSignal: dart.definiteFunctionType(async.Stream$(io.ProcessSignal), [io.ProcessSignal])
+    }),
+    names: ['_exit', '_setExitCode', '_getExitCode', '_sleep', '_pid', '_watchSignal']
+  });
+  io.exit = function(code) {
+    if (!(typeof code == 'number')) {
+      dart.throw(new core.ArgumentError("Integer value for exit code expected"));
+    }
+    io._ProcessUtils._exit(code);
+  };
+  dart.fn(io.exit, intTovoid());
+  dart.copyProperties(io, {
+    set exitCode(code) {
+      if (!(typeof code == 'number')) {
+        dart.throw(new core.ArgumentError("Integer value for exit code expected"));
+      }
+      io._ProcessUtils._setExitCode(code);
+    },
+    get exitCode() {
+      return io._ProcessUtils._getExitCode();
+    }
+  });
+  io.sleep = function(duration) {
+    let milliseconds = duration.inMilliseconds;
+    if (dart.notNull(milliseconds) < 0) {
+      dart.throw(new core.ArgumentError("sleep: duration cannot be negative"));
+    }
+    io._ProcessUtils._sleep(milliseconds);
+  };
+  dart.fn(io.sleep, DurationTovoid());
+  dart.copyProperties(io, {
+    get pid() {
+      return io._ProcessUtils._pid(null);
+    }
+  });
+  io.ProcessStartMode = class ProcessStartMode extends core.Object {
+    new(index) {
+      this.index = index;
+    }
+    toString() {
+      return {
+        0: "ProcessStartMode.NORMAL",
+        1: "ProcessStartMode.DETACHED",
+        2: "ProcessStartMode.DETACHED_WITH_STDIO"
+      }[this.index];
+    }
+  };
+  dart.setSignature(io.ProcessStartMode, {
+    fields: () => ({index: core.int})
+  });
+  dart.defineEnumValues(io.ProcessStartMode, [
+    'NORMAL',
+    'DETACHED',
+    'DETACHED_WITH_STDIO'
+  ]);
+  io.Process = class Process extends core.Object {
+    new() {
+      this.exitCode = null;
+    }
+    static start(executable, arguments$, opts) {
+      let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+      let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+      let mode = opts && 'mode' in opts ? opts.mode : io.ProcessStartMode.NORMAL;
+      dart.throw(new core.UnsupportedError("Process.start"));
+    }
+    static run(executable, arguments$, opts) {
+      let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+      let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+      let stdoutEncoding = opts && 'stdoutEncoding' in opts ? opts.stdoutEncoding : io.SYSTEM_ENCODING;
+      let stderrEncoding = opts && 'stderrEncoding' in opts ? opts.stderrEncoding : io.SYSTEM_ENCODING;
+      dart.throw(new core.UnsupportedError("Process.run"));
+    }
+    static runSync(executable, arguments$, opts) {
+      let workingDirectory = opts && 'workingDirectory' in opts ? opts.workingDirectory : null;
+      let environment = opts && 'environment' in opts ? opts.environment : null;
+      let includeParentEnvironment = opts && 'includeParentEnvironment' in opts ? opts.includeParentEnvironment : true;
+      let runInShell = opts && 'runInShell' in opts ? opts.runInShell : false;
+      let stdoutEncoding = opts && 'stdoutEncoding' in opts ? opts.stdoutEncoding : io.SYSTEM_ENCODING;
+      let stderrEncoding = opts && 'stderrEncoding' in opts ? opts.stderrEncoding : io.SYSTEM_ENCODING;
+      dart.throw(new core.UnsupportedError("Process.runSync"));
+    }
+    static killPid(pid, signal) {
+      if (signal === void 0) signal = io.ProcessSignal.SIGTERM;
+      dart.throw(new core.UnsupportedError("Process.killPid"));
+    }
+  };
+  dart.setSignature(io.Process, {
+    fields: () => ({exitCode: FutureOfint()}),
+    statics: () => ({
+      start: dart.definiteFunctionType(async.Future$(io.Process), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, mode: io.ProcessStartMode}),
+      run: dart.definiteFunctionType(async.Future$(io.ProcessResult), [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
+      runSync: dart.definiteFunctionType(io.ProcessResult, [core.String, ListOfString()], {workingDirectory: core.String, environment: MapOfString$String(), includeParentEnvironment: core.bool, runInShell: core.bool, stdoutEncoding: convert.Encoding, stderrEncoding: convert.Encoding}),
+      killPid: dart.definiteFunctionType(core.bool, [core.int], [io.ProcessSignal])
+    }),
+    names: ['start', 'run', 'runSync', 'killPid']
+  });
+  io.ProcessResult = class ProcessResult extends core.Object {
+    new(pid, exitCode, stdout, stderr) {
+      this.pid = pid;
+      this.exitCode = exitCode;
+      this.stdout = stdout;
+      this.stderr = stderr;
+    }
+  };
+  dart.setSignature(io.ProcessResult, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ProcessResult, [core.int, core.int, dart.dynamic, dart.dynamic])}),
+    fields: () => ({
+      exitCode: core.int,
+      stdout: dart.dynamic,
+      stderr: dart.dynamic,
+      pid: core.int
+    })
+  });
+  const _signalNumber = Symbol('_signalNumber');
+  const _name$2 = Symbol('_name');
+  io.ProcessSignal = class ProcessSignal extends core.Object {
+    _(signalNumber, name) {
+      this[_signalNumber] = signalNumber;
+      this[_name$2] = name;
+    }
+    toString() {
+      return this[_name$2];
+    }
+    watch() {
+      return io._ProcessUtils._watchSignal(this);
+    }
+  };
+  dart.defineNamedConstructor(io.ProcessSignal, '_');
+  dart.setSignature(io.ProcessSignal, {
+    constructors: () => ({_: dart.definiteFunctionType(io.ProcessSignal, [core.int, core.String])}),
+    fields: () => ({
+      [_signalNumber]: core.int,
+      [_name$2]: core.String
+    }),
+    methods: () => ({watch: dart.definiteFunctionType(async.Stream$(io.ProcessSignal), [])}),
+    sfields: () => ({
+      SIGHUP: io.ProcessSignal,
+      SIGINT: io.ProcessSignal,
+      SIGQUIT: io.ProcessSignal,
+      SIGILL: io.ProcessSignal,
+      SIGTRAP: io.ProcessSignal,
+      SIGABRT: io.ProcessSignal,
+      SIGBUS: io.ProcessSignal,
+      SIGFPE: io.ProcessSignal,
+      SIGKILL: io.ProcessSignal,
+      SIGUSR1: io.ProcessSignal,
+      SIGSEGV: io.ProcessSignal,
+      SIGUSR2: io.ProcessSignal,
+      SIGPIPE: io.ProcessSignal,
+      SIGALRM: io.ProcessSignal,
+      SIGTERM: io.ProcessSignal,
+      SIGCHLD: io.ProcessSignal,
+      SIGCONT: io.ProcessSignal,
+      SIGSTOP: io.ProcessSignal,
+      SIGTSTP: io.ProcessSignal,
+      SIGTTIN: io.ProcessSignal,
+      SIGTTOU: io.ProcessSignal,
+      SIGURG: io.ProcessSignal,
+      SIGXCPU: io.ProcessSignal,
+      SIGXFSZ: io.ProcessSignal,
+      SIGVTALRM: io.ProcessSignal,
+      SIGPROF: io.ProcessSignal,
+      SIGWINCH: io.ProcessSignal,
+      SIGPOLL: io.ProcessSignal,
+      SIGSYS: io.ProcessSignal
+    })
+  });
+  dart.defineLazy(io.ProcessSignal, {
+    get SIGHUP() {
+      return dart.const(new io.ProcessSignal._(1, "SIGHUP"));
+    },
+    get SIGINT() {
+      return dart.const(new io.ProcessSignal._(2, "SIGINT"));
+    },
+    get SIGQUIT() {
+      return dart.const(new io.ProcessSignal._(3, "SIGQUIT"));
+    },
+    get SIGILL() {
+      return dart.const(new io.ProcessSignal._(4, "SIGILL"));
+    },
+    get SIGTRAP() {
+      return dart.const(new io.ProcessSignal._(5, "SIGTRAP"));
+    },
+    get SIGABRT() {
+      return dart.const(new io.ProcessSignal._(6, "SIGABRT"));
+    },
+    get SIGBUS() {
+      return dart.const(new io.ProcessSignal._(7, "SIGBUS"));
+    },
+    get SIGFPE() {
+      return dart.const(new io.ProcessSignal._(8, "SIGFPE"));
+    },
+    get SIGKILL() {
+      return dart.const(new io.ProcessSignal._(9, "SIGKILL"));
+    },
+    get SIGUSR1() {
+      return dart.const(new io.ProcessSignal._(10, "SIGUSR1"));
+    },
+    get SIGSEGV() {
+      return dart.const(new io.ProcessSignal._(11, "SIGSEGV"));
+    },
+    get SIGUSR2() {
+      return dart.const(new io.ProcessSignal._(12, "SIGUSR2"));
+    },
+    get SIGPIPE() {
+      return dart.const(new io.ProcessSignal._(13, "SIGPIPE"));
+    },
+    get SIGALRM() {
+      return dart.const(new io.ProcessSignal._(14, "SIGALRM"));
+    },
+    get SIGTERM() {
+      return dart.const(new io.ProcessSignal._(15, "SIGTERM"));
+    },
+    get SIGCHLD() {
+      return dart.const(new io.ProcessSignal._(17, "SIGCHLD"));
+    },
+    get SIGCONT() {
+      return dart.const(new io.ProcessSignal._(18, "SIGCONT"));
+    },
+    get SIGSTOP() {
+      return dart.const(new io.ProcessSignal._(19, "SIGSTOP"));
+    },
+    get SIGTSTP() {
+      return dart.const(new io.ProcessSignal._(20, "SIGTSTP"));
+    },
+    get SIGTTIN() {
+      return dart.const(new io.ProcessSignal._(21, "SIGTTIN"));
+    },
+    get SIGTTOU() {
+      return dart.const(new io.ProcessSignal._(22, "SIGTTOU"));
+    },
+    get SIGURG() {
+      return dart.const(new io.ProcessSignal._(23, "SIGURG"));
+    },
+    get SIGXCPU() {
+      return dart.const(new io.ProcessSignal._(24, "SIGXCPU"));
+    },
+    get SIGXFSZ() {
+      return dart.const(new io.ProcessSignal._(25, "SIGXFSZ"));
+    },
+    get SIGVTALRM() {
+      return dart.const(new io.ProcessSignal._(26, "SIGVTALRM"));
+    },
+    get SIGPROF() {
+      return dart.const(new io.ProcessSignal._(27, "SIGPROF"));
+    },
+    get SIGWINCH() {
+      return dart.const(new io.ProcessSignal._(28, "SIGWINCH"));
+    },
+    get SIGPOLL() {
+      return dart.const(new io.ProcessSignal._(29, "SIGPOLL"));
+    },
+    get SIGSYS() {
+      return dart.const(new io.ProcessSignal._(31, "SIGSYS"));
+    }
+  });
+  io.SignalException = class SignalException extends core.Object {
+    new(message, osError) {
+      if (osError === void 0) osError = null;
+      this.message = message;
+      this.osError = osError;
+    }
+    toString() {
+      let msg = "";
+      if (this.osError != null) {
+        msg = dart.str`, osError: ${this.osError}`;
+      }
+      return dart.str`SignalException: ${this.message}${msg}`;
+    }
+  };
+  io.SignalException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.SignalException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.SignalException, [core.String], [dart.dynamic])}),
+    fields: () => ({
+      message: core.String,
+      osError: dart.dynamic
+    })
+  });
+  io.ProcessException = class ProcessException extends core.Object {
+    new(executable, arguments$, message, errorCode) {
+      if (message === void 0) message = "";
+      if (errorCode === void 0) errorCode = 0;
+      this.executable = executable;
+      this.arguments = arguments$;
+      this.message = message;
+      this.errorCode = errorCode;
+    }
+    toString() {
+      let msg = this.message == null ? dart.str`OS error code: ${this.errorCode}` : this.message;
+      let args = this.arguments[dartx.join](' ');
+      return dart.str`ProcessException: ${msg}\n  Command: ${this.executable} ${args}`;
+    }
+  };
+  io.ProcessException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.ProcessException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.ProcessException, [core.String, ListOfString()], [core.String, core.int])}),
+    fields: () => ({
+      executable: core.String,
+      arguments: ListOfString(),
+      message: core.String,
+      errorCode: core.int
+    })
+  });
+  const _detachRaw = Symbol('_detachRaw');
+  io.SecureSocket = class SecureSocket extends core.Object {
+    static _(rawSocket) {
+      dart.throw(new core.UnsupportedError("SecureSocket constructor"));
+    }
+    static connect(host, port, opts) {
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      return io.RawSecureSocket.connect(host, port, {context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols}).then(io.SecureSocket)(dart.fn(rawSocket => io.SecureSocket._(rawSocket), RawSecureSocketToSecureSocket()));
+    }
+    static secure(socket, opts) {
+      let host = opts && 'host' in opts ? opts.host : null;
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let completer = async.Completer.new();
+      dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secure(io.RawSocket._check(dart.dindex(detachedRaw, 0)), {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), host: host, context: context, onBadCertificate: onBadCertificate}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
+        completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
+      }, dynamicToNull$()));
+      return FutureOfSecureSocket()._check(completer.future);
+    }
+    static secureServer(socket, context, opts) {
+      let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      let completer = async.Completer.new();
+      dart.dsend(dart.dsend(dart.dsend(socket, _detachRaw), 'then', dart.fn(detachedRaw => io.RawSecureSocket.secureServer(io.RawSocket._check(dart.dindex(detachedRaw, 0)), context, {subscription: async.StreamSubscription._check(dart.dindex(detachedRaw, 1)), bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols}), dynamicToFutureOfRawSecureSocket())), 'then', dart.fn(raw => {
+        completer.complete(io.SecureSocket._(io.RawSecureSocket._check(raw)));
+      }, dynamicToNull$()));
+      return FutureOfSecureSocket()._check(completer.future);
+    }
+  };
+  io.SecureSocket[dart.implements] = () => [io.Socket];
+  dart.setSignature(io.SecureSocket, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SecureSocket, [io.RawSecureSocket])}),
+    statics: () => ({
+      connect: dart.definiteFunctionType(async.Future$(io.SecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      secure: dart.definiteFunctionType(async.Future$(io.SecureSocket), [io.Socket], {host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool()}),
+      secureServer: dart.definiteFunctionType(async.Future$(io.SecureSocket), [io.Socket, io.SecurityContext], {bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+    }),
+    names: ['connect', 'secure', 'secureServer']
+  });
+  io.SecureServerSocket = class SecureServerSocket extends async.Stream$(io.SecureSocket) {
+    _(socket) {
+      this[_socket] = socket;
+      super.new();
+    }
+    static bind(address, port, context, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io.RawSecureServerSocket.bind(address, port, context, {backlog: backlog, v6Only: v6Only, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols, shared: shared}).then(io.SecureServerSocket)(dart.fn(serverSocket => new io.SecureServerSocket._(serverSocket), RawSecureServerSocketToSecureServerSocket()));
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_socket].map(io.SecureSocket)(dart.fn(rawSocket => io.SecureSocket._(rawSocket), RawSecureSocketToSecureSocket())).listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get port() {
+      return this[_socket].port;
+    }
+    get address() {
+      return this[_socket].address;
+    }
+    close() {
+      return this[_socket].close().then(io.SecureServerSocket)(dart.fn(_ => this, RawSecureServerSocketToSecureServerSocket()));
+    }
+    set [_owner](owner) {
+      this[_socket][_owner] = owner;
+    }
+  };
+  dart.addSimpleTypeTests(io.SecureServerSocket);
+  dart.defineNamedConstructor(io.SecureServerSocket, '_');
+  dart.setSignature(io.SecureServerSocket, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SecureServerSocket, [io.RawSecureServerSocket])}),
+    fields: () => ({[_socket]: io.RawSecureServerSocket}),
+    getters: () => ({
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, [])
+    }),
+    setters: () => ({[_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.SecureSocket), [SecureSocketTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(async.Future$(io.SecureServerSocket), [])
+    }),
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.SecureServerSocket), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString(), shared: core.bool})}),
+    names: ['bind']
+  });
+  const _onSubscriptionStateChange = Symbol('_onSubscriptionStateChange');
+  const _onPauseStateChange = Symbol('_onPauseStateChange');
+  io.RawSecureSocket = class RawSecureSocket extends core.Object {
+    static connect(host, port, opts) {
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      io._RawSecureSocket._verifyFields(host, port, false, false, false, onBadCertificate);
+      return io.RawSocket.connect(host, port).then(io.RawSecureSocket)(dart.fn(socket => io.RawSecureSocket.secure(socket, {context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols}), RawSocketToFutureOfRawSecureSocket()));
+    }
+    static secure(socket, opts) {
+      let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+      let host = opts && 'host' in opts ? opts.host : null;
+      let context = opts && 'context' in opts ? opts.context : null;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      socket.readEventsEnabled = false;
+      socket.writeEventsEnabled = false;
+      return io._RawSecureSocket.connect(host != null ? host : socket.address.host, socket.port, {is_server: false, socket: socket, subscription: subscription, context: context, onBadCertificate: onBadCertificate, supportedProtocols: supportedProtocols});
+    }
+    static secureServer(socket, context, opts) {
+      let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+      let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      socket.readEventsEnabled = false;
+      socket.writeEventsEnabled = false;
+      return io._RawSecureSocket.connect(socket.address, socket.remotePort, {context: context, is_server: true, socket: socket, subscription: subscription, bufferedData: bufferedData, requestClientCertificate: requestClientCertificate, requireClientCertificate: requireClientCertificate, supportedProtocols: supportedProtocols});
+    }
+  };
+  io.RawSecureSocket[dart.implements] = () => [io.RawSocket];
+  dart.setSignature(io.RawSecureSocket, {
+    statics: () => ({
+      connect: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [dart.dynamic, core.int], {context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      secure: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket], {subscription: async.StreamSubscription, host: dart.dynamic, context: io.SecurityContext, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      secureServer: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), [io.RawSocket, io.SecurityContext], {subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString()})
+    }),
+    names: ['connect', 'secure', 'secureServer']
+  });
+  io.RawSecureServerSocket = class RawSecureServerSocket extends async.Stream$(io.RawSecureSocket) {
+    _(socket, context, requestClientCertificate, requireClientCertificate, supportedProtocols) {
+      this[_socket] = socket;
+      this[_context] = context;
+      this.requestClientCertificate = requestClientCertificate;
+      this.requireClientCertificate = requireClientCertificate;
+      this.supportedProtocols = supportedProtocols;
+      this[_controller$0] = null;
+      this[_subscription$] = null;
+      this[_closed] = false;
+      super.new();
+      this[_controller$0] = StreamControllerOfRawSecureSocket().new({sync: true, onListen: dart.bind(this, _onSubscriptionStateChange), onPause: dart.bind(this, _onPauseStateChange), onResume: dart.bind(this, _onPauseStateChange), onCancel: dart.bind(this, _onSubscriptionStateChange)});
+    }
+    static bind(address, port, context, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      return io.RawServerSocket.bind(address, port, {backlog: backlog, v6Only: v6Only, shared: shared}).then(io.RawSecureServerSocket)(dart.fn(serverSocket => new io.RawSecureServerSocket._(serverSocket, context, requestClientCertificate, requireClientCertificate, supportedProtocols), RawServerSocketToRawSecureServerSocket()));
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get port() {
+      return this[_socket].port;
+    }
+    get address() {
+      return this[_socket].address;
+    }
+    close() {
+      this[_closed] = true;
+      return this[_socket].close().then(io.RawSecureServerSocket)(dart.fn(_ => this, RawServerSocketToRawSecureServerSocket()));
+    }
+    [_onData$](connection) {
+      let remotePort = null;
+      try {
+        remotePort = connection.remotePort;
+      } catch (e) {
+        return;
+      }
+
+      io._RawSecureSocket.connect(connection.address, core.int._check(remotePort), {context: this[_context], is_server: true, socket: connection, requestClientCertificate: this.requestClientCertificate, requireClientCertificate: this.requireClientCertificate, supportedProtocols: this.supportedProtocols}).then(dart.dynamic)(dart.fn(secureConnection => {
+        if (dart.test(this[_closed])) {
+          secureConnection.close();
+        } else {
+          this[_controller$0].add(secureConnection);
+        }
+      }, RawSecureSocketToNull())).catchError(dart.fn((e, s) => {
+        if (!dart.test(this[_closed])) {
+          this[_controller$0].addError(e, core.StackTrace._check(s));
+        }
+      }, dynamicAnddynamicToNull()));
+    }
+    [_onPauseStateChange]() {
+      if (dart.test(this[_controller$0].isPaused)) {
+        this[_subscription$].pause();
+      } else {
+        this[_subscription$].resume();
+      }
+    }
+    [_onSubscriptionStateChange]() {
+      if (dart.test(this[_controller$0].hasListener)) {
+        this[_subscription$] = this[_socket].listen(dart.bind(this, _onData$), {onError: dart.bind(this[_controller$0], 'addError'), onDone: dart.bind(this[_controller$0], 'close')});
+      } else {
+        this.close();
+      }
+    }
+    set [_owner](owner) {
+      dart.dput(this[_socket], _owner, owner);
+    }
+  };
+  dart.addSimpleTypeTests(io.RawSecureServerSocket);
+  dart.defineNamedConstructor(io.RawSecureServerSocket, '_');
+  dart.setSignature(io.RawSecureServerSocket, {
+    constructors: () => ({_: dart.definiteFunctionType(io.RawSecureServerSocket, [io.RawServerSocket, io.SecurityContext, core.bool, core.bool, ListOfString()])}),
+    fields: () => ({
+      [_socket]: io.RawServerSocket,
+      [_controller$0]: StreamControllerOfRawSecureSocket(),
+      [_subscription$]: StreamSubscriptionOfRawSocket(),
+      [_context]: io.SecurityContext,
+      requestClientCertificate: core.bool,
+      requireClientCertificate: core.bool,
+      supportedProtocols: ListOfString(),
+      [_closed]: core.bool
+    }),
+    getters: () => ({
+      port: dart.definiteFunctionType(core.int, []),
+      address: dart.definiteFunctionType(io.InternetAddress, [])
+    }),
+    setters: () => ({[_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSecureSocket), [RawSecureSocketTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      close: dart.definiteFunctionType(async.Future$(io.RawSecureServerSocket), []),
+      [_onData$]: dart.definiteFunctionType(dart.void, [io.RawSocket]),
+      [_onPauseStateChange]: dart.definiteFunctionType(dart.void, []),
+      [_onSubscriptionStateChange]: dart.definiteFunctionType(dart.void, [])
+    }),
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawSecureServerSocket), [dart.dynamic, core.int, io.SecurityContext], {backlog: core.int, v6Only: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool, supportedProtocols: ListOfString(), shared: core.bool})}),
+    names: ['bind']
+  });
+  io.X509Certificate = class X509Certificate extends core.Object {
+    static _() {
+      dart.throw(new core.UnsupportedError("X509Certificate constructor"));
+    }
+  };
+  dart.setSignature(io.X509Certificate, {
+    constructors: () => ({_: dart.definiteFunctionType(io.X509Certificate, [])})
+  });
+  io._FilterStatus = class _FilterStatus extends core.Object {
+    new() {
+      this.progress = false;
+      this.readEmpty = true;
+      this.writeEmpty = true;
+      this.readPlaintextNoLongerEmpty = false;
+      this.writePlaintextNoLongerFull = false;
+      this.readEncryptedNoLongerFull = false;
+      this.writeEncryptedNoLongerEmpty = false;
+    }
+  };
+  dart.setSignature(io._FilterStatus, {
+    constructors: () => ({new: dart.definiteFunctionType(io._FilterStatus, [])}),
+    fields: () => ({
+      progress: core.bool,
+      readEmpty: core.bool,
+      writeEmpty: core.bool,
+      readPlaintextNoLongerEmpty: core.bool,
+      writePlaintextNoLongerFull: core.bool,
+      readEncryptedNoLongerFull: core.bool,
+      writeEncryptedNoLongerEmpty: core.bool
+    })
+  });
+  const _handshakeComplete = Symbol('_handshakeComplete');
+  const _status = Symbol('_status');
+  const _filterStatus = Symbol('_filterStatus');
+  const _secureFilter = Symbol('_secureFilter');
+  const _bufferedData = Symbol('_bufferedData');
+  const _bufferedDataIndex = Symbol('_bufferedDataIndex');
+  const _writeEventsEnabled = Symbol('_writeEventsEnabled');
+  const _readEventsEnabled = Symbol('_readEventsEnabled');
+  const _pendingReadEvent = Symbol('_pendingReadEvent');
+  const _socketClosedRead = Symbol('_socketClosedRead');
+  const _socketClosedWrite = Symbol('_socketClosedWrite');
+  const _closedRead = Symbol('_closedRead');
+  const _closedWrite = Symbol('_closedWrite');
+  const _connectPending = Symbol('_connectPending');
+  const _filterPending = Symbol('_filterPending');
+  const _filterActive = Symbol('_filterActive');
+  const _selectedProtocol = Symbol('_selectedProtocol');
+  const _secureHandshakeCompleteHandler = Symbol('_secureHandshakeCompleteHandler');
+  const _onBadCertificateWrapper = Symbol('_onBadCertificateWrapper');
+  const _eventDispatcher = Symbol('_eventDispatcher');
+  const _doneHandler = Symbol('_doneHandler');
+  const _secureHandshake = Symbol('_secureHandshake');
+  const _sendWriteEvent = Symbol('_sendWriteEvent');
+  const _completeCloseCompleter = Symbol('_completeCloseCompleter');
+  const _close$0 = Symbol('_close');
+  const _scheduleReadEvent = Symbol('_scheduleReadEvent');
+  const _scheduleFilter = Symbol('_scheduleFilter');
+  const _readHandler = Symbol('_readHandler');
+  const _writeHandler = Symbol('_writeHandler');
+  const _closeHandler = Symbol('_closeHandler');
+  const _readSocket = Symbol('_readSocket');
+  const _writeSocket = Symbol('_writeSocket');
+  const _tryFilter = Symbol('_tryFilter');
+  const _pushAllFilterStages = Symbol('_pushAllFilterStages');
+  const _readSocketOrBufferedData = Symbol('_readSocketOrBufferedData');
+  const _sendReadEvent = Symbol('_sendReadEvent');
+  let const$75;
+  io.RawSocketEvent = class RawSocketEvent extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+    toString() {
+      return (const$75 || (const$75 = dart.constList(['RawSocketEvent:READ', 'RawSocketEvent:WRITE', 'RawSocketEvent:READ_CLOSED', 'RawSocketEvent:CLOSED'], core.String)))[dartx._get](this[_value$1]);
+    }
+  };
+  dart.defineNamedConstructor(io.RawSocketEvent, '_');
+  dart.setSignature(io.RawSocketEvent, {
+    constructors: () => ({_: dart.definiteFunctionType(io.RawSocketEvent, [core.int])}),
+    fields: () => ({[_value$1]: core.int}),
+    sfields: () => ({
+      READ: io.RawSocketEvent,
+      WRITE: io.RawSocketEvent,
+      READ_CLOSED: io.RawSocketEvent,
+      CLOSED: io.RawSocketEvent
+    })
+  });
+  dart.defineLazy(io.RawSocketEvent, {
+    get READ() {
+      return dart.const(new io.RawSocketEvent._(0));
+    },
+    get WRITE() {
+      return dart.const(new io.RawSocketEvent._(1));
+    },
+    get READ_CLOSED() {
+      return dart.const(new io.RawSocketEvent._(2));
+    },
+    get CLOSED() {
+      return dart.const(new io.RawSocketEvent._(3));
+    }
+  });
+  io._RawSecureSocket = class _RawSecureSocket extends async.Stream$(io.RawSocketEvent) {
+    static _isBufferEncrypted(identifier) {
+      return dart.notNull(identifier) >= dart.notNull(io._RawSecureSocket.READ_ENCRYPTED);
+    }
+    static connect(host, requestedPort, opts) {
+      let is_server = opts && 'is_server' in opts ? opts.is_server : null;
+      let context = opts && 'context' in opts ? opts.context : null;
+      let socket = opts && 'socket' in opts ? opts.socket : null;
+      let subscription = opts && 'subscription' in opts ? opts.subscription : null;
+      let bufferedData = opts && 'bufferedData' in opts ? opts.bufferedData : null;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      let onBadCertificate = opts && 'onBadCertificate' in opts ? opts.onBadCertificate : null;
+      let supportedProtocols = opts && 'supportedProtocols' in opts ? opts.supportedProtocols : null;
+      io._RawSecureSocket._verifyFields(host, requestedPort, is_server, requestClientCertificate, requireClientCertificate, onBadCertificate);
+      if (io.InternetAddress.is(host)) host = dart.dload(host, 'host');
+      let address = socket.address;
+      if (host != null) {
+        address = io.InternetAddress._cloneWithNewHost(address, core.String._check(host));
+      }
+      return new io._RawSecureSocket(address, requestedPort, is_server, context, socket, StreamSubscriptionOfRawSocketEvent()._check(subscription), bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols)[_handshakeComplete].future;
+    }
+    new(address, requestedPort, is_server, context, socket, socketSubscription, bufferedData, requestClientCertificate, requireClientCertificate, onBadCertificate, supportedProtocols) {
+      this[_handshakeComplete] = CompleterOf_RawSecureSocket().new();
+      this[_status] = io._RawSecureSocket.HANDSHAKE;
+      this[_closeCompleter] = async.Completer.new();
+      this[_filterStatus] = new io._FilterStatus();
+      this[_secureFilter] = io._SecureFilter.new();
+      this.address = address;
+      this.is_server = is_server;
+      this.context = context;
+      this[_socket] = socket;
+      this[_socketSubscription] = socketSubscription;
+      this[_bufferedData] = bufferedData;
+      this.requestClientCertificate = requestClientCertificate;
+      this.requireClientCertificate = requireClientCertificate;
+      this.onBadCertificate = onBadCertificate;
+      this[_controller$0] = null;
+      this[_stream$] = null;
+      this[_bufferedDataIndex] = 0;
+      this[_writeEventsEnabled] = true;
+      this[_readEventsEnabled] = true;
+      this[_pauseCount$] = 0;
+      this[_pendingReadEvent] = false;
+      this[_socketClosedRead] = false;
+      this[_socketClosedWrite] = false;
+      this[_closedRead] = false;
+      this[_closedWrite] = false;
+      this[_connectPending] = true;
+      this[_filterPending] = false;
+      this[_filterActive] = false;
+      this[_selectedProtocol] = null;
+      super.new();
+      if (this.context == null) {
+        this.context = io.SecurityContext.defaultContext;
+      }
+      this[_controller$0] = StreamControllerOfRawSocketEvent().new({sync: true, onListen: dart.bind(this, _onSubscriptionStateChange), onPause: dart.bind(this, _onPauseStateChange), onResume: dart.bind(this, _onPauseStateChange), onCancel: dart.bind(this, _onSubscriptionStateChange)});
+      this[_stream$] = this[_controller$0].stream;
+      this[_secureFilter].init();
+      this[_secureFilter].registerHandshakeCompleteCallback(dart.bind(this, _secureHandshakeCompleteHandler));
+      if (this.onBadCertificate != null) {
+        this[_secureFilter].registerBadCertificateCallback(dart.bind(this, _onBadCertificateWrapper));
+      }
+      this[_socket].readEventsEnabled = true;
+      this[_socket].writeEventsEnabled = false;
+      if (this[_socketSubscription] == null) {
+        this[_socketSubscription] = this[_socket].listen(dart.bind(this, _eventDispatcher), {onError: dart.bind(this, _reportError), onDone: dart.bind(this, _doneHandler)});
+      } else {
+        if (dart.test(this[_socketSubscription].isPaused)) {
+          this[_socket].close();
+          dart.throw(new core.ArgumentError("Subscription passed to TLS upgrade is paused"));
+        }
+        let s = this[_socket];
+        if (dart.test(dart.dload(dart.dload(s, _socket), 'closedReadEventSent'))) {
+          this[_eventDispatcher](io.RawSocketEvent.READ_CLOSED);
+        }
+        let _ = this[_socketSubscription];
+        _.onData(dart.bind(this, _eventDispatcher));
+        _.onError(dart.bind(this, _reportError));
+        _.onDone(dart.bind(this, _doneHandler));
+      }
+      try {
+        let encodedProtocols = io.SecurityContext._protocolsToLengthEncoding(supportedProtocols);
+        this[_secureFilter].connect(this.address.host, this.context, this.is_server, dart.test(this.requestClientCertificate) || dart.test(this.requireClientCertificate), this.requireClientCertificate, encodedProtocols);
+        this[_secureHandshake]();
+      } catch (e) {
+        let s = dart.stackTrace(e);
+        this[_reportError](e, s);
+      }
+
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      this[_sendWriteEvent]();
+      return this[_stream$].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    static _verifyFields(host, requestedPort, is_server, requestClientCertificate, requireClientCertificate, onBadCertificate) {
+      if (!(typeof host == 'string') && !io.InternetAddress.is(host)) {
+        dart.throw(new core.ArgumentError("host is not a String or an InternetAddress"));
+      }
+      if (!(typeof requestedPort == 'number')) {
+        dart.throw(new core.ArgumentError("requestedPort is not an int"));
+      }
+      if (dart.notNull(requestedPort) < 0 || dart.notNull(requestedPort) > 65535) {
+        dart.throw(new core.ArgumentError("requestedPort is not in the range 0..65535"));
+      }
+      if (!(typeof requestClientCertificate == 'boolean')) {
+        dart.throw(new core.ArgumentError("requestClientCertificate is not a bool"));
+      }
+      if (!(typeof requireClientCertificate == 'boolean')) {
+        dart.throw(new core.ArgumentError("requireClientCertificate is not a bool"));
+      }
+      if (onBadCertificate != null && !core.Function.is(onBadCertificate)) {
+        dart.throw(new core.ArgumentError("onBadCertificate is not null or a Function"));
+      }
+    }
+    get port() {
+      return this[_socket].port;
+    }
+    get remoteAddress() {
+      return this[_socket].remoteAddress;
+    }
+    get remotePort() {
+      return this[_socket].remotePort;
+    }
+    set [_owner](owner) {
+      dart.dput(this[_socket], _owner, owner);
+    }
+    available() {
+      return this[_status] != io._RawSecureSocket.CONNECTED ? 0 : this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).length;
+    }
+    close() {
+      this.shutdown(io.SocketDirection.BOTH);
+      return FutureOfRawSecureSocket()._check(this[_closeCompleter].future);
+    }
+    [_completeCloseCompleter](dummy) {
+      if (dummy === void 0) dummy = null;
+      if (!dart.test(this[_closeCompleter].isCompleted)) this[_closeCompleter].complete(this);
+    }
+    [_close$0]() {
+      this[_closedWrite] = true;
+      this[_closedRead] = true;
+      if (this[_socket] != null) {
+        this[_socket].close().then(dart.void)(dart.bind(this, _completeCloseCompleter));
+      } else {
+        this[_completeCloseCompleter]();
+      }
+      this[_socketClosedWrite] = true;
+      this[_socketClosedRead] = true;
+      if (!dart.test(this[_filterActive]) && this[_secureFilter] != null) {
+        this[_secureFilter].destroy();
+        this[_secureFilter] = null;
+      }
+      if (this[_socketSubscription] != null) {
+        this[_socketSubscription].cancel();
+      }
+      this[_controller$0].close();
+      this[_status] = io._RawSecureSocket.CLOSED;
+    }
+    shutdown(direction) {
+      if (dart.equals(direction, io.SocketDirection.SEND) || dart.equals(direction, io.SocketDirection.BOTH)) {
+        this[_closedWrite] = true;
+        if (dart.test(this[_filterStatus].writeEmpty)) {
+          this[_socket].shutdown(io.SocketDirection.SEND);
+          this[_socketClosedWrite] = true;
+          if (dart.test(this[_closedRead])) {
+            this[_close$0]();
+          }
+        }
+      }
+      if (dart.equals(direction, io.SocketDirection.RECEIVE) || dart.equals(direction, io.SocketDirection.BOTH)) {
+        this[_closedRead] = true;
+        this[_socketClosedRead] = true;
+        this[_socket].shutdown(io.SocketDirection.RECEIVE);
+        if (dart.test(this[_socketClosedWrite])) {
+          this[_close$0]();
+        }
+      }
+    }
+    get writeEventsEnabled() {
+      return this[_writeEventsEnabled];
+    }
+    set writeEventsEnabled(value) {
+      this[_writeEventsEnabled] = value;
+      if (dart.test(value)) {
+        async.Timer.run(dart.fn(() => this[_sendWriteEvent](), VoidTovoid$()));
+      }
+    }
+    get readEventsEnabled() {
+      return this[_readEventsEnabled];
+    }
+    set readEventsEnabled(value) {
+      this[_readEventsEnabled] = value;
+      this[_scheduleReadEvent]();
+    }
+    read(length) {
+      if (length === void 0) length = null;
+      if (length != null && (!(typeof length == 'number') || dart.notNull(length) < 0)) {
+        dart.throw(new core.ArgumentError(dart.str`Invalid length parameter in SecureSocket.read (length: ${length})`));
+      }
+      if (dart.test(this[_closedRead])) {
+        dart.throw(new io.SocketException("Reading from a closed socket"));
+      }
+      if (this[_status] != io._RawSecureSocket.CONNECTED) {
+        return null;
+      }
+      let result = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).read(length);
+      this[_scheduleFilter]();
+      return result;
+    }
+    write(data, offset, bytes) {
+      if (offset === void 0) offset = null;
+      if (bytes === void 0) bytes = null;
+      if (bytes != null && (!(typeof bytes == 'number') || dart.notNull(bytes) < 0)) {
+        dart.throw(new core.ArgumentError(dart.str`Invalid bytes parameter in SecureSocket.read (bytes: ${bytes})`));
+      }
+      if (offset != null && (!(typeof offset == 'number') || dart.notNull(offset) < 0)) {
+        dart.throw(new core.ArgumentError(dart.str`Invalid offset parameter in SecureSocket.read (offset: ${offset})`));
+      }
+      if (dart.test(this[_closedWrite])) {
+        this[_controller$0].addError(new io.SocketException("Writing to a closed socket"));
+        return 0;
+      }
+      if (this[_status] != io._RawSecureSocket.CONNECTED) return 0;
+      if (offset == null) offset = 0;
+      if (bytes == null) bytes = dart.notNull(data[dartx.length]) - dart.notNull(offset);
+      let written = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).write(data, offset, bytes);
+      if (dart.notNull(written) > 0) {
+        this[_filterStatus].writeEmpty = false;
+      }
+      this[_scheduleFilter]();
+      return written;
+    }
+    get peerCertificate() {
+      return this[_secureFilter].peerCertificate;
+    }
+    get selectedProtocol() {
+      return this[_selectedProtocol];
+    }
+    [_onBadCertificateWrapper](certificate) {
+      if (this.onBadCertificate == null) return false;
+      let result = dart.dcall(this.onBadCertificate, certificate);
+      if (typeof result == 'boolean') return result;
+      dart.throw(new io.HandshakeException(dart.str`onBadCertificate callback returned non-boolean ${result}`));
+    }
+    setOption(option, enabled) {
+      if (this[_socket] == null) return false;
+      return this[_socket].setOption(option, enabled);
+    }
+    [_eventDispatcher](event) {
+      try {
+        if (dart.equals(event, io.RawSocketEvent.READ)) {
+          this[_readHandler]();
+        } else if (dart.equals(event, io.RawSocketEvent.WRITE)) {
+          this[_writeHandler]();
+        } else if (dart.equals(event, io.RawSocketEvent.READ_CLOSED)) {
+          this[_closeHandler]();
+        }
+      } catch (e) {
+        let stackTrace = dart.stackTrace(e);
+        this[_reportError](e, stackTrace);
+      }
+
+    }
+    [_readHandler]() {
+      this[_readSocket]();
+      this[_scheduleFilter]();
+    }
+    [_writeHandler]() {
+      this[_writeSocket]();
+      this[_scheduleFilter]();
+    }
+    [_doneHandler]() {
+      if (dart.test(this[_filterStatus].readEmpty)) {
+        this[_close$0]();
+      }
+    }
+    [_reportError](e, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      if (this[_status] == io._RawSecureSocket.CLOSED) {
+        return;
+      } else if (dart.test(this[_connectPending])) {
+        this[_handshakeComplete].completeError(e, stackTrace);
+      } else {
+        this[_controller$0].addError(e, stackTrace);
+      }
+      this[_close$0]();
+    }
+    [_closeHandler]() {
+      if (this[_status] == io._RawSecureSocket.CONNECTED) {
+        if (dart.test(this[_closedRead])) return;
+        this[_socketClosedRead] = true;
+        if (dart.test(this[_filterStatus].readEmpty)) {
+          this[_closedRead] = true;
+          this[_controller$0].add(io.RawSocketEvent.READ_CLOSED);
+          if (dart.test(this[_socketClosedWrite])) {
+            this[_close$0]();
+          }
+        } else {
+          this[_scheduleFilter]();
+        }
+      } else if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+        this[_socketClosedRead] = true;
+        if (dart.test(this[_filterStatus].readEmpty)) {
+          this[_reportError](new io.HandshakeException('Connection terminated during handshake'), null);
+        } else {
+          this[_secureHandshake]();
+        }
+      }
+    }
+    [_secureHandshake]() {
+      try {
+        this[_secureFilter].handshake();
+        this[_filterStatus].writeEmpty = false;
+        this[_readSocket]();
+        this[_writeSocket]();
+        this[_scheduleFilter]();
+      } catch (e) {
+        let stackTrace = dart.stackTrace(e);
+        this[_reportError](e, stackTrace);
+      }
+
+    }
+    renegotiate(opts) {
+      let useSessionCache = opts && 'useSessionCache' in opts ? opts.useSessionCache : true;
+      let requestClientCertificate = opts && 'requestClientCertificate' in opts ? opts.requestClientCertificate : false;
+      let requireClientCertificate = opts && 'requireClientCertificate' in opts ? opts.requireClientCertificate : false;
+      if (this[_status] != io._RawSecureSocket.CONNECTED) {
+        dart.throw(new io.HandshakeException("Called renegotiate on a non-connected socket"));
+      }
+      this[_secureFilter].renegotiate(useSessionCache, requestClientCertificate, requireClientCertificate);
+      this[_status] = io._RawSecureSocket.HANDSHAKE;
+      this[_filterStatus].writeEmpty = false;
+      this[_scheduleFilter]();
+    }
+    [_secureHandshakeCompleteHandler]() {
+      this[_status] = io._RawSecureSocket.CONNECTED;
+      if (dart.test(this[_connectPending])) {
+        this[_connectPending] = false;
+        try {
+          this[_selectedProtocol] = this[_secureFilter].selectedProtocol();
+          async.Timer.run(dart.fn(() => this[_handshakeComplete].complete(this), VoidTovoid$()));
+        } catch (error) {
+          let stack = dart.stackTrace(error);
+          this[_handshakeComplete].completeError(error, stack);
+        }
+
+      }
+    }
+    [_onPauseStateChange]() {
+      if (dart.test(this[_controller$0].isPaused)) {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) + 1;
+      } else {
+        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) - 1;
+        if (this[_pauseCount$] == 0) {
+          this[_scheduleReadEvent]();
+          this[_sendWriteEvent]();
+        }
+      }
+      if (!dart.test(this[_socketClosedRead]) || !dart.test(this[_socketClosedWrite])) {
+        if (dart.test(this[_controller$0].isPaused)) {
+          this[_socketSubscription].pause();
+        } else {
+          this[_socketSubscription].resume();
+        }
+      }
+    }
+    [_onSubscriptionStateChange]() {
+      if (dart.test(this[_controller$0].hasListener)) {
+      }
+    }
+    [_scheduleFilter]() {
+      this[_filterPending] = true;
+      this[_tryFilter]();
+    }
+    [_tryFilter]() {
+      if (this[_status] == io._RawSecureSocket.CLOSED) {
+        return;
+      }
+      if (dart.test(this[_filterPending]) && !dart.test(this[_filterActive])) {
+        this[_filterActive] = true;
+        this[_filterPending] = false;
+        this[_pushAllFilterStages]().then(dart.dynamic)(dart.fn(status => {
+          this[_filterStatus] = status;
+          this[_filterActive] = false;
+          if (this[_status] == io._RawSecureSocket.CLOSED) {
+            this[_secureFilter].destroy();
+            this[_secureFilter] = null;
+            return;
+          }
+          this[_socket].readEventsEnabled = true;
+          if (dart.test(this[_filterStatus].writeEmpty) && dart.test(this[_closedWrite]) && !dart.test(this[_socketClosedWrite])) {
+            this.shutdown(io.SocketDirection.SEND);
+            if (this[_status] == io._RawSecureSocket.CLOSED) {
+              return;
+            }
+          }
+          if (dart.test(this[_filterStatus].readEmpty) && dart.test(this[_socketClosedRead]) && !dart.test(this[_closedRead])) {
+            if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+              this[_secureFilter].handshake();
+              if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+                dart.throw(new io.HandshakeException('Connection terminated during handshake'));
+              }
+            }
+            this[_closeHandler]();
+          }
+          if (this[_status] == io._RawSecureSocket.CLOSED) {
+            return;
+          }
+          if (dart.test(this[_filterStatus].progress)) {
+            this[_filterPending] = true;
+            if (dart.test(this[_filterStatus].writeEncryptedNoLongerEmpty)) {
+              this[_writeSocket]();
+            }
+            if (dart.test(this[_filterStatus].writePlaintextNoLongerFull)) {
+              this[_sendWriteEvent]();
+            }
+            if (dart.test(this[_filterStatus].readEncryptedNoLongerFull)) {
+              this[_readSocket]();
+            }
+            if (dart.test(this[_filterStatus].readPlaintextNoLongerEmpty)) {
+              this[_scheduleReadEvent]();
+            }
+            if (this[_status] == io._RawSecureSocket.HANDSHAKE) {
+              this[_secureHandshake]();
+            }
+          }
+          this[_tryFilter]();
+        }, _FilterStatusToNull())).catchError(dart.bind(this, _reportError));
+      }
+    }
+    [_readSocketOrBufferedData](bytes) {
+      if (this[_bufferedData] != null) {
+        if (dart.notNull(bytes) > dart.notNull(this[_bufferedData][dartx.length]) - dart.notNull(this[_bufferedDataIndex])) {
+          bytes = dart.notNull(this[_bufferedData][dartx.length]) - dart.notNull(this[_bufferedDataIndex]);
+        }
+        let result = this[_bufferedData][dartx.sublist](this[_bufferedDataIndex], dart.notNull(this[_bufferedDataIndex]) + dart.notNull(bytes));
+        this[_bufferedDataIndex] = dart.notNull(this[_bufferedDataIndex]) + dart.notNull(bytes);
+        if (this[_bufferedData][dartx.length] == this[_bufferedDataIndex]) {
+          this[_bufferedData] = null;
+        }
+        return result;
+      } else if (!dart.test(this[_socketClosedRead])) {
+        return this[_socket].read(bytes);
+      } else {
+        return null;
+      }
+    }
+    [_readSocket]() {
+      if (this[_status] == io._RawSecureSocket.CLOSED) return;
+      let buffer = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_ENCRYPTED);
+      if (dart.notNull(buffer.writeFromSource(dart.bind(this, _readSocketOrBufferedData))) > 0) {
+        this[_filterStatus].readEmpty = false;
+      } else {
+        this[_socket].readEventsEnabled = false;
+      }
+    }
+    [_writeSocket]() {
+      if (dart.test(this[_socketClosedWrite])) return;
+      let buffer = this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_ENCRYPTED);
+      if (dart.test(buffer.readToSocket(this[_socket]))) {
+        this[_socket].writeEventsEnabled = true;
+      }
+    }
+    [_scheduleReadEvent]() {
+      if (!dart.test(this[_pendingReadEvent]) && dart.test(this[_readEventsEnabled]) && this[_pauseCount$] == 0 && this[_secureFilter] != null && !dart.test(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).isEmpty)) {
+        this[_pendingReadEvent] = true;
+        async.Timer.run(dart.bind(this, _sendReadEvent));
+      }
+    }
+    [_sendReadEvent]() {
+      this[_pendingReadEvent] = false;
+      if (this[_status] != io._RawSecureSocket.CLOSED && dart.test(this[_readEventsEnabled]) && this[_pauseCount$] == 0 && this[_secureFilter] != null && !dart.test(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.READ_PLAINTEXT).isEmpty)) {
+        this[_controller$0].add(io.RawSocketEvent.READ);
+        this[_scheduleReadEvent]();
+      }
+    }
+    [_sendWriteEvent]() {
+      if (!dart.test(this[_closedWrite]) && dart.test(this[_writeEventsEnabled]) && this[_pauseCount$] == 0 && this[_secureFilter] != null && dart.notNull(this[_secureFilter].buffers[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).free) > 0) {
+        this[_writeEventsEnabled] = false;
+        this[_controller$0].add(io.RawSocketEvent.WRITE);
+      }
+    }
+    [_pushAllFilterStages]() {
+      let wasInHandshake = this[_status] != io._RawSecureSocket.CONNECTED;
+      let args = core.List.new(2 + dart.notNull(io._RawSecureSocket.NUM_BUFFERS) * 2);
+      args[dartx._set](0, this[_secureFilter][_pointer]());
+      args[dartx._set](1, wasInHandshake);
+      let bufs = this[_secureFilter].buffers;
+      for (let i = 0; i < dart.notNull(io._RawSecureSocket.NUM_BUFFERS); ++i) {
+        args[dartx._set](2 * i + 2, bufs[dartx._get](i).start);
+        args[dartx._set](2 * i + 3, bufs[dartx._get](i).end);
+      }
+      return io._IOService._dispatch(io._SSL_PROCESS_FILTER, args).then(io._FilterStatus)(dart.fn(response => {
+        if (dart.equals(dart.dload(response, 'length'), 2)) {
+          if (wasInHandshake) {
+            this[_reportError](new io.HandshakeException(dart.str`${dart.dindex(response, 1)} error ${dart.dindex(response, 0)}`), null);
+          } else {
+            this[_reportError](new io.TlsException(dart.str`${dart.dindex(response, 1)} error ${dart.dindex(response, 0)}`), null);
+          }
+        }
+        function start(index) {
+          return core.int._check(dart.dindex(response, 2 * dart.notNull(index)));
+        }
+        dart.fn(start, intToint());
+        function end(index) {
+          return core.int._check(dart.dindex(response, 2 * dart.notNull(index) + 1));
+        }
+        dart.fn(end, intToint());
+        let status = new io._FilterStatus();
+        status.writeEmpty = dart.test(bufs[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT).isEmpty) && start(io._RawSecureSocket.WRITE_ENCRYPTED) == end(io._RawSecureSocket.WRITE_ENCRYPTED);
+        if (wasInHandshake) status.writeEmpty = false;
+        status.readEmpty = dart.test(bufs[dartx._get](io._RawSecureSocket.READ_ENCRYPTED).isEmpty) && start(io._RawSecureSocket.READ_PLAINTEXT) == end(io._RawSecureSocket.READ_PLAINTEXT);
+        let buffer = bufs[dartx._get](io._RawSecureSocket.WRITE_PLAINTEXT);
+        let new_start = start(io._RawSecureSocket.WRITE_PLAINTEXT);
+        if (new_start != buffer.start) {
+          status.progress = true;
+          if (buffer.free == 0) {
+            status.writePlaintextNoLongerFull = true;
+          }
+          buffer.start = new_start;
+        }
+        buffer = bufs[dartx._get](io._RawSecureSocket.READ_ENCRYPTED);
+        new_start = start(io._RawSecureSocket.READ_ENCRYPTED);
+        if (new_start != buffer.start) {
+          status.progress = true;
+          if (buffer.free == 0) {
+            status.readEncryptedNoLongerFull = true;
+          }
+          buffer.start = new_start;
+        }
+        buffer = bufs[dartx._get](io._RawSecureSocket.WRITE_ENCRYPTED);
+        let new_end = end(io._RawSecureSocket.WRITE_ENCRYPTED);
+        if (new_end != buffer.end) {
+          status.progress = true;
+          if (buffer.length == 0) {
+            status.writeEncryptedNoLongerEmpty = true;
+          }
+          buffer.end = new_end;
+        }
+        buffer = bufs[dartx._get](io._RawSecureSocket.READ_PLAINTEXT);
+        new_end = end(io._RawSecureSocket.READ_PLAINTEXT);
+        if (new_end != buffer.end) {
+          status.progress = true;
+          if (buffer.length == 0) {
+            status.readPlaintextNoLongerEmpty = true;
+          }
+          buffer.end = new_end;
+        }
+        return status;
+      }, dynamicTo_FilterStatus()));
+    }
+  };
+  dart.addSimpleTypeTests(io._RawSecureSocket);
+  io._RawSecureSocket[dart.implements] = () => [io.RawSecureSocket];
+  dart.setSignature(io._RawSecureSocket, {
+    constructors: () => ({new: dart.definiteFunctionType(io._RawSecureSocket, [io.InternetAddress, core.int, core.bool, io.SecurityContext, io.RawSocket, StreamSubscriptionOfRawSocketEvent(), ListOfint(), core.bool, core.bool, X509CertificateTodynamic(), ListOfString()])}),
+    fields: () => ({
+      [_socket]: io.RawSocket,
+      [_handshakeComplete]: CompleterOf_RawSecureSocket(),
+      [_controller$0]: StreamControllerOfRawSocketEvent(),
+      [_stream$]: StreamOfRawSocketEvent(),
+      [_socketSubscription]: StreamSubscriptionOfRawSocketEvent(),
+      [_bufferedData]: ListOfint(),
+      [_bufferedDataIndex]: core.int,
+      address: io.InternetAddress,
+      is_server: core.bool,
+      context: io.SecurityContext,
+      requestClientCertificate: core.bool,
+      requireClientCertificate: core.bool,
+      onBadCertificate: core.Function,
+      [_status]: core.int,
+      [_writeEventsEnabled]: core.bool,
+      [_readEventsEnabled]: core.bool,
+      [_pauseCount$]: core.int,
+      [_pendingReadEvent]: core.bool,
+      [_socketClosedRead]: core.bool,
+      [_socketClosedWrite]: core.bool,
+      [_closedRead]: core.bool,
+      [_closedWrite]: core.bool,
+      [_closeCompleter]: async.Completer,
+      [_filterStatus]: io._FilterStatus,
+      [_connectPending]: core.bool,
+      [_filterPending]: core.bool,
+      [_filterActive]: core.bool,
+      [_secureFilter]: io._SecureFilter,
+      [_selectedProtocol]: core.String
+    }),
+    getters: () => ({
+      port: dart.definiteFunctionType(core.int, []),
+      remoteAddress: dart.definiteFunctionType(io.InternetAddress, []),
+      remotePort: dart.definiteFunctionType(core.int, []),
+      writeEventsEnabled: dart.definiteFunctionType(core.bool, []),
+      readEventsEnabled: dart.definiteFunctionType(core.bool, []),
+      peerCertificate: dart.definiteFunctionType(io.X509Certificate, []),
+      selectedProtocol: dart.definiteFunctionType(core.String, [])
+    }),
+    setters: () => ({
+      [_owner]: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      writeEventsEnabled: dart.definiteFunctionType(dart.void, [core.bool]),
+      readEventsEnabled: dart.definiteFunctionType(dart.void, [core.bool])
+    }),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription$(io.RawSocketEvent), [RawSocketEventTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      available: dart.definiteFunctionType(core.int, []),
+      close: dart.definiteFunctionType(async.Future$(io.RawSecureSocket), []),
+      [_completeCloseCompleter]: dart.definiteFunctionType(dart.void, [], [dart.dynamic]),
+      [_close$0]: dart.definiteFunctionType(dart.void, []),
+      shutdown: dart.definiteFunctionType(dart.void, [io.SocketDirection]),
+      read: dart.definiteFunctionType(core.List$(core.int), [], [core.int]),
+      write: dart.definiteFunctionType(core.int, [ListOfint()], [core.int, core.int]),
+      [_onBadCertificateWrapper]: dart.definiteFunctionType(core.bool, [io.X509Certificate]),
+      setOption: dart.definiteFunctionType(core.bool, [io.SocketOption, core.bool]),
+      [_eventDispatcher]: dart.definiteFunctionType(dart.void, [io.RawSocketEvent]),
+      [_readHandler]: dart.definiteFunctionType(dart.void, []),
+      [_writeHandler]: dart.definiteFunctionType(dart.void, []),
+      [_doneHandler]: dart.definiteFunctionType(dart.void, []),
+      [_reportError]: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      [_closeHandler]: dart.definiteFunctionType(dart.void, []),
+      [_secureHandshake]: dart.definiteFunctionType(dart.void, []),
+      renegotiate: dart.definiteFunctionType(dart.void, [], {useSessionCache: core.bool, requestClientCertificate: core.bool, requireClientCertificate: core.bool}),
+      [_secureHandshakeCompleteHandler]: dart.definiteFunctionType(dart.void, []),
+      [_onPauseStateChange]: dart.definiteFunctionType(dart.void, []),
+      [_onSubscriptionStateChange]: dart.definiteFunctionType(dart.void, []),
+      [_scheduleFilter]: dart.definiteFunctionType(dart.void, []),
+      [_tryFilter]: dart.definiteFunctionType(dart.void, []),
+      [_readSocketOrBufferedData]: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+      [_readSocket]: dart.definiteFunctionType(dart.void, []),
+      [_writeSocket]: dart.definiteFunctionType(dart.void, []),
+      [_scheduleReadEvent]: dart.definiteFunctionType(dart.dynamic, []),
+      [_sendReadEvent]: dart.definiteFunctionType(dart.dynamic, []),
+      [_sendWriteEvent]: dart.definiteFunctionType(dart.dynamic, []),
+      [_pushAllFilterStages]: dart.definiteFunctionType(async.Future$(io._FilterStatus), [])
+    }),
+    sfields: () => ({
+      HANDSHAKE: core.int,
+      CONNECTED: core.int,
+      CLOSED: core.int,
+      READ_PLAINTEXT: core.int,
+      WRITE_PLAINTEXT: core.int,
+      READ_ENCRYPTED: core.int,
+      WRITE_ENCRYPTED: core.int,
+      NUM_BUFFERS: core.int
+    }),
+    statics: () => ({
+      _isBufferEncrypted: dart.definiteFunctionType(core.bool, [core.int]),
+      connect: dart.definiteFunctionType(async.Future$(io._RawSecureSocket), [dart.dynamic, core.int], {is_server: core.bool, context: io.SecurityContext, socket: io.RawSocket, subscription: async.StreamSubscription, bufferedData: ListOfint(), requestClientCertificate: core.bool, requireClientCertificate: core.bool, onBadCertificate: X509CertificateTobool(), supportedProtocols: ListOfString()}),
+      _verifyFields: dart.definiteFunctionType(dart.void, [dart.dynamic, core.int, core.bool, core.bool, core.bool, core.Function])
+    }),
+    names: ['_isBufferEncrypted', 'connect', '_verifyFields']
+  });
+  io._RawSecureSocket.HANDSHAKE = 201;
+  io._RawSecureSocket.CONNECTED = 202;
+  io._RawSecureSocket.CLOSED = 203;
+  io._RawSecureSocket.READ_PLAINTEXT = 0;
+  io._RawSecureSocket.WRITE_PLAINTEXT = 1;
+  io._RawSecureSocket.READ_ENCRYPTED = 2;
+  io._RawSecureSocket.WRITE_ENCRYPTED = 3;
+  io._RawSecureSocket.NUM_BUFFERS = 4;
+  io._ExternalBuffer = class _ExternalBuffer extends core.Object {
+    new(size) {
+      this.size = size;
+      this.data = null;
+      this.start = null;
+      this.end = null;
+      this.start = core.int._check(this.end = core.int._check(dart.dsend(this.size, '~/', 2)));
+    }
+    advanceStart(bytes) {
+      dart.assert(dart.notNull(this.start) > dart.notNull(this.end) || dart.notNull(this.start) + dart.notNull(bytes) <= dart.notNull(this.end));
+      this.start = dart.notNull(this.start) + dart.notNull(bytes);
+      if (dart.notNull(this.start) >= dart.notNull(core.num._check(this.size))) {
+        this.start = dart.notNull(this.start) - dart.notNull(core.num._check(this.size));
+        dart.assert(dart.notNull(this.start) <= dart.notNull(this.end));
+        dart.assert(dart.notNull(this.start) < dart.notNull(core.num._check(this.size)));
+      }
+    }
+    advanceEnd(bytes) {
+      dart.assert(dart.notNull(this.start) <= dart.notNull(this.end) || dart.notNull(this.start) > dart.notNull(this.end) + dart.notNull(bytes));
+      this.end = dart.notNull(this.end) + dart.notNull(bytes);
+      if (dart.notNull(this.end) >= dart.notNull(core.num._check(this.size))) {
+        this.end = dart.notNull(this.end) - dart.notNull(core.num._check(this.size));
+        dart.assert(dart.notNull(this.end) < dart.notNull(this.start));
+        dart.assert(dart.notNull(this.end) < dart.notNull(core.num._check(this.size)));
+      }
+    }
+    get isEmpty() {
+      return this.end == this.start;
+    }
+    get length() {
+      return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.dsend(dart.dsend(this.size, '+', this.end), '-', this.start) : dart.notNull(this.end) - dart.notNull(this.start));
+    }
+    get linearLength() {
+      return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.dsend(this.size, '-', this.start) : dart.notNull(this.end) - dart.notNull(this.start));
+    }
+    get free() {
+      return core.int._check(dart.notNull(this.start) > dart.notNull(this.end) ? dart.notNull(this.start) - dart.notNull(this.end) - 1 : dart.dsend(dart.dsend(dart.dsend(this.size, '+', this.start), '-', this.end), '-', 1));
+    }
+    get linearFree() {
+      if (dart.notNull(this.start) > dart.notNull(this.end)) return dart.notNull(this.start) - dart.notNull(this.end) - 1;
+      if (this.start == 0) return core.int._check(dart.dsend(dart.dsend(this.size, '-', this.end), '-', 1));
+      return core.int._check(dart.dsend(this.size, '-', this.end));
+    }
+    read(bytes) {
+      if (bytes == null) {
+        bytes = this.length;
+      } else {
+        bytes = math.min(core.int)(bytes, this.length);
+      }
+      if (bytes == 0) return null;
+      let result = typed_data.Uint8List.new(bytes);
+      let bytesRead = 0;
+      while (dart.notNull(bytesRead) < dart.notNull(bytes)) {
+        let toRead = math.min(core.int)(dart.notNull(bytes) - dart.notNull(bytesRead), this.linearLength);
+        result[dartx.setRange](bytesRead, dart.notNull(bytesRead) + dart.notNull(toRead), this.data, this.start);
+        this.advanceStart(toRead);
+        bytesRead = dart.notNull(bytesRead) + dart.notNull(toRead);
+      }
+      return result;
+    }
+    write(inputData, offset, bytes) {
+      if (dart.notNull(bytes) > dart.notNull(this.free)) {
+        bytes = this.free;
+      }
+      let written = 0;
+      let toWrite = math.min(core.int)(bytes, this.linearFree);
+      while (dart.notNull(toWrite) > 0) {
+        this.data[dartx.setRange](this.end, dart.notNull(this.end) + dart.notNull(toWrite), inputData, offset);
+        this.advanceEnd(toWrite);
+        offset = dart.notNull(offset) + dart.notNull(toWrite);
+        written = dart.notNull(written) + dart.notNull(toWrite);
+        toWrite = math.min(core.int)(dart.notNull(bytes) - dart.notNull(written), this.linearFree);
+      }
+      return written;
+    }
+    writeFromSource(getData) {
+      let written = 0;
+      let toWrite = this.linearFree;
+      while (dart.notNull(toWrite) > 0) {
+        let inputData = getData(toWrite);
+        if (inputData == null || inputData[dartx.length] == 0) break;
+        let len = inputData[dartx.length];
+        this.data[dartx.setRange](this.end, dart.notNull(this.end) + dart.notNull(len), inputData);
+        this.advanceEnd(len);
+        written = dart.notNull(written) + dart.notNull(len);
+        toWrite = this.linearFree;
+      }
+      return written;
+    }
+    readToSocket(socket) {
+      while (true) {
+        let toWrite = this.linearLength;
+        if (toWrite == 0) return false;
+        let bytes = socket.write(ListOfint()._check(this.data), this.start, toWrite);
+        this.advanceStart(bytes);
+        if (dart.notNull(bytes) < dart.notNull(toWrite)) {
+          return true;
+        }
+      }
+    }
+  };
+  dart.setSignature(io._ExternalBuffer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._ExternalBuffer, [dart.dynamic])}),
+    fields: () => ({
+      data: core.List,
+      start: core.int,
+      end: core.int,
+      size: dart.dynamic
+    }),
+    getters: () => ({
+      isEmpty: dart.definiteFunctionType(core.bool, []),
+      length: dart.definiteFunctionType(core.int, []),
+      linearLength: dart.definiteFunctionType(core.int, []),
+      free: dart.definiteFunctionType(core.int, []),
+      linearFree: dart.definiteFunctionType(core.int, [])
+    }),
+    methods: () => ({
+      advanceStart: dart.definiteFunctionType(dart.void, [core.int]),
+      advanceEnd: dart.definiteFunctionType(dart.void, [core.int]),
+      read: dart.definiteFunctionType(core.List$(core.int), [core.int]),
+      write: dart.definiteFunctionType(core.int, [ListOfint(), core.int, core.int]),
+      writeFromSource: dart.definiteFunctionType(core.int, [intToListOfint()]),
+      readToSocket: dart.definiteFunctionType(core.bool, [io.RawSocket])
+    })
+  });
+  io._SecureFilter = class _SecureFilter extends core.Object {
+    static new() {
+      dart.throw(new core.UnsupportedError("_SecureFilter._SecureFilter"));
+    }
+  };
+  dart.setSignature(io._SecureFilter, {
+    constructors: () => ({new: dart.definiteFunctionType(io._SecureFilter, [])})
+  });
+  io.TlsException = class TlsException extends core.Object {
+    new(message, osError) {
+      if (message === void 0) message = "";
+      if (osError === void 0) osError = null;
+      TlsException.prototype._.call(this, "TlsException", message, osError);
+    }
+    _(type, message, osError) {
+      this.type = type;
+      this.message = message;
+      this.osError = osError;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write(this.type);
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(dart.str`: ${this.message}`);
+        if (this.osError != null) {
+          sb.write(dart.str` (${this.osError})`);
+        }
+      } else if (this.osError != null) {
+        sb.write(dart.str`: ${this.osError}`);
+      }
+      return sb.toString();
+    }
+  };
+  dart.defineNamedConstructor(io.TlsException, '_');
+  io.TlsException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.TlsException, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.TlsException, [], [core.String, io.OSError]),
+      _: dart.definiteFunctionType(io.TlsException, [core.String, core.String, io.OSError])
+    }),
+    fields: () => ({
+      type: core.String,
+      message: core.String,
+      osError: io.OSError
+    })
+  });
+  io.HandshakeException = class HandshakeException extends io.TlsException {
+    new(message, osError) {
+      if (message === void 0) message = "";
+      if (osError === void 0) osError = null;
+      super._("HandshakeException", message, osError);
+    }
+  };
+  dart.setSignature(io.HandshakeException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.HandshakeException, [], [core.String, io.OSError])})
+  });
+  io.CertificateException = class CertificateException extends io.TlsException {
+    new(message, osError) {
+      if (message === void 0) message = "";
+      if (osError === void 0) osError = null;
+      super._("CertificateException", message, osError);
+    }
+  };
+  dart.setSignature(io.CertificateException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.CertificateException, [], [core.String, io.OSError])})
+  });
+  io.SecurityContext = class SecurityContext extends core.Object {
+    static new() {
+      dart.throw(new core.UnsupportedError("SecurityContext constructor"));
+    }
+    static get defaultContext() {
+      dart.throw(new core.UnsupportedError("default SecurityContext getter"));
+    }
+    static get alpnSupported() {
+      dart.throw(new core.UnsupportedError("SecurityContext alpnSupported getter"));
+    }
+    static _protocolsToLengthEncoding(protocols) {
+      if (protocols == null || protocols[dartx.length] == 0) {
+        return typed_data.Uint8List.new(0);
+      }
+      let protocolsLength = protocols[dartx.length];
+      let expectedLength = protocolsLength;
+      for (let i = 0; i < dart.notNull(protocolsLength); i++) {
+        let length = protocols[dartx._get](i)[dartx.length];
+        if (dart.notNull(length) > 0 && dart.notNull(length) <= 255) {
+          expectedLength = dart.notNull(expectedLength) + dart.notNull(length);
+        } else {
+          dart.throw(new core.ArgumentError(dart.str`Length of protocol must be between 1 and 255 (was: ${length}).`));
+        }
+      }
+      if (dart.notNull(expectedLength) >= 1 << 13) {
+        dart.throw(new core.ArgumentError('The maximum message length supported is 2^13-1.'));
+      }
+      let bytes = typed_data.Uint8List.new(expectedLength);
+      let bytesOffset = 0;
+      for (let i = 0; i < dart.notNull(protocolsLength); i++) {
+        let proto = protocols[dartx._get](i);
+        bytes[dartx._set](bytesOffset++, proto[dartx.length]);
+        let bits = 0;
+        for (let j = 0; j < dart.notNull(proto[dartx.length]); j++) {
+          let char = proto[dartx.codeUnitAt](j);
+          bits = (dart.notNull(bits) | dart.notNull(char)) >>> 0;
+          bytes[dartx._set](bytesOffset++, dart.notNull(char) & 255);
+        }
+        if (dart.notNull(bits) > 127) {
+          return io.SecurityContext._protocolsToLengthEncodingNonAsciiBailout(protocols);
+        }
+      }
+      return bytes;
+    }
+    static _protocolsToLengthEncodingNonAsciiBailout(protocols) {
+      function addProtocol(outBytes, protocol) {
+        let protocolBytes = convert.UTF8.encode(protocol);
+        let len = protocolBytes[dartx.length];
+        if (dart.notNull(len) > 255) {
+          dart.throw(new core.ArgumentError(dart.str`Length of protocol must be between 1 and 255 (was: ${len})`));
+        }
+        outBytes[dartx.add](len);
+        outBytes[dartx.addAll](protocolBytes);
+      }
+      dart.fn(addProtocol, ListOfintAndStringTovoid());
+      let bytes = JSArrayOfint().of([]);
+      for (let i = 0; i < dart.notNull(protocols[dartx.length]); i++) {
+        addProtocol(bytes, protocols[dartx._get](i));
+      }
+      if (dart.notNull(bytes[dartx.length]) >= 1 << 13) {
+        dart.throw(new core.ArgumentError('The maximum message length supported is 2^13-1.'));
+      }
+      return typed_data.Uint8List.fromList(bytes);
+    }
+  };
+  dart.setSignature(io.SecurityContext, {
+    constructors: () => ({new: dart.definiteFunctionType(io.SecurityContext, [])}),
+    sgetters: () => ({
+      defaultContext: dart.definiteFunctionType(io.SecurityContext, []),
+      alpnSupported: dart.definiteFunctionType(core.bool, [])
+    }),
+    statics: () => ({
+      _protocolsToLengthEncoding: dart.definiteFunctionType(typed_data.Uint8List, [ListOfString()]),
+      _protocolsToLengthEncodingNonAsciiBailout: dart.definiteFunctionType(typed_data.Uint8List, [ListOfString()])
+    }),
+    names: ['_protocolsToLengthEncoding', '_protocolsToLengthEncodingNonAsciiBailout']
+  });
+  io._nextServiceId = 1;
+  io.InternetAddressType = class InternetAddressType extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+    static _from(value) {
+      if (value == 0) return io.InternetAddressType.IP_V4;
+      if (value == 1) return io.InternetAddressType.IP_V6;
+      dart.throw(new core.ArgumentError(dart.str`Invalid type: ${value}`));
+    }
+    get name() {
+      switch (this[_value$1]) {
+        case -1:
+        {
+          return "ANY";
+        }
+        case 0:
+        {
+          return "IP_V4";
+        }
+        case 1:
+        {
+          return "IP_V6";
+        }
+        default:
+        {
+          dart.throw(new core.ArgumentError("Invalid InternetAddress"));
+        }
+      }
+    }
+    toString() {
+      return dart.str`InternetAddressType: ${this.name}`;
+    }
+  };
+  dart.defineNamedConstructor(io.InternetAddressType, '_');
+  dart.setSignature(io.InternetAddressType, {
+    constructors: () => ({
+      _: dart.definiteFunctionType(io.InternetAddressType, [core.int]),
+      _from: dart.definiteFunctionType(io.InternetAddressType, [core.int])
+    }),
+    fields: () => ({[_value$1]: core.int}),
+    getters: () => ({name: dart.definiteFunctionType(core.String, [])}),
+    sfields: () => ({
+      IP_V4: io.InternetAddressType,
+      IP_V6: io.InternetAddressType,
+      ANY: io.InternetAddressType
+    })
+  });
+  dart.defineLazy(io.InternetAddressType, {
+    get IP_V4() {
+      return dart.const(new io.InternetAddressType._(0));
+    },
+    get IP_V6() {
+      return dart.const(new io.InternetAddressType._(1));
+    },
+    get ANY() {
+      return dart.const(new io.InternetAddressType._(-1));
+    }
+  });
+  io.InternetAddress = class InternetAddress extends core.Object {
+    static get LOOPBACK_IP_V4() {
+      dart.throw(new core.UnsupportedError("InternetAddress.LOOPBACK_IP_V4"));
+    }
+    static get LOOPBACK_IP_V6() {
+      dart.throw(new core.UnsupportedError("InternetAddress.LOOPBACK_IP_V6"));
+    }
+    static get ANY_IP_V4() {
+      dart.throw(new core.UnsupportedError("InternetAddress.ANY_IP_V4"));
+    }
+    static get ANY_IP_V6() {
+      dart.throw(new core.UnsupportedError("InternetAddress.ANY_IP_V6"));
+    }
+    static new(address) {
+      dart.throw(new core.UnsupportedError("InternetAddress"));
+    }
+    static lookup(host, opts) {
+      let type = opts && 'type' in opts ? opts.type : io.InternetAddressType.ANY;
+      dart.throw(new core.UnsupportedError("InternetAddress.lookup"));
+    }
+    static _cloneWithNewHost(address, host) {
+      dart.throw(new core.UnsupportedError("InternetAddress._cloneWithNewHost"));
+    }
+  };
+  dart.setSignature(io.InternetAddress, {
+    constructors: () => ({new: dart.definiteFunctionType(io.InternetAddress, [core.String])}),
+    fields: () => ({type: io.InternetAddressType}),
+    sgetters: () => ({
+      LOOPBACK_IP_V4: dart.definiteFunctionType(io.InternetAddress, []),
+      LOOPBACK_IP_V6: dart.definiteFunctionType(io.InternetAddress, []),
+      ANY_IP_V4: dart.definiteFunctionType(io.InternetAddress, []),
+      ANY_IP_V6: dart.definiteFunctionType(io.InternetAddress, [])
+    }),
+    statics: () => ({
+      lookup: dart.definiteFunctionType(async.Future$(core.List$(io.InternetAddress)), [core.String], {type: io.InternetAddressType}),
+      _cloneWithNewHost: dart.definiteFunctionType(io.InternetAddress, [io.InternetAddress, core.String])
+    }),
+    names: ['lookup', '_cloneWithNewHost']
+  });
+  io.NetworkInterface = class NetworkInterface extends core.Object {
+    static get listSupported() {
+      dart.throw(new core.UnsupportedError("NetworkInterface.listSupported"));
+    }
+    static list(opts) {
+      let includeLoopback = opts && 'includeLoopback' in opts ? opts.includeLoopback : false;
+      let includeLinkLocal = opts && 'includeLinkLocal' in opts ? opts.includeLinkLocal : false;
+      let type = opts && 'type' in opts ? opts.type : io.InternetAddressType.ANY;
+      dart.throw(new core.UnsupportedError("NetworkInterface.list"));
+    }
+  };
+  dart.setSignature(io.NetworkInterface, {
+    sgetters: () => ({listSupported: dart.definiteFunctionType(core.bool, [])}),
+    statics: () => ({list: dart.definiteFunctionType(async.Future$(core.List$(io.NetworkInterface)), [], {includeLoopback: core.bool, includeLinkLocal: core.bool, type: io.InternetAddressType})}),
+    names: ['list']
+  });
+  io.RawServerSocket = class RawServerSocket extends core.Object {
+    static bind(address, port, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      dart.throw(new core.UnsupportedError("RawServerSocket.bind"));
+    }
+  };
+  io.RawServerSocket[dart.implements] = () => [StreamOfRawSocket()];
+  dart.setSignature(io.RawServerSocket, {
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawServerSocket), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool})}),
+    names: ['bind']
+  });
+  io.ServerSocket = class ServerSocket extends core.Object {
+    static bind(address, port, opts) {
+      let backlog = opts && 'backlog' in opts ? opts.backlog : 0;
+      let v6Only = opts && 'v6Only' in opts ? opts.v6Only : false;
+      let shared = opts && 'shared' in opts ? opts.shared : false;
+      dart.throw(new core.UnsupportedError("ServerSocket.bind"));
+    }
+  };
+  io.ServerSocket[dart.implements] = () => [StreamOfSocket()];
+  dart.setSignature(io.ServerSocket, {
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.ServerSocket), [dart.dynamic, core.int], {backlog: core.int, v6Only: core.bool, shared: core.bool})}),
+    names: ['bind']
+  });
+  io.SocketDirection = class SocketDirection extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+  };
+  dart.defineNamedConstructor(io.SocketDirection, '_');
+  dart.setSignature(io.SocketDirection, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SocketDirection, [dart.dynamic])}),
+    fields: () => ({[_value$1]: dart.dynamic}),
+    sfields: () => ({
+      RECEIVE: io.SocketDirection,
+      SEND: io.SocketDirection,
+      BOTH: io.SocketDirection
+    })
+  });
+  dart.defineLazy(io.SocketDirection, {
+    get RECEIVE() {
+      return dart.const(new io.SocketDirection._(0));
+    },
+    get SEND() {
+      return dart.const(new io.SocketDirection._(1));
+    },
+    get BOTH() {
+      return dart.const(new io.SocketDirection._(2));
+    }
+  });
+  io.SocketOption = class SocketOption extends core.Object {
+    _(value) {
+      this[_value$1] = value;
+    }
+  };
+  dart.defineNamedConstructor(io.SocketOption, '_');
+  dart.setSignature(io.SocketOption, {
+    constructors: () => ({_: dart.definiteFunctionType(io.SocketOption, [dart.dynamic])}),
+    fields: () => ({[_value$1]: dart.dynamic}),
+    sfields: () => ({
+      TCP_NODELAY: io.SocketOption,
+      _IP_MULTICAST_LOOP: io.SocketOption,
+      _IP_MULTICAST_HOPS: io.SocketOption,
+      _IP_MULTICAST_IF: io.SocketOption,
+      _IP_BROADCAST: io.SocketOption
+    })
+  });
+  dart.defineLazy(io.SocketOption, {
+    get TCP_NODELAY() {
+      return dart.const(new io.SocketOption._(0));
+    },
+    get _IP_MULTICAST_LOOP() {
+      return dart.const(new io.SocketOption._(1));
+    },
+    get _IP_MULTICAST_HOPS() {
+      return dart.const(new io.SocketOption._(2));
+    },
+    get _IP_MULTICAST_IF() {
+      return dart.const(new io.SocketOption._(3));
+    },
+    get _IP_BROADCAST() {
+      return dart.const(new io.SocketOption._(4));
+    }
+  });
+  io.RawSocket = class RawSocket extends core.Object {
+    new() {
+      this.readEventsEnabled = null;
+      this.writeEventsEnabled = null;
+    }
+    static connect(host, port, opts) {
+      let sourceAddress = opts && 'sourceAddress' in opts ? opts.sourceAddress : null;
+      dart.throw(new core.UnsupportedError("RawSocket constructor"));
+    }
+  };
+  io.RawSocket[dart.implements] = () => [StreamOfRawSocketEvent()];
+  dart.setSignature(io.RawSocket, {
+    fields: () => ({
+      readEventsEnabled: core.bool,
+      writeEventsEnabled: core.bool
+    }),
+    statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.RawSocket), [dart.dynamic, core.int], {sourceAddress: dart.dynamic})}),
+    names: ['connect']
+  });
+  io.Socket = class Socket extends core.Object {
+    static connect(host, port, opts) {
+      let sourceAddress = opts && 'sourceAddress' in opts ? opts.sourceAddress : null;
+      dart.throw(new core.UnsupportedError("Socket constructor"));
+    }
+  };
+  io.Socket[dart.implements] = () => [StreamOfListOfint(), io.IOSink];
+  dart.setSignature(io.Socket, {
+    statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.Socket), [dart.dynamic, core.int], {sourceAddress: dart.dynamic})}),
+    names: ['connect']
+  });
+  io.Datagram = class Datagram extends core.Object {
+    new(data, address, port) {
+      this.data = data;
+      this.address = address;
+      this.port = port;
+    }
+  };
+  dart.setSignature(io.Datagram, {
+    constructors: () => ({new: dart.definiteFunctionType(io.Datagram, [ListOfint(), io.InternetAddress, core.int])}),
+    fields: () => ({
+      data: ListOfint(),
+      address: io.InternetAddress,
+      port: core.int
+    })
+  });
+  io.RawDatagramSocket = class RawDatagramSocket extends async.Stream$(io.RawSocketEvent) {
+    new() {
+      this.readEventsEnabled = null;
+      this.writeEventsEnabled = null;
+      this.multicastLoopback = null;
+      this.multicastHops = null;
+      this.multicastInterface = null;
+      this.broadcastEnabled = null;
+      super.new();
+    }
+    static bind(host, port, opts) {
+      let reuseAddress = opts && 'reuseAddress' in opts ? opts.reuseAddress : true;
+      dart.throw(new core.UnsupportedError("RawDatagramSocket.bind"));
+    }
+  };
+  dart.addSimpleTypeTests(io.RawDatagramSocket);
+  dart.setSignature(io.RawDatagramSocket, {
+    fields: () => ({
+      readEventsEnabled: core.bool,
+      writeEventsEnabled: core.bool,
+      multicastLoopback: core.bool,
+      multicastHops: core.int,
+      multicastInterface: io.NetworkInterface,
+      broadcastEnabled: core.bool
+    }),
+    statics: () => ({bind: dart.definiteFunctionType(async.Future$(io.RawDatagramSocket), [dart.dynamic, core.int], {reuseAddress: core.bool})}),
+    names: ['bind']
+  });
+  io.SocketException = class SocketException extends core.Object {
+    new(message, opts) {
+      let osError = opts && 'osError' in opts ? opts.osError : null;
+      let address = opts && 'address' in opts ? opts.address : null;
+      let port = opts && 'port' in opts ? opts.port : null;
+      this.message = message;
+      this.osError = osError;
+      this.address = address;
+      this.port = port;
+    }
+    closed() {
+      this.message = 'Socket has been closed';
+      this.osError = null;
+      this.address = null;
+      this.port = null;
+    }
+    toString() {
+      let sb = new core.StringBuffer();
+      sb.write("SocketException");
+      if (!dart.test(this.message[dartx.isEmpty])) {
+        sb.write(dart.str`: ${this.message}`);
+        if (this.osError != null) {
+          sb.write(dart.str` (${this.osError})`);
+        }
+      } else if (this.osError != null) {
+        sb.write(dart.str`: ${this.osError}`);
+      }
+      if (this.address != null) {
+        sb.write(dart.str`, address = ${this.address.host}`);
+      }
+      if (this.port != null) {
+        sb.write(dart.str`, port = ${this.port}`);
+      }
+      return sb.toString();
+    }
+  };
+  dart.defineNamedConstructor(io.SocketException, 'closed');
+  io.SocketException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.SocketException, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.SocketException, [core.String], {osError: io.OSError, address: io.InternetAddress, port: core.int}),
+      closed: dart.definiteFunctionType(io.SocketException, [])
+    }),
+    fields: () => ({
+      message: core.String,
+      osError: io.OSError,
+      address: io.InternetAddress,
+      port: core.int
+    })
+  });
+  io._STDIO_HANDLE_TYPE_TERMINAL = 0;
+  io._STDIO_HANDLE_TYPE_PIPE = 1;
+  io._STDIO_HANDLE_TYPE_FILE = 2;
+  io._STDIO_HANDLE_TYPE_SOCKET = 3;
+  io._STDIO_HANDLE_TYPE_OTHER = 4;
+  io._StdStream = class _StdStream extends async.Stream$(core.List$(core.int)) {
+    new(stream) {
+      this[_stream$] = stream;
+      super.new();
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_stream$].listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+  };
+  dart.addSimpleTypeTests(io._StdStream);
+  dart.setSignature(io._StdStream, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StdStream, [StreamOfListOfint()])}),
+    fields: () => ({[_stream$]: StreamOfListOfint()}),
+    methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(core.List$(core.int)), [ListOfintTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
+  });
+  io.Stdin = class Stdin extends io._StdStream {
+    _(stream) {
+      super.new(stream);
+    }
+    readLineSync(opts) {
+      let encoding = opts && 'encoding' in opts ? opts.encoding : io.SYSTEM_ENCODING;
+      let retainNewlines = opts && 'retainNewlines' in opts ? opts.retainNewlines : false;
+      let CR = 13;
+      let LF = 10;
+      let line = [];
+      let crIsNewline = dart.test(io.Platform.isWindows) && dart.equals(io.stdioType(io.stdin), io.StdioType.TERMINAL) && !dart.test(/* Unimplemented unknown name */lineMode);
+      if (dart.test(retainNewlines)) {
+        let byte = null;
+        do {
+          byte = this.readByteSync();
+          if (dart.notNull(byte) < 0) {
+            break;
+          }
+          line[dartx.add](byte);
+        } while (byte != LF && !(byte == CR && crIsNewline));
+        if (dart.test(line[dartx.isEmpty])) {
+          return null;
+        }
+      } else if (crIsNewline) {
+        while (true) {
+          let byte = this.readByteSync();
+          if (dart.notNull(byte) < 0) {
+            if (dart.test(line[dartx.isEmpty])) return null;
+            break;
+          }
+          if (byte == LF || byte == CR) break;
+          line[dartx.add](byte);
+        }
+      } else {
+        outer:
+          while (true) {
+            let byte = this.readByteSync();
+            if (byte == LF) break;
+            if (byte == CR) {
+              do {
+                byte = this.readByteSync();
+                if (byte == LF) break outer;
+                line[dartx.add](CR);
+              } while (byte == CR);
+            }
+            if (dart.notNull(byte) < 0) {
+              if (dart.test(line[dartx.isEmpty])) return null;
+              break;
+            }
+            line[dartx.add](byte);
+          }
+      }
+      return encoding.decode(ListOfint()._check(line));
+    }
+    set echoMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.echoMode"));
+    }
+    set echoMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.echoMode"));
+    }
+    set lineMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.lineMode"));
+    }
+    set lineMode(enabled) {
+      dart.throw(new core.UnsupportedError("Stdin.lineMode"));
+    }
+    readByteSync() {
+      dart.throw(new core.UnsupportedError("Stdin.readByteSync"));
+    }
+  };
+  dart.defineNamedConstructor(io.Stdin, '_');
+  io.Stdin[dart.implements] = () => [StreamOfListOfint()];
+  dart.setSignature(io.Stdin, {
+    constructors: () => ({_: dart.definiteFunctionType(io.Stdin, [StreamOfListOfint()])}),
+    setters: () => ({
+      echoMode: dart.definiteFunctionType(dart.void, [core.bool]),
+      echoMode: dart.definiteFunctionType(dart.void, [core.bool]),
+      lineMode: dart.definiteFunctionType(dart.void, [core.bool]),
+      lineMode: dart.definiteFunctionType(dart.void, [core.bool])
+    }),
+    methods: () => ({
+      readLineSync: dart.definiteFunctionType(core.String, [], {encoding: convert.Encoding, retainNewlines: core.bool}),
+      readByteSync: dart.definiteFunctionType(core.int, [])
+    })
+  });
+  const _fd = Symbol('_fd');
+  const _nonBlocking = Symbol('_nonBlocking');
+  const _hasTerminal = Symbol('_hasTerminal');
+  const _terminalColumns = Symbol('_terminalColumns');
+  const _terminalLines = Symbol('_terminalLines');
+  io._StdSink = class _StdSink extends core.Object {
+    new(sink) {
+      this[_sink$0] = sink;
+    }
+    get encoding() {
+      return this[_sink$0].encoding;
+    }
+    set encoding(encoding) {
+      this[_sink$0].encoding = encoding;
+    }
+    write(object) {
+      this[_sink$0].write(object);
+    }
+    writeln(object) {
+      if (object === void 0) object = "";
+      this[_sink$0].writeln(object);
+    }
+    writeAll(objects, sep) {
+      if (sep === void 0) sep = "";
+      this[_sink$0].writeAll(objects, sep);
+    }
+    add(data) {
+      this[_sink$0].add(data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_sink$0].addError(error, stackTrace);
+    }
+    writeCharCode(charCode) {
+      this[_sink$0].writeCharCode(charCode);
+    }
+    addStream(stream) {
+      return this[_sink$0].addStream(stream);
+    }
+    flush() {
+      return this[_sink$0].flush();
+    }
+    close() {
+      return this[_sink$0].close();
+    }
+    get done() {
+      return this[_sink$0].done;
+    }
+  };
+  io._StdSink[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io._StdSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StdSink, [io.IOSink])}),
+    fields: () => ({[_sink$0]: io.IOSink}),
+    getters: () => ({
+      encoding: dart.definiteFunctionType(convert.Encoding, []),
+      done: dart.definiteFunctionType(async.Future, [])
+    }),
+    setters: () => ({encoding: dart.definiteFunctionType(dart.void, [convert.Encoding])}),
+    methods: () => ({
+      write: dart.definiteFunctionType(dart.void, [core.Object]),
+      writeln: dart.definiteFunctionType(dart.void, [], [core.Object]),
+      writeAll: dart.definiteFunctionType(dart.void, [core.Iterable], [core.String]),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      writeCharCode: dart.definiteFunctionType(dart.void, [core.int]),
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+      flush: dart.definiteFunctionType(async.Future, []),
+      close: dart.definiteFunctionType(async.Future, [])
+    })
+  });
+  io.Stdout = class Stdout extends io._StdSink {
+    _(sink, fd) {
+      this[_fd] = fd;
+      this[_nonBlocking] = null;
+      super.new(sink);
+    }
+    get hasTerminal() {
+      return this[_hasTerminal](this[_fd]);
+    }
+    get terminalColumns() {
+      return this[_terminalColumns](this[_fd]);
+    }
+    get terminalLines() {
+      return this[_terminalLines](this[_fd]);
+    }
+    [_hasTerminal](fd) {
+      dart.throw(new core.UnsupportedError("Stdout.hasTerminal"));
+    }
+    [_terminalColumns](fd) {
+      dart.throw(new core.UnsupportedError("Stdout.terminalColumns"));
+    }
+    [_terminalLines](fd) {
+      dart.throw(new core.UnsupportedError("Stdout.terminalLines"));
+    }
+    get nonBlocking() {
+      if (this[_nonBlocking] == null) {
+        this[_nonBlocking] = io.IOSink.new(new io._FileStreamConsumer.fromStdio(this[_fd]));
+      }
+      return this[_nonBlocking];
+    }
+  };
+  dart.defineNamedConstructor(io.Stdout, '_');
+  io.Stdout[dart.implements] = () => [io.IOSink];
+  dart.setSignature(io.Stdout, {
+    constructors: () => ({_: dart.definiteFunctionType(io.Stdout, [io.IOSink, core.int])}),
+    fields: () => ({
+      [_fd]: core.int,
+      [_nonBlocking]: io.IOSink
+    }),
+    getters: () => ({
+      hasTerminal: dart.definiteFunctionType(core.bool, []),
+      terminalColumns: dart.definiteFunctionType(core.int, []),
+      terminalLines: dart.definiteFunctionType(core.int, []),
+      nonBlocking: dart.definiteFunctionType(io.IOSink, [])
+    }),
+    methods: () => ({
+      [_hasTerminal]: dart.definiteFunctionType(core.bool, [core.int]),
+      [_terminalColumns]: dart.definiteFunctionType(core.int, [core.int]),
+      [_terminalLines]: dart.definiteFunctionType(core.int, [core.int])
+    })
+  });
+  io.StdoutException = class StdoutException extends core.Object {
+    new(message, osError) {
+      if (osError === void 0) osError = null;
+      this.message = message;
+      this.osError = osError;
+    }
+    toString() {
+      return dart.str`StdoutException: ${this.message}${this.osError == null ? "" : dart.str`, ${this.osError}`}`;
+    }
+  };
+  io.StdoutException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.StdoutException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.StdoutException, [core.String], [io.OSError])}),
+    fields: () => ({
+      message: core.String,
+      osError: io.OSError
+    })
+  });
+  io._StdConsumer = class _StdConsumer extends core.Object {
+    new(fd) {
+      this[_file] = io._File._openStdioSync(fd);
+    }
+    addStream(stream) {
+      let completer = async.Completer.new();
+      let sub = null;
+      sub = stream.listen(dart.fn(data => {
+        try {
+          dart.dsend(this[_file], 'writeFromSync', data);
+        } catch (e) {
+          let s = dart.stackTrace(e);
+          dart.dsend(sub, 'cancel');
+          completer.completeError(e, s);
+        }
+
+      }, ListOfintToNull()), {onError: dart.bind(completer, 'completeError'), onDone: dart.bind(completer, 'complete'), cancelOnError: true});
+      return completer.future;
+    }
+    close() {
+      dart.dsend(this[_file], 'closeSync');
+      return async.Future.value();
+    }
+  };
+  io._StdConsumer[dart.implements] = () => [StreamConsumerOfListOfint()];
+  dart.setSignature(io._StdConsumer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._StdConsumer, [core.int])}),
+    fields: () => ({[_file]: dart.dynamic}),
+    methods: () => ({
+      addStream: dart.definiteFunctionType(async.Future, [StreamOfListOfint()]),
+      close: dart.definiteFunctionType(async.Future, [])
+    })
+  });
+  io.StdioType = class StdioType extends core.Object {
+    _(name) {
+      this.name = name;
+    }
+    toString() {
+      return dart.str`StdioType: ${this.name}`;
+    }
+  };
+  dart.defineNamedConstructor(io.StdioType, '_');
+  dart.setSignature(io.StdioType, {
+    constructors: () => ({_: dart.definiteFunctionType(io.StdioType, [core.String])}),
+    fields: () => ({name: core.String}),
+    sfields: () => ({
+      TERMINAL: io.StdioType,
+      PIPE: io.StdioType,
+      FILE: io.StdioType,
+      OTHER: io.StdioType
+    })
+  });
+  dart.defineLazy(io.StdioType, {
+    get TERMINAL() {
+      return dart.const(new io.StdioType._("terminal"));
+    },
+    get PIPE() {
+      return dart.const(new io.StdioType._("pipe"));
+    },
+    get FILE() {
+      return dart.const(new io.StdioType._("file"));
+    },
+    get OTHER() {
+      return dart.const(new io.StdioType._("other"));
+    }
+  });
+  io._stdin = null;
+  io._stdout = null;
+  io._stderr = null;
+  dart.copyProperties(io, {
+    get stdin() {
+      if (io._stdin == null) {
+        io._stdin = io._StdIOUtils._getStdioInputStream();
+      }
+      return io._stdin;
+    }
+  });
+  dart.copyProperties(io, {
+    get stdout() {
+      if (io._stdout == null) {
+        io._stdout = io.Stdout._check(io._StdIOUtils._getStdioOutputStream(1));
+      }
+      return io._stdout;
+    }
+  });
+  dart.copyProperties(io, {
+    get stderr() {
+      if (io._stderr == null) {
+        io._stderr = io.Stdout._check(io._StdIOUtils._getStdioOutputStream(2));
+      }
+      return io._stderr;
+    }
+  });
+  io.stdioType = function(object) {
+    if (io._StdStream.is(object)) {
+      object = dart.dload(object, _stream$);
+    } else if (dart.equals(object, io.stdout) || dart.equals(object, io.stderr)) {
+      switch (io._StdIOUtils._getStdioHandleType(dart.equals(object, io.stdout) ? 1 : 2)) {
+        case io._STDIO_HANDLE_TYPE_TERMINAL:
+        {
+          return io.StdioType.TERMINAL;
+        }
+        case io._STDIO_HANDLE_TYPE_PIPE:
+        {
+          return io.StdioType.PIPE;
+        }
+        case io._STDIO_HANDLE_TYPE_FILE:
+        {
+          return io.StdioType.FILE;
+        }
+      }
+    }
+    if (io._FileStream.is(object)) {
+      return io.StdioType.FILE;
+    }
+    if (io.Socket.is(object)) {
+      let socketType = io._StdIOUtils._socketType(object);
+      if (socketType == null) return io.StdioType.OTHER;
+      switch (socketType) {
+        case io._STDIO_HANDLE_TYPE_TERMINAL:
+        {
+          return io.StdioType.TERMINAL;
+        }
+        case io._STDIO_HANDLE_TYPE_PIPE:
+        {
+          return io.StdioType.PIPE;
+        }
+        case io._STDIO_HANDLE_TYPE_FILE:
+        {
+          return io.StdioType.FILE;
+        }
+      }
+    }
+    if (io._IOSinkImpl.is(object)) {
+      try {
+        if (io._FileStreamConsumer.is(object[_target$])) {
+          return io.StdioType.FILE;
+        }
+      } catch (e) {
+      }
+
+    }
+    return io.StdioType.OTHER;
+  };
+  dart.fn(io.stdioType, dynamicToStdioType());
+  io._StdIOUtils = class _StdIOUtils extends core.Object {
+    static _getStdioOutputStream(fd) {
+      dart.throw(new core.UnsupportedError("StdIOUtils._getStdioOutputStream"));
+    }
+    static _getStdioInputStream() {
+      dart.throw(new core.UnsupportedError("StdIOUtils._getStdioInputStream"));
+    }
+    static _socketType(socket) {
+      dart.throw(new core.UnsupportedError("StdIOUtils._socketType"));
+    }
+    static _getStdioHandleType(fd) {
+      dart.throw(new core.UnsupportedError("StdIOUtils._getStdioHandleType"));
+    }
+  };
+  dart.setSignature(io._StdIOUtils, {
+    statics: () => ({
+      _getStdioOutputStream: dart.definiteFunctionType(dart.dynamic, [core.int]),
+      _getStdioInputStream: dart.definiteFunctionType(io.Stdin, []),
+      _socketType: dart.definiteFunctionType(core.int, [io.Socket]),
+      _getStdioHandleType: dart.definiteFunctionType(dart.dynamic, [core.int])
+    }),
+    names: ['_getStdioOutputStream', '_getStdioInputStream', '_socketType', '_getStdioHandleType']
+  });
+  let const$76;
+  let const$77;
+  let const$78;
+  let const$79;
+  io.SystemEncoding = class SystemEncoding extends convert.Encoding {
+    new() {
+      super.new();
+    }
+    get name() {
+      return 'system';
+    }
+    encode(input) {
+      return this.encoder.convert(input);
+    }
+    decode(encoded) {
+      return this.decoder.convert(encoded);
+    }
+    get encoder() {
+      if (io.Platform.operatingSystem == "windows") {
+        return const$76 || (const$76 = dart.const(new io._WindowsCodePageEncoder()));
+      } else {
+        return const$77 || (const$77 = dart.const(new convert.Utf8Encoder()));
+      }
+    }
+    get decoder() {
+      if (io.Platform.operatingSystem == "windows") {
+        return const$78 || (const$78 = dart.const(new io._WindowsCodePageDecoder()));
+      } else {
+        return const$79 || (const$79 = dart.const(new convert.Utf8Decoder()));
+      }
+    }
+  };
+  dart.setSignature(io.SystemEncoding, {
+    constructors: () => ({new: dart.definiteFunctionType(io.SystemEncoding, [])}),
+    getters: () => ({
+      name: dart.definiteFunctionType(core.String, []),
+      encoder: dart.definiteFunctionType(convert.Converter$(core.String, core.List$(core.int)), []),
+      decoder: dart.definiteFunctionType(convert.Converter$(core.List$(core.int), core.String), [])
+    })
+  });
+  io.SYSTEM_ENCODING = dart.const(new io.SystemEncoding());
+  io._WindowsCodePageEncoder = class _WindowsCodePageEncoder extends convert.Converter$(core.String, core.List$(core.int)) {
+    new() {
+      super.new();
+    }
+    convert(input) {
+      let encoded = io._WindowsCodePageEncoder._encodeString(input);
+      if (encoded == null) {
+        dart.throw(new core.FormatException("Invalid character for encoding"));
+      }
+      return encoded;
+    }
+    startChunkedConversion(sink) {
+      return new io._WindowsCodePageEncoderSink(sink);
+    }
+    static _encodeString(string) {
+      dart.throw(new core.UnsupportedError("_WindowsCodePageEncoder._encodeString"));
+    }
+  };
+  dart.addSimpleTypeTests(io._WindowsCodePageEncoder);
+  dart.setSignature(io._WindowsCodePageEncoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageEncoder, [])}),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.List$(core.int), [core.String]),
+      startChunkedConversion: dart.definiteFunctionType(convert.StringConversionSink, [SinkOfListOfint()])
+    }),
+    statics: () => ({_encodeString: dart.definiteFunctionType(core.List$(core.int), [core.String])}),
+    names: ['_encodeString']
+  });
+  io._WindowsCodePageEncoderSink = class _WindowsCodePageEncoderSink extends convert.StringConversionSinkBase {
+    new(sink) {
+      this[_sink$0] = sink;
+    }
+    close() {
+      this[_sink$0].close();
+    }
+    add(string) {
+      let encoded = io._WindowsCodePageEncoder._encodeString(string);
+      if (encoded == null) {
+        dart.throw(new core.FormatException("Invalid character for encoding"));
+      }
+      this[_sink$0].add(encoded);
+    }
+    addSlice(source, start, end, isLast) {
+      if (start != 0 || end != source[dartx.length]) {
+        source = source[dartx.substring](start, end);
+      }
+      this.add(source);
+      if (dart.test(isLast)) this.close();
+    }
+  };
+  dart.setSignature(io._WindowsCodePageEncoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageEncoderSink, [SinkOfListOfint()])}),
+    fields: () => ({[_sink$0]: SinkOfListOfint()}),
+    methods: () => ({
+      close: dart.definiteFunctionType(dart.void, []),
+      addSlice: dart.definiteFunctionType(dart.void, [core.String, core.int, core.int, core.bool])
+    })
+  });
+  io._WindowsCodePageDecoder = class _WindowsCodePageDecoder extends convert.Converter$(core.List$(core.int), core.String) {
+    new() {
+      super.new();
+    }
+    convert(input) {
+      return io._WindowsCodePageDecoder._decodeBytes(input);
+    }
+    startChunkedConversion(sink) {
+      return new io._WindowsCodePageDecoderSink(sink);
+    }
+    static _decodeBytes(bytes) {
+      dart.throw(new core.UnsupportedError("_WindowsCodePageDecoder._decodeBytes"));
+    }
+  };
+  dart.addSimpleTypeTests(io._WindowsCodePageDecoder);
+  dart.setSignature(io._WindowsCodePageDecoder, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageDecoder, [])}),
+    methods: () => ({
+      convert: dart.definiteFunctionType(core.String, [ListOfint()]),
+      startChunkedConversion: dart.definiteFunctionType(convert.ByteConversionSink, [SinkOfString()])
+    }),
+    statics: () => ({_decodeBytes: dart.definiteFunctionType(core.String, [ListOfint()])}),
+    names: ['_decodeBytes']
+  });
+  io._WindowsCodePageDecoderSink = class _WindowsCodePageDecoderSink extends convert.ByteConversionSinkBase {
+    new(sink) {
+      this[_sink$0] = sink;
+      super.new();
+    }
+    close() {
+      this[_sink$0].close();
+    }
+    add(bytes) {
+      this[_sink$0].add(io._WindowsCodePageDecoder._decodeBytes(bytes));
+    }
+  };
+  dart.setSignature(io._WindowsCodePageDecoderSink, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WindowsCodePageDecoderSink, [SinkOfString()])}),
+    fields: () => ({[_sink$0]: SinkOfString()}),
+    methods: () => ({
+      close: dart.definiteFunctionType(dart.void, []),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()])
+    })
+  });
+  io.WebSocketStatus = class WebSocketStatus extends core.Object {};
+  dart.setSignature(io.WebSocketStatus, {
+    sfields: () => ({
+      NORMAL_CLOSURE: core.int,
+      GOING_AWAY: core.int,
+      PROTOCOL_ERROR: core.int,
+      UNSUPPORTED_DATA: core.int,
+      RESERVED_1004: core.int,
+      NO_STATUS_RECEIVED: core.int,
+      ABNORMAL_CLOSURE: core.int,
+      INVALID_FRAME_PAYLOAD_DATA: core.int,
+      POLICY_VIOLATION: core.int,
+      MESSAGE_TOO_BIG: core.int,
+      MISSING_MANDATORY_EXTENSION: core.int,
+      INTERNAL_SERVER_ERROR: core.int,
+      RESERVED_1015: core.int
+    })
+  });
+  io.WebSocketStatus.NORMAL_CLOSURE = 1000;
+  io.WebSocketStatus.GOING_AWAY = 1001;
+  io.WebSocketStatus.PROTOCOL_ERROR = 1002;
+  io.WebSocketStatus.UNSUPPORTED_DATA = 1003;
+  io.WebSocketStatus.RESERVED_1004 = 1004;
+  io.WebSocketStatus.NO_STATUS_RECEIVED = 1005;
+  io.WebSocketStatus.ABNORMAL_CLOSURE = 1006;
+  io.WebSocketStatus.INVALID_FRAME_PAYLOAD_DATA = 1007;
+  io.WebSocketStatus.POLICY_VIOLATION = 1008;
+  io.WebSocketStatus.MESSAGE_TOO_BIG = 1009;
+  io.WebSocketStatus.MISSING_MANDATORY_EXTENSION = 1010;
+  io.WebSocketStatus.INTERNAL_SERVER_ERROR = 1011;
+  io.WebSocketStatus.RESERVED_1015 = 1015;
+  const _createServerResponseHeader = Symbol('_createServerResponseHeader');
+  const _createClientRequestHeader = Symbol('_createClientRequestHeader');
+  const _createHeader = Symbol('_createHeader');
+  io.CompressionOptions = class CompressionOptions extends core.Object {
+    new(opts) {
+      let clientNoContextTakeover = opts && 'clientNoContextTakeover' in opts ? opts.clientNoContextTakeover : false;
+      let serverNoContextTakeover = opts && 'serverNoContextTakeover' in opts ? opts.serverNoContextTakeover : false;
+      let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : null;
+      let serverMaxWindowBits = opts && 'serverMaxWindowBits' in opts ? opts.serverMaxWindowBits : null;
+      let enabled = opts && 'enabled' in opts ? opts.enabled : true;
+      this.clientNoContextTakeover = clientNoContextTakeover;
+      this.serverNoContextTakeover = serverNoContextTakeover;
+      this.clientMaxWindowBits = clientMaxWindowBits;
+      this.serverMaxWindowBits = serverMaxWindowBits;
+      this.enabled = enabled;
+    }
+    [_createServerResponseHeader](requested) {
+      let info = new io._CompressionMaxWindowBits();
+      let mwb = null;
+      let part = null;
+      if (dart.nullSafe(requested, _ => _.parameters) != null) {
+        part = requested.parameters[dartx._get](io._serverMaxWindowBits);
+      }
+      if (part != null) {
+        if (dart.notNull(part[dartx.length]) >= 2 && dart.test(part[dartx.startsWith]('0'))) {
+          dart.throw(new core.ArgumentError("Illegal 0 padding on value."));
+        } else {
+          mwb = this.serverMaxWindowBits == null ? core.int.parse(part, {onError: dart.fn(source => io._WebSocketImpl.DEFAULT_WINDOW_BITS, StringToint$())}) : this.serverMaxWindowBits;
+          info.headerValue = dart.str`; server_max_window_bits=${mwb}`;
+          info.maxWindowBits = mwb;
+        }
+      } else {
+        info.headerValue = "";
+        info.maxWindowBits = io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+      }
+      return info;
+    }
+    [_createClientRequestHeader](requested, size) {
+      let info = "";
+      if (requested != null) {
+        info = dart.str`; client_max_window_bits=${size}`;
+      } else {
+        if (this.clientMaxWindowBits == null) {
+          info = "; client_max_window_bits";
+        } else {
+          info = dart.str`; client_max_window_bits=${this.clientMaxWindowBits}`;
+        }
+        if (this.serverMaxWindowBits != null) {
+          info = info + dart.str`; server_max_window_bits=${this.serverMaxWindowBits}`;
+        }
+      }
+      return info;
+    }
+    [_createHeader](requested) {
+      if (requested === void 0) requested = null;
+      let info = new io._CompressionMaxWindowBits("", 0);
+      if (!dart.test(this.enabled)) {
+        return info;
+      }
+      info.headerValue = io._WebSocketImpl.PER_MESSAGE_DEFLATE;
+      if (dart.test(this.clientNoContextTakeover) && (requested == null || requested != null && dart.test(requested.parameters[dartx.containsKey](io._clientNoContextTakeover)))) {
+        info.headerValue = dart.notNull(info.headerValue) + "; client_no_context_takeover";
+      }
+      if (dart.test(this.serverNoContextTakeover) && (requested == null || requested != null && dart.test(requested.parameters[dartx.containsKey](io._serverNoContextTakeover)))) {
+        info.headerValue = dart.notNull(info.headerValue) + "; server_no_context_takeover";
+      }
+      let headerList = this[_createServerResponseHeader](requested);
+      info.headerValue = dart.notNull(info.headerValue) + dart.notNull(headerList.headerValue);
+      info.maxWindowBits = headerList.maxWindowBits;
+      info.headerValue = dart.notNull(info.headerValue) + dart.notNull(this[_createClientRequestHeader](requested, info.maxWindowBits));
+      return info;
+    }
+  };
+  dart.setSignature(io.CompressionOptions, {
+    constructors: () => ({new: dart.definiteFunctionType(io.CompressionOptions, [], {clientNoContextTakeover: core.bool, serverNoContextTakeover: core.bool, clientMaxWindowBits: core.int, serverMaxWindowBits: core.int, enabled: core.bool})}),
+    fields: () => ({
+      clientNoContextTakeover: core.bool,
+      serverNoContextTakeover: core.bool,
+      clientMaxWindowBits: core.int,
+      serverMaxWindowBits: core.int,
+      enabled: core.bool
+    }),
+    methods: () => ({
+      [_createServerResponseHeader]: dart.definiteFunctionType(io._CompressionMaxWindowBits, [io.HeaderValue]),
+      [_createClientRequestHeader]: dart.definiteFunctionType(core.String, [io.HeaderValue, core.int]),
+      [_createHeader]: dart.definiteFunctionType(io._CompressionMaxWindowBits, [], [io.HeaderValue])
+    }),
+    sfields: () => ({
+      DEFAULT: io.CompressionOptions,
+      OFF: io.CompressionOptions
+    })
+  });
+  dart.defineLazy(io.CompressionOptions, {
+    get DEFAULT() {
+      return dart.const(new io.CompressionOptions());
+    },
+    get OFF() {
+      return dart.const(new io.CompressionOptions({enabled: false}));
+    }
+  });
+  io.WebSocketTransformer = class WebSocketTransformer extends core.Object {
+    static new(opts) {
+      let protocolSelector = opts && 'protocolSelector' in opts ? opts.protocolSelector : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      return new io._WebSocketTransformerImpl(protocolSelector, compression);
+    }
+    static upgrade(request, opts) {
+      let protocolSelector = opts && 'protocolSelector' in opts ? opts.protocolSelector : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      return io._WebSocketTransformerImpl._upgrade(request, protocolSelector, compression);
+    }
+    static isUpgradeRequest(request) {
+      return io._WebSocketTransformerImpl._isUpgradeRequest(request);
+    }
+  };
+  io.WebSocketTransformer[dart.implements] = () => [StreamTransformerOfHttpRequest$WebSocket()];
+  dart.setSignature(io.WebSocketTransformer, {
+    constructors: () => ({new: dart.definiteFunctionType(io.WebSocketTransformer, [], {protocolSelector: ListOfStringTodynamic(), compression: io.CompressionOptions})}),
+    statics: () => ({
+      upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest], {protocolSelector: ListOfStringTodynamic(), compression: io.CompressionOptions}),
+      isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
+    }),
+    names: ['upgrade', 'isUpgradeRequest']
+  });
+  io.WebSocket = class WebSocket extends core.Object {
+    static connect(url, opts) {
+      let protocols = opts && 'protocols' in opts ? opts.protocols : null;
+      let headers = opts && 'headers' in opts ? opts.headers : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      return io._WebSocketImpl.connect(url, protocols, headers, {compression: compression});
+    }
+    new() {
+      this.pingInterval = null;
+    }
+    static fromUpgradedSocket(socket, opts) {
+      let protocol = opts && 'protocol' in opts ? opts.protocol : null;
+      let serverSide = opts && 'serverSide' in opts ? opts.serverSide : null;
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      if (serverSide == null) {
+        dart.throw(new core.ArgumentError("The serverSide argument must be passed " + "explicitly to WebSocket.fromUpgradedSocket."));
+      }
+      return new io._WebSocketImpl._fromSocket(socket, protocol, compression, serverSide);
+    }
+  };
+  io.WebSocket[dart.implements] = () => [async.Stream, async.StreamSink];
+  dart.setSignature(io.WebSocket, {
+    constructors: () => ({
+      new: dart.definiteFunctionType(io.WebSocket, []),
+      fromUpgradedSocket: dart.definiteFunctionType(io.WebSocket, [io.Socket], {protocol: core.String, serverSide: core.bool, compression: io.CompressionOptions})
+    }),
+    fields: () => ({pingInterval: core.Duration}),
+    sfields: () => ({
+      CONNECTING: core.int,
+      OPEN: core.int,
+      CLOSING: core.int,
+      CLOSED: core.int
+    }),
+    statics: () => ({connect: dart.definiteFunctionType(async.Future$(io.WebSocket), [core.String], {protocols: IterableOfString(), headers: MapOfString$dynamic(), compression: io.CompressionOptions})}),
+    names: ['connect']
+  });
+  io.WebSocket.CONNECTING = 0;
+  io.WebSocket.OPEN = 1;
+  io.WebSocket.CLOSING = 2;
+  io.WebSocket.CLOSED = 3;
+  io.WebSocketException = class WebSocketException extends core.Object {
+    new(message) {
+      if (message === void 0) message = "";
+      this.message = message;
+    }
+    toString() {
+      return dart.str`WebSocketException: ${this.message}`;
+    }
+  };
+  io.WebSocketException[dart.implements] = () => [io.IOException];
+  dart.setSignature(io.WebSocketException, {
+    constructors: () => ({new: dart.definiteFunctionType(io.WebSocketException, [], [core.String])}),
+    fields: () => ({message: core.String})
+  });
+  io._webSocketGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
+  io._clientNoContextTakeover = "client_no_context_takeover";
+  io._serverNoContextTakeover = "server_no_context_takeover";
+  io._clientMaxWindowBits = "client_max_window_bits";
+  io._serverMaxWindowBits = "server_max_window_bits";
+  io._WebSocketMessageType = class _WebSocketMessageType extends core.Object {};
+  dart.setSignature(io._WebSocketMessageType, {
+    sfields: () => ({
+      NONE: core.int,
+      TEXT: core.int,
+      BINARY: core.int
+    })
+  });
+  io._WebSocketMessageType.NONE = 0;
+  io._WebSocketMessageType.TEXT = 1;
+  io._WebSocketMessageType.BINARY = 2;
+  io._WebSocketOpcode = class _WebSocketOpcode extends core.Object {};
+  dart.setSignature(io._WebSocketOpcode, {
+    sfields: () => ({
+      CONTINUATION: core.int,
+      TEXT: core.int,
+      BINARY: core.int,
+      RESERVED_3: core.int,
+      RESERVED_4: core.int,
+      RESERVED_5: core.int,
+      RESERVED_6: core.int,
+      RESERVED_7: core.int,
+      CLOSE: core.int,
+      PING: core.int,
+      PONG: core.int,
+      RESERVED_B: core.int,
+      RESERVED_C: core.int,
+      RESERVED_D: core.int,
+      RESERVED_E: core.int,
+      RESERVED_F: core.int
+    })
+  });
+  io._WebSocketOpcode.CONTINUATION = 0;
+  io._WebSocketOpcode.TEXT = 1;
+  io._WebSocketOpcode.BINARY = 2;
+  io._WebSocketOpcode.RESERVED_3 = 3;
+  io._WebSocketOpcode.RESERVED_4 = 4;
+  io._WebSocketOpcode.RESERVED_5 = 5;
+  io._WebSocketOpcode.RESERVED_6 = 6;
+  io._WebSocketOpcode.RESERVED_7 = 7;
+  io._WebSocketOpcode.CLOSE = 8;
+  io._WebSocketOpcode.PING = 9;
+  io._WebSocketOpcode.PONG = 10;
+  io._WebSocketOpcode.RESERVED_B = 11;
+  io._WebSocketOpcode.RESERVED_C = 12;
+  io._WebSocketOpcode.RESERVED_D = 13;
+  io._WebSocketOpcode.RESERVED_E = 14;
+  io._WebSocketOpcode.RESERVED_F = 15;
+  io._CompressionMaxWindowBits = class _CompressionMaxWindowBits extends core.Object {
+    new(headerValue, maxWindowBits) {
+      if (headerValue === void 0) headerValue = null;
+      if (maxWindowBits === void 0) maxWindowBits = null;
+      this.headerValue = headerValue;
+      this.maxWindowBits = maxWindowBits;
+    }
+    toString() {
+      return this.headerValue;
+    }
+  };
+  dart.setSignature(io._CompressionMaxWindowBits, {
+    constructors: () => ({new: dart.definiteFunctionType(io._CompressionMaxWindowBits, [], [core.String, core.int])}),
+    fields: () => ({
+      headerValue: core.String,
+      maxWindowBits: core.int
+    })
+  });
+  const _maskingBytes = Symbol('_maskingBytes');
+  const _payload = Symbol('_payload');
+  const _serverSide = Symbol('_serverSide');
+  const _deflate = Symbol('_deflate');
+  const _fin = Symbol('_fin');
+  const _compressed = Symbol('_compressed');
+  const _opcode = Symbol('_opcode');
+  const _len = Symbol('_len');
+  const _masked = Symbol('_masked');
+  const _remainingLenBytes = Symbol('_remainingLenBytes');
+  const _remainingMaskingKeyBytes = Symbol('_remainingMaskingKeyBytes');
+  const _remainingPayloadBytes = Symbol('_remainingPayloadBytes');
+  const _unmaskingIndex = Symbol('_unmaskingIndex');
+  const _currentMessageType = Symbol('_currentMessageType');
+  const _eventSink$ = Symbol('_eventSink');
+  const _isControlFrame = Symbol('_isControlFrame');
+  const _lengthDone = Symbol('_lengthDone');
+  const _maskDone = Symbol('_maskDone');
+  const _unmask = Symbol('_unmask');
+  const _controlFrameEnd = Symbol('_controlFrameEnd');
+  const _messageFrameEnd = Symbol('_messageFrameEnd');
+  const _startPayload = Symbol('_startPayload');
+  const _prepareForNextFrame = Symbol('_prepareForNextFrame');
+  io._WebSocketProtocolTransformer = class _WebSocketProtocolTransformer extends core.Object {
+    new(serverSide, deflate) {
+      if (serverSide === void 0) serverSide = false;
+      if (deflate === void 0) deflate = null;
+      this[_maskingBytes] = core.List.new(4);
+      this[_payload] = io.BytesBuilder.new({copy: false});
+      this[_serverSide] = serverSide;
+      this[_deflate] = deflate;
+      this[_state$1] = io._WebSocketProtocolTransformer.START;
+      this[_fin] = false;
+      this[_compressed] = false;
+      this[_opcode] = -1;
+      this[_len] = -1;
+      this[_masked] = false;
+      this[_remainingLenBytes] = -1;
+      this[_remainingMaskingKeyBytes] = 4;
+      this[_remainingPayloadBytes] = -1;
+      this[_unmaskingIndex] = 0;
+      this[_currentMessageType] = io._WebSocketMessageType.NONE;
+      this.closeCode = io.WebSocketStatus.NO_STATUS_RECEIVED;
+      this.closeReason = "";
+      this[_eventSink$] = null;
+    }
+    bind(stream) {
+      return async.Stream.eventTransformed(stream, dart.fn(eventSink => {
+        if (this[_eventSink$] != null) {
+          dart.throw(new core.StateError("WebSocket transformer already used."));
+        }
+        this[_eventSink$] = eventSink;
+        return this;
+      }, EventSinkTo_WebSocketProtocolTransformer()));
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_eventSink$].addError(error, stackTrace);
+    }
+    close() {
+      this[_eventSink$].close();
+    }
+    add(bytes) {
+      let buffer = typed_data.Uint8List.is(bytes) ? bytes : typed_data.Uint8List.fromList(bytes);
+      let index = 0;
+      let lastIndex = buffer[dartx.length];
+      if (this[_state$1] == io._WebSocketProtocolTransformer.CLOSED) {
+        dart.throw(new io.WebSocketException("Data on closed connection"));
+      }
+      if (this[_state$1] == io._WebSocketProtocolTransformer.FAILURE) {
+        dart.throw(new io.WebSocketException("Data on failed connection"));
+      }
+      while (dart.notNull(index) < dart.notNull(lastIndex) && this[_state$1] != io._WebSocketProtocolTransformer.CLOSED && this[_state$1] != io._WebSocketProtocolTransformer.FAILURE) {
+        let byte = buffer[dartx._get](index);
+        if (dart.notNull(this[_state$1]) <= io._WebSocketProtocolTransformer.LEN_REST) {
+          if (this[_state$1] == io._WebSocketProtocolTransformer.START) {
+            this[_fin] = (dart.notNull(byte) & io._WebSocketProtocolTransformer.FIN) != 0;
+            if ((dart.notNull(byte) & (io._WebSocketProtocolTransformer.RSV2 | io._WebSocketProtocolTransformer.RSV3)) != 0) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            this[_opcode] = dart.notNull(byte) & io._WebSocketProtocolTransformer.OPCODE;
+            if (this[_opcode] != io._WebSocketOpcode.CONTINUATION) {
+              if ((dart.notNull(byte) & io._WebSocketProtocolTransformer.RSV1) != 0) {
+                this[_compressed] = true;
+              } else {
+                this[_compressed] = false;
+              }
+            }
+            if (dart.notNull(this[_opcode]) <= io._WebSocketOpcode.BINARY) {
+              if (this[_opcode] == io._WebSocketOpcode.CONTINUATION) {
+                if (this[_currentMessageType] == io._WebSocketMessageType.NONE) {
+                  dart.throw(new io.WebSocketException("Protocol error"));
+                }
+              } else {
+                dart.assert(this[_opcode] == io._WebSocketOpcode.TEXT || this[_opcode] == io._WebSocketOpcode.BINARY);
+                if (this[_currentMessageType] != io._WebSocketMessageType.NONE) {
+                  dart.throw(new io.WebSocketException("Protocol error"));
+                }
+                this[_currentMessageType] = this[_opcode];
+              }
+            } else if (dart.notNull(this[_opcode]) >= io._WebSocketOpcode.CLOSE && dart.notNull(this[_opcode]) <= io._WebSocketOpcode.PONG) {
+              if (!dart.test(this[_fin])) dart.throw(new io.WebSocketException("Protocol error"));
+            } else {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            this[_state$1] = io._WebSocketProtocolTransformer.LEN_FIRST;
+          } else if (this[_state$1] == io._WebSocketProtocolTransformer.LEN_FIRST) {
+            this[_masked] = (dart.notNull(byte) & 128) != 0;
+            this[_len] = dart.notNull(byte) & 127;
+            if (dart.test(this[_isControlFrame]()) && dart.notNull(this[_len]) > 125) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            if (this[_len] == 126) {
+              this[_len] = 0;
+              this[_remainingLenBytes] = 2;
+              this[_state$1] = io._WebSocketProtocolTransformer.LEN_REST;
+            } else if (this[_len] == 127) {
+              this[_len] = 0;
+              this[_remainingLenBytes] = 8;
+              this[_state$1] = io._WebSocketProtocolTransformer.LEN_REST;
+            } else {
+              dart.assert(dart.notNull(this[_len]) < 126);
+              this[_lengthDone]();
+            }
+          } else {
+            dart.assert(this[_state$1] == io._WebSocketProtocolTransformer.LEN_REST);
+            this[_len] = (dart.notNull(this[_len]) << 8 | dart.notNull(byte)) >>> 0;
+            this[_remainingLenBytes] = dart.notNull(this[_remainingLenBytes]) - 1;
+            if (this[_remainingLenBytes] == 0) {
+              this[_lengthDone]();
+            }
+          }
+        } else {
+          if (this[_state$1] == io._WebSocketProtocolTransformer.MASK) {
+            this[_maskingBytes][dartx._set](4 - (() => {
+              let x = this[_remainingMaskingKeyBytes];
+              this[_remainingMaskingKeyBytes] = dart.notNull(x) - 1;
+              return x;
+            })(), byte);
+            if (this[_remainingMaskingKeyBytes] == 0) {
+              this[_maskDone]();
+            }
+          } else {
+            dart.assert(this[_state$1] == io._WebSocketProtocolTransformer.PAYLOAD);
+            let payloadLength = math.min(core.int)(dart.notNull(lastIndex) - dart.notNull(index), this[_remainingPayloadBytes]);
+            this[_remainingPayloadBytes] = dart.notNull(this[_remainingPayloadBytes]) - dart.notNull(payloadLength);
+            if (dart.test(this[_masked])) {
+              this[_unmask](index, payloadLength, buffer);
+            }
+            this[_payload].add(typed_data.Uint8List.view(buffer[dartx.buffer], index, payloadLength));
+            index = dart.notNull(index) + dart.notNull(payloadLength);
+            if (dart.test(this[_isControlFrame]())) {
+              if (this[_remainingPayloadBytes] == 0) this[_controlFrameEnd]();
+            } else {
+              if (this[_currentMessageType] != io._WebSocketMessageType.TEXT && this[_currentMessageType] != io._WebSocketMessageType.BINARY) {
+                dart.throw(new io.WebSocketException("Protocol error"));
+              }
+              if (this[_remainingPayloadBytes] == 0) this[_messageFrameEnd]();
+            }
+            index = dart.notNull(index) - 1;
+          }
+        }
+        index = dart.notNull(index) + 1;
+      }
+    }
+    [_unmask](index, length, buffer) {
+      let BLOCK_SIZE = 16;
+      if (dart.notNull(length) >= BLOCK_SIZE) {
+        let startOffset = BLOCK_SIZE - (dart.notNull(index) & 15);
+        let end = dart.notNull(index) + startOffset;
+        for (let i = index; dart.notNull(i) < end; i = dart.notNull(i) + 1) {
+          buffer[dartx._set](i, (dart.notNull(buffer[dartx._get](i)) ^ dart.notNull(core.int._check(this[_maskingBytes][dartx._get]((() => {
+            let x = this[_unmaskingIndex];
+            this[_unmaskingIndex] = dart.notNull(x) + 1;
+            return x;
+          })() & 3)))) >>> 0);
+        }
+        index = dart.notNull(index) + startOffset;
+        length = dart.notNull(length) - startOffset;
+        let blockCount = (dart.notNull(length) / BLOCK_SIZE)[dartx.truncate]();
+        if (blockCount > 0) {
+          let mask = 0;
+          for (let i = 3; i >= 0; i--) {
+            mask = (mask << 8 | dart.notNull(core.int._check(this[_maskingBytes][dartx._get](dart.notNull(this[_unmaskingIndex]) + i & 3)))) >>> 0;
+          }
+          let blockMask = typed_data.Int32x4.new(mask, mask, mask, mask);
+          let blockBuffer = typed_data.Int32x4List.view(buffer[dartx.buffer], index, blockCount);
+          for (let i = 0; i < dart.notNull(blockBuffer.length); i++) {
+            blockBuffer._set(i, blockBuffer._get(i)['^'](blockMask));
+          }
+          let bytes = blockCount * BLOCK_SIZE;
+          index = dart.notNull(index) + bytes;
+          length = dart.notNull(length) - bytes;
+        }
+      }
+      let end = dart.notNull(index) + dart.notNull(length);
+      for (let i = index; dart.notNull(i) < end; i = dart.notNull(i) + 1) {
+        buffer[dartx._set](i, (dart.notNull(buffer[dartx._get](i)) ^ dart.notNull(core.int._check(this[_maskingBytes][dartx._get]((() => {
+          let x = this[_unmaskingIndex];
+          this[_unmaskingIndex] = dart.notNull(x) + 1;
+          return x;
+        })() & 3)))) >>> 0);
+      }
+    }
+    [_lengthDone]() {
+      if (dart.test(this[_masked])) {
+        if (!dart.test(this[_serverSide])) {
+          dart.throw(new io.WebSocketException("Received masked frame from server"));
+        }
+        this[_state$1] = io._WebSocketProtocolTransformer.MASK;
+      } else {
+        if (dart.test(this[_serverSide])) {
+          dart.throw(new io.WebSocketException("Received unmasked frame from client"));
+        }
+        this[_remainingPayloadBytes] = this[_len];
+        this[_startPayload]();
+      }
+    }
+    [_maskDone]() {
+      this[_remainingPayloadBytes] = this[_len];
+      this[_startPayload]();
+    }
+    [_startPayload]() {
+      if (this[_remainingPayloadBytes] == 0) {
+        if (dart.test(this[_isControlFrame]())) {
+          switch (this[_opcode]) {
+            case io._WebSocketOpcode.CLOSE:
+            {
+              this[_state$1] = io._WebSocketProtocolTransformer.CLOSED;
+              this[_eventSink$].close();
+              break;
+            }
+            case io._WebSocketOpcode.PING:
+            {
+              this[_eventSink$].add(new io._WebSocketPing());
+              break;
+            }
+            case io._WebSocketOpcode.PONG:
+            {
+              this[_eventSink$].add(new io._WebSocketPong());
+              break;
+            }
+          }
+          this[_prepareForNextFrame]();
+        } else {
+          this[_messageFrameEnd]();
+        }
+      } else {
+        this[_state$1] = io._WebSocketProtocolTransformer.PAYLOAD;
+      }
+    }
+    [_messageFrameEnd]() {
+      if (dart.test(this[_fin])) {
+        let bytes = this[_payload].takeBytes();
+        if (this[_deflate] != null && dart.test(this[_compressed])) {
+          bytes = this[_deflate].processIncomingMessage(bytes);
+        }
+        switch (this[_currentMessageType]) {
+          case io._WebSocketMessageType.TEXT:
+          {
+            this[_eventSink$].add(convert.UTF8.decode(bytes));
+            break;
+          }
+          case io._WebSocketMessageType.BINARY:
+          {
+            this[_eventSink$].add(bytes);
+            break;
+          }
+        }
+        this[_currentMessageType] = io._WebSocketMessageType.NONE;
+      }
+      this[_prepareForNextFrame]();
+    }
+    [_controlFrameEnd]() {
+      switch (this[_opcode]) {
+        case io._WebSocketOpcode.CLOSE:
+        {
+          this.closeCode = io.WebSocketStatus.NO_STATUS_RECEIVED;
+          let payload = this[_payload].takeBytes();
+          if (dart.notNull(payload[dartx.length]) > 0) {
+            if (payload[dartx.length] == 1) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            this.closeCode = (dart.notNull(payload[dartx._get](0)) << 8 | dart.notNull(payload[dartx._get](1))) >>> 0;
+            if (this.closeCode == io.WebSocketStatus.NO_STATUS_RECEIVED) {
+              dart.throw(new io.WebSocketException("Protocol error"));
+            }
+            if (dart.notNull(payload[dartx.length]) > 2) {
+              this.closeReason = convert.UTF8.decode(payload[dartx.sublist](2));
+            }
+          }
+          this[_state$1] = io._WebSocketProtocolTransformer.CLOSED;
+          this[_eventSink$].close();
+          break;
+        }
+        case io._WebSocketOpcode.PING:
+        {
+          this[_eventSink$].add(new io._WebSocketPing(this[_payload].takeBytes()));
+          break;
+        }
+        case io._WebSocketOpcode.PONG:
+        {
+          this[_eventSink$].add(new io._WebSocketPong(this[_payload].takeBytes()));
+          break;
+        }
+      }
+      this[_prepareForNextFrame]();
+    }
+    [_isControlFrame]() {
+      return this[_opcode] == io._WebSocketOpcode.CLOSE || this[_opcode] == io._WebSocketOpcode.PING || this[_opcode] == io._WebSocketOpcode.PONG;
+    }
+    [_prepareForNextFrame]() {
+      if (this[_state$1] != io._WebSocketProtocolTransformer.CLOSED && this[_state$1] != io._WebSocketProtocolTransformer.FAILURE) this[_state$1] = io._WebSocketProtocolTransformer.START;
+      this[_fin] = false;
+      this[_opcode] = -1;
+      this[_len] = -1;
+      this[_remainingLenBytes] = -1;
+      this[_remainingMaskingKeyBytes] = 4;
+      this[_remainingPayloadBytes] = -1;
+      this[_unmaskingIndex] = 0;
+    }
+  };
+  io._WebSocketProtocolTransformer[dart.implements] = () => [StreamTransformerOfListOfint$dynamic(), EventSinkOfUint8List()];
+  dart.setSignature(io._WebSocketProtocolTransformer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketProtocolTransformer, [], [core.bool, io._WebSocketPerMessageDeflate])}),
+    fields: () => ({
+      [_state$1]: core.int,
+      [_fin]: core.bool,
+      [_compressed]: core.bool,
+      [_opcode]: core.int,
+      [_len]: core.int,
+      [_masked]: core.bool,
+      [_remainingLenBytes]: core.int,
+      [_remainingMaskingKeyBytes]: core.int,
+      [_remainingPayloadBytes]: core.int,
+      [_unmaskingIndex]: core.int,
+      [_currentMessageType]: core.int,
+      closeCode: core.int,
+      closeReason: core.String,
+      [_eventSink$]: async.EventSink,
+      [_serverSide]: core.bool,
+      [_maskingBytes]: core.List,
+      [_payload]: io.BytesBuilder,
+      [_deflate]: io._WebSocketPerMessageDeflate
+    }),
+    methods: () => ({
+      bind: dart.definiteFunctionType(async.Stream, [async.Stream]),
+      addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
+      close: dart.definiteFunctionType(dart.void, []),
+      add: dart.definiteFunctionType(dart.void, [ListOfint()]),
+      [_unmask]: dart.definiteFunctionType(dart.void, [core.int, core.int, typed_data.Uint8List]),
+      [_lengthDone]: dart.definiteFunctionType(dart.void, []),
+      [_maskDone]: dart.definiteFunctionType(dart.void, []),
+      [_startPayload]: dart.definiteFunctionType(dart.void, []),
+      [_messageFrameEnd]: dart.definiteFunctionType(dart.void, []),
+      [_controlFrameEnd]: dart.definiteFunctionType(dart.void, []),
+      [_isControlFrame]: dart.definiteFunctionType(core.bool, []),
+      [_prepareForNextFrame]: dart.definiteFunctionType(dart.void, [])
+    }),
+    sfields: () => ({
+      START: core.int,
+      LEN_FIRST: core.int,
+      LEN_REST: core.int,
+      MASK: core.int,
+      PAYLOAD: core.int,
+      CLOSED: core.int,
+      FAILURE: core.int,
+      FIN: core.int,
+      RSV1: core.int,
+      RSV2: core.int,
+      RSV3: core.int,
+      OPCODE: core.int
+    })
+  });
+  io._WebSocketProtocolTransformer.START = 0;
+  io._WebSocketProtocolTransformer.LEN_FIRST = 1;
+  io._WebSocketProtocolTransformer.LEN_REST = 2;
+  io._WebSocketProtocolTransformer.MASK = 3;
+  io._WebSocketProtocolTransformer.PAYLOAD = 4;
+  io._WebSocketProtocolTransformer.CLOSED = 5;
+  io._WebSocketProtocolTransformer.FAILURE = 6;
+  io._WebSocketProtocolTransformer.FIN = 128;
+  io._WebSocketProtocolTransformer.RSV1 = 64;
+  io._WebSocketProtocolTransformer.RSV2 = 32;
+  io._WebSocketProtocolTransformer.RSV3 = 16;
+  io._WebSocketProtocolTransformer.OPCODE = 15;
+  io._WebSocketPing = class _WebSocketPing extends core.Object {
+    new(payload) {
+      if (payload === void 0) payload = null;
+      this.payload = payload;
+    }
+  };
+  dart.setSignature(io._WebSocketPing, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPing, [], [ListOfint()])}),
+    fields: () => ({payload: ListOfint()})
+  });
+  io._WebSocketPong = class _WebSocketPong extends core.Object {
+    new(payload) {
+      if (payload === void 0) payload = null;
+      this.payload = payload;
+    }
+  };
+  dart.setSignature(io._WebSocketPong, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPong, [], [ListOfint()])}),
+    fields: () => ({payload: ListOfint()})
+  });
+  const _protocolSelector = Symbol('_protocolSelector');
+  const _compression = Symbol('_compression');
+  io._WebSocketTransformerImpl = class _WebSocketTransformerImpl extends core.Object {
+    new(protocolSelector, compression) {
+      this[_controller$0] = StreamControllerOfWebSocket().new({sync: true});
+      this[_protocolSelector] = protocolSelector;
+      this[_compression] = compression;
+    }
+    bind(stream) {
+      stream.listen(dart.fn(request => {
+        io._WebSocketTransformerImpl._upgrade(request, this[_protocolSelector], this[_compression]).then(dart.void)(dart.fn(webSocket => this[_controller$0].add(webSocket), WebSocketTovoid())).catchError(dart.bind(this[_controller$0], 'addError'));
+      }, HttpRequestToNull()), {onDone: dart.fn(() => {
+          this[_controller$0].close();
+        }, VoidToNull())});
+      return this[_controller$0].stream;
+    }
+    static _upgrade(request, _protocolSelector, compression) {
+      let response = request.response;
+      if (!dart.test(io._WebSocketTransformerImpl._isUpgradeRequest(request))) {
+        response.statusCode = io.HttpStatus.BAD_REQUEST;
+        response.close();
+        return FutureOfWebSocket().error(new io.WebSocketException("Invalid WebSocket upgrade request"));
+      }
+      function upgrade(protocol) {
+        response.statusCode = io.HttpStatus.SWITCHING_PROTOCOLS;
+        response.headers.add(io.HttpHeaders.CONNECTION, "Upgrade");
+        response.headers.add(io.HttpHeaders.UPGRADE, "websocket");
+        let key = request.headers.value("Sec-WebSocket-Key");
+        let sha1 = new io._SHA1();
+        sha1.add(dart.str`${key}${io._webSocketGUID}`[dartx.codeUnits]);
+        let accept = io._CryptoUtils.bytesToBase64(sha1.close());
+        response.headers.add("Sec-WebSocket-Accept", accept);
+        if (protocol != null) {
+          response.headers.add("Sec-WebSocket-Protocol", protocol);
+        }
+        let deflate = io._WebSocketTransformerImpl._negotiateCompression(request, response, compression);
+        response.headers.contentLength = 0;
+        return response.detachSocket().then(io._WebSocketImpl)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, true, deflate), SocketTo_WebSocketImpl()));
+      }
+      dart.fn(upgrade, StringToFuture());
+      let protocols = request.headers._get('Sec-WebSocket-Protocol');
+      if (protocols != null && _protocolSelector != null) {
+        protocols = io._HttpParser._tokenizeFieldValue(protocols[dartx.join](', '));
+        return async.Future.new(dart.fn(() => dart.dcall(_protocolSelector, protocols), VoidTodynamic$())).then(dart.dynamic)(dart.fn(protocol => {
+          if (dart.notNull(protocols[dartx.indexOf](core.String._check(protocol))) < 0) {
+            dart.throw(new io.WebSocketException("Selected protocol is not in the list of available protocols"));
+          }
+          return protocol;
+        }, dynamicTodynamic$())).catchError(dart.fn(error => {
+          response.statusCode = io.HttpStatus.INTERNAL_SERVER_ERROR;
+          response.close();
+          dart.throw(error);
+        }, dynamicToNull$())).then(io.WebSocket)(upgrade);
+      } else {
+        return FutureOfWebSocket()._check(upgrade(null));
+      }
+    }
+    static _negotiateCompression(request, response, compression) {
+      let extensionHeader = request.headers.value("Sec-WebSocket-Extensions");
+      let t = extensionHeader;
+      t == null ? extensionHeader = "" : t;
+      let hv = io.HeaderValue.parse(extensionHeader, {valueSeparator: ','});
+      if (dart.test(compression.enabled) && hv.value == io._WebSocketImpl.PER_MESSAGE_DEFLATE) {
+        let info = compression[_createHeader](hv);
+        response.headers.add("Sec-WebSocket-Extensions", info.headerValue);
+        let serverNoContextTakeover = dart.test(hv.parameters[dartx.containsKey](io._serverNoContextTakeover)) && dart.test(compression.serverNoContextTakeover);
+        let clientNoContextTakeover = dart.test(hv.parameters[dartx.containsKey](io._clientNoContextTakeover)) && dart.test(compression.clientNoContextTakeover);
+        let deflate = new io._WebSocketPerMessageDeflate({serverNoContextTakeover: serverNoContextTakeover, clientNoContextTakeover: clientNoContextTakeover, serverMaxWindowBits: info.maxWindowBits, clientMaxWindowBits: info.maxWindowBits, serverSide: true});
+        return deflate;
+      }
+      return null;
+    }
+    static _isUpgradeRequest(request) {
+      if (request.method != "GET") {
+        return false;
+      }
+      if (request.headers._get(io.HttpHeaders.CONNECTION) == null) {
+        return false;
+      }
+      let isUpgrade = false;
+      request.headers._get(io.HttpHeaders.CONNECTION)[dartx.forEach](dart.fn(value => {
+        if (value[dartx.toLowerCase]() == "upgrade") isUpgrade = true;
+      }, StringToNull()));
+      if (!isUpgrade) return false;
+      let upgrade = request.headers.value(io.HttpHeaders.UPGRADE);
+      if (upgrade == null || upgrade[dartx.toLowerCase]() != "websocket") {
+        return false;
+      }
+      let version = request.headers.value("Sec-WebSocket-Version");
+      if (version == null || version != "13") {
+        return false;
+      }
+      let key = request.headers.value("Sec-WebSocket-Key");
+      if (key == null) {
+        return false;
+      }
+      return true;
+    }
+  };
+  io._WebSocketTransformerImpl[dart.implements] = () => [io.WebSocketTransformer];
+  dart.setSignature(io._WebSocketTransformerImpl, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketTransformerImpl, [core.Function, io.CompressionOptions])}),
+    fields: () => ({
+      [_controller$0]: StreamControllerOfWebSocket(),
+      [_protocolSelector]: core.Function,
+      [_compression]: io.CompressionOptions
+    }),
+    methods: () => ({bind: dart.definiteFunctionType(async.Stream$(io.WebSocket), [StreamOfHttpRequest()])}),
+    statics: () => ({
+      _upgrade: dart.definiteFunctionType(async.Future$(io.WebSocket), [io.HttpRequest, dart.dynamic, io.CompressionOptions]),
+      _negotiateCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpRequest, io.HttpResponse, io.CompressionOptions]),
+      _isUpgradeRequest: dart.definiteFunctionType(core.bool, [io.HttpRequest])
+    }),
+    names: ['_upgrade', '_negotiateCompression', '_isUpgradeRequest']
+  });
+  const _ensureDecoder = Symbol('_ensureDecoder');
+  const _ensureEncoder = Symbol('_ensureEncoder');
+  let const$80;
+  io._WebSocketPerMessageDeflate = class _WebSocketPerMessageDeflate extends core.Object {
+    new(opts) {
+      let clientMaxWindowBits = opts && 'clientMaxWindowBits' in opts ? opts.clientMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+      let serverMaxWindowBits = opts && 'serverMaxWindowBits' in opts ? opts.serverMaxWindowBits : io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+      let serverNoContextTakeover = opts && 'serverNoContextTakeover' in opts ? opts.serverNoContextTakeover : false;
+      let clientNoContextTakeover = opts && 'clientNoContextTakeover' in opts ? opts.clientNoContextTakeover : false;
+      let serverSide = opts && 'serverSide' in opts ? opts.serverSide : false;
+      this.clientMaxWindowBits = clientMaxWindowBits;
+      this.serverMaxWindowBits = serverMaxWindowBits;
+      this.serverNoContextTakeover = serverNoContextTakeover;
+      this.clientNoContextTakeover = clientNoContextTakeover;
+      this.serverSide = serverSide;
+      this.decoder = null;
+      this.encoder = null;
+    }
+    [_ensureDecoder]() {
+      if (this.decoder == null) {
+        this.decoder = io._Filter._newZLibInflateFilter(dart.test(this.serverSide) ? this.clientMaxWindowBits : this.serverMaxWindowBits, null, true);
+      }
+    }
+    [_ensureEncoder]() {
+      if (this.encoder == null) {
+        this.encoder = io._Filter._newZLibDeflateFilter(false, io.ZLibOption.DEFAULT_LEVEL, dart.test(this.serverSide) ? this.serverMaxWindowBits : this.clientMaxWindowBits, io.ZLibOption.DEFAULT_MEM_LEVEL, io.ZLibOption.STRATEGY_DEFAULT, null, true);
+      }
+    }
+    processIncomingMessage(msg) {
+      this[_ensureDecoder]();
+      let data = [];
+      data[dartx.addAll](msg);
+      data[dartx.addAll](const$80 || (const$80 = dart.constList([0, 0, 255, 255], core.int)));
+      this.decoder.process(ListOfint()._check(data), 0, data[dartx.length]);
+      let result = [];
+      let out = null;
+      while ((out = this.decoder.processed()) != null) {
+        result[dartx.addAll](core.Iterable._check(out));
+      }
+      if (dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || !dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
+        this.decoder = null;
+      }
+      return typed_data.Uint8List.fromList(ListOfint()._check(result));
+    }
+    processOutgoingMessage(msg) {
+      this[_ensureEncoder]();
+      let result = [];
+      let buffer = null;
+      let out = null;
+      if (!typed_data.Uint8List.is(msg)) {
+        for (let i = 0; i < dart.notNull(msg[dartx.length]); i++) {
+          if (dart.notNull(msg[dartx._get](i)) < 0 || 255 < dart.notNull(msg[dartx._get](i))) {
+            dart.throw(new core.ArgumentError("List element is not a byte value " + dart.str`(value ${msg[dartx._get](i)} at index ${i})`));
+          }
+        }
+        buffer = typed_data.Uint8List.fromList(msg);
+      } else {
+        buffer = typed_data.Uint8List._check(msg);
+      }
+      this.encoder.process(buffer, 0, buffer[dartx.length]);
+      while ((out = this.encoder.processed()) != null) {
+        result[dartx.addAll](core.Iterable._check(out));
+      }
+      if (!dart.test(this.serverSide) && dart.test(this.clientNoContextTakeover) || dart.test(this.serverSide) && dart.test(this.serverNoContextTakeover)) {
+        this.encoder = null;
+      }
+      if (dart.notNull(result[dartx.length]) > 4) {
+        result = result[dartx.sublist](0, dart.notNull(result[dartx.length]) - 4);
+      }
+      return ListOfint()._check(result);
+    }
+  };
+  dart.setSignature(io._WebSocketPerMessageDeflate, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [], {clientMaxWindowBits: core.int, serverMaxWindowBits: core.int, serverNoContextTakeover: core.bool, clientNoContextTakeover: core.bool, serverSide: core.bool})}),
+    fields: () => ({
+      serverNoContextTakeover: core.bool,
+      clientNoContextTakeover: core.bool,
+      clientMaxWindowBits: core.int,
+      serverMaxWindowBits: core.int,
+      serverSide: core.bool,
+      decoder: io._Filter,
+      encoder: io._Filter
+    }),
+    methods: () => ({
+      [_ensureDecoder]: dart.definiteFunctionType(dart.void, []),
+      [_ensureEncoder]: dart.definiteFunctionType(dart.void, []),
+      processIncomingMessage: dart.definiteFunctionType(typed_data.Uint8List, [ListOfint()]),
+      processOutgoingMessage: dart.definiteFunctionType(core.List$(core.int), [ListOfint()])
+    })
+  });
+  const _deflateHelper = Symbol('_deflateHelper');
+  const _outCloseCode = Symbol('_outCloseCode');
+  const _outCloseReason = Symbol('_outCloseReason');
+  io._WebSocketOutgoingTransformer = class _WebSocketOutgoingTransformer extends core.Object {
+    new(webSocket) {
+      this.webSocket = webSocket;
+      this[_eventSink$] = null;
+      this[_deflateHelper] = null;
+      this[_deflateHelper] = this.webSocket[_deflate];
+    }
+    bind(stream) {
+      return StreamOfListOfint().eventTransformed(stream, dart.fn(eventSink => {
+        if (this[_eventSink$] != null) {
+          dart.throw(new core.StateError("WebSocket transformer already used"));
+        }
+        this[_eventSink$] = eventSink;
+        return this;
+      }, EventSinkOfListOfintTo_WebSocketOutgoingTransformer()));
+    }
+    add(message) {
+      if (io._WebSocketPong.is(message)) {
+        this.addFrame(io._WebSocketOpcode.PONG, message.payload);
+        return;
+      }
+      if (io._WebSocketPing.is(message)) {
+        this.addFrame(io._WebSocketOpcode.PING, message.payload);
+        return;
+      }
+      let data = null;
+      let opcode = null;
+      if (message != null) {
+        if (typeof message == 'string') {
+          opcode = io._WebSocketOpcode.TEXT;
+          data = convert.UTF8.encode(message);
+        } else {
+          if (ListOfint().is(message)) {
+            data = message;
+            opcode = io._WebSocketOpcode.BINARY;
+          } else {
+            dart.throw(new core.ArgumentError(message));
+          }
+        }
+        if (this[_deflateHelper] != null) {
+          data = this[_deflateHelper].processOutgoingMessage(data);
+        }
+      } else {
+        opcode = io._WebSocketOpcode.TEXT;
+      }
+      this.addFrame(opcode, data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_eventSink$].addError(error, stackTrace);
+    }
+    close() {
+      let code = this.webSocket[_outCloseCode];
+      let reason = this.webSocket[_outCloseReason];
+      let data = null;
+      if (code != null) {
+        data = ListOfint().new();
+        data[dartx.add](dart.notNull(code) >> 8 & 255);
+        data[dartx.add](dart.notNull(code) & 255);
+        if (reason != null) {
+          data[dartx.addAll](convert.UTF8.encode(reason));
+        }
+      }
+      this.addFrame(io._WebSocketOpcode.CLOSE, data);
+      this[_eventSink$].close();
+    }
+    addFrame(opcode, data) {
+      return io._WebSocketOutgoingTransformer.createFrame(opcode, data, this.webSocket[_serverSide], this[_deflateHelper] != null && (opcode == io._WebSocketOpcode.TEXT || opcode == io._WebSocketOpcode.BINARY))[dartx.forEach](dart.fn(e => {
+        this[_eventSink$].add(e);
+      }, ListOfintToNull()));
+    }
+    static createFrame(opcode, data, serverSide, compressed) {
+      let mask = !dart.test(serverSide);
+      let dataLength = data == null ? 0 : data[dartx.length];
+      let headerSize = mask ? 6 : 2;
+      if (dart.notNull(dataLength) > 65535) {
+        headerSize = headerSize + 8;
+      } else if (dart.notNull(dataLength) > 125) {
+        headerSize = headerSize + 2;
+      }
+      let header = typed_data.Uint8List.new(headerSize);
+      let index = 0;
+      let hoc = (io._WebSocketProtocolTransformer.FIN | (dart.test(compressed) ? io._WebSocketProtocolTransformer.RSV1 : 0) | dart.notNull(opcode) & io._WebSocketProtocolTransformer.OPCODE) >>> 0;
+      header[dartx._set](index++, hoc);
+      let lengthBytes = 1;
+      if (dart.notNull(dataLength) > 65535) {
+        header[dartx._set](index++, 127);
+        lengthBytes = 8;
+      } else if (dart.notNull(dataLength) > 125) {
+        header[dartx._set](index++, 126);
+        lengthBytes = 2;
+      }
+      for (let i = 0; i < lengthBytes; i++) {
+        header[dartx._set](index++, dataLength[dartx['>>']]((lengthBytes - 1 - i) * 8) & 255);
+      }
+      if (mask) {
+        let i$ = 1;
+        header[dartx._set](i$, (dart.notNull(header[dartx._get](i$)) | 1 << 7) >>> 0);
+        let maskBytes = io._IOCrypto.getRandomBytes(4);
+        header[dartx.setRange](index, index + 4, maskBytes);
+        index = index + 4;
+        if (data != null) {
+          let list = null;
+          if (opcode == io._WebSocketOpcode.TEXT && typed_data.Uint8List.is(data)) {
+            list = data;
+          } else {
+            if (typed_data.Uint8List.is(data)) {
+              list = typed_data.Uint8List.fromList(data);
+            } else {
+              list = typed_data.Uint8List.new(data[dartx.length]);
+              for (let i = 0; i < dart.notNull(data[dartx.length]); i++) {
+                if (dart.notNull(data[dartx._get](i)) < 0 || 255 < dart.notNull(data[dartx._get](i))) {
+                  dart.throw(new core.ArgumentError("List element is not a byte value " + dart.str`(value ${data[dartx._get](i)} at index ${i})`));
+                }
+                list[dartx._set](i, data[dartx._get](i));
+              }
+            }
+          }
+          let BLOCK_SIZE = 16;
+          let blockCount = (dart.notNull(list[dartx.length]) / BLOCK_SIZE)[dartx.truncate]();
+          if (blockCount > 0) {
+            let mask = 0;
+            for (let i = 3; i >= 0; i--) {
+              mask = (mask << 8 | dart.notNull(maskBytes[dartx._get](i))) >>> 0;
+            }
+            let blockMask = typed_data.Int32x4.new(mask, mask, mask, mask);
+            let blockBuffer = typed_data.Int32x4List.view(list[dartx.buffer], 0, blockCount);
+            for (let i = 0; i < dart.notNull(blockBuffer.length); i++) {
+              blockBuffer._set(i, blockBuffer._get(i)['^'](blockMask));
+            }
+          }
+          for (let i = blockCount * BLOCK_SIZE; i < dart.notNull(list[dartx.length]); i++) {
+            list[dartx._set](i, (dart.notNull(list[dartx._get](i)) ^ dart.notNull(maskBytes[dartx._get](i & 3))) >>> 0);
+          }
+          data = list;
+        }
+      }
+      dart.assert(index == headerSize);
+      if (data == null) {
+        return JSArrayOfUint8List().of([header]);
+      } else {
+        return JSArrayOfListOfint().of([header, data]);
+      }
+    }
+  };
+  io._WebSocketOutgoingTransformer[dart.implements] = () => [StreamTransformerOfdynamic$ListOfint(), async.EventSink];
+  dart.setSignature(io._WebSocketOutgoingTransformer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketOutgoingTransformer, [io._WebSocketImpl])}),
+    fields: () => ({
+      webSocket: io._WebSocketImpl,
+      [_eventSink$]: EventSinkOfListOfint(),
+      [_deflateHelper]: io._WebSocketPerMessageDeflate
+    }),
+    methods: () => ({
+      bind: dart.definiteFunctionType(async.Stream$(core.List$(core.int)), [async.Stream]),
+      add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      addError: dart.definiteFunctionType(dart.void, [core.Object], [core.StackTrace]),
+      close: dart.definiteFunctionType(dart.void, []),
+      addFrame: dart.definiteFunctionType(dart.void, [core.int, ListOfint()])
+    }),
+    statics: () => ({createFrame: dart.definiteFunctionType(core.Iterable$(core.List$(core.int)), [core.int, ListOfint(), core.bool, core.bool])}),
+    names: ['createFrame']
+  });
+  const _issuedPause = Symbol('_issuedPause');
+  const _completer = Symbol('_completer');
+  const _onListen$ = Symbol('_onListen');
+  const _onPause$ = Symbol('_onPause');
+  const _onResume$ = Symbol('_onResume');
+  const _cancel$ = Symbol('_cancel');
+  const _done$ = Symbol('_done');
+  const _ensureController = Symbol('_ensureController');
+  io._WebSocketConsumer = class _WebSocketConsumer extends core.Object {
+    new(webSocket, socket) {
+      this[_closeCompleter] = async.Completer.new();
+      this.webSocket = webSocket;
+      this.socket = socket;
+      this[_controller$0] = null;
+      this[_subscription$] = null;
+      this[_issuedPause] = false;
+      this[_closed] = false;
+      this[_completer] = null;
+    }
+    [_onListen$]() {
+      if (this[_subscription$] != null) {
+        this[_subscription$].cancel();
+      }
+    }
+    [_onPause$]() {
+      if (this[_subscription$] != null) {
+        this[_subscription$].pause();
+      } else {
+        this[_issuedPause] = true;
+      }
+    }
+    [_onResume$]() {
+      if (this[_subscription$] != null) {
+        this[_subscription$].resume();
+      } else {
+        this[_issuedPause] = false;
+      }
+    }
+    [_cancel$]() {
+      if (this[_subscription$] != null) {
+        let subscription = this[_subscription$];
+        this[_subscription$] = null;
+        subscription.cancel();
+      }
+    }
+    [_ensureController]() {
+      if (this[_controller$0] != null) return;
+      this[_controller$0] = async.StreamController.new({sync: true, onPause: dart.bind(this, _onPause$), onResume: dart.bind(this, _onResume$), onCancel: dart.bind(this, _onListen$)});
+      let stream = this[_controller$0].stream.transform(ListOfint())(new io._WebSocketOutgoingTransformer(this.webSocket));
+      this.socket.addStream(stream).then(dart.dynamic)(dart.fn(_ => {
+        this[_done$]();
+        this[_closeCompleter].complete(this.webSocket);
+      }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
+          this[_closed] = true;
+          this[_cancel$]();
+          if (core.ArgumentError.is(error)) {
+            if (!dart.test(this[_done$](error, stackTrace))) {
+              this[_closeCompleter].completeError(error, stackTrace);
+            }
+          } else {
+            this[_done$]();
+            this[_closeCompleter].complete(this.webSocket);
+          }
+        }, dynamicAndStackTraceToNull())});
+    }
+    [_done$](error, stackTrace) {
+      if (error === void 0) error = null;
+      if (stackTrace === void 0) stackTrace = null;
+      if (this[_completer] == null) return false;
+      if (error != null) {
+        this[_completer].completeError(error, stackTrace);
+      } else {
+        this[_completer].complete(this.webSocket);
+      }
+      this[_completer] = null;
+      return true;
+    }
+    addStream(stream) {
+      if (dart.test(this[_closed])) {
+        stream.listen(null).cancel();
+        return async.Future.value(this.webSocket);
+      }
+      this[_ensureController]();
+      this[_completer] = async.Completer.new();
+      this[_subscription$] = stream.listen(dart.fn(data => {
+        this[_controller$0].add(data);
+      }, dynamicToNull$()), {onDone: dart.bind(this, _done$), onError: dart.bind(this, _done$), cancelOnError: true});
+      if (dart.test(this[_issuedPause])) {
+        this[_subscription$].pause();
+        this[_issuedPause] = false;
+      }
+      return this[_completer].future;
+    }
+    close() {
+      this[_ensureController]();
+      const closeSocket = (function() {
+        return this.socket.close().catchError(dart.fn(_ => {
+        }, dynamicToNull$())).then(io._WebSocketImpl)(dart.fn(_ => this.webSocket, dynamicTo_WebSocketImpl()));
+      }).bind(this);
+      dart.fn(closeSocket, VoidToFuture());
+      this[_controller$0].close();
+      return this[_closeCompleter].future.then(dart.dynamic)(dart.fn(_ => closeSocket(), dynamicToFuture()));
+    }
+    add(data) {
+      if (dart.test(this[_closed])) return;
+      this[_ensureController]();
+      this[_controller$0].add(data);
+    }
+    closeSocket() {
+      this[_closed] = true;
+      this[_cancel$]();
+      this.close();
+    }
+  };
+  io._WebSocketConsumer[dart.implements] = () => [async.StreamConsumer];
+  dart.setSignature(io._WebSocketConsumer, {
+    constructors: () => ({new: dart.definiteFunctionType(io._WebSocketConsumer, [io._WebSocketImpl, io.Socket])}),
+    fields: () => ({
+      webSocket: io._WebSocketImpl,
+      socket: io.Socket,
+      [_controller$0]: async.StreamController,
+      [_subscription$]: async.StreamSubscription,
+      [_issuedPause]: core.bool,
+      [_closed]: core.bool,
+      [_closeCompleter]: async.Completer,
+      [_completer]: async.Completer
+    }),
+    methods: () => ({
+      [_onListen$]: dart.definiteFunctionType(dart.void, []),
+      [_onPause$]: dart.definiteFunctionType(dart.void, []),
+      [_onResume$]: dart.definiteFunctionType(dart.void, []),
+      [_cancel$]: dart.definiteFunctionType(dart.void, []),
+      [_ensureController]: dart.definiteFunctionType(dart.dynamic, []),
+      [_done$]: dart.definiteFunctionType(core.bool, [], [dart.dynamic, core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
+      close: dart.definiteFunctionType(async.Future, []),
+      add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      closeSocket: dart.definiteFunctionType(dart.void, [])
+    })
+  });
+  const _readyState = Symbol('_readyState');
+  const _writeClosed = Symbol('_writeClosed');
+  const _closeCode = Symbol('_closeCode');
+  const _closeReason = Symbol('_closeReason');
+  const _pingInterval = Symbol('_pingInterval');
+  const _pingTimer = Symbol('_pingTimer');
+  const _consumer = Symbol('_consumer');
+  const _closeTimer = Symbol('_closeTimer');
+  let const$81;
+  io._WebSocketImpl = class _WebSocketImpl extends dart.mixin(async.Stream, io._ServiceObject) {
+    static connect(url, protocols, headers, opts) {
+      let compression = opts && 'compression' in opts ? opts.compression : io.CompressionOptions.DEFAULT;
+      let uri = core.Uri.parse(url);
+      if (uri.scheme != "ws" && uri.scheme != "wss") {
+        dart.throw(new io.WebSocketException(dart.str`Unsupported URL scheme '${uri.scheme}'`));
+      }
+      let random = math.Random.new();
+      let nonceData = typed_data.Uint8List.new(16);
+      for (let i = 0; i < 16; i++) {
+        nonceData[dartx._set](i, random.nextInt(256));
+      }
+      let nonce = io._CryptoUtils.bytesToBase64(nonceData);
+      uri = core.Uri.new({scheme: uri.scheme == "wss" ? "https" : "http", userInfo: uri.userInfo, host: uri.host, port: uri.port, path: uri.path, query: uri.query, fragment: uri.fragment});
+      return io._WebSocketImpl._httpClient.openUrl("GET", uri).then(io.HttpClientResponse)(dart.fn(request => {
+        if (uri.userInfo != null && !dart.test(uri.userInfo[dartx.isEmpty])) {
+          let auth = io._CryptoUtils.bytesToBase64(convert.UTF8.encode(uri.userInfo));
+          request.headers.set(io.HttpHeaders.AUTHORIZATION, dart.str`Basic ${auth}`);
+        }
+        if (headers != null) {
+          headers[dartx.forEach](dart.fn((field, value) => request.headers.add(field, value), StringAnddynamicTovoid()));
+        }
+        let _ = request.headers;
+        _.set(io.HttpHeaders.CONNECTION, "Upgrade");
+        _.set(io.HttpHeaders.UPGRADE, "websocket");
+        _.set("Sec-WebSocket-Key", nonce);
+        _.set("Cache-Control", "no-cache");
+        _.set("Sec-WebSocket-Version", "13");
+        if (protocols != null) {
+          request.headers.add("Sec-WebSocket-Protocol", protocols[dartx.toList]());
+        }
+        if (dart.test(compression.enabled)) {
+          request.headers.add("Sec-WebSocket-Extensions", compression[_createHeader]());
+        }
+        return request.close();
+      }, HttpClientRequestToFutureOfHttpClientResponse())).then(io.WebSocket)(dart.fn(response => {
+        function error(message) {
+          response.detachSocket().then(dart.dynamic)(dart.fn(socket => {
+            socket.destroy();
+          }, SocketToNull()));
+          dart.throw(new io.WebSocketException(message));
+        }
+        dart.fn(error, StringTovoid$());
+        if (response.statusCode != io.HttpStatus.SWITCHING_PROTOCOLS || response.headers._get(io.HttpHeaders.CONNECTION) == null || !dart.test(response.headers._get(io.HttpHeaders.CONNECTION)[dartx.any](dart.fn(value => value[dartx.toLowerCase]() == "upgrade", StringTobool$()))) || response.headers.value(io.HttpHeaders.UPGRADE)[dartx.toLowerCase]() != "websocket") {
+          error(dart.str`Connection to '${uri}' was not upgraded to websocket`);
+        }
+        let accept = response.headers.value("Sec-WebSocket-Accept");
+        if (accept == null) {
+          error("Response did not contain a 'Sec-WebSocket-Accept' header");
+        }
+        let sha1 = new io._SHA1();
+        sha1.add(dart.str`${nonce}${io._webSocketGUID}`[dartx.codeUnits]);
+        let expectedAccept = sha1.close();
+        let receivedAccept = io._CryptoUtils.base64StringToBytes(accept);
+        if (expectedAccept[dartx.length] != receivedAccept[dartx.length]) {
+          error("Reasponse header 'Sec-WebSocket-Accept' is the wrong length");
+        }
+        for (let i = 0; i < dart.notNull(expectedAccept[dartx.length]); i++) {
+          if (expectedAccept[dartx._get](i) != receivedAccept[dartx._get](i)) {
+            error("Bad response 'Sec-WebSocket-Accept' header");
+          }
+        }
+        let protocol = response.headers.value('Sec-WebSocket-Protocol');
+        let deflate = io._WebSocketImpl.negotiateClientCompression(response, compression);
+        return response.detachSocket().then(io.WebSocket)(dart.fn(socket => new io._WebSocketImpl._fromSocket(socket, protocol, compression, false, deflate), SocketTo_WebSocketImpl()));
+      }, HttpClientResponseToFutureOfWebSocket()));
+    }
+    static negotiateClientCompression(response, compression) {
+      let extensionHeader = response.headers.value('Sec-WebSocket-Extensions');
+      if (extensionHeader == null) {
+        extensionHeader = "";
+      }
+      let hv = io.HeaderValue.parse(extensionHeader, {valueSeparator: ','});
+      if (dart.test(compression.enabled) && hv.value == io._WebSocketImpl.PER_MESSAGE_DEFLATE) {
+        let serverNoContextTakeover = hv.parameters[dartx.containsKey](io._serverNoContextTakeover);
+        let clientNoContextTakeover = hv.parameters[dartx.containsKey](io._clientNoContextTakeover);
+        function getWindowBits(type) {
+          let o = hv.parameters[dartx._get](type);
+          if (o == null) {
+            return io._WebSocketImpl.DEFAULT_WINDOW_BITS;
+          }
+          return core.int.parse(o, {onError: dart.fn(s => io._WebSocketImpl.DEFAULT_WINDOW_BITS, StringToint$())});
+        }
+        dart.fn(getWindowBits, StringToint$());
+        return new io._WebSocketPerMessageDeflate({clientMaxWindowBits: getWindowBits(io._clientMaxWindowBits), serverMaxWindowBits: getWindowBits(io._serverMaxWindowBits), clientNoContextTakeover: clientNoContextTakeover, serverNoContextTakeover: serverNoContextTakeover});
+      }
+      return null;
+    }
+    _fromSocket(socket, protocol, compression, serverSide, deflate) {
+      if (serverSide === void 0) serverSide = false;
+      if (deflate === void 0) deflate = null;
+      this[_socket] = socket;
+      this.protocol = protocol;
+      this[_serverSide] = serverSide;
+      this[_controller$0] = null;
+      this[_subscription$] = null;
+      this[_sink$0] = null;
+      this[_readyState] = io.WebSocket.CONNECTING;
+      this[_writeClosed] = false;
+      this[_closeCode] = null;
+      this[_closeReason] = null;
+      this[_pingInterval] = null;
+      this[_pingTimer] = null;
+      this[_consumer] = null;
+      this[_outCloseCode] = null;
+      this[_outCloseReason] = null;
+      this[_closeTimer] = null;
+      this[_deflate] = null;
+      super.new();
+      this[_consumer] = new io._WebSocketConsumer(this, io.Socket._check(this[_socket]));
+      this[_sink$0] = new io._StreamSinkImpl(this[_consumer]);
+      this[_readyState] = io.WebSocket.OPEN;
+      this[_deflate] = deflate;
+      let transformer = new io._WebSocketProtocolTransformer(this[_serverSide], this[_deflate]);
+      this[_subscription$] = async.StreamSubscription._check(dart.dsend(dart.dsend(this[_socket], 'transform', transformer), 'listen', dart.fn(data => {
+        if (io._WebSocketPing.is(data)) {
+          if (!dart.test(this[_writeClosed])) this[_consumer].add(new io._WebSocketPong(data.payload));
+        } else if (io._WebSocketPong.is(data)) {
+          this.pingInterval = this[_pingInterval];
+        } else {
+          this[_controller$0].add(data);
+        }
+      }, dynamicToNull$()), {onError: dart.fn((error, stackTrace) => {
+          if (this[_closeTimer] != null) this[_closeTimer].cancel();
+          if (core.FormatException.is(error)) {
+            this[_close$0](io.WebSocketStatus.INVALID_FRAME_PAYLOAD_DATA);
+          } else {
+            this[_close$0](io.WebSocketStatus.PROTOCOL_ERROR);
+          }
+          this[_closeCode] = this[_outCloseCode];
+          this[_closeReason] = this[_outCloseReason];
+          this[_controller$0].close();
+        }, dynamicAnddynamicToNull()), onDone: dart.fn(() => {
+          if (this[_closeTimer] != null) this[_closeTimer].cancel();
+          if (this[_readyState] == io.WebSocket.OPEN) {
+            this[_readyState] = io.WebSocket.CLOSING;
+            if (!dart.test(io._WebSocketImpl._isReservedStatusCode(transformer.closeCode))) {
+              this[_close$0](transformer.closeCode, transformer.closeReason);
+            } else {
+              this[_close$0]();
+            }
+            this[_readyState] = io.WebSocket.CLOSED;
+          }
+          this[_closeCode] = transformer.closeCode;
+          this[_closeReason] = transformer.closeReason;
+          this[_controller$0].close();
+        }, VoidToNull()), cancelOnError: true}));
+      this[_subscription$].pause();
+      this[_controller$0] = async.StreamController.new({sync: true, onListen: dart.bind(this[_subscription$], 'resume'), onCancel: dart.fn(() => {
+          this[_subscription$].cancel();
+          this[_subscription$] = null;
+        }, VoidToNull()), onPause: dart.bind(this[_subscription$], 'pause'), onResume: dart.bind(this[_subscription$], 'resume')});
+      io._WebSocketImpl._webSockets[dartx._set](this[_serviceId], this);
+      try {
+        dart.dput(this[_socket], _owner, this);
+      } catch (_) {
+      }
+
+    }
+    listen(onData, opts) {
+      let onError = opts && 'onError' in opts ? opts.onError : null;
+      let onDone = opts && 'onDone' in opts ? opts.onDone : null;
+      let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
+      return this[_controller$0].stream.listen(onData, {onError: onError, onDone: onDone, cancelOnError: cancelOnError});
+    }
+    get pingInterval() {
+      return this[_pingInterval];
+    }
+    set pingInterval(interval) {
+      if (dart.test(this[_writeClosed])) return;
+      if (this[_pingTimer] != null) this[_pingTimer].cancel();
+      this[_pingInterval] = interval;
+      if (this[_pingInterval] == null) return;
+      this[_pingTimer] = async.Timer.new(this[_pingInterval], dart.fn(() => {
+        if (dart.test(this[_writeClosed])) return;
+        this[_consumer].add(new io._WebSocketPing());
+        this[_pingTimer] = async.Timer.new(this[_pingInterval], dart.fn(() => {
+          this[_close$0](io.WebSocketStatus.GOING_AWAY);
+        }, VoidToNull()));
+      }, VoidToNull()));
+    }
+    get readyState() {
+      return this[_readyState];
+    }
+    get extensions() {
+      return null;
+    }
+    get closeCode() {
+      return this[_closeCode];
+    }
+    get closeReason() {
+      return this[_closeReason];
+    }
+    add(data) {
+      this[_sink$0].add(data);
+    }
+    addError(error, stackTrace) {
+      if (stackTrace === void 0) stackTrace = null;
+      this[_sink$0].addError(error, stackTrace);
+    }
+    addStream(stream) {
+      return this[_sink$0].addStream(stream);
+    }
+    get done() {
+      return this[_sink$0].done;
+    }
+    close(code, reason) {
+      if (code === void 0) code = null;
+      if (reason === void 0) reason = null;
+      if (dart.test(io._WebSocketImpl._isReservedStatusCode(code))) {
+        dart.throw(new io.WebSocketException(dart.str`Reserved status code ${code}`));
+      }
+      if (this[_outCloseCode] == null) {
+        this[_outCloseCode] = code;
+        this[_outCloseReason] = reason;
+      }
+      if (!dart.test(this[_controller$0].isClosed)) {
+        if (!dart.test(this[_controller$0].hasListener) && this[_subscription$] != null) {
+          this[_controller$0].stream.drain(dart.dynamic)().catchError(dart.fn(_ => dart.map(), dynamicToMap()));
+        }
+        if (this[_closeTimer] == null) {
+          this[_closeTimer] = async.Timer.new(const$81 || (const$81 = dart.const(new core.Duration({seconds: 5}))), dart.fn(() => {
+            this[_closeCode] = this[_outCloseCode];
+            this[_closeReason] = this[_outCloseReason];
+            if (this[_subscription$] != null) this[_subscription$].cancel();
+            this[_controller$0].close();
+            io._WebSocketImpl._webSockets[dartx.remove](this[_serviceId]);
+          }, VoidToNull()));
+        }
+      }
+      return this[_sink$0].close();
+    }
+    [_close$0](code, reason) {
+      if (code === void 0) code = null;
+      if (reason === void 0) reason = null;
+      if (dart.test(this[_writeClosed])) return;
+      if (this[_outCloseCode] == null) {
+        this[_outCloseCode] = code;
+        this[_outCloseReason] = reason;
+      }
+      this[_writeClosed] = true;
+      this[_consumer].closeSocket();
+      io._WebSocketImpl._webSockets[dartx.remove](this[_serviceId]);
+    }
+    get [_serviceTypePath]() {
+      return 'io/websockets';
+    }
+    get [_serviceTypeName]() {
+      return 'WebSocket';
+    }
+    [_toJSON$](ref) {
+      let name = dart.str`${dart.dload(dart.dload(this[_socket], 'address'), 'host')}:${dart.dload(this[_socket], 'port')}`;
+      let r = dart.map({id: this[_servicePath], type: this[_serviceType](ref), name: name, user_name: name}, core.String, dart.dynamic);
+      if (dart.test(ref)) {
+        return r;
+      }
+      try {
+        r[dartx._set]('socket', dart.dsend(this[_socket], _toJSON$, true));
+      } catch (_) {
+        r[dartx._set]('socket', dart.map({id: this[_servicePath], type: '@Socket', name: 'UserSocket', user_name: 'UserSocket'}, core.String, core.String));
+      }
+
+      return r;
+    }
+    static _isReservedStatusCode(code) {
+      return code != null && (dart.notNull(code) < io.WebSocketStatus.NORMAL_CLOSURE || code == io.WebSocketStatus.RESERVED_1004 || code == io.WebSocketStatus.NO_STATUS_RECEIVED || code == io.WebSocketStatus.ABNORMAL_CLOSURE || dart.notNull(code) > io.WebSocketStatus.INTERNAL_SERVER_ERROR && dart.notNull(code) < io.WebSocketStatus.RESERVED_1015 || dart.notNull(code) >= io.WebSocketStatus.RESERVED_1015 && dart.notNull(code) < 3000);
+    }
+  };
+  dart.addSimpleTypeTests(io._WebSocketImpl);
+  dart.defineNamedConstructor(io._WebSocketImpl, '_fromSocket');
+  io._WebSocketImpl[dart.implements] = () => [io.WebSocket];
+  dart.setSignature(io._WebSocketImpl, {
+    constructors: () => ({_fromSocket: dart.definiteFunctionType(io._WebSocketImpl, [dart.dynamic, core.String, io.CompressionOptions], [core.bool, io._WebSocketPerMessageDeflate])}),
+    fields: () => ({
+      protocol: core.String,
+      [_controller$0]: async.StreamController,
+      [_subscription$]: async.StreamSubscription,
+      [_sink$0]: async.StreamSink,
+      [_socket]: dart.dynamic,
+      [_serverSide]: core.bool,
+      [_readyState]: core.int,
+      [_writeClosed]: core.bool,
+      [_closeCode]: core.int,
+      [_closeReason]: core.String,
+      [_pingInterval]: core.Duration,
+      [_pingTimer]: async.Timer,
+      [_consumer]: io._WebSocketConsumer,
+      [_outCloseCode]: core.int,
+      [_outCloseReason]: core.String,
+      [_closeTimer]: async.Timer,
+      [_deflate]: io._WebSocketPerMessageDeflate
+    }),
+    getters: () => ({
+      pingInterval: dart.definiteFunctionType(core.Duration, []),
+      readyState: dart.definiteFunctionType(core.int, []),
+      extensions: dart.definiteFunctionType(core.String, []),
+      closeCode: dart.definiteFunctionType(core.int, []),
+      closeReason: dart.definiteFunctionType(core.String, []),
+      done: dart.definiteFunctionType(async.Future, []),
+      [_serviceTypePath]: dart.definiteFunctionType(core.String, []),
+      [_serviceTypeName]: dart.definiteFunctionType(core.String, [])
+    }),
+    setters: () => ({pingInterval: dart.definiteFunctionType(dart.void, [core.Duration])}),
+    methods: () => ({
+      listen: dart.definiteFunctionType(async.StreamSubscription, [dynamicTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
+      add: dart.definiteFunctionType(dart.void, [dart.dynamic]),
+      addError: dart.definiteFunctionType(dart.void, [dart.dynamic], [core.StackTrace]),
+      addStream: dart.definiteFunctionType(async.Future, [async.Stream]),
+      close: dart.definiteFunctionType(async.Future, [], [core.int, core.String]),
+      [_close$0]: dart.definiteFunctionType(dart.void, [], [core.int, core.String]),
+      [_toJSON$]: dart.definiteFunctionType(core.Map$(core.String, dart.dynamic), [core.bool])
+    }),
+    sfields: () => ({
+      _webSockets: MapOfint$_WebSocketImpl(),
+      DEFAULT_WINDOW_BITS: core.int,
+      PER_MESSAGE_DEFLATE: core.String,
+      _httpClient: io.HttpClient
+    }),
+    statics: () => ({
+      connect: dart.definiteFunctionType(async.Future$(io.WebSocket), [core.String, IterableOfString(), MapOfString$dynamic()], {compression: io.CompressionOptions}),
+      negotiateClientCompression: dart.definiteFunctionType(io._WebSocketPerMessageDeflate, [io.HttpClientResponse, io.CompressionOptions]),
+      _isReservedStatusCode: dart.definiteFunctionType(core.bool, [core.int])
+    }),
+    names: ['connect', 'negotiateClientCompression', '_isReservedStatusCode']
+  });
+  io._WebSocketImpl.DEFAULT_WINDOW_BITS = 15;
+  io._WebSocketImpl.PER_MESSAGE_DEFLATE = "permessage-deflate";
+  dart.defineLazy(io._WebSocketImpl, {
+    get _webSockets() {
+      return MapOfint$_WebSocketImpl().new();
+    },
+    set _webSockets(_) {},
+    get _httpClient() {
+      return io.HttpClient.new();
+    }
+  });
   isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
     new(message) {
       this.message = message;
@@ -37353,11 +52556,11 @@
       controller = async.StreamController.broadcast({sync: true, onListen: dart.fn(() => {
           port = isolate.RawReceivePort.new(handleError);
           this.addErrorListener(port.sendPort);
-        }, VoidTovoid$()), onCancel: dart.fn(() => {
+        }, VoidToNull()), onCancel: dart.fn(() => {
           this.removeErrorListener(port.sendPort);
           port.close();
           port = null;
-        }, VoidTovoid$())});
+        }, VoidToNull())});
       return controller.stream;
     }
   };
@@ -37494,7 +52697,7 @@
   });
   dart.defineLazy(js, {
     get context() {
-      return js._wrapToDart(js._global);
+      return js.JsObject._check(js._wrapToDart(js._global));
     }
   });
   const _jsObject = Symbol('_jsObject');
@@ -37507,22 +52710,22 @@
       if (arguments$ === void 0) arguments$ = null;
       let ctor = constructor[_jsObject];
       if (arguments$ == null) {
-        return js._wrapToDart(new ctor());
+        return js.JsObject._check(js._wrapToDart(new ctor()));
       }
       let unwrapped = core.List.from(arguments$[dartx.map](dart.dynamic)(js._convertToJS));
-      return js._wrapToDart(new ctor(...unwrapped));
+      return js.JsObject._check(js._wrapToDart(new ctor(...unwrapped)));
     }
     static fromBrowserObject(object) {
       if (typeof object == 'number' || typeof object == 'string' || typeof object == 'boolean' || object == null) {
         dart.throw(new core.ArgumentError("object cannot be a num, string, bool, or null"));
       }
-      return js._wrapToDart(js._convertToJS(object));
+      return js.JsObject._check(js._wrapToDart(js._convertToJS(object)));
     }
     static jsify(object) {
       if (!core.Map.is(object) && !core.Iterable.is(object)) {
         dart.throw(new core.ArgumentError("object must be a Map or Iterable"));
       }
-      return js._wrapToDart(js.JsObject._convertDataTree(object));
+      return js.JsObject._check(js._wrapToDart(js.JsObject._convertDataTree(object)));
     }
     static _convertDataTree(data) {
       let _convertedObjects = collection.HashMap.identity();
@@ -37598,7 +52801,7 @@
       }
       if (args != null) args = core.List.from(args[dartx.map](dart.dynamic)(js._convertToJS));
       let fn = this[_jsObject][method];
-      if (!(fn instanceof Function)) {
+      if (typeof fn !== "function") {
         dart.throw(new core.NoSuchMethodError(this[_jsObject], core.Symbol.new(core.String._check(method)), args, dart.map({}, core.Symbol, dart.dynamic)));
       }
       return js._convertToDart(fn.apply(this[_jsObject], args));
@@ -37770,14 +52973,7 @@
         [_checkIndex]: dart.definiteFunctionType(dart.dynamic, [core.int]),
         [_checkInsertIndex]: dart.definiteFunctionType(dart.dynamic, [core.int]),
         _get: dart.definiteFunctionType(E, [core.Object]),
-        _set: dart.definiteFunctionType(dart.void, [core.Object, E]),
-        add: dart.definiteFunctionType(dart.void, [E]),
-        addAll: dart.definiteFunctionType(dart.void, [IterableOfE()]),
-        insert: dart.definiteFunctionType(dart.void, [core.int, E]),
-        removeAt: dart.definiteFunctionType(E, [core.int]),
-        removeLast: dart.definiteFunctionType(E, []),
-        setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()], [core.int]),
-        sort: dart.definiteFunctionType(dart.void, [], [EAndEToint()])
+        _set: dart.definiteFunctionType(dart.void, [core.Object, E])
       }),
       statics: () => ({_checkRange: dart.definiteFunctionType(dart.dynamic, [core.int, core.int, core.int])}),
       names: ['_checkRange']
@@ -37800,7 +52996,7 @@
   });
   js.JsArray = JsArray();
   js._isBrowserType = function(o) {
-    return o instanceof Blob || o instanceof Event || window.KeyRange && o instanceof KeyRange || o instanceof ImageData || o instanceof Node || window.TypedData && o instanceof TypedData || o instanceof Window;
+    return o instanceof Object && (o instanceof Blob || o instanceof Event || window.KeyRange && o instanceof KeyRange || window.IDBKeyRange && o instanceof IDBKeyRange || o instanceof ImageData || o instanceof Node || window.Int8Array && o instanceof Int8Array.__proto__ || o instanceof Window);
   };
   dart.fn(js._isBrowserType, dynamicTobool$());
   const _dartObj = Symbol('_dartObj');
@@ -37845,11 +53041,15 @@
     } else if (js._DartObject.is(o) && dart.jsobject != dart.getReifiedType(o)) {
       return o[_dartObj];
     } else {
-      return js._putIfAbsent(js._dartProxies, o, js._wrapToDart);
+      return js._wrapToDart(o);
     }
   };
   dart.fn(js._convertToDart, dynamicToObject());
   js._wrapToDart = function(o) {
+    return js._putIfAbsent(js._dartProxies, o, js._wrapToDartHelper);
+  };
+  dart.fn(js._wrapToDart, dynamicToObject());
+  js._wrapToDartHelper = function(o) {
     if (typeof o == "function") {
       return new js.JsFunction._fromJs(o);
     }
@@ -37858,7 +53058,7 @@
     }
     return new js.JsObject._fromJs(o);
   };
-  dart.fn(js._wrapToDart, dynamicToJsObject());
+  dart.fn(js._wrapToDartHelper, dynamicToObject());
   dart.defineLazy(js, {
     get _dartProxies() {
       return new WeakMap();
@@ -38223,11 +53423,11 @@
   math._Random._POW2_53_D = 1.0 * 9007199254740992;
   math._Random._POW2_27_D = 1.0 * (1 << 27);
   math._Random._MASK32 = 4294967295;
-  const _buffer$ = Symbol('_buffer');
+  const _buffer$0 = Symbol('_buffer');
   const _getRandomBytes = Symbol('_getRandomBytes');
   math._JSSecureRandom = class _JSSecureRandom extends core.Object {
     new() {
-      this[_buffer$] = typed_data.ByteData.new(8);
+      this[_buffer$0] = typed_data.ByteData.new(8);
       let crypto = self.crypto;
       if (crypto != null) {
         let getRandomValues = crypto.getRandomValues;
@@ -38238,18 +53438,18 @@
       dart.throw(new core.UnsupportedError("No source of cryptographically secure random numbers available."));
     }
     [_getRandomBytes](start, length) {
-      crypto.getRandomValues(this[_buffer$][dartx.buffer][dartx.asUint8List](start, length));
+      crypto.getRandomValues(this[_buffer$0][dartx.buffer][dartx.asUint8List](start, length));
     }
     nextBool() {
       this[_getRandomBytes](0, 1);
-      return this[_buffer$][dartx.getUint8](0)[dartx.isOdd];
+      return this[_buffer$0][dartx.getUint8](0)[dartx.isOdd];
     }
     nextDouble() {
       this[_getRandomBytes](1, 7);
-      this[_buffer$][dartx.setUint8](0, 63);
-      let highByte = this[_buffer$][dartx.getUint8](1);
-      this[_buffer$][dartx.setUint8](1, (dart.notNull(highByte) | 240) >>> 0);
-      let result = dart.notNull(this[_buffer$][dartx.getFloat64](0)) - 1.0;
+      this[_buffer$0][dartx.setUint8](0, 63);
+      let highByte = this[_buffer$0][dartx.getUint8](1);
+      this[_buffer$0][dartx.setUint8](1, (dart.notNull(highByte) | 240) >>> 0);
+      let result = dart.notNull(this[_buffer$0][dartx.getFloat64](0)) - 1.0;
       if ((dart.notNull(highByte) & 16) != 0) {
         result = result + 1.1102230246251565e-16;
       }
@@ -38269,12 +53469,12 @@
           }
         }
       }
-      this[_buffer$][dartx.setUint32](0, 0);
+      this[_buffer$0][dartx.setUint32](0, 0);
       let start = 4 - byteCount;
       let randomLimit = dart.asInt(math.pow(256, byteCount));
       while (true) {
         this[_getRandomBytes](start, byteCount);
-        let random = this[_buffer$][dartx.getUint32](0);
+        let random = this[_buffer$0][dartx.getUint32](0);
         if ((dart.notNull(max) & dart.notNull(max) - 1) == 0) {
           return (dart.notNull(random) & dart.notNull(max) - 1) >>> 0;
         }
@@ -38288,7 +53488,7 @@
   math._JSSecureRandom[dart.implements] = () => [math.Random];
   dart.setSignature(math._JSSecureRandom, {
     constructors: () => ({new: dart.definiteFunctionType(math._JSSecureRandom, [])}),
-    fields: () => ({[_buffer$]: typed_data.ByteData}),
+    fields: () => ({[_buffer$0]: typed_data.ByteData}),
     methods: () => ({
       [_getRandomBytes]: dart.definiteFunctionType(dart.void, [core.int, core.int]),
       nextBool: dart.definiteFunctionType(core.bool, []),
@@ -38386,11 +53586,11 @@
     return Point;
   });
   math.Point = Point$();
-  let const$52;
+  let const$82;
   math.Random = class Random extends core.Object {
     static new(seed) {
       if (seed === void 0) seed = null;
-      return seed == null ? const$52 || (const$52 = dart.const(new math._JSRandom())) : new math._Random(seed);
+      return seed == null ? const$82 || (const$82 = dart.const(new math._JSRandom())) : new math._Random(seed);
     }
     static secure() {
       return math.Random._secureRandom;
@@ -39250,7 +54450,7 @@
   indexed_db._idbKey = 'JSExtendableArray|=Object|num|String';
   indexed_db._annotation_Creates_IDBKey = dart.const(new _js_helper.Creates(indexed_db._idbKey));
   indexed_db._annotation_Returns_IDBKey = dart.const(new _js_helper.Returns(indexed_db._idbKey));
-  const _delete = Symbol('_delete');
+  const _delete$ = Symbol('_delete');
   const _update = Symbol('_update');
   const _update_1 = Symbol('_update_1');
   dart.defineExtensionNames([
@@ -39267,7 +54467,7 @@
   indexed_db.Cursor = class Cursor extends _interceptors.Interceptor {
     [dartx.delete]() {
       try {
-        return indexed_db._completeRequest(dart.dynamic)(this[_delete]());
+        return indexed_db._completeRequest(dart.dynamic)(this[_delete$]());
       } catch (e) {
         let stacktrace = dart.stackTrace(e);
         return async.Future.error(e, stacktrace);
@@ -39312,7 +54512,7 @@
     [dartx.continuePrimaryKey](...args) {
       return this.continuePrimaryKey.apply(this, args);
     }
-    [_delete](...args) {
+    [_delete$](...args) {
       return this.delete.apply(this, args);
     }
     [_update](value) {
@@ -39337,7 +54537,7 @@
       [dartx.next]: dart.definiteFunctionType(dart.void, [], [core.Object]),
       [dartx.advance]: dart.definiteFunctionType(dart.void, [core.int]),
       [dartx.continuePrimaryKey]: dart.definiteFunctionType(dart.void, [core.Object, core.Object]),
-      [_delete]: dart.definiteFunctionType(indexed_db.Request, []),
+      [_delete$]: dart.definiteFunctionType(indexed_db.Request, []),
       [_update]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
       [_update_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic])
     })
@@ -39625,7 +54825,7 @@
         let completer = CompleterOfIdbFactory().sync();
         request[dartx.onSuccess].listen(dart.fn(e => {
           completer.complete(this);
-        }, EventTovoid$()));
+        }, EventToNull()));
         request[dartx.onError].listen(dart.bind(completer, 'completeError'));
         return completer.future;
       } catch (e) {
@@ -39684,7 +54884,7 @@
       request[dartx.onSuccess].listen(dart.fn(e => {
         let result = indexed_db._cast(T)(request[dartx.result]);
         completer.complete(result);
-      }, EventTovoid$()));
+      }, EventToNull()));
       request[dartx.onError].listen(dart.bind(completer, 'completeError'));
       return completer.future;
     };
@@ -39912,7 +55112,7 @@
     names: ['bound_', 'lowerBound_', 'only_', 'upperBound_']
   });
   dart.registerExtension(dart.global.IDBKeyRange, indexed_db.KeyRange);
-  const _add$2 = Symbol('_add');
+  const _add$3 = Symbol('_add');
   const _clear$0 = Symbol('_clear');
   const _put = Symbol('_put');
   const _createIndex = Symbol('_createIndex');
@@ -39948,9 +55148,9 @@
       try {
         let request = null;
         if (key != null) {
-          request = this[_add$2](value, key);
+          request = this[_add$3](value, key);
         } else {
-          request = this[_add$2](value);
+          request = this[_add$3](value);
         }
         return indexed_db._completeRequest(dart.dynamic)(indexed_db.Request._check(request));
       } catch (e) {
@@ -39970,7 +55170,7 @@
     }
     [dartx.delete](key_OR_keyRange) {
       try {
-        return indexed_db._completeRequest(dart.dynamic)(this[_delete](key_OR_keyRange));
+        return indexed_db._completeRequest(dart.dynamic)(this[_delete$](key_OR_keyRange));
       } catch (e) {
         let stacktrace = dart.stackTrace(e);
         return async.Future.error(e, stacktrace);
@@ -40066,7 +55266,7 @@
     get [dartx.transaction]() {
       return this.transaction;
     }
-    [_add$2](value, key) {
+    [_add$3](value, key) {
       if (key === void 0) key = null;
       if (key != null) {
         let value_1 = html_common.convertDartToNative_SerializedScriptValue(value);
@@ -40102,7 +55302,7 @@
     [_createIndex_2](...args) {
       return this.createIndex.apply(this, args);
     }
-    [_delete](...args) {
+    [_delete$](...args) {
       return this.delete.apply(this, args);
     }
     [dartx.deleteIndex](...args) {
@@ -40156,7 +55356,7 @@
               cursor[dartx.next]();
             }
           }
-        }, EventTovoid$()));
+        }, EventToNull()));
         return controller.stream;
       };
     }
@@ -40179,7 +55379,7 @@
       [dartx.getObject]: dart.definiteFunctionType(async.Future, [dart.dynamic]),
       [dartx.openCursor]: dart.definiteFunctionType(async.Stream$(indexed_db.CursorWithValue), [], {key: dart.dynamic, range: indexed_db.KeyRange, direction: core.String, autoAdvance: core.bool}),
       [dartx.createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, dart.dynamic], {unique: core.bool, multiEntry: core.bool}),
-      [_add$2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
+      [_add$3]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic], [dart.dynamic]),
       [_add_1]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic, dart.dynamic]),
       [_add_2]: dart.definiteFunctionType(indexed_db.Request, [dart.dynamic]),
       [_clear$0]: dart.definiteFunctionType(indexed_db.Request, []),
@@ -40187,7 +55387,7 @@
       [_createIndex]: dart.definiteFunctionType(indexed_db.Index, [core.String, core.Object], [core.Map]),
       [_createIndex_1]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic, dart.dynamic]),
       [_createIndex_2]: dart.definiteFunctionType(indexed_db.Index, [dart.dynamic, dart.dynamic]),
-      [_delete]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
+      [_delete$]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
       [dartx.deleteIndex]: dart.definiteFunctionType(dart.void, [core.String]),
       [_get$]: dart.definiteFunctionType(indexed_db.Request, [core.Object]),
       [dartx.getAll]: dart.definiteFunctionType(indexed_db.Request, [core.Object], [core.int]),
@@ -40329,15 +55529,15 @@
       let completer = CompleterOfDatabase().new();
       this[dartx.onComplete].first.then(dart.dynamic)(dart.fn(_ => {
         completer.complete(this[dartx.db]);
-      }, EventTodynamic()));
+      }, EventToNull()));
       this[dartx.onError].first.then(dart.dynamic)(dart.fn(e => {
         completer.completeError(e);
-      }, EventTodynamic()));
+      }, EventToNull()));
       this[dartx.onAbort].first.then(dart.dynamic)(dart.fn(e => {
         if (!dart.test(completer.isCompleted)) {
           completer.completeError(e);
         }
-      }, EventTodynamic()));
+      }, EventToNull()));
       return completer.future;
     }
     static _() {
@@ -40468,10 +55668,10 @@
       return html$.Event._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new Event(type, eventInitDict);
+      return new self.Event(type, eventInitDict);
     }
     static _create_2(type) {
-      return new Event(type);
+      return new self.Event(type);
     }
     get [dartx.bubbles]() {
       return this.bubbles;
@@ -43178,10 +58378,10 @@
       return html$.AnimationEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new AnimationEvent(type, eventInitDict);
+      return new self.AnimationEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new AnimationEvent(type);
+      return new self.AnimationEvent(type);
     }
     get [dartx.animationName]() {
       return this.animationName;
@@ -43223,10 +58423,10 @@
       return html$.AnimationPlayerEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new AnimationPlayerEvent(type, eventInitDict);
+      return new self.AnimationPlayerEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new AnimationPlayerEvent(type);
+      return new self.AnimationPlayerEvent(type);
     }
     get [dartx.currentTime]() {
       return this.currentTime;
@@ -43463,10 +58663,10 @@
       return html$.ApplicationCacheErrorEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ApplicationCacheErrorEvent(type, eventInitDict);
+      return new self.ApplicationCacheErrorEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ApplicationCacheErrorEvent(type);
+      return new self.ApplicationCacheErrorEvent(type);
     }
     get [dartx.message]() {
       return this.message;
@@ -44167,10 +59367,10 @@
       return html$.AutocompleteErrorEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new AutocompleteErrorEvent(type, eventInitDict);
+      return new self.AutocompleteErrorEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new AutocompleteErrorEvent(type);
+      return new self.AutocompleteErrorEvent(type);
     }
     get [dartx.reason]() {
       return this.reason;
@@ -44318,10 +59518,10 @@
       return html$.BeforeInstallPromptEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new BeforeInstallPromptEvent(type, eventInitDict);
+      return new self.BeforeInstallPromptEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new BeforeInstallPromptEvent(type);
+      return new self.BeforeInstallPromptEvent(type);
     }
     get [dartx.platforms]() {
       return this.platforms;
@@ -44403,10 +59603,10 @@
       return html$.Blob._check(html$.Blob._create_2(blobParts, bag));
     }
     static _create_1(parts) {
-      return new Blob(parts);
+      return new self.Blob(parts);
     }
     static _create_2(parts, bag) {
-      return new Blob(parts, bag);
+      return new self.Blob(parts, bag);
     }
     static _create_bag() {
       return {};
@@ -45892,7 +61092,7 @@
       return html$.CircularGeofencingRegion._create_1(init_1);
     }
     static _create_1(init) {
-      return new CircularGeofencingRegion(init);
+      return new self.CircularGeofencingRegion(init);
     }
     get [dartx.latitude]() {
       return this.latitude;
@@ -46054,10 +61254,10 @@
       return html$.CloseEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new CloseEvent(type, eventInitDict);
+      return new self.CloseEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new CloseEvent(type);
+      return new self.CloseEvent(type);
     }
     get [dartx.code]() {
       return this.code;
@@ -46138,10 +61338,10 @@
       return html$.UIEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new UIEvent(type, eventInitDict);
+      return new self.UIEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new UIEvent(type);
+      return new self.UIEvent(type);
     }
     get [_charCode]() {
       return this.charCode;
@@ -46220,10 +61420,10 @@
       return html$.CompositionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new CompositionEvent(type, eventInitDict);
+      return new self.CompositionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new CompositionEvent(type);
+      return new self.CompositionEvent(type);
     }
     get [dartx.data]() {
       return this.data;
@@ -46262,7 +61462,7 @@
       return html$.CompositorProxy._create_1(element, attributeArray);
     }
     static _create_1(element, attributeArray) {
-      return new CompositorProxy(element, attributeArray);
+      return new self.CompositorProxy(element, attributeArray);
     }
     get [dartx.opacity]() {
       return this.opacity;
@@ -46328,7 +61528,7 @@
       return html$.CompositorWorker._create_1(scriptUrl);
     }
     static _create_1(scriptUrl) {
-      return new CompositorWorker(scriptUrl);
+      return new self.CompositorWorker(scriptUrl);
     }
     [dartx.postMessage](message, transfer) {
       if (transfer === void 0) transfer = null;
@@ -46474,9 +61674,9 @@
       let completer = CompleterOfFileSystem().new();
       this[_webkitRequestFileSystem](type, size, dart.fn(value => {
         completer.complete(value);
-      }, FileSystemTovoid()), dart.fn(error => {
+      }, FileSystemToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.requestFileSystemSync](...args) {
@@ -46492,9 +61692,9 @@
       let completer = CompleterOfEntry().new();
       this[_webkitResolveLocalFileSystemUrl](url, dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), dart.fn(error => {
+      }, EntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.atob](...args) {
@@ -47435,7 +62635,7 @@
   const _pageBreakAfter = Symbol('_pageBreakAfter');
   const _pageBreakBefore = Symbol('_pageBreakBefore');
   const _pageBreakInside = Symbol('_pageBreakInside');
-  const _position$0 = Symbol('_position');
+  const _position$1 = Symbol('_position');
   const _quotes = Symbol('_quotes');
   const _right = Symbol('_right');
   const _tableLayout = Symbol('_tableLayout');
@@ -52734,15 +67934,15 @@
       this.pageBreakInside = value;
     }
     get [dartx.position]() {
-      return this[_position$0];
+      return this[_position$1];
     }
     set [dartx.position](value) {
-      this[_position$0] = value == null ? '' : value;
+      this[_position$1] = value == null ? '' : value;
     }
-    get [_position$0]() {
+    get [_position$1]() {
       return this.position;
     }
-    set [_position$0](value) {
+    set [_position$1](value) {
       this.position = value;
     }
     get [dartx.quotes]() {
@@ -53010,7 +68210,7 @@
       [_pageBreakAfter]: core.String,
       [_pageBreakBefore]: core.String,
       [_pageBreakInside]: core.String,
-      [_position$0]: core.String,
+      [_position$1]: core.String,
       [_quotes]: core.String,
       [_right]: core.String,
       [_tableLayout]: core.String,
@@ -53952,10 +69152,10 @@
       return html$.CustomEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new CustomEvent(type, eventInitDict);
+      return new self.CustomEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new CustomEvent(type);
+      return new self.CustomEvent(type);
     }
     get [_detail]() {
       return html_common.convertNativeToDart_SerializedScriptValue(this[_get__detail]);
@@ -54134,7 +69334,7 @@
       let completer = CompleterOfString().new();
       this[_getAsString](dart.fn(value => {
         completer.complete(value);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     [dartx.getAsEntry](...args) {
@@ -54270,10 +69470,10 @@
       return html$.DefaultSessionStartEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new DefaultSessionStartEvent(type, eventInitDict);
+      return new self.DefaultSessionStartEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new DefaultSessionStartEvent(type);
+      return new self.DefaultSessionStartEvent(type);
     }
     get [dartx.session]() {
       return this.session;
@@ -54423,10 +69623,10 @@
       return html$.DeviceLightEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new DeviceLightEvent(type, eventInitDict);
+      return new self.DeviceLightEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new DeviceLightEvent(type);
+      return new self.DeviceLightEvent(type);
     }
     get [dartx.value]() {
       return this.value;
@@ -54676,9 +69876,9 @@
       let completer = CompleterOfEntry().new();
       this[_copyTo](parent, {name: name, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [_getMetadata](...args) {
@@ -54688,9 +69888,9 @@
       let completer = CompleterOfMetadata().new();
       this[_getMetadata](dart.fn(value => {
         completer.complete(value);
-      }, MetadataTovoid()), dart.fn(error => {
+      }, MetadataToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [_getParent](...args) {
@@ -54700,9 +69900,9 @@
       let completer = CompleterOfEntry().new();
       this[_getParent](dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), dart.fn(error => {
+      }, EntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [_moveTo](...args) {
@@ -54713,9 +69913,9 @@
       let completer = CompleterOfEntry().new();
       this[_moveTo](parent, {name: name, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [_remove$](...args) {
@@ -54725,9 +69925,9 @@
       let completer = async.Completer.new();
       this[_remove$](dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.toUrl](...args) {
@@ -54826,9 +70026,9 @@
       let completer = CompleterOfEntry().new();
       this[__getDirectory](path, {options: options, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [__getFile](path, opts) {
@@ -54870,9 +70070,9 @@
       let completer = CompleterOfEntry().new();
       this[__getFile](path, {options: options, successCallback: dart.fn(value => {
           completer.complete(value);
-        }, EntryTovoid()), errorCallback: dart.fn(error => {
+        }, EntryToNull()), errorCallback: dart.fn(error => {
           completer.completeError(error);
-        }, FileErrorTovoid())});
+        }, FileErrorToNull())});
       return completer.future;
     }
     [_removeRecursively](...args) {
@@ -54882,9 +70082,9 @@
       let completer = async.Completer.new();
       this[_removeRecursively](dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
   };
@@ -54928,9 +70128,9 @@
       let completer = CompleterOfListOfEntry().new();
       this[_readEntries](dart.fn(value => {
         completer.complete(value);
-      }, ListOfEntryTovoid()), dart.fn(error => {
+      }, ListOfEntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
   };
@@ -54964,7 +70164,7 @@
   dart.registerExtension(dart.global.HTMLDivElement, html$.DivElement);
   const _body = Symbol('_body');
   const _get_window = Symbol('_get_window');
-  const _head$ = Symbol('_head');
+  const _head$0 = Symbol('_head');
   const _lastModified = Symbol('_lastModified');
   const _preferredStylesheetSet = Symbol('_preferredStylesheetSet');
   const _referrer = Symbol('_referrer');
@@ -55153,7 +70353,7 @@
     get [dartx.fullscreenEnabled]() {
       return this.fullscreenEnabled;
     }
-    get [_head$]() {
+    get [_head$0]() {
       return this.head;
     }
     get [dartx.hidden]() {
@@ -55599,7 +70799,7 @@
       [dartx.fonts]: html$.FontFaceSet,
       [dartx.fullscreenElement]: html$.Element,
       [dartx.fullscreenEnabled]: core.bool,
-      [_head$]: html$.HeadElement,
+      [_head$0]: html$.HeadElement,
       [dartx.hidden]: core.bool,
       [dartx.implementation]: html$.DomImplementation,
       [_lastModified]: core.String,
@@ -57096,17 +72296,11 @@
   html$.DomStringList[dart.implements] = () => [ListOfString()];
   dart.setSignature(html$.DomStringList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.DomStringList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(core.String, []),
-      [dartx.last]: dart.definiteFunctionType(core.String, []),
-      [dartx.single]: dart.definiteFunctionType(core.String, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(core.String, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
-      [dartx.elementAt]: dart.definiteFunctionType(core.String, [core.int]),
       [__getter__]: dart.definiteFunctionType(core.String, [core.int]),
       [dartx.item]: dart.definiteFunctionType(core.String, [core.int])
     })
@@ -57131,7 +72325,7 @@
   dart.registerExtension(dart.global.EffectModel, html$.EffectModel);
   const _childElements = Symbol('_childElements');
   const _element$ = Symbol('_element');
-  const _filter$ = Symbol('_filter');
+  const _filter$0 = Symbol('_filter');
   html$._ChildrenElementList = class _ChildrenElementList extends collection.ListBase$(html$.Element) {
     _wrap(element) {
       this[_childElements] = html$.HtmlCollection._check(element[_children]);
@@ -57180,12 +72374,12 @@
       dart.throw(new core.UnsupportedError('Cannot shuffle element lists'));
     }
     removeWhere(test) {
-      this[_filter$](test, false);
+      this[_filter$0](test, false);
     }
     retainWhere(test) {
-      this[_filter$](test, true);
+      this[_filter$0](test, true);
     }
-    [_filter$](test, retainMatching) {
+    [_filter$0](test, retainMatching) {
       let removed = null;
       if (dart.test(retainMatching)) {
         removed = this[_element$][dartx.children][dartx.where](dart.fn(e => !dart.test(test(e)), ElementTobool$()));
@@ -57275,10 +72469,6 @@
     }),
     getters: () => ({
       length: dart.definiteFunctionType(core.int, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(html$.Element), []),
-      first: dart.definiteFunctionType(html$.Element, []),
-      last: dart.definiteFunctionType(html$.Element, []),
-      single: dart.definiteFunctionType(html$.Element, []),
       rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
@@ -57286,18 +72476,7 @@
       _get: dart.definiteFunctionType(html$.Element, [core.int]),
       _set: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
       add: dart.definiteFunctionType(html$.Element, [html$.Element]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfElement()]),
-      sort: dart.definiteFunctionType(dart.void, [], [ElementAndElementToint()]),
-      removeWhere: dart.definiteFunctionType(dart.void, [ElementTobool()]),
-      retainWhere: dart.definiteFunctionType(dart.void, [ElementTobool()]),
-      [_filter$]: dart.definiteFunctionType(dart.void, [ElementTobool(), core.bool]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()], [core.int]),
-      replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html$.Element]),
-      insert: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
-      setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfElement()]),
-      removeAt: dart.definiteFunctionType(html$.Element, [core.int]),
-      removeLast: dart.definiteFunctionType(html$.Element, [])
+      [_filter$0]: dart.definiteFunctionType(dart.void, [ElementTobool(), core.bool])
     })
   });
   dart.defineExtensionMembers(html$._ChildrenElementList, [
@@ -57612,9 +72791,6 @@
       fields: () => ({[_nodeList]: ListOfNode()}),
       getters: () => ({
         length: dart.definiteFunctionType(core.int, []),
-        first: dart.definiteFunctionType(E, []),
-        last: dart.definiteFunctionType(E, []),
-        single: dart.definiteFunctionType(E, []),
         classes: dart.definiteFunctionType(html$.CssClassSet, []),
         style: dart.definiteFunctionType(html$.CssStyleDeclarationBase, []),
         contentEdge: dart.definiteFunctionType(html$.CssRect, []),
@@ -57698,8 +72874,7 @@
       }),
       methods: () => ({
         _get: dart.definiteFunctionType(E, [core.int]),
-        _set: dart.definiteFunctionType(dart.void, [core.int, E]),
-        sort: dart.definiteFunctionType(dart.void, [], [ComparatorOfE()])
+        _set: dart.definiteFunctionType(dart.void, [core.int, E])
       })
     });
     dart.defineExtensionMembers(_FrozenElementList, [
@@ -57728,19 +72903,19 @@
     statics: () => ({createElement_tag: dart.definiteFunctionType(dart.dynamic, [core.String, core.String])}),
     names: ['createElement_tag']
   });
-  const _value$1 = Symbol('_value');
+  const _value$2 = Symbol('_value');
   html$.ScrollAlignment = class ScrollAlignment extends core.Object {
     _internal(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
     }
     toString() {
-      return dart.str`ScrollAlignment.${this[_value$1]}`;
+      return dart.str`ScrollAlignment.${this[_value$2]}`;
     }
   };
   dart.defineNamedConstructor(html$.ScrollAlignment, '_internal');
   dart.setSignature(html$.ScrollAlignment, {
     constructors: () => ({_internal: dart.definiteFunctionType(html$.ScrollAlignment, [dart.dynamic])}),
-    fields: () => ({[_value$1]: dart.dynamic}),
+    fields: () => ({[_value$2]: dart.dynamic}),
     sfields: () => ({
       TOP: html$.ScrollAlignment,
       CENTER: html$.ScrollAlignment,
@@ -57865,10 +73040,10 @@
       return html$.ErrorEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ErrorEvent(type, eventInitDict);
+      return new self.ErrorEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ErrorEvent(type);
+      return new self.ErrorEvent(type);
     }
     get [dartx.colno]() {
       return this.colno;
@@ -57932,10 +73107,10 @@
       return html$.EventSource._create_2(url);
     }
     static _create_1(url, eventSourceInitDict) {
-      return new EventSource(url, eventSourceInitDict);
+      return new self.EventSource(url, eventSourceInitDict);
     }
     static _create_2(url) {
-      return new EventSource(url);
+      return new self.EventSource(url);
     }
     get [dartx.readyState]() {
       return this.readyState;
@@ -58057,10 +73232,10 @@
       return html$.ExtendableEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ExtendableEvent(type, eventInitDict);
+      return new self.ExtendableEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ExtendableEvent(type);
+      return new self.ExtendableEvent(type);
     }
     [dartx.waitUntil](...args) {
       return this.waitUntil.apply(this, args);
@@ -58092,7 +73267,7 @@
       return html$.FederatedCredential._create_1(data_1);
     }
     static _create_1(data) {
-      return new FederatedCredential(data);
+      return new self.FederatedCredential(data);
     }
     get [dartx.protocol]() {
       return this.protocol;
@@ -58132,10 +73307,10 @@
       return html$.FetchEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new FetchEvent(type, eventInitDict);
+      return new self.FetchEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new FetchEvent(type);
+      return new self.FetchEvent(type);
     }
     get [dartx.isReload]() {
       return this.isReload;
@@ -58279,10 +73454,10 @@
       return html$.File._create_2(fileBits, fileName);
     }
     static _create_1(fileBits, fileName, options) {
-      return new File(fileBits, fileName, options);
+      return new self.File(fileBits, fileName, options);
     }
     static _create_2(fileBits, fileName) {
-      return new File(fileBits, fileName);
+      return new self.File(fileBits, fileName);
     }
     get [dartx.lastModified]() {
       return this.lastModified;
@@ -58321,7 +73496,7 @@
   dart.registerExtension(dart.global.File, html$.File);
   html$._FileCallback = dart.typedef('_FileCallback', () => dart.functionType(dart.void, [html$.File]));
   const _createWriter = Symbol('_createWriter');
-  const _file = Symbol('_file');
+  const _file$ = Symbol('_file');
   dart.defineExtensionNames([
     'createWriter',
     'file'
@@ -58337,21 +73512,21 @@
       let completer = CompleterOfFileWriter().new();
       this[_createWriter](dart.fn(value => {
         completer.complete(value);
-      }, FileWriterTovoid()), dart.fn(error => {
+      }, FileWriterToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
-    [_file](...args) {
+    [_file$](...args) {
       return this.file.apply(this, args);
     }
     [dartx.file]() {
-      let completer = CompleterOfFile().new();
-      this[_file](dart.fn(value => {
+      let completer = CompleterOfFile$().new();
+      this[_file$](dart.fn(value => {
         completer.complete(value);
-      }, FileTovoid()), dart.fn(error => {
+      }, FileToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
   };
@@ -58360,7 +73535,7 @@
     methods: () => ({
       [_createWriter]: dart.definiteFunctionType(dart.void, [html$._FileWriterCallback], [html$._ErrorCallback]),
       [dartx.createWriter]: dart.definiteFunctionType(async.Future$(html$.FileWriter), []),
-      [_file]: dart.definiteFunctionType(dart.void, [html$._FileCallback], [html$._ErrorCallback]),
+      [_file$]: dart.definiteFunctionType(dart.void, [html$._FileCallback], [html$._ErrorCallback]),
       [dartx.file]: dart.definiteFunctionType(async.Future$(html$.File), [])
     })
   });
@@ -58467,17 +73642,11 @@
   html$.FileList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfFile()];
   dart.setSignature(html$.FileList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.FileList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.File, []),
-      [dartx.last]: dart.definiteFunctionType(html$.File, []),
-      [dartx.single]: dart.definiteFunctionType(html$.File, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.File, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.File]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.File, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.File, [core.int])
     })
   });
@@ -58512,7 +73681,7 @@
       return html$.FileReader._create_1();
     }
     static _create_1() {
-      return new FileReader();
+      return new self.FileReader();
     }
     get [dartx.error]() {
       return this.error;
@@ -58796,10 +73965,10 @@
       return html$.FocusEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new FocusEvent(type, eventInitDict);
+      return new self.FocusEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new FocusEvent(type);
+      return new self.FocusEvent(type);
     }
     get [dartx.relatedTarget]() {
       return html$._convertNativeToDart_EventTarget(this[_get_relatedTarget]);
@@ -58847,10 +74016,10 @@
       return html$.FontFace._create_2(family, source);
     }
     static _create_1(family, source, descriptors) {
-      return new FontFace(family, source, descriptors);
+      return new self.FontFace(family, source, descriptors);
     }
     static _create_2(family, source) {
-      return new FontFace(family, source);
+      return new self.FontFace(family, source);
     }
     get [dartx.family]() {
       return this.family;
@@ -59021,10 +74190,10 @@
       return html$.FormData._create_2();
     }
     static _create_1(form) {
-      return new FormData(form);
+      return new self.FormData(form);
     }
     static _create_2() {
-      return new FormData();
+      return new self.FormData();
     }
     static get supported() {
       return !!window.FormData;
@@ -59315,10 +74484,10 @@
       return html$.GamepadEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new GamepadEvent(type, eventInitDict);
+      return new self.GamepadEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new GamepadEvent(type);
+      return new self.GamepadEvent(type);
     }
     get [dartx.gamepad]() {
       return this.gamepad;
@@ -59421,9 +74590,9 @@
       try {
         this[_getCurrentPosition](dart.fn(position => {
           completer.complete(this[_ensurePosition](position));
-        }, GeopositionTovoid()), dart.fn(error => {
+        }, GeopositionToNull()), dart.fn(error => {
           completer.completeError(error);
-        }, PositionErrorTovoid()), options);
+        }, PositionErrorToNull()), options);
       } catch (e) {
         let stacktrace = dart.stackTrace(e);
         completer.completeError(e, stacktrace);
@@ -59451,13 +74620,13 @@
           dart.assert(watchId == null);
           watchId = this[_watchPosition](dart.fn(position => {
             controller.add(this[_ensurePosition](position));
-          }, GeopositionTovoid()), dart.fn(error => {
+          }, GeopositionToNull()), dart.fn(error => {
             controller.addError(error);
-          }, PositionErrorTovoid()), options);
-        }, VoidTovoid$()), onCancel: dart.fn(() => {
+          }, PositionErrorToNull()), options);
+        }, VoidToNull()), onCancel: dart.fn(() => {
           dart.assert(watchId != null);
           this[_clearWatch](watchId);
-        }, VoidTodynamic$())});
+        }, VoidToNull())});
       return controller.stream;
     }
     [_ensurePosition](domPosition) {
@@ -60165,7 +75334,7 @@
       let oldUrl = opts && 'oldUrl' in opts ? opts.oldUrl : null;
       let newUrl = opts && 'newUrl' in opts ? opts.newUrl : null;
       let options = dart.map({canBubble: canBubble, cancelable: cancelable, oldURL: oldUrl, newURL: newUrl}, core.String, core.Object);
-      return new HashChangeEvent(type, html_common.convertDartToNative_Dictionary(options));
+      return new self.HashChangeEvent(type, html_common.convertDartToNative_Dictionary(options));
     }
     static _(type, eventInitDict) {
       if (eventInitDict === void 0) eventInitDict = null;
@@ -60176,10 +75345,10 @@
       return html$.HashChangeEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new HashChangeEvent(type, eventInitDict);
+      return new self.HashChangeEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new HashChangeEvent(type);
+      return new self.HashChangeEvent(type);
     }
     static get supported() {
       return html_common.Device.isEventTypeSupported('HashChangeEvent');
@@ -60254,16 +75423,16 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1() {
-      return new Headers();
+      return new self.Headers();
     }
     static _create_2(input) {
-      return new Headers(input);
+      return new self.Headers(input);
     }
     static _create_3(input) {
-      return new Headers(input);
+      return new self.Headers(input);
     }
     static _create_4(input) {
-      return new Headers(input);
+      return new self.Headers(input);
     }
   };
   dart.setSignature(html$.Headers, {
@@ -60545,17 +75714,11 @@
   html$.HtmlCollection[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
   dart.setSignature(html$.HtmlCollection, {
     constructors: () => ({_: dart.definiteFunctionType(html$.HtmlCollection, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Node, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx.namedItem]: dart.definiteFunctionType(core.Object, [core.String])
     })
@@ -60604,7 +75767,7 @@
       return html$.CanvasRenderingContext._check(this[_getCssCanvasContext](contextId, name, width, height));
     }
     get [dartx.head]() {
-      return this[_head$];
+      return this[_head$0];
     }
     get [dartx.lastModified]() {
       return this[_lastModified];
@@ -60867,7 +76030,7 @@
       let parts = [];
       data[dartx.forEach](dart.fn((key, value) => {
         parts[dartx.add](dart.str`${core.Uri.encodeQueryComponent(key)}=` + dart.str`${core.Uri.encodeQueryComponent(value)}`);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
       let formData = parts[dartx.join]('&');
       if (requestHeaders == null) {
         requestHeaders = dart.map({}, core.String, core.String);
@@ -60901,7 +76064,7 @@
       if (requestHeaders != null) {
         requestHeaders[dartx.forEach](dart.fn((header, value) => {
           xhr[dartx.setRequestHeader](header, value);
-        }, StringAndStringTovoid$()));
+        }, StringAndStringToNull()));
       }
       if (onProgress != null) {
         xhr[dartx.onProgress].listen(onProgress);
@@ -60916,7 +76079,7 @@
         } else {
           completer.completeError(e);
         }
-      }, ProgressEventTovoid$()));
+      }, ProgressEventToNull()));
       xhr[dartx.onError].listen(dart.bind(completer, 'completeError'));
       if (sendData != null) {
         xhr[dartx.send](sendData);
@@ -60953,13 +76116,13 @@
       }
       let xhr = new XDomainRequest();
       xhr.open(method, url);
-      xhr.onload = _js_helper.convertDartClosureToJS(dynamicTodynamic())(dart.fn(e => {
+      xhr.onload = _js_helper.convertDartClosureToJS(dynamicToNull())(dart.fn(e => {
         let response = xhr.responseText;
         completer.complete(response);
-      }, dynamicTodynamic$()), 1);
-      xhr.onerror = _js_helper.convertDartClosureToJS(dynamicTodynamic())(dart.fn(e => {
+      }, dynamicToNull$()), 1);
+      xhr.onerror = _js_helper.convertDartClosureToJS(dynamicToNull())(dart.fn(e => {
         completer.completeError(e);
-      }, dynamicTodynamic$()), 1);
+      }, dynamicToNull$()), 1);
       xhr.onprogress = {};
       xhr.ontimeout = {};
       xhr.timeout = Number.MAX_VALUE;
@@ -61290,13 +76453,13 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1(data_OR_sw, sh_OR_sw) {
-      return new ImageData(data_OR_sw, sh_OR_sw);
+      return new self.ImageData(data_OR_sw, sh_OR_sw);
     }
     static _create_2(data_OR_sw, sh_OR_sw) {
-      return new ImageData(data_OR_sw, sh_OR_sw);
+      return new self.ImageData(data_OR_sw, sh_OR_sw);
     }
     static _create_3(data_OR_sw, sh_OR_sw, sh) {
-      return new ImageData(data_OR_sw, sh_OR_sw, sh);
+      return new self.ImageData(data_OR_sw, sh_OR_sw, sh);
     }
     get [dartx.data]() {
       return this.data;
@@ -61495,10 +76658,10 @@
       return html$.InputDevice._create_2();
     }
     static _create_1(deviceInitDict) {
-      return new InputDevice(deviceInitDict);
+      return new self.InputDevice(deviceInitDict);
     }
     static _create_2() {
-      return new InputDevice();
+      return new self.InputDevice();
     }
     get [dartx.firesTouchEvents]() {
       return this.firesTouchEvents;
@@ -63216,10 +78379,10 @@
       return html$.KeyboardEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new KeyboardEvent(type, eventInitDict);
+      return new self.KeyboardEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new KeyboardEvent(type);
+      return new self.KeyboardEvent(type);
     }
     get [dartx.altKey]() {
       return this.altKey;
@@ -63317,13 +78480,13 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1(target, keyframes) {
-      return new KeyframeEffect(target, keyframes);
+      return new self.KeyframeEffect(target, keyframes);
     }
     static _create_2(target, keyframes, timing) {
-      return new KeyframeEffect(target, keyframes, timing);
+      return new self.KeyframeEffect(target, keyframes, timing);
     }
     static _create_3(target, keyframes, timing) {
-      return new KeyframeEffect(target, keyframes, timing);
+      return new self.KeyframeEffect(target, keyframes, timing);
     }
   };
   dart.setSignature(html$.KeyframeEffect, {
@@ -63863,7 +79026,7 @@
       return html$.MediaController._create_1();
     }
     static _create_1() {
-      return new MediaController();
+      return new self.MediaController();
     }
     get [dartx.buffered]() {
       return this.buffered;
@@ -64029,10 +79192,10 @@
       return html$.MediaEncryptedEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaEncryptedEvent(type, eventInitDict);
+      return new self.MediaEncryptedEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaEncryptedEvent(type);
+      return new self.MediaEncryptedEvent(type);
     }
     get [dartx.initData]() {
       return this.initData;
@@ -64142,10 +79305,10 @@
       return html$.MediaKeyEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaKeyEvent(type, eventInitDict);
+      return new self.MediaKeyEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaKeyEvent(type);
+      return new self.MediaKeyEvent(type);
     }
     get [dartx.defaultUrl]() {
       return this.defaultURL;
@@ -64207,10 +79370,10 @@
       return html$.MediaKeyMessageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaKeyMessageEvent(type, eventInitDict);
+      return new self.MediaKeyMessageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaKeyMessageEvent(type);
+      return new self.MediaKeyMessageEvent(type);
     }
     get [dartx.message]() {
       return this.message;
@@ -64473,10 +79636,10 @@
       return html$.MediaQueryListEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaQueryListEvent(type, eventInitDict);
+      return new self.MediaQueryListEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaQueryListEvent(type);
+      return new self.MediaQueryListEvent(type);
     }
     get [dartx.matches]() {
       return this.matches;
@@ -64513,7 +79676,7 @@
       return html$.MediaSession._create_1();
     }
     static _create_1() {
-      return new MediaSession();
+      return new self.MediaSession();
     }
     [dartx.activate](...args) {
       return this.activate.apply(this, args);
@@ -64552,7 +79715,7 @@
       return html$.MediaSource._create_1();
     }
     static _create_1() {
-      return new MediaSource();
+      return new self.MediaSource();
     }
     static get supported() {
       return !!window.MediaSource;
@@ -64641,13 +79804,13 @@
       dart.throw(new core.ArgumentError("Incorrect number or type of arguments"));
     }
     static _create_1() {
-      return new MediaStream();
+      return new self.MediaStream();
     }
     static _create_2(stream_OR_tracks) {
-      return new MediaStream(stream_OR_tracks);
+      return new self.MediaStream(stream_OR_tracks);
     }
     static _create_3(stream_OR_tracks) {
-      return new MediaStream(stream_OR_tracks);
+      return new self.MediaStream(stream_OR_tracks);
     }
     get [dartx.active]() {
       return this.active;
@@ -64765,10 +79928,10 @@
       return html$.MediaStreamEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MediaStreamEvent(type, eventInitDict);
+      return new self.MediaStreamEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MediaStreamEvent(type);
+      return new self.MediaStreamEvent(type);
     }
     static get supported() {
       return html_common.Device.isEventTypeSupported('MediaStreamEvent');
@@ -64836,7 +79999,7 @@
       let completer = CompleterOfListOfSourceInfo().new();
       html$.MediaStreamTrack._getSources(dart.fn(value => {
         completer.complete(value);
-      }, ListOfSourceInfoTovoid()));
+      }, ListOfSourceInfoToNull()));
       return completer.future;
     }
     [dartx.stop](...args) {
@@ -65113,7 +80276,7 @@
         source = html$.window;
       }
       if (!dart.test(html_common.Device.isIE)) {
-        return new MessageEvent(type, {bubbles: canBubble, cancelable: cancelable, data: data, origin: origin, lastEventId: lastEventId, source: source, ports: messagePorts});
+        return new self.MessageEvent(type, {bubbles: canBubble, cancelable: cancelable, data: data, origin: origin, lastEventId: lastEventId, source: source, ports: messagePorts});
       }
       let event = html$.MessageEvent._check(html$.document[_createEvent]("MessageEvent"));
       event[_initMessageEvent](type, canBubble, cancelable, data, origin, lastEventId, source, messagePorts);
@@ -65134,10 +80297,10 @@
       return html$.MessageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MessageEvent(type, eventInitDict);
+      return new self.MessageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MessageEvent(type);
+      return new self.MessageEvent(type);
     }
     get [dartx.lastEventId]() {
       return this.lastEventId;
@@ -65739,17 +80902,11 @@
   html$.MimeTypeArray[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfMimeType()];
   dart.setSignature(html$.MimeTypeArray, {
     constructors: () => ({_: dart.definiteFunctionType(html$.MimeTypeArray, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.MimeType, []),
-      [dartx.last]: dart.definiteFunctionType(html$.MimeType, []),
-      [dartx.single]: dart.definiteFunctionType(html$.MimeType, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.MimeType, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.MimeType]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.MimeType, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.MimeType, [core.int]),
       [dartx.namedItem]: dart.definiteFunctionType(html$.MimeType, [core.String])
     })
@@ -65858,10 +81015,10 @@
       return html$.MouseEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new MouseEvent(type, eventInitDict);
+      return new self.MouseEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new MouseEvent(type);
+      return new self.MouseEvent(type);
     }
     get [dartx.altKey]() {
       return this.altKey;
@@ -66063,7 +81220,7 @@
       function override(key, value) {
         if (value != null) html$.MutationObserver._add(parsedOptions, core.String._check(key), value);
       }
-      dart.fn(override, dynamicAnddynamicTodynamic$());
+      dart.fn(override, dynamicAnddynamicToNull());
       override('childList', childList);
       override('attributes', attributes);
       override('characterData', characterData);
@@ -66089,7 +81246,7 @@
     }
     static new(callback) {
       0;
-      return new (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver)(_js_helper.convertDartClosureToJS(html$._wrapZoneBinaryCallback)(html$._wrapBinaryZone(dart.dynamic, dart.dynamic, dart.dynamic)(callback), 2));
+      return new (window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver)(_js_helper.convertDartClosureToJS(_wrapZoneBinaryCallbackOfListOfMutationRecord$MutationObserver$void())(html$._wrapBinaryZone(ListOfMutationRecord(), html$.MutationObserver, dart.void)(callback), 2));
     }
   };
   dart.setSignature(html$.MutationObserver, {
@@ -66229,9 +81386,9 @@
       this[_ensureGetUserMedia]();
       this[_getUserMedia](html_common.convertDartToNative_SerializedScriptValue(options), dart.fn(stream => {
         completer.complete(stream);
-      }, MediaStreamTovoid()), dart.fn(error => {
+      }, MediaStreamToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, NavigatorUserMediaErrorTovoid()));
+      }, NavigatorUserMediaErrorToNull()));
       return completer.future;
     }
     [_ensureGetUserMedia]() {
@@ -66721,7 +81878,7 @@
       this[_this][_removeChild](node);
       return true;
     }
-    [_filter$](test, removeMatching) {
+    [_filter$0](test, removeMatching) {
       let child = this[_this][dartx.firstChild];
       while (child != null) {
         let nextChild = child[dartx.nextNode];
@@ -66732,10 +81889,10 @@
       }
     }
     removeWhere(test) {
-      this[_filter$](test, true);
+      this[_filter$0](test, true);
     }
     retainWhere(test) {
-      this[_filter$](test, false);
+      this[_filter$0](test, false);
     }
     clear() {
       this[_this][_clearChildren]();
@@ -66782,29 +81939,13 @@
     constructors: () => ({new: dart.definiteFunctionType(html$._ChildNodeListLazy, [html$.Node])}),
     fields: () => ({[_this]: html$.Node}),
     getters: () => ({
-      first: dart.definiteFunctionType(html$.Node, []),
-      last: dart.definiteFunctionType(html$.Node, []),
-      single: dart.definiteFunctionType(html$.Node, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(html$.Node), []),
       length: dart.definiteFunctionType(core.int, []),
       rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
-      add: dart.definiteFunctionType(dart.void, [html$.Node]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfNode()]),
-      insert: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfNode()]),
-      setAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfNode()]),
-      removeLast: dart.definiteFunctionType(html$.Node, []),
-      removeAt: dart.definiteFunctionType(html$.Node, [core.int]),
-      [_filter$]: dart.definiteFunctionType(dart.void, [NodeTobool(), core.bool]),
-      removeWhere: dart.definiteFunctionType(dart.void, [NodeTobool()]),
-      retainWhere: dart.definiteFunctionType(dart.void, [NodeTobool()]),
+      [_filter$0]: dart.definiteFunctionType(dart.void, [NodeTobool(), core.bool]),
       _set: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      sort: dart.definiteFunctionType(dart.void, [], [ComparatorOfNode()]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfNode()], [core.int]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html$.Node]),
       _get: dart.definiteFunctionType(html$.Node, [core.int])
     })
   });
@@ -66981,17 +82122,11 @@
   html$.NodeList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
   dart.setSignature(html$.NodeList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.NodeList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Node, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Node, [core.int]),
       [_item]: dart.definiteFunctionType(html$.Node, [core.int])
     })
   });
@@ -67080,10 +82215,10 @@
       return html$.Notification._create_2(title);
     }
     static _create_1(title, options) {
-      return new Notification(title, options);
+      return new self.Notification(title, options);
     }
     static _create_2(title) {
-      return new Notification(title);
+      return new self.Notification(title);
     }
     static get supported() {
       return !!window.Notification;
@@ -67125,7 +82260,7 @@
       let completer = CompleterOfString().new();
       html$.Notification._requestPermission(dart.fn(value => {
         completer.complete(value);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     get [dartx.onClick]() {
@@ -67212,10 +82347,10 @@
       return html$.NotificationEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new NotificationEvent(type, eventInitDict);
+      return new self.NotificationEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new NotificationEvent(type);
+      return new self.NotificationEvent(type);
     }
     get [dartx.notification]() {
       return this.notification;
@@ -67712,10 +82847,10 @@
       return html$.PageTransitionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PageTransitionEvent(type, eventInitDict);
+      return new self.PageTransitionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PageTransitionEvent(type);
+      return new self.PageTransitionEvent(type);
     }
     get [dartx.persisted]() {
       return this.persisted;
@@ -67830,13 +82965,13 @@
       return html$.PasswordCredential._create_3(id, password);
     }
     static _create_1(id, password, name, iconURL) {
-      return new PasswordCredential(id, password, name, iconURL);
+      return new self.PasswordCredential(id, password, name, iconURL);
     }
     static _create_2(id, password, name) {
-      return new PasswordCredential(id, password, name);
+      return new self.PasswordCredential(id, password, name);
     }
     static _create_3(id, password) {
-      return new PasswordCredential(id, password);
+      return new self.PasswordCredential(id, password);
     }
     get [dartx.formData]() {
       return this.formData;
@@ -68386,7 +83521,7 @@
       return html$.PeriodicSyncEvent._create_1(type, init_1);
     }
     static _create_1(type, init) {
-      return new PeriodicSyncEvent(type, init);
+      return new self.PeriodicSyncEvent(type, init);
     }
     get [dartx.registration]() {
       return this.registration;
@@ -68672,17 +83807,11 @@
   html$.PluginArray[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfPlugin()];
   dart.setSignature(html$.PluginArray, {
     constructors: () => ({_: dart.definiteFunctionType(html$.PluginArray, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Plugin, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Plugin, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Plugin, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Plugin, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Plugin]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Plugin, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Plugin, [core.int]),
       [dartx.namedItem]: dart.definiteFunctionType(html$.Plugin, [core.String]),
       [dartx.refresh]: dart.definiteFunctionType(dart.void, [core.bool])
@@ -68755,10 +83884,10 @@
       return html$.PointerEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PointerEvent(type, eventInitDict);
+      return new self.PointerEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PointerEvent(type);
+      return new self.PointerEvent(type);
     }
     get [dartx.height]() {
       return this.height;
@@ -68823,10 +83952,10 @@
       return html$.PopStateEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PopStateEvent(type, eventInitDict);
+      return new self.PopStateEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PopStateEvent(type);
+      return new self.PopStateEvent(type);
     }
     get [dartx.state]() {
       return html_common.convertNativeToDart_SerializedScriptValue(this[_get_state]);
@@ -69143,10 +84272,10 @@
       return html$.ProgressEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ProgressEvent(type, eventInitDict);
+      return new self.ProgressEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ProgressEvent(type);
+      return new self.ProgressEvent(type);
     }
     get [dartx.lengthComputable]() {
       return this.lengthComputable;
@@ -69192,10 +84321,10 @@
       return html$.PromiseRejectionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PromiseRejectionEvent(type, eventInitDict);
+      return new self.PromiseRejectionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PromiseRejectionEvent(type);
+      return new self.PromiseRejectionEvent(type);
     }
     get [dartx.promise]() {
       return this.promise;
@@ -69236,10 +84365,10 @@
       return html$.PushEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new PushEvent(type, eventInitDict);
+      return new self.PushEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new PushEvent(type);
+      return new self.PushEvent(type);
     }
     get [dartx.data]() {
       return this.data;
@@ -69330,7 +84459,7 @@
       return html$.PushMessageData._create_1(message);
     }
     static _create_1(message) {
-      return new PushMessageData(message);
+      return new self.PushMessageData(message);
     }
     [dartx.arrayBuffer](...args) {
       return this.arrayBuffer.apply(this, args);
@@ -69727,10 +84856,10 @@
       return html$.RelatedEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new RelatedEvent(type, eventInitDict);
+      return new self.RelatedEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new RelatedEvent(type);
+      return new self.RelatedEvent(type);
     }
     get [dartx.relatedTarget]() {
       return html$._convertNativeToDart_EventTarget(this[_get_relatedTarget]);
@@ -70146,9 +85275,9 @@
       let completer = CompleterOfRtcSessionDescription().new();
       this[_createOffer](dart.fn(value => {
         completer.complete(value);
-      }, RtcSessionDescriptionTovoid()), dart.fn(error => {
+      }, RtcSessionDescriptionToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()), mediaConstraints);
+      }, StringToNull()), mediaConstraints);
       return completer.future;
     }
     [dartx.createAnswer](mediaConstraints) {
@@ -70156,16 +85285,16 @@
       let completer = CompleterOfRtcSessionDescription().new();
       this[_createAnswer](dart.fn(value => {
         completer.complete(value);
-      }, RtcSessionDescriptionTovoid()), dart.fn(error => {
+      }, RtcSessionDescriptionToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()), mediaConstraints);
+      }, StringToNull()), mediaConstraints);
       return completer.future;
     }
     [dartx.getStats](selector) {
       let completer = CompleterOfRtcStatsResponse().new();
       this[_getStats](dart.fn(value => {
         completer.complete(value);
-      }, RtcStatsResponseTovoid()), selector);
+      }, RtcStatsResponseToNull()), selector);
       return completer.future;
     }
     static _() {
@@ -70281,9 +85410,9 @@
       let completer = async.Completer.new();
       this[_setLocalDescription](description, dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     [_setRemoteDescription](...args) {
@@ -70293,9 +85422,9 @@
       let completer = async.Completer.new();
       this[_setRemoteDescription](description, dart.fn(() => {
         completer.complete();
-      }, VoidTovoid$()), dart.fn(error => {
+      }, VoidToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, StringTovoid$()));
+      }, StringToNull()));
       return completer.future;
     }
     [dartx.updateIce](configuration, mediaConstraints) {
@@ -70799,31 +85928,31 @@
       return html$.ScrollState._create_9();
     }
     static _create_1(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning, isEnding);
     }
     static _create_2(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase, isBeginning);
     }
     static _create_3(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY, inInertialPhase);
     }
     static _create_4(deltaX, deltaY, deltaGranularity, velocityX, velocityY) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX, velocityY);
     }
     static _create_5(deltaX, deltaY, deltaGranularity, velocityX) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity, velocityX);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity, velocityX);
     }
     static _create_6(deltaX, deltaY, deltaGranularity) {
-      return new ScrollState(deltaX, deltaY, deltaGranularity);
+      return new self.ScrollState(deltaX, deltaY, deltaGranularity);
     }
     static _create_7(deltaX, deltaY) {
-      return new ScrollState(deltaX, deltaY);
+      return new self.ScrollState(deltaX, deltaY);
     }
     static _create_8(deltaX) {
-      return new ScrollState(deltaX);
+      return new self.ScrollState(deltaX);
     }
     static _create_9() {
-      return new ScrollState();
+      return new self.ScrollState();
     }
     get [dartx.deltaGranularity]() {
       return this.deltaGranularity;
@@ -70916,10 +86045,10 @@
       return html$.SecurityPolicyViolationEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new SecurityPolicyViolationEvent(type, eventInitDict);
+      return new self.SecurityPolicyViolationEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new SecurityPolicyViolationEvent(type);
+      return new self.SecurityPolicyViolationEvent(type);
     }
     get [dartx.blockedUri]() {
       return this.blockedURI;
@@ -71457,10 +86586,10 @@
       return html$.ServicePortConnectEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ServicePortConnectEvent(type, eventInitDict);
+      return new self.ServicePortConnectEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ServicePortConnectEvent(type);
+      return new self.ServicePortConnectEvent(type);
     }
     get [dartx.origin]() {
       return this.origin;
@@ -71623,10 +86752,10 @@
       return html$.ServiceWorkerMessageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new ServiceWorkerMessageEvent(type, eventInitDict);
+      return new self.ServiceWorkerMessageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new ServiceWorkerMessageEvent(type);
+      return new self.ServiceWorkerMessageEvent(type);
     }
     get [dartx.lastEventId]() {
       return this.lastEventId;
@@ -71938,10 +87067,10 @@
       return html$.SharedWorker._create_2(scriptURL);
     }
     static _create_1(scriptURL, name) {
-      return new SharedWorker(scriptURL, name);
+      return new self.SharedWorker(scriptURL, name);
     }
     static _create_2(scriptURL) {
-      return new SharedWorker(scriptURL);
+      return new self.SharedWorker(scriptURL);
     }
     get [dartx.port]() {
       return this.port;
@@ -72154,17 +87283,11 @@
   html$.SourceBufferList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfSourceBuffer()];
   dart.setSignature(html$.SourceBufferList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.SourceBufferList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.SourceBuffer, []),
-      [dartx.last]: dart.definiteFunctionType(html$.SourceBuffer, []),
-      [dartx.single]: dart.definiteFunctionType(html$.SourceBuffer, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.SourceBuffer, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.SourceBuffer]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.SourceBuffer, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.SourceBuffer, [core.int])
     })
   });
@@ -72303,7 +87426,7 @@
       return html$.SpeechGrammar._create_1();
     }
     static _create_1() {
-      return new SpeechGrammar();
+      return new self.SpeechGrammar();
     }
     get [dartx.src]() {
       return this.src;
@@ -72352,7 +87475,7 @@
       return html$.SpeechGrammarList._create_1();
     }
     static _create_1() {
-      return new SpeechGrammarList();
+      return new self.SpeechGrammarList();
     }
     get [dartx.length]() {
       return this.length;
@@ -72408,17 +87531,11 @@
       _: dart.definiteFunctionType(html$.SpeechGrammarList, []),
       new: dart.definiteFunctionType(html$.SpeechGrammarList, [])
     }),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.SpeechGrammar, []),
-      [dartx.last]: dart.definiteFunctionType(html$.SpeechGrammar, []),
-      [dartx.single]: dart.definiteFunctionType(html$.SpeechGrammar, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.SpeechGrammar, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.SpeechGrammar]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.SpeechGrammar, [core.int]),
       [dartx.addFromString]: dart.definiteFunctionType(dart.void, [core.String], [core.num]),
       [dartx.addFromUri]: dart.definiteFunctionType(dart.void, [core.String], [core.num]),
       [dartx.item]: dart.definiteFunctionType(html$.SpeechGrammar, [core.int])
@@ -72668,10 +87785,10 @@
       return html$.SpeechRecognitionError._create_2(type);
     }
     static _create_1(type, initDict) {
-      return new SpeechRecognitionError(type, initDict);
+      return new self.SpeechRecognitionError(type, initDict);
     }
     static _create_2(type) {
-      return new SpeechRecognitionError(type);
+      return new self.SpeechRecognitionError(type);
     }
     get [dartx.error]() {
       return this.error;
@@ -72715,10 +87832,10 @@
       return html$.SpeechRecognitionEvent._create_2(type);
     }
     static _create_1(type, initDict) {
-      return new SpeechRecognitionEvent(type, initDict);
+      return new self.SpeechRecognitionEvent(type, initDict);
     }
     static _create_2(type) {
-      return new SpeechRecognitionEvent(type);
+      return new self.SpeechRecognitionEvent(type);
     }
     get [dartx.emma]() {
       return this.emma;
@@ -72894,10 +88011,10 @@
       return html$.SpeechSynthesisUtterance._create_2();
     }
     static _create_1(text) {
-      return new SpeechSynthesisUtterance(text);
+      return new self.SpeechSynthesisUtterance(text);
     }
     static _create_2() {
-      return new SpeechSynthesisUtterance();
+      return new self.SpeechSynthesisUtterance();
     }
     get [dartx.lang]() {
       return this.lang;
@@ -73103,7 +88220,7 @@
   const _setItem = Symbol('_setItem');
   const _removeItem = Symbol('_removeItem');
   const _key = Symbol('_key');
-  const _length$2 = Symbol('_length');
+  const _length$3 = Symbol('_length');
   const __delete__ = Symbol('__delete__');
   dart.defineExtensionNames([
     'addAll',
@@ -73125,7 +88242,7 @@
     [dartx.addAll](other) {
       other[dartx.forEach](dart.fn((k, v) => {
         this[dartx._set](k, v);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     [dartx.containsValue](value) {
       return this[dartx.values][dartx.any](dart.fn(e => dart.equals(e, value), StringTobool$()));
@@ -73170,7 +88287,7 @@
       return values;
     }
     get [dartx.length]() {
-      return this[_length$2];
+      return this[_length$3];
     }
     get [dartx.isEmpty]() {
       return this[_key](0) == null;
@@ -73181,7 +88298,7 @@
     static _() {
       dart.throw(new core.UnsupportedError("Not supported"));
     }
-    get [_length$2]() {
+    get [_length$3]() {
       return this.length;
     }
     [__delete__](...args) {
@@ -73212,7 +88329,7 @@
   html$.Storage[dart.implements] = () => [MapOfString$String()];
   dart.setSignature(html$.Storage, {
     constructors: () => ({_: dart.definiteFunctionType(html$.Storage, [])}),
-    fields: () => ({[_length$2]: core.int}),
+    fields: () => ({[_length$3]: core.int}),
     getters: () => ({
       [dartx.keys]: dart.definiteFunctionType(core.Iterable$(core.String), []),
       [dartx.values]: dart.definiteFunctionType(core.Iterable$(core.String), []),
@@ -73272,10 +88389,10 @@
       return html$.StorageEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new StorageEvent(type, eventInitDict);
+      return new self.StorageEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new StorageEvent(type);
+      return new self.StorageEvent(type);
     }
     get [dartx.key]() {
       return this.key;
@@ -73460,7 +88577,7 @@
       return html$.SyncEvent._create_1(type, init_1);
     }
     static _create_1(type, init) {
-      return new SyncEvent(type, init);
+      return new self.SyncEvent(type, init);
     }
     get [dartx.registration]() {
       return this.registration;
@@ -74616,17 +89733,11 @@
   html$.TextTrackCueList[dart.implements] = () => [ListOfTextTrackCue(), _js_helper.JavaScriptIndexingBehavior];
   dart.setSignature(html$.TextTrackCueList, {
     constructors: () => ({_: dart.definiteFunctionType(html$.TextTrackCueList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.TextTrackCue, []),
-      [dartx.last]: dart.definiteFunctionType(html$.TextTrackCue, []),
-      [dartx.single]: dart.definiteFunctionType(html$.TextTrackCue, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.TextTrackCue, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.TextTrackCue]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.TextTrackCue, [core.int]),
       [dartx.getCueById]: dart.definiteFunctionType(html$.TextTrackCue, [core.String]),
       [dartx.item]: dart.definiteFunctionType(html$.TextTrackCue, [core.int])
     })
@@ -74706,9 +89817,6 @@
     constructors: () => ({_: dart.definiteFunctionType(html$.TextTrackList, [])}),
     getters: () => ({
       [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.TextTrack, []),
-      [dartx.last]: dart.definiteFunctionType(html$.TextTrack, []),
-      [dartx.single]: dart.definiteFunctionType(html$.TextTrack, []),
       [dartx.onAddTrack]: dart.definiteFunctionType(async.Stream$(html$.TrackEvent), []),
       [dartx.onChange]: dart.definiteFunctionType(async.Stream$(html$.Event), [])
     }),
@@ -74716,7 +89824,6 @@
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.TextTrack, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.TextTrack]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.TextTrack, [core.int]),
       [dartx.getTrackById]: dart.definiteFunctionType(html$.TextTrack, [core.String]),
       [dartx.item]: dart.definiteFunctionType(html$.TextTrack, [core.int])
     }),
@@ -75067,17 +90174,11 @@
       new: dart.definiteFunctionType(html$.TouchList, []),
       _: dart.definiteFunctionType(html$.TouchList, [])
     }),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Touch, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Touch, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Touch, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Touch, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Touch]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Touch, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Touch, [core.int])
     }),
     sgetters: () => ({supported: dart.definiteFunctionType(core.bool, [])})
@@ -75104,10 +90205,10 @@
       return html$.TrackDefault._create_2(type, language, label, kinds_1);
     }
     static _create_1(type, language, label, kinds, byteStreamTrackID) {
-      return new TrackDefault(type, language, label, kinds, byteStreamTrackID);
+      return new self.TrackDefault(type, language, label, kinds, byteStreamTrackID);
     }
     static _create_2(type, language, label, kinds) {
-      return new TrackDefault(type, language, label, kinds);
+      return new self.TrackDefault(type, language, label, kinds);
     }
     get [dartx.byteStreamTrackID]() {
       return this.byteStreamTrackID;
@@ -75160,10 +90261,10 @@
       return html$.TrackDefaultList._create_2();
     }
     static _create_1(trackDefaults) {
-      return new TrackDefaultList(trackDefaults);
+      return new self.TrackDefaultList(trackDefaults);
     }
     static _create_2() {
-      return new TrackDefaultList();
+      return new self.TrackDefaultList();
     }
     get [dartx.length]() {
       return this.length;
@@ -75297,10 +90398,10 @@
       return html$.TrackEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new TrackEvent(type, eventInitDict);
+      return new self.TrackEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new TrackEvent(type);
+      return new self.TrackEvent(type);
     }
     get [dartx.track]() {
       return this.track;
@@ -75337,10 +90438,10 @@
       return html$.TransitionEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new TransitionEvent(type, eventInitDict);
+      return new self.TransitionEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new TransitionEvent(type);
+      return new self.TransitionEvent(type);
     }
     get [dartx.elapsedTime]() {
       return this.elapsedTime;
@@ -75911,10 +91012,10 @@
       return html$.VRFieldOfView._create_2();
     }
     static _create_1(fov) {
-      return new VRFieldOfView(fov);
+      return new self.VRFieldOfView(fov);
     }
     static _create_2() {
-      return new VRFieldOfView();
+      return new self.VRFieldOfView();
     }
     get [dartx.downDegrees]() {
       return this.downDegrees;
@@ -76532,10 +91633,10 @@
       return html$.WebSocket._create_2(url);
     }
     static _create_1(url, protocols) {
-      return new WebSocket(url, protocols);
+      return new self.WebSocket(url, protocols);
     }
     static _create_2(url) {
-      return new WebSocket(url);
+      return new self.WebSocket(url);
     }
     static get supported() {
       return typeof window.WebSocket != "undefined";
@@ -76693,7 +91794,7 @@
       if (view == null) {
         view = html$.window;
       }
-      return new WheelEvent(type, html_common.convertDartToNative_Dictionary(options));
+      return new self.WheelEvent(type, html_common.convertDartToNative_Dictionary(options));
     }
     static _(type, eventInitDict) {
       if (eventInitDict === void 0) eventInitDict = null;
@@ -76704,10 +91805,10 @@
       return html$.WheelEvent._create_2(type);
     }
     static _create_1(type, eventInitDict) {
-      return new WheelEvent(type, eventInitDict);
+      return new self.WheelEvent(type, eventInitDict);
     }
     static _create_2(type) {
-      return new WheelEvent(type);
+      return new self.WheelEvent(type);
     }
     get [_deltaX]() {
       return this.deltaX;
@@ -76977,7 +92078,7 @@
       let completer = CompleterOfnum().sync();
       this[dartx.requestAnimationFrame](dart.fn(time => {
         completer.complete(time);
-      }, numTovoid()));
+      }, numToNull()));
       return completer.future;
     }
     get [dartx.document]() {
@@ -77432,9 +92533,9 @@
       let completer = CompleterOfFileSystem().new();
       this[__requestFileSystem](type, size, dart.fn(value => {
         completer.complete(value);
-      }, FileSystemTovoid()), dart.fn(error => {
+      }, FileSystemToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [_resolveLocalFileSystemUrl](...args) {
@@ -77444,9 +92545,9 @@
       let completer = CompleterOfEntry().new();
       this[_resolveLocalFileSystemUrl](url, dart.fn(value => {
         completer.complete(value);
-      }, EntryTovoid()), dart.fn(error => {
+      }, EntryToNull()), dart.fn(error => {
         completer.completeError(error);
-      }, FileErrorTovoid()));
+      }, FileErrorToNull()));
       return completer.future;
     }
     [dartx.atob](...args) {
@@ -78131,12 +93232,12 @@
     }
     forTarget(e, opts) {
       let useCapture = opts && 'useCapture' in opts ? opts.useCapture : false;
-      let stream = new (_EventStreamOfEvent())(e, this[_eventType], useCapture);
+      let stream = new (_EventStreamOfBeforeUnloadEvent())(e, this[_eventType], useCapture);
       let controller = StreamControllerOfBeforeUnloadEvent().new({sync: true});
       stream.listen(dart.fn(event => {
         let wrapped = new html$._BeforeUnloadEvent(event);
         controller.add(wrapped);
-      }, EventTovoid$()));
+      }, BeforeUnloadEventToNull()));
       return controller.stream;
     }
     getEventType(target) {
@@ -78300,7 +93401,7 @@
       return html$.Worker._create_1(scriptUrl);
     }
     static _create_1(scriptUrl) {
-      return new Worker(scriptUrl);
+      return new self.Worker(scriptUrl);
     }
     static get supported() {
       return typeof window.Worker != "undefined";
@@ -78455,7 +93556,7 @@
       return html$.XPathEvaluator._create_1();
     }
     static _create_1() {
-      return new XPathEvaluator();
+      return new self.XPathEvaluator();
     }
     [dartx.createExpression](...args) {
       return this.createExpression.apply(this, args);
@@ -78951,17 +94052,11 @@
   html$._ClientRectList[dart.implements] = () => [ListOfRectangleOfnum()];
   dart.setSignature(html$._ClientRectList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._ClientRectList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(math.Rectangle$(core.num), []),
-      [dartx.last]: dart.definiteFunctionType(math.Rectangle$(core.num), []),
-      [dartx.single]: dart.definiteFunctionType(math.Rectangle$(core.num), [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, RectangleOfnum()]),
-      [dartx.elementAt]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
       [__getter__]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int]),
       [dartx.item]: dart.definiteFunctionType(math.Rectangle$(core.num), [core.int])
     })
@@ -79028,17 +94123,11 @@
   html$._CssRuleList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfCssRule()];
   dart.setSignature(html$._CssRuleList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._CssRuleList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.CssRule, []),
-      [dartx.last]: dart.definiteFunctionType(html$.CssRule, []),
-      [dartx.single]: dart.definiteFunctionType(html$.CssRule, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.CssRule, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.CssRule]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.CssRule, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.CssRule, [core.int])
     })
   });
@@ -79281,17 +94370,11 @@
   html$._GamepadList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfGamepad()];
   dart.setSignature(html$._GamepadList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._GamepadList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Gamepad, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Gamepad, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Gamepad, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Gamepad, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Gamepad]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Gamepad, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.Gamepad, [core.int])
     })
   });
@@ -79490,17 +94573,11 @@
   html$._NamedNodeMap[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfNode()];
   dart.setSignature(html$._NamedNodeMap, {
     constructors: () => ({_: dart.definiteFunctionType(html$._NamedNodeMap, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.last]: dart.definiteFunctionType(html$.Node, []),
-      [dartx.single]: dart.definiteFunctionType(html$.Node, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.Node]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.Node, [core.int]),
       [dartx.getNamedItem]: dart.definiteFunctionType(html$._Attr, [core.String]),
       [dartx.getNamedItemNS]: dart.definiteFunctionType(html$._Attr, [core.String, core.String]),
       [dartx.item]: dart.definiteFunctionType(html$._Attr, [core.int]),
@@ -79700,17 +94777,11 @@
   html$._SpeechRecognitionResultList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfSpeechRecognitionResult()];
   dart.setSignature(html$._SpeechRecognitionResultList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._SpeechRecognitionResultList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.SpeechRecognitionResult, []),
-      [dartx.last]: dart.definiteFunctionType(html$.SpeechRecognitionResult, []),
-      [dartx.single]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.SpeechRecognitionResult]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [core.int]),
       [dartx.item]: dart.definiteFunctionType(html$.SpeechRecognitionResult, [core.int])
     })
   });
@@ -79778,17 +94849,11 @@
   html$._StyleSheetList[dart.implements] = () => [_js_helper.JavaScriptIndexingBehavior, ListOfStyleSheet()];
   dart.setSignature(html$._StyleSheetList, {
     constructors: () => ({_: dart.definiteFunctionType(html$._StyleSheetList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(html$.StyleSheet, []),
-      [dartx.last]: dart.definiteFunctionType(html$.StyleSheet, []),
-      [dartx.single]: dart.definiteFunctionType(html$.StyleSheet, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(html$.StyleSheet, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, html$.StyleSheet]),
-      [dartx.elementAt]: dart.definiteFunctionType(html$.StyleSheet, [core.int]),
       [__getter__]: dart.definiteFunctionType(html$.CssStyleSheet, [core.String]),
       [dartx.item]: dart.definiteFunctionType(html$.StyleSheet, [core.int])
     })
@@ -79878,7 +94943,7 @@
     addAll(other) {
       other[dartx.forEach](dart.fn((k, v) => {
         this._set(k, v);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     containsValue(value) {
       for (let v of this.values) {
@@ -80065,7 +95130,7 @@
     addAll(other) {
       other[dartx.forEach](dart.fn((k, v) => {
         this._set(k, v);
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     containsValue(value) {
       return this.values[dartx.any](dart.fn(v => dart.equals(v, value), StringTobool$()));
@@ -80096,7 +95161,7 @@
         if (dart.test(this[_matches](key))) {
           f(this[_strip](key), value);
         }
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
     }
     get keys() {
       let keys = JSArrayOfString().of([]);
@@ -80104,7 +95169,7 @@
         if (dart.test(this[_matches](key))) {
           keys[dartx.add](this[_strip](key));
         }
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
       return keys;
     }
     get values() {
@@ -80113,7 +95178,7 @@
         if (dart.test(this[_matches](key))) {
           values[dartx.add](value);
         }
-      }, StringAndStringTovoid$()));
+      }, StringAndStringToNull()));
       return values;
     }
     get length() {
@@ -81001,43 +96066,43 @@
   const _unit = Symbol('_unit');
   html$.Dimension = class Dimension extends core.Object {
     percent(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = '%';
     }
     px(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'px';
     }
     pc(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'pc';
     }
     pt(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'pt';
     }
     inch(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'in';
     }
     cm(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'cm';
     }
     mm(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'mm';
     }
     em(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'em';
     }
     ex(value) {
-      this[_value$1] = value;
+      this[_value$2] = value;
       this[_unit] = 'ex';
     }
     css(cssValue) {
-      this[_value$1] = null;
+      this[_value$2] = null;
       this[_unit] = null;
       if (cssValue == '') cssValue = '0px';
       if (dart.test(cssValue[dartx.endsWith]('%'))) {
@@ -81046,16 +96111,16 @@
         this[_unit] = cssValue[dartx.substring](dart.notNull(cssValue[dartx.length]) - 2);
       }
       if (dart.test(cssValue[dartx.contains]('.'))) {
-        this[_value$1] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+        this[_value$2] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
       } else {
-        this[_value$1] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+        this[_value$2] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
       }
     }
     toString() {
-      return dart.str`${this[_value$1]}${this[_unit]}`;
+      return dart.str`${this[_value$2]}${this[_unit]}`;
     }
     get value() {
-      return this[_value$1];
+      return this[_value$2];
     }
   };
   dart.defineNamedConstructor(html$.Dimension, 'percent');
@@ -81082,7 +96147,7 @@
       css: dart.definiteFunctionType(html$.Dimension, [core.String])
     }),
     fields: () => ({
-      [_value$1]: core.num,
+      [_value$2]: core.num,
       [_unit]: core.String
     }),
     getters: () => ({value: dart.definiteFunctionType(core.num, [])})
@@ -81134,7 +96199,7 @@
     return ElementStream;
   });
   html$.ElementStream = ElementStream();
-  const _target$ = Symbol('_target');
+  const _target$0 = Symbol('_target');
   const _useCapture = Symbol('_useCapture');
   html$._EventStream$ = dart.generic(T => {
     let _EventStreamSubscriptionOfT = () => (_EventStreamSubscriptionOfT = dart.constFn(html$._EventStreamSubscription$(T)))();
@@ -81143,7 +96208,7 @@
     let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     class _EventStream extends async.Stream$(T) {
       new(target, eventType, useCapture) {
-        this[_target$] = target;
+        this[_target$0] = target;
         this[_eventType] = eventType;
         this[_useCapture] = useCapture;
         super.new();
@@ -81160,20 +96225,17 @@
         let onError = opts && 'onError' in opts ? opts.onError : null;
         let onDone = opts && 'onDone' in opts ? opts.onDone : null;
         let cancelOnError = opts && 'cancelOnError' in opts ? opts.cancelOnError : null;
-        return new (_EventStreamSubscriptionOfT())(this[_target$], this[_eventType], onData, this[_useCapture]);
+        return new (_EventStreamSubscriptionOfT())(this[_target$0], this[_eventType], onData, this[_useCapture]);
       }
     }
     dart.setSignature(_EventStream, {
       constructors: () => ({new: dart.definiteFunctionType(html$._EventStream$(T), [html$.EventTarget, core.String, core.bool])}),
       fields: () => ({
-        [_target$]: html$.EventTarget,
+        [_target$0]: html$.EventTarget,
         [_eventType]: core.String,
         [_useCapture]: core.bool
       }),
-      methods: () => ({
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
-        listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})
-      })
+      methods: () => ({listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool})})
     });
     return _EventStream;
   });
@@ -81200,7 +96262,7 @@
         }, TToT()));
       }
       capture(onData) {
-        return new (_EventStreamSubscriptionOfT())(this[_target$], this[_eventType], onData, true);
+        return new (_EventStreamSubscriptionOfT())(this[_target$0], this[_eventType], onData, true);
       }
     }
     _ElementEventStreamImpl[dart.implements] = () => [ElementStreamOfT()];
@@ -81274,8 +96336,7 @@
       methods: () => ({
         matches: dart.definiteFunctionType(async.Stream$(T), [core.String]),
         listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
-        capture: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()]),
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()})
+        capture: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()])
       })
     });
     return _ElementListEventStreamImpl;
@@ -81286,8 +96347,8 @@
     return _EventListener;
   });
   html$._EventListener = _EventListener();
-  const _onData$ = Symbol('_onData');
-  const _pauseCount$ = Symbol('_pauseCount');
+  const _onData$0 = Symbol('_onData');
+  const _pauseCount$0 = Symbol('_pauseCount');
   const _tryResume = Symbol('_tryResume');
   const _canceled = Symbol('_canceled');
   const _unlisten = Symbol('_unlisten');
@@ -81295,29 +96356,29 @@
     let TTovoid = () => (TTovoid = dart.constFn(dart.functionType(dart.void, [T])))();
     class _EventStreamSubscription extends async.StreamSubscription$(T) {
       new(target, eventType, onData, useCapture) {
-        this[_target$] = target;
+        this[_target$0] = target;
         this[_eventType] = eventType;
         this[_useCapture] = useCapture;
-        this[_onData$] = html$._wrapZone(html$.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(onData));
-        this[_pauseCount$] = 0;
+        this[_onData$0] = onData == null ? null : html$._wrapZone(html$.Event, dart.dynamic)(dart.fn(e => dart.dcall(onData, e), EventTodynamic()));
+        this[_pauseCount$0] = 0;
         this[_tryResume]();
       }
       cancel() {
         if (dart.test(this[_canceled])) return null;
         this[_unlisten]();
-        this[_target$] = null;
-        this[_onData$] = null;
+        this[_target$0] = null;
+        this[_onData$0] = null;
         return null;
       }
       get [_canceled]() {
-        return this[_target$] == null;
+        return this[_target$0] == null;
       }
       onData(handleData) {
         if (dart.test(this[_canceled])) {
           dart.throw(new core.StateError("Subscription has been canceled."));
         }
         this[_unlisten]();
-        this[_onData$] = html$._wrapZone(html$.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(handleData));
+        this[_onData$0] = html$._wrapZone(html$.Event, dart.dynamic)(_wrapZoneCallbackOfEvent$dynamic()._check(handleData));
         this[_tryResume]();
       }
       onError(handleError) {}
@@ -81325,43 +96386,45 @@
       pause(resumeSignal) {
         if (resumeSignal === void 0) resumeSignal = null;
         if (dart.test(this[_canceled])) return;
-        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) + 1;
+        this[_pauseCount$0] = dart.notNull(this[_pauseCount$0]) + 1;
         this[_unlisten]();
         if (resumeSignal != null) {
           resumeSignal.whenComplete(dart.bind(this, 'resume'));
         }
       }
       get isPaused() {
-        return dart.notNull(this[_pauseCount$]) > 0;
+        return dart.notNull(this[_pauseCount$0]) > 0;
       }
       resume() {
         if (dart.test(this[_canceled]) || !dart.test(this.isPaused)) return;
-        this[_pauseCount$] = dart.notNull(this[_pauseCount$]) - 1;
+        this[_pauseCount$0] = dart.notNull(this[_pauseCount$0]) - 1;
         this[_tryResume]();
       }
       [_tryResume]() {
-        if (this[_onData$] != null && !dart.test(this.isPaused)) {
-          this[_target$][dartx.addEventListener](this[_eventType], this[_onData$], this[_useCapture]);
+        if (this[_onData$0] != null && !dart.test(this.isPaused)) {
+          this[_target$0][dartx.addEventListener](this[_eventType], this[_onData$0], this[_useCapture]);
         }
       }
       [_unlisten]() {
-        if (this[_onData$] != null) {
-          this[_target$][dartx.removeEventListener](this[_eventType], this[_onData$], this[_useCapture]);
+        if (this[_onData$0] != null) {
+          this[_target$0][dartx.removeEventListener](this[_eventType], this[_onData$0], this[_useCapture]);
         }
       }
-      asFuture(futureValue) {
-        if (futureValue === void 0) futureValue = null;
-        let completer = async.Completer.new();
-        return completer.future;
+      asFuture(E) {
+        return futureValue => {
+          if (futureValue === void 0) futureValue = null;
+          let completer = async.Completer$(E).new();
+          return completer.future;
+        };
       }
     }
     dart.setSignature(_EventStreamSubscription, {
       constructors: () => ({new: dart.definiteFunctionType(html$._EventStreamSubscription$(T), [html$.EventTarget, core.String, TTovoid(), core.bool])}),
       fields: () => ({
-        [_pauseCount$]: core.int,
-        [_target$]: html$.EventTarget,
+        [_pauseCount$0]: core.int,
+        [_target$0]: html$.EventTarget,
         [_eventType]: core.String,
-        [_onData$]: html$.EventListener,
+        [_onData$0]: html$.EventListener,
         [_useCapture]: core.bool
       }),
       getters: () => ({
@@ -81377,7 +96440,7 @@
         resume: dart.definiteFunctionType(dart.void, []),
         [_tryResume]: dart.definiteFunctionType(dart.void, []),
         [_unlisten]: dart.definiteFunctionType(dart.void, []),
-        asFuture: dart.definiteFunctionType(async.Future, [], [dart.dynamic])
+        asFuture: dart.definiteFunctionType(E => [async.Future$(E), [], [E]])
       })
     });
     return _EventStreamSubscription;
@@ -81392,7 +96455,7 @@
   });
   html$.CustomStream = CustomStream();
   const _streamController = Symbol('_streamController');
-  const _type = Symbol('_type');
+  const _type$ = Symbol('_type');
   html$._CustomEventStreamImpl$ = dart.generic(T => {
     let StreamControllerOfT = () => (StreamControllerOfT = dart.constFn(async.StreamController$(T)))();
     let CustomStreamOfT = () => (CustomStreamOfT = dart.constFn(html$.CustomStream$(T)))();
@@ -81402,9 +96465,9 @@
     class _CustomEventStreamImpl extends async.Stream$(T) {
       new(type) {
         this[_streamController] = null;
-        this[_type] = null;
+        this[_type$] = null;
         super.new();
-        this[_type] = type;
+        this[_type$] = type;
         this[_streamController] = StreamControllerOfT().broadcast({sync: true});
       }
       listen(onData, opts) {
@@ -81423,7 +96486,7 @@
       }
       add(event) {
         T._check(event);
-        if (event[dartx.type] == this[_type]) this[_streamController].add(event);
+        if (event[dartx.type] == this[_type$]) this[_streamController].add(event);
       }
     }
     _CustomEventStreamImpl[dart.implements] = () => [CustomStreamOfT()];
@@ -81431,11 +96494,10 @@
       constructors: () => ({new: dart.definiteFunctionType(html$._CustomEventStreamImpl$(T), [core.String])}),
       fields: () => ({
         [_streamController]: StreamControllerOfT(),
-        [_type]: core.String
+        [_type$]: core.String
       }),
       methods: () => ({
         listen: dart.definiteFunctionType(async.StreamSubscription$(T), [TTovoid()], {onError: core.Function, onDone: VoidTovoid(), cancelOnError: core.bool}),
-        asBroadcastStream: dart.definiteFunctionType(async.Stream$(T), [], {onListen: StreamSubscriptionOfTTovoid(), onCancel: StreamSubscriptionOfTTovoid()}),
         add: dart.definiteFunctionType(dart.void, [T])
       })
     });
@@ -81704,7 +96766,7 @@
       super.new(type);
     }
     add(event) {
-      if (event.type == this[_type]) {
+      if (event.type == this[_type$]) {
         event.currentTarget[dartx.dispatchEvent](event[_parent$]);
         this[_streamController].add(event);
       }
@@ -81713,11 +96775,10 @@
   dart.addSimpleTypeTests(html$._CustomKeyEventStreamImpl);
   html$._CustomKeyEventStreamImpl[dart.implements] = () => [CustomStreamOfKeyEvent()];
   dart.setSignature(html$._CustomKeyEventStreamImpl, {
-    constructors: () => ({new: dart.definiteFunctionType(html$._CustomKeyEventStreamImpl, [core.String])}),
-    methods: () => ({add: dart.definiteFunctionType(dart.void, [html$.KeyEvent])})
+    constructors: () => ({new: dart.definiteFunctionType(html$._CustomKeyEventStreamImpl, [core.String])})
   });
   const _subscriptions = Symbol('_subscriptions');
-  const _controller$0 = Symbol('_controller');
+  const _controller$1 = Symbol('_controller');
   html$._StreamPool$ = dart.generic(T => {
     let StreamOfT = () => (StreamOfT = dart.constFn(async.Stream$(T)))();
     let StreamSubscriptionOfT = () => (StreamSubscriptionOfT = dart.constFn(async.StreamSubscription$(T)))();
@@ -81726,16 +96787,16 @@
     class _StreamPool extends core.Object {
       broadcast() {
         this[_subscriptions] = MapOfStreamOfT$StreamSubscriptionOfT().new();
-        this[_controller$0] = null;
-        this[_controller$0] = StreamControllerOfT().broadcast({sync: true, onCancel: dart.bind(this, 'close')});
+        this[_controller$1] = null;
+        this[_controller$1] = StreamControllerOfT().broadcast({sync: true, onCancel: dart.bind(this, 'close')});
       }
       get stream() {
-        return this[_controller$0].stream;
+        return this[_controller$1].stream;
       }
       add(stream) {
         StreamOfT()._check(stream);
         if (dart.test(this[_subscriptions][dartx.containsKey](stream))) return;
-        this[_subscriptions][dartx._set](stream, stream.listen(dart.bind(this[_controller$0], 'add'), {onError: dart.bind(this[_controller$0], 'addError'), onDone: dart.fn(() => this.remove(stream), VoidTovoid$())}));
+        this[_subscriptions][dartx._set](stream, stream.listen(dart.bind(this[_controller$1], 'add'), {onError: dart.bind(this[_controller$1], 'addError'), onDone: dart.fn(() => this.remove(stream), VoidTovoid$())}));
       }
       remove(stream) {
         StreamOfT()._check(stream);
@@ -81747,7 +96808,7 @@
           subscription.cancel();
         }
         this[_subscriptions][dartx.clear]();
-        this[_controller$0].close();
+        this[_controller$1].close();
       }
     }
     dart.addTypeTests(_StreamPool);
@@ -81755,7 +96816,7 @@
     dart.setSignature(_StreamPool, {
       constructors: () => ({broadcast: dart.definiteFunctionType(html$._StreamPool$(T), [])}),
       fields: () => ({
-        [_controller$0]: StreamControllerOfT(),
+        [_controller$1]: StreamControllerOfT(),
         [_subscriptions]: MapOfStreamOfT$StreamSubscriptionOfT()
       }),
       getters: () => ({stream: dart.definiteFunctionType(async.Stream$(T), [])}),
@@ -82625,7 +97686,7 @@
   html$._KeyName.DEAD_VOICED_SOUND = "DeadVoicedSound";
   html$._KeyName.DEC_SEMIVOICED_SOUND = "DeadSemivoicedSound";
   html$._KeyName.UNIDENTIFIED = "Unidentified";
-  const _stream$ = Symbol('_stream');
+  const _stream$0 = Symbol('_stream');
   const _keyDownList = Symbol('_keyDownList');
   const _capsLockOn = Symbol('_capsLockOn');
   const _determineKeyCodeForKeypress = Symbol('_determineKeyCodeForKeypress');
@@ -82635,26 +97696,26 @@
   html$._KeyboardEventHandler = class _KeyboardEventHandler extends html$.EventStreamProvider$(html$.KeyEvent) {
     forTarget(e, opts) {
       let useCapture = opts && 'useCapture' in opts ? opts.useCapture : false;
-      let handler = new html$._KeyboardEventHandler.initializeAllEventListeners(this[_type], e);
-      return handler[_stream$];
+      let handler = new html$._KeyboardEventHandler.initializeAllEventListeners(this[_type$], e);
+      return handler[_stream$0];
     }
     new(type) {
       this[_keyDownList] = JSArrayOfKeyEvent().of([]);
-      this[_type] = type;
-      this[_stream$] = new html$._CustomKeyEventStreamImpl('event');
-      this[_target$] = null;
+      this[_type$] = type;
+      this[_stream$0] = new html$._CustomKeyEventStreamImpl('event');
+      this[_target$0] = null;
       super.new(html$._KeyboardEventHandler._EVENT_TYPE);
     }
     initializeAllEventListeners(type, target) {
       this[_keyDownList] = JSArrayOfKeyEvent().of([]);
-      this[_type] = type;
-      this[_target$] = target;
-      this[_stream$] = null;
+      this[_type$] = type;
+      this[_target$0] = target;
+      this[_stream$0] = null;
       super.new(html$._KeyboardEventHandler._EVENT_TYPE);
-      html$.Element.keyDownEvent.forTarget(this[_target$], {useCapture: true}).listen(dart.bind(this, 'processKeyDown'));
-      html$.Element.keyPressEvent.forTarget(this[_target$], {useCapture: true}).listen(dart.bind(this, 'processKeyPress'));
-      html$.Element.keyUpEvent.forTarget(this[_target$], {useCapture: true}).listen(dart.bind(this, 'processKeyUp'));
-      this[_stream$] = new html$._CustomKeyEventStreamImpl(this[_type]);
+      html$.Element.keyDownEvent.forTarget(this[_target$0], {useCapture: true}).listen(dart.bind(this, 'processKeyDown'));
+      html$.Element.keyPressEvent.forTarget(this[_target$0], {useCapture: true}).listen(dart.bind(this, 'processKeyPress'));
+      html$.Element.keyUpEvent.forTarget(this[_target$0], {useCapture: true}).listen(dart.bind(this, 'processKeyUp'));
+      this[_stream$0] = new html$._CustomKeyEventStreamImpl(this[_type$]);
     }
     get [_capsLockOn]() {
       return this[_keyDownList][dartx.any](dart.fn(element => element.keyCode == html$.KeyCode.CAPS_LOCK, KeyEventTobool()));
@@ -82847,7 +97908,7 @@
         this.processKeyPress(e);
       }
       this[_keyDownList][dartx.add](event);
-      this[_stream$].add(event);
+      this[_stream$0].add(event);
     }
     processKeyPress(event) {
       let e = new html$.KeyEvent.wrap(event);
@@ -82865,7 +97926,7 @@
         e[_shadowKeyCode] = html$._KeyboardEventHandler._keyIdentifier[dartx._get](e[_shadowKeyIdentifier]);
       }
       e[_shadowAltKey] = this[_keyDownList][dartx.any](dart.fn(element => element.altKey, KeyEventTobool()));
-      this[_stream$].add(e);
+      this[_stream$0].add(e);
     }
     processKeyUp(event) {
       let e = new html$.KeyEvent.wrap(event);
@@ -82880,7 +97941,7 @@
       } else if (dart.notNull(this[_keyDownList][dartx.length]) > 0) {
         this[_keyDownList][dartx.removeLast]();
       }
-      this[_stream$].add(e);
+      this[_stream$0].add(e);
     }
   };
   dart.addSimpleTypeTests(html$._KeyboardEventHandler);
@@ -82892,9 +97953,9 @@
     }),
     fields: () => ({
       [_keyDownList]: ListOfKeyEvent(),
-      [_type]: core.String,
-      [_target$]: html$.EventTarget,
-      [_stream$]: html$._CustomKeyEventStreamImpl
+      [_type$]: core.String,
+      [_target$0]: html$.EventTarget,
+      [_stream$0]: html$._CustomKeyEventStreamImpl
     }),
     getters: () => ({[_capsLockOn]: dart.definiteFunctionType(core.bool, [])}),
     methods: () => ({
@@ -83050,25 +98111,25 @@
       allowsAttribute: dart.definiteFunctionType(core.bool, [html$.Element, core.String, core.String])
     })
   });
-  let const$53;
-  let const$54;
-  let const$55;
-  let const$56;
-  let const$57;
-  let const$58;
-  let const$59;
-  let const$60;
-  let const$61;
-  let const$62;
+  let const$83;
+  let const$84;
+  let const$85;
+  let const$86;
+  let const$87;
+  let const$88;
+  let const$89;
+  let const$90;
+  let const$91;
+  let const$92;
   html$._SimpleNodeValidator = class _SimpleNodeValidator extends core.Object {
     static allowNavigation(uriPolicy) {
-      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$53 || (const$53 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$54 || (const$54 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$55 || (const$55 = dart.constList(['A::href', 'FORM::action'], core.String))});
+      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$83 || (const$83 = dart.constList(['A', 'FORM'], core.String)), allowedAttributes: const$84 || (const$84 = dart.constList(['A::accesskey', 'A::coords', 'A::hreflang', 'A::name', 'A::shape', 'A::tabindex', 'A::target', 'A::type', 'FORM::accept', 'FORM::autocomplete', 'FORM::enctype', 'FORM::method', 'FORM::name', 'FORM::novalidate', 'FORM::target'], core.String)), allowedUriAttributes: const$85 || (const$85 = dart.constList(['A::href', 'FORM::action'], core.String))});
     }
     static allowImages(uriPolicy) {
-      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$56 || (const$56 = dart.constList(['IMG'], core.String)), allowedAttributes: const$57 || (const$57 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$58 || (const$58 = dart.constList(['IMG::src'], core.String))});
+      return new html$._SimpleNodeValidator(uriPolicy, {allowedElements: const$86 || (const$86 = dart.constList(['IMG'], core.String)), allowedAttributes: const$87 || (const$87 = dart.constList(['IMG::align', 'IMG::alt', 'IMG::border', 'IMG::height', 'IMG::hspace', 'IMG::ismap', 'IMG::name', 'IMG::usemap', 'IMG::vspace', 'IMG::width'], core.String)), allowedUriAttributes: const$88 || (const$88 = dart.constList(['IMG::src'], core.String))});
     }
     static allowTextElements() {
-      return new html$._SimpleNodeValidator(null, {allowedElements: const$59 || (const$59 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
+      return new html$._SimpleNodeValidator(null, {allowedElements: const$89 || (const$89 = dart.constList(['B', 'BLOCKQUOTE', 'BR', 'EM', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'LI', 'OL', 'P', 'SPAN', 'UL'], core.String))});
     }
     new(uriPolicy, opts) {
       let allowedElements = opts && 'allowedElements' in opts ? opts.allowedElements : null;
@@ -83078,9 +98139,9 @@
       this.allowedAttributes = SetOfString().new();
       this.allowedUriAttributes = SetOfString().new();
       this.uriPolicy = uriPolicy;
-      this.allowedElements.addAll((allowedElements != null ? allowedElements : const$60 || (const$60 = dart.constList([], core.String))));
-      allowedAttributes = allowedAttributes != null ? allowedAttributes : const$61 || (const$61 = dart.constList([], core.String));
-      allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$62 || (const$62 = dart.constList([], core.String));
+      this.allowedElements.addAll((allowedElements != null ? allowedElements : const$90 || (const$90 = dart.constList([], core.String))));
+      allowedAttributes = allowedAttributes != null ? allowedAttributes : const$91 || (const$91 = dart.constList([], core.String));
+      allowedUriAttributes = allowedUriAttributes != null ? allowedUriAttributes : const$92 || (const$92 = dart.constList([], core.String));
       let legalAttributes = allowedAttributes[dartx.where](dart.fn(x => !dart.test(html$._Html5NodeValidator._uriAttributes[dartx.contains](x)), StringTobool$()));
       let extraUriAttributes = allowedAttributes[dartx.where](dart.fn(x => html$._Html5NodeValidator._uriAttributes[dartx.contains](x), StringTobool$()));
       this.allowedAttributes.addAll(legalAttributes);
@@ -83303,21 +98364,13 @@
       constructors: () => ({new: dart.definiteFunctionType(html$._WrappedList$(E), [ListOfNode()])}),
       fields: () => ({[_list$]: ListOfNode()}),
       getters: () => ({
-        iterator: dart.definiteFunctionType(core.Iterator$(E), []),
         length: dart.definiteFunctionType(core.int, []),
         rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
       }),
       setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
       methods: () => ({
-        add: dart.definiteFunctionType(dart.void, [E]),
         _get: dart.definiteFunctionType(E, [core.int]),
-        _set: dart.definiteFunctionType(dart.void, [core.int, E]),
-        sort: dart.definiteFunctionType(dart.void, [], [EAndEToint()]),
-        insert: dart.definiteFunctionType(dart.void, [core.int, E]),
-        removeAt: dart.definiteFunctionType(E, [core.int]),
-        setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()], [core.int]),
-        replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfE()]),
-        fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [E])
+        _set: dart.definiteFunctionType(dart.void, [core.int, E])
       })
     });
     dart.defineExtensionMembers(_WrappedList, [
@@ -83382,7 +98435,7 @@
         if (request[dartx.readyState] == html$.HttpRequest.DONE) {
           onComplete(request);
         }
-      }, ProgressEventTovoid$()));
+      }, ProgressEventToNull()));
       request[dartx.send]();
       return request;
     }
@@ -83399,19 +98452,19 @@
     class FixedSizeListIterator extends core.Object {
       new(array) {
         this[_array] = array;
-        this[_position$0] = -1;
-        this[_length$2] = array[dartx.length];
+        this[_position$1] = -1;
+        this[_length$3] = array[dartx.length];
         this[_current$4] = null;
       }
       moveNext() {
-        let nextPosition = dart.notNull(this[_position$0]) + 1;
-        if (nextPosition < dart.notNull(this[_length$2])) {
+        let nextPosition = dart.notNull(this[_position$1]) + 1;
+        if (nextPosition < dart.notNull(this[_length$3])) {
           this[_current$4] = this[_array][dartx._get](nextPosition);
-          this[_position$0] = nextPosition;
+          this[_position$1] = nextPosition;
           return true;
         }
         this[_current$4] = null;
-        this[_position$0] = this[_length$2];
+        this[_position$1] = this[_length$3];
         return false;
       }
       get current() {
@@ -83424,8 +98477,8 @@
       constructors: () => ({new: dart.definiteFunctionType(html$.FixedSizeListIterator$(T), [ListOfT()])}),
       fields: () => ({
         [_array]: ListOfT(),
-        [_length$2]: core.int,
-        [_position$0]: core.int,
+        [_length$3]: core.int,
+        [_position$1]: core.int,
         [_current$4]: T
       }),
       getters: () => ({current: dart.definiteFunctionType(T, [])}),
@@ -83440,18 +98493,18 @@
     class _VariableSizeListIterator extends core.Object {
       new(array) {
         this[_array] = array;
-        this[_position$0] = -1;
+        this[_position$1] = -1;
         this[_current$4] = null;
       }
       moveNext() {
-        let nextPosition = dart.notNull(this[_position$0]) + 1;
+        let nextPosition = dart.notNull(this[_position$1]) + 1;
         if (nextPosition < dart.notNull(this[_array][dartx.length])) {
           this[_current$4] = this[_array][dartx._get](nextPosition);
-          this[_position$0] = nextPosition;
+          this[_position$1] = nextPosition;
           return true;
         }
         this[_current$4] = null;
-        this[_position$0] = this[_array][dartx.length];
+        this[_position$1] = this[_array][dartx.length];
         return false;
       }
       get current() {
@@ -83464,7 +98517,7 @@
       constructors: () => ({new: dart.definiteFunctionType(html$._VariableSizeListIterator$(T), [ListOfT()])}),
       fields: () => ({
         [_array]: ListOfT(),
-        [_position$0]: core.int,
+        [_position$1]: core.int,
         [_current$4]: T
       }),
       getters: () => ({current: dart.definiteFunctionType(T, [])}),
@@ -84128,7 +99181,7 @@
         this.writeSlot(slot, copy);
         e[dartx.forEach](dart.fn((key, value) => {
           this.putIntoMap(copy, key, this.walk(value));
-        }, dynamicAnddynamicTovoid$()));
+        }, dynamicAnddynamicToNull()));
         return copy;
       }
       if (core.List.is(e)) {
@@ -84337,7 +99390,7 @@
     }
     dict[dartx.forEach](dart.fn((key, value) => {
       object[key] = value;
-    }, StringAnddynamicTovoid()));
+    }, StringAnddynamicToNull()));
     return object;
   };
   dart.fn(html_common.convertDartToNative_Dictionary, Map__Todynamic());
@@ -84362,7 +99415,7 @@
     let mustCopy = opts && 'mustCopy' in opts ? opts.mustCopy : false;
     return new html_common._AcceptStructuredCloneDart2Js().convertNativeToDart_AcceptStructuredClone(object, {mustCopy: mustCopy});
   };
-  dart.fn(html_common.convertNativeToDart_AcceptStructuredClone, dynamic__Todynamic$());
+  dart.fn(html_common.convertNativeToDart_AcceptStructuredClone, dynamic__Todynamic());
   html_common._StructuredCloneDart2Js = class _StructuredCloneDart2Js extends html_common._StructuredClone {
     new() {
       super.new();
@@ -84670,25 +99723,12 @@
     getters: () => ({
       [_iterable$0]: dart.definiteFunctionType(core.Iterable$(html$.Element), []),
       [_filtered]: dart.definiteFunctionType(core.List$(html$.Element), []),
-      reversed: dart.definiteFunctionType(core.Iterable$(html$.Element), []),
       length: dart.definiteFunctionType(core.int, []),
-      iterator: dart.definiteFunctionType(core.Iterator$(html$.Element), []),
       rawList: dart.definiteFunctionType(core.List$(html$.Node), [])
     }),
     setters: () => ({length: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
-      forEach: dart.definiteFunctionType(dart.void, [ElementTovoid()]),
       _set: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
-      add: dart.definiteFunctionType(dart.void, [html$.Element]),
-      addAll: dart.definiteFunctionType(dart.void, [IterableOfElement()]),
-      sort: dart.definiteFunctionType(dart.void, [], [ElementAndElementToint()]),
-      setRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()], [core.int]),
-      fillRange: dart.definiteFunctionType(dart.void, [core.int, core.int], [html$.Element]),
-      replaceRange: dart.definiteFunctionType(dart.void, [core.int, core.int, IterableOfElement()]),
-      removeLast: dart.definiteFunctionType(html$.Element, []),
-      insert: dart.definiteFunctionType(dart.void, [core.int, html$.Element]),
-      insertAll: dart.definiteFunctionType(dart.void, [core.int, IterableOfElement()]),
-      removeAt: dart.definiteFunctionType(html$.Element, [core.int]),
       _get: dart.definiteFunctionType(html$.Element, [core.int])
     })
   });
@@ -88359,17 +103399,11 @@
   dart.setSignature(svg$.LengthList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.LengthList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.Length, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.Length, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.Length, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.Length, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.Length]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.Length, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.Length]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.Length, [svg$.Length]),
       [dartx.getItem]: dart.definiteFunctionType(svg$.Length, [core.int]),
@@ -88965,17 +103999,11 @@
   dart.setSignature(svg$.NumberList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.NumberList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.Number, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.Number, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.Number, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.Number, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.Number]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.Number, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.Number]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.Number, [svg$.Number]),
       [dartx.getItem]: dart.definiteFunctionType(svg$.Number, [core.int]),
@@ -89950,17 +104978,11 @@
   dart.setSignature(svg$.PathSegList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.PathSegList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.PathSeg, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.PathSeg, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.PathSeg, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.PathSeg, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.PathSeg]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.PathSeg, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.PathSeg]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.PathSeg, [svg$.PathSeg]),
       [dartx.getItem]: dart.definiteFunctionType(svg$.PathSeg, [core.int]),
@@ -90715,17 +105737,11 @@
   dart.setSignature(svg$.StringList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.StringList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(core.String, []),
-      [dartx.last]: dart.definiteFunctionType(core.String, []),
-      [dartx.single]: dart.definiteFunctionType(core.String, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(core.String, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
-      [dartx.elementAt]: dart.definiteFunctionType(core.String, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, core.String]),
       [dartx.appendItem]: dart.definiteFunctionType(core.String, [core.String]),
       [dartx.getItem]: dart.definiteFunctionType(core.String, [core.int]),
@@ -91599,17 +106615,11 @@
   dart.setSignature(svg$.TransformList, {
     constructors: () => ({_: dart.definiteFunctionType(svg$.TransformList, [])}),
     fields: () => ({[dartx.numberOfItems]: core.int}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(svg$.Transform, []),
-      [dartx.last]: dart.definiteFunctionType(svg$.Transform, []),
-      [dartx.single]: dart.definiteFunctionType(svg$.Transform, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(svg$.Transform, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, svg$.Transform]),
-      [dartx.elementAt]: dart.definiteFunctionType(svg$.Transform, [core.int]),
       [__setter__$]: dart.definiteFunctionType(dart.void, [core.int, svg$.Transform]),
       [dartx.appendItem]: dart.definiteFunctionType(svg$.Transform, [svg$.Transform]),
       [dartx.consolidate]: dart.definiteFunctionType(svg$.Transform, []),
@@ -92376,13 +107386,13 @@
       let completer = CompleterOfAudioBuffer().new();
       this[_decodeAudioData](audioData, dart.fn(value => {
         completer.complete(value);
-      }, AudioBufferTovoid()), dart.fn(error => {
+      }, AudioBufferToNull()), dart.fn(error => {
         if (error == null) {
           completer.completeError('');
         } else {
           completer.completeError(error);
         }
-      }, AudioBufferTovoid()));
+      }, AudioBufferToNull()));
       return completer.future;
     }
   };
@@ -92818,7 +107828,7 @@
       return web_audio.OfflineAudioContext._create_1(numberOfChannels, numberOfFrames, sampleRate);
     }
     static _create_1(numberOfChannels, numberOfFrames, sampleRate) {
-      return new OfflineAudioContext(numberOfChannels, numberOfFrames, sampleRate);
+      return new self.OfflineAudioContext(numberOfChannels, numberOfFrames, sampleRate);
     }
   };
   dart.setSignature(web_audio.OfflineAudioContext, {
@@ -95646,17 +110656,11 @@
   web_sql.SqlResultSetRowList[dart.implements] = () => [ListOfMap()];
   dart.setSignature(web_sql.SqlResultSetRowList, {
     constructors: () => ({_: dart.definiteFunctionType(web_sql.SqlResultSetRowList, [])}),
-    getters: () => ({
-      [dartx.length]: dart.definiteFunctionType(core.int, []),
-      [dartx.first]: dart.definiteFunctionType(core.Map, []),
-      [dartx.last]: dart.definiteFunctionType(core.Map, []),
-      [dartx.single]: dart.definiteFunctionType(core.Map, [])
-    }),
+    getters: () => ({[dartx.length]: dart.definiteFunctionType(core.int, [])}),
     setters: () => ({[dartx.length]: dart.definiteFunctionType(dart.void, [core.int])}),
     methods: () => ({
       [dartx._get]: dart.definiteFunctionType(core.Map, [core.int]),
       [dartx._set]: dart.definiteFunctionType(dart.void, [core.int, core.Map]),
-      [dartx.elementAt]: dart.definiteFunctionType(core.Map, [core.int]),
       [dartx.item]: dart.definiteFunctionType(core.Map, [core.int]),
       [_item_1]: dart.definiteFunctionType(dart.dynamic, [dart.dynamic])
     })
@@ -95697,6 +110701,7 @@
   exports.convert = convert;
   exports.core = core;
   exports.developer = developer;
+  exports.io = io;
   exports.isolate = isolate;
   exports.js = js;
   exports.js_util = js_util;
diff --git a/pkg/dev_compiler/lib/sdk/ddc_sdk.sum b/pkg/dev_compiler/lib/sdk/ddc_sdk.sum
index 6286c3e..0c71c33 100644
--- a/pkg/dev_compiler/lib/sdk/ddc_sdk.sum
+++ b/pkg/dev_compiler/lib/sdk/ddc_sdk.sum
Binary files differ
diff --git a/pkg/dev_compiler/lib/src/analyzer/context.dart b/pkg/dev_compiler/lib/src/analyzer/context.dart
index d2bfe96..188f978 100644
--- a/pkg/dev_compiler/lib/src/analyzer/context.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/context.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:args/args.dart' show ArgParser, ArgResults;
+import 'package:analyzer/src/command_line/arguments.dart';
 import 'package:analyzer/file_system/file_system.dart'
     show ResourceProvider, ResourceUriResolver;
 import 'package:analyzer/file_system/physical_file_system.dart'
@@ -10,80 +11,87 @@
 import 'package:analyzer/source/custom_resolver.dart';
 import 'package:analyzer/source/package_map_resolver.dart';
 import 'package:analyzer/src/context/builder.dart';
-import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl;
-import 'package:analyzer/src/dart/sdk/sdk.dart' show FolderBasedDartSdk;
-import 'package:analyzer/src/generated/engine.dart'
-    show AnalysisEngine, AnalysisOptionsImpl;
+import 'package:analyzer/src/generated/engine.dart' show AnalysisOptionsImpl;
 import 'package:analyzer/src/generated/source.dart'
     show DartUriResolver, SourceFactory, UriResolver;
 import 'package:analyzer/src/summary/package_bundle_reader.dart'
     show InSummaryUriResolver, SummaryDataStore;
-import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk;
 import 'package:cli_util/cli_util.dart' show getSdkDir;
 import 'package:path/path.dart' as path;
 
 /// Options used to set up Source URI resolution in the analysis context.
 class AnalyzerOptions {
+  final ContextBuilderOptions contextBuilderOptions;
+
   /// Custom URI mappings, such as "dart:foo" -> "path/to/foo.dart"
   final Map<String, String> customUrlMappings;
 
   /// Package root when resolving 'package:' urls the standard way.
-  final String packageRoot;
+  String get packageRoot => contextBuilderOptions.defaultPackagesDirectoryPath;
 
   /// List of summary file paths.
   final List<String> summaryPaths;
 
-  /// Path to the dart-sdk. Null if `useMockSdk` is true or if the path couldn't
-  /// be determined
+  /// Path to the dart-sdk, or `null` if the path couldn't be determined.
   final String dartSdkPath;
 
   /// Path to the dart-sdk summary.  If this is set, it will be used in favor
   /// of the unsummarized one.
-  final String dartSdkSummaryPath;
+  String get dartSdkSummaryPath => contextBuilderOptions.dartSdkSummaryPath;
 
   /// Defined variables used by `bool.fromEnvironment` etc.
-  final Map<String, String> declaredVariables;
+  Map<String, String> get declaredVariables =>
+      contextBuilderOptions.declaredVariables;
 
-  AnalyzerOptions(
-      {this.summaryPaths: const [],
+  AnalyzerOptions._(
+      {this.contextBuilderOptions,
+      List<String> summaryPaths,
       String dartSdkPath,
-      this.dartSdkSummaryPath,
-      this.customUrlMappings: const {},
-      this.packageRoot: null,
-      this.declaredVariables: const {}})
-      : dartSdkPath = dartSdkPath ?? getSdkDir().path;
-
-  factory AnalyzerOptions.fromArguments(
-      ArgResults args, Map<String, String> declaredVariables) {
-    var sdkPath = args['dart-sdk'] ?? getSdkDir().path;
-    var sdkSummaryPath = args['dart-sdk-summary'];
-
-    if (sdkSummaryPath == null) {
-      sdkSummaryPath = path.join(sdkPath, 'lib', '_internal', 'ddc_sdk.sum');
-    } else if (sdkSummaryPath == 'build') {
-      // For building the SDK, we explicitly set the path to none.
-      sdkSummaryPath = null;
-    }
-
-    return new AnalyzerOptions(
-        summaryPaths: args['summary'] as List<String>,
-        dartSdkPath: sdkPath,
-        dartSdkSummaryPath: sdkSummaryPath,
-        customUrlMappings: _parseUrlMappings(args['url-mapping']),
-        packageRoot: args['package-root'],
-        declaredVariables: declaredVariables);
+      this.customUrlMappings: const {}})
+      : dartSdkPath = dartSdkPath ?? getSdkDir().path,
+        summaryPaths = summaryPaths ?? const [] {
+    contextBuilderOptions.declaredVariables ??= const {};
   }
 
-  static void addArguments(ArgParser parser) {
+  factory AnalyzerOptions.basic(
+      {String dartSdkPath,
+      String dartSdkSummaryPath,
+      List<String> summaryPaths}) {
+    var contextBuilderOptions = new ContextBuilderOptions()
+      ..defaultOptions = (new AnalysisOptionsImpl()..strongMode = true)
+      ..dartSdkSummaryPath = dartSdkSummaryPath;
+
+    return new AnalyzerOptions._(
+        contextBuilderOptions: contextBuilderOptions,
+        dartSdkPath: dartSdkPath,
+        summaryPaths: summaryPaths);
+  }
+
+  factory AnalyzerOptions.fromArguments(ArgResults args,
+      {String dartSdkSummaryPath, List<String> summaryPaths}) {
+    var contextBuilderOptions = createContextBuilderOptions(args,
+        strongMode: true, trackCacheDependencies: false);
+
+    var dartSdkPath = args['dart-sdk'] ?? getSdkDir().path;
+
+    dartSdkSummaryPath ??= contextBuilderOptions.dartSdkSummaryPath;
+    dartSdkSummaryPath ??=
+        path.join(dartSdkPath, 'lib', '_internal', 'ddc_sdk.sum');
+    // For building the SDK, we explicitly set the path to none.
+    if (dartSdkSummaryPath == 'build') dartSdkSummaryPath = null;
+    contextBuilderOptions.dartSdkSummaryPath = dartSdkSummaryPath;
+
+    return new AnalyzerOptions._(
+        contextBuilderOptions: contextBuilderOptions,
+        summaryPaths: summaryPaths ?? args['summary'] as List<String>,
+        dartSdkPath: dartSdkPath,
+        customUrlMappings: _parseUrlMappings(args['url-mapping']));
+  }
+
+  static void addArguments(ArgParser parser, {bool hide: true}) {
     parser
       ..addOption('summary',
           abbr: 's', help: 'summary file(s) to include', allowMultiple: true)
-      ..addOption('dart-sdk',
-          help: 'Dart SDK Path', defaultsTo: null, hide: true)
-      ..addOption('dart-sdk-summary',
-          help: 'Dart SDK Summary Path', defaultsTo: null, hide: true)
-      ..addOption('package-root',
-          abbr: 'p', help: 'Package root to resolve "package:" imports')
       ..addOption('url-mapping',
           help: '--url-mapping=libraryUri,/path/to/library.dart uses\n'
               'library.dart as the source for an import of of "libraryUri".',
@@ -103,20 +111,8 @@
   }
 }
 
-/// Creates an analysis context that contains our restricted typing rules.
-AnalysisContextImpl createAnalysisContext() {
-  var res = AnalysisEngine.instance.createAnalysisContext();
-  res.analysisOptions = new AnalysisOptionsImpl()
-    ..strongMode = true
-    ..trackCacheDependencies = false;
-  return res;
-}
-
 /// Creates a SourceFactory configured by the [options].
 ///
-/// Use [options.useMockSdk] to specify the SDK mode, or use [sdkResolver]
-/// to entirely override the DartUriResolver.
-///
 /// If supplied, [fileResolvers] will override the default `file:` and
 /// `package:` URI resolvers.
 SourceFactory createSourceFactory(AnalyzerOptions options,
@@ -158,42 +154,3 @@
 
   return [new ResourceUriResolver(resourceProvider), packageResolver()];
 }
-
-FolderBasedDartSdk _createFolderBasedDartSdk(String sdkPath) {
-  var resourceProvider = PhysicalResourceProvider.INSTANCE;
-  var sdk = new FolderBasedDartSdk(resourceProvider,
-      resourceProvider.getFolder(sdkPath), /*useDart2jsPaths:*/ true);
-  sdk.useSummary = true;
-  sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = true;
-  return sdk;
-}
-
-/// Creates a [DartUriResolver] that uses the SDK at the given [sdkPath].
-DartUriResolver createSdkPathResolver(String sdkSummaryPath, String sdkPath) {
-  var sdk = (sdkSummaryPath != null)
-      ? new SummaryBasedDartSdk(sdkSummaryPath, true)
-      : _createFolderBasedDartSdk(sdkPath);
-  return new DartUriResolver(sdk);
-}
-
-List<String> parseDeclaredVariables(
-    List<String> args, Map<String, String> declaredVars) {
-  var count = args.length;
-  var remainingArgs = <String>[];
-  for (int i = 0; i < count; i++) {
-    var arg = args[i];
-    if (arg == '--') {
-      while (i < count) {
-        remainingArgs.add(args[i++]);
-      }
-    } else if (arg.startsWith("-D")) {
-      // The format for defined variables is:
-      //     -D<name>=<value>
-      var parts = arg.substring(2).split('=');
-      declaredVars[parts[0]] = parts.length > 1 ? parts[1] : '';
-    } else {
-      remainingArgs.add(arg);
-    }
-  }
-  return remainingArgs;
-}
diff --git a/pkg/dev_compiler/lib/src/compiler/ast_builder.dart b/pkg/dev_compiler/lib/src/compiler/ast_builder.dart
index 76d534d..2cbfdbf 100644
--- a/pkg/dev_compiler/lib/src/compiler/ast_builder.dart
+++ b/pkg/dev_compiler/lib/src/compiler/ast_builder.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart';
 import 'package:analyzer/src/dart/ast/token.dart';
 import 'package:analyzer/src/generated/utilities_dart.dart';
@@ -34,7 +35,7 @@
     return RawAstBuilder.typeParameterList(params);
   }
 
-  static TypeArgumentList typeArgumentList(List<TypeName> args) {
+  static TypeArgumentList typeArgumentList(List<TypeAnnotation> args) {
     return RawAstBuilder.typeArgumentList(args);
   }
 
@@ -42,7 +43,7 @@
     return RawAstBuilder.argumentList(args);
   }
 
-  static TypeName typeName(Identifier id, List<TypeName> args) {
+  static TypeName typeName(Identifier id, List<TypeAnnotation> args) {
     TypeArgumentList argList = null;
     if (args != null && args.length > 0) argList = typeArgumentList(args);
     return RawAstBuilder.typeName(id, argList);
@@ -102,13 +103,13 @@
   static PropertyAccess propertyAccess(
       Expression target, SimpleIdentifier name) {
     var p = new Token(TokenType.PERIOD, 0);
-    return new PropertyAccess(target, p, name);
+    return astFactory.propertyAccess(target, p, name);
   }
 
   static MethodInvocation methodInvoke(Expression target, SimpleIdentifier name,
       TypeArgumentList typeArguments, NodeList<Expression> args) {
     var p = new Token(TokenType.PERIOD, 0);
-    return new MethodInvocation(
+    return astFactory.methodInvocation(
         target, p, name, typeArguments, argumentList(args));
   }
 
@@ -359,8 +360,8 @@
       [Expression init]) {
     var eqToken = init != null ? new Token(TokenType.EQ, 0) : null;
     var varToken = new KeywordToken(Keyword.VAR, 0);
-    return new VariableDeclarationList(null, null, varToken, null,
-        [new VariableDeclaration(name, eqToken, init)]);
+    return astFactory.variableDeclarationList(null, null, varToken, null,
+        [astFactory.variableDeclaration(name, eqToken, init)]);
   }
 
   static VariableDeclarationStatement variableStatement(SimpleIdentifier name,
@@ -372,7 +373,7 @@
   static InstanceCreationExpression instanceCreation(
       ConstructorName ctor, List<Expression> args) {
     var newToken = new KeywordToken(Keyword.NEW, 0);
-    return new InstanceCreationExpression(
+    return astFactory.instanceCreationExpression(
         newToken, ctor, RawAstBuilder.argumentList(args));
   }
 }
@@ -383,112 +384,113 @@
   static ConstructorName constructorName(TypeName type,
       [SimpleIdentifier name]) {
     Token period = name != null ? new Token(TokenType.PERIOD, 0) : null;
-    return new ConstructorName(type, period, name);
+    return astFactory.constructorName(type, period, name);
   }
 
   static SimpleIdentifier identifierFromString(String name) {
     StringToken token = new SyntheticStringToken(TokenType.IDENTIFIER, name, 0);
-    return new SimpleIdentifier(token);
+    return astFactory.simpleIdentifier(token);
   }
 
   static PrefixedIdentifier prefixedIdentifier(
       SimpleIdentifier pre, SimpleIdentifier id) {
     Token period = new Token(TokenType.PERIOD, 0);
-    return new PrefixedIdentifier(pre, period, id);
+    return astFactory.prefixedIdentifier(pre, period, id);
   }
 
   static TypeParameter typeParameter(SimpleIdentifier name,
       [TypeName bound = null]) {
     Token keyword =
         (bound == null) ? null : new KeywordToken(Keyword.EXTENDS, 0);
-    return new TypeParameter(null, null, name, keyword, bound);
+    return astFactory.typeParameter(null, null, name, keyword, bound);
   }
 
   static TypeParameterList typeParameterList(List<TypeParameter> params) {
     Token lb = new Token(TokenType.LT, 0);
     Token rb = new Token(TokenType.GT, 0);
-    return new TypeParameterList(lb, params, rb);
+    return astFactory.typeParameterList(lb, params, rb);
   }
 
-  static TypeArgumentList typeArgumentList(List<TypeName> args) {
+  static TypeArgumentList typeArgumentList(List<TypeAnnotation> args) {
     Token lb = new Token(TokenType.LT, 0);
     Token rb = new Token(TokenType.GT, 0);
-    return new TypeArgumentList(lb, args, rb);
+    return astFactory.typeArgumentList(lb, args, rb);
   }
 
   static ArgumentList argumentList(List<Expression> args) {
     Token lp = new BeginToken(TokenType.OPEN_PAREN, 0);
     Token rp = new Token(TokenType.CLOSE_PAREN, 0);
-    return new ArgumentList(lp, args, rp);
+    return astFactory.argumentList(lp, args, rp);
   }
 
   static TypeName typeName(Identifier id, TypeArgumentList l) {
-    return new TypeName(id, l);
+    return astFactory.typeName(id, l);
   }
 
   static FunctionTypeAlias functionTypeAlias(TypeName ret,
       SimpleIdentifier name, TypeParameterList tps, FormalParameterList fps) {
     Token semi = new Token(TokenType.SEMICOLON, 0);
     Token td = new KeywordToken(Keyword.TYPEDEF, 0);
-    return new FunctionTypeAlias(null, null, td, ret, name, tps, fps, semi);
+    return astFactory.functionTypeAlias(
+        null, null, td, ret, name, tps, fps, semi);
   }
 
   static BooleanLiteral booleanLiteral(bool b) {
     var k = new KeywordToken(b ? Keyword.TRUE : Keyword.FALSE, 0);
-    return new BooleanLiteral(k, b);
+    return astFactory.booleanLiteral(k, b);
   }
 
   static NullLiteral nullLiteral() {
     var n = new KeywordToken(Keyword.NULL, 0);
-    return new NullLiteral(n);
+    return astFactory.nullLiteral(n);
   }
 
   static IntegerLiteral integerLiteral(int i) {
     StringToken token = new StringToken(TokenType.INT, '$i', 0);
-    return new IntegerLiteral(token, i);
+    return astFactory.integerLiteral(token, i);
   }
 
   static SimpleStringLiteral simpleStringLiteral(String s) {
     StringToken token = new StringToken(TokenType.STRING, "\"" + s + "\"", 0);
-    return new SimpleStringLiteral(token, s);
+    return astFactory.simpleStringLiteral(token, s);
   }
 
   static SimpleStringLiteral tripleQuotedStringLiteral(String s) {
     StringToken token = new StringToken(TokenType.STRING, '"""' + s + '"""', 0);
-    return new SimpleStringLiteral(token, s);
+    return astFactory.simpleStringLiteral(token, s);
   }
 
   static AsExpression asExpression(Expression exp, TypeName type) {
     Token token = new KeywordToken(Keyword.AS, 0);
-    return new AsExpression(exp, token, type);
+    return astFactory.asExpression(exp, token, type);
   }
 
   static IsExpression isExpression(Expression exp, TypeName type) {
     Token token = new KeywordToken(Keyword.IS, 0);
-    return new IsExpression(exp, token, null, type);
+    return astFactory.isExpression(exp, token, null, type);
   }
 
   static ParenthesizedExpression parenthesizedExpression(Expression exp) {
     Token lp = new BeginToken(TokenType.OPEN_PAREN, exp.offset);
     Token rp = new Token(TokenType.CLOSE_PAREN, exp.end);
-    return new ParenthesizedExpression(lp, exp, rp);
+    return astFactory.parenthesizedExpression(lp, exp, rp);
   }
 
   static BinaryExpression binaryExpression(
       Expression l, Token op, Expression r) {
-    return new BinaryExpression(l, op, r);
+    return astFactory.binaryExpression(l, op, r);
   }
 
   static ConditionalExpression conditionalExpression(
       Expression cond, Expression tExp, Expression fExp) {
     var q = new Token(TokenType.QUESTION, 0);
     var c = new Token(TokenType.COLON, 0);
-    return new ConditionalExpression(cond, q, tExp, c, fExp);
+    return astFactory.conditionalExpression(cond, q, tExp, c, fExp);
   }
 
   static Expression functionExpressionInvocation(
       Expression function, ArgumentList es) {
-    return new FunctionExpressionInvocation(function, null, es);
+    return astFactory.functionExpressionInvocation(function, null, es);
   }
 
   static FormalParameterList formalParameterList(List<FormalParameter> params) {
@@ -507,67 +509,67 @@
       ld = new BeginToken(TokenType.OPEN_CURLY_BRACKET, 0);
       rd = new Token(TokenType.CLOSE_CURLY_BRACKET, 0);
     }
-    return new FormalParameterList(lp, params, ld, rd, rp);
+    return astFactory.formalParameterList(lp, params, ld, rd, rp);
   }
 
   static Block block(List<Statement> statements) {
     Token ld = new BeginToken(TokenType.OPEN_CURLY_BRACKET, 0);
     Token rd = new Token(TokenType.CLOSE_CURLY_BRACKET, 0);
-    return new Block(ld, statements, rd);
+    return astFactory.block(ld, statements, rd);
   }
 
   static BlockFunctionBody blockFunctionBody(Block b) {
-    return new BlockFunctionBody(null, null, b);
+    return astFactory.blockFunctionBody(null, null, b);
   }
 
   static ExpressionFunctionBody expressionFunctionBody(Expression body,
       [bool decl = false]) {
     Token semi = (decl) ? new Token(TokenType.SEMICOLON, 0) : null;
-    return new ExpressionFunctionBody(null, null, body, semi);
+    return astFactory.expressionFunctionBody(null, null, body, semi);
   }
 
   static ExpressionStatement expressionStatement(Expression expression) {
     Token semi = new Token(TokenType.SEMICOLON, 0);
-    return new ExpressionStatement(expression, semi);
+    return astFactory.expressionStatement(expression, semi);
   }
 
   static FunctionDeclaration functionDeclaration(
       TypeName rt, SimpleIdentifier f, FunctionExpression fexp) {
-    return new FunctionDeclaration(null, null, null, rt, null, f, fexp);
+    return astFactory.functionDeclaration(null, null, null, rt, null, f, fexp);
   }
 
   static MethodDeclaration methodDeclaration(TypeName rt, SimpleIdentifier m,
       FormalParameterList fl, FunctionBody body,
       {bool isStatic: false}) {
     Token st = isStatic ? new KeywordToken(Keyword.STATIC, 0) : null;
-    return new MethodDeclaration(
+    return astFactory.methodDeclaration(
         null, null, null, st, rt, null, null, m, null, fl, body);
   }
 
   static FunctionExpression functionExpression(
       FormalParameterList fl, FunctionBody body) {
-    return new FunctionExpression(null, fl, body);
+    return astFactory.functionExpression(null, fl, body);
   }
 
   static FunctionDeclarationStatement functionDeclarationStatement(
       FunctionDeclaration fd) {
-    return new FunctionDeclarationStatement(fd);
+    return astFactory.functionDeclarationStatement(fd);
   }
 
   static Statement returnExpression([Expression e]) {
     Token ret = new KeywordToken(Keyword.RETURN, 0);
     Token semi = new Token(TokenType.SEMICOLON, 0);
-    return new ReturnStatement(ret, e, semi);
+    return astFactory.returnStatement(ret, e, semi);
   }
 
   static SimpleFormalParameter simpleFormalParameter(
       SimpleIdentifier v, TypeName t) {
-    return new SimpleFormalParameter(null, <Annotation>[], null, t, v);
+    return astFactory.simpleFormalParameter(null, <Annotation>[], null, t, v);
   }
 
   static FunctionTypedFormalParameter functionTypedFormalParameter(
       TypeName ret, SimpleIdentifier v, FormalParameterList ps) {
-    return new FunctionTypedFormalParameter(
+    return astFactory.functionTypedFormalParameter(
         null, <Annotation>[], ret, v, null, ps);
   }
 
@@ -576,11 +578,13 @@
   }
 
   static FormalParameter optionalFormalParameter(NormalFormalParameter fp) {
-    return new DefaultFormalParameter(fp, ParameterKind.POSITIONAL, null, null);
+    return astFactory.defaultFormalParameter(
+        fp, ParameterKind.POSITIONAL, null, null);
   }
 
   static FormalParameter namedFormalParameter(NormalFormalParameter fp) {
-    return new DefaultFormalParameter(fp, ParameterKind.NAMED, null, null);
+    return astFactory.defaultFormalParameter(
+        fp, ParameterKind.NAMED, null, null);
   }
 
   static NamedExpression namedParameter(SimpleIdentifier s, Expression e) {
@@ -588,13 +592,13 @@
   }
 
   static NamedExpression namedExpression(SimpleIdentifier s, Expression e) {
-    Label l = new Label(s, new Token(TokenType.COLON, 0));
-    return new NamedExpression(l, e);
+    Label l = astFactory.label(s, new Token(TokenType.COLON, 0));
+    return astFactory.namedExpression(l, e);
   }
 
   static VariableDeclarationStatement variableDeclarationStatement(
       VariableDeclarationList varDecl) {
     var semi = new Token(TokenType.SEMICOLON, 0);
-    return new VariableDeclarationStatement(varDecl, semi);
+    return astFactory.variableDeclarationStatement(varDecl, semi);
   }
 }
diff --git a/pkg/dev_compiler/lib/src/compiler/class_property_model.dart b/pkg/dev_compiler/lib/src/compiler/class_property_model.dart
new file mode 100644
index 0000000..8319c82
--- /dev/null
+++ b/pkg/dev_compiler/lib/src/compiler/class_property_model.dart
@@ -0,0 +1,95 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:collection' show HashSet;
+
+import 'package:analyzer/dart/ast/ast.dart' show Identifier;
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/element.dart' show FieldElementImpl;
+
+import '../js_ast/js_ast.dart' as JS;
+import 'element_helpers.dart';
+import 'js_names.dart' as JS;
+
+/// Tracks how fields, getters and setters are represented when emitting JS.
+///
+/// Dart classes have implicit features that must be made explicit:
+///
+/// - virtual fields induce a getter and setter pair.
+/// - getters and setters are independent.
+/// - getters and setters can be overridden.
+///
+class ClassPropertyModel {
+  /// Fields that are virtual, that is, they must be generated as a property
+  /// pair in JavaScript.
+  ///
+  /// The value property stores the symbol used for the field's storage slot.
+  final virtualFields = <FieldElement, JS.TemporaryId>{};
+
+  /// Static fields that are overridden, this does not matter for Dart but in
+  /// JS we need to take care initializing these because JS classes inherit
+  /// statics.
+  final staticFieldOverrides = new HashSet<FieldElement>();
+
+  /// The set of inherited getters, used because JS getters/setters are paired,
+  /// so if we're generating a setter we may need to emit a getter that calls
+  /// super.
+  final inheritedGetters = new HashSet<String>();
+
+  /// The set of inherited setters, used because JS getters/setters are paired,
+  /// so if we're generating a getter we may need to emit a setter that calls
+  /// super.
+  final inheritedSetters = new HashSet<String>();
+
+  ClassPropertyModel.build(
+      ClassElement classElem, Iterable<ExecutableElement> extensionMembers) {
+    // Visit superclasses to collect information about their fields/accessors.
+    // This is expensive so we try to collect everything in one pass.
+    for (var base in getSuperclasses(classElem)) {
+      for (var accessor in base.accessors) {
+        // For getter/setter pairs only process them once.
+        if (accessor.correspondingGetter != null) continue;
+
+        var field = accessor.variable;
+        var name = field.name;
+        // Ignore private names from other libraries.
+        if (Identifier.isPrivateName(name) &&
+            accessor.library != classElem.library) {
+          continue;
+        }
+
+        if (field.getter?.isAbstract == false) inheritedGetters.add(name);
+        if (field.setter?.isAbstract == false) inheritedSetters.add(name);
+      }
+    }
+
+    var extensionNames =
+        new HashSet<String>.from(extensionMembers.map((e) => e.name));
+
+    // Visit accessors in the current class, and see if they need to be
+    // generated differently based on the inherited fields/accessors.
+    for (var accessor in classElem.accessors) {
+      // For getter/setter pairs only process them once.
+      if (accessor.correspondingGetter != null) continue;
+      // Also ignore abstract fields.
+      if (accessor.isAbstract) continue;
+
+      var field = accessor.variable;
+      var name = field.name;
+      // Is it a field?
+      if (!field.isSynthetic && field is FieldElementImpl) {
+        if (inheritedGetters.contains(name) ||
+            inheritedSetters.contains(name) ||
+            extensionNames.contains(name) ||
+            field.isVirtual) {
+          if (field.isStatic) {
+            staticFieldOverrides.add(field);
+          } else {
+            virtualFields[field] = new JS.TemporaryId(name);
+          }
+        }
+      }
+    }
+  }
+}
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
index 1d36734..76292e4 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -8,12 +8,14 @@
 
 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator;
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType;
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
 import 'package:analyzer/src/dart/ast/token.dart' show StringToken;
 import 'package:analyzer/src/dart/element/element.dart'
-    show LocalVariableElementImpl;
+    show FieldElementImpl, LocalVariableElementImpl;
 import 'package:analyzer/src/dart/element/type.dart' show DynamicTypeImpl;
 import 'package:analyzer/src/dart/sdk/sdk.dart';
 import 'package:analyzer/src/generated/engine.dart' show AnalysisContext;
@@ -37,11 +39,11 @@
 import '../js_ast/js_ast.dart' as JS;
 import '../js_ast/js_ast.dart' show js;
 import 'ast_builder.dart' show AstBuilder;
+import 'class_property_model.dart';
 import 'compiler.dart' show BuildUnit, CompilerOptions, JSModuleFile;
 import 'element_helpers.dart';
 import 'element_loader.dart' show ElementLoader;
 import 'extension_types.dart' show ExtensionTypeSet;
-import 'js_field_storage.dart' show checkForPropertyOverride, getSuperclasses;
 import 'js_interop.dart';
 import 'js_metalet.dart' as JS;
 import 'js_names.dart' as JS;
@@ -58,7 +60,7 @@
   final SummaryDataStore summaryData;
 
   final CompilerOptions options;
-  final rules = new StrongTypeSystemImpl();
+  final StrongTypeSystemImpl rules;
 
   /// The set of libraries we are currently compiling, and the temporaries used
   /// to refer to them.
@@ -124,6 +126,7 @@
   final ClassElement numClass;
   final ClassElement objectClass;
   final ClassElement stringClass;
+  final ClassElement functionClass;
   final ClassElement symbolClass;
 
   ConstFieldVisitor _constants;
@@ -149,9 +152,14 @@
   /// Whether we are currently generating code for the body of a `JS()` call.
   bool _isInForeignJS = false;
 
+  /// Information about virtual and overridden fields/getters/setters in the
+  /// class we're currently compiling, or `null` if we aren't compiling a class.
+  ClassPropertyModel _classProperties;
+
   CodeGenerator(
       AnalysisContext c, this.summaryData, this.options, this._extensionTypes)
       : context = c,
+        rules = new StrongTypeSystemImpl(c.typeProvider),
         types = c.typeProvider,
         _asyncStreamIterator =
             _getLibrary(c, 'dart:async').getType('StreamIterator').type,
@@ -165,6 +173,7 @@
         nullClass = _getLibrary(c, 'dart:core').getType('Null'),
         objectClass = _getLibrary(c, 'dart:core').getType('Object'),
         stringClass = _getLibrary(c, 'dart:core').getType('String'),
+        functionClass = _getLibrary(c, 'dart:core').getType('Function'),
         symbolClass = _getLibrary(c, 'dart:_internal').getType('Symbol'),
         dartJSLibrary = _getLibrary(c, 'dart:js');
 
@@ -179,7 +188,7 @@
     _buildUnit = unit;
     _libraryRoot = _buildUnit.libraryRoot;
     if (!_libraryRoot.endsWith(separator)) {
-      _libraryRoot = '$_libraryRoot${separator}';
+      _libraryRoot += separator;
     }
 
     var module = _emitModule(compilationUnits);
@@ -191,7 +200,10 @@
   List<int> _summarizeModule(List<CompilationUnit> units) {
     if (!options.summarizeApi) return null;
 
-    if (!units.any((u) => u.element.librarySource.isInSystemLibrary)) {
+    if (!units.any((u) => resolutionMap
+        .elementDeclaredByCompilationUnit(u)
+        .librarySource
+        .isInSystemLibrary)) {
       var sdk = context.sourceFactory.dartSdk;
       summaryData.addBundle(
           null,
@@ -233,7 +245,8 @@
     // Transform the AST to make coercions explicit.
     compilationUnits = CoercionReifier.reify(compilationUnits);
 
-    if (compilationUnits.any((u) => _isDartRuntime(u.element.library))) {
+    if (compilationUnits.any((u) => _isDartRuntime(
+        resolutionMap.elementDeclaredByCompilationUnit(u).library))) {
       // Don't allow these to be renamed when we're building the SDK.
       // There is JS code in dart:* that depends on their names.
       _runtimeModule = new JS.Identifier('dart');
@@ -248,7 +261,8 @@
     // Initialize our library variables.
     var items = <JS.ModuleItem>[];
     for (var unit in compilationUnits) {
-      var library = unit.element.library;
+      var library =
+          resolutionMap.elementDeclaredByCompilationUnit(unit).library;
       if (unit.element != library.definingCompilationUnit) continue;
 
       var libraryTemp = _isDartRuntime(library)
@@ -271,15 +285,19 @@
     var nodes = new HashMap<Element, AstNode>.identity();
     var sdkBootstrappingFns = new List<FunctionElement>();
     for (var unit in compilationUnits) {
-      if (_isDartRuntime(unit.element.library)) {
-        sdkBootstrappingFns.addAll(unit.element.functions);
+      if (_isDartRuntime(
+          resolutionMap.elementDeclaredByCompilationUnit(unit).library)) {
+        sdkBootstrappingFns.addAll(
+            resolutionMap.elementDeclaredByCompilationUnit(unit).functions);
       }
       _collectElements(unit, nodes);
     }
     _loader = new ElementLoader(nodes);
     if (compilationUnits.isNotEmpty) {
       _constants = new ConstFieldVisitor(context,
-          dummySource: compilationUnits.first.element.source);
+          dummySource: resolutionMap
+              .elementDeclaredByCompilationUnit(compilationUnits.first)
+              .source);
     }
 
     // Add implicit dart:core dependency so it is first.
@@ -727,7 +745,7 @@
 
   @override
   JS.Statement visitClassDeclaration(ClassDeclaration node) {
-    var classElem = node.element;
+    var classElem = resolutionMap.elementDeclaredByClassDeclaration(node);
 
     // If this class is annotated with `@JS`, then there is nothing to emit.
     if (findAnnotation(classElem, isPublicJSAnnotation) != null) return null;
@@ -737,16 +755,19 @@
     if (jsTypeDef != null) return jsTypeDef;
 
     var ctors = <ConstructorDeclaration>[];
+    var allFields = <FieldDeclaration>[];
     var fields = <FieldDeclaration>[];
     var staticFields = <FieldDeclaration>[];
     var methods = <MethodDeclaration>[];
 
-    // True if a "call" method or getter exists.
+    // True if a "call" method or getter exists directly on this class.
+    // If so, we need to install a Function prototype.
     bool isCallable = false;
     for (var member in node.members) {
       if (member is ConstructorDeclaration) {
         ctors.add(member);
       } else if (member is FieldDeclaration) {
+        allFields.add(member);
         (member.isStatic ? staticFields : fields).add(member);
       } else if (member is MethodDeclaration) {
         methods.add(member);
@@ -769,6 +790,16 @@
       }
     }
 
+    // True if a "call" method or getter exists directly or indirectly on this
+    // class.  If so, we need special constructor handling.
+    bool isCallableTransitive =
+        classElem.lookUpMethod('call', currentLibrary) != null;
+    if (!isCallableTransitive) {
+      var callGetter = classElem.lookUpGetter('call', currentLibrary);
+      isCallableTransitive =
+          callGetter != null && callGetter.returnType is FunctionType;
+    }
+
     JS.Expression className;
     if (classElem.typeParameters.isNotEmpty) {
       // Generic classes will be defined inside a function that closes over the
@@ -778,17 +809,12 @@
       className = _emitTopLevelName(classElem);
     }
 
-    var allFields = fields.toList()..addAll(staticFields);
-    var superclasses = getSuperclasses(classElem);
-    var virtualFields = <FieldElement, JS.TemporaryId>{};
-    var virtualFieldSymbols = <JS.Statement>[];
-    var staticFieldOverrides = new HashSet<FieldElement>();
     var extensions = _extensionsToImplement(classElem);
-    _registerPropertyOverrides(classElem, className, superclasses, allFields,
-        virtualFields, virtualFieldSymbols, staticFieldOverrides, extensions);
+    var savedClassProperties = _classProperties;
+    _classProperties = new ClassPropertyModel.build(classElem, extensions);
 
-    var classExpr = _emitClassExpression(classElem,
-        _emitClassMethods(node, ctors, fields, superclasses, virtualFields),
+    var classExpr = _emitClassExpression(
+        classElem, _emitClassMethods(node, ctors, fields),
         fields: allFields);
 
     var body = <JS.Statement>[];
@@ -805,8 +831,8 @@
 
     _emitClassTypeTests(classElem, className, body);
 
-    _defineNamedConstructors(ctors, body, className, isCallable);
-    body.addAll(virtualFieldSymbols);
+    _defineNamedConstructors(ctors, body, className, isCallableTransitive);
+    _emitVirtualFieldSymbols(className, body);
     _emitClassSignature(
         methods, allFields, classElem, ctors, extensions, className, body);
     _defineExtensionMembers(extensions, className, body);
@@ -821,10 +847,12 @@
     }
 
     body = <JS.Statement>[classDef];
-    _emitStaticFields(staticFields, staticFieldOverrides, classElem, body);
+    _emitStaticFields(staticFields, classElem, body);
     for (var peer in jsPeerNames) {
       _registerExtensionType(classElem, peer, body);
     }
+
+    _classProperties = savedClassProperties;
     return _statement(body);
   }
 
@@ -905,6 +933,25 @@
           [className, _runtimeModule, className]));
       return;
     }
+    if (classElem == functionClass) {
+      body.add(js.statement(
+          '#.is = function is_Function(o) { return typeof o == "function"; }',
+          className));
+      body.add(js.statement(
+          '#.as = function as_Function(o) {'
+          '  if (typeof o == "function" || o == null) return o;'
+          '  return #.as(o, #);'
+          '}',
+          [className, _runtimeModule, className]));
+      body.add(js.statement(
+          '#._check = function check_String(o) {'
+          '  if (typeof o == "function" || o == null) return o;'
+          '  return #.check(o, #);'
+          '}',
+          [className, _runtimeModule, className]));
+      return;
+    }
+
     if (classElem == intClass) {
       body.add(js.statement(
           '#.is = function is_int(o) {'
@@ -1042,36 +1089,12 @@
     superHelperSymbols.clear();
   }
 
-  void _registerPropertyOverrides(
-      ClassElement classElem,
-      JS.Expression className,
-      List<ClassElement> superclasses,
-      List<FieldDeclaration> fields,
-      Map<FieldElement, JS.TemporaryId> virtualFields,
-      List<JS.Statement> virtualFieldSymbols,
-      Set<FieldElement> staticFieldOverrides,
-      Iterable<ExecutableElement> extensionMembers) {
-    var extensionNames =
-        new HashSet<String>.from(extensionMembers.map((e) => e.name));
-    for (var field in fields) {
-      for (VariableDeclaration fieldDecl in field.fields.variables) {
-        var field = fieldDecl.element as FieldElement;
-        var overrideInfo = checkForPropertyOverride(field, superclasses);
-        if (overrideInfo.foundGetter ||
-            overrideInfo.foundSetter ||
-            extensionNames.contains(field.name)) {
-          if (field.isStatic) {
-            staticFieldOverrides.add(field);
-          } else {
-            var virtualField = new JS.TemporaryId(field.name);
-            virtualFields[field] = virtualField;
-            virtualFieldSymbols.add(js.statement(
-                'const # = Symbol(#.name + "." + #.toString());',
-                [virtualField, className, _declareMemberName(field.getter)]));
-          }
-        }
-      }
-    }
+  void _emitVirtualFieldSymbols(
+      JS.Expression className, List<JS.Statement> body) {
+    _classProperties.virtualFields.forEach((field, virtualField) {
+      body.add(js.statement('const # = Symbol(#.name + "." + #.toString());',
+          [virtualField, className, _declareMemberName(field.getter)]));
+    });
   }
 
   void _defineClass(ClassElement classElem, JS.Expression className,
@@ -1109,14 +1132,16 @@
                 new JS.Identifier(
                     // TODO(ochafik): use a refactored _emitMemberName instead.
                     decl.name.name,
-                    type: emitTypeRef(decl.element.type)),
+                    type: emitTypeRef(resolutionMap
+                        .elementDeclaredByVariableDeclaration(decl)
+                        .type)),
                 null))
             .toList(growable: false));
   }
 
   @override
   JS.Statement visitEnumDeclaration(EnumDeclaration node) {
-    var element = node.element;
+    var element = resolutionMap.elementDeclaredByEnumDeclaration(node);
     var type = element.type;
 
     // Generate a class per section 13 of the spec.
@@ -1142,8 +1167,21 @@
     var classExpr = new JS.ClassExpression(new JS.Identifier(type.name),
         _emitClassHeritage(element), [constructor, toStringF]);
     var id = _emitTopLevelName(element);
+
+    // Emit metadata for synthetic enum index member.
+    // TODO(jacobr): make field readonly when that is supported.
+    var tInstanceFields = <JS.Property>[
+      new JS.Property(
+          _emitMemberName('index'), _emitAnnotatedType(intClass.type, null))
+    ];
+    var sigFields = <JS.Property>[
+      _buildSignatureField('fields', tInstanceFields)
+    ];
+    var sig = new JS.ObjectInitializer(sigFields);
+
     var result = [
-      js.statement('# = #', [id, classExpr])
+      js.statement('# = #', [id, classExpr]),
+      _callHelperStatement('setSignature(#, #);', [id, sig])
     ];
 
     // defineEnumValues internally depends on dart.constList which uses
@@ -1223,24 +1261,26 @@
 
     _loader.startTopLevel(element);
 
-    // Find the super type
-    JS.Expression heritage;
-    var supertype = type.superclass;
-    if (_deferIfNeeded(supertype, element)) {
-      // Fall back to raw type.
-      supertype = fillDynamicTypeArgs(supertype.element.type);
+    // List of "direct" supertypes (supertype + mixins)
+    var basetypes = [type.superclass]..addAll(type.mixins);
+
+    // If any of these are recursive (via type parameter), defer setting
+    // the real superclass.
+    if (basetypes.any((t) => _deferIfNeeded(t, element))) {
+      // Fall back to raw type
+      basetypes =
+          basetypes.map((t) => fillDynamicTypeArgs(t.element.type)).toList();
       _hasDeferredSupertype.add(element);
     }
-    // We could choose to name the superclasses, but it's
-    // not clear that there's much benefit
-    heritage = _emitType(supertype, nameType: false);
 
-    if (type.mixins.isNotEmpty) {
-      var mixins =
-          type.mixins.map((t) => _emitType(t, nameType: false)).toList();
-      mixins.insert(0, heritage);
-      heritage = _callHelper('mixin(#)', [mixins]);
-    }
+    // List of "direct" JS superclasses
+    var baseclasses = basetypes
+        .map((t) => _emitConstructorAccess(t, nameType: false))
+        .toList();
+    assert(baseclasses.isNotEmpty);
+    var heritage = (baseclasses.length == 1)
+        ? baseclasses.first
+        : _callHelper('mixin(#)', [baseclasses]);
 
     _loader.finishTopLevel(element);
 
@@ -1281,15 +1321,12 @@
     return jsMethods;
   }
 
-  List<JS.Method> _emitClassMethods(
-      ClassDeclaration node,
-      List<ConstructorDeclaration> ctors,
-      List<FieldDeclaration> fields,
-      List<ClassElement> superclasses,
-      Map<FieldElement, JS.TemporaryId> virtualFields) {
-    var element = node.element;
+  List<JS.Method> _emitClassMethods(ClassDeclaration node,
+      List<ConstructorDeclaration> ctors, List<FieldDeclaration> fields) {
+    var element = resolutionMap.elementDeclaredByClassDeclaration(node);
     var type = element.type;
     var isObject = type.isObject;
+    var virtualFields = _classProperties.virtualFields;
 
     // Iff no constructor is specified for a class C, it implicitly has a
     // default constructor `C() : super() {}`, unless C is class Object.
@@ -1309,12 +1346,12 @@
       // bypass the ES6 restrictions.
       //
       // TODO(jmesserly): we'll need to rethink this.
-      // See <https://github.com/dart-lang/dev_compiler/issues/51>.
+      // See https://github.com/dart-lang/sdk/issues/28322.
       // This level of indirection will hurt performance.
       jsMethods.add(new JS.Method(
           _propertyName('constructor'),
           js.call('function(...args) { return this.new.apply(this, args); }')
-          as JS.Fun));
+              as JS.Fun));
     } else if (ctors.isEmpty) {
       jsMethods.add(_emitImplicitConstructor(node, fields, virtualFields));
     }
@@ -1330,7 +1367,7 @@
         jsMethods.add(_emitMethodDeclaration(type, m));
 
         if (m.element is PropertyAccessorElement) {
-          jsMethods.add(_emitSuperAccessorWrapper(m, type, superclasses));
+          jsMethods.add(_emitSuperAccessorWrapper(m, type));
         }
 
         if (!hasJsPeer && m.isGetter && m.name.name == 'iterator') {
@@ -1426,7 +1463,8 @@
     // Doing better is a bit tricky, as our current codegen strategy for the
     // mock methods encodes information about the number of arguments (and type
     // arguments) that D expects.
-    return _collectMockMethods(type).map(_implementMockMethod);
+    return _collectMockMethods(type)
+        .map((method) => _implementMockMethod(method, type));
   }
 
   /// Given a class C that implements method M from interface I, but does not
@@ -1448,7 +1486,7 @@
   ///       return core.bool.as(this.noSuchMethod(
   ///           new dart.InvocationImpl('eatFood', args)));
   ///     }
-  JS.Method _implementMockMethod(ExecutableElement method) {
+  JS.Method _implementMockMethod(ExecutableElement method, InterfaceType type) {
     var invocationProps = <JS.Property>[];
     addProperty(String name, JS.Expression value) {
       invocationProps.add(new JS.Property(js.string(name), value));
@@ -1483,7 +1521,7 @@
 
     var fnBody = js.call('this.noSuchMethod(new #.InvocationImpl(#, #, #))', [
       _runtimeModule,
-      _declareMemberName(method),
+      _declareMemberName(method, useDisplayName: true),
       positionalArgs,
       new JS.ObjectInitializer(invocationProps)
     ]);
@@ -1499,8 +1537,7 @@
     // We have a similar issue with `dgsend` helpers.
     return new JS.Method(
         _declareMemberName(method,
-            useExtension:
-                _extensionTypes.isNativeClass(method.enclosingElement)),
+            useExtension: _extensionTypes.isNativeClass(type.element)),
         _makeGenericFunction(fn),
         isGetter: method is PropertyAccessorElement && method.isGetter,
         isSetter: method is PropertyAccessorElement && method.isSetter,
@@ -1551,29 +1588,32 @@
   /// setter. This is needed because in ES6, if you only override a getter
   /// (alternatively, a setter), then there is an implicit override of the
   /// setter (alternatively, the getter) that does nothing.
-  JS.Method _emitSuperAccessorWrapper(MethodDeclaration method,
-      InterfaceType type, List<ClassElement> superclasses) {
+  JS.Method _emitSuperAccessorWrapper(
+      MethodDeclaration method, InterfaceType type) {
     var methodElement = method.element as PropertyAccessorElement;
     var field = methodElement.variable;
     if (!field.isSynthetic) return null;
-    var propertyOverrideResult =
-        checkForPropertyOverride(methodElement.variable, superclasses);
 
     // Generate a corresponding virtual getter / setter.
     var name = _declareMemberName(methodElement);
     if (method.isGetter) {
-      // Generate a setter
-      if (field.setter != null || !propertyOverrideResult.foundSetter)
-        return null;
-      var fn = js.call('function(value) { super[#] = value; }', [name]);
-      return new JS.Method(name, fn, isSetter: true);
+      var setter = field.setter;
+      if ((setter == null || setter.isAbstract) &&
+          _classProperties.inheritedSetters.contains(field.name)) {
+        // Generate a setter that forwards to super.
+        var fn = js.call('function(value) { super[#] = value; }', [name]);
+        return new JS.Method(name, fn, isSetter: true);
+      }
     } else {
-      // Generate a getter
-      if (field.getter != null || !propertyOverrideResult.foundGetter)
-        return null;
-      var fn = js.call('function() { return super[#]; }', [name]);
-      return new JS.Method(name, fn, isGetter: true);
+      var getter = field.getter;
+      if ((getter == null || getter.isAbstract) &&
+          _classProperties.inheritedGetters.contains(field.name)) {
+        // Generate a getter that forwards to super.
+        var fn = js.call('function() { return super[#]; }', [name]);
+        return new JS.Method(name, fn, isGetter: true);
+      }
     }
+    return null;
   }
 
   bool _implementsIterable(InterfaceType t) =>
@@ -1657,8 +1697,17 @@
             'setExtensionBaseClass(#, #);', [className, newBaseClass]));
       }
     } else if (_hasDeferredSupertype.contains(classElem)) {
+      // TODO(vsm): consider just threading the deferred supertype through
+      // instead of recording classElem in a set on the class and recomputing
       var newBaseClass = _emitType(classElem.type.superclass,
           nameType: false, subClass: classElem, className: className);
+      if (classElem.type.mixins.isNotEmpty) {
+        var mixins = classElem.type.mixins
+            .map((t) => _emitType(t, nameType: false))
+            .toList();
+        mixins.insert(0, newBaseClass);
+        newBaseClass = _callHelper('mixin(#)', [mixins]);
+      }
       var deferredBaseClass = _callHelperStatement(
           'setBaseClass(#, #);', [className, newBaseClass]);
       if (typeFormals.isNotEmpty) return deferredBaseClass;
@@ -1687,16 +1736,12 @@
 
   /// Emits static fields for a class, and initialize them eagerly if possible,
   /// otherwise define them as lazy properties.
-  void _emitStaticFields(
-      List<FieldDeclaration> staticFields,
-      Set<FieldElement> staticFieldOverrides,
-      ClassElement classElem,
-      List<JS.Statement> body) {
+  void _emitStaticFields(List<FieldDeclaration> staticFields,
+      ClassElement classElem, List<JS.Statement> body) {
     var lazyStatics = <VariableDeclaration>[];
     for (FieldDeclaration member in staticFields) {
       for (VariableDeclaration field in member.fields.variables) {
-        JS.Statement eagerField =
-            _emitConstantStaticField(classElem, field, staticFieldOverrides);
+        JS.Statement eagerField = _emitConstantStaticField(classElem, field);
         if (eagerField != null) {
           body.add(eagerField);
         } else {
@@ -1740,6 +1785,13 @@
     }
   }
 
+  JS.Property _buildSignatureField(String name, List<JS.Property> elements) {
+    var o = new JS.ObjectInitializer(elements, multiline: elements.length > 1);
+    // TODO(vsm): Remove
+    var e = js.call('() => #', o);
+    return new JS.Property(_propertyName(name), e);
+  }
+
   /// Emit the signature on the class recording the runtime type information
   void _emitClassSignature(
       List<MethodDeclaration> methods,
@@ -1767,43 +1819,62 @@
     var sNames = <JS.Expression>[];
     for (MethodDeclaration node in methods) {
       var name = node.name.name;
-      var element = node.element;
+      var element = resolutionMap.elementDeclaredByMethodDeclaration(node);
       // TODO(vsm): Clean up all the nasty duplication.
       if (node.isAbstract) {
         continue;
       }
 
-      Function lookup;
       List<JS.Property> tMember;
-      JS.Expression type;
+      Function getOverride;
+      Function lookup;
+      Function elementToType;
       if (node.isGetter) {
-        lookup = classElem.lookUpInheritedConcreteGetter;
+        elementToType = (ExecutableElement element) => element.type;
+        getOverride = classElem.lookUpInheritedConcreteGetter;
+        lookup = classElem.type.lookUpInheritedGetter;
         tMember = node.isStatic ? tStaticGetters : tInstanceGetters;
       } else if (node.isSetter) {
-        lookup = classElem.lookUpInheritedConcreteSetter;
+        elementToType = (ExecutableElement element) => element.type;
+        getOverride = classElem.lookUpInheritedConcreteSetter;
+        lookup = classElem.type.lookUpInheritedSetter;
         tMember = node.isStatic ? tStaticSetters : tInstanceSetters;
       } else {
         // Method
-        lookup = classElem.lookUpInheritedConcreteMethod;
+        // Swap in "Object" for parameter types that are covariant overrides.
+        var objectType = context.typeProvider.objectType;
+        elementToType =
+            (MethodElement element) => element.getReifiedType(objectType);
+        getOverride = classElem.lookUpInheritedConcreteMethod;
+        lookup = classElem.type.lookUpInheritedMethod;
         tMember = node.isStatic ? tStaticMethods : tInstanceMethods;
       }
 
-      type = _emitAnnotatedFunctionType(element.type, node.metadata,
+      DartType reifiedType = elementToType(element);
+      var type = _emitAnnotatedFunctionType(reifiedType, node.metadata,
           parameters: node.parameters?.parameters,
           nameType: options.hoistSignatureTypes,
           hoistType: options.hoistSignatureTypes,
           definite: true);
 
-      var inheritedElement = lookup(name, currentLibrary);
-      if (inheritedElement != null && inheritedElement.type == element.type) {
-        continue;
-      }
-      var memberName = _declareMemberName(element);
-      var property = new JS.Property(memberName, type);
-      tMember.add(property);
-      // TODO(vsm): Why do we need this?
-      if (node.isStatic && !node.isGetter && !node.isSetter) {
-        sNames.add(memberName);
+      // Don't add redundant signatures for inherited methods whose signature
+      // did not change.  If we are not overriding, or if the thing we are
+      // overriding has a different reified type from ourselves, we must
+      // emit a signature on this class.  Otherwise we will inherit the
+      // signature from the superclass.
+      var needsSignature = getOverride(name, currentLibrary) == null ||
+          elementToType(
+                  lookup(name, library: currentLibrary, thisType: false)) !=
+              reifiedType;
+
+      if (needsSignature) {
+        var memberName = _declareMemberName(element);
+        var property = new JS.Property(memberName, type);
+        tMember.add(property);
+        // TODO(vsm): Why do we need this?
+        if (node.isStatic && !node.isGetter && !node.isSetter) {
+          sNames.add(memberName);
+        }
       }
     }
 
@@ -1822,7 +1893,7 @@
     var tCtors = <JS.Property>[];
     for (ConstructorDeclaration node in ctors) {
       var memberName = _constructorName(node.element);
-      var element = node.element;
+      var element = resolutionMap.elementDeclaredByConstructorDeclaration(node);
       var type = _emitAnnotatedFunctionType(element.type, node.metadata,
           parameters: node.parameters.parameters,
           nameType: options.hoistSignatureTypes,
@@ -1832,45 +1903,37 @@
       tCtors.add(property);
     }
 
-    JS.Property build(String name, List<JS.Property> elements) {
-      var o =
-          new JS.ObjectInitializer(elements, multiline: elements.length > 1);
-      // TODO(vsm): Remove
-      var e = js.call('() => #', o);
-      return new JS.Property(_propertyName(name), e);
-    }
-
     var sigFields = <JS.Property>[];
     if (!tCtors.isEmpty) {
-      sigFields.add(build('constructors', tCtors));
+      sigFields.add(_buildSignatureField('constructors', tCtors));
     }
     if (!tInstanceFields.isEmpty) {
-      sigFields.add(build('fields', tInstanceFields));
+      sigFields.add(_buildSignatureField('fields', tInstanceFields));
     }
     if (!tInstanceGetters.isEmpty) {
-      sigFields.add(build('getters', tInstanceGetters));
+      sigFields.add(_buildSignatureField('getters', tInstanceGetters));
     }
     if (!tInstanceSetters.isEmpty) {
-      sigFields.add(build('setters', tInstanceSetters));
+      sigFields.add(_buildSignatureField('setters', tInstanceSetters));
     }
     if (!tInstanceMethods.isEmpty) {
-      sigFields.add(build('methods', tInstanceMethods));
+      sigFields.add(_buildSignatureField('methods', tInstanceMethods));
     }
     if (!tStaticFields.isEmpty) {
-      sigFields.add(build('sfields', tStaticFields));
+      sigFields.add(_buildSignatureField('sfields', tStaticFields));
     }
     if (!tStaticGetters.isEmpty) {
-      sigFields.add(build('sgetters', tStaticGetters));
+      sigFields.add(_buildSignatureField('sgetters', tStaticGetters));
     }
     if (!tStaticSetters.isEmpty) {
-      sigFields.add(build('ssetters', tStaticSetters));
+      sigFields.add(_buildSignatureField('ssetters', tStaticSetters));
     }
     if (!tStaticMethods.isEmpty) {
       assert(!sNames.isEmpty);
       // TODO(vsm): Why do we need this names field?
       var aNames = new JS.Property(
           _propertyName('names'), new JS.ArrayInitializer(sNames));
-      sigFields.add(build('statics', tStaticMethods));
+      sigFields.add(_buildSignatureField('statics', tStaticMethods));
       sigFields.add(aNames);
     }
     if (!sigFields.isEmpty || extensions.isNotEmpty) {
@@ -1894,7 +1957,9 @@
     if (_extensionTypes.hasNativeSubtype(classElem.type)) {
       var dartxNames = <JS.Expression>[];
       for (var m in methods) {
-        if (!m.isAbstract && !m.isStatic && m.element.isPublic) {
+        if (!m.isAbstract &&
+            !m.isStatic &&
+            resolutionMap.elementDeclaredByMethodDeclaration(m).isPublic) {
           dartxNames.add(_declareMemberName(m.element, useExtension: false));
         }
       }
@@ -1916,14 +1981,14 @@
   }
 
   List<ExecutableElement> _extensionsToImplement(ClassElement element) {
-    var members = <ExecutableElement>[];
-    if (_extensionTypes.isNativeClass(element)) return members;
+    if (_extensionTypes.isNativeClass(element)) return [];
 
     // Collect all extension types we implement.
     var type = element.type;
     var types = _extensionTypes.collectNativeInterfaces(element);
-    if (types.isEmpty) return members;
+    if (types.isEmpty) return [];
 
+    var members = new Set<ExecutableElement>();
     // Collect all possible extension method names.
     var extensionMembers = new HashSet<String>();
     for (var t in types) {
@@ -1938,7 +2003,9 @@
         members.add(m);
       }
     }
-    return members;
+    members.addAll(_collectMockMethods(type)
+        .where((m) => extensionMembers.contains(m.name)));
+    return members.toList();
   }
 
   /// Generates the implicit default constructor for class C of the form
@@ -1956,7 +2023,9 @@
     if (superCall != null) {
       body.add(superCall);
     }
-    var name = _constructorName(node.element.unnamedConstructor);
+    var name = _constructorName(resolutionMap
+        .elementDeclaredByClassDeclaration(node)
+        .unnamedConstructor);
     return annotate(
         new JS.Method(name, js.call('function() { #; }', [body]) as JS.Fun),
         node,
@@ -1972,12 +2041,18 @@
     if (_externalOrNative(node)) return null;
 
     var name = _constructorName(node.element);
-    var returnType = emitTypeRef(node.element.enclosingElement.type);
+    var returnType = emitTypeRef(resolutionMap
+        .elementDeclaredByConstructorDeclaration(node)
+        .enclosingElement
+        .type);
 
     // Wacky factory redirecting constructors: factory Foo.q(x, y) = Bar.baz;
     var redirect = node.redirectedConstructor;
     if (redirect != null) {
-      var newKeyword = redirect.staticElement.isFactory ? '' : 'new';
+      var newKeyword =
+          resolutionMap.staticElementForConstructorReference(redirect).isFactory
+              ? ''
+              : 'new';
       // Pass along all arguments verbatim, and let the callee handle them.
       // TODO(jmesserly): we'll need something different once we have
       // rest/spread support, but this should work for now.
@@ -2086,7 +2161,7 @@
   @override
   JS.Statement visitRedirectingConstructorInvocation(
       RedirectingConstructorInvocation node) {
-    var ctor = node.staticElement;
+    var ctor = resolutionMap.staticElementForConstructorReference(node);
     var cls = ctor.enclosingElement;
     // We can't dispatch to the constructor with `this.new` as that might hit a
     // derived class constructor with the same name.
@@ -2262,10 +2337,12 @@
       }
 
       // TODO(jmesserly): various problems here, see:
-      // https://github.com/dart-lang/dev_compiler/issues/116
-      var paramType = param.element.type;
+      // https://github.com/dart-lang/sdk/issues/27259
+      var paramType =
+          resolutionMap.elementDeclaredByFormalParameter(param).type;
       if (node is MethodDeclaration &&
-          (param.element.isCovariant || _unsoundCovariant(paramType, true)) &&
+          (resolutionMap.elementDeclaredByFormalParameter(param).isCovariant ||
+              _unsoundCovariant(paramType, true)) &&
           !_inWhitelistCode(node)) {
         var castType = _emitType(paramType,
             nameType: options.nameTypeTests || options.hoistTypeTests,
@@ -2410,7 +2487,7 @@
       fn = _simplifyPassThroughArrowFunCallBody(fn);
     }
 
-    var element = node.element;
+    var element = resolutionMap.elementDeclaredByFunctionDeclaration(node);
     var nameExpr = _emitTopLevelName(element);
     body.add(annotate(js.statement('# = #', [nameExpr, fn]), node, element));
     if (!_isDartRuntime(element.library)) {
@@ -2615,8 +2692,7 @@
     // are not mutated inside the generator.
     //
     // In the future, we might be able to simplify this, see:
-    // https://github.com/dart-lang/dev_compiler/issues/247.
-    //
+    // https://github.com/dart-lang/sdk/issues/28320
     // `async` works the same, but uses the `dart.async` helper.
     //
     // In the body of a `sync*` and `async`, `yield`/`await` are both generated
@@ -2678,7 +2754,9 @@
 
     return new JS.Block([
       declareFn,
-      _emitFunctionTagged(name, func.element.type).toStatement()
+      _emitFunctionTagged(name,
+              resolutionMap.elementDeclaredByFunctionDeclaration(func).type)
+          .toStatement()
     ]);
   }
 
@@ -2698,7 +2776,7 @@
   /// going through the qualified library name if necessary, but *not* handling
   /// inferred generic function instantiation.
   JS.Expression _emitSimpleIdentifier(SimpleIdentifier node) {
-    var accessor = node.staticElement;
+    var accessor = resolutionMap.staticElementForIdentifier(node);
     if (accessor == null) {
       return js.commentExpression(
           'Unimplemented unknown name', new JS.Identifier(node.name));
@@ -2864,7 +2942,7 @@
         lowerTypedef: lowerTypedef,
         nameType: nameType,
         hoistType: hoistType);
-    var helper = (definite) ? 'definiteFunctionType' : 'functionType';
+    var helper = definite ? 'definiteFunctionType' : 'functionType';
     var fullType = _callHelper('${helper}(#)', [parts]);
     if (!nameType) return fullType;
     return _typeTable.nameType(type, fullType,
@@ -2899,6 +2977,7 @@
     var namedTypes = type.namedParameterTypes;
     var rt =
         _emitType(type.returnType, nameType: nameType, hoistType: hoistType);
+
     var ra = _emitTypeNames(parameterTypes, parameters,
         nameType: nameType, hoistType: hoistType);
 
@@ -2921,8 +3000,8 @@
     var typeFormals = type.typeFormals;
     if (typeFormals.isNotEmpty && !lowerTypedef) {
       // TODO(jmesserly): this is a suboptimal representation for universal
-      // function types (as callable functions). See discussion at:
-      // https://github.com/dart-lang/dev_compiler/issues/526
+      // function types (as callable functions). See discussion at
+      // https://github.com/dart-lang/sdk/issues/27333
       var tf = _emitTypeFormals(typeFormals);
       var names = _typeTable.discharge(typeFormals);
       var parts = new JS.ArrayInitializer(typeParts);
@@ -3229,7 +3308,7 @@
       return _badAssignment("Unimplemented: unknown name '$node'", node, rhs);
     }
 
-    var accessor = node.staticElement;
+    var accessor = resolutionMap.staticElementForIdentifier(node);
     if (accessor == null) return unimplemented();
 
     // Get the original declaring element. If we had a property accessor, this
@@ -3391,7 +3470,7 @@
       return _emitFunctionCall(node);
     }
     if (node.methodName.name == 'call') {
-      var targetType = target.staticType;
+      var targetType = resolutionMap.staticTypeForExpression(target);
       if (targetType is FunctionType) {
         // Call methods on function types should be handled as regular function
         // invocations.
@@ -3580,7 +3659,15 @@
     } else if (typeArgs != null) {
       // Dynamic calls may have type arguments, even though the function types
       // are not known.
-      return typeArgs.arguments.map(visitTypeName).toList(growable: false);
+      return typeArgs.arguments.map((argument) {
+        if (argument is TypeName) {
+          return visitTypeName(argument);
+        } else {
+          // TODO(brianwilkerson) Implement support for GenericFunctionType.
+          throw new StateError(
+              'Cannot compile type argument of kind ${argument.runtimeType}');
+        }
+      }).toList(growable: false);
     }
     return null;
   }
@@ -3620,7 +3707,7 @@
       // arg[0] is static return type, used in `RestrictedStaticTypeAnalyzer`
       var code = args[1];
       List<AstNode> templateArgs;
-      var source;
+      String source;
       if (code is StringInterpolation) {
         if (args.length > 2) {
           throw new ArgumentError(
@@ -3640,6 +3727,28 @@
         source = (code as StringLiteral).stringValue;
       }
 
+      // TODO(vsm): Constructors in dart:html and friends are trying to
+      // allocate a type defined on window/self, but this often conflicts a
+      // with the generated extenstion class in scope.  We really should
+      // qualify explicitly in dart:html itself.
+      var constructorPattern = new RegExp("new [A-Z][A-Za-z]+\\(");
+      if (constructorPattern.matchAsPrefix(source) != null) {
+        var containingClass = node.parent;
+        while (
+            containingClass != null && containingClass is! ClassDeclaration) {
+          containingClass = containingClass.parent;
+        }
+        if (containingClass is ClassDeclaration &&
+            _extensionTypes.isNativeClass(containingClass.element)) {
+          var constructorName = source.substring(4, source.indexOf('('));
+          var className = containingClass.name.name;
+          if (className == constructorName) {
+            source =
+                source.replaceFirst('new $className(', 'new self.$className(');
+          }
+        }
+      }
+
       // TODO(rnystrom): The JS() calls are almost never nested, and probably
       // really shouldn't be, but there are at least a couple of calls in the
       // HTML library where an argument to JS() is itself a JS() call. If those
@@ -3781,9 +3890,15 @@
       new JS.EmptyStatement();
 
   @override
-  JS.Statement visitAssertStatement(AssertStatement node) =>
-      // TODO(jmesserly): only emit in checked mode.
-      _callHelperStatement('assert(#);', _visit(node.condition));
+  JS.Statement visitAssertStatement(AssertStatement node) {
+    // TODO(jmesserly): only emit in checked mode.
+    if (node.message != null) {
+      return _callHelperStatement('assert(#, () => #);',
+          [_visit(node.condition), _visit(node.message)]);
+    }
+
+    return _callHelperStatement('assert(#);', _visit(node.condition));
+  }
 
   @override
   JS.Statement visitReturnStatement(ReturnStatement node) {
@@ -3865,8 +3980,9 @@
       return _emitTopLevelField(node);
     }
 
-    var name =
-        new JS.Identifier(node.name.name, type: emitTypeRef(node.element.type));
+    var name = new JS.Identifier(node.name.name,
+        type: emitTypeRef(
+            resolutionMap.elementDeclaredByVariableDeclaration(node).type));
     return new JS.VariableInitialization(name, _visitInitializer(node));
   }
 
@@ -3883,8 +3999,8 @@
   /// Otherwise, we'll need to generate a lazy-static field. That ensures
   /// correct visible behavior, as well as avoiding referencing something that
   /// isn't defined yet (because it is defined later in the module).
-  JS.Statement _emitConstantStaticField(ClassElement classElem,
-      VariableDeclaration field, Set<FieldElement> staticFieldOverrides) {
+  JS.Statement _emitConstantStaticField(
+      ClassElement classElem, VariableDeclaration field) {
     PropertyInducingElement element = field.element;
     assert(element.isStatic);
 
@@ -3898,7 +4014,7 @@
     var fieldName = field.name.name;
     if (eagerInit &&
         !JS.invalidStaticFieldName(fieldName) &&
-        !staticFieldOverrides.contains(element)) {
+        !_classProperties.staticFieldOverrides.contains(element)) {
       return annotate(
           js.statement('#.# = #;', [
             _emitTopLevelName(classElem),
@@ -3971,7 +4087,7 @@
           new JS.Method(
               access,
               js.call('function() { return #; }', _visitInitializer(node))
-              as JS.Fun,
+                  as JS.Fun,
               isGetter: true),
           node,
           _findAccessor(element, getter: true)));
@@ -4083,7 +4199,7 @@
 
   @override
   visitInstanceCreationExpression(InstanceCreationExpression node) {
-    var element = node.staticElement;
+    var element = resolutionMap.staticElementForConstructorReference(node);
     var constructor = node.constructorName;
     var name = constructor.name;
     var type = constructor.type.type;
@@ -4457,8 +4573,8 @@
     //   LocalVariableElementImpl, so we could repurpose to mean "temp".
     // * add a new property to LocalVariableElementImpl.
     // * create a new subtype of LocalVariableElementImpl to mark a temp.
-    var id =
-        new SimpleIdentifier(new StringToken(TokenType.IDENTIFIER, name, -1));
+    var id = astFactory
+        .simpleIdentifier(new StringToken(TokenType.IDENTIFIER, name, -1));
 
     variable ??= new JS.TemporaryId(name);
 
@@ -4513,14 +4629,14 @@
     Expression result;
     if (expr is IndexExpression) {
       IndexExpression index = expr;
-      result = new IndexExpression.forTarget(
+      result = astFactory.indexExpressionForTarget(
           _bindValue(scope, 'o', index.target, context: context),
           index.leftBracket,
           _bindValue(scope, 'i', index.index, context: context),
           index.rightBracket);
     } else if (expr is PropertyAccess) {
       PropertyAccess prop = expr;
-      result = new PropertyAccess(
+      result = astFactory.propertyAccess(
           _bindValue(scope, 'o', _getTarget(prop), context: context),
           prop.operator,
           prop.propertyName);
@@ -4529,9 +4645,9 @@
       if (isLibraryPrefix(ident.prefix)) {
         return expr;
       }
-      result = new PrefixedIdentifier(
+      result = astFactory.prefixedIdentifier(
           _bindValue(scope, 'o', ident.prefix, context: context)
-          as SimpleIdentifier,
+              as SimpleIdentifier,
           ident.period,
           ident.identifier);
     } else {
@@ -4864,9 +4980,11 @@
 
     var jsTarget = _emitTarget(target, member, isStatic);
     bool isSuper = jsTarget is JS.Super;
-
-    if (isSuper && member is FieldElement && !member.isSynthetic) {
-      // If super.x is actually a field, then x is an instance property since
+    if (isSuper &&
+        !member.isSynthetic &&
+        member is FieldElementImpl &&
+        !member.isVirtual) {
+      // If super.x is a sealed field, then x is an instance property since
       // subclasses cannot override x.
       jsTarget = new JS.This();
     }
@@ -5419,17 +5537,14 @@
   ///
   /// Unlike call sites, we always have an element available, so we can use it
   /// directly rather than computing the relevant options for [_emitMemberName].
-  JS.Expression _declareMemberName(ExecutableElement e, {bool useExtension}) {
-    String name;
-    if (e is PropertyAccessorElement) {
-      name = e.variable.name;
-    } else {
-      name = e.name;
-    }
+  JS.Expression _declareMemberName(ExecutableElement e,
+      {bool useExtension, useDisplayName = false}) {
+    var name = (e is PropertyAccessorElement) ? e.variable.name : e.name;
     return _emitMemberName(name,
         isStatic: e.isStatic,
         useExtension:
-            useExtension ?? _extensionTypes.isNativeClass(e.enclosingElement));
+            useExtension ?? _extensionTypes.isNativeClass(e.enclosingElement),
+        useDisplayName: useDisplayName);
   }
 
   /// This handles member renaming for private names and operators.
@@ -5476,6 +5591,7 @@
       {DartType type,
       bool isStatic: false,
       bool useExtension,
+      bool useDisplayName: false,
       Element element}) {
     // Static members skip the rename steps and may require JS interop renames.
     if (isStatic) {
@@ -5488,20 +5604,22 @@
 
     // When generating synthetic names, we use _ as the prefix, since Dart names
     // won't have this (eliminated above), nor will static names reach here.
-    switch (name) {
-      case '[]':
-        name = '_get';
-        break;
-      case '[]=':
-        name = '_set';
-        break;
-      case 'unary-':
-        name = '_negate';
-        break;
-      case 'constructor':
-      case 'prototype':
-        name = '_$name';
-        break;
+    if (!useDisplayName) {
+      switch (name) {
+        case '[]':
+          name = '_get';
+          break;
+        case '[]=':
+          name = '_set';
+          break;
+        case 'unary-':
+          name = '_negate';
+          break;
+        case 'constructor':
+        case 'prototype':
+          name = '_$name';
+          break;
+      }
     }
 
     var result = _propertyName(name);
@@ -5563,7 +5681,9 @@
   ///
   /// JSNumber is the type that actually "implements" all numbers, hence it's
   /// a subtype of int and double (and num). It's in our "dart:_interceptors".
-  bool _isNumberInJS(DartType t) => rules.isSubtypeOf(t, types.numType);
+  bool _isNumberInJS(DartType t) =>
+      rules.isSubtypeOf(t, types.numType) &&
+      !rules.isSubtypeOf(t, types.nullType);
 
   /// Return true if this is one of the methods/properties on all Dart Objects
   /// (toString, hashCode, noSuchMethod, runtimeType).
@@ -5599,7 +5719,6 @@
         expectedType = types.streamType;
       } else {
         // Future<T> -> T
-        // TODO(vsm): Revisit with issue #228.
         expectedType = types.futureType;
       }
     } else {
@@ -5772,7 +5891,9 @@
   var prefix = targetIdentifier.staticElement as PrefixElement;
 
   // The library the prefix is referring to must come from a deferred import.
-  var containingLibrary = (target.root as CompilationUnit).element.library;
+  var containingLibrary = resolutionMap
+      .elementDeclaredByCompilationUnit(target.root as CompilationUnit)
+      .library;
   var imports = containingLibrary.getImportsWithPrefix(prefix);
   return imports.length == 1 && imports[0].isDeferred;
 }
diff --git a/pkg/dev_compiler/lib/src/compiler/command.dart b/pkg/dev_compiler/lib/src/compiler/command.dart
index 221e7d4..ae46ce6 100644
--- a/pkg/dev_compiler/lib/src/compiler/command.dart
+++ b/pkg/dev_compiler/lib/src/compiler/command.dart
@@ -3,6 +3,11 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:io';
+import 'package:analyzer/src/command_line/arguments.dart'
+    show
+        defineAnalysisArguments,
+        filterUnknownArguments,
+        ignoreUnrecognizedFlagsFlag;
 import 'package:analyzer/src/generated/source.dart' show Source;
 import 'package:analyzer/src/summary/package_bundle_reader.dart'
     show InSummarySource;
@@ -10,28 +15,11 @@
 import 'package:args/command_runner.dart' show UsageException;
 import 'package:path/path.dart' as path;
 
-import '../analyzer/context.dart' show AnalyzerOptions, parseDeclaredVariables;
+import '../analyzer/context.dart' show AnalyzerOptions;
 import 'compiler.dart' show BuildUnit, CompilerOptions, ModuleCompiler;
 import 'module_builder.dart';
 
-final ArgParser _argParser = () {
-  var argParser = new ArgParser(allowTrailingOptions: true)
-    ..addFlag('help', abbr: 'h', help: 'Display this message.')
-    ..addOption('out',
-        abbr: 'o', allowMultiple: true, help: 'Output file (required).')
-    ..addOption('module-root',
-        help: 'Root module directory.\n'
-            'Generated module paths are relative to this root.')
-    ..addOption('library-root',
-        help: 'Root of source files.\n'
-            'Generated library names are relative to this root.')
-    ..addOption('build-root',
-        help: 'Deprecated in favor of --library-root', hide: true);
-  addModuleFormatOptions(argParser, allowMultiple: true);
-  AnalyzerOptions.addArguments(argParser);
-  CompilerOptions.addArguments(argParser);
-  return argParser;
-}();
+bool _verbose = false;
 
 /// Runs a single compile for dartdevc.
 ///
@@ -40,16 +28,29 @@
 /// worker support.
 int compile(List<String> args, {void printFn(Object obj)}) {
   printFn ??= print;
+
   ArgResults argResults;
-  var declaredVars = <String, String>{};
+  AnalyzerOptions analyzerOptions;
   try {
-    argResults = _argParser.parse(parseDeclaredVariables(args, declaredVars));
+    var parser = ddcArgParser();
+    if (args.contains('--$ignoreUnrecognizedFlagsFlag')) {
+      args = filterUnknownArguments(args, parser);
+    }
+    argResults = parser.parse(args);
+    analyzerOptions = new AnalyzerOptions.fromArguments(argResults);
   } on FormatException catch (error) {
     printFn('$error\n\n$_usageMessage');
     return 64;
   }
+
+  _verbose = argResults['verbose'];
+  if (argResults['help']) {
+    printFn(_usageMessage);
+    return 0;
+  }
+
   try {
-    _compile(argResults, declaredVars, printFn);
+    _compile(argResults, analyzerOptions, printFn);
     return 0;
   } on UsageException catch (error) {
     // Incorrect usage, input file not found, etc.
@@ -82,6 +83,33 @@
   }
 }
 
+ArgParser ddcArgParser({bool hide: true}) {
+  var argParser = new ArgParser(allowTrailingOptions: true)
+    ..addFlag('help',
+        abbr: 'h',
+        help: 'Display this message.\n'
+            'Add --verbose to show hidden options.',
+        negatable: false)
+    ..addFlag('verbose', abbr: 'v', help: 'Verbose output.')
+    ..addFlag(ignoreUnrecognizedFlagsFlag,
+        help: 'Ignore unrecognized command line flags.',
+        defaultsTo: false,
+        negatable: false)
+    ..addOption('out',
+        abbr: 'o', allowMultiple: true, help: 'Output file (required).')
+    ..addOption('module-root',
+        help: 'Root module directory.\n'
+            'Generated module paths are relative to this root.')
+    ..addOption('library-root',
+        help: 'Root of source files.\n'
+            'Generated library names are relative to this root.');
+  defineAnalysisArguments(argParser, hide: hide, ddc: true);
+  addModuleFormatOptions(argParser, allowMultiple: true, hide: hide);
+  AnalyzerOptions.addArguments(argParser, hide: hide);
+  CompilerOptions.addArguments(argParser, hide: hide);
+  return argParser;
+}
+
 bool _changed(List<int> list1, List<int> list2) {
   var length = list1.length;
   if (length != list2.length) return true;
@@ -91,14 +119,9 @@
   return false;
 }
 
-void _compile(ArgResults argResults, Map<String, String> declaredVars,
+void _compile(ArgResults argResults, AnalyzerOptions analyzerOptions,
     void printFn(Object obj)) {
-  if (argResults['help']) {
-    printFn(_usageMessage);
-    return;
-  }
-  var compiler = new ModuleCompiler(
-      new AnalyzerOptions.fromArguments(argResults, declaredVars));
+  var compiler = new ModuleCompiler(analyzerOptions);
   var compilerOpts = new CompilerOptions.fromArguments(argResults);
   var outPaths = argResults['out'] as List<String>;
   var moduleFormats = parseModuleFormatOption(argResults);
@@ -125,7 +148,6 @@
   var firstOutPath = outPaths[0];
 
   var libraryRoot = argResults['library-root'] as String;
-  libraryRoot ??= argResults['build-root'] as String;
   if (libraryRoot != null) {
     libraryRoot = path.absolute(libraryRoot);
   } else {
@@ -201,9 +223,9 @@
   return null; // unreachable
 }
 
-final _usageMessage =
+String get _usageMessage =>
     'Dart Development Compiler compiles Dart into a JavaScript module.'
-    '\n\n${_argParser.usage}';
+    '\n\n${ddcArgParser(hide: !_verbose).usage}';
 
 void _usageException(String message) {
   throw new UsageException(message, _usageMessage);
diff --git a/pkg/dev_compiler/lib/src/compiler/compiler.dart b/pkg/dev_compiler/lib/src/compiler/compiler.dart
index ea67648..75337de 100644
--- a/pkg/dev_compiler/lib/src/compiler/compiler.dart
+++ b/pkg/dev_compiler/lib/src/compiler/compiler.dart
@@ -5,30 +5,32 @@
 import 'dart:collection' show HashSet, Queue;
 import 'dart:convert' show BASE64, JSON, UTF8;
 import 'dart:io' show File;
-import 'package:analyzer/dart/element/element.dart' show LibraryElement;
+
 import 'package:analyzer/analyzer.dart'
     show AnalysisError, CompilationUnit, ErrorSeverity;
+import 'package:analyzer/dart/element/element.dart' show LibraryElement;
 import 'package:analyzer/file_system/file_system.dart' show ResourceProvider;
+import 'package:analyzer/file_system/physical_file_system.dart'
+    show PhysicalResourceProvider;
+import 'package:analyzer/src/context/builder.dart' show ContextBuilder;
+import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl;
+import 'package:analyzer/src/error/codes.dart' show StaticTypeWarningCode;
 import 'package:analyzer/src/generated/engine.dart'
     show AnalysisContext, AnalysisEngine;
-import 'package:analyzer/src/generated/source.dart' show DartUriResolver;
+import 'package:analyzer/src/generated/sdk.dart' show DartSdkManager;
+import 'package:analyzer/src/generated/source.dart'
+    show ContentCache, DartUriResolver;
 import 'package:analyzer/src/generated/source_io.dart'
     show Source, SourceKind, UriResolver;
 import 'package:analyzer/src/summary/package_bundle_reader.dart'
     show InSummarySource, InputPackagesResultProvider, SummaryDataStore;
-import 'package:analyzer/src/error/codes.dart' show StaticTypeWarningCode;
 import 'package:args/args.dart' show ArgParser, ArgResults;
 import 'package:args/src/usage_exception.dart' show UsageException;
 import 'package:func/func.dart' show Func1;
 import 'package:path/path.dart' as path;
 import 'package:source_maps/source_maps.dart';
 
-import '../analyzer/context.dart'
-    show
-        AnalyzerOptions,
-        createAnalysisContext,
-        createSdkPathResolver,
-        createSourceFactory;
+import '../analyzer/context.dart' show AnalyzerOptions, createSourceFactory;
 import '../js_ast/js_ast.dart' as JS;
 import 'code_generator.dart' show CodeGenerator;
 import 'error_helpers.dart' show errorSeverity, formatError, sortErrors;
@@ -59,29 +61,36 @@
   final SummaryDataStore summaryData;
   final ExtensionTypeSet _extensionTypes;
 
-  ModuleCompiler.withContext(AnalysisContext context, this.summaryData)
+  ModuleCompiler._(AnalysisContext context, this.summaryData)
       : context = context,
-        _extensionTypes = new ExtensionTypeSet(context) {
-    if (!context.analysisOptions.strongMode) {
-      throw new ArgumentError('AnalysisContext must be strong mode');
-    }
-    if (!context.sourceFactory.dartSdk.context.analysisOptions.strongMode) {
-      throw new ArgumentError('AnalysisContext must have strong mode SDK');
-    }
-  }
+        _extensionTypes = new ExtensionTypeSet(context);
 
   factory ModuleCompiler(AnalyzerOptions options,
-      {DartUriResolver sdkResolver,
-      ResourceProvider resourceProvider,
+      {ResourceProvider resourceProvider,
+      String analysisRoot,
       List<UriResolver> fileResolvers}) {
+    // TODO(danrubel): refactor with analyzer CLI into analyzer common code
     AnalysisEngine.instance.processRequiredPlugins();
 
-    sdkResolver ??=
-        createSdkPathResolver(options.dartSdkSummaryPath, options.dartSdkPath);
+    resourceProvider ??= PhysicalResourceProvider.INSTANCE;
+    analysisRoot ??= path.current;
+
+    var contextBuilder = new ContextBuilder(resourceProvider,
+        new DartSdkManager(options.dartSdkPath, true), new ContentCache(),
+        options: options.contextBuilderOptions);
+
+    var analysisOptions = contextBuilder.getAnalysisOptions(analysisRoot);
+    var sdk = contextBuilder.findSdk(null, analysisOptions);
+
+    var sdkResolver = new DartUriResolver(sdk);
 
     // Read the summaries.
     var summaryData =
         new SummaryDataStore(options.summaryPaths, recordDependencyInfo: true);
+    var sdkSummaryBundle = sdk.getLinkedBundle();
+    if (sdkSummaryBundle != null) {
+      summaryData.addBundle(null, sdkSummaryBundle);
+    }
 
     var srcFactory = createSourceFactory(options,
         sdkResolver: sdkResolver,
@@ -89,15 +98,29 @@
         summaryData: summaryData,
         resourceProvider: resourceProvider);
 
-    var context = createAnalysisContext();
+    var context =
+        AnalysisEngine.instance.createAnalysisContext() as AnalysisContextImpl;
+    context.analysisOptions = analysisOptions;
     context.sourceFactory = srcFactory;
-    context.typeProvider = sdkResolver.dartSdk.context.typeProvider;
-    context.resultProvider =
-        new InputPackagesResultProvider(context, summaryData);
+    if (sdkSummaryBundle != null) {
+      context.resultProvider =
+          new InputPackagesResultProvider(context, summaryData);
+    }
     options.declaredVariables.forEach(context.declaredVariables.define);
     context.declaredVariables.define('dart.isVM', 'false');
 
-    return new ModuleCompiler.withContext(context, summaryData);
+    // TODO(vsm): Should this be hardcoded?
+    context.declaredVariables.define('dart.library.html', 'true');
+    context.declaredVariables.define('dart.library.io', 'false');
+
+    if (!context.analysisOptions.strongMode) {
+      throw new ArgumentError('AnalysisContext must be strong mode');
+    }
+    if (!context.sourceFactory.dartSdk.context.analysisOptions.strongMode) {
+      throw new ArgumentError('AnalysisContext must have strong mode SDK');
+    }
+
+    return new ModuleCompiler._(context, summaryData);
   }
 
   bool _isFatalError(AnalysisError e, CompilerOptions options) {
@@ -305,19 +328,19 @@
         bazelMapping = _parseBazelMappings(args['bazel-mapping']),
         summaryOutPath = args['summary-out'];
 
-  static void addArguments(ArgParser parser) {
+  static void addArguments(ArgParser parser, {bool hide: true}) {
     parser
       ..addFlag('summarize', help: 'emit an API summary file', defaultsTo: true)
       ..addOption('summary-extension',
           help: 'file extension for Dart summary files',
           defaultsTo: 'sum',
-          hide: true)
+          hide: hide)
       ..addFlag('source-map', help: 'emit source mapping', defaultsTo: true)
       ..addFlag('source-map-comment',
           help: 'adds a sourceMappingURL comment to the end of the JS,\n'
               'disable if using X-SourceMap header',
           defaultsTo: true,
-          hide: true)
+          hide: hide)
       ..addFlag('inline-source-map',
           help: 'emit source mapping inline', defaultsTo: false)
       ..addFlag('emit-metadata',
@@ -327,39 +350,39 @@
           help: 'emit Closure Compiler-friendly code (experimental)',
           defaultsTo: false)
       ..addFlag('destructure-named-params',
-          help: 'Destructure named parameters', defaultsTo: false, hide: true)
+          help: 'Destructure named parameters', defaultsTo: false, hide: hide)
       ..addFlag('unsafe-force-compile',
           help: 'Compile code even if it has errors. ಠ_ಠ\n'
               'This has undefined behavior!',
           defaultsTo: false,
-          hide: true)
+          hide: hide)
       ..addFlag('repl-compile',
-          help: 'Compile code more permissively when in REPL mode allowing '
-              'access to private members across library boundaries.',
+          help: 'Compile code more permissively when in REPL mode\n'
+              'allowing access to private members across library boundaries.',
           defaultsTo: false,
-          hide: true)
+          hide: hide)
       ..addFlag('hoist-instance-creation',
           help: 'Hoist the class type from generic instance creations',
           defaultsTo: true,
-          hide: true)
+          hide: hide)
       ..addFlag('hoist-signature-types',
           help: 'Hoist types from class signatures',
           defaultsTo: false,
-          hide: true)
+          hide: hide)
       ..addFlag('name-type-tests',
-          help: 'Name types used in type tests', defaultsTo: true, hide: true)
+          help: 'Name types used in type tests', defaultsTo: true, hide: hide)
       ..addFlag('hoist-type-tests',
-          help: 'Hoist types used in type tests', defaultsTo: true, hide: true)
-      ..addFlag('unsafe-angular2-whitelist', defaultsTo: false, hide: true)
+          help: 'Hoist types used in type tests', defaultsTo: true, hide: hide)
+      ..addFlag('unsafe-angular2-whitelist', defaultsTo: false, hide: hide)
       ..addOption('bazel-mapping',
           help:
               '--bazel-mapping=genfiles/to/library.dart,to/library.dart uses \n'
               'to/library.dart as the path for library.dart in source maps.',
           allowMultiple: true,
           splitCommas: false,
-          hide: true)
+          hide: hide)
       ..addOption('summary-out',
-          help: 'location to write the summary file', hide: true);
+          help: 'location to write the summary file', hide: hide);
   }
 
   static Map<String, String> _parseBazelMappings(Iterable argument) {
diff --git a/pkg/dev_compiler/lib/src/compiler/element_helpers.dart b/pkg/dev_compiler/lib/src/compiler/element_helpers.dart
index 7f4576d..39a2e47 100644
--- a/pkg/dev_compiler/lib/src/compiler/element_helpers.dart
+++ b/pkg/dev_compiler/lib/src/compiler/element_helpers.dart
@@ -2,6 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import 'dart:collection';
+
 /// Helpers for Analyzer's Element model and corelib model.
 
 import 'package:analyzer/dart/ast/ast.dart'
@@ -14,7 +16,7 @@
         MethodInvocation,
         SimpleIdentifier;
 import 'package:analyzer/dart/element/element.dart'
-    show Element, ExecutableElement, FunctionElement;
+    show ClassElement, Element, ExecutableElement, FunctionElement;
 import 'package:analyzer/dart/element/type.dart'
     show DartType, InterfaceType, ParameterizedType;
 import 'package:analyzer/src/dart/element/type.dart' show DynamicTypeImpl;
@@ -120,3 +122,20 @@
 /// return the string 'FooBar'.
 String getAnnotationName(Element element, bool match(DartObjectImpl value)) =>
     findAnnotation(element, match)?.getField('name')?.toStringValue();
+
+List<ClassElement> getSuperclasses(ClassElement cls) {
+  var result = <ClassElement>[];
+  var visited = new HashSet<ClassElement>();
+  while (cls != null && visited.add(cls)) {
+    for (var mixinType in cls.mixins.reversed) {
+      var mixin = mixinType.element;
+      if (mixin != null) result.add(mixin);
+    }
+    var supertype = cls.supertype;
+    if (supertype == null) break;
+
+    cls = supertype.element;
+    result.add(cls);
+  }
+  return result;
+}
diff --git a/pkg/dev_compiler/lib/src/compiler/error_helpers.dart b/pkg/dev_compiler/lib/src/compiler/error_helpers.dart
index 091ab62..ec730d3 100644
--- a/pkg/dev_compiler/lib/src/compiler/error_helpers.dart
+++ b/pkg/dev_compiler/lib/src/compiler/error_helpers.dart
@@ -60,6 +60,8 @@
   // * it can return null
   // * using AnalysisError directly is now suspect, it's a correctness trap
   // * it requires an AnalysisContext
-  return ErrorProcessor.getProcessor(context, error)?.severity ??
+  return ErrorProcessor
+          .getProcessor(context.analysisOptions, error)
+          ?.severity ??
       error.errorCode.errorSeverity;
 }
diff --git a/pkg/dev_compiler/lib/src/compiler/js_field_storage.dart b/pkg/dev_compiler/lib/src/compiler/js_field_storage.dart
deleted file mode 100644
index 13d5980..0000000
--- a/pkg/dev_compiler/lib/src/compiler/js_field_storage.dart
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:collection' show HashSet;
-
-import 'package:analyzer/dart/ast/ast.dart' show Identifier;
-import 'package:analyzer/dart/element/element.dart';
-
-class PropertyOverrideResult {
-  final bool foundGetter;
-  final bool foundSetter;
-
-  PropertyOverrideResult(this.foundGetter, this.foundSetter);
-}
-
-PropertyOverrideResult checkForPropertyOverride(
-    FieldElement field, List<ClassElement> superclasses) {
-  bool foundGetter = false;
-  bool foundSetter = false;
-
-  for (var superclass in superclasses) {
-    var superprop = getProperty(superclass, field.library, field.name);
-    if (superprop == null) continue;
-
-    var getter = superprop.getter;
-    bool hasGetter = getter != null && !getter.isAbstract;
-    if (hasGetter) foundGetter = true;
-
-    var setter = superprop.setter;
-    bool hasSetter = setter != null && !setter.isAbstract;
-    if (hasSetter) foundSetter = true;
-  }
-
-  return new PropertyOverrideResult(foundGetter, foundSetter);
-}
-
-FieldElement getProperty(
-    ClassElement cls, LibraryElement fromLibrary, String name) {
-  // Properties from a different library are not accessible.
-  if (Identifier.isPrivateName(name) && cls.library != fromLibrary) {
-    return null;
-  }
-  for (var accessor in cls.accessors) {
-    var prop = accessor.variable;
-    if (prop.name == name) return prop;
-  }
-  return null;
-}
-
-List<ClassElement> getSuperclasses(ClassElement cls) {
-  var result = <ClassElement>[];
-  var visited = new HashSet<ClassElement>();
-  while (cls != null && visited.add(cls)) {
-    for (var mixinType in cls.mixins.reversed) {
-      var mixin = mixinType.element;
-      if (mixin != null) result.add(mixin);
-    }
-    var supertype = cls.supertype;
-    if (supertype == null) break;
-
-    cls = supertype.element;
-    result.add(cls);
-  }
-  return result;
-}
diff --git a/pkg/dev_compiler/lib/src/compiler/js_metalet.dart b/pkg/dev_compiler/lib/src/compiler/js_metalet.dart
index 8e341fe..3947884 100644
--- a/pkg/dev_compiler/lib/src/compiler/js_metalet.dart
+++ b/pkg/dev_compiler/lib/src/compiler/js_metalet.dart
@@ -333,6 +333,7 @@
   bool hasYield = false;
   bool hasThis = false;
   bool _nestedFunction = false;
+
   @override
   visitThis(This node) {
     hasThis = true;
@@ -349,10 +350,12 @@
   @override
   visitYield(Yield node) {
     if (!_nestedFunction) hasYield = true;
+    super.visitYield(node);
   }
 
   @override
   visitNode(Node node) {
-    if (!hasYield) super.visitNode(node);
+    if (hasYield && hasThis) return; // found both, nothing more to do.
+    super.visitNode(node);
   }
 }
diff --git a/pkg/dev_compiler/lib/src/compiler/module_builder.dart b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
index 0fd990c..415554a 100644
--- a/pkg/dev_compiler/lib/src/compiler/module_builder.dart
+++ b/pkg/dev_compiler/lib/src/compiler/module_builder.dart
@@ -45,7 +45,8 @@
 /// Adds an option to the [argParser] for choosing the module format, optionally
 /// [allowMultiple] formats to be specified, with each emitted into a separate
 /// file.
-void addModuleFormatOptions(ArgParser argParser, {bool allowMultiple: false}) {
+void addModuleFormatOptions(ArgParser argParser,
+    {bool allowMultiple: false, bool hide: true}) {
   argParser
     ..addOption('modules',
         help: 'module pattern to emit',
@@ -68,7 +69,7 @@
         help: 'emit modules that can be concatenated into one file.\n'
             'Only compatible with legacy and amd module formats.',
         defaultsTo: false,
-        hide: true);
+        hide: hide);
 }
 
 /// Transforms an ES6 [module] into a given module [format].
@@ -237,7 +238,7 @@
       }
     }
 
-    // TODO(vsm): See https://github.com/dart-lang/dev_compiler/issues/512
+    // TODO(vsm): See https://github.com/dart-lang/sdk/issues/27309
     // This extra level of indirection should be unnecessary.
     var block =
         js.statement("(function() { 'use strict'; #; })()", [statements]);
diff --git a/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart b/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
index 39f0130..3934503 100644
--- a/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
+++ b/pkg/dev_compiler/lib/src/compiler/nullable_type_inference.dart
@@ -4,6 +4,7 @@
 
 import 'dart:collection';
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/dart/ast/token.dart' show TokenType;
 import 'package:analyzer/dart/ast/visitor.dart' show RecursiveAstVisitor;
 import 'package:analyzer/dart/element/element.dart';
@@ -121,7 +122,7 @@
       return _isNullable(expr.expression, localIsNullable);
     }
     if (expr is InstanceCreationExpression) {
-      var e = expr.staticElement;
+      var e = resolutionMap.staticElementForConstructorReference(expr);
       if (e == null) return true;
 
       // Follow redirects.
@@ -165,7 +166,7 @@
     if (expr is MethodInvocation) {
       // TODO(vsm): This logic overlaps with the resolver.
       // Where is the best place to put this?
-      var e = expr.methodName.staticElement;
+      var e = resolutionMap.staticElementForIdentifier(expr.methodName);
       if (isInlineJS(e)) {
         // Fix types for JS builtin calls.
         //
diff --git a/pkg/dev_compiler/lib/src/compiler/reify_coercions.dart b/pkg/dev_compiler/lib/src/compiler/reify_coercions.dart
index c0a9f72..595d540 100644
--- a/pkg/dev_compiler/lib/src/compiler/reify_coercions.dart
+++ b/pkg/dev_compiler/lib/src/compiler/reify_coercions.dart
@@ -4,6 +4,7 @@
 
 import 'package:analyzer/analyzer.dart' as analyzer;
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_ast_factory.dart';
 import 'package:analyzer/dart/element/type.dart' show DartType;
 import 'package:analyzer/src/dart/ast/ast.dart' show FunctionBodyImpl;
 import 'package:analyzer/src/dart/ast/utilities.dart' show NodeReplacer;
@@ -40,7 +41,8 @@
   static Expression castExpression(Expression e, DartType toType) {
     // We use an empty name in the AST, because the JS code generator only cares
     // about the target type. It does not look at the AST name.
-    var typeName = new TypeName(AstBuilder.identifierFromString(''), null);
+    var typeName =
+        astFactory.typeName(AstBuilder.identifierFromString(''), null);
     typeName.type = toType;
     var cast = AstBuilder.asExpression(e, typeName);
     cast.staticType = toType;
diff --git a/pkg/dev_compiler/lib/src/compiler/source_map_printer.dart b/pkg/dev_compiler/lib/src/compiler/source_map_printer.dart
index 3a12972..3320e8d 100644
--- a/pkg/dev_compiler/lib/src/compiler/source_map_printer.dart
+++ b/pkg/dev_compiler/lib/src/compiler/source_map_printer.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:source_maps/source_maps.dart' hide Printer;
 import 'package:source_span/source_span.dart' show SourceLocation;
 
@@ -48,7 +49,8 @@
       // parts.
       _currentTopLevelDeclaration = node;
       unit = node.getAncestor((n) => n is CompilationUnit);
-      sourcePath = unit.element.source.fullName;
+      sourcePath =
+          resolutionMap.elementDeclaredByCompilationUnit(unit).source.fullName;
     }
 
     _mark(node.offset, _getIdentifier(node));
diff --git a/pkg/dev_compiler/test/all_tests.dart b/pkg/dev_compiler/test/all_tests.dart
index 71d48ac..963e55c 100644
--- a/pkg/dev_compiler/test/all_tests.dart
+++ b/pkg/dev_compiler/test/all_tests.dart
@@ -11,9 +11,11 @@
 import 'closure/closure_type_test.dart' as closure_type_test;
 import 'codegen_test.dart' as codegen_test;
 import 'js/builder_test.dart' as builder_test;
+import 'options/options_test.dart' as options_test;
 import 'worker/worker_test.dart' as worker_test;
 
 void main() {
+  group('options', options_test.main);
   group('codegen', () => codegen_test.main([]));
   group('closure', () {
     closure_annotation_test.main();
diff --git a/pkg/dev_compiler/test/browser/language_tests.js b/pkg/dev_compiler/test/browser/language_tests.js
index 6cf5f8f..1bf0b53 100644
--- a/pkg/dev_compiler/test/browser/language_tests.js
+++ b/pkg/dev_compiler/test/browser/language_tests.js
@@ -8,7 +8,8 @@
 
   async_helper = async_helper.async_helper;
   let minitest = expect.minitest;
-
+  let mochaOnError = window.onerror;
+  dart_sdk.dart.trapRuntimeErrors(false);
   dart_sdk._isolate_helper.startRootIsolate(function() {}, []);
   let html_config = unittest.html_config;
   // Test attributes are a list of strings, or a string for a single
@@ -25,13 +26,16 @@
   // Common combinations:
   const pass = 'pass';
   const fail = 'fail';
-  const skip_fail = ['skip', 'fail'];
   const skip_timeout = ['skip', 'timeout'];
 
   // Browsers
   const firefox_fail = is.firefox() ? fail : pass;
   const chrome_fail = is.chrome() ? fail : pass;
 
+  // These are typically tests with asynchronous exceptions that our
+  // test framework doesn't always catch.
+  const flaky = 'skip';
+
   // Tests marked with this are still using the deprecated unittest package
   // because they rely on its support for futures and asynchronous tests, which
   // expect and minitest do not handle.
@@ -41,130 +45,111 @@
 
   // The number of expected unittest errors should be zero but unfortunately
   // there are a lot of broken html unittests.
-  let num_expected_unittest_fails = 3;
+  let num_expected_unittest_fails = 4;
   let num_expected_unittest_errors = 0;
 
   // TODO(jmesserly): separate StrongModeError from other errors.
   let all_status = {
     'language': {
-      'assert_with_type_test_or_cast_test': skip_fail,
-      'assertion_test': skip_fail,
+      'assertion_test': fail,
       'async_await_test_none_multi': 'unittest',
       'async_await_test_02_multi': 'unittest',
-      'async_await_test_03_multi': skip_fail,  // Flaky on travis (#634)
-      'async_star_await_pauses_test': skip_fail,
+
+      // Flaky on travis (https://github.com/dart-lang/sdk/issues/27224)
+      'async_await_test_03_multi': async_unittest,
+
+      'async_star_await_pauses_test': skip_timeout,
 
       // TODO(jmesserly): figure out why this test is hanging.
       'async_star_cancel_and_throw_in_finally_test': skip_timeout,
 
-      'async_star_cancel_while_paused_test': skip_fail,
-      'async_star_regression_fisk_test': skip_fail,
+      'async_star_cancel_while_paused_test': fail,
 
-      // TODO(vsm): Re-enable.
-      // See https://github.com/dart-lang/dev_compiler/issues/456
-      'async_star_test_none_multi': ['unittest', 'skip', 'fail'],
-      'async_star_test_01_multi': ['unittest', 'skip', 'fail'],
-      'async_star_test_02_multi': ['unittest', 'skip', 'fail'],
-      'async_star_test_03_multi': ['unittest', 'skip', 'fail'],
-      'async_star_test_04_multi': ['unittest', 'skip', 'fail'],
-      'async_star_test_05_multi': ['unittest', 'skip', 'fail'],
+      // TODO(vsm): Re-enable (https://github.com/dart-lang/sdk/issues/28319)
+      'async_star_test_none_multi': async_unittest,
+      'async_star_test_01_multi': async_unittest,
+      'async_star_test_02_multi': async_unittest,
+      'async_star_test_03_multi': async_unittest,
+      'async_star_test_04_multi': async_unittest,
+      'async_star_test_05_multi': async_unittest,
 
-      'async_switch_test': skip_fail,
-      'asyncstar_throw_in_catch_test': skip_fail,
-      'await_future_test': skip_fail,
-      'bit_operations_test_none_multi': skip_fail,  // DDC/dart2js canonicalize bitop results to unsigned
-      'bool_test': skip_fail,
-      'branch_canonicalization_test': skip_fail,  // JS bit operations truncate to 32 bits.
+      'async_switch_test': fail,
+      'asyncstar_throw_in_catch_test': ['skip', 'fail'],
+      'await_future_test': skip_timeout,
+      'bit_operations_test_none_multi': fail,  // DDC/dart2js canonicalize bitop results to unsigned
+      'branch_canonicalization_test': fail,  // JS bit operations truncate to 32 bits.
       'call_closurization_test': fail, // Functions do not expose a "call" method.
       'call_function_apply_test': fail, // Function.apply not really implemented.
       'call_through_null_getter_test': fail, // null errors are not converted to NoSuchMethodErrors.
       'call_with_no_such_method_test': fail, // Function.apply not really implemented.
-      'canonical_const2_test': skip_fail,
-      'canonical_const_test': skip_fail,
-      'cascade_precedence_test': skip_fail,
-      'cast_test_01_multi': skip_fail,
-      'cast_test_02_multi': skip_fail,
-      'cast_test_03_multi': skip_fail,
-      'cast_test_07_multi': skip_fail,
-      'cast_test_10_multi': skip_fail,
-      'cast_test_12_multi': skip_fail,
-      'cast_test_13_multi': skip_fail,
-      'cast_test_14_multi': skip_fail,
-      'cast_test_15_multi': skip_fail,
-      'cha_deopt1_test': skip_fail,
-      'cha_deopt2_test': skip_fail,
-      'cha_deopt3_test': skip_fail,
-
-      // interpolation does not call Dart's toString:
-      // https://github.com/dart-lang/dev_compiler/issues/470
-      'class_syntax2_test': skip_fail,
-      'classes_static_method_clash_test': skip_fail,
-      'closure_call_wrong_argument_count_negative_test': skip_fail,
-      'closure_in_constructor_test': skip_fail,
-      'closures_initializer_test': skip_fail,
-      'code_after_try_is_executed_test_01_multi': skip_fail,
-      'compile_time_constant10_test_none_multi': skip_fail,
-      'compile_time_constant_a_test': skip_fail,
-      'compile_time_constant_b_test': skip_fail,
-      'compile_time_constant_d_test': skip_fail,
-      'compile_time_constant_i_test': skip_fail,
-      'compile_time_constant_k_test_none_multi': skip_fail,
-      'compile_time_constant_o_test_none_multi': skip_fail,
-      'const_constructor3_test_03_multi': skip_fail,
-      'const_escape_frog_test': skip_fail,
-      'const_evaluation_test_01_multi': skip_fail,
-      'const_switch_test_02_multi': skip_fail,
-      'const_switch_test_04_multi': skip_fail,
-      'constructor11_test': skip_fail,
-      'constructor12_test': skip_fail,
-      'cyclic_type2_test': skip_fail,
-      'cyclic_type_test_00_multi': skip_fail,
-      'cyclic_type_test_01_multi': skip_fail,
-      'cyclic_type_test_02_multi': skip_fail,
-      'cyclic_type_test_03_multi': skip_fail,
-      'cyclic_type_test_04_multi': skip_fail,
-      'cyclic_type_variable_test_none_multi': skip_fail,
+      'canonical_const2_test': fail,
+      'canonical_const_test': fail,
+      'cast_test_01_multi': fail,
+      'cast_test_02_multi': fail,
+      'cast_test_03_multi': fail,
+      'cast_test_07_multi': fail,
+      'cast_test_08_multi': fail, // (oc as dynamic).bar;  /// 08: runtime error
+      'cast_test_10_multi': fail,
+      'cast_test_12_multi': fail,
+      'cast_test_13_multi': fail,
+      'cast_test_14_multi': fail,
+      'cast_test_15_multi': fail,
+      'classes_static_method_clash_test': fail,
+      'code_after_try_is_executed_test_01_multi': fail,
+      'compile_time_constant10_test_none_multi': fail,
+      'compile_time_constant_a_test': fail,
+      'compile_time_constant_b_test': fail,
+      'compile_time_constant_d_test': fail,
+      'compile_time_constant_k_test_none_multi': fail,
+      'compile_time_constant_o_test_none_multi': fail,
+      'const_evaluation_test_01_multi': fail,
+      'const_switch_test_02_multi': fail,
+      'const_switch_test_04_multi': fail,
+      'constructor12_test': fail,
+      'covariant_subtyping_unsafe_call2_test': fail,
+      'cyclic_type2_test': fail,
+      'cyclic_type_test_00_multi': fail,
+      'cyclic_type_test_01_multi': fail,
+      'cyclic_type_test_02_multi': fail,
+      'cyclic_type_test_03_multi': fail,
+      'cyclic_type_test_04_multi': fail,
 
       // Deferred libraries are not actually deferred. These tests all test
       // that synchronous access to the library fails.
-      'deferred_call_empty_before_load_test': skip_fail,
-      'deferred_not_loaded_check_test': skip_fail,
-      'deferred_redirecting_factory_test': skip_fail,
-      'deferred_static_seperate_test': skip_fail,
+      'deferred_call_empty_before_load_test': fail,
+      'deferred_not_loaded_check_test': fail,
+      'deferred_redirecting_factory_test': fail,
+      'deferred_static_seperate_test': fail,
 
-      'deferred_regression_22995_test': skip_fail, // Strong mode "is" rejects some type tests.
-      'double_int_to_string_test': skip_fail,
-      'double_to_string_test': skip_fail,
-      'dynamic_test': skip_fail,
-      'enum_mirror_test': skip_fail,
+      'deferred_regression_22995_test': fail, // Strong mode "is" rejects some type tests.
+      'double_int_to_string_test': fail,
+      'dynamic_test': fail,
       'exception_test': fail,
-      'execute_finally6_test': skip_fail,
-      'expect_test': skip_fail,
-      'extends_test_lib': skip_fail,
-      'external_test_10_multi': skip_fail,
-      'external_test_13_multi': skip_fail,
-      'external_test_20_multi': skip_fail,
-      'f_bounded_quantification3_test': skip_fail,
-      'factory_type_parameter_test': skip_fail,
-      'fast_method_extraction_test': skip_fail,
+      'execute_finally6_test': fail,
+      'expect_test': fail,
+      'extends_test_lib': fail,
+      'external_test_10_multi': fail,
+      'external_test_13_multi': fail,
+      'external_test_20_multi': fail,
+      'f_bounded_quantification3_test': fail,
       'field_increment_bailout_test': fail,
-      'field_optimization3_test': skip_fail,
-      'final_syntax_test_08_multi': skip_fail,
-      'first_class_types_test': skip_fail,
-      'for_in2_test': skip_fail,
-      'for_variable_capture_test': skip_fail,
-      'function_subtype0_test': skip_fail,
-      'function_subtype1_test': skip_fail,
-      'function_subtype2_test': skip_fail,
-      'function_subtype3_test': skip_fail,
-      'function_subtype_bound_closure0_test': skip_fail,
-      'function_subtype_bound_closure1_test': skip_fail,
-      'function_subtype_bound_closure2_test': skip_fail,
-      'function_subtype_bound_closure3_test': skip_fail,
-      'function_subtype_bound_closure4_test': skip_fail,
-      'function_subtype_bound_closure5_test': skip_fail,
-      'function_subtype_bound_closure5a_test': skip_fail,
-      'function_subtype_bound_closure6_test': skip_fail,
+      'field_optimization3_test': fail,
+      'field_type_check2_test_01_multi': fail, // 01: dynamic type error
+      'final_syntax_test_08_multi': fail,
+      'first_class_types_test': fail,
+      'for_variable_capture_test': is.firefox('<=50') ? pass : fail,
+      'function_subtype0_test': fail,
+      'function_subtype1_test': fail,
+      'function_subtype2_test': fail,
+      'function_subtype3_test': fail,
+      'function_subtype_bound_closure0_test': fail,
+      'function_subtype_bound_closure1_test': fail,
+      'function_subtype_bound_closure2_test': fail,
+      'function_subtype_bound_closure3_test': fail,
+      'function_subtype_bound_closure4_test': fail,
+      'function_subtype_bound_closure5_test': fail,
+      'function_subtype_bound_closure5a_test': fail,
+      'function_subtype_bound_closure6_test': fail,
       'function_subtype_call0_test': fail, // Strong mode "is" rejects some type tests.
       'function_subtype_call1_test': fail,
       'function_subtype_call2_test': fail,
@@ -172,156 +157,118 @@
       'function_subtype_cast1_test': fail,
       'function_subtype_cast2_test': fail,
       'function_subtype_cast3_test': fail,
-      'function_subtype_factory0_test': skip_fail,
-      'function_subtype_inline0_test': skip_fail,
-      'function_subtype_local0_test': skip_fail,
-      'function_subtype_local1_test': skip_fail,
-      'function_subtype_local2_test': skip_fail,
-      'function_subtype_local3_test': skip_fail,
-      'function_subtype_local4_test': skip_fail,
-      'function_subtype_local5_test': skip_fail,
-      'function_subtype_named1_test': skip_fail,
-      'function_subtype_named2_test': skip_fail,
-      'function_subtype_not0_test': skip_fail,
-      'function_subtype_not1_test': skip_fail,
-      'function_subtype_not2_test': skip_fail,
-      'function_subtype_not3_test': skip_fail,
-      'function_subtype_optional1_test': skip_fail,
-      'function_subtype_optional2_test': skip_fail,
-      'function_subtype_top_level0_test': skip_fail,
-      'function_subtype_top_level1_test': skip_fail,
-      'function_subtype_typearg0_test': skip_fail,
-      'function_subtype_typearg2_test': skip_fail,
-      'function_subtype_typearg4_test': skip_fail,
-      'function_type_alias2_test': skip_fail,
-      'function_type_alias3_test': skip_fail,
-      'function_type_alias4_test': skip_fail,
-      'function_type_alias6_test_none_multi': skip_fail,
-      'gc_test': skip_fail,
-      'generic_field_mixin2_test': skip_fail,
-      'generic_field_mixin3_test': skip_fail,
-      'generic_field_mixin4_test': skip_fail,
-      'generic_field_mixin5_test': skip_fail,
-      'generic_field_mixin_test': skip_fail,
+      'function_subtype_factory0_test': fail,
+      'function_subtype_inline0_test': fail,
+      'function_subtype_local0_test': fail,
+      'function_subtype_local1_test': fail,
+      'function_subtype_local2_test': fail,
+      'function_subtype_local3_test': fail,
+      'function_subtype_local4_test': fail,
+      'function_subtype_local5_test': fail,
+      'function_subtype_named1_test': fail,
+      'function_subtype_named2_test': fail,
+      'function_subtype_not0_test': fail,
+      'function_subtype_not1_test': fail,
+      'function_subtype_not2_test': fail,
+      'function_subtype_not3_test': fail,
+      'function_subtype_optional1_test': fail,
+      'function_subtype_optional2_test': fail,
+      'function_subtype_top_level0_test': fail,
+      'function_subtype_top_level1_test': fail,
+      'function_subtype_typearg2_test': fail,
+      'function_subtype_typearg4_test': fail,
+      'function_type_alias2_test': fail,
+      'function_type_alias3_test': fail,
+      'function_type_alias4_test': fail,
+      'function_type_alias6_test_none_multi': fail,
       'generic_instanceof_test': fail, // runtime strong mode reject
-      'generic_instanceof2_test': skip_fail,
-      'generic_is_check_test': skip_fail,
-      'getter_closure_execution_order_test': skip_fail,
-      'hash_code_mangling_test': skip_fail,
-      'identical_closure2_test': skip_fail,
-      'infinite_switch_label_test': skip_fail,
-      'infinity_test': skip_fail,
-      'instance_creation_in_function_annotation_test': skip_fail,
+      'generic_instanceof2_test': fail,
+      'generic_is_check_test': fail,
+      'getter_closure_execution_order_test': fail,
+      'hash_code_mangling_test': fail,
+      'identical_closure2_test': fail,
+      'infinite_switch_label_test': fail,
+      'infinity_test': fail,
+      'initializing_formal_final_test': fail,
+      'instance_creation_in_function_annotation_test': fail,
       'instanceof2_test': fail,
       'instanceof4_test_01_multi': fail,
       'instanceof4_test_none_multi': fail,
-      'instanceof_optimized_test': skip_fail,
+      'instanceof_optimized_test': fail,
       'integer_division_by_zero_test': fail,
-      'is_nan_test': fail,
-      'issue10747_test': skip_fail,
-      'issue13179_test': skip_fail,
-      'issue21079_test': skip_fail,
-      'issue21957_test': skip_fail,
-      'issue_1751477_test': skip_fail,
-      'issue_22780_test_01_multi': skip_fail,
-      'issue_23914_test': skip_fail,
-      'js_properties_test': skip_fail,
-      'lazy_static3_test': skip_fail,
-      'least_upper_bound_expansive_test_none_multi': skip_fail,
-      'left_shift_test': skip_fail,
-      'list_is_test': skip_fail,
-      'list_literal3_test': skip_fail,
-      'many_generic_instanceof_test': skip_fail,
-      'map_literal10_test': skip_fail,
-      'map_literal7_test': skip_fail,
-      'memory_swap_test': skip_fail,
-      'method_invocation_test': skip_fail,
-      'mint_arithmetic_test': skip_fail,
-      'mixin_forwarding_constructor3_test': skip_fail,
-      'mixin_generic_test': skip_fail,
-      'mixin_implements_test': skip_fail,
-      'mixin_issue10216_2_test': skip_fail,
-      'mixin_mixin2_test': skip_fail,
-      'mixin_mixin3_test': skip_fail,
-      'mixin_mixin4_test': skip_fail,
-      'mixin_mixin5_test': skip_fail,
-      'mixin_mixin6_test': skip_fail,
-      'mixin_mixin7_test': skip_fail,
-      'mixin_mixin_bound2_test': skip_fail,
-      'mixin_mixin_bound_test': skip_fail,
-      'mixin_mixin_test': skip_fail,
-      'mixin_regress_13688_test': skip_fail,
-      'mixin_type_parameter1_test': skip_fail,
-      'mixin_type_parameter2_test': skip_fail,
-      'mixin_type_parameter3_test': skip_fail,
+      'issue_22780_test_01_multi': fail,
+      'lazy_static3_test': fail,
+      'least_upper_bound_expansive_test_none_multi': fail,
+      'left_shift_test': fail,
+      'list_is_test': fail,
+      'list_literal3_test': fail,
+      'many_generic_instanceof_test': fail,
+      'map_literal10_test': fail,
+      'map_literal7_test': fail,
+      'memory_swap_test': is.firefox() ? skip_timeout : pass,
+      'method_invocation_test': fail,
+      'mint_arithmetic_test': fail,
+      'mixin_forwarding_constructor3_test': fail,
+      'mixin_implements_test': fail,
+      'mixin_issue10216_2_test': fail,
+      'mixin_mixin2_test': fail,
+      'mixin_mixin3_test': fail,
+      'mixin_mixin4_test': fail,
+      'mixin_mixin5_test': fail,
+      'mixin_mixin6_test': fail,
+      'mixin_mixin7_test': fail,
+      'mixin_mixin_bound2_test': fail,
+      'mixin_mixin_bound_test': fail,
+      'mixin_mixin_test': fail,
+      'mixin_regress_13688_test': fail,
       'modulo_test': fail,
-      'named_parameter_clash_test': skip_fail,
-      'named_parameters_passing_falsy_test': firefox_fail,
-      'nan_identical_test': skip_fail,
-      'nested_switch_label_test': skip_fail,
-      'number_identifier_test_05_multi': skip_fail,
-      'number_identity2_test': skip_fail,
-      'numbers_test': skip_fail,
-      'optimized_hoisting_checked_mode_assert_test': skip_fail,
-      'redirecting_factory_reflection_test': skip_fail,
-      'regress_13462_0_test': skip_fail,
-      'regress_13462_1_test': skip_fail,
-      'regress_14105_test': skip_fail,
-      'regress_16640_test': skip_fail,
+      'named_parameter_clash_test': fail,
+      'named_parameters_passing_falsy_test': is.firefox('<=50') ? fail : pass,
+      'nan_identical_test': fail,
+      'nested_switch_label_test': fail,
+      'number_identifier_test_05_multi': fail,
+      'number_identity2_test': fail,
+      'numbers_test': fail,
+      'redirecting_factory_reflection_test': fail,
+      'regress_16640_test': fail,
       'regress_18535_test': fail,
-      'regress_21795_test': skip_fail,
-      'regress_22443_test': skip_fail,
-      'regress_22666_test': skip_fail,
-      'setter_no_getter_test_01_multi': skip_fail,
-      'stack_overflow_stacktrace_test': skip_fail,
-      'stack_overflow_test': skip_fail,
-      'stack_trace_test': skip_fail,
-      'stacktrace_rethrow_nonerror_test': skip_fail, // mismatch from Karma's file hash
-      'stacktrace_rethrow_error_test_none_multi': skip_fail,
-      'stacktrace_rethrow_error_test_withtraceparameter_multi': skip_fail,
-      'stacktrace_test': skip_fail,
-      'string_interpolate_null_test': skip_fail,
-      'super_operator_index3_test': skip_fail,
-      'super_operator_index4_test': skip_fail,
-      'switch_label2_test': skip_fail,
-      'switch_label_test': skip_fail,
-      'switch_try_catch_test': skip_fail,
-      'sync_generator1_test_none_multi': skip_fail,
-      'throwing_lazy_variable_test': skip_fail,
-      'top_level_non_prefixed_library_test': skip_fail,
+      'regress_22666_test': fail,
+      'regress_22777_test': flaky,
+      'setter_no_getter_test_01_multi': fail,
+      'stack_overflow_stacktrace_test': fail,
+      'stack_overflow_test': fail,
+      'stacktrace_rethrow_error_test_none_multi': fail,
+      'stacktrace_rethrow_error_test_withtraceparameter_multi': fail,
+      'stacktrace_test': chrome_fail,
+      'string_interpolate_null_test': fail,
+      'switch_label2_test': fail,
+      'switch_label_test': fail,
+      'switch_try_catch_test': fail,
+      'throwing_lazy_variable_test': fail,
       'truncdiv_test': fail,  // did not throw
-      'type_variable_nested_test': skip_fail,  // unsound is-check
-      'type_variable_typedef_test': skip_fail,  // unsound is-check
+      'type_variable_nested_test': fail,  // unsound is-check
+      'type_variable_typedef_test': fail,  // unsound is-check
 
-      'bit_operations_test_01_multi': skip_fail,
-      'bit_operations_test_02_multi': skip_fail,
-      'bit_operations_test_03_multi': skip_fail,
-      'bit_operations_test_04_multi': skip_fail,
-      'bool_condition_check_test_01_multi': skip_fail,
-      'deferred_constraints_constants_test_none_multi': skip_fail,
-      'deferred_constraints_constants_test_reference_after_load_multi': skip_fail,
-      'deferred_constraints_type_annotation_test_new_generic1_multi': skip_fail,
-      'deferred_constraints_type_annotation_test_new_multi': skip_fail,
-      'deferred_constraints_type_annotation_test_none_multi': skip_fail,
-      'deferred_constraints_type_annotation_test_static_method_multi': skip_fail,
-      'deferred_constraints_type_annotation_test_type_annotation_non_deferred_multi': skip_fail,
-      'deferred_load_constants_test_none_multi': skip_fail,
-      'deferred_load_library_wrong_args_test_01_multi': skip_fail,
-      'deferred_load_library_wrong_args_test_none_multi': skip_fail,
-      'external_test_21_multi': skip_fail,
-      'external_test_24_multi': skip_fail,
-      'main_not_a_function_test_01_multi': skip_fail,
-      'multiline_newline_test_04_multi': skip_fail,
-      'multiline_newline_test_05_multi': skip_fail,
-      'multiline_newline_test_06_multi': skip_fail,
-      'multiline_newline_test_none_multi': skip_fail,
-      'no_main_test_01_multi': skip_fail,
+      'bit_operations_test_01_multi': fail,
+      'bit_operations_test_02_multi': fail,
+      'bit_operations_test_03_multi': fail,
+      'bit_operations_test_04_multi': fail,
+      'bool_condition_check_test_01_multi': fail,
+      'deferred_load_constants_test_none_multi': fail,
+      'external_test_21_multi': fail,
+      'external_test_24_multi': fail,
+      'main_not_a_function_test_01_multi': fail,
+      'multiline_newline_test_04_multi': fail,
+      'multiline_newline_test_05_multi': fail,
+      'multiline_newline_test_06_multi': fail,
+      'multiline_newline_test_none_multi': fail,
+      'no_main_test_01_multi': fail,
 
       // https://github.com/dart-lang/sdk/issues/26123
-      'bad_raw_string_negative_test': skip_fail,
+      'bad_raw_string_negative_test': fail,
 
       // https://github.com/dart-lang/sdk/issues/26124
-      'prefix10_negative_test': skip_fail,
+      'prefix10_negative_test': fail,
 
       'library_prefixes_test1': 'helper',
       'library_prefixes_test2': 'helper',
@@ -329,6 +276,8 @@
 
     },
 
+    'language/covariant_override': {},
+
     'corelib': {
       'apply2_test': fail,
       'apply3_test': fail,
@@ -346,11 +295,10 @@
       'double_parse_test_02_multi': firefox_fail,
       'error_stack_trace1_test': fail,
       'error_stack_trace2_test': fail,
-      'for_in_test': firefox_fail,
+      'for_in_test': is.firefox('<=50') ? fail : pass,
       'hash_map2_test': skip_timeout,
       'hash_set_test_01_multi': fail,
       'hidden_library2_test_01_multi': fail,
-      'indexed_list_access_test': fail,
       'int_modulo_arith_test_bignum_multi': fail,
       'int_modulo_arith_test_modPow_multi': fail,
       'int_modulo_arith_test_none_multi': fail,
@@ -369,15 +317,14 @@
       'main_test': fail,
       'map_keys2_test': fail,
       'map_to_string_test': fail,
-      'map_from_iterable_test': firefox_fail,
+      'map_from_iterable_test': is.firefox('<=50') ? fail : pass,
       'nan_infinity_test_01_multi': fail,
       'null_nosuchmethod_test': fail,
       'null_test': fail,
       'num_sign_test': fail,
       'regress_r21715_test': fail,
       'throw_half_surrogate_pair_test_02_multi': fail,
-      'splay_tree_from_iterable_test': firefox_fail,
-      'stacktrace_current_test': chrome_fail,
+      'splay_tree_from_iterable_test': is.firefox('<=50') ? fail : pass,
       'string_case_test_01_multi': firefox_fail,
       'string_fromcharcodes_test': skip_timeout,
       'string_operations_with_null_test': fail,
@@ -386,11 +333,11 @@
       'symbol_reserved_word_test_12_multi': fail,
       'throw_half_surrogate_pair_test_01_multi': fail,
       'unicode_test': firefox_fail,
-      'uri_parameters_all_test': firefox_fail,
+      'uri_parameters_all_test': is.firefox('<=50') ? fail : pass,
       // TODO(rnystrom): Times out because it tests a huge number of
       // combinations of URLs (4 * 5 * 5 * 8 * 6 * 6 * 4 = 115200).
       'uri_parse_test': skip_timeout,
-      'uri_test': firefox_fail,
+      'uri_test': is.firefox('<=50') ? fail : pass,
 
       'list_insert_test': fail,
       'list_removeat_test': fail,
@@ -408,10 +355,6 @@
     'lib/convert': {
       'encoding_test': skip_timeout,
 
-      // TODO(jmesserly): this is in an inconsistent state between our old and
-      // newer SDKs.
-      'html_escape_test': ['skip'],
-
       'json_utf8_chunk_test': skip_timeout,
       'latin1_test': skip_timeout,
 
@@ -426,8 +369,10 @@
     'lib/html': {
       'async_spawnuri_test': async_unittest,
       'async_test': async_unittest,
-      'audiocontext_test': is.chrome('<=55') ? fail : pass, // was sdk#27578, needs triage
-      'blob_constructor_test': 'fail', // was sdk#27578, needs triage
+
+       // was https://github.com/dart-lang/sdk/issues/27578, needs triage
+      'audiocontext_test': is.chrome('<=54') ? fail : pass,
+
       'canvas_test': ['unittest'],
       'canvasrenderingcontext2d_test': ['unittest'],
       'cross_domain_iframe_test': async_unittest,
@@ -437,31 +382,28 @@
       // This is failing with a range error, I'm guessing because it's looking
       // for a stylesheet and the page has none.
       'css_rule_list_test': 'fail',
+
       'custom_element_method_clash_test': async_unittest,
       'custom_element_name_clash_test': async_unittest,
       'custom_elements_23127_test': async_unittest,
       'custom_elements_test': async_unittest,
-      'dom_constructors_test': 'fail', // was sdk#27578, needs triage
-      'element_animate_test': async_unittest,
-      'element_classes_test': 'fail', // sdk#27579.
-      'element_classes_svg_test': 'fail', // sdk#27579.
+      'element_animate_test': 'unittest',
+
+      // https://github.com/dart-lang/sdk/issues/27579.
+      'element_classes_test': 'fail',
+      'element_classes_svg_test': 'fail',
 
       // Failure: 'Expected 56 to be in the inclusive range [111, 160].'.
       'element_offset_test': 'fail',
+
       'element_test': async_unittest,
       'element_types_test': firefox_fail,
       'event_customevent_test': async_unittest,
       'events_test': async_unittest,
-
-      // Failure: "Failed to execute 'dispatchEvent' on 'EventTarget': parameter
-      // 1 is not of type 'Event'."
-      'event_test': 'fail',
       'fileapi_test': async_unittest,
       'filereader_test': async_unittest,
       'fontface_loaded_test': async_unittest,
-
-      // Failed because it's expecting "Ahem" but getting null. Maybe sdk#27579?
-      'fontface_test': 'fail',
+      'fontface_test': firefox_fail,
       'form_data_test': async_unittest,
       'history_test': async_unittest,
       'indexeddb_1_test': async_unittest,
@@ -469,12 +411,13 @@
       'indexeddb_3_test': async_unittest,
       'indexeddb_4_test': async_unittest,
       'indexeddb_5_test': async_unittest,
-      'input_element_test': 'fail', // was sdk#27578, needs triage
+
+      // was https://github.com/dart-lang/sdk/issues/27578, needs triage
+      'input_element_test': 'fail',
+
       'interactive_test': async_unittest,
       'isolates_test': async_unittest,
 
-      // Failing on "identical JS objects should have identical proxies".
-      'js_test': 'fail',
       'js_interop_1_test': async_unittest,
 
       // Failing because accessing "zSomeInvalidName" does not throw.
@@ -484,29 +427,29 @@
       'js_util_test': 'fail',
       'keyboard_event_test': async_unittest,
 
-      'mediasource_test': 'fail', // was sdk#27578, needs triage
-      'media_stream_test': 'fail', // was sdk#27578, needs triage
-      'messageevent_test': 'fail', // was sdk#27578, needs triage
-
-      // Should throw but does not.
-      'mirrors_js_typed_interop_test': 'fail',
+      // was https://github.com/dart-lang/sdk/issues/27578, needs triage
+      'mediasource_test': 'fail',
+      'media_stream_test': 'fail',
 
       'mutationobserver_test': async_unittest,
       'native_gc_test': async_unittest,
-      'notification_test': 'fail', // was sdk#27578, needs triage
       'postmessage_structured_test': async_unittest,
       'queryall_test': ['slow'], // see sdk #27794
       'request_animation_frame_test': async_unittest,
       'resource_http_test': async_unittest,
-      'rtc_test': is.chrome('<=55') ? fail : pass, // was sdk#27578, needs triage
 
-      // Expected 1, got null.
-      'serialized_script_value_test': 'fail',
+      // was https://github.com/dart-lang/sdk/issues/27578, needs triage
+      'rtc_test': is.chrome('<=55') ? fail : pass,
       'shadow_dom_test': firefox_fail,
-      'speechrecognition_test': 'fail', // was sdk#27578, needs triage
-      'svgelement_test': chrome_fail, // was sdk#27578, needs triage
+
+      // was https://github.com/dart-lang/sdk/issues/27578, needs triage
+      'speechrecognition_test': 'fail',
+      'svgelement_test': chrome_fail,
       'text_event_test': firefox_fail,
-      'touchevent_test': 'fail', // was sdk#27578, needs triage
+
+      // was https://github.com/dart-lang/sdk/issues/27578, needs triage
+      'touchevent_test': 'fail',
+
       'transferables_test': async_unittest,
       'transition_event_test': async_unittest,
       'url_test': async_unittest,
@@ -535,19 +478,17 @@
 
     'lib/math': {
       // TODO(het): triage
-      'double_pow_test': skip_fail,
-      'low_test': skip_fail,
-      'math_test': skip_fail,
-      'math2_test': skip_fail,
+      'double_pow_test': fail,
+      'low_test': fail,
       'pi_test': skip_timeout,
-      'random_big_test': skip_fail,
+      'random_big_test': fail,
     },
 
     'lib/typed_data': {
       // No bigint or int64 support
-      'int32x4_bigint_test': skip_fail,
-      'int64_list_load_store_test': skip_fail,
-      'typed_data_hierarchy_int64_test': skip_fail,
+      'int32x4_bigint_test': fail,
+      'int64_list_load_store_test': fail,
+      'typed_data_hierarchy_int64_test': fail,
       'typed_data_list_test': fail,
     },
 
@@ -601,6 +542,7 @@
       'hot_set_field_test': fail,
       'inherited_metadata_test': fail,
       'instance_members_unimplemented_interface_test': fail,
+      'instance_members_with_override_test': fail, // JsClassMirror.instanceMembers unimplemented
       'instantiate_abstract_class_test': fail,
       'intercepted_superclass_test': fail,
       'invocation_fuzz_test_emptyarray_multi': fail,
@@ -625,6 +567,7 @@
       'library_imports_bad_metadata_test_none_multi': fail,
       'library_metadata2_test_none_multi': fail,
       'library_metadata_test': fail,
+      'library_uri_io_test': fail,
       'library_uri_package_test': fail,
       'list_constructor_test_01_multi': fail,
       'list_constructor_test_none_multi': fail,
@@ -676,7 +619,7 @@
       'type_variable_is_static_test': fail,
       'type_variable_owner_test_01_multi': fail,
       'type_variable_owner_test_none_multi': fail,
-      'typedef_deferred_library_test': skip_fail,  // Isolate spawn not support
+      'typedef_deferred_library_test': fail,  // Isolate spawn not support
       'typedef_library_test': fail,
       'typedef_metadata_test': fail,
       'typedef_test': fail,
@@ -695,6 +638,7 @@
   }
 
   let unittest_tests = [];
+  let unittestAccidentallyInitialized = false;
 
   let languageTestPattern =
       new RegExp('gen/codegen_output/(.*)/([^/]*_test[^/]*)');
@@ -740,56 +684,125 @@
 
       let protect = (f) => {  // Returns the exception, or `null`.
         try {
-          f();
-          return null;
+          return f();
         } catch (e) {
           return e;
         }
       };
 
       test(name, function(done) { // 'function' to allow `this.timeout`.
-        async_helper.asyncTestInitialize(done);
         console.debug('Running test:  ' + name);
 
+        // Many tests are async.  Currently, tests can indicate this in
+        // two different ways.  First, `main` can call (in Dart)
+        // `async_helper.asyncStart`.  We can check if this happened by
+        // querying `async_helper.asyncTestStarted` afterward and waiting for
+        // the callback if so.  Second, `main` can return a `Future`.  If so,
+        // we wait for that to complete.  If neither is true, we assume the
+        // test is synchronous.
+        //
+        // A 'failing' test will throw an exception.  This exception may be
+        // synchronous (i.e., during `main`) or asynchronous (after `main` in
+        // lieu of the callback/future).  The latter exceptions are not
+        // directly caught.  Instead, we intercept `window.onerror` to detect
+        // them.
+        //
+        // Note, if the test is marked 'negative' or 'fail', than pass and fail
+        // are effectively inverted: only a success is reported.
+        //
+        // In all cases, we funnel test completion through the `finish` handler
+        // below to handle reporting (based on status) and cleanup state.
+        //
+        // A test can finish in one of several ways:
+        // 1. Synchronous without an error.  In this case, `main` returns
+        //    null and did not set `async_helper`.  `finish` is invoked
+        //    immediately.
+        // 2. Synchronous error.  `main` throws an error.  `finish`
+        //    is invoked immediately with the error.
+        // 3. `Future` without an error.  In this case, the future completes
+        //    and asynchronously invokes `finish`.
+        // 4. Via `async_helper` without an error.  In this case, the
+        //    `async_helper` library triggers `finish` via its callback.
+        // 5. Asynchronously with an error.  In this case, `window.onerror`
+        //    triggers `finish` with the error.
+        // 6. Hangs.  In this case, we rely on the underlying mocha framework
+        //    timeout.
+        //
+        // TODO(vsm): This currently doesn't handle tests that trigger multiple
+        // asynchronous exceptions.
+
         let mainLibrary = require(module)[libraryName(name)];
         let negative = /negative_test/.test(name);
-        if (has('slow')) this.timeout(10000);
-        if (has('fail')) {
-          let e = protect(mainLibrary.main);
-          if (negative) {
-            if (e != null) {
-              throw new Error(
-                  "negative test marked as 'fail' " +
-                  "but passed by throwing:\n" + e);
-            }
-          } else {
-            if (e == null) {
-              throw new Error("test marked as 'fail' but passed");
-            }
-          }
-        } else {
-          try {
+        let fail = has('fail');
+
+        function finish(error) {
+          // If the test left any lingering detritus in the DOM, blow it away
+          // so it doesn't interfere with later tests.
+          if (fail) {
             if (negative) {
-              assert.throws(mainLibrary.main);
+              if (error) {
+                error = new Error(
+                  "negative test marked as 'fail' " +
+                  "but passed by throwing:\n" + error);
+              }
+            } else if (error) {
+              error = null
             } else {
-              mainLibrary.main();
+              error = new Error("test marked as 'fail' but passed");
             }
-          } finally {
-            minitest.finishTests();
+          } else if (negative) {
+            if (!error) {
+              error = new Error("test marked as 'negative' but did not throw");
+            } else {
+              error = null;
+            }
           }
+          minitest.finishTests();
+          document.body.innerHTML = '';
+          console.log("cleared");
+          if (error && !(error instanceof Error)) error = new Error(error);
+          done(error);
         }
 
-        // If the test left any lingering detritus in the DOM, blow it away
-        // so it doesn't interfere with later tests.
-        document.body.innerHTML = '';
-        console.log("cleared");
+        // Intercept uncaught exceptions
+        window.onerror = function(message, url, line, column, error) {
+          console.warn('Asynchronous error in ' + name + ': ' + message);
+          if (!error) {
+            error = new Error(message);
+          }
+          finish(error);
+        };
 
-        if (!async_helper.asyncTestStarted) done();
+        async_helper.asyncTestInitialize(finish);
+        if (has('slow')) this.timeout(10000);
+
+        var result;
+        try {
+          var result = mainLibrary.main();
+          if (result && !(result instanceof dart_sdk.async.Future)) {
+            result = null;
+          }
+        } catch (e) {
+          finish(e);
+        }
+
+        // Ensure this isn't a unittest
+        if (!unittestAccidentallyInitialized &&
+            unittest.src__test_environment.environment.initialized) {
+          // This suppresses duplicate messages for later tests
+          unittestAccidentallyInitialized = true;
+          finish(new Error('Test ' + name + ' must be marked as a unittest'));
+        } else if (!async_helper.asyncTestStarted) {
+          if (!result) {
+            finish();
+          } else {
+            result.then(dart_sdk.dart.dynamic)(() => finish());
+          }
+        }
       });
     }
   }
 
-  let mochaOnError;
   // We run these tests in a mocha test wrapper to avoid the confusing failure
   // case of dart unittests being interleaved with mocha tests.
   // In practice we are really just suppressing all mocha test behavior while
@@ -814,7 +827,6 @@
     this.timeout(100000000);
     this.enableTimeouts(false);
     // Suppress mocha on-error handling because it will mess up unittests.
-    mochaOnError = window.onerror;
     window.onerror = function(err, url, line) {
       console.error(err, url, line);
     };
diff --git a/pkg/dev_compiler/test/browser/runtime_tests.js b/pkg/dev_compiler/test/browser/runtime_tests.js
index 39d9a53..3cb562a 100644
--- a/pkg/dev_compiler/test/browser/runtime_tests.js
+++ b/pkg/dev_compiler/test/browser/runtime_tests.js
@@ -4,6 +4,7 @@
 
 define(['dart_sdk'], function(dart_sdk) {
   const assert = chai.assert;
+  const async = dart_sdk.async;
   const core = dart_sdk.core;
   const collection = dart_sdk.collection;
   const dart = dart_sdk.dart;
@@ -211,10 +212,13 @@
 
     function checkType(x, type, expectedTrue, strongOnly) {
       if (expectedTrue === undefined) expectedTrue = true;
-      if (strongOnly == undefined) strongOnly = false;
+      if (strongOnly === undefined) strongOnly = false;
       if (!strongOnly) {
         assert.doesNotThrow(() => instanceOf(x, type));
-        expect(instanceOf(x, type), expectedTrue);
+        expect(instanceOf(x, type), expectedTrue,
+          '"' + x + '" ' +
+          (expectedTrue ? 'should' : 'should not') +
+          ' be an instance of "' + dart.typeName(type) + '"');
       } else {
         assert.throws(() => instanceOf(x, type), dart.StrongModeError);
         expect(expectedTrue, false);
@@ -801,25 +805,34 @@
     let dyn = dart.dynamic;
 
     function always(t1, t2) {
-      assert.equal(isSubtype(t1, t2), true);
+      assert.equal(isSubtype(t1, t2), true,
+          dart.toString(t1) +
+          " should always be a subtype of " +
+          dart.toString(t2));
     }
     function never(t1, t2) {
-      assert.equal(isSubtype(t1, t2), false);
+      assert.equal(isSubtype(t1, t2), false,
+          dart.toString(t1) +
+          " should never be a subtype of " +
+          dart.toString(t2));
     }
     function maybe(t1, t2) {
-      assert.equal(isSubtype(t1, t2), null);
+      assert.equal(isSubtype(t1, t2), null,
+          dart.toString(t1) +
+          " should maybe be a subtype of " +
+          dart.toString(t2));
     }
 
     function always2(t1, t2) {
-      assert.equal(isSubtype(t1, t2), true);
+      always(t1, t2);
       always(functionType(t1, [t2]), functionType(t2, [t1]));
     }
     function never2(t1, t2) {
-      assert.equal(isSubtype(t1, t2), false);
+      never(t1, t2);
       maybe(functionType(t1, [t2]), functionType(t2, [t1]));
     }
     function maybe2(t1, t2) {
-      assert.equal(isSubtype(t1, t2), null);
+      maybe(t1, t2);
       maybe(functionType(t1, [t2]), functionType(t2, [t1]));
     }
 
@@ -919,6 +932,44 @@
       run_test(func1, func2, func2opt, func1extra, func2extra);
     });
 
+    test('top and bottom types', () => {
+      let FutureOr = async.FutureOr$;
+      let tops = [
+        dart.dynamic,
+        core.Object,
+        dart.void,
+        FutureOr(dart.dynamic),
+        FutureOr(core.Object),
+        FutureOr(dart.void),
+        FutureOr(FutureOr(core.Object)),
+        // ... skip the (infinite) rest of the top types :D
+      ];
+      let bottoms = [dart.bottom, core.Null];
+
+      for (let top of tops) {
+        for (let bottom of bottoms) {
+          always(bottom, top);
+          always(
+              definiteFunctionType(bottom, [top]),
+              definiteFunctionType(top, [bottom]));
+        }
+      }
+
+      for (let equalTypes of [tops, bottoms]) {
+        for (let t1 of equalTypes) {
+          for (let t2 of equalTypes) {
+            always(t1, t2);
+            always(t2, t1);
+
+            let t11 = definiteFunctionType(t1, [t1]);
+            let t22 = definiteFunctionType(t2, [t2]);
+            always(t11, t22);
+            always(t22, t11);
+          }
+        }
+      }
+    });
+
     test('basic typedefs', () => {
       function func1(S) {
         return dart.typedef('Func1', () => functionType(S, []))
@@ -975,7 +1026,6 @@
       always(functionType(dyn, [], [dyn]), functionType(dyn, [dyn]));
       always(functionType(dyn, [], [dyn]), functionType(dyn, []));
       always(functionType(dyn, [dyn], {extra: dyn}), functionType(dyn, [dyn]));
-
     });
 
     test('void function types', () => {
@@ -1020,7 +1070,6 @@
       never(functionType(dart.void, [], [int]), functionType(int, [int]));
       never(functionType(dart.void, [], [int]), functionType(int, []));
       never(functionType(dart.void, [int], {extra: int}), functionType(int, [int]));
-
     });
 
     test('higher-order typedef', () => {
@@ -1060,10 +1109,7 @@
       maybe(AA$(functionType(dyn, [dyn])), AA$(functionType(int, [int])));
       maybe(AA$(functionType(core.Object, [core.Object])),
             AA$(functionType(int, [int])));
-
-
     });
-
   });
 
   suite('canonicalization', function() {
diff --git a/pkg/dev_compiler/test/codegen/js_test.dart b/pkg/dev_compiler/test/codegen/js_test.dart
index 4476801..2c862d0 100644
--- a/pkg/dev_compiler/test/codegen/js_test.dart
+++ b/pkg/dev_compiler/test/codegen/js_test.dart
@@ -447,7 +447,7 @@
       var result = context.callMethod('callable');
       expect(result, 'called');
       context.deleteProperty('callable');
-    }, skip: "https://github.com/dart-lang/dev_compiler/issues/244");
+    });
 
   });
 
diff --git a/pkg/dev_compiler/test/codegen/language/tearoff_basic_lib.dart b/pkg/dev_compiler/test/codegen/language/tearoff_basic_lib.dart
deleted file mode 100644
index fe9fc07..0000000
--- a/pkg/dev_compiler/test/codegen/language/tearoff_basic_lib.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library tearoff_basic_lib;
-
-cfunc() => "cfunc";
-
-set cset(a) { cvar = a; }
-
-get cget => "cget";
-
-var cvar = 1+2+3;
-
-final cfinvar = "set in stone";
-
-class ZZ { }
diff --git a/pkg/dev_compiler/test/codegen/language/tearoff_basic_test.dart b/pkg/dev_compiler/test/codegen/language/tearoff_basic_test.dart
deleted file mode 100644
index 303d38e..0000000
--- a/pkg/dev_compiler/test/codegen/language/tearoff_basic_test.dart
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Basic test for tear-off closures.
-
-import "package:expect/expect.dart";
-import "tearoff_basic_lib.dart" as P;
-import "tearoff_basic_lib.dart" deferred as D;
-
-class C {
-  var v = 99;
-  final fv = 444;
-
-  operator + (a) { return v + a; }
-  get sugus => "sugus";
-  set frosch(a) { v = "ribbit $a"; }
-  foo() => "kuh";
-
-  static var st;
-  static final stfin = 1000;
-  static stfoo([p1 = 100]) => p1 * 10;
-  static get stg => "stg";
-  static set sts(x) { st = x; }
-}
-
-
-testStatic() {
-  // Closurize static variable.
-  var a = C#st=;
-  a(100);
-  Expect.equals(100, C.st);
-  var b = C#st;
-  Expect.equals(100, b());
-
-  // Closurize static final variable.
-  a = C#stfin;
-  Expect.equals(1000, a());
-  Expect.throws(() => C#stfin= );  // Final variable has no setter.
-
-  // Closurize static method.
-  a = C#stfoo;
-  Expect.equals(1000, a());
-  Expect.equals(90, a(9));
-
-  // Closurize static getter.
-  a = C#stg;
-  Expect.equals("stg", a());
-
-  // Closurize static setter.
-  Expect.throws(() => C#sts);  // No setter/method named sts exists.
-  a = C#sts=;
-  a("pflug");
-  Expect.equals("pflug", C.st);
-
-  // Can't closurize instance method via class literal.
-  Expect.throws(() => C#foo);
-
-  // Extracted closures must be equal.
-  Expect.isTrue(C#st == C#st);
-  Expect.isTrue(C#st= == C#st=);
-  Expect.isTrue(C#stfin == C#stfin);
-  Expect.isTrue(C#stfoo == C#stfoo);
-  Expect.isTrue(C#stg == C#stg);
-  Expect.isTrue(C#sts= == C#sts=);
-}
-
-testInstance() {
-  var o = new C();
-  var p = new C();
-  var a, b;
-
-  // Closurize instance variable.
-  a = o#v;
-  Expect.equals(99, a());
-  b = p#v=;
-  b(999);
-  Expect.equals(999, p.v);
-  Expect.equals(99, a());
-
-  // Closurize final instance variable.
-  Expect.throws(() => o#fv=);  // Final variable has not setter.
-  a = o#fv;
-  Expect.equals(444, a());
-
-  // Closurize instance method.
-  a = o#foo;
-  Expect.equals("kuh", a());
-
-  // Closurize operator.
-  a = o#+;
-  Expect.equals(100, o + 1);
-  Expect.equals(100, a(1));
-
-  // Closurize instance getter.
-  a = o#sugus;
-  Expect.equals("sugus", a());
-  Expect.throws(() => o#sugus=);
-
-  // Closurize instance setter.
-  a = o#frosch=;
-  a("!");
-  Expect.equals("ribbit !", o.v);
-  Expect.throws(() => o#frosch);
-
-  // Extracted closures must be equal.
-  Expect.isTrue(o#v == o#v);
-  Expect.isTrue(o#v= == o#v=);
-  Expect.isTrue(o#fv == o#fv);
-  Expect.isTrue(o#foo == o#foo);
-  Expect.isTrue(o#+ == o#+);
-  Expect.isTrue(o#sugus == o#sugus);
-  Expect.isTrue(o#frosch= == o#frosch=);
-}
-
-testPrefix() {
-  // Closurize top-level variable.
-  var a = P#cvar;
-  Expect.equals(6, a());
-  var b = P#cvar=;
-  b(7);
-  Expect.equals(7, a());
-
-  // Closurize final top-level variable.
-  a = P#cfinvar;
-  Expect.equals("set in stone", a());
-  Expect.throws(() => P#cfinvar=);
-
-  // Closurize top-level function.
-  a = P#cfunc;
-  Expect.equals("cfunc", a());
-
-  // Closurize top-level getter.
-  a = P#cget;
-  Expect.equals("cget", a());
-
-  // Closurize top-level getter.
-  a = P#cset=;
-  a(99);
-  Expect.equals(99, P.cvar);
-
-  Expect.throws(() => P#ZZ);  // Cannot closurize class.
-
-  // Extracted closures must be equal.
-  Expect.isTrue(P#cvar == P#cvar);
-  Expect.isTrue(P#cvar= == P#cvar=);
-  Expect.isTrue(P#cfinvar == P#cfinvar);
-  Expect.isTrue(P#cfunc == P#cfunc);
-  Expect.isTrue(P#cget == P#cget);
-  Expect.isTrue(P#cset= == P#cset=);
-}
-
-testDeferred() {
-  Expect.throws(() => D#cfunc);
-  D.loadLibrary().then((_) {
-    var a = D#cfunc;
-    Expect.equals("cfunc", a());
-  });
-}
-
-main() {
-  testStatic();
-  testInstance();
-  testPrefix();
-  testDeferred();
-}
diff --git a/pkg/dev_compiler/test/codegen/language/tearoff_constructor_basic_test.dart b/pkg/dev_compiler/test/codegen/language/tearoff_constructor_basic_test.dart
deleted file mode 100644
index 27c34d9..0000000
--- a/pkg/dev_compiler/test/codegen/language/tearoff_constructor_basic_test.dart
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Basic test for tear-off constructor closures.
-
-import "package:expect/expect.dart";
-
-class A {
-  // Implicit constructor A();
-  var f1 = "A.f1";
-}
-
-class P {
-  var x, y;
-  P(this.x, this.y);
-  factory P.origin() { return new P(0,0); }
-  factory P.ursprung() = P.origin;
-  P.onXAxis(x) : this(x, 0);
-}
-
-class C<T> {
-  T f1;
-  C(T p) : f1 = p;
-  C.n([T p]) : f1 = p;
-  listMaker() { return new List<T>#; }  // Closurize type parameter.
-}
-
-
-testMalformed() {
-  Expect.throws(() => new NoSuchClass#);
-  Expect.throws(() => new A#noSuchContstructor);
-}
-
-testA() {
-  var cc = new A#;  // Closurize implicit constructor.
-  var o = cc();
-  Expect.equals("A.f1", o.f1);
-  Expect.equals("A.f1", (new A#)().f1);
-  Expect.throws(() => new A#foo);
-}
-
-testP() {
-  var cc = new P#origin;
-  var o = cc();
-  Expect.equals(0, o.x);
-  cc = new P#ursprung;
-  o = cc();
-  Expect.equals(0, o.x);
-  cc = new P#onXAxis;
-  o = cc(5);
-  Expect.equals(0, o.y);
-  Expect.equals(5, o.x);
-  Expect.throws(() => cc(1, 1));  // Too many arguments.
-}
-
-testC() {
-  var cc = new C<int>#;
-  var o = cc(5);
-  Expect.equals("int", "${o.f1.runtimeType}");
-  Expect.throws(() => cc());  // Missing constructor parameter.
-
-  cc = new C<String>#n;
-  o = cc("foo");
-  Expect.equals("String", "${o.f1.runtimeType}");
-  o = cc();
-  Expect.equals(null, o.f1);
-
-  cc = o.listMaker();
-  Expect.isTrue(cc is Function);
-  var l = cc();
-  Expect.equals("List<String>", "${l.runtimeType}");
-}
-
-main() {
-  testA();
-  testC();
-  testP();
-  testMalformed();
-}
diff --git a/pkg/dev_compiler/test/codegen/lib/collection/list_test.dart b/pkg/dev_compiler/test/codegen/lib/collection/list_test.dart
deleted file mode 100644
index 76cd515..0000000
--- a/pkg/dev_compiler/test/codegen/lib/collection/list_test.dart
+++ /dev/null
@@ -1,40 +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.
-
-import 'dart:collection';
-import "package:expect/expect.dart";
-
-class MyList<E> extends Object with ListMixin<E> implements List<E> {
-  List<E> _list;
-
-  MyList(List<E> this._list);
-
-  int get length => _list.length;
-
-  void set length(int x) {
-    _list.length = x;
-  }
-
-  E operator[](int idx) => _list[idx];
-
-  void operator[]=(int idx, E value) {
-    _list[idx] = value;
-  }
-}
-
-void testRetainWhere() {
-  List<int> list = <int>[1, 2, 3];
-  list.retainWhere((x) => x % 2 == 0);
-  Expect.equals(1, list.length);
-  Expect.equals(2, list.first);
-
-  list = new MyList<int>([1, 2, 3]);
-  list.retainWhere((x) => x % 2 == 0);
-  Expect.equals(1, list.length);
-  Expect.equals(2, list.first);
-}
-
-void main() {
-  testRetainWhere();
-}
diff --git a/pkg/dev_compiler/test/codegen/single_test.html b/pkg/dev_compiler/test/codegen/single_test.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pkg/dev_compiler/test/codegen/single_test.html
diff --git a/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js b/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js
index 48a5eb6..d303d7d 100644
--- a/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js
+++ b/pkg/dev_compiler/test/codegen_expected/BenchmarkBase.js
@@ -4,7 +4,7 @@
   const dart = dart_sdk.dart;
   const dartx = dart_sdk.dartx;
   const BenchmarkBase$ = Object.create(null);
-  let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+  let VoidToNull = () => (VoidToNull = dart.constFn(dart.definiteFunctionType(core.Null, [])))();
   BenchmarkBase$.Expect = class Expect extends core.Object {
     static equals(expected, actual) {
       if (!dart.equals(expected, actual)) {
@@ -63,10 +63,10 @@
       this.setup();
       BenchmarkBase$.BenchmarkBase.measureFor(dart.fn(() => {
         this.warmup();
-      }, VoidTodynamic()), 100);
+      }, VoidToNull()), 100);
       let result = BenchmarkBase$.BenchmarkBase.measureFor(dart.fn(() => {
         this.exercise();
-      }, VoidTodynamic()), 2000);
+      }, VoidToNull()), 2000);
       this.teardown();
       return result;
     }
diff --git a/pkg/dev_compiler/test/codegen_expected/closure.js b/pkg/dev_compiler/test/codegen_expected/closure.js
index 698b90f..3db08c0 100644
--- a/pkg/dev_compiler/test/codegen_expected/closure.js
+++ b/pkg/dev_compiler/test/codegen_expected/closure.js
@@ -10,7 +10,7 @@
 let Foo = () => (Foo = dart.constFn(closure.Foo$()))();
 let ListOfTAndTToListOfT = () => (ListOfTAndTToListOfT = dart.constFn(dart.definiteFunctionType(T => [core.List$(T), [core.List$(T), T]])))();
 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic])))();
-let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+let VoidToNull = () => (VoidToNull = dart.constFn(dart.definiteFunctionType(core.Null, [])))();
 closure.generic_function = function(T) {
   return (items: core.List<T>, seed: T): core.List<T> => {
     let strings = items[dartx.map](core.String)(dart.fn((i: T): string => dart.str`${i}`, dart.definiteFunctionType(core.String, [T])))[dartx.toList]();
@@ -119,9 +119,9 @@
 dart.fn(closure.main, dynamicTovoid());
 dart.defineLazy(closure, {
   get closure() {
-    return dart.fn(() => {
+    return dart.fn((): core.Null => {
       return;
-    }, VoidTodynamic());
+    }, VoidToNull());
   },
   set closure(_) {}
 });
diff --git a/pkg/dev_compiler/test/codegen_test.dart b/pkg/dev_compiler/test/codegen_test.dart
index 4df5f64..2e1d7be 100644
--- a/pkg/dev_compiler/test/codegen_test.dart
+++ b/pkg/dev_compiler/test/codegen_test.dart
@@ -20,11 +20,12 @@
         StringLiteral,
         UriBasedDirective,
         parseDirectives;
+import 'package:analyzer/src/command_line/arguments.dart'
+    show defineAnalysisArguments;
 import 'package:analyzer/src/dart/ast/ast.dart';
 import 'package:analyzer/src/generated/source.dart' show Source;
 import 'package:args/args.dart' show ArgParser, ArgResults;
-import 'package:dev_compiler/src/analyzer/context.dart'
-    show AnalyzerOptions, parseDeclaredVariables;
+import 'package:dev_compiler/src/analyzer/context.dart';
 import 'package:dev_compiler/src/compiler/compiler.dart'
     show BuildUnit, CompilerOptions, JSModuleFile, ModuleCompiler;
 import 'package:dev_compiler/src/compiler/module_builder.dart'
@@ -78,7 +79,7 @@
       .where((p) => p.endsWith('.sum'))
       .toList();
 
-  var sharedCompiler = new ModuleCompiler(new AnalyzerOptions(
+  var sharedCompiler = new ModuleCompiler(new AnalyzerOptions.basic(
       dartSdkSummaryPath: sdkSummaryFile, summaryPaths: summaryPaths));
 
   var testDirs = [
@@ -88,9 +89,6 @@
     path.join('lib', 'collection'),
     path.join('lib', 'convert'),
     path.join('lib', 'html'),
-    // TODO(vsm): Fix these - they import files from a different directory
-    // - this triggers an invalid library root build error.
-    // path.join('lib', 'html', 'custom'),
     path.join('lib', 'math'),
     path.join('lib', 'mirrors'),
     path.join('lib', 'typed_data'),
@@ -103,6 +101,8 @@
   // Our default compiler options. Individual tests can override these.
   var defaultOptions = ['--no-source-map', '--no-summarize'];
   var compileArgParser = new ArgParser();
+  defineAnalysisArguments(compileArgParser, ddc: true);
+  AnalyzerOptions.addArguments(compileArgParser);
   CompilerOptions.addArguments(compileArgParser);
   addModuleFormatOptions(compileArgParser);
 
@@ -137,10 +137,12 @@
         args.addAll(matchedArgs.where((s) => !ignoreOptions.contains(s)));
       }
 
-      var declaredVars = <String, String>{};
-      var argResults =
-          compileArgParser.parse(parseDeclaredVariables(args, declaredVars));
+      ArgResults argResults = compileArgParser.parse(args);
+      var analyzerOptions = new AnalyzerOptions.fromArguments(argResults,
+          dartSdkSummaryPath: sdkSummaryFile, summaryPaths: summaryPaths);
+
       var options = new CompilerOptions.fromArguments(argResults);
+
       var moduleFormat = parseModuleFormatOption(argResults).first;
 
       // Collect any other files we've imported.
@@ -150,25 +152,37 @@
           name, path.dirname(testFile), files.toList(), _moduleForLibrary);
 
       var compiler = sharedCompiler;
-      if (declaredVars.isNotEmpty) {
-        compiler = new ModuleCompiler(new AnalyzerOptions(
-            dartSdkSummaryPath: sdkSummaryFile,
-            summaryPaths: summaryPaths,
-            declaredVariables: declaredVars));
+      if (analyzerOptions.declaredVariables.isNotEmpty) {
+        compiler = new ModuleCompiler(analyzerOptions);
       }
-      var module = compiler.compile(unit, options);
+      JSModuleFile module = null;
+      var error, trace;
+      try {
+        module = compiler.compile(unit, options);
+      } catch (e, t) {
+        error = e;
+        trace = t;
+      }
 
       bool notStrong = notYetStrongTests.contains(name);
-      if (module.isValid) {
+      bool crashing = _crashingTests.contains(name);
+
+      if (module == null) {
+        expect(crashing, isTrue,
+            reason: "test $name crashes during compilation.\n\n"
+                "Exception: $error\n\nStack trace:\n\n$trace");
+      } else if (module.isValid) {
         _writeModule(
             path.join(codegenOutputDir, name),
             isTopLevelTest ? path.join(codegenExpectDir, name) : null,
             moduleFormat,
             module);
 
+        expect(crashing, isFalse, reason: "test $name no longer crashes.");
         expect(notStrong, isFalse,
             reason: "test $name expected strong mode errors, but compiled.");
       } else {
+        expect(crashing, isFalse, reason: "test $name no longer crashes.");
         expect(notStrong, isTrue,
             reason: "test $name failed to compile due to strong mode errors:"
                 "\n\n${module.errors.join('\n')}.");
@@ -244,10 +258,16 @@
   var testFiles = <String>[];
 
   for (var testDir in testDirs) {
-    for (var file
-        in _listFiles(path.join(codegenDir, testDir), recursive: false)) {
-      var relativePath = path.relative(file, from: codegenDir);
-      var outputPath = path.join(codegenTestDir, relativePath);
+    // Look for the tests in the "_strong" directories in the SDK's main
+    // "tests" directory.
+    var dirParts = path.split(testDir);
+    var sdkTestDir =
+        path.join(dirParts[0] + "_strong", path.joinAll(dirParts.skip(1)));
+    var inputPath = path.join(testDirectory, '../../../tests/', sdkTestDir);
+
+    for (var file in _listFiles(inputPath, recursive: true)) {
+      var relativePath = path.relative(file, from: inputPath);
+      var outputPath = path.join(codegenTestDir, testDir, relativePath);
 
       _ensureDirectory(path.dirname(outputPath));
 
@@ -357,3 +377,29 @@
       ? uriContent
       : null;
 }
+
+final _crashingTests = new Set<String>.from([
+  'language/mixin_illegal_syntax_test_none_multi',
+  'language/mixin_illegal_syntax_test_01_multi',
+  'language/mixin_illegal_syntax_test_02_multi',
+  'language/mixin_illegal_syntax_test_03_multi',
+  'language/mixin_illegal_syntax_test_04_multi',
+  'language/mixin_illegal_syntax_test_05_multi',
+  'language/mixin_illegal_syntax_test_06_multi',
+  'language/mixin_illegal_syntax_test_07_multi',
+  'language/mixin_illegal_syntax_test_08_multi',
+  'language/mixin_illegal_syntax_test_09_multi',
+  'language/mixin_illegal_syntax_test_10_multi',
+  'language/mixin_illegal_syntax_test_11_multi',
+  'language/mixin_illegal_syntax_test_12_multi',
+  'language/mixin_illegal_syntax_test_13_multi',
+  'language/mixin_illegal_syntax_test_14_multi',
+
+  // TODO(vsm): Fix these - they import files from a different directory
+  // - this triggers an invalid library root build error.
+  'lib/html/custom/attribute_changed_callback_test',
+  'lib/html/custom/entered_left_view_test',
+  'lib/html/custom/js_custom_test',
+  'lib/html/custom/mirrors_test',
+  'lib/html/custom/regress_194523002_test',
+]);
diff --git a/pkg/dev_compiler/test/not_yet_strong_tests.dart b/pkg/dev_compiler/test/not_yet_strong_tests.dart
index 0769af7..715f099 100644
--- a/pkg/dev_compiler/test/not_yet_strong_tests.dart
+++ b/pkg/dev_compiler/test/not_yet_strong_tests.dart
@@ -517,7 +517,6 @@
   'language/cyclic_class_member_test_01_multi',
   'language/cyclic_constructor_test_01_multi',
   'language/cyclic_default_values_test',
-  'language/cyclic_import_test',
   'language/cyclic_type_variable_test_01_multi',
   'language/cyclic_type_variable_test_02_multi',
   'language/cyclic_type_variable_test_03_multi',
@@ -666,7 +665,6 @@
   'language/field_override_test_01_multi',
   'language/field_override_test_02_multi',
   'language/field_override_test_none_multi',
-  'language/field_test',
   'language/field_type_check_test_01_multi',
   'language/final_field_initialization_order_test',
   'language/final_for_in_variable_test_01_multi',
@@ -1349,12 +1347,10 @@
   'language/override_inheritance_field_test_33_multi',
   'language/override_inheritance_field_test_33a_multi',
   'language/override_inheritance_field_test_34_multi',
-  'language/override_inheritance_field_test_41_multi',
   'language/override_inheritance_field_test_42_multi',
   'language/override_inheritance_field_test_43_multi',
   'language/override_inheritance_field_test_44_multi',
   'language/override_inheritance_field_test_45_multi',
-  'language/override_inheritance_field_test_46_multi',
   'language/override_inheritance_field_test_47_multi',
   'language/override_inheritance_field_test_48_multi',
   'language/override_inheritance_field_test_49_multi',
@@ -1483,12 +1479,12 @@
   'language/regress_22936_test_01_multi',
   'language/regress_23038_test_01_multi',
   'language/regress_23051_test_01_multi',
+  'language/regress_23089_test', // issue 28450
   'language/regress_23408_test',
   'language/return_type_test',
   'language/rewrite_implicit_this_test_01_multi',
   'language/scope_variable_test_01_multi',
   'language/setter_no_getter_call_test_01_multi',
-  'language/setter_override2_test_00_multi',
   'language/setter_override_test_00_multi',
   'language/setter_override_test_01_multi',
   'language/setter_override_test_02_multi',
@@ -1760,10 +1756,8 @@
   'language/type_promotion_closure_test_02_multi',
   'language/type_promotion_closure_test_03_multi',
   'language/type_promotion_closure_test_04_multi',
-  'language/type_promotion_closure_test_05_multi',
   'language/type_promotion_closure_test_06_multi',
   'language/type_promotion_closure_test_07_multi',
-  'language/type_promotion_closure_test_08_multi',
   'language/type_promotion_closure_test_09_multi',
   'language/type_promotion_closure_test_10_multi',
   'language/type_promotion_closure_test_11_multi',
@@ -1772,7 +1766,6 @@
   'language/type_promotion_closure_test_14_multi',
   'language/type_promotion_closure_test_15_multi',
   'language/type_promotion_closure_test_16_multi',
-  'language/type_promotion_closure_test_none_multi',
   'language/type_promotion_functions_test_01_multi',
   'language/type_promotion_functions_test_02_multi',
   'language/type_promotion_functions_test_03_multi',
@@ -2137,7 +2130,6 @@
   'lib/mirrors/initializing_formals_test_none_multi',
   'lib/mirrors/instance_members_easier_test',
   'lib/mirrors/instance_members_test',
-  'lib/mirrors/instance_members_with_override_test',
   'lib/mirrors/intercepted_class_test',
   'lib/mirrors/intercepted_object_test',
   'lib/mirrors/invoke_call_through_getter_previously_accessed_test_named_multi',
@@ -2161,7 +2153,6 @@
   'lib/mirrors/library_imports_prefixed_test',
   'lib/mirrors/library_imports_shown_test',
   'lib/mirrors/library_metadata2_test_01_multi',
-  'lib/mirrors/library_uri_io_test',
   'lib/mirrors/load_library_test',
   'lib/mirrors/metadata_allowed_values_test_01_multi',
   'lib/mirrors/metadata_allowed_values_test_02_multi',
@@ -2274,7 +2265,6 @@
   'language/body_less_constructor_wrong_arg_negative_test',
   'language/bound_closure_equality_test',
   'language/call_test',
-  'language/closure_with_super_field_test',
   'language/const_counter_negative_test',
   'language/const_map4_test',
   'language/const_optional_args_negative_test',
@@ -2304,9 +2294,8 @@
   'language/function_type_parameter2_negative_test',
   'language/function_type_parameter_negative_test',
   'language/getter_declaration_negative_test',
-  'language/getter_override2_test_00_multi',
-  'language/getters_setters_test',
   'language/import_combinators_negative_test',
+  'language/initializing_formal_type_test',
   'language/inst_field_initializer1_negative_test',
   'language/instance_call_wrong_argument_count_negative_test',
   'language/instance_method2_negative_test',
@@ -2382,8 +2371,6 @@
   'language/string_unicode2_negative_test',
   'language/string_unicode3_negative_test',
   'language/string_unicode4_negative_test',
-  'language/super_field_2_test',
-  'language/super_field_test',
   'language/switch1_negative_test',
   'language/switch3_negative_test',
   'language/switch4_negative_test',
@@ -2409,6 +2396,11 @@
   'lib/convert/chunked_conversion_utf8_test',
   'lib/convert/line_splitter_test',
   'lib/html/cross_frame_test',
+  'lib/html/custom/constructor_calls_created_synchronously_test',
+  'lib/html/custom/created_callback_test',
+  'lib/html/custom/document_register_basic_test',
+  'lib/html/custom/document_register_type_extensions_test',
+  'lib/html/custom/element_upgrade_test',
   'lib/html/element_test',
   'lib/html/events_test',
   'lib/html/fileapi_test',
diff --git a/pkg/dev_compiler/test/options/analysis_options.yaml b/pkg/dev_compiler/test/options/analysis_options.yaml
new file mode 100644
index 0000000..983e534
--- /dev/null
+++ b/pkg/dev_compiler/test/options/analysis_options.yaml
@@ -0,0 +1,4 @@
+analyzer:
+  strong-mode: true
+  errors:
+    undefined_class: ignore
diff --git a/pkg/dev_compiler/test/options/analysis_options_2.yaml b/pkg/dev_compiler/test/options/analysis_options_2.yaml
new file mode 100644
index 0000000..d91a15a
--- /dev/null
+++ b/pkg/dev_compiler/test/options/analysis_options_2.yaml
@@ -0,0 +1,4 @@
+analyzer:
+  strong-mode: true
+  errors:
+    duplicate_definition: ignore
diff --git a/pkg/dev_compiler/test/options/options_test.dart b/pkg/dev_compiler/test/options/options_test.dart
new file mode 100644
index 0000000..5fff692
--- /dev/null
+++ b/pkg/dev_compiler/test/options/options_test.dart
@@ -0,0 +1,82 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:io';
+import 'package:analyzer/analyzer.dart';
+import 'package:analyzer/src/command_line/arguments.dart';
+import 'package:analyzer/src/summary/summary_sdk.dart';
+import 'package:path/path.dart' as path;
+import 'package:test/test.dart';
+
+import '../../lib/src/analyzer/context.dart';
+import '../../lib/src/compiler/command.dart';
+import '../../lib/src/compiler/compiler.dart';
+import '../testing.dart' show repoDirectory, testDirectory;
+
+/// The `test/options` directory.
+final optionsDir = path.join(testDirectory, 'options');
+
+/// Summary file for testing.
+final sdkSummaryFile = path.join(repoDirectory, 'lib', 'sdk', 'ddc_sdk.sum');
+
+final sdkSummaryArgs = ['--$sdkSummaryPathOption', sdkSummaryFile];
+
+main() {
+  test('basic', () {
+    var options = new AnalyzerOptions.basic();
+    var compiler = new ModuleCompiler(options, analysisRoot: optionsDir);
+    var processors = compiler.context.analysisOptions.errorProcessors;
+    expect(processors, hasLength(1));
+    expect(processors[0].code, CompileTimeErrorCode.UNDEFINED_CLASS.name);
+  });
+
+  test('basic sdk summary', () {
+    expect(new File(sdkSummaryFile).existsSync(), isTrue);
+    var options = new AnalyzerOptions.basic(dartSdkSummaryPath: sdkSummaryFile);
+    var compiler = new ModuleCompiler(options, analysisRoot: optionsDir);
+    var context = compiler.context;
+    var sdk = context.sourceFactory.dartSdk;
+    expect(sdk, new isInstanceOf<SummaryBasedDartSdk>());
+    var processors = context.analysisOptions.errorProcessors;
+    expect(processors, hasLength(1));
+    expect(processors[0].code, CompileTimeErrorCode.UNDEFINED_CLASS.name);
+  });
+
+  test('fromArgs', () {
+    var args = <String>[];
+    //TODO(danrubel) remove sdkSummaryArgs once all SDKs have summary file
+    args.addAll(sdkSummaryArgs);
+    var argResults = ddcArgParser().parse(args);
+    var options = new AnalyzerOptions.fromArguments(argResults);
+    var compiler = new ModuleCompiler(options, analysisRoot: optionsDir);
+    var processors = compiler.context.analysisOptions.errorProcessors;
+    expect(processors, hasLength(1));
+    expect(processors[0].code, CompileTimeErrorCode.UNDEFINED_CLASS.name);
+  });
+
+  test('fromArgs options file 2', () {
+    var optionsFile2 = path.join(optionsDir, 'analysis_options_2.yaml');
+    expect(new File(optionsFile2).existsSync(), isTrue);
+    var args = <String>['--$analysisOptionsFileOption', optionsFile2];
+    //TODO(danrubel) remove sdkSummaryArgs once all SDKs have summary file
+    args.addAll(sdkSummaryArgs);
+    var argResults = ddcArgParser().parse(args);
+    var options = new AnalyzerOptions.fromArguments(argResults);
+    var compiler = new ModuleCompiler(options, analysisRoot: optionsDir);
+    var processors = compiler.context.analysisOptions.errorProcessors;
+    expect(processors, hasLength(1));
+    expect(processors[0].code, CompileTimeErrorCode.DUPLICATE_DEFINITION.name);
+  });
+
+  test('fromArgs options flag', () {
+    var args = <String>['--$enableStrictCallChecksFlag'];
+    //TODO(danrubel) remove sdkSummaryArgs once all SDKs have summary file
+    args.addAll(sdkSummaryArgs);
+    var argResults = ddcArgParser().parse(args);
+    var options = new AnalyzerOptions.fromArguments(argResults);
+    var compiler = new ModuleCompiler(options, analysisRoot: optionsDir);
+    var analysisOptions = compiler.context.analysisOptions;
+    expect(analysisOptions.enableStrictCallChecks, isTrue);
+  });
+}
diff --git a/pkg/dev_compiler/test/worker/worker_test.dart b/pkg/dev_compiler/test/worker/worker_test.dart
index daa1841..7f2aa11 100644
--- a/pkg/dev_compiler/test/worker/worker_test.dart
+++ b/pkg/dev_compiler/test/worker/worker_test.dart
@@ -44,7 +44,7 @@
 
     test('can compile in worker mode', () async {
       var args = executableArgs.toList()..add('--persistent_worker');
-      var process = await Process.start('dart', args);
+      var process = await Process.start(Platform.executable, args);
       var messageGrouper = new AsyncMessageGrouper(process.stdout);
 
       var request = new WorkRequest();
@@ -76,7 +76,33 @@
 
     test('can compile in basic mode', () {
       var args = executableArgs.toList()..addAll(compilerArgs);
-      var result = Process.runSync('dart', args);
+      var result = Process.runSync(Platform.executable, args);
+
+      expect(result.exitCode, EXIT_CODE_OK);
+      expect(result.stdout, isEmpty);
+      expect(result.stderr, isEmpty);
+      expect(outputJsFile.existsSync(), isTrue);
+    });
+
+    test('unknown options', () {
+      var args = new List<String>.from(executableArgs)
+        ..add('--does-not-exist')
+        ..addAll(compilerArgs);
+      var result = Process.runSync(Platform.executable, args);
+
+      expect(result.exitCode, 64);
+      expect(result.stdout,
+          contains('Could not find an option named "does-not-exist"'));
+      expect(result.stderr, isEmpty);
+      expect(outputJsFile.existsSync(), isFalse);
+    });
+
+    test('unknown options ignored', () {
+      var args = new List<String>.from(executableArgs)
+        ..add('--does-not-exist')
+        ..add('--ignore-unrecognized-flags')
+        ..addAll(compilerArgs);
+      var result = Process.runSync(Platform.executable, args);
 
       expect(result.exitCode, EXIT_CODE_OK);
       expect(result.stdout, isEmpty);
@@ -88,7 +114,7 @@
       argsFile.createSync();
       argsFile.writeAsStringSync(compilerArgs.join('\n'));
       var args = executableArgs.toList()..add('@${argsFile.path}');
-      var process = await Process.start('dart', args);
+      var process = await Process.start(Platform.executable, args);
       stderr.addStream(process.stderr);
       var futureProcessOutput = process.stdout.map(UTF8.decode).toList();
 
@@ -122,7 +148,7 @@
 
     test('can compile in basic mode', () {
       final dartSdkSummary = new File('lib/sdk/ddc_sdk.sum').absolute;
-      var result = Process.runSync('dart', [
+      var result = Process.runSync(Platform.executable, [
         'bin/dartdevc.dart',
         '--summary-extension=api.ds',
         '--no-source-map',
@@ -138,7 +164,7 @@
       expect(greetingJS.existsSync(), isTrue);
       expect(greetingSummary.existsSync(), isTrue);
 
-      result = Process.runSync('dart', [
+      result = Process.runSync(Platform.executable, [
         'bin/dartdevc.dart',
         '--no-source-map',
         '--no-summarize',
@@ -169,7 +195,12 @@
     });
 
     test('incorrect usage', () {
-      var result = Process.runSync('dart', ['bin/dartdevc.dart', '--dart-sdk-summary', dartSdkSummary.path, 'oops',]);
+      var result = Process.runSync(Platform.executable, [
+        'bin/dartdevc.dart',
+        '--dart-sdk-summary',
+        dartSdkSummary.path,
+        'oops',
+      ]);
       expect(result.exitCode, 64);
       expect(
           result.stdout, contains('Please include the output file location.'));
@@ -178,7 +209,7 @@
 
     test('compile errors', () {
       badFileDart.writeAsStringSync('main() => "hello world"');
-      var result = Process.runSync('dart', [
+      var result = Process.runSync(Platform.executable, [
         'bin/dartdevc.dart',
         '--no-source-map',
         '--dart-sdk-summary',
@@ -214,7 +245,7 @@
     });
 
     test('works if part and library supplied', () {
-      var result = Process.runSync('dart', [
+      var result = Process.runSync(Platform.executable, [
         'bin/dartdevc.dart',
         '--no-summarize',
         '--no-source-map',
@@ -232,7 +263,7 @@
     });
 
     test('works if part is not supplied', () {
-      var result = Process.runSync('dart', [
+      var result = Process.runSync(Platform.executable, [
         'bin/dartdevc.dart',
         '--no-summarize',
         '--no-source-map',
@@ -249,7 +280,7 @@
     });
 
     test('part without library is silently ignored', () {
-      var result = Process.runSync('dart', [
+      var result = Process.runSync(Platform.executable, [
         'bin/dartdevc.dart',
         '--no-summarize',
         '--no-source-map',
diff --git a/pkg/dev_compiler/tool/build_sdk.dart b/pkg/dev_compiler/tool/build_sdk.dart
index 1b2b2cc..9761f1d 100644
--- a/pkg/dev_compiler/tool/build_sdk.dart
+++ b/pkg/dev_compiler/tool/build_sdk.dart
@@ -9,6 +9,8 @@
 /// command line interface. But being able to build from a Dart library means
 /// we can call this during code coverage to get more realistic numbers.
 
+import 'dart:io';
+
 import 'package:dev_compiler/src/compiler/command.dart';
 
 main(List<String> arguments) {
@@ -36,6 +38,7 @@
     'dart:convert',
     'dart:core',
     'dart:developer',
+    'dart:io',
     'dart:isolate',
     'dart:js',
     'dart:js_util',
@@ -50,5 +53,7 @@
     'dart:web_gl',
     'dart:web_sql'
   ]);
-  compile(args);
+
+  var result = compile(args);
+  exit(result);
 }
diff --git a/pkg/dev_compiler/tool/build_sdk.sh b/pkg/dev_compiler/tool/build_sdk.sh
index 561f5c4..bcda0af 100755
--- a/pkg/dev_compiler/tool/build_sdk.sh
+++ b/pkg/dev_compiler/tool/build_sdk.sh
@@ -9,7 +9,8 @@
 echo "*** Compiling SDK to JavaScript"
 
 # TODO(jmesserly): break out dart:html & friends.
-dart -c tool/build_sdk.dart \
+{ # Try
+  dart -c tool/build_sdk.dart \
     --dart-sdk gen/patched_sdk \
     --dart-sdk-summary=build \
     --summary-out lib/sdk/ddc_sdk.sum \
@@ -22,3 +23,8 @@
     --modules=legacy \
     -o lib/js/legacy/dart_sdk.js \
     "$@" > tool/sdk_expected_errors.txt
+} || { # Catch
+  # Show errors if the sdk didn't compile.
+  cat tool/sdk_expected_errors.txt
+  exit 1
+}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/future.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/future.dart
index 815f526..49b2460 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/future.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/async/future.dart
@@ -4,6 +4,46 @@
 
 part of dart.async;
 
+/// A type representing values that are either `Future<T>` or `T`.
+///
+/// This class declaration is a public stand-in for an internal
+/// future-or-value generic type. References to this class are resolved to the
+/// internal type.
+///
+/// It is a compile-time error for any class to extend, mix in or implement
+/// `FutureOr`.
+///
+/// Note: the `FutureOr<T>` type is interpreted as `dynamic` in non strong-mode.
+///
+/// # Examples
+/// ``` dart
+/// // The `Future<T>.then` function takes a callback [f] that returns either
+/// // an `S` or a `Future<S>`.
+/// Future<S> then<S>(FutureOr<S> f(T x), ...);
+///
+/// // `Completer<T>.complete` takes either a `T` or `Future<T>`.
+/// void complete(FutureOr<T> value);
+/// ```
+///
+/// # Advanced
+/// The `FutureOr<int>` type is actually the "type union" of the types `int` and
+/// `Future<int>`. This type union is defined in such a way that
+/// `FutureOr<Object>` is both a super- and sub-type of `Object` (sub-type
+/// because `Object` is one of the types of the union, super-type because
+/// `Object` is a super-type of both of the types of the union). Together it
+/// means that `FutureOr<Object>` is equivalent to `Object`.
+///
+/// As a corollary, `FutureOr<Object>` is equivalent to
+/// `FutureOr<FutureOr<Object>>`, `FutureOr<Future<Object>> is equivalent to
+/// `Future<Object>`.
+abstract class FutureOr<T> {
+  // Private constructor, so that it is not subclassable, mixable, or
+  // instantiable.
+  FutureOr._() {
+    throw new UnsupportedError("FutureOr can't be instantiated");
+  }
+}
+
 /**
  * An object representing a delayed computation.
  *
@@ -225,7 +265,7 @@
     _Future<T> result = new _Future<T>();
     new Timer(duration, () {
       try {
-        result._complete(computation == null ? null : computation());
+        result._complete(computation?.call());
       } catch (e, s) {
         _completeWithErrorCallback(result, e, s);
       }
@@ -254,11 +294,11 @@
    * The call to `cleanUp` should not throw. If it does, the error will be an
    * uncaught asynchronous error.
    */
-  static Future<List/*<T>*/> wait/*<T>*/(Iterable<Future/*<T>*/> futures,
+  static Future<List<T>> wait<T>(Iterable<Future<T>> futures,
                            {bool eagerError: false,
-                            void cleanUp(/*=T*/ successValue)}) {
-    final _Future<List/*<T>*/> result = new _Future<List/*<T>*/>();
-    List/*<T>*/ values;  // Collects the values. Set to null on error.
+                            void cleanUp(T successValue)}) {
+    final _Future<List<T>> result = new _Future<List<T>>();
+    List<T> values;  // Collects the values. Set to null on error.
     int remaining = 0;  // How many futures are we waiting for.
     var error;   // The first error from a future.
     StackTrace stackTrace;  // The stackTrace that came with the error.
@@ -287,32 +327,56 @@
       }
     }
 
-    // As each future completes, put its value into the corresponding
-    // position in the list of values.
-    for (Future future in futures) {
-      int pos = remaining++;
-      future.then((Object/*=T*/ value) {
-        remaining--;
-        if (values != null) {
-          values[pos] = value;
-          if (remaining == 0) {
-            result._completeWithValue(values);
+    try {
+      // As each future completes, put its value into the corresponding
+      // position in the list of values.
+      for (Future future in futures) {
+        int pos = remaining;
+        future.then((T value) {
+          remaining--;
+          if (values != null) {
+            values[pos] = value;
+            if (remaining == 0) {
+              result._completeWithValue(values);
+            }
+          } else {
+            if (cleanUp != null && value != null) {
+              // Ensure errors from cleanUp are uncaught.
+              new Future.sync(() { cleanUp(value); });
+            }
+            if (remaining == 0 && !eagerError) {
+              result._completeError(error, stackTrace);
+            }
           }
-        } else {
-          if (cleanUp != null && value != null) {
-            // Ensure errors from cleanUp are uncaught.
-            new Future.sync(() { cleanUp(value); });
-          }
-          if (remaining == 0 && !eagerError) {
-            result._completeError(error, stackTrace);
-          }
-        }
-      }, onError: handleError);
+        }, onError: handleError);
+        // Increment the 'remaining' after the call to 'then'.
+        // If that call throws, we don't expect any future callback from
+        // the future, and we also don't increment remaining.
+        remaining++;
+      }
+      if (remaining == 0) {
+        return new Future.value(const []);
+      }
+      values = new List<T>(remaining);
+    } catch (e, st) {
+      // The error must have been thrown while iterating over the futures
+      // list, or while installing a callback handler on the future.
+      if (remaining == 0 || eagerError) {
+        // Throw a new Future.error.
+        // Don't just call `result._completeError` since that would propagate
+        // the error too eagerly, not giving the callers time to install
+        // error handlers.
+        // Also, don't use `_asyncCompleteError` since that one doesn't give
+        // zones the chance to intercept the error.
+        return new Future.error(e, st);
+      } else {
+        // Don't allocate a list for values, thus indicating that there was an
+        // error.
+        // Set error to the caught exception.
+        error = e;
+        stackTrace = st;
+      }
     }
-    if (remaining == 0) {
-      return new Future.value(const []);
-    }
-    values = new List/*<T>*/(remaining);
     return result;
   }
 
@@ -326,9 +390,9 @@
    * If [futures] is empty, or if none of its futures complete,
    * the returned future never completes.
    */
-  static Future/*<T>*/ any/*<T>*/(Iterable<Future/*<T>*/> futures) {
-    var completer = new Completer/*<T>*/.sync();
-    var onValue = (/*=T*/ value) {
+  static Future<T> any<T>(Iterable<Future<T>> futures) {
+    var completer = new Completer<T>.sync();
+    var onValue = (T value) {
       if (!completer.isCompleted) completer.complete(value);
     };
     var onError = (error, stack) {
@@ -363,18 +427,19 @@
   }
 
   /**
-   * Perform an async operation repeatedly until it returns `false`.
+   * Performs an async operation repeatedly until it returns `false`.
    *
-   * Runs [f] repeatedly, starting the next iteration only when the [Future]
-   * returned by [f] completes to `true`. Returns a [Future] that completes once
-   * [f] returns `false`.
+   * The function [f] is called repeatedly while it returns either the [bool]
+   * value `true` or a [Future] which completes with the value `true`.
    *
-   * The return values of all [Future]s are discarded. Any errors will cause the
-   * iteration to stop and will be piped through the returned [Future].
+   * If a call to [f] returns `false` or a [Future] that completes to `false`,
+   * iteration ends and the future returned by [doWhile] is completed.
    *
-   * The function [f] may return either a [bool] or a [Future] that completes to
-   * a [bool]. If it returns a non-[Future], iteration continues immediately.
-   * Otherwise it waits for the returned [Future] to complete.
+   * If a future returned by [f] completes with an error, iteration ends and
+   * the future returned by [doWhile] completes with the same error.
+   *
+   * The [f] function must return either a `bool` value or a [Future] completing
+   * with a `bool` value.
    */
   static Future doWhile(f()) {
     _Future doneSignal = new _Future();
@@ -432,7 +497,7 @@
    * with a `test` parameter, instead of handling both value and error in a
    * single [then] call.
    */
-  Future/*<S>*/ then/*<S>*/(onValue(T value), { Function onError });
+  Future<S> then<S>(FutureOr<S> onValue(T value), { Function onError });
 
   /**
    * Handles errors emitted by this [Future].
@@ -495,7 +560,7 @@
   // `isCheck` we should also expect functions that take a specific argument.
   // Note: making `catchError` return a `Future<T>` in non-strong mode could be
   // a breaking change.
-  Future/*<T>*/ catchError(Function onError,
+  Future<T> catchError(Function onError,
                            {bool test(Object error)});
 
   /**
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/future_impl.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/future_impl.dart
index eb4d6cf..4e6ba42 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/future_impl.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/async/future_impl.dart
@@ -128,14 +128,14 @@
   }
 
   dynamic/*T|Future<T>*/ handleValue(S sourceResult) {
-    return _zone.runUnary/*<dynamic/*T|Future<T>*/, S>*/(
+    return _zone.runUnary<dynamic/*T|Future<T>*/, S>(
         _onValue, sourceResult);
   }
 
   bool matchesErrorTest(AsyncError asyncError) {
     if (!hasErrorTest) return true;
     _FutureErrorTest test = _errorTest;
-    return _zone.runUnary/*<bool, dynamic>*/(_errorTest, asyncError.error);
+    return _zone.runUnary<bool, dynamic>(_errorTest, asyncError.error);
   }
 
   dynamic/*T|Future<T>*/ handleError(AsyncError asyncError) {
@@ -147,7 +147,7 @@
           asyncError.error,
           asyncError.stackTrace);
     } else {
-      return _zone.runUnary/*<dynamic/*T|Future<T>*/, dynamic>*/(
+      return _zone.runUnary<dynamic/*T|Future<T>*/, dynamic>(
           errorCallback, asyncError.error);
     }
   }
@@ -230,33 +230,33 @@
     _resultOrListeners = source;
   }
 
-  Future/*<E>*/ then/*<E>*/(
-      /*=dynamic/*E|Future<E>*/*/ f(T value), { Function onError }) {
+  Future<E> then<E>(
+      FutureOr<E> f(T value), { Function onError }) {
     Zone currentZone = Zone.current;
     ZoneUnaryCallback registered;
     if (!identical(currentZone, _ROOT_ZONE)) {
-      f = currentZone.registerUnaryCallback/*<dynamic, T>*/(f);
+      f = currentZone.registerUnaryCallback<FutureOr<E>, T>(f);
       if (onError != null) {
-        onError = _registerErrorHandler/*<T>*/(onError, currentZone);
+        onError = _registerErrorHandler<T>(onError, currentZone);
       }
     }
-    return _thenNoZoneRegistration/*<E>*/(f, onError);
+    return _thenNoZoneRegistration<E>(f, onError);
   }
 
   // This method is used by async/await.
-  Future/*<E>*/ _thenNoZoneRegistration/*<E>*/(f(T value), Function onError) {
-    _Future/*<E>*/ result = new _Future/*<E>*/();
-    _addListener(new _FutureListener/*<T, E>*/.then(result, f, onError));
+  Future<E> _thenNoZoneRegistration<E>(f(T value), Function onError) {
+    _Future<E> result = new _Future<E>();
+    _addListener(new _FutureListener<T, E>.then(result, f, onError));
     return result;
   }
 
-  Future/*<T>*/ catchError(Function onError, { bool test(error) }) {
-    _Future/*<T>*/ result = new _Future/*<T>*/();
+  Future<T> catchError(Function onError, { bool test(error) }) {
+    _Future<T> result = new _Future<T>();
     if (!identical(result._zone, _ROOT_ZONE)) {
-      onError = _registerErrorHandler/*<T>*/(onError, result._zone);
+      onError = _registerErrorHandler<T>(onError, result._zone);
       if (test != null) test = result._zone.registerUnaryCallback(test);
     }
-    _addListener(new _FutureListener/*<T, T>*/.catchError(
+    _addListener(new _FutureListener<T, T>.catchError(
         result, onError, test));
     return result;
   }
@@ -264,9 +264,9 @@
   Future<T> whenComplete(action()) {
     _Future<T> result = new _Future<T>();
     if (!identical(result._zone, _ROOT_ZONE)) {
-      action = result._zone.registerCallback/*<dynamic>*/(action);
+      action = result._zone.registerCallback<dynamic>(action);
     }
-    _addListener(new _FutureListener/*<T, T>*/.whenComplete(result, action));
+    _addListener(new _FutureListener<T, T>.whenComplete(result, action));
     return result;
   }
 
@@ -277,6 +277,11 @@
     _state = _PENDING_COMPLETE;
   }
 
+  void _clearPendingComplete() {
+    assert(_isPendingComplete);
+    _state = _INCOMPLETE;
+  }
+
   AsyncError get _error {
     assert(_hasError);
     return _resultOrListeners;
@@ -405,7 +410,11 @@
     try {
       source.then((value) {
           assert(target._isPendingComplete);
-          target._completeWithValue(value);
+          // The "value" may be another future if the foreign future
+          // implementation is mis-behaving,
+          // so use _complete instead of _completeWithValue.
+          target._clearPendingComplete();  // Clear this first, it's set again.
+          target._complete(value);
         },
         // TODO(floitsch): eventually we would like to make this non-optional
         // and dependent on the listeners of the target future. If none of
@@ -650,7 +659,7 @@
           }
         }
 
- 
+
         if (listener.handlesComplete) {
           handleWhenCompleteCallback();
         } else if (!hasError) {
@@ -662,7 +671,7 @@
             handleError();
           }
         }
-        
+
         // If we changed zone, oldZone will not be null.
         if (oldZone != null) Zone._leave(oldZone);
 
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_impl.dart b/pkg/dev_compiler/tool/input_sdk/lib/async/stream_impl.dart
index dffaa12..7099973 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/async/stream_impl.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/async/stream_impl.dart
@@ -401,7 +401,7 @@
    * during the call, and it checks for state changes after the call
    * that should cause further callbacks.
    */
-  void _guardCallback(callback) {
+  void _guardCallback(void callback()) {
     assert(!_inCallback);
     bool wasInputPaused = _isInputPaused;
     _state |= _STATE_IN_CALLBACK;
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/core/annotations.dart b/pkg/dev_compiler/tool/input_sdk/lib/core/annotations.dart
index 6a596c6..77211ab 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/core/annotations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/core/annotations.dart
@@ -137,7 +137,7 @@
  * so assigning it to a typed variable may fail in checked mode,
  * and testing it with the `is` operator
  * will only return true for types it actually implements or extends.
- * Accessing a member which isn't implemented by the classs
+ * Accessing a member which isn't implemented by the class
  * will cause the `noSuchMethod` method to be called normally,
  * the `@proxy` annotation merely states the intent to handle (some of) those
  * `noSuchMethod` calls gracefully.
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart b/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
index e103c7d..670e039 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/html/dart2js/html_dart2js.dart
@@ -1214,8 +1214,8 @@
     return _create_2(blobParts, bag);
   }
 
-  static _create_1(parts) => JS('Blob', 'new Blob(#)', parts);
-  static _create_2(parts, bag) => JS('Blob', 'new Blob(#, #)', parts, bag);
+  static _create_1(parts) => JS('Blob', 'new self.Blob(#)', parts);
+  static _create_2(parts, bag) => JS('Blob', 'new self.Blob(#, #)', parts, bag);
 
   static _create_bag() => JS('var', '{}');
   static _bag_set(bag, key, value) { JS('void', '#[#] = #', bag, key, value); }
@@ -36568,7 +36568,9 @@
   const _BeforeUnloadEventStreamProvider(this._eventType);
 
   Stream<BeforeUnloadEvent> forTarget(EventTarget e, {bool useCapture: false}) {
-    var stream = new _EventStream(e, _eventType, useCapture);
+    // Specify the generic type for EventStream only in dart2js to avoid
+    // checked mode errors in dartium.
+    var stream = new _EventStream<BeforeUnloadEvent>(e, _eventType, useCapture);
     var controller = new StreamController<BeforeUnloadEvent>(sync: true);
 
     stream.listen((event) {
@@ -36584,12 +36586,16 @@
   }
 
   ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false}) {
-    return new _ElementEventStreamImpl(e, _eventType, useCapture);
+    // Specify the generic type for _ElementEventStreamImpl only in dart2js to
+    // avoid checked mode errors in dartium.
+    return new _ElementEventStreamImpl<BeforeUnloadEvent>(e, _eventType, useCapture);
   }
 
   ElementStream<BeforeUnloadEvent> _forElementList(ElementList e,
       {bool useCapture: false}) {
-    return new _ElementListEventStreamImpl(e, _eventType, useCapture);
+    // Specify the generic type for _ElementEventStreamImpl only in dart2js to
+    // avoid checked mode errors in dartium.
+    return new _ElementListEventStreamImpl<BeforeUnloadEvent>(e, _eventType, useCapture);
   }
 }
 // Copyright (c) 2012, the Dart project authors.  Please see the AUTHORS file
@@ -39931,7 +39937,7 @@
    * [addEventListener](http://docs.webplatform.org/wiki/dom/methods/addEventListener)
    */
   ElementStream<T> _forElementList(ElementList e, {bool useCapture: false}) {
-    return new _ElementListEventStreamImpl(e, _eventType, useCapture);
+    return new _ElementListEventStreamImpl<T>(e, _eventType, useCapture);
   }
 
   /**
@@ -40081,13 +40087,21 @@
   EventListener _onData;
   final bool _useCapture;
 
-  // TODO(jacobr): for full strong mode correctness we should write
-  // _onData = onData == null ? null : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
-  // but that breaks 114 co19 tests as well as multiple html tests as it is reasonable
-  // to pass the wrong type of event object to an event listener as part of a
-  // test.
+  // TODO(leafp): It would be better to write this as
+  // _onData = onData == null ? null :
+  //   onData is _wrapZoneCallback<Event, dynamic>
+  //     ? _wrapZone/*<Event, dynamic>*/(onData)
+  //     : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
+  // In order to support existing tests which pass the wrong type of events but
+  // use a more general listener, without causing as much slowdown for things
+  // which are typed correctly.  But this currently runs afoul of restrictions
+  // on is checks for compatibility with the VM.
   _EventStreamSubscription(this._target, this._eventType, void onData(T event),
-      this._useCapture) : _onData = _wrapZone/*<Event, dynamic>*/(onData) {
+                           this._useCapture) :
+      _onData = onData == null
+      ? null
+      : _wrapZone/*<Event, dynamic>*/((e) => (onData as dynamic)(e))
+  {
     _tryResume();
   }
 
@@ -40149,9 +40163,9 @@
     }
   }
 
-  Future asFuture([var futureValue]) {
+  Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]) {
     // We just need a future that will never succeed or fail.
-    Completer completer = new Completer();
+    var completer = new Completer/*<E>*/();
     return completer.future;
   }
 }
@@ -42527,7 +42541,7 @@
 
   // Iterable APIs
 
-  Iterator<E> get iterator => new _WrappedIterator(_list.iterator);
+  Iterator<E> get iterator => new _WrappedIterator<E>(_list.iterator);
 
   int get length => _list.length;
 
@@ -43387,17 +43401,13 @@
   // For performance reasons avoid wrapping if we are in the root zone.
   if (Zone.current == Zone.ROOT) return callback;
   if (callback == null) return null;
-  // TODO(jacobr): we cast to _wrapZoneCallback/*<A, R>*/ to hack around missing
-  // generic method support in zones.
-  return Zone.current.bindUnaryCallback(callback, runGuarded: true) as _wrapZoneCallback/*<A, R>*/;
+  return Zone.current.bindUnaryCallback/*<R, A>*/(callback, runGuarded: true);
 }
 
 _wrapZoneBinaryCallback/*<A, B, R>*/ _wrapBinaryZone/*<A, B, R>*/(_wrapZoneBinaryCallback/*<A, B, R>*/ callback) {
   if (Zone.current == Zone.ROOT) return callback;
   if (callback == null) return null;
-  // We cast to _wrapZoneBinaryCallback/*<A, B, R>*/ to hack around missing
-  // generic method support in zones.
-  return Zone.current.bindBinaryCallback(callback, runGuarded: true) as _wrapZoneBinaryCallback/*<A, B, R>*/;
+  return Zone.current.bindBinaryCallback/*<R, A, B>*/(callback, runGuarded: true);
 }
 
 /**
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart b/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart
index 34636a7..eb15560 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart
@@ -273,7 +273,7 @@
     }
     if (args != null) args = new List.from(args.map(_convertToJS));
     var fn = JS('', '#[#]', _jsObject, method);
-    if (!JS('bool', '# instanceof Function', fn)) {
+    if (JS('bool', 'typeof(#) !== "function"', fn)) {
       throw new NoSuchMethodError(_jsObject, new Symbol(method), args, {});
     }
     return _convertToDart(JS('', '#.apply(#, #)', fn, _jsObject, args));
@@ -431,14 +431,21 @@
   }
 }
 
+// Cross frame objects should not be considered browser types.
+// We include the the instanceof Object test to filter out cross frame objects
+// on FireFox. Surprisingly on FireFox the instanceof Window test succeeds for
+// cross frame windows while the instanceof Object test fails.
 bool _isBrowserType(o) => JS('bool',
+    '# instanceof Object && ('
     '# instanceof Blob || '
     '# instanceof Event || '
     '(window.KeyRange && # instanceof KeyRange) || '
+    '(window.IDBKeyRange && # instanceof IDBKeyRange) || '
     '# instanceof ImageData || '
     '# instanceof Node || '
-    '(window.TypedData && # instanceof TypedData) || '
-    '# instanceof Window', o, o, o, o, o, o, o);
+    // Int8Array.__proto__ is TypedArray.
+    '(window.Int8Array && # instanceof Int8Array.__proto__) || '
+    '# instanceof Window)', o, o, o, o, o, o, o, o, o);
 
 class _DartObject {
   final _dartObj;
@@ -491,11 +498,13 @@
              JS('bool', 'dart.jsobject != dart.getReifiedType(#)', o)) {
     return o._dartObj;
   } else {
-    return _putIfAbsent(_dartProxies, o, _wrapToDart);
+    return _wrapToDart(o);
   }
 }
 
-JsObject _wrapToDart(o) {
+Object _wrapToDart(o) => _putIfAbsent(_dartProxies, o, _wrapToDartHelper);
+
+Object _wrapToDartHelper(o) {
   if (JS('bool', 'typeof # == "function"', o)) {
     return new JsFunction._fromJs(o);
   }
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart
index dfc883a..cd898d0 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/async_patch.dart
@@ -10,12 +10,16 @@
 import 'dart:_isolate_helper' show
     IsolateNatives,
     TimerImpl,
+    global,
     leaveJsAsync,
     enterJsAsync,
     isWorker;
 
 import 'dart:_foreign_helper' show JS;
 
+typedef void _Callback();
+typedef void _TakeCallback(_Callback callback);
+
 @patch
 class _AsyncRun {
   @patch
@@ -24,21 +28,21 @@
   }
 
   // Lazily initialized.
-  static final Function _scheduleImmediateClosure =
+  static final _TakeCallback _scheduleImmediateClosure =
       _initializeScheduleImmediate();
 
-  static Function _initializeScheduleImmediate() {
+  static _TakeCallback _initializeScheduleImmediate() {
     // TODO(rnystrom): Not needed by dev_compiler.
     // requiresPreamble();
-    if (JS('', 'self.scheduleImmediate') != null) {
+    if (JS('', '#.scheduleImmediate', global) != null) {
       return _scheduleImmediateJsOverride;
     }
-    if (JS('', 'self.MutationObserver') != null &&
-        JS('', 'self.document') != null) {
+    if (JS('', '#.MutationObserver', global) != null &&
+        JS('', '#.document', global) != null) {
       // Use mutationObservers.
-      var div = JS('', 'self.document.createElement("div")');
-      var span = JS('', 'self.document.createElement("span")');
-      var storedCallback;
+      var div = JS('', '#.document.createElement("div")', global);
+      var span = JS('', '#.document.createElement("span")', global);
+      _Callback storedCallback;
 
       internalCallback(_) {
         leaveJsAsync();
@@ -47,7 +51,7 @@
         f();
       };
 
-      var observer = JS('', 'new self.MutationObserver(#)', internalCallback);
+      var observer = JS('', 'new #.MutationObserver(#)', global, internalCallback);
       JS('', '#.observe(#, { childList: true })',
           observer, div);
 
@@ -61,7 +65,7 @@
         JS('', '#.firstChild ? #.removeChild(#): #.appendChild(#)',
             div, div, span, div, span);
       };
-    } else if (JS('', 'self.setImmediate') != null) {
+    } else if (JS('', '#.setImmediate', global) != null) {
       return _scheduleImmediateWithSetImmediate;
     }
     // TODO(20055): We should use DOM promises when available.
@@ -74,7 +78,7 @@
       callback();
     };
     enterJsAsync();
-    JS('void', 'self.scheduleImmediate(#)', internalCallback);
+    JS('void', '#.scheduleImmediate(#)', global, internalCallback);
   }
 
   static void _scheduleImmediateWithSetImmediate(void callback()) {
@@ -83,7 +87,7 @@
       callback();
     };
     enterJsAsync();
-    JS('void', 'self.setImmediate(#)', internalCallback);
+    JS('void', '#.setImmediate(#)', global, internalCallback);
   }
 
   static void _scheduleImmediateWithTimer(void callback()) {
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
index ffeb76a..6aafacd 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart
@@ -56,8 +56,8 @@
   static apply(Function f,
                List positionalArguments,
                [Map<Symbol, dynamic> namedArguments]) {
-    // TODO(vsm): Handle named args.
-    // See: https://github.com/dart-lang/dev_compiler/issues/176
+    // TODO(vsm): Handle named args:
+    // https://github.com/dart-lang/sdk/issues/27257
     return JS('', 'dart.dcall.apply(null, [#].concat(#))', f, positionalArguments);
   }
 
@@ -610,16 +610,6 @@
   @patch
   @NoInline()
   static StackTrace get current {
-    if (JS('', 'Error.captureStackTrace') != null) {
-      var error = JS('', 'new Error()');
-      JS('void', 'Error.captureStackTrace(#)', error);
-      return getTraceFromException(error);
-    }
-    // Fallback if Error.captureStackTrace does not exist.
-    try {
-      throw '';
-    } catch (_, stackTrace) {
-      return stackTrace;
-    }
+    return getTraceFromException(JS('', 'new Error()'));
   }
 }
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
index 629db38..cdc14c1 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
@@ -53,6 +53,27 @@
         $copyProperties(s, m[$_methodSig]);
       }
       return s;
+    },
+    fields: () => {
+      let s = {};
+      for (let m of $mixins) {
+        $copyProperties(s, m[$_fieldSig]);
+      }
+      return s;
+    },
+    getters: () => {
+      let s = {};
+      for (let m of $mixins) {
+        $copyProperties(s, m[$_getterSig]);
+      }
+      return s;
+    },
+    setters: () => {
+      let s = {};
+      for (let m of $mixins) {
+        $copyProperties(s, m[$_setterSig]);
+      }
+      return s;
     }
   });
 
@@ -64,12 +85,14 @@
 /// The Symbol for storing type arguments on a specialized generic type.
 final _mixins = JS('', 'Symbol("mixins")');
 
-getMixins(clazz) => JS('', 'Object.hasOwnProperty.call(#, #) ? #[#] : null', clazz, _mixins, clazz, _mixins);
+getMixins(clazz) => JS('', 'Object.hasOwnProperty.call(#, #) ? #[#] : null',
+    clazz, _mixins, clazz, _mixins);
 
 @JSExportName('implements')
 final _implements = JS('', 'Symbol("implements")');
 
-getImplements(clazz) => JS('', 'Object.hasOwnProperty.call(#, #) ? #[#] : null', clazz, _implements, clazz, _implements);
+getImplements(clazz) => JS('', 'Object.hasOwnProperty.call(#, #) ? #[#] : null',
+    clazz, _implements, clazz, _implements);
 
 /// The Symbol for storing type arguments on a specialized generic type.
 final _typeArguments = JS('', 'Symbol("typeArguments")');
@@ -151,12 +174,12 @@
 final _constructorSig = JS('', 'Symbol("sigCtor")');
 final _methodSig = JS('', 'Symbol("sigMethod")');
 final _fieldSig = JS('', 'Symbol("sigField")');
-final _getterSig= JS('', 'Symbol("sigGetter")');
-final _setterSig= JS('', 'Symbol("sigSetter")');
+final _getterSig = JS('', 'Symbol("sigGetter")');
+final _setterSig = JS('', 'Symbol("sigSetter")');
 final _staticSig = JS('', 'Symbol("sigStaticMethod")');
 final _staticFieldSig = JS('', 'Symbol("sigStaticField")');
-final _staticGetterSig= JS('', 'Symbol("sigStaticGetter")');
-final _staticSetterSig= JS('', 'Symbol("sigStaticSetter")');
+final _staticGetterSig = JS('', 'Symbol("sigStaticGetter")');
+final _staticSetterSig = JS('', 'Symbol("sigStaticSetter")');
 final _genericTypeCtor = JS('', 'Symbol("genericType")');
 
 // TODO(vsm): Collapse this as well - just provide a dart map to mirrors code.
@@ -174,15 +197,29 @@
 getGenericTypeCtor(value) => JS('', '#[#]', value, _genericTypeCtor);
 
 /// Get the type of a method from an object using the stored signature
-getMethodType(obj, name) => JS(
+getType(obj) => JS(
     '',
     '''(() => {
-  let type = $obj == null ? $Object : $obj.__proto__.constructor;
-  return $getMethodTypeFromType(type, $name);
+  return $obj == null ? $Object : $obj.__proto__.constructor;
 })()''');
 
+bool isJsInterop(obj) {
+  if (JS('bool', 'typeof # === "function"', obj)) {
+    // A function is a Dart function if it has runtime type information.
+    return _getRuntimeType(obj) == null;
+  }
+  // Primitive types are not JS interop types.
+  if (JS('bool', 'typeof # !== "object"', obj)) return false;
+
+  // Extension types are not considered JS interop types.
+  // Note that it is still possible to call typed JS interop methods on
+  // extension types but the calls must be statically typed.
+  if (getExtensionType(obj) != null) return false;
+  return JS('bool', '!($obj instanceof $Object)');
+}
+
 /// Get the type of a method from a type using the stored signature
-getMethodTypeFromType(type, name) => JS(
+getMethodType(type, name) => JS(
     '',
     '''(() => {
   let sigObj = $type[$_methodSig];
@@ -190,6 +227,24 @@
   return sigObj[$name];
 })()''');
 
+getFieldType(type, name) => JS(
+    '',
+    '''(() => {
+  let sigObj = $type[$_fieldSig];
+  if (sigObj === void 0) return void 0;
+  let fieldType = sigObj[$name];
+  // workaround to handle metadata.
+  return (fieldType instanceof Array) ? fieldType[0] : fieldType;
+})()''');
+
+getSetterType(type, name) => JS(
+    '',
+    '''(() => {
+  let sigObj = $type[$_setterSig];
+  if (sigObj === void 0) return void 0;
+  return sigObj[$name];
+})()''');
+
 /// Get the type of a constructor from a class using the stored signature
 /// If name is undefined, returns the type of the default constructor
 /// Returns undefined if the constructor is not found.
@@ -219,7 +274,7 @@
   $f = $f.bind($obj);
   // TODO(jmesserly): track the function's signature on the function, instead
   // of having to go back to the class?
-  let sig = $getMethodType($obj, $name);
+  let sig = $getMethodType($getType($obj), $name);
   $assert_(sig);
   $tag($f, sig);
   return $f;
@@ -242,7 +297,9 @@
     '''(() => {
   $defineMemoizedGetter($f, $kind, () => {
     let sigObj = $sigF();
-    sigObj.__proto__ = $f.__proto__[$kind];
+    let proto = $f.__proto__;
+    // We need to set the root proto to null not undefined.
+    sigObj.__proto__ = ($kind in proto) ? proto[$kind] : null;
     return sigObj;
   });
 })()''');
@@ -330,7 +387,18 @@
   $_setStaticTypes($f, names);
 })()''');
 
-hasMethod(obj, name) => JS('', '$getMethodType($obj, $name) !== void 0');
+_hasSigEntry(type, sigF, name) => JS(
+    '',
+    '''(() => {
+  let sigObj = $type[$sigF];
+  if (sigObj === void 0) return false;
+  return $name in sigObj;
+})()''');
+
+hasMethod(type, name) => _hasSigEntry(type, _methodSig, name);
+hasGetter(type, name) => _hasSigEntry(type, _getterSig, name);
+hasSetter(type, name) => _hasSigEntry(type, _setterSig, name);
+hasField(type, name) => _hasSigEntry(type, _fieldSig, name);
 
 /// Given a class and an initializer method name, creates a constructor
 /// function with the same name.
@@ -431,9 +499,15 @@
   // Mark the JS type's instances so we can easily check for extensions.
   jsProto[$_extensionType] = $dartExtType;
   $_installProperties(jsProto, extProto);
-  let originalSigFn = $getOwnPropertyDescriptor($dartExtType, $_methodSig).get;
-  $assert_(originalSigFn);
-  $defineMemoizedGetter($jsType, $_methodSig, originalSigFn);
+  function updateSig(sigF) {
+    let originalSigFn = $getOwnPropertyDescriptor($dartExtType, sigF).get;
+    $assert_(originalSigFn);
+    $defineMemoizedGetter($jsType, sigF, originalSigFn);
+  }
+  updateSig($_methodSig);
+  updateSig($_fieldSig);
+  updateSig($_getterSig);
+  updateSig($_setterSig);
 })()''');
 
 ///
@@ -469,14 +543,24 @@
   // annotations) any time we copy a method as part of our metaprogramming.
   // It might be more friendly to JS metaprogramming if we include this info
   // on the function.
-  let originalSigFn = $getOwnPropertyDescriptor($type, $_methodSig).get;
-  $defineMemoizedGetter(type, $_methodSig, function() {
-    let sig = originalSigFn();
-    for (let name of $methodNames) {
-      sig[$getExtensionSymbol(name)] = sig[name];
-    }
-    return sig;
-  });
+
+  function upgradeSig(sigF) {
+    let originalSigFn = $getOwnPropertyDescriptor($type, sigF).get;
+    $defineMemoizedGetter(type, sigF, function() {
+      let sig = originalSigFn();
+      let propertyNames = Object.getOwnPropertyNames(sig);
+      for (let name of methodNames) {
+        if (name in sig) {
+          sig[$getExtensionSymbol(name)] = sig[name];
+        }
+      }
+      return sig;
+    });
+  };
+  upgradeSig($_methodSig);
+  upgradeSig($_fieldSig);
+  upgradeSig($_getterSig);
+  upgradeSig($_setterSig);
 })()''');
 
 /// Sets the type of `obj` to be `type`
@@ -499,7 +583,9 @@
 /// Like [setBaseClass] but for generic extension types, e.g. `JSArray<E>`
 setExtensionBaseClass(derived, base) {
   // Mark the generic type as an extension type and link the prototype objects
-  return JS('', '''(() => {
+  return JS(
+      '',
+      '''(() => {
     if ($base) {
       $derived.prototype[$_extensionType] = $derived;
       $derived.prototype.__proto__ = $base.prototype
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
index 244a603..49bc1cc 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
@@ -3,49 +3,59 @@
 // BSD-style license that can be found in the LICENSE file.
 part of dart._runtime;
 
+bool _trapRuntimeErrors = true;
+
+// Override, e.g., for testing
+void trapRuntimeErrors(bool flag) {
+  _trapRuntimeErrors = flag;
+}
+
 throwCastError(object, actual, type) => JS('', '''(() => {
-  debugger;
-  $throw_(new $CastErrorImplementation($object,
-                                       $typeName($actual),
-                                       $typeName($type)));
+  var found = $typeName($actual);
+  var expected = $typeName($type);
+  if ($_trapRuntimeErrors) debugger;
+  $throw_(new $CastErrorImplementation($object, found, expected));
 })()''');
 
 throwTypeError(object, actual, type) => JS('', '''(() => {
-  debugger;
-  $throw_(new $TypeErrorImplementation($object,
-                                       $typeName($actual),
-                                       $typeName($type)));
+  var found = $typeName($actual);
+  var expected = $typeName($type);
+  if ($_trapRuntimeErrors) debugger;
+  $throw_(new $TypeErrorImplementation($object, found, expected));
 })()''');
 
 throwStrongModeCastError(object, actual, type) => JS('', '''(() => {
-  debugger;
-  $throw_(new $StrongModeCastError($object,
-                                   $typeName($actual),
-                                   $typeName($type)));
+  var found = $typeName($actual);
+  var expected = $typeName($type);
+  if ($_trapRuntimeErrors) debugger;
+  $throw_(new $StrongModeCastError($object, found, expected));
 })()''');
 
 throwStrongModeTypeError(object, actual, type) => JS('', '''(() => {
-  debugger;
-  $throw_(new $StrongModeTypeError($object,
-                                   $typeName($actual),
-                                   $typeName($type)));
+  var found = $typeName($actual);
+  var expected = $typeName($type);
+  if ($_trapRuntimeErrors) debugger;
+  $throw_(new $StrongModeTypeError($object, found, expected));
 })()''');
 
 throwUnimplementedError(message) => JS('', '''(() => {
-  debugger;
+  if ($_trapRuntimeErrors) debugger;
   $throw_(new $UnimplementedError($message));
 })()''');
 
-throwAssertionError() => JS('', '''(() => {
-  debugger;
-  $throw_(new $AssertionError());
+throwAssertionError([message]) => JS('', '''(() => {
+  if ($_trapRuntimeErrors) debugger;
+  let error = $message != null
+        ? new $AssertionErrorWithMessage($message())
+        : new $AssertionError();
+  $throw_(error);
 })()''');
 
 throwNullValueError() => JS('', '''(() => {
   // TODO(vsm): Per spec, we should throw an NSM here.  Technically, we ought
   // to thread through method info, but that uglifies the code and can't
   // actually be queried ... it only affects how the error is printed.
-  debugger;
+  if ($_trapRuntimeErrors) debugger;
   $throw_(new $NoSuchMethodError(null,
       new $Symbol('<Unexpected Null Value>'), null, null, null));
 })()''');
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart
index b8138d7..090ec26 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart
@@ -5,7 +5,7 @@
 /// This library adapts ES6 generators to implement Dart's async/await.
 /// It's designed to interact with Dart's Future/Stream and follow Dart
 /// async/await semantics.
-/// See https://github.com/dart-lang/dev_compiler/issues/245 for ideas on
+/// See https://github.com/dart-lang/sdk/issues/27315 for ideas on
 /// reconciling Dart's Future and ES6 Promise.
 /// Inspired by `co`: https://github.com/tj/co/blob/master/index.js, which is a
 /// stepping stone for proposed ES7 async/await, and uses ES6 Promises.
@@ -47,7 +47,7 @@
     // Chain the Future so `await` receives the Future's value.
     return future.then($dynamic)(onValue, {onError: onError});
   }
-  return ${getGenericClass(Future)}($T).new(function() {
+  return ${getGenericClass(Future)}($T).microtask(function() {
     iter = $gen.apply(null, $args)[Symbol.iterator]();
     return onValue();
   });
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
index 392abf0..68d8fd0 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -14,7 +14,7 @@
   final bool isGetter;
   final bool isSetter;
 
-  InvocationImpl(String memberName, this.positionalArguments,
+  InvocationImpl(memberName, this.positionalArguments,
       {namedArguments,
       this.isMethod: false,
       this.isGetter: false,
@@ -29,22 +29,104 @@
   }
 }
 
+// Warning: dload, dput, and dsend assume they are never called on methods
+// implemented by the Object base class as those methods can always be
+// statically resolved.
 dload(obj, field) {
   var f = _canonicalMember(obj, field);
+
   _trackCall(obj);
   if (f != null) {
-    if (hasMethod(obj, f)) return bind(obj, f, JS('', 'void 0'));
-    return JS('', '#[#]', obj, f);
+    var type = getType(obj);
+
+    if (hasField(type, f) || hasGetter(type, f)) return JS('', '#[#]', obj, f);
+    if (hasMethod(type, f)) return bind(obj, f, JS('', 'void 0'));
+
+    // Always allow for JS interop objects.
+    if (isJsInterop(obj)) return JS('', '#[#]', obj, f);
   }
   return noSuchMethod(
       obj, new InvocationImpl(field, JS('', '[]'), isGetter: true));
 }
 
+// Version of dload that matches legacy mirrors behavior for JS types.
+dloadMirror(obj, field) {
+  var f = _canonicalMember(obj, field);
+
+  _trackCall(obj);
+  if (f != null) {
+    var type = getType(obj);
+
+    if (hasField(type, f) || hasGetter(type, f)) return JS('', '#[#]', obj, f);
+    if (hasMethod(type, f)) return bind(obj, f, JS('', 'void 0'));
+
+    // Do not support calls on JS interop objects to match Dart2JS behavior.
+  }
+  return noSuchMethod(
+      obj, new InvocationImpl(field, JS('', '[]'), isGetter: true));
+}
+
+_stripGenericArguments(type) {
+  var genericClass = getGenericClass(type);
+  if (genericClass != null) return JS('', '#()', genericClass);
+  return type;
+}
+
+// Version of dput that matches legacy Dart 1 type check rules and mirrors
+// behavior for JS types.
+// TODO(jacobr): remove the type checking rules workaround when mirrors based
+// PageLoader code can generate the correct reified generic types.
+dputMirror(obj, field, value) {
+  var f = _canonicalMember(obj, field);
+  _trackCall(obj);
+  if (f != null) {
+    var objType = getType(obj);
+    var setterType = getSetterType(objType, f);
+    if (JS('bool', '# != void 0', setterType)) {
+      return JS(
+          '',
+          '#[#] = #',
+          obj,
+          f,
+          check(
+              value, _stripGenericArguments(JS('', '#.args[0]', setterType))));
+    } else {
+      var fieldType = getFieldType(objType, f);
+      // TODO(jacobr): add metadata tracking which fields are final and throw
+      // if a setter is called on a final field.
+      if (JS('bool', '# != void 0', fieldType)) {
+        return JS('', '#[#] = #', obj, f,
+            check(value, _stripGenericArguments(fieldType)));
+      }
+
+      // Do not support calls on JS interop objects to match Dart2JS behavior.
+    }
+  }
+  return noSuchMethod(
+      obj, new InvocationImpl(field, JS('', '[#]', value), isSetter: true));
+}
+
 dput(obj, field, value) {
   var f = _canonicalMember(obj, field);
   _trackCall(obj);
   if (f != null) {
-    return JS('', '#[#] = #', obj, f, value);
+    var objType = getType(obj);
+    var setterType = getSetterType(objType, f);
+    if (JS('bool', '# != void 0', setterType)) {
+      return JS('', '#[#] = #', obj, f,
+          check(value, JS('', '#.args[0]', setterType)));
+    } else {
+      var fieldType = getFieldType(objType, f);
+      // TODO(jacobr): add metadata tracking which fields are final and throw
+      // if a setter is called on a final field.
+      if (JS('bool', '# != void 0', fieldType)) {
+        return JS('', '#[#] = #', obj, f, check(value, fieldType));
+      }
+      // Always allow for JS interop objects.
+      if (isJsInterop(obj)) {
+        return JS('', '#[#] = #', obj, f, value);
+      }
+    }
   }
   return noSuchMethod(
       obj, new InvocationImpl(field, JS('', '[#]', value), isSetter: true));
@@ -58,7 +140,7 @@
   if ($actuals.length < $type.args.length) return false;
   let index = 0;
   for(let i = 0; i < $type.args.length; ++i) {
-    if (!$instanceOfOrNull($actuals[i], $type.args[i])) return false;
+    $check($actuals[i], $type.args[i]);
     ++index;
   }
   if ($actuals.length == $type.args.length) return true;
@@ -66,7 +148,7 @@
   if ($type.optionals.length > 0) {
     if (extras > $type.optionals.length) return false;
     for(let i = 0, j=index; i < extras; ++i, ++j) {
-      if (!$instanceOfOrNull($actuals[j], $type.optionals[i])) return false;
+      $check($actuals[j], $type.optionals[i]);
     }
     return true;
   }
@@ -84,13 +166,47 @@
     if (!($hasOwnProperty.call($type.named, name))) {
       return false;
     }
-    if (!$instanceOfOrNull(opts[name], $type.named[name])) return false;
+    $check(opts[name], $type.named[name]);
   }
   return true;
 })()''');
 
-Symbol _dartSymbol(name) =>
-    JS('', '#(#.new(#.toString()))', const_, Symbol, name);
+_toSymbolName(symbol) => JS(
+    '',
+    '''(() => {
+        let str = $symbol.toString();
+        // Strip leading 'Symbol(' and trailing ')'
+        return str.substring(7, str.length-1);
+    })()''');
+
+_toDisplayName(name) => JS(
+    '',
+    '''(() => {
+      // Names starting with _ are escaped names used to disambiguate Dart and
+      // JS names.
+      if ($name[0] === '_') {
+        // Inverse of 
+        switch($name) {
+          case '_get':
+            return '[]';
+          case '_set':
+            return '[]=';
+          case '_negate':
+            return 'unary-';
+          case '_constructor':
+          case '_prototype':
+            return $name.substring(1);
+        }
+      }
+      return $name;
+  })()''');
+
+Symbol _dartSymbol(name) {
+  return (JS('bool', 'typeof # === "symbol"', name))
+      ? JS('', '#(new #.es6(#, #))', const_, _internal.Symbol,
+          _toSymbolName(name), name)
+      : JS('', '#(#.new(#))', const_, Symbol, _toDisplayName(name));
+}
 
 /// Extracts the named argument array from a list of arguments, and returns it.
 // TODO(jmesserly): we need to handle named arguments better.
@@ -121,7 +237,7 @@
     // We're not a function (and hence not a method either)
     // Grab the `call` method if it's not a function.
     if ($f != null) {
-      $ftype = $getMethodType($f, 'call');
+      $ftype = $getMethodType($getType($f), 'call');
       $f = $f.call;
     }
     if (!($f instanceof Function)) {
@@ -303,7 +419,9 @@
         obj, new InvocationImpl(displayName, args, isMethod: true));
   }
   var f = obj != null ? JS('', '#[#]', obj, symbol) : null;
-  var ftype = getMethodType(obj, symbol);
+  var type = getType(obj);
+  var ftype = getMethodType(type, symbol);
+  // No such method if dart object and ftype is missing.
   return _checkAndCall(f, ftype, obj, typeArgs, args, displayName);
 }
 
@@ -312,7 +430,8 @@
 dgsend(obj, typeArgs, method, @rest args) =>
     _callMethod(obj, method, typeArgs, args, method);
 
-dindex(obj, index) => _callMethod(obj, '_get', null, JS('', '[#]', index), '[]');
+dindex(obj, index) =>
+    _callMethod(obj, '_get', null, JS('', '[#]', index), '[]');
 
 dsetindex(obj, index, value) =>
     _callMethod(obj, '_set', null, JS('', '[#, #]', index, value), '[]=');
@@ -394,6 +513,9 @@
 instanceOf(obj, type) => JS(
     '',
     '''(() => {
+  if ($obj == null) {
+    return $type == $Null || $_isTop($type);
+  }
   let result = $strongInstanceOf($obj, $type);
   if (result !== null) return result;
   let actual = $getReifiedType($obj);
@@ -546,31 +668,26 @@
 })()''');
 
 @JSExportName('assert')
-assert_(condition) => JS(
+assert_(condition, [message]) => JS(
     '',
     '''(() => {
-  if (!$condition) $throwAssertionError();
+  if (!$condition) $throwAssertionError(message);
 })()''');
 
-final _stack = JS('', 'new WeakMap()');
+var _stack = null;
 @JSExportName('throw')
 throw_(obj) => JS(
     '',
     '''(() => {
-  if ($obj != null && (typeof $obj == 'object' || typeof $obj == 'function')) {
-    // TODO(jmesserly): couldn't we store the most recent stack in a single
-    // variable? There should only be one active stack trace. That would
-    // allow it to work for things like strings and numbers.
-    $_stack.set($obj, new Error());
-  }
-  throw $obj;
+    $_stack = new Error();
+    throw $obj;
 })()''');
 
 getError(exception) => JS(
     '',
     '''(() => {
-  var stack = $_stack.get($exception);
-  return stack !== void 0 ? stack : $exception;
+  var stack = $_stack;
+  return stack !== null ? stack : $exception;
 })()''');
 
 // This is a utility function: it is only intended to be called from dev
@@ -765,7 +882,7 @@
   }
   // TODO(jmesserly): restore this faster path once ES Symbol is treated as
   // an extension type (and thus hits the above code path).
-  // See https://github.com/dart-lang/dev_compiler/issues/578.
+  // See https://github.com/dart-lang/sdk/issues/28323
   // return JS('', '"" + #', obj);
   return JS('String', '#.toString()', obj);
 }
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
index d97b6bd..344c592 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/rtti.dart
@@ -183,7 +183,7 @@
 }
 
 /// Given a WrappedType, return the internal runtime type object.
-unwrapType(obj) => obj._wrappedType;
+unwrapType(WrappedType obj) => obj._wrappedType;
 
 _getRuntimeType(value) => JS('', '#[#]', value, _runtimeType);
 getIsNamedConstructor(value) => JS('', '#[#]', value, isNamedConstructor);
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart
index 6b79332..fb47401 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart
@@ -9,10 +9,19 @@
 
 import 'dart:_foreign_helper' show JS, JSExportName, rest, spread;
 import 'dart:_interceptors' show JSArray;
-import 'dart:_js_helper' show SyncIterable, BooleanConversionAssertionError,
-  CastErrorImplementation, TypeErrorImplementation,
-  StrongModeCastError, StrongModeTypeError, StrongModeErrorImplementation,
-  getTraceFromException, Primitives;
+import 'dart:_js_helper'
+    show
+        AssertionErrorWithMessage,
+        BooleanConversionAssertionError,
+        CastErrorImplementation,
+        getTraceFromException,
+        Primitives,
+        TypeErrorImplementation,
+        StrongModeCastError,
+        StrongModeErrorImplementation,
+        StrongModeTypeError,
+        SyncIterable;
+import 'dart:_internal' as _internal;
 
 part 'classes.dart';
 part 'rtti.dart';
@@ -22,6 +31,59 @@
 part 'operations.dart';
 part 'utils.dart';
 
+// TODO(vsm): Move polyfill code to dart:html.
+// Note, native extensions are registered onto types in dart.global.
+// This polyfill needs to run before the corresponding dart:html code is run.
 @JSExportName('global')
-final global_ = JS('', 'typeof window == "undefined" ? global : window');
+final global_ = JS('', '''
+  function () {
+    if (typeof NodeList !== "undefined") {
+      // TODO(vsm): Do we still need these?
+      NodeList.prototype.get = function(i) { return this[i]; };
+      NamedNodeMap.prototype.get = function(i) { return this[i]; };
+      DOMTokenList.prototype.get = function(i) { return this[i]; };
+      HTMLCollection.prototype.get = function(i) { return this[i]; };
+
+      // Expose constructors for DOM types dart:html needs to assume are
+      // available on window.
+      if (typeof PannerNode == "undefined") {
+        let audioContext;
+        if (typeof AudioContext == "undefined" &&
+            (typeof webkitAudioContext != "undefined")) {
+          audioContext = new webkitAudioContext();
+        } else {
+          audioContext = new AudioContext();
+          window.StereoPannerNode =
+              audioContext.createStereoPanner().constructor;
+        }
+        window.PannerNode = audioContext.createPanner().constructor;
+      }
+      if (typeof AudioSourceNode == "undefined") {
+        window.AudioSourceNode = MediaElementAudioSourceNode.__proto__;
+      }
+      if (typeof FontFaceSet == "undefined") {
+        window.FontFaceSet = document.fonts.__proto__.constructor;
+      }
+      if (typeof MemoryInfo == "undefined") {
+        if (typeof window.performance.memory != "undefined") {
+          window.MemoryInfo = window.performance.memory.constructor;
+        }
+      }
+      if (typeof Geolocation == "undefined") {
+        navigator.geolocation.constructor;
+      }
+      if (typeof Animation == "undefined") {
+        let d = document.createElement('div');
+        if (typeof d.animate != "undefined") {
+          window.Animation = d.animate(d).constructor;
+        }
+      }
+      if (typeof SourceBufferList == "undefined") {
+        window.SourceBufferList = new MediaSource().sourceBuffers.constructor;
+      }
+    }
+    return typeof window == "undefined" ? global : window;
+  }()
+''');
+
 final JsSymbol = JS('', 'Symbol');
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
index 4d402db..e64daf7 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
@@ -182,56 +182,61 @@
   toString() => typeName(_wrappedType);
 }
 
-final AbstractFunctionType = JS(
-    '',
-    '''
-  class AbstractFunctionType extends $TypeRep {
-    constructor() {
-      super();
-      this._stringValue = null;
+abstract class AbstractFunctionType extends TypeRep {
+  String _stringValue = null;
+  get args;
+  get optionals;
+  get metadata;
+  get named;
+  get returnType;
+
+  AbstractFunctionType() {}
+
+  toString() {
+    return name;
+  }
+
+  get name {
+    if (_stringValue != null) return _stringValue;
+
+    var buffer = '(';
+    for (var i = 0; JS('bool', '# < #.length', i, args); ++i) {
+      if (i > 0) {
+        buffer += ', ';
+      }
+      buffer += typeName(JS('', '#[#]', args, i));
     }
-
-    toString() { return this.name; }
-
-    get name() {
-      if (this._stringValue) return this._stringValue;
-
-      let buffer = '(';
-      for (let i = 0; i < this.args.length; ++i) {
+    if (JS('bool', '#.length > 0', optionals)) {
+      if (JS('bool', '#.length > 0', args)) buffer += ', ';
+      buffer += '[';
+      for (var i = 0; JS('bool', '# < #.length', i, optionals); ++i) {
         if (i > 0) {
           buffer += ', ';
         }
-        buffer += $typeName(this.args[i]);
+        buffer += typeName(JS('', '#[#]', optionals, i));
       }
-      if (this.optionals.length > 0) {
-        if (this.args.length > 0) buffer += ', ';
-        buffer += '[';
-        for (let i = 0; i < this.optionals.length; ++i) {
-          if (i > 0) {
-            buffer += ', ';
-          }
-          buffer += $typeName(this.optionals[i]);
+      buffer += ']';
+    } else if (JS('bool', 'Object.keys(#).length > 0', named)) {
+      if (JS('bool', '#.length > 0', args)) buffer += ', ';
+      buffer += '{';
+      var names = getOwnPropertyNames(named);
+      JS('', '#.sort()', names);
+      for (var i = 0; JS('', '# < #.length', i, names); ++i) {
+        if (i > 0) {
+          buffer += ', ';
         }
-        buffer += ']';
-      } else if (Object.keys(this.named).length > 0) {
-        if (this.args.length > 0) buffer += ', ';
-        buffer += '{';
-        let names = $getOwnPropertyNames(this.named).sort();
-        for (let i = 0; i < names.length; ++i) {
-          if (i > 0) {
-            buffer += ', ';
-          }
-          buffer += names[i] + ': ' + $typeName(this.named[names[i]]);
-        }
-        buffer += '}';
+        var typeNameString = typeName(JS('', '#[#[#]]', named, names, i));
+        buffer += '${JS('', '#[#]', names, i)}: $typeNameString';
       }
-
-      buffer += ') -> ' + $typeName(this.returnType);
-      this._stringValue = buffer;
-      return buffer;
+      buffer += '}';
     }
+
+    var returnTypeName = typeName(returnType);
+    buffer += ') -> $returnTypeName';
+    _stringValue = buffer;
+    return buffer;
   }
-''');
+}
 
 /// Memo table for named argument groups. A named argument packet
 /// {name1 : type1, ..., namen : typen} corresponds to the path
@@ -260,207 +265,215 @@
 /// of required arguments yields a map which is indexed by the
 /// argument types themselves.  The element reached via this
 /// index path (if present) is the canonical function type.
-final _fnTypeSmallMap = JS('', '[new Map(), new Map(), new Map()]');
+final List _fnTypeSmallMap = JS('', '[new Map(), new Map(), new Map()]');
 
-final FunctionType = JS(
+_memoizeArray(map, arr, create) => JS(
     '',
-    '''
-  class FunctionType extends $AbstractFunctionType {
-    static _memoizeArray(map, arr, create) {
-      let len = arr.length;
-      map = FunctionType._lookupNonTerminal(map, len);
-      for (var i = 0; i < len-1; ++i) {
-        map = FunctionType._lookupNonTerminal(map, arr[i]);
-      }
-      let result = map.get(arr[len-1]);
-      if (result !== void 0) return result;
-      map.set(arr[len-1], result = create());
-      return result;
-    }
+    '''(() => {
+  let len = $arr.length;
+  $map = $_lookupNonTerminal($map, len);
+  for (var i = 0; i < len-1; ++i) {
+    $map = $_lookupNonTerminal($map, $arr[i]);
+  }
+  let result = $map.get($arr[len-1]);
+  if (result !== void 0) return result;
+  $map.set($arr[len-1], result = $create());
+  return result;
+})()''');
 
-    // Map dynamic to bottom. If meta-data is present,
-    // we slice off the remaining meta-data and make
-    // it the second element of a packet for processing
-    // later on in the constructor.
-    static _normalizeParameter(a) {
-      if (a instanceof Array) {
-        let result = [];
-        result.push((a[0] == $dynamic) ? $bottom : a[0]);
-        result.push(a.slice(1));
-        return result;
-      }
-      return (a == $dynamic) ? $bottom : a;
-    }
+// Map dynamic to bottom. If meta-data is present,
+// we slice off the remaining meta-data and make
+// it the second element of a packet for processing
+// later on in the constructor.
+_normalizeParameter(a) => JS(
+    '',
+    '''(() => {
+  if ($a instanceof Array) {
+    let result = [];
+    result.push(($a[0] == $dynamic) ? $bottom : $a[0]);
+    result.push($a.slice(1));
+    return result;
+  }
+  return ($a == $dynamic) ? $bottom : $a;
+})()''');
 
-    static _canonicalizeArray(definite, array, map) {
-      let arr = (definite)
-         ? array
-         : array.map(FunctionType._normalizeParameter);
-      return FunctionType._memoizeArray(map, arr, () => arr);
-    }
+_canonicalizeArray(definite, array, map) => JS(
+    '',
+    '''(() => {
+  let arr = ($definite)
+     ? $array
+     : $array.map($_normalizeParameter);
+  return $_memoizeArray($map, arr, () => arr);
+})()''');
 
-    // TODO(leafp): This only canonicalizes of the names are
-    // emitted in a consistent order.
-    static _canonicalizeNamed(definite, named, map) {
-      let key = [];
-      let names = $getOwnPropertyNames(named);
-      let r = {};
-      for (var i = 0; i < names.length; ++i) {
-        let name = names[i];
-        let type = named[name];
-        if (!definite) r[name] = type = FunctionType._normalizeParameter(type);
-        key.push(name);
-        key.push(type);
-      }
-      if (!definite) named = r;
-      return FunctionType._memoizeArray(map, key, () => named);
-    }
+// TODO(leafp): This only canonicalizes of the names are
+// emitted in a consistent order.
+_canonicalizeNamed(definite, named, map) => JS(
+    '',
+    '''(() => {
+  let key = [];
+  let names = $getOwnPropertyNames($named);
+  let r = {};
+  for (var i = 0; i < names.length; ++i) {
+    let name = names[i];
+    let type = $named[name];
+    if (!definite) r[name] = type = $_normalizeParameter(type);
+    key.push(name);
+    key.push(type);
+  }
+  if (!$definite) $named = r;
+  return $_memoizeArray($map, key, () => $named);
+})()''');
 
-    static _lookupNonTerminal(map, key) {
-      let result = map.get(key);
-      if (result !== void 0) return result;
-      map.set(key, result = new Map());
-      return result;
-    }
+_lookupNonTerminal(map, key) => JS(
+    '',
+    '''(() => {
+  let result = $map.get($key);
+  if (result !== void 0) return result;
+  $map.set($key, result = new Map());
+  return result;
+})()''');
 
-    // TODO(leafp): This handles some low hanging fruit, but
-    // really we should make all of this faster, and also
-    // handle more cases here.
-    static _createSmall(count, definite, returnType, required) {
-      let map = $_fnTypeSmallMap[count];
-      let args = (definite) ? required
-        : required.map(FunctionType._normalizeParameter);
-      for (var i = 0; i < count; ++i) {
-        map = FunctionType._lookupNonTerminal(map, args[i]);
-     }
-     let result = map.get(returnType);
-     if (result !== void 0) return result;
-     result = new FunctionType(returnType, args, [], {});
-     map.set(returnType, result);
-     return result;
+// TODO(leafp): This handles some low hanging fruit, but
+// really we should make all of this faster, and also
+// handle more cases here.
+_createSmall(count, definite, returnType, required) => JS(
+    '',
+    '''(() => {
+  let map = $_fnTypeSmallMap[$count];
+  let args = ($definite) ? $required
+    : $required.map($_normalizeParameter);
+  for (var i = 0; i < $count; ++i) {
+    map = $_lookupNonTerminal(map, args[i]);
+ }
+ let result = map.get($returnType);
+ if (result !== void 0) return result;
+ result = new $FunctionType($returnType, args, [], {});
+ map.set($returnType, result);
+ return result;
+})()''');
+
+class FunctionType extends AbstractFunctionType {
+  final returnType;
+  dynamic args;
+  dynamic optionals;
+  final named;
+  dynamic metadata;
+
+  /**
+   * Construct a function type. There are two arrow constructors,
+   * distinguished by the "definite" flag.
+   *
+   * The fuzzy arrow (definite is false) treats any arguments
+   * of type dynamic as having type bottom, and will always be
+   * called with a dynamic invoke.
+   *
+   * The definite arrow (definite is true) leaves arguments unchanged.
+   *
+   * We eagerly normalize the argument types to avoid having to deal with
+   * this logic in multiple places.
+   *
+   * This code does best effort canonicalization.  It does not guarantee
+   * that all instances will share.
+   *
+   */
+  static create(definite, returnType, args, extra) {
+    // Note that if extra is ever passed as an empty array
+    // or an empty map, we can end up with semantically
+    // identical function types that don't canonicalize
+    // to the same object since we won't fall into this
+    // fast path.
+    if (JS('bool', '# === void 0', extra) && JS('', '#.length < 3', args)) {
+      return _createSmall(JS('', '#.length', args), definite, returnType, args);
     }
-    /**
-     * Construct a function type. There are two arrow constructors,
-     * distinguished by the "definite" flag.
-     *
-     * The fuzzy arrow (definite is false) treats any arguments
-     * of type dynamic as having type bottom, and will always be
-     * called with a dynamic invoke.
-     *
-     * The definite arrow (definite is true) leaves arguments unchanged.
-     *
-     * We eagerly normalize the argument types to avoid having to deal with
-     * this logic in multiple places.
-     *
-     * This code does best effort canonicalization.  It does not guarantee
-     * that all instances will share.
-     *
-     */
-    static create(definite, returnType, args, extra) {
-      // Note that if extra is ever passed as an empty array
-      // or an empty map, we can end up with semantically
-      // identical function types that don't canonicalize
-      // to the same object since we won't fall into this
-      // fast path.
-      if (extra === void 0 && args.length < 3) {
-        return FunctionType._createSmall(
-          args.length, definite, returnType, args);
-      }
-      args = FunctionType._canonicalizeArray(
-        definite, args, $_fnTypeArrayArgMap);
-      let keys;
-      let create;
-      if (extra === void 0) {
-        keys = [returnType, args];
-        create = () => new FunctionType(returnType, args, [], {});
-      } else if (extra instanceof Array) {
-        let optionals =
-          FunctionType._canonicalizeArray(definite, extra, $_fnTypeArrayArgMap);
-        keys = [returnType, args, optionals];
-        create =
-          () => new FunctionType(returnType, args, optionals, {});
+    args = _canonicalizeArray(definite, args, _fnTypeArrayArgMap);
+    var keys;
+    var create;
+    if (JS('bool', '# === void 0', extra)) {
+      keys = [returnType, args];
+      create = () => new FunctionType(returnType, args, [], JS('', '{}'));
+    } else if (JS('bool', '# instanceof Array', extra)) {
+      var optionals = _canonicalizeArray(definite, extra, _fnTypeArrayArgMap);
+      keys = [returnType, args, optionals];
+      create =
+          () => new FunctionType(returnType, args, optionals, JS('', '{}'));
+    } else {
+      var named = _canonicalizeNamed(definite, extra, _fnTypeNamedArgMap);
+      keys = [returnType, args, named];
+      create = () => new FunctionType(returnType, args, [], named);
+    }
+    return _memoizeArray(_fnTypeTypeMap, keys, create);
+  }
+
+  _process(array, metadata) {
+    var result = [];
+    for (var i = 0; JS('bool', '# < #.length', i, array); ++i) {
+      var arg = JS('', '#[#]', array, i);
+      if (JS('bool', '# instanceof Array', arg)) {
+        metadata.add(JS('', '#.slice(1)', arg));
+        result.add(JS('', '#[0]', arg));
       } else {
-        let named =
-          FunctionType._canonicalizeNamed(definite, extra, $_fnTypeNamedArgMap);
-        keys = [returnType, args, named];
-        create = () => new FunctionType(returnType, args, [], named);
+        JS('', '#.push([])', metadata);
+        JS('', '#.push(#)', result, arg);
       }
-      return FunctionType._memoizeArray($_fnTypeTypeMap, keys, create);
     }
-
-    constructor(returnType, args, optionals, named) {
-      super();
-      this.returnType = returnType;
-      this.args = args;
-      this.optionals = optionals;
-      this.named = named;
-
-      // TODO(vsm): This is just parameter metadata for now.
-      this.metadata = [];
-      function process(array, metadata) {
-        var result = [];
-        for (var i = 0; i < array.length; ++i) {
-          var arg = array[i];
-          if (arg instanceof Array) {
-            metadata.push(arg.slice(1));
-            result.push(arg[0]);
-          } else {
-            metadata.push([]);
-            result.push(arg);
-          }
-        }
-        return result;
-      }
-      this.args = process(this.args, this.metadata);
-      this.optionals = process(this.optionals, this.metadata);
-      // TODO(vsm): Add named arguments.
-    }
+    return result;
   }
-''');
 
-final Typedef = JS(
-    '',
-    '''
-  class Typedef extends $AbstractFunctionType {
-    constructor(name, closure) {
-      super();
-      this._name = name;
-      this._closure = closure;
-      this._functionType = null;
-    }
-
-    get name() {
-      return this._name;
-    }
-
-    get functionType() {
-      if (!this._functionType) {
-        this._functionType = this._closure();
-      }
-      return this._functionType;
-    }
-
-    get returnType() {
-      return this.functionType.returnType;
-    }
-
-    get args() {
-      return this.functionType.args;
-    }
-
-    get optionals() {
-      return this.functionType.optionals;
-    }
-
-    get named() {
-      return this.functionType.named;
-    }
-
-    get metadata() {
-      return this.functionType.metadata;
-    }
+  FunctionType(this.returnType, this.args, this.optionals, this.named) {
+    // TODO(vsm): This is just parameter metadata for now.
+    metadata = [];
+    this.args = _process(this.args, metadata);
+    this.optionals = _process(this.optionals, metadata);
+    // TODO(vsm): Add named arguments.
   }
-''');
+}
+
+// TODO(jacobr): we can't define this typedef due to execution order issues.
+//typedef AbstractFunctionType FunctionTypeClosure();
+
+class Typedef extends AbstractFunctionType {
+  dynamic _name;
+  dynamic /*FunctionTypeClosure*/ _closure;
+  AbstractFunctionType _functionType;
+
+  Typedef(this._name, this._closure) {}
+
+  get name {
+    return _name;
+  }
+
+  AbstractFunctionType get functionType {
+    if (_functionType == null) {
+      _functionType = JS('', '#()', _closure);
+    }
+    return _functionType;
+  }
+
+  get returnType {
+    return functionType.returnType;
+  }
+
+  List get args {
+    return functionType.args;
+  }
+
+  List get optionals {
+    return functionType.optionals;
+  }
+
+  get named {
+    return functionType.named;
+  }
+
+  List get metadata {
+    return functionType.metadata;
+  }
+}
+
+typedef(name, /*FunctionTypeClosure*/ closure) {
+  return new Typedef(name, closure);
+}
 
 final _typeFormalCount = JS('', 'Symbol("_typeFormalCount")');
 
@@ -500,9 +513,7 @@
 definiteFunctionType(returnType, args, extra) =>
     _functionType(true, returnType, args, extra);
 
-typedef(name, closure) => JS('', 'new #(#, #)', Typedef, name, closure);
-
-typeName(type) => JS(
+String typeName(type) => JS(
     '',
     '''(() => {
   if ($type === void 0) return "undefined type";
@@ -554,28 +565,28 @@
 /// for a class type.
 getImplicitFunctionType(type) {
   if (isFunctionType(type)) return type;
-  return getMethodTypeFromType(type, 'call');
+  return getMethodType(type, 'call');
 }
 
 bool isFunctionType(type) => JS('bool', '# instanceof # || # === #', type,
     AbstractFunctionType, type, Function);
 
-isLazyJSSubtype(LazyJSType t1, LazyJSType t2, covariant) {
+isLazyJSSubtype(LazyJSType t1, LazyJSType t2, isCovariant) {
   if (t1 == t2) return true;
 
   // All anonymous JS types are subtypes of each other.
   if (t1._jsTypeCallback == null || t2._jsTypeCallback == null) return true;
-  return isClassSubType(t1._rawJSType, t2._rawJSType, covariant);
+  return isClassSubType(t1._rawJSType, t2._rawJSType, isCovariant);
 }
 
 /// Returns true if [ft1] <: [ft2].
 /// Returns false if [ft1] </: [ft2] in both spec and strong mode
 /// Returns null if [ft1] </: [ft2] in strong mode, but spec mode
 /// may differ
-/// If [covariant] is true, then we are checking subtyping in a covariant
+/// If [isCovariant] is true, then we are checking subtyping in a covariant
 /// position, and hence the direction of the check for function types
 /// corresponds to the direction of the check according to the Dart spec.
-isFunctionSubtype(ft1, ft2, covariant) => JS(
+isFunctionSubtype(ft1, ft2, isCovariant) => JS(
     '',
     '''(() => {
   if ($ft2 === $Function) {
@@ -595,11 +606,11 @@
   if (args1.length > args2.length) {
     // If we're in a covariant position, then Dart's arity rules
     // agree with strong mode, otherwise we can't be sure.
-    return ($covariant) ? false : null;
+    return ($isCovariant) ? false : null;
   }
 
   for (let i = 0; i < args1.length; ++i) {
-    if (!$_isSubtype(args2[i], args1[i], !$covariant)) {
+    if (!$_isSubtype(args2[i], args1[i], !$isCovariant)) {
       // Even if isSubtype returns false, assignability
       // means that we can't be definitive
       return null;
@@ -610,18 +621,18 @@
   let optionals2 = $ft2.optionals;
 
   if (args1.length + optionals1.length < args2.length + optionals2.length) {
-    return ($covariant) ? false : null;
+    return ($isCovariant) ? false : null;
   }
 
   let j = 0;
   for (let i = args1.length; i < args2.length; ++i, ++j) {
-    if (!$_isSubtype(args2[i], optionals1[j], !$covariant)) {
+    if (!$_isSubtype(args2[i], optionals1[j], !$isCovariant)) {
       return null;
     }
   }
 
   for (let i = 0; i < optionals2.length; ++i, ++j) {
-    if (!$_isSubtype(optionals2[i], optionals1[j], !$covariant)) {
+    if (!$_isSubtype(optionals2[i], optionals1[j], !$isCovariant)) {
       return null;
     }
   }
@@ -635,9 +646,9 @@
     let n1 = named1[name];
     let n2 = named2[name];
     if (n1 === void 0) {
-      return ($covariant) ? false : null;
+      return ($isCovariant) ? false : null;
     }
-    if (!$_isSubtype(n2, n1, !$covariant)) {
+    if (!$_isSubtype(n2, n1, !$isCovariant)) {
       return null;
     }
   }
@@ -645,12 +656,10 @@
   // Check return type last, so that arity mismatched functions can be
   // definitively rejected.
 
-  // We allow any type to subtype a void return type, but not vice versa
-  if (ret2 === $_void) return true;
-  // Dart allows void functions to subtype dynamic functions, but not
-  // other functions.
-  if (ret1 === $_void) return (ret2 === $dynamic);
-  if (!$_isSubtype(ret1, ret2, $covariant)) return null;
+  // For `void` we will give the same answer as the VM, so don't return null.
+  if (ret1 === $_void) return $_isTop(ret2);
+
+  if (!$_isSubtype(ret1, ret2, $isCovariant)) return null;
   return true;
 })()''');
 
@@ -683,11 +692,17 @@
 final isSubtype = JS(
     '', '$_subtypeMemo((t1, t2) => (t1 === t2) || $_isSubtype(t1, t2, true))');
 
-_isBottom(type) => JS('bool', '# == #', type, bottom);
+_isBottom(type) => JS('bool', '# == # || # == #', type, bottom, type, Null);
 
-_isTop(type) => JS('bool', '# == # || # == #', type, Object, type, dynamic);
+_isTop(type) {
+  if (JS('bool', '# === #', getGenericClass(type), getGenericClass(FutureOr))) {
+    return _isTop(JS('', '#[0]', getGenericArgs(type)));
+  }
+  return JS('bool', '# == # || # == # || # == #',
+      type, Object, type, dynamic, type, _void);
+}
 
-_isSubtype(t1, t2, covariant) => JS(
+_isSubtype(t1, t2, isCovariant) => JS(
     '',
     '''(() => {
   if ($t1 === $t2) return true;
@@ -709,7 +724,7 @@
   // currently distinguish between generic typedefs and classes.
   if (!($t1 instanceof $AbstractFunctionType) &&
       !($t2 instanceof $AbstractFunctionType)) {
-    let result = $isClassSubType($t1, $t2, $covariant);
+    let result = $isClassSubType($t1, $t2, $isCovariant);
     if (result === true || result === null) return result;
   }
 
@@ -721,17 +736,17 @@
   if (!t1) return false;
 
   if ($isFunctionType($t1) && $isFunctionType($t2)) {
-    return $isFunctionSubtype($t1, $t2, $covariant);
+    return $isFunctionSubtype($t1, $t2, $isCovariant);
   }
   
   if ($t1 instanceof $LazyJSType && $t2 instanceof $LazyJSType) {
-    return $isLazyJSSubtype($t1, $t2, $covariant);
+    return $isLazyJSSubtype($t1, $t2, $isCovariant);
   }
   
   return false;
 })()''');
 
-isClassSubType(t1, t2, covariant) => JS(
+isClassSubType(t1, t2, isCovariant) => JS(
     '',
     '''(() => {
   // We support Dart's covariant generics with the caveat that we do not
@@ -765,7 +780,7 @@
     $assert_(length == typeArguments2.length);
     for (let i = 0; i < length; ++i) {
       let result =
-          $_isSubtype(typeArguments1[i], typeArguments2[i], $covariant);
+          $_isSubtype(typeArguments1[i], typeArguments2[i], $isCovariant);
       if (!result) {
         return result;
       }
@@ -773,9 +788,25 @@
     return true;
   }
 
+  // Handle FutureOr<T>.
+  // It's not really a class type, but it's convenient to handle here.
+  if (raw1 === ${getGenericClass(FutureOr)}) {
+    // given t1 is Future<A> | A, then:
+    // (Future<A> | A) <: t2 iff Future<A> <: t2 and A <: t2.
+    let t1TypeArg = $getGenericArgs($t1)[0];
+    let t1Future = ${getGenericClass(Future)}(t1TypeArg);
+    return $isSubtype(t1Future, $t2) && $isSubtype(t1TypeArg, $t2);
+  } else if (raw2 === ${getGenericClass(FutureOr)}) {
+    // given t2 is Future<A> | A, then:
+    // t1 <: (Future<A> | A) iff t1 <: Future<A> or t1 <: A
+    let t2TypeArg = $getGenericArgs($t2)[0];
+    let t2Future = ${getGenericClass(Future)}(t2TypeArg);
+    return $isSubtype($t1, t2Future) || $isSubtype($t1, t2TypeArg);
+  }
+
   let indefinite = false;
   function definitive(t1, t2) {
-    let result = $isClassSubType(t1, t2, $covariant);
+    let result = $isClassSubType(t1, t2, $isCovariant);
     if (result == null) {
       indefinite = true;
       return false;
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart
index a604423..154410e 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart
@@ -24,13 +24,13 @@
 /// This error indicates a strong mode specific failure, other than a type
 /// assertion failure (TypeError) or CastError.
 void throwStrongModeError(String message) {
-  JS('', 'debugger');
+  if (_trapRuntimeErrors) JS('', 'debugger');
   JS('', 'throw new #(#);', StrongModeErrorImplementation, message);
 }
 
 /// This error indicates a bug in the runtime or the compiler.
 void throwInternalError(String message) {
-  JS('', 'debugger');
+  if (_trapRuntimeErrors) JS('', 'debugger');
   JS('', 'throw Error(#)', message);
 }
 
@@ -98,7 +98,7 @@
     // On native types, Symbol.iterator may already be present.
     // TODO(jmesserly): investigate if we still need this.
     // If so, we need to find a better solution.
-    // See: https://github.com/dart-lang/dev_compiler/issues/487
+    // See https://github.com/dart-lang/sdk/issues/28324
     var existing = getOwnPropertyDescriptor(to, name);
     if (existing != null) {
       if (JS('bool', '#.writable', existing)) {
diff --git a/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart b/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart
index daa0e77..4c84cc9 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/interceptors.dart
@@ -98,7 +98,7 @@
 // dart:html can be used in dart2js an dev compiler.
 // Warning: calls to these methods need to be removed before custom elements
 // and cross-frame dom objects behave correctly in ddc.
-// See https://github.com/dart-lang/dev_compiler/issues/517
+// See https://github.com/dart-lang/sdk/issues/28326
 findInterceptorConstructorForType(Type type) { }
 findConstructorForNativeSubclassType(Type type, String name) { }
 getNativeInterceptor(object) {}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart
index bb56c25..975dde7 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/isolate_helper.dart
@@ -245,18 +245,19 @@
         "(function (f, a) { return function (e) { f(a, e); }})(#, #)",
         IsolateNatives._processWorkerMessage,
         mainManager);
-    JS("void", r"self.onmessage = #", function);
+    JS("void", r"#.onmessage = #", global, function);
     // We ensure dartPrint is defined so that the implementation of the Dart
     // print method knows what to call.
-    JS('', '''self.dartPrint = self.dartPrint || (function(serialize) {
+    JS('', '''#.dartPrint = #.dartPrint || (function(serialize) {
   return function (object) {
-    if (self.console && self.console.log) {
-      self.console.log(object)
+    var _self = #;
+    if (_self.console && _self.console.log) {
+      _self.console.log(object)
     } else {
-      self.postMessage(serialize(object));
+      _self.postMessage(serialize(object));
     }
   }
-})(#)''', _serializePrintMessage);
+})(#)''', global, global, global, _serializePrintMessage);
   }
 
   static _serializePrintMessage(object) {
@@ -429,8 +430,8 @@
         // don't print it.
         return;
       }
-      if (JS('bool', 'self.console && self.console.error')) {
-        JS('void', 'self.console.error(#, #)', error, stackTrace);
+      if (JS('bool', '#.console && #.console.error', global, global)) {
+        JS('void', '#.console.error(#, #)', global, error, stackTrace);
       } else {
         print(error);
         if (stackTrace != null) print(stackTrace);
@@ -700,13 +701,13 @@
 //
 // See: http://www.w3.org/TR/workers/#the-global-scope
 // and: http://www.w3.org/TR/Window/#dfn-self-attribute
-final _global =
+final global =
   JS("", "typeof global == 'undefined' ? self : global");
 
 /** A stub for interacting with the main manager. */
 class _MainManagerStub {
   void postMessage(msg) {
-    JS("void", r"#.postMessage(#)", _global, msg);
+    JS("void", r"#.postMessage(#)", global, msg);
   }
 }
 
@@ -714,14 +715,14 @@
 const String _SPAWN_FAILED_SIGNAL = "spawn failed";
 
 get globalWindow {
-  return JS('', "#.window", _global);
+  return JS('', "#.window", global);
 }
 
 get globalWorker {
-  return JS('', "#.Worker", _global);
+  return JS('', "#.Worker", global);
 }
 bool get globalPostMessageDefined {
-  return JS('bool', "!!#.postMessage", _global);
+  return JS('bool', "!!#.postMessage", global);
 }
 
 typedef _MainFunction();
@@ -906,7 +907,7 @@
   }
 
   static void _consoleLog(msg) {
-    JS("void", r"self.console.log(#)", msg);
+    JS("void", r"#.console.log(#)", global, msg);
   }
 
   static _getJSFunctionFromName(String functionName) {
@@ -1372,7 +1373,7 @@
       enterJsAsync();
 
       _handle = JS(
-          'int', 'self.setTimeout(#, #)', internalCallback, milliseconds);
+          'int', '#.setTimeout(#, #)', global, internalCallback, milliseconds);
     } else {
       assert(milliseconds > 0);
       throw new UnsupportedError("Timer greater than 0.");
@@ -1383,8 +1384,8 @@
       : _once = false {
     if (hasTimer()) {
       enterJsAsync();
-      _handle = JS('int', 'self.setInterval(#, #)',
-          () { callback(this); }, milliseconds);
+      _handle = JS('int', '#.setInterval(#, #)',
+          global, () { callback(this); }, milliseconds);
     } else {
       throw new UnsupportedError("Periodic timer.");
     }
@@ -1398,9 +1399,9 @@
       if (_handle == null) return;
       leaveJsAsync();
       if (_once) {
-        JS('void', 'self.clearTimeout(#)', _handle);
+        JS('void', '#.clearTimeout(#)', global, _handle);
       } else {
-        JS('void', 'self.clearInterval(#)', _handle);
+        JS('void', '#.clearInterval(#)', global, _handle);
       }
       _handle = null;
     } else {
@@ -1412,7 +1413,7 @@
 }
 
 bool hasTimer() {
-  return JS('', 'self.setTimeout') != null;
+  return JS('', '#.setTimeout', global) != null;
 }
 
 
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
index 351d94d..a20547b 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
@@ -851,6 +851,17 @@
 }
 
 /**
+ * Error thrown when an assert() fails with a message:
+ *
+ *     assert(false, "Message here");
+ */
+class AssertionErrorWithMessage extends AssertionError {
+  final Object _message;
+  AssertionErrorWithMessage(this._message);
+  String toString() => "Assertion failed: ${_message}";
+}
+
+/**
  * Creates a random number with 64 bits of randomness.
  *
  * This will be truncated to the 53 bits available in a double.
@@ -867,8 +878,8 @@
 }
 
 
-// TODO(jmesserly): this adapter is to work around:
-// https://github.com/dart-lang/dev_compiler/issues/247
+// TODO(jmesserly): this adapter is to work around
+// https://github.com/dart-lang/sdk/issues/28320
 class SyncIterator<E> implements Iterator<E> {
   final dynamic _jsIterator;
   E _current;
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
index 8560096..62cb4a6 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
@@ -31,7 +31,8 @@
 
 TypeMirror reflectType(Type key) {
   var unwrapped = _unwrap(key);
-  var property = JS('', 'Object.getOwnPropertyDescriptor(#, #)', unwrapped, _typeMirror);
+  var property =
+      JS('', 'Object.getOwnPropertyDescriptor(#, #)', unwrapped, _typeMirror);
   if (property != null) {
     return JS('', '#.value', property);
   }
@@ -44,11 +45,11 @@
 final dynamic _dart = JS('', 'dart');
 
 dynamic _dload(obj, String name) {
-  return JS('', '#.dload(#, #)', _dart, obj, name);
+  return JS('', '#.dloadMirror(#, #)', _dart, obj, name);
 }
 
 void _dput(obj, String name, val) {
-  JS('', '#.dput(#, #, #)', _dart, obj, name, val);
+  JS('', '#.dputMirror(#, #, #)', _dart, obj, name, val);
 }
 
 dynamic _dcall(obj, List args) {
@@ -85,7 +86,24 @@
   if (privateSymbol != null) {
     return privateSymbol;
   }
-  return getName(symbol);
+  var name = getName(symbol);
+  // TODO(jacobr): this code is duplicated in code_generator.dart
+  switch (name) {
+    case '[]':
+      name = '_get';
+      break;
+    case '[]=':
+      name = '_set';
+      break;
+    case 'unary-':
+      name = '_negate';
+      break;
+    case 'constructor':
+    case 'prototype':
+      name = '_$name';
+      break;
+  }
+  return name;
 }
 
 String _getNameForESSymbol(member) {
@@ -184,8 +202,7 @@
 
 dynamic _wrap(obj) => JS('', '#.wrapType(#)', _dart, obj);
 
-dynamic _runtimeType(obj) =>
-  _wrap(JS('', '#.getReifiedType(#)', _dart, obj));
+dynamic _runtimeType(obj) => _wrap(JS('', '#.getReifiedType(#)', _dart, obj));
 
 _unimplemented(Type t, Invocation i) {
   throw new UnimplementedError('$t.${getName(i.memberName)} unimplemented');
@@ -205,23 +222,18 @@
   }
 }
 
-class JsCombinatorMirror extends JsMirror implements CombinatorMirror {
-}
+class JsCombinatorMirror extends JsMirror implements CombinatorMirror {}
 
-class JsDeclarationMirror extends JsMirror implements DeclarationMirror {
-}
+class JsDeclarationMirror extends JsMirror implements DeclarationMirror {}
 
-class JsIsolateMirror extends JsMirror implements IsolateMirror {
-}
+class JsIsolateMirror extends JsMirror implements IsolateMirror {}
 
-class JsLibraryDependencyMirror extends JsMirror implements LibraryDependencyMirror {
-}
+class JsLibraryDependencyMirror extends JsMirror
+    implements LibraryDependencyMirror {}
 
-class JsObjectMirror extends JsMirror implements ObjectMirror {
-}
+class JsObjectMirror extends JsMirror implements ObjectMirror {}
 
 class JsInstanceMirror extends JsObjectMirror implements InstanceMirror {
-
   // Reflected object
   final reflectee;
   bool get hasReflectee => true;
@@ -235,7 +247,7 @@
 
   JsInstanceMirror._(this.reflectee);
 
-  bool operator==(Object other) {
+  bool operator ==(Object other) {
     return (other is JsInstanceMirror) && identical(reflectee, other.reflectee);
   }
 
@@ -246,8 +258,8 @@
   }
 
   // Returns a String for public members or an ES6 symbol for private members.
-  _getAccessor(dynamic reflectee, Symbol symbol, [List<dynamic> args,
-      Map<Symbol, dynamic> namedArgs]) {
+  _getAccessor(dynamic reflectee, Symbol symbol,
+      [List<dynamic> args, Map<Symbol, dynamic> namedArgs]) {
     return _getMember(symbol);
   }
 
@@ -280,8 +292,7 @@
 class JsClosureMirror extends JsInstanceMirror implements ClosureMirror {
   JsClosureMirror._(reflectee) : super._(reflectee);
 
-  InstanceMirror apply(List<dynamic> args,
-      [Map<Symbol, dynamic> namedArgs]) {
+  InstanceMirror apply(List<dynamic> args, [Map<Symbol, dynamic> namedArgs]) {
     if (namedArgs != null) {
       args = new List.from(args);
       args.add(_toJsMap(namedArgs));
@@ -310,13 +321,14 @@
       var unwrapped = _unwrap(_cls);
       // Only get metadata directly embedded on this class, not its
       // superclasses.
-      var fn = JS('Function',
-        'Object.hasOwnProperty.call(#, dart.metadata) ? #[dart.metadata] : null',
-        unwrapped, unwrapped);
+      var fn = JS(
+          'Function',
+          'Object.hasOwnProperty.call(#, dart.metadata) ? #[dart.metadata] : null',
+          unwrapped,
+          unwrapped);
       _metadata = (fn == null)
           ? const <InstanceMirror>[]
-          : new List<InstanceMirror>.unmodifiable(
-              fn().map((i) => reflect(i)));
+          : new List<InstanceMirror>.unmodifiable(fn().map((i) => reflect(i)));
     }
     return _metadata;
   }
@@ -330,14 +342,16 @@
       var constructors = _getConstructors(unwrapped);
       constructors.forEach((symbol, ft) {
         var name = getName(symbol);
-        _declarations[symbol] = new JsMethodMirror._constructor(this, symbol, ft);
+        _declarations[symbol] =
+            new JsMethodMirror._constructor(this, symbol, ft);
       });
       if (constructors.isEmpty) {
         // Add a default
         var name = 'new';
         var ft = _defaultConstructorType(_unwrap(_cls));
         var symbol = new Symbol(name);
-        _declarations[symbol] = new JsMethodMirror._constructor(this, symbol, ft);
+        _declarations[symbol] =
+            new JsMethodMirror._constructor(this, symbol, ft);
       }
       var fields = _getFields(unwrapped);
       fields.forEach((symbol, t) {
@@ -346,24 +360,28 @@
           metadata = t.skip(1).toList();
           t = t[0];
         }
-        _declarations[symbol] = new JsVariableMirror._(symbol, _wrap(t), metadata);
+        _declarations[symbol] =
+            new JsVariableMirror._(symbol, _wrap(t), metadata);
       });
       var methods = _getMethods(unwrapped);
       methods.forEach((symbol, ft) {
         var name = getName(symbol);
-        _declarations[symbol] = new JsMethodMirror._instanceMethod(this, symbol, ft);
+        _declarations[symbol] =
+            new JsMethodMirror._instanceMethod(this, symbol, ft);
       });
       var getters = _getGetters(unwrapped);
       getters.forEach((symbol, ft) {
         var name = getName(symbol);
-        _declarations[symbol] = new JsMethodMirror._instanceMethod(this, symbol, ft);
+        _declarations[symbol] =
+            new JsMethodMirror._instanceMethod(this, symbol, ft);
       });
       var setters = _getSetters(unwrapped);
       setters.forEach((symbol, ft) {
         var name = getName(symbol) + '=';
         // Create a separate symbol for the setter.
         symbol = new _internal.Symbol.es6(name, _getESSymbol(symbol));
-        _declarations[symbol] = new JsMethodMirror._instanceMethod(this, symbol, ft);
+        _declarations[symbol] =
+            new JsMethodMirror._instanceMethod(this, symbol, ft);
       });
       var staticFields = _getStaticFields(unwrapped);
       staticFields.forEach((symbol, t) {
@@ -373,24 +391,29 @@
           metadata = t.skip(1).toList();
           t = t[0];
         }
-        _declarations[symbol] = new JsVariableMirror._(symbol, _wrap(t), metadata);
+        _declarations[symbol] =
+            new JsVariableMirror._(symbol, _wrap(t), metadata);
       });
       var statics = _getStatics(unwrapped);
       statics.forEach((symbol, ft) {
         var name = getName(symbol);
-        _declarations[symbol] = new JsMethodMirror._staticMethod(this, symbol, ft);
+        _declarations[symbol] =
+            new JsMethodMirror._staticMethod(this, symbol, ft);
       });
       var staticGetters = _getStaticGetters(unwrapped);
       staticGetters.forEach((symbol, ft) {
         var name = getName(symbol);
-        _declarations[symbol] = new JsMethodMirror._staticMethod(this, symbol, ft);
+        _declarations[symbol] =
+            new JsMethodMirror._staticMethod(this, symbol, ft);
       });
       var staticSetters = _getStaticSetters(unwrapped);
       staticSetters.forEach((symbol, ft) {
         var name = getName(symbol);
-        _declarations[symbol] = new JsMethodMirror._staticMethod(this, symbol, ft);
+        _declarations[symbol] =
+            new JsMethodMirror._staticMethod(this, symbol, ft);
       });
-      _declarations = new Map<Symbol, DeclarationMirror>.unmodifiable(_declarations);
+      _declarations =
+          new Map<Symbol, DeclarationMirror>.unmodifiable(_declarations);
     }
     return _declarations;
   }
@@ -401,9 +424,10 @@
         simpleName = new Symbol(JS('String', '#.name', _unwrap(cls))) {
     var typeArgs = _getGenericArgs(_unwrap(cls));
     if (typeArgs == null) {
-      _typeArguments = const[];
+      _typeArguments = const [];
     } else {
-      _typeArguments = new List.unmodifiable(typeArgs.map((t) => reflectType(_wrap(t))));
+      _typeArguments =
+          new List.unmodifiable(typeArgs.map((t) => reflectType(_wrap(t))));
     }
   }
 
@@ -413,8 +437,8 @@
     var name = getName(constructorName);
     assert(namedArgs == null || namedArgs.isEmpty);
     var instance = (name == 'new' || name == '')
-      ? JS('', 'new #(...#)', _unwrap(_cls), args)
-      : JS('', 'new (#.#)(...#)', _unwrap(_cls), name, args);
+        ? JS('', 'new #(...#)', _unwrap(_cls), args)
+        : JS('', 'new (#.#)(...#)', _unwrap(_cls), name, args);
     return reflect(instance);
   }
 
@@ -445,7 +469,8 @@
   }
 
   List<ClassMirror> get superinterfaces {
-    _Lazy<List<Type>> interfaceThunk = JS('', '#[dart.implements]', _unwrap(_cls));
+    _Lazy<List<Type>> interfaceThunk =
+        JS('', '#[dart.implements]', _unwrap(_cls));
     if (interfaceThunk == null) {
       return [];
     } else {
@@ -455,7 +480,9 @@
   }
 
   bool get hasReflectedType => true;
-  Type get reflectedType { return _cls; }
+  Type get reflectedType {
+    return _cls;
+  }
 
   bool get isOriginalDeclaration => _raw == null;
 
@@ -467,7 +494,8 @@
     if (_raw == null) {
       return this;
     }
-    throw new UnimplementedError("ClassMirror.originalDeclaration unimplemented");
+    throw new UnimplementedError(
+        "ClassMirror.originalDeclaration unimplemented");
   }
 
   ClassMirror get superclass {
@@ -490,7 +518,7 @@
     }
     if (mixins.length > 1) {
       throw new UnsupportedError("ClassMirror.mixin not yet supported for "
-        "classes ($_cls) with multiple mixins");
+          "classes ($_cls) with multiple mixins");
     }
     _mixin = reflectType(_wrap(mixins[0]));
     return _mixin;
@@ -546,18 +574,27 @@
   Symbol get simpleName => _symbol;
 
   JsMethodMirror._constructor(JsClassMirror cls, Symbol symbol, ftype)
-    : _symbol = symbol, _name = getName(symbol), isConstructor = true, isStatic = false {
-      _createParameterMirrorList(ftype);
+      : _symbol = symbol,
+        _name = getName(symbol),
+        isConstructor = true,
+        isStatic = false {
+    _createParameterMirrorList(ftype);
   }
 
   JsMethodMirror._instanceMethod(JsClassMirror cls, Symbol symbol, ftype)
-    : _symbol = symbol, _name = getName(symbol), isConstructor = false, isStatic = false {
-      _createParameterMirrorList(ftype);
+      : _symbol = symbol,
+        _name = getName(symbol),
+        isConstructor = false,
+        isStatic = false {
+    _createParameterMirrorList(ftype);
   }
 
   JsMethodMirror._staticMethod(JsClassMirror cls, Symbol symbol, ftype)
-    : _symbol = symbol, _name = getName(symbol), isConstructor = false, isStatic = true {
-      _createParameterMirrorList(ftype);
+      : _symbol = symbol,
+        _name = getName(symbol),
+        isConstructor = false,
+        isStatic = true {
+    _createParameterMirrorList(ftype);
   }
 
   // TODO(vsm): Support named constructors.
@@ -600,7 +637,8 @@
       var type = args[i];
       var metadata = ftype.metadata[i];
       // TODO(vsm): Recover the param name.
-      var param = new JsParameterMirror._(new Symbol(''), _wrap(type), metadata);
+      var param =
+          new JsParameterMirror._(new Symbol(''), _wrap(type), metadata);
       params[i] = param;
     }
 
@@ -608,7 +646,8 @@
       var type = opts[i];
       var metadata = ftype.metadata[args.length + i];
       // TODO(vsm): Recover the param name.
-      var param = new JsParameterMirror._(new Symbol(''), _wrap(type), metadata);
+      var param =
+          new JsParameterMirror._(new Symbol(''), _wrap(type), metadata);
       params[i + args.length] = param;
     }
 
diff --git a/pkg/dev_compiler/tool/input_sdk/private/native_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/native_helper.dart
index de77f66..335805b 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/native_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/native_helper.dart
@@ -24,8 +24,8 @@
 }
 
 // Warning: calls to these methods need to be removed before custom elements
-// and cross-frame dom objects behave correctly in ddc.
-// See https://github.com/dart-lang/dev_compiler/issues/517
+// and cross-frame dom objects behave correctly in ddc
+// https://github.com/dart-lang/sdk/issues/28326
 setNativeSubclassDispatchRecord(proto, interceptor) { }
 findDispatchTagForInterceptorClass(interceptorClassConstructor) {}
 makeLeafDispatchRecord(interceptor) {}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/preambles/d8.js b/pkg/dev_compiler/tool/input_sdk/private/preambles/d8.js
index aed0161..c330ad8 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/preambles/d8.js
+++ b/pkg/dev_compiler/tool/input_sdk/private/preambles/d8.js
@@ -33,7 +33,6 @@
   self.location = { href: "file://" + workingDirectory + "/" };
 
   // Event loop.
-
   // Task queue as cyclic list queue.
   var taskQueue = new Array(8);  // Length is power of 2.
   var head = 0;
@@ -77,7 +76,7 @@
   // That field is cleared when the timer is cancelled, but it is not returned
   // from the queue until its time comes.
   var timerIds = {};
-  var timerIdCounter = 1;  // Counter used to assing ids.
+  var timerIdCounter = 1;  // Counter used to assign ids.
 
   // Zero-timer queue as simple array queue using push/shift.
   var zeroTimerQueue = [];
diff --git a/pkg/dev_compiler/tool/run.js b/pkg/dev_compiler/tool/run.js
index 7306964..6783750 100644
--- a/pkg/dev_compiler/tool/run.js
+++ b/pkg/dev_compiler/tool/run.js
@@ -45,6 +45,7 @@
 var module = requirejs(test);
 var lib = test.split('/').slice(-1)[0];
 try {
+  sdk._isolate_helper.startRootIsolate(() => {}, []);
   module[lib].main();
   console.log('Test ' + test + ' passed.');
 } catch (e) {
diff --git a/pkg/dev_compiler/tool/sdk_expected_errors.txt b/pkg/dev_compiler/tool/sdk_expected_errors.txt
index 80eacbc..381ac61 100644
--- a/pkg/dev_compiler/tool/sdk_expected_errors.txt
+++ b/pkg/dev_compiler/tool/sdk_expected_errors.txt
@@ -1,5 +1,6 @@
 [error] Couldn't infer type parameter 'T'; '_ControllerEventSinkWrapper<dynamic>' must be of type 'EventSink<T>'. (dart:async/stream.dart, line 1346, col 16)
 [error] The argument type '_ControllerEventSinkWrapper' can't be assigned to the parameter type 'EventSink<T>'. (dart:async/stream.dart, line 1346, col 53)
+[error] Type parameter bound types must be instantiated. (dart:collection/queue.dart, line 99, col 29)
 [error] Invalid override. The type of 'ChunkedConverter.bind' ('(dynamic) → dynamic') isn't a subtype of 'Converter<S, T>.bind' ('(Stream<S>) → Stream<T>'). (dart:convert/chunked_conversion.dart, line 14, col 3)
 [error] Invalid override. The type of 'ChunkedConverter.bind' ('(dynamic) → dynamic') isn't a subtype of 'StreamTransformer<S, T>.bind' ('(Stream<S>) → Stream<T>'). (dart:convert/chunked_conversion.dart, line 14, col 3)
 [error] Invalid override. The type of 'ChunkedConverter.startChunkedConversion' ('(dynamic) → dynamic') isn't a subtype of 'Converter<S, T>.startChunkedConversion' ('(Sink<T>) → Sink<S>'). (dart:convert/chunked_conversion.dart, line 15, col 3)
@@ -9,7 +10,30 @@
 [error] Const constructors can't throw exceptions. (dart:core/int.dart, line 34, col 5)
 [error] Only redirecting factory constructors can be declared to be 'const'. (dart:core/string.dart, line 156, col 9)
 [error] Const constructors can't throw exceptions. (dart:core/string.dart, line 157, col 5)
-[error] Invalid override. The type of '_EventStreamSubscription.asFuture' ('([dynamic]) → Future<dynamic>') isn't a subtype of 'StreamSubscription<T>.asFuture' ('<E>([E]) → Future<E>'). (dart:html, line 40152, col 3)
+[error] Couldn't infer type parameter 'S'; 'RandomAccessFile' must be of type 'File'. (dart:io/file_impl.dart, line 216, col 19)
+[error] The argument type '(RandomAccessFile) → Future<RandomAccessFile>' can't be assigned to the parameter type '(RandomAccessFile) → FutureOr<File>'. (dart:io/file_impl.dart, line 216, col 24)
+[error] The return type 'Future' isn't a 'FutureOr<File>', as defined by the method ''. (dart:io/file_impl.dart, line 545, col 14)
+[error] The return type 'StreamSubscription<int>' isn't a 'StreamSubscription<List<int>>', as defined by the method 'listen'. (dart:io/http_parser.dart, line 208, col 14)
+[error] The argument type '(List<int>) → void' can't be assigned to the parameter type '(int) → void'. (dart:io/http_parser.dart, line 209, col 19)
+[error] Couldn't infer type parameter 'V'; 'Object' must be of type 'String'. (dart:io/io_resource_info.dart, line 27, col 7)
+[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 30, col 15)
+[error] Couldn't infer type parameter 'V'; 'Object' must be of type 'String'. (dart:io/io_resource_info.dart, line 75, col 5)
+[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 77, col 13)
+[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 79, col 20)
+[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 80, col 23)
+[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 81, col 20)
+[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 82, col 21)
+[error] The element type 'double' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 83, col 19)
+[error] The element type 'double' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 84, col 20)
+[error] Couldn't infer type parameter 'V'; 'Object' must be of type 'String'. (dart:io/io_resource_info.dart, line 159, col 5)
+[error] The element type 'int' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 161, col 13)
+[error] The element type 'double' can't be assigned to the map value type 'String'. (dart:io/io_resource_info.dart, line 164, col 20)
+[error] The argument type 'List' can't be assigned to the parameter type 'Iterable<int>'. (dart:io/secure_socket.dart, line 1129, col 23)
+[error] Undefined name 'lineMode'. (dart:io/stdio.dart, line 64, col 10)
+[error] The name 'echoMode=' is already defined. (dart:io/stdio.dart, line 126, col 12)
+[error] The name 'lineMode=' is already defined. (dart:io/stdio.dart, line 145, col 12)
+[error] Couldn't infer type parameter 'S'; 'dynamic' must be of type 'WebSocket'. (dart:io/websocket_impl.dart, line 469, col 10)
+[error] The argument type '(String) → Future<dynamic>' can't be assigned to the parameter type '(dynamic) → FutureOr<WebSocket>'. (dart:io/websocket_impl.dart, line 469, col 15)
 [error] Invalid override. The type of 'JsArray.[]=' ('(Object, E) → void') isn't a subtype of 'JsObject.[]=' ('(Object, dynamic) → dynamic'). (dart:js, line 363, col 3)
 [warning] Unsafe implicit cast from 'List<dynamic>' to 'List<String>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:_js_helper/regexp_helper.dart, line 140, col 43)
 [warning] Unsafe implicit cast from 'List<dynamic>' to 'List<String>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:_js_helper/regexp_helper.dart, line 152, col 43)
@@ -48,8 +72,29 @@
 [warning] The final variables 'form', 'labels' and '5' more must be initialized. (dart:html, line 32069, col 3)
 [warning] The final variables 'readyState' and 'track' must be initialized. (dart:html, line 33056, col 3)
 [warning] The final variables 'decodedFrameCount', 'droppedFrameCount' and '2' more must be initialized. (dart:html, line 33754, col 3)
-[warning] Unsafe implicit cast from '(T) → void' to '(Event) → dynamic'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:html, line 40090, col 67)
-[warning] Unsafe implicit cast from '(T) → void' to '(Event) → dynamic'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:html, line 40112, col 45)
+[warning] Unsafe implicit cast from '(T) → void' to '(Event) → dynamic'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:html, line 40126, col 45)
+[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/data_transformer.dart, line 492, col 23)
+[warning] Unsafe implicit cast from 'Stream<dynamic>' to 'Stream<FileSystemEntity>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/directory_impl.dart, line 239, col 12)
+[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/file_impl.dart, line 484, col 14)
+[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/file_impl.dart, line 831, col 33)
+[warning] Unsafe implicit cast from 'StreamSubscription<dynamic>' to 'StreamSubscription<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 269, col 14)
+[warning] Unsafe implicit cast from 'Stream<dynamic>' to 'Stream<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 1056, col 29)
+[warning] Unsafe implicit cast from 'Function' to '(List<int>) → void'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 1173, col 54)
+[warning] Unsafe implicit cast from 'Function' to '(List<int>) → void'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 1175, col 33)
+[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<_ConnectionInfo>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_impl.dart, line 1635, col 14)
+[warning] Unsafe implicit cast from 'StreamSubscription<dynamic>' to 'StreamSubscription<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_parser.dart, line 201, col 16)
+[warning] Unsafe implicit cast from 'StreamSubscription<dynamic>' to 'StreamSubscription<List<int>>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/http_parser.dart, line 203, col 50)
+[warning] Unsafe implicit cast from 'Map<dynamic, dynamic>' to 'Map<String, String>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/platform_impl.dart, line 100, col 69)
+[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<SecureSocket>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 92, col 12)
+[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<SecureSocket>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 138, col 12)
+[warning] Unsafe implicit cast from 'StreamSubscription<dynamic>' to 'StreamSubscription<RawSocketEvent>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 446, col 33)
+[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<RawSecureSocket>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 580, col 12)
+[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/secure_socket.dart, line 1176, col 32)
+[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/stdio.dart, line 109, col 28)
+[warning] Unsafe implicit cast from 'Future<dynamic>' to 'Future<WebSocket>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/websocket_impl.dart, line 471, col 14)
+[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/websocket_impl.dart, line 577, col 21)
+[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/websocket_impl.dart, line 590, col 35)
+[warning] Unsafe implicit cast from 'List<dynamic>' to 'List<int>'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:io/websocket_impl.dart, line 626, col 12)
 [warning] Unsafe implicit cast from 'num' to 'T'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:math/rectangle.dart, line 158, col 22)
 [warning] Unsafe implicit cast from 'num' to 'T'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:math/rectangle.dart, line 159, col 23)
 [warning] Unsafe implicit cast from 'num' to 'T'. This usually indicates that type information was lost and resulted in 'dynamic' and/or a place that will have a failure at runtime. (dart:math/rectangle.dart, line 282, col 10)
diff --git a/pkg/dev_compiler/web/web_command.dart b/pkg/dev_compiler/web/web_command.dart
index bc4c1ad..91a5696 100644
--- a/pkg/dev_compiler/web/web_command.dart
+++ b/pkg/dev_compiler/web/web_command.dart
@@ -18,7 +18,6 @@
 import 'package:analyzer/file_system/memory_file_system.dart'
     show MemoryResourceProvider;
 import 'package:analyzer/src/context/context.dart' show AnalysisContextImpl;
-import 'package:analyzer/src/generated/source.dart' show DartUriResolver;
 import 'package:analyzer/src/summary/idl.dart' show PackageBundle;
 import 'package:analyzer/src/summary/package_bundle_reader.dart'
     show
@@ -27,7 +26,6 @@
         InputPackagesResultProvider,
         InSummarySource;
 import 'package:analyzer/src/dart/resolver/scope.dart' show Scope;
-import 'package:analyzer/src/summary/summary_sdk.dart' show SummaryBasedDartSdk;
 
 import 'package:args/command_runner.dart';
 
@@ -95,13 +93,12 @@
 
   CompileModule setUpCompile(List<int> sdkBytes, List<List<int>> summaryBytes,
       List<String> summaryUrls) {
-    var resourceProvider = new MemoryResourceProvider();
-    var resourceUriResolver = new ResourceUriResolver(resourceProvider);
+    var dartSdkSummaryPath = '/dart-sdk/lib/_internal/web_sdk.sum';
 
-    var packageBundle = new PackageBundle.fromBuffer(sdkBytes);
-    var webDartSdk = new SummaryBasedDartSdk.fromBundle(
-        true, packageBundle, resourceProvider);
-    var sdkResolver = new DartUriResolver(webDartSdk);
+    var resourceProvider = new MemoryResourceProvider()
+      ..newFileWithBytes(dartSdkSummaryPath, sdkBytes);
+
+    var resourceUriResolver = new ResourceUriResolver(resourceProvider);
 
     var summaryDataStore = new SummaryDataStore([]);
     for (var i = 0; i < summaryBytes.length; i++) {
@@ -116,8 +113,9 @@
     var fileResolvers = [summaryResolver, resourceUriResolver];
 
     var compiler = new ModuleCompiler(
-        new AnalyzerOptions(dartSdkPath: '/dart-sdk'),
-        sdkResolver: sdkResolver,
+        new AnalyzerOptions.basic(
+            dartSdkPath: '/dart-sdk', dartSdkSummaryPath: dartSdkSummaryPath),
+        analysisRoot: '/web-compile-root',
         fileResolvers: fileResolvers,
         resourceProvider: resourceProvider);
 
@@ -209,7 +207,8 @@
           code: moduleCode, isValid: module.isValid, errors: module.errors);
     };
 
-    return allowInterop(compileFn);
+    // TODO(vsm): Cast is due to https://github.com/dart-lang/sdk/issues/28507
+    return allowInterop(compileFn) as CompileModule;
   }
 }
 
diff --git a/pkg/front_end/lib/compiler_options.dart b/pkg/front_end/lib/compiler_options.dart
index f9f2f29..731344c 100644
--- a/pkg/front_end/lib/compiler_options.dart
+++ b/pkg/front_end/lib/compiler_options.dart
@@ -6,6 +6,10 @@
 
 import 'compilation_error.dart';
 import 'file_system.dart';
+import 'physical_file_system.dart';
+
+/// Default error handler used by [CompielerOptions.onError].
+void defaultErrorHandler(CompilationError error) => throw error;
 
 /// Callback used to report errors encountered during compilation.
 typedef void ErrorHandler(CompilationError error);
@@ -14,68 +18,72 @@
 ///
 /// Not intended to be implemented or extended by clients.
 class CompilerOptions {
-  /// The path to the Dart SDK.
+  /// The URI of the root of the Dart SDK (typically a "file:" URI).
   ///
   /// If `null`, the SDK will be searched for using
   /// [Platform.resolvedExecutable] as a starting point.
   ///
   /// This option is mutually exclusive with [sdkSummary].
-  String sdkPath;
+  Uri sdkRoot;
 
   /// Callback to which compilation errors should be delivered.
   ///
-  /// If `null`, the first error will be reported by throwing an exception of
+  /// By default, the first error will be reported by throwing an exception of
   /// type [CompilationError].
-  ErrorHandler onError;
+  ErrorHandler onError = defaultErrorHandler;
 
-  /// Path to the ".packages" file.
+  /// URI of the ".packages" file (typically a "file:" URI).
   ///
   /// If `null`, the ".packages" file will be found via the standard
   /// package_config search algorithm.
-  String packagesFilePath;
+  ///
+  /// If the URI's path component is empty (e.g. `new Uri()`), no packages file
+  /// will be used.
+  Uri packagesFileUri;
 
-  /// Paths to the input summary files (excluding the SDK summary).  These files
-  /// should all be linked summaries.  They should also be closed, in the sense
-  /// that any libraries they reference should also appear in [inputSummaries]
-  /// or [sdkSummary].
-  List<String> inputSummaries = [];
+  /// URIs of input summary files (excluding the SDK summary; typically these
+  /// will be "file:" URIs).  These files should all be linked summaries.  They
+  /// should also be closed, in the sense that any libraries they reference
+  /// should also appear in [inputSummaries] or [sdkSummary].
+  List<Uri> inputSummaries = [];
 
-  /// Path to the SDK summary file.
+  /// URI of the SDK summary file (typically a "file:" URI).
   ///
   /// This should be a linked summary.  If `null`, the SDK summary will be
-  /// searched for at a default location within [sdkPath].
+  /// searched for at a default location within [sdkRoot].
   ///
-  /// This option is mutually exclusive with [sdkPath].  TODO(paulberry): if the
+  /// This option is mutually exclusive with [sdkRoot].  TODO(paulberry): if the
   /// VM does not contain a pickled copy of the SDK, we might need to change
   /// this.
-  String sdkSummary;
+  Uri sdkSummary;
 
   /// URI override map.
   ///
-  /// This is a map from Uri to file path.  Any URI override listed in this map
-  /// takes precedence over the URI resolution that would be implied by the
-  /// packages file (see [packagesFilePath]) and/or [bazelRoots].
+  /// This is a map from URIs that might appear in import/export/part statements
+  /// to URIs that should be used to locate the corresponding files in the
+  /// [fileSystem].  Any URI override listed in this map takes precedence over
+  /// the URI resolution that would be implied by the packages file (see
+  /// [packagesFileUri]) and/or [multiRoots].
   ///
   /// If a URI is not listed in this map, then the normal URI resolution
   /// algorithm will be used.
   ///
   /// TODO(paulberry): transition analyzer and dev_compiler to use the
-  /// "file:///bazel-root" mechanism, and then remove this.
+  /// "multi-root:" mechanism, and then remove this.
   @deprecated
-  Map<Uri, String> uriOverride = {};
+  Map<Uri, Uri> uriOverride = {};
 
-  /// Bazel roots.
+  /// Multi-roots.
   ///
-  /// Any Uri that resolves to "file:///bazel-root/$rest" will be searched for
-  /// at "$root/$rest" ("$root\\$rest" in Windows), where "$root" is drawn from
-  /// this list.  If the file is not found at any of those locations, the URI
-  /// "file:///bazel-root/$rest" will be used directly.
+  /// Any Uri that resolves to "multi-root:///$rest" will be searched for
+  /// at "$root/$rest", where "$root" is drawn from this list.
   ///
-  /// Intended use: if the Bazel workspace is located at path "$workspace", this
-  /// could be set to `['$workspace', '$workspace/bazel-bin',
-  /// '$workspace/bazel-genfiles']`, effectively overlaying source and generated
-  /// files.
-  List<String> bazelRoots = [];
+  /// Intended use: if the user has a Bazel workspace located at path
+  /// "$workspace", this could be set to the file URIs corresponding to the
+  /// paths for "$workspace", "$workspace/bazel-bin",
+  /// and "$workspace/bazel-genfiles", effectively overlaying source and
+  /// generated files.
+  List<Uri> multiRoots = [];
 
   /// Sets the platform bit, which determines which patch files should be
   /// applied to the SDK.
@@ -91,12 +99,27 @@
 
   /// The [FileSystem] which should be used by the front end to access files.
   ///
-  /// TODO(paulberry): once an implementation of [FileSystem] has been created
-  /// which uses the actual physical file system, make that the default.
-  ///
   /// All file system access performed by the front end goes through this
   /// mechanism, with one exception: if no value is specified for
-  /// [packagesFilePath], the packages file is located using the actual physical
+  /// [packagesFileUri], the packages file is located using the actual physical
   /// file system.  TODO(paulberry): fix this.
-  FileSystem fileSystem;
+  FileSystem fileSystem = PhysicalFileSystem.instance;
+
+  /// Whether to generate code for the SDK when compiling a whole-program.
+  bool compileSdk = false;
+
+  /// Whether a modular build compiles only the files listed explicitly or if it
+  /// compiles dependencies as well.
+  ///
+  /// This option is intended only for modular APIs like `kernelForBuildUnit`.
+  /// These APIs by default ensure that builds are hermetic, where all files
+  /// that will be compiled are listed explicitly and all other dependencies
+  /// are covered by summary files.
+  ///
+  /// When this option is true, these APIs will treat any dependency that is
+  /// not described in a summary as if it was explictly listed as an input.
+  bool chaseDependencies = false;
+
+  /// Whether to intepret Dart sources in strong-mode.
+  bool strongMode = true;
 }
diff --git a/pkg/front_end/lib/dependency_grapher.dart b/pkg/front_end/lib/dependency_grapher.dart
new file mode 100644
index 0000000..6120490
--- /dev/null
+++ b/pkg/front_end/lib/dependency_grapher.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:front_end/compiler_options.dart';
+import 'package:front_end/src/base/processed_options.dart';
+import 'package:front_end/src/dependency_grapher_impl.dart' as impl;
+
+/// Generates a representation of the dependency graph of a program.
+///
+/// Given the Uri of one or more files, this function follows `import`,
+/// `export`, and `part` declarations to discover a graph of all files involved
+/// in the program.
+Future<Graph> graphForProgram(List<Uri> sources, CompilerOptions options) {
+  var processedOptions = new ProcessedOptions(options);
+  return impl.graphForProgram(sources, processedOptions);
+}
+
+/// A representation of the dependency graph of a program.
+///
+/// Not intended to be extended, implemented, or mixed in by clients.
+class Graph {
+  /// A list of all library cycles in the program, in topologically sorted order
+  /// (each cycle only depends on libraries in the cycles that precede it).
+  final topologicallySortedCycles = <LibraryCycleNode>[];
+}
+
+/// A representation of a single library cycle in the dependency graph of a
+/// program.
+///
+/// Not intended to be extended, implemented, or mixed in by clients.
+class LibraryCycleNode {
+  /// A map of all the libraries in the cycle, keyed by the URI of their
+  /// defining compilation unit.
+  final libraries = <Uri, LibraryNode>{};
+}
+
+/// A representation of a single library in the dependency graph of a program.
+///
+/// Not intended to be extended, implemented, or mixed in by clients.
+class LibraryNode {
+  /// The URI of this library's defining compilation unit.
+  final Uri uri;
+
+  /// A list of the URIs of all of this library's "part" files.
+  final parts = <Uri>[];
+
+  /// A list of all the other libraries this library directly depends on.
+  final dependencies = <LibraryNode>[];
+
+  LibraryNode(this.uri);
+}
diff --git a/pkg/front_end/lib/file_system.dart b/pkg/front_end/lib/file_system.dart
index cadf82f..6e57c26 100644
--- a/pkg/front_end/lib/file_system.dart
+++ b/pkg/front_end/lib/file_system.dart
@@ -18,22 +18,17 @@
 /// Not intended to be implemented or extended by clients.
 abstract class FileSystem {
   /// Returns a path context suitable for use with this [FileSystem].
+  ///
+  /// TODO(paulberry): try to eliminate all usages of this.  Since the
+  /// FileSystem API now uses URIs rather than paths, it should not be needed.
   path.Context get context;
 
-  /// Returns a [FileSystemEntity] corresponding to the given [path].
-  ///
-  /// Uses of `..` and `.` in path are normalized before returning (so, for
-  /// example, `entityForPath('./foo')` and `entityForPath('foo')` are
-  /// equivalent).  Relative paths are also converted to absolute paths.
-  ///
-  /// Does not check whether a file or folder exists at the given location.
-  FileSystemEntity entityForPath(String path);
-
   /// Returns a [FileSystemEntity] corresponding to the given [uri].
   ///
   /// Uses of `..` and `.` in the URI are normalized before returning.
   ///
-  /// If [uri] is not an absolute `file:` URI, an [Error] will be thrown.
+  /// If the URI scheme is not supported by this file system, an [Error] will be
+  /// thrown.
   ///
   /// Does not check whether a file or folder exists at the given location.
   FileSystemEntity entityForUri(Uri uri);
@@ -46,14 +41,12 @@
 ///
 /// Not intended to be implemented or extended by clients.
 abstract class FileSystemEntity {
-  /// Returns the absolute normalized path represented by this file system
+  /// Returns the absolute normalized URI represented by this file system
   /// entity.
   ///
-  /// Note: if the [FileSystemEntity] was created using
-  /// [FileSystem.entityForPath], this is not necessarily the same as the path
-  /// that was used to create the object, since the path might have been
-  /// normalized.
-  String get path;
+  /// Note: this is not necessarily the same as the URI that was passed to
+  /// [FileSystem.entityForUri], since the URI might have been normalized.
+  Uri get uri;
 
   /// Attempts to access this file system entity as a file and read its contents
   /// as raw bytes.
diff --git a/pkg/front_end/lib/incremental_kernel_generator.dart b/pkg/front_end/lib/incremental_kernel_generator.dart
new file mode 100644
index 0000000..3b3b429
--- /dev/null
+++ b/pkg/front_end/lib/incremental_kernel_generator.dart
@@ -0,0 +1,102 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:front_end/src/base/processed_options.dart';
+import 'package:front_end/src/incremental_kernel_generator_impl.dart';
+import 'package:kernel/kernel.dart';
+
+import 'compiler_options.dart';
+
+/// Represents the difference between "old" and "new" states of a program.
+///
+/// Not intended to be implemented or extended by clients.
+class DeltaProgram {
+  /// The new state of the program.
+  ///
+  /// Libraries whose kernel representation is known to be unchanged since the
+  /// last [DeltaProgram] are not included.
+  final Map<Uri, Program> newState;
+
+  DeltaProgram(this.newState);
+
+  /// TODO(paulberry): add information about libraries that were removed.
+}
+
+/// Interface for generating an initial kernel representation of a program and
+/// keeping it up to date as incremental changes are made.
+///
+/// This class maintains an internal "previous program state"; each
+/// time [computeDelta] is called, it updates the previous program state and
+/// produces a representation of what has changed.  When there are few changes,
+/// a call to [computeDelta] should be much faster than compiling the whole
+/// program from scratch.
+///
+/// This class also maintains a set of "valid sources", which is a (possibly
+/// empty) subset of the sources constituting the previous program state.  Files
+/// in this set are assumed to be unchanged since the last call to
+/// [computeDelta].
+///
+/// Behavior is undefined if the client does not obey the following concurrency
+/// restrictions:
+/// - no two invocations of [computeDelta] may be outstanding at any given time.
+/// - neither [invalidate] nor [invalidateAll] may be called while an invocation
+///   of [computeDelta] is outstanding.
+///
+/// Not intended to be implemented or extended by clients.
+abstract class IncrementalKernelGenerator {
+  /// Creates an [IncrementalKernelGenerator] which is prepared to generate
+  /// kernel representations of the program whose main library is in the given
+  /// [source].
+  ///
+  /// No file system access is performed by this constructor; the initial
+  /// "previous program state" is an empty program containing no code, and the
+  /// initial set of valid sources is empty.  To obtain a kernel representation
+  /// of the program, call [computeDelta].
+  factory IncrementalKernelGenerator(Uri source, CompilerOptions options) =>
+      new IncrementalKernelGeneratorImpl(source, new ProcessedOptions(options));
+
+  /// Generates a kernel representation of the changes to the program, assuming
+  /// that all valid sources are unchanged since the last call to
+  /// [computeDelta].
+  ///
+  /// Source files in the set of valid sources are guaranteed not to be re-read
+  /// from disk; they are assumed to be unchanged regardless of the state of the
+  /// filesystem.
+  ///
+  /// If [watch] is not `null`, then when a source file is first used
+  /// by [computeDelta], [watch] is called with the Uri of that source
+  /// file and `used` == `true` indicating that the source file is being
+  /// used when compiling the program. The content of the file is not read
+  /// until the Future returned by [watch] completes. If during a subsequent
+  /// call to [computeDelta], a source file that was being used is no longer
+  /// used, then [watch] is called with the Uri of that source file and
+  /// `used` == `false` indicating that the source file is no longer needed.
+  /// Multiple invocations of [watch] may be running concurrently.
+  ///
+  /// If the future completes successfully, the previous file state is updated
+  /// and the set of valid sources is set to the set of all sources in the
+  /// program.
+  ///
+  /// If the future completes with an error (due to errors in the compiled
+  /// source code), the caller may consider the previous file state and the set
+  /// of valid sources to be unchanged; this means that once the user fixes the
+  /// errors, it is safe to call [computeDelta] again.
+  Future<DeltaProgram> computeDelta({Future<Null> watch(Uri uri, bool used)});
+
+  /// Remove any source file(s) associated with the given file path from the set
+  /// of valid sources.  This guarantees that those files will be re-read on the
+  /// next call to [computeDelta]).
+  void invalidate(String path);
+
+  /// Remove all source files from the set of valid sources.  This guarantees
+  /// that all files will be re-read on the next call to [computeDelta].
+  ///
+  /// Note that this does not erase the previous program state; the next time
+  /// [computeDelta] is called, if parts of the program are discovered to be
+  /// unchanged, parts of the previous program state will still be re-used to
+  /// speed up compilation.
+  void invalidateAll();
+}
diff --git a/pkg/front_end/lib/incremental_resolved_ast_generator.dart b/pkg/front_end/lib/incremental_resolved_ast_generator.dart
new file mode 100644
index 0000000..dd5e4c7
--- /dev/null
+++ b/pkg/front_end/lib/incremental_resolved_ast_generator.dart
@@ -0,0 +1,104 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:front_end/src/base/processed_options.dart';
+import 'package:front_end/src/incremental_resolved_ast_generator_impl.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+
+import 'compiler_options.dart';
+
+/// Represents the difference between "old" and "new" states of a program.
+///
+/// Not intended to be implemented or extended by clients.
+class DeltaLibraries {
+  /// The new state of the program, as a map from Uri to [ResolvedLibrary].
+  ///
+  /// Libraries whose resolved AST is known to be unchanged since the last
+  /// [DeltaLibraries] are not included.
+  final Map<Uri, ResolvedLibrary> newState;
+
+  DeltaLibraries(this.newState);
+
+/// TODO(paulberry): add information about libraries that were removed.
+}
+
+/// Represents the resolved ASTs for all the compilation units in a single
+/// library.
+///
+/// Not intended to be implemented or extended by clients.
+class ResolvedLibrary {
+  final CompilationUnit definingCompilationUnit;
+
+  final Map<Uri, CompilationUnit> partUnits;
+
+  ResolvedLibrary(this.definingCompilationUnit, this.partUnits);
+}
+
+/// Interface for generating an initial resolved representation of a program and
+/// keeping it up to date as incremental changes are made.
+///
+/// This class maintains an internal "previous program state"; each
+/// time [computeDelta] is called, it updates the previous program state and
+/// produces a representation of what has changed.  When there are few changes,
+/// a call to [computeDelta] should be much faster than compiling the whole
+/// program from scratch.
+///
+/// This class also maintains a set of "valid sources", which is a (possibly
+/// empty) subset of the sources constituting the previous program state.  Files
+/// in this set are assumed to be unchanged since the last call to
+/// [computeDelta].
+///
+/// Behavior is undefined if the client does not obey the following concurrency
+/// restrictions:
+/// - no two invocations of [computeDelta] may be outstanding at any given time.
+/// - neither [invalidate] nor [invalidateAll] may be called while an invocation
+///   of [computeDelta] is outstanding.
+///
+/// Not intended to be implemented or extended by clients.
+abstract class IncrementalResolvedAstGenerator {
+  /// Creates an [IncrementalResolvedAstGenerator] which is prepared to generate
+  /// resolved ASTs for the program whose main library is in the given
+  /// [source].
+  ///
+  /// No file system access is performed by this constructor; the initial
+  /// "previous program state" is an empty program containing no code, and the
+  /// initial set of valid sources is empty.  To obtain a resolved AST
+  /// representation of the program, call [computeDelta].
+  factory IncrementalResolvedAstGenerator(Uri source, CompilerOptions options) =>
+      new IncrementalResolvedAstGeneratorImpl(source, new ProcessedOptions(options));
+
+  /// Generates a resolved AST representation of the changes to the program,
+  /// assuming that all valid sources are unchanged since the last call to
+  /// [computeDelta].
+  ///
+  /// Source files in the set of valid sources are guaranteed not to be re-read
+  /// from disk; they are assumed to be unchanged regardless of the state of the
+  /// filesystem.
+  ///
+  /// If the future completes successfully, the previous file state is updated
+  /// and the set of valid sources is set to the set of all sources in the
+  /// program.
+  ///
+  /// If the future completes with an error (due to errors in the compiled
+  /// source code), the caller may consider the previous file state and the set
+  /// of valid sources to be unchanged; this means that once the user fixes the
+  /// errors, it is safe to call [computeDelta] again.
+  Future<DeltaLibraries> computeDelta();
+
+  /// Remove any source file(s) associated with the given file path from the set
+  /// of valid sources.  This guarantees that those files will be re-read on the
+  /// next call to [computeDelta]).
+  void invalidate(String path);
+
+  /// Remove all source files from the set of valid sources.  This guarantees
+  /// that all files will be re-read on the next call to [computeDelta].
+  ///
+  /// Note that this does not erase the previous program state; the next time
+  /// [computeDelta] is called, if parts of the program are discovered to be
+  /// unchanged, parts of the previous program state will still be re-used to
+  /// speed up compilation.
+  void invalidateAll();
+}
diff --git a/pkg/front_end/lib/kernel_generator.dart b/pkg/front_end/lib/kernel_generator.dart
index 3b35086..348d1f9 100644
--- a/pkg/front_end/lib/kernel_generator.dart
+++ b/pkg/front_end/lib/kernel_generator.dart
@@ -5,9 +5,17 @@
 /// Defines the front-end API for converting source code to Dart Kernel objects.
 library front_end.kernel_generator;
 
-import 'dart:async';
+import 'compilation_error.dart';
 import 'compiler_options.dart';
-import 'package:kernel/kernel.dart' as kernel;
+import 'dart:async';
+
+import 'package:analyzer/src/generated/source.dart' show SourceKind;
+import 'package:analyzer/src/summary/package_bundle_reader.dart'
+    show InSummarySource;
+// TODO(sigmund): move loader logic under front_end/lib/src/kernel/
+import 'package:kernel/analyzer/loader.dart';
+import 'package:kernel/kernel.dart';
+import 'package:source_span/source_span.dart' show SourceSpan;
 
 /// Generates a kernel representation of the program whose main library is in
 /// the given [source].
@@ -18,41 +26,147 @@
 /// follows `import`, `export`, and `part` declarations to discover the whole
 /// program, and converts the result to Dart Kernel format.
 ///
-/// If summaries are provided in [options], they may be used to speed up
-/// analysis, but they will not take the place of Dart source code (since the
-/// Dart source code is still needed to access the contents of method bodies).
+/// If `compileSdk` in [options] is true, the generated program will include
+/// code for the SDK.
 ///
-/// TODO(paulberry): will the VM have a pickled version of the SDK inside it? If
-/// so, then maybe this method should not convert SDK libraries to kernel.
-Future<kernel.Program> kernelForProgram(Uri source, CompilerOptions options) =>
-    throw new UnimplementedError();
+/// If summaries are provided in [options], they may be used to speed up
+/// analysis. If in addition `compileSdk` is false, this will speed up
+/// compilation, as no source of the sdk will be generated.  Note however, that
+/// summaries for application code can also speed up analysis, but they will not
+/// take the place of Dart source code (since the Dart source code is still
+/// needed to access the contents of method bodies).
+Future<Program> kernelForProgram(Uri source, CompilerOptions options) async {
+  var loader = await _createLoader(options, entry: source);
+  // TODO(sigmund): merge what we have in loadEverything and the logic below in
+  // kernelForBuildUnit so there is a single place where we crawl for
+  // dependencies.
+  Program program = loader.loadProgram(source, compileSdk: options.compileSdk);
+  _reportErrors(loader.errors, options.onError);
+  return program;
+}
 
-/// Generates a kernel representation of the build unit whose source files are
-/// in [sources].
+/// Generates a kernel representation for a build unit.
 ///
 /// Intended for modular compilation.
 ///
-/// [sources] should be the complete set of source files for a build unit
-/// (including both library and part files).  All of the library files are
-/// transformed into Dart Kernel Library objects.
+/// The build unit by default contains only the source files in [sources]
+/// (including library and part files), but if
+/// [CompilerOptions.chaseDependencies] is true, it may include some additional
+/// source files.  All of the library files are transformed into Dart Kernel
+/// Library objects.
 ///
-/// The compilation process is hermetic, meaning that the only files which will
-/// be read are those listed in [sources], [CompilerOptions.inputSummaries], and
-/// [CompilerOptions.sdkSummary].  If a source file attempts to refer to a file
-/// which is not obtainable from these paths, that will result in an error, even
-/// if the file exists on the filesystem.
+/// By default, the compilation process is hermetic, meaning that the only files
+/// which will be read are those listed in [sources],
+/// [CompilerOptions.inputSummaries], and [CompilerOptions.sdkSummary].  If a
+/// source file attempts to refer to a file which is not obtainable from these
+/// URIs, that will result in an error, even if the file exists on the
+/// filesystem.
+///
+/// When [CompilerOptions.chaseDependencies] is true, this default behavior
+/// changes, and any dependency of [sources] that is not listed in
+/// [CompilerOptions.inputSummaries] and [CompilerOptions.sdkSummary] is treated
+/// as an additional source file for the build unit.
 ///
 /// Any `part` declarations found in [sources] must refer to part files which
-/// are also listed in [sources], otherwise an error results.  (It is not
-/// permitted to refer to a part file declared in another build unit).
+/// are also listed in the build unit sources, otherwise an error results.  (It
+/// is not permitted to refer to a part file declared in another build unit).
 ///
-/// The return value is a [kernel.Program] object with no main method set.
+/// The return value is a [Program] object with no main method set.
 /// TODO(paulberry): would it be better to define a data type in kernel to
 /// represent a bundle of all the libraries in a given build unit?
 ///
 /// TODO(paulberry): does additional information need to be output to allow the
 /// caller to match up referenced elements to the summary files they were
 /// obtained from?
-Future<kernel.Program> kernelForBuildUnit(
-        List<Uri> sources, CompilerOptions options) =>
-    throw new UnimplementedError();
+Future<Program> kernelForBuildUnit(
+    List<Uri> sources, CompilerOptions options) async {
+  var repository = new Repository();
+  var loader = await _createLoader(options, repository: repository);
+  var context = loader.context;
+
+  // Process every library in the build unit.
+  for (var uri in sources) {
+    var source = context.sourceFactory.forUri2(uri);
+    //  We ignore part files, those are handled by their enclosing library.
+    if (context.computeKindOf(source) == SourceKind.PART) {
+      // TODO(sigmund): record it and ensure that this part is within a provided
+      // library.
+      continue;
+    }
+    loader.loadLibrary(uri);
+  }
+
+  // Check whether all dependencies were included in [sources].
+  // TODO(sigmund): we should look for dependencies using import, export, and
+  // part directives intead of relying on the dartk-loader.  In particular, if a
+  // library is imported but not used, the logic below will not detect it.
+  for (int i = 0; i < repository.libraries.length; ++i) {
+    // Note: we don't use a for-in loop because repository.libraries grows as
+    // the loader processes libraries.
+    var lib = repository.libraries[i];
+    var source = context.sourceFactory.forUri2(lib.importUri);
+    if (source is InSummarySource) continue;
+    if (options.chaseDependencies) {
+      loader.ensureLibraryIsLoaded(lib);
+    } else if (lib.isExternal) {
+      // Default behavior: the build should be hermetic and all dependencies
+      // should be listed.
+      options.onError(new _DartkError('hermetic build error: '
+          'no source or summary was given for ${lib.importUri}'));
+    }
+  }
+
+  Program program = new Program(repository.libraries);
+  _reportErrors(loader.errors, options.onError);
+  return program;
+}
+
+/// Create a [DartLoader] using the provided [options].
+///
+/// If [options] contain no configuration to resolve `.packages`, the [entry]
+/// file will be used to search for a `.packages` file.
+Future<DartLoader> _createLoader(CompilerOptions options,
+    {Repository repository, Uri entry}) async {
+  var kernelOptions = _convertOptions(options);
+  var packages = await createPackages(
+      _uriToPath(options.packagesFileUri, options),
+      discoveryPath: entry?.path);
+  return new DartLoader(
+      repository ?? new Repository(), kernelOptions, packages);
+}
+
+DartOptions _convertOptions(CompilerOptions options) {
+  return new DartOptions(
+      strongMode: options.strongMode,
+      sdk: _uriToPath(options.sdkRoot, options),
+      // TODO(sigmund): make it possible to use summaries and still compile the
+      // sdk sources.
+      sdkSummary:
+          options.compileSdk ? null : _uriToPath(options.sdkSummary, options),
+      packagePath: _uriToPath(options.packagesFileUri, options),
+      declaredVariables: options.declaredVariables);
+}
+
+void _reportErrors(List errors, ErrorHandler onError) {
+  if (onError == null) return;
+  for (var error in errors) {
+    onError(new _DartkError(error));
+  }
+}
+
+String _uriToPath(Uri uri, CompilerOptions options) {
+  if (uri == null) return null;
+  if (uri.scheme != 'file') {
+    throw new StateError('Only file URIs are supported');
+  }
+  return options.fileSystem.context.fromUri(uri);
+}
+
+// TODO(sigmund): delete this class. Dartk should not format errors itself, we
+// should just pass them along.
+class _DartkError implements CompilationError {
+  String get correction => null;
+  SourceSpan get span => null;
+  final String message;
+  _DartkError(this.message);
+}
diff --git a/pkg/front_end/lib/memory_file_system.dart b/pkg/front_end/lib/memory_file_system.dart
index 267cbe3..e7382ad 100644
--- a/pkg/front_end/lib/memory_file_system.dart
+++ b/pkg/front_end/lib/memory_file_system.dart
@@ -20,26 +20,29 @@
   @override
   final p.Context context;
 
-  final Map<String, Uint8List> _files = {};
+  final Map<Uri, Uint8List> _files = {};
 
   /// The "current directory" in the in-memory virtual file system.
   ///
-  /// This is used to convert relative paths to absolute paths.
-  String currentDirectory;
+  /// This is used to convert relative URIs to absolute URIs.
+  ///
+  /// Always ends in a trailing '/'.
+  Uri currentDirectory;
 
-  MemoryFileSystem(this.context, this.currentDirectory);
-
-  @override
-  MemoryFileSystemEntity entityForPath(String path) =>
-      new MemoryFileSystemEntity._(
-          this, context.normalize(context.join(currentDirectory, path)));
+  MemoryFileSystem(this.context, Uri currentDirectory)
+      : currentDirectory = _addTrailingSlash(currentDirectory);
 
   @override
   MemoryFileSystemEntity entityForUri(Uri uri) {
-    if (uri.scheme != 'file') throw new ArgumentError('File URI expected');
-    // Note: we don't have to verify that the URI's path is absolute, because
-    // URIs with non-empty schemes always have absolute paths.
-    return entityForPath(context.fromUri(uri));
+    return new MemoryFileSystemEntity._(
+        this, currentDirectory.resolveUri(uri).normalizePath());
+  }
+
+  static Uri _addTrailingSlash(Uri uri) {
+    if (!uri.path.endsWith('/')) {
+      uri = uri.replace(path: uri.path + '/');
+    }
+    return uri;
   }
 }
 
@@ -49,22 +52,22 @@
   final MemoryFileSystem _fileSystem;
 
   @override
-  final String path;
+  final Uri uri;
 
-  MemoryFileSystemEntity._(this._fileSystem, this.path);
+  MemoryFileSystemEntity._(this._fileSystem, this.uri);
 
   @override
-  int get hashCode => path.hashCode;
+  int get hashCode => uri.hashCode;
 
   @override
   bool operator ==(Object other) =>
       other is MemoryFileSystemEntity &&
-      other.path == path &&
+      other.uri == uri &&
       identical(other._fileSystem, _fileSystem);
 
   @override
   Future<List<int>> readAsBytes() async {
-    List<int> contents = _fileSystem._files[path];
+    List<int> contents = _fileSystem._files[uri];
     if (contents != null) {
       return contents.toList();
     }
@@ -82,7 +85,7 @@
   /// If no file exists, one is created.  If a file exists already, it is
   /// overwritten.
   void writeAsBytesSync(List<int> bytes) {
-    _fileSystem._files[path] = new Uint8List.fromList(bytes);
+    _fileSystem._files[uri] = new Uint8List.fromList(bytes);
   }
 
   /// Writes the given string to this file system entity.
@@ -95,6 +98,6 @@
     // Note: the return type of UTF8.encode is List<int>, but in practice it
     // always returns Uint8List.  We rely on that for efficiency, so that we
     // don't have to make an extra copy.
-    _fileSystem._files[path] = UTF8.encode(s) as Uint8List;
+    _fileSystem._files[uri] = UTF8.encode(s) as Uint8List;
   }
 }
diff --git a/pkg/front_end/lib/physical_file_system.dart b/pkg/front_end/lib/physical_file_system.dart
index 0ed5d8b..f90abc9 100644
--- a/pkg/front_end/lib/physical_file_system.dart
+++ b/pkg/front_end/lib/physical_file_system.dart
@@ -24,15 +24,11 @@
   p.Context get context => p.context;
 
   @override
-  FileSystemEntity entityForPath(String path) =>
-      new _PhysicalFileSystemEntity(context.normalize(context.absolute(path)));
-
-  @override
   FileSystemEntity entityForUri(Uri uri) {
-    if (uri.scheme != 'file') throw new ArgumentError('File URI expected');
-    // Note: we don't have to verify that the URI's path is absolute, because
-    // URIs with non-empty schemes always have absolute paths.
-    return entityForPath(context.fromUri(uri));
+    if (uri.scheme != 'file' && uri.scheme != '') {
+      throw new ArgumentError('File URI expected');
+    }
+    return new _PhysicalFileSystemEntity(Uri.base.resolveUri(uri));
   }
 }
 
@@ -40,20 +36,20 @@
 /// [PhysicalFileSystem].
 class _PhysicalFileSystemEntity implements FileSystemEntity {
   @override
-  final String path;
+  final Uri uri;
 
-  _PhysicalFileSystemEntity(this.path);
+  _PhysicalFileSystemEntity(this.uri);
 
   @override
-  int get hashCode => path.hashCode;
+  int get hashCode => uri.hashCode;
 
   @override
   bool operator ==(Object other) =>
-      other is _PhysicalFileSystemEntity && other.path == path;
+      other is _PhysicalFileSystemEntity && other.uri == uri;
 
   @override
-  Future<List<int>> readAsBytes() => new io.File(path).readAsBytes();
+  Future<List<int>> readAsBytes() => new io.File.fromUri(uri).readAsBytes();
 
   @override
-  Future<String> readAsString() => new io.File(path).readAsString();
+  Future<String> readAsString() => new io.File.fromUri(uri).readAsString();
 }
diff --git a/pkg/front_end/lib/src/async_dependency_walker.dart b/pkg/front_end/lib/src/async_dependency_walker.dart
new file mode 100644
index 0000000..b0c6535
--- /dev/null
+++ b/pkg/front_end/lib/src/async_dependency_walker.dart
@@ -0,0 +1,172 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+/**
+ * An instance of [AsyncDependencyWalker] contains the core algorithms for
+ * walking a dependency graph and evaluating nodes in a safe order.
+ *
+ * Computation of dependencies and evaluation of nodes may be asynchronous.
+ */
+abstract class AsyncDependencyWalker<NodeType extends Node<NodeType>> {
+  /**
+   * Called by [walk] to evaluate a single non-cyclical node, after
+   * all that node's dependencies have been evaluated.
+   */
+  Future<Null> evaluate(NodeType v);
+
+  /**
+   * Called by [walk] to evaluate a strongly connected component
+   * containing one or more nodes.  All dependencies of the strongly
+   * connected component have been evaluated.
+   */
+  Future<Null> evaluateScc(List<NodeType> scc);
+
+  /**
+   * Walk the dependency graph starting at [startingPoint], finding
+   * strongly connected components and evaluating them in a safe order
+   * by calling [evaluate] and [evaluateScc].
+   *
+   * This is an implementation of Tarjan's strongly connected
+   * components algorithm
+   * (https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm).
+   *
+   * TODO(paulberry): Consider switching to an algorithm that allows
+   * dependencies to be computed in parallel, and nodes to be evaluated in
+   * parallel.
+   */
+  Future<Null> walk(NodeType startingPoint) async {
+    // TODO(paulberry): consider rewriting in a non-recursive way so
+    // that long dependency chains don't cause stack overflow.
+
+    // TODO(paulberry): in the event that an exception occurs during
+    // the walk, restore the state of the [Node] data structures so
+    // that further evaluation will be safe.
+
+    // The index which will be assigned to the next node that is
+    // freshly visited.
+    int index = 1;
+
+    // Stack of nodes which have been seen so far and whose strongly
+    // connected component is still being determined.  Nodes are only
+    // popped off the stack when they are evaluated, so sometimes the
+    // stack contains nodes that were visited after the current node.
+    List<NodeType> stack = <NodeType>[];
+
+    Future strongConnect(NodeType node) async {
+      bool hasTrivialCycle = false;
+
+      // Assign the current node an index and add it to the stack.  We
+      // haven't seen any of its dependencies yet, so set its lowLink
+      // to its index, indicating that so far it is the only node in
+      // its strongly connected component.
+      node._index = node._lowLink = index++;
+      stack.add(node);
+
+      // Consider the node's dependencies one at a time.
+      var dependencies =
+          node._dependencies ??= await node.computeDependencies();
+      for (NodeType dependency in dependencies) {
+        // If the dependency has already been evaluated, it can't be
+        // part of this node's strongly connected component, so we can
+        // skip it.
+        if (dependency._isEvaluated) {
+          continue;
+        }
+        if (identical(node, dependency)) {
+          // If a node includes itself as a dependency, there is no need to
+          // explore the dependency further.
+          hasTrivialCycle = true;
+        } else if (dependency._index == 0) {
+          // The dependency hasn't been seen yet, so recurse on it.
+          await strongConnect(dependency);
+          // If the dependency's lowLink refers to a node that was
+          // visited before the current node, that means that the
+          // current node, the dependency, and the node referred to by
+          // the dependency's lowLink are all part of the same
+          // strongly connected component, so we need to update the
+          // current node's lowLink accordingly.
+          if (dependency._lowLink < node._lowLink) {
+            node._lowLink = dependency._lowLink;
+          }
+        } else {
+          // The dependency has already been seen, so it is part of
+          // the current node's strongly connected component.  If it
+          // was visited earlier than the current node's lowLink, then
+          // it is a new addition to the current node's strongly
+          // connected component, so we need to update the current
+          // node's lowLink accordingly.
+          if (dependency._index < node._lowLink) {
+            node._lowLink = dependency._index;
+          }
+        }
+      }
+
+      // If the current node's lowLink is the same as its index, then
+      // we have finished visiting a strongly connected component, so
+      // pop the stack and evaluate it before moving on.
+      if (node._lowLink == node._index) {
+        // The strongly connected component has only one node.  If there is a
+        // cycle, it's a trivial one.
+        if (identical(stack.last, node)) {
+          stack.removeLast();
+          node._isEvaluated = true;
+          if (hasTrivialCycle) {
+            await evaluateScc(<NodeType>[node]);
+          } else {
+            await evaluate(node);
+          }
+        } else {
+          // There are multiple nodes in the strongly connected
+          // component.
+          List<NodeType> scc = <NodeType>[];
+          while (true) {
+            NodeType otherNode = stack.removeLast();
+            scc.add(otherNode);
+            otherNode._isEvaluated = true;
+            if (identical(otherNode, node)) {
+              break;
+            }
+          }
+          await evaluateScc(scc);
+        }
+      }
+    }
+
+    // Kick off the algorithm starting with the starting point.
+    await strongConnect(startingPoint);
+  }
+}
+
+/**
+ * Instances of [Node] represent nodes in a dependency graph.  The
+ * type parameter, [NodeType], is the derived type (this affords some
+ * extra type safety by making it difficult to accidentally construct
+ * bridges between unrelated dependency graphs).
+ */
+abstract class Node<NodeType> {
+  /**
+   * Index used by Tarjan's strongly connected components algorithm.
+   * Zero means the node has not been visited yet; a nonzero value
+   * counts the order in which the node was visited.
+   */
+  int _index = 0;
+
+  /**
+   * Low link used by Tarjan's strongly connected components
+   * algorithm.  This represents the smallest [_index] of all the nodes
+   * in the strongly connected component to which this node belongs.
+   */
+  int _lowLink = 0;
+
+  List<NodeType> _dependencies;
+
+  bool _isEvaluated = false;
+
+  /**
+   * Compute the dependencies of this node.
+   */
+  Future<List<NodeType>> computeDependencies();
+}
diff --git a/pkg/front_end/lib/src/base/file_repository.dart b/pkg/front_end/lib/src/base/file_repository.dart
new file mode 100644
index 0000000..d4d4f7c
--- /dev/null
+++ b/pkg/front_end/lib/src/base/file_repository.dart
@@ -0,0 +1,100 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Data structure storing an association between URI and file contents.
+///
+/// Each URI is also associated with a unique arbitrary path ending in ".dart".
+/// This allows interfacing with analyzer code that expects to manipulate paths
+/// rather than URIs.
+class FileRepository {
+  /// Regular expression matching the arbitrary file paths generated by
+  /// [_pathForIndex].
+  static final _pathRegexp = new RegExp(r'^/[0-9]+\.dart$');
+
+  /// The URIs currently stored in the repository.
+  final _uris = <Uri>[];
+
+  /// Map from a URI to its index in [_uris].
+  final _uriToIndexMap = <Uri, int>{};
+
+  /// The file contents associated with the URIs in [_uris].
+  final _contents = <String>[];
+
+  /// Clear any contents stored in the file repository.  The association between
+  /// URI and arbitrary path is preserved.
+  ///
+  /// Subsequent calls to [contentsForPath] will have undefined results until
+  /// new contents are stored using [store].
+  void clearContents() {
+    for (var i = 0; i < _contents.length; i++) {
+      _contents[i] = null;
+    }
+  }
+
+  /// Return the contents of the file whose arbitary path is [path].
+  ///
+  /// The path must have been returned by a previous call to [store] or
+  /// [pathForUri].
+  String contentsForPath(String path) {
+    var contents = _contents[_indexForPath(path)];
+    assert(contents != null);
+    return contents;
+  }
+
+  /// For testing purposes, return the contents of all files stored in the file
+  /// repository, as a map from path to contents string.
+  Map<String, String> getContentsForTesting() {
+    var result = <String, String>{};
+    for (var i = 0; i < _contents.length; i++) {
+      if (_contents[i] != null) result[_pathForIndex(i)] = _contents[i];
+    }
+    return result;
+  }
+
+  /// Return the arbitrary path associated with [uri].
+  ///
+  /// If [allocate] is `false` (the default), the uri must have previously been
+  /// allocated a corresponding path, e.g. via a call to [store].  If [allocate]
+  /// is `true`, then a new path will be allocated if necessary.
+  String pathForUri(Uri uri, {bool allocate: false}) {
+    return _pathForIndex(_indexForUri(uri, allocate));
+  }
+
+  /// Associate the given [uri] with file [contents].
+  ///
+  /// The arbitrary path associated with the file is returned.
+  String store(Uri uri, String contents) {
+    int index = _indexForUri(uri, true);
+    _contents[index] = contents;
+    return _pathForIndex(index);
+  }
+
+  /// Return the URI for the file whose arbitrary path is [path].
+  ///
+  /// The path must have been returned by a previous call to [store] or
+  /// [pathForUri].
+  Uri uriForPath(String path) => _uris[_indexForPath(path)];
+
+  /// Return the index into [_uris] and [_contents] matching the arbitrary path
+  /// [path].
+  int _indexForPath(String path) {
+    assert(_pathRegexp.hasMatch(path));
+    return int.parse(path.substring(1, path.length - 5));
+  }
+
+  int _indexForUri(Uri uri, bool allocate) {
+    int index = _uriToIndexMap[uri];
+    assert(allocate || index != null);
+    if (index == null) {
+      index = _uris.length;
+      _uris.add(uri);
+      _uriToIndexMap[uri] = index;
+      _contents.add(null);
+    }
+    return index;
+  }
+
+  /// Return the arbitrary path associated with the given index.
+  String _pathForIndex(int index) => '/$index.dart';
+}
diff --git a/pkg/front_end/lib/src/base/library_info.dart b/pkg/front_end/lib/src/base/library_info.dart
new file mode 100644
index 0000000..a66b6d5
--- /dev/null
+++ b/pkg/front_end/lib/src/base/library_info.dart
@@ -0,0 +1,159 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// A bit flag used by [LibraryInfo] indicating that a library is used by
+/// dart2js.
+///
+/// This declaration duplicates the declaration in the SDK's "libraries.dart".
+const int DART2JS_PLATFORM = 1;
+
+/// A bit flag used by [LibraryInfo] indicating that a library is used by the
+/// VM.
+///
+/// This declaration duplicates the declaration in the SDK's "libraries.dart".
+const int VM_PLATFORM = 2;
+
+/// Parse a category string in the SDK's "libraries.dart".
+///
+/// This declaration duplicates the declaration in the SDK's "libraries.dart".
+Category parseCategory(String name) {
+  switch (name) {
+    case 'Client':
+      return Category.client;
+    case 'Server':
+      return Category.server;
+    case 'Embedded':
+      return Category.embedded;
+  }
+  return null;
+}
+
+/// The contexts that a library can be used from.
+///
+/// This declaration duplicates the declaration in the SDK's "libraries.dart".
+enum Category {
+  /// Indicates that a library can be used in a browser context.
+  client,
+
+  /// Indicates that a lbirary can be used in a command line context.
+  server,
+
+  /// Indicates that a library can be used from embedded devices.
+  embedded
+}
+
+/// Information about a "dart:" library gleaned from the SDK's "libraries.dart"
+/// file.
+///
+/// This declaration duplicates the declaration in "libraries.dart".
+class LibraryInfo {
+  /// Path to the library's *.dart file relative to the SDK's "lib" directory.
+  final String path;
+
+  /// The categories in which the library can be used, encoded as a
+  /// comma-separated String.
+  final String _categories;
+
+  /// Path to the dart2js library's *.dart file relative to the SDK's "lib"
+  /// directory, or null if dart2js uses the common library path defined above.
+  final String dart2jsPath;
+
+  /// Path to the dart2js library's patch file relative to the SDK's "lib"
+  /// directory, or null if no dart2js patch file associated with this library.
+  final String dart2jsPatchPath;
+
+  /// True if this library is documented and should be shown to the user.
+  final bool documented;
+
+  /// Bit flags indicating which platforms consume this library.  See
+  /// [DART2JS_LIBRARY] and [VM_LIBRARY].
+  final int platforms;
+
+  /// True if the library contains implementation details for another library.
+  /// The implication is that these libraries are less commonly used and that
+  /// tools like the analysis server should not show these libraries in a list
+  /// of all libraries unless the user specifically asks the tool to do so.
+  final bool implementation;
+
+  /// States the current maturity of this library.
+  final Maturity maturity;
+
+  const LibraryInfo(this.path,
+      {String categories: "",
+      this.dart2jsPath,
+      this.dart2jsPatchPath,
+      this.implementation: false,
+      this.documented: true,
+      this.maturity: Maturity.UNSPECIFIED,
+      this.platforms: DART2JS_PLATFORM | VM_PLATFORM})
+      : _categories = categories;
+
+  /// The categories in which the library can be used.
+  ///
+  /// If no categories are specified, the library is internal and cannot be
+  /// loaded by user code.
+  List<Category> get categories {
+    // `''.split(',')` returns [''], not [], so we handle that case separately.
+    if (_categories.isEmpty) return const <Category>[];
+    return _categories.split(',').map(parseCategory).toList();
+  }
+
+  /// The original "categories" String that was passed to the constructor.
+  ///
+  /// Can be used to construct a slightly modified copy of this LibraryInfo.
+  String get categoriesString {
+    return _categories;
+  }
+
+  bool get isDart2jsLibrary => (platforms & DART2JS_PLATFORM) != 0;
+
+  bool get isInternal => categories.isEmpty;
+
+  bool get isVmLibrary => (platforms & VM_PLATFORM) != 0;
+}
+
+/// Abstraction to capture the maturity of a library.
+class Maturity {
+  static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
+      "This library will be remove before next major release.");
+  static const Maturity EXPERIMENTAL = const Maturity(
+      1,
+      "Experimental",
+      "This library is experimental and will likely change or be removed\n"
+      "in future versions.");
+  static const Maturity UNSTABLE = const Maturity(
+      2,
+      "Unstable",
+      "This library is in still changing and have not yet endured\n"
+      "sufficient real-world testing.\n"
+      "Backwards-compatibility is NOT guaranteed.");
+
+  static const Maturity WEB_STABLE = const Maturity(
+      3,
+      "Web Stable",
+      "This library is tracking the DOM evolution as defined by WC3.\n"
+      "Backwards-compatibility is NOT guaranteed.");
+
+  static const Maturity STABLE = const Maturity(
+      4,
+      "Stable",
+      "The library is stable. API backwards-compatibility is guaranteed.\n"
+      "However implementation details might change.");
+
+  static const Maturity LOCKED = const Maturity(5, "Locked",
+      "This library will not change except when serious bugs are encountered.");
+
+  static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
+      "The maturity for this library has not been specified.");
+
+  final int level;
+
+  final String name;
+
+  final String description;
+
+  const Maturity(this.level, this.name, this.description);
+
+  String toString() => "$name: $level\n$description\n";
+}
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
new file mode 100644
index 0000000..60ef2ec
--- /dev/null
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -0,0 +1,136 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:analyzer/src/summary/idl.dart';
+import 'package:front_end/compiler_options.dart';
+import 'package:front_end/file_system.dart';
+import 'package:front_end/src/base/uri_resolver.dart';
+import 'package:package_config/packages_file.dart' as package_config;
+
+/// Wrapper around [CompilerOptions] which exposes the options in a form useful
+/// to the front end implementation.
+///
+/// The intent is that the front end should immediately wrap any incoming
+/// [CompilerOptions] object in this class before doing further processing, and
+/// should thereafter access all options via the wrapper.  This ensures that
+/// options are interpreted in a consistent way and that data derived from
+/// options is not unnecessarily recomputed.
+class ProcessedOptions {
+  /// The raw [CompilerOptions] which this class wraps.
+  final CompilerOptions _raw;
+
+  /// The package map derived from the options, or `null` if the package map has
+  /// not been computed yet.
+  Map<String, Uri> _packages;
+
+  /// A URI resolver based on the options, or `null` if the URI resolver has not
+  /// been computed yet.
+  UriResolver _uriResolver;
+
+  /// The summary bundle for the SDK, or `null` if it has not been read yet.
+  PackageBundle _sdkSummary;
+
+  /// The location of the SDK, or `null` if the location hasn't been determined
+  /// yet.
+  Uri _sdkRoot;
+
+  /// Initializes a [ProcessedOptions] object wrapping the given [rawOptions].
+  ProcessedOptions(CompilerOptions rawOptions) : this._raw = rawOptions;
+
+  /// Determine whether to generate code for the SDK when compiling a
+  /// whole-program.
+  bool get compileSdk => _raw.compileSdk;
+
+  /// Get the [FileSystem] which should be used by the front end to access
+  /// files.
+  ///
+  /// If the client supplied roots using [CompilerOptions.multiRoots], the
+  /// returned [FileSystem] will automatically perform the appropriate mapping.
+  FileSystem get fileSystem {
+    // TODO(paulberry): support multiRoots.
+    assert(_raw.multiRoots.isEmpty);
+    return _raw.fileSystem;
+  }
+
+  /// Get the summary bundle for the SDK.
+  ///
+  /// This is an asynchronous getter since file system operations are required.
+  Future<PackageBundle> getSdkSummary() async {
+    if (_sdkSummary == null) {
+      Uri summaryLocation;
+      if (_raw.sdkSummary != null) {
+        // Options sdkSummary and sdkRoot are mutually exclusive.
+        assert(_raw.sdkRoot == null);
+        // No need to look for the SDK; we were told where the SDK summary is.
+        summaryLocation = _raw.sdkSummary;
+      } else {
+        // Need to look for the SDK summary inside the SDK.
+        var sdkRoot = await _getSdkRoot();
+        summaryLocation = sdkRoot.resolve(
+            'lib/_internal/' + (_raw.strongMode ? 'strong.sum' : 'spec.sum'));
+      }
+      var summaryBytes =
+          await fileSystem.entityForUri(summaryLocation).readAsBytes();
+      _sdkSummary = new PackageBundle.fromBuffer(summaryBytes);
+    }
+    return _sdkSummary;
+  }
+
+  /// Get the [UriResolver] which resolves "package:" and "dart:" URIs.
+  ///
+  /// This is an asynchronous getter since file system operations may be
+  /// required to locate/read the packages file as well as SDK metadata.
+  Future<UriResolver> getUriResolver() async {
+    if (_uriResolver == null) {
+      await _getPackages();
+      var sdkLibraries =
+          <String, Uri>{}; // TODO(paulberry): support SDK libraries
+      _uriResolver = new UriResolver(_packages, sdkLibraries);
+    }
+    return _uriResolver;
+  }
+
+  /// Get the package map which maps package names to URIs.
+  ///
+  /// This is an asynchronous getter since file system operations may be
+  /// required to locate/read the packages file.
+  Future<Map<String, Uri>> _getPackages() async {
+    if (_packages == null) {
+      if (_raw.packagesFileUri == null) {
+        throw new UnimplementedError(); // TODO(paulberry): search for .packages
+      } else if (_raw.packagesFileUri.path.isEmpty) {
+        _packages = {};
+      } else {
+        var contents =
+            await fileSystem.entityForUri(_raw.packagesFileUri).readAsBytes();
+        _packages = package_config.parse(contents, _raw.packagesFileUri);
+      }
+    }
+    return _packages;
+  }
+
+  /// Get the location of the SDK.
+  ///
+  /// This is an asynchronous getter since file system operations may be
+  /// required to locate the SDK.
+  Future<Uri> _getSdkRoot() async {
+    if (_sdkRoot == null) {
+      // If an SDK summary location was provided, the SDK itself should not be
+      // needed.
+      assert(_raw.sdkSummary == null);
+      if (_raw.sdkRoot == null) {
+        // TODO(paulberry): implement the algorithm for finding the SDK
+        // automagically.
+        throw new UnimplementedError();
+      }
+      _sdkRoot = _raw.sdkRoot;
+      if (!_sdkRoot.path.endsWith('/')) {
+        _sdkRoot = _sdkRoot.replace(path: _sdkRoot.path + '/');
+      }
+    }
+    return _sdkRoot;
+  }
+}
diff --git a/pkg/front_end/lib/src/base/source.dart b/pkg/front_end/lib/src/base/source.dart
index 0ed4747..a87f933 100644
--- a/pkg/front_end/lib/src/base/source.dart
+++ b/pkg/front_end/lib/src/base/source.dart
@@ -5,6 +5,33 @@
 import 'package:front_end/src/base/analysis_target.dart';
 import 'package:front_end/src/base/timestamped_data.dart';
 import 'package:front_end/src/base/uri_kind.dart';
+import 'package:path/path.dart' as pathos;
+
+/// Base class providing implementations for the methods in [Source] that don't
+/// require filesystem access.
+abstract class BasicSource extends Source {
+  final Uri uri;
+
+  BasicSource(this.uri);
+
+  @override
+  String get encoding => uri.toString();
+
+  @override
+  String get fullName => encoding;
+
+  @override
+  int get hashCode => uri.hashCode;
+
+  @override
+  bool get isInSystemLibrary => uri.scheme == 'dart';
+
+  @override
+  String get shortName => pathos.basename(fullName);
+
+  @override
+  bool operator ==(Object object) => object is Source && object.uri == uri;
+}
 
 /**
  * The interface `Source` defines the behavior of objects representing source code that can be
diff --git a/pkg/front_end/lib/src/base/uri_resolver.dart b/pkg/front_end/lib/src/base/uri_resolver.dart
new file mode 100644
index 0000000..0c6a420
--- /dev/null
+++ b/pkg/front_end/lib/src/base/uri_resolver.dart
@@ -0,0 +1,68 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// The class `UriResolver` implements the rules for resolving "dart:" and
+/// "package:" URIs.
+class UriResolver {
+  /// The URI scheme used for "package" URIs.
+  static const PACKAGE_SCHEME = 'package';
+
+  /// The URI scheme used for "dart" URIs.
+  static const DART_SCHEME = 'dart';
+
+  /// A map from package name to the file URI of the "lib" directory of the
+  /// corresponding package.  This is equivalent to the format returned by
+  /// the "package_config" package's parse() function.
+  final Map<String, Uri> packages;
+
+  /// A map from SDK library name (e.g. `core` for `dart:core`) to the file URI
+  /// of the defining compilation unit of the SDK library.
+  final Map<String, Uri> sdkLibraries;
+
+  UriResolver(this.packages, this.sdkLibraries);
+
+  /// Converts "package:" and "dart:" URIs to the locations of the corresponding
+  /// files.
+  ///
+  /// If the given URI is a "package:" or "dart:" URI, is well formed, and names
+  /// a package or dart library that is recognized, returns the URI it resolves
+  /// to.  If the given URI is a "package:" or "dart:" URI, and is ill-formed
+  /// or names a package or dart library that is not recognized, returns `null`.
+  ///
+  /// If the given URI has any scheme other than "package:" or "dart:", it is
+  /// returned unchanged.
+  ///
+  /// It is not necessary for the URI to be absolute (relative URIs will be
+  /// passed through unchanged).
+  ///
+  /// Note that no I/O is performed; the URI that is returned will be
+  /// independent of whether or not any particular file exists on the file
+  /// system.
+  Uri resolve(Uri uri) {
+    if (uri.scheme == DART_SCHEME || uri.scheme == PACKAGE_SCHEME) {
+      var path = uri.path;
+      var slashIndex = path.indexOf('/');
+      String prefix;
+      String rest;
+      if (slashIndex >= 0) {
+        prefix = path.substring(0, slashIndex);
+        rest = path.substring(slashIndex + 1);
+      } else {
+        prefix = path;
+        rest = '';
+      }
+      Uri libUri;
+      if (uri.scheme == PACKAGE_SCHEME) {
+        if (slashIndex < 0) return null;
+        libUri = packages[prefix];
+      } else if (uri.scheme == DART_SCHEME) {
+        libUri = sdkLibraries[prefix];
+      }
+      if (libUri == null) return null;
+      return libUri.resolve(rest);
+    } else {
+      return uri;
+    }
+  }
+}
diff --git a/pkg/front_end/lib/src/dependency_grapher_impl.dart b/pkg/front_end/lib/src/dependency_grapher_impl.dart
new file mode 100644
index 0000000..66aa443
--- /dev/null
+++ b/pkg/front_end/lib/src/dependency_grapher_impl.dart
@@ -0,0 +1,151 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/dart/scanner/reader.dart';
+import 'package:analyzer/src/generated/parser.dart';
+import 'package:front_end/dependency_grapher.dart';
+import 'package:front_end/src/async_dependency_walker.dart';
+import 'package:front_end/src/base/processed_options.dart';
+import 'package:front_end/src/base/uri_resolver.dart';
+import 'package:front_end/src/scanner/scanner.dart';
+
+/// Generates a representation of the dependency graph of a program.
+///
+/// Given the Uri of one or more files, this function follows `import`,
+/// `export`, and `part` declarations to discover a graph of all files involved
+/// in the program.
+///
+/// If a [fileReader] is supplied, it is used to read file contents; otherwise
+/// they are read directly from `options.fileSystem`.
+///
+/// This is intended for internal use by the front end.  Clients should use
+/// package:front_end/dependency_grapher.dart.
+Future<Graph> graphForProgram(List<Uri> sources, ProcessedOptions options,
+    {FileReader fileReader}) async {
+  var uriResolver = await options.getUriResolver();
+  fileReader ??= (originalUri, resolvedUri) =>
+      options.fileSystem.entityForUri(resolvedUri).readAsString();
+  var walker = new _Walker(fileReader, uriResolver, options.compileSdk);
+  var startingPoint = new _StartingPoint(walker, sources);
+  await walker.walk(startingPoint);
+  return walker.graph;
+}
+
+/// Type of the callback function used by [graphForProgram] to read file
+/// contents.
+typedef Future<String> FileReader(Uri originalUri, Uri resolvedUri);
+
+class _Scanner extends Scanner {
+  _Scanner(String contents) : super(new CharSequenceReader(contents)) {
+    preserveComments = false;
+  }
+
+  @override
+  void reportError(errorCode, int offset, List<Object> arguments) {
+    // TODO(paulberry): report errors.
+  }
+}
+
+class _StartingPoint extends _WalkerNode {
+  final List<Uri> sources;
+
+  _StartingPoint(_Walker walker, this.sources) : super(walker, null);
+
+  @override
+  Future<List<_WalkerNode>> computeDependencies() async =>
+      sources.map(walker.nodeForUri).toList();
+}
+
+class _Walker extends AsyncDependencyWalker<_WalkerNode> {
+  final FileReader fileReader;
+  final UriResolver uriResolver;
+  final _nodesByUri = <Uri, _WalkerNode>{};
+  final graph = new Graph();
+  final bool compileSdk;
+
+  _Walker(this.fileReader, this.uriResolver, this.compileSdk);
+
+  @override
+  Future<Null> evaluate(_WalkerNode v) {
+    if (v is _StartingPoint) return new Future.value();
+    return evaluateScc([v]);
+  }
+
+  @override
+  Future<Null> evaluateScc(List<_WalkerNode> scc) {
+    var cycle = new LibraryCycleNode();
+    for (var walkerNode in scc) {
+      cycle.libraries[walkerNode.uri] = walkerNode.library;
+    }
+    graph.topologicallySortedCycles.add(cycle);
+    return new Future.value();
+  }
+
+  _WalkerNode nodeForUri(Uri referencedUri) {
+    var dependencyNode = _nodesByUri.putIfAbsent(
+        referencedUri, () => new _WalkerNode(this, referencedUri));
+    return dependencyNode;
+  }
+}
+
+class _WalkerNode extends Node<_WalkerNode> {
+  static final dartCoreUri = Uri.parse('dart:core');
+  final _Walker walker;
+  final Uri uri;
+  final LibraryNode library;
+
+  _WalkerNode(this.walker, Uri uri)
+      : uri = uri,
+        library = new LibraryNode(uri);
+
+  @override
+  Future<List<_WalkerNode>> computeDependencies() async {
+    var dependencies = <_WalkerNode>[];
+    // TODO(paulberry): add error recovery if the file can't be read.
+    var resolvedUri = walker.uriResolver.resolve(uri);
+    if (resolvedUri == null) {
+      // TODO(paulberry): If an error reporter was provided, report the error
+      // in the proper way and continue.
+      throw new StateError('Invalid URI: $uri');
+    }
+    var contents = await walker.fileReader(uri, resolvedUri);
+    var scanner = new _Scanner(contents);
+    var token = scanner.tokenize();
+    // TODO(paulberry): report errors.
+    var parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER);
+    var unit = parser.parseDirectives(token);
+    bool coreUriFound = false;
+    void handleDependency(Uri referencedUri) {
+      _WalkerNode dependencyNode = walker.nodeForUri(referencedUri);
+      library.dependencies.add(dependencyNode.library);
+      if (referencedUri.scheme != 'dart' || walker.compileSdk) {
+        dependencies.add(dependencyNode);
+      }
+      if (referencedUri == dartCoreUri) {
+        coreUriFound = true;
+      }
+    }
+
+    for (var directive in unit.directives) {
+      if (directive is UriBasedDirective) {
+        // TODO(paulberry): when we support SDK libraries, we'll need more
+        // complex logic here to find SDK parts correctly.
+        var referencedUri = uri.resolve(directive.uri.stringValue);
+        if (directive is PartDirective) {
+          library.parts.add(referencedUri);
+        } else {
+          handleDependency(referencedUri);
+        }
+      }
+    }
+    if (!coreUriFound) {
+      handleDependency(dartCoreUri);
+    }
+    return dependencies;
+  }
+}
diff --git a/pkg/front_end/lib/src/dependency_walker.dart b/pkg/front_end/lib/src/dependency_walker.dart
new file mode 100644
index 0000000..7a27acb
--- /dev/null
+++ b/pkg/front_end/lib/src/dependency_walker.dart
@@ -0,0 +1,168 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * Instances of [Node] represent nodes in a dependency graph.  The
+ * type parameter, [NodeType], is the derived type (this affords some
+ * extra type safety by making it difficult to accidentally construct
+ * bridges between unrelated dependency graphs).
+ */
+abstract class Node<NodeType> {
+  /**
+   * Index used by Tarjan's strongly connected components algorithm.
+   * Zero means the node has not been visited yet; a nonzero value
+   * counts the order in which the node was visited.
+   */
+  int _index = 0;
+
+  /**
+   * Low link used by Tarjan's strongly connected components
+   * algorithm.  This represents the smallest [_index] of all the nodes
+   * in the strongly connected component to which this node belongs.
+   */
+  int _lowLink = 0;
+
+  List<NodeType> _dependencies;
+
+  /**
+   * Retrieve the dependencies of this node.
+   */
+  List<NodeType> get dependencies => _dependencies ??= computeDependencies();
+
+  /**
+   * Indicates whether this node has been evaluated yet.
+   */
+  bool get isEvaluated;
+
+  /**
+   * Compute the dependencies of this node.
+   */
+  List<NodeType> computeDependencies();
+}
+
+/**
+ * An instance of [DependencyWalker] contains the core algorithms for
+ * walking a dependency graph and evaluating nodes in a safe order.
+ */
+abstract class DependencyWalker<NodeType extends Node<NodeType>> {
+  /**
+   * Called by [walk] to evaluate a single non-cyclical node, after
+   * all that node's dependencies have been evaluated.
+   */
+  void evaluate(NodeType v);
+
+  /**
+   * Called by [walk] to evaluate a strongly connected component
+   * containing one or more nodes.  All dependencies of the strongly
+   * connected component have been evaluated.
+   */
+  void evaluateScc(List<NodeType> scc);
+
+  /**
+   * Walk the dependency graph starting at [startingPoint], finding
+   * strongly connected components and evaluating them in a safe order
+   * by calling [evaluate] and [evaluateScc].
+   *
+   * This is an implementation of Tarjan's strongly connected
+   * components algorithm
+   * (https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm).
+   */
+  void walk(NodeType startingPoint) {
+    // TODO(paulberry): consider rewriting in a non-recursive way so
+    // that long dependency chains don't cause stack overflow.
+
+    // TODO(paulberry): in the event that an exception occurs during
+    // the walk, restore the state of the [Node] data structures so
+    // that further evaluation will be safe.
+
+    // The index which will be assigned to the next node that is
+    // freshly visited.
+    int index = 1;
+
+    // Stack of nodes which have been seen so far and whose strongly
+    // connected component is still being determined.  Nodes are only
+    // popped off the stack when they are evaluated, so sometimes the
+    // stack contains nodes that were visited after the current node.
+    List<NodeType> stack = <NodeType>[];
+
+    void strongConnect(NodeType node) {
+      bool hasTrivialCycle = false;
+
+      // Assign the current node an index and add it to the stack.  We
+      // haven't seen any of its dependencies yet, so set its lowLink
+      // to its index, indicating that so far it is the only node in
+      // its strongly connected component.
+      node._index = node._lowLink = index++;
+      stack.add(node);
+
+      // Consider the node's dependencies one at a time.
+      for (NodeType dependency in node.dependencies) {
+        // If the dependency has already been evaluated, it can't be
+        // part of this node's strongly connected component, so we can
+        // skip it.
+        if (dependency.isEvaluated) {
+          continue;
+        }
+        if (identical(node, dependency)) {
+          // If a node includes itself as a dependency, there is no need to
+          // explore the dependency further.
+          hasTrivialCycle = true;
+        } else if (dependency._index == 0) {
+          // The dependency hasn't been seen yet, so recurse on it.
+          strongConnect(dependency);
+          // If the dependency's lowLink refers to a node that was
+          // visited before the current node, that means that the
+          // current node, the dependency, and the node referred to by
+          // the dependency's lowLink are all part of the same
+          // strongly connected component, so we need to update the
+          // current node's lowLink accordingly.
+          if (dependency._lowLink < node._lowLink) {
+            node._lowLink = dependency._lowLink;
+          }
+        } else {
+          // The dependency has already been seen, so it is part of
+          // the current node's strongly connected component.  If it
+          // was visited earlier than the current node's lowLink, then
+          // it is a new addition to the current node's strongly
+          // connected component, so we need to update the current
+          // node's lowLink accordingly.
+          if (dependency._index < node._lowLink) {
+            node._lowLink = dependency._index;
+          }
+        }
+      }
+
+      // If the current node's lowLink is the same as its index, then
+      // we have finished visiting a strongly connected component, so
+      // pop the stack and evaluate it before moving on.
+      if (node._lowLink == node._index) {
+        // The strongly connected component has only one node.  If there is a
+        // cycle, it's a trivial one.
+        if (identical(stack.last, node)) {
+          stack.removeLast();
+          if (hasTrivialCycle) {
+            evaluateScc(<NodeType>[node]);
+          } else {
+            evaluate(node);
+          }
+        } else {
+          // There are multiple nodes in the strongly connected
+          // component.
+          List<NodeType> scc = <NodeType>[];
+          while (true) {
+            NodeType otherNode = stack.removeLast();
+            scc.add(otherNode);
+            if (identical(otherNode, node)) {
+              break;
+            }
+          }
+          evaluateScc(scc);
+        }
+      }
+    }
+
+    // Kick off the algorithm starting with the starting point.
+    strongConnect(startingPoint);
+  }
+}
diff --git a/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
new file mode 100644
index 0000000..50473eb
--- /dev/null
+++ b/pkg/front_end/lib/src/incremental_kernel_generator_impl.dart
@@ -0,0 +1,152 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/error/error.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:front_end/incremental_kernel_generator.dart';
+import 'package:front_end/incremental_resolved_ast_generator.dart';
+import 'package:front_end/src/base/processed_options.dart';
+import 'package:front_end/src/base/source.dart';
+import 'package:front_end/src/incremental_resolved_ast_generator_impl.dart';
+import 'package:kernel/analyzer/loader.dart';
+import 'package:kernel/kernel.dart' hide Source;
+import 'package:kernel/repository.dart';
+
+dynamic unimplemented() {
+  // TODO(paulberry): get rid of this.
+  throw new UnimplementedError();
+}
+
+DartOptions _convertOptions(ProcessedOptions options) {
+  // TODO(paulberry): make sure options.compileSdk is handled correctly.
+  return new DartOptions(
+      strongMode: true, // TODO(paulberry): options.strongMode,
+      sdk: null, // TODO(paulberry): _uriToPath(options.sdkRoot, options),
+      sdkSummary:
+          null, // TODO(paulberry): options.compileSdk ? null : _uriToPath(options.sdkSummary, options),
+      packagePath:
+          null, // TODO(paulberry): _uriToPath(options.packagesFileUri, options),
+      declaredVariables: null // TODO(paulberry): options.declaredVariables
+      );
+}
+
+/// Implementation of [IncrementalKernelGenerator].
+///
+/// Theory of operation: an instance of [IncrementalResolvedAstGenerator] is
+/// used to obtain resolved ASTs, and these are fed into kernel code generation
+/// logic.
+///
+/// Note that the kernel doesn't expect to take resolved ASTs as a direct input;
+/// it expects to request resolved ASTs from an [AnalysisContext].  To deal with
+/// this, we create [_AnalysisContextProxy] which returns the resolved ASTs when
+/// requested.  TODO(paulberry): Make this unnecessary.
+class IncrementalKernelGeneratorImpl implements IncrementalKernelGenerator {
+  final IncrementalResolvedAstGenerator _resolvedAstGenerator;
+  final ProcessedOptions _options;
+
+  IncrementalKernelGeneratorImpl(Uri source, ProcessedOptions options)
+      : _resolvedAstGenerator =
+            new IncrementalResolvedAstGeneratorImpl(source, options),
+        _options = options;
+
+  @override
+  Future<DeltaProgram> computeDelta(
+      {Future<Null> watch(Uri uri, bool used)}) async {
+    var deltaLibraries = await _resolvedAstGenerator.computeDelta();
+    var kernelOptions = _convertOptions(_options);
+    var packages = null; // TODO(paulberry)
+    var kernels = <Uri, Program>{};
+    for (Uri uri in deltaLibraries.newState.keys) {
+      // The kernel generation code doesn't currently support building a kernel
+      // directly from resolved ASTs--it wants to query an analysis context.  So
+      // we provide it with a proxy analysis context that feeds it the resolved
+      // ASTs.
+      var strongMode = true; // TODO(paulberry): set this correctly
+      var analysisOptions = new _AnalysisOptionsProxy(strongMode);
+      var context =
+          new _AnalysisContextProxy(deltaLibraries.newState, analysisOptions);
+      var repository = new Repository();
+      var loader =
+          new DartLoader(repository, kernelOptions, packages, context: context);
+      loader.loadLibrary(uri);
+      kernels[uri] = new Program(repository.libraries);
+      // TODO(paulberry) rework watch invocation to eliminate race condition,
+      // include part source files, and prevent watch from being a bottleneck
+      if (watch != null) await watch(uri, true);
+    }
+    // TODO(paulberry) invoke watch with used=false for each unused source
+    return new DeltaProgram(kernels);
+  }
+
+  @override
+  void invalidate(String path) => _resolvedAstGenerator.invalidate(path);
+
+  @override
+  void invalidateAll() => _resolvedAstGenerator.invalidateAll();
+}
+
+class _AnalysisContextProxy implements AnalysisContext {
+  final Map<Uri, ResolvedLibrary> _resolvedLibraries;
+
+  @override
+  final _SourceFactoryProxy sourceFactory = new _SourceFactoryProxy();
+
+  @override
+  final AnalysisOptions analysisOptions;
+
+  _AnalysisContextProxy(this._resolvedLibraries, this.analysisOptions);
+
+  List<AnalysisError> computeErrors(Source source) {
+    // TODO(paulberry): do we need to return errors sometimes?
+    return [];
+  }
+
+  LibraryElement computeLibraryElement(Source source) {
+    assert(_resolvedLibraries.containsKey(source.uri));
+    return resolutionMap
+        .elementDeclaredByCompilationUnit(
+            _resolvedLibraries[source.uri].definingCompilationUnit)
+        .library;
+  }
+
+  noSuchMethod(Invocation invocation) => unimplemented();
+
+  CompilationUnit resolveCompilationUnit(
+      Source unitSource, LibraryElement library) {
+    assert(_resolvedLibraries.containsKey(library.source.uri));
+    var resolvedLibrary = _resolvedLibraries[library.source.uri];
+    if (unitSource == library.source) {
+      return resolvedLibrary.definingCompilationUnit;
+    } else {
+      assert(resolvedLibrary.partUnits.containsKey(unitSource.uri));
+      return resolvedLibrary.partUnits[unitSource.uri];
+    }
+  }
+}
+
+class _AnalysisOptionsProxy implements AnalysisOptions {
+  final bool strongMode;
+
+  _AnalysisOptionsProxy(this.strongMode);
+
+  noSuchMethod(Invocation invocation) => unimplemented();
+}
+
+class _SourceFactoryProxy implements SourceFactory {
+  Source forUri2(Uri absoluteUri) => new _SourceProxy(absoluteUri);
+
+  noSuchMethod(Invocation invocation) => unimplemented();
+}
+
+class _SourceProxy extends BasicSource {
+  _SourceProxy(Uri uri) : super(uri);
+
+  noSuchMethod(Invocation invocation) => unimplemented();
+}
diff --git a/pkg/front_end/lib/src/incremental_resolved_ast_generator_impl.dart b/pkg/front_end/lib/src/incremental_resolved_ast_generator_impl.dart
new file mode 100644
index 0000000..aa51fbf
--- /dev/null
+++ b/pkg/front_end/lib/src/incremental_resolved_ast_generator_impl.dart
@@ -0,0 +1,299 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/context/context.dart';
+import 'package:analyzer/src/dart/analysis/byte_store.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart' as driver;
+import 'package:analyzer/src/dart/analysis/file_state.dart';
+import 'package:analyzer/src/generated/engine.dart';
+import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/utilities_dart.dart';
+import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/util/absolute_path.dart';
+import 'package:front_end/incremental_resolved_ast_generator.dart';
+import 'package:front_end/src/base/file_repository.dart';
+import 'package:front_end/src/base/processed_options.dart';
+import 'package:front_end/src/base/source.dart';
+import 'package:front_end/src/dependency_grapher_impl.dart';
+import 'package:path/src/context.dart';
+
+dynamic unimplemented() {
+  // TODO(paulberry): get rid of this.
+  throw new UnimplementedError();
+}
+
+/// Implementation of [IncrementalKernelGenerator].
+///
+/// Theory of operation: this class is a thin wrapper around
+/// [driver.AnalysisDriver].  When the client requests a new delta, we forward
+/// the request to the analysis driver.  When the client calls an invalidate
+/// method, we ensure that the proper files will be re-read next time a delta is
+/// requested.
+///
+/// Note that the analysis driver expects to be able to read file contents
+/// synchronously based on filesystem path rather than asynchronously based on
+/// URI, so the file contents are first read into memory using the asynchronous
+/// FileSystem API, and then these are fed into the analysis driver using a
+/// proxy implementation of [ResourceProvider].  TODO(paulberry): make this (and
+/// other proxies in this file) unnecessary.
+class IncrementalResolvedAstGeneratorImpl
+    implements IncrementalResolvedAstGenerator {
+  driver.AnalysisDriverScheduler _scheduler;
+  final _fileRepository = new FileRepository();
+  _ResourceProviderProxy _resourceProvider;
+  driver.AnalysisDriver _driver;
+  bool _isInitialized = false;
+  final ProcessedOptions _options;
+  final Uri _source;
+  bool _schedulerStarted = false;
+  final _fileState = <Uri, String>{};
+
+  IncrementalResolvedAstGeneratorImpl(this._source, this._options);
+
+  @override
+  Future<DeltaLibraries> computeDelta() async {
+    if (!_isInitialized) {
+      await init();
+    }
+    // The analysis driver doesn't currently support an asynchronous file API,
+    // so we have to find all the files first to read their contents.
+    // TODO(paulberry): this is an unnecessary source of duplicate work and
+    // should be eliminated ASAP.
+    var graph =
+        await graphForProgram([_source], _options, fileReader: _fileReader);
+    // TODO(paulberry): collect no-longer-referenced files from _fileState and
+    // _fileRepository.
+    var libraries = <Uri, ResolvedLibrary>{};
+    if (!_schedulerStarted) {
+      _scheduler.start();
+      _schedulerStarted = true;
+    }
+    for (var libraryCycle in graph.topologicallySortedCycles) {
+      for (var libraryUri in libraryCycle.libraries.keys) {
+        var libraryNode = libraryCycle.libraries[libraryUri];
+        for (var partUri in libraryNode.parts) {
+          // TODO(paulberry): resolve the part URI.
+          _fileReader(partUri, partUri);
+        }
+      }
+      for (var libraryUri in libraryCycle.libraries.keys) {
+        var libraryNode = libraryCycle.libraries[libraryUri];
+        var result =
+            await _driver.getResult(_fileRepository.pathForUri(libraryUri));
+        // TODO(paulberry): handle errors.
+        var definingCompilationUnit = result.unit;
+        var partUnits = <Uri, CompilationUnit>{};
+        for (var partUri in libraryNode.parts) {
+          // Really we ought to have a driver API that lets us request a
+          // specific part of a given library.  Otherwise we will run into
+          // problems if a part is included in multiple libraries.
+          // TODO(paulberry): address this.
+          var partResult =
+              await _driver.getResult(_fileRepository.pathForUri(partUri));
+          // TODO(paulberry): handle errors.
+          partUnits[partUri] = partResult.unit;
+        }
+        libraries[libraryUri] =
+            new ResolvedLibrary(definingCompilationUnit, partUnits);
+      }
+    }
+    _driver.addFile(_fileRepository.pathForUri(_source));
+    // TODO(paulberry): stop the scheduler
+    return new DeltaLibraries(libraries);
+  }
+
+  Future<Null> init() async {
+    // TODO(paulberry): can we just use null?
+    var performanceLog = new driver.PerformanceLog(new _NullStringSink());
+    _scheduler = new driver.AnalysisDriverScheduler(performanceLog);
+    _resourceProvider = new _ResourceProviderProxy(_fileRepository);
+    // TODO(paulberry): MemoryByteStore leaks memory (it never discards data).
+    // Do something better here.
+    var byteStore = new MemoryByteStore();
+    // TODO(paulberry): can we just use null?
+    var fileContentOverlay = new FileContentOverlay();
+    var sdkContext = new AnalysisContextImpl();
+    var sdkBundle = await _options.getSdkSummary();
+    var dartSdk = new _DartSdkProxy(sdkBundle, sdkContext, _fileRepository);
+    sdkContext.sourceFactory =
+        new SourceFactory([new DartUriResolver(dartSdk)]);
+
+    var sourceFactory = new _SourceFactoryProxy(dartSdk, _fileRepository);
+    var analysisOptions = new AnalysisOptionsImpl();
+    _driver = new driver.AnalysisDriver(
+        _scheduler,
+        performanceLog,
+        _resourceProvider,
+        byteStore,
+        fileContentOverlay,
+        'front_end',
+        sourceFactory,
+        analysisOptions,
+        sdkBundle: sdkBundle);
+    _isInitialized = true;
+  }
+
+  @override
+  void invalidate(String path) {
+    throw new UnimplementedError();
+  }
+
+  @override
+  void invalidateAll() {
+    _fileState.clear();
+    _fileRepository.clearContents();
+    // TODO(paulberry): verify that this has an effect (requires a multi-file
+    // test).
+    if (_isInitialized) {
+      _driver.knownFiles.forEach(_driver.changeFile);
+    }
+  }
+
+  Future<String> _fileReader(Uri originalUri, Uri resolvedUri) async {
+    String contents = _fileState[resolvedUri] ??=
+        await _options.fileSystem.entityForUri(resolvedUri).readAsString();
+    _fileRepository.store(originalUri, contents);
+    return contents;
+  }
+}
+
+class _DartSdkProxy implements DartSdk {
+  final PackageBundle summary;
+
+  final AnalysisContext context;
+
+  final FileRepository _fileRepository;
+
+  _DartSdkProxy(this.summary, this.context, this._fileRepository);
+
+  @override
+  PackageBundle getLinkedBundle() => summary;
+
+  @override
+  Source mapDartUri(String uriString) {
+    var uri = Uri.parse(uriString);
+    return new _SourceProxy(
+        uri, _fileRepository.pathForUri(uri, allocate: true));
+  }
+
+  noSuchMethod(Invocation invocation) => unimplemented();
+}
+
+class _FileProxy implements File {
+  final _SourceProxy _source;
+
+  final _ResourceProviderProxy _resourceProvider;
+
+  _FileProxy(this._source, this._resourceProvider);
+
+  @override
+  String get path => _source.fullName;
+
+  @override
+  String get shortName => path;
+
+  @override
+  Source createSource([Uri uri]) {
+    assert(uri == null);
+    return _source;
+  }
+
+  noSuchMethod(Invocation invocation) => unimplemented();
+
+  @override
+  String readAsStringSync() {
+    return _resourceProvider._fileRepository.contentsForPath(path);
+  }
+}
+
+/// A string sink that ignores everything written to it.
+class _NullStringSink implements StringSink {
+  void write(Object obj) {}
+  void writeAll(Iterable objects, [String separator = ""]) {}
+  void writeCharCode(int charCode) {}
+  void writeln([Object obj = ""]) {}
+}
+
+class _ResourceProviderProxy implements ResourceProvider {
+  final FileRepository _fileRepository;
+
+  _ResourceProviderProxy(this._fileRepository);
+
+  @override
+  AbsolutePathContext get absolutePathContext => throw new UnimplementedError();
+
+  @override
+  Context get pathContext => throw new UnimplementedError();
+
+  @override
+  File getFile(String path) {
+    return new _FileProxy(
+        new _SourceProxy(_fileRepository.uriForPath(path), path), this);
+  }
+
+  @override
+  Folder getFolder(String path) => throw new UnimplementedError();
+
+  @override
+  Future<List<int>> getModificationTimes(List<Source> sources) =>
+      throw new UnimplementedError();
+
+  @override
+  Resource getResource(String path) => throw new UnimplementedError();
+
+  @override
+  Folder getStateLocation(String pluginId) => throw new UnimplementedError();
+}
+
+class _SourceFactoryProxy implements SourceFactory {
+  @override
+  final DartSdk dartSdk;
+
+  final FileRepository _fileRepository;
+
+  @override
+  AnalysisContext context;
+
+  _SourceFactoryProxy(this.dartSdk, this._fileRepository);
+
+  @override
+  SourceFactory clone() => new _SourceFactoryProxy(dartSdk, _fileRepository);
+
+  @override
+  Source forUri(String absoluteUri) {
+    Uri uri = Uri.parse(absoluteUri);
+    return new _SourceProxy(
+        uri, _fileRepository.pathForUri(uri, allocate: true));
+  }
+
+  noSuchMethod(Invocation invocation) => unimplemented();
+
+  Source resolveUri(Source containingSource, String containedUri) {
+    // TODO(paulberry): re-use code from dependency_grapher_impl, and support
+    // SDK URI resolution logic.
+    String absoluteUri =
+        resolveRelativeUri(containingSource?.uri, Uri.parse(containedUri))
+            .toString();
+    return forUri(absoluteUri);
+  }
+
+  @override
+  Uri restoreUri(Source source) => source.uri;
+}
+
+class _SourceProxy extends BasicSource {
+  @override
+  final String fullName;
+
+  _SourceProxy(Uri uri, this.fullName) : super(uri);
+
+  int get modificationStamp => 0;
+
+  noSuchMethod(Invocation invocation) => unimplemented();
+}
diff --git a/pkg/front_end/lib/src/libraries_reader.dart b/pkg/front_end/lib/src/libraries_reader.dart
new file mode 100644
index 0000000..ded5d9f
--- /dev/null
+++ b/pkg/front_end/lib/src/libraries_reader.dart
@@ -0,0 +1,201 @@
+import 'package:analyzer/src/summary/idl.dart';
+import 'package:front_end/src/base/library_info.dart';
+
+/// Decodes the contents of the SDK's "libraries.dart" file.
+///
+/// Caller should pass in the unlinked summary of the libraries.dart file.  This
+/// function will materialize the "libraries" constant based on information in
+/// the summary.
+///
+/// Note that this code is not intended to be fully general; it makes some
+/// assumptions about the structure of the "libraries.dart" file (such as what
+/// declarations are expected to be present in it, and the types of those
+/// declarations).
+Map<String, LibraryInfo> readLibraries(UnlinkedUnit librariesUnit) {
+  var constContext = new _ConstContext(librariesUnit.references);
+  for (var variable in librariesUnit.variables) {
+    if (!variable.isConst) continue;
+    constContext.topLevelConstants[variable.name] =
+        new _ConstVariable(variable.initializer.bodyExpr, constContext);
+  }
+  for (var cls in librariesUnit.classes) {
+    if (cls.name == 'Maturity') {
+      for (var field in cls.fields) {
+        if (!field.isConst) continue;
+        constContext.maturityConstants[field.name] =
+            new _ConstVariable(field.initializer.bodyExpr, constContext);
+      }
+    }
+  }
+  return constContext.topLevelConstants['libraries'].value;
+}
+
+/// Function type used to invoke a constructor based on dynamic information.
+///
+/// Caller supplies two callbacks ([positional] and [named]) which can be used
+/// to query the arguments passed to the constructor.  These callbacks will
+/// return the requested argument if it was provided; otherwise they will return
+/// the supplied default value.
+typedef dynamic _Constructor(dynamic positional(int i, [dynamic defaultValue]),
+    dynamic named(String name, [dynamic defaultValue]));
+
+/// Contextual information used to evaluate constants in the "libraries.dart"
+/// file.
+class _ConstContext {
+  /// Top level constants in the "libraries.dart" file.
+  final topLevelConstants = <String, _ConstVariable>{};
+
+  /// Static constants in "libraries.dart"'s "Maturity" class.
+  final maturityConstants = <String, _ConstVariable>{};
+
+  /// References from the unlinked summary of the "libraries.dart" file.
+  final List<UnlinkedReference> references;
+
+  _ConstContext(this.references);
+}
+
+/// Information necessary to evaluate a single constant from the
+/// "libraries.dart" file.
+class _ConstVariable {
+  /// The constant expression from the unlinked summary.
+  final UnlinkedExpr expr;
+
+  /// Contextual information necessary to evaluate the constant.
+  final _ConstContext context;
+
+  /// The evaluated value, or `null` if it hasn't been evaluated yet.
+  dynamic _value;
+
+  _ConstVariable(this.expr, this.context);
+
+  /// Evaluate the constant (if necessary) and return it.
+  dynamic get value => _value ??= _materialize();
+
+  /// Find the constructor referred to by [entityRef] and return a function
+  /// which may be used to invoke it.
+  _Constructor _findConstructor(EntityRef entityRef) {
+    // This method is not fully general; we only support the constructor
+    // invocations that we expect to find in LibraryInfo.
+    assert(entityRef.implicitFunctionTypeIndices.isEmpty);
+    assert(entityRef.paramReference == 0);
+    assert(entityRef.syntheticParams.isEmpty);
+    assert(entityRef.syntheticReturnType == null);
+    assert(entityRef.typeArguments.isEmpty);
+    var reference = context.references[entityRef.reference];
+    assert(reference.prefixReference == 0);
+    switch (reference.name) {
+      case 'LibraryInfo':
+        return (dynamic positional(int i, [dynamic defaultValue]),
+                dynamic named(String name, [dynamic defaultValue])) =>
+            new LibraryInfo(positional(0),
+                categories: named('categories', ''),
+                dart2jsPath: named('dart2jsPath'),
+                dart2jsPatchPath: named('dart2jsPatchPath'),
+                implementation: named('implementation', false),
+                documented: named('documented', true),
+                maturity: named('maturity', Maturity.UNSPECIFIED),
+                platforms: named('platforms', DART2JS_PLATFORM | VM_PLATFORM));
+      case 'Maturity':
+        return (dynamic positional(int i, [dynamic defaultValue]),
+                dynamic named(String name, [dynamic defaultValue])) =>
+            new Maturity(positional(0), positional(1), positional(2));
+      default:
+        throw new UnimplementedError(
+            'Unexpected constructor reference: ${reference.name}');
+    }
+  }
+
+  /// Compute the value referred to by [entityRef].
+  dynamic _findReference(EntityRef entityRef) {
+    // This method is not fully general; we only support the references that we
+    // expect to find in LibraryInfo.
+    assert(entityRef.implicitFunctionTypeIndices.isEmpty);
+    assert(entityRef.paramReference == 0);
+    assert(entityRef.syntheticParams.isEmpty);
+    assert(entityRef.syntheticReturnType == null);
+    assert(entityRef.typeArguments.isEmpty);
+    var reference = context.references[entityRef.reference];
+    if (reference.prefixReference == 0) {
+      return context.topLevelConstants[reference.name].value;
+    } else {
+      assert(reference.prefixReference != 0);
+      var prefixReference = context.references[reference.prefixReference];
+      assert(prefixReference.name == 'Maturity');
+      assert(prefixReference.prefixReference == 0);
+      return context.maturityConstants[reference.name].value;
+    }
+  }
+
+  /// Compute the value of the constant.
+  dynamic _materialize() {
+    var stack = [];
+    var stringIndex = 0;
+    var intIndex = 0;
+    var referenceIndex = 0;
+    List popItems(int count) {
+      var items = stack.sublist(stack.length - count, stack.length);
+      stack.length -= count;
+      return items;
+    }
+
+    for (var operation in expr.operations) {
+      switch (operation) {
+        case UnlinkedExprOperation.pushString:
+          stack.add(expr.strings[stringIndex++]);
+          break;
+        case UnlinkedExprOperation.invokeConstructor:
+          var namedArgumentList = popItems(expr.ints[intIndex++]);
+          var namedArguments = <String, dynamic>{};
+          for (var namedArgument in namedArgumentList) {
+            namedArguments[expr.strings[stringIndex++]] = namedArgument;
+          }
+          var positionalArguments = popItems(expr.ints[intIndex++]);
+          stack.add(_findConstructor(expr.references[referenceIndex++])(
+              (i, [defaultValue]) => i < positionalArguments.length
+                  ? positionalArguments[i]
+                  : defaultValue,
+              (name, [defaultValue]) => namedArguments.containsKey(name)
+                  ? namedArguments[name]
+                  : defaultValue));
+          break;
+        case UnlinkedExprOperation.makeUntypedMap:
+          var map = {};
+          var numKeyValuePairs = expr.ints[intIndex++];
+          var keyValueList = popItems(numKeyValuePairs * 2);
+          for (var i = 0; i < numKeyValuePairs; i++) {
+            map[keyValueList[2 * i]] = keyValueList[2 * i + 1];
+          }
+          stack.add(map);
+          break;
+        case UnlinkedExprOperation.pushReference:
+          stack.add(_findReference(expr.references[referenceIndex++]));
+          break;
+        case UnlinkedExprOperation.pushInt:
+          stack.add(expr.ints[intIndex++]);
+          break;
+        case UnlinkedExprOperation.pushFalse:
+          stack.add(false);
+          break;
+        case UnlinkedExprOperation.pushTrue:
+          stack.add(true);
+          break;
+        case UnlinkedExprOperation.bitOr:
+          var y = stack.removeLast();
+          var x = stack.removeLast();
+          stack.add(x | y);
+          break;
+        default:
+          throw new UnimplementedError(
+              'Unexpected expression in libraries.dart: $operation');
+      }
+    }
+    assert(stringIndex == expr.strings.length);
+    assert(intIndex == expr.ints.length);
+    assert(referenceIndex == expr.references.length);
+    assert(stack.length == 1);
+    if (stack[0] == null) {
+      throw new StateError('Unexpected null constant in libraries.dart');
+    }
+    return stack[0];
+  }
+}
diff --git a/pkg/front_end/lib/src/scanner/token.dart b/pkg/front_end/lib/src/scanner/token.dart
index 95c1005..abd0194 100644
--- a/pkg/front_end/lib/src/scanner/token.dart
+++ b/pkg/front_end/lib/src/scanner/token.dart
@@ -166,6 +166,9 @@
 
   static const Keyword CONTINUE = const Keyword._('CONTINUE', "continue");
 
+  static const Keyword COVARIANT =
+      const Keyword._('COVARIANT', "covariant", true);
+
   static const Keyword DEFAULT = const Keyword._('DEFAULT', "default");
 
   static const Keyword DEFERRED = const Keyword._('DEFERRED', "deferred", true);
@@ -257,6 +260,7 @@
     CLASS,
     CONST,
     CONTINUE,
+    COVARIANT,
     DEFAULT,
     DEFERRED,
     DO,
diff --git a/pkg/front_end/test/dependency_grapher_test.dart b/pkg/front_end/test/dependency_grapher_test.dart
new file mode 100644
index 0000000..826283d
--- /dev/null
+++ b/pkg/front_end/test/dependency_grapher_test.dart
@@ -0,0 +1,195 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:front_end/compiler_options.dart';
+import 'package:front_end/dependency_grapher.dart';
+import 'package:front_end/memory_file_system.dart';
+import 'package:path/path.dart' as pathos;
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(DependencyGrapherTest);
+  });
+}
+
+@reflectiveTest
+class DependencyGrapherTest {
+  LibraryNode checkLibrary(LibraryCycleNode cycle, String uri,
+      {List<String> dependencies: const ['dart:core'],
+      List<String> parts: const []}) {
+    var library = cycle.libraries[Uri.parse(uri)];
+    expect('${library.uri}', uri);
+    expect(library.dependencies.map((dep) => '${dep.uri}'),
+        unorderedEquals(dependencies));
+    expect(library.parts.map((part) => '$part'), unorderedEquals(parts));
+    return library;
+  }
+
+  Future<List<LibraryCycleNode>> getCycles(Map<String, String> contents,
+      {List<String> startingPoints, String packagesFilePath = ''}) async {
+    // If no starting points given, assume the first entry in [contents] is the
+    // single starting point.
+    startingPoints ??= [contents.keys.first];
+    var fileSystem = new MemoryFileSystem(pathos.posix, Uri.parse('file:///'));
+    contents.forEach((path, text) {
+      fileSystem.entityForUri(pathos.posix.toUri(path)).writeAsStringSync(text);
+    });
+    // TODO(paulberry): implement and test other option possibilities.
+    var options = new CompilerOptions()
+      ..fileSystem = fileSystem
+      ..chaseDependencies = true
+      ..packagesFileUri = packagesFilePath == ''
+          ? new Uri()
+          : pathos.posix.toUri(packagesFilePath);
+    var graph = await graphForProgram(
+        startingPoints.map(pathos.posix.toUri).toList(), options);
+    return graph.topologicallySortedCycles;
+  }
+
+  /// Sort the given library cycles into a deterministic order based on their
+  /// URIs for easier unit testing.
+  List<LibraryCycleNode> sortCycles(Iterable<LibraryCycleNode> cycles) {
+    var result = cycles.toList();
+    String sortKey(LibraryCycleNode node) => node.libraries.keys.join(',');
+    result.sort((a, b) => Comparable.compare(sortKey(a), sortKey(b)));
+    return result;
+  }
+
+  test_explicitCoreDependency() async {
+    // If "dart:core" is explicitly imported, there shouldn't be two imports of
+    // "dart:core", just one.
+    var cycles = await getCycles({'/foo.dart': 'import "dart:core";'});
+    expect(cycles, hasLength(1));
+    expect(cycles[0].libraries, hasLength(1));
+    checkLibrary(cycles[0], 'file:///foo.dart');
+  }
+
+  test_exportDependency() async {
+    var cycles =
+        await getCycles({'/foo.dart': 'export "bar.dart";', '/bar.dart': ''});
+    expect(cycles, hasLength(2));
+    expect(cycles[0].libraries, hasLength(1));
+    checkLibrary(cycles[0], 'file:///bar.dart');
+    expect(cycles[1].libraries, hasLength(1));
+    checkLibrary(cycles[1], 'file:///foo.dart',
+        dependencies: ['file:///bar.dart', 'dart:core']);
+  }
+
+  test_importDependency() async {
+    var cycles =
+        await getCycles({'/foo.dart': 'import "bar.dart";', '/bar.dart': ''});
+    expect(cycles, hasLength(2));
+    expect(cycles[0].libraries, hasLength(1));
+    checkLibrary(cycles[0], 'file:///bar.dart');
+    expect(cycles[1].libraries, hasLength(1));
+    checkLibrary(cycles[1], 'file:///foo.dart',
+        dependencies: ['file:///bar.dart', 'dart:core']);
+  }
+
+  test_multipleStartingPoints() async {
+    var cycles = await getCycles({
+      '/a.dart': 'import "c.dart";',
+      '/b.dart': 'import "c.dart";',
+      '/c.dart': ''
+    }, startingPoints: [
+      '/a.dart',
+      '/b.dart'
+    ]);
+    expect(cycles, hasLength(3));
+    expect(cycles[0].libraries, hasLength(1));
+    checkLibrary(cycles[0], 'file:///c.dart');
+    // The other two cycles might be in any order, so sort them for
+    // reproducibility.
+    List<LibraryCycleNode> otherCycles = sortCycles(cycles.sublist(1));
+    checkLibrary(otherCycles[0], 'file:///a.dart',
+        dependencies: ['file:///c.dart', 'dart:core']);
+    checkLibrary(otherCycles[1], 'file:///b.dart',
+        dependencies: ['file:///c.dart', 'dart:core']);
+  }
+
+  test_packages() async {
+    var cycles = await getCycles({
+      '/foo.dart': 'import "package:foo/bar.dart";',
+      '/.packages': 'foo:pkg/foo/lib\nbar:pkg/bar/lib\n',
+      '/pkg/foo/lib/bar.dart': 'import "package:bar/baz.dart";',
+      '/pkg/bar/lib/baz.dart': ''
+    }, packagesFilePath: '/.packages');
+    expect(cycles, hasLength(3));
+    expect(cycles[0].libraries, hasLength(1));
+    checkLibrary(cycles[0], 'package:bar/baz.dart');
+    expect(cycles[1].libraries, hasLength(1));
+    checkLibrary(cycles[1], 'package:foo/bar.dart',
+        dependencies: ['package:bar/baz.dart', 'dart:core']);
+    expect(cycles[2].libraries, hasLength(1));
+    checkLibrary(cycles[2], 'file:///foo.dart',
+        dependencies: ['package:foo/bar.dart', 'dart:core']);
+  }
+
+  test_parts() async {
+    var cycles = await getCycles({
+      '/foo.dart': 'library foo; part "a.dart"; part "b.dart";',
+      '/a.dart': 'part of foo;',
+      '/b.dart': 'part of foo;'
+    });
+    expect(cycles, hasLength(1));
+    expect(cycles[0].libraries, hasLength(1));
+    checkLibrary(cycles[0], 'file:///foo.dart',
+        parts: ['file:///a.dart', 'file:///b.dart']);
+  }
+
+  test_relativeUris() async {
+    var cycles = await getCycles({
+      '/a.dart': 'import "b/c.dart";',
+      '/b/c.dart': 'import "d/e.dart";',
+      '/b/d/e.dart': 'import "../f.dart";',
+      '/b/f.dart': ''
+    });
+    expect(cycles, hasLength(4));
+    expect(cycles[0].libraries, hasLength(1));
+    checkLibrary(cycles[0], 'file:///b/f.dart');
+    expect(cycles[1].libraries, hasLength(1));
+    checkLibrary(cycles[1], 'file:///b/d/e.dart',
+        dependencies: ['file:///b/f.dart', 'dart:core']);
+    expect(cycles[2].libraries, hasLength(1));
+    checkLibrary(cycles[2], 'file:///b/c.dart',
+        dependencies: ['file:///b/d/e.dart', 'dart:core']);
+    expect(cycles[3].libraries, hasLength(1));
+    checkLibrary(cycles[3], 'file:///a.dart',
+        dependencies: ['file:///b/c.dart', 'dart:core']);
+  }
+
+  test_sdkDependency() async {
+    // Dependencies on the SDK should be recorded even if SDK libraries aren't
+    // being included in the graph.
+    var cycles = await getCycles({'/foo.dart': 'import "dart:async";'});
+    expect(cycles, hasLength(1));
+    expect(cycles[0].libraries, hasLength(1));
+    checkLibrary(cycles[0], 'file:///foo.dart',
+        dependencies: ['dart:core', 'dart:async']);
+  }
+
+  test_simpleCycle() async {
+    var cycles = await getCycles(
+        {'/foo.dart': 'import "bar.dart";', '/bar.dart': 'import "foo.dart";'});
+    expect(cycles, hasLength(1));
+    expect(cycles[0].libraries, hasLength(2));
+    var foo = checkLibrary(cycles[0], 'file:///foo.dart',
+        dependencies: ['file:///bar.dart', 'dart:core']);
+    var bar = checkLibrary(cycles[0], 'file:///bar.dart',
+        dependencies: ['file:///foo.dart', 'dart:core']);
+    expect(foo.dependencies[0], same(bar));
+    expect(bar.dependencies[0], same(foo));
+  }
+
+  test_singleFile() async {
+    var cycles = await getCycles({'/foo.dart': ''});
+    expect(cycles, hasLength(1));
+    expect(cycles[0].libraries, hasLength(1));
+    checkLibrary(cycles[0], 'file:///foo.dart');
+  }
+}
diff --git a/pkg/front_end/test/incremental_kernel_generator_test.dart b/pkg/front_end/test/incremental_kernel_generator_test.dart
new file mode 100644
index 0000000..ea23134
--- /dev/null
+++ b/pkg/front_end/test/incremental_kernel_generator_test.dart
@@ -0,0 +1,159 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/src/dart/sdk/sdk.dart';
+import 'package:front_end/compiler_options.dart';
+import 'package:front_end/incremental_kernel_generator.dart';
+import 'package:front_end/memory_file_system.dart';
+import 'package:kernel/ast.dart';
+import 'package:path/path.dart' as pathos;
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(IncrementalKernelGeneratorTest);
+  });
+}
+
+final _sdkSummary = _readSdkSummary();
+
+List<int> _readSdkSummary() {
+  var resourceProvider = PhysicalResourceProvider.INSTANCE;
+  var sdk = new FolderBasedDartSdk(resourceProvider,
+      FolderBasedDartSdk.defaultSdkDirectory(resourceProvider))
+    ..useSummary = true;
+  var path = resourceProvider.pathContext
+      .join(sdk.directory.path, 'lib', '_internal', 'strong.sum');
+  return resourceProvider.getFile(path).readAsBytesSync();
+}
+
+@reflectiveTest
+class IncrementalKernelGeneratorTest {
+  static final sdkSummaryUri = Uri.parse('special:sdk_summary');
+
+  /// Virtual filesystem for testing.
+  final fileSystem = new MemoryFileSystem(pathos.posix, Uri.parse('file:///'));
+
+  /// The object under test.
+  IncrementalKernelGenerator incrementalKernelGenerator;
+
+  Future<Map<Uri, Program>> getInitialState(Uri startingUri) async {
+    fileSystem.entityForUri(sdkSummaryUri).writeAsBytesSync(_sdkSummary);
+    incrementalKernelGenerator = new IncrementalKernelGenerator(
+        startingUri,
+        new CompilerOptions()
+          ..fileSystem = fileSystem
+          ..chaseDependencies = true
+          ..sdkSummary = sdkSummaryUri
+          ..packagesFileUri = new Uri());
+    return (await incrementalKernelGenerator.computeDelta()).newState;
+  }
+
+  test_incrementalUpdate_referenceToCore() async {
+    writeFiles({'/foo.dart': 'main() { print(1); }'});
+    var fooUri = Uri.parse('file:///foo.dart');
+    var coreUri = Uri.parse('dart:core');
+    var initialState = await getInitialState(fooUri);
+    expect(initialState.keys, unorderedEquals([fooUri]));
+
+    void _checkMain(Program program, int expectedArgument) {
+      expect(_getLibraryUris(program), unorderedEquals([fooUri, coreUri]));
+      var mainStatements = _getProcedureStatements(
+          _getProcedure(_getLibrary(program, fooUri), 'main'));
+      expect(mainStatements, hasLength(1));
+      _checkPrintLiteralInt(mainStatements[0], expectedArgument);
+      var coreLibrary = _getLibrary(program, coreUri);
+      expect(coreLibrary.procedures, hasLength(1));
+      expect(coreLibrary.procedures[0].name.name, 'print');
+      expect(coreLibrary.procedures[0].function.body, isNull);
+    }
+
+    _checkMain(initialState[fooUri], 1);
+    writeFiles({'/foo.dart': 'main() { print(2); }'});
+    incrementalKernelGenerator.invalidateAll();
+    var deltaProgram = await incrementalKernelGenerator.computeDelta();
+    expect(deltaProgram.newState.keys, unorderedEquals([fooUri]));
+    _checkMain(deltaProgram.newState[fooUri], 2);
+  }
+
+  test_part() async {
+    writeFiles({
+      '/foo.dart': 'library foo; part "bar.dart"; main() { print(1); f(); }',
+      '/bar.dart': 'part of foo; f() { print(2); }'
+    });
+    var fooUri = Uri.parse('file:///foo.dart');
+    var initialState = await getInitialState(fooUri);
+    expect(initialState.keys, unorderedEquals([fooUri]));
+    var library = _getLibrary(initialState[fooUri], fooUri);
+    var mainStatements =
+        _getProcedureStatements(_getProcedure(library, 'main'));
+    var fProcedure = _getProcedure(library, 'f');
+    var fStatements = _getProcedureStatements(fProcedure);
+    expect(mainStatements, hasLength(2));
+    _checkPrintLiteralInt(mainStatements[0], 1);
+    _checkFunctionCall(mainStatements[1], fProcedure);
+    expect(fStatements, hasLength(1));
+    _checkPrintLiteralInt(fStatements[0], 2);
+    // TODO(paulberry): now test incremental updates
+  }
+
+  /// Write the given file contents to the virtual filesystem.
+  void writeFiles(Map<String, String> contents) {
+    contents.forEach((path, text) {
+      fileSystem
+          .entityForUri(Uri.parse('file://$path'))
+          .writeAsStringSync(text);
+    });
+  }
+
+  void _checkFunctionCall(Statement statement, Procedure expectedTarget) {
+    expect(statement, new isInstanceOf<ExpressionStatement>());
+    var expressionStatement = statement as ExpressionStatement;
+    expect(
+        expressionStatement.expression, new isInstanceOf<StaticInvocation>());
+    var staticInvocation = expressionStatement.expression as StaticInvocation;
+    expect(staticInvocation.target, same(expectedTarget));
+  }
+
+  void _checkPrintLiteralInt(Statement statement, int expectedArgument) {
+    expect(statement, new isInstanceOf<ExpressionStatement>());
+    var expressionStatement = statement as ExpressionStatement;
+    expect(
+        expressionStatement.expression, new isInstanceOf<StaticInvocation>());
+    var staticInvocation = expressionStatement.expression as StaticInvocation;
+    expect(staticInvocation.target.name.name, 'print');
+    expect(staticInvocation.arguments.positional, hasLength(1));
+    expect(staticInvocation.arguments.positional[0],
+        new isInstanceOf<IntLiteral>());
+    var intLiteral = staticInvocation.arguments.positional[0] as IntLiteral;
+    expect(intLiteral.value, expectedArgument);
+  }
+
+  Library _getLibrary(Program program, Uri uri) {
+    for (var library in program.libraries) {
+      if (library.importUri == uri) return library;
+    }
+    throw fail('No library found with URI "$uri"');
+  }
+
+  List<Uri> _getLibraryUris(Program program) =>
+      program.libraries.map((library) => library.importUri).toList();
+
+  Procedure _getProcedure(Library library, String name) {
+    for (var procedure in library.procedures) {
+      if (procedure.name.name == name) return procedure;
+    }
+    throw fail('No function declaration found with name "$name"');
+  }
+
+  List<Statement> _getProcedureStatements(Procedure procedure) {
+    var body = procedure.function.body;
+    expect(body, new isInstanceOf<Block>());
+    return (body as Block).statements;
+  }
+}
diff --git a/pkg/front_end/test/incremental_resolved_ast_generator_test.dart b/pkg/front_end/test/incremental_resolved_ast_generator_test.dart
new file mode 100644
index 0000000..553c9f3
--- /dev/null
+++ b/pkg/front_end/test/incremental_resolved_ast_generator_test.dart
@@ -0,0 +1,173 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/src/dart/sdk/sdk.dart';
+import 'package:front_end/compiler_options.dart';
+import 'package:front_end/incremental_resolved_ast_generator.dart';
+import 'package:front_end/memory_file_system.dart';
+import 'package:path/path.dart' as pathos;
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(IncrementalResolvedAstGeneratorTest);
+  });
+}
+
+final _sdkSummary = _readSdkSummary();
+
+List<int> _readSdkSummary() {
+  var resourceProvider = PhysicalResourceProvider.INSTANCE;
+  var sdk = new FolderBasedDartSdk(resourceProvider,
+      FolderBasedDartSdk.defaultSdkDirectory(resourceProvider))
+    ..useSummary = true;
+  var path = resourceProvider.pathContext
+      .join(sdk.directory.path, 'lib', '_internal', 'strong.sum');
+  return resourceProvider.getFile(path).readAsBytesSync();
+}
+
+@reflectiveTest
+class IncrementalResolvedAstGeneratorTest {
+  static final sdkSummaryUri = Uri.parse('special:sdk_summary');
+
+  /// Virtual filesystem for testing.
+  final fileSystem = new MemoryFileSystem(pathos.posix, Uri.parse('file:///'));
+
+  /// The object under test.
+  IncrementalResolvedAstGenerator incrementalResolvedAstGenerator;
+
+  Future<Map<Uri, ResolvedLibrary>> getInitialProgram(Uri startingUri) async {
+    fileSystem.entityForUri(sdkSummaryUri).writeAsBytesSync(_sdkSummary);
+    incrementalResolvedAstGenerator = new IncrementalResolvedAstGenerator(
+        startingUri,
+        new CompilerOptions()
+          ..fileSystem = fileSystem
+          ..chaseDependencies = true
+          ..sdkSummary = sdkSummaryUri
+          ..packagesFileUri = new Uri());
+    return (await incrementalResolvedAstGenerator.computeDelta()).newState;
+  }
+
+  test_incrementalUpdate_referenceToCore() async {
+    writeFiles({'/foo.dart': 'main() { print(1); }'});
+    var fooUri = Uri.parse('file:///foo.dart');
+    var initialProgram = await getInitialProgram(fooUri);
+    expect(initialProgram.keys, unorderedEquals([fooUri]));
+
+    void _checkMain(CompilationUnit unit, int expectedArgument) {
+      var mainStatements = _getFunctionStatements(_getFunction(unit, 'main'));
+      expect(mainStatements, hasLength(1));
+      _checkPrintLiteralInt(mainStatements[0], expectedArgument);
+    }
+
+    _checkMain(initialProgram[fooUri].definingCompilationUnit, 1);
+    writeFiles({'/foo.dart': 'main() { print(2); }'});
+    // Verify that the file isn't actually reread until invalidate is called.
+    var deltaProgram1 = await incrementalResolvedAstGenerator.computeDelta();
+    // TODO(paulberry): since there is no delta, computeDelta should return an
+    // empty map.
+    // expect(deltaProgram1.newState, isEmpty);
+    expect(deltaProgram1.newState.keys, unorderedEquals([fooUri]));
+    _checkMain(deltaProgram1.newState[fooUri].definingCompilationUnit, 1);
+    incrementalResolvedAstGenerator.invalidateAll();
+    var deltaProgram2 = await incrementalResolvedAstGenerator.computeDelta();
+    expect(deltaProgram2.newState.keys, unorderedEquals([fooUri]));
+    _checkMain(deltaProgram2.newState[fooUri].definingCompilationUnit, 2);
+  }
+
+  test_invalidateAllBeforeInitialProgram() async {
+    incrementalResolvedAstGenerator = new IncrementalResolvedAstGenerator(
+        Uri.parse('file:///foo.dart'),
+        new CompilerOptions()
+          ..fileSystem = fileSystem
+          ..chaseDependencies = true
+          ..packagesFileUri = new Uri());
+    incrementalResolvedAstGenerator.invalidateAll();
+  }
+
+  test_part() async {
+    writeFiles({
+      '/foo.dart': 'library foo; part "bar.dart"; main() { print(1); f(); }',
+      '/bar.dart': 'part of foo; f() { print(2); }'
+    });
+    var fooUri = Uri.parse('file:///foo.dart');
+    var barUri = Uri.parse('file:///bar.dart');
+    var initialProgram = await getInitialProgram(fooUri);
+    expect(initialProgram.keys, unorderedEquals([fooUri]));
+    expect(initialProgram[fooUri].partUnits.keys, unorderedEquals([barUri]));
+    var mainStatements = _getFunctionStatements(
+        _getFunction(initialProgram[fooUri].definingCompilationUnit, 'main'));
+    var fDeclaration =
+        _getFunction(initialProgram[fooUri].partUnits[barUri], 'f');
+    var fStatements = _getFunctionStatements(fDeclaration);
+    expect(mainStatements, hasLength(2));
+    _checkPrintLiteralInt(mainStatements[0], 1);
+    _checkFunctionCall(mainStatements[1],
+        resolutionMap.elementDeclaredByFunctionDeclaration(fDeclaration));
+    expect(fStatements, hasLength(1));
+    _checkPrintLiteralInt(fStatements[0], 2);
+    // TODO(paulberry): now test incremental updates
+  }
+
+  /// Write the given file contents to the virtual filesystem.
+  void writeFiles(Map<String, String> contents) {
+    contents.forEach((path, text) {
+      fileSystem
+          .entityForUri(Uri.parse('file://$path'))
+          .writeAsStringSync(text);
+    });
+  }
+
+  void _checkFunctionCall(Statement statement, Element expectedTarget) {
+    expect(statement, new isInstanceOf<ExpressionStatement>());
+    var expressionStatement = statement as ExpressionStatement;
+    expect(
+        expressionStatement.expression, new isInstanceOf<MethodInvocation>());
+    var methodInvocation = expressionStatement.expression as MethodInvocation;
+    expect(
+        resolutionMap.staticElementForIdentifier(methodInvocation.methodName),
+        expectedTarget);
+  }
+
+  void _checkPrintLiteralInt(Statement statement, int expectedArgument) {
+    expect(statement, new isInstanceOf<ExpressionStatement>());
+    var expressionStatement = statement as ExpressionStatement;
+    expect(
+        expressionStatement.expression, new isInstanceOf<MethodInvocation>());
+    var methodInvocation = expressionStatement.expression as MethodInvocation;
+    expect(methodInvocation.methodName.name, 'print');
+    var printElement =
+        resolutionMap.staticElementForIdentifier(methodInvocation.methodName);
+    expect(printElement, isNotNull);
+    expect(printElement.library.source.uri, Uri.parse('dart:core'));
+    expect(methodInvocation.argumentList.arguments, hasLength(1));
+    expect(methodInvocation.argumentList.arguments[0],
+        new isInstanceOf<IntegerLiteral>());
+    var integerLiteral =
+        methodInvocation.argumentList.arguments[0] as IntegerLiteral;
+    expect(integerLiteral.value, expectedArgument);
+  }
+
+  FunctionDeclaration _getFunction(CompilationUnit unit, String name) {
+    for (var declaration in unit.declarations) {
+      if (declaration is FunctionDeclaration && declaration.name.name == name) {
+        return declaration;
+      }
+    }
+    throw fail('No function declaration found with name "$name"');
+  }
+
+  NodeList<Statement> _getFunctionStatements(FunctionDeclaration function) {
+    var body = function.functionExpression.body;
+    expect(body, new isInstanceOf<BlockFunctionBody>());
+    return (body as BlockFunctionBody).block.statements;
+  }
+}
diff --git a/pkg/front_end/test/memory_file_system_test.dart b/pkg/front_end/test/memory_file_system_test.dart
index b9757f3..365cd43 100644
--- a/pkg/front_end/test/memory_file_system_test.dart
+++ b/pkg/front_end/test/memory_file_system_test.dart
@@ -30,26 +30,23 @@
   setUp() {
     super.setUp();
     path = join(tempPath, 'file.txt');
-    file = fileSystem.entityForPath(path);
+    file = entityForPath(path);
   }
 
   test_equals_differentPaths() {
-    expect(
-        file == fileSystem.entityForPath(join(tempPath, 'file2.txt')), isFalse);
+    expect(file == entityForPath(join(tempPath, 'file2.txt')), isFalse);
   }
 
   test_equals_samePath() {
-    expect(
-        file == fileSystem.entityForPath(join(tempPath, 'file.txt')), isTrue);
+    expect(file == entityForPath(join(tempPath, 'file.txt')), isTrue);
   }
 
   test_hashCode_samePath() {
-    expect(file.hashCode,
-        fileSystem.entityForPath(join(tempPath, 'file.txt')).hashCode);
+    expect(file.hashCode, entityForPath(join(tempPath, 'file.txt')).hashCode);
   }
 
   test_path() {
-    expect(file.path, path);
+    expect(file.uri, fileSystem.context.toUri(path));
   }
 
   test_readAsBytes_badUtf8() async {
@@ -128,40 +125,44 @@
     tempUri = fileSystem.context.toUri(tempPath);
   }
 
-  test_entityForPath() {
-    var path = join(tempPath, 'file.txt');
-    expect(fileSystem.entityForPath(path).path, path);
+  test_currentDirectory_trailingSlash() {
+    // The currentDirectory should already end in a trailing slash.
+    expect(fileSystem.currentDirectory.path, endsWith('/'));
+    // A trailing slash should automatically be appended when creating a
+    // MemoryFileSystem.
+    var path = fileSystem.currentDirectory.path;
+    var currentDirectoryWithoutSlash = fileSystem.currentDirectory
+        .replace(path: path.substring(0, path.length - 1));
+    expect(
+        new MemoryFileSystem(fileSystem.context, currentDirectoryWithoutSlash)
+            .currentDirectory,
+        fileSystem.currentDirectory);
+    // If the currentDirectory supplied to the MemoryFileSystem constructor
+    // already has a trailing slash, no further trailing slash should be added.
+    expect(
+        new MemoryFileSystem(fileSystem.context, fileSystem.currentDirectory)
+            .currentDirectory,
+        fileSystem.currentDirectory);
   }
 
   test_entityForPath_absolutize() {
-    expect(fileSystem.entityForPath('file.txt').path,
-        join(fileSystem.currentDirectory, 'file.txt'));
+    expect(entityForPath('file.txt').uri,
+        fileSystem.currentDirectory.resolve('file.txt'));
   }
 
   test_entityForPath_normalize_dot() {
-    expect(fileSystem.entityForPath(join(tempPath, '.', 'file.txt')).path,
-        join(tempPath, 'file.txt'));
+    expect(entityForPath(join(tempPath, '.', 'file.txt')).uri,
+        Uri.parse('$tempUri/file.txt'));
   }
 
   test_entityForPath_normalize_dotDot() {
-    expect(
-        fileSystem.entityForPath(join(tempPath, 'foo', '..', 'file.txt')).path,
-        join(tempPath, 'file.txt'));
+    expect(entityForPath(join(tempPath, 'foo', '..', 'file.txt')).uri,
+        Uri.parse('$tempUri/file.txt'));
   }
 
   test_entityForUri() {
-    expect(fileSystem.entityForUri(Uri.parse('$tempUri/file.txt')).path,
-        join(tempPath, 'file.txt'));
-  }
-
-  test_entityForUri_bareUri_absolute() {
-    expect(() => fileSystem.entityForUri(Uri.parse('/file.txt')),
-        throwsA(new isInstanceOf<Error>()));
-  }
-
-  test_entityForUri_bareUri_relative() {
-    expect(() => fileSystem.entityForUri(Uri.parse('file.txt')),
-        throwsA(new isInstanceOf<Error>()));
+    expect(fileSystem.entityForUri(Uri.parse('$tempUri/file.txt')).uri,
+        Uri.parse('$tempUri/file.txt'));
   }
 
   test_entityForUri_fileUri_relative() {
@@ -184,18 +185,18 @@
   }
 
   test_entityForUri_nonFileUri() {
-    expect(() => fileSystem.entityForUri(Uri.parse('package:foo/bar.dart')),
-        throwsA(new isInstanceOf<Error>()));
+    var uri = Uri.parse('package:foo/bar.dart');
+    expect(fileSystem.entityForUri(uri).uri, uri);
   }
 
   test_entityForUri_normalize_dot() {
-    expect(fileSystem.entityForUri(Uri.parse('$tempUri/./file.txt')).path,
-        join(tempPath, 'file.txt'));
+    expect(fileSystem.entityForUri(Uri.parse('$tempUri/./file.txt')).uri,
+        Uri.parse('$tempUri/file.txt'));
   }
 
   test_entityForUri_normalize_dotDot() {
-    expect(fileSystem.entityForUri(Uri.parse('$tempUri/foo/../file.txt')).path,
-        join(tempPath, 'file.txt'));
+    expect(fileSystem.entityForUri(Uri.parse('$tempUri/foo/../file.txt')).uri,
+        Uri.parse('$tempUri/file.txt'));
   }
 }
 
@@ -213,8 +214,14 @@
 
 abstract class _BaseTest {
   MemoryFileSystem get fileSystem;
+
   String get tempPath;
+
+  MemoryFileSystemEntity entityForPath(String path) =>
+      fileSystem.entityForUri(fileSystem.context.toUri(path));
+
   String join(String path1, String path2, [String path3, String path4]);
+
   void setUp();
 }
 
@@ -227,8 +234,8 @@
 
   setUp() {
     tempPath = pathos.join(io.Directory.systemTemp.path, 'test_file_system');
-    fileSystem =
-        new MemoryFileSystem(pathos.context, io.Directory.current.path);
+    fileSystem = new MemoryFileSystem(
+        pathos.context, pathos.toUri(io.Directory.current.path));
   }
 }
 
@@ -241,7 +248,7 @@
 
   void setUp() {
     tempPath = '/test_file_system';
-    fileSystem = new MemoryFileSystem(pathos.posix, '/cwd');
+    fileSystem = new MemoryFileSystem(pathos.posix, Uri.parse('file:///cwd'));
   }
 }
 
@@ -254,6 +261,7 @@
 
   void setUp() {
     tempPath = r'c:\test_file_system';
-    fileSystem = new MemoryFileSystem(pathos.windows, r'c:\cwd');
+    fileSystem =
+        new MemoryFileSystem(pathos.windows, Uri.parse('file:///c:/cwd'));
   }
 }
diff --git a/pkg/front_end/test/physical_file_system_test.dart b/pkg/front_end/test/physical_file_system_test.dart
index 859e998..d1a026b 100644
--- a/pkg/front_end/test/physical_file_system_test.dart
+++ b/pkg/front_end/test/physical_file_system_test.dart
@@ -30,35 +30,19 @@
   setUp() {
     super.setUp();
     path = p.join(tempPath, 'file.txt');
-    file = PhysicalFileSystem.instance.entityForPath(path);
+    file = PhysicalFileSystem.instance.entityForUri(p.toUri(path));
   }
 
   test_equals_differentPaths() {
-    expect(
-        file ==
-            PhysicalFileSystem.instance
-                .entityForPath(p.join(tempPath, 'file2.txt')),
-        isFalse);
+    expect(file == entityForPath(p.join(tempPath, 'file2.txt')), isFalse);
   }
 
   test_equals_samePath() {
-    expect(
-        file ==
-            PhysicalFileSystem.instance
-                .entityForPath(p.join(tempPath, 'file.txt')),
-        isTrue);
+    expect(file == entityForPath(p.join(tempPath, 'file.txt')), isTrue);
   }
 
   test_hashCode_samePath() {
-    expect(
-        file.hashCode,
-        PhysicalFileSystem.instance
-            .entityForPath(p.join(tempPath, 'file.txt'))
-            .hashCode);
-  }
-
-  test_path() {
-    expect(file.path, path);
+    expect(file.hashCode, entityForPath(p.join(tempPath, 'file.txt')).hashCode);
   }
 
   test_readAsBytes_badUtf8() async {
@@ -98,6 +82,10 @@
     new io.File(path).writeAsBytesSync(bytes);
     expect(await file.readAsString(), '\u20ac');
   }
+
+  test_uri() {
+    expect(file.uri, p.toUri(path));
+  }
 }
 
 @reflectiveTest
@@ -111,48 +99,35 @@
 
   test_entityForPath() {
     var path = p.join(tempPath, 'file.txt');
-    expect(PhysicalFileSystem.instance.entityForPath(path).path, path);
+    expect(entityForPath(path).uri, p.toUri(path));
   }
 
   test_entityForPath_absolutize() {
-    expect(PhysicalFileSystem.instance.entityForPath('file.txt').path,
-        new io.File('file.txt').absolute.path);
+    expect(entityForPath('file.txt').uri,
+        p.toUri(new io.File('file.txt').absolute.path));
   }
 
   test_entityForPath_normalize_dot() {
-    expect(
-        PhysicalFileSystem.instance
-            .entityForPath(p.join(tempPath, '.', 'file.txt'))
-            .path,
-        p.join(tempPath, 'file.txt'));
+    expect(entityForPath(p.join(tempPath, '.', 'file.txt')).uri,
+        p.toUri(p.join(tempPath, 'file.txt')));
   }
 
   test_entityForPath_normalize_dotDot() {
-    expect(
-        PhysicalFileSystem.instance
-            .entityForPath(p.join(tempPath, 'foo', '..', 'file.txt'))
-            .path,
-        p.join(tempPath, 'file.txt'));
+    expect(entityForPath(p.join(tempPath, 'foo', '..', 'file.txt')).uri,
+        p.toUri(p.join(tempPath, 'file.txt')));
   }
 
   test_entityForUri() {
     expect(
         PhysicalFileSystem.instance
-            .entityForUri(Uri.parse('$tempUri/file.txt'))
-            .path,
-        p.join(tempPath, 'file.txt'));
+            .entityForUri(Uri.parse('${tempUri}file.txt'))
+            .uri,
+        p.toUri(p.join(tempPath, 'file.txt')));
   }
 
   test_entityForUri_bareUri_absolute() {
-    expect(
-        () => PhysicalFileSystem.instance.entityForUri(Uri.parse('/file.txt')),
-        throwsA(new isInstanceOf<Error>()));
-  }
-
-  test_entityForUri_bareUri_relative() {
-    expect(
-        () => PhysicalFileSystem.instance.entityForUri(Uri.parse('file.txt')),
-        throwsA(new isInstanceOf<Error>()));
+    expect(PhysicalFileSystem.instance.entityForUri(Uri.parse('/file.txt')).uri,
+        Uri.parse('file:///file.txt'));
   }
 
   test_entityForUri_fileUri_relative() {
@@ -184,17 +159,17 @@
   test_entityForUri_normalize_dot() {
     expect(
         PhysicalFileSystem.instance
-            .entityForUri(Uri.parse('$tempUri/./file.txt'))
-            .path,
-        p.join(tempPath, 'file.txt'));
+            .entityForUri(Uri.parse('${tempUri}./file.txt'))
+            .uri,
+        p.toUri(p.join(tempPath, 'file.txt')));
   }
 
   test_entityForUri_normalize_dotDot() {
     expect(
         PhysicalFileSystem.instance
-            .entityForUri(Uri.parse('$tempUri/foo/../file.txt'))
-            .path,
-        p.join(tempPath, 'file.txt'));
+            .entityForUri(Uri.parse('${tempUri}foo/../file.txt'))
+            .uri,
+        p.toUri(p.join(tempPath, 'file.txt')));
   }
 }
 
@@ -202,6 +177,9 @@
   io.Directory tempDirectory;
   String tempPath;
 
+  FileSystemEntity entityForPath(String path) =>
+      PhysicalFileSystem.instance.entityForUri(p.toUri(path));
+
   setUp() {
     tempDirectory = io.Directory.systemTemp.createTempSync('test_file_system');
     tempPath = tempDirectory.absolute.path;
diff --git a/pkg/front_end/test/src/async_dependency_walker_test.dart b/pkg/front_end/test/src/async_dependency_walker_test.dart
new file mode 100644
index 0000000..8cf0b28
--- /dev/null
+++ b/pkg/front_end/test/src/async_dependency_walker_test.dart
@@ -0,0 +1,220 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:front_end/src/async_dependency_walker.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(AsyncDependencyWalkerTest);
+  });
+}
+
+@reflectiveTest
+class AsyncDependencyWalkerTest {
+  final nodes = <String, TestNode>{};
+
+  Future<Null> checkGraph(
+      Map<String, List<String>> graph,
+      String startingNodeName,
+      List<List<String>> expectedEvaluations,
+      List<bool> expectedSccFlags) async {
+    makeGraph(graph);
+    var walker = await walk(startingNodeName);
+    expect(walker._evaluations, expectedEvaluations.map((x) => x.toSet()));
+    expect(walker._sccFlags, expectedSccFlags);
+  }
+
+  TestNode getNode(String name) =>
+      nodes.putIfAbsent(name, () => new TestNode(name));
+
+  void makeGraph(Map<String, List<String>> graph) {
+    graph.forEach((name, deps) {
+      var node = getNode(name);
+      for (var dep in deps) {
+        node._dependencies.add(getNode(dep));
+      }
+    });
+  }
+
+  test_complex_graph() async {
+    await checkGraph(
+        {
+          'a': ['b', 'c'],
+          'b': ['c', 'd'],
+          'c': [],
+          'd': ['c', 'e'],
+          'e': ['b', 'f'],
+          'f': ['c', 'd']
+        },
+        'a',
+        [
+          ['c'],
+          ['b', 'd', 'e', 'f'],
+          ['a']
+        ],
+        [false, true, false]);
+  }
+
+  test_diamond() async {
+    await checkGraph(
+        {
+          'a': ['b', 'c'],
+          'b': ['d'],
+          'c': ['d'],
+          'd': []
+        },
+        'a',
+        [
+          ['d'],
+          ['b'],
+          ['c'],
+          ['a']
+        ],
+        [false, false, false, false]);
+  }
+
+  test_singleNode() async {
+    await checkGraph(
+        {'a': []},
+        'a',
+        [
+          ['a']
+        ],
+        [false]);
+  }
+
+  test_singleNodeWithTrivialCycle() async {
+    await checkGraph(
+        {
+          'a': ['a']
+        },
+        'a',
+        [
+          ['a']
+        ],
+        [true]);
+  }
+
+  test_threeNodesWithCircularDependency() async {
+    await checkGraph(
+        {
+          'a': ['b'],
+          'b': ['c'],
+          'c': ['a'],
+        },
+        'a',
+        [
+          ['a', 'b', 'c']
+        ],
+        [true]);
+  }
+
+  test_twoBacklinksEarlierFirst() async {
+    // Test a graph A->B->C->D, where D points back to B and then C.
+    await checkGraph(
+        {
+          'a': ['b'],
+          'b': ['c'],
+          'c': ['d'],
+          'd': ['b', 'c']
+        },
+        'a',
+        [
+          ['b', 'c', 'd'],
+          ['a']
+        ],
+        [true, false]);
+  }
+
+  test_twoBacklinksLaterFirst() async {
+    // Test a graph A->B->C->D, where D points back to C and then B.
+    await checkGraph(
+        {
+          'a': ['b'],
+          'b': ['c'],
+          'c': ['d'],
+          'd': ['c', 'b']
+        },
+        'a',
+        [
+          ['b', 'c', 'd'],
+          ['a']
+        ],
+        [true, false]);
+  }
+
+  test_twoNodesWithCircularDependency() async {
+    await checkGraph(
+        {
+          'a': ['b'],
+          'b': ['a']
+        },
+        'a',
+        [
+          ['a', 'b']
+        ],
+        [true]);
+  }
+
+  test_twoNodesWithSimpleDependency() async {
+    await checkGraph(
+        {
+          'a': ['b'],
+          'b': []
+        },
+        'a',
+        [
+          ['b'],
+          ['a']
+        ],
+        [false, false]);
+  }
+
+  Future<TestWalker> walk(String startingNodeName) async {
+    var testWalker = new TestWalker();
+    await testWalker.walk(getNode(startingNodeName));
+    return testWalker;
+  }
+}
+
+class TestNode extends Node<TestNode> {
+  final String _name;
+
+  bool _computeDependenciesCalled = false;
+
+  final _dependencies = <TestNode>[];
+
+  TestNode(this._name);
+
+  @override
+  Future<List<TestNode>> computeDependencies() async {
+    expect(_computeDependenciesCalled, false);
+    _computeDependenciesCalled = true;
+    return _dependencies;
+  }
+}
+
+class TestWalker extends AsyncDependencyWalker<TestNode> {
+  final _evaluations = <Set<String>>[];
+  final _sccFlags = <bool>[];
+
+  @override
+  Future<Null> evaluate(TestNode v) async {
+    _evaluations.add([v._name].toSet());
+    _sccFlags.add(false);
+  }
+
+  @override
+  Future<Null> evaluateScc(List<TestNode> scc) async {
+    var sccNames = scc.map((node) => node._name).toSet();
+    // Make sure there were no duplicates
+    expect(sccNames.length, scc.length);
+    _evaluations.add(sccNames);
+    _sccFlags.add(true);
+  }
+}
diff --git a/pkg/front_end/test/src/base/file_repository_test.dart b/pkg/front_end/test/src/base/file_repository_test.dart
new file mode 100644
index 0000000..f6917aa
--- /dev/null
+++ b/pkg/front_end/test/src/base/file_repository_test.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/base/file_repository.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(FileRepositoryTest);
+  });
+}
+
+/// Generic URI resolver tests which do not depend on the particular path
+/// context in use.
+@reflectiveTest
+class FileRepositoryTest {
+  final fileRepository = new FileRepository();
+
+  test_clearContents() {
+    var uri = Uri.parse('file:///foo/bar.dart');
+    fileRepository.store(uri, 'contents1');
+    expect(fileRepository.getContentsForTesting(), isNotEmpty);
+    fileRepository.clearContents();
+    expect(fileRepository.getContentsForTesting(), isEmpty);
+  }
+
+  test_contentsForPath() {
+    var path1 =
+        fileRepository.store(Uri.parse('file:///foo/bar.dart'), 'contents1');
+    var path2 =
+        fileRepository.store(Uri.parse('package:foo/bar.dart'), 'contents2');
+    expect(fileRepository.contentsForPath(path1), 'contents1');
+    expect(fileRepository.contentsForPath(path2), 'contents2');
+  }
+
+  test_pathForUri() {
+    var uri1 = Uri.parse('file:///foo/bar.dart');
+    var path1 = fileRepository.store(uri1, 'contents1');
+    var uri2 = Uri.parse('package:foo/bar.dart');
+    var path2 = fileRepository.store(uri2, 'contents2');
+    expect(fileRepository.pathForUri(uri1), path1);
+    expect(fileRepository.pathForUri(uri2), path2);
+  }
+
+  test_pathForUri_allocate() {
+    var uri1 = Uri.parse('file:///foo/bar.dart');
+    var path1 = fileRepository.pathForUri(uri1, allocate: true);
+    var uri2 = Uri.parse('package:foo/bar.dart');
+    var path2 = fileRepository.pathForUri(uri2, allocate: true);
+    expect(fileRepository.store(uri1, 'contents1'), path1);
+    expect(fileRepository.store(uri2, 'contents2'), path2);
+  }
+
+  test_store() {
+    var uri = Uri.parse('file:///foo/bar.dart');
+    var path = fileRepository.store(uri, 'contents1');
+    expect(path, endsWith('.dart'));
+    expect(fileRepository.contentsForPath(path), 'contents1');
+    expect(fileRepository.getContentsForTesting(), {path: 'contents1'});
+    expect(fileRepository.store(uri, 'contents2'), path);
+    expect(fileRepository.contentsForPath(path), 'contents2');
+    expect(fileRepository.getContentsForTesting(), {path: 'contents2'});
+  }
+
+  test_uriForPath() {
+    var uri1 = Uri.parse('file:///foo/bar.dart');
+    var path1 = fileRepository.store(uri1, 'contents1');
+    var uri2 = Uri.parse('package:foo/bar.dart');
+    var path2 = fileRepository.store(uri2, 'contents2');
+    expect(fileRepository.uriForPath(path1), uri1);
+    expect(fileRepository.uriForPath(path2), uri2);
+  }
+}
diff --git a/pkg/front_end/test/src/base/libraries_reader_test.dart b/pkg/front_end/test/src/base/libraries_reader_test.dart
new file mode 100644
index 0000000..520e1ff
--- /dev/null
+++ b/pkg/front_end/test/src/base/libraries_reader_test.dart
@@ -0,0 +1,239 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/error/listener.dart';
+import 'package:analyzer/src/generated/parser.dart';
+import 'package:analyzer/src/summary/summarize_ast.dart';
+import 'package:front_end/src/base/library_info.dart';
+import 'package:front_end/src/libraries_reader.dart';
+import 'package:front_end/src/scanner/errors.dart';
+import 'package:front_end/src/scanner/reader.dart';
+import 'package:front_end/src/scanner/scanner.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(LibrariesReaderTest);
+  });
+}
+
+/// Generic URI resolver tests which do not depend on the particular path
+/// context in use.
+@reflectiveTest
+class LibrariesReaderTest {
+  test_categoriesClient() {
+    var info =
+        _computeSingleInfo('const LibraryInfo("", categories: "Client")');
+    expect(info.categories, [Category.client]);
+    expect(info.categoriesString, 'Client');
+  }
+
+  test_categoriesDefault() {
+    var info = _computeSingleInfo('const LibraryInfo("")');
+    expect(info.categories, isEmpty);
+    expect(info.categoriesString, '');
+  }
+
+  test_categoriesMultiple() {
+    var info = _computeSingleInfo(
+        'const LibraryInfo("", categories: "Client,Server")');
+    expect(
+        info.categories, unorderedEquals([Category.client, Category.server]));
+    expect(info.categoriesString, 'Client,Server');
+  }
+
+  test_categoriesNone() {
+    var info = _computeSingleInfo('const LibraryInfo("", categories: "")');
+    expect(info.categories, isEmpty);
+    expect(info.categoriesString, '');
+  }
+
+  test_categoriesSingle() {
+    var info =
+        _computeSingleInfo('const LibraryInfo("", categories: "Client")');
+    expect(info.categories, [Category.client]);
+    expect(info.categoriesString, 'Client');
+  }
+
+  test_complex() {
+    var info = _computeSingleInfo(
+        '''
+const LibraryInfo(
+    "async/async.dart",
+    categories: "Client,Server",
+    maturity: Maturity.STABLE,
+    dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart"))
+''',
+        additionalDeclarations: '''
+class Maturity {
+  final int level;
+  final String name;
+  final String description;
+
+  const Maturity(this.level, this.name, this.description);
+
+  static const Maturity STABLE = const Maturity(4, "Stable", "Stable description");
+}
+''');
+    expect(info.path, 'async/async.dart');
+    expect(
+        info.categories, unorderedEquals([Category.client, Category.server]));
+    expect(info.maturity.name, 'Stable');
+    expect(info.dart2jsPatchPath, '_internal/js_runtime/lib/async_patch.dart');
+  }
+
+  test_dart2jsPatchPathDefault() {
+    var info = _computeSingleInfo('const LibraryInfo("")');
+    expect(info.dart2jsPatchPath, null);
+  }
+
+  test_dart2jsPatchPathString() {
+    var info = _computeSingleInfo('''
+const LibraryInfo(
+    "",
+    dart2jsPatchPath: "_internal/js_runtime/lib/async_patch.dart")
+''');
+    expect(info.dart2jsPatchPath, '_internal/js_runtime/lib/async_patch.dart');
+  }
+
+  test_dart2jsPathDefault() {
+    var info = _computeSingleInfo('const LibraryInfo("")');
+    expect(info.dart2jsPath, null);
+  }
+
+  test_dart2jsPathString() {
+    var info = _computeSingleInfo(
+        'const LibraryInfo("", dart2jsPath: "html/dart2js/html_dart2js.dart"');
+    expect(info.dart2jsPath, 'html/dart2js/html_dart2js.dart');
+  }
+
+  test_documentedDefault() {
+    var info = _computeSingleInfo('const LibraryInfo("")');
+    expect(info.documented, true);
+  }
+
+  test_documentedFalse() {
+    var info = _computeSingleInfo('const LibraryInfo("", documented: false)');
+    expect(info.documented, false);
+  }
+
+  test_documentedTrue() {
+    var info = _computeSingleInfo('const LibraryInfo("", documented: true)');
+    expect(info.documented, true);
+  }
+
+  test_implementationDefault() {
+    var info = _computeSingleInfo('const LibraryInfo("")');
+    expect(info.implementation, false);
+  }
+
+  test_implementationFalse() {
+    var info =
+        _computeSingleInfo('const LibraryInfo("", implementation: false)');
+    expect(info.implementation, false);
+  }
+
+  test_implementationTrue() {
+    var info =
+        _computeSingleInfo('const LibraryInfo("", implementation: true)');
+    expect(info.implementation, true);
+  }
+
+  test_maturityDefault() {
+    var info = _computeSingleInfo('const LibraryInfo("")');
+    expect(info.maturity, Maturity.UNSPECIFIED);
+  }
+
+  test_maturityStable() {
+    var info =
+        _computeSingleInfo('const LibraryInfo("", maturity: Maturity.FOO)',
+            additionalDeclarations: '''
+class Maturity {
+  final int level;
+  final String name;
+  final String description;
+
+  const Maturity(this.level, this.name, this.description);
+
+  static const Maturity FOO = const Maturity(10, "Foo", "Foo description");
+}
+''');
+    expect(info.maturity.level, 10);
+    expect(info.maturity.name, 'Foo');
+    expect(info.maturity.description, 'Foo description');
+  }
+
+  test_multipleLibraries() {
+    var info = _computeLibraries('''
+const Map<String, LibraryInfo> libraries = const {
+  "async": const LibraryInfo("async/async.dart"),
+  "core": const LibraryInfo("core/core.dart")
+}
+''');
+    expect(info.keys, unorderedEquals(['async', 'core']));
+    expect(info['async'].path, 'async/async.dart');
+    expect(info['core'].path, 'core/core.dart');
+  }
+
+  test_path() {
+    var info = _computeSingleInfo('const LibraryInfo("core/core.dart")');
+    expect(info.path, 'core/core.dart');
+  }
+
+  test_platformsDefault() {
+    var info = _computeSingleInfo('const LibraryInfo("")');
+    expect(info.platforms, DART2JS_PLATFORM | VM_PLATFORM);
+  }
+
+  test_platformsMultiple() {
+    var info = _computeSingleInfo(
+        'const LibraryInfo("", platforms: VM_PLATFORM | DART2JS_PLATFORM)',
+        additionalDeclarations: '''
+const int DART2JS_PLATFORM = 1;
+const int VM_PLATFORM = 2;
+''');
+    expect(info.platforms, 1 | 2);
+  }
+
+  test_platformsSingle() {
+    var info =
+        _computeSingleInfo('const LibraryInfo("", platforms: VM_PLATFORM)',
+            additionalDeclarations: '''
+const int VM_PLATFORM = 2;
+''');
+    expect(info.platforms, 2);
+  }
+
+  Map<String, LibraryInfo> _computeLibraries(String text,
+      {String additionalDeclarations: ''}) {
+    var fullText = '$text\n$additionalDeclarations';
+    var scanner = new _Scanner(fullText);
+    var token = scanner.tokenize();
+    var parser = new Parser(null, AnalysisErrorListener.NULL_LISTENER);
+    var compilationUnit = parser.parseCompilationUnit(token);
+    var unlinkedUnit = serializeAstUnlinked(compilationUnit);
+    return readLibraries(unlinkedUnit);
+  }
+
+  LibraryInfo _computeSingleInfo(String text,
+      {String additionalDeclarations: ''}) {
+    var libraries = _computeLibraries(
+        'const Map<String, LibraryInfo> libraries = const { "x": $text };',
+        additionalDeclarations: additionalDeclarations);
+    return libraries['x'];
+  }
+}
+
+class _Scanner extends Scanner {
+  _Scanner(String contents) : super(new CharSequenceReader(contents)) {
+    preserveComments = false;
+  }
+
+  @override
+  void reportError(
+      ScannerErrorCode errorCode, int offset, List<Object> arguments) {
+    fail('Unexpected error($errorCode, $offset, $arguments)');
+  }
+}
diff --git a/pkg/front_end/test/src/base/processed_options_test.dart b/pkg/front_end/test/src/base/processed_options_test.dart
new file mode 100644
index 0000000..94941f1
--- /dev/null
+++ b/pkg/front_end/test/src/base/processed_options_test.dart
@@ -0,0 +1,136 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:analyzer/src/summary/format.dart';
+import 'package:front_end/compiler_options.dart';
+import 'package:front_end/memory_file_system.dart';
+import 'package:front_end/src/base/processed_options.dart';
+import 'package:path/path.dart' as pathos;
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(ProcessedOptionsTest);
+  });
+}
+
+@reflectiveTest
+class ProcessedOptionsTest {
+  final fileSystem = new MemoryFileSystem(pathos.posix, Uri.parse('file:///'));
+
+  PackageBundleBuilder _mockSdkSummary;
+
+  PackageBundleBuilder get mockSdkSummary => _mockSdkSummary ??=
+      new PackageBundleBuilder(apiSignature: 'mock summary signature');
+
+  Future<Null> checkMockSummary(CompilerOptions raw) async {
+    var processed = new ProcessedOptions(raw);
+    var sdkSummary = await processed.getSdkSummary();
+    expect(sdkSummary.apiSignature, mockSdkSummary.apiSignature);
+  }
+
+  test_compileSdk_false() {
+    for (var value in [false, true]) {
+      var raw = new CompilerOptions()..compileSdk = value;
+      var processed = new ProcessedOptions(raw);
+      expect(processed.compileSdk, value);
+    }
+  }
+
+  test_fileSystem_noBazelRoots() {
+    // When no bazel roots are specified, the filesystem should be passed
+    // through unmodified.
+    var raw = new CompilerOptions()..fileSystem = fileSystem;
+    var processed = new ProcessedOptions(raw);
+    expect(processed.fileSystem, same(fileSystem));
+  }
+
+  test_getSdkSummary_sdkLocationProvided_noTrailingSlash() async {
+    var uri = Uri.parse('file:///sdk');
+    writeMockSummaryTo(Uri.parse('$uri/lib/_internal/strong.sum'));
+    checkMockSummary(new CompilerOptions()
+      ..fileSystem = fileSystem
+      ..sdkRoot = uri);
+  }
+
+  test_getSdkSummary_sdkLocationProvided_spec() async {
+    var uri = Uri.parse('file:///sdk');
+    writeMockSummaryTo(Uri.parse('$uri/lib/_internal/spec.sum'));
+    checkMockSummary(new CompilerOptions()
+      ..fileSystem = fileSystem
+      ..strongMode = false
+      ..sdkRoot = uri);
+  }
+
+  test_getSdkSummary_sdkLocationProvided_trailingSlash() async {
+    var uri = Uri.parse('file:///sdk');
+    writeMockSummaryTo(Uri.parse('$uri/lib/_internal/strong.sum'));
+    checkMockSummary(new CompilerOptions()
+      ..fileSystem = fileSystem
+      ..sdkRoot = Uri.parse('$uri/'));
+  }
+
+  test_getSdkSummary_summaryLocationProvided() async {
+    var uri = Uri.parse('file:///sdkSummary');
+    writeMockSummaryTo(uri);
+    checkMockSummary(new CompilerOptions()
+      ..fileSystem = fileSystem
+      ..sdkSummary = uri);
+  }
+
+  test_getUriResolver_explicitPackagesFile() async {
+    // This .packages file should be ignored.
+    fileSystem
+        .entityForUri(Uri.parse('file:///.packages'))
+        .writeAsStringSync('foo:bar\n');
+    // This one should be used.
+    fileSystem
+        .entityForUri(Uri.parse('file:///explicit.packages'))
+        .writeAsStringSync('foo:baz\n');
+    var raw = new CompilerOptions()
+      ..fileSystem = fileSystem
+      ..packagesFileUri = Uri.parse('file:///explicit.packages');
+    var processed = new ProcessedOptions(raw);
+    var uriResolver = await processed.getUriResolver();
+    expect(uriResolver.packages, {'foo': Uri.parse('file:///baz/')});
+  }
+
+  test_getUriResolver_explicitPackagesFile_withBaseLocation() async {
+    // This .packages file should be ignored.
+    fileSystem
+        .entityForUri(Uri.parse('file:///.packages'))
+        .writeAsStringSync('foo:bar\n');
+    // This one should be used.
+    fileSystem
+        .entityForUri(Uri.parse('file:///base/location/explicit.packages'))
+        .writeAsStringSync('foo:baz\n');
+    var raw = new CompilerOptions()
+      ..fileSystem = fileSystem
+      ..packagesFileUri = Uri.parse('file:///base/location/explicit.packages');
+    var processed = new ProcessedOptions(raw);
+    var uriResolver = await processed.getUriResolver();
+    expect(
+        uriResolver.packages, {'foo': Uri.parse('file:///base/location/baz/')});
+  }
+
+  test_getUriResolver_noPackages() async {
+    // .packages file should be ignored.
+    fileSystem
+        .entityForUri(Uri.parse('file:///.packages'))
+        .writeAsStringSync('foo:bar\n');
+    var raw = new CompilerOptions()
+      ..fileSystem = fileSystem
+      ..packagesFileUri = new Uri();
+    var processed = new ProcessedOptions(raw);
+    var uriResolver = await processed.getUriResolver();
+    expect(uriResolver.packages, isEmpty);
+  }
+
+  void writeMockSummaryTo(Uri uri) {
+    fileSystem.entityForUri(uri).writeAsBytesSync(mockSdkSummary.toBuffer());
+  }
+}
diff --git a/pkg/front_end/test/src/base/uri_resolver_test.dart b/pkg/front_end/test/src/base/uri_resolver_test.dart
new file mode 100644
index 0000000..627b466
--- /dev/null
+++ b/pkg/front_end/test/src/base/uri_resolver_test.dart
@@ -0,0 +1,175 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/base/uri_resolver.dart';
+import 'package:path/path.dart' as p;
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(UriResolverTestNative);
+    defineReflectiveTests(UriResolverTestPosix);
+    defineReflectiveTests(UriResolverTestWindows);
+  });
+}
+
+/// Generic URI resolver tests which do not depend on the particular path
+/// context in use.
+abstract class UriResolverTest {
+  p.Context get pathContext;
+
+  void test_badScheme() {
+    _expectResolutionUri('foo:bar/baz.dart', Uri.parse('foo:bar/baz.dart'));
+  }
+
+  void test_dart() {
+    _expectResolution('dart:core', _p('sdk/lib/core/core.dart'));
+    _expectResolution('dart:async', _p('sdk/lib/async/async.dart'));
+  }
+
+  void test_dartLeadingSlash() {
+    _expectResolution('dart:/core', null);
+  }
+
+  void test_dartLeadingSlash2() {
+    _expectResolution('dart://core', null);
+  }
+
+  void test_dartLeadingSlash3() {
+    _expectResolution('dart:///core', null);
+  }
+
+  void test_dartPart() {
+    _expectResolution('dart:core/bool.dart', _p('sdk/lib/core/bool.dart'));
+  }
+
+  void test_file() {
+    _expectResolution(_fileUri('foo.dart'), _p('foo.dart'));
+  }
+
+  void test_fileLongPath() {
+    _expectResolution(_fileUri('foo/bar.dart'), _p('foo/bar.dart'));
+  }
+
+  void test_noSchemeAbsolute() {
+    _expectResolutionUri('/foo.dart', Uri.parse('/foo.dart'));
+  }
+
+  void test_noSchemeRelative() {
+    _expectResolution('foo.dart', 'foo.dart');
+  }
+
+  void test_package() {
+    _expectResolution('package:foo/bar.dart', _p('packages/foo/lib/bar.dart'));
+    _expectResolution('package:bar/baz.dart', _p('packages/bar/lib/baz.dart'));
+  }
+
+  void test_packageLeadingSlash() {
+    _expectResolution('package:/foo', null);
+  }
+
+  void test_packageLeadingSlash2() {
+    _expectResolution('package://foo', null);
+  }
+
+  void test_packageLeadingSlash3() {
+    _expectResolution('package:///foo', null);
+  }
+
+  void test_packageLongPath() {
+    _expectResolution(
+        'package:foo/bar/baz.dart', _p('packages/foo/lib/bar/baz.dart'));
+  }
+
+  void test_packageNoPath() {
+    // In practice "package:foo/" is meaningless.  But the VM treats it as
+    // resolving to the package's lib directory (and then later reports the
+    // error when trying to open that directory as a file), so for consistency
+    // we do the same.
+    _expectResolution('package:foo/', _p('packages/foo/lib/'));
+  }
+
+  void test_packageNoSlash() {
+    _expectResolution('package:foo', null);
+  }
+
+  void test_packageUnmatchedName() {
+    _expectResolution('package:doesNotExist/foo.dart', null);
+  }
+
+  /// Verifies that the resolution of [uriString] produces the path
+  /// [expectedResult].
+  void _expectResolution(String uriString, String expectedResult) {
+    _expectResolutionUri(uriString,
+        expectedResult == null ? null : pathContext.toUri(expectedResult));
+  }
+
+  /// Verifies that the resolution of [uriString] produces the URI
+  /// [expectedResult].
+  void _expectResolutionUri(String uriString, Uri expectedResult) {
+    var packages = {
+      'foo': _u('packages/foo/lib/'),
+      'bar': _u('packages/bar/lib/')
+    };
+    var sdkLibraries = {
+      'core': _u('sdk/lib/core/core.dart'),
+      'async': _u('sdk/lib/async/async.dart')
+    };
+    var uriResolver = new UriResolver(packages, sdkLibraries);
+    expect(uriResolver.resolve(Uri.parse(uriString)), expectedResult);
+  }
+
+  /// Prepends "file:///", plus a Windows drive letter if applicable, to the
+  /// given path.
+  String _fileUri(String pathPart) {
+    if (pathContext.separator == '/') {
+      return 'file:///$pathPart';
+    } else {
+      return 'file:///C:/$pathPart';
+    }
+  }
+
+  /// Converts a posix style path into a path appropriate for the current path
+  /// context.
+  String _p(String posixPath) {
+    if (!posixPath.startsWith('/')) posixPath = '/$posixPath';
+    if (pathContext.separator == '/') return posixPath;
+    // Windows
+    return 'C:${posixPath.replaceAll('/', pathContext.separator)}';
+  }
+
+  /// Converts a posix style path into a file URI.
+  Uri _u(String posixPath) => pathContext.toUri(_p(posixPath));
+}
+
+/// Override of [UriResolverTest] which uses the native path context for the
+/// platform the test is running on.
+@reflectiveTest
+class UriResolverTestNative extends UriResolverTest {
+  final p.Context pathContext = p.context;
+}
+
+/// Override of [UriResolverTest] which uses a posix path context, regardless of
+/// the platform the test is running on.
+@reflectiveTest
+class UriResolverTestPosix extends UriResolverTest {
+  final p.Context pathContext = p.posix;
+}
+
+/// Override of [UriResolverTest] which uses a windows path context, regardless
+/// of the platform the test is running on.
+@reflectiveTest
+class UriResolverTestWindows extends UriResolverTest {
+  final p.Context pathContext = p.windows;
+
+  void test_fileWindowsLocal() {
+    _expectResolution('file:///C:/foo/bar.dart', r'C:\foo\bar.dart');
+  }
+
+  void test_fileWindowsUNC() {
+    _expectResolution(
+        'file://computer/directory/foo.dart', r'\\computer\directory\foo.dart');
+  }
+}
diff --git a/pkg/front_end/test/src/dependency_walker_test.dart b/pkg/front_end/test/src/dependency_walker_test.dart
new file mode 100644
index 0000000..d4c731b
--- /dev/null
+++ b/pkg/front_end/test/src/dependency_walker_test.dart
@@ -0,0 +1,219 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:front_end/src/dependency_walker.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(DependencyWalkerTest);
+  });
+}
+
+@reflectiveTest
+class DependencyWalkerTest {
+  final nodes = <String, TestNode>{};
+
+  void checkGraph(Map<String, List<String>> graph, String startingNodeName,
+      List<List<String>> expectedEvaluations, List<bool> expectedSccFlags) {
+    makeGraph(graph);
+    var walker = walk(startingNodeName);
+    expect(walker._evaluations, expectedEvaluations.map((x) => x.toSet()));
+    expect(walker._sccFlags, expectedSccFlags);
+  }
+
+  TestNode getNode(String name) =>
+      nodes.putIfAbsent(name, () => new TestNode(name));
+
+  void makeGraph(Map<String, List<String>> graph) {
+    graph.forEach((name, deps) {
+      var node = getNode(name);
+      for (var dep in deps) {
+        node._dependencies.add(getNode(dep));
+      }
+    });
+  }
+
+  void test_complex_graph() {
+    checkGraph(
+        {
+          'a': ['b', 'c'],
+          'b': ['c', 'd'],
+          'c': [],
+          'd': ['c', 'e'],
+          'e': ['b', 'f'],
+          'f': ['c', 'd']
+        },
+        'a',
+        [
+          ['c'],
+          ['b', 'd', 'e', 'f'],
+          ['a']
+        ],
+        [false, true, false]);
+  }
+
+  void test_diamond() {
+    checkGraph(
+        {
+          'a': ['b', 'c'],
+          'b': ['d'],
+          'c': ['d'],
+          'd': []
+        },
+        'a',
+        [
+          ['d'],
+          ['b'],
+          ['c'],
+          ['a']
+        ],
+        [false, false, false, false]);
+  }
+
+  void test_singleNode() {
+    checkGraph(
+        {'a': []},
+        'a',
+        [
+          ['a']
+        ],
+        [false]);
+  }
+
+  void test_singleNodeWithTrivialCycle() {
+    checkGraph(
+        {
+          'a': ['a']
+        },
+        'a',
+        [
+          ['a']
+        ],
+        [true]);
+  }
+
+  void test_threeNodesWithCircularDependency() {
+    checkGraph(
+        {
+          'a': ['b'],
+          'b': ['c'],
+          'c': ['a'],
+        },
+        'a',
+        [
+          ['a', 'b', 'c']
+        ],
+        [true]);
+  }
+
+  test_twoBacklinksEarlierFirst() {
+    // Test a graph A->B->C->D, where D points back to B and then C.
+    checkGraph(
+        {
+          'a': ['b'],
+          'b': ['c'],
+          'c': ['d'],
+          'd': ['b', 'c']
+        },
+        'a',
+        [
+          ['b', 'c', 'd'],
+          ['a']
+        ],
+        [true, false]);
+  }
+
+  test_twoBacklinksLaterFirst() {
+    // Test a graph A->B->C->D, where D points back to C and then B.
+    checkGraph(
+        {
+          'a': ['b'],
+          'b': ['c'],
+          'c': ['d'],
+          'd': ['c', 'b']
+        },
+        'a',
+        [
+          ['b', 'c', 'd'],
+          ['a']
+        ],
+        [true, false]);
+  }
+
+  void test_twoNodesWithCircularDependency() {
+    checkGraph(
+        {
+          'a': ['b'],
+          'b': ['a']
+        },
+        'a',
+        [
+          ['a', 'b']
+        ],
+        [true]);
+  }
+
+  void test_twoNodesWithSimpleDependency() {
+    checkGraph(
+        {
+          'a': ['b'],
+          'b': []
+        },
+        'a',
+        [
+          ['b'],
+          ['a']
+        ],
+        [false, false]);
+  }
+
+  TestWalker walk(String startingNodeName) =>
+      new TestWalker()..walk(getNode(startingNodeName));
+}
+
+class TestNode extends Node<TestNode> {
+  final String _name;
+
+  @override
+  bool isEvaluated = false;
+
+  bool _computeDependenciesCalled = false;
+
+  final _dependencies = <TestNode>[];
+
+  TestNode(this._name);
+
+  @override
+  List<TestNode> computeDependencies() {
+    expect(_computeDependenciesCalled, false);
+    _computeDependenciesCalled = true;
+    return _dependencies;
+  }
+}
+
+class TestWalker extends DependencyWalker<TestNode> {
+  final _evaluations = <Set<String>>[];
+  final _sccFlags = <bool>[];
+
+  @override
+  void evaluate(TestNode v) {
+    v.isEvaluated = true;
+    _evaluations.add([v._name].toSet());
+    _sccFlags.add(false);
+  }
+
+  @override
+  void evaluateScc(List<TestNode> scc) {
+    for (var v in scc) {
+      v.isEvaluated = true;
+    }
+    var sccNames = scc.map((node) => node._name).toSet();
+    // Make sure there were no duplicates
+    expect(sccNames.length, scc.length);
+    _evaluations.add(sccNames);
+    _sccFlags.add(true);
+  }
+}
diff --git a/pkg/front_end/test/subpackage_relationships_test.dart b/pkg/front_end/test/subpackage_relationships_test.dart
new file mode 100644
index 0000000..9df8ff4
--- /dev/null
+++ b/pkg/front_end/test/subpackage_relationships_test.dart
@@ -0,0 +1,141 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:front_end/compiler_options.dart';
+import 'package:front_end/dependency_grapher.dart';
+import 'package:path/path.dart' as pathos;
+
+main() async {
+  exit(await new _SubpackageRelationshipsTest().run());
+}
+
+/// Map from subpackage name to the rules for what the subpackage is allowed to
+/// depend directly on.
+///
+/// Each subdirectory of `lib/src` is considered a subpackage.  Files in
+/// `lib/src` but not in a subdirectory are considered to be in the `lib/src`
+/// subpackage.  Files outside of `lib/src` (but still in `lib`) are considered
+/// to be in the `lib` subpackage.
+///
+/// TODO(paulberry): stuff in lib/src shouldn't depend on lib; lib should just
+/// re-export stuff in lib/src.
+/// TODO(paulberry): remove dependencies on analyzer.
+final subpackageRules = {
+  'lib': new SubpackageRules(
+      mayImportAnalyzer: true,
+      allowedDependencies: ['lib/src', 'lib/src/base']),
+  'lib/src': new SubpackageRules(
+      mayImportAnalyzer: true,
+      allowedDependencies: ['lib', 'lib/src/base', 'lib/src/scanner']),
+  'lib/src/base': new SubpackageRules(
+      mayImportAnalyzer: true, allowedDependencies: ['lib']),
+  'lib/src/scanner': new SubpackageRules(allowedDependencies: ['lib/src/base']),
+};
+
+/// Rules for what a subpackage may depend directly on.
+class SubpackageRules {
+  /// Indicates whether the subpackage may directly depend on analyzer.
+  final bool mayImportAnalyzer;
+
+  /// Indicates which other subpackages a given subpackage may directly depend
+  /// on.
+  final List<String> allowedDependencies;
+
+  SubpackageRules(
+      {this.mayImportAnalyzer: false, this.allowedDependencies: const []});
+}
+
+class _SubpackageRelationshipsTest {
+  /// File uri of the front_end package's "lib" directory.
+  final frontEndLibUri = Platform.script.resolve('../lib/');
+
+  /// Indicates whether any problems have been reported yet.
+  bool problemsReported = false;
+
+  /// Check for problems resulting from URI [src] having a direct dependency on
+  /// URI [dst].
+  void checkDependency(Uri src, Uri dst) {
+    if (dst.scheme == 'dart') return;
+    if (dst.scheme != 'package') {
+      problem('$src depends on $dst, which is neither a package: or dart: URI');
+      return;
+    }
+    var srcSubpackage = subpackageForUri(src);
+    if (srcSubpackage == null) return;
+    var srcSubpackageRules = subpackageRules[srcSubpackage];
+    if (srcSubpackageRules == null) {
+      problem('$src is in subpackage "$srcSubpackage", which is not found in '
+          'subpackageRules');
+      return;
+    }
+    if (!srcSubpackageRules.mayImportAnalyzer &&
+        dst.pathSegments[0] == 'analyzer') {
+      problem('$src depends on $dst, but subpackage "$srcSubpackage" may not '
+          'import analyzer');
+    }
+    var dstSubPackage = subpackageForUri(dst);
+    if (dstSubPackage == null) return;
+    if (dstSubPackage == srcSubpackage) return;
+    if (!srcSubpackageRules.allowedDependencies.contains(dstSubPackage)) {
+      problem('$src depends on $dst, but subpackage "$srcSubpackage" is not '
+          'allowed to depend on subpackage "$dstSubPackage"');
+    }
+  }
+
+  /// Finds all files in the front_end's "lib" directory and returns their Uris
+  /// (as "package:" URIs).
+  List<Uri> findFrontEndUris() {
+    var frontEndUris = <Uri>[];
+    var frontEndLibPath = pathos.fromUri(frontEndLibUri);
+    for (var entity in new Directory(frontEndLibPath)
+        .listSync(recursive: true, followLinks: false)) {
+      if (entity is File && entity.path.endsWith('.dart')) {
+        var posixRelativePath = pathos.url.joinAll(
+            pathos.split(pathos.relative(entity.path, from: frontEndLibPath)));
+        frontEndUris.add(Uri.parse('package:front_end/$posixRelativePath'));
+      }
+    }
+    return frontEndUris;
+  }
+
+  /// Reports a single problem.
+  void problem(String description) {
+    print(description);
+    problemsReported = true;
+  }
+
+  /// Tests all subpackage relationships in the front end, and returns an
+  /// appropriate exit code.
+  Future<int> run() async {
+    var frontEndUris = await findFrontEndUris();
+    var packagesFileUri = frontEndLibUri.resolve('../../../.packages');
+    var graph = await graphForProgram(
+        frontEndUris,
+        new CompilerOptions()
+          ..packagesFileUri = packagesFileUri
+          ..chaseDependencies = true);
+    for (var i = 0; i < graph.topologicallySortedCycles.length; i++) {
+      for (var library in graph.topologicallySortedCycles[i].libraries.values) {
+        for (var dependency in library.dependencies) {
+          checkDependency(library.uri, dependency.uri);
+        }
+      }
+    }
+    return problemsReported ? 1 : 0;
+  }
+
+  /// Determines which subpackage [src] is in.
+  ///
+  /// If [src] is not part of the front end, `null` is returned.
+  String subpackageForUri(Uri src) {
+    if (src.scheme != 'package') return null;
+    if (src.pathSegments[0] != 'front_end') return null;
+    if (src.pathSegments[1] != 'src') return 'lib';
+    if (src.pathSegments.length == 3) return 'lib/src';
+    return 'lib/src/${src.pathSegments[2]}';
+  }
+}
diff --git a/pkg/front_end/tool/example.dart b/pkg/front_end/tool/example.dart
new file mode 100644
index 0000000..d81f437
--- /dev/null
+++ b/pkg/front_end/tool/example.dart
@@ -0,0 +1,29 @@
+import 'dart:async';
+
+import 'package:front_end/kernel_generator.dart';
+import 'package:front_end/compiler_options.dart';
+import 'package:kernel/binary/ast_to_binary.dart';
+import 'package:kernel/kernel.dart' show Program;
+
+Future dumpToSink(Program program, StreamSink<List<int>> sink) {
+  new BinaryPrinter(sink).writeProgramFile(program);
+  return sink.close();
+}
+
+Future kernelToSink(Uri entry, StreamSink<List<int>> sink) async {
+  var program = await kernelForProgram(
+      entry,
+      new CompilerOptions()
+        ..sdkRoot = new Uri.file('sdk')
+        ..packagesFileUri = new Uri.file('.packages')
+        ..onError = (e) => print(e.message));
+
+  await dumpToSink(program, sink);
+}
+
+main(args) async {
+  kernelToSink(
+      Uri.base.resolve(args[0]),
+      // TODO(sigmund,hausner): define memory type where to dump binary data.
+      new StreamController<List<int>>.broadcast().sink);
+}
diff --git a/pkg/front_end/tool/perf.dart b/pkg/front_end/tool/perf.dart
index 4d61e9b..7c4e4cd 100644
--- a/pkg/front_end/tool/perf.dart
+++ b/pkg/front_end/tool/perf.dart
@@ -6,7 +6,7 @@
 library front_end.tool.perf;
 
 import 'dart:async';
-import 'dart:io' show exit, stderr;
+import 'dart:io' show exit;
 
 import 'package:analyzer/dart/ast/ast.dart';
 import 'package:analyzer/error/listener.dart';
@@ -19,22 +19,17 @@
 import 'package:analyzer/src/generated/parser.dart';
 import 'package:analyzer/src/generated/source.dart';
 import 'package:analyzer/src/generated/source_io.dart';
-import 'package:kernel/analyzer/loader.dart';
-import 'package:kernel/kernel.dart';
-import 'package:package_config/discovery.dart';
-
+import 'package:analyzer/src/summary/format.dart';
+import 'package:analyzer/src/summary/idl.dart';
+import 'package:analyzer/src/summary/link.dart';
+import 'package:analyzer/src/summary/summarize_ast.dart';
+import 'package:front_end/compiler_options.dart';
+import 'package:front_end/kernel_generator.dart';
 import 'package:front_end/src/scanner/reader.dart';
 import 'package:front_end/src/scanner/scanner.dart';
 import 'package:front_end/src/scanner/token.dart';
-
-/// Cumulative total number of chars scanned.
-int scanTotalChars = 0;
-
-/// Cumulative time spent scanning.
-Stopwatch scanTimer = new Stopwatch();
-
-/// Factory to load and resolve app, packages, and sdk sources.
-SourceFactory sources;
+import 'package:kernel/kernel.dart' hide Source;
+import 'package:package_config/discovery.dart';
 
 main(List<String> args) async {
   // TODO(sigmund): provide sdk folder as well.
@@ -42,136 +37,60 @@
     print('usage: perf.dart <bench-id> <entry.dart>');
     exit(1);
   }
-  var totalTimer = new Stopwatch()..start();
 
   var bench = args[0];
   var entryUri = Uri.base.resolve(args[1]);
 
   await setup(entryUri);
 
+  Set<Source> files = scanReachableFiles(entryUri);
   var handlers = {
-    'scan': () async {
-      Set<Source> files = scanReachableFiles(entryUri);
-      // TODO(sigmund): replace the warmup with instrumented snapshots.
-      for (int i = 0; i < 10; i++) scanFiles(files);
-    },
-    'parse': () async {
-      Set<Source> files = scanReachableFiles(entryUri);
-      // TODO(sigmund): replace the warmup with instrumented snapshots.
-      for (int i = 0; i < 10; i++) parseFiles(files);
-    },
+    'scan': () async => scanFiles(files),
+    'parse': () async => parseFiles(files),
     'kernel_gen_e2e': () async {
-      // TODO(sigmund): remove. This is used to compute the input size, we
-      // should extract input size from frontend instead.
-      scanReachableFiles(entryUri);
-      // TODO(sigmund): replace this warmup. Note that for very large programs,
-      // the GC pressure on the VM seems to make this worse with time (maybe we
-      // are leaking memory?). That's why we run it twice and not 10 times.
-      for (int i = 0; i < 2; i++) await generateKernel(entryUri);
+      await generateKernel(entryUri, useSdkSummary: false);
     },
+    'kernel_gen_e2e_sum': () async {
+      await generateKernel(entryUri, useSdkSummary: true, compileSdk: false);
+    },
+    'unlinked_summarize': () async => summarize(files),
+    'unlinked_summarize_from_sources': () async => summarize(files),
+    'prelinked_summarize': () async => summarize(files, prelink: true),
+    'linked_summarize': () async => summarize(files, link: true),
   };
 
   var handler = handlers[bench];
   if (handler == null) {
-    // TODO(sigmund): implement the remaining benchmarks.
     print('unsupported bench-id: $bench. Please specify one of the following: '
         '${handlers.keys.join(", ")}');
     exit(1);
   }
-  await handler();
 
-  totalTimer.stop();
-  report("total", totalTimer.elapsedMicroseconds);
-}
-
-/// Sets up analyzer to be able to load and resolve app, packages, and sdk
-/// sources.
-Future setup(Uri entryUri) async {
-  var provider = PhysicalResourceProvider.INSTANCE;
-  var packageMap = new ContextBuilder(provider, null, null)
-      .convertPackagesToMap(await findPackages(entryUri));
-  sources = new SourceFactory([
-    new ResourceUriResolver(provider),
-    new PackageMapUriResolver(provider, packageMap),
-    new DartUriResolver(
-        new FolderBasedDartSdk(provider, provider.getFolder("sdk"))),
-  ]);
-}
-
-/// Load and scans all files we need to process: files reachable from the
-/// entrypoint and all core libraries automatically included by the VM.
-Set<Source> scanReachableFiles(Uri entryUri) {
-  var files = new Set<Source>();
-  var loadTimer = new Stopwatch()..start();
-  collectSources(sources.forUri2(entryUri), files);
-
-  var libs = [
-    "dart:async",
-    "dart:collection",
-    "dart:convert",
-    "dart:core",
-    "dart:developer",
-    "dart:_internal",
-    "dart:isolate",
-    "dart:math",
-    "dart:mirrors",
-    "dart:typed_data",
-    "dart:io"
-  ];
-
-  for (var lib in libs) {
-    collectSources(sources.forUri(lib), files);
+  // TODO(sigmund): replace the warmup with instrumented snapshots.
+  int iterations = bench.contains('kernel_gen') ? 2 : 10;
+  for (int i = 0; i < iterations; i++) {
+    var totalTimer = new Stopwatch()..start();
+    print('== iteration $i');
+    await handler();
+    totalTimer.stop();
+    report('total', totalTimer.elapsedMicroseconds);
   }
-
-  loadTimer.stop();
-
-  print('input size: ${scanTotalChars} chars');
-  var loadTime = loadTimer.elapsedMicroseconds - scanTimer.elapsedMicroseconds;
-  report("load", loadTime);
-  report("scan", scanTimer.elapsedMicroseconds);
-  return files;
 }
 
-/// Scans every file in [files] and reports the time spent doing so.
-void scanFiles(Set<Source> files) {
-  // The code below will record again how many chars are scanned and how long it
-  // takes to scan them, even though we already did so in [scanReachableFiles].
-  // Recording and reporting this twice is unnecessary, but we do so for now to
-  // validate that the results are consistent.
-  scanTimer = new Stopwatch();
-  var old = scanTotalChars;
-  scanTotalChars = 0;
-  for (var source in files) {
-    tokenize(source);
-  }
+/// Cumulative time spent parsing.
+Stopwatch parseTimer = new Stopwatch();
 
-  // Report size and scanning time again. See discussion above.
-  if (old != scanTotalChars) print('input size changed? ${old} chars');
-  report("scan", scanTimer.elapsedMicroseconds);
-}
+/// Cumulative time spent building unlinked summaries.
+Stopwatch unlinkedSummarizeTimer = new Stopwatch();
 
-/// Parses every file in [files] and reports the time spent doing so.
-void parseFiles(Set<Source> files) {
-  // The code below will record again how many chars are scanned and how long it
-  // takes to scan them, even though we already did so in [scanReachableFiles].
-  // Recording and reporting this twice is unnecessary, but we do so for now to
-  // validate that the results are consistent.
-  scanTimer = new Stopwatch();
-  var old = scanTotalChars;
-  scanTotalChars = 0;
-  var parseTimer = new Stopwatch()..start();
-  for (var source in files) {
-    parseFull(source);
-  }
-  parseTimer.stop();
+/// Cumulative time spent scanning.
+Stopwatch scanTimer = new Stopwatch();
 
-  // Report size and scanning time again. See discussion above.
-  if (old != scanTotalChars) print('input size changed? ${old} chars');
-  report("scan", scanTimer.elapsedMicroseconds);
+/// Size of all sources.
+int inputSize = 0;
 
-  var pTime = parseTimer.elapsedMicroseconds - scanTimer.elapsedMicroseconds;
-  report("parse", pTime);
-}
+/// Factory to load and resolve app, packages, and sdk sources.
+SourceFactory sources;
 
 /// Add to [files] all sources reachable from [start].
 void collectSources(Source start, Set<Source> files) {
@@ -185,6 +104,87 @@
   }
 }
 
+Future<Program> generateKernel(Uri entryUri,
+    {bool useSdkSummary: false, bool compileSdk: true}) async {
+  // TODO(sigmund): this is here only to compute the input size,
+  // we should extract the input size from the frontend instead.
+  scanReachableFiles(entryUri);
+
+  var dartkTimer = new Stopwatch()..start();
+  // TODO(sigmund): add a constructor with named args to compiler options.
+  var options = new CompilerOptions()
+    ..strongMode = false
+    ..compileSdk = compileSdk
+    ..packagesFileUri = new Uri.file('.packages')
+    ..onError = ((e) => print('${e.message}'));
+  if (useSdkSummary) {
+    // TODO(sigmund): adjust path based on the benchmark runner architecture.
+    // Possibly let the runner make the file available at an architecture
+    // independent location.
+    options.sdkSummary =
+        new Uri.file('out/ReleaseX64/dart-sdk/lib/_internal/spec.sum');
+  } else {
+    options.sdkRoot = new Uri.file('sdk');
+  }
+  Program program = await kernelForProgram(entryUri, options);
+  dartkTimer.stop();
+  var suffix = useSdkSummary ? '_sum' : '';
+  report('kernel_gen_e2e${suffix}', dartkTimer.elapsedMicroseconds);
+  return program;
+}
+
+/// Generates unlinkmed summaries for all files in [files], and returns them in
+/// an [_UnlinkedSummaries] container.
+_UnlinkedSummaries generateUnlinkedSummaries(Set<Source> files) {
+  var unlinkedSummaries = new _UnlinkedSummaries();
+  for (var source in files) {
+    unlinkedSummaries.summariesByUri[source.uri.toString()] =
+        unlinkedSummarize(source);
+  }
+  return unlinkedSummaries;
+}
+
+/// Generates unlinked summaries for every file in [files] and, if requested via
+/// [prelink] or [link], generates the pre-linked and linked summaries as well.
+///
+/// This function also prints a report of the time spent on each action.
+void summarize(Set<Source> files, {bool prelink: false, bool link: false}) {
+  scanTimer = new Stopwatch();
+  parseTimer = new Stopwatch();
+  unlinkedSummarizeTimer = new Stopwatch();
+  var unlinkedSummaries = generateUnlinkedSummaries(files);
+  report('scan', scanTimer.elapsedMicroseconds);
+  report('parse', parseTimer.elapsedMicroseconds);
+  report('unlinked_summarize', unlinkedSummarizeTimer.elapsedMicroseconds);
+  report(
+      'unlinked_summarize_from_sources',
+      unlinkedSummarizeTimer.elapsedMicroseconds +
+          parseTimer.elapsedMicroseconds +
+          scanTimer.elapsedMicroseconds);
+
+  if (prelink || link) {
+    var prelinkTimer = new Stopwatch()..start();
+    var prelinkedLibraries = prelinkSummaries(files, unlinkedSummaries);
+    prelinkTimer.stop();
+    report('prelinked_summarize', prelinkTimer.elapsedMicroseconds);
+
+    if (link) {
+      var linkTimer = new Stopwatch()..start();
+      LinkedLibrary getDependency(String uri) {
+        // getDependency should never be called because all dependencies are
+        // present in [prelinkedLibraries].
+        print('Warning: getDependency called for: $uri');
+        return null;
+      }
+
+      relink(prelinkedLibraries, getDependency, unlinkedSummaries.getUnit,
+          true /*strong*/);
+      linkTimer.stop();
+      report('linked_summarize', linkTimer.elapsedMicroseconds);
+    }
+  }
+}
+
 /// Uses the diet-parser to parse only directives in [source].
 CompilationUnit parseDirectives(Source source) {
   var token = tokenize(source);
@@ -192,26 +192,151 @@
   return parser.parseDirectives(token);
 }
 
+/// Parses every file in [files] and reports the time spent doing so.
+void parseFiles(Set<Source> files) {
+  scanTimer = new Stopwatch();
+  parseTimer = new Stopwatch();
+  for (var source in files) {
+    parseFull(source);
+  }
+
+  report('scan', scanTimer.elapsedMicroseconds);
+  report('parse', parseTimer.elapsedMicroseconds);
+}
+
 /// Parse the full body of [source] and return it's compilation unit.
 CompilationUnit parseFull(Source source) {
   var token = tokenize(source);
+  parseTimer.start();
   var parser = new Parser(source, AnalysisErrorListener.NULL_LISTENER);
-  return parser.parseCompilationUnit(token);
+  var unit = parser.parseCompilationUnit(token);
+  parseTimer.stop();
+  return unit;
+}
+
+/// Prelinks all the summaries for [files], using [unlinkedSummaries] to obtain
+/// their unlinked summaries.
+///
+/// The return value is suitable for passing to the summary linker.
+Map<String, LinkedLibraryBuilder> prelinkSummaries(
+    Set<Source> files, _UnlinkedSummaries unlinkedSummaries) {
+  Set<String> libraryUris = files.map((source) => '${source.uri}').toSet();
+
+  String getDeclaredVariable(String s) => null;
+  var prelinkedLibraries =
+      setupForLink(libraryUris, unlinkedSummaries.getUnit, getDeclaredVariable);
+  return prelinkedLibraries;
+}
+
+/// Report that metric [name] took [time] micro-seconds to process
+/// [inputSize] characters.
+void report(String name, int time) {
+  var sb = new StringBuffer();
+  var padding = ' ' * (20 - name.length);
+  sb.write('$name:$padding $time us, ${time ~/ 1000} ms');
+  var invSpeed = (time * 1000 / inputSize).toStringAsFixed(2);
+  sb.write(', $invSpeed ns/char');
+  print('$sb');
+}
+
+/// Scans every file in [files] and reports the time spent doing so.
+void scanFiles(Set<Source> files) {
+  // `tokenize` records how many chars are scanned and how long it takes to scan
+  // them. As this function is called repeatedly when running as a benchmark, we
+  // make sure to clear the data and compute it again every time.
+  scanTimer = new Stopwatch();
+  for (var source in files) {
+    tokenize(source);
+  }
+
+  report('scan', scanTimer.elapsedMicroseconds);
+}
+
+/// Load and scans all files we need to process: files reachable from the
+/// entrypoint and all core libraries automatically included by the VM.
+Set<Source> scanReachableFiles(Uri entryUri) {
+  var files = new Set<Source>();
+  var loadTimer = new Stopwatch()..start();
+  scanTimer = new Stopwatch();
+  collectSources(sources.forUri2(entryUri), files);
+
+  var libs = [
+    'dart:async',
+    'dart:collection',
+    'dart:convert',
+    'dart:core',
+    'dart:developer',
+    'dart:_internal',
+    'dart:isolate',
+    'dart:math',
+    'dart:mirrors',
+    'dart:typed_data',
+    'dart:io'
+  ];
+
+  for (var lib in libs) {
+    collectSources(sources.forUri(lib), files);
+  }
+
+  loadTimer.stop();
+
+  inputSize = 0;
+  for (var s in files) inputSize += s.contents.data.length;
+  print('input size: ${inputSize} chars');
+  var loadTime = loadTimer.elapsedMicroseconds - scanTimer.elapsedMicroseconds;
+  report('load', loadTime);
+  report('scan', scanTimer.elapsedMicroseconds);
+  return files;
+}
+
+/// Sets up analyzer to be able to load and resolve app, packages, and sdk
+/// sources.
+Future setup(Uri entryUri) async {
+  var provider = PhysicalResourceProvider.INSTANCE;
+  var packageMap = new ContextBuilder(provider, null, null)
+      .convertPackagesToMap(await findPackages(entryUri));
+  sources = new SourceFactory([
+    new ResourceUriResolver(provider),
+    new PackageMapUriResolver(provider, packageMap),
+    new DartUriResolver(
+        new FolderBasedDartSdk(provider, provider.getFolder('sdk'))),
+  ]);
 }
 
 /// Scan [source] and return the first token produced by the scanner.
 Token tokenize(Source source) {
   scanTimer.start();
-  var contents = source.contents.data;
-  scanTotalChars += contents.length;
   // TODO(sigmund): is there a way to scan from a random-access-file without
   // first converting to String?
-  var scanner = new _Scanner(contents);
+  var scanner = new _Scanner(source.contents.data);
   var token = scanner.tokenize();
   scanTimer.stop();
   return token;
 }
 
+UnlinkedUnitBuilder unlinkedSummarize(Source source) {
+  var unit = parseFull(source);
+  unlinkedSummarizeTimer.start();
+  var unlinkedUnit = serializeAstUnlinked(unit);
+  unlinkedSummarizeTimer.stop();
+  return unlinkedUnit;
+}
+
+/// Simple container for a mapping from URI string to an unlinked summary.
+class _UnlinkedSummaries {
+  final summariesByUri = <String, UnlinkedUnit>{};
+
+  /// Get the unlinked summary for the given URI, and report a warning if it
+  /// can't be found.
+  UnlinkedUnit getUnit(String uri) {
+    var result = summariesByUri[uri];
+    if (result == null) {
+      print('Warning: no summary found for: $uri');
+    }
+    return result;
+  }
+}
+
 class _Scanner extends Scanner {
   _Scanner(String contents) : super(new CharSequenceReader(contents)) {
     preserveComments = false;
@@ -222,35 +347,3 @@
     // ignore errors.
   }
 }
-
-/// Report that metric [name] took [time] micro-seconds to process
-/// [scanTotalChars] characters.
-void report(String name, int time) {
-  var sb = new StringBuffer();
-  sb.write('$name: $time us, ${time ~/ 1000} ms');
-  sb.write(', ${scanTotalChars * 1000 ~/ time} chars/ms');
-  print('$sb');
-}
-
-// TODO(sigmund): replace this once kernel is produced by the frontend directly.
-Future<Program> generateKernel(Uri entryUri) async {
-  var dartkTimer = new Stopwatch()..start();
-  var options = new DartOptions(strongMode: false, sdk: 'sdk');
-  var packages =
-      await createPackages(options.packagePath, discoveryPath: entryUri.path);
-  var repository = new Repository();
-  DartLoader loader = new DartLoader(repository, options, packages);
-
-  Program program = loader.loadProgram(entryUri.path);
-  List errors = loader.errors;
-  if (errors.isNotEmpty) {
-    const int errorLimit = 100;
-    stderr.writeln(errors.take(errorLimit).join('\n'));
-    if (errors.length > errorLimit) {
-      stderr.writeln('[error] ${errors.length - errorLimit} errors not shown');
-    }
-  }
-  dartkTimer.stop();
-  report("kernel_gen_e2e", dartkTimer.elapsedMicroseconds);
-  return program;
-}
diff --git a/pkg/front_end/tool/perf_test.dart b/pkg/front_end/tool/perf_test.dart
index 5abc06f..66093ed 100644
--- a/pkg/front_end/tool/perf_test.dart
+++ b/pkg/front_end/tool/perf_test.dart
@@ -8,4 +8,4 @@
 
 import 'perf.dart' as m;
 
-main() => print('done ${m.scanTotalChars}');
+main() => print('done ${m.inputSize}');
diff --git a/pkg/kernel/bin/batch_util.dart b/pkg/kernel/bin/batch_util.dart
index 0070aa0..a758095 100644
--- a/pkg/kernel/bin/batch_util.dart
+++ b/pkg/kernel/bin/batch_util.dart
@@ -7,7 +7,10 @@
 import 'dart:convert';
 import 'dart:io';
 
-enum CompilerOutcome { Ok, Fail, }
+enum CompilerOutcome {
+  Ok,
+  Fail,
+}
 
 typedef Future<CompilerOutcome> BatchCallback(List<String> arguments);
 
diff --git a/pkg/kernel/bin/dartk.dart b/pkg/kernel/bin/dartk.dart
index e735f97..b8666a4 100755
--- a/pkg/kernel/bin/dartk.dart
+++ b/pkg/kernel/bin/dartk.dart
@@ -10,6 +10,7 @@
 
 import 'package:args/args.dart';
 import 'package:kernel/analyzer/loader.dart';
+import 'package:kernel/application_root.dart';
 import 'package:kernel/verifier.dart';
 import 'package:kernel/kernel.dart';
 import 'package:kernel/log.dart';
@@ -36,6 +37,11 @@
   ..addOption('packages',
       abbr: 'p', help: 'Path to the .packages file or packages folder.')
   ..addOption('package-root', help: 'Deprecated alias for --packages')
+  ..addOption('app-root',
+      help: 'Store library paths relative to the given directory.\n'
+          'If none is given, absolute paths are used.\n'
+          'Application libraries not inside the application root are stored '
+          'using absolute paths')
   ..addOption('target',
       abbr: 't',
       help: 'Tailor the IR to the given target.',
@@ -69,7 +75,9 @@
       hide: true)
   ..addFlag('show-external',
       help: 'When printing a library as text, also print its dependencies\n'
-          'on external libraries.');
+          'on external libraries.')
+  ..addFlag('show-offsets',
+      help: 'When printing a library as text, also print node offsets');
 
 String getUsage() => """
 Usage: dartk [options] FILE
@@ -244,6 +252,13 @@
   String packagePath = options['packages'] ?? options['package-root'];
   checkIsFileOrDirectoryOrNull(packagePath, 'Package root or .packages');
 
+  String applicationRootOption = options['app-root'];
+  checkIsDirectoryOrNull(applicationRootOption, 'Application root');
+  if (applicationRootOption != null) {
+    applicationRootOption = new File(applicationRootOption).absolute.path;
+  }
+  var applicationRoot = new ApplicationRoot(applicationRootOption);
+
   // Set up logging.
   if (options['verbose']) {
     log.onRecord.listen((LogRecord rec) {
@@ -255,9 +270,10 @@
     return fail('Exactly one FILE should be given.');
   }
 
-  var file = options.rest.single;
-
+  String file = options.rest.single;
   checkIsFile(file, option: 'Input file');
+  file = new File(file).absolute.path;
+  Uri fileUri = new Uri(scheme: 'file', path: file);
 
   String format = options['format'] ?? defaultFormat();
   String outputFile = options['out'] ?? defaultOutput();
@@ -297,16 +313,18 @@
         sdk: options['sdk'],
         packagePath: packagePath,
         customUriMappings: customUriMappings,
-        declaredVariables: declaredVariables);
+        declaredVariables: declaredVariables,
+        applicationRoot: applicationRoot);
     String packageDiscoveryPath = batchModeState.isBatchMode ? null : file;
     DartLoader loader = await batchModeState.batch.getLoader(
         repository, dartOptions,
         packageDiscoveryPath: packageDiscoveryPath);
     if (options['link']) {
-      program = loader.loadProgram(file, target: target);
+      program = loader.loadProgram(fileUri, target: target);
     } else {
-      var library = loader.loadLibrary(file);
-      assert(library == repository.getLibrary(file));
+      var library = loader.loadLibrary(fileUri);
+      assert(library ==
+          repository.getLibraryReference(applicationRoot.relativeUri(fileUri)));
       program = new Program(repository.libraries);
     }
     errors = loader.errors;
@@ -360,7 +378,9 @@
     switch (format) {
       case 'text':
         writeProgramToText(program,
-            path: outputFile, showExternal: options['show-external']);
+            path: outputFile,
+            showExternal: options['show-external'],
+            showOffsets: options['show-offsets']);
         break;
       case 'bin':
         ioFuture = writeProgramToBinary(program, outputFile);
diff --git a/pkg/kernel/bin/transform.dart b/pkg/kernel/bin/transform.dart
index 680a760..37f1838 100755
--- a/pkg/kernel/bin/transform.dart
+++ b/pkg/kernel/bin/transform.dart
@@ -12,6 +12,7 @@
 import 'package:kernel/transformations/continuation.dart' as cont;
 import 'package:kernel/transformations/infer_values.dart' as infer_values;
 import 'package:kernel/transformations/mixin_full_resolution.dart' as mix;
+import 'package:kernel/transformations/closure_conversion.dart' as closures;
 import 'package:kernel/transformations/treeshaker.dart' as treeshaker;
 
 import 'batch_util.dart';
@@ -72,6 +73,9 @@
     case 'resolve-mixins':
       program = mix.transformProgram(program);
       break;
+    case 'closures':
+      program = closures.transformProgram(program);
+      break;
     case 'treeshake':
       program = treeshaker.transformProgram(program);
       break;
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index 6f8a03a..a287dd6 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -42,45 +42,44 @@
 
 type MagicWord = big endian 32-bit unsigned integer
 
-type String {
-  UInt num_bytes;
-  Byte[num_bytes] utf8_bytes;
-}
-
-type StringTable {
-  UInt num_strings;
-  String[num_strings] strings;
-}
-
-type StringReference {
-  UInt index; // Index into the StringTable.
-}
-
-type LineStarts {
-  UInt lineCount;
-  // Delta encoded, e.g. 0, 10, 15, 7, 10 means 0, 10, 25, 32, 42.
-  UInt[lineCount] lineStarts;
-}
-
-type UriLineStarts {
-  StringTable uris;
-  LineStarts[uris.num_strings] lineStarts;
-}
-
-type UriReference {
-  UInt index; // Index into the URIs StringTable.
-}
-
-type FileOffset {
-  // Saved as number+1 to accommodate literal "-1".
-  UInt fileOffset;
-}
-
 type List<T> {
   UInt length;
   T[length] items;
 }
 
+type String {
+  List<Byte> utf8Bytes;
+}
+
+type StringTable {
+  List<String> strings;
+}
+
+type StringReference {
+  UInt index; // Index into the StringTable strings.
+}
+
+type Source {
+  String source;
+  // Line starts are delta-encoded (they are encoded as line lengths).  The list
+  // [0, 10, 25, 32, 42] is encoded as [0, 10, 15, 7, 10].
+  List<Uint> lineStarts;
+}
+
+type UriSource {
+  List<String> uris;
+  Source[uris.length] source;
+}
+
+type UriReference {
+  UInt index; // Index into the UriSource uris.
+}
+
+type FileOffset {
+  // Encoded as offset + 1 to accommodate -1 indicating no offset.
+  UInt fileOffset;
+}
+
 type Option<T> {
   Byte tag;
 }
@@ -95,14 +94,13 @@
 type ProgramFile {
   MagicWord magic = 0x90ABCDEF;
   StringTable strings;
-  UriLineStarts lineStartsMap;
-  List<Library> library;
+  UriSource sourceMap;
+  List<Library> libraries;
   LibraryProcedureReference mainMethod;
 }
 
 type LibraryReference {
-  // For library files, this is an index into the import table.
-  // For program files, this is an index into the list of libaries.
+  // Index into the ProgramFile libraries.
   UInt index;
 }
 
@@ -169,8 +167,11 @@
 type Library {
   Byte flags (isExternal);
   StringReference name;
-  // A URI with the dart, package, or file scheme.  For file URIs, the path
-  // is an absolute path to the .dart file from which the library was created.
+  // A URI from which the library was created.  The URI has the dart, package,
+  // file, or app scheme.  For file URIs, the path is an absolute path to the
+  // .dart file from which the library was created.  For app URIs, the path is
+  // relative to an application root that was specified when the binary was
+  // generated.
   StringReference importUri;
   // An absolute path URI to the .dart file from which the library was created.
   UriReference fileUri;
@@ -195,6 +196,7 @@
 
 type NormalClass extends Class {
   Byte tag = 2;
+  FileOffset fileOffset;
   Byte flags (isAbstract, isTypeLevel);
   StringReference name;
   // An absolute path URI to the .dart file from which the class was created.
@@ -210,6 +212,7 @@
 
 type MixinClass extends Class {
   Byte tag = 3;
+  FileOffset fileOffset;
   Byte flags (isAbstract, isTypeLevel);
   StringReference name;
   // An absolute path URI to the .dart file from which the class was created.
@@ -227,6 +230,7 @@
 type Field extends Member {
   Byte tag = 4;
   FileOffset fileOffset;
+  FileOffset fileEndOffset;
   Byte flags (isFinal, isConst, isStatic);
   Name name;
   // An absolute path URI to the .dart file from which the field was created.
@@ -239,6 +243,8 @@
 
 type Constructor extends Member {
   Byte tag = 5;
+  FileOffset fileOffset;
+  FileOffset fileEndOffset;
   Byte flags (isConst, isExternal);
   Name name;
   List<Expression> annotations;
@@ -258,6 +264,8 @@
 
 type Procedure extends Member {
   Byte tag = 6;
+  FileOffset fileOffset;
+  FileOffset fileEndOffset;
   Byte kind; // Index into the ProcedureKind enum above.
   Byte flags (isStatic, isAbstract, isExternal, isConst);
   Name name;
@@ -308,7 +316,10 @@
 
 type FunctionNode {
   // Note: there is no tag on FunctionNode.
+  FileOffset fileOffset;
+  FileOffset fileEndOffset;
   Byte asyncMarker; // Index into AsyncMarker above.
+  Byte debuggable; // 1 for yes, 0 for no
   List<TypeParameter> typeParameters;
   UInt requiredParameterCount;
   List<VariableDeclaration> positionalParameters;
@@ -349,22 +360,26 @@
 
 type VariableGet extends Expression {
   Byte tag = 20;
+  FileOffset fileOffset;
   VariableReference variable;
 }
 
 type SpecializedVariableGet extends Expression {
   Byte tag = 128 + N; // Where 0 <= N < 8.
   // Equivalent to a VariableGet with index N.
+  FileOffset fileOffset;
 }
 
 type VariableSet extends Expression {
   Byte tag = 21;
+  FileOffset fileOffset;
   VariableReference variable;
   Expression value;
 }
 
 type SpecializedVariableSet extends Expression {
   Byte tag = 136 + N; // Where 0 <= N < 8.
+  FileOffset fileOffset;
   Expression value;
   // Equivalent to VariableSet with index N.
 }
@@ -517,11 +532,13 @@
 
 type StringConcatenation extends Expression {
   Byte tag = 36;
+  FileOffset fileOffset;
   List<Expression> expressions;
 }
 
 type IsExpression extends Expression {
   Byte tag = 37;
+  FileOffset fileOffset;
   Expression operand;
   DartType type;
 }
@@ -612,6 +629,7 @@
 
 type MapLiteral extends Expression {
   Byte tag = 50;
+  FileOffset fileOffset;
   DartType keyType;
   DartType valueType;
   List<MapEntry> entries;
@@ -758,6 +776,7 @@
 
 type ReturnStatement extends Statement {
   Byte tag = 74;
+  FileOffset fileOffset;
   Option<Expression> expression;
 }
 
@@ -782,6 +801,7 @@
 
 type YieldStatement extends Statement {
   Byte tag = 77;
+  FileOffset fileOffset;
   Byte flags (isYieldStar);
   Expression expression;
 }
@@ -792,6 +812,7 @@
 }
 
 type VariableDeclaration {
+  FileOffset fileOffset;
   Byte flags (isFinal, isConst);
   // For named parameters, this is the parameter name.
   // For other variables, the name is cosmetic, may be empty,
@@ -808,6 +829,7 @@
 
 type FunctionDeclaration extends Statement {
   Byte tag = 79;
+  FileOffset fileOffset;
   // The variable binding the function.  The variable is in scope
   // within the function for use as a self-reference.
   // Some of the fields in the variable are redundant, but its presence here
diff --git a/pkg/kernel/lib/analyzer/ast_from_analyzer.dart b/pkg/kernel/lib/analyzer/ast_from_analyzer.dart
index 9847b59..06e0f5e 100644
--- a/pkg/kernel/lib/analyzer/ast_from_analyzer.dart
+++ b/pkg/kernel/lib/analyzer/ast_from_analyzer.dart
@@ -12,6 +12,7 @@
 import 'analyzer.dart';
 import 'loader.dart';
 import 'package:analyzer/analyzer.dart';
+import 'package:analyzer/dart/ast/standard_resolution_map.dart';
 import 'package:analyzer/src/generated/parser.dart';
 import 'package:analyzer/src/dart/element/member.dart';
 import 'package:analyzer/src/error/codes.dart';
@@ -294,8 +295,11 @@
 class TypeScope extends ReferenceScope {
   final Map<TypeParameterElement, ast.TypeParameter> localTypeParameters =
       <TypeParameterElement, ast.TypeParameter>{};
+  TypeAnnotationBuilder _typeBuilder;
 
-  TypeScope(ReferenceLevelLoader loader) : super(loader);
+  TypeScope(ReferenceLevelLoader loader) : super(loader) {
+    _typeBuilder = new TypeAnnotationBuilder(this);
+  }
 
   String get location => '?';
 
@@ -303,6 +307,11 @@
 
   ast.DartType get defaultTypeParameterBound => getRootClassReference().rawType;
 
+  ast.TypeParameter tryGetTypeParameterReference(TypeParameterElement element) {
+    return localTypeParameters[element] ??
+        loader.tryGetClassTypeParameter(element);
+  }
+
   ast.TypeParameter getTypeParameterReference(TypeParameterElement element) {
     return localTypeParameters[element] ??
         loader.tryGetClassTypeParameter(element) ??
@@ -318,7 +327,7 @@
   }
 
   ast.DartType buildType(DartType type) {
-    return new TypeAnnotationBuilder(this).buildFromDartType(type);
+    return _typeBuilder.buildFromDartType(type);
   }
 
   ast.Supertype buildSupertype(DartType type) {
@@ -338,11 +347,11 @@
   }
 
   ast.DartType buildTypeAnnotation(AstNode node) {
-    return new TypeAnnotationBuilder(this).build(node);
+    return _typeBuilder.build(node);
   }
 
   ast.DartType buildOptionalTypeAnnotation(AstNode node) {
-    return node == null ? null : new TypeAnnotationBuilder(this).build(node);
+    return node == null ? null : _typeBuilder.build(node);
   }
 
   ast.DartType getInferredType(Expression node) {
@@ -381,7 +390,8 @@
             .toList();
       }
       return new List<ast.DartType>.filled(
-          genericFunctionType.typeParameters.length, const ast.DynamicType());
+          genericFunctionType.typeParameters.length, const ast.DynamicType(),
+          growable: true);
     } else {
       return <ast.DartType>[];
     }
@@ -389,16 +399,17 @@
 
   List<ast.DartType> buildOptionalTypeArgumentList(TypeArgumentList node) {
     if (node == null) return null;
-    return new TypeAnnotationBuilder(this).buildList(node.arguments);
+    return _typeBuilder.buildList(node.arguments);
   }
 
   List<ast.DartType> buildTypeArgumentList(TypeArgumentList node) {
-    return new TypeAnnotationBuilder(this).buildList(node.arguments);
+    return _typeBuilder.buildList(node.arguments);
   }
 
-  List<ast.TypeParameter> buildOptionalTypeParameterList(
-      TypeParameterList node) {
+  List<ast.TypeParameter> buildOptionalTypeParameterList(TypeParameterList node,
+      {bool strongModeOnly: false}) {
     if (node == null) return <ast.TypeParameter>[];
+    if (strongModeOnly && !strongMode) return <ast.TypeParameter>[];
     return node.typeParameters.map(buildTypeParameter).toList();
   }
 
@@ -427,10 +438,12 @@
     // Initialize type parameters in two passes: put them into scope,
     // and compute the bounds afterwards while they are all in scope.
     var typeParameters = <ast.TypeParameter>[];
-    for (var parameter in element.typeParameters) {
-      var parameterNode = new ast.TypeParameter(parameter.name);
-      typeParameters.add(parameterNode);
-      localTypeParameters[parameter] = parameterNode;
+    if (strongMode || element is ConstructorElement) {
+      for (var parameter in element.typeParameters) {
+        var parameterNode = new ast.TypeParameter(parameter.name);
+        typeParameters.add(parameterNode);
+        localTypeParameters[parameter] = parameterNode;
+      }
     }
     for (int i = 0; i < typeParameters.length; ++i) {
       var parameter = element.typeParameters[i];
@@ -465,7 +478,7 @@
         positionalParameters: positional,
         namedParameters: named,
         requiredParameterCount: requiredParameterCount,
-        returnType: returnType);
+        returnType: returnType)..fileOffset = element.nameOffset;
   }
 }
 
@@ -541,7 +554,8 @@
           initializer: parameter is DefaultFormalParameter
               ? buildOptionalTopLevelExpression(parameter.defaultValue)
               : null,
-          type: buildType(parameter.element.type));
+          type: buildType(
+              resolutionMap.elementDeclaredByFormalParameter(parameter).type));
       switch (parameter.kind) {
         case ParameterKind.REQUIRED:
           positional.add(declaration);
@@ -558,6 +572,8 @@
           break;
       }
     }
+    int offset = formalParameters?.offset ?? body.offset;
+    int endOffset = body.endToken.offset;
     return new ast.FunctionNode(buildOptionalFunctionBody(body),
         typeParameters: typeParameters,
         positionalParameters: positional,
@@ -567,7 +583,9 @@
             inferredReturnType ??
             const ast.DynamicType(),
         asyncMarker: getAsyncMarker(
-            isAsync: body.isAsynchronous, isStar: body.isGenerator));
+            isAsync: body.isAsynchronous, isStar: body.isGenerator))
+      ..fileOffset = offset
+      ..fileEndOffset = endOffset;
   }
 
   ast.Expression buildOptionalTopLevelExpression(Expression node) {
@@ -628,7 +646,8 @@
   ast.VariableDeclaration getVariableReference(LocalElement element) {
     return localVariables.putIfAbsent(element, () {
       return new ast.VariableDeclaration(element.name,
-          isFinal: isFinal(element), isConst: isConst(element));
+          isFinal: isFinal(element),
+          isConst: isConst(element))..fileOffset = element.nameOffset;
     });
   }
 
@@ -735,11 +754,14 @@
     return new ast.Throw(new ast.StringLiteral(message));
   }
 
+  ast.Expression buildThrowCompileTimeErrorFromCode(ErrorCode code,
+      [List arguments]) {
+    return buildThrowCompileTimeError(makeErrorMessage(code, arguments));
+  }
+
   static final RegExp _errorMessagePattern = new RegExp(r'\{(\d+)\}');
 
-  /// Throws an exception that will be caught at the function level, to replace
-  /// the entire function with a throw.
-  emitCompileTimeError(ErrorCode error, [List arguments]) {
+  String makeErrorMessage(ErrorCode error, [List arguments]) {
     String message = error.message;
     if (arguments != null) {
       message = message.replaceAllMapped(_errorMessagePattern, (m) {
@@ -748,7 +770,13 @@
         return arguments[index];
       });
     }
-    throw new _CompilationError(message);
+    return message;
+  }
+
+  /// Throws an exception that will be caught at the function level, to replace
+  /// the entire function with a throw.
+  emitCompileTimeError(ErrorCode error, [List arguments]) {
+    throw new _CompilationError(makeErrorMessage(error, arguments));
   }
 
   ast.Expression buildThrowAbstractClassInstantiationError(String name) {
@@ -887,21 +915,36 @@
 
 class StatementBuilder extends GeneralizingAstVisitor<ast.Statement> {
   final ExpressionScope scope;
-  final LabelStack breakStack, continueStack;
+  LabelStack breakStack, continueStack;
 
   StatementBuilder(this.scope, [this.breakStack, this.continueStack]);
 
   ast.Statement build(Statement node) {
-    return node.accept(this);
+    ast.Statement result = node.accept(this);
+    result.fileOffset = _getOffset(node);
+    return result;
   }
 
   ast.Statement buildOptional(Statement node) {
-    return node?.accept(this);
+    ast.Statement result = node?.accept(this);
+    result?.fileOffset = _getOffset(node);
+    return result;
+  }
+
+  int _getOffset(AstNode node) {
+    return node.offset;
   }
 
   ast.Statement buildInScope(
       Statement node, LabelStack breakNode, LabelStack continueNode) {
-    return new StatementBuilder(scope, breakNode, continueNode).build(node);
+    var oldBreak = this.breakStack;
+    var oldContinue = this.continueStack;
+    breakStack = breakNode;
+    continueStack = continueNode;
+    var result = build(node);
+    this.breakStack = oldBreak;
+    this.continueStack = oldContinue;
+    return result;
   }
 
   void buildBlockMember(Statement node, List<ast.Statement> output) {
@@ -1086,11 +1129,14 @@
       currentCase = null;
     }
     // Now that the label environment is set up, build the bodies.
-    var innerBuilder = new StatementBuilder(scope, breakNode, continueNode);
+    var oldBreak = this.breakStack;
+    var oldContinue = this.continueStack;
+    this.breakStack = breakNode;
+    this.continueStack = continueNode;
     for (int i = 0; i < cases.length; ++i) {
       var blockNodes = <ast.Statement>[];
       for (var statement in bodies[i]) {
-        innerBuilder.buildBlockMember(statement, blockNodes);
+        buildBlockMember(statement, blockNodes);
       }
       if (blockNodes.isEmpty || !isBreakingStatement(blockNodes.last)) {
         if (i < cases.length - 1) {
@@ -1105,7 +1151,7 @@
       cases[i].body = new ast.Block(blockNodes)..parent = cases[i];
     }
     // Unwind the stack of case labels and bind their jumps to the case target.
-    while (continueNode != continueStack) {
+    while (continueNode != oldContinue) {
       for (var jump in continueNode.jumps) {
         (jump as ast.ContinueSwitchStatement).target =
             labelToNode[continueNode.labels.first];
@@ -1114,6 +1160,8 @@
     }
     var expression = scope.buildExpression(node.expression);
     var result = new ast.SwitchStatement(expression, cases);
+    this.breakStack = oldBreak;
+    this.continueStack = oldContinue;
     return makeBreakTarget(result, breakNode);
   }
 
@@ -1151,6 +1199,28 @@
     return loop;
   }
 
+  DartType iterableElementType(DartType iterable) {
+    if (iterable is InterfaceType) {
+      var iterator = iterable.lookUpInheritedGetter('iterator')?.returnType;
+      if (iterator is InterfaceType) {
+        return iterator.lookUpInheritedGetter('current')?.returnType;
+      }
+    }
+    return null;
+  }
+
+  DartType streamElementType(DartType stream) {
+    if (stream is InterfaceType) {
+      var class_ = stream.element;
+      if (class_.library.isDartAsync &&
+          class_.name == 'Stream' &&
+          stream.typeArguments.length == 1) {
+        return stream.typeArguments[0];
+      }
+    }
+    return null;
+  }
+
   ast.Statement visitForEachStatement(ForEachStatement node) {
     ast.VariableDeclaration variable;
     Accessor leftHand;
@@ -1160,8 +1230,16 @@
           type: scope.buildOptionalTypeAnnotation(loopVariable.type));
     } else if (node.identifier != null) {
       leftHand = scope.buildLeftHandValue(node.identifier);
-      // TODO: In strong mode, set variable type based on iterable type.
       variable = new ast.VariableDeclaration(null, isFinal: true);
+      if (scope.strongMode) {
+        var containerType = node.iterable.staticType;
+        DartType elementType = node.awaitKeyword != null
+            ? streamElementType(containerType)
+            : iterableElementType(containerType);
+        if (elementType != null) {
+          variable.type = scope.buildType(elementType);
+        }
+      }
     }
     var breakNode = new LabelStack.unlabeled(breakStack);
     var continueNode = new LabelStack.unlabeled(continueStack);
@@ -1188,7 +1266,7 @@
         variable,
         scope.buildExpression(node.iterable),
         makeBreakTarget(body, continueNode),
-        isAsync: node.awaitKeyword != null);
+        isAsync: node.awaitKeyword != null)..fileOffset = node.offset;
     return makeBreakTarget(loop, breakNode);
   }
 
@@ -1259,13 +1337,14 @@
     var declaration = node.functionDeclaration;
     var expression = declaration.functionExpression;
     LocalElement element = declaration.element as dynamic; // Cross cast.
-    // TODO: Set a function type on the variable.
     return new ast.FunctionDeclaration(
-        scope.makeVariableDeclaration(element),
+        scope.makeVariableDeclaration(element,
+            type: scope.buildType(declaration.element.type)),
         scope.buildFunctionNode(expression.parameters, expression.body,
-            typeParameters:
-                scope.buildOptionalTypeParameterList(expression.typeParameters),
-            returnType: declaration.returnType));
+            typeParameters: scope.buildOptionalTypeParameterList(
+                expression.typeParameters,
+                strongModeOnly: true),
+            returnType: declaration.returnType))..fileOffset = node.offset;
   }
 
   @override
@@ -1277,8 +1356,8 @@
 class ExpressionBuilder
     extends GeneralizingAstVisitor /* <ast.Expression | Accessor> */ {
   final ExpressionScope scope;
-  final ast.VariableDeclaration cascadeReceiver;
-  ExpressionBuilder(this.scope, [this.cascadeReceiver]);
+  ast.VariableDeclaration cascadeReceiver;
+  ExpressionBuilder(this.scope);
 
   ast.Expression build(Expression node) {
     var result = node.accept(this);
@@ -1299,6 +1378,14 @@
       return node.identifier.offset;
     } else if (node is AssignmentExpression) {
       return _getOffset(node.leftHandSide);
+    } else if (node is PropertyAccess) {
+      return node.propertyName.offset;
+    } else if (node is IsExpression) {
+      return node.isOperator.offset;
+    } else if (node is StringLiteral) {
+      // Use a catch-all for StringInterpolation and AdjacentStrings:
+      // the debugger stops at the end.
+      return node.end;
     }
     return node.offset;
   }
@@ -1332,6 +1419,7 @@
       // Cut off the trailing '='.
       var name = new ast.Name(operator.substring(0, operator.length - 1));
       return leftHand.buildCompoundAssignment(name, rightHand,
+          offset: node.offset,
           voidContext: voidContext,
           interfaceTarget: scope.resolveInterfaceMethod(node.staticElement));
     }
@@ -1355,7 +1443,7 @@
       ast.Expression leftOperand = build(node.leftOperand);
       if (leftOperand is ast.VariableGet) {
         return new ast.ConditionalExpression(
-            buildIsNull(leftOperand),
+            buildIsNull(leftOperand, offset: node.leftOperand.offset),
             build(node.rightOperand),
             new ast.VariableGet(leftOperand.variable),
             scope.getInferredType(node));
@@ -1364,7 +1452,8 @@
         return new ast.Let(
             variable,
             new ast.ConditionalExpression(
-                buildIsNull(new ast.VariableGet(variable)),
+                buildIsNull(new ast.VariableGet(variable),
+                    offset: leftOperand.fileOffset),
                 build(node.rightOperand),
                 new ast.VariableGet(variable),
                 scope.getInferredType(node)));
@@ -1431,12 +1520,14 @@
     // might be reassigned in one of the cascade sections.
     var receiverVariable = new ast.VariableDeclaration.forValue(receiver,
         type: scope.getInferredType(node.target));
-    var inner = new ExpressionBuilder(scope, receiverVariable);
+    var oldReceiver = this.cascadeReceiver;
+    cascadeReceiver = receiverVariable;
     ast.Expression result = new ast.VariableGet(receiverVariable);
     for (var section in node.cascadeSections.reversed) {
-      var dummy = new ast.VariableDeclaration.forValue(inner.build(section));
+      var dummy = new ast.VariableDeclaration.forValue(build(section));
       result = new ast.Let(dummy, result);
     }
+    cascadeReceiver = oldReceiver;
     return new ast.Let(receiverVariable, result);
   }
 
@@ -1456,8 +1547,9 @@
   ast.Expression visitFunctionExpression(FunctionExpression node) {
     return new ast.FunctionExpression(scope.buildFunctionNode(
         node.parameters, node.body,
-        typeParameters:
-            scope.buildOptionalTypeParameterList(node.typeParameters),
+        typeParameters: scope.buildOptionalTypeParameterList(
+            node.typeParameters,
+            strongModeOnly: true),
         inferredReturnType: scope.getInferredReturnType(node)));
   }
 
@@ -1487,10 +1579,14 @@
   }
 
   ast.Arguments buildArgumentsForInvocation(InvocationExpression node) {
-    return buildArguments(node.argumentList,
-        explicitTypeArguments: node.typeArguments,
-        inferTypeArguments: () =>
-            scope.getInferredInvocationTypeArguments(node));
+    if (scope.strongMode) {
+      return buildArguments(node.argumentList,
+          explicitTypeArguments: node.typeArguments,
+          inferTypeArguments: () =>
+              scope.getInferredInvocationTypeArguments(node));
+    } else {
+      return buildArguments(node.argumentList);
+    }
   }
 
   static final ast.Name callName = new ast.Name('call');
@@ -1606,6 +1702,9 @@
         if (isTopLevelFunction(function)) {
           return scope.staticAccess(node.name, function);
         }
+        if (function == function.library.loadLibraryFunction) {
+          return scope.unsupportedFeature('Deferred loading');
+        }
         return new VariableAccessor(scope.getVariableReference(function));
 
       case ElementKind.LOCAL_VARIABLE:
@@ -1677,6 +1776,15 @@
     return element;
   }
 
+  /// Forces the list of type arguments to have the specified length. If the
+  /// length was changed, all type arguments are changed to `dynamic`.
+  void _coerceTypeArgumentArity(List<ast.DartType> typeArguments, int arity) {
+    if (typeArguments.length != arity) {
+      typeArguments.length = arity;
+      typeArguments.fillRange(0, arity, const ast.DynamicType());
+    }
+  }
+
   ast.Expression visitInstanceCreationExpression(
       InstanceCreationExpression node) {
     ConstructorElement element = node.staticElement;
@@ -1729,6 +1837,8 @@
     if (classElement.isEnum) {
       return scope.emitCompileTimeError(CompileTimeErrorCode.INSTANTIATE_ENUM);
     }
+    _coerceTypeArgumentArity(
+        arguments.types, classElement.typeParameters.length);
     if (element.isFactory) {
       ast.Member target = scope.resolveConcreteMethod(element);
       if (target is ast.Procedure &&
@@ -1855,7 +1965,7 @@
                   new ast.VariableGet(receiver),
                   scope.buildName(node.methodName),
                   buildArgumentsForInvocation(node),
-                  element),
+                  element)..fileOffset = node.methodName.offset,
               scope.buildType(node.staticType)));
     } else {
       return buildDecomposableMethodInvocation(
@@ -1890,6 +2000,7 @@
         var leftHand = buildLeftHandValue(node.operand);
         var binaryOperator = new ast.Name(operator[0]);
         return leftHand.buildPostfixIncrement(binaryOperator,
+            offset: node.offset,
             voidContext: isInVoidContext(node),
             interfaceTarget: scope.resolveInterfaceMethod(node.staticElement));
 
@@ -1923,6 +2034,7 @@
         var leftHand = buildLeftHandValue(node.operand);
         var binaryOperator = new ast.Name(operator[0]);
         return leftHand.buildPrefixIncrement(binaryOperator,
+            offset: node.offset,
             interfaceTarget: scope.resolveInterfaceMethod(node.staticElement));
 
       default:
@@ -2067,6 +2179,12 @@
     return convertType(type, null);
   }
 
+  /// True if [parameter] should not be reified, because spec mode does not
+  /// currently reify generic method type parameters.
+  bool isUnreifiedTypeParameter(TypeParameterElement parameter) {
+    return !scope.strongMode && parameter.enclosingElement is! ClassElement;
+  }
+
   /// Converts [type] to an [ast.DartType], while replacing unbound type
   /// variables with 'dynamic'.
   ///
@@ -2076,8 +2194,19 @@
   ast.DartType convertType(
       DartType type, List<TypeParameterElement> boundVariables) {
     if (type is TypeParameterType) {
+      if (isUnreifiedTypeParameter(type.element)) {
+        return const ast.DynamicType();
+      }
       if (boundVariables == null || boundVariables.contains(type)) {
-        var typeParameter = scope.getTypeParameterReference(type.element);
+        var typeParameter = scope.tryGetTypeParameterReference(type.element);
+        if (typeParameter == null) {
+          // The analyzer sometimes gives us a type parameter that was not
+          // bound anywhere.  Make sure we do not emit a dangling reference.
+          if (type.element.bound != null) {
+            return convertType(type.element.bound, []);
+          }
+          return const ast.DynamicType();
+        }
         if (!scope.allowClassTypeParameters &&
             typeParameter.parent is ast.Class) {
           return const ast.InvalidType();
@@ -2089,7 +2218,7 @@
     } else if (type is InterfaceType) {
       var classNode = scope.getClassReference(type.element);
       if (type.typeArguments.length == 0) {
-        return new ast.InterfaceType(classNode);
+        return classNode.rawType;
       }
       if (type.typeArguments.length != classNode.typeParameters.length) {
         log.warning('Type parameter arity error in $type');
@@ -2169,7 +2298,7 @@
     Element element = node.staticElement;
     switch (ElementKind.of(element)) {
       case ElementKind.CLASS:
-        return new ast.InterfaceType(scope.getClassReference(element));
+        return scope.getClassReference(element).rawType;
 
       case ElementKind.DYNAMIC:
         return const ast.DynamicType();
@@ -2184,6 +2313,9 @@
             typeParameter.parent is ast.Class) {
           return const ast.InvalidType();
         }
+        if (isUnreifiedTypeParameter(element)) {
+          return const ast.DynamicType();
+        }
         return new ast.TypeParameterType(typeParameter);
 
       case ElementKind.COMPILATION_UNIT:
@@ -2302,7 +2434,8 @@
     currentClass.name = element.name;
     currentClass.supertype = scope.getRootClassReference().asRawSupertype;
     currentClass.constructors.add(
-        new ast.Constructor(new ast.FunctionNode(new ast.InvalidStatement())));
+        new ast.Constructor(new ast.FunctionNode(new ast.InvalidStatement()))
+          ..fileOffset = element.nameOffset);
   }
 
   void addAnnotations(List<Annotation> annotations) {
@@ -2324,7 +2457,10 @@
   bool _isIgnoredMember(ClassMember node) {
     return node is ConstructorDeclaration &&
         node.factoryKeyword != null &&
-        node.element.redirectedConstructor != null;
+        resolutionMap
+                .elementDeclaredByConstructorDeclaration(node)
+                .redirectedConstructor !=
+            null;
   }
 
   visitClassDeclaration(ClassDeclaration node) {
@@ -2433,40 +2569,59 @@
   visitEnumDeclaration(EnumDeclaration node) {
     addAnnotations(node.metadata);
     ast.Class classNode = currentClass;
-    var intType =
-        new ast.InterfaceType(scope.loader.getCoreClassReference('int'));
+
+    var intType = scope.loader.getCoreClassReference('int').rawType;
     var indexFieldElement = element.fields.firstWhere(_isIndexField);
     ast.Field indexField = scope.getMemberReference(indexFieldElement);
     indexField.type = intType;
     classNode.addMember(indexField);
-    var parameter = new ast.VariableDeclaration('index', type: intType);
+
+    var stringType = scope.loader.getCoreClassReference('String').rawType;
+    ast.Field nameField = new ast.Field(
+        new ast.Name('_name', scope.currentLibrary),
+        type: stringType,
+        isFinal: true,
+        fileUri: classNode.fileUri);
+    classNode.addMember(nameField);
+
+    var indexParameter = new ast.VariableDeclaration('index', type: intType);
+    var nameParameter = new ast.VariableDeclaration('name', type: stringType);
     var function = new ast.FunctionNode(new ast.EmptyStatement(),
-        positionalParameters: [parameter]);
+        positionalParameters: [indexParameter, nameParameter]);
     var superConstructor = scope.loader.getRootClassConstructorReference();
     var constructor = new ast.Constructor(function,
         name: new ast.Name(''),
         isConst: true,
         initializers: [
-          new ast.FieldInitializer(indexField, new ast.VariableGet(parameter)),
+          new ast.FieldInitializer(
+              indexField, new ast.VariableGet(indexParameter)),
+          new ast.FieldInitializer(
+              nameField, new ast.VariableGet(nameParameter)),
           new ast.SuperInitializer(superConstructor, new ast.Arguments.empty())
-        ]);
+        ])..fileOffset = element.nameOffset;
     classNode.addMember(constructor);
+
     int index = 0;
     var enumConstantFields = <ast.Field>[];
     for (var constant in node.constants) {
       ast.Field field = scope.getMemberReference(constant.element);
       field.initializer = new ast.ConstructorInvocation(
-          constructor, new ast.Arguments([new ast.IntLiteral(index)]),
+          constructor,
+          new ast.Arguments([
+            new ast.IntLiteral(index),
+            new ast.StringLiteral('${classNode.name}.${field.name.name}')
+          ]),
           isConst: true)..parent = field;
-      field.type = new ast.InterfaceType(classNode);
+      field.type = classNode.rawType;
       classNode.addMember(field);
       ++index;
       enumConstantFields.add(field);
     }
+
     // Add the 'values' field.
     var valuesFieldElement = element.fields.firstWhere(_isValuesField);
     ast.Field valuesField = scope.getMemberReference(valuesFieldElement);
-    var enumType = new ast.InterfaceType(classNode);
+    var enumType = classNode.rawType;
     valuesField.type = new ast.InterfaceType(
         scope.loader.getCoreClassReference('List'), <ast.DartType>[enumType]);
     valuesField.initializer = new ast.ListLiteral(
@@ -2474,7 +2629,15 @@
         isConst: true,
         typeArgument: enumType)..parent = valuesField;
     classNode.addMember(valuesField);
-    // TODO: Add the toString method.
+
+    // Add the 'toString()' method.
+    var body = new ast.ReturnStatement(
+        new ast.DirectPropertyGet(new ast.ThisExpression(), nameField));
+    var toStringFunction = new ast.FunctionNode(body, returnType: stringType);
+    var toStringMethod = new ast.Procedure(
+        new ast.Name('toString'), ast.ProcedureKind.Method, toStringFunction,
+        fileUri: classNode.fileUri);
+    classNode.addMember(toStringMethod);
   }
 
   visitClassTypeAlias(ClassTypeAlias node) {
@@ -2525,6 +2688,7 @@
 
   void build(AstNode node) {
     if (node != null) {
+      currentMember.fileEndOffset = node.endToken.offset;
       node.accept(this);
     } else {
       buildBrokenMember();
@@ -2574,6 +2738,10 @@
   }
 
   void buildGenerativeConstructor(ConstructorDeclaration node) {
+    if (currentMember is! ast.Constructor) {
+      buildBrokenMember();
+      return;
+    }
     addAnnotations(node.metadata);
     ast.Constructor constructor = currentMember;
     constructor.function = scope.buildFunctionNode(node.parameters, node.body,
@@ -2585,9 +2753,18 @@
     }
     for (var parameter in node.parameters.parameterElements) {
       if (parameter is FieldFormalParameterElement) {
-        var initializer = new ast.FieldInitializer(
-            scope.getMemberReference(parameter.field),
-            new ast.VariableGet(scope.getVariableReference(parameter)));
+        ast.Initializer initializer;
+        if (parameter.field == null) {
+          initializer = new ast.LocalInitializer(
+              new ast.VariableDeclaration.forValue(scope
+                  .buildThrowCompileTimeErrorFromCode(
+                      CompileTimeErrorCode.INITIALIZER_FOR_NON_EXISTENT_FIELD,
+                      [parameter.name])));
+        } else {
+          initializer = new ast.FieldInitializer(
+              scope.getMemberReference(parameter.field),
+              new ast.VariableGet(scope.getVariableReference(parameter)));
+        }
         constructor.initializers.add(initializer..parent = constructor);
       }
     }
@@ -2599,7 +2776,9 @@
         hasExplicitConstructorCall = true;
       }
     }
-    ClassElement classElement = node.element.enclosingElement;
+    ClassElement classElement = resolutionMap
+        .elementDeclaredByConstructorDeclaration(node)
+        .enclosingElement;
     if (classElement.supertype != null && !hasExplicitConstructorCall) {
       ConstructorElement targetElement =
           scope.findDefaultConstructor(classElement.supertype.element);
@@ -2615,24 +2794,39 @@
   }
 
   void buildFactoryConstructor(ConstructorDeclaration node) {
+    if (currentMember is! ast.Procedure) {
+      buildBrokenMember();
+      return;
+    }
     addAnnotations(node.metadata);
     ast.Procedure procedure = currentMember;
-    ClassElement classElement = node.element.enclosingElement;
+    ClassElement classElement = resolutionMap
+        .elementDeclaredByConstructorDeclaration(node)
+        .enclosingElement;
     ast.Class classNode = procedure.enclosingClass;
     var types = getFreshTypeParameters(classNode.typeParameters);
     for (int i = 0; i < classElement.typeParameters.length; ++i) {
       scope.localTypeParameters[classElement.typeParameters[i]] =
           types.freshTypeParameters[i];
     }
+    var inferredReturnType = types.freshTypeParameters.isEmpty
+        ? classNode.rawType
+        : new ast.InterfaceType(
+            classNode,
+            types.freshTypeParameters
+                .map(makeTypeParameterType)
+                .toList(growable: false));
     var function = scope.buildFunctionNode(node.parameters, node.body,
         typeParameters: types.freshTypeParameters,
-        inferredReturnType: new ast.InterfaceType(classNode,
-            types.freshTypeParameters.map(makeTypeParameterType).toList()));
+        inferredReturnType: inferredReturnType);
     procedure.function = function..parent = procedure;
     handleNativeBody(node.body);
     if (node.redirectedConstructor != null) {
       // Redirecting factories with resolved targets don't show up here.
-      assert(node.element.redirectedConstructor == null);
+      assert(resolutionMap
+              .elementDeclaredByConstructorDeclaration(node)
+              .redirectedConstructor ==
+          null);
       var function = procedure.function;
       var name = node.redirectedConstructor.type.name.name;
       if (node.redirectedConstructor.name != null) {
@@ -2651,17 +2845,19 @@
     ast.Procedure procedure = currentMember;
     procedure.function = scope.buildFunctionNode(node.parameters, node.body,
         returnType: node.returnType,
-        inferredReturnType: scope.buildType(node.element.returnType),
-        typeParameters:
-            scope.buildOptionalTypeParameterList(node.typeParameters))
-      ..parent = procedure;
+        inferredReturnType: scope.buildType(
+            resolutionMap.elementDeclaredByMethodDeclaration(node).returnType),
+        typeParameters: scope.buildOptionalTypeParameterList(
+            node.typeParameters,
+            strongModeOnly: true))..parent = procedure;
     handleNativeBody(node.body);
   }
 
   visitVariableDeclaration(VariableDeclaration node) {
     addAnnotations(node.metadata);
     ast.Field field = currentMember;
-    field.type = scope.buildType(node.element.type);
+    field.type = scope.buildType(
+        resolutionMap.elementDeclaredByVariableDeclaration(node).type);
     if (node.initializer != null) {
       field.initializer = scope.buildTopLevelExpression(node.initializer)
         ..parent = field;
@@ -2673,14 +2869,15 @@
   }
 
   visitFunctionDeclaration(FunctionDeclaration node) {
+    addAnnotations(node.metadata);
     var function = node.functionExpression;
     ast.Procedure procedure = currentMember;
     procedure.function = scope.buildFunctionNode(
         function.parameters, function.body,
         returnType: node.returnType,
-        typeParameters:
-            scope.buildOptionalTypeParameterList(function.typeParameters))
-      ..parent = procedure;
+        typeParameters: scope.buildOptionalTypeParameterList(
+            function.typeParameters,
+            strongModeOnly: true))..parent = procedure;
     handleNativeBody(function.body);
   }
 
diff --git a/pkg/kernel/lib/analyzer/loader.dart b/pkg/kernel/lib/analyzer/loader.dart
index 1591bcf..d3743af 100644
--- a/pkg/kernel/lib/analyzer/loader.dart
+++ b/pkg/kernel/lib/analyzer/loader.dart
@@ -16,6 +16,8 @@
 import 'package:analyzer/src/generated/parser.dart';
 import 'package:analyzer/src/generated/sdk.dart';
 import 'package:analyzer/src/generated/source_io.dart';
+import 'package:analyzer/src/summary/summary_sdk.dart';
+import 'package:kernel/application_root.dart';
 import 'package:package_config/discovery.dart';
 import 'package:package_config/packages.dart';
 
@@ -33,22 +35,38 @@
 
   /// True if the Dart SDK should be loaded in strong mode.
   bool strongModeSdk;
+
+  /// Path to the sdk sources, ignored if sdkSummary is provided.
   String sdk;
+
+  /// Path to a summary of the sdk sources.
+  String sdkSummary;
+
+  /// Path to the `.packages` file.
   String packagePath;
+
+  /// Root used to relativize app file-urls, making them machine agnostic.
+  ApplicationRoot applicationRoot;
+
   Map<Uri, Uri> customUriMappings;
+
+  /// Environment definitions provided via `-Dkey=value`.
   Map<String, String> declaredVariables;
 
   DartOptions(
       {bool strongMode: false,
       bool strongModeSdk,
       this.sdk,
+      this.sdkSummary,
       this.packagePath,
+      ApplicationRoot applicationRoot,
       Map<Uri, Uri> customUriMappings,
       Map<String, String> declaredVariables})
       : this.customUriMappings = customUriMappings ?? <Uri, Uri>{},
         this.declaredVariables = declaredVariables ?? <String, String>{},
         this.strongMode = strongMode,
-        this.strongModeSdk = strongModeSdk ?? strongMode;
+        this.strongModeSdk = strongModeSdk ?? strongMode,
+        this.applicationRoot = applicationRoot ?? new ApplicationRoot.none();
 }
 
 abstract class ReferenceLevelLoader {
@@ -68,6 +86,7 @@
 
 class DartLoader implements ReferenceLevelLoader {
   final Repository repository;
+  final ApplicationRoot applicationRoot;
   final Bimap<ClassElement, ast.Class> _classes =
       new Bimap<ClassElement, ast.Class>();
   final Bimap<Element, ast.Member> _members = new Bimap<Element, ast.Member>();
@@ -89,26 +108,24 @@
   bool get strongMode => context.analysisOptions.strongMode;
 
   DartLoader(this.repository, DartOptions options, Packages packages,
-      {DartSdk dartSdk})
-      : this.context = createContext(options, packages, dartSdk: dartSdk);
-
-  LibraryElement getLibraryElement(ast.Library node) {
-    return context
-        .getLibraryElement(context.sourceFactory.forUri2(node.importUri));
-  }
+      {DartSdk dartSdk, AnalysisContext context})
+      : this.context =
+            context ?? createContext(options, packages, dartSdk: dartSdk),
+        this.applicationRoot = options.applicationRoot;
 
   String getLibraryName(LibraryElement element) {
     return element.name.isEmpty ? null : element.name;
   }
 
   ast.Library getLibraryReference(LibraryElement element) {
-    return repository.getLibraryReference(element.source.uri)
+    var uri = applicationRoot.relativeUri(element.source.uri);
+    return repository.getLibraryReference(uri)
       ..name ??= getLibraryName(element)
-      ..fileUri = "file://${element.source.fullName}";
+      ..fileUri = '${element.source.uri}';
   }
 
-  void _buildTopLevelMember(ast.Member member, Element element) {
-    var astNode = element.computeNode();
+  void _buildTopLevelMember(
+      ast.Member member, Element element, Declaration astNode) {
     assert(member.parent != null);
     new MemberBodyBuilder(this, member, element).build(astNode);
   }
@@ -122,45 +139,56 @@
     return _libraryBeingLoaded == element;
   }
 
-  void _buildLibraryBody(LibraryElement element, ast.Library library) {
+  void _buildLibraryBody(LibraryElement element, ast.Library library,
+      List<CompilationUnit> units) {
     assert(_libraryBeingLoaded == null);
     _libraryBeingLoaded = element;
     var classes = <ast.Class>[];
     var procedures = <ast.Procedure>[];
     var fields = <ast.Field>[];
-    void loadClass(ClassElement classElement) {
-      var node = getClassReference(classElement);
-      promoteToBodyLevel(node);
+
+    void loadClass(NamedCompilationUnitMember declaration) {
+      // [declaration] can be a ClassDeclaration, EnumDeclaration, or a
+      // ClassTypeAlias.
+      ClassElement element = declaration.element;
+      var node = getClassReference(element);
+      promoteToBodyLevel(node, element, declaration);
       classes.add(node);
     }
 
-    void loadProcedure(Element memberElement) {
-      var node = getMemberReference(memberElement);
-      _buildTopLevelMember(node, memberElement);
+    void loadProcedure(FunctionDeclaration declaration) {
+      var element = declaration.element;
+      var node = getMemberReference(element);
+      _buildTopLevelMember(node, element, declaration);
       procedures.add(node);
     }
 
-    void loadField(Element memberElement) {
-      var node = getMemberReference(memberElement);
-      _buildTopLevelMember(node, memberElement);
-      fields.add(node);
+    void loadField(TopLevelVariableDeclaration declaration) {
+      for (var field in declaration.variables.variables) {
+        var element = field.element;
+        // Ignore fields inserted through error recovery.
+        if (element.name == '') continue;
+        var node = getMemberReference(element);
+        _buildTopLevelMember(node, element, field);
+        fields.add(node);
+      }
     }
 
-    for (var unit in element.units) {
-      unit.types.forEach(loadClass);
-      unit.enums.forEach(loadClass);
-      for (var accessor in unit.accessors) {
-        if (!accessor.isSynthetic) {
-          loadProcedure(accessor);
-        }
-      }
-      for (var function in unit.functions) {
-        loadProcedure(function);
-      }
-      for (var field in unit.topLevelVariables) {
-        // Ignore fields inserted through error recovery.
-        if (!field.isSynthetic && field.name != '') {
-          loadField(field);
+    for (var unit in units) {
+      for (CompilationUnitMember declaration in unit.declarations) {
+        if (declaration is ClassDeclaration ||
+            declaration is EnumDeclaration ||
+            declaration is ClassTypeAlias) {
+          loadClass(declaration);
+        } else if (declaration is FunctionDeclaration) {
+          loadProcedure(declaration);
+        } else if (declaration is TopLevelVariableDeclaration) {
+          loadField(declaration);
+        } else if (declaration is FunctionTypeAlias) {
+          // Nothing to do. Typedefs are handled lazily while constructing type
+          // references.
+        } else {
+          throw "unexpected node: ${declaration.runtimeType} $declaration";
         }
       }
     }
@@ -241,7 +269,7 @@
     _classes[element] = classNode = new ast.Class(
         name: element.name,
         isAbstract: element.isAbstract,
-        fileUri: "file://${element.source.fullName}");
+        fileUri: '${element.source.uri}')..fileOffset = element.nameOffset;
     classNode.level = ast.ClassLevel.Temporary;
     var library = getLibraryReference(element.library);
     library.addClass(classNode);
@@ -291,6 +319,9 @@
           // Use a shared mixin application class for this library.
           var mixinClass = getSharedMixinApplicationClass(
               scope.currentLibrary, supertype.classNode, mixinType.classNode);
+          if (mixinClass.fileOffset < 0) {
+            mixinClass.fileOffset = element.nameOffset;
+          }
           supertype = new ast.Supertype(
               mixinClass,
               supertype.typeArguments.length > mixinType.typeArguments.length
@@ -305,7 +336,8 @@
               isAbstract: true,
               typeParameters: freshParameters.freshTypeParameters,
               supertype: freshParameters.substituteSuper(supertype),
-              mixedInType: freshParameters.substituteSuper(mixinType));
+              mixedInType: freshParameters.substituteSuper(mixinType),
+              fileUri: classNode.fileUri)..fileOffset = element.nameOffset;
           mixinClass.level = ast.ClassLevel.Type;
           supertype = new ast.Supertype(mixinClass,
               classNode.typeParameters.map(makeTypeParameterType).toList());
@@ -350,13 +382,11 @@
     }
   }
 
-  void promoteToBodyLevel(ast.Class classNode) {
+  void promoteToBodyLevel(ast.Class classNode, ClassElement element,
+      NamedCompilationUnitMember astNode) {
     if (classNode.level == ast.ClassLevel.Body) return;
     promoteToHierarchyLevel(classNode);
     classNode.level = ast.ClassLevel.Body;
-    var element = getClassElement(classNode);
-    if (element == null) return;
-    var astNode = element.computeNode();
     // Clear out the member references that were put in the class.
     // The AST builder will load them all put back in the right order.
     classNode..fields.clear()..procedures.clear()..constructors.clear();
@@ -372,11 +402,13 @@
   }
 
   ast.Member getMemberReference(Element element) {
+    assert(element != null);
     assert(element is! Member); // Use the "base element".
     return _members[element] ??= _buildMemberReference(element);
   }
 
   ast.Member _buildMemberReference(Element element) {
+    assert(element != null);
     var node = _buildOrphanedMemberReference(element);
     // Set the parent pointer and store it in the enclosing class or library.
     // If the enclosing library is being built from the AST, do not add the
@@ -399,6 +431,7 @@
   }
 
   ast.Member _buildOrphanedMemberReference(Element element) {
+    assert(element != null);
     ClassElement classElement = element.enclosingElement is ClassElement
         ? element.enclosingElement
         : null;
@@ -420,12 +453,14 @@
               isStatic: true,
               isExternal: constructor.isExternal,
               isConst: constructor.isConst,
-              fileUri: "file://${element.source.fullName}");
+              fileUri: '${element.source.uri}')
+            ..fileOffset = element.nameOffset;
         }
         return new ast.Constructor(scope.buildFunctionInterface(constructor),
             name: _nameOfMember(element),
             isConst: constructor.isConst,
-            isExternal: constructor.isExternal);
+            isExternal: constructor.isExternal)
+          ..fileOffset = element.nameOffset;
 
       case ElementKind.FIELD:
       case ElementKind.TOP_LEVEL_VARIABLE:
@@ -435,8 +470,7 @@
             isFinal: variable.isFinal,
             isConst: variable.isConst,
             type: scope.buildType(variable.type),
-            fileUri: "file://${element.source.fullName}")
-          ..fileOffset = element.nameOffset;
+            fileUri: '${element.source.uri}')..fileOffset = element.nameOffset;
 
       case ElementKind.METHOD:
       case ElementKind.GETTER:
@@ -455,7 +489,7 @@
             isAbstract: executable.isAbstract,
             isStatic: executable.isStatic,
             isExternal: executable.isExternal,
-            fileUri: "file://${element.source.fullName}");
+            fileUri: '${element.source.uri}')..fileOffset = element.nameOffset;
 
       default:
         throw 'Unexpected member kind: $element';
@@ -561,7 +595,7 @@
           typeParameters: fresh.freshTypeParameters,
           supertype: new ast.Supertype(superclass, superArgs),
           mixedInType: new ast.Supertype(mixedInClass, mixinArgs),
-          fileUri: mixedInClass.fileUri);
+          fileUri: library.fileUri);
       result.level = ast.ClassLevel.Type;
       library.addClass(result);
       return result;
@@ -579,41 +613,56 @@
   void ensureLibraryIsLoaded(ast.Library node) {
     if (!node.isExternal) return;
     node.isExternal = false;
-    var source = context.sourceFactory.forUri2(node.importUri);
+    var source = context.sourceFactory
+        .forUri2(applicationRoot.absoluteUri(node.importUri));
     assert(source != null);
     var element = context.computeLibraryElement(source);
-    context.resolveCompilationUnit(source, element);
-    _buildLibraryBody(element, node);
-    if (node.importUri.scheme != 'dart') {
-      for (var unit in element.units) {
-        LineInfo lines;
-        for (var error in context.computeErrors(unit.source)) {
-          if (error.errorCode is CompileTimeErrorCode ||
-              error.errorCode is ParserErrorCode ||
-              error.errorCode is ScannerErrorCode ||
-              error.errorCode is StrongModeCode) {
-            lines ??= context.computeLineInfo(source);
-            errors.add(formatErrorMessage(error, source.shortName, lines));
-          }
-        }
+    var units = <CompilationUnit>[];
+    bool reportErrors = node.importUri.scheme != 'dart';
+    var tree = context.resolveCompilationUnit(source, element);
+    units.add(tree);
+    if (reportErrors) _processErrors(source);
+    for (var part in element.parts) {
+      var source = part.source;
+      units.add(context.resolveCompilationUnit(source, element));
+      if (reportErrors) _processErrors(source);
+    }
+    _buildLibraryBody(element, node, units);
+  }
+
+  void _processErrors(Source source) {
+    LineInfo lines;
+    for (var error in context.computeErrors(source)) {
+      if (error.errorCode is CompileTimeErrorCode ||
+          error.errorCode is ParserErrorCode ||
+          error.errorCode is ScannerErrorCode ||
+          error.errorCode is StrongModeCode) {
+        lines ??= context.computeLineInfo(source);
+        errors.add(formatErrorMessage(error, source.shortName, lines));
       }
     }
   }
 
-  void loadEverything({Target target}) {
-    ensureLibraryIsLoaded(getLibraryReference(getDartCoreLibrary()));
-    if (target != null) {
-      for (var uri in target.extraRequiredLibraries) {
-        var library = _findLibraryElement(uri);
-        if (library == null) {
-          errors.add('Could not find required library $uri');
-          continue;
+  void loadEverything({Target target, bool compileSdk}) {
+    compileSdk ??= true;
+    if (compileSdk) {
+      ensureLibraryIsLoaded(getLibraryReference(getDartCoreLibrary()));
+      if (target != null) {
+        for (var uri in target.extraRequiredLibraries) {
+          var library = _findLibraryElement(uri);
+          if (library == null) {
+            errors.add('Could not find required library $uri');
+            continue;
+          }
+          ensureLibraryIsLoaded(getLibraryReference(library));
         }
-        ensureLibraryIsLoaded(getLibraryReference(library));
       }
     }
     for (int i = 0; i < repository.libraries.length; ++i) {
-      ensureLibraryIsLoaded(repository.libraries[i]);
+      var library = repository.libraries[i];
+      if (compileSdk || library.importUri.scheme != 'dart') {
+        ensureLibraryIsLoaded(library);
+      }
     }
   }
 
@@ -623,8 +672,9 @@
   List<String> getLoadedFileNames() {
     var list = <String>[];
     for (var library in repository.libraries) {
-      LibraryElement element = context.computeLibraryElement(
-          context.sourceFactory.forUri2(library.importUri));
+      LibraryElement element = context.computeLibraryElement(context
+          .sourceFactory
+          .forUri2(applicationRoot.absoluteUri(library.importUri)));
       for (var unit in element.units) {
         list.add(unit.source.fullName);
       }
@@ -639,30 +689,64 @@
     }
   }
 
-  ast.Program loadProgram(String mainLibrary, {Target target}) {
-    ast.Library library = repository.getLibrary(mainLibrary);
+  ast.Procedure _getMainMethod(Uri uri) {
+    Source source = context.sourceFactory.forUri2(uri);
+    LibraryElement library = context.computeLibraryElement(source);
+    var mainElement = library.entryPoint;
+    if (mainElement == null) return null;
+    var mainMember = getMemberReference(mainElement);
+    if (mainMember is ast.Procedure && !mainMember.isAccessor) {
+      return mainMember;
+    }
+    // Top-level 'main' getters are not supported at the moment.
+    return null;
+  }
+
+  ast.Procedure _makeMissingMainMethod(ast.Library library) {
+    var main = new ast.Procedure(
+        new ast.Name('main'),
+        ast.ProcedureKind.Method,
+        new ast.FunctionNode(new ast.ExpressionStatement(new ast.Throw(
+            new ast.StringLiteral('Program has no main method')))),
+        isStatic: true)
+      ..fileUri = library.fileUri;
+    library.addMember(main);
+    return main;
+  }
+
+  ast.Program loadProgram(Uri mainLibrary, {Target target, bool compileSdk}) {
+    Uri uri = applicationRoot.relativeUri(mainLibrary);
+    ast.Library library = repository.getLibraryReference(uri);
     ensureLibraryIsLoaded(library);
-    loadEverything(target: target);
+    var mainMethod = _getMainMethod(mainLibrary);
+    loadEverything(target: target, compileSdk: compileSdk);
     var program = new ast.Program(repository.libraries);
-    program.mainMethod = library.procedures.firstWhere(
-        (member) => member.name?.name == 'main',
-        orElse: () => null);
+    if (mainMethod == null) {
+      mainMethod = _makeMissingMainMethod(library);
+    }
+    program.mainMethod = mainMethod;
     for (LibraryElement libraryElement in libraryElements) {
       for (CompilationUnitElement compilationUnitElement
           in libraryElement.units) {
-        // TODO(jensj): Get this another way?
-        LineInfo lineInfo = compilationUnitElement.computeNode().lineInfo;
-        program.uriToLineStarts[
-                "file://${compilationUnitElement.source.source.fullName}"] =
-            new List<int>.generate(lineInfo.lineCount, lineInfo.getOffsetOfLine,
-                growable: false);
+        var source = compilationUnitElement.source;
+        LineInfo lineInfo = context.computeLineInfo(source);
+        String sourceCode;
+        try {
+          sourceCode = context.getContents(source).data;
+        } catch (e) {
+          // The source's contents could not be accessed.
+          sourceCode = '';
+        }
+        program.uriToSource['${source.uri}'] =
+            new ast.Source(lineInfo.lineStarts, sourceCode);
       }
     }
     return program;
   }
 
-  ast.Library loadLibrary(String mainLibrary) {
-    ast.Library library = repository.getLibrary(mainLibrary);
+  ast.Library loadLibrary(Uri uri) {
+    ast.Library library =
+        repository.getLibraryReference(applicationRoot.relativeUri(uri));
     ensureLibraryIsLoaded(library);
     return library;
   }
@@ -741,7 +825,10 @@
     ..enableSuperMixins = true;
 }
 
-DartSdk createDartSdk(String path, {bool strongMode}) {
+DartSdk createDartSdk(String path, {bool strongMode, bool isSummary}) {
+  if (isSummary ?? false) {
+    return new SummaryBasedDartSdk(path, strongMode);
+  }
   var resources = PhysicalResourceProvider.INSTANCE;
   return new FolderBasedDartSdk(resources, resources.getFolder(path))
     ..context
@@ -784,7 +871,9 @@
 
 AnalysisContext createContext(DartOptions options, Packages packages,
     {DartSdk dartSdk}) {
-  dartSdk ??= createDartSdk(options.sdk, strongMode: options.strongModeSdk);
+  bool fromSummary = options.sdkSummary != null;
+  dartSdk ??= createDartSdk(fromSummary ? options.sdkSummary : options.sdk,
+      strongMode: options.strongModeSdk, isSummary: fromSummary);
 
   var resourceProvider = PhysicalResourceProvider.INSTANCE;
   var resourceUriResolver = new ResourceUriResolver(resourceProvider);
diff --git a/pkg/kernel/lib/application_root.dart b/pkg/kernel/lib/application_root.dart
new file mode 100644
index 0000000..a65d8dd
--- /dev/null
+++ b/pkg/kernel/lib/application_root.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+library kernel.application_root;
+
+import 'package:path/path.dart' as pathlib;
+
+/// Resolves URIs with the `app` scheme.
+///
+/// These are used internally in kernel to represent file paths relative to
+/// some application root. This is done to avoid storing irrelevant paths, such
+/// as the path to the home directory of the user who compiled a given file.
+class ApplicationRoot {
+  static const String scheme = 'app';
+
+  final String path;
+
+  ApplicationRoot(this.path) {
+    assert(path == null || pathlib.isAbsolute(path));
+  }
+
+  ApplicationRoot.none() : path = null;
+
+  /// Converts `app` URIs to absolute `file` URIs.
+  Uri absoluteUri(Uri uri) {
+    if (path == null) return uri;
+    if (uri.scheme == ApplicationRoot.scheme) {
+      return new Uri(scheme: 'file', path: pathlib.join(this.path, uri.path));
+    } else {
+      return uri;
+    }
+  }
+
+  /// Converts `file` URIs to `app` URIs.
+  Uri relativeUri(Uri uri) {
+    if (path == null) return uri;
+    if (uri.scheme == 'file' && pathlib.isWithin(this.path, uri.path)) {
+      return new Uri(
+          scheme: ApplicationRoot.scheme,
+          path: pathlib.relative(uri.path, from: this.path));
+    } else {
+      return uri;
+    }
+  }
+}
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 0cece08..f35e754 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -157,9 +157,11 @@
 // ------------------------------------------------------------------------
 
 class Library extends TreeNode implements Comparable<Library> {
-  /// An absolute import path to this library.
+  /// An import path to this library.
   ///
-  /// The [Uri] should have the `dart`, `package`, or `file` scheme.
+  /// The [Uri] should have the `dart`, `package`, `app`, or `file` scheme.
+  ///
+  /// If the URI has the `app` scheme, it is relative to the application root.
   Uri importUri;
 
   /// The uri of the source file this library was loaded from.
@@ -340,7 +342,7 @@
       this.supertype,
       this.mixedInType,
       List<TypeParameter> typeParameters,
-      List<InterfaceType> implementedTypes,
+      List<Supertype> implementedTypes,
       List<Constructor> constructors,
       List<Procedure> procedures,
       List<Field> fields,
@@ -496,6 +498,11 @@
 }
 
 abstract class Member extends TreeNode {
+  /// End offset in the source file it comes from. Valid values are from 0 and
+  /// up, or -1 ([TreeNode.noOffset]) if the file end offset is not available
+  /// (this is the default if none is specifically set).
+  int fileEndOffset = TreeNode.noOffset;
+
   /// List of metadata annotations on the member.
   ///
   /// This defaults to an immutable empty list. Use [addAnnotation] to add
@@ -942,6 +949,10 @@
 
   _MemberAccessor get _getterInterface => _reference;
   _MemberAccessor get _setterInterface => _reference;
+
+  Location _getLocationInEnclosingFile(int offset) {
+    return enclosingProgram.getLocation(fileUri, offset);
+  }
 }
 
 enum ProcedureKind {
@@ -1102,7 +1113,13 @@
 /// This may occur in a procedure, constructor, function expression, or local
 /// function declaration.
 class FunctionNode extends TreeNode {
+  /// End offset in the source file it comes from. Valid values are from 0 and
+  /// up, or -1 ([TreeNode.noOffset]) if the file end offset is not available
+  /// (this is the default if none is specifically set).
+  int fileEndOffset = TreeNode.noOffset;
+
   AsyncMarker asyncMarker;
+  bool debuggable = true;
   List<TypeParameter> typeParameters;
   int requiredParameterCount;
   List<VariableDeclaration> positionalParameters;
@@ -3502,17 +3519,17 @@
 class Program extends TreeNode {
   final List<Library> libraries;
 
-  /// Map from a source file uri to a line-starts table.
+  /// Map from a source file uri to a line-starts table and source code.
   /// Given a source file uri and a offset in that file one can translate
   /// it to a line:column position in that file.
-  final Map<String, List<int>> uriToLineStarts;
+  final Map<String, Source> uriToSource;
 
   /// Reference to the main method in one of the libraries.
   Procedure mainMethod;
 
-  Program([List<Library> libraries, Map<String, List<int>> uriToLineStarts])
+  Program([List<Library> libraries, Map<String, Source> uriToSource])
       : libraries = libraries ?? <Library>[],
-        uriToLineStarts = uriToLineStarts ?? {} {
+        uriToSource = uriToSource ?? <String, Source>{} {
     setParents(libraries, this);
   }
 
@@ -3531,7 +3548,7 @@
 
   /// Translates an offset to line and column numbers in the given file.
   Location getLocation(String file, int offset) {
-    List<int> lines = uriToLineStarts[file];
+    List<int> lines = uriToSource[file].lineStarts;
     int low = 0, high = lines.length - 1;
     while (low < high) {
       int mid = high - ((high - low) >> 1); // Get middle, rounding up.
@@ -3545,7 +3562,7 @@
     int lineIndex = low;
     int lineStart = lines[lineIndex];
     int lineNumber = 1 + lineIndex;
-    int columnNumber = offset - lineStart;
+    int columnNumber = 1 + offset - lineStart;
     return new Location(file, lineNumber, columnNumber);
   }
 }
@@ -3649,3 +3666,10 @@
     }
   }
 }
+
+class Source {
+  final List<int> lineStarts;
+  final String source;
+
+  Source(this.lineStarts, this.source);
+}
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index 1b228b8..8c940f6 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -177,7 +177,7 @@
           'Magic number was: ${magic.toRadixString(16)}');
     }
     readStringTable();
-    Map<String, List<int>> uriToLineStarts = readUriToLineStarts();
+    Map<String, Source> uriToSource = readUriToSource();
     importTable.length = readUInt();
     for (int i = 0; i < importTable.length; ++i) {
       importTable[i] = new Library(null);
@@ -187,15 +187,17 @@
       readLibrary();
     }
     var mainMethod = readMemberReference(allowNull: true);
-    return new Program(importTable, uriToLineStarts)..mainMethod = mainMethod;
+    return new Program(importTable, uriToSource)
+      ..mainMethod = mainMethod;
   }
 
-  Map<String, List<int>> readUriToLineStarts() {
+  Map<String, Source> readUriToSource() {
     readSourceUriTable();
     int length = _sourceUriTable.length;
-    Map<String, List<int>> uriToLineStarts = {};
+    Map<String, Source> uriToLineStarts = <String, Source>{};
     for (int i = 0; i < length; ++i) {
       String uri = _sourceUriTable[i];
+      String sourceCode = readStringEntry();
       int lineCount = readUInt();
       List<int> lineStarts = new List<int>(lineCount);
       int previousLineStart = 0;
@@ -204,7 +206,7 @@
         lineStarts[j] = lineStart;
         previousLineStart = lineStart;
       }
-      uriToLineStarts[uri] = lineStarts;
+      uriToLineStarts[uri] = new Source(lineStarts, sourceCode);
     }
     return uriToLineStarts;
   }
@@ -319,6 +321,7 @@
   }
 
   void readNormalClass(Class node) {
+    node.fileOffset = readOffset();
     int flags = readByte();
     node.isAbstract = flags & 0x1 != 0;
     node.level = _currentLibrary.isExternal
@@ -345,6 +348,7 @@
   }
 
   void readMixinClass(Class node) {
+    node.fileOffset = readOffset();
     int flags = readByte();
     node.isAbstract = flags & 0x1 != 0;
     node.level = _currentLibrary.isExternal
@@ -382,6 +386,7 @@
     // consumed from the input.
     assert(tag == Tag.Field);
     node.fileOffset = readOffset();
+    node.fileEndOffset = readOffset();
     node.flags = readByte();
     node.name = readName();
     node.fileUri = readUriReference();
@@ -397,6 +402,8 @@
 
   void readConstructor(Constructor node, int tag) {
     assert(tag == Tag.Constructor);
+    node.fileOffset = readOffset();
+    node.fileEndOffset = readOffset();
     node.flags = readByte();
     node.name = readName();
     node.annotations = readAnnotationList(node);
@@ -412,6 +419,8 @@
 
   void readProcedure(Procedure node, int tag) {
     assert(tag == Tag.Procedure);
+    node.fileOffset = readOffset();
+    node.fileEndOffset = readOffset();
     int kindIndex = readByte();
     node.kind = ProcedureKind.values[kindIndex];
     node.flags = readByte();
@@ -449,7 +458,10 @@
   }
 
   FunctionNode readFunctionNode() {
+    int offset = readOffset();
+    int endOffset = readOffset();
     AsyncMarker asyncMarker = AsyncMarker.values[readByte()];
+    bool debuggable = readByte() == 1 ? true : false;
     int typeParameterStackHeight = typeParameterStack.length;
     var typeParameters = readAndPushTypeParameterList();
     var requiredParameterCount = readUInt();
@@ -471,7 +483,10 @@
         namedParameters: named,
         returnType: returnType,
         inferredReturnValue: inferredReturnValue,
-        asyncMarker: asyncMarker);
+        asyncMarker: asyncMarker)
+      ..fileOffset = offset
+      ..fileEndOffset = endOffset
+      ..debuggable = debuggable;
   }
 
   void pushVariableDeclaration(VariableDeclaration variable) {
@@ -518,15 +533,22 @@
       case Tag.InvalidExpression:
         return new InvalidExpression();
       case Tag.VariableGet:
-        return new VariableGet(readVariableReference(), readDartTypeOption());
+        int offset = readOffset();
+        return new VariableGet(readVariableReference(), readDartTypeOption())
+          ..fileOffset = offset;
       case Tag.SpecializedVariableGet:
         int index = tagByte & Tag.SpecializedPayloadMask;
-        return new VariableGet(variableStack[index]);
+        int offset = readOffset();
+        return new VariableGet(variableStack[index])..fileOffset = offset;
       case Tag.VariableSet:
-        return new VariableSet(readVariableReference(), readExpression());
+        int offset = readOffset();
+        return new VariableSet(readVariableReference(), readExpression())
+          ..fileOffset = offset;
       case Tag.SpecializedVariableSet:
         int index = tagByte & Tag.SpecializedPayloadMask;
-        return new VariableSet(variableStack[index], readExpression());
+        int offset = readOffset();
+        return new VariableSet(variableStack[index], readExpression())
+          ..fileOffset = offset;
       case Tag.PropertyGet:
         int offset = readOffset();
         return new PropertyGet(
@@ -551,8 +573,7 @@
             readExpression(), readMemberReference(), readExpression());
       case Tag.StaticGet:
         int offset = readOffset();
-        return new StaticGet(readMemberReference())
-          ..fileOffset = offset;
+        return new StaticGet(readMemberReference())..fileOffset = offset;
       case Tag.StaticSet:
         return new StaticSet(readMemberReference(), readExpression());
       case Tag.MethodInvocation:
@@ -596,9 +617,13 @@
         return new ConditionalExpression(readExpression(), readExpression(),
             readExpression(), readDartTypeOption());
       case Tag.StringConcatenation:
-        return new StringConcatenation(readExpressionList());
+        int offset = readOffset();
+        return new StringConcatenation(readExpressionList())
+          ..fileOffset = offset;
       case Tag.IsExpression:
-        return new IsExpression(readExpression(), readDartType());
+        int offset = readOffset();
+        return new IsExpression(readExpression(), readDartType())
+          ..fileOffset = offset;
       case Tag.AsExpression:
         return new AsExpression(readExpression(), readDartType());
       case Tag.StringLiteral:
@@ -640,15 +665,21 @@
         return new ListLiteral(readExpressionList(),
             typeArgument: typeArgument, isConst: true);
       case Tag.MapLiteral:
+        int offset = readOffset();
         var keyType = readDartType();
         var valueType = readDartType();
         return new MapLiteral(readMapEntryList(),
-            keyType: keyType, valueType: valueType, isConst: false);
+            keyType: keyType,
+            valueType: valueType,
+            isConst: false)..fileOffset = offset;
       case Tag.ConstMapLiteral:
+        int offset = readOffset();
         var keyType = readDartType();
         var valueType = readDartType();
         return new MapLiteral(readMapEntryList(),
-            keyType: keyType, valueType: valueType, isConst: true);
+            keyType: keyType,
+            valueType: valueType,
+            isConst: true)..fileOffset = offset;
       case Tag.AwaitExpression:
         return new AwaitExpression(readExpression());
       case Tag.FunctionExpression:
@@ -754,25 +785,29 @@
         return new IfStatement(
             readExpression(), readStatement(), readStatementOrNullIfEmpty());
       case Tag.ReturnStatement:
-        return new ReturnStatement(readExpressionOption());
+        int offset = readOffset();
+        return new ReturnStatement(readExpressionOption())..fileOffset = offset;
       case Tag.TryCatch:
         return new TryCatch(readStatement(), readCatchList());
       case Tag.TryFinally:
         return new TryFinally(readStatement(), readStatement());
       case Tag.YieldStatement:
+        int offset = readOffset();
         int flags = readByte();
         return new YieldStatement(readExpression(),
             isYieldStar: flags & YieldStatement.FlagYieldStar != 0,
-            isNative: flags & YieldStatement.FlagNative != 0);
+            isNative: flags & YieldStatement.FlagNative != 0)
+          ..fileOffset = offset;
       case Tag.VariableDeclaration:
         var variable = readVariableDeclaration();
         variableStack.add(variable); // Will be popped by the enclosing scope.
         return variable;
       case Tag.FunctionDeclaration:
+        int offset = readOffset();
         var variable = readVariableDeclaration();
         variableStack.add(variable); // Will be popped by the enclosing scope.
         var function = readFunctionNode();
-        return new FunctionDeclaration(variable, function);
+        return new FunctionDeclaration(variable, function)..fileOffset = offset;
       default:
         throw fail('Invalid statement tag: $tag');
     }
@@ -924,13 +959,14 @@
   }
 
   VariableDeclaration readVariableDeclaration() {
+    int offset = readOffset();
     int flags = readByte();
     return new VariableDeclaration(readStringOrNullIfEmpty(),
         type: readDartType(),
         inferredValue: readOptionalInferredValue(),
         initializer: readExpressionOption(),
         isFinal: flags & 0x1 != 0,
-        isConst: flags & 0x2 != 0);
+        isConst: flags & 0x2 != 0)..fileOffset = offset;
   }
 
   int readOffset() {
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index 68f3687..6d3dabd 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -137,20 +137,23 @@
     _importTable = new ProgramImportTable(program);
     _stringIndexer.build(program);
     writeStringTable(_stringIndexer);
-    writeUriToLineStarts(program);
+    writeUriToSource(program);
     writeList(program.libraries, writeNode);
     writeMemberReference(program.mainMethod, allowNull: true);
     _flush();
   }
 
-  void writeUriToLineStarts(Program program) {
-    program.uriToLineStarts.keys.forEach((uri) {
+  void writeUriToSource(Program program) {
+    program.uriToSource.keys.forEach((uri) {
       _sourceUriIndexer.put(uri);
     });
     writeStringTable(_sourceUriIndexer);
     for (int i = 0; i < _sourceUriIndexer.entries.length; i++) {
       String uri = _sourceUriIndexer.entries[i].value;
-      List<int> lineStarts = program.uriToLineStarts[uri] ?? [];
+      Source source = program.uriToSource[uri] ?? new Source([], '');
+      String sourceCode = source.source;
+      writeStringTableEntry(sourceCode);
+      List<int> lineStarts = source.lineStarts;
       writeUInt30(lineStarts.length);
       int previousLineStart = 0;
       lineStarts.forEach((lineStart) {
@@ -200,11 +203,11 @@
     }
   }
 
-  writeOffset(TreeNode node) {
+  writeOffset(TreeNode node, int offset) {
     // TODO(jensj): Delta-encoding.
     // File offset ranges from -1 and up,
     // but is here saved as unsigned (thus the +1)
-    writeUInt30(node.fileOffset + 1);
+    writeUInt30(offset + 1);
   }
 
   void visitClassReference(Class node) {
@@ -287,6 +290,7 @@
     }
     if (node.isMixinApplication) {
       writeByte(Tag.MixinClass);
+      writeOffset(node, node.fileOffset);
       writeByte(flags);
       writeStringReference(node.name ?? '');
       writeUriReference(node.fileUri ?? '');
@@ -300,6 +304,7 @@
       _typeParameterIndexer.exit(node.typeParameters);
     } else {
       writeByte(Tag.NormalClass);
+      writeOffset(node, node.fileOffset);
       writeByte(flags);
       writeStringReference(node.name ?? '');
       writeUriReference(node.fileUri ?? '');
@@ -320,6 +325,8 @@
   visitConstructor(Constructor node) {
     _variableIndexer = new VariableIndexer();
     writeByte(Tag.Constructor);
+    writeOffset(node, node.fileOffset);
+    writeOffset(node, node.fileEndOffset);
     writeByte(node.flags);
     writeName(node.name ?? _emptyName);
     writeAnnotationList(node.annotations);
@@ -335,6 +342,8 @@
   visitProcedure(Procedure node) {
     _variableIndexer = new VariableIndexer();
     writeByte(Tag.Procedure);
+    writeOffset(node, node.fileOffset);
+    writeOffset(node, node.fileEndOffset);
     writeByte(node.kind.index);
     writeByte(node.flags);
     writeName(node.name ?? '');
@@ -347,7 +356,8 @@
   visitField(Field node) {
     _variableIndexer = new VariableIndexer();
     writeByte(Tag.Field);
-    writeOffset(node);
+    writeOffset(node, node.fileOffset);
+    writeOffset(node, node.fileEndOffset);
     writeByte(node.flags);
     writeName(node.name ?? '');
     writeUriReference(node.fileUri ?? '');
@@ -394,7 +404,10 @@
     _switchCaseIndexer = new SwitchCaseIndexer();
     // Note: FunctionNode has no tag.
     _typeParameterIndexer.enter(node.typeParameters);
+    writeOffset(node, node.fileOffset);
+    writeOffset(node, node.fileEndOffset);
     writeByte(node.asyncMarker.index);
+    writeByte(node.debuggable ? 1 : 0);
     writeNodeList(node.typeParameters);
     writeUInt30(node.requiredParameterCount);
     writeVariableDeclarationList(node.positionalParameters);
@@ -419,8 +432,10 @@
     if (index & Tag.SpecializedPayloadMask == index &&
         node.promotedType == null) {
       writeByte(Tag.SpecializedVariableGet + index);
+      writeOffset(node, node.fileOffset);
     } else {
       writeByte(Tag.VariableGet);
+      writeOffset(node, node.fileOffset);
       writeUInt30(_variableIndexer[node.variable]);
       writeOptionalNode(node.promotedType);
     }
@@ -431,9 +446,11 @@
     int index = _variableIndexer[node.variable];
     if (index & Tag.SpecializedPayloadMask == index) {
       writeByte(Tag.SpecializedVariableSet + index);
+      writeOffset(node, node.fileOffset);
       writeNode(node.value);
     } else {
       writeByte(Tag.VariableSet);
+      writeOffset(node, node.fileOffset);
       writeUInt30(_variableIndexer[node.variable]);
       writeNode(node.value);
     }
@@ -441,7 +458,7 @@
 
   visitPropertyGet(PropertyGet node) {
     writeByte(Tag.PropertyGet);
-    writeOffset(node);
+    writeOffset(node, node.fileOffset);
     writeNode(node.receiver);
     writeName(node.name);
     writeMemberReference(node.interfaceTarget, allowNull: true);
@@ -449,7 +466,7 @@
 
   visitPropertySet(PropertySet node) {
     writeByte(Tag.PropertySet);
-    writeOffset(node);
+    writeOffset(node, node.fileOffset);
     writeNode(node.receiver);
     writeName(node.name);
     writeNode(node.value);
@@ -484,7 +501,7 @@
 
   visitStaticGet(StaticGet node) {
     writeByte(Tag.StaticGet);
-    writeOffset(node);
+    writeOffset(node, node.fileOffset);
     writeMemberReference(node.target);
   }
 
@@ -496,7 +513,7 @@
 
   visitMethodInvocation(MethodInvocation node) {
     writeByte(Tag.MethodInvocation);
-    writeOffset(node);
+    writeOffset(node, node.fileOffset);
     writeNode(node.receiver);
     writeName(node.name);
     writeNode(node.arguments);
@@ -505,7 +522,7 @@
 
   visitSuperMethodInvocation(SuperMethodInvocation node) {
     writeByte(Tag.SuperMethodInvocation);
-    writeOffset(node);
+    writeOffset(node, node.fileOffset);
     writeName(node.name);
     writeNode(node.arguments);
     writeMemberReference(node.interfaceTarget, allowNull: true);
@@ -520,7 +537,7 @@
 
   visitStaticInvocation(StaticInvocation node) {
     writeByte(node.isConst ? Tag.ConstStaticInvocation : Tag.StaticInvocation);
-    writeOffset(node);
+    writeOffset(node, node.fileOffset);
     writeMemberReference(node.target);
     writeNode(node.arguments);
   }
@@ -529,7 +546,7 @@
     writeByte(node.isConst
         ? Tag.ConstConstructorInvocation
         : Tag.ConstructorInvocation);
-    writeOffset(node);
+    writeOffset(node, node.fileOffset);
     writeMemberReference(node.target);
     writeNode(node.arguments);
   }
@@ -577,11 +594,13 @@
 
   visitStringConcatenation(StringConcatenation node) {
     writeByte(Tag.StringConcatenation);
+    writeOffset(node, node.fileOffset);
     writeNodeList(node.expressions);
   }
 
   visitIsExpression(IsExpression node) {
     writeByte(Tag.IsExpression);
+    writeOffset(node, node.fileOffset);
     writeNode(node.operand);
     writeNode(node.type);
   }
@@ -652,7 +671,7 @@
 
   visitThrow(Throw node) {
     writeByte(Tag.Throw);
-    writeOffset(node);
+    writeOffset(node, node.fileOffset);
     writeNode(node.expression);
   }
 
@@ -664,6 +683,7 @@
 
   visitMapLiteral(MapLiteral node) {
     writeByte(node.isConst ? Tag.ConstMapLiteral : Tag.MapLiteral);
+    writeOffset(node, node.fileOffset);
     writeNode(node.keyType);
     writeNode(node.valueType);
     writeNodeList(node.entries);
@@ -798,6 +818,7 @@
 
   visitReturnStatement(ReturnStatement node) {
     writeByte(Tag.ReturnStatement);
+    writeOffset(node, node.fileOffset);
     writeOptionalNode(node.expression);
   }
 
@@ -825,6 +846,7 @@
 
   visitYieldStatement(YieldStatement node) {
     writeByte(Tag.YieldStatement);
+    writeOffset(node, node.fileOffset);
     writeByte(node.flags);
     writeNode(node.expression);
   }
@@ -835,6 +857,7 @@
   }
 
   void writeVariableDeclaration(VariableDeclaration node) {
+    writeOffset(node, node.fileOffset);
     writeByte(node.flags);
     writeStringReference(node.name ?? '');
     writeNode(node.type);
@@ -860,6 +883,7 @@
 
   visitFunctionDeclaration(FunctionDeclaration node) {
     writeByte(Tag.FunctionDeclaration);
+    writeOffset(node, node.fileOffset);
     writeVariableDeclaration(node.variable);
     writeNode(node.function);
   }
diff --git a/pkg/kernel/lib/class_hierarchy.dart b/pkg/kernel/lib/class_hierarchy.dart
index 32bf6958..40bc6e7 100644
--- a/pkg/kernel/lib/class_hierarchy.dart
+++ b/pkg/kernel/lib/class_hierarchy.dart
@@ -232,6 +232,22 @@
     }
   }
 
+  /// True if the program contains another class that is a subtype of given one.
+  bool hasProperSubtypes(Class class_) {
+    // If there are no subtypes then the subtype set contains the class itself.
+    return !getSubtypesOf(class_).isSingleton;
+  }
+
+  /// Returns the subtypes of [class_] as an interval list.
+  ClassSet getSubtypesOf(Class class_) {
+    return new ClassSet(this, _infoFor[class_].subtypeIntervalList);
+  }
+
+  /// Returns the subclasses of [class_] as an interval list.
+  ClassSet getSubclassesOf(Class class_) {
+    return new ClassSet(this, _infoFor[class_].subclassIntervalList);
+  }
+
   ClassHierarchy._internal(Program program, int numberOfClasses)
       : classes = new List<Class>(numberOfClasses) {
     // Build the class ordering based on a topological sort.
@@ -365,6 +381,7 @@
       inherited = _getUnshadowedInheritedMembers(declared, inherited);
       allInheritedMembers = _merge(allInheritedMembers, inherited);
     }
+
     inheritFrom(classNode.supertype);
     inheritFrom(classNode.mixedInType);
     classNode.implementedTypes.forEach(inheritFrom);
@@ -415,10 +432,14 @@
     }
     // One of the two lists is now exhausted, copy over the remains.
     while (i < declared.length) {
-      result[storeIndex++] = declared[i++];
+      Member declaredMember = declared[i++];
+      if (skipAbstractMembers && declaredMember.isAbstract) continue;
+      result[storeIndex++] = declaredMember;
     }
     while (j < inherited.length) {
-      result[storeIndex++] = inherited[j++];
+      Member inheritedMember = inherited[j++];
+      if (skipAbstractMembers && inheritedMember.isAbstract) continue;
+      result[storeIndex++] = inheritedMember;
     }
     result.length = storeIndex;
     return result;
@@ -850,3 +871,32 @@
 
   _ClassInfo(this.classNode);
 }
+
+/// An immutable set of classes, internally represented as an interval list.
+class ClassSet {
+  final ClassHierarchy _hierarchy;
+  final Uint32List _intervalList;
+
+  ClassSet(this._hierarchy, this._intervalList);
+
+  bool get isEmpty => _intervalList.isEmpty;
+
+  bool get isSingleton {
+    var list = _intervalList;
+    return list.length == 2 && list[0] + 1 == list[1];
+  }
+
+  bool contains(Class class_) {
+    return _intervalListContains(
+        _intervalList, _hierarchy._infoFor[class_].topDownIndex);
+  }
+
+  ClassSet union(ClassSet other) {
+    assert(_hierarchy == other._hierarchy);
+    if (identical(_intervalList, other._intervalList)) return this;
+    _IntervalListBuilder builder = new _IntervalListBuilder();
+    builder.addIntervalList(_intervalList);
+    builder.addIntervalList(other._intervalList);
+    return new ClassSet(_hierarchy, builder.buildIntervalList());
+  }
+}
diff --git a/pkg/kernel/lib/clone.dart b/pkg/kernel/lib/clone.dart
index ee315e6..3b9a6a2 100644
--- a/pkg/kernel/lib/clone.dart
+++ b/pkg/kernel/lib/clone.dart
@@ -341,7 +341,8 @@
         isConst: node.isConst,
         isExternal: node.isExternal,
         initializers: node.initializers.map(clone).toList(),
-        transformerFlags: node.transformerFlags);
+        transformerFlags: node.transformerFlags)
+      ..fileEndOffset = node.fileEndOffset;
   }
 
   visitProcedure(Procedure node) {
@@ -351,7 +352,7 @@
         isExternal: node.isExternal,
         isConst: node.isConst,
         transformerFlags: node.transformerFlags,
-        fileUri: node.fileUri);
+        fileUri: node.fileUri)..fileEndOffset = node.fileEndOffset;
   }
 
   visitField(Field node) {
@@ -364,7 +365,7 @@
         hasImplicitGetter: node.hasImplicitGetter,
         hasImplicitSetter: node.hasImplicitSetter,
         transformerFlags: node.transformerFlags,
-        fileUri: node.fileUri);
+        fileUri: node.fileUri)..fileEndOffset = node.fileEndOffset;
   }
 
   visitTypeParameter(TypeParameter node) {
@@ -374,17 +375,19 @@
     return newNode;
   }
 
+  TreeNode cloneFunctionNodeBody(FunctionNode node) => cloneOptional(node.body);
+
   visitFunctionNode(FunctionNode node) {
     var typeParameters = node.typeParameters.map(clone).toList();
     var positional = node.positionalParameters.map(clone).toList();
     var named = node.namedParameters.map(clone).toList();
-    return new FunctionNode(cloneOptional(node.body),
+    return new FunctionNode(cloneFunctionNodeBody(node),
         typeParameters: typeParameters,
         positionalParameters: positional,
         namedParameters: named,
         requiredParameterCount: node.requiredParameterCount,
         returnType: visitType(node.returnType),
-        asyncMarker: node.asyncMarker);
+        asyncMarker: node.asyncMarker)..fileEndOffset = node.fileEndOffset;
   }
 
   visitArguments(Arguments node) {
diff --git a/pkg/kernel/lib/core_types.dart b/pkg/kernel/lib/core_types.dart
index 790b3fd..28ce858 100644
--- a/pkg/kernel/lib/core_types.dart
+++ b/pkg/kernel/lib/core_types.dart
@@ -25,8 +25,9 @@
   Class internalSymbolClass;
   Class typeClass;
   Class functionClass;
+  Class invocationClass;
 
-  Library getCoreLibrary(String uri) => _dartLibraries[uri].library;
+  Library getCoreLibrary(String uri) => _dartLibraries[uri]?.library;
 
   Class getCoreClass(String libraryUri, String className) {
     return _dartLibraries[libraryUri].require(className);
@@ -63,6 +64,7 @@
     symbolClass = dartCore.require('Symbol');
     typeClass = dartCore.require('Type');
     functionClass = dartCore.require('Function');
+    invocationClass = dartCore.require('Invocation');
     futureClass = dartAsync.require('Future');
     streamClass = dartAsync.require('Stream');
     internalSymbolClass = dartInternal.require('Symbol');
diff --git a/pkg/kernel/lib/frontend/accessors.dart b/pkg/kernel/lib/frontend/accessors.dart
index 5271f0b..48bb2c5 100644
--- a/pkg/kernel/lib/frontend/accessors.dart
+++ b/pkg/kernel/lib/frontend/accessors.dart
@@ -42,30 +42,39 @@
   }
 
   Expression buildCompoundAssignment(Name binaryOperator, Expression value,
-      {bool voidContext: false, Procedure interfaceTarget}) {
+      {int offset: TreeNode.noOffset,
+      bool voidContext: false,
+      Procedure interfaceTarget}) {
     return _finish(_makeWrite(
-        builtBinary =
-            makeBinary(_makeRead(), binaryOperator, interfaceTarget, value),
+        builtBinary = makeBinary(
+            _makeRead(), binaryOperator, interfaceTarget, value,
+            offset: offset),
         voidContext));
   }
 
   Expression buildPrefixIncrement(Name binaryOperator,
-      {bool voidContext: false, Procedure interfaceTarget}) {
+      {int offset: TreeNode.noOffset,
+      bool voidContext: false,
+      Procedure interfaceTarget}) {
     return buildCompoundAssignment(binaryOperator, new IntLiteral(1),
-        voidContext: voidContext, interfaceTarget: interfaceTarget);
+        offset: offset,
+        voidContext: voidContext,
+        interfaceTarget: interfaceTarget);
   }
 
   Expression buildPostfixIncrement(Name binaryOperator,
-      {bool voidContext: false, Procedure interfaceTarget}) {
+      {int offset: TreeNode.noOffset,
+      bool voidContext: false,
+      Procedure interfaceTarget}) {
     if (voidContext) {
-      return buildPrefixIncrement(binaryOperator,
+      return buildPrefixIncrement(binaryOperator, offset: offset,
           voidContext: true, interfaceTarget: interfaceTarget);
     }
     var value = new VariableDeclaration.forValue(_makeRead());
     valueAccess() => new VariableGet(value);
     var dummy = new VariableDeclaration.forValue(_makeWrite(
-        builtBinary = makeBinary(
-            valueAccess(), binaryOperator, interfaceTarget, new IntLiteral(1)),
+        builtBinary = makeBinary(valueAccess(), binaryOperator, interfaceTarget,
+            new IntLiteral(1), offset: offset),
         true));
     return _finish(makeLet(value, makeLet(dummy, valueAccess())));
   }
@@ -185,7 +194,7 @@
 
   SuperPropertyAccessor(this.name, this.getter, this.setter);
 
-  _makeRead() => new SuperPropertyGet(name, getter);
+  _makeRead() => builtGetter = new SuperPropertyGet(name, getter);
 
   _makeWrite(Expression value, bool voidContext) {
     return new SuperPropertySet(name, value, setter);
@@ -235,7 +244,7 @@
   }
 
   _makeRead() {
-    return new MethodInvocation(receiverAccess(), _indexGet,
+    return builtGetter = new MethodInvocation(receiverAccess(), _indexGet,
         new Arguments(<Expression>[indexAccess()]), getter);
   }
 
@@ -289,8 +298,8 @@
     return new VariableGet(indexVariable);
   }
 
-  _makeRead() => new MethodInvocation(new ThisExpression(), _indexGet,
-      new Arguments(<Expression>[indexAccess()]), getter);
+  _makeRead() => builtGetter = new MethodInvocation(new ThisExpression(),
+      _indexGet, new Arguments(<Expression>[indexAccess()]), getter);
 
   _makeWrite(Expression value, bool voidContext) {
     if (!voidContext) return _makeWriteAndReturn(value);
@@ -335,7 +344,7 @@
   }
 
   _makeRead() {
-    return new SuperMethodInvocation(
+    return builtGetter = new SuperMethodInvocation(
         _indexGet, new Arguments(<Expression>[indexAccess()]), getter);
   }
 
@@ -367,7 +376,7 @@
 
   StaticAccessor(this.readTarget, this.writeTarget);
 
-  _makeRead() =>
+  _makeRead() => builtGetter =
       readTarget == null ? makeInvalidRead() : new StaticGet(readTarget);
 
   _makeWrite(Expression value, bool voidContext) {
@@ -400,16 +409,19 @@
   return new Let(variable, body);
 }
 
-Expression makeBinary(Expression left, Name operator, Procedure interfaceTarget,
-    Expression right) {
+Expression makeBinary(
+    Expression left, Name operator, Procedure interfaceTarget, Expression right,
+    {int offset: TreeNode.noOffset}) {
   return new MethodInvocation(
-      left, operator, new Arguments(<Expression>[right]), interfaceTarget);
+      left, operator, new Arguments(<Expression>[right]), interfaceTarget)
+    ..fileOffset = offset;
 }
 
 final Name _equalOperator = new Name('==');
 
-Expression buildIsNull(Expression value) {
-  return makeBinary(value, _equalOperator, null, new NullLiteral());
+Expression buildIsNull(Expression value, {int offset: TreeNode.noOffset}) {
+  return makeBinary(value, _equalOperator, null, new NullLiteral(),
+      offset: offset);
 }
 
 VariableDeclaration makeOrReuseVariable(Expression value) {
diff --git a/pkg/kernel/lib/frontend/super_initializers.dart b/pkg/kernel/lib/frontend/super_initializers.dart
index 4569274..ad8624d 100644
--- a/pkg/kernel/lib/frontend/super_initializers.dart
+++ b/pkg/kernel/lib/frontend/super_initializers.dart
@@ -33,10 +33,10 @@
   // [LocalInitializer]s.
   initializers.length += argumentCount;
   initializers.setRange(
-      superIndex + argumentCount,  // desination start (inclusive)
-      initializers.length - 1,     // desination end (exclusive)
-      initializers,                // source list
-      superIndex + 1);             // source start index
+      superIndex + argumentCount, // desination start (inclusive)
+      initializers.length - 1, // desination end (exclusive)
+      initializers, // source list
+      superIndex + 1); // source start index
   initializers[initializers.length - 1] = superCall;
 
   // Fill in the [argumentCount] reserved slots with the evaluation expressions
diff --git a/pkg/kernel/lib/kernel.dart b/pkg/kernel/lib/kernel.dart
index 123f843..1d67fb3 100644
--- a/pkg/kernel/lib/kernel.dart
+++ b/pkg/kernel/lib/kernel.dart
@@ -50,9 +50,11 @@
   }
 }
 
-void writeProgramToText(Program program, {String path, bool showExternal: false}) {
+void writeProgramToText(Program program,
+    {String path, bool showExternal: false, bool showOffsets: false}) {
   StringBuffer buffer = new StringBuffer();
-  new Printer(buffer, showExternal: showExternal).writeProgramFile(program);
+  new Printer(buffer, showExternal: showExternal, showOffsets: showOffsets)
+      .writeProgramFile(program);
   if (path == null) {
     print(buffer);
   } else {
diff --git a/pkg/kernel/lib/repository.dart b/pkg/kernel/lib/repository.dart
index 7689d90..73cc1a9 100644
--- a/pkg/kernel/lib/repository.dart
+++ b/pkg/kernel/lib/repository.dart
@@ -3,10 +3,6 @@
 // BSD-style license that can be found in the LICENSE file.
 library kernel.repository;
 
-import 'dart:io';
-
-import 'package:path/path.dart' as pathlib;
-
 import 'ast.dart';
 
 /// Keeps track of which [Library] objects have been created for a given URI.
@@ -14,62 +10,17 @@
 /// To load different files into the same IR, pass in the same repository
 /// object to the loaders.
 class Repository {
-  final String workingDirectory;
   final Map<Uri, Library> _uriToLibrary = <Uri, Library>{};
   final List<Library> libraries = <Library>[];
 
-  Repository({String workingDirectory})
-      : this.workingDirectory = workingDirectory ?? Directory.current.path;
-
-  /// Get the [Library] object for the library addresesd by [path]; possibly
-  /// as an external library.
-  ///
-  /// The [path] may be a relative or absolute file path, or a URI string with a
-  /// `dart:`, `package:` or `file:` scheme.
-  ///
-  /// Note that this method does not check if the library can be loaded at all.
-  Library getLibrary(String path) {
-    return getLibraryReference(normalizePath(path));
-  }
-
-  String normalizeFileExtension(String path) {
-    if (path.endsWith('.dill')) {
-      return path.substring(0, path.length - '.dill'.length) + '.dart';
-    } else {
-      return path;
-    }
-  }
-
-  /// Get the canonical URI for the library addressed by the given [path].
-  ///
-  /// The [path] may be a relative or absolute file path, or a URI string with a
-  /// `dart:`, `package:` or `file:` scheme.
-  Uri normalizePath(String path) {
-    var uri = Uri.parse(path);
-    if (!uri.hasScheme) {
-      if (!pathlib.isAbsolute(path)) {
-        path = pathlib.join(workingDirectory, path);
-      }
-      uri = new Uri(scheme: 'file', path: normalizeFileExtension(path));
-    } else if (uri.scheme == 'file') {
-      var path = normalizeFileExtension(uri.path);
-      if (!uri.hasAbsolutePath) {
-        uri = uri.replace(path: pathlib.join(workingDirectory, path));
-      } else {
-        uri = uri.replace(path: path);
-      }
-    }
-    return uri;
-  }
-
   Library getLibraryReference(Uri uri) {
     assert(uri.hasScheme);
-    assert(uri.scheme != 'file' || uri.hasAbsolutePath);
     return _uriToLibrary.putIfAbsent(uri, () => _buildLibraryReference(uri));
   }
 
   Library _buildLibraryReference(Uri uri) {
-    var library = new Library(uri, isExternal: true);
+    assert(uri.hasScheme);
+    var library = new Library(uri, isExternal: true)..fileUri = '$uri';
     libraries.add(library);
     return library;
   }
diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart
index 1dcae03..1c06273 100644
--- a/pkg/kernel/lib/target/targets.dart
+++ b/pkg/kernel/lib/target/targets.dart
@@ -6,6 +6,7 @@
 import '../ast.dart';
 
 import 'vm.dart';
+import 'vmcc.dart';
 import 'flutter.dart';
 
 final List<String> targetNames = targets.keys.toList();
@@ -20,6 +21,7 @@
 final Map<String, _TargetBuilder> targets = <String, _TargetBuilder>{
   'none': (TargetFlags flags) => new NoneTarget(flags),
   'vm': (TargetFlags flags) => new VmTarget(flags),
+  'vmcc': (TargetFlags flags) => new VmClosureConvertedTarget(flags),
   'flutter': (TargetFlags flags) => new FlutterTarget(flags),
 };
 
diff --git a/pkg/kernel/lib/target/vm.dart b/pkg/kernel/lib/target/vm.dart
index e6c5d94..c12403e 100644
--- a/pkg/kernel/lib/target/vm.dart
+++ b/pkg/kernel/lib/target/vm.dart
@@ -4,11 +4,15 @@
 library kernel.target.vm;
 
 import '../ast.dart';
+import '../core_types.dart';
 import '../transformations/continuation.dart' as cont;
 import '../transformations/erasure.dart';
+import '../transformations/insert_covariance_checks.dart';
+import '../transformations/insert_type_checks.dart';
 import '../transformations/mixin_full_resolution.dart' as mix;
 import '../transformations/sanitize_for_vm.dart';
 import '../transformations/setup_builtin_library.dart' as setup_builtin_library;
+import '../transformations/treeshaker.dart';
 import 'targets.dart';
 
 /// Specializes the kernel IR to the Dart VM.
@@ -51,7 +55,23 @@
       ];
 
   void transformProgram(Program program) {
-    new mix.MixinFullResolution().transform(program);
+    var mixins = new mix.MixinFullResolution();
+    mixins.transform(program);
+
+    var hierarchy = mixins.hierarchy;
+    var coreTypes = new CoreTypes(program);
+
+    if (strongMode) {
+      new InsertTypeChecks(hierarchy: hierarchy, coreTypes: coreTypes)
+          .transformProgram(program);
+      new InsertCovarianceChecks(hierarchy: hierarchy, coreTypes: coreTypes)
+          .transformProgram(program);
+    }
+
+    new TreeShaker(program,
+            hierarchy: hierarchy, coreTypes: coreTypes, strongMode: strongMode)
+        .transform(program);
+
     cont.transformProgram(program);
 
     // Repair `_getMainClosure()` function in dart:_builtin.
diff --git a/pkg/kernel/lib/target/vmcc.dart b/pkg/kernel/lib/target/vmcc.dart
new file mode 100644
index 0000000..b292457
--- /dev/null
+++ b/pkg/kernel/lib/target/vmcc.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+library kernel.target.vmcc;
+
+import '../ast.dart' show Program;
+import '../transformations/closure_conversion.dart' as cc show transformProgram;
+
+import 'targets.dart' show TargetFlags;
+import 'vm.dart' as vm_target;
+
+class VmClosureConvertedTarget extends vm_target.VmTarget {
+  VmClosureConvertedTarget(TargetFlags flags) : super(flags);
+
+  @override
+  String get name => "vmcc";
+
+  @override
+  void transformProgram(Program program) {
+    super.transformProgram(program);
+    cc.transformProgram(program);
+  }
+}
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index 18be9de..a0e7227 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -181,6 +181,7 @@
   int indentation = 0;
   int column = 0;
   bool showExternal;
+  bool showOffsets;
 
   static int SPACE = 0;
   static int WORD = 1;
@@ -190,6 +191,7 @@
   Printer(this.sink,
       {NameSystem syntheticNames,
       this.showExternal,
+      this.showOffsets: false,
       this.importTable,
       this.annotator: const InferredValueAnnotator()})
       : this.syntheticNames = syntheticNames ?? new NameSystem();
@@ -198,7 +200,8 @@
       : sink = parent.sink,
         syntheticNames = parent.syntheticNames,
         annotator = parent.annotator,
-        showExternal = parent.showExternal;
+        showExternal = parent.showExternal,
+        showOffsets = parent.showOffsets;
 
   String getLibraryName(Library node) {
     return node.name ?? syntheticNames.nameLibrary(node);
@@ -393,6 +396,9 @@
   }
 
   void writeNode(Node node) {
+    if (showOffsets && node is TreeNode) {
+      writeWord("[${node.fileOffset}]");
+    }
     node.accept(this);
   }
 
@@ -486,6 +492,7 @@
     if (function.asyncMarker != AsyncMarker.Sync) {
       writeSpaced(getAsyncMarkerKeyword(function.asyncMarker));
     }
+    if (!function.debuggable) writeSpaced("/* not debuggable */");
     if (function.body != null) {
       writeFunctionBody(function.body, terminateLine: terminateLine);
     } else if (terminateLine) {
@@ -626,6 +633,7 @@
   }
 
   void writeExpression(Expression node, [int minimumPrecedence]) {
+    if (showOffsets) writeWord("[${node.fileOffset}]");
     bool needsParenteses = false;
     if (minimumPrecedence != null && getPrecedence(node) < minimumPrecedence) {
       needsParenteses = true;
@@ -983,6 +991,12 @@
 
   visitVariableGet(VariableGet node) {
     writeVariableReference(node.variable);
+    if (node.promotedType != null) {
+      writeSymbol('{');
+      writeNode(node.promotedType);
+      writeSymbol('}');
+      state = WORD;
+    }
   }
 
   visitVariableSet(VariableSet node) {
@@ -1287,6 +1301,7 @@
 
   void writeVariableDeclaration(VariableDeclaration node,
       {bool useVarKeyword: false}) {
+    if (showOffsets) writeWord("[${node.fileOffset}]");
     writeModifier(node.isFinal, 'final');
     writeModifier(node.isConst, 'const');
     if (node.type != null) {
@@ -1380,6 +1395,9 @@
   }
 
   visitFunctionType(FunctionType node) {
+    if (state == WORD) {
+      ensureSpace();
+    }
     writeTypeParameterList(node.typeParameters);
     writeSymbol('(');
     var positional = node.positionalParameters;
diff --git a/pkg/kernel/lib/transformations/async.dart b/pkg/kernel/lib/transformations/async.dart
index fb3483d..b01f71a 100644
--- a/pkg/kernel/lib/transformations/async.dart
+++ b/pkg/kernel/lib/transformations/async.dart
@@ -56,7 +56,6 @@
   /// [statements] to a fresh empty list before transforming those children.
   List<Statement> statements = <Statement>[];
 
-
   /// The number of currently live named intermediate values.
   ///
   /// This index is used to allocate names to temporary values.  Because
@@ -76,8 +75,7 @@
   /// [nameIndex] may still account for names of subexpressions.
   int nameIndex = 0;
 
-  final VariableDeclaration asyncResult =
-      new VariableDeclaration(':result');
+  final VariableDeclaration asyncResult = new VariableDeclaration(':result');
   final List<VariableDeclaration> variables = <VariableDeclaration>[];
 
   ExpressionLifter(this.continuationRewriter);
@@ -176,13 +174,11 @@
     // children.
     var index = nameIndex;
 
-
     // 3. Transform the children.  Initially they do not have an await in a
     // sibling to their right.
     seenAwait = false;
     action();
 
-
     // 4. If the expression was named then the variables used for children are
     // no longer live but the variable used for the expression is.
     if (shouldName) {
@@ -194,7 +190,9 @@
 
   // Unary expressions.
   Expression unary(Expression expr) {
-    return transform(expr, () { expr.transformChildren(this); });
+    return transform(expr, () {
+      expr.transformChildren(this);
+    });
   }
 
   TreeNode visitVariableSet(VariableSet expr) => unary(expr);
@@ -249,15 +247,21 @@
   }
 
   TreeNode visitSuperMethodInvocation(SuperMethodInvocation expr) {
-    return transform(expr, () { visitArguments(expr.arguments); });
+    return transform(expr, () {
+      visitArguments(expr.arguments);
+    });
   }
 
   TreeNode visitStaticInvocation(StaticInvocation expr) {
-    return transform(expr, () { visitArguments(expr.arguments); });
+    return transform(expr, () {
+      visitArguments(expr.arguments);
+    });
   }
 
   TreeNode visitConstructorInvocation(ConstructorInvocation expr) {
-    return transform(expr, () { visitArguments(expr.arguments); });
+    return transform(expr, () {
+      visitArguments(expr.arguments);
+    });
   }
 
   TreeNode visitStringConcatenation(StringConcatenation expr) {
@@ -295,7 +299,7 @@
     var rightStatements = <Statement>[];
     seenAwait = false;
     expr.right = delimit(() => expr.right.accept(this), rightStatements)
-        ..parent = expr;
+      ..parent = expr;
     var rightAwait = seenAwait;
 
     if (rightStatements.isEmpty) {
@@ -321,13 +325,10 @@
     // so they occur before in the corresponding block).
     var rightBody = blockOf(rightStatements);
     var result = allocateTemporary(nameIndex);
-    rightBody.addStatement(new ExpressionStatement(
-        new VariableSet(
-            result,
-            new MethodInvocation(
-                expr.right,
-                new Name('=='),
-                new Arguments(<Expression>[new BoolLiteral(true)])))));
+    rightBody.addStatement(new ExpressionStatement(new VariableSet(
+        result,
+        new MethodInvocation(expr.right, new Name('=='),
+            new Arguments(<Expression>[new BoolLiteral(true)])))));
     var then, otherwise;
     if (expr.operator == '&&') {
       then = rightBody;
@@ -338,13 +339,9 @@
     }
     statements.add(new IfStatement(new VariableGet(result), then, otherwise));
 
-    var test =
-        new MethodInvocation(
-            expr.left,
-            new Name('=='),
-            new Arguments(<Expression>[new BoolLiteral(true)]));
-    statements.add(
-        new ExpressionStatement(new VariableSet(result, test)));
+    var test = new MethodInvocation(expr.left, new Name('=='),
+        new Arguments(<Expression>[new BoolLiteral(true)]));
+    statements.add(new ExpressionStatement(new VariableSet(result, test)));
 
     seenAwait = false;
     test.receiver = test.receiver.accept(this)..parent = test;
@@ -362,13 +359,14 @@
     var thenStatements = <Statement>[];
     seenAwait = false;
     expr.then = delimit(() => expr.then.accept(this), thenStatements)
-        ..parent = expr;
+      ..parent = expr;
     var thenAwait = seenAwait;
 
     var otherwiseStatements = <Statement>[];
     seenAwait = false;
-    expr.otherwise = delimit(() => expr.otherwise.accept(this),
-        otherwiseStatements)..parent = expr;
+    expr.otherwise =
+        delimit(() => expr.otherwise.accept(this), otherwiseStatements)
+          ..parent = expr;
     var otherwiseAwait = seenAwait;
 
     if (thenStatements.isEmpty && otherwiseStatements.isEmpty) {
@@ -411,16 +409,19 @@
     final R = continuationRewriter;
     var shouldName = seenAwait;
     var result = new VariableGet(asyncResult);
+
     // The statements are in reverse order, so name the result first if
     // necessary and then add the two other statements in reverse.
     if (shouldName) result = name(result);
-    statements.add(R.createContinuationPoint());
+    statements.add(R.createContinuationPoint()..fileOffset = expr.fileOffset);
     Arguments arguments = new Arguments(<Expression>[
-        expr.operand,
-        new VariableGet(R.thenContinuationVariable),
-        new VariableGet(R.catchErrorContinuationVariable)]);
+      expr.operand,
+      new VariableGet(R.thenContinuationVariable),
+      new VariableGet(R.catchErrorContinuationVariable)
+    ]);
     statements.add(new ExpressionStatement(
-        new StaticInvocation(R.helper.awaitHelper, arguments)));
+        new StaticInvocation(R.helper.awaitHelper, arguments)
+          ..fileOffset = expr.fileOffset));
 
     seenAwait = false;
     var index = nameIndex;
@@ -461,8 +462,8 @@
       statements.add(variable);
       var index = nameIndex;
       seenAwait = false;
-      variable.initializer =
-          variable.initializer.accept(this)..parent = variable;
+      variable.initializer = variable.initializer.accept(this)
+        ..parent = variable;
       // Temporaries used in the initializer or the body are not live but the
       // temporary used for the body is.
       nameIndex = index + 1;
@@ -475,15 +476,15 @@
       return transform(expr, () {
         // The body has already been translated.
         expr.body = body..parent = expr;
-        variable.initializer =
-            variable.initializer.accept(this)..parent = variable;
+        variable.initializer = variable.initializer.accept(this)
+          ..parent = variable;
       });
     }
   }
 
   visitFunctionNode(FunctionNode node) {
-    var nestedRewriter = new RecursiveContinuationRewriter(
-        continuationRewriter.helper);
+    var nestedRewriter =
+        new RecursiveContinuationRewriter(continuationRewriter.helper);
     return node.accept(nestedRewriter);
   }
 }
diff --git a/pkg/kernel/lib/transformations/closure/clone_without_body.dart b/pkg/kernel/lib/transformations/closure/clone_without_body.dart
new file mode 100644
index 0000000..1f13b54
--- /dev/null
+++ b/pkg/kernel/lib/transformations/closure/clone_without_body.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library kernel.transformations.closure.converter;
+
+import '../../ast.dart' show DartType, FunctionNode, TreeNode, TypeParameter;
+
+import '../../clone.dart' show CloneVisitor;
+
+class CloneWithoutBody extends CloneVisitor {
+  CloneWithoutBody({Map<TypeParameter, DartType> typeSubstitution})
+      : super(typeSubstitution: typeSubstitution);
+
+  @override
+  TreeNode cloneFunctionNodeBody(FunctionNode node) => null;
+}
diff --git a/pkg/kernel/lib/transformations/closure/context.dart b/pkg/kernel/lib/transformations/closure/context.dart
new file mode 100644
index 0000000..3a3495e
--- /dev/null
+++ b/pkg/kernel/lib/transformations/closure/context.dart
@@ -0,0 +1,248 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library kernel.transformations.closure.context;
+
+import '../../ast.dart'
+    show
+        Arguments,
+        Class,
+        ConstructorInvocation,
+        Expression,
+        ExpressionStatement,
+        IntLiteral,
+        InterfaceType,
+        MethodInvocation,
+        Name,
+        NullLiteral,
+        PropertyGet,
+        PropertySet,
+        StringLiteral,
+        Throw,
+        VariableDeclaration,
+        VariableGet,
+        VariableSet;
+
+import '../../frontend/accessors.dart'
+    show Accessor, IndexAccessor, VariableAccessor;
+
+import 'converter.dart' show ClosureConverter;
+
+abstract class Context {
+  /// Returns a new expression for accessing this context.
+  Expression get expression;
+
+  /// Returns an accessor (or null) for accessing this context.
+  Accessor get accessor;
+
+  /// Extend the context to include [variable] initialized to [value]. For
+  /// example, this replaces the [VariableDeclaration] node of a captured local
+  /// variable.
+  ///
+  /// This may create a new context and update the `context` field of the
+  /// current [ClosureConverter].
+  // TODO(ahe): Return context instead?
+  void extend(VariableDeclaration variable, Expression value);
+
+  /// Update the initializer [value] of [variable] which was previously added
+  /// with [extend]. This is used when [value] isn't available when the context
+  /// was extended.
+  void update(VariableDeclaration variable, Expression value) {
+    throw "not supported $runtimeType";
+  }
+
+  /// Returns a new expression for reading the value of [variable] from this
+  /// context. For example, for replacing a [VariableGet] of a captured local
+  /// variable.
+  Expression lookup(VariableDeclaration variable);
+
+  /// Returns a new expression which stores [value] in [variable] in this
+  /// context. For example, for replacing a [VariableSet] of a captured local
+  /// variable.
+  Expression assign(VariableDeclaration variable, Expression value,
+      {bool voidContext: false});
+
+  /// Returns a new context whose parent is this context. The optional argument
+  /// [accessor] controls how the nested context access this context. This is
+  /// used, for example, when hoisting a local function. In this case, access
+  /// to this context can't be accessed directly via [expression]. In other
+  /// cases, for example, a for-loop, this context is still in scope and can be
+  /// accessed directly (with [accessor]).
+  Context toNestedContext([Accessor accessor]);
+
+  /// Returns a new expression which will copy this context and store the copy
+  /// in the local variable currently holding this context.
+  Expression clone() {
+    return new Throw(
+        new StringLiteral("Context clone not implemented for ${runtimeType}"));
+  }
+}
+
+class NoContext extends Context {
+  final ClosureConverter converter;
+
+  NoContext(this.converter);
+
+  Expression get expression => new NullLiteral();
+
+  Accessor get accessor => null;
+
+  void extend(VariableDeclaration variable, Expression value) {
+    converter.context = new LocalContext(converter, this)
+      ..extend(variable, value);
+  }
+
+  Expression lookup(VariableDeclaration variable) {
+    throw 'Unbound NoContext.lookup($variable)';
+  }
+
+  Expression assign(VariableDeclaration variable, Expression value,
+      {bool voidContext: false}) {
+    throw 'Unbound NoContext.assign($variable, ...)';
+  }
+
+  Context toNestedContext([Accessor accessor]) {
+    return new NestedContext(
+        converter, accessor, <List<VariableDeclaration>>[]);
+  }
+}
+
+class LocalContext extends Context {
+  final ClosureConverter converter;
+  final Context parent;
+  final VariableDeclaration self;
+  final IntLiteral size;
+  final List<VariableDeclaration> variables = <VariableDeclaration>[];
+  final Map<VariableDeclaration, Arguments> initializers =
+      <VariableDeclaration, Arguments>{};
+
+  LocalContext._internal(this.converter, this.parent, this.self, this.size);
+
+  factory LocalContext(ClosureConverter converter, Context parent) {
+    Class contextClass = converter.contextClass;
+    assert(contextClass.constructors.length == 1);
+    IntLiteral zero = new IntLiteral(0);
+    VariableDeclaration declaration = new VariableDeclaration.forValue(
+        new ConstructorInvocation(
+            contextClass.constructors.first, new Arguments(<Expression>[zero])),
+        type: new InterfaceType(contextClass));
+    declaration.name = "#context";
+    converter.insert(declaration);
+    converter.insert(new ExpressionStatement(new PropertySet(
+        new VariableGet(declaration), new Name('parent'), parent.expression)));
+
+    return new LocalContext._internal(converter, parent, declaration, zero);
+  }
+
+  Expression get expression => accessor.buildSimpleRead();
+
+  Accessor get accessor => new VariableAccessor(self);
+
+  void extend(VariableDeclaration variable, Expression value) {
+    Arguments arguments =
+        new Arguments(<Expression>[new IntLiteral(variables.length), value]);
+    converter.insert(new ExpressionStatement(
+        new MethodInvocation(expression, new Name('[]='), arguments)));
+    ++size.value;
+    variables.add(variable);
+    initializers[variable] = arguments;
+  }
+
+  void update(VariableDeclaration variable, Expression value) {
+    Arguments arguments = initializers[variable];
+    arguments.positional[1] = value;
+    value.parent = arguments;
+  }
+
+  Expression lookup(VariableDeclaration variable) {
+    var index = variables.indexOf(variable);
+    return index == -1
+        ? parent.lookup(variable)
+        : new MethodInvocation(expression, new Name('[]'),
+            new Arguments(<Expression>[new IntLiteral(index)]));
+  }
+
+  Expression assign(VariableDeclaration variable, Expression value,
+      {bool voidContext: false}) {
+    var index = variables.indexOf(variable);
+    return index == -1
+        ? parent.assign(variable, value, voidContext: voidContext)
+        : IndexAccessor
+            .make(expression, new IntLiteral(index), null, null)
+            .buildAssignment(value, voidContext: voidContext);
+  }
+
+  Context toNestedContext([Accessor accessor]) {
+    accessor ??= this.accessor;
+    List<List<VariableDeclaration>> variabless = <List<VariableDeclaration>>[];
+    var current = this;
+    while (current != null && current is! NoContext) {
+      if (current is LocalContext) {
+        variabless.add(current.variables);
+        current = current.parent;
+      } else if (current is NestedContext) {
+        variabless.addAll((current as NestedContext).variabless);
+        current = null;
+      }
+    }
+    return new NestedContext(converter, accessor, variabless);
+  }
+
+  Expression clone() {
+    self.isFinal = false;
+    return new VariableSet(
+        self,
+        new MethodInvocation(
+            new VariableGet(self), new Name("copy"), new Arguments.empty()));
+  }
+}
+
+class NestedContext extends Context {
+  final ClosureConverter converter;
+  final Accessor accessor;
+  final List<List<VariableDeclaration>> variabless;
+
+  NestedContext(this.converter, this.accessor, this.variabless);
+
+  Expression get expression {
+    return accessor?.buildSimpleRead() ?? new NullLiteral();
+  }
+
+  void extend(VariableDeclaration variable, Expression value) {
+    converter.context = new LocalContext(converter, this)
+      ..extend(variable, value);
+  }
+
+  Expression lookup(VariableDeclaration variable) {
+    var context = expression;
+    for (var variables in variabless) {
+      var index = variables.indexOf(variable);
+      if (index != -1) {
+        return new MethodInvocation(context, new Name('[]'),
+            new Arguments(<Expression>[new IntLiteral(index)]));
+      }
+      context = new PropertyGet(context, new Name('parent'));
+    }
+    throw 'Unbound NestedContext.lookup($variable)';
+  }
+
+  Expression assign(VariableDeclaration variable, Expression value,
+      {bool voidContext: false}) {
+    var context = expression;
+    for (var variables in variabless) {
+      var index = variables.indexOf(variable);
+      if (index != -1) {
+        return IndexAccessor
+            .make(context, new IntLiteral(index), null, null)
+            .buildAssignment(value, voidContext: voidContext);
+      }
+      context = new PropertyGet(context, new Name('parent'));
+    }
+    throw 'Unbound NestedContext.lookup($variable)';
+  }
+
+  Context toNestedContext([Accessor accessor]) {
+    return new NestedContext(converter, accessor ?? this.accessor, variabless);
+  }
+}
diff --git a/pkg/kernel/lib/transformations/closure/converter.dart b/pkg/kernel/lib/transformations/closure/converter.dart
new file mode 100644
index 0000000..91a36df
--- /dev/null
+++ b/pkg/kernel/lib/transformations/closure/converter.dart
@@ -0,0 +1,818 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library kernel.transformations.closure.converter;
+
+import '../../ast.dart'
+    show
+        Arguments,
+        Block,
+        Catch,
+        Class,
+        Constructor,
+        ConstructorInvocation,
+        DartType,
+        EmptyStatement,
+        Expression,
+        ExpressionStatement,
+        Field,
+        FieldInitializer,
+        ForInStatement,
+        ForStatement,
+        FunctionDeclaration,
+        FunctionExpression,
+        FunctionNode,
+        InferredValue,
+        Initializer,
+        InvalidExpression,
+        InvocationExpression,
+        Library,
+        LocalInitializer,
+        Member,
+        MethodInvocation,
+        Name,
+        NamedExpression,
+        NullLiteral,
+        Procedure,
+        ProcedureKind,
+        PropertyGet,
+        ReturnStatement,
+        Statement,
+        StaticGet,
+        StaticInvocation,
+        StringLiteral,
+        Supertype,
+        ThisExpression,
+        Transformer,
+        TreeNode,
+        TypeParameter,
+        TypeParameterType,
+        VariableDeclaration,
+        VariableGet,
+        VariableSet,
+        transformList;
+
+import '../../frontend/accessors.dart' show VariableAccessor;
+
+import '../../clone.dart' show CloneVisitor;
+
+import '../../core_types.dart' show CoreTypes;
+
+import '../../type_algebra.dart' show substitute;
+
+import 'clone_without_body.dart' show CloneWithoutBody;
+
+import 'context.dart' show Context, NoContext;
+
+import 'info.dart' show ClosureInfo;
+
+class ClosureConverter extends Transformer {
+  final CoreTypes coreTypes;
+  final Class contextClass;
+  final Set<VariableDeclaration> capturedVariables;
+  final Map<FunctionNode, Set<TypeParameter>> capturedTypeVariables;
+  final Map<FunctionNode, VariableDeclaration> thisAccess;
+  final Map<FunctionNode, String> localNames;
+
+  /// Records place-holders for cloning contexts. See [visitForStatement].
+  final Set<InvalidExpression> contextClonePlaceHolders =
+      new Set<InvalidExpression>();
+
+  /// Maps the names of all instance methods that may be torn off (aka
+  /// implicitly closurized) to `${name.name}#get`.
+  final Map<Name, Name> tearOffGetterNames;
+
+  final CloneVisitor cloner = new CloneWithoutBody();
+
+  /// New members to add to [currentLibrary] after it has been
+  /// transformed. These members will not be transformed themselves.
+  final List<TreeNode> newLibraryMembers = <TreeNode>[];
+
+  /// New members to add to [currentClass] after it has been transformed. These
+  /// members will not be transformed themselves.
+  final List<Member> newClassMembers = <Member>[];
+
+  Library currentLibrary;
+
+  Class currentClass;
+
+  Member currentMember;
+
+  FunctionNode currentMemberFunction;
+
+  FunctionNode currentFunction;
+
+  Block _currentBlock;
+
+  int _insertionIndex = 0;
+
+  Context context;
+
+  /// Maps original type variable (aka type parameter) to a hoisted type
+  /// variable type.
+  ///
+  /// For example, consider:
+  ///
+  ///     class C<T> {
+  ///       f() => (x) => x is T;
+  ///     }
+  ///
+  /// This is currently converted to:
+  ///
+  ///    class C<T> {
+  ///      f() => new Closure#0<T>();
+  ///    }
+  ///    class Closure#0<T_> implements Function {
+  ///      call(x) => x is T_;
+  ///    }
+  ///
+  /// In this example, `typeSubstitution[T].parameter == T_` when transforming
+  /// the closure in `f`.
+  Map<TypeParameter, DartType> typeSubstitution =
+      const <TypeParameter, DartType>{};
+
+  ClosureConverter(this.coreTypes, ClosureInfo info, this.contextClass)
+      : this.capturedVariables = info.variables,
+        this.capturedTypeVariables = info.typeVariables,
+        this.thisAccess = info.thisAccess,
+        this.localNames = info.localNames,
+        this.tearOffGetterNames = info.tearOffGetterNames;
+
+  bool get isOuterMostContext {
+    return currentFunction == null || currentMemberFunction == currentFunction;
+  }
+
+  String get currentFileUri {
+    if (currentMember is Constructor) return currentClass.fileUri;
+    if (currentMember is Field) return (currentMember as Field).fileUri;
+    if (currentMember is Procedure) return (currentMember as Procedure).fileUri;
+    throw "No file uri for ${currentMember.runtimeType}";
+  }
+
+  void insert(Statement statement) {
+    _currentBlock.statements.insert(_insertionIndex++, statement);
+    statement.parent = _currentBlock;
+  }
+
+  TreeNode saveContext(TreeNode f()) {
+    Block savedBlock = _currentBlock;
+    int savedIndex = _insertionIndex;
+    Context savedContext = context;
+    try {
+      return f();
+    } finally {
+      _currentBlock = savedBlock;
+      _insertionIndex = savedIndex;
+      context = savedContext;
+    }
+  }
+
+  TreeNode visitLibrary(Library node) {
+    assert(newLibraryMembers.isEmpty);
+    if (node == contextClass.enclosingLibrary) return node;
+
+    currentLibrary = node;
+    node = super.visitLibrary(node);
+    for (TreeNode member in newLibraryMembers) {
+      if (member is Class) {
+        node.addClass(member);
+      } else {
+        node.addMember(member);
+      }
+    }
+    newLibraryMembers.clear();
+    currentLibrary = null;
+    return node;
+  }
+
+  TreeNode visitClass(Class node) {
+    assert(newClassMembers.isEmpty);
+    currentClass = node;
+    node = super.visitClass(node);
+    newClassMembers.forEach(node.addMember);
+    newClassMembers.clear();
+    currentClass = null;
+    return node;
+  }
+
+  TreeNode visitConstructor(Constructor node) {
+    assert(isEmptyContext);
+
+    currentMember = node;
+
+    FunctionNode function = node.function;
+    if (function.body != null && function.body is! EmptyStatement) {
+      setupContextForFunctionBody(function);
+      VariableDeclaration self = thisAccess[currentMemberFunction];
+      // TODO(karlklose): transform initializers
+      if (self != null) {
+        context.extend(self, new ThisExpression());
+      }
+      node.function.accept(this);
+      resetContext();
+    }
+
+    return node;
+  }
+
+  Expression handleLocalFunction(FunctionNode function) {
+    FunctionNode enclosingFunction = currentFunction;
+    Map<TypeParameter, DartType> enclosingTypeSubstitution = typeSubstitution;
+    currentFunction = function;
+    Statement body = function.body;
+    assert(body != null);
+
+    if (body is Block) {
+      _currentBlock = body;
+    } else {
+      _currentBlock = new Block(<Statement>[body]);
+      function.body = body.parent = _currentBlock;
+    }
+    _insertionIndex = 0;
+
+    VariableDeclaration contextVariable = new VariableDeclaration(
+        "#contextParameter",
+        type: contextClass.rawType,
+        isFinal: true);
+    Context parent = context;
+    context = context.toNestedContext(new VariableAccessor(contextVariable));
+
+    Set<TypeParameter> captured = capturedTypeVariables[currentFunction];
+    if (captured != null) {
+      typeSubstitution = copyTypeVariables(captured);
+    } else {
+      typeSubstitution = const <TypeParameter, DartType>{};
+    }
+
+    function.transformChildren(this);
+
+    Expression result = addClosure(function, contextVariable, parent.expression,
+        typeSubstitution, enclosingTypeSubstitution);
+    currentFunction = enclosingFunction;
+    typeSubstitution = enclosingTypeSubstitution;
+    return result;
+  }
+
+  TreeNode visitFunctionDeclaration(FunctionDeclaration node) {
+    /// Is this closure itself captured by a closure?
+    bool isCaptured = capturedVariables.contains(node.variable);
+    if (isCaptured) {
+      context.extend(node.variable, new InvalidExpression());
+    }
+    Context parent = context;
+    return saveContext(() {
+      Expression expression = handleLocalFunction(node.function);
+
+      if (isCaptured) {
+        parent.update(node.variable, expression);
+        return null;
+      } else {
+        node.variable.initializer = expression;
+        expression.parent = node.variable;
+        return node.variable;
+      }
+    });
+  }
+
+  TreeNode visitFunctionExpression(FunctionExpression node) => saveContext(() {
+        return handleLocalFunction(node.function);
+      });
+
+  /// Add a new class to the current library that looks like this:
+  ///
+  ///     class Closure#0 extends core::Object implements core::Function {
+  ///       field _in::Context context;
+  ///       constructor •(final _in::Context #t1) → dynamic
+  ///         : self::Closure 0::context = #t1
+  ///         ;
+  ///       method call(/* The parameters of [function] */) → dynamic {
+  ///         /// #t2 is [contextVariable].
+  ///         final _in::Context #t2 = this.{self::Closure#0::context};
+  ///         /* The body of [function]. */
+  ///       }
+  ///     }
+  ///
+  /// Returns a constructor call to invoke the above constructor.
+  ///
+  /// TODO(ahe): We shouldn't create a class for each closure. Instead we turn
+  /// [function] into a top-level function and use the Dart VM's mechnism for
+  /// closures.
+  Expression addClosure(
+      FunctionNode function,
+      VariableDeclaration contextVariable,
+      Expression accessContext,
+      Map<TypeParameter, DartType> substitution,
+      Map<TypeParameter, DartType> enclosingTypeSubstitution) {
+    Field contextField = new Field(
+        // TODO(ahe): Rename to #context.
+        new Name("context"),
+        type: contextClass.rawType,
+        fileUri: currentFileUri);
+    Class closureClass = createClosureClass(function,
+        fields: [contextField], substitution: substitution);
+    closureClass.addMember(new Procedure(
+        new Name("call"), ProcedureKind.Method, function,
+        fileUri: currentFileUri));
+    newLibraryMembers.add(closureClass);
+    Statement note = new ExpressionStatement(
+        new StringLiteral("This is a temporary solution. "
+            "In the VM, this will become an additional parameter."));
+    List<Statement> statements = <Statement>[note, contextVariable];
+    Statement body = function.body;
+    if (body is Block) {
+      statements.addAll(body.statements);
+    } else {
+      statements.add(body);
+    }
+    function.body = new Block(statements);
+    function.body.parent = function;
+    contextVariable.initializer =
+        new PropertyGet(new ThisExpression(), contextField.name, contextField);
+    contextVariable.initializer.parent = contextVariable;
+    return new ConstructorInvocation(
+        closureClass.constructors.single,
+        new Arguments(<Expression>[accessContext], types:
+            new List<DartType>.from(substitution.keys.map((TypeParameter t) {
+          return substitute(
+              new TypeParameterType(t), enclosingTypeSubstitution);
+        }))));
+  }
+
+  TreeNode visitField(Field node) {
+    currentMember = node;
+    context = new NoContext(this);
+    if (node.isInstanceMember) {
+      Name tearOffName = tearOffGetterNames[node.name];
+      if (tearOffName != null) {
+        // TODO(ahe): If we rewrite setters, we can rename the field to avoid
+        // an indirection in most cases.
+        addFieldForwarder(tearOffName, node);
+      }
+    }
+    node = super.visitField(node);
+    context = null;
+    currentMember = null;
+    return node;
+  }
+
+  TreeNode visitProcedure(Procedure node) {
+    assert(isEmptyContext);
+
+    currentMember = node;
+
+    if (node.isInstanceMember) {
+      Name tearOffName = tearOffGetterNames[node.name];
+      if (tearOffName != null) {
+        if (node.isGetter) {
+          // We rename the getter to avoid an indirection in most cases.
+          Name oldName = node.name;
+          node.name = tearOffName;
+          addGetterForwarder(oldName, node);
+        } else if (node.kind == ProcedureKind.Method) {
+          addTearOffGetter(tearOffName, node);
+        }
+      }
+    }
+
+    FunctionNode function = node.function;
+    if (function.body != null) {
+      setupContextForFunctionBody(function);
+      VariableDeclaration self = thisAccess[currentMemberFunction];
+      if (self != null) {
+        context.extend(self, new ThisExpression());
+      }
+      node.transformChildren(this);
+      resetContext();
+    }
+
+    return node;
+  }
+
+  void setupContextForFunctionBody(FunctionNode function) {
+    Statement body = function.body;
+    assert(body != null);
+    currentMemberFunction = function;
+    // Ensure that the body is a block which becomes the current block.
+    if (body is Block) {
+      _currentBlock = body;
+    } else {
+      _currentBlock = new Block(<Statement>[body]);
+      function.body = body.parent = _currentBlock;
+    }
+    _insertionIndex = 0;
+    // Start with no context.  This happens after setting up _currentBlock
+    // so statements can be emitted into _currentBlock if necessary.
+    context = new NoContext(this);
+  }
+
+  void resetContext() {
+    _currentBlock = null;
+    _insertionIndex = 0;
+    context = null;
+    currentMemberFunction = null;
+    currentMember = null;
+  }
+
+  bool get isEmptyContext {
+    return _currentBlock == null && _insertionIndex == 0 && context == null;
+  }
+
+  TreeNode visitLocalInitializer(LocalInitializer node) {
+    assert(!capturedVariables.contains(node.variable));
+    node.transformChildren(this);
+    return node;
+  }
+
+  TreeNode visitFunctionNode(FunctionNode node) {
+    transformList(node.typeParameters, this, node);
+
+    void extend(VariableDeclaration parameter) {
+      context.extend(parameter, new VariableGet(parameter));
+    }
+
+    // TODO: Can parameters contain initializers (e.g., for optional ones) that
+    // need to be closure converted?
+    node.positionalParameters.where(capturedVariables.contains).forEach(extend);
+    node.namedParameters.where(capturedVariables.contains).forEach(extend);
+
+    assert(node.body != null);
+    node.body = node.body.accept(this);
+    node.body.parent = node;
+    return node;
+  }
+
+  TreeNode visitBlock(Block node) {
+    return saveContext(() {
+      if (_currentBlock != node) {
+        _currentBlock = node;
+        _insertionIndex = 0;
+      }
+
+      while (_insertionIndex < _currentBlock.statements.length) {
+        assert(_currentBlock == node);
+
+        var original = _currentBlock.statements[_insertionIndex];
+        var transformed = original.accept(this);
+        assert(_currentBlock.statements[_insertionIndex] == original);
+        if (transformed == null) {
+          _currentBlock.statements.removeAt(_insertionIndex);
+        } else {
+          _currentBlock.statements[_insertionIndex++] = transformed;
+          transformed.parent = _currentBlock;
+        }
+      }
+
+      return node;
+    });
+  }
+
+  TreeNode visitVariableDeclaration(VariableDeclaration node) {
+    node.transformChildren(this);
+
+    if (!capturedVariables.contains(node)) return node;
+    context.extend(node, node.initializer ?? new NullLiteral());
+
+    if (node.parent == currentFunction) {
+      return node;
+    } else {
+      assert(node.parent is Block);
+      // When returning null, the parent block will remove this node from its
+      // list of statements.
+      return null;
+    }
+  }
+
+  TreeNode visitVariableGet(VariableGet node) {
+    return capturedVariables.contains(node.variable)
+        ? context.lookup(node.variable)
+        : node;
+  }
+
+  TreeNode visitVariableSet(VariableSet node) {
+    node.transformChildren(this);
+
+    return capturedVariables.contains(node.variable)
+        ? context.assign(node.variable, node.value,
+            voidContext: isInVoidContext(node))
+        : node;
+  }
+
+  bool isInVoidContext(Expression node) {
+    TreeNode parent = node.parent;
+    return parent is ExpressionStatement ||
+        parent is ForStatement && parent.condition != node;
+  }
+
+  DartType visitDartType(DartType node) {
+    return substitute(node, typeSubstitution);
+  }
+
+  VariableDeclaration getReplacementLoopVariable(VariableDeclaration variable) {
+    VariableDeclaration newVariable = new VariableDeclaration(variable.name,
+        initializer: variable.initializer,
+        type: variable.type)..flags = variable.flags;
+    variable.initializer = new VariableGet(newVariable);
+    variable.initializer.parent = variable;
+    return newVariable;
+  }
+
+  Expression cloneContext() {
+    InvalidExpression placeHolder = new InvalidExpression();
+    contextClonePlaceHolders.add(placeHolder);
+    return placeHolder;
+  }
+
+  TreeNode visitInvalidExpression(InvalidExpression node) {
+    return contextClonePlaceHolders.remove(node) ? context.clone() : node;
+  }
+
+  TreeNode visitForStatement(ForStatement node) {
+    if (node.variables.any(capturedVariables.contains)) {
+      // In Dart, loop variables are new variables on each iteration of the
+      // loop. This is only observable when a loop variable is captured by a
+      // closure, which is the situation we're in here. So we transform the
+      // loop.
+      //
+      // Consider the following example, where `x` is `node.variables.first`,
+      // and `#t1` is a temporary variable:
+      //
+      //     for (var x = 0; x < 10; x++) body;
+      //
+      // This is transformed to:
+      //
+      //     {
+      //       var x = 0;
+      //       for (; x < 10; clone-context, x++) body;
+      //     }
+      //
+      // `clone-context` is a place-holder that will later be replaced by an
+      // expression that clones the current closure context (see
+      // [visitInvalidExpression]).
+      return saveContext(() {
+        context = context.toNestedContext();
+        List<Statement> statements = <Statement>[];
+        statements.addAll(node.variables);
+        statements.add(node);
+        node.variables.clear();
+        node.updates.insert(0, cloneContext());
+        _currentBlock = new Block(statements);
+        _insertionIndex = 0;
+        return _currentBlock.accept(this);
+      });
+    }
+    return super.visitForStatement(node);
+  }
+
+  TreeNode visitForInStatement(ForInStatement node) {
+    if (capturedVariables.contains(node.variable)) {
+      // In Dart, loop variables are new variables on each iteration of the
+      // loop. This is only observable when the loop variable is captured by a
+      // closure, so we need to transform the for-in loop when `node.variable`
+      // is captured.
+      //
+      // Consider the following example, where `x` is `node.variable`, and
+      // `#t1` is a temporary variable:
+      //
+      //     for (var x in expr) body;
+      //
+      // Notice that we can assume that `x` doesn't have an initializer based
+      // on invariants in the Kernel AST. This is transformed to:
+      //
+      //     for (var #t1 in expr) { var x = #t1; body; }
+      //
+      // After this, we call super to apply the normal closure conversion to
+      // the transformed for-in loop.
+      VariableDeclaration variable = node.variable;
+      VariableDeclaration newVariable = getReplacementLoopVariable(variable);
+      node.variable = newVariable;
+      newVariable.parent = node;
+      node.body = new Block(<Statement>[variable, node.body]);
+      node.body.parent = node;
+    }
+    return super.visitForInStatement(node);
+  }
+
+  TreeNode visitThisExpression(ThisExpression node) {
+    return isOuterMostContext
+        ? node
+        : context.lookup(thisAccess[currentMemberFunction]);
+  }
+
+  TreeNode visitStaticGet(StaticGet node) {
+    Member target = node.target;
+    if (target is Procedure && target.kind == ProcedureKind.Method) {
+      Expression expression = getTearOffExpression(node.target);
+      expression.transformChildren(this);
+      return expression;
+    }
+    return super.visitStaticGet(node);
+  }
+
+  TreeNode visitPropertyGet(PropertyGet node) {
+    Name tearOffName = tearOffGetterNames[node.name];
+    if (tearOffName != null) {
+      node.name = tearOffName;
+    }
+    return super.visitPropertyGet(node);
+  }
+
+  TreeNode visitCatch(Catch node) {
+    VariableDeclaration exception = node.exception;
+    VariableDeclaration stackTrace = node.stackTrace;
+    if (stackTrace != null && capturedVariables.contains(stackTrace)) {
+      Block block = node.body = ensureBlock(node.body);
+      block.parent = node;
+      node.stackTrace = new VariableDeclaration(null);
+      node.stackTrace.parent = node;
+      stackTrace.initializer = new VariableGet(node.stackTrace);
+      block.statements.insert(0, stackTrace);
+      stackTrace.parent = block;
+    }
+    if (exception != null && capturedVariables.contains(exception)) {
+      Block block = node.body = ensureBlock(node.body);
+      block.parent = node;
+      node.exception = new VariableDeclaration(null);
+      node.exception.parent = node;
+      exception.initializer = new VariableGet(node.exception);
+      block.statements.insert(0, exception);
+      exception.parent = block;
+    }
+    return super.visitCatch(node);
+  }
+
+  Block ensureBlock(Statement statement) {
+    return statement is Block ? statement : new Block(<Statement>[statement]);
+  }
+
+  /// Creates a closure that will invoke [procedure] and return an expression
+  /// that instantiates that closure.
+  Expression getTearOffExpression(Procedure procedure) {
+    Map<TypeParameter, DartType> substitution = procedure.isInstanceMember
+        // Note: we do not attempt to avoid copying type variables that aren't
+        // used in the signature of [procedure]. It might be more economical to
+        // only copy type variables that are used. However, we assume that
+        // passing type arguments that match the enclosing class' type
+        // variables will be handled most efficiently.
+        ? copyTypeVariables(procedure.enclosingClass.typeParameters)
+        : const <TypeParameter, DartType>{};
+    Expression receiver = null;
+    List<Field> fields = null;
+    if (procedure.isInstanceMember) {
+      // TODO(ahe): Rename to #self.
+      Field self = new Field(new Name("self"), fileUri: currentFileUri);
+      self.type = substitute(procedure.enclosingClass.thisType, substitution);
+      fields = <Field>[self];
+      receiver = new PropertyGet(new ThisExpression(), self.name, self);
+    }
+    Class closureClass = createClosureClass(procedure.function,
+        fields: fields, substitution: substitution);
+    closureClass.addMember(new Procedure(new Name("call"), ProcedureKind.Method,
+        forwardFunction(procedure, receiver, substitution),
+        fileUri: currentFileUri));
+    newLibraryMembers.add(closureClass);
+    Arguments constructorArguments = procedure.isInstanceMember
+        ? new Arguments(<Expression>[new ThisExpression()])
+        : new Arguments.empty();
+    if (substitution.isNotEmpty) {
+      constructorArguments.types
+          .addAll(procedure.enclosingClass.thisType.typeArguments);
+    }
+    return new ConstructorInvocation(
+        closureClass.constructors.single, constructorArguments);
+  }
+
+  /// Creates a function that has the same signature as `procedure.function`
+  /// and which forwards all arguments to `procedure`.
+  FunctionNode forwardFunction(Procedure procedure, Expression receiver,
+      Map<TypeParameter, DartType> substitution) {
+    CloneVisitor cloner = substitution.isEmpty
+        ? this.cloner
+        : new CloneWithoutBody(typeSubstitution: substitution);
+    FunctionNode function = procedure.function;
+    List<TypeParameter> typeParameters =
+        function.typeParameters.map(cloner.clone).toList();
+    List<VariableDeclaration> positionalParameters =
+        function.positionalParameters.map(cloner.clone).toList();
+    List<VariableDeclaration> namedParameters =
+        function.namedParameters.map(cloner.clone).toList();
+    // TODO(ahe): Clone or copy inferredReturnValue?
+    InferredValue inferredReturnValue = null;
+
+    List<DartType> types = typeParameters
+        .map((TypeParameter parameter) => new TypeParameterType(parameter))
+        .toList();
+    List<Expression> positional = positionalParameters
+        .map((VariableDeclaration parameter) => new VariableGet(parameter))
+        .toList();
+    List<NamedExpression> named =
+        namedParameters.map((VariableDeclaration parameter) {
+      return new NamedExpression(parameter.name, new VariableGet(parameter));
+    }).toList();
+
+    Arguments arguments = new Arguments(positional, types: types, named: named);
+    InvocationExpression invocation = procedure.isInstanceMember
+        ? new MethodInvocation(receiver, procedure.name, arguments, procedure)
+        : new StaticInvocation(procedure, arguments);
+    return new FunctionNode(new ReturnStatement(invocation),
+        typeParameters: typeParameters,
+        positionalParameters: positionalParameters,
+        namedParameters: namedParameters,
+        requiredParameterCount: function.requiredParameterCount,
+        returnType: substitute(function.returnType, substitution),
+        inferredReturnValue: inferredReturnValue);
+  }
+
+  /// Creates copies of the type variables in [original] and returns a
+  /// substitution that can be passed to [substitute] to substitute all uses of
+  /// [original] with their copies.
+  Map<TypeParameter, DartType> copyTypeVariables(
+      Iterable<TypeParameter> original) {
+    if (original.isEmpty) return const <TypeParameter, DartType>{};
+    Map<TypeParameter, DartType> substitution = <TypeParameter, DartType>{};
+    for (TypeParameter t in original) {
+      substitution[t] = new TypeParameterType(new TypeParameter(t.name));
+    }
+    substitution.forEach((TypeParameter t, DartType copy) {
+      if (copy is TypeParameterType) {
+        copy.parameter.bound = substitute(t.bound, substitution);
+      }
+    });
+    return substitution;
+  }
+
+  Class createClosureClass(FunctionNode function,
+      {List<Field> fields, Map<TypeParameter, DartType> substitution}) {
+    List<TypeParameter> typeParameters = new List<TypeParameter>.from(
+        substitution.values
+            .map((DartType t) => (t as TypeParameterType).parameter));
+    Class closureClass = new Class(
+        name: 'Closure#${localNames[function]}',
+        supertype: new Supertype(coreTypes.objectClass, const <DartType>[]),
+        typeParameters: typeParameters,
+        implementedTypes: <Supertype>[
+          new Supertype(coreTypes.functionClass, const <DartType>[])
+        ],
+        fileUri: currentFileUri);
+    addClosureClassNote(closureClass);
+
+    List<VariableDeclaration> parameters = <VariableDeclaration>[];
+    List<Initializer> initializers = <Initializer>[];
+    for (Field field in fields ?? const <Field>[]) {
+      closureClass.addMember(field);
+      VariableDeclaration parameter = new VariableDeclaration(field.name.name,
+          type: field.type, isFinal: true);
+      parameters.add(parameter);
+      initializers.add(new FieldInitializer(field, new VariableGet(parameter)));
+    }
+
+    closureClass.addMember(new Constructor(
+        new FunctionNode(new EmptyStatement(),
+            positionalParameters: parameters),
+        name: new Name(""),
+        initializers: initializers));
+
+    return closureClass;
+  }
+
+  Statement forwardToThisProperty(Member node) {
+    assert(node is Field || (node is Procedure && node.isGetter));
+    return new ReturnStatement(
+        new PropertyGet(new ThisExpression(), node.name, node));
+  }
+
+  void addFieldForwarder(Name name, Field field) {
+    newClassMembers.add(new Procedure(name, ProcedureKind.Getter,
+        new FunctionNode(forwardToThisProperty(field)),
+        fileUri: currentFileUri));
+  }
+
+  Procedure copyWithBody(Procedure procedure, Statement body) {
+    Procedure copy = cloner.clone(procedure);
+    copy.function.body = body;
+    copy.function.body.parent = copy.function;
+    return copy;
+  }
+
+  void addGetterForwarder(Name name, Procedure getter) {
+    assert(getter.isGetter);
+    newClassMembers
+        .add(copyWithBody(getter, forwardToThisProperty(getter))..name = name);
+  }
+
+  void addTearOffGetter(Name name, Procedure procedure) {
+    newClassMembers.add(new Procedure(name, ProcedureKind.Getter,
+        new FunctionNode(new ReturnStatement(getTearOffExpression(procedure))),
+        fileUri: currentFileUri));
+  }
+
+  // TODO(ahe): Remove this method when we don't generate closure classes
+  // anymore.
+  void addClosureClassNote(Class closureClass) {
+    closureClass.addMember(new Field(new Name("note"),
+        type: coreTypes.stringClass.rawType,
+        initializer: new StringLiteral(
+            "This is temporary. The VM doesn't need closure classes."),
+        fileUri: currentFileUri));
+  }
+}
diff --git a/pkg/kernel/lib/transformations/closure/info.dart b/pkg/kernel/lib/transformations/closure/info.dart
new file mode 100644
index 0000000..acbb3d2
--- /dev/null
+++ b/pkg/kernel/lib/transformations/closure/info.dart
@@ -0,0 +1,206 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library kernel.transformations.closure.info;
+
+import '../../ast.dart'
+    show
+        Class,
+        Constructor,
+        Field,
+        FunctionDeclaration,
+        FunctionNode,
+        Member,
+        Name,
+        Procedure,
+        ProcedureKind,
+        PropertyGet,
+        ThisExpression,
+        TypeParameter,
+        TypeParameterType,
+        VariableDeclaration,
+        VariableGet,
+        VariableSet;
+
+import '../../visitor.dart' show RecursiveVisitor;
+
+class ClosureInfo extends RecursiveVisitor {
+  FunctionNode currentFunction;
+  final Map<VariableDeclaration, FunctionNode> function =
+      <VariableDeclaration, FunctionNode>{};
+
+  final Set<VariableDeclaration> variables = new Set<VariableDeclaration>();
+
+  final Map<FunctionNode, Set<TypeParameter>> typeVariables =
+      <FunctionNode, Set<TypeParameter>>{};
+
+  /// Map from members to synthetic variables for accessing `this` in a local
+  /// function.
+  final Map<FunctionNode, VariableDeclaration> thisAccess =
+      <FunctionNode, VariableDeclaration>{};
+
+  final Set<String> currentMemberLocalNames = new Set<String>();
+
+  final Map<FunctionNode, String> localNames = <FunctionNode, String>{};
+
+  /// Contains all names used as getter through a [PropertyGet].
+  final Set<Name> invokedGetters = new Set<Name>();
+
+  /// Contains all names of declared regular instance methods (not including
+  /// accessors and operators).
+  final Set<Name> declaredInstanceMethodNames = new Set<Name>();
+
+  Class currentClass;
+
+  Member currentMember;
+
+  FunctionNode currentMemberFunction;
+
+  bool get isOuterMostContext {
+    return currentFunction == null || currentMemberFunction == currentFunction;
+  }
+
+  /// Maps the names of all instance methods that may be torn off (aka
+  /// implicitly closurized) to `${name.name}#get`.
+  Map<Name, Name> get tearOffGetterNames {
+    Map<Name, Name> result = <Name, Name>{};
+    for (Name name in declaredInstanceMethodNames) {
+      if (invokedGetters.contains(name)) {
+        result[name] = new Name("${name.name}#get", name.library);
+      }
+    }
+    return result;
+  }
+
+  void beginMember(Member member, [FunctionNode function]) {
+    currentMemberLocalNames.clear();
+    if (function != null) {
+      localNames[function] = computeUniqueLocalName(member.name.name);
+    }
+    currentMember = member;
+    currentMemberFunction = function;
+  }
+
+  void endMember() {
+    currentMember = null;
+    currentMemberFunction = null;
+  }
+
+  visitClass(Class node) {
+    currentClass = node;
+    super.visitClass(node);
+    currentClass = null;
+  }
+
+  visitConstructor(Constructor node) {
+    beginMember(node, node.function);
+    super.visitConstructor(node);
+    endMember();
+  }
+
+  visitProcedure(Procedure node) {
+    beginMember(node, node.function);
+    if (node.isInstanceMember && node.kind == ProcedureKind.Method) {
+      // Ignore the `length` method of [File] subclasses for now, as they
+      // will force us to rename the `length` getter (kernel issue #43).
+      // TODO(ahe): remove this condition.
+      Class parent = node.parent;
+      if (node.name.name != "length" ||
+          parent.enclosingLibrary.importUri.toString() != "dart:io") {
+        declaredInstanceMethodNames.add(node.name);
+      }
+    }
+    super.visitProcedure(node);
+    endMember();
+  }
+
+  visitField(Field node) {
+    beginMember(node);
+    super.visitField(node);
+    endMember();
+  }
+
+  String computeUniqueLocalName([String name]) {
+    if (name == null || name.isEmpty) {
+      name = "function";
+    }
+    if (currentFunction == null) {
+      if (currentMember != null) {
+        name = "${currentMember.name.name}#$name";
+      }
+      if (currentClass != null) {
+        name = "${currentClass.name}#$name";
+      }
+    } else {
+      name = "${localNames[currentFunction]}#$name";
+    }
+    int count = 1;
+    String candidate = name;
+    while (currentMemberLocalNames.contains(candidate)) {
+      candidate = "$name#${count++}";
+    }
+    currentMemberLocalNames.add(candidate);
+    return candidate;
+  }
+
+  visitFunctionDeclaration(FunctionDeclaration node) {
+    assert(!localNames.containsKey(node));
+    localNames[node.function] = computeUniqueLocalName(node.variable.name);
+    return super.visitFunctionDeclaration(node);
+  }
+
+  visitFunctionNode(FunctionNode node) {
+    localNames.putIfAbsent(node, computeUniqueLocalName);
+    var saved = currentFunction;
+    currentFunction = node;
+    node.visitChildren(this);
+    currentFunction = saved;
+    Set<TypeParameter> capturedTypeVariables = typeVariables[node];
+    if (capturedTypeVariables != null && !isOuterMostContext) {
+      // Propagate captured type variables to enclosing function.
+      typeVariables
+          .putIfAbsent(currentFunction, () => new Set<TypeParameter>())
+          .addAll(capturedTypeVariables);
+    }
+  }
+
+  visitVariableDeclaration(VariableDeclaration node) {
+    function[node] = currentFunction;
+    node.visitChildren(this);
+  }
+
+  visitVariableGet(VariableGet node) {
+    if (function[node.variable] != currentFunction) {
+      variables.add(node.variable);
+    }
+    node.visitChildren(this);
+  }
+
+  visitVariableSet(VariableSet node) {
+    if (function[node.variable] != currentFunction) {
+      variables.add(node.variable);
+    }
+    node.visitChildren(this);
+  }
+
+  visitTypeParameterType(TypeParameterType node) {
+    if (!isOuterMostContext) {
+      typeVariables
+          .putIfAbsent(currentFunction, () => new Set<TypeParameter>())
+          .add(node.parameter);
+    }
+  }
+
+  visitThisExpression(ThisExpression node) {
+    if (!isOuterMostContext) {
+      thisAccess.putIfAbsent(
+          currentMemberFunction, () => new VariableDeclaration("#self"));
+    }
+  }
+
+  visitPropertyGet(PropertyGet node) {
+    invokedGetters.add(node.name);
+    super.visitPropertyGet(node);
+  }
+}
diff --git a/pkg/kernel/lib/transformations/closure/invalidate_closures.dart b/pkg/kernel/lib/transformations/closure/invalidate_closures.dart
new file mode 100644
index 0000000..96e281e
--- /dev/null
+++ b/pkg/kernel/lib/transformations/closure/invalidate_closures.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library kernel.transformations.closure.invalidate;
+
+import '../../ast.dart';
+
+class InvalidateClosures extends Transformer {
+  FunctionDeclaration visitFunctionDeclaration(FunctionDeclaration node) {
+    invalidate(node.function);
+    return node;
+  }
+
+  FunctionExpression visitFunctionExpression(FunctionExpression node) {
+    invalidate(node.function);
+    return node;
+  }
+
+  void invalidate(FunctionNode function) {
+    var position = function.location;
+    function.body = new ExpressionStatement(new Throw(
+        new StringLiteral("Calling unconverted closure at $position")))
+      ..parent = function;
+  }
+}
diff --git a/pkg/kernel/lib/transformations/closure/mock.dart b/pkg/kernel/lib/transformations/closure/mock.dart
new file mode 100644
index 0000000..6f13fca
--- /dev/null
+++ b/pkg/kernel/lib/transformations/closure/mock.dart
@@ -0,0 +1,196 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library kernel.transformations.closure.mock;
+
+import '../../ast.dart'
+    show
+        Arguments,
+        Block,
+        Class,
+        Constructor,
+        ConstructorInvocation,
+        DartType,
+        DynamicType,
+        EmptyStatement,
+        Expression,
+        ExpressionStatement,
+        Field,
+        FieldInitializer,
+        FunctionNode,
+        Initializer,
+        IntLiteral,
+        Library,
+        MethodInvocation,
+        Name,
+        NullLiteral,
+        Procedure,
+        ProcedureKind,
+        Program,
+        PropertyGet,
+        ReturnStatement,
+        Source,
+        Statement,
+        StaticInvocation,
+        Supertype,
+        VariableDeclaration,
+        VariableGet;
+
+import '../../core_types.dart' show CoreTypes;
+
+import '../../frontend/accessors.dart'
+    show
+        Accessor,
+        IndexAccessor,
+        PropertyAccessor,
+        ThisPropertyAccessor,
+        VariableAccessor;
+
+/// Extend the program with this mock:
+///
+///     class Context {
+///       final List list;
+///       var parent;
+///       Context(int i) : list = new List(i);
+///       operator[] (int i) => list[i];
+///       operator[]= (int i, value) {
+///         list[i] = value;
+///       }
+///       Context copy() {
+///         Context c = new Context(list.length);
+///         c.parent = parent;
+///         c.list.setRange(0, list.length, list);
+///         return c;
+///       }
+///     }
+///
+/// Returns the mock.
+Class mockUpContext(CoreTypes coreTypes, Program program) {
+  String fileUri = "dart:mock";
+
+  ///     final List list;
+  Field listField = new Field(new Name("list"),
+      type: coreTypes.listClass.rawType, isFinal: true, fileUri: fileUri);
+  Accessor listFieldAccessor =
+      new ThisPropertyAccessor(listField.name, listField, null);
+
+  ///     var parent;
+  Field parentField = new Field(new Name("parent"), fileUri: fileUri);
+  Accessor parentFieldAccessor =
+      new ThisPropertyAccessor(parentField.name, parentField, parentField);
+
+  List<Field> fields = <Field>[listField, parentField];
+
+  ///     Context(int i) : list = new List(i);
+  VariableDeclaration iParameter = new VariableDeclaration("i",
+      type: coreTypes.intClass.rawType, isFinal: true);
+
+  // TODO(karlklose): use the default factory when it is exposed again.
+  Procedure listConstructor = coreTypes.listClass.procedures.firstWhere(
+      (Procedure p) => p.name.name == 'filled');
+
+  Constructor constructor = new Constructor(
+      new FunctionNode(new EmptyStatement(),
+          positionalParameters: <VariableDeclaration>[iParameter]),
+      name: new Name(""),
+      initializers: <Initializer>[
+        new FieldInitializer(
+            listField,
+            new StaticInvocation(
+                listConstructor,
+                new Arguments(<Expression>[
+                  new VariableAccessor(iParameter).buildSimpleRead(),
+                  new NullLiteral(),
+                ], types: <DartType>[
+                  const DynamicType()
+                ])))
+      ]);
+
+  ///     operator[] (int i) => list[i];
+  iParameter = new VariableDeclaration("i",
+      type: coreTypes.intClass.rawType, isFinal: true);
+  Accessor accessor = IndexAccessor.make(listFieldAccessor.buildSimpleRead(),
+      new VariableAccessor(iParameter).buildSimpleRead(), null, null);
+  Procedure indexGet = new Procedure(
+      new Name("[]"),
+      ProcedureKind.Operator,
+      new FunctionNode(new ReturnStatement(accessor.buildSimpleRead()),
+          positionalParameters: <VariableDeclaration>[iParameter]),
+      fileUri: fileUri);
+
+  ///     operator[]= (int i, value) {
+  ///       list[i] = value;
+  ///     }
+  iParameter = new VariableDeclaration("i",
+      type: coreTypes.intClass.rawType, isFinal: true);
+  VariableDeclaration valueParameter =
+      new VariableDeclaration("value", isFinal: true);
+  accessor = IndexAccessor.make(listFieldAccessor.buildSimpleRead(),
+      new VariableAccessor(iParameter).buildSimpleRead(), null, null);
+  Expression expression = accessor.buildAssignment(
+      new VariableAccessor(valueParameter).buildSimpleRead(),
+      voidContext: true);
+  Procedure indexSet = new Procedure(
+      new Name("[]="),
+      ProcedureKind.Operator,
+      new FunctionNode(new ExpressionStatement(expression),
+          positionalParameters: <VariableDeclaration>[
+            iParameter,
+            valueParameter
+          ]),
+      fileUri: fileUri);
+
+  ///       Context copy() {
+  ///         Context c = new Context(list.length);
+  ///         c.parent = parent;
+  ///         c.list.setRange(0, list.length, list);
+  ///         return c;
+  ///       }
+  VariableDeclaration c = new VariableDeclaration("c",
+      initializer: new ConstructorInvocation(
+          constructor,
+          new Arguments(<Expression>[
+            new PropertyGet(
+                listFieldAccessor.buildSimpleRead(), new Name("length"))
+          ])));
+  Accessor accessCParent = PropertyAccessor.make(
+      new VariableGet(c), parentField.name, parentField, parentField);
+  Accessor accessCList = PropertyAccessor.make(
+      new VariableGet(c), listField.name, listField, null);
+  List<Statement> statements = <Statement>[
+    c,
+    new ExpressionStatement(accessCParent.buildAssignment(
+        parentFieldAccessor.buildSimpleRead(),
+        voidContext: true)),
+    new ExpressionStatement(new MethodInvocation(
+        accessCList.buildSimpleRead(),
+        new Name("setRange"),
+        new Arguments(<Expression>[
+          new IntLiteral(0),
+          new PropertyGet(
+              listFieldAccessor.buildSimpleRead(), new Name("length")),
+          listFieldAccessor.buildSimpleRead()
+        ]))),
+    new ReturnStatement(new VariableGet(c))
+  ];
+  Procedure copy = new Procedure(new Name("copy"), ProcedureKind.Method,
+      new FunctionNode(new Block(statements)),
+      fileUri: fileUri);
+
+  List<Procedure> procedures = <Procedure>[indexGet, indexSet, copy];
+
+  Class contextClass = new Class(
+      name: "Context",
+      supertype: new Supertype(coreTypes.objectClass, const <DartType>[]),
+      constructors: [constructor],
+      fields: fields,
+      procedures: procedures,
+      fileUri: fileUri);
+  Library mock = new Library(Uri.parse(fileUri),
+      name: "mock", classes: [contextClass])..fileUri = fileUri;
+  program.libraries.add(mock);
+  mock.parent = program;
+  program.uriToSource[mock.fileUri] = new Source(<int>[0], "");
+  return contextClass;
+}
diff --git a/pkg/kernel/lib/transformations/closure_conversion.dart b/pkg/kernel/lib/transformations/closure_conversion.dart
new file mode 100644
index 0000000..44ae828
--- /dev/null
+++ b/pkg/kernel/lib/transformations/closure_conversion.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library kernel.transformations.closure_conversion;
+
+import '../ast.dart' show Class, Program;
+
+import '../core_types.dart' show CoreTypes;
+
+import 'closure/converter.dart' show ClosureConverter;
+
+import 'closure/info.dart' show ClosureInfo;
+
+import 'closure/invalidate_closures.dart';
+import 'closure/mock.dart' show mockUpContext;
+
+Program transformProgram(Program program) {
+  var info = new ClosureInfo();
+  info.visitProgram(program);
+
+  CoreTypes coreTypes = new CoreTypes(program);
+  Class contextClass = mockUpContext(coreTypes, program);
+  var convert = new ClosureConverter(coreTypes, info, contextClass);
+  program = convert.visitProgram(program);
+  return new InvalidateClosures().visitProgram(program);
+}
diff --git a/pkg/kernel/lib/transformations/continuation.dart b/pkg/kernel/lib/transformations/continuation.dart
index fd6e1d2..f92d680 100644
--- a/pkg/kernel/lib/transformations/continuation.dart
+++ b/pkg/kernel/lib/transformations/continuation.dart
@@ -50,13 +50,12 @@
 abstract class ContinuationRewriterBase extends RecursiveContinuationRewriter {
   final FunctionNode enclosingFunction;
 
-  int currentTryDepth; // Nesting depth for try-blocks.
+  int currentTryDepth = 0; // Nesting depth for try-blocks.
   int currentCatchDepth = 0; // Nesting depth for catch-blocks.
   int capturedTryDepth = 0; // Deepest yield point within a try-block.
   int capturedCatchDepth = 0; // Deepest yield point within a catch-block.
 
-  ContinuationRewriterBase(HelperNodes helper, this.enclosingFunction,
-      {this.currentTryDepth: 0})
+  ContinuationRewriterBase(HelperNodes helper, this.enclosingFunction)
       : super(helper);
 
   Statement createContinuationPoint([Expression value]) {
@@ -68,28 +67,30 @@
 
   TreeNode visitTryCatch(TryCatch node) {
     if (node.body != null) {
-      currentTryDepth++;
+      ++currentTryDepth;
       node.body = node.body.accept(this);
       node.body?.parent = node;
-      currentTryDepth--;
+      --currentTryDepth;
     }
 
-    currentCatchDepth++;
+    ++currentCatchDepth;
     transformList(node.catches, this, node);
-    currentCatchDepth--;
+    --currentCatchDepth;
     return node;
   }
 
   TreeNode visitTryFinally(TryFinally node) {
     if (node.body != null) {
-      currentTryDepth++;
+      ++currentTryDepth;
       node.body = node.body.accept(this);
       node.body?.parent = node;
-      currentTryDepth--;
+      --currentTryDepth;
     }
     if (node.finalizer != null) {
+      ++currentCatchDepth;
       node.finalizer = node.finalizer.accept(this);
       node.finalizer?.parent = node;
+      --currentCatchDepth;
     }
     return node;
   }
@@ -125,9 +126,12 @@
     final function = new FunctionNode(buildClosureBody(),
         positionalParameters: [iteratorVariable],
         requiredParameterCount: 1,
-        asyncMarker: AsyncMarker.SyncYielding);
+        asyncMarker: AsyncMarker.SyncYielding)
+      ..fileOffset = enclosingFunction.fileOffset
+      ..fileEndOffset = enclosingFunction.fileEndOffset;
     final closureFunction =
-        new FunctionDeclaration(nestedClosureVariable, function);
+        new FunctionDeclaration(nestedClosureVariable, function)
+          ..fileOffset = enclosingFunction.parent.fileOffset;
 
     // return new _SyncIterable(:sync_body);
     final arguments = new Arguments([new VariableGet(nestedClosureVariable)]);
@@ -186,8 +190,7 @@
   ExpressionLifter expressionRewriter;
 
   AsyncRewriterBase(helper, enclosingFunction)
-      // Body is wrapped in the try-catch so initial currentTryDepth is 1.
-      : super(helper, enclosingFunction, currentTryDepth: 1) {}
+      : super(helper, enclosingFunction) {}
 
   void setupAsyncContinuations(List<Statement> statements) {
     expressionRewriter = new ExpressionLifter(this);
@@ -209,7 +212,9 @@
     final function = new FunctionNode(buildWrappedBody(),
         positionalParameters: parameters,
         requiredParameterCount: 0,
-        asyncMarker: AsyncMarker.SyncYielding);
+        asyncMarker: AsyncMarker.SyncYielding)
+      ..fileOffset = enclosingFunction.fileOffset
+      ..fileEndOffset = enclosingFunction.fileEndOffset;
 
     // The await expression lifter might have created a number of
     // [VariableDeclarations].
@@ -220,7 +225,8 @@
 
     // Now add the closure function itself.
     final closureFunction =
-        new FunctionDeclaration(nestedClosureVariable, function);
+        new FunctionDeclaration(nestedClosureVariable, function)
+          ..fileOffset = enclosingFunction.parent.fileOffset;
     statements.add(closureFunction);
 
     // :async_op_then = _asyncThenWrapperHelper(asyncBody);
@@ -241,9 +247,11 @@
   }
 
   Statement buildWrappedBody() {
+    ++currentTryDepth;
     labeledBody = new LabeledStatement(null);
     labeledBody.body = visitDelimited(enclosingFunction.body)
       ..parent = labeledBody;
+    --currentTryDepth;
 
     var exceptionVariable = new VariableDeclaration(":exception");
     var stackTraceVariable = new VariableDeclaration(":stack_trace");
@@ -528,13 +536,14 @@
       var iteratorVariable = new VariableDeclaration(':for-iterator',
           initializer: new ConstructorInvocation(
               helper.streamIteratorConstructor,
-              new Arguments(<Expression>[stmt.iterable])));
+              new Arguments(<Expression>[stmt.iterable],
+                  types: [const DynamicType()])));
 
       // await iterator.moveNext()
       var condition = new AwaitExpression(new MethodInvocation(
           new VariableGet(iteratorVariable),
           new Name('moveNext'),
-          new Arguments(<Expression>[])));
+          new Arguments(<Expression>[])))..fileOffset = stmt.fileOffset;
 
       // var <variable> = iterator.current;
       var valueVariable = stmt.variable;
@@ -610,7 +619,9 @@
     ++currentTryDepth;
     stmt.body = visitDelimited(stmt.body)..parent = stmt;
     --currentTryDepth;
+    ++currentCatchDepth;
     stmt.finalizer = visitDelimited(stmt.finalizer)..parent = stmt;
+    --currentCatchDepth;
     statements.add(stmt);
     return null;
   }
@@ -658,8 +669,9 @@
     // :controller = new _AsyncController(:async_op);
     var arguments =
         new Arguments(<Expression>[new VariableGet(nestedClosureVariable)]);
-    var buildController = new ConstructorInvocation(
-        helper.streamControllerConstructor, arguments);
+    var buildController =
+        new ConstructorInvocation(helper.streamControllerConstructor, arguments)
+          ..fileOffset = enclosingFunction.fileOffset;
     var setController = new ExpressionStatement(
         new VariableSet(controllerVariable, buildController));
     statements.add(setController);
@@ -676,10 +688,24 @@
     return enclosingFunction;
   }
 
+  Statement buildWrappedBody() {
+    ++currentTryDepth;
+    Statement body = super.buildWrappedBody();
+    --currentTryDepth;
+
+    var finallyBody = new ExpressionStatement(new MethodInvocation(
+        new VariableGet(controllerVariable),
+        new Name("close", helper.asyncLibrary),
+        new Arguments(<Expression>[])));
+
+    var tryFinally = new TryFinally(body, new Block(<Statement>[finallyBody]));
+    return tryFinally;
+  }
+
   Statement buildCatchBody(exceptionVariable, stackTraceVariable) {
     return new ExpressionStatement(new MethodInvocation(
         new VariableGet(controllerVariable),
-        new Name("completeError", helper.asyncLibrary),
+        new Name("addError", helper.asyncLibrary),
         new Arguments(<Expression>[
           new VariableGet(exceptionVariable),
           new VariableGet(stackTraceVariable)
@@ -691,11 +717,7 @@
     // have been translated into breaks from the labeled body.
     return new Block(<Statement>[
       body,
-      new ExpressionStatement(new MethodInvocation(
-          new VariableGet(controllerVariable),
-          new Name("close", helper.asyncLibrary),
-          new Arguments(<Expression>[]))),
-      new ReturnStatement()
+      new ReturnStatement()..fileOffset = enclosingFunction.fileEndOffset,
     ]);
   }
 
@@ -705,10 +727,12 @@
     var addExpression = new MethodInvocation(
         new VariableGet(controllerVariable),
         new Name(stmt.isYieldStar ? 'addStream' : 'add', helper.asyncLibrary),
-        new Arguments(<Expression>[expr]));
+        new Arguments(<Expression>[expr]))..fileOffset = stmt.fileOffset;
 
-    statements.add(new IfStatement(addExpression,
-        new ReturnStatement(new NullLiteral()), createContinuationPoint()));
+    statements.add(new IfStatement(
+        addExpression,
+        new ReturnStatement(new NullLiteral()),
+        createContinuationPoint()..fileOffset = stmt.fileOffset));
     return null;
   }
 
@@ -733,8 +757,9 @@
 
     // var :completer = new Completer.sync();
     completerVariable = new VariableDeclaration(":completer",
-        initializer: new StaticInvocation(
-            helper.completerConstructor, new Arguments([])),
+        initializer: new StaticInvocation(helper.completerConstructor,
+            new Arguments([], types: [const DynamicType()]))
+          ..fileOffset = enclosingFunction.body.fileOffset,
         isFinal: true);
     statements.add(completerVariable);
 
@@ -746,7 +771,9 @@
     // new Future.microtask(:async_op);
     var newMicrotaskStatement = new ExpressionStatement(new StaticInvocation(
         helper.futureMicrotaskConstructor,
-        new Arguments([new VariableGet(nestedClosureVariable)])));
+        new Arguments([new VariableGet(nestedClosureVariable)],
+            types: [const DynamicType()]))
+      ..fileOffset = enclosingFunction.fileOffset);
     statements.add(newMicrotaskStatement);
 
     // return :completer.future;
@@ -758,6 +785,7 @@
     enclosingFunction.body = new Block(statements);
     enclosingFunction.body.parent = enclosingFunction;
     enclosingFunction.asyncMarker = AsyncMarker.Sync;
+    enclosingFunction.debuggable = false;
     return enclosingFunction;
   }
 
@@ -780,7 +808,7 @@
           new VariableGet(completerVariable),
           new Name("complete", helper.asyncLibrary),
           new Arguments([new VariableGet(returnVariable)]))),
-      new ReturnStatement()
+      new ReturnStatement()..fileOffset = enclosingFunction.fileEndOffset
     ]);
   }
 
diff --git a/pkg/kernel/lib/transformations/insert_covariance_checks.dart b/pkg/kernel/lib/transformations/insert_covariance_checks.dart
new file mode 100644
index 0000000..662dda9
--- /dev/null
+++ b/pkg/kernel/lib/transformations/insert_covariance_checks.dart
@@ -0,0 +1,524 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+library kernel.transformations.insert_covariance_checks;
+
+import '../class_hierarchy.dart';
+import '../clone.dart';
+import '../core_types.dart';
+import '../kernel.dart';
+import '../log.dart';
+import '../type_algebra.dart';
+import '../type_environment.dart';
+
+// TODO: Should helper be removed?
+DartType substituteBounds(DartType type, Map<TypeParameter, DartType> upper,
+    Map<TypeParameter, DartType> lower) {
+  return Substitution
+      .fromUpperAndLowerBounds(upper, lower)
+      .substituteType(type);
+}
+
+/// Inserts checked entry points for methods in order to enforce type safety
+/// in face on covariant subtyping.
+///
+/// An 'unsafe parameter' is a parameter whose type mentions a class type
+/// parameter T, but is not contravariant in T.  For instance, the argument
+/// to `List.add` is unsafe, whereas the function parameter to `List.forEach`
+/// is safe:
+///
+///     class List<T> {
+///       ...
+///       void add(T x) {...} // unsafe
+///       void forEach(void action(T x)) {...} // safe
+///     }
+///
+/// For every method with unsafe parameters, a checked entry point suffixed
+/// with `$cc` is inserted, which casts the unsafe parameters to their expected
+/// types and calls the actual implementation:
+///
+///     class List<T> {
+///       ...
+///       void add$cc(Object x) => this.add(x as T);
+///     }
+///
+/// Calls whose interface target declares unsafe parameters are then rewritten
+/// to target the `$cc` entry point instead, unless it can be determined that
+/// the type argument is exact.  For example:
+///
+///     void foo(List<num> numbers) {
+///       numbers.add(3.5); // before
+///       numbers.add$cc(3.5); // after
+///     }
+///
+/// Currently, we only deduce that the type arguments are exact when the
+/// receiver is `this`.
+class InsertCovarianceChecks {
+  ClassHierarchy hierarchy;
+  CoreTypes coreTypes;
+  TypeEnvironment types;
+
+  /// Maps unsafe members to their checked entry point, to be used at call sites
+  /// where the arguments cannot be guaranteed to satisfy the generic parameter
+  /// types of the actual target.
+  final Map<Member, Procedure> unsafeMemberEntryPoint = <Member, Procedure>{};
+
+  /// Members that may be invoked through a checked entry point.
+  ///
+  /// Note that these members are not necessarily unsafe, because a safe member
+  /// can override an unsafe member, and thereby be invoked through a checked
+  /// entry point.  This set is not therefore not the same as the set of keys
+  /// in [unsafeMemberEntryPoint].
+  final Set<Member> membersWithCheckedEntryPoint = new Set<Member>();
+
+  InsertCovarianceChecks({this.hierarchy, this.coreTypes});
+
+  void transformProgram(Program program) {
+    hierarchy ??= new ClassHierarchy(program);
+    coreTypes ??= new CoreTypes(program);
+    types = new TypeEnvironment(coreTypes, hierarchy);
+    // We transform every class before their subtypes.
+    // This ensures that transitive overrides are taken into account.
+    hierarchy.classes.forEach(transformClass);
+
+    program.accept(new _CallTransformer(this));
+  }
+
+  void transformClass(Class class_) {
+    new _ClassTransformer(class_, this).transformClass();
+  }
+}
+
+class _ClassTransformer {
+  final Class host;
+  final ClassHierarchy hierarchy;
+  final TypeEnvironment types;
+  final InsertCovarianceChecks global;
+
+  final Map<Field, VariableDeclaration> fieldSetterParameter =
+      <Field, VariableDeclaration>{};
+
+  final Map<VariableDeclaration, List<DartType>> unsafeParameterTypes =
+      new Map<VariableDeclaration, List<DartType>>();
+
+  // The following four maps translate types from the context of a supertype
+  // into the context of the current class.
+  //
+  // When analyzing an override relation "ownMember <: superMember", the two
+  // "own" maps translate types from the context of the ownMember, while the
+  // "super" maps translate types from the context of superMember.
+  //
+  // The "substitution" maps translate type parameters to their exact type,
+  // while the "upper bound" maps translate type parameters to their erased
+  // upper bounds.
+  Map<TypeParameter, DartType> ownSubstitution;
+  Map<TypeParameter, DartType> ownUpperBounds;
+  Map<TypeParameter, DartType> superSubstitution;
+  Map<TypeParameter, DartType> superUpperBounds;
+
+  /// Members for which a checked entry point must be created in this current
+  /// class.
+  Set<Member> membersNeedingCheckedEntryPoint = new Set<Member>();
+
+  _ClassTransformer(this.host, InsertCovarianceChecks global)
+      : hierarchy = global.hierarchy,
+        types = global.types,
+        this.global = global;
+
+  /// Mark [parameter] unsafe, with [type] as a potential argument type.
+  void addUnsafeParameter(
+      VariableDeclaration parameter, DartType type, Member member) {
+    unsafeParameterTypes.putIfAbsent(parameter, () => <DartType>[]).add(type);
+    requireLocalCheckedEntryPoint(member);
+  }
+
+  /// Get a parameter representing the argument to the implicit setter
+  /// for [field].
+  VariableDeclaration getFieldSetterParameter(Field field) {
+    return fieldSetterParameter.putIfAbsent(field, () {
+      return new VariableDeclaration('${field.name.name}_', type: field.type);
+    });
+  }
+
+  /// Mark [field] as unsafe, with [type] as a potential argument to its setter.
+  void addUnsafeField(Field field, DartType type) {
+    addUnsafeParameter(getFieldSetterParameter(field), type, field);
+  }
+
+  /// True if [member] can be invoked through a checked entry point.
+  ///
+  /// This does not imply that the member has unsafe parameters.
+  bool hasCheckedEntryPoint(Member member, {bool setter: false}) {
+    if (!setter && member is Field) {
+      return false; // Field getters never have checked entry points.
+    }
+    return global.membersWithCheckedEntryPoint.contains(member);
+  }
+
+  /// Ensures that a checked entry point for [member] will be emitted in the
+  /// current class.
+  void requireLocalCheckedEntryPoint(Member member) {
+    if (membersNeedingCheckedEntryPoint.add(member)) {
+      global.membersWithCheckedEntryPoint.add(member);
+    }
+  }
+
+  void transformClass() {
+    if (host.isMixinApplication) {
+      // TODO(asgerf): We need a way to support mixin applications with unsafe
+      //   overrides. This version assumes mixins have been resolved by cloning.
+      //   We could generate a subclass of the mixin application containing the
+      //   checked entry points.
+      throw 'Mixin applications must be resolved before inserting covariance '
+          'checks';
+    }
+    // Find parameters with an unsafe reference to a class type parameter.
+    if (host.typeParameters.isNotEmpty) {
+      var upperBounds = getUpperBoundSubstitutionMap(host);
+      for (var field in host.fields) {
+        if (field.hasImplicitSetter) {
+          var rawType = substituteBounds(field.type, upperBounds, {});
+          if (!identical(rawType, field.type)) {
+            requireLocalCheckedEntryPoint(field);
+            addUnsafeField(field, rawType);
+          }
+        }
+      }
+      for (var procedure in host.procedures) {
+        if (procedure.isStatic) continue;
+        void handleParameter(VariableDeclaration parameter) {
+          var rawType = substituteBounds(parameter.type, upperBounds, {});
+          if (!identical(rawType, parameter.type)) {
+            requireLocalCheckedEntryPoint(procedure);
+            addUnsafeParameter(parameter, rawType, procedure);
+          }
+        }
+
+        procedure.function.positionalParameters.forEach(handleParameter);
+        procedure.function.namedParameters.forEach(handleParameter);
+      }
+    }
+
+    // Find (possibly inherited) members that override a method that has
+    // unsafe parameters.
+    hierarchy.forEachOverridePair(host,
+        (Member ownMember, Member superMember, bool isSetter) {
+      if (hasCheckedEntryPoint(superMember, setter: isSetter)) {
+        requireLocalCheckedEntryPoint(ownMember);
+      }
+      if (superMember.enclosingClass.typeParameters.isEmpty) return;
+      ownSubstitution = getSubstitutionMap(
+          hierarchy.getClassAsInstanceOf(host, ownMember.enclosingClass));
+      ownUpperBounds = getUpperBoundSubstitutionMap(ownMember.enclosingClass);
+      superSubstitution = getSubstitutionMap(
+          hierarchy.getClassAsInstanceOf(host, superMember.enclosingClass));
+      superUpperBounds =
+          getUpperBoundSubstitutionMap(superMember.enclosingClass);
+      if (ownMember is Procedure) {
+        if (superMember is Procedure) {
+          checkProcedureOverride(ownMember, superMember);
+        } else if (superMember is Field && isSetter) {
+          checkSetterFieldOverride(ownMember, superMember);
+        }
+      } else if (isSetter) {
+        checkFieldOverride(ownMember, superMember);
+      }
+    });
+
+    for (Member member in membersNeedingCheckedEntryPoint) {
+      ownSubstitution = getSubstitutionMap(
+          hierarchy.getClassAsInstanceOf(host, member.enclosingClass));
+      ownSubstitution = ensureMutable(ownSubstitution);
+      generateCheckedEntryPoint(member);
+    }
+  }
+
+  /// Compute an upper bound of the types in [inputTypes].
+  ///
+  /// We use this to compute a trustworthy type for a parameter, given a list
+  /// of types that may actually be passed into the parameter.
+  DartType getSafeType(List<DartType> inputTypes) {
+    var safeType = inputTypes[0];
+    for (int i = 1; i < inputTypes.length; ++i) {
+      if (inputTypes[i] != safeType) {
+        // Multiple types are being overridden. Fall back to dynamic.
+        // There are cases where a better upper bound could be found, but they
+        // are quite rare.
+        return const DynamicType();
+      }
+    }
+    return safeType;
+  }
+
+  void fail(String message) {
+    log.warning('[unsoundness] $message');
+  }
+
+  void checkFieldOverride(Field field, Member superMember) {
+    var fieldType =
+        substituteBounds(field.type, ownUpperBounds, ownSubstitution);
+    var superType = substituteBounds(
+        superMember.setterType, superUpperBounds, superSubstitution);
+    if (!types.isSubtypeOf(superType, fieldType)) {
+      addUnsafeField(field, superType);
+    }
+  }
+
+  void checkSetterFieldOverride(Procedure ownMember, Field superMember) {
+    assert(ownMember.isSetter);
+    var ownParameter = ownMember.function.positionalParameters[0];
+    var ownType =
+        substituteBounds(ownParameter.type, ownUpperBounds, ownSubstitution);
+    var superType = substituteBounds(
+        superMember.setterType, superUpperBounds, superSubstitution);
+    if (!types.isSubtypeOf(superType, ownType)) {
+      addUnsafeParameter(ownParameter, superType, ownMember);
+    }
+  }
+
+  void checkProcedureOverride(Procedure ownMember, Procedure superMember) {
+    var ownFunction = ownMember.function;
+    var superFunction = superMember.function;
+    // We perform some checks here to avoid crashing, but the frontend is
+    // responsible for generating IR that does not violate these restrictions.
+    if (ownFunction.requiredParameterCount >
+        superFunction.requiredParameterCount) {
+      fail('$ownMember requires more parameters than $superMember');
+      return;
+    }
+    if (ownFunction.positionalParameters.length <
+        superFunction.positionalParameters.length) {
+      fail('$ownMember allows fewer parameters than $superMember');
+      return;
+    }
+    if (ownFunction.typeParameters.length !=
+        superFunction.typeParameters.length) {
+      fail('$ownMember declares a different number of type parameters '
+          'than $superMember');
+      return;
+    }
+    if (superFunction.typeParameters.isNotEmpty) {
+      // Ensure these maps are not constant, so we can add bindings for the
+      // function type parameters.
+      superSubstitution = ensureMutable(superSubstitution);
+      superUpperBounds = ensureMutable(superUpperBounds);
+    }
+    for (int i = 0; i < superFunction.typeParameters.length; ++i) {
+      var ownTypeParameter = ownFunction.typeParameters[i];
+      var superTypeParameter = superFunction.typeParameters[i];
+      var type = new TypeParameterType(ownTypeParameter);
+      superSubstitution[superTypeParameter] = type;
+      superUpperBounds[superTypeParameter] = type;
+    }
+    void checkParameterPair(
+        VariableDeclaration ownParameter, VariableDeclaration superParameter) {
+      var ownType = substitute(ownParameter.type, ownSubstitution);
+      var superType = substituteBounds(
+          superParameter.type, superUpperBounds, superSubstitution);
+      if (!types.isSubtypeOf(superType, ownType)) {
+        addUnsafeParameter(ownParameter, superType, ownMember);
+      }
+    }
+
+    for (int i = 0; i < superFunction.positionalParameters.length; ++i) {
+      checkParameterPair(ownFunction.positionalParameters[i],
+          superFunction.positionalParameters[i]);
+    }
+    for (int i = 0; i < superFunction.namedParameters.length; ++i) {
+      var superParameter = superFunction.namedParameters[i];
+      bool found = false;
+      for (int j = 0; j < ownFunction.namedParameters.length; ++j) {
+        var ownParameter = ownFunction.namedParameters[j];
+        if (ownParameter.name == superParameter.name) {
+          found = true;
+          checkParameterPair(ownParameter, superParameter);
+          break;
+        }
+      }
+      if (!found) {
+        fail('$ownMember is missing the named parameter '
+            '${superParameter.name} from $superMember');
+      }
+    }
+  }
+
+  void generateCheckedEntryPoint(Member member) {
+    // TODO(asgerf): It may be worthwhile to try to reuse a checked entry
+    //   point from the supertype when the same checks are needed and the
+    //   dispatch target is the same.
+    if (member is Procedure) {
+      generateCheckedProcedure(member);
+    } else {
+      generateCheckedFieldSetter(member);
+    }
+  }
+
+  void generateCheckedProcedure(Procedure procedure) {
+    var function = procedure.function;
+
+    // Clone the function without its body.
+    var body = function.body;
+    function.body = null;
+    var cloner = new CloneVisitor(typeSubstitution: ownSubstitution);
+    Procedure checkedProcedure = cloner.clone(procedure);
+    FunctionNode checkedFunction = checkedProcedure.function;
+    function.body = body;
+
+    checkedFunction.asyncMarker = AsyncMarker.Sync;
+    checkedProcedure.isExternal = false;
+
+    Expression getParameter(VariableDeclaration parameter) {
+      var cloneParameter = cloner.variables[parameter];
+      var unsafeInputs = unsafeParameterTypes[parameter];
+      if (unsafeInputs == null) {
+        return new VariableGet(cloneParameter); // No check needed.
+      }
+      // Change the actual parameter type to the safe type, and cast to the
+      // type declared on the original parameter.
+      // Use the cloner to map function type parameters to the cloned
+      // function type parameters (in case the function is generic).
+      var targetType = cloneParameter.type;
+      cloneParameter.type = cloner.visitType(getSafeType(unsafeInputs));
+      return new AsExpression(new VariableGet(cloneParameter), targetType);
+    }
+
+    // TODO: Insert checks for type parameter bounds.
+    var types = checkedFunction.typeParameters
+        .map((p) => new TypeParameterType(p))
+        .toList();
+    var positional = function.positionalParameters.map(getParameter).toList();
+    var named = function.namedParameters
+        .map((p) => new NamedExpression(p.name, getParameter(p)))
+        .toList();
+
+    checkedProcedure.name = covariantCheckedName(procedure.name);
+    host.addMember(checkedProcedure);
+
+    // Only generate a body if the original method had one.
+    if (!procedure.isAbstract && !procedure.isInExternalLibrary) {
+      var call = procedure.isSetter
+          ? new DirectPropertySet(
+              new ThisExpression(), procedure, positional[0])
+          : new DirectMethodInvocation(new ThisExpression(), procedure,
+              new Arguments(positional, named: named, types: types));
+      var checkedBody = function.returnType is VoidType
+          ? new ExpressionStatement(call)
+          : new ReturnStatement(call);
+      checkedFunction.body = checkedBody..parent = checkedFunction;
+    }
+
+    if (procedure.enclosingClass == host) {
+      global.unsafeMemberEntryPoint[procedure] = checkedProcedure;
+    }
+  }
+
+  void generateCheckedFieldSetter(Field field) {
+    var parameter = getFieldSetterParameter(field);
+    var unsafeTypes = unsafeParameterTypes[parameter];
+    Expression argument = new VariableGet(parameter);
+    if (unsafeTypes != null) {
+      var castType = substitute(field.type, ownSubstitution);
+      argument = new AsExpression(argument, castType);
+      var inputType = substitute(getSafeType(unsafeTypes), ownSubstitution);
+      parameter.type = inputType;
+    }
+
+    Statement body = field.isInExternalLibrary
+        ? null
+        : new ExpressionStatement(
+            new DirectPropertySet(new ThisExpression(), field, argument));
+
+    var setter = new Procedure(
+        covariantCheckedName(field.name),
+        ProcedureKind.Setter,
+        new FunctionNode(body, positionalParameters: [parameter]));
+    host.addMember(setter);
+
+    if (field.enclosingClass == host) {
+      global.unsafeMemberEntryPoint[field] = setter;
+    }
+  }
+
+  /// Generates a synthetic name representing the covariant-checked entry point
+  /// to a method.
+  static Name covariantCheckedName(Name name) {
+    return new Name('${name.name}\$cc', name.library);
+  }
+
+  static Map<TypeParameter, DartType> ensureMutable(
+      Map<TypeParameter, DartType> map) {
+    if (map.isEmpty) return <TypeParameter, DartType>{};
+    return map;
+  }
+}
+
+// TODO(asgerf): We should be able to avoid checked calls in a lot more cases:
+//  - the arguments to every unsafe parameter is null or is omitted
+//  - allocation site of receiver can easily be seen statically
+class _CallTransformer extends RecursiveVisitor {
+  final InsertCovarianceChecks global;
+  final TypeEnvironment types;
+  final Map<Member, Procedure> checkedInterfaceMethod;
+
+  _CallTransformer(InsertCovarianceChecks global)
+      : checkedInterfaceMethod = global.unsafeMemberEntryPoint,
+        types = global.types,
+        this.global = global;
+
+  Member getChecked(Expression receiver, Member member) {
+    var checked = checkedInterfaceMethod[member];
+    if (checked == null) return member;
+    if (!receiverNeedsChecks(receiver)) return member;
+    return checked;
+  }
+
+  bool receiverNeedsChecks(Expression node) {
+    if (node is ThisExpression) return false;
+    var type = node.getStaticType(types);
+    if (type is InterfaceType && type.typeArguments.every(isSealedType)) {
+      return false;
+    }
+    return true;
+  }
+
+  bool isSealedType(DartType type) {
+    return type is InterfaceType && types.isSealedClass(type.classNode);
+  }
+
+  bool isTrustedLibrary(Library node) {
+    return node.importUri.scheme == 'dart';
+  }
+
+  @override
+  visitClass(Class node) {
+    types.thisType = node.thisType;
+    node.visitChildren(this);
+  }
+
+  @override
+  visitLibrary(Library node) {
+    if (!isTrustedLibrary(node)) {
+      node.visitChildren(this);
+    }
+  }
+
+  @override
+  visitMethodInvocation(MethodInvocation node) {
+    var target = getChecked(node.receiver, node.interfaceTarget);
+    if (target != null) {
+      node.interfaceTarget = target;
+      node.name = target.name;
+    }
+    node.visitChildren(this);
+  }
+
+  @override
+  visitPropertySet(PropertySet node) {
+    var target = getChecked(node.receiver, node.interfaceTarget);
+    if (target != null) {
+      node.interfaceTarget = target;
+      node.name = target.name;
+    }
+    node.visitChildren(this);
+  }
+}
diff --git a/pkg/kernel/lib/transformations/insert_type_checks.dart b/pkg/kernel/lib/transformations/insert_type_checks.dart
new file mode 100644
index 0000000..01db445
--- /dev/null
+++ b/pkg/kernel/lib/transformations/insert_type_checks.dart
@@ -0,0 +1,58 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+library kernel.transformations.insert_type_checks;
+
+import '../ast.dart';
+import '../class_hierarchy.dart';
+import '../core_types.dart';
+import '../log.dart';
+import '../type_checker.dart';
+
+/// Inserts implicit downcasts in method bodies to ensure type safety.
+///
+/// This does not deal with covariant override and covariant use of type
+/// parameters.
+///
+/// Ideally this should be done when initially generating kernel IR, but this
+/// is not practical at the moment.
+class InsertTypeChecks {
+  CoreTypes coreTypes;
+  ClassHierarchy hierarchy;
+
+  InsertTypeChecks({this.coreTypes, this.hierarchy});
+
+  void transformProgram(Program program) {
+    coreTypes ??= new CoreTypes(program);
+    hierarchy ??= new ClassHierarchy(program);
+    new CheckInsertingTypeChecker(coreTypes, hierarchy).checkProgram(program);
+  }
+}
+
+class CheckInsertingTypeChecker extends TypeChecker {
+  CheckInsertingTypeChecker(CoreTypes coreTypes, ClassHierarchy hierarchy)
+      : super(coreTypes, hierarchy);
+
+  @override
+  void fail(TreeNode where, String message) {
+    log.severe('${where.location}: $message');
+  }
+
+  @override
+  void checkAssignable(TreeNode where, DartType from, DartType to) {
+    if (!environment.isSubtypeOf(from, to)) {
+      fail(where, '$from cannot be assigned to $to');
+    }
+  }
+
+  @override
+  Expression checkAndDowncastExpression(
+      Expression expression, DartType from, DartType to) {
+    if (!environment.isSubtypeOf(from, to)) {
+      return new AsExpression(expression, to)
+        ..fileOffset = expression.fileOffset;
+    } else {
+      return expression;
+    }
+  }
+}
diff --git a/pkg/kernel/lib/transformations/mixin_full_resolution.dart b/pkg/kernel/lib/transformations/mixin_full_resolution.dart
index 7669b1a..1cd1160 100644
--- a/pkg/kernel/lib/transformations/mixin_full_resolution.dart
+++ b/pkg/kernel/lib/transformations/mixin_full_resolution.dart
@@ -311,7 +311,8 @@
     return new StaticInvocation(
         _listFrom,
         new Arguments([new ListLiteral(list)],
-            named: [new NamedExpression("growable", new BoolLiteral(false))]));
+            named: [new NamedExpression("growable", new BoolLiteral(false))],
+            types: [const DynamicType()]));
   }
 
   /// Check that a call to the targetFunction is legal given the arguments.
diff --git a/pkg/kernel/lib/transformations/sanitize_for_vm.dart b/pkg/kernel/lib/transformations/sanitize_for_vm.dart
index f5f86c3..fc83ab7 100644
--- a/pkg/kernel/lib/transformations/sanitize_for_vm.dart
+++ b/pkg/kernel/lib/transformations/sanitize_for_vm.dart
@@ -14,7 +14,7 @@
       for (var class_ in library.classes) {
         if (class_.constructors.isEmpty && class_.procedures.isEmpty) {
           class_.addMember(new Constructor(
-              new FunctionNode(new InvalidStatement()),
+              new FunctionNode(new EmptyStatement()),
               name: new Name('')));
         }
       }
diff --git a/pkg/kernel/lib/transformations/treeshaker.dart b/pkg/kernel/lib/transformations/treeshaker.dart
index bd33595..90540a0 100644
--- a/pkg/kernel/lib/transformations/treeshaker.dart
+++ b/pkg/kernel/lib/transformations/treeshaker.dart
@@ -7,6 +7,7 @@
 import '../ast.dart';
 import '../class_hierarchy.dart';
 import '../core_types.dart';
+import '../type_environment.dart';
 
 Program transformProgram(Program program) {
   new TreeShaker(program).transform(program);
@@ -27,7 +28,7 @@
 /// - for each member, a set of potential host classes
 /// - a set of names used in dynamic dispatch not on `this`
 ///
-/// The `dart:mirrors` library is not supported.
+/// If the `dart:mirrors` library is used then nothing will be tree-shaken.
 //
 // TODO(asgerf): Shake off parts of the core libraries based on the Target.
 // TODO(asgerf): Tree shake unused instance fields.
@@ -35,10 +36,19 @@
   final Program program;
   final ClassHierarchy hierarchy;
   final CoreTypes coreTypes;
+  final bool strongMode;
 
-  /// Names used in a dynamic dispatch invocation that could not be resolved
-  /// to a concrete target (i.e. not on `this`).
-  final Set<Name> _dispatchedNames = new Set<Name>();
+  /// Map from classes to set of names that have been dispatched with that class
+  /// as the static receiver type (meaning any subtype of that class can be
+  /// the potential concrete receiver).
+  ///
+  /// The map is implemented as a list, indexed by
+  /// [ClassHierarchy.getClassIndex].
+  final List<Set<Name>> _dispatchedNames;
+
+  /// Map from names to the set of classes that might be the concrete receiver
+  /// of a call with the given name.
+  final Map<Name, ClassSet> _receiversOfName = <Name, ClassSet>{};
 
   /// Instance members that are potential targets for dynamic dispatch, but
   /// whose name has not yet been seen in a dynamic dispatch invocation.
@@ -77,20 +87,41 @@
   /// Classes whose interface can be used by external code to invoke user code.
   final Set<Class> _escapedClasses = new Set<Class>();
 
+  /// Members that have been overridden by a member whose concrete body is
+  /// needed.  These must be preserved in order to maintain interface targets
+  /// for typed calls.
+  final Set<Member> _overriddenMembers = new Set<Member>();
+
+  final List<Expression> _typedCalls = <Expression>[];
+
   /// AST visitor for finding static uses and dynamic dispatches in code.
   _TreeShakerVisitor _visitor;
 
   /// AST visitor for analyzing type annotations on external members.
   _ExternalTypeVisitor _covariantVisitor;
   _ExternalTypeVisitor _contravariantVisitor;
-  _ExternalTypeVisitor _bivariantVisitor;
+  _ExternalTypeVisitor _invariantVisitor;
 
-  TreeShaker(Program program, {ClassHierarchy hierarchy, CoreTypes coreTypes})
+  Library _mirrorsLibrary;
+
+  /// Set to true if any use of the `dart:mirrors` API is found.
+  bool isUsingMirrors = false;
+
+  TreeShaker(Program program,
+      {ClassHierarchy hierarchy, CoreTypes coreTypes, bool strongMode: false})
       : this._internal(program, hierarchy ?? new ClassHierarchy(program),
-            coreTypes ?? new CoreTypes(program));
+            coreTypes ?? new CoreTypes(program), strongMode);
+
+  bool isMemberBodyUsed(Member member) {
+    return _usedMembers.containsKey(member);
+  }
+
+  bool isMemberOverridden(Member member) {
+    return _overriddenMembers.contains(member);
+  }
 
   bool isMemberUsed(Member member) {
-    return _usedMembers.containsKey(member);
+    return isMemberBodyUsed(member) || isMemberOverridden(member);
   }
 
   bool isInstantiated(Class classNode) {
@@ -110,11 +141,14 @@
   ///
   /// This removes unused classes, members, and hierarchy data.
   void transform(Program program) {
+    if (isUsingMirrors) return; // Give up if using mirrors.
     new _TreeShakingTransformer(this).transform(program);
   }
 
-  TreeShaker._internal(this.program, ClassHierarchy hierarchy, this.coreTypes)
+  TreeShaker._internal(
+      this.program, ClassHierarchy hierarchy, this.coreTypes, this.strongMode)
       : this.hierarchy = hierarchy,
+        this._dispatchedNames = new List<Set<Name>>(hierarchy.classes.length),
         this._usedMembersWithHost =
             new List<Set<Member>>(hierarchy.classes.length),
         this._classRetention = new List<ClassRetention>.filled(
@@ -123,9 +157,14 @@
     _covariantVisitor = new _ExternalTypeVisitor(this, isCovariant: true);
     _contravariantVisitor =
         new _ExternalTypeVisitor(this, isContravariant: true);
-    _bivariantVisitor = new _ExternalTypeVisitor(this,
+    _invariantVisitor = new _ExternalTypeVisitor(this,
         isCovariant: true, isContravariant: true);
-    _build();
+    _mirrorsLibrary = coreTypes.getCoreLibrary('dart:mirrors');
+    try {
+      _build();
+    } on _UsingMirrorsException {
+      isUsingMirrors = true;
+    }
   }
 
   void _build() {
@@ -137,10 +176,32 @@
       _addInstantiatedExternalSubclass(coreTypes.listClass);
       _addInstantiatedExternalSubclass(coreTypes.stringClass);
     }
-    _addDispatchedName(new Name('noSuchMethod'));
+    _addDispatchedName(hierarchy.rootClass, new Name('noSuchMethod'));
     _addPervasiveUses();
     _addUsedMember(null, program.mainMethod);
     _iterateWorklist();
+
+    // Mark overridden members in order to preserve abstract members as
+    // necessary.
+    if (strongMode) {
+      for (int i = hierarchy.classes.length - 1; i >= 0; --i) {
+        Class class_ = hierarchy.classes[i];
+        if (isHierarchyUsed(class_)) {
+          hierarchy.forEachOverridePair(class_,
+              (Member ownMember, Member superMember, bool isSetter) {
+            if (isMemberBodyUsed(ownMember) ||
+                _overriddenMembers.contains(ownMember)) {
+              _overriddenMembers.add(superMember);
+              // Ensure the types mentioned in the member can be preserved.
+              _visitor.visitMemberInterface(superMember);
+            }
+          });
+        }
+      }
+      // Marking members as overridden should not cause new code to become
+      // reachable.
+      assert(_worklist.isEmpty);
+    }
   }
 
   /// Registers some extremely commonly used core classes as instantiated, so
@@ -150,26 +211,53 @@
     _addInstantiatedExternalSubclass(coreTypes.intClass);
     _addInstantiatedExternalSubclass(coreTypes.boolClass);
     _addInstantiatedExternalSubclass(coreTypes.nullClass);
+    _addInstantiatedExternalSubclass(coreTypes.functionClass);
+    _addInstantiatedExternalSubclass(coreTypes.invocationClass);
   }
 
   /// Registers the given name as seen in a dynamic dispatch, and discovers used
   /// instance members accordingly.
-  void _addDispatchedName(Name name) {
+  void _addDispatchedName(Class receiver, Name name) {
+    int index = hierarchy.getClassIndex(receiver);
+    Set<Name> receiverNames = _dispatchedNames[index] ??= new Set<Name>();
     // TODO(asgerf): make use of selector arity and getter/setter kind
-    if (_dispatchedNames.add(name)) {
-      List<TreeNode> targets = _dispatchTargetCandidates[name];
-      if (targets != null) {
-        for (int i = 0; i < targets.length; i += 2) {
-          _addUsedMember(targets[i], targets[i + 1]);
+    if (receiverNames.add(name)) {
+      List<TreeNode> candidates = _dispatchTargetCandidates[name];
+      if (candidates != null) {
+        for (int i = 0; i < candidates.length; i += 2) {
+          Class host = candidates[i];
+          if (hierarchy.isSubtypeOf(host, receiver)) {
+            // This (host, member) pair is a potential target of the dispatch.
+            Member member = candidates[i + 1];
+
+            // Remove the (host,member) pair from the candidate list.
+            // Move the last pair into the current index and shrink the list.
+            int lastPair = candidates.length - 2;
+            candidates[i] = candidates[lastPair];
+            candidates[i + 1] = candidates[lastPair + 1];
+            candidates.length -= 2;
+            i -= 2; // Revisit the same index now that it has been updated.
+
+            // Mark the pair as used.  This should be done after removing it
+            // from the candidate list, since this call may recursively scan
+            // for more used members.
+            _addUsedMember(host, member);
+          }
         }
       }
+      var subtypes = hierarchy.getSubtypesOf(receiver);
+      var receiverSet = _receiversOfName[name];
+      _receiversOfName[name] = receiverSet == null
+          ? subtypes
+          : _receiversOfName[name].union(subtypes);
     }
   }
 
   /// Registers the given method as a potential target of dynamic dispatch on
   /// the given class.
   void _addDispatchTarget(Class host, Member member) {
-    if (_dispatchedNames.contains(member.name)) {
+    ClassSet receivers = _receiversOfName[member.name];
+    if (receivers != null && receivers.contains(host)) {
       _addUsedMember(host, member);
     } else {
       _dispatchTargetCandidates.putIfAbsent(member.name, _makeTreeNodeList)
@@ -213,6 +301,11 @@
       } else {
         _addCallToExternalProcedure(member);
       }
+      _addDispatchTarget(classNode, member);
+    }
+    for (Member member
+        in hierarchy.getInterfaceMembers(classNode, setters: true)) {
+      _addDispatchTarget(classNode, member);
     }
   }
 
@@ -307,6 +400,9 @@
   ///   the initializer list of another constructor.
   /// - Procedures are used if they can be invoked or torn off.
   void _addUsedMember(Class host, Member member) {
+    if (member.enclosingLibrary == _mirrorsLibrary) {
+      throw new _UsingMirrorsException();
+    }
     if (host != null) {
       // Check if the member has been seen with this host before.
       int index = hierarchy.getClassIndex(host);
@@ -349,7 +445,7 @@
     if (!_escapedClasses.add(node)) return;
     for (Member member in hierarchy.getInterfaceMembers(node)) {
       if (member is Procedure) {
-        _addDispatchedName(member.name);
+        _addDispatchedName(node, member.name);
       }
     }
   }
@@ -418,15 +514,47 @@
 class _TreeShakerVisitor extends RecursiveVisitor {
   final TreeShaker shaker;
   final CoreTypes coreTypes;
+  final TypeEnvironment types;
+  final bool strongMode;
   List<Node> summary;
 
   _TreeShakerVisitor(TreeShaker shaker)
       : this.shaker = shaker,
-        this.coreTypes = shaker.coreTypes;
+        this.coreTypes = shaker.coreTypes,
+        this.strongMode = shaker.strongMode,
+        this.types = new TypeEnvironment(shaker.coreTypes, shaker.hierarchy) {
+    types.errorHandler = handleError;
+  }
 
-  void analyzeAndBuildSummary(Node node, List<Node> summary) {
+  void handleError(TreeNode node, String message) {
+    print('[error] $message (${node.location})');
+  }
+
+  void analyzeAndBuildSummary(Member member, List<Node> summary) {
     this.summary = summary;
-    node.accept(this);
+    types.thisType = member.enclosingClass?.thisType;
+    member.accept(this);
+  }
+
+  void visitMemberInterface(Member node) {
+    if (node is Field) {
+      node.type.accept(this);
+    } else if (node is Procedure) {
+      visitFunctionInterface(node.function);
+    }
+  }
+
+  visitFunctionInterface(FunctionNode node) {
+    for (var parameter in node.typeParameters) {
+      parameter.bound.accept(this);
+    }
+    for (var parameter in node.positionalParameters) {
+      parameter.type.accept(this);
+    }
+    for (var parameter in node.namedParameters) {
+      parameter.type.accept(this);
+    }
+    node.returnType.accept(this);
   }
 
   @override
@@ -504,12 +632,34 @@
     node.visitChildren(this);
   }
 
+  Class getKnownSupertype(DartType type) {
+    if (type is InterfaceType) {
+      return type.classNode;
+    } else if (type is TypeParameterType) {
+      return getKnownSupertype(type.parameter.bound);
+    } else if (type is FunctionType) {
+      return coreTypes.functionClass;
+    } else if (type is BottomType) {
+      return coreTypes.nullClass;
+    } else {
+      return coreTypes.objectClass;
+    }
+  }
+
+  Class getStaticType(Expression node) {
+    if (!strongMode) return coreTypes.objectClass;
+    return getKnownSupertype(node.getStaticType(types));
+  }
+
   @override
   visitMethodInvocation(MethodInvocation node) {
     if (node.receiver is ThisExpression) {
       addSelfDispatch(node.name);
     } else {
-      shaker._addDispatchedName(node.name);
+      shaker._addDispatchedName(getStaticType(node.receiver), node.name);
+      if (node.interfaceTarget != null) {
+        shaker._typedCalls.add(node);
+      }
     }
     node.visitChildren(this);
   }
@@ -551,7 +701,10 @@
     if (node.receiver is ThisExpression) {
       addSelfDispatch(node.name);
     } else {
-      shaker._addDispatchedName(node.name);
+      shaker._addDispatchedName(getStaticType(node.receiver), node.name);
+      if (node.interfaceTarget != null) {
+        shaker._typedCalls.add(node);
+      }
     }
     node.visitChildren(this);
   }
@@ -561,7 +714,10 @@
     if (node.receiver is ThisExpression) {
       addSelfDispatch(node.name, setter: true);
     } else {
-      shaker._addDispatchedName(node.name);
+      shaker._addDispatchedName(getStaticType(node.receiver), node.name);
+      if (node.interfaceTarget != null) {
+        shaker._typedCalls.add(node);
+      }
     }
     node.visitChildren(this);
   }
@@ -582,7 +738,9 @@
 
   @override
   visitStringConcatenation(StringConcatenation node) {
-    shaker._addDispatchedName(_toStringName);
+    for (var expression in node.expressions) {
+      shaker._addDispatchedName(getStaticType(expression), _toStringName);
+    }
     node.visitChildren(this);
   }
 
@@ -593,6 +751,12 @@
   }
 
   @override
+  visitSupertype(Supertype node) {
+    shaker._addClassUsedInType(node.classNode);
+    node.visitChildren(this);
+  }
+
+  @override
   visitDoubleLiteral(DoubleLiteral node) {
     shaker._addInstantiatedExternalSubclass(coreTypes.doubleClass);
   }
@@ -600,8 +764,6 @@
   @override
   visitSymbolLiteral(SymbolLiteral node) {
     shaker._addInstantiatedExternalSubclass(coreTypes.symbolClass);
-    // Note: we do not support 'dart:mirrors' right now, so nothing else needs
-    // to be done for symbols.
   }
 
   @override
@@ -640,17 +802,34 @@
 
   _TreeShakingTransformer(this.shaker);
 
+  Member _translateInterfaceTarget(Member target) {
+    return target != null && shaker.isMemberUsed(target) ? target : null;
+  }
+
   void transform(Program program) {
     for (var library in program.libraries) {
       if (library.importUri.scheme == 'dart') {
-        // As long as patching happens in the backend, we cannot shake off
-        // anything in the core libraries.
+        // The backend expects certain things to be present in the core
+        // libraries, so we currently don't shake off anything there.
         continue;
       }
       library.transformChildren(this);
       // Note: we can't shake off empty libraries yet since we don't check if
       // there are private names that use the library.
     }
+    for (Expression node in shaker._typedCalls) {
+      // We should not leave dangling references, so if the target of a typed
+      // call has been removed, we must remove the reference.  The receiver of
+      // such a call can only be null.
+      // TODO(asgerf): Rewrite to a NSM call instead of adding dynamic calls.
+      if (node is MethodInvocation) {
+        node.interfaceTarget = _translateInterfaceTarget(node.interfaceTarget);
+      } else if (node is PropertyGet) {
+        node.interfaceTarget = _translateInterfaceTarget(node.interfaceTarget);
+      } else if (node is PropertySet) {
+        node.interfaceTarget = _translateInterfaceTarget(node.interfaceTarget);
+      }
+    }
   }
 
   Class visitClass(Class node) {
@@ -665,28 +844,47 @@
         node.supertype = shaker.coreTypes.objectClass.asRawSupertype;
         node.implementedTypes.clear();
         node.typeParameters.clear();
+        node.isAbstract = true;
         // Mixin applications cannot have static members.
         assert(node.mixedInType == null);
         // Unused members will be removed below.
         break;
 
       case ClassRetention.Hierarchy:
+        node.isAbstract = true;
+        break;
+
       case ClassRetention.Instance:
       case ClassRetention.ExternalInstance:
         break;
     }
     node.transformChildren(this);
-    if (node.constructors.isEmpty && node.procedures.isEmpty) {
-      // The VM does not like classes without any members, so ensure there is
-      // always a constructor left.
-      node.addMember(new Constructor(new FunctionNode(new EmptyStatement())));
-    }
     return node;
   }
 
   Member defaultMember(Member node) {
-    if (!shaker.isMemberUsed(node)) {
-      return null; // Remove unused member.
+    if (!shaker.isMemberBodyUsed(node)) {
+      if (!shaker.isMemberOverridden(node)) {
+        return null;
+      }
+      if (node is Procedure) {
+        // Remove body of unused member.
+        if (node.enclosingClass.isAbstract) {
+          node.isAbstract = true;
+          node.function.body = null;
+        } else {
+          // If the enclosing class is not abstract, the method should still
+          // have a body even if it can never be called.
+          if (node.function.body != null) {
+            node.function.body = new ExpressionStatement(
+                new Throw(new StringLiteral('Method removed by tree-shaking')))
+              ..parent = node.function;
+          }
+        }
+        node.function.asyncMarker = AsyncMarker.Sync;
+      } else if (node is Field) {
+        node.initializer = null;
+      }
     }
     return node;
   }
@@ -720,7 +918,7 @@
 
   visitCovariant(DartType type) => type?.accept(this);
 
-  visitBivariant(DartType type) => shaker._bivariantVisitor.visit(type);
+  visitInvariant(DartType type) => shaker._invariantVisitor.visit(type);
 
   visitInvalidType(InvalidType node) {}
 
@@ -747,7 +945,7 @@
       if (isWhitelistedCovariant(node.classNode)) {
         visitCovariant(typeArgument);
       } else {
-        visitBivariant(typeArgument);
+        visitInvariant(typeArgument);
       }
     }
   }
@@ -777,3 +975,7 @@
         classNode == coreTypes.mapClass;
   }
 }
+
+/// Exception that is thrown to stop the tree shaking analysis when a use
+/// of `dart:mirrors` is found.
+class _UsingMirrorsException {}
diff --git a/pkg/kernel/lib/type_algebra.dart b/pkg/kernel/lib/type_algebra.dart
index 19508b1..ce4a553 100644
--- a/pkg/kernel/lib/type_algebra.dart
+++ b/pkg/kernel/lib/type_algebra.dart
@@ -30,6 +30,18 @@
           type.classNode.typeParameters, type.typeArguments);
 }
 
+Map<TypeParameter, DartType> getUpperBoundSubstitutionMap(Class host) {
+  if (host.typeParameters.isEmpty) return const <TypeParameter, DartType>{};
+  var result = <TypeParameter, DartType>{};
+  for (var parameter in host.typeParameters) {
+    result[parameter] = const DynamicType();
+  }
+  for (var parameter in host.typeParameters) {
+    result[parameter] = substitute(parameter.bound, result);
+  }
+  return result;
+}
+
 /// Like [substitute], except when a type in the [substitution] map references
 /// another substituted type variable, the mapping for that type is recursively
 /// inserted.
@@ -180,6 +192,21 @@
     return new _ClassBottomSubstitution(class_);
   }
 
+  /// Substitutes covariant uses of [class_]'s type parameters with the upper
+  /// bound of that type parameter.  Recursive references in the bound have
+  /// been replaced by dynamic.
+  static Substitution upperBoundForClass(Class class_) {
+    if (class_.typeParameters.isEmpty) return _NullSubstitution.instance;
+    var upper = <TypeParameter, DartType>{};
+    for (var parameter in class_.typeParameters) {
+      upper[parameter] = const DynamicType();
+    }
+    for (var parameter in class_.typeParameters) {
+      upper[parameter] = substitute(parameter.bound, upper);
+    }
+    return fromUpperAndLowerBounds(upper, {});
+  }
+
   /// Substitutes both variables from [first] and [second], favoring those from
   /// [first] if they overlap.
   ///
diff --git a/pkg/kernel/lib/type_checker.dart b/pkg/kernel/lib/type_checker.dart
index ab0351e..45159b2 100644
--- a/pkg/kernel/lib/type_checker.dart
+++ b/pkg/kernel/lib/type_checker.dart
@@ -85,6 +85,16 @@
   /// [where] is an AST node indicating roughly where the check is required.
   void checkAssignable(TreeNode where, DartType from, DartType to);
 
+  /// Checks that [expression], which has type [from], can be assigned to [to].
+  ///
+  /// Should return a downcast if necessary, or [expression] if no cast is
+  /// needed.
+  Expression checkAndDowncastExpression(
+      Expression expression, DartType from, DartType to) {
+    checkAssignable(expression, from, to);
+    return expression;
+  }
+
   /// Indicates that type checking failed.
   void fail(TreeNode where, String message);
 }
@@ -108,8 +118,16 @@
     checker.checkAssignable(where, from, to);
   }
 
-  void checkAssignableExpression(Expression from, DartType to) {
-    checker.checkAssignable(from, visitExpression(from), to);
+  Expression checkAndDowncastExpression(Expression from, DartType to) {
+    var parent = from.parent;
+    var type = visitExpression(from);
+    var result = checker.checkAndDowncastExpression(from, type, to);
+    result.parent = parent;
+    return result;
+  }
+
+  void checkExpressionNoDowncast(Expression expression, DartType to) {
+    checkAssignable(expression, visitExpression(expression), to);
   }
 
   void fail(TreeNode node, String message) {
@@ -146,7 +164,8 @@
 
   visitField(Field node) {
     if (node.initializer != null) {
-      checkAssignableExpression(node.initializer, node.type);
+      node.initializer =
+          checkAndDowncastExpression(node.initializer, node.type);
     }
   }
 
@@ -188,7 +207,8 @@
 
   void handleOptionalParameter(VariableDeclaration parameter) {
     if (parameter.initializer != null) {
-      checkAssignableExpression(parameter.initializer, parameter.type);
+      // Default parameter values cannot be downcast.
+      checkExpressionNoDowncast(parameter.initializer, parameter.type);
     }
   }
 
@@ -255,7 +275,8 @@
       var expectedType = substitution.substituteType(
           function.positionalParameters[i].type,
           contravariant: true);
-      checkAssignableExpression(arguments.positional[i], expectedType);
+      arguments.positional[i] =
+          checkAndDowncastExpression(arguments.positional[i], expectedType);
     }
     for (int i = 0; i < arguments.named.length; ++i) {
       var argument = arguments.named[i];
@@ -265,7 +286,8 @@
           var expectedType = substitution.substituteType(
               function.namedParameters[j].type,
               contravariant: true);
-          checkAssignableExpression(argument.value, expectedType);
+          argument.value =
+              checkAndDowncastExpression(argument.value, expectedType);
           found = true;
           break;
         }
@@ -344,9 +366,11 @@
 
   @override
   DartType visitConditionalExpression(ConditionalExpression node) {
-    checkAssignableExpression(node.condition, environment.boolType);
-    checkAssignableExpression(node.then, node.staticType);
-    checkAssignableExpression(node.otherwise, node.staticType);
+    node.condition =
+        checkAndDowncastExpression(node.condition, environment.boolType);
+    node.then = checkAndDowncastExpression(node.then, node.staticType);
+    node.otherwise =
+        checkAndDowncastExpression(node.otherwise, node.staticType);
     return node.staticType;
   }
 
@@ -419,24 +443,25 @@
 
   @override
   DartType visitListLiteral(ListLiteral node) {
-    for (var item in node.expressions) {
-      checkAssignableExpression(item, node.typeArgument);
+    for (int i = 0; i < node.expressions.length; ++i) {
+      node.expressions[i] =
+          checkAndDowncastExpression(node.expressions[i], node.typeArgument);
     }
     return environment.literalListType(node.typeArgument);
   }
 
   @override
   DartType visitLogicalExpression(LogicalExpression node) {
-    checkAssignableExpression(node.left, environment.boolType);
-    checkAssignableExpression(node.right, environment.boolType);
+    node.left = checkAndDowncastExpression(node.left, environment.boolType);
+    node.right = checkAndDowncastExpression(node.right, environment.boolType);
     return environment.boolType;
   }
 
   @override
   DartType visitMapLiteral(MapLiteral node) {
     for (var entry in node.entries) {
-      checkAssignableExpression(entry.key, node.keyType);
-      checkAssignableExpression(entry.value, node.valueType);
+      entry.key = checkAndDowncastExpression(entry.key, node.keyType);
+      entry.value = checkAndDowncastExpression(entry.value, node.valueType);
     }
     return environment.literalMapType(node.keyType, node.valueType);
   }
@@ -467,7 +492,8 @@
       var expectedType = instantiation.substituteType(
           function.positionalParameters[i],
           contravariant: true);
-      checkAssignableExpression(arguments.positional[i], expectedType);
+      arguments.positional[i] =
+          checkAndDowncastExpression(arguments.positional[i], expectedType);
     }
     for (int i = 0; i < arguments.named.length; ++i) {
       var argument = arguments.named[i];
@@ -477,7 +503,8 @@
           var expectedType = instantiation.substituteType(
               function.namedParameters[j].type,
               contravariant: true);
-          checkAssignableExpression(argument.value, expectedType);
+          argument.value =
+              checkAndDowncastExpression(argument.value, expectedType);
           found = true;
           break;
         }
@@ -674,7 +701,8 @@
   @override
   visitDoStatement(DoStatement node) {
     visitStatement(node.body);
-    checkAssignableExpression(node.condition, environment.boolType);
+    node.condition =
+        checkAndDowncastExpression(node.condition, environment.boolType);
   }
 
   @override
@@ -700,23 +728,27 @@
   }
 
   static final Name iteratorName = new Name('iterator');
-  static final Name nextName = new Name('next');
+  static final Name currentName = new Name('current');
 
   DartType getIterableElementType(DartType iterable) {
     if (iterable is InterfaceType) {
       var iteratorGetter =
           hierarchy.getInterfaceMember(iterable.classNode, iteratorName);
       if (iteratorGetter == null) return const DynamicType();
+      var castedIterable = hierarchy.getTypeAsInstanceOf(
+          iterable, iteratorGetter.enclosingClass);
       var iteratorType = Substitution
-          .fromInterfaceType(iterable)
+          .fromInterfaceType(castedIterable)
           .substituteType(iteratorGetter.getterType);
       if (iteratorType is InterfaceType) {
-        var nextGetter =
-            hierarchy.getInterfaceMember(iteratorType.classNode, nextName);
-        if (nextGetter == null) return const DynamicType();
+        var currentGetter =
+            hierarchy.getInterfaceMember(iteratorType.classNode, currentName);
+        if (currentGetter == null) return const DynamicType();
+        var castedIteratorType = hierarchy.getTypeAsInstanceOf(
+            iteratorType, currentGetter.enclosingClass);
         return Substitution
-            .fromInterfaceType(iteratorType)
-            .substituteType(nextGetter.getterType);
+            .fromInterfaceType(castedIteratorType)
+            .substituteType(currentGetter.getterType);
       }
     }
     return const DynamicType();
@@ -736,7 +768,8 @@
   visitForStatement(ForStatement node) {
     node.variables.forEach(visitVariableDeclaration);
     if (node.condition != null) {
-      checkAssignableExpression(node.condition, environment.boolType);
+      node.condition =
+          checkAndDowncastExpression(node.condition, environment.boolType);
     }
     node.updates.forEach(visitExpression);
     visitStatement(node.body);
@@ -749,7 +782,8 @@
 
   @override
   visitIfStatement(IfStatement node) {
-    checkAssignableExpression(node.condition, environment.boolType);
+    node.condition =
+        checkAndDowncastExpression(node.condition, environment.boolType);
     visitStatement(node.then);
     if (node.otherwise != null) {
       visitStatement(node.otherwise);
@@ -805,13 +839,15 @@
   @override
   visitVariableDeclaration(VariableDeclaration node) {
     if (node.initializer != null) {
-      checkAssignableExpression(node.initializer, node.type);
+      node.initializer =
+          checkAndDowncastExpression(node.initializer, node.type);
     }
   }
 
   @override
   visitWhileStatement(WhileStatement node) {
-    checkAssignableExpression(node.condition, environment.boolType);
+    node.condition =
+        checkAndDowncastExpression(node.condition, environment.boolType);
     visitStatement(node.body);
   }
 
@@ -832,13 +868,14 @@
         fail(node.expression, '$type is not an instance of $container');
       }
     } else {
-      checkAssignableExpression(node.expression, environment.yieldType);
+      node.expression =
+          checkAndDowncastExpression(node.expression, environment.yieldType);
     }
   }
 
   @override
   visitFieldInitializer(FieldInitializer node) {
-    checkAssignableExpression(node.value, node.field.type);
+    node.value = checkAndDowncastExpression(node.value, node.field.type);
   }
 
   @override
@@ -850,7 +887,8 @@
   @override
   visitSuperInitializer(SuperInitializer node) {
     handleCall(node.arguments, node.target.function,
-        typeParameters: const <TypeParameter>[]);
+        typeParameters: const <TypeParameter>[],
+        receiver: getSuperReceiverType(node.target));
   }
 
   @override
diff --git a/pkg/kernel/lib/type_environment.dart b/pkg/kernel/lib/type_environment.dart
index c354c44..0b90cb4 100644
--- a/pkg/kernel/lib/type_environment.dart
+++ b/pkg/kernel/lib/type_environment.dart
@@ -95,7 +95,11 @@
     Class class_ = member.enclosingClass;
     if (class_ == coreTypes.intClass || class_ == coreTypes.numClass) {
       String name = member.name.name;
-      return name == '+' || name == '-' || name == '*' || name == 'remainder';
+      return name == '+' ||
+          name == '-' ||
+          name == '*' ||
+          name == 'remainder' ||
+          name == '%';
     }
     return false;
   }
@@ -114,6 +118,21 @@
     if (type1 == doubleType || type2 == doubleType) return doubleType;
     return numType;
   }
+
+  /// Returns true if [class_] has no proper subtypes that are usable as type
+  /// argument.
+  bool isSealedClass(Class class_) {
+    // The sealed core classes have subtypes in the patched SDK, but those
+    // classes cannot occur as type argument.
+    if (class_ == coreTypes.intClass ||
+        class_ == coreTypes.doubleClass ||
+        class_ == coreTypes.stringClass ||
+        class_ == coreTypes.boolClass ||
+        class_ == coreTypes.nullClass) {
+      return true;
+    }
+    return !hierarchy.hasProperSubtypes(class_);
+  }
 }
 
 /// The part of [TypeEnvironment] that deals with subtype tests.
@@ -128,7 +147,9 @@
   bool isSubtypeOf(DartType subtype, DartType supertype) {
     if (identical(subtype, supertype)) return true;
     if (subtype is BottomType) return true;
-    if (supertype is DynamicType || supertype == objectType) {
+    if (supertype is DynamicType ||
+        supertype is VoidType ||
+        supertype == objectType) {
       return true;
     }
     if (subtype is InterfaceType && supertype is InterfaceType) {
@@ -194,8 +215,7 @@
       }
       subtype = substitute(subtype.withoutTypeParameters, substitution);
     }
-    if (supertype.returnType is! VoidType &&
-        !isSubtypeOf(subtype.returnType, supertype.returnType)) {
+    if (!isSubtypeOf(subtype.returnType, supertype.returnType)) {
       return false;
     }
     for (int i = 0; i < supertype.positionalParameters.length; ++i) {
diff --git a/pkg/kernel/lib/type_propagation/canonicalizer.dart b/pkg/kernel/lib/type_propagation/canonicalizer.dart
index 420bd01..60192b5 100644
--- a/pkg/kernel/lib/type_propagation/canonicalizer.dart
+++ b/pkg/kernel/lib/type_propagation/canonicalizer.dart
@@ -99,8 +99,8 @@
   Iterable<T> get values => _table.values;
 
   static int _bigintHash(int bigint) {
-  	int x = 0x3fffffff & (bigint >> 31);
-  	int y = 0x3fffffff & bigint;
+    int x = 0x3fffffff & (bigint >> 31);
+    int y = 0x3fffffff & bigint;
     int hash = 0x3fffffff & (x * 1367);
     hash = 0x3fffffff & (y * 31 + hash ^ y);
     hash = 0x3fffffff & ((x ^ y) * 31 + hash ^ y);
diff --git a/pkg/kernel/lib/type_propagation/type_propagation.dart b/pkg/kernel/lib/type_propagation/type_propagation.dart
index 48305c2..de5f329 100644
--- a/pkg/kernel/lib/type_propagation/type_propagation.dart
+++ b/pkg/kernel/lib/type_propagation/type_propagation.dart
@@ -51,7 +51,12 @@
   }
 }
 
-enum BaseClassKind { None, Exact, Subclass, Subtype, }
+enum BaseClassKind {
+  None,
+  Exact,
+  Subclass,
+  Subtype,
+}
 
 /// An abstract value inferred by type propagation.
 ///
diff --git a/pkg/kernel/lib/verifier.dart b/pkg/kernel/lib/verifier.dart
index e40b2c0..1a1b5ad 100644
--- a/pkg/kernel/lib/verifier.dart
+++ b/pkg/kernel/lib/verifier.dart
@@ -238,6 +238,7 @@
 
   visitVariableGet(VariableGet node) {
     checkVariableInScope(node.variable, node);
+    visitChildren(node);
   }
 
   visitVariableSet(VariableSet node) {
@@ -246,6 +247,147 @@
   }
 
   @override
+  visitStaticGet(StaticGet node) {
+    visitChildren(node);
+    if (node.target == null) {
+      throw 'StaticGet without target found in $context.';
+    }
+    if (!node.target.hasGetter) {
+      throw 'StaticGet to ${node.target} without getter found in $context';
+    }
+    if (node.target.isInstanceMember) {
+      throw 'StaticGet to ${node.target} that is not static found in $context';
+    }
+  }
+
+  @override
+  visitStaticSet(StaticSet node) {
+    visitChildren(node);
+    if (node.target == null) {
+      throw 'StaticSet without target found in $context.';
+    }
+    if (!node.target.hasSetter) {
+      throw 'StaticSet to ${node.target} without setter found in $context';
+    }
+    if (node.target.isInstanceMember) {
+      throw 'StaticSet to ${node.target} that is not static found in $context';
+    }
+  }
+
+  @override
+  visitStaticInvocation(StaticInvocation node) {
+    visitChildren(node);
+    if (node.target == null) {
+      throw 'StaticInvocation without target found in $context.';
+    }
+    if (node.target.isInstanceMember) {
+      throw 'StaticInvocation to ${node.target} that is not static found in '
+          '$context';
+    }
+    if (!areArgumentsCompatible(node.arguments, node.target.function)) {
+      throw 'StaticInvocation with incompatible arguments to '
+          '${node.target} found in $context';
+    }
+    if (node.arguments.types.length !=
+        node.target.function.typeParameters.length) {
+      throw 'Wrong number of type arguments provided in StaticInvocation '
+          'to ${node.target} found in $context';
+    }
+  }
+
+  @override
+  visitDirectPropertyGet(DirectPropertyGet node) {
+    visitChildren(node);
+    if (node.target == null) {
+      throw 'DirectPropertyGet without target found in $context.';
+    }
+    if (!node.target.hasGetter) {
+      throw 'DirectPropertyGet to ${node.target} without getter found in '
+          '$context';
+    }
+    if (!node.target.isInstanceMember) {
+      throw 'DirectPropertyGet to ${node.target} that is static found in '
+          '$context';
+    }
+  }
+
+  @override
+  visitDirectPropertySet(DirectPropertySet node) {
+    visitChildren(node);
+    if (node.target == null) {
+      throw 'DirectPropertySet without target found in $context.';
+    }
+    if (!node.target.hasSetter) {
+      throw 'DirectPropertyGet to ${node.target} without setter found in '
+          '$context';
+    }
+    if (!node.target.isInstanceMember) {
+      throw 'DirectPropertySet to ${node.target} that is static found in '
+          '$context';
+    }
+  }
+
+  @override
+  visitDirectMethodInvocation(DirectMethodInvocation node) {
+    visitChildren(node);
+    if (node.target == null) {
+      throw 'DirectMethodInvocation without target found in $context.';
+    }
+    if (!node.target.isInstanceMember) {
+      throw 'DirectMethodInvocation to ${node.target} that is static found in '
+          '$context';
+    }
+    if (!areArgumentsCompatible(node.arguments, node.target.function)) {
+      throw 'DirectMethodInvocation with incompatible arguments to '
+          '${node.target} found in $context';
+    }
+    if (node.arguments.types.length !=
+        node.target.function.typeParameters.length) {
+      throw 'Wrong number of type arguments provided in DirectMethodInvocation '
+          'to ${node.target} found in $context';
+    }
+  }
+
+  @override
+  visitConstructorInvocation(ConstructorInvocation node) {
+    visitChildren(node);
+    if (node.target == null) {
+      throw 'ConstructorInvocation without target found in $context.';
+    }
+    if (node.target.enclosingClass.isAbstract) {
+      throw 'ConstructorInvocation to abstract class found in $context';
+    }
+    if (!areArgumentsCompatible(node.arguments, node.target.function)) {
+      throw 'ConstructorInvocation with incompatible arguments to '
+          '${node.target} found in $context';
+    }
+    if (node.arguments.types.length !=
+        node.target.enclosingClass.typeParameters.length) {
+      throw 'Wrong number of type arguments provided in ConstructorInvocation '
+          'to ${node.target} found in $context';
+    }
+  }
+
+  bool areArgumentsCompatible(Arguments arguments, FunctionNode function) {
+    if (arguments.positional.length < function.requiredParameterCount) {
+      return false;
+    }
+    if (arguments.positional.length > function.positionalParameters.length) {
+      return false;
+    }
+    namedLoop:
+    for (int i = 0; i < arguments.named.length; ++i) {
+      var argument = arguments.named[i];
+      String name = argument.name;
+      for (int j = 0; j < function.namedParameters.length; ++j) {
+        if (function.namedParameters[j].name == name) continue namedLoop;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  @override
   defaultMemberReference(Member node) {
     if (node.transformerFlags & TransformerFlag.seenByVerifier == 0) {
       throw 'Dangling reference to $node found in $context.\n'
diff --git a/pkg/kernel/lib/visitor.dart b/pkg/kernel/lib/visitor.dart
index c48f0d4..bbefd95 100644
--- a/pkg/kernel/lib/visitor.dart
+++ b/pkg/kernel/lib/visitor.dart
@@ -235,9 +235,7 @@
 }
 
 class Visitor<R> extends TreeVisitor<R>
-    implements
-        DartTypeVisitor<R>,
-        MemberReferenceVisitor<R> {
+    implements DartTypeVisitor<R>, MemberReferenceVisitor<R> {
   /// The catch-all case, except for references.
   R defaultNode(Node node) => null;
   R defaultTreeNode(TreeNode node) => defaultNode(node);
diff --git a/pkg/kernel/pubspec.yaml b/pkg/kernel/pubspec.yaml
index d4f3420..94dbf2d 100644
--- a/pkg/kernel/pubspec.yaml
+++ b/pkg/kernel/pubspec.yaml
@@ -6,7 +6,7 @@
 environment:
   sdk: ">=1.8.0"
 dependencies:
-  analyzer: ^0.29.0
+  analyzer: ^0.30.0-alpha.0
   path: ^1.3.9
   args: ^0.13.4
   logging: ^0.11.2
@@ -15,5 +15,9 @@
   test: ^0.12.15+6
   stack_trace: ^1.6.6
   ansicolor: ^0.0.9
+  testing:
+    git:
+      url: https://github.com/peter-ahe-google/testing.git
+      ref: 2e196d5
 dependency_overrides:
   analyzer: {path: ../analyzer}
diff --git a/pkg/kernel/test/baseline_spec_mode_test_disabled.dart b/pkg/kernel/test/baseline_spec_mode_test.dart
similarity index 100%
rename from pkg/kernel/test/baseline_spec_mode_test_disabled.dart
rename to pkg/kernel/test/baseline_spec_mode_test.dart
diff --git a/pkg/kernel/test/baseline_strong_mode_test_disabled.dart b/pkg/kernel/test/baseline_strong_mode_test.dart
similarity index 70%
rename from pkg/kernel/test/baseline_strong_mode_test_disabled.dart
rename to pkg/kernel/test/baseline_strong_mode_test.dart
index 51d2a7c..00ffcf0 100644
--- a/pkg/kernel/test/baseline_strong_mode_test_disabled.dart
+++ b/pkg/kernel/test/baseline_strong_mode_test.dart
@@ -4,7 +4,10 @@
 import 'package:kernel/class_hierarchy.dart';
 import 'package:kernel/core_types.dart';
 import 'package:kernel/kernel.dart';
+import 'package:kernel/transformations/insert_covariance_checks.dart';
+import 'package:kernel/transformations/insert_type_checks.dart';
 import 'package:kernel/transformations/mixin_full_resolution.dart';
+import 'package:kernel/transformations/treeshaker.dart';
 import 'package:kernel/type_checker.dart';
 import 'package:path/path.dart' as pathlib;
 
@@ -24,9 +27,13 @@
   List<String> transformProgram(Program program) {
     List<String> errors = <String>[];
     new MixinFullResolution().transform(program);
+    new InsertTypeChecks().transformProgram(program);
+    new InsertCovarianceChecks().transformProgram(program);
     new TestTypeChecker(
             errors, new CoreTypes(program), new ClassHierarchy(program))
         .checkProgram(program);
+    new TreeShaker(program, strongMode: true).transform(program);
+    program.accept(new TreeShakerCheck());
     return errors;
   }
 }
@@ -58,6 +65,16 @@
   }
 }
 
+class TreeShakerCheck extends RecursiveVisitor {
+  visitStringLiteral(StringLiteral node) {
+    if (node.value.toLowerCase() == 'unused') {
+      throw 'Code not tree-shaken at ${node.location}.\n'
+          'The string literal $node is used to indicate that the code is '
+          'expected to be removed by strong-mode tree shaking';
+    }
+  }
+}
+
 void main() {
   runBaselineTests('strong-mode', new StrongModeTest());
 }
diff --git a/pkg/kernel/test/baseline_tester.dart b/pkg/kernel/test/baseline_tester.dart
index c2c47e5..b954e20 100644
--- a/pkg/kernel/test/baseline_tester.dart
+++ b/pkg/kernel/test/baseline_tester.dart
@@ -4,6 +4,7 @@
 import 'dart:io';
 
 import 'package:kernel/analyzer/loader.dart';
+import 'package:kernel/application_root.dart';
 import 'package:kernel/kernel.dart';
 import 'package:kernel/target/targets.dart';
 import 'package:kernel/text/ast_to_text.dart';
@@ -30,11 +31,13 @@
   String outputDirectory = '$testcaseDirectory/$folderName';
   var batch = new DartLoaderBatch();
   Directory directory = new Directory(inputDirectory);
+  var applicationRoot = new ApplicationRoot(directory.absolute.path);
   for (FileSystemEntity file in directory.listSync()) {
     if (file is File && file.path.endsWith('.dart')) {
       String name = pathlib.basename(file.path);
       test(name, () async {
-        String dartPath = file.path;
+        Uri dartPath =
+            new Uri(scheme: 'file', path: pathlib.absolute(file.path));
         String shortName = pathlib.withoutExtension(name);
         String filenameOfBaseline = '$outputDirectory/$shortName.baseline.txt';
         String filenameOfCurrent = '$outputDirectory/$shortName.current.txt';
@@ -45,7 +48,8 @@
             new DartOptions(
                 strongMode: target.strongMode,
                 sdk: sdkDirectory,
-                declaredVariables: target.extraDeclaredVariables));
+                declaredVariables: target.extraDeclaredVariables,
+                applicationRoot: applicationRoot));
         var program = loader.loadProgram(dartPath, target: target);
         verifyProgram(program);
         var errors = target.transformProgram(program);
diff --git a/pkg/kernel/test/baseline_type_propagation_test_disabled.dart b/pkg/kernel/test/baseline_type_propagation_test.dart
similarity index 100%
rename from pkg/kernel/test/baseline_type_propagation_test_disabled.dart
rename to pkg/kernel/test/baseline_type_propagation_test.dart
diff --git a/pkg/kernel/test/class_hierarchy_basic.dart b/pkg/kernel/test/class_hierarchy_basic.dart
index 601bf04..8120505 100644
--- a/pkg/kernel/test/class_hierarchy_basic.dart
+++ b/pkg/kernel/test/class_hierarchy_basic.dart
@@ -43,6 +43,7 @@
         callback(member, superMember, setter);
       }
     }
+
     // Report declared members overriding inheritable members.
     for (var member in class_.mixin.members) {
       for (var supertype in class_.supers) {
@@ -172,6 +173,7 @@
           interfaceGettersAndCalls[node]);
       mergeMaps(interfaceSetters[type.classNode], interfaceSetters[node]);
     }
+
     inheritFrom(node.supertype);
     inheritFrom(node.mixedInType);
     node.implementedTypes.forEach(inheritFrom);
diff --git a/pkg/kernel/test/class_hierarchy_membench.dart b/pkg/kernel/test/class_hierarchy_membench.dart
index e8f6886..3c73bc5 100644
--- a/pkg/kernel/test/class_hierarchy_membench.dart
+++ b/pkg/kernel/test/class_hierarchy_membench.dart
@@ -10,7 +10,8 @@
 
 ArgParser argParser = new ArgParser()
   ..addFlag('basic', help: 'Measure the basic implementation', negatable: false)
-  ..addOption('count', abbr: 'c',
+  ..addOption('count',
+      abbr: 'c',
       help: 'Build N copies of the class hierarchy',
       defaultsTo: '300');
 
diff --git a/pkg/kernel/test/class_hierarchy_tester.dart b/pkg/kernel/test/class_hierarchy_self_check.dart
similarity index 94%
rename from pkg/kernel/test/class_hierarchy_tester.dart
rename to pkg/kernel/test/class_hierarchy_self_check.dart
index d4e04ad..d4cc87b 100644
--- a/pkg/kernel/test/class_hierarchy_tester.dart
+++ b/pkg/kernel/test/class_hierarchy_self_check.dart
@@ -8,6 +8,13 @@
 import 'class_hierarchy_basic.dart';
 import 'dart:io';
 import 'dart:math';
+import 'self_check_util.dart';
+
+main(List<String> args) {
+  runSelfCheck(args, (String filename) {
+    testClassHierarchyOnProgram(loadProgramFromBinary(filename));
+  });
+}
 
 void testClassHierarchyOnProgram(Program program, {bool verbose: false}) {
   BasicClassHierarchy basic = new BasicClassHierarchy(program);
@@ -115,12 +122,14 @@
       String eq = setter ? '=' : '';
       return '$member$eq overrides $superMember$eq';
     }
+
     Set<String> expectedOverrides = new Set<String>();
     basic.forEachOverridePair(classNode, (member, superMember, setter) {
       expectedOverrides.add(getHash(member, superMember, setter));
     });
     Set<String> actualOverrides = new Set<String>();
-    classHierarchy.forEachOverridePair(classNode, (member, superMember, setter) {
+    classHierarchy.forEachOverridePair(classNode,
+        (member, superMember, setter) {
       actualOverrides.add(getHash(member, superMember, setter));
     });
     for (var actual in actualOverrides) {
@@ -142,7 +151,7 @@
 var random = new Random(12345);
 
 List/*<T>*/ pickRandom/*<T>*/(List/*<T>*/ items, int n) {
-  var result = /*<T>*/[];
+  var result = /*<T>*/ [];
   for (int i = 0; i < n; ++i) {
     result.add(items[random.nextInt(items.length)]);
   }
diff --git a/pkg/kernel/test/class_hierarchy_test_disabled.dart b/pkg/kernel/test/class_hierarchy_test_disabled.dart
index 89e1d7d..842f8a2 100644
--- a/pkg/kernel/test/class_hierarchy_test_disabled.dart
+++ b/pkg/kernel/test/class_hierarchy_test_disabled.dart
@@ -3,7 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 import 'package:kernel/kernel.dart';
 import 'package:test/test.dart';
-import 'class_hierarchy_tester.dart';
+import 'class_hierarchy_self_check.dart';
 
 main() {
   test('All-pairs class hierarchy tests on dart2js', () {
diff --git a/pkg/kernel/test/closures/closures.status b/pkg/kernel/test/closures/closures.status
new file mode 100644
index 0000000..2d5d1b7
--- /dev/null
+++ b/pkg/kernel/test/closures/closures.status
@@ -0,0 +1,4 @@
+# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE.md file.
+
diff --git a/pkg/kernel/test/closures/kernel_chain.dart b/pkg/kernel/test/closures/kernel_chain.dart
new file mode 100644
index 0000000..b3088cb
--- /dev/null
+++ b/pkg/kernel/test/closures/kernel_chain.dart
@@ -0,0 +1,199 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+library test.kernel.closures.suite;
+
+import 'dart:async' show Future;
+
+import 'dart:io' show Directory, File, IOSink;
+
+import 'dart:typed_data' show Uint8List;
+
+import 'package:kernel/kernel.dart' show Repository, loadProgramFromBinary;
+
+import 'package:kernel/text/ast_to_text.dart' show Printer;
+
+import 'package:testing/testing.dart'
+    show ChainContext, Result, StdioProcess, Step;
+
+import 'package:kernel/ast.dart' show Library, Program;
+
+import 'package:kernel/verifier.dart' show verifyProgram;
+
+import 'package:kernel/binary/ast_to_binary.dart' show BinaryPrinter;
+
+import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
+
+import 'package:kernel/binary/loader.dart' show BinaryLoader;
+
+Future<bool> fileExists(Uri base, String path) async {
+  return await new File.fromUri(base.resolve(path)).exists();
+}
+
+class Print extends Step<Program, Program, ChainContext> {
+  const Print();
+
+  String get name => "print";
+
+  Future<Result<Program>> run(Program program, _) async {
+    StringBuffer sb = new StringBuffer();
+    for (Library library in program.libraries) {
+      Printer printer = new Printer(sb);
+      if (library.importUri.scheme != "dart") {
+        printer.writeLibraryFile(library);
+      }
+    }
+    print("$sb");
+    return pass(program);
+  }
+}
+
+class SanityCheck extends Step<Program, Program, ChainContext> {
+  const SanityCheck();
+
+  String get name => "sanity check";
+
+  Future<Result<Program>> run(Program program, _) async {
+    try {
+      verifyProgram(program);
+      return pass(program);
+    } catch (e, s) {
+      return crash(e, s);
+    }
+  }
+}
+
+class MatchExpectation extends Step<Program, Program, ChainContext> {
+  final String suffix;
+
+  final bool updateExpectations;
+
+  const MatchExpectation(this.suffix, {this.updateExpectations: true});
+
+  String get name => "match expectations";
+
+  Future<Result<Program>> run(Program program, _) async {
+    Library library = program.libraries
+        .firstWhere((Library library) => library.importUri.scheme != "dart");
+    Uri uri = library.importUri;
+    StringBuffer buffer = new StringBuffer();
+    new Printer(buffer).writeLibraryFile(library);
+
+    File expectedFile = new File("${uri.toFilePath()}$suffix");
+    if (await expectedFile.exists()) {
+      String expected = await expectedFile.readAsString();
+      if (expected.trim() != "$buffer".trim()) {
+        if (!updateExpectations) {
+          String diff = await runDiff(expectedFile.uri, "$buffer");
+          return fail(null, "$uri doesn't match ${expectedFile.uri}\n$diff");
+        }
+      } else {
+        return pass(program);
+      }
+    }
+    if (updateExpectations) {
+      await openWrite(expectedFile.uri, (IOSink sink) {
+        sink.writeln("$buffer".trim());
+      });
+      return pass(program);
+    } else {
+      return fail(
+          program,
+          """
+Please create file ${expectedFile.path} with this content:
+$buffer""");
+    }
+  }
+}
+
+class WriteDill extends Step<Program, Uri, ChainContext> {
+  const WriteDill();
+
+  String get name => "write .dill";
+
+  Future<Result<Uri>> run(Program program, _) async {
+    Directory tmp = await Directory.systemTemp.createTemp();
+    Uri uri = tmp.uri.resolve("generated.dill");
+    File generated = new File.fromUri(uri);
+    IOSink sink = generated.openWrite();
+    try {
+      new BinaryPrinter(sink).writeProgramFile(program);
+    } catch (e, s) {
+      return fail(uri, e, s);
+    } finally {
+      print("Wrote `${generated.path}`");
+      await sink.close();
+    }
+    return pass(uri);
+  }
+}
+
+class ReadDill extends Step<Uri, Uri, ChainContext> {
+  const ReadDill();
+
+  String get name => "read .dill";
+
+  Future<Result<Uri>> run(Uri uri, _) async {
+    try {
+      loadProgramFromBinary(uri.toFilePath());
+    } catch (e, s) {
+      return fail(uri, e, s);
+    }
+    return pass(uri);
+  }
+}
+
+class Copy extends Step<Program, Program, ChainContext> {
+  const Copy();
+
+  String get name => "copy program";
+
+  Future<Result<Program>> run(Program program, _) async {
+    BytesCollector sink = new BytesCollector();
+    new BinaryPrinter(sink).writeProgramFile(program);
+    Uint8List bytes = sink.collect();
+    BinaryLoader loader = new BinaryLoader(new Repository());
+    return pass(new BinaryBuilder(loader, bytes).readProgramFile());
+  }
+}
+
+class BytesCollector implements Sink<List<int>> {
+  final List<List<int>> lists = <List<int>>[];
+
+  int length = 0;
+
+  void add(List<int> data) {
+    lists.add(data);
+    length += data.length;
+  }
+
+  Uint8List collect() {
+    Uint8List result = new Uint8List(length);
+    int offset = 0;
+    for (List<int> list in lists) {
+      result.setRange(offset, offset += list.length, list);
+    }
+    lists.clear();
+    length = 0;
+    return result;
+  }
+
+  void close() {}
+}
+
+Future<String> runDiff(Uri expected, String actual) async {
+  StdioProcess process = await StdioProcess
+      .run("diff", <String>["-u", expected.toFilePath(), "-"], input: actual);
+  return process.output;
+}
+
+Future openWrite(Uri uri, f(IOSink sink)) async {
+  IOSink sink = new File.fromUri(uri).openWrite();
+  try {
+    await f(sink);
+  } finally {
+    await sink.close();
+  }
+  print("Wrote $uri");
+}
diff --git a/pkg/kernel/test/closures/suite.dart b/pkg/kernel/test/closures/suite.dart
new file mode 100644
index 0000000..4c3b9a5
--- /dev/null
+++ b/pkg/kernel/test/closures/suite.dart
@@ -0,0 +1,193 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+library test.kernel.closures.suite;
+
+import 'dart:async' show Future;
+
+import 'dart:io' show Directory, File, Platform;
+
+import 'package:analyzer/src/generated/sdk.dart' show DartSdk;
+
+import 'package:kernel/analyzer/loader.dart'
+    show DartLoader, DartOptions, createDartSdk;
+
+import 'package:kernel/target/targets.dart' show Target, TargetFlags, getTarget;
+
+import 'package:kernel/repository.dart' show Repository;
+
+import 'kernel_chain.dart'
+    show MatchExpectation, Print, ReadDill, SanityCheck, WriteDill;
+
+import 'package:testing/testing.dart'
+    show
+        Chain,
+        ChainContext,
+        Result,
+        StdioProcess,
+        Step,
+        TestDescription,
+        runMe;
+
+import 'package:kernel/ast.dart' show Program;
+
+import 'package:kernel/transformations/closure_conversion.dart'
+    as closure_conversion;
+
+import 'package:package_config/discovery.dart' show loadPackagesFile;
+
+class TestContext extends ChainContext {
+  final Uri vm;
+
+  final Uri packages;
+
+  final DartOptions options;
+
+  final DartSdk dartSdk;
+
+  final List<Step> steps;
+
+  TestContext(String sdk, this.vm, Uri packages, bool strongMode, this.dartSdk,
+      bool updateExpectations)
+      : packages = packages,
+        options = new DartOptions(
+            strongMode: strongMode,
+            sdk: sdk,
+            packagePath: packages.toFilePath()),
+        steps = <Step>[
+          const Kernel(),
+          const Print(),
+          const SanityCheck(),
+          const ClosureConversion(),
+          const Print(),
+          const SanityCheck(),
+          new MatchExpectation(".expect",
+              updateExpectations: updateExpectations),
+          const WriteDill(),
+          const ReadDill(),
+          const Run(),
+        ];
+
+  Future<DartLoader> createLoader() async {
+    Repository repository = new Repository();
+    return new DartLoader(repository, options, await loadPackagesFile(packages),
+        dartSdk: dartSdk);
+  }
+}
+
+enum Environment {
+  directory,
+  file,
+}
+
+Future<String> getEnvironmentVariable(
+    String name, Environment kind, String undefined, notFound(String n)) async {
+  String result = Platform.environment[name];
+  if (result == null) {
+    throw undefined;
+  }
+  switch (kind) {
+    case Environment.directory:
+      if (!await new Directory(result).exists()) throw notFound(result);
+      break;
+
+    case Environment.file:
+      if (!await new File(result).exists()) throw notFound(result);
+      break;
+  }
+  return result;
+}
+
+Future<bool> fileExists(Uri base, String path) async {
+  return await new File.fromUri(base.resolve(path)).exists();
+}
+
+Future<TestContext> createContext(
+    Chain suite, Map<String, String> environment) async {
+  const String suggestion = """Try building the patched SDK by running
+    'tools/build.py patched_sdk'""";
+
+  // TODO(karlklose): The path is different on MacOS.
+  String sdk = "out/DebugX64/patched_sdk/";
+  Uri sdkUri = Uri.base.resolve(sdk);
+  const String asyncDart = "lib/async/async.dart";
+  if (!await fileExists(sdkUri, asyncDart)) {
+    throw "Couldn't find the patched SDK. $suggestion";
+  }
+  const String asyncSources = "lib/async/async_sources.gypi";
+  if (await fileExists(sdkUri, asyncSources)) {
+    throw "Found '$asyncSources' in '$sdk', so it isn't a patched SDK. "
+        "$suggestion";
+  }
+
+  // TODO(karlklose): select the VM based on the mode.
+  Uri vm = Uri.base.resolve("out/ReleaseX64/dart");
+
+  Uri packages = Uri.base.resolve(".packages");
+  bool strongMode = false;
+  bool updateExpectations = environment["updateExpectations"] != "false";
+  return new TestContext(sdk, vm, packages, strongMode,
+      createDartSdk(sdk, strongMode: strongMode), updateExpectations);
+}
+
+class Kernel extends Step<TestDescription, Program, TestContext> {
+  const Kernel();
+
+  String get name => "kernel";
+
+  Future<Result<Program>> run(
+      TestDescription description, TestContext testContext) async {
+    try {
+      DartLoader loader = await testContext.createLoader();
+      Target target = getTarget(
+          "vm", new TargetFlags(strongMode: testContext.options.strongMode));
+      String path = description.file.path;
+      Uri uri = Uri.base.resolve(path);
+      Program program = loader.loadProgram(uri, target: target);
+      for (var error in loader.errors) {
+        return fail(program, "$error");
+      }
+      target.transformProgram(program);
+      return pass(program);
+    } catch (e, s) {
+      return crash(e, s);
+    }
+  }
+}
+
+class ClosureConversion extends Step<Program, Program, TestContext> {
+  const ClosureConversion();
+
+  String get name => "closure conversion";
+
+  Future<Result<Program>> run(Program program, TestContext testContext) async {
+    try {
+      program = closure_conversion.transformProgram(program);
+      return pass(program);
+    } catch (e, s) {
+      return crash(e, s);
+    }
+  }
+}
+
+class Run extends Step<Uri, int, TestContext> {
+  const Run();
+
+  String get name => "run";
+
+  Future<Result<int>> run(Uri uri, TestContext context) async {
+    File generated = new File.fromUri(uri);
+    StdioProcess process;
+    try {
+      process = await StdioProcess
+          .run(context.vm.toFilePath(), [generated.path, "Hello, World!"]);
+      print(process.output);
+    } finally {
+      generated.parent.delete(recursive: true);
+    }
+    return process.toResult();
+  }
+}
+
+main(List<String> arguments) => runMe(arguments, createContext, "testing.json");
diff --git a/pkg/kernel/test/closures/testing.json b/pkg/kernel/test/closures/testing.json
new file mode 100644
index 0000000..f3dfd38
--- /dev/null
+++ b/pkg/kernel/test/closures/testing.json
@@ -0,0 +1,28 @@
+{
+"":"Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file",
+"":"for details. All rights reserved. Use of this source code is governed by a",
+"":"BSD-style license that can be found in the LICENSE.md file.",
+  "packages": "../../../../.packages",
+  "suites": [
+    {
+      "name": "closures",
+      "kind": "Chain",
+      "source": "suite.dart",
+      "path": "../../testcases/closures",
+      "status": "closures.status",
+      "pattern": [
+        "\\.dart$"
+      ],
+      "exclude": [
+        "/test/closures/suite\\.dart$"
+      ]
+    }
+  ],
+  "analyze": {
+    "uris": [
+      "suite.dart"
+    ],
+    "exclude": [
+    ]
+  }
+}
diff --git a/pkg/kernel/test/closures_test.dart b/pkg/kernel/test/closures_test.dart
new file mode 100644
index 0000000..bb0d3e2
--- /dev/null
+++ b/pkg/kernel/test/closures_test.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+library test.kernel.closures_test;
+
+import 'package:test/test.dart' show Timeout, test;
+
+import 'package:testing/testing.dart' show run;
+
+main() {
+  test("closures",
+      () => run([], ["closures"], "pkg/kernel/test/closures/testing.json"),
+      timeout: new Timeout(new Duration(minutes: 5)));
+}
diff --git a/pkg/kernel/test/frontend_bench.dart b/pkg/kernel/test/frontend_bench.dart
index 796d064..9ca6abc 100644
--- a/pkg/kernel/test/frontend_bench.dart
+++ b/pkg/kernel/test/frontend_bench.dart
@@ -45,6 +45,7 @@
   bool strongMode = options['strong'];
 
   String path = options.rest.single;
+  var uri = new Uri(scheme: 'file', path: new File(path).absolute.path);
   var packages =
       getPackagesDirectory(new Uri(scheme: 'file', path: packagePath));
   Repository repository = new Repository();
@@ -54,7 +55,7 @@
           new DartOptions(
               strongMode: strongMode, sdk: sdk, packagePath: packagePath),
           packages)
-      .loadProgram(path);
+      .loadProgram(uri);
 
   CacheEntry.recomputedCounts.forEach((key, value) {
     print('Recomputed $key $value times');
diff --git a/pkg/kernel/test/round_trip.dart b/pkg/kernel/test/round_trip.dart
index 6ca417a..72a57df 100644
--- a/pkg/kernel/test/round_trip.dart
+++ b/pkg/kernel/test/round_trip.dart
@@ -53,7 +53,6 @@
   BinaryPrinterWithExpectedOutput(this.expectedBytes)
       : super(new IOSink(new DummyStreamConsumer()));
 
-
   String show(int byte) {
     if (byte == eof) return 'EOF';
     return '$byte (0x${byte.toRadixString(16).padLeft(2, "0")})';
diff --git a/pkg/kernel/test/round_trip_self_check.dart b/pkg/kernel/test/round_trip_self_check.dart
new file mode 100644
index 0000000..a299f26
--- /dev/null
+++ b/pkg/kernel/test/round_trip_self_check.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+library kernel.round_trip_test;
+
+import 'self_check_util.dart';
+import 'round_trip.dart' as cmd;
+
+void main(List<String> args) {
+  runSelfCheck(args, (String filename) {
+    cmd.main([filename]);
+  });
+}
diff --git a/pkg/kernel/test/round_trip_test_disabled.dart b/pkg/kernel/test/round_trip_test_disabled.dart
deleted file mode 100644
index 946f252..0000000
--- a/pkg/kernel/test/round_trip_test_disabled.dart
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-library kernel.round_trip_test;
-
-import 'package:test/test.dart';
-import 'round_trip.dart' as cmd;
-
-void main() {
-  test('dart2js', () {
-    cmd.main(['test/data/dart2js.dill']);
-  });
-  test('dart2js-strong', () {
-    cmd.main(['test/data/dart2js-strong.dill']);
-  });
-  test('boms', () {
-    cmd.main(['test/data/boms.dill']);
-  });
-}
diff --git a/pkg/kernel/test/self_check_util.dart b/pkg/kernel/test/self_check_util.dart
new file mode 100644
index 0000000..81a4c66
--- /dev/null
+++ b/pkg/kernel/test/self_check_util.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import '../bin/batch_util.dart';
+import 'dart:async';
+
+/// Wraps a main() method for a test that should be runnable as a self-checking
+/// unit test.
+///
+/// These tests can be run like:
+///
+///    tools/test.py -cdartk -rself_check
+///
+/// The test can either be run with a single file passed on the command line
+/// or run in batch mode.
+runSelfCheck(List<String> args, Future runTest(String filename)) {
+  Future<CompilerOutcome> batchMain(List<String> arguments) async {
+    if (arguments.length != 1) {
+      throw 'Exactly one argument expected';
+    }
+    String filename = arguments[0];
+    if (!filename.endsWith('.dill')) {
+      throw 'File does not have expected .dill extension: $filename';
+    }
+    await runTest(filename);
+    return CompilerOutcome.Ok;
+  }
+  if (args.length == 1 && args[0] == '--batch') {
+    runBatch(batchMain);
+  } else {
+    batchMain(args);
+  }
+}
diff --git a/pkg/kernel/test/treeshaker_bench.dart b/pkg/kernel/test/treeshaker_bench.dart
index 3096f99..7a83c7a 100644
--- a/pkg/kernel/test/treeshaker_bench.dart
+++ b/pkg/kernel/test/treeshaker_bench.dart
@@ -13,16 +13,18 @@
 
 import 'class_hierarchy_basic.dart';
 
-ArgParser argParser = new ArgParser()
+ArgParser argParser = new ArgParser(allowTrailingOptions: true)
   ..addFlag('basic',
       help: 'Use the basic class hierarchy implementation', negatable: false)
   ..addFlag('from-scratch',
       help: 'Rebuild class hierarchy for each tree shaking', negatable: false)
   ..addFlag('diagnose',
-      abbr: 'd', help: 'Print internal diagnostics', negatable: false);
+      abbr: 'd', help: 'Print internal diagnostics', negatable: false)
+  ..addFlag('strong',
+      help: 'Run the tree shaker in strong mode', negatable: false);
 
 String usage = '''
-Usage: treeshaker_bench [options] FILE.dart
+Usage: treeshaker_bench [options] FILE.dill
 
 Benchmark the tree shaker and the class hierarchy it depends on.
 
@@ -41,6 +43,7 @@
     exit(1);
   }
   String filename = options.rest.single;
+  bool strongMode = options['strong'];
 
   Program program = loadProgramFromBinary(filename);
 
@@ -56,7 +59,9 @@
   ClassHierarchy sharedClassHierarchy = buildClassHierarchy();
   int coldHierarchyTime = watch.elapsedMicroseconds;
   var shaker = new TreeShaker(program,
-      hierarchy: sharedClassHierarchy, coreTypes: coreTypes);
+      hierarchy: sharedClassHierarchy,
+      coreTypes: coreTypes,
+      strongMode: strongMode);
   if (options['diagnose']) {
     print(shaker.getDiagnosticString());
   }
@@ -77,7 +82,8 @@
     watch.reset();
     var hierarchy = getClassHierarchy();
     hotHierarchyTime += watch.elapsedMicroseconds;
-    new TreeShaker(program, hierarchy: hierarchy, coreTypes: coreTypes);
+    new TreeShaker(program,
+        hierarchy: hierarchy, coreTypes: coreTypes, strongMode: strongMode);
     hotTreeShakingTime += watch.elapsedMicroseconds;
   }
   hotHierarchyTime ~/= numberOfTrials;
diff --git a/pkg/kernel/test/treeshaker_dump.dart b/pkg/kernel/test/treeshaker_dump.dart
index 8d1c7f4..0a380d1 100644
--- a/pkg/kernel/test/treeshaker_dump.dart
+++ b/pkg/kernel/test/treeshaker_dump.dart
@@ -24,7 +24,8 @@
       negatable: false)
   ..addOption('output',
       help: 'The --diff files are written to the given directory instead of '
-          'the working directory');
+          'the working directory')
+  ..addFlag('strong', help: 'Run the tree shaker in strong mode');
 
 String usage = '''
 Usage: treeshaker_dump [options] FILE.dill
@@ -60,8 +61,10 @@
     exit(1);
   }
 
+  bool strong = options['strong'];
+
   Program program = loadProgramFromBinary(filename);
-  TreeShaker shaker = new TreeShaker(program);
+  TreeShaker shaker = new TreeShaker(program, strongMode: strong);
   int totalClasses = 0;
   int totalInstantiationCandidates = 0;
   int totalMembers = 0;
@@ -72,7 +75,7 @@
   void visitMember(Member member) {
     if (member.isAbstract) return; // Abstract members are not relevant.
     ++totalMembers;
-    bool isUsed = shaker.isMemberUsed(member);
+    bool isUsed = shaker.isMemberBodyUsed(member);
     if (isUsed) {
       ++usedMembers;
     }
@@ -124,7 +127,7 @@
     StringBuffer before = new StringBuffer();
     new Printer(before, syntheticNames: names).writeProgramFile(program);
     new File(beforeFile).writeAsStringSync('$before');
-    new TreeShaker(program).transform(program);
+    new TreeShaker(program, strongMode: strong).transform(program);
     StringBuffer after = new StringBuffer();
     new Printer(after, syntheticNames: names).writeProgramFile(program);
     new File(afterFile).writeAsStringSync('$after');
diff --git a/pkg/kernel/test/treeshaker_membench.dart b/pkg/kernel/test/treeshaker_membench.dart
index 318ba74..275fd18 100644
--- a/pkg/kernel/test/treeshaker_membench.dart
+++ b/pkg/kernel/test/treeshaker_membench.dart
@@ -11,13 +11,13 @@
 import 'package:args/args.dart';
 import 'dart:io';
 
-ArgParser argParser = new ArgParser()
-  ..addOption('count', abbr: 'c',
-      help: 'Build N copies of the tree shaker',
-      defaultsTo: '100');
+ArgParser argParser = new ArgParser(allowTrailingOptions: true)
+  ..addOption('count',
+      abbr: 'c', help: 'Build N copies of the tree shaker', defaultsTo: '100')
+  ..addFlag('strong', help: 'Run the tree shaker in strong mode');
 
 String usage = """
-Usage: treeshaker_membench [options] FILE.dart
+Usage: treeshaker_membench [options] FILE.dill
 
 Options:
 ${argParser.usage}
@@ -36,6 +36,7 @@
     exit(1);
   }
   String filename = options.rest.single;
+  bool strongMode = options['strong'];
 
   Program program = loadProgramFromBinary(filename);
   ClassHierarchy hierarchy = new ClassHierarchy(program);
@@ -44,7 +45,8 @@
   int copyCount = int.parse(options['count']);
 
   TreeShaker buildTreeShaker() {
-    return new TreeShaker(program, hierarchy: hierarchy, coreTypes: coreTypes);
+    return new TreeShaker(program,
+        hierarchy: hierarchy, coreTypes: coreTypes, strongMode: strongMode);
   }
 
   List<TreeShaker> keepAlive = <TreeShaker>[];
diff --git a/pkg/kernel/test/type_hashcode_test_disabled.dart b/pkg/kernel/test/type_hashcode_test.dart
similarity index 94%
rename from pkg/kernel/test/type_hashcode_test_disabled.dart
rename to pkg/kernel/test/type_hashcode_test.dart
index aa7f2d4..468deb6 100644
--- a/pkg/kernel/test/type_hashcode_test_disabled.dart
+++ b/pkg/kernel/test/type_hashcode_test.dart
@@ -3,7 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 import 'package:kernel/kernel.dart';
 import 'type_parser.dart';
-import 'type_unification_test_disabled.dart' show testCases;
+import 'type_unification_test.dart' show testCases;
 import 'package:test/test.dart';
 
 void checkHashCodeEquality(DartType type1, DartType type2) {
diff --git a/pkg/kernel/test/type_propagation_dump.dart b/pkg/kernel/test/type_propagation_dump.dart
index 6de0872..5af3f10 100644
--- a/pkg/kernel/test/type_propagation_dump.dart
+++ b/pkg/kernel/test/type_propagation_dump.dart
@@ -105,6 +105,7 @@
       String dotCode = visualizer.dumpMember(member);
       new File(path).writeAsStringSync(dotCode);
     }
+
     for (var library in program.libraries) {
       library.members.forEach(dumpMember);
       for (var class_ in library.classes) {
diff --git a/pkg/kernel/test/type_propagation_selfcheck.dart b/pkg/kernel/test/type_propagation_selfcheck.dart
index f5ce293..e83e4b7 100644
--- a/pkg/kernel/test/type_propagation_selfcheck.dart
+++ b/pkg/kernel/test/type_propagation_selfcheck.dart
@@ -155,9 +155,7 @@
     // is allowed to occur.  We use this because it is hard to check directly
     // that a value is of the 'other' type.
     bool disallowOtherValues = expected.valueBits & ValueBit.other == 0;
-    List<Expression> anyChecks = disallowOtherValues
-        ? <Expression>[]
-        : null;
+    List<Expression> anyChecks = disallowOtherValues ? <Expression>[] : null;
 
     void checkType(int bit, DartType type) {
       if (expected.valueBits & bit == 0) {
diff --git a/pkg/kernel/test/type_substitute_bounds_test_disabled.dart b/pkg/kernel/test/type_substitute_bounds_test.dart
similarity index 100%
rename from pkg/kernel/test/type_substitute_bounds_test_disabled.dart
rename to pkg/kernel/test/type_substitute_bounds_test.dart
diff --git a/pkg/kernel/test/type_substitution_identity_test_disabled.dart b/pkg/kernel/test/type_substitution_identity_test.dart
similarity index 93%
rename from pkg/kernel/test/type_substitution_identity_test_disabled.dart
rename to pkg/kernel/test/type_substitution_identity_test.dart
index 2e6c263..d07da2a 100644
--- a/pkg/kernel/test/type_substitution_identity_test_disabled.dart
+++ b/pkg/kernel/test/type_substitution_identity_test.dart
@@ -4,7 +4,7 @@
 import 'package:kernel/kernel.dart';
 import 'package:kernel/type_algebra.dart';
 import 'type_parser.dart';
-import 'type_unification_test_disabled.dart' show testCases;
+import 'type_unification_test.dart' show testCases;
 import 'package:test/test.dart';
 
 checkType(DartType type) {
diff --git a/pkg/kernel/test/type_subtype_test_disabled.dart b/pkg/kernel/test/type_subtype_test.dart
similarity index 100%
rename from pkg/kernel/test/type_subtype_test_disabled.dart
rename to pkg/kernel/test/type_subtype_test.dart
diff --git a/pkg/kernel/test/type_unification_test_disabled.dart b/pkg/kernel/test/type_unification_test.dart
similarity index 95%
rename from pkg/kernel/test/type_unification_test_disabled.dart
rename to pkg/kernel/test/type_unification_test.dart
index ed75d26..2e79fdb 100644
--- a/pkg/kernel/test/type_unification_test_disabled.dart
+++ b/pkg/kernel/test/type_unification_test.dart
@@ -43,8 +43,10 @@
 
   successCase('(x:int,y:String) => int', '(y:String,x:int) => int', {}),
   successCase('<S,T>(x:S,y:T) => S', '<S,T>(y:T,x:S) => S', {}),
-  successCase('(x:<T>(T)=>T,y:<S>(S)=>S) => int', '(y:<S>(S)=>S,x:<T>(T)=>T) => int', {}),
-  successCase('(x:<T>(T)=>T,y:<S>(S,S,S)=>S) => int', '(y:<S>(S,S,S)=>S,x:<T>(T)=>T) => int', {}),
+  successCase('(x:<T>(T)=>T,y:<S>(S)=>S) => int',
+      '(y:<S>(S)=>S,x:<T>(T)=>T) => int', {}),
+  successCase('(x:<T>(T)=>T,y:<S>(S,S,S)=>S) => int',
+      '(y:<S>(S,S,S)=>S,x:<T>(T)=>T) => int', {}),
 ];
 
 class TestCase {
diff --git a/pkg/kernel/test/uint31_pair_map_bench.dart b/pkg/kernel/test/uint31_pair_map_bench.dart
index 1e6d5b0..9f732a3 100644
--- a/pkg/kernel/test/uint31_pair_map_bench.dart
+++ b/pkg/kernel/test/uint31_pair_map_bench.dart
@@ -58,7 +58,6 @@
 ''');
 }
 
-
 String formatTime(int microseconds) {
   double seconds = microseconds / 1000000.0;
   return '$seconds s';
diff --git a/pkg/kernel/test/uint31_pair_map_test_disabled.dart b/pkg/kernel/test/uint31_pair_map_test.dart
similarity index 100%
rename from pkg/kernel/test/uint31_pair_map_test_disabled.dart
rename to pkg/kernel/test/uint31_pair_map_test.dart
diff --git a/pkg/kernel/test/parent_pointer_test_disabled.dart b/pkg/kernel/test/verify_self_check.dart
similarity index 65%
rename from pkg/kernel/test/parent_pointer_test_disabled.dart
rename to pkg/kernel/test/verify_self_check.dart
index 2920227..a9ccbb8 100644
--- a/pkg/kernel/test/parent_pointer_test_disabled.dart
+++ b/pkg/kernel/test/verify_self_check.dart
@@ -1,10 +1,14 @@
 // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
+
 import 'package:kernel/kernel.dart';
 import 'package:kernel/verifier.dart';
 
-main() {
-  Program program = loadProgramFromBinary('test/data/dart2js.dill');
-  CheckParentPointers.check(program);
+import 'self_check_util.dart';
+
+main(List<String> args) {
+  runSelfCheck(args, (String filename) {
+    verifyProgram(loadProgramFromBinary(filename));
+  });
 }
diff --git a/pkg/kernel/test/verify_test.dart b/pkg/kernel/test/verify_test.dart
index e9f03b9..11f54f9 100644
--- a/pkg/kernel/test/verify_test.dart
+++ b/pkg/kernel/test/verify_test.dart
@@ -125,6 +125,86 @@
     procedure.function = new FunctionNode(new EmptyStatement());
     return procedure;
   });
+  negativeTest('StaticGet without target', () {
+    return new StaticGet(null);
+  });
+  negativeTest('StaticSet without target', () {
+    return new StaticSet(null, new NullLiteral());
+  });
+  negativeTest('StaticInvocation without target', () {
+    return new StaticInvocation(null, new Arguments.empty());
+  });
+  positiveTest('Correct StaticInvocation', () {
+    var method = new Procedure(new Name('test'), ProcedureKind.Method, null,
+        isStatic: true);
+    method.function = new FunctionNode(
+        new ReturnStatement(
+            new StaticInvocation(method, new Arguments([new NullLiteral()]))),
+        positionalParameters: [new VariableDeclaration('p')])..parent = method;
+    return new Class(
+        name: 'Test',
+        supertype: objectClass.asRawSupertype,
+        procedures: [method]);
+  });
+  negativeTest('StaticInvocation with too many parameters', () {
+    var method = new Procedure(new Name('test'), ProcedureKind.Method, null,
+        isStatic: true);
+    method.function = new FunctionNode(new ReturnStatement(
+        new StaticInvocation(method, new Arguments([new NullLiteral()]))))
+      ..parent = method;
+    return new Class(
+        name: 'Test',
+        supertype: objectClass.asRawSupertype,
+        procedures: [method]);
+  });
+  negativeTest('StaticInvocation with too few parameters', () {
+    var method = new Procedure(new Name('test'), ProcedureKind.Method, null,
+        isStatic: true);
+    method.function = new FunctionNode(
+        new ReturnStatement(
+            new StaticInvocation(method, new Arguments.empty())),
+        positionalParameters: [new VariableDeclaration('p')])..parent = method;
+    return new Class(
+        name: 'Test',
+        supertype: objectClass.asRawSupertype,
+        procedures: [method]);
+  });
+  negativeTest('StaticInvocation with unmatched named parameter', () {
+    var method = new Procedure(new Name('test'), ProcedureKind.Method, null,
+        isStatic: true);
+    method.function = new FunctionNode(new ReturnStatement(new StaticInvocation(
+        method,
+        new Arguments([],
+            named: [new NamedExpression('p', new NullLiteral())]))))
+      ..parent = method;
+    return new Class(
+        name: 'Test',
+        supertype: objectClass.asRawSupertype,
+        procedures: [method]);
+  });
+  negativeTest('StaticInvocation with missing type argument', () {
+    var method = new Procedure(new Name('test'), ProcedureKind.Method, null,
+        isStatic: true);
+    method.function = new FunctionNode(
+        new ReturnStatement(
+            new StaticInvocation(method, new Arguments.empty())),
+        typeParameters: [makeTypeParameter()])..parent = method;
+    return new Class(
+        name: 'Test',
+        supertype: objectClass.asRawSupertype,
+        procedures: [method]);
+  });
+  negativeTest('ConstructorInvocation with missing type argument', () {
+    var constructor = new Constructor(null);
+    constructor.function = new FunctionNode(new ReturnStatement(
+        new ConstructorInvocation(constructor, new Arguments.empty())))
+      ..parent = constructor;
+    return new Class(
+        name: 'Test',
+        typeParameters: [makeTypeParameter()],
+        supertype: objectClass.asRawSupertype,
+        constructors: [constructor]);
+  });
 }
 
 checkHasError(Program program) {
diff --git a/pkg/kernel/testcases/closures/README.md b/pkg/kernel/testcases/closures/README.md
new file mode 100644
index 0000000..290864f
--- /dev/null
+++ b/pkg/kernel/testcases/closures/README.md
@@ -0,0 +1,9 @@
+<!--
+Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+for details. All rights reserved. Use of this source code is governed by a
+BSD-style license that can be found in the LICENSE file.
+-->
+# Running tests
+
+    export DART_AOT_SDK=.../xcodebuild/DerivedSources/DebugX64/patched_sdk
+    dart -c --packages=.packages package:testing/src/run_tests.dart test/closures/testing.json
diff --git a/pkg/kernel/testcases/closures/capture_closure.dart b/pkg/kernel/testcases/closures/capture_closure.dart
new file mode 100644
index 0000000..cdfadf5
--- /dev/null
+++ b/pkg/kernel/testcases/closures/capture_closure.dart
@@ -0,0 +1,9 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+main(arguments) {
+  f() => null;
+  g() => f();
+  g();
+}
diff --git a/pkg/kernel/testcases/closures/capture_closure.dart.expect b/pkg/kernel/testcases/closures/capture_closure.dart.expect
new file mode 100644
index 0000000..830004b
--- /dev/null
+++ b/pkg/kernel/testcases/closures/capture_closure.dart.expect
@@ -0,0 +1,36 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#f extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#f::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#f::context};
+    return null;
+  }
+}
+class Closure#main#g extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#g::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#g::context};
+    return #contextParameter.[](0).call();
+  }
+}
+static method main(dynamic arguments) → dynamic {
+  final mock::Context #context = new mock::Context::•(1);
+  #context.parent = null;
+  #context.[]=(0, new self::Closure#main#f::•(#context));
+  final () → dynamic g = new self::Closure#main#g::•(#context);
+  g.call();
+}
diff --git a/pkg/kernel/testcases/closures/capture_closure_parameter.dart b/pkg/kernel/testcases/closures/capture_closure_parameter.dart
new file mode 100644
index 0000000..e70052d
--- /dev/null
+++ b/pkg/kernel/testcases/closures/capture_closure_parameter.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+main(List<String> arguments) {
+  foo(x) {
+    bar() {
+      print(x);
+    }
+    return bar;
+  }
+  foo(arguments[0])();
+}
diff --git a/pkg/kernel/testcases/closures/capture_closure_parameter.dart.expect b/pkg/kernel/testcases/closures/capture_closure_parameter.dart.expect
new file mode 100644
index 0000000..7cc52f2
--- /dev/null
+++ b/pkg/kernel/testcases/closures/capture_closure_parameter.dart.expect
@@ -0,0 +1,37 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#foo#bar extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#foo#bar::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#foo#bar::context};
+    core::print(#contextParameter.[](0));
+  }
+}
+class Closure#main#foo extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#foo::context = context
+    ;
+  method call(dynamic x) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#foo::context};
+    final mock::Context #context = new mock::Context::•(1);
+    #context.parent = #contextParameter;
+    #context.[]=(0, null);
+    final () → dynamic bar = new self::Closure#main#foo#bar::•(#context);
+    return bar;
+  }
+}
+static method main(core::List<core::String> arguments) → dynamic {
+  final (dynamic) → dynamic foo = new self::Closure#main#foo::•(null);
+  foo.call(arguments.[](0)).call();
+}
diff --git a/pkg/kernel/testcases/closures/capture_this.dart b/pkg/kernel/testcases/closures/capture_this.dart
new file mode 100644
index 0000000..bde384d
--- /dev/null
+++ b/pkg/kernel/testcases/closures/capture_this.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+class C {
+  var x;
+  m() => (v) => x = v;
+  f() => () => () => x;
+}
+
+main() {
+  C c = new C();
+  c.x = 41;
+  c.m()(42);
+  if (42 != c.x) throw "Unexpected value in c.x: ${c.x}";
+  var result = c.f()()();
+  if (42 != result) throw "Unexpected value from c.f()()(): $result";
+}
diff --git a/pkg/kernel/testcases/closures/capture_this.dart.expect b/pkg/kernel/testcases/closures/capture_this.dart.expect
new file mode 100644
index 0000000..442f00a
--- /dev/null
+++ b/pkg/kernel/testcases/closures/capture_this.dart.expect
@@ -0,0 +1,69 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class C extends core::Object {
+  field dynamic x = null;
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  method m() → dynamic {
+    final mock::Context #context = new mock::Context::•(1);
+    #context.parent = null;
+    #context.[]=(0, this);
+    return new self::Closure#C#m#function::•(#context);
+  }
+  method f() → dynamic {
+    final mock::Context #context = new mock::Context::•(1);
+    #context.parent = null;
+    #context.[]=(0, this);
+    return new self::Closure#C#f#function::•(#context);
+  }
+}
+class Closure#C#m#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#m#function::context = context
+    ;
+  method call(dynamic v) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#m#function::context};
+    return #contextParameter.[](0).x = v;
+  }
+}
+class Closure#C#f#function#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#f#function#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#f#function#function::context};
+    return #contextParameter.[](0).x;
+  }
+}
+class Closure#C#f#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#f#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#f#function::context};
+    return new self::Closure#C#f#function#function::•(#contextParameter);
+  }
+}
+static method main() → dynamic {
+  self::C c = new self::C::•();
+  c.x = 41;
+  c.m().call(42);
+  if(!42.==(c.x))
+    throw "Unexpected value in c.x: ${c.x}";
+  dynamic result = c.f().call().call();
+  if(!42.==(result))
+    throw "Unexpected value from c.f()()(): ${result}";
+}
diff --git a/pkg/kernel/testcases/closures/catch.dart b/pkg/kernel/testcases/closures/catch.dart
new file mode 100644
index 0000000..dcf383c
--- /dev/null
+++ b/pkg/kernel/testcases/closures/catch.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+main() {
+  var c;
+  try {
+    throw "Fisk";
+  } on String catch (e, s) {
+    c = () {
+      print(e);
+      if (s != null) print(s);
+    };
+  }
+  c();
+  print("TEST PASSED");
+}
diff --git a/pkg/kernel/testcases/closures/catch.dart.expect b/pkg/kernel/testcases/closures/catch.dart.expect
new file mode 100644
index 0000000..1081d5b
--- /dev/null
+++ b/pkg/kernel/testcases/closures/catch.dart.expect
@@ -0,0 +1,34 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#function::context};
+    core::print(#contextParameter.[](0));
+    if(!#contextParameter.[](1).==(null))
+      core::print(#contextParameter.[](1));
+  }
+}
+static method main() → dynamic {
+  dynamic c;
+  try {
+    throw "Fisk";
+  }
+  on core::String catch(dynamic #t1, dynamic #t2) {
+    final mock::Context #context = new mock::Context::•(2);
+    #context.parent = null;
+    #context.[]=(0, #t1);
+    #context.[]=(1, #t2);
+    c = new self::Closure#main#function::•(#context);
+  }
+  c.call();
+  core::print("TEST PASSED");
+}
diff --git a/pkg/kernel/testcases/closures/closures.dart b/pkg/kernel/testcases/closures/closures.dart
new file mode 100644
index 0000000..545ad55
--- /dev/null
+++ b/pkg/kernel/testcases/closures/closures.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+var f;
+
+foo() {
+  print(f(0));
+}
+
+main(arguments) {
+  f = (x) => arguments[x];
+  foo();
+}
diff --git a/pkg/kernel/testcases/closures/closures.dart.expect b/pkg/kernel/testcases/closures/closures.dart.expect
new file mode 100644
index 0000000..c1414f5
--- /dev/null
+++ b/pkg/kernel/testcases/closures/closures.dart.expect
@@ -0,0 +1,28 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#function::context = context
+    ;
+  method call(dynamic x) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#function::context};
+    return #contextParameter.[](0).[](x);
+  }
+}
+static field dynamic f = null;
+static method foo() → dynamic {
+  core::print(self::f.call(0));
+}
+static method main(dynamic arguments) → dynamic {
+  final mock::Context #context = new mock::Context::•(1);
+  #context.parent = null;
+  #context.[]=(0, arguments);
+  self::f = new self::Closure#main#function::•(#context);
+  self::foo();
+}
diff --git a/pkg/kernel/testcases/closures/field.dart b/pkg/kernel/testcases/closures/field.dart
new file mode 100644
index 0000000..910a128
--- /dev/null
+++ b/pkg/kernel/testcases/closures/field.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+var x = () => "x";
+
+class C<T> {
+  var v = (x) => x is T;
+
+  final y = () => "y";
+
+  static final z = () => "z";
+}
+
+main() {
+  if (!new C<String>().v("")) throw "C<String>.v false on String";
+  if (new C<String>().v(0)) throw "C<String>.v true on int";
+  if (new C<String>().v(null)) throw "C<String>.v true on null";
+  if (new C<int>().v("")) throw "C<int>.v true on String";
+  if (!new C<int>().v(0)) throw "C<int>.v false on int";
+  if (new C<int>().v(null)) throw "C<int>.v true on null";
+  if ("x" != x()) throw "x";
+  if ("y" != new C<String>().y()) throw "y";
+  if ("z" != C.z()) throw "z";
+}
diff --git a/pkg/kernel/testcases/closures/field.dart.expect b/pkg/kernel/testcases/closures/field.dart.expect
new file mode 100644
index 0000000..3cfc055
--- /dev/null
+++ b/pkg/kernel/testcases/closures/field.dart.expect
@@ -0,0 +1,82 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class C<T extends core::Object> extends core::Object {
+  field dynamic v = new self::Closure#C#v#function::•<self::C::T>(null);
+  final field dynamic y = new self::Closure#C#y#function::•(null);
+  static final field dynamic z = new self::Closure#C#z#function::•(null);
+  constructor •() → void
+    : super core::Object::•()
+    ;
+}
+class Closure#C#v#function<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#v#function::context = context
+    ;
+  method call(dynamic x) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#v#function::context};
+    return x is self::Closure#C#v#function::T;
+  }
+}
+class Closure#C#y#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#y#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#y#function::context};
+    return "y";
+  }
+}
+class Closure#C#z#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#z#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#z#function::context};
+    return "z";
+  }
+}
+class Closure#x#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#x#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#x#function::context};
+    return "x";
+  }
+}
+static field dynamic x = new self::Closure#x#function::•(null);
+static method main() → dynamic {
+  if(!new self::C::•<core::String>().v(""))
+    throw "C<String>.v false on String";
+  if(new self::C::•<core::String>().v(0))
+    throw "C<String>.v true on int";
+  if(new self::C::•<core::String>().v(null))
+    throw "C<String>.v true on null";
+  if(new self::C::•<core::int>().v(""))
+    throw "C<int>.v true on String";
+  if(!new self::C::•<core::int>().v(0))
+    throw "C<int>.v false on int";
+  if(new self::C::•<core::int>().v(null))
+    throw "C<int>.v true on null";
+  if(!"x".==(self::x.call()))
+    throw "x";
+  if(!"y".==(new self::C::•<core::String>().y()))
+    throw "y";
+  if(!"z".==(self::C::z.call()))
+    throw "z";
+}
diff --git a/pkg/kernel/testcases/closures/for_in_closure.dart b/pkg/kernel/testcases/closures/for_in_closure.dart
new file mode 100644
index 0000000..b48b185
--- /dev/null
+++ b/pkg/kernel/testcases/closures/for_in_closure.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+const numbers = const <int>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+
+main() {
+  var closures = [];
+  for (int i in numbers) {
+    closures.add(() => i);
+  }
+  int sum = 0;
+  for (Function f in closures) {
+    sum += f();
+  }
+  // This formula is credited to Gauss. Search for "Gauss adding 1 to 100".
+  int expectedSum = (numbers.length - 1) * numbers.length ~/ 2;
+  if (expectedSum != sum) {
+    throw new Exception("Unexpected sum = $sum != $expectedSum");
+  }
+}
diff --git a/pkg/kernel/testcases/closures/for_in_closure.dart.expect b/pkg/kernel/testcases/closures/for_in_closure.dart.expect
new file mode 100644
index 0000000..d6c8ee0
--- /dev/null
+++ b/pkg/kernel/testcases/closures/for_in_closure.dart.expect
@@ -0,0 +1,37 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#function::context};
+    return #contextParameter.[](0);
+  }
+}
+static const field dynamic numbers = const <core::int>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+static method main() → dynamic {
+  dynamic closures = <dynamic>[];
+  for (core::int i in self::numbers) {
+    final mock::Context #context = new mock::Context::•(1);
+    #context.parent = null;
+    #context.[]=(0, i);
+    {
+      closures.add(new self::Closure#main#function::•(#context));
+    }
+  }
+  core::int sum = 0;
+  for (core::Function f in closures) {
+    sum = sum.+(f.call());
+  }
+  core::int expectedSum = self::numbers.length.-(1).*(self::numbers.length).~/(2);
+  if(!expectedSum.==(sum)) {
+    throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}");
+  }
+}
diff --git a/pkg/kernel/testcases/closures/for_loop.dart b/pkg/kernel/testcases/closures/for_loop.dart
new file mode 100644
index 0000000..f7b4249
--- /dev/null
+++ b/pkg/kernel/testcases/closures/for_loop.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+const int max = 100;
+
+main() {
+  var closures = [];
+  var closures2 = [];
+  var last;
+  for (int i = 0; i < max; i++) {
+    closures.add(() => last = i);
+    closures2.add(() {
+      if (last != max - 1) throw "last: $last != ${max - 1}";
+    });
+  }
+  int sum = 0;
+  for (Function f in closures) {
+    sum += f();
+  }
+  for (Function f in closures2) {
+    f();
+  }
+  // This formula is credited to Gauss. Search for "Gauss adding 1 to 100".
+  int expectedSum = (max - 1) * max ~/ 2;
+  if (expectedSum != sum) {
+    throw new Exception("Unexpected sum = $sum != $expectedSum");
+  }
+}
diff --git a/pkg/kernel/testcases/closures/for_loop.dart.expect b/pkg/kernel/testcases/closures/for_loop.dart.expect
new file mode 100644
index 0000000..90e2c64
--- /dev/null
+++ b/pkg/kernel/testcases/closures/for_loop.dart.expect
@@ -0,0 +1,58 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#function::context};
+    return let final dynamic #t1 = #contextParameter.parent in let final dynamic #t2 = 0 in let final dynamic #t3 = #contextParameter.[](0) in let final dynamic #t4 = #t1.[]=(#t2, #t3) in #t3;
+  }
+}
+class Closure#main#function#1 extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#function#1::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#function#1::context};
+    if(!#contextParameter.parent.[](0).==(self::max.-(1)))
+      throw "last: ${#contextParameter.parent.[](0)} != ${self::max.-(1)}";
+  }
+}
+static const field core::int max = 100;
+static method main() → dynamic {
+  dynamic closures = <dynamic>[];
+  dynamic closures2 = <dynamic>[];
+  final mock::Context #context = new mock::Context::•(1);
+  #context.parent = null;
+  #context.[]=(0, null);
+  {
+    mock::Context #context = new mock::Context::•(1);
+    #context.parent = #context;
+    #context.[]=(0, 0);
+    for (; #context.[](0).<(self::max); #context = #context.copy(), #context.[]=(0, #context.[](0).+(1))) {
+      closures.add(new self::Closure#main#function::•(#context));
+      closures2.add(new self::Closure#main#function#1::•(#context));
+    }
+  }
+  core::int sum = 0;
+  for (core::Function f in closures) {
+    sum = sum.+(f.call());
+  }
+  for (core::Function f in closures2) {
+    f.call();
+  }
+  core::int expectedSum = self::max.-(1).*(self::max).~/(2);
+  if(!expectedSum.==(sum)) {
+    throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}");
+  }
+}
diff --git a/pkg/kernel/testcases/closures/for_variable_capture_test.dart b/pkg/kernel/testcases/closures/for_variable_capture_test.dart
new file mode 100644
index 0000000..5efb362
--- /dev/null
+++ b/pkg/kernel/testcases/closures/for_variable_capture_test.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+main() {
+  var closure;
+  for (var i=0, fn = () => i; i < 3; i++) {
+    i += 1;
+    closure = fn;
+  }
+  var x = closure();
+  if (x != 1) {
+    throw "Expected 1, but got $x.";
+  }
+}
diff --git a/pkg/kernel/testcases/closures/for_variable_capture_test.dart.expect b/pkg/kernel/testcases/closures/for_variable_capture_test.dart.expect
new file mode 100644
index 0000000..4347b22
--- /dev/null
+++ b/pkg/kernel/testcases/closures/for_variable_capture_test.dart.expect
@@ -0,0 +1,34 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#function::context};
+    return #contextParameter.[](0);
+  }
+}
+static method main() → dynamic {
+  dynamic closure;
+  {
+    mock::Context #context = new mock::Context::•(1);
+    #context.parent = null;
+    #context.[]=(0, 0);
+    dynamic fn = new self::Closure#main#function::•(#context);
+    for (; #context.[](0).<(3); #context = #context.copy(), #context.[]=(0, #context.[](0).+(1))) {
+      #context.[]=(0, #context.[](0).+(1));
+      closure = fn;
+    }
+  }
+  dynamic x = closure.call();
+  if(!x.==(1)) {
+    throw "Expected 1, but got ${x}.";
+  }
+}
diff --git a/pkg/kernel/testcases/closures/instance_tear_off.dart b/pkg/kernel/testcases/closures/instance_tear_off.dart
new file mode 100644
index 0000000..a0c4ce8
--- /dev/null
+++ b/pkg/kernel/testcases/closures/instance_tear_off.dart
@@ -0,0 +1,65 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+class C {
+  var f = () => "f";
+  get g => (x) => "g($x)";
+  a() => "a";
+  b(x) => x;
+  c(x, [y = 2]) => x + y;
+  d(x, {y: 2}) => x + y;
+}
+
+/// This class doesn't use its type variable.
+class D<T> {
+  var f = () => "f";
+  get g => (x) => "g($x)";
+  a() => "a";
+  b(x) => x;
+  c(x, [y = 2]) => x + y;
+  d(x, {y: 2}) => x + y;
+}
+
+/// This class uses its type variable.
+class E<T> {
+  var f = () => "f";
+  get g => (T x) => "g($x)";
+  a() => "a";
+  b(T x) => x;
+  c(T x, [T y = 2]) => x + y;
+  d(T x, {T y: 2}) => x + y;
+}
+
+expect(expected, actual) {
+  print("Expecting '$expected' and got '$actual'");
+  if (expected != actual) {
+    print("Expected '$expected' but got '$actual'");
+    throw "Expected '$expected' but got '$actual'";
+  }
+}
+
+test(o) {
+  expect("f", o.f());
+  expect("f", (o.f)());
+  expect("g(42)", o.g(42));
+  expect("g(42)", (o.g)(42));
+  expect("a", o.a());
+  expect("a", (o.a)());
+  expect(42, o.b(42));
+  expect(42, (o.b)(42));
+  expect(42, o.c(40));
+  expect(42, (o.c)(40));
+  expect(87, o.c(80, 7));
+  expect(87, (o.c)(80, 7));
+  expect(42, o.d(40));
+  expect(42, (o.d)(40));
+  expect(87, o.d(80, y: 7));
+  expect(87, (o.d)(80, y: 7));
+}
+
+main(arguments) {
+  test(new C());
+  test(new D<int>());
+  test(new E<int>());
+}
diff --git a/pkg/kernel/testcases/closures/instance_tear_off.dart.expect b/pkg/kernel/testcases/closures/instance_tear_off.dart.expect
new file mode 100644
index 0000000..a67a1fd
--- /dev/null
+++ b/pkg/kernel/testcases/closures/instance_tear_off.dart.expect
@@ -0,0 +1,302 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class C extends core::Object {
+  field dynamic f = new self::Closure#C#f#function::•(null);
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  get g() → dynamic {
+    return new self::Closure#C#g#function::•(null);
+  }
+  method a() → dynamic {
+    return "a";
+  }
+  method b(dynamic x) → dynamic {
+    return x;
+  }
+  method c(dynamic x, [dynamic y = 2]) → dynamic {
+    return x.+(y);
+  }
+  method d(dynamic x, {dynamic y = 2}) → dynamic {
+    return x.+(y);
+  }
+  get a#get() → dynamic
+    return new self::Closure#C#a::•(this);
+  get b#get() → dynamic
+    return new self::Closure#C#b::•(this);
+  get c#get() → dynamic
+    return new self::Closure#C#c::•(this);
+  get d#get() → dynamic
+    return new self::Closure#C#d::•(this);
+}
+class D<T extends core::Object> extends core::Object {
+  field dynamic f = new self::Closure#D#f#function::•(null);
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  get g() → dynamic {
+    return new self::Closure#D#g#function::•(null);
+  }
+  method a() → dynamic {
+    return "a";
+  }
+  method b(dynamic x) → dynamic {
+    return x;
+  }
+  method c(dynamic x, [dynamic y = 2]) → dynamic {
+    return x.+(y);
+  }
+  method d(dynamic x, {dynamic y = 2}) → dynamic {
+    return x.+(y);
+  }
+  get a#get() → dynamic
+    return new self::Closure#D#a::•<self::D::T>(this);
+  get b#get() → dynamic
+    return new self::Closure#D#b::•<self::D::T>(this);
+  get c#get() → dynamic
+    return new self::Closure#D#c::•<self::D::T>(this);
+  get d#get() → dynamic
+    return new self::Closure#D#d::•<self::D::T>(this);
+}
+class E<T extends core::Object> extends core::Object {
+  field dynamic f = new self::Closure#E#f#function::•(null);
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  get g() → dynamic {
+    return new self::Closure#E#g#function::•<self::E::T>(null);
+  }
+  method a() → dynamic {
+    return "a";
+  }
+  method b(self::E::T x) → dynamic {
+    return x;
+  }
+  method c(self::E::T x, [self::E::T y = 2]) → dynamic {
+    return x.+(y);
+  }
+  method d(self::E::T x, {self::E::T y = 2}) → dynamic {
+    return x.+(y);
+  }
+  get a#get() → dynamic
+    return new self::Closure#E#a::•<self::E::T>(this);
+  get b#get() → dynamic
+    return new self::Closure#E#b::•<self::E::T>(this);
+  get c#get() → dynamic
+    return new self::Closure#E#c::•<self::E::T>(this);
+  get d#get() → dynamic
+    return new self::Closure#E#d::•<self::E::T>(this);
+}
+class Closure#C#g#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#g#function::context = context
+    ;
+  method call(dynamic x) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#g#function::context};
+    return "g(${x})";
+  }
+}
+class Closure#C#a extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::C self;
+  constructor •(final self::C self) → dynamic
+    : self::Closure#C#a::self = self
+    ;
+  method call() → dynamic
+    return this.{self::Closure#C#a::self}.{self::C::a}();
+}
+class Closure#C#b extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::C self;
+  constructor •(final self::C self) → dynamic
+    : self::Closure#C#b::self = self
+    ;
+  method call(dynamic x) → dynamic
+    return this.{self::Closure#C#b::self}.{self::C::b}(x);
+}
+class Closure#C#c extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::C self;
+  constructor •(final self::C self) → dynamic
+    : self::Closure#C#c::self = self
+    ;
+  method call(dynamic x, [dynamic y = 2]) → dynamic
+    return this.{self::Closure#C#c::self}.{self::C::c}(x, y);
+}
+class Closure#C#d extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::C self;
+  constructor •(final self::C self) → dynamic
+    : self::Closure#C#d::self = self
+    ;
+  method call(dynamic x, {dynamic y = 2}) → dynamic
+    return this.{self::Closure#C#d::self}.{self::C::d}(x, y: y);
+}
+class Closure#C#f#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#f#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#f#function::context};
+    return "f";
+  }
+}
+class Closure#D#g#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#D#g#function::context = context
+    ;
+  method call(dynamic x) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#D#g#function::context};
+    return "g(${x})";
+  }
+}
+class Closure#D#a<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::D<self::Closure#D#a::T> self;
+  constructor •(final self::D<self::Closure#D#a::T> self) → dynamic
+    : self::Closure#D#a::self = self
+    ;
+  method call() → dynamic
+    return this.{self::Closure#D#a::self}.{self::D::a}();
+}
+class Closure#D#b<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::D<self::Closure#D#b::T> self;
+  constructor •(final self::D<self::Closure#D#b::T> self) → dynamic
+    : self::Closure#D#b::self = self
+    ;
+  method call(dynamic x) → dynamic
+    return this.{self::Closure#D#b::self}.{self::D::b}(x);
+}
+class Closure#D#c<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::D<self::Closure#D#c::T> self;
+  constructor •(final self::D<self::Closure#D#c::T> self) → dynamic
+    : self::Closure#D#c::self = self
+    ;
+  method call(dynamic x, [dynamic y = 2]) → dynamic
+    return this.{self::Closure#D#c::self}.{self::D::c}(x, y);
+}
+class Closure#D#d<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::D<self::Closure#D#d::T> self;
+  constructor •(final self::D<self::Closure#D#d::T> self) → dynamic
+    : self::Closure#D#d::self = self
+    ;
+  method call(dynamic x, {dynamic y = 2}) → dynamic
+    return this.{self::Closure#D#d::self}.{self::D::d}(x, y: y);
+}
+class Closure#D#f#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#D#f#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#D#f#function::context};
+    return "f";
+  }
+}
+class Closure#E#g#function<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#E#g#function::context = context
+    ;
+  method call(self::Closure#E#g#function::T x) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#E#g#function::context};
+    return "g(${x})";
+  }
+}
+class Closure#E#a<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::E<self::Closure#E#a::T> self;
+  constructor •(final self::E<self::Closure#E#a::T> self) → dynamic
+    : self::Closure#E#a::self = self
+    ;
+  method call() → dynamic
+    return this.{self::Closure#E#a::self}.{self::E::a}();
+}
+class Closure#E#b<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::E<self::Closure#E#b::T> self;
+  constructor •(final self::E<self::Closure#E#b::T> self) → dynamic
+    : self::Closure#E#b::self = self
+    ;
+  method call(self::Closure#E#b::T x) → dynamic
+    return this.{self::Closure#E#b::self}.{self::E::b}(x);
+}
+class Closure#E#c<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::E<self::Closure#E#c::T> self;
+  constructor •(final self::E<self::Closure#E#c::T> self) → dynamic
+    : self::Closure#E#c::self = self
+    ;
+  method call(self::Closure#E#c::T x, [self::Closure#E#c::T y = 2]) → dynamic
+    return this.{self::Closure#E#c::self}.{self::E::c}(x, y);
+}
+class Closure#E#d<T extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field self::E<self::Closure#E#d::T> self;
+  constructor •(final self::E<self::Closure#E#d::T> self) → dynamic
+    : self::Closure#E#d::self = self
+    ;
+  method call(self::Closure#E#d::T x, {self::Closure#E#d::T y = 2}) → dynamic
+    return this.{self::Closure#E#d::self}.{self::E::d}(x, y: y);
+}
+class Closure#E#f#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#E#f#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#E#f#function::context};
+    return "f";
+  }
+}
+static method expect(dynamic expected, dynamic actual) → dynamic {
+  core::print("Expecting '${expected}' and got '${actual}'");
+  if(!expected.==(actual)) {
+    core::print("Expected '${expected}' but got '${actual}'");
+    throw "Expected '${expected}' but got '${actual}'";
+  }
+}
+static method test(dynamic o) → dynamic {
+  self::expect("f", o.f());
+  self::expect("f", o.f.call());
+  self::expect("g(42)", o.g(42));
+  self::expect("g(42)", o.g.call(42));
+  self::expect("a", o.a());
+  self::expect("a", o.a#get.call());
+  self::expect(42, o.b(42));
+  self::expect(42, o.b#get.call(42));
+  self::expect(42, o.c(40));
+  self::expect(42, o.c#get.call(40));
+  self::expect(87, o.c(80, 7));
+  self::expect(87, o.c#get.call(80, 7));
+  self::expect(42, o.d(40));
+  self::expect(42, o.d#get.call(40));
+  self::expect(87, o.d(80, y: 7));
+  self::expect(87, o.d#get.call(80, y: 7));
+}
+static method main(dynamic arguments) → dynamic {
+  self::test(new self::C::•());
+  self::test(new self::D::•<core::int>());
+  self::test(new self::E::•<core::int>());
+}
diff --git a/pkg/kernel/testcases/closures/named_closure.dart b/pkg/kernel/testcases/closures/named_closure.dart
new file mode 100644
index 0000000..8040e78
--- /dev/null
+++ b/pkg/kernel/testcases/closures/named_closure.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+var f;
+
+foo() {
+  print(f(0));
+}
+
+main(arguments) {
+  g(x) => arguments[x];
+  f = g;
+  foo();
+}
diff --git a/pkg/kernel/testcases/closures/named_closure.dart.expect b/pkg/kernel/testcases/closures/named_closure.dart.expect
new file mode 100644
index 0000000..cac6a81
--- /dev/null
+++ b/pkg/kernel/testcases/closures/named_closure.dart.expect
@@ -0,0 +1,29 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#g extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#g::context = context
+    ;
+  method call(dynamic x) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#g::context};
+    return #contextParameter.[](0).[](x);
+  }
+}
+static field dynamic f = null;
+static method foo() → dynamic {
+  core::print(self::f.call(0));
+}
+static method main(dynamic arguments) → dynamic {
+  final mock::Context #context = new mock::Context::•(1);
+  #context.parent = null;
+  #context.[]=(0, arguments);
+  final (dynamic) → dynamic g = new self::Closure#main#g::•(#context);
+  self::f = g;
+  self::foo();
+}
diff --git a/pkg/kernel/testcases/closures/non_void_context.dart b/pkg/kernel/testcases/closures/non_void_context.dart
new file mode 100644
index 0000000..0987ab5
--- /dev/null
+++ b/pkg/kernel/testcases/closures/non_void_context.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+var v;
+
+main(arguments) {
+  var w;
+  ((x) => v = w = x)(87);
+  if (v != 87) {
+    throw "Unexpected value in v: $v";
+  }
+  if (w != 87) {
+    throw "Unexpected value in w: $w";
+  }
+  v = true;
+  (() {
+    for (; w = v;) {
+      v = false;
+    }
+  })();
+  if (v != false) {
+    throw "Unexpected value in v: $v";
+  }
+  if (w != false) {
+    throw "Unexpected value in w: $w";
+  }
+}
diff --git a/pkg/kernel/testcases/closures/non_void_context.dart.expect b/pkg/kernel/testcases/closures/non_void_context.dart.expect
new file mode 100644
index 0000000..d7059b8
--- /dev/null
+++ b/pkg/kernel/testcases/closures/non_void_context.dart.expect
@@ -0,0 +1,52 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#function::context = context
+    ;
+  method call(dynamic x) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#function::context};
+    return self::v = let final dynamic #t1 = #contextParameter in let final dynamic #t2 = 0 in let final dynamic #t3 = x in let final dynamic #t4 = #t1.[]=(#t2, #t3) in #t3;
+  }
+}
+class Closure#main#function#1 extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#function#1::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#function#1::context};
+    for (; let final dynamic #t5 = #contextParameter in let final dynamic #t6 = 0 in let final dynamic #t7 = self::v in let final dynamic #t8 = #t5.[]=(#t6, #t7) in #t7; ) {
+      self::v = false;
+    }
+  }
+}
+static field dynamic v = null;
+static method main(dynamic arguments) → dynamic {
+  final mock::Context #context = new mock::Context::•(1);
+  #context.parent = null;
+  #context.[]=(0, null);
+  new self::Closure#main#function::•(#context).call(87);
+  if(!self::v.==(87)) {
+    throw "Unexpected value in v: ${self::v}";
+  }
+  if(!#context.[](0).==(87)) {
+    throw "Unexpected value in w: ${#context.[](0)}";
+  }
+  self::v = true;
+  new self::Closure#main#function#1::•(#context).call();
+  if(!self::v.==(false)) {
+    throw "Unexpected value in v: ${self::v}";
+  }
+  if(!#context.[](0).==(false)) {
+    throw "Unexpected value in w: ${#context.[](0)}";
+  }
+}
diff --git a/pkg/kernel/testcases/closures/static_tear_off.dart b/pkg/kernel/testcases/closures/static_tear_off.dart
new file mode 100644
index 0000000..29de7c7
--- /dev/null
+++ b/pkg/kernel/testcases/closures/static_tear_off.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+f_1_1_no_default(a, [b]) => a + b;
+
+f_1_1_default(a, [b = 2]) => a + b;
+
+f_1_b_no_default(a, {b}) => a + b;
+
+f_1_b_default(a, {b: 2}) => a + b;
+
+test_1_1(Function f, bool hasDefault) {
+  var result = f(40, 2);
+  if (42 != result) throw "Unexpected result: $result";
+  test_1(f, hasDefault);
+}
+
+test_1_b(Function f, bool hasDefault) {
+  var result = f(40, b: 2);
+  if (42 != result) throw "Unexpected result: $result";
+  test_1(f, hasDefault);
+}
+
+test_1(Function f, bool hasDefault) {
+  var result = 0;
+  bool threw = true;
+  try {
+    result = f(40);
+    threw = false;
+  } catch (_) {
+    // Ignored.
+  }
+  if (hasDefault) {
+    if (threw) throw "Unexpected exception.";
+    if (42 != result) throw "Unexpected result: $result.";
+  } else {
+    if (!threw) throw "Expected exception missing.";
+    if (0 != result) throw "Unexpected result: $result.";
+  }
+}
+
+main(arguments) {
+  test_1_1(f_1_1_no_default, false);
+  test_1_1(f_1_1_default, true);
+  test_1_b(f_1_b_no_default, false);
+  test_1_b(f_1_b_default, true);
+}
diff --git a/pkg/kernel/testcases/closures/static_tear_off.dart.expect b/pkg/kernel/testcases/closures/static_tear_off.dart.expect
new file mode 100644
index 0000000..7095890
--- /dev/null
+++ b/pkg/kernel/testcases/closures/static_tear_off.dart.expect
@@ -0,0 +1,84 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Closure#f_1_1_no_default extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  constructor •() → dynamic
+    ;
+  method call(dynamic a, [dynamic b]) → dynamic
+    return self::f_1_1_no_default(a, b);
+}
+class Closure#f_1_1_default extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  constructor •() → dynamic
+    ;
+  method call(dynamic a, [dynamic b = 2]) → dynamic
+    return self::f_1_1_default(a, b);
+}
+class Closure#f_1_b_no_default extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  constructor •() → dynamic
+    ;
+  method call(dynamic a, {dynamic b}) → dynamic
+    return self::f_1_b_no_default(a, b: b);
+}
+class Closure#f_1_b_default extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  constructor •() → dynamic
+    ;
+  method call(dynamic a, {dynamic b = 2}) → dynamic
+    return self::f_1_b_default(a, b: b);
+}
+static method f_1_1_no_default(dynamic a, [dynamic b]) → dynamic {
+  return a.+(b);
+}
+static method f_1_1_default(dynamic a, [dynamic b = 2]) → dynamic {
+  return a.+(b);
+}
+static method f_1_b_no_default(dynamic a, {dynamic b}) → dynamic {
+  return a.+(b);
+}
+static method f_1_b_default(dynamic a, {dynamic b = 2}) → dynamic {
+  return a.+(b);
+}
+static method test_1_1(core::Function f, core::bool hasDefault) → dynamic {
+  dynamic result = f.call(40, 2);
+  if(!42.==(result))
+    throw "Unexpected result: ${result}";
+  self::test_1(f, hasDefault);
+}
+static method test_1_b(core::Function f, core::bool hasDefault) → dynamic {
+  dynamic result = f.call(40, b: 2);
+  if(!42.==(result))
+    throw "Unexpected result: ${result}";
+  self::test_1(f, hasDefault);
+}
+static method test_1(core::Function f, core::bool hasDefault) → dynamic {
+  dynamic result = 0;
+  core::bool threw = true;
+  try {
+    result = f.call(40);
+    threw = false;
+  }
+  on dynamic catch(dynamic _) {
+  }
+  if(hasDefault) {
+    if(threw)
+      throw "Unexpected exception.";
+    if(!42.==(result))
+      throw "Unexpected result: ${result}.";
+  }
+  else {
+    if(!threw)
+      throw "Expected exception missing.";
+    if(!0.==(result))
+      throw "Unexpected result: ${result}.";
+  }
+}
+static method main(dynamic arguments) → dynamic {
+  self::test_1_1(new self::Closure#f_1_1_no_default::•(), false);
+  self::test_1_1(new self::Closure#f_1_1_default::•(), true);
+  self::test_1_b(new self::Closure#f_1_b_no_default::•(), false);
+  self::test_1_b(new self::Closure#f_1_b_default::•(), true);
+}
diff --git a/pkg/kernel/testcases/closures/type_variables.dart b/pkg/kernel/testcases/closures/type_variables.dart
new file mode 100644
index 0000000..cdfd4c2
--- /dev/null
+++ b/pkg/kernel/testcases/closures/type_variables.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+class C<T, S> {
+  foo(S s) => (T x) {
+    T y = x;
+    Object z = y;
+    C<T, S> self = this;
+    return z as T;
+  };
+
+  bar() {
+    C<T, S> self = this;
+  }
+
+  baz() {
+    return () => () => new C<T, S>();
+  }
+
+  factory C() {
+    local() {
+      C<T, S> self = new C<T, S>.internal();
+      return self;
+    }
+    return local();
+  }
+  C.internal();
+}
+
+main(arguments) {
+  print(new C<String, String>().foo(null)(arguments.first));
+  dynamic c = new C<int, int>().baz()()();
+  if (c is! C<int, int>) throw "$c fails type test 'is C<int, int>'";
+  if (c is C<String, String>) {
+    throw "$c passes type test 'is C<String, String>'";
+  }
+  print(c);
+}
diff --git a/pkg/kernel/testcases/closures/type_variables.dart.expect b/pkg/kernel/testcases/closures/type_variables.dart.expect
new file mode 100644
index 0000000..0939dad
--- /dev/null
+++ b/pkg/kernel/testcases/closures/type_variables.dart.expect
@@ -0,0 +1,85 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class C<T extends core::Object, S extends core::Object> extends core::Object {
+  constructor internal() → void
+    : super core::Object::•()
+    ;
+  method foo(self::C::S s) → dynamic {
+    final mock::Context #context = new mock::Context::•(1);
+    #context.parent = null;
+    #context.[]=(0, this);
+    return new self::Closure#C#foo#function::•<self::C::T, self::C::S>(#context);
+  }
+  method baz() → dynamic {
+    return new self::Closure#C#baz#function::•<self::C::T, self::C::S>(null);
+  }
+  static factory •<T extends core::Object, S extends core::Object>() → self::C<self::C::•::T, self::C::•::S> {
+    final () → dynamic local = new self::Closure#C#function#local::•<self::C::•::T, self::C::•::S>(null);
+    return local.call();
+  }
+}
+class Closure#C#foo#function<T extends core::Object, S extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#foo#function::context = context
+    ;
+  method call(self::Closure#C#foo#function::T x) → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#foo#function::context};
+    self::Closure#C#foo#function::T y = x;
+    core::Object z = y;
+    self::C<self::Closure#C#foo#function::T, self::Closure#C#foo#function::S> self = #contextParameter.[](0);
+    return z as self::Closure#C#foo#function::T;
+  }
+}
+class Closure#C#baz#function#function<T extends core::Object, S extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#baz#function#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#baz#function#function::context};
+    return self::C::•<self::Closure#C#baz#function#function::T, self::Closure#C#baz#function#function::S>();
+  }
+}
+class Closure#C#baz#function<T extends core::Object, S extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#baz#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#baz#function::context};
+    return new self::Closure#C#baz#function#function::•<self::Closure#C#baz#function::T, self::Closure#C#baz#function::S>(#contextParameter);
+  }
+}
+class Closure#C#function#local<T extends core::Object, S extends core::Object> extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#C#function#local::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#C#function#local::context};
+    self::C<self::Closure#C#function#local::T, self::Closure#C#function#local::S> self = new self::C::internal<self::Closure#C#function#local::T, self::Closure#C#function#local::S>();
+    return self;
+  }
+}
+static method main(dynamic arguments) → dynamic {
+  core::print(self::C::•<core::String, core::String>().foo(null).call(arguments.first));
+  dynamic c = self::C::•<core::int, core::int>().baz().call().call();
+  if(!(c is self::C<core::int, core::int>))
+    throw "${c} fails type test 'is C<int, int>'";
+  if(c is self::C<core::String, core::String>) {
+    throw "${c} passes type test 'is C<String, String>'";
+  }
+  core::print(c);
+}
diff --git a/pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart b/pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart
new file mode 100644
index 0000000..8c60816
--- /dev/null
+++ b/pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+const numbers = const <int>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+
+main() {
+  var closures = [];
+  for (int i in numbers) {
+    int j = i;
+    closures.add(() => j);
+  }
+  int sum = 0;
+  for (Function f in closures) {
+    sum += f();
+  }
+  // This formula is credited to Gauss. Search for "Gauss adding 1 to 100".
+  int expectedSum = (numbers.length - 1) * numbers.length ~/ 2;
+  if (expectedSum != sum) {
+    throw new Exception("Unexpected sum = $sum != $expectedSum");
+  }
+}
diff --git a/pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart.expect b/pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart.expect
new file mode 100644
index 0000000..eb0f413
--- /dev/null
+++ b/pkg/kernel/testcases/closures/uncaptured_for_in_loop.dart.expect
@@ -0,0 +1,35 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:mock" as mock;
+
+class Closure#main#function extends core::Object implements core::Function {
+  field core::String note = "This is temporary. The VM doesn't need closure classes.";
+  field mock::Context context;
+  constructor •(final mock::Context context) → dynamic
+    : self::Closure#main#function::context = context
+    ;
+  method call() → dynamic {
+    "This is a temporary solution. In the VM, this will become an additional parameter.";
+    final mock::Context #contextParameter = this.{self::Closure#main#function::context};
+    return #contextParameter.[](0);
+  }
+}
+static const field dynamic numbers = const <core::int>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+static method main() → dynamic {
+  dynamic closures = <dynamic>[];
+  for (core::int i in self::numbers) {
+    final mock::Context #context = new mock::Context::•(1);
+    #context.parent = null;
+    #context.[]=(0, i);
+    closures.add(new self::Closure#main#function::•(#context));
+  }
+  core::int sum = 0;
+  for (core::Function f in closures) {
+    sum = sum.+(f.call());
+  }
+  core::int expectedSum = self::numbers.length.-(1).*(self::numbers.length).~/(2);
+  if(!expectedSum.==(sum)) {
+    throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}");
+  }
+}
diff --git a/pkg/kernel/testcases/input/covariant_generic.dart b/pkg/kernel/testcases/input/covariant_generic.dart
new file mode 100644
index 0000000..a0234a6
--- /dev/null
+++ b/pkg/kernel/testcases/input/covariant_generic.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+typedef void Callback<T>(T x);
+
+class Foo<T> {
+  final T finalField;
+  final Callback<T> callbackField;
+
+  T mutableField;
+  Callback<T> mutableCallbackField;
+
+  Foo(this.finalField, this.callbackField);
+
+  void method(T x) {}
+
+  set setter(T x) {}
+
+  void withCallback(Callback<T> callback) {
+    callback(finalField);
+  }
+}
+
+main() {
+  Foo<int> fooInt = new Foo<int>(1, (int x) {});
+
+  fooInt.method(3);
+  fooInt.setter = 3;
+  fooInt.withCallback((int x) {});
+  fooInt.withCallback((num x) {});
+  fooInt.mutableField = 3;
+  fooInt.mutableCallbackField = (int x) {};
+
+  Foo<num> fooNum = fooInt;
+  fooNum.method(3);
+  fooNum.method(2.5);
+  fooNum.setter = 3;
+  fooNum.setter = 2.5;
+  fooNum.withCallback((num x) {});
+  fooNum.mutableField = 3;
+  fooNum.mutableField = 2.5;
+  fooNum.mutableCallbackField(3);
+  fooNum.mutableCallbackField(2.5);
+  fooNum.mutableCallbackField = (num x) {};
+}
diff --git a/pkg/kernel/testcases/input/unused_methods.dart b/pkg/kernel/testcases/input/unused_methods.dart
new file mode 100644
index 0000000..5d2c38c
--- /dev/null
+++ b/pkg/kernel/testcases/input/unused_methods.dart
@@ -0,0 +1,90 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class UnusedClass {
+  UnusedClass() {
+    print('Unused');
+  }
+}
+
+abstract class UsedAsBaseClass {
+  void usedInSubclass() {
+    print('Unused');
+  }
+
+  void calledFromB() {
+    this.calledFromSubclass();
+  }
+
+  void calledFromSubclass() {
+    print('Unused');
+  }
+}
+
+class UsedAsInterface {
+  void usedInSubclass() {
+    print('Unused');
+  }
+}
+
+class InstantiatedButMethodsUnused {
+  void usedInSubclass() {
+    print('Unused');
+  }
+}
+
+class ClassA extends UsedAsBaseClass
+    implements UsedAsInterface, InstantiatedButMethodsUnused {
+  void usedInSubclass() {
+    print('A');
+  }
+}
+
+class ClassB extends UsedAsBaseClass
+    implements UsedAsInterface, InstantiatedButMethodsUnused {
+  void usedInSubclass() {
+    print('B');
+    calledFromB();
+  }
+
+  void calledFromSubclass() {}
+}
+
+void baseClassCall(UsedAsBaseClass object) {
+  object.usedInSubclass();
+}
+
+void interfaceCall(UsedAsInterface object) {
+  object.usedInSubclass();
+}
+
+void exactCallA(ClassA object) {
+  object.usedInSubclass();
+}
+
+void exactCallB(ClassB object) {
+  object.usedInSubclass();
+}
+
+unusedTopLevel() {
+  print('Unused');
+}
+
+usedTopLevel() {}
+
+main() {
+  usedTopLevel();
+
+  ClassA a = new ClassA();
+  exactCallA(a);
+  baseClassCall(a);
+  interfaceCall(a);
+
+  ClassB b = new ClassB();
+  exactCallB(b);
+  baseClassCall(b);
+  interfaceCall(b);
+
+  new InstantiatedButMethodsUnused();
+}
diff --git a/pkg/kernel/testcases/spec-mode/covariant_generic.baseline.txt b/pkg/kernel/testcases/spec-mode/covariant_generic.baseline.txt
new file mode 100644
index 0000000..063394e
--- /dev/null
+++ b/pkg/kernel/testcases/spec-mode/covariant_generic.baseline.txt
@@ -0,0 +1,38 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo<T extends core::Object> extends core::Object {
+  final field self::Foo::T finalField;
+  final field (self::Foo::T) → void callbackField;
+  field self::Foo::T mutableField = null;
+  field (self::Foo::T) → void mutableCallbackField = null;
+  constructor •(self::Foo::T finalField, (self::Foo::T) → void callbackField) → void
+    : self::Foo::finalField = finalField, self::Foo::callbackField = callbackField, super core::Object::•()
+    ;
+  method method(self::Foo::T x) → void {}
+  set setter(self::Foo::T x) → dynamic {}
+  method withCallback((self::Foo::T) → void callback) → void {
+    callback.call(this.finalField);
+  }
+}
+static method main() → dynamic {
+  self::Foo<core::int> fooInt = new self::Foo::•<core::int>(1, (core::int x) → dynamic {});
+  fooInt.method(3);
+  fooInt.setter = 3;
+  fooInt.withCallback((core::int x) → dynamic {});
+  fooInt.withCallback((core::num x) → dynamic {});
+  fooInt.mutableField = 3;
+  fooInt.mutableCallbackField = (core::int x) → dynamic {};
+  self::Foo<core::num> fooNum = fooInt;
+  fooNum.method(3);
+  fooNum.method(2.5);
+  fooNum.setter = 3;
+  fooNum.setter = 2.5;
+  fooNum.withCallback((core::num x) → dynamic {});
+  fooNum.mutableField = 3;
+  fooNum.mutableField = 2.5;
+  fooNum.mutableCallbackField(3);
+  fooNum.mutableCallbackField(2.5);
+  fooNum.mutableCallbackField = (core::num x) → dynamic {};
+}
diff --git a/pkg/kernel/testcases/spec-mode/unused_methods.baseline.txt b/pkg/kernel/testcases/spec-mode/unused_methods.baseline.txt
new file mode 100644
index 0000000..4bd1746
--- /dev/null
+++ b/pkg/kernel/testcases/spec-mode/unused_methods.baseline.txt
@@ -0,0 +1,86 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class UnusedClass extends core::Object {
+  constructor •() → void
+    : super core::Object::•() {
+    core::print("Unused");
+  }
+}
+abstract class UsedAsBaseClass extends core::Object {
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  method usedInSubclass() → void {
+    core::print("Unused");
+  }
+  method calledFromB() → void {
+    this.calledFromSubclass();
+  }
+  method calledFromSubclass() → void {
+    core::print("Unused");
+  }
+}
+class UsedAsInterface extends core::Object {
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  method usedInSubclass() → void {
+    core::print("Unused");
+  }
+}
+class InstantiatedButMethodsUnused extends core::Object {
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  method usedInSubclass() → void {
+    core::print("Unused");
+  }
+}
+class ClassA extends self::UsedAsBaseClass implements self::UsedAsInterface, self::InstantiatedButMethodsUnused {
+  constructor •() → void
+    : super self::UsedAsBaseClass::•()
+    ;
+  method usedInSubclass() → void {
+    core::print("A");
+  }
+}
+class ClassB extends self::UsedAsBaseClass implements self::UsedAsInterface, self::InstantiatedButMethodsUnused {
+  constructor •() → void
+    : super self::UsedAsBaseClass::•()
+    ;
+  method usedInSubclass() → void {
+    core::print("B");
+    this.calledFromB();
+  }
+  method calledFromSubclass() → void {}
+}
+static method baseClassCall(self::UsedAsBaseClass object) → void {
+  object.usedInSubclass();
+}
+static method interfaceCall(self::UsedAsInterface object) → void {
+  object.usedInSubclass();
+}
+static method exactCallA(self::ClassA object) → void {
+  object.usedInSubclass();
+}
+static method exactCallB(self::ClassB object) → void {
+  object.usedInSubclass();
+}
+static method unusedTopLevel() → dynamic {
+  core::print("Unused");
+}
+static method usedTopLevel() → dynamic {}
+static method main() → dynamic {
+  self::usedTopLevel();
+  self::ClassA a = new self::ClassA::•();
+  self::exactCallA(a);
+  self::baseClassCall(a);
+  self::interfaceCall(a);
+  self::ClassB b = new self::ClassB::•();
+  self::exactCallB(b);
+  self::baseClassCall(b);
+  self::interfaceCall(b);
+  new self::InstantiatedButMethodsUnused::•();
+}
diff --git a/pkg/kernel/testcases/strong-mode/DeltaBlue.baseline.txt b/pkg/kernel/testcases/strong-mode/DeltaBlue.baseline.txt
index f2735c6..2579576 100644
--- a/pkg/kernel/testcases/strong-mode/DeltaBlue.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/DeltaBlue.baseline.txt
@@ -1,7 +1,4 @@
-// dynamic is not a subtype of dart.core::int (DeltaBlue.dart:126:17)
-// dynamic is not a subtype of dart.core::int (DeltaBlue.dart:133:15)
-// dynamic is not a subtype of dart.core::int (DeltaBlue.dart:138:36)
-// dynamic is not a subtype of dart.core::int (DeltaBlue.dart:139:15)
+// dynamic is not a subtype of dart.core::int (DeltaBlue.dart:139:16)
 library;
 import self as self;
 import "dart:core" as core;
@@ -32,9 +29,6 @@
   static method weakest(self::Strength s1, self::Strength s2) → self::Strength {
     return self::Strength::weaker(s1, s2) ? s1 : s2;
   }
-  static method strongest(self::Strength s1, self::Strength s2) → self::Strength {
-    return self::Strength::stronger(s1, s2) ? s1 : s2;
-  }
 }
 abstract class Constraint extends core::Object {
   final field self::Strength strength;
@@ -56,20 +50,20 @@
     self::planner.{self::Planner::incrementalAdd}(this);
   }
   method satisfy(dynamic mark) → self::Constraint {
-    this.{self::Constraint::chooseMethod}(mark);
+    this.{self::Constraint::chooseMethod}(mark as core::int);
     if(!this.{self::Constraint::isSatisfied}()) {
       if(this.{self::Constraint::strength}.{core::Object::==}(self::REQUIRED)) {
         core::print("Could not satisfy a required constraint!");
       }
       return null;
     }
-    this.{self::Constraint::markInputs}(mark);
+    this.{self::Constraint::markInputs}(mark as core::int);
     self::Variable out = this.{self::Constraint::output}();
     self::Constraint overridden = out.{self::Variable::determinedBy};
     if(!overridden.{core::Object::==}(null))
       overridden.{self::Constraint::markUnsatisfied}();
     out.{self::Variable::determinedBy} = this;
-    if(!self::planner.{self::Planner::addPropagate}(this, mark))
+    if(!self::planner.{self::Planner::addPropagate}(this, mark as core::int))
       core::print("Cycle encountered");
     out.{self::Variable::mark} = mark;
     return overridden;
@@ -250,7 +244,7 @@
     : self::Variable::name = name, self::Variable::value = value, super core::Object::•()
     ;
   method addConstraint(self::Constraint c) → void {
-    this.{self::Variable::constraints}.{core::List::add}(c);
+    this.{self::Variable::constraints}.{core::List::add$cc}(c);
   }
   method removeConstraint(self::Constraint c) → void {
     this.{self::Variable::constraints}.{core::List::remove}(c);
@@ -305,7 +299,7 @@
     for (core::int i = 0; i.{core::num::<}(constraints.{core::List::length}); i = i.{core::num::+}(1)) {
       self::Constraint c = constraints.{core::List::[]}(i);
       if(c.{self::Constraint::isInput}() && c.{self::Constraint::isSatisfied}())
-        sources.{core::List::add}(c);
+        sources.{core::List::add$cc}(c);
     }
     return this.{self::Planner::makePlan}(sources);
   }
@@ -333,7 +327,7 @@
       for (core::int i = 0; i.{core::num::<}(v.{self::Variable::constraints}.{core::List::length}); i = i.{core::num::+}(1)) {
         self::Constraint c = v.{self::Variable::constraints}.{core::List::[]}(i);
         if(!c.{self::Constraint::isSatisfied}())
-          unsatisfied.{core::List::add}(c);
+          unsatisfied.{core::List::add$cc}(c);
       }
       self::Constraint determining = v.{self::Variable::determinedBy};
       for (core::int i = 0; i.{core::num::<}(v.{self::Variable::constraints}.{core::List::length}); i = i.{core::num::+}(1)) {
@@ -351,7 +345,7 @@
     for (core::int i = 0; i.{core::num::<}(v.{self::Variable::constraints}.{core::List::length}); i = i.{core::num::+}(1)) {
       self::Constraint c = v.{self::Variable::constraints}.{core::List::[]}(i);
       if(!c.{core::Object::==}(determining) && c.{self::Constraint::isSatisfied}())
-        coll.{core::List::add}(c);
+        coll.{core::List::add$cc}(c);
     }
   }
 }
@@ -361,10 +355,8 @@
     : super core::Object::•()
     ;
   method addConstraint(self::Constraint c) → void {
-    this.{self::Plan::list}.{core::List::add}(c);
+    this.{self::Plan::list}.{core::List::add$cc}(c);
   }
-  method size() → core::int
-    return this.{self::Plan::list}.{core::List::length};
   method execute() → void {
     for (core::int i = 0; i.{core::num::<}(this.{self::Plan::list}.{core::List::length}); i = i.{core::num::+}(1)) {
       this.{self::Plan::list}.{core::List::[]}(i).{self::Constraint::execute}();
diff --git a/pkg/kernel/testcases/strong-mode/async_function.baseline.txt b/pkg/kernel/testcases/strong-mode/async_function.baseline.txt
index 4cbc5e0..d498bf6 100644
--- a/pkg/kernel/testcases/strong-mode/async_function.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/async_function.baseline.txt
@@ -3,29 +3,9 @@
 import "dart:async" as asy;
 import "dart:core" as core;
 
-static field core::List<core::String> stringList = <core::String>["bar"];
 static method asyncString() → asy::Future<core::String> async {
   return "foo";
 }
-static method asyncString2() → asy::Future<core::String> async {
-  return self::asyncString();
-}
-static method syncStarString() → core::Iterable<core::String> sync* {
-  yield "foo";
-  yield* self::syncStarString2();
-  yield* self::stringList;
-}
-static method syncStarString2() → core::Iterable<core::String> sync* {
-  yield "foo";
-}
-static method asyncStarString() → asy::Stream<core::String> async* {
-  yield "foo";
-  yield* self::asyncStarString2();
-  yield await self::asyncString();
-}
-static method asyncStarString2() → asy::Stream<core::String> async* {
-  yield "bar";
-}
 static method main() → dynamic async {
   core::String str = await self::asyncString();
 }
diff --git a/pkg/kernel/testcases/strong-mode/call.baseline.txt b/pkg/kernel/testcases/strong-mode/call.baseline.txt
index 387757e..65b0561 100644
--- a/pkg/kernel/testcases/strong-mode/call.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/call.baseline.txt
@@ -1,8 +1,8 @@
-// Too few positional arguments (call.dart:30:17)
-// Too few positional arguments (call.dart:31:25)
-// Too few positional arguments (call.dart:35:17)
-// Too few positional arguments (call.dart:36:26)
-// Too few positional arguments (call.dart:37:31)
+// Too few positional arguments (call.dart:30:18)
+// Too few positional arguments (call.dart:31:26)
+// Too few positional arguments (call.dart:35:18)
+// Too few positional arguments (call.dart:36:27)
+// Too few positional arguments (call.dart:37:32)
 library;
 import self as self;
 import "dart:core" as core;
diff --git a/pkg/kernel/testcases/strong-mode/covariant_generic.baseline.txt b/pkg/kernel/testcases/strong-mode/covariant_generic.baseline.txt
new file mode 100644
index 0000000..9b0d0d7
--- /dev/null
+++ b/pkg/kernel/testcases/strong-mode/covariant_generic.baseline.txt
@@ -0,0 +1,44 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo<T extends core::Object> extends core::Object {
+  final field self::Foo::T finalField;
+  final field (self::Foo::T) → void callbackField;
+  field self::Foo::T mutableField = null;
+  field (self::Foo::T) → void mutableCallbackField = null;
+  constructor •(self::Foo::T finalField, (self::Foo::T) → void callbackField) → void
+    : self::Foo::finalField = finalField, self::Foo::callbackField = callbackField, super core::Object::•()
+    ;
+  method method(self::Foo::T x) → void {}
+  set setter(self::Foo::T x) → void {}
+  method withCallback((self::Foo::T) → void callback) → void {
+    callback.call(this.{self::Foo::finalField});
+  }
+  set /* from null */ mutableField$cc(core::Object mutableField_) → dynamic
+    this.{=self::Foo::mutableField} = mutableField_ as self::Foo::T;
+  method method$cc(core::Object x) → void
+    this.{=self::Foo::method}(x as self::Foo::T);
+  set setter$cc(core::Object x) → void
+    this.{=self::Foo::setter} = x as self::Foo::T;
+}
+static method main() → dynamic {
+  self::Foo<core::int> fooInt = new self::Foo::•<core::int>(1, (core::int x) → void {});
+  fooInt.{self::Foo::method}(3);
+  fooInt.{self::Foo::setter} = 3;
+  fooInt.{self::Foo::withCallback}((core::int x) → void {});
+  fooInt.{self::Foo::withCallback}((core::num x) → void {});
+  fooInt.{self::Foo::mutableField} = 3;
+  fooInt.{self::Foo::mutableCallbackField} = (core::int x) → void {};
+  self::Foo<core::num> fooNum = fooInt;
+  fooNum.{self::Foo::method$cc}(3);
+  fooNum.{self::Foo::method$cc}(2.5);
+  fooNum.{self::Foo::setter$cc} = 3;
+  fooNum.{self::Foo::setter$cc} = 2.5;
+  fooNum.{self::Foo::withCallback}((core::num x) → void {});
+  fooNum.{self::Foo::mutableField$cc} = 3;
+  fooNum.{self::Foo::mutableField$cc} = 2.5;
+  fooNum.{self::Foo::mutableCallbackField}.call(3);
+  fooNum.{self::Foo::mutableCallbackField}.call(2.5);
+  fooNum.{self::Foo::mutableCallbackField} = (core::num x) → void {};
+}
diff --git a/pkg/kernel/testcases/strong-mode/escape.baseline.txt b/pkg/kernel/testcases/strong-mode/escape.baseline.txt
index fd61f99..ff16c94 100644
--- a/pkg/kernel/testcases/strong-mode/escape.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/escape.baseline.txt
@@ -14,13 +14,6 @@
     : super core::Object::•()
     ;
 }
-class C extends core::Object {
-  constructor •() → void
-    : super core::Object::•()
-    ;
-  operator ==(dynamic x) → core::bool
-    return false;
-}
 class X extends core::Object implements self::A, self::B {
   field dynamic field = null;
   constructor •() → void
diff --git a/pkg/kernel/testcases/strong-mode/micro.baseline.txt b/pkg/kernel/testcases/strong-mode/micro.baseline.txt
index 994a9c9..fabb29d 100644
--- a/pkg/kernel/testcases/strong-mode/micro.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/micro.baseline.txt
@@ -11,14 +11,8 @@
   }
 }
 abstract class ExternalValue extends core::Object {
-  constructor •() → void
-    : super core::Object::•()
-    ;
 }
 abstract class Bar extends core::Object {
-  constructor •() → void
-    : super core::Object::•()
-    ;
   abstract method externalInstanceMethod() → self::ExternalValue;
 }
 class Box extends core::Object {
diff --git a/pkg/kernel/testcases/strong-mode/named_parameters.baseline.txt b/pkg/kernel/testcases/strong-mode/named_parameters.baseline.txt
index 279ed4a..ad415f8 100644
--- a/pkg/kernel/testcases/strong-mode/named_parameters.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/named_parameters.baseline.txt
@@ -1,30 +1,20 @@
-// ({alpha: dynamic, beta: dynamic}) → dynamic is not a subtype of ({beta: dynamic, alpha: dynamic}) → dynamic (no location)
-// ({beta: dynamic, alpha: dynamic}) → dynamic is not a subtype of ({alpha: dynamic, beta: dynamic}) → dynamic (no location)
 library;
 import self as self;
 import "dart:core" as core;
 
-class Superclass extends core::Object {
+abstract class Superclass extends core::Object {
   constructor •() → void
     : super core::Object::•()
     ;
-  method foo({dynamic alpha, dynamic beta}) → dynamic {}
-  method bar({dynamic beta, dynamic alpha}) → dynamic {}
-  method namedCallback(({alpha: core::String, beta: core::int}) → dynamic callback) → dynamic {
-    callback.call(alpha: "one", beta: 2);
-    callback.call(beta: 1, alpha: "two");
-  }
+  abstract method foo({dynamic alpha, dynamic beta}) → dynamic;
 }
 class Subclass extends self::Superclass {
   constructor •() → void
     : super self::Superclass::•()
     ;
   method foo({dynamic beta, dynamic alpha}) → dynamic {}
-  method bar({dynamic alpha, dynamic beta}) → dynamic {}
-  method namedCallback(({alpha: core::String, beta: core::int}) → dynamic callback) → dynamic {}
 }
 static method topLevelNamed(dynamic beta, dynamic alpha, {dynamic gamma, dynamic delta}) → dynamic {}
-static method topLevelOptional(dynamic beta, dynamic alpha, [dynamic gamma, dynamic delta]) → dynamic {}
 static method main() → dynamic {
   new self::Subclass::•().{self::Subclass::foo}(beta: 1, alpha: 2);
   new self::Subclass::•().{self::Subclass::foo}(alpha: 1, beta: 2);
diff --git a/pkg/kernel/testcases/strong-mode/optional.baseline.txt b/pkg/kernel/testcases/strong-mode/optional.baseline.txt
index 1087a03..9387b66 100644
--- a/pkg/kernel/testcases/strong-mode/optional.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/optional.baseline.txt
@@ -1,8 +1,7 @@
-// #lib1::InvalidListener is not a subtype of #lib1::Listener (optional.dart:42:20)
-// Too few positional arguments (optional.dart:44:21)
-// Too many positional arguments (optional.dart:45:21)
-// Too few positional arguments (optional.dart:46:24)
-// Too many positional arguments (optional.dart:47:24)
+// Too few positional arguments (optional.dart:44:22)
+// Too many positional arguments (optional.dart:45:22)
+// Too few positional arguments (optional.dart:46:25)
+// Too many positional arguments (optional.dart:47:25)
 library;
 import self as self;
 import "dart:core" as core;
@@ -16,9 +15,6 @@
   }
 }
 abstract class External extends core::Object {
-  constructor •() → void
-    : super core::Object::•()
-    ;
   abstract method externalMethod(core::int x, [core::int y, core::int z]) → core::String;
   abstract method listen(self::Listener listener) → void;
 }
@@ -44,7 +40,6 @@
   constructor •() → void
     : super core::Object::•()
     ;
-  method event(dynamic input, [dynamic x]) → void {}
 }
 external static method createExternal() → self::External;
 static method main() → dynamic {
@@ -58,7 +53,7 @@
   core::String string6 = extern.{self::External::externalMethod}(1, 2, 3);
   extern.{self::External::listen}(new self::TestListener::•());
   extern.{self::External::listen}(new self::ExtendedListener::•());
-  extern.{self::External::listen}(new self::InvalidListener::•());
+  extern.{self::External::listen}(new self::InvalidListener::•() as self::Listener);
   dynamic nothing1 = foo.{self::Foo::method}();
   dynamic nothing2 = foo.{self::Foo::method}(1, 2, 3, 4);
   core::String nothing3 = extern.{self::External::externalMethod}();
diff --git a/pkg/kernel/testcases/strong-mode/prefer_baseclass.baseline.txt b/pkg/kernel/testcases/strong-mode/prefer_baseclass.baseline.txt
index 8e82d39..4783efb 100644
--- a/pkg/kernel/testcases/strong-mode/prefer_baseclass.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/prefer_baseclass.baseline.txt
@@ -2,12 +2,12 @@
 import self as self;
 import "dart:core" as core;
 
-class A extends core::Object {
+abstract class A extends core::Object {
   constructor •() → void
     : super core::Object::•()
     ;
 }
-class B extends core::Object {
+abstract class B extends core::Object {
   constructor •() → void
     : super core::Object::•()
     ;
diff --git a/pkg/kernel/testcases/strong-mode/redirecting_factory.baseline.txt b/pkg/kernel/testcases/strong-mode/redirecting_factory.baseline.txt
index be5bd7c..5471c7c 100644
--- a/pkg/kernel/testcases/strong-mode/redirecting_factory.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/redirecting_factory.baseline.txt
@@ -14,32 +14,21 @@
     core::print("Bar<${self::Bar::Sb},${self::Bar::Tb}>");
   }
 }
-class Builder<X extends core::Object> extends core::Object {
-  constructor •() → void
-    : super core::Object::•()
-    ;
-  method method() → dynamic {
-    return new self::Bar::•<core::String, self::Builder::X>(4);
-  }
+abstract class SimpleCase<A extends core::Object, B extends core::Object> extends core::Object {
 }
-class SimpleCase<A extends core::Object, B extends core::Object> extends core::Object {
-}
-class SimpleCaseImpl<Ai extends core::Object, Bi extends core::Object> extends core::Object implements self::SimpleCase<self::SimpleCaseImpl::Ai, self::SimpleCaseImpl::Bi> {
+abstract class SimpleCaseImpl<Ai extends core::Object, Bi extends core::Object> extends core::Object implements self::SimpleCase<self::SimpleCaseImpl::Ai, self::SimpleCaseImpl::Bi> {
 }
 class SimpleCaseImpl2<Ai2 extends core::Object, Bi2 extends core::Object> extends core::Object implements self::SimpleCaseImpl<self::SimpleCaseImpl2::Ai2, self::SimpleCaseImpl2::Bi2> {
   constructor •() → void
     : super core::Object::•()
     ;
 }
-class Base<M extends core::Object> extends core::Object {
+abstract class Base<M extends core::Object> extends core::Object {
   constructor •() → void
     : super core::Object::•()
     ;
 }
-class Mixin<M extends core::Object> extends core::Object {
-  constructor •() → void
-    : super core::Object::•()
-    ;
+abstract class Mixin<M extends core::Object> extends core::Object {
 }
 class Mix<M extends core::Object> extends self::Base<self::Mix::M> implements self::Mixin<self::Mix::M> {
   constructor •() → void
diff --git a/pkg/kernel/testcases/strong-mode/stringliteral.baseline.txt b/pkg/kernel/testcases/strong-mode/stringliteral.baseline.txt
index 00fca06..bef6d48 100644
--- a/pkg/kernel/testcases/strong-mode/stringliteral.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/stringliteral.baseline.txt
@@ -1,11 +1,4 @@
 library;
 import self as self;
-import "dart:core" as core;
 
-static field core::String color = "brown";
-static field core::String thing = "lazy dog";
-static field core::String phrase = "The quick ${self::color} fox\njumped over the ${self::thing}.\n";
-static field core::String adjacent = "${self::color}${self::color}${self::color}";
-static field core::String linebreaks = "${self::color}\n${self::color}\n${self::color}";
-static field core::String other = "${self::color}\n is \n${self::color}";
 static method main() → dynamic {}
diff --git a/pkg/kernel/testcases/strong-mode/uninitialized_fields.baseline.txt b/pkg/kernel/testcases/strong-mode/uninitialized_fields.baseline.txt
index c4b9044..bef6d48 100644
--- a/pkg/kernel/testcases/strong-mode/uninitialized_fields.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/uninitialized_fields.baseline.txt
@@ -1,37 +1,4 @@
 library;
 import self as self;
-import "dart:core" as core;
 
-class Uninitialized extends core::Object {
-  field core::int x = null;
-  constructor •() → void
-    : super core::Object::•()
-    ;
-}
-class PartiallyInitialized extends core::Object {
-  field core::int x = null;
-  constructor •(core::int x) → void
-    : self::PartiallyInitialized::x = x, super core::Object::•()
-    ;
-  constructor noInitializer() → void
-    : super core::Object::•()
-    ;
-}
-class Initialized extends core::Object {
-  field core::int x;
-  constructor •(core::int x) → void
-    : self::Initialized::x = x, super core::Object::•()
-    ;
-}
-class Forwarding extends core::Object {
-  field core::int x;
-  constructor initialize(core::int x) → void
-    : self::Forwarding::x = x, super core::Object::•()
-    ;
-  constructor •(core::int arg) → void
-    : this self::Forwarding::initialize(arg)
-    ;
-}
-static field core::int uninitializedTopLevel = null;
-static field core::int initializedTopLevel = 4;
 static method main() → dynamic {}
diff --git a/pkg/kernel/testcases/strong-mode/unused_methods.baseline.txt b/pkg/kernel/testcases/strong-mode/unused_methods.baseline.txt
new file mode 100644
index 0000000..02debc7
--- /dev/null
+++ b/pkg/kernel/testcases/strong-mode/unused_methods.baseline.txt
@@ -0,0 +1,67 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+abstract class UsedAsBaseClass extends core::Object {
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  abstract method usedInSubclass() → void;
+  method calledFromB() → void {
+    this.{self::UsedAsBaseClass::calledFromSubclass}();
+  }
+  abstract method calledFromSubclass() → void;
+}
+abstract class UsedAsInterface extends core::Object {
+  abstract method usedInSubclass() → void;
+}
+class InstantiatedButMethodsUnused extends core::Object {
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  method usedInSubclass() → void
+    throw "Method removed by tree-shaking";
+}
+class ClassA extends self::UsedAsBaseClass implements self::UsedAsInterface, self::InstantiatedButMethodsUnused {
+  constructor •() → void
+    : super self::UsedAsBaseClass::•()
+    ;
+  method usedInSubclass() → void {
+    core::print("A");
+  }
+}
+class ClassB extends self::UsedAsBaseClass implements self::UsedAsInterface, self::InstantiatedButMethodsUnused {
+  constructor •() → void
+    : super self::UsedAsBaseClass::•()
+    ;
+  method usedInSubclass() → void {
+    core::print("B");
+    this.{self::UsedAsBaseClass::calledFromB}();
+  }
+  method calledFromSubclass() → void {}
+}
+static method baseClassCall(self::UsedAsBaseClass object) → void {
+  object.{self::UsedAsBaseClass::usedInSubclass}();
+}
+static method interfaceCall(self::UsedAsInterface object) → void {
+  object.{self::UsedAsInterface::usedInSubclass}();
+}
+static method exactCallA(self::ClassA object) → void {
+  object.{self::ClassA::usedInSubclass}();
+}
+static method exactCallB(self::ClassB object) → void {
+  object.{self::ClassB::usedInSubclass}();
+}
+static method usedTopLevel() → dynamic {}
+static method main() → dynamic {
+  self::usedTopLevel();
+  self::ClassA a = new self::ClassA::•();
+  self::exactCallA(a);
+  self::baseClassCall(a);
+  self::interfaceCall(a);
+  self::ClassB b = new self::ClassB::•();
+  self::exactCallB(b);
+  self::baseClassCall(b);
+  self::interfaceCall(b);
+  new self::InstantiatedButMethodsUnused::•();
+}
diff --git a/pkg/kernel/testcases/strong-mode/void-methods.baseline.txt b/pkg/kernel/testcases/strong-mode/void-methods.baseline.txt
index 73cd4d9..5120402 100644
--- a/pkg/kernel/testcases/strong-mode/void-methods.baseline.txt
+++ b/pkg/kernel/testcases/strong-mode/void-methods.baseline.txt
@@ -1,4 +1,3 @@
-// dynamic is not a subtype of dart.core::int (void-methods.dart:4:27)
 library;
 import self as self;
 import "dart:core" as core;
@@ -9,9 +8,9 @@
     : super core::Object::•()
     ;
   set first(dynamic x) → void
-    this.{self::Foo::list}.{core::List::[]=}(0, x);
+    this.{self::Foo::list}.{core::List::[]=$cc}(0, x);
   operator []=(dynamic x, dynamic y) → dynamic
-    this.{self::Foo::list}.{core::List::[]=}(x, y);
+    this.{self::Foo::list}.{core::List::[]=$cc}(x as core::int, y);
   method clear() → void
     this.{self::Foo::list}.{core::List::clear}();
 }
diff --git a/pkg/kernel/testcases/type-propagation/covariant_generic.baseline.txt b/pkg/kernel/testcases/type-propagation/covariant_generic.baseline.txt
new file mode 100644
index 0000000..bc66a8f
--- /dev/null
+++ b/pkg/kernel/testcases/type-propagation/covariant_generic.baseline.txt
@@ -0,0 +1,38 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class Foo<T extends core::Object> extends core::Object {
+  final field self::Foo::T/core::int* {int} finalField;
+  final field (self::Foo::T) → void/core::Function* {other} callbackField;
+  field self::Foo::T/core::num* {null,int,double} mutableField = null;
+  field (self::Foo::T) → void/core::Function* {null,other} mutableCallbackField = null;
+  constructor •(self::Foo::T/core::int* {int} finalField, (self::Foo::T) → void/core::Function* {other} callbackField) → void
+    : self::Foo::finalField = finalField, self::Foo::callbackField = callbackField, super core::Object::•()
+    ;
+  method method(self::Foo::T/core::num* {int,double} x) → void/Null {}
+  set setter(self::Foo::T/core::num* {int,double} x) → dynamic/Null {}
+  method withCallback((self::Foo::T) → void/core::Function* {other} callback) → void/Null {
+    callback.call(this.finalField);
+  }
+}
+static method main() → dynamic/Null {
+  self::Foo<core::int>/self::Foo! {other} fooInt = new self::Foo::•<core::int>(1, (core::int/Nothing x) → dynamic/Null {});
+  fooInt.method(3);
+  fooInt.setter = 3;
+  fooInt.withCallback((core::int/core::Object+ {*} x) → dynamic/Null {});
+  fooInt.withCallback((core::num/core::Object+ {*} x) → dynamic/Null {});
+  fooInt.mutableField = 3;
+  fooInt.mutableCallbackField = (core::int/core::Object+ {*} x) → dynamic/Null {};
+  self::Foo<core::num>/self::Foo! {other} fooNum = fooInt;
+  fooNum.method(3);
+  fooNum.method(2.5);
+  fooNum.setter = 3;
+  fooNum.setter = 2.5;
+  fooNum.withCallback((core::num/core::Object+ {*} x) → dynamic/Null {});
+  fooNum.mutableField = 3;
+  fooNum.mutableField = 2.5;
+  fooNum.mutableCallbackField(3);
+  fooNum.mutableCallbackField(2.5);
+  fooNum.mutableCallbackField = (core::num/core::Object+ {*} x) → dynamic/Null {};
+}
diff --git a/pkg/kernel/testcases/type-propagation/unused_methods.baseline.txt b/pkg/kernel/testcases/type-propagation/unused_methods.baseline.txt
new file mode 100644
index 0000000..13cd886
--- /dev/null
+++ b/pkg/kernel/testcases/type-propagation/unused_methods.baseline.txt
@@ -0,0 +1,86 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+class UnusedClass extends core::Object {
+  constructor •() → void
+    : super core::Object::•() {
+    core::print("Unused");
+  }
+}
+abstract class UsedAsBaseClass extends core::Object {
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  method usedInSubclass() → void/Null {
+    core::print("Unused");
+  }
+  method calledFromB() → void/Null {
+    this.calledFromSubclass();
+  }
+  method calledFromSubclass() → void/Null {
+    core::print("Unused");
+  }
+}
+class UsedAsInterface extends core::Object {
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  method usedInSubclass() → void/Null {
+    core::print("Unused");
+  }
+}
+class InstantiatedButMethodsUnused extends core::Object {
+  constructor •() → void
+    : super core::Object::•()
+    ;
+  method usedInSubclass() → void/Null {
+    core::print("Unused");
+  }
+}
+class ClassA extends self::UsedAsBaseClass implements self::UsedAsInterface, self::InstantiatedButMethodsUnused {
+  constructor •() → void
+    : super self::UsedAsBaseClass::•()
+    ;
+  method usedInSubclass() → void/Null {
+    core::print("A");
+  }
+}
+class ClassB extends self::UsedAsBaseClass implements self::UsedAsInterface, self::InstantiatedButMethodsUnused {
+  constructor •() → void
+    : super self::UsedAsBaseClass::•()
+    ;
+  method usedInSubclass() → void/Null {
+    core::print("B");
+    this.calledFromB();
+  }
+  method calledFromSubclass() → void/Null {}
+}
+static method baseClassCall(self::UsedAsBaseClass/self::UsedAsBaseClass+ {other} object) → void/Null {
+  object.usedInSubclass();
+}
+static method interfaceCall(self::UsedAsInterface/self::UsedAsBaseClass+ {other} object) → void/Null {
+  object.usedInSubclass();
+}
+static method exactCallA(self::ClassA/self::ClassA! {other} object) → void/Null {
+  object.usedInSubclass();
+}
+static method exactCallB(self::ClassB/self::ClassB! {other} object) → void/Null {
+  object.usedInSubclass();
+}
+static method unusedTopLevel() → dynamic/Null {
+  core::print("Unused");
+}
+static method usedTopLevel() → dynamic/Null {}
+static method main() → dynamic/Null {
+  self::usedTopLevel();
+  self::ClassA/self::ClassA! {other} a = new self::ClassA::•();
+  self::exactCallA(a);
+  self::baseClassCall(a);
+  self::interfaceCall(a);
+  self::ClassB/self::ClassB! {other} b = new self::ClassB::•();
+  self::exactCallB(b);
+  self::baseClassCall(b);
+  self::interfaceCall(b);
+  new self::InstantiatedButMethodsUnused::•();
+}
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 17e515b..0bb8e1e 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -11,17 +11,28 @@
 */*/*/*/packages/*/*: Skip
 */*/*/*/*/packages/*/*: Skip
 
-# Don't run dev_compiler tests
-dev_compiler/test/*: Skip
-
 # Analyzer2dart is not maintained anymore.
 analyzer2dart/test/*: Skip
 
 dart_messages/test/dart_messages_test: Skip  # Requires a package root.
 
-[ $compiler == dart2analyzer ]
+# Skip dev_compiler codegen tests
+dev_compiler/test/codegen/*: Skip
 dev_compiler/gen/*: SkipByDesign
 
+[ $runtime == vm && $mode == release && $system == linux ]
+kernel/test/closures_test: Slow, Pass
+
+[ $runtime != vm || $mode != release || $system != linux ]
+kernel/test/closures_test: Skip
+
+# Analyze dev_compiler but don't run its tests
+[ $compiler != dart2analyzer ]
+dev_compiler/test/*: Skip
+
+[ $compiler == dart2analyzer ]
+dev_compiler/test/options/*: SkipByDesign
+
 [ $compiler == none && ($runtime == drt || $runtime == dartium) ]
 mutation_observer: Skip # Issue 21149
 unittest/*: Skip # Issue 21949
@@ -40,6 +51,9 @@
 analysis_server/test/integration/analysis/analysis_options_test: RuntimeError # Issue 24796
 analyzer/test/generated/all_the_rest_test: Fail # Issue 21772
 analyzer/test/generated/source_factory_test: RuntimeError # Issue 26828
+kernel/test/baseline_type_propagation_test: RuntimeError # Issue 28243
+kernel/test/baseline_spec_mode_test: RuntimeError # Issue 28243
+kernel/test/baseline_strong_mode_test: RuntimeError # Issue 28243
 
 [ $compiler == dart2js ]
 analysis_server/test/integration: SkipByDesign # Analysis server integration tests don't make sense to run under dart2js, since the code under test always runs in the Dart vm as a subprocess.
@@ -54,8 +68,15 @@
 front_end/tool/*: SkipByDesign # Only meant to run on vm
 lookup_map/test/version_check_test: SkipByDesign # Only meant to run in vm.
 typed_data/test/typed_buffers_test/01: Fail # Not supporting Int64List, Uint64List.
+front_end/test/incremental_kernel_generator_test: SkipByDesign # Uses dart:io
+front_end/test/incremental_resolved_ast_generator_test: SkipByDesign # Uses dart:io
 front_end/test/memory_file_system_test: CompileTimeError # Issue 23773
+front_end/test/dependency_grapher_test: SkipByDesign # Uses dart:io
 front_end/test/physical_file_system_test: SkipByDesign # Uses dart:io
+front_end/test/src/base/file_repository_test: SkipByDesign # Uses dart:io
+front_end/test/src/base/libraries_reader_test: SkipByDesign # Uses dart:io
+front_end/test/src/base/processed_options_test: SkipByDesign # Uses dart:io
+front_end/test/subpackage_relationships_test: SkipByDesign # Uses dart:io
 
 [ $compiler == dart2js && $fast_startup ]
 front_end/test/*: SkipByDesign # Tests written with dart:mirrors.
@@ -71,7 +92,7 @@
 [ $runtime == jsshell ]
 async/test/stream_zip_test: RuntimeError, OK # Issue 26103. Timers are not supported.
 lookup_map/test/lookup_map_test: RuntimeError, OK # Issue 26103. Timers are not supported.
-front_end/test/*: RuntimeError, OK # Issue 26103. Timers are not supported.
+front_end/test/*: RuntimeError, OK, Pass # Issue 26103. Timers are not supported.
 kernel/test/*: RuntimeError, OK # Issue 26103. Timers are not supported.
 
 [ $compiler == dart2js && $runtime == drt ]
@@ -85,6 +106,9 @@
 analyzer/test/generated/java_core_test: Pass, Timeout # Issue 19747
 typed_data/test/typed_buffers_test/none: Fail # Issue 17607 (I put this here explicitly, since this is not the same as on ie9)
 
+[ $runtime == ie11 ]
+kernel/test/verify_test: Skip # Times out. Issue 27935
+
 [ $runtime == safarimobilesim ]
 # Unexplained errors only occuring on Safari 6.1 and earlier.
 typed_data/test/typed_buffers_test: RuntimeError
@@ -113,6 +137,9 @@
 observe/test/unique_message_test: SkipByDesign  # Uses dart:io.
 dart_messages/test/dart_messages_test: Skip  # Uses dart:io.
 
+[ $browser || $jscl ]
+kernel/test/*: SkipByDesign # Uses dart:io and bigints.
+
 [ $runtime == vm && ($arch == simarm64 || $arch == simarm || $arch == simarmv6 || $arch == simarmv5te || $arch == simmips || $arch == armv6 || $arch == armv5te) ]
 # Timeout. These are not unit tests. They do not run efficiently on our
 # simulator or low-end devices.
@@ -187,8 +214,11 @@
 analyzer/test/src/task/strong_mode_test: Crash # Issue 24485
 analyzer/test/src/task/yaml_test: Crash # Issue 24485
 
-[ $noopt || $runtime == dart_precompiled || $runtime == dart_app ]
+[ $runtime == dart_precompiled ]
 *: SkipByDesign # The pkg test framework imports dart:mirrors.
 
 [ $compiler == dart2js && $cps_ir && $checked ]
 *: Skip # `assert` not implemented, about 75% tests crash
+
+[ $compiler == none ]
+kernel/test/closures_test: Fail
diff --git a/pkg/pkg_files.gyp b/pkg/pkg_files.gyp
index 55dd284..9e41a67 100644
--- a/pkg/pkg_files.gyp
+++ b/pkg/pkg_files.gyp
@@ -19,7 +19,7 @@
           'action_name': 'make_pkg_files_stamp',
           'inputs': [
             '../tools/create_timestamp_file.py',
-            '<!@(["python", "../tools/list_dart_files.py", "."])',
+            '<!@(["python", "../tools/list_dart_files.py", "relative", "."])',
             '<(SHARED_INTERMEDIATE_DIR)/third_party_pkg_files_a_k.stamp',
             '<(SHARED_INTERMEDIATE_DIR)/third_party_pkg_files_l_r.stamp',
             '<(SHARED_INTERMEDIATE_DIR)/third_party_pkg_files_s_z.stamp',
@@ -36,7 +36,8 @@
           'action_name': 'make_third_party_pkg_files_a_k_stamp',
           'inputs': [
             '../tools/create_timestamp_file.py',
-            '<!@(["python", "../tools/list_dart_files.py", "../third_party/pkg", "[a-k].*"])',
+            '<!@(["python", "../tools/list_dart_files.py", "relative", '
+                '"../third_party/pkg", "[a-k].*"])',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/third_party_pkg_files_a_k.stamp',
@@ -50,7 +51,8 @@
           'action_name': 'make_third_party_pkg_files_l_r_stamp',
           'inputs': [
             '../tools/create_timestamp_file.py',
-            '<!@(["python", "../tools/list_dart_files.py", "../third_party/pkg", "[l-r].*"])',
+            '<!@(["python", "../tools/list_dart_files.py", "relative", '
+                '"../third_party/pkg", "[l-r].*"])',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/third_party_pkg_files_l_r.stamp',
@@ -64,7 +66,8 @@
           'action_name': 'make_third_party_pkg_files_s_z_stamp',
           'inputs': [
             '../tools/create_timestamp_file.py',
-            '<!@(["python", "../tools/list_dart_files.py", "../third_party/pkg", "[s-z].*"])',
+            '<!@(["python", "../tools/list_dart_files.py", "relative", '
+                '"../third_party/pkg", "[s-z].*"])',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/third_party_pkg_files_s_z.stamp',
diff --git a/pkg/pkgbuild.status b/pkg/pkgbuild.status
index cefeb2f..7ba877f 100644
--- a/pkg/pkgbuild.status
+++ b/pkg/pkgbuild.status
@@ -4,11 +4,14 @@
 
 [ $use_public_packages ]
 pkg/compiler: SkipByDesign # js_ast is not published
+third_party/pkg/linter: Skip # Issue 27937
 
 [ ($use_repository_packages || $use_public_packages) ]
 pkg/dev_compiler: SkipByDesign # we have relative paths to analyzer
 pkg/analyzer: Fail # Issue 27654
 pkg/front_end: Fail # Issue 27655
+pkg/kernel: SkipByDesign # Issue 27937
+third_party/pkg/linter: SkipByDesign # Issue 27937
 
 [ $use_repository_packages ]
- # third_party/pkg/dart2js_info: Fail # Issue https://github.com/dart-lang/dart2js_info/pull/14
+third_party/pkg_tested/dart_style: Fail # Issue https://github.com/dart-lang/dart_style/issues/562
diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
index 8556ba2..05d33f7 100644
--- a/runtime/BUILD.gn
+++ b/runtime/BUILD.gn
@@ -28,6 +28,9 @@
   dart_target_arch = ""
 
   dart_experimental_interpreter = false
+
+  # The optimization level to use for debug builds.
+  dart_debug_optimization_level = "2"
 }
 
 config("dart_public_config") {
@@ -129,11 +132,13 @@
     } else if (dart_target_arch == "ia32") {
       defines += [ "TARGET_ARCH_IA32" ]
     } else if (dart_target_arch == "dbc" || dart_target_arch == "simdbc" ||
-               dart_target_arch == "simdbc64") {
+               dart_target_arch == "simdbc64" ||
+               dart_target_arch == "armsimdbc" ||
+               dart_target_arch == "armsimdbc64") {
       defines += [ "TARGET_ARCH_DBC" ]
       defines += [ "USING_SIMULATOR" ]
     } else {
-      print("Invalid |dart_target_arch|")
+      print("Invalid $dart_target_arch")
       assert(false)
     }
   }
@@ -161,13 +166,20 @@
     ]
 
     if (dart_debug) {
-      cflags += [ "-O1" ]
+      cflags += [ "-O${dart_debug_optimization_level}" ]
     } else {
       cflags += [ "-O3" ]
     }
 
+    ldflags = []
     if (defined(is_asan) && is_asan) {
-      ldflags = [ "-fsanitize=address" ]
+      ldflags += [ "-fsanitize=address" ]
+    }
+    if (defined(is_msan) && is_msan) {
+      ldflags += [ "-fsanitize=memory" ]
+    }
+    if (defined(is_tsan) && is_tsan) {
+      ldflags += [ "-fsanitize=thread" ]
     }
   }
 }
@@ -217,17 +229,6 @@
   ]
 }
 
-libdart_library("libdart_noopt") {
-  extra_configs = [
-    ":dart_maybe_precompiled_runtime_config",
-    ":dart_precompiler_config",
-  ]
-  extra_deps = [
-    "vm:libdart_lib",
-    "vm:libdart_vm_noopt",
-  ]
-}
-
 libdart_library("libdart_precompiled_runtime") {
   extra_configs = [ ":dart_precompiled_runtime_config" ]
   extra_deps = [
diff --git a/runtime/PRESUBMIT.py b/runtime/PRESUBMIT.py
index 0170f2f9..44c53df 100644
--- a/runtime/PRESUBMIT.py
+++ b/runtime/PRESUBMIT.py
@@ -5,6 +5,7 @@
 import os
 import cpplint
 import re
+import StringIO
 
 # memcpy does not handle overlapping memory regions. Even though this
 # is well documented it seems to be used in error quite often. To avoid
@@ -49,7 +50,17 @@
 
 
 def CheckFormatted(input_api, output_api):
-  return input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
+  def convert_warning_to_error(presubmit_result):
+    if not presubmit_result.fatal:
+      # Convert this warning to an error.
+      stream = StringIO.StringIO()
+      presubmit_result.handle(stream)
+      message = stream.getvalue()
+      return output_api.PresubmitError(message)
+    return presubmit_result
+
+  results = input_api.canned_checks.CheckPatchFormatted(input_api, output_api)
+  return [convert_warning_to_error(r) for r in results]
 
 
 def CheckChangeOnUpload(input_api, output_api):
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index 903cc40..c3140f0 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -3,27 +3,7 @@
 # BSD-style license that can be found in the LICENSE file.
 
 import("gypi_contents.gni")
-
-declare_args() {
-  # Whether to fall back to built-in root certificates when they cannot be
-  # verified at the operating system level.
-  dart_use_fallback_root_certificates = false
-
-  # The BUILD.gn file that we pull from chromium as part of zlib has a
-  # dependence on //base, which we don't pull in. In a standalone build of the
-  # VM, we set this to //runtime/bin/zlib where we have a BUILD.gn file without
-  # a dependence on //base.
-  dart_zlib_path = "//third_party/zlib"
-
-  # Whether to link the standalone VM against tcmalloc. The standalone build of
-  # the VM enables this only for Linux builds.
-  dart_use_tcmalloc = false
-}
-
-# TODO(zra): Remove this when Fuchsia has a root cert cache on the filesystem.
-if (defined(is_fuchsia) && is_fuchsia) {
-  dart_use_fallback_root_certificates = true
-}
+import("../runtime_args.gni")
 
 # Generate a resources.cc file for the service isolate without Observatory.
 action("gen_resources_cc") {
@@ -333,6 +313,10 @@
       "winmm.lib",
     ]
   }
+
+  if (defined(is_fuchsia) && is_fuchsia) {
+    libs = [ "launchpad" ]
+  }
 }
 
 # A source set for the implementation of 'dart:io' library
@@ -430,6 +414,10 @@
       ]
     }
 
+    if (defined(is_fuchsia) && is_fuchsia) {
+      libs = [ "launchpad" ]
+    }
+
     sources = io_impl_sources_gypi + builtin_impl_sources_gypi
     sources += [
                  "builtin_natives.cc",
@@ -564,6 +552,17 @@
                  "..:dart_maybe_product_config",
                ] + extra_configs
 
+    if (defined(is_fuchsia_host) && is_fuchsia_host) {
+      # We already have these in the standalone build, but Fuchsia doesn't
+      # have them. They are needed for running Fuchsia binaries built for the
+      # host.
+      if (is_linux) {
+        configs += [ "../../build/config/gcc:executable_ldconfig" ]
+      } else if (is_mac) {
+        configs += [ "../../build/config/mac:mac_dynamic_flags" ]
+      }
+    }
+
     deps = [
              ":gen_resources_cc",
              ":standalone_dart_io",
@@ -571,12 +570,13 @@
              "$dart_zlib_path",
            ] + extra_deps
 
+    defines = extra_defines
+
     if (dart_use_tcmalloc) {
       deps += [ "//third_party/tcmalloc" ]
+      defines += [ "DART_USE_TCMALLOC" ]
     }
 
-    defines = extra_defines
-
     sources = [
                 "main.cc",
                 "vmservice_impl.cc",
@@ -604,40 +604,32 @@
         "winmm.lib",
       ]
     }
+
+    if (defined(is_fuchsia) && is_fuchsia) {
+      libs = [ "launchpad" ]
+    }
   }
 }
 
-if (!defined(is_fuchsia) || !is_fuchsia) {
-  dart_executable("dart") {
-    extra_deps = [
-      "..:libdart",
-      ":dart_snapshot_cc",
-      "../observatory:standalone_observatory_archive",
-    ]
-    extra_sources = [ "builtin_nolib.cc" ]
-  }
+dart_executable("dart") {
+  extra_deps = [
+    "..:libdart",
+    ":dart_snapshot_cc",
+    "../observatory:standalone_observatory_archive",
+  ]
+  extra_sources = [ "builtin_nolib.cc" ]
+}
 
-  dart_executable("dart_noopt") {
-    extra_configs = [ "..:dart_precompiler_config" ]
-    extra_deps = [
-      "..:libdart_noopt",
-      ":dart_snapshot_cc",
-      "../observatory:standalone_observatory_archive",
-    ]
-    extra_sources = [ "builtin_nolib.cc" ]
-  }
-
-  dart_executable("dart_precompiled_runtime") {
-    extra_configs = [ "..:dart_precompiled_runtime_config" ]
-    extra_deps = [
-      "..:libdart_precompiled_runtime",
-      "../observatory:standalone_observatory_archive",
-    ]
-    extra_sources = [
-      "builtin_nolib.cc",
-      "snapshot_empty.cc",
-    ]
-  }
+dart_executable("dart_precompiled_runtime") {
+  extra_configs = [ "..:dart_precompiled_runtime_config" ]
+  extra_deps = [
+    "..:libdart_precompiled_runtime",
+    "../observatory:standalone_observatory_archive",
+  ]
+  extra_sources = [
+    "builtin_nolib.cc",
+    "snapshot_empty.cc",
+  ]
 }
 
 dart_executable("dart_bootstrap") {
@@ -764,10 +756,15 @@
 }
 
 executable("run_vm_tests") {
+  if (defined(is_fuchsia) && (is_fuchsia || is_fuchsia_host)) {
+    testonly = true
+  }
+
   configs += [
     "..:dart_config",
     "..:dart_maybe_product_config",
   ]
+
   deps = [
     ":dart_snapshot_cc",
     ":generate_snapshot_test_dat_file",
@@ -784,6 +781,7 @@
 
   if (dart_use_tcmalloc) {
     deps += [ "//third_party/tcmalloc" ]
+    defines += [ "DART_USE_TCMALLOC" ]
   }
 
   # The VM sources are already included in libdart, so we just want to add in
@@ -810,44 +808,48 @@
   }
 }
 
-if (!defined(is_fuchsia) || !is_fuchsia) {
-  shared_library("test_extension") {
-    deps = [
-      ":dart",
-    ]
-    sources = [
-      "test_extension.c",
-      "test_extension_dllmain_win.cc",
-    ]
-    include_dirs = [ ".." ]
-    defines = [
-      # The only effect of DART_SHARED_LIB is to export the Dart API.
-      "DART_SHARED_LIB",
-    ]
-    if (is_win) {
-      libs = [ "dart.lib" ]
-      abs_root_out_dir = rebase_path(root_out_dir)
-      ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
-    }
+shared_library("test_extension") {
+  deps = [
+    ":dart",
+  ]
+  sources = [
+    "test_extension.c",
+    "test_extension_dllmain_win.cc",
+  ]
+  include_dirs = [ ".." ]
+  defines = [
+    # The only effect of DART_SHARED_LIB is to export the Dart API.
+    "DART_SHARED_LIB",
+  ]
+  if (is_linux || is_android) {
+    cflags = [ "-fPIC" ]
   }
+  if (is_win) {
+    libs = [ "dart.lib" ]
+    abs_root_out_dir = rebase_path(root_out_dir)
+    ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
+  }
+}
 
-  shared_library("sample_extension") {
-    deps = [
-      ":dart",
-    ]
-    sources = [
-      "../../samples/sample_extension/sample_extension.cc",
-      "../../samples/sample_extension/sample_extension_dllmain_win.cc",
-    ]
-    include_dirs = [ ".." ]
-    defines = [
-      # The only effect of DART_SHARED_LIB is to export the Dart API.
-      "DART_SHARED_LIB",
-    ]
-    if (is_win) {
-      libs = [ "dart.lib" ]
-      abs_root_out_dir = rebase_path(root_out_dir)
-      ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
-    }
+shared_library("sample_extension") {
+  deps = [
+    ":dart",
+  ]
+  sources = [
+    "../../samples/sample_extension/sample_extension.cc",
+    "../../samples/sample_extension/sample_extension_dllmain_win.cc",
+  ]
+  include_dirs = [ ".." ]
+  defines = [
+    # The only effect of DART_SHARED_LIB is to export the Dart API.
+    "DART_SHARED_LIB",
+  ]
+  if (is_linux || is_android) {
+    cflags = [ "-fPIC" ]
+  }
+  if (is_win) {
+    libs = [ "dart.lib" ]
+    abs_root_out_dir = rebase_path(root_out_dir)
+    ldflags = [ "/LIBPATH:$abs_root_out_dir" ]
   }
 }
diff --git a/runtime/bin/bin.gypi b/runtime/bin/bin.gypi
index f460a08..d546638 100644
--- a/runtime/bin/bin.gypi
+++ b/runtime/bin/bin.gypi
@@ -1147,67 +1147,13 @@
             },
           },
         }],
-        ['OS == "linux" and asan == 0 and msan == 0', {
+        ['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
           'dependencies': [
             '../third_party/tcmalloc/tcmalloc.gypi:tcmalloc',
           ],
-        }],
-      ],
-      'configurations': {
-        'Dart_Linux_Base': {
-          # Have the linker add all symbols to the dynamic symbol table
-          # so that extensions can look them up dynamically in the binary.
-          'ldflags': [
-            '-rdynamic',
+          'defines': [
+            'DART_USE_TCMALLOC'
           ],
-        },
-      },
-    },
-    {
-      # dart binary with a snapshot of corelibs built in and support for testing
-      # precompilation (aka --noopt)
-      'target_name': 'dart_noopt',
-      'type': 'executable',
-      'dependencies': [
-        'build_observatory#host',
-        'generate_observatory_assets_cc_file#host',
-        'generate_resources_cc_file#host',
-        'generate_snapshot_file#host',
-        'libdart_builtin',
-        'libdart_io',
-        'libdart_noopt',
-      ],
-      'include_dirs': [
-        '..',
-      ],
-      'sources': [
-        'main.cc',
-        'builtin.h',
-        'builtin_common.cc',
-        'builtin_natives.cc',
-        'builtin_nolib.cc',
-        'io_natives.h',
-        'vmservice_impl.cc',
-        'vmservice_impl.h',
-        '<(observatory_assets_cc_file)',
-        '<(resources_cc_file)',
-        '<(snapshot_cc_file)',
-      ],
-      'defines': [
-        'DART_PRECOMPILER',
-      ],
-      'conditions': [
-        ['OS=="win"', {
-          'link_settings': {
-            'libraries': [ '-lws2_32.lib', '-lRpcrt4.lib', '-lwinmm.lib' ],
-          },
-          # Generate an import library on Windows, by exporting a function.
-          # Extensions use this import library to link to the API in dart.exe.
-          'msvs_settings': {
-            'VCLinkerTool': {
-              'AdditionalOptions': [ '/EXPORT:Dart_True' ],
-            },
-          },
         }],
       ],
       'configurations': {
@@ -1398,10 +1344,13 @@
             'libraries': [ '-lws2_32.lib', '-lRpcrt4.lib', '-lwinmm.lib' ],
           },
         }],
-        ['OS == "linux" and asan == 0 and msan == 0', {
+        ['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
           'dependencies': [
             '../third_party/tcmalloc/tcmalloc.gypi:tcmalloc',
           ],
+          'defines': [
+            'DART_USE_TCMALLOC'
+          ],
         }],
       ],
       'configurations': {
diff --git a/runtime/bin/crypto_fuchsia.cc b/runtime/bin/crypto_fuchsia.cc
index a066574..dde76ac 100644
--- a/runtime/bin/crypto_fuchsia.cc
+++ b/runtime/bin/crypto_fuchsia.cc
@@ -18,7 +18,7 @@
     const intptr_t remaining = count - read;
     const intptr_t len =
         (MX_CPRNG_DRAW_MAX_LEN < remaining) ? MX_CPRNG_DRAW_MAX_LEN : remaining;
-    mx_size_t res = 0;
+    size_t res = 0;
     const mx_status_t status = mx_cprng_draw(buffer + read, len, &res);
     if (status != NO_ERROR) {
       return false;
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index 3997a32d..f99a5d1 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -124,12 +124,22 @@
   Dart_Handle path = Dart_GetNativeArgument(args, 1);
   Dart_Handle recursive = Dart_GetNativeArgument(args, 2);
   Dart_Handle follow_links = Dart_GetNativeArgument(args, 3);
-  // Pass the list that should hold the directory listing to the
-  // SyncDirectoryListing object, which adds elements to it.
-  SyncDirectoryListing sync_listing(results, DartUtils::GetStringValue(path),
-                                    DartUtils::GetBooleanValue(recursive),
-                                    DartUtils::GetBooleanValue(follow_links));
-  Directory::List(&sync_listing);
+
+  Dart_Handle dart_error;
+  {
+    // Pass the list that should hold the directory listing to the
+    // SyncDirectoryListing object, which adds elements to it.
+    SyncDirectoryListing sync_listing(results, DartUtils::GetStringValue(path),
+                                      DartUtils::GetBooleanValue(recursive),
+                                      DartUtils::GetBooleanValue(follow_links));
+    Directory::List(&sync_listing);
+    dart_error = sync_listing.dart_error();
+  }
+  if (Dart_IsError(dart_error)) {
+    Dart_PropagateError(dart_error);
+  } else if (!Dart_IsNull(dart_error)) {
+    Dart_ThrowException(dart_error);
+  }
 }
 
 
@@ -401,7 +411,8 @@
   Dart_Handle dir = Dart_New(directory_type_, Dart_Null(), 1, &dir_name_dart);
   Dart_Handle result = Dart_Invoke(results_, add_string_, 1, &dir);
   if (Dart_IsError(result)) {
-    Dart_PropagateError(result);
+    dart_error_ = result;
+    return false;
   }
   return true;
 }
@@ -412,7 +423,8 @@
   Dart_Handle link = Dart_New(link_type_, Dart_Null(), 1, &link_name_dart);
   Dart_Handle result = Dart_Invoke(results_, add_string_, 1, &link);
   if (Dart_IsError(result)) {
-    Dart_PropagateError(result);
+    dart_error_ = result;
+    return false;
   }
   return true;
 }
@@ -423,7 +435,8 @@
   Dart_Handle file = Dart_New(file_type_, Dart_Null(), 1, &file_name_dart);
   Dart_Handle result = Dart_Invoke(results_, add_string_, 1, &file);
   if (Dart_IsError(result)) {
-    Dart_PropagateError(result);
+    dart_error_ = result;
+    return false;
   }
   return true;
 }
@@ -435,10 +448,11 @@
   args[0] = DartUtils::NewString("Directory listing failed");
   args[1] = DartUtils::NewString(error() ? "Invalid path" : CurrentPath());
   args[2] = dart_os_error;
-  Dart_ThrowException(Dart_New(
+
+  dart_error_ = Dart_New(
       DartUtils::GetDartType(DartUtils::kIOLibURL, "FileSystemException"),
-      Dart_Null(), 3, args));
-  return true;
+      Dart_Null(), 3, args);
+  return false;
 }
 
 
diff --git a/runtime/bin/directory.h b/runtime/bin/directory.h
index 86026b7..433a6cc 100644
--- a/runtime/bin/directory.h
+++ b/runtime/bin/directory.h
@@ -196,7 +196,9 @@
                        const char* dir_name,
                        bool recursive,
                        bool follow_links)
-      : DirectoryListing(dir_name, recursive, follow_links), results_(results) {
+      : DirectoryListing(dir_name, recursive, follow_links),
+        results_(results),
+        dart_error_(Dart_Null()) {
     add_string_ = DartUtils::NewString("add");
     directory_type_ = DartUtils::GetDartType(DartUtils::kIOLibURL, "Directory");
     file_type_ = DartUtils::GetDartType(DartUtils::kIOLibURL, "File");
@@ -208,12 +210,15 @@
   virtual bool HandleLink(const char* file_name);
   virtual bool HandleError();
 
+  Dart_Handle dart_error() { return dart_error_; }
+
  private:
   Dart_Handle results_;
   Dart_Handle add_string_;
   Dart_Handle directory_type_;
   Dart_Handle file_type_;
   Dart_Handle link_type_;
+  Dart_Handle dart_error_;
 
   DISALLOW_ALLOCATION()
   DISALLOW_IMPLICIT_CONSTRUCTORS(SyncDirectoryListing);
diff --git a/runtime/bin/directory_android.cc b/runtime/bin/directory_android.cc
index e61d513..b4ad7c0 100644
--- a/runtime/bin/directory_android.cc
+++ b/runtime/bin/directory_android.cc
@@ -129,6 +129,10 @@
           return Next(listing);
         }
         return kListDirectory;
+      case DT_BLK:
+      case DT_CHR:
+      case DT_FIFO:
+      case DT_SOCK:
       case DT_REG:
         return kListFile;
       case DT_LNK:
@@ -184,15 +188,23 @@
             return Next(listing);
           }
           return kListDirectory;
-        } else if (S_ISREG(entry_info.st_mode)) {
+        } else if (S_ISREG(entry_info.st_mode) || S_ISCHR(entry_info.st_mode) ||
+                   S_ISBLK(entry_info.st_mode) ||
+                   S_ISFIFO(entry_info.st_mode) ||
+                   S_ISSOCK(entry_info.st_mode)) {
           return kListFile;
         } else if (S_ISLNK(entry_info.st_mode)) {
           return kListLink;
+        } else {
+          FATAL1("Unexpected st_mode: %d\n", entry_info.st_mode);
+          return kListError;
         }
       }
 
       default:
-        break;
+        // We should have covered all the bases. If not, let's get an error.
+        FATAL1("Unexpected d_type: %d\n", entry.d_type);
+        return kListError;
     }
   }
   done_ = true;
@@ -247,7 +259,7 @@
   struct stat st;
   if (NO_RETRY_EXPECTED(lstat(path->AsString(), &st)) == -1) {
     return false;
-  } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
+  } else if (!S_ISDIR(st.st_mode)) {
     return (unlink(path->AsString()) == 0);
   }
 
@@ -280,6 +292,10 @@
       case DT_DIR:
         ok = DeleteDir(entry.d_name, path);
         break;
+      case DT_BLK:
+      case DT_CHR:
+      case DT_FIFO:
+      case DT_SOCK:
       case DT_REG:
       case DT_LNK:
         // Treat all links as files. This will delete the link which
@@ -301,7 +317,7 @@
         path->Reset(path_length);
         if (S_ISDIR(entry_info.st_mode)) {
           ok = DeleteDir(entry.d_name, path);
-        } else if (S_ISREG(entry_info.st_mode) || S_ISLNK(entry_info.st_mode)) {
+        } else {
           // Treat links as files. This will delete the link which is
           // what we want no matter if the link target is a file or a
           // directory.
@@ -310,6 +326,8 @@
         break;
       }
       default:
+        // We should have covered all the bases. If not, let's get an error.
+        FATAL1("Unexpected d_type: %d\n", entry.d_type);
         break;
     }
     if (!ok) {
@@ -333,6 +351,9 @@
     if (S_ISDIR(entry_info.st_mode)) {
       return EXISTS;
     } else {
+      // An OSError may be constructed based on the return value of this
+      // function, so set errno to something that makes sense.
+      errno = ENOTDIR;
       return DOES_NOT_EXIST;
     }
   } else {
diff --git a/runtime/bin/directory_fuchsia.cc b/runtime/bin/directory_fuchsia.cc
index 24ecd27..f47f81d4 100644
--- a/runtime/bin/directory_fuchsia.cc
+++ b/runtime/bin/directory_fuchsia.cc
@@ -7,9 +7,11 @@
 
 #include "bin/directory.h"
 
+#include <dirent.h>    // NOLINT
 #include <errno.h>     // NOLINT
 #include <stdlib.h>    // NOLINT
 #include <string.h>    // NOLINT
+#include <sys/param.h>  // NOLINT
 #include <sys/stat.h>  // NOLINT
 #include <unistd.h>    // NOLINT
 
@@ -79,19 +81,131 @@
 }
 
 
+// A linked list of symbolic links, with their unique file system identifiers.
+// These are scanned to detect loops while doing a recursive directory listing.
+struct LinkList {
+  dev_t dev;
+  ino64_t ino;
+  LinkList* next;
+};
+
+
 ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
-  UNIMPLEMENTED();
-  return kListError;
+  if (done_) {
+    return kListDone;
+  }
+
+  if (lister_ == 0) {
+    lister_ =
+        reinterpret_cast<intptr_t>(opendir(listing->path_buffer().AsString()));
+    if (lister_ == 0) {
+      perror("opendir failed: ");
+      done_ = true;
+      return kListError;
+    }
+    if (parent_ != NULL) {
+      if (!listing->path_buffer().Add(File::PathSeparator())) {
+        return kListError;
+      }
+    }
+    path_length_ = listing->path_buffer().length();
+  }
+  // Reset.
+  listing->path_buffer().Reset(path_length_);
+  ResetLink();
+
+  // Iterate the directory and post the directories and files to the
+  // ports.
+  errno = 0;
+  dirent* entry = readdir(reinterpret_cast<DIR*>(lister_));
+  if (entry != NULL) {
+    if (!listing->path_buffer().Add(entry->d_name)) {
+      done_ = true;
+      return kListError;
+    }
+    // TODO(MG-450): When entry->d_type is filled out correctly, we can avoid
+    // this call to stat().
+    struct stat64 entry_info;
+    int stat_success;
+    stat_success = NO_RETRY_EXPECTED(
+        lstat64(listing->path_buffer().AsString(), &entry_info));
+    if (stat_success == -1) {
+      perror("lstat64 failed: ");
+      return kListError;
+    }
+    if (listing->follow_links() && S_ISLNK(entry_info.st_mode)) {
+      // Check to see if we are in a loop created by a symbolic link.
+      LinkList current_link = {entry_info.st_dev, entry_info.st_ino, link_};
+      LinkList* previous = link_;
+      while (previous != NULL) {
+        if ((previous->dev == current_link.dev) &&
+            (previous->ino == current_link.ino)) {
+          // Report the looping link as a link, rather than following it.
+          return kListLink;
+        }
+        previous = previous->next;
+      }
+      stat_success = NO_RETRY_EXPECTED(
+          stat64(listing->path_buffer().AsString(), &entry_info));
+      if (stat_success == -1) {
+        perror("lstat64 failed");
+        // Report a broken link as a link, even if follow_links is true.
+        return kListLink;
+      }
+      if (S_ISDIR(entry_info.st_mode)) {
+        // Recurse into the subdirectory with current_link added to the
+        // linked list of seen file system links.
+        link_ = new LinkList(current_link);
+        if ((strcmp(entry->d_name, ".") == 0) ||
+            (strcmp(entry->d_name, "..") == 0)) {
+          return Next(listing);
+        }
+        return kListDirectory;
+      }
+    }
+    if (S_ISDIR(entry_info.st_mode)) {
+      if ((strcmp(entry->d_name, ".") == 0) ||
+          (strcmp(entry->d_name, "..") == 0)) {
+        return Next(listing);
+      }
+      return kListDirectory;
+    } else if (S_ISREG(entry_info.st_mode) || S_ISCHR(entry_info.st_mode) ||
+               S_ISBLK(entry_info.st_mode) || S_ISFIFO(entry_info.st_mode) ||
+               S_ISSOCK(entry_info.st_mode)) {
+      return kListFile;
+    } else if (S_ISLNK(entry_info.st_mode)) {
+      return kListLink;
+    } else {
+      FATAL1("Unexpected st_mode: %d\n", entry_info.st_mode);
+      return kListError;
+    }
+  }
+  done_ = true;
+
+  if (errno != 0) {
+    return kListError;
+  }
+
+  return kListDone;
 }
 
 
 DirectoryListingEntry::~DirectoryListingEntry() {
-  UNIMPLEMENTED();
+  ResetLink();
+  if (lister_ != 0) {
+    VOID_NO_RETRY_EXPECTED(closedir(reinterpret_cast<DIR*>(lister_)));
+  }
 }
 
 
 void DirectoryListingEntry::ResetLink() {
-  UNIMPLEMENTED();
+  if ((link_ != NULL) && ((parent_ == NULL) || (parent_->link_ != link_))) {
+    delete link_;
+    link_ = NULL;
+  }
+  if (parent_ != NULL) {
+    link_ = parent_->link_;
+  }
 }
 
 
@@ -102,6 +216,9 @@
     if (S_ISDIR(entry_info.st_mode)) {
       return EXISTS;
     } else {
+      // An OSError may be constructed based on the return value of this
+      // function, so set errno to something that makes sense.
+      errno = ENOTDIR;
       return DOES_NOT_EXIST;
     }
   } else {
@@ -186,10 +303,7 @@
     // Pattern has overflowed.
     return NULL;
   }
-  char* result;
-  do {
-    result = mkdtemp(path.AsString());
-  } while ((result == NULL) && (errno == EINTR));
+  char* result = mkdtemp(path.AsString());
   if (result == NULL) {
     return NULL;
   }
@@ -197,6 +311,98 @@
 }
 
 
+static bool DeleteRecursively(PathBuffer* path);
+
+
+static bool DeleteFile(char* file_name, PathBuffer* path) {
+  return path->Add(file_name) &&
+         (NO_RETRY_EXPECTED(unlink(path->AsString())) == 0);
+}
+
+
+static bool DeleteDir(char* dir_name, PathBuffer* path) {
+  if ((strcmp(dir_name, ".") == 0) || (strcmp(dir_name, "..") == 0)) {
+    return true;
+  }
+  return path->Add(dir_name) && DeleteRecursively(path);
+}
+
+
+static bool DeleteRecursively(PathBuffer* path) {
+  // Do not recurse into links for deletion. Instead delete the link.
+  // If it's a file, delete it.
+  struct stat64 st;
+  if (NO_RETRY_EXPECTED(lstat64(path->AsString(), &st)) == -1) {
+    return false;
+  } else if (!S_ISDIR(st.st_mode)) {
+    return NO_RETRY_EXPECTED(unlink(path->AsString())) == 0;
+  }
+
+  if (!path->Add(File::PathSeparator())) {
+    return false;
+  }
+
+  // Not a link. Attempt to open as a directory and recurse into the
+  // directory.
+  DIR* dir_pointer = opendir(path->AsString());
+  if (dir_pointer == NULL) {
+    return false;
+  }
+
+  // Iterate the directory and delete all files and directories.
+  int path_length = path->length();
+  while (true) {
+    // In case `readdir()` returns `NULL` we distinguish between end-of-stream
+    // and error by looking if `errno` was updated.
+    errno = 0;
+    // In glibc 2.24+, readdir_r is deprecated.
+    // According to the man page for readdir:
+    // "readdir(3) is not required to be thread-safe. However, in modern
+    // implementations (including the glibc implementation), concurrent calls to
+    // readdir(3) that specify different directory streams are thread-safe."
+    dirent* entry = readdir(dir_pointer);
+    if (entry == NULL) {
+      // Failed to read next directory entry.
+      if (errno != 0) {
+        break;
+      }
+      // End of directory.
+      return (NO_RETRY_EXPECTED(closedir(dir_pointer)) == 0) &&
+             (NO_RETRY_EXPECTED(remove(path->AsString())) == 0);
+    }
+    bool ok = false;
+    if (!path->Add(entry->d_name)) {
+      break;
+    }
+    // TODO(MG-450): When entry->d_type is filled out correctly, we can avoid
+    // this call to stat().
+    struct stat64 entry_info;
+    if (NO_RETRY_EXPECTED(lstat64(path->AsString(), &entry_info)) == -1) {
+      break;
+    }
+    path->Reset(path_length);
+    if (S_ISDIR(entry_info.st_mode)) {
+      ok = DeleteDir(entry->d_name, path);
+    } else {
+      // Treat links as files. This will delete the link which is
+      // what we want no matter if the link target is a file or a
+      // directory.
+      ok = DeleteFile(entry->d_name, path);
+    }
+    if (!ok) {
+      break;
+    }
+    path->Reset(path_length);
+  }
+  // Only happens if there was an error.
+  ASSERT(errno != 0);
+  int err = errno;
+  VOID_NO_RETRY_EXPECTED(closedir(dir_pointer));
+  errno = err;
+  return false;
+}
+
+
 bool Directory::Delete(const char* dir_name, bool recursive) {
   if (!recursive) {
     if ((File::GetType(dir_name, false) == File::kIsLink) &&
@@ -205,8 +411,11 @@
     }
     return NO_RETRY_EXPECTED(rmdir(dir_name)) == 0;
   } else {
-    UNIMPLEMENTED();
-    return false;
+    PathBuffer path;
+    if (!path.Add(dir_name)) {
+      return false;
+    }
+    return DeleteRecursively(&path);
   }
 }
 
diff --git a/runtime/bin/directory_linux.cc b/runtime/bin/directory_linux.cc
index 43ee548..f2a064a 100644
--- a/runtime/bin/directory_linux.cc
+++ b/runtime/bin/directory_linux.cc
@@ -127,6 +127,10 @@
           return Next(listing);
         }
         return kListDirectory;
+      case DT_BLK:
+      case DT_CHR:
+      case DT_FIFO:
+      case DT_SOCK:
       case DT_REG:
         return kListFile;
       case DT_LNK:
@@ -182,15 +186,23 @@
             return Next(listing);
           }
           return kListDirectory;
-        } else if (S_ISREG(entry_info.st_mode)) {
+        } else if (S_ISREG(entry_info.st_mode) || S_ISCHR(entry_info.st_mode) ||
+                   S_ISBLK(entry_info.st_mode) ||
+                   S_ISFIFO(entry_info.st_mode) ||
+                   S_ISSOCK(entry_info.st_mode)) {
           return kListFile;
         } else if (S_ISLNK(entry_info.st_mode)) {
           return kListLink;
+        } else {
+          FATAL1("Unexpected st_mode: %d\n", entry_info.st_mode);
+          return kListError;
         }
       }
 
       default:
-        break;
+        // We should have covered all the bases. If not, let's get an error.
+        FATAL1("Unexpected d_type: %d\n", entry->d_type);
+        return kListError;
     }
   }
   done_ = true;
@@ -245,7 +257,7 @@
   struct stat64 st;
   if (TEMP_FAILURE_RETRY(lstat64(path->AsString(), &st)) == -1) {
     return false;
-  } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
+  } else if (!S_ISDIR(st.st_mode)) {
     return (NO_RETRY_EXPECTED(unlink(path->AsString())) == 0);
   }
 
@@ -289,6 +301,10 @@
       case DT_DIR:
         ok = DeleteDir(entry->d_name, path);
         break;
+      case DT_BLK:
+      case DT_CHR:
+      case DT_FIFO:
+      case DT_SOCK:
       case DT_REG:
       case DT_LNK:
         // Treat all links as files. This will delete the link which
@@ -310,7 +326,7 @@
         path->Reset(path_length);
         if (S_ISDIR(entry_info.st_mode)) {
           ok = DeleteDir(entry->d_name, path);
-        } else if (S_ISREG(entry_info.st_mode) || S_ISLNK(entry_info.st_mode)) {
+        } else {
           // Treat links as files. This will delete the link which is
           // what we want no matter if the link target is a file or a
           // directory.
@@ -319,6 +335,8 @@
         break;
       }
       default:
+        // We should have covered all the bases. If not, let's get an error.
+        FATAL1("Unexpected d_type: %d\n", entry->d_type);
         break;
     }
     if (!ok) {
@@ -342,6 +360,9 @@
     if (S_ISDIR(entry_info.st_mode)) {
       return EXISTS;
     } else {
+      // An OSError may be constructed based on the return value of this
+      // function, so set errno to something that makes sense.
+      errno = ENOTDIR;
       return DOES_NOT_EXIST;
     }
   } else {
diff --git a/runtime/bin/directory_macos.cc b/runtime/bin/directory_macos.cc
index 18c254c..ca0d41b 100644
--- a/runtime/bin/directory_macos.cc
+++ b/runtime/bin/directory_macos.cc
@@ -129,6 +129,10 @@
           return Next(listing);
         }
         return kListDirectory;
+      case DT_BLK:
+      case DT_CHR:
+      case DT_FIFO:
+      case DT_SOCK:
       case DT_REG:
         return kListFile;
       case DT_LNK:
@@ -184,15 +188,23 @@
             return Next(listing);
           }
           return kListDirectory;
-        } else if (S_ISREG(entry_info.st_mode)) {
+        } else if (S_ISREG(entry_info.st_mode) || S_ISCHR(entry_info.st_mode) ||
+                   S_ISBLK(entry_info.st_mode) ||
+                   S_ISFIFO(entry_info.st_mode) ||
+                   S_ISSOCK(entry_info.st_mode)) {
           return kListFile;
         } else if (S_ISLNK(entry_info.st_mode)) {
           return kListLink;
+        } else {
+          FATAL1("Unexpected st_mode: %d\n", entry_info.st_mode);
+          return kListError;
         }
       }
 
       default:
-        break;
+        // We should have covered all the bases. If not, let's get an error.
+        FATAL1("Unexpected d_type: %d\n", entry.d_type);
+        return kListError;
     }
   }
   done_ = true;
@@ -247,7 +259,7 @@
   struct stat st;
   if (NO_RETRY_EXPECTED(lstat(path->AsString(), &st)) == -1) {
     return false;
-  } else if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
+  } else if (!S_ISDIR(st.st_mode)) {
     return (unlink(path->AsString()) == 0);
   }
 
@@ -280,6 +292,10 @@
       case DT_DIR:
         ok = DeleteDir(entry.d_name, path);
         break;
+      case DT_BLK:
+      case DT_CHR:
+      case DT_FIFO:
+      case DT_SOCK:
       case DT_REG:
       case DT_LNK:
         // Treat all links as files. This will delete the link which
@@ -301,7 +317,7 @@
         path->Reset(path_length);
         if (S_ISDIR(entry_info.st_mode)) {
           ok = DeleteDir(entry.d_name, path);
-        } else if (S_ISREG(entry_info.st_mode) || S_ISLNK(entry_info.st_mode)) {
+        } else {
           // Treat links as files. This will delete the link which is
           // what we want no matter if the link target is a file or a
           // directory.
@@ -310,6 +326,8 @@
         break;
       }
       default:
+        // We should have covered all the bases. If not, let's get an error.
+        FATAL1("Unexpected d_type: %d\n", entry.d_type);
         break;
     }
     if (!ok) {
@@ -333,6 +351,9 @@
     if (S_ISDIR(entry_info.st_mode)) {
       return EXISTS;
     } else {
+      // An OSError may be constructed based on the return value of this
+      // function, so set errno to something that makes sense.
+      errno = ENOTDIR;
       return DOES_NOT_EXIST;
     }
   } else {
diff --git a/runtime/bin/eventhandler_android.cc b/runtime/bin/eventhandler_android.cc
index c9c4b0d..8ab91cd 100644
--- a/runtime/bin/eventhandler_android.cc
+++ b/runtime/bin/eventhandler_android.cc
@@ -336,9 +336,12 @@
     } else {
       DescriptorInfo* di =
           reinterpret_cast<DescriptorInfo*>(events[i].data.ptr);
-      intptr_t event_mask = GetPollEvents(events[i].events, di);
-      if (event_mask != 0) {
-        intptr_t old_mask = di->Mask();
+      const intptr_t old_mask = di->Mask();
+      const intptr_t event_mask = GetPollEvents(events[i].events, di);
+      if ((event_mask & (1 << kErrorEvent)) != 0) {
+        di->NotifyAllDartPorts(event_mask);
+        UpdateEpollInstance(old_mask, di);
+      } else if (event_mask != 0) {
         Dart_Port port = di->NextNotifyDartPort(event_mask);
         ASSERT(port != 0);
         UpdateEpollInstance(old_mask, di);
diff --git a/runtime/bin/eventhandler_fuchsia.cc b/runtime/bin/eventhandler_fuchsia.cc
index c298e22..6531ce5 100644
--- a/runtime/bin/eventhandler_fuchsia.cc
+++ b/runtime/bin/eventhandler_fuchsia.cc
@@ -327,7 +327,10 @@
           delete di;
         }
 
-        DartUtils::PostInt32(port, 1 << kDestroyedEvent);
+        bool success = DartUtils::PostInt32(port, 1 << kDestroyedEvent);
+        if (!success) {
+          LOG_ERR("Failed to post destroy event to port %ld", port);
+        }
       } else if (IS_COMMAND(msg[i].data, kReturnTokenCommand)) {
         int count = TOKEN_COUNT(msg[i].data);
         intptr_t old_mask = di->Mask();
@@ -385,16 +388,13 @@
     } else {
       DescriptorInfo* di =
           reinterpret_cast<DescriptorInfo*>(events[i].data.ptr);
-      intptr_t event_mask = GetPollEvents(events[i].events, di);
-
+      const intptr_t old_mask = di->Mask();
+      const intptr_t event_mask = GetPollEvents(events[i].events, di);
+      LOG_INFO("HandleEvents: fd=%ld events=%ld\n", di->fd(), event_mask);
       if ((event_mask & (1 << kErrorEvent)) != 0) {
         di->NotifyAllDartPorts(event_mask);
-      }
-      event_mask &= ~(1 << kErrorEvent);
-
-      LOG_INFO("HandleEvents: fd=%ld events=%ld\n", di->fd(), event_mask);
-      if (event_mask != 0) {
-        intptr_t old_mask = di->Mask();
+        UpdateEpollInstance(old_mask, di);
+      } else if (event_mask != 0) {
         Dart_Port port = di->NextNotifyDartPort(event_mask);
         ASSERT(port != 0);
         UpdateEpollInstance(old_mask, di);
@@ -404,7 +404,8 @@
         if (!success) {
           // This can happen if e.g. the isolate that owns the port has died
           // for some reason.
-          FATAL2("Failed to post event for fd %ld to port %ld", di->fd(), port);
+          LOG_ERR("Failed to post event for fd %ld to port %ld", di->fd(),
+                  port);
         }
       }
     }
@@ -449,6 +450,10 @@
   while (!handler_impl->shutdown_) {
     int64_t millis = handler_impl->GetTimeout();
     ASSERT((millis == kInfinityTimeout) || (millis >= 0));
+    // TODO(US-109): When the epoll implementation is properly edge-triggered,
+    // remove this sleep, which prevents the message queue from being
+    // overwhelmed and leading to memory exhaustion.
+    usleep(5000);
     LOG_INFO("epoll_wait(millis = %ld)\n", millis);
     intptr_t result = NO_RETRY_EXPECTED(
         epoll_wait(handler_impl->epoll_fd_, events, kMaxEvents, millis));
diff --git a/runtime/bin/eventhandler_linux.cc b/runtime/bin/eventhandler_linux.cc
index 8b35818..24e7755 100644
--- a/runtime/bin/eventhandler_linux.cc
+++ b/runtime/bin/eventhandler_linux.cc
@@ -361,15 +361,12 @@
     } else {
       DescriptorInfo* di =
           reinterpret_cast<DescriptorInfo*>(events[i].data.ptr);
-      intptr_t event_mask = GetPollEvents(events[i].events, di);
-
+      const intptr_t old_mask = di->Mask();
+      const intptr_t event_mask = GetPollEvents(events[i].events, di);
       if ((event_mask & (1 << kErrorEvent)) != 0) {
         di->NotifyAllDartPorts(event_mask);
-      }
-      event_mask &= ~(1 << kErrorEvent);
-
-      if (event_mask != 0) {
-        intptr_t old_mask = di->Mask();
+        UpdateEpollInstance(old_mask, di);
+      } else if (event_mask != 0) {
         Dart_Port port = di->NextNotifyDartPort(event_mask);
         ASSERT(port != 0);
         UpdateEpollInstance(old_mask, di);
diff --git a/runtime/bin/eventhandler_macos.cc b/runtime/bin/eventhandler_macos.cc
index 640f05a..7aa9280 100644
--- a/runtime/bin/eventhandler_macos.cc
+++ b/runtime/bin/eventhandler_macos.cc
@@ -388,14 +388,12 @@
       interrupt_seen = true;
     } else {
       DescriptorInfo* di = reinterpret_cast<DescriptorInfo*>(events[i].udata);
-      intptr_t event_mask = GetEvents(events + i, di);
+      const intptr_t old_mask = di->Mask();
+      const intptr_t event_mask = GetEvents(events + i, di);
       if ((event_mask & (1 << kErrorEvent)) != 0) {
         di->NotifyAllDartPorts(event_mask);
-      }
-      event_mask &= ~(1 << kErrorEvent);
-
-      if (event_mask != 0) {
-        intptr_t old_mask = di->Mask();
+        UpdateKQueueInstance(old_mask, di);
+      } else if (event_mask != 0) {
         Dart_Port port = di->NextNotifyDartPort(event_mask);
         ASSERT(port != 0);
         UpdateKQueueInstance(old_mask, di);
diff --git a/runtime/bin/eventhandler_win.cc b/runtime/bin/eventhandler_win.cc
index 81adcfd..f988712 100644
--- a/runtime/bin/eventhandler_win.cc
+++ b/runtime/bin/eventhandler_win.cc
@@ -145,6 +145,12 @@
 
 
 void Handle::Close() {
+  if (!SupportsOverlappedIO()) {
+    // If the handle uses synchronous I/O (e.g. stdin), cancel any pending
+    // operation before closing the handle, so the read thread is not blocked.
+    BOOL result = CancelIoEx(handle_, NULL);
+    ASSERT(result || (GetLastError() == ERROR_NOT_FOUND));
+  }
   MonitorLocker ml(monitor_);
   if (!IsClosing()) {
     // Close the socket and set the closing state. This close method can be
diff --git a/runtime/bin/extensions_android.cc b/runtime/bin/extensions_android.cc
index 44df410..85b20ae 100644
--- a/runtime/bin/extensions_android.cc
+++ b/runtime/bin/extensions_android.cc
@@ -11,10 +11,11 @@
 namespace dart {
 namespace bin {
 
-const char* kPrecompiledVMIsolateSymbolName = "_kVmIsolateSnapshot";
-const char* kPrecompiledIsolateSymbolName = "_kIsolateSnapshot";
-const char* kPrecompiledInstructionsSymbolName = "_kInstructionsSnapshot";
-const char* kPrecompiledDataSymbolName = "_kDataSnapshot";
+const char* kVmSnapshotDataSymbolName = "_kDartVmSnapshotData";
+const char* kVmSnapshotInstructionsSymbolName = "_kDartVmSnapshotInstructions";
+const char* kIsolateSnapshotDataSymbolName = "_kDartIsolateSnapshotData";
+const char* kIsolateSnapshotInstructionsSymbolName =
+    "_kDartIsolateSnapshotInstructions";
 
 void* Extensions::LoadExtensionLibrary(const char* library_file) {
   return dlopen(library_file, RTLD_LAZY);
diff --git a/runtime/bin/extensions_fuchsia.cc b/runtime/bin/extensions_fuchsia.cc
index 691cac3..b464fe0 100644
--- a/runtime/bin/extensions_fuchsia.cc
+++ b/runtime/bin/extensions_fuchsia.cc
@@ -11,10 +11,11 @@
 namespace dart {
 namespace bin {
 
-const char* kPrecompiledVMIsolateSymbolName = "_kVmIsolateSnapshot";
-const char* kPrecompiledIsolateSymbolName = "_kIsolateSnapshot";
-const char* kPrecompiledInstructionsSymbolName = "_kInstructionsSnapshot";
-const char* kPrecompiledDataSymbolName = "_kDataSnapshot";
+const char* kVmSnapshotDataSymbolName = "_kDartVmSnapshotData";
+const char* kVmSnapshotInstructionsSymbolName = "_kDartVmSnapshotInstructions";
+const char* kIsolateSnapshotDataSymbolName = "_kDartIsolateSnapshotData";
+const char* kIsolateSnapshotInstructionsSymbolName =
+    "_kDartIsolateSnapshotInstructions";
 
 void* Extensions::LoadExtensionLibrary(const char* library_file) {
   return dlopen(library_file, RTLD_LAZY);
diff --git a/runtime/bin/extensions_linux.cc b/runtime/bin/extensions_linux.cc
index 264c4ee..1a45e67 100644
--- a/runtime/bin/extensions_linux.cc
+++ b/runtime/bin/extensions_linux.cc
@@ -11,10 +11,11 @@
 namespace dart {
 namespace bin {
 
-const char* kPrecompiledVMIsolateSymbolName = "_kVmIsolateSnapshot";
-const char* kPrecompiledIsolateSymbolName = "_kIsolateSnapshot";
-const char* kPrecompiledInstructionsSymbolName = "_kInstructionsSnapshot";
-const char* kPrecompiledDataSymbolName = "_kDataSnapshot";
+const char* kVmSnapshotDataSymbolName = "_kDartVmSnapshotData";
+const char* kVmSnapshotInstructionsSymbolName = "_kDartVmSnapshotInstructions";
+const char* kIsolateSnapshotDataSymbolName = "_kDartIsolateSnapshotData";
+const char* kIsolateSnapshotInstructionsSymbolName =
+    "_kDartIsolateSnapshotInstructions";
 
 void* Extensions::LoadExtensionLibrary(const char* library_file) {
   return dlopen(library_file, RTLD_LAZY);
diff --git a/runtime/bin/extensions_macos.cc b/runtime/bin/extensions_macos.cc
index 69d712d..d994c17 100644
--- a/runtime/bin/extensions_macos.cc
+++ b/runtime/bin/extensions_macos.cc
@@ -11,10 +11,11 @@
 namespace dart {
 namespace bin {
 
-const char* kPrecompiledVMIsolateSymbolName = "kVmIsolateSnapshot";
-const char* kPrecompiledIsolateSymbolName = "kIsolateSnapshot";
-const char* kPrecompiledInstructionsSymbolName = "kInstructionsSnapshot";
-const char* kPrecompiledDataSymbolName = "kDataSnapshot";
+const char* kVmSnapshotDataSymbolName = "kDartVmSnapshotData";
+const char* kVmSnapshotInstructionsSymbolName = "kDartVmSnapshotInstructions";
+const char* kIsolateSnapshotDataSymbolName = "kDartIsolateSnapshotData";
+const char* kIsolateSnapshotInstructionsSymbolName =
+    "kDartIsolateSnapshotInstructions";
 
 void* Extensions::LoadExtensionLibrary(const char* library_file) {
   return dlopen(library_file, RTLD_LAZY);
diff --git a/runtime/bin/extensions_win.cc b/runtime/bin/extensions_win.cc
index 17bb58f..b07bf59 100644
--- a/runtime/bin/extensions_win.cc
+++ b/runtime/bin/extensions_win.cc
@@ -12,10 +12,11 @@
 namespace dart {
 namespace bin {
 
-const char* kPrecompiledVMIsolateSymbolName = "_kVmIsolateSnapshot";
-const char* kPrecompiledIsolateSymbolName = "_kIsolateSnapshot";
-const char* kPrecompiledInstructionsSymbolName = "_kInstructionsSnapshot";
-const char* kPrecompiledDataSymbolName = "_kDataSnapshot";
+const char* kVmSnapshotDataSymbolName = "_kDartVmSnapshotData";
+const char* kVmSnapshotInstructionsSymbolName = "_kDartVmSnapshotInstructions";
+const char* kIsolateSnapshotDataSymbolName = "_kDartIsolateSnapshotData";
+const char* kIsolateSnapshotInstructionsSymbolName =
+    "_kDartIsolateSnapshotInstructions";
 
 void* Extensions::LoadExtensionLibrary(const char* library_file) {
   SetLastError(0);
diff --git a/runtime/bin/fdutils_fuchsia.cc b/runtime/bin/fdutils_fuchsia.cc
index 4aa4b29..00c9763 100644
--- a/runtime/bin/fdutils_fuchsia.cc
+++ b/runtime/bin/fdutils_fuchsia.cc
@@ -74,6 +74,7 @@
   int available;  // ioctl for FIONREAD expects an 'int*' argument.
   int result = NO_RETRY_EXPECTED(ioctl(fd, FIONREAD, &available));
   if (result < 0) {
+    perror("ioctl(fd, FIONREAD, &available) failed");
     return result;
   }
   ASSERT(available >= 0);
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc
index ee3255a..1abd906 100644
--- a/runtime/bin/file.cc
+++ b/runtime/bin/file.cc
@@ -256,7 +256,8 @@
   ASSERT(buffer != NULL);
 
   // Write all the data out into the file.
-  bool success = file->WriteFully(buffer, length);
+  char* byte_buffer = reinterpret_cast<char*>(buffer);
+  bool success = file->WriteFully(byte_buffer + start, length);
 
   // Release the direct pointer acquired above.
   result = Dart_TypedDataReleaseData(buffer_obj);
diff --git a/runtime/bin/file_android.cc b/runtime/bin/file_android.cc
index afe0966..74aa81f 100644
--- a/runtime/bin/file_android.cc
+++ b/runtime/bin/file_android.cc
@@ -17,8 +17,8 @@
 #include <unistd.h>        // NOLINT
 
 #include "bin/builtin.h"
+#include "bin/fdutils.h"
 #include "bin/log.h"
-
 #include "platform/signal_blocker.h"
 #include "platform/utils.h"
 
@@ -227,7 +227,8 @@
 bool File::Exists(const char* name) {
   struct stat st;
   if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
-    return S_ISREG(st.st_mode);
+    // Everything but a directory and a link is a file to Dart.
+    return !S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode);
   } else {
     return false;
   }
@@ -239,7 +240,22 @@
   if (fd < 0) {
     return false;
   }
-  return (close(fd) == 0);
+  // File.create returns a File, so we shouldn't be giving the illusion that the
+  // call has created a file or that a file already exists if there is already
+  // an entity at the same path that is a directory or a link.
+  bool is_file = true;
+  struct stat st;
+  if (NO_RETRY_EXPECTED(fstat(fd, &st)) == 0) {
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      is_file = false;
+    } else if (S_ISLNK(st.st_mode)) {
+      errno = ENOENT;
+      is_file = false;
+    }
+  }
+  FDUtils::SaveErrorAndClose(fd);
+  return is_file;
 }
 
 
@@ -249,114 +265,136 @@
 }
 
 
-bool File::Delete(const char* name) {
-  File::Type type = File::GetType(name, true);
-  if (type == kIsFile) {
-    return NO_RETRY_EXPECTED(unlink(name)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
+File::Type File::GetType(const char* pathname, bool follow_links) {
+  struct stat entry_info;
+  int stat_success;
+  if (follow_links) {
+    stat_success = NO_RETRY_EXPECTED(stat(pathname, &entry_info));
   } else {
-    errno = ENOENT;
+    stat_success = NO_RETRY_EXPECTED(lstat(pathname, &entry_info));
+  }
+  if (stat_success == -1) {
+    return File::kDoesNotExist;
+  }
+  if (S_ISDIR(entry_info.st_mode)) {
+    return File::kIsDirectory;
+  }
+  if (S_ISREG(entry_info.st_mode)) {
+    return File::kIsFile;
+  }
+  if (S_ISLNK(entry_info.st_mode)) {
+    return File::kIsLink;
+  }
+  return File::kDoesNotExist;
+}
+
+
+static bool CheckTypeAndSetErrno(const char* name,
+                                 File::Type expected,
+                                 bool follow_links) {
+  File::Type actual = File::GetType(name, follow_links);
+  if (actual == expected) {
+    return true;
+  }
+  switch (actual) {
+    case File::kIsDirectory:
+      errno = EISDIR;
+      break;
+    case File::kDoesNotExist:
+      errno = ENOENT;
+      break;
+    default:
+      errno = EINVAL;
+      break;
   }
   return false;
 }
 
 
+bool File::Delete(const char* name) {
+  return CheckTypeAndSetErrno(name, kIsFile, true) &&
+         (NO_RETRY_EXPECTED(unlink(name)) == 0);
+}
+
+
 bool File::DeleteLink(const char* name) {
-  File::Type type = File::GetType(name, false);
-  if (type == kIsLink) {
-    return NO_RETRY_EXPECTED(unlink(name)) == 0;
-  }
-  errno = EINVAL;
-  return false;
+  return CheckTypeAndSetErrno(name, kIsLink, false) &&
+         (NO_RETRY_EXPECTED(unlink(name)) == 0);
 }
 
 
 bool File::Rename(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, true);
-  if (type == kIsFile) {
-    return NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = ENOENT;
-  }
-  return false;
+  return CheckTypeAndSetErrno(old_path, kIsFile, true) &&
+         (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
 }
 
 
 bool File::RenameLink(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, false);
-  if (type == kIsLink) {
-    return NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = EINVAL;
-  }
-  return false;
+  return CheckTypeAndSetErrno(old_path, kIsLink, false) &&
+         (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
 }
 
 
 bool File::Copy(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, true);
-  if (type == kIsFile) {
-    struct stat st;
-    if (NO_RETRY_EXPECTED(stat(old_path, &st)) != 0) {
-      return false;
-    }
-    int old_fd = TEMP_FAILURE_RETRY(open(old_path, O_RDONLY | O_CLOEXEC));
-    if (old_fd < 0) {
-      return false;
-    }
-    int new_fd = TEMP_FAILURE_RETRY(
-        open(new_path, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, st.st_mode));
-    if (new_fd < 0) {
-      VOID_TEMP_FAILURE_RETRY(close(old_fd));
-      return false;
-    }
-    off_t offset = 0;
-    int result = 1;
-    while (result > 0) {
-      // Loop to ensure we copy everything, and not only up to 2GB.
-      result = NO_RETRY_EXPECTED(sendfile(new_fd, old_fd, &offset, kMaxUint32));
-    }
-    // From sendfile man pages:
-    //   Applications may wish to fall back to read(2)/write(2) in the case
-    //   where sendfile() fails with EINVAL or ENOSYS.
-    if ((result < 0) && ((errno == EINVAL) || (errno == ENOSYS))) {
-      const intptr_t kBufferSize = 8 * KB;
-      uint8_t buffer[kBufferSize];
-      while ((result = TEMP_FAILURE_RETRY(read(old_fd, buffer, kBufferSize))) >
-             0) {
-        int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result));
-        if (wrote != result) {
-          result = -1;
-          break;
-        }
+  if (!CheckTypeAndSetErrno(old_path, kIsFile, true)) {
+    return false;
+  }
+  struct stat st;
+  if (NO_RETRY_EXPECTED(stat(old_path, &st)) != 0) {
+    return false;
+  }
+  int old_fd = TEMP_FAILURE_RETRY(open(old_path, O_RDONLY | O_CLOEXEC));
+  if (old_fd < 0) {
+    return false;
+  }
+  int new_fd = TEMP_FAILURE_RETRY(
+      open(new_path, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, st.st_mode));
+  if (new_fd < 0) {
+    VOID_TEMP_FAILURE_RETRY(close(old_fd));
+    return false;
+  }
+  off_t offset = 0;
+  int result = 1;
+  while (result > 0) {
+    // Loop to ensure we copy everything, and not only up to 2GB.
+    result = NO_RETRY_EXPECTED(sendfile(new_fd, old_fd, &offset, kMaxUint32));
+  }
+  // From sendfile man pages:
+  //   Applications may wish to fall back to read(2)/write(2) in the case
+  //   where sendfile() fails with EINVAL or ENOSYS.
+  if ((result < 0) && ((errno == EINVAL) || (errno == ENOSYS))) {
+    const intptr_t kBufferSize = 8 * KB;
+    uint8_t buffer[kBufferSize];
+    while ((result = TEMP_FAILURE_RETRY(read(old_fd, buffer, kBufferSize))) >
+           0) {
+      int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result));
+      if (wrote != result) {
+        result = -1;
+        break;
       }
     }
-    int e = errno;
-    VOID_TEMP_FAILURE_RETRY(close(old_fd));
-    VOID_TEMP_FAILURE_RETRY(close(new_fd));
-    if (result < 0) {
-      VOID_NO_RETRY_EXPECTED(unlink(new_path));
-      errno = e;
-      return false;
-    }
-    return true;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = ENOENT;
   }
-  return false;
+  int e = errno;
+  VOID_TEMP_FAILURE_RETRY(close(old_fd));
+  VOID_TEMP_FAILURE_RETRY(close(new_fd));
+  if (result < 0) {
+    VOID_NO_RETRY_EXPECTED(unlink(new_path));
+    errno = e;
+    return false;
+  }
+  return true;
 }
 
 
 int64_t File::LengthFromPath(const char* name) {
   struct stat st;
   if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
+    // Signal an error if it's a directory.
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      return -1;
+    }
+    // Otherwise assume the caller knows what it's doing.
     return st.st_size;
   }
   return -1;
@@ -389,6 +427,12 @@
 time_t File::LastModified(const char* name) {
   struct stat st;
   if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
+    // Signal an error if it's a directory.
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      return -1;
+    }
+    // Otherwise assume the caller knows what it's doing.
     return st.st_mtime;
   }
   return -1;
@@ -472,30 +516,6 @@
 }
 
 
-File::Type File::GetType(const char* pathname, bool follow_links) {
-  struct stat entry_info;
-  int stat_success;
-  if (follow_links) {
-    stat_success = NO_RETRY_EXPECTED(stat(pathname, &entry_info));
-  } else {
-    stat_success = NO_RETRY_EXPECTED(lstat(pathname, &entry_info));
-  }
-  if (stat_success == -1) {
-    return File::kDoesNotExist;
-  }
-  if (S_ISDIR(entry_info.st_mode)) {
-    return File::kIsDirectory;
-  }
-  if (S_ISREG(entry_info.st_mode)) {
-    return File::kIsFile;
-  }
-  if (S_ISLNK(entry_info.st_mode)) {
-    return File::kIsLink;
-  }
-  return File::kDoesNotExist;
-}
-
-
 File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
   struct stat file_1_info;
   struct stat file_2_info;
diff --git a/runtime/bin/file_fuchsia.cc b/runtime/bin/file_fuchsia.cc
index bda6113..7175d55 100644
--- a/runtime/bin/file_fuchsia.cc
+++ b/runtime/bin/file_fuchsia.cc
@@ -16,6 +16,7 @@
 #include <unistd.h>     // NOLINT
 
 #include "bin/builtin.h"
+#include "bin/fdutils.h"
 #include "bin/log.h"
 #include "platform/signal_blocker.h"
 #include "platform/utils.h"
@@ -207,9 +208,10 @@
 
 
 bool File::Exists(const char* name) {
-  struct stat st;
-  if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
-    return S_ISREG(st.st_mode);
+  struct stat64 st;
+  if (NO_RETRY_EXPECTED(stat64(name, &st)) == 0) {
+    // Everything but a directory and a link is a file to Dart.
+    return !S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode);
   } else {
     return false;
   }
@@ -217,11 +219,27 @@
 
 
 bool File::Create(const char* name) {
-  int fd = NO_RETRY_EXPECTED(open(name, O_RDONLY | O_CREAT | O_CLOEXEC, 0666));
+  int fd =
+      NO_RETRY_EXPECTED(open64(name, O_RDONLY | O_CREAT | O_CLOEXEC, 0666));
   if (fd < 0) {
     return false;
   }
-  return (close(fd) == 0);
+  // File.create returns a File, so we shouldn't be giving the illusion that the
+  // call has created a file or that a file already exists if there is already
+  // an entity at the same path that is a directory or a link.
+  bool is_file = true;
+  struct stat64 st;
+  if (NO_RETRY_EXPECTED(fstat64(fd, &st)) == 0) {
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      is_file = false;
+    } else if (S_ISLNK(st.st_mode)) {
+      errno = ENOENT;
+      is_file = false;
+    }
+  }
+  FDUtils::SaveErrorAndClose(fd);
+  return is_file;
 }
 
 
@@ -230,64 +248,126 @@
 }
 
 
-bool File::Delete(const char* name) {
-  File::Type type = File::GetType(name, true);
-  if (type == kIsFile) {
-    return NO_RETRY_EXPECTED(unlink(name)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
+File::Type File::GetType(const char* pathname, bool follow_links) {
+  struct stat entry_info;
+  int stat_success;
+  if (follow_links) {
+    stat_success = NO_RETRY_EXPECTED(stat(pathname, &entry_info));
   } else {
-    errno = ENOENT;
+    stat_success = NO_RETRY_EXPECTED(lstat(pathname, &entry_info));
+  }
+  if (stat_success == -1) {
+    return File::kDoesNotExist;
+  }
+  if (S_ISDIR(entry_info.st_mode)) {
+    return File::kIsDirectory;
+  }
+  if (S_ISREG(entry_info.st_mode)) {
+    return File::kIsFile;
+  }
+  if (S_ISLNK(entry_info.st_mode)) {
+    return File::kIsLink;
+  }
+  return File::kDoesNotExist;
+}
+
+
+static bool CheckTypeAndSetErrno(const char* name,
+                                 File::Type expected,
+                                 bool follow_links) {
+  File::Type actual = File::GetType(name, follow_links);
+  if (actual == expected) {
+    return true;
+  }
+  switch (actual) {
+    case File::kIsDirectory:
+      errno = EISDIR;
+      break;
+    case File::kDoesNotExist:
+      errno = ENOENT;
+      break;
+    default:
+      errno = EINVAL;
+      break;
   }
   return false;
 }
 
 
+bool File::Delete(const char* name) {
+  return CheckTypeAndSetErrno(name, kIsFile, true) &&
+         (NO_RETRY_EXPECTED(unlink(name)) == 0);
+}
+
+
 bool File::DeleteLink(const char* name) {
-  File::Type type = File::GetType(name, false);
-  if (type == kIsLink) {
-    return NO_RETRY_EXPECTED(unlink(name)) == 0;
-  }
-  errno = EINVAL;
-  return false;
+  return CheckTypeAndSetErrno(name, kIsLink, false) &&
+         (NO_RETRY_EXPECTED(unlink(name)) == 0);
 }
 
 
 bool File::Rename(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, true);
-  if (type == kIsFile) {
-    return NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = ENOENT;
-  }
-  return false;
+  return CheckTypeAndSetErrno(old_path, kIsFile, true) &&
+         (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
 }
 
 
 bool File::RenameLink(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, false);
-  if (type == kIsLink) {
-    return NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = EINVAL;
-  }
-  return false;
+  return CheckTypeAndSetErrno(old_path, kIsLink, false) &&
+         (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
 }
 
 
 bool File::Copy(const char* old_path, const char* new_path) {
-  UNIMPLEMENTED();
-  return false;
+  if (!CheckTypeAndSetErrno(old_path, kIsFile, true)) {
+    return false;
+  }
+  struct stat64 st;
+  if (NO_RETRY_EXPECTED(stat64(old_path, &st)) != 0) {
+    return false;
+  }
+  int old_fd = NO_RETRY_EXPECTED(open64(old_path, O_RDONLY | O_CLOEXEC));
+  if (old_fd < 0) {
+    return false;
+  }
+  int new_fd = NO_RETRY_EXPECTED(
+      open64(new_path, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, st.st_mode));
+  if (new_fd < 0) {
+    VOID_TEMP_FAILURE_RETRY(close(old_fd));
+    return false;
+  }
+  // TODO(MG-429): Use sendfile/copyfile or equivalent when there is one.
+  intptr_t result;
+  const intptr_t kBufferSize = 8 * KB;
+  uint8_t buffer[kBufferSize];
+  while ((result = NO_RETRY_EXPECTED(read(old_fd, buffer, kBufferSize))) > 0) {
+    int wrote = NO_RETRY_EXPECTED(write(new_fd, buffer, result));
+    if (wrote != result) {
+      result = -1;
+      break;
+    }
+  }
+  FDUtils::SaveErrorAndClose(old_fd);
+  FDUtils::SaveErrorAndClose(new_fd);
+  if (result < 0) {
+    int e = errno;
+    VOID_NO_RETRY_EXPECTED(unlink(new_path));
+    errno = e;
+    return false;
+  }
+  return true;
 }
 
 
 int64_t File::LengthFromPath(const char* name) {
   struct stat st;
   if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
+    // Signal an error if it's a directory.
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      return -1;
+    }
+    // Otherwise assume the caller knows what it's doing.
     return st.st_size;
   }
   return -1;
@@ -320,6 +400,12 @@
 time_t File::LastModified(const char* name) {
   struct stat st;
   if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
+    // Signal an error if it's a directory.
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      return -1;
+    }
+    // Otherwise assume the caller knows what it's doing.
     return st.st_mtime;
   }
   return -1;
@@ -353,6 +439,8 @@
 
 
 const char* File::GetCanonicalPath(const char* pathname) {
+  // TODO(MG-425): realpath() is not implemented.
+#if 0
   char* abs_path = NULL;
   if (pathname != NULL) {
     char* resolved_path = DartUtils::ScopedCString(PATH_MAX + 1);
@@ -364,6 +452,9 @@
     ASSERT((abs_path == NULL) || (abs_path == resolved_path));
   }
   return abs_path;
+#else
+  return pathname;
+#endif
 }
 
 
@@ -403,30 +494,6 @@
 }
 
 
-File::Type File::GetType(const char* pathname, bool follow_links) {
-  struct stat entry_info;
-  int stat_success;
-  if (follow_links) {
-    stat_success = NO_RETRY_EXPECTED(stat(pathname, &entry_info));
-  } else {
-    stat_success = NO_RETRY_EXPECTED(lstat(pathname, &entry_info));
-  }
-  if (stat_success == -1) {
-    return File::kDoesNotExist;
-  }
-  if (S_ISDIR(entry_info.st_mode)) {
-    return File::kIsDirectory;
-  }
-  if (S_ISREG(entry_info.st_mode)) {
-    return File::kIsFile;
-  }
-  if (S_ISLNK(entry_info.st_mode)) {
-    return File::kIsLink;
-  }
-  return File::kDoesNotExist;
-}
-
-
 File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
   struct stat file_1_info;
   struct stat file_2_info;
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index 9a6dc41..fd2a3c2 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -17,6 +17,7 @@
 #include <unistd.h>        // NOLINT
 
 #include "bin/builtin.h"
+#include "bin/fdutils.h"
 #include "bin/log.h"
 #include "platform/signal_blocker.h"
 #include "platform/utils.h"
@@ -227,7 +228,8 @@
 bool File::Exists(const char* name) {
   struct stat64 st;
   if (TEMP_FAILURE_RETRY(stat64(name, &st)) == 0) {
-    return S_ISREG(st.st_mode);
+    // Everything but a directory and a link is a file to Dart.
+    return !S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode);
   } else {
     return false;
   }
@@ -240,7 +242,22 @@
   if (fd < 0) {
     return false;
   }
-  return (TEMP_FAILURE_RETRY(close(fd)) == 0);
+  // File.create returns a File, so we shouldn't be giving the illusion that the
+  // call has created a file or that a file already exists if there is already
+  // an entity at the same path that is a directory or a link.
+  bool is_file = true;
+  struct stat64 st;
+  if (TEMP_FAILURE_RETRY(fstat64(fd, &st)) == 0) {
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      is_file = false;
+    } else if (S_ISLNK(st.st_mode)) {
+      errno = ENOENT;
+      is_file = false;
+    }
+  }
+  FDUtils::SaveErrorAndClose(fd);
+  return is_file;
 }
 
 
@@ -249,115 +266,136 @@
 }
 
 
-bool File::Delete(const char* name) {
-  File::Type type = File::GetType(name, true);
-  if (type == kIsFile) {
-    return NO_RETRY_EXPECTED(unlink(name)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
+File::Type File::GetType(const char* pathname, bool follow_links) {
+  struct stat64 entry_info;
+  int stat_success;
+  if (follow_links) {
+    stat_success = TEMP_FAILURE_RETRY(stat64(pathname, &entry_info));
   } else {
-    errno = ENOENT;
+    stat_success = TEMP_FAILURE_RETRY(lstat64(pathname, &entry_info));
+  }
+  if (stat_success == -1) {
+    return File::kDoesNotExist;
+  }
+  if (S_ISDIR(entry_info.st_mode)) {
+    return File::kIsDirectory;
+  }
+  if (S_ISREG(entry_info.st_mode)) {
+    return File::kIsFile;
+  }
+  if (S_ISLNK(entry_info.st_mode)) {
+    return File::kIsLink;
+  }
+  return File::kDoesNotExist;
+}
+
+
+static bool CheckTypeAndSetErrno(const char* name,
+                                 File::Type expected,
+                                 bool follow_links) {
+  File::Type actual = File::GetType(name, follow_links);
+  if (actual == expected) {
+    return true;
+  }
+  switch (actual) {
+    case File::kIsDirectory:
+      errno = EISDIR;
+      break;
+    case File::kDoesNotExist:
+      errno = ENOENT;
+      break;
+    default:
+      errno = EINVAL;
+      break;
   }
   return false;
 }
 
 
+bool File::Delete(const char* name) {
+  return CheckTypeAndSetErrno(name, kIsFile, true) &&
+         (NO_RETRY_EXPECTED(unlink(name)) == 0);
+}
+
+
 bool File::DeleteLink(const char* name) {
-  File::Type type = File::GetType(name, false);
-  if (type == kIsLink) {
-    return NO_RETRY_EXPECTED(unlink(name)) == 0;
-  }
-  errno = EINVAL;
-  return false;
+  return CheckTypeAndSetErrno(name, kIsLink, false) &&
+         (NO_RETRY_EXPECTED(unlink(name)) == 0);
 }
 
 
 bool File::Rename(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, true);
-  if (type == kIsFile) {
-    return NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = ENOENT;
-  }
-  return false;
+  return CheckTypeAndSetErrno(old_path, kIsFile, true) &&
+         (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
 }
 
 
 bool File::RenameLink(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, false);
-  if (type == kIsLink) {
-    return NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = EINVAL;
-  }
-  return false;
+  return CheckTypeAndSetErrno(old_path, kIsLink, false) &&
+         (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
 }
 
 
 bool File::Copy(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, true);
-  if (type == kIsFile) {
-    struct stat64 st;
-    if (TEMP_FAILURE_RETRY(stat64(old_path, &st)) != 0) {
-      return false;
-    }
-    int old_fd = TEMP_FAILURE_RETRY(open64(old_path, O_RDONLY | O_CLOEXEC));
-    if (old_fd < 0) {
-      return false;
-    }
-    int new_fd = TEMP_FAILURE_RETRY(
-        open64(new_path, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, st.st_mode));
-    if (new_fd < 0) {
-      VOID_TEMP_FAILURE_RETRY(close(old_fd));
-      return false;
-    }
-    int64_t offset = 0;
-    intptr_t result = 1;
-    while (result > 0) {
-      // Loop to ensure we copy everything, and not only up to 2GB.
-      result =
-          NO_RETRY_EXPECTED(sendfile64(new_fd, old_fd, &offset, kMaxUint32));
-    }
-    // From sendfile man pages:
-    //   Applications may wish to fall back to read(2)/write(2) in the case
-    //   where sendfile() fails with EINVAL or ENOSYS.
-    if ((result < 0) && ((errno == EINVAL) || (errno == ENOSYS))) {
-      const intptr_t kBufferSize = 8 * KB;
-      uint8_t buffer[kBufferSize];
-      while ((result = TEMP_FAILURE_RETRY(read(old_fd, buffer, kBufferSize))) >
-             0) {
-        int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result));
-        if (wrote != result) {
-          result = -1;
-          break;
-        }
+  if (!CheckTypeAndSetErrno(old_path, kIsFile, true)) {
+    return false;
+  }
+  struct stat64 st;
+  if (TEMP_FAILURE_RETRY(stat64(old_path, &st)) != 0) {
+    return false;
+  }
+  int old_fd = TEMP_FAILURE_RETRY(open64(old_path, O_RDONLY | O_CLOEXEC));
+  if (old_fd < 0) {
+    return false;
+  }
+  int new_fd = TEMP_FAILURE_RETRY(
+      open64(new_path, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, st.st_mode));
+  if (new_fd < 0) {
+    VOID_TEMP_FAILURE_RETRY(close(old_fd));
+    return false;
+  }
+  int64_t offset = 0;
+  intptr_t result = 1;
+  while (result > 0) {
+    // Loop to ensure we copy everything, and not only up to 2GB.
+    result = NO_RETRY_EXPECTED(sendfile64(new_fd, old_fd, &offset, kMaxUint32));
+  }
+  // From sendfile man pages:
+  //   Applications may wish to fall back to read(2)/write(2) in the case
+  //   where sendfile() fails with EINVAL or ENOSYS.
+  if ((result < 0) && ((errno == EINVAL) || (errno == ENOSYS))) {
+    const intptr_t kBufferSize = 8 * KB;
+    uint8_t buffer[kBufferSize];
+    while ((result = TEMP_FAILURE_RETRY(read(old_fd, buffer, kBufferSize))) >
+           0) {
+      int wrote = TEMP_FAILURE_RETRY(write(new_fd, buffer, result));
+      if (wrote != result) {
+        result = -1;
+        break;
       }
     }
-    int e = errno;
-    VOID_TEMP_FAILURE_RETRY(close(old_fd));
-    VOID_TEMP_FAILURE_RETRY(close(new_fd));
-    if (result < 0) {
-      VOID_NO_RETRY_EXPECTED(unlink(new_path));
-      errno = e;
-      return false;
-    }
-    return true;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = ENOENT;
   }
-  return false;
+  int e = errno;
+  VOID_TEMP_FAILURE_RETRY(close(old_fd));
+  VOID_TEMP_FAILURE_RETRY(close(new_fd));
+  if (result < 0) {
+    VOID_NO_RETRY_EXPECTED(unlink(new_path));
+    errno = e;
+    return false;
+  }
+  return true;
 }
 
 
 int64_t File::LengthFromPath(const char* name) {
   struct stat64 st;
   if (TEMP_FAILURE_RETRY(stat64(name, &st)) == 0) {
+    // Signal an error if it's a directory.
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      return -1;
+    }
+    // Otherwise assume the caller knows what it's doing.
     return st.st_size;
   }
   return -1;
@@ -396,6 +434,12 @@
 time_t File::LastModified(const char* name) {
   struct stat64 st;
   if (TEMP_FAILURE_RETRY(stat64(name, &st)) == 0) {
+    // Signal an error if it's a directory.
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      return -1;
+    }
+    // Otherwise assume the caller knows what it's doing.
     return st.st_mtime;
   }
   return -1;
@@ -485,30 +529,6 @@
 }
 
 
-File::Type File::GetType(const char* pathname, bool follow_links) {
-  struct stat64 entry_info;
-  int stat_success;
-  if (follow_links) {
-    stat_success = TEMP_FAILURE_RETRY(stat64(pathname, &entry_info));
-  } else {
-    stat_success = TEMP_FAILURE_RETRY(lstat64(pathname, &entry_info));
-  }
-  if (stat_success == -1) {
-    return File::kDoesNotExist;
-  }
-  if (S_ISDIR(entry_info.st_mode)) {
-    return File::kIsDirectory;
-  }
-  if (S_ISREG(entry_info.st_mode)) {
-    return File::kIsFile;
-  }
-  if (S_ISLNK(entry_info.st_mode)) {
-    return File::kIsLink;
-  }
-  return File::kDoesNotExist;
-}
-
-
 File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
   struct stat64 file_1_info;
   struct stat64 file_2_info;
diff --git a/runtime/bin/file_macos.cc b/runtime/bin/file_macos.cc
index 2b32bc1..767908e 100644
--- a/runtime/bin/file_macos.cc
+++ b/runtime/bin/file_macos.cc
@@ -230,7 +230,8 @@
 bool File::Exists(const char* name) {
   struct stat st;
   if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
-    return S_ISREG(st.st_mode);
+    // Everything but a directory and a link is a file to Dart.
+    return !S_ISDIR(st.st_mode) && !S_ISLNK(st.st_mode);
   } else {
     return false;
   }
@@ -242,7 +243,22 @@
   if (fd < 0) {
     return false;
   }
-  return (close(fd) == 0);
+  // File.create returns a File, so we shouldn't be giving the illusion that the
+  // call has created a file or that a file already exists if there is already
+  // an entity at the same path that is a directory or a link.
+  bool is_file = true;
+  struct stat st;
+  if (NO_RETRY_EXPECTED(fstat(fd, &st)) == 0) {
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      is_file = false;
+    } else if (S_ISLNK(st.st_mode)) {
+      errno = ENOENT;
+      is_file = false;
+    }
+  }
+  FDUtils::SaveErrorAndClose(fd);
+  return is_file;
 }
 
 
@@ -252,71 +268,91 @@
 }
 
 
-bool File::Delete(const char* name) {
-  File::Type type = File::GetType(name, true);
-  if (type == kIsFile) {
-    return NO_RETRY_EXPECTED(unlink(name)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
+File::Type File::GetType(const char* pathname, bool follow_links) {
+  struct stat entry_info;
+  int stat_success;
+  if (follow_links) {
+    stat_success = NO_RETRY_EXPECTED(stat(pathname, &entry_info));
   } else {
-    errno = ENOENT;
+    stat_success = NO_RETRY_EXPECTED(lstat(pathname, &entry_info));
+  }
+  if (stat_success == -1) {
+    return File::kDoesNotExist;
+  }
+  if (S_ISDIR(entry_info.st_mode)) {
+    return File::kIsDirectory;
+  }
+  if (S_ISREG(entry_info.st_mode)) {
+    return File::kIsFile;
+  }
+  if (S_ISLNK(entry_info.st_mode)) {
+    return File::kIsLink;
+  }
+  return File::kDoesNotExist;
+}
+
+
+static bool CheckTypeAndSetErrno(const char* name,
+                                 File::Type expected,
+                                 bool follow_links) {
+  File::Type actual = File::GetType(name, follow_links);
+  if (actual == expected) {
+    return true;
+  }
+  switch (actual) {
+    case File::kIsDirectory:
+      errno = EISDIR;
+      break;
+    case File::kDoesNotExist:
+      errno = ENOENT;
+      break;
+    default:
+      errno = EINVAL;
+      break;
   }
   return false;
 }
 
 
+bool File::Delete(const char* name) {
+  return CheckTypeAndSetErrno(name, kIsFile, true) &&
+         (NO_RETRY_EXPECTED(unlink(name)) == 0);
+}
+
+
 bool File::DeleteLink(const char* name) {
-  File::Type type = File::GetType(name, false);
-  if (type == kIsLink) {
-    return NO_RETRY_EXPECTED(unlink(name)) == 0;
-  }
-  errno = EINVAL;
-  return false;
+  return CheckTypeAndSetErrno(name, kIsLink, false) &&
+         (NO_RETRY_EXPECTED(unlink(name)) == 0);
 }
 
 
 bool File::Rename(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, true);
-  if (type == kIsFile) {
-    return NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = ENOENT;
-  }
-  return false;
+  return CheckTypeAndSetErrno(old_path, kIsFile, true) &&
+         (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
 }
 
 
 bool File::RenameLink(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, false);
-  if (type == kIsLink) {
-    return NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = EINVAL;
-  }
-  return false;
+  return CheckTypeAndSetErrno(old_path, kIsLink, false) &&
+         (NO_RETRY_EXPECTED(rename(old_path, new_path)) == 0);
 }
 
 
 bool File::Copy(const char* old_path, const char* new_path) {
-  File::Type type = File::GetType(old_path, true);
-  if (type == kIsFile) {
-    return copyfile(old_path, new_path, NULL, COPYFILE_ALL) == 0;
-  } else if (type == kIsDirectory) {
-    errno = EISDIR;
-  } else {
-    errno = ENOENT;
-  }
-  return false;
+  return CheckTypeAndSetErrno(old_path, kIsFile, true) &&
+         (copyfile(old_path, new_path, NULL, COPYFILE_ALL) == 0);
 }
 
 
 int64_t File::LengthFromPath(const char* name) {
   struct stat st;
   if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
+    // Signal an error if it's a directory.
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      return -1;
+    }
+    // Otherwise assume the caller knows what it's doing.
     return st.st_size;
   }
   return -1;
@@ -358,6 +394,12 @@
 time_t File::LastModified(const char* name) {
   struct stat st;
   if (NO_RETRY_EXPECTED(stat(name, &st)) == 0) {
+    // Signal an error if it's a directory.
+    if (S_ISDIR(st.st_mode)) {
+      errno = EISDIR;
+      return -1;
+    }
+    // Otherwise assume the caller knows what it's doing.
     return st.st_mtime;
   }
   return -1;
@@ -449,30 +491,6 @@
 }
 
 
-File::Type File::GetType(const char* pathname, bool follow_links) {
-  struct stat entry_info;
-  int stat_success;
-  if (follow_links) {
-    stat_success = NO_RETRY_EXPECTED(stat(pathname, &entry_info));
-  } else {
-    stat_success = NO_RETRY_EXPECTED(lstat(pathname, &entry_info));
-  }
-  if (stat_success == -1) {
-    return File::kDoesNotExist;
-  }
-  if (S_ISDIR(entry_info.st_mode)) {
-    return File::kIsDirectory;
-  }
-  if (S_ISREG(entry_info.st_mode)) {
-    return File::kIsFile;
-  }
-  if (S_ISLNK(entry_info.st_mode)) {
-    return File::kIsLink;
-  }
-  return File::kDoesNotExist;
-}
-
-
 File::Identical File::AreIdentical(const char* file_1, const char* file_2) {
   struct stat file_1_info;
   struct stat file_2_info;
diff --git a/runtime/bin/file_patch.dart b/runtime/bin/file_patch.dart
index 2fe1414..5e4b16a 100644
--- a/runtime/bin/file_patch.dart
+++ b/runtime/bin/file_patch.dart
@@ -77,14 +77,14 @@
   @patch static Stream<FileSystemEvent> _watch(
       String path, int events, bool recursive) {
     if (Platform.isLinux) {
-      return new _InotifyFileSystemWatcher(path, events, recursive).stream;
+      return new _InotifyFileSystemWatcher(path, events, recursive)._stream;
     }
     if (Platform.isWindows) {
-      return new _Win32FileSystemWatcher(path, events, recursive).stream;
+      return new _Win32FileSystemWatcher(path, events, recursive)._stream;
     }
     if (Platform.isMacOS) {
       return new _FSEventStreamFileSystemWatcher(
-          path, events, recursive).stream;
+          path, events, recursive)._stream;
     }
     throw new FileSystemException(
         "File system watching is not supported on this platform");
@@ -100,7 +100,7 @@
                                                           onCancel: _cancel);
   }
 
-  Stream get stream => _broadcastController.stream;
+  Stream get _stream => _broadcastController.stream;
 
   void _listen() {
     if (_id == null) {
diff --git a/runtime/bin/file_win.cc b/runtime/bin/file_win.cc
index 79272d3..3cfdf69 100644
--- a/runtime/bin/file_win.cc
+++ b/runtime/bin/file_win.cc
@@ -444,7 +444,12 @@
   Utf8ToWideScope system_name(name);
   int stat_status = _wstat64(system_name.wide(), &st);
   if (stat_status == 0) {
-    return st.st_size;
+    if ((st.st_mode & S_IFMT) == S_IFREG) {
+      return st.st_size;
+    } else {
+      // ERROR_DIRECTORY_NOT_SUPPORTED is not always in the message table.
+      SetLastError(ERROR_NOT_SUPPORTED);
+    }
   }
   return -1;
 }
@@ -539,7 +544,12 @@
   Utf8ToWideScope system_name(name);
   int stat_status = _wstat64(system_name.wide(), &st);
   if (stat_status == 0) {
-    return st.st_mtime;
+    if ((st.st_mode & S_IFMT) == S_IFREG) {
+      return st.st_mtime;
+    } else {
+      // ERROR_DIRECTORY_NOT_SUPPORTED is not always in the message table.
+      SetLastError(ERROR_NOT_SUPPORTED);
+    }
   }
   return -1;
 }
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index e18f2f5..ef809ba 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -60,11 +60,11 @@
 
 // Global state that indicates whether a snapshot is to be created and
 // if so which file to write the snapshot into.
-static const char* vm_isolate_snapshot_filename = NULL;
-static const char* isolate_snapshot_filename = NULL;
+static const char* vm_snapshot_data_filename = NULL;
+static const char* vm_snapshot_instructions_filename = NULL;
+static const char* isolate_snapshot_data_filename = NULL;
+static const char* isolate_snapshot_instructions_filename = NULL;
 static const char* assembly_filename = NULL;
-static const char* instructions_blob_filename = NULL;
-static const char* rodata_blob_filename = NULL;
 
 
 // Value of the --package-root flag.
@@ -189,20 +189,40 @@
 }
 
 
-static bool ProcessVmIsolateSnapshotOption(const char* option) {
-  const char* name = ProcessOption(option, "--vm_isolate_snapshot=");
+static bool ProcessVmSnapshotDataOption(const char* option) {
+  const char* name = ProcessOption(option, "--vm_snapshot_data=");
   if (name != NULL) {
-    vm_isolate_snapshot_filename = name;
+    vm_snapshot_data_filename = name;
     return true;
   }
   return false;
 }
 
 
-static bool ProcessIsolateSnapshotOption(const char* option) {
-  const char* name = ProcessOption(option, "--isolate_snapshot=");
+static bool ProcessVmSnapshotInstructionsOption(const char* option) {
+  const char* name = ProcessOption(option, "--vm_snapshot_instructions=");
   if (name != NULL) {
-    isolate_snapshot_filename = name;
+    vm_snapshot_instructions_filename = name;
+    return true;
+  }
+  return false;
+}
+
+
+static bool ProcessIsolateSnapshotDataOption(const char* option) {
+  const char* name = ProcessOption(option, "--isolate_snapshot_data=");
+  if (name != NULL) {
+    isolate_snapshot_data_filename = name;
+    return true;
+  }
+  return false;
+}
+
+
+static bool ProcessIsolateSnapshotInstructionsOption(const char* option) {
+  const char* name = ProcessOption(option, "--isolate_snapshot_instructions=");
+  if (name != NULL) {
+    isolate_snapshot_instructions_filename = name;
     return true;
   }
   return false;
@@ -219,26 +239,6 @@
 }
 
 
-static bool ProcessInstructionsBlobOption(const char* option) {
-  const char* name = ProcessOption(option, "--instructions_blob=");
-  if (name != NULL) {
-    instructions_blob_filename = name;
-    return true;
-  }
-  return false;
-}
-
-
-static bool ProcessRodataBlobOption(const char* option) {
-  const char* name = ProcessOption(option, "--rodata_blob=");
-  if (name != NULL) {
-    rodata_blob_filename = name;
-    return true;
-  }
-  return false;
-}
-
-
 static bool ProcessEmbedderEntryPointsManifestOption(const char* option) {
   const char* name = ProcessOption(option, "--embedder_entry_points_manifest=");
   if (name != NULL) {
@@ -286,7 +286,8 @@
 
 
 static bool IsSnapshottingForPrecompilation() {
-  return (assembly_filename != NULL) || (instructions_blob_filename != NULL);
+  return (assembly_filename != NULL) ||
+         (vm_snapshot_instructions_filename != NULL);
 }
 
 
@@ -304,11 +305,11 @@
 
   // Parse out the vm options.
   while ((i < argc) && IsValidFlag(argv[i], kPrefix, kPrefixLen)) {
-    if (ProcessVmIsolateSnapshotOption(argv[i]) ||
-        ProcessIsolateSnapshotOption(argv[i]) ||
+    if (ProcessVmSnapshotDataOption(argv[i]) ||
+        ProcessVmSnapshotInstructionsOption(argv[i]) ||
+        ProcessIsolateSnapshotDataOption(argv[i]) ||
+        ProcessIsolateSnapshotInstructionsOption(argv[i]) ||
         ProcessAssemblyOption(argv[i]) ||
-        ProcessInstructionsBlobOption(argv[i]) ||
-        ProcessRodataBlobOption(argv[i]) ||
         ProcessEmbedderEntryPointsManifestOption(argv[i]) ||
         ProcessURLmappingOption(argv[i]) || ProcessPackageRootOption(argv[i]) ||
         ProcessPackagesOption(argv[i]) || ProcessEnvironmentOption(argv[i])) {
@@ -336,19 +337,19 @@
     return -1;
   }
 
-  if (vm_isolate_snapshot_filename == NULL) {
-    Log::PrintErr("No vm isolate snapshot output file specified.\n\n");
+  if (vm_snapshot_data_filename == NULL) {
+    Log::PrintErr("No vm snapshot output file specified.\n\n");
     return -1;
   }
 
-  if (isolate_snapshot_filename == NULL) {
+  if (isolate_snapshot_data_filename == NULL) {
     Log::PrintErr("No isolate snapshot output file specified.\n\n");
     return -1;
   }
 
   bool precompiled_as_assembly = assembly_filename != NULL;
-  bool precompiled_as_blobs =
-      (instructions_blob_filename != NULL) || (rodata_blob_filename != NULL);
+  bool precompiled_as_blobs = (vm_snapshot_instructions_filename != NULL) ||
+                              (isolate_snapshot_instructions_filename != NULL);
   if (precompiled_as_assembly && precompiled_as_blobs) {
     Log::PrintErr(
         "Cannot request a precompiled snapshot simultaneously as "
@@ -357,11 +358,12 @@
         "--rodata-blob=<output.file>)\n\n");
     return -1;
   }
-  if ((instructions_blob_filename != NULL) != (rodata_blob_filename != NULL)) {
+  if ((vm_snapshot_instructions_filename != NULL) !=
+      (isolate_snapshot_instructions_filename != NULL)) {
     Log::PrintErr(
         "Requesting a precompiled snapshot as blobs requires both "
-        "(--instructions-blob=<output.file> and "
-        "--rodata-blob=<output.file>)\n\n");
+        "(--vm_snapshot_instructions=<output.file> and "
+        "--isolate_snapshot_instructions=<output.file>)\n\n");
     return -1;
   }
   if (IsSnapshottingForPrecompilation() && (entry_points_files->count() == 0)) {
@@ -640,8 +642,8 @@
 "      dart:something,SomeClass,doSomething                                  \n"
 "                                                                            \n"
 "  Supported options:                                                        \n"
-"    --vm_isolate_snapshot=<file>      A full snapshot is a compact          \n"
-"    --isolate_snapshot=<file>         representation of the dart vm isolate \n"
+"    --vm_snapshot_data=<file>         A full snapshot is a compact          \n"
+"    --isolate_snapshot_data=<file>    representation of the dart vm isolate \n"
 "                                      heap and dart isolate heap states.    \n"
 "                                      Both these options are required       \n"
 "                                                                            \n"
@@ -658,9 +660,10 @@
 "                                      assembly that must be linked into     \n"
 "                                      the target binary                     \n"
 "                                                                            \n"
-"    --instructions_blob=<file>        (Precompilation only) Contains the    \n"
-"    --rodata_blob=<file>              instructions and read-only data that  \n"
-"                                      must be mapped into the target binary \n"
+"    --vm_snapshot_instructions=<file> (Precompilation only) Contains the    \n"
+"    --isolate_snapshot_instructions=<file> instructions and read-only data  \n"
+"                                      that must be mapped into the target   \n"
+"                                      binary                                \n"
 "                                                                            \n"
 "    --embedder_entry_points_manifest=<file> (Precompilation or app          \n"
 "                                      snapshots) Contains embedder's entry  \n"
@@ -1027,21 +1030,23 @@
 static void CreateAndWriteSnapshot() {
   ASSERT(!IsSnapshottingForPrecompilation());
   Dart_Handle result;
-  uint8_t* vm_isolate_buffer = NULL;
-  intptr_t vm_isolate_size = 0;
-  uint8_t* isolate_buffer = NULL;
-  intptr_t isolate_size = 0;
+  uint8_t* vm_snapshot_data_buffer = NULL;
+  intptr_t vm_snapshot_data_size = 0;
+  uint8_t* isolate_snapshot_data_buffer = NULL;
+  intptr_t isolate_snapshot_data_size = 0;
 
   // First create a snapshot.
-  result = Dart_CreateSnapshot(&vm_isolate_buffer, &vm_isolate_size,
-                               &isolate_buffer, &isolate_size);
+  result = Dart_CreateSnapshot(&vm_snapshot_data_buffer, &vm_snapshot_data_size,
+                               &isolate_snapshot_data_buffer,
+                               &isolate_snapshot_data_size);
   CHECK_RESULT(result);
 
   // Now write the vm isolate and isolate snapshots out to the
   // specified file and exit.
-  WriteSnapshotFile(vm_isolate_snapshot_filename, vm_isolate_buffer,
-                    vm_isolate_size);
-  WriteSnapshotFile(isolate_snapshot_filename, isolate_buffer, isolate_size);
+  WriteSnapshotFile(vm_snapshot_data_filename, vm_snapshot_data_buffer,
+                    vm_snapshot_data_size);
+  WriteSnapshotFile(isolate_snapshot_data_filename,
+                    isolate_snapshot_data_buffer, isolate_snapshot_data_size);
   Dart_ExitScope();
 
   // Shutdown the isolate.
@@ -1055,7 +1060,7 @@
   Dart_Handle result;
 
   // Precompile with specified embedder entry points
-  result = Dart_Precompile(standalone_entry_points, true);
+  result = Dart_Precompile(standalone_entry_points, NULL, 0);
   CHECK_RESULT(result);
 
   // Create a precompiled snapshot.
@@ -1063,31 +1068,36 @@
   if (as_assembly) {
     uint8_t* assembly_buffer = NULL;
     intptr_t assembly_size = 0;
-    result = Dart_CreatePrecompiledSnapshotAssembly(&assembly_buffer,
-                                                    &assembly_size);
+    result =
+        Dart_CreateAppAOTSnapshotAsAssembly(&assembly_buffer, &assembly_size);
     CHECK_RESULT(result);
     WriteSnapshotFile(assembly_filename, assembly_buffer, assembly_size);
   } else {
-    uint8_t* vm_isolate_buffer = NULL;
-    intptr_t vm_isolate_size = 0;
-    uint8_t* isolate_buffer = NULL;
-    intptr_t isolate_size = 0;
-    uint8_t* instructions_blob_buffer = NULL;
-    intptr_t instructions_blob_size = 0;
-    uint8_t* rodata_blob_buffer = NULL;
-    intptr_t rodata_blob_size = 0;
-    result = Dart_CreatePrecompiledSnapshotBlob(
-        &vm_isolate_buffer, &vm_isolate_size, &isolate_buffer, &isolate_size,
-        &instructions_blob_buffer, &instructions_blob_size, &rodata_blob_buffer,
-        &rodata_blob_size);
+    uint8_t* vm_snapshot_data_buffer = NULL;
+    intptr_t vm_snapshot_data_size = 0;
+    uint8_t* vm_snapshot_instructions_buffer = NULL;
+    intptr_t vm_snapshot_instructions_size = 0;
+    uint8_t* isolate_snapshot_data_buffer = NULL;
+    intptr_t isolate_snapshot_data_size = 0;
+    uint8_t* isolate_snapshot_instructions_buffer = NULL;
+    intptr_t isolate_snapshot_instructions_size = 0;
+    result = Dart_CreateAppAOTSnapshotAsBlobs(
+        &vm_snapshot_data_buffer, &vm_snapshot_data_size,
+        &vm_snapshot_instructions_buffer, &vm_snapshot_instructions_size,
+        &isolate_snapshot_data_buffer, &isolate_snapshot_data_size,
+        &isolate_snapshot_instructions_buffer,
+        &isolate_snapshot_instructions_size);
     CHECK_RESULT(result);
-    WriteSnapshotFile(vm_isolate_snapshot_filename, vm_isolate_buffer,
-                      vm_isolate_size);
-    WriteSnapshotFile(isolate_snapshot_filename, isolate_buffer, isolate_size);
-    WriteSnapshotFile(instructions_blob_filename, instructions_blob_buffer,
-                      instructions_blob_size);
-    WriteSnapshotFile(rodata_blob_filename, rodata_blob_buffer,
-                      rodata_blob_size);
+    WriteSnapshotFile(vm_snapshot_data_filename, vm_snapshot_data_buffer,
+                      vm_snapshot_data_size);
+    WriteSnapshotFile(vm_snapshot_instructions_filename,
+                      vm_snapshot_instructions_buffer,
+                      vm_snapshot_instructions_size);
+    WriteSnapshotFile(isolate_snapshot_data_filename,
+                      isolate_snapshot_data_buffer, isolate_snapshot_data_size);
+    WriteSnapshotFile(isolate_snapshot_instructions_filename,
+                      isolate_snapshot_instructions_buffer,
+                      isolate_snapshot_instructions_size);
   }
 
   Dart_ExitScope();
@@ -1139,8 +1149,8 @@
   IsolateData* isolate_data =
       new IsolateData(script_uri, package_root, package_config);
   Dart_Isolate isolate = NULL;
-  isolate =
-      Dart_CreateIsolate(script_uri, main, NULL, NULL, isolate_data, error);
+  isolate = Dart_CreateIsolate(script_uri, main, NULL, NULL, NULL, isolate_data,
+                               error);
 
   if (isolate == NULL) {
     Log::PrintErr("Error: Could not create service isolate");
@@ -1243,7 +1253,7 @@
   IsolateData* isolate_data = new IsolateData(NULL, commandline_package_root,
                                               commandline_packages_file);
   Dart_Isolate isolate =
-      Dart_CreateIsolate(NULL, NULL, NULL, NULL, isolate_data, &error);
+      Dart_CreateIsolate(NULL, NULL, NULL, NULL, NULL, isolate_data, &error);
   if (isolate == NULL) {
     Log::PrintErr("Error: %s", error);
     free(error);
@@ -1257,8 +1267,8 @@
   result = Dart_SetEnvironmentCallback(EnvironmentCallback);
   CHECK_RESULT(result);
 
-  ASSERT(vm_isolate_snapshot_filename != NULL);
-  ASSERT(isolate_snapshot_filename != NULL);
+  ASSERT(vm_snapshot_data_filename != NULL);
+  ASSERT(isolate_snapshot_data_filename != NULL);
   // Load up the script before a snapshot is created.
   if (app_script_name != NULL) {
     // This is the case of a custom embedder (e.g: dartium) trying to
@@ -1305,7 +1315,8 @@
         is_kernel_file
             ? Dart_CreateIsolateFromKernel(NULL, NULL, kernel_program, NULL,
                                            isolate_data, &error)
-            : Dart_CreateIsolate(NULL, NULL, NULL, NULL, isolate_data, &error);
+            : Dart_CreateIsolate(NULL, NULL, NULL, NULL, NULL, isolate_data,
+                                 &error);
     if (isolate == NULL) {
       Log::PrintErr("%s", error);
       free(error);
diff --git a/runtime/bin/hashmap_test.cc b/runtime/bin/hashmap_test.cc
index 47849e0..bad384b 100644
--- a/runtime/bin/hashmap_test.cc
+++ b/runtime/bin/hashmap_test.cc
@@ -171,7 +171,7 @@
 }
 
 
-UNIT_TEST_CASE(Set) {
+UNIT_TEST_CASE(HashMap_Basic) {
   TestSet(WordHash, 100);
   TestSet(Hash, 100);
   TestSet(CollisionHash1, 50);
diff --git a/runtime/bin/io_natives.cc b/runtime/bin/io_natives.cc
index 4662d82..d6d5c09 100644
--- a/runtime/bin/io_natives.cc
+++ b/runtime/bin/io_natives.cc
@@ -138,7 +138,7 @@
   V(Socket_LeaveMulticast, 4)                                                  \
   V(Socket_GetSocketId, 1)                                                     \
   V(Socket_SetSocketId, 2)                                                     \
-  V(Stdin_ReadByte, 1)                                                         \
+  V(Stdin_ReadByte, 0)                                                         \
   V(Stdin_GetEchoMode, 0)                                                      \
   V(Stdin_SetEchoMode, 1)                                                      \
   V(Stdin_GetLineMode, 0)                                                      \
diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc
index d0a95e2..70ee444 100644
--- a/runtime/bin/loader.cc
+++ b/runtime/bin/loader.cc
@@ -206,6 +206,24 @@
 }
 
 
+// Forward a request from the tag handler to the kernel isolate.
+// [ tag, send port, url ]
+void Loader::SendKernelRequest(Dart_LibraryTag tag, Dart_Handle url) {
+  // This port delivers loading messages to the Kernel isolate.
+  Dart_Port kernel_port = Dart_KernelPort();
+  ASSERT(kernel_port != ILLEGAL_PORT);
+
+  Dart_Handle request = Dart_NewList(3);
+  Dart_ListSetAt(request, 0, Dart_NewInteger(tag));
+  Dart_ListSetAt(request, 1, Dart_NewSendPort(port_));
+  Dart_ListSetAt(request, 2, url);
+  if (Dart_Post(kernel_port, request)) {
+    MonitorLocker ml(monitor_);
+    pending_operations_++;
+  }
+}
+
+
 void Loader::QueueMessage(Dart_CObject* message) {
   MonitorLocker ml(monitor_);
   if (results_length_ == results_capacity_) {
@@ -625,12 +643,15 @@
   if (DartUtils::IsDartExtensionSchemeURL(url_string)) {
     loader->SendImportExtensionRequest(url, Dart_LibraryUrl(library));
   } else {
-    loader->SendRequest(tag, url, (library != Dart_Null())
-                                      ? Dart_LibraryUrl(library)
-                                      : Dart_Null());
+    if (Dart_KernelIsolateIsRunning()) {
+      loader->SendKernelRequest(tag, url);
+    } else {
+      loader->SendRequest(tag, url, (library != Dart_Null())
+                                        ? Dart_LibraryUrl(library)
+                                        : Dart_Null());
+    }
   }
 
-
   if (blocking_call) {
     // The outer invocation of the tag handler will block here until all nested
     // invocations complete.
diff --git a/runtime/bin/loader.h b/runtime/bin/loader.h
index 2076be8..cc4912d 100644
--- a/runtime/bin/loader.h
+++ b/runtime/bin/loader.h
@@ -93,6 +93,9 @@
                    Dart_Handle url,
                    Dart_Handle library_url);
 
+  // Send a request from the tag handler to the kernel isolate.
+  void SendKernelRequest(Dart_LibraryTag tag, Dart_Handle url);
+
   /// Queue |message| and notify the loader that a message is available.
   void QueueMessage(Dart_CObject* message);
 
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 0adf4ac..b5f958d 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -34,13 +34,11 @@
 namespace dart {
 namespace bin {
 
-// vm_isolate_snapshot_buffer points to a snapshot for the vm isolate if we
-// link in a snapshot otherwise it is initialized to NULL.
-extern const uint8_t* vm_isolate_snapshot_buffer;
-
-// isolate_snapshot_buffer points to a snapshot for an isolate if we link in a
-// snapshot otherwise it is initialized to NULL.
-extern const uint8_t* isolate_snapshot_buffer;
+// Snapshot pieces if we link in a snapshot, otherwise initialized to NULL.
+extern const uint8_t* vm_snapshot_data;
+extern const uint8_t* vm_snapshot_instructions;
+extern const uint8_t* core_isolate_snapshot_data;
+extern const uint8_t* core_isolate_snapshot_instructions;
 
 /**
  * Global state used to control and store generation of application snapshots
@@ -51,7 +49,7 @@
  * To Run the application snapshot generated above, use :
  *   dart <app_snapshot_filename> [<script_options>]
  */
-static bool run_app_snapshot = false;
+static bool vm_run_app_snapshot = false;
 static const char* snapshot_filename = NULL;
 enum SnapshotKind {
   kNone,
@@ -61,6 +59,20 @@
 };
 static SnapshotKind gen_snapshot_kind = kNone;
 
+static bool use_dart_frontend = false;
+
+static const char* frontend_filename = NULL;
+
+// Value of the --save-feedback flag.
+// (This pointer points into an argv buffer and does not need to be
+// free'd.)
+static const char* save_feedback_filename = NULL;
+
+// Value of the --load-feedback flag.
+// (This pointer points into an argv buffer and does not need to be
+// free'd.)
+static const char* load_feedback_filename = NULL;
+
 // Value of the --package-root flag.
 // (This pointer points into an argv buffer and does not need to be
 // free'd.)
@@ -83,21 +95,10 @@
 static bool use_blobs = false;
 
 
-// Global flag that is used to indicate that we want to compile everything in
-// the same way as precompilation before main, then continue running in the
-// same process.
-// Always set this with dart_noopt.
-#if defined(DART_PRECOMPILER) && !defined(DART_NO_SNAPSHOT)
-static const bool is_noopt = true;
-#else
-static const bool is_noopt = false;
-#endif
-
-
-extern const char* kPrecompiledVMIsolateSymbolName;
-extern const char* kPrecompiledIsolateSymbolName;
-extern const char* kPrecompiledInstructionsSymbolName;
-extern const char* kPrecompiledDataSymbolName;
+extern const char* kVmSnapshotDataSymbolName;
+extern const char* kVmSnapshotInstructionsSymbolName;
+extern const char* kIsolateSnapshotDataSymbolName;
+extern const char* kIsolateSnapshotInstructionsSymbolName;
 
 
 // Global flag that is used to indicate that we want to trace resolution of
@@ -105,6 +106,11 @@
 static bool trace_loading = false;
 
 
+static char* app_script_uri = NULL;
+static const uint8_t* app_isolate_snapshot_data = NULL;
+static const uint8_t* app_isolate_snapshot_instructions = NULL;
+
+
 static Dart_Isolate main_isolate = NULL;
 
 
@@ -217,6 +223,28 @@
 }
 
 
+static bool ProcessSaveFeedbackOption(const char* arg,
+                                      CommandLineOptions* vm_options) {
+  ASSERT(arg != NULL);
+  if (*arg == '-') {
+    return false;
+  }
+  save_feedback_filename = arg;
+  return true;
+}
+
+
+static bool ProcessLoadFeedbackOption(const char* arg,
+                                      CommandLineOptions* vm_options) {
+  ASSERT(arg != NULL);
+  if (*arg == '-') {
+    return false;
+  }
+  load_feedback_filename = arg;
+  return true;
+}
+
+
 static void* GetHashmapKeyFromString(char* key) {
   return reinterpret_cast<void*>(key);
 }
@@ -324,6 +352,19 @@
 }
 
 
+static bool ProcessFrontendOption(const char* filename,
+                                  CommandLineOptions* vm_options) {
+  ASSERT(filename != NULL);
+  if (filename[0] == '\0') {
+    return false;
+  }
+  use_dart_frontend = true;
+  frontend_filename = filename;
+  vm_options->AddArgument("--use-dart-frontend");
+  return true;
+}
+
+
 static bool ProcessUseBlobsOption(const char* arg,
                                   CommandLineOptions* vm_options) {
   ASSERT(arg != NULL);
@@ -540,12 +581,15 @@
     // VM specific options to the standalone dart program.
     {"--compile_all", ProcessCompileAllOption},
     {"--parse_all", ProcessParseAllOption},
+    {"--dfe=", ProcessFrontendOption},
     {"--enable-vm-service", ProcessEnableVmServiceOption},
     {"--disable-service-origin-check", ProcessDisableServiceOriginCheckOption},
     {"--observe", ProcessObserveOption},
     {"--snapshot=", ProcessSnapshotFilenameOption},
     {"--snapshot-kind=", ProcessSnapshotKindOption},
     {"--use-blobs", ProcessUseBlobsOption},
+    {"--save-feedback=", ProcessSaveFeedbackOption},
+    {"--load-feedback=", ProcessLoadFeedbackOption},
     {"--trace-loading", ProcessTraceLoadingOption},
     {"--hot-reload-test-mode", ProcessHotReloadTestModeOption},
     {"--hot-reload-rollback-test-mode", ProcessHotReloadRollbackTestModeOption},
@@ -678,15 +722,11 @@
     Log::PrintErr("Empty package file name specified.\n");
     return -1;
   }
-  if (is_noopt && gen_snapshot_kind != kNone) {
-    Log::PrintErr("Generating a snapshot with dart_noopt is invalid.\n");
-    return -1;
-  }
   if ((gen_snapshot_kind != kNone) && (snapshot_filename == NULL)) {
     Log::PrintErr("Generating a snapshot requires a filename (--snapshot).\n");
     return -1;
   }
-  if ((gen_snapshot_kind != kNone) && run_app_snapshot) {
+  if ((gen_snapshot_kind != kNone) && vm_run_app_snapshot) {
     Log::PrintErr(
         "Specifying an option to generate a snapshot and"
         " run using a snapshot is invalid.\n");
@@ -770,7 +810,8 @@
 
 
 // Returns true on success, false on failure.
-static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
+static Dart_Isolate CreateIsolateAndSetupHelper(bool is_main_isolate,
+                                                const char* script_uri,
                                                 const char* main,
                                                 const char* package_root,
                                                 const char* packages_config,
@@ -778,26 +819,45 @@
                                                 char** error,
                                                 int* exit_code) {
   ASSERT(script_uri != NULL);
-
-  const bool needs_load_port = true;
-#if defined(PRODUCT)
-  const bool run_service_isolate = needs_load_port;
-#else
-  // Always create the service isolate in DEBUG and RELEASE modes for profiling,
-  // even if we don't need it for loading.
-  const bool run_service_isolate = true;
-#endif  // PRODUCT
-  if (!run_service_isolate &&
-      (strcmp(script_uri, DART_VM_SERVICE_ISOLATE_NAME) == 0)) {
-    return NULL;
+  if (strcmp(script_uri, DART_KERNEL_ISOLATE_NAME) == 0) {
+    if (!use_dart_frontend) {
+      *error = strdup("Kernel isolate not supported.");
+      return NULL;
+    } else {
+      if (packages_config == NULL) {
+        packages_config = commandline_packages_file;
+      }
+    }
   }
 
+#if defined(DART_PRECOMPILED_RUNTIME)
+  // AOT: All isolates start from the app snapshot.
+  bool isolate_run_app_snapshot = true;
+  const uint8_t* isolate_snapshot_data = app_isolate_snapshot_data;
+  const uint8_t* isolate_snapshot_instructions =
+      app_isolate_snapshot_instructions;
+#else
+  // JIT: Main isolate starts from the app snapshot, if any. Other isolates
+  // use the core libraries snapshot.
+  bool isolate_run_app_snapshot = false;
+  const uint8_t* isolate_snapshot_data = core_isolate_snapshot_data;
+  const uint8_t* isolate_snapshot_instructions =
+      core_isolate_snapshot_instructions;
+  if ((app_isolate_snapshot_data != NULL) &&
+      (is_main_isolate || ((app_script_uri != NULL) &&
+                           (strcmp(script_uri, app_script_uri) == 0)))) {
+    isolate_run_app_snapshot = true;
+    isolate_snapshot_data = app_isolate_snapshot_data;
+    isolate_snapshot_instructions = app_isolate_snapshot_instructions;
+  }
+#endif
+
   // If the script is a Kernel binary, then we will try to bootstrap from the
   // script.
   const uint8_t* kernel_file = NULL;
   intptr_t kernel_length = -1;
   const bool is_kernel =
-      !run_app_snapshot &&
+      !isolate_run_app_snapshot &&
       TryReadKernel(script_uri, &kernel_file, &kernel_length);
 
   void* kernel_program = NULL;
@@ -811,8 +871,9 @@
   Dart_Isolate isolate =
       is_kernel ? Dart_CreateIsolateFromKernel(script_uri, main, kernel_program,
                                                flags, isolate_data, error)
-                : Dart_CreateIsolate(script_uri, main, isolate_snapshot_buffer,
-                                     flags, isolate_data, error);
+                : Dart_CreateIsolate(script_uri, main, isolate_snapshot_data,
+                                     isolate_snapshot_instructions, flags,
+                                     isolate_data, error);
   if (isolate == NULL) {
     delete isolate_data;
     return NULL;
@@ -828,19 +889,19 @@
     Dart_Handle result = Dart_LoadKernel(kernel_program);
     CHECK_RESULT(result);
   }
-  if (is_kernel || (isolate_snapshot_buffer != NULL)) {
+  if (is_kernel || (isolate_snapshot_data != NULL)) {
     // Setup the native resolver as the snapshot does not carry it.
     Builtin::SetNativeResolver(Builtin::kBuiltinLibrary);
     Builtin::SetNativeResolver(Builtin::kIOLibrary);
   }
-  if (run_app_snapshot) {
+  if (isolate_run_app_snapshot) {
     Dart_Handle result = Loader::ReloadNativeExtensions();
     CHECK_RESULT(result);
   }
 
   if (Dart_IsServiceIsolate(isolate)) {
     // If this is the service isolate, load embedder specific bits and return.
-    bool skip_library_load = run_app_snapshot;
+    bool skip_library_load = isolate_run_app_snapshot;
     if (!VmService::Setup(vm_service_server_ip, vm_service_server_port,
                           skip_library_load, vm_service_dev_mode)) {
       *error = strdup(VmService::GetErrorMessage());
@@ -863,11 +924,13 @@
   result = DartUtils::PrepareForScriptLoading(false, trace_loading);
   CHECK_RESULT(result);
 
-  if (needs_load_port) {
-    // Set up the load port provided by the service isolate so that we can
-    // load scripts.
-    result = DartUtils::SetupServiceLoadPort();
-    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);
+
+  if (Dart_IsKernelIsolate(isolate)) {
+    script_uri = frontend_filename;
   }
 
   // Setup package root if specified.
@@ -877,10 +940,33 @@
   result = Dart_SetEnvironmentCallback(EnvironmentCallback);
   CHECK_RESULT(result);
 
-  if (run_app_snapshot) {
+  if (!Dart_IsKernelIsolate(isolate) && use_dart_frontend) {
+    // This must be the main script to be loaded. Wait for Kernel isolate
+    // to finish initialization.
+    Dart_Port port = Dart_ServiceWaitForKernelPort();
+    if (port == ILLEGAL_PORT) {
+      *error = strdup("Error while initializing Kernel isolate");
+      return NULL;
+    }
+  }
+
+  if (isolate_run_app_snapshot) {
     result = DartUtils::SetupIOLibrary(script_uri);
     CHECK_RESULT(result);
     Loader::InitForSnapshot(script_uri);
+#if !defined(DART_PRECOMPILED_RUNTIME)
+    if (is_main_isolate) {
+      // Find the canonical uri of the app snapshot. We'll use this to decide if
+      // other isolates should use the app snapshot or the core snapshot.
+      const char* resolved_script_uri = NULL;
+      result = Dart_StringToCString(
+          DartUtils::ResolveScript(Dart_NewStringFromCString(script_uri)),
+          &resolved_script_uri);
+      CHECK_RESULT(result);
+      ASSERT(app_script_uri == NULL);
+      app_script_uri = strdup(resolved_script_uri);
+    }
+#endif  // !defined(DART_PRECOMPILED_RUNTIME)
   } else {
     // Load the specified application script into the newly created isolate.
     Dart_Handle uri =
@@ -933,9 +1019,11 @@
     return NULL;
   }
 
+  bool is_main_isolate = false;
   int exit_code = 0;
-  return CreateIsolateAndSetupHelper(script_uri, main, package_root,
-                                     package_config, flags, error, &exit_code);
+  return CreateIsolateAndSetupHelper(is_main_isolate, script_uri, main,
+                                     package_root, package_config, flags, error,
+                                     &exit_code);
 }
 
 
@@ -1206,10 +1294,10 @@
 
 
 static bool ReadAppSnapshotBlobs(const char* script_name,
-                                 const uint8_t** vmisolate_buffer,
-                                 const uint8_t** isolate_buffer,
-                                 const uint8_t** instructions_buffer,
-                                 const uint8_t** rodata_buffer) {
+                                 const uint8_t** vm_data_buffer,
+                                 const uint8_t** vm_instructions_buffer,
+                                 const uint8_t** isolate_data_buffer,
+                                 const uint8_t** isolate_instructions_buffer) {
   File* file = File::Open(script_name, File::kRead);
   if (file == NULL) {
     return false;
@@ -1229,49 +1317,58 @@
     return false;
   }
 
-  int64_t vmisolate_size = header[1];
-  int64_t vmisolate_position =
+  int64_t vm_data_size = header[1];
+  int64_t vm_data_position =
       Utils::RoundUp(file->Position(), kAppSnapshotPageSize);
-  int64_t isolate_size = header[2];
-  int64_t isolate_position =
-      Utils::RoundUp(vmisolate_position + vmisolate_size, kAppSnapshotPageSize);
-  int64_t rodata_size = header[3];
-  int64_t rodata_position = isolate_position + isolate_size;
-  if (rodata_size != 0) {
-    rodata_position = Utils::RoundUp(rodata_position, kAppSnapshotPageSize);
+  int64_t vm_instructions_size = header[2];
+  int64_t vm_instructions_position = vm_data_position + vm_data_size;
+  if (vm_instructions_size != 0) {
+    vm_instructions_position =
+        Utils::RoundUp(vm_instructions_position, kAppSnapshotPageSize);
   }
-  int64_t instructions_size = header[4];
-  int64_t instructions_position = rodata_position + rodata_size;
-  if (instructions_size != 0) {
-    instructions_position =
-        Utils::RoundUp(instructions_position, kAppSnapshotPageSize);
+  int64_t isolate_data_size = header[3];
+  int64_t isolate_data_position = Utils::RoundUp(
+      vm_instructions_position + vm_instructions_size, kAppSnapshotPageSize);
+  int64_t isolate_instructions_size = header[4];
+  int64_t isolate_instructions_position =
+      isolate_data_position + isolate_data_size;
+  if (isolate_instructions_size != 0) {
+    isolate_instructions_position =
+        Utils::RoundUp(isolate_instructions_position, kAppSnapshotPageSize);
   }
 
-  void* read_only_buffer =
-      file->Map(File::kReadOnly, vmisolate_position,
-                instructions_position - vmisolate_position);
-  if (read_only_buffer == NULL) {
+  if (vm_data_size != 0) {
+    *vm_data_buffer = reinterpret_cast<const uint8_t*>(
+        file->Map(File::kReadOnly, vm_data_position, vm_data_size));
+    if (vm_data_buffer == NULL) {
+      Log::PrintErr("Failed to memory map snapshot\n");
+      Platform::Exit(kErrorExitCode);
+    }
+  }
+
+  if (vm_instructions_size != 0) {
+    *vm_instructions_buffer = reinterpret_cast<const uint8_t*>(file->Map(
+        File::kReadExecute, vm_instructions_position, vm_instructions_size));
+    if (*vm_instructions_buffer == NULL) {
+      Log::PrintErr("Failed to memory map snapshot\n");
+      Platform::Exit(kErrorExitCode);
+    }
+  }
+
+  *isolate_data_buffer = reinterpret_cast<const uint8_t*>(
+      file->Map(File::kReadOnly, isolate_data_position, isolate_data_size));
+  if (isolate_data_buffer == NULL) {
     Log::PrintErr("Failed to memory map snapshot\n");
     Platform::Exit(kErrorExitCode);
   }
 
-  *vmisolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) +
-                      (vmisolate_position - vmisolate_position);
-  *isolate_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) +
-                    (isolate_position - vmisolate_position);
-  if (rodata_size == 0) {
-    *rodata_buffer = NULL;
+  if (isolate_instructions_size == 0) {
+    *isolate_instructions_buffer = NULL;
   } else {
-    *rodata_buffer = reinterpret_cast<const uint8_t*>(read_only_buffer) +
-                     (rodata_position - vmisolate_position);
-  }
-
-  if (instructions_size == 0) {
-    *instructions_buffer = NULL;
-  } else {
-    *instructions_buffer = reinterpret_cast<const uint8_t*>(
-        file->Map(File::kReadExecute, instructions_position, header[4]));
-    if (*instructions_buffer == NULL) {
+    *isolate_instructions_buffer = reinterpret_cast<const uint8_t*>(
+        file->Map(File::kReadExecute, isolate_instructions_position,
+                  isolate_instructions_size));
+    if (*isolate_instructions_buffer == NULL) {
       Log::PrintErr("Failed to memory map snapshot\n");
       Platform::Exit(kErrorExitCode);
     }
@@ -1282,70 +1379,79 @@
 }
 
 
-static bool ReadAppSnapshotDynamicLibrary(const char* script_name,
-                                          const uint8_t** vmisolate_buffer,
-                                          const uint8_t** isolate_buffer,
-                                          const uint8_t** instructions_buffer,
-                                          const uint8_t** rodata_buffer) {
+#if defined(DART_PRECOMPILED_RUNTIME)
+static bool ReadAppSnapshotDynamicLibrary(
+    const char* script_name,
+    const uint8_t** vm_data_buffer,
+    const uint8_t** vm_instructions_buffer,
+    const uint8_t** isolate_data_buffer,
+    const uint8_t** isolate_instructions_buffer) {
   void* library = Extensions::LoadExtensionLibrary(script_name);
   if (library == NULL) {
     return false;
   }
 
-  *vmisolate_buffer = reinterpret_cast<const uint8_t*>(
-      Extensions::ResolveSymbol(library, kPrecompiledVMIsolateSymbolName));
-  if (*vmisolate_buffer == NULL) {
-    Log::PrintErr("Failed to resolve symbol '%s'\n",
-                  kPrecompiledVMIsolateSymbolName);
+  *vm_data_buffer = reinterpret_cast<const uint8_t*>(
+      Extensions::ResolveSymbol(library, kVmSnapshotDataSymbolName));
+  if (*vm_data_buffer == NULL) {
+    Log::PrintErr("Failed to resolve symbol '%s'\n", kVmSnapshotDataSymbolName);
     Platform::Exit(kErrorExitCode);
   }
 
-  *isolate_buffer = reinterpret_cast<const uint8_t*>(
-      Extensions::ResolveSymbol(library, kPrecompiledIsolateSymbolName));
-  if (*isolate_buffer == NULL) {
+  *vm_instructions_buffer = reinterpret_cast<const uint8_t*>(
+      Extensions::ResolveSymbol(library, kVmSnapshotInstructionsSymbolName));
+  if (*vm_instructions_buffer == NULL) {
     Log::PrintErr("Failed to resolve symbol '%s'\n",
-                  kPrecompiledIsolateSymbolName);
+                  kVmSnapshotInstructionsSymbolName);
     Platform::Exit(kErrorExitCode);
   }
 
-  *instructions_buffer = reinterpret_cast<const uint8_t*>(
-      Extensions::ResolveSymbol(library, kPrecompiledInstructionsSymbolName));
-  if (*instructions_buffer == NULL) {
+  *isolate_data_buffer = reinterpret_cast<const uint8_t*>(
+      Extensions::ResolveSymbol(library, kIsolateSnapshotDataSymbolName));
+  if (*isolate_data_buffer == NULL) {
     Log::PrintErr("Failed to resolve symbol '%s'\n",
-                  kPrecompiledInstructionsSymbolName);
+                  kIsolateSnapshotDataSymbolName);
     Platform::Exit(kErrorExitCode);
   }
 
-  *rodata_buffer = reinterpret_cast<const uint8_t*>(
-      Extensions::ResolveSymbol(library, kPrecompiledDataSymbolName));
-  if (*rodata_buffer == NULL) {
+  *isolate_instructions_buffer =
+      reinterpret_cast<const uint8_t*>(Extensions::ResolveSymbol(
+          library, kIsolateSnapshotInstructionsSymbolName));
+  if (*isolate_instructions_buffer == NULL) {
     Log::PrintErr("Failed to resolve symbol '%s'\n",
-                  kPrecompiledDataSymbolName);
+                  kIsolateSnapshotInstructionsSymbolName);
     Platform::Exit(kErrorExitCode);
   }
 
   return true;
 }
+#endif  // defined(DART_PRECOMPILED_RUNTIME)
 
 
 static bool ReadAppSnapshot(const char* script_name,
-                            const uint8_t** vmisolate_buffer,
-                            const uint8_t** isolate_buffer,
-                            const uint8_t** instructions_buffer,
-                            const uint8_t** rodata_buffer) {
+                            const uint8_t** vm_data_buffer,
+                            const uint8_t** vm_instructions_buffer,
+                            const uint8_t** isolate_data_buffer,
+                            const uint8_t** isolate_instructions_buffer) {
   if (File::GetType(script_name, true) != File::kIsFile) {
     // If 'script_name' refers to a pipe, don't read to check for an app
     // snapshot since we cannot rewind if it isn't (and couldn't mmap it in
     // anyway if it was).
     return false;
   }
-  if (ReadAppSnapshotBlobs(script_name, vmisolate_buffer, isolate_buffer,
-                           instructions_buffer, rodata_buffer)) {
+  if (ReadAppSnapshotBlobs(script_name, vm_data_buffer, vm_instructions_buffer,
+                           isolate_data_buffer, isolate_instructions_buffer)) {
     return true;
   }
-  return ReadAppSnapshotDynamicLibrary(script_name, vmisolate_buffer,
-                                       isolate_buffer, instructions_buffer,
-                                       rodata_buffer);
+#if defined(DART_PRECOMPILED_RUNTIME)
+  // For testing AOT with the standalone embedder, we also support loading
+  // from a dynamic library to simulate what happens on iOS.
+  return ReadAppSnapshotDynamicLibrary(
+      script_name, vm_data_buffer, vm_instructions_buffer, isolate_data_buffer,
+      isolate_instructions_buffer);
+#else
+  return false;
+#endif  //  defined(DART_PRECOMPILED_RUNTIME)
 }
 
 
@@ -1355,47 +1461,48 @@
 
 
 static void WriteAppSnapshot(const char* filename,
-                             uint8_t* vmisolate_buffer,
-                             intptr_t vmisolate_size,
-                             uint8_t* isolate_buffer,
-                             intptr_t isolate_size,
-                             uint8_t* instructions_buffer,
-                             intptr_t instructions_size,
-                             uint8_t* rodata_buffer,
-                             intptr_t rodata_size) {
+                             uint8_t* vm_data_buffer,
+                             intptr_t vm_data_size,
+                             uint8_t* vm_instructions_buffer,
+                             intptr_t vm_instructions_size,
+                             uint8_t* isolate_data_buffer,
+                             intptr_t isolate_data_size,
+                             uint8_t* isolate_instructions_buffer,
+                             intptr_t isolate_instructions_size) {
   File* file = File::Open(filename, File::kWriteTruncate);
   if (file == NULL) {
     ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename);
   }
 
   file->WriteFully(&kAppSnapshotMagicNumber, sizeof(kAppSnapshotMagicNumber));
-  WriteInt64(file, vmisolate_size);
-  WriteInt64(file, isolate_size);
-  WriteInt64(file, rodata_size);
-  WriteInt64(file, instructions_size);
+  WriteInt64(file, vm_data_size);
+  WriteInt64(file, vm_instructions_size);
+  WriteInt64(file, isolate_data_size);
+  WriteInt64(file, isolate_instructions_size);
   ASSERT(file->Position() == kAppSnapshotHeaderSize);
 
   file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize));
-  if (!file->WriteFully(vmisolate_buffer, vmisolate_size)) {
+  if (!file->WriteFully(vm_data_buffer, vm_data_size)) {
     ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename);
   }
 
-  file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize));
-  if (!file->WriteFully(isolate_buffer, isolate_size)) {
-    ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename);
-  }
-
-  if (rodata_size != 0) {
+  if (vm_instructions_size != 0) {
     file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize));
-    if (!file->WriteFully(rodata_buffer, rodata_size)) {
+    if (!file->WriteFully(vm_instructions_buffer, vm_instructions_size)) {
       ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n",
                 filename);
     }
   }
 
-  if (instructions_size != 0) {
+  file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize));
+  if (!file->WriteFully(isolate_data_buffer, isolate_data_size)) {
+    ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename);
+  }
+
+  if (isolate_instructions_size != 0) {
     file->SetPosition(Utils::RoundUp(file->Position(), kAppSnapshotPageSize));
-    if (!file->WriteFully(instructions_buffer, instructions_size)) {
+    if (!file->WriteFully(isolate_instructions_buffer,
+                          isolate_instructions_size)) {
       ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n",
                 filename);
     }
@@ -1419,89 +1526,76 @@
 }
 
 
-static void GeneratePrecompiledSnapshot() {
-  uint8_t* vm_isolate_buffer = NULL;
-  intptr_t vm_isolate_size = 0;
-  uint8_t* isolate_buffer = NULL;
-  intptr_t isolate_size = 0;
+static void GenerateAppAOTSnapshotAsBlobs() {
+  uint8_t* vm_data_buffer = NULL;
+  intptr_t vm_data_size = 0;
+  uint8_t* vm_instructions_buffer = NULL;
+  intptr_t vm_instructions_size = 0;
+  uint8_t* isolate_data_buffer = NULL;
+  intptr_t isolate_data_size = 0;
+  uint8_t* isolate_instructions_buffer = NULL;
+  intptr_t isolate_instructions_size = 0;
+  Dart_Handle result = Dart_CreateAppAOTSnapshotAsBlobs(
+      &vm_data_buffer, &vm_data_size, &vm_instructions_buffer,
+      &vm_instructions_size, &isolate_data_buffer, &isolate_data_size,
+      &isolate_instructions_buffer, &isolate_instructions_size);
+  if (Dart_IsError(result)) {
+    ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result));
+  }
+  WriteAppSnapshot(snapshot_filename, vm_data_buffer, vm_data_size,
+                   vm_instructions_buffer, vm_instructions_size,
+                   isolate_data_buffer, isolate_data_size,
+                   isolate_instructions_buffer, isolate_instructions_size);
+}
+
+static void GenerateAppAOTSnapshotAsAssembly() {
   uint8_t* assembly_buffer = NULL;
   intptr_t assembly_size = 0;
-  uint8_t* instructions_blob_buffer = NULL;
-  intptr_t instructions_blob_size = 0;
-  uint8_t* rodata_blob_buffer = NULL;
-  intptr_t rodata_blob_size = 0;
-  Dart_Handle result;
-  if (use_blobs) {
-    result = Dart_CreatePrecompiledSnapshotBlob(
-        &vm_isolate_buffer, &vm_isolate_size, &isolate_buffer, &isolate_size,
-        &instructions_blob_buffer, &instructions_blob_size, &rodata_blob_buffer,
-        &rodata_blob_size);
-  } else {
-    result = Dart_CreatePrecompiledSnapshotAssembly(&assembly_buffer,
-                                                    &assembly_size);
-  }
+  Dart_Handle result =
+      Dart_CreateAppAOTSnapshotAsAssembly(&assembly_buffer, &assembly_size);
   if (Dart_IsError(result)) {
     ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result));
   }
+  WriteSnapshotFile(snapshot_filename, false, assembly_buffer, assembly_size);
+}
+
+
+static void GenerateAppAOTSnapshot() {
   if (use_blobs) {
-    WriteAppSnapshot(snapshot_filename, vm_isolate_buffer, vm_isolate_size,
-                     isolate_buffer, isolate_size, instructions_blob_buffer,
-                     instructions_blob_size, rodata_blob_buffer,
-                     rodata_blob_size);
+    GenerateAppAOTSnapshotAsBlobs();
   } else {
-    WriteSnapshotFile(snapshot_filename, false, assembly_buffer, assembly_size);
+    GenerateAppAOTSnapshotAsAssembly();
   }
 }
 
 
+static void GenerateAppJITSnapshot() {
 #if defined(TARGET_ARCH_X64)
-static void GeneratePrecompiledJITSnapshot() {
-  uint8_t* vm_isolate_buffer = NULL;
-  intptr_t vm_isolate_size = 0;
-  uint8_t* isolate_buffer = NULL;
-  intptr_t isolate_size = 0;
-  uint8_t* instructions_blob_buffer = NULL;
-  intptr_t instructions_blob_size = 0;
-  uint8_t* rodata_blob_buffer = NULL;
-  intptr_t rodata_blob_size = 0;
-  Dart_Handle result = Dart_CreateAppJITSnapshot(
-      &vm_isolate_buffer, &vm_isolate_size, &isolate_buffer, &isolate_size,
-      &instructions_blob_buffer, &instructions_blob_size, &rodata_blob_buffer,
-      &rodata_blob_size);
+  uint8_t* isolate_data_buffer = NULL;
+  intptr_t isolate_data_size = 0;
+  uint8_t* isolate_instructions_buffer = NULL;
+  intptr_t isolate_instructions_size = 0;
+  Dart_Handle result = Dart_CreateAppJITSnapshotAsBlobs(
+      &isolate_data_buffer, &isolate_data_size, &isolate_instructions_buffer,
+      &isolate_instructions_size);
   if (Dart_IsError(result)) {
     ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result));
   }
-  WriteAppSnapshot(snapshot_filename, vm_isolate_buffer, vm_isolate_size,
-                   isolate_buffer, isolate_size, instructions_blob_buffer,
-                   instructions_blob_size, rodata_blob_buffer,
-                   rodata_blob_size);
-}
-#endif  // defined(TARGET_ARCH_X64)
-
-
-static void GenerateAppSnapshot() {
-  Dart_Handle result;
-#if defined(TARGET_ARCH_X64)
-  result = Dart_PrecompileJIT();
-  if (Dart_IsError(result)) {
-    ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result));
-  }
-  GeneratePrecompiledJITSnapshot();
+  WriteAppSnapshot(snapshot_filename, NULL, 0, NULL, 0, isolate_data_buffer,
+                   isolate_data_size, isolate_instructions_buffer,
+                   isolate_instructions_size);
 #else
-  // Create an application snapshot of the script.
-  uint8_t* vm_isolate_buffer = NULL;
-  intptr_t vm_isolate_size = 0;
   uint8_t* isolate_buffer = NULL;
   intptr_t isolate_size = 0;
 
-  result = Dart_CreateSnapshot(&vm_isolate_buffer, &vm_isolate_size,
-                               &isolate_buffer, &isolate_size);
+  Dart_Handle result =
+      Dart_CreateSnapshot(NULL, NULL, &isolate_buffer, &isolate_size);
   if (Dart_IsError(result)) {
     ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result));
   }
 
-  WriteAppSnapshot(snapshot_filename, vm_isolate_buffer, vm_isolate_size,
-                   isolate_buffer, isolate_size, NULL, 0, NULL, 0);
+  WriteAppSnapshot(snapshot_filename, NULL, 0, NULL, 0, isolate_buffer,
+                   isolate_size, NULL, 0);
 #endif  // defined(TARGET_ARCH_X64)
 }
 
@@ -1529,7 +1623,7 @@
     Platform::Exit(kErrorExitCode);
   }
   if (exit_code == 0) {
-    GenerateAppSnapshot();
+    GenerateAppJITSnapshot();
   }
 }
 
@@ -1538,11 +1632,12 @@
   // Call CreateIsolateAndSetup which creates an isolate and loads up
   // the specified application script.
   char* error = NULL;
+  bool is_main_isolate = true;
   int exit_code = 0;
   char* isolate_name = BuildIsolateName(script_name, "main");
   Dart_Isolate isolate = CreateIsolateAndSetupHelper(
-      script_name, "main", commandline_package_root, commandline_packages_file,
-      NULL, &error, &exit_code);
+      is_main_isolate, script_name, "main", commandline_package_root,
+      commandline_packages_file, NULL, &error, &exit_code);
   if (isolate == NULL) {
     delete[] isolate_name;
     if (exit_code == kRestartRequestExitCode) {
@@ -1582,8 +1677,7 @@
         reinterpret_cast<IsolateData*>(Dart_IsolateData(isolate));
     result = Dart_LibraryImportLibrary(isolate_data->builtin_lib(), root_lib,
                                        Dart_Null());
-    if (is_noopt || (gen_snapshot_kind == kAppAOT) ||
-        (gen_snapshot_kind == kAppJIT)) {
+    if ((gen_snapshot_kind == kAppAOT) || (gen_snapshot_kind == kAppJIT)) {
       // Load the embedder's portion of the VM service's Dart code so it will
       // be included in the app snapshot.
       if (!VmService::LoadForGenPrecompiled()) {
@@ -1607,7 +1701,7 @@
       return false;
     }
 
-    if (is_noopt || (gen_snapshot_kind == kAppAOT)) {
+    if (gen_snapshot_kind == kAppAOT) {
       Dart_QualifiedFunctionName standalone_entry_points[] = {
           {"dart:_builtin", "::", "_getMainClosure"},
           {"dart:_builtin", "::", "_getPrintClosure"},
@@ -1645,13 +1739,31 @@
           {NULL, NULL, NULL}  // Must be terminated with NULL entries.
       };
 
-      const bool reset_fields = gen_snapshot_kind == kAppAOT;
-      result = Dart_Precompile(standalone_entry_points, reset_fields);
+      uint8_t* feedback_buffer = NULL;
+      intptr_t feedback_length = 0;
+      if (load_feedback_filename != NULL) {
+        File* file = File::Open(load_feedback_filename, File::kRead);
+        if (file == NULL) {
+          ErrorExit(kErrorExitCode, "Failed to read JIT feedback.\n");
+        }
+        feedback_length = file->Length();
+        feedback_buffer = reinterpret_cast<uint8_t*>(malloc(feedback_length));
+        if (!file->ReadFully(feedback_buffer, feedback_length)) {
+          ErrorExit(kErrorExitCode, "Failed to read JIT feedback.\n");
+        }
+        file->Release();
+      }
+
+      result = Dart_Precompile(standalone_entry_points, feedback_buffer,
+                               feedback_length);
+      if (feedback_buffer != NULL) {
+        free(feedback_buffer);
+      }
       CHECK_RESULT(result);
     }
 
     if (gen_snapshot_kind == kAppAOT) {
-      GeneratePrecompiledSnapshot();
+      GenerateAppAOTSnapshot();
     } else {
       if (Dart_IsNull(root_lib)) {
         ErrorExit(kErrorExitCode, "Unable to find root library for '%s'\n",
@@ -1686,10 +1798,20 @@
       if (gen_snapshot_kind == kAppJIT) {
         if (!Dart_IsCompilationError(result) &&
             !Dart_IsVMRestartRequest(result)) {
-          GenerateAppSnapshot();
+          GenerateAppJITSnapshot();
         }
       }
       CHECK_RESULT(result);
+
+      if (save_feedback_filename != NULL) {
+        uint8_t* buffer = NULL;
+        intptr_t size = 0;
+        result = Dart_SaveJITFeedback(&buffer, &size);
+        if (Dart_IsError(result)) {
+          ErrorExit(kErrorExitCode, "%s\n", Dart_GetError(result));
+        }
+        WriteSnapshotFile(save_feedback_filename, false, buffer, size);
+      }
     }
   }
 
@@ -1800,7 +1922,6 @@
   bool print_flags_seen = false;
   bool verbose_debug_seen = false;
 
-  vm_options.AddArgument("--no_write_protect_code");
   // Perform platform specific initialization.
   if (!Platform::Initialize()) {
     Log::PrintErr("Initialization failed\n");
@@ -1840,18 +1961,15 @@
     Platform::Exit(kErrorExitCode);
   }
 
-  const uint8_t* instructions_snapshot = NULL;
-  const uint8_t* data_snapshot = NULL;
-
-  if (ReadAppSnapshot(script_name, &vm_isolate_snapshot_buffer,
-                      &isolate_snapshot_buffer, &instructions_snapshot,
-                      &data_snapshot)) {
-    run_app_snapshot = true;
+  if (ReadAppSnapshot(script_name, &vm_snapshot_data, &vm_snapshot_instructions,
+                      &app_isolate_snapshot_data,
+                      &app_isolate_snapshot_instructions)) {
+    vm_run_app_snapshot = true;
   }
 
 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
   // Constant true if PRODUCT or DART_PRECOMPILED_RUNTIME.
-  if ((gen_snapshot_kind != kNone) || run_app_snapshot) {
+  if ((gen_snapshot_kind != kNone) || vm_run_app_snapshot) {
     vm_options.AddArgument("--load_deferred_eagerly");
   }
 #endif
@@ -1862,7 +1980,7 @@
     vm_options.AddArgument("--collect_code=false");
 #endif
   }
-  if ((gen_snapshot_kind == kAppAOT) || is_noopt) {
+  if (gen_snapshot_kind == kAppAOT) {
     vm_options.AddArgument("--precompilation");
   }
 #if defined(DART_PRECOMPILED_RUNTIME)
@@ -1882,9 +2000,8 @@
   Dart_InitializeParams init_params;
   memset(&init_params, 0, sizeof(init_params));
   init_params.version = DART_INITIALIZE_PARAMS_CURRENT_VERSION;
-  init_params.vm_isolate_snapshot = vm_isolate_snapshot_buffer;
-  init_params.instructions_snapshot = instructions_snapshot;
-  init_params.data_snapshot = data_snapshot;
+  init_params.vm_snapshot_data = vm_snapshot_data;
+  init_params.vm_snapshot_instructions = vm_snapshot_instructions;
   init_params.create = CreateIsolateAndSetup;
   init_params.shutdown = ShutdownIsolate;
   init_params.file_open = DartUtils::OpenFile;
@@ -1923,6 +2040,8 @@
   }
   EventHandler::Stop();
 
+  free(app_script_uri);
+
   // Free copied argument strings if converted.
   if (argv_converted) {
     for (int i = 0; i < argc; i++) {
diff --git a/runtime/bin/platform_fuchsia.cc b/runtime/bin/platform_fuchsia.cc
index caa5aef..53f07ac 100644
--- a/runtime/bin/platform_fuchsia.cc
+++ b/runtime/bin/platform_fuchsia.cc
@@ -10,6 +10,7 @@
 #include <string.h>  // NOLINT
 #include <unistd.h>  // NOLINT
 
+#include "bin/dartutils.h"
 #include "bin/fdutils.h"
 #include "bin/file.h"
 
@@ -52,15 +53,59 @@
 
 
 char** Platform::Environment(intptr_t* count) {
-  char** result =
-      reinterpret_cast<char**>(Dart_ScopeAllocate(1 * sizeof(*result)));
-  result[0] = NULL;
+  // Using environ directly is only safe as long as we do not
+  // provide access to modifying environment variables.
+  intptr_t i = 0;
+  char** tmp = environ;
+  while (*(tmp++) != NULL) {
+    i++;
+  }
+  *count = i;
+  char** result;
+  result = reinterpret_cast<char**>(Dart_ScopeAllocate(i * sizeof(*result)));
+  for (intptr_t current = 0; current < i; current++) {
+    result[current] = environ[current];
+  }
   return result;
 }
 
 
 const char* Platform::ResolveExecutablePath() {
-  return "dart";
+  // The string used on the command line to spawn the executable is in argv_[0].
+  // If that string is a relative or absolute path, i.e. it contains a '/', then
+  // we make the path absolute if it is not already and return it. If argv_[0]
+  // does not contain a '/', we assume it is a program whose location is
+  // resolved via the PATH environment variable, and search for it using the
+  // paths found there.
+  const char* path = getenv("PATH");
+  if ((strchr(argv_[0], '/') != NULL) || (path == NULL)) {
+    if (argv_[0][0] == '/') {
+      return File::GetCanonicalPath(argv_[0]);
+    } else {
+      char* result = DartUtils::ScopedCString(PATH_MAX + 1);
+      char* cwd = DartUtils::ScopedCString(PATH_MAX + 1);
+      getcwd(cwd, PATH_MAX);
+      snprintf(result, PATH_MAX, "%s/%s", cwd, argv_[0]);
+      result[PATH_MAX] = '\0';
+      ASSERT(File::Exists(result));
+      return File::GetCanonicalPath(result);
+    }
+  } else {
+    char* pathcopy = DartUtils::ScopedCopyCString(path);
+    char* result = DartUtils::ScopedCString(PATH_MAX + 1);
+    char* save = NULL;
+    while ((pathcopy = strtok_r(pathcopy, ":", &save)) != NULL) {
+      snprintf(result, PATH_MAX, "%s/%s", pathcopy, argv_[0]);
+      result[PATH_MAX] = '\0';
+      if (File::Exists(result)) {
+        return File::GetCanonicalPath(result);
+      }
+      pathcopy = NULL;
+    }
+    // Couldn't find it. This causes null to be returned for
+    // Platform.resovledExecutable.
+    return NULL;
+  }
 }
 
 
diff --git a/runtime/bin/process.h b/runtime/bin/process.h
index 48cf21b..f877b8d 100644
--- a/runtime/bin/process.h
+++ b/runtime/bin/process.h
@@ -5,11 +5,16 @@
 #ifndef RUNTIME_BIN_PROCESS_H_
 #define RUNTIME_BIN_PROCESS_H_
 
+#include <errno.h>
+
 #include "bin/builtin.h"
 #include "bin/io_buffer.h"
 #include "bin/lockers.h"
 #include "bin/thread.h"
 #include "platform/globals.h"
+#if !defined(TARGET_OS_WINDOWS)
+#include "platform/signal_blocker.h"
+#endif
 #include "platform/utils.h"
 
 namespace dart {
@@ -203,24 +208,30 @@
    public:
     explicit BufferListNode(intptr_t size) {
       data_ = new uint8_t[size];
-      if (data_ == NULL) FATAL("Allocation failed");
+      // We check for a failed allocation below in Allocate()
       next_ = NULL;
     }
 
     ~BufferListNode() { delete[] data_; }
 
+    bool Valid() const { return data_ != NULL; }
+
+    uint8_t* data() const { return data_; }
+    BufferListNode* next() const { return next_; }
+    void set_next(BufferListNode* n) { next_ = n; }
+
+   private:
     uint8_t* data_;
     BufferListNode* next_;
 
-   private:
     DISALLOW_IMPLICIT_CONSTRUCTORS(BufferListNode);
   };
 
  public:
   BufferListBase() : head_(NULL), tail_(NULL), data_size_(0), free_size_(0) {}
   ~BufferListBase() {
-    ASSERT(head_ == NULL);
-    ASSERT(tail_ == NULL);
+    Free();
+    DEBUG_ASSERT(IsEmpty());
   }
 
   // Returns the collected data as a Uint8List. If an error occours an
@@ -234,9 +245,9 @@
       return result;
     }
     for (BufferListNode* current = head_; current != NULL;
-         current = current->next_) {
+         current = current->next()) {
       intptr_t to_copy = dart::Utils::Minimum(data_size_, kBufferSize);
-      memmove(buffer + buffer_position, current->data_, to_copy);
+      memmove(buffer + buffer_position, current->data(), to_copy);
       buffer_position += to_copy;
       data_size_ -= to_copy;
     }
@@ -245,26 +256,36 @@
     return result;
   }
 
+#if defined(DEBUG)
+  bool IsEmpty() const { return (head_ == NULL) && (tail_ == NULL); }
+#endif
+
  protected:
-  void Allocate() {
+  bool Allocate() {
     ASSERT(free_size_ == 0);
     BufferListNode* node = new BufferListNode(kBufferSize);
+    if ((node == NULL) || !node->Valid()) {
+      // Failed to allocate a buffer for the node.
+      delete node;
+      return false;
+    }
     if (head_ == NULL) {
       head_ = node;
       tail_ = node;
     } else {
-      ASSERT(tail_->next_ == NULL);
-      tail_->next_ = node;
+      ASSERT(tail_->next() == NULL);
+      tail_->set_next(node);
       tail_ = node;
     }
     free_size_ = kBufferSize;
+    return true;
   }
 
   void Free() {
     BufferListNode* current = head_;
     while (current != NULL) {
       BufferListNode* tmp = current;
-      current = current->next_;
+      current = current->next();
       delete tmp;
     }
     head_ = NULL;
@@ -275,9 +296,19 @@
 
   // Returns the address of the first byte in the free space.
   uint8_t* FreeSpaceAddress() {
-    return tail_->data_ + (kBufferSize - free_size_);
+    return tail_->data() + (kBufferSize - free_size_);
   }
 
+  intptr_t data_size() const { return data_size_; }
+  void set_data_size(intptr_t size) { data_size_ = size; }
+
+  intptr_t free_size() const { return free_size_; }
+  void set_free_size(intptr_t size) { free_size_ = size; }
+
+  BufferListNode* head() const { return head_; }
+  BufferListNode* tail() const { return tail_; }
+
+ private:
   // Linked list for data collected.
   BufferListNode* head_;
   BufferListNode* tail_;
@@ -288,10 +319,49 @@
   // Number of free bytes in the last node in the list.
   intptr_t free_size_;
 
- private:
   DISALLOW_COPY_AND_ASSIGN(BufferListBase);
 };
 
+#if defined(TARGET_OS_ANDROID) || defined(TARGET_OS_FUCHSIA) ||                \
+    defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS)
+class BufferList : public BufferListBase {
+ public:
+  BufferList() {}
+
+  bool Read(int fd, intptr_t available) {
+    // Read all available bytes.
+    while (available > 0) {
+      if (free_size() == 0) {
+        if (!Allocate()) {
+          errno = ENOMEM;
+          return false;
+        }
+      }
+      ASSERT(free_size() > 0);
+      ASSERT(free_size() <= kBufferSize);
+      intptr_t block_size = dart::Utils::Minimum(free_size(), available);
+#if defined(TARGET_OS_FUCHSIA)
+      intptr_t bytes = NO_RETRY_EXPECTED(
+          read(fd, reinterpret_cast<void*>(FreeSpaceAddress()), block_size));
+#else
+      intptr_t bytes = TEMP_FAILURE_RETRY(
+          read(fd, reinterpret_cast<void*>(FreeSpaceAddress()), block_size));
+#endif  // defined(TARGET_OS_FUCHSIA)
+      if (bytes < 0) {
+        return false;
+      }
+      set_data_size(data_size() + bytes);
+      set_free_size(free_size() - bytes);
+      available -= bytes;
+    }
+    return true;
+  }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(BufferList);
+};
+#endif  // defined(TARGET_OS_ANDROID) ...
+
 }  // namespace bin
 }  // namespace dart
 
diff --git a/runtime/bin/process_android.cc b/runtime/bin/process_android.cc
index b49515f..d2dcca1 100644
--- a/runtime/bin/process_android.cc
+++ b/runtime/bin/process_android.cc
@@ -163,9 +163,12 @@
     // monitor.
     running_ = false;
 
-    // Fork to wake up waitpid.
+    // Wake up the [ExitCodeHandler] thread which is blocked on `wait()` (see
+    // [ExitCodeHandlerEntry]).
     if (TEMP_FAILURE_RETRY(fork()) == 0) {
-      exit(0);
+      // We avoid running through registered atexit() handlers because that is
+      // unnecessary work.
+      _exit(0);
     }
 
     monitor_->Notify();
@@ -679,7 +682,10 @@
                                strlen(os_error_message) + 1);
     }
     VOID_TEMP_FAILURE_RETRY(close(exec_control_[1]));
-    exit(1);
+
+    // We avoid running through registered atexit() handlers because that is
+    // unnecessary work.
+    _exit(1);
   }
 
 
@@ -768,36 +774,6 @@
 }
 
 
-class BufferList : public BufferListBase {
- public:
-  BufferList() {}
-
-  bool Read(int fd, intptr_t available) {
-    // Read all available bytes.
-    while (available > 0) {
-      if (free_size_ == 0) {
-        Allocate();
-      }
-      ASSERT(free_size_ > 0);
-      ASSERT(free_size_ <= kBufferSize);
-      intptr_t block_size = dart::Utils::Minimum(free_size_, available);
-      intptr_t bytes = TEMP_FAILURE_RETRY(
-          read(fd, reinterpret_cast<void*>(FreeSpaceAddress()), block_size));
-      if (bytes < 0) {
-        return false;
-      }
-      data_size_ += bytes;
-      free_size_ -= bytes;
-      available -= bytes;
-    }
-    return true;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(BufferList);
-};
-
-
 static bool CloseProcessBuffers(struct pollfd fds[3]) {
   int e = errno;
   VOID_TEMP_FAILURE_RETRY(close(fds[0].fd));
@@ -881,6 +857,8 @@
   // All handles closed and all data read.
   result->set_stdout_data(out_data.GetData());
   result->set_stderr_data(err_data.GetData());
+  DEBUG_ASSERT(out_data.IsEmpty());
+  DEBUG_ASSERT(err_data.IsEmpty());
 
   // Calculate the exit code.
   intptr_t exit_code = exit_code_data.ints[0];
diff --git a/runtime/bin/process_fuchsia.cc b/runtime/bin/process_fuchsia.cc
index 058234f..4b4b5d5 100644
--- a/runtime/bin/process_fuchsia.cc
+++ b/runtime/bin/process_fuchsia.cc
@@ -9,9 +9,37 @@
 
 #include "bin/process.h"
 
-#include "bin/lockers.h"
-#include "platform/assert.h"
+#include <errno.h>
+#include <fcntl.h>
+#include <launchpad/launchpad.h>
+#include <launchpad/vmo.h>
+#include <magenta/status.h>
+#include <magenta/syscalls.h>
+#include <magenta/syscalls/object.h>
+#include <mxio/util.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/epoll.h>
+#include <unistd.h>
 
+#include "bin/dartutils.h"
+#include "bin/fdutils.h"
+#include "bin/lockers.h"
+#include "bin/log.h"
+#include "platform/signal_blocker.h"
+#include "platform/utils.h"
+
+// #define PROCESS_LOGGING 1
+#if defined(PROCESS_LOGGING)
+#define LOG_ERR(msg, ...) Log::PrintErr("Dart Process: " msg, ##__VA_ARGS__)
+#define LOG_INFO(msg, ...) Log::Print("Dart Process: " msg, ##__VA_ARGS__)
+#else
+#define LOG_ERR(msg, ...)
+#define LOG_INFO(msg, ...)
+#endif  // defined(PROCESS_LOGGING)
 
 namespace dart {
 namespace bin {
@@ -20,38 +48,767 @@
 Mutex* Process::global_exit_code_mutex_ = new Mutex();
 Process::ExitHook Process::exit_hook_ = NULL;
 
-void Process::TerminateExitCodeHandler() {}
+// ProcessInfo is used to map a process id to the file descriptor for
+// the pipe used to communicate the exit code of the process to Dart.
+// ProcessInfo objects are kept in the static singly-linked
+// ProcessInfoList.
+class ProcessInfo {
+ public:
+  ProcessInfo(mx_handle_t process, intptr_t fd)
+      : process_(process), exit_pipe_fd_(fd) {}
+  ~ProcessInfo() {
+    int closed = NO_RETRY_EXPECTED(close(exit_pipe_fd_));
+    if (closed != 0) {
+      FATAL("Failed to close process exit code pipe");
+    }
+    mx_handle_close(process_);
+  }
+  mx_handle_t process() const { return process_; }
+  intptr_t exit_pipe_fd() const { return exit_pipe_fd_; }
+  ProcessInfo* next() const { return next_; }
+  void set_next(ProcessInfo* info) { next_ = info; }
+
+ private:
+  mx_handle_t process_;
+  intptr_t exit_pipe_fd_;
+  ProcessInfo* next_;
+
+  DISALLOW_COPY_AND_ASSIGN(ProcessInfo);
+};
+
+
+// Singly-linked list of ProcessInfo objects for all active processes
+// started from Dart.
+class ProcessInfoList {
+ public:
+  static void AddProcess(mx_handle_t process, intptr_t fd) {
+    MutexLocker locker(mutex_);
+    ProcessInfo* info = new ProcessInfo(process, fd);
+    info->set_next(active_processes_);
+    active_processes_ = info;
+  }
+
+  static intptr_t LookupProcessExitFd(mx_handle_t process) {
+    MutexLocker locker(mutex_);
+    ProcessInfo* current = active_processes_;
+    while (current != NULL) {
+      if (current->process() == process) {
+        return current->exit_pipe_fd();
+      }
+      current = current->next();
+    }
+    return 0;
+  }
+
+  static bool Exists(mx_handle_t process) {
+    return LookupProcessExitFd(process) != 0;
+  }
+
+  static void RemoveProcess(mx_handle_t process) {
+    MutexLocker locker(mutex_);
+    ProcessInfo* prev = NULL;
+    ProcessInfo* current = active_processes_;
+    while (current != NULL) {
+      if (current->process() == process) {
+        if (prev == NULL) {
+          active_processes_ = current->next();
+        } else {
+          prev->set_next(current->next());
+        }
+        delete current;
+        return;
+      }
+      prev = current;
+      current = current->next();
+    }
+  }
+
+ private:
+  // Linked list of ProcessInfo objects for all active processes
+  // started from Dart code.
+  static ProcessInfo* active_processes_;
+  // Mutex protecting all accesses to the linked list of active
+  // processes.
+  static Mutex* mutex_;
+
+  DISALLOW_ALLOCATION();
+  DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessInfoList);
+};
+
+ProcessInfo* ProcessInfoList::active_processes_ = NULL;
+Mutex* ProcessInfoList::mutex_ = new Mutex();
+
+// The exit code handler sets up a separate thread which waits for child
+// processes to terminate. That separate thread can then get the exit code from
+// processes that have exited and communicate it to Dart through the
+// event loop.
+class ExitCodeHandler {
+ public:
+  // Notify the ExitCodeHandler that another process exists.
+  static void Start() {
+    // Multiple isolates could be starting processes at the same
+    // time. Make sure that only one ExitCodeHandler thread exists.
+    MonitorLocker locker(monitor_);
+    if (running_) {
+      return;
+    }
+
+    LOG_INFO("ExitCodeHandler Starting\n");
+
+    mx_status_t status = mx_socket_create(0, &interrupt_in_, &interrupt_out_);
+    if (status < 0) {
+      FATAL1("Failed to create exit code handler interrupt socket: %s\n",
+             mx_status_get_string(status));
+    }
+
+    // Start thread that handles process exits when wait returns.
+    intptr_t result =
+        Thread::Start(ExitCodeHandlerEntry, static_cast<uword>(interrupt_out_));
+    if (result != 0) {
+      FATAL1("Failed to start exit code handler worker thread %ld", result);
+    }
+
+    running_ = true;
+  }
+
+  static void Add(mx_handle_t process) {
+    MonitorLocker locker(monitor_);
+    LOG_INFO("ExitCodeHandler Adding Process: %ld\n", process);
+    SendMessage(Message::kAdd, process);
+  }
+
+  static void Terminate() {
+    MonitorLocker locker(monitor_);
+    if (!running_) {
+      return;
+    }
+    running_ = false;
+
+    LOG_INFO("ExitCodeHandler Terminating\n");
+    SendMessage(Message::kShutdown, MX_HANDLE_INVALID);
+
+    while (!terminate_done_) {
+      monitor_->Wait(Monitor::kNoTimeout);
+    }
+    mx_handle_close(interrupt_in_);
+    LOG_INFO("ExitCodeHandler Terminated\n");
+  }
+
+ private:
+  class Message {
+   public:
+    enum Command {
+      kAdd,
+      kShutdown,
+    };
+    Command command;
+    mx_handle_t handle;
+  };
+
+  static void SendMessage(Message::Command command, mx_handle_t handle) {
+    Message msg;
+    msg.command = command;
+    msg.handle = handle;
+    size_t actual;
+    mx_status_t status =
+        mx_socket_write(interrupt_in_, 0, &msg, sizeof(msg), &actual);
+    if (status < 0) {
+      FATAL1("Write to exit handler interrupt handle failed: %s\n",
+             mx_status_get_string(status));
+    }
+    ASSERT(actual == sizeof(msg));
+  }
+
+  // Entry point for the separate exit code handler thread started by
+  // the ExitCodeHandler.
+  static void ExitCodeHandlerEntry(uword param) {
+    LOG_INFO("ExitCodeHandler Entering ExitCodeHandler thread\n");
+    item_capacity_ = 16;
+    items_ = reinterpret_cast<mx_wait_item_t*>(
+        malloc(item_capacity_ * sizeof(*items_)));
+    items_to_remove_ = reinterpret_cast<intptr_t*>(
+        malloc(item_capacity_ * sizeof(*items_to_remove_)));
+
+    // The interrupt handle is fixed to the first entry.
+    items_[0].handle = interrupt_out_;
+    items_[0].waitfor = MX_SOCKET_READABLE | MX_SOCKET_PEER_CLOSED;
+    items_[0].pending = MX_SIGNAL_NONE;
+    item_count_ = 1;
+
+    while (!do_shutdown_) {
+      LOG_INFO("ExitCodeHandler Calling mx_handle_wait_many: %ld items\n",
+               item_count_);
+      mx_status_t status =
+          mx_handle_wait_many(items_, item_count_, MX_TIME_INFINITE);
+      if (status < 0) {
+        FATAL1("Exit code handler handle wait failed: %s\n",
+               mx_status_get_string(status));
+      }
+      LOG_INFO("ExitCodeHandler mx_handle_wait_many returned\n");
+
+      bool have_interrupt = false;
+      intptr_t remove_count = 0;
+      for (intptr_t i = 0; i < item_count_; i++) {
+        if (items_[i].pending == MX_SIGNAL_NONE) {
+          continue;
+        }
+        if (i == 0) {
+          LOG_INFO("ExitCodeHandler thread saw interrupt\n");
+          have_interrupt = true;
+          continue;
+        }
+        ASSERT(items_[i].waitfor == MX_TASK_TERMINATED);
+        ASSERT((items_[i].pending & MX_TASK_TERMINATED) != 0);
+        LOG_INFO("ExitCodeHandler signal for %ld\n", items_[i].handle);
+        SendProcessStatus(items_[i].handle);
+        items_to_remove_[remove_count++] = i;
+      }
+      for (intptr_t i = 0; i < remove_count; i++) {
+        RemoveItem(items_to_remove_[i]);
+      }
+      if (have_interrupt) {
+        HandleInterruptMsg();
+      }
+    }
+
+    LOG_INFO("ExitCodeHandler thread shutting down\n");
+    mx_handle_close(interrupt_out_);
+    free(items_);
+    items_ = NULL;
+    free(items_to_remove_);
+    items_to_remove_ = NULL;
+    item_count_ = 0;
+    item_capacity_ = 0;
+
+    terminate_done_ = true;
+    monitor_->Notify();
+  }
+
+  static void SendProcessStatus(mx_handle_t process) {
+    LOG_INFO("ExitCodeHandler thread getting process status: %ld\n", process);
+    mx_info_process_t proc_info;
+    mx_status_t status = mx_object_get_info(
+        process, MX_INFO_PROCESS, &proc_info, sizeof(proc_info), NULL, NULL);
+    if (status < 0) {
+      FATAL1("mx_object_get_info failed on process handle: %s\n",
+             mx_status_get_string(status));
+    }
+
+    const int return_code = proc_info.return_code;
+    status = mx_handle_close(process);
+    if (status < 0) {
+      FATAL1("Failed to close process handle: %s\n",
+             mx_status_get_string(status));
+    }
+    LOG_INFO("ExitCodeHandler thread process %ld exited with %d\n", process,
+             return_code);
+
+    const intptr_t exit_code_fd = ProcessInfoList::LookupProcessExitFd(process);
+    LOG_INFO("ExitCodeHandler thread sending %ld code %d on fd %ld\n", process,
+             return_code, exit_code_fd);
+    if (exit_code_fd != 0) {
+      int exit_message[2];
+      exit_message[0] = abs(return_code);
+      exit_message[1] = return_code >= 0 ? 0 : 1;
+      intptr_t result = FDUtils::WriteToBlocking(exit_code_fd, &exit_message,
+                                                 sizeof(exit_message));
+      ASSERT((result == -1) || (result == sizeof(exit_code_fd)));
+      if ((result == -1) && (errno != EPIPE)) {
+        int err = errno;
+        FATAL1("Failed to write exit code to pipe: %d\n", err);
+      }
+      LOG_INFO("ExitCodeHandler thread wrote %ld bytes to fd %ld\n", result,
+               exit_code_fd);
+      LOG_INFO("ExitCodeHandler thread removing process %ld from list\n",
+               process);
+      ProcessInfoList::RemoveProcess(process);
+    }
+  }
+
+  static void HandleInterruptMsg() {
+    ASSERT(items_[0].handle == interrupt_out_);
+    ASSERT(items_[0].waitfor == MX_SOCKET_READABLE);
+    ASSERT((items_[0].pending & MX_SOCKET_READABLE) != 0);
+    while (true) {
+      Message msg;
+      size_t actual = 0;
+      LOG_INFO("ExitCodeHandler thread reading interrupt message\n");
+      mx_status_t status =
+          mx_socket_read(interrupt_out_, 0, &msg, sizeof(msg), &actual);
+      if (status == ERR_SHOULD_WAIT) {
+        LOG_INFO("ExitCodeHandler thread done reading interrupt messages\n");
+        return;
+      }
+      if (status < 0) {
+        FATAL1("Failed to read exit handler interrupt handle: %s\n",
+               mx_status_get_string(status));
+      }
+      if (actual < sizeof(msg)) {
+        FATAL1("Short read from exit handler interrupt handle: %ld\n", actual);
+      }
+      switch (msg.command) {
+        case Message::kShutdown:
+          LOG_INFO("ExitCodeHandler thread got shutdown message\n");
+          do_shutdown_ = true;
+          break;
+        case Message::kAdd:
+          LOG_INFO("ExitCodeHandler thread got add message: %ld\n", msg.handle);
+          AddItem(msg.handle);
+          break;
+      }
+    }
+  }
+
+  static void AddItem(mx_handle_t h) {
+    if (item_count_ == item_capacity_) {
+      item_capacity_ = item_capacity_ + (item_capacity_ >> 1);
+      items_ =
+          reinterpret_cast<mx_wait_item_t*>(realloc(items_, item_capacity_));
+      items_to_remove_ = reinterpret_cast<intptr_t*>(
+          realloc(items_to_remove_, item_capacity_));
+    }
+    LOG_INFO("ExitCodeHandler thread adding item %ld at %ld\n", h, item_count_);
+    items_[item_count_].handle = h;
+    items_[item_count_].waitfor = MX_TASK_TERMINATED;
+    items_[item_count_].pending = MX_SIGNAL_NONE;
+    item_count_++;
+  }
+
+  static void RemoveItem(intptr_t idx) {
+    LOG_INFO("ExitCodeHandler thread removing item %ld at %ld\n",
+             items_[idx].handle, idx);
+    ASSERT(idx != 0);
+    const intptr_t last = item_count_ - 1;
+    items_[idx].handle = MX_HANDLE_INVALID;
+    items_[idx].waitfor = MX_SIGNAL_NONE;
+    items_[idx].pending = MX_SIGNAL_NONE;
+    if (idx != last) {
+      items_[idx] = items_[last];
+    }
+    item_count_--;
+  }
+
+  // Interrupt message pipe.
+  static mx_handle_t interrupt_in_;
+  static mx_handle_t interrupt_out_;
+
+  // Accessed only by the ExitCodeHandler thread.
+  static mx_wait_item_t* items_;
+  static intptr_t* items_to_remove_;
+  static intptr_t item_count_;
+  static intptr_t item_capacity_;
+
+  // Protected by monitor_.
+  static bool do_shutdown_;
+  static bool terminate_done_;
+  static bool running_;
+  static Monitor* monitor_;
+
+  DISALLOW_ALLOCATION();
+  DISALLOW_IMPLICIT_CONSTRUCTORS(ExitCodeHandler);
+};
+
+mx_handle_t ExitCodeHandler::interrupt_in_ = MX_HANDLE_INVALID;
+mx_handle_t ExitCodeHandler::interrupt_out_ = MX_HANDLE_INVALID;
+mx_wait_item_t* ExitCodeHandler::items_ = NULL;
+intptr_t* ExitCodeHandler::items_to_remove_ = NULL;
+intptr_t ExitCodeHandler::item_count_ = 0;
+intptr_t ExitCodeHandler::item_capacity_ = 0;
+
+bool ExitCodeHandler::do_shutdown_ = false;
+bool ExitCodeHandler::running_ = false;
+bool ExitCodeHandler::terminate_done_ = false;
+Monitor* ExitCodeHandler::monitor_ = new Monitor();
+
+void Process::TerminateExitCodeHandler() {
+  ExitCodeHandler::Terminate();
+}
+
 
 intptr_t Process::CurrentProcessId() {
-  UNIMPLEMENTED();
-  return 0;
-}
-
-intptr_t Process::SetSignalHandler(intptr_t signal) {
-  UNIMPLEMENTED();
-  return -1;
+  return static_cast<intptr_t>(getpid());
 }
 
 
-void Process::ClearSignalHandler(intptr_t signal) {
-  UNIMPLEMENTED();
+static bool ProcessWaitCleanup(intptr_t out,
+                               intptr_t err,
+                               intptr_t exit_event,
+                               intptr_t epoll_fd) {
+  int e = errno;
+  VOID_NO_RETRY_EXPECTED(close(out));
+  VOID_NO_RETRY_EXPECTED(close(err));
+  VOID_NO_RETRY_EXPECTED(close(exit_event));
+  VOID_NO_RETRY_EXPECTED(close(epoll_fd));
+  errno = e;
+  return false;
 }
 
+
 bool Process::Wait(intptr_t pid,
                    intptr_t in,
                    intptr_t out,
                    intptr_t err,
                    intptr_t exit_event,
                    ProcessResult* result) {
-  UNIMPLEMENTED();
-  return false;
+  VOID_NO_RETRY_EXPECTED(close(in));
+
+  // There is no return from this function using Dart_PropagateError
+  // as memory used by the buffer lists is freed through their
+  // destructors.
+  BufferList out_data;
+  BufferList err_data;
+  union {
+    uint8_t bytes[8];
+    int32_t ints[2];
+  } exit_code_data;
+
+  // The initial size passed to epoll_create is ignore on newer (>=
+  // 2.6.8) Linux versions
+  static const int kEpollInitialSize = 64;
+  int epoll_fd = NO_RETRY_EXPECTED(epoll_create(kEpollInitialSize));
+  if (epoll_fd == -1) {
+    return ProcessWaitCleanup(out, err, exit_event, epoll_fd);
+  }
+  if (!FDUtils::SetCloseOnExec(epoll_fd)) {
+    return ProcessWaitCleanup(out, err, exit_event, epoll_fd);
+  }
+
+  struct epoll_event event;
+  event.events = EPOLLRDHUP | EPOLLIN;
+  event.data.fd = out;
+  int status = NO_RETRY_EXPECTED(
+      epoll_ctl(epoll_fd, EPOLL_CTL_ADD, out, &event));
+  if (status == -1) {
+    return ProcessWaitCleanup(out, err, exit_event, epoll_fd);
+  }
+  event.data.fd = err;
+  status = NO_RETRY_EXPECTED(
+      epoll_ctl(epoll_fd, EPOLL_CTL_ADD, err, &event));
+  if (status == -1) {
+    return ProcessWaitCleanup(out, err, exit_event, epoll_fd);
+  }
+  event.data.fd = exit_event;
+  status = NO_RETRY_EXPECTED(
+      epoll_ctl(epoll_fd, EPOLL_CTL_ADD, exit_event, &event));
+  if (status == -1) {
+    return ProcessWaitCleanup(out, err, exit_event, epoll_fd);
+  }
+  intptr_t active = 3;
+
+  static const intptr_t kMaxEvents = 16;
+  struct epoll_event events[kMaxEvents];
+  while (active > 0) {
+    // TODO(US-109): When the epoll implementation is properly edge-triggered,
+    // remove this sleep, which prevents the message queue from being
+    // overwhelmed and leading to memory exhaustion.
+    usleep(5000);
+    intptr_t result = NO_RETRY_EXPECTED(
+        epoll_wait(epoll_fd, events, kMaxEvents, -1));
+    if ((result < 0) && (errno != EWOULDBLOCK)) {
+      return ProcessWaitCleanup(out, err, exit_event, epoll_fd);
+    }
+    for (intptr_t i = 0; i < result; i++) {
+      if ((events[i].events & EPOLLIN) != 0) {
+        const intptr_t avail = FDUtils::AvailableBytes(events[i].data.fd);
+        if (events[i].data.fd == out) {
+          if (!out_data.Read(out, avail)) {
+            return ProcessWaitCleanup(out, err, exit_event, epoll_fd);
+          }
+        } else if (events[i].data.fd == err) {
+          if (!err_data.Read(err, avail)) {
+            return ProcessWaitCleanup(out, err, exit_event, epoll_fd);
+          }
+        } else if (events[i].data.fd == exit_event) {
+          if (avail == 8) {
+            intptr_t b =
+                NO_RETRY_EXPECTED(read(exit_event, exit_code_data.bytes, 8));
+            if (b != 8) {
+              return ProcessWaitCleanup(out, err, exit_event, epoll_fd);
+            }
+          }
+        } else {
+          UNREACHABLE();
+        }
+      }
+      if ((events[i].events & (EPOLLHUP | EPOLLRDHUP)) != 0) {
+        NO_RETRY_EXPECTED(close(events[i].data.fd));
+        active--;
+        VOID_NO_RETRY_EXPECTED(
+            epoll_ctl(epoll_fd, EPOLL_CTL_DEL, events[i].data.fd, NULL));
+      }
+    }
+  }
+  VOID_NO_RETRY_EXPECTED(close(epoll_fd));
+
+  // All handles closed and all data read.
+  result->set_stdout_data(out_data.GetData());
+  result->set_stderr_data(err_data.GetData());
+  DEBUG_ASSERT(out_data.IsEmpty());
+  DEBUG_ASSERT(err_data.IsEmpty());
+
+  // Calculate the exit code.
+  intptr_t exit_code = exit_code_data.ints[0];
+  intptr_t negative = exit_code_data.ints[1];
+  if (negative != 0) {
+    exit_code = -exit_code;
+  }
+  result->set_exit_code(exit_code);
+
+  // Close the process handle.
+  mx_handle_t process = static_cast<mx_handle_t>(pid);
+  mx_handle_close(process);
+  return true;
 }
 
+
 bool Process::Kill(intptr_t id, int signal) {
-  UNIMPLEMENTED();
-  return false;
+  LOG_INFO("Sending signal %d to process with id %ld\n", signal, id);
+  // mx_task_kill is definitely going to kill the process.
+  if ((signal != SIGTERM) && (signal != SIGKILL)) {
+    LOG_ERR("Signal %d not supported\n", signal);
+    errno = ENOSYS;
+    return false;
+  }
+  // We can only use mx_task_kill if we know id is a process handle, and we only
+  // know that for sure if it's in our list.
+  mx_handle_t process = static_cast<mx_handle_t>(id);
+  if (!ProcessInfoList::Exists(process)) {
+    LOG_ERR("Process %ld wasn't in the ProcessInfoList\n", id);
+    errno = ESRCH;  // No such process.
+    return false;
+  }
+  mx_status_t status = mx_task_kill(process);
+  if (status != NO_ERROR) {
+    LOG_ERR("mx_task_kill failed: %s\n", mx_status_get_string(status));
+    errno = EPERM;  // TODO(zra): Figure out what it really should be.
+    return false;
+  }
+  LOG_INFO("Signal %d sent successfully to process %ld\n", signal, id);
+  return true;
 }
 
+
+class ProcessStarter {
+ public:
+  ProcessStarter(const char* path,
+                 char* arguments[],
+                 intptr_t arguments_length,
+                 const char* working_directory,
+                 char* environment[],
+                 intptr_t environment_length,
+                 ProcessStartMode mode,
+                 intptr_t* in,
+                 intptr_t* out,
+                 intptr_t* err,
+                 intptr_t* id,
+                 intptr_t* exit_event,
+                 char** os_error_message)
+      : path_(path),
+        working_directory_(working_directory),
+        mode_(mode),
+        in_(in),
+        out_(out),
+        err_(err),
+        id_(id),
+        exit_event_(exit_event),
+        os_error_message_(os_error_message) {
+    LOG_INFO("ProcessStarter: ctor %s with %ld args, mode = %d\n", path,
+             arguments_length, mode);
+
+    read_in_ = -1;
+    read_err_ = -1;
+    write_out_ = -1;
+
+    program_arguments_ = reinterpret_cast<char**>(Dart_ScopeAllocate(
+        (arguments_length + 2) * sizeof(*program_arguments_)));
+    program_arguments_[0] = const_cast<char*>(path_);
+    for (int i = 0; i < arguments_length; i++) {
+      program_arguments_[i + 1] = arguments[i];
+    }
+    program_arguments_[arguments_length + 1] = NULL;
+    program_arguments_count_ = arguments_length + 1;
+
+    program_environment_ = NULL;
+    if (environment != NULL) {
+      program_environment_ = reinterpret_cast<char**>(Dart_ScopeAllocate(
+          (environment_length + 1) * sizeof(*program_environment_)));
+      for (int i = 0; i < environment_length; i++) {
+        program_environment_[i] = environment[i];
+      }
+      program_environment_[environment_length] = NULL;
+    }
+
+    binary_vmo_ = MX_HANDLE_INVALID;
+    launchpad_ = NULL;
+  }
+
+  ~ProcessStarter() {
+    if (binary_vmo_ != MX_HANDLE_INVALID) {
+      mx_handle_close(binary_vmo_);
+    }
+    if (launchpad_ != NULL) {
+      launchpad_destroy(launchpad_);
+    }
+    if (read_in_ != -1) {
+      close(read_in_);
+    }
+    if (read_err_ != -1) {
+      close(read_err_);
+    }
+    if (write_out_ != -1) {
+      close(write_out_);
+    }
+  }
+
+  int Start() {
+    LOG_INFO("ProcessStarter: Start()\n");
+    int exit_pipe_fds[2];
+    intptr_t result = NO_RETRY_EXPECTED(pipe(exit_pipe_fds));
+    if (result != 0) {
+      *os_error_message_ = DartUtils::ScopedCopyCString(
+          "Failed to create exit code pipe for process start.");
+      return result;
+    }
+    LOG_INFO("ProcessStarter: Start() set up exit_pipe_fds (%d, %d)\n",
+             exit_pipe_fds[0], exit_pipe_fds[1]);
+
+    mx_status_t status = SetupLaunchpad();
+    if (status != NO_ERROR) {
+      close(exit_pipe_fds[0]);
+      close(exit_pipe_fds[1]);
+      return status;
+    }
+
+    LOG_INFO("ProcessStarter: Start() Calling launchpad_start\n");
+    mx_handle_t process = launchpad_start(launchpad_);
+    launchpad_destroy(launchpad_);
+    launchpad_ = NULL;
+    if (process < 0) {
+      LOG_INFO("ProcessStarter: Start() launchpad_start failed\n");
+      const intptr_t kMaxMessageSize = 256;
+      close(exit_pipe_fds[0]);
+      close(exit_pipe_fds[1]);
+      char* message = DartUtils::ScopedCString(kMaxMessageSize);
+      snprintf(message, kMaxMessageSize, "%s:%d: launchpad_start failed: %s\n",
+               __FILE__, __LINE__, mx_status_get_string(process));
+      *os_error_message_ = message;
+      return process;
+    }
+
+    LOG_INFO("ProcessStarter: Start() adding %ld to list with exit_pipe %d\n",
+             process, exit_pipe_fds[1]);
+    ProcessInfoList::AddProcess(process, exit_pipe_fds[1]);
+    ExitCodeHandler::Start();
+    ExitCodeHandler::Add(process);
+
+    *id_ = process;
+    FDUtils::SetNonBlocking(read_in_);
+    *in_ = read_in_;
+    read_in_ = -1;
+    FDUtils::SetNonBlocking(read_err_);
+    *err_ = read_err_;
+    read_err_ = -1;
+    FDUtils::SetNonBlocking(write_out_);
+    *out_ = write_out_;
+    write_out_ = -1;
+    FDUtils::SetNonBlocking(exit_pipe_fds[0]);
+    *exit_event_ = exit_pipe_fds[0];
+    return 0;
+  }
+
+ private:
+#define CHECK_FOR_ERROR(status, msg)                                           \
+  if (status < 0) {                                                            \
+    const intptr_t kMaxMessageSize = 256;                                      \
+    char* message = DartUtils::ScopedCString(kMaxMessageSize);                 \
+    snprintf(message, kMaxMessageSize, "%s:%d: %s: %s\n", __FILE__, __LINE__,  \
+             msg, mx_status_get_string(status));                               \
+    *os_error_message_ = message;                                              \
+    return status;                                                             \
+  }
+
+  mx_status_t SetupLaunchpad() {
+    mx_handle_t binary_vmo = launchpad_vmo_from_file(path_);
+    CHECK_FOR_ERROR(binary_vmo, "launchpad_vmo_from_file");
+    binary_vmo_ = binary_vmo;
+
+    launchpad_t* lp;
+    mx_status_t status;
+
+    mx_handle_t job = MX_HANDLE_INVALID;
+    status = mx_handle_duplicate(mx_job_default(), MX_RIGHT_SAME_RIGHTS, &job);
+    CHECK_FOR_ERROR(status, "mx_handle_duplicate");
+
+    status = launchpad_create(job, program_arguments_[0], &lp);
+    CHECK_FOR_ERROR(status, "launchpad_create");
+    launchpad_ = lp;
+
+    status =
+        launchpad_arguments(lp, program_arguments_count_, program_arguments_);
+    CHECK_FOR_ERROR(status, "launchpad_arguments");
+
+    status = launchpad_environ(lp, program_environment_);
+    CHECK_FOR_ERROR(status, "launchpad_environ");
+
+    // TODO(zra): Use the supplied working directory when launchpad adds an
+    // API to set it.
+
+    status = launchpad_clone_mxio_root(lp);
+    CHECK_FOR_ERROR(status, "launchpad_clone_mxio_root");
+
+    status = launchpad_add_pipe(lp, &write_out_, 0);
+    CHECK_FOR_ERROR(status, "launchpad_add_pipe");
+
+    status = launchpad_add_pipe(lp, &read_in_, 1);
+    CHECK_FOR_ERROR(status, "launchpad_add_pipe");
+
+    status = launchpad_add_pipe(lp, &read_err_, 2);
+    CHECK_FOR_ERROR(status, "launchpad_add_pipe");
+
+    status = launchpad_add_vdso_vmo(lp);
+    CHECK_FOR_ERROR(status, "launchpad_add_vdso_vmo");
+
+    status = launchpad_elf_load(lp, binary_vmo);
+    CHECK_FOR_ERROR(status, "launchpad_elf_load");
+    binary_vmo_ = MX_HANDLE_INVALID;  // launchpad_elf_load consumes the handle.
+
+    status = launchpad_load_vdso(lp, MX_HANDLE_INVALID);
+    CHECK_FOR_ERROR(status, "launchpad_load_vdso");
+
+    status = launchpad_clone_mxio_cwd(lp);
+    CHECK_FOR_ERROR(status, "launchpad_clone_mxio_cwd");
+
+    return NO_ERROR;
+  }
+
+#undef CHECK_FOR_ERROR
+
+  int read_in_;    // Pipe for stdout to child process.
+  int read_err_;   // Pipe for stderr to child process.
+  int write_out_;  // Pipe for stdin to child process.
+
+  char** program_arguments_;
+  intptr_t program_arguments_count_;
+  char** program_environment_;
+
+  mx_handle_t binary_vmo_;
+  launchpad_t* launchpad_;
+
+  const char* path_;
+  const char* working_directory_;
+  ProcessStartMode mode_;
+  intptr_t* in_;
+  intptr_t* out_;
+  intptr_t* err_;
+  intptr_t* id_;
+  intptr_t* exit_event_;
+  char** os_error_message_;
+
+  DISALLOW_ALLOCATION();
+  DISALLOW_IMPLICIT_CONSTRUCTORS(ProcessStarter);
+};
+
+
 int Process::Start(const char* path,
                    char* arguments[],
                    intptr_t arguments_length,
@@ -65,10 +822,28 @@
                    intptr_t* id,
                    intptr_t* exit_event,
                    char** os_error_message) {
+  if (mode != kNormal) {
+    *os_error_message = DartUtils::ScopedCopyCString(
+        "Only ProcessStartMode.NORMAL is supported on this platform");
+    return -1;
+  }
+  ProcessStarter starter(path, arguments, arguments_length, working_directory,
+                         environment, environment_length, mode, in, out, err,
+                         id, exit_event, os_error_message);
+  return starter.Start();
+}
+
+
+intptr_t Process::SetSignalHandler(intptr_t signal) {
   UNIMPLEMENTED();
   return -1;
 }
 
+
+void Process::ClearSignalHandler(intptr_t signal) {
+  UNIMPLEMENTED();
+}
+
 }  // namespace bin
 }  // namespace dart
 
diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc
index 22dc683..ae686e5 100644
--- a/runtime/bin/process_linux.cc
+++ b/runtime/bin/process_linux.cc
@@ -163,9 +163,12 @@
     // monitor.
     running_ = false;
 
-    // Fork to wake up waitpid.
+    // Wake up the [ExitCodeHandler] thread which is blocked on `wait()` (see
+    // [ExitCodeHandlerEntry]).
     if (TEMP_FAILURE_RETRY(fork()) == 0) {
-      exit(0);
+      // We avoid running through registered atexit() handlers because that is
+      // unnecessary work.
+      _exit(0);
     }
 
     monitor_->Notify();
@@ -679,7 +682,10 @@
                                strlen(os_error_message) + 1);
     }
     VOID_TEMP_FAILURE_RETRY(close(exec_control_[1]));
-    exit(1);
+
+    // We avoid running through registered atexit() handlers because that is
+    // unnecessary work.
+    _exit(1);
   }
 
 
@@ -768,36 +774,6 @@
 }
 
 
-class BufferList : public BufferListBase {
- public:
-  BufferList() {}
-
-  bool Read(int fd, intptr_t available) {
-    // Read all available bytes.
-    while (available > 0) {
-      if (free_size_ == 0) {
-        Allocate();
-      }
-      ASSERT(free_size_ > 0);
-      ASSERT(free_size_ <= kBufferSize);
-      intptr_t block_size = dart::Utils::Minimum(free_size_, available);
-      intptr_t bytes = TEMP_FAILURE_RETRY(
-          read(fd, reinterpret_cast<void*>(FreeSpaceAddress()), block_size));
-      if (bytes < 0) {
-        return false;
-      }
-      data_size_ += bytes;
-      free_size_ -= bytes;
-      available -= bytes;
-    }
-    return true;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(BufferList);
-};
-
-
 static bool CloseProcessBuffers(struct pollfd fds[3]) {
   int e = errno;
   VOID_TEMP_FAILURE_RETRY(close(fds[0].fd));
@@ -881,6 +857,8 @@
   // All handles closed and all data read.
   result->set_stdout_data(out_data.GetData());
   result->set_stderr_data(err_data.GetData());
+  DEBUG_ASSERT(out_data.IsEmpty());
+  DEBUG_ASSERT(err_data.IsEmpty());
 
   // Calculate the exit code.
   intptr_t exit_code = exit_code_data.ints[0];
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc
index 584968e..30035c5 100644
--- a/runtime/bin/process_macos.cc
+++ b/runtime/bin/process_macos.cc
@@ -784,36 +784,6 @@
 }
 
 
-class BufferList : public BufferListBase {
- public:
-  BufferList() {}
-
-  bool Read(int fd, intptr_t available) {
-    // Read all available bytes.
-    while (available > 0) {
-      if (free_size_ == 0) {
-        Allocate();
-      }
-      ASSERT(free_size_ > 0);
-      ASSERT(free_size_ <= kBufferSize);
-      size_t block_size = dart::Utils::Minimum(free_size_, available);
-      ssize_t bytes = TEMP_FAILURE_RETRY(
-          read(fd, reinterpret_cast<void*>(FreeSpaceAddress()), block_size));
-      if (bytes < 0) {
-        return false;
-      }
-      data_size_ += bytes;
-      free_size_ -= bytes;
-      available -= bytes;
-    }
-    return true;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(BufferList);
-};
-
-
 static bool CloseProcessBuffers(struct pollfd fds[3]) {
   int e = errno;
   VOID_TEMP_FAILURE_RETRY(close(fds[0].fd));
@@ -903,6 +873,8 @@
   // All handles closed and all data read.
   result->set_stdout_data(out_data.GetData());
   result->set_stderr_data(err_data.GetData());
+  DEBUG_ASSERT(out_data.IsEmpty());
+  DEBUG_ASSERT(err_data.IsEmpty());
 
   // Calculate the exit code.
   intptr_t exit_code = exit_code_data.ints[0];
diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc
index a2d93a4..c0cb06b 100644
--- a/runtime/bin/process_win.cc
+++ b/runtime/bin/process_win.cc
@@ -714,32 +714,35 @@
   // overlapped read.
   void DataIsRead(intptr_t size) {
     ASSERT(read_pending_ == true);
-    data_size_ += size;
-    free_size_ -= size;
-    ASSERT(free_size_ >= 0);
+    set_data_size(data_size() + size);
+    set_free_size(free_size() - size);
+    ASSERT(free_size() >= 0);
     read_pending_ = false;
   }
 
   // The access to the read buffer for overlapped read.
-  void GetReadBuffer(uint8_t** buffer, intptr_t* size) {
+  bool GetReadBuffer(uint8_t** buffer, intptr_t* size) {
     ASSERT(!read_pending_);
-    if (free_size_ == 0) {
-      Allocate();
+    if (free_size() == 0) {
+      if (!Allocate()) {
+        return false;
+      }
     }
-    ASSERT(free_size_ > 0);
-    ASSERT(free_size_ <= kBufferSize);
+    ASSERT(free_size() > 0);
+    ASSERT(free_size() <= kBufferSize);
     *buffer = FreeSpaceAddress();
-    *size = free_size_;
+    *size = free_size();
     read_pending_ = true;
+    return true;
   }
 
-  intptr_t GetDataSize() { return data_size_; }
+  intptr_t GetDataSize() { return data_size(); }
 
   uint8_t* GetFirstDataBuffer() {
-    ASSERT(head_ != NULL);
-    ASSERT(head_ == tail_);
-    ASSERT(data_size_ <= kBufferSize);
-    return head_->data_;
+    ASSERT(head() != NULL);
+    ASSERT(head() == tail());
+    ASSERT(data_size() <= kBufferSize);
+    return head()->data();
   }
 
   void FreeDataBuffer() { Free(); }
@@ -776,7 +779,9 @@
       ClearOverlapped();
       uint8_t* buffer;
       intptr_t buffer_size;
-      buffer_.GetReadBuffer(&buffer, &buffer_size);
+      if (!buffer_.GetReadBuffer(&buffer, &buffer_size)) {
+        return false;
+      }
       BOOL ok = ReadFile(handle_, buffer, buffer_size, NULL, &overlapped_);
       if (!ok) {
         return (GetLastError() == ERROR_IO_PENDING);
@@ -793,6 +798,10 @@
 
   void FreeDataBuffer() { return buffer_.FreeDataBuffer(); }
 
+#if defined(DEBUG)
+  bool IsEmpty() const { return buffer_.IsEmpty(); }
+#endif
+
   void Close() {
     CloseHandle(handle_);
     CloseHandle(event_);
@@ -882,6 +891,8 @@
   // All handles closed and all data read.
   result->set_stdout_data(oh[0].GetData());
   result->set_stderr_data(oh[1].GetData());
+  DEBUG_ASSERT(oh[0].IsEmpty());
+  DEBUG_ASSERT(oh[1].IsEmpty());
 
   // Calculate the exit code.
   ASSERT(oh[2].GetDataSize() == 8);
diff --git a/runtime/bin/run_vm_tests.cc b/runtime/bin/run_vm_tests.cc
index 3f621fe..c6e11b4 100644
--- a/runtime/bin/run_vm_tests.cc
+++ b/runtime/bin/run_vm_tests.cc
@@ -19,9 +19,10 @@
 // Defined in vm/os_thread_win.cc
 extern bool private_flag_windows_run_tls_destructors;
 
-// vm_isolate_snapshot_buffer points to a snapshot for the vm isolate if we
+// vm_snapshot_data_buffer points to a snapshot for the vm isolate if we
 // link in a snapshot otherwise it is initialized to NULL.
-extern const uint8_t* bin::vm_isolate_snapshot_buffer;
+extern const uint8_t* bin::vm_snapshot_data;
+extern const uint8_t* bin::vm_snapshot_instructions;
 
 // Only run tests that match the filter string. The default does not match any
 // tests.
@@ -108,10 +109,10 @@
       Flags::ProcessCommandLineFlags(dart_argc, dart_argv);
   ASSERT(set_vm_flags_success);
   const char* err_msg = Dart::InitOnce(
-      dart::bin::vm_isolate_snapshot_buffer, NULL, NULL, NULL, NULL, NULL,
-      dart::bin::DartUtils::OpenFile, dart::bin::DartUtils::ReadFile,
-      dart::bin::DartUtils::WriteFile, dart::bin::DartUtils::CloseFile, NULL,
-      NULL);
+      dart::bin::vm_snapshot_data, dart::bin::vm_snapshot_instructions, NULL,
+      NULL, NULL, dart::bin::DartUtils::OpenFile,
+      dart::bin::DartUtils::ReadFile, dart::bin::DartUtils::WriteFile,
+      dart::bin::DartUtils::CloseFile, NULL, NULL);
   ASSERT(err_msg == NULL);
   // Apply the filter to all registered tests.
   TestCaseBase::RunAll();
diff --git a/runtime/bin/run_vm_tests_fuchsia.cc b/runtime/bin/run_vm_tests_fuchsia.cc
index 71cf5c3..da8e19c 100644
--- a/runtime/bin/run_vm_tests_fuchsia.cc
+++ b/runtime/bin/run_vm_tests_fuchsia.cc
@@ -32,17 +32,9 @@
   "Read",
   "FileLength",
   "FilePosition",
-  // Crash in abort() and then hang. (MG-252)
-  "ArrayLengthMaxElements",
-  "Int8ListLengthMaxElements",
-  "ArrayNew_Overflow_Crash",
-  "SNPrint_BadArgs",
-  "IsolateReload_PendingUnqualifiedCall_InstanceToStatic",
-  "IsolateReload_PendingUnqualifiedCall_StaticToInstance",
-  "IsolateReload_PendingConstructorCall_AbstractToConcrete",
-  "IsolateReload_PendingConstructorCall_ConcreteToAbstract",
-  "IsolateReload_PendingStaticCall_DefinedToNSM",
-  "IsolateReload_PendingStaticCall_NSMToDefined",
+  // No realpath, files not in image.
+  "Dart2JSCompilerStats",
+  "Dart2JSCompileAll",
   // The profiler is turned off.
   "Profiler_AllocationSampleTest",
   "Profiler_ArrayAllocation",
@@ -69,27 +61,6 @@
   "Profiler_TypedArrayAllocation",
   "Profiler_GetSourceReport",
   "Service_Profile",
-  // No realpath, files not in image.
-  "Dart2JSCompilerStats",
-  "Dart2JSCompileAll",
-  // Uses too much memory.
-  "PrintJSON",
-  // Need OS::GetCurrentThreadCPUMicros.
-  // Skipping because they crash and hang. (MG-252)
-  "Timeline_Dart_TimelineGetTrace",
-  "Timeline_Dart_TimelineGetTraceOnlyDartEvents",
-  "Timeline_Dart_TimelineGetTraceWithDartEvents",
-  "Timeline_Dart_TimelineGetTraceGlobalOverride",
-  "Timeline_Dart_GlobalTimelineGetTrace",
-  "Timeline_Dart_GlobalTimelineGetTrace_Threaded",
-  "TimelineEventDuration",
-  "TimelineEventDurationPrintJSON",
-  "TimelineEventArguments",
-  "TimelineEventArgumentsPrintJSON",
-  "TimelineEventCallbackRecorderBasic",
-  "TimelineAnalysis_ThreadBlockCount",
-  "TimelineRingRecorderJSONOrder",
-  "TimelinePauses_BeginEnd",
 };
 
 // Expected to fail/crash.
@@ -99,14 +70,20 @@
   "Fail2",
   "AllocGeneric_Overflow",
   "CodeImmutability",
-  // Assumes initial thread's stack is the same size as spawned thread stacks.
-  "StackOverflowStacktraceInfo",
+  "IsolateReload_PendingUnqualifiedCall_StaticToInstance",
+  "IsolateReload_PendingConstructorCall_AbstractToConcrete",
+  "IsolateReload_PendingConstructorCall_ConcreteToAbstract",
+  "IsolateReload_PendingUnqualifiedCall_InstanceToStatic",
+  "IsolateReload_PendingStaticCall_DefinedToNSM",
+  "IsolateReload_PendingStaticCall_NSMToDefined",
+  "ArrayNew_Overflow_Crash",
+  "SNPrint_BadArgs",
 };
 
 // Bugs to fix, or things that are not yet implemented.
 const char* kBugs[] = {
-  // Needs read of RSS.
-  "InitialRSS",
+  // Assumes initial thread's stack is the same size as spawned thread stacks.
+  "StackOverflowStackTraceInfo",
 };
 // clang-format on
 
@@ -156,7 +133,10 @@
   }
   launchpad_t* lp;
   mx_status_t status;
-  status = launchpad_create(0, argv[0], &lp);
+  mx_handle_t job = MX_HANDLE_INVALID;
+  status = mx_handle_duplicate(mx_job_default(), MX_RIGHT_SAME_RIGHTS, &job);
+  RETURN_IF_ERROR(status);
+  status = launchpad_create(job, argv[0], &lp);
   RETURN_IF_ERROR(status);
   status = launchpad_arguments(lp, argc, argv);
   RETURN_IF_ERROR(status);
@@ -272,7 +252,7 @@
   drain_fd(stderr_pipe, test_stderr);
 
   mx_status_t r =
-      mx_handle_wait_one(p, MX_SIGNAL_SIGNALED, MX_TIME_INFINITE, NULL);
+      mx_handle_wait_one(p, MX_PROCESS_SIGNALED, MX_TIME_INFINITE, NULL);
   RETURN_IF_ERROR(r);
 
   mx_info_process_t proc_info;
diff --git a/runtime/bin/secure_socket_boringssl.cc b/runtime/bin/secure_socket_boringssl.cc
index 90d22fb..280d1f7 100644
--- a/runtime/bin/secure_socket_boringssl.cc
+++ b/runtime/bin/secure_socket_boringssl.cc
@@ -55,6 +55,17 @@
 Mutex* SSLFilter::mutex_ = new Mutex();
 int SSLFilter::filter_ssl_index;
 
+const intptr_t SSLFilter::kInternalBIOSize = 10 * KB;
+const intptr_t SSLFilter::kApproximateSize =
+    sizeof(SSLFilter) + (2 * SSLFilter::kInternalBIOSize);
+
+// The security context won't necessarily use the compiled-in root certificates,
+// but since there is no way to update the size of the allocation after creating
+// the weak persistent handle, we assume that it will. Note that when the
+// root certs aren't compiled in, |root_certificates_pem_length| is 0.
+const intptr_t SSLContext::kApproximateSize =
+    sizeof(SSLContext) + root_certificates_pem_length;
+
 static const int kSSLFilterNativeFieldIndex = 0;
 static const int kSecurityContextNativeFieldIndex = 0;
 static const int kX509NativeFieldIndex = 0;
@@ -64,11 +75,9 @@
 
 static const int SSL_ERROR_MESSAGE_BUFFER_SIZE = 1000;
 
-
 const char* commandline_root_certs_file = NULL;
 const char* commandline_root_certs_cache = NULL;
 
-
 /* Get the error messages from BoringSSL, and put them in buffer as a
  * null-terminated string. */
 static void FetchErrorString(char* buffer, int length) {
@@ -141,7 +150,7 @@
                                   reinterpret_cast<intptr_t>(filter));
   RETURN_IF_ERROR(err);
   Dart_NewWeakPersistentHandle(dart_this, reinterpret_cast<void*>(filter),
-                               sizeof(*filter), DeleteFilter);
+                               SSLFilter::kApproximateSize, DeleteFilter);
   return Dart_Null();
 }
 
@@ -167,7 +176,6 @@
 
 static Dart_Handle SetSecurityContext(Dart_NativeArguments args,
                                       SSLContext* context) {
-  const int approximate_size_of_context = 1500;
   Dart_Handle dart_this = Dart_GetNativeArgument(args, 0);
   RETURN_IF_ERROR(dart_this);
   ASSERT(Dart_IsInstance(dart_this));
@@ -175,7 +183,7 @@
       Dart_SetNativeInstanceField(dart_this, kSecurityContextNativeFieldIndex,
                                   reinterpret_cast<intptr_t>(context));
   RETURN_IF_ERROR(err);
-  Dart_NewWeakPersistentHandle(dart_this, context, approximate_size_of_context,
+  Dart_NewWeakPersistentHandle(dart_this, context, SSLContext::kApproximateSize,
                                DeleteSecurityContext);
   return Dart_Null();
 }
@@ -330,11 +338,16 @@
 }
 
 
+static intptr_t EstimateX509Size(X509* certificate) {
+  intptr_t length = i2d_X509(certificate, NULL);
+  return length > 0 ? length : 0;
+}
+
+
 // Returns the handle for a Dart object wrapping the X509 certificate object.
 // The caller should own a reference to the X509 object whose reference count
 // won't drop to zero before the ReleaseCertificate finalizer runs.
 static Dart_Handle WrappedX509Certificate(X509* certificate) {
-  const intptr_t approximate_size_of_certificate = 1500;
   if (certificate == NULL) {
     return Dart_Null();
   }
@@ -358,6 +371,9 @@
     X509_free(certificate);
     return status;
   }
+  const intptr_t approximate_size_of_certificate =
+      sizeof(*certificate) + EstimateX509Size(certificate);
+  ASSERT(approximate_size_of_certificate > 0);
   Dart_NewWeakPersistentHandle(result, reinterpret_cast<void*>(certificate),
                                approximate_size_of_certificate,
                                ReleaseCertificate);
@@ -1496,7 +1512,8 @@
   int status;
   int error;
   BIO* ssl_side;
-  status = BIO_new_bio_pair(&ssl_side, 10000, &socket_side_, 10000);
+  status = BIO_new_bio_pair(&ssl_side, kInternalBIOSize, &socket_side_,
+                            kInternalBIOSize);
   CheckStatus(status, "TlsException", "BIO_new_bio_pair");
 
   assert(context != NULL);
@@ -1505,10 +1522,6 @@
   SSL_set_mode(ssl_, SSL_MODE_AUTO_RETRY);  // TODO(whesse): Is this right?
   SSL_set_ex_data(ssl_, filter_ssl_index, this);
 
-#if defined(TARGET_OS_FUCHSIA)
-  // Temporary workaround until we isolate the memory leak issue.
-  SSL_set_verify(ssl_, SSL_VERIFY_NONE, NULL);
-#else
   if (is_server_) {
     int certificate_mode =
         request_client_certificate ? SSL_VERIFY_PEER : SSL_VERIFY_NONE;
@@ -1533,7 +1546,6 @@
     CheckStatus(status, "TlsException",
                 "Set hostname for certificate checking");
   }
-#endif  // defined(TARGET_OS_FUCHSIA)
   // Make the connection:
   if (is_server_) {
     status = SSL_accept(ssl_);
diff --git a/runtime/bin/secure_socket_boringssl.h b/runtime/bin/secure_socket_boringssl.h
index a24194a..974a57e 100644
--- a/runtime/bin/secure_socket_boringssl.h
+++ b/runtime/bin/secure_socket_boringssl.h
@@ -35,6 +35,8 @@
 
 class SSLContext {
  public:
+  static const intptr_t kApproximateSize;
+
   explicit SSLContext(SSL_CTX* context)
       : context_(context), alpn_protocol_string_(NULL) {}
 
@@ -81,6 +83,8 @@
     kFirstEncrypted = kReadEncrypted
   };
 
+  static const intptr_t kApproximateSize;
+
   SSLFilter()
       : callback_error(NULL),
         ssl_(NULL),
@@ -133,6 +137,7 @@
   BIO* socket_side_;
 
  private:
+  static const intptr_t kInternalBIOSize;
   static bool library_initialized_;
   static Mutex* mutex_;  // To protect library initialization.
 
diff --git a/runtime/bin/snapshot_empty.cc b/runtime/bin/snapshot_empty.cc
index bab9212..6508bd9 100644
--- a/runtime/bin/snapshot_empty.cc
+++ b/runtime/bin/snapshot_empty.cc
@@ -16,8 +16,10 @@
 namespace dart {
 namespace bin {
 
-const uint8_t* vm_isolate_snapshot_buffer = NULL;
-const uint8_t* isolate_snapshot_buffer = NULL;
+const uint8_t* vm_snapshot_data = NULL;
+const uint8_t* vm_snapshot_instructions = NULL;
+const uint8_t* core_isolate_snapshot_data = NULL;
+const uint8_t* core_isolate_snapshot_instructions = NULL;
 
 }  // namespace bin
 }  // namespace dart
diff --git a/runtime/bin/snapshot_in.cc b/runtime/bin/snapshot_in.cc
index 1f63a86..8445c20 100644
--- a/runtime/bin/snapshot_in.cc
+++ b/runtime/bin/snapshot_in.cc
@@ -22,20 +22,22 @@
 // generated snapshot binary file for the vm isolate.
 // This string forms the content of a vm isolate snapshot which is loaded
 // into the vm isolate.
-static const uint8_t vm_isolate_snapshot_buffer_[] = {
+static const uint8_t vm_snapshot_data_[] = {
   %s
 };
-const uint8_t* vm_isolate_snapshot_buffer = vm_isolate_snapshot_buffer_;
+const uint8_t* vm_snapshot_data = vm_snapshot_data_;
+const uint8_t* vm_snapshot_instructions = NULL;
 
 
 // The string on the next line will be filled in with the contents of the
 // generated snapshot binary file for a regular dart isolate.
 // This string forms the content of a regular dart isolate snapshot which is
 // loaded into an isolate when it is created.
-static const uint8_t isolate_snapshot_buffer_[] = {
+static const uint8_t core_isolate_snapshot_data_[] = {
   %s
 };
-const uint8_t* isolate_snapshot_buffer = isolate_snapshot_buffer_;
+const uint8_t* core_isolate_snapshot_data = core_isolate_snapshot_data_;
+const uint8_t* core_isolate_snapshot_instructions = NULL;
 
 }  // namespace bin
 }  // namespace dart
diff --git a/runtime/bin/socket.cc b/runtime/bin/socket.cc
index d520572..cbb9a2c 100644
--- a/runtime/bin/socket.cc
+++ b/runtime/bin/socket.cc
@@ -196,7 +196,8 @@
 }
 
 
-bool ListeningSocketRegistry::CloseOneSafe(OSSocket* os_socket) {
+bool ListeningSocketRegistry::CloseOneSafe(OSSocket* os_socket,
+                                           bool update_hash_maps) {
   ASSERT(!mutex_->TryLock());
   ASSERT(os_socket != NULL);
   ASSERT(os_socket->ref_count > 0);
@@ -204,26 +205,28 @@
   if (os_socket->ref_count > 0) {
     return false;
   }
-  // We free the OS socket by removing it from two datastructures.
-  RemoveByFd(os_socket->socketfd);
+  if (update_hash_maps) {
+    // We free the OS socket by removing it from two datastructures.
+    RemoveByFd(os_socket->socketfd);
 
-  OSSocket* prev = NULL;
-  OSSocket* current = LookupByPort(os_socket->port);
-  while (current != os_socket) {
-    ASSERT(current != NULL);
-    prev = current;
-    current = current->next;
-  }
+    OSSocket* prev = NULL;
+    OSSocket* current = LookupByPort(os_socket->port);
+    while (current != os_socket) {
+      ASSERT(current != NULL);
+      prev = current;
+      current = current->next;
+    }
 
-  if ((prev == NULL) && (current->next == NULL)) {
-    // Remove last element from the list.
-    RemoveByPort(os_socket->port);
-  } else if (prev == NULL) {
-    // Remove first element of the list.
-    InsertByPort(os_socket->port, current->next);
-  } else {
-    // Remove element from the list which is not the first one.
-    prev->next = os_socket->next;
+    if ((prev == NULL) && (current->next == NULL)) {
+      // Remove last element from the list.
+      RemoveByPort(os_socket->port);
+    } else if (prev == NULL) {
+      // Remove first element of the list.
+      InsertByPort(os_socket->port, current->next);
+    } else {
+      // Remove element from the list which is not the first one.
+      prev->next = os_socket->next;
+    }
   }
 
   ASSERT(os_socket->ref_count == 0);
@@ -234,9 +237,10 @@
 
 void ListeningSocketRegistry::CloseAllSafe() {
   MutexLocker ml(mutex_);
-  for (HashMap::Entry* p = sockets_by_fd_.Start(); p != NULL;
-       p = sockets_by_fd_.Next(p)) {
-    CloseOneSafe(reinterpret_cast<OSSocket*>(p->value));
+
+  for (HashMap::Entry* cursor = sockets_by_fd_.Start(); cursor != NULL;
+       cursor = sockets_by_fd_.Next(cursor)) {
+    CloseOneSafe(reinterpret_cast<OSSocket*>(cursor->value), false);
   }
 }
 
@@ -245,7 +249,7 @@
   ASSERT(!mutex_->TryLock());
   OSSocket* os_socket = LookupByFd(socketfd);
   if (os_socket != NULL) {
-    return CloseOneSafe(os_socket);
+    return CloseOneSafe(os_socket, true);
   } else {
     // It should be impossible for the event handler to close something that
     // hasn't been created before.
diff --git a/runtime/bin/socket.h b/runtime/bin/socket.h
index 35d4acc..1afc05e 100644
--- a/runtime/bin/socket.h
+++ b/runtime/bin/socket.h
@@ -469,7 +469,7 @@
   void InsertByFd(intptr_t fd, OSSocket* socket);
   void RemoveByFd(intptr_t fd);
 
-  bool CloseOneSafe(OSSocket* os_socket);
+  bool CloseOneSafe(OSSocket* os_socket, bool update_hash_maps);
   void CloseAllSafe();
 
   HashMap sockets_by_port_;
diff --git a/runtime/bin/socket_fuchsia.cc b/runtime/bin/socket_fuchsia.cc
index 2443ee3..b82b723 100644
--- a/runtime/bin/socket_fuchsia.cc
+++ b/runtime/bin/socket_fuchsia.cc
@@ -137,7 +137,9 @@
 
 
 intptr_t Socket::Available(intptr_t fd) {
-  return FDUtils::AvailableBytes(fd);
+  intptr_t available = FDUtils::AvailableBytes(fd);
+  LOG_INFO("Socket::Available(%ld) = %ld\n", fd, available);
+  return available;
 }
 
 
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index cd02b29..c11cec1 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -669,7 +669,8 @@
     var result =
         nativeWrite(bufferAndStart.buffer, bufferAndStart.start, bytes);
     if (result is OSError) {
-      scheduleMicrotask(() => reportError(result, "Write failed"));
+      OSError osError = result;
+      scheduleMicrotask(() => reportError(osError, "Write failed"));
       result = 0;
     }
     // The result may be negative, if we forced a short write for testing
@@ -699,7 +700,8 @@
         bufferAndStart.buffer, bufferAndStart.start, bytes,
         address._in_addr, port);
     if (result is OSError) {
-      scheduleMicrotask(() => reportError(result, "Send failed"));
+      OSError osError = result;
+      scheduleMicrotask(() => reportError(osError, "Send failed"));
       result = 0;
     }
     // TODO(ricow): Remove when we track internal and pipe uses.
diff --git a/runtime/bin/stdio.cc b/runtime/bin/stdio.cc
index 47bd554..aa1c7c2 100644
--- a/runtime/bin/stdio.cc
+++ b/runtime/bin/stdio.cc
@@ -20,29 +20,52 @@
 
 void FUNCTION_NAME(Stdin_ReadByte)(Dart_NativeArguments args) {
   ScopedBlockingCall blocker;
-  Dart_SetReturnValue(args, Dart_NewInteger(Stdin::ReadByte()));
+  int byte = -1;
+  if (Stdin::ReadByte(&byte)) {
+    Dart_SetReturnValue(args, Dart_NewInteger(byte));
+  } else {
+    Dart_SetReturnValue(args, DartUtils::NewDartOSError());
+  }
 }
 
 
 void FUNCTION_NAME(Stdin_GetEchoMode)(Dart_NativeArguments args) {
-  Dart_SetReturnValue(args, Dart_NewBoolean(Stdin::GetEchoMode()));
+  bool enabled = false;
+  if (Stdin::GetEchoMode(&enabled)) {
+    Dart_SetReturnValue(args, Dart_NewBoolean(enabled));
+  } else {
+    Dart_SetReturnValue(args, DartUtils::NewDartOSError());
+  }
 }
 
 
 void FUNCTION_NAME(Stdin_SetEchoMode)(Dart_NativeArguments args) {
   bool enabled = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 0));
-  Stdin::SetEchoMode(enabled);
+  if (Stdin::SetEchoMode(enabled)) {
+    Dart_SetReturnValue(args, Dart_True());
+  } else {
+    Dart_SetReturnValue(args, DartUtils::NewDartOSError());
+  }
 }
 
 
 void FUNCTION_NAME(Stdin_GetLineMode)(Dart_NativeArguments args) {
-  Dart_SetReturnValue(args, Dart_NewBoolean(Stdin::GetLineMode()));
+  bool enabled = false;
+  if (Stdin::GetLineMode(&enabled)) {
+    Dart_SetReturnValue(args, Dart_NewBoolean(enabled));
+  } else {
+    Dart_SetReturnValue(args, DartUtils::NewDartOSError());
+  }
 }
 
 
 void FUNCTION_NAME(Stdin_SetLineMode)(Dart_NativeArguments args) {
   bool enabled = DartUtils::GetBooleanValue(Dart_GetNativeArgument(args, 0));
-  Stdin::SetLineMode(enabled);
+  if (Stdin::SetLineMode(enabled)) {
+    Dart_SetReturnValue(args, Dart_True());
+  } else {
+    Dart_SetReturnValue(args, DartUtils::NewDartOSError());
+  }
 }
 
 
diff --git a/runtime/bin/stdio.h b/runtime/bin/stdio.h
index 9bf079a..56b5914 100644
--- a/runtime/bin/stdio.h
+++ b/runtime/bin/stdio.h
@@ -19,13 +19,13 @@
 
 class Stdin {
  public:
-  static int ReadByte();
+  static bool ReadByte(int* byte);
 
-  static bool GetEchoMode();
-  static void SetEchoMode(bool enabled);
+  static bool GetEchoMode(bool* enabled);
+  static bool SetEchoMode(bool enabled);
 
-  static bool GetLineMode();
-  static void SetLineMode(bool enabled);
+  static bool GetLineMode(bool* enabled);
+  static bool SetLineMode(bool enabled);
 
  private:
   DISALLOW_ALLOCATION();
diff --git a/runtime/bin/stdio_android.cc b/runtime/bin/stdio_android.cc
index 35d83e5..fbf1d76 100644
--- a/runtime/bin/stdio_android.cc
+++ b/runtime/bin/stdio_android.cc
@@ -19,50 +19,67 @@
 namespace dart {
 namespace bin {
 
-int Stdin::ReadByte() {
-  int c = getchar();
-  if (c == EOF) {
-    c = -1;
+bool Stdin::ReadByte(int* byte) {
+  int c = NO_RETRY_EXPECTED(getchar());
+  if ((c == EOF) && (errno != 0)) {
+    return false;
   }
-  return c;
+  *byte = (c == EOF) ? -1 : c;
+  return true;
 }
 
 
-bool Stdin::GetEchoMode() {
+bool Stdin::GetEchoMode(bool* enabled) {
   struct termios term;
-  tcgetattr(STDIN_FILENO, &term);
-  return ((term.c_lflag & ECHO) != 0);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
+  *enabled = ((term.c_lflag & ECHO) != 0);
+  return true;
 }
 
 
-void Stdin::SetEchoMode(bool enabled) {
+bool Stdin::SetEchoMode(bool enabled) {
   struct termios term;
-  tcgetattr(STDIN_FILENO, &term);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
   if (enabled) {
     term.c_lflag |= (ECHO | ECHONL);
   } else {
     term.c_lflag &= ~(ECHO | ECHONL);
   }
-  tcsetattr(STDIN_FILENO, TCSANOW, &term);
+  status = NO_RETRY_EXPECTED(tcsetattr(STDIN_FILENO, TCSANOW, &term));
+  return (status == 0);
 }
 
 
-bool Stdin::GetLineMode() {
+bool Stdin::GetLineMode(bool* enabled) {
   struct termios term;
-  tcgetattr(STDIN_FILENO, &term);
-  return ((term.c_lflag & ICANON) != 0);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
+  *enabled = ((term.c_lflag & ICANON) != 0);
+  return true;
 }
 
 
-void Stdin::SetLineMode(bool enabled) {
+bool Stdin::SetLineMode(bool enabled) {
   struct termios term;
-  tcgetattr(STDIN_FILENO, &term);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
   if (enabled) {
     term.c_lflag |= ICANON;
   } else {
     term.c_lflag &= ~(ICANON);
   }
-  tcsetattr(STDIN_FILENO, TCSANOW, &term);
+  status = NO_RETRY_EXPECTED(tcsetattr(STDIN_FILENO, TCSANOW, &term));
+  return (status == 0);
 }
 
 
diff --git a/runtime/bin/stdio_fuchsia.cc b/runtime/bin/stdio_fuchsia.cc
index e297499..8b77fbc 100644
--- a/runtime/bin/stdio_fuchsia.cc
+++ b/runtime/bin/stdio_fuchsia.cc
@@ -12,31 +12,33 @@
 namespace dart {
 namespace bin {
 
-int Stdin::ReadByte() {
-  UNIMPLEMENTED();
-  return -1;
-}
-
-
-bool Stdin::GetEchoMode() {
+bool Stdin::ReadByte(int* byte) {
   UNIMPLEMENTED();
   return false;
 }
 
 
-void Stdin::SetEchoMode(bool enabled) {
-  UNIMPLEMENTED();
-}
-
-
-bool Stdin::GetLineMode() {
+bool Stdin::GetEchoMode(bool* enabled) {
   UNIMPLEMENTED();
   return false;
 }
 
 
-void Stdin::SetLineMode(bool enabled) {
+bool Stdin::SetEchoMode(bool enabled) {
   UNIMPLEMENTED();
+  return false;
+}
+
+
+bool Stdin::GetLineMode(bool* enabled) {
+  UNIMPLEMENTED();
+  return false;
+}
+
+
+bool Stdin::SetLineMode(bool enabled) {
+  UNIMPLEMENTED();
+  return false;
 }
 
 
diff --git a/runtime/bin/stdio_linux.cc b/runtime/bin/stdio_linux.cc
index 280c75f..dd61fae 100644
--- a/runtime/bin/stdio_linux.cc
+++ b/runtime/bin/stdio_linux.cc
@@ -19,50 +19,67 @@
 namespace dart {
 namespace bin {
 
-int Stdin::ReadByte() {
+bool Stdin::ReadByte(int* byte) {
   int c = NO_RETRY_EXPECTED(getchar());
-  if (c == EOF) {
-    c = -1;
+  if ((c == EOF) && (errno != 0)) {
+    return false;
   }
-  return c;
+  *byte = (c == EOF) ? -1 : c;
+  return true;
 }
 
 
-bool Stdin::GetEchoMode() {
+bool Stdin::GetEchoMode(bool* enabled) {
   struct termios term;
-  VOID_NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
-  return ((term.c_lflag & ECHO) != 0);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
+  *enabled = ((term.c_lflag & ECHO) != 0);
+  return true;
 }
 
 
-void Stdin::SetEchoMode(bool enabled) {
+bool Stdin::SetEchoMode(bool enabled) {
   struct termios term;
-  VOID_NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
   if (enabled) {
     term.c_lflag |= (ECHO | ECHONL);
   } else {
     term.c_lflag &= ~(ECHO | ECHONL);
   }
-  VOID_NO_RETRY_EXPECTED(tcsetattr(STDIN_FILENO, TCSANOW, &term));
+  status = NO_RETRY_EXPECTED(tcsetattr(STDIN_FILENO, TCSANOW, &term));
+  return (status == 0);
 }
 
 
-bool Stdin::GetLineMode() {
+bool Stdin::GetLineMode(bool* enabled) {
   struct termios term;
-  VOID_NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
-  return ((term.c_lflag & ICANON) != 0);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
+  *enabled = ((term.c_lflag & ICANON) != 0);
+  return true;
 }
 
 
-void Stdin::SetLineMode(bool enabled) {
+bool Stdin::SetLineMode(bool enabled) {
   struct termios term;
-  VOID_NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
   if (enabled) {
     term.c_lflag |= ICANON;
   } else {
     term.c_lflag &= ~(ICANON);
   }
-  VOID_NO_RETRY_EXPECTED(tcsetattr(STDIN_FILENO, TCSANOW, &term));
+  status = NO_RETRY_EXPECTED(tcsetattr(STDIN_FILENO, TCSANOW, &term));
+  return (status == 0);
 }
 
 
diff --git a/runtime/bin/stdio_macos.cc b/runtime/bin/stdio_macos.cc
index a8bd159..9481395 100644
--- a/runtime/bin/stdio_macos.cc
+++ b/runtime/bin/stdio_macos.cc
@@ -19,50 +19,67 @@
 namespace dart {
 namespace bin {
 
-int Stdin::ReadByte() {
-  int c = getchar();
-  if (c == EOF) {
-    c = -1;
+bool Stdin::ReadByte(int* byte) {
+  int c = NO_RETRY_EXPECTED(getchar());
+  if ((c == EOF) && (errno != 0)) {
+    return false;
   }
-  return c;
+  *byte = (c == EOF) ? -1 : c;
+  return true;
 }
 
 
-bool Stdin::GetEchoMode() {
+bool Stdin::GetEchoMode(bool* enabled) {
   struct termios term;
-  tcgetattr(STDIN_FILENO, &term);
-  return ((term.c_lflag & ECHO) != 0);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
+  *enabled = ((term.c_lflag & ECHO) != 0);
+  return true;
 }
 
 
-void Stdin::SetEchoMode(bool enabled) {
+bool Stdin::SetEchoMode(bool enabled) {
   struct termios term;
-  tcgetattr(STDIN_FILENO, &term);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
   if (enabled) {
     term.c_lflag |= (ECHO | ECHONL);
   } else {
     term.c_lflag &= ~(ECHO | ECHONL);
   }
-  tcsetattr(STDIN_FILENO, TCSANOW, &term);
+  status = NO_RETRY_EXPECTED(tcsetattr(STDIN_FILENO, TCSANOW, &term));
+  return (status == 0);
 }
 
 
-bool Stdin::GetLineMode() {
+bool Stdin::GetLineMode(bool* enabled) {
   struct termios term;
-  tcgetattr(STDIN_FILENO, &term);
-  return ((term.c_lflag & ICANON) != 0);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
+  *enabled = ((term.c_lflag & ICANON) != 0);
+  return true;
 }
 
 
-void Stdin::SetLineMode(bool enabled) {
+bool Stdin::SetLineMode(bool enabled) {
   struct termios term;
-  tcgetattr(STDIN_FILENO, &term);
+  int status = NO_RETRY_EXPECTED(tcgetattr(STDIN_FILENO, &term));
+  if (status != 0) {
+    return false;
+  }
   if (enabled) {
     term.c_lflag |= ICANON;
   } else {
     term.c_lflag &= ~(ICANON);
   }
-  tcsetattr(STDIN_FILENO, TCSANOW, &term);
+  status = NO_RETRY_EXPECTED(tcsetattr(STDIN_FILENO, TCSANOW, &term));
+  return (status == 0);
 }
 
 
diff --git a/runtime/bin/stdio_patch.dart b/runtime/bin/stdio_patch.dart
index 9478180..e537dc8 100644
--- a/runtime/bin/stdio_patch.dart
+++ b/runtime/bin/stdio_patch.dart
@@ -47,18 +47,47 @@
 }
 
 @patch class Stdin {
-  @patch int readByteSync() native "Stdin_ReadByte";
+  @patch int readByteSync() {
+    var result = _readByte();
+    if (result is OSError) {
+      throw new StdinException("Error reading byte from stdin", result);
+    }
+    return result;
+  }
 
-  @patch bool get echoMode => _echoMode;
-  @patch void set echoMode(bool enabled) { _echoMode = enabled; }
+  @patch bool get echoMode {
+    var result = _echoMode();
+    if (result is OSError) {
+      throw new StdinException("Error getting terminal echo mode", result);
+    }
+    return result;
+  }
+  @patch void set echoMode(bool enabled) {
+    var result = _setEchoMode(enabled);
+    if (result is OSError) {
+      throw new StdinException("Error setting terminal echo mode", result);
+    }
+  }
 
-  @patch bool get lineMode => _lineMode;
-  @patch void set lineMode(bool enabled) { _lineMode = enabled; }
+  @patch bool get lineMode {
+    var result = _lineMode();
+    if (result is OSError) {
+      throw new StdinException("Error getting terminal line mode", result);
+    }
+    return result;
+  }
+  @patch void set lineMode(bool enabled) {
+    var result = _setLineMode(enabled);
+    if (result is OSError) {
+      throw new StdinException("Error setting terminal line mode", result);
+    }
+  }
 
-  static bool get _echoMode native "Stdin_GetEchoMode";
-  static void set _echoMode(bool enabled) native "Stdin_SetEchoMode";
-  static bool get _lineMode native "Stdin_GetLineMode";
-  static void set _lineMode(bool enabled) native "Stdin_SetLineMode";
+  static _echoMode() native "Stdin_GetEchoMode";
+  static _setEchoMode(bool enabled) native "Stdin_SetEchoMode";
+  static _lineMode() native "Stdin_GetLineMode";
+  static _setLineMode(bool enabled) native "Stdin_SetLineMode";
+  static _readByte() native "Stdin_ReadByte";
 }
 
 @patch class Stdout {
diff --git a/runtime/bin/stdio_win.cc b/runtime/bin/stdio_win.cc
index d062826..5c79784 100644
--- a/runtime/bin/stdio_win.cc
+++ b/runtime/bin/stdio_win.cc
@@ -12,65 +12,68 @@
 namespace dart {
 namespace bin {
 
-int Stdin::ReadByte() {
+bool Stdin::ReadByte(int* byte) {
   HANDLE h = GetStdHandle(STD_INPUT_HANDLE);
   uint8_t buffer[1];
   DWORD read = 0;
-  int c = -1;
-  if (ReadFile(h, buffer, 1, &read, NULL) && (read == 1)) {
-    c = buffer[0];
+  BOOL success = ReadFile(h, buffer, 1, &read, NULL);
+  if (!success && (GetLastError() != ERROR_BROKEN_PIPE)) {
+    return false;
   }
-  return c;
+  *byte = (read == 1) ? buffer[0] : -1;
+  return true;
 }
 
 
-bool Stdin::GetEchoMode() {
+bool Stdin::GetEchoMode(bool* enabled) {
   HANDLE h = GetStdHandle(STD_INPUT_HANDLE);
   DWORD mode;
   if (!GetConsoleMode(h, &mode)) {
     return false;
   }
-  return ((mode & ENABLE_ECHO_INPUT) != 0);
+  *enabled = ((mode & ENABLE_ECHO_INPUT) != 0);
+  return true;
 }
 
 
-void Stdin::SetEchoMode(bool enabled) {
+bool Stdin::SetEchoMode(bool enabled) {
   HANDLE h = GetStdHandle(STD_INPUT_HANDLE);
   DWORD mode;
   if (!GetConsoleMode(h, &mode)) {
-    return;
+    return false;
   }
   if (enabled) {
     mode |= ENABLE_ECHO_INPUT;
   } else {
     mode &= ~ENABLE_ECHO_INPUT;
   }
-  SetConsoleMode(h, mode);
+  return SetConsoleMode(h, mode);
 }
 
 
-bool Stdin::GetLineMode() {
+bool Stdin::GetLineMode(bool* enabled) {
   HANDLE h = GetStdHandle(STD_INPUT_HANDLE);
   DWORD mode;
   if (!GetConsoleMode(h, &mode)) {
     return false;
   }
-  return (mode & ENABLE_LINE_INPUT) != 0;
+  *enabled = (mode & ENABLE_LINE_INPUT) != 0;
+  return true;
 }
 
 
-void Stdin::SetLineMode(bool enabled) {
+bool Stdin::SetLineMode(bool enabled) {
   HANDLE h = GetStdHandle(STD_INPUT_HANDLE);
   DWORD mode;
   if (!GetConsoleMode(h, &mode)) {
-    return;
+    return false;
   }
   if (enabled) {
     mode |= ENABLE_LINE_INPUT;
   } else {
     mode &= ~ENABLE_LINE_INPUT;
   }
-  SetConsoleMode(h, mode);
+  return SetConsoleMode(h, mode);
 }
 
 
diff --git a/runtime/bin/thread.h b/runtime/bin/thread.h
index e33e7f2..5bf1f13 100644
--- a/runtime/bin/thread.h
+++ b/runtime/bin/thread.h
@@ -55,7 +55,6 @@
   static ThreadId GetCurrentThreadId();
   static intptr_t ThreadIdToIntPtr(ThreadId id);
   static bool Compare(ThreadId a, ThreadId b);
-  static void GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage);
 
   static void InitOnce();
 
diff --git a/runtime/bin/thread_android.cc b/runtime/bin/thread_android.cc
index cee224d..e3732fa 100644
--- a/runtime/bin/thread_android.cc
+++ b/runtime/bin/thread_android.cc
@@ -165,17 +165,6 @@
 }
 
 
-void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
-  ASSERT(thread_id == GetCurrentThreadId());
-  ASSERT(cpu_usage != NULL);
-  struct timespec ts;
-  int r = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
-  ASSERT(r == 0);
-  *cpu_usage = (ts.tv_sec * kNanosecondsPerSecond + ts.tv_nsec) /
-               kNanosecondsPerMicrosecond;
-}
-
-
 void Thread::InitOnce() {
   // Nothing to be done.
 }
diff --git a/runtime/bin/thread_fuchsia.cc b/runtime/bin/thread_fuchsia.cc
index fa5397f..c4fb413 100644
--- a/runtime/bin/thread_fuchsia.cc
+++ b/runtime/bin/thread_fuchsia.cc
@@ -165,11 +165,6 @@
 }
 
 
-void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
-  UNIMPLEMENTED();
-}
-
-
 void Thread::InitOnce() {
   // Nothing to be done.
 }
diff --git a/runtime/bin/thread_linux.cc b/runtime/bin/thread_linux.cc
index 6e6971f..ed44b34 100644
--- a/runtime/bin/thread_linux.cc
+++ b/runtime/bin/thread_linux.cc
@@ -165,17 +165,6 @@
 }
 
 
-void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
-  ASSERT(thread_id == GetCurrentThreadId());
-  ASSERT(cpu_usage != NULL);
-  struct timespec ts;
-  int r = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
-  ASSERT(r == 0);
-  *cpu_usage = (ts.tv_sec * kNanosecondsPerSecond + ts.tv_nsec) /
-               kNanosecondsPerMicrosecond;
-}
-
-
 void Thread::InitOnce() {
   // Nothing to be done.
 }
diff --git a/runtime/bin/thread_macos.cc b/runtime/bin/thread_macos.cc
index b63b0b9..dc76aaa 100644
--- a/runtime/bin/thread_macos.cc
+++ b/runtime/bin/thread_macos.cc
@@ -158,30 +158,6 @@
 }
 
 
-void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
-  ASSERT(thread_id == GetCurrentThreadId());
-  ASSERT(cpu_usage != NULL);
-  // TODO(johnmccutchan): Enable this after fixing issue with macos directory
-  // watcher.
-  const bool get_cpu_usage = false;
-  if (get_cpu_usage) {
-    mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
-    thread_basic_info_data_t info_data;
-    thread_basic_info_t info = &info_data;
-    mach_port_t thread_port = mach_thread_self();
-    kern_return_t r = thread_info(thread_port, THREAD_BASIC_INFO,
-                                  (thread_info_t)info, &count);
-    mach_port_deallocate(mach_task_self(), thread_port);
-    if (r == KERN_SUCCESS) {
-      *cpu_usage = (info->user_time.seconds * kMicrosecondsPerSecond) +
-                   info->user_time.microseconds;
-      return;
-    }
-  }
-  *cpu_usage = 0;
-}
-
-
 void Thread::InitOnce() {
   // Nothing to be done.
 }
diff --git a/runtime/bin/thread_win.cc b/runtime/bin/thread_win.cc
index b491a51..2bb0942 100644
--- a/runtime/bin/thread_win.cc
+++ b/runtime/bin/thread_win.cc
@@ -114,35 +114,6 @@
 }
 
 
-void Thread::GetThreadCpuUsage(ThreadId thread_id, int64_t* cpu_usage) {
-  static const int64_t kTimeEpoc = 116444736000000000LL;
-  static const int64_t kTimeScaler = 10;  // 100 ns to us.
-  // Although win32 uses 64-bit integers for representing timestamps,
-  // these are packed into a FILETIME structure. The FILETIME
-  // structure is just a struct representing a 64-bit integer. The
-  // TimeStamp union allows access to both a FILETIME and an integer
-  // representation of the timestamp. The Windows timestamp is in
-  // 100-nanosecond intervals since January 1, 1601.
-  union TimeStamp {
-    FILETIME ft_;
-    int64_t t_;
-  };
-  ASSERT(cpu_usage != NULL);
-  TimeStamp created;
-  TimeStamp exited;
-  TimeStamp kernel;
-  TimeStamp user;
-  HANDLE handle = OpenThread(THREAD_QUERY_INFORMATION, false, thread_id);
-  BOOL result =
-      GetThreadTimes(handle, &created.ft_, &exited.ft_, &kernel.ft_, &user.ft_);
-  CloseHandle(handle);
-  if (!result) {
-    FATAL1("GetThreadCpuUsage failed %d\n", GetLastError());
-  }
-  *cpu_usage = (user.t_ - kTimeEpoc) / kTimeScaler;
-}
-
-
 void Thread::SetThreadLocal(ThreadLocalKey key, uword value) {
   ASSERT(key != kUnsetThreadLocalKey);
   BOOL result = TlsSetValue(key, reinterpret_cast<void*>(value));
diff --git a/runtime/bin/vmservice/loader.dart b/runtime/bin/vmservice/loader.dart
index 8af63b5..a72e735 100644
--- a/runtime/bin/vmservice/loader.dart
+++ b/runtime/bin/vmservice/loader.dart
@@ -53,6 +53,15 @@
   return uri;
 }
 
+class FileRequest {
+  final SendPort sp;
+  final int tag;
+  final Uri uri;
+  final Uri resolvedUri;
+  final String libraryUrl;
+  FileRequest(this.sp, this.tag, this.uri, this.resolvedUri, this.libraryUrl);
+}
+
 // State associated with the isolate that is used for loading.
 class IsolateLoaderState extends IsolateEmbedderData {
   IsolateLoaderState(this.isolateId);
@@ -78,6 +87,7 @@
     if (packagesConfigFlag != null) {
       _setPackagesConfig(packagesConfigFlag);
     }
+    _fileRequestQueue = new List<FileRequest>();
   }
 
   void cleanup() {
@@ -114,6 +124,24 @@
   Uri _packageConfig = null;
   Map<String, Uri> _packageMap = null;
 
+  // We issue only 16 concurrent calls to File.readAsBytes() to stay within
+  // platform-specific resource limits (e.g. max open files). The rest go on
+  // _fileRequestQueue and are processed when we can safely issue them.
+  static const int _maxFileRequests = 16;
+  int currentFileRequests = 0;
+  List<FileRequest> _fileRequestQueue;
+
+  bool get shouldIssueFileRequest => currentFileRequests < _maxFileRequests;
+  void enqueueFileRequest(FileRequest fr) {
+    _fileRequestQueue.add(fr);
+  }
+  FileRequest dequeueFileRequest() {
+    if (_fileRequestQueue.length == 0) {
+      return null;
+    }
+    return _fileRequestQueue.removeAt(0);
+  }
+
   _setPackageRoot(String packageRoot) {
     packageRoot = _sanitizeWindowsPath(packageRoot);
     if (packageRoot.startsWith('file:') ||
@@ -399,7 +427,8 @@
   Timer.run(() {});
 }
 
-void _loadFile(SendPort sp,
+void _loadFile(IsolateLoaderState loaderState,
+               SendPort sp,
                int tag,
                Uri uri,
                Uri resolvedUri,
@@ -411,6 +440,17 @@
   },
   onError: (e) {
     _sendResourceResponse(sp, tag, uri, resolvedUri, libraryUrl, e.toString());
+  }).whenComplete(() {
+    loaderState.currentFileRequests--;
+    while (loaderState.shouldIssueFileRequest) {
+      FileRequest fr = loaderState.dequeueFileRequest();
+      if (fr == null) {
+        break;
+      }
+      _loadFile(
+          loaderState, fr.sp, fr.tag, fr.uri, fr.resolvedUri, fr.libraryUrl);
+      loaderState.currentFileRequests++;
+    }
   });
 }
 
@@ -507,7 +547,13 @@
                        Uri resolvedUri,
                        String libraryUrl) {
   if (resolvedUri.scheme == '' || resolvedUri.scheme == 'file') {
-    _loadFile(sp, tag, uri, resolvedUri, libraryUrl);
+    if (loaderState.shouldIssueFileRequest) {
+      _loadFile(loaderState, sp, tag, uri, resolvedUri, libraryUrl);
+      loaderState.currentFileRequests++;
+    } else {
+      FileRequest fr = new FileRequest(sp, tag, uri, resolvedUri, libraryUrl);
+      loaderState.enqueueFileRequest(fr);
+    }
   } else if ((resolvedUri.scheme == 'http') ||
              (resolvedUri.scheme == 'https')) {
     _loadHttp(sp, tag, uri, resolvedUri, libraryUrl);
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart
index 9a48adf..020badb 100644
--- a/runtime/bin/vmservice/server.dart
+++ b/runtime/bin/vmservice/server.dart
@@ -166,7 +166,7 @@
   }
 
   bool _originCheck(HttpRequest request) {
-    if (_originCheckDisabled) {
+    if (_originCheckDisabled || Platform.isFuchsia) {
       // Always allow.
       return true;
     }
@@ -306,12 +306,16 @@
 
     // Startup HTTP server.
     try {
-      var addresses = await InternetAddress.lookup(_ip);
       var address;
-      // Prefer IPv4 addresses.
-      for (var i = 0; i < addresses.length; i++) {
-        address = addresses[i];
-        if (address.type == InternetAddressType.IP_V4) break;
+      if (Platform.isFuchsia) {
+        address = InternetAddress.ANY_IP_V6;
+      } else {
+        var addresses = await InternetAddress.lookup(_ip);
+        // Prefer IPv4 addresses.
+        for (var i = 0; i < addresses.length; i++) {
+          address = addresses[i];
+          if (address.type == InternetAddressType.IP_V4) break;
+        }
       }
       _server = await HttpServer.bind(address, _port);
       _server.listen(_requestHandler, cancelOnError: true);
diff --git a/runtime/bin/vmservice/vmservice_io.dart b/runtime/bin/vmservice/vmservice_io.dart
index a883a73..b092b21 100644
--- a/runtime/bin/vmservice/vmservice_io.dart
+++ b/runtime/bin/vmservice/vmservice_io.dart
@@ -229,7 +229,7 @@
   VMServiceEmbedderHooks.webServerControl = webServerControlCallback;
   // Always instantiate the vmservice object so that the exit message
   // can be delivered and waiting loaders can be cancelled.
-  var service = new VMService();
+  new VMService();
   if (_autoStart) {
     _lazyServerBoot();
     server.startup();
diff --git a/runtime/bin/vmservice_dartium.cc b/runtime/bin/vmservice_dartium.cc
index 613b005..f3c91d9 100644
--- a/runtime/bin/vmservice_dartium.cc
+++ b/runtime/bin/vmservice_dartium.cc
@@ -47,7 +47,7 @@
   char* error = 0;
   Dart_Isolate isolate =
       Dart_CreateIsolate(DART_VM_SERVICE_ISOLATE_NAME, "main", snapshot_buffer,
-                         NULL, isolate_data, &error);
+                         NULL, NULL, isolate_data, &error);
   if (!isolate) {
     fprintf(stderr, "Dart_CreateIsolate failed: %s\n", error);
     return 0;
diff --git a/runtime/dart-runtime.gyp b/runtime/dart-runtime.gyp
index 6ed2306..1b2f9bd 100644
--- a/runtime/dart-runtime.gyp
+++ b/runtime/dart-runtime.gyp
@@ -55,41 +55,6 @@
       },
     },
     {
-      'target_name': 'libdart_noopt',
-      'type': 'static_library',
-      'dependencies': [
-        'libdart_lib',
-        'libdart_vm_noopt',
-        'libdouble_conversion',
-        'generate_version_cc_file#host',
-      ],
-      'include_dirs': [
-        '.',
-      ],
-      'sources': [
-        '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/debugger_api_impl.cc',
-        'vm/mirrors_api_impl.cc',
-        'vm/native_api_impl.cc',
-        'vm/version.h',
-        '<(version_cc_file)',
-      ],
-      'defines': [
-        # The only effect of DART_SHARED_LIB is to export the Dart API entries.
-        'DART_SHARED_LIB',
-        'DART_PRECOMPILER',
-      ],
-      'direct_dependent_settings': {
-        'include_dirs': [
-          'include',
-        ],
-      },
-    },
-    {
       'target_name': 'libdart_precompiled_runtime',
       'type': 'static_library',
       'dependencies': [
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index 93d6da5..47ca849 100644
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -125,7 +125,7 @@
  *
  *   An unhandled exception error provides access to an exception and
  *   stacktrace via the functions Dart_ErrorGetException and
- *   Dart_ErrorGetStacktrace.
+ *   Dart_ErrorGetStackTrace.
  *
  * - Compilation error handles are produced when, during the execution
  *   of Dart code, a compile-time error occurs.  As above, this can
@@ -284,7 +284,7 @@
  * This can occur in any function which triggers the execution of Dart
  * code.
  *
- * See Dart_ErrorGetException and Dart_ErrorGetStacktrace.
+ * See Dart_ErrorGetException and Dart_ErrorGetStackTrace.
  *
  * Requires there to be a current isolate.
  */
@@ -347,7 +347,7 @@
 /**
  * Gets the stack trace Object from an unhandled exception error handle.
  */
-DART_EXPORT Dart_Handle Dart_ErrorGetStacktrace(Dart_Handle handle);
+DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace(Dart_Handle handle);
 
 /**
  * Produces an api error handle with the provided error message.
@@ -773,7 +773,7 @@
  * The current version of the Dart_InitializeFlags. Should be incremented every
  * time Dart_InitializeFlags changes in a binary incompatible way.
  */
-#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000001)
+#define DART_INITIALIZE_PARAMS_CURRENT_VERSION (0x00000002)
 
 /**
  * Describes how to initialize the VM. Used with Dart_Initialize.
@@ -794,9 +794,8 @@
  */
 typedef struct {
   int32_t version;
-  const uint8_t* vm_isolate_snapshot;
-  const uint8_t* instructions_snapshot;
-  const uint8_t* data_snapshot;
+  const uint8_t* vm_snapshot_data;
+  const uint8_t* vm_snapshot_instructions;
   Dart_IsolateCreateCallback create;
   Dart_IsolateShutdownCallback shutdown;
   Dart_ThreadExitCallback thread_exit;
@@ -864,8 +863,9 @@
  *   Provided only for advisory purposes to improve debugging messages.
  * \param main The name of the main entry point this isolate will run.
  *   Provided only for advisory purposes to improve debugging messages.
- * \param snapshot A buffer containing a snapshot of the isolate or
- *   NULL if no snapshot is provided.
+ * \param isolate_snapshot_data
+ * \param isolate_snapshot_instructions Buffers containing a snapshot of the
+ *   isolate or NULL if no snapshot is provided.
  * \param flags Pointer to VM specific flags or NULL for default flags.
  * \param callback_data Embedder data.  This data will be passed to
  *   the Dart_IsolateCreateCallback when new isolates are spawned from
@@ -875,12 +875,14 @@
  * \return The new isolate is returned. May be NULL if an error
  *   occurs during isolate initialization.
  */
-DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri,
-                                            const char* main,
-                                            const uint8_t* snapshot,
-                                            Dart_IsolateFlags* flags,
-                                            void* callback_data,
-                                            char** error);
+DART_EXPORT Dart_Isolate
+Dart_CreateIsolate(const char* script_uri,
+                   const char* main,
+                   const uint8_t* isolate_snapshot_data,
+                   const uint8_t* isolate_snapshot_instructions,
+                   Dart_IsolateFlags* flags,
+                   void* callback_data,
+                   char** error);
 /* TODO(turnidge): Document behavior when there is already a current
  * isolate. */
 
@@ -1009,10 +1011,10 @@
  * \return A valid handle if no error occurs during the operation.
  */
 DART_EXPORT Dart_Handle
-Dart_CreateSnapshot(uint8_t** vm_isolate_snapshot_buffer,
-                    intptr_t* vm_isolate_snapshot_size,
-                    uint8_t** isolate_snapshot_buffer,
-                    intptr_t* isolate_snapshot_size);
+Dart_CreateSnapshot(uint8_t** vm_snapshot_data_buffer,
+                    intptr_t* vm_snapshot_data_size,
+                    uint8_t** isolate_snapshot_data_buffer,
+                    intptr_t* isolate_snapshot_data_size);
 
 /**
  * Creates a snapshot of the application script loaded in the isolate.
@@ -1030,29 +1032,9 @@
  *
  * \return A valid handle if no error occurs during the operation.
  */
-DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer,
-                                                  intptr_t* size);
-
-/**
- * Creates a snapshot of the specified library loaded in the isolate.
- *
- * A library snapshot can be used for implementing fast startup of applications
- * (skips tokenizing and parsing process). A Snapshot of the library
- * can only be created before any dart code has executed.
- *
- * Requires there to be a current isolate which already has loaded the library.
- *
- * \param library A library for which the snapshot needs to be created.
- * \param buffer Returns a pointer to a buffer containing
- *   the snapshot. This buffer is scope allocated and is only valid
- *   until the next call to Dart_ExitScope.
- * \param size Returns the size of the buffer.
- *
- * \return A valid handle if no error occurs during the operation.
- */
-DART_EXPORT Dart_Handle Dart_CreateLibrarySnapshot(Dart_Handle library,
-                                                   uint8_t** buffer,
-                                                   intptr_t* size);
+DART_EXPORT Dart_Handle
+Dart_CreateScriptSnapshot(uint8_t** script_snapshot_buffer,
+                          intptr_t* script_snapshot_size);
 
 /**
  * Schedules an interrupt for the specified isolate.
@@ -2860,8 +2842,9 @@
  * \return If no error occurs, the Library object corresponding to the root
  *   script is returned. Otherwise an error handle is returned.
  */
-DART_EXPORT Dart_Handle Dart_LoadScriptFromSnapshot(const uint8_t* buffer,
-                                                    intptr_t buffer_len);
+DART_EXPORT Dart_Handle
+Dart_LoadScriptFromSnapshot(const uint8_t* script_snapshot_buffer,
+                            intptr_t script_snapshot_size);
 
 /**
  * Loads a dart application via an in-memory kernel program.
@@ -3131,6 +3114,27 @@
 
 
 /*
+ * ======
+ * Kernel
+ * ======
+ */
+
+
+/**
+ * Experimental support for Dart to Kernel parser isolate.
+ *
+ * TODO(hausner): Document finalized interface.
+ *
+ */
+
+DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate);
+DART_EXPORT bool Dart_KernelIsolateIsRunning();
+DART_EXPORT Dart_Port Dart_ServiceWaitForKernelPort();
+DART_EXPORT Dart_Port Dart_KernelPort();
+
+#define DART_KERNEL_ISOLATE_NAME "kernel-service"
+
+/*
  * =======
  * Service
  * =======
@@ -3164,6 +3168,22 @@
  * ==============
  */
 
+/**
+ * Saves a serialized version of the information collected for use by the
+ * optimizing compiler, such as type feedback and usage counters. When this
+ * information is passed to Dart_Precompile, the AOT compiler may use it to
+ * produce faster and smaller code. The feedback is only used if the JIT that
+ * created it and the AOT compiler consuming it
+ *   - are running the same Dart program
+ *   - are built from the same version of the VM
+ *   - agree on whether type checks and assertions are enabled
+ *
+ * \return Returns an error handler if the VM was built in a mode that does not
+ * support saving JIT feedback.
+ */
+DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer,
+                                             intptr_t* buffer_length);
+
 
 typedef struct {
   const char* library_uri;
@@ -3186,14 +3206,15 @@
  * reset_fields is true when we are about to create a precompilated snapshot.
  * Some fields are already been initialized as part of the loading logic, and
  * we want them to be reinitialized in the new process that will load the
- * snapshot. reset_fields is false for --noopt, which will continue running in
- * the same process.
+ * snapshot.
  *
  * \return An error handle if a compilation error or runtime error running const
  * constructors was encountered.
  */
 DART_EXPORT Dart_Handle
-Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields);
+Dart_Precompile(Dart_QualifiedFunctionName entry_points[],
+                uint8_t* jit_feedback,
+                intptr_t jit_feedback_length);
 
 
 /**
@@ -3201,14 +3222,18 @@
  *   - A root library must have been loaded.
  *   - Dart_Precompile must have been called.
  *
- *  Outputs a vm isolate snapshot, an isolate snapshot, and an assembly file
- *  defining the symbols kInstructionsSnapshot and kDataSnapshot. The assembly
- *  should be compiled as a static or shared library and linked or loaded by the
- *  embedder.
+ *  Outputs an assembly file defining the symbols
+ *   - kDartVmSnapshotData
+ *   - kDartVmSnapshotInstructions
+ *   - kDartIsolateSnapshotData
+ *   - kDartIsolateSnapshotInstructions
+ *
+ *  The assembly should be compiled as a static or shared library and linked or
+ *  loaded by the embedder.
  *  Running this snapshot requires a VM compiled with DART_PRECOMPILED_SNAPSHOT.
- *  The vm isolate snapshot, kInstructionsSnapshot and kDataSnapshot should be
- *  passed as arguments to Dart_Initialize. The isolate snapshot should be
- *  passed to Dart_CreateIsolate.
+ *  The kDartVmSnapshotData and kDartVmSnapshotInstructions should be passed to
+ *  Dart_Initialize. The kDartIsolateSnapshotData and
+ *  kDartIsoalteSnapshotInstructions should be passed to Dart_CreateIsolate.
  *
  *  The buffers are scope allocated and are only valid until the next call to
  *  Dart_ExitScope.
@@ -3216,43 +3241,39 @@
  * \return A valid handle if no error occurs during the operation.
  */
 DART_EXPORT Dart_Handle
-Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer,
-                                       intptr_t* assembly_size);
+Dart_CreateAppAOTSnapshotAsAssembly(uint8_t** assembly_buffer,
+                                    intptr_t* assembly_size);
 
 
 /**
- *  Same as Dart_CreatePrecompiledSnapshotAssembly, except the instruction and
- *  data snapshot pieces are provided directly as bytes that the embedder can
- *  load with mmap. The instructions piece must be loaded with read and
- *  execute permissions; the rodata piece may be loaded as read-only.
+ *  Same as Dart_CreateAppAOTSnapshotAsAssembly, except all the pieces are
+ *  provided directly as bytes that the embedder can load with mmap. The
+ *  instructions pieces must be loaded with read and execute permissions; the
+ *  other pieces may be loaded as read-only.
  */
 DART_EXPORT Dart_Handle
-Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer,
-                                   intptr_t* vm_isolate_snapshot_size,
-                                   uint8_t** isolate_snapshot_buffer,
-                                   intptr_t* isolate_snapshot_size,
-                                   uint8_t** instructions_blob_buffer,
-                                   intptr_t* instructions_blob_size,
-                                   uint8_t** rodata_blob_buffer,
-                                   intptr_t* rodata_blob_size);
-
-
-DART_EXPORT Dart_Handle Dart_PrecompileJIT();
+Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer,
+                                 intptr_t* vm_snapshot_data_size,
+                                 uint8_t** vm_snapshot_instructions_buffer,
+                                 intptr_t* vm_snapshot_instructions_size,
+                                 uint8_t** isolate_snapshot_data_buffer,
+                                 intptr_t* isolate_snapshot_data_size,
+                                 uint8_t** isolate_snapshot_instructions_buffer,
+                                 intptr_t* isolate_snapshot_instructions_size);
 
 
 /**
- *  Creates a snapshot that caches unoptimized code and type feedback for faster
+ *  Creates a snapshot that caches compiled code and type feedback for faster
  *  startup and quicker warmup in a subsequent process.
  *
- *  Outputs a snapshot in four pieces. The vm isolate snapshot,
- *  instructions_blob and rodata_blob should be passed as arguments to
- *  Dart_Initialize. The isolate snapshot should be passed to
- *  Dart_CreateIsolate. The instructions piece must be loaded with execute
- *  permissions; the other pieces may loaded as read-only.
+ *  Outputs a snapshot in two pieces. The pieces should be passed to
+ *  Dart_CreateIsolate in a VM using the same VM snapshot pieces used in the
+ *  current VM. The instructions piece must be loaded with read and execute
+ *  permissions; the data piece may be loaded as read-only.
  *
  *   - Requires the VM to have been started with --load-deferred-eagerly.
  *   - Requires the VM to have not been started with --precompilation.
- *   - Not supported when targeting IA32.
+ *   - Not supported when targeting IA32 or DBC.
  *   - The VM writing the snapshot and the VM reading the snapshot must be the
  *     same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must
  *     be targeting the same architecture, and must both be in checked mode or
@@ -3264,14 +3285,10 @@
  * \return A valid handle if no error occurs during the operation.
  */
 DART_EXPORT Dart_Handle
-Dart_CreateAppJITSnapshot(uint8_t** vm_isolate_snapshot_buffer,
-                          intptr_t* vm_isolate_snapshot_size,
-                          uint8_t** isolate_snapshot_buffer,
-                          intptr_t* isolate_snapshot_size,
-                          uint8_t** instructions_blob_buffer,
-                          intptr_t* instructions_blob_size,
-                          uint8_t** rodata_blob_buffer,
-                          intptr_t* rodata_blob_size);
+Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
+                                 intptr_t* isolate_snapshot_data_size,
+                                 uint8_t** isolate_snapshot_instructions_buffer,
+                                 intptr_t* isolate_snapshot_instructions_size);
 
 
 /**
diff --git a/runtime/lib/array_patch.dart b/runtime/lib/array_patch.dart
index f834394..db4626a 100644
--- a/runtime/lib/array_patch.dart
+++ b/runtime/lib/array_patch.dart
@@ -11,14 +11,7 @@
 const _GROWABLE_ARRAY_MARKER = const _GrowableArrayMarker();
 
 @patch class List<E> {
-  @patch factory List([int length = _GROWABLE_ARRAY_MARKER]) {
-    if (identical(length, _GROWABLE_ARRAY_MARKER)) {
-      return new _GrowableList<E>(0);
-    }
-    // All error handling on the length parameter is done at the implementation
-    // of new _List.
-    return new _List<E>(length);
-  }
+  @patch factory List([int length]) = List<E>._internal;
 
   @patch factory List.filled(int length, E fill, {bool growable: false}) {
     // All error handling on the length parameter is done at the implementation
@@ -59,6 +52,17 @@
     return makeFixedListUnmodifiable(result);
   }
 
+  // The List factory constructor redirects to this one so that we can change
+  // length's default value from the one in the SDK's implementation.
+  factory List._internal([int length = _GROWABLE_ARRAY_MARKER]) {
+    if (identical(length, _GROWABLE_ARRAY_MARKER)) {
+      return new _GrowableList<E>(0);
+    }
+    // All error handling on the length parameter is done at the implementation
+    // of new _List.
+    return new _List<E>(length);
+  }
+
   // Factory constructing a mutable List from a parser generated List literal.
   // [elements] contains elements that are already type checked.
   factory List._fromLiteral(List elements) {
diff --git a/runtime/lib/bool_patch.dart b/runtime/lib/bool_patch.dart
index 5b5f4ff..3adc918 100644
--- a/runtime/lib/bool_patch.dart
+++ b/runtime/lib/bool_patch.dart
@@ -10,6 +10,8 @@
                                             {bool defaultValue: false})
       native "Bool_fromEnvironment";
 
+  @patch
   int get hashCode => this ? 1231 : 1237;
+
   int get _identityHashCode => this ? 1231 : 1237;
 }
diff --git a/runtime/lib/convert_patch.dart b/runtime/lib/convert_patch.dart
index 25a8dc5..9606568 100644
--- a/runtime/lib/convert_patch.dart
+++ b/runtime/lib/convert_patch.dart
@@ -6,7 +6,7 @@
 
 // JSON conversion.
 
-@patch _parseJson(String json, reviver(var key, var value)) {
+@patch _parseJson(String source, reviver(key, value)) {
   _BuildJsonListener listener;
   if (reviver == null) {
     listener = new _BuildJsonListener();
@@ -14,8 +14,8 @@
     listener = new _ReviverJsonListener(reviver);
   }
   var parser = new _JsonStringParser(listener);
-  parser.chunk = json;
-  parser.chunkEnd = json.length;
+  parser.chunk = source;
+  parser.chunkEnd = source.length;
   parser.parse(0);
   parser.close();
   return listener.result;
@@ -23,8 +23,8 @@
 
 @patch class Utf8Decoder {
   @patch
-  Converter<List<int>, dynamic/*=T*/> fuse/*<T>*/(
-      Converter<String, dynamic/*=T*/> next) {
+  Converter<List<int>, T> fuse<T>(
+      Converter<String, T> next) {
     if (next is JsonDecoder) {
       return new _JsonUtf8Decoder(next._reviver, this._allowMalformed)
           as dynamic/*=Converter<List<int>, T>*/;
diff --git a/runtime/lib/core_patch.dart b/runtime/lib/core_patch.dart
index 29357ae..fbcfdb9 100644
--- a/runtime/lib/core_patch.dart
+++ b/runtime/lib/core_patch.dart
@@ -25,16 +25,16 @@
 // implement sync* generator functions. A sync* generator allocates
 // and returns a new _SyncIterable object.
 
-typedef bool SyncGeneratorCallback(Iterator iterator);
+typedef bool _SyncGeneratorCallback(Iterator iterator);
 
 class _SyncIterable extends IterableBase {
-  // moveNextFn is the closurized body of the generator function.
-  final SyncGeneratorCallback moveNextFn;
+  // _moveNextFn is the closurized body of the generator function.
+  final _SyncGeneratorCallback _moveNextFn;
 
-  const _SyncIterable(this.moveNextFn);
+  const _SyncIterable(this._moveNextFn);
 
   get iterator {
-    return new _SyncIterator(moveNextFn._clone());
+    return new _SyncIterator(_moveNextFn._clone());
   }
 }
 
@@ -42,16 +42,16 @@
   bool isYieldEach;  // Set by generated code for the yield* statement.
   Iterator yieldEachIterator;
   var _current;  // Set by generated code for the yield and yield* statement.
-  SyncGeneratorCallback moveNextFn;
+  _SyncGeneratorCallback _moveNextFn;
 
   get current => yieldEachIterator != null
       ? yieldEachIterator.current
       : _current;
 
-  _SyncIterator(this.moveNextFn);
+  _SyncIterator(this._moveNextFn);
 
   bool moveNext() {
-    if (moveNextFn == null) {
+    if (_moveNextFn == null) {
       return false;
     }
     while(true) {
@@ -62,9 +62,9 @@
         yieldEachIterator = null;
       }
       isYieldEach = false;
-      // moveNextFn() will update the values of isYieldEach and _current.
-      if (!moveNextFn(this)) {
-        moveNextFn = null;
+      // _moveNextFn() will update the values of isYieldEach and _current.
+      if (!_moveNextFn(this)) {
+        _moveNextFn = null;
         _current = null;
         return false;
       }
diff --git a/runtime/lib/double_patch.dart b/runtime/lib/double_patch.dart
index b0b7054..2b9fb28 100644
--- a/runtime/lib/double_patch.dart
+++ b/runtime/lib/double_patch.dart
@@ -101,12 +101,12 @@
     return _nativeParse(str, start, end);
   }
 
-  @patch static double parse(String str,
-                                   [double onError(String str)]) {
-    var result = _parse(str);
+  @patch
+  static double parse(String source, [double onError(String source)]) {
+    var result = _parse(source);
     if (result == null) {
-      if (onError == null) throw new FormatException("Invalid double", str);
-      return onError(str);
+      if (onError == null) throw new FormatException("Invalid double", source);
+      return onError(source);
     }
     return result;
   }
diff --git a/runtime/lib/errors.cc b/runtime/lib/errors.cc
index 27770a9..d10df39 100644
--- a/runtime/lib/errors.cc
+++ b/runtime/lib/errors.cc
@@ -20,7 +20,7 @@
     // the inlining meta-data so we cannot walk the inline-aware stack trace.
     // Second, the script text itself is missing so whatever script is returned
     // from here will be missing the assertion expression text.
-    iterator->NextFrame();  // Skip _AssertionError._checkAssertion frame
+    iterator->NextFrame();  // Skip _AssertionError._evaluateAssertion frame
     return Exceptions::GetCallerScript(iterator);
   }
   StackFrame* stack_frame = iterator->NextFrame();
@@ -62,8 +62,9 @@
 // Allocate and throw a new AssertionError.
 // Arg0: index of the first token of the failed assertion.
 // Arg1: index of the first token after the failed assertion.
+// Arg2: Message object or null.
 // Return value: none, throws an exception.
-DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 2) {
+DEFINE_NATIVE_ENTRY(AssertionError_throwNew, 3) {
   // No need to type check the arguments. This function can only be called
   // internally from the VM.
   const TokenPosition assertion_start =
@@ -71,7 +72,8 @@
   const TokenPosition assertion_end =
       TokenPosition(Smi::CheckedHandle(arguments->NativeArgAt(1)).Value());
 
-  const Array& args = Array::Handle(Array::New(4));
+  const Instance& message = Instance::CheckedHandle(arguments->NativeArgAt(2));
+  const Array& args = Array::Handle(Array::New(5));
 
   DartFrameIterator iterator;
   iterator.NextFrame();  // Skip native call.
@@ -92,6 +94,7 @@
   args.SetAt(1, String::Handle(script.url()));
   args.SetAt(2, Smi::Handle(Smi::New(from_line)));
   args.SetAt(3, Smi::Handle(Smi::New(script.HasSource() ? from_column : -1)));
+  args.SetAt(4, message);
 
   Exceptions::ThrowByType(Exceptions::kAssertion, args);
   UNREACHABLE();
diff --git a/runtime/lib/errors_patch.dart b/runtime/lib/errors_patch.dart
index 2635802..69ae219 100644
--- a/runtime/lib/errors_patch.dart
+++ b/runtime/lib/errors_patch.dart
@@ -18,29 +18,37 @@
 
 class _AssertionError extends Error implements AssertionError {
   _AssertionError._create(
-      this._failedAssertion, this._url, this._line, this._column);
+      this._failedAssertion, this._url, this._line, this._column,
+      this.message);
 
-  static _throwNew(int assertionStart, int assertionEnd)
-      native "AssertionError_throwNew";
 
-  static void _checkAssertion(condition, int start, int end) {
+  // AssertionError_throwNew in errors.cc fishes the assertion source code
+  // out of the script. It expects a Dart stack frame from class
+  // _AssertionError. Thus we need a Dart stub that calls the native code.
+  static _throwNew(int assertionStart, int assertionEnd, Object message) {
+    _doThrowNew(assertionStart, assertionEnd, message);
+  }
+
+  static _doThrowNew(int assertionStart, int assertionEnd, Object message)
+    native "AssertionError_throwNew";
+
+  static _evaluateAssertion(condition) {
     if (condition is Function) {
       condition = condition();
     }
-    if (!condition) {
-      _throwNew(start, end);
-    }
+    return condition;
   }
 
-  static void _checkConstAssertion(bool condition, int start, int end) {
-    if (!condition) {
-      _throwNew(start, end);
-    }
+  String get _messageString {
+    if (message == null) return "is not true.";
+    if (message is String) return message;
+    return Error.safeToString(message);
   }
 
   String toString() {
     if (_url == null) {
-      return _failedAssertion;
+      if (message == null) return _failedAssertion;
+      return "'$_failedAssertion': $_messageString";
     }
     var columnInfo = "";
     if (_column > 0) {
@@ -48,17 +56,18 @@
       columnInfo = " pos $_column";
     }
     return "'$_url': Failed assertion: line $_line$columnInfo: "
-        "'$_failedAssertion' is not true.";
+        "'$_failedAssertion': $_messageString";
   }
   final String _failedAssertion;
   final String _url;
   final int _line;
   final int _column;
+  final Object message;
 }
 
 class _TypeError extends _AssertionError implements TypeError {
-  _TypeError._create(String url, int line, int column, this._errorMsg)
-      : super._create("is assignable", url, line, column);
+  _TypeError._create(String url, int line, int column, String errorMsg)
+      : super._create("is assignable", url, line, column, errorMsg);
 
   static _throwNew(int location,
                    Object src_value,
@@ -78,9 +87,7 @@
     }
   }
 
-  String toString() => _errorMsg;
-
-  final String _errorMsg;
+  String toString() => super.message;
 }
 
 class _CastError extends Error implements CastError {
@@ -103,6 +110,7 @@
 
   static _throwNew(int case_clause_pos) native "FallThroughError_throwNew";
 
+  @patch
   String toString() {
     return "'$_url': Switch case fall-through at line $_line.";
   }
@@ -204,13 +212,17 @@
   final int _invocation_type;
 
   @patch
-  NoSuchMethodError(Object this._receiver,
-                    Symbol this._memberName,
-                    List this._arguments,
-                    Map<Symbol, dynamic> this._namedArguments,
+  NoSuchMethodError(Object receiver,
+                    Symbol memberName,
+                    List positionalArguments,
+                    Map<Symbol, dynamic> namedArguments,
                     [List existingArgumentNames = null])
-      : this._existingArgumentNames = existingArgumentNames,
-        this._invocation_type = -1;
+      : _receiver = receiver,
+        _memberName = memberName,
+        _arguments = positionalArguments,
+        _namedArguments = namedArguments,
+        _existingArgumentNames = existingArgumentNames,
+        _invocation_type = -1;
 
   // This constructor seems to be called with either strings or
   // values read from another NoSuchMethodError.
diff --git a/runtime/lib/expando_patch.dart b/runtime/lib/expando_patch.dart
index ac5f706..af55a4d 100644
--- a/runtime/lib/expando_patch.dart
+++ b/runtime/lib/expando_patch.dart
@@ -3,8 +3,9 @@
 // BSD-style license that can be found in the LICENSE file.
 
 @patch class Expando<T> {
-  @patch Expando([String this.name])
-      : _data = new List(_minSize),
+  @patch Expando([String name])
+      : name = name,
+        _data = new List(_minSize),
         _used = 0;
 
   static const _minSize = 8;
diff --git a/runtime/lib/function.cc b/runtime/lib/function.cc
index 2abdde71..5b2343f 100644
--- a/runtime/lib/function.cc
+++ b/runtime/lib/function.cc
@@ -69,17 +69,7 @@
   const Closure& receiver =
       Closure::CheckedHandle(zone, arguments->NativeArgAt(0));
   const Function& func = Function::Handle(receiver.function());
-  // Hash together name, class name and signature.
-  const Class& cls = Class::Handle(func.Owner());
-  intptr_t result = String::Handle(func.name()).Hash();
-  result += String::Handle(func.Signature()).Hash();
-  result += String::Handle(cls.Name()).Hash();
-  // Finalize hash value like for strings so that it fits into a smi.
-  result += result << 3;
-  result ^= result >> 11;
-  result += result << 15;
-  result &= ((static_cast<intptr_t>(1) << String::kHashBits) - 1);
-  return Smi::New(result);
+  return func.GetClosureHashCode();
 }
 
 
diff --git a/runtime/lib/immutable_map.dart b/runtime/lib/immutable_map.dart
index ba866e3..87c1689 100644
--- a/runtime/lib/immutable_map.dart
+++ b/runtime/lib/immutable_map.dart
@@ -3,10 +3,10 @@
 // BSD-style license that can be found in the LICENSE file.
 // Immutable map class for compiler generated map literals.
 
-class ImmutableMap<K, V> implements Map<K, V> {
+class _ImmutableMap<K, V> implements Map<K, V> {
   final _ImmutableList _kvPairs;
 
-  const ImmutableMap._create(_ImmutableList keyValuePairs)
+  const _ImmutableMap._create(_ImmutableList keyValuePairs)
       : _kvPairs = keyValuePairs;
 
 
@@ -86,7 +86,7 @@
 }
 
 class _ImmutableMapKeyIterable<E> extends EfficientLengthIterable<E> {
-  final ImmutableMap _map;
+  final _ImmutableMap _map;
   _ImmutableMapKeyIterable(this._map);
 
   Iterator<E> get iterator {
@@ -97,7 +97,7 @@
 }
 
 class _ImmutableMapValueIterable<E> extends EfficientLengthIterable<E> {
-  final ImmutableMap _map;
+  final _ImmutableMap _map;
   _ImmutableMapValueIterable(this._map);
 
   Iterator<E> get iterator {
@@ -108,7 +108,7 @@
 }
 
 class _ImmutableMapKeyIterator<E> implements Iterator<E> {
-  ImmutableMap _map;
+  _ImmutableMap _map;
   int _index = -1;
   E _current;
 
@@ -130,7 +130,7 @@
 }
 
 class _ImmutableMapValueIterator<E> implements Iterator<E> {
-  ImmutableMap _map;
+  _ImmutableMap _map;
   int _index = -1;
   E _current;
 
diff --git a/runtime/lib/integers.dart b/runtime/lib/integers.dart
index f465e3b..e87dba7 100644
--- a/runtime/lib/integers.dart
+++ b/runtime/lib/integers.dart
@@ -394,8 +394,8 @@
     if (x == 0) return y;
     if (y == 0) return x;
     if ((x == 1) || (y == 1)) return 1;
-    if (other is _Bigint) {
-      return _toBigint().gcd(other);
+    if (y is _Bigint) {
+      return x._toBigint().gcd(y);
     }
     return _binaryGcd(x, y, false);
   }
diff --git a/runtime/lib/isolate.cc b/runtime/lib/isolate.cc
index d88fbc8..5fc2a54 100644
--- a/runtime/lib/isolate.cc
+++ b/runtime/lib/isolate.cc
@@ -30,11 +30,17 @@
             false,
             "Block the parent thread when loading spawned isolates.");
 
-static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
+static uint8_t* malloc_allocator(uint8_t* ptr,
+                                 intptr_t old_size,
+                                 intptr_t new_size) {
   void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
   return reinterpret_cast<uint8_t*>(new_ptr);
 }
 
+static void malloc_deallocator(uint8_t* ptr) {
+  free(reinterpret_cast<void*>(ptr));
+}
+
 
 DEFINE_NATIVE_ENTRY(CapabilityImpl_factory, 1) {
   ASSERT(TypeArguments::CheckedHandle(arguments->NativeArgAt(0)).IsNull());
@@ -116,7 +122,8 @@
         new Message(destination_port_id, obj.raw(), Message::kNormalPriority));
   } else {
     uint8_t* data = NULL;
-    MessageWriter writer(&data, &allocator, can_send_any_object);
+    MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator,
+                         can_send_any_object);
     writer.WriteMessage(obj);
 
     // TODO(turnidge): Throw an exception when the return value is false?
@@ -232,18 +239,29 @@
       // Get the parent function so that we get the right function name.
       func = func.parent_function();
 
+      bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
+      Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
+      Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
+
+      // We first try to serialize the message.  In case the message is not
+      // serializable this will throw an exception.
+      SerializedObjectBuffer message_buffer;
+      {
+        MessageWriter writer(message_buffer.data_buffer(), &malloc_allocator,
+                             &malloc_deallocator,
+                             /* can_send_any_object = */ true,
+                             message_buffer.data_length());
+        writer.WriteMessage(message);
+      }
+
       const char* utf8_package_root =
           packageRoot.IsNull() ? NULL : String2UTF8(packageRoot);
       const char* utf8_package_config =
           packageConfig.IsNull() ? NULL : String2UTF8(packageConfig);
 
-      bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
-      Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
-      Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
-
       IsolateSpawnState* state = new IsolateSpawnState(
           port.Id(), isolate->origin_id(), isolate->init_callback_data(),
-          String2UTF8(script_uri), func, message,
+          String2UTF8(script_uri), func, &message_buffer,
           isolate->spawn_count_monitor(), isolate->spawn_count(),
           utf8_package_root, utf8_package_config, paused.value(), fatal_errors,
           on_exit_port, on_error_port);
@@ -333,14 +351,37 @@
   GET_NATIVE_ARGUMENT(String, packageRoot, arguments->NativeArgAt(10));
   GET_NATIVE_ARGUMENT(String, packageConfig, arguments->NativeArgAt(11));
 
-  if (Snapshot::IncludesCode(Dart::snapshot_kind())) {
+  if (Dart::vm_snapshot_kind() == Snapshot::kAppAOT) {
     const Array& args = Array::Handle(Array::New(1));
-    args.SetAt(0, String::Handle(String::New(
-                      "Isolate.spawnUri not supported under precompilation")));
+    args.SetAt(
+        0,
+        String::Handle(String::New(
+            "Isolate.spawnUri is not supported when using AOT compilation")));
     Exceptions::ThrowByType(Exceptions::kUnsupported, args);
     UNREACHABLE();
   }
 
+  bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
+  Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
+  Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
+
+  // We first try to serialize the arguments and the message.  In case the
+  // arguments or the message are not serializable this will throw an exception.
+  SerializedObjectBuffer arguments_buffer;
+  SerializedObjectBuffer message_buffer;
+  {
+    MessageWriter writer(
+        arguments_buffer.data_buffer(), &malloc_allocator, &malloc_deallocator,
+        /* can_send_any_object = */ false, arguments_buffer.data_length());
+    writer.WriteMessage(args);
+  }
+  {
+    MessageWriter writer(
+        message_buffer.data_buffer(), &malloc_allocator, &malloc_deallocator,
+        /* can_send_any_object = */ false, message_buffer.data_length());
+    writer.WriteMessage(message);
+  }
+
   // Canonicalize the uri with respect to the current isolate.
   const Library& root_lib =
       Library::Handle(isolate->object_store()->root_library());
@@ -356,15 +397,11 @@
   const char* utf8_package_config =
       packageConfig.IsNull() ? NULL : String2UTF8(packageConfig);
 
-  bool fatal_errors = fatalErrors.IsNull() ? true : fatalErrors.value();
-  Dart_Port on_exit_port = onExit.IsNull() ? ILLEGAL_PORT : onExit.Id();
-  Dart_Port on_error_port = onError.IsNull() ? ILLEGAL_PORT : onError.Id();
-
   IsolateSpawnState* state = new IsolateSpawnState(
       port.Id(), isolate->init_callback_data(), canonical_uri,
-      utf8_package_root, utf8_package_config, args, message,
-      isolate->spawn_count_monitor(), isolate->spawn_count(), paused.value(),
-      fatal_errors, on_exit_port, on_error_port);
+      utf8_package_root, utf8_package_config, &arguments_buffer,
+      &message_buffer, isolate->spawn_count_monitor(), isolate->spawn_count(),
+      paused.value(), fatal_errors, on_exit_port, on_error_port);
 
   // If we were passed a value then override the default flags state for
   // checked mode.
@@ -424,7 +461,7 @@
   msg.SetAt(0, Smi::Handle(Smi::New(Message::kIsolateLibOOBMsg)));
 
   uint8_t* data = NULL;
-  MessageWriter writer(&data, &allocator, false);
+  MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
   writer.WriteMessage(msg);
 
   PortMap::PostMessage(new Message(port.Id(), data, writer.BytesWritten(),
diff --git a/runtime/lib/isolate_patch.dart b/runtime/lib/isolate_patch.dart
index 3a02c7a..20b1f6b 100644
--- a/runtime/lib/isolate_patch.dart
+++ b/runtime/lib/isolate_patch.dart
@@ -77,10 +77,10 @@
   StreamController _controller;
 }
 
-typedef void ImmediateCallback();
+typedef void _ImmediateCallback();
 
 /// The callback that has been registered through `scheduleImmediate`.
-ImmediateCallback _pendingImmediateCallback;
+_ImmediateCallback _pendingImmediateCallback;
 
 /// The closure that should be used as scheduleImmediateClosure, when the VM
 /// is responsible for the event loop.
@@ -97,7 +97,7 @@
   }
 }
 
-ImmediateCallback _removePendingImmediateCallback() {
+_ImmediateCallback _removePendingImmediateCallback() {
   var callback = _pendingImmediateCallback;
   _pendingImmediateCallback = null;
   return callback;
diff --git a/runtime/lib/math_patch.dart b/runtime/lib/math_patch.dart
index 1be57ac..7d5e752 100644
--- a/runtime/lib/math_patch.dart
+++ b/runtime/lib/math_patch.dart
@@ -57,15 +57,15 @@
 }
 
 @patch double atan2(num a, num b) => _atan2(a.toDouble(), b.toDouble());
-@patch double sin(num value) => _sin(value.toDouble());
-@patch double cos(num value) => _cos(value.toDouble());
-@patch double tan(num value) => _tan(value.toDouble());
-@patch double acos(num value) => _acos(value.toDouble());
-@patch double asin(num value) => _asin(value.toDouble());
-@patch double atan(num value) => _atan(value.toDouble());
-@patch double sqrt(num value) => _sqrt(value.toDouble());
-@patch double exp(num value) => _exp(value.toDouble());
-@patch double log(num value) => _log(value.toDouble());
+@patch double sin(num x) => _sin(x.toDouble());
+@patch double cos(num x) => _cos(x.toDouble());
+@patch double tan(num x) => _tan(x.toDouble());
+@patch double acos(num x) => _acos(x.toDouble());
+@patch double asin(num x) => _asin(x.toDouble());
+@patch double atan(num x) => _atan(x.toDouble());
+@patch double sqrt(num x) => _sqrt(x.toDouble());
+@patch double exp(num x) => _exp(x.toDouble());
+@patch double log(num x) => _log(x.toDouble());
 
 double _atan2(double a, double b) native "Math_atan2";
 double _sin(double x) native "Math_sin";
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 7a2efe0..615699a 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -11,6 +11,7 @@
 #include "vm/dart_entry.h"
 #include "vm/exceptions.h"
 #include "vm/flags.h"
+#include "vm/kernel_to_il.h"
 #include "vm/object_store.h"
 #include "vm/parser.h"
 #include "vm/port.h"
@@ -19,7 +20,7 @@
 
 namespace dart {
 
-#ifndef PRODUCT
+#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
 
 #define PROPAGATE_IF_MALFORMED(type)                                           \
   if (type.IsMalformed()) {                                                    \
@@ -150,8 +151,15 @@
     // * The default value of a parameter.
     // * Whether a parameters has been declared as final.
     // * Any metadata associated with the parameter.
-    const Object& result =
-        Object::Handle(Parser::ParseFunctionParameters(func));
+    Object& result = Object::Handle();
+
+    kernel::TreeNode* kernel_node =
+        reinterpret_cast<kernel::TreeNode*>(func.kernel_function());
+    if (kernel_node != NULL) {
+      result = kernel::BuildParameterDescriptor(kernel_node);
+    } else {
+      result = Parser::ParseFunctionParameters(func);
+    }
     if (result.IsError()) {
       Exceptions::PropagateError(Error::Cast(result));
       UNREACHABLE();
@@ -670,7 +678,7 @@
       return field.StaticValue();
     }
     // An uninitialized field was found.  Check for a getter in the field's
-    // owner classs.
+    // owner class.
     const Class& klass = Class::Handle(field.Owner());
     const String& internal_getter_name =
         String::Handle(Field::GetterName(getter_name));
@@ -819,6 +827,70 @@
 }
 
 
+DEFINE_NATIVE_ENTRY(Mirrors_instantiateGenericType, 2) {
+  GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, type, arguments->NativeArgAt(0));
+  GET_NON_NULL_NATIVE_ARGUMENT(Array, args, arguments->NativeArgAt(1));
+
+  ASSERT(type.HasResolvedTypeClass());
+  const Class& clz = Class::Handle(type.type_class());
+  if (!clz.IsGeneric()) {
+    const Array& error_args = Array::Handle(Array::New(3));
+    error_args.SetAt(0, type);
+    error_args.SetAt(1, String::Handle(String::New("key")));
+    error_args.SetAt(2, String::Handle(String::New(
+                            "Type must be a generic class or function.")));
+    Exceptions::ThrowByType(Exceptions::kArgumentValue, error_args);
+    UNREACHABLE();
+  }
+  if (clz.NumTypeParameters() != args.Length()) {
+    const Array& error_args = Array::Handle(Array::New(3));
+    error_args.SetAt(0, args);
+    error_args.SetAt(1, String::Handle(String::New("typeArguments")));
+    error_args.SetAt(2, String::Handle(String::New(
+                            "Number of type arguments does not match.")));
+    Exceptions::ThrowByType(Exceptions::kArgumentValue, error_args);
+    UNREACHABLE();
+  }
+
+  intptr_t num_expected_type_arguments = args.Length();
+  TypeArguments& type_args_obj = TypeArguments::Handle();
+  type_args_obj ^= TypeArguments::New(num_expected_type_arguments);
+  AbstractType& type_arg = AbstractType::Handle();
+  Instance& instance = Instance::Handle();
+  for (intptr_t i = 0; i < args.Length(); i++) {
+    instance ^= args.At(i);
+    if (!instance.IsType()) {
+      const Array& error_args = Array::Handle(Array::New(3));
+      error_args.SetAt(0, args);
+      error_args.SetAt(1, String::Handle(String::New("typeArguments")));
+      error_args.SetAt(2, String::Handle(String::New(
+                              "Type arguments must be instances of Type.")));
+      Exceptions::ThrowByType(Exceptions::kArgumentValue, error_args);
+      UNREACHABLE();
+    }
+    type_arg ^= args.At(i);
+    type_args_obj.SetTypeAt(i, type_arg);
+  }
+
+  Type& instantiated_type =
+      Type::Handle(Type::New(clz, type_args_obj, TokenPosition::kNoSource));
+  instantiated_type ^= ClassFinalizer::FinalizeType(
+      clz, instantiated_type, ClassFinalizer::kCanonicalize);
+  if (instantiated_type.IsMalbounded()) {
+    const LanguageError& type_error =
+        LanguageError::Handle(instantiated_type.error());
+    const Array& error_args = Array::Handle(Array::New(3));
+    error_args.SetAt(0, args);
+    error_args.SetAt(1, String::Handle(String::New("typeArguments")));
+    error_args.SetAt(2, String::Handle(type_error.FormatMessage()));
+    Exceptions::ThrowByType(Exceptions::kArgumentValue, error_args);
+    UNREACHABLE();
+  }
+
+  return instantiated_type.raw();
+}
+
+
 DEFINE_NATIVE_ENTRY(Mirrors_mangleName, 2) {
   GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0));
   GET_NON_NULL_NATIVE_ARGUMENT(MirrorReference, ref, arguments->NativeArgAt(1));
@@ -852,7 +924,7 @@
   if (decl.IsClass()) {
     klass ^= decl.raw();
     library = klass.library();
-  } else if (decl.IsFunction()) {
+  } else if (decl.IsFunction() && !Function::Cast(decl).IsSignatureFunction()) {
     klass = Function::Cast(decl).origin();
     library = klass.library();
   } else if (decl.IsField()) {
@@ -1667,8 +1739,7 @@
       Array::Handle(ArgumentsDescriptor::New(args.Length(), arg_names));
 
   ArgumentsDescriptor args_descriptor(args_descriptor_array);
-  if (!redirected_constructor.AreValidArguments(args_descriptor, NULL) ||
-      !redirected_constructor.is_reflectable()) {
+  if (!redirected_constructor.AreValidArguments(args_descriptor, NULL)) {
     external_constructor_name = redirected_constructor.name();
     ThrowNoSuchMethod(AbstractType::Handle(klass.RareType()),
                       external_constructor_name, redirected_constructor,
@@ -2021,6 +2092,6 @@
   return Bool::Get(a.IsSubtypeOf(b, NULL, NULL, Heap::kNew)).raw();
 }
 
-#endif  // !PRODUCT
+#endif  // !PRODUCT && !DART_PRECOMPILED_RUNTIME
 
 }  // namespace dart
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index 0305f12..f152adb 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -4,9 +4,8 @@
 
 // VM-specific implementation of the dart:mirrors library.
 
-var dirty = false;
-final emptyList = new UnmodifiableListView([]);
-final emptyMap = new UnmodifiableMapView({});
+var _dirty = false;
+final _emptyList = new UnmodifiableListView([]);
 
 class _InternalMirrorError {
   final String _msg;
@@ -220,10 +219,10 @@
 
   var _libraries;
   Map<Uri, LibraryMirror> get libraries {
-    if ((_libraries == null) || dirty) {
+    if ((_libraries == null) || _dirty) {
       _libraries = new Map<Uri, LibraryMirror>.fromIterable(
           _computeLibraries(), key: (e) => e.uri);
-      dirty = false;
+      _dirty = false;
     }
     return _libraries;
   }
@@ -303,13 +302,13 @@
 
   TypeMirror get returnType => _target.type;
   List<ParameterMirror> get parameters {
-    if (isGetter) return emptyList;
+    if (isGetter) return _emptyList;
     return new UnmodifiableListView(
         [new _SyntheticSetterParameter(this, this._target)]);
   }
 
   SourceLocation get location => null;
-  List<InstanceMirror> get metadata => emptyList;
+  List<InstanceMirror> get metadata => _emptyList;
   String get source => null;
 }
 
@@ -333,7 +332,7 @@
   bool get hasDefaultValue => false;
   InstanceMirror get defaultValue => null;
   SourceLocation get location => null;
-  List<InstanceMirror> get metadata => emptyList;
+  List<InstanceMirror> get metadata => _emptyList;
 }
 
 abstract class _LocalObjectMirror extends _LocalMirror implements ObjectMirror {
@@ -787,7 +786,7 @@
   List<TypeVariableMirror> _typeVariables = null;
   List<TypeVariableMirror> get typeVariables {
     if (_typeVariables == null) {
-      if (_isAnonymousMixinApplication) return _typeVariables = emptyList;
+      if (_isAnonymousMixinApplication) return _typeVariables = _emptyList;
       _typeVariables = new List<TypeVariableMirror>();
 
       List params = _ClassMirror_type_variables(_reflectee);
@@ -807,7 +806,7 @@
   List<TypeMirror> get typeArguments {
     if(_typeArguments == null) {
       if(_isGenericDeclaration || _isAnonymousMixinApplication) {
-        _typeArguments = emptyList;
+        _typeArguments = _emptyList;
       } else {
         _typeArguments =
             new UnmodifiableListView(_computeTypeArguments(_reflectedType));
@@ -986,9 +985,9 @@
 
   bool get isOriginalDeclaration => true;
   get originalDeclaration => this;
-  get typeVariables => emptyList;
-  get typeArguments => emptyList;
-  get metadata => emptyList;
+  get typeVariables => _emptyList;
+  get typeArguments => _emptyList;
+  get metadata => _emptyList;
   get location => null;
 
   String toString() => "FunctionTypeMirror on '${_n(simpleName)}'";
@@ -1072,8 +1071,8 @@
   }
   Type get _reflectedType => _reflectee;
 
-  List<TypeVariableMirror> get typeVariables => emptyList;
-  List<TypeMirror> get typeArguments => emptyList;
+  List<TypeVariableMirror> get typeVariables => _emptyList;
+  List<TypeMirror> get typeArguments => _emptyList;
 
   bool get isOriginalDeclaration => true;
   TypeMirror get originalDeclaration => this;
@@ -1181,7 +1180,7 @@
   List<TypeMirror> get typeArguments {
     if(_typeArguments == null) {
       if(_isGenericDeclaration) {
-        _typeArguments = emptyList;
+        _typeArguments = _emptyList;
       } else {
         _typeArguments = new UnmodifiableListView(
             _LocalClassMirror._computeTypeArguments(_reflectedType));
@@ -1558,7 +1557,7 @@
   }
 
   List<InstanceMirror> get metadata {
-    if (_unmirroredMetadata == null) return emptyList;
+    if (_unmirroredMetadata == null) return _emptyList;
     return new UnmodifiableListView(_unmirroredMetadata.map(reflect));
   }
 
@@ -1593,7 +1592,7 @@
   DeclarationMirror get owner => null;
 
   SourceLocation get location => null;
-  List<InstanceMirror> get metadata => emptyList;
+  List<InstanceMirror> get metadata => _emptyList;
 
   bool get hasReflectedType => simpleName == #dynamic;
   Type get reflectedType {
@@ -1601,8 +1600,8 @@
     throw new UnsupportedError("void has no reflected type");
   }
 
-  List<TypeVariableMirror> get typeVariables => emptyList;
-  List<TypeMirror> get typeArguments => emptyList;
+  List<TypeVariableMirror> get typeVariables => _emptyList;
+  List<TypeMirror> get typeArguments => _emptyList;
 
   bool get isOriginalDeclaration => true;
   TypeMirror get originalDeclaration => this;
@@ -1646,6 +1645,8 @@
       native "Mirrors_makeLocalClassMirror";
   static TypeMirror makeLocalTypeMirror(Type key)
       native "Mirrors_makeLocalTypeMirror";
+  static Type instantiateGenericType(Type key, typeArguments)
+      native "Mirrors_instantiateGenericType";
 
   static Expando<ClassMirror> _declarationCache = new Expando("ClassMirror");
   static Expando<TypeMirror> _instantiationCache = new Expando("TypeMirror");
@@ -1662,7 +1663,10 @@
     return classMirror;
   }
 
-  static TypeMirror reflectType(Type key) {
+  static TypeMirror reflectType(Type key, [List<Type> typeArguments]) {
+    if (typeArguments != null) {
+      key = _instantiateType(key, typeArguments);
+    }
     var typeMirror = _instantiationCache[key];
     if (typeMirror == null) {
       typeMirror = makeLocalTypeMirror(key);
@@ -1673,4 +1677,12 @@
     }
     return typeMirror;
   }
+
+  static Type _instantiateType(Type key, List<Type> typeArguments) {
+    if (typeArguments.isEmpty) {
+      throw new ArgumentError.value(
+        typeArguments, 'typeArguments', 'Type arguments list cannot be empty.');
+    }
+    return instantiateGenericType(key, typeArguments.toList(growable: false));
+  }
 }
diff --git a/runtime/lib/mirrors_patch.dart b/runtime/lib/mirrors_patch.dart
index 03bd1b6..c168026 100644
--- a/runtime/lib/mirrors_patch.dart
+++ b/runtime/lib/mirrors_patch.dart
@@ -33,8 +33,8 @@
   return _Mirrors.reflectClass(key);
 }
 
-@patch TypeMirror reflectType(Type key) {
-  return _Mirrors.reflectType(key);
+@patch TypeMirror reflectType(Type key, [List<Type> typeArguments]) {
+  return _Mirrors.reflectType(key, typeArguments);
 }
 
 @patch class MirrorSystem {
diff --git a/runtime/lib/null_patch.dart b/runtime/lib/null_patch.dart
index 0f22e67..eb5db12 100644
--- a/runtime/lib/null_patch.dart
+++ b/runtime/lib/null_patch.dart
@@ -6,6 +6,9 @@
 
 @patch class Null {
   static const _HASH_CODE = 2011; // The year Dart was announced and a prime.
+
+  @patch
   int get hashCode => _HASH_CODE;
+
   int get _identityHashCode => _HASH_CODE;
 }
diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
index 6a7db55..b67da4f 100644
--- a/runtime/lib/object.cc
+++ b/runtime/lib/object.cc
@@ -18,14 +18,14 @@
 DECLARE_FLAG(bool, trace_type_checks);
 
 // Helper function in stacktrace.cc.
-void _printCurrentStacktrace();
+void _printCurrentStackTrace();
 
 DEFINE_NATIVE_ENTRY(DartCore_fatal, 1) {
   // The core library code entered an unrecoverable state.
   const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
   const char* msg = instance.ToCString();
   OS::PrintErr("Fatal error in dart:core\n");
-  _printCurrentStacktrace();
+  _printCurrentStackTrace();
   FATAL(msg);
   return Object::null();
 }
@@ -311,10 +311,8 @@
   ASSERT(!type.IsMalformed());
   ASSERT(!type.IsMalbounded());
   Error& bound_error = Error::Handle(zone);
-  if (instance.IsNull()) {
-    return instance.raw();
-  }
   const bool is_instance_of =
+      instance.IsNull() ||
       instance.IsInstanceOf(type, instantiator_type_arguments, &bound_error);
   if (FLAG_trace_type_checks) {
     const char* result_str = is_instance_of ? "true" : "false";
diff --git a/runtime/lib/profiler.dart b/runtime/lib/profiler.dart
index b60760a..acf6f58 100644
--- a/runtime/lib/profiler.dart
+++ b/runtime/lib/profiler.dart
@@ -9,7 +9,6 @@
   @patch static UserTag get defaultTag => _getDefaultTag();
 }
 
-
 class _UserTag implements UserTag {
   factory _UserTag(String label) native "UserTag_new";
   String get label native "UserTag_label";
diff --git a/runtime/lib/stacktrace.cc b/runtime/lib/stacktrace.cc
index dcc4834..d7dcfe0 100644
--- a/runtime/lib/stacktrace.cc
+++ b/runtime/lib/stacktrace.cc
@@ -34,10 +34,10 @@
   }
 }
 
-// Creates a Stacktrace object from the current stack.
+// Creates a StackTrace object from the current stack.
 //
 // Skips the first skip_frames Dart frames.
-const Stacktrace& GetCurrentStacktrace(int skip_frames) {
+const StackTrace& GetCurrentStackTrace(int skip_frames) {
   const GrowableObjectArray& code_list =
       GrowableObjectArray::Handle(GrowableObjectArray::New());
   const GrowableObjectArray& pc_offset_list =
@@ -46,8 +46,8 @@
   const Array& code_array = Array::Handle(Array::MakeArray(code_list));
   const Array& pc_offset_array =
       Array::Handle(Array::MakeArray(pc_offset_list));
-  const Stacktrace& stacktrace =
-      Stacktrace::Handle(Stacktrace::New(code_array, pc_offset_array));
+  const StackTrace& stacktrace =
+      StackTrace::Handle(StackTrace::New(code_array, pc_offset_array));
   return stacktrace;
 }
 
@@ -56,13 +56,13 @@
 // valid exit frame information. It will not work when a breakpoint is
 // set in dart code and control is got inside 'gdb' without going through
 // the runtime or native transition stub.
-void _printCurrentStacktrace() {
-  const Stacktrace& stacktrace = GetCurrentStacktrace(0);
+void _printCurrentStackTrace() {
+  const StackTrace& stacktrace = GetCurrentStackTrace(0);
   OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString());
 }
 
-// Like _printCurrentStacktrace, but works in a NoSafepointScope.
-void _printCurrentStacktraceNoSafepoint() {
+// Like _printCurrentStackTrace, but works in a NoSafepointScope.
+void _printCurrentStackTraceNoSafepoint() {
   StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
   StackFrame* frame = frames.NextFrame();
   while (frame != NULL) {
@@ -72,7 +72,7 @@
 }
 
 DEFINE_NATIVE_ENTRY(StackTrace_current, 0) {
-  const Stacktrace& stacktrace = GetCurrentStacktrace(1);
+  const StackTrace& stacktrace = GetCurrentStackTrace(1);
   return stacktrace.raw();
 }
 
diff --git a/runtime/lib/stacktrace.h b/runtime/lib/stacktrace.h
index e6bccae..fe67a9d 100644
--- a/runtime/lib/stacktrace.h
+++ b/runtime/lib/stacktrace.h
@@ -7,14 +7,14 @@
 
 namespace dart {
 
-class Stacktrace;
+class StackTrace;
 
-// Creates a Stacktrace object from the current stack.  Skips the
+// Creates a StackTrace object from the current stack.  Skips the
 // first skip_frames Dart frames.
 //
 // This function is exposed to provide stack trace printing in
 // assertion failures, etc.
-const Stacktrace& GetCurrentStacktrace(int skip_frames);
+const StackTrace& GetCurrentStackTrace(int skip_frames);
 
 }  // namespace dart
 
diff --git a/runtime/lib/timeline.dart b/runtime/lib/timeline.dart
index b2aa165..55a40e8 100644
--- a/runtime/lib/timeline.dart
+++ b/runtime/lib/timeline.dart
@@ -22,7 +22,7 @@
 
 @patch void _reportCompleteEvent(
      int start,
-     int end,
+     int startCpu,
      String category,
      String name,
      String argumentsAsJson) native "Timeline_reportCompleteEvent";
diff --git a/runtime/lib/typed_data.dart b/runtime/lib/typed_data.dart
deleted file mode 100644
index 0875fbc..0000000
--- a/runtime/lib/typed_data.dart
+++ /dev/null
@@ -1,4258 +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.
-
-// Unlike the other SDK libraries, this file is not a patch that is applied to
-// dart:typed_data.  Instead, it completely replaces the implementation from the
-// SDK.
-library dart.typed_data;
-
-import "dart:_internal";
-import "dart:collection" show ListBase;
-import 'dart:math' show Random;
-
-/**
- * A typed view of a sequence of bytes.
- */
-abstract class TypedData {
-  /**
-   * Returns the number of bytes in the representation of each element in this
-   * list.
-   */
-  int get elementSizeInBytes;
-
-  /**
-   * Returns the offset in bytes into the underlying byte buffer of this view.
-   */
-  int get offsetInBytes;
-
-  /**
-   * Returns the length of this view, in bytes.
-   */
-  int get lengthInBytes;
-
-  /**
-   * Returns the byte buffer associated with this object.
-   */
-  ByteBuffer get buffer;
-}
-
-
-/**
- * Describes endianness to be used when accessing or updating a
- * sequence of bytes.
- */
-class Endianness {
-  const Endianness._(this._littleEndian);
-
-  static const Endianness BIG_ENDIAN = const Endianness._(false);
-  static const Endianness LITTLE_ENDIAN = const Endianness._(true);
-  static final Endianness HOST_ENDIAN =
-    (new ByteData.view(new Uint16List.fromList([1]).buffer)).getInt8(0) == 1 ?
-    LITTLE_ENDIAN : BIG_ENDIAN;
-
-  final bool _littleEndian;
-}
-
-
-/**
- * A fixed-length, random-access sequence of bytes that also provides random
- * and unaligned access to the fixed-width integers and floating point
- * numbers represented by those bytes.
- *
- * `ByteData` may be used to pack and unpack data from external sources
- * (such as networks or files systems), and to process large quantities
- * of numerical data more efficiently than would be possible
- * with ordinary [List] implementations.
- * `ByteData` can save space, by eliminating the need for object headers,
- * and time, by eliminating the need for data copies.
- * Finally, `ByteData` may be used to intentionally reinterpret the bytes
- * representing one arithmetic type as another.
- * For example this code fragment determine what 32-bit signed integer
- * is represented by the bytes of a 32-bit floating point number:
- *
- *     var buffer = new Uint8List(8).buffer;
- *     var bdata = new ByteData.view(buffer);
- *     bdata.setFloat32(0, 3.04);
- *     int huh = bdata.getInt32(0);
- */
-class ByteData implements TypedData {
-  /**
-   * Creates a [ByteData] of the specified length (in elements), all of
-   * whose bytes are initially zero.
-   */
-  factory ByteData(int length) {
-    var list = new Uint8List(length);
-    return new _ByteDataView(list, 0, length);
-  }
-
-  // Called directly from C code.
-  factory ByteData._view(TypedData typedData, int offsetInBytes, int length) {
-    return new _ByteDataView(typedData, offsetInBytes, length);
-  }
-
-  /**
-   * Creates an [ByteData] _view_ of the specified region in [buffer].
-   *
-   * Changes in the [ByteData] will be visible in the byte
-   * buffer and vice versa.
-   * If the [offsetInBytes] index of the region is not specified,
-   * it defaults to zero (the first byte in the byte buffer).
-   * If the length is not specified, it defaults to `null`,
-   * which indicates that the view extends to the end of the byte buffer.
-   *
-   * Throws [RangeError] if [offsetInBytes] or [length] are negative, or
-   * if [offsetInBytes] + ([length] * elementSizeInBytes) is greater than
-   * the length of [buffer].
-   */
-  factory ByteData.view(ByteBuffer buffer,
-                        [int offsetInBytes = 0, int length]) {
-    return buffer.asByteData(offsetInBytes, length);
-  }
-
-  /**
-   * Returns the (possibly negative) integer represented by the byte at the
-   * specified [byteOffset] in this object, in two's complement binary
-   * representation.
-   *
-   * The return value will be between -128 and 127, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * greater than or equal to the length of this object.
-   */
-  int getInt8(int byteOffset);
-
-  /**
-   * Sets the byte at the specified [byteOffset] in this object to the
-   * two's complement binary representation of the specified [value], which
-   * must fit in a single byte.
-   *
-   * In other words, [value] must be between -128 and 127, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * greater than or equal to the length of this object.
-   */
-  void setInt8(int byteOffset, int value);
-
-  /**
-   * Returns the positive integer represented by the byte at the specified
-   * [byteOffset] in this object, in unsigned binary form.
-   *
-   * The return value will be between 0 and 255, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * greater than or equal to the length of this object.
-   */
-  int getUint8(int byteOffset);
-
-  /**
-   * Sets the byte at the specified [byteOffset] in this object to the
-   * unsigned binary representation of the specified [value], which must fit
-   * in a single byte.
-   *
-   * In other words, [value] must be between 0 and 255, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative,
-   * or greater than or equal to the length of this object.
-   */
-  void setUint8(int byteOffset, int value);
-
-  /**
-   * Returns the (possibly negative) integer represented by the two bytes at
-   * the specified [byteOffset] in this object, in two's complement binary
-   * form.
-   *
-   * The return value will be between 2<sup>15</sup> and 2<sup>15</sup> - 1,
-   * inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 2` is greater than the length of this object.
-   */
-  int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Sets the two bytes starting at the specified [byteOffset] in this
-   * object to the two's complement binary representation of the specified
-   * [value], which must fit in two bytes.
-   *
-   * In other words, [value] must lie
-   * between 2<sup>15</sup> and 2<sup>15</sup> - 1, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 2` is greater than the length of this object.
-   */
-  void setInt16(int byteOffset,
-                int value,
-                [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Returns the positive integer represented by the two bytes starting
-   * at the specified [byteOffset] in this object, in unsigned binary
-   * form.
-   *
-   * The return value will be between 0 and  2<sup>16</sup> - 1, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 2` is greater than the length of this object.
-   */
-  int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Sets the two bytes starting at the specified [byteOffset] in this object
-   * to the unsigned binary representation of the specified [value],
-   * which must fit in two bytes.
-   *
-   * In other words, [value] must be between
-   * 0 and 2<sup>16</sup> - 1, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 2` is greater than the length of this object.
-   */
-  void setUint16(int byteOffset,
-                 int value,
-                 [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Returns the (possibly negative) integer represented by the four bytes at
-   * the specified [byteOffset] in this object, in two's complement binary
-   * form.
-   *
-   * The return value will be between 2<sup>31</sup> and 2<sup>31</sup> - 1,
-   * inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 4` is greater than the length of this object.
-   */
-  int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Sets the four bytes starting at the specified [byteOffset] in this
-   * object to the two's complement binary representation of the specified
-   * [value], which must fit in four bytes.
-   *
-   * In other words, [value] must lie
-   * between 2<sup>31</sup> and 2<sup>31</sup> - 1, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 4` is greater than the length of this object.
-   */
-  void setInt32(int byteOffset,
-                int value,
-                [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Returns the positive integer represented by the four bytes starting
-   * at the specified [byteOffset] in this object, in unsigned binary
-   * form.
-   *
-   * The return value will be between 0 and  2<sup>32</sup> - 1, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 4` is greater than the length of this object.
-   */
-  int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Sets the four bytes starting at the specified [byteOffset] in this object
-   * to the unsigned binary representation of the specified [value],
-   * which must fit in four bytes.
-   *
-   * In other words, [value] must be between
-   * 0 and 2<sup>32</sup> - 1, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 4` is greater than the length of this object.
-   */
-  void setUint32(int byteOffset,
-                 int value,
-                 [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Returns the (possibly negative) integer represented by the eight bytes at
-   * the specified [byteOffset] in this object, in two's complement binary
-   * form.
-   *
-   * The return value will be between 2<sup>63</sup> and 2<sup>63</sup> - 1,
-   * inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 8` is greater than the length of this object.
-   */
-  int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Sets the eight bytes starting at the specified [byteOffset] in this
-   * object to the two's complement binary representation of the specified
-   * [value], which must fit in eight bytes.
-   *
-   * In other words, [value] must lie
-   * between 2<sup>63</sup> and 2<sup>63</sup> - 1, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 8` is greater than the length of this object.
-   */
-  void setInt64(int byteOffset,
-                int value,
-                [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Returns the positive integer represented by the eight bytes starting
-   * at the specified [byteOffset] in this object, in unsigned binary
-   * form.
-   *
-   * The return value will be between 0 and  2<sup>64</sup> - 1, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 8` is greater than the length of this object.
-   */
-  int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Sets the eight bytes starting at the specified [byteOffset] in this object
-   * to the unsigned binary representation of the specified [value],
-   * which must fit in eight bytes.
-   *
-   * In other words, [value] must be between
-   * 0 and 2<sup>64</sup> - 1, inclusive.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 8` is greater than the length of this object.
-   */
-  void setUint64(int byteOffset,
-                 int value,
-                 [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Returns the floating point number represented by the four bytes at
-   * the specified [byteOffset] in this object, in IEEE 754
-   * single-precision binary floating-point format (binary32).
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 4` is greater than the length of this object.
-   */
-  double getFloat32(int byteOffset,
-                    [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Sets the four bytes starting at the specified [byteOffset] in this
-   * object to the IEEE 754 single-precision binary floating-point
-   * (binary32) representation of the specified [value].
-   *
-   * **Note that this method can lose precision.** The input [value] is
-   * a 64-bit floating point value, which will be converted to 32-bit
-   * floating point value by IEEE 754 rounding rules before it is stored.
-   * If [value] cannot be represented exactly as a binary32, it will be
-   * converted to the nearest binary32 value.  If two binary32 values are
-   * equally close, the one whose least significant bit is zero will be used.
-   * Note that finite (but large) values can be converted to infinity, and
-   * small non-zero values can be converted to zero.
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 4` is greater than the length of this object.
-   */
-  void setFloat32(int byteOffset,
-                  double value,
-                  [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Returns the floating point number represented by the eight bytes at
-   * the specified [byteOffset] in this object, in IEEE 754
-   * double-precision binary floating-point format (binary64).
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 8` is greater than the length of this object.
-   */
-  double getFloat64(int byteOffset,
-                    [Endianness endian = Endianness.BIG_ENDIAN]);
-
-  /**
-   * Sets the eight bytes starting at the specified [byteOffset] in this
-   * object to the IEEE 754 double-precision binary floating-point
-   * (binary64) representation of the specified [value].
-   *
-   * Throws [RangeError] if [byteOffset] is negative, or
-   * `byteOffset + 8` is greater than the length of this object.
-   */
-  void setFloat64(int byteOffset,
-                  double value,
-                  [Endianness endian = Endianness.BIG_ENDIAN]);
-}
-
-
-// Based class for _TypedList that provides common methods for implementing
-// the collection and list interfaces.
-// This class does not extend ListBase<T> since that would add type arguments
-// to instances of _TypeListBase. Instead the subclasses use type specific
-// mixins (like _IntListMixin, _DoubleListMixin) to implement ListBase<T>.
-abstract class _TypedListBase {
-
-  // Method(s) implementing the Collection interface.
-  bool contains(element) {
-    var len = this.length;
-    for (var i = 0; i < len; ++i) {
-      if (this[i] == element) return true;
-    }
-    return false;
-  }
-
-  void forEach(void f(element)) {
-    var len = this.length;
-    for (var i = 0; i < len; i++) {
-      f(this[i]);
-    }
-  }
-
-  String join([String separator = ""]) {
-    StringBuffer buffer = new StringBuffer();
-    buffer.writeAll(this, separator);
-    return buffer.toString();
-  }
-
-  dynamic reduce(dynamic combine(value, element)) {
-    var len = this.length;
-    if (len == 0) throw IterableElementError.noElement();
-    var i = 0;
-    var value = this[0];
-    for (var i = 1; i < len; ++i) {
-      value = combine(value, this[i]);
-    }
-    return value;
-  }
-
-  dynamic fold(dynamic initialValue,
-               dynamic combine(dynamic initialValue, element)) {
-    var len = this.length;
-    for (var i = 0; i < len; ++i) {
-      initialValue = combine(initialValue, this[i]);
-    }
-    return initialValue;
-  }
-
-  Iterable map(f(element)) => new MappedIterable(this, f);
-
-  Iterable expand(Iterable f(element)) => new ExpandIterable(this, f);
-
-  bool every(bool f(element)) {
-    var len = this.length;
-    for (var i = 0; i < len; ++i) {
-      if (!f(this[i])) return false;
-    }
-    return true;
-  }
-
-  bool any(bool f(element)) {
-    var len = this.length;
-    for (var i = 0; i < len; ++i) {
-      if (f(this[i])) return true;
-    }
-    return false;
-  }
-
-  dynamic firstWhere(bool test(element), {orElse()}) {
-    var len = this.length;
-    for (var i = 0; i < len; ++i) {
-      var element = this[i];
-      if (test(element)) return element;
-    }
-    if (orElse != null) return orElse();
-    throw IterableElementError.noElement();
-  }
-
-  dynamic lastWhere(bool test(element), {orElse()}) {
-    var result = null;
-    var len = this.length;
-    for (var i = len - 1; i >= 0; --i) {
-      var element = this[i];
-      if (test(element)) {
-        return element;
-      }
-    }
-    if (orElse != null) return orElse();
-    throw IterableElementError.noElement();
-  }
-
-  dynamic singleWhere(bool test(element)) {
-    var result = null;
-    bool foundMatching = false;
-    var len = this.length;
-    for (var i = 0; i < len; ++i) {
-      var element = this[i];
-      if (test(element)) {
-        if (foundMatching) {
-          throw IterableElementError.tooMany();
-        }
-        result = element;
-        foundMatching = true;
-      }
-    }
-    if (foundMatching) return result;
-    throw IterableElementError.noElement();
-  }
-
-  dynamic elementAt(int index) {
-    return this[index];
-  }
-
-  bool get isEmpty {
-    return this.length == 0;
-  }
-
-  bool get isNotEmpty => !isEmpty;
-
-  // Method(s) implementing the List interface.
-
-  set length(newLength) {
-    throw new UnsupportedError(
-        "Cannot resize a fixed-length list");
-  }
-
-  void add(value) {
-    throw new UnsupportedError(
-        "Cannot add to a fixed-length list");
-  }
-
-  void addAll(Iterable value) {
-    throw new UnsupportedError(
-        "Cannot add to a fixed-length list");
-  }
-
-  void insert(int index, value) {
-    throw new UnsupportedError(
-        "Cannot insert into a fixed-length list");
-  }
-
-  void insertAll(int index, Iterable values) {
-    throw new UnsupportedError(
-        "Cannot insert into a fixed-length list");
-  }
-
-  void sort([int compare(a, b)]) {
-    if (compare == null) compare = Comparable.compare;
-    Sort.sort(this, compare);
-  }
-
-  void shuffle([Random random]) {
-    if (random == null) random = new Random();
-    var i = this.length;
-    while (i > 1) {
-      int pos = random.nextInt(i);
-      i -= 1;
-      var tmp = this[i];
-      this[i] = this[pos];
-      this[pos] = tmp;
-    }
-  }
-
-  int indexOf(element, [int start = 0]) {
-    return Lists.indexOf(this, element, start, this.length);
-  }
-
-  int lastIndexOf(element, [int start = null]) {
-    if (start == null) start = this.length - 1;
-    return Lists.lastIndexOf(this, element, start);
-  }
-
-  void clear() {
-    throw new UnsupportedError(
-        "Cannot remove from a fixed-length list");
-  }
-
-  int removeLast() {
-    throw new UnsupportedError(
-        "Cannot remove from a fixed-length list");
-  }
-
-  bool remove(Object element) {
-    throw new UnsupportedError(
-        "Cannot remove from a fixed-length list");
-  }
-
-  bool removeAt(int index) {
-    throw new UnsupportedError(
-        "Cannot remove from a fixed-length list");
-  }
-
-  void removeWhere(bool test(element)) {
-    throw new UnsupportedError(
-        "Cannot remove from a fixed-length list");
-  }
-
-  void retainWhere(bool test(element)) {
-    throw new UnsupportedError(
-        "Cannot remove from a fixed-length list");
-  }
-
-  dynamic get first {
-    if (length > 0) return this[0];
-    throw IterableElementError.noElement();
-  }
-
-  dynamic get last {
-    if (length > 0) return this[length - 1];
-    throw IterableElementError.noElement();
-  }
-
-  dynamic get single {
-    if (length == 1) return this[0];
-    if (length == 0) throw IterableElementError.noElement();
-    throw IterableElementError.tooMany();
-  }
-
-  void removeRange(int start, int end) {
-    throw new UnsupportedError(
-        "Cannot remove from a fixed-length list");
-  }
-
-  void replaceRange(int start, int end, Iterable iterable) {
-    throw new UnsupportedError(
-        "Cannot remove from a fixed-length list");
-  }
-
-  List toList({bool growable: true}) {
-    return new List.from(this, growable: growable);
-  }
-
-  Set toSet() {
-    return new Set.from(this);
-  }
-
-  List sublist(int start, [int end]) {
-    end = RangeError.checkValidRange(start, end, this.length);
-    var length = end - start;
-    List result = _createList(length);
-    result.setRange(0, length, this, start);
-    return result;
-  }
-
-  void setRange(int start, int end, Iterable from, [int skipCount = 0]) {
-    // Check ranges.
-    if (0 > start || start > end || end > length) {
-      RangeError.checkValidRange(start, end, length);  // Always throws.
-      assert(false);
-    }
-    if (skipCount < 0) {
-      throw new ArgumentError(skipCount);
-    }
-
-    final count = end - start;
-    if ((from.length - skipCount) < count) {
-      throw IterableElementError.tooFew();
-    }
-
-    if (from is _TypedListBase) {
-      if (this.elementSizeInBytes == from.elementSizeInBytes) {
-        if ((count < 10) && (from.buffer != this.buffer)) {
-          Lists.copy(from, skipCount, this, start, count);
-          return;
-        } else if (this.buffer._data._setRange(
-              start * elementSizeInBytes + this.offsetInBytes,
-              count * elementSizeInBytes,
-              from.buffer._data,
-              skipCount * elementSizeInBytes + from.offsetInBytes,
-              ClassID.getID(this), ClassID.getID(from))) {
-          return;
-        }
-      } else if (from.buffer == this.buffer) {
-        // Different element sizes, but same buffer means that we need
-        // an intermediate structure.
-        // TODO(srdjan): Optimize to skip copying if the range does not overlap.
-        final temp_buffer = new List(count);
-        for (var i = 0; i < count; i++) {
-          temp_buffer[i] = from[skipCount + i];
-        }
-        for (var i = start; i < end; i++) {
-          this[i] = temp_buffer[i - start];
-        }
-        return;
-      }
-    }
-
-    if (count == 0) return;
-    List otherList;
-    int otherStart;
-    if (from is List) {
-      otherList = from;
-      otherStart = skipCount;
-    } else {
-      otherList = from.skip(skipCount).toList(growable: false);
-      otherStart = 0;
-    }
-    if (otherStart + count > otherList.length) {
-      throw IterableElementError.tooFew();
-    }
-    Lists.copy(otherList, otherStart, this, start, count);
-  }
-
-  void setAll(int index, Iterable iterable) {
-    final end = iterable.length + index;
-    setRange(index, end, iterable);
-  }
-
-  void fillRange(int start, int end, [fillValue]) {
-    RangeError.checkValidRange(start, end, this.length);
-    for (var i = start; i < end; ++i) {
-      this[i] = fillValue;
-    }
-  }
-
-
-  // Method(s) implementing Object interface.
-
-  String toString() => ListBase.listToString(this);
-
-
-  // Internal utility methods.
-
-  // Returns true if operation succeeds.
-  // 'fromCid' and 'toCid' may be cid-s of the views and therefore may not
-  // match the cids of 'this' and 'from'.
-  // Uses toCid and fromCid to decide if clamping is necessary.
-  // Element size of toCid and fromCid must match (test at caller).
-  bool _setRange(int startInBytes, int lengthInBytes,
-                 _TypedListBase from, int startFromInBytes,
-                 int toCid, int fromCid)
-      native "TypedData_setRange";
-}
-
-
-class _IntListMixin {
-  Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
-
-  Iterable<int> take(int n) => new SubListIterable<int>(this, 0, n);
-
-  Iterable<int> takeWhile(bool test(int element)) =>
-    new TakeWhileIterable<int>(this, test);
-
-  Iterable<int> skip(int n) => new SubListIterable<int>(this, n, null);
-
-  Iterable<int> skipWhile(bool test(element)) =>
-    new SkipWhileIterable<int>(this, test);
-
-  Iterable<int> get reversed => new ReversedListIterable<int>(this);
-
-  Map<int, int> asMap() => new ListMapView<int>(this);
-
-  Iterable<int> getRange(int start, [int end]) {
-    RangeError.checkValidRange(start, end, this.length);
-    return new SubListIterable<int>(this, start, end);
-  }
-
-  Iterator<int> get iterator => new _TypedListIterator<int>(this);
-
-  List<int> toList({bool growable: true}) {
-    return new List<int>.from(this, growable: growable);
-  }
-
-  Set<int> toSet() {
-    return new Set<int>.from(this);
-  }
-}
-
-
-class _DoubleListMixin {
-  Iterable<double> where(bool f(int element)) =>
-    new WhereIterable<double>(this, f);
-
-  Iterable<double> take(int n) => new SubListIterable<double>(this, 0, n);
-
-  Iterable<double> takeWhile(bool test(int element)) =>
-    new TakeWhileIterable<double>(this, test);
-
-  Iterable<double> skip(int n) => new SubListIterable<double>(this, n, null);
-
-  Iterable<double> skipWhile(bool test(element)) =>
-    new SkipWhileIterable<double>(this, test);
-
-  Iterable<double> get reversed => new ReversedListIterable<double>(this);
-
-  Map<int, double> asMap() => new ListMapView<double>(this);
-
-  Iterable<double> getRange(int start, [int end]) {
-    RangeError.checkValidRange(start, end, this.length);
-    return new SubListIterable<double>(this, start, end);
-  }
-
-  Iterator<double> get iterator => new _TypedListIterator<double>(this);
-
-  List<double> toList({bool growable: true}) {
-    return new List<double>.from(this, growable: growable);
-  }
-
-  Set<double> toSet() {
-    return new Set<double>.from(this);
-  }
-}
-
-
-class _Float32x4ListMixin {
-  Iterable<Float32x4> where(bool f(int element)) =>
-    new WhereIterable<Float32x4>(this, f);
-
-  Iterable<Float32x4> take(int n) => new SubListIterable<Float32x4>(this, 0, n);
-
-  Iterable<Float32x4> takeWhile(bool test(int element)) =>
-    new TakeWhileIterable<Float32x4>(this, test);
-
-  Iterable<Float32x4> skip(int n) =>
-    new SubListIterable<Float32x4>(this, n, null);
-
-  Iterable<Float32x4> skipWhile(bool test(element)) =>
-    new SkipWhileIterable<Float32x4>(this, test);
-
-  Iterable<Float32x4> get reversed => new ReversedListIterable<Float32x4>(this);
-
-  Map<int, Float32x4> asMap() => new ListMapView<Float32x4>(this);
-
-  Iterable<Float32x4> getRange(int start, [int end]) {
-    RangeError.checkValidRange(start, end, this.length);
-    return new SubListIterable<Float32x4>(this, start, end);
-  }
-
-  Iterator<Float32x4> get iterator => new _TypedListIterator<Float32x4>(this);
-
-  List<Float32x4> toList({bool growable: true}) {
-    return new List<Float32x4>.from(this, growable: growable);
-  }
-
-  Set<Float32x4> toSet() {
-    return new Set<Float32x4>.from(this);
-  }
-}
-
-
-class _Int32x4ListMixin {
-  Iterable<Int32x4> where(bool f(int element)) =>
-    new WhereIterable<Int32x4>(this, f);
-
-  Iterable<Int32x4> take(int n) => new SubListIterable<Int32x4>(this, 0, n);
-
-  Iterable<Int32x4> takeWhile(bool test(int element)) =>
-    new TakeWhileIterable<Int32x4>(this, test);
-
-  Iterable<Int32x4> skip(int n) => new SubListIterable<Int32x4>(this, n, null);
-
-  Iterable<Int32x4> skipWhile(bool test(element)) =>
-    new SkipWhileIterable<Int32x4>(this, test);
-
-  Iterable<Int32x4> get reversed => new ReversedListIterable<Int32x4>(this);
-
-  Map<int, Int32x4> asMap() => new ListMapView<Int32x4>(this);
-
-  Iterable<Int32x4> getRange(int start, [int end]) {
-    RangeError.checkValidRange(start, end, this.length);
-    return new SubListIterable<Int32x4>(this, start, end);
-  }
-
-  Iterator<Int32x4> get iterator => new _TypedListIterator<Int32x4>(this);
-
-  List<Int32x4> toList({bool growable: true}) {
-    return new List<Int32x4>.from(this, growable: growable);
-  }
-
-  Set<Int32x4> toSet() {
-    return new Set<Int32x4>.from(this);
-  }
-}
-
-
-class _Float64x2ListMixin {
-  Iterable<Float64x2> where(bool f(int element)) =>
-    new WhereIterable<Float64x2>(this, f);
-
-  Iterable<Float64x2> take(int n) => new SubListIterable<Float64x2>(this, 0, n);
-
-  Iterable<Float64x2> takeWhile(bool test(int element)) =>
-    new TakeWhileIterable<Float64x2>(this, test);
-
-  Iterable<Float64x2> skip(int n) =>
-    new SubListIterable<Float64x2>(this, n, null);
-
-  Iterable<Float64x2> skipWhile(bool test(element)) =>
-    new SkipWhileIterable<Float64x2>(this, test);
-
-  Iterable<Float64x2> get reversed => new ReversedListIterable<Float64x2>(this);
-
-  Map<int, Float64x2> asMap() => new ListMapView<Float64x2>(this);
-
-  Iterable<Float64x2> getRange(int start, [int end]) {
-    RangeError.checkValidRange(start, end, this.length);
-    return new SubListIterable<Float64x2>(this, start, end);
-  }
-
-  Iterator<Float64x2> get iterator => new _TypedListIterator<Float64x2>(this);
-
-  List<Float64x2> toList({bool growable: true}) {
-    return new List<Float64x2>.from(this, growable: growable);
-  }
-
-  Set<Float64x2> toSet() {
-    return new Set<Float64x2>.from(this);
-  }
-}
-
-
-class ByteBuffer {
-  final _TypedList _data;
-
-  ByteBuffer(this._data);
-
-  factory ByteBuffer._New(data) => new ByteBuffer(data);
-
-  // Forward calls to _data.
-  int get lengthInBytes => _data.lengthInBytes;
-  int get hashCode => _data.hashCode;
-  bool operator==(Object other) =>
-      (other is ByteBuffer) && identical(_data, other._data);
-
-  ByteData asByteData([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = this.lengthInBytes - offsetInBytes;
-    }
-    return new _ByteDataView(this._data, offsetInBytes, length);
-  }
-
-  Int8List asInt8List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = this.lengthInBytes - offsetInBytes;
-    }
-    return new _Int8ArrayView(this, offsetInBytes, length);
-  }
-
-  Uint8List asUint8List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = this.lengthInBytes - offsetInBytes;
-    }
-    return new _Uint8ArrayView(this, offsetInBytes, length);
-  }
-
-  Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = this.lengthInBytes - offsetInBytes;
-    }
-    return new _Uint8ClampedArrayView(this, offsetInBytes, length);
-  }
-
-  Int16List asInt16List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Int16List.BYTES_PER_ELEMENT;
-    }
-    return new _Int16ArrayView(this, offsetInBytes, length);
-  }
-
-  Uint16List asUint16List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Uint16List.BYTES_PER_ELEMENT;
-    }
-    return new _Uint16ArrayView(this, offsetInBytes, length);
-  }
-
-  Int32List asInt32List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Int32List.BYTES_PER_ELEMENT;
-    }
-    return new _Int32ArrayView(this, offsetInBytes, length);
-  }
-
-  Uint32List asUint32List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Uint32List.BYTES_PER_ELEMENT;
-    }
-    return new _Uint32ArrayView(this, offsetInBytes, length);
-  }
-
-  Int64List asInt64List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Int64List.BYTES_PER_ELEMENT;
-    }
-    return new _Int64ArrayView(this, offsetInBytes, length);
-  }
-
-  Uint64List asUint64List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Uint64List.BYTES_PER_ELEMENT;
-    }
-    return new _Uint64ArrayView(this, offsetInBytes, length);
-  }
-
-  Float32List asFloat32List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Float32List.BYTES_PER_ELEMENT;
-    }
-    return new _Float32ArrayView(this, offsetInBytes, length);
-  }
-
-  Float64List asFloat64List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Float64List.BYTES_PER_ELEMENT;
-    }
-    return new _Float64ArrayView(this, offsetInBytes, length);
-  }
-
-  Float32x4List asFloat32x4List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Float32x4List.BYTES_PER_ELEMENT;
-    }
-    return new _Float32x4ArrayView(this, offsetInBytes, length);
-  }
-
-  Int32x4List asInt32x4List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Int32x4List.BYTES_PER_ELEMENT;
-    }
-    return new _Int32x4ArrayView(this, offsetInBytes, length);
-  }
-
-  Float64x2List asFloat64x2List([int offsetInBytes = 0, int length]) {
-    if (length == null) {
-      length = (this.lengthInBytes - offsetInBytes) ~/
-               Float64x2List.BYTES_PER_ELEMENT;
-    }
-    return new _Float64x2ArrayView(this, offsetInBytes, length);
-  }
-}
-
-
-abstract class _TypedList extends _TypedListBase {
-  // Default method implementing parts of the TypedData interface.
-  int get offsetInBytes {
-    return 0;
-  }
-
-  int get lengthInBytes {
-    return length * elementSizeInBytes;
-  }
-
-  ByteBuffer get buffer => new ByteBuffer(this);
-
-  // Methods implementing the collection interface.
-
-  int get length native "TypedData_length";
-
-  // Internal utility methods.
-
-  int _getInt8(int offsetInBytes) native "TypedData_GetInt8";
-  void _setInt8(int offsetInBytes, int value) native "TypedData_SetInt8";
-
-  int _getUint8(int offsetInBytes) native "TypedData_GetUint8";
-  void _setUint8(int offsetInBytes, int value) native "TypedData_SetUint8";
-
-  int _getInt16(int offsetInBytes) native "TypedData_GetInt16";
-  void _setInt16(int offsetInBytes, int value) native "TypedData_SetInt16";
-
-  int _getUint16(int offsetInBytes) native "TypedData_GetUint16";
-  void _setUint16(int offsetInBytes, int value) native "TypedData_SetUint16";
-
-  int _getInt32(int offsetInBytes) native "TypedData_GetInt32";
-  void _setInt32(int offsetInBytes, int value) native "TypedData_SetInt32";
-
-  int _getUint32(int offsetInBytes) native "TypedData_GetUint32";
-  void _setUint32(int offsetInBytes, int value) native "TypedData_SetUint32";
-
-  int _getInt64(int offsetInBytes) native "TypedData_GetInt64";
-  void _setInt64(int offsetInBytes, int value) native "TypedData_SetInt64";
-
-  int _getUint64(int offsetInBytes) native "TypedData_GetUint64";
-  void _setUint64(int offsetInBytes, int value) native "TypedData_SetUint64";
-
-  double _getFloat32(int offsetInBytes) native "TypedData_GetFloat32";
-  void _setFloat32(int offsetInBytes, double value)
-      native "TypedData_SetFloat32";
-
-  double _getFloat64(int offsetInBytes) native "TypedData_GetFloat64";
-  void _setFloat64(int offsetInBytes, double value)
-      native "TypedData_SetFloat64";
-
-  Float32x4 _getFloat32x4(int offsetInBytes) native "TypedData_GetFloat32x4";
-  void _setFloat32x4(int offsetInBytes, Float32x4 value)
-      native "TypedData_SetFloat32x4";
-
-  Int32x4 _getInt32x4(int offsetInBytes) native "TypedData_GetInt32x4";
-  void _setInt32x4(int offsetInBytes, Int32x4 value)
-      native "TypedData_SetInt32x4";
-
-  Float64x2 _getFloat64x2(int offsetInBytes) native "TypedData_GetFloat64x2";
-  void _setFloat64x2(int offsetInBytes, Float64x2 value)
-      native "TypedData_SetFloat64x2";
-
-  /**
-   * Stores the [CodeUnits] as UTF-16 units into this TypedData at
-   * positions [start]..[end] (uint16 indices).
-   */
-  void _setCodeUnits(CodeUnits units,
-                     int byteStart, int length, int skipCount) {
-    assert(byteStart + length * Uint16List.BYTES_PER_ELEMENT <= lengthInBytes);
-    String string = CodeUnits.stringOf(units);
-    int sliceEnd = skipCount + length;
-    RangeError.checkValidRange(skipCount, sliceEnd,
-                               string.length,
-                               "skipCount", "skipCount + length");
-    for (int i = 0; i < length; i++) {
-      _setUint16(byteStart + i * Uint16List.BYTES_PER_ELEMENT,
-                 string.codeUnitAt(skipCount + i));
-    }
-  }
-}
-
-
-class Int8List extends _TypedList with _IntListMixin implements List<int>, TypedData {
-  // Factory constructors.
-
-  factory Int8List(int length) native "TypedData_Int8Array_new";
-
-  factory Int8List.fromList(List<int> elements) {
-    return new Int8List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Int8List.view(ByteBuffer buffer,
-                        [int offsetInBytes = 0, int length]) {
-    return buffer.asInt8List(offsetInBytes, length);
-  }
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getInt8(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setInt8(index, _toInt8(value));
-  }
-
-  static const int BYTES_PER_ELEMENT = 1;
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int8List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int8List _createList(int length) {
-    return new Int8List(length);
-  }
-}
-
-
-class Uint8List extends _TypedList with _IntListMixin implements List<int>, TypedData {
-  // Factory constructors.
-
-  factory Uint8List(int length) native "TypedData_Uint8Array_new";
-
-  factory Uint8List.fromList(List<int> elements) {
-    return new Uint8List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Uint8List.view(ByteBuffer buffer,
-                         [int offsetInBytes = 0, int length]) {
-    return buffer.asUint8List(offsetInBytes, length);
-  }
-
-  // Methods implementing List interface.
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getUint8(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setUint8(index, _toUint8(value));
-  }
-
-  static const int BYTES_PER_ELEMENT = 1;
-
-  // Methods implementing TypedData interface.
-  int get elementSizeInBytes {
-    return Uint8List.BYTES_PER_ELEMENT;
-  }
-
-  // Internal utility methods.
-
-  Uint8List _createList(int length) {
-    return new Uint8List(length);
-  }
-}
-
-
-class Uint8ClampedList extends _TypedList with _IntListMixin implements List<int>, TypedData {
-  // Factory constructors.
-
-  factory Uint8ClampedList(int length) native "TypedData_Uint8ClampedArray_new";
-
-  factory Uint8ClampedList.fromList(List<int> elements) {
-    return new Uint8ClampedList(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Uint8ClampedList.view(ByteBuffer buffer,
-                                [int offsetInBytes = 0, int length]) {
-    return buffer.asUint8ClampedList(offsetInBytes, length);
-  }
-
-  // Methods implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getUint8(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setUint8(index, _toClampedUint8(value));
-  }
-
-  static const int BYTES_PER_ELEMENT = 1;
-
-  // Methods implementing TypedData interface.
-  int get elementSizeInBytes {
-    return Uint8List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint8ClampedList _createList(int length) {
-    return new Uint8ClampedList(length);
-  }
-}
-
-
-class Int16List extends _TypedList with _IntListMixin implements List<int>, TypedData {
-  // Factory constructors.
-
-  factory Int16List(int length) native "TypedData_Int16Array_new";
-
-  factory Int16List.fromList(List<int> elements) {
-    return new Int16List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Int16List.view(ByteBuffer buffer,
-                         [int offsetInBytes = 0, int length]) {
-    return buffer.asInt16List(offsetInBytes, length);
-  }
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedInt16(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedInt16(index, _toInt16(value));
-  }
-
-  void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
-    if (iterable is CodeUnits) {
-      end = RangeError.checkValidRange(start, end, this.length);
-      int length = end - start;
-      int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT;
-      _setCodeUnits(iterable, byteStart, length, skipCount);
-    } else {
-      super.setRange(start, end, iterable, skipCount);
-    }
-  }
-
-  // Method(s) implementing TypedData interface.
-  static const int BYTES_PER_ELEMENT = 2;
-
-  int get elementSizeInBytes {
-    return Int16List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int16List _createList(int length) {
-    return new Int16List(length);
-  }
-
-  int _getIndexedInt16(int index) {
-    return _getInt16(index * Int16List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedInt16(int index, int value) {
-    _setInt16(index * Int16List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Uint16List extends _TypedList with _IntListMixin implements List<int>, TypedData {
-  // Factory constructors.
-
-  factory Uint16List(int length) native "TypedData_Uint16Array_new";
-
-  factory Uint16List.fromList(List<int> elements) {
-    return new Uint16List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Uint16List.view(ByteBuffer buffer,
-                          [int offsetInBytes = 0, int length]) {
-    return buffer.asUint16List(offsetInBytes, length);
-  }
-
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedUint16(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedUint16(index, _toUint16(value));
-  }
-
-  void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
-    if (iterable is CodeUnits) {
-      end = RangeError.checkValidRange(start, end, this.length);
-      int length = end - start;
-      int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT;
-      _setCodeUnits(iterable, byteStart, length, skipCount);
-    } else {
-      super.setRange(start, end, iterable, skipCount);
-    }
-  }
-
-  // Method(s) implementing the TypedData interface.
-  static const int BYTES_PER_ELEMENT = 2;
-
-  int get elementSizeInBytes {
-    return Uint16List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint16List _createList(int length) {
-    return new Uint16List(length);
-  }
-
-  int _getIndexedUint16(int index) {
-    return _getUint16(index * Uint16List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedUint16(int index, int value) {
-    _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Int32List extends _TypedList with _IntListMixin implements List<int>, TypedData {
-  // Factory constructors.
-
-  factory Int32List(int length) native "TypedData_Int32Array_new";
-
-  factory Int32List.fromList(List<int> elements) {
-    return new Int32List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Int32List.view(ByteBuffer buffer,
-                         [int offsetInBytes = 0, int length]) {
-    return buffer.asInt32List(offsetInBytes, length);
-  }
-
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedInt32(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedInt32(index, _toInt32(value));
-  }
-
-
-  // Method(s) implementing TypedData interface.
-  static const int BYTES_PER_ELEMENT = 4;
-
-  int get elementSizeInBytes {
-    return Int32List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int32List _createList(int length) {
-    return new Int32List(length);
-  }
-
-  int _getIndexedInt32(int index) {
-    return _getInt32(index * Int32List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedInt32(int index, int value) {
-    _setInt32(index * Int32List.BYTES_PER_ELEMENT, value);
-  }
-
-}
-
-
-class Uint32List extends _TypedList with _IntListMixin implements List<int>, TypedData {
-  // Factory constructors.
-
-  factory Uint32List(int length) native "TypedData_Uint32Array_new";
-
-  factory Uint32List.fromList(List<int> elements) {
-    return new Uint32List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Uint32List.view(ByteBuffer buffer,
-                          [int offsetInBytes = 0, int length]) {
-    return buffer.asUint32List(offsetInBytes, length);
-  }
-
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedUint32(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedUint32(index, _toUint32(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-  static const int BYTES_PER_ELEMENT = 4;
-
-  int get elementSizeInBytes {
-    return Uint32List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint32List _createList(int length) {
-    return new Uint32List(length);
-  }
-
-  int _getIndexedUint32(int index) {
-    return _getUint32(index * Uint32List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedUint32(int index, int value) {
-    _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Int64List extends _TypedList with _IntListMixin implements List<int>, TypedData {
-  // Factory constructors.
-
-  factory Int64List(int length) native "TypedData_Int64Array_new";
-
-  factory Int64List.fromList(List<int> elements) {
-    return new Int64List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Int64List.view(ByteBuffer buffer,
-                         [int offsetInBytes = 0, int length]) {
-    return buffer.asInt64List(offsetInBytes, length);
-  }
-
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedInt64(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedInt64(index, _toInt64(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-  static const int BYTES_PER_ELEMENT = 8;
-
-  int get elementSizeInBytes {
-    return Int64List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int64List _createList(int length) {
-    return new Int64List(length);
-  }
-
-  int _getIndexedInt64(int index) {
-    return _getInt64(index * Int64List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedInt64(int index, int value) {
-    _setInt64(index * Int64List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Uint64List extends _TypedList with _IntListMixin implements List<int>, TypedData {
-  // Factory constructors.
-
-  factory Uint64List(int length) native "TypedData_Uint64Array_new";
-
-  factory Uint64List.fromList(List<int> elements) {
-    return new Uint64List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Uint64List.view(ByteBuffer buffer,
-                          [int offsetInBytes = 0, int length]) {
-    return buffer.asUint64List(offsetInBytes, length);
-  }
-
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedUint64(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedUint64(index, _toUint64(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-  static const int BYTES_PER_ELEMENT = 8;
-
-  int get elementSizeInBytes {
-    return Uint64List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint64List _createList(int length) {
-    return new Uint64List(length);
-  }
-
-  int _getIndexedUint64(int index) {
-    return _getUint64(index * Uint64List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedUint64(int index, int value) {
-    _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Float32List extends _TypedList with _DoubleListMixin implements List<double>, TypedData {
-  // Factory constructors.
-
-  factory Float32List(int length) native "TypedData_Float32Array_new";
-
-  factory Float32List.fromList(List<double> elements) {
-    return new Float32List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Float32List.view(ByteBuffer buffer,
-                           [int offsetInBytes = 0, int length]) {
-    return buffer.asFloat32List(offsetInBytes, length);
-  }
-
-  // Method(s) implementing the List interface.
-
-  double operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedFloat32(index);
-  }
-
-  void operator[]=(int index, double value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedFloat32(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-  static const int BYTES_PER_ELEMENT = 4;
-
-  int get elementSizeInBytes {
-    return Float32List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float32List _createList(int length) {
-    return new Float32List(length);
-  }
-
-  double _getIndexedFloat32(int index) {
-    return _getFloat32(index * Float32List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedFloat32(int index, double value) {
-    _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Float64List extends _TypedList with _DoubleListMixin implements List<double>, TypedData {
-  // Factory constructors.
-
-  factory Float64List(int length) native "TypedData_Float64Array_new";
-
-  factory Float64List.fromList(List<double> elements) {
-    return new Float64List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Float64List.view(ByteBuffer buffer,
-                           [int offsetInBytes = 0, int length]) {
-    return buffer.asFloat64List(offsetInBytes, length);
-  }
-
-  // Method(s) implementing the List interface.
-
-  double operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedFloat64(index);
-  }
-
-  void operator[]=(int index, double value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedFloat64(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-  static const int BYTES_PER_ELEMENT = 8;
-
-  int get elementSizeInBytes {
-    return Float64List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float64List _createList(int length) {
-    return new Float64List(length);
-  }
-
-  double _getIndexedFloat64(int index) {
-    return _getFloat64(index * Float64List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedFloat64(int index, double value) {
-    _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Float32x4List extends _TypedList with _Float32x4ListMixin implements List<Float32x4>, TypedData {
-  // Factory constructors.
-
-  factory Float32x4List(int length) native "TypedData_Float32x4Array_new";
-
-  factory Float32x4List.fromList(List<Float32x4> elements) {
-    return new Float32x4List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Float32x4List.view(ByteBuffer buffer,
-                             [int offsetInBytes = 0, int length]) {
-    return buffer.asFloat32x4List(offsetInBytes, length);
-  }
-
-  Float32x4 operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedFloat32x4(index);
-  }
-
-  void operator[]=(int index, Float32x4 value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedFloat32x4(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-  static const int BYTES_PER_ELEMENT = 16;
-
-  int get elementSizeInBytes {
-    return Float32x4List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float32x4List _createList(int length) {
-    return new Float32x4List(length);
-  }
-
-  Float32x4 _getIndexedFloat32x4(int index) {
-    return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedFloat32x4(int index, Float32x4 value) {
-    _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Int32x4List extends _TypedList with _Int32x4ListMixin implements List<Int32x4>, TypedData {
-  // Factory constructors.
-
-  factory Int32x4List(int length) native "TypedData_Int32x4Array_new";
-
-  factory Int32x4List.fromList(List<Int32x4> elements) {
-    return new Int32x4List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Int32x4List.view(ByteBuffer buffer,
-                             [int offsetInBytes = 0, int length]) {
-    return buffer.asInt32x4List(offsetInBytes, length);
-  }
-
-  Int32x4 operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedInt32x4(index);
-  }
-
-  void operator[]=(int index, Int32x4 value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedInt32x4(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-  static const int BYTES_PER_ELEMENT = 16;
-
-  int get elementSizeInBytes {
-    return Int32x4List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int32x4List _createList(int length) {
-    return new Int32x4List(length);
-  }
-
-  Int32x4 _getIndexedInt32x4(int index) {
-    return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedInt32x4(int index, Int32x4 value) {
-    _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Float64x2List extends _TypedList with _Float64x2ListMixin implements List<Float64x2>, TypedData {
-  // Factory constructors.
-
-  factory Float64x2List(int length) native "TypedData_Float64x2Array_new";
-
-  factory Float64x2List.fromList(List<Float64x2> elements) {
-    return new Float64x2List(elements.length)
-        ..setRange(0, elements.length, elements);
-  }
-
-  factory Float64x2List.view(ByteBuffer buffer,
-                             [int offsetInBytes = 0, int length]) {
-    return buffer.asFloat64x2List(offsetInBytes, length);
-  }
-
-  Float64x2 operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedFloat64x2(index);
-  }
-
-  void operator[]=(int index, Float64x2 value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedFloat64x2(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-  static const int BYTES_PER_ELEMENT = 16;
-
-  int get elementSizeInBytes {
-    return Float64x2List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float64x2List _createList(int length) {
-    return new Float64x2List(length);
-  }
-
-  Float64x2 _getIndexedFloat64x2(int index) {
-    return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedFloat64x2(int index, Float64x2 value) {
-    _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalInt8Array extends _TypedList with _IntListMixin implements Int8List {
-  // Method(s) implementing the List interface.
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getInt8(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setInt8(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int8List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int8List _createList(int length) {
-    return new Int8List(length);
-  }
-}
-
-
-class _ExternalUint8Array extends _TypedList with _IntListMixin implements Uint8List {
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getUint8(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setUint8(index, _toUint8(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint8List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint8List _createList(int length) {
-    return new Uint8List(length);
-  }
-}
-
-
-class _ExternalUint8ClampedArray extends _TypedList with _IntListMixin implements Uint8ClampedList {
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getUint8(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setUint8(index, _toClampedUint8(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint8List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint8ClampedList _createList(int length) {
-    return new Uint8ClampedList(length);
-  }
-}
-
-
-class _ExternalInt16Array extends _TypedList with _IntListMixin implements Int16List {
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedInt16(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedInt16(index, _toInt16(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int16List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int16List _createList(int length) {
-    return new Int16List(length);
-  }
-
-  int _getIndexedInt16(int index) {
-    return _getInt16(index * Int16List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedInt16(int index, int value) {
-    _setInt16(index * Int16List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalUint16Array extends _TypedList with _IntListMixin implements Uint16List {
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedUint16(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedUint16(index, _toUint16(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint16List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint16List _createList(int length) {
-    return new Uint16List(length);
-  }
-
-  int _getIndexedUint16(int index) {
-    return _getUint16(index * Uint16List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedUint16(int index, int value) {
-    _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalInt32Array extends _TypedList with _IntListMixin implements Int32List {
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedInt32(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedInt32(index, _toInt32(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int32List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int32List _createList(int length) {
-    return new Int32List(length);
-  }
-
-  int _getIndexedInt32(int index) {
-    return _getInt32(index * Int32List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedInt32(int index, int value) {
-    _setInt32(index * Int32List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalUint32Array extends _TypedList with _IntListMixin implements Uint32List {
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedUint32(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedUint32(index, _toUint32(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint32List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint32List _createList(int length) {
-    return new Uint32List(length);
-  }
-
-  int _getIndexedUint32(int index) {
-    return _getUint32(index * Uint32List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedUint32(int index, int value) {
-    _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalInt64Array extends _TypedList with _IntListMixin implements Int64List {
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedInt64(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedInt64(index, _toInt64(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int64List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int64List _createList(int length) {
-    return new Int64List(length);
-  }
-
-  int _getIndexedInt64(int index) {
-    return _getInt64(index * Int64List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedInt64(int index, int value) {
-    _setInt64(index * Int64List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalUint64Array extends _TypedList with _IntListMixin implements Uint64List {
-  // Method(s) implementing the List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedUint64(index);
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedUint64(index, _toUint64(value));
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint64List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint64List _createList(int length) {
-    return new Uint64List(length);
-  }
-
-  int _getIndexedUint64(int index) {
-    return _getUint64(index * Uint64List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedUint64(int index, int value) {
-    _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalFloat32Array extends _TypedList with _DoubleListMixin implements Float32List {
-  // Method(s) implementing the List interface.
-
-  double operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedFloat32(index);
-  }
-
-  void operator[]=(int index, double value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedFloat32(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Float32List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float32List _createList(int length) {
-    return new Float32List(length);
-  }
-
-  double _getIndexedFloat32(int index) {
-    return _getFloat32(index * Float32List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedFloat32(int index, double value) {
-    _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalFloat64Array extends _TypedList with _DoubleListMixin implements Float64List {
-  // Method(s) implementing the List interface.
-
-  double operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedFloat64(index);
-  }
-
-  void operator[]=(int index, double value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedFloat64(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Float64List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float64List _createList(int length) {
-    return new Float64List(length);
-  }
-
-  double _getIndexedFloat64(int index) {
-    return _getFloat64(index * Float64List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedFloat64(int index, double value) {
-    _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalFloat32x4Array extends _TypedList with _Float32x4ListMixin implements Float32x4List {
-  // Method(s) implementing the List interface.
-
-  Float32x4 operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedFloat32x4(index);
-  }
-
-  void operator[]=(int index, Float32x4 value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedFloat32x4(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Float32x4List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float32x4List _createList(int length) {
-    return new Float32x4List(length);
-  }
-
-  Float32x4 _getIndexedFloat32x4(int index) {
-    return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedFloat32x4(int index, Float32x4 value) {
-    _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalInt32x4Array extends _TypedList with _Int32x4ListMixin implements Int32x4List {
-  // Method(s) implementing the List interface.
-
-  Int32x4 operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedInt32x4(index);
-  }
-
-  void operator[]=(int index, Int32x4 value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedInt32x4(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int32x4List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int32x4List _createList(int length) {
-    return new Int32x4List(length);
-  }
-
-  Int32x4 _getIndexedInt32x4(int index) {
-    return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedInt32x4(int index, Int32x4 value) {
-    _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class _ExternalFloat64x2Array extends _TypedList with _Float64x2ListMixin implements Float64x2List {
-  // Method(s) implementing the List interface.
-
-  Float64x2 operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _getIndexedFloat64x2(index);
-  }
-
-  void operator[]=(int index, Float64x2 value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _setIndexedFloat64x2(index, value);
-  }
-
-
-  // Method(s) implementing the TypedData interface.
-
-  int get elementSizeInBytes {
-    return Float64x2List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float64x2List _createList(int length) {
-    return new Float64x2List(length);
-  }
-
-  Float64x2 _getIndexedFloat64x2(int index) {
-    return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT);
-  }
-
-  void _setIndexedFloat64x2(int index, Float64x2 value) {
-    _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value);
-  }
-}
-
-
-class Float32x4 {
-  factory Float32x4(double x, double y, double z, double w)
-      native "Float32x4_fromDoubles";
-  factory Float32x4.splat(double v) native "Float32x4_splat";
-  factory Float32x4.zero() native "Float32x4_zero";
-  factory Float32x4.fromInt32x4Bits(Int32x4 x)
-      native "Float32x4_fromInt32x4Bits";
-  factory Float32x4.fromFloat64x2(Float64x2 v)
-      native "Float32x4_fromFloat64x2";
-  Float32x4 operator +(Float32x4 other) {
-    return _add(other);
-  }
-  Float32x4 _add(Float32x4 other) native "Float32x4_add";
-  Float32x4 operator -() {
-    return _negate();
-  }
-  Float32x4 _negate() native "Float32x4_negate";
-  Float32x4 operator -(Float32x4 other) {
-    return _sub(other);
-  }
-  Float32x4 _sub(Float32x4 other) native "Float32x4_sub";
-  Float32x4 operator *(Float32x4 other) {
-    return _mul(other);
-  }
-  Float32x4 _mul(Float32x4 other) native "Float32x4_mul";
-  Float32x4 operator /(Float32x4 other) {
-    return _div(other);
-  }
-  Float32x4 _div(Float32x4 other) native "Float32x4_div";
-  Int32x4 lessThan(Float32x4 other) {
-    return _cmplt(other);
-  }
-  Int32x4 _cmplt(Float32x4 other) native "Float32x4_cmplt";
-  Int32x4 lessThanOrEqual(Float32x4 other) {
-    return _cmplte(other);
-  }
-  Int32x4 _cmplte(Float32x4 other) native "Float32x4_cmplte";
-  Int32x4 greaterThan(Float32x4 other) {
-    return _cmpgt(other);
-  }
-  Int32x4 _cmpgt(Float32x4 other) native "Float32x4_cmpgt";
-  Int32x4 greaterThanOrEqual(Float32x4 other) {
-    return _cmpgte(other);
-  }
-  Int32x4 _cmpgte(Float32x4 other) native "Float32x4_cmpgte";
-  Int32x4 equal(Float32x4 other) {
-    return _cmpequal(other);
-  }
-  Int32x4 _cmpequal(Float32x4 other)
-      native "Float32x4_cmpequal";
-  Int32x4 notEqual(Float32x4 other) {
-    return _cmpnequal(other);
-  }
-  Int32x4 _cmpnequal(Float32x4 other)
-      native "Float32x4_cmpnequal";
-  Float32x4 scale(double s) {
-    return _scale(s);
-  }
-  Float32x4 _scale(double s) native "Float32x4_scale";
-  Float32x4 abs() {
-    return _abs();
-  }
-  Float32x4 _abs() native "Float32x4_abs";
-  Float32x4 clamp(Float32x4 lowerLimit, Float32x4 upperLimit) {
-    return _clamp(lowerLimit, upperLimit);
-  }
-  Float32x4 _clamp(Float32x4 lowerLimit, Float32x4 upperLimit)
-      native "Float32x4_clamp";
-  double get x native "Float32x4_getX";
-  double get y native "Float32x4_getY";
-  double get z native "Float32x4_getZ";
-  double get w native "Float32x4_getW";
-  int get signMask native "Float32x4_getSignMask";
-
-  Float32x4 shuffle(int mask) native "Float32x4_shuffle";
-  Float32x4 shuffleMix(Float32x4 zw, int mask) native "Float32x4_shuffleMix";
-
-  Float32x4 withX(double x) native "Float32x4_setX";
-  Float32x4 withY(double y) native "Float32x4_setY";
-  Float32x4 withZ(double z) native "Float32x4_setZ";
-  Float32x4 withW(double w) native "Float32x4_setW";
-  Float32x4 min(Float32x4 other) {
-    return _min(other);
-  }
-  Float32x4 _min(Float32x4 other) native "Float32x4_min";
-  Float32x4 max(Float32x4 other) {
-    return _max(other);
-  }
-  Float32x4 _max(Float32x4 other) native "Float32x4_max";
-  Float32x4 sqrt() {
-    return _sqrt();
-  }
-  Float32x4 _sqrt() native "Float32x4_sqrt";
-  Float32x4 reciprocal() {
-    return _reciprocal();
-  }
-  Float32x4 _reciprocal() native "Float32x4_reciprocal";
-  Float32x4 reciprocalSqrt() {
-    return _reciprocalSqrt();
-  }
-  Float32x4 _reciprocalSqrt() native "Float32x4_reciprocalSqrt";
-
-  /// Mask passed to [shuffle] or [shuffleMix].
-  static const int XXXX = 0x0;
-  static const int XXXY = 0x40;
-  static const int XXXZ = 0x80;
-  static const int XXXW = 0xC0;
-  static const int XXYX = 0x10;
-  static const int XXYY = 0x50;
-  static const int XXYZ = 0x90;
-  static const int XXYW = 0xD0;
-  static const int XXZX = 0x20;
-  static const int XXZY = 0x60;
-  static const int XXZZ = 0xA0;
-  static const int XXZW = 0xE0;
-  static const int XXWX = 0x30;
-  static const int XXWY = 0x70;
-  static const int XXWZ = 0xB0;
-  static const int XXWW = 0xF0;
-  static const int XYXX = 0x4;
-  static const int XYXY = 0x44;
-  static const int XYXZ = 0x84;
-  static const int XYXW = 0xC4;
-  static const int XYYX = 0x14;
-  static const int XYYY = 0x54;
-  static const int XYYZ = 0x94;
-  static const int XYYW = 0xD4;
-  static const int XYZX = 0x24;
-  static const int XYZY = 0x64;
-  static const int XYZZ = 0xA4;
-  static const int XYZW = 0xE4;
-  static const int XYWX = 0x34;
-  static const int XYWY = 0x74;
-  static const int XYWZ = 0xB4;
-  static const int XYWW = 0xF4;
-  static const int XZXX = 0x8;
-  static const int XZXY = 0x48;
-  static const int XZXZ = 0x88;
-  static const int XZXW = 0xC8;
-  static const int XZYX = 0x18;
-  static const int XZYY = 0x58;
-  static const int XZYZ = 0x98;
-  static const int XZYW = 0xD8;
-  static const int XZZX = 0x28;
-  static const int XZZY = 0x68;
-  static const int XZZZ = 0xA8;
-  static const int XZZW = 0xE8;
-  static const int XZWX = 0x38;
-  static const int XZWY = 0x78;
-  static const int XZWZ = 0xB8;
-  static const int XZWW = 0xF8;
-  static const int XWXX = 0xC;
-  static const int XWXY = 0x4C;
-  static const int XWXZ = 0x8C;
-  static const int XWXW = 0xCC;
-  static const int XWYX = 0x1C;
-  static const int XWYY = 0x5C;
-  static const int XWYZ = 0x9C;
-  static const int XWYW = 0xDC;
-  static const int XWZX = 0x2C;
-  static const int XWZY = 0x6C;
-  static const int XWZZ = 0xAC;
-  static const int XWZW = 0xEC;
-  static const int XWWX = 0x3C;
-  static const int XWWY = 0x7C;
-  static const int XWWZ = 0xBC;
-  static const int XWWW = 0xFC;
-  static const int YXXX = 0x1;
-  static const int YXXY = 0x41;
-  static const int YXXZ = 0x81;
-  static const int YXXW = 0xC1;
-  static const int YXYX = 0x11;
-  static const int YXYY = 0x51;
-  static const int YXYZ = 0x91;
-  static const int YXYW = 0xD1;
-  static const int YXZX = 0x21;
-  static const int YXZY = 0x61;
-  static const int YXZZ = 0xA1;
-  static const int YXZW = 0xE1;
-  static const int YXWX = 0x31;
-  static const int YXWY = 0x71;
-  static const int YXWZ = 0xB1;
-  static const int YXWW = 0xF1;
-  static const int YYXX = 0x5;
-  static const int YYXY = 0x45;
-  static const int YYXZ = 0x85;
-  static const int YYXW = 0xC5;
-  static const int YYYX = 0x15;
-  static const int YYYY = 0x55;
-  static const int YYYZ = 0x95;
-  static const int YYYW = 0xD5;
-  static const int YYZX = 0x25;
-  static const int YYZY = 0x65;
-  static const int YYZZ = 0xA5;
-  static const int YYZW = 0xE5;
-  static const int YYWX = 0x35;
-  static const int YYWY = 0x75;
-  static const int YYWZ = 0xB5;
-  static const int YYWW = 0xF5;
-  static const int YZXX = 0x9;
-  static const int YZXY = 0x49;
-  static const int YZXZ = 0x89;
-  static const int YZXW = 0xC9;
-  static const int YZYX = 0x19;
-  static const int YZYY = 0x59;
-  static const int YZYZ = 0x99;
-  static const int YZYW = 0xD9;
-  static const int YZZX = 0x29;
-  static const int YZZY = 0x69;
-  static const int YZZZ = 0xA9;
-  static const int YZZW = 0xE9;
-  static const int YZWX = 0x39;
-  static const int YZWY = 0x79;
-  static const int YZWZ = 0xB9;
-  static const int YZWW = 0xF9;
-  static const int YWXX = 0xD;
-  static const int YWXY = 0x4D;
-  static const int YWXZ = 0x8D;
-  static const int YWXW = 0xCD;
-  static const int YWYX = 0x1D;
-  static const int YWYY = 0x5D;
-  static const int YWYZ = 0x9D;
-  static const int YWYW = 0xDD;
-  static const int YWZX = 0x2D;
-  static const int YWZY = 0x6D;
-  static const int YWZZ = 0xAD;
-  static const int YWZW = 0xED;
-  static const int YWWX = 0x3D;
-  static const int YWWY = 0x7D;
-  static const int YWWZ = 0xBD;
-  static const int YWWW = 0xFD;
-  static const int ZXXX = 0x2;
-  static const int ZXXY = 0x42;
-  static const int ZXXZ = 0x82;
-  static const int ZXXW = 0xC2;
-  static const int ZXYX = 0x12;
-  static const int ZXYY = 0x52;
-  static const int ZXYZ = 0x92;
-  static const int ZXYW = 0xD2;
-  static const int ZXZX = 0x22;
-  static const int ZXZY = 0x62;
-  static const int ZXZZ = 0xA2;
-  static const int ZXZW = 0xE2;
-  static const int ZXWX = 0x32;
-  static const int ZXWY = 0x72;
-  static const int ZXWZ = 0xB2;
-  static const int ZXWW = 0xF2;
-  static const int ZYXX = 0x6;
-  static const int ZYXY = 0x46;
-  static const int ZYXZ = 0x86;
-  static const int ZYXW = 0xC6;
-  static const int ZYYX = 0x16;
-  static const int ZYYY = 0x56;
-  static const int ZYYZ = 0x96;
-  static const int ZYYW = 0xD6;
-  static const int ZYZX = 0x26;
-  static const int ZYZY = 0x66;
-  static const int ZYZZ = 0xA6;
-  static const int ZYZW = 0xE6;
-  static const int ZYWX = 0x36;
-  static const int ZYWY = 0x76;
-  static const int ZYWZ = 0xB6;
-  static const int ZYWW = 0xF6;
-  static const int ZZXX = 0xA;
-  static const int ZZXY = 0x4A;
-  static const int ZZXZ = 0x8A;
-  static const int ZZXW = 0xCA;
-  static const int ZZYX = 0x1A;
-  static const int ZZYY = 0x5A;
-  static const int ZZYZ = 0x9A;
-  static const int ZZYW = 0xDA;
-  static const int ZZZX = 0x2A;
-  static const int ZZZY = 0x6A;
-  static const int ZZZZ = 0xAA;
-  static const int ZZZW = 0xEA;
-  static const int ZZWX = 0x3A;
-  static const int ZZWY = 0x7A;
-  static const int ZZWZ = 0xBA;
-  static const int ZZWW = 0xFA;
-  static const int ZWXX = 0xE;
-  static const int ZWXY = 0x4E;
-  static const int ZWXZ = 0x8E;
-  static const int ZWXW = 0xCE;
-  static const int ZWYX = 0x1E;
-  static const int ZWYY = 0x5E;
-  static const int ZWYZ = 0x9E;
-  static const int ZWYW = 0xDE;
-  static const int ZWZX = 0x2E;
-  static const int ZWZY = 0x6E;
-  static const int ZWZZ = 0xAE;
-  static const int ZWZW = 0xEE;
-  static const int ZWWX = 0x3E;
-  static const int ZWWY = 0x7E;
-  static const int ZWWZ = 0xBE;
-  static const int ZWWW = 0xFE;
-  static const int WXXX = 0x3;
-  static const int WXXY = 0x43;
-  static const int WXXZ = 0x83;
-  static const int WXXW = 0xC3;
-  static const int WXYX = 0x13;
-  static const int WXYY = 0x53;
-  static const int WXYZ = 0x93;
-  static const int WXYW = 0xD3;
-  static const int WXZX = 0x23;
-  static const int WXZY = 0x63;
-  static const int WXZZ = 0xA3;
-  static const int WXZW = 0xE3;
-  static const int WXWX = 0x33;
-  static const int WXWY = 0x73;
-  static const int WXWZ = 0xB3;
-  static const int WXWW = 0xF3;
-  static const int WYXX = 0x7;
-  static const int WYXY = 0x47;
-  static const int WYXZ = 0x87;
-  static const int WYXW = 0xC7;
-  static const int WYYX = 0x17;
-  static const int WYYY = 0x57;
-  static const int WYYZ = 0x97;
-  static const int WYYW = 0xD7;
-  static const int WYZX = 0x27;
-  static const int WYZY = 0x67;
-  static const int WYZZ = 0xA7;
-  static const int WYZW = 0xE7;
-  static const int WYWX = 0x37;
-  static const int WYWY = 0x77;
-  static const int WYWZ = 0xB7;
-  static const int WYWW = 0xF7;
-  static const int WZXX = 0xB;
-  static const int WZXY = 0x4B;
-  static const int WZXZ = 0x8B;
-  static const int WZXW = 0xCB;
-  static const int WZYX = 0x1B;
-  static const int WZYY = 0x5B;
-  static const int WZYZ = 0x9B;
-  static const int WZYW = 0xDB;
-  static const int WZZX = 0x2B;
-  static const int WZZY = 0x6B;
-  static const int WZZZ = 0xAB;
-  static const int WZZW = 0xEB;
-  static const int WZWX = 0x3B;
-  static const int WZWY = 0x7B;
-  static const int WZWZ = 0xBB;
-  static const int WZWW = 0xFB;
-  static const int WWXX = 0xF;
-  static const int WWXY = 0x4F;
-  static const int WWXZ = 0x8F;
-  static const int WWXW = 0xCF;
-  static const int WWYX = 0x1F;
-  static const int WWYY = 0x5F;
-  static const int WWYZ = 0x9F;
-  static const int WWYW = 0xDF;
-  static const int WWZX = 0x2F;
-  static const int WWZY = 0x6F;
-  static const int WWZZ = 0xAF;
-  static const int WWZW = 0xEF;
-  static const int WWWX = 0x3F;
-  static const int WWWY = 0x7F;
-  static const int WWWZ = 0xBF;
-  static const int WWWW = 0xFF;
-
-}
-
-
-class Int32x4 {
-  factory Int32x4(int x, int y, int z, int w)
-      native "Int32x4_fromInts";
-  factory Int32x4.bool(bool x, bool y, bool z, bool w)
-      native "Int32x4_fromBools";
-  factory Int32x4.fromFloat32x4Bits(Float32x4 x)
-      native "Int32x4_fromFloat32x4Bits";
-  Int32x4 operator |(Int32x4 other) {
-    return _or(other);
-  }
-  Int32x4 _or(Int32x4 other) native "Int32x4_or";
-  Int32x4 operator &(Int32x4 other) {
-    return _and(other);
-  }
-  Int32x4 _and(Int32x4 other) native "Int32x4_and";
-  Int32x4 operator ^(Int32x4 other) {
-    return _xor(other);
-  }
-  Int32x4 _xor(Int32x4 other) native "Int32x4_xor";
-  Int32x4 operator +(Int32x4 other) {
-    return _add(other);
-  }
-  Int32x4 _add(Int32x4 other) native "Int32x4_add";
-  Int32x4 operator -(Int32x4 other) {
-    return _sub(other);
-  }
-  Int32x4 _sub(Int32x4 other) native "Int32x4_sub";
-  int get x native "Int32x4_getX";
-  int get y native "Int32x4_getY";
-  int get z native "Int32x4_getZ";
-  int get w native "Int32x4_getW";
-  int get signMask native "Int32x4_getSignMask";
-  Int32x4 shuffle(int mask) native "Int32x4_shuffle";
-  Int32x4 shuffleMix(Int32x4 zw, int mask) native "Int32x4_shuffleMix";
-  Int32x4 withX(int x) native "Int32x4_setX";
-  Int32x4 withY(int y) native "Int32x4_setY";
-  Int32x4 withZ(int z) native "Int32x4_setZ";
-  Int32x4 withW(int w) native "Int32x4_setW";
-  bool get flagX native "Int32x4_getFlagX";
-  bool get flagY native "Int32x4_getFlagY";
-  bool get flagZ native "Int32x4_getFlagZ";
-  bool get flagW native "Int32x4_getFlagW";
-  Int32x4 withFlagX(bool x) native "Int32x4_setFlagX";
-  Int32x4 withFlagY(bool y) native "Int32x4_setFlagY";
-  Int32x4 withFlagZ(bool z) native "Int32x4_setFlagZ";
-  Int32x4 withFlagW(bool w) native "Int32x4_setFlagW";
-  Float32x4 select(Float32x4 trueValue, Float32x4 falseValue) {
-    return _select(trueValue, falseValue);
-  }
-  Float32x4 _select(Float32x4 trueValue, Float32x4 falseValue)
-      native "Int32x4_select";
-
-  /// Mask passed to [shuffle] or [shuffleMix].
-  static const int XXXX = 0x0;
-  static const int XXXY = 0x40;
-  static const int XXXZ = 0x80;
-  static const int XXXW = 0xC0;
-  static const int XXYX = 0x10;
-  static const int XXYY = 0x50;
-  static const int XXYZ = 0x90;
-  static const int XXYW = 0xD0;
-  static const int XXZX = 0x20;
-  static const int XXZY = 0x60;
-  static const int XXZZ = 0xA0;
-  static const int XXZW = 0xE0;
-  static const int XXWX = 0x30;
-  static const int XXWY = 0x70;
-  static const int XXWZ = 0xB0;
-  static const int XXWW = 0xF0;
-  static const int XYXX = 0x4;
-  static const int XYXY = 0x44;
-  static const int XYXZ = 0x84;
-  static const int XYXW = 0xC4;
-  static const int XYYX = 0x14;
-  static const int XYYY = 0x54;
-  static const int XYYZ = 0x94;
-  static const int XYYW = 0xD4;
-  static const int XYZX = 0x24;
-  static const int XYZY = 0x64;
-  static const int XYZZ = 0xA4;
-  static const int XYZW = 0xE4;
-  static const int XYWX = 0x34;
-  static const int XYWY = 0x74;
-  static const int XYWZ = 0xB4;
-  static const int XYWW = 0xF4;
-  static const int XZXX = 0x8;
-  static const int XZXY = 0x48;
-  static const int XZXZ = 0x88;
-  static const int XZXW = 0xC8;
-  static const int XZYX = 0x18;
-  static const int XZYY = 0x58;
-  static const int XZYZ = 0x98;
-  static const int XZYW = 0xD8;
-  static const int XZZX = 0x28;
-  static const int XZZY = 0x68;
-  static const int XZZZ = 0xA8;
-  static const int XZZW = 0xE8;
-  static const int XZWX = 0x38;
-  static const int XZWY = 0x78;
-  static const int XZWZ = 0xB8;
-  static const int XZWW = 0xF8;
-  static const int XWXX = 0xC;
-  static const int XWXY = 0x4C;
-  static const int XWXZ = 0x8C;
-  static const int XWXW = 0xCC;
-  static const int XWYX = 0x1C;
-  static const int XWYY = 0x5C;
-  static const int XWYZ = 0x9C;
-  static const int XWYW = 0xDC;
-  static const int XWZX = 0x2C;
-  static const int XWZY = 0x6C;
-  static const int XWZZ = 0xAC;
-  static const int XWZW = 0xEC;
-  static const int XWWX = 0x3C;
-  static const int XWWY = 0x7C;
-  static const int XWWZ = 0xBC;
-  static const int XWWW = 0xFC;
-  static const int YXXX = 0x1;
-  static const int YXXY = 0x41;
-  static const int YXXZ = 0x81;
-  static const int YXXW = 0xC1;
-  static const int YXYX = 0x11;
-  static const int YXYY = 0x51;
-  static const int YXYZ = 0x91;
-  static const int YXYW = 0xD1;
-  static const int YXZX = 0x21;
-  static const int YXZY = 0x61;
-  static const int YXZZ = 0xA1;
-  static const int YXZW = 0xE1;
-  static const int YXWX = 0x31;
-  static const int YXWY = 0x71;
-  static const int YXWZ = 0xB1;
-  static const int YXWW = 0xF1;
-  static const int YYXX = 0x5;
-  static const int YYXY = 0x45;
-  static const int YYXZ = 0x85;
-  static const int YYXW = 0xC5;
-  static const int YYYX = 0x15;
-  static const int YYYY = 0x55;
-  static const int YYYZ = 0x95;
-  static const int YYYW = 0xD5;
-  static const int YYZX = 0x25;
-  static const int YYZY = 0x65;
-  static const int YYZZ = 0xA5;
-  static const int YYZW = 0xE5;
-  static const int YYWX = 0x35;
-  static const int YYWY = 0x75;
-  static const int YYWZ = 0xB5;
-  static const int YYWW = 0xF5;
-  static const int YZXX = 0x9;
-  static const int YZXY = 0x49;
-  static const int YZXZ = 0x89;
-  static const int YZXW = 0xC9;
-  static const int YZYX = 0x19;
-  static const int YZYY = 0x59;
-  static const int YZYZ = 0x99;
-  static const int YZYW = 0xD9;
-  static const int YZZX = 0x29;
-  static const int YZZY = 0x69;
-  static const int YZZZ = 0xA9;
-  static const int YZZW = 0xE9;
-  static const int YZWX = 0x39;
-  static const int YZWY = 0x79;
-  static const int YZWZ = 0xB9;
-  static const int YZWW = 0xF9;
-  static const int YWXX = 0xD;
-  static const int YWXY = 0x4D;
-  static const int YWXZ = 0x8D;
-  static const int YWXW = 0xCD;
-  static const int YWYX = 0x1D;
-  static const int YWYY = 0x5D;
-  static const int YWYZ = 0x9D;
-  static const int YWYW = 0xDD;
-  static const int YWZX = 0x2D;
-  static const int YWZY = 0x6D;
-  static const int YWZZ = 0xAD;
-  static const int YWZW = 0xED;
-  static const int YWWX = 0x3D;
-  static const int YWWY = 0x7D;
-  static const int YWWZ = 0xBD;
-  static const int YWWW = 0xFD;
-  static const int ZXXX = 0x2;
-  static const int ZXXY = 0x42;
-  static const int ZXXZ = 0x82;
-  static const int ZXXW = 0xC2;
-  static const int ZXYX = 0x12;
-  static const int ZXYY = 0x52;
-  static const int ZXYZ = 0x92;
-  static const int ZXYW = 0xD2;
-  static const int ZXZX = 0x22;
-  static const int ZXZY = 0x62;
-  static const int ZXZZ = 0xA2;
-  static const int ZXZW = 0xE2;
-  static const int ZXWX = 0x32;
-  static const int ZXWY = 0x72;
-  static const int ZXWZ = 0xB2;
-  static const int ZXWW = 0xF2;
-  static const int ZYXX = 0x6;
-  static const int ZYXY = 0x46;
-  static const int ZYXZ = 0x86;
-  static const int ZYXW = 0xC6;
-  static const int ZYYX = 0x16;
-  static const int ZYYY = 0x56;
-  static const int ZYYZ = 0x96;
-  static const int ZYYW = 0xD6;
-  static const int ZYZX = 0x26;
-  static const int ZYZY = 0x66;
-  static const int ZYZZ = 0xA6;
-  static const int ZYZW = 0xE6;
-  static const int ZYWX = 0x36;
-  static const int ZYWY = 0x76;
-  static const int ZYWZ = 0xB6;
-  static const int ZYWW = 0xF6;
-  static const int ZZXX = 0xA;
-  static const int ZZXY = 0x4A;
-  static const int ZZXZ = 0x8A;
-  static const int ZZXW = 0xCA;
-  static const int ZZYX = 0x1A;
-  static const int ZZYY = 0x5A;
-  static const int ZZYZ = 0x9A;
-  static const int ZZYW = 0xDA;
-  static const int ZZZX = 0x2A;
-  static const int ZZZY = 0x6A;
-  static const int ZZZZ = 0xAA;
-  static const int ZZZW = 0xEA;
-  static const int ZZWX = 0x3A;
-  static const int ZZWY = 0x7A;
-  static const int ZZWZ = 0xBA;
-  static const int ZZWW = 0xFA;
-  static const int ZWXX = 0xE;
-  static const int ZWXY = 0x4E;
-  static const int ZWXZ = 0x8E;
-  static const int ZWXW = 0xCE;
-  static const int ZWYX = 0x1E;
-  static const int ZWYY = 0x5E;
-  static const int ZWYZ = 0x9E;
-  static const int ZWYW = 0xDE;
-  static const int ZWZX = 0x2E;
-  static const int ZWZY = 0x6E;
-  static const int ZWZZ = 0xAE;
-  static const int ZWZW = 0xEE;
-  static const int ZWWX = 0x3E;
-  static const int ZWWY = 0x7E;
-  static const int ZWWZ = 0xBE;
-  static const int ZWWW = 0xFE;
-  static const int WXXX = 0x3;
-  static const int WXXY = 0x43;
-  static const int WXXZ = 0x83;
-  static const int WXXW = 0xC3;
-  static const int WXYX = 0x13;
-  static const int WXYY = 0x53;
-  static const int WXYZ = 0x93;
-  static const int WXYW = 0xD3;
-  static const int WXZX = 0x23;
-  static const int WXZY = 0x63;
-  static const int WXZZ = 0xA3;
-  static const int WXZW = 0xE3;
-  static const int WXWX = 0x33;
-  static const int WXWY = 0x73;
-  static const int WXWZ = 0xB3;
-  static const int WXWW = 0xF3;
-  static const int WYXX = 0x7;
-  static const int WYXY = 0x47;
-  static const int WYXZ = 0x87;
-  static const int WYXW = 0xC7;
-  static const int WYYX = 0x17;
-  static const int WYYY = 0x57;
-  static const int WYYZ = 0x97;
-  static const int WYYW = 0xD7;
-  static const int WYZX = 0x27;
-  static const int WYZY = 0x67;
-  static const int WYZZ = 0xA7;
-  static const int WYZW = 0xE7;
-  static const int WYWX = 0x37;
-  static const int WYWY = 0x77;
-  static const int WYWZ = 0xB7;
-  static const int WYWW = 0xF7;
-  static const int WZXX = 0xB;
-  static const int WZXY = 0x4B;
-  static const int WZXZ = 0x8B;
-  static const int WZXW = 0xCB;
-  static const int WZYX = 0x1B;
-  static const int WZYY = 0x5B;
-  static const int WZYZ = 0x9B;
-  static const int WZYW = 0xDB;
-  static const int WZZX = 0x2B;
-  static const int WZZY = 0x6B;
-  static const int WZZZ = 0xAB;
-  static const int WZZW = 0xEB;
-  static const int WZWX = 0x3B;
-  static const int WZWY = 0x7B;
-  static const int WZWZ = 0xBB;
-  static const int WZWW = 0xFB;
-  static const int WWXX = 0xF;
-  static const int WWXY = 0x4F;
-  static const int WWXZ = 0x8F;
-  static const int WWXW = 0xCF;
-  static const int WWYX = 0x1F;
-  static const int WWYY = 0x5F;
-  static const int WWYZ = 0x9F;
-  static const int WWYW = 0xDF;
-  static const int WWZX = 0x2F;
-  static const int WWZY = 0x6F;
-  static const int WWZZ = 0xAF;
-  static const int WWZW = 0xEF;
-  static const int WWWX = 0x3F;
-  static const int WWWY = 0x7F;
-  static const int WWWZ = 0xBF;
-  static const int WWWW = 0xFF;
-
-}
-
-
-class Float64x2 {
-  factory Float64x2(double x, double y) native "Float64x2_fromDoubles";
-  factory Float64x2.splat(double v) native "Float64x2_splat";
-  factory Float64x2.zero() native "Float64x2_zero";
-  factory Float64x2.fromFloat32x4(Float32x4 v) native "Float64x2_fromFloat32x4";
-
-  Float64x2 operator +(Float64x2 other) {
-    return _add(other);
-  }
-  Float64x2 _add(Float64x2 other) native "Float64x2_add";
-  Float64x2 operator -() {
-    return _negate();
-  }
-  Float64x2 _negate() native "Float64x2_negate";
-  Float64x2 operator -(Float64x2 other) {
-    return _sub(other);
-  }
-  Float64x2 _sub(Float64x2 other) native "Float64x2_sub";
-  Float64x2 operator *(Float64x2 other) {
-    return _mul(other);
-  }
-  Float64x2 _mul(Float64x2 other) native "Float64x2_mul";
-  Float64x2 operator /(Float64x2 other) {
-    return _div(other);
-  }
-  Float64x2 _div(Float64x2 other) native "Float64x2_div";
-
-
-  /// Returns a copy of [this] each lane being scaled by [s].
-  Float64x2 scale(double s) native "Float64x2_scale";
-  /// Returns the absolute value of this [Float64x2].
-  Float64x2 abs() native "Float64x2_abs";
-
-  /// Clamps [this] to be in the range [lowerLimit]-[upperLimit].
-  Float64x2 clamp(Float64x2 lowerLimit,
-                  Float64x2 upperLimit) native "Float64x2_clamp";
-
-  /// Extracted x value.
-  double get x native "Float64x2_getX";
-  /// Extracted y value.
-  double get y native "Float64x2_getY";
-
-  /// Extract the sign bits from each lane return them in the first 2 bits.
-  int get signMask native "Float64x2_getSignMask";
-
-  /// Returns a new [Float64x2] copied from [this] with a new x value.
-  Float64x2 withX(double x) native "Float64x2_setX";
-  /// Returns a new [Float64x2] copied from [this] with a new y value.
-  Float64x2 withY(double y) native "Float64x2_setY";
-
-  /// Returns the lane-wise minimum value in [this] or [other].
-  Float64x2 min(Float64x2 other) native "Float64x2_min";
-
-  /// Returns the lane-wise maximum value in [this] or [other].
-  Float64x2 max(Float64x2 other) native "Float64x2_max";
-
-  /// Returns the lane-wise square root of [this].
-  Float64x2 sqrt() native "Float64x2_sqrt";
-}
-
-
-
-class _TypedListIterator<E> implements Iterator<E> {
-  final List<E> _array;
-  final int _length;
-  int _position;
-  E _current;
-
-  _TypedListIterator(List array)
-      : _array = array, _length = array.length, _position = -1 {
-    assert(array is _TypedList || array is _TypedListView);
-  }
-
-  bool moveNext() {
-    int nextPosition = _position + 1;
-    if (nextPosition < _length) {
-      _current = _array[nextPosition];
-      _position = nextPosition;
-      return true;
-    }
-    _position = _length;
-    _current = null;
-    return false;
-  }
-
-  E get current => _current;
-}
-
-
-class _TypedListView extends _TypedListBase implements TypedData {
-  _TypedListView(ByteBuffer _buffer, int _offset, int _length)
-    : _typedData = _buffer._data,
-      offsetInBytes = _offset,
-      length = _length {
-  }
-
-  // Method(s) implementing the TypedData interface.
-
-  int get lengthInBytes {
-    return length * elementSizeInBytes;
-  }
-
-  ByteBuffer get buffer {
-    return _typedData.buffer;
-  }
-
-  final _TypedList _typedData;
-  final int offsetInBytes;
-  final int length;
-}
-
-
-class _Int8ArrayView extends _TypedListView with _IntListMixin implements Int8List {
-  // Constructor.
-  _Int8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Int8List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                _offsetInBytes,
-                length * Int8List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getInt8(offsetInBytes +
-                               (index * Int8List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT),
-                        _toInt8(value));
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int8List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int8List _createList(int length) {
-    return new Int8List(length);
-  }
-}
-
-
-class _Uint8ArrayView extends _TypedListView with _IntListMixin implements Uint8List {
-  // Constructor.
-  _Uint8ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Uint8List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                _offsetInBytes,
-                length * Uint8List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getUint8(offsetInBytes +
-                                (index * Uint8List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
-                         _toUint8(value));
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint8List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint8List _createList(int length) {
-    return new Uint8List(length);
-  }
-}
-
-
-class _Uint8ClampedArrayView extends _TypedListView with _IntListMixin implements Uint8ClampedList {
-  // Constructor.
-  _Uint8ClampedArrayView(ByteBuffer buffer,
-                         [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Uint8List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Uint8List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getUint8(offsetInBytes +
-                                (index * Uint8List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
-                         _toClampedUint8(value));
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint8List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint8ClampedList _createList(int length) {
-    return new Uint8ClampedList(length);
-  }
-}
-
-
-class _Int16ArrayView extends _TypedListView with _IntListMixin implements Int16List {
-  // Constructor.
-  _Int16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Int16List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Int16List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getInt16(offsetInBytes +
-                                (index * Int16List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT),
-                         _toInt16(value));
-  }
-
-  void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
-    if (iterable is CodeUnits) {
-      end = RangeError.checkValidRange(start, end, this.length);
-      int length = end - start;
-      int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT;
-      _typedData._setCodeUnits(iterable, byteStart, length, skipCount);
-    } else {
-      super.setRange(start, end, iterable, skipCount);
-    }
-  }
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int16List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int16List _createList(int length) {
-    return new Int16List(length);
-  }
-}
-
-
-class _Uint16ArrayView extends _TypedListView with _IntListMixin implements Uint16List {
-  // Constructor.
-  _Uint16ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Uint16List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Uint16List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getUint16(offsetInBytes +
-                                 (index * Uint16List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT),
-                          _toUint16(value));
-  }
-
-  void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
-    if (iterable is CodeUnits) {
-      end = RangeError.checkValidRange(start, end, this.length);
-      int length = end - start;
-      int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT;
-      _typedData._setCodeUnits(iterable, byteStart, length, skipCount);
-    } else {
-      super.setRange(start, end, iterable, skipCount);
-    }
-  }
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint16List.BYTES_PER_ELEMENT;
-  }
-
-  // Internal utility methods.
-
-  Uint16List _createList(int length) {
-    return new Uint16List(length);
-  }
-}
-
-
-class _Int32ArrayView extends _TypedListView with _IntListMixin implements Int32List {
-  // Constructor.
-  _Int32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Int32List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Int32List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getInt32(offsetInBytes +
-                                (index * Int32List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT),
-                         _toInt32(value));
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int32List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int32List _createList(int length) {
-    return new Int32List(length);
-  }
-}
-
-
-class _Uint32ArrayView extends _TypedListView with _IntListMixin implements Uint32List {
-  // Constructor.
-  _Uint32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Uint32List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Uint32List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getUint32(offsetInBytes +
-                                 (index * Uint32List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT),
-                          _toUint32(value));
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint32List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint32List _createList(int length) {
-    return new Uint32List(length);
-  }
-}
-
-
-class _Int64ArrayView extends _TypedListView with _IntListMixin implements Int64List {
-  // Constructor.
-  _Int64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Int64List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Int64List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getInt64(offsetInBytes +
-                                (index * Int64List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT),
-                         _toInt64(value));
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int64List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int64List _createList(int length) {
-    return new Int64List(length);
-  }
-}
-
-
-class _Uint64ArrayView extends _TypedListView with _IntListMixin implements Uint64List {
-  // Constructor.
-  _Uint64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Uint64List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Uint64List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  int operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getUint64(offsetInBytes +
-                                 (index * Uint64List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, int value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT),
-                          _toUint64(value));
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Uint64List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Uint64List _createList(int length) {
-    return new Uint64List(length);
-  }
-}
-
-
-class _Float32ArrayView extends _TypedListView with _DoubleListMixin implements Float32List {
-  // Constructor.
-  _Float32ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Float32List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Float32List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  double operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getFloat32(offsetInBytes +
-                                  (index * Float32List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, double value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setFloat32(offsetInBytes +
-                           (index * Float32List.BYTES_PER_ELEMENT), value);
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Float32List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float32List _createList(int length) {
-    return new Float32List(length);
-  }
-}
-
-
-class _Float64ArrayView extends _TypedListView with _DoubleListMixin implements Float64List {
-  // Constructor.
-  _Float64ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Float64List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Float64List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  double operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getFloat64(offsetInBytes +
-                                  (index * Float64List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, double value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setFloat64(offsetInBytes +
-                          (index * Float64List.BYTES_PER_ELEMENT), value);
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Float64List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float64List _createList(int length) {
-    return new Float64List(length);
-  }
-}
-
-
-class _Float32x4ArrayView extends _TypedListView with _Float32x4ListMixin implements Float32x4List {
-  // Constructor.
-  _Float32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Float32x4List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Float32x4List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  Float32x4 operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getFloat32x4(offsetInBytes +
-                                  (index * Float32x4List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, Float32x4 value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setFloat32x4(offsetInBytes +
-                             (index * Float32x4List.BYTES_PER_ELEMENT), value);
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Float32x4List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float32x4List _createList(int length) {
-    return new Float32x4List(length);
-  }
-}
-
-
-class _Int32x4ArrayView extends _TypedListView with _Int32x4ListMixin implements Int32x4List {
-  // Constructor.
-  _Int32x4ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Int32x4List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Int32x4List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  Int32x4 operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getInt32x4(offsetInBytes +
-                                   (index * Int32x4List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, Int32x4 value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setInt32x4(offsetInBytes +
-                            (index * Int32x4List.BYTES_PER_ELEMENT), value);
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Int32x4List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Int32x4List _createList(int length) {
-    return new Int32x4List(length);
-  }
-}
-
-
-class _Float64x2ArrayView extends _TypedListView with _Float64x2ListMixin implements Float64x2List {
-  // Constructor.
-  _Float64x2ArrayView(ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
-    : super(buffer, _offsetInBytes,
-            _defaultIfNull(_length,
-                           ((buffer.lengthInBytes - _offsetInBytes) ~/
-                            Float64x2List.BYTES_PER_ELEMENT))) {
-    _rangeCheck(buffer.lengthInBytes,
-                offsetInBytes,
-                length * Float64x2List.BYTES_PER_ELEMENT);
-    _offsetAlignmentCheck(_offsetInBytes, Float64x2List.BYTES_PER_ELEMENT);
-  }
-
-
-  // Method(s) implementing List interface.
-
-  Float64x2 operator[](int index) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    return _typedData._getFloat64x2(offsetInBytes +
-                                    (index * Float64x2List.BYTES_PER_ELEMENT));
-  }
-
-  void operator[]=(int index, Float64x2 value) {
-    if (index < 0 || index >= length) {
-      throw new RangeError.index(index, this, "index");
-    }
-    _typedData._setFloat64x2(offsetInBytes +
-                             (index * Float64x2List.BYTES_PER_ELEMENT), value);
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  int get elementSizeInBytes {
-    return Float64x2List.BYTES_PER_ELEMENT;
-  }
-
-
-  // Internal utility methods.
-
-  Float64x2List _createList(int length) {
-    return new Float64x2List(length);
-  }
-}
-
-
-class _ByteDataView implements ByteData {
-  _ByteDataView(TypedData typedData, int _offsetInBytes, int _lengthInBytes)
-    : _typedData = typedData,
-      _offset = _offsetInBytes,
-      length = _lengthInBytes {
-    _rangeCheck(_typedData.lengthInBytes, _offset, length);
-  }
-
-
-  // Method(s) implementing TypedData interface.
-
-  ByteBuffer get buffer {
-    return _typedData.buffer;
-  }
-
-  int get lengthInBytes {
-    return length;
-  }
-
-  int get offsetInBytes {
-    return _offset;
-  }
-
-  int get elementSizeInBytes {
-    return 1;
-  }
-
-  // Method(s) implementing ByteData interface.
-
-  int getInt8(int byteOffset) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      throw new RangeError.index(byteOffset, this, "byteOffset");
-    }
-    return _typedData._getInt8(_offset + byteOffset);
-  }
-  void setInt8(int byteOffset, int value) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      throw new RangeError.index(byteOffset, this, "byteOffset");
-    }
-    _typedData._setInt8(_offset + byteOffset, value);
-  }
-
-  int getUint8(int byteOffset) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      throw new RangeError.index(byteOffset, this, "byteOffset");
-    }
-    return _typedData._getUint8(_offset + byteOffset);
-  }
-  void setUint8(int byteOffset, int value) {
-    if (byteOffset < 0 || byteOffset >= length) {
-      throw new RangeError.index(byteOffset, this, "byteOffset");
-    }
-    _typedData._setUint8(_offset + byteOffset, value);
-  }
-
-  int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 1 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
-    }
-    var result = _typedData._getInt16(_offset + byteOffset);
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      return result;
-    }
-    return _byteSwap16(result).toSigned(16);
-  }
-  void setInt16(int byteOffset,
-                int value,
-                [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 1 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
-    }
-    _typedData._setInt16(_offset + byteOffset,
-        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
-  }
-
-  int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 1 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
-    }
-    var result = _typedData._getUint16(_offset + byteOffset);
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      return result;
-    }
-    return _byteSwap16(result);
-  }
-  void setUint16(int byteOffset,
-                 int value,
-                 [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 1 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
-    }
-    _typedData._setUint16(_offset + byteOffset,
-        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
-  }
-
-  int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
-    }
-    var result = _typedData._getInt32(_offset + byteOffset);
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      return result;
-    }
-    return _byteSwap32(result).toSigned(32);
-  }
-  void setInt32(int byteOffset,
-                int value,
-                [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
-    }
-    _typedData._setInt32(_offset + byteOffset,
-        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
-  }
-
-  int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
-    }
-    var result = _typedData._getUint32(_offset + byteOffset);
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      return result;
-    }
-    return _byteSwap32(result);
-  }
-  void setUint32(int byteOffset,
-                 int value,
-                 [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
-    }
-    _typedData._setUint32(_offset + byteOffset,
-        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
-  }
-
-  int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
-    }
-    var result = _typedData._getInt64(_offset + byteOffset);
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      return result;
-    }
-    return _byteSwap64(result).toSigned(64);
-  }
-  void setInt64(int byteOffset,
-                int value,
-                [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
-    }
-    _typedData._setInt64(_offset + byteOffset,
-        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
-  }
-
-  int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
-    }
-    var result = _typedData._getUint64(_offset + byteOffset);
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      return result;
-    }
-    return _byteSwap64(result);
-  }
-  void setUint64(int byteOffset,
-                 int value,
-                 [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
-    }
-    _typedData._setUint64(_offset + byteOffset,
-        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
-  }
-
-  double getFloat32(int byteOffset,
-                    [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
-    }
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      return _typedData._getFloat32(_offset + byteOffset);
-    }
-    _convU32[0] = _byteSwap32(_typedData._getUint32(_offset + byteOffset));
-    return _convF32[0];
-  }
-  void setFloat32(int byteOffset,
-                  double value,
-                  [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
-    }
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      _typedData._setFloat32(_offset + byteOffset, value);
-      return;
-    }
-    _convF32[0] = value;
-    _typedData._setUint32(_offset + byteOffset, _byteSwap32(_convU32[0]));
-  }
-
-  double getFloat64(int byteOffset,
-                    [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
-    }
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      return _typedData._getFloat64(_offset + byteOffset);
-    }
-    _convU64[0] = _byteSwap64(_typedData._getUint64(_offset + byteOffset));
-    return _convF64[0];
-  }
-  void setFloat64(int byteOffset,
-                  double value,
-                  [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 7 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
-    }
-    if (identical(endian, Endianness.HOST_ENDIAN)) {
-      _typedData._setFloat64(_offset + byteOffset, value);
-      return;
-    }
-    _convF64[0] = value;
-    _typedData._setUint64(_offset + byteOffset, _byteSwap64(_convU64[0]));
-  }
-
-  Float32x4 getFloat32x4(int byteOffset,
-                         [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
-    }
-    // TODO(johnmccutchan) : Need to resolve this for endianity.
-    return _typedData._getFloat32x4(_offset + byteOffset);
-  }
-  void setFloat32x4(int byteOffset,
-                    Float32x4 value,
-                    [Endianness endian = Endianness.BIG_ENDIAN]) {
-    if (byteOffset < 0 || byteOffset + 3 >= length) {
-      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
-    }
-    // TODO(johnmccutchan) : Need to resolve this for endianity.
-    _typedData._setFloat32x4(_offset + byteOffset, value);
-
-  }
-
-  final TypedData _typedData;
-  final int _offset;
-  final int length;
-}
-
-int _byteSwap16(int value) {
-  return ((value & 0xFF00) >> 8) |
-         ((value & 0x00FF) << 8);
-}
-
-int _byteSwap32(int value) {
-  value = ((value & 0xFF00FF00) >> 8)  | ((value & 0x00FF00FF) << 8);
-  value = ((value & 0xFFFF0000) >> 16) | ((value & 0x0000FFFF) << 16);
-  return value;
-}
-
-int _byteSwap64(int value) {
-  return (_byteSwap32(value) << 32) | _byteSwap32(value >> 32);
-}
-
-final _convU32 = new Uint32List(2);
-final _convU64 = new Uint64List.view(_convU32.buffer);
-final _convF32 = new Float32List.view(_convU32.buffer);
-final _convF64 = new Float64List.view(_convU32.buffer);
-
-// Top level utility methods.
-int _toInt(int value, int mask) {
-  value &= mask;
-  if (value > (mask >> 1)) value -= mask + 1;
-  return value;
-}
-
-
-int _toInt8(int value) {
-  return _toInt(value, 0xFF);
-}
-
-
-int _toUint8(int value) {
-  return value & 0xFF;
-}
-
-
-int _toClampedUint8(int value) {
-  if (value < 0) return 0;
-  if (value > 0xFF) return 0xFF;
-  return value;
-}
-
-
-int _toInt16(int value) {
-  return _toInt(value, 0xFFFF);
-}
-
-
-int _toUint16(int value) {
-  return value & 0xFFFF;
-}
-
-
-int _toInt32(int value) {
-  return _toInt(value, 0xFFFFFFFF);
-}
-
-
-int _toUint32(int value) {
-  return value & 0xFFFFFFFF;
-}
-
-
-int _toInt64(int value) {
-  // Avoid bigint mask when possible.
-  return (ClassID.getID(value) == ClassID.cidBigint) ?
-      _toInt(value, 0xFFFFFFFFFFFFFFFF) : value;
-}
-
-
-int _toUint64(int value) {
-  // Avoid bigint mask when possible.
-  return (ClassID.getID(value) == ClassID.cidBigint) ?
-      _toInt(value, 0xFFFFFFFFFFFFFFFF) : value;
-}
-
-
-void _rangeCheck(int listLength, int start, int length) {
-  if (length < 0) {
-    throw new RangeError.value(length);
-  }
-  if (start < 0) {
-    throw new RangeError.value(start);
-  }
-  if (start + length > listLength) {
-    throw new RangeError.value(start + length);
-  }
-}
-
-
-void _offsetAlignmentCheck(int offset, int alignment) {
-  if ((offset % alignment) != 0) {
-    throw new RangeError('Offset ($offset) must be a multiple of '
-                         'BYTES_PER_ELEMENT ($alignment)');
-  }
-}
-
-
-int _defaultIfNull(object, value) {
-  if (object == null) {
-    return value;
-  }
-  return object;
-}
diff --git a/runtime/lib/typed_data_patch.dart b/runtime/lib/typed_data_patch.dart
new file mode 100644
index 0000000..ab055ee
--- /dev/null
+++ b/runtime/lib/typed_data_patch.dart
@@ -0,0 +1,3070 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:_internal";
+import "dart:collection" show ListBase;
+import 'dart:math' show Random;
+
+@patch
+class ByteData implements TypedData {
+  @patch
+  factory ByteData(int length) {
+    var list = new Uint8List(length);
+    return new _ByteDataView(list, 0, length);
+  }
+
+  // Called directly from C code.
+  factory ByteData._view(TypedData typedData, int offsetInBytes, int length) {
+    return new _ByteDataView(typedData, offsetInBytes, length);
+  }
+}
+
+// Based class for _TypedList that provides common methods for implementing
+// the collection and list interfaces.
+// This class does not extend ListBase<T> since that would add type arguments
+// to instances of _TypeListBase. Instead the subclasses use type specific
+// mixins (like _IntListMixin, _DoubleListMixin) to implement ListBase<T>.
+abstract class _TypedListBase {
+  // Method(s) implementing the Collection interface.
+  bool contains(element) {
+    var len = this.length;
+    for (var i = 0; i < len; ++i) {
+      if (this[i] == element) return true;
+    }
+    return false;
+  }
+
+  void forEach(void f(element)) {
+    var len = this.length;
+    for (var i = 0; i < len; i++) {
+      f(this[i]);
+    }
+  }
+
+  String join([String separator = ""]) {
+    StringBuffer buffer = new StringBuffer();
+    buffer.writeAll(this, separator);
+    return buffer.toString();
+  }
+
+  dynamic reduce(dynamic combine(value, element)) {
+    var len = this.length;
+    if (len == 0) throw IterableElementError.noElement();
+    var i = 0;
+    var value = this[0];
+    for (var i = 1; i < len; ++i) {
+      value = combine(value, this[i]);
+    }
+    return value;
+  }
+
+  dynamic fold(
+      dynamic initialValue, dynamic combine(dynamic initialValue, element)) {
+    var len = this.length;
+    for (var i = 0; i < len; ++i) {
+      initialValue = combine(initialValue, this[i]);
+    }
+    return initialValue;
+  }
+
+  Iterable map(f(element)) => new MappedIterable(this, f);
+
+  Iterable expand(Iterable f(element)) => new ExpandIterable(this, f);
+
+  bool every(bool f(element)) {
+    var len = this.length;
+    for (var i = 0; i < len; ++i) {
+      if (!f(this[i])) return false;
+    }
+    return true;
+  }
+
+  bool any(bool f(element)) {
+    var len = this.length;
+    for (var i = 0; i < len; ++i) {
+      if (f(this[i])) return true;
+    }
+    return false;
+  }
+
+  dynamic firstWhere(bool test(element), {orElse()}) {
+    var len = this.length;
+    for (var i = 0; i < len; ++i) {
+      var element = this[i];
+      if (test(element)) return element;
+    }
+    if (orElse != null) return orElse();
+    throw IterableElementError.noElement();
+  }
+
+  dynamic lastWhere(bool test(element), {orElse()}) {
+    var result = null;
+    var len = this.length;
+    for (var i = len - 1; i >= 0; --i) {
+      var element = this[i];
+      if (test(element)) {
+        return element;
+      }
+    }
+    if (orElse != null) return orElse();
+    throw IterableElementError.noElement();
+  }
+
+  dynamic singleWhere(bool test(element)) {
+    var result = null;
+    bool foundMatching = false;
+    var len = this.length;
+    for (var i = 0; i < len; ++i) {
+      var element = this[i];
+      if (test(element)) {
+        if (foundMatching) {
+          throw IterableElementError.tooMany();
+        }
+        result = element;
+        foundMatching = true;
+      }
+    }
+    if (foundMatching) return result;
+    throw IterableElementError.noElement();
+  }
+
+  dynamic elementAt(int index) {
+    return this[index];
+  }
+
+  bool get isEmpty {
+    return this.length == 0;
+  }
+
+  bool get isNotEmpty => !isEmpty;
+
+  // Method(s) implementing the List interface.
+
+  set length(newLength) {
+    throw new UnsupportedError("Cannot resize a fixed-length list");
+  }
+
+  void add(value) {
+    throw new UnsupportedError("Cannot add to a fixed-length list");
+  }
+
+  void addAll(Iterable value) {
+    throw new UnsupportedError("Cannot add to a fixed-length list");
+  }
+
+  void insert(int index, value) {
+    throw new UnsupportedError("Cannot insert into a fixed-length list");
+  }
+
+  void insertAll(int index, Iterable values) {
+    throw new UnsupportedError("Cannot insert into a fixed-length list");
+  }
+
+  void sort([int compare(a, b)]) {
+    if (compare == null) compare = Comparable.compare;
+    Sort.sort(this, compare);
+  }
+
+  void shuffle([Random random]) {
+    if (random == null) random = new Random();
+    var i = this.length;
+    while (i > 1) {
+      int pos = random.nextInt(i);
+      i -= 1;
+      var tmp = this[i];
+      this[i] = this[pos];
+      this[pos] = tmp;
+    }
+  }
+
+  int indexOf(element, [int start = 0]) {
+    return Lists.indexOf(this, element, start, this.length);
+  }
+
+  int lastIndexOf(element, [int start = null]) {
+    if (start == null) start = this.length - 1;
+    return Lists.lastIndexOf(this, element, start);
+  }
+
+  void clear() {
+    throw new UnsupportedError("Cannot remove from a fixed-length list");
+  }
+
+  int removeLast() {
+    throw new UnsupportedError("Cannot remove from a fixed-length list");
+  }
+
+  bool remove(Object element) {
+    throw new UnsupportedError("Cannot remove from a fixed-length list");
+  }
+
+  bool removeAt(int index) {
+    throw new UnsupportedError("Cannot remove from a fixed-length list");
+  }
+
+  void removeWhere(bool test(element)) {
+    throw new UnsupportedError("Cannot remove from a fixed-length list");
+  }
+
+  void retainWhere(bool test(element)) {
+    throw new UnsupportedError("Cannot remove from a fixed-length list");
+  }
+
+  dynamic get first {
+    if (length > 0) return this[0];
+    throw IterableElementError.noElement();
+  }
+
+  dynamic get last {
+    if (length > 0) return this[length - 1];
+    throw IterableElementError.noElement();
+  }
+
+  dynamic get single {
+    if (length == 1) return this[0];
+    if (length == 0) throw IterableElementError.noElement();
+    throw IterableElementError.tooMany();
+  }
+
+  void removeRange(int start, int end) {
+    throw new UnsupportedError("Cannot remove from a fixed-length list");
+  }
+
+  void replaceRange(int start, int end, Iterable iterable) {
+    throw new UnsupportedError("Cannot remove from a fixed-length list");
+  }
+
+  List toList({bool growable: true}) {
+    return new List.from(this, growable: growable);
+  }
+
+  Set toSet() {
+    return new Set.from(this);
+  }
+
+  List sublist(int start, [int end]) {
+    end = RangeError.checkValidRange(start, end, this.length);
+    var length = end - start;
+    List result = _createList(length);
+    result.setRange(0, length, this, start);
+    return result;
+  }
+
+  void setRange(int start, int end, Iterable from, [int skipCount = 0]) {
+    // Check ranges.
+    if (0 > start || start > end || end > length) {
+      RangeError.checkValidRange(start, end, length); // Always throws.
+      assert(false);
+    }
+    if (skipCount < 0) {
+      throw new ArgumentError(skipCount);
+    }
+
+    final count = end - start;
+    if ((from.length - skipCount) < count) {
+      throw IterableElementError.tooFew();
+    }
+
+    if (from is _TypedListBase) {
+      if (this.elementSizeInBytes == from.elementSizeInBytes) {
+        if ((count < 10) && (from.buffer != this.buffer)) {
+          Lists.copy(from, skipCount, this, start, count);
+          return;
+        } else if (this.buffer._data._setRange(
+            start * elementSizeInBytes + this.offsetInBytes,
+            count * elementSizeInBytes,
+            from.buffer._data,
+            skipCount * elementSizeInBytes + from.offsetInBytes,
+            ClassID.getID(this),
+            ClassID.getID(from))) {
+          return;
+        }
+      } else if (from.buffer == this.buffer) {
+        // Different element sizes, but same buffer means that we need
+        // an intermediate structure.
+        // TODO(srdjan): Optimize to skip copying if the range does not overlap.
+        final temp_buffer = new List(count);
+        for (var i = 0; i < count; i++) {
+          temp_buffer[i] = from[skipCount + i];
+        }
+        for (var i = start; i < end; i++) {
+          this[i] = temp_buffer[i - start];
+        }
+        return;
+      }
+    }
+
+    if (count == 0) return;
+    List otherList;
+    int otherStart;
+    if (from is List) {
+      otherList = from;
+      otherStart = skipCount;
+    } else {
+      otherList = from.skip(skipCount).toList(growable: false);
+      otherStart = 0;
+    }
+    if (otherStart + count > otherList.length) {
+      throw IterableElementError.tooFew();
+    }
+    Lists.copy(otherList, otherStart, this, start, count);
+  }
+
+  void setAll(int index, Iterable iterable) {
+    final end = iterable.length + index;
+    setRange(index, end, iterable);
+  }
+
+  void fillRange(int start, int end, [fillValue]) {
+    RangeError.checkValidRange(start, end, this.length);
+    for (var i = start; i < end; ++i) {
+      this[i] = fillValue;
+    }
+  }
+
+  // Method(s) implementing Object interface.
+  String toString() => ListBase.listToString(this);
+
+  // Internal utility methods.
+
+  // Returns true if operation succeeds.
+  // 'fromCid' and 'toCid' may be cid-s of the views and therefore may not
+  // match the cids of 'this' and 'from'.
+  // Uses toCid and fromCid to decide if clamping is necessary.
+  // Element size of toCid and fromCid must match (test at caller).
+  bool _setRange(int startInBytes, int lengthInBytes, _TypedListBase from,
+      int startFromInBytes, int toCid, int fromCid) native "TypedData_setRange";
+}
+
+class _IntListMixin {
+  Iterable<int> where(bool f(int element)) => new WhereIterable<int>(this, f);
+
+  Iterable<int> take(int n) => new SubListIterable<int>(this, 0, n);
+
+  Iterable<int> takeWhile(bool test(int element)) =>
+      new TakeWhileIterable<int>(this, test);
+
+  Iterable<int> skip(int n) => new SubListIterable<int>(this, n, null);
+
+  Iterable<int> skipWhile(bool test(element)) =>
+      new SkipWhileIterable<int>(this, test);
+
+  Iterable<int> get reversed => new ReversedListIterable<int>(this);
+
+  Map<int, int> asMap() => new ListMapView<int>(this);
+
+  Iterable<int> getRange(int start, [int end]) {
+    RangeError.checkValidRange(start, end, this.length);
+    return new SubListIterable<int>(this, start, end);
+  }
+
+  Iterator<int> get iterator => new _TypedListIterator<int>(this);
+
+  List<int> toList({bool growable: true}) {
+    return new List<int>.from(this, growable: growable);
+  }
+
+  Set<int> toSet() {
+    return new Set<int>.from(this);
+  }
+}
+
+class _DoubleListMixin {
+  Iterable<double> where(bool f(int element)) =>
+      new WhereIterable<double>(this, f);
+
+  Iterable<double> take(int n) => new SubListIterable<double>(this, 0, n);
+
+  Iterable<double> takeWhile(bool test(int element)) =>
+      new TakeWhileIterable<double>(this, test);
+
+  Iterable<double> skip(int n) => new SubListIterable<double>(this, n, null);
+
+  Iterable<double> skipWhile(bool test(element)) =>
+      new SkipWhileIterable<double>(this, test);
+
+  Iterable<double> get reversed => new ReversedListIterable<double>(this);
+
+  Map<int, double> asMap() => new ListMapView<double>(this);
+
+  Iterable<double> getRange(int start, [int end]) {
+    RangeError.checkValidRange(start, end, this.length);
+    return new SubListIterable<double>(this, start, end);
+  }
+
+  Iterator<double> get iterator => new _TypedListIterator<double>(this);
+
+  List<double> toList({bool growable: true}) {
+    return new List<double>.from(this, growable: growable);
+  }
+
+  Set<double> toSet() {
+    return new Set<double>.from(this);
+  }
+}
+
+class _Float32x4ListMixin {
+  Iterable<Float32x4> where(bool f(int element)) =>
+      new WhereIterable<Float32x4>(this, f);
+
+  Iterable<Float32x4> take(int n) => new SubListIterable<Float32x4>(this, 0, n);
+
+  Iterable<Float32x4> takeWhile(bool test(int element)) =>
+      new TakeWhileIterable<Float32x4>(this, test);
+
+  Iterable<Float32x4> skip(int n) =>
+      new SubListIterable<Float32x4>(this, n, null);
+
+  Iterable<Float32x4> skipWhile(bool test(element)) =>
+      new SkipWhileIterable<Float32x4>(this, test);
+
+  Iterable<Float32x4> get reversed => new ReversedListIterable<Float32x4>(this);
+
+  Map<int, Float32x4> asMap() => new ListMapView<Float32x4>(this);
+
+  Iterable<Float32x4> getRange(int start, [int end]) {
+    RangeError.checkValidRange(start, end, this.length);
+    return new SubListIterable<Float32x4>(this, start, end);
+  }
+
+  Iterator<Float32x4> get iterator => new _TypedListIterator<Float32x4>(this);
+
+  List<Float32x4> toList({bool growable: true}) {
+    return new List<Float32x4>.from(this, growable: growable);
+  }
+
+  Set<Float32x4> toSet() {
+    return new Set<Float32x4>.from(this);
+  }
+}
+
+class _Int32x4ListMixin {
+  Iterable<Int32x4> where(bool f(int element)) =>
+      new WhereIterable<Int32x4>(this, f);
+
+  Iterable<Int32x4> take(int n) => new SubListIterable<Int32x4>(this, 0, n);
+
+  Iterable<Int32x4> takeWhile(bool test(int element)) =>
+      new TakeWhileIterable<Int32x4>(this, test);
+
+  Iterable<Int32x4> skip(int n) => new SubListIterable<Int32x4>(this, n, null);
+
+  Iterable<Int32x4> skipWhile(bool test(element)) =>
+      new SkipWhileIterable<Int32x4>(this, test);
+
+  Iterable<Int32x4> get reversed => new ReversedListIterable<Int32x4>(this);
+
+  Map<int, Int32x4> asMap() => new ListMapView<Int32x4>(this);
+
+  Iterable<Int32x4> getRange(int start, [int end]) {
+    RangeError.checkValidRange(start, end, this.length);
+    return new SubListIterable<Int32x4>(this, start, end);
+  }
+
+  Iterator<Int32x4> get iterator => new _TypedListIterator<Int32x4>(this);
+
+  List<Int32x4> toList({bool growable: true}) {
+    return new List<Int32x4>.from(this, growable: growable);
+  }
+
+  Set<Int32x4> toSet() {
+    return new Set<Int32x4>.from(this);
+  }
+}
+
+class _Float64x2ListMixin {
+  Iterable<Float64x2> where(bool f(int element)) =>
+      new WhereIterable<Float64x2>(this, f);
+
+  Iterable<Float64x2> take(int n) => new SubListIterable<Float64x2>(this, 0, n);
+
+  Iterable<Float64x2> takeWhile(bool test(int element)) =>
+      new TakeWhileIterable<Float64x2>(this, test);
+
+  Iterable<Float64x2> skip(int n) =>
+      new SubListIterable<Float64x2>(this, n, null);
+
+  Iterable<Float64x2> skipWhile(bool test(element)) =>
+      new SkipWhileIterable<Float64x2>(this, test);
+
+  Iterable<Float64x2> get reversed => new ReversedListIterable<Float64x2>(this);
+
+  Map<int, Float64x2> asMap() => new ListMapView<Float64x2>(this);
+
+  Iterable<Float64x2> getRange(int start, [int end]) {
+    RangeError.checkValidRange(start, end, this.length);
+    return new SubListIterable<Float64x2>(this, start, end);
+  }
+
+  Iterator<Float64x2> get iterator => new _TypedListIterator<Float64x2>(this);
+
+  List<Float64x2> toList({bool growable: true}) {
+    return new List<Float64x2>.from(this, growable: growable);
+  }
+
+  Set<Float64x2> toSet() {
+    return new Set<Float64x2>.from(this);
+  }
+}
+
+class _ByteBuffer implements ByteBuffer {
+  final _TypedList _data;
+
+  _ByteBuffer(this._data);
+
+  factory _ByteBuffer._New(data) => new _ByteBuffer(data);
+
+  // Forward calls to _data.
+  int get lengthInBytes => _data.lengthInBytes;
+  int get hashCode => _data.hashCode;
+  bool operator ==(Object other) =>
+      (other is _ByteBuffer) && identical(_data, other._data);
+
+  ByteData asByteData([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length = this.lengthInBytes - offsetInBytes;
+    }
+    return new _ByteDataView(this._data, offsetInBytes, length);
+  }
+
+  Int8List asInt8List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length = this.lengthInBytes - offsetInBytes;
+    }
+    return new _Int8ArrayView(this, offsetInBytes, length);
+  }
+
+  Uint8List asUint8List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length = this.lengthInBytes - offsetInBytes;
+    }
+    return new _Uint8ArrayView(this, offsetInBytes, length);
+  }
+
+  Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length = this.lengthInBytes - offsetInBytes;
+    }
+    return new _Uint8ClampedArrayView(this, offsetInBytes, length);
+  }
+
+  Int16List asInt16List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length =
+          (this.lengthInBytes - offsetInBytes) ~/ Int16List.BYTES_PER_ELEMENT;
+    }
+    return new _Int16ArrayView(this, offsetInBytes, length);
+  }
+
+  Uint16List asUint16List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length =
+          (this.lengthInBytes - offsetInBytes) ~/ Uint16List.BYTES_PER_ELEMENT;
+    }
+    return new _Uint16ArrayView(this, offsetInBytes, length);
+  }
+
+  Int32List asInt32List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length =
+          (this.lengthInBytes - offsetInBytes) ~/ Int32List.BYTES_PER_ELEMENT;
+    }
+    return new _Int32ArrayView(this, offsetInBytes, length);
+  }
+
+  Uint32List asUint32List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length =
+          (this.lengthInBytes - offsetInBytes) ~/ Uint32List.BYTES_PER_ELEMENT;
+    }
+    return new _Uint32ArrayView(this, offsetInBytes, length);
+  }
+
+  Int64List asInt64List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length =
+          (this.lengthInBytes - offsetInBytes) ~/ Int64List.BYTES_PER_ELEMENT;
+    }
+    return new _Int64ArrayView(this, offsetInBytes, length);
+  }
+
+  Uint64List asUint64List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length =
+          (this.lengthInBytes - offsetInBytes) ~/ Uint64List.BYTES_PER_ELEMENT;
+    }
+    return new _Uint64ArrayView(this, offsetInBytes, length);
+  }
+
+  Float32List asFloat32List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length =
+          (this.lengthInBytes - offsetInBytes) ~/ Float32List.BYTES_PER_ELEMENT;
+    }
+    return new _Float32ArrayView(this, offsetInBytes, length);
+  }
+
+  Float64List asFloat64List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length =
+          (this.lengthInBytes - offsetInBytes) ~/ Float64List.BYTES_PER_ELEMENT;
+    }
+    return new _Float64ArrayView(this, offsetInBytes, length);
+  }
+
+  Float32x4List asFloat32x4List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length = (this.lengthInBytes - offsetInBytes) ~/
+          Float32x4List.BYTES_PER_ELEMENT;
+    }
+    return new _Float32x4ArrayView(this, offsetInBytes, length);
+  }
+
+  Int32x4List asInt32x4List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length =
+          (this.lengthInBytes - offsetInBytes) ~/ Int32x4List.BYTES_PER_ELEMENT;
+    }
+    return new _Int32x4ArrayView(this, offsetInBytes, length);
+  }
+
+  Float64x2List asFloat64x2List([int offsetInBytes = 0, int length]) {
+    if (length == null) {
+      length = (this.lengthInBytes - offsetInBytes) ~/
+          Float64x2List.BYTES_PER_ELEMENT;
+    }
+    return new _Float64x2ArrayView(this, offsetInBytes, length);
+  }
+}
+
+abstract class _TypedList extends _TypedListBase {
+  // Default method implementing parts of the TypedData interface.
+  int get offsetInBytes {
+    return 0;
+  }
+
+  int get lengthInBytes {
+    return length * elementSizeInBytes;
+  }
+
+  _ByteBuffer get buffer => new _ByteBuffer(this);
+
+  // Methods implementing the collection interface.
+
+  int get length native "TypedData_length";
+
+  // Internal utility methods.
+
+  int _getInt8(int offsetInBytes) native "TypedData_GetInt8";
+  void _setInt8(int offsetInBytes, int value) native "TypedData_SetInt8";
+
+  int _getUint8(int offsetInBytes) native "TypedData_GetUint8";
+  void _setUint8(int offsetInBytes, int value) native "TypedData_SetUint8";
+
+  int _getInt16(int offsetInBytes) native "TypedData_GetInt16";
+  void _setInt16(int offsetInBytes, int value) native "TypedData_SetInt16";
+
+  int _getUint16(int offsetInBytes) native "TypedData_GetUint16";
+  void _setUint16(int offsetInBytes, int value) native "TypedData_SetUint16";
+
+  int _getInt32(int offsetInBytes) native "TypedData_GetInt32";
+  void _setInt32(int offsetInBytes, int value) native "TypedData_SetInt32";
+
+  int _getUint32(int offsetInBytes) native "TypedData_GetUint32";
+  void _setUint32(int offsetInBytes, int value) native "TypedData_SetUint32";
+
+  int _getInt64(int offsetInBytes) native "TypedData_GetInt64";
+  void _setInt64(int offsetInBytes, int value) native "TypedData_SetInt64";
+
+  int _getUint64(int offsetInBytes) native "TypedData_GetUint64";
+  void _setUint64(int offsetInBytes, int value) native "TypedData_SetUint64";
+
+  double _getFloat32(int offsetInBytes) native "TypedData_GetFloat32";
+  void _setFloat32(int offsetInBytes, double value)
+      native "TypedData_SetFloat32";
+
+  double _getFloat64(int offsetInBytes) native "TypedData_GetFloat64";
+  void _setFloat64(int offsetInBytes, double value)
+      native "TypedData_SetFloat64";
+
+  Float32x4 _getFloat32x4(int offsetInBytes) native "TypedData_GetFloat32x4";
+  void _setFloat32x4(int offsetInBytes, Float32x4 value)
+      native "TypedData_SetFloat32x4";
+
+  Int32x4 _getInt32x4(int offsetInBytes) native "TypedData_GetInt32x4";
+  void _setInt32x4(int offsetInBytes, Int32x4 value)
+      native "TypedData_SetInt32x4";
+
+  Float64x2 _getFloat64x2(int offsetInBytes) native "TypedData_GetFloat64x2";
+  void _setFloat64x2(int offsetInBytes, Float64x2 value)
+      native "TypedData_SetFloat64x2";
+
+  /**
+   * Stores the [CodeUnits] as UTF-16 units into this TypedData at
+   * positions [start]..[end] (uint16 indices).
+   */
+  void _setCodeUnits(
+      CodeUnits units, int byteStart, int length, int skipCount) {
+    assert(byteStart + length * Uint16List.BYTES_PER_ELEMENT <= lengthInBytes);
+    String string = CodeUnits.stringOf(units);
+    int sliceEnd = skipCount + length;
+    RangeError.checkValidRange(
+        skipCount, sliceEnd, string.length, "skipCount", "skipCount + length");
+    for (int i = 0; i < length; i++) {
+      _setUint16(byteStart + i * Uint16List.BYTES_PER_ELEMENT,
+          string.codeUnitAt(skipCount + i));
+    }
+  }
+}
+
+@patch
+class Int8List {
+  @patch
+  factory Int8List(int length) native "TypedData_Int8Array_new";
+
+  @patch
+  factory Int8List.fromList(List<int> elements) {
+    return new Int8List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Int8List extends _TypedList with _IntListMixin implements Int8List {
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getInt8(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setInt8(index, _toInt8(value));
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Int8List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int8List _createList(int length) {
+    return new Int8List(length);
+  }
+}
+
+@patch
+class Uint8List {
+  @patch
+  factory Uint8List(int length) native "TypedData_Uint8Array_new";
+
+  @patch
+  factory Uint8List.fromList(List<int> elements) {
+    return new Uint8List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Uint8List extends _TypedList with _IntListMixin implements Uint8List {
+  // Methods implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getUint8(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setUint8(index, _toUint8(value));
+  }
+
+  // Methods implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Uint8List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint8List _createList(int length) {
+    return new Uint8List(length);
+  }
+}
+
+@patch
+class Uint8ClampedList {
+  @patch
+  factory Uint8ClampedList(int length) native "TypedData_Uint8ClampedArray_new";
+
+  @patch
+  factory Uint8ClampedList.fromList(List<int> elements) {
+    return new Uint8ClampedList(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Uint8ClampedList extends _TypedList
+    with _IntListMixin
+    implements Uint8ClampedList {
+  // Methods implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getUint8(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setUint8(index, _toClampedUint8(value));
+  }
+
+  // Methods implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Uint8List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint8ClampedList _createList(int length) {
+    return new Uint8ClampedList(length);
+  }
+}
+
+@patch
+class Int16List {
+  @patch
+  factory Int16List(int length) native "TypedData_Int16Array_new";
+
+  @patch
+  factory Int16List.fromList(List<int> elements) {
+    return new Int16List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Int16List extends _TypedList with _IntListMixin implements Int16List {
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedInt16(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedInt16(index, _toInt16(value));
+  }
+
+  void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
+    if (iterable is CodeUnits) {
+      end = RangeError.checkValidRange(start, end, this.length);
+      int length = end - start;
+      int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT;
+      _setCodeUnits(iterable, byteStart, length, skipCount);
+    } else {
+      super.setRange(start, end, iterable, skipCount);
+    }
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Int16List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int16List _createList(int length) {
+    return new Int16List(length);
+  }
+
+  int _getIndexedInt16(int index) {
+    return _getInt16(index * Int16List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedInt16(int index, int value) {
+    _setInt16(index * Int16List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Uint16List {
+  @patch
+  factory Uint16List(int length) native "TypedData_Uint16Array_new";
+
+  @patch
+  factory Uint16List.fromList(List<int> elements) {
+    return new Uint16List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Uint16List extends _TypedList with _IntListMixin implements Uint16List {
+  // Method(s) implementing the List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedUint16(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedUint16(index, _toUint16(value));
+  }
+
+  void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
+    if (iterable is CodeUnits) {
+      end = RangeError.checkValidRange(start, end, this.length);
+      int length = end - start;
+      int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT;
+      _setCodeUnits(iterable, byteStart, length, skipCount);
+    } else {
+      super.setRange(start, end, iterable, skipCount);
+    }
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Uint16List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint16List _createList(int length) {
+    return new Uint16List(length);
+  }
+
+  int _getIndexedUint16(int index) {
+    return _getUint16(index * Uint16List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedUint16(int index, int value) {
+    _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Int32List {
+  @patch
+  factory Int32List(int length) native "TypedData_Int32Array_new";
+
+  @patch
+  factory Int32List.fromList(List<int> elements) {
+    return new Int32List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Int32List extends _TypedList with _IntListMixin implements Int32List {
+  // Method(s) implementing the List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedInt32(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedInt32(index, _toInt32(value));
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Int32List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int32List _createList(int length) {
+    return new Int32List(length);
+  }
+
+  int _getIndexedInt32(int index) {
+    return _getInt32(index * Int32List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedInt32(int index, int value) {
+    _setInt32(index * Int32List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Uint32List {
+  @patch
+  factory Uint32List(int length) native "TypedData_Uint32Array_new";
+
+  @patch
+  factory Uint32List.fromList(List<int> elements) {
+    return new Uint32List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Uint32List extends _TypedList with _IntListMixin implements Uint32List {
+  // Method(s) implementing the List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedUint32(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedUint32(index, _toUint32(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Uint32List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint32List _createList(int length) {
+    return new Uint32List(length);
+  }
+
+  int _getIndexedUint32(int index) {
+    return _getUint32(index * Uint32List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedUint32(int index, int value) {
+    _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Int64List {
+  @patch
+  factory Int64List(int length) native "TypedData_Int64Array_new";
+
+  @patch
+  factory Int64List.fromList(List<int> elements) {
+    return new Int64List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Int64List extends _TypedList with _IntListMixin implements Int64List {
+  // Method(s) implementing the List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedInt64(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedInt64(index, _toInt64(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Int64List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int64List _createList(int length) {
+    return new Int64List(length);
+  }
+
+  int _getIndexedInt64(int index) {
+    return _getInt64(index * Int64List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedInt64(int index, int value) {
+    _setInt64(index * Int64List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Uint64List {
+  @patch
+  factory Uint64List(int length) native "TypedData_Uint64Array_new";
+
+  @patch
+  factory Uint64List.fromList(List<int> elements) {
+    return new Uint64List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Uint64List extends _TypedList with _IntListMixin implements Uint64List {
+  // Method(s) implementing the List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedUint64(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedUint64(index, _toUint64(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Uint64List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint64List _createList(int length) {
+    return new Uint64List(length);
+  }
+
+  int _getIndexedUint64(int index) {
+    return _getUint64(index * Uint64List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedUint64(int index, int value) {
+    _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Float32List {
+  @patch
+  factory Float32List(int length) native "TypedData_Float32Array_new";
+
+  @patch
+  factory Float32List.fromList(List<double> elements) {
+    return new Float32List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Float32List extends _TypedList
+    with _DoubleListMixin
+    implements Float32List {
+  // Method(s) implementing the List interface.
+  double operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedFloat32(index);
+  }
+
+  void operator []=(int index, double value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedFloat32(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Float32List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float32List _createList(int length) {
+    return new Float32List(length);
+  }
+
+  double _getIndexedFloat32(int index) {
+    return _getFloat32(index * Float32List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedFloat32(int index, double value) {
+    _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Float64List {
+  @patch
+  factory Float64List(int length) native "TypedData_Float64Array_new";
+
+  @patch
+  factory Float64List.fromList(List<double> elements) {
+    return new Float64List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Float64List extends _TypedList
+    with _DoubleListMixin
+    implements Float64List {
+  // Method(s) implementing the List interface.
+  double operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedFloat64(index);
+  }
+
+  void operator []=(int index, double value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedFloat64(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Float64List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float64List _createList(int length) {
+    return new Float64List(length);
+  }
+
+  double _getIndexedFloat64(int index) {
+    return _getFloat64(index * Float64List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedFloat64(int index, double value) {
+    _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Float32x4List {
+  @patch
+  factory Float32x4List(int length) native "TypedData_Float32x4Array_new";
+
+  @patch
+  factory Float32x4List.fromList(List<Float32x4> elements) {
+    return new Float32x4List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Float32x4List extends _TypedList
+    with _Float32x4ListMixin
+    implements Float32x4List {
+  Float32x4 operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedFloat32x4(index);
+  }
+
+  void operator []=(int index, Float32x4 value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedFloat32x4(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Float32x4List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float32x4List _createList(int length) {
+    return new Float32x4List(length);
+  }
+
+  Float32x4 _getIndexedFloat32x4(int index) {
+    return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedFloat32x4(int index, Float32x4 value) {
+    _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Int32x4List {
+  @patch
+  factory Int32x4List(int length) native "TypedData_Int32x4Array_new";
+
+  @patch
+  factory Int32x4List.fromList(List<Int32x4> elements) {
+    return new Int32x4List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Int32x4List extends _TypedList
+    with _Int32x4ListMixin
+    implements Int32x4List {
+  Int32x4 operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedInt32x4(index);
+  }
+
+  void operator []=(int index, Int32x4 value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedInt32x4(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Int32x4List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int32x4List _createList(int length) {
+    return new Int32x4List(length);
+  }
+
+  Int32x4 _getIndexedInt32x4(int index) {
+    return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedInt32x4(int index, Int32x4 value) {
+    _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Float64x2List {
+  @patch
+  factory Float64x2List(int length) native "TypedData_Float64x2Array_new";
+
+  @patch
+  factory Float64x2List.fromList(List<Float64x2> elements) {
+    return new Float64x2List(elements.length)
+      ..setRange(0, elements.length, elements);
+  }
+}
+
+class _Float64x2List extends _TypedList
+    with _Float64x2ListMixin
+    implements Float64x2List {
+  Float64x2 operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedFloat64x2(index);
+  }
+
+  void operator []=(int index, Float64x2 value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedFloat64x2(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Float64x2List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float64x2List _createList(int length) {
+    return new Float64x2List(length);
+  }
+
+  Float64x2 _getIndexedFloat64x2(int index) {
+    return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedFloat64x2(int index, Float64x2 value) {
+    _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalInt8Array extends _TypedList
+    with _IntListMixin
+    implements Int8List {
+  // Method(s) implementing the List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getInt8(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setInt8(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Int8List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int8List _createList(int length) {
+    return new Int8List(length);
+  }
+}
+
+class _ExternalUint8Array extends _TypedList
+    with _IntListMixin
+    implements Uint8List {
+  // Method(s) implementing the List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getUint8(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setUint8(index, _toUint8(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Uint8List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint8List _createList(int length) {
+    return new Uint8List(length);
+  }
+}
+
+class _ExternalUint8ClampedArray extends _TypedList
+    with _IntListMixin
+    implements Uint8ClampedList {
+  // Method(s) implementing the List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getUint8(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setUint8(index, _toClampedUint8(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Uint8List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint8ClampedList _createList(int length) {
+    return new Uint8ClampedList(length);
+  }
+}
+
+class _ExternalInt16Array extends _TypedList
+    with _IntListMixin
+    implements Int16List {
+  // Method(s) implementing the List interface.
+
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedInt16(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedInt16(index, _toInt16(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Int16List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int16List _createList(int length) {
+    return new Int16List(length);
+  }
+
+  int _getIndexedInt16(int index) {
+    return _getInt16(index * Int16List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedInt16(int index, int value) {
+    _setInt16(index * Int16List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalUint16Array extends _TypedList
+    with _IntListMixin
+    implements Uint16List {
+  // Method(s) implementing the List interface.
+
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedUint16(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedUint16(index, _toUint16(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Uint16List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint16List _createList(int length) {
+    return new Uint16List(length);
+  }
+
+  int _getIndexedUint16(int index) {
+    return _getUint16(index * Uint16List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedUint16(int index, int value) {
+    _setUint16(index * Uint16List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalInt32Array extends _TypedList
+    with _IntListMixin
+    implements Int32List {
+  // Method(s) implementing the List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedInt32(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedInt32(index, _toInt32(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Int32List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int32List _createList(int length) {
+    return new Int32List(length);
+  }
+
+  int _getIndexedInt32(int index) {
+    return _getInt32(index * Int32List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedInt32(int index, int value) {
+    _setInt32(index * Int32List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalUint32Array extends _TypedList
+    with _IntListMixin
+    implements Uint32List {
+  // Method(s) implementing the List interface.
+
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedUint32(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedUint32(index, _toUint32(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Uint32List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint32List _createList(int length) {
+    return new Uint32List(length);
+  }
+
+  int _getIndexedUint32(int index) {
+    return _getUint32(index * Uint32List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedUint32(int index, int value) {
+    _setUint32(index * Uint32List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalInt64Array extends _TypedList
+    with _IntListMixin
+    implements Int64List {
+  // Method(s) implementing the List interface.
+
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedInt64(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedInt64(index, _toInt64(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Int64List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int64List _createList(int length) {
+    return new Int64List(length);
+  }
+
+  int _getIndexedInt64(int index) {
+    return _getInt64(index * Int64List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedInt64(int index, int value) {
+    _setInt64(index * Int64List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalUint64Array extends _TypedList
+    with _IntListMixin
+    implements Uint64List {
+  // Method(s) implementing the List interface.
+
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedUint64(index);
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedUint64(index, _toUint64(value));
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Uint64List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint64List _createList(int length) {
+    return new Uint64List(length);
+  }
+
+  int _getIndexedUint64(int index) {
+    return _getUint64(index * Uint64List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedUint64(int index, int value) {
+    _setUint64(index * Uint64List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalFloat32Array extends _TypedList
+    with _DoubleListMixin
+    implements Float32List {
+  // Method(s) implementing the List interface.
+
+  double operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedFloat32(index);
+  }
+
+  void operator []=(int index, double value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedFloat32(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Float32List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float32List _createList(int length) {
+    return new Float32List(length);
+  }
+
+  double _getIndexedFloat32(int index) {
+    return _getFloat32(index * Float32List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedFloat32(int index, double value) {
+    _setFloat32(index * Float32List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalFloat64Array extends _TypedList
+    with _DoubleListMixin
+    implements Float64List {
+  // Method(s) implementing the List interface.
+
+  double operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedFloat64(index);
+  }
+
+  void operator []=(int index, double value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedFloat64(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Float64List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float64List _createList(int length) {
+    return new Float64List(length);
+  }
+
+  double _getIndexedFloat64(int index) {
+    return _getFloat64(index * Float64List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedFloat64(int index, double value) {
+    _setFloat64(index * Float64List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalFloat32x4Array extends _TypedList
+    with _Float32x4ListMixin
+    implements Float32x4List {
+  // Method(s) implementing the List interface.
+
+  Float32x4 operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedFloat32x4(index);
+  }
+
+  void operator []=(int index, Float32x4 value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedFloat32x4(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Float32x4List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float32x4List _createList(int length) {
+    return new Float32x4List(length);
+  }
+
+  Float32x4 _getIndexedFloat32x4(int index) {
+    return _getFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedFloat32x4(int index, Float32x4 value) {
+    _setFloat32x4(index * Float32x4List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalInt32x4Array extends _TypedList
+    with _Int32x4ListMixin
+    implements Int32x4List {
+  // Method(s) implementing the List interface.
+
+  Int32x4 operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedInt32x4(index);
+  }
+
+  void operator []=(int index, Int32x4 value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedInt32x4(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Int32x4List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int32x4List _createList(int length) {
+    return new Int32x4List(length);
+  }
+
+  Int32x4 _getIndexedInt32x4(int index) {
+    return _getInt32x4(index * Int32x4List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedInt32x4(int index, Int32x4 value) {
+    _setInt32x4(index * Int32x4List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+class _ExternalFloat64x2Array extends _TypedList
+    with _Float64x2ListMixin
+    implements Float64x2List {
+  // Method(s) implementing the List interface.
+  Float64x2 operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _getIndexedFloat64x2(index);
+  }
+
+  void operator []=(int index, Float64x2 value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _setIndexedFloat64x2(index, value);
+  }
+
+  // Method(s) implementing the TypedData interface.
+  int get elementSizeInBytes {
+    return Float64x2List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float64x2List _createList(int length) {
+    return new Float64x2List(length);
+  }
+
+  Float64x2 _getIndexedFloat64x2(int index) {
+    return _getFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT);
+  }
+
+  void _setIndexedFloat64x2(int index, Float64x2 value) {
+    _setFloat64x2(index * Float64x2List.BYTES_PER_ELEMENT, value);
+  }
+}
+
+@patch
+class Float32x4 {
+  @patch
+  factory Float32x4(double x, double y, double z, double w)
+      native "Float32x4_fromDoubles";
+
+  @patch
+  factory Float32x4.splat(double v) native "Float32x4_splat";
+
+  @patch
+  factory Float32x4.zero() native "Float32x4_zero";
+
+  @patch
+  factory Float32x4.fromInt32x4Bits(Int32x4 x)
+      native "Float32x4_fromInt32x4Bits";
+
+  @patch
+  factory Float32x4.fromFloat64x2(Float64x2 v) native "Float32x4_fromFloat64x2";
+}
+
+class _Float32x4 implements Float32x4 {
+  Float32x4 operator +(Float32x4 other) native "Float32x4_add";
+  Float32x4 operator -() native "Float32x4_negate";
+  Float32x4 operator -(Float32x4 other) native "Float32x4_sub";
+  Float32x4 operator *(Float32x4 other) native "Float32x4_mul";
+  Float32x4 operator /(Float32x4 other) native "Float32x4_div";
+  Int32x4 lessThan(Float32x4 other) native "Float32x4_cmplt";
+  Int32x4 lessThanOrEqual(Float32x4 other) native "Float32x4_cmplte";
+  Int32x4 greaterThan(Float32x4 other) native "Float32x4_cmpgt";
+  Int32x4 greaterThanOrEqual(Float32x4 other) native "Float32x4_cmpgte";
+  Int32x4 equal(Float32x4 other) native "Float32x4_cmpequal";
+  Int32x4 notEqual(Float32x4 other) native "Float32x4_cmpnequal";
+  Float32x4 scale(double s) native "Float32x4_scale";
+  Float32x4 abs() native "Float32x4_abs";
+  Float32x4 clamp(Float32x4 lowerLimit, Float32x4 upperLimit)
+      native "Float32x4_clamp";
+  double get x native "Float32x4_getX";
+  double get y native "Float32x4_getY";
+  double get z native "Float32x4_getZ";
+  double get w native "Float32x4_getW";
+  int get signMask native "Float32x4_getSignMask";
+
+  Float32x4 shuffle(int mask) native "Float32x4_shuffle";
+  Float32x4 shuffleMix(Float32x4 zw, int mask) native "Float32x4_shuffleMix";
+
+  Float32x4 withX(double x) native "Float32x4_setX";
+  Float32x4 withY(double y) native "Float32x4_setY";
+  Float32x4 withZ(double z) native "Float32x4_setZ";
+  Float32x4 withW(double w) native "Float32x4_setW";
+  Float32x4 min(Float32x4 other) native "Float32x4_min";
+  Float32x4 max(Float32x4 other) native "Float32x4_max";
+  Float32x4 sqrt() native "Float32x4_sqrt";
+  Float32x4 reciprocal() native "Float32x4_reciprocal";
+  Float32x4 reciprocalSqrt() native "Float32x4_reciprocalSqrt";
+}
+
+@patch
+class Int32x4 {
+  @patch
+  factory Int32x4(int x, int y, int z, int w) native "Int32x4_fromInts";
+
+  @patch
+  factory Int32x4.bool(bool x, bool y, bool z, bool w)
+      native "Int32x4_fromBools";
+
+  @patch
+  factory Int32x4.fromFloat32x4Bits(Float32x4 x)
+      native "Int32x4_fromFloat32x4Bits";
+}
+
+class _Int32x4 implements Int32x4 {
+  Int32x4 operator |(Int32x4 other) native "Int32x4_or";
+  Int32x4 operator &(Int32x4 other) native "Int32x4_and";
+  Int32x4 operator ^(Int32x4 other) native "Int32x4_xor";
+  Int32x4 operator +(Int32x4 other) native "Int32x4_add";
+  Int32x4 operator -(Int32x4 other) native "Int32x4_sub";
+  int get x native "Int32x4_getX";
+  int get y native "Int32x4_getY";
+  int get z native "Int32x4_getZ";
+  int get w native "Int32x4_getW";
+  int get signMask native "Int32x4_getSignMask";
+  Int32x4 shuffle(int mask) native "Int32x4_shuffle";
+  Int32x4 shuffleMix(Int32x4 zw, int mask) native "Int32x4_shuffleMix";
+  Int32x4 withX(int x) native "Int32x4_setX";
+  Int32x4 withY(int y) native "Int32x4_setY";
+  Int32x4 withZ(int z) native "Int32x4_setZ";
+  Int32x4 withW(int w) native "Int32x4_setW";
+  bool get flagX native "Int32x4_getFlagX";
+  bool get flagY native "Int32x4_getFlagY";
+  bool get flagZ native "Int32x4_getFlagZ";
+  bool get flagW native "Int32x4_getFlagW";
+  Int32x4 withFlagX(bool x) native "Int32x4_setFlagX";
+  Int32x4 withFlagY(bool y) native "Int32x4_setFlagY";
+  Int32x4 withFlagZ(bool z) native "Int32x4_setFlagZ";
+  Int32x4 withFlagW(bool w) native "Int32x4_setFlagW";
+  Float32x4 select(Float32x4 trueValue, Float32x4 falseValue)
+      native "Int32x4_select";
+}
+
+@patch
+class Float64x2 {
+  @patch
+  factory Float64x2(double x, double y) native "Float64x2_fromDoubles";
+
+  @patch
+  factory Float64x2.splat(double v) native "Float64x2_splat";
+
+  @patch
+  factory Float64x2.zero() native "Float64x2_zero";
+
+  @patch
+  factory Float64x2.fromFloat32x4(Float32x4 v) native "Float64x2_fromFloat32x4";
+}
+
+class _Float64x2 implements Float64x2 {
+  Float64x2 operator +(Float64x2 other) native "Float64x2_add";
+  Float64x2 operator -() native "Float64x2_negate";
+  Float64x2 operator -(Float64x2 other) native "Float64x2_sub";
+  Float64x2 operator *(Float64x2 other) native "Float64x2_mul";
+  Float64x2 operator /(Float64x2 other) native "Float64x2_div";
+  Float64x2 scale(double s) native "Float64x2_scale";
+  Float64x2 abs() native "Float64x2_abs";
+  Float64x2 clamp(Float64x2 lowerLimit, Float64x2 upperLimit)
+      native "Float64x2_clamp";
+  double get x native "Float64x2_getX";
+  double get y native "Float64x2_getY";
+  int get signMask native "Float64x2_getSignMask";
+  Float64x2 withX(double x) native "Float64x2_setX";
+  Float64x2 withY(double y) native "Float64x2_setY";
+  Float64x2 min(Float64x2 other) native "Float64x2_min";
+  Float64x2 max(Float64x2 other) native "Float64x2_max";
+  Float64x2 sqrt() native "Float64x2_sqrt";
+}
+
+class _TypedListIterator<E> implements Iterator<E> {
+  final List<E> _array;
+  final int _length;
+  int _position;
+  E _current;
+
+  _TypedListIterator(List array)
+      : _array = array,
+        _length = array.length,
+        _position = -1 {
+    assert(array is _TypedList || array is _TypedListView);
+  }
+
+  bool moveNext() {
+    int nextPosition = _position + 1;
+    if (nextPosition < _length) {
+      _current = _array[nextPosition];
+      _position = nextPosition;
+      return true;
+    }
+    _position = _length;
+    _current = null;
+    return false;
+  }
+
+  E get current => _current;
+}
+
+class _TypedListView extends _TypedListBase implements TypedData {
+  _TypedListView(_ByteBuffer _buffer, int _offset, int _length)
+      : _typedData = _buffer._data,
+        offsetInBytes = _offset,
+        length = _length {}
+
+  // Method(s) implementing the TypedData interface.
+
+  int get lengthInBytes {
+    return length * elementSizeInBytes;
+  }
+
+  _ByteBuffer get buffer {
+    return _typedData.buffer;
+  }
+
+  final _TypedList _typedData;
+  final int offsetInBytes;
+  final int length;
+}
+
+class _Int8ArrayView extends _TypedListView
+    with _IntListMixin
+    implements Int8List {
+  // Constructor.
+  _Int8ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Int8List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, _offsetInBytes,
+        length * Int8List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getInt8(offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setInt8(
+        offsetInBytes + (index * Int8List.BYTES_PER_ELEMENT), _toInt8(value));
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Int8List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int8List _createList(int length) {
+    return new Int8List(length);
+  }
+}
+
+class _Uint8ArrayView extends _TypedListView
+    with _IntListMixin
+    implements Uint8List {
+  // Constructor.
+  _Uint8ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Uint8List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, _offsetInBytes,
+        length * Uint8List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setUint8(
+        offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT), _toUint8(value));
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Uint8List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint8List _createList(int length) {
+    return new Uint8List(length);
+  }
+}
+
+class _Uint8ClampedArrayView extends _TypedListView
+    with _IntListMixin
+    implements Uint8ClampedList {
+  // Constructor.
+  _Uint8ClampedArrayView(_ByteBuffer buffer,
+      [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Uint8List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Uint8List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setUint8(offsetInBytes + (index * Uint8List.BYTES_PER_ELEMENT),
+        _toClampedUint8(value));
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Uint8List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint8ClampedList _createList(int length) {
+    return new Uint8ClampedList(length);
+  }
+}
+
+class _Int16ArrayView extends _TypedListView
+    with _IntListMixin
+    implements Int16List {
+  // Constructor.
+  _Int16ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Int16List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Int16List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Int16List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getInt16(offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setInt16(
+        offsetInBytes + (index * Int16List.BYTES_PER_ELEMENT), _toInt16(value));
+  }
+
+  void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
+    if (iterable is CodeUnits) {
+      end = RangeError.checkValidRange(start, end, this.length);
+      int length = end - start;
+      int byteStart = this.offsetInBytes + start * Int16List.BYTES_PER_ELEMENT;
+      _typedData._setCodeUnits(iterable, byteStart, length, skipCount);
+    } else {
+      super.setRange(start, end, iterable, skipCount);
+    }
+  }
+
+  // Method(s) implementing TypedData interface.
+
+  int get elementSizeInBytes {
+    return Int16List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int16List _createList(int length) {
+    return new Int16List(length);
+  }
+}
+
+class _Uint16ArrayView extends _TypedListView
+    with _IntListMixin
+    implements Uint16List {
+  // Constructor.
+  _Uint16ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Uint16List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Uint16List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Uint16List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getUint16(offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setUint16(
+        offsetInBytes + (index * Uint16List.BYTES_PER_ELEMENT),
+        _toUint16(value));
+  }
+
+  void setRange(int start, int end, Iterable iterable, [int skipCount = 0]) {
+    if (iterable is CodeUnits) {
+      end = RangeError.checkValidRange(start, end, this.length);
+      int length = end - start;
+      int byteStart = this.offsetInBytes + start * Uint16List.BYTES_PER_ELEMENT;
+      _typedData._setCodeUnits(iterable, byteStart, length, skipCount);
+    } else {
+      super.setRange(start, end, iterable, skipCount);
+    }
+  }
+
+  // Method(s) implementing TypedData interface.
+
+  int get elementSizeInBytes {
+    return Uint16List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+
+  Uint16List _createList(int length) {
+    return new Uint16List(length);
+  }
+}
+
+class _Int32ArrayView extends _TypedListView
+    with _IntListMixin
+    implements Int32List {
+  // Constructor.
+  _Int32ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Int32List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Int32List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Int32List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getInt32(offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setInt32(
+        offsetInBytes + (index * Int32List.BYTES_PER_ELEMENT), _toInt32(value));
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Int32List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int32List _createList(int length) {
+    return new Int32List(length);
+  }
+}
+
+class _Uint32ArrayView extends _TypedListView
+    with _IntListMixin
+    implements Uint32List {
+  // Constructor.
+  _Uint32ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Uint32List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Uint32List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Uint32List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getUint32(offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setUint32(
+        offsetInBytes + (index * Uint32List.BYTES_PER_ELEMENT),
+        _toUint32(value));
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Uint32List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint32List _createList(int length) {
+    return new Uint32List(length);
+  }
+}
+
+class _Int64ArrayView extends _TypedListView
+    with _IntListMixin
+    implements Int64List {
+  // Constructor.
+  _Int64ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Int64List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Int64List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Int64List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getInt64(offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setInt64(
+        offsetInBytes + (index * Int64List.BYTES_PER_ELEMENT), _toInt64(value));
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Int64List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int64List _createList(int length) {
+    return new Int64List(length);
+  }
+}
+
+class _Uint64ArrayView extends _TypedListView
+    with _IntListMixin
+    implements Uint64List {
+  // Constructor.
+  _Uint64ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Uint64List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Uint64List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Uint64List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  int operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getUint64(offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, int value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setUint64(
+        offsetInBytes + (index * Uint64List.BYTES_PER_ELEMENT),
+        _toUint64(value));
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Uint64List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Uint64List _createList(int length) {
+    return new Uint64List(length);
+  }
+}
+
+class _Float32ArrayView extends _TypedListView
+    with _DoubleListMixin
+    implements Float32List {
+  // Constructor.
+  _Float32ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Float32List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Float32List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Float32List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  double operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getFloat32(offsetInBytes + (index * Float32List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, double value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setFloat32(
+        offsetInBytes + (index * Float32List.BYTES_PER_ELEMENT), value);
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Float32List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float32List _createList(int length) {
+    return new Float32List(length);
+  }
+}
+
+class _Float64ArrayView extends _TypedListView
+    with _DoubleListMixin
+    implements Float64List {
+  // Constructor.
+  _Float64ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Float64List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Float64List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Float64List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  double operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getFloat64(offsetInBytes + (index * Float64List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, double value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setFloat64(
+        offsetInBytes + (index * Float64List.BYTES_PER_ELEMENT), value);
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Float64List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float64List _createList(int length) {
+    return new Float64List(length);
+  }
+}
+
+class _Float32x4ArrayView extends _TypedListView
+    with _Float32x4ListMixin
+    implements Float32x4List {
+  // Constructor.
+  _Float32x4ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Float32x4List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Float32x4List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Float32x4List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  Float32x4 operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData._getFloat32x4(
+        offsetInBytes + (index * Float32x4List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, Float32x4 value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setFloat32x4(
+        offsetInBytes + (index * Float32x4List.BYTES_PER_ELEMENT), value);
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Float32x4List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float32x4List _createList(int length) {
+    return new Float32x4List(length);
+  }
+}
+
+class _Int32x4ArrayView extends _TypedListView
+    with _Int32x4ListMixin
+    implements Int32x4List {
+  // Constructor.
+  _Int32x4ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Int32x4List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Int32x4List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Int32x4List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  Int32x4 operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData
+        ._getInt32x4(offsetInBytes + (index * Int32x4List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, Int32x4 value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setInt32x4(
+        offsetInBytes + (index * Int32x4List.BYTES_PER_ELEMENT), value);
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Int32x4List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Int32x4List _createList(int length) {
+    return new Int32x4List(length);
+  }
+}
+
+class _Float64x2ArrayView extends _TypedListView
+    with _Float64x2ListMixin
+    implements Float64x2List {
+  // Constructor.
+  _Float64x2ArrayView(_ByteBuffer buffer, [int _offsetInBytes = 0, int _length])
+      : super(
+            buffer,
+            _offsetInBytes,
+            _defaultIfNull(
+                _length,
+                ((buffer.lengthInBytes - _offsetInBytes) ~/
+                    Float64x2List.BYTES_PER_ELEMENT))) {
+    _rangeCheck(buffer.lengthInBytes, offsetInBytes,
+        length * Float64x2List.BYTES_PER_ELEMENT);
+    _offsetAlignmentCheck(_offsetInBytes, Float64x2List.BYTES_PER_ELEMENT);
+  }
+
+  // Method(s) implementing List interface.
+  Float64x2 operator [](int index) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    return _typedData._getFloat64x2(
+        offsetInBytes + (index * Float64x2List.BYTES_PER_ELEMENT));
+  }
+
+  void operator []=(int index, Float64x2 value) {
+    if (index < 0 || index >= length) {
+      throw new RangeError.index(index, this, "index");
+    }
+    _typedData._setFloat64x2(
+        offsetInBytes + (index * Float64x2List.BYTES_PER_ELEMENT), value);
+  }
+
+  // Method(s) implementing TypedData interface.
+  int get elementSizeInBytes {
+    return Float64x2List.BYTES_PER_ELEMENT;
+  }
+
+  // Internal utility methods.
+  Float64x2List _createList(int length) {
+    return new Float64x2List(length);
+  }
+}
+
+class _ByteDataView implements ByteData {
+  _ByteDataView(TypedData typedData, int _offsetInBytes, int _lengthInBytes)
+      : _typedData = typedData,
+        _offset = _offsetInBytes,
+        length = _lengthInBytes {
+    _rangeCheck(_typedData.lengthInBytes, _offset, length);
+  }
+
+  // Method(s) implementing TypedData interface.
+  _ByteBuffer get buffer {
+    return _typedData.buffer;
+  }
+
+  int get lengthInBytes {
+    return length;
+  }
+
+  int get offsetInBytes {
+    return _offset;
+  }
+
+  int get elementSizeInBytes {
+    return 1;
+  }
+
+  // Method(s) implementing ByteData interface.
+
+  int getInt8(int byteOffset) {
+    if (byteOffset < 0 || byteOffset >= length) {
+      throw new RangeError.index(byteOffset, this, "byteOffset");
+    }
+    return _typedData._getInt8(_offset + byteOffset);
+  }
+
+  void setInt8(int byteOffset, int value) {
+    if (byteOffset < 0 || byteOffset >= length) {
+      throw new RangeError.index(byteOffset, this, "byteOffset");
+    }
+    _typedData._setInt8(_offset + byteOffset, value);
+  }
+
+  int getUint8(int byteOffset) {
+    if (byteOffset < 0 || byteOffset >= length) {
+      throw new RangeError.index(byteOffset, this, "byteOffset");
+    }
+    return _typedData._getUint8(_offset + byteOffset);
+  }
+
+  void setUint8(int byteOffset, int value) {
+    if (byteOffset < 0 || byteOffset >= length) {
+      throw new RangeError.index(byteOffset, this, "byteOffset");
+    }
+    _typedData._setUint8(_offset + byteOffset, value);
+  }
+
+  int getInt16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 1 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
+    }
+    var result = _typedData._getInt16(_offset + byteOffset);
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      return result;
+    }
+    return _byteSwap16(result).toSigned(16);
+  }
+
+  void setInt16(int byteOffset, int value,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 1 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
+    }
+    _typedData._setInt16(_offset + byteOffset,
+        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
+  }
+
+  int getUint16(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 1 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
+    }
+    var result = _typedData._getUint16(_offset + byteOffset);
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      return result;
+    }
+    return _byteSwap16(result);
+  }
+
+  void setUint16(int byteOffset, int value,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 1 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 2, "byteOffset");
+    }
+    _typedData._setUint16(_offset + byteOffset,
+        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap16(value));
+  }
+
+  int getInt32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
+    }
+    var result = _typedData._getInt32(_offset + byteOffset);
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      return result;
+    }
+    return _byteSwap32(result).toSigned(32);
+  }
+
+  void setInt32(int byteOffset, int value,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
+    }
+    _typedData._setInt32(_offset + byteOffset,
+        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
+  }
+
+  int getUint32(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
+    }
+    var result = _typedData._getUint32(_offset + byteOffset);
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      return result;
+    }
+    return _byteSwap32(result);
+  }
+
+  void setUint32(int byteOffset, int value,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
+    }
+    _typedData._setUint32(_offset + byteOffset,
+        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap32(value));
+  }
+
+  int getInt64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
+    }
+    var result = _typedData._getInt64(_offset + byteOffset);
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      return result;
+    }
+    return _byteSwap64(result).toSigned(64);
+  }
+
+  void setInt64(int byteOffset, int value,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
+    }
+    _typedData._setInt64(_offset + byteOffset,
+        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
+  }
+
+  int getUint64(int byteOffset, [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
+    }
+    var result = _typedData._getUint64(_offset + byteOffset);
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      return result;
+    }
+    return _byteSwap64(result);
+  }
+
+  void setUint64(int byteOffset, int value,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
+    }
+    _typedData._setUint64(_offset + byteOffset,
+        identical(endian, Endianness.HOST_ENDIAN) ? value : _byteSwap64(value));
+  }
+
+  double getFloat32(int byteOffset,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
+    }
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      return _typedData._getFloat32(_offset + byteOffset);
+    }
+    _convU32[0] = _byteSwap32(_typedData._getUint32(_offset + byteOffset));
+    return _convF32[0];
+  }
+
+  void setFloat32(int byteOffset, double value,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
+    }
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      _typedData._setFloat32(_offset + byteOffset, value);
+      return;
+    }
+    _convF32[0] = value;
+    _typedData._setUint32(_offset + byteOffset, _byteSwap32(_convU32[0]));
+  }
+
+  double getFloat64(int byteOffset,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
+    }
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      return _typedData._getFloat64(_offset + byteOffset);
+    }
+    _convU64[0] = _byteSwap64(_typedData._getUint64(_offset + byteOffset));
+    return _convF64[0];
+  }
+
+  void setFloat64(int byteOffset, double value,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 7 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 8, "byteOffset");
+    }
+    if (identical(endian, Endianness.HOST_ENDIAN)) {
+      _typedData._setFloat64(_offset + byteOffset, value);
+      return;
+    }
+    _convF64[0] = value;
+    _typedData._setUint64(_offset + byteOffset, _byteSwap64(_convU64[0]));
+  }
+
+  Float32x4 getFloat32x4(int byteOffset,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
+    }
+    // TODO(johnmccutchan) : Need to resolve this for endianity.
+    return _typedData._getFloat32x4(_offset + byteOffset);
+  }
+
+  void setFloat32x4(int byteOffset, Float32x4 value,
+      [Endianness endian = Endianness.BIG_ENDIAN]) {
+    if (byteOffset < 0 || byteOffset + 3 >= length) {
+      throw new RangeError.range(byteOffset, 0, length - 4, "byteOffset");
+    }
+    // TODO(johnmccutchan) : Need to resolve this for endianity.
+    _typedData._setFloat32x4(_offset + byteOffset, value);
+  }
+
+  final TypedData _typedData;
+  final int _offset;
+  final int length;
+}
+
+int _byteSwap16(int value) {
+  return ((value & 0xFF00) >> 8) | ((value & 0x00FF) << 8);
+}
+
+int _byteSwap32(int value) {
+  value = ((value & 0xFF00FF00) >> 8) | ((value & 0x00FF00FF) << 8);
+  value = ((value & 0xFFFF0000) >> 16) | ((value & 0x0000FFFF) << 16);
+  return value;
+}
+
+int _byteSwap64(int value) {
+  return (_byteSwap32(value) << 32) | _byteSwap32(value >> 32);
+}
+
+final _convU32 = new Uint32List(2);
+final _convU64 = new Uint64List.view(_convU32.buffer);
+final _convF32 = new Float32List.view(_convU32.buffer);
+final _convF64 = new Float64List.view(_convU32.buffer);
+
+// Top level utility methods.
+int _toInt(int value, int mask) {
+  value &= mask;
+  if (value > (mask >> 1)) value -= mask + 1;
+  return value;
+}
+
+int _toInt8(int value) {
+  return _toInt(value, 0xFF);
+}
+
+int _toUint8(int value) {
+  return value & 0xFF;
+}
+
+int _toClampedUint8(int value) {
+  if (value < 0) return 0;
+  if (value > 0xFF) return 0xFF;
+  return value;
+}
+
+int _toInt16(int value) {
+  return _toInt(value, 0xFFFF);
+}
+
+int _toUint16(int value) {
+  return value & 0xFFFF;
+}
+
+int _toInt32(int value) {
+  return _toInt(value, 0xFFFFFFFF);
+}
+
+int _toUint32(int value) {
+  return value & 0xFFFFFFFF;
+}
+
+int _toInt64(int value) {
+  // Avoid bigint mask when possible.
+  return (ClassID.getID(value) == ClassID.cidBigint)
+      ? _toInt(value, 0xFFFFFFFFFFFFFFFF)
+      : value;
+}
+
+int _toUint64(int value) {
+  // Avoid bigint mask when possible.
+  return (ClassID.getID(value) == ClassID.cidBigint)
+      ? _toInt(value, 0xFFFFFFFFFFFFFFFF)
+      : value;
+}
+
+void _rangeCheck(int listLength, int start, int length) {
+  if (length < 0) {
+    throw new RangeError.value(length);
+  }
+  if (start < 0) {
+    throw new RangeError.value(start);
+  }
+  if (start + length > listLength) {
+    throw new RangeError.value(start + length);
+  }
+}
+
+void _offsetAlignmentCheck(int offset, int alignment) {
+  if ((offset % alignment) != 0) {
+    throw new RangeError('Offset ($offset) must be a multiple of '
+        'BYTES_PER_ELEMENT ($alignment)');
+  }
+}
+
+int _defaultIfNull(object, value) {
+  if (object == null) {
+    return value;
+  }
+  return object;
+}
diff --git a/runtime/lib/typed_data_sources.gypi b/runtime/lib/typed_data_sources.gypi
index 28d6a53..d68daed 100644
--- a/runtime/lib/typed_data_sources.gypi
+++ b/runtime/lib/typed_data_sources.gypi
@@ -7,8 +7,7 @@
 {
   'sources': [
     'typed_data.cc',
-    'typed_data.dart',
+    'typed_data_patch.dart',
     'simd128.cc',
   ],
 }
-
diff --git a/runtime/lib/vmservice.cc b/runtime/lib/vmservice.cc
index 6e39021..9d83c13 100644
--- a/runtime/lib/vmservice.cc
+++ b/runtime/lib/vmservice.cc
@@ -21,11 +21,17 @@
 
 DECLARE_FLAG(bool, trace_service);
 
-static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
+static uint8_t* malloc_allocator(uint8_t* ptr,
+                                 intptr_t old_size,
+                                 intptr_t new_size) {
   void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
   return reinterpret_cast<uint8_t*>(new_ptr);
 }
 
+static void malloc_deallocator(uint8_t* ptr) {
+  free(reinterpret_cast<void*>(ptr));
+}
+
 
 #ifndef PRODUCT
 class RegisterRunningIsolatesVisitor : public IsolateVisitor {
@@ -51,8 +57,7 @@
 
   virtual void VisitIsolate(Isolate* isolate) {
     ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current()));
-    if (ServiceIsolate::IsServiceIsolateDescendant(isolate) ||
-        (isolate == Dart::vm_isolate())) {
+    if (IsVMInternalIsolate(isolate)) {
       // We do not register the service (and descendants) or the vm-isolate.
       return;
     }
@@ -96,7 +101,7 @@
 
   // Serialize message.
   uint8_t* data = NULL;
-  MessageWriter writer(&data, &allocator, false);
+  MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
   writer.WriteMessage(message);
 
   // TODO(turnidge): Throw an exception when the return value is false?
diff --git a/runtime/observatory/BUILD.gn b/runtime/observatory/BUILD.gn
index d4c736c..ca85f29 100644
--- a/runtime/observatory/BUILD.gn
+++ b/runtime/observatory/BUILD.gn
@@ -22,6 +22,12 @@
   dart_host_pub_exe = rebase_path("$dart_host_sdk/bin/pub")
 }
 
+# We set this to "" in the Fuchsia build to force building with dart_bootstrap.
+if (defined(is_fuchsia) && defined(is_fuchsia_host) &&
+    (is_fuchsia || is_fuchsia_host)) {
+  dart_host_pub_exe = ""
+}
+
 # Construct arguments to the observatory tool for finding pub.
 pub_build_deps = []
 pub_build_args = []
diff --git a/runtime/observatory/lib/models.dart b/runtime/observatory/lib/models.dart
index a196975..71619ca 100644
--- a/runtime/observatory/lib/models.dart
+++ b/runtime/observatory/lib/models.dart
@@ -45,11 +45,13 @@
 part 'src/models/objects/sentinel.dart';
 part 'src/models/objects/source_location.dart';
 part 'src/models/objects/target.dart';
+part 'src/models/objects/thread.dart';
 part 'src/models/objects/token_stream.dart';
 part 'src/models/objects/timeline_event.dart';
 part 'src/models/objects/type_arguments.dart';
 part 'src/models/objects/unknown.dart';
 part 'src/models/objects/vm.dart';
+part 'src/models/objects/zone.dart';
 
 part 'src/models/repositories/allocation_profile.dart';
 part 'src/models/repositories/breakpoint.dart';
diff --git a/runtime/observatory/lib/src/elements/css/shared.css b/runtime/observatory/lib/src/elements/css/shared.css
index 717ad46..556d997 100644
--- a/runtime/observatory/lib/src/elements/css/shared.css
+++ b/runtime/observatory/lib/src/elements/css/shared.css
@@ -283,6 +283,12 @@
   flex-basis: 90%;
 }
 
+.indent {
+  margin-left: 1.5em;
+  font: 400 14px 'Montserrat', sans-serif;
+  line-height: 150%;
+}
+
 .well {
   min-height: 20px;
   padding: 19px;
@@ -1429,6 +1435,17 @@
 isolate-shared-summary {
   display: block;
 }
+
+.isolate-ref-container {
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
+.isolate-state-container {
+  display: inline-block;
+  min-width: 18ex;
+}
+
 isolate-shared-summary > .summary {
   height: 300px;
   position: relative;
diff --git a/runtime/observatory/lib/src/elements/debugger.dart b/runtime/observatory/lib/src/elements/debugger.dart
index 8b91eff..b3ca569 100644
--- a/runtime/observatory/lib/src/elements/debugger.dart
+++ b/runtime/observatory/lib/src/elements/debugger.dart
@@ -209,7 +209,8 @@
       debugger.downFrame(count);
       debugger.console.print('frame = ${debugger.currentFrame}');
     } catch (e) {
-      debugger.console.print('frame must be in range [${e.start},${e.end-1}]');
+      debugger.console.print(
+          'frame must be in range [${e.start}..${e.end-1}]');
     }
     return new Future.value(null);
   }
@@ -243,7 +244,8 @@
       debugger.upFrame(count);
       debugger.console.print('frame = ${debugger.currentFrame}');
     } on RangeError catch (e) {
-      debugger.console.print('frame must be in range [${e.start},${e.end-1}]');
+      debugger.console.print(
+          'frame must be in range [${e.start}..${e.end-1}]');
     }
     return new Future.value(null);
   }
@@ -279,7 +281,8 @@
       debugger.currentFrame = frame;
       debugger.console.print('frame = ${debugger.currentFrame}');
     } on RangeError catch (e) {
-      debugger.console.print('frame must be in range [${e.start},${e.end-1}]');
+      debugger.console.print(
+          'frame must be in range [${e.start}..${e.end-1}]');
     }
     return new Future.value(null);
   }
@@ -403,6 +406,73 @@
       'Syntax: step\n';
 }
 
+class RewindCommand extends DebuggerCommand {
+  RewindCommand(Debugger debugger) : super(debugger, 'rewind', []);
+
+  Future run(List<String> args) async {
+    try {
+      int count = 1;
+      if (args.length == 1) {
+        count = int.parse(args[0]);
+      } else if (args.length > 1) {
+        debugger.console.print('rewind expects 0 or 1 argument');
+        return;
+      } else if (count < 1 || count > debugger.stackDepth) {
+        debugger.console.print(
+            'frame must be in range [1..${debugger.stackDepth - 1}]');
+        return;
+      }
+      await debugger.rewind(count);
+    } on S.ServerRpcException catch(e) {
+      if (e.code == S.ServerRpcException.kCannotResume) {
+        debugger.console.printRed(e.data['details']);
+      } else {
+        rethrow;
+      }
+    }
+  }
+
+  String helpShort = 'Rewind the stack to a previous frame';
+
+  String helpLong =
+      'Rewind the stack to a previous frame.\n'
+      '\n'
+      'Syntax: rewind\n'
+      '        rewind <count>\n';
+}
+
+class ReloadCommand extends DebuggerCommand {
+  ReloadCommand(Debugger debugger) : super(debugger, 'reload', []);
+
+  Future run(List<String> args) async {
+    try {
+      int count = 1;
+      if (args.length > 0) {
+        debugger.console.print('reload expects no arguments');
+        return;
+      }
+      await debugger.isolate.reloadSources();
+      debugger.console.print('reload complete');
+      await debugger.refreshStack();
+    } on S.ServerRpcException catch(e) {
+      if (e.code == S.ServerRpcException.kIsolateReloadBarred ||
+          e.code == S.ServerRpcException.kIsolateReloadFailed ||
+          e.code == S.ServerRpcException.kIsolateIsReloading) {
+        debugger.console.printRed(e.data['details']);
+      } else {
+        rethrow;
+      }
+    }
+  }
+
+  String helpShort = 'Reload the sources for the current isolate';
+
+  String helpLong =
+      'Reload the sources for the current isolate.\n'
+      '\n'
+      'Syntax: reload\n';
+}
+
 class ClsCommand extends DebuggerCommand {
   ClsCommand(Debugger debugger) : super(debugger, 'cls', []) {}
 
@@ -663,8 +733,8 @@
         var script = loc.script;
         await script.load();
         if (loc.line < 1 || loc.line > script.lines.length) {
-          debugger.console
-              .print('line number must be in range [1,${script.lines.length}]');
+          debugger.console.print(
+              'line number must be in range [1..${script.lines.length}]');
           return;
         }
         try {
@@ -744,7 +814,7 @@
     var script = loc.script;
     if (loc.line < 1 || loc.line > script.lines.length) {
       debugger.console
-          .print('line number must be in range [1,${script.lines.length}]');
+          .print('line number must be in range [1..${script.lines.length}]');
       return;
     }
     var lineInfo = script.getLine(loc.line);
@@ -899,7 +969,6 @@
       : super(debugger, 'isolate', [
           new IsolateListCommand(debugger),
           new IsolateNameCommand(debugger),
-          new IsolateReloadCommand(debugger),
         ]) {
     alias = 'i';
   }
@@ -1042,27 +1111,6 @@
       'Syntax: isolate name <name>\n';
 }
 
-class IsolateReloadCommand extends DebuggerCommand {
-  IsolateReloadCommand(Debugger debugger) : super(debugger, 'reload', []);
-
-  Future run(List<String> args) async {
-    if (debugger.isolate == null) {
-      debugger.console.print('There is no current vm');
-      return;
-    }
-
-    await debugger.isolate.reloadSources();
-
-    debugger.console.print('Isolate reloading....');
-  }
-
-  String helpShort = 'Reload the sources for the current isolate.';
-
-  String helpLong = 'Reload the sources for the current isolate.\n'
-      '\n'
-      'Syntax: reload\n';
-}
-
 class InfoCommand extends DebuggerCommand {
   InfoCommand(Debugger debugger)
       : super(debugger, 'info', [
@@ -1371,7 +1419,9 @@
       new LogCommand(this),
       new PauseCommand(this),
       new PrintCommand(this),
+      new ReloadCommand(this),
       new RefreshCommand(this),
+      new RewindCommand(this),
       new SetCommand(this),
       new SmartNextCommand(this),
       new StepCommand(this),
@@ -1879,6 +1929,20 @@
       return new Future.value(null);
     }
   }
+
+  Future rewind(int count) {
+    if (isolatePaused()) {
+      var event = isolate.pauseEvent;
+      if (event is M.PauseExitEvent) {
+        console.print("Type 'continue' [F7] to exit the isolate");
+        return new Future.value(null);
+      }
+      return isolate.rewind(count);
+    } else {
+      console.print('The program must be paused');
+      return new Future.value(null);
+    }
+  }
 }
 
 class DebuggerPageElement extends HtmlElement implements Renderable {
@@ -1905,6 +1969,7 @@
     final e = document.createElement(tag.name);
     final debugger = new ObservatoryDebugger(isolate);
     debugger.page = e;
+    debugger.instances = instances;
     e._isolate = isolate;
     e._debugger = debugger;
     e._instances = instances;
@@ -2513,7 +2578,9 @@
   }
 
   bool matchFrame(S.Frame newFrame) {
-    return newFrame.function.id == _frame.function.id;
+    return (newFrame.function.id == _frame.function.id &&
+            newFrame.location.script.id ==
+            frame.location.script.id);
   }
 
   void updateFrame(S.Frame newFrame) {
diff --git a/runtime/observatory/lib/src/elements/isolate/summary.dart b/runtime/observatory/lib/src/elements/isolate/summary.dart
index 82d768a..0943996 100644
--- a/runtime/observatory/lib/src/elements/isolate/summary.dart
+++ b/runtime/observatory/lib/src/elements/isolate/summary.dart
@@ -79,11 +79,13 @@
           ..classes = ['flex-row']
           ..children = [
             new DivElement()
+              ..classes = ['isolate-ref-container']
               ..children = [
                 new IsolateRefElement(_isolate, _events, queue: _r.queue)
               ],
             new DivElement()..style.flex = '1',
             new DivElement()
+              ..classes = ['flex-row', 'isolate-state-container']
               ..children = [
                 new IsolateRunStateElement(_isolate, _events, queue: _r.queue),
                 new IsolateLocationElement(_isolate, _events, _scripts,
diff --git a/runtime/observatory/lib/src/elements/isolate_view.dart b/runtime/observatory/lib/src/elements/isolate_view.dart
index 73fde1a..7e7599e 100644
--- a/runtime/observatory/lib/src/elements/isolate_view.dart
+++ b/runtime/observatory/lib/src/elements/isolate_view.dart
@@ -27,6 +27,7 @@
 import 'package:observatory/src/elements/script_inset.dart';
 import 'package:observatory/src/elements/source_inset.dart';
 import 'package:observatory/src/elements/view_footer.dart';
+import 'package:observatory/utils.dart';
 
 class IsolateViewElement extends HtmlElement implements Renderable {
   static const tag =
@@ -133,6 +134,7 @@
   void render() {
     final uptime = new DateTime.now().difference(_isolate.startTime);
     final libraries = _isolate.libraries.toList();
+    final List<Thread> threads = _isolate.threads;
     children = [
       navBar([
         new NavTopMenuElement(queue: _r.queue),
@@ -267,6 +269,26 @@
                 ..children = [
                   new DivElement()
                     ..classes = ['memberName']
+                    ..text = 'allocated zone handle count',
+                  new DivElement()
+                    ..classes = ['memberValue']
+                    ..text = '${_isolate.numZoneHandles}'
+                ],
+              new DivElement()
+                ..classes = ['memberItem']
+                ..children = [
+                  new DivElement()
+                    ..classes = ['memberName']
+                    ..text = 'allocated scoped handle count',
+                  new DivElement()
+                    ..classes = ['memberValue']
+                    ..text = '${_isolate.numScopedHandles}'
+                ],
+              new DivElement()
+                ..classes = ['memberItem']
+                ..children = [
+                  new DivElement()
+                    ..classes = ['memberName']
                     ..text = 'object store',
                   new DivElement()
                     ..classes = ['memberValue']
@@ -275,6 +297,19 @@
                         ..text = 'object store'
                     ]
                 ],
+              new DivElement()
+                ..classes = ['memberItem']
+                ..children = [
+                  new DivElement()
+                    ..classes = ['memberName']
+                    ..text = 'native memory usage high watermark'
+                    ..title = '''The maximum amount of native memory allocated
+                    by the isolate over it\'s life.''',
+                  new DivElement()
+                    ..classes = ['memberValue']
+                    ..text = Utils.formatSize(_isolate.memoryHighWatermark)
+                    ..title = '${_isolate.memoryHighWatermark}B'
+                ],
               new BRElement(),
               new DivElement()
                 ..classes = ['memberItem']
@@ -294,6 +329,20 @@
                               ])
                             .toList()
                     ]
+                ],
+              new DivElement()
+                ..classes = ['memberItem']
+                ..children = [
+                  new DivElement()
+                    ..classes = ['memberName']
+                    ..text = 'threads (${threads.length})',
+                  new DivElement()
+                    ..classes = ['memberValue']
+                    ..children = [
+                      new CurlyBlockElement(queue: _r.queue)
+                        ..content = threads
+                          .map(_populateThreadInfo)
+                    ]
                 ]
             ],
           new HRElement(),
@@ -314,6 +363,72 @@
     ];
   }
 
+  DivElement _populateThreadInfo(Thread t) {
+    int index = 0;
+    return new DivElement()
+      ..classes = ['indent']
+      ..children = [
+        new SpanElement()
+          ..text = '${t.id} ',
+        new CurlyBlockElement(queue: _r.queue)
+          ..content = [
+            new DivElement()
+              ..classes = ['indent']
+              ..text = 'kind ${t.kindString}',
+            new DivElement()
+              ..classes = ['indent']
+              ..title = '${t.memoryHighWatermark}B'
+              ..text =
+              'native memory usage high watermark ${Utils.formatSize(t.memoryHighWatermark)}',
+            new DivElement()
+              ..children = t.zones
+                .map((z) => new DivElement()
+                ..classes = ['indent']
+                ..children = [
+                  new DivElement()
+                    ..children = [
+                      new SpanElement()
+                        ..children = [
+                          new SpanElement()
+                            ..text = 'zone ${index++} ',
+                          new CurlyBlockElement(queue: _r.queue)
+                            ..content = [
+                              new DivElement()
+                                ..classes = ['memberList']
+                                ..children = [
+                                  new DivElement()
+                                    ..classes = ['memberItem']
+                                    ..children = [
+                                      new SpanElement()
+                                        ..classes = ['memberName']
+                                        ..text = 'used ',
+                                      new SpanElement()
+                                        ..classes = ['memberValue']
+                                        ..title = '${z.used}B'
+                                        ..text =
+                                        Utils.formatSize(z.used)
+                                    ],
+                                  new DivElement()
+                                    ..classes = ['memberItem']
+                                    ..children = [
+                                        new SpanElement()
+                                          ..classes = ['memberName']
+                                          ..text = 'capacity',
+                                        new SpanElement()
+                                          ..classes = ['memberValue']
+                                          ..title = '${z.capacity}B'
+                                          ..text =
+                                          Utils.formatSize(z.capacity)
+                                    ]
+                                ]
+                            ]
+                        ]
+                    ]
+                ]
+          )]
+      ];
+  }
+
   Future _loadExtraData() async {
     _function = null;
     _rootScript = null;
diff --git a/runtime/observatory/lib/src/elements/nav/notify_exception.dart b/runtime/observatory/lib/src/elements/nav/notify_exception.dart
index 167181c..3a76cc4 100644
--- a/runtime/observatory/lib/src/elements/nav/notify_exception.dart
+++ b/runtime/observatory/lib/src/elements/nav/notify_exception.dart
@@ -98,7 +98,7 @@
     ];
     if (stacktrace != null) {
       content.addAll([
-        new SpanElement()..text = 'Stacktrace:',
+        new SpanElement()..text = 'StackTrace:',
         new BRElement(),
         new BRElement(),
         new DivElement()..text = stacktrace.toString(),
diff --git a/runtime/observatory/lib/src/models/objects/isolate.dart b/runtime/observatory/lib/src/models/objects/isolate.dart
index f114941..8c1e367 100644
--- a/runtime/observatory/lib/src/models/objects/isolate.dart
+++ b/runtime/observatory/lib/src/models/objects/isolate.dart
@@ -51,6 +51,20 @@
   /// [optional] The error that is causing this isolate to exit, if applicable.
   Error get error;
 
+  /// The list of threads associated with this isolate.
+  Iterable<Thread> get threads;
+
+  /// The maximum amount of memory in bytes allocated by the isolate in all
+  /// threads at a given time. Calculated using the high watermarks of each
+  /// thread alive when a thread is unscheduled.
+  int get memoryHighWatermark;
+
+  /// The number of zone handles currently held by this isolate.
+  int get numZoneHandles;
+
+  /// The number of scoped handles currently held by this isolate.
+  int get numScopedHandles;
+
   /// The current pause on exception mode for this isolate.
   //ExceptionPauseMode get exceptionPauseMode;
 
diff --git a/runtime/observatory/lib/src/models/objects/thread.dart b/runtime/observatory/lib/src/models/objects/thread.dart
new file mode 100644
index 0000000..7bff72c
--- /dev/null
+++ b/runtime/observatory/lib/src/models/objects/thread.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of models;
+
+enum ThreadKind {
+  unknownTask,
+  mutatorTask,
+  compilerTask,
+  sweeperTask,
+  markerTask,
+  finalizerTask
+}
+
+abstract class Thread {
+  /// The id associated with the thread on creation.
+  String get id;
+
+  /// The task type associated with the thread.
+  ThreadKind get kind;
+
+  /// The maximum amount of memory in bytes allocated by a thread at a given
+  /// time throughout the entire life of the thread.
+  int get memoryHighWatermark;
+
+  /// A list of all the zones held by the thread.
+  Iterable<Zone> get zones;
+}
diff --git a/runtime/observatory/lib/src/models/objects/zone.dart b/runtime/observatory/lib/src/models/objects/zone.dart
new file mode 100644
index 0000000..51840cb
--- /dev/null
+++ b/runtime/observatory/lib/src/models/objects/zone.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of models;
+
+abstract class Zone {
+  /// The total amount of memory in bytes allocated in the zone, including
+  /// memory that is not actually being used.
+  int get capacity;
+
+  /// The total amount of memory in bytes actually used in the zone.
+  int get used;
+}
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index c3ea07da..74a99ab 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -42,11 +42,13 @@
   static const kStreamNotSubscribed = 104;
   static const kIsolateMustBeRunnable = 105;
   static const kIsolateMustBePaused = 106;
-  static const kIsolateIsReloading = 1000;
+  static const kCannotResume = 107;
+  static const kIsolateIsReloading = 108;
+  static const kIsolateReloadBarred = 109;
+
   static const kFileSystemAlreadyExists = 1001;
   static const kFileSystemDoesNotExist = 1002;
   static const kFileDoesNotExist = 1003;
-  static const kIsolateReloadFailed = 1004;
 
   int code;
   Map data;
@@ -236,6 +238,9 @@
       case 'SourceLocation':
         obj = new SourceLocation._empty(owner);
         break;
+      case '_Thread':
+        obj = new Thread._empty(owner);
+        break;
       case 'UnresolvedSourceLocation':
         obj = new UnresolvedSourceLocation._empty(owner);
         break;
@@ -1279,7 +1284,6 @@
   bool loading = true;
   bool runnable = false;
   bool ioEnabled = false;
-  bool reloading = false;
   M.IsolateStatus get status {
     if (paused) {
       return M.IsolateStatus.paused;
@@ -1344,13 +1348,12 @@
       params['pause'] = pause;
     }
     return invokeRpc('reloadSources', params).then((result) {
-      reloading = true;
+      _cache.clear();
       return result;
     });
   }
 
   void _handleIsolateReloadEvent(ServiceEvent event) {
-    reloading = false;
     if (event.reloadError != null) {
       // Failure.
       print('Reload failed: ${event.reloadError}');
@@ -1501,6 +1504,18 @@
 
   List<ByteData> _chunksInProgress;
 
+  List<Thread> get threads => _threads;
+  final List<Thread> _threads = new List<Thread>();
+
+  int get memoryHighWatermark => _memoryHighWatermark;
+  int _memoryHighWatermark = 0;
+
+  int get numZoneHandles => _numZoneHandles;
+  int _numZoneHandles;
+
+  int get numScopedHandles => _numScopedHandles;
+  int _numScopedHandles;
+
   void _loadHeapSnapshot(ServiceEvent event) {
     if (_snapshotFetch == null || _snapshotFetch.isClosed) {
       // No outstanding snapshot request. Presumably another client asked for a
@@ -1624,6 +1639,23 @@
     if (map['extensionRPCs'] != null) {
       extensionRPCs.addAll(map['extensionRPCs']);
     }
+
+    threads.clear();
+    if(map['_threads'] != null) {
+      threads.addAll(map['_threads']);
+    }
+
+    int currentMemoryHighWatermark = 0;
+    for (var i = 0; i < threads.length; i++) {
+      currentMemoryHighWatermark += threads[i].memoryHighWatermark;
+    }
+
+    if (currentMemoryHighWatermark > _memoryHighWatermark) {
+      _memoryHighWatermark = currentMemoryHighWatermark;
+    }
+
+    _numZoneHandles = map['_numZoneHandles'];
+    _numScopedHandles = map['_numScopedHandles'];
   }
 
   Future<TagProfile> updateTagProfile() {
@@ -1777,6 +1809,10 @@
     return invokeRpc('resume', {'step': 'Out'});
   }
 
+  Future rewind(int count) {
+    return invokeRpc('resume', {'step': 'Rewind', 'frameIndex': count});
+  }
+
   Future setName(String newName) {
     return invokeRpc('setName', {'name': newName});
   }
@@ -3052,6 +3088,71 @@
   String get shortName => valueAsString;
 }
 
+class Thread extends ServiceObject implements M.Thread {
+  M.ThreadKind get kind => _kind;
+  M.ThreadKind _kind;
+  String get kindString => _kindString;
+  String _kindString;
+  int get memoryHighWatermark => _memoryHighWatermark;
+  int _memoryHighWatermark;
+  List<Zone> get zones => _zones;
+  final List<Zone> _zones = new List<Zone>();
+
+  Thread._empty(ServiceObjectOwner owner) : super._empty(owner);
+
+  void _update(Map map, bool mapIsRef) {
+    String rawKind = map['kind'];
+    List<Map> zoneList = map['zones'];
+
+    switch(rawKind) {
+      case "kUnknownTask":
+        _kind = M.ThreadKind.unknownTask;
+        _kindString = 'unknown';
+        break;
+      case "kMutatorTask":
+        _kind = M.ThreadKind.mutatorTask;
+        _kindString = 'mutator';
+        break;
+      case "kCompilerTask":
+        _kind = M.ThreadKind.compilerTask;
+        _kindString = 'compiler';
+        break;
+      case "kSweeperTask":
+        _kind = M.ThreadKind.sweeperTask;
+        _kindString = 'sweeper';
+        break;
+      case "kMarkerTask":
+        _kind = M.ThreadKind.markerTask;
+        _kindString = 'marker';
+        break;
+      case "kFinalizerTask":
+        _kind = M.ThreadKind.finalizerTask;
+        _kindString = 'finalizer';
+        break;
+      default:
+        assert(false);
+    }
+
+    _memoryHighWatermark = int.parse(map['_memoryHighWatermark']);
+
+    zones.clear();
+    zoneList.forEach((zone) {
+      int capacity = zone['capacity'];
+      int used = zone['used'];
+      zones.add(new Zone(capacity, used));
+    });
+  }
+}
+
+class Zone implements M.Zone {
+  int get capacity => _capacity;
+  int _capacity;
+  int get used => _used;
+  int _used;
+
+  Zone(this._capacity, this._used);
+}
+
 class Field extends HeapObject implements M.Field {
   // Library or Class.
   HeapObject dartOwner;
diff --git a/runtime/observatory/observatory_sources.gypi b/runtime/observatory/observatory_sources.gypi
index c139cd3..a83a34c 100644
--- a/runtime/observatory/observatory_sources.gypi
+++ b/runtime/observatory/observatory_sources.gypi
@@ -173,11 +173,13 @@
     'lib/src/models/objects/sentinel.dart',
     'lib/src/models/objects/source_location.dart',
     'lib/src/models/objects/target.dart',
+    'lib/src/models/objects/thread.dart',
     'lib/src/models/objects/timeline_event.dart',
     'lib/src/models/objects/token_stream.dart',
     'lib/src/models/objects/type_arguments.dart',
     'lib/src/models/objects/unknown.dart',
     'lib/src/models/objects/vm.dart',
+    'lib/src/models/objects/zone.dart',
     'lib/src/models/repositories/allocation_profile.dart',
     'lib/src/models/repositories/breakpoint.dart',
     'lib/src/models/repositories/class.dart',
diff --git a/runtime/observatory/tests/service/get_isolate_rpc_test.dart b/runtime/observatory/tests/service/get_isolate_rpc_test.dart
index 840c705..74940c7 100644
--- a/runtime/observatory/tests/service/get_isolate_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_rpc_test.dart
@@ -23,6 +23,8 @@
     expect(result['pauseOnExit'], isFalse);
     expect(result['pauseEvent']['type'], equals('Event'));
     expect(result['error'], isNull);
+    expect(result['numZoneHandles'], isPositive);
+    expect(result['numScopedHandles'], isPositive);
     expect(result['rootLib']['type'], equals('@Library'));
     expect(result['libraries'].length, isPositive);
     expect(result['libraries'][0]['type'], equals('@Library'));
diff --git a/runtime/observatory/tests/service/get_object_rpc_test.dart b/runtime/observatory/tests/service/get_object_rpc_test.dart
index 2f45f3a..e933d49 100644
--- a/runtime/observatory/tests/service/get_object_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_object_rpc_test.dart
@@ -441,7 +441,7 @@
     expect(result['id'], startsWith('objects/'));
     expect(result['valueAsString'], isNull);
     expect(result['class']['type'], equals('@Class'));
-    expect(result['class']['name'], equals('Uint8List'));
+    expect(result['class']['name'], equals('_Uint8List'));
     expect(result['size'], isPositive);
     expect(result['fields'], isEmpty);
     expect(result['length'], equals(3));
@@ -467,7 +467,7 @@
     expect(result['id'], startsWith('objects/'));
     expect(result['valueAsString'], isNull);
     expect(result['class']['type'], equals('@Class'));
-    expect(result['class']['name'], equals('Uint8List'));
+    expect(result['class']['name'], equals('_Uint8List'));
     expect(result['size'], isPositive);
     expect(result['fields'], isEmpty);
     expect(result['length'], equals(3));
@@ -494,7 +494,7 @@
     expect(result['id'], startsWith('objects/'));
     expect(result['valueAsString'], isNull);
     expect(result['class']['type'], equals('@Class'));
-    expect(result['class']['name'], equals('Uint8List'));
+    expect(result['class']['name'], equals('_Uint8List'));
     expect(result['size'], isPositive);
     expect(result['fields'], isEmpty);
     expect(result['length'], equals(3));
@@ -521,7 +521,7 @@
     expect(result['id'], startsWith('objects/'));
     expect(result['valueAsString'], isNull);
     expect(result['class']['type'], equals('@Class'));
-    expect(result['class']['name'], equals('Uint8List'));
+    expect(result['class']['name'], equals('_Uint8List'));
     expect(result['size'], isPositive);
     expect(result['fields'], isEmpty);
     expect(result['length'], equals(3));
@@ -544,7 +544,7 @@
     expect(result['id'], startsWith('objects/'));
     expect(result['valueAsString'], isNull);
     expect(result['class']['type'], equals('@Class'));
-    expect(result['class']['name'], equals('Uint64List'));
+    expect(result['class']['name'], equals('_Uint64List'));
     expect(result['size'], isPositive);
     expect(result['fields'], isEmpty);
     expect(result['length'], equals(3));
@@ -570,7 +570,7 @@
     expect(result['id'], startsWith('objects/'));
     expect(result['valueAsString'], isNull);
     expect(result['class']['type'], equals('@Class'));
-    expect(result['class']['name'], equals('Uint64List'));
+    expect(result['class']['name'], equals('_Uint64List'));
     expect(result['size'], isPositive);
     expect(result['fields'], isEmpty);
     expect(result['length'], equals(3));
@@ -597,7 +597,7 @@
     expect(result['id'], startsWith('objects/'));
     expect(result['valueAsString'], isNull);
     expect(result['class']['type'], equals('@Class'));
-    expect(result['class']['name'], equals('Uint64List'));
+    expect(result['class']['name'], equals('_Uint64List'));
     expect(result['size'], isPositive);
     expect(result['fields'], isEmpty);
     expect(result['length'], equals(3));
@@ -624,7 +624,7 @@
     expect(result['id'], startsWith('objects/'));
     expect(result['valueAsString'], isNull);
     expect(result['class']['type'], equals('@Class'));
-    expect(result['class']['name'], equals('Uint64List'));
+    expect(result['class']['name'], equals('_Uint64List'));
     expect(result['size'], isPositive);
     expect(result['fields'], isEmpty);
     expect(result['length'], equals(3));
diff --git a/runtime/observatory/tests/service/get_source_report_test.dart b/runtime/observatory/tests/service/get_source_report_test.dart
index 2f089b2..81f21a5 100644
--- a/runtime/observatory/tests/service/get_source_report_test.dart
+++ b/runtime/observatory/tests/service/get_source_report_test.dart
@@ -63,10 +63,10 @@
 
   var expectedRange = {
     'scriptIndex': 0,
-    'startPos': 38,
-    'endPos': 87,
+    'startPos': 39,
+    'endPos': 88,
     'compiled': true,
-    'coverage': {'hits': [53, 71, 81], 'misses': [59]}
+    'coverage': {'hits': [54, 72, 82], 'misses': [60]}
   };
 
   // Full script
diff --git a/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart b/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart
new file mode 100644
index 0000000..36876be
--- /dev/null
+++ b/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--error_on_bad_type --error_on_bad_override
+
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+
+import 'test_helper.dart';
+
+var tests = [
+  (VM vm) async {
+    isInstanceOf<int> isInt = new isInstanceOf<int>();
+    // Just iterate over all the isolates to confirm they have
+    // the correct fields needed to examine zone memory usage.
+    for (Isolate isolate in vm.isolates) {
+      await isolate.reload();
+      expect(isolate.memoryHighWatermark, isInt);
+      expect(isolate.threads, isNotNull);
+      List<Thread> threads = isolate.threads;
+
+      for (Thread thread in threads) {
+        expect(thread.type, equals('_Thread'));
+        expect(thread.id, isNotNull);
+        expect(thread.kind, isNotNull);
+        expect(thread.memoryHighWatermark, isInt);
+        expect(thread.zones, isNotNull);
+        List<Zone> zones = thread.zones;
+
+        for (Zone zone in zones) {
+          expect(zone.capacity, isInt);
+          expect(zone.used, isInt);
+        }
+      }
+    }
+  },
+];
+
+main(args) async => runVMTests(args, tests);
diff --git a/runtime/observatory/tests/service/pause_idle_isolate_test.dart b/runtime/observatory/tests/service/pause_idle_isolate_test.dart
index 484230b..d042f4b 100644
--- a/runtime/observatory/tests/service/pause_idle_isolate_test.dart
+++ b/runtime/observatory/tests/service/pause_idle_isolate_test.dart
@@ -52,5 +52,6 @@
 
 main(args) => runIsolateTests(args, tests,
                               testeeConcurrent: testMain,
-                              trace_service: true,
-                              verbose_vm: true);
+                              verbose_vm: true,
+                              extraArgs: [ '--trace-service',
+                                           '--trace-service-verbose' ]);
diff --git a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart b/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
index 146be22..b292b31 100644
--- a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
+++ b/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
@@ -86,5 +86,6 @@
                               testeeConcurrent: testMain,
                               pause_on_start: true,
                               pause_on_exit: true,
-                              trace_service: true,
-                              verbose_vm: true);
+                              verbose_vm: true,
+                              extraArgs: [ '--trace-service',
+                                           '--trace-service-verbose' ]);
diff --git a/runtime/observatory/tests/service/pause_on_start_then_step_test.dart b/runtime/observatory/tests/service/pause_on_start_then_step_test.dart
index 107d2ee..480d984 100644
--- a/runtime/observatory/tests/service/pause_on_start_then_step_test.dart
+++ b/runtime/observatory/tests/service/pause_on_start_then_step_test.dart
@@ -89,5 +89,6 @@
                               testeeConcurrent: testMain,
                               pause_on_start: true,
                               pause_on_exit: true,
-                              trace_service: true,
-                              verbose_vm: true);
+                              verbose_vm: true,
+                              extraArgs: [ '--trace-service',
+                                           '--trace-service-verbose' ]);
diff --git a/runtime/observatory/tests/service/regress_28443_test.dart b/runtime/observatory/tests/service/regress_28443_test.dart
new file mode 100644
index 0000000..b135a6f
--- /dev/null
+++ b/runtime/observatory/tests/service/regress_28443_test.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'test_helper.dart';
+import 'service_test_common.dart';
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+
+const int LINE_A = 28, LINE_B = 33;
+
+class VMServiceClient {
+  VMServiceClient(this.x);
+  close() => new Future.microtask(() => print("close"));
+  var x;
+}
+
+collect() async {
+  var uri = "abc";
+  var vmService;
+  await new Future.microtask(() async {
+    try {
+      vmService = new VMServiceClient(uri);
+      await new Future.microtask(() => throw new TimeoutException("here"));
+    } on dynamic {
+      vmService.close();
+      rethrow;  // LINE_A
+    }
+  });
+}
+
+test_code() async {  // LINE_B
+  try {
+    await collect();
+  } on TimeoutException {
+    print("ok");
+  }
+}
+
+Future<Isolate> stepThroughProgram(Isolate isolate) async {
+  Completer completer = new Completer();
+  int pauseEventsSeen = 0;
+
+  await subscribeToStream(isolate.vm, VM.kDebugStream,
+      (ServiceEvent event) async {
+    if (event.kind == ServiceEvent.kPauseBreakpoint) {
+      // We are paused: Step further.
+      pauseEventsSeen++;
+      isolate.stepInto();
+    } else if (event.kind == ServiceEvent.kPauseExit) {
+      // We are at the exit: The test is done.
+      expect(pauseEventsSeen > 20, true,
+          reason: "Saw only $pauseEventsSeen pause events.");
+      await cancelStreamSubscription(VM.kDebugStream);
+      completer.complete();
+    }
+  });
+  isolate.resume();
+  return completer.future;
+}
+
+var tests = [hasPausedAtStart,
+             setBreakpointAtLine(LINE_B),
+             resumeIsolate,
+             hasStoppedAtBreakpoint,
+             setBreakpointAtLine(LINE_A),
+             resumeIsolate,
+             hasStoppedAtBreakpoint,
+             stepOut,
+             stoppedAtLine(LINE_B),
+             resumeIsolate];
+
+main(args) => runIsolateTestsSynchronous(args, tests,
+    testeeConcurrent: test_code, pause_on_start: true, pause_on_exit: false);
diff --git a/runtime/observatory/tests/service/rewind_optimized_out_test.dart b/runtime/observatory/tests/service/rewind_optimized_out_test.dart
new file mode 100644
index 0000000..23b8c9a
--- /dev/null
+++ b/runtime/observatory/tests/service/rewind_optimized_out_test.dart
@@ -0,0 +1,86 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--error_on_bad_type --error_on_bad_override
+
+import 'dart:developer';
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+import 'service_test_common.dart';
+import 'test_helper.dart';
+
+const alwaysInline = "AlwaysInline";
+const noInline = "NeverInline";
+
+int LINE_A = 35;
+int LINE_B = 40;
+int LINE_C = 43;
+int LINE_D = 47;
+
+int global = 0;
+
+@noInline
+b3(x) {
+  int sum = 0;
+  try {
+    for (int i = 0; i < x; i++) {
+      sum += x;
+    }
+  } catch (e) {
+    print("caught $e");
+  }
+  if (global >= 100) {
+    debugger();
+  }
+  global = global + 1;  // Line A
+  return sum;
+}
+
+@alwaysInline
+b2(x) => b3(x);  // Line B
+
+@alwaysInline
+b1(x) => b2(x);  // Line C
+
+test() {
+  while (true) {
+    b1(10000);  // Line D
+  }
+}
+
+var tests = [
+  hasStoppedAtBreakpoint,
+  stoppedAtLine(LINE_A),
+
+  (Isolate isolate) async {
+    // We are at our breakpoint with global=100.
+    var result = await isolate.rootLibrary.evaluate('global');
+    print('global is $result');
+    expect(result.type, equals('Instance'));
+    expect(result.valueAsString, equals('100'));
+
+    // Rewind the top stack frame.
+    bool caughtException;
+    try {
+      result = await isolate.rewind(1);
+      expect(false, isTrue, reason:'Unreachable');
+    } on ServerRpcException catch(e) {
+      caughtException = true;
+      expect(e.code, equals(ServerRpcException.kCannotResume));
+      expect(e.message,
+             'Cannot rewind to frame 1 due to conflicting compiler '
+             'optimizations. Run the vm with --no-prune-dead-locals to '
+             'disallow these optimizations. Next valid rewind frame is 4.');
+    }
+    expect(caughtException, isTrue);
+  },
+];
+
+
+main(args) => runIsolateTests(args, tests, testeeConcurrent: test,
+                              extraArgs:
+                              ['--trace-rewind',
+                               '--prune-dead-locals',
+                               '--enable-inlining-annotations',
+                               '--no-background-compilation',
+                               '--optimization-counter-threshold=10']);
diff --git a/runtime/observatory/tests/service/rewind_test.dart b/runtime/observatory/tests/service/rewind_test.dart
new file mode 100644
index 0000000..152d711
--- /dev/null
+++ b/runtime/observatory/tests/service/rewind_test.dart
@@ -0,0 +1,173 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--error_on_bad_type --error_on_bad_override
+
+import 'dart:developer';
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+import 'service_test_common.dart';
+import 'test_helper.dart';
+
+const alwaysInline = "AlwaysInline";
+const noInline = "NeverInline";
+
+int LINE_A = 35;
+int LINE_B = 40;
+int LINE_C = 43;
+int LINE_D = 47;
+
+int global = 0;
+
+@noInline
+b3(x) {
+  int sum = 0;
+  try {
+    for (int i = 0; i < x; i++) {
+      sum += x;
+    }
+  } catch (e) {
+    print("caught $e");
+  }
+  if (global >= 100) {
+    debugger();
+  }
+  global = global + 1;  // Line A
+  return sum;
+}
+
+@alwaysInline
+b2(x) => b3(x);  // Line B
+
+@alwaysInline
+b1(x) => b2(x);  // Line C
+
+test() {
+  while (true) {
+    b1(10000);  // Line D
+  }
+}
+
+var tests = [
+  hasStoppedAtBreakpoint,
+  stoppedAtLine(LINE_A),
+
+  (Isolate isolate) async {
+    // We are not able to rewind frame 0.
+    bool caughtException;
+    try {
+      await isolate.rewind(0);
+      expect(false, isTrue, reason:'Unreachable');
+    } on ServerRpcException catch(e) {
+      caughtException = true;
+      expect(e.code, equals(ServerRpcException.kCannotResume));
+      expect(e.message, 'Frame must be in bounds [1..9]: saw 0');
+    }
+    expect(caughtException, isTrue);
+  },
+
+  (Isolate isolate) async {
+    // We are not able to rewind frame 10.
+    bool caughtException;
+    try {
+      await isolate.rewind(10);
+      expect(false, isTrue, reason:'Unreachable');
+    } on ServerRpcException catch(e) {
+      caughtException = true;
+      expect(e.code, equals(ServerRpcException.kCannotResume));
+      expect(e.message, 'Frame must be in bounds [1..9]: saw 10');
+    }
+    expect(caughtException, isTrue);
+  },
+
+  (Isolate isolate) async {
+    // We are at our breakpoint with global=100.
+    var result = await isolate.rootLibrary.evaluate('global');
+    print('global is $result');
+    expect(result.type, equals('Instance'));
+    expect(result.valueAsString, equals('100'));
+
+    // Rewind the top stack frame.
+    result = await isolate.rewind(1);
+    expect(result['type'], equals('Success'));
+  },
+
+  hasStoppedAtBreakpoint,
+  stoppedAtLine(LINE_B),
+
+  (Isolate isolate) async {
+    var result = await isolate.resume();
+    expect(result['type'], equals('Success'));
+  },
+
+  hasStoppedAtBreakpoint,
+  stoppedAtLine(LINE_A),
+
+  (Isolate isolate) async {
+    // global still is equal to 100.  We did not execute "global++".
+    var result = await isolate.rootLibrary.evaluate('global');
+    print('global is $result');
+    expect(result.type, equals('Instance'));
+    expect(result.valueAsString, equals('100'));
+
+    // Resume again, for fun.
+    result = await isolate.resume();
+    expect(result['type'], equals('Success'));
+  },
+
+  hasStoppedAtBreakpoint,
+  stoppedAtLine(LINE_A),
+
+  (Isolate isolate) async {
+    // global is now 101.
+    var result = await isolate.rootLibrary.evaluate('global');
+    print('global is $result');
+    expect(result.type, equals('Instance'));
+    expect(result.valueAsString, equals('101'));
+
+    // Rewind up to 'test'/
+    result = await isolate.rewind(3);
+    expect(result['type'], equals('Success'));
+  },
+
+  hasStoppedAtBreakpoint,
+  stoppedAtLine(LINE_D),
+
+  (Isolate isolate) async {
+    // Reset global to 0 and start again.
+    var result = await isolate.rootLibrary.evaluate('global=0');
+    print('set global to $result');
+    expect(result.type, equals('Instance'));
+    expect(result.valueAsString, equals('0'));
+
+    result = await isolate.resume();
+    expect(result['type'], equals('Success'));
+  },
+
+  hasStoppedAtBreakpoint,
+  stoppedAtLine(LINE_A),
+
+  (Isolate isolate) async {
+    // We are at our breakpoint with global=100.
+    var result = await isolate.rootLibrary.evaluate('global');
+    print('global is $result');
+    expect(result.type, equals('Instance'));
+    expect(result.valueAsString, equals('100'));
+
+    // Rewind the top 2 stack frames.
+    result = await isolate.rewind(2);
+    expect(result['type'], equals('Success'));
+  },
+
+  hasStoppedAtBreakpoint,
+  stoppedAtLine(LINE_C),
+];
+
+
+main(args) => runIsolateTests(args, tests, testeeConcurrent: test,
+                              extraArgs:
+                              ['--trace-rewind',
+                               '--no-prune-dead-locals',
+                               '--enable-inlining-annotations',
+                               '--no-background-compilation',
+                               '--optimization-counter-threshold=10']);
diff --git a/runtime/observatory/tests/service/service.status b/runtime/observatory/tests/service/service.status
index ccbcbcc..cee1a67 100644
--- a/runtime/observatory/tests/service/service.status
+++ b/runtime/observatory/tests/service/service.status
@@ -8,8 +8,12 @@
 pause_on_start_and_exit_test: Pass, RuntimeError # Issue 26470
 pause_on_start_then_step_test: Pass, RuntimeError # Issue 26470
 get_allocation_samples_test: Pass, RuntimeError # Inconsistent stack trace
-# Reload is slow on the bots
-reload_sources_test: Pass, Slow
+get_isolate_rpc_test: Pass, RuntimeError # Issue 28185
+set_library_debuggable_test: Pass, RuntimeError # Issue 28091
+reload_sources_test: Pass, Slow # Reload is slow on the bots
+rewind_test: Pass, RuntimeError # Issue 28047
+tcp_socket_service_test: Pass, RuntimeError # Issue 28184
+get_retained_size_rpc_test: Pass, RuntimeError # Issue 28193
 
 [ ($compiler == none || $compiler == precompiler) && ($runtime == vm || $runtime == dart_precompiled) ]
 evaluate_activation_test/instance: RuntimeError # http://dartbug.com/20047
@@ -21,8 +25,13 @@
 debugger_location_second_test: Pass, Slow
 debugger_location_test: Pass, Slow
 
-# Disable on simulators.
+# Can be slow in debug mode, as well.
+vm_restart_test: Pass, Slow
+
+# These tests are slow on simulators.
 [ $arch == simarm || $arch == simmips || $arch == simarm64 ]
+*: Pass, Slow
+[ $mode == debug && ($arch == simarm || $arch == simmips || $arch == simarm64) ]
 *: SkipSlow
 
 # All tests use dart:io
@@ -37,18 +46,16 @@
 [ $arch == arm ]
 process_service_test: Pass, Fail # Issue 24344
 
-[ ($noopt || $compiler == precompiler) ]
+[ $compiler == precompiler ]
 *: Skip # Issue 24651
 
 [ $runtime == vm ]
 developer_extension_test: Pass, Fail # Issue 27225
 
-[ $runtime == dart_app ]
+[ $compiler == app_jit ]
 address_mapper_test: CompileTimeError # Issue 27806
 capture_stdio_test: CompileTimeError # Issue 27806
 complex_reload_test: RuntimeError # Issue 27806
-debugger_location_second_test: RuntimeError # Issue 27806
-dev_fs_spawn_test: RuntimeError # Issue 27806
 developer_extension_test: RuntimeError # Issue 27806
 evaluate_activation_test/instance: RuntimeError # Issue 27806
 evaluate_activation_test/scope: RuntimeError # Issue 27806
@@ -57,6 +64,8 @@
 set_name_rpc_test: RuntimeError # Issue 27806
 vm_restart_test: CompileTimeError # Issue 27806
 
+debugger_location_second_test: Skip # Issue 28180
+
 [ $compiler == dart2analyzer ]
 evaluate_activation_in_method_class_test: CompileTimeError # Issue 24478
 
@@ -64,6 +73,8 @@
 get_allocation_samples_test: RuntimeError # Profiling unimplemented.
 get_cpu_profile_timeline_rpc_test: RuntimeError # Profiling unimplemented.
 implicit_getter_setter_test: RuntimeError # Field guards unimplemented.
+rewind_test: RuntimeError # Issue 27878
+rewind_optimized_out_test: RuntimeError # Issue 27878
 
 [ $hot_reload || $hot_reload_rollback ]
 # Skip all service tests because random reloads interfere.
diff --git a/runtime/observatory/tests/service/service_test_common.dart b/runtime/observatory/tests/service/service_test_common.dart
index bf1d013..45e8b46 100644
--- a/runtime/observatory/tests/service/service_test_common.dart
+++ b/runtime/observatory/tests/service/service_test_common.dart
@@ -234,6 +234,10 @@
   return (Isolate isolate) async {
     print("Checking we are at line $line");
 
+    // Make sure that the isolate has stopped.
+    isolate.reload();
+    expect(isolate.pauseEvent is! M.ResumeEvent, isTrue);
+
     ServiceMap stack = await isolate.getStack();
     expect(stack.type, equals('Stack'));
 
diff --git a/runtime/observatory/tests/service/set_vm_name_rpc_test.dart b/runtime/observatory/tests/service/set_vm_name_rpc_test.dart
index 7e3a53a..8554ad3 100644
--- a/runtime/observatory/tests/service/set_vm_name_rpc_test.dart
+++ b/runtime/observatory/tests/service/set_vm_name_rpc_test.dart
@@ -32,4 +32,6 @@
   },
 ];
 
-main(args) async => runVMTests(args, tests, trace_service: true);
+main(args) async => runVMTests(args, tests,
+                               extraArgs: [ '--trace-service',
+                                            '--trace-service-verbose' ]);
diff --git a/runtime/observatory/tests/service/step_over_await_test.dart b/runtime/observatory/tests/service/step_over_await_test.dart
index 1bbb3b7..d5f946c 100644
--- a/runtime/observatory/tests/service/step_over_await_test.dart
+++ b/runtime/observatory/tests/service/step_over_await_test.dart
@@ -1,7 +1,7 @@
 // Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-// VMOptions=--error_on_bad_type --error_on_bad_override  --verbose_debug --trace_service
+// VMOptions=--error_on_bad_type --error_on_bad_override  --verbose_debug
 
 import 'dart:async';
 import 'dart:developer';
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index a722876..eeb6805 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -90,15 +90,12 @@
   Future<Process> _spawnProcess(bool pause_on_start,
                                 bool pause_on_exit,
                                 bool pause_on_unhandled_exceptions,
-                                bool trace_service,
-                                bool trace_compiler,
                                 bool testeeControlsServer,
-                                bool useAuthToken) {
+                                bool useAuthToken,
+                                List<String> extraArgs) {
     assert(pause_on_start != null);
     assert(pause_on_exit != null);
     assert(pause_on_unhandled_exceptions != null);
-    assert(trace_service != null);
-    assert(trace_compiler != null);
     assert(testeeControlsServer != null);
     assert(useAuthToken != null);
 
@@ -106,39 +103,29 @@
       return _spawnSkyProcess(pause_on_start,
                               pause_on_exit,
                               pause_on_unhandled_exceptions,
-                              trace_service,
-                              trace_compiler,
-                              testeeControlsServer);
+                              testeeControlsServer,
+                              extraArgs);
     } else {
       return _spawnDartProcess(pause_on_start,
                                pause_on_exit,
                                pause_on_unhandled_exceptions,
-                               trace_service,
-                               trace_compiler,
                                testeeControlsServer,
-                               useAuthToken);
+                               useAuthToken,
+                               extraArgs);
     }
   }
 
   Future<Process> _spawnDartProcess(bool pause_on_start,
                                     bool pause_on_exit,
                                     bool pause_on_unhandled_exceptions,
-                                    bool trace_service,
-                                    bool trace_compiler,
                                     bool testeeControlsServer,
-                                    bool useAuthToken) {
+                                    bool useAuthToken,
+                                    List<String> extraArgs) {
     assert(!_shouldLaunchSkyShell());
 
     String dartExecutable = Platform.executable;
 
     var fullArgs = [];
-    if (trace_service) {
-      fullArgs.add('--trace-service');
-      fullArgs.add('--trace-service-verbose');
-    }
-    if (trace_compiler) {
-      fullArgs.add('--trace-compiler');
-    }
     if (pause_on_start) {
       fullArgs.add('--pause-isolates-on-start');
     }
@@ -148,6 +135,9 @@
     if (pause_on_unhandled_exceptions) {
       fullArgs.add('--pause-isolates-on-unhandled-exceptions');
     }
+    if (extraArgs != null) {
+      fullArgs.addAll(extraArgs);
+    }
 
     fullArgs.addAll(Platform.executableArguments);
     if (!testeeControlsServer) {
@@ -166,22 +156,14 @@
   Future<Process> _spawnSkyProcess(bool pause_on_start,
                                    bool pause_on_exit,
                                    bool pause_on_unhandled_exceptions,
-                                   bool trace_service,
-                                   bool trace_compiler,
-                                   bool testeeControlsServer) {
+                                   bool testeeControlsServer,
+                                   List<String> extraArgs) {
     assert(_shouldLaunchSkyShell());
 
     String dartExecutable = _skyShellPath();
 
     var dartFlags = [];
     var fullArgs = [];
-    if (trace_service) {
-      dartFlags.add('--trace_service');
-      dartFlags.add('--trace_service_verbose');
-    }
-    if (trace_compiler) {
-      dartFlags.add('--trace_compiler');
-    }
     if (pause_on_start) {
       dartFlags.add('--pause_isolates_on_start');
       fullArgs.add('--start-paused');
@@ -194,6 +176,9 @@
     }
     // Override mirrors.
     dartFlags.add('--enable_mirrors=true');
+    if (extraArgs != null) {
+      fullArgs.addAll(extraArgs);
+    }
 
     fullArgs.addAll(Platform.executableArguments);
     if (!testeeControlsServer) {
@@ -223,17 +208,15 @@
   Future<Uri> launch(bool pause_on_start,
                      bool pause_on_exit,
                      bool pause_on_unhandled_exceptions,
-                     bool trace_service,
-                     bool trace_compiler,
                      bool testeeControlsServer,
-                     bool useAuthToken) {
+                     bool useAuthToken,
+                     List<String> extraArgs) {
     return _spawnProcess(pause_on_start,
                   pause_on_exit,
                   pause_on_unhandled_exceptions,
-                  trace_service,
-                  trace_compiler,
                   testeeControlsServer,
-                  useAuthToken).then((p) {
+                  useAuthToken,
+                  extraArgs).then((p) {
       Completer<Uri> completer = new Completer<Uri>();
       process = p;
       Uri uri;
@@ -288,12 +271,11 @@
 
 class _ServiceTesterRunner {
   void run({List<String> mainArgs,
+            List<String> extraArgs,
             List<VMTest> vmTests,
             List<IsolateTest> isolateTests,
             bool pause_on_start: false,
             bool pause_on_exit: false,
-            bool trace_service: false,
-            bool trace_compiler: false,
             bool verbose_vm: false,
             bool pause_on_unhandled_exceptions: false,
             bool testeeControlsServer: false,
@@ -301,9 +283,8 @@
     var process = new _ServiceTesteeLauncher();
     process.launch(pause_on_start, pause_on_exit,
                    pause_on_unhandled_exceptions,
-                   trace_service, trace_compiler,
                    testeeControlsServer,
-                   useAuthToken).then((Uri serverAddress) async {
+                   useAuthToken, extraArgs).then((Uri serverAddress) async {
       if (mainArgs.contains("--gdb")) {
         var pid = process.process.pid;
         var wait = new Duration(seconds: 10);
@@ -364,12 +345,11 @@
                         testeeConcurrent(),
                         bool pause_on_start: false,
                         bool pause_on_exit: false,
-                        bool trace_service: false,
-                        bool trace_compiler: false,
                         bool verbose_vm: false,
                         bool pause_on_unhandled_exceptions: false,
                         bool testeeControlsServer: false,
-                        bool useAuthToken: false}) async {
+                        bool useAuthToken: false,
+                        List<String> extraArgs}) async {
   assert(!pause_on_start || testeeBefore == null);
   if (_isTestee()) {
     new _ServiceTesteeRunner().run(testeeBefore: testeeBefore,
@@ -379,11 +359,10 @@
   } else {
     new _ServiceTesterRunner().run(
         mainArgs: mainArgs,
+        extraArgs: extraArgs,
         isolateTests: tests,
         pause_on_start: pause_on_start,
         pause_on_exit: pause_on_exit,
-        trace_service: trace_service,
-        trace_compiler: trace_compiler,
         verbose_vm: verbose_vm,
         pause_on_unhandled_exceptions: pause_on_unhandled_exceptions,
         testeeControlsServer: testeeControlsServer,
@@ -406,10 +385,9 @@
                                  void testeeConcurrent(),
                                  bool pause_on_start: false,
                                  bool pause_on_exit: false,
-                                 bool trace_service: false,
-                                 bool trace_compiler: false,
                                  bool verbose_vm: false,
-                                 bool pause_on_unhandled_exceptions: false}) {
+                                 bool pause_on_unhandled_exceptions: false,
+                                 List<String> extraArgs}) {
   assert(!pause_on_start || testeeBefore == null);
   if (_isTestee()) {
     new _ServiceTesteeRunner().runSync(testeeBeforeSync: testeeBefore,
@@ -419,11 +397,10 @@
   } else {
     new _ServiceTesterRunner().run(
         mainArgs: mainArgs,
+        extraArgs: extraArgs,
         isolateTests: tests,
         pause_on_start: pause_on_start,
         pause_on_exit: pause_on_exit,
-        trace_service: trace_service,
-        trace_compiler: trace_compiler,
         verbose_vm: verbose_vm,
         pause_on_unhandled_exceptions: pause_on_unhandled_exceptions);
   }
@@ -440,10 +417,9 @@
                    testeeConcurrent(),
                    bool pause_on_start: false,
                    bool pause_on_exit: false,
-                   bool trace_service: false,
-                   bool trace_compiler: false,
                    bool verbose_vm: false,
-                   bool pause_on_unhandled_exceptions: false}) async {
+                   bool pause_on_unhandled_exceptions: false,
+                   List<String> extraArgs}) async {
   if (_isTestee()) {
     new _ServiceTesteeRunner().run(testeeBefore: testeeBefore,
                                    testeeConcurrent: testeeConcurrent,
@@ -452,11 +428,10 @@
   } else {
     new _ServiceTesterRunner().run(
         mainArgs: mainArgs,
+        extraArgs: extraArgs,
         vmTests: tests,
         pause_on_start: pause_on_start,
         pause_on_exit: pause_on_exit,
-        trace_service: trace_service,
-        trace_compiler: trace_compiler,
         verbose_vm: verbose_vm,
         pause_on_unhandled_exceptions: pause_on_unhandled_exceptions);
   }
diff --git a/runtime/observatory/tests/ui/inspector.dart b/runtime/observatory/tests/ui/inspector.dart
index c34f2d9..ae617a7 100644
--- a/runtime/observatory/tests/ui/inspector.dart
+++ b/runtime/observatory/tests/ui/inspector.dart
@@ -76,7 +76,7 @@
   var userTag;
   var weakProperty;
 
-  genStacktrace() {
+  genStackTrace() {
     try {
       num.parse(',');
     } catch (e, s) {
@@ -162,7 +162,7 @@
     portSend = portReceive.sendPort;
     regex = new RegExp("a*b+c");
     smi = 7;
-    stacktrace = genStacktrace();
+    stacktrace = genStackTrace();
     string = "Hello $smi ${smi.runtimeType}";
     stringLatin1 = "blåbærgrød";
     stringSnowflake = "❄";
diff --git a/runtime/platform/address_sanitizer.h b/runtime/platform/address_sanitizer.h
index ec8baf7..bc7359d 100644
--- a/runtime/platform/address_sanitizer.h
+++ b/runtime/platform/address_sanitizer.h
@@ -10,18 +10,40 @@
 // Allow the use of ASan (AddressSanitizer). This is needed as ASan needs to be
 // told about areas where the VM does the equivalent of a long-jump.
 #if defined(__has_feature)
+
 #if __has_feature(address_sanitizer)
 extern "C" void __asan_unpoison_memory_region(void*, size_t);
+extern "C" void __lsan_register_root_region(const void* p, size_t size);
+extern "C" void __lsan_unregister_root_region(const void* p, size_t size);
 #define ASAN_UNPOISON(ptr, len) __asan_unpoison_memory_region(ptr, len)
+#define LSAN_REGISTER_ROOT_REGION(ptr, len)                                    \
+  __lsan_register_root_region(ptr, len)
+#define LSAN_UNREGISTER_ROOT_REGION(ptr, len)                                  \
+  __lsan_unregister_root_region(ptr, len)
 #else  // __has_feature(address_sanitizer)
 #define ASAN_UNPOISON(ptr, len)                                                \
   do {                                                                         \
   } while (false && (ptr) == 0 && (len) == 0)
+#define LSAN_REGISTER_ROOT_REGION(ptr, len)                                    \
+  do {                                                                         \
+  } while (false && (ptr) == 0 && (len) == 0)
+#define LSAN_UNREGISTER_ROOT_REGION(ptr, len)                                  \
+  do {                                                                         \
+  } while (false && (ptr) == 0 && (len) == 0)
 #endif  // __has_feature(address_sanitizer)
+
 #else   // defined(__has_feature)
+
 #define ASAN_UNPOISON(ptr, len)                                                \
   do {                                                                         \
   } while (false && (ptr) == 0 && (len) == 0)
+#define LSAN_REGISTER_ROOT_REGION(ptr, len)                                    \
+  do {                                                                         \
+  } while (false && (ptr) == 0 && (len) == 0)
+#define LSAN_UNREGISTER_ROOT_REGION(ptr, len)                                  \
+  do {                                                                         \
+  } while (false && (ptr) == 0 && (len) == 0)
+
 #endif  // defined(__has_feature)
 
 #endif  // RUNTIME_PLATFORM_ADDRESS_SANITIZER_H_
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index 101200b..d862a9e 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -248,6 +248,9 @@
 #define ARCH_IS_32_BIT 1
 #define kFpuRegisterSize 8
 typedef double fpu_register_t;
+#elif defined(__MIPSEB__)
+#error Big-endian MIPS is not supported by Dart. Try passing -EL to your      \
+ compiler.
 #elif defined(__aarch64__)
 #define HOST_ARCH_ARM64 1
 #define ARCH_IS_64_BIT 1
diff --git a/runtime/platform/hashmap.cc b/runtime/platform/hashmap.cc
index 4611533..4a18cb2 100644
--- a/runtime/platform/hashmap.cc
+++ b/runtime/platform/hashmap.cc
@@ -106,7 +106,6 @@
 
   // Clear the candidate which will not break searching the hash table.
   candidate->key = NULL;
-  candidate->value = NULL;
   occupancy_--;
 }
 
@@ -118,7 +117,6 @@
     if ((clear != NULL) && (p->key != NULL)) {
       clear(p->value);
     }
-    p->value = NULL;
     p->key = NULL;
   }
   occupancy_ = 0;
diff --git a/runtime/platform/hashmap.h b/runtime/platform/hashmap.h
index 1fd1235..be8278e 100644
--- a/runtime/platform/hashmap.h
+++ b/runtime/platform/hashmap.h
@@ -61,6 +61,9 @@
   Entry* Lookup(void* key, uint32_t hash, bool insert);
 
   // Removes the entry with matching key.
+  //
+  // WARNING: This method cannot be called while iterating a `HashMap`
+  // otherwise the iteration might step over elements!
   void Remove(void* key, uint32_t hash);
 
   // Empties the hash map (occupancy() == 0), and calls the function 'clear' on
diff --git a/runtime/runtime_args.gni b/runtime/runtime_args.gni
new file mode 100644
index 0000000..52b2407
--- /dev/null
+++ b/runtime/runtime_args.gni
@@ -0,0 +1,24 @@
+# Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+declare_args() {
+  # Whether to fall back to built-in root certificates when they cannot be
+  # verified at the operating system level.
+  dart_use_fallback_root_certificates = false
+
+  # The BUILD.gn file that we pull from chromium as part of zlib has a
+  # dependence on //base, which we don't pull in. In a standalone build of the
+  # VM, we set this to //runtime/bin/zlib where we have a BUILD.gn file without
+  # a dependence on //base.
+  dart_zlib_path = "//third_party/zlib"
+
+  # Whether to link the standalone VM against tcmalloc. The standalone build of
+  # the VM enables this only for Linux builds.
+  dart_use_tcmalloc = false
+}
+
+# TODO(zra): Remove this when Fuchsia has a root cert cache on the filesystem.
+if (defined(is_fuchsia) && is_fuchsia) {
+  dart_use_fallback_root_certificates = true
+}
diff --git a/runtime/tests/vm/dart/hello_fuchsia_test.dart b/runtime/tests/vm/dart/hello_fuchsia_test.dart
index 35f2cef3..8d597f2 100644
--- a/runtime/tests/vm/dart/hello_fuchsia_test.dart
+++ b/runtime/tests/vm/dart/hello_fuchsia_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "dart:async";
+import "dart:convert";
 import "dart:io";
 
 testAddressParse() async {
@@ -378,7 +379,98 @@
   }
 }
 
-main() async {
+Future testProcess() async {
+  String exe = Platform.resolvedExecutable;
+  print("Running $exe --version");
+  Process p = await Process.start(exe, ["--version"]);
+  p.stderr.transform(UTF8.decoder).listen(print);
+  int code = await p.exitCode;
+  print("$exe --version exited with code $code");
+}
+
+void testProcessRunSync() {
+  String exe = Platform.resolvedExecutable;
+  print("Running $exe --version");
+  var result = Process.runSync(exe, ["--version"]);
+  print("$exe --version exited with code ${result.exitCode}");
+  print("$exe --version had stdout = '${result.stdout}'");
+  print("$exe --version had stderr = '${result.stderr}'");
+}
+
+Future testKill() async {
+  String exe = Platform.resolvedExecutable;
+  String script = Platform.script.path;
+  print("Running $exe $script");
+  Process p = await Process.start(exe, [script, "infinite-loop"]);
+  await new Future.delayed(const Duration(seconds: 1));
+  p.kill();
+  int code = await p.exitCode;
+  print("$exe $script exited with code $code");
+}
+
+Future testLs(String path) async {
+  Stream<FileSystemEntity> stream = (new Directory(path)).list();
+  await for (FileSystemEntity fse in stream) {
+    print(fse.path);
+  }
+}
+
+void testPlatformEnvironment() {
+  Map<String, String> env = Platform.environment;
+  for (String k in env.keys) {
+    String v = env[k];
+    print("$k = '$v'");
+  }
+}
+
+Future testCopy() async {
+  final String sourceName = "foo";
+  final String destName = "bar";
+  Directory tmp = await Directory.systemTemp.createTemp("testCopy");
+  File sourceFile = new File("${tmp.path}/$sourceName");
+  File destFile = new File("${tmp.path}/$destName");
+  List<int> data = new List<int>.generate(10 * 1024, (int i) => i & 0xff);
+  await sourceFile.writeAsBytes(data);
+  await sourceFile.copy(destFile.path);
+  List<int> resultData = await destFile.readAsBytes();
+  assert(data.length == resultData.length);
+  for (int i = 0; i < data.length; i++) {
+    assert(data[i] == resultData[i]);
+  }
+  await sourceFile.delete();
+  await destFile.delete();
+  await tmp.delete();
+}
+
+Future testRecursiveDelete() async {
+  Directory tmp0 = await Directory.systemTemp.createTemp("testRD");
+  Directory tmp1 = await tmp0.createTemp("testRD");
+  Directory tmp2 = await tmp1.createTemp("testRD");
+  File file0 = new File("${tmp0.path}/file");
+  File file1 = new File("${tmp1.path}/file");
+  File file2 = new File("${tmp2.path}/file");
+  List<int> data = new List<int>.generate(10 * 1024, (int i) => i & 0xff);
+  await file0.writeAsBytes(data);
+  await file1.writeAsBytes(data);
+  await file2.writeAsBytes(data);
+
+  await tmp0.delete(recursive: true);
+
+  assert(!await file2.exists());
+  assert(!await file1.exists());
+  assert(!await file0.exists());
+  assert(!await tmp2.exists());
+  assert(!await tmp1.exists());
+  assert(!await tmp0.exists());
+}
+
+main(List<String> args) async {
+  if (args.length >= 1) {
+    if (args[0] == "infinite-loop") {
+      while (true);
+    }
+  }
+
   print("Hello, Fuchsia!");
 
   print("testAddressParse");
@@ -409,5 +501,33 @@
   await testGoogleHttps(null, 'pass');
   print("testGoogleHttps done");
 
+  print("lsTest");
+  await testLs("/");
+  print("lsTest done");
+
+  print("testPlatformEnvironment");
+  testPlatformEnvironment();
+  print("testPlatformEnvironment done");
+
+  print("testProcess");
+  await testProcess();
+  print("testProcess done");
+
+  print("testProcessRunSync");
+  testProcessRunSync();
+  print("testProcessRunSync done");
+
+  print("testKill");
+  await testKill();
+  print("testKill done");
+
+  print("testCopy");
+  await testCopy();
+  print("testCopy done");
+
+  print("testRecursiveDelete");
+  await testRecursiveDelete();
+  print("testRecursiveDelete done");
+
   print("Goodbyte, Fuchsia!");
 }
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index dd5b600..7ec8b8a 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -2,12 +2,13 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-cc/IsolateReload_PendingUnqualifiedCall_InstanceToStatic: Fail, Crash
-cc/IsolateReload_PendingUnqualifiedCall_StaticToInstance: Fail, Crash
-cc/IsolateReload_PendingConstructorCall_AbstractToConcrete: Fail, Crash
-cc/IsolateReload_PendingConstructorCall_ConcreteToAbstract: Fail, Crash
-cc/IsolateReload_PendingStaticCall_DefinedToNSM: Fail, Crash
-cc/IsolateReload_PendingStaticCall_NSMToDefined: Fail, Crash
+# Issue 28198
+cc/IsolateReload_PendingUnqualifiedCall_InstanceToStatic: Fail, Crash, Timeout
+cc/IsolateReload_PendingUnqualifiedCall_StaticToInstance: Fail, Crash, Timeout
+cc/IsolateReload_PendingConstructorCall_AbstractToConcrete: Fail, Crash, Timeout
+cc/IsolateReload_PendingConstructorCall_ConcreteToAbstract: Fail, Crash, Timeout
+cc/IsolateReload_PendingStaticCall_DefinedToNSM: Fail, Crash, Timeout
+cc/IsolateReload_PendingStaticCall_NSMToDefined: Fail, Crash, Timeout
 
 # These tests are expected to crash on all platforms.
 cc/ArrayNew_Overflow_Crash: Crash, Timeout
@@ -17,8 +18,8 @@
 cc/Fail1: Fail
 cc/Fail2: Fail
 
-cc/Dart2JSCompileAll: Crash # Issue 27369
-cc/Dart2JSCompilerStats: Crash # Issue 27369
+cc/Dart2JSCompileAll: Fail, Crash # Issue 27369
+cc/Dart2JSCompilerStats: Fail, Crash # Issue 27369
 
 cc/SNPrint_BadArgs: Skip
 
@@ -48,6 +49,43 @@
 cc/Dart2JSCompilerStats: Skip
 cc/CorelibCompilerStats: Skip
 
+[ $system == fuchsia ]
+# OOM crash can bring down the OS.
+dart/spawn_shutdown_test: Skip
+cc/CorelibIsolateStartup: Skip
+# TODO(zra): package:unittest is not in the image.
+dart/data_uri_spawn_test: Skip
+# ../../dart/runtime/bin/file_test.cc: 34: error: expected: !file->WriteByte(1)
+cc/Read: Fail  # TODO(zra): Investigate
+# Assumes initial thread's stack is the same size as spawned thread stacks.
+cc/StackOverflowStackTraceInfo: Crash
+# The profiler is turned off. Issue MG-430.
+cc/Profiler_AllocationSampleTest: Crash
+cc/Profiler_ArrayAllocation: Crash
+cc/Profiler_BasicSourcePosition: Crash
+cc/Profiler_BasicSourcePositionOptimized: Crash
+cc/Profiler_BinaryOperatorSourcePosition: Crash
+cc/Profiler_BinaryOperatorSourcePositionOptimized: Crash
+cc/Profiler_ChainedSamples: Crash
+cc/Profiler_ClosureAllocation: Crash
+cc/Profiler_CodeTicks: Crash
+cc/Profiler_ContextAllocation: Crash
+cc/Profiler_FunctionInline: Crash
+cc/Profiler_FunctionTicks: Crash
+cc/Profiler_InliningIntervalBoundry: Crash
+cc/Profiler_IntrinsicAllocation: Crash
+cc/Profiler_SampleBufferIterateTest: Crash
+cc/Profiler_SampleBufferWrapTest: Crash
+cc/Profiler_SourcePosition: Crash
+cc/Profiler_SourcePositionOptimized: Crash
+cc/Profiler_StringAllocation: Crash
+cc/Profiler_StringInterpolation: Crash
+cc/Profiler_ToggleRecordAllocation: Crash
+cc/Profiler_TrivialRecordAllocation: Crash
+cc/Profiler_TypedArrayAllocation: Crash
+cc/Profiler_GetSourceReport: Crash
+cc/Service_Profile: Fail
+
 # Profiler is completely disabled in SIMDBC builds.
 # On the simluator stack traces produced by the Profiler do not match
 # up with the real Dart stack trace and hence we don't get correct
@@ -133,6 +171,9 @@
 [ $compiler == dart2analyzer ]
 dart/optimized_stacktrace_test: StaticWarning
 
+[ $compiler == app_jit ]
+dart/snapshot_version_test: Fail,OK # Expects to find script snapshot relative to Dart source.
+
 [ $runtime != vm ]
 dart/snapshot_version_test: SkipByDesign  # Spawns processes
 dart/spawn_infinite_loop_test: Skip  # VM shutdown test
@@ -145,22 +186,82 @@
 [ $builder_tag == asan ]
 cc/CodeImmutability: Fail,OK # Address Sanitizer turns a crash into a failure.
 
-[ $noopt || $compiler == precompiler ]
+[ $builder_tag == asan && $arch == x64 ]
+cc/Debug_DeleteBreakpoint: Fail # Issue 28348
+
+cc/IsolateReload_ChangeInstanceFormat7: Fail # Issue 28349
+cc/IsolateReload_ClassAdded: Fail # Issue 28349
+cc/IsolateReload_ComplexInheritanceChange: Fail # Issue 28349
+cc/IsolateReload_ConstFieldUpdate: Fail # Issue 28349
+cc/IsolateReload_ConstantIdentical: Fail # Issue 28349
+cc/IsolateReload_ConstructorChanged: Fail # Issue 28349
+cc/IsolateReload_DanglingGetter_Class: Fail # Issue 28349
+cc/IsolateReload_DanglingGetter_Instance: Fail # Issue 28349
+cc/IsolateReload_DanglingGetter_Library: Fail # Issue 28349
+cc/IsolateReload_DanglingSetter_Class: Fail # Issue 28349
+cc/IsolateReload_DanglingSetter_Instance: Fail # Issue 28349
+cc/IsolateReload_DanglingSetter_Library: Fail # Issue 28349
+cc/IsolateReload_DirectSubclasses_GhostSubclass: Fail # Issue 28349
+cc/IsolateReload_DirectSubclasses_Success: Fail # Issue 28349
+cc/IsolateReload_EnumAddition: Fail # Issue 28349
+cc/IsolateReload_EnumDelete: Fail # Issue 28349
+cc/IsolateReload_EnumEquality: Fail # Issue 28349
+cc/IsolateReload_EnumIdentical: Fail # Issue 28349
+cc/IsolateReload_EnumIdentityReload: Fail # Issue 28349
+cc/IsolateReload_EnumReorderIdentical: Fail # Issue 28349
+cc/IsolateReload_EnumValuesToString: Fail # Issue 28349
+cc/IsolateReload_ExportedLibModified: Fail # Issue 28349
+cc/IsolateReload_FunctionReplacement: Fail # Issue 28349
+cc/IsolateReload_Generics: Fail # Issue 28349
+cc/IsolateReload_ImplicitConstructorChanged: Fail # Issue 28349
+cc/IsolateReload_ImportedLibModified: Fail # Issue 28349
+cc/IsolateReload_ImportedMixinFunction: Fail # Issue 28349
+cc/IsolateReload_LibraryDebuggable: Fail # Issue 28349
+cc/IsolateReload_LibraryHide: Fail # Issue 28349
+cc/IsolateReload_LibraryImportAdded: Fail # Issue 28349
+cc/IsolateReload_LibraryImportRemoved: Fail # Issue 28349
+cc/IsolateReload_LibraryLookup: Fail # Issue 28349
+cc/IsolateReload_LibraryShow: Fail # Issue 28349
+cc/IsolateReload_LiveStack: Fail # Issue 28349
+cc/IsolateReload_MainLibModified: Fail # Issue 28349
+cc/IsolateReload_MixinChanged: Fail # Issue 28349
+cc/IsolateReload_PendingSuperCall: Fail # Issue 28349
+cc/IsolateReload_PrefixImportedLibModified: Fail # Issue 28349
+cc/IsolateReload_SavedClosure: Fail # Issue 28349
+cc/IsolateReload_SavedClosure: Fail # Issue 28349
+cc/IsolateReload_SimpleConstFieldUpdate: Fail # Issue 28349
+cc/IsolateReload_SmiFastPathStubs: Fail # Issue 28349
+cc/IsolateReload_StaticTearOffRetainsHash: Fail # Issue 28349
+cc/IsolateReload_StaticValuePreserved: Fail # Issue 28349
+cc/IsolateReload_StaticValuePreserved: Fail # Issue 28349
+cc/IsolateReload_SuperClassChanged: Fail # Issue 28349
+cc/IsolateReload_TearOff_AddArguments2: Fail # Issue 28349
+cc/IsolateReload_TearOff_AddArguments: Fail # Issue 28349
+cc/IsolateReload_TearOff_Class_Identity: Fail # Issue 28349
+cc/IsolateReload_TearOff_Instance_Equality: Fail # Issue 28349
+cc/IsolateReload_TearOff_Library_Identity: Fail # Issue 28349
+cc/IsolateReload_TearOff_List_Set: Fail # Issue 28349
+cc/IsolateReload_TopLevelFieldAdded: Fail # Issue 28349
+cc/IsolateReload_TypeIdentity: Fail # Issue 28349
+cc/IsolateReload_TypeIdentityGeneric: Fail # Issue 28349
+cc/IsolateReload_TypeIdentityParameter: Fail # Issue 28349
+
+[ $compiler == precompiler ]
 dart/byte_array_test: Skip # Incompatible flag --disable_alloc_stubs_after_gc
 
-[ $noopt || $compiler == precompiler || $mode == product ]
+[ $compiler == precompiler || $mode == product ]
 dart/redirection_type_shuffling_test: SkipByDesign # Imports dart:mirrors
 cc/CreateMirrorSystem: SkipByDesign # Imports dart:mirrors
 cc/CoreSnapshotSize: SkipByDesign # Imports dart:mirrors
 cc/StandaloneSnapshotSize: SkipByDesign # Imports dart:mirrors
 
-[ $noopt || $runtime == dart_precompiled ]
-# Stacktraces in precompilation omit inlined frames.
+[ $runtime == dart_precompiled ]
+# StackTraces in precompilation omit inlined frames.
 dart/inline_stack_frame_test: Pass, RuntimeError
 dart/optimized_stacktrace_test: Pass, RuntimeError
-
-[ $runtime == dart_app || $runtime == dart_precompiled ]
 dart/data_uri_spawn_test: SkipByDesign # Isolate.spawnUri
+
+[ $compiler == app_jit || $compiler == precompiler ]
 dart/optimized_stacktrace_test: SkipByDesign # Requires line numbers
 
 [ $runtime == vm && $mode == product ]
@@ -188,6 +289,9 @@
 # This test is meaningless for DBC as allocation stubs are not used.
 cc/RegenerateAllocStubs: Skip
 
+[ $arch == simdbc64 && $mode == release ]
+cc/UseDartApi: Pass,Crash # Issue 28499
+
 [ $hot_reload || $hot_reload_rollback ]
 dart/spawn_shutdown_test: Skip # We can shutdown an isolate before it reloads.
 dart/spawn_infinite_loop_test: Skip # We can shutdown an isolate before it reloads.
diff --git a/runtime/tools/create_archive.py b/runtime/tools/create_archive.py
old mode 100644
new mode 100755
index 7b0e99d..76d42dc
--- a/runtime/tools/create_archive.py
+++ b/runtime/tools/create_archive.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
 # Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
@@ -132,6 +133,9 @@
             continue
         files.append(src_path)
 
+    # Ensure consistent file ordering for reproducible builds.
+    files.sort()
+
     # Write out archive.
     makeArchive(options.tar_output,
                 options.client_root,
diff --git a/runtime/tools/create_snapshot_bin.py b/runtime/tools/create_snapshot_bin.py
index 65e56de..81f35aa 100755
--- a/runtime/tools/create_snapshot_bin.py
+++ b/runtime/tools/create_snapshot_bin.py
@@ -32,10 +32,6 @@
       action="store", type="string",
       help="output file name into which isolate snapshot in binary form " +
            "is generated")
-  result.add_option("--instructions_bin",
-      action="store", type="string",
-      help="output file name into which instructions snapshot in assembly " +
-           "form is generated")
   result.add_option("--embedder_entry_points_manifest",
       action="store", type="string",
       help="input manifest with the vm entry points in a precompiled snapshot")
@@ -120,14 +116,8 @@
     script_args.append(''.join([ "--packages=", options.packages]))
 
   # First setup the vm isolate and regular isolate snapshot output filename.
-  script_args.append(''.join([ "--vm_isolate_snapshot=",
-                               options.vm_output_bin ]))
-  script_args.append(''.join([ "--isolate_snapshot=", options.output_bin ]))
-
-  # Setup the instuctions snapshot output filename
-  if options.instructions_bin:
-    script_args.append(''.join([ "--instructions_snapshot=",
-                                 options.instructions_bin ]))
+  script_args.append(''.join([ "--vm_snapshot_data=", options.vm_output_bin ]))
+  script_args.append(''.join([ "--isolate_snapshot_data=", options.output_bin ]))
 
   # Specify the embedder entry points snapshot
   if options.embedder_entry_points_manifest:
diff --git a/runtime/tools/gyp/runtime-configurations.gypi b/runtime/tools/gyp/runtime-configurations.gypi
index 95168b0..2de3bf9 100644
--- a/runtime/tools/gyp/runtime-configurations.gypi
+++ b/runtime/tools/gyp/runtime-configurations.gypi
@@ -11,6 +11,7 @@
     'dart_io_secure_socket%': 1,
     'asan%': 0,
     'msan%': 0,
+    'tsan%': 0,
     # Intel VTune related variables.
     'dart_vtune_support%': 0,
     'conditions': [
diff --git a/runtime/tools/kernel-service.dart b/runtime/tools/kernel-service.dart
new file mode 100644
index 0000000..f473c15
--- /dev/null
+++ b/runtime/tools/kernel-service.dart
@@ -0,0 +1,95 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This is an interface to the Dart Kernel parser and Kernel binary generator.
+// It is used by the kernel-isolate to load Dart source code and generate
+// Kernel binary format.
+
+import 'dart:isolate';
+import 'dart:async';
+import 'dart:io';
+import 'dart:typed_data';
+
+import 'package:kernel/binary/ast_to_binary.dart';
+import 'package:kernel/analyzer/loader.dart';
+import 'package:kernel/kernel.dart';
+import 'package:kernel/target/targets.dart';
+
+const verbose = false;
+
+class DataSink implements Sink<List<int>> {
+  final BytesBuilder builder = new BytesBuilder();
+
+  void add(List<int> data) {
+    builder.add(data);
+  }
+
+  void close() {
+    // Nothing to do.
+  }
+}
+
+Future<Uint8List> parseScript(
+    Uri fileName, String packageConfig, String sdkPath) async {
+  if (!FileSystemEntity.isFileSync(fileName.path)) {
+    throw "Input file '${fileName.path}' does not exist.";
+  }
+
+  if (!FileSystemEntity.isDirectorySync(sdkPath)) {
+    throw "Patched sdk directory not found at $sdkPath";
+  }
+
+  Target target = getTarget("vm", new TargetFlags(strongMode: false));
+  DartOptions dartOptions = new DartOptions(
+      strongMode: false,
+      strongModeSdk: false,
+      sdk: sdkPath,
+      packagePath: packageConfig,
+      customUriMappings: const {},
+      declaredVariables: const {});
+  DartLoader loader =
+      await new DartLoaderBatch().getLoader(new Repository(), dartOptions);
+  var program = loader.loadProgram(fileName, target: target);
+
+  var errors = loader.errors;
+  if (errors.isNotEmpty) {
+    throw loader.errors.first;
+  }
+
+  // Link program into one file, cf. --link option in dartk.
+  target.transformProgram(program);
+
+  // Write the program to a list of bytes and return it.
+  var sink = new DataSink();
+  new BinaryPrinter(sink).writeProgramFile(program);
+  return sink.builder.takeBytes();
+}
+
+Future _processLoadRequest(request) async {
+  if (verbose) {
+    print("FROM DART KERNEL: load request: $request");
+    print("FROM DART KERNEL: package: ${Platform.packageConfig}");
+    print("FROM DART KERNEL: exec: ${Platform.resolvedExecutable}");
+  }
+
+  int tag = request[0];
+  SendPort port = request[1];
+  String inputFileUrl = request[2];
+  Uri scriptUri = Uri.parse(inputFileUrl);
+  Uri packagesUri = Uri.parse(Platform.packageConfig ?? ".packages");
+  Uri patchedSdk =
+      Uri.parse(Platform.resolvedExecutable).resolve("patched_sdk");
+
+  var result;
+  try {
+    result = await parseScript(scriptUri, packagesUri.path, patchedSdk.path);
+  } catch (error) {
+    tag = -tag; // Mark reply as an exception.
+    result = error.toString();
+  }
+
+  port.send([tag, inputFileUrl, inputFileUrl, null, result]);
+}
+
+main() => new RawReceivePort()..handler = _processLoadRequest;
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index 9bbc3a4..5683aee 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -5,6 +5,7 @@
 import("../../build/executable_suffix.gni")
 import("../../build/prebuilt_dart_sdk.gni")
 import("gypi_contents.gni")
+import("../runtime_args.gni")
 
 config("libdart_vm_config") {
   if (defined(is_fuchsia) && is_fuchsia) {
@@ -344,10 +345,12 @@
     ],
     [
       "typed_data",
+      processed_gypis.typed_data_sdk_sources,
+      "../../sdk/lib/typed_data",
+      "typed_data",
+      true,
       processed_gypis.typed_data_runtime_sources,
       "../lib",
-      "typed_data",
-      false,
     ],
     [
       "_vmservice",
@@ -378,154 +381,159 @@
   }
 }
 
-if (!defined(is_fuchsia) || !is_fuchsia) {
-  template("generate_patched_sdk") {
-    assert(defined(invoker.libraries), "Need libraries in $target_name")
+template("generate_patched_sdk") {
+  assert(defined(invoker.libraries), "Need libraries in $target_name")
 
-    concatenation_target_names = []
-    concatenation_files = []
+  concatenation_target_names = []
+  concatenation_files = []
 
-    # Concatenate vm library patches.
-    foreach(library, invoker.libraries) {
-      name = library[0]
+  # Concatenate vm library patches.
+  foreach(library, invoker.libraries) {
+    name = library[0]
 
-      target_output = "$target_gen_dir/patches/${name}_patch.dart"
-      concatenate_patch("concatenate_${name}_patch") {
-        libsources = rebase_path(library[1], ".", library[2])
-        output = target_output
-      }
-      concatenation_target_names += [ ":concatenate_${name}_patch" ]
-      concatenation_files += [ target_output ]
+    target_output = "$target_gen_dir/patches/${name}_patch.dart"
+    concatenate_patch("concatenate_${name}_patch") {
+      libsources = rebase_path(library[1], ".", library[2])
+      output = target_output
     }
-
-    # Build the patched sdk out of the concatenated patches and the special
-    # libraries.
-    action(target_name) {
-      deps = concatenation_target_names
-      if (!prebuilt_dart_exe_works) {
-        deps += [ "../bin:dart_bootstrap($host_toolchain)" ]
-      }
-
-      patches_dir = "$target_gen_dir/patches"
-      patched_sdk_dir = "$root_out_dir/patched_sdk"
-
-      script = "../../tools/patch_sdk.py"
-
-      # We list all files which make up the sdk (modulo patches) and get them back
-      # as a GN list object.
-      shared_sdk_sources = exec_script("../../tools/list_dart_files.py",
-                                       [ "../../sdk/lib" ],
-                                       "list lines")
-
-      # We list the `patch_sdk.dart` tool here because the [script] (which is
-      # implicitly an input) will call it.
-      inputs = [
-        "../../tools/patch_sdk.dart",
-      ]
-
-      # Files below are not patches, they will not be in [concatenation_files] but
-      # the `patch_sdk.dart` script will copy them into the patched sdk.
-      inputs += [
-        "../lib/typed_data.dart",
-        "../bin/builtin.dart",
-        "../bin/vmservice/vmservice_io.dart",
-        "../bin/vmservice/loader.dart",
-        "../bin/vmservice/server.dart",
-      ]
-
-      # Add all the normal sdk sources.
-      inputs += shared_sdk_sources
-
-      # Add all the concatenated patch files.
-      inputs += concatenation_files
-
-      outputs = [
-        # Instead of listing all outputs we list a single well-known one.
-        "${patched_sdk_dir}/lib/core/core.dart",
-      ]
-
-      args = []
-      if (!prebuilt_dart_exe_works) {
-        dart_out_dir = get_label_info("../bin:dart_bootstrap($host_toolchain)",
-                                      "root_out_dir")
-        dart_bootstrap =
-            rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
-        args += [
-          "--dart-executable",
-          dart_bootstrap,
-        ]
-      }
-      args += [
-        "vm",
-        rebase_path("../../sdk"),
-        rebase_path(patches_dir, root_build_dir),
-        rebase_path(patched_sdk_dir, root_build_dir),
-      ]
-    }
+    concatenation_target_names += [ ":concatenate_${name}_patch" ]
+    concatenation_files += [ target_output ]
   }
 
-  generate_patched_sdk("patched_sdk") {
-    libraries = [
-      [
-        "async",
-        processed_gypis.async_runtime_sources,
-        "../lib",
-      ],
-      [
-        "collection",
-        processed_gypis.collection_runtime_sources,
-        "../lib",
-      ],
-      [
-        "convert",
-        processed_gypis.convert_runtime_sources,
-        "../lib",
-      ],
-      [
-        "core",
-        processed_gypis.core_runtime_sources,
-        "../lib",
-      ],
-      [
-        "developer",
-        processed_gypis.developer_runtime_sources,
-        "../lib",
-      ],
-      [
-        "internal",
-        processed_gypis.internal_runtime_sources,
-        "../lib",
-      ],
-      [
-        "isolate",
-        processed_gypis.isolate_runtime_sources,
-        "../lib",
-      ],
-      [
-        "math",
-        processed_gypis.math_runtime_sources,
-        "../lib",
-      ],
-      [
-        "mirrors",
-        processed_gypis.mirrors_runtime_sources,
-        "../lib",
-      ],
-      [
-        "profiler",
-        processed_gypis.profiler_runtime_sources,
-        "../lib",
-      ],
-      [
-        "vmservice",
-        processed_gypis.vmservice_runtime_sources,
-        "../lib",
-      ],
-      [
-        "io",
-        processed_gypis.bin_io_sources,
-        "../bin",
-      ],
+  # Build the patched sdk out of the concatenated patches and the special
+  # libraries.
+  action(target_name) {
+    deps = concatenation_target_names
+    if (!prebuilt_dart_exe_works) {
+      deps += [ "../bin:dart_bootstrap($host_toolchain)" ]
+    }
+
+    patches_dir = "$target_gen_dir/patches"
+    patched_sdk_dir = "$root_out_dir/patched_sdk"
+
+    script = "../../tools/patch_sdk.py"
+
+    # We list all files which make up the sdk (modulo patches) and get them
+    # back as a GN list object.
+    shared_sdk_sources = exec_script("../../tools/list_dart_files.py",
+                                     [
+                                       "absolute",
+                                       rebase_path("../../sdk/lib"),
+                                     ],
+                                     "list lines")
+
+    # We list the `patch_sdk.dart` tool here because the [script] (which is
+    # implicitly an input) will call it.
+    inputs = [
+      "../../tools/patch_sdk.dart",
+    ]
+
+    # Files below are not patches, they will not be in [concatenation_files]
+    # but the `patch_sdk.dart` script will copy them into the patched sdk.
+    inputs += [
+      "../bin/builtin.dart",
+      "../bin/vmservice/vmservice_io.dart",
+      "../bin/vmservice/loader.dart",
+      "../bin/vmservice/server.dart",
+    ]
+
+    # Add all the normal sdk sources.
+    inputs += shared_sdk_sources
+
+    # Add all the concatenated patch files.
+    inputs += concatenation_files
+
+    outputs = [
+      # Instead of listing all outputs we list a single well-known one.
+      "${patched_sdk_dir}/lib/core/core.dart",
+    ]
+
+    args = [ "--quiet" ]
+    if (!prebuilt_dart_exe_works) {
+      dart_out_dir = get_label_info("../bin:dart_bootstrap($host_toolchain)",
+                                    "root_out_dir")
+      dart_bootstrap =
+          rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
+      args += [
+        "--dart-executable",
+        dart_bootstrap,
+      ]
+    }
+    args += [
+      "vm",
+      rebase_path("../../sdk"),
+      rebase_path(patches_dir, root_build_dir),
+      rebase_path(patched_sdk_dir, root_build_dir),
     ]
   }
 }
+
+generate_patched_sdk("patched_sdk") {
+  libraries = [
+    [
+      "async",
+      processed_gypis.async_runtime_sources,
+      "../lib",
+    ],
+    [
+      "collection",
+      processed_gypis.collection_runtime_sources,
+      "../lib",
+    ],
+    [
+      "convert",
+      processed_gypis.convert_runtime_sources,
+      "../lib",
+    ],
+    [
+      "core",
+      processed_gypis.core_runtime_sources,
+      "../lib",
+    ],
+    [
+      "developer",
+      processed_gypis.developer_runtime_sources,
+      "../lib",
+    ],
+    [
+      "internal",
+      processed_gypis.internal_runtime_sources,
+      "../lib",
+    ],
+    [
+      "isolate",
+      processed_gypis.isolate_runtime_sources,
+      "../lib",
+    ],
+    [
+      "math",
+      processed_gypis.math_runtime_sources,
+      "../lib",
+    ],
+    [
+      "mirrors",
+      processed_gypis.mirrors_runtime_sources,
+      "../lib",
+    ],
+    [
+      "profiler",
+      processed_gypis.profiler_runtime_sources,
+      "../lib",
+    ],
+    [
+      "typed_data",
+      processed_gypis.typed_data_runtime_sources,
+      "../lib",
+    ],
+    [
+      "vmservice",
+      processed_gypis.vmservice_runtime_sources,
+      "../lib",
+    ],
+    [
+      "io",
+      processed_gypis.bin_io_sources,
+      "../bin",
+    ],
+  ]
+}
diff --git a/runtime/vm/aot_optimizer.cc b/runtime/vm/aot_optimizer.cc
index 0013157..57ff349 100644
--- a/runtime/vm/aot_optimizer.cc
+++ b/runtime/vm/aot_optimizer.cc
@@ -100,32 +100,6 @@
 }
 
 
-void AotOptimizer::PopulateWithICData() {
-  ASSERT(current_iterator_ == NULL);
-  for (BlockIterator block_it = flow_graph_->reverse_postorder_iterator();
-       !block_it.Done(); block_it.Advance()) {
-    ForwardInstructionIterator it(block_it.Current());
-    for (; !it.Done(); it.Advance()) {
-      Instruction* instr = it.Current();
-      if (instr->IsInstanceCall()) {
-        InstanceCallInstr* call = instr->AsInstanceCall();
-        if (!call->HasICData()) {
-          const Array& arguments_descriptor = Array::Handle(
-              zone(), ArgumentsDescriptor::New(call->ArgumentCount(),
-                                               call->argument_names()));
-          const ICData& ic_data = ICData::ZoneHandle(
-              zone(), ICData::New(function(), call->function_name(),
-                                  arguments_descriptor, call->deopt_id(),
-                                  call->checked_argument_count(), false));
-          call->set_ic_data(&ic_data);
-        }
-      }
-    }
-    current_iterator_ = NULL;
-  }
-}
-
-
 bool AotOptimizer::RecognizeRuntimeTypeGetter(InstanceCallInstr* call) {
   if ((precompiler_ == NULL) || !precompiler_->get_runtime_type_is_unique()) {
     return false;
@@ -1361,9 +1335,15 @@
     if (cls.NumTypeArguments() > 0) {
       return Bool::null();
     }
+    // As of Dart 1.5, the Null type is a subtype of (and is more specific than)
+    // any type. However, we are checking instances here and not types. The
+    // null instance is only an instance of Null, Object, and dynamic.
     const bool is_subtype =
-        cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class,
-                        TypeArguments::Handle(Z), NULL, NULL, Heap::kOld);
+        cls.IsNullClass()
+            ? (type_class.IsNullClass() || type_class.IsObjectClass() ||
+               type_class.IsDynamicClass())
+            : cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class,
+                              TypeArguments::Handle(Z), NULL, NULL, Heap::kOld);
     results->Add(cls.id());
     results->Add(is_subtype);
     if (prev.IsNull()) {
@@ -1550,47 +1530,58 @@
     return;
   }
 
-  TypeRangeCache* cache = thread()->type_range_cache();
-  intptr_t lower_limit, upper_limit;
-  if (cache != NULL &&
-      cache->InstanceOfHasClassRange(type, &lower_limit, &upper_limit)) {
-    // left.instanceof(type) =>
-    //     _classRangeCheck(left.cid, lower_limit, upper_limit)
+  if (precompiler_ != NULL) {
+    TypeRangeCache* cache = precompiler_->type_range_cache();
+    intptr_t lower_limit, upper_limit;
+    if (cache != NULL &&
+        cache->InstanceOfHasClassRange(type, &lower_limit, &upper_limit)) {
+      // left.instanceof(type) =>
+      //     _classRangeCheck(left.cid, lower_limit, upper_limit)
 
-    LoadClassIdInstr* left_cid = new (Z) LoadClassIdInstr(new (Z) Value(left));
-    InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
-    ConstantInstr* lower_cid =
-        flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(lower_limit)));
-    ConstantInstr* upper_cid =
-        flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(upper_limit)));
+      LoadClassIdInstr* left_cid =
+          new (Z) LoadClassIdInstr(new (Z) Value(left));
+      InsertBefore(call, left_cid, NULL, FlowGraph::kValue);
+      ConstantInstr* lower_cid =
+          flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(lower_limit)));
+      ConstantInstr* upper_cid =
+          flow_graph()->GetConstant(Smi::Handle(Z, Smi::New(upper_limit)));
 
-    ZoneGrowableArray<PushArgumentInstr*>* args =
-        new (Z) ZoneGrowableArray<PushArgumentInstr*>(3);
-    PushArgumentInstr* arg = new (Z) PushArgumentInstr(new (Z) Value(left_cid));
-    InsertBefore(call, arg, NULL, FlowGraph::kEffect);
-    args->Add(arg);
-    arg = new (Z) PushArgumentInstr(new (Z) Value(lower_cid));
-    InsertBefore(call, arg, NULL, FlowGraph::kEffect);
-    args->Add(arg);
-    arg = new (Z) PushArgumentInstr(new (Z) Value(upper_cid));
-    InsertBefore(call, arg, NULL, FlowGraph::kEffect);
-    args->Add(arg);
+      ZoneGrowableArray<PushArgumentInstr*>* args =
+          new (Z) ZoneGrowableArray<PushArgumentInstr*>(3);
+      PushArgumentInstr* arg =
+          new (Z) PushArgumentInstr(new (Z) Value(left_cid));
+      InsertBefore(call, arg, NULL, FlowGraph::kEffect);
+      args->Add(arg);
+      arg = new (Z) PushArgumentInstr(new (Z) Value(lower_cid));
+      InsertBefore(call, arg, NULL, FlowGraph::kEffect);
+      args->Add(arg);
+      arg = new (Z) PushArgumentInstr(new (Z) Value(upper_cid));
+      InsertBefore(call, arg, NULL, FlowGraph::kEffect);
+      args->Add(arg);
 
-    const Library& dart_internal =
-        Library::Handle(Z, Library::InternalLibrary());
-    const String& target_name = negate ? Symbols::_classRangeCheckNegative()
-                                       : Symbols::_classRangeCheck();
-    const Function& target = Function::ZoneHandle(
-        Z, dart_internal.LookupFunctionAllowPrivate(target_name));
-    ASSERT(!target.IsNull());
-    ASSERT(target.IsRecognized() && target.always_inline());
+      const Library& dart_internal =
+          Library::Handle(Z, Library::InternalLibrary());
+      const String& target_name = negate ? Symbols::_classRangeCheckNegative()
+                                         : Symbols::_classRangeCheck();
+      const Function& target = Function::ZoneHandle(
+          Z, dart_internal.LookupFunctionAllowPrivate(target_name));
+      ASSERT(!target.IsNull());
+      ASSERT(target.IsRecognized() && target.always_inline());
 
-    StaticCallInstr* new_call =
-        new (Z) StaticCallInstr(call->token_pos(), target,
-                                Object::null_array(),  // argument_names
-                                args, call->deopt_id());
-    ReplaceCall(call, new_call);
-    return;
+      StaticCallInstr* new_call =
+          new (Z) StaticCallInstr(call->token_pos(), target,
+                                  Object::null_array(),  // argument_names
+                                  args, call->deopt_id());
+      Environment* copy = call->env()->DeepCopy(
+          Z, call->env()->Length() - call->ArgumentCount());
+      for (intptr_t i = 0; i < args->length(); ++i) {
+        copy->PushValue(new (Z) Value((*args)[i]->value()->definition()));
+      }
+      call->RemoveEnvironment();
+      ReplaceCall(call, new_call);
+      copy->DeepCopyTo(Z, new_call);
+      return;
+    }
   }
 
   const ICData& unary_checks =
diff --git a/runtime/vm/aot_optimizer.h b/runtime/vm/aot_optimizer.h
index 16e879e..2b8938d 100644
--- a/runtime/vm/aot_optimizer.h
+++ b/runtime/vm/aot_optimizer.h
@@ -28,10 +28,6 @@
 
   FlowGraph* flow_graph() const { return flow_graph_; }
 
-  // Add ICData to InstanceCalls, so that optimizations can be run on them.
-  // TODO(srdjan): StaticCals as well?
-  void PopulateWithICData();
-
   // Use ICData to optimize, replace or eliminate instructions.
   void ApplyICData();
 
diff --git a/runtime/vm/assembler.cc b/runtime/vm/assembler.cc
index 4edcedd..77d61b0 100644
--- a/runtime/vm/assembler.cc
+++ b/runtime/vm/assembler.cc
@@ -319,10 +319,10 @@
     return Object::empty_object_pool().raw();
   }
   const ObjectPool& result = ObjectPool::Handle(ObjectPool::New(len));
-  const TypedData& info_array = TypedData::Handle(result.info_array());
+  ObjectPoolInfo pool_info(result);
   for (intptr_t i = 0; i < len; ++i) {
     ObjectPool::EntryType info = object_pool_[i].type_;
-    info_array.SetInt8(i, static_cast<int8_t>(info));
+    pool_info.SetInfoAt(i, info);
     if (info == ObjectPool::kTaggedObject) {
       result.SetObjectAt(i, *object_pool_[i].obj_);
     } else {
diff --git a/runtime/vm/assembler_arm64.cc b/runtime/vm/assembler_arm64.cc
index 8f3dc14..1b98387 100644
--- a/runtime/vm/assembler_arm64.cc
+++ b/runtime/vm/assembler_arm64.cc
@@ -181,7 +181,7 @@
 
 static int CountOneBits(uint64_t value, int width) {
   // Mask out unused bits to ensure that they are not counted.
-  value &= (0xffffffffffffffffUL >> (64 - width));
+  value &= (0xffffffffffffffffULL >> (64 - width));
 
   value = ((value >> 1) & 0x5555555555555555) + (value & 0x5555555555555555);
   value = ((value >> 2) & 0x3333333333333333) + (value & 0x3333333333333333);
@@ -282,7 +282,7 @@
     // 5. If the most-significant half of the bitwise value is equal to the
     //    least-significant half, return to step 2 using the least-significant
     //    half of the value.
-    uint64_t mask = (1UL << (width >> 1)) - 1;
+    uint64_t mask = (1ULL << (width >> 1)) - 1;
     if ((value & mask) == ((value >> (width >> 1)) & mask)) {
       width >>= 1;
       set_bits >>= 1;
diff --git a/runtime/vm/ast.h b/runtime/vm/ast.h
index ef26563..ca75856 100644
--- a/runtime/vm/ast.h
+++ b/runtime/vm/ast.h
@@ -564,14 +564,18 @@
 class PrimaryNode : public AstNode {
  public:
   PrimaryNode(TokenPosition token_pos, const Object& primary)
-      : AstNode(token_pos), primary_(primary), is_deferred_reference_(false) {
+      : AstNode(token_pos), primary_(primary), prefix_(NULL) {
     ASSERT(primary_.IsNotTemporaryScopedHandle());
   }
 
   const Object& primary() const { return primary_; }
 
-  void set_is_deferred(bool value) { is_deferred_reference_ = value; }
-  bool is_deferred_reference() const { return is_deferred_reference_; }
+  void set_prefix(const LibraryPrefix* prefix) {
+    ASSERT(prefix->IsNotTemporaryScopedHandle());
+    prefix_ = prefix;
+  }
+  const LibraryPrefix* prefix() const { return prefix_; }
+  bool is_deferred_reference() const { return prefix_ != NULL; }
 
   bool IsSuper() const {
     return primary().IsString() && (primary().raw() == Symbols::Super().raw());
@@ -583,7 +587,7 @@
 
  private:
   const Object& primary_;
-  bool is_deferred_reference_;
+  const LibraryPrefix* prefix_;
 
   DISALLOW_IMPLICIT_CONSTRUCTORS(PrimaryNode);
 };
diff --git a/runtime/vm/ast_transformer.cc b/runtime/vm/ast_transformer.cc
index 974259e..fa1028d 100644
--- a/runtime/vm/ast_transformer.cc
+++ b/runtime/vm/ast_transformer.cc
@@ -207,8 +207,8 @@
       new (Z) LoadLocalNode(token_pos, stack_trace_param);
   SequenceNode* error_ne_null_branch =
       new (Z) SequenceNode(token_pos, ChainNewScope(preamble_->scope()));
-  error_ne_null_branch->Add(
-      new (Z) ThrowNode(token_pos, load_error_param, load_stack_trace_param));
+  error_ne_null_branch->Add(new (Z) ThrowNode(
+      node->token_pos(), load_error_param, load_stack_trace_param));
   preamble_->Add(new (Z) IfNode(
       token_pos, new (Z) ComparisonNode(
                      token_pos, Token::kNE, load_error_param,
diff --git a/runtime/vm/benchmark_test.cc b/runtime/vm/benchmark_test.cc
index db3bfc4..83cd23f 100644
--- a/runtime/vm/benchmark_test.cc
+++ b/runtime/vm/benchmark_test.cc
@@ -95,10 +95,11 @@
 }
 
 
-Dart_Isolate Benchmark::CreateIsolate(const uint8_t* buffer) {
-  bin::IsolateData* isolate_data = new bin::IsolateData(NULL, NULL, NULL);
+Dart_Isolate Benchmark::CreateIsolate(const uint8_t* snapshot_data,
+                                      const uint8_t* snapshot_instructions) {
   char* err = NULL;
-  isolate_ = Dart_CreateIsolate(NULL, NULL, buffer, NULL, isolate_data, &err);
+  isolate_ = Dart_CreateIsolate(NULL, NULL, snapshot_data,
+                                snapshot_instructions, NULL, NULL, &err);
   EXPECT(isolate_ != NULL);
   free(err);
   return isolate_;
@@ -492,6 +493,11 @@
 }
 
 
+static void malloc_deallocator(uint8_t* ptr) {
+  free(ptr);
+}
+
+
 BENCHMARK_SIZE(CoreSnapshotSize) {
   const char* kScriptChars =
       "import 'dart:async';\n"
@@ -505,21 +511,25 @@
       "\n";
 
   // Start an Isolate, load a script and create a full snapshot.
-  uint8_t* vm_isolate_snapshot_buffer;
-  uint8_t* isolate_snapshot_buffer;
+  uint8_t* vm_snapshot_data_buffer;
+  uint8_t* isolate_snapshot_data_buffer;
   // Need to load the script into the dart: core library due to
   // the import of dart:_internal.
   TestCase::LoadCoreTestScript(kScriptChars, NULL);
   Api::CheckAndFinalizePendingClasses(thread);
 
   // Write snapshot with object content.
-  FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer,
-                            &isolate_snapshot_buffer, &malloc_allocator,
-                            NULL /* instructions_writer */);
+  FullSnapshotWriter writer(Snapshot::kCore, &vm_snapshot_data_buffer,
+                            &isolate_snapshot_data_buffer, &malloc_allocator,
+                            NULL, NULL /* image_writer */);
   writer.WriteFullSnapshot();
-  const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
+  const Snapshot* snapshot =
+      Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer);
   ASSERT(snapshot->kind() == Snapshot::kCore);
   benchmark->set_score(snapshot->length());
+
+  free(vm_snapshot_data_buffer);
+  free(isolate_snapshot_data_buffer);
 }
 
 
@@ -539,21 +549,25 @@
       "\n";
 
   // Start an Isolate, load a script and create a full snapshot.
-  uint8_t* vm_isolate_snapshot_buffer;
-  uint8_t* isolate_snapshot_buffer;
+  uint8_t* vm_snapshot_data_buffer;
+  uint8_t* isolate_snapshot_data_buffer;
   // Need to load the script into the dart: core library due to
   // the import of dart:_internal.
   TestCase::LoadCoreTestScript(kScriptChars, NULL);
   Api::CheckAndFinalizePendingClasses(thread);
 
   // Write snapshot with object content.
-  FullSnapshotWriter writer(Snapshot::kCore, &vm_isolate_snapshot_buffer,
-                            &isolate_snapshot_buffer, &malloc_allocator,
-                            NULL /* instructions_writer */);
+  FullSnapshotWriter writer(Snapshot::kCore, &vm_snapshot_data_buffer,
+                            &isolate_snapshot_data_buffer, &malloc_allocator,
+                            NULL, NULL /* image_writer */);
   writer.WriteFullSnapshot();
-  const Snapshot* snapshot = Snapshot::SetupFromBuffer(isolate_snapshot_buffer);
+  const Snapshot* snapshot =
+      Snapshot::SetupFromBuffer(isolate_snapshot_data_buffer);
   ASSERT(snapshot->kind() == Snapshot::kCore);
   benchmark->set_score(snapshot->length());
+
+  free(vm_snapshot_data_buffer);
+  free(isolate_snapshot_data_buffer);
 }
 
 
@@ -602,6 +616,7 @@
                                   intptr_t new_size) {
   return message_buffer;
 }
+static void message_deallocator(uint8_t* ptr) {}
 
 
 BENCHMARK(SerializeNull) {
@@ -612,7 +627,8 @@
   timer.Start();
   for (intptr_t i = 0; i < kLoopCount; i++) {
     StackZone zone(thread);
-    MessageWriter writer(&buffer, &message_allocator, true);
+    MessageWriter writer(&buffer, &message_allocator, &message_deallocator,
+                         true);
     writer.WriteMessage(null_object);
     intptr_t buffer_len = writer.BytesWritten();
 
@@ -634,7 +650,8 @@
   timer.Start();
   for (intptr_t i = 0; i < kLoopCount; i++) {
     StackZone zone(thread);
-    MessageWriter writer(&buffer, &message_allocator, true);
+    MessageWriter writer(&buffer, &message_allocator, &message_deallocator,
+                         true);
     writer.WriteMessage(smi_object);
     intptr_t buffer_len = writer.BytesWritten();
 
@@ -659,7 +676,7 @@
   timer.Start();
   for (intptr_t i = 0; i < kLoopCount; i++) {
     StackZone zone(thread);
-    MessageWriter writer(&buffer, &malloc_allocator, true);
+    MessageWriter writer(&buffer, &malloc_allocator, &malloc_deallocator, true);
     writer.WriteMessage(array_object);
     intptr_t buffer_len = writer.BytesWritten();
 
@@ -693,7 +710,7 @@
   timer.Start();
   for (intptr_t i = 0; i < kLoopCount; i++) {
     StackZone zone(thread);
-    MessageWriter writer(&buffer, &malloc_allocator, true);
+    MessageWriter writer(&buffer, &malloc_allocator, &malloc_deallocator, true);
     writer.WriteMessage(map);
     intptr_t buffer_len = writer.BytesWritten();
 
diff --git a/runtime/vm/benchmark_test.h b/runtime/vm/benchmark_test.h
index b51c64c..edc9bfc 100644
--- a/runtime/vm/benchmark_test.h
+++ b/runtime/vm/benchmark_test.h
@@ -20,13 +20,11 @@
 DECLARE_FLAG(int, old_gen_growth_space_ratio);
 
 namespace bin {
-// vm_isolate_snapshot_buffer points to a snapshot for the vm isolate if we
-// link in a snapshot otherwise it is initialized to NULL.
-extern const uint8_t* vm_isolate_snapshot_buffer;
-
-// isolate_snapshot_buffer points to a snapshot for an isolate if we link in a
-// snapshot otherwise it is initialized to NULL.
-extern const uint8_t* isolate_snapshot_buffer;
+// Snapshot pieces if we link in a snapshot, otherwise initialized to NULL.
+extern const uint8_t* vm_snapshot_data;
+extern const uint8_t* vm_snapshot_instructions;
+extern const uint8_t* core_isolate_snapshot_data;
+extern const uint8_t* core_isolate_snapshot_instructions;
 }
 
 // The BENCHMARK macros are used for benchmarking a specific functionality
@@ -82,7 +80,8 @@
   int64_t score() const { return score_; }
   Isolate* isolate() const { return reinterpret_cast<Isolate*>(isolate_); }
 
-  Dart_Isolate CreateIsolate(const uint8_t* buffer);
+  Dart_Isolate CreateIsolate(const uint8_t* snapshot_data,
+                             const uint8_t* snapshot_instructions);
 
   void Run() { (*run_)(this); }
   void RunBenchmark();
@@ -110,7 +109,8 @@
 class BenchmarkIsolateScope {
  public:
   explicit BenchmarkIsolateScope(Benchmark* benchmark) : benchmark_(benchmark) {
-    benchmark_->CreateIsolate(bin::isolate_snapshot_buffer);
+    benchmark_->CreateIsolate(bin::core_isolate_snapshot_data,
+                              bin::core_isolate_snapshot_instructions);
     Dart_EnterScope();  // Create a Dart API scope for unit benchmarks.
   }
   ~BenchmarkIsolateScope() {
diff --git a/runtime/vm/bitmap.h b/runtime/vm/bitmap.h
index 657bd24..289f481 100644
--- a/runtime/vm/bitmap.h
+++ b/runtime/vm/bitmap.h
@@ -12,8 +12,8 @@
 namespace dart {
 
 // Forward declarations.
-class RawStackmap;
-class Stackmap;
+class RawStackMap;
+class StackMap;
 
 
 // BitmapBuilder is used to build a bitmap. The implementation is optimized
diff --git a/runtime/vm/bitmap_test.cc b/runtime/vm/bitmap_test.cc
index f3ec123..95fcd68 100644
--- a/runtime/vm/bitmap_test.cc
+++ b/runtime/vm/bitmap_test.cc
@@ -36,8 +36,8 @@
     EXPECT_EQ(value, builder1->Get(i));
     value = !value;
   }
-  // Create a Stackmap object from the builder and verify its contents.
-  const Stackmap& stackmap1 = Stackmap::Handle(Stackmap::New(0, builder1, 0));
+  // Create a StackMap object from the builder and verify its contents.
+  const StackMap& stackmap1 = StackMap::Handle(StackMap::New(0, builder1, 0));
   EXPECT_EQ(1024, stackmap1.Length());
   OS::Print("%s\n", stackmap1.ToCString());
   value = true;
@@ -62,7 +62,7 @@
   for (int32_t i = 1025; i <= 2048; i++) {
     EXPECT(!builder1->Get(i));
   }
-  const Stackmap& stackmap2 = Stackmap::Handle(Stackmap::New(0, builder1, 0));
+  const StackMap& stackmap2 = StackMap::Handle(StackMap::New(0, builder1, 0));
   EXPECT_EQ(2049, stackmap2.Length());
   for (int32_t i = 0; i <= 256; i++) {
     EXPECT(!stackmap2.IsObject(i));
diff --git a/runtime/vm/bootstrap.cc b/runtime/vm/bootstrap.cc
index 0dc6e7c..8ef219d 100644
--- a/runtime/vm/bootstrap.cc
+++ b/runtime/vm/bootstrap.cc
@@ -44,7 +44,6 @@
 
 
 const char** Bootstrap::profiler_patch_paths_ = NULL;
-const char** Bootstrap::typed_data_patch_paths_ = NULL;
 
 
 #define MAKE_PROPERTIES(CamelName, name)                                       \
diff --git a/runtime/vm/bootstrap.h b/runtime/vm/bootstrap.h
index 15f454b..0c271b3 100644
--- a/runtime/vm/bootstrap.h
+++ b/runtime/vm/bootstrap.h
@@ -55,11 +55,11 @@
   static const char* isolate_patch_paths_[];
   static const char* math_patch_paths_[];
   static const char* mirrors_patch_paths_[];
+  static const char* typed_data_patch_paths_[];
   static const char* _vmservice_patch_paths_[];
 
   // NULL patch paths for libraries that do not have patch files.
   static const char** profiler_patch_paths_;
-  static const char** typed_data_patch_paths_;
 };
 
 }  // namespace dart
diff --git a/runtime/vm/bootstrap_natives.cc b/runtime/vm/bootstrap_natives.cc
index ef4b92f..b6d5f2a 100644
--- a/runtime/vm/bootstrap_natives.cc
+++ b/runtime/vm/bootstrap_natives.cc
@@ -27,9 +27,9 @@
   Dart_NativeFunction function_;
   int argument_count_;
 } BootStrapEntries[] = {BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY)
-#ifndef PRODUCT
+#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
                             MIRRORS_BOOTSTRAP_NATIVE_LIST(REGISTER_NATIVE_ENTRY)
-#endif  // !PRODUCT
+#endif  // !PRODUCT && !DART_PRECOMPILED_RUNTIME
 };
 
 
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index 2086186..89a1076 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -159,7 +159,7 @@
   V(DateTime_timeZoneName, 1)                                                  \
   V(DateTime_timeZoneOffsetInSeconds, 1)                                       \
   V(DateTime_localTimeZoneAdjustmentInSeconds, 0)                              \
-  V(AssertionError_throwNew, 2)                                                \
+  V(AssertionError_throwNew, 3)                                                \
   V(Async_rethrow, 2)                                                          \
   V(StackTrace_current, 0)                                                     \
   V(TypeError_throwNew, 5)                                                     \
@@ -366,6 +366,7 @@
   V(Mirrors_evalInLibraryWithPrivateKey, 2)                                    \
   V(Mirrors_makeLocalClassMirror, 1)                                           \
   V(Mirrors_makeLocalTypeMirror, 1)                                            \
+  V(Mirrors_instantiateGenericType, 2)                                         \
   V(Mirrors_mangleName, 2)                                                     \
   V(MirrorReference_equals, 2)                                                 \
   V(MirrorSystem_libraries, 0)                                                 \
@@ -425,7 +426,7 @@
   static void DN_##name(Dart_NativeArguments args);
 
   BOOTSTRAP_NATIVE_LIST(DECLARE_BOOTSTRAP_NATIVE)
-#ifndef PRODUCT
+#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
   MIRRORS_BOOTSTRAP_NATIVE_LIST(DECLARE_BOOTSTRAP_NATIVE)
 #endif
 
diff --git a/runtime/vm/branch_optimizer.cc b/runtime/vm/branch_optimizer.cc
index 62fdb47..f68bbca 100644
--- a/runtime/vm/branch_optimizer.cc
+++ b/runtime/vm/branch_optimizer.cc
@@ -83,7 +83,6 @@
   ComparisonInstr* new_comparison =
       comparison->CopyWithNewOperands(new_left, new_right);
   BranchInstr* new_branch = new (zone) BranchInstr(new_comparison);
-  new_branch->set_is_checked(branch->is_checked());
   return new_branch;
 }
 
diff --git a/runtime/vm/class_finalizer.cc b/runtime/vm/class_finalizer.cc
index f13d562..c319f1f 100644
--- a/runtime/vm/class_finalizer.cc
+++ b/runtime/vm/class_finalizer.cc
@@ -516,6 +516,13 @@
   }
   ASSERT(!type_class.IsTypedefClass() ||
          (type.signature() != Function::null()));
+
+  // Replace FutureOr<T> type of async library with dynamic.
+  if ((type_class.library() == Library::AsyncLibrary()) &&
+      (type_class.Name() == Symbols::FutureOr().raw())) {
+    Type::Cast(type).set_type_class(Class::Handle(Object::dynamic_class()));
+    type.set_arguments(Object::null_type_arguments());
+  }
 }
 
 
@@ -549,11 +556,34 @@
   // Resolve signature if function type.
   if (type.IsFunctionType()) {
     const Function& signature = Function::Handle(Type::Cast(type).signature());
-    const Class& scope_class = Class::Handle(type.type_class());
-    if (scope_class.IsTypedefClass()) {
-      ResolveSignature(scope_class, signature);
+    Type& signature_type = Type::Handle(signature.SignatureType());
+    if (signature_type.raw() != type.raw()) {
+      ResolveType(cls, signature_type);
     } else {
-      ResolveSignature(cls, signature);
+      const Class& scope_class = Class::Handle(type.type_class());
+      if (scope_class.IsTypedefClass()) {
+        ResolveSignature(scope_class, signature);
+      } else {
+        ResolveSignature(cls, signature);
+      }
+      if (signature.IsSignatureFunction()) {
+        // Drop fields that are not necessary anymore after resolution.
+        // The parent function, owner, and token position of a shared
+        // canonical function type are meaningless, since the canonical
+        // representent is picked arbitrarily.
+        signature.set_parent_function(Function::Handle());
+        // TODO(regis): As long as we support metadata in typedef signatures,
+        // we cannot reset these fields used to reparse a typedef.
+        // Note that the scope class of a typedef function type is always
+        // preserved as the typedef class (not reset to _Closure class), thereby
+        // preventing sharing of canonical function types between typedefs.
+        // Not being shared, these fields are therefore always meaningful for
+        // typedefs.
+        if (!scope_class.IsTypedefClass()) {
+          signature.set_owner(Object::Handle());
+          signature.set_token_pos(TokenPosition::kNoSource);
+        }
+      }
     }
   }
 }
@@ -1475,15 +1505,18 @@
       }
     }
   }
-  // Collect interfaces, super interfaces, and super classes of this class.
+  // If we check for bad overrides, collect interfaces, super interfaces, and
+  // super classes of this class.
   GrowableArray<const Class*> interfaces(zone, 4);
-  CollectInterfaces(cls, &interfaces);
-  // Include superclasses in list of interfaces and super interfaces.
-  super_class = cls.SuperClass();
-  while (!super_class.IsNull()) {
-    interfaces.Add(&Class::ZoneHandle(zone, super_class.raw()));
-    CollectInterfaces(super_class, &interfaces);
-    super_class = super_class.SuperClass();
+  if (Isolate::Current()->error_on_bad_override()) {
+    CollectInterfaces(cls, &interfaces);
+    // Include superclasses in list of interfaces and super interfaces.
+    super_class = cls.SuperClass();
+    while (!super_class.IsNull()) {
+      interfaces.Add(&Class::ZoneHandle(zone, super_class.raw()));
+      CollectInterfaces(super_class, &interfaces);
+      super_class = super_class.SuperClass();
+    }
   }
   // Resolve function signatures and check for conflicts in super classes and
   // interfaces.
@@ -1501,22 +1534,22 @@
         !function.IsGenerativeConstructor()) {
       // A constructor cannot override anything.
       for (intptr_t i = 0; i < interfaces.length(); i++) {
-        const Class* super_class = interfaces.At(i);
-        // Finalize superclass since overrides check relies on all members
-        // of the superclass to be finalized.
-        FinalizeClass(*super_class);
-        overridden_function = super_class->LookupDynamicFunction(name);
+        const Class* interface = interfaces.At(i);
+        // All interfaces should have been finalized since override checks
+        // rely on all interface members to be finalized.
+        ASSERT(interface->is_finalized());
+        overridden_function = interface->LookupDynamicFunction(name);
         if (!overridden_function.IsNull() &&
             !function.HasCompatibleParametersWith(overridden_function,
                                                   &error)) {
           const String& class_name = String::Handle(zone, cls.Name());
-          const String& super_cls_name =
-              String::Handle(zone, super_class->Name());
+          const String& interface_name =
+              String::Handle(zone, interface->Name());
           ReportErrors(error, cls, function.token_pos(),
-                       "class '%s' overrides method '%s' of super "
-                       "class '%s' with incompatible parameters",
+                       "class '%s' overrides method '%s' of super class or "
+                       "interface '%s' with incompatible parameters",
                        class_name.ToCString(), name.ToCString(),
-                       super_cls_name.ToCString());
+                       interface_name.ToCString());
         }
       }
     }
@@ -2331,8 +2364,9 @@
     cls.set_mixin(mixin_type);
   }
   if (cls.IsTypedefClass()) {
-    const Function& signature = Function::Handle(cls.signature_function());
+    Function& signature = Function::Handle(cls.signature_function());
     Type& type = Type::Handle(signature.SignatureType());
+    ASSERT(type.signature() == signature.raw());
 
     // Check for illegal self references.
     GrowableArray<intptr_t> visited_aliases;
@@ -2350,7 +2384,12 @@
 
     // Resolve and finalize the signature type of this typedef.
     type ^= FinalizeType(cls, type, kCanonicalizeWellFormed);
+
+    // If a different canonical signature type is returned, update the signature
+    // function of the typedef.
+    signature = type.signature();
     signature.SetSignatureType(type);
+    cls.set_signature_function(signature);
 
     // Closure instances do not refer to this typedef as their class, so there
     // is no need to add this typedef class to the subclasses of _Closure.
@@ -2450,17 +2489,25 @@
     cls.set_is_finalized();
     return;
   }
+  // Ensure super class is finalized.
+  const Class& super = Class::Handle(cls.SuperClass());
+  if (!super.IsNull()) {
+    FinalizeClass(super);
+  }
+  // Ensure interfaces are finalized in case we check for bad overrides.
+  if (Isolate::Current()->error_on_bad_override()) {
+    GrowableArray<const Class*> interfaces(4);
+    CollectInterfaces(cls, &interfaces);
+    for (intptr_t i = 0; i < interfaces.length(); i++) {
+      FinalizeClass(*interfaces.At(i));
+    }
+  }
   if (cls.IsMixinApplication()) {
     // Copy instance methods and fields from the mixin class.
     // This has to happen before the check whether the methods of
     // the class conflict with inherited methods.
     ApplyMixinMembers(cls);
   }
-  // Ensure super class is finalized.
-  const Class& super = Class::Handle(cls.SuperClass());
-  if (!super.IsNull()) {
-    FinalizeClass(super);
-  }
   // Mark as parsed and finalized.
   cls.Finalize();
   // Mixin app alias classes may still lack their forwarding constructor.
@@ -2478,8 +2525,9 @@
     cls.SetFunctions(functions);
   }
   // Every class should have at least a constructor, unless it is a top level
-  // class or a typedef class.
-  ASSERT(cls.IsTopLevel() || cls.IsTypedefClass() ||
+  // class or a typedef class. The Kernel frontend does not create an implicit
+  // constructor for abstract classes.
+  ASSERT(cls.IsTopLevel() || cls.IsTypedefClass() || cls.is_abstract() ||
          (Array::Handle(cls.functions()).Length() > 0));
   // Resolve and finalize all member types.
   ResolveAndFinalizeMemberTypes(cls);
diff --git a/runtime/vm/class_table.cc b/runtime/vm/class_table.cc
index 4ceeb60..0094cd5 100644
--- a/runtime/vm/class_table.cc
+++ b/runtime/vm/class_table.cc
@@ -124,9 +124,11 @@
     // Add the vtable for this predefined class into the static vtable registry
     // if it has not been setup yet.
     cpp_vtable cls_vtable = cls.handle_vtable();
-    AtomicOperations::CompareAndSwapWord(&(Object::builtin_vtables_[index]), 0,
-                                         cls_vtable);
-    ASSERT(Object::builtin_vtables_[index] == cls_vtable);
+    cpp_vtable old_cls_vtable = AtomicOperations::CompareAndSwapWord(
+        &(Object::builtin_vtables_[index]), 0, cls_vtable);
+    if (old_cls_vtable != 0) {
+      ASSERT(old_cls_vtable == cls_vtable);
+    }
   } else {
     if (top_ == capacity_) {
       // Grow the capacity of the class table.
diff --git a/runtime/vm/class_table.h b/runtime/vm/class_table.h
index b1721ed..1edb248 100644
--- a/runtime/vm/class_table.h
+++ b/runtime/vm/class_table.h
@@ -6,6 +6,7 @@
 #define RUNTIME_VM_CLASS_TABLE_H_
 
 #include "platform/assert.h"
+#include "vm/atomic.h"
 #include "vm/bitfield.h"
 #include "vm/globals.h"
 
@@ -36,8 +37,8 @@
   }
 
   void AddNew(T size) {
-    new_count++;
-    new_size += size;
+    AtomicOperations::IncrementBy(&new_count, 1);
+    AtomicOperations::IncrementBy(&new_size, size);
   }
 
   void ResetOld() {
@@ -46,8 +47,8 @@
   }
 
   void AddOld(T size, T count = 1) {
-    old_count += count;
-    old_size += size;
+    AtomicOperations::IncrementBy(&old_count, count);
+    AtomicOperations::IncrementBy(&old_size, size);
   }
 
   void Reset() {
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index e561a54..9929c3d 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -515,9 +515,9 @@
     for (RawObject** p = from; p <= to; p++) {
       s->Push(*p);
     }
-    if (s->kind() == Snapshot::kAppNoJIT) {
+    if (s->kind() == Snapshot::kAppAOT) {
       s->Push(func->ptr()->code_);
-    } else if (s->kind() == Snapshot::kAppWithJIT) {
+    } else if (s->kind() == Snapshot::kAppJIT) {
       NOT_IN_PRECOMPILED(s->Push(func->ptr()->unoptimized_code_));
       s->Push(func->ptr()->code_);
       s->Push(func->ptr()->ic_data_array_);
@@ -544,16 +544,16 @@
       for (RawObject** p = from; p <= to; p++) {
         s->WriteRef(*p);
       }
-      if (kind == Snapshot::kAppNoJIT) {
+      if (kind == Snapshot::kAppAOT) {
         s->WriteRef(func->ptr()->code_);
-      } else if (s->kind() == Snapshot::kAppWithJIT) {
+      } else if (s->kind() == Snapshot::kAppJIT) {
         NOT_IN_PRECOMPILED(s->WriteRef(func->ptr()->unoptimized_code_));
         s->WriteRef(func->ptr()->code_);
         s->WriteRef(func->ptr()->ic_data_array_);
       }
 
 #if !defined(DART_PRECOMPILED_RUNTIME)
-      if (kind != Snapshot::kAppNoJIT) {
+      if (kind != Snapshot::kAppAOT) {
         s->WriteTokenPosition(func->ptr()->token_pos_);
         s->WriteTokenPosition(func->ptr()->end_token_pos_);
       }
@@ -561,7 +561,7 @@
       s->Write<int16_t>(func->ptr()->num_fixed_parameters_);
       s->Write<int16_t>(func->ptr()->num_optional_parameters_);
       s->Write<uint32_t>(func->ptr()->kind_tag_);
-      if (kind == Snapshot::kAppNoJIT) {
+      if (kind == Snapshot::kAppAOT) {
         // Omit fields used to support de/reoptimization.
       } else if (!Snapshot::IncludesCode(kind)) {
 #if !defined(DART_PRECOMPILED_RUNTIME)
@@ -614,9 +614,9 @@
       for (RawObject** p = to_snapshot + 1; p <= to; p++) {
         *p = Object::null();
       }
-      if (kind == Snapshot::kAppNoJIT) {
+      if (kind == Snapshot::kAppAOT) {
         func->ptr()->code_ = reinterpret_cast<RawCode*>(d->ReadRef());
-      } else if (kind == Snapshot::kAppWithJIT) {
+      } else if (kind == Snapshot::kAppJIT) {
         NOT_IN_PRECOMPILED(func->ptr()->unoptimized_code_ =
                                reinterpret_cast<RawCode*>(d->ReadRef()));
         func->ptr()->code_ = reinterpret_cast<RawCode*>(d->ReadRef());
@@ -628,7 +628,7 @@
 #endif
 
 #if !defined(DART_PRECOMPILED_RUNTIME)
-      if (kind != Snapshot::kAppNoJIT) {
+      if (kind != Snapshot::kAppAOT) {
         func->ptr()->token_pos_ = d->ReadTokenPosition();
         func->ptr()->end_token_pos_ = d->ReadTokenPosition();
       }
@@ -636,7 +636,7 @@
       func->ptr()->num_fixed_parameters_ = d->Read<int16_t>();
       func->ptr()->num_optional_parameters_ = d->Read<int16_t>();
       func->ptr()->kind_tag_ = d->Read<uint32_t>();
-      if (kind == Snapshot::kAppNoJIT) {
+      if (kind == Snapshot::kAppAOT) {
         // Omit fields used to support de/reoptimization.
       } else {
 #if !defined(DART_PRECOMPILED_RUNTIME)
@@ -657,7 +657,7 @@
     NOT_IN_PRODUCT(TimelineDurationScope tds(
         Thread::Current(), Timeline::GetIsolateStream(), "PostLoadFunction"));
 
-    if (kind == Snapshot::kAppNoJIT) {
+    if (kind == Snapshot::kAppAOT) {
       Function& func = Function::Handle(zone);
       for (intptr_t i = start_index_; i < stop_index_; i++) {
         func ^= refs.At(i);
@@ -666,7 +666,7 @@
         ASSERT(entry_point != 0);
         func.raw()->ptr()->entry_point_ = entry_point;
       }
-    } else if (kind == Snapshot::kAppWithJIT) {
+    } else if (kind == Snapshot::kAppJIT) {
       Function& func = Function::Handle(zone);
       Code& code = Code::Handle(zone);
       for (intptr_t i = start_index_; i < stop_index_; i++) {
@@ -703,7 +703,7 @@
     RawClosureData* data = ClosureData::RawCast(object);
     objects_.Add(data);
 
-    if (s->kind() != Snapshot::kAppNoJIT) {
+    if (s->kind() != Snapshot::kAppAOT) {
       s->Push(data->ptr()->context_scope_);
     }
     s->Push(data->ptr()->parent_function_);
@@ -725,7 +725,7 @@
     intptr_t count = objects_.length();
     for (intptr_t i = 0; i < count; i++) {
       RawClosureData* data = objects_[i];
-      if (s->kind() != Snapshot::kAppNoJIT) {
+      if (s->kind() != Snapshot::kAppAOT) {
         s->WriteRef(data->ptr()->context_scope_);
       }
       s->WriteRef(data->ptr()->parent_function_);
@@ -763,7 +763,7 @@
       RawClosureData* data = reinterpret_cast<RawClosureData*>(d->Ref(id));
       Deserializer::InitializeHeader(data, kClosureDataCid,
                                      ClosureData::InstanceSize(), is_vm_object);
-      if (d->kind() == Snapshot::kAppNoJIT) {
+      if (d->kind() == Snapshot::kAppAOT) {
         data->ptr()->context_scope_ = ContextScope::null();
       } else {
         data->ptr()->context_scope_ =
@@ -772,6 +772,85 @@
       data->ptr()->parent_function_ = static_cast<RawFunction*>(d->ReadRef());
       data->ptr()->signature_type_ = static_cast<RawType*>(d->ReadRef());
       data->ptr()->closure_ = static_cast<RawInstance*>(d->ReadRef());
+      data->ptr()->hash_ = Object::null();
+    }
+  }
+};
+
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+class SignatureDataSerializationCluster : public SerializationCluster {
+ public:
+  SignatureDataSerializationCluster() {}
+  virtual ~SignatureDataSerializationCluster() {}
+
+  void Trace(Serializer* s, RawObject* object) {
+    RawSignatureData* data = SignatureData::RawCast(object);
+    objects_.Add(data);
+
+    RawObject** from = data->from();
+    RawObject** to = data->to();
+    for (RawObject** p = from; p <= to; p++) {
+      s->Push(*p);
+    }
+  }
+
+  void WriteAlloc(Serializer* s) {
+    s->WriteCid(kSignatureDataCid);
+    intptr_t count = objects_.length();
+    s->Write<int32_t>(count);
+    for (intptr_t i = 0; i < count; i++) {
+      RawSignatureData* data = objects_[i];
+      s->AssignRef(data);
+    }
+  }
+
+  void WriteFill(Serializer* s) {
+    intptr_t count = objects_.length();
+    for (intptr_t i = 0; i < count; i++) {
+      RawSignatureData* data = objects_[i];
+      RawObject** from = data->from();
+      RawObject** to = data->to();
+      for (RawObject** p = from; p <= to; p++) {
+        s->WriteRef(*p);
+      }
+    }
+  }
+
+ private:
+  GrowableArray<RawSignatureData*> objects_;
+};
+#endif  // !DART_PRECOMPILED_RUNTIME
+
+
+class SignatureDataDeserializationCluster : public DeserializationCluster {
+ public:
+  SignatureDataDeserializationCluster() {}
+  virtual ~SignatureDataDeserializationCluster() {}
+
+  void ReadAlloc(Deserializer* d) {
+    start_index_ = d->next_index();
+    PageSpace* old_space = d->heap()->old_space();
+    intptr_t count = d->Read<int32_t>();
+    for (intptr_t i = 0; i < count; i++) {
+      d->AssignRef(
+          AllocateUninitialized(old_space, SignatureData::InstanceSize()));
+    }
+    stop_index_ = d->next_index();
+  }
+
+  void ReadFill(Deserializer* d) {
+    bool is_vm_object = d->isolate() == Dart::vm_isolate();
+
+    for (intptr_t id = start_index_; id < stop_index_; id++) {
+      RawSignatureData* data = reinterpret_cast<RawSignatureData*>(d->Ref(id));
+      Deserializer::InitializeHeader(
+          data, kSignatureDataCid, SignatureData::InstanceSize(), is_vm_object);
+      RawObject** from = data->from();
+      RawObject** to = data->to();
+      for (RawObject** p = from; p <= to; p++) {
+        *p = d->ReadRef();
+      }
     }
   }
 };
@@ -874,7 +953,7 @@
     s->Push(field->ptr()->type_);
     // Write out the initial static value or field offset.
     if (Field::StaticBit::decode(field->ptr()->kind_bits_)) {
-      if (kind == Snapshot::kAppNoJIT) {
+      if (kind == Snapshot::kAppAOT) {
         // For precompiled static fields, the value was already reset and
         // initializer_ now contains a Function.
         s->Push(field->ptr()->value_.static_value_);
@@ -889,16 +968,16 @@
       s->Push(field->ptr()->value_.offset_);
     }
     // Write out the initializer function or saved initial value.
-    if (kind == Snapshot::kAppNoJIT) {
+    if (kind == Snapshot::kAppAOT) {
       s->Push(field->ptr()->initializer_.precompiled_);
     } else {
       s->Push(field->ptr()->initializer_.saved_value_);
     }
-    if (kind != Snapshot::kAppNoJIT) {
+    if (kind != Snapshot::kAppAOT) {
       // Write out the guarded list length.
       s->Push(field->ptr()->guarded_list_length_);
     }
-    if (kind == Snapshot::kAppWithJIT) {
+    if (kind == Snapshot::kAppJIT) {
       s->Push(field->ptr()->dependent_code_);
     }
   }
@@ -924,7 +1003,7 @@
       s->WriteRef(field->ptr()->type_);
       // Write out the initial static value or field offset.
       if (Field::StaticBit::decode(field->ptr()->kind_bits_)) {
-        if (kind == Snapshot::kAppNoJIT) {
+        if (kind == Snapshot::kAppAOT) {
           // For precompiled static fields, the value was already reset and
           // initializer_ now contains a Function.
           s->WriteRef(field->ptr()->value_.static_value_);
@@ -939,20 +1018,20 @@
         s->WriteRef(field->ptr()->value_.offset_);
       }
       // Write out the initializer function or saved initial value.
-      if (kind == Snapshot::kAppNoJIT) {
+      if (kind == Snapshot::kAppAOT) {
         s->WriteRef(field->ptr()->initializer_.precompiled_);
       } else {
         s->WriteRef(field->ptr()->initializer_.saved_value_);
       }
-      if (kind != Snapshot::kAppNoJIT) {
+      if (kind != Snapshot::kAppAOT) {
         // Write out the guarded list length.
         s->WriteRef(field->ptr()->guarded_list_length_);
       }
-      if (kind == Snapshot::kAppWithJIT) {
+      if (kind == Snapshot::kAppJIT) {
         s->WriteRef(field->ptr()->dependent_code_);
       }
 
-      if (kind != Snapshot::kAppNoJIT) {
+      if (kind != Snapshot::kAppAOT) {
         s->WriteTokenPosition(field->ptr()->token_pos_);
         s->WriteCid(field->ptr()->guarded_cid_);
         s->WriteCid(field->ptr()->is_nullable_);
@@ -1000,7 +1079,7 @@
         *p = Object::null();
       }
 
-      if (kind != Snapshot::kAppNoJIT) {
+      if (kind != Snapshot::kAppAOT) {
         field->ptr()->token_pos_ = d->ReadTokenPosition();
         field->ptr()->guarded_cid_ = d->ReadCid();
         field->ptr()->is_nullable_ = d->ReadCid();
@@ -1489,7 +1568,7 @@
     s->Push(code->ptr()->pc_descriptors_);
     s->Push(code->ptr()->stackmaps_);
 
-    if (s->kind() == Snapshot::kAppWithJIT) {
+    if (s->kind() == Snapshot::kAppJIT) {
       s->Push(code->ptr()->deopt_info_array_);
       s->Push(code->ptr()->static_calls_target_table_);
       NOT_IN_PRODUCT(s->Push(code->ptr()->inlined_metadata_));
@@ -1518,7 +1597,7 @@
       if (pointer_offsets_length != 0) {
         FATAL("Cannot serialize code with embedded pointers");
       }
-      if (kind == Snapshot::kAppNoJIT) {
+      if (kind == Snapshot::kAppAOT) {
         // No disabled code in precompilation.
         NOT_IN_PRECOMPILED(ASSERT(code->ptr()->instructions_ ==
                                   code->ptr()->active_instructions_));
@@ -1527,7 +1606,7 @@
       RawInstructions* instr = code->ptr()->instructions_;
       int32_t text_offset = s->GetTextOffset(instr, code);
       s->Write<int32_t>(text_offset);
-      if (s->kind() == Snapshot::kAppWithJIT) {
+      if (s->kind() == Snapshot::kAppJIT) {
         // TODO(rmacnak): Fix references to disabled code before serializing.
         if (code->ptr()->active_instructions_ != code->ptr()->instructions_) {
           instr = code->ptr()->active_instructions_;
@@ -1542,7 +1621,7 @@
       s->WriteRef(code->ptr()->pc_descriptors_);
       s->WriteRef(code->ptr()->stackmaps_);
 
-      if (s->kind() == Snapshot::kAppWithJIT) {
+      if (s->kind() == Snapshot::kAppJIT) {
         s->WriteRef(code->ptr()->deopt_info_array_);
         s->WriteRef(code->ptr()->static_calls_target_table_);
         NOT_IN_PRODUCT(s->WriteRef(code->ptr()->inlined_metadata_));
@@ -1583,8 +1662,7 @@
                                      is_vm_object);
 
       int32_t text_offset = d->Read<int32_t>();
-      RawInstructions* instr = reinterpret_cast<RawInstructions*>(
-          d->GetInstructionsAt(text_offset) + kHeapObjectTag);
+      RawInstructions* instr = d->GetInstructionsAt(text_offset);
 
       code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr);
       code->ptr()->checked_entry_point_ =
@@ -1593,10 +1671,9 @@
       code->ptr()->instructions_ = instr;
 
 #if !defined(DART_PRECOMPILED_RUNTIME)
-      if (d->kind() == Snapshot::kAppWithJIT) {
+      if (d->kind() == Snapshot::kAppJIT) {
         int32_t text_offset = d->Read<int32_t>();
-        RawInstructions* instr = reinterpret_cast<RawInstructions*>(
-            d->GetInstructionsAt(text_offset) + kHeapObjectTag);
+        RawInstructions* instr = d->GetInstructionsAt(text_offset);
         code->ptr()->active_instructions_ = instr;
         code->ptr()->entry_point_ = Instructions::UncheckedEntryPoint(instr);
         code->ptr()->checked_entry_point_ =
@@ -1614,7 +1691,7 @@
       code->ptr()->stackmaps_ = reinterpret_cast<RawArray*>(d->ReadRef());
 
 #if !defined(DART_PRECOMPILED_RUNTIME)
-      if (d->kind() == Snapshot::kAppWithJIT) {
+      if (d->kind() == Snapshot::kAppJIT) {
         code->ptr()->deopt_info_array_ =
             reinterpret_cast<RawArray*>(d->ReadRef());
         code->ptr()->static_calls_target_table_ =
@@ -1799,7 +1876,7 @@
 
 
 #if !defined(DART_PRECOMPILED_RUNTIME)
-// PcDescriptor, Stackmap, OneByteString, TwoByteString
+// PcDescriptor, StackMap, OneByteString, TwoByteString
 class RODataSerializationCluster : public SerializationCluster {
  public:
   explicit RODataSerializationCluster(intptr_t cid) : cid_(cid) {}
@@ -2245,7 +2322,7 @@
       for (RawObject** p = from; p <= to; p++) {
         s->WriteRef(*p);
       }
-      if (kind != Snapshot::kAppNoJIT) {
+      if (kind != Snapshot::kAppAOT) {
         NOT_IN_PRECOMPILED(s->Write<int32_t>(ic->ptr()->deopt_id_));
       }
       s->Write<uint32_t>(ic->ptr()->state_bits_);
@@ -3769,13 +3846,13 @@
 
 
 #if !defined(DART_PRECOMPILED_RUNTIME)
-class StacktraceSerializationCluster : public SerializationCluster {
+class StackTraceSerializationCluster : public SerializationCluster {
  public:
-  StacktraceSerializationCluster() {}
-  virtual ~StacktraceSerializationCluster() {}
+  StackTraceSerializationCluster() {}
+  virtual ~StackTraceSerializationCluster() {}
 
   void Trace(Serializer* s, RawObject* object) {
-    RawStacktrace* trace = Stacktrace::RawCast(object);
+    RawStackTrace* trace = StackTrace::RawCast(object);
     objects_.Add(trace);
 
     RawObject** from = trace->from();
@@ -3786,11 +3863,11 @@
   }
 
   void WriteAlloc(Serializer* s) {
-    s->WriteCid(kStacktraceCid);
+    s->WriteCid(kStackTraceCid);
     intptr_t count = objects_.length();
     s->Write<int32_t>(count);
     for (intptr_t i = 0; i < count; i++) {
-      RawStacktrace* trace = objects_[i];
+      RawStackTrace* trace = objects_[i];
       s->AssignRef(trace);
     }
   }
@@ -3798,7 +3875,7 @@
   void WriteFill(Serializer* s) {
     intptr_t count = objects_.length();
     for (intptr_t i = 0; i < count; i++) {
-      RawStacktrace* trace = objects_[i];
+      RawStackTrace* trace = objects_[i];
       RawObject** from = trace->from();
       RawObject** to = trace->to();
       for (RawObject** p = from; p <= to; p++) {
@@ -3808,15 +3885,15 @@
   }
 
  private:
-  GrowableArray<RawStacktrace*> objects_;
+  GrowableArray<RawStackTrace*> objects_;
 };
 #endif  // !DART_PRECOMPILED_RUNTIME
 
 
-class StacktraceDeserializationCluster : public DeserializationCluster {
+class StackTraceDeserializationCluster : public DeserializationCluster {
  public:
-  StacktraceDeserializationCluster() {}
-  virtual ~StacktraceDeserializationCluster() {}
+  StackTraceDeserializationCluster() {}
+  virtual ~StackTraceDeserializationCluster() {}
 
   void ReadAlloc(Deserializer* d) {
     start_index_ = d->next_index();
@@ -3824,7 +3901,7 @@
     intptr_t count = d->Read<int32_t>();
     for (intptr_t i = 0; i < count; i++) {
       d->AssignRef(
-          AllocateUninitialized(old_space, Stacktrace::InstanceSize()));
+          AllocateUninitialized(old_space, StackTrace::InstanceSize()));
     }
     stop_index_ = d->next_index();
   }
@@ -3833,9 +3910,9 @@
     bool is_vm_object = d->isolate() == Dart::vm_isolate();
 
     for (intptr_t id = start_index_; id < stop_index_; id++) {
-      RawStacktrace* trace = reinterpret_cast<RawStacktrace*>(d->Ref(id));
-      Deserializer::InitializeHeader(trace, kStacktraceCid,
-                                     Stacktrace::InstanceSize(), is_vm_object);
+      RawStackTrace* trace = reinterpret_cast<RawStackTrace*>(d->Ref(id));
+      Deserializer::InitializeHeader(trace, kStackTraceCid,
+                                     StackTrace::InstanceSize(), is_vm_object);
       RawObject** from = trace->from();
       RawObject** to = trace->to();
       for (RawObject** p = from; p <= to; p++) {
@@ -4389,13 +4466,13 @@
                        uint8_t** buffer,
                        ReAlloc alloc,
                        intptr_t initial_size,
-                       InstructionsWriter* instructions_writer)
+                       ImageWriter* image_writer)
     : StackResource(thread),
       heap_(thread->isolate()->heap()),
       zone_(thread->zone()),
       kind_(kind),
       stream_(buffer, alloc, initial_size),
-      instructions_writer_(instructions_writer),
+      image_writer_(image_writer),
       clusters_by_cid_(NULL),
       stack_(),
       num_cids_(0),
@@ -4446,6 +4523,8 @@
       return new (Z) FunctionSerializationCluster();
     case kClosureDataCid:
       return new (Z) ClosureDataSerializationCluster();
+    case kSignatureDataCid:
+      return new (Z) SignatureDataSerializationCluster();
     case kRedirectionDataCid:
       return new (Z) RedirectionDataSerializationCluster();
     case kFieldCid:
@@ -4466,8 +4545,8 @@
       return new (Z) ObjectPoolSerializationCluster();
     case kPcDescriptorsCid:
       return new (Z) RODataSerializationCluster(kPcDescriptorsCid);
-    case kStackmapCid:
-      return new (Z) RODataSerializationCluster(kStackmapCid);
+    case kStackMapCid:
+      return new (Z) RODataSerializationCluster(kStackMapCid);
     case kExceptionHandlersCid:
       return new (Z) ExceptionHandlersSerializationCluster();
     case kContextCid:
@@ -4506,8 +4585,8 @@
       return new (Z) DoubleSerializationCluster();
     case kGrowableObjectArrayCid:
       return new (Z) GrowableObjectArraySerializationCluster();
-    case kStacktraceCid:
-      return new (Z) StacktraceSerializationCluster();
+    case kStackTraceCid:
+      return new (Z) StackTraceSerializationCluster();
     case kRegExpCid:
       return new (Z) RegExpSerializationCluster();
     case kWeakPropertyCid:
@@ -4666,6 +4745,12 @@
   }
   AddBaseObject(table->At(kDynamicCid));
   AddBaseObject(table->At(kVoidCid));
+
+  if (kind_ != Snapshot::kAppAOT) {
+    for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
+      AddBaseObject(StubCode::EntryAt(i)->code());
+    }
+  }
 }
 
 
@@ -4679,7 +4764,9 @@
   Push(symbols.raw());
   Push(scripts.raw());
   if (Snapshot::IncludesCode(kind_)) {
-    StubCode::Push(this);
+    for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
+      Push(StubCode::EntryAt(i)->code());
+    }
   }
 
   Serialize();
@@ -4688,7 +4775,9 @@
   WriteRef(symbols.raw());
   WriteRef(scripts.raw());
   if (Snapshot::IncludesCode(kind_)) {
-    StubCode::WriteRef(this);
+    for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
+      WriteRef(StubCode::EntryAt(i)->code());
+    }
   }
 
 #if defined(DEBUG)
@@ -4704,8 +4793,8 @@
 }
 
 
-void Serializer::WriteFullSnapshot(intptr_t num_base_objects,
-                                   ObjectStore* object_store) {
+void Serializer::WriteIsolateSnapshot(intptr_t num_base_objects,
+                                      ObjectStore* object_store) {
   NoSafepointScope no_safepoint;
 
   if (num_base_objects == 0) {
@@ -4800,6 +4889,8 @@
       return new (Z) FunctionDeserializationCluster();
     case kClosureDataCid:
       return new (Z) ClosureDataDeserializationCluster();
+    case kSignatureDataCid:
+      return new (Z) SignatureDataDeserializationCluster();
     case kRedirectionDataCid:
       return new (Z) RedirectionDataDeserializationCluster();
     case kFieldCid:
@@ -4819,7 +4910,7 @@
     case kObjectPoolCid:
       return new (Z) ObjectPoolDeserializationCluster();
     case kPcDescriptorsCid:
-    case kStackmapCid:
+    case kStackMapCid:
       return new (Z) RODataDeserializationCluster();
     case kExceptionHandlersCid:
       return new (Z) ExceptionHandlersDeserializationCluster();
@@ -4859,8 +4950,8 @@
       return new (Z) DoubleDeserializationCluster();
     case kGrowableObjectArrayCid:
       return new (Z) GrowableObjectArrayDeserializationCluster();
-    case kStacktraceCid:
-      return new (Z) StacktraceDeserializationCluster();
+    case kStackTraceCid:
+      return new (Z) StackTraceDeserializationCluster();
     case kRegExpCid:
       return new (Z) RegExpDeserializationCluster();
     case kWeakPropertyCid:
@@ -4944,8 +5035,9 @@
     char* actual_features =
         OS::StrNDup(features, buffer_len < 128 ? buffer_len : 128);
     OS::SNPrint(message_buffer, kMessageBufferSize,
-                "Wrong features in snapshot, expected '%s' found '%s'",
-                expected_features, actual_features);
+                "Snapshot not compatible with the current VM configuration: "
+                "the snapshot requires '%s' but the VM has '%s'",
+                actual_features, expected_features);
     free(const_cast<char*>(expected_features));
     free(actual_features);
     // This can also fail while bringing up the VM isolate, so make sure to
@@ -5050,6 +5142,12 @@
   }
   AddBaseObject(table->At(kDynamicCid));
   AddBaseObject(table->At(kVoidCid));
+
+  if (kind_ != Snapshot::kAppAOT) {
+    for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
+      AddBaseObject(StubCode::EntryAt(i)->code());
+    }
+  }
 }
 
 
@@ -5071,7 +5169,11 @@
     isolate()->object_store()->set_symbol_table(symbol_table);
     ReadRef();  // Script list.
     if (Snapshot::IncludesCode(kind_)) {
-      StubCode::ReadRef(this);
+      Code& code = Code::Handle(zone_);
+      for (intptr_t i = 0; i < StubCode::NumEntries(); i++) {
+        code ^= ReadRef();
+        StubCode::EntryAtPut(i, new StubEntry(code));
+      }
     }
 
 #if defined(DEBUG)
@@ -5092,7 +5194,7 @@
 #endif
 }
 
-void Deserializer::ReadFullSnapshot(ObjectStore* object_store) {
+void Deserializer::ReadIsolateSnapshot(ObjectStore* object_store) {
   Array& refs = Array::Handle();
   Prepare();
 
@@ -5179,22 +5281,28 @@
 
 
 FullSnapshotWriter::FullSnapshotWriter(Snapshot::Kind kind,
-                                       uint8_t** vm_isolate_snapshot_buffer,
-                                       uint8_t** isolate_snapshot_buffer,
+                                       uint8_t** vm_snapshot_data_buffer,
+                                       uint8_t** isolate_snapshot_data_buffer,
                                        ReAlloc alloc,
-                                       InstructionsWriter* instructions_writer)
+                                       ImageWriter* vm_image_writer,
+                                       ImageWriter* isolate_image_writer)
     : thread_(Thread::Current()),
       kind_(kind),
-      vm_isolate_snapshot_buffer_(vm_isolate_snapshot_buffer),
-      isolate_snapshot_buffer_(isolate_snapshot_buffer),
+      vm_snapshot_data_buffer_(vm_snapshot_data_buffer),
+      isolate_snapshot_data_buffer_(isolate_snapshot_data_buffer),
       alloc_(alloc),
       vm_isolate_snapshot_size_(0),
       isolate_snapshot_size_(0),
-      instructions_writer_(instructions_writer),
+      vm_image_writer_(vm_image_writer),
+      isolate_image_writer_(isolate_image_writer),
       token_streams_(Array::Handle(zone())),
       saved_symbol_table_(Array::Handle(zone())),
-      new_vm_symbol_table_(Array::Handle(zone())) {
-  ASSERT(isolate_snapshot_buffer_ != NULL);
+      new_vm_symbol_table_(Array::Handle(zone())),
+      clustered_vm_size_(0),
+      clustered_isolate_size_(0),
+      mapped_data_size_(0),
+      mapped_instructions_size_(0) {
+  ASSERT(isolate_snapshot_data_buffer_ != NULL);
   ASSERT(alloc_ != NULL);
   ASSERT(isolate() != NULL);
   ASSERT(ClassFinalizer::AllClassesFinalized());
@@ -5210,7 +5318,7 @@
   // Can't have any mutation happening while we're serializing.
   ASSERT(isolate()->background_compiler() == NULL);
 
-  if (vm_isolate_snapshot_buffer != NULL) {
+  if (vm_snapshot_data_buffer != NULL) {
     NOT_IN_PRODUCT(TimelineDurationScope tds(
         thread(), Timeline::GetIsolateStream(), "PrepareNewVMIsolate"));
 
@@ -5254,88 +5362,114 @@
 }
 
 
-intptr_t FullSnapshotWriter::WriteVmIsolateSnapshot() {
+intptr_t FullSnapshotWriter::WriteVMSnapshot() {
   NOT_IN_PRODUCT(TimelineDurationScope tds(
-      thread(), Timeline::GetIsolateStream(), "WriteVmIsolateSnapshot"));
+      thread(), Timeline::GetIsolateStream(), "WriteVMSnapshot"));
 
-  ASSERT(vm_isolate_snapshot_buffer_ != NULL);
-  Serializer serializer(thread(), kind_, vm_isolate_snapshot_buffer_, alloc_,
-                        kInitialSize, instructions_writer_);
+  ASSERT(vm_snapshot_data_buffer_ != NULL);
+  Serializer serializer(thread(), kind_, vm_snapshot_data_buffer_, alloc_,
+                        kInitialSize, vm_image_writer_);
 
   serializer.ReserveHeader();
   serializer.WriteVersionAndFeatures();
-  /*
-   * Now Write out the following
-   * - the symbol table
-   * - all the token streams
-   * - the stub code (precompiled snapshots only)
-   **/
+  // VM snapshot roots are:
+  // - the symbol table
+  // - all the token streams
+  // - the stub code (precompiled snapshots only)
   intptr_t num_objects =
       serializer.WriteVMSnapshot(new_vm_symbol_table_, token_streams_);
   serializer.FillHeader(serializer.kind());
+  clustered_vm_size_ = serializer.bytes_written();
 
+  if (Snapshot::IncludesCode(kind_)) {
+    vm_image_writer_->Write(serializer.stream(), true);
+    mapped_data_size_ += vm_image_writer_->data_size();
+    mapped_instructions_size_ += vm_image_writer_->text_size();
+    vm_image_writer_->ResetOffsets();
+  }
+
+  // The clustered part + the direct mapped data part.
   vm_isolate_snapshot_size_ = serializer.bytes_written();
   return num_objects;
 }
 
 
-void FullSnapshotWriter::WriteIsolateFullSnapshot(intptr_t num_base_objects) {
+void FullSnapshotWriter::WriteIsolateSnapshot(intptr_t num_base_objects) {
   NOT_IN_PRODUCT(TimelineDurationScope tds(
-      thread(), Timeline::GetIsolateStream(), "WriteIsolateFullSnapshot"));
+      thread(), Timeline::GetIsolateStream(), "WriteIsolateSnapshot"));
 
-  Serializer serializer(thread(), kind_, isolate_snapshot_buffer_, alloc_,
-                        kInitialSize, instructions_writer_);
+  Serializer serializer(thread(), kind_, isolate_snapshot_data_buffer_, alloc_,
+                        kInitialSize, isolate_image_writer_);
   ObjectStore* object_store = isolate()->object_store();
   ASSERT(object_store != NULL);
 
   serializer.ReserveHeader();
   serializer.WriteVersionAndFeatures();
-  serializer.WriteFullSnapshot(num_base_objects, object_store);
+  // Isolate snapshot roots are:
+  // - the object store
+  serializer.WriteIsolateSnapshot(num_base_objects, object_store);
   serializer.FillHeader(serializer.kind());
+  clustered_isolate_size_ = serializer.bytes_written();
 
+  if (Snapshot::IncludesCode(kind_)) {
+    isolate_image_writer_->Write(serializer.stream(), false);
+    mapped_data_size_ += isolate_image_writer_->data_size();
+    mapped_instructions_size_ += isolate_image_writer_->text_size();
+    isolate_image_writer_->ResetOffsets();
+  }
+
+  // The clustered part + the direct mapped data part.
   isolate_snapshot_size_ = serializer.bytes_written();
 }
 
 
 void FullSnapshotWriter::WriteFullSnapshot() {
   intptr_t num_base_objects;
-  if (vm_isolate_snapshot_buffer() != NULL) {
-    num_base_objects = WriteVmIsolateSnapshot();
+  if (vm_snapshot_data_buffer() != NULL) {
+    num_base_objects = WriteVMSnapshot();
     ASSERT(num_base_objects != 0);
   } else {
     num_base_objects = 0;
   }
 
-  WriteIsolateFullSnapshot(num_base_objects);
+  WriteIsolateSnapshot(num_base_objects);
 
   if (FLAG_print_snapshot_sizes) {
-    OS::Print("VMIsolate(CodeSize): %" Pd "\n", VmIsolateSnapshotSize());
-    OS::Print("Isolate(CodeSize): %" Pd "\n", IsolateSnapshotSize());
-  }
-  intptr_t total_size = VmIsolateSnapshotSize() + IsolateSnapshotSize();
-
-  if (Snapshot::IncludesCode(kind_)) {
-    instructions_writer_->Write(
-        *vm_isolate_snapshot_buffer_, vm_isolate_snapshot_size_,
-        *isolate_snapshot_buffer_, isolate_snapshot_size_);
-
-    if (FLAG_print_snapshot_sizes) {
-      OS::Print("ReadOnlyData(CodeSize): %" Pd "\n",
-                instructions_writer_->data_size());
-      OS::Print("Instructions(CodeSize): %" Pd "\n",
-                instructions_writer_->text_size());
-    }
-    total_size +=
-        instructions_writer_->data_size() + instructions_writer_->text_size();
-  }
-
-  if (FLAG_print_snapshot_sizes) {
-    OS::Print("Total(CodeSize): %" Pd "\n", total_size);
+    OS::Print("VMIsolate(CodeSize): %" Pd "\n", clustered_vm_size_);
+    OS::Print("Isolate(CodeSize): %" Pd "\n", clustered_isolate_size_);
+    OS::Print("ReadOnlyData(CodeSize): %" Pd "\n", mapped_data_size_);
+    OS::Print("Instructions(CodeSize): %" Pd "\n", mapped_instructions_size_);
+    OS::Print("Total(CodeSize): %" Pd "\n",
+              clustered_vm_size_ + clustered_isolate_size_ + mapped_data_size_ +
+                  mapped_instructions_size_);
   }
 }
 
 
-RawApiError* IsolateSnapshotReader::ReadFullSnapshot() {
+static const uint8_t* DataBuffer(const Snapshot* snapshot) {
+  if (Snapshot::IncludesCode(snapshot->kind())) {
+    uword offset =
+        Utils::RoundUp(snapshot->length(), OS::kMaxPreferredCodeAlignment);
+    return snapshot->Addr() + offset;
+  }
+  return NULL;
+}
+
+
+FullSnapshotReader::FullSnapshotReader(const Snapshot* snapshot,
+                                       const uint8_t* instructions_buffer,
+                                       Thread* thread)
+    : kind_(snapshot->kind()),
+      thread_(thread),
+      buffer_(snapshot->content()),
+      size_(snapshot->length()),
+      instructions_buffer_(instructions_buffer),
+      data_buffer_(DataBuffer(snapshot)) {
+  thread->isolate()->set_compilation_allowed(kind_ != Snapshot::kAppAOT);
+}
+
+
+RawApiError* FullSnapshotReader::ReadVMSnapshot() {
   Deserializer deserializer(thread_, kind_, buffer_, size_,
                             instructions_buffer_, data_buffer_);
 
@@ -5344,13 +5478,22 @@
     return error;
   }
 
-  deserializer.ReadFullSnapshot(thread_->isolate()->object_store());
+  if (Snapshot::IncludesCode(kind_)) {
+    ASSERT(instructions_buffer_ != NULL);
+    thread_->isolate()->SetupImagePage(instructions_buffer_,
+                                       /* is_executable */ true);
+    ASSERT(data_buffer_ != NULL);
+    thread_->isolate()->SetupImagePage(data_buffer_,
+                                       /* is_executable */ false);
+  }
+
+  deserializer.ReadVMSnapshot();
 
   return ApiError::null();
 }
 
 
-RawApiError* VmIsolateSnapshotReader::ReadVmIsolateSnapshot() {
+RawApiError* FullSnapshotReader::ReadIsolateSnapshot() {
   Deserializer deserializer(thread_, kind_, buffer_, size_,
                             instructions_buffer_, data_buffer_);
 
@@ -5359,10 +5502,16 @@
     return error;
   }
 
-  deserializer.ReadVMSnapshot();
+  if (Snapshot::IncludesCode(kind_)) {
+    ASSERT(instructions_buffer_ != NULL);
+    thread_->isolate()->SetupImagePage(instructions_buffer_,
+                                       /* is_executable */ true);
+    ASSERT(data_buffer_ != NULL);
+    thread_->isolate()->SetupImagePage(data_buffer_,
+                                       /* is_executable */ false);
+  }
 
-  Dart::set_instructions_snapshot_buffer(instructions_buffer_);
-  Dart::set_data_snapshot_buffer(data_buffer_);
+  deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store());
 
   return ApiError::null();
 }
diff --git a/runtime/vm/clustered_snapshot.h b/runtime/vm/clustered_snapshot.h
index 21fc29c..e110f74 100644
--- a/runtime/vm/clustered_snapshot.h
+++ b/runtime/vm/clustered_snapshot.h
@@ -119,11 +119,12 @@
              uint8_t** buffer,
              ReAlloc alloc,
              intptr_t initial_size,
-             InstructionsWriter* instructions_writer_);
+             ImageWriter* image_writer_);
   ~Serializer();
 
   intptr_t WriteVMSnapshot(const Array& symbols, const Array& scripts);
-  void WriteFullSnapshot(intptr_t num_base_objects, ObjectStore* object_store);
+  void WriteIsolateSnapshot(intptr_t num_base_objects,
+                            ObjectStore* object_store);
 
   void AddVMIsolateBaseObjects();
 
@@ -206,6 +207,7 @@
   void WriteVersionAndFeatures();
 
   void Serialize();
+  WriteStream* stream() { return &stream_; }
   intptr_t bytes_written() { return stream_.bytes_written(); }
 
   // Writes raw data to the stream (basic type).
@@ -257,11 +259,11 @@
   }
 
   int32_t GetTextOffset(RawInstructions* instr, RawCode* code) {
-    return instructions_writer_->GetOffsetFor(instr, code);
+    return image_writer_->GetOffsetFor(instr, code);
   }
 
   int32_t GetRODataOffset(RawObject* object) {
-    return instructions_writer_->GetObjectOffsetFor(object);
+    return image_writer_->GetObjectOffsetFor(object);
   }
 
   Snapshot::Kind kind() const { return kind_; }
@@ -271,7 +273,7 @@
   Zone* zone_;
   Snapshot::Kind kind_;
   WriteStream stream_;
-  InstructionsWriter* instructions_writer_;
+  ImageWriter* image_writer_;
   SerializationCluster** clusters_by_cid_;
   GrowableArray<RawObject*> stack_;
   intptr_t num_cids_;
@@ -294,7 +296,7 @@
                const uint8_t* data_buffer);
   ~Deserializer();
 
-  void ReadFullSnapshot(ObjectStore* object_store);
+  void ReadIsolateSnapshot(ObjectStore* object_store);
   void ReadVMSnapshot();
 
   void AddVMIsolateBaseObjects();
@@ -350,7 +352,7 @@
     return Read<int32_t>();
   }
 
-  uword GetInstructionsAt(int32_t offset) {
+  RawInstructions* GetInstructionsAt(int32_t offset) {
     return instructions_reader_->GetInstructionsAt(offset);
   }
 
@@ -387,17 +389,18 @@
  public:
   static const intptr_t kInitialSize = 64 * KB;
   FullSnapshotWriter(Snapshot::Kind kind,
-                     uint8_t** vm_isolate_snapshot_buffer,
-                     uint8_t** isolate_snapshot_buffer,
+                     uint8_t** vm_snapshot_data_buffer,
+                     uint8_t** isolate_snapshot_data_buffer,
                      ReAlloc alloc,
-                     InstructionsWriter* instructions_writer);
+                     ImageWriter* vm_image_writer,
+                     ImageWriter* iso_image_writer);
   ~FullSnapshotWriter();
 
-  uint8_t** vm_isolate_snapshot_buffer() const {
-    return vm_isolate_snapshot_buffer_;
-  }
+  uint8_t** vm_snapshot_data_buffer() const { return vm_snapshot_data_buffer_; }
 
-  uint8_t** isolate_snapshot_buffer() const { return isolate_snapshot_buffer_; }
+  uint8_t** isolate_snapshot_data_buffer() const {
+    return isolate_snapshot_data_buffer_;
+  }
 
   Thread* thread() const { return thread_; }
   Zone* zone() const { return thread_->zone(); }
@@ -412,48 +415,44 @@
 
  private:
   // Writes a snapshot of the VM Isolate.
-  intptr_t WriteVmIsolateSnapshot();
+  intptr_t WriteVMSnapshot();
 
   // Writes a full snapshot of a regular Dart Isolate.
-  void WriteIsolateFullSnapshot(intptr_t num_base_objects);
+  void WriteIsolateSnapshot(intptr_t num_base_objects);
 
   Thread* thread_;
   Snapshot::Kind kind_;
-  uint8_t** vm_isolate_snapshot_buffer_;
-  uint8_t** isolate_snapshot_buffer_;
+  uint8_t** vm_snapshot_data_buffer_;
+  uint8_t** isolate_snapshot_data_buffer_;
   ReAlloc alloc_;
   intptr_t vm_isolate_snapshot_size_;
   intptr_t isolate_snapshot_size_;
   ForwardList* forward_list_;
-  InstructionsWriter* instructions_writer_;
+  ImageWriter* vm_image_writer_;
+  ImageWriter* isolate_image_writer_;
   Array& token_streams_;
   Array& saved_symbol_table_;
   Array& new_vm_symbol_table_;
 
+  // Stats for benchmarking.
+  intptr_t clustered_vm_size_;
+  intptr_t clustered_isolate_size_;
+  intptr_t mapped_data_size_;
+  intptr_t mapped_instructions_size_;
+
   DISALLOW_COPY_AND_ASSIGN(FullSnapshotWriter);
 };
 
 
-class VmIsolateSnapshotReader {
+class FullSnapshotReader {
  public:
-  VmIsolateSnapshotReader(Snapshot::Kind kind,
-                          const uint8_t* buffer,
-                          intptr_t size,
-                          const uint8_t* instructions_buffer,
-                          const uint8_t* data_buffer,
-                          Thread* thread)
-      : kind_(kind),
-        thread_(thread),
-        buffer_(buffer),
-        size_(size),
-        instructions_buffer_(instructions_buffer),
-        data_buffer_(data_buffer) {
-    thread->isolate()->set_compilation_allowed(kind != Snapshot::kAppNoJIT);
-  }
+  FullSnapshotReader(const Snapshot* snapshot,
+                     const uint8_t* instructions_buffer,
+                     Thread* thread);
+  ~FullSnapshotReader() {}
 
-  ~VmIsolateSnapshotReader() {}
-
-  RawApiError* ReadVmIsolateSnapshot();
+  RawApiError* ReadVMSnapshot();
+  RawApiError* ReadIsolateSnapshot();
 
  private:
   Snapshot::Kind kind_;
@@ -463,40 +462,7 @@
   const uint8_t* instructions_buffer_;
   const uint8_t* data_buffer_;
 
-  DISALLOW_COPY_AND_ASSIGN(VmIsolateSnapshotReader);
-};
-
-
-class IsolateSnapshotReader {
- public:
-  IsolateSnapshotReader(Snapshot::Kind kind,
-                        const uint8_t* buffer,
-                        intptr_t size,
-                        const uint8_t* instructions_buffer,
-                        const uint8_t* data_buffer,
-                        Thread* thread)
-      : kind_(kind),
-        thread_(thread),
-        buffer_(buffer),
-        size_(size),
-        instructions_buffer_(instructions_buffer),
-        data_buffer_(data_buffer) {
-    thread->isolate()->set_compilation_allowed(kind != Snapshot::kAppNoJIT);
-  }
-
-  ~IsolateSnapshotReader() {}
-
-  RawApiError* ReadFullSnapshot();
-
- private:
-  Snapshot::Kind kind_;
-  Thread* thread_;
-  const uint8_t* buffer_;
-  intptr_t size_;
-  const uint8_t* instructions_buffer_;
-  const uint8_t* data_buffer_;
-
-  DISALLOW_COPY_AND_ASSIGN(IsolateSnapshotReader);
+  DISALLOW_COPY_AND_ASSIGN(FullSnapshotReader);
 };
 
 }  // namespace dart
diff --git a/runtime/vm/code_descriptors.cc b/runtime/vm/code_descriptors.cc
index ece0fd8..1e6ff22 100644
--- a/runtime/vm/code_descriptors.cc
+++ b/runtime/vm/code_descriptors.cc
@@ -60,18 +60,18 @@
 }
 
 
-void StackmapTableBuilder::AddEntry(intptr_t pc_offset,
+void StackMapTableBuilder::AddEntry(intptr_t pc_offset,
                                     BitmapBuilder* bitmap,
                                     intptr_t register_bit_count) {
-  stack_map_ = Stackmap::New(pc_offset, bitmap, register_bit_count);
+  stack_map_ = StackMap::New(pc_offset, bitmap, register_bit_count);
   list_.Add(stack_map_, Heap::kOld);
 }
 
 
-bool StackmapTableBuilder::Verify() {
+bool StackMapTableBuilder::Verify() {
   intptr_t num_entries = Length();
-  Stackmap& map1 = Stackmap::Handle();
-  Stackmap& map2 = Stackmap::Handle();
+  StackMap& map1 = StackMap::Handle();
+  StackMap& map2 = StackMap::Handle();
   for (intptr_t i = 1; i < num_entries; i++) {
     map1 = MapAt(i - 1);
     map2 = MapAt(i);
@@ -84,7 +84,7 @@
 }
 
 
-RawArray* StackmapTableBuilder::FinalizeStackmaps(const Code& code) {
+RawArray* StackMapTableBuilder::FinalizeStackMaps(const Code& code) {
   ASSERT(Verify());
   intptr_t num_entries = Length();
   if (num_entries == 0) {
@@ -94,8 +94,8 @@
 }
 
 
-RawStackmap* StackmapTableBuilder::MapAt(intptr_t index) const {
-  Stackmap& map = Stackmap::Handle();
+RawStackMap* StackMapTableBuilder::MapAt(intptr_t index) const {
+  StackMap& map = StackMap::Handle();
   map ^= list_.At(index);
   return map.raw();
 }
diff --git a/runtime/vm/code_descriptors.h b/runtime/vm/code_descriptors.h
index 58f1af7..fa99412 100644
--- a/runtime/vm/code_descriptors.h
+++ b/runtime/vm/code_descriptors.h
@@ -63,13 +63,13 @@
 };
 
 
-class StackmapTableBuilder : public ZoneAllocated {
+class StackMapTableBuilder : public ZoneAllocated {
  public:
-  StackmapTableBuilder()
-      : stack_map_(Stackmap::ZoneHandle()),
+  StackMapTableBuilder()
+      : stack_map_(StackMap::ZoneHandle()),
         list_(GrowableObjectArray::ZoneHandle(
             GrowableObjectArray::New(Heap::kOld))) {}
-  ~StackmapTableBuilder() {}
+  ~StackMapTableBuilder() {}
 
   void AddEntry(intptr_t pc_offset,
                 BitmapBuilder* bitmap,
@@ -77,15 +77,15 @@
 
   bool Verify();
 
-  RawArray* FinalizeStackmaps(const Code& code);
+  RawArray* FinalizeStackMaps(const Code& code);
 
  private:
   intptr_t Length() const { return list_.Length(); }
-  RawStackmap* MapAt(intptr_t index) const;
+  RawStackMap* MapAt(intptr_t index) const;
 
-  Stackmap& stack_map_;
+  StackMap& stack_map_;
   GrowableObjectArray& list_;
-  DISALLOW_COPY_AND_ASSIGN(StackmapTableBuilder);
+  DISALLOW_COPY_AND_ASSIGN(StackMapTableBuilder);
 };
 
 
@@ -130,7 +130,7 @@
 
 
   // Called by rethrows, to mark their enclosing handlers.
-  void SetNeedsStacktrace(intptr_t try_index) {
+  void SetNeedsStackTrace(intptr_t try_index) {
     // Rethrows can be generated outside a try by the compiler.
     if (try_index == CatchClauseNode::kInvalidTryIndex) {
       return;
diff --git a/runtime/vm/code_descriptors_test.cc b/runtime/vm/code_descriptors_test.cc
index ec481fb..0097bb4 100644
--- a/runtime/vm/code_descriptors_test.cc
+++ b/runtime/vm/code_descriptors_test.cc
@@ -21,7 +21,7 @@
 static const TokenPosition kPos = TokenPosition::kNoSource;
 
 
-CODEGEN_TEST_GENERATE(StackmapCodegen, test) {
+CODEGEN_TEST_GENERATE(StackMapCodegen, test) {
   ParsedFunction* parsed_function =
       new ParsedFunction(Thread::Current(), test->function());
   LiteralNode* l = new LiteralNode(kPos, Smi::ZoneHandle(Smi::New(1)));
@@ -45,7 +45,7 @@
   if (setjmp(*jump.Set()) == 0) {
     // Build a stackmap table and some stackmap table entries.
     const intptr_t kStackSlotCount = 11;
-    StackmapTableBuilder* stackmap_table_builder = new StackmapTableBuilder();
+    StackMapTableBuilder* stackmap_table_builder = new StackMapTableBuilder();
     EXPECT(stackmap_table_builder != NULL);
 
     BitmapBuilder* stack_bitmap = new BitmapBuilder();
@@ -125,11 +125,11 @@
     const Code& code = Code::Handle(test->function().CurrentCode());
 
     const Array& stack_maps =
-        Array::Handle(stackmap_table_builder->FinalizeStackmaps(code));
+        Array::Handle(stackmap_table_builder->FinalizeStackMaps(code));
     code.set_stackmaps(stack_maps);
     const Array& stack_map_list = Array::Handle(code.stackmaps());
     EXPECT(!stack_map_list.IsNull());
-    Stackmap& stack_map = Stackmap::Handle();
+    StackMap& stack_map = StackMap::Handle();
     EXPECT_EQ(4, stack_map_list.Length());
 
     // Validate the first stack map entry.
@@ -165,7 +165,7 @@
   }
   EXPECT(retval);
 }
-CODEGEN_TEST_RUN(StackmapCodegen, Smi::New(1))
+CODEGEN_TEST_RUN(StackMapCodegen, Smi::New(1))
 
 
 static void NativeFunc(Dart_NativeArguments args) {
@@ -192,7 +192,7 @@
 }
 
 
-TEST_CASE(StackmapGC) {
+TEST_CASE(StackMapGC) {
   const char* kScriptChars =
       "class A {"
       "  static void func(var i, var k) native 'NativeFunc';"
@@ -237,7 +237,7 @@
 
   // Build and setup a stackmap for the call to 'func' in 'A.foo' in order
   // to test the traversal of stack maps when a GC happens.
-  StackmapTableBuilder* stackmap_table_builder = new StackmapTableBuilder();
+  StackMapTableBuilder* stackmap_table_builder = new StackMapTableBuilder();
   EXPECT(stackmap_table_builder != NULL);
   BitmapBuilder* stack_bitmap = new BitmapBuilder();
   EXPECT(stack_bitmap != NULL);
@@ -260,7 +260,7 @@
   // we did if there was exactly one call seen.
   EXPECT(call_count == 1);
   const Array& stack_maps =
-      Array::Handle(stackmap_table_builder->FinalizeStackmaps(code));
+      Array::Handle(stackmap_table_builder->FinalizeStackMaps(code));
   code.set_stackmaps(stack_maps);
 
   // Now invoke 'A.moo' and it will trigger a GC when the native function
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 4a35895..6e4cd11 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -585,7 +585,7 @@
       Instance::CheckedHandle(zone, arguments.ArgAt(0));
 
   if (src_instance.IsNull()) {
-    const Array& args = Array::Handle(zone, Array::New(4));
+    const Array& args = Array::Handle(zone, Array::New(5));
     args.SetAt(
         0, String::Handle(
                zone,
@@ -596,6 +596,7 @@
     args.SetAt(1, String::Handle(zone, String::null()));
     args.SetAt(2, Smi::Handle(zone, Smi::New(0)));
     args.SetAt(3, Smi::Handle(zone, Smi::New(0)));
+    args.SetAt(4, String::Handle(zone, String::null()));
 
     Exceptions::ThrowByType(Exceptions::kAssertion, args);
     UNREACHABLE();
@@ -2215,6 +2216,15 @@
 }
 
 
+DEFINE_RUNTIME_ENTRY(RewindPostDeopt, 0) {
+#if !defined(DART_PRECOMPILED_RUNTIME)
+#if !defined(PRODUCT)
+  isolate->debugger()->RewindPostDeopt();
+#endif  // !PRODUCT
+#endif  // !DART_PRECOMPILED_RUNTIME
+  UNREACHABLE();
+}
+
 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t,
                           BigintCompare,
                           2,
@@ -2246,14 +2256,6 @@
 }
 
 
-void SinCos(double arg, double* cos_res, double* sin_res) {
-  // The compiler may merge the calls to sincos, if supported. This
-  // typically occurs only when compiling for 64-bit targets.
-  *cos_res = cos(arg);
-  *sin_res = sin(arg);
-}
-
-
 // Update global type feedback recorded for a field recording the assignment
 // of the given value.
 //   Arg0: Field object;
diff --git a/runtime/vm/code_generator.h b/runtime/vm/code_generator.h
index 65b8ca1..e9425a6 100644
--- a/runtime/vm/code_generator.h
+++ b/runtime/vm/code_generator.h
@@ -22,7 +22,6 @@
 void DeoptimizeFunctionsOnStack();
 
 double DartModulo(double a, double b);
-void SinCos(double arg, double* sin_res, double* cos_res);
 
 }  // namespace dart
 
diff --git a/runtime/vm/compiler.cc b/runtime/vm/compiler.cc
index 5c5628f..fee4b89 100644
--- a/runtime/vm/compiler.cc
+++ b/runtime/vm/compiler.cc
@@ -574,7 +574,7 @@
   graph_compiler->FinalizePcDescriptors(code);
   code.set_deopt_info_array(deopt_info_array);
 
-  graph_compiler->FinalizeStackmaps(code);
+  graph_compiler->FinalizeStackMaps(code);
   graph_compiler->FinalizeVarDescriptors(code);
   graph_compiler->FinalizeExceptionHandlers(code);
   graph_compiler->FinalizeStaticCallTargetsTable(code);
@@ -1161,8 +1161,6 @@
           // }
         }
       }
-      // Mark that this isolate now has compiled code.
-      isolate()->set_has_compiled_code(true);
       // Exit the loop and the function with the correct result value.
       is_compiled = true;
       done = true;
@@ -1595,8 +1593,12 @@
   // if state changed while compiling in background.
   LongJumpScope jump;
   if (setjmp(*jump.Set()) == 0) {
-    Parser::ParseFunction(parsed_function);
-    parsed_function->AllocateVariables();
+    if (function.kernel_function() == NULL) {
+      Parser::ParseFunction(parsed_function);
+      parsed_function->AllocateVariables();
+    } else {
+      parsed_function->EnsureKernelScopes();
+    }
     const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle(
         parsed_function->node_sequence()->scope()->GetVarDescriptors(function));
     ASSERT(!var_descs.IsNull());
diff --git a/runtime/vm/compiler_test.cc b/runtime/vm/compiler_test.cc
index 5225c53..6e44b6c 100644
--- a/runtime/vm/compiler_test.cc
+++ b/runtime/vm/compiler_test.cc
@@ -102,10 +102,13 @@
   ASSERT(isolate->background_compiler() != NULL);
   isolate->background_compiler()->CompileOptimized(func);
   Monitor* m = new Monitor();
-  MonitorLocker ml(m);
-  while (!func.HasOptimizedCode()) {
-    ml.WaitWithSafepointCheck(thread, 1);
+  {
+    MonitorLocker ml(m);
+    while (!func.HasOptimizedCode()) {
+      ml.WaitWithSafepointCheck(thread, 1);
+    }
   }
+  delete m;
   BackgroundCompiler::Stop(isolate);
 }
 
diff --git a/runtime/vm/constants_arm64.h b/runtime/vm/constants_arm64.h
index 542fd52..bafbc73 100644
--- a/runtime/vm/constants_arm64.h
+++ b/runtime/vm/constants_arm64.h
@@ -810,7 +810,7 @@
                                    uint8_t width) {
   ASSERT(width <= 64);
   rotate &= 63;
-  return ((value & ((1UL << rotate) - 1UL)) << (width - rotate)) |
+  return ((value & ((1ULL << rotate) - 1ULL)) << (width - rotate)) |
          (value >> rotate);
 }
 
@@ -820,7 +820,7 @@
   ASSERT((width == 2) || (width == 4) || (width == 8) || (width == 16) ||
          (width == 32));
   ASSERT((reg_size == kWRegSizeInBits) || (reg_size == kXRegSizeInBits));
-  uint64_t result = value & ((1UL << width) - 1UL);
+  uint64_t result = value & ((1ULL << width) - 1ULL);
   for (unsigned i = width; i < reg_size; i *= 2) {
     result |= (result << i);
   }
@@ -1087,7 +1087,7 @@
       if (imm_s == 0x3F) {
         return 0;
       }
-      uint64_t bits = (1UL << (imm_s + 1)) - 1;
+      uint64_t bits = (1ULL << (imm_s + 1)) - 1;
       return RotateRight(bits, imm_r, 64);
     } else {
       if ((imm_s >> 1) == 0x1F) {
@@ -1099,7 +1099,7 @@
           if ((imm_s & mask) == mask) {
             return 0;
           }
-          uint64_t bits = (1UL << ((imm_s & mask) + 1)) - 1;
+          uint64_t bits = (1ULL << ((imm_s & mask) + 1)) - 1;
           return RepeatBitsAcrossReg(
               reg_size, RotateRight(bits, imm_r & mask, width), width);
         }
diff --git a/runtime/vm/constants_dbc.h b/runtime/vm/constants_dbc.h
index cf14318..00e0793 100644
--- a/runtime/vm/constants_dbc.h
+++ b/runtime/vm/constants_dbc.h
@@ -821,6 +821,7 @@
   V(CheckDenseSwitch,              A_D, reg, num, ___) \
   V(CheckCids,                   A_B_C, reg, num, num) \
   V(CheckStack,                      0, ___, ___, ___) \
+  V(CheckStackAlwaysExit,            0, ___, ___, ___) \
   V(DebugStep,                       0, ___, ___, ___) \
   V(DebugBreak,                      A, num, ___, ___) \
   V(Deopt,                         A_D, num, num, ___)
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 07547de..c72d431 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -16,6 +16,7 @@
 #include "vm/handles.h"
 #include "vm/heap.h"
 #include "vm/isolate.h"
+#include "vm/kernel_isolate.h"
 #include "vm/message_handler.h"
 #include "vm/metrics.h"
 #include "vm/object.h"
@@ -43,13 +44,11 @@
 DEFINE_FLAG(bool, trace_shutdown, false, "Trace VM shutdown on stderr");
 
 Isolate* Dart::vm_isolate_ = NULL;
-int64_t Dart::start_time_ = 0;
+int64_t Dart::start_time_micros_ = 0;
 ThreadPool* Dart::thread_pool_ = NULL;
 DebugInfo* Dart::pprof_symbol_generator_ = NULL;
 ReadOnlyHandles* Dart::predefined_handles_ = NULL;
-Snapshot::Kind Dart::snapshot_kind_ = Snapshot::kInvalid;
-const uint8_t* Dart::instructions_snapshot_buffer_ = NULL;
-const uint8_t* Dart::data_snapshot_buffer_ = NULL;
+Snapshot::Kind Dart::vm_snapshot_kind_ = Snapshot::kInvalid;
 Dart_ThreadExitCallback Dart::thread_exit_callback_ = NULL;
 Dart_FileOpenCallback Dart::file_open_callback_ = NULL;
 Dart_FileReadCallback Dart::file_read_callback_ = NULL;
@@ -123,7 +122,6 @@
 
 char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot,
                      const uint8_t* instructions_snapshot,
-                     const uint8_t* data_snapshot,
                      Dart_IsolateCreateCallback create,
                      Dart_IsolateShutdownCallback shutdown,
                      Dart_ThreadExitCallback thread_exit,
@@ -138,10 +136,19 @@
   if (vm_isolate_ != NULL || !Flags::Initialized()) {
     return strdup("VM already initialized or flags not initialized.");
   }
+#if defined(DEBUG)
+  // Turn on verify_gc_contains if any of the other GC verification flag
+  // is turned on.
+  if (FLAG_verify_before_gc || FLAG_verify_after_gc ||
+      FLAG_verify_on_transition) {
+    FLAG_verify_gc_contains = true;
+  }
+#endif
   set_thread_exit_callback(thread_exit);
   SetFileCallbacks(file_open, file_read, file_write, file_close);
   set_entropy_source_callback(entropy_source);
   OS::InitOnce();
+  start_time_micros_ = OS::GetCurrentMonotonicMicros();
   VirtualMemory::InitOnce();
   OSThread::InitOnce();
   if (FLAG_support_timeline) {
@@ -182,7 +189,6 @@
     Dart_IsolateFlags api_flags;
     Isolate::FlagsInitialize(&api_flags);
     vm_isolate_ = Isolate::Init("vm-isolate", api_flags, is_vm_isolate);
-    start_time_ = vm_isolate_->start_time();
     // Verify assumptions about executing in the VM isolate.
     ASSERT(vm_isolate_ == Isolate::Current());
     ASSERT(vm_isolate_ == Thread::Current()->isolate());
@@ -204,10 +210,10 @@
       if (snapshot == NULL) {
         return strdup("Invalid vm isolate snapshot seen");
       }
-      snapshot_kind_ = snapshot->kind();
+      vm_snapshot_kind_ = snapshot->kind();
 
-      if (Snapshot::IncludesCode(snapshot_kind_)) {
-        if (snapshot_kind_ == Snapshot::kAppNoJIT) {
+      if (Snapshot::IncludesCode(vm_snapshot_kind_)) {
+        if (vm_snapshot_kind_ == Snapshot::kAppAOT) {
 #if defined(DART_PRECOMPILED_RUNTIME)
           vm_isolate_->set_compilation_allowed(false);
           if (!FLAG_precompiled_runtime) {
@@ -220,30 +226,17 @@
         if (instructions_snapshot == NULL) {
           return strdup("Missing instructions snapshot");
         }
-        if (data_snapshot == NULL) {
-          return strdup("Missing rodata snapshot");
-        }
-        vm_isolate_->SetupInstructionsSnapshotPage(instructions_snapshot);
-        vm_isolate_->SetupDataSnapshotPage(data_snapshot);
-      } else if (Snapshot::IsFull(snapshot_kind_)) {
+      } else if (Snapshot::IsFull(vm_snapshot_kind_)) {
 #if defined(DART_PRECOMPILED_RUNTIME)
         return strdup("Precompiled runtime requires a precompiled snapshot");
 #else
-        if (instructions_snapshot != NULL) {
-          return strdup("Unexpected instructions snapshot");
-        }
-        if (data_snapshot != NULL) {
-          return strdup("Unexpected rodata snapshot");
-        }
         StubCode::InitOnce();
 #endif
       } else {
         return strdup("Invalid vm isolate snapshot seen");
       }
-      VmIsolateSnapshotReader reader(snapshot->kind(), snapshot->content(),
-                                     snapshot->length(), instructions_snapshot,
-                                     data_snapshot, T);
-      const Error& error = Error::Handle(reader.ReadVmIsolateSnapshot());
+      FullSnapshotReader reader(snapshot, instructions_snapshot, T);
+      const Error& error = Error::Handle(reader.ReadVMSnapshot());
       if (!error.IsNull()) {
         // Must copy before leaving the zone.
         return strdup(error.ToErrorCString());
@@ -274,7 +267,7 @@
 #elif !defined(DART_NO_SNAPSHOT)
       return strdup("Missing vm isolate snapshot");
 #else
-      snapshot_kind_ = Snapshot::kNone;
+      vm_snapshot_kind_ = Snapshot::kNone;
       StubCode::InitOnce();
       Symbols::InitOnce(vm_isolate_);
 #endif
@@ -312,6 +305,10 @@
 
   ServiceIsolate::Run();
 
+#ifndef DART_PRECOMPILED_RUNTIME
+  KernelIsolate::Run();
+#endif  // DART_PRECOMPILED_RUNTIME
+
   return NULL;
 }
 
@@ -353,14 +350,15 @@
   }
 
   if (FLAG_trace_shutdown) {
-    OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Starting shutdown\n", timestamp());
+    OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Starting shutdown\n",
+                 UptimeMillis());
   }
 
   if (FLAG_profiler) {
     // Shut down profiling.
     if (FLAG_trace_shutdown) {
       OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down profiling\n",
-                   timestamp());
+                   UptimeMillis());
     }
     Profiler::Shutdown();
   }
@@ -371,7 +369,7 @@
     // Metrics so that we can use a StackZone.
     if (FLAG_trace_shutdown) {
       OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Entering vm isolate\n",
-                   timestamp());
+                   UptimeMillis());
     }
     bool result = Thread::EnterIsolate(vm_isolate_);
     ASSERT(result);
@@ -382,14 +380,14 @@
   // Disable the creation of new isolates.
   if (FLAG_trace_shutdown) {
     OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Disabling isolate creation\n",
-                 timestamp());
+                 UptimeMillis());
   }
   Isolate::DisableIsolateCreation();
 
   // Send the OOB Kill message to all remaining application isolates.
   if (FLAG_trace_shutdown) {
     OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Killing all app isolates\n",
-                 timestamp());
+                 UptimeMillis());
   }
   Isolate::KillAllIsolates(Isolate::kInternalKillMsg);
 
@@ -398,7 +396,7 @@
   if (ServiceIsolate::IsRunning()) {
     if (FLAG_trace_shutdown) {
       OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down app isolates\n",
-                   timestamp());
+                   UptimeMillis());
     }
     WaitForApplicationIsolateShutdown();
   }
@@ -406,7 +404,7 @@
   // Shutdown the service isolate.
   if (FLAG_trace_shutdown) {
     OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down service isolate\n",
-                 timestamp());
+                 UptimeMillis());
   }
   ServiceIsolate::Shutdown();
 
@@ -414,14 +412,14 @@
   // before shutting down the thread pool.
   if (FLAG_trace_shutdown) {
     OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Waiting for isolate shutdown\n",
-                 timestamp());
+                 UptimeMillis());
   }
   WaitForIsolateShutdown();
 
   // Shutdown the thread pool. On return, all thread pool threads have exited.
   if (FLAG_trace_shutdown) {
     OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleting thread pool\n",
-                 timestamp());
+                 UptimeMillis());
   }
   delete thread_pool_;
   thread_pool_ = NULL;
@@ -434,14 +432,14 @@
   // pool, messing up its bookkeeping.
   if (FLAG_trace_shutdown) {
     OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Disabling OS Thread creation\n",
-                 timestamp());
+                 UptimeMillis());
   }
   OSThread::DisableOSThreadCreation();
 
   // Set the VM isolate as current isolate.
   if (FLAG_trace_shutdown) {
     OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Cleaning up vm isolate\n",
-                 timestamp());
+                 UptimeMillis());
   }
   bool result = Thread::EnterIsolate(vm_isolate_);
   ASSERT(result);
@@ -460,23 +458,24 @@
   OSThread::SetCurrent(NULL);
   delete os_thread;
   if (FLAG_trace_shutdown) {
-    OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleted os_thread\n", timestamp());
+    OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleted os_thread\n",
+                 UptimeMillis());
   }
 
   if (FLAG_trace_shutdown) {
     OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Deleting code observers\n",
-                 timestamp());
+                 UptimeMillis());
   }
   NOT_IN_PRODUCT(CodeObservers::DeleteAll());
   if (FLAG_support_timeline) {
     if (FLAG_trace_shutdown) {
       OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Shutting down timeline\n",
-                   timestamp());
+                   UptimeMillis());
     }
     Timeline::Shutdown();
   }
   if (FLAG_trace_shutdown) {
-    OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", timestamp());
+    OS::PrintErr("[+%" Pd64 "ms] SHUTDOWN: Done\n", UptimeMillis());
   }
 
   return NULL;
@@ -491,7 +490,17 @@
 }
 
 
-RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer,
+static bool IsSnapshotCompatible(Snapshot::Kind vm_kind,
+                                 Snapshot::Kind isolate_kind) {
+  if (vm_kind == isolate_kind) return true;
+  if (vm_kind == Snapshot::kCore && isolate_kind == Snapshot::kAppJIT)
+    return true;
+  return Snapshot::IsFull(isolate_kind);
+}
+
+
+RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data,
+                                  const uint8_t* snapshot_instructions,
                                   intptr_t snapshot_length,
                                   kernel::Program* kernel_program,
                                   void* data) {
@@ -516,31 +525,28 @@
   if (!error.IsNull()) {
     return error.raw();
   }
-  if ((snapshot_buffer != NULL) && kernel_program == NULL) {
+  if ((snapshot_data != NULL) && kernel_program == NULL) {
     // Read the snapshot and setup the initial state.
     NOT_IN_PRODUCT(TimelineDurationScope tds(T, Timeline::GetIsolateStream(),
                                              "IsolateSnapshotReader"));
     // TODO(turnidge): Remove once length is not part of the snapshot.
-    const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer);
+    const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_data);
     if (snapshot == NULL) {
       const String& message = String::Handle(String::New("Invalid snapshot"));
       return ApiError::New(message);
     }
-    if (snapshot->kind() != snapshot_kind_) {
-      const String& message = String::Handle(
-          String::NewFormatted("Invalid snapshot kind: got '%s', expected '%s'",
-                               Snapshot::KindToCString(snapshot->kind()),
-                               Snapshot::KindToCString(snapshot_kind_)));
+    if (!IsSnapshotCompatible(vm_snapshot_kind_, snapshot->kind())) {
+      const String& message = String::Handle(String::NewFormatted(
+          "Incompatible snapshot kinds: vm '%s', isolate '%s'",
+          Snapshot::KindToCString(vm_snapshot_kind_),
+          Snapshot::KindToCString(snapshot->kind())));
       return ApiError::New(message);
     }
-    ASSERT(Snapshot::IsFull(snapshot->kind()));
     if (FLAG_trace_isolates) {
       OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length());
     }
-    IsolateSnapshotReader reader(
-        snapshot->kind(), snapshot->content(), snapshot->length(),
-        Dart::instructions_snapshot_buffer(), Dart::data_snapshot_buffer(), T);
-    const Error& error = Error::Handle(reader.ReadFullSnapshot());
+    FullSnapshotReader reader(snapshot, snapshot_instructions, T);
+    const Error& error = Error::Handle(reader.ReadIsolateSnapshot());
     if (!error.IsNull()) {
       return error.raw();
     }
@@ -557,7 +563,7 @@
       MegamorphicCacheTable::PrintSizes(I);
     }
   } else {
-    if ((snapshot_kind_ != Snapshot::kNone) && kernel_program == NULL) {
+    if ((vm_snapshot_kind_ != Snapshot::kNone) && kernel_program == NULL) {
       const String& message =
           String::Handle(String::New("Missing isolate snapshot"));
       return ApiError::New(message);
@@ -573,19 +579,22 @@
     StubCode::Init(I);
   }
 
-#if !defined(DART_PRECOMPILED_RUNTIME)
-  // When running precompiled, the megamorphic miss function/code comes from the
-  // snapshot.
-  if (!Snapshot::IncludesCode(Dart::snapshot_kind())) {
+#if defined(DART_PRECOMPILED_RUNTIME)
+  // AOT: The megamorphic miss function and code come from the snapshot.
+  ASSERT(I->object_store()->megamorphic_miss_code() != Code::null());
+#else
+  // JIT: The megamorphic miss function and code come from the snapshot in JIT
+  // app snapshot, otherwise create them.
+  if (I->object_store()->megamorphic_miss_code() == Code::null()) {
     MegamorphicCacheTable::InitMissHandler(I);
   }
-#endif
+#endif  // defined(DART_PRECOMPILED_RUNTIME)
 
   const Code& miss_code =
       Code::Handle(I->object_store()->megamorphic_miss_code());
   I->set_ic_miss_code(miss_code);
 
-  if ((snapshot_buffer == NULL) || (kernel_program != NULL)) {
+  if ((snapshot_data == NULL) || (kernel_program != NULL)) {
     const Error& error = Error::Handle(I->object_store()->PreallocateObjects());
     if (!error.IsNull()) {
       return error.raw();
@@ -599,6 +608,9 @@
     I->class_table()->Print();
   }
 
+#ifndef DART_PRECOMPILED_RUNTIME
+  KernelIsolate::InitCallback(I);
+#endif
   ServiceIsolate::MaybeMakeServiceIsolate(I);
   if (!ServiceIsolate::IsServiceIsolate(I)) {
     I->message_handler()->set_should_pause_on_start(
@@ -704,9 +716,8 @@
 }
 
 
-int64_t Dart::timestamp() {
-  return ((OS::GetCurrentTimeMicros() - Dart::start_time_) /
-          kMillisecondsPerSecond);
+int64_t Dart::UptimeMicros() {
+  return OS::GetCurrentMonotonicMicros() - Dart::start_time_micros_;
 }
 
 
diff --git a/runtime/vm/dart.h b/runtime/vm/dart.h
index 9af4ed9..b4376dd 100644
--- a/runtime/vm/dart.h
+++ b/runtime/vm/dart.h
@@ -24,9 +24,8 @@
 
 class Dart : public AllStatic {
  public:
-  static char* InitOnce(const uint8_t* vm_isolate_snapshot,
-                        const uint8_t* instructions_snapshot,
-                        const uint8_t* data_snapshot,
+  static char* InitOnce(const uint8_t* vm_snapshot_data,
+                        const uint8_t* vm_snapshot_instructions,
                         Dart_IsolateCreateCallback create,
                         Dart_IsolateShutdownCallback shutdown,
                         Dart_ThreadExitCallback thread_exit,
@@ -45,7 +44,8 @@
   // from SDK library sources.  If the snapshot_buffer is non-NULL,
   // initialize from a snapshot or a Kernel binary depending on the value of
   // from_kernel.  Otherwise, initialize from sources.
-  static RawError* InitializeIsolate(const uint8_t* snapshot_buffer,
+  static RawError* InitializeIsolate(const uint8_t* snapshot_data,
+                                     const uint8_t* snapshot_instructions,
                                      intptr_t snapshot_length,
                                      kernel::Program* kernel_program,
                                      void* data);
@@ -56,9 +56,10 @@
   static Isolate* vm_isolate() { return vm_isolate_; }
   static ThreadPool* thread_pool() { return thread_pool_; }
 
-  // Returns a timestamp for use in debugging output in milliseconds
-  // since start time.
-  static int64_t timestamp();
+  static int64_t UptimeMicros();
+  static int64_t UptimeMillis() {
+    return UptimeMicros() / kMicrosecondsPerMillisecond;
+  }
 
   static void set_pprof_symbol_generator(DebugInfo* value) {
     pprof_symbol_generator_ = value;
@@ -72,18 +73,7 @@
   static bool IsReadOnlyHandle(uword address);
 
   static const char* FeaturesString(Snapshot::Kind kind);
-
-  static Snapshot::Kind snapshot_kind() { return snapshot_kind_; }
-  static const uint8_t* instructions_snapshot_buffer() {
-    return instructions_snapshot_buffer_;
-  }
-  static void set_instructions_snapshot_buffer(const uint8_t* buffer) {
-    instructions_snapshot_buffer_ = buffer;
-  }
-  static const uint8_t* data_snapshot_buffer() { return data_snapshot_buffer_; }
-  static void set_data_snapshot_buffer(const uint8_t* buffer) {
-    data_snapshot_buffer_ = buffer;
-  }
+  static Snapshot::Kind vm_snapshot_kind() { return vm_snapshot_kind_; }
 
   static Dart_ThreadExitCallback thread_exit_callback() {
     return thread_exit_callback_;
@@ -126,13 +116,11 @@
   static void WaitForApplicationIsolateShutdown();
 
   static Isolate* vm_isolate_;
-  static int64_t start_time_;
+  static int64_t start_time_micros_;
   static ThreadPool* thread_pool_;
   static DebugInfo* pprof_symbol_generator_;
   static ReadOnlyHandles* predefined_handles_;
-  static Snapshot::Kind snapshot_kind_;
-  static const uint8_t* instructions_snapshot_buffer_;
-  static const uint8_t* data_snapshot_buffer_;
+  static Snapshot::Kind vm_snapshot_kind_;
   static Dart_ThreadExitCallback thread_exit_callback_;
   static Dart_FileOpenCallback file_open_callback_;
   static Dart_FileReadCallback file_read_callback_;
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 2e739e1..2b4b954 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -25,6 +25,7 @@
 #include "vm/growable_array.h"
 #include "vm/lockers.h"
 #include "vm/isolate_reload.h"
+#include "vm/kernel_isolate.h"
 #include "vm/message.h"
 #include "vm/message_handler.h"
 #include "vm/native_entry.h"
@@ -35,6 +36,7 @@
 #include "vm/port.h"
 #include "vm/precompiler.h"
 #include "vm/profiler.h"
+#include "vm/program_visitor.h"
 #include "vm/resolver.h"
 #include "vm/reusable_handles.h"
 #include "vm/service_event.h"
@@ -111,9 +113,9 @@
 // An object visitor which will iterate over all the function objects in the
 // heap and check if the result type and parameter types are canonicalized
 // or not. An assertion is raised if a type is not canonicalized.
-class FunctionVisitor : public ObjectVisitor {
+class CheckFunctionTypesVisitor : public ObjectVisitor {
  public:
-  explicit FunctionVisitor(Thread* thread)
+  explicit CheckFunctionTypesVisitor(Thread* thread)
       : classHandle_(Class::Handle(thread->zone())),
         funcHandle_(Function::Handle(thread->zone())),
         typeHandle_(AbstractType::Handle(thread->zone())) {}
@@ -532,6 +534,22 @@
 }
 
 
+bool Api::IsValid(Dart_Handle handle) {
+  Isolate* isolate = Isolate::Current();
+  CHECK_ISOLATE(isolate);
+
+  // Check against all of the handles in the current isolate as well as the
+  // read-only handles.
+  return isolate->thread_registry()->IsValidHandle(handle) ||
+         isolate->api_state()->IsActivePersistentHandle(
+             reinterpret_cast<Dart_PersistentHandle>(handle)) ||
+         isolate->api_state()->IsActiveWeakPersistentHandle(
+             reinterpret_cast<Dart_WeakPersistentHandle>(handle)) ||
+         Dart::IsReadOnlyApiHandle(handle) ||
+         Dart::IsReadOnlyHandle(reinterpret_cast<uword>(handle));
+}
+
+
 ApiLocalScope* Api::TopScope(Thread* thread) {
   ASSERT(thread != NULL);
   ApiLocalScope* scope = thread->api_top_scope();
@@ -825,7 +843,7 @@
 }
 
 
-DART_EXPORT Dart_Handle Dart_ErrorGetStacktrace(Dart_Handle handle) {
+DART_EXPORT Dart_Handle Dart_ErrorGetStackTrace(Dart_Handle handle) {
   DARTSCOPE(Thread::Current());
   const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
   if (obj.IsUnhandledException()) {
@@ -865,7 +883,7 @@
       RETURN_TYPE_ERROR(Z, exception, Instance);
     }
   }
-  const Stacktrace& stacktrace = Stacktrace::Handle(Z);
+  const StackTrace& stacktrace = StackTrace::Handle(Z);
   return Api::NewHandle(T, UnhandledException::New(obj, stacktrace));
 }
 
@@ -1170,12 +1188,11 @@
         "Invalid Dart_InitializeParams version.");
   }
 
-  return Dart::InitOnce(params->vm_isolate_snapshot,
-                        params->instructions_snapshot, params->data_snapshot,
-                        params->create, params->shutdown, params->thread_exit,
-                        params->file_open, params->file_read,
-                        params->file_write, params->file_close,
-                        params->entropy_source, params->get_service_assets);
+  return Dart::InitOnce(
+      params->vm_snapshot_data, params->vm_snapshot_instructions,
+      params->create, params->shutdown, params->thread_exit, params->file_open,
+      params->file_read, params->file_write, params->file_close,
+      params->entropy_source, params->get_service_assets);
 }
 
 
@@ -1238,7 +1255,8 @@
 
 static Dart_Isolate CreateIsolate(const char* script_uri,
                                   const char* main,
-                                  const uint8_t* snapshot_buffer,
+                                  const uint8_t* snapshot_data,
+                                  const uint8_t* snapshot_instructions,
                                   intptr_t snapshot_length,
                                   kernel::Program* kernel_program,
                                   Dart_IsolateFlags* flags,
@@ -1267,9 +1285,10 @@
     // bootstrap library files which call out to a tag handler that may create
     // Api Handles when an error is encountered.
     Dart_EnterScope();
-    const Error& error_obj = Error::Handle(
-        Z, Dart::InitializeIsolate(snapshot_buffer, snapshot_length,
-                                   kernel_program, callback_data));
+    const Error& error_obj =
+        Error::Handle(Z, Dart::InitializeIsolate(
+                             snapshot_data, snapshot_instructions,
+                             snapshot_length, kernel_program, callback_data));
     if (error_obj.IsNull()) {
 #if defined(DART_NO_SNAPSHOT) && !defined(PRODUCT)
       if (FLAG_check_function_fingerprints && kernel_program == NULL) {
@@ -1295,14 +1314,16 @@
 }
 
 
-DART_EXPORT Dart_Isolate Dart_CreateIsolate(const char* script_uri,
-                                            const char* main,
-                                            const uint8_t* snapshot_buffer,
-                                            Dart_IsolateFlags* flags,
-                                            void* callback_data,
-                                            char** error) {
-  return CreateIsolate(script_uri, main, snapshot_buffer, -1, NULL, flags,
-                       callback_data, error);
+DART_EXPORT Dart_Isolate
+Dart_CreateIsolate(const char* script_uri,
+                   const char* main,
+                   const uint8_t* snapshot_data,
+                   const uint8_t* snapshot_instructions,
+                   Dart_IsolateFlags* flags,
+                   void* callback_data,
+                   char** error) {
+  return CreateIsolate(script_uri, main, snapshot_data, snapshot_instructions,
+                       -1, NULL, flags, callback_data, error);
 }
 
 
@@ -1312,7 +1333,7 @@
                                                       Dart_IsolateFlags* flags,
                                                       void* callback_data,
                                                       char** error) {
-  return CreateIsolate(script_uri, main, NULL, -1,
+  return CreateIsolate(script_uri, main, NULL, NULL, -1,
                        reinterpret_cast<kernel::Program*>(kernel_program),
                        flags, callback_data, error);
 }
@@ -1542,10 +1563,10 @@
 
 
 DART_EXPORT Dart_Handle
-Dart_CreateSnapshot(uint8_t** vm_isolate_snapshot_buffer,
-                    intptr_t* vm_isolate_snapshot_size,
-                    uint8_t** isolate_snapshot_buffer,
-                    intptr_t* isolate_snapshot_size) {
+Dart_CreateSnapshot(uint8_t** vm_snapshot_data_buffer,
+                    intptr_t* vm_snapshot_data_size,
+                    uint8_t** isolate_snapshot_data_buffer,
+                    intptr_t* isolate_snapshot_data_size) {
   DARTSCOPE(Thread::Current());
   API_TIMELINE_DURATION;
   Isolate* I = T->isolate();
@@ -1553,14 +1574,14 @@
     return Api::NewError(
         "Creating full snapshots requires --load_deferred_eagerly");
   }
-  if (vm_isolate_snapshot_buffer != NULL && vm_isolate_snapshot_size == NULL) {
-    RETURN_NULL_ERROR(vm_isolate_snapshot_size);
+  if (vm_snapshot_data_buffer != NULL && vm_snapshot_data_size == NULL) {
+    RETURN_NULL_ERROR(vm_snapshot_data_size);
   }
-  if (isolate_snapshot_buffer == NULL) {
-    RETURN_NULL_ERROR(isolate_snapshot_buffer);
+  if (isolate_snapshot_data_buffer == NULL) {
+    RETURN_NULL_ERROR(isolate_snapshot_data_buffer);
   }
-  if (isolate_snapshot_size == NULL) {
-    RETURN_NULL_ERROR(isolate_snapshot_size);
+  if (isolate_snapshot_data_size == NULL) {
+    RETURN_NULL_ERROR(isolate_snapshot_data_size);
   }
   // Finalize all classes if needed.
   Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
@@ -1571,71 +1592,57 @@
 
 #if defined(DEBUG)
   I->heap()->CollectAllGarbage();
-  FunctionVisitor check_canonical(T);
+  CheckFunctionTypesVisitor check_canonical(T);
   I->heap()->IterateObjects(&check_canonical);
 #endif  // #if defined(DEBUG)
 
-  FullSnapshotWriter writer(Snapshot::kCore, vm_isolate_snapshot_buffer,
-                            isolate_snapshot_buffer, ApiReallocate,
-                            NULL /* instructions_writer */);
+  Symbols::Compact(I);
+
+  FullSnapshotWriter writer(Snapshot::kCore, vm_snapshot_data_buffer,
+                            isolate_snapshot_data_buffer, ApiReallocate,
+                            NULL /* vm_image_writer */,
+                            NULL /* isolate_image_writer */);
   writer.WriteFullSnapshot();
-  *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
-  *isolate_snapshot_size = writer.IsolateSnapshotSize();
+  if (vm_snapshot_data_buffer != NULL) {
+    *vm_snapshot_data_size = writer.VmIsolateSnapshotSize();
+  }
+  *isolate_snapshot_data_size = writer.IsolateSnapshotSize();
   return Api::Success();
 }
 
 
-static Dart_Handle createLibrarySnapshot(Dart_Handle library,
-                                         uint8_t** buffer,
-                                         intptr_t* size) {
+DART_EXPORT Dart_Handle
+Dart_CreateScriptSnapshot(uint8_t** script_snapshot_buffer,
+                          intptr_t* script_snapshot_size) {
+  API_TIMELINE_DURATION;
   DARTSCOPE(Thread::Current());
   Isolate* I = T->isolate();
-  if (buffer == NULL) {
-    RETURN_NULL_ERROR(buffer);
+  if (script_snapshot_buffer == NULL) {
+    RETURN_NULL_ERROR(script_snapshot_buffer);
   }
-  if (size == NULL) {
-    RETURN_NULL_ERROR(size);
+  if (script_snapshot_size == NULL) {
+    RETURN_NULL_ERROR(script_snapshot_size);
   }
   // Finalize all classes if needed.
   Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
   if (::Dart_IsError(state)) {
     return state;
   }
-  Library& lib = Library::Handle(Z);
-  if (library == Dart_Null()) {
-    lib ^= I->object_store()->root_library();
-  } else {
-    lib ^= Api::UnwrapHandle(library);
-  }
+  Library& lib = Library::Handle(Z, I->object_store()->root_library());
 
 #if defined(DEBUG)
   I->heap()->CollectAllGarbage();
-  FunctionVisitor check_canonical(T);
+  CheckFunctionTypesVisitor check_canonical(T);
   I->heap()->IterateObjects(&check_canonical);
 #endif  // #if defined(DEBUG)
 
-  ScriptSnapshotWriter writer(buffer, ApiReallocate);
+  ScriptSnapshotWriter writer(script_snapshot_buffer, ApiReallocate);
   writer.WriteScriptSnapshot(lib);
-  *size = writer.BytesWritten();
+  *script_snapshot_size = writer.BytesWritten();
   return Api::Success();
 }
 
 
-DART_EXPORT Dart_Handle Dart_CreateScriptSnapshot(uint8_t** buffer,
-                                                  intptr_t* size) {
-  API_TIMELINE_DURATION;
-  return createLibrarySnapshot(Dart_Null(), buffer, size);
-}
-
-
-DART_EXPORT Dart_Handle Dart_CreateLibrarySnapshot(Dart_Handle library,
-                                                   uint8_t** buffer,
-                                                   intptr_t* size) {
-  API_TIMELINE_DURATION;
-  return createLibrarySnapshot(library, buffer, size);
-}
-
-
 DART_EXPORT void Dart_InterruptIsolate(Dart_Isolate isolate) {
   if (isolate == NULL) {
     FATAL1("%s expects argument 'isolate' to be non-null.", CURRENT_FUNC);
@@ -1798,12 +1805,19 @@
 }
 
 
-static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
+static uint8_t* malloc_allocator(uint8_t* ptr,
+                                 intptr_t old_size,
+                                 intptr_t new_size) {
   void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
   return reinterpret_cast<uint8_t*>(new_ptr);
 }
 
 
+static void malloc_deallocator(uint8_t* ptr) {
+  free(reinterpret_cast<void*>(ptr));
+}
+
+
 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) {
   DARTSCOPE(Thread::Current());
   API_TIMELINE_DURATION;
@@ -1821,7 +1835,7 @@
 
   const Object& object = Object::Handle(Z, raw_obj);
   uint8_t* data = NULL;
-  MessageWriter writer(&data, &allocator, false);
+  MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
   writer.WriteMessage(object);
   intptr_t len = writer.BytesWritten();
   return PortMap::PostMessage(
@@ -3557,8 +3571,8 @@
     RETURN_TYPE_ERROR(Z, typed_data, 'TypedData');
   }
   Object& result = Object::Handle(Z);
-  result = GetByteBufferConstructor(T, Symbols::ByteBuffer(),
-                                    Symbols::ByteBufferDot_New(), 1);
+  result = GetByteBufferConstructor(T, Symbols::_ByteBuffer(),
+                                    Symbols::_ByteBufferDot_New(), 1);
   ASSERT(!result.IsNull());
   ASSERT(result.IsFunction());
   const Function& factory = Function::Cast(result);
@@ -3875,7 +3889,8 @@
   }
   if (constructor.IsGenerativeConstructor()) {
 #if defined(DEBUG)
-    if (!cls.is_allocated() && (Dart::snapshot_kind() == Snapshot::kAppNoJIT)) {
+    if (!cls.is_allocated() &&
+        (Dart::vm_snapshot_kind() == Snapshot::kAppAOT)) {
       return Api::NewError("Precompilation dropped '%s'", cls.ToCString());
     }
 #endif
@@ -3970,7 +3985,7 @@
   }
   const Class& cls = Class::Handle(Z, type_obj.type_class());
 #if defined(DEBUG)
-  if (!cls.is_allocated() && (Dart::snapshot_kind() == Snapshot::kAppNoJIT)) {
+  if (!cls.is_allocated() && (Dart::vm_snapshot_kind() == Snapshot::kAppAOT)) {
     return Api::NewError("Precompilation dropped '%s'", cls.ToCString());
   }
 #endif
@@ -4000,7 +4015,7 @@
   }
   const Class& cls = Class::Handle(Z, type_obj.type_class());
 #if defined(DEBUG)
-  if (!cls.is_allocated() && (Dart::snapshot_kind() == Snapshot::kAppNoJIT)) {
+  if (!cls.is_allocated() && (Dart::vm_snapshot_kind() == Snapshot::kAppAOT)) {
     return Api::NewError("Precompilation dropped '%s'", cls.ToCString());
   }
 #endif
@@ -4406,7 +4421,7 @@
           String::Handle(Z, Field::GetterName(field_name));
       getter = lib.LookupFunctionAllowPrivate(getter_name);
     } else if (!field.IsNull() && field.IsUninitialized()) {
-      // A field was found.  Check for a getter in the field's owner classs.
+      // A field was found.  Check for a getter in the field's owner class.
       const Class& cls = Class::Handle(Z, field.Owner());
       const String& getter_name =
           String::Handle(Z, Field::GetterName(field_name));
@@ -4657,16 +4672,16 @@
   // Unwind all the API scopes till the exit frame before throwing an
   // exception.
   const Instance* saved_exception;
-  const Stacktrace* saved_stacktrace;
+  const StackTrace* saved_stacktrace;
   {
     NoSafepointScope no_safepoint;
     RawInstance* raw_exception =
         Api::UnwrapInstanceHandle(zone, exception).raw();
-    RawStacktrace* raw_stacktrace =
-        Api::UnwrapStacktraceHandle(zone, stacktrace).raw();
+    RawStackTrace* raw_stacktrace =
+        Api::UnwrapStackTraceHandle(zone, stacktrace).raw();
     thread->UnwindScopes(thread->top_exit_frame_info());
     saved_exception = &Instance::Handle(raw_exception);
-    saved_stacktrace = &Stacktrace::Handle(raw_stacktrace);
+    saved_stacktrace = &StackTrace::Handle(raw_stacktrace);
   }
   Exceptions::ReThrow(thread, *saved_exception, *saved_stacktrace);
   return Api::NewError("Exception was not re thrown, internal error");
@@ -5028,7 +5043,7 @@
       !Api::IsError(retval)) {
     // Print the current stack trace to make the problematic caller
     // easier to find.
-    const Stacktrace& stacktrace = GetCurrentStacktrace(0);
+    const StackTrace& stacktrace = GetCurrentStackTrace(0);
     OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString());
 
     const Object& ret_obj = Object::Handle(Api::UnwrapHandle(retval));
@@ -5859,7 +5874,7 @@
     // Notify mirrors that MirrorSystem.libraries needs to be recomputed.
     const Library& libmirrors = Library::Handle(Z, Library::MirrorsLibrary());
     const Field& dirty_bit = Field::Handle(
-        Z, libmirrors.LookupLocalField(String::Handle(String::New("dirty"))));
+        Z, libmirrors.LookupLocalField(String::Handle(String::New("_dirty"))));
     ASSERT(!dirty_bit.IsNull() && dirty_bit.is_static());
     dirty_bit.SetStaticValue(Bool::True());
   }
@@ -5977,6 +5992,44 @@
 }
 
 
+// --- Dart Front-End (Kernel) support ---
+
+DART_EXPORT bool Dart_IsKernelIsolate(Dart_Isolate isolate) {
+#ifdef DART_PRECOMPILED_RUNTIME
+  return false;
+#else
+  Isolate* iso = reinterpret_cast<Isolate*>(isolate);
+  return KernelIsolate::IsKernelIsolate(iso);
+#endif
+}
+
+
+DART_EXPORT bool Dart_KernelIsolateIsRunning() {
+#ifdef DART_PRECOMPILED_RUNTIME
+  return false;
+#else
+  return KernelIsolate::IsRunning();
+#endif
+}
+
+
+DART_EXPORT Dart_Port Dart_ServiceWaitForKernelPort() {
+#ifdef DART_PRECOMPILED_RUNTIME
+  return ILLEGAL_PORT;
+#else
+  return KernelIsolate::WaitForKernelPort();
+#endif
+}
+
+DART_EXPORT Dart_Port Dart_KernelPort() {
+#ifdef DART_PRECOMPILED_RUNTIME
+  return false;
+#else
+  return KernelIsolate::KernelPort();
+#endif
+}
+
+
 // --- Service support ---
 
 DART_EXPORT bool Dart_IsServiceIsolate(Dart_Isolate isolate) {
@@ -6387,47 +6440,174 @@
 }
 
 
-// The precompiler is included in dart_bootstrap and dart_noopt, and
-// excluded from dart and dart_precompiled_runtime.
-#if !defined(DART_PRECOMPILER)
+DART_EXPORT
+Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, intptr_t* buffer_length) {
+#if defined(DART_PRECOMPILED_RUNTIME)
+  return Api::NewError("No JIT feedback to save on an AOT runtime.");
+#elif defined(PRODUCT)
+  // TOOD(rmacnak): We'd need to include the JSON printing code again.
+  return Api::NewError("Dart_SaveJITFeedback not supported in PRODUCT mode.");
+#else
+  Thread* thread = Thread::Current();
+  DARTSCOPE(thread);
+  Isolate* isolate = thread->isolate();
+  Zone* zone = thread->zone();
 
-DART_EXPORT Dart_Handle
-Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields) {
-  return Api::NewError(
-      "This VM was built without support for AOT compilation.");
+  if (buffer == NULL) {
+    RETURN_NULL_ERROR(buffer);
+  }
+  if (buffer_length == NULL) {
+    RETURN_NULL_ERROR(buffer_length);
+  }
+
+  JSONStream js_stream;
+  {
+    JSONObject js_profile(&js_stream);
+    js_profile.AddProperty("vmVersion", Version::CommitString());
+    js_profile.AddProperty("asserts", FLAG_enable_asserts);
+    js_profile.AddProperty("typeChecks", FLAG_enable_type_checks);
+
+    {
+      JSONArray js_scripts(&js_profile, "scripts");
+
+      const GrowableObjectArray& libraries = GrowableObjectArray::Handle(
+          zone, isolate->object_store()->libraries());
+      Library& library = Library::Handle(zone);
+      Array& scripts = Array::Handle(zone);
+      Script& script = Script::Handle(zone);
+      String& uri = String::Handle(zone);
+      for (intptr_t i = 0; i < libraries.Length(); i++) {
+        library ^= libraries.At(i);
+        scripts = library.LoadedScripts();
+        for (intptr_t j = 0; j < scripts.Length(); j++) {
+          script ^= scripts.At(j);
+          JSONObject js_script(&js_scripts);
+          uri = script.url();
+          js_script.AddProperty("uri", uri.ToCString());
+          int64_t fp = script.SourceFingerprint();
+          js_script.AddProperty64("checksum", fp);
+        }
+      }
+    }
+
+    {
+      JSONArray js_classes(&js_profile, "classes");
+
+      ClassTable* classes = isolate->class_table();
+      Class& cls = Class::Handle(zone);
+      Library& library = Library::Handle(zone);
+      String& uri = String::Handle(zone);
+      String& name = String::Handle(zone);
+      for (intptr_t cid = kNumPredefinedCids; cid < classes->NumCids(); cid++) {
+        if (!classes->HasValidClassAt(cid)) continue;
+        cls ^= classes->At(cid);
+        library = cls.library();
+        JSONObject js_class(&js_classes);
+        js_class.AddProperty("cid", cid);
+        uri = library.url();
+        js_class.AddProperty("uri", uri.ToCString());
+        name = cls.Name();
+        name = String::RemovePrivateKey(name);
+        js_class.AddProperty("name", name.ToCString());
+      }
+    }
+
+    {
+      JSONArray js_functions(&js_profile, "functions");
+
+      class JITFeedbackFunctionVisitor : public FunctionVisitor {
+       public:
+        JITFeedbackFunctionVisitor(JSONArray* js_functions, Zone* zone)
+            : js_functions_(js_functions),
+              function_(Function::Handle(zone)),
+              owner_(Class::Handle(zone)),
+              name_(String::Handle(zone)),
+              ic_datas_(Array::Handle(zone)),
+              ic_data_(ICData::Handle(zone)),
+              entry_(Object::Handle(zone)) {}
+
+        void Visit(const Function& function) {
+          if (function.usage_counter() == 0) return;
+
+          JSONObject js_function(js_functions_);
+          name_ = function.name();
+          name_ = String::RemovePrivateKey(name_);
+          js_function.AddProperty("name", name_.ToCString());
+          owner_ ^= function.Owner();
+          js_function.AddProperty("class", owner_.id());
+          js_function.AddProperty("tokenPos", function.token_pos().value());
+          js_function.AddProperty("kind",
+                                  static_cast<intptr_t>(function.kind()));
+          intptr_t usage = function.usage_counter();
+          if (usage < 0) {
+            // Function was in the background compiler's queue.
+            usage = FLAG_optimization_counter_threshold;
+          }
+          js_function.AddProperty("usageCounter", usage);
+
+          ic_datas_ = function.ic_data_array();
+          JSONArray js_icdatas(&js_function, "ics");
+          if (ic_datas_.IsNull()) return;
+
+          for (intptr_t j = 0; j < ic_datas_.Length(); j++) {
+            entry_ = ic_datas_.At(j);
+            if (!entry_.IsICData()) continue;  // Skip edge counters.
+            ic_data_ ^= entry_.raw();
+
+            JSONObject js_icdata(&js_icdatas);
+            js_icdata.AddProperty("deoptId", ic_data_.deopt_id());
+            name_ = ic_data_.target_name();
+            name_ = String::RemovePrivateKey(name_);
+            js_icdata.AddProperty("selector", name_.ToCString());
+            js_icdata.AddProperty("isStaticCall", ic_data_.is_static_call());
+            intptr_t num_args_checked = ic_data_.NumArgsTested();
+            js_icdata.AddProperty("argsTested", num_args_checked);
+            JSONArray js_entries(&js_icdata, "entries");
+            for (intptr_t check = 0; check < ic_data_.NumberOfChecks();
+                 check++) {
+              GrowableArray<intptr_t> class_ids(num_args_checked);
+              ic_data_.GetClassIdsAt(check, &class_ids);
+              for (intptr_t k = 0; k < num_args_checked; k++) {
+                ASSERT(class_ids[k] != kIllegalCid);
+                js_entries.AddValue(class_ids[k]);
+              }
+              js_entries.AddValue(ic_data_.GetCountAt(check));
+            }
+          }
+        }
+
+       private:
+        JSONArray* js_functions_;
+        Function& function_;
+        Class& owner_;
+        String& name_;
+        Array& ic_datas_;
+        ICData& ic_data_;
+        Object& entry_;
+      };
+
+      JITFeedbackFunctionVisitor visitor(&js_functions, zone);
+      ProgramVisitor::VisitFunctions(&visitor);
+    }
+  }
+
+  js_stream.Steal(reinterpret_cast<char**>(buffer), buffer_length);
+  return Api::Success();
+#endif
 }
 
 
 DART_EXPORT Dart_Handle
-Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer,
-                                       intptr_t* assembly_size) {
-  return Api::NewError(
-      "This VM was built without support for AOT compilation.");
-  return 0;
-}
-
-
-DART_EXPORT Dart_Handle
-Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer,
-                                   intptr_t* vm_isolate_snapshot_size,
-                                   uint8_t** isolate_snapshot_buffer,
-                                   intptr_t* isolate_snapshot_size,
-                                   uint8_t** instructions_blob_buffer,
-                                   intptr_t* instructions_blob_size,
-                                   uint8_t** rodata_blob_buffer,
-                                   intptr_t* rodata_blob_size) {
-  return Api::NewError(
-      "This VM was built without support for AOT compilation.");
-}
-
-#else  // DART_PRECOMPILER
-
-DART_EXPORT Dart_Handle
-Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields) {
+Dart_Precompile(Dart_QualifiedFunctionName entry_points[],
+                uint8_t* jit_feedback,
+                intptr_t jit_feedback_length) {
 #if defined(TARGET_ARCH_IA32)
-  return Api::NewError("Precompilation is not supported on IA32.");
+  return Api::NewError("AOT compilation is not supported on IA32.");
 #elif defined(TARGET_ARCH_DBC)
-  return Api::NewError("Precompilation is not supported on DBC.");
+  return Api::NewError("AOT compilation is not supported on DBC.");
+#elif !defined(DART_PRECOMPILER)
+  return Api::NewError(
+      "This VM was built without support for AOT compilation.");
 #else
   API_TIMELINE_BEGIN_END;
   DARTSCOPE(Thread::Current());
@@ -6439,8 +6619,8 @@
     return result;
   }
   CHECK_CALLBACK_STATE(T);
-  const Error& error =
-      Error::Handle(Precompiler::CompileAll(entry_points, reset_fields));
+  const Error& error = Error::Handle(
+      Precompiler::CompileAll(entry_points, jit_feedback, jit_feedback_length));
   if (!error.IsNull()) {
     return Api::NewHandle(T, error.raw());
   }
@@ -6450,12 +6630,15 @@
 
 
 DART_EXPORT Dart_Handle
-Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer,
-                                       intptr_t* assembly_size) {
+Dart_CreateAppAOTSnapshotAsAssembly(uint8_t** assembly_buffer,
+                                    intptr_t* assembly_size) {
 #if defined(TARGET_ARCH_IA32)
-  return Api::NewError("Precompilation is not supported on IA32.");
+  return Api::NewError("AOT compilation is not supported on IA32.");
 #elif defined(TARGET_ARCH_DBC)
-  return Api::NewError("Precompilation is not supported on DBC.");
+  return Api::NewError("AOT compilation is not supported on DBC.");
+#elif !defined(DART_PRECOMPILER)
+  return Api::NewError(
+      "This VM was built without support for AOT compilation.");
 #else
   API_TIMELINE_DURATION;
   DARTSCOPE(Thread::Current());
@@ -6475,16 +6658,16 @@
 
   NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
                                             "WriteAppAOTSnapshot"));
-  AssemblyInstructionsWriter instructions_writer(assembly_buffer, ApiReallocate,
-                                                 2 * MB /* initial_size */);
-  uint8_t* vm_isolate_snapshot_buffer = NULL;
-  uint8_t* isolate_snapshot_buffer = NULL;
-  FullSnapshotWriter writer(Snapshot::kAppNoJIT, &vm_isolate_snapshot_buffer,
-                            &isolate_snapshot_buffer, ApiReallocate,
-                            &instructions_writer);
+  AssemblyImageWriter image_writer(assembly_buffer, ApiReallocate,
+                                   2 * MB /* initial_size */);
+  uint8_t* vm_snapshot_data_buffer = NULL;
+  uint8_t* isolate_snapshot_data_buffer = NULL;
+  FullSnapshotWriter writer(Snapshot::kAppAOT, &vm_snapshot_data_buffer,
+                            &isolate_snapshot_data_buffer, ApiReallocate,
+                            &image_writer, &image_writer);
 
   writer.WriteFullSnapshot();
-  *assembly_size = instructions_writer.AssemblySize();
+  *assembly_size = image_writer.AssemblySize();
 
   return Api::Success();
 #endif
@@ -6492,18 +6675,21 @@
 
 
 DART_EXPORT Dart_Handle
-Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer,
-                                   intptr_t* vm_isolate_snapshot_size,
-                                   uint8_t** isolate_snapshot_buffer,
-                                   intptr_t* isolate_snapshot_size,
-                                   uint8_t** instructions_blob_buffer,
-                                   intptr_t* instructions_blob_size,
-                                   uint8_t** rodata_blob_buffer,
-                                   intptr_t* rodata_blob_size) {
+Dart_CreateAppAOTSnapshotAsBlobs(uint8_t** vm_snapshot_data_buffer,
+                                 intptr_t* vm_snapshot_data_size,
+                                 uint8_t** vm_snapshot_instructions_buffer,
+                                 intptr_t* vm_snapshot_instructions_size,
+                                 uint8_t** isolate_snapshot_data_buffer,
+                                 intptr_t* isolate_snapshot_data_size,
+                                 uint8_t** isolate_snapshot_instructions_buffer,
+                                 intptr_t* isolate_snapshot_instructions_size) {
 #if defined(TARGET_ARCH_IA32)
-  return Api::NewError("Precompilation is not supported on IA32.");
+  return Api::NewError("AOT compilation is not supported on IA32.");
 #elif defined(TARGET_ARCH_DBC)
-  return Api::NewError("Precompilation is not supported on DBC.");
+  return Api::NewError("AOT compilation is not supported on DBC.");
+#elif !defined(DART_PRECOMPILER)
+  return Api::NewError(
+      "This VM was built without support for AOT compilation.");
 #else
   API_TIMELINE_DURATION;
   DARTSCOPE(Thread::Current());
@@ -6514,97 +6700,65 @@
         "Did you forget to call Dart_Precompile?");
   }
   ASSERT(FLAG_load_deferred_eagerly);
-  if (vm_isolate_snapshot_buffer == NULL) {
-    RETURN_NULL_ERROR(vm_isolate_snapshot_buffer);
+  if (vm_snapshot_data_buffer == NULL) {
+    RETURN_NULL_ERROR(vm_snapshot_data_buffer);
   }
-  if (vm_isolate_snapshot_size == NULL) {
-    RETURN_NULL_ERROR(vm_isolate_snapshot_size);
+  if (vm_snapshot_data_size == NULL) {
+    RETURN_NULL_ERROR(vm_snapshot_data_size);
   }
-  if (isolate_snapshot_buffer == NULL) {
-    RETURN_NULL_ERROR(isolate_snapshot_buffer);
+  if (vm_snapshot_instructions_buffer == NULL) {
+    RETURN_NULL_ERROR(vm_snapshot_instructions_buffer);
   }
-  if (isolate_snapshot_size == NULL) {
-    RETURN_NULL_ERROR(isolate_snapshot_size);
+  if (vm_snapshot_instructions_size == NULL) {
+    RETURN_NULL_ERROR(vm_snapshot_instructions_size);
   }
-  if (instructions_blob_buffer == NULL) {
-    RETURN_NULL_ERROR(instructions_blob_buffer);
+  if (isolate_snapshot_data_buffer == NULL) {
+    RETURN_NULL_ERROR(isolate_snapshot_data_buffer);
   }
-  if (instructions_blob_size == NULL) {
-    RETURN_NULL_ERROR(instructions_blob_size);
+  if (isolate_snapshot_data_size == NULL) {
+    RETURN_NULL_ERROR(isolate_snapshot_data_size);
   }
-  if (rodata_blob_buffer == NULL) {
-    RETURN_NULL_ERROR(instructions_blob_buffer);
+  if (isolate_snapshot_instructions_buffer == NULL) {
+    RETURN_NULL_ERROR(instructions_snapshot_blob_buffer);
   }
-  if (rodata_blob_size == NULL) {
-    RETURN_NULL_ERROR(instructions_blob_size);
+  if (isolate_snapshot_instructions_buffer == NULL) {
+    RETURN_NULL_ERROR(instructions_snapshot_blob_size);
   }
 
   NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
                                             "WriteAppAOTSnapshot"));
-  BlobInstructionsWriter instructions_writer(instructions_blob_buffer,
-                                             rodata_blob_buffer, ApiReallocate,
-                                             2 * MB /* initial_size */);
-  FullSnapshotWriter writer(Snapshot::kAppNoJIT, vm_isolate_snapshot_buffer,
-                            isolate_snapshot_buffer, ApiReallocate,
-                            &instructions_writer);
+  BlobImageWriter vm_image_writer(vm_snapshot_instructions_buffer,
+                                  ApiReallocate, 2 * MB /* initial_size */);
+  BlobImageWriter isolate_image_writer(isolate_snapshot_instructions_buffer,
+                                       ApiReallocate,
+                                       2 * MB /* initial_size */);
+  FullSnapshotWriter writer(Snapshot::kAppAOT, vm_snapshot_data_buffer,
+                            isolate_snapshot_data_buffer, ApiReallocate,
+                            &vm_image_writer, &isolate_image_writer);
 
   writer.WriteFullSnapshot();
-  *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
-  *isolate_snapshot_size = writer.IsolateSnapshotSize();
-  *instructions_blob_size = instructions_writer.InstructionsBlobSize();
-  *rodata_blob_size = instructions_writer.RodataBlobSize();
+  *vm_snapshot_data_size = writer.VmIsolateSnapshotSize();
+  *vm_snapshot_instructions_size = vm_image_writer.InstructionsBlobSize();
+  *isolate_snapshot_data_size = writer.IsolateSnapshotSize();
+  *isolate_snapshot_instructions_size =
+      isolate_image_writer.InstructionsBlobSize();
 
   return Api::Success();
 #endif
 }
-#endif  // DART_PRECOMPILER
-
-
-DART_EXPORT Dart_Handle Dart_PrecompileJIT() {
-  API_TIMELINE_BEGIN_END;
-  DARTSCOPE(Thread::Current());
-  Isolate* I = T->isolate();
-  Dart_Handle result = Api::CheckAndFinalizePendingClasses(T);
-  if (::Dart_IsError(result)) {
-    return result;
-  }
-  CHECK_CALLBACK_STATE(T);
-  GrowableObjectArray& libraries =
-      GrowableObjectArray::Handle(Z, I->object_store()->libraries());
-  Library& lib = Library::Handle(Z);
-  Class& cls = Class::Handle(Z);
-  Error& error = Error::Handle(Z);
-  for (intptr_t i = 0; i < libraries.Length(); i++) {
-    lib ^= libraries.At(i);
-    ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
-    while (it.HasNext()) {
-      cls = it.GetNextClass();
-      if (cls.IsDynamicClass()) {
-        continue;  // class 'dynamic' is in the read-only VM isolate.
-      }
-      error = cls.EnsureIsFinalized(T);
-      if (!error.IsNull()) {
-        return Api::NewHandle(T, error.raw());
-      }
-    }
-  }
-  return Api::Success();
-}
 
 
 DART_EXPORT Dart_Handle
-Dart_CreateAppJITSnapshot(uint8_t** vm_isolate_snapshot_buffer,
-                          intptr_t* vm_isolate_snapshot_size,
-                          uint8_t** isolate_snapshot_buffer,
-                          intptr_t* isolate_snapshot_size,
-                          uint8_t** instructions_blob_buffer,
-                          intptr_t* instructions_blob_size,
-                          uint8_t** rodata_blob_buffer,
-                          intptr_t* rodata_blob_size) {
+Dart_CreateAppJITSnapshotAsBlobs(uint8_t** isolate_snapshot_data_buffer,
+                                 intptr_t* isolate_snapshot_data_size,
+                                 uint8_t** isolate_snapshot_instructions_buffer,
+                                 intptr_t* isolate_snapshot_instructions_size) {
 #if defined(TARGET_ARCH_IA32)
   return Api::NewError("Snapshots with code are not supported on IA32.");
 #elif defined(TARGET_ARCH_DBC)
   return Api::NewError("Snapshots with code are not supported on DBC.");
+#elif defined(DART_PRECOMPILED_RUNTIME)
+  return Api::NewError("JIT app snapshots cannot be taken from an AOT runtime");
 #else
   API_TIMELINE_DURATION;
   DARTSCOPE(Thread::Current());
@@ -6613,29 +6767,17 @@
     return Api::NewError(
         "Creating full snapshots requires --load_deferred_eagerly");
   }
-  if (vm_isolate_snapshot_buffer == NULL) {
-    RETURN_NULL_ERROR(vm_isolate_snapshot_buffer);
+  if (isolate_snapshot_data_buffer == NULL) {
+    RETURN_NULL_ERROR(isolate_snapshot_data_buffer);
   }
-  if (vm_isolate_snapshot_size == NULL) {
-    RETURN_NULL_ERROR(vm_isolate_snapshot_size);
+  if (isolate_snapshot_data_size == NULL) {
+    RETURN_NULL_ERROR(isolate_snapshot_data_size);
   }
-  if (isolate_snapshot_buffer == NULL) {
-    RETURN_NULL_ERROR(isolate_snapshot_buffer);
+  if (isolate_snapshot_instructions_buffer == NULL) {
+    RETURN_NULL_ERROR(instructions_snapshot_blob_buffer);
   }
-  if (isolate_snapshot_size == NULL) {
-    RETURN_NULL_ERROR(isolate_snapshot_size);
-  }
-  if (instructions_blob_buffer == NULL) {
-    RETURN_NULL_ERROR(instructions_blob_buffer);
-  }
-  if (instructions_blob_size == NULL) {
-    RETURN_NULL_ERROR(instructions_blob_size);
-  }
-  if (rodata_blob_buffer == NULL) {
-    RETURN_NULL_ERROR(instructions_blob_buffer);
-  }
-  if (rodata_blob_size == NULL) {
-    RETURN_NULL_ERROR(instructions_blob_size);
+  if (isolate_snapshot_instructions_buffer == NULL) {
+    RETURN_NULL_ERROR(instructions_snapshot_blob_size);
   }
   // Finalize all classes if needed.
   Dart_Handle state = Api::CheckAndFinalizePendingClasses(T);
@@ -6644,19 +6786,21 @@
   }
   I->StopBackgroundCompiler();
 
+  Symbols::Compact(I);
+
   NOT_IN_PRODUCT(TimelineDurationScope tds2(T, Timeline::GetIsolateStream(),
                                             "WriteAppJITSnapshot"));
-  BlobInstructionsWriter instructions_writer(instructions_blob_buffer,
-                                             rodata_blob_buffer, ApiReallocate,
-                                             2 * MB /* initial_size */);
-  FullSnapshotWriter writer(Snapshot::kAppWithJIT, vm_isolate_snapshot_buffer,
-                            isolate_snapshot_buffer, ApiReallocate,
-                            &instructions_writer);
+  BlobImageWriter isolate_image_writer(isolate_snapshot_instructions_buffer,
+                                       ApiReallocate,
+                                       2 * MB /* initial_size */);
+  FullSnapshotWriter writer(Snapshot::kAppJIT, NULL,
+                            isolate_snapshot_data_buffer, ApiReallocate, NULL,
+                            &isolate_image_writer);
   writer.WriteFullSnapshot();
-  *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize();
-  *isolate_snapshot_size = writer.IsolateSnapshotSize();
-  *instructions_blob_size = instructions_writer.InstructionsBlobSize();
-  *rodata_blob_size = instructions_writer.RodataBlobSize();
+
+  *isolate_snapshot_data_size = writer.IsolateSnapshotSize();
+  *isolate_snapshot_instructions_size =
+      isolate_image_writer.InstructionsBlobSize();
 
   return Api::Success();
 #endif
diff --git a/runtime/vm/dart_api_impl.h b/runtime/vm/dart_api_impl.h
index f597ca2..d61a3f8 100644
--- a/runtime/vm/dart_api_impl.h
+++ b/runtime/vm/dart_api_impl.h
@@ -9,6 +9,7 @@
 #include "vm/native_arguments.h"
 #include "vm/object.h"
 #include "vm/safepoint.h"
+#include "vm/thread_registry.h"
 
 namespace dart {
 
@@ -18,6 +19,7 @@
 class LocalHandle;
 class PersistentHandle;
 class ReusableObjectHandleScope;
+class ThreadRegistry;
 
 const char* CanonicalFunction(const char* func);
 
@@ -166,6 +168,9 @@
     return (ClassId(handle) >= kInstanceCid);
   }
 
+  // Returns true if the handle is non-dangling.
+  static bool IsValid(Dart_Handle handle);
+
   // Returns true if the handle holds an Error.
   static bool IsError(Dart_Handle handle) {
     return RawObject::IsErrorClassId(ClassId(handle));
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 7ee03f7..eb84645 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -59,13 +59,13 @@
   EXPECT(Dart_IsError(Dart_ErrorGetException(error)));
   EXPECT_VALID(Dart_ErrorGetException(exception));
 
-  EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(instance)));
-  EXPECT(Dart_IsError(Dart_ErrorGetStacktrace(error)));
-  EXPECT_VALID(Dart_ErrorGetStacktrace(exception));
+  EXPECT(Dart_IsError(Dart_ErrorGetStackTrace(instance)));
+  EXPECT(Dart_IsError(Dart_ErrorGetStackTrace(error)));
+  EXPECT_VALID(Dart_ErrorGetStackTrace(exception));
 }
 
 
-TEST_CASE(StacktraceInfo) {
+TEST_CASE(StackTraceInfo) {
   const char* kScriptChars =
       "bar() => throw new Error();\n"
       "foo() => bar();\n"
@@ -136,7 +136,7 @@
 }
 
 
-TEST_CASE(DeepStacktraceInfo) {
+TEST_CASE(DeepStackTraceInfo) {
   const char* kScriptChars =
       "foo(n) => n == 1 ? throw new Error() : foo(n-1);\n"
       "testMain() => foo(50);\n";
@@ -156,7 +156,7 @@
   EXPECT_EQ(51, frame_count);
   // Test something bigger than the preallocated size to verify nothing was
   // truncated.
-  EXPECT(51 > Stacktrace::kPreallocatedStackdepth);
+  EXPECT(51 > StackTrace::kPreallocatedStackdepth);
 
   Dart_Handle function_name;
   Dart_Handle script_url;
@@ -215,7 +215,7 @@
 }
 
 
-TEST_CASE(StackOverflowStacktraceInfo) {
+TEST_CASE(StackOverflowStackTraceInfo) {
   const char* kScriptChars =
       "class C {\n"
       "  static foo() => foo();\n"
@@ -234,7 +234,7 @@
   intptr_t frame_count = 0;
   result = Dart_StackTraceLength(stacktrace, &frame_count);
   EXPECT_VALID(result);
-  EXPECT_EQ(Stacktrace::kPreallocatedStackdepth - 1, frame_count);
+  EXPECT_EQ(StackTrace::kPreallocatedStackdepth - 1, frame_count);
 
   Dart_Handle function_name;
   Dart_Handle script_url;
@@ -264,7 +264,7 @@
 }
 
 
-TEST_CASE(OutOfMemoryStacktraceInfo) {
+TEST_CASE(OutOfMemoryStackTraceInfo) {
   const char* kScriptChars =
       "var number_of_ints = 134000000;\n"
       "testMain() {\n"
@@ -278,7 +278,7 @@
 
   Dart_StackTrace stacktrace;
   Dart_Handle result = Dart_GetStackTraceFromError(error, &stacktrace);
-  EXPECT(Dart_IsError(result));  // No Stacktrace for OutOfMemory.
+  EXPECT(Dart_IsError(result));  // No StackTrace for OutOfMemory.
 }
 
 
@@ -295,7 +295,7 @@
   EXPECT_EQ(52, frame_count);
   // Test something bigger than the preallocated size to verify nothing was
   // truncated.
-  EXPECT(52 > Stacktrace::kPreallocatedStackdepth);
+  EXPECT(52 > StackTrace::kPreallocatedStackdepth);
 
   Dart_Handle function_name;
   Dart_Handle script_url;
@@ -380,7 +380,7 @@
 }
 
 
-TEST_CASE(CurrentStacktraceInfo) {
+TEST_CASE(CurrentStackTraceInfo) {
   const char* kScriptChars =
       "inspectStack() native 'CurrentStackTraceNatve';\n"
       "foo(n) => n == 1 ? inspectStack() : foo(n-1);\n"
@@ -1007,6 +1007,7 @@
 
 
 TEST_CASE(ArrayValues) {
+  EXPECT(!Dart_IsList(Dart_Null()));
   const int kArrayLength = 10;
   Dart_Handle str = NewString("test");
   EXPECT(!Dart_IsList(str));
@@ -1473,6 +1474,7 @@
 
 
 TEST_CASE(MapAccess) {
+  EXPECT(!Dart_IsMap(Dart_Null()));
   const char* kScriptChars =
       "Map testMain() {"
       "  return {"
@@ -3495,7 +3497,8 @@
   intptr_t mydata = 12345;
   char* err;
   Dart_Isolate isolate =
-      Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL,
+      Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                         bin::core_isolate_snapshot_instructions, NULL,
                          reinterpret_cast<void*>(mydata), &err);
   EXPECT(isolate != NULL);
   EXPECT_EQ(mydata, reinterpret_cast<intptr_t>(Dart_CurrentIsolateData()));
@@ -3526,7 +3529,8 @@
 
   char* err;
   Dart_Isolate isolate = Dart_CreateIsolate(
-      NULL, NULL, bin::isolate_snapshot_buffer, &api_flags, NULL, &err);
+      NULL, NULL, bin::core_isolate_snapshot_data,
+      bin::core_isolate_snapshot_instructions, &api_flags, NULL, &err);
   if (isolate == NULL) {
     OS::Print("Creation of isolate failed '%s'\n", err);
     free(err);
@@ -7571,7 +7575,8 @@
     MonitorLocker ml(sync);
     char* error = NULL;
     shared_isolate = Dart_CreateIsolate(
-        NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL, &error);
+        NULL, NULL, bin::core_isolate_snapshot_data,
+        bin::core_isolate_snapshot_instructions, NULL, NULL, &error);
     EXPECT(shared_isolate != NULL);
     Dart_EnterScope();
     Dart_Handle url = NewString(TestCase::url());
@@ -7622,7 +7627,8 @@
   // Create an isolate.
   char* err;
   Dart_Isolate isolate = Dart_CreateIsolate(
-      NULL, NULL, bin::isolate_snapshot_buffer, NULL, my_data, &err);
+      NULL, NULL, bin::core_isolate_snapshot_data,
+      bin::core_isolate_snapshot_instructions, NULL, my_data, &err);
   if (isolate == NULL) {
     OS::Print("Creation of isolate failed '%s'\n", err);
     free(err);
@@ -7671,7 +7677,8 @@
   // Create an isolate.
   char* err;
   Dart_Isolate isolate = Dart_CreateIsolate(
-      NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL, &err);
+      NULL, NULL, bin::core_isolate_snapshot_data,
+      bin::core_isolate_snapshot_instructions, NULL, NULL, &err);
   if (isolate == NULL) {
     OS::Print("Creation of isolate failed '%s'\n", err);
     free(err);
diff --git a/runtime/vm/dart_api_message.h b/runtime/vm/dart_api_message.h
index 8e2747a..c74737e 100644
--- a/runtime/vm/dart_api_message.h
+++ b/runtime/vm/dart_api_message.h
@@ -158,7 +158,7 @@
  public:
   static const intptr_t kInitialSize = 512;
   ApiMessageWriter(uint8_t** buffer, ReAlloc alloc)
-      : BaseWriter(buffer, alloc, kInitialSize),
+      : BaseWriter(buffer, alloc, NULL, kInitialSize),
         object_id_(0),
         forward_list_(NULL),
         forward_list_length_(0),
diff --git a/runtime/vm/dart_api_state.cc b/runtime/vm/dart_api_state.cc
index 2d1d827..d5d0d3b 100644
--- a/runtime/vm/dart_api_state.cc
+++ b/runtime/vm/dart_api_state.cc
@@ -14,6 +14,8 @@
 
 namespace dart {
 
+intptr_t ApiNativeScope::current_memory_usage_ = 0;
+
 BackgroundFinalizer::BackgroundFinalizer(Isolate* isolate,
                                          FinalizationQueue* queue)
     : isolate_(isolate), queue_(queue) {
diff --git a/runtime/vm/dart_api_state.h b/runtime/vm/dart_api_state.h
index 1bff38c..7946ef8 100644
--- a/runtime/vm/dart_api_state.h
+++ b/runtime/vm/dart_api_state.h
@@ -512,6 +512,17 @@
     return IsValidScopedHandle(reinterpret_cast<uword>(object));
   }
 
+  bool IsFreeHandle(Dart_PersistentHandle object) const {
+    PersistentHandle* handle = free_list_;
+    while (handle != NULL) {
+      if (handle == reinterpret_cast<PersistentHandle*>(object)) {
+        return true;
+      }
+      handle = handle->Next();
+    }
+    return false;
+  }
+
   // Returns a count of active handles (used for testing purposes).
   int CountHandles() const { return CountScopedHandles(); }
 
@@ -594,6 +605,18 @@
     return IsValidScopedHandle(reinterpret_cast<uword>(object));
   }
 
+  bool IsFreeHandle(Dart_WeakPersistentHandle object) const {
+    MutexLocker ml(mutex_);
+    FinalizablePersistentHandle* handle = free_list_;
+    while (handle != NULL) {
+      if (handle == reinterpret_cast<FinalizablePersistentHandle*>(object)) {
+        return true;
+      }
+      handle = handle->Next();
+    }
+    return false;
+  }
+
   // Returns a count of active handles (used for testing purposes).
   int CountHandles() const { return CountScopedHandles(); }
 
@@ -651,11 +674,18 @@
     ASSERT(Current() == NULL);
     OSThread::SetThreadLocal(Api::api_native_key_,
                              reinterpret_cast<uword>(this));
+    // We manually increment the memory usage counter since there is memory
+    // initially allocated within the zone on creation.
+    IncrementNativeScopeMemoryUsage(zone_.GetZone()->CapacityInBytes());
   }
 
   ~ApiNativeScope() {
     ASSERT(Current() == this);
     OSThread::SetThreadLocal(Api::api_native_key_, 0);
+    // We must also manually decrement the memory usage counter since the native
+    // is still holding it's initial memory and ~Zone() won't be able to
+    // determine which memory usage counter to decrement.
+    DecrementNativeScopeMemoryUsage(zone_.GetZone()->CapacityInBytes());
   }
 
   static inline ApiNativeScope* Current() {
@@ -663,6 +693,16 @@
         OSThread::GetThreadLocal(Api::api_native_key_));
   }
 
+  static intptr_t current_memory_usage() { return current_memory_usage_; }
+
+  static void IncrementNativeScopeMemoryUsage(intptr_t size) {
+    AtomicOperations::IncrementBy(&current_memory_usage_, size);
+  }
+
+  static void DecrementNativeScopeMemoryUsage(intptr_t size) {
+    AtomicOperations::DecrementBy(&current_memory_usage_, size);
+  }
+
   Zone* zone() {
     Zone* result = zone_.GetZone();
     ASSERT(result->handles()->CountScopedHandles() == 0);
@@ -671,6 +711,9 @@
   }
 
  private:
+  // The current total memory usage within ApiNativeScopes.
+  static intptr_t current_memory_usage_;
+
   ApiZone zone_;
 };
 
@@ -742,10 +785,27 @@
     return persistent_handles_.IsValidHandle(object);
   }
 
+  bool IsFreePersistentHandle(Dart_PersistentHandle object) const {
+    return persistent_handles_.IsFreeHandle(object);
+  }
+
+  bool IsActivePersistentHandle(Dart_PersistentHandle object) const {
+    return IsValidPersistentHandle(object) && !IsFreePersistentHandle(object);
+  }
+
   bool IsValidWeakPersistentHandle(Dart_WeakPersistentHandle object) const {
     return weak_persistent_handles_.IsValidHandle(object);
   }
 
+  bool IsFreeWeakPersistentHandle(Dart_WeakPersistentHandle object) const {
+    return weak_persistent_handles_.IsFreeHandle(object);
+  }
+
+  bool IsActiveWeakPersistentHandle(Dart_WeakPersistentHandle object) const {
+    return IsValidWeakPersistentHandle(object) &&
+           !IsFreeWeakPersistentHandle(object);
+  }
+
   bool IsProtectedHandle(PersistentHandle* object) const {
     if (object == NULL) return false;
     return object == null_ || object == true_ || object == false_;
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index 3346bef..195781c 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -32,7 +32,7 @@
 
 class ScopedIsolateStackLimits : public ValueObject {
  public:
-  explicit ScopedIsolateStackLimits(Thread* thread)
+  explicit ScopedIsolateStackLimits(Thread* thread, uword current_sp)
       : thread_(thread), saved_stack_limit_(0) {
     ASSERT(thread != NULL);
     // Set the thread's stack_base based on the current
@@ -41,7 +41,6 @@
     // grows from high to low addresses).
     OSThread* os_thread = thread->os_thread();
     ASSERT(os_thread != NULL);
-    uword current_sp = Thread::GetCurrentStackPointer();
     if (current_sp > os_thread->stack_base()) {
       os_thread->set_stack_base(current_sp);
     }
@@ -87,13 +86,15 @@
 
 RawObject* DartEntry::InvokeFunction(const Function& function,
                                      const Array& arguments,
-                                     const Array& arguments_descriptor) {
+                                     const Array& arguments_descriptor,
+                                     uword current_sp) {
   // Get the entrypoint corresponding to the function specified, this
   // will result in a compilation of the function if it is not already
   // compiled.
   Thread* thread = Thread::Current();
   Zone* zone = thread->zone();
   ASSERT(thread->IsMutatorThread());
+  ScopedIsolateStackLimits stack_limit(thread, current_sp);
   if (!function.HasCode()) {
     const Error& error =
         Error::Handle(zone, Compiler::CompileFunction(thread, function));
@@ -109,7 +110,6 @@
   const Code& code = Code::Handle(zone, function.CurrentCode());
   ASSERT(!code.IsNull());
   ASSERT(thread->no_callback_scope_depth() == 0);
-  ScopedIsolateStackLimits stack_limit(thread);
   SuspendLongJumpScope suspend_long_jump_scope(thread);
   TransitionToGenerated transition(thread);
 #if defined(TARGET_ARCH_DBC)
@@ -177,7 +177,7 @@
         if (c_stack_pos < c_stack_limit) {
           const Instance& exception =
               Instance::Handle(zone, isolate->object_store()->stack_overflow());
-          return UnhandledException::New(exception, Stacktrace::Handle(zone));
+          return UnhandledException::New(exception, StackTrace::Handle(zone));
         }
 
         const Array& getter_arguments = Array::Handle(zone, Array::New(1));
@@ -551,7 +551,7 @@
     // If the isolate is being debugged and the debugger was stepping
     // through code, enable single stepping so debugger will stop
     // at the first location the user is interested in.
-    isolate->debugger()->SetSingleStep();
+    isolate->debugger()->SetResumeAction(Debugger::kStepInto);
   }
   const Object& result =
       Object::Handle(zone, DartEntry::InvokeFunction(function, args));
diff --git a/runtime/vm/dart_entry.h b/runtime/vm/dart_entry.h
index 2a52eec..c2e8f92 100644
--- a/runtime/vm/dart_entry.h
+++ b/runtime/vm/dart_entry.h
@@ -126,9 +126,11 @@
 
   // Invokes the specified instance, static, or closure function.
   // On success, returns a RawInstance.  On failure, a RawError.
-  static RawObject* InvokeFunction(const Function& function,
-                                   const Array& arguments,
-                                   const Array& arguments_descriptor);
+  static RawObject* InvokeFunction(
+      const Function& function,
+      const Array& arguments,
+      const Array& arguments_descriptor,
+      uword current_sp = Thread::GetCurrentStackPointer());
 
   // Invokes the closure object given as the first argument.
   // On success, returns a RawInstance.  On failure, a RawError.
diff --git a/runtime/vm/datastream.h b/runtime/vm/datastream.h
index 3b714b7..19a33c4 100644
--- a/runtime/vm/datastream.h
+++ b/runtime/vm/datastream.h
@@ -23,6 +23,7 @@
 static const uint8_t kEndUnsignedByteMarker = (255 - kMaxUnsignedDataPerByte);
 
 typedef uint8_t* (*ReAlloc)(uint8_t* ptr, intptr_t old_size, intptr_t new_size);
+typedef void (*DeAlloc)(uint8_t* ptr);
 
 // Stream for reading various types from a buffer.
 class ReadStream : public ValueObject {
@@ -309,10 +310,17 @@
   }
 
   uint8_t* buffer() const { return *buffer_; }
+  void set_buffer(uint8_t* value) { *buffer_ = value; }
   intptr_t bytes_written() const { return current_ - *buffer_; }
 
   void set_current(uint8_t* value) { current_ = value; }
 
+  void Align(intptr_t alignment) {
+    intptr_t position = current_ - *buffer_;
+    position = Utils::RoundUp(position, alignment);
+    current_ = *buffer_ + position;
+  }
+
   template <int N, typename T>
   class Raw {};
 
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index 3cdf810..3dce573 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -6,6 +6,8 @@
 
 #include "include/dart_api.h"
 
+#include "platform/address_sanitizer.h"
+
 #include "vm/code_generator.h"
 #include "vm/code_patcher.h"
 #include "vm/compiler.h"
@@ -42,6 +44,7 @@
             trace_debugger_stacktrace,
             false,
             "Trace debugger stacktrace collection");
+DEFINE_FLAG(bool, trace_rewind, false, "Trace frame rewind");
 DEFINE_FLAG(bool, verbose_debug, false, "Verbose debugger messages");
 DEFINE_FLAG(bool,
             steal_breakpoints,
@@ -635,7 +638,7 @@
       const int8_t kind = var_info.kind();
       if ((kind == RawLocalVarDescriptors::kContextLevel) &&
           (var_info.begin_pos <= activation_token_pos) &&
-          (activation_token_pos < var_info.end_pos)) {
+          (activation_token_pos <= var_info.end_pos)) {
         // This var_descriptors_ entry is a context scope which is in scope
         // of the current token position. Now check whether it is shadowing
         // the previous context scope.
@@ -850,6 +853,24 @@
 }
 
 
+bool ActivationFrame::IsRewindable() const {
+  if (deopt_frame_.IsNull()) {
+    return true;
+  }
+  // TODO(turnidge): This is conservative.  It looks at all values in
+  // the deopt_frame_ even though some of them may correspond to other
+  // inlined frames.
+  Object& obj = Object::Handle();
+  for (int i = 0; i < deopt_frame_.Length(); i++) {
+    obj = deopt_frame_.At(i);
+    if (obj.raw() == Symbols::OptimizedOut().raw()) {
+      return false;
+    }
+  }
+  return true;
+}
+
+
 void ActivationFrame::PrintContextMismatchError(intptr_t ctx_slot,
                                                 intptr_t frame_ctx_level,
                                                 intptr_t var_ctx_level) {
@@ -1108,9 +1129,13 @@
   }
 }
 
+static bool IsFunctionVisible(const Function& function) {
+  return FLAG_show_invisible_frames || function.is_visible();
+}
+
 
 void DebuggerStackTrace::AddActivation(ActivationFrame* frame) {
-  if (FLAG_show_invisible_frames || frame->function().is_visible()) {
+  if (IsFunctionVisible(frame->function())) {
     trace_.Add(frame);
   }
 }
@@ -1237,6 +1262,8 @@
       breakpoint_locations_(NULL),
       code_breakpoints_(NULL),
       resume_action_(kContinue),
+      resume_frame_index_(-1),
+      post_deopt_frame_index_(-1),
       ignore_breakpoints_(false),
       pause_event_(NULL),
       obj_cache_(NULL),
@@ -1300,10 +1327,13 @@
 }
 
 
-bool Debugger::SetupStepOverAsyncSuspension() {
+bool Debugger::SetupStepOverAsyncSuspension(const char** error) {
   ActivationFrame* top_frame = TopDartFrame();
   if (!IsAtAsyncJump(top_frame)) {
     // Not at an async operation.
+    if (error) {
+      *error = "Isolate must be paused at an async suspension point";
+    }
     return false;
   }
   Object& closure = Object::Handle(top_frame->GetAsyncOperation());
@@ -1313,24 +1343,42 @@
   Breakpoint* bpt = SetBreakpointAtActivation(Instance::Cast(closure), true);
   if (bpt == NULL) {
     // Unable to set the breakpoint.
+    if (error) {
+      *error = "Unable to set breakpoint at async suspension point";
+    }
     return false;
   }
   return true;
 }
 
 
-void Debugger::SetSingleStep() {
-  resume_action_ = kSingleStep;
-}
-
-
-void Debugger::SetStepOver() {
-  resume_action_ = kStepOver;
-}
-
-
-void Debugger::SetStepOut() {
-  resume_action_ = kStepOut;
+bool Debugger::SetResumeAction(ResumeAction action,
+                               intptr_t frame_index,
+                               const char** error) {
+  if (error) {
+    *error = NULL;
+  }
+  resume_frame_index_ = -1;
+  switch (action) {
+    case kStepInto:
+    case kStepOver:
+    case kStepOut:
+    case kContinue:
+      resume_action_ = action;
+      return true;
+    case kStepRewind:
+      if (!CanRewindFrame(frame_index, error)) {
+        return false;
+      }
+      resume_action_ = kStepRewind;
+      resume_frame_index_ = frame_index;
+      return true;
+    case kStepOverAsyncSuspension:
+      return SetupStepOverAsyncSuspension(error);
+    default:
+      UNREACHABLE();
+      return false;
+  }
 }
 
 
@@ -1519,7 +1567,7 @@
   return CollectStackTrace();
 }
 
-DebuggerStackTrace* Debugger::StackTraceFrom(const Stacktrace& ex_trace) {
+DebuggerStackTrace* Debugger::StackTraceFrom(const class StackTrace& ex_trace) {
   DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8);
   Function& function = Function::Handle();
   Code& code = Code::Handle();
@@ -1531,7 +1579,7 @@
 
   for (intptr_t i = 0; i < ex_trace.Length(); i++) {
     function = ex_trace.FunctionAtFrame(i);
-    // Pre-allocated Stacktraces may include empty slots, either (a) to indicate
+    // Pre-allocated StackTraces may include empty slots, either (a) to indicate
     // where frames were omitted in the case a stack has more frames than the
     // pre-allocated trace (such as a stack overflow) or (b) because a stack has
     // fewer frames that the pre-allocated trace (such as memory exhaustion with
@@ -1622,6 +1670,7 @@
   ASSERT(stack_trace_ == NULL);
   stack_trace_ = stack_trace;
   Pause(&event);
+  HandleSteppingRequest(stack_trace_);  // we may get a rewind request
   stack_trace_ = NULL;
 }
 
@@ -1722,6 +1771,7 @@
   // of the given token range.
   TokenPosition best_fit_pos = TokenPosition::kMaxSource;
   intptr_t best_column = INT_MAX;
+  intptr_t best_line = INT_MAX;
   PcDescriptors::Iterator iter(desc, kSafepointKind);
   while (iter.MoveNext()) {
     const TokenPosition pos = iter.TokenPos();
@@ -1732,8 +1782,8 @@
     }
 
     intptr_t token_start_column = -1;
+    intptr_t token_line = -1;
     if (requested_column >= 0) {
-      intptr_t ignored = -1;
       intptr_t token_len = -1;
       // TODO(turnidge): GetTokenLocation is a very expensive
       // operation, and this code will blow up when we are setting
@@ -1741,7 +1791,8 @@
       // program.  Consider rewriting this code so that it only scans
       // the program code once and caches the token positions and
       // lengths.
-      script.GetTokenLocation(pos, &ignored, &token_start_column, &token_len);
+      script.GetTokenLocation(pos, &token_line, &token_start_column,
+                              &token_len);
       intptr_t token_end_column = token_start_column + token_len - 1;
       if ((token_end_column < requested_column) ||
           (token_start_column > best_column)) {
@@ -1754,6 +1805,7 @@
     // Prefer the lowest (first) token pos.
     if (pos < best_fit_pos) {
       best_fit_pos = pos;
+      best_line = token_line;
       best_column = token_start_column;
     }
   }
@@ -1763,10 +1815,24 @@
   // was specified) and has the lowest code address.
   if (best_fit_pos != TokenPosition::kMaxSource) {
     const Script& script = Script::Handle(zone, func.script());
-    const TokenStream& tokens = TokenStream::Handle(zone, script.tokens());
     const TokenPosition begin_pos = best_fit_pos;
-    const TokenPosition end_of_line_pos =
-        LastTokenOnLine(zone, tokens, begin_pos);
+
+    TokenPosition end_of_line_pos;
+    if (script.kind() == RawScript::kKernelTag) {
+      if (best_line == -1) {
+        script.GetTokenLocation(begin_pos, &best_line, NULL);
+      }
+      ASSERT(best_line > 0);
+      TokenPosition ignored;
+      script.TokenRangeAtLine(best_line, &ignored, &end_of_line_pos);
+      if (end_of_line_pos < begin_pos) {
+        end_of_line_pos = begin_pos;
+      }
+    } else {
+      const TokenStream& tokens = TokenStream::Handle(zone, script.tokens());
+      end_of_line_pos = LastTokenOnLine(zone, tokens, begin_pos);
+    }
+
     uword lowest_pc_offset = kUwordMax;
     PcDescriptors::Iterator iter(desc, kSafepointKind);
     while (iter.MoveNext()) {
@@ -2547,7 +2613,7 @@
 void Debugger::HandleSteppingRequest(DebuggerStackTrace* stack_trace,
                                      bool skip_next_step) {
   stepping_fp_ = 0;
-  if (resume_action_ == kSingleStep) {
+  if (resume_action_ == kStepInto) {
     // When single stepping, we need to deoptimize because we might be
     // stepping into optimized code.  This happens in particular if
     // the isolate has been interrupted, but can happen in other cases
@@ -2557,7 +2623,7 @@
     isolate_->set_single_step(true);
     skip_next_step_ = skip_next_step;
     if (FLAG_verbose_debug) {
-      OS::Print("HandleSteppingRequest- kSingleStep\n");
+      OS::Print("HandleSteppingRequest- kStepInto\n");
     }
   } else if (resume_action_ == kStepOver) {
     DeoptimizeWorld();
@@ -2582,6 +2648,244 @@
     if (FLAG_verbose_debug) {
       OS::Print("HandleSteppingRequest- kStepOut %" Px "\n", stepping_fp_);
     }
+  } else if (resume_action_ == kStepRewind) {
+    if (FLAG_trace_rewind) {
+      OS::PrintErr("Rewinding to frame %" Pd "\n", resume_frame_index_);
+      OS::PrintErr(
+          "-------------------------\n"
+          "All frames...\n\n");
+      StackFrameIterator iterator(false);
+      StackFrame* frame = iterator.NextFrame();
+      intptr_t num = 0;
+      while ((frame != NULL)) {
+        OS::PrintErr("#%04" Pd " %s\n", num++, frame->ToCString());
+        frame = iterator.NextFrame();
+      }
+    }
+    RewindToFrame(resume_frame_index_);
+    UNREACHABLE();
+  }
+}
+
+
+static intptr_t FindNextRewindFrameIndex(DebuggerStackTrace* stack,
+                                         intptr_t frame_index) {
+  for (intptr_t i = frame_index + 1; i < stack->Length(); i++) {
+    ActivationFrame* frame = stack->FrameAt(i);
+    if (frame->IsRewindable()) {
+      return i;
+    }
+  }
+  return -1;
+}
+
+
+// Can the top frame be rewound?
+bool Debugger::CanRewindFrame(intptr_t frame_index, const char** error) const {
+  // check rewind pc is found
+  DebuggerStackTrace* stack = Isolate::Current()->debugger()->StackTrace();
+  intptr_t num_frames = stack->Length();
+  if (frame_index < 1 || frame_index >= num_frames) {
+    if (error) {
+      *error = Thread::Current()->zone()->PrintToString(
+          "Frame must be in bounds [1..%" Pd
+          "]: "
+          "saw %" Pd "",
+          num_frames - 1, frame_index);
+    }
+    return false;
+  }
+  ActivationFrame* frame = stack->FrameAt(frame_index);
+  if (!frame->IsRewindable()) {
+    intptr_t next_index = FindNextRewindFrameIndex(stack, frame_index);
+    if (next_index > 0) {
+      *error = Thread::Current()->zone()->PrintToString(
+          "Cannot rewind to frame %" Pd
+          " due to conflicting compiler "
+          "optimizations. "
+          "Run the vm with --no-prune-dead-locals to disallow these "
+          "optimizations. "
+          "Next valid rewind frame is %" Pd ".",
+          frame_index, next_index);
+    } else {
+      *error = Thread::Current()->zone()->PrintToString(
+          "Cannot rewind to frame %" Pd
+          " due to conflicting compiler "
+          "optimizations. "
+          "Run the vm with --no-prune-dead-locals to disallow these "
+          "optimizations.",
+          frame_index);
+    }
+    return false;
+  }
+  return true;
+}
+
+
+// Given a return address pc, find the "rewind" pc, which is the pc
+// before the corresponding call.
+static uword LookupRewindPc(const Code& code, uword pc) {
+  ASSERT(!code.is_optimized());
+  ASSERT(code.ContainsInstructionAt(pc));
+
+  uword pc_offset = pc - code.PayloadStart();
+  const PcDescriptors& descriptors =
+      PcDescriptors::Handle(code.pc_descriptors());
+  PcDescriptors::Iterator iter(
+      descriptors, RawPcDescriptors::kRewind | RawPcDescriptors::kIcCall |
+                       RawPcDescriptors::kUnoptStaticCall);
+  intptr_t rewind_deopt_id = -1;
+  uword rewind_pc = 0;
+  while (iter.MoveNext()) {
+    if (iter.Kind() == RawPcDescriptors::kRewind) {
+      // Remember the last rewind so we don't need to iterator twice.
+      rewind_pc = code.PayloadStart() + iter.PcOffset();
+      rewind_deopt_id = iter.DeoptId();
+    }
+    if ((pc_offset == iter.PcOffset()) && (iter.DeoptId() == rewind_deopt_id)) {
+      return rewind_pc;
+    }
+  }
+  return 0;
+}
+
+
+void Debugger::RewindToFrame(intptr_t frame_index) {
+  Thread* thread = Thread::Current();
+  Zone* zone = thread->zone();
+  Code& code = Code::Handle(zone);
+  Function& function = Function::Handle(zone);
+
+  // Find the requested frame.
+  StackFrameIterator iterator(false);
+  intptr_t current_frame = 0;
+  for (StackFrame* frame = iterator.NextFrame(); frame != NULL;
+       frame = iterator.NextFrame()) {
+    ASSERT(frame->IsValid());
+    if (frame->IsDartFrame()) {
+      code = frame->LookupDartCode();
+      function = code.function();
+      if (!IsFunctionVisible(function)) {
+        continue;
+      }
+      if (code.is_optimized()) {
+        intptr_t sub_index = 0;
+        for (InlinedFunctionsIterator it(code, frame->pc()); !it.Done();
+             it.Advance()) {
+          if (current_frame == frame_index) {
+            RewindToOptimizedFrame(frame, code, sub_index);
+            UNREACHABLE();
+          }
+          current_frame++;
+          sub_index++;
+        }
+      } else {
+        if (current_frame == frame_index) {
+          // We are rewinding to an unoptimized frame.
+          RewindToUnoptimizedFrame(frame, code);
+          UNREACHABLE();
+        }
+        current_frame++;
+      }
+    }
+  }
+  UNIMPLEMENTED();
+}
+
+
+void Debugger::RewindToUnoptimizedFrame(StackFrame* frame, const Code& code) {
+  // We will be jumping out of the debugger rather than exiting this
+  // function, so prepare the debugger state.
+  stack_trace_ = NULL;
+  resume_action_ = kContinue;
+  resume_frame_index_ = -1;
+  EnterSingleStepMode();
+
+  uword rewind_pc = LookupRewindPc(code, frame->pc());
+  if (FLAG_trace_rewind && rewind_pc == 0) {
+    OS::PrintErr("Unable to find rewind pc for pc(%" Px ")\n", frame->pc());
+  }
+  ASSERT(rewind_pc != 0);
+  if (FLAG_trace_rewind) {
+    OS::PrintErr(
+        "===============================\n"
+        "Rewinding to unoptimized frame:\n"
+        "    rewind_pc(0x%" Px ") sp(0x%" Px ") fp(0x%" Px
+        ")\n"
+        "===============================\n",
+        rewind_pc, frame->sp(), frame->fp());
+  }
+  Exceptions::JumpToFrame(Thread::Current(), rewind_pc, frame->sp(),
+                          frame->fp(), true /* clear lazy deopt at target */);
+  UNREACHABLE();
+}
+
+
+void Debugger::RewindToOptimizedFrame(StackFrame* frame,
+                                      const Code& optimized_code,
+                                      intptr_t sub_index) {
+  post_deopt_frame_index_ = sub_index;
+
+  // We will be jumping out of the debugger rather than exiting this
+  // function, so prepare the debugger state.
+  stack_trace_ = NULL;
+  resume_action_ = kContinue;
+  resume_frame_index_ = -1;
+  EnterSingleStepMode();
+
+  if (FLAG_trace_rewind) {
+    OS::PrintErr(
+        "===============================\n"
+        "Deoptimizing frame for rewind:\n"
+        "    deopt_pc(0x%" Px ") sp(0x%" Px ") fp(0x%" Px
+        ")\n"
+        "===============================\n",
+        frame->pc(), frame->sp(), frame->fp());
+  }
+  Thread* thread = Thread::Current();
+  thread->set_resume_pc(frame->pc());
+  uword deopt_stub_pc = StubCode::DeoptForRewind_entry()->EntryPoint();
+  Exceptions::JumpToFrame(thread, deopt_stub_pc, frame->sp(), frame->fp(),
+                          true /* clear lazy deopt at target */);
+  UNREACHABLE();
+}
+
+
+void Debugger::RewindPostDeopt() {
+  intptr_t rewind_frame = post_deopt_frame_index_;
+  post_deopt_frame_index_ = -1;
+  if (FLAG_trace_rewind) {
+    OS::PrintErr("Post deopt, jumping to frame %" Pd "\n", rewind_frame);
+    OS::PrintErr(
+        "-------------------------\n"
+        "All frames...\n\n");
+    StackFrameIterator iterator(false);
+    StackFrame* frame = iterator.NextFrame();
+    intptr_t num = 0;
+    while ((frame != NULL)) {
+      OS::PrintErr("#%04" Pd " %s\n", num++, frame->ToCString());
+      frame = iterator.NextFrame();
+    }
+  }
+
+  Thread* thread = Thread::Current();
+  Zone* zone = thread->zone();
+  Code& code = Code::Handle(zone);
+
+  StackFrameIterator iterator(false);
+  intptr_t current_frame = 0;
+  for (StackFrame* frame = iterator.NextFrame(); frame != NULL;
+       frame = iterator.NextFrame()) {
+    ASSERT(frame->IsValid());
+    if (frame->IsDartFrame()) {
+      code = frame->LookupDartCode();
+      ASSERT(!code.is_optimized());
+      if (current_frame == rewind_frame) {
+        RewindToUnoptimizedFrame(frame, code);
+        UNREACHABLE();
+      }
+      current_frame++;
+    }
   }
 }
 
@@ -2624,6 +2928,9 @@
     ASSERT(closure_or_null.IsInstance());
     ASSERT(Instance::Cast(closure_or_null).IsClosure());
     const Script& script = Script::Handle(zone, top_frame->SourceScript());
+    if (script.kind() == RawScript::kKernelTag) {
+      return false;
+    }
     const TokenStream& tokens = TokenStream::Handle(zone, script.tokens());
     TokenStream::Iterator iter(zone, tokens, top_frame->TokenPos());
     if ((iter.CurrentTokenKind() == Token::kIDENT) &&
@@ -2793,7 +3100,7 @@
 
     // We are at the entry of an async function.
     // We issue a step over to resume at the point after the await statement.
-    SetStepOver();
+    SetResumeAction(kStepOver);
     // When we single step from a user breakpoint, our next stepping
     // point will be at the exact same pc.  Skip it.
     HandleSteppingRequest(stack_trace_, true /* skip next step */);
@@ -2846,7 +3153,7 @@
   // We are in the native call to Developer_debugger.  the developer
   // gets a better experience by not seeing this call. To accomplish
   // this, we continue execution until the call exits (step out).
-  SetStepOut();
+  SetResumeAction(kStepOut);
   HandleSteppingRequest(stack_trace_);
 
   stack_trace_ = NULL;
diff --git a/runtime/vm/debugger.h b/runtime/vm/debugger.h
index 7319c8e..fa9c3a6 100644
--- a/runtime/vm/debugger.h
+++ b/runtime/vm/debugger.h
@@ -276,6 +276,9 @@
   // to the user and can be debugged.
   bool IsDebuggable() const;
 
+  // Returns true if it is possible to rewind the debugger to this frame.
+  bool IsRewindable() const;
+
   // The context level of a frame is the context level at the
   // PC/token index of the frame. It determines the depth of the context
   // chain that belongs to the function of this activation frame.
@@ -373,6 +376,15 @@
 
 class Debugger {
  public:
+  enum ResumeAction {
+    kContinue,
+    kStepInto,
+    kStepOver,
+    kStepOut,
+    kStepRewind,
+    kStepOverAsyncSuspension,
+  };
+
   typedef void EventHandler(ServiceEvent* event);
 
   Debugger();
@@ -412,11 +424,10 @@
   void RemoveBreakpoint(intptr_t bp_id);
   Breakpoint* GetBreakpointById(intptr_t id);
 
-  // Will return false if we are not at an await.
-  bool SetupStepOverAsyncSuspension();
-  void SetStepOver();
-  void SetSingleStep();
-  void SetStepOut();
+  bool SetResumeAction(ResumeAction action,
+                       intptr_t frame_index = 1,
+                       const char** error = NULL);
+
   bool IsStepping() const { return resume_action_ != kContinue; }
 
   bool IsPaused() const { return pause_event_ != NULL; }
@@ -459,10 +470,10 @@
   DebuggerStackTrace* StackTrace();
   DebuggerStackTrace* CurrentStackTrace();
 
-  // Returns a debugger stack trace corresponding to a dart.core.Stacktrace.
+  // Returns a debugger stack trace corresponding to a dart.core.StackTrace.
   // Frames corresponding to invisible functions are omitted. It is not valid
   // to query local variables in the returned stack.
-  DebuggerStackTrace* StackTraceFrom(const Stacktrace& dart_stacktrace);
+  DebuggerStackTrace* StackTraceFrom(const class StackTrace& dart_stacktrace);
 
   RawArray* GetInstanceFields(const Instance& obj);
   RawArray* GetStaticFields(const Class& cls);
@@ -513,11 +524,15 @@
 
   intptr_t limitBreakpointId() { return next_id_; }
 
- private:
-  enum ResumeAction { kContinue, kStepOver, kStepOut, kSingleStep };
+  // Callback to the debugger to continue frame rewind, post-deoptimization.
+  void RewindPostDeopt();
 
+ private:
   RawError* PauseRequest(ServiceEvent::EventKind kind);
 
+  // Will return false if we are not at an await.
+  bool SetupStepOverAsyncSuspension(const char** error);
+
   bool NeedsIsolateEvents();
   bool NeedsDebugEvents();
   void InvokeEventHandler(ServiceEvent* event);
@@ -588,6 +603,15 @@
   void HandleSteppingRequest(DebuggerStackTrace* stack_trace,
                              bool skip_next_step = false);
 
+  // Can we rewind to the indicated frame?
+  bool CanRewindFrame(intptr_t frame_index, const char** error) const;
+
+  void RewindToFrame(intptr_t frame_index);
+  void RewindToUnoptimizedFrame(StackFrame* frame, const Code& code);
+  void RewindToOptimizedFrame(StackFrame* frame,
+                              const Code& code,
+                              intptr_t post_deopt_frame_index);
+
   Isolate* isolate_;
   Dart_Port isolate_id_;  // A unique ID for the isolate in the debugger.
   bool initialized_;
@@ -601,6 +625,8 @@
 
   // Tells debugger what to do when resuming execution after a breakpoint.
   ResumeAction resume_action_;
+  intptr_t resume_frame_index_;
+  intptr_t post_deopt_frame_index_;
 
   // Do not call back to breakpoint handler if this flag is set.
   // Effectively this means ignoring breakpoints. Set when Dart code may
diff --git a/runtime/vm/debugger_api_impl.cc b/runtime/vm/debugger_api_impl.cc
index 71610d2..af4a5e1 100644
--- a/runtime/vm/debugger_api_impl.cc
+++ b/runtime/vm/debugger_api_impl.cc
@@ -247,7 +247,7 @@
   const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
   if (obj.IsUnhandledException()) {
     const UnhandledException& error = UnhandledException::Cast(obj);
-    Stacktrace& dart_stacktrace = Stacktrace::Handle(Z);
+    StackTrace& dart_stacktrace = StackTrace::Handle(Z);
     dart_stacktrace ^= error.stacktrace();
     if (dart_stacktrace.IsNull()) {
       *trace = NULL;
@@ -485,7 +485,7 @@
   DARTSCOPE(Thread::Current());
   Isolate* I = T->isolate();
   CHECK_DEBUGGER(I);
-  I->debugger()->SetStepOver();
+  I->debugger()->SetResumeAction(Debugger::kStepOver);
   return Api::Success();
 }
 
@@ -494,7 +494,7 @@
   DARTSCOPE(Thread::Current());
   Isolate* I = T->isolate();
   CHECK_DEBUGGER(I);
-  I->debugger()->SetSingleStep();
+  I->debugger()->SetResumeAction(Debugger::kStepInto);
   return Api::Success();
 }
 
@@ -503,7 +503,7 @@
   DARTSCOPE(Thread::Current());
   Isolate* I = T->isolate();
   CHECK_DEBUGGER(I);
-  I->debugger()->SetStepOut();
+  I->debugger()->SetResumeAction(Debugger::kStepOut);
   return Api::Success();
 }
 
diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc
index 31f08cd..345db49 100644
--- a/runtime/vm/deopt_instructions.cc
+++ b/runtime/vm/deopt_instructions.cc
@@ -1077,7 +1077,13 @@
     deopt_instr = new (zone()) DeoptMaterializedObjectRefInstr(index);
   } else {
     ASSERT(!source_loc.IsInvalid());
-    switch (value->definition()->representation()) {
+#if defined(TARGET_ARCH_DBC)
+    Representation rep =
+        (value == NULL) ? kTagged : value->definition()->representation();
+#else
+    Representation rep = value->definition()->representation();
+#endif
+    switch (rep) {
       case kTagged:
         deopt_instr =
             new (zone()) DeoptWordInstr(ToCpuRegisterSource(source_loc));
diff --git a/runtime/vm/disassembler.cc b/runtime/vm/disassembler.cc
index 235fcfe..b2d20e8 100644
--- a/runtime/vm/disassembler.cc
+++ b/runtime/vm/disassembler.cc
@@ -214,10 +214,10 @@
     THR_Print("}\n");
   }
 
-  THR_Print("Stackmaps for function '%s' {\n", function_fullname);
+  THR_Print("StackMaps for function '%s' {\n", function_fullname);
   if (code.stackmaps() != Array::null()) {
     const Array& stackmap_table = Array::Handle(code.stackmaps());
-    Stackmap& map = Stackmap::Handle();
+    StackMap& map = StackMap::Handle();
     for (intptr_t i = 0; i < stackmap_table.Length(); ++i) {
       map ^= stackmap_table.At(i);
       THR_Print("%s\n", map.ToCString());
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 71eb55a..c2bc393 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -28,23 +28,23 @@
             "Prints a stack trace everytime a throw occurs.");
 
 
-class StacktraceBuilder : public ValueObject {
+class StackTraceBuilder : public ValueObject {
  public:
-  StacktraceBuilder() {}
-  virtual ~StacktraceBuilder() {}
+  StackTraceBuilder() {}
+  virtual ~StackTraceBuilder() {}
 
   virtual void AddFrame(const Code& code, const Smi& offset) = 0;
 };
 
 
-class RegularStacktraceBuilder : public StacktraceBuilder {
+class RegularStackTraceBuilder : public StackTraceBuilder {
  public:
-  explicit RegularStacktraceBuilder(Zone* zone)
+  explicit RegularStackTraceBuilder(Zone* zone)
       : code_list_(
             GrowableObjectArray::Handle(zone, GrowableObjectArray::New())),
         pc_offset_list_(
             GrowableObjectArray::Handle(zone, GrowableObjectArray::New())) {}
-  ~RegularStacktraceBuilder() {}
+  ~RegularStackTraceBuilder() {}
 
   const GrowableObjectArray& code_list() const { return code_list_; }
   const GrowableObjectArray& pc_offset_list() const { return pc_offset_list_; }
@@ -58,41 +58,41 @@
   const GrowableObjectArray& code_list_;
   const GrowableObjectArray& pc_offset_list_;
 
-  DISALLOW_COPY_AND_ASSIGN(RegularStacktraceBuilder);
+  DISALLOW_COPY_AND_ASSIGN(RegularStackTraceBuilder);
 };
 
 
-class PreallocatedStacktraceBuilder : public StacktraceBuilder {
+class PreallocatedStackTraceBuilder : public StackTraceBuilder {
  public:
-  explicit PreallocatedStacktraceBuilder(const Instance& stacktrace)
-      : stacktrace_(Stacktrace::Cast(stacktrace)),
+  explicit PreallocatedStackTraceBuilder(const Instance& stacktrace)
+      : stacktrace_(StackTrace::Cast(stacktrace)),
         cur_index_(0),
         dropped_frames_(0) {
     ASSERT(stacktrace_.raw() ==
            Isolate::Current()->object_store()->preallocated_stack_trace());
   }
-  ~PreallocatedStacktraceBuilder() {}
+  ~PreallocatedStackTraceBuilder() {}
 
   virtual void AddFrame(const Code& code, const Smi& offset);
 
  private:
-  static const int kNumTopframes = Stacktrace::kPreallocatedStackdepth / 2;
+  static const int kNumTopframes = StackTrace::kPreallocatedStackdepth / 2;
 
-  const Stacktrace& stacktrace_;
+  const StackTrace& stacktrace_;
   intptr_t cur_index_;
   intptr_t dropped_frames_;
 
-  DISALLOW_COPY_AND_ASSIGN(PreallocatedStacktraceBuilder);
+  DISALLOW_COPY_AND_ASSIGN(PreallocatedStackTraceBuilder);
 };
 
 
-void PreallocatedStacktraceBuilder::AddFrame(const Code& code,
+void PreallocatedStackTraceBuilder::AddFrame(const Code& code,
                                              const Smi& offset) {
-  if (cur_index_ >= Stacktrace::kPreallocatedStackdepth) {
+  if (cur_index_ >= StackTrace::kPreallocatedStackdepth) {
     // The number of frames is overflowing the preallocated stack trace object.
     Code& frame_code = Code::Handle();
     Smi& frame_offset = Smi::Handle();
-    intptr_t start = Stacktrace::kPreallocatedStackdepth - (kNumTopframes - 1);
+    intptr_t start = StackTrace::kPreallocatedStackdepth - (kNumTopframes - 1);
     intptr_t null_slot = start - 2;
     // We are going to drop one frame.
     dropped_frames_++;
@@ -107,14 +107,14 @@
     frame_offset ^= Smi::New(dropped_frames_);
     stacktrace_.SetPcOffsetAtFrame(null_slot, frame_offset);
     // Move frames one slot down so that we can accomodate the new frame.
-    for (intptr_t i = start; i < Stacktrace::kPreallocatedStackdepth; i++) {
+    for (intptr_t i = start; i < StackTrace::kPreallocatedStackdepth; i++) {
       intptr_t prev = (i - 1);
       frame_code = stacktrace_.CodeAtFrame(i);
       frame_offset = stacktrace_.PcOffsetAtFrame(i);
       stacktrace_.SetCodeAtFrame(prev, frame_code);
       stacktrace_.SetPcOffsetAtFrame(prev, frame_offset);
     }
-    cur_index_ = (Stacktrace::kPreallocatedStackdepth - 1);
+    cur_index_ = (StackTrace::kPreallocatedStackdepth - 1);
   }
   stacktrace_.SetCodeAtFrame(cur_index_, code);
   stacktrace_.SetPcOffsetAtFrame(cur_index_, offset);
@@ -122,7 +122,7 @@
 }
 
 
-static void BuildStackTrace(StacktraceBuilder* builder) {
+static void BuildStackTrace(StackTraceBuilder* builder) {
   StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
   StackFrame* frame = frames.NextFrame();
   ASSERT(frame != NULL);  // We expect to find a dart invocation frame.
@@ -189,7 +189,6 @@
 static void FindErrorHandler(uword* handler_pc,
                              uword* handler_sp,
                              uword* handler_fp) {
-  // TODO(turnidge): Is there a faster way to get the next entry frame?
   StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
   StackFrame* frame = frames.NextFrame();
   ASSERT(frame != NULL);
@@ -228,7 +227,17 @@
         break;
       }
     }
+  }
+#endif  // !DBC
+  return program_counter;
+}
 
+
+static void ClearLazyDeopts(Thread* thread, uword frame_pointer) {
+#if !defined(TARGET_ARCH_DBC)
+  MallocGrowableArray<PendingLazyDeopt>* pending_deopts =
+      thread->isolate()->pending_deopts();
+  if (pending_deopts->length() > 0) {
     // We may be jumping over frames scheduled for lazy deopt. Remove these
     // frames from the pending deopt table, but only after unmarking them so
     // any stack walk that happens before the stack is unwound will still work.
@@ -264,7 +273,6 @@
 #endif
   }
 #endif  // !DBC
-  return program_counter;
 }
 
 
@@ -281,14 +289,18 @@
   thread->set_resume_pc(remapped_pc);
   uword run_exception_pc = StubCode::RunExceptionHandler_entry()->EntryPoint();
   Exceptions::JumpToFrame(thread, run_exception_pc, stack_pointer,
-                          frame_pointer);
+                          frame_pointer, false /* do not clear deopt */);
 }
 
 
 void Exceptions::JumpToFrame(Thread* thread,
                              uword program_counter,
                              uword stack_pointer,
-                             uword frame_pointer) {
+                             uword frame_pointer,
+                             bool clear_deopt_at_target) {
+  uword fp_for_clearing =
+      (clear_deopt_at_target ? frame_pointer + 1 : frame_pointer);
+  ClearLazyDeopts(thread, fp_for_clearing);
 #if defined(USING_SIMULATOR)
   // Unwinding of the C++ frames and destroying of their stack resources is done
   // by the simulator, because the target stack_pointer is a simulated stack
@@ -323,7 +335,7 @@
 }
 
 
-static RawField* LookupStacktraceField(const Instance& instance) {
+static RawField* LookupStackTraceField(const Instance& instance) {
   if (instance.GetClassId() < kNumPredefinedCids) {
     // 'class Error' is not a predefined class.
     return Field::null();
@@ -356,9 +368,9 @@
 }
 
 
-RawStacktrace* Exceptions::CurrentStacktrace() {
+RawStackTrace* Exceptions::CurrentStackTrace() {
   Zone* zone = Thread::Current()->zone();
-  RegularStacktraceBuilder frame_builder(zone);
+  RegularStackTraceBuilder frame_builder(zone);
   BuildStackTrace(&frame_builder);
 
   // Create arrays for code and pc_offset tuples of each frame.
@@ -366,8 +378,8 @@
       Array::Handle(zone, Array::MakeArray(frame_builder.code_list()));
   const Array& full_pc_offset_array =
       Array::Handle(zone, Array::MakeArray(frame_builder.pc_offset_list()));
-  const Stacktrace& full_stacktrace = Stacktrace::Handle(
-      Stacktrace::New(full_code_array, full_pc_offset_array));
+  const StackTrace& full_stacktrace = StackTrace::Handle(
+      StackTrace::New(full_code_array, full_pc_offset_array));
   return full_stacktrace.raw();
 }
 
@@ -408,7 +420,7 @@
       UNREACHABLE();
     }
     stacktrace ^= isolate->object_store()->preallocated_stack_trace();
-    PreallocatedStacktraceBuilder frame_builder(stacktrace);
+    PreallocatedStackTraceBuilder frame_builder(stacktrace);
     if (handler_needs_stacktrace) {
       BuildStackTrace(&frame_builder);
     }
@@ -423,11 +435,11 @@
       // Get stacktrace field of class Error to determine whether we have a
       // subclass of Error which carries around its stack trace.
       const Field& stacktrace_field =
-          Field::Handle(zone, LookupStacktraceField(exception));
+          Field::Handle(zone, LookupStackTraceField(exception));
       if (!stacktrace_field.IsNull() || handler_needs_stacktrace) {
         // Collect the stacktrace if needed.
         ASSERT(existing_stacktrace.IsNull());
-        stacktrace = Exceptions::CurrentStacktrace();
+        stacktrace = Exceptions::CurrentStackTrace();
         // If we have an Error object, then set its stackTrace field only if it
         // not yet initialized.
         if (!stacktrace_field.IsNull() &&
@@ -461,7 +473,7 @@
     // the isolate etc.).
     const UnhandledException& unhandled_exception = UnhandledException::Handle(
         zone, UnhandledException::New(exception, stacktrace));
-    stacktrace = Stacktrace::null();
+    stacktrace = StackTrace::null();
     JumpToExceptionHandler(thread, handler_pc, handler_sp, handler_fp,
                            unhandled_exception, stacktrace);
   }
@@ -620,7 +632,7 @@
     }
   }
   // Null object is a valid exception object.
-  ThrowExceptionHelper(thread, exception, Stacktrace::Handle(thread->zone()),
+  ThrowExceptionHelper(thread, exception, StackTrace::Handle(thread->zone()),
                        false);
 }
 
@@ -653,7 +665,7 @@
     uword handler_fp = 0;
     FindErrorHandler(&handler_pc, &handler_sp, &handler_fp);
     JumpToExceptionHandler(thread, handler_pc, handler_sp, handler_fp, error,
-                           Stacktrace::Handle(zone));  // Null stacktrace.
+                           StackTrace::Handle(zone));  // Null stacktrace.
   }
   UNREACHABLE();
 }
diff --git a/runtime/vm/exceptions.h b/runtime/vm/exceptions.h
index c3fc408..48e0f4a 100644
--- a/runtime/vm/exceptions.h
+++ b/runtime/vm/exceptions.h
@@ -21,7 +21,7 @@
 class RawInstance;
 class RawObject;
 class RawScript;
-class RawStacktrace;
+class RawStackTrace;
 class String;
 class Thread;
 
@@ -34,7 +34,7 @@
   static void PropagateError(const Error& error);
 
   // Helpers to create and throw errors.
-  static RawStacktrace* CurrentStacktrace();
+  static RawStackTrace* CurrentStackTrace();
   static RawScript* GetCallerScript(DartFrameIterator* iterator);
   static RawInstance* NewInstance(const char* class_name);
   static void CreateAndThrowTypeError(TokenPosition location,
@@ -83,7 +83,8 @@
   static void JumpToFrame(Thread* thread,
                           uword program_counter,
                           uword stack_pointer,
-                          uword frame_pointer);
+                          uword frame_pointer,
+                          bool clear_deopt_at_target);
 
  private:
   DISALLOW_COPY_AND_ASSIGN(Exceptions);
diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h
index c59746e..bd6f464 100644
--- a/runtime/vm/flag_list.h
+++ b/runtime/vm/flag_list.h
@@ -103,7 +103,6 @@
     "Maximum number of polymorphic check, otherwise it is megamorphic.")       \
   P(max_equality_polymorphic_checks, int, 32,                                  \
     "Maximum number of polymorphic checks in equality operator,")              \
-  P(merge_sin_cos, bool, false, "Merge sin/cos into sincos")                   \
   P(new_gen_ext_limit, int, 64,                                                \
     "maximum total external size (MB) in new gen before triggering GC")        \
   P(new_gen_semi_max_size, int, (kWordSize <= 4) ? 16 : 32,                    \
@@ -162,6 +161,8 @@
     "Enables heap verification after GC.")                                     \
   R(verify_before_gc, false, bool, false,                                      \
     "Enables heap verification before GC.")                                    \
+  D(verify_gc_contains, bool, false,                                           \
+    "Enables verification of address contains during GC.")                     \
   D(verify_on_transition, bool, false, "Verify on dart <==> VM.")
 
 #endif  // RUNTIME_VM_FLAG_LIST_H_
diff --git a/runtime/vm/flow_graph.cc b/runtime/vm/flow_graph.cc
index 4eb78fa..16ed1eb 100644
--- a/runtime/vm/flow_graph.cc
+++ b/runtime/vm/flow_graph.cc
@@ -2052,7 +2052,6 @@
       }
     }
     TryMergeTruncDivMod(&div_mod_merge);
-    TryMergeMathUnary(&sin_cos_merge);
   }
 }
 
@@ -2225,63 +2224,6 @@
 }
 
 
-// Tries to merge MathUnary operations, in this case sine and cosine.
-void FlowGraph::TryMergeMathUnary(
-    GrowableArray<InvokeMathCFunctionInstr*>* merge_candidates) {
-  if (!FlowGraphCompiler::SupportsSinCos() || !CanUnboxDouble() ||
-      !FLAG_merge_sin_cos) {
-    return;
-  }
-  if (merge_candidates->length() < 2) {
-    // Need at least a SIN and a COS.
-    return;
-  }
-  for (intptr_t i = 0; i < merge_candidates->length(); i++) {
-    InvokeMathCFunctionInstr* curr_instr = (*merge_candidates)[i];
-    if (curr_instr == NULL) {
-      // Instruction was merged already.
-      continue;
-    }
-    const MethodRecognizer::Kind kind = curr_instr->recognized_kind();
-    ASSERT((kind == MethodRecognizer::kMathSin) ||
-           (kind == MethodRecognizer::kMathCos));
-    // Check if there is sin/cos binop with same inputs.
-    const MethodRecognizer::Kind other_kind =
-        (kind == MethodRecognizer::kMathSin) ? MethodRecognizer::kMathCos
-                                             : MethodRecognizer::kMathSin;
-    Definition* def = curr_instr->InputAt(0)->definition();
-    for (intptr_t k = i + 1; k < merge_candidates->length(); k++) {
-      InvokeMathCFunctionInstr* other_op = (*merge_candidates)[k];
-      // 'other_op' can be NULL if it was already merged.
-      if ((other_op != NULL) && (other_op->recognized_kind() == other_kind) &&
-          (other_op->InputAt(0)->definition() == def)) {
-        (*merge_candidates)[k] = NULL;  // Clear it.
-        ASSERT(curr_instr->HasUses());
-        AppendExtractNthOutputForMerged(curr_instr,
-                                        MergedMathInstr::OutputIndexOf(kind),
-                                        kUnboxedDouble, kDoubleCid);
-        ASSERT(other_op->HasUses());
-        AppendExtractNthOutputForMerged(
-            other_op, MergedMathInstr::OutputIndexOf(other_kind),
-            kUnboxedDouble, kDoubleCid);
-        ZoneGrowableArray<Value*>* args = new (Z) ZoneGrowableArray<Value*>(1);
-        args->Add(new (Z) Value(curr_instr->InputAt(0)->definition()));
-        // Replace with SinCos.
-        MergedMathInstr* sin_cos = new (Z) MergedMathInstr(
-            args, curr_instr->DeoptimizationTarget(), MergedMathInstr::kSinCos);
-        curr_instr->ReplaceWith(sin_cos, NULL);
-        other_op->ReplaceUsesWith(sin_cos);
-        other_op->RemoveFromGraph();
-        // Only one merge possible. Because canonicalization happens later,
-        // more candidates are possible.
-        // TODO(srdjan): Allow merging of sin/cos into sincos.
-        break;
-      }
-    }
-  }
-}
-
-
 void FlowGraph::AppendExtractNthOutputForMerged(Definition* instr,
                                                 intptr_t index,
                                                 Representation rep,
diff --git a/runtime/vm/flow_graph.h b/runtime/vm/flow_graph.h
index 544dfac..9c1c08e 100644
--- a/runtime/vm/flow_graph.h
+++ b/runtime/vm/flow_graph.h
@@ -351,8 +351,6 @@
       Definition* right_instr);
 
   void TryMergeTruncDivMod(GrowableArray<BinarySmiOpInstr*>* merge_candidates);
-  void TryMergeMathUnary(
-      GrowableArray<InvokeMathCFunctionInstr*>* merge_candidates);
 
   void AppendExtractNthOutputForMerged(Definition* instr,
                                        intptr_t ix,
diff --git a/runtime/vm/flow_graph_allocator.cc b/runtime/vm/flow_graph_allocator.cc
index 9010074..4bc071c 100644
--- a/runtime/vm/flow_graph_allocator.cc
+++ b/runtime/vm/flow_graph_allocator.cc
@@ -32,7 +32,7 @@
 static const intptr_t kPairVirtualRegisterOffset = 1;
 
 // Definitions which have pair representations
-// (kPairOfTagged or kPairOfUnboxedDouble) use two virtual register names.
+// (kPairOfTagged) use two virtual register names.
 // At SSA index allocation time each definition reserves two SSA indexes,
 // the second index is only used for pairs. This function maps from the first
 // SSA index to the second.
@@ -786,8 +786,7 @@
   const Representation rep = instr->representation();
 #if !defined(TARGET_ARCH_DBC)
   if ((rep == kUnboxedDouble) || (rep == kUnboxedFloat32x4) ||
-      (rep == kUnboxedInt32x4) || (rep == kUnboxedFloat64x2) ||
-      (rep == kPairOfUnboxedDouble)) {
+      (rep == kUnboxedInt32x4) || (rep == kUnboxedFloat64x2)) {
     return Location::kFpuRegister;
   } else {
     return Location::kRegister;
@@ -796,7 +795,7 @@
   // DBC supports only unboxed doubles and does not have distinguished FPU
   // registers.
   ASSERT((rep != kUnboxedFloat32x4) && (rep != kUnboxedInt32x4) &&
-         (rep != kUnboxedFloat64x2) && (rep != kPairOfUnboxedDouble));
+         (rep != kUnboxedFloat64x2));
   return Location::kRegister;
 #endif
 }
diff --git a/runtime/vm/flow_graph_builder.cc b/runtime/vm/flow_graph_builder.cc
index e3963d9..1bafaa5 100644
--- a/runtime/vm/flow_graph_builder.cc
+++ b/runtime/vm/flow_graph_builder.cc
@@ -76,12 +76,11 @@
 }
 
 
-#define RECOGNIZE_FACTORY(test_factory_symbol, cid, fp)                        \
-  {Symbols::k##test_factory_symbol##Id, cid, fp,                               \
-   #test_factory_symbol ", " #cid},  // NOLINT
+#define RECOGNIZE_FACTORY(symbol, class_name, constructor_name, cid, fp)       \
+  {Symbols::k##symbol##Id, cid, fp, #symbol ", " #cid},  // NOLINT
 
 static struct {
-  intptr_t symbold_id;
+  intptr_t symbol_id;
   intptr_t cid;
   intptr_t finger_print;
   const char* name;
@@ -98,10 +97,10 @@
          (lib.raw() == Library::TypedDataLibrary()));
   const String& factory_name = String::Handle(factory.name());
   for (intptr_t i = 0;
-       factory_recognizer_list[i].symbold_id != Symbols::kIllegal; i++) {
+       factory_recognizer_list[i].symbol_id != Symbols::kIllegal; i++) {
     if (String::EqualsIgnoringPrivateKey(
             factory_name,
-            Symbols::Symbol(factory_recognizer_list[i].symbold_id))) {
+            Symbols::Symbol(factory_recognizer_list[i].symbol_id))) {
       return factory_recognizer_list[i].cid;
     }
   }
@@ -992,23 +991,8 @@
 }
 
 
-void TestGraphVisitor::MergeBranchWithComparison(ComparisonInstr* comp) {
-  BranchInstr* branch;
-  if (Token::IsStrictEqualityOperator(comp->kind())) {
-    ASSERT(comp->IsStrictCompare());
-    branch = new (Z) BranchInstr(comp);
-  } else if (Token::IsEqualityOperator(comp->kind()) &&
-             (comp->left()->BindsToConstantNull() ||
-              comp->right()->BindsToConstantNull())) {
-    branch = new (Z) BranchInstr(new (Z) StrictCompareInstr(
-        comp->token_pos(),
-        (comp->kind() == Token::kEQ) ? Token::kEQ_STRICT : Token::kNE_STRICT,
-        comp->left(), comp->right(),
-        false));  // No number check.
-  } else {
-    branch = new (Z) BranchInstr(comp);
-    branch->set_is_checked(Isolate::Current()->type_checks());
-  }
+void TestGraphVisitor::MergeBranchWithStrictCompare(StrictCompareInstr* comp) {
+  BranchInstr* branch = new (Z) BranchInstr(comp);
   AddInstruction(branch);
   CloseFragment();
   true_successor_addresses_.Add(branch->true_successor_address());
@@ -1031,9 +1015,9 @@
 
 
 void TestGraphVisitor::ReturnDefinition(Definition* definition) {
-  ComparisonInstr* comp = definition->AsComparison();
+  StrictCompareInstr* comp = definition->AsStrictCompare();
   if (comp != NULL) {
-    MergeBranchWithComparison(comp);
+    MergeBranchWithStrictCompare(comp);
     return;
   }
   if (!Isolate::Current()->type_checks()) {
@@ -2120,6 +2104,11 @@
 
 
 void EffectGraphVisitor::VisitJumpNode(JumpNode* node) {
+  if (FLAG_support_debugger && owner()->function().is_debuggable()) {
+    AddInstruction(new (Z) DebugStepCheckInstr(node->token_pos(),
+                                               RawPcDescriptors::kRuntimeCall));
+  }
+
   NestedContextAdjustment context_adjustment(owner(), owner()->context_level());
 
   for (intptr_t i = 0; i < node->inlined_finally_list_length(); i++) {
@@ -3380,7 +3369,7 @@
     if (rhs->IsAssignableNode()) {
       rhs = rhs->AsAssignableNode()->expr();
     }
-    if ((rhs->IsLiteralNode() ||
+    if ((rhs->IsLiteralNode() || rhs->IsLoadStaticFieldNode() ||
          (rhs->IsLoadLocalNode() &&
           !rhs->AsLoadLocalNode()->local().IsInternal()) ||
          rhs->IsClosureNode()) &&
@@ -3492,7 +3481,7 @@
       rhs = rhs->AsAssignableNode()->expr();
     }
     if ((rhs->IsLiteralNode() || rhs->IsLoadLocalNode() ||
-         rhs->IsClosureNode()) &&
+         rhs->IsLoadStaticFieldNode() || rhs->IsClosureNode()) &&
         node->token_pos().IsDebugPause()) {
       AddInstruction(new (Z) DebugStepCheckInstr(
           node->token_pos(), RawPcDescriptors::kRuntimeCall));
@@ -4223,6 +4212,7 @@
   if (FLAG_support_debugger) {
     if (node->exception()->IsLiteralNode() ||
         node->exception()->IsLoadLocalNode() ||
+        node->exception()->IsLoadStaticFieldNode() ||
         node->exception()->IsClosureNode()) {
       AddInstruction(new (Z) DebugStepCheckInstr(
           node->token_pos(), RawPcDescriptors::kRuntimeCall));
diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
index 8db4aae..98819bc 100644
--- a/runtime/vm/flow_graph_builder.h
+++ b/runtime/vm/flow_graph_builder.h
@@ -544,7 +544,7 @@
   // or adds the definition to the graph and returns a use of its value.
   virtual void ReturnDefinition(Definition* definition);
 
-  void MergeBranchWithComparison(ComparisonInstr* comp);
+  void MergeBranchWithStrictCompare(StrictCompareInstr* comp);
   void MergeBranchWithNegate(BooleanNegateInstr* comp);
 
   BlockEntryInstr* CreateSuccessorFor(
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index c6b6663..2ab89c1 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -67,14 +67,6 @@
 DECLARE_FLAG(int, stacktrace_every);
 DECLARE_FLAG(charp, stacktrace_filter);
 DECLARE_FLAG(bool, trace_compiler);
-DECLARE_FLAG(int, inlining_hotness);
-DECLARE_FLAG(int, inlining_size_threshold);
-DECLARE_FLAG(int, inlining_callee_size_threshold);
-DECLARE_FLAG(int, inline_getters_setters_smaller_than);
-DECLARE_FLAG(int, inlining_depth_threshold);
-DECLARE_FLAG(int, inlining_caller_size_threshold);
-DECLARE_FLAG(int, inlining_constant_arguments_max_size_threshold);
-DECLARE_FLAG(int, inlining_constant_arguments_min_size_threshold);
 DECLARE_FLAG(int, reload_every);
 DECLARE_FLAG(bool, unbox_numeric_fields);
 
@@ -84,22 +76,6 @@
     FATAL("Precompilation not supported on IA32");
 #endif
 
-#if !defined(DART_PRECOMPILED_RUNTIME)
-    // Flags affecting compilation only:
-    // There is no counter feedback in precompilation, so ignore the counter
-    // when making inlining decisions.
-    FLAG_inlining_hotness = 0;
-    // Use smaller thresholds in precompilation as we are compiling everything
-    // with the optimizing compiler instead of only hot functions.
-    FLAG_inlining_size_threshold = 5;
-    FLAG_inline_getters_setters_smaller_than = 5;
-    FLAG_inlining_callee_size_threshold = 20;
-    FLAG_inlining_depth_threshold = 4;
-    FLAG_inlining_caller_size_threshold = 1000;
-    FLAG_inlining_constant_arguments_max_size_threshold = 100;
-    FLAG_inlining_constant_arguments_min_size_threshold = 30;
-#endif
-
     FLAG_background_compilation = false;
     FLAG_fields_may_be_reset = true;
     FLAG_interpret_irregexp = true;
@@ -114,7 +90,8 @@
     FLAG_unbox_numeric_fields = false;
 
 #if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
-    // Set flags affecting runtime accordingly for dart_noopt.
+    // Set flags affecting runtime accordingly for dart_bootstrap.
+    // These flags are constants with PRODUCT and DART_PRECOMPILED_RUNTIME.
     FLAG_collect_code = false;
     FLAG_support_debugger = false;
     FLAG_deoptimize_alot = false;  // Used in some tests.
@@ -785,8 +762,8 @@
 }
 
 
-void FlowGraphCompiler::SetNeedsStacktrace(intptr_t try_index) {
-  exception_handlers_list_->SetNeedsStacktrace(try_index);
+void FlowGraphCompiler::SetNeedsStackTrace(intptr_t try_index) {
+  exception_handlers_list_->SetNeedsStackTrace(try_index);
 }
 
 
@@ -815,7 +792,7 @@
 }
 
 
-void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id) {
+CompilerDeoptInfo* FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id) {
   ASSERT(is_optimizing());
   ASSERT(!intrinsic_mode());
   CompilerDeoptInfo* info =
@@ -824,6 +801,7 @@
                                      pending_deoptimization_env_);
   info->set_pc_offset(assembler()->CodeSize());
   deopt_infos_.Add(info);
+  return info;
 }
 
 
@@ -1070,13 +1048,13 @@
 }
 
 
-void FlowGraphCompiler::FinalizeStackmaps(const Code& code) {
+void FlowGraphCompiler::FinalizeStackMaps(const Code& code) {
   if (stackmap_table_builder_ == NULL) {
     code.set_stackmaps(Object::null_array());
   } else {
     // Finalize the stack map array and add it to the code object.
     code.set_stackmaps(
-        Array::Handle(stackmap_table_builder_->FinalizeStackmaps(code)));
+        Array::Handle(stackmap_table_builder_->FinalizeStackMaps(code)));
   }
 }
 
@@ -1271,6 +1249,7 @@
                                    kNumArgsChecked)
               ->raw();
     }
+    AddCurrentDescriptor(RawPcDescriptors::kRewind, deopt_id, token_pos);
     EmitUnoptimizedStaticCall(argument_count, deopt_id, token_pos, locs,
                               call_ic_data);
   }
diff --git a/runtime/vm/flow_graph_compiler.h b/runtime/vm/flow_graph_compiler.h
index afdb4cb..9e5b784 100644
--- a/runtime/vm/flow_graph_compiler.h
+++ b/runtime/vm/flow_graph_compiler.h
@@ -122,6 +122,9 @@
         deopt_id_(deopt_id),
         reason_(reason),
         flags_(flags),
+#if defined(TARGET_ARCH_DBC)
+        lazy_deopt_with_result_(false),
+#endif
         deopt_env_(deopt_env) {
     ASSERT(deopt_env != NULL);
   }
@@ -143,6 +146,18 @@
   uint32_t flags() const { return flags_; }
   const Environment* deopt_env() const { return deopt_env_; }
 
+#if defined(TARGET_ARCH_DBC)
+  // On DBC calls return results on the stack but not all calls have a result.
+  // This needs to be taken into account when constructing lazy deoptimization
+  // environment.
+  // For calls with results we add a deopt instruction that would copy top
+  // of the stack from optimized frame to unoptimized frame effectively
+  // preserving the result of the call.
+  // For calls with no results we don't emit such instruction - because there
+  // is no result pushed by the return sequence.
+  void mark_lazy_deopt_with_result() { lazy_deopt_with_result_ = true; }
+#endif
+
  private:
   void EmitMaterializations(Environment* env, DeoptInfoBuilder* builder);
 
@@ -153,6 +168,9 @@
   const intptr_t deopt_id_;
   const ICData::DeoptReasonId reason_;
   const uint32_t flags_;
+#if defined(TARGET_ARCH_DBC)
+  bool lazy_deopt_with_result_;
+#endif
   Environment* deopt_env_;
 
   DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfo);
@@ -274,7 +292,6 @@
 
   static bool SupportsUnboxedDoubles();
   static bool SupportsUnboxedMints();
-  static bool SupportsSinCos();
   static bool SupportsUnboxedSimd128();
   static bool SupportsHardwareDivision();
   static bool CanConvertUnboxedMintToDouble();
@@ -478,7 +495,7 @@
                            intptr_t pc_offset,
                            const Array& handler_types,
                            bool needs_stacktrace);
-  void SetNeedsStacktrace(intptr_t try_index);
+  void SetNeedsStackTrace(intptr_t try_index);
   void AddCurrentDescriptor(RawPcDescriptors::Kind kind,
                             intptr_t deopt_id,
                             TokenPosition token_pos);
@@ -499,14 +516,14 @@
   uint16_t ToEmbeddableCid(intptr_t cid, Instruction* instruction);
 #endif  // defined(TARGET_ARCH_DBC)
 
-  void AddDeoptIndexAtCall(intptr_t deopt_id);
+  CompilerDeoptInfo* AddDeoptIndexAtCall(intptr_t deopt_id);
 
   void AddSlowPathCode(SlowPathCode* slow_path);
 
   void FinalizeExceptionHandlers(const Code& code);
   void FinalizePcDescriptors(const Code& code);
   RawArray* CreateDeoptInfo(Assembler* assembler);
-  void FinalizeStackmaps(const Code& code);
+  void FinalizeStackMaps(const Code& code);
   void FinalizeVarDescriptors(const Code& code);
   void FinalizeStaticCallTargetsTable(const Code& code);
 
@@ -583,11 +600,16 @@
   bool EndCodeSourceRange(TokenPosition token_pos);
 
 #if defined(TARGET_ARCH_DBC)
+  enum CallResult {
+    kHasResult,
+    kNoResult,
+  };
   void RecordAfterCallHelper(TokenPosition token_pos,
                              intptr_t deopt_id,
                              intptr_t argument_count,
+                             CallResult result,
                              LocationSummary* locs);
-  void RecordAfterCall(Instruction* instr);
+  void RecordAfterCall(Instruction* instr, CallResult result);
 #endif
 
  private:
@@ -699,9 +721,9 @@
 
   intptr_t GetOptimizationThreshold() const;
 
-  StackmapTableBuilder* stackmap_table_builder() {
+  StackMapTableBuilder* stackmap_table_builder() {
     if (stackmap_table_builder_ == NULL) {
-      stackmap_table_builder_ = new StackmapTableBuilder();
+      stackmap_table_builder_ = new StackMapTableBuilder();
     }
     return stackmap_table_builder_;
   }
@@ -752,7 +774,7 @@
   BlockEntryInstr* current_block_;
   ExceptionHandlerList* exception_handlers_list_;
   DescriptorList* pc_descriptors_list_;
-  StackmapTableBuilder* stackmap_table_builder_;
+  StackMapTableBuilder* stackmap_table_builder_;
   CodeSourceMapBuilder* code_source_map_builder_;
   intptr_t saved_code_size_;
   GrowableArray<BlockInfo*> block_info_;
diff --git a/runtime/vm/flow_graph_compiler_arm.cc b/runtime/vm/flow_graph_compiler_arm.cc
index 4e61306..e16256c 100644
--- a/runtime/vm/flow_graph_compiler_arm.cc
+++ b/runtime/vm/flow_graph_compiler_arm.cc
@@ -53,11 +53,6 @@
 }
 
 
-bool FlowGraphCompiler::SupportsSinCos() {
-  return false;
-}
-
-
 bool FlowGraphCompiler::SupportsHardwareDivision() {
   return TargetCPUFeatures::can_divide();
 }
@@ -550,7 +545,7 @@
 
 // If instanceof type test cannot be performed successfully at compile time and
 // therefore eliminated, optimize it by adding inlined tests for:
-// - NULL -> return false.
+// - NULL -> return type == Null (type is not Object or dynamic).
 // - Smi -> compile time subtype check (only if dst class is not parameterized).
 // - Class equality (only if class is not parameterized).
 // Inputs:
@@ -564,6 +559,7 @@
                                            bool negate_result,
                                            LocationSummary* locs) {
   ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded());
+  ASSERT(!type.IsObjectType() && !type.IsDynamicType());
 
   // Preserve instantiator type arguments (R1).
   __ Push(R1);
@@ -572,13 +568,13 @@
   // If type is instantiated and non-parameterized, we can inline code
   // checking whether the tested instance is a Smi.
   if (type.IsInstantiated()) {
-    // A null object is only an instance of Object and dynamic, which has
-    // already been checked above (if the type is instantiated). So we can
-    // return false here if the instance is null (and if the type is
-    // instantiated).
+    // A null object is only an instance of Null, Object, and dynamic.
+    // Object and dynamic have already been checked above (if the type is
+    // instantiated). So we can return false here if the instance is null,
+    // unless the type is Null (and if the type is instantiated).
     // We can only inline this null check if the type is instantiated at compile
-    // time, since an uninstantiated type at compile time could be Object or
-    // dynamic at run time.
+    // time, since an uninstantiated type at compile time could be Null, Object,
+    // or dynamic at run time.
     __ CompareObject(R0, Object::null_object());
     __ b(type.IsNullType() ? &is_instance : &is_not_instance, EQ);
   }
diff --git a/runtime/vm/flow_graph_compiler_arm64.cc b/runtime/vm/flow_graph_compiler_arm64.cc
index 85c0a76f..8534b1f 100644
--- a/runtime/vm/flow_graph_compiler_arm64.cc
+++ b/runtime/vm/flow_graph_compiler_arm64.cc
@@ -51,11 +51,6 @@
 }
 
 
-bool FlowGraphCompiler::SupportsSinCos() {
-  return false;
-}
-
-
 bool FlowGraphCompiler::CanConvertUnboxedMintToDouble() {
   // ARM does not have a short instruction sequence for converting int64 to
   // double.
@@ -543,7 +538,7 @@
 
 // If instanceof type test cannot be performed successfully at compile time and
 // therefore eliminated, optimize it by adding inlined tests for:
-// - NULL -> return false.
+// - NULL -> return type == Null (type is not Object or dynamic).
 // - Smi -> compile time subtype check (only if dst class is not parameterized).
 // - Class equality (only if class is not parameterized).
 // Inputs:
@@ -557,6 +552,7 @@
                                            bool negate_result,
                                            LocationSummary* locs) {
   ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded());
+  ASSERT(!type.IsObjectType() && !type.IsDynamicType());
 
   // Preserve instantiator type arguments (R1).
   __ Push(R1);
@@ -565,13 +561,13 @@
   // If type is instantiated and non-parameterized, we can inline code
   // checking whether the tested instance is a Smi.
   if (type.IsInstantiated()) {
-    // A null object is only an instance of Object and dynamic, which has
-    // already been checked above (if the type is instantiated). So we can
-    // return false here if the instance is null (and if the type is
-    // instantiated).
+    // A null object is only an instance of Null, Object, and dynamic.
+    // Object and dynamic have already been checked above (if the type is
+    // instantiated). So we can return false here if the instance is null,
+    // unless the type is Null (and if the type is instantiated).
     // We can only inline this null check if the type is instantiated at compile
-    // time, since an uninstantiated type at compile time could be Object or
-    // dynamic at run time.
+    // time, since an uninstantiated type at compile time could be Null, Object,
+    // or dynamic at run time.
     __ CompareObject(R0, Object::null_object());
     __ b(type.IsNullType() ? &is_instance : &is_not_instance, EQ);
   }
diff --git a/runtime/vm/flow_graph_compiler_dbc.cc b/runtime/vm/flow_graph_compiler_dbc.cc
index 745fcf9..52e3af3 100644
--- a/runtime/vm/flow_graph_compiler_dbc.cc
+++ b/runtime/vm/flow_graph_compiler_dbc.cc
@@ -58,11 +58,6 @@
 }
 
 
-bool FlowGraphCompiler::SupportsSinCos() {
-  return false;
-}
-
-
 bool FlowGraphCompiler::SupportsHardwareDivision() {
   return true;
 }
@@ -118,6 +113,11 @@
   // will be able to find them during materialization.
   slot_ix = builder->EmitMaterializationArguments(slot_ix);
 
+  if (lazy_deopt_with_result_) {
+    ASSERT(reason() == ICData::kDeoptAtCall);
+    builder->AddCopy(NULL, Location::StackSlot(stack_height), slot_ix++);
+  }
+
   // For the innermost environment, set outgoing arguments and the locals.
   for (intptr_t i = current->Length() - 1;
        i >= current->fixed_parameter_count(); i--) {
@@ -179,6 +179,7 @@
 void FlowGraphCompiler::RecordAfterCallHelper(TokenPosition token_pos,
                                               intptr_t deopt_id,
                                               intptr_t argument_count,
+                                              CallResult result,
                                               LocationSummary* locs) {
   RecordSafepoint(locs);
   // Marks either the continuation point in unoptimized code or the
@@ -190,7 +191,10 @@
     // On all other architectures caller drops outgoing arguments itself
     // hence the difference.
     pending_deoptimization_env_->DropArguments(argument_count);
-    AddDeoptIndexAtCall(deopt_id_after);
+    CompilerDeoptInfo* info = AddDeoptIndexAtCall(deopt_id_after);
+    if (result == kHasResult) {
+      info->mark_lazy_deopt_with_result();
+    }
     // This descriptor is needed for exception handling in optimized code.
     AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id_after, token_pos);
   } else {
@@ -201,9 +205,9 @@
 }
 
 
-void FlowGraphCompiler::RecordAfterCall(Instruction* instr) {
+void FlowGraphCompiler::RecordAfterCall(Instruction* instr, CallResult result) {
   RecordAfterCallHelper(instr->token_pos(), instr->deopt_id(),
-                        instr->ArgumentCount(), instr->locs());
+                        instr->ArgumentCount(), result, instr->locs());
 }
 
 
@@ -263,7 +267,9 @@
     locs->SetStackBit(locs->out(0).reg());
   }
   AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos);
-  RecordAfterCallHelper(token_pos, deopt_id, 0, locs);
+  const intptr_t kArgCount = 0;
+  RecordAfterCallHelper(token_pos, deopt_id, kArgCount,
+                        FlowGraphCompiler::kHasResult, locs);
   if (is_optimizing()) {
     // Assert assignable keeps the instance on the stack as the result,
     // all other arguments are popped.
diff --git a/runtime/vm/flow_graph_compiler_ia32.cc b/runtime/vm/flow_graph_compiler_ia32.cc
index fbc891e..e0d5846 100644
--- a/runtime/vm/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/flow_graph_compiler_ia32.cc
@@ -56,11 +56,6 @@
 }
 
 
-bool FlowGraphCompiler::SupportsSinCos() {
-  return true;
-}
-
-
 bool FlowGraphCompiler::SupportsHardwareDivision() {
   return true;
 }
@@ -554,7 +549,7 @@
 
 // If instanceof type test cannot be performed successfully at compile time and
 // therefore eliminated, optimize it by adding inlined tests for:
-// - NULL -> return false.
+// - NULL -> return type == Null (type is not Object or dynamic).
 // - Smi -> compile time subtype check (only if dst class is not parameterized).
 // - Class equality (only if class is not parameterized).
 // Inputs:
@@ -569,6 +564,7 @@
                                            bool negate_result,
                                            LocationSummary* locs) {
   ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
+  ASSERT(!type.IsObjectType() && !type.IsDynamicType());
 
   const Immediate& raw_null =
       Immediate(reinterpret_cast<intptr_t>(Object::null()));
@@ -577,13 +573,13 @@
   // If type is instantiated and non-parameterized, we can inline code
   // checking whether the tested instance is a Smi.
   if (type.IsInstantiated()) {
-    // A null object is only an instance of Object and dynamic, which has
-    // already been checked above (if the type is instantiated). So we can
-    // return false here if the instance is null (and if the type is
-    // instantiated).
+    // A null object is only an instance of Null, Object, and dynamic.
+    // Object and dynamic have already been checked above (if the type is
+    // instantiated). So we can return false here if the instance is null,
+    // unless the type is Null (and if the type is instantiated).
     // We can only inline this null check if the type is instantiated at compile
-    // time, since an uninstantiated type at compile time could be Object or
-    // dynamic at run time.
+    // time, since an uninstantiated type at compile time could be Null, Object,
+    // or dynamic at run time.
     __ cmpl(EAX, raw_null);
     __ j(EQUAL, type.IsNullType() ? &is_instance : &is_not_instance);
   }
diff --git a/runtime/vm/flow_graph_compiler_mips.cc b/runtime/vm/flow_graph_compiler_mips.cc
index fddc901..b6914ad 100644
--- a/runtime/vm/flow_graph_compiler_mips.cc
+++ b/runtime/vm/flow_graph_compiler_mips.cc
@@ -49,11 +49,6 @@
 }
 
 
-bool FlowGraphCompiler::SupportsSinCos() {
-  return false;
-}
-
-
 bool FlowGraphCompiler::SupportsHardwareDivision() {
   return true;
 }
@@ -538,7 +533,7 @@
 
 // If instanceof type test cannot be performed successfully at compile time and
 // therefore eliminated, optimize it by adding inlined tests for:
-// - NULL -> return false.
+// - NULL -> return type == Null (type is not Object or dynamic).
 // - Smi -> compile time subtype check (only if dst class is not parameterized).
 // - Class equality (only if class is not parameterized).
 // Inputs:
@@ -552,6 +547,7 @@
                                            bool negate_result,
                                            LocationSummary* locs) {
   ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded());
+  ASSERT(!type.IsObjectType() && !type.IsDynamicType());
 
   // Preserve instantiator type arguments (A1).
   __ addiu(SP, SP, Immediate(-1 * kWordSize));
@@ -561,13 +557,13 @@
   // If type is instantiated and non-parameterized, we can inline code
   // checking whether the tested instance is a Smi.
   if (type.IsInstantiated()) {
-    // A null object is only an instance of Object and dynamic, which has
-    // already been checked above (if the type is instantiated). So we can
-    // return false here if the instance is null (and if the type is
-    // instantiated).
+    // A null object is only an instance of Null, Object, and dynamic.
+    // Object and dynamic have already been checked above (if the type is
+    // instantiated). So we can return false here if the instance is null,
+    // unless the type is Null (and if the type is instantiated).
     // We can only inline this null check if the type is instantiated at compile
-    // time, since an uninstantiated type at compile time could be Object or
-    // dynamic at run time.
+    // time, since an uninstantiated type at compile time could be Null, Object,
+    // or dynamic at run time.
     __ BranchEqual(A0, Object::null_object(),
                    type.IsNullType() ? &is_instance : &is_not_instance);
   }
diff --git a/runtime/vm/flow_graph_compiler_x64.cc b/runtime/vm/flow_graph_compiler_x64.cc
index 0944b5e..fa35f47 100644
--- a/runtime/vm/flow_graph_compiler_x64.cc
+++ b/runtime/vm/flow_graph_compiler_x64.cc
@@ -52,11 +52,6 @@
 }
 
 
-bool FlowGraphCompiler::SupportsSinCos() {
-  return true;
-}
-
-
 bool FlowGraphCompiler::SupportsHardwareDivision() {
   return true;
 }
@@ -549,7 +544,7 @@
 
 // If instanceof type test cannot be performed successfully at compile time and
 // therefore eliminated, optimize it by adding inlined tests for:
-// - NULL -> return false.
+// - NULL -> return type == Null (type is not Object or dynamic).
 // - Smi -> compile time subtype check (only if dst class is not parameterized).
 // - Class equality (only if class is not parameterized).
 // Inputs:
@@ -564,19 +559,20 @@
                                            bool negate_result,
                                            LocationSummary* locs) {
   ASSERT(type.IsFinalized() && !type.IsMalformedOrMalbounded());
+  ASSERT(!type.IsObjectType() && !type.IsDynamicType());
 
   Label is_instance, is_not_instance;
   __ pushq(RDX);  // Store instantiator type arguments.
   // If type is instantiated and non-parameterized, we can inline code
   // checking whether the tested instance is a Smi.
   if (type.IsInstantiated()) {
-    // A null object is only an instance of Object and dynamic, which has
-    // already been checked above (if the type is instantiated). So we can
-    // return false here if the instance is null (and if the type is
-    // instantiated).
+    // A null object is only an instance of Null, Object, and dynamic.
+    // Object and dynamic have already been checked above (if the type is
+    // instantiated). So we can return false here if the instance is null,
+    // unless the type is Null (and if the type is instantiated).
     // We can only inline this null check if the type is instantiated at compile
-    // time, since an uninstantiated type at compile time could be Object or
-    // dynamic at run time.
+    // time, since an uninstantiated type at compile time could be Null, Object,
+    // or dynamic at run time.
     __ CompareObject(RAX, Object::null_object());
     __ j(EQUAL, type.IsNullType() ? &is_instance : &is_not_instance);
   }
diff --git a/runtime/vm/flow_graph_inliner.cc b/runtime/vm/flow_graph_inliner.cc
index 001535c..f07e7cd 100644
--- a/runtime/vm/flow_graph_inliner.cc
+++ b/runtime/vm/flow_graph_inliner.cc
@@ -5,6 +5,7 @@
 #include "vm/flow_graph_inliner.h"
 
 #include "vm/aot_optimizer.h"
+#include "vm/precompiler.h"
 #include "vm/block_scheduler.h"
 #include "vm/branch_optimizer.h"
 #include "vm/compiler.h"
@@ -159,7 +160,8 @@
            it.Advance()) {
         ++instruction_count_;
         Instruction* current = it.Current();
-        if (current->IsStaticCall() || current->IsClosureCall()) {
+        if (current->IsInstanceCall() || current->IsStaticCall() ||
+            current->IsClosureCall()) {
           ++call_site_count_;
           continue;
         }
@@ -212,8 +214,11 @@
 // A collection of call sites to consider for inlining.
 class CallSites : public ValueObject {
  public:
-  explicit CallSites(FlowGraph* flow_graph)
-      : static_calls_(), closure_calls_(), instance_calls_() {}
+  explicit CallSites(FlowGraph* flow_graph, intptr_t threshold)
+      : inlining_depth_threshold_(threshold),
+        static_calls_(),
+        closure_calls_(),
+        instance_calls_() {}
 
   struct InstanceCallInfo {
     PolymorphicInstanceCallInstr* call;
@@ -356,7 +361,7 @@
                      intptr_t depth,
                      GrowableArray<InlinedInfo>* inlined_info) {
     ASSERT(graph != NULL);
-    if (depth > FLAG_inlining_depth_threshold) {
+    if (depth > inlining_depth_threshold_) {
       if (FLAG_print_inlining_tree) {
         RecordAllNotInlinedFunction(graph, depth, inlined_info);
       }
@@ -366,7 +371,7 @@
     // Recognized methods are not treated as normal calls. They don't have
     // calls in themselves, so we keep adding those even when at the threshold.
     const bool inline_only_recognized_methods =
-        (depth == FLAG_inlining_depth_threshold);
+        (depth == inlining_depth_threshold_);
 
     const intptr_t instance_call_start_ix = instance_calls_.length();
     const intptr_t static_call_start_ix = static_calls_.length();
@@ -380,7 +385,8 @@
               current->AsPolymorphicInstanceCall();
           if (!inline_only_recognized_methods ||
               instance_call->HasSingleRecognizedTarget() ||
-              instance_call->ic_data().HasOnlyDispatcherTargets()) {
+              instance_call->ic_data()
+                  .HasOnlyDispatcherOrImplicitAccessorTargets()) {
             instance_calls_.Add(InstanceCallInfo(instance_call, graph));
           } else {
             // Method not inlined because inlining too deep and method
@@ -396,7 +402,8 @@
         } else if (current->IsStaticCall()) {
           StaticCallInstr* static_call = current->AsStaticCall();
           if (!inline_only_recognized_methods ||
-              static_call->function().IsRecognized()) {
+              static_call->function().IsRecognized() ||
+              static_call->function().IsDispatcherOrImplicitAccessor()) {
             static_calls_.Add(StaticCallInfo(static_call, graph));
           } else {
             // Method not inlined because inlining too deep and method
@@ -420,6 +427,7 @@
   }
 
  private:
+  intptr_t inlining_depth_threshold_;
   GrowableArray<StaticCallInfo> static_calls_;
   GrowableArray<ClosureCallInfo> closure_calls_;
   GrowableArray<InstanceCallInfo> instance_calls_;
@@ -510,7 +518,7 @@
 
 class CallSiteInliner : public ValueObject {
  public:
-  explicit CallSiteInliner(FlowGraphInliner* inliner)
+  explicit CallSiteInliner(FlowGraphInliner* inliner, intptr_t threshold)
       : inliner_(inliner),
         caller_graph_(inliner->flow_graph()),
         inlined_(false),
@@ -519,6 +527,7 @@
         inlined_recursive_call_(false),
         inlining_depth_(1),
         inlining_recursion_depth_(0),
+        inlining_depth_threshold_(threshold),
         collected_call_sites_(NULL),
         inlining_call_sites_(NULL),
         function_cache_(),
@@ -567,14 +576,14 @@
 
   void InlineCalls() {
     // If inlining depth is less then one abort.
-    if (FLAG_inlining_depth_threshold < 1) return;
+    if (inlining_depth_threshold_ < 1) return;
     if (caller_graph_->function().deoptimization_counter() >=
         FLAG_deoptimization_counter_inlining_threshold) {
       return;
     }
     // Create two call site collections to swap between.
-    CallSites sites1(caller_graph_);
-    CallSites sites2(caller_graph_);
+    CallSites sites1(caller_graph_, inlining_depth_threshold_);
+    CallSites sites2(caller_graph_, inlining_depth_threshold_);
     CallSites* call_sites_temp = NULL;
     collected_call_sites_ = &sites1;
     inlining_call_sites_ = &sites2;
@@ -666,6 +675,15 @@
       return false;
     }
 
+    if ((inliner_->precompiler_ != NULL) &&
+        inliner_->precompiler_->HasFeedback() &&
+        (function.usage_counter() <= 0) && !inliner_->AlwaysInline(function)) {
+      TRACE_INLINING(THR_Print("     Bailout: not compiled yet\n"));
+      PRINT_INLINING_TREE("Not compiled", &call_data->caller, &function,
+                          call_data->call);
+      return false;
+    }
+
     // Type feedback may have been cleared for this function (ClearICDataArray),
     // but we need it for inlining.
     if (!FLAG_precompiled_mode && (function.ic_data_array() == Array::null())) {
@@ -788,6 +806,16 @@
             callee_graph = builder.BuildGraph();
           }
         }
+#ifdef DART_PRECOMPILER
+        if (FLAG_precompiled_mode) {
+          Precompiler::PopulateWithICData(parsed_function->function(),
+                                          callee_graph);
+          if (inliner_->precompiler_ != NULL) {
+            inliner_->precompiler_->TryApplyFeedback(
+                parsed_function->function(), callee_graph);
+          }
+        }
+#endif
 
         // The parameter stubs are a copy of the actual arguments providing
         // concrete information about the values, for example constant values,
@@ -854,7 +882,6 @@
             AotOptimizer optimizer(inliner_->precompiler_, callee_graph,
                                    inliner_->use_speculative_inlining_,
                                    inliner_->inlining_black_list_);
-            optimizer.PopulateWithICData();
 
             optimizer.ApplyClassIds();
             DEBUG_ASSERT(callee_graph->VerifyUseLists());
@@ -935,10 +962,8 @@
         }
 
         // Inline dispatcher methods regardless of the current depth.
-        const intptr_t depth = (function.IsInvokeFieldDispatcher() ||
-                                function.IsNoSuchMethodDispatcher())
-                                   ? 0
-                                   : inlining_depth_;
+        const intptr_t depth =
+            function.IsDispatcherOrImplicitAccessor() ? 0 : inlining_depth_;
         collected_call_sites_->FindCallSites(callee_graph, depth,
                                              &inlined_info_);
 
@@ -1374,6 +1399,7 @@
   bool inlined_recursive_call_;
   intptr_t inlining_depth_;
   intptr_t inlining_recursion_depth_;
+  intptr_t inlining_depth_threshold_;
   CallSites* collected_call_sites_;
   CallSites* inlining_call_sites_;
   GrowableArray<ParsedFunction*> function_cache_;
@@ -1923,8 +1949,17 @@
     return true;
   }
 
-  if (function.IsImplicitGetterFunction() || function.IsGetterFunction() ||
-      function.IsImplicitSetterFunction() || function.IsSetterFunction() ||
+  if (function.IsDispatcherOrImplicitAccessor()) {
+    // Smaller or same size as the call.
+    return true;
+  }
+
+  if (function.is_const()) {
+    // Inlined const fields are smaller than a call.
+    return true;
+  }
+
+  if (function.IsGetterFunction() || function.IsSetterFunction() ||
       IsInlineableOperator(function) ||
       (function.kind() == RawFunction::kConstructor)) {
     const intptr_t count = function.optimized_instruction_count();
@@ -1957,7 +1992,13 @@
     printer.PrintBlocks();
   }
 
-  CallSiteInliner inliner(this);
+  intptr_t inlining_depth_threshold = FLAG_inlining_depth_threshold;
+  if ((precompiler_ != NULL) && precompiler_->HasFeedback() &&
+      (top.usage_counter() <= 0)) {
+    inlining_depth_threshold = 1;
+  }
+
+  CallSiteInliner inliner(this, inlining_depth_threshold);
   inliner.InlineCalls();
   if (FLAG_print_inlining_tree) {
     inliner.PrintInlinedInfo(top);
@@ -2192,15 +2233,13 @@
       }
       case kTypedDataFloat32x4ArrayCid: {
         type_args = flow_graph->constant_null();
-        ASSERT((array_cid != kTypedDataFloat32x4ArrayCid) ||
-               value_type.IsFloat32x4Type());
+        ASSERT(value_type.IsFloat32x4Type());
         ASSERT(value_type.IsInstantiated());
         break;
       }
       case kTypedDataFloat64x2ArrayCid: {
         type_args = flow_graph->constant_null();
-        ASSERT((array_cid != kTypedDataFloat64x2ArrayCid) ||
-               value_type.IsFloat64x2Type());
+        ASSERT(value_type.IsFloat64x2Type());
         ASSERT(value_type.IsInstantiated());
         break;
       }
diff --git a/runtime/vm/flow_graph_type_propagator.cc b/runtime/vm/flow_graph_type_propagator.cc
index 9f96d7d..782ea05 100644
--- a/runtime/vm/flow_graph_type_propagator.cc
+++ b/runtime/vm/flow_graph_type_propagator.cc
@@ -98,18 +98,6 @@
         if (use_defn != NULL) {
           AddToWorklist(use_defn);
         }
-
-        // If the value flow into a branch recompute type constrained by the
-        // branch (if any). This ensures that correct non-nullable type will
-        // flow downwards from the branch on the comparison with the null
-        // constant.
-        BranchInstr* branch = instr->AsBranch();
-        if (branch != NULL) {
-          ConstrainedCompileType* constrained_type = branch->constrained_type();
-          if (constrained_type != NULL) {
-            constrained_type->Update();
-          }
-        }
       }
     }
   }
@@ -199,19 +187,6 @@
 }
 
 
-ConstrainedCompileType* FlowGraphTypePropagator::MarkNonNullable(
-    Definition* def) {
-  CompileType* current = TypeOf(def);
-  if (current->is_nullable() && (current->ToCid() != kNullCid)) {
-    ConstrainedCompileType* constrained_type =
-        new NotNullConstrainedCompileType(current);
-    SetTypeOf(def, constrained_type->ToCompileType());
-    return constrained_type;
-  }
-  return NULL;
-}
-
-
 void FlowGraphTypePropagator::VisitValue(Value* value) {
   CompileType* type = TypeOf(value->definition());
   value->SetReachingType(type);
@@ -604,7 +579,7 @@
   const AbstractType& compile_type = *ToAbstractType();
 
   // The compile-type of a value should never be void. The result of a void
-  // function must always be null, which wass checked to be null at the return
+  // function must always be null, which was checked to be null at the return
   // statement inside the function.
   ASSERT(!compile_type.IsVoidType());
 
@@ -612,13 +587,13 @@
     return false;
   }
 
-  // The Null type is only a subtype of Object and of dynamic.
+  // The null instance is an instance of Null, of Object, and of dynamic.
   // Functions that do not explicitly return a value, implicitly return null,
   // except generative constructors, which return the object being constructed.
   // It is therefore acceptable for void functions to return null.
   if (compile_type.IsNullType()) {
     *is_instance = is_nullable || type.IsObjectType() || type.IsDynamicType() ||
-                   type.IsVoidType();
+                   type.IsNullType() || type.IsVoidType();
     return true;
   }
 
diff --git a/runtime/vm/flow_graph_type_propagator.h b/runtime/vm/flow_graph_type_propagator.h
index 0e23e5e..77be776 100644
--- a/runtime/vm/flow_graph_type_propagator.h
+++ b/runtime/vm/flow_graph_type_propagator.h
@@ -46,8 +46,6 @@
   // Mark definition as having given class id in all dominated instructions.
   void SetCid(Definition* value, intptr_t cid);
 
-  ConstrainedCompileType* MarkNonNullable(Definition* value);
-
   void AddToWorklist(Definition* defn);
   Definition* RemoveLastFromWorklist();
 
diff --git a/runtime/vm/gc_marker.cc b/runtime/vm/gc_marker.cc
index 86c5ae3..a6d1548 100644
--- a/runtime/vm/gc_marker.cc
+++ b/runtime/vm/gc_marker.cc
@@ -305,7 +305,7 @@
  private:
   void PushMarked(RawObject* raw_obj) {
     ASSERT(raw_obj->IsHeapObject());
-    ASSERT((FLAG_verify_before_gc || FLAG_verify_before_gc)
+    ASSERT((FLAG_verify_gc_contains)
                ? page_space_->Contains(RawObject::ToAddr(raw_obj))
                : true);
 
diff --git a/runtime/vm/gc_sweeper.cc b/runtime/vm/gc_sweeper.cc
index f779b49..738e1b8 100644
--- a/runtime/vm/gc_sweeper.cc
+++ b/runtime/vm/gc_sweeper.cc
@@ -16,6 +16,11 @@
 namespace dart {
 
 bool GCSweeper::SweepPage(HeapPage* page, FreeList* freelist, bool locked) {
+  if (page->is_image_page()) {
+    // Don't clear mark bits.
+    return true;
+  }
+
   // Keep track whether this page is still in use.
   bool in_use = false;
 
diff --git a/runtime/vm/gypi_contents.gni b/runtime/vm/gypi_contents.gni
index 403efdf..4ba651e 100644
--- a/runtime/vm/gypi_contents.gni
+++ b/runtime/vm/gypi_contents.gni
@@ -42,6 +42,7 @@
   "../../sdk/lib/math/math_sources.gypi",
   "../../sdk/lib/mirrors/mirrors_sources.gypi",
   "../../sdk/lib/profiler/profiler_sources.gypi",
+  "../../sdk/lib/typed_data/typed_data_sources.gypi",
   "../../sdk/lib/vmservice/vmservice_sources.gypi",
   "../bin/io_sources.gypi",
 ]
diff --git a/runtime/vm/handles_test.cc b/runtime/vm/handles_test.cc
index 8a05fb7..6c472b1 100644
--- a/runtime/vm/handles_test.cc
+++ b/runtime/vm/handles_test.cc
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 #include "platform/assert.h"
+#include "vm/dart_api_state.h"
 #include "vm/flags.h"
 #include "vm/handles.h"
 #include "vm/heap.h"
@@ -77,4 +78,57 @@
   EXPECT_EQ(handle_count, VMHandles::ScopedHandleCount());
 }
 
+
+static void NoopCallback(void* isolate_callback_data,
+                         Dart_WeakPersistentHandle handle,
+                         void* peer) {}
+
+
+// Unit test for handle validity checks.
+TEST_CASE(CheckHandleValidity) {
+#if defined(DEBUG)
+  FLAG_trace_handles = true;
+#endif
+  Thread* current = Thread::Current();
+  Dart_Handle handle = NULL;
+  // Check validity using zone handles.
+  {
+    StackZone sz(current);
+    handle = reinterpret_cast<Dart_Handle>(&Smi::ZoneHandle(Smi::New(1)));
+    EXPECT_VALID(handle);
+  }
+  EXPECT(!Api::IsValid(handle));
+
+  // Check validity using scoped handles.
+  {
+    HANDLESCOPE(current);
+    Dart_EnterScope();
+    handle = reinterpret_cast<Dart_Handle>(&Smi::Handle(Smi::New(1)));
+    EXPECT_VALID(handle);
+    Dart_ExitScope();
+  }
+  EXPECT(!Api::IsValid(handle));
+
+  // Check validity using persistent handle.
+  Isolate* isolate = Isolate::Current();
+  Dart_PersistentHandle persistent_handle =
+      Dart_NewPersistentHandle(Api::NewHandle(thread, Smi::New(1)));
+  EXPECT_VALID(persistent_handle);
+
+  Dart_DeletePersistentHandle(persistent_handle);
+  EXPECT(!Api::IsValid(persistent_handle));
+
+  // Check validity using weak persistent handle.
+  handle = reinterpret_cast<Dart_Handle>(Dart_NewWeakPersistentHandle(
+      Dart_NewStringFromCString("foo"), NULL, 0, NoopCallback));
+
+  EXPECT_NOTNULL(handle);
+  EXPECT_VALID(handle);
+
+  Dart_DeleteWeakPersistentHandle(
+      reinterpret_cast<Dart_Isolate>(isolate),
+      reinterpret_cast<Dart_WeakPersistentHandle>(handle));
+  EXPECT(!Api::IsValid(handle));
+}
+
 }  // namespace dart
diff --git a/runtime/vm/hash_table.h b/runtime/vm/hash_table.h
index 05d69fc..61db830 100644
--- a/runtime/vm/hash_table.h
+++ b/runtime/vm/hash_table.h
@@ -287,17 +287,23 @@
   intptr_t NumGT25Collisions() const {
     return GetSmiValueAt(kNumGT25LookupsIndex);
   }
-  void UpdateGrowth() const { AdjustSmiValueAt(kNumGrowsIndex, 1); }
-  void UpdateCollisions(intptr_t collisions) const {
-    if (data_->raw()->IsVMHeapObject()) {
-      return;
+  void UpdateGrowth() const {
+    if (KeyTraits::ReportStats()) {
+      AdjustSmiValueAt(kNumGrowsIndex, 1);
     }
-    if (collisions < 5) {
-      AdjustSmiValueAt(kNumLT5LookupsIndex, 1);
-    } else if (collisions < 25) {
-      AdjustSmiValueAt(kNumLT25LookupsIndex, 1);
-    } else {
-      AdjustSmiValueAt(kNumGT25LookupsIndex, 1);
+  }
+  void UpdateCollisions(intptr_t collisions) const {
+    if (KeyTraits::ReportStats()) {
+      if (data_->raw()->IsVMHeapObject()) {
+        return;
+      }
+      if (collisions < 5) {
+        AdjustSmiValueAt(kNumLT5LookupsIndex, 1);
+      } else if (collisions < 25) {
+        AdjustSmiValueAt(kNumLT25LookupsIndex, 1);
+      } else {
+        AdjustSmiValueAt(kNumGT25LookupsIndex, 1);
+      }
     }
   }
   void PrintStats() const {
diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc
index a6a4daa..d8ce157 100644
--- a/runtime/vm/heap.cc
+++ b/runtime/vm/heap.cc
@@ -87,14 +87,9 @@
   // memory.
   Thread* thread = Thread::Current();
   if (thread->CanCollectGarbage()) {
-    {
-      MonitorLocker ml(old_space_.tasks_lock());
-      addr = old_space_.TryAllocate(size, type);
-      while ((addr == 0) && (old_space_.tasks() > 0)) {
-        ml.WaitWithSafepointCheck(thread);
-        addr = old_space_.TryAllocate(size, type);
-      }
-    }
+    // Wait for any GC tasks that are in progress.
+    WaitForSweeperTasks(thread);
+    addr = old_space_.TryAllocate(size, type);
     if (addr != 0) {
       return addr;
     }
@@ -105,14 +100,8 @@
       return addr;
     }
     // Wait for all of the concurrent tasks to finish before giving up.
-    {
-      MonitorLocker ml(old_space_.tasks_lock());
-      addr = old_space_.TryAllocate(size, type);
-      while ((addr == 0) && (old_space_.tasks() > 0)) {
-        ml.WaitWithSafepointCheck(thread);
-        addr = old_space_.TryAllocate(size, type);
-      }
-    }
+    WaitForSweeperTasks(thread);
+    addr = old_space_.TryAllocate(size, type);
     if (addr != 0) {
       return addr;
     }
@@ -123,12 +112,7 @@
     }
     // Before throwing an out-of-memory error try a synchronous GC.
     CollectAllGarbage();
-    {
-      MonitorLocker ml(old_space_.tasks_lock());
-      while (old_space_.tasks() > 0) {
-        ml.WaitWithSafepointCheck(thread);
-      }
-    }
+    WaitForSweeperTasks(thread);
   }
   addr = old_space_.TryAllocate(size, type, PageSpace::kForceGrowth);
   if (addr != 0) {
@@ -194,34 +178,61 @@
 }
 
 
+bool Heap::DataContains(uword addr) const {
+  return old_space_.DataContains(addr);
+}
+
+
 void Heap::VisitObjects(ObjectVisitor* visitor) const {
   new_space_.VisitObjects(visitor);
   old_space_.VisitObjects(visitor);
 }
 
 
-HeapIterationScope::HeapIterationScope()
+void Heap::VisitObjectsNoImagePages(ObjectVisitor* visitor) const {
+  new_space_.VisitObjects(visitor);
+  old_space_.VisitObjectsNoImagePages(visitor);
+}
+
+
+void Heap::VisitObjectsImagePages(ObjectVisitor* visitor) const {
+  old_space_.VisitObjectsImagePages(visitor);
+}
+
+
+HeapIterationScope::HeapIterationScope(bool writable)
     : StackResource(Thread::Current()),
-      old_space_(isolate()->heap()->old_space()) {
-  // It's not yet safe to iterate over a paged space while it's concurrently
-  // sweeping, so wait for any such task to complete first.
-  MonitorLocker ml(old_space_->tasks_lock());
+      old_space_(isolate()->heap()->old_space()),
+      writable_(writable) {
+  {
+    // It's not yet safe to iterate over a paged space while it's concurrently
+    // sweeping, so wait for any such task to complete first.
+    MonitorLocker ml(old_space_->tasks_lock());
 #if defined(DEBUG)
-  // We currently don't support nesting of HeapIterationScopes.
-  ASSERT(old_space_->iterating_thread_ != thread());
+    // We currently don't support nesting of HeapIterationScopes.
+    ASSERT(old_space_->iterating_thread_ != thread());
 #endif
-  while (old_space_->tasks() > 0) {
-    ml.WaitWithSafepointCheck(thread());
+    while (old_space_->tasks() > 0) {
+      ml.WaitWithSafepointCheck(thread());
+    }
+#if defined(DEBUG)
+    ASSERT(old_space_->iterating_thread_ == NULL);
+    old_space_->iterating_thread_ = thread();
+#endif
+    old_space_->set_tasks(1);
   }
-#if defined(DEBUG)
-  ASSERT(old_space_->iterating_thread_ == NULL);
-  old_space_->iterating_thread_ = thread();
-#endif
-  old_space_->set_tasks(1);
+
+  if (writable_) {
+    thread()->heap()->WriteProtectCode(false);
+  }
 }
 
 
 HeapIterationScope::~HeapIterationScope() {
+  if (writable_) {
+    thread()->heap()->WriteProtectCode(true);
+  }
+
   MonitorLocker ml(old_space_->tasks_lock());
 #if defined(DEBUG)
   ASSERT(old_space_->iterating_thread_ == thread());
@@ -247,9 +258,9 @@
 }
 
 
-void Heap::IterateOldObjectsNoEmbedderPages(ObjectVisitor* visitor) const {
+void Heap::IterateOldObjectsNoImagePages(ObjectVisitor* visitor) const {
   HeapIterationScope heap_iteration_scope;
-  old_space_.VisitObjectsNoEmbedderPages(visitor);
+  old_space_.VisitObjectsNoImagePages(visitor);
 }
 
 
@@ -434,17 +445,12 @@
 }
 
 
-#if defined(DEBUG)
-void Heap::WaitForSweeperTasks() {
-  Thread* thread = Thread::Current();
-  {
-    MonitorLocker ml(old_space_.tasks_lock());
-    while (old_space_.tasks() > 0) {
-      ml.WaitWithSafepointCheck(thread);
-    }
+void Heap::WaitForSweeperTasks(Thread* thread) {
+  MonitorLocker ml(old_space_.tasks_lock());
+  while (old_space_.tasks() > 0) {
+    ml.WaitWithSafepointCheck(thread);
   }
 }
-#endif
 
 
 void Heap::UpdateGlobalMaxUsed() {
@@ -525,7 +531,12 @@
   {
     VerifyObjectVisitor object_visitor(isolate(), allocated_set,
                                        mark_expectation);
-    this->VisitObjects(&object_visitor);
+    this->VisitObjectsNoImagePages(&object_visitor);
+  }
+  {
+    VerifyObjectVisitor object_visitor(isolate(), allocated_set,
+                                       kRequireMarked);
+    this->VisitObjectsImagePages(&object_visitor);
   }
 
   Isolate* vm_isolate = Dart::vm_isolate();
@@ -682,7 +693,7 @@
   stats_.num_++;
   stats_.space_ = space;
   stats_.reason_ = reason;
-  stats_.before_.micros_ = OS::GetCurrentTimeMicros();
+  stats_.before_.micros_ = OS::GetCurrentMonotonicMicros();
   stats_.before_.new_ = new_space_.GetCurrentUsage();
   stats_.before_.old_ = old_space_.GetCurrentUsage();
   stats_.times_[0] = 0;
@@ -697,7 +708,7 @@
 
 
 void Heap::RecordAfterGC(Space space) {
-  stats_.after_.micros_ = OS::GetCurrentTimeMicros();
+  stats_.after_.micros_ = OS::GetCurrentMonotonicMicros();
   int64_t delta = stats_.after_.micros_ - stats_.before_.micros_;
   if (stats_.space_ == kNew) {
     new_space_.AddGCTime(delta);
@@ -750,7 +761,7 @@
     "]\n",  // End with a comma to make it easier to import in spreadsheets.
     isolate()->main_port(), space_str, GCReasonToString(stats_.reason_),
     stats_.num_,
-    MicrosecondsToSeconds(stats_.before_.micros_ - isolate()->start_time()),
+    MicrosecondsToSeconds(isolate()->UptimeMicros()),
     MicrosecondsToMilliseconds(stats_.after_.micros_ -
                                     stats_.before_.micros_),
     RoundWordsToKB(stats_.before_.new_.used_in_words),
diff --git a/runtime/vm/heap.h b/runtime/vm/heap.h
index 3e05e13..80265fc 100644
--- a/runtime/vm/heap.h
+++ b/runtime/vm/heap.h
@@ -88,10 +88,11 @@
   bool NewContains(uword addr) const;
   bool OldContains(uword addr) const;
   bool CodeContains(uword addr) const;
+  bool DataContains(uword addr) const;
 
   void IterateObjects(ObjectVisitor* visitor) const;
   void IterateOldObjects(ObjectVisitor* visitor) const;
-  void IterateOldObjectsNoEmbedderPages(ObjectVisitor* visitor) const;
+  void IterateOldObjectsNoImagePages(ObjectVisitor* visitor) const;
   void IterateObjectPointers(ObjectVisitor* visitor) const;
 
   // Find an object by visiting all pointers in the specified heap space,
@@ -114,9 +115,7 @@
     return old_space_.NeedsGarbageCollection();
   }
 
-#if defined(DEBUG)
-  void WaitForSweeperTasks();
-#endif
+  void WaitForSweeperTasks(Thread* thread);
 
   // Enables growth control on the page space heaps.  This should be
   // called before any user code is executed.
@@ -246,8 +245,8 @@
   Monitor* barrier() const { return barrier_; }
   Monitor* barrier_done() const { return barrier_done_; }
 
-  void SetupExternalPage(void* pointer, uword size, bool is_executable) {
-    old_space_.SetupExternalPage(pointer, size, is_executable);
+  void SetupImagePage(void* pointer, uword size, bool is_executable) {
+    old_space_.SetupImagePage(pointer, size, is_executable);
   }
 
  private:
@@ -297,6 +296,8 @@
   // Visit all objects, including FreeListElement "objects". Caller must ensure
   // concurrent sweeper is not running, and the visitor must not allocate.
   void VisitObjects(ObjectVisitor* visitor) const;
+  void VisitObjectsNoImagePages(ObjectVisitor* visitor) const;
+  void VisitObjectsImagePages(ObjectVisitor* visitor) const;
 
   // Like Verify, but does not wait for concurrent sweeper, so caller must
   // ensure thread-safety.
@@ -350,6 +351,8 @@
 
   friend class Become;       // VisitObjectPointers
   friend class Precompiler;  // VisitObjects
+  friend class ObjectGraph;  // VisitObjects
+  friend class Unmarker;     // VisitObjects
   friend class ServiceEvent;
   friend class PageSpace;             // VerifyGC
   friend class IsolateReloadContext;  // VisitObjects
@@ -360,12 +363,13 @@
 
 class HeapIterationScope : public StackResource {
  public:
-  HeapIterationScope();
+  explicit HeapIterationScope(bool writable = false);
   ~HeapIterationScope();
 
  private:
   NoSafepointScope no_safepoint_scope_;
   PageSpace* old_space_;
+  bool writable_;
 
   DISALLOW_COPY_AND_ASSIGN(HeapIterationScope);
 };
diff --git a/runtime/vm/il_printer.cc b/runtime/vm/il_printer.cc
index bfee006..66c8ea4 100644
--- a/runtime/vm/il_printer.cc
+++ b/runtime/vm/il_printer.cc
@@ -1096,8 +1096,6 @@
       return "float64x2";
     case kPairOfTagged:
       return "tagged-pair";
-    case kPairOfUnboxedDouble:
-      return "double-pair";
     case kNoRepresentation:
       return "none";
     case kNumRepresentations:
diff --git a/runtime/vm/intermediate_language.cc b/runtime/vm/intermediate_language.cc
index 49126f9..9ca5040 100644
--- a/runtime/vm/intermediate_language.cc
+++ b/runtime/vm/intermediate_language.cc
@@ -3075,6 +3075,8 @@
   } else {
     // Unoptimized code.
     ASSERT(!HasICData());
+    compiler->AddCurrentDescriptor(RawPcDescriptors::kRewind, deopt_id(),
+                                   token_pos());
     bool is_smi_two_args_op = false;
     const StubEntry* stub_entry = TwoArgsSmiOpInlineCacheEntry(token_kind());
     if (stub_entry != NULL) {
@@ -3123,7 +3125,7 @@
   }
   compiler->AddCurrentDescriptor(RawPcDescriptors::kIcCall, deopt_id(),
                                  token_pos());
-  compiler->RecordAfterCall(this);
+  compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
 
   if (compiler->is_optimizing()) {
     __ PopLocal(locs()->out(0).reg());
@@ -3271,7 +3273,7 @@
     __ StaticCall(ArgumentCount(), argdesc_kidx);
     compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
                                    token_pos());
-    compiler->RecordAfterCall(this);
+    compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
     __ PopLocal(locs()->out(0).reg());
   } else {
     const intptr_t ic_data_kidx = __ AddConstant(*call_ic_data);
@@ -3279,7 +3281,7 @@
     __ IndirectStaticCall(ArgumentCount(), argdesc_kidx);
     compiler->AddCurrentDescriptor(RawPcDescriptors::kUnoptStaticCall,
                                    deopt_id(), token_pos());
-    compiler->RecordAfterCall(this);
+    compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
   }
 #endif  // !defined(TARGET_ARCH_DBC)
 }
@@ -3325,6 +3327,11 @@
 }
 
 
+void Environment::PushValue(Value* value) {
+  values_.Add(value);
+}
+
+
 Environment* Environment::DeepCopy(Zone* zone, intptr_t length) const {
   ASSERT(length <= values_.length());
   Environment* copy = new (zone)
@@ -3609,7 +3616,7 @@
         pieces.SetAt(store_index, Bool::Cast(obj).value() ? Symbols::True()
                                                           : Symbols::False());
       } else if (obj.IsNull()) {
-        pieces.SetAt(store_index, Symbols::Null());
+        pieces.SetAt(store_index, Symbols::null());
       } else {
         return this;
       }
diff --git a/runtime/vm/intermediate_language.h b/runtime/vm/intermediate_language.h
index 0aa3af3..8359174 100644
--- a/runtime/vm/intermediate_language.h
+++ b/runtime/vm/intermediate_language.h
@@ -193,37 +193,6 @@
 };
 
 
-// ConstrainedCompileType represents a compile type that is computed from
-// another compile type.
-class ConstrainedCompileType : public ZoneCompileType {
- public:
-  virtual ~ConstrainedCompileType() {}
-
-  // Recompute compile type.
-  virtual void Update() = 0;
-
- protected:
-  explicit ConstrainedCompileType(const CompileType& type)
-      : ZoneCompileType(type) {}
-};
-
-
-// NotNullConstrainedCompileType represents not-null constraint applied to
-// the source compile type. Result is non-nullable version of the incoming
-// compile type. It is used to represent compile type propagated downwards
-// from strict comparison with the null constant.
-class NotNullConstrainedCompileType : public ConstrainedCompileType {
- public:
-  explicit NotNullConstrainedCompileType(CompileType* source)
-      : ConstrainedCompileType(source->CopyNonNullable()), source_(source) {}
-
-  virtual void Update() { type_ = source_->CopyNonNullable(); }
-
- private:
-  CompileType* source_;
-};
-
-
 class EffectSet : public ValueObject {
  public:
   enum Effects {
@@ -1655,11 +1624,9 @@
   void ClearSSATempIndex() { ssa_temp_index_ = -1; }
   bool HasPairRepresentation() const {
 #if defined(TARGET_ARCH_X64)
-    return (representation() == kPairOfTagged) ||
-           (representation() == kPairOfUnboxedDouble);
+    return representation() == kPairOfTagged;
 #else
     return (representation() == kPairOfTagged) ||
-           (representation() == kPairOfUnboxedDouble) ||
            (representation() == kUnboxedMint);
 #endif
   }
@@ -2355,8 +2322,6 @@
   explicit BranchInstr(ComparisonInstr* comparison)
       : Instruction(Thread::Current()->GetNextDeoptId()),
         comparison_(comparison),
-        is_checked_(false),
-        constrained_type_(NULL),
         constant_target_(NULL) {
     ASSERT(comparison->env() == NULL);
     for (intptr_t i = comparison->InputCount() - 1; i >= 0; --i) {
@@ -2376,11 +2341,7 @@
 
   virtual TokenPosition token_pos() const { return comparison_->token_pos(); }
 
-  virtual bool CanDeoptimize() const {
-    // Branches need a deoptimization info in checked mode if they
-    // can throw a type check error.
-    return comparison()->CanDeoptimize() || is_checked();
-  }
+  virtual bool CanDeoptimize() const { return comparison()->CanDeoptimize(); }
 
   virtual bool CanBecomeDeoptimizationTarget() const {
     return comparison()->CanBecomeDeoptimizationTarget();
@@ -2391,9 +2352,6 @@
   ComparisonInstr* comparison() const { return comparison_; }
   void SetComparison(ComparisonInstr* comp);
 
-  void set_is_checked(bool value) { is_checked_ = value; }
-  bool is_checked() const { return is_checked_; }
-
   virtual intptr_t DeoptimizationTarget() const {
     return comparison()->DeoptimizationTarget();
   }
@@ -2404,16 +2362,6 @@
 
   virtual Instruction* Canonicalize(FlowGraph* flow_graph);
 
-  // Set compile type constrained by the comparison of this branch.
-  // FlowGraphPropagator propagates it downwards into either true or false
-  // successor.
-  void set_constrained_type(ConstrainedCompileType* type) {
-    constrained_type_ = type;
-  }
-
-  // Return compile type constrained by the comparison of this branch.
-  ConstrainedCompileType* constrained_type() const { return constrained_type_; }
-
   void set_constant_target(TargetEntryInstr* target) {
     ASSERT(target == true_successor() || target == false_successor());
     constant_target_ = target;
@@ -2443,8 +2391,6 @@
   TargetEntryInstr* true_successor_;
   TargetEntryInstr* false_successor_;
   ComparisonInstr* comparison_;
-  bool is_checked_;
-  ConstrainedCompileType* constrained_type_;
   TargetEntryInstr* constant_target_;
 
   DISALLOW_COPY_AND_ASSIGN(BranchInstr);
@@ -3221,6 +3167,8 @@
   const ICData* ic_data() const { return ic_data_; }
   bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); }
 
+  void set_ic_data(const ICData* value) { ic_data_ = value; }
+
   DECLARE_INSTRUCTION(StaticCall)
   virtual CompileType ComputeType() const;
   virtual Definition* Canonicalize(FlowGraph* flow_graph);
@@ -7442,8 +7390,6 @@
     ASSERT(idx == 0);
     if (representation() == kTagged) {
       return kPairOfTagged;
-    } else if (representation() == kUnboxedDouble) {
-      return kPairOfUnboxedDouble;
     }
     UNREACHABLE();
     return definition_rep_;
@@ -7469,7 +7415,6 @@
  public:
   enum Kind {
     kTruncDivMod,
-    kSinCos,
   };
 
   MergedMathInstr(ZoneGrowableArray<Value*>* inputs,
@@ -7479,8 +7424,6 @@
   static intptr_t InputCountFor(MergedMathInstr::Kind kind) {
     if (kind == kTruncDivMod) {
       return 2;
-    } else if (kind == kSinCos) {
-      return 1;
     } else {
       UNIMPLEMENTED();
       return -1;
@@ -7501,8 +7444,6 @@
   virtual bool CanDeoptimize() const {
     if (kind_ == kTruncDivMod) {
       return true;
-    } else if (kind_ == kSinCos) {
-      return false;
     } else {
       UNIMPLEMENTED();
       return false;
@@ -7512,8 +7453,6 @@
   virtual Representation representation() const {
     if (kind_ == kTruncDivMod) {
       return kPairOfTagged;
-    } else if (kind_ == kSinCos) {
-      return kPairOfUnboxedDouble;
     } else {
       UNIMPLEMENTED();
       return kTagged;
@@ -7524,8 +7463,6 @@
     ASSERT((0 <= idx) && (idx < InputCount()));
     if (kind_ == kTruncDivMod) {
       return kTagged;
-    } else if (kind_ == kSinCos) {
-      return kUnboxedDouble;
     } else {
       UNIMPLEMENTED();
       return kTagged;
@@ -7545,7 +7482,6 @@
 
   static const char* KindToCString(MergedMathInstr::Kind kind) {
     if (kind == kTruncDivMod) return "TruncDivMod";
-    if (kind == kSinCos) return "SinCos";
     UNIMPLEMENTED();
     return "";
   }
@@ -7958,6 +7894,8 @@
 
   Value* ValueAt(intptr_t ix) const { return values_[ix]; }
 
+  void PushValue(Value* value);
+
   intptr_t Length() const { return values_.length(); }
 
   Location LocationAt(intptr_t index) const {
diff --git a/runtime/vm/intermediate_language_arm.cc b/runtime/vm/intermediate_language_arm.cc
index 395b59a..afe7d11 100644
--- a/runtime/vm/intermediate_language_arm.cc
+++ b/runtime/vm/intermediate_language_arm.cc
@@ -6233,9 +6233,6 @@
 
     return;
   }
-  if (kind() == MergedMathInstr::kSinCos) {
-    UNIMPLEMENTED();
-  }
   UNIMPLEMENTED();
 }
 
@@ -6994,7 +6991,7 @@
 
 
 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
-  compiler->SetNeedsStacktrace(catch_try_index());
+  compiler->SetNeedsStackTrace(catch_try_index());
   compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry,
                                 2, locs());
   __ bkpt(0);
diff --git a/runtime/vm/intermediate_language_arm64.cc b/runtime/vm/intermediate_language_arm64.cc
index 25a220e..006dd3b 100644
--- a/runtime/vm/intermediate_language_arm64.cc
+++ b/runtime/vm/intermediate_language_arm64.cc
@@ -5379,9 +5379,6 @@
     __ Bind(&done);
     return;
   }
-  if (kind() == MergedMathInstr::kSinCos) {
-    UNIMPLEMENTED();
-  }
   UNIMPLEMENTED();
 }
 
@@ -5788,7 +5785,7 @@
 
 
 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
-  compiler->SetNeedsStacktrace(catch_try_index());
+  compiler->SetNeedsStackTrace(catch_try_index());
   compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry,
                                 2, locs());
   __ brk(0);
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index f11a372..e15e4fa 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -204,7 +204,7 @@
   __ InstanceOf(negate_result() ? 1 : 0);
   compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
                                  token_pos());
-  compiler->RecordAfterCall(this);
+  compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
   if (compiler->is_optimizing()) {
     __ PopLocal(locs()->out(0).reg());
   }
@@ -227,7 +227,7 @@
   __ AssertBoolean(Isolate::Current()->type_checks() ? 1 : 0);
   compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
                                  token_pos());
-  compiler->RecordAfterCall(this);
+  compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
   if (compiler->is_optimizing()) {
     __ Drop1();
   }
@@ -280,7 +280,7 @@
   __ StaticCall(instance_call()->ArgumentCount(), argdesc_kidx);
   compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
                                  instance_call()->token_pos());
-  compiler->RecordAfterCall(this);
+  compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
   __ PopLocal(locs()->out(0).reg());
 }
 
@@ -294,10 +294,14 @@
                  0,
                  Location::NoLocation(),
                  LocationSummary::kCall) {
-  __ CheckStack();
+  if (compiler->ForceSlowPathForStackOverflow()) {
+    __ CheckStackAlwaysExit();
+  } else {
+    __ CheckStack();
+  }
   compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
                                  token_pos());
-  compiler->RecordAfterCall(this);
+  compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult);
 }
 
 
@@ -427,7 +431,7 @@
   } else {
     __ InitStaticTOS();
   }
-  compiler->RecordAfterCall(this);
+  compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult);
 }
 
 
@@ -445,7 +449,7 @@
   const intptr_t argdesc_kidx =
       compiler->assembler()->AddConstant(arguments_descriptor);
   __ StaticCall(argument_count, argdesc_kidx);
-  compiler->RecordAfterCall(this);
+  compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
   if (compiler->is_optimizing()) {
     __ PopLocal(locs()->out(0).reg());
   }
@@ -695,11 +699,11 @@
     __ Push(type_arguments);
     __ Push(length);
     __ CreateArrayTOS();
-    compiler->RecordAfterCall(this);
+    compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
     __ PopLocal(out);
   } else {
     __ CreateArrayTOS();
-    compiler->RecordAfterCall(this);
+    compiler->RecordAfterCall(this, FlowGraphCompiler::kHasResult);
   }
 }
 
@@ -913,7 +917,12 @@
   __ PushConstant(CallFunction());
   const intptr_t argdesc_kidx = __ AddConstant(arguments_descriptor);
   __ StaticCall(kArgumentCount, argdesc_kidx);
-  compiler->RecordAfterCall(this);
+  // Note: can't use RecordAfterCall here because
+  // StringInterpolateInstr::ArgumentCount() is 0. However
+  // internally it does a call with 1 argument which needs to
+  // be reflected in the lazy deoptimization environment.
+  compiler->RecordAfterCallHelper(token_pos(), deopt_id(), kArgumentCount,
+                                  FlowGraphCompiler::kHasResult, locs());
   if (compiler->is_optimizing()) {
     __ PopLocal(locs()->out(0).reg());
   }
@@ -1141,7 +1150,15 @@
   compiler->AddExceptionHandler(catch_try_index(), try_index(),
                                 compiler->assembler()->CodeSize(),
                                 catch_handler_types_, needs_stacktrace());
-
+  // On lazy deoptimization we patch the optimized code here to enter the
+  // deoptimization stub.
+  const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId());
+  if (compiler->is_optimizing()) {
+    compiler->AddDeoptIndexAtCall(deopt_id);
+  } else {
+    compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id,
+                                   TokenPosition::kNoSource);
+  }
   if (HasParallelMove()) {
     compiler->parallel_move_resolver()->EmitNativeCode(parallel_move());
   }
@@ -1157,12 +1174,12 @@
         kNumberOfCpuRegisters -
         (-stacktrace_var().index() + num_non_copied_params);
     __ MoveSpecial(exception_reg, Simulator::kExceptionSpecialIndex);
-    __ MoveSpecial(stacktrace_reg, Simulator::kStacktraceSpecialIndex);
+    __ MoveSpecial(stacktrace_reg, Simulator::kStackTraceSpecialIndex);
   } else {
     __ MoveSpecial(LocalVarIndex(0, exception_var().index()),
                    Simulator::kExceptionSpecialIndex);
     __ MoveSpecial(LocalVarIndex(0, stacktrace_var().index()),
-                   Simulator::kStacktraceSpecialIndex);
+                   Simulator::kStackTraceSpecialIndex);
   }
   __ SetFrame(compiler->StackSize());
 }
@@ -1172,17 +1189,17 @@
   __ Throw(0);
   compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
                                  token_pos());
-  compiler->RecordAfterCall(this);
+  compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult);
   __ Trap();
 }
 
 
 EMIT_NATIVE_CODE(ReThrow, 0, Location::NoLocation(), LocationSummary::kCall) {
-  compiler->SetNeedsStacktrace(catch_try_index());
+  compiler->SetNeedsStackTrace(catch_try_index());
   __ Throw(1);
   compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(),
                                  token_pos());
-  compiler->RecordAfterCall(this);
+  compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult);
   __ Trap();
 }
 
diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
index c3f905d..7ccabe0 100644
--- a/runtime/vm/intermediate_language_ia32.cc
+++ b/runtime/vm/intermediate_language_ia32.cc
@@ -5658,37 +5658,11 @@
                                        Location::RegisterLocation(EDX)));
     return summary;
   }
-  if (kind() == MergedMathInstr::kSinCos) {
-    const intptr_t kNumInputs = 1;
-    const intptr_t kNumTemps = 2;
-    LocationSummary* summary = new (zone)
-        LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall);
-    // Because we always call into the runtime (LocationSummary::kCall) we
-    // must specify each input, temp, and output register explicitly.
-    summary->set_in(0, Location::FpuRegisterLocation(XMM1));
-    // EDI is chosen because it is callee saved so we do not need to back it
-    // up before calling into the runtime.
-    summary->set_temp(0, Location::RegisterLocation(EDI));
-    summary->set_temp(1, Location::RegisterLocation(EBX));
-    summary->set_out(0, Location::Pair(Location::FpuRegisterLocation(XMM2),
-                                       Location::FpuRegisterLocation(XMM3)));
-    return summary;
-  }
   UNIMPLEMENTED();
   return NULL;
 }
 
 
-typedef void (*SinCosCFunction)(double x, double* res_sin, double* res_cos);
-
-extern const RuntimeEntry kSinCosRuntimeEntry(
-    "libc_sincos",
-    reinterpret_cast<RuntimeFunction>(static_cast<SinCosCFunction>(&SinCos)),
-    1,
-    true,
-    true);
-
-
 void MergedMathInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
   Label* deopt = NULL;
   if (CanDeoptimize()) {
@@ -5757,49 +5731,6 @@
     __ SmiTag(EDX);
     return;
   }
-
-  if (kind() == MergedMathInstr::kSinCos) {
-    ASSERT(locs()->out(0).IsPairLocation());
-    PairLocation* pair = locs()->out(0).AsPairLocation();
-    XmmRegister out1 = pair->At(0).fpu_reg();
-    XmmRegister out2 = pair->At(1).fpu_reg();
-
-    // Save ESP.
-    __ movl(locs()->temp(0).reg(), ESP);
-    // +-------------------------------+
-    // | double-argument               |  <- TOS
-    // +-------------------------------+
-    // | address-cos-result            |  +8
-    // +-------------------------------+
-    // | address-sin-result            |  +12
-    // +-------------------------------+
-    // | double-storage-for-cos-result |  +16
-    // +-------------------------------+
-    // | double-storage-for-sin-result |  +24
-    // +-------------------------------+
-    // ....
-    __ ReserveAlignedFrameSpace(kDoubleSize * 3 + kWordSize * 2);
-    __ movsd(Address(ESP, 0), locs()->in(0).fpu_reg());
-
-    Address cos_result(ESP, 2 * kWordSize + kDoubleSize);
-    Address sin_result(ESP, 2 * kWordSize + 2 * kDoubleSize);
-
-    // 'cos' result storage address.
-    __ leal(locs()->temp(1).reg(), cos_result);
-    __ movl(Address(ESP, kDoubleSize), locs()->temp(1).reg());
-
-    // 'sin' result storage address.
-    __ leal(locs()->temp(1).reg(), sin_result);
-    __ movl(Address(ESP, kDoubleSize + kWordSize), locs()->temp(1).reg());
-
-    __ CallRuntime(kSinCosRuntimeEntry, InputCount());
-    __ movsd(out2, sin_result);  // sin.
-    __ movsd(out1, cos_result);  // cos.
-    // Restore RSP.
-    __ movl(ESP, locs()->temp(0).reg());
-
-    return;
-  }
   UNIMPLEMENTED();
 }
 
@@ -6597,7 +6528,7 @@
 
 
 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
-  compiler->SetNeedsStacktrace(catch_try_index());
+  compiler->SetNeedsStackTrace(catch_try_index());
   compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry,
                                 2, locs());
   __ int3();
diff --git a/runtime/vm/intermediate_language_mips.cc b/runtime/vm/intermediate_language_mips.cc
index c5a5af5..5494f62 100644
--- a/runtime/vm/intermediate_language_mips.cc
+++ b/runtime/vm/intermediate_language_mips.cc
@@ -5776,7 +5776,7 @@
 
 
 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
-  compiler->SetNeedsStacktrace(catch_try_index());
+  compiler->SetNeedsStackTrace(catch_try_index());
   compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry,
                                 2, locs());
   __ break_(0);
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc
index 097df6e..7cebfd7 100644
--- a/runtime/vm/intermediate_language_x64.cc
+++ b/runtime/vm/intermediate_language_x64.cc
@@ -5641,36 +5641,11 @@
                                        Location::RegisterLocation(RDX)));
     return summary;
   }
-  if (kind() == MergedMathInstr::kSinCos) {
-    const intptr_t kNumInputs = 1;
-    const intptr_t kNumTemps = 1;
-    LocationSummary* summary = new (zone)
-        LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall);
-    // Because we always call into the runtime (LocationSummary::kCall) we
-    // must specify each input, temp, and output register explicitly.
-    summary->set_in(0, Location::FpuRegisterLocation(XMM1));
-    // R13 is chosen because it is callee saved so we do not need to back it
-    // up before calling into the runtime.
-    summary->set_temp(0, Location::RegisterLocation(R13));
-    summary->set_out(0, Location::Pair(Location::FpuRegisterLocation(XMM2),
-                                       Location::FpuRegisterLocation(XMM3)));
-    return summary;
-  }
   UNIMPLEMENTED();
   return NULL;
 }
 
 
-typedef void (*SinCosCFunction)(double x, double* res_sin, double* res_cos);
-
-extern const RuntimeEntry kSinCosRuntimeEntry(
-    "libc_sincos",
-    reinterpret_cast<RuntimeFunction>(static_cast<SinCosCFunction>(&SinCos)),
-    1,
-    true,
-    true);
-
-
 void MergedMathInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
   Label* deopt = NULL;
   if (CanDeoptimize()) {
@@ -5764,41 +5739,6 @@
     // in-range arguments, cannot create out-of-range result.
     return;
   }
-  if (kind() == MergedMathInstr::kSinCos) {
-    ASSERT(locs()->out(0).IsPairLocation());
-    PairLocation* pair = locs()->out(0).AsPairLocation();
-    XmmRegister out1 = pair->At(0).fpu_reg();
-    XmmRegister out2 = pair->At(1).fpu_reg();
-
-    // Save RSP.
-    __ movq(locs()->temp(0).reg(), RSP);
-    // +-------------------------------+
-    // | double-argument               |  <- TOS
-    // +-------------------------------+
-    // | address-cos-result            |  +8
-    // +-------------------------------+
-    // | address-sin-result            |  +16
-    // +-------------------------------+
-    // | double-storage-for-cos-result |  +24
-    // +-------------------------------+
-    // | double-storage-for-sin-result |  +32
-    // +-------------------------------+
-    // ....
-    __ ReserveAlignedFrameSpace(kDoubleSize * 3 + kWordSize * 2);
-    __ movsd(Address(RSP, 0), locs()->in(0).fpu_reg());
-
-    __ leaq(RDI, Address(RSP, 2 * kWordSize + kDoubleSize));
-    __ leaq(RSI, Address(RSP, 2 * kWordSize + 2 * kDoubleSize));
-    __ movaps(XMM0, locs()->in(0).fpu_reg());
-
-    __ CallRuntime(kSinCosRuntimeEntry, InputCount());
-    __ movsd(out2, Address(RSP, 2 * kWordSize + kDoubleSize * 2));  // sin.
-    __ movsd(out1, Address(RSP, 2 * kWordSize + kDoubleSize));      // cos.
-    // Restore RSP.
-    __ movq(RSP, locs()->temp(0).reg());
-
-    return;
-  }
   UNIMPLEMENTED();
 }
 
@@ -6527,7 +6467,7 @@
 
 
 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
-  compiler->SetNeedsStacktrace(catch_try_index());
+  compiler->SetNeedsStackTrace(catch_try_index());
   compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry,
                                 2, locs());
   __ int3();
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index aa851bf..c2a4e54 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -100,17 +100,24 @@
 #endif
 
 
-static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
+static uint8_t* malloc_allocator(uint8_t* ptr,
+                                 intptr_t old_size,
+                                 intptr_t new_size) {
   void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
   return reinterpret_cast<uint8_t*>(new_ptr);
 }
 
+static void malloc_deallocator(uint8_t* ptr) {
+  free(reinterpret_cast<void*>(ptr));
+}
+
 
 static void SerializeObject(const Instance& obj,
                             uint8_t** obj_data,
                             intptr_t* obj_len,
                             bool allow_any_object) {
-  MessageWriter writer(obj_data, &allocator, allow_any_object);
+  MessageWriter writer(obj_data, &malloc_allocator, &malloc_deallocator,
+                       allow_any_object);
   writer.WriteMessage(obj);
   *obj_len = writer.BytesWritten();
 }
@@ -128,6 +135,12 @@
 }
 
 
+bool IsolateVisitor::IsVMInternalIsolate(Isolate* isolate) const {
+  return ((isolate == Dart::vm_isolate()) ||
+          ServiceIsolate::IsServiceIsolateDescendant(isolate));
+}
+
+
 NoOOBMessageScope::NoOOBMessageScope(Thread* thread) : StackResource(thread) {
   thread->DeferOOBMessageInterrupts();
 }
@@ -187,7 +200,7 @@
   msg.SetAt(2, element);
 
   uint8_t* data = NULL;
-  MessageWriter writer(&data, &allocator, false);
+  MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
   writer.WriteMessage(msg);
 
   PortMap::PostMessage(new Message(main_port(), data, writer.BytesWritten(),
@@ -773,7 +786,7 @@
       message_notify_callback_(NULL),
       name_(NULL),
       debugger_name_(NULL),
-      start_time_(OS::GetCurrentTimeMicros()),
+      start_time_micros_(OS::GetCurrentMonotonicMicros()),
       main_port_(0),
       origin_id_(0),
       pause_capability_(0),
@@ -786,7 +799,6 @@
       debugger_(NULL),
       resume_request_(false),
       last_resume_timestamp_(OS::GetCurrentTimeMillis()),
-      has_compiled_code_(false),
       random_(),
       simulator_(NULL),
       mutex_(new Mutex()),
@@ -986,35 +998,10 @@
 }
 
 
-void Isolate::SetupInstructionsSnapshotPage(
-    const uint8_t* instructions_snapshot_buffer) {
-  InstructionsSnapshot snapshot(instructions_snapshot_buffer);
-#if defined(DEBUG)
-  if (FLAG_trace_isolates) {
-    OS::Print("Precompiled instructions are at [0x%" Px ", 0x%" Px ")\n",
-              reinterpret_cast<uword>(snapshot.instructions_start()),
-              reinterpret_cast<uword>(snapshot.instructions_start()) +
-                  snapshot.instructions_size());
-  }
-#endif
-  heap_->SetupExternalPage(snapshot.instructions_start(),
-                           snapshot.instructions_size(),
-                           /* is_executable = */ true);
-}
-
-
-void Isolate::SetupDataSnapshotPage(const uint8_t* data_snapshot_buffer) {
-  DataSnapshot snapshot(data_snapshot_buffer);
-#if defined(DEBUG)
-  if (FLAG_trace_isolates) {
-    OS::Print(
-        "Precompiled rodata are at [0x%" Px ", 0x%" Px ")\n",
-        reinterpret_cast<uword>(snapshot.data_start()),
-        reinterpret_cast<uword>(snapshot.data_start()) + snapshot.data_size());
-  }
-#endif
-  heap_->SetupExternalPage(snapshot.data_start(), snapshot.data_size(),
-                           /* is_executable = */ false);
+void Isolate::SetupImagePage(const uint8_t* image_buffer, bool is_executable) {
+  Image image(image_buffer);
+  heap_->SetupImagePage(image.object_start(), image.object_size(),
+                        is_executable);
 }
 
 
@@ -1035,6 +1022,11 @@
 }
 
 
+int64_t Isolate::UptimeMicros() const {
+  return OS::GetCurrentMonotonicMicros() - start_time_micros_;
+}
+
+
 bool Isolate::IsPaused() const {
   return (debugger_ != NULL) && (debugger_->PauseEvent() != NULL);
 }
@@ -1663,9 +1655,11 @@
   if (FLAG_dump_megamorphic_stats) {
     MegamorphicCacheTable::PrintSizes(this);
   }
+  if (FLAG_dump_symbol_stats) {
+    Symbols::DumpStats(this);
+  }
   if (FLAG_trace_isolates) {
     heap()->PrintSizes();
-    Symbols::DumpStats();
     OS::Print(
         "[-] Stopping isolate:\n"
         "\tisolate:    %s\n",
@@ -1712,7 +1706,7 @@
   StopBackgroundCompiler();
 
 #if defined(DEBUG)
-  if (heap_ != NULL) {
+  if (heap_ != NULL && FLAG_verify_on_transition) {
     // The VM isolate keeps all objects marked.
     heap_->Verify(this == Dart::vm_isolate() ? kRequireMarked : kForbidMarked);
   }
@@ -1984,8 +1978,9 @@
   }
   jsobj.AddPropertyF("_originNumber", "%" Pd64 "",
                      static_cast<int64_t>(origin_id()));
-  int64_t start_time_millis = start_time() / kMicrosecondsPerMillisecond;
-  jsobj.AddPropertyTimeMillis("startTime", start_time_millis);
+  int64_t uptime_millis = UptimeMicros() / kMicrosecondsPerMillisecond;
+  int64_t start_time = OS::GetCurrentTimeMillis() - uptime_millis;
+  jsobj.AddPropertyTimeMillis("startTime", start_time);
   {
     JSONObject jsheap(&jsobj, "_heaps");
     heap()->PrintToJSONObject(Heap::kNew, &jsheap);
@@ -2032,6 +2027,12 @@
     jsobj.AddProperty("rootLib", lib);
   }
 
+  intptr_t zone_handle_count = thread_registry_->CountZoneHandles();
+  intptr_t scoped_handle_count = thread_registry_->CountScopedHandles();
+
+  jsobj.AddProperty("_numZoneHandles", zone_handle_count);
+  jsobj.AddProperty("_numScopedHandles", scoped_handle_count);
+
   if (FLAG_profiler) {
     JSONObject tagCounters(&jsobj, "_tagCounters");
     vm_tag_counters()->PrintToJSONObject(&tagCounters);
@@ -2090,6 +2091,8 @@
       }
     }
   }
+
+  jsobj.AddProperty("_threads", thread_registry_);
 }
 #endif
 
@@ -2232,12 +2235,12 @@
 
     if (FLAG_trace_service) {
       OS::Print("[+%" Pd64 "ms] Isolate %s invoking _runExtension for %s\n",
-                Dart::timestamp(), name(), method_name.ToCString());
+                Dart::UptimeMillis(), name(), method_name.ToCString());
     }
     result = DartEntry::InvokeFunction(run_extension, arguments);
     if (FLAG_trace_service) {
       OS::Print("[+%" Pd64 "ms] Isolate %s : _runExtension complete for %s\n",
-                Dart::timestamp(), name(), method_name.ToCString());
+                Dart::UptimeMillis(), name(), method_name.ToCString());
     }
     // Propagate the error.
     if (result.IsError()) {
@@ -2276,7 +2279,7 @@
                                          const Instance& id) {
   if (FLAG_trace_service) {
     OS::Print("[+%" Pd64 "ms] Isolate %s ENQUEUING request for extension %s\n",
-              Dart::timestamp(), name(), method_name.ToCString());
+              Dart::UptimeMillis(), name(), method_name.ToCString());
   }
   GrowableObjectArray& calls =
       GrowableObjectArray::Handle(pending_service_extension_calls());
@@ -2535,7 +2538,7 @@
 
   {
     uint8_t* buffer = NULL;
-    ApiMessageWriter writer(&buffer, allocator);
+    ApiMessageWriter writer(&buffer, &malloc_allocator);
     bool success = writer.WriteCMessage(&kill_msg);
     ASSERT(success);
 
@@ -2571,9 +2574,7 @@
     // If a target_ is specified, then only kill the target_.
     // Otherwise, don't kill the service isolate or vm isolate.
     return (((target_ != NULL) && (isolate == target_)) ||
-            ((target_ == NULL) &&
-             !ServiceIsolate::IsServiceIsolateDescendant(isolate) &&
-             (isolate != Dart::vm_isolate())));
+            ((target_ == NULL) && !IsVMInternalIsolate(isolate)));
   }
 
   Isolate* target_;
@@ -2641,6 +2642,8 @@
     thread = thread_registry()->GetFreeThreadLocked(this, is_mutator);
     ASSERT(thread != NULL);
 
+    thread->ResetHighWatermark();
+
     // Set up other values and set the TLS value.
     thread->isolate_ = this;
     ASSERT(heap() != NULL);
@@ -2736,7 +2739,7 @@
                                      void* init_data,
                                      const char* script_url,
                                      const Function& func,
-                                     const Instance& message,
+                                     SerializedObjectBuffer* message_buffer,
                                      Monitor* spawn_count_monitor,
                                      intptr_t* spawn_count,
                                      const char* package_root,
@@ -2778,9 +2781,8 @@
     const String& class_name = String::Handle(cls.Name());
     class_name_ = NewConstChar(class_name.ToCString());
   }
-  bool can_send_any_object = true;
-  SerializeObject(message, &serialized_message_, &serialized_message_len_,
-                  can_send_any_object);
+  message_buffer->StealBuffer(&serialized_message_, &serialized_message_len_);
+
   // Inherit flags from spawning isolate.
   Isolate::Current()->FlagsCopyTo(isolate_flags());
 }
@@ -2791,8 +2793,8 @@
                                      const char* script_url,
                                      const char* package_root,
                                      const char* package_config,
-                                     const Instance& args,
-                                     const Instance& message,
+                                     SerializedObjectBuffer* args_buffer,
+                                     SerializedObjectBuffer* message_buffer,
                                      Monitor* spawn_count_monitor,
                                      intptr_t* spawn_count,
                                      bool paused,
@@ -2821,11 +2823,9 @@
       paused_(paused),
       errors_are_fatal_(errors_are_fatal) {
   function_name_ = NewConstChar("main");
-  bool can_send_any_object = false;
-  SerializeObject(args, &serialized_args_, &serialized_args_len_,
-                  can_send_any_object);
-  SerializeObject(message, &serialized_message_, &serialized_message_len_,
-                  can_send_any_object);
+  args_buffer->StealBuffer(&serialized_args_, &serialized_args_len_);
+  message_buffer->StealBuffer(&serialized_message_, &serialized_message_len_);
+
   // By default inherit flags from spawning isolate. These can be overridden
   // from the calling code.
   Isolate::Current()->FlagsCopyTo(isolate_flags());
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 9fa4361..fe4da08 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -61,6 +61,7 @@
 class SafepointHandler;
 class SampleBuffer;
 class SendPort;
+class SerializedObjectBuffer;
 class ServiceIdZone;
 class Simulator;
 class StackResource;
@@ -91,6 +92,10 @@
 
   virtual void VisitIsolate(Isolate* isolate) = 0;
 
+ protected:
+  // Returns true if |isolate| is the VM or service isolate.
+  bool IsVMInternalIsolate(Isolate* isolate) const;
+
  private:
   DISALLOW_COPY_AND_ASSIGN(IsolateVisitor);
 };
@@ -174,7 +179,6 @@
 
   ThreadRegistry* thread_registry() const { return thread_registry_; }
   SafepointHandler* safepoint_handler() const { return safepoint_handler_; }
-
   ClassTable* class_table() { return &class_table_; }
   static intptr_t class_table_offset() {
     return OFFSET_OF(Isolate, class_table_);
@@ -200,7 +204,7 @@
   const char* debugger_name() const { return debugger_name_; }
   void set_debugger_name(const char* name);
 
-  int64_t start_time() const { return start_time_; }
+  int64_t UptimeMicros() const;
 
   Dart_Port main_port() const { return main_port_; }
   void set_main_port(Dart_Port port) {
@@ -250,9 +254,7 @@
     library_tag_handler_ = value;
   }
 
-  void SetupInstructionsSnapshotPage(
-      const uint8_t* instructions_snapshot_buffer);
-  void SetupDataSnapshotPage(const uint8_t* instructions_snapshot_buffer);
+  void SetupImagePage(const uint8_t* snapshot_buffer, bool is_executable);
 
   void ScheduleMessageInterrupts();
 
@@ -309,9 +311,6 @@
     return OFFSET_OF(Isolate, single_step_);
   }
 
-  void set_has_compiled_code(bool value) { has_compiled_code_ = value; }
-  bool has_compiled_code() const { return has_compiled_code_; }
-
   // Lets the embedder know that a service message resulted in a resume request.
   void SetResumeRequest() {
     resume_request_ = true;
@@ -713,7 +712,7 @@
   Dart_MessageNotifyCallback message_notify_callback_;
   char* name_;
   char* debugger_name_;
-  int64_t start_time_;
+  int64_t start_time_micros_;
   Dart_Port main_port_;
   Dart_Port origin_id_;  // Isolates created by spawnFunc have some origin id.
   uint64_t pause_capability_;
@@ -726,7 +725,6 @@
   Debugger* debugger_;
   bool resume_request_;
   int64_t last_resume_timestamp_;
-  bool has_compiled_code_;  // Can check that no compilation occured.
   Random random_;
   Simulator* simulator_;
   Mutex* mutex_;          // Protects compiler stats.
@@ -856,6 +854,7 @@
   friend class GCMarker;  // VisitObjectPointers
   friend class SafepointHandler;
   friend class Scavenger;  // VisitObjectPointers
+  friend class ObjectGraph;  // VisitObjectPointers
   friend class ServiceIsolate;
   friend class Thread;
   friend class Timeline;
@@ -915,7 +914,7 @@
                     void* init_data,
                     const char* script_url,
                     const Function& func,
-                    const Instance& message,
+                    SerializedObjectBuffer* message_buffer,
                     Monitor* spawn_count_monitor,
                     intptr_t* spawn_count,
                     const char* package_root,
@@ -929,8 +928,8 @@
                     const char* script_url,
                     const char* package_root,
                     const char* package_config,
-                    const Instance& args,
-                    const Instance& message,
+                    SerializedObjectBuffer* args_buffer,
+                    SerializedObjectBuffer* message_buffer,
                     Monitor* spawn_count_monitor,
                     intptr_t* spawn_count,
                     bool paused,
diff --git a/runtime/vm/isolate_reload.cc b/runtime/vm/isolate_reload.cc
index c375df3..08f33db 100644
--- a/runtime/vm/isolate_reload.cc
+++ b/runtime/vm/isolate_reload.cc
@@ -1596,6 +1596,9 @@
     handle_ = obj;
     if (handle_.IsFunction()) {
       const Function& func = Function::Cast(handle_);
+      if (func.IsSignatureFunction()) {
+        return;
+      }
 
       // Switch to unoptimized code or the lazy compilation stub.
       func.SwitchToLazyCompiledUnoptimizedCode();
diff --git a/runtime/vm/isolate_reload_test.cc b/runtime/vm/isolate_reload_test.cc
index 287eb71..be2a2f3 100644
--- a/runtime/vm/isolate_reload_test.cc
+++ b/runtime/vm/isolate_reload_test.cc
@@ -16,6 +16,8 @@
 
 #ifndef PRODUCT
 
+DECLARE_FLAG(bool, support_deprecated_tearoff_syntax);
+
 // TODO(johnmccutchan):
 // - Tests involving generics.
 
@@ -1434,19 +1436,19 @@
       "main() {\n"
       "  var c = new C();\n"
       "  list[0] = c.foo;\n"
-      "  list[1] = c#foo;\n"
+      "  list[1] = c.foo;\n"
       "  set.add(c.foo);\n"
-      "  set.add(c#foo);\n"
+      "  set.add(c.foo);\n"
       "  int countBefore = set.length;\n"
       "  reloadTest();\n"
       "  list[1] = c.foo;\n"
       "  set.add(c.foo);\n"
-      "  set.add(c#foo);\n"
+      "  set.add(c.foo);\n"
       "  int countAfter = set.length;\n"
       "  return '${list[0]()} ${list[1]()} ${list[0] == list[1]} '\n"
       "         '${countBefore == 1} ${countAfter == 1} ${(set.first)()} '\n"
-      "         '${set.first == c.foo} ${set.first == c#foo} '\n"
-      "         '${set.remove(c#foo)}';\n"
+      "         '${set.first == c.foo} ${set.first == c.foo} '\n"
+      "         '${set.remove(c.foo)}';\n"
       "}\n";
 
   Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
@@ -1462,19 +1464,19 @@
       "main() {\n"
       "  var c = new C();\n"
       "  list[0] = c.foo;\n"
-      "  list[1] = c#foo;\n"
+      "  list[1] = c.foo;\n"
       "  set.add(c.foo);\n"
-      "  set.add(c#foo);\n"
+      "  set.add(c.foo);\n"
       "  int countBefore = set.length;\n"
       "  reloadTest();\n"
       "  list[1] = c.foo;\n"
       "  set.add(c.foo);\n"
-      "  set.add(c#foo);\n"
+      "  set.add(c.foo);\n"
       "  int countAfter = set.length;\n"
       "  return '${list[0]()} ${list[1]()} ${list[0] == list[1]} '\n"
       "         '${countBefore == 1} ${countAfter == 1} ${(set.first)()} '\n"
-      "         '${set.first == c.foo} ${set.first == c#foo} '\n"
-      "         '${set.remove(c#foo)}';\n"
+      "         '${set.first == c.foo} ${set.first == c.foo} '\n"
+      "         '${set.remove(c.foo)}';\n"
       "}\n";
 
   TestCase::SetReloadTestScript(kReloadScript);
@@ -1503,7 +1505,7 @@
       "}\n"
       "main() {\n"
       "  var c = new C();\n"
-      "  var f = c#y;\n"
+      "  var f = c.y;\n"
       "  var r1 = invoke(f);\n"
       "  reloadTest();\n"
       "  var r2 = invoke(f);\n"
@@ -1527,7 +1529,7 @@
       "}\n"
       "main() {\n"
       "  var c = new C();\n"
-      "  var f = c#y;\n"
+      "  var f = c.y;\n"
       "  var r1 = invoke(f);\n"
       "  reloadTest();\n"
       "  var r2 = invoke(f);\n"
@@ -1536,8 +1538,10 @@
 
   TestCase::SetReloadTestScript(kReloadScript);
 
-  EXPECT_STREQ("4 NoSuchMethodError: Class 'C' has no instance getter 'y'.",
-               SimpleInvokeStr(lib, "main"));
+  EXPECT_STREQ(
+      "NoSuchMethodError: Class 'int' has no instance method 'call'. "
+      "NoSuchMethodError: Class 'int' has no instance method 'call'.",
+      SimpleInvokeStr(lib, "main"));
 
   lib = TestCase::GetReloadErrorOrRootLibrary();
   EXPECT_VALID(lib);
@@ -1561,7 +1565,7 @@
       "main() {\n"
       "  C.x = 3;\n"
       "  C.y = 4;\n"
-      "  var f = C#y;\n"
+      "  var f = C.y;\n"
       "  var r1 = invoke(f);\n"
       "  reloadTest();\n"
       "  var r2 = invoke(f);\n"
@@ -1586,7 +1590,7 @@
       "main() {\n"
       "  C.x = 3;\n"
       "  C.y = 4;\n"
-      "  var f = C#y;\n"
+      "  var f = C.y;\n"
       "  var r1 = invoke(f);\n"
       "  reloadTest();\n"
       "  var r2 = invoke(f);\n"
@@ -1596,8 +1600,8 @@
   TestCase::SetReloadTestScript(kReloadScript);
 
   EXPECT_STREQ(
-      "4 NoSuchMethodError: No static getter 'y' declared "
-      "in class 'C'.",
+      "NoSuchMethodError: Class 'int' has no instance method 'call'. "
+      "NoSuchMethodError: Class 'int' has no instance method 'call'.",
       SimpleInvokeStr(lib, "main"));
 
   lib = TestCase::GetReloadErrorOrRootLibrary();
@@ -1648,6 +1652,7 @@
       "  return '$r1 $r2';\n"
       "}\n";
 
+  FLAG_support_deprecated_tearoff_syntax = true;
   Dart_Handle lib = TestCase::LoadTestScript(
       kScript, IsolateReload_DanlingGetter_LibraryNativeResolver);
   EXPECT_VALID(lib);
@@ -1659,6 +1664,7 @@
 
   lib = TestCase::GetReloadErrorOrRootLibrary();
   EXPECT_VALID(lib);
+  FLAG_support_deprecated_tearoff_syntax = false;
 }
 
 
@@ -1685,6 +1691,7 @@
       "  return '$r1 $r2';\n"
       "}\n";
 
+  FLAG_support_deprecated_tearoff_syntax = true;
   Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
   EXPECT_VALID(lib);
 
@@ -1716,6 +1723,7 @@
 
   lib = TestCase::GetReloadErrorOrRootLibrary();
   EXPECT_VALID(lib);
+  FLAG_support_deprecated_tearoff_syntax = false;
 }
 
 
@@ -1743,6 +1751,7 @@
       "  return '$r1 $r2';\n"
       "}\n";
 
+  FLAG_support_deprecated_tearoff_syntax = true;
   Dart_Handle lib = TestCase::LoadTestScript(kScript, NULL);
   EXPECT_VALID(lib);
 
@@ -1777,6 +1786,7 @@
 
   lib = TestCase::GetReloadErrorOrRootLibrary();
   EXPECT_VALID(lib);
+  FLAG_support_deprecated_tearoff_syntax = false;
 }
 
 
@@ -1823,6 +1833,7 @@
       "  return '$r1 $r2';\n"
       "}\n";
 
+  FLAG_support_deprecated_tearoff_syntax = true;
   Dart_Handle lib = TestCase::LoadTestScript(
       kScript, IsolateReload_DanlingSetter_LibraryNativeResolver);
   EXPECT_VALID(lib);
@@ -1834,6 +1845,7 @@
 
   lib = TestCase::GetReloadErrorOrRootLibrary();
   EXPECT_VALID(lib);
+  FLAG_support_deprecated_tearoff_syntax = false;
 }
 
 
@@ -1852,7 +1864,7 @@
       "}\n"
       "main() {\n"
       "  var c = new C();\n"
-      "  var f = c#foo;\n"
+      "  var f = c.foo;\n"
       "  var r1 = invoke(f, 1);\n"
       "  reloadTest();\n"
       "  var r2 = invoke(f, 1);\n"
@@ -1876,7 +1888,7 @@
       "}\n"
       "main() {\n"
       "  var c = new C();\n"
-      "  var f = c#foo;\n"
+      "  var f = c.foo;\n"
       "  var r1 = invoke(f, 1);\n"
       "  reloadTest();\n"
       "  var r2 = invoke(f, 1);\n"
@@ -1909,7 +1921,7 @@
       "  }\n"
       "}\n"
       "main() {\n"
-      "  var f = C#foo;\n"
+      "  var f = C.foo;\n"
       "  var r1 = invoke(f, 1);\n"
       "  reloadTest();\n"
       "  var r2 = invoke(f, 1);\n"
@@ -1932,7 +1944,7 @@
       "  }\n"
       "}\n"
       "main() {\n"
-      "  var f = C#foo;\n"
+      "  var f = C.foo;\n"
       "  var r1 = invoke(f, 1);\n"
       "  reloadTest();\n"
       "  var r2 = invoke(f, 1);\n"
diff --git a/runtime/vm/isolate_test.cc b/runtime/vm/isolate_test.cc
index 5e71ed7..43bbd09 100644
--- a/runtime/vm/isolate_test.cc
+++ b/runtime/vm/isolate_test.cc
@@ -15,7 +15,8 @@
 
 UNIT_TEST_CASE(IsolateCurrent) {
   Dart_Isolate isolate = Dart_CreateIsolate(
-      NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL, NULL);
+      NULL, NULL, bin::core_isolate_snapshot_data,
+      bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   EXPECT_EQ(isolate, Dart_CurrentIsolate());
   Dart_ShutdownIsolate();
   EXPECT_EQ(reinterpret_cast<Dart_Isolate>(NULL), Dart_CurrentIsolate());
diff --git a/runtime/vm/jit_optimizer.cc b/runtime/vm/jit_optimizer.cc
index ff691b0..d7ef3e3 100644
--- a/runtime/vm/jit_optimizer.cc
+++ b/runtime/vm/jit_optimizer.cc
@@ -1234,9 +1234,15 @@
     if (cls.NumTypeArguments() > 0) {
       return Bool::null();
     }
+    // As of Dart 1.5, the Null type is a subtype of (and is more specific than)
+    // any type. However, we are checking instances here and not types. The
+    // null instance is only an instance of Null, Object, and dynamic.
     const bool is_subtype =
-        cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class,
-                        TypeArguments::Handle(Z), NULL, NULL, Heap::kOld);
+        cls.IsNullClass()
+            ? (type_class.IsNullClass() || type_class.IsObjectClass() ||
+               type_class.IsDynamicClass())
+            : cls.IsSubtypeOf(TypeArguments::Handle(Z), type_class,
+                              TypeArguments::Handle(Z), NULL, NULL, Heap::kOld);
     results->Add(cls.id());
     results->Add(is_subtype);
     if (prev.IsNull()) {
diff --git a/runtime/vm/json_parser.h b/runtime/vm/json_parser.h
new file mode 100644
index 0000000..83b9d6b
--- /dev/null
+++ b/runtime/vm/json_parser.h
@@ -0,0 +1,331 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef RUNTIME_VM_JSON_PARSER_H_
+#define RUNTIME_VM_JSON_PARSER_H_
+
+#include "vm/allocation.h"
+#include "vm/zone.h"
+#include "vm/growable_array.h"
+
+namespace dart {
+
+class ParsedJSONArray;
+
+class ParsedJSONValue : public ZoneAllocated {
+ public:
+  virtual ~ParsedJSONValue() {}
+
+  virtual bool IsObject() const { return false; }
+  virtual bool IsArray() const { return false; }
+  virtual bool IsString() const { return false; }
+  virtual bool IsNumber() const { return false; }
+  virtual bool IsBoolean() const { return false; }
+  virtual bool IsError() const { return false; }
+};
+
+class ParsedJSONString : public ParsedJSONValue {
+ public:
+  explicit ParsedJSONString(const char* value) : value_(value) {}
+  bool Equals(const char* other) { return strcmp(value_, other) == 0; }
+  const char* value() { return value_; }
+  virtual bool IsString() const { return true; }
+
+ private:
+  const char* value_;
+};
+
+class ParsedJSONNumber : public ParsedJSONValue {
+ public:
+  explicit ParsedJSONNumber(int64_t value) : value_(value) {}
+
+  int64_t value() { return value_; }
+  virtual bool IsNumber() const { return true; }
+
+ private:
+  int64_t value_;
+};
+
+class ParsedJSONBoolean : public ParsedJSONValue {
+ public:
+  explicit ParsedJSONBoolean(bool value) : value_(value) {}
+
+  bool value() { return value_; }
+  virtual bool IsBoolean() const { return true; }
+
+ private:
+  bool value_;
+};
+
+class ParsedJSONNull : public ParsedJSONValue {
+ public:
+  virtual bool IsNull() const { return true; }
+};
+
+class ParsedJSONObject : public ParsedJSONValue {
+ public:
+  ParsedJSONObject(intptr_t length, ParsedJSONValue** keys_and_values)
+      : length_(length), keys_and_values_(keys_and_values) {}
+
+  ParsedJSONValue* At(const char* key) const {
+    for (intptr_t i = 0; i < length_; i += 2) {
+      ASSERT(keys_and_values_[i]->IsString());
+      ParsedJSONString* jskey =
+          static_cast<ParsedJSONString*>(keys_and_values_[i]);
+      if (jskey->Equals(key)) {
+        return keys_and_values_[i + 1];
+      }
+    }
+    return NULL;
+  }
+
+  virtual bool IsObject() const { return true; }
+
+  ParsedJSONNumber* NumberAt(const char* key) {
+    ParsedJSONValue* member = At(key);
+    if ((member == NULL) || !member->IsNumber()) {
+      return NULL;
+    }
+    return static_cast<ParsedJSONNumber*>(member);
+  }
+
+  ParsedJSONString* StringAt(const char* key) {
+    ParsedJSONValue* member = At(key);
+    if ((member == NULL) || !member->IsString()) {
+      return NULL;
+    }
+    return static_cast<ParsedJSONString*>(member);
+  }
+
+  ParsedJSONBoolean* BooleanAt(const char* key) {
+    ParsedJSONValue* member = At(key);
+    if ((member == NULL) || !member->IsBoolean()) {
+      return NULL;
+    }
+    return static_cast<ParsedJSONBoolean*>(member);
+  }
+
+  inline ParsedJSONArray* ArrayAt(const char* key);
+
+ private:
+  intptr_t length_;
+  ParsedJSONValue** keys_and_values_;
+};
+
+class ParsedJSONArray : public ParsedJSONValue {
+ public:
+  ParsedJSONArray(intptr_t length, ParsedJSONValue** elements)
+      : length_(length), elements_(elements) {}
+
+  ParsedJSONValue* At(intptr_t index) const {
+    ASSERT(index < length_);
+    return elements_[index];
+  }
+
+  intptr_t Length() const { return length_; }
+
+  virtual bool IsArray() const { return true; }
+
+  ParsedJSONObject* ObjectAt(intptr_t index) {
+    ParsedJSONValue* element = At(index);
+    if ((element == NULL) || !element->IsObject()) {
+      return NULL;
+    }
+    return static_cast<ParsedJSONObject*>(element);
+  }
+
+  ParsedJSONNumber* NumberAt(intptr_t index) {
+    ParsedJSONValue* element = At(index);
+    if ((element == NULL) || !element->IsNumber()) {
+      return NULL;
+    }
+    return static_cast<ParsedJSONNumber*>(element);
+  }
+
+ private:
+  intptr_t length_;
+  ParsedJSONValue** elements_;
+};
+
+class ParsedJSONError : public ParsedJSONValue {
+ public:
+  explicit ParsedJSONError(const char* message, intptr_t position)
+      : message_(message), position_(position) {}
+
+  virtual bool IsError() const { return true; }
+
+  const char* message() const { return message_; }
+  intptr_t position() const { return position_; }
+
+ private:
+  const char* message_;
+  intptr_t position_;
+};
+
+class JSONParser {
+ public:
+  JSONParser(const char* buffer, intptr_t length, Zone* zone)
+      : buffer_(buffer), position_(0), length_(length), zone_(zone) {}
+
+  ParsedJSONValue* ParseValue() {
+    ConsumeWhitespace();
+    if (Peek() == '\"') return ParseString();
+    if (IsDigitOrMinus(Peek())) return ParseNumber();
+    if (Peek() == '{') return ParseObject();
+    if (Peek() == '[') return ParseArray();
+    if (PeekAndConsume("true")) return new (zone_) ParsedJSONBoolean(true);
+    if (PeekAndConsume("false")) return new (zone_) ParsedJSONBoolean(false);
+    if (PeekAndConsume("null")) return new (zone_) ParsedJSONNull();
+    return Error("value expected");
+  }
+
+ private:
+  intptr_t Available() const { return length_ - position_; }
+  char Peek() const {
+    if (position_ < length_) return buffer_[position_];
+    return 0;
+  }
+  char Consume() {
+    ASSERT(position_ < length_);
+    return buffer_[position_++];
+  }
+  bool PeekAndConsume(const char* expected) {
+    intptr_t n = strlen(expected);
+    if (Available() < n) return false;
+    if (strncmp(&buffer_[position_], expected, n) != 0) return false;
+    position_ += n;
+    return true;
+  }
+  void ConsumeWhitespace() {
+    while ((Available() > 0) && (buffer_[position_] < ' '))
+      position_++;
+  }
+  bool IsDigit(char c) { return c >= '0' && c <= '9'; }
+  bool IsDigitOrMinus(char c) { return (c == '-') || (c >= '0' && c <= '9'); }
+
+  ParsedJSONValue* ParseString() {
+    ConsumeWhitespace();
+    if (Peek() != '\"') return Error("string expected");
+    Consume();
+    intptr_t start = position_;
+    for (;;) {
+      if (Available() == 0) return Error("unterminated string");
+      if (Consume() == '\"') break;
+    }
+    intptr_t end = position_ - 1;
+
+    char* cstr = zone_->Alloc<char>(end - start + 1);
+    intptr_t dst_pos = 0;
+    for (intptr_t src_pos = start; src_pos < end; src_pos++) {
+      if (buffer_[src_pos] == '\\') {
+        src_pos++;
+      }
+      cstr[dst_pos++] = buffer_[src_pos];
+    }
+    cstr[dst_pos] = '\0';
+
+    return new (zone_) ParsedJSONString(cstr);
+  }
+
+  ParsedJSONValue* ParseNumber() {
+    ConsumeWhitespace();
+    bool negate = false;
+    if (Peek() == '-') {
+      Consume();
+      negate = true;
+    }
+    if (!IsDigit(Peek())) return Error("number expected");
+    int64_t value = 0;
+    for (;;) {
+      if (!IsDigit(Peek())) break;
+      char c = Consume();
+      value *= 10;
+      value += (c - '0');
+    }
+    if (negate) {
+      value = -value;
+    }
+    return new (zone_) ParsedJSONNumber(value);
+  }
+
+  ParsedJSONValue* ParseObject() {
+    ConsumeWhitespace();
+    if (Peek() != '{') return Error("object expected");
+    Consume();
+    ConsumeWhitespace();
+    if (Peek() == '}') return new (zone_) ParsedJSONObject(0, NULL);
+    ZoneGrowableArray<ParsedJSONValue*>* keys_and_values =
+        new (zone_) ZoneGrowableArray<ParsedJSONValue*>(zone_, 6);
+    for (;;) {
+      ParsedJSONValue* key = ParseString();
+      if (key->IsError()) return key;
+      ConsumeWhitespace();
+      if (Consume() != ':') return Error(": expected");
+      ConsumeWhitespace();
+      ParsedJSONValue* value = ParseValue();
+      if (value->IsError()) return value;
+      ConsumeWhitespace();
+
+      keys_and_values->Add(key);
+      keys_and_values->Add(value);
+
+      char c = Consume();
+      if (c == '}') break;
+      if (c != ',') return Error(", expected (object)");
+      ConsumeWhitespace();
+    }
+
+    return new (zone_)
+        ParsedJSONObject(keys_and_values->length(), keys_and_values->data());
+  }
+
+  ParsedJSONValue* ParseArray() {
+    ConsumeWhitespace();
+    if (Peek() != '[') return Error("array expected");
+    Consume();
+    ConsumeWhitespace();
+    if (Peek() == ']') {
+      Consume();
+      return new (zone_) ParsedJSONArray(0, NULL);
+    }
+    ZoneGrowableArray<ParsedJSONValue*>* elements =
+        new (zone_) ZoneGrowableArray<ParsedJSONValue*>(zone_, 6);
+    for (;;) {
+      ParsedJSONValue* element = ParseValue();
+      if (element->IsError()) return element;
+      ConsumeWhitespace();
+
+      elements->Add(element);
+
+      char c = Consume();
+      if (c == ']') break;
+      if (c != ',') return Error(", expected (array)");
+      ConsumeWhitespace();
+    }
+
+    return new (zone_) ParsedJSONArray(elements->length(), elements->data());
+  }
+
+ private:
+  ParsedJSONError* Error(const char* message) {
+    return new (zone_) ParsedJSONError(message, position_);
+  }
+
+  const char* const buffer_;
+  intptr_t position_;
+  intptr_t length_;
+  Zone* zone_;
+};
+
+ParsedJSONArray* ParsedJSONObject::ArrayAt(const char* key) {
+  ParsedJSONValue* member = At(key);
+  if ((member == NULL) || !member->IsArray()) {
+    return NULL;
+  }
+  return static_cast<ParsedJSONArray*>(member);
+}
+
+}  // namespace dart
+
+#endif  // RUNTIME_VM_JSON_PARSER_H_
diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
index 8310e70..f098998 100644
--- a/runtime/vm/json_stream.cc
+++ b/runtime/vm/json_stream.cc
@@ -14,6 +14,7 @@
 #include "vm/safepoint.h"
 #include "vm/service.h"
 #include "vm/service_event.h"
+#include "vm/thread_registry.h"
 #include "vm/timeline.h"
 #include "vm/unicode.h"
 
@@ -107,7 +108,7 @@
     const char* isolate_name = isolate->name();
     setup_time_micros_ = OS::GetCurrentTimeMicros();
     OS::Print("[+%" Pd64 "ms] Isolate %s processing service request %s\n",
-              Dart::timestamp(), isolate_name, method_);
+              Dart::UptimeMillis(), isolate_name, method_);
   }
   buffer_.Printf("{\"jsonrpc\":\"2.0\", \"result\":");
 }
@@ -139,6 +140,8 @@
       return "Isolate must be runnable";
     case kIsolateMustBePaused:
       return "Isolate must be paused";
+    case kCannotResume:
+      return "Cannot resume execution";
     case kIsolateIsReloading:
       return "Isolate is reloading";
     case kFileSystemAlreadyExists:
@@ -147,8 +150,8 @@
       return "File system does not exist";
     case kFileDoesNotExist:
       return "File does not exist";
-    case kIsolateReloadFailed:
-      return "Isolate reload failed";
+    case kIsolateReloadBarred:
+      return "Isolate cannot be reloaded";
     default:
       return "Extension error";
   }
@@ -263,12 +266,12 @@
       OS::Print("[+%" Pd64
                 "ms] Isolate %s processed service request %s "
                 "(%" Pd64 "us)\n",
-                Dart::timestamp(), isolate_name, method_, total_time);
+                Dart::UptimeMillis(), isolate_name, method_, total_time);
     } else {
       OS::Print("[+%" Pd64
                 "ms] Isolate %s processed service request %s "
                 "(%" Pd64 "us) FAILED\n",
-                Dart::timestamp(), isolate_name, method_, total_time);
+                Dart::UptimeMillis(), isolate_name, method_, total_time);
     }
   }
 }
@@ -538,6 +541,24 @@
 }
 
 
+void JSONStream::PrintValue(ThreadRegistry* reg) {
+  PrintCommaIfNeeded();
+  reg->PrintJSON(this);
+}
+
+
+void JSONStream::PrintValue(Thread* thread) {
+  PrintCommaIfNeeded();
+  thread->PrintJSON(this);
+}
+
+
+void JSONStream::PrintValue(Zone* zone) {
+  PrintCommaIfNeeded();
+  zone->PrintJSON(this);
+}
+
+
 void JSONStream::PrintValue(const TimelineEvent* timeline_event) {
   PrintCommaIfNeeded();
   timeline_event->PrintJSON(this);
@@ -661,6 +682,24 @@
 }
 
 
+void JSONStream::PrintProperty(const char* name, ThreadRegistry* reg) {
+  PrintPropertyName(name);
+  PrintValue(reg);
+}
+
+
+void JSONStream::PrintProperty(const char* name, Thread* thread) {
+  PrintPropertyName(name);
+  PrintValue(thread);
+}
+
+
+void JSONStream::PrintProperty(const char* name, Zone* zone) {
+  PrintPropertyName(name);
+  PrintValue(zone);
+}
+
+
 void JSONStream::PrintProperty(const char* name,
                                const TimelineEvent* timeline_event) {
   PrintPropertyName(name);
diff --git a/runtime/vm/json_stream.h b/runtime/vm/json_stream.h
index b54bfb2..6f4e85a 100644
--- a/runtime/vm/json_stream.h
+++ b/runtime/vm/json_stream.h
@@ -30,6 +30,8 @@
 class String;
 class TimelineEvent;
 class TimelineEventBlock;
+class Thread;
+class ThreadRegistry;
 class Zone;
 
 
@@ -53,14 +55,14 @@
   kStreamNotSubscribed = 104,
   kIsolateMustBeRunnable = 105,
   kIsolateMustBePaused = 106,
+  kCannotResume = 107,
+  kIsolateIsReloading = 108,
+  kIsolateReloadBarred = 109,
 
   // Experimental (used in private rpcs).
-  kIsolateIsReloading = 1000,
   kFileSystemAlreadyExists = 1001,
   kFileSystemDoesNotExist = 1002,
   kFileDoesNotExist = 1003,
-  kIsolateReloadFailed = 1004,
-  kIsolateReloadBarred = 1005,
 };
 
 // Expected that user_data is a JSONStream*.
@@ -180,6 +182,9 @@
   void PrintValue(Metric* metric);
   void PrintValue(MessageQueue* queue);
   void PrintValue(Isolate* isolate, bool ref = true);
+  void PrintValue(ThreadRegistry* reg);
+  void PrintValue(Thread* thread);
+  void PrintValue(Zone* zone);
   bool PrintValueStr(const String& s, intptr_t offset, intptr_t count);
   void PrintValue(const TimelineEvent* timeline_event);
   void PrintValue(const TimelineEventBlock* timeline_event_block);
@@ -211,6 +216,9 @@
   void PrintProperty(const char* name, Metric* metric);
   void PrintProperty(const char* name, MessageQueue* queue);
   void PrintProperty(const char* name, Isolate* isolate);
+  void PrintProperty(const char* name, ThreadRegistry* reg);
+  void PrintProperty(const char* name, Thread* thread);
+  void PrintProperty(const char* name, Zone* zone);
   void PrintProperty(const char* name, const TimelineEvent* timeline_event);
   void PrintProperty(const char* name,
                      const TimelineEventBlock* timeline_event_block);
@@ -330,6 +338,15 @@
   void AddProperty(const char* name, Isolate* isolate) const {
     stream_->PrintProperty(name, isolate);
   }
+  void AddProperty(const char* name, ThreadRegistry* reg) const {
+    stream_->PrintProperty(name, reg);
+  }
+  void AddProperty(const char* name, Thread* thread) const {
+    stream_->PrintProperty(name, thread);
+  }
+  void AddProperty(const char* name, Zone* zone) const {
+    stream_->PrintProperty(name, zone);
+  }
   void AddProperty(const char* name,
                    const TimelineEvent* timeline_event) const {
     stream_->PrintProperty(name, timeline_event);
@@ -385,6 +402,9 @@
   void AddValue(Isolate* isolate, bool ref = true) const {
     stream_->PrintValue(isolate, ref);
   }
+  void AddValue(ThreadRegistry* reg) const { stream_->PrintValue(reg); }
+  void AddValue(Thread* thread) const { stream_->PrintValue(thread); }
+  void AddValue(Zone* zone) const { stream_->PrintValue(zone); }
   void AddValue(Breakpoint* bpt) const { stream_->PrintValue(bpt); }
   void AddValue(TokenPosition tp) const { stream_->PrintValue(tp); }
   void AddValue(const ServiceEvent* event) const { stream_->PrintValue(event); }
diff --git a/runtime/vm/kernel.cc b/runtime/vm/kernel.cc
index f30e100..48dcbde 100644
--- a/runtime/vm/kernel.cc
+++ b/runtime/vm/kernel.cc
@@ -752,20 +752,6 @@
 }
 
 
-BlockExpression::~BlockExpression() {}
-
-
-void BlockExpression::AcceptExpressionVisitor(ExpressionVisitor* visitor) {
-  visitor->VisitBlockExpression(this);
-}
-
-
-void BlockExpression::VisitChildren(Visitor* visitor) {
-  visitor->VisitBlock(body());
-  value()->AcceptExpressionVisitor(visitor);
-}
-
-
 Statement::~Statement() {}
 
 
diff --git a/runtime/vm/kernel.h b/runtime/vm/kernel.h
index 15bf633..ebdac48 100644
--- a/runtime/vm/kernel.h
+++ b/runtime/vm/kernel.h
@@ -79,7 +79,6 @@
   M(AwaitExpression)                                                           \
   M(FunctionExpression)                                                        \
   M(Let)                                                                       \
-  M(BlockExpression)                                                           \
   M(Statement)                                                                 \
   M(InvalidStatement)                                                          \
   M(ExpressionStatement)                                                       \
@@ -136,7 +135,6 @@
 class Reader;
 class TreeNode;
 class TypeParameter;
-class Writer;
 
 // Boxes a value of type `T*` and `delete`s it on destruction.
 template <typename T>
@@ -200,11 +198,6 @@
   template <typename IT>
   void ReadFromStatic(Reader* reader);
 
-  void WriteTo(Writer* writer);
-
-  template <typename IT>
-  void WriteToStatic(Writer* writer);
-
   // Extends the array to at least be able to hold [length] elements.
   //
   // Free places will be filled with `NULL` values.
@@ -241,7 +234,6 @@
 class TypeParameterList : public List<TypeParameter> {
  public:
   void ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 };
 
 
@@ -249,7 +241,6 @@
 class Tuple {
  public:
   static Tuple<A, B>* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   Tuple(A* a, B* b) : first_(a), second_(b) {}
 
@@ -270,8 +261,6 @@
  public:
   static String* ReadFrom(Reader* reader);
   static String* ReadFromImpl(Reader* reader);
-  void WriteTo(Writer* writer);
-  void WriteToImpl(Writer* writer);
 
   String(const uint8_t* utf8, int length) {
     buffer_ = new uint8_t[length];
@@ -296,7 +285,6 @@
 class StringTable {
  public:
   void ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   List<String>& strings() { return strings_; }
 
@@ -311,29 +299,36 @@
 };
 
 
-class LineStartingTable {
+class SourceTable {
  public:
   void ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
-  ~LineStartingTable() {
+  ~SourceTable() {
     for (intptr_t i = 0; i < size_; ++i) {
-      delete[] values_[i];
+      delete source_code_[i];
+      delete[] line_starts_[i];
     }
-    delete[] values_;
+    delete[] source_code_;
+    delete[] line_starts_;
+    delete[] line_count_;
   }
 
   intptr_t size() { return size_; }
-  intptr_t* valuesFor(int i) { return values_[i]; }
+  String* SourceFor(intptr_t i) { return source_code_[i]; }
+  intptr_t* LineStartsFor(intptr_t i) { return line_starts_[i]; }
+  intptr_t LineCountFor(intptr_t i) { return line_count_[i]; }
 
  private:
-  LineStartingTable() : values_(NULL), size_(0) {}
+  SourceTable()
+      : source_code_(NULL), line_starts_(NULL), line_count_(NULL), size_(0) {}
 
   friend class Program;
 
-  intptr_t** values_;
+  String** source_code_;
+  intptr_t** line_starts_;
+  intptr_t* line_count_;
   intptr_t size_;
 
-  DISALLOW_COPY_AND_ASSIGN(LineStartingTable);
+  DISALLOW_COPY_AND_ASSIGN(SourceTable);
 };
 
 // Forward declare all classes.
@@ -408,7 +403,6 @@
 class Library : public TreeNode {
  public:
   Library* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~Library();
 
@@ -466,7 +460,6 @@
 class Class : public TreeNode {
  public:
   Class* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~Class();
 
@@ -481,6 +474,7 @@
   intptr_t source_uri_index() { return source_uri_index_; }
   bool is_abstract() { return is_abstract_; }
   List<Expression>& annotations() { return annotations_; }
+  TokenPosition position() { return position_; }
 
   virtual List<TypeParameter>& type_parameters() = 0;
   virtual List<InterfaceType>& implemented_classes() = 0;
@@ -489,7 +483,7 @@
   virtual List<Procedure>& procedures() = 0;
 
  protected:
-  Class() : is_abstract_(false) {}
+  Class() : is_abstract_(false), position_(TokenPosition::kNoSource) {}
 
  private:
   template <typename T>
@@ -500,6 +494,7 @@
   intptr_t source_uri_index_;
   bool is_abstract_;
   List<Expression> annotations_;
+  TokenPosition position_;
 
   DISALLOW_COPY_AND_ASSIGN(Class);
 };
@@ -508,7 +503,6 @@
 class NormalClass : public Class {
  public:
   NormalClass* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~NormalClass();
 
@@ -547,7 +541,6 @@
 class MixinClass : public Class {
  public:
   MixinClass* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~MixinClass();
 
@@ -600,9 +593,13 @@
   TreeNode* parent() { return parent_; }
   Name* name() { return name_; }
   List<Expression>& annotations() { return annotations_; }
+  TokenPosition position() { return position_; }
+  TokenPosition end_position() { return end_position_; }
 
  protected:
-  Member() {}
+  Member()
+      : position_(TokenPosition::kNoSource),
+        end_position_(TokenPosition::kNoSource) {}
 
   template <typename T>
   friend class List;
@@ -610,6 +607,8 @@
   Ref<TreeNode> parent_;
   Child<Name> name_;
   List<Expression> annotations_;
+  TokenPosition position_;
+  TokenPosition end_position_;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(Member);
@@ -625,7 +624,6 @@
   };
 
   Field* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~Field();
 
@@ -643,10 +641,9 @@
   DartType* type() { return type_; }
   InferredValue* inferred_value() { return inferred_value_; }
   Expression* initializer() { return initializer_; }
-  TokenPosition position() { return position_; }
 
  private:
-  Field() : position_(TokenPosition::kNoSource) {}
+  Field() {}
 
   template <typename T>
   friend class List;
@@ -656,7 +653,6 @@
   Child<DartType> type_;
   Child<InferredValue> inferred_value_;
   Child<Expression> initializer_;
-  TokenPosition position_;
 
   DISALLOW_COPY_AND_ASSIGN(Field);
 };
@@ -670,7 +666,6 @@
   };
 
   Constructor* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~Constructor();
 
@@ -721,7 +716,6 @@
   };
 
   Procedure* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~Procedure();
 
@@ -758,7 +752,6 @@
 class Initializer : public TreeNode {
  public:
   static Initializer* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer) = 0;
 
   virtual ~Initializer();
 
@@ -778,7 +771,6 @@
 class InvalidInitializer : public Initializer {
  public:
   static InvalidInitializer* ReadFromImpl(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~InvalidInitializer();
 
@@ -796,7 +788,6 @@
 class FieldInitializer : public Initializer {
  public:
   static FieldInitializer* ReadFromImpl(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~FieldInitializer();
 
@@ -821,7 +812,6 @@
 class SuperInitializer : public Initializer {
  public:
   static SuperInitializer* ReadFromImpl(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~SuperInitializer();
 
@@ -846,7 +836,6 @@
 class RedirectingInitializer : public Initializer {
  public:
   static RedirectingInitializer* ReadFromImpl(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~RedirectingInitializer();
 
@@ -871,7 +860,6 @@
 class LocalInitializer : public Initializer {
  public:
   static LocalInitializer* ReadFromImpl(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~LocalInitializer();
 
@@ -902,7 +890,6 @@
   };
 
   static FunctionNode* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~FunctionNode();
 
@@ -912,6 +899,7 @@
   virtual void VisitChildren(Visitor* visitor);
 
   AsyncMarker async_marker() { return async_marker_; }
+  bool debuggable() { return debuggable_; }
   TypeParameterList& type_parameters() { return type_parameters_; }
   int required_parameter_count() { return required_parameter_count_; }
   List<VariableDeclaration>& positional_parameters() {
@@ -921,11 +909,16 @@
   DartType* return_type() { return return_type_; }
   InferredValue* inferred_return_value() { return inferred_return_value_; }
   Statement* body() { return body_; }
+  TokenPosition position() { return position_; }
+  TokenPosition end_position() { return end_position_; }
 
  private:
-  FunctionNode() {}
+  FunctionNode()
+      : position_(TokenPosition::kNoSource),
+        end_position_(TokenPosition::kNoSource) {}
 
   AsyncMarker async_marker_;
+  bool debuggable_;
   TypeParameterList type_parameters_;
   int required_parameter_count_;
   List<VariableDeclaration> positional_parameters_;
@@ -933,6 +926,8 @@
   Child<DartType> return_type_;
   Child<InferredValue> inferred_return_value_;
   Child<Statement> body_;
+  TokenPosition position_;
+  TokenPosition end_position_;
 
   DISALLOW_COPY_AND_ASSIGN(FunctionNode);
 };
@@ -941,7 +936,6 @@
 class Expression : public TreeNode {
  public:
   static Expression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer) = 0;
 
   virtual ~Expression();
 
@@ -963,7 +957,6 @@
 class InvalidExpression : public Expression {
  public:
   static InvalidExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~InvalidExpression();
   virtual void VisitChildren(Visitor* visitor);
@@ -983,7 +976,6 @@
  public:
   static VariableGet* ReadFrom(Reader* reader);
   static VariableGet* ReadFrom(Reader* reader, uint8_t payload);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~VariableGet();
 
@@ -1007,7 +999,6 @@
  public:
   static VariableSet* ReadFrom(Reader* reader);
   static VariableSet* ReadFrom(Reader* reader, uint8_t payload);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~VariableSet();
 
@@ -1032,7 +1023,6 @@
 class PropertyGet : public Expression {
  public:
   static PropertyGet* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~PropertyGet();
 
@@ -1058,7 +1048,6 @@
 class PropertySet : public Expression {
  public:
   static PropertySet* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~PropertySet();
 
@@ -1086,7 +1075,6 @@
 class DirectPropertyGet : public Expression {
  public:
   static DirectPropertyGet* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~DirectPropertyGet();
 
@@ -1111,7 +1099,6 @@
 class DirectPropertySet : public Expression {
  public:
   static DirectPropertySet* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~DirectPropertySet();
 
@@ -1138,7 +1125,6 @@
 class StaticGet : public Expression {
  public:
   static StaticGet* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~StaticGet();
 
@@ -1161,7 +1147,6 @@
 class StaticSet : public Expression {
  public:
   static StaticSet* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~StaticSet();
 
@@ -1186,7 +1171,6 @@
 class Arguments : public TreeNode {
  public:
   static Arguments* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~Arguments();
 
@@ -1215,7 +1199,6 @@
 class NamedExpression : public TreeNode {
  public:
   static NamedExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   NamedExpression(String* name, Expression* expr)
       : name_(name), expression_(expr) {}
@@ -1242,7 +1225,6 @@
 class MethodInvocation : public Expression {
  public:
   static MethodInvocation* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~MethodInvocation();
 
@@ -1270,7 +1252,6 @@
 class DirectMethodInvocation : public Expression {
  public:
   static DirectMethodInvocation* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~DirectMethodInvocation();
 
@@ -1297,7 +1278,6 @@
 class StaticInvocation : public Expression {
  public:
   static StaticInvocation* ReadFrom(Reader* reader, bool is_const);
-  virtual void WriteTo(Writer* writer);
   ~StaticInvocation();
 
   virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
@@ -1321,7 +1301,6 @@
 class ConstructorInvocation : public Expression {
  public:
   static ConstructorInvocation* ReadFrom(Reader* reader, bool is_const);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~ConstructorInvocation();
 
@@ -1348,7 +1327,6 @@
 class Not : public Expression {
  public:
   static Not* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~Not();
 
@@ -1373,7 +1351,6 @@
   enum Operator { kAnd, kOr };
 
   static LogicalExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~LogicalExpression();
 
@@ -1400,7 +1377,6 @@
 class ConditionalExpression : public Expression {
  public:
   static ConditionalExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~ConditionalExpression();
 
@@ -1427,7 +1403,6 @@
 class StringConcatenation : public Expression {
  public:
   static StringConcatenation* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~StringConcatenation();
 
@@ -1450,7 +1425,6 @@
 class IsExpression : public Expression {
  public:
   static IsExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~IsExpression();
 
@@ -1475,7 +1449,6 @@
 class AsExpression : public Expression {
  public:
   static AsExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~AsExpression();
 
@@ -1510,7 +1483,6 @@
 class StringLiteral : public BasicLiteral {
  public:
   static StringLiteral* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
 
@@ -1534,7 +1506,6 @@
 class BigintLiteral : public StringLiteral {
  public:
   static BigintLiteral* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
 
@@ -1554,7 +1525,6 @@
  public:
   static IntLiteral* ReadFrom(Reader* reader, bool is_negative);
   static IntLiteral* ReadFrom(Reader* reader, uint8_t payload);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~IntLiteral();
 
@@ -1576,7 +1546,6 @@
 class DoubleLiteral : public BasicLiteral {
  public:
   static DoubleLiteral* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~DoubleLiteral();
 
@@ -1598,7 +1567,6 @@
 class BoolLiteral : public BasicLiteral {
  public:
   static BoolLiteral* ReadFrom(Reader* reader, bool value);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~BoolLiteral();
 
@@ -1620,7 +1588,6 @@
 class NullLiteral : public BasicLiteral {
  public:
   static NullLiteral* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~NullLiteral();
 
@@ -1638,7 +1605,6 @@
 class SymbolLiteral : public Expression {
  public:
   static SymbolLiteral* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~SymbolLiteral();
 
@@ -1661,7 +1627,6 @@
 class TypeLiteral : public Expression {
  public:
   static TypeLiteral* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~TypeLiteral();
 
@@ -1684,7 +1649,6 @@
 class ThisExpression : public Expression {
  public:
   static ThisExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~ThisExpression();
 
@@ -1703,7 +1667,6 @@
 class Rethrow : public Expression {
  public:
   static Rethrow* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~Rethrow();
 
@@ -1722,7 +1685,6 @@
 class Throw : public Expression {
  public:
   static Throw* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~Throw();
 
@@ -1745,7 +1707,6 @@
 class ListLiteral : public Expression {
  public:
   static ListLiteral* ReadFrom(Reader* reader, bool is_const);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~ListLiteral();
 
@@ -1772,7 +1733,6 @@
 class MapLiteral : public Expression {
  public:
   static MapLiteral* ReadFrom(Reader* reader, bool is_const);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~MapLiteral();
 
@@ -1801,7 +1761,6 @@
 class MapEntry : public TreeNode {
  public:
   static MapEntry* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~MapEntry();
 
@@ -1829,7 +1788,6 @@
 class AwaitExpression : public Expression {
  public:
   static AwaitExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~AwaitExpression();
 
@@ -1852,7 +1810,6 @@
 class FunctionExpression : public Expression {
  public:
   static FunctionExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~FunctionExpression();
 
@@ -1875,7 +1832,6 @@
 class Let : public Expression {
  public:
   static Let* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~Let();
 
@@ -1886,46 +1842,26 @@
 
   VariableDeclaration* variable() { return variable_; }
   Expression* body() { return body_; }
+  TokenPosition position() { return position_; }
+  TokenPosition end_position() { return end_position_; }
 
  private:
-  Let() {}
+  Let()
+      : position_(TokenPosition::kNoSource),
+        end_position_(TokenPosition::kNoSource) {}
 
   Child<VariableDeclaration> variable_;
   Child<Expression> body_;
+  TokenPosition position_;
+  TokenPosition end_position_;
 
   DISALLOW_COPY_AND_ASSIGN(Let);
 };
 
 
-class BlockExpression : public Expression {
- public:
-  static BlockExpression* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
-
-  virtual ~BlockExpression();
-
-  DEFINE_CASTING_OPERATIONS(BlockExpression);
-
-  virtual void AcceptExpressionVisitor(ExpressionVisitor* visitor);
-  virtual void VisitChildren(Visitor* visitor);
-
-  Block* body() { return body_; }
-  Expression* value() { return value_; }
-
- private:
-  BlockExpression() {}
-
-  Child<Block> body_;
-  Child<Expression> value_;
-
-  DISALLOW_COPY_AND_ASSIGN(BlockExpression);
-};
-
-
 class Statement : public TreeNode {
  public:
   static Statement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer) = 0;
 
   virtual ~Statement();
 
@@ -1933,9 +1869,11 @@
 
   virtual void AcceptTreeVisitor(TreeVisitor* visitor);
   virtual void AcceptStatementVisitor(StatementVisitor* visitor) = 0;
+  TokenPosition position() { return position_; }
 
  protected:
-  Statement() {}
+  Statement() : position_(TokenPosition::kNoSource) {}
+  TokenPosition position_;
 
  private:
   DISALLOW_COPY_AND_ASSIGN(Statement);
@@ -1945,7 +1883,6 @@
 class InvalidStatement : public Statement {
  public:
   static InvalidStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~InvalidStatement();
 
@@ -1964,7 +1901,6 @@
 class ExpressionStatement : public Statement {
  public:
   static ExpressionStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   explicit ExpressionStatement(Expression* exp) : expression_(exp) {}
   virtual ~ExpressionStatement();
@@ -1988,8 +1924,6 @@
 class Block : public Statement {
  public:
   static Block* ReadFromImpl(Reader* reader);
-  virtual void WriteTo(Writer* writer);
-  void WriteToImpl(Writer* writer);
 
   virtual ~Block();
 
@@ -1999,11 +1933,13 @@
   virtual void VisitChildren(Visitor* visitor);
 
   List<Statement>& statements() { return statements_; }
+  TokenPosition end_position() { return end_position_; }
 
  private:
-  Block() {}
+  Block() : end_position_(TokenPosition::kNoSource) {}
 
   List<Statement> statements_;
+  TokenPosition end_position_;
 
   DISALLOW_COPY_AND_ASSIGN(Block);
 };
@@ -2012,7 +1948,6 @@
 class EmptyStatement : public Statement {
  public:
   static EmptyStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~EmptyStatement();
 
@@ -2031,7 +1966,6 @@
 class AssertStatement : public Statement {
  public:
   static AssertStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~AssertStatement();
 
@@ -2056,7 +1990,6 @@
 class LabeledStatement : public Statement {
  public:
   static LabeledStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~LabeledStatement();
 
@@ -2079,7 +2012,6 @@
 class BreakStatement : public Statement {
  public:
   static BreakStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~BreakStatement();
 
@@ -2102,7 +2034,6 @@
 class WhileStatement : public Statement {
  public:
   static WhileStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~WhileStatement();
 
@@ -2127,7 +2058,6 @@
 class DoStatement : public Statement {
  public:
   static DoStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~DoStatement();
 
@@ -2152,7 +2082,6 @@
 class ForStatement : public Statement {
  public:
   static ForStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~ForStatement();
 
@@ -2165,14 +2094,20 @@
   Expression* condition() { return condition_; }
   List<Expression>& updates() { return updates_; }
   Statement* body() { return body_; }
+  TokenPosition position() { return position_; }
+  TokenPosition end_position() { return end_position_; }
 
  private:
-  ForStatement() {}
+  ForStatement()
+      : position_(TokenPosition::kNoSource),
+        end_position_(TokenPosition::kNoSource) {}
 
   List<VariableDeclaration> variables_;
   Child<Expression> condition_;
   List<Expression> updates_;
   Child<Statement> body_;
+  TokenPosition position_;
+  TokenPosition end_position_;
 
   DISALLOW_COPY_AND_ASSIGN(ForStatement);
 };
@@ -2181,7 +2116,6 @@
 class ForInStatement : public Statement {
  public:
   static ForInStatement* ReadFrom(Reader* reader, bool is_async);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~ForInStatement();
 
@@ -2194,14 +2128,20 @@
   Expression* iterable() { return iterable_; }
   Statement* body() { return body_; }
   bool is_async() { return is_async_; }
+  TokenPosition position() { return position_; }
+  TokenPosition end_position() { return end_position_; }
 
  private:
-  ForInStatement() {}
+  ForInStatement()
+      : position_(TokenPosition::kNoSource),
+        end_position_(TokenPosition::kNoSource) {}
 
   Child<VariableDeclaration> variable_;
   Child<Expression> iterable_;
   Child<Statement> body_;
   bool is_async_;
+  TokenPosition position_;
+  TokenPosition end_position_;
 
   DISALLOW_COPY_AND_ASSIGN(ForInStatement);
 };
@@ -2210,7 +2150,6 @@
 class SwitchStatement : public Statement {
  public:
   static SwitchStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~SwitchStatement();
 
@@ -2235,7 +2174,6 @@
 class SwitchCase : public TreeNode {
  public:
   SwitchCase* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~SwitchCase();
 
@@ -2265,7 +2203,6 @@
 class ContinueSwitchStatement : public Statement {
  public:
   static ContinueSwitchStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~ContinueSwitchStatement();
 
@@ -2288,7 +2225,6 @@
 class IfStatement : public Statement {
  public:
   static IfStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~IfStatement();
 
@@ -2315,7 +2251,6 @@
 class ReturnStatement : public Statement {
  public:
   static ReturnStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~ReturnStatement();
 
@@ -2338,7 +2273,6 @@
 class TryCatch : public Statement {
  public:
   static TryCatch* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~TryCatch();
 
@@ -2363,7 +2297,6 @@
 class Catch : public TreeNode {
  public:
   static Catch* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~Catch();
 
@@ -2376,9 +2309,13 @@
   VariableDeclaration* exception() { return exception_; }
   VariableDeclaration* stack_trace() { return stack_trace_; }
   Statement* body() { return body_; }
+  TokenPosition position() { return position_; }
+  TokenPosition end_position() { return end_position_; }
 
  private:
-  Catch() {}
+  Catch()
+      : position_(TokenPosition::kNoSource),
+        end_position_(TokenPosition::kNoSource) {}
 
   template <typename T>
   friend class List;
@@ -2387,6 +2324,8 @@
   Child<VariableDeclaration> exception_;
   Child<VariableDeclaration> stack_trace_;
   Child<Statement> body_;
+  TokenPosition position_;
+  TokenPosition end_position_;
 
   DISALLOW_COPY_AND_ASSIGN(Catch);
 };
@@ -2395,7 +2334,6 @@
 class TryFinally : public Statement {
  public:
   static TryFinally* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~TryFinally();
 
@@ -2424,7 +2362,6 @@
     kFlagNative = 1 << 1,
   };
   static YieldStatement* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~YieldStatement();
 
@@ -2456,8 +2393,6 @@
 
   static VariableDeclaration* ReadFrom(Reader* reader);
   static VariableDeclaration* ReadFromImpl(Reader* reader);
-  virtual void WriteTo(Writer* writer);
-  void WriteToImpl(Writer* writer);
 
   virtual ~VariableDeclaration();
 
@@ -2473,9 +2408,10 @@
   DartType* type() { return type_; }
   InferredValue* inferred_value() { return inferred_value_; }
   Expression* initializer() { return initializer_; }
+  TokenPosition end_position() { return end_position_; }
 
  private:
-  VariableDeclaration() {}
+  VariableDeclaration() : end_position_(TokenPosition::kNoSource) {}
 
   template <typename T>
   friend class List;
@@ -2485,6 +2421,7 @@
   Child<DartType> type_;
   Child<InferredValue> inferred_value_;
   Child<Expression> initializer_;
+  TokenPosition end_position_;
 
   DISALLOW_COPY_AND_ASSIGN(VariableDeclaration);
 };
@@ -2493,7 +2430,6 @@
 class FunctionDeclaration : public Statement {
  public:
   static FunctionDeclaration* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer);
 
   virtual ~FunctionDeclaration();
 
@@ -2518,7 +2454,6 @@
 class Name : public Node {
  public:
   static Name* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~Name();
 
@@ -2531,7 +2466,8 @@
   Library* library() { return library_; }
 
  private:
-  Name(String* string, Library* library) : string_(string), library_(library) {}
+  Name(String* string, Library* library)
+      : string_(string), library_(library) {}  // NOLINT
 
   Ref<String> string_;
   Ref<Library> library_;
@@ -2556,7 +2492,6 @@
   };
 
   static InferredValue* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~InferredValue();
 
@@ -2597,7 +2532,6 @@
 class DartType : public Node {
  public:
   static DartType* ReadFrom(Reader* reader);
-  virtual void WriteTo(Writer* writer) = 0;
 
   virtual ~DartType();
 
@@ -2617,7 +2551,6 @@
 class InvalidType : public DartType {
  public:
   static InvalidType* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~InvalidType();
 
@@ -2636,7 +2569,6 @@
 class DynamicType : public DartType {
  public:
   static DynamicType* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~DynamicType();
 
@@ -2655,7 +2587,6 @@
 class VoidType : public DartType {
  public:
   static VoidType* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~VoidType();
 
@@ -2675,7 +2606,6 @@
  public:
   static InterfaceType* ReadFrom(Reader* reader);
   static InterfaceType* ReadFrom(Reader* reader, bool _without_type_arguments_);
-  void WriteTo(Writer* writer);
 
   explicit InterfaceType(Class* klass) : klass_(klass) {}
   virtual ~InterfaceType();
@@ -2702,7 +2632,6 @@
  public:
   static FunctionType* ReadFrom(Reader* reader);
   static FunctionType* ReadFrom(Reader* reader, bool _without_type_arguments_);
-  void WriteTo(Writer* writer);
 
   virtual ~FunctionType();
 
@@ -2735,7 +2664,6 @@
 class TypeParameterType : public DartType {
  public:
   static TypeParameterType* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~TypeParameterType();
 
@@ -2758,7 +2686,6 @@
 class TypeParameter : public TreeNode {
  public:
   TypeParameter* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~TypeParameter();
 
@@ -2787,7 +2714,6 @@
 class Program : public TreeNode {
  public:
   static Program* ReadFrom(Reader* reader);
-  void WriteTo(Writer* writer);
 
   virtual ~Program();
 
@@ -2798,7 +2724,7 @@
 
   StringTable& string_table() { return string_table_; }
   StringTable& source_uri_table() { return source_uri_table_; }
-  LineStartingTable& line_starting_table() { return line_starting_table_; }
+  SourceTable& source_table() { return source_table_; }
   List<Library>& libraries() { return libraries_; }
   Procedure* main_method() { return main_method_; }
 
@@ -2809,7 +2735,7 @@
   Ref<Procedure> main_method_;
   StringTable string_table_;
   StringTable source_uri_table_;
-  LineStartingTable line_starting_table_;
+  SourceTable source_table_;
 
   DISALLOW_COPY_AND_ASSIGN(Program);
 };
@@ -2818,17 +2744,10 @@
 class Reference : public AllStatic {
  public:
   static Member* ReadMemberFrom(Reader* reader, bool allow_null = false);
-  static void WriteMemberTo(Writer* writer,
-                            Member* member,
-                            bool allow_null = false);
 
   static Class* ReadClassFrom(Reader* reader, bool allow_null = false);
-  static void WriteClassTo(Writer* writer,
-                           Class* klass,
-                           bool allow_null = false);
 
   static String* ReadStringFrom(Reader* reader);
-  static void WriteStringTo(Writer* writer, String* string);  // NOLINT
 };
 
 
@@ -2933,9 +2852,6 @@
     VisitDefaultBasicLiteral(node);
   }
   virtual void VisitLet(Let* node) { VisitDefaultExpression(node); }
-  virtual void VisitBlockExpression(BlockExpression* node) {
-    VisitDefaultExpression(node);
-  }
 };
 
 
@@ -3249,17 +3165,6 @@
 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer,
                                                  intptr_t buffer_length);
 
-class ByteWriter {
- public:
-  virtual ~ByteWriter();
-
-  virtual void WriteByte(uint8_t byte) = 0;
-
-  virtual void WriteBytes(uint8_t* buffer, int count) = 0;
-};
-
-
-void WritePrecompiledKernel(ByteWriter* out, kernel::Program* program);
 
 
 }  // namespace dart
diff --git a/runtime/vm/kernel_binary.cc b/runtime/vm/kernel_binary.cc
index 25b8899..a90ad37 100644
--- a/runtime/vm/kernel_binary.cc
+++ b/runtime/vm/kernel_binary.cc
@@ -3,12 +3,11 @@
 // BSD-style license that can be found in the LICENSE file.
 #if !defined(DART_PRECOMPILED_RUNTIME)
 
-#include <map>
-#include <vector>
-
 #include "platform/globals.h"
 #include "vm/flags.h"
+#include "vm/growable_array.h"
 #include "vm/kernel.h"
+#include "vm/kernel_to_il.h"
 #include "vm/os.h"
 
 #if defined(DEBUG)
@@ -16,21 +15,13 @@
   do {                                                                         \
     if (FLAG_trace_kernel_binary) reader->DumpOffset(DART_PRETTY_FUNCTION);    \
   } while (0)
-#define TRACE_WRITE_OFFSET()                                                   \
-  do {                                                                         \
-    if (FLAG_trace_kernel_binary) writer->DumpOffset(DART_PRETTY_FUNCTION);    \
-  } while (0)
 #else
 #define TRACE_READ_OFFSET()
-#define TRACE_WRITE_OFFSET()
 #endif
 
 namespace dart {
 
 
-ByteWriter::~ByteWriter() {}
-
-
 namespace kernel {
 
 
@@ -94,7 +85,6 @@
   kAwaitExpression = 51,
   kFunctionExpression = 52,
   kLet = 53,
-  kBlockExpression = 54,
 
   kPositiveIntLiteral = 55,
   kNegativeIntLiteral = 56,
@@ -162,47 +152,47 @@
   BlockStack() : current_count_(0) {}
 
   void EnterScope() {
-    variable_count_.push_back(current_count_);
+    variable_count_.Add(current_count_);
     current_count_ = 0;
   }
 
   void LeaveScope() {
-    variables_.resize(variables_.size() - current_count_);
-    current_count_ = variable_count_[variable_count_.size() - 1];
-    variable_count_.pop_back();
+    variables_.TruncateTo(variables_.length() - current_count_);
+    current_count_ = variable_count_[variable_count_.length() - 1];
+    variable_count_.RemoveLast();
   }
 
   T* Lookup(int index) {
-    ASSERT(static_cast<unsigned>(index) < variables_.size());
+    ASSERT(index < variables_.length());
     return variables_[index];
   }
 
   void Push(T* v) {
-    variables_.push_back(v);
+    variables_.Add(v);
     current_count_++;
   }
 
   void Push(List<T>* decl) {
     for (int i = 0; i < decl->length(); i++) {
-      variables_.push_back(decl[i]);
+      variables_.Add(decl[i]);
       current_count_++;
     }
   }
 
   void Pop(T* decl) {
-    variables_.resize(variables_.size() - 1);
+    variables_.RemoveLast();
     current_count_--;
   }
 
   void Pop(List<T>* decl) {
-    variables_.resize(variables_.size() - decl->length());
+    variables_.TruncateTo(variables_.length() - decl->length());
     current_count_ -= decl->length();
   }
 
  private:
   int current_count_;
-  std::vector<T*> variables_;
-  std::vector<int> variable_count_;
+  MallocGrowableArray<T*> variables_;
+  MallocGrowableArray<int> variable_count_;
 };
 
 
@@ -212,29 +202,35 @@
   BlockMap() : current_count_(0), stack_height_(0) {}
 
   void EnterScope() {
-    variable_count_.push_back(current_count_);
+    variable_count_.Add(current_count_);
     current_count_ = 0;
   }
 
   void LeaveScope() {
     stack_height_ -= current_count_;
-    current_count_ = variable_count_[variable_count_.size() - 1];
-    variable_count_.pop_back();
+    current_count_ = variable_count_[variable_count_.length() - 1];
+    variable_count_.RemoveLast();
   }
 
   int Lookup(T* object) {
-    ASSERT(variables_.find(object) != variables_.end());
-    if (variables_.find(object) == variables_.end()) FATAL("lookup failure");
-    return variables_[object];
+    typename MallocMap<T, int>::Pair* result = variables_.LookupPair(object);
+    ASSERT(result != NULL);
+    if (result == NULL) FATAL("lookup failure");
+    return RawPointerKeyValueTrait<T, int>::ValueOf(*result);
   }
 
   void Push(T* v) {
+    ASSERT(variables_.LookupPair(v) == NULL);
     int index = stack_height_++;
-    variables_[v] = index;
+    variables_.Insert(v, index);
     current_count_++;
   }
 
-  void Set(T* v, int index) { variables_[v] = index; }
+  void Set(T* v, int index) {
+    typename MallocMap<T, int>::Pair* entry = variables_.LookupPair(v);
+    ASSERT(entry != NULL);
+    entry->value = index;
+  }
 
   void Push(List<T>* decl) {
     for (int i = 0; i < decl->length(); i++) {
@@ -250,8 +246,8 @@
  private:
   int current_count_;
   int stack_height_;
-  std::map<T*, int> variables_;
-  std::vector<int> variable_count_;
+  MallocMap<T, int> variables_;
+  MallocGrowableArray<int> variable_count_;
 };
 
 
@@ -373,11 +369,22 @@
     }
   }
 
+  /**
+   * Read and return a TokenPosition from this reader.
+   */
   TokenPosition ReadPosition() {
-    intptr_t value = ReadUInt();
     // Position is saved as unsigned,
     // but actually ranges from -1 and up (thus the -1)
-    return TokenPosition(value - 1);
+    intptr_t value = ReadUInt() - 1;
+    TokenPosition result = TokenPosition(value);
+    max_position_ = Utils::Maximum(max_position_, result);
+    if (min_position_.IsNoSource()) {
+      min_position_ = result;
+    } else if (result.IsReal()) {
+      min_position_ = Utils::Minimum(min_position_, result);
+    }
+
+    return result;
   }
 
   intptr_t ReadListLength() { return ReadUInt(); }
@@ -421,6 +428,22 @@
     OS::PrintErr("@%" Pd64 " %s\n", offset_, str);
   }
 
+  // The largest position read yet (since last reset).
+  // This is automatically updated when calling ReadPosition,
+  // but can be overwritten (e.g. via the PositionScope class).
+  TokenPosition max_position() { return max_position_; }
+  // The smallest position read yet (since last reset).
+  // This is automatically updated when calling ReadPosition,
+  // but can be overwritten (e.g. via the PositionScope class).
+  TokenPosition min_position() { return min_position_; }
+  // The current script id for what we are currently processing.
+  // Note though that this is only a convenience helper and has to be set
+  // manually.
+  intptr_t current_script_id() { return current_script_id_; }
+  void set_current_script_id(intptr_t script_id) {
+    current_script_id_ = script_id;
+  }
+
   template <typename T, typename RT>
   T* ReadOptional() {
     Tag tag = ReadTag();
@@ -443,185 +466,43 @@
   int64_t size_;
   int64_t offset_;
   ReaderHelper builder_;
+  TokenPosition max_position_;
+  TokenPosition min_position_;
+  intptr_t current_script_id_;
+
+  friend class PositionScope;
 };
 
 
-class WriterHelper {
+// A helper class that resets the readers min and max positions both upon
+// initialization and upon destruction, i.e. when created the min an max
+// positions will be reset to "noSource", when destructing the min and max will
+// be reset to have they value they would have had, if they hadn't been reset in
+// the first place.
+class PositionScope {
  public:
-  WriterHelper() : labels_(NULL) {}
-
-  void SetProgram(Program* program) {
-    program_ = program;
-    for (int i = 0; i < program->libraries().length(); i++) {
-      Library* lib = program->libraries()[i];
-      libraries_.Set(lib, i);
-
-      for (int j = 0; j < lib->classes().length(); j++) {
-        Class* klass = lib->classes()[j];
-        classes_.Set(klass, j);
-
-        for (int k = 0; k < klass->fields().length(); k++) {
-          Field* field = klass->fields()[k];
-          fields_.Set(field, k);
-        }
-        for (int k = 0; k < klass->constructors().length(); k++) {
-          Constructor* constructor = klass->constructors()[k];
-          constructors_.Set(constructor, k);
-        }
-        for (int k = 0; k < klass->procedures().length(); k++) {
-          Procedure* procedure = klass->procedures()[k];
-          procedures_.Set(procedure, k);
-        }
-      }
-
-      for (int k = 0; k < lib->fields().length(); k++) {
-        Field* field = lib->fields()[k];
-        fields_.Set(field, k);
-      }
-
-      for (int k = 0; k < lib->procedures().length(); k++) {
-        Procedure* procedure = lib->procedures()[k];
-        procedures_.Set(procedure, k);
-      }
-    }
+  explicit PositionScope(Reader* reader)
+      : reader_(reader),
+        min_(reader->min_position_),
+        max_(reader->max_position_) {
+    reader->min_position_ = reader->max_position_ = TokenPosition::kNoSource;
   }
 
-  Program* program() { return program_; }
-
-  BlockMap<String>& strings() { return strings_; }
-  BlockMap<Library>& libraries() { return libraries_; }
-  BlockMap<Class>& classes() { return classes_; }
-  BlockMap<Field>& fields() { return fields_; }
-  BlockMap<Procedure>& procedures() { return procedures_; }
-  BlockMap<Constructor>& constructors() { return constructors_; }
-
-  BlockMap<VariableDeclaration>& variables() { return scope_; }
-  BlockMap<TypeParameter>& type_parameters() { return type_parameters_; }
-  BlockMap<SwitchCase>& switch_cases() { return switch_cases_; }
-
-  BlockMap<LabeledStatement>* labels() { return labels_; }
-  void set_labels(BlockMap<LabeledStatement>* labels) { labels_ = labels; }
+  ~PositionScope() {
+    if (reader_->min_position_.IsNoSource()) {
+      reader_->min_position_ = min_;
+    } else if (min_.IsReal()) {
+      reader_->min_position_ = Utils::Minimum(reader_->min_position_, min_);
+    }
+    reader_->max_position_ = Utils::Maximum(reader_->max_position_, max_);
+  }
 
  private:
-  Program* program_;
-
-  BlockMap<String> strings_;
-  BlockMap<Library> libraries_;
-  BlockMap<Class> classes_;
-  BlockMap<Field> fields_;
-  BlockMap<Procedure> procedures_;
-  BlockMap<Constructor> constructors_;
-
-  BlockMap<VariableDeclaration> scope_;
-  BlockMap<TypeParameter> type_parameters_;
-  BlockMap<SwitchCase> switch_cases_;
-  BlockMap<LabeledStatement>* labels_;
+  Reader* reader_;
+  TokenPosition min_;
+  TokenPosition max_;
 };
 
-
-class Writer {
- public:
-  explicit Writer(ByteWriter* writer) : out_(writer), offset_(0) {}
-
-  void WriteUInt32(uint32_t value) {
-    uint8_t buffer[4] = {
-        static_cast<uint8_t>((value >> 24) & 0xff),
-        static_cast<uint8_t>((value >> 16) & 0xff),
-        static_cast<uint8_t>((value >> 8) & 0xff),
-        static_cast<uint8_t>((value >> 0) & 0xff),
-    };
-    WriteBytes(buffer, 4);
-  }
-
-  void WriteUInt(uint32_t value) {
-    if (value < 0x80) {
-      // 0...
-      WriteByte(static_cast<uint8_t>(value));
-    } else if (value < 0x4000) {
-      // 10...
-      WriteByte(static_cast<uint8_t>(((value >> 8) & 0x3f) | 0x80));
-      WriteByte(static_cast<uint8_t>(value & 0xff));
-    } else {
-      // 11...
-      // Ensure the highest 2 bits is not used for anything (we use it to for
-      // encoding).
-      ASSERT(static_cast<uint8_t>((value >> 24) & 0xc0) == 0);
-      uint8_t buffer[4] = {
-          static_cast<uint8_t>(((value >> 24) & 0x7f) | 0xc0),
-          static_cast<uint8_t>((value >> 16) & 0xff),
-          static_cast<uint8_t>((value >> 8) & 0xff),
-          static_cast<uint8_t>((value >> 0) & 0xff),
-      };
-      WriteBytes(buffer, 4);
-    }
-  }
-
-  void WriteListLength(intptr_t value) { return WriteUInt(value); }
-
-  void WriteByte(uint8_t value) {
-    out_->WriteByte(value);
-    offset_++;
-  }
-
-  void WriteBool(bool value) { WriteByte(value ? 1 : 0); }
-
-  void WriteFlags(uint8_t value) { WriteByte(value); }
-
-  void WriteTag(Tag tag) { WriteByte(static_cast<uint8_t>(tag)); }
-
-  void WriteTag(Tag tag, uint8_t payload) {
-    ASSERT((payload & ~kSpecializedPayloadMask) == 0);
-    WriteByte(kSpecializedTagHighBit | static_cast<uint8_t>(tag) | payload);
-  }
-
-  void WriteBytes(uint8_t* bytes, int length) {
-    out_->WriteBytes(bytes, length);
-    offset_ += length;
-  }
-
-  void WritePosition(TokenPosition position) {
-    intptr_t value = position.value() + 1;
-    WriteUInt(value);
-  }
-
-  template <typename T>
-  void WriteOptional(T* object) {
-    if (object == NULL) {
-      WriteTag(kNothing);
-    } else {
-      WriteTag(kSomething);
-      object->WriteTo(this);
-    }
-  }
-
-  template <typename T, typename WT>
-  void WriteOptionalStatic(T* object) {
-    if (object == NULL) {
-      WriteTag(kNothing);
-    } else {
-      WriteTag(kSomething);
-      WT::WriteTo(this, object);
-    }
-  }
-
-  template <typename T>
-  void WriteOptionalStatic(T* object) {
-    return WriteOptionalStatic<T, T>(object);
-  }
-
-  void DumpOffset(const char* str) {
-    OS::PrintErr("@%" Pd64 " %s\n", offset_, str);
-  }
-
-  WriterHelper* helper() { return &helper_; }
-
- private:
-  ByteWriter* out_;
-  WriterHelper helper_;
-  int64_t offset_;
-};
-
-
 template <typename T>
 template <typename IT>
 void List<T>::ReadFrom(Reader* reader, TreeNode* parent) {
@@ -663,36 +544,6 @@
   }
 }
 
-
-template <typename T>
-void List<T>::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-
-  // NOTE: We only support dense lists.
-  writer->WriteListLength(length_);
-  for (int i = 0; i < length_; i++) {
-    T* object = array_[i];
-    ASSERT(object != NULL);
-    object->WriteTo(writer);
-  }
-}
-
-
-template <typename T>
-template <typename IT>
-void List<T>::WriteToStatic(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-
-  // NOTE: We only support dense lists.
-  writer->WriteListLength(length_);
-  for (int i = 0; i < length_; i++) {
-    T* object = array_[i];
-    ASSERT(object != NULL);
-    IT::WriteTo(writer, object);
-  }
-}
-
-
 void TypeParameterList::ReadFrom(Reader* reader) {
   // It is possible for the bound of the first type parameter to refer to
   // the second type parameter. This means we need to create [TypeParameter]
@@ -713,23 +564,6 @@
 }
 
 
-void TypeParameterList::WriteTo(Writer* writer) {
-  writer->WriteListLength(length());
-
-  // Make all [TypeParameter]s available in scope.
-  for (int i = 0; i < length(); i++) {
-    TypeParameter* parameter = (*this)[i];
-    writer->helper()->type_parameters().Push(parameter);
-  }
-
-  // Write all [TypeParameter]s and their bounds.
-  for (int i = 0; i < length(); i++) {
-    TypeParameter* parameter = (*this)[i];
-    parameter->WriteTo(writer);
-  }
-}
-
-
 template <typename A, typename B>
 Tuple<A, B>* Tuple<A, B>::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
@@ -739,14 +573,6 @@
 }
 
 
-template <typename A, typename B>
-void Tuple<A, B>::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  first_->WriteTo(writer);
-  second_->WriteTo(writer);
-}
-
-
 template <typename B, typename S>
 class DowncastReader {
  public:
@@ -763,11 +589,6 @@
     TRACE_READ_OFFSET();
     return String::ReadFromImpl(reader);
   }
-
-  static void WriteTo(Writer* writer, String* string) {
-    TRACE_WRITE_OFFSET();
-    string->WriteToImpl(writer);
-  }
 };
 
 
@@ -777,11 +598,6 @@
     TRACE_READ_OFFSET();
     return VariableDeclaration::ReadFromImpl(reader);
   }
-
-  static void WriteTo(Writer* writer, VariableDeclaration* d) {
-    TRACE_WRITE_OFFSET();
-    d->WriteToImpl(writer);
-  }
 };
 
 
@@ -798,66 +614,28 @@
   return string;
 }
 
-
-void String::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  Reference::WriteStringTo(writer, this);
-}
-
-
-void String::WriteToImpl(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteUInt(size_);
-  writer->WriteBytes(buffer_, size_);
-}
-
-
 void StringTable::ReadFrom(Reader* reader) {
   strings_.ReadFromStatic<StringImpl>(reader);
 }
 
 
-void StringTable::WriteTo(Writer* writer) {
-  strings_.WriteToStatic<StringImpl>(writer);
-
-  // Build up the "String* -> index" table.
-  WriterHelper* helper = writer->helper();
-  for (int i = 0; i < strings_.length(); i++) {
-    helper->strings().Push(strings_[i]);
-  }
-}
-
-
-void LineStartingTable::ReadFrom(Reader* reader) {
+void SourceTable::ReadFrom(Reader* reader) {
   size_ = reader->helper()->program()->source_uri_table().strings().length();
-  values_ = new intptr_t*[size_];
+  source_code_ = new String*[size_];
+  line_starts_ = new intptr_t*[size_];
+  line_count_ = new intptr_t[size_];
   for (intptr_t i = 0; i < size_; ++i) {
+    source_code_[i] = StringImpl::ReadFrom(reader);
     intptr_t line_count = reader->ReadUInt();
-    intptr_t* line_starts = new intptr_t[line_count + 1];
-    line_starts[0] = line_count;
+    intptr_t* line_starts = new intptr_t[line_count];
+    line_count_[i] = line_count;
     intptr_t previous_line_start = 0;
     for (intptr_t j = 0; j < line_count; ++j) {
       intptr_t line_start = reader->ReadUInt() + previous_line_start;
-      line_starts[j + 1] = line_start;
+      line_starts[j] = line_start;
       previous_line_start = line_start;
     }
-    values_[i] = line_starts;
-  }
-}
-
-
-void LineStartingTable::WriteTo(Writer* writer) {
-  for (intptr_t i = 0; i < size_; ++i) {
-    intptr_t* line_starts = values_[i];
-    intptr_t line_count = line_starts[0];
-    writer->WriteUInt(line_count);
-
-    intptr_t previous_line_start = 0;
-    for (intptr_t j = 0; j < line_count; ++j) {
-      intptr_t line_start = line_starts[j + 1];
-      writer->WriteUInt(line_start - previous_line_start);
-      previous_line_start = line_start;
-    }
+    line_starts_[i] = line_starts;
   }
 }
 
@@ -869,6 +647,7 @@
   name_ = Reference::ReadStringFrom(reader);
   import_uri_ = Reference::ReadStringFrom(reader);
   source_uri_index_ = reader->ReadUInt();
+  reader->set_current_script_id(source_uri_index_);
 
   int num_classes = reader->ReadUInt();
   classes().EnsureInitialized(num_classes);
@@ -890,49 +669,20 @@
 }
 
 
-void Library::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  name_->WriteTo(writer);
-  import_uri_->WriteTo(writer);
-  writer->WriteUInt(source_uri_index_);
-
-  writer->WriteUInt(classes_.length());
-  for (int i = 0; i < classes_.length(); i++) {
-    Class* klass = classes_[i];
-    if (klass->IsNormalClass()) {
-      writer->WriteTag(kNormalClass);
-      NormalClass::Cast(klass)->WriteTo(writer);
-    } else {
-      writer->WriteTag(kMixinClass);
-      MixinClass::Cast(klass)->WriteTo(writer);
-    }
-  }
-  fields().WriteTo(writer);
-  procedures().WriteTo(writer);
-}
-
-
 Class* Class::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
 
+  position_ = reader->ReadPosition();
   is_abstract_ = reader->ReadBool();
   name_ = Reference::ReadStringFrom(reader);
   source_uri_index_ = reader->ReadUInt();
+  reader->set_current_script_id(source_uri_index_);
   annotations_.ReadFromStatic<Expression>(reader);
 
   return this;
 }
 
 
-void Class::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteBool(is_abstract_);
-  name_->WriteTo(writer);
-  writer->WriteUInt(source_uri_index_);
-  annotations_.WriteTo(writer);
-}
-
-
 NormalClass* NormalClass::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Class::ReadFrom(reader);
@@ -952,20 +702,6 @@
 }
 
 
-void NormalClass::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  Class::WriteTo(writer);
-  TypeParameterScope<WriterHelper> scope(writer->helper());
-
-  type_parameters().WriteTo(writer);
-  writer->WriteOptional<DartType>(super_class_);
-  implemented_classes().WriteTo(writer);
-  fields_.WriteTo(writer);
-  constructors_.WriteTo(writer);
-  procedures_.WriteTo(writer);
-}
-
-
 MixinClass* MixinClass::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   TypeParameterScope<ReaderHelper> scope(reader->helper());
@@ -981,19 +717,6 @@
 }
 
 
-void MixinClass::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  TypeParameterScope<WriterHelper> scope(writer->helper());
-
-  Class::WriteTo(writer);
-  type_parameters_.WriteTo(writer);
-  first_->WriteTo(writer);
-  second_->WriteTo(writer);
-  implemented_classes_.WriteTo(writer);
-  constructors_.WriteTo(writer);
-}
-
-
 Member* Reference::ReadMemberFrom(Reader* reader, bool allow_null) {
   TRACE_READ_OFFSET();
 
@@ -1046,56 +769,6 @@
 }
 
 
-void Reference::WriteMemberTo(Writer* writer, Member* member, bool allow_null) {
-  TRACE_WRITE_OFFSET();
-  if (member == NULL) {
-    if (allow_null) {
-      writer->WriteTag(kNullReference);
-      return;
-    } else {
-      FATAL("Expected a valid member reference but got `null`");
-    }
-  }
-  TreeNode* node = member->parent();
-
-  WriterHelper* helper = writer->helper();
-
-  if (node->IsLibrary()) {
-    Library* library = Library::Cast(node);
-    if (member->IsField()) {
-      Field* field = Field::Cast(member);
-      writer->WriteTag(kLibraryFieldReference);
-      writer->WriteUInt(helper->libraries().Lookup(library));
-      writer->WriteUInt(helper->fields().Lookup(field));
-    } else {
-      Procedure* procedure = Procedure::Cast(member);
-      writer->WriteTag(kLibraryProcedureReference);
-      writer->WriteUInt(helper->libraries().Lookup(library));
-      writer->WriteUInt(helper->procedures().Lookup(procedure));
-    }
-  } else {
-    Class* klass = Class::Cast(node);
-
-    if (member->IsField()) {
-      Field* field = Field::Cast(member);
-      writer->WriteTag(kClassFieldReference);
-      Reference::WriteClassTo(writer, klass);
-      writer->WriteUInt(helper->fields().Lookup(field));
-    } else if (member->IsConstructor()) {
-      Constructor* constructor = Constructor::Cast(member);
-      writer->WriteTag(kClassConstructorReference);
-      Reference::WriteClassTo(writer, klass);
-      writer->WriteUInt(helper->constructors().Lookup(constructor));
-    } else {
-      Procedure* procedure = Procedure::Cast(member);
-      writer->WriteTag(kClassProcedureReference);
-      Reference::WriteClassTo(writer, klass);
-      writer->WriteUInt(helper->procedures().Lookup(procedure));
-    }
-  }
-}
-
-
 Class* Reference::ReadClassFrom(Reader* reader, bool allow_null) {
   TRACE_READ_OFFSET();
   Program* program = reader->helper()->program();
@@ -1123,49 +796,23 @@
 }
 
 
-void Reference::WriteClassTo(Writer* writer, Class* klass, bool allow_null) {
-  TRACE_WRITE_OFFSET();
-  if (klass == NULL) {
-    if (allow_null) {
-      writer->WriteTag(kNullReference);
-      return;
-    } else {
-      FATAL("Expected a valid class reference but got `null`.");
-    }
-  }
-  if (klass->IsNormalClass()) {
-    writer->WriteTag(kNormalClassReference);
-  } else {
-    ASSERT(klass->IsMixinClass());
-    writer->WriteTag(kMixinClassReference);
-  }
-
-  writer->WriteUInt(writer->helper()->libraries().Lookup(klass->parent()));
-  writer->WriteUInt(writer->helper()->classes().Lookup(klass));
-}
-
-
 String* Reference::ReadStringFrom(Reader* reader) {
   int index = reader->ReadUInt();
   return reader->helper()->program()->string_table().strings()[index];
 }
 
 
-void Reference::WriteStringTo(Writer* writer, String* string) {
-  int index = writer->helper()->strings().Lookup(string);
-  writer->WriteUInt(index);
-}
-
-
 Field* Field::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Tag tag = reader->ReadTag();
   ASSERT(tag == kField);
 
   position_ = reader->ReadPosition();
+  end_position_ = reader->ReadPosition();
   flags_ = reader->ReadFlags();
   name_ = Name::ReadFrom(reader);
   source_uri_index_ = reader->ReadUInt();
+  reader->set_current_script_id(source_uri_index_);
   annotations_.ReadFromStatic<Expression>(reader);
   type_ = DartType::ReadFrom(reader);
   inferred_value_ = reader->ReadOptional<InferredValue>();
@@ -1174,26 +821,14 @@
 }
 
 
-void Field::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kField);
-  writer->WritePosition(position_);
-  writer->WriteFlags(flags_);
-  name_->WriteTo(writer);
-  writer->WriteUInt(source_uri_index_);
-  annotations_.WriteTo(writer);
-  type_->WriteTo(writer);
-  writer->WriteOptional<InferredValue>(inferred_value_);
-  writer->WriteOptional<Expression>(initializer_);
-}
-
-
 Constructor* Constructor::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Tag tag = reader->ReadTag();
   ASSERT(tag == kConstructor);
 
   VariableScope<ReaderHelper> parameters(reader->helper());
+  position_ = reader->ReadPosition();
+  end_position_ = reader->ReadPosition();
   flags_ = reader->ReadFlags();
   name_ = Name::ReadFrom(reader);
   annotations_.ReadFromStatic<Expression>(reader);
@@ -1203,49 +838,25 @@
 }
 
 
-void Constructor::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kConstructor);
-
-  VariableScope<WriterHelper> parameters(writer->helper());
-  writer->WriteFlags(flags_);
-  name_->WriteTo(writer);
-  annotations_.WriteTo(writer);
-  function_->WriteTo(writer);
-  initializers_.WriteTo(writer);
-}
-
-
 Procedure* Procedure::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Tag tag = reader->ReadTag();
   ASSERT(tag == kProcedure);
 
   VariableScope<ReaderHelper> parameters(reader->helper());
+  position_ = reader->ReadPosition();
+  end_position_ = reader->ReadPosition();
   kind_ = static_cast<ProcedureKind>(reader->ReadByte());
   flags_ = reader->ReadFlags();
   name_ = Name::ReadFrom(reader);
   source_uri_index_ = reader->ReadUInt();
+  reader->set_current_script_id(source_uri_index_);
   annotations_.ReadFromStatic<Expression>(reader);
   function_ = reader->ReadOptional<FunctionNode>();
   return this;
 }
 
 
-void Procedure::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kProcedure);
-
-  VariableScope<WriterHelper> parameters(writer->helper());
-  writer->WriteByte(kind_);
-  writer->WriteFlags(flags_);
-  name_->WriteTo(writer);
-  writer->WriteUInt(source_uri_index_);
-  annotations_.WriteTo(writer);
-  writer->WriteOptional<FunctionNode>(function_);
-}
-
-
 Initializer* Initializer::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Tag tag = reader->ReadTag();
@@ -1273,12 +884,6 @@
 }
 
 
-void InvalidInitializer::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kInvalidInitializer);
-}
-
-
 FieldInitializer* FieldInitializer::ReadFromImpl(Reader* reader) {
   TRACE_READ_OFFSET();
   FieldInitializer* initializer = new FieldInitializer();
@@ -1288,14 +893,6 @@
 }
 
 
-void FieldInitializer::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kFieldInitializer);
-  Reference::WriteMemberTo(writer, field_);
-  value_->WriteTo(writer);
-}
-
-
 SuperInitializer* SuperInitializer::ReadFromImpl(Reader* reader) {
   TRACE_READ_OFFSET();
   SuperInitializer* init = new SuperInitializer();
@@ -1305,14 +902,6 @@
 }
 
 
-void SuperInitializer::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kSuperInitializer);
-  Reference::WriteMemberTo(writer, target_);
-  arguments_->WriteTo(writer);
-}
-
-
 RedirectingInitializer* RedirectingInitializer::ReadFromImpl(Reader* reader) {
   TRACE_READ_OFFSET();
   RedirectingInitializer* init = new RedirectingInitializer();
@@ -1322,14 +911,6 @@
 }
 
 
-void RedirectingInitializer::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kRedirectingInitializer);
-  Reference::WriteMemberTo(writer, target_);
-  arguments_->WriteTo(writer);
-}
-
-
 LocalInitializer* LocalInitializer::ReadFromImpl(Reader* reader) {
   TRACE_READ_OFFSET();
   LocalInitializer* init = new LocalInitializer();
@@ -1338,13 +919,6 @@
 }
 
 
-void LocalInitializer::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kLocalInitializer);
-  variable_->WriteToImpl(writer);
-}
-
-
 Expression* Expression::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   uint8_t payload = 0;
@@ -1420,8 +994,6 @@
       return FunctionExpression::ReadFrom(reader);
     case kLet:
       return Let::ReadFrom(reader);
-    case kBlockExpression:
-      return BlockExpression::ReadFrom(reader);
     case kBigIntLiteral:
       return BigintLiteral::ReadFrom(reader);
     case kStringLiteral:
@@ -1453,15 +1025,10 @@
 }
 
 
-void InvalidExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kInvalidExpression);
-}
-
-
 VariableGet* VariableGet::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   VariableGet* get = new VariableGet();
+  get->position_ = reader->ReadPosition();
   get->variable_ = reader->helper()->variables().Lookup(reader->ReadUInt());
   reader->ReadOptional<DartType>();  // Unused promoted type.
   return get;
@@ -1471,27 +1038,16 @@
 VariableGet* VariableGet::ReadFrom(Reader* reader, uint8_t payload) {
   TRACE_READ_OFFSET();
   VariableGet* get = new VariableGet();
+  get->position_ = reader->ReadPosition();
   get->variable_ = reader->helper()->variables().Lookup(payload);
   return get;
 }
 
 
-void VariableGet::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  int index = writer->helper()->variables().Lookup(variable_);
-  if ((index & kSpecializedPayloadMask) == index) {
-    writer->WriteTag(kSpecializedVariableGet, static_cast<uint8_t>(index));
-  } else {
-    writer->WriteTag(kVariableGet);
-    writer->WriteUInt(index);
-    writer->WriteOptional<DartType>(NULL);
-  }
-}
-
-
 VariableSet* VariableSet::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   VariableSet* set = new VariableSet();
+  set->position_ = reader->ReadPosition();
   set->variable_ = reader->helper()->variables().Lookup(reader->ReadUInt());
   set->expression_ = Expression::ReadFrom(reader);
   return set;
@@ -1502,24 +1058,12 @@
   TRACE_READ_OFFSET();
   VariableSet* set = new VariableSet();
   set->variable_ = reader->helper()->variables().Lookup(payload);
+  set->position_ = reader->ReadPosition();
   set->expression_ = Expression::ReadFrom(reader);
   return set;
 }
 
 
-void VariableSet::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  int index = writer->helper()->variables().Lookup(variable_);
-  if ((index & kSpecializedPayloadMask) == index) {
-    writer->WriteTag(kSpecializedVariableSet, static_cast<uint8_t>(index));
-  } else {
-    writer->WriteTag(kVariableSet);
-    writer->WriteUInt(index);
-  }
-  expression_->WriteTo(writer);
-}
-
-
 PropertyGet* PropertyGet::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   PropertyGet* get = new PropertyGet();
@@ -1531,16 +1075,6 @@
 }
 
 
-void PropertyGet::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kPropertyGet);
-  writer->WritePosition(position_);
-  receiver_->WriteTo(writer);
-  name_->WriteTo(writer);
-  Reference::WriteMemberTo(writer, interfaceTarget_, true);
-}
-
-
 PropertySet* PropertySet::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   PropertySet* set = new PropertySet();
@@ -1553,17 +1087,6 @@
 }
 
 
-void PropertySet::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kPropertySet);
-  writer->WritePosition(position_);
-  receiver_->WriteTo(writer);
-  name_->WriteTo(writer);
-  value_->WriteTo(writer);
-  Reference::WriteMemberTo(writer, interfaceTarget_, true);
-}
-
-
 DirectPropertyGet* DirectPropertyGet::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   DirectPropertyGet* get = new DirectPropertyGet();
@@ -1573,14 +1096,6 @@
 }
 
 
-void DirectPropertyGet::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kDirectPropertyGet);
-  receiver_->WriteTo(writer);
-  Reference::WriteMemberTo(writer, target_);
-}
-
-
 DirectPropertySet* DirectPropertySet::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   DirectPropertySet* set = new DirectPropertySet();
@@ -1591,15 +1106,6 @@
 }
 
 
-void DirectPropertySet::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kDirectPropertySet);
-  receiver_->WriteTo(writer);
-  Reference::WriteMemberTo(writer, target_);
-  value_->WriteTo(writer);
-}
-
-
 StaticGet* StaticGet::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   StaticGet* get = new StaticGet();
@@ -1609,14 +1115,6 @@
 }
 
 
-void StaticGet::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kStaticGet);
-  writer->WritePosition(position_);
-  Reference::WriteMemberTo(writer, target_);
-}
-
-
 StaticSet* StaticSet::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   StaticSet* set = new StaticSet();
@@ -1626,14 +1124,6 @@
 }
 
 
-void StaticSet::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kStaticSet);
-  Reference::WriteMemberTo(writer, target_);
-  expression_->WriteTo(writer);
-}
-
-
 Arguments* Arguments::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Arguments* arguments = new Arguments();
@@ -1644,14 +1134,6 @@
 }
 
 
-void Arguments::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  types().WriteTo(writer);
-  positional().WriteTo(writer);
-  named().WriteTo(writer);
-}
-
-
 NamedExpression* NamedExpression::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   String* name = Reference::ReadStringFrom(reader);
@@ -1660,13 +1142,6 @@
 }
 
 
-void NamedExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  name_->WriteTo(writer);
-  expression_->WriteTo(writer);
-}
-
-
 MethodInvocation* MethodInvocation::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   MethodInvocation* invocation = new MethodInvocation();
@@ -1679,17 +1154,6 @@
 }
 
 
-void MethodInvocation::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kMethodInvocation);
-  writer->WritePosition(position_);
-  receiver_->WriteTo(writer);
-  name_->WriteTo(writer);
-  arguments_->WriteTo(writer);
-  Reference::WriteMemberTo(writer, interfaceTarget_, true);
-}
-
-
 DirectMethodInvocation* DirectMethodInvocation::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   DirectMethodInvocation* invocation = new DirectMethodInvocation();
@@ -1700,15 +1164,6 @@
 }
 
 
-void DirectMethodInvocation::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kDirectMethodInvocation);
-  receiver_->WriteTo(writer);
-  Reference::WriteMemberTo(writer, target_);
-  arguments_->WriteTo(writer);
-}
-
-
 StaticInvocation* StaticInvocation::ReadFrom(Reader* reader, bool is_const) {
   TRACE_READ_OFFSET();
   StaticInvocation* invocation = new StaticInvocation();
@@ -1720,15 +1175,6 @@
 }
 
 
-void StaticInvocation::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(is_const_ ? kConstStaticInvocation : kStaticInvocation);
-  writer->WritePosition(position_);
-  Reference::WriteMemberTo(writer, procedure_);
-  arguments_->WriteTo(writer);
-}
-
-
 ConstructorInvocation* ConstructorInvocation::ReadFrom(Reader* reader,
                                                        bool is_const) {
   TRACE_READ_OFFSET();
@@ -1741,16 +1187,6 @@
 }
 
 
-void ConstructorInvocation::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(is_const_ ? kConstConstructorInvocation
-                             : kConstructorInvocation);
-  writer->WritePosition(position_);
-  Reference::WriteMemberTo(writer, target_);
-  arguments_->WriteTo(writer);
-}
-
-
 Not* Not::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Not* n = new Not();
@@ -1759,13 +1195,6 @@
 }
 
 
-void Not::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kNot);
-  expression_->WriteTo(writer);
-}
-
-
 LogicalExpression* LogicalExpression::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   LogicalExpression* expr = new LogicalExpression();
@@ -1776,15 +1205,6 @@
 }
 
 
-void LogicalExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kLogicalExpression);
-  left_->WriteTo(writer);
-  writer->WriteByte(operator_);
-  right_->WriteTo(writer);
-}
-
-
 ConditionalExpression* ConditionalExpression::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   ConditionalExpression* expr = new ConditionalExpression();
@@ -1796,48 +1216,25 @@
 }
 
 
-void ConditionalExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kConditionalExpression);
-  condition_->WriteTo(writer);
-  then_->WriteTo(writer);
-  otherwise_->WriteTo(writer);
-  writer->WriteOptional<DartType>(NULL);  // Unused static type.
-}
-
-
 StringConcatenation* StringConcatenation::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   StringConcatenation* concat = new StringConcatenation();
+  concat->position_ = reader->ReadPosition();
   concat->expressions_.ReadFromStatic<Expression>(reader);
   return concat;
 }
 
 
-void StringConcatenation::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kStringConcatenation);
-  expressions_.WriteTo(writer);
-}
-
-
 IsExpression* IsExpression::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   IsExpression* expr = new IsExpression();
+  expr->position_ = reader->ReadPosition();
   expr->operand_ = Expression::ReadFrom(reader);
   expr->type_ = DartType::ReadFrom(reader);
   return expr;
 }
 
 
-void IsExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kIsExpression);
-  operand_->WriteTo(writer);
-  type_->WriteTo(writer);
-}
-
-
 AsExpression* AsExpression::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   AsExpression* expr = new AsExpression();
@@ -1847,40 +1244,18 @@
 }
 
 
-void AsExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kAsExpression);
-  operand_->WriteTo(writer);
-  type_->WriteTo(writer);
-}
-
-
 StringLiteral* StringLiteral::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   return new StringLiteral(Reference::ReadStringFrom(reader));
 }
 
 
-void StringLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kStringLiteral);
-  value_->WriteTo(writer);
-}
-
-
 BigintLiteral* BigintLiteral::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   return new BigintLiteral(Reference::ReadStringFrom(reader));
 }
 
 
-void BigintLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kBigIntLiteral);
-  value_->WriteTo(writer);
-}
-
-
 IntLiteral* IntLiteral::ReadFrom(Reader* reader, bool is_negative) {
   TRACE_READ_OFFSET();
   IntLiteral* literal = new IntLiteral();
@@ -1898,18 +1273,6 @@
 }
 
 
-void IntLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  int64_t payload = value_ + SpecializedIntLiteralBias;
-  if ((payload & kSpecializedPayloadMask) == payload) {
-    writer->WriteTag(kSpecialIntLiteral, static_cast<uint8_t>(payload));
-  } else {
-    writer->WriteTag(value_ < 0 ? kNegativeIntLiteral : kPositiveIntLiteral);
-    writer->WriteUInt(static_cast<uint32_t>(value_ < 0 ? -value_ : value_));
-  }
-}
-
-
 DoubleLiteral* DoubleLiteral::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   DoubleLiteral* literal = new DoubleLiteral();
@@ -1918,13 +1281,6 @@
 }
 
 
-void DoubleLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kDoubleLiteral);
-  value_->WriteTo(writer);
-}
-
-
 BoolLiteral* BoolLiteral::ReadFrom(Reader* reader, bool value) {
   TRACE_READ_OFFSET();
   BoolLiteral* lit = new BoolLiteral();
@@ -1933,24 +1289,12 @@
 }
 
 
-void BoolLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(value_ ? kTrueLiteral : kFalseLiteral);
-}
-
-
 NullLiteral* NullLiteral::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   return new NullLiteral();
 }
 
 
-void NullLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kNullLiteral);
-}
-
-
 SymbolLiteral* SymbolLiteral::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   SymbolLiteral* lit = new SymbolLiteral();
@@ -1959,13 +1303,6 @@
 }
 
 
-void SymbolLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kSymbolLiteral);
-  value_->WriteTo(writer);
-}
-
-
 TypeLiteral* TypeLiteral::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   TypeLiteral* literal = new TypeLiteral();
@@ -1974,37 +1311,18 @@
 }
 
 
-void TypeLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kTypeLiteral);
-  type_->WriteTo(writer);
-}
-
-
 ThisExpression* ThisExpression::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   return new ThisExpression();
 }
 
 
-void ThisExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kThisExpression);
-}
-
-
 Rethrow* Rethrow::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   return new Rethrow();
 }
 
 
-void Rethrow::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kRethrow);
-}
-
-
 Throw* Throw::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Throw* t = new Throw();
@@ -2014,14 +1332,6 @@
 }
 
 
-void Throw::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kThrow);
-  writer->WritePosition(position_);
-  expression_->WriteTo(writer);
-}
-
-
 ListLiteral* ListLiteral::ReadFrom(Reader* reader, bool is_const) {
   TRACE_READ_OFFSET();
   ListLiteral* literal = new ListLiteral();
@@ -2032,18 +1342,11 @@
 }
 
 
-void ListLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(is_const_ ? kConstListLiteral : kListLiteral);
-  type_->WriteTo(writer);
-  expressions_.WriteTo(writer);
-}
-
-
 MapLiteral* MapLiteral::ReadFrom(Reader* reader, bool is_const) {
   TRACE_READ_OFFSET();
   MapLiteral* literal = new MapLiteral();
   literal->is_const_ = is_const;
+  literal->position_ = reader->ReadPosition();
   literal->key_type_ = DartType::ReadFrom(reader);
   literal->value_type_ = DartType::ReadFrom(reader);
   literal->entries_.ReadFromStatic<MapEntry>(reader);
@@ -2051,15 +1354,6 @@
 }
 
 
-void MapLiteral::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(is_const_ ? kConstMapLiteral : kMapLiteral);
-  key_type_->WriteTo(writer);
-  value_type_->WriteTo(writer);
-  entries_.WriteTo(writer);
-}
-
-
 MapEntry* MapEntry::ReadFrom(Reader* reader) {
   MapEntry* entry = new MapEntry();
   entry->key_ = Expression::ReadFrom(reader);
@@ -2068,13 +1362,6 @@
 }
 
 
-void MapEntry::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  key_->WriteTo(writer);
-  value_->WriteTo(writer);
-}
-
-
 AwaitExpression* AwaitExpression::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   AwaitExpression* await = new AwaitExpression();
@@ -2083,13 +1370,6 @@
 }
 
 
-void AwaitExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kAwaitExpression);
-  operand_->WriteTo(writer);
-}
-
-
 FunctionExpression* FunctionExpression::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   VariableScope<ReaderHelper> parameters(reader->helper());
@@ -2099,50 +1379,21 @@
 }
 
 
-void FunctionExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  VariableScope<WriterHelper> parameters(writer->helper());
-  writer->WriteTag(kFunctionExpression);
-  function_->WriteTo(writer);
-}
-
-
 Let* Let::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   VariableScope<ReaderHelper> vars(reader->helper());
+  PositionScope scope(reader);
+
   Let* let = new Let();
   let->variable_ = VariableDeclaration::ReadFromImpl(reader);
   let->body_ = Expression::ReadFrom(reader);
+  let->position_ = reader->min_position();
+  let->end_position_ = reader->max_position();
+
   return let;
 }
 
 
-void Let::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  VariableScope<WriterHelper> vars(writer->helper());
-  writer->WriteTag(kLet);
-  variable_->WriteToImpl(writer);
-  body_->WriteTo(writer);
-}
-
-
-BlockExpression* BlockExpression::ReadFrom(Reader* reader) {
-  TRACE_READ_OFFSET();
-  BlockExpression* be = new BlockExpression();
-  be->body_ = Block::ReadFromImpl(reader);
-  be->value_ = Expression::ReadFrom(reader);
-  return be;
-}
-
-
-void BlockExpression::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kBlockExpression);
-  body_->WriteToImpl(writer);
-  value_->WriteTo(writer);
-}
-
-
 Statement* Statement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Tag tag = reader->ReadTag();
@@ -2202,59 +1453,32 @@
 }
 
 
-void InvalidStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kInvalidStatement);
-}
-
-
 ExpressionStatement* ExpressionStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   return new ExpressionStatement(Expression::ReadFrom(reader));
 }
 
 
-void ExpressionStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kExpressionStatement);
-  expression_->WriteTo(writer);
-}
-
-
 Block* Block::ReadFromImpl(Reader* reader) {
   TRACE_READ_OFFSET();
+  PositionScope scope(reader);
+
   VariableScope<ReaderHelper> vars(reader->helper());
   Block* block = new Block();
   block->statements().ReadFromStatic<Statement>(reader);
+  block->position_ = reader->min_position();
+  block->end_position_ = reader->max_position();
+
   return block;
 }
 
 
-void Block::WriteTo(Writer* writer) {
-  writer->WriteTag(kBlock);
-  WriteToImpl(writer);
-}
-
-
-void Block::WriteToImpl(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  VariableScope<WriterHelper> vars(writer->helper());
-  statements_.WriteTo(writer);
-}
-
-
 EmptyStatement* EmptyStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   return new EmptyStatement();
 }
 
 
-void EmptyStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kEmptyStatement);
-}
-
-
 AssertStatement* AssertStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   AssertStatement* stmt = new AssertStatement();
@@ -2264,14 +1488,6 @@
 }
 
 
-void AssertStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kAssertStatement);
-  condition_->WriteTo(writer);
-  writer->WriteOptional<Expression>(message_);
-}
-
-
 LabeledStatement* LabeledStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   LabeledStatement* stmt = new LabeledStatement();
@@ -2282,15 +1498,6 @@
 }
 
 
-void LabeledStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kLabeledStatement);
-  writer->helper()->labels()->Push(this);
-  body_->WriteTo(writer);
-  writer->helper()->labels()->Pop(this);
-}
-
-
 BreakStatement* BreakStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   BreakStatement* stmt = new BreakStatement();
@@ -2299,13 +1506,6 @@
 }
 
 
-void BreakStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kBreakStatement);
-  writer->WriteUInt(writer->helper()->labels()->Lookup(target_));
-}
-
-
 WhileStatement* WhileStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   WhileStatement* stmt = new WhileStatement();
@@ -2315,14 +1515,6 @@
 }
 
 
-void WhileStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kWhileStatement);
-  condition_->WriteTo(writer);
-  body_->WriteTo(writer);
-}
-
-
 DoStatement* DoStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   DoStatement* dostmt = new DoStatement();
@@ -2332,59 +1524,40 @@
 }
 
 
-void DoStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kDoStatement);
-  body_->WriteTo(writer);
-  condition_->WriteTo(writer);
-}
-
-
 ForStatement* ForStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   VariableScope<ReaderHelper> vars(reader->helper());
+  PositionScope scope(reader);
+
   ForStatement* forstmt = new ForStatement();
   forstmt->variables_.ReadFromStatic<VariableDeclarationImpl>(reader);
   forstmt->condition_ = reader->ReadOptional<Expression>();
   forstmt->updates_.ReadFromStatic<Expression>(reader);
   forstmt->body_ = Statement::ReadFrom(reader);
+  forstmt->end_position_ = reader->max_position();
+  forstmt->position_ = reader->min_position();
+
   return forstmt;
 }
 
 
-void ForStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kForStatement);
-  VariableScope<WriterHelper> vars(writer->helper());
-  variables_.WriteToStatic<VariableDeclarationImpl>(writer);
-  writer->WriteOptional<Expression>(condition_);
-  updates_.WriteTo(writer);
-  body_->WriteTo(writer);
-}
-
-
 ForInStatement* ForInStatement::ReadFrom(Reader* reader, bool is_async) {
   TRACE_READ_OFFSET();
   VariableScope<ReaderHelper> vars(reader->helper());
+  PositionScope scope(reader);
+
   ForInStatement* forinstmt = new ForInStatement();
   forinstmt->is_async_ = is_async;
   forinstmt->variable_ = VariableDeclaration::ReadFromImpl(reader);
   forinstmt->iterable_ = Expression::ReadFrom(reader);
   forinstmt->body_ = Statement::ReadFrom(reader);
+  forinstmt->end_position_ = reader->max_position();
+  forinstmt->position_ = reader->min_position();
+
   return forinstmt;
 }
 
 
-void ForInStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(is_async_ ? kAsyncForInStatement : kForInStatement);
-  VariableScope<WriterHelper> vars(writer->helper());
-  variable_->WriteToImpl(writer);
-  iterable_->WriteTo(writer);
-  body_->WriteTo(writer);
-}
-
-
 SwitchStatement* SwitchStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   SwitchCaseScope<ReaderHelper> scope(reader->helper());
@@ -2406,18 +1579,6 @@
 }
 
 
-void SwitchStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  SwitchCaseScope<WriterHelper> scope(writer->helper());
-  writer->WriteTag(kSwitchStatement);
-  condition_->WriteTo(writer);
-  for (int i = 0; i < cases_.length(); i++) {
-    writer->helper()->switch_cases().Push(cases_[i]);
-  }
-  cases_.WriteTo(writer);
-}
-
-
 SwitchCase* SwitchCase::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   expressions_.ReadFromStatic<Expression>(reader);
@@ -2427,14 +1588,6 @@
 }
 
 
-void SwitchCase::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  expressions_.WriteTo(writer);
-  writer->WriteBool(is_default_);
-  body_->WriteTo(writer);
-}
-
-
 ContinueSwitchStatement* ContinueSwitchStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   ContinueSwitchStatement* stmt = new ContinueSwitchStatement();
@@ -2443,13 +1596,6 @@
 }
 
 
-void ContinueSwitchStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kContinueSwitchStatement);
-  writer->WriteUInt(writer->helper()->switch_cases().Lookup(target_));
-}
-
-
 IfStatement* IfStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   IfStatement* ifstmt = new IfStatement();
@@ -2460,50 +1606,33 @@
 }
 
 
-void IfStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kIfStatement);
-  condition_->WriteTo(writer);
-  then_->WriteTo(writer);
-  otherwise_->WriteTo(writer);
-}
-
-
 ReturnStatement* ReturnStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   ReturnStatement* ret = new ReturnStatement();
+  ret->position_ = reader->ReadPosition();
   ret->expression_ = reader->ReadOptional<Expression>();
   return ret;
 }
 
 
-void ReturnStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kReturnStatement);
-  writer->WriteOptional<Expression>(expression_);
-}
-
-
 TryCatch* TryCatch::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
+  PositionScope scope(reader);
+
   TryCatch* tc = new TryCatch();
   tc->body_ = Statement::ReadFrom(reader);
   tc->catches_.ReadFromStatic<Catch>(reader);
+  tc->position_ = reader->min_position();
+
   return tc;
 }
 
 
-void TryCatch::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kTryCatch);
-  body_->WriteTo(writer);
-  catches_.WriteTo(writer);
-}
-
-
 Catch* Catch::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   VariableScope<ReaderHelper> vars(reader->helper());
+  PositionScope scope(reader);
+
   Catch* c = new Catch();
   c->guard_ = DartType::ReadFrom(reader);
   c->exception_ =
@@ -2511,22 +1640,13 @@
   c->stack_trace_ =
       reader->ReadOptional<VariableDeclaration, VariableDeclarationImpl>();
   c->body_ = Statement::ReadFrom(reader);
+  c->end_position_ = reader->max_position();
+  c->position_ = reader->min_position();
+
   return c;
 }
 
 
-void Catch::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  VariableScope<WriterHelper> vars(writer->helper());
-  guard_->WriteTo(writer);
-  writer->WriteOptionalStatic<VariableDeclaration, VariableDeclarationImpl>(
-      exception_);
-  writer->WriteOptionalStatic<VariableDeclaration, VariableDeclarationImpl>(
-      stack_trace_);
-  body_->WriteTo(writer);
-}
-
-
 TryFinally* TryFinally::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   TryFinally* tf = new TryFinally();
@@ -2536,31 +1656,16 @@
 }
 
 
-void TryFinally::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kTryFinally);
-  body_->WriteTo(writer);
-  finalizer_->WriteTo(writer);
-}
-
-
 YieldStatement* YieldStatement::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   YieldStatement* stmt = new YieldStatement();
+  stmt->position_ = reader->ReadPosition();
   stmt->flags_ = reader->ReadByte();
   stmt->expression_ = Expression::ReadFrom(reader);
   return stmt;
 }
 
 
-void YieldStatement::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kYieldStatement);
-  writer->WriteByte(flags_);
-  expression_->WriteTo(writer);
-}
-
-
 VariableDeclaration* VariableDeclaration::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Tag tag = reader->ReadTag();
@@ -2571,38 +1676,31 @@
 
 VariableDeclaration* VariableDeclaration::ReadFromImpl(Reader* reader) {
   TRACE_READ_OFFSET();
+  PositionScope scope(reader);
+
   VariableDeclaration* decl = new VariableDeclaration();
+  decl->position_ = reader->ReadPosition();
   decl->flags_ = reader->ReadFlags();
   decl->name_ = Reference::ReadStringFrom(reader);
   decl->type_ = DartType::ReadFrom(reader);
   decl->inferred_value_ = reader->ReadOptional<InferredValue>();
   decl->initializer_ = reader->ReadOptional<Expression>();
+
+  // Go to next token position so it ends *after* the last potentially
+  // debuggable position in the initializer.
+  TokenPosition position = reader->max_position();
+  if (position.IsReal()) position.Next();
+  decl->end_position_ = position;
   reader->helper()->variables().Push(decl);
+
   return decl;
 }
 
 
-void VariableDeclaration::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kVariableDeclaration);
-  WriteToImpl(writer);
-}
-
-
-void VariableDeclaration::WriteToImpl(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteFlags(flags_);
-  name_->WriteTo(writer);
-  type_->WriteTo(writer);
-  writer->WriteOptional<InferredValue>(inferred_value_);
-  writer->WriteOptional<Expression>(initializer_);
-  writer->helper()->variables().Push(this);
-}
-
-
 FunctionDeclaration* FunctionDeclaration::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   FunctionDeclaration* decl = new FunctionDeclaration();
+  decl->position_ = reader->ReadPosition();
   decl->variable_ = VariableDeclaration::ReadFromImpl(reader);
   VariableScope<ReaderHelper> parameters(reader->helper());
   decl->function_ = FunctionNode::ReadFrom(reader);
@@ -2610,15 +1708,6 @@
 }
 
 
-void FunctionDeclaration::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kFunctionDeclaration);
-  variable_->WriteToImpl(writer);
-  VariableScope<WriterHelper> parameters(writer->helper());
-  function_->WriteTo(writer);
-}
-
-
 Name* Name::ReadFrom(Reader* reader) {
   String* string = Reference::ReadStringFrom(reader);
   if (string->size() >= 1 && string->buffer()[0] == '_') {
@@ -2633,17 +1722,6 @@
 }
 
 
-void Name::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  string_->WriteTo(writer);
-  Library* library = library_;
-  bool is_private = library != NULL;
-  if (is_private) {
-    writer->WriteUInt(writer->helper()->libraries().Lookup(library_));
-  }
-}
-
-
 InferredValue* InferredValue::ReadFrom(Reader* reader) {
   InferredValue* type = new InferredValue();
   type->klass_ = Reference::ReadClassFrom(reader, true);
@@ -2653,13 +1731,6 @@
 }
 
 
-void InferredValue::WriteTo(Writer* writer) {
-  Reference::WriteClassTo(writer, klass_, true);
-  writer->WriteByte(static_cast<uint8_t>(kind_));
-  writer->WriteByte(value_bits_);
-}
-
-
 DartType* DartType::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Tag tag = reader->ReadTag();
@@ -2694,36 +1765,18 @@
 }
 
 
-void InvalidType::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kInvalidType);
-}
-
-
 DynamicType* DynamicType::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   return new DynamicType();
 }
 
 
-void DynamicType::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kDynamicType);
-}
-
-
 VoidType* VoidType::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   return new VoidType();
 }
 
 
-void VoidType::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kVoidType);
-}
-
-
 InterfaceType* InterfaceType::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   Class* klass = Reference::ReadClassFrom(reader);
@@ -2743,19 +1796,6 @@
 }
 
 
-void InterfaceType::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  if (type_arguments_.length() == 0) {
-    writer->WriteTag(kSimpleInterfaceType);
-    Reference::WriteClassTo(writer, klass_);
-  } else {
-    writer->WriteTag(kInterfaceType);
-    Reference::WriteClassTo(writer, klass_);
-    type_arguments_.WriteTo(writer);
-  }
-}
-
-
 FunctionType* FunctionType::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   FunctionType* type = new FunctionType();
@@ -2780,28 +1820,6 @@
 }
 
 
-void FunctionType::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-
-  bool is_simple =
-      positional_parameters_.length() == required_parameter_count_ &&
-      type_parameters_.length() == 0 && named_parameters_.length() == 0;
-  if (is_simple) {
-    writer->WriteTag(kSimpleFunctionType);
-    positional_parameters_.WriteTo(writer);
-    return_type_->WriteTo(writer);
-  } else {
-    TypeParameterScope<WriterHelper> scope(writer->helper());
-    writer->WriteTag(kFunctionType);
-    type_parameters_.WriteTo(writer);
-    writer->WriteUInt(required_parameter_count_);
-    positional_parameters_.WriteTo(writer);
-    named_parameters_.WriteTo(writer);
-    return_type_->WriteTo(writer);
-  }
-}
-
-
 TypeParameterType* TypeParameterType::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   TypeParameterType* type = new TypeParameterType();
@@ -2811,13 +1829,6 @@
 }
 
 
-void TypeParameterType::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  writer->WriteTag(kTypeParameterType);
-  writer->WriteUInt(writer->helper()->type_parameters().Lookup(parameter_));
-}
-
-
 Program* Program::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   uint32_t magic = reader->ReadUInt32();
@@ -2828,7 +1839,7 @@
 
   program->string_table_.ReadFrom(reader);
   program->source_uri_table_.ReadFrom(reader);
-  program->line_starting_table_.ReadFrom(reader);
+  program->source_table_.ReadFrom(reader);
 
   int libraries = reader->ReadUInt();
   program->libraries().EnsureInitialized(libraries);
@@ -2842,31 +1853,16 @@
 }
 
 
-void Program::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-
-  writer->helper()->SetProgram(this);
-
-  writer->WriteUInt32(kMagicProgramFile);
-
-  // NOTE: Currently we don't GC strings and we require that all referenced
-  // strings in nodes are present in [string_table_].
-  string_table_.WriteTo(writer);
-  source_uri_table_.WriteTo(writer);
-  line_starting_table_.WriteTo(writer);
-
-  libraries_.WriteTo(writer);
-  Reference::WriteMemberTo(writer, main_method_);
-}
-
-
 FunctionNode* FunctionNode::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   TypeParameterScope<ReaderHelper> scope(reader->helper());
 
   FunctionNode* function = new FunctionNode();
+  function->position_ = reader->ReadPosition();
+  function->end_position_ = reader->ReadPosition();
   function->async_marker_ =
       static_cast<FunctionNode::AsyncMarker>(reader->ReadByte());
+  function->debuggable_ = reader->ReadByte() == 1 ? true : false;
   function->type_parameters().ReadFrom(reader);
   function->required_parameter_count_ = reader->ReadUInt();
   function->positional_parameters().ReadFromStatic<VariableDeclarationImpl>(
@@ -2883,25 +1879,6 @@
 }
 
 
-void FunctionNode::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  TypeParameterScope<WriterHelper> scope(writer->helper());
-
-  writer->WriteByte(static_cast<uint8_t>(async_marker_));
-  type_parameters().WriteTo(writer);
-  writer->WriteUInt(required_parameter_count());
-  positional_parameters().WriteToStatic<VariableDeclarationImpl>(writer);
-  named_parameters().WriteToStatic<VariableDeclarationImpl>(writer);
-  return_type_->WriteTo(writer);
-  writer->WriteOptional<InferredValue>(inferred_return_value_);
-
-  LabelScope<WriterHelper, BlockMap<LabeledStatement> > labels(
-      writer->helper());
-  VariableScope<WriterHelper> vars(writer->helper());
-  writer->WriteOptional<Statement>(body_);
-}
-
-
 TypeParameter* TypeParameter::ReadFrom(Reader* reader) {
   TRACE_READ_OFFSET();
   name_ = Reference::ReadStringFrom(reader);
@@ -2910,13 +1887,6 @@
 }
 
 
-void TypeParameter::WriteTo(Writer* writer) {
-  TRACE_WRITE_OFFSET();
-  name_->WriteTo(writer);
-  bound_->WriteTo(writer);
-}
-
-
 }  // namespace kernel
 
 
@@ -2927,13 +1897,5 @@
 }
 
 
-void WritePrecompiledKernel(ByteWriter* byte_writer, kernel::Program* program) {
-  ASSERT(byte_writer != NULL);
-
-  kernel::Writer writer(byte_writer);
-  program->WriteTo(&writer);
-}
-
-
 }  // namespace dart
 #endif  // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc
new file mode 100644
index 0000000..8d682ab
--- /dev/null
+++ b/runtime/vm/kernel_isolate.cc
@@ -0,0 +1,266 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "vm/kernel_isolate.h"
+
+#include "vm/compiler.h"
+#include "vm/dart_api_impl.h"
+#include "vm/dart_entry.h"
+#include "vm/isolate.h"
+#include "vm/lockers.h"
+#include "vm/message.h"
+#include "vm/message_handler.h"
+#include "vm/native_entry.h"
+#include "vm/native_arguments.h"
+#include "vm/object.h"
+#include "vm/object_store.h"
+#include "vm/port.h"
+#include "vm/service.h"
+#include "vm/symbols.h"
+#include "vm/thread_pool.h"
+#include "vm/timeline.h"
+
+namespace dart {
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
+#define Z (T->zone())
+
+DEFINE_FLAG(bool, trace_kernel, false, "Trace Kernel service requests.");
+DEFINE_FLAG(bool,
+            use_dart_frontend,
+            false,
+            "Parse scripts with Dart-to-Kernel parser");
+
+const char* KernelIsolate::kName = "kernel-service";
+Dart_IsolateCreateCallback KernelIsolate::create_callback_ = NULL;
+Monitor* KernelIsolate::monitor_ = new Monitor();
+Isolate* KernelIsolate::isolate_ = NULL;
+bool KernelIsolate::initializing_ = true;
+Dart_Port KernelIsolate::kernel_port_ = ILLEGAL_PORT;
+
+
+class RunKernelTask : public ThreadPool::Task {
+ public:
+  virtual void Run() {
+    ASSERT(Isolate::Current() == NULL);
+
+    if (!FLAG_use_dart_frontend) {
+      ASSERT(FLAG_use_dart_frontend);
+      // In release builds, make this a no-op. In debug builds, the
+      // assert shows that this is not supposed to happen.
+      return;
+    }
+
+#ifndef PRODUCT
+    TimelineDurationScope tds(Timeline::GetVMStream(), "KernelIsolateStartup");
+#endif  // !PRODUCT
+    char* error = NULL;
+    Isolate* isolate = NULL;
+
+    Dart_IsolateCreateCallback create_callback =
+        KernelIsolate::create_callback();
+
+    if (create_callback == NULL) {
+      KernelIsolate::FinishedInitializing();
+      return;
+    }
+
+    Dart_IsolateFlags api_flags;
+    Isolate::FlagsInitialize(&api_flags);
+
+    isolate = reinterpret_cast<Isolate*>(create_callback(
+        KernelIsolate::kName, NULL, NULL, NULL, &api_flags, NULL, &error));
+    if (isolate == NULL) {
+      if (FLAG_trace_kernel) {
+        OS::PrintErr("kernel-service: Isolate creation error: %s\n", error);
+      }
+      KernelIsolate::SetKernelIsolate(NULL);
+      KernelIsolate::FinishedInitializing();
+      return;
+    }
+
+    bool init_success = false;
+    {
+      ASSERT(Isolate::Current() == NULL);
+      StartIsolateScope start_scope(isolate);
+      init_success = RunMain(isolate);
+    }
+    KernelIsolate::FinishedInitializing();
+
+    if (!init_success) {
+      ShutdownIsolate(reinterpret_cast<uword>(isolate));
+      return;
+    }
+
+    // isolate_ was set as side effect of create callback.
+    ASSERT(KernelIsolate::IsKernelIsolate(isolate));
+
+    isolate->message_handler()->Run(Dart::thread_pool(), NULL, ShutdownIsolate,
+                                    reinterpret_cast<uword>(isolate));
+  }
+
+ protected:
+  static void ShutdownIsolate(uword parameter) {
+    if (FLAG_trace_kernel) {
+      OS::Print("kernel-service: ShutdownIsolate\n");
+    }
+    Isolate* I = reinterpret_cast<Isolate*>(parameter);
+    ASSERT(KernelIsolate::IsKernelIsolate(I));
+    KernelIsolate::SetKernelIsolate(NULL);
+    KernelIsolate::SetLoadPort(ILLEGAL_PORT);
+    I->WaitForOutstandingSpawns();
+    {
+      // Print the error if there is one.  This may execute dart code to
+      // print the exception object, so we need to use a StartIsolateScope.
+      ASSERT(Isolate::Current() == NULL);
+      StartIsolateScope start_scope(I);
+      Thread* T = Thread::Current();
+      ASSERT(I == T->isolate());
+      StackZone zone(T);
+      HandleScope handle_scope(T);
+      Error& error = Error::Handle(Z);
+      error = T->sticky_error();
+      if (!error.IsNull() && !error.IsUnwindError()) {
+        OS::PrintErr("kernel-service: Error: %s\n", error.ToErrorCString());
+      }
+      error = I->sticky_error();
+      if (!error.IsNull() && !error.IsUnwindError()) {
+        OS::PrintErr("kernel-service: Error: %s\n", error.ToErrorCString());
+      }
+      Dart::RunShutdownCallback();
+    }
+    // Shut the isolate down.
+    Dart::ShutdownIsolate(I);
+    if (FLAG_trace_kernel) {
+      OS::Print("kernel-service: Shutdown.\n");
+    }
+  }
+
+  bool RunMain(Isolate* I) {
+    Thread* T = Thread::Current();
+    ASSERT(I == T->isolate());
+    StackZone zone(T);
+    HANDLESCOPE(T);
+    // Invoke main which will return the port to which load requests are sent.
+    const Library& root_library =
+        Library::Handle(Z, I->object_store()->root_library());
+    if (root_library.IsNull()) {
+      if (FLAG_trace_kernel) {
+        OS::Print("kernel-service: Embedder did not install a script.");
+      }
+      // Kernel isolate is not supported by embedder.
+      return false;
+    }
+    ASSERT(!root_library.IsNull());
+    const String& entry_name = String::Handle(Z, String::New("main"));
+    ASSERT(!entry_name.IsNull());
+    const Function& entry = Function::Handle(
+        Z, root_library.LookupFunctionAllowPrivate(entry_name));
+    if (entry.IsNull()) {
+      // Kernel isolate is not supported by embedder.
+      if (FLAG_trace_kernel) {
+        OS::Print("kernel-service: Embedder did not provide a main function.");
+      }
+      return false;
+    }
+    ASSERT(!entry.IsNull());
+    const Object& result = Object::Handle(
+        Z, DartEntry::InvokeFunction(entry, Object::empty_array()));
+    ASSERT(!result.IsNull());
+    if (result.IsError()) {
+      // Kernel isolate did not initialize properly.
+      if (FLAG_trace_kernel) {
+        const Error& error = Error::Cast(result);
+        OS::Print("kernel-service: Calling main resulted in an error: %s",
+                  error.ToErrorCString());
+      }
+      return false;
+    }
+    ASSERT(result.IsReceivePort());
+    const ReceivePort& rp = ReceivePort::Cast(result);
+    KernelIsolate::SetLoadPort(rp.Id());
+    return true;
+  }
+};
+
+
+void KernelIsolate::Run() {
+  if (!FLAG_use_dart_frontend) {
+    return;
+  }
+  // Grab the isolate create callback here to avoid race conditions with tests
+  // that change this after Dart_Initialize returns.
+  create_callback_ = Isolate::CreateCallback();
+  Dart::thread_pool()->Run(new RunKernelTask());
+}
+
+
+void KernelIsolate::InitCallback(Isolate* I) {
+  Thread* T = Thread::Current();
+  ASSERT(I == T->isolate());
+  ASSERT(I != NULL);
+  ASSERT(I->name() != NULL);
+  if (!FLAG_use_dart_frontend ||
+      (strstr(I->name(), "kernel-service") == NULL)) {
+    // Not kernel isolate.
+    return;
+  }
+  ASSERT(!Exists());
+  if (FLAG_trace_kernel) {
+    OS::Print("kernel-service: InitCallback for %s.\n", I->name());
+  }
+  SetKernelIsolate(I);
+}
+
+
+bool KernelIsolate::IsKernelIsolate(const Isolate* isolate) {
+  MonitorLocker ml(monitor_);
+  return isolate == isolate_;
+}
+
+
+bool KernelIsolate::IsRunning() {
+  MonitorLocker ml(monitor_);
+  return (kernel_port_ != ILLEGAL_PORT) && (isolate_ != NULL);
+}
+
+
+bool KernelIsolate::Exists() {
+  MonitorLocker ml(monitor_);
+  return isolate_ != NULL;
+}
+
+
+void KernelIsolate::SetKernelIsolate(Isolate* isolate) {
+  MonitorLocker ml(monitor_);
+  isolate_ = isolate;
+}
+
+void KernelIsolate::SetLoadPort(Dart_Port port) {
+  MonitorLocker ml(monitor_);
+  kernel_port_ = port;
+}
+
+void KernelIsolate::FinishedInitializing() {
+  MonitorLocker ml(monitor_);
+  initializing_ = false;
+  ml.NotifyAll();
+}
+
+
+Dart_Port KernelIsolate::WaitForKernelPort() {
+  if (!FLAG_use_dart_frontend) {
+    return ILLEGAL_PORT;
+  }
+  MonitorLocker ml(monitor_);
+  while (initializing_ && (kernel_port_ == ILLEGAL_PORT)) {
+    ml.Wait();
+  }
+  return kernel_port_;
+}
+
+#endif  // DART_PRECOMPILED_RUNTIME
+
+}  // namespace dart
diff --git a/runtime/vm/kernel_isolate.h b/runtime/vm/kernel_isolate.h
new file mode 100644
index 0000000..8f54c34
--- /dev/null
+++ b/runtime/vm/kernel_isolate.h
@@ -0,0 +1,57 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef RUNTIME_VM_KERNEL_ISOLATE_H_
+#define RUNTIME_VM_KERNEL_ISOLATE_H_
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
+#include "include/dart_api.h"
+
+#include "vm/allocation.h"
+#include "vm/dart.h"
+#include "vm/os_thread.h"
+
+namespace dart {
+
+class KernelIsolate : public AllStatic {
+ public:
+  static const char* kName;
+
+  static void Run();
+
+  static bool Exists();
+  static bool IsRunning();
+  static bool IsKernelIsolate(const Isolate* isolate);
+  static Dart_Port WaitForKernelPort();
+  static Dart_Port KernelPort() { return kernel_port_; }
+
+  static bool LoadScript(const String& url, const String& source);
+
+ protected:
+  static Monitor* monitor_;
+  static Dart_IsolateCreateCallback create_callback_;
+
+  static void InitCallback(Isolate* I);
+  static void SetKernelIsolate(Isolate* isolate);
+  static void SetLoadPort(Dart_Port port);
+  static void FinishedInitializing();
+
+  static Dart_Port kernel_port_;
+  static Isolate* isolate_;
+  static bool initializing_;
+
+  static Dart_IsolateCreateCallback create_callback() {
+    return create_callback_;
+  }
+
+  friend class Dart;
+  friend class RunKernelTask;
+};
+
+}  // namespace dart
+
+#endif  // DART_PRECOMPILED_RUNTIME
+
+#endif  // RUNTIME_VM_KERNEL_ISOLATE_H_
diff --git a/runtime/vm/kernel_reader.cc b/runtime/vm/kernel_reader.cc
index e3b633f..f0be6f6 100644
--- a/runtime/vm/kernel_reader.cc
+++ b/runtime/vm/kernel_reader.cc
@@ -23,9 +23,9 @@
 
 class SimpleExpressionConverter : public ExpressionVisitor {
  public:
-  SimpleExpressionConverter(Thread* thread, Zone* zone)
-      : translation_helper_(thread, zone, NULL),
-        zone_(zone),
+  explicit SimpleExpressionConverter(Thread* thread)
+      : translation_helper_(thread),
+        zone_(translation_helper_.zone()),
         is_simple_(false),
         simple_value_(NULL) {}
 
@@ -99,12 +99,12 @@
       zone_(thread_->zone()),
       isolate_(thread_->isolate()),
       scripts_(Array::ZoneHandle(zone_)),
-      translation_helper_(this, thread_, zone_, isolate_),
+      translation_helper_(this, thread_),
       type_translator_(&translation_helper_,
                        &active_class_,
                        /*finalize=*/false) {
-  intptr_t source_file_count = program_->line_starting_table().size();
-  scripts_ = Array::New(source_file_count);
+  intptr_t source_file_count = program_->source_table().size();
+  scripts_ = Array::New(source_file_count, Heap::kOld);
 }
 
 Object& KernelReader::ReadProgram() {
@@ -158,7 +158,8 @@
   }
   // Setup toplevel class (which contains library fields/procedures).
 
-  Script& script = ScriptAt(kernel_library->source_uri_index());
+  Script& script = ScriptAt(kernel_library->source_uri_index(),
+                            kernel_library->import_uri());
   dart::Class& toplevel_class = dart::Class::Handle(
       Z, dart::Class::New(library, Symbols::TopLevel(), script,
                           TokenPosition::kNoSource));
@@ -199,7 +200,7 @@
   // Load all classes.
   for (intptr_t i = 0; i < kernel_library->classes().length(); i++) {
     Class* kernel_klass = kernel_library->classes()[i];
-    classes.Add(ReadClass(library, kernel_klass), Heap::kOld);
+    classes.Add(ReadClass(library, toplevel_class, kernel_klass), Heap::kOld);
   }
 
   classes.Add(toplevel_class, Heap::kOld);
@@ -265,7 +266,7 @@
   // Build implemented interface types
   intptr_t interface_count = kernel_klass->implemented_classes().length();
   const dart::Array& interfaces =
-      dart::Array::Handle(Z, dart::Array::New(interface_count));
+      dart::Array::Handle(Z, dart::Array::New(interface_count, Heap::kOld));
   for (intptr_t i = 0; i < interface_count; i++) {
     InterfaceType* kernel_interface_type =
         kernel_klass->implemented_classes()[i];
@@ -280,6 +281,7 @@
 
 
 dart::Class& KernelReader::ReadClass(const dart::Library& library,
+                                     const dart::Class& toplevel_class,
                                      Class* kernel_klass) {
   // This will trigger a call to [ReadPreliminaryClass] if not already done.
   dart::Class& klass = LookupClass(kernel_klass);
@@ -293,6 +295,8 @@
     const dart::String& name = H.DartFieldName(kernel_field->name());
     const AbstractType& type =
         T.TranslateTypeWithoutFinalization(kernel_field->type());
+    const Object& script_class =
+        ClassForScriptAt(klass, kernel_field->source_uri_index());
     dart::Field& field = dart::Field::Handle(
         Z, dart::Field::New(name, kernel_field->IsStatic(),
                             // In the VM all const fields are implicitly final
@@ -301,7 +305,7 @@
                             kernel_field->IsFinal() || kernel_field->IsConst(),
                             kernel_field->IsConst(),
                             false,  // is_reflectable
-                            klass, type, kernel_field->position()));
+                            script_class, type, kernel_field->position()));
     field.set_kernel_field(kernel_field);
     field.set_has_initializer(kernel_field->initializer() != NULL);
     GenerateFieldAccessors(klass, field, kernel_field);
@@ -322,7 +326,8 @@
                                false,  // is_abstract
                                kernel_constructor->IsExternal(),
                                false,  // is_native
-                               klass, TokenPosition::kNoSource));
+                               klass, kernel_constructor->position()));
+    function.set_end_token_pos(kernel_constructor->end_position());
     klass.AddFunction(function);
     function.set_kernel_function(kernel_constructor);
     function.set_result_type(T.ReceiverType(klass));
@@ -330,6 +335,11 @@
                             kernel_constructor->function(),
                             true,    // is_method
                             false);  // is_closure
+
+    if (FLAG_enable_mirrors) {
+      library.AddFunctionMetadata(function, TokenPosition::kNoSource,
+                                  kernel_constructor);
+    }
   }
 
   for (intptr_t i = 0; i < kernel_klass->procedures().length(); i++) {
@@ -342,6 +352,11 @@
     klass.set_is_marked_for_parsing();
   }
 
+  if (FLAG_enable_mirrors) {
+    library.AddClassMetadata(klass, toplevel_class, TokenPosition::kNoSource,
+                             kernel_klass);
+  }
+
   return klass;
 }
 
@@ -399,10 +414,11 @@
                        false,       // is_const
                        is_abstract, is_external,
                        native_name != NULL,  // is_native
-                       script_class, TokenPosition::kNoSource));
+                       script_class, kernel_procedure->position()));
+  function.set_end_token_pos(kernel_procedure->end_position());
   owner.AddFunction(function);
   function.set_kernel_function(kernel_procedure);
-  function.set_is_debuggable(false);
+  function.set_is_debuggable(kernel_procedure->function()->debuggable());
   if (native_name != NULL) {
     function.set_native_name(*native_name);
   }
@@ -417,6 +433,10 @@
                                   H.DartProcedureName(kernel_procedure)))
                 .IsNull());
   }
+  if (FLAG_enable_mirrors) {
+    library.AddFunctionMetadata(function, TokenPosition::kNoSource,
+                                kernel_procedure);
+  }
 }
 
 const Object& KernelReader::ClassForScriptAt(const dart::Class& klass,
@@ -430,21 +450,30 @@
   return klass;
 }
 
-Script& KernelReader::ScriptAt(intptr_t source_uri_index) {
+Script& KernelReader::ScriptAt(intptr_t source_uri_index, String* import_uri) {
   Script& script = Script::ZoneHandle(Z);
   script ^= scripts_.At(source_uri_index);
   if (script.IsNull()) {
+    // Create script with correct uri(s).
     String* uri = program_->source_uri_table().strings()[source_uri_index];
-    script = Script::New(H.DartString(uri), dart::String::ZoneHandle(Z),
+    dart::String& uri_string = H.DartString(uri, Heap::kOld);
+    dart::String& import_uri_string =
+        import_uri == NULL ? uri_string : H.DartString(import_uri, Heap::kOld);
+    dart::String& source_code = H.DartString(
+        program_->source_table().SourceFor(source_uri_index), Heap::kOld);
+    script = Script::New(import_uri_string, uri_string, source_code,
                          RawScript::kKernelTag);
     scripts_.SetAt(source_uri_index, script);
+
+    // Create line_starts array for the script.
     intptr_t* line_starts =
-        program_->line_starting_table().valuesFor(source_uri_index);
-    intptr_t line_count = line_starts[0];
-    Array& array_object = Array::Handle(Z, Array::New(line_count));
+        program_->source_table().LineStartsFor(source_uri_index);
+    intptr_t line_count =
+        program_->source_table().LineCountFor(source_uri_index);
+    Array& array_object = Array::Handle(Z, Array::New(line_count, Heap::kOld));
     Smi& value = Smi::Handle(Z);
     for (intptr_t i = 0; i < line_count; ++i) {
-      value = Smi::New(line_starts[i + 1]);
+      value = Smi::New(line_starts[i]);
       array_object.SetAt(i, value);
     }
     script.set_line_starts(array_object);
@@ -459,7 +488,7 @@
     // Static fields with initializers either have the static value set to the
     // initializer value if it is simple enough or else set to an uninitialized
     // sentinel.
-    SimpleExpressionConverter converter(H.thread(), Z);
+    SimpleExpressionConverter converter(H.thread());
     if (converter.IsSimple(kernel_field->initializer())) {
       // We do not need a getter.
       field.SetStaticValue(converter.SimpleValue(), true);
@@ -490,6 +519,7 @@
           false,  // is_native
           script_class, kernel_field->position()));
   klass.AddFunction(getter);
+  getter.set_end_token_pos(kernel_field->end_position());
   getter.set_kernel_function(kernel_field);
   getter.set_result_type(AbstractType::Handle(Z, field.type()));
   getter.set_is_debuggable(false);
@@ -508,6 +538,7 @@
                          false,  // is_native
                          script_class, kernel_field->position()));
     klass.AddFunction(setter);
+    setter.set_end_token_pos(kernel_field->end_position());
     setter.set_kernel_function(kernel_field);
     setter.set_result_type(Object::void_type());
     setter.set_is_debuggable(false);
@@ -625,6 +656,7 @@
     if (handle->IsNull()) {
       *handle = dart::Library::New(url);
       handle->Register(thread_);
+      handle->SetName(H.DartSymbol(library->name()));
     }
     ASSERT(!handle->IsNull());
     libraries_.Insert(library, handle);
@@ -645,7 +677,7 @@
       // optimized.
       Script& script = ScriptAt(klass->source_uri_index());
       handle = &dart::Class::Handle(
-          Z, dart::Class::New(library, name, script, TokenPosition::kNoSource));
+          Z, dart::Class::New(library, name, script, klass->position()));
       library.AddClass(*handle);
     } else if (handle->script() == Script::null()) {
       // When bootstrapping we can encounter classes that do not yet have a
diff --git a/runtime/vm/kernel_reader.h b/runtime/vm/kernel_reader.h
index f6b4ffd..092b90d 100644
--- a/runtime/vm/kernel_reader.h
+++ b/runtime/vm/kernel_reader.h
@@ -19,11 +19,8 @@
 
 class BuildingTranslationHelper : public TranslationHelper {
  public:
-  BuildingTranslationHelper(KernelReader* reader,
-                            dart::Thread* thread,
-                            dart::Zone* zone,
-                            Isolate* isolate)
-      : TranslationHelper(thread, zone, isolate), reader_(reader) {}
+  BuildingTranslationHelper(KernelReader* reader, dart::Thread* thread)
+      : TranslationHelper(thread), reader_(reader) {}
   virtual ~BuildingTranslationHelper() {}
 
   virtual RawLibrary* LookupLibraryByKernelLibrary(Library* library);
@@ -37,18 +34,18 @@
 class Mapping {
  public:
   bool Lookup(KernelType* node, VmType** handle) {
-    typename MapType::iterator value = map_.find(node);
-    if (value != map_.end()) {
-      *handle = value->second;
+    typename MapType::Pair* pair = map_.LookupPair(node);
+    if (pair != NULL) {
+      *handle = pair->value;
       return true;
     }
     return false;
   }
 
-  void Insert(KernelType* node, VmType* object) { map_[node] = object; }
+  void Insert(KernelType* node, VmType* object) { map_.Insert(node, object); }
 
  private:
-  typedef typename std::map<KernelType*, VmType*> MapType;
+  typedef MallocMap<KernelType, VmType*> MapType;
   MapType map_;
 };
 
@@ -73,7 +70,9 @@
   friend class BuildingTranslationHelper;
 
   void ReadPreliminaryClass(dart::Class* klass, Class* kernel_klass);
-  dart::Class& ReadClass(const dart::Library& library, Class* kernel_klass);
+  dart::Class& ReadClass(const dart::Library& library,
+                         const dart::Class& toplevel_class,
+                         Class* kernel_klass);
   void ReadProcedure(const dart::Library& library,
                      const dart::Class& owner,
                      Procedure* procedure,
@@ -84,7 +83,7 @@
   // Otherwise return klass.
   const Object& ClassForScriptAt(const dart::Class& klass,
                                  intptr_t source_uri_index);
-  Script& ScriptAt(intptr_t source_uri_index);
+  Script& ScriptAt(intptr_t source_uri_index, String* import_uri = NULL);
 
   void GenerateFieldAccessors(const dart::Class& klass,
                               const dart::Field& field,
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
index f741ce5..11a84e2 100644
--- a/runtime/vm/kernel_to_il.cc
+++ b/runtime/vm/kernel_to_il.cc
@@ -58,21 +58,24 @@
 }
 
 
-void ScopeBuilder::EnterScope(TreeNode* node) {
+void ScopeBuilder::EnterScope(TreeNode* node, TokenPosition start_position) {
   scope_ = new (Z) LocalScope(scope_, depth_.function_, depth_.loop_);
+  scope_->set_begin_token_pos(start_position);
   result_->scopes.Insert(node, scope_);
 }
 
 
-void ScopeBuilder::ExitScope() {
+void ScopeBuilder::ExitScope(TokenPosition end_position) {
+  scope_->set_end_token_pos(end_position);
   scope_ = scope_->parent();
 }
 
 
-LocalVariable* ScopeBuilder::MakeVariable(const dart::String& name,
+LocalVariable* ScopeBuilder::MakeVariable(TokenPosition declaration_pos,
+                                          TokenPosition token_pos,
+                                          const dart::String& name,
                                           const AbstractType& type) {
-  return new (Z) LocalVariable(TokenPosition::kNoSource,
-                               TokenPosition::kNoSource, name, type);
+  return new (Z) LocalVariable(declaration_pos, token_pos, name, type);
 }
 
 
@@ -90,8 +93,9 @@
 
 void ScopeBuilder::AddParameter(VariableDeclaration* declaration,
                                 intptr_t pos) {
-  LocalVariable* variable = MakeVariable(H.DartSymbol(declaration->name()),
-                                         T.TranslateVariableType(declaration));
+  LocalVariable* variable = MakeVariable(
+      declaration->position(), declaration->position(),
+      H.DartSymbol(declaration->name()), T.TranslateVariableType(declaration));
   if (declaration->IsFinal()) {
     variable->set_is_final();
   }
@@ -138,7 +142,8 @@
   // If variable was not lifted by the transformer introduce a new
   // one into the current function scope.
   if (v == NULL) {
-    v = MakeVariable(GenerateName(prefix, nesting_depth - 1),
+    v = MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+                     GenerateName(prefix, nesting_depth - 1),
                      AbstractType::dynamic_type());
 
     // If transformer did not lift the variable then there is no need
@@ -171,7 +176,8 @@
 
   ASSERT(result_->iterator_variables.length() == depth_.for_in_ - 1);
   LocalVariable* iterator =
-      MakeVariable(GenerateName(":iterator", depth_.for_in_ - 1),
+      MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+                   GenerateName(":iterator", depth_.for_in_ - 1),
                    AbstractType::dynamic_type());
   current_function_scope_->AddVariable(iterator);
   result_->iterator_variables.Add(iterator);
@@ -237,7 +243,8 @@
                                  ? GenerateName(":var", name_index_++)
                                  : H.DartSymbol(declaration->name());
   LocalVariable* variable =
-      MakeVariable(name, T.TranslateVariableType(declaration));
+      MakeVariable(declaration->position(), declaration->end_position(), name,
+                   T.TranslateVariableType(declaration));
   if (declaration->IsFinal()) {
     variable->set_is_final();
   }
@@ -287,6 +294,8 @@
         ContextScope::Handle(Z, function.context_scope()));
   }
   current_function_scope_ = scope_ = new (Z) LocalScope(enclosing_scope, 0, 0);
+  scope_->set_begin_token_pos(function.token_pos());
+  scope_->set_end_token_pos(function.end_token_pos());
 
   LocalVariable* context_var = parsed_function->current_context_var();
   context_var->set_is_forced_stack();
@@ -314,8 +323,9 @@
 
       intptr_t pos = 0;
       if (function.IsClosureFunction()) {
-        LocalVariable* variable = MakeVariable(Symbols::ClosureParameter(),
-                                               AbstractType::dynamic_type());
+        LocalVariable* variable = MakeVariable(
+            TokenPosition::kNoSource, TokenPosition::kNoSource,
+            Symbols::ClosureParameter(), AbstractType::dynamic_type());
         variable->set_is_forced_stack();
         scope_->InsertParameterAt(pos++, variable);
       } else if (!function.is_static()) {
@@ -323,7 +333,9 @@
         // returns `false` for constructors.
         dart::Class& klass = dart::Class::Handle(Z, function.Owner());
         Type& klass_type = H.GetCanonicalType(klass);
-        LocalVariable* variable = MakeVariable(Symbols::This(), klass_type);
+        LocalVariable* variable =
+            MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+                         Symbols::This(), klass_type);
         scope_->InsertParameterAt(pos++, variable);
         result_->this_variable = variable;
 
@@ -335,14 +347,15 @@
           for (intptr_t i = 0; i < klass->fields().length(); i++) {
             Field* field = klass->fields()[i];
             if (!field->IsStatic() && (field->initializer() != NULL)) {
-              EnterScope(field);
+              EnterScope(field, field->position());
               field->initializer()->AcceptExpressionVisitor(this);
-              ExitScope();
+              ExitScope(field->end_position());
             }
           }
         }
       } else if (function.IsFactory()) {
         LocalVariable* variable = MakeVariable(
+            TokenPosition::kNoSource, TokenPosition::kNoSource,
             Symbols::TypeArgumentsParameter(), AbstractType::dynamic_type());
         scope_->InsertParameterAt(pos++, variable);
         result_->type_arguments_variable = variable;
@@ -371,13 +384,16 @@
       if (is_method) {
         dart::Class& klass = dart::Class::Handle(Z, function.Owner());
         Type& klass_type = H.GetCanonicalType(klass);
-        LocalVariable* variable = MakeVariable(Symbols::This(), klass_type);
+        LocalVariable* variable =
+            MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+                         Symbols::This(), klass_type);
         scope_->InsertParameterAt(pos++, variable);
         result_->this_variable = variable;
       }
       if (is_setter) {
         result_->setter_value =
-            MakeVariable(Symbols::Value(), AbstractType::dynamic_type());
+            MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+                         Symbols::Value(), AbstractType::dynamic_type());
         scope_->InsertParameterAt(pos++, result_->setter_value);
       }
       break;
@@ -389,7 +405,9 @@
       // Therefore, it isn't necessary to mark it as captured here.
       dart::Class& klass = dart::Class::Handle(Z, function.Owner());
       Type& klass_type = H.GetCanonicalType(klass);
-      LocalVariable* variable = MakeVariable(Symbols::This(), klass_type);
+      LocalVariable* variable =
+          MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+                       Symbols::This(), klass_type);
       scope_->InsertParameterAt(0, variable);
       result_->this_variable = variable;
       break;
@@ -398,6 +416,7 @@
     case RawFunction::kInvokeFieldDispatcher:
       for (intptr_t i = 0; i < function.NumParameters(); ++i) {
         LocalVariable* variable = MakeVariable(
+            TokenPosition::kNoSource, TokenPosition::kNoSource,
             dart::String::ZoneHandle(Z, function.ParameterNameAt(i)),
             AbstractType::dynamic_type());
         scope_->InsertParameterAt(i, variable);
@@ -455,7 +474,7 @@
   FunctionNode* saved_function_node = current_function_node_;
   ScopeBuilder::DepthState saved_depth_state = depth_;
   depth_ = DepthState(depth_.function_ + 1);
-  EnterScope(parent);
+  EnterScope(parent, function->position());
   current_function_scope_ = scope_;
   current_function_node_ = function;
   if (depth_.function_ == 1) {
@@ -464,7 +483,7 @@
   }
   AddParameters(function);
   VisitFunctionNode(function);
-  ExitScope();
+  ExitScope(function->end_position());
   depth_ = saved_depth_state;
   current_function_scope_ = saved_function_scope;
   current_function_node_ = saved_function_node;
@@ -499,16 +518,16 @@
 
 
 void ScopeBuilder::VisitLet(Let* node) {
-  EnterScope(node);
+  EnterScope(node, node->position());
   node->VisitChildren(this);
-  ExitScope();
+  ExitScope(node->end_position());
 }
 
 
 void ScopeBuilder::VisitBlock(Block* node) {
-  EnterScope(node);
+  EnterScope(node, node->position());
   node->VisitChildren(this);
-  ExitScope();
+  ExitScope(node->end_position());
 }
 
 
@@ -539,7 +558,7 @@
 
 
 void ScopeBuilder::VisitForStatement(ForStatement* node) {
-  EnterScope(node);
+  EnterScope(node, node->position());
   List<VariableDeclaration>& variables = node->variables();
   for (intptr_t i = 0; i < variables.length(); ++i) {
     VisitVariableDeclaration(variables[i]);
@@ -554,7 +573,7 @@
     updates[i]->AcceptExpressionVisitor(this);
   }
   --depth_.loop_;
-  ExitScope();
+  ExitScope(node->end_position());
 }
 
 
@@ -563,10 +582,10 @@
   ++depth_.for_in_;
   AddIteratorVariable();
   ++depth_.loop_;
-  EnterScope(node);
+  EnterScope(node, node->position());
   VisitVariableDeclaration(node->variable());
   node->body()->AcceptStatementVisitor(this);
-  ExitScope();
+  ExitScope(node->end_position());
   --depth_.loop_;
   --depth_.for_in_;
 }
@@ -575,7 +594,8 @@
 void ScopeBuilder::AddSwitchVariable() {
   if ((depth_.function_ == 0) && (result_->switch_variable == NULL)) {
     LocalVariable* variable =
-        MakeVariable(Symbols::SwitchExpr(), AbstractType::dynamic_type());
+        MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+                     Symbols::SwitchExpr(), AbstractType::dynamic_type());
     variable->set_is_forced_stack();
     current_function_scope_->AddVariable(variable);
     result_->switch_variable = variable;
@@ -593,7 +613,9 @@
   if ((depth_.function_ == 0) && (depth_.finally_ > 0) &&
       (result_->finally_return_variable == NULL)) {
     const dart::String& name = H.DartSymbol(":try_finally_return_value");
-    LocalVariable* variable = MakeVariable(name, AbstractType::dynamic_type());
+    LocalVariable* variable =
+        MakeVariable(TokenPosition::kNoSource, TokenPosition::kNoSource, name,
+                     AbstractType::dynamic_type());
     current_function_scope_->AddVariable(variable);
     result_->finally_return_variable = variable;
   }
@@ -612,7 +634,7 @@
   List<Catch>& catches = node->catches();
   for (intptr_t i = 0; i < catches.length(); ++i) {
     Catch* ketch = catches[i];
-    EnterScope(ketch);
+    EnterScope(ketch, ketch->position());
     if (ketch->exception() != NULL) {
       VisitVariableDeclaration(ketch->exception());
     }
@@ -620,7 +642,7 @@
       VisitVariableDeclaration(ketch->stack_trace());
     }
     ketch->body()->AcceptStatementVisitor(this);
-    ExitScope();
+    ExitScope(ketch->end_position());
   }
   --depth_.catch_;
 }
@@ -649,10 +671,11 @@
 
   if (node->async_marker() == FunctionNode::kSyncYielding) {
     LocalScope* scope = parsed_function_->node_sequence()->scope();
+    intptr_t offset = parsed_function_->function().num_fixed_parameters();
     for (intptr_t i = 0;
          i < parsed_function_->function().NumOptionalPositionalParameters();
          i++) {
-      scope->VariableAt(i)->set_is_forced_stack();
+      scope->VariableAt(offset + i)->set_is_forced_stack();
     }
   }
 
@@ -662,7 +685,7 @@
     node->body()->AcceptStatementVisitor(this);
   }
 
-  // Ensure that :await_jump_var and :await_ctx_var are captured.
+  // Ensure that :await_jump_var, :await_ctx_var and :async_op are captured.
   if (node->async_marker() == FunctionNode::kSyncYielding) {
     {
       LocalVariable* temp = NULL;
@@ -676,6 +699,13 @@
           (depth_.function_ == 0) ? &result_->yield_context_variable : &temp,
           Symbols::AwaitContextVar());
     }
+    {
+      LocalVariable* temp =
+          scope_->LookupVariable(Symbols::AsyncOperation(), true);
+      if (temp != NULL) {
+        scope_->CaptureVariable(temp);
+      }
+    }
   }
 }
 
@@ -727,7 +757,8 @@
         outer_(builder->breakable_block_),
         destination_(NULL),
         outer_finally_(builder->try_finally_block_),
-        context_depth_(builder->context_depth_) {
+        context_depth_(builder->context_depth_),
+        try_index_(builder->CurrentTryIndex()) {
     builder_->breakable_block_ = this;
   }
   ~BreakableBlock() { builder_->breakable_block_ = outer_; }
@@ -752,7 +783,7 @@
  private:
   JoinEntryInstr* EnsureDestination() {
     if (destination_ == NULL) {
-      destination_ = builder_->BuildJoinEntry();
+      destination_ = builder_->BuildJoinEntry(try_index_);
     }
     return destination_;
   }
@@ -763,6 +794,7 @@
   JoinEntryInstr* destination_;
   TryFinallyBlock* outer_finally_;
   intptr_t context_depth_;
+  intptr_t try_index_;
 };
 
 
@@ -773,7 +805,8 @@
         outer_(builder->switch_block_),
         outer_finally_(builder->try_finally_block_),
         switch_statement_(switch_stmt),
-        context_depth_(builder->context_depth_) {
+        context_depth_(builder->context_depth_),
+        try_index_(builder->CurrentTryIndex()) {
     builder_->switch_block_ = this;
   }
   ~SwitchBlock() { builder_->switch_block_ = outer_; }
@@ -809,7 +842,7 @@
   JoinEntryInstr* EnsureDestination(SwitchCase* switch_case) {
     JoinEntryInstr* cached_inst = destinations_.Lookup(switch_case);
     if (cached_inst == NULL) {
-      JoinEntryInstr* inst = builder_->BuildJoinEntry();
+      JoinEntryInstr* inst = builder_->BuildJoinEntry(try_index_);
       destinations_.Insert(switch_case, inst);
       return inst;
     }
@@ -838,6 +871,7 @@
   TryFinallyBlock* outer_finally_;
   SwitchStatement* switch_statement_;
   intptr_t context_depth_;
+  intptr_t try_index_;
 };
 
 
@@ -1273,7 +1307,7 @@
   if (named->length() == 0) return Array::ZoneHandle(Z);
 
   const Array& names =
-      Array::ZoneHandle(Z, Array::New(named->length(), allocation_space_));
+      Array::ZoneHandle(Z, Array::New(named->length(), Heap::kOld));
   for (intptr_t i = 0; i < named->length(); ++i) {
     names.SetAt(i, DartSymbol((*named)[i]->name()));
   }
@@ -1290,10 +1324,11 @@
       zone_(zone),
       translation_helper_(*h),
       type_translator_(*type_translator),
-      script_(dart::Script::Handle(
+      script_(Script::Handle(
           zone,
-          builder_->parsed_function_->function().script())),
-      result_(dart::Instance::Handle(zone)) {}
+          builder == NULL ? Script::null()
+                          : builder_->parsed_function_->function().script())),
+      result_(Instance::Handle(zone)) {}
 
 
 Instance& ConstantEvaluator::EvaluateExpression(Expression* expression) {
@@ -1312,7 +1347,7 @@
   if (setjmp(*jump.Set()) == 0) {
     return EvaluateExpression(expression);
   } else {
-    Thread* thread = Thread::Current();
+    Thread* thread = H.thread();
     Error& error = Error::Handle(Z);
     error = thread->sticky_error();
     thread->clear_sticky_error();
@@ -1439,6 +1474,8 @@
 
 
 bool ConstantEvaluator::GetCachedConstant(TreeNode* node, Instance* value) {
+  if (builder_ == NULL) return false;
+
   const Function& function = builder_->parsed_function_->function();
   if (function.kind() == RawFunction::kImplicitStaticFinalGetter) {
     // Don't cache constants in initializer expressions. They get
@@ -1468,6 +1505,8 @@
                                            const Instance& value) {
   ASSERT(Thread::Current()->IsMutatorThread());
 
+  if (builder_ == NULL) return;
+
   const Function& function = builder_->parsed_function_->function();
   if (function.kind() == RawFunction::kImplicitStaticFinalGetter) {
     // Don't cache constants in initializer expressions. They get
@@ -1763,6 +1802,28 @@
 }
 
 
+void ConstantEvaluator::VisitPropertyGet(PropertyGet* node) {
+  const size_t kLengthLen = strlen("length");
+
+  String* string = node->name()->string();
+  if (string->size() == kLengthLen &&
+      memcmp(string->buffer(), "length", kLengthLen) == 0) {
+    node->receiver()->AcceptExpressionVisitor(this);
+    if (result_.IsString()) {
+      const dart::String& str =
+          dart::String::Handle(Z, dart::String::RawCast(result_.raw()));
+      result_ = Integer::New(str.Length());
+    } else {
+      H.ReportError(
+          "Constant expressions can only call "
+          "'length' on string constants.");
+    }
+  } else {
+    VisitDefaultExpression(node);
+  }
+}
+
+
 const TypeArguments* ConstantEvaluator::TranslateTypeArguments(
     const Function& target,
     dart::Class* target_klass,
@@ -1843,10 +1904,8 @@
     InlineExitCollector* exit_collector,
     intptr_t osr_id,
     intptr_t first_block_id)
-    : zone_(Thread::Current()->zone()),
-      translation_helper_(Thread::Current(),
-                          zone_,
-                          Thread::Current()->isolate()),
+    : translation_helper_(Thread::Current()),
+      zone_(translation_helper_.zone()),
       node_(node),
       parsed_function_(parsed_function),
       osr_id_(osr_id),
@@ -1985,7 +2044,8 @@
   Fragment instructions;
   if (depth < context_depth_) {
     instructions += LoadContextAt(depth);
-    instructions += StoreLocal(parsed_function_->current_context_var());
+    instructions += StoreLocal(TokenPosition::kNoSource,
+                               parsed_function_->current_context_var());
     instructions += Drop();
     context_depth_ = depth;
   }
@@ -2000,7 +2060,8 @@
   instructions += LoadLocal(context);
   instructions += LoadLocal(parsed_function_->current_context_var());
   instructions += StoreInstanceField(Context::parent_offset());
-  instructions += StoreLocal(parsed_function_->current_context_var());
+  instructions += StoreLocal(TokenPosition::kNoSource,
+                             parsed_function_->current_context_var());
   ++context_depth_;
   return instructions;
 }
@@ -2041,6 +2102,14 @@
 }
 
 
+Fragment FlowGraphBuilder::InstantiateType(const AbstractType& type) {
+  InstantiateTypeInstr* instr = new (Z) InstantiateTypeInstr(
+      TokenPosition::kNoSource, type, *active_class_.klass, Pop());
+  Push(instr);
+  return Fragment(instr);
+}
+
+
 Fragment FlowGraphBuilder::InstantiateTypeArguments(
     const TypeArguments& type_arguments) {
   InstantiateTypeArgumentsInstr* instr = new (Z) InstantiateTypeArgumentsInstr(
@@ -2185,7 +2254,7 @@
   CatchBlockEntryInstr* entry = new (Z) CatchBlockEntryInstr(
       AllocateBlockId(), CurrentTryIndex(), graph_entry_, handler_types,
       handler_index, *CurrentException(), *CurrentStackTrace(),
-      /* needs_stacktrace = */ true, Thread::Current()->GetNextDeoptId(),
+      /* needs_stacktrace = */ true, H.thread()->GetNextDeoptId(),
       should_restore_closure_context);
   graph_entry_->AddCatchEntry(entry);
   Fragment instructions(entry);
@@ -2200,7 +2269,8 @@
          CurrentCatchContext()->owner()->context_level() == 0);
   context_depth_ = 0;
   instructions += LoadLocal(CurrentCatchContext());
-  instructions += StoreLocal(parsed_function_->current_context_var());
+  instructions += StoreLocal(TokenPosition::kNoSource,
+                             parsed_function_->current_context_var());
   instructions += Drop();
   context_depth_ = saved_context_depth;
 
@@ -2218,7 +2288,7 @@
   JoinEntryInstr* entry =
       new (Z) JoinEntryInstr(AllocateBlockId(), try_handler_index);
   body += LoadLocal(parsed_function_->current_context_var());
-  body += StoreLocal(CurrentCatchContext());
+  body += StoreLocal(TokenPosition::kNoSource, CurrentCatchContext());
   body += Drop();
   body += Goto(entry);
   return Fragment(body.entry, entry);
@@ -2252,7 +2322,7 @@
   instructions <<= clone_instruction;
   Push(clone_instruction);
 
-  instructions += StoreLocal(context_variable);
+  instructions += StoreLocal(TokenPosition::kNoSource, context_variable);
   instructions += Drop();
   return instructions;
 }
@@ -2462,7 +2532,7 @@
 }
 
 
-Fragment FlowGraphBuilder::Return() {
+Fragment FlowGraphBuilder::Return(TokenPosition position) {
   Value* value = Pop();
   ASSERT(stack_ == NULL);
   ReturnInstr* return_instr =
@@ -2537,6 +2607,7 @@
 
 Fragment FlowGraphBuilder::StoreInstanceField(
     const dart::Field& field,
+    bool is_initialization_store,
     StoreBarrierType emit_store_barrier) {
   Value* value = Pop();
   if (value->BindsToConstant()) {
@@ -2545,23 +2616,24 @@
   StoreInstanceFieldInstr* store = new (Z)
       StoreInstanceFieldInstr(MayCloneField(Z, field), Pop(), value,
                               emit_store_barrier, TokenPosition::kNoSource);
+  store->set_is_initialization(is_initialization_store);
   return Fragment(store);
 }
 
 
-Fragment FlowGraphBuilder::StoreInstanceFieldGuarded(const dart::Field& field) {
+Fragment FlowGraphBuilder::StoreInstanceFieldGuarded(
+    const dart::Field& field,
+    bool is_initialization_store) {
   Fragment instructions;
   const dart::Field& field_clone = MayCloneField(Z, field);
   if (FLAG_use_field_guards) {
     LocalVariable* store_expression = MakeTemporary();
     instructions += LoadLocal(store_expression);
-    instructions +=
-        GuardFieldClass(field_clone, Thread::Current()->GetNextDeoptId());
+    instructions += GuardFieldClass(field_clone, H.thread()->GetNextDeoptId());
     instructions += LoadLocal(store_expression);
-    instructions +=
-        GuardFieldLength(field_clone, Thread::Current()->GetNextDeoptId());
+    instructions += GuardFieldLength(field_clone, H.thread()->GetNextDeoptId());
   }
-  instructions += StoreInstanceField(field_clone);
+  instructions += StoreInstanceField(field_clone, is_initialization_store);
   return instructions;
 }
 
@@ -2579,7 +2651,8 @@
 }
 
 
-Fragment FlowGraphBuilder::StoreLocal(LocalVariable* variable) {
+Fragment FlowGraphBuilder::StoreLocal(TokenPosition position,
+                                      LocalVariable* variable) {
   Fragment instructions;
   if (variable->is_captured()) {
     LocalVariable* value = MakeTemporary();
@@ -2588,8 +2661,9 @@
     instructions +=
         StoreInstanceField(Context::variable_offset(variable->index()));
   } else {
+    Value* value = Pop();
     StoreLocalInstr* store =
-        new (Z) StoreLocalInstr(*variable, Pop(), TokenPosition::kNoSource);
+        new (Z) StoreLocalInstr(*variable, value, position);
     instructions <<= store;
     Push(store);
   }
@@ -2603,10 +2677,10 @@
 }
 
 
-Fragment FlowGraphBuilder::StringInterpolate() {
+Fragment FlowGraphBuilder::StringInterpolate(TokenPosition position) {
   Value* array = Pop();
   StringInterpolateInstr* interpolate =
-      new (Z) StringInterpolateInstr(array, TokenPosition::kNoSource);
+      new (Z) StringInterpolateInstr(array, position);
   Push(interpolate);
   return Fragment(interpolate);
 }
@@ -2631,7 +2705,7 @@
   instructions += AllocateObject(klass, 0);
   LocalVariable* instance = MakeTemporary();
 
-  // Call _AssertionError._create constructor.
+  // Call _TypeError._create constructor.
   instructions += LoadLocal(instance);
   instructions += PushArgument();  // this
 
@@ -2972,7 +3046,7 @@
         body += LoadLocal(parameter);
         body += StoreInstanceField(Context::variable_offset(variable->index()));
         body += NullConstant();
-        body += StoreLocal(parameter);
+        body += StoreLocal(TokenPosition::kNoSource, parameter);
         body += Drop();
       }
     }
@@ -3014,7 +3088,7 @@
     // false.
     Fragment null_fragment(null_entry);
     null_fragment += Constant(Bool::False());
-    null_fragment += Return();
+    null_fragment += Return(dart_function.end_token_pos());
 
     body = Fragment(body.entry, non_null_entry);
   }
@@ -3026,7 +3100,7 @@
   }
   if (body.is_open()) {
     body += NullConstant();
-    body += Return();
+    body += Return(dart_function.end_token_pos());
   }
 
   // If functions body contains any yield points build switch statement that
@@ -3049,7 +3123,7 @@
 
     // Load :await_jump_var into a temporary.
     dispatch += LoadLocal(scopes_->yield_jump_variable);
-    dispatch += StoreLocal(scopes_->switch_variable);
+    dispatch += StoreLocal(TokenPosition::kNoSource, scopes_->switch_variable);
     dispatch += Drop();
 
     BlockEntryInstr* block = NULL;
@@ -3060,7 +3134,8 @@
         // Note: after this point context_depth_ does not match current context
         // depth so we should not access any local variables anymore.
         dispatch += LoadLocal(scopes_->yield_context_variable);
-        dispatch += StoreLocal(parsed_function_->current_context_var());
+        dispatch += StoreLocal(TokenPosition::kNoSource,
+                               parsed_function_->current_context_var());
         dispatch += Drop();
       }
       if (i == (yield_continuations_.length() - 1)) {
@@ -3099,6 +3174,7 @@
 
     context_depth_ = current_context_depth;
   }
+
   normal_entry->LinkTo(body.entry);
 
   // When compiling for OSR, use a depth first search to prune instructions
@@ -3266,7 +3342,7 @@
       break;
     }
   }
-  return body + Return();
+  return body + Return(TokenPosition::kNoSource);
 }
 
 
@@ -3289,7 +3365,7 @@
     if (is_method) {
       body += LoadLocal(scopes_->this_variable);
       body += LoadLocal(setter_value);
-      body += StoreInstanceFieldGuarded(field);
+      body += StoreInstanceFieldGuarded(field, false);
     } else {
       body += LoadLocal(setter_value);
       body += StoreStaticField(field);
@@ -3317,7 +3393,7 @@
     body += Constant(field);
     body += LoadStaticField();
   }
-  body += Return();
+  body += Return(TokenPosition::kNoSource);
 
   return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1);
 }
@@ -3340,7 +3416,7 @@
   } else {
     body += TranslateExpression(initializer);
   }
-  body += Return();
+  body += Return(TokenPosition::kNoSource);
 
   return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1);
 }
@@ -3401,7 +3477,7 @@
   Fragment body(normal_entry);
   body += CheckStackOverflowInPrologue();
   body += BuildImplicitClosureCreation(function);
-  body += Return();
+  body += Return(TokenPosition::kNoSource);
 
   return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1);
 }
@@ -3453,7 +3529,7 @@
                      argument_names);
 
   // Return the result.
-  body += Return();
+  body += Return(kernel_function->end_position());
 
   return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1);
 }
@@ -3554,7 +3630,7 @@
         Symbols::NoSuchMethod(), two_arguments);
   }
   body += StaticCall(TokenPosition::kMinSource, no_such_method, 2);
-  body += Return();
+  body += Return(TokenPosition::kNoSource);
 
   return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1);
 }
@@ -3641,7 +3717,7 @@
                          Token::kILLEGAL, descriptor.Count(), argument_names);
   }
 
-  body += Return();
+  body += Return(TokenPosition::kNoSource);
 
   return new (Z) FlowGraph(*parsed_function_, graph_entry_, next_block_id_ - 1);
 }
@@ -3693,6 +3769,11 @@
 }
 
 
+JoinEntryInstr* FlowGraphBuilder::BuildJoinEntry(intptr_t try_index) {
+  return new (Z) JoinEntryInstr(AllocateBlockId(), try_index);
+}
+
+
 JoinEntryInstr* FlowGraphBuilder::BuildJoinEntry() {
   return new (Z) JoinEntryInstr(AllocateBlockId(), CurrentTryIndex());
 }
@@ -3717,7 +3798,7 @@
       EnterScope(kernel_field);
       instructions += LoadLocal(scopes_->this_variable);
       instructions += TranslateExpression(init);
-      instructions += StoreInstanceFieldGuarded(field);
+      instructions += StoreInstanceFieldGuarded(field, true);
       ExitScope(kernel_field);
     }
   }
@@ -3737,7 +3818,7 @@
 
       instructions += LoadLocal(scopes_->this_variable);
       instructions += TranslateExpression(init->value());
-      instructions += StoreInstanceFieldGuarded(field);
+      instructions += StoreInstanceFieldGuarded(field, true);
     } else if (initializer->IsSuperInitializer()) {
       SuperInitializer* init = SuperInitializer::Cast(initializer);
 
@@ -3800,7 +3881,7 @@
       ASSERT(!declaration->IsConst());
 
       instructions += TranslateExpression(initializer);
-      instructions += StoreLocal(variable);
+      instructions += StoreLocal(TokenPosition::kNoSource, variable);
       instructions += Drop();
 
       fragment_ = instructions;
@@ -3951,8 +4032,9 @@
   //     checker and the runtime unless explicitly specified otherwise.
   //
   // So we convert malformed return/parameter types to `dynamic`.
+  TypeParameterScope scope(this, &node->type_parameters());
 
-  const Function& signature_function = Function::ZoneHandle(
+  Function& signature_function = Function::ZoneHandle(
       Z, Function::NewSignatureFunction(*active_class_->klass,
                                         TokenPosition::kNoSource));
 
@@ -4007,18 +4089,37 @@
   if (finalize_) {
     signature_type ^= ClassFinalizer::FinalizeType(
         *active_class_->klass, signature_type, ClassFinalizer::kCanonicalize);
+    // Do not refer to signature_function anymore, since it may have been
+    // replaced during canonicalization.
+    signature_function = Function::null();
   }
-  signature_function.SetSignatureType(signature_type);
 
   result_ = signature_type.raw();
 }
 
 
-void DartTypeTranslator::VisitTypeParameterType(TypeParameterType* node) {
-  ASSERT(active_class_->kernel_class != NULL);
+static intptr_t FindTypeParameterIndex(List<TypeParameter>* parameters,
+                                       TypeParameter* param) {
+  for (intptr_t i = 0; i < parameters->length(); i++) {
+    if (param == (*parameters)[i]) {
+      return i;
+    }
+  }
+  return -1;
+}
 
-  List<TypeParameter>* parameters =
-      &active_class_->kernel_class->type_parameters();
+
+void DartTypeTranslator::VisitTypeParameterType(TypeParameterType* node) {
+  for (TypeParameterScope* scope = type_parameter_scope_; scope != NULL;
+       scope = scope->outer()) {
+    const intptr_t index =
+        FindTypeParameterIndex(scope->parameters(), node->parameter());
+    if (index >= 0) {
+      result_ ^= dart::Type::DynamicType();
+      return;
+    }
+  }
+
   if ((active_class_->member != NULL) && active_class_->member->IsProcedure()) {
     Procedure* procedure = Procedure::Cast(active_class_->member);
     if ((procedure->function() != NULL) &&
@@ -4041,20 +4142,34 @@
       //     static A.x<T'>() { return new B<T'>(); }
       //   }
       //
-      parameters = &procedure->function()->type_parameters();
+      const intptr_t index = FindTypeParameterIndex(
+          &procedure->function()->type_parameters(), node->parameter());
+      if (index >= 0) {
+        if (procedure->kind() == Procedure::kFactory) {
+          // The index of the type parameter in [parameters] is
+          // the same index into the `klass->type_parameters()` array.
+          result_ ^= dart::TypeArguments::Handle(
+                         Z, active_class_->klass->type_parameters())
+                         .TypeAt(index);
+        } else {
+          result_ ^= dart::Type::DynamicType();
+        }
+        return;
+      }
     }
   }
 
-  for (intptr_t i = 0; i < parameters->length(); i++) {
-    TypeParameter* type_parameter = (*parameters)[i];
-    if (node->parameter() == type_parameter) {
-      // The index of the type parameter in [parameters] is
-      // the same index into the `klass->type_parameters()` array.
-      result_ ^= dart::TypeArguments::Handle(
-                     Z, active_class_->klass->type_parameters())
-                     .TypeAt(i);
-      return;
-    }
+  ASSERT(active_class_->kernel_class != NULL);
+  List<TypeParameter>* parameters =
+      &active_class_->kernel_class->type_parameters();
+  const intptr_t index = FindTypeParameterIndex(parameters, node->parameter());
+  if (index >= 0) {
+    // The index of the type parameter in [parameters] is
+    // the same index into the `klass->type_parameters()` array.
+    result_ ^=
+        dart::TypeArguments::Handle(Z, active_class_->klass->type_parameters())
+            .TypeAt(index);
+    return;
   }
 
   UNREACHABLE();
@@ -4167,7 +4282,14 @@
   const AbstractType& type = T.TranslateType(node->type());
   if (type.IsMalformed()) H.ReportError("Malformed type literal");
 
-  fragment_ = Constant(type);
+  Fragment instructions;
+  if (type.IsInstantiated()) {
+    instructions += Constant(type);
+  } else {
+    instructions += LoadInstantiatorTypeArguments();
+    instructions += InstantiateType(type);
+  }
+  fragment_ = instructions;
 }
 
 
@@ -4178,7 +4300,8 @@
 
 void FlowGraphBuilder::VisitVariableSet(VariableSet* node) {
   Fragment instructions = TranslateExpression(node->expression());
-  instructions += StoreLocal(LookupVariable(node->variable()));
+  instructions +=
+      StoreLocal(node->position(), LookupVariable(node->variable()));
   fragment_ = instructions;
 }
 
@@ -4212,12 +4335,7 @@
       fragment_ = StaticCall(node->position(), target, 0);
     } else if (procedure->kind() == Procedure::kMethod) {
       ASSERT(procedure->IsStatic());
-      Function& closure_function =
-          Function::ZoneHandle(Z, target.ImplicitClosureFunction());
-      closure_function.set_kernel_function(target.kernel_function());
-      const Instance& closure =
-          Instance::ZoneHandle(Z, closure_function.ImplicitStaticClosure());
-      fragment_ = Constant(closure);
+      fragment_ = Constant(constant_evaluator_.EvaluateExpression(node));
     } else {
       UNIMPLEMENTED();
     }
@@ -4273,7 +4391,7 @@
   instructions += TranslateExpression(node->receiver());
   instructions += PushArgument();
   instructions += TranslateExpression(node->value());
-  instructions += StoreLocal(variable);
+  instructions += StoreLocal(TokenPosition::kNoSource, variable);
   instructions += PushArgument();
 
   const dart::String& setter_name = H.DartSetterName(node->name());
@@ -4322,7 +4440,7 @@
   instructions += TranslateExpression(node->receiver());
   instructions += PushArgument();
   instructions += TranslateExpression(node->value());
-  instructions += StoreLocal(value);
+  instructions += StoreLocal(TokenPosition::kNoSource, value);
   instructions += PushArgument();
   instructions += StaticCall(node->position(), target, 2);
 
@@ -4392,7 +4510,7 @@
     instructions += TranslateInstantiatedTypeArguments(type_arguments);
     instructions += PushArgument();
   } else {
-    ASSERT(node->arguments()->types().length() == 0);
+    // TODO(28109) Support generic methods in the VM or reify them away.
   }
 
   // Special case identical(x, y) call.
@@ -4453,9 +4571,7 @@
   Fragment instructions = TranslateExpression(node->receiver());
   instructions += PushArgument();
 
-  // Dart does not support generic methods yet.
-  ASSERT(node->arguments()->types().length() == 0);
-
+  // TODO(28109) Support generic methods in the VM or reify them away.
   Array& argument_names = Array::ZoneHandle(Z);
   instructions += TranslateArguments(node->arguments(), &argument_names);
 
@@ -4482,7 +4598,7 @@
   intptr_t argument_count = node->arguments()->count() + 1;
   Array& argument_names = Array::ZoneHandle(Z);
 
-  ASSERT(node->arguments()->types().length() == 0);
+  // TODO(28109) Support generic methods in the VM or reify them away.
   Fragment instructions = TranslateExpression(node->receiver());
   instructions += PushArgument();
   instructions += TranslateArguments(node->arguments(), &argument_names);
@@ -4509,26 +4625,21 @@
     const TypeArguments& type_arguments = T.TranslateInstantiatedTypeArguments(
         klass, kernel_type_arguments.raw_array(),
         kernel_type_arguments.length());
+    if (!klass.IsGeneric()) {
+      Type& type = Type::ZoneHandle(Z, T.ReceiverType(klass).raw());
 
-    if (type_arguments.IsNull() || type_arguments.IsInstantiated()) {
-      instructions += TranslateInstantiatedTypeArguments(type_arguments);
+      // TODO(27590): Can we move this code into [ReceiverType]?
+      type ^= ClassFinalizer::FinalizeType(*active_class_.klass, type,
+                                           ClassFinalizer::kFinalize);
+      ASSERT(!type.IsMalformedOrMalbounded());
+
+      TypeArguments& canonicalized_type_arguments =
+          TypeArguments::ZoneHandle(Z, type.arguments());
+      canonicalized_type_arguments =
+          canonicalized_type_arguments.Canonicalize();
+      instructions += Constant(canonicalized_type_arguments);
     } else {
-      if (!klass.IsGeneric()) {
-        Type& type = Type::ZoneHandle(Z, T.ReceiverType(klass).raw());
-
-        // TODO(27590): Can we move this code into [ReceiverType]?
-        type ^= ClassFinalizer::FinalizeType(*active_class_.klass, type,
-                                             ClassFinalizer::kFinalize);
-        ASSERT(!type.IsMalformedOrMalbounded());
-
-        TypeArguments& canonicalized_type_arguments =
-            TypeArguments::ZoneHandle(Z, type.arguments());
-        canonicalized_type_arguments =
-            canonicalized_type_arguments.Canonicalize();
-        instructions += Constant(canonicalized_type_arguments);
-      } else {
-        instructions += TranslateInstantiatedTypeArguments(type_arguments);
-      }
+      instructions += TranslateInstantiatedTypeArguments(type_arguments);
     }
 
     instructions += PushArgument();
@@ -4591,7 +4702,7 @@
     instructions += PushArgument();  // Negate?.
 
     instructions +=
-        InstanceCall(TokenPosition::kNoSource,
+        InstanceCall(node->position(),
                      dart::Library::PrivateCoreLibName(Symbols::_instanceOf()),
                      Token::kIS, 4);
   }
@@ -4651,14 +4762,17 @@
   Value* top = stack_;
   Fragment then_fragment(then_entry);
   then_fragment += TranslateExpression(node->then());
-  then_fragment += StoreLocal(parsed_function_->expression_temp_var());
+  then_fragment += StoreLocal(TokenPosition::kNoSource,
+                              parsed_function_->expression_temp_var());
   then_fragment += Drop();
-
   ASSERT(stack_ == top);
+
   Fragment otherwise_fragment(otherwise_entry);
   otherwise_fragment += TranslateExpression(node->otherwise());
-  otherwise_fragment += StoreLocal(parsed_function_->expression_temp_var());
+  otherwise_fragment += StoreLocal(TokenPosition::kNoSource,
+                                   parsed_function_->expression_temp_var());
   otherwise_fragment += Drop();
+  ASSERT(stack_ == top);
 
   JoinEntryInstr* join = BuildJoinEntry();
   then_fragment += Goto(join);
@@ -4687,14 +4801,16 @@
   right_fragment += Constant(Bool::True());
   right_fragment +=
       StrictCompare(negate ? Token::kNE_STRICT : Token::kEQ_STRICT);
-  right_fragment += StoreLocal(parsed_function_->expression_temp_var());
+  right_fragment += StoreLocal(TokenPosition::kNoSource,
+                               parsed_function_->expression_temp_var());
   right_fragment += Drop();
 
   ASSERT(top == stack_);
   Fragment constant_fragment(constant_entry);
   constant_fragment +=
       Constant(Bool::Get(node->op() == LogicalExpression::kOr));
-  constant_fragment += StoreLocal(parsed_function_->expression_temp_var());
+  constant_fragment += StoreLocal(TokenPosition::kNoSource,
+                                  parsed_function_->expression_temp_var());
   constant_fragment += Drop();
 
   JoinEntryInstr* join = BuildJoinEntry();
@@ -4736,7 +4852,7 @@
     instructions += Drop();
   }
 
-  instructions += StringInterpolate();
+  instructions += StringInterpolate(node->position());
 
   fragment_ = instructions;
 }
@@ -4871,13 +4987,6 @@
 }
 
 
-void FlowGraphBuilder::VisitBlockExpression(BlockExpression* node) {
-  Fragment instructions = TranslateStatement(node->body());
-  instructions += TranslateExpression(node->value());
-  fragment_ = instructions;
-}
-
-
 Fragment FlowGraphBuilder::TranslateArguments(Arguments* node,
                                               Array* argument_names) {
   Fragment instructions;
@@ -4935,15 +5044,16 @@
   if (instructions.is_open()) {
     if (inside_try_finally) {
       ASSERT(scopes_->finally_return_variable != NULL);
-      instructions += StoreLocal(scopes_->finally_return_variable);
+      instructions += StoreLocal(TokenPosition::kNoSource,
+                                 scopes_->finally_return_variable);
       instructions += Drop();
       instructions += TranslateFinallyFinalizers(NULL, -1);
       if (instructions.is_open()) {
         instructions += LoadLocal(scopes_->finally_return_variable);
-        instructions += Return();
+        instructions += Return(node->position());
       }
     } else {
-      instructions += Return();
+      instructions += Return(node->position());
     }
   } else {
     Pop();
@@ -4976,7 +5086,7 @@
       instructions += TranslateExpression(initializer);
     }
   }
-  instructions += StoreLocal(variable);
+  instructions += StoreLocal(variable->token_pos(), variable);
   instructions += Drop();
   fragment_ = instructions;
 }
@@ -4984,7 +5094,8 @@
 
 void FlowGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* node) {
   Fragment instructions = TranslateFunctionNode(node->function(), node);
-  instructions += StoreLocal(LookupVariable(node->variable()));
+  instructions +=
+      StoreLocal(TokenPosition::kNoSource, LookupVariable(node->variable()));
   instructions += Drop();
   fragment_ = instructions;
 }
@@ -5143,7 +5254,7 @@
   instructions +=
       InstanceCall(TokenPosition::kNoSource, iterator_getter, Token::kGET, 1);
   LocalVariable* iterator = scopes_->iterator_variables[for_in_depth_];
-  instructions += StoreLocal(iterator);
+  instructions += StoreLocal(TokenPosition::kNoSource, iterator);
   instructions += Drop();
 
   ++for_in_depth_;
@@ -5164,7 +5275,8 @@
       Z, dart::Field::GetterSymbol(Symbols::Current()));
   body +=
       InstanceCall(TokenPosition::kNoSource, current_getter, Token::kGET, 1);
-  body += StoreLocal(LookupVariable(node->variable()));
+  body +=
+      StoreLocal(TokenPosition::kNoSource, LookupVariable(node->variable()));
   body += Drop();
   body += TranslateStatement(node->body());
   body += ExitScope(node);
@@ -5234,7 +5346,8 @@
   // Instead of using a variable we should reuse the expression on the stack,
   // since it won't be assigned again, we don't need phi nodes.
   Fragment head_instructions = TranslateExpression(node->condition());
-  head_instructions += StoreLocal(scopes_->switch_variable);
+  head_instructions +=
+      StoreLocal(TokenPosition::kNoSource, scopes_->switch_variable);
   head_instructions += Drop();
 
   // Phase 1: Generate bodies and try to find out whether a body will be target
@@ -5274,7 +5387,7 @@
       body_fragment += AllocateObject(klass, 0);
       LocalVariable* instance = MakeTemporary();
 
-      // Call _AssertionError._create constructor.
+      // Call _FallThroughError._create constructor.
       body_fragment += LoadLocal(instance);
       body_fragment += PushArgument();  // this
 
@@ -5465,7 +5578,7 @@
       node->message() != NULL
           ? TranslateExpression(node->message())
           : Constant(H.DartString("<no message>", Heap::kOld));
-  otherwise_fragment += PushArgument();  // message
+  otherwise_fragment += PushArgument();  // failedAssertion
 
   otherwise_fragment += Constant(url);
   otherwise_fragment += PushArgument();  // url
@@ -5476,7 +5589,10 @@
   otherwise_fragment += IntConstant(0);
   otherwise_fragment += PushArgument();  // column
 
-  otherwise_fragment += StaticCall(TokenPosition::kNoSource, constructor, 5);
+  otherwise_fragment += Constant(H.DartString("<no message>", Heap::kOld));
+  otherwise_fragment += PushArgument();  // message
+
+  otherwise_fragment += StaticCall(TokenPosition::kNoSource, constructor, 6);
   otherwise_fragment += Drop();
 
   // Throw _AssertionError exception.
@@ -5589,14 +5705,15 @@
 
     if (catch_clause->exception() != NULL) {
       catch_handler_body += LoadLocal(CurrentException());
-      catch_handler_body +=
-          StoreLocal(LookupVariable(catch_clause->exception()));
+      catch_handler_body += StoreLocal(
+          TokenPosition::kNoSource, LookupVariable(catch_clause->exception()));
       catch_handler_body += Drop();
     }
     if (catch_clause->stack_trace() != NULL) {
       catch_handler_body += LoadLocal(CurrentStackTrace());
       catch_handler_body +=
-          StoreLocal(LookupVariable(catch_clause->stack_trace()));
+          StoreLocal(TokenPosition::kNoSource,
+                     LookupVariable(catch_clause->stack_trace()));
       catch_handler_body += Drop();
     }
     AbstractType* type_guard = NULL;
@@ -5686,13 +5803,15 @@
   // Continuation<:await_jump_var> upon entry to the function.
   //
   Fragment instructions = IntConstant(yield_continuations_.length() + 1);
-  instructions += StoreLocal(scopes_->yield_jump_variable);
+  instructions +=
+      StoreLocal(TokenPosition::kNoSource, scopes_->yield_jump_variable);
   instructions += Drop();
   instructions += LoadLocal(parsed_function_->current_context_var());
-  instructions += StoreLocal(scopes_->yield_context_variable);
+  instructions +=
+      StoreLocal(TokenPosition::kNoSource, scopes_->yield_context_variable);
   instructions += Drop();
   instructions += TranslateExpression(node->expression());
-  instructions += Return();
+  instructions += Return(TokenPosition::kNoSource);
 
   // Note: DropTempsInstr serves as an anchor instruction. It will not
   // be linked into the resulting graph.
@@ -5747,16 +5866,24 @@
 Fragment FlowGraphBuilder::TranslateFunctionNode(FunctionNode* node,
                                                  TreeNode* parent) {
   // The VM has a per-isolate table of functions indexed by the enclosing
-  // function and token position.  We don't have token positions, so we've
-  // simply numbered the immediately-nested functions with respect to the
-  // parent.
+  // function and token position.
   Function& function = Function::ZoneHandle(Z);
   for (intptr_t i = 0; i < scopes_->function_scopes.length(); ++i) {
     if (scopes_->function_scopes[i].function != node) continue;
 
+    TokenPosition position = node->position();
+    if (parent->IsFunctionDeclaration()) {
+      position = FunctionDeclaration::Cast(parent)->position();
+    }
+    if (!position.IsReal()) {
+      // Positions has to be unique in regards to the parent.
+      // A non-real at this point is probably -1, we cannot blindly use that
+      // as others might use it too. Create a new dummy non-real TokenPosition.
+      position = TokenPosition(i).ToSynthetic();
+    }
+
     // NOTE: This is not TokenPosition in the general sense!
-    function = I->LookupClosureFunction(parsed_function_->function(),
-                                        TokenPosition(i));
+    function = I->LookupClosureFunction(parsed_function_->function(), position);
     if (function.IsNull()) {
       const dart::String* name;
       if (parent->IsFunctionExpression()) {
@@ -5768,8 +5895,9 @@
       }
       // NOTE: This is not TokenPosition in the general sense!
       function = Function::NewClosureFunction(
-          *name, parsed_function_->function(), TokenPosition(i));
-      function.set_is_debuggable(false);
+          *name, parsed_function_->function(), position);
+      function.set_is_debuggable(node->debuggable());
+      function.set_end_token_pos(node->end_position());
       LocalScope* scope = scopes_->function_scopes[i].scope;
       const ContextScope& context_scope =
           ContextScope::Handle(Z, scope->PreserveOuterScope(context_depth_));
@@ -5811,6 +5939,116 @@
 }
 
 
+RawObject* EvaluateMetadata(TreeNode* const kernel_node) {
+  LongJumpScope jump;
+  if (setjmp(*jump.Set()) == 0) {
+    Thread* thread = Thread::Current();
+    Zone* zone_ = thread->zone();
+
+    List<Expression>* metadata_expressions = NULL;
+    if (kernel_node->IsClass()) {
+      metadata_expressions = &Class::Cast(kernel_node)->annotations();
+    } else if (kernel_node->IsProcedure()) {
+      metadata_expressions = &Procedure::Cast(kernel_node)->annotations();
+    } else if (kernel_node->IsField()) {
+      metadata_expressions = &Field::Cast(kernel_node)->annotations();
+    } else if (kernel_node->IsConstructor()) {
+      metadata_expressions = &Constructor::Cast(kernel_node)->annotations();
+    } else {
+      FATAL1("No support for metadata on this type of kernel node %p\n",
+             kernel_node);
+    }
+
+    TranslationHelper translation_helper(thread);
+    DartTypeTranslator type_translator(&translation_helper, NULL, true);
+    ConstantEvaluator constant_evaluator(/* flow_graph_builder = */ NULL, Z,
+                                         &translation_helper, &type_translator);
+
+    const Array& metadata_values =
+        Array::Handle(Z, Array::New(metadata_expressions->length()));
+
+    for (intptr_t i = 0; i < metadata_expressions->length(); i++) {
+      const Instance& value =
+          constant_evaluator.EvaluateExpression((*metadata_expressions)[i]);
+      metadata_values.SetAt(i, value);
+    }
+
+    return metadata_values.raw();
+  } else {
+    Thread* thread = Thread::Current();
+    Error& error = Error::Handle();
+    error = thread->sticky_error();
+    thread->clear_sticky_error();
+    return error.raw();
+  }
+}
+
+
+RawObject* BuildParameterDescriptor(TreeNode* const kernel_node) {
+  LongJumpScope jump;
+  if (setjmp(*jump.Set()) == 0) {
+    FunctionNode* function_node = NULL;
+
+    if (kernel_node->IsProcedure()) {
+      function_node = Procedure::Cast(kernel_node)->function();
+    } else if (kernel_node->IsConstructor()) {
+      function_node = Constructor::Cast(kernel_node)->function();
+    } else if (kernel_node->IsFunctionNode()) {
+      function_node = FunctionNode::Cast(kernel_node);
+    } else {
+      UNIMPLEMENTED();
+      return NULL;
+    }
+
+    Thread* thread = Thread::Current();
+    Zone* zone_ = thread->zone();
+    TranslationHelper translation_helper(thread);
+    DartTypeTranslator type_translator(&translation_helper, NULL, true);
+    ConstantEvaluator constant_evaluator(/* flow_graph_builder = */ NULL, Z,
+                                         &translation_helper, &type_translator);
+
+
+    intptr_t param_count = function_node->positional_parameters().length() +
+                           function_node->named_parameters().length();
+    const Array& param_descriptor = Array::Handle(
+        Array::New(param_count * Parser::kParameterEntrySize, Heap::kOld));
+    for (intptr_t i = 0; i < param_count; ++i) {
+      VariableDeclaration* variable;
+      if (i < function_node->positional_parameters().length()) {
+        variable = function_node->positional_parameters()[i];
+      } else {
+        variable = function_node->named_parameters()[i];
+      }
+
+      param_descriptor.SetAt(
+          i + Parser::kParameterIsFinalOffset,
+          variable->IsFinal() ? Bool::True() : Bool::False());
+
+      if (variable->initializer() != NULL) {
+        param_descriptor.SetAt(
+            i + Parser::kParameterDefaultValueOffset,
+            constant_evaluator.EvaluateExpression(variable->initializer()));
+      } else {
+        param_descriptor.SetAt(i + Parser::kParameterDefaultValueOffset,
+                               Object::null_instance());
+      }
+
+      param_descriptor.SetAt(i + Parser::kParameterMetadataOffset,
+                             /* Issue(28434): Missing parameter metadata. */
+                             Object::null_instance());
+    }
+    return param_descriptor.raw();
+  } else {
+    Thread* thread = Thread::Current();
+    Error& error = Error::Handle();
+    error = thread->sticky_error();
+    thread->clear_sticky_error();
+    return error.raw();
+  }
+}
+
+
 }  // namespace kernel
 }  // namespace dart
+
 #endif  // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/kernel_to_il.h b/runtime/vm/kernel_to_il.h
index 3f9db3e..1f374f5 100644
--- a/runtime/vm/kernel_to_il.h
+++ b/runtime/vm/kernel_to_il.h
@@ -75,8 +75,42 @@
       return pair->value;
     }
   }
+
+  inline Pair* LookupPair(const Key& key) {
+    return DirectChainedHashMap<RawPointerKeyValueTrait<K, V> >::Lookup(key);
+  }
 };
 
+template <typename K, typename V>
+class MallocMap
+    : public MallocDirectChainedHashMap<RawPointerKeyValueTrait<K, V> > {
+ public:
+  typedef typename RawPointerKeyValueTrait<K, V>::Key Key;
+  typedef typename RawPointerKeyValueTrait<K, V>::Value Value;
+  typedef typename RawPointerKeyValueTrait<K, V>::Pair Pair;
+
+  inline void Insert(const Key& key, const Value& value) {
+    Pair pair(key, value);
+    MallocDirectChainedHashMap<RawPointerKeyValueTrait<K, V> >::Insert(pair);
+  }
+
+  inline V Lookup(const Key& key) {
+    Pair* pair =
+        MallocDirectChainedHashMap<RawPointerKeyValueTrait<K, V> >::Lookup(key);
+    if (pair == NULL) {
+      return V();
+    } else {
+      return pair->value;
+    }
+  }
+
+  inline Pair* LookupPair(const Key& key) {
+    return MallocDirectChainedHashMap<RawPointerKeyValueTrait<K, V> >::Lookup(
+        key);
+  }
+};
+
+
 class BreakableBlock;
 class CatchBlock;
 class FlowGraphBuilder;
@@ -188,12 +222,12 @@
 
 class TranslationHelper {
  public:
-  TranslationHelper(dart::Thread* thread, dart::Zone* zone, Isolate* isolate)
+  explicit TranslationHelper(dart::Thread* thread)
       : thread_(thread),
-        zone_(zone),
-        isolate_(isolate),
-        allocation_space_(thread_->IsMutatorThread() ? Heap::kNew
-                                                     : Heap::kOld) {}
+        zone_(thread->zone()),
+        isolate_(thread->isolate()),
+        allocation_space_(thread->IsMutatorThread() ? Heap::kNew : Heap::kOld) {
+  }
   virtual ~TranslationHelper() {}
 
   Thread* thread() { return thread_; }
@@ -284,6 +318,7 @@
                      bool finalize = false)
       : translation_helper_(*helper),
         active_class_(active_class),
+        type_parameter_scope_(NULL),
         zone_(helper->zone()),
         result_(AbstractType::Handle(helper->zone())),
         finalize_(finalize) {}
@@ -327,11 +362,31 @@
   const Type& ReceiverType(const dart::Class& klass);
 
  private:
+  class TypeParameterScope {
+   public:
+    TypeParameterScope(DartTypeTranslator* translator,
+                       List<TypeParameter>* parameters)
+        : parameters_(parameters),
+          outer_(translator->type_parameter_scope_),
+          translator_(translator) {
+      translator_->type_parameter_scope_ = this;
+    }
+    ~TypeParameterScope() { translator_->type_parameter_scope_ = outer_; }
+
+    TypeParameterScope* outer() const { return outer_; }
+    List<TypeParameter>* parameters() const { return parameters_; }
+
+   private:
+    List<TypeParameter>* parameters_;
+    TypeParameterScope* outer_;
+    DartTypeTranslator* translator_;
+  };
+
   TranslationHelper& translation_helper_;
   ActiveClass* active_class_;
+  TypeParameterScope* type_parameter_scope_;
   Zone* zone_;
   AbstractType& result_;
-
   bool finalize_;
 };
 
@@ -393,6 +448,7 @@
   virtual void VisitConditionalExpression(ConditionalExpression* node);
   virtual void VisitLogicalExpression(LogicalExpression* node);
   virtual void VisitNot(Not* node);
+  virtual void VisitPropertyGet(PropertyGet* node);
 
  private:
   // This will translate type arguments form [kernel_arguments].  If no type
@@ -498,8 +554,8 @@
       : result_(NULL),
         parsed_function_(parsed_function),
         node_(node),
-        zone_(Thread::Current()->zone()),
-        translation_helper_(Thread::Current(), zone_, Isolate::Current()),
+        translation_helper_(Thread::Current()),
+        zone_(translation_helper_.zone()),
         type_translator_(&translation_helper_,
                          &active_class_,
                          /*finalize=*/true),
@@ -540,11 +596,13 @@
   virtual void VisitConstructor(Constructor* node);
 
  private:
-  void EnterScope(TreeNode* node);
-  void ExitScope();
+  void EnterScope(TreeNode* node, TokenPosition start_position);
+  void ExitScope(TokenPosition end_position);
 
   const Type& TranslateVariableType(VariableDeclaration* variable);
-  LocalVariable* MakeVariable(const dart::String& name,
+  LocalVariable* MakeVariable(TokenPosition declaration_pos,
+                              TokenPosition token_pos,
+                              const dart::String& name,
                               const AbstractType& type);
 
   void AddParameters(FunctionNode* function, intptr_t pos = 0);
@@ -594,8 +652,8 @@
 
   ActiveClass active_class_;
 
-  Zone* zone_;
   TranslationHelper translation_helper_;
+  Zone* zone_;
   DartTypeTranslator type_translator_;
 
   FunctionNode* current_function_node_;
@@ -607,7 +665,7 @@
 };
 
 
-class FlowGraphBuilder : public TreeVisitor {
+class FlowGraphBuilder : public ExpressionVisitor, public StatementVisitor {
  public:
   FlowGraphBuilder(TreeNode* node,
                    ParsedFunction* parsed_function,
@@ -619,7 +677,8 @@
 
   FlowGraph* BuildGraph();
 
-  virtual void VisitDefaultTreeNode(TreeNode* node) { UNREACHABLE(); }
+  virtual void VisitDefaultExpression(Expression* node) { UNREACHABLE(); }
+  virtual void VisitDefaultStatement(Statement* node) { UNREACHABLE(); }
 
   virtual void VisitInvalidExpression(InvalidExpression* node);
   virtual void VisitNullLiteral(NullLiteral* node);
@@ -655,7 +714,6 @@
   virtual void VisitLet(Let* node);
   virtual void VisitThrow(Throw* node);
   virtual void VisitRethrow(Rethrow* node);
-  virtual void VisitBlockExpression(BlockExpression* node);
 
   virtual void VisitInvalidStatement(InvalidStatement* node);
   virtual void VisitEmptyStatement(EmptyStatement* node);
@@ -697,6 +755,7 @@
 
   TargetEntryInstr* BuildTargetEntry();
   JoinEntryInstr* BuildJoinEntry();
+  JoinEntryInstr* BuildJoinEntry(intptr_t try_index);
 
   Fragment TranslateArguments(Arguments* node, Array* argument_names);
   ArgumentArray GetArguments(int count);
@@ -723,6 +782,7 @@
   Fragment PopContext();
 
   Fragment LoadInstantiatorTypeArguments();
+  Fragment InstantiateType(const AbstractType& type);
   Fragment InstantiateTypeArguments(const TypeArguments& type_arguments);
   Fragment TranslateInstantiatedTypeArguments(
       const TypeArguments& type_arguments);
@@ -781,7 +841,7 @@
   Fragment NullConstant();
   Fragment NativeCall(const dart::String* name, const Function* function);
   Fragment PushArgument();
-  Fragment Return();
+  Fragment Return(TokenPosition position);
   Fragment StaticCall(TokenPosition position,
                       const Function& target,
                       intptr_t argument_count);
@@ -790,16 +850,18 @@
                       intptr_t argument_count,
                       const Array& argument_names);
   Fragment StoreIndexed(intptr_t class_id);
-  Fragment StoreInstanceFieldGuarded(const dart::Field& field);
+  Fragment StoreInstanceFieldGuarded(const dart::Field& field,
+                                     bool is_initialization_store);
   Fragment StoreInstanceField(
       const dart::Field& field,
+      bool is_initialization_store,
       StoreBarrierType emit_store_barrier = kEmitStoreBarrier);
   Fragment StoreInstanceField(
       intptr_t offset,
       StoreBarrierType emit_store_barrier = kEmitStoreBarrier);
-  Fragment StoreLocal(LocalVariable* variable);
+  Fragment StoreLocal(TokenPosition position, LocalVariable* variable);
   Fragment StoreStaticField(const dart::Field& field);
-  Fragment StringInterpolate();
+  Fragment StringInterpolate(TokenPosition position);
   Fragment ThrowTypeError();
   Fragment ThrowNoSuchMethodError();
   Fragment BuildImplicitClosureCreation(const Function& target);
@@ -833,8 +895,8 @@
 
   void InlineBailout(const char* reason);
 
-  Zone* zone_;
   TranslationHelper translation_helper_;
+  Zone* zone_;
 
   // The node we are currently compiling (e.g. FunctionNode, Constructor,
   // Field)
@@ -922,6 +984,24 @@
   friend class TryFinallyBlock;
 };
 
+RawObject* EvaluateMetadata(TreeNode* const kernel_node);
+RawObject* BuildParameterDescriptor(TreeNode* const kernel_node);
+
+
+}  // namespace kernel
+}  // namespace dart
+
+#else  // !defined(DART_PRECOMPILED_RUNTIME)
+
+#include "vm/object.h"
+#include "vm/kernel.h"
+
+namespace dart {
+namespace kernel {
+
+RawObject* EvaluateMetadata(TreeNode* const kernel_node);
+RawObject* BuildParameterDescriptor(TreeNode* const kernel_node);
+
 }  // namespace kernel
 }  // namespace dart
 
diff --git a/runtime/vm/locations.h b/runtime/vm/locations.h
index c2d815b..2497264 100644
--- a/runtime/vm/locations.h
+++ b/runtime/vm/locations.h
@@ -32,7 +32,6 @@
   kUnboxedInt32x4,
   kUnboxedFloat64x2,
   kPairOfTagged,
-  kPairOfUnboxedDouble,
   kNumRepresentations
 };
 
diff --git a/runtime/vm/log_test.cc b/runtime/vm/log_test.cc
index 84ef855..aa95f09 100644
--- a/runtime/vm/log_test.cc
+++ b/runtime/vm/log_test.cc
@@ -16,7 +16,7 @@
 
 namespace dart {
 
-static const char* test_output_;
+static const char* test_output_ = NULL;
 static void TestPrinter(const char* format, ...) {
   // Measure.
   va_list args;
@@ -31,7 +31,10 @@
   OS::VSNPrint(buffer, (len + 1), format, args2);
   va_end(args2);
 
-  // Leaks buffer.
+  if (test_output_ != NULL) {
+    free(const_cast<char*>(test_output_));
+    test_output_ = NULL;
+  }
   test_output_ = buffer;
 }
 
@@ -42,6 +45,13 @@
     ASSERT(printer != NULL);
     log->printer_ = printer;
   }
+
+  static void FreeTestOutput() {
+    if (test_output_ != NULL) {
+      free(const_cast<char*>(test_output_));
+      test_output_ = NULL;
+    }
+  }
 };
 
 
@@ -54,6 +64,7 @@
   EXPECT_STREQ("Hello World", test_output_);
   THR_Print("SingleArgument");
   EXPECT_STREQ("SingleArgument", test_output_);
+  LogTestHelper::FreeTestOutput();
 }
 
 
@@ -64,6 +75,9 @@
   EXPECT_EQ(reinterpret_cast<const char*>(NULL), test_output_);
   log->Print("Hello %s", "World");
   EXPECT_STREQ("Hello World", test_output_);
+
+  delete log;
+  LogTestHelper::FreeTestOutput();
 }
 
 
@@ -84,6 +98,8 @@
     EXPECT_STREQ("BANANA", test_output_);
   }
   EXPECT_STREQ("APPLE", test_output_);
+  delete log;
+  LogTestHelper::FreeTestOutput();
 }
 
 }  // namespace dart
diff --git a/runtime/vm/malloc_hooks.cc b/runtime/vm/malloc_hooks.cc
new file mode 100644
index 0000000..65edca7
--- /dev/null
+++ b/runtime/vm/malloc_hooks.cc
@@ -0,0 +1,17 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#if defined(DART_USE_TCMALLOC)
+
+#include "vm/malloc_hooks.h"
+
+namespace dart {
+
+void MallocHooks::Init() {
+  // TODO(bkonyi): Implement
+}
+
+}  // namespace dart
+
+#endif  // defined(DART_USE_TCMALLOC)
diff --git a/runtime/vm/malloc_hooks.h b/runtime/vm/malloc_hooks.h
new file mode 100644
index 0000000..ae09402
--- /dev/null
+++ b/runtime/vm/malloc_hooks.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef RUNTIME_VM_MALLOC_HOOKS_H_
+#define RUNTIME_VM_MALLOC_HOOKS_H_
+
+#include "vm/globals.h"
+
+namespace dart {
+
+class MallocHooks {
+  static void Init();
+
+ private:
+  DISALLOW_ALLOCATION();
+  DISALLOW_IMPLICIT_CONSTRUCTORS(MallocHooks);
+};
+
+}  // namespace dart
+
+#endif  // RUNTIME_VM_MALLOC_HOOKS_H_
diff --git a/runtime/vm/malloc_hooks_unsupported.cc b/runtime/vm/malloc_hooks_unsupported.cc
new file mode 100644
index 0000000..65edca7
--- /dev/null
+++ b/runtime/vm/malloc_hooks_unsupported.cc
@@ -0,0 +1,17 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#if defined(DART_USE_TCMALLOC)
+
+#include "vm/malloc_hooks.h"
+
+namespace dart {
+
+void MallocHooks::Init() {
+  // TODO(bkonyi): Implement
+}
+
+}  // namespace dart
+
+#endif  // defined(DART_USE_TCMALLOC)
diff --git a/runtime/vm/megamorphic_cache_table.cc b/runtime/vm/megamorphic_cache_table.cc
index c6edb75..33df09a 100644
--- a/runtime/vm/megamorphic_cache_table.cc
+++ b/runtime/vm/megamorphic_cache_table.cc
@@ -73,9 +73,11 @@
   function.set_is_debuggable(false);
   function.set_is_visible(false);
   function.AttachCode(code);  // Has a single entry point, as a static function.
-  // For inclusion in Snapshot::kAppWithJIT.
+  // For inclusion in Snapshot::kAppJIT.
   function.set_unoptimized_code(code);
 
+  ASSERT(isolate->object_store()->megamorphic_miss_function() ==
+         Function::null());
   isolate->object_store()->SetMegamorphicMissHandler(code, function);
 }
 
diff --git a/runtime/vm/message_handler.cc b/runtime/vm/message_handler.cc
index f98ec65..649ae66 100644
--- a/runtime/vm/message_handler.cc
+++ b/runtime/vm/message_handler.cc
@@ -332,6 +332,8 @@
   MessageStatus status = kOK;
   bool run_end_callback = false;
   bool delete_me = false;
+  EndCallback end_callback = NULL;
+  CallbackData callback_data = 0;
   {
     // We will occasionally release and reacquire this monitor in this
     // function. Whenever we reacquire the monitor we *must* process
@@ -414,7 +416,10 @@
         }
       }
       pool_ = NULL;
-      run_end_callback = true;
+      // Decide if we have a callback before releasing the monitor.
+      end_callback = end_callback_;
+      callback_data = callback_data_;
+      run_end_callback = end_callback_ != NULL;
       delete_me = delete_me_;
     }
 
@@ -424,11 +429,15 @@
     task_ = NULL;
   }
 
-  // Message handlers either use delete_me or end_callback but not both.
-  ASSERT(!delete_me || end_callback_ == NULL);
+  // The handler may have been deleted by another thread here if it is a native
+  // message handler.
 
-  if (run_end_callback && end_callback_ != NULL) {
-    end_callback_(callback_data_);
+  // Message handlers either use delete_me or end_callback but not both.
+  ASSERT(!delete_me || !run_end_callback);
+
+  if (run_end_callback) {
+    ASSERT(end_callback != NULL);
+    end_callback(callback_data);
     // The handler may have been deleted after this point.
   }
   if (delete_me) {
diff --git a/runtime/vm/message_handler_test.cc b/runtime/vm/message_handler_test.cc
index fedb823..0e636d7 100644
--- a/runtime/vm/message_handler_test.cc
+++ b/runtime/vm/message_handler_test.cc
@@ -405,6 +405,7 @@
   handler_peer.decrement_live_ports();
   EXPECT(!handler.HasLivePorts());
   PortMap::ClosePorts(&handler);
+  delete[] ports;
 }
 
 }  // namespace dart
diff --git a/runtime/vm/method_recognizer.h b/runtime/vm/method_recognizer.h
index 5ab5eac..1e0a4bc 100644
--- a/runtime/vm/method_recognizer.h
+++ b/runtime/vm/method_recognizer.h
@@ -15,321 +15,323 @@
 // correct fingerprint from the mismatch error.
 #define OTHER_RECOGNIZED_LIST(V)                                               \
   V(::, identical, ObjectIdentical, Bool, 0x49c6e96a)                          \
-  V(ClassID, getID, ClassIDgetID, Smi, 0x528fd455)                             \
+  V(ClassID, getID, ClassIDgetID, Smi, 0x66d44356)                             \
   V(Object, Object., ObjectConstructor, Dynamic, 0x681617fe)                   \
-  V(_List, ., ObjectArrayAllocate, Array, 0x63078b15)                          \
-  V(_TypedList, _getInt8, ByteArrayBaseGetInt8, Smi, 0x59e7291d)               \
-  V(_TypedList, _getUint8, ByteArrayBaseGetUint8, Smi, 0x38d3e5bf)             \
-  V(_TypedList, _getInt16, ByteArrayBaseGetInt16, Smi, 0x19dde22c)             \
-  V(_TypedList, _getUint16, ByteArrayBaseGetUint16, Smi, 0x4f3dbe58)           \
-  V(_TypedList, _getInt32, ByteArrayBaseGetInt32, Dynamic, 0x082db131)         \
-  V(_TypedList, _getUint32, ByteArrayBaseGetUint32, Dynamic, 0x1dcbfb98)       \
-  V(_TypedList, _getInt64, ByteArrayBaseGetInt64, Dynamic, 0x61b71474)         \
-  V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, Double, 0x63b56e15)      \
-  V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, Double, 0x399dacf8)      \
+  V(_List, ., ObjectArrayAllocate, Array, 0x6c3b54ee)                          \
+  V(_TypedList, _getInt8, ByteArrayBaseGetInt8, Smi, 0x7041895a)               \
+  V(_TypedList, _getUint8, ByteArrayBaseGetUint8, Smi, 0x336fa3ea)             \
+  V(_TypedList, _getInt16, ByteArrayBaseGetInt16, Smi, 0x231bbe2e)             \
+  V(_TypedList, _getUint16, ByteArrayBaseGetUint16, Smi, 0x0371785f)           \
+  V(_TypedList, _getInt32, ByteArrayBaseGetInt32, Dynamic, 0x65ab3a20)         \
+  V(_TypedList, _getUint32, ByteArrayBaseGetUint32, Dynamic, 0x0cb0fcf6)       \
+  V(_TypedList, _getInt64, ByteArrayBaseGetInt64, Dynamic, 0x7db75d78)         \
+  V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, Double, 0x6674ea6f)      \
+  V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, Double, 0x236c6e7a)      \
   V(_TypedList, _getFloat32x4, ByteArrayBaseGetFloat32x4, Float32x4,           \
-    0x4761a5be)                                                                \
-  V(_TypedList, _getInt32x4, ByteArrayBaseGetInt32x4, Int32x4, 0x3053e92c)     \
-  V(_TypedList, _setInt8, ByteArrayBaseSetInt8, Dynamic, 0x4e82d1e9)           \
-  V(_TypedList, _setUint8, ByteArrayBaseSetUint8, Dynamic, 0x4f3587fc)         \
-  V(_TypedList, _setInt16, ByteArrayBaseSetInt16, Dynamic, 0x6cef30ee)         \
-  V(_TypedList, _setUint16, ByteArrayBaseSetUint16, Dynamic, 0x64f938ac)       \
-  V(_TypedList, _setInt32, ByteArrayBaseSetInt32, Dynamic, 0x3693c029)         \
-  V(_TypedList, _setUint32, ByteArrayBaseSetUint32, Dynamic, 0x74bbf260)       \
-  V(_TypedList, _setInt64, ByteArrayBaseSetInt64, Dynamic, 0x75764edb)         \
-  V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, Dynamic, 0x6e72f2a4)     \
-  V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, Dynamic, 0x4765edda)     \
-  V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, Dynamic, 0x7cca4533) \
-  V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, Dynamic, 0x7631bdbc)     \
-  V(_StringBase, _interpolate, StringBaseInterpolate, Dynamic, 0x6f98eb49)     \
-  V(_IntegerImplementation, toDouble, IntegerToDouble, Double, 0x2f409861)     \
-  V(_Double, _add, DoubleAdd, Double, 0x0021c560)                              \
-  V(_Double, _sub, DoubleSub, Double, 0x419b3c66)                              \
-  V(_Double, _mul, DoubleMul, Double, 0x1a08cbe1)                              \
-  V(_Double, _div, DoubleDiv, Double, 0x38d2770f)                              \
-  V(::, min, MathMin, Dynamic, 0x4276561c)                                     \
-  V(::, max, MathMax, Dynamic, 0x54121d6a)                                     \
-  V(::, _doublePow, MathDoublePow, Double, 0x698eb78d)                         \
-  V(Float32x4, Float32x4., Float32x4Constructor, Float32x4, 0x05968999)        \
-  V(Float32x4, Float32x4.zero, Float32x4Zero, Float32x4, 0x472a4c46)           \
-  V(Float32x4, Float32x4.splat, Float32x4Splat, Float32x4, 0x00bba1a5)         \
+    0x5c367ffb)                                                                \
+  V(_TypedList, _getInt32x4, ByteArrayBaseGetInt32x4, Int32x4, 0x772d1c0f)     \
+  V(_TypedList, _setInt8, ByteArrayBaseSetInt8, Dynamic, 0x7dd630a9)           \
+  V(_TypedList, _setUint8, ByteArrayBaseSetUint8, Dynamic, 0x009d6a08)         \
+  V(_TypedList, _setInt16, ByteArrayBaseSetInt16, Dynamic, 0x0a9d8539)         \
+  V(_TypedList, _setUint16, ByteArrayBaseSetUint16, Dynamic, 0x0339aa55)       \
+  V(_TypedList, _setInt32, ByteArrayBaseSetInt32, Dynamic, 0x68f6ecc6)         \
+  V(_TypedList, _setUint32, ByteArrayBaseSetUint32, Dynamic, 0x5f249ccc)       \
+  V(_TypedList, _setInt64, ByteArrayBaseSetInt64, Dynamic, 0x325c86ad)         \
+  V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, Dynamic, 0x6ef655ba)     \
+  V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, Dynamic, 0x23c3584c)     \
+  V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, Dynamic, 0x2b20798d) \
+  V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, Dynamic, 0x72d3ec93)     \
+  V(_StringBase, _interpolate, StringBaseInterpolate, Dynamic, 0x051d283a)     \
+  V(_IntegerImplementation, toDouble, IntegerToDouble, Double, 0x09b4f74c)     \
+  V(_Double, _add, DoubleAdd, Double, 0x2a38277b)                              \
+  V(_Double, _sub, DoubleSub, Double, 0x4f466391)                              \
+  V(_Double, _mul, DoubleMul, Double, 0x175e4f66)                              \
+  V(_Double, _div, DoubleDiv, Double, 0x0854181b)                              \
+  V(::, min, MathMin, Dynamic, 0x154735b3)                                     \
+  V(::, max, MathMax, Dynamic, 0x217af195)                                     \
+  V(::, _doublePow, MathDoublePow, Double, 0x61369cfd)                         \
+  V(Float32x4, Float32x4., Float32x4Constructor, Float32x4, 0x5640679a)        \
+  V(Float32x4, Float32x4.zero, Float32x4Zero, Float32x4, 0x2f0b7925)           \
+  V(Float32x4, Float32x4.splat, Float32x4Splat, Float32x4, 0x750512c4)         \
   V(Float32x4, Float32x4.fromInt32x4Bits, Float32x4FromInt32x4Bits, Float32x4, \
-    0x46d00995)                                                                \
+    0x3b197ab4)                                                                \
   V(Float32x4, Float32x4.fromFloat64x2, Float32x4FromFloat64x2, Float32x4,     \
-    0x685a86d2)                                                                \
-  V(Float32x4, shuffle, Float32x4Shuffle, Float32x4, 0x7829101f)               \
-  V(Float32x4, shuffleMix, Float32x4ShuffleMix, Float32x4, 0x4182c06b)         \
-  V(Float32x4, get:signMask, Float32x4GetSignMask, Dynamic, 0x1d07ca93)        \
-  V(Float32x4, _cmpequal, Float32x4Equal, Int32x4, 0x079804cb)                 \
-  V(Float32x4, _cmpgt, Float32x4GreaterThan, Int32x4, 0x7e441585)              \
-  V(Float32x4, _cmpgte, Float32x4GreaterThanOrEqual, Int32x4, 0x213f782d)      \
-  V(Float32x4, _cmplt, Float32x4LessThan, Int32x4, 0x3f481f31)                 \
-  V(Float32x4, _cmplte, Float32x4LessThanOrEqual, Int32x4, 0x061db061)         \
-  V(Float32x4, _cmpnequal, Float32x4NotEqual, Int32x4, 0x6fada13e)             \
-  V(Float32x4, _min, Float32x4Min, Float32x4, 0x4505ee78)                      \
-  V(Float32x4, _max, Float32x4Max, Float32x4, 0x071681c6)                      \
-  V(Float32x4, _scale, Float32x4Scale, Float32x4, 0x18c7f49d)                  \
-  V(Float32x4, _sqrt, Float32x4Sqrt, Float32x4, 0x734e6ad0)                    \
-  V(Float32x4, _reciprocalSqrt, Float32x4ReciprocalSqrt, Float32x4,            \
-    0x5e8a97f6)                                                                \
-  V(Float32x4, _reciprocal, Float32x4Reciprocal, Float32x4, 0x626f6106)        \
-  V(Float32x4, _negate, Float32x4Negate, Float32x4, 0x7fb3a154)                \
-  V(Float32x4, _abs, Float32x4Absolute, Float32x4, 0x1420f447)                 \
-  V(Float32x4, _clamp, Float32x4Clamp, Float32x4, 0x4200222d)                  \
-  V(Float32x4, withX, Float32x4WithX, Float32x4, 0x4e336aff)                   \
-  V(Float32x4, withY, Float32x4WithY, Float32x4, 0x0a72b910)                   \
-  V(Float32x4, withZ, Float32x4WithZ, Float32x4, 0x31e93658)                   \
-  V(Float32x4, withW, Float32x4WithW, Float32x4, 0x60ddc105)                   \
-  V(Float64x2, Float64x2., Float64x2Constructor, Float64x2, 0x193be61d)        \
-  V(Float64x2, Float64x2.zero, Float64x2Zero, Float64x2, 0x7b2ed5df)           \
-  V(Float64x2, Float64x2.splat, Float64x2Splat, Float64x2, 0x2abbfcb2)         \
+    0x5ca3f7f1)                                                                \
+  V(_Float32x4, shuffle, Float32x4Shuffle, Float32x4, 0x7829101f)              \
+  V(_Float32x4, shuffleMix, Float32x4ShuffleMix, Float32x4, 0x4182c06b)        \
+  V(_Float32x4, get:signMask, Float32x4GetSignMask, Dynamic, 0x1d083ef2)       \
+  V(_Float32x4, equal, Float32x4Equal, Int32x4, 0x11adb239)                    \
+  V(_Float32x4, greaterThan, Float32x4GreaterThan, Int32x4, 0x48adaf58)        \
+  V(_Float32x4, greaterThanOrEqual, Float32x4GreaterThanOrEqual, Int32x4,      \
+    0x32db94ca)                                                                \
+  V(_Float32x4, lessThan, Float32x4LessThan, Int32x4, 0x425b000c)              \
+  V(_Float32x4, lessThanOrEqual, Float32x4LessThanOrEqual, Int32x4,            \
+    0x0278c2f8)                                                                \
+  V(_Float32x4, notEqual, Float32x4NotEqual, Int32x4, 0x2987cd26)              \
+  V(_Float32x4, min, Float32x4Min, Float32x4, 0x5ed74b6f)                      \
+  V(_Float32x4, max, Float32x4Max, Float32x4, 0x68696442)                      \
+  V(_Float32x4, scale, Float32x4Scale, Float32x4, 0x704e4122)                  \
+  V(_Float32x4, sqrt, Float32x4Sqrt, Float32x4, 0x2c967a6f)                    \
+  V(_Float32x4, reciprocalSqrt, Float32x4ReciprocalSqrt, Float32x4,            \
+    0x6264bfe8)                                                                \
+  V(_Float32x4, reciprocal, Float32x4Reciprocal, Float32x4, 0x3cd7e819)        \
+  V(_Float32x4, unary-, Float32x4Negate, Float32x4, 0x35f7f2b3)                \
+  V(_Float32x4, abs, Float32x4Absolute, Float32x4, 0x471cdd87)                 \
+  V(_Float32x4, clamp, Float32x4Clamp, Float32x4, 0x2cb30492)                  \
+  V(_Float32x4, withX, Float32x4WithX, Float32x4, 0x4e336aff)                  \
+  V(_Float32x4, withY, Float32x4WithY, Float32x4, 0x0a72b910)                  \
+  V(_Float32x4, withZ, Float32x4WithZ, Float32x4, 0x31e93658)                  \
+  V(_Float32x4, withW, Float32x4WithW, Float32x4, 0x60ddc105)                  \
+  V(Float64x2, Float64x2., Float64x2Constructor, Float64x2, 0x2e2098de)        \
+  V(Float64x2, Float64x2.zero, Float64x2Zero, Float64x2, 0x631002be)           \
+  V(Float64x2, Float64x2.splat, Float64x2Splat, Float64x2, 0x1f056dd1)         \
   V(Float64x2, Float64x2.fromFloat32x4, Float64x2FromFloat32x4, Float64x2,     \
-    0x2f43d3a6)                                                                \
-  V(Float64x2, get:x, Float64x2GetX, Double, 0x58bfb39a)                       \
-  V(Float64x2, get:y, Float64x2GetY, Double, 0x3cf4fcfa)                       \
-  V(Float64x2, _negate, Float64x2Negate, Float64x2, 0x64ef7b77)                \
-  V(Float64x2, abs, Float64x2Abs, Float64x2, 0x031f9e47)                       \
-  V(Float64x2, sqrt, Float64x2Sqrt, Float64x2, 0x77f711dd)                     \
-  V(Float64x2, get:signMask, Float64x2GetSignMask, Dynamic, 0x27ddf18d)        \
-  V(Float64x2, scale, Float64x2Scale, Float64x2, 0x26830a61)                   \
-  V(Float64x2, withX, Float64x2WithX, Float64x2, 0x1d2bcaf5)                   \
-  V(Float64x2, withY, Float64x2WithY, Float64x2, 0x383ed6ac)                   \
-  V(Float64x2, min, Float64x2Min, Float64x2, 0x28d7ddf6)                       \
-  V(Float64x2, max, Float64x2Max, Float64x2, 0x0bd74e5b)                       \
-  V(Int32x4, Int32x4., Int32x4Constructor, Int32x4, 0x26b199a7)                \
-  V(Int32x4, Int32x4.bool, Int32x4BoolConstructor, Int32x4, 0x1b55a5e1)        \
+    0x238d44c5)                                                                \
+  V(_Float64x2, get:x, Float64x2GetX, Double, 0x58c027f9)                      \
+  V(_Float64x2, get:y, Float64x2GetY, Double, 0x3cf57159)                      \
+  V(_Float64x2, unary-, Float64x2Negate, Float64x2, 0x3fa7c76a)                \
+  V(_Float64x2, abs, Float64x2Abs, Float64x2, 0x031f9e47)                      \
+  V(_Float64x2, sqrt, Float64x2Sqrt, Float64x2, 0x77f711dd)                    \
+  V(_Float64x2, get:signMask, Float64x2GetSignMask, Dynamic, 0x27de65ec)       \
+  V(_Float64x2, scale, Float64x2Scale, Float64x2, 0x26830a61)                  \
+  V(_Float64x2, withX, Float64x2WithX, Float64x2, 0x1d2bcaf5)                  \
+  V(_Float64x2, withY, Float64x2WithY, Float64x2, 0x383ed6ac)                  \
+  V(_Float64x2, min, Float64x2Min, Float64x2, 0x28d7ddf6)                      \
+  V(_Float64x2, max, Float64x2Max, Float64x2, 0x0bd74e5b)                      \
+  V(Int32x4, Int32x4., Int32x4Constructor, Int32x4, 0x775b77a8)                \
+  V(Int32x4, Int32x4.bool, Int32x4BoolConstructor, Int32x4, 0x690007a2)        \
   V(Int32x4, Int32x4.fromFloat32x4Bits, Int32x4FromFloat32x4Bits, Int32x4,     \
-    0x7e82564c)                                                                \
-  V(Int32x4, get:flagX, Int32x4GetFlagX, Bool, 0x563883c4)                     \
-  V(Int32x4, get:flagY, Int32x4GetFlagY, Bool, 0x446f5e7a)                     \
-  V(Int32x4, get:flagZ, Int32x4GetFlagZ, Bool, 0x20d61679)                     \
-  V(Int32x4, get:flagW, Int32x4GetFlagW, Bool, 0x504478ac)                     \
-  V(Int32x4, get:signMask, Int32x4GetSignMask, Dynamic, 0x2c1ec9e5)            \
-  V(Int32x4, shuffle, Int32x4Shuffle, Int32x4, 0x20bc0b16)                     \
-  V(Int32x4, shuffleMix, Int32x4ShuffleMix, Int32x4, 0x5c7056e1)               \
-  V(Int32x4, select, Int32x4Select, Float32x4, 0x518ee337)                     \
-  V(Int32x4, withFlagX, Int32x4WithFlagX, Int32x4, 0x0ef58fcf)                 \
-  V(Int32x4, withFlagY, Int32x4WithFlagY, Int32x4, 0x6485a9c4)                 \
-  V(Int32x4, withFlagZ, Int32x4WithFlagZ, Int32x4, 0x267acdfa)                 \
-  V(Int32x4, withFlagW, Int32x4WithFlagW, Int32x4, 0x345ac675)                 \
-  V(Int64List, [], Int64ArrayGetIndexed, Dynamic, 0x0c0c939a)                  \
-  V(Int64List, []=, Int64ArraySetIndexed, Dynamic, 0x3714d004)                 \
-  V(_Bigint, get:_neg, Bigint_getNeg, Bool, 0x7bf17a57)                        \
-  V(_Bigint, get:_used, Bigint_getUsed, Smi, 0x55041013)                       \
-  V(_Bigint, get:_digits, Bigint_getDigits, TypedDataUint32Array, 0x46a6c1b3)  \
-  V(_HashVMBase, get:_index, LinkedHashMap_getIndex, Dynamic, 0x7d6bb76b)      \
-  V(_HashVMBase, set:_index, LinkedHashMap_setIndex, Dynamic, 0x4beb13f2)      \
-  V(_HashVMBase, get:_data, LinkedHashMap_getData, Array, 0x4bf5ccb3)          \
-  V(_HashVMBase, set:_data, LinkedHashMap_setData, Dynamic, 0x6007556d)        \
-  V(_HashVMBase, get:_usedData, LinkedHashMap_getUsedData, Smi, 0x15e70845)    \
-  V(_HashVMBase, set:_usedData, LinkedHashMap_setUsedData, Dynamic, 0x3e8c6edc)\
-  V(_HashVMBase, get:_hashMask, LinkedHashMap_getHashMask, Smi, 0x35c5ac00)    \
-  V(_HashVMBase, set:_hashMask, LinkedHashMap_setHashMask, Dynamic, 0x49adf69e)\
+    0x72cbc76b)                                                                \
+  V(_Int32x4, get:flagX, Int32x4GetFlagX, Bool, 0x5638f823)                    \
+  V(_Int32x4, get:flagY, Int32x4GetFlagY, Bool, 0x446fd2d9)                    \
+  V(_Int32x4, get:flagZ, Int32x4GetFlagZ, Bool, 0x20d68ad8)                    \
+  V(_Int32x4, get:flagW, Int32x4GetFlagW, Bool, 0x5044ed0b)                    \
+  V(_Int32x4, get:signMask, Int32x4GetSignMask, Dynamic, 0x2c1f3e44)           \
+  V(_Int32x4, shuffle, Int32x4Shuffle, Int32x4, 0x20bc0b16)                    \
+  V(_Int32x4, shuffleMix, Int32x4ShuffleMix, Int32x4, 0x5c7056e1)              \
+  V(_Int32x4, select, Int32x4Select, Float32x4, 0x6b49654f)                    \
+  V(_Int32x4, withFlagX, Int32x4WithFlagX, Int32x4, 0x0ef58fcf)                \
+  V(_Int32x4, withFlagY, Int32x4WithFlagY, Int32x4, 0x6485a9c4)                \
+  V(_Int32x4, withFlagZ, Int32x4WithFlagZ, Int32x4, 0x267acdfa)                \
+  V(_Int32x4, withFlagW, Int32x4WithFlagW, Int32x4, 0x345ac675)                \
+  V(_Int64List, [], Int64ArrayGetIndexed, Dynamic, 0x1cfce099)                 \
+  V(_Int64List, []=, Int64ArraySetIndexed, Dynamic, 0x6b2911f5)                \
+  V(_Bigint, get:_neg, Bigint_getNeg, Bool, 0x356019c4)                        \
+  V(_Bigint, get:_used, Bigint_getUsed, Smi, 0x33ba5131)                       \
+  V(_Bigint, get:_digits, Bigint_getDigits, TypedDataUint32Array, 0x68defc99)  \
+  V(_HashVMBase, get:_index, LinkedHashMap_getIndex, Dynamic, 0x0246fcf8)      \
+  V(_HashVMBase, set:_index, LinkedHashMap_setIndex, Dynamic, 0x53a33a00)      \
+  V(_HashVMBase, get:_data, LinkedHashMap_getData, Array, 0x2d79fc4d)          \
+  V(_HashVMBase, set:_data, LinkedHashMap_setData, Dynamic, 0x129a9708)        \
+  V(_HashVMBase, get:_usedData, LinkedHashMap_getUsedData, Smi, 0x0885258e)    \
+  V(_HashVMBase, set:_usedData, LinkedHashMap_setUsedData, Dynamic, 0x631d2ea6)\
+  V(_HashVMBase, get:_hashMask, LinkedHashMap_getHashMask, Smi, 0x32f33cdc)    \
+  V(_HashVMBase, set:_hashMask, LinkedHashMap_setHashMask, Dynamic, 0x75f4287b)\
   V(_HashVMBase, get:_deletedKeys, LinkedHashMap_getDeletedKeys, Smi,          \
-    0x306e6a79)                                                                \
+    0x55840d63)                                                                \
   V(_HashVMBase, set:_deletedKeys, LinkedHashMap_setDeletedKeys, Dynamic,      \
-    0x3fe95fc2)                                                                \
-  V(::, _classRangeCheck, ClassRangeCheck, Bool, 0x6279a7b3)                   \
-  V(::, _classRangeCheckNegative, ClassRangeCheckNegated, Bool, 0x4799dac1)    \
+    0x5e83ecad)                                                                \
+  V(::, _classRangeCheck, ClassRangeCheck, Bool, 0x16a2fc83)                   \
+  V(::, _classRangeCheckNegative, ClassRangeCheckNegated, Bool, 0x46898c74)    \
 
 
 // List of intrinsics:
 // (class-name, function-name, intrinsification method, fingerprint).
 #define CORE_LIB_INTRINSIC_LIST(V)                                             \
-  V(_Smi, ~, Smi_bitNegate, Smi, 0x63bfee11)                                   \
-  V(_Smi, get:bitLength, Smi_bitLength, Smi, 0x25b2e24c)                       \
-  V(_Smi, _bitAndFromSmi, Smi_bitAndFromSmi, Smi, 0x0df806ed)                  \
-  V(_Bigint, _lsh, Bigint_lsh, Dynamic, 0x5cd95513)                            \
-  V(_Bigint, _rsh, Bigint_rsh, Dynamic, 0x2d68d0e1)                            \
-  V(_Bigint, _absAdd, Bigint_absAdd, Dynamic, 0x492f4865)                      \
-  V(_Bigint, _absSub, Bigint_absSub, Dynamic, 0x174a3a34)                      \
-  V(_Bigint, _mulAdd, Bigint_mulAdd, Dynamic, 0x24ced3ee)                      \
-  V(_Bigint, _sqrAdd, Bigint_sqrAdd, Dynamic, 0x60c6b633)                      \
-  V(_Bigint, _estQuotientDigit, Bigint_estQuotientDigit, Dynamic, 0x2f867482)  \
-  V(_Montgomery, _mulMod, Montgomery_mulMod, Dynamic, 0x741bed13)              \
-  V(_Double, >, Double_greaterThan, Bool, 0x569b0a81)                          \
-  V(_Double, >=, Double_greaterEqualThan, Bool, 0x6c317340)                    \
-  V(_Double, <, Double_lessThan, Bool, 0x26dda4bc)                             \
-  V(_Double, <=, Double_lessEqualThan, Bool, 0x1e869d20)                       \
-  V(_Double, ==, Double_equal, Bool, 0x578a1a51)                               \
-  V(_Double, +, Double_add, Double, 0x4bac5dd5)                                \
-  V(_Double, -, Double_sub, Double, 0x62052dbb)                                \
-  V(_Double, *, Double_mul, Double, 0x23d068d8)                                \
-  V(_Double, /, Double_div, Double, 0x48bac1dc)                                \
-  V(_Double, get:isNaN, Double_getIsNaN, Bool, 0x0af8ebeb)                     \
-  V(_Double, get:isInfinite, Double_getIsInfinite, Bool, 0x0f79e289)           \
-  V(_Double, get:isNegative, Double_getIsNegative, Bool, 0x3a58ff36)           \
-  V(_Double, _mulFromInteger, Double_mulFromInteger, Double, 0x330e9a36)       \
-  V(_Double, .fromInteger, DoubleFromInteger, Double, 0x7ef45843)              \
-  V(_List, []=, ObjectArraySetIndexed, Dynamic, 0x34d2c72c)                    \
+  V(_Smi, ~, Smi_bitNegate, Smi, 0x6574c6b0)                                   \
+  V(_Smi, get:bitLength, Smi_bitLength, Smi, 0x25b356ab)                       \
+  V(_Smi, _bitAndFromSmi, Smi_bitAndFromSmi, Smi, 0x490a4da1)                  \
+  V(_Bigint, _lsh, Bigint_lsh, Dynamic, 0x40d9f1cc)                            \
+  V(_Bigint, _rsh, Bigint_rsh, Dynamic, 0x703f1a40)                            \
+  V(_Bigint, _absAdd, Bigint_absAdd, Dynamic, 0x50fb1e47)                      \
+  V(_Bigint, _absSub, Bigint_absSub, Dynamic, 0x2beeb34d)                      \
+  V(_Bigint, _mulAdd, Bigint_mulAdd, Dynamic, 0x4feffd35)                      \
+  V(_Bigint, _sqrAdd, Bigint_sqrAdd, Dynamic, 0x1acf0bbe)                      \
+  V(_Bigint, _estQuotientDigit, Bigint_estQuotientDigit, Dynamic, 0x0a2898bb)  \
+  V(_Montgomery, _mulMod, Montgomery_mulMod, Dynamic, 0x26d5b8ee)              \
+  V(_Double, >, Double_greaterThan, Bool, 0x0a202683)                          \
+  V(_Double, >=, Double_greaterEqualThan, Bool, 0x57491a62)                    \
+  V(_Double, <, Double_lessThan, Bool, 0x2e9d61bb)                             \
+  V(_Double, <=, Double_lessEqualThan, Bool, 0x099e4442)                       \
+  V(_Double, ==, Double_equal, Bool, 0x04c399a1)                               \
+  V(_Double, +, Double_add, Double, 0x0ea5f450)                                \
+  V(_Double, -, Double_sub, Double, 0x76768546)                                \
+  V(_Double, *, Double_mul, Double, 0x66c66e3d)                                \
+  V(_Double, /, Double_div, Double, 0x034b9f08)                                \
+  V(_Double, get:isNaN, Double_getIsNaN, Bool, 0x0af9604a)                     \
+  V(_Double, get:isInfinite, Double_getIsInfinite, Bool, 0x0f7a56e8)           \
+  V(_Double, get:isNegative, Double_getIsNegative, Bool, 0x3a597395)           \
+  V(_Double, _mulFromInteger, Double_mulFromInteger, Double, 0x4fb72915)       \
+  V(_Double, .fromInteger, DoubleFromInteger, Double, 0x78d9de2c)              \
+  V(_List, []=, ObjectArraySetIndexed, Dynamic, 0x51691f4c)                    \
   V(_GrowableList, .withData, GrowableArray_Allocate, GrowableObjectArray,     \
-    0x25a786de)                                                                \
-  V(_GrowableList, add, GrowableArray_add, Dynamic, 0x0d1358ed)                \
-  V(_RegExp, _ExecuteMatch, RegExp_ExecuteMatch, Dynamic, 0x6036d7fa)          \
+    0x3468a26f)                                                                \
+  V(_GrowableList, add, GrowableArray_add, Dynamic, 0x19eaa9aa)                \
+  V(_RegExp, _ExecuteMatch, RegExp_ExecuteMatch, Dynamic, 0x380184b1)          \
   V(_RegExp, _ExecuteMatchSticky, RegExp_ExecuteMatchSticky, Dynamic,          \
-    0x71c67f7d)                                                                \
-  V(Object, ==, ObjectEquals, Bool, 0x11662ed8)                                \
-  V(Object, get:runtimeType, ObjectRuntimeType, Type, 0x00e7c26b)              \
-  V(Object, _haveSameRuntimeType, ObjectHaveSameRuntimeType, Bool, 0x72aad7e2) \
-  V(_StringBase, get:hashCode, String_getHashCode, Smi, 0x78c2eb88)            \
-  V(_StringBase, get:isEmpty, StringBaseIsEmpty, Bool, 0x74c21fca)             \
+    0x79b8f955)                                                                \
+  V(Object, ==, ObjectEquals, Bool, 0x464c6a19)                                \
+  V(Object, get:runtimeType, ObjectRuntimeType, Type, 0x00e836ca)              \
+  V(Object, _haveSameRuntimeType, ObjectHaveSameRuntimeType, Bool, 0x597b967a) \
+  V(_StringBase, get:hashCode, String_getHashCode, Smi, 0x78c35fe7)            \
+  V(_StringBase, get:isEmpty, StringBaseIsEmpty, Bool, 0x1fa6a4c9)             \
   V(_StringBase, _substringMatches, StringBaseSubstringMatches, Bool,          \
-    0x2f851deb)                                                                \
-  V(_StringBase, [], StringBaseCharAt, Dynamic, 0x2cf92c45)                    \
-  V(_OneByteString, get:hashCode, OneByteString_getHashCode, Smi, 0x78c2eb88)  \
+    0x649cbeef)                                                                \
+  V(_StringBase, [], StringBaseCharAt, Dynamic, 0x14da5924)                    \
+  V(_OneByteString, get:hashCode, OneByteString_getHashCode, Smi, 0x78c35fe7)  \
   V(_OneByteString, _substringUncheckedNative,                                 \
-    OneByteString_substringUnchecked, OneByteString, 0x638c3722)               \
-  V(_OneByteString, _setAt, OneByteStringSetAt, Dynamic, 0x452533ef)           \
+    OneByteString_substringUnchecked, OneByteString, 0x3538ad86)               \
+  V(_OneByteString, _setAt, OneByteStringSetAt, Dynamic, 0x7d1b2b10)           \
   V(_OneByteString, _allocate, OneByteString_allocate, OneByteString,          \
-    0x3d4fad8a)                                                                \
-  V(_OneByteString, ==, OneByteString_equality, Bool, 0x3f59b700)              \
-  V(_TwoByteString, ==, TwoByteString_equality, Bool, 0x3f59b700)              \
+    0x604ec475)                                                                \
+  V(_OneByteString, ==, OneByteString_equality, Bool, 0x4719e83f)              \
+  V(_TwoByteString, ==, TwoByteString_equality, Bool, 0x4719e83f)              \
 
 
 #define CORE_INTEGER_LIB_INTRINSIC_LIST(V)                                     \
   V(_IntegerImplementation, _addFromInteger, Integer_addFromInteger,           \
-    Dynamic, 0x79bde54b)                                                       \
-  V(_IntegerImplementation, +, Integer_add, Dynamic, 0x0e4300c2)               \
+    Dynamic, 0x6a10c54a)                                                       \
+  V(_IntegerImplementation, +, Integer_add, Dynamic, 0x5125faaa)               \
   V(_IntegerImplementation, _subFromInteger, Integer_subFromInteger, Dynamic,  \
-    0x3918c1af)                                                                \
-  V(_IntegerImplementation, -, Integer_sub, Dynamic, 0x0ce294c3)               \
+    0x3fa4b1ed)                                                                \
+  V(_IntegerImplementation, -, Integer_sub, Dynamic, 0x0c94540b)               \
   V(_IntegerImplementation, _mulFromInteger, Integer_mulFromInteger,           \
-    Dynamic, 0x791ecebc)                                                       \
-  V(_IntegerImplementation, *, Integer_mul, Dynamic, 0x4d8e01a4)               \
+    Dynamic, 0x3216e299)                                                       \
+  V(_IntegerImplementation, *, Integer_mul, Dynamic, 0x4535624c)               \
   V(_IntegerImplementation, _moduloFromInteger, Integer_moduloFromInteger,     \
-    Dynamic, 0x2e72f552)                                                       \
-  V(_IntegerImplementation, ~/, Integer_truncDivide, Dynamic, 0x3caf6780)      \
-  V(_IntegerImplementation, unary-, Integer_negate, Dynamic, 0x59dce57c)       \
+    Dynamic, 0x6348b974)                                                       \
+  V(_IntegerImplementation, ~/, Integer_truncDivide, Dynamic, 0x1f48f4c9)      \
+  V(_IntegerImplementation, unary-, Integer_negate, Dynamic, 0x4e346e3b)       \
   V(_IntegerImplementation, _bitAndFromInteger, Integer_bitAndFromInteger,     \
-    Dynamic, 0x1dfbe172)                                                       \
-  V(_IntegerImplementation, &, Integer_bitAnd, Dynamic, 0x596a453e)            \
+    Dynamic, 0x395b1678)                                                       \
+  V(_IntegerImplementation, &, Integer_bitAnd, Dynamic, 0x01b79186)            \
   V(_IntegerImplementation, _bitOrFromInteger, Integer_bitOrFromInteger,       \
-    Dynamic, 0x3d79aa1c)                                                       \
-  V(_IntegerImplementation, |, Integer_bitOr, Dynamic, 0x071e153c)             \
+    Dynamic, 0x6a36b395)                                                       \
+  V(_IntegerImplementation, |, Integer_bitOr, Dynamic, 0x71c6af64)             \
   V(_IntegerImplementation, _bitXorFromInteger, Integer_bitXorFromInteger,     \
-    Dynamic, 0x4fd73f45)                                                       \
-  V(_IntegerImplementation, ^, Integer_bitXor, Dynamic, 0x0c8aeb3d)            \
+    Dynamic, 0x72da93f0)                                                       \
+  V(_IntegerImplementation, ^, Integer_bitXor, Dynamic, 0x47faa8a5)            \
   V(_IntegerImplementation, _greaterThanFromInteger,                           \
-    Integer_greaterThanFromInt, Bool, 0x2e801bc8)                              \
-  V(_IntegerImplementation, >, Integer_greaterThan, Bool, 0x28287b8f)          \
-  V(_IntegerImplementation, ==, Integer_equal, Bool, 0x103da147)               \
+    Integer_greaterThanFromInt, Bool, 0x4a50ed58)                              \
+  V(_IntegerImplementation, >, Integer_greaterThan, Bool, 0x23dd0c00)          \
+  V(_IntegerImplementation, ==, Integer_equal, Bool, 0x7d51f04d)               \
   V(_IntegerImplementation, _equalToInteger, Integer_equalToInteger, Bool,     \
-    0x7773d51d)                                                                \
-  V(_IntegerImplementation, <, Integer_lessThan, Bool, 0x26dda4bc)             \
-  V(_IntegerImplementation, <=, Integer_lessEqualThan, Bool, 0x1e869d20)       \
-  V(_IntegerImplementation, >=, Integer_greaterEqualThan, Bool, 0x6c317340)    \
-  V(_IntegerImplementation, <<, Integer_shl, Dynamic, 0x4334dfc0)              \
-  V(_IntegerImplementation, >>, Integer_sar, Dynamic, 0x4a2583a1)              \
+    0x063be842)                                                                \
+  V(_IntegerImplementation, <, Integer_lessThan, Bool, 0x2e9d61bb)             \
+  V(_IntegerImplementation, <=, Integer_lessEqualThan, Bool, 0x099e4442)       \
+  V(_IntegerImplementation, >=, Integer_greaterEqualThan, Bool, 0x57491a62)    \
+  V(_IntegerImplementation, <<, Integer_shl, Dynamic, 0x1050c9a8)              \
+  V(_IntegerImplementation, >>, Integer_sar, Dynamic, 0x39af1c69)              \
   V(_Double, toInt, DoubleToInteger, Dynamic, 0x26ef344b)
 
 
 #define MATH_LIB_INTRINSIC_LIST(V)                                             \
-  V(::, sqrt, MathSqrt, Double, 0x1afb83d4)                                    \
-  V(_Random, _nextState, Random_nextState, Dynamic, 0x1e4b0103)                \
+  V(::, sqrt, MathSqrt, Double, 0x70482cf3)                                    \
+  V(_Random, _nextState, Random_nextState, Dynamic, 0x268dec36)                \
 
 #define GRAPH_MATH_LIB_INTRINSIC_LIST(V)                                       \
-  V(::, sin, MathSin, Double, 0x0213abe6)                                      \
-  V(::, cos, MathCos, Double, 0x79a7611c)                                      \
-  V(::, tan, MathTan, Double, 0x4e2e20db)                                      \
-  V(::, asin, MathAsin, Double, 0x661ff68b)                                    \
-  V(::, acos, MathAcos, Double, 0x44e71d5f)                                    \
-  V(::, atan, MathAtan, Double, 0x4436a657)                                    \
-  V(::, atan2, MathAtan2, Double, 0x60a40743)                                  \
+  V(::, sin, MathSin, Double, 0x3f3a010c)                                      \
+  V(::, cos, MathCos, Double, 0x195a1d7e)                                      \
+  V(::, tan, MathTan, Double, 0x0f8b9eaa)                                      \
+  V(::, asin, MathAsin, Double, 0x2ecc2fcd)                                    \
+  V(::, acos, MathAcos, Double, 0x08cf2212)                                    \
+  V(::, atan, MathAtan, Double, 0x1e2731d5)                                    \
+  V(::, atan2, MathAtan2, Double, 0x39f1fa41)                                  \
 
 #define TYPED_DATA_LIB_INTRINSIC_LIST(V)                                       \
-  V(Int8List, ., TypedData_Int8Array_factory, TypedDataInt8Array, 0x2e7749e3)  \
+  V(Int8List, ., TypedData_Int8Array_factory, TypedDataInt8Array, 0x165876c2)  \
   V(Uint8List, ., TypedData_Uint8Array_factory, TypedDataUint8Array,           \
-    0x6ab75439)                                                                \
+    0x52988118)                                                                \
   V(Uint8ClampedList, ., TypedData_Uint8ClampedArray_factory,                  \
-    TypedDataUint8ClampedArray, 0x183129d7)                                    \
+    TypedDataUint8ClampedArray, 0x001256b6)                                    \
   V(Int16List, ., TypedData_Int16Array_factory, TypedDataInt16Array,           \
-    0x14b563ea)                                                                \
+    0x7c9690c9)                                                                \
   V(Uint16List, ., TypedData_Uint16Array_factory, TypedDataUint16Array,        \
-    0x07456be4)                                                                \
+    0x6f2698c3)                                                                \
   V(Int32List, ., TypedData_Int32Array_factory, TypedDataInt32Array,           \
-    0x5bd49250)                                                                \
+    0x43b5bf2f)                                                                \
   V(Uint32List, ., TypedData_Uint32Array_factory,                              \
-    TypedDataUint32Array, 0x3c59b3a4)                                          \
+    TypedDataUint32Array, 0x243ae083)                                          \
   V(Int64List, ., TypedData_Int64Array_factory,                                \
-    TypedDataInt64Array, 0x57d85ac7)                                           \
+    TypedDataInt64Array, 0x3fb987a6)                                           \
   V(Uint64List, ., TypedData_Uint64Array_factory,                              \
-    TypedDataUint64Array, 0x2c093004)                                          \
+    TypedDataUint64Array, 0x13ea5ce3)                                          \
   V(Float32List, ., TypedData_Float32Array_factory,                            \
-    TypedDataFloat32Array, 0x738e124b)                                         \
+    TypedDataFloat32Array, 0x5b6f3f2a)                                         \
   V(Float64List, ., TypedData_Float64Array_factory,                            \
-    TypedDataFloat64Array, 0x501be4f1)                                         \
+    TypedDataFloat64Array, 0x37fd11d0)                                         \
   V(Float32x4List, ., TypedData_Float32x4Array_factory,                        \
-    TypedDataFloat32x4Array, 0x7a7dd718)                                       \
+    TypedDataFloat32x4Array, 0x625f03f7)                                       \
   V(Int32x4List, ., TypedData_Int32x4Array_factory,                            \
-    TypedDataInt32x4Array, 0x1e0dca48)                                         \
+    TypedDataInt32x4Array, 0x05eef727)                                         \
   V(Float64x2List, ., TypedData_Float64x2Array_factory,                        \
-    TypedDataFloat64x2Array, 0x18cbf4d9)                                       \
+    TypedDataFloat64x2Array, 0x00ad21b8)                                       \
 
 #define GRAPH_TYPED_DATA_INTRINSICS_LIST(V)                                    \
-  V(Int8List, [], Int8ArrayGetIndexed, Smi, 0x069af8b3)                        \
-  V(Int8List, []=, Int8ArraySetIndexed, Dynamic, 0x33994cd7)                   \
-  V(Uint8List, [], Uint8ArrayGetIndexed, Smi, 0x027603ed)                      \
-  V(Uint8List, []=, Uint8ArraySetIndexed, Dynamic, 0x060d5256)                 \
-  V(_ExternalUint8Array, [], ExternalUint8ArrayGetIndexed, Smi, 0x027603ed)    \
+  V(_Int8List, [], Int8ArrayGetIndexed, Smi, 0x14885f2e)                       \
+  V(_Int8List, []=, Int8ArraySetIndexed, Dynamic, 0x423e16f0)                  \
+  V(_Uint8List, [], Uint8ArrayGetIndexed, Smi, 0x539f6bd6)                     \
+  V(_Uint8List, []=, Uint8ArraySetIndexed, Dynamic, 0x2fad7f61)                \
+  V(_ExternalUint8Array, [], ExternalUint8ArrayGetIndexed, Smi, 0x539f6bd6)    \
   V(_ExternalUint8Array, []=, ExternalUint8ArraySetIndexed, Dynamic,           \
-    0x060d5256)                                                                \
-  V(Uint8ClampedList, [], Uint8ClampedArrayGetIndexed, Smi, 0x027603ed)        \
-  V(Uint8ClampedList, []=, Uint8ClampedArraySetIndexed, Dynamic, 0x28f5f058)   \
+    0x2fad7f61)                                                                \
+  V(_Uint8ClampedList, [], Uint8ClampedArrayGetIndexed, Smi, 0x539f6bd6)       \
+  V(_Uint8ClampedList, []=, Uint8ClampedArraySetIndexed, Dynamic, 0x04dac5c1)  \
   V(_ExternalUint8ClampedArray, [], ExternalUint8ClampedArrayGetIndexed,       \
-    Smi, 0x027603ed)                                                           \
+    Smi, 0x539f6bd6)                                                           \
   V(_ExternalUint8ClampedArray, []=, ExternalUint8ClampedArraySetIndexed,      \
-    Dynamic, 0x28f5f058)                                                       \
-  V(Int16List, [], Int16ArrayGetIndexed, Smi, 0x173cd6a1)                      \
-  V(Int16List, []=, Int16ArraySetIndexed, Dynamic, 0x32f84e3c)                 \
-  V(Uint16List, [], Uint16ArrayGetIndexed, Smi, 0x3ececa2f)                    \
-  V(Uint16List, []=, Uint16ArraySetIndexed, Dynamic, 0x5c3a0bb9)               \
-  V(Int32List, [], Int32ArrayGetIndexed, Dynamic, 0x262eef09)                  \
-  V(Int32List, []=, Int32ArraySetIndexed, Dynamic, 0x1b05b471)                 \
-  V(Uint32List, [], Uint32ArrayGetIndexed, Dynamic, 0x6040f7fb)                \
-  V(Uint32List, []=, Uint32ArraySetIndexed, Dynamic, 0x3a4e1119)               \
-  V(Float64List, [], Float64ArrayGetIndexed, Double, 0x7a27098d)               \
-  V(Float64List, []=, Float64ArraySetIndexed, Dynamic, 0x139b2465)             \
-  V(Float32List, [], Float32ArrayGetIndexed, Double, 0x5686528f)               \
-  V(Float32List, []=, Float32ArraySetIndexed, Dynamic, 0x1b0d90df)             \
-  V(Float32x4List, [], Float32x4ArrayGetIndexed, Float32x4, 0x01c7017b)        \
-  V(Float32x4List, []=, Float32x4ArraySetIndexed, Dynamic, 0x56e843aa)         \
-  V(Int32x4List, [], Int32x4ArrayGetIndexed, Int32x4, 0x08353f8d)              \
-  V(Int32x4List, []=, Int32x4ArraySetIndexed, Dynamic, 0x1d9a47a5)             \
-  V(Float64x2List, [], Float64x2ArrayGetIndexed, Float64x2, 0x669b1498)        \
-  V(Float64x2List, []=, Float64x2ArraySetIndexed, Dynamic, 0x76da6ffe)         \
-  V(_TypedList, get:length, TypedDataLength, Smi, 0x2090dc1a)                  \
-  V(Float32x4, get:x, Float32x4ShuffleX, Double, 0x63d0c13f)                   \
-  V(Float32x4, get:y, Float32x4ShuffleY, Double, 0x20343b1b)                   \
-  V(Float32x4, get:z, Float32x4ShuffleZ, Double, 0x13181dba)                   \
-  V(Float32x4, get:w, Float32x4ShuffleW, Double, 0x69895020)                   \
-  V(Float32x4, _mul, Float32x4Mul, Float32x4, 0x028d3146)                      \
-  V(Float32x4, _sub, Float32x4Sub, Float32x4, 0x062f78f7)                      \
-  V(Float32x4, _add, Float32x4Add, Float32x4, 0x509f9006)                      \
+    Dynamic, 0x04dac5c1)                                                       \
+  V(_Int16List, [], Int16ArrayGetIndexed, Smi, 0x29d82e4a)                     \
+  V(_Int16List, []=, Int16ArraySetIndexed, Dynamic, 0x2b986c41)                \
+  V(_Uint16List, [], Uint16ArrayGetIndexed, Smi, 0x2a5bb595)                   \
+  V(_Uint16List, []=, Uint16ArraySetIndexed, Dynamic, 0x4c45b32f)              \
+  V(_Int32List, [], Int32ArrayGetIndexed, Dynamic, 0x16d2b8df)                 \
+  V(_Int32List, []=, Int32ArraySetIndexed, Dynamic, 0x38298243)                \
+  V(_Uint32List, [], Uint32ArrayGetIndexed, Dynamic, 0x63983dd0)               \
+  V(_Uint32List, []=, Uint32ArraySetIndexed, Dynamic, 0x1f3f0499)              \
+  V(_Float64List, [], Float64ArrayGetIndexed, Double, 0x55832988)              \
+  V(_Float64List, []=, Float64ArraySetIndexed, Dynamic, 0x2cfebd47)            \
+  V(_Float32List, [], Float32ArrayGetIndexed, Double, 0x25f01521)              \
+  V(_Float32List, []=, Float32ArraySetIndexed, Dynamic, 0x35c7780b)            \
+  V(_Float32x4List, [], Float32x4ArrayGetIndexed, Float32x4, 0x5d9ec2ed)       \
+  V(_Float32x4List, []=, Float32x4ArraySetIndexed, Dynamic, 0x2340a652)        \
+  V(_Int32x4List, [], Int32x4ArrayGetIndexed, Int32x4, 0x168a949e)             \
+  V(_Int32x4List, []=, Int32x4ArraySetIndexed, Dynamic, 0x59b0878b)            \
+  V(_Float64x2List, [], Float64x2ArrayGetIndexed, Float64x2, 0x2f5bf0e3)       \
+  V(_Float64x2List, []=, Float64x2ArraySetIndexed, Dynamic, 0x13eeb4eb)        \
+  V(_TypedList, get:length, TypedDataLength, Smi, 0x20915079)                  \
+  V(_Float32x4, get:x, Float32x4ShuffleX, Double, 0x63d1359e)                  \
+  V(_Float32x4, get:y, Float32x4ShuffleY, Double, 0x2034af7a)                  \
+  V(_Float32x4, get:z, Float32x4ShuffleZ, Double, 0x13189219)                  \
+  V(_Float32x4, get:w, Float32x4ShuffleW, Double, 0x6989c47f)                  \
+  V(_Float32x4, *, Float32x4Mul, Float32x4, 0x760b3bd3)                        \
+  V(_Float32x4, -, Float32x4Sub, Float32x4, 0x56c01782)                        \
+  V(_Float32x4, +, Float32x4Add, Float32x4, 0x181bc622)                        \
 
 #define GRAPH_CORE_INTRINSICS_LIST(V)                                          \
-  V(_List, get:length, ObjectArrayLength, Smi, 0x25943ad2)                     \
-  V(_List, [], ObjectArrayGetIndexed, Dynamic, 0x157b4670)                     \
-  V(_ImmutableList, get:length, ImmutableArrayLength, Smi, 0x25943ad2)         \
-  V(_ImmutableList, [], ImmutableArrayGetIndexed, Dynamic, 0x157b4670)         \
-  V(_GrowableList, get:length, GrowableArrayLength, Smi, 0x18dc9df6)           \
-  V(_GrowableList, get:_capacity, GrowableArrayCapacity, Smi, 0x02734d82)      \
-  V(_GrowableList, _setData, GrowableArraySetData, Dynamic, 0x0c854013)        \
-  V(_GrowableList, _setLength, GrowableArraySetLength, Dynamic, 0x1401a7d6)    \
-  V(_GrowableList, [], GrowableArrayGetIndexed, Dynamic, 0x74ad8832)           \
-  V(_GrowableList, []=, GrowableArraySetIndexed, Dynamic, 0x0d6cfe96)          \
-  V(_StringBase, get:length, StringBaseLength, Smi, 0x2a2c1b13)                \
+  V(_List, get:length, ObjectArrayLength, Smi, 0x2594af31)                     \
+  V(_List, [], ObjectArrayGetIndexed, Dynamic, 0x7d5c734f)                     \
+  V(_ImmutableList, get:length, ImmutableArrayLength, Smi, 0x2594af31)         \
+  V(_ImmutableList, [], ImmutableArrayGetIndexed, Dynamic, 0x7d5c734f)         \
+  V(_GrowableList, get:length, GrowableArrayLength, Smi, 0x18dd1255)           \
+  V(_GrowableList, get:_capacity, GrowableArrayCapacity, Smi, 0x2e044a01)      \
+  V(_GrowableList, _setData, GrowableArraySetData, Dynamic, 0x55dd7669)        \
+  V(_GrowableList, _setLength, GrowableArraySetLength, Dynamic, 0x0d5d28fb)    \
+  V(_GrowableList, [], GrowableArrayGetIndexed, Dynamic, 0x5c8eb511)           \
+  V(_GrowableList, []=, GrowableArraySetIndexed, Dynamic, 0x2a0356b6)          \
+  V(_StringBase, get:length, StringBaseLength, Smi, 0x2a2c8f72)                \
   V(_OneByteString, codeUnitAt, OneByteStringCodeUnitAt, Smi, 0x55a0a1f3)      \
   V(_TwoByteString, codeUnitAt, TwoByteStringCodeUnitAt, Smi, 0x55a0a1f3)      \
   V(_ExternalOneByteString, codeUnitAt, ExternalOneByteStringCodeUnitAt,       \
     Smi, 0x55a0a1f3)                                                           \
   V(_ExternalTwoByteString, codeUnitAt, ExternalTwoByteStringCodeUnitAt,       \
     Smi, 0x55a0a1f3)                                                           \
-  V(_Double, unary-, DoubleFlipSignBit, Double, 0x6a4ab611)                    \
+  V(_Double, unary-, DoubleFlipSignBit, Double, 0x6bff8eb0)                    \
   V(_Double, truncateToDouble, DoubleTruncate, Double, 0x2f27e5d3)             \
   V(_Double, roundToDouble, DoubleRound, Double, 0x2f89c512)                   \
   V(_Double, floorToDouble, DoubleFloor, Double, 0x6aa87a5f)                   \
   V(_Double, ceilToDouble, DoubleCeil, Double, 0x1b045e9e)                     \
-  V(_Double, _modulo, DoubleMod, Double, 0x2e41c4fc)
+  V(_Double, _modulo, DoubleMod, Double, 0x5b8ceed7)
 
 
 #define GRAPH_INTRINSICS_LIST(V)                                               \
@@ -339,10 +341,10 @@
 
 #define DEVELOPER_LIB_INTRINSIC_LIST(V)                                        \
   V(_UserTag, makeCurrent, UserTag_makeCurrent, Dynamic, 0x0b3066fd)           \
-  V(::, _getDefaultTag, UserTag_defaultTag, Dynamic, 0x14ddc3b7)               \
-  V(::, _getCurrentTag, Profiler_getCurrentTag, Dynamic, 0x486ee02d)           \
+  V(::, _getDefaultTag, UserTag_defaultTag, Dynamic, 0x69f3f1ad)               \
+  V(::, _getCurrentTag, Profiler_getCurrentTag, Dynamic, 0x05fa99d2)           \
   V(::, _isDartStreamEnabled, Timeline_isDartStreamEnabled, Dynamic,           \
-    0x1667ce76)                                                                \
+    0x72f13f7a)                                                                \
 
 #define ALL_INTRINSICS_NO_INTEGER_LIB_LIST(V)                                  \
   CORE_LIB_INTRINSIC_LIST(V)                                                   \
@@ -361,139 +363,139 @@
 
 // A list of core function that should always be inlined.
 #define INLINE_WHITE_LIST(V)                                                   \
-  V(Object, ==, ObjectEquals, 0x11662ed8)                                      \
-  V(_List, get:length, ObjectArrayLength, 0x25943ad2)                          \
-  V(_ImmutableList, get:length, ImmutableArrayLength, 0x25943ad2)              \
-  V(_TypedList, get:length, TypedDataLength, 0x2090dc1a)                       \
-  V(_GrowableList, get:length, GrowableArrayLength, 0x18dc9df6)                \
-  V(_GrowableList, get:_capacity, GrowableArrayCapacity, 0x02734d82)           \
-  V(_GrowableList, add, GrowableListAdd, 0x0d1358ed)                           \
-  V(_GrowableList, removeLast, GrowableListRemoveLast, 0x7add0363)             \
-  V(_StringBase, get:length, StringBaseLength, 0x2a2c1b13)                     \
-  V(ListIterator, moveNext, ListIteratorMoveNext, 0x3f892e71)                  \
-  V(_FixedSizeArrayIterator, moveNext, FixedListIteratorMoveNext, 0x5681c902)  \
-  V(_GrowableList, get:iterator, GrowableArrayIterator, 0x6db11a73)            \
-  V(_GrowableList, forEach, GrowableArrayForEach, 0x250036fe)                  \
-  V(_List, ., ObjectArrayAllocate, 0x63078b15)                                 \
-  V(ListMixin, get:isEmpty, ListMixinIsEmpty, 0x787d9bc6)                      \
-  V(_List, get:iterator, ObjectArrayIterator, 0x119cf41a)                      \
-  V(_List, forEach, ObjectArrayForEach, 0x0abce191)                            \
-  V(_List, _slice, ObjectArraySlice, 0x3219e715)                               \
-  V(_ImmutableList, get:iterator, ImmutableArrayIterator, 0x119cf41a)          \
-  V(_ImmutableList, forEach, ImmutableArrayForEach, 0x0abce191)                \
-  V(_Uint8ArrayView, [], Uint8ArrayViewGetIndexed, 0x4fc6b3d3)                 \
-  V(_Uint8ArrayView, []=, Uint8ArrayViewSetIndexed, 0x2032fdf0)                \
-  V(_Int8ArrayView, [], Int8ArrayViewGetIndexed, 0x12036952)                   \
-  V(_Int8ArrayView, []=, Int8ArrayViewSetIndexed, 0x6d881658)                  \
-  V(_ByteDataView, setInt8, ByteDataViewSetInt8, 0x275cbdca)                   \
-  V(_ByteDataView, setUint8, ByteDataViewSetUint8, 0x62774e77)                 \
-  V(_ByteDataView, setInt16, ByteDataViewSetInt16, 0x7a43c6c2)                 \
-  V(_ByteDataView, setUint16, ByteDataViewSetUint16, 0x64dd988f)               \
-  V(_ByteDataView, setInt32, ByteDataViewSetInt32, 0x3363264a)                 \
-  V(_ByteDataView, setUint32, ByteDataViewSetUint32, 0x158f9899)               \
-  V(_ByteDataView, setInt64, ByteDataViewSetInt64, 0x480f73a5)                 \
-  V(_ByteDataView, setUint64, ByteDataViewSetUint64, 0x5c23db8c)               \
-  V(_ByteDataView, setFloat32, ByteDataViewSetFloat32, 0x4f76c49a)             \
-  V(_ByteDataView, setFloat64, ByteDataViewSetFloat64, 0x5e1ddd4f)             \
-  V(_ByteDataView, getInt8, ByteDataViewGetInt8, 0x01bac87d)                   \
-  V(_ByteDataView, getUint8, ByteDataViewGetUint8, 0x129dab34)                 \
-  V(_ByteDataView, getInt16, ByteDataViewGetInt16, 0x60282377)                 \
-  V(_ByteDataView, getUint16, ByteDataViewGetUint16, 0x10edcd89)               \
-  V(_ByteDataView, getInt32, ByteDataViewGetInt32, 0x79630f81)                 \
-  V(_ByteDataView, getUint32, ByteDataViewGetUint32, 0x220d3da8)               \
-  V(_ByteDataView, getInt64, ByteDataViewGetInt64, 0x757dd5c8)                 \
-  V(_ByteDataView, getUint64, ByteDataViewGetUint64, 0x2fab992e)               \
-  V(_ByteDataView, getFloat32, ByteDataViewGetFloat32, 0x387e9fc6)             \
-  V(_ByteDataView, getFloat64, ByteDataViewGetFloat64, 0x5396432d)             \
-  V(::, exp, MathExp, 0x5b894d7b)                                              \
-  V(::, log, MathLog, 0x2e25132c)                                              \
-  V(::, max, MathMax, 0x54121d6a)                                              \
-  V(::, min, MathMin, 0x4276561c)                                              \
-  V(::, pow, MathPow, 0x438e3089)                                              \
-  V(::, _classRangeCheck, ClassRangeCheck, 0x6279a7b3)                         \
-  V(::, _classRangeCheckNegative, ClassRangeCheckNegated, 0x4799dac1)          \
-  V(Lists, copy, ListsCopy, 0x21a194fa)                                        \
-  V(_Bigint, get:_neg, Bigint_getNeg, 0x7bf17a57)                              \
-  V(_Bigint, get:_used, Bigint_getUsed, 0x55041013)                            \
-  V(_Bigint, get:_digits, Bigint_getDigits, 0x46a6c1b3)                        \
-  V(_HashVMBase, get:_index, LinkedHashMap_getIndex, 0x7d6bb76b)               \
-  V(_HashVMBase, set:_index, LinkedHashMap_setIndex, 0x4beb13f2)               \
-  V(_HashVMBase, get:_data, LinkedHashMap_getData, 0x4bf5ccb3)                 \
-  V(_HashVMBase, set:_data, LinkedHashMap_setData, 0x6007556d)                 \
-  V(_HashVMBase, get:_usedData, LinkedHashMap_getUsedData, 0x15e70845)         \
-  V(_HashVMBase, set:_usedData, LinkedHashMap_setUsedData, 0x3e8c6edc)         \
-  V(_HashVMBase, get:_hashMask, LinkedHashMap_getHashMask, 0x35c5ac00)         \
-  V(_HashVMBase, set:_hashMask, LinkedHashMap_setHashMask, 0x49adf69e)         \
-  V(_HashVMBase, get:_deletedKeys, LinkedHashMap_getDeletedKeys, 0x306e6a79)   \
-  V(_HashVMBase, set:_deletedKeys, LinkedHashMap_setDeletedKeys, 0x3fe95fc2)   \
+  V(Object, ==, ObjectEquals, 0x464c6a19)                                      \
+  V(_List, get:length, ObjectArrayLength, 0x2594af31)                          \
+  V(_ImmutableList, get:length, ImmutableArrayLength, 0x2594af31)              \
+  V(_TypedList, get:length, TypedDataLength, 0x20915079)                       \
+  V(_GrowableList, get:length, GrowableArrayLength, 0x18dd1255)                \
+  V(_GrowableList, get:_capacity, GrowableArrayCapacity, 0x2e044a01)           \
+  V(_GrowableList, add, GrowableListAdd, 0x19eaa9aa)                           \
+  V(_GrowableList, removeLast, GrowableListRemoveLast, 0x3daaaca4)             \
+  V(_StringBase, get:length, StringBaseLength, 0x2a2c8f72)                     \
+  V(ListIterator, moveNext, ListIteratorMoveNext, 0x7ead154d)                  \
+  V(_FixedSizeArrayIterator, moveNext, FixedListIteratorMoveNext, 0x4197892b)  \
+  V(_GrowableList, get:iterator, GrowableArrayIterator, 0x64c204d5)            \
+  V(_GrowableList, forEach, GrowableArrayForEach, 0x4cc8215b)                  \
+  V(_List, ., ObjectArrayAllocate, 0x6c3b54ee)                                 \
+  V(ListMixin, get:isEmpty, ListMixinIsEmpty, 0x7a327465)                      \
+  V(_List, get:iterator, ObjectArrayIterator, 0x757431f3)                      \
+  V(_List, forEach, ObjectArrayForEach, 0x4dfea652)                            \
+  V(_List, _slice, ObjectArraySlice, 0x671ebc98)                               \
+  V(_ImmutableList, get:iterator, ImmutableArrayIterator, 0x757431f3)          \
+  V(_ImmutableList, forEach, ImmutableArrayForEach, 0x4dfea652)                \
+  V(_Uint8ArrayView, [], Uint8ArrayViewGetIndexed, 0x4e8a9e40)                 \
+  V(_Uint8ArrayView, []=, Uint8ArrayViewSetIndexed, 0x46f85777)                \
+  V(_Int8ArrayView, [], Int8ArrayViewGetIndexed, 0x4fb4a051)                   \
+  V(_Int8ArrayView, []=, Int8ArrayViewSetIndexed, 0x443418ed)                  \
+  V(_ByteDataView, setInt8, ByteDataViewSetInt8, 0x6502a95f)                   \
+  V(_ByteDataView, setUint8, ByteDataViewSetUint8, 0x7b051d40)                 \
+  V(_ByteDataView, setInt16, ByteDataViewSetInt16, 0x41bf9a68)                 \
+  V(_ByteDataView, setUint16, ByteDataViewSetUint16, 0x384e7797)               \
+  V(_ByteDataView, setInt32, ByteDataViewSetInt32, 0x41973c2e)                 \
+  V(_ByteDataView, setUint32, ByteDataViewSetUint32, 0x49a7590e)               \
+  V(_ByteDataView, setInt64, ByteDataViewSetInt64, 0x31e47b84)                 \
+  V(_ByteDataView, setUint64, ByteDataViewSetUint64, 0x57daedc6)               \
+  V(_ByteDataView, setFloat32, ByteDataViewSetFloat32, 0x6c92cb69)             \
+  V(_ByteDataView, setFloat64, ByteDataViewSetFloat64, 0x6f4b64ab)             \
+  V(_ByteDataView, getInt8, ByteDataViewGetInt8, 0x655d546e)                   \
+  V(_ByteDataView, getUint8, ByteDataViewGetUint8, 0x5a819513)                 \
+  V(_ByteDataView, getInt16, ByteDataViewGetInt16, 0x449cf8de)                 \
+  V(_ByteDataView, getUint16, ByteDataViewGetUint16, 0x2f585007)               \
+  V(_ByteDataView, getInt32, ByteDataViewGetInt32, 0x1590e92b)                 \
+  V(_ByteDataView, getUint32, ByteDataViewGetUint32, 0x0ed36ced)               \
+  V(_ByteDataView, getInt64, ByteDataViewGetInt64, 0x535fe14d)                 \
+  V(_ByteDataView, getUint64, ByteDataViewGetUint64, 0x469be77a)               \
+  V(_ByteDataView, getFloat32, ByteDataViewGetFloat32, 0x32567817)             \
+  V(_ByteDataView, getFloat64, ByteDataViewGetFloat64, 0x322badf5)             \
+  V(::, exp, MathExp, 0x32ab9efa)                                              \
+  V(::, log, MathLog, 0x1ee8f9fc)                                              \
+  V(::, max, MathMax, 0x217af195)                                              \
+  V(::, min, MathMin, 0x154735b3)                                              \
+  V(::, pow, MathPow, 0x5f119fa5)                                              \
+  V(::, _classRangeCheck, ClassRangeCheck, 0x16a2fc83)                         \
+  V(::, _classRangeCheckNegative, ClassRangeCheckNegated, 0x46898c74)          \
+  V(Lists, copy, ListsCopy, 0x714584f8)                                        \
+  V(_Bigint, get:_neg, Bigint_getNeg, 0x356019c4)                              \
+  V(_Bigint, get:_used, Bigint_getUsed, 0x33ba5131)                            \
+  V(_Bigint, get:_digits, Bigint_getDigits, 0x68defc99)                        \
+  V(_HashVMBase, get:_index, LinkedHashMap_getIndex, 0x0246fcf8)               \
+  V(_HashVMBase, set:_index, LinkedHashMap_setIndex, 0x53a33a00)               \
+  V(_HashVMBase, get:_data, LinkedHashMap_getData, 0x2d79fc4d)                 \
+  V(_HashVMBase, set:_data, LinkedHashMap_setData, 0x129a9708)                 \
+  V(_HashVMBase, get:_usedData, LinkedHashMap_getUsedData, 0x0885258e)         \
+  V(_HashVMBase, set:_usedData, LinkedHashMap_setUsedData, 0x631d2ea6)         \
+  V(_HashVMBase, get:_hashMask, LinkedHashMap_getHashMask, 0x32f33cdc)         \
+  V(_HashVMBase, set:_hashMask, LinkedHashMap_setHashMask, 0x75f4287b)         \
+  V(_HashVMBase, get:_deletedKeys, LinkedHashMap_getDeletedKeys, 0x55840d63)   \
+  V(_HashVMBase, set:_deletedKeys, LinkedHashMap_setDeletedKeys, 0x5e83ecad)   \
 
 // A list of core function that should never be inlined.
 #define INLINE_BLACK_LIST(V)                                                   \
-  V(::, asin, MathAsin, 0x661ff68b)                                            \
-  V(::, acos, MathAcos, 0x44e71d5f)                                            \
-  V(::, atan, MathAtan, 0x4436a657)                                            \
-  V(::, atan2, MathAtan2, 0x60a40743)                                          \
-  V(::, cos, MathCos, 0x79a7611c)                                              \
-  V(::, sin, MathSin, 0x0213abe6)                                              \
-  V(::, sqrt, MathSqrt, 0x1afb83d4)                                            \
-  V(::, tan, MathTan, 0x4e2e20db)                                              \
-  V(_Bigint, _lsh, Bigint_lsh, 0x5cd95513)                                     \
-  V(_Bigint, _rsh, Bigint_rsh, 0x2d68d0e1)                                     \
-  V(_Bigint, _absAdd, Bigint_absAdd, 0x492f4865)                               \
-  V(_Bigint, _absSub, Bigint_absSub, 0x174a3a34)                               \
-  V(_Bigint, _mulAdd, Bigint_mulAdd, 0x24ced3ee)                               \
-  V(_Bigint, _sqrAdd, Bigint_sqrAdd, 0x60c6b633)                               \
-  V(_Bigint, _estQuotientDigit, Bigint_estQuotientDigit, 0x2f867482)           \
-  V(_Montgomery, _mulMod, Montgomery_mulMod, 0x741bed13)                       \
-  V(_Double, >, Double_greaterThan, 0x569b0a81)                                \
-  V(_Double, >=, Double_greaterEqualThan, 0x6c317340)                          \
-  V(_Double, <, Double_lessThan, 0x26dda4bc)                                   \
-  V(_Double, <=, Double_lessEqualThan, 0x1e869d20)                             \
-  V(_Double, ==, Double_equal, 0x578a1a51)                                     \
-  V(_Double, +, Double_add, 0x4bac5dd5)                                        \
-  V(_Double, -, Double_sub, 0x62052dbb)                                        \
-  V(_Double, *, Double_mul, 0x23d068d8)                                        \
-  V(_Double, /, Double_div, 0x48bac1dc)                                        \
-  V(_IntegerImplementation, +, Integer_add, 0x0e4300c2)                        \
-  V(_IntegerImplementation, -, Integer_sub, 0x0ce294c3)                        \
-  V(_IntegerImplementation, *, Integer_mul, 0x4d8e01a4)                        \
-  V(_IntegerImplementation, ~/, Integer_truncDivide, 0x3caf6780)               \
-  V(_IntegerImplementation, unary-, Integer_negate, 0x59dce57c)                \
-  V(_IntegerImplementation, &, Integer_bitAnd, 0x596a453e)                     \
-  V(_IntegerImplementation, |, Integer_bitOr, 0x071e153c)                      \
-  V(_IntegerImplementation, ^, Integer_bitXor, 0x0c8aeb3d)                     \
-  V(_IntegerImplementation, >, Integer_greaterThan, 0x28287b8f)                \
-  V(_IntegerImplementation, ==, Integer_equal, 0x103da147)                     \
-  V(_IntegerImplementation, <, Integer_lessThan, 0x26dda4bc)                   \
-  V(_IntegerImplementation, <=, Integer_lessEqualThan, 0x1e869d20)             \
-  V(_IntegerImplementation, >=, Integer_greaterEqualThan, 0x6c317340)          \
-  V(_IntegerImplementation, <<, Integer_shl, 0x4334dfc0)                       \
-  V(_IntegerImplementation, >>, Integer_sar, 0x4a2583a1)                       \
+  V(::, asin, MathAsin, 0x2ecc2fcd)                                            \
+  V(::, acos, MathAcos, 0x08cf2212)                                            \
+  V(::, atan, MathAtan, 0x1e2731d5)                                            \
+  V(::, atan2, MathAtan2, 0x39f1fa41)                                          \
+  V(::, cos, MathCos, 0x195a1d7e)                                              \
+  V(::, sin, MathSin, 0x3f3a010c)                                              \
+  V(::, sqrt, MathSqrt, 0x70482cf3)                                            \
+  V(::, tan, MathTan, 0x0f8b9eaa)                                              \
+  V(_Bigint, _lsh, Bigint_lsh, 0x40d9f1cc)                                     \
+  V(_Bigint, _rsh, Bigint_rsh, 0x703f1a40)                                     \
+  V(_Bigint, _absAdd, Bigint_absAdd, 0x50fb1e47)                               \
+  V(_Bigint, _absSub, Bigint_absSub, 0x2beeb34d)                               \
+  V(_Bigint, _mulAdd, Bigint_mulAdd, 0x4feffd35)                               \
+  V(_Bigint, _sqrAdd, Bigint_sqrAdd, 0x1acf0bbe)                               \
+  V(_Bigint, _estQuotientDigit, Bigint_estQuotientDigit, 0x0a2898bb)           \
+  V(_Montgomery, _mulMod, Montgomery_mulMod, 0x26d5b8ee)                       \
+  V(_Double, >, Double_greaterThan, 0x0a202683)                                \
+  V(_Double, >=, Double_greaterEqualThan, 0x57491a62)                          \
+  V(_Double, <, Double_lessThan, 0x2e9d61bb)                                   \
+  V(_Double, <=, Double_lessEqualThan, 0x099e4442)                             \
+  V(_Double, ==, Double_equal, 0x04c399a1)                                     \
+  V(_Double, +, Double_add, 0x0ea5f450)                                        \
+  V(_Double, -, Double_sub, 0x76768546)                                        \
+  V(_Double, *, Double_mul, 0x66c66e3d)                                        \
+  V(_Double, /, Double_div, 0x034b9f08)                                        \
+  V(_IntegerImplementation, +, Integer_add, 0x5125faaa)                        \
+  V(_IntegerImplementation, -, Integer_sub, 0x0c94540b)                        \
+  V(_IntegerImplementation, *, Integer_mul, 0x4535624c)                        \
+  V(_IntegerImplementation, ~/, Integer_truncDivide, 0x1f48f4c9)               \
+  V(_IntegerImplementation, unary-, Integer_negate, 0x4e346e3b)                \
+  V(_IntegerImplementation, &, Integer_bitAnd, 0x01b79186)                     \
+  V(_IntegerImplementation, |, Integer_bitOr, 0x71c6af64)                      \
+  V(_IntegerImplementation, ^, Integer_bitXor, 0x47faa8a5)                     \
+  V(_IntegerImplementation, >, Integer_greaterThan, 0x23dd0c00)                \
+  V(_IntegerImplementation, ==, Integer_equal, 0x7d51f04d)                     \
+  V(_IntegerImplementation, <, Integer_lessThan, 0x2e9d61bb)                   \
+  V(_IntegerImplementation, <=, Integer_lessEqualThan, 0x099e4442)             \
+  V(_IntegerImplementation, >=, Integer_greaterEqualThan, 0x57491a62)          \
+  V(_IntegerImplementation, <<, Integer_shl, 0x1050c9a8)                       \
+  V(_IntegerImplementation, >>, Integer_sar, 0x39af1c69)                       \
 
 // A list of core functions that internally dispatch based on received id.
 #define POLYMORPHIC_TARGET_LIST(V)                                             \
-  V(_StringBase, [], StringBaseCharAt, 0x2cf92c45)                             \
-  V(_TypedList, _getInt8, ByteArrayBaseGetInt8, 0x59e7291d)                    \
-  V(_TypedList, _getUint8, ByteArrayBaseGetUint8, 0x38d3e5bf)                  \
-  V(_TypedList, _getInt16, ByteArrayBaseGetInt16, 0x19dde22c)                  \
-  V(_TypedList, _getUint16, ByteArrayBaseGetUint16, 0x4f3dbe58)                \
-  V(_TypedList, _getInt32, ByteArrayBaseGetInt32, 0x082db131)                  \
-  V(_TypedList, _getUint32, ByteArrayBaseGetUint32, 0x1dcbfb98)                \
-  V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, 0x63b56e15)              \
-  V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, 0x399dacf8)              \
-  V(_TypedList, _getFloat32x4, ByteArrayBaseGetFloat32x4, 0x4761a5be)          \
-  V(_TypedList, _getInt32x4, ByteArrayBaseGetInt32x4, 0x3053e92c)              \
-  V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 0x4e82d1e9)                    \
-  V(_TypedList, _setUint8, ByteArrayBaseSetInt8, 0x4f3587fc)                   \
-  V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 0x6cef30ee)                  \
-  V(_TypedList, _setUint16, ByteArrayBaseSetInt16, 0x64f938ac)                 \
-  V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 0x3693c029)                  \
-  V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 0x74bbf260)                \
-  V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 0x6e72f2a4)              \
-  V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 0x4765edda)              \
-  V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, 0x7cca4533)          \
-  V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, 0x7631bdbc)              \
-  V(Object, get:runtimeType, ObjectRuntimeType, 0x00e7c26b)
+  V(_StringBase, [], StringBaseCharAt, 0x14da5924)                             \
+  V(_TypedList, _getInt8, ByteArrayBaseGetInt8, 0x7041895a)                    \
+  V(_TypedList, _getUint8, ByteArrayBaseGetUint8, 0x336fa3ea)                  \
+  V(_TypedList, _getInt16, ByteArrayBaseGetInt16, 0x231bbe2e)                  \
+  V(_TypedList, _getUint16, ByteArrayBaseGetUint16, 0x0371785f)                \
+  V(_TypedList, _getInt32, ByteArrayBaseGetInt32, 0x65ab3a20)                  \
+  V(_TypedList, _getUint32, ByteArrayBaseGetUint32, 0x0cb0fcf6)                \
+  V(_TypedList, _getFloat32, ByteArrayBaseGetFloat32, 0x6674ea6f)              \
+  V(_TypedList, _getFloat64, ByteArrayBaseGetFloat64, 0x236c6e7a)              \
+  V(_TypedList, _getFloat32x4, ByteArrayBaseGetFloat32x4, 0x5c367ffb)          \
+  V(_TypedList, _getInt32x4, ByteArrayBaseGetInt32x4, 0x772d1c0f)              \
+  V(_TypedList, _setInt8, ByteArrayBaseSetInt8, 0x7dd630a9)                    \
+  V(_TypedList, _setUint8, ByteArrayBaseSetInt8, 0x009d6a08)                   \
+  V(_TypedList, _setInt16, ByteArrayBaseSetInt16, 0x0a9d8539)                  \
+  V(_TypedList, _setUint16, ByteArrayBaseSetInt16, 0x0339aa55)                 \
+  V(_TypedList, _setInt32, ByteArrayBaseSetInt32, 0x68f6ecc6)                  \
+  V(_TypedList, _setUint32, ByteArrayBaseSetUint32, 0x5f249ccc)                \
+  V(_TypedList, _setFloat32, ByteArrayBaseSetFloat32, 0x6ef655ba)              \
+  V(_TypedList, _setFloat64, ByteArrayBaseSetFloat64, 0x23c3584c)              \
+  V(_TypedList, _setFloat32x4, ByteArrayBaseSetFloat32x4, 0x2b20798d)          \
+  V(_TypedList, _setInt32x4, ByteArrayBaseSetInt32x4, 0x72d3ec93)              \
+  V(Object, get:runtimeType, ObjectRuntimeType, 0x00e836ca)
 
 // clang-format on
 
@@ -538,23 +540,30 @@
 
 // clang-format off
 // List of recognized list factories:
-// (factory-name-symbol, result-cid, fingerprint).
+// (factory-name-symbol, class-name-string, constructor-name-string,
+//  result-cid, fingerprint).
 #define RECOGNIZED_LIST_FACTORY_LIST(V)                                        \
-  V(_ListFactory, kArrayCid, 0x63078b15)                                       \
-  V(_GrowableListWithData, kGrowableObjectArrayCid, 0x25a786de)                \
-  V(_GrowableListFactory, kGrowableObjectArrayCid, 0x4f4d4790)                 \
-  V(_Int8ArrayFactory, kTypedDataInt8ArrayCid, 0x2e7749e3)                     \
-  V(_Uint8ArrayFactory, kTypedDataUint8ArrayCid, 0x6ab75439)                   \
-  V(_Uint8ClampedArrayFactory, kTypedDataUint8ClampedArrayCid, 0x183129d7)     \
-  V(_Int16ArrayFactory, kTypedDataInt16ArrayCid, 0x14b563ea)                   \
-  V(_Uint16ArrayFactory, kTypedDataUint16ArrayCid, 0x07456be4)                 \
-  V(_Int32ArrayFactory, kTypedDataInt32ArrayCid, 0x5bd49250)                   \
-  V(_Uint32ArrayFactory, kTypedDataUint32ArrayCid, 0x3c59b3a4)                 \
-  V(_Int64ArrayFactory, kTypedDataInt64ArrayCid, 0x57d85ac7)                   \
-  V(_Uint64ArrayFactory, kTypedDataUint64ArrayCid, 0x2c093004)                 \
-  V(_Float64ArrayFactory, kTypedDataFloat64ArrayCid, 0x501be4f1)               \
-  V(_Float32ArrayFactory, kTypedDataFloat32ArrayCid, 0x738e124b)               \
-  V(_Float32x4ArrayFactory, kTypedDataFloat32x4ArrayCid, 0x7a7dd718)
+  V(_ListFactory, _List, ., kArrayCid, 0x6c3b54ee)                             \
+  V(_GrowableListWithData, _GrowableList, .withData, kGrowableObjectArrayCid,  \
+    0x3468a26f)                                                                \
+  V(_GrowableListFactory, _GrowableList, ., kGrowableObjectArrayCid,           \
+    0x3bd724aa)                                                                \
+  V(_Int8ArrayFactory, Int8List, ., kTypedDataInt8ArrayCid, 0x165876c2)        \
+  V(_Uint8ArrayFactory, Uint8List, ., kTypedDataUint8ArrayCid, 0x52988118)     \
+  V(_Uint8ClampedArrayFactory, Uint8ClampedList, .,                            \
+    kTypedDataUint8ClampedArrayCid, 0x001256b6)                                \
+  V(_Int16ArrayFactory, Int16List, ., kTypedDataInt16ArrayCid, 0x7c9690c9)     \
+  V(_Uint16ArrayFactory, Uint16List, ., kTypedDataUint16ArrayCid, 0x6f2698c3)  \
+  V(_Int32ArrayFactory, Int32List, ., kTypedDataInt32ArrayCid, 0x43b5bf2f)     \
+  V(_Uint32ArrayFactory, Uint32List, ., kTypedDataUint32ArrayCid, 0x243ae083)  \
+  V(_Int64ArrayFactory, Int64List, ., kTypedDataInt64ArrayCid, 0x3fb987a6)     \
+  V(_Uint64ArrayFactory, Uint64List, ., kTypedDataUint64ArrayCid, 0x13ea5ce3)  \
+  V(_Float64ArrayFactory, Float64List, ., kTypedDataFloat64ArrayCid,           \
+    0x37fd11d0)                                                                \
+  V(_Float32ArrayFactory, Float32List, ., kTypedDataFloat32ArrayCid,           \
+    0x5b6f3f2a)                                                                \
+  V(_Float32x4ArrayFactory, Float32x4List, ., kTypedDataFloat32x4ArrayCid,     \
+    0x625f03f7)
 
 // clang-format on
 
diff --git a/runtime/vm/metrics_test.cc b/runtime/vm/metrics_test.cc
index 77a762f..3892372 100644
--- a/runtime/vm/metrics_test.cc
+++ b/runtime/vm/metrics_test.cc
@@ -16,8 +16,8 @@
 #ifndef PRODUCT
 
 UNIT_TEST_CASE(Metric_Simple) {
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   {
     Metric metric;
 
@@ -45,8 +45,8 @@
 };
 
 UNIT_TEST_CASE(Metric_OnDemand) {
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   {
     Thread* thread = Thread::Current();
     StackZone zone(thread);
diff --git a/runtime/vm/native_api_impl.cc b/runtime/vm/native_api_impl.cc
index 08a8daa..4729375 100644
--- a/runtime/vm/native_api_impl.cc
+++ b/runtime/vm/native_api_impl.cc
@@ -16,7 +16,9 @@
 
 // --- Message sending/receiving from native code ---
 
-static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
+static uint8_t* malloc_allocator(uint8_t* ptr,
+                                 intptr_t old_size,
+                                 intptr_t new_size) {
   void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
   return reinterpret_cast<uint8_t*>(new_ptr);
 }
@@ -47,10 +49,13 @@
 
 static bool PostCObjectHelper(Dart_Port port_id, Dart_CObject* message) {
   uint8_t* buffer = NULL;
-  ApiMessageWriter writer(&buffer, allocator);
+  ApiMessageWriter writer(&buffer, malloc_allocator);
   bool success = writer.WriteCMessage(message);
 
-  if (!success) return success;
+  if (!success) {
+    free(buffer);
+    return success;
+  }
 
   // Post the message at the given port.
   return PortMap::PostMessage(new Message(
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index daa2198..865e67f 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -29,6 +29,7 @@
 #include "vm/heap.h"
 #include "vm/intrinsifier.h"
 #include "vm/isolate_reload.h"
+#include "vm/kernel_to_il.h"
 #include "vm/object_store.h"
 #include "vm/parser.h"
 #include "vm/precompiler.h"
@@ -142,6 +143,7 @@
 RawClass* Object::patch_class_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
 RawClass* Object::function_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
 RawClass* Object::closure_data_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
+RawClass* Object::signature_data_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
 RawClass* Object::redirection_data_class_ =
     reinterpret_cast<RawClass*>(RAW_NULL);
 RawClass* Object::field_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
@@ -210,6 +212,28 @@
 }
 
 
+// Remove private keys, but retain getter/setter/constructor/mixin manglings.
+RawString* String::RemovePrivateKey(const String& name) {
+  ASSERT(name.IsOneByteString());
+  GrowableArray<uint8_t> without_key(name.Length());
+  intptr_t i = 0;
+  while (i < name.Length()) {
+    while (i < name.Length()) {
+      uint8_t c = name.CharAt(i++);
+      if (c == '@') break;
+      without_key.Add(c);
+    }
+    while (i < name.Length()) {
+      uint8_t c = name.CharAt(i);
+      if ((c < '0') || (c > '9')) break;
+      i++;
+    }
+  }
+
+  return String::FromLatin1(without_key.data(), without_key.length());
+}
+
+
 // Takes a vm internal name and makes it suitable for external user.
 //
 // Examples:
@@ -609,6 +633,9 @@
   cls = Class::New<ClosureData>();
   closure_data_class_ = cls.raw();
 
+  cls = Class::New<SignatureData>();
+  signature_data_class_ = cls.raw();
+
   cls = Class::New<RedirectionData>();
   redirection_data_class_ = cls.raw();
 
@@ -645,7 +672,7 @@
   cls = Class::New<CodeSourceMap>();
   code_source_map_class_ = cls.raw();
 
-  cls = Class::New<Stackmap>();
+  cls = Class::New<StackMap>();
   stackmap_class_ = cls.raw();
 
   cls = Class::New<LocalVarDescriptors>();
@@ -977,6 +1004,7 @@
   SET_CLASS_NAME(patch_class, PatchClass);
   SET_CLASS_NAME(function, Function);
   SET_CLASS_NAME(closure_data, ClosureData);
+  SET_CLASS_NAME(signature_data, SignatureData);
   SET_CLASS_NAME(redirection_data, RedirectionData);
   SET_CLASS_NAME(field, Field);
   SET_CLASS_NAME(literal_token, LiteralToken);
@@ -989,7 +1017,7 @@
   SET_CLASS_NAME(object_pool, ObjectPool);
   SET_CLASS_NAME(code_source_map, CodeSourceMap);
   SET_CLASS_NAME(pc_descriptors, PcDescriptors);
-  SET_CLASS_NAME(stackmap, Stackmap);
+  SET_CLASS_NAME(stackmap, StackMap);
   SET_CLASS_NAME(var_descriptors, LocalVarDescriptors);
   SET_CLASS_NAME(exception_handlers, ExceptionHandlers);
   SET_CLASS_NAME(context, Context);
@@ -1023,8 +1051,9 @@
     WritableVMIsolateScope scope(Thread::Current());
     PremarkingVisitor premarker;
     ASSERT(isolate->heap()->UsedInWords(Heap::kNew) == 0);
-    isolate->heap()->IterateOldObjectsNoEmbedderPages(&premarker);
+    isolate->heap()->IterateOldObjectsNoImagePages(&premarker);
     // Make the VM isolate read-only again after setting all objects as marked.
+    // Note objects in image pages are already pre-marked.
   }
 }
 
@@ -1315,7 +1344,7 @@
     RegisterPrivateClass(cls, Symbols::_SendPortImpl(), isolate_lib);
     pending_classes.Add(cls);
 
-    const Class& stacktrace_cls = Class::Handle(zone, Class::New<Stacktrace>());
+    const Class& stacktrace_cls = Class::Handle(zone, Class::New<StackTrace>());
     RegisterPrivateClass(stacktrace_cls, Symbols::_StackTrace(), core_lib);
     pending_classes.Add(stacktrace_cls);
     // Super type set below, after Object is allocated.
@@ -1483,7 +1512,7 @@
     ASSERT(lib.raw() == Library::TypedDataLibrary());
 #define REGISTER_TYPED_DATA_CLASS(clazz)                                       \
   cls = Class::NewTypedDataClass(kTypedData##clazz##ArrayCid);                 \
-  RegisterClass(cls, Symbols::clazz##List(), lib);
+  RegisterPrivateClass(cls, Symbols::_##clazz##List(), lib);
 
     DART_CLASS_LIST_TYPED_DATA(REGISTER_TYPED_DATA_CLASS);
 #undef REGISTER_TYPED_DATA_CLASS
@@ -1504,43 +1533,52 @@
     cls = Class::New<Instance>(kByteBufferCid);
     cls.set_instance_size(0);
     cls.set_next_field_offset(-kWordSize);
-    RegisterClass(cls, Symbols::ByteBuffer(), lib);
+    RegisterPrivateClass(cls, Symbols::_ByteBuffer(), lib);
     pending_classes.Add(cls);
 
     CLASS_LIST_TYPED_DATA(REGISTER_EXT_TYPED_DATA_CLASS);
 #undef REGISTER_EXT_TYPED_DATA_CLASS
-    // Register Float32x4 and Int32x4 in the object store.
+    // Register Float32x4, Int32x4, and Float64x2 in the object store.
     cls = Class::New<Float32x4>();
+    RegisterPrivateClass(cls, Symbols::_Float32x4(), lib);
+    pending_classes.Add(cls);
+    object_store->set_float32x4_class(cls);
+
+    cls = Class::New<Instance>(kIllegalCid);
     RegisterClass(cls, Symbols::Float32x4(), lib);
     cls.set_num_type_arguments(0);
     cls.set_num_own_type_arguments(0);
     cls.set_is_prefinalized();
-    pending_classes.Add(cls);
-    object_store->set_float32x4_class(cls);
     type = Type::NewNonParameterizedType(cls);
     object_store->set_float32x4_type(type);
 
     cls = Class::New<Int32x4>();
+    RegisterPrivateClass(cls, Symbols::_Int32x4(), lib);
+    pending_classes.Add(cls);
+    object_store->set_int32x4_class(cls);
+
+    cls = Class::New<Instance>(kIllegalCid);
     RegisterClass(cls, Symbols::Int32x4(), lib);
     cls.set_num_type_arguments(0);
     cls.set_num_own_type_arguments(0);
     cls.set_is_prefinalized();
-    pending_classes.Add(cls);
-    object_store->set_int32x4_class(cls);
     type = Type::NewNonParameterizedType(cls);
     object_store->set_int32x4_type(type);
 
     cls = Class::New<Float64x2>();
+    RegisterPrivateClass(cls, Symbols::_Float64x2(), lib);
+    pending_classes.Add(cls);
+    object_store->set_float64x2_class(cls);
+
+    cls = Class::New<Instance>(kIllegalCid);
     RegisterClass(cls, Symbols::Float64x2(), lib);
     cls.set_num_type_arguments(0);
     cls.set_num_own_type_arguments(0);
     cls.set_is_prefinalized();
-    pending_classes.Add(cls);
-    object_store->set_float64x2_class(cls);
     type = Type::NewNonParameterizedType(cls);
     object_store->set_float64x2_type(type);
 
-    // Set the super type of class Stacktrace to Object type so that the
+    // Set the super type of class StackTrace to Object type so that the
     // 'toString' method is implemented.
     type = object_store->object_type();
     stacktrace_cls.set_super_type(type);
@@ -1733,7 +1771,7 @@
     cls = Class::New<Capability>();
     cls = Class::New<ReceivePort>();
     cls = Class::New<SendPort>();
-    cls = Class::New<Stacktrace>();
+    cls = Class::New<StackTrace>();
     cls = Class::New<RegExp>();
     cls = Class::New<Number>();
 
@@ -3345,6 +3383,8 @@
       return Symbols::Function().raw();
     case kClosureDataCid:
       return Symbols::ClosureData().raw();
+    case kSignatureDataCid:
+      return Symbols::SignatureData().raw();
     case kRedirectionDataCid:
       return Symbols::RedirectionData().raw();
     case kFieldCid:
@@ -3371,8 +3411,8 @@
       return Symbols::CodeSourceMap().raw();
     case kPcDescriptorsCid:
       return Symbols::PcDescriptors().raw();
-    case kStackmapCid:
-      return Symbols::Stackmap().raw();
+    case kStackMapCid:
+      return Symbols::StackMap().raw();
     case kLocalVarDescriptorsCid:
       return Symbols::LocalVarDescriptors().raw();
     case kExceptionHandlersCid:
@@ -3436,12 +3476,33 @@
   if (is_synthesized_class() || IsMixinApplication() || IsTopLevel()) {
     return token_pos();
   }
+
   Zone* zone = Thread::Current()->zone();
   const Script& scr = Script::Handle(zone, script());
   ASSERT(!scr.IsNull());
+
+  if (scr.kind() == RawScript::kKernelTag) {
+    TokenPosition largest_seen = token_pos();
+
+    // Walk through all functions and get their end_tokens to find the classes
+    // "end token".
+    // TODO(jensj): Should probably walk though all fields as well.
+    Function& function = Function::Handle(zone);
+    const Array& arr = Array::Handle(functions());
+    for (int i = 0; i < arr.Length(); i++) {
+      function ^= arr.At(i);
+      if (function.script() == script()) {
+        if (largest_seen < function.end_token_pos()) {
+          largest_seen = function.end_token_pos();
+        }
+      }
+    }
+    return TokenPosition(largest_seen);
+  }
+
   const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens());
   if (tkns.IsNull()) {
-    ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
+    ASSERT(Dart::vm_snapshot_kind() == Snapshot::kAppAOT);
     return TokenPosition::kNoSource;
   }
   TokenStream::Iterator tkit(zone, tkns, token_pos(),
@@ -3698,19 +3759,17 @@
     if (other.IsDynamicClass()) {
       return true;
     }
+    // Check for NullType, which, as of Dart 1.5, is a subtype of (and is more
+    // specific than) any type. Note that the null instance is not handled here.
+    if (thsi.IsNullClass()) {
+      return true;
+    }
     // In the case of a subtype test, each occurrence of DynamicType in type S
     // is interpreted as the bottom type, a subtype of all types.
     // However, DynamicType is not more specific than any type.
     if (thsi.IsDynamicClass()) {
       return test_kind == Class::kIsSubtypeOf;
     }
-    // Check for NullType, which is only a subtype of ObjectType, of
-    // DynamicType, or of itself, and which is more specific than any type.
-    if (thsi.IsNullClass()) {
-      // We already checked for other.IsDynamicClass() above.
-      return (test_kind == Class::kIsMoreSpecificThan) ||
-             other.IsObjectClass() || other.IsNullClass();
-    }
     // Check for ObjectType. Any type that is not NullType or DynamicType
     // (already checked above), is more specific than ObjectType.
     if (other.IsObjectClass()) {
@@ -5181,7 +5240,8 @@
 void Function::InstallOptimizedCode(const Code& code, bool is_osr) const {
   DEBUG_ASSERT(IsMutatorOrAtSafepoint());
   // We may not have previous code if FLAG_precompile is set.
-  if (!is_osr && HasCode()) {
+  // Hot-reload may have already disabled the current code.
+  if (!is_osr && HasCode() && !Code::Handle(CurrentCode()).IsDisabled()) {
     Code::Handle(CurrentCode()).DisableDartCode();
   }
   AttachCode(code);
@@ -5415,15 +5475,13 @@
 
 
 RawFunction* Function::parent_function() const {
-  if (IsClosureFunction()) {
+  if (IsClosureFunction() || IsSignatureFunction()) {
     const Object& obj = Object::Handle(raw_ptr()->data_);
     ASSERT(!obj.IsNull());
-    return ClosureData::Cast(obj).parent_function();
-  } else if (IsSignatureFunction()) {
-    const Object& obj = Object::Handle(raw_ptr()->data_);
-    // Parent function may be null or data_ may already be set to function type.
-    if (!obj.IsNull() && obj.IsFunction()) {
-      return Function::Cast(obj).raw();
+    if (IsClosureFunction()) {
+      return ClosureData::Cast(obj).parent_function();
+    } else {
+      return SignatureData::Cast(obj).parent_function();
     }
   }
   return Function::null();
@@ -5431,16 +5489,14 @@
 
 
 void Function::set_parent_function(const Function& value) const {
+  const Object& obj = Object::Handle(raw_ptr()->data_);
+  ASSERT(!obj.IsNull());
   if (IsClosureFunction()) {
-    const Object& obj = Object::Handle(raw_ptr()->data_);
-    ASSERT(!obj.IsNull());
     ClosureData::Cast(obj).set_parent_function(value);
-    return;
-  } else if (IsSignatureFunction()) {
-    set_data(value);  // Temporarily set during parsing only.
-    return;
+  } else {
+    ASSERT(IsSignatureFunction());
+    SignatureData::Cast(obj).set_parent_function(value);
   }
-  UNREACHABLE();
 }
 
 
@@ -5480,12 +5536,11 @@
 RawType* Function::SignatureType() const {
   Type& type = Type::Handle();
   const Object& obj = Object::Handle(raw_ptr()->data_);
+  ASSERT(!obj.IsNull());
   if (IsSignatureFunction()) {
-    ASSERT(obj.IsNull() || Type::Cast(obj).IsFunctionType());
-    type = obj.IsNull() ? Type::null() : Type::Cast(obj).raw();
+    type = SignatureData::Cast(obj).signature_type();
   } else {
     ASSERT(IsClosureFunction());
-    ASSERT(!obj.IsNull());
     type = ClosureData::Cast(obj).signature_type();
   }
   if (type.IsNull()) {
@@ -5526,12 +5581,13 @@
 
 
 void Function::SetSignatureType(const Type& value) const {
+  const Object& obj = Object::Handle(raw_ptr()->data_);
+  ASSERT(!obj.IsNull());
   if (IsSignatureFunction()) {
-    set_data(value);
+    SignatureData::Cast(obj).set_signature_type(value);
+    ASSERT(!value.IsCanonical() || (value.signature() == this->raw()));
   } else {
     ASSERT(IsClosureFunction());
-    const Object& obj = Object::Handle(raw_ptr()->data_);
-    ASSERT(!obj.IsNull());
     ClosureData::Cast(obj).set_signature_type(value);
   }
 }
@@ -5654,7 +5710,7 @@
 
 // This field is heavily overloaded:
 //   eval function:           Script expression source
-//   signature function:      Function type
+//   signature function:      SignatureData
 //   method extractor:        Function extracted closure function
 //   noSuchMethod dispatcher: Array arguments descriptor
 //   invoke-field dispatcher: Array arguments descriptor
@@ -5689,7 +5745,7 @@
 
 
 void Function::set_owner(const Object& value) const {
-  ASSERT(!value.IsNull());
+  ASSERT(!value.IsNull() || IsSignatureFunction());
   StorePointer(&raw_ptr()->owner_, value.raw());
 }
 
@@ -6525,6 +6581,9 @@
   if (kind == RawFunction::kClosureFunction) {
     const ClosureData& data = ClosureData::Handle(ClosureData::New());
     result.set_data(data);
+  } else if (kind == RawFunction::kSignatureFunction) {
+    const SignatureData& data = SignatureData::Handle(SignatureData::New());
+    result.set_data(data);
   }
   return result.raw();
 }
@@ -6818,6 +6877,28 @@
 }
 
 
+RawSmi* Function::GetClosureHashCode() const {
+  ASSERT(IsClosureFunction());
+  const Object& obj = Object::Handle(raw_ptr()->data_);
+  ASSERT(!obj.IsNull());
+  if (ClosureData::Cast(obj).hash() != Object::null()) {
+    return Smi::RawCast(ClosureData::Cast(obj).hash());
+  }
+  // Hash not yet computed. Compute and cache it.
+  const Class& cls = Class::Handle(Owner());
+  intptr_t result = String::Handle(name()).Hash();
+  result += String::Handle(Signature()).Hash();
+  result += String::Handle(cls.Name()).Hash();
+  // Finalize hash value like for strings so that it fits into a smi.
+  result += result << 3;
+  result ^= result >> 11;
+  result += result << 15;
+  result &= ((static_cast<intptr_t>(1) << String::kHashBits) - 1);
+  ClosureData::Cast(obj).set_hash(result);
+  return Smi::New(result);
+}
+
+
 RawString* Function::BuildSignature(bool instantiate,
                                     NameVisibility name_visibility,
                                     const TypeArguments& instantiator) const {
@@ -6890,6 +6971,10 @@
 
 
 RawClass* Function::Owner() const {
+  if (raw_ptr()->owner_ == Object::null()) {
+    ASSERT(IsSignatureFunction());
+    return Class::null();
+  }
   if (raw_ptr()->owner_->IsClass()) {
     return Class::RawCast(raw_ptr()->owner_);
   }
@@ -6900,6 +6985,10 @@
 
 
 RawClass* Function::origin() const {
+  if (raw_ptr()->owner_ == Object::null()) {
+    ASSERT(IsSignatureFunction());
+    return Class::null();
+  }
   if (raw_ptr()->owner_->IsClass()) {
     return Class::RawCast(raw_ptr()->owner_);
   }
@@ -6924,6 +7013,10 @@
     return Function::Handle(parent_function()).script();
   }
   const Object& obj = Object::Handle(raw_ptr()->owner_);
+  if (obj.IsNull()) {
+    ASSERT(IsSignatureFunction());
+    return Script::null();
+  }
   if (obj.IsClass()) {
     return Class::Cast(obj).script();
   }
@@ -7018,28 +7111,8 @@
 // Construct fingerprint from token stream. The token stream contains also
 // arguments.
 int32_t Function::SourceFingerprint() const {
-  uint32_t result = 0;
-  Zone* zone = Thread::Current()->zone();
-  TokenStream::Iterator tokens_iterator(
-      zone, TokenStream::Handle(zone, Script::Handle(zone, script()).tokens()),
-      token_pos());
-  Object& obj = Object::Handle(zone);
-  String& literal = String::Handle(zone);
-  while (tokens_iterator.CurrentPosition() < end_token_pos()) {
-    uint32_t val = 0;
-    obj = tokens_iterator.CurrentToken();
-    if (obj.IsSmi()) {
-      val = Smi::Cast(obj).Value();
-    } else {
-      literal = tokens_iterator.MakeLiteralToken(obj);
-      val = literal.Hash();
-    }
-    result = 31 * result + val;
-    tokens_iterator.Advance();
-  }
-  result = result & ((static_cast<uint32_t>(1) << 31) - 1);
-  ASSERT(result <= static_cast<uint32_t>(kMaxInt32));
-  return result;
+  return Script::Handle(script()).SourceFingerprint(token_pos(),
+                                                    end_token_pos());
 }
 
 
@@ -7139,7 +7212,7 @@
     if (recalculatingFingerprints) {
       // This output can be copied into a file, then used with sed
       // to replace the old values.
-      // sed -i .bak -f /tmp/newkeys runtime/vm/method_recognizer.h
+      // sed -i.bak -f /tmp/newkeys runtime/vm/method_recognizer.h
       THR_Print("s/0x%08x/0x%08x/\n", fp, SourceFingerprint());
     } else {
       THR_Print(
@@ -7214,6 +7287,11 @@
 }
 
 
+void ClosureData::set_hash(intptr_t value) const {
+  StorePointer(&raw_ptr()->hash_, static_cast<RawObject*>(Smi::New(value)));
+}
+
+
 void ClosureData::set_parent_function(const Function& value) const {
   StorePointer(&raw_ptr()->parent_function_, value.raw());
 }
@@ -7233,7 +7311,50 @@
 
 
 const char* ClosureData::ToCString() const {
-  return "ClosureData class";
+  if (IsNull()) {
+    return "ClosureData: null";
+  }
+  const Function& parent = Function::Handle(parent_function());
+  const Type& type = Type::Handle(signature_type());
+  return OS::SCreate(Thread::Current()->zone(),
+                     "ClosureData: context_scope: 0x%" Px
+                     " parent_function: %s signature_type: %s"
+                     " implicit_static_closure: 0x%" Px,
+                     reinterpret_cast<uword>(context_scope()),
+                     parent.IsNull() ? "null" : parent.ToCString(),
+                     type.IsNull() ? "null" : type.ToCString(),
+                     reinterpret_cast<uword>(implicit_static_closure()));
+}
+
+
+void SignatureData::set_parent_function(const Function& value) const {
+  StorePointer(&raw_ptr()->parent_function_, value.raw());
+}
+
+
+void SignatureData::set_signature_type(const Type& value) const {
+  StorePointer(&raw_ptr()->signature_type_, value.raw());
+}
+
+
+RawSignatureData* SignatureData::New() {
+  ASSERT(Object::signature_data_class() != Class::null());
+  RawObject* raw = Object::Allocate(SignatureData::kClassId,
+                                    SignatureData::InstanceSize(), Heap::kOld);
+  return reinterpret_cast<RawSignatureData*>(raw);
+}
+
+
+const char* SignatureData::ToCString() const {
+  if (IsNull()) {
+    return "SignatureData: null";
+  }
+  const Function& parent = Function::Handle(parent_function());
+  const Type& type = Type::Handle(signature_type());
+  return OS::SCreate(Thread::Current()->zone(),
+                     "SignatureData parent_function: %s signature_type: %s",
+                     parent.IsNull() ? "null" : parent.ToCString(),
+                     type.IsNull() ? "null" : type.ToCString());
 }
 
 
@@ -7262,7 +7383,17 @@
 
 
 const char* RedirectionData::ToCString() const {
-  return "RedirectionData class";
+  if (IsNull()) {
+    return "RedirectionData: null";
+  }
+  const Type& redir_type = Type::Handle(type());
+  const String& ident = String::Handle(identifier());
+  const Function& target_fun = Function::Handle(target());
+  return OS::SCreate(Thread::Current()->zone(),
+                     "RedirectionData: type: %s identifier: %s target: %s",
+                     redir_type.IsNull() ? "null" : redir_type.ToCString(),
+                     ident.IsNull() ? "null" : ident.ToCString(),
+                     target_fun.IsNull() ? "null" : target_fun.ToCString());
 }
 
 
@@ -7466,7 +7597,7 @@
                      bool is_final,
                      bool is_const,
                      bool is_reflectable,
-                     const Class& owner,
+                     const Object& owner,
                      const AbstractType& type,
                      TokenPosition token_pos) {
   ASSERT(!owner.IsNull());
@@ -7532,7 +7663,7 @@
   ASSERT(!scr.IsNull());
   const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens());
   if (tkns.IsNull()) {
-    ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
+    ASSERT(Dart::vm_snapshot_kind() == Snapshot::kAppAOT);
     return String::null();
   }
   TokenStream::Iterator tkit(zone, tkns, token_pos());
@@ -7592,7 +7723,7 @@
 
 const char* Field::ToCString() const {
   if (IsNull()) {
-    return "Field::null";
+    return "Field: null";
   }
   const char* kF0 = is_static() ? " static" : "";
   const char* kF1 = is_final() ? " final" : "";
@@ -8678,9 +8809,14 @@
 
 
 RawString* Script::GenerateSource() const {
+  if (kind() == RawScript::kKernelTag) {
+    // In kernel it's embedded.
+    return raw_ptr()->source_;
+  }
+
   const TokenStream& token_stream = TokenStream::Handle(tokens());
   if (token_stream.IsNull()) {
-    ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
+    ASSERT(Dart::vm_snapshot_kind() == Snapshot::kAppAOT);
     return String::null();
   }
   return token_stream.GenerateSource();
@@ -8699,8 +8835,32 @@
   const String& source = String::Handle(zone, Source());
   const String& key = Symbols::Empty();
   const Object& line_separator = Object::Handle(zone);
-  const TokenStream& tkns = TokenStream::Handle(zone, tokens());
   Smi& value = Smi::Handle(zone);
+
+  if (kind() == RawScript::kKernelTag) {
+    const Array& line_starts_array = Array::Handle(line_starts());
+    if (line_starts_array.IsNull()) {
+      // Scripts in the AOT snapshot do not have a line starts array.
+      // A well-formed line number array has a leading null.
+      info.Add(line_separator);  // New line.
+      return info.raw();
+    }
+    intptr_t line_count = line_starts_array.Length();
+    ASSERT(line_count > 0);
+
+    for (int i = 0; i < line_count; i++) {
+      info.Add(line_separator);  // New line.
+      value = Smi::New(i + 1);
+      info.Add(value);  // Line number.
+      value ^= line_starts_array.At(i);
+      info.Add(value);  // Token position.
+      value = Smi::New(1);
+      info.Add(value);  // Column.
+    }
+    return info.raw();
+  }
+
+  const TokenStream& tkns = TokenStream::Handle(zone, tokens());
   String& tokenValue = String::Handle(zone);
   ASSERT(!tkns.IsNull());
   TokenStream::Iterator tkit(zone, tkns, TokenPosition::kMinSource,
@@ -8832,6 +8992,10 @@
 
 
 void Script::Tokenize(const String& private_key, bool use_shared_tokens) const {
+  if (kind() == RawScript::kKernelTag) {
+    return;
+  }
+
   Thread* thread = Thread::Current();
   Zone* zone = thread->zone();
   const TokenStream& tkns = TokenStream::Handle(zone, tokens());
@@ -8898,7 +9062,9 @@
     }
     *line = min + 1;
     smi ^= line_starts_array.At(min);
-    *column = offset - smi.Value() + 1;
+    if (column != NULL) {
+      *column = offset - smi.Value() + 1;
+    }
     if (token_len != NULL) {
       *token_len = 1;
     }
@@ -8907,7 +9073,7 @@
 
   const TokenStream& tkns = TokenStream::Handle(zone, tokens());
   if (tkns.IsNull()) {
-    ASSERT((Dart::snapshot_kind() == Snapshot::kAppNoJIT));
+    ASSERT((Dart::vm_snapshot_kind() == Snapshot::kAppAOT));
     *line = -1;
     if (column != NULL) {
       *column = -1;
@@ -8957,6 +9123,29 @@
                               TokenPosition* last_token_index) const {
   ASSERT(first_token_index != NULL && last_token_index != NULL);
   ASSERT(line_number > 0);
+
+  if (kind() == RawScript::kKernelTag) {
+    const Array& line_starts_array = Array::Handle(line_starts());
+    if (line_starts_array.IsNull()) {
+      // Scripts in the AOT snapshot do not have a line starts array.
+      *first_token_index = TokenPosition::kNoSource;
+      *last_token_index = TokenPosition::kNoSource;
+      return;
+    }
+    ASSERT(line_starts_array.Length() >= line_number);
+    Smi& value = Smi::Handle();
+    value ^= line_starts_array.At(line_number - 1);
+    *first_token_index = TokenPosition(value.Value());
+    if (line_starts_array.Length() > line_number) {
+      value ^= line_starts_array.At(line_number);
+      *last_token_index = TokenPosition(value.Value() - 1);
+    } else {
+      // Length of source is last possible token in this script.
+      *last_token_index = TokenPosition(String::Handle(Source()).Length());
+    }
+    return;
+  }
+
   Zone* zone = Thread::Current()->zone();
   *first_token_index = TokenPosition::kNoSource;
   *last_token_index = TokenPosition::kNoSource;
@@ -9002,10 +9191,47 @@
 }
 
 
+int32_t Script::SourceFingerprint() const {
+  return SourceFingerprint(TokenPosition(TokenPosition::kMinSourcePos),
+                           TokenPosition(TokenPosition::kMaxSourcePos));
+}
+
+
+int32_t Script::SourceFingerprint(TokenPosition start,
+                                  TokenPosition end) const {
+  uint32_t result = 0;
+  Zone* zone = Thread::Current()->zone();
+  TokenStream::Iterator tokens_iterator(
+      zone, TokenStream::Handle(zone, tokens()), start);
+  Object& obj = Object::Handle(zone);
+  String& literal = String::Handle(zone);
+  while ((tokens_iterator.CurrentTokenKind() != Token::kEOS) &&
+         (tokens_iterator.CurrentPosition() < end)) {
+    uint32_t val = 0;
+    obj = tokens_iterator.CurrentToken();
+    if (obj.IsSmi()) {
+      val = Smi::Cast(obj).Value();
+    } else {
+      literal = tokens_iterator.MakeLiteralToken(obj);
+      if (tokens_iterator.CurrentTokenKind() == Token::kIDENT ||
+          tokens_iterator.CurrentTokenKind() == Token::kINTERPOL_VAR) {
+        literal = String::RemovePrivateKey(literal);
+      }
+      val = literal.Hash();
+    }
+    result = 31 * result + val;
+    tokens_iterator.Advance();
+  }
+  result = result & ((static_cast<uint32_t>(1) << 31) - 1);
+  ASSERT(result <= static_cast<uint32_t>(kMaxInt32));
+  return result;
+}
+
+
 RawString* Script::GetLine(intptr_t line_number, Heap::Space space) const {
   const String& src = String::Handle(Source());
   if (src.IsNull()) {
-    ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
+    ASSERT(Dart::vm_snapshot_kind() == Snapshot::kAppAOT);
     return Symbols::OptimizedOut().raw();
   }
   intptr_t relative_line_number = line_number - line_offset();
@@ -9055,7 +9281,7 @@
                               intptr_t to_column) const {
   const String& src = String::Handle(Source());
   if (src.IsNull()) {
-    ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
+    ASSERT(Dart::vm_snapshot_kind() == Snapshot::kAppAOT);
     return Symbols::OptimizedOut().raw();
   }
   intptr_t length = src.Length();
@@ -9457,7 +9683,8 @@
 
 void Library::AddMetadata(const Object& owner,
                           const String& name,
-                          TokenPosition token_pos) const {
+                          TokenPosition token_pos,
+                          kernel::TreeNode* kernel_node) const {
   Thread* thread = Thread::Current();
   ASSERT(thread->IsMutatorThread());
   Zone* zone = thread->zone();
@@ -9470,6 +9697,7 @@
   field.SetFieldType(Object::dynamic_type());
   field.set_is_reflectable(false);
   field.SetStaticValue(Array::empty_array(), true);
+  field.set_kernel_field(kernel_node);
   GrowableObjectArray& metadata =
       GrowableObjectArray::Handle(zone, this->metadata());
   metadata.Add(field, Heap::kOld);
@@ -9478,34 +9706,37 @@
 
 void Library::AddClassMetadata(const Class& cls,
                                const Object& tl_owner,
-                               TokenPosition token_pos) const {
+                               TokenPosition token_pos,
+                               kernel::TreeNode* kernel_node) const {
   Thread* thread = Thread::Current();
   Zone* zone = thread->zone();
   // We use the toplevel class as the owner of a class's metadata field because
   // a class's metadata is in scope of the library, not the class.
   AddMetadata(tl_owner,
               String::Handle(zone, MakeClassMetaName(thread, zone, cls)),
-              token_pos);
+              token_pos, kernel_node);
 }
 
 
 void Library::AddFieldMetadata(const Field& field,
-                               TokenPosition token_pos) const {
+                               TokenPosition token_pos,
+                               kernel::TreeNode* kernel_node) const {
   Thread* thread = Thread::Current();
   Zone* zone = thread->zone();
   AddMetadata(Object::Handle(zone, field.RawOwner()),
               String::Handle(zone, MakeFieldMetaName(thread, zone, field)),
-              token_pos);
+              token_pos, kernel_node);
 }
 
 
 void Library::AddFunctionMetadata(const Function& func,
-                                  TokenPosition token_pos) const {
+                                  TokenPosition token_pos,
+                                  kernel::TreeNode* kernel_node) const {
   Thread* thread = Thread::Current();
   Zone* zone = thread->zone();
   AddMetadata(Object::Handle(zone, func.RawOwner()),
               String::Handle(zone, MakeFunctionMetaName(thread, zone, func)),
-              token_pos);
+              token_pos, kernel_node);
 }
 
 
@@ -9564,6 +9795,10 @@
 
 
 RawObject* Library::GetMetadata(const Object& obj) const {
+#if defined(DART_PRECOMPILED_RUNTIME)
+  COMPILE_ASSERT(!FLAG_enable_mirrors);
+  return Object::empty_array().raw();
+#else
   if (!obj.IsClass() && !obj.IsField() && !obj.IsFunction() &&
       !obj.IsLibrary() && !obj.IsTypeParameter()) {
     return Object::null();
@@ -9577,13 +9812,21 @@
   Object& metadata = Object::Handle();
   metadata = field.StaticValue();
   if (field.StaticValue() == Object::empty_array().raw()) {
-    metadata = Parser::ParseMetadata(field);
+    kernel::TreeNode* kernel_node =
+        reinterpret_cast<kernel::TreeNode*>(field.kernel_field());
+
+    if (kernel_node != NULL) {
+      metadata = kernel::EvaluateMetadata(kernel_node);
+    } else {
+      metadata = Parser::ParseMetadata(field);
+    }
     if (metadata.IsArray()) {
       ASSERT(Array::Cast(metadata).raw() != Object::empty_array().raw());
       field.SetStaticValue(Array::Cast(metadata), true);
     }
   }
   return metadata.raw();
+#endif  // defined(DART_PRECOMPILED_RUNTIME)
 }
 
 
@@ -10969,7 +11212,7 @@
   }
   ASSERT(is_deferred_load());
   ASSERT(num_imports() == 1);
-  if (Dart::snapshot_kind() == Snapshot::kAppNoJIT) {
+  if (Dart::vm_snapshot_kind() == Snapshot::kAppAOT) {
     // The library list was tree-shaken away.
     this->set_is_loaded();
     return true;
@@ -11469,19 +11712,16 @@
 #undef CHECK_FINGERPRINTS2
 
 
-  Class& cls = Class::Handle();
-
-#define CHECK_FACTORY_FINGERPRINTS(factory_symbol, cid, fp)                    \
-  cls = Isolate::Current()->class_table()->At(cid);                            \
-  func = cls.LookupFunctionAllowPrivate(Symbols::factory_symbol());            \
+#define CHECK_FACTORY_FINGERPRINTS(symbol, class_name, factory_name, cid, fp)  \
+  func = GetFunction(all_libs, #class_name, #factory_name);                    \
   if (func.IsNull()) {                                                         \
     has_errors = true;                                                         \
-    OS::Print("Function not found %s.%s\n", cls.ToCString(),                   \
-              Symbols::factory_symbol().ToCString());                          \
+    OS::Print("Function not found %s.%s\n", #class_name, #factory_name);       \
   } else {                                                                     \
-    CHECK_FINGERPRINT2(func, factory_symbol, cid, fp);                         \
+    CHECK_FINGERPRINT2(func, symbol, cid, fp);                                 \
   }
 
+  all_libs.Add(&Library::ZoneHandle(Library::CoreLibrary()));
   RECOGNIZED_LIST_FACTORY_LIST(CHECK_FACTORY_FINGERPRINTS);
 
 #undef CHECK_FACTORY_FINGERPRINTS
@@ -11602,8 +11842,8 @@
 
 
 ObjectPool::EntryType ObjectPool::InfoAt(intptr_t index) const {
-  const TypedData& array = TypedData::Handle(info_array());
-  return static_cast<EntryType>(array.GetInt8(index));
+  ObjectPoolInfo pool_info(*this);
+  return pool_info.InfoAt(index);
 }
 
 
@@ -11700,6 +11940,8 @@
       return "runtime-call ";
     case RawPcDescriptors::kOsrEntry:
       return "osr-entry    ";
+    case RawPcDescriptors::kRewind:
+      return "rewind       ";
     case RawPcDescriptors::kOther:
       return "other        ";
     case RawPcDescriptors::kAnyKind:
@@ -11973,7 +12215,7 @@
 }
 
 
-bool Stackmap::GetBit(intptr_t bit_index) const {
+bool StackMap::GetBit(intptr_t bit_index) const {
   ASSERT(InRange(bit_index));
   int byte_index = bit_index >> kBitsPerByteLog2;
   int bit_remainder = bit_index & (kBitsPerByte - 1);
@@ -11983,7 +12225,7 @@
 }
 
 
-void Stackmap::SetBit(intptr_t bit_index, bool value) const {
+void StackMap::SetBit(intptr_t bit_index, bool value) const {
   ASSERT(InRange(bit_index));
   int byte_index = bit_index >> kBitsPerByteLog2;
   int bit_remainder = bit_index & (kBitsPerByte - 1);
@@ -11998,30 +12240,30 @@
 }
 
 
-RawStackmap* Stackmap::New(intptr_t pc_offset,
+RawStackMap* StackMap::New(intptr_t pc_offset,
                            BitmapBuilder* bmap,
                            intptr_t slow_path_bit_count) {
   ASSERT(Object::stackmap_class() != Class::null());
   ASSERT(bmap != NULL);
-  Stackmap& result = Stackmap::Handle();
+  StackMap& result = StackMap::Handle();
   // Guard against integer overflow of the instance size computation.
   intptr_t length = bmap->Length();
   intptr_t payload_size = Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte;
   if ((payload_size < 0) || (payload_size > kMaxLengthInBytes)) {
     // This should be caught before we reach here.
-    FATAL1("Fatal error in Stackmap::New: invalid length %" Pd "\n", length);
+    FATAL1("Fatal error in StackMap::New: invalid length %" Pd "\n", length);
   }
   {
-    // Stackmap data objects are associated with a code object, allocate them
+    // StackMap data objects are associated with a code object, allocate them
     // in old generation.
     RawObject* raw = Object::Allocate(
-        Stackmap::kClassId, Stackmap::InstanceSize(length), Heap::kOld);
+        StackMap::kClassId, StackMap::InstanceSize(length), Heap::kOld);
     NoSafepointScope no_safepoint;
     result ^= raw;
     result.SetLength(length);
   }
   // When constructing a stackmap we store the pc offset in the stackmap's
-  // PC. StackmapTableBuilder::FinalizeStackmaps will replace it with the pc
+  // PC. StackMapTableBuilder::FinalizeStackMaps will replace it with the pc
   // address.
   ASSERT(pc_offset >= 0);
   result.SetPcOffset(pc_offset);
@@ -12033,28 +12275,28 @@
 }
 
 
-RawStackmap* Stackmap::New(intptr_t length,
+RawStackMap* StackMap::New(intptr_t length,
                            intptr_t slow_path_bit_count,
                            intptr_t pc_offset) {
   ASSERT(Object::stackmap_class() != Class::null());
-  Stackmap& result = Stackmap::Handle();
+  StackMap& result = StackMap::Handle();
   // Guard against integer overflow of the instance size computation.
   intptr_t payload_size = Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte;
   if ((payload_size < 0) || (payload_size > kMaxLengthInBytes)) {
     // This should be caught before we reach here.
-    FATAL1("Fatal error in Stackmap::New: invalid length %" Pd "\n", length);
+    FATAL1("Fatal error in StackMap::New: invalid length %" Pd "\n", length);
   }
   {
-    // Stackmap data objects are associated with a code object, allocate them
+    // StackMap data objects are associated with a code object, allocate them
     // in old generation.
     RawObject* raw = Object::Allocate(
-        Stackmap::kClassId, Stackmap::InstanceSize(length), Heap::kOld);
+        StackMap::kClassId, StackMap::InstanceSize(length), Heap::kOld);
     NoSafepointScope no_safepoint;
     result ^= raw;
     result.SetLength(length);
   }
   // When constructing a stackmap we store the pc offset in the stackmap's
-  // PC. StackmapTableBuilder::FinalizeStackmaps will replace it with the pc
+  // PC. StackMapTableBuilder::FinalizeStackMaps will replace it with the pc
   // address.
   ASSERT(pc_offset >= 0);
   result.SetPcOffset(pc_offset);
@@ -12063,7 +12305,7 @@
 }
 
 
-const char* Stackmap::ToCString() const {
+const char* StackMap::ToCString() const {
 #define FORMAT "%#05x: "
   if (IsNull()) {
     return "{null}";
@@ -12268,7 +12510,7 @@
 }
 
 
-bool ExceptionHandlers::NeedsStacktrace(intptr_t try_index) const {
+bool ExceptionHandlers::NeedsStackTrace(intptr_t try_index) const {
   ASSERT((try_index >= 0) && (try_index < num_entries()));
   return raw_ptr()->data()[try_index].needs_stacktrace;
 }
@@ -12573,7 +12815,7 @@
 RawFunction* ICData::Owner() const {
   Object& obj = Object::Handle(raw_ptr()->owner_);
   if (obj.IsNull()) {
-    ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
+    ASSERT(Dart::vm_snapshot_kind() == Snapshot::kAppAOT);
     return Function::null();
   } else if (obj.IsFunction()) {
     return Function::Cast(obj).raw();
@@ -12955,7 +13197,8 @@
 }
 
 void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids,
-                      const Function& target) const {
+                      const Function& target,
+                      intptr_t count) const {
   ASSERT(!target.IsNull());
   ASSERT((target.name() == target_name()) || ValidateInterceptor(target));
   DEBUG_ASSERT(!HasCheck(class_ids));
@@ -12999,7 +13242,7 @@
   }
   ASSERT(!target.IsNull());
   data.SetAt(data_pos++, target);
-  value = Smi::New(1);
+  value = Smi::New(count);
   data.SetAt(data_pos, value);
   // Multithreaded access to ICData requires setting of array to be the last
   // operation.
@@ -13439,13 +13682,12 @@
 }
 
 
-bool ICData::HasOnlyDispatcherTargets() const {
+bool ICData::HasOnlyDispatcherOrImplicitAccessorTargets() const {
   const intptr_t len = NumberOfChecks();
   Function& target = Function::Handle();
   for (intptr_t i = 0; i < len; i++) {
     target = GetTargetAt(i);
-    if (!target.IsNoSuchMethodDispatcher() &&
-        !target.IsInvokeFieldDispatcher()) {
+    if (!target.IsDispatcherOrImplicitAccessor()) {
       return false;
     }
   }
@@ -13677,9 +13919,6 @@
   if (v.IsNull()) {
     ASSERT(!is_optimized());
     const Function& f = Function::Handle(function());
-    if (f.kernel_function() != NULL) {
-      return v.raw();
-    }
     ASSERT(!f.IsIrregexpFunction());  // Not yet implemented.
     Compiler::ComputeLocalVarDescriptors(*this);
   }
@@ -13764,7 +14003,7 @@
   uword code_entry = instrs.PayloadStart();
   const Array& table = Array::Handle(deopt_info_array());
   if (table.IsNull()) {
-    ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
+    ASSERT(Dart::vm_snapshot_kind() == Snapshot::kAppAOT);
     return TypedData::null();
   }
   // Linear search for the PC offset matching the target PC.
@@ -14390,21 +14629,21 @@
 }
 
 
-RawStackmap* Code::GetStackmap(uint32_t pc_offset,
+RawStackMap* Code::GetStackMap(uint32_t pc_offset,
                                Array* maps,
-                               Stackmap* map) const {
+                               StackMap* map) const {
   // This code is used during iterating frames during a GC and hence it
   // should not in turn start a GC.
   NoSafepointScope no_safepoint;
   if (stackmaps() == Array::null()) {
     // No stack maps are present in the code object which means this
     // frame relies on tagged pointers.
-    return Stackmap::null();
+    return StackMap::null();
   }
   // A stack map is present in the code object, use the stack map to visit
   // frame slots which are marked as having objects.
   *maps = stackmaps();
-  *map = Stackmap::null();
+  *map = StackMap::null();
   for (intptr_t i = 0; i < maps->Length(); i++) {
     *map ^= maps->At(i);
     ASSERT(!map->IsNull());
@@ -14418,7 +14657,7 @@
   // Running with --verify-on-transition should hit this.
   ASSERT(!is_optimized() ||
          (pc_offset == UncheckedEntryPoint() - PayloadStart()));
-  return Stackmap::null();
+  return StackMap::null();
 }
 
 
@@ -15196,7 +15435,7 @@
     result ^= raw;
   }
   result.set_exception(Object::null_instance());
-  result.set_stacktrace(Stacktrace::Handle());
+  result.set_stacktrace(StackTrace::Handle());
   return result.raw();
 }
 
@@ -15650,6 +15889,12 @@
     return false;
   }
   other_class = instantiated_other.type_class();
+  if (IsNull()) {
+    ASSERT(cls.IsNullClass());
+    // As of Dart 1.5, the null instance and Null type are handled differently.
+    // We already checked for other.IsDynamicType().
+    return other_class.IsNullClass() || other_class.IsObjectClass();
+  }
   return cls.IsSubtypeOf(type_arguments, other_class, other_type_arguments,
                          bound_error, NULL, Heap::kOld);
 }
@@ -16349,7 +16594,10 @@
     }
     return false;
   }
-  if (other.IsObjectType() || other.IsDynamicType()) {
+  // Any type is a subtype of (and is more specific than) Object and dynamic.
+  // As of Dart 1.5, the Null type is a subtype of (and is more specific than)
+  // any type.
+  if (other.IsObjectType() || other.IsDynamicType() || IsNullType()) {
     return true;
   }
   Zone* zone = Thread::Current()->zone();
@@ -16982,6 +17230,7 @@
     const Class& owner = Class::Handle(zone, fun.Owner());
     Function& fun_clone = Function::Handle(
         zone, Function::NewSignatureFunction(owner, TokenPosition::kNoSource));
+    // TODO(regis): Handle cloning of a generic function type.
     AbstractType& type = AbstractType::Handle(zone, fun.result_type());
     type = type.CloneUnfinalized();
     fun_clone.set_result_type(type);
@@ -16998,6 +17247,7 @@
     }
     fun_clone.set_parameter_names(Array::Handle(zone, fun.parameter_names()));
     clone.set_signature(fun_clone);
+    fun_clone.SetSignatureType(clone);
   }
   clone.SetIsResolved();
   return clone.raw();
@@ -17194,6 +17444,10 @@
         }
         sig_fun.set_parameter_names(Array::Handle(zone, fun.parameter_names()));
         set_signature(sig_fun);
+        // Note that the signature type of the signature function may be
+        // different than the type being canonicalized.
+        // Consider F<int> being canonicalized, with F being a typedef and F<T>
+        // being its signature type.
       }
     }
 
@@ -22262,70 +22516,70 @@
 }
 
 
-intptr_t Stacktrace::Length() const {
+intptr_t StackTrace::Length() const {
   const Array& code_array = Array::Handle(raw_ptr()->code_array_);
   return code_array.Length();
 }
 
 
-RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const {
+RawFunction* StackTrace::FunctionAtFrame(intptr_t frame_index) const {
   const Code& code = Code::Handle(CodeAtFrame(frame_index));
   return code.IsNull() ? Function::null() : code.function();
 }
 
 
-RawCode* Stacktrace::CodeAtFrame(intptr_t frame_index) const {
+RawCode* StackTrace::CodeAtFrame(intptr_t frame_index) const {
   const Array& code_array = Array::Handle(raw_ptr()->code_array_);
   return reinterpret_cast<RawCode*>(code_array.At(frame_index));
 }
 
 
-void Stacktrace::SetCodeAtFrame(intptr_t frame_index, const Code& code) const {
+void StackTrace::SetCodeAtFrame(intptr_t frame_index, const Code& code) const {
   const Array& code_array = Array::Handle(raw_ptr()->code_array_);
   code_array.SetAt(frame_index, code);
 }
 
 
-RawSmi* Stacktrace::PcOffsetAtFrame(intptr_t frame_index) const {
+RawSmi* StackTrace::PcOffsetAtFrame(intptr_t frame_index) const {
   const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
   return reinterpret_cast<RawSmi*>(pc_offset_array.At(frame_index));
 }
 
 
-void Stacktrace::SetPcOffsetAtFrame(intptr_t frame_index,
+void StackTrace::SetPcOffsetAtFrame(intptr_t frame_index,
                                     const Smi& pc_offset) const {
   const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_);
   pc_offset_array.SetAt(frame_index, pc_offset);
 }
 
 
-void Stacktrace::set_code_array(const Array& code_array) const {
+void StackTrace::set_code_array(const Array& code_array) const {
   StorePointer(&raw_ptr()->code_array_, code_array.raw());
 }
 
 
-void Stacktrace::set_pc_offset_array(const Array& pc_offset_array) const {
+void StackTrace::set_pc_offset_array(const Array& pc_offset_array) const {
   StorePointer(&raw_ptr()->pc_offset_array_, pc_offset_array.raw());
 }
 
 
-void Stacktrace::set_expand_inlined(bool value) const {
+void StackTrace::set_expand_inlined(bool value) const {
   StoreNonPointer(&raw_ptr()->expand_inlined_, value);
 }
 
 
-bool Stacktrace::expand_inlined() const {
+bool StackTrace::expand_inlined() const {
   return raw_ptr()->expand_inlined_;
 }
 
 
-RawStacktrace* Stacktrace::New(const Array& code_array,
+RawStackTrace* StackTrace::New(const Array& code_array,
                                const Array& pc_offset_array,
                                Heap::Space space) {
-  Stacktrace& result = Stacktrace::Handle();
+  StackTrace& result = StackTrace::Handle();
   {
-    RawObject* raw = Object::Allocate(Stacktrace::kClassId,
-                                      Stacktrace::InstanceSize(), space);
+    RawObject* raw = Object::Allocate(StackTrace::kClassId,
+                                      StackTrace::InstanceSize(), space);
     NoSafepointScope no_safepoint;
     result ^= raw;
   }
@@ -22336,13 +22590,13 @@
 }
 
 
-const char* Stacktrace::ToCString() const {
+const char* StackTrace::ToCString() const {
   intptr_t idx = 0;
   return ToCStringInternal(&idx);
 }
 
 
-static intptr_t PrintOneStacktrace(Zone* zone,
+static intptr_t PrintOneStackTrace(Zone* zone,
                                    GrowableArray<char*>* frame_strings,
                                    uword pc,
                                    const Function& function,
@@ -22380,7 +22634,7 @@
 }
 
 
-const char* Stacktrace::ToCStringInternal(intptr_t* frame_index,
+const char* StackTrace::ToCStringInternal(intptr_t* frame_index,
                                           intptr_t max_frames) const {
   Zone* zone = Thread::Current()->zone();
   Function& function = Function::Handle();
@@ -22423,14 +22677,14 @@
             ASSERT(pc != 0);
             ASSERT(code.PayloadStart() <= pc);
             ASSERT(pc < (code.PayloadStart() + code.Size()));
-            total_len += PrintOneStacktrace(zone, &frame_strings, pc, function,
+            total_len += PrintOneStackTrace(zone, &frame_strings, pc, function,
                                             code, *frame_index);
             (*frame_index)++;  // To account for inlined frames.
           }
         }
       } else {
         if (function.is_visible() || FLAG_show_invisible_frames) {
-          total_len += PrintOneStacktrace(zone, &frame_strings, pc, function,
+          total_len += PrintOneStackTrace(zone, &frame_strings, pc, function,
                                           code, *frame_index);
           (*frame_index)++;
         }
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index ee6c10c..d010ec3 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -31,6 +31,7 @@
 // Forward declarations.
 namespace kernel {
 class Program;
+class TreeNode;
 }
 
 #define DEFINE_FORWARD_DECLARATION(clazz) class clazz;
@@ -488,6 +489,7 @@
   static RawClass* patch_class_class() { return patch_class_class_; }
   static RawClass* function_class() { return function_class_; }
   static RawClass* closure_data_class() { return closure_data_class_; }
+  static RawClass* signature_data_class() { return signature_data_class_; }
   static RawClass* redirection_data_class() { return redirection_data_class_; }
   static RawClass* field_class() { return field_class_; }
   static RawClass* literal_token_class() { return literal_token_class_; }
@@ -745,6 +747,7 @@
   static RawClass* patch_class_class_;     // Class of the PatchClass vm object.
   static RawClass* function_class_;        // Class of the Function vm object.
   static RawClass* closure_data_class_;    // Class of ClosureData vm obj.
+  static RawClass* signature_data_class_;  // Class of SignatureData vm obj.
   static RawClass* redirection_data_class_;  // Class of RedirectionData vm obj.
   static RawClass* field_class_;             // Class of the Field vm object.
   static RawClass* literal_token_class_;     // Class of LiteralToken vm object.
@@ -757,7 +760,7 @@
   static RawClass* object_pool_class_;   // Class of the ObjectPool vm object.
   static RawClass* pc_descriptors_class_;   // Class of PcDescriptors vm object.
   static RawClass* code_source_map_class_;  // Class of CodeSourceMap vm object.
-  static RawClass* stackmap_class_;         // Class of Stackmap vm object.
+  static RawClass* stackmap_class_;         // Class of StackMap vm object.
   static RawClass* var_descriptors_class_;  // Class of LocalVarDescriptors.
   static RawClass* exception_handlers_class_;  // Class of ExceptionHandlers.
   static RawClass* deopt_info_class_;          // Class of DeoptInfo.
@@ -1506,7 +1509,7 @@
   friend class Object;
   friend class Type;
   friend class Intrinsifier;
-  friend class Precompiler;
+  friend class ProgramVisitor;
 };
 
 
@@ -1742,6 +1745,7 @@
   FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeArguments, Object);
   friend class AbstractType;
   friend class Class;
+  friend class ClearTypeHashVisitor;
 };
 
 
@@ -1974,7 +1978,8 @@
   // Adds one more class test to ICData. Length of 'classes' must be equal to
   // the number of arguments tested. Use only for num_args_tested > 1.
   void AddCheck(const GrowableArray<intptr_t>& class_ids,
-                const Function& target) const;
+                const Function& target,
+                intptr_t count = 1) const;
   // Adds sorted so that Smi is the first class-id. Use only for
   // num_args_tested == 1.
   void AddReceiverCheck(intptr_t receiver_class_id,
@@ -2033,7 +2038,7 @@
   bool AllTargetsHaveSameOwner(intptr_t owner_cid) const;
   bool AllReceiversAreNumbers() const;
   bool HasOneTarget() const;
-  bool HasOnlyDispatcherTargets() const;
+  bool HasOnlyDispatcherOrImplicitAccessorTargets() const;
   bool HasReceiverClassId(intptr_t class_id) const;
 
   static RawICData* New(const Function& owner,
@@ -2344,6 +2349,8 @@
 
   RawInstance* ImplicitInstanceClosure(const Instance& receiver) const;
 
+  RawSmi* GetClosureHashCode() const;
+
   // Redirection information for a redirecting factory.
   bool IsRedirectingFactory() const;
   RawType* RedirectionType() const;
@@ -2649,6 +2656,18 @@
                 Error* bound_error,
                 Heap::Space space) const;
 
+  bool IsDispatcherOrImplicitAccessor() const {
+    switch (kind()) {
+      case RawFunction::kImplicitGetter:
+      case RawFunction::kImplicitSetter:
+      case RawFunction::kNoSuchMethodDispatcher:
+      case RawFunction::kInvokeFieldDispatcher:
+        return true;
+      default:
+        return false;
+    }
+  }
+
   // Returns true if this function represents an explicit getter function.
   bool IsGetterFunction() const {
     return kind() == RawFunction::kGetterFunction;
@@ -2976,6 +2995,7 @@
   // RawFunction::VisitFunctionPointers accesses the private constructor of
   // Function.
   friend class RawFunction;
+  friend class ClassFinalizer;  // To reset parent_function.
 };
 
 
@@ -3000,6 +3020,9 @@
   RawInstance* implicit_static_closure() const { return raw_ptr()->closure_; }
   void set_implicit_static_closure(const Instance& closure) const;
 
+  RawObject* hash() const { return raw_ptr()->hash_; }
+  void set_hash(intptr_t value) const;
+
   static RawClosureData* New();
 
   FINAL_HEAP_OBJECT_IMPLEMENTATION(ClosureData, Object);
@@ -3009,6 +3032,30 @@
 };
 
 
+class SignatureData : public Object {
+ public:
+  static intptr_t InstanceSize() {
+    return RoundedAllocationSize(sizeof(RawSignatureData));
+  }
+
+ private:
+  // Enclosing function of this signature function.
+  RawFunction* parent_function() const { return raw_ptr()->parent_function_; }
+  void set_parent_function(const Function& value) const;
+
+  // Signature type of this signature function.
+  RawType* signature_type() const { return raw_ptr()->signature_type_; }
+  void set_signature_type(const Type& value) const;
+
+  static RawSignatureData* New();
+
+  FINAL_HEAP_OBJECT_IMPLEMENTATION(SignatureData, Object);
+  friend class Class;
+  friend class Function;
+  friend class HeapProfiler;
+};
+
+
 class RedirectionData : public Object {
  public:
   static intptr_t InstanceSize() {
@@ -3120,7 +3167,7 @@
                        bool is_final,
                        bool is_const,
                        bool is_reflectable,
-                       const Class& owner,
+                       const Object& owner,
                        const AbstractType& type,
                        TokenPosition token_pos);
 
@@ -3503,9 +3550,10 @@
   }
   void set_compile_time_constants(const Array& value) const;
 
-  RawTokenStream* tokens() const { return raw_ptr()->tokens_; }
-
-  RawArray* line_starts() const { return raw_ptr()->line_starts_; }
+  RawTokenStream* tokens() const {
+    ASSERT(kind() != RawScript::kKernelTag);
+    return raw_ptr()->tokens_;
+  }
 
   void set_line_starts(const Array& value) const;
 
@@ -3535,6 +3583,9 @@
                         TokenPosition* first_token_index,
                         TokenPosition* last_token_index) const;
 
+  int32_t SourceFingerprint() const;
+  int32_t SourceFingerprint(TokenPosition start, TokenPosition end) const;
+
   static intptr_t InstanceSize() {
     return RoundedAllocationSize(sizeof(RawScript));
   }
@@ -3555,6 +3606,7 @@
   void set_kind(RawScript::Kind value) const;
   void set_load_timestamp(int64_t value) const;
   void set_tokens(const TokenStream& value) const;
+  RawArray* line_starts() const { return raw_ptr()->line_starts_; }
 
   static RawScript* New();
 
@@ -3712,9 +3764,14 @@
 
   void AddClassMetadata(const Class& cls,
                         const Object& tl_owner,
-                        TokenPosition token_pos) const;
-  void AddFieldMetadata(const Field& field, TokenPosition token_pos) const;
-  void AddFunctionMetadata(const Function& func, TokenPosition token_pos) const;
+                        TokenPosition token_pos,
+                        kernel::TreeNode* kernel_node = NULL) const;
+  void AddFieldMetadata(const Field& field,
+                        TokenPosition token_pos,
+                        kernel::TreeNode* kernel_node = NULL) const;
+  void AddFunctionMetadata(const Function& func,
+                           TokenPosition token_pos,
+                           kernel::TreeNode* kernel_node = NULL) const;
   void AddLibraryMetadata(const Object& tl_owner,
                           TokenPosition token_pos) const;
   void AddTypeParameterMetadata(const TypeParameter& param,
@@ -3881,7 +3938,8 @@
   RawField* GetMetadataField(const String& metaname) const;
   void AddMetadata(const Object& owner,
                    const String& name,
-                   TokenPosition token_pos) const;
+                   TokenPosition token_pos,
+                   kernel::TreeNode* kernel_node = NULL) const;
 
   FINAL_HEAP_OBJECT_IMPLEMENTATION(Library, Object);
 
@@ -4161,8 +4219,8 @@
   FINAL_HEAP_OBJECT_IMPLEMENTATION(Instructions, Object);
   friend class Class;
   friend class Code;
-  friend class AssemblyInstructionsWriter;
-  friend class BlobInstructionsWriter;
+  friend class AssemblyImageWriter;
+  friend class BlobImageWriter;
 };
 
 
@@ -4403,7 +4461,7 @@
 };
 
 
-class Stackmap : public Object {
+class StackMap : public Object {
  public:
   static const intptr_t kNoMaximum = -1;
   static const intptr_t kNoMinimum = -1;
@@ -4427,7 +4485,7 @@
     StoreNonPointer(&raw_ptr()->slow_path_bit_count_, bit_count);
   }
 
-  bool Equals(const Stackmap& other) const {
+  bool Equals(const StackMap& other) const {
     if (Length() != other.Length()) {
       return false;
     }
@@ -4438,20 +4496,20 @@
   static const intptr_t kMaxLengthInBytes = kSmiMax;
 
   static intptr_t InstanceSize() {
-    ASSERT(sizeof(RawStackmap) == OFFSET_OF_RETURNED_VALUE(RawStackmap, data));
+    ASSERT(sizeof(RawStackMap) == OFFSET_OF_RETURNED_VALUE(RawStackMap, data));
     return 0;
   }
   static intptr_t InstanceSize(intptr_t length) {
     ASSERT(length >= 0);
     // The stackmap payload is in an array of bytes.
     intptr_t payload_size = Utils::RoundUp(length, kBitsPerByte) / kBitsPerByte;
-    return RoundedAllocationSize(sizeof(RawStackmap) + payload_size);
+    return RoundedAllocationSize(sizeof(RawStackMap) + payload_size);
   }
-  static RawStackmap* New(intptr_t pc_offset,
+  static RawStackMap* New(intptr_t pc_offset,
                           BitmapBuilder* bmap,
                           intptr_t register_bit_count);
 
-  static RawStackmap* New(intptr_t length,
+  static RawStackMap* New(intptr_t length,
                           intptr_t register_bit_count,
                           intptr_t pc_offset);
 
@@ -4465,7 +4523,7 @@
   bool GetBit(intptr_t bit_index) const;
   void SetBit(intptr_t bit_index, bool value) const;
 
-  FINAL_HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object);
+  FINAL_HEAP_OBJECT_IMPLEMENTATION(StackMap, Object);
   friend class BitmapBuilder;
   friend class Class;
 };
@@ -4482,7 +4540,7 @@
 
   uword HandlerPCOffset(intptr_t try_index) const;
   intptr_t OuterTryIndex(intptr_t try_index) const;
-  bool NeedsStacktrace(intptr_t try_index) const;
+  bool NeedsStackTrace(intptr_t try_index) const;
 
   void SetHandlerInfo(intptr_t try_index,
                       intptr_t outer_try_index,
@@ -4680,9 +4738,9 @@
 
   RawArray* stackmaps() const { return raw_ptr()->stackmaps_; }
   void set_stackmaps(const Array& maps) const;
-  RawStackmap* GetStackmap(uint32_t pc_offset,
+  RawStackMap* GetStackMap(uint32_t pc_offset,
                            Array* stackmaps,
-                           Stackmap* map) const;
+                           StackMap* map) const;
 
   enum {
     kSCallTableOffsetEntry = 0,
@@ -5956,6 +6014,7 @@
   FINAL_HEAP_OBJECT_IMPLEMENTATION(Type, AbstractType);
   friend class Class;
   friend class TypeArguments;
+  friend class ClearTypeHashVisitor;
 };
 
 
@@ -6128,6 +6187,7 @@
 
   FINAL_HEAP_OBJECT_IMPLEMENTATION(TypeParameter, AbstractType);
   friend class Class;
+  friend class ClearTypeHashVisitor;
 };
 
 
@@ -6219,6 +6279,7 @@
 
   FINAL_HEAP_OBJECT_IMPLEMENTATION(BoundedType, AbstractType);
   friend class Class;
+  friend class ClearTypeHashVisitor;
 };
 
 
@@ -6890,6 +6951,8 @@
   static RawString* ToLowerCase(const String& str,
                                 Heap::Space space = Heap::kNew);
 
+  static RawString* RemovePrivateKey(const String& name);
+
   static RawString* ScrubName(const String& name);
   static RawString* ScrubNameRetainPrivate(const String& name);
 
@@ -8375,7 +8438,7 @@
 
 
 // Internal stacktrace object used in exceptions for printing stack traces.
-class Stacktrace : public Instance {
+class StackTrace : public Instance {
  public:
   static const int kPreallocatedStackdepth = 30;
 
@@ -8391,9 +8454,9 @@
   void set_expand_inlined(bool value) const;
 
   static intptr_t InstanceSize() {
-    return RoundedAllocationSize(sizeof(RawStacktrace));
+    return RoundedAllocationSize(sizeof(RawStackTrace));
   }
-  static RawStacktrace* New(const Array& code_array,
+  static RawStackTrace* New(const Array& code_array,
                             const Array& pc_offset_array,
                             Heap::Space space = Heap::kNew);
 
@@ -8406,7 +8469,7 @@
   void set_pc_offset_array(const Array& pc_offset_array) const;
   bool expand_inlined() const;
 
-  FINAL_HEAP_OBJECT_IMPLEMENTATION(Stacktrace, Instance);
+  FINAL_HEAP_OBJECT_IMPLEMENTATION(StackTrace, Instance);
   friend class Class;
   friend class Debugger;
 };
@@ -8655,6 +8718,26 @@
 };
 
 
+class ObjectPoolInfo : public ValueObject {
+ public:
+  explicit ObjectPoolInfo(const ObjectPool& pool)
+      : array_(TypedData::Handle(pool.info_array())) {}
+
+  explicit ObjectPoolInfo(const TypedData& info_array) : array_(info_array) {}
+
+  ObjectPool::EntryType InfoAt(intptr_t i) {
+    return static_cast<ObjectPool::EntryType>(array_.GetInt8(i));
+  }
+
+  void SetInfoAt(intptr_t i, ObjectPool::EntryType info) {
+    array_.SetInt8(i, static_cast<int8_t>(info));
+  }
+
+ private:
+  const TypedData& array_;
+};
+
+
 // Breaking cycles and loops.
 RawClass* Object::clazz() const {
   uword raw_value = reinterpret_cast<uword>(raw_);
diff --git a/runtime/vm/object_graph.cc b/runtime/vm/object_graph.cc
index 2352bd88..cd9fdee 100644
--- a/runtime/vm/object_graph.cc
+++ b/runtime/vm/object_graph.cc
@@ -149,7 +149,7 @@
 
   static void UnmarkAll(Isolate* isolate) {
     Unmarker unmarker;
-    isolate->heap()->IterateObjects(&unmarker);
+    isolate->heap()->VisitObjectsNoImagePages(&unmarker);
   }
 
  private:
@@ -161,19 +161,16 @@
   // The VM isolate has all its objects pre-marked, so iterating over it
   // would be a no-op.
   ASSERT(thread->isolate() != Dart::vm_isolate());
-  thread->isolate()->heap()->WriteProtectCode(false);
 }
 
 
-ObjectGraph::~ObjectGraph() {
-  isolate()->heap()->WriteProtectCode(true);
-}
+ObjectGraph::~ObjectGraph() {}
 
 
 void ObjectGraph::IterateObjects(ObjectGraph::Visitor* visitor) {
   NoSafepointScope no_safepoint_scope_;
   Stack stack(isolate());
-  isolate()->IterateObjectPointers(&stack, false);
+  isolate()->VisitObjectPointers(&stack, false);
   stack.TraverseGraph(visitor);
   Unmarker::UnmarkAll(isolate());
 }
@@ -216,7 +213,7 @@
   Stack stack(isolate());
 
   InstanceAccumulator accumulator(&stack, class_id);
-  isolate()->heap()->IterateObjects(&accumulator);
+  isolate()->heap()->VisitObjectsNoImagePages(&accumulator);
 
   stack.TraverseGraph(visitor);
   Unmarker::UnmarkAll(isolate());
@@ -265,6 +262,7 @@
 
 
 intptr_t ObjectGraph::SizeRetainedByInstance(const Object& obj) {
+  HeapIterationScope iteration_scope(true);
   SizeVisitor total;
   IterateObjects(&total);
   intptr_t size_total = total.size();
@@ -276,6 +274,7 @@
 
 
 intptr_t ObjectGraph::SizeReachableByInstance(const Object& obj) {
+  HeapIterationScope iteration_scope(true);
   SizeVisitor total;
   IterateObjectsFrom(obj, &total);
   return total.size();
@@ -283,6 +282,7 @@
 
 
 intptr_t ObjectGraph::SizeRetainedByClass(intptr_t class_id) {
+  HeapIterationScope iteration_scope(true);
   SizeVisitor total;
   IterateObjects(&total);
   intptr_t size_total = total.size();
@@ -294,6 +294,7 @@
 
 
 intptr_t ObjectGraph::SizeReachableByClass(intptr_t class_id) {
+  HeapIterationScope iteration_scope(true);
   SizeVisitor total;
   IterateObjectsFrom(class_id, &total);
   return total.size();
@@ -390,6 +391,7 @@
 
 intptr_t ObjectGraph::RetainingPath(Object* obj, const Array& path) {
   NoSafepointScope no_safepoint_scope_;
+  HeapIterationScope iteration_scope(true);
   // To break the trivial path, the handle 'obj' is temporarily cleared during
   // the search, but restored before returning.
   RawObject* raw = obj->raw();
@@ -467,7 +469,7 @@
 
 intptr_t ObjectGraph::InboundReferences(Object* obj, const Array& references) {
   Object& scratch = Object::Handle();
-  NoSafepointScope no_safepoint_scope_;
+  NoSafepointScope no_safepoint_scope;
   InboundReferencesVisitor visitor(isolate(), obj->raw(), references, &scratch);
   isolate()->heap()->IterateObjects(&visitor);
   return visitor.length();
@@ -611,6 +613,7 @@
   }
   // Current encoding assumes objects do not move, so promote everything to old.
   isolate()->heap()->new_space()->Evacuate();
+  HeapIterationScope iteration_scope(true);
 
   RawObject* kRootAddress = reinterpret_cast<RawObject*>(kHeapObjectTag);
   const intptr_t kRootCid = kIllegalCid;
@@ -624,7 +627,7 @@
     // Write root "object".
     WriteHeader(kRootAddress, 0, kRootCid, stream);
     WritePointerVisitor ptr_writer(isolate(), stream, false);
-    isolate()->IterateObjectPointers(&ptr_writer, false);
+    isolate()->VisitObjectPointers(&ptr_writer, false);
     stream->WriteUnsigned(0);
   } else {
     {
@@ -640,7 +643,7 @@
       // Write stack "object".
       WriteHeader(kStackAddress, 0, kStackCid, stream);
       WritePointerVisitor ptr_writer(isolate(), stream, true);
-      isolate()->IterateStackPointers(&ptr_writer, false);
+      isolate()->VisitStackPointers(&ptr_writer, false);
       stream->WriteUnsigned(0);
     }
   }
diff --git a/runtime/vm/object_graph_test.cc b/runtime/vm/object_graph_test.cc
index 0b5c095..f840284 100644
--- a/runtime/vm/object_graph_test.cc
+++ b/runtime/vm/object_graph_test.cc
@@ -67,24 +67,27 @@
     d = Array::null();
     ObjectGraph graph(thread);
     {
-      // Compare count and size when 'b' is/isn't skipped.
-      CounterVisitor with(Object::null(), Object::null());
-      graph.IterateObjectsFrom(a, &with);
-      CounterVisitor without(b_raw, a.raw());
-      graph.IterateObjectsFrom(a, &without);
-      // Only 'b' and 'c' were cut off.
-      EXPECT_EQ(2, with.count() - without.count());
-      EXPECT_EQ(b_size + c_size, with.size() - without.size());
-    }
-    {
-      // Like above, but iterate over the entire isolate. The counts and sizes
-      // are thus larger, but the difference should still be just 'b' and 'c'.
-      CounterVisitor with(Object::null(), Object::null());
-      graph.IterateObjects(&with);
-      CounterVisitor without(b_raw, a.raw());
-      graph.IterateObjects(&without);
-      EXPECT_EQ(2, with.count() - without.count());
-      EXPECT_EQ(b_size + c_size, with.size() - without.size());
+      HeapIterationScope iteration_scope(true);
+      {
+        // Compare count and size when 'b' is/isn't skipped.
+        CounterVisitor with(Object::null(), Object::null());
+        graph.IterateObjectsFrom(a, &with);
+        CounterVisitor without(b_raw, a.raw());
+        graph.IterateObjectsFrom(a, &without);
+        // Only 'b' and 'c' were cut off.
+        EXPECT_EQ(2, with.count() - without.count());
+        EXPECT_EQ(b_size + c_size, with.size() - without.size());
+      }
+      {
+        // Like above, but iterate over the entire isolate. The counts and sizes
+        // are thus larger, but the difference should still be just 'b' and 'c'.
+        CounterVisitor with(Object::null(), Object::null());
+        graph.IterateObjects(&with);
+        CounterVisitor without(b_raw, a.raw());
+        graph.IterateObjects(&without);
+        EXPECT_EQ(2, with.count() - without.count());
+        EXPECT_EQ(b_size + c_size, with.size() - without.size());
+      }
     }
     EXPECT_EQ(a_size + b_size + c_size + d_size,
               graph.SizeRetainedByInstance(a));
diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc
index a5998b9..181ff49 100644
--- a/runtime/vm/object_reload.cc
+++ b/runtime/vm/object_reload.cc
@@ -201,7 +201,7 @@
 //   This case is handled automatically.
 // 2) Enum values are reordered.
 //   We pair old and new enums and the old enums 'become' the new ones so
-//   the ordering is always correct (i.e. enum indicies match slots in values
+//   the ordering is always correct (i.e. enum indices match slots in values
 //   array)
 // 3) An existing enum value is removed.
 //   Each enum class has a canonical 'deleted' enum sentinel instance.
@@ -326,7 +326,7 @@
                                        deleted_enum_sentinel);
 
   if (enums_deleted) {
-    // Map all deleted enums to the deleted enum senintel value.
+    // Map all deleted enums to the deleted enum sentinel value.
     // TODO(johnmccutchan): Add this to the reload 'notices' list.
     VTIR_Print(
         "The following enum values were deleted from %s and will become the "
diff --git a/runtime/vm/object_service.cc b/runtime/vm/object_service.cc
index 6d2bd9e..d4fc827 100644
--- a/runtime/vm/object_service.cc
+++ b/runtime/vm/object_service.cc
@@ -243,6 +243,11 @@
 static void AddFunctionServiceId(const JSONObject& jsobj,
                                  const Function& f,
                                  const Class& cls) {
+  if (cls.IsNull()) {
+    ASSERT(f.IsSignatureFunction());
+    jsobj.AddServiceId(f);
+    return;
+  }
   // Special kinds of functions use indices in their respective lists.
   intptr_t id = -1;
   const char* selector = NULL;
@@ -279,10 +284,13 @@
 
 void Function::PrintJSONImpl(JSONStream* stream, bool ref) const {
   Class& cls = Class::Handle(Owner());
-  ASSERT(!cls.IsNull());
-  Error& err = Error::Handle();
-  err ^= cls.EnsureIsFinalized(Thread::Current());
-  ASSERT(err.IsNull());
+  if (!cls.IsNull()) {
+    Error& err = Error::Handle();
+    err ^= cls.EnsureIsFinalized(Thread::Current());
+    ASSERT(err.IsNull());
+  } else {
+    ASSERT(IsSignatureFunction());
+  }
   JSONObject jsobj(stream);
   AddCommonObjectProperties(&jsobj, "Function", ref);
   AddFunctionServiceId(jsobj, *this, cls);
@@ -292,11 +300,13 @@
   const Function& parent = Function::Handle(parent_function());
   if (!parent.IsNull()) {
     jsobj.AddProperty("owner", parent);
-  } else if (cls.IsTopLevel()) {
-    const Library& library = Library::Handle(cls.library());
-    jsobj.AddProperty("owner", library);
-  } else {
-    jsobj.AddProperty("owner", cls);
+  } else if (!cls.IsNull()) {
+    if (cls.IsTopLevel()) {
+      const Library& library = Library::Handle(cls.library());
+      jsobj.AddProperty("owner", library);
+    } else {
+      jsobj.AddProperty("owner", cls);
+    }
   }
 
   const char* kind_string = Function::KindToCString(kind());
@@ -709,7 +719,7 @@
 }
 
 
-void Stackmap::PrintJSONImpl(JSONStream* stream, bool ref) const {
+void StackMap::PrintJSONImpl(JSONStream* stream, bool ref) const {
   Object::PrintJSONImpl(stream, ref);
 }
 
@@ -1099,6 +1109,7 @@
 
 
 void Type::PrintJSONImpl(JSONStream* stream, bool ref) const {
+  // TODO(regis): Function types are not handled properly.
   JSONObject jsobj(stream);
   PrintSharedInstanceJSON(&jsobj, ref);
   jsobj.AddProperty("kind", "Type");
@@ -1482,12 +1493,17 @@
 }
 
 
+void SignatureData::PrintJSONImpl(JSONStream* stream, bool ref) const {
+  Object::PrintJSONImpl(stream, ref);
+}
+
+
 void Closure::PrintJSONImpl(JSONStream* stream, bool ref) const {
   Instance::PrintJSONImpl(stream, ref);
 }
 
 
-void Stacktrace::PrintJSONImpl(JSONStream* stream, bool ref) const {
+void StackTrace::PrintJSONImpl(JSONStream* stream, bool ref) const {
   JSONObject jsobj(stream);
   PrintSharedInstanceJSON(&jsobj, ref);
   jsobj.AddProperty("kind", "StackTrace");
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc
index a4e4958..e35ed7a 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -86,7 +86,7 @@
       stack_overflow_(Instance::null()),
       out_of_memory_(Instance::null()),
       preallocated_unhandled_exception_(UnhandledException::null()),
-      preallocated_stack_trace_(Stacktrace::null()),
+      preallocated_stack_trace_(StackTrace::null()),
       lookup_port_handler_(Function::null()),
       empty_uint32_array_(TypedData::null()),
       handle_message_function_(Function::null()),
@@ -149,12 +149,12 @@
   ASSERT(isolate != NULL && isolate->object_store() == this);
   if (this->stack_overflow() != Instance::null()) {
     ASSERT(this->out_of_memory() != Instance::null());
-    ASSERT(this->preallocated_stack_trace() != Stacktrace::null());
+    ASSERT(this->preallocated_stack_trace() != StackTrace::null());
     return Error::null();
   }
   ASSERT(this->stack_overflow() == Instance::null());
   ASSERT(this->out_of_memory() == Instance::null());
-  ASSERT(this->preallocated_stack_trace() == Stacktrace::null());
+  ASSERT(this->preallocated_stack_trace() == StackTrace::null());
 
   this->pending_deferred_loads_ = GrowableObjectArray::New();
 
@@ -186,15 +186,15 @@
   // pre-allocated OutOfMemoryError.
   const UnhandledException& unhandled_exception =
       UnhandledException::Handle(UnhandledException::New(
-          Instance::Cast(result), Stacktrace::Handle(zone)));
+          Instance::Cast(result), StackTrace::Handle(zone)));
   set_preallocated_unhandled_exception(unhandled_exception);
 
   const Array& code_array = Array::Handle(
-      zone, Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld));
+      zone, Array::New(StackTrace::kPreallocatedStackdepth, Heap::kOld));
   const Array& pc_offset_array = Array::Handle(
-      zone, Array::New(Stacktrace::kPreallocatedStackdepth, Heap::kOld));
-  const Stacktrace& stack_trace =
-      Stacktrace::Handle(zone, Stacktrace::New(code_array, pc_offset_array));
+      zone, Array::New(StackTrace::kPreallocatedStackdepth, Heap::kOld));
+  const StackTrace& stack_trace =
+      StackTrace::Handle(zone, StackTrace::New(code_array, pc_offset_array));
   // Expansion of inlined functions requires additional memory at run time,
   // avoid it.
   stack_trace.set_expand_inlined(false);
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index 8be015e..ab0a384 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -361,10 +361,10 @@
     preallocated_unhandled_exception_ = value.raw();
   }
 
-  RawStacktrace* preallocated_stack_trace() const {
+  RawStackTrace* preallocated_stack_trace() const {
     return preallocated_stack_trace_;
   }
-  void set_preallocated_stack_trace(const Stacktrace& value) {
+  void set_preallocated_stack_trace(const StackTrace& value) {
     preallocated_stack_trace_ = value.raw();
   }
 
@@ -533,7 +533,7 @@
   V(RawInstance*, stack_overflow_)                                             \
   V(RawInstance*, out_of_memory_)                                              \
   V(RawUnhandledException*, preallocated_unhandled_exception_)                 \
-  V(RawStacktrace*, preallocated_stack_trace_)                                 \
+  V(RawStackTrace*, preallocated_stack_trace_)                                 \
   V(RawFunction*, lookup_port_handler_)                                        \
   V(RawTypedData*, empty_uint32_array_)                                        \
   V(RawFunction*, handle_message_function_)                                    \
@@ -560,8 +560,8 @@
     switch (kind) {
       case Snapshot::kCore:
         return reinterpret_cast<RawObject**>(&library_load_error_table_);
-      case Snapshot::kAppWithJIT:
-      case Snapshot::kAppNoJIT:
+      case Snapshot::kAppJIT:
+      case Snapshot::kAppAOT:
         return to();
       case Snapshot::kScript:
       case Snapshot::kMessage:
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index c0ac1ad..f0e9b3f 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -2485,6 +2485,8 @@
   script.TokenRangeAtLine(1000, &first_idx, &last_idx);
   EXPECT_EQ(-1, first_idx.value());
   EXPECT_EQ(-1, last_idx.value());
+
+  free(src_chars);
 }
 
 
@@ -2789,12 +2791,12 @@
   // Add an exception handler table to the code.
   ExceptionHandlers& exception_handlers = ExceptionHandlers::Handle();
   exception_handlers ^= ExceptionHandlers::New(kNumEntries);
-  const bool kNeedsStacktrace = true;
-  const bool kNoStacktrace = false;
-  exception_handlers.SetHandlerInfo(0, -1, 20u, kNeedsStacktrace, false);
-  exception_handlers.SetHandlerInfo(1, 0, 30u, kNeedsStacktrace, false);
-  exception_handlers.SetHandlerInfo(2, -1, 40u, kNoStacktrace, true);
-  exception_handlers.SetHandlerInfo(3, 1, 150u, kNoStacktrace, true);
+  const bool kNeedsStackTrace = true;
+  const bool kNoStackTrace = false;
+  exception_handlers.SetHandlerInfo(0, -1, 20u, kNeedsStackTrace, false);
+  exception_handlers.SetHandlerInfo(1, 0, 30u, kNeedsStackTrace, false);
+  exception_handlers.SetHandlerInfo(2, -1, 40u, kNoStackTrace, true);
+  exception_handlers.SetHandlerInfo(3, 1, 150u, kNoStackTrace, true);
 
   extern void GenerateIncrement(Assembler * assembler);
   Assembler _assembler_;
@@ -2812,12 +2814,12 @@
   EXPECT_EQ(-1, handlers.OuterTryIndex(0));
   EXPECT_EQ(-1, info.outer_try_index);
   EXPECT_EQ(20u, handlers.HandlerPCOffset(0));
-  EXPECT(handlers.NeedsStacktrace(0));
+  EXPECT(handlers.NeedsStackTrace(0));
   EXPECT(!handlers.HasCatchAll(0));
   EXPECT_EQ(20u, info.handler_pc_offset);
   EXPECT_EQ(1, handlers.OuterTryIndex(3));
   EXPECT_EQ(150u, handlers.HandlerPCOffset(3));
-  EXPECT(!handlers.NeedsStacktrace(3));
+  EXPECT(!handlers.NeedsStackTrace(3));
   EXPECT(handlers.HasCatchAll(3));
 }
 
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index 1e3fc48..9c850ed 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -99,8 +99,7 @@
 
 
 int64_t OS::GetCurrentThreadCPUMicros() {
-  UNIMPLEMENTED();
-  return 0;
+  return mx_time_get(MX_CLOCK_THREAD) / kNanosecondsPerMicrosecond;
 }
 
 
diff --git a/runtime/vm/os_test.cc b/runtime/vm/os_test.cc
index fe01609..2ecc36b 100644
--- a/runtime/vm/os_test.cc
+++ b/runtime/vm/os_test.cc
@@ -11,11 +11,12 @@
 namespace dart {
 
 UNIT_TEST_CASE(Sleep) {
-  int64_t start_time = OS::GetCurrentTimeMillis();
-  int64_t sleep_time = 702;
-  OS::Sleep(sleep_time);
-  int64_t delta = OS::GetCurrentTimeMillis() - start_time;
-  const int kAcceptableSleepWakeupJitter = 200;  // Measured in milliseconds.
+  // All times measured in microseconds.
+  int64_t start_time = OS::GetCurrentMonotonicMicros();
+  int64_t sleep_time = 702000;
+  OS::SleepMicros(sleep_time);
+  int64_t delta = OS::GetCurrentMonotonicMicros() - start_time;
+  const int kAcceptableSleepWakeupJitter = 200000;
   EXPECT_GE(delta, sleep_time - kAcceptableSleepWakeupJitter);
   EXPECT_LE(delta, sleep_time + kAcceptableSleepWakeupJitter);
 }
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 36019130..9768bc5 100644
--- a/runtime/vm/pages.cc
+++ b/runtime/vm/pages.cc
@@ -4,6 +4,7 @@
 
 #include "vm/pages.h"
 
+#include "platform/address_sanitizer.h"
 #include "platform/assert.h"
 #include "vm/compiler_stats.h"
 #include "vm/gc_marker.h"
@@ -69,6 +70,9 @@
   result->memory_ = memory;
   result->next_ = NULL;
   result->type_ = type;
+
+  LSAN_REGISTER_ROOT_REGION(result, sizeof(*result));
+
   return result;
 }
 
@@ -89,8 +93,21 @@
 
 
 void HeapPage::Deallocate() {
-  // The memory for this object will become unavailable after the delete below.
+  bool image_page = is_image_page();
+
+  if (!image_page) {
+    LSAN_UNREGISTER_ROOT_REGION(this, sizeof(*this));
+  }
+
+  // For a regular heap pages, the memory for this object will become
+  // unavailable after the delete below.
   delete memory_;
+
+  // For a heap page from a snapshot, the HeapPage object lives in the malloc
+  // heap rather than the page itself.
+  if (image_page) {
+    free(this);
+  }
 }
 
 
@@ -139,6 +156,8 @@
 
 
 void HeapPage::WriteProtect(bool read_only) {
+  ASSERT(!is_image_page());
+
   VirtualMemory::Protection prot;
   if (read_only) {
     if (type_ == kExecutable) {
@@ -227,16 +246,16 @@
   } else {
     // Should not allocate executable pages when running from a precompiled
     // snapshot.
-    ASSERT(Dart::snapshot_kind() != Snapshot::kAppNoJIT);
+    ASSERT(Dart::vm_snapshot_kind() != Snapshot::kAppAOT);
 
     if (exec_pages_ == NULL) {
       exec_pages_ = page;
     } else {
-      if (FLAG_write_protect_code) {
+      if (FLAG_write_protect_code && !exec_pages_tail_->is_image_page()) {
         exec_pages_tail_->WriteProtect(false);
       }
       exec_pages_tail_->set_next(page);
-      if (FLAG_write_protect_code) {
+      if (FLAG_write_protect_code && !exec_pages_tail_->is_image_page()) {
         exec_pages_tail_->WriteProtect(true);
       }
     }
@@ -379,9 +398,6 @@
                                      bool is_locked) {
   ASSERT(size >= kObjectAlignment);
   ASSERT(Utils::IsAligned(size, kObjectAlignment));
-#ifdef DEBUG
-  SpaceUsage usage_before = GetCurrentUsage();
-#endif
   uword result = 0;
   if (size < kAllocatablePageSize) {
     if (is_locked) {
@@ -418,14 +434,6 @@
       }
     }
   }
-#ifdef DEBUG
-  if (result != 0) {
-    // A successful allocation should increase usage_.
-    ASSERT(usage_before.used_in_words < usage_.used_in_words);
-  }
-// Note we cannot assert that a failed allocation should not change
-// used_in_words as another thread could have changed used_in_words.
-#endif
   ASSERT((result & kObjectAlignmentMask) == kOldObjectAlignmentOffset);
   return result;
 }
@@ -609,6 +617,17 @@
 }
 
 
+bool PageSpace::DataContains(uword addr) const {
+  for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) {
+    if ((it.page()->type() != HeapPage::kExecutable) &&
+        it.page()->Contains(addr)) {
+      return true;
+    }
+  }
+  return false;
+}
+
+
 void PageSpace::AddRegionsToObjectSet(ObjectSet* set) const {
   ASSERT((pages_ != NULL) || (exec_pages_ != NULL) || (large_pages_ != NULL));
   for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) {
@@ -624,9 +643,18 @@
 }
 
 
-void PageSpace::VisitObjectsNoEmbedderPages(ObjectVisitor* visitor) const {
+void PageSpace::VisitObjectsNoImagePages(ObjectVisitor* visitor) const {
   for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) {
-    if (!it.page()->embedder_allocated()) {
+    if (!it.page()->is_image_page()) {
+      it.page()->VisitObjects(visitor);
+    }
+  }
+}
+
+
+void PageSpace::VisitObjectsImagePages(ObjectVisitor* visitor) const {
+  for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) {
+    if (it.page()->is_image_page()) {
       it.page()->VisitObjects(visitor);
     }
   }
@@ -680,7 +708,7 @@
     AbandonBumpAllocation();
   }
   for (ExclusivePageIterator it(this); !it.Done(); it.Advance()) {
-    if (!it.page()->embedder_allocated()) {
+    if (!it.page()->is_image_page()) {
       it.page()->WriteProtect(read_only);
     }
   }
@@ -704,7 +732,7 @@
   space.AddProperty64("external", ExternalInWords() * kWordSize);
   space.AddProperty("time", MicrosecondsToSeconds(gc_time_micros()));
   if (collections() > 0) {
-    int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time();
+    int64_t run_time = isolate->UptimeMicros();
     run_time = Utils::Maximum(run_time, static_cast<int64_t>(0));
     double run_time_millis = MicrosecondsToMilliseconds(run_time);
     double avg_time_between_collections =
@@ -776,7 +804,7 @@
 
 bool PageSpace::ShouldCollectCode() {
   // Try to collect code if enough time has passed since the last attempt.
-  const int64_t start = OS::GetCurrentTimeMicros();
+  const int64_t start = OS::GetCurrentMonotonicMicros();
   const int64_t last_code_collection_in_us =
       page_space_controller_.last_code_collection_in_us();
 
@@ -800,12 +828,14 @@
     HeapPage* page = exec_pages_;
     while (page != NULL) {
       ASSERT(page->type() == HeapPage::kExecutable);
-      page->WriteProtect(read_only);
+      if (!page->is_image_page()) {
+        page->WriteProtect(read_only);
+      }
       page = page->next();
     }
     page = large_pages_;
     while (page != NULL) {
-      if (page->type() == HeapPage::kExecutable) {
+      if (page->type() == HeapPage::kExecutable && !page->is_image_page()) {
         page->WriteProtect(read_only);
       }
       page = page->next();
@@ -852,7 +882,7 @@
       OS::PrintErr(" done.\n");
     }
 
-    const int64_t start = OS::GetCurrentTimeMicros();
+    const int64_t start = OS::GetCurrentMonotonicMicros();
 
     // Make code pages writable.
     WriteProtectCode(false);
@@ -867,7 +897,7 @@
     marker.MarkObjects(isolate, this, invoke_api_callbacks, collect_code);
     usage_.used_in_words = marker.marked_words();
 
-    int64_t mid1 = OS::GetCurrentTimeMicros();
+    int64_t mid1 = OS::GetCurrentMonotonicMicros();
 
     // Abandon the remainder of the bump allocation block.
     AbandonBumpAllocation();
@@ -875,7 +905,7 @@
     freelist_[HeapPage::kData].Reset();
     freelist_[HeapPage::kExecutable].Reset();
 
-    int64_t mid2 = OS::GetCurrentTimeMicros();
+    int64_t mid2 = OS::GetCurrentMonotonicMicros();
     int64_t mid3 = 0;
 
     {
@@ -922,7 +952,7 @@
         page = next_page;
       }
 
-      mid3 = OS::GetCurrentTimeMicros();
+      mid3 = OS::GetCurrentMonotonicMicros();
 
       if (!FLAG_concurrent_sweep) {
         // Sweep all regular sized pages now.
@@ -955,7 +985,7 @@
     // Make code pages read-only.
     WriteProtectCode(true);
 
-    int64_t end = OS::GetCurrentTimeMicros();
+    int64_t end = OS::GetCurrentMonotonicMicros();
 
     // Record signals for growth control. Include size of external allocations.
     page_space_controller_.EvaluateGarbageCollection(
@@ -1067,9 +1097,7 @@
 }
 
 
-void PageSpace::SetupExternalPage(void* pointer,
-                                  uword size,
-                                  bool is_executable) {
+void PageSpace::SetupImagePage(void* pointer, uword size, bool is_executable) {
   // Setup a HeapPage so precompiled Instructions can be traversed.
   // Instructions are contiguous at [pointer, pointer + size). HeapPage
   // expects to find objects at [memory->start() + ObjectStartOffset,
@@ -1078,7 +1106,7 @@
   pointer = reinterpret_cast<void*>(reinterpret_cast<uword>(pointer) - offset);
   size += offset;
 
-  VirtualMemory* memory = VirtualMemory::ForExternalPage(pointer, size);
+  VirtualMemory* memory = VirtualMemory::ForImagePage(pointer, size);
   ASSERT(memory != NULL);
   HeapPage* page = reinterpret_cast<HeapPage*>(malloc(sizeof(HeapPage)));
   page->memory_ = memory;
@@ -1093,14 +1121,20 @@
     first = &exec_pages_;
     tail = &exec_pages_tail_;
   } else {
-    page->type_ = HeapPage::kReadOnlyData;
+    page->type_ = HeapPage::kData;
     first = &pages_;
     tail = &pages_tail_;
   }
   if (*first == NULL) {
     *first = page;
   } else {
+    if (is_executable && FLAG_write_protect_code && !(*tail)->is_image_page()) {
+      (*tail)->WriteProtect(false);
+    }
     (*tail)->set_next(page);
+    if (is_executable && FLAG_write_protect_code && !(*tail)->is_image_page()) {
+      (*tail)->WriteProtect(true);
+    }
   }
   (*tail) = page;
 }
@@ -1117,7 +1151,7 @@
       desired_utilization_((100.0 - heap_growth_ratio) / 100.0),
       heap_growth_max_(heap_growth_max),
       garbage_collection_time_ratio_(garbage_collection_time_ratio),
-      last_code_collection_in_us_(OS::GetCurrentTimeMicros()) {}
+      last_code_collection_in_us_(OS::GetCurrentMonotonicMicros()) {}
 
 
 PageSpaceController::~PageSpaceController() {}
@@ -1144,8 +1178,8 @@
   // kInitialTimeoutSeconds, gradually lower the capacity limit.
   static const double kInitialTimeoutSeconds = 1.00;
   if (history_.IsEmpty()) {
-    double seconds_since_init = MicrosecondsToSeconds(
-        OS::GetCurrentTimeMicros() - heap_->isolate()->start_time());
+    double seconds_since_init =
+        MicrosecondsToSeconds(heap_->isolate()->UptimeMicros());
     if (seconds_since_init > kInitialTimeoutSeconds) {
       multiplier *= seconds_since_init / kInitialTimeoutSeconds;
     }
diff --git a/runtime/vm/pages.h b/runtime/vm/pages.h
index d1cfad2..0cf4388 100644
--- a/runtime/vm/pages.h
+++ b/runtime/vm/pages.h
@@ -28,7 +28,7 @@
 // A page containing old generation objects.
 class HeapPage {
  public:
-  enum PageType { kData = 0, kExecutable, kReadOnlyData, kNumPageTypes };
+  enum PageType { kData = 0, kExecutable, kNumPageTypes };
 
   HeapPage* next() const { return next_; }
   void set_next(HeapPage* next) { next_ = next; }
@@ -40,7 +40,7 @@
 
   PageType type() const { return type_; }
 
-  bool embedder_allocated() const { return memory_->embedder_allocated(); }
+  bool is_image_page() const { return !memory_->vm_owns_region(); }
 
   void VisitObjects(ObjectVisitor* visitor) const;
   void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
@@ -227,10 +227,12 @@
 
   bool Contains(uword addr) const;
   bool Contains(uword addr, HeapPage::PageType type) const;
+  bool DataContains(uword addr) const;
   bool IsValidAddress(uword addr) const { return Contains(addr); }
 
   void VisitObjects(ObjectVisitor* visitor) const;
-  void VisitObjectsNoEmbedderPages(ObjectVisitor* visitor) const;
+  void VisitObjectsNoImagePages(ObjectVisitor* visitor) const;
+  void VisitObjectsImagePages(ObjectVisitor* visitor) const;
   void VisitObjectPointers(ObjectPointerVisitor* visitor) const;
 
   RawObject* FindObject(FindObjectVisitor* visitor,
@@ -316,7 +318,7 @@
   static intptr_t top_offset() { return OFFSET_OF(PageSpace, bump_top_); }
   static intptr_t end_offset() { return OFFSET_OF(PageSpace, bump_end_); }
 
-  void SetupExternalPage(void* pointer, uword size, bool is_executable);
+  void SetupImagePage(void* pointer, uword size, bool is_executable);
 
  private:
   // Ids for time and data records in Heap::GCStats.
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 1a91fcb..e75d86d 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -44,8 +44,10 @@
 
 DEFINE_FLAG(bool, enable_debug_break, false, "Allow use of break \"message\".");
 DEFINE_FLAG(bool, trace_parser, false, "Trace parser operations.");
-DEFINE_FLAG(bool, warn_mixin_typedef, true, "Warning on legacy mixin typedef.");
-DEFINE_FLAG(bool, warn_new_tearoff_syntax, true, "Warning on new tear off.");
+DEFINE_FLAG(bool,
+            support_deprecated_tearoff_syntax,
+            false,
+            "Support new tear-off syntax.");
 // TODO(floitsch): remove the conditional-directive flag, once we publicly
 // committed to the current version.
 DEFINE_FLAG(bool,
@@ -671,7 +673,8 @@
         var(NULL),
         is_final(false),
         is_field_initializer(false),
-        has_explicit_type(false) {}
+        has_explicit_type(false),
+        is_covariant(false) {}
   const AbstractType* type;
   TokenPosition name_pos;
   const String* name;
@@ -681,6 +684,7 @@
   bool is_final;
   bool is_field_initializer;
   bool has_explicit_type;
+  bool is_covariant;
 };
 
 
@@ -694,6 +698,7 @@
     has_optional_named_parameters = false;
     has_explicit_default_values = false;
     has_field_initializer = false;
+    has_covariant = false;
     implicitly_final = false;
     skipped = false;
     this->parameters = new ZoneGrowableArray<ParamDesc>();
@@ -755,6 +760,7 @@
   bool has_optional_named_parameters;
   bool has_explicit_default_values;
   bool has_field_initializer;
+  bool has_covariant;
   bool implicitly_final;
   bool skipped;
   ZoneGrowableArray<ParamDesc>* parameters;
@@ -767,6 +773,7 @@
   void Clear() {
     has_abstract = false;
     has_external = false;
+    has_covariant = false;
     has_final = false;
     has_const = false;
     has_static = false;
@@ -814,6 +821,7 @@
   String* DictName() const { return (dict_name != NULL) ? dict_name : name; }
   bool has_abstract;
   bool has_external;
+  bool has_covariant;
   bool has_final;
   bool has_const;
   bool has_static;
@@ -1944,6 +1952,12 @@
     SkipMetadata();
   }
 
+  if (CurrentToken() == Token::kCOVARIANT &&
+      (LookaheadToken(1) == Token::kFINAL || LookaheadToken(1) == Token::kVAR ||
+       Token::IsIdentifier(LookaheadToken(1)))) {
+    parameter.is_covariant = true;
+    ConsumeToken();
+  }
   if (CurrentToken() == Token::kFINAL) {
     ConsumeToken();
     final_seen = true;
@@ -2056,7 +2070,7 @@
       // signature functions (except typedef signature functions), therefore
       // we do not need to keep the correct script via a patch class. Use the
       // actual current class as owner of the signature function.
-      const Function& signature_function =
+      Function& signature_function =
           Function::Handle(Z, Function::NewSignatureFunction(
                                   current_class(), TokenPosition::kNoSource));
       signature_function.set_parent_function(innermost_function());
@@ -2090,14 +2104,15 @@
 
       ASSERT(innermost_function().raw() == signature_function.raw());
       innermost_function_ = signature_function.parent_function();
-      signature_function.set_data(Object::Handle(Z));
 
       Type& signature_type =
           Type::ZoneHandle(Z, signature_function.SignatureType());
       if (!is_top_level_) {
         signature_type ^= ClassFinalizer::FinalizeType(
             current_class(), signature_type, ClassFinalizer::kCanonicalize);
-        signature_function.SetSignatureType(signature_type);
+        // Do not refer to signature_function anymore, since it may have been
+        // replaced during canonicalization.
+        signature_function = Function::null();
       }
       ASSERT(is_top_level_ || signature_type.IsFinalized());
       // A signature type itself cannot be malformed or malbounded, only its
@@ -2160,6 +2175,9 @@
     parameter.is_final = true;
   }
   params->parameters->Add(parameter);
+  if (parameter.is_covariant) {
+    params->has_covariant = true;
+  }
 }
 
 
@@ -3671,6 +3689,10 @@
   ASSERT(method->type != NULL);  // May still be unresolved.
   ASSERT(current_member_ == method);
 
+  if (method->has_covariant) {
+    ReportError(method->name_pos,
+                "methods and constructors cannot be declared covariant");
+  }
   if (method->has_var) {
     ReportError(method->name_pos, "keyword var not allowed for methods");
   }
@@ -4038,6 +4060,13 @@
   // All const fields are also final.
   ASSERT(!field->has_const || field->has_final);
 
+  if (field->has_covariant) {
+    if (field->has_static) {
+      ReportError("static fields cannot be declared covariant");
+    } else if (field->has_final) {
+      ReportError("final fields cannot be declared covariant");
+    }
+  }
   if (field->has_abstract) {
     ReportError("keyword 'abstract' not allowed in field declaration");
   }
@@ -4249,6 +4278,10 @@
     ConsumeToken();
     member.has_static = true;
   }
+  if (CurrentToken() == Token::kCOVARIANT) {
+    ConsumeToken();
+    member.has_covariant = true;
+  }
   if (CurrentToken() == Token::kCONST) {
     ConsumeToken();
     member.has_const = true;
@@ -4835,6 +4868,9 @@
     declared_names.Add(enum_ident);
 
     // Create the static const field for the enumeration value.
+    // Note that we do not set the field type to E, because we temporarily store
+    // a Smi in the field. The class finalizer would detect the bad type and
+    // reset the value to sentinel.
     enum_value = Field::New(*enum_ident,
                             /* is_static = */ true,
                             /* is_final = */ true,
@@ -4857,18 +4893,28 @@
   }
   ExpectToken(Token::kRBRACE);
 
-  const Type& array_type = Type::Handle(Z, Type::ArrayType());
-  // Add static field 'const List values'.
+  const Class& array_class = Class::Handle(Z, I->object_store()->array_class());
+  TypeArguments& values_type_args =
+      TypeArguments::ZoneHandle(Z, TypeArguments::New(1));
+  const Type& enum_type = Type::Handle(Type::NewNonParameterizedType(cls));
+  values_type_args.SetTypeAt(0, enum_type);
+  Type& values_type = Type::ZoneHandle(
+      Z, Type::New(array_class, values_type_args, cls.token_pos(), Heap::kOld));
+  values_type ^= ClassFinalizer::FinalizeType(cls, values_type,
+                                              ClassFinalizer::kCanonicalize);
+  values_type_args = values_type.arguments();  // Get canonical type arguments.
+  // Add static field 'const List<E> values'.
   Field& values_field = Field::ZoneHandle(Z);
-  values_field =
-      Field::New(Symbols::Values(),
-                 /* is_static = */ true,
-                 /* is_final = */ true,
-                 /* is_const = */ true,
-                 /* is_reflectable = */ true, cls, array_type, cls.token_pos());
+  values_field = Field::New(Symbols::Values(),
+                            /* is_static = */ true,
+                            /* is_final = */ true,
+                            /* is_const = */ true,
+                            /* is_reflectable = */ true, cls, values_type,
+                            cls.token_pos());
   enum_members.AddField(values_field);
 
   // Add static field 'const _deleted_enum_sentinel'.
+  // This field does not need to be of type E.
   Field& deleted_enum_sentinel = Field::ZoneHandle(Z);
   deleted_enum_sentinel = Field::New(Symbols::_DeletedEnumSentinel(),
                                      /* is_static = */ true,
@@ -4881,6 +4927,7 @@
   // Allocate the immutable array containing the enumeration values.
   // The actual enum instance values will be patched in later.
   const Array& values_array = Array::Handle(Z, Array::New(i, Heap::kOld));
+  values_array.SetTypeArguments(values_type_args);
   values_field.SetStaticValue(values_array, true);
   values_field.RecordStore(values_array);
 
@@ -5073,23 +5120,6 @@
 }
 
 
-// Look ahead to detect if we are seeing ident [ TypeParameters ] "=".
-// Token position remains unchanged.
-bool Parser::IsMixinAppAlias() {
-  if (IsIdentifier() && (LookaheadToken(1) == Token::kASSIGN)) {
-    return true;
-  }
-  const TokenPosScope saved_pos(this);
-  if (IsIdentifier() && (LookaheadToken(1) == Token::kLT)) {
-    ConsumeToken();
-    if (TryParseTypeParameters() && (CurrentToken() == Token::kASSIGN)) {
-      return true;
-    }
-  }
-  return false;
-}
-
-
 void Parser::ParseTypedef(const GrowableObjectArray& pending_classes,
                           const Object& tl_owner,
                           TokenPosition metadata_pos) {
@@ -5098,14 +5128,6 @@
       metadata_pos.IsReal() ? metadata_pos : TokenPos();
   ExpectToken(Token::kTYPEDEF);
 
-  if (IsMixinAppAlias()) {
-    if (FLAG_warn_mixin_typedef) {
-      ReportWarning(TokenPos(), "deprecated mixin application typedef");
-    }
-    ParseMixinAppAlias(pending_classes, tl_owner, metadata_pos);
-    return;
-  }
-
   // Parse the result type of the function type.
   AbstractType& result_type = Type::Handle(Z, Type::DynamicType());
   if (CurrentToken() == Token::kVOID) {
@@ -6401,7 +6423,7 @@
       try_scope->LocalLookupVariable(Symbols::SavedExceptionVar());
   LocalVariable* saved_stack_trace_var =
       try_scope->LocalLookupVariable(Symbols::SavedStackTraceVar());
-  SaveExceptionAndStacktrace(current_block_->statements, exception_var,
+  SaveExceptionAndStackTrace(current_block_->statements, exception_var,
                              stack_trace_var, saved_exception_var,
                              saved_stack_trace_var);
 
@@ -6549,7 +6571,7 @@
       try_scope->LocalLookupVariable(Symbols::SavedExceptionVar());
   LocalVariable* saved_stack_trace_var =
       try_scope->LocalLookupVariable(Symbols::SavedStackTraceVar());
-  SaveExceptionAndStacktrace(current_block_->statements, exception_var,
+  SaveExceptionAndStackTrace(current_block_->statements, exception_var,
                              stack_trace_var, saved_exception_var,
                              saved_stack_trace_var);
 
@@ -7335,6 +7357,13 @@
                   "only generative constructors may have "
                   "initializing formal parameters");
     }
+    if (param_desc.is_covariant) {
+      if (!func.IsDynamicFunction(true)) {
+        ReportError(param_desc.name_pos,
+                    "only instance functions may have "
+                    "covariant parameters");
+      }
+    }
   }
 }
 
@@ -9190,32 +9219,91 @@
   const TokenPosition condition_pos = TokenPos();
   if (!I->asserts()) {
     SkipExpr();
+    if (CurrentToken() == Token::kCOMMA) {
+      ConsumeToken();
+      SkipExpr();
+    }
     ExpectToken(Token::kRPAREN);
     return NULL;
   }
-  AstNode* condition = ParseAwaitableExpr(kAllowConst, kConsumeCascades, NULL);
+
+  BoolScope saved_seen_await(&parsed_function()->have_seen_await_expr_, false);
+  AstNode* condition = ParseExpr(kAllowConst, kConsumeCascades);
   if (is_const && !condition->IsPotentiallyConst()) {
     ReportError(condition_pos,
                 "initializer assert expression must be compile time constant.");
   }
   const TokenPosition condition_end = TokenPos();
+  AstNode* message = NULL;
+  TokenPosition message_pos = TokenPosition::kNoSource;
+  if (CurrentToken() == Token::kCOMMA) {
+    ConsumeToken();
+    message_pos = TokenPos();
+    message = ParseExpr(kAllowConst, kConsumeCascades);
+    if (is_const && !message->IsPotentiallyConst()) {
+      ReportError(
+          message_pos,
+          "initializer assert expression must be compile time constant.");
+    }
+  }
   ExpectToken(Token::kRPAREN);
 
+  if (!is_const) {
+    // Check for assertion condition being a function if not const.
+    ArgumentListNode* arguments = new (Z) ArgumentListNode(condition_pos);
+    arguments->Add(condition);
+    condition = MakeStaticCall(
+        Symbols::AssertionError(),
+        Library::PrivateCoreLibName(Symbols::EvaluateAssertion()), arguments);
+  }
+  AstNode* not_condition =
+      new (Z) UnaryOpNode(condition_pos, Token::kNOT, condition);
+
+  // Build call to _AsertionError._throwNew(start, end, message)
   ArgumentListNode* arguments = new (Z) ArgumentListNode(condition_pos);
-  arguments->Add(condition);
   arguments->Add(new (Z) LiteralNode(
       condition_pos,
-      Integer::ZoneHandle(Z, Integer::New(condition_pos.value(), Heap::kOld))));
+      Integer::ZoneHandle(Z, Integer::New(condition_pos.Pos()))));
   arguments->Add(new (Z) LiteralNode(
       condition_end,
-      Integer::ZoneHandle(Z, Integer::New(condition_end.value(), Heap::kOld))));
+      Integer::ZoneHandle(Z, Integer::New(condition_end.Pos()))));
+  if (message == NULL) {
+    message = new (Z) LiteralNode(condition_end, Instance::ZoneHandle(Z));
+  }
+  arguments->Add(message);
   AstNode* assert_throw = MakeStaticCall(
       Symbols::AssertionError(),
-      Library::PrivateCoreLibName(is_const ? Symbols::CheckConstAssertion()
-                                           : Symbols::CheckAssertion()),
-      arguments);
+      Library::PrivateCoreLibName(Symbols::ThrowNew()), arguments);
 
-  return assert_throw;
+  AstNode* assertion_check = NULL;
+  if (parsed_function()->have_seen_await()) {
+    // The await transformation must be done manually because assertions
+    // are parsed as statements, not expressions. Thus, we need to check
+    // explicitely whether the arguments contain await operators. (Note that
+    // we must not parse the arguments with ParseAwaitableExpr(). In the
+    // corner case of assert(await a, await b), this would create two
+    // sibling scopes containing the temporary values for a and b. Both
+    // values would be allocated in the same internal context variable.)
+    //
+    // Build !condition ? _AsertionError._throwNew(...) : null;
+    // We need to use a conditional expression because the await transformer
+    // cannot transform if statements.
+    assertion_check = new (Z) ConditionalExprNode(
+        condition_pos, not_condition, assert_throw,
+        new (Z) LiteralNode(condition_pos, Object::null_instance()));
+    OpenBlock();
+    AwaitTransformer at(current_block_->statements, async_temp_scope_);
+    AstNode* transformed_assertion = at.Transform(assertion_check);
+    SequenceNode* preamble = CloseBlock();
+    preamble->Add(transformed_assertion);
+    assertion_check = preamble;
+  } else {
+    // Build if (!condition) _AsertionError._throwNew(...)
+    assertion_check = new (Z)
+        IfNode(condition_pos, not_condition,
+               NodeAsSequenceNode(condition_pos, assert_throw, NULL), NULL);
+  }
+  return assertion_check;
 }
 
 
@@ -9253,7 +9341,7 @@
 // the saved exception variable (:saved_exception_var) used to rethrow.
 // Generate code to load the stack trace object (:stack_trace_var) into
 // the saved stacktrace variable (:saved_stack_trace_var) used to rethrow.
-void Parser::SaveExceptionAndStacktrace(SequenceNode* statements,
+void Parser::SaveExceptionAndStackTrace(SequenceNode* statements,
                                         LocalVariable* exception_var,
                                         LocalVariable* stack_trace_var,
                                         LocalVariable* saved_exception_var,
@@ -9326,7 +9414,7 @@
     // there is an outer try or not. Note that this is only necessary if the
     // finally clause contains an await or yield.
     // TODO(hausner): Optimize.
-    SaveExceptionAndStacktrace(current_block_->statements, exception_var,
+    SaveExceptionAndStackTrace(current_block_->statements, exception_var,
                                stack_trace_var, rethrow_exception_var,
                                rethrow_stack_trace_var);
   }
@@ -9607,7 +9695,7 @@
                 LoadLocalNode(TokenPosition::kNoSource, async_saved_try_ctx)));
       }
     }
-    SaveExceptionAndStacktrace(async_code, exception_var, stack_trace_var,
+    SaveExceptionAndStackTrace(async_code, exception_var, stack_trace_var,
                                rethrow_exception_var, rethrow_stack_trace_var);
     // The async_code node sequence contains code to restore the context (if
     // an outer try block is present) and code to save the exception and
@@ -9881,7 +9969,7 @@
       ReportError(jump_pos, "label '%s' not found", target_name.ToCString());
     }
   } else if (FLAG_enable_debug_break && (CurrentToken() == Token::kSTRING)) {
-    const char* message = strdup(CurrentLiteral()->ToCString());
+    const char* message = Z->MakeCopyOfString(CurrentLiteral()->ToCString());
     ConsumeToken();
     return new (Z) StopNode(jump_pos, message);
   } else {
@@ -10444,7 +10532,7 @@
   ArgumentListNode* arguments = new (Z) ArgumentListNode(call_pos);
 
   String& method_name = String::Handle(Z);
-  if (prefix == NULL) {
+  if (prefix == NULL || !prefix->is_deferred_load()) {
     method_name = Library::PrivateCoreLibName(Symbols::ThrowNew()).raw();
   } else {
     arguments->Add(new (Z) LiteralNode(call_pos, *prefix));
@@ -11182,7 +11270,8 @@
 
 AstNode* Parser::ParseStaticCall(const Class& cls,
                                  const String& func_name,
-                                 TokenPosition ident_pos) {
+                                 TokenPosition ident_pos,
+                                 const LibraryPrefix* prefix) {
   TRACE_PARSER("ParseStaticCall");
   const TokenPosition call_pos = TokenPos();
   ASSERT(CurrentToken() == Token::kLPAREN);
@@ -11218,7 +11307,8 @@
     return ThrowNoSuchMethodError(ident_pos, cls, func_name, arguments,
                                   InvocationMirror::kStatic,
                                   InvocationMirror::kMethod,
-                                  NULL);  // No existing function.
+                                  NULL,  // No existing function.
+                                  prefix);
   } else if (cls.IsTopLevel() && (cls.library() == Library::CoreLibrary()) &&
              (func.name() == Symbols::Identical().raw())) {
     // This is the predefined toplevel function identical(a,b).
@@ -11355,8 +11445,15 @@
     // for a field (which may be defined in a subclass.)
     const String& name =
         String::Cast(Object::ZoneHandle(primary->primary().raw()));
-    if (current_function().is_static() ||
-        current_function().IsInFactoryScope()) {
+    if (primary->is_deferred_reference()) {
+      StaticGetterNode* getter = new (Z) StaticGetterNode(
+          primary->token_pos(),
+          NULL,  // No receiver.
+          Class::ZoneHandle(Z, library_.toplevel_class()), name);
+      getter->set_is_deferred(primary->is_deferred_reference());
+      return getter;
+    } else if (current_function().is_static() ||
+               current_function().IsInFactoryScope()) {
       StaticGetterNode* getter = new (Z)
           StaticGetterNode(primary->token_pos(),
                            NULL,  // No receiver.
@@ -11469,13 +11566,21 @@
           // For now, resolve type arguments and ignore.
           ParseTypeArguments(ClassFinalizer::kCanonicalize);
         }
-        if (left->IsPrimaryNode() &&
-            left->AsPrimaryNode()->primary().IsClass()) {
+        PrimaryNode* primary_node = left->AsPrimaryNode();
+        if ((primary_node != NULL) && primary_node->primary().IsClass()) {
           // Static method call prefixed with class name.
-          const Class& cls = Class::Cast(left->AsPrimaryNode()->primary());
-          selector = ParseStaticCall(cls, *ident, ident_pos);
+          const Class& cls = Class::Cast(primary_node->primary());
+          selector =
+              ParseStaticCall(cls, *ident, ident_pos, primary_node->prefix());
         } else {
-          selector = ParseInstanceCall(left, *ident, ident_pos, is_conditional);
+          if ((primary_node != NULL) && primary_node->is_deferred_reference()) {
+            const Class& cls = Class::Handle(library_.toplevel_class());
+            selector =
+                ParseStaticCall(cls, *ident, ident_pos, primary_node->prefix());
+          } else {
+            selector =
+                ParseInstanceCall(left, *ident, ident_pos, is_conditional);
+          }
         }
       } else {
         // Field access.
@@ -11483,11 +11588,13 @@
         bool is_deferred = false;
         if (left->IsPrimaryNode()) {
           PrimaryNode* primary_node = left->AsPrimaryNode();
+          is_deferred = primary_node->is_deferred_reference();
           if (primary_node->primary().IsClass()) {
             // If the primary node referred to a class we are loading a
             // qualified static field.
             cls ^= primary_node->primary().raw();
-            is_deferred = primary_node->is_deferred_reference();
+          } else if (is_deferred) {
+            cls = library_.toplevel_class();
           }
         }
         if (cls.IsNull()) {
@@ -11579,7 +11686,12 @@
           }
           const String& name =
               String::Cast(Object::ZoneHandle(primary_node->primary().raw()));
-          if (current_function().is_static()) {
+          if (primary_node->is_deferred_reference()) {
+            // The static call will be converted to throwing a NSM error.
+            const Class& cls = Class::Handle(library_.toplevel_class());
+            selector =
+                ParseStaticCall(cls, name, primary_pos, primary_node->prefix());
+          } else if (current_function().is_static()) {
             // The static call will be converted to throwing a NSM error.
             selector = ParseStaticCall(current_class(), name, primary_pos);
           } else {
@@ -11670,10 +11782,9 @@
 
 // Closurization e#m of getter, setter, method or operator.
 AstNode* Parser::ParseClosurization(AstNode* primary) {
-  if (FLAG_warn_new_tearoff_syntax) {
-    ReportWarning(
-        "Tear-offs using the x#id syntax is a deprecated feature,"
-        "it will not be supported in the next release");
+  if (!FLAG_support_deprecated_tearoff_syntax) {
+    ReportError("tear-off using the x#id syntax is a deprecated feature");
+    return NULL;
   }
   ExpectToken(Token::kHASH);
   TokenPosition property_pos = TokenPos();
@@ -11715,7 +11826,7 @@
       // a prefix, the name mangling does not help in hiding the private
       // name, so we explicitly prevent lookup of private names here.
       if (is_setter_name) {
-        String& setter_name =
+        const String& setter_name =
             String::Handle(Z, Field::SetterName(extractor_name));
         obj = prefix.LookupObject(setter_name);
       }
@@ -11738,11 +11849,13 @@
     } else if (obj.IsField()) {
       const Field& field = Field::Cast(obj);
       if (is_setter_name && !field.is_final()) {
-        Instance& setter_closure = Instance::ZoneHandle(field.SetterClosure());
+        const Instance& setter_closure =
+            Instance::ZoneHandle(field.SetterClosure());
         return new (Z) LiteralNode(property_pos, setter_closure);
       }
       if (!is_setter_name) {
-        Instance& getter_closure = Instance::ZoneHandle(field.GetterClosure());
+        const Instance& getter_closure =
+            Instance::ZoneHandle(field.GetterClosure());
         return new (Z) LiteralNode(property_pos, getter_closure);
       }
     }
@@ -11861,6 +11974,8 @@
 // Not all involved type classes may get resolved yet, but at least type
 // parameters will get resolved, thereby relieving the class
 // finalizer from resolving type parameters out of context.
+// TODO(regis): Refactor this code which is partially duplicated in the class
+// finalizer, paying attention to type parameter resolution and mixin library.
 void Parser::ResolveType(ClassFinalizer::FinalizationKind finalization,
                          AbstractType* type) {
   ASSERT(finalization >= ClassFinalizer::kResolveTypeParameters);
@@ -11938,6 +12053,19 @@
     if (!resolved_type_class.IsNull()) {
       // Replace unresolved class with resolved type class.
       parameterized_type.set_type_class(resolved_type_class);
+      // Promote type to a function type in case its type class is a typedef.
+      if (resolved_type_class.IsTypedefClass()) {
+        ASSERT(!parameterized_type.IsFunctionType());
+        parameterized_type.set_signature(
+            Function::Handle(Z, resolved_type_class.signature_function()));
+      }
+      // Replace FutureOr<T> type of async library with dynamic.
+      if ((resolved_type_class.library() == Library::AsyncLibrary()) &&
+          (resolved_type_class.Name() == Symbols::FutureOr().raw())) {
+        parameterized_type.set_type_class(
+            Class::Handle(Object::dynamic_class()));
+        parameterized_type.set_arguments(Object::null_type_arguments());
+      }
     } else if (finalization >= ClassFinalizer::kCanonicalize) {
       ClassFinalizer::FinalizeMalformedType(
           Error::Handle(Z),  // No previous error.
@@ -11946,6 +12074,9 @@
       return;
     }
   }
+  if (finalization > ClassFinalizer::kResolveTypeParameters) {
+    type->SetIsResolved();
+  }
   // Resolve type arguments, if any.
   if (type->arguments() != TypeArguments::null()) {
     const TypeArguments& arguments =
@@ -11958,6 +12089,45 @@
       arguments.SetTypeAt(i, type_argument);
     }
   }
+  if (type->IsFunctionType()) {
+    const Function& signature =
+        Function::Handle(Z, Type::Cast(*type).signature());
+    Type& signature_type = Type::Handle(Z, signature.SignatureType());
+    if (signature_type.raw() != type->raw()) {
+      ResolveType(finalization, &signature_type);
+    } else {
+      AbstractType& type = AbstractType::Handle(signature.result_type());
+      ResolveType(finalization, &type);
+      signature.set_result_type(type);
+      const intptr_t num_parameters = signature.NumParameters();
+      for (intptr_t i = 0; i < num_parameters; i++) {
+        type = signature.ParameterTypeAt(i);
+        ResolveType(finalization, &type);
+        signature.SetParameterTypeAt(i, type);
+      }
+      if (signature.IsSignatureFunction()) {
+        // Drop fields that are not necessary anymore after resolution.
+        // The parent function, owner, and token position of a shared
+        // canonical function type are meaningless, since the canonical
+        // representent is picked arbitrarily.
+        signature.set_parent_function(Function::Handle(Z));
+        // TODO(regis): As long as we support metadata in typedef signatures,
+        // we cannot reset these fields used to reparse a typedef.
+        // Note that the scope class of a typedef function type is always
+        // preserved as the typedef class (not reset to _Closure class), thereby
+        // preventing sharing of canonical function types between typedefs.
+        // Not being shared, these fields are therefore always meaningful for
+        // typedefs.
+        if (type.HasResolvedTypeClass()) {
+          const Class& scope_class = Class::Handle(Z, type.type_class());
+          if (!scope_class.IsTypedefClass()) {
+            signature.set_owner(Object::Handle(Z));
+            signature.set_token_pos(TokenPosition::kNoSource);
+          }
+        }
+      }
+    }
+  }
 }
 
 
@@ -12415,7 +12585,9 @@
     const Class& cls = Class::Cast(obj);
     PrimaryNode* primary =
         new (Z) PrimaryNode(ident_pos, Class::ZoneHandle(Z, cls.raw()));
-    primary->set_is_deferred(is_deferred);
+    if (is_deferred) {
+      primary->set_prefix(&prefix);
+    }
     return primary;
   } else if (obj.IsField()) {
     const Field& field = Field::Cast(obj);
@@ -12444,7 +12616,9 @@
     } else {
       PrimaryNode* primary =
           new (Z) PrimaryNode(ident_pos, Function::ZoneHandle(Z, func.raw()));
-      primary->set_is_deferred(is_deferred);
+      if (is_deferred) {
+        primary->set_prefix(&prefix);
+      }
       return primary;
     }
   }
@@ -13041,8 +13215,8 @@
     ArgumentListNode* constr_args = new (Z) ArgumentListNode(TokenPos());
     constr_args->Add(new (Z) LiteralNode(literal_pos, key_value_array));
     const Function& map_constr = Function::ZoneHandle(
-        Z, immutable_map_class.LookupConstructor(Library::PrivateCoreLibName(
-               Symbols::ImmutableMapConstructor())));
+        Z, immutable_map_class.LookupConstructorAllowPrivate(
+               Symbols::ImmutableMapConstructor()));
     ASSERT(!map_constr.IsNull());
     const Object& constructor_result = Object::Handle(
         Z, EvaluateConstConstructorCall(immutable_map_class, map_type_arguments,
@@ -13264,10 +13438,9 @@
   // type that is loaded.
   ASSERT(prefix.IsNull() || prefix.is_loaded());
   ASSERT(!type.IsMalformed() && !type.IsTypeParameter());
-  if (FLAG_warn_new_tearoff_syntax) {
-    ReportWarning(
-        "Tear-offs using the x#id syntax is a deprecated feature,"
-        "it will not be supported in the next release");
+  if (!FLAG_support_deprecated_tearoff_syntax) {
+    ReportError("tear-off using the x#id syntax is a deprecated feature");
+    return;
   }
   ExpectToken(Token::kHASH);
   String* named_constructor = NULL;
@@ -13364,14 +13537,12 @@
   String* named_constructor = NULL;
   const bool is_tearoff_expression = (CurrentToken() == Token::kHASH);
   if (is_tearoff_expression) {
+    if (!FLAG_support_deprecated_tearoff_syntax) {
+      ReportError("tear-off using the x#id syntax is a deprecated feature");
+    }
     if (is_const) {
       ReportError("tear-off closure not allowed with const allocation");
     }
-    if (FLAG_warn_new_tearoff_syntax) {
-      ReportWarning(
-          "Tear-offs using the x#id syntax is a deprecated feature,"
-          "and will not be supported in the next release");
-    }
     ConsumeToken();
     if (IsIdentifier()) {
       named_constructor = ExpectIdentifier("name of constructor expected");
@@ -13809,10 +13980,8 @@
     const LibraryPrefix& prefix = LibraryPrefix::ZoneHandle(Z, ParsePrefix());
     if (!prefix.IsNull()) {
       if (CurrentToken() == Token::kHASH) {
-        if (FLAG_warn_new_tearoff_syntax) {
-          ReportWarning(
-              "Tear-offs using the x#id syntax is a deprecated feature,"
-              "it will not be supported in the next release");
+        if (!FLAG_support_deprecated_tearoff_syntax) {
+          ReportError("tear-off using the x#id syntax is a deprecated feature");
         }
         // Closurization of top-level entity in prefix scope.
         return new (Z) LiteralNode(qual_ident_pos, prefix);
@@ -13886,6 +14055,9 @@
           const String& qualified_name =
               String::ZoneHandle(Z, Symbols::FromConcatAll(T, pieces));
           primary = new (Z) PrimaryNode(qual_ident_pos, qualified_name);
+          if (prefix.is_deferred_load()) {
+            primary->AsPrimaryNode()->set_prefix(&prefix);
+          }
         }
       } else if (FLAG_load_deferred_eagerly && prefix.is_deferred_load()) {
         // primary != NULL.
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index 004913e..7f11efe 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -694,7 +694,7 @@
                                LocalVariable** stack_trace_var,
                                LocalVariable** saved_exception_var,
                                LocalVariable** saved_stack_trace_var);
-  void SaveExceptionAndStacktrace(SequenceNode* statements,
+  void SaveExceptionAndStackTrace(SequenceNode* statements,
                                   LocalVariable* exception_var,
                                   LocalVariable* stack_trace_var,
                                   LocalVariable* saved_exception_var,
@@ -750,7 +750,6 @@
   bool IsSymbol(const String& symbol);
   bool IsSimpleLiteral(const AbstractType& type, Instance* value);
   bool IsFunctionTypeAliasName();
-  bool IsMixinAppAlias();
   bool TryParseQualIdent();
   bool TryParseTypeParameters();
   bool TryParseTypeArguments();
@@ -806,7 +805,8 @@
                                           bool require_const);
   AstNode* ParseStaticCall(const Class& cls,
                            const String& method_name,
-                           TokenPosition ident_pos);
+                           TokenPosition ident_pos,
+                           const LibraryPrefix* prefix = NULL);
   AstNode* ParseInstanceCall(AstNode* receiver,
                              const String& method_name,
                              TokenPosition ident_pos,
diff --git a/runtime/vm/parser_test.cc b/runtime/vm/parser_test.cc
index ece6a9a..2e35b12 100644
--- a/runtime/vm/parser_test.cc
+++ b/runtime/vm/parser_test.cc
@@ -179,7 +179,7 @@
 #ifndef PRODUCT
 
 
-static const char* saved_vars = NULL;
+static char* saved_vars = NULL;
 
 
 static char* SkipIndex(const char* input) {
@@ -218,7 +218,7 @@
   DebuggerStackTrace* stack = Isolate::Current()->debugger()->StackTrace();
   intptr_t num_frames = stack->Length();
   const int kBufferLen = 2048;
-  char* buffer = new char[kBufferLen];
+  char* buffer = reinterpret_cast<char*>(malloc(kBufferLen));
   char* pos = buffer;
   LocalVarDescriptors& var_desc = LocalVarDescriptors::Handle();
   for (intptr_t i = 0; i < num_frames; i++) {
@@ -233,15 +233,16 @@
     delete[] var_str;
   }
   pos[0] = '\0';
+  if (saved_vars != NULL) {
+    free(saved_vars);
+  }
   saved_vars = buffer;
 }
 
 
 // Uses the debugger to pause the program and capture the variable
 // descriptors for all frames on the stack.
-static const char* CaptureVarsAtLine(Dart_Handle lib,
-                                     const char* entry,
-                                     int line) {
+static char* CaptureVarsAtLine(Dart_Handle lib, const char* entry, int line) {
   EXPECT(ClassFinalizer::ProcessPendingClasses());
   bool saved_flag = FLAG_show_invisible_frames;
   FLAG_show_invisible_frames = true;
@@ -249,7 +250,7 @@
   EXPECT_VALID(Dart_SetBreakpoint(NewString(TestCase::url()), line));
   saved_vars = NULL;
   EXPECT_VALID(Dart_Invoke(lib, NewString(entry), 0, NULL));
-  const char* tmp = saved_vars;
+  char* tmp = saved_vars;
   saved_vars = NULL;
   FLAG_show_invisible_frames = saved_flag;
   return tmp;
@@ -267,6 +268,7 @@
       "}\n";
   Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
   EXPECT_VALID(lib);
+  char* vars = CaptureVarsAtLine(lib, "main", 4);
   EXPECT_STREQ(
       // function f uses one ctx var at (0); doesn't save ctx.
       "main.f\n"
@@ -288,7 +290,8 @@
       " 1 ContextLevel  level=1   scope=2   begin=4   end=37\n"
       " 2 ContextVar    level=1   begin=10  end=37  name=value\n"
       " 3 StackVar      scope=2   begin=12  end=37  name=f\n",
-      CaptureVarsAtLine(lib, "main", 4));
+      vars);
+  free(vars);
 }
 
 
@@ -306,6 +309,7 @@
       "}\n";
   Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
   EXPECT_VALID(lib);
+  char* vars = CaptureVarsAtLine(lib, "a", 5);
   EXPECT_STREQ(
       // Innermost function uses captured variable 'value' from middle
       // function.
@@ -343,7 +347,8 @@
       " 0 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
       " 1 StackVar      scope=2   begin=6   end=46  name=b\n",
-      CaptureVarsAtLine(lib, "a", 5));
+      vars);
+  free(vars);
 }
 
 
@@ -366,10 +371,11 @@
   Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
   EXPECT_VALID(lib);
 
+  char* vars = CaptureVarsAtLine(lib, "a", 7);
   EXPECT_STREQ(
       // bb captures only value2 from aa.  No others.
       "a.b.aa.bb\n"
-      " 0 ContextVar    level=0   begin=33  end=43  name=value2\n"
+      " 0 ContextVar    level=0   begin=34  end=44  name=value2\n"
       " 1 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
 
@@ -385,9 +391,9 @@
       "a.b.aa\n"
       " 0 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
-      " 1 ContextLevel  level=1   scope=2   begin=22  end=52\n"
-      " 2 ContextVar    level=1   begin=28  end=52  name=value2\n"
-      " 3 StackVar      scope=2   begin=30  end=52  name=bb\n"
+      " 1 ContextLevel  level=1   scope=2   begin=22  end=53\n"
+      " 2 ContextVar    level=1   begin=29  end=53  name=value2\n"
+      " 3 StackVar      scope=2   begin=31  end=53  name=bb\n"
 
       // Closure call saves current context.
       "_Closure.call\n"
@@ -397,10 +403,10 @@
 
       // b captures value1 from a.
       "a.b\n"
-      " 0 ContextVar    level=0   begin=14  end=62  name=value1\n"
+      " 0 ContextVar    level=0   begin=14  end=63  name=value1\n"
       " 1 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
-      " 2 StackVar      scope=2   begin=18  end=62  name=aa\n"
+      " 2 StackVar      scope=2   begin=18  end=63  name=aa\n"
 
       // Closure call saves current context.
       "_Closure.call\n"
@@ -412,10 +418,11 @@
       "a\n"
       " 0 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
-      " 1 ContextLevel  level=1   scope=2   begin=4   end=70\n"
-      " 2 ContextVar    level=1   begin=10  end=70  name=value1\n"
-      " 3 StackVar      scope=2   begin=12  end=70  name=b\n",
-      CaptureVarsAtLine(lib, "a", 7));
+      " 1 ContextLevel  level=1   scope=2   begin=4   end=71\n"
+      " 2 ContextVar    level=1   begin=10  end=71  name=value1\n"
+      " 3 StackVar      scope=2   begin=12  end=71  name=b\n",
+      vars);
+  free(vars);
 }
 
 
@@ -447,11 +454,12 @@
       "}\n";
   Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
   EXPECT_VALID(lib);
+  char* vars = CaptureVarsAtLine(lib, "doIt", 12);
   EXPECT_STREQ(
       // This frame saves the entry context instead of chaining.  Good.
       "doIt.<anonymous closure>\n"
-      " 0 ContextLevel  level=1   scope=1   begin=41  end=62\n"
-      " 1 ContextVar    level=1   begin=42  end=62  name=y\n"
+      " 0 ContextLevel  level=1   scope=1   begin=41  end=65\n"
+      " 1 ContextVar    level=1   begin=42  end=65  name=y\n"
       " 2 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
 
@@ -470,8 +478,9 @@
       "doIt\n"
       " 0 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
-      " 1 StackVar      scope=2   begin=35  end=77  name=x\n",
-      CaptureVarsAtLine(lib, "doIt", 12));
+      " 1 StackVar      scope=2   begin=35  end=80  name=x\n",
+      vars);
+  free(vars);
 }
 
 
@@ -493,10 +502,11 @@
       "}\n";
   Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
   EXPECT_VALID(lib);
+  char* vars = CaptureVarsAtLine(lib, "outer", 5);
   EXPECT_STREQ(
       // inner function captures variable value.  That's fine.
       "outer.inner\n"
-      " 0 ContextVar    level=0   begin=32  end=42  name=value\n"
+      " 0 ContextVar    level=0   begin=33  end=43  name=value\n"
       " 1 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
 
@@ -511,11 +521,12 @@
       "outer\n"
       " 0 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
-      " 1 StackVar      scope=3   begin=12  end=50  name=i\n"
-      " 2 ContextLevel  level=1   scope=4   begin=20  end=50\n"
-      " 3 ContextVar    level=1   begin=28  end=50  name=value\n"
-      " 4 StackVar      scope=4   begin=30  end=50  name=inner\n",
-      CaptureVarsAtLine(lib, "outer", 5));
+      " 1 StackVar      scope=3   begin=12  end=52  name=i\n"
+      " 2 ContextLevel  level=1   scope=4   begin=20  end=52\n"
+      " 3 ContextVar    level=1   begin=28  end=52  name=value\n"
+      " 4 StackVar      scope=4   begin=30  end=52  name=inner\n",
+      vars);
+  free(vars);
 }
 
 TEST_CASE(Parser_AllocateVariables_MiddleChain) {
@@ -537,9 +548,10 @@
       "}\n";
   Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
   EXPECT_VALID(lib);
+  char* vars = CaptureVarsAtLine(lib, "a", 10);
   EXPECT_STREQ(
       "a.b.c\n"
-      " 0 ContextVar    level=0   begin=50  end=62  name=x\n"
+      " 0 ContextVar    level=0   begin=51  end=64  name=x\n"
       " 1 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
       "_Closure.call\n"
@@ -549,13 +561,13 @@
 
       // Doesn't save the entry context.  Chains to parent instead.
       "a.b\n"
-      " 0 ContextVar    level=0   begin=12  end=71  name=x\n"
+      " 0 ContextVar    level=0   begin=12  end=73  name=x\n"
       " 1 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
-      " 2 StackVar      scope=2   begin=47  end=71  name=c\n"
-      " 3 ContextLevel  level=1   scope=3   begin=18  end=47\n"
-      " 4 ContextVar    level=1   begin=22  end=47  name=i\n"
-      " 5 StackVar      scope=4   begin=32  end=47  name=d\n"
+      " 2 StackVar      scope=2   begin=48  end=73  name=c\n"
+      " 3 ContextLevel  level=1   scope=3   begin=18  end=48\n"
+      " 4 ContextVar    level=1   begin=22  end=48  name=i\n"
+      " 5 StackVar      scope=4   begin=33  end=48  name=d\n"
 
       "_Closure.call\n"
       " 0 StackVar      scope=1   begin=0   end=4   name=this\n"
@@ -565,10 +577,11 @@
       "a\n"
       " 0 CurrentCtx    scope=0   begin=0   end=0"
       "   name=:current_context_var\n"
-      " 1 ContextLevel  level=1   scope=2   begin=3   end=79\n"
-      " 2 ContextVar    level=1   begin=9   end=79  name=x\n"
-      " 3 StackVar      scope=2   begin=11  end=79  name=b\n",
-      CaptureVarsAtLine(lib, "a", 10));
+      " 1 ContextLevel  level=1   scope=2   begin=3   end=81\n"
+      " 2 ContextVar    level=1   begin=9   end=81  name=x\n"
+      " 3 StackVar      scope=2   begin=11  end=81  name=b\n",
+      vars);
+  free(vars);
 }
 
 #endif  // !PRODUCT
diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc
index 8d72d929a..13c2b68 100644
--- a/runtime/vm/precompiler.cc
+++ b/runtime/vm/precompiler.cc
@@ -33,6 +33,7 @@
 #include "vm/object_store.h"
 #include "vm/os.h"
 #include "vm/parser.h"
+#include "vm/program_visitor.h"
 #include "vm/redundancy_elimination.h"
 #include "vm/regexp_assembler.h"
 #include "vm/regexp_parser.h"
@@ -42,16 +43,17 @@
 #include "vm/timeline.h"
 #include "vm/timer.h"
 #include "vm/type_table.h"
+#include "vm/version.h"
+#include "vm/json_parser.h"
 
 namespace dart {
 
-
 #define T (thread())
 #define I (isolate())
 #define Z (zone())
 
 
-DEFINE_FLAG(bool, print_unique_targets, false, "Print unique dynaic targets");
+DEFINE_FLAG(bool, print_unique_targets, false, "Print unique dynamic targets");
 DEFINE_FLAG(bool, trace_precompiler, false, "Trace precompiler.");
 DEFINE_FLAG(
     int,
@@ -76,6 +78,15 @@
 DECLARE_FLAG(bool, trace_failed_optimization_attempts);
 DECLARE_FLAG(bool, trace_inlining_intervals);
 DECLARE_FLAG(bool, trace_irregexp);
+DECLARE_FLAG(int, inlining_hotness);
+DECLARE_FLAG(int, inlining_size_threshold);
+DECLARE_FLAG(int, inlining_callee_size_threshold);
+DECLARE_FLAG(int, inline_getters_setters_smaller_than);
+DECLARE_FLAG(int, inlining_depth_threshold);
+DECLARE_FLAG(int, inlining_caller_size_threshold);
+DECLARE_FLAG(int, inlining_constant_arguments_max_size_threshold);
+DECLARE_FLAG(int, inlining_constant_arguments_min_size_threshold);
+
 
 #ifdef DART_PRECOMPILER
 
@@ -95,30 +106,38 @@
           StoreInstanceFieldInstr* store = it.Current()->AsStoreInstanceField();
           if (store != NULL) {
             if (!store->field().IsNull() && store->field().is_final()) {
+#ifndef PRODUCT
               if (FLAG_trace_precompiler && FLAG_support_il_printer) {
                 THR_Print("Found store to %s <- %s\n",
                           store->field().ToCString(),
                           store->value()->Type()->ToCString());
               }
+#endif  // !PRODUCT
               FieldTypePair* entry = field_map_->Lookup(&store->field());
               if (entry == NULL) {
                 field_map_->Insert(FieldTypePair(
                     &Field::Handle(zone_, store->field().raw()),  // Re-wrap.
                     store->value()->Type()->ToCid()));
+#ifndef PRODUCT
                 if (FLAG_trace_precompiler && FLAG_support_il_printer) {
                   THR_Print(" initial type = %s\n",
                             store->value()->Type()->ToCString());
                 }
+#endif  // !PRODUCT
                 continue;
               }
               CompileType type = CompileType::FromCid(entry->cid_);
+#ifndef PRODUCT
               if (FLAG_trace_precompiler && FLAG_support_il_printer) {
                 THR_Print(" old type = %s\n", type.ToCString());
               }
+#endif  // !PRODUCT
               type.Union(store->value()->Type());
+#ifndef PRODUCT
               if (FLAG_trace_precompiler && FLAG_support_il_printer) {
                 THR_Print(" new type = %s\n", type.ToCString());
               }
+#endif  // !PRODUCT
               entry->cid_ = type.ToCid();
             }
           }
@@ -185,12 +204,36 @@
 }
 
 
+TypeRangeCache::TypeRangeCache(Precompiler* precompiler,
+                               Thread* thread,
+                               intptr_t num_cids)
+    : precompiler_(precompiler),
+      thread_(thread),
+      lower_limits_(thread->zone()->Alloc<intptr_t>(num_cids)),
+      upper_limits_(thread->zone()->Alloc<intptr_t>(num_cids)) {
+  for (intptr_t i = 0; i < num_cids; i++) {
+    lower_limits_[i] = kNotComputed;
+    upper_limits_[i] = kNotComputed;
+  }
+  ASSERT(precompiler->type_range_cache() == NULL);
+  precompiler->set_type_range_cache(this);
+}
+
+
+TypeRangeCache::~TypeRangeCache() {
+  ASSERT(precompiler_->type_range_cache() == this);
+  precompiler_->set_type_range_cache(NULL);
+}
+
+
 RawError* Precompiler::CompileAll(
     Dart_QualifiedFunctionName embedder_entry_points[],
-    bool reset_fields) {
+    uint8_t* jit_feedback,
+    intptr_t jit_feedback_length) {
   LongJumpScope jump;
   if (setjmp(*jump.Set()) == 0) {
-    Precompiler precompiler(Thread::Current(), reset_fields);
+    Precompiler precompiler(Thread::Current());
+    precompiler.LoadFeedback(jit_feedback, jit_feedback_length);
     precompiler.DoCompileAll(embedder_entry_points);
     return Error::null();
   } else {
@@ -209,6 +252,7 @@
 
   if (!type.IsInstantiated()) return false;
   if (type.IsFunctionType()) return false;
+  if (type.IsDartFunctionType()) return false;
 
   Zone* zone = thread_->zone();
   const TypeArguments& type_arguments =
@@ -235,16 +279,22 @@
   Class& cls = Class::Handle(zone);
   AbstractType& cls_type = AbstractType::Handle(zone);
   for (intptr_t cid = kInstanceCid; cid < table->NumCids(); cid++) {
+    // Create local zone because deep hierarchies may allocate lots of handles
+    // within one iteration of this loop.
+    StackZone stack_zone(thread_);
+    HANDLESCOPE(thread_);
+
     if (!table->HasValidClassAt(cid)) continue;
     if (cid == kVoidCid) continue;
     if (cid == kDynamicCid) continue;
+    if (cid == kNullCid) continue;  // Instance is not at Bottom like Null type.
     cls = table->At(cid);
     if (cls.is_abstract()) continue;
     if (cls.is_patch()) continue;
     if (cls.IsTopLevel()) continue;
 
     cls_type = cls.RareType();
-    if (cls_type.IsSubtypeOf(type, NULL, NULL, Heap::kOld)) {
+    if (cls_type.IsSubtypeOf(type, NULL, NULL, Heap::kNew)) {
       last_matching_cid = cid;
       if (*lower_limit == -1) {
         // Found beginning of range.
@@ -289,11 +339,11 @@
 }
 
 
-Precompiler::Precompiler(Thread* thread, bool reset_fields)
+Precompiler::Precompiler(Thread* thread)
     : thread_(thread),
       zone_(NULL),
       isolate_(thread->isolate()),
-      reset_fields_(reset_fields),
+      jit_feedback_(NULL),
       changed_(false),
       function_count_(0),
       class_count_(0),
@@ -316,10 +366,52 @@
       types_to_retain_(),
       consts_to_retain_(),
       field_type_map_(),
+      type_range_cache_(NULL),
       error_(Error::Handle()),
       get_runtime_type_is_unique_(false) {}
 
 
+void Precompiler::LoadFeedback(uint8_t* buffer, intptr_t length) {
+  if (buffer == NULL) {
+    if (FLAG_trace_precompiler) {
+      THR_Print("Precompiler running without JIT feedback\n");
+    }
+
+    // Flags affecting compilation only:
+    // There is no counter feedback in precompilation, so ignore the counter
+    // when making inlining decisions.
+    FLAG_inlining_hotness = 0;
+    // Use smaller thresholds in precompilation as we are compiling everything
+    // with the optimizing compiler instead of only hot functions.
+    FLAG_inlining_size_threshold = 5;
+    FLAG_inline_getters_setters_smaller_than = 5;
+    FLAG_inlining_callee_size_threshold = 20;
+    FLAG_inlining_depth_threshold = 4;
+    FLAG_inlining_caller_size_threshold = 1000;
+    FLAG_inlining_constant_arguments_max_size_threshold = 100;
+    FLAG_inlining_constant_arguments_min_size_threshold = 30;
+    return;
+  }
+
+  if (FLAG_trace_precompiler) {
+    THR_Print("Loading JIT feedback\n");
+  }
+
+  JSONParser parser(reinterpret_cast<const char*>(buffer), length,
+                    Thread::Current()->zone());
+  ParsedJSONValue* root = parser.ParseValue();
+  if (root->IsError()) {
+    ParsedJSONError* error = static_cast<ParsedJSONError*>(root);
+    THR_Print("Error parsing JIT feedback: %s:%" Pd "\n", error->message(),
+              error->position());
+  } else if (!root->IsObject()) {
+    THR_Print("Error parsing JIT feedback: object expected\n");
+  } else {
+    jit_feedback_ = static_cast<ParsedJSONObject*>(root);
+  }
+}
+
+
 void Precompiler::DoCompileAll(
     Dart_QualifiedFunctionName embedder_entry_points[]) {
   ASSERT(I->compilation_allowed());
@@ -336,7 +428,8 @@
       FinalizeAllClasses();
 
       SortClasses();
-      TypeRangeCache trc(T, I->class_table()->NumCids());
+      TypeRangeCache trc(this, T, I->class_table()->NumCids());
+      VerifyJITFeedback();
 
       // Precompile static initializers to compute result type information.
       PrecompileStaticInitializers();
@@ -401,7 +494,7 @@
     SwitchICCalls();
 
     ShareMegamorphicBuckets();
-    DedupStackmaps();
+    DedupStackMaps();
     DedupLists();
 
     if (FLAG_dedup_instructions) {
@@ -478,7 +571,7 @@
 
   HANDLESCOPE(T);
   StaticInitializerVisitor visitor(Z);
-  VisitClasses(&visitor);
+  ProgramVisitor::VisitClasses(&visitor);
 }
 
 
@@ -508,7 +601,7 @@
 
   HANDLESCOPE(T);
   ConstructorVisitor visitor(this, zone_);
-  VisitFunctions(&visitor);
+  ProgramVisitor::VisitFunctions(&visitor);
 
   FieldTypeMap::Iterator it(field_type_map_.GetIterator());
   for (FieldTypePair* current = it.Next(); current != NULL;
@@ -533,13 +626,13 @@
     }
   };
   ClearCodeFunctionVisitor function_visitor;
-  VisitFunctions(&function_visitor);
+  ProgramVisitor::VisitFunctions(&function_visitor);
 
   class ClearCodeClassVisitor : public ClassVisitor {
     void Visit(const Class& cls) { cls.DisableAllocationStub(); }
   };
   ClearCodeClassVisitor class_visitor;
-  VisitClasses(&class_visitor);
+  ProgramVisitor::VisitClasses(&class_visitor);
 }
 
 
@@ -598,10 +691,10 @@
     {"dart:isolate", "_SendPortImpl", "send"},
     {"dart:typed_data", "ByteData", "ByteData."},
     {"dart:typed_data", "ByteData", "ByteData._view"},
-    {"dart:typed_data", "ByteBuffer", "ByteBuffer._New"},
-    {"dart:_vmservice", "::", "_registerIsolate"},
+    {"dart:typed_data", "_ByteBuffer", "_ByteBuffer._New"},
     {"dart:_vmservice", "::", "boot"},
 #if !defined(PRODUCT)
+    {"dart:_vmservice", "::", "_registerIsolate"},
     {"dart:developer", "Metrics", "_printMetrics"},
     {"dart:developer", "::", "_runExtension"},
     {"dart:isolate", "::", "_runPendingImmediateCallback"},
@@ -830,6 +923,7 @@
 #endif
 
   const ObjectPool& pool = ObjectPool::Handle(Z, code.GetObjectPool());
+  ObjectPoolInfo pool_info(pool);
   ICData& call_site = ICData::Handle(Z);
   MegamorphicCache& cache = MegamorphicCache::Handle(Z);
   String& selector = String::Handle(Z);
@@ -838,34 +932,31 @@
   Instance& instance = Instance::Handle(Z);
   Code& target_code = Code::Handle(Z);
   for (intptr_t i = 0; i < pool.Length(); i++) {
-    if (pool.InfoAt(i) == ObjectPool::kTaggedObject) {
+    if (pool_info.InfoAt(i) == ObjectPool::kTaggedObject) {
       entry = pool.ObjectAt(i);
       if (entry.IsICData()) {
+        // A dynamic call.
         call_site ^= entry.raw();
-        for (intptr_t j = 0; j < call_site.NumberOfChecks(); j++) {
-          target = call_site.GetTargetAt(j);
-          AddFunction(target);
-          if (!target.is_static()) {
-            // Super call (should not enqueue selector) or dynamic call with a
-            // CHA prediction (should enqueue selector).
-            selector = call_site.target_name();
-            AddSelector(selector);
-          }
-        }
-        if (call_site.NumberOfChecks() == 0) {
-          // A dynamic call.
-          selector = call_site.target_name();
-          AddSelector(selector);
-          if (selector.raw() == Symbols::Call().raw()) {
-            // Potential closure call.
-            AddClosureCall(call_site);
-          }
+        ASSERT(!call_site.is_static_call());
+        selector = call_site.target_name();
+        AddSelector(selector);
+        if (selector.raw() == Symbols::Call().raw()) {
+          // Potential closure call.
+          const Array& arguments_descriptor =
+              Array::Handle(Z, call_site.arguments_descriptor());
+          AddClosureCall(arguments_descriptor);
         }
       } else if (entry.IsMegamorphicCache()) {
         // A dynamic call.
         cache ^= entry.raw();
         selector = cache.target_name();
         AddSelector(selector);
+        if (selector.raw() == Symbols::Call().raw()) {
+          // Potential closure call.
+          const Array& arguments_descriptor =
+              Array::Handle(Z, cache.arguments_descriptor());
+          AddClosureCall(arguments_descriptor);
+        }
       } else if (entry.IsField()) {
         // Potential need for field initializer.
         field ^= entry.raw();
@@ -924,6 +1015,8 @@
 
 void Precompiler::AddTypesOf(const Function& function) {
   if (function.IsNull()) return;
+  // We don't expect to see a reference to a redicting factory.
+  ASSERT(!function.IsRedirectingFactory());
   if (functions_to_retain_.Lookup(&function) != NULL) return;
   functions_to_retain_.Insert(&Function::ZoneHandle(Z, function.raw()));
 
@@ -1035,6 +1128,9 @@
   // argument descriptors.
   if (!instance.IsCanonical()) return;
 
+  // Constants are canonicalized and we avoid repeated processing of them.
+  if (consts_to_retain_.Lookup(&instance) != NULL) return;
+
   consts_to_retain_.Insert(&Instance::ZoneHandle(Z, instance.raw()));
 
   if (cls.NumTypeArguments() > 0) {
@@ -1068,9 +1164,7 @@
 }
 
 
-void Precompiler::AddClosureCall(const ICData& call_site) {
-  const Array& arguments_descriptor =
-      Array::Handle(Z, call_site.arguments_descriptor());
+void Precompiler::AddClosureCall(const Array& arguments_descriptor) {
   const Class& cache_class =
       Class::Handle(Z, I->object_store()->closure_class());
   const Function& dispatcher = Function::Handle(
@@ -1082,6 +1176,8 @@
 
 
 void Precompiler::AddField(const Field& field) {
+  if (fields_to_retain_.Lookup(&field) != NULL) return;
+
   fields_to_retain_.Insert(&Field::ZoneHandle(Z, field.raw()));
 
   if (field.is_static()) {
@@ -1094,15 +1190,12 @@
       // Should not be in the middle of initialization while precompiling.
       ASSERT(value.raw() != Object::transition_sentinel().raw());
 
-      const bool is_initialized = value.raw() != Object::sentinel().raw();
-      if (is_initialized && !reset_fields_) return;
-
       if (!field.HasPrecompiledInitializer() ||
           !Function::Handle(Z, field.PrecompiledInitializer()).HasCode()) {
         if (FLAG_trace_precompiler) {
           THR_Print("Precompiling initializer for %s\n", field.ToCString());
         }
-        ASSERT(Dart::snapshot_kind() != Snapshot::kAppNoJIT);
+        ASSERT(Dart::vm_snapshot_kind() != Snapshot::kAppAOT);
         const Function& initializer = Function::Handle(
             Z, CompileStaticInitializer(field, /* compute_type = */ true));
         ASSERT(!initializer.IsNull());
@@ -1141,10 +1234,12 @@
   if (compute_type && field.is_final()) {
     intptr_t result_cid = pipeline.result_type().ToCid();
     if (result_cid != kDynamicCid) {
+#ifndef PRODUCT
       if (FLAG_trace_precompiler && FLAG_support_il_printer) {
         THR_Print("Setting guarded_cid of %s to %s\n", field.ToCString(),
                   pipeline.result_type().ToCString());
       }
+#endif  // !PRODUCT
       field.set_guarded_cid(result_cid);
     }
   }
@@ -1918,7 +2013,7 @@
   // corpses. Request a full GC and wait for the sweeper tasks to finish before
   // we continue.
   I->heap()->CollectAllGarbage();
-  I->heap()->WaitForSweeperTasks();
+  I->heap()->WaitForSweeperTasks(T);
 #endif
 
   ClassTable* class_table = I->class_table();
@@ -2080,7 +2175,7 @@
   };
 
   BindStaticCallsVisitor visitor(Z);
-  VisitFunctions(&visitor);
+  ProgramVisitor::VisitFunctions(&visitor);
 }
 
 
@@ -2100,6 +2195,7 @@
           code_(Code::Handle(zone)),
           pool_(ObjectPool::Handle(zone)),
           entry_(Object::Handle(zone)),
+          info_array_(TypedData::Handle(zone)),
           ic_(ICData::Handle(zone)),
           target_name_(String::Handle(zone)),
           args_descriptor_(Array::Handle(zone)),
@@ -2114,8 +2210,10 @@
 
       code_ = function.CurrentCode();
       pool_ = code_.object_pool();
+      info_array_ = pool_.info_array();
+      ObjectPoolInfo pool_info(info_array_);
       for (intptr_t i = 0; i < pool_.Length(); i++) {
-        if (pool_.InfoAt(i) != ObjectPool::kTaggedObject) continue;
+        if (pool_info.InfoAt(i) != ObjectPool::kTaggedObject) continue;
         entry_ = pool_.ObjectAt(i);
         if (entry_.IsICData()) {
           // The only IC calls generated by precompilation are for switchable
@@ -2155,6 +2253,7 @@
     Code& code_;
     ObjectPool& pool_;
     Object& entry_;
+    TypedData& info_array_;
     ICData& ic_;
     String& target_name_;
     Array& args_descriptor_;
@@ -2165,7 +2264,7 @@
 
   ASSERT(!I->compilation_allowed());
   SwitchICCallsVisitor visitor(Z);
-  VisitFunctions(&visitor);
+  ProgramVisitor::VisitFunctions(&visitor);
 #endif
 }
 
@@ -2193,15 +2292,15 @@
 }
 
 
-void Precompiler::DedupStackmaps() {
-  class DedupStackmapsVisitor : public FunctionVisitor {
+void Precompiler::DedupStackMaps() {
+  class DedupStackMapsVisitor : public FunctionVisitor {
    public:
-    explicit DedupStackmapsVisitor(Zone* zone)
+    explicit DedupStackMapsVisitor(Zone* zone)
         : zone_(zone),
           canonical_stackmaps_(),
           code_(Code::Handle(zone)),
           stackmaps_(Array::Handle(zone)),
-          stackmap_(Stackmap::Handle(zone)) {}
+          stackmap_(StackMap::Handle(zone)) {}
 
     void Visit(const Function& function) {
       if (!function.HasCode()) {
@@ -2212,17 +2311,17 @@
       if (stackmaps_.IsNull()) return;
       for (intptr_t i = 0; i < stackmaps_.Length(); i++) {
         stackmap_ ^= stackmaps_.At(i);
-        stackmap_ = DedupStackmap(stackmap_);
+        stackmap_ = DedupStackMap(stackmap_);
         stackmaps_.SetAt(i, stackmap_);
       }
     }
 
-    RawStackmap* DedupStackmap(const Stackmap& stackmap) {
-      const Stackmap* canonical_stackmap =
+    RawStackMap* DedupStackMap(const StackMap& stackmap) {
+      const StackMap* canonical_stackmap =
           canonical_stackmaps_.LookupValue(&stackmap);
       if (canonical_stackmap == NULL) {
         canonical_stackmaps_.Insert(
-            &Stackmap::ZoneHandle(zone_, stackmap.raw()));
+            &StackMap::ZoneHandle(zone_, stackmap.raw()));
         return stackmap.raw();
       } else {
         return canonical_stackmap->raw();
@@ -2231,14 +2330,14 @@
 
    private:
     Zone* zone_;
-    StackmapSet canonical_stackmaps_;
+    StackMapSet canonical_stackmaps_;
     Code& code_;
     Array& stackmaps_;
-    Stackmap& stackmap_;
+    StackMap& stackmap_;
   };
 
-  DedupStackmapsVisitor visitor(Z);
-  VisitFunctions(&visitor);
+  DedupStackMapsVisitor visitor(Z);
+  ProgramVisitor::VisitFunctions(&visitor);
 }
 
 
@@ -2305,7 +2404,7 @@
   };
 
   DedupListsVisitor visitor(Z);
-  VisitFunctions(&visitor);
+  ProgramVisitor::VisitFunctions(&visitor);
 }
 
 
@@ -2351,81 +2450,7 @@
   };
 
   DedupInstructionsVisitor visitor(Z);
-  VisitFunctions(&visitor);
-}
-
-
-void Precompiler::VisitClasses(ClassVisitor* visitor) {
-  Library& lib = Library::Handle(Z);
-  Class& cls = Class::Handle(Z);
-
-  for (intptr_t i = 0; i < libraries_.Length(); i++) {
-    lib ^= libraries_.At(i);
-    ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
-    while (it.HasNext()) {
-      cls = it.GetNextClass();
-      if (cls.IsDynamicClass()) {
-        continue;  // class 'dynamic' is in the read-only VM isolate.
-      }
-      visitor->Visit(cls);
-    }
-  }
-}
-
-
-void Precompiler::VisitFunctions(FunctionVisitor* visitor) {
-  Library& lib = Library::Handle(Z);
-  Class& cls = Class::Handle(Z);
-  Array& functions = Array::Handle(Z);
-  Array& fields = Array::Handle(Z);
-  Field& field = Field::Handle(Z);
-  Object& object = Object::Handle(Z);
-  Function& function = Function::Handle(Z);
-  GrowableObjectArray& closures = GrowableObjectArray::Handle(Z);
-
-  for (intptr_t i = 0; i < libraries_.Length(); i++) {
-    lib ^= libraries_.At(i);
-    ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
-    while (it.HasNext()) {
-      cls = it.GetNextClass();
-      if (cls.IsDynamicClass()) {
-        continue;  // class 'dynamic' is in the read-only VM isolate.
-      }
-
-      functions = cls.functions();
-      for (intptr_t j = 0; j < functions.Length(); j++) {
-        function ^= functions.At(j);
-        visitor->Visit(function);
-        if (function.HasImplicitClosureFunction()) {
-          function = function.ImplicitClosureFunction();
-          visitor->Visit(function);
-        }
-      }
-
-      functions = cls.invocation_dispatcher_cache();
-      for (intptr_t j = 0; j < functions.Length(); j++) {
-        object = functions.At(j);
-        if (object.IsFunction()) {
-          function ^= functions.At(j);
-          visitor->Visit(function);
-        }
-      }
-      fields = cls.fields();
-      for (intptr_t j = 0; j < fields.Length(); j++) {
-        field ^= fields.At(j);
-        if (field.is_static() && field.HasPrecompiledInitializer()) {
-          function ^= field.PrecompiledInitializer();
-          visitor->Visit(function);
-        }
-      }
-    }
-  }
-  closures = isolate()->object_store()->closure_functions();
-  for (intptr_t j = 0; j < closures.Length(); j++) {
-    function ^= closures.At(j);
-    visitor->Visit(function);
-    ASSERT(!function.HasImplicitClosureFunction());
-  }
+  ProgramVisitor::VisitFunctions(&visitor);
 }
 
 
@@ -2528,6 +2553,7 @@
 
   RemapClassIds(old_to_new_cid);
   delete[] old_to_new_cid;
+  RehashTypes();  // Types use cid's as part of their hashes.
 }
 
 
@@ -2602,6 +2628,437 @@
 }
 
 
+class ClearTypeHashVisitor : public ObjectVisitor {
+ public:
+  explicit ClearTypeHashVisitor(Zone* zone)
+      : type_param_(TypeParameter::Handle(zone)),
+        type_(Type::Handle(zone)),
+        type_args_(TypeArguments::Handle(zone)),
+        bounded_type_(BoundedType::Handle(zone)) {}
+
+  void VisitObject(RawObject* obj) {
+    if (obj->IsTypeParameter()) {
+      type_param_ ^= obj;
+      type_param_.SetHash(0);
+    } else if (obj->IsType()) {
+      type_ ^= obj;
+      type_.SetHash(0);
+    } else if (obj->IsBoundedType()) {
+      bounded_type_ ^= obj;
+      bounded_type_.SetHash(0);
+    } else if (obj->IsTypeArguments()) {
+      type_args_ ^= obj;
+      type_args_.SetHash(0);
+    }
+  }
+
+ private:
+  TypeParameter& type_param_;
+  Type& type_;
+  TypeArguments& type_args_;
+  BoundedType& bounded_type_;
+};
+
+
+void Precompiler::RehashTypes() {
+  // Clear all cached hash values.
+  {
+    HeapIterationScope his;
+    ClearTypeHashVisitor visitor(Z);
+    I->heap()->VisitObjects(&visitor);
+  }
+
+  // Rehash the canonical Types table.
+  ObjectStore* object_store = I->object_store();
+  GrowableObjectArray& types =
+      GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
+  Array& types_array = Array::Handle(Z);
+  Type& type = Type::Handle(Z);
+  {
+    CanonicalTypeSet types_table(Z, object_store->canonical_types());
+    types_array = HashTables::ToArray(types_table, false);
+    for (intptr_t i = 0; i < (types_array.Length() - 1); i++) {
+      type ^= types_array.At(i);
+      types.Add(type);
+    }
+    types_table.Release();
+  }
+
+  intptr_t dict_size = Utils::RoundUpToPowerOfTwo(types.Length() * 4 / 3);
+  types_array = HashTables::New<CanonicalTypeSet>(dict_size, Heap::kOld);
+  CanonicalTypeSet types_table(Z, types_array.raw());
+  for (intptr_t i = 0; i < types.Length(); i++) {
+    type ^= types.At(i);
+    bool present = types_table.Insert(type);
+    ASSERT(!present);
+  }
+  object_store->set_canonical_types(types_table.Release());
+
+  // Rehash the canonical TypeArguments table.
+  Array& typeargs_array = Array::Handle(Z);
+  GrowableObjectArray& typeargs =
+      GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
+  TypeArguments& typearg = TypeArguments::Handle(Z);
+  {
+    CanonicalTypeArgumentsSet typeargs_table(
+        Z, object_store->canonical_type_arguments());
+    typeargs_array = HashTables::ToArray(typeargs_table, false);
+    for (intptr_t i = 0; i < (typeargs_array.Length() - 1); i++) {
+      typearg ^= typeargs_array.At(i);
+      typeargs.Add(typearg);
+    }
+    typeargs_table.Release();
+  }
+
+  dict_size = Utils::RoundUpToPowerOfTwo(typeargs.Length() * 4 / 3);
+  typeargs_array =
+      HashTables::New<CanonicalTypeArgumentsSet>(dict_size, Heap::kOld);
+  CanonicalTypeArgumentsSet typeargs_table(Z, typeargs_array.raw());
+  for (intptr_t i = 0; i < typeargs.Length(); i++) {
+    typearg ^= typeargs.At(i);
+    bool present = typeargs_table.Insert(typearg);
+    ASSERT(!present);
+  }
+  object_store->set_canonical_type_arguments(typeargs_table.Release());
+}
+
+
+void Precompiler::VerifyJITFeedback() {
+  if (jit_feedback_ == NULL) return;
+
+  ParsedJSONString* js_vmversion = jit_feedback_->StringAt("vmVersion");
+  if ((js_vmversion == NULL) ||
+      strcmp(js_vmversion->value(), Version::CommitString()) != 0) {
+    THR_Print(
+        "JIT feedback contains invalid vm version "
+        "(saw %s, expected %s).\n",
+        js_vmversion->value(), Version::CommitString());
+    jit_feedback_ = NULL;
+    return;
+  }
+  ParsedJSONBoolean* js_asserts = jit_feedback_->BooleanAt("asserts");
+  if ((js_asserts == NULL) || (FLAG_enable_asserts != js_asserts->value())) {
+    THR_Print("JIT feedback contains invalid FLAG_enable_asserts\n");
+    jit_feedback_ = NULL;
+    return;
+  }
+  ParsedJSONBoolean* js_typechecks = jit_feedback_->BooleanAt("typeChecks");
+  if ((js_typechecks == NULL) ||
+      (FLAG_enable_type_checks != js_typechecks->value())) {
+    THR_Print("JIT feedback contains invalid FLAG_enable_type_checks\n");
+    jit_feedback_ = NULL;
+    return;
+  }
+
+  ParsedJSONArray* js_scripts = jit_feedback_->ArrayAt("scripts");
+  ASSERT(js_scripts != NULL);
+  Script& script = Script::Handle(Z);
+  for (intptr_t i = 0; i < js_scripts->Length(); i++) {
+    ParsedJSONObject* js_script = js_scripts->ObjectAt(i);
+    ASSERT(js_script != NULL);
+    ParsedJSONString* js_uri = js_script->StringAt("uri");
+    ASSERT(js_uri != NULL);
+    ParsedJSONNumber* js_fp = js_script->NumberAt("checksum");
+    ASSERT(js_fp != NULL);
+    script = LookupScript(js_uri->value());
+    if (script.IsNull()) {
+      THR_Print("Cannot find script %s\n", js_uri->value());
+      continue;
+    }
+    intptr_t fp = script.SourceFingerprint();
+    if (fp != js_fp->value()) {
+      THR_Print(
+          "Fingerprint has changed for %s. Continuing without JIT "
+          "feedback.\n",
+          js_uri->value());
+      jit_feedback_ = NULL;
+      return;
+    }
+  }
+
+  ParsedJSONArray* js_classes = jit_feedback_->ArrayAt("classes");
+  ASSERT(js_classes != NULL);
+  Library& lib = Library::Handle(Z);
+  Class& cls = Class::Handle(Z);
+  String& str = String::Handle(Z);
+  for (intptr_t i = 0; i < js_classes->Length(); i++) {
+    ParsedJSONObject* js_class = js_classes->ObjectAt(i);
+    ASSERT(js_class != NULL);
+    ParsedJSONString* js_uri = js_class->StringAt("uri");
+    ASSERT(js_uri != NULL);
+    ParsedJSONString* js_name = js_class->StringAt("name");
+    ASSERT(js_name != NULL);
+    ParsedJSONNumber* js_cid = js_class->NumberAt("cid");
+    ASSERT(js_cid != NULL);
+
+    str = String::New(js_uri->value());
+    lib = Library::LookupLibrary(T, str);
+    if (lib.IsNull()) {
+      THR_Print("Cannot find library %s\n", js_uri->value());
+      continue;
+    }
+    str = String::New(js_name->value());
+    if (str.Equals(Symbols::TopLevel())) {
+      cls = lib.toplevel_class();
+    } else {
+      cls = lib.LookupClassAllowPrivate(str);
+    }
+    if (cls.IsNull()) {
+      THR_Print("Missing class %s\n", js_name->value());
+      continue;
+    }
+
+    feedback_cid_map_.Insert(IntptrPair(js_cid->value(), cls.id()));
+  }
+
+  ParsedJSONArray* js_functions = jit_feedback_->ArrayAt("functions");
+  ASSERT(js_functions != NULL);
+  for (intptr_t i = 0; i < js_functions->Length(); i++) {
+    ParsedJSONObject* js_function = js_functions->ObjectAt(i);
+    ASSERT(js_function != NULL);
+    ParsedJSONString* js_name = js_function->StringAt("name");
+    ASSERT(js_name != NULL);
+    ParsedJSONNumber* js_cid = js_function->NumberAt("class");
+    ASSERT(js_cid != NULL);
+    ParsedJSONNumber* js_token = js_function->NumberAt("tokenPos");
+    ASSERT(js_token != NULL);
+    ParsedJSONNumber* js_kind = js_function->NumberAt("kind");
+    ASSERT(js_kind != NULL);
+    function_feedback_map_.Insert(FunctionFeedbackPair(
+        FunctionFeedbackKey(MapCid(js_cid->value()), js_token->value(),
+                            js_kind->value()),
+        js_function));
+  }
+
+  class ApplyUsageVisitor : public FunctionVisitor {
+   public:
+    explicit ApplyUsageVisitor(Precompiler* precompiler)
+        : precompiler_(precompiler) {}
+    void Visit(const Function& function) {
+      ParsedJSONObject* js_function = precompiler_->LookupFeedback(function);
+      if (js_function == NULL) {
+        function.set_usage_counter(0);
+      } else {
+        ParsedJSONNumber* js_usage = js_function->NumberAt("usageCounter");
+        ASSERT(js_usage != NULL);
+        function.set_usage_counter(js_usage->value());
+      }
+    }
+
+   private:
+    Precompiler* precompiler_;
+  };
+
+  ApplyUsageVisitor visitor(this);
+  ProgramVisitor::VisitFunctions(&visitor);
+}
+
+
+ParsedJSONObject* Precompiler::LookupFeedback(const Function& function) {
+  const Class& owner = Class::Handle(Z, function.Owner());
+
+  FunctionFeedbackKey key(owner.id(), function.token_pos().value(),
+                          function.kind());
+  FunctionFeedbackPair* pair = function_feedback_map_.Lookup(key);
+  if (pair == NULL) {
+    return NULL;
+  }
+  return pair->value_;
+}
+
+
+RawScript* Precompiler::LookupScript(const char* uri) {
+  String& dart_uri = String::Handle(Z, String::New(uri));
+  Library& lib = Library::Handle(Z);
+  Script& script = Script::Handle(Z);
+  for (intptr_t i = 0; i < libraries_.Length(); i++) {
+    lib ^= libraries_.At(i);
+    script = lib.LookupScript(dart_uri);
+    if (!script.IsNull()) {
+      return script.raw();
+    }
+  }
+  return Script::null();
+}
+
+
+intptr_t Precompiler::MapCid(intptr_t feedback_cid) {
+  if (feedback_cid < kNumPredefinedCids) {
+    return feedback_cid;
+  }
+  IntptrPair* pair = feedback_cid_map_.Lookup(feedback_cid);
+  if (pair == NULL) return kIllegalCid;
+  return pair->value_;
+}
+
+
+void Precompiler::PopulateWithICData(const Function& function,
+                                     FlowGraph* graph) {
+  Zone* zone = Thread::Current()->zone();
+
+  for (BlockIterator block_it = graph->reverse_postorder_iterator();
+       !block_it.Done(); block_it.Advance()) {
+    ForwardInstructionIterator it(block_it.Current());
+    for (; !it.Done(); it.Advance()) {
+      Instruction* instr = it.Current();
+      if (instr->IsInstanceCall()) {
+        InstanceCallInstr* call = instr->AsInstanceCall();
+        if (!call->HasICData()) {
+          const Array& arguments_descriptor = Array::Handle(
+              zone, ArgumentsDescriptor::New(call->ArgumentCount(),
+                                             call->argument_names()));
+          const ICData& ic_data = ICData::ZoneHandle(
+              zone, ICData::New(function, call->function_name(),
+                                arguments_descriptor, call->deopt_id(),
+                                call->checked_argument_count(), false));
+          call->set_ic_data(&ic_data);
+        }
+      } else if (instr->IsStaticCall()) {
+        StaticCallInstr* call = instr->AsStaticCall();
+        if (!call->HasICData()) {
+          const Array& arguments_descriptor = Array::Handle(
+              zone, ArgumentsDescriptor::New(call->ArgumentCount(),
+                                             call->argument_names()));
+          const Function& target = call->function();
+          MethodRecognizer::Kind recognized_kind =
+              MethodRecognizer::RecognizeKind(target);
+          int num_args_checked = 0;
+          switch (recognized_kind) {
+            case MethodRecognizer::kDoubleFromInteger:
+            case MethodRecognizer::kMathMin:
+            case MethodRecognizer::kMathMax:
+              num_args_checked = 2;
+              break;
+            default:
+              break;
+          }
+          const ICData& ic_data = ICData::ZoneHandle(
+              zone, ICData::New(function, String::Handle(zone, target.name()),
+                                arguments_descriptor, call->deopt_id(),
+                                num_args_checked, true));
+          ic_data.AddTarget(target);
+          call->set_ic_data(&ic_data);
+        }
+      }
+    }
+  }
+}
+
+
+void Precompiler::TryApplyFeedback(const Function& function, FlowGraph* graph) {
+  ParsedJSONObject* js_function = LookupFeedback(function);
+  if (js_function == NULL) {
+    if (FLAG_trace_precompiler) {
+      THR_Print("No feedback available for %s\n",
+                function.ToQualifiedCString());
+    }
+    return;
+  }
+
+  ParsedJSONArray* js_icdatas = js_function->ArrayAt("ics");
+  ASSERT(js_icdatas != NULL);
+
+  for (BlockIterator block_it = graph->reverse_postorder_iterator();
+       !block_it.Done(); block_it.Advance()) {
+    ForwardInstructionIterator it(block_it.Current());
+    for (; !it.Done(); it.Advance()) {
+      Instruction* instr = it.Current();
+      if (instr->IsInstanceCall()) {
+        InstanceCallInstr* call = instr->AsInstanceCall();
+        TryApplyFeedback(js_icdatas, *call->ic_data());
+      } else if (instr->IsStaticCall()) {
+        StaticCallInstr* call = instr->AsStaticCall();
+        TryApplyFeedback(js_icdatas, *call->ic_data());
+      }
+    }
+  }
+}
+
+
+void Precompiler::TryApplyFeedback(ParsedJSONArray* js_icdatas,
+                                   const ICData& ic) {
+  for (intptr_t j = 0; j < js_icdatas->Length(); j++) {
+    ParsedJSONObject* js_icdata = js_icdatas->ObjectAt(j);
+    ASSERT(js_icdata != NULL);
+
+    ParsedJSONNumber* js_deoptid = js_icdata->NumberAt("deoptId");
+    ASSERT(js_deoptid != NULL);
+    if (js_deoptid->value() != ic.deopt_id()) continue;
+
+    ParsedJSONBoolean* js_isstaticcall = js_icdata->BooleanAt("isStaticCall");
+    ASSERT(js_isstaticcall != NULL);
+    if (js_isstaticcall->value() != ic.is_static_call()) return;
+
+    ParsedJSONNumber* js_argsTested = js_icdata->NumberAt("argsTested");
+    ASSERT(js_argsTested != NULL);
+    if (js_argsTested->value() != ic.NumArgsTested()) return;
+
+    ParsedJSONString* js_selector = js_icdata->StringAt("selector");
+    ASSERT(js_selector != NULL);
+    const String& feedback_selector =
+        String::Handle(String::New(js_selector->value()));
+    const String& selector = String::Handle(ic.target_name());
+    // N.B.: EqualsIgnoringPrivateKey is not symmetric.
+    if (!String::EqualsIgnoringPrivateKey(selector, feedback_selector)) return;
+
+    ParsedJSONArray* js_entries = js_icdata->ArrayAt("entries");
+    ASSERT(js_entries != NULL);
+    if (ic.is_static_call()) {
+      // [cid [cid]] target count
+      ParsedJSONNumber* entry = js_entries->NumberAt(js_entries->Length() - 1);
+      ASSERT(entry != NULL);
+      ic.SetCountAt(0, entry->value());
+    } else {
+      // [cid [cid [cid]]] target count
+      const Array& arguments_descriptor =
+          Array::Handle(ic.arguments_descriptor());
+      ArgumentsDescriptor args_desc(arguments_descriptor);
+
+      intptr_t num_args_checked = ic.NumArgsTested();
+      for (intptr_t k = 0; k < js_entries->Length();
+           k += num_args_checked + 1) {
+        GrowableArray<intptr_t> class_ids(num_args_checked);
+        for (intptr_t arg = 0; arg < num_args_checked; arg++) {
+          ParsedJSONNumber* entry = js_entries->NumberAt(k + arg);
+          ASSERT(entry != NULL);
+          class_ids.Add(MapCid(entry->value()));
+        }
+        ParsedJSONNumber* entry = js_entries->NumberAt(k + num_args_checked);
+        ASSERT(entry != NULL);
+        intptr_t count = entry->value();
+
+        bool has_missing_cid = false;
+        for (intptr_t arg = 0; arg < num_args_checked; arg++) {
+          if (class_ids[arg] == kIllegalCid) {
+            has_missing_cid = true;
+          }
+        }
+        if (has_missing_cid) continue;
+
+        intptr_t receiver_cid = class_ids[0];
+        const Class& receiver_cls =
+            Class::Handle(I->class_table()->At(receiver_cid));
+        if (receiver_cls.IsClass()) {
+          const Function& target =
+              Function::Handle(Resolver::ResolveDynamicForReceiverClass(
+                  receiver_cls, selector, args_desc, false));
+          // TODO(rmacnak): Create missing dispatchers.
+          if (!target.IsNull()) {
+            if (num_args_checked == 1) {
+              ic.AddReceiverCheck(receiver_cid, target, count);
+            } else {
+              ic.AddCheck(class_ids, target, count);
+            }
+          }
+        }
+      }
+    }
+
+    return;
+  }
+}
+
+
 void Precompiler::ResetPrecompilerState() {
   changed_ = false;
   function_count_ = 0;
@@ -2613,6 +3070,13 @@
   sent_selectors_.Clear();
   enqueued_functions_.Clear();
 
+  classes_to_retain_.Clear();
+  consts_to_retain_.Clear();
+  fields_to_retain_.Clear();
+  functions_to_retain_.Clear();
+  typeargs_to_retain_.Clear();
+  types_to_retain_.Clear();
+
   Library& lib = Library::Handle(Z);
   Class& cls = Class::Handle(Z);
 
@@ -2675,7 +3139,7 @@
   graph_compiler->FinalizePcDescriptors(code);
   code.set_deopt_info_array(deopt_info_array);
 
-  graph_compiler->FinalizeStackmaps(code);
+  graph_compiler->FinalizeStackMaps(code);
   graph_compiler->FinalizeVarDescriptors(code);
   graph_compiler->FinalizeExceptionHandlers(code);
   graph_compiler->FinalizeStaticCallTargetsTable(code);
@@ -2751,6 +3215,15 @@
             zone, parsed_function(), *ic_data_array, Compiler::kNoOSRDeoptId);
       }
 
+      if (optimized()) {
+        Precompiler::PopulateWithICData(parsed_function()->function(),
+                                        flow_graph);
+        if (precompiler_ != NULL) {
+          precompiler_->TryApplyFeedback(parsed_function()->function(),
+                                         flow_graph);
+        }
+      }
+
       const bool print_flow_graph =
           (FLAG_print_flow_graph ||
            (optimized() && FLAG_print_flow_graph_optimized)) &&
@@ -2801,7 +3274,6 @@
 
         AotOptimizer optimizer(precompiler_, flow_graph,
                                use_speculative_inlining, &inlining_black_list);
-        optimizer.PopulateWithICData();
 
         optimizer.ApplyClassIds();
         DEBUG_ASSERT(flow_graph->VerifyUseLists());
@@ -3135,8 +3607,6 @@
         ASSERT(thread()->IsMutatorThread());
         FinalizeCompilation(&assembler, &graph_compiler, flow_graph);
       }
-      // Mark that this isolate now has compiled code.
-      isolate()->set_has_compiled_code(true);
       // Exit the loop and the function with the correct result value.
       is_compiled = true;
       done = true;
diff --git a/runtime/vm/precompiler.h b/runtime/vm/precompiler.h
index 2566a78..6f504f1 100644
--- a/runtime/vm/precompiler.h
+++ b/runtime/vm/precompiler.h
@@ -21,28 +21,15 @@
 class RawError;
 class SequenceNode;
 class String;
+class ParsedJSONObject;
+class ParsedJSONArray;
+class Precompiler;
+class FlowGraph;
 
-
-class TypeRangeCache : public StackResource {
+class TypeRangeCache : public ValueObject {
  public:
-  TypeRangeCache(Thread* thread, intptr_t num_cids)
-      : StackResource(thread),
-        thread_(thread),
-        lower_limits_(thread->zone()->Alloc<intptr_t>(num_cids)),
-        upper_limits_(thread->zone()->Alloc<intptr_t>(num_cids)) {
-    for (intptr_t i = 0; i < num_cids; i++) {
-      lower_limits_[i] = kNotComputed;
-      upper_limits_[i] = kNotComputed;
-    }
-    // We don't re-enter the precompiler.
-    ASSERT(thread->type_range_cache() == NULL);
-    thread->set_type_range_cache(this);
-  }
-
-  ~TypeRangeCache() {
-    ASSERT(thread_->type_range_cache() == this);
-    thread_->set_type_range_cache(NULL);
-  }
+  TypeRangeCache(Precompiler* precompiler, Thread* thread, intptr_t num_cids);
+  ~TypeRangeCache();
 
   bool InstanceOfHasClassRange(const AbstractType& type,
                                intptr_t* lower_limit,
@@ -52,6 +39,7 @@
   static const intptr_t kNotComputed = -1;
   static const intptr_t kNotContiguous = -2;
 
+  Precompiler* precompiler_;
   Thread* thread_;
   intptr_t* lower_limits_;
   intptr_t* upper_limits_;
@@ -78,12 +66,12 @@
 
 typedef DirectChainedHashMap<SymbolKeyValueTrait> SymbolSet;
 
-class StackmapKeyValueTrait {
+class StackMapKeyValueTrait {
  public:
   // Typedefs needed for the DirectChainedHashMap template.
-  typedef const Stackmap* Key;
-  typedef const Stackmap* Value;
-  typedef const Stackmap* Pair;
+  typedef const StackMap* Key;
+  typedef const StackMap* Value;
+  typedef const StackMap* Pair;
 
   static Key KeyOf(Pair kv) { return kv; }
 
@@ -96,7 +84,7 @@
   }
 };
 
-typedef DirectChainedHashMap<StackmapKeyValueTrait> StackmapSet;
+typedef DirectChainedHashMap<StackMapKeyValueTrait> StackMapSet;
 
 
 class ArrayKeyValueTrait {
@@ -328,11 +316,78 @@
 typedef DirectChainedHashMap<FieldTypePair> FieldTypeMap;
 
 
+struct IntptrPair {
+  // Typedefs needed for the DirectChainedHashMap template.
+  typedef intptr_t Key;
+  typedef intptr_t Value;
+  typedef IntptrPair Pair;
+
+  static Key KeyOf(Pair kv) { return kv.key_; }
+
+  static Value ValueOf(Pair kv) { return kv.value_; }
+
+  static inline intptr_t Hashcode(Key key) { return key; }
+
+  static inline bool IsKeyEqual(Pair pair, Key key) { return pair.key_ == key; }
+
+  IntptrPair(intptr_t key, intptr_t value) : key_(key), value_(value) {}
+
+  IntptrPair() : key_(kIllegalCid), value_(kIllegalCid) {}
+
+  Key key_;
+  Value value_;
+};
+
+typedef DirectChainedHashMap<IntptrPair> CidMap;
+
+
+struct FunctionFeedbackKey {
+  FunctionFeedbackKey() : owner_cid_(kIllegalCid), token_(0), kind_(0) {}
+  FunctionFeedbackKey(intptr_t owner_cid, intptr_t token, intptr_t kind)
+      : owner_cid_(owner_cid), token_(token), kind_(kind) {}
+
+  intptr_t owner_cid_;
+  intptr_t token_;
+  intptr_t kind_;
+};
+
+
+struct FunctionFeedbackPair {
+  // Typedefs needed for the DirectChainedHashMap template.
+  typedef FunctionFeedbackKey Key;
+  typedef ParsedJSONObject* Value;
+  typedef FunctionFeedbackPair Pair;
+
+  static Key KeyOf(Pair kv) { return kv.key_; }
+
+  static Value ValueOf(Pair kv) { return kv.value_; }
+
+  static inline intptr_t Hashcode(Key key) {
+    return key.token_ ^ key.owner_cid_ ^ key.kind_;
+  }
+
+  static inline bool IsKeyEqual(Pair pair, Key key) {
+    return (pair.key_.owner_cid_ == key.owner_cid_) &&
+           (pair.key_.token_ == key.token_) && (pair.key_.kind_ == key.kind_);
+  }
+
+  FunctionFeedbackPair(Key key, Value value) : key_(key), value_(value) {}
+
+  FunctionFeedbackPair() : key_(), value_(NULL) {}
+
+  Key key_;
+  Value value_;
+};
+
+typedef DirectChainedHashMap<FunctionFeedbackPair> FunctionFeedbackMap;
+
+
 class Precompiler : public ValueObject {
  public:
   static RawError* CompileAll(
       Dart_QualifiedFunctionName embedder_entry_points[],
-      bool reset_fields);
+      uint8_t* jit_feedback,
+      intptr_t jit_feedback_length);
 
   static RawError* CompileFunction(Precompiler* precompiler,
                                    Thread* thread,
@@ -352,9 +407,21 @@
   }
 
   FieldTypeMap* field_type_map() { return &field_type_map_; }
+  TypeRangeCache* type_range_cache() { return type_range_cache_; }
+  void set_type_range_cache(TypeRangeCache* value) {
+    type_range_cache_ = value;
+  }
+
+  bool HasFeedback() const { return jit_feedback_ != NULL; }
+  static void PopulateWithICData(const Function& func, FlowGraph* graph);
+  void TryApplyFeedback(const Function& func, FlowGraph* graph);
+  void TryApplyFeedback(ParsedJSONArray* js_icdatas, const ICData& ic);
 
  private:
-  Precompiler(Thread* thread, bool reset_fields);
+  explicit Precompiler(Thread* thread);
+
+  void LoadFeedback(uint8_t* jit_feedback, intptr_t jit_feedback_length);
+  ParsedJSONObject* LookupFeedback(const Function& function);
 
   void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]);
   void ClearAllCode();
@@ -368,7 +435,7 @@
   void AddTypeArguments(const TypeArguments& args);
   void AddCalleesOf(const Function& function);
   void AddConstObject(const Instance& instance);
-  void AddClosureCall(const ICData& call_site);
+  void AddClosureCall(const Array& arguments_descriptor);
   void AddField(const Field& field);
   void AddFunction(const Function& function);
   void AddInstantiatedClass(const Class& cls);
@@ -393,7 +460,7 @@
   void BindStaticCalls();
   void SwitchICCalls();
   void ShareMegamorphicBuckets();
-  void DedupStackmaps();
+  void DedupStackMaps();
   void DedupLists();
   void DedupInstructions();
   void ResetPrecompilerState();
@@ -403,21 +470,13 @@
   void PrecompileStaticInitializers();
   void PrecompileConstructors();
 
-  template <typename T>
-  class Visitor : public ValueObject {
-   public:
-    virtual ~Visitor() {}
-    virtual void Visit(const T& obj) = 0;
-  };
-  typedef Visitor<Function> FunctionVisitor;
-  typedef Visitor<Class> ClassVisitor;
-
-  void VisitFunctions(FunctionVisitor* visitor);
-  void VisitClasses(ClassVisitor* visitor);
-
   void FinalizeAllClasses();
   void SortClasses();
   void RemapClassIds(intptr_t* old_to_new_cid);
+  void RehashTypes();
+  void VerifyJITFeedback();
+  RawScript* LookupScript(const char* uri);
+  intptr_t MapCid(intptr_t feedback_cid);
 
   Thread* thread() const { return thread_; }
   Zone* zone() const { return zone_; }
@@ -427,7 +486,7 @@
   Zone* zone_;
   Isolate* isolate_;
 
-  const bool reset_fields_;
+  ParsedJSONObject* jit_feedback_;
 
   bool changed_;
   intptr_t function_count_;
@@ -451,6 +510,9 @@
   AbstractTypeSet types_to_retain_;
   InstanceSet consts_to_retain_;
   FieldTypeMap field_type_map_;
+  TypeRangeCache* type_range_cache_;
+  CidMap feedback_cid_map_;
+  FunctionFeedbackMap function_feedback_map_;
   Error& error_;
 
   bool get_runtime_type_is_unique_;
diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc
index a150c30..8e3af78 100644
--- a/runtime/vm/profiler_test.cc
+++ b/runtime/vm/profiler_test.cc
@@ -775,7 +775,7 @@
     EXPECT(walker.Down());
     EXPECT_STREQ("_List._List", walker.CurrentName());
     EXPECT(walker.Down());
-    EXPECT_STREQ("List.List", walker.CurrentName());
+    EXPECT_STREQ("List.List._internal", walker.CurrentName());
     EXPECT(walker.Down());
     EXPECT_STREQ("foo", walker.CurrentName());
     EXPECT(!walker.Down());
@@ -829,7 +829,7 @@
     EXPECT(walker.Down());
     EXPECT_STREQ("_GrowableList._GrowableList", walker.CurrentName());
     EXPECT(walker.Down());
-    EXPECT_STREQ("List.List", walker.CurrentName());
+    EXPECT_STREQ("List.List._internal", walker.CurrentName());
     EXPECT(walker.Down());
     EXPECT_STREQ("bar", walker.CurrentName());
     EXPECT(!walker.Down());
@@ -994,7 +994,7 @@
       Library::Handle(isolate->object_store()->typed_data_library());
 
   const Class& float32_list_class =
-      Class::Handle(GetClass(typed_data_library, "Float32List"));
+      Class::Handle(GetClass(typed_data_library, "_Float32List"));
   EXPECT(!float32_list_class.IsNull());
 
   Dart_Handle result = Dart_Invoke(lib, NewString("foo"), 0, NULL);
diff --git a/runtime/vm/program_visitor.cc b/runtime/vm/program_visitor.cc
new file mode 100644
index 0000000..4a41925
--- /dev/null
+++ b/runtime/vm/program_visitor.cc
@@ -0,0 +1,95 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "vm/program_visitor.h"
+
+#include "vm/object.h"
+#include "vm/object_store.h"
+
+namespace dart {
+
+void ProgramVisitor::VisitClasses(ClassVisitor* visitor) {
+  Thread* thread = Thread::Current();
+  Isolate* isolate = thread->isolate();
+  Zone* zone = thread->zone();
+  GrowableObjectArray& libraries =
+      GrowableObjectArray::Handle(zone, isolate->object_store()->libraries());
+  Library& lib = Library::Handle(zone);
+  Class& cls = Class::Handle(zone);
+
+  for (intptr_t i = 0; i < libraries.Length(); i++) {
+    lib ^= libraries.At(i);
+    ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
+    while (it.HasNext()) {
+      cls = it.GetNextClass();
+      if (cls.IsDynamicClass()) {
+        continue;  // class 'dynamic' is in the read-only VM isolate.
+      }
+      visitor->Visit(cls);
+    }
+  }
+}
+
+
+void ProgramVisitor::VisitFunctions(FunctionVisitor* visitor) {
+  Thread* thread = Thread::Current();
+  Isolate* isolate = thread->isolate();
+  Zone* zone = thread->zone();
+  GrowableObjectArray& libraries =
+      GrowableObjectArray::Handle(zone, isolate->object_store()->libraries());
+  Library& lib = Library::Handle(zone);
+  Class& cls = Class::Handle(zone);
+  Array& functions = Array::Handle(zone);
+  Array& fields = Array::Handle(zone);
+  Field& field = Field::Handle(zone);
+  Object& object = Object::Handle(zone);
+  Function& function = Function::Handle(zone);
+  GrowableObjectArray& closures = GrowableObjectArray::Handle(zone);
+
+  for (intptr_t i = 0; i < libraries.Length(); i++) {
+    lib ^= libraries.At(i);
+    ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
+    while (it.HasNext()) {
+      cls = it.GetNextClass();
+      if (cls.IsDynamicClass()) {
+        continue;  // class 'dynamic' is in the read-only VM isolate.
+      }
+
+      functions = cls.functions();
+      for (intptr_t j = 0; j < functions.Length(); j++) {
+        function ^= functions.At(j);
+        visitor->Visit(function);
+        if (function.HasImplicitClosureFunction()) {
+          function = function.ImplicitClosureFunction();
+          visitor->Visit(function);
+        }
+      }
+
+      functions = cls.invocation_dispatcher_cache();
+      for (intptr_t j = 0; j < functions.Length(); j++) {
+        object = functions.At(j);
+        if (object.IsFunction()) {
+          function ^= functions.At(j);
+          visitor->Visit(function);
+        }
+      }
+      fields = cls.fields();
+      for (intptr_t j = 0; j < fields.Length(); j++) {
+        field ^= fields.At(j);
+        if (field.is_static() && field.HasPrecompiledInitializer()) {
+          function ^= field.PrecompiledInitializer();
+          visitor->Visit(function);
+        }
+      }
+    }
+  }
+  closures = isolate->object_store()->closure_functions();
+  for (intptr_t j = 0; j < closures.Length(); j++) {
+    function ^= closures.At(j);
+    visitor->Visit(function);
+    ASSERT(!function.HasImplicitClosureFunction());
+  }
+}
+
+}  // namespace dart
diff --git a/runtime/vm/program_visitor.h b/runtime/vm/program_visitor.h
new file mode 100644
index 0000000..5ac8130
--- /dev/null
+++ b/runtime/vm/program_visitor.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef RUNTIME_VM_PROGRAM_VISITOR_H_
+#define RUNTIME_VM_PROGRAM_VISITOR_H_
+
+#include "vm/allocation.h"
+
+namespace dart {
+
+class Function;
+class Class;
+
+template <typename T>
+class Visitor : public ValueObject {
+ public:
+  virtual ~Visitor() {}
+  virtual void Visit(const T& obj) = 0;
+};
+
+typedef Visitor<Function> FunctionVisitor;
+typedef Visitor<Class> ClassVisitor;
+
+class ProgramVisitor : public AllStatic {
+ public:
+  static void VisitFunctions(FunctionVisitor* visitor);
+  static void VisitClasses(ClassVisitor* visitor);
+};
+
+}  // namespace dart
+
+#endif  // RUNTIME_VM_PROGRAM_VISITOR_H_
diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc
index bfe850a..f4a1bc1 100644
--- a/runtime/vm/raw_object.cc
+++ b/runtime/vm/raw_object.cc
@@ -145,10 +145,10 @@
       instance_size = CodeSourceMap::InstanceSize(length);
       break;
     }
-    case kStackmapCid: {
-      const RawStackmap* map = reinterpret_cast<const RawStackmap*>(this);
+    case kStackMapCid: {
+      const RawStackMap* map = reinterpret_cast<const RawStackMap*>(this);
       intptr_t length = map->ptr()->length_;
-      instance_size = Stackmap::InstanceSize(length);
+      instance_size = StackMap::InstanceSize(length);
       break;
     }
     case kLocalVarDescriptorsCid: {
@@ -393,6 +393,14 @@
 }
 
 
+intptr_t RawSignatureData::VisitSignatureDataPointers(
+    RawSignatureData* raw_obj,
+    ObjectPointerVisitor* visitor) {
+  visitor->VisitPointers(raw_obj->from(), raw_obj->to());
+  return SignatureData::InstanceSize();
+}
+
+
 intptr_t RawRedirectionData::VisitRedirectionDataPointers(
     RawRedirectionData* raw_obj,
     ObjectPointerVisitor* visitor) {
@@ -607,9 +615,9 @@
 }
 
 
-intptr_t RawStackmap::VisitStackmapPointers(RawStackmap* raw_obj,
+intptr_t RawStackMap::VisitStackMapPointers(RawStackMap* raw_obj,
                                             ObjectPointerVisitor* visitor) {
-  return Stackmap::InstanceSize(raw_obj->ptr()->length_);
+  return StackMap::InstanceSize(raw_obj->ptr()->length_);
 }
 
 
@@ -955,12 +963,12 @@
 }
 
 
-intptr_t RawStacktrace::VisitStacktracePointers(RawStacktrace* raw_obj,
+intptr_t RawStackTrace::VisitStackTracePointers(RawStackTrace* raw_obj,
                                                 ObjectPointerVisitor* visitor) {
   // Make sure that we got here with the tagged pointer as this.
   ASSERT(raw_obj->IsHeapObject());
   visitor->VisitPointers(raw_obj->from(), raw_obj->to());
-  return Stacktrace::InstanceSize();
+  return StackTrace::InstanceSize();
 }
 
 
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 253c304..b694518 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -22,6 +22,7 @@
   V(PatchClass)                                                                \
   V(Function)                                                                  \
   V(ClosureData)                                                               \
+  V(SignatureData)                                                             \
   V(RedirectionData)                                                           \
   V(Field)                                                                     \
   V(LiteralToken)                                                              \
@@ -34,7 +35,7 @@
   V(ObjectPool)                                                                \
   V(PcDescriptors)                                                             \
   V(CodeSourceMap)                                                             \
-  V(Stackmap)                                                                  \
+  V(StackMap)                                                                  \
   V(LocalVarDescriptors)                                                       \
   V(ExceptionHandlers)                                                         \
   V(Context)                                                                   \
@@ -74,7 +75,7 @@
   V(Capability)                                                                \
   V(ReceivePort)                                                               \
   V(SendPort)                                                                  \
-  V(Stacktrace)                                                                \
+  V(StackTrace)                                                                \
   V(RegExp)                                                                    \
   V(WeakProperty)                                                              \
   V(MirrorReference)                                                           \
@@ -608,8 +609,9 @@
   friend class RetainingPathVisitor;       // GetClassId
   friend class SkippedCodeFunctions;       // StorePointer
   friend class InstructionsReader;         // tags_ check
-  friend class AssemblyInstructionsWriter;
-  friend class BlobInstructionsWriter;
+  friend class ImageWriter;
+  friend class AssemblyImageWriter;
+  friend class BlobImageWriter;
   friend class SnapshotReader;
   friend class Deserializer;
   friend class SnapshotWriter;
@@ -673,8 +675,8 @@
     switch (kind) {
       case Snapshot::kCore:
       case Snapshot::kScript:
-      case Snapshot::kAppWithJIT:
-      case Snapshot::kAppNoJIT:
+      case Snapshot::kAppJIT:
+      case Snapshot::kAppAOT:
         return reinterpret_cast<RawObject**>(&ptr()->direct_subclasses_);
       case Snapshot::kMessage:
       case Snapshot::kNone:
@@ -701,6 +703,7 @@
   friend class Object;
   friend class RawInstance;
   friend class RawInstructions;
+  friend class RawTypeArguments;
   friend class SnapshotReader;
   friend class InstanceSerializationCluster;
   friend class CidRewriteVisitor;
@@ -861,7 +864,28 @@
   RawFunction* parent_function_;  // Enclosing function of this local function.
   RawType* signature_type_;
   RawInstance* closure_;  // Closure object for static implicit closures.
-  RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->closure_); }
+  RawObject** to_snapshot() {
+    return reinterpret_cast<RawObject**>(&ptr()->closure_);
+  }
+  RawObject* hash_;
+  RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); }
+
+  friend class Function;
+};
+
+
+class RawSignatureData : public RawObject {
+ private:
+  RAW_HEAP_OBJECT_IMPLEMENTATION(SignatureData);
+
+  RawObject** from() {
+    return reinterpret_cast<RawObject**>(&ptr()->parent_function_);
+  }
+  RawFunction* parent_function_;  // Enclosing function of this sig. function.
+  RawType* signature_type_;
+  RawObject** to() {
+    return reinterpret_cast<RawObject**>(&ptr()->signature_type_);
+  }
 
   friend class Function;
 };
@@ -910,9 +934,9 @@
       case Snapshot::kCore:
       case Snapshot::kScript:
         return reinterpret_cast<RawObject**>(&ptr()->guarded_list_length_);
-      case Snapshot::kAppWithJIT:
+      case Snapshot::kAppJIT:
         return reinterpret_cast<RawObject**>(&ptr()->dependent_code_);
-      case Snapshot::kAppNoJIT:
+      case Snapshot::kAppAOT:
         return reinterpret_cast<RawObject**>(&ptr()->initializer_);
       case Snapshot::kMessage:
       case Snapshot::kNone:
@@ -991,10 +1015,10 @@
   RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->source_); }
   RawObject** to_snapshot(Snapshot::Kind kind) {
     switch (kind) {
-      case Snapshot::kAppNoJIT:
+      case Snapshot::kAppAOT:
         return reinterpret_cast<RawObject**>(&ptr()->url_);
       case Snapshot::kCore:
-      case Snapshot::kAppWithJIT:
+      case Snapshot::kAppJIT:
       case Snapshot::kScript:
         return reinterpret_cast<RawObject**>(&ptr()->tokens_);
       case Snapshot::kMessage:
@@ -1190,7 +1214,7 @@
   friend class SkippedCodeFunctions;
   friend class Function;
   friend class InstructionsReader;
-  friend class InstructionsWriter;
+  friend class ImageWriter;
 };
 
 
@@ -1202,7 +1226,8 @@
     kUnoptStaticCall = kIcCall << 1,       // Call to a known target via stub.
     kRuntimeCall = kUnoptStaticCall << 1,  // Runtime call.
     kOsrEntry = kRuntimeCall << 1,         // OSR entry point in unopt. code.
-    kOther = kOsrEntry << 1,
+    kRewind = kOsrEntry << 1,              // Call rewind target address.
+    kOther = kRewind << 1,
     kLastKind = kOther,
     kAnyKind = -1
   };
@@ -1267,14 +1292,14 @@
 };
 
 
-// Stackmap is an immutable representation of the layout of the stack at a
+// StackMap is an immutable representation of the layout of the stack at a
 // PC. The stack map representation consists of a bit map which marks each
 // live object index starting from the base of the frame.
 //
 // The bit map representation is optimized for dense and small bit maps, without
 // any upper bound.
-class RawStackmap : public RawObject {
-  RAW_HEAP_OBJECT_IMPLEMENTATION(Stackmap);
+class RawStackMap : public RawObject {
+  RAW_HEAP_OBJECT_IMPLEMENTATION(StackMap);
 
   // Regarding changing this to a bitfield: ARM64 requires register_bit_count_
   // to be as large as 96, meaning 7 bits, leaving 25 bits for the length, or
@@ -1491,11 +1516,11 @@
   RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->owner_); }
   RawObject** to_snapshot(Snapshot::Kind kind) {
     switch (kind) {
-      case Snapshot::kAppNoJIT:
+      case Snapshot::kAppAOT:
         return reinterpret_cast<RawObject**>(&ptr()->args_descriptor_);
       case Snapshot::kCore:
       case Snapshot::kScript:
-      case Snapshot::kAppWithJIT:
+      case Snapshot::kAppJIT:
         return to();
       case Snapshot::kMessage:
       case Snapshot::kNone:
@@ -1615,9 +1640,9 @@
     switch (kind) {
       case Snapshot::kCore:
       case Snapshot::kScript:
-      case Snapshot::kAppWithJIT:
+      case Snapshot::kAppJIT:
         return reinterpret_cast<RawObject**>(&ptr()->imports_);
-      case Snapshot::kAppNoJIT:
+      case Snapshot::kAppAOT:
         return reinterpret_cast<RawObject**>(&ptr()->importer_);
       case Snapshot::kMessage:
       case Snapshot::kNone:
@@ -1678,6 +1703,7 @@
   int8_t type_state_;
 
   friend class CidRewriteVisitor;
+  friend class RawTypeArguments;
 };
 
 
@@ -1736,7 +1762,6 @@
     return reinterpret_cast<RawObject**>(&ptr()->super_type_);
   }
   RawAbstractType* super_type_;
-  RawSmi* hash_;
   RawArray* mixin_types_;  // Array of AbstractType.
   RawObject** to() {
     return reinterpret_cast<RawObject**>(&ptr()->mixin_types_);
@@ -2098,8 +2123,8 @@
 // Currently we don't have any interface that this object is supposed
 // to implement so we just support the 'toString' method which
 // converts the stack trace into a string.
-class RawStacktrace : public RawInstance {
-  RAW_HEAP_OBJECT_IMPLEMENTATION(Stacktrace);
+class RawStackTrace : public RawInstance {
+  RAW_HEAP_OBJECT_IMPLEMENTATION(StackTrace);
 
   RawObject** from() {
     return reinterpret_cast<RawObject**>(&ptr()->code_array_);
@@ -2377,7 +2402,7 @@
          RawObject::IsTypedDataClassId(index) || (index == kContextCid) ||
          (index == kTypeArgumentsCid) || (index == kInstructionsCid) ||
          (index == kObjectPoolCid) || (index == kPcDescriptorsCid) ||
-         (index == kCodeSourceMapCid) || (index == kStackmapCid) ||
+         (index == kCodeSourceMapCid) || (index == kStackMapCid) ||
          (index == kLocalVarDescriptorsCid) ||
          (index == kExceptionHandlersCid) || (index == kCodeCid) ||
          (index == kContextScopeCid) || (index == kInstanceCid) ||
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 2177722..95a71c1 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -504,7 +504,25 @@
   // Write out the individual types.
   intptr_t len = Smi::Value(ptr()->length_);
   for (intptr_t i = 0; i < len; i++) {
-    writer->WriteObjectImpl(ptr()->types()[i], kAsReference);
+    // The Dart VM reuses type argument lists across instances in order
+    // to reduce memory footprint, this can sometimes lead to a type from
+    // such a shared type argument list being sent over to another isolate.
+    // In such scenarios where it is not appropriate to send the types
+    // across (isolates spawned using spawnURI) we send them as dynamic.
+    if (!writer->can_send_any_object()) {
+      // Lookup the type class.
+      RawType* raw_type = Type::RawCast(ptr()->types()[i]);
+      RawSmi* raw_type_class_id = Smi::RawCast(raw_type->ptr()->type_class_id_);
+      RawClass* type_class =
+          writer->isolate()->class_table()->At(Smi::Value(raw_type_class_id));
+      if (!writer->AllowObjectsInDartLibrary(type_class->ptr()->library_)) {
+        writer->WriteVMIsolateObject(kDynamicType);
+      } else {
+        writer->WriteObjectImpl(ptr()->types()[i], kAsReference);
+      }
+    } else {
+      writer->WriteObjectImpl(ptr()->types()[i], kAsReference);
+    }
   }
 }
 
@@ -590,7 +608,8 @@
   reader->AddBackRef(object_id, &data, kIsDeserialized);
 
   // Set all the object fields.
-  READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(),
+  // Cached hash is null-initialized by ClosureData::New()
+  READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to_snapshot(),
                      kAsInlinedObject);
 
   return data.raw();
@@ -632,6 +651,47 @@
 }
 
 
+RawSignatureData* SignatureData::ReadFrom(SnapshotReader* reader,
+                                          intptr_t object_id,
+                                          intptr_t tags,
+                                          Snapshot::Kind kind,
+                                          bool as_reference) {
+  ASSERT(reader != NULL);
+  ASSERT(kind == Snapshot::kScript);
+
+  // Allocate signature data object.
+  SignatureData& data =
+      SignatureData::ZoneHandle(reader->zone(), SignatureData::New());
+  reader->AddBackRef(object_id, &data, kIsDeserialized);
+
+  // Set all the object fields.
+  READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(),
+                     kAsInlinedObject);
+
+  return data.raw();
+}
+
+
+void RawSignatureData::WriteTo(SnapshotWriter* writer,
+                               intptr_t object_id,
+                               Snapshot::Kind kind,
+                               bool as_reference) {
+  ASSERT(writer != NULL);
+  ASSERT(kind == Snapshot::kScript);
+
+  // Write out the serialization header value for this object.
+  writer->WriteInlinedObjectHeader(object_id);
+
+  // Write out the class and tags information.
+  writer->WriteVMIsolateObject(kSignatureDataCid);
+  writer->WriteTags(writer->GetObjectTags(this));
+
+  // Write out all the object pointer fields.
+  SnapshotWriterVisitor visitor(writer, kAsInlinedObject);
+  visitor.VisitPointers(from(), to());
+}
+
+
 RawRedirectionData* RedirectionData::ReadFrom(SnapshotReader* reader,
                                               intptr_t object_id,
                                               intptr_t tags,
@@ -1336,17 +1396,17 @@
 }
 
 
-RawStackmap* Stackmap::ReadFrom(SnapshotReader* reader,
+RawStackMap* StackMap::ReadFrom(SnapshotReader* reader,
                                 intptr_t object_id,
                                 intptr_t tags,
                                 Snapshot::Kind kind,
                                 bool as_reference) {
   UNREACHABLE();
-  return Stackmap::null();
+  return StackMap::null();
 }
 
 
-void RawStackmap::WriteTo(SnapshotWriter* writer,
+void RawStackMap::WriteTo(SnapshotWriter* writer,
                           intptr_t object_id,
                           Snapshot::Kind kind,
                           bool as_reference) {
@@ -2853,17 +2913,17 @@
 }
 
 
-RawStacktrace* Stacktrace::ReadFrom(SnapshotReader* reader,
+RawStackTrace* StackTrace::ReadFrom(SnapshotReader* reader,
                                     intptr_t object_id,
                                     intptr_t tags,
                                     Snapshot::Kind kind,
                                     bool as_reference) {
-  UNREACHABLE();  // Stacktraces are not sent in a snapshot.
-  return Stacktrace::null();
+  UNREACHABLE();  // StackTraces are not sent in a snapshot.
+  return StackTrace::null();
 }
 
 
-void RawStacktrace::WriteTo(SnapshotWriter* writer,
+void RawStackTrace::WriteTo(SnapshotWriter* writer,
                             intptr_t object_id,
                             Snapshot::Kind kind,
                             bool as_reference) {
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index b0cd46e..860f048 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -14,7 +14,7 @@
 void VerifyOnTransition() {
   Thread* thread = Thread::Current();
   TransitionGeneratedToVM transition(thread);
-  thread->isolate()->heap()->WaitForSweeperTasks();
+  thread->isolate()->heap()->WaitForSweeperTasks(thread);
   SafepointOperationScope safepoint_scope(thread);
   VerifyPointersVisitor::VerifyPointers();
   thread->isolate()->heap()->Verify();
diff --git a/runtime/vm/runtime_entry_list.h b/runtime/vm/runtime_entry_list.h
index d450ee4..edc0e41 100644
--- a/runtime/vm/runtime_entry_list.h
+++ b/runtime/vm/runtime_entry_list.h
@@ -40,6 +40,7 @@
   V(TraceFunctionEntry)                                                        \
   V(TraceFunctionExit)                                                         \
   V(DeoptimizeMaterialize)                                                     \
+  V(RewindPostDeopt)                                                           \
   V(UpdateFieldCid)                                                            \
   V(InitStaticField)                                                           \
   V(GrowRegExpStack)                                                           \
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc
index 69d09cb..f728f6b 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -79,9 +79,11 @@
         visiting_old_object_(NULL) {}
 
   void VisitPointers(RawObject** first, RawObject** last) {
-    ASSERT((visiting_old_object_ != NULL) ||
-           scavenger_->Contains(reinterpret_cast<uword>(first)) ||
-           !heap_->Contains(reinterpret_cast<uword>(first)));
+    if (FLAG_verify_gc_contains) {
+      ASSERT((visiting_old_object_ != NULL) ||
+             scavenger_->Contains(reinterpret_cast<uword>(first)) ||
+             !heap_->Contains(reinterpret_cast<uword>(first)));
+    }
     for (RawObject** current = first; current <= last; current++) {
       ScavengePointer(current);
     }
@@ -96,11 +98,12 @@
 
  private:
   void UpdateStoreBuffer(RawObject** p, RawObject* obj) {
-    uword ptr = reinterpret_cast<uword>(p);
     ASSERT(obj->IsHeapObject());
-    ASSERT(!scavenger_->Contains(ptr));
-    ASSERT(!heap_->CodeContains(ptr));
-    ASSERT(heap_->Contains(ptr));
+    if (FLAG_verify_gc_contains) {
+      uword ptr = reinterpret_cast<uword>(p);
+      ASSERT(!scavenger_->Contains(ptr));
+      ASSERT(heap_->DataContains(ptr));
+    }
     // If the newly written object is not a new object, drop it immediately.
     if (!obj->IsNewObject() || visiting_old_object_->IsRemembered()) {
       return;
@@ -504,13 +507,13 @@
 
 
 void Scavenger::IterateRoots(Isolate* isolate, ScavengerVisitor* visitor) {
-  int64_t start = OS::GetCurrentTimeMicros();
+  int64_t start = OS::GetCurrentMonotonicMicros();
   isolate->VisitObjectPointers(visitor,
                                StackFrameIterator::kDontValidateFrames);
-  int64_t middle = OS::GetCurrentTimeMicros();
+  int64_t middle = OS::GetCurrentMonotonicMicros();
   IterateStoreBuffers(isolate, visitor);
   IterateObjectIdTable(isolate, visitor);
-  int64_t end = OS::GetCurrentTimeMicros();
+  int64_t end = OS::GetCurrentMonotonicMicros();
   heap_->RecordData(kToKBAfterStoreBuffer, RoundWordsToKB(UsedInWords()));
   heap_->RecordTime(kVisitIsolateRoots, middle - start);
   heap_->RecordTime(kIterateStoreBuffers, end - middle);
@@ -808,9 +811,9 @@
     ScavengerVisitor visitor(isolate, this, from);
     page_space->AcquireDataLock();
     IterateRoots(isolate, &visitor);
-    int64_t start = OS::GetCurrentTimeMicros();
+    int64_t start = OS::GetCurrentMonotonicMicros();
     ProcessToSpace(&visitor);
-    int64_t middle = OS::GetCurrentTimeMicros();
+    int64_t middle = OS::GetCurrentMonotonicMicros();
     {
       TIMELINE_FUNCTION_GC_DURATION(thread, "WeakHandleProcessing");
       if (FLAG_background_finalization) {
@@ -831,7 +834,7 @@
     page_space->ReleaseDataLock();
 
     // Scavenge finished. Run accounting.
-    int64_t end = OS::GetCurrentTimeMicros();
+    int64_t end = OS::GetCurrentMonotonicMicros();
     heap_->RecordTime(kProcessToSpace, middle - start);
     heap_->RecordTime(kIterateWeaks, end - middle);
     stats_history_.Add(ScavengeStats(
@@ -872,7 +875,7 @@
   space.AddProperty("vmName", "Scavenger");
   space.AddProperty("collections", collections());
   if (collections() > 0) {
-    int64_t run_time = OS::GetCurrentTimeMicros() - isolate->start_time();
+    int64_t run_time = isolate->UptimeMicros();
     run_time = Utils::Maximum(run_time, static_cast<int64_t>(0));
     double run_time_millis = MicrosecondsToMilliseconds(run_time);
     double avg_time_between_collections =
diff --git a/runtime/vm/scope_timer.h b/runtime/vm/scope_timer.h
index 1266f29..c895225 100644
--- a/runtime/vm/scope_timer.h
+++ b/runtime/vm/scope_timer.h
@@ -17,11 +17,11 @@
     if (!enabled_) {
       return;
     }
-    start_ = OS::GetCurrentTimeMicros();
+    start_ = OS::GetCurrentMonotonicMicros();
   }
 
   int64_t GetElapsed() const {
-    int64_t end = OS::GetCurrentTimeMicros();
+    int64_t end = OS::GetCurrentMonotonicMicros();
     ASSERT(end >= start_);
     return end - start_;
   }
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 259b2c0..bdc71e9 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -2339,6 +2339,7 @@
   Array& storage = Array::Handle(Array::New(limit));
   GetInstancesVisitor visitor(cls, storage);
   ObjectGraph graph(thread);
+  HeapIterationScope iteration_scope(true);
   graph.IterateObjects(&visitor);
   intptr_t count = visitor.count();
   JSONObject jsobj(js);
@@ -2988,18 +2989,57 @@
 }
 
 
+static const char* const step_enum_names[] = {
+    "None", "Into", "Over", "Out", "Rewind", "OverAsyncSuspension", NULL,
+};
+
+
+static const Debugger::ResumeAction step_enum_values[] = {
+    Debugger::kContinue,   Debugger::kStepInto,
+    Debugger::kStepOver,   Debugger::kStepOut,
+    Debugger::kStepRewind, Debugger::kStepOverAsyncSuspension,
+    Debugger::kContinue,  // Default value
+};
+
+
 static const MethodParameter* resume_params[] = {
-    RUNNABLE_ISOLATE_PARAMETER, NULL,
+    RUNNABLE_ISOLATE_PARAMETER,
+    new EnumParameter("step", false, step_enum_names),
+    new UIntParameter("frameIndex", false), NULL,
 };
 
 
 static bool Resume(Thread* thread, JSONStream* js) {
   const char* step_param = js->LookupParam("step");
+  Debugger::ResumeAction step = Debugger::kContinue;
+  if (step_param != NULL) {
+    step = EnumMapper(step_param, step_enum_names, step_enum_values);
+  }
+#if defined(TARGET_ARCH_DBC)
+  if (step == Debugger::kStepRewind) {
+    js->PrintError(kCannotResume,
+                   "Rewind not yet implemented on this architecture");
+    return true;
+  }
+#endif
+  intptr_t frame_index = 1;
+  const char* frame_index_param = js->LookupParam("frameIndex");
+  if (frame_index_param != NULL) {
+    if (step != Debugger::kStepRewind) {
+      // Only rewind supports the frameIndex parameter.
+      js->PrintError(
+          kInvalidParams,
+          "%s: the 'frameIndex' parameter can only be used when rewinding",
+          js->method());
+      return true;
+    }
+    frame_index = UIntParameter::Parse(js->LookupParam("frameIndex"));
+  }
   Isolate* isolate = thread->isolate();
   if (isolate->message_handler()->is_paused_on_start()) {
     // If the user is issuing a 'Over' or an 'Out' step, that is the
     // same as a regular resume request.
-    if ((step_param != NULL) && (strcmp(step_param, "Into") == 0)) {
+    if (step == Debugger::kStepInto) {
       isolate->debugger()->EnterSingleStepMode();
     }
     isolate->message_handler()->set_should_pause_on_start(false);
@@ -3028,31 +3068,18 @@
     PrintSuccess(js);
     return true;
   }
-  if (isolate->debugger()->PauseEvent() != NULL) {
-    if (step_param != NULL) {
-      if (strcmp(step_param, "Into") == 0) {
-        isolate->debugger()->SetSingleStep();
-      } else if (strcmp(step_param, "Over") == 0) {
-        isolate->debugger()->SetStepOver();
-      } else if (strcmp(step_param, "Out") == 0) {
-        isolate->debugger()->SetStepOut();
-      } else if (strcmp(step_param, "OverAsyncSuspension") == 0) {
-        if (!isolate->debugger()->SetupStepOverAsyncSuspension()) {
-          js->PrintError(kInvalidParams,
-                         "Isolate must be paused at an async suspension point");
-          return true;
-        }
-      } else {
-        PrintInvalidParamError(js, "step");
-        return true;
-      }
-    }
-    isolate->SetResumeRequest();
-    PrintSuccess(js);
+  if (isolate->debugger()->PauseEvent() == NULL) {
+    js->PrintError(kIsolateMustBePaused, NULL);
     return true;
   }
 
-  js->PrintError(kIsolateMustBePaused, NULL);
+  const char* error = NULL;
+  if (!isolate->debugger()->SetResumeAction(step, frame_index, &error)) {
+    js->PrintError(kCannotResume, error);
+    return true;
+  }
+  isolate->SetResumeRequest();
+  PrintSuccess(js);
   return true;
 }
 
@@ -3733,12 +3760,10 @@
 class ServiceIsolateVisitor : public IsolateVisitor {
  public:
   explicit ServiceIsolateVisitor(JSONArray* jsarr) : jsarr_(jsarr) {}
-
   virtual ~ServiceIsolateVisitor() {}
 
   void VisitIsolate(Isolate* isolate) {
-    if ((isolate != Dart::vm_isolate()) &&
-        !ServiceIsolate::IsServiceIsolateDescendant(isolate)) {
+    if (!IsVMInternalIsolate(isolate)) {
       jsarr_->AddValue(isolate);
     }
   }
@@ -3760,7 +3785,6 @@
   if (ref) {
     return;
   }
-  Isolate* vm_isolate = Dart::vm_isolate();
   jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord));
   jsobj.AddProperty("targetCPU", CPU::Id());
   jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware());
@@ -3768,9 +3792,8 @@
   jsobj.AddProperty("_profilerMode", FLAG_profile_vm ? "VM" : "Dart");
   jsobj.AddProperty64("pid", OS::ProcessId());
   jsobj.AddProperty64("_maxRSS", OS::MaxRSS());
-  int64_t start_time_millis =
-      (vm_isolate->start_time() / kMicrosecondsPerMillisecond);
-  jsobj.AddPropertyTimeMillis("startTime", start_time_millis);
+  jsobj.AddPropertyTimeMillis(
+      "startTime", OS::GetCurrentTimeMillis() - Dart::UptimeMillis());
   // Construct the isolate list.
   {
     JSONArray jsarr(&jsobj, "isolates");
diff --git a/runtime/vm/service/service.md b/runtime/vm/service/service.md
index 7975456..1c9bb72 100644
--- a/runtime/vm/service/service.md
+++ b/runtime/vm/service/service.md
@@ -37,6 +37,7 @@
 	- [getVersion](#getversion)
 	- [getVM](#getvm)
 	- [pause](#pause)
+	- [reloadSources](#reloadsources)
 	- [removeBreakpoint](#removebreakpoint)
 	- [resume](#resume)
 	- [setExceptionPauseMode](#setexceptionpausemode)
@@ -73,6 +74,7 @@
 	- [Message](#message)
 	- [Null](#null)
 	- [Object](#object)
+	- [ReloadReport](#reloadreport)
 	- [Response](#response)
 	- [Sentinel](#sentinel)
 	- [SentinelKind](#sentinelkind)
@@ -183,7 +185,9 @@
 104 | Stream not subscribed | The client is not subscribed to the specified _streamId_
 105 | Isolate must be runnable | This operation cannot happen until the isolate is runnable
 106 | Isolate must be paused | This operation is only valid when the isolate is paused
-
+107 | Cannot resume execution | The isolate could not be resumed
+108 | Isolate is reloading | The isolate is currently processing another reload request
+109 | Isolate cannot be reloaded | The isolate has an unhandled exception and can no longer be reloaded
 
 
 
@@ -651,6 +655,31 @@
 
 See [Success](#success).
 
+### reloadSources
+
+
+```
+ReloadReport reloadSources(string isolateId,
+                           bool force [optional],
+                           bool pause [optional],
+                           string rootLibUri [optional],
+                           string packagesUri [optional])
+```
+
+The _reloadSources_ RPC is used to perform a hot reload of an Isolate's sources.
+
+if the _force_ parameter is provided, it indicates that all of the Isolate's
+sources should be reloaded regardless of modification time.
+
+if the _pause_ parameter is provided, the isolate will pause immediately
+after the reload.
+
+if the _rootLibUri_ parameter is provided, it indicates the new uri to the
+Isolate's root library.
+
+if the _packagesUri_ parameter is provided, it indicates the new uri to the
+Isolate's package map (.packages) file.
+
 ### removeBreakpoint
 
 ```
@@ -668,7 +697,8 @@
 
 ```
 Success resume(string isolateId,
-               StepOption step [optional])
+               StepOption step [optional],
+               int frameIndex [optional])
 ```
 
 The _resume_ RPC is used to resume execution of a paused isolate.
@@ -684,6 +714,13 @@
 Into | Single step, entering function calls
 Over | Single step, skipping over function calls
 Out | Single step until the current function exits
+Rewind | Immediately exit the top frame(s) without executing any code. Isolate will be paused at the call of the last exited function.
+
+The _frameIndex_ parameter is only used when the _step_ parameter is Rewind. It
+specifies the stack frame to rewind to. Stack frame 0 is the currently executing
+function, so _frameIndex_ must be at least 1.
+
+If the _frameIndex_ parameter is not provided, it defaults to 1.
 
 See [Success](#success), [StepOption](#StepOption).
 
@@ -768,8 +805,8 @@
 streamId | event types provided
 -------- | -----------
 VM | VMUpdate
-Isolate | IsolateStart, IsolateRunnable, IsolateExit, IsolateUpdate, ServiceExtensionAdded
-Debug | PauseStart, PauseExit, PauseBreakpoint, PauseInterrupted, PauseException, Resume, BreakpointAdded, BreakpointResolved, BreakpointRemoved, Inspect, None
+Isolate | IsolateStart, IsolateRunnable, IsolateExit, IsolateUpdate, IsolateReload, ServiceExtensionAdded
+Debug | PauseStart, PauseExit, PauseBreakpoint, PauseInterrupted, PauseException, PausePostRequest, Resume, BreakpointAdded, BreakpointResolved, BreakpointRemoved, Inspect, None
 GC | GC
 Extension | Extension
 Timeline | TimelineEvents
@@ -1244,6 +1281,12 @@
   //   PauseBreakpoint
   //   PauseInterrupted
   bool atAsyncSuspension [optional];
+
+  // The status (success or failure) related to the event.
+  // This is provided for the event kinds:
+  //   IsolateReloaded
+  //   IsolateSpawn
+  string status [optional];
 }
 ```
 
@@ -1275,6 +1318,9 @@
   // via setName.
   IsolateUpdate,
 
+  // Notification that an isolate has been reloaded.
+  IsolateReload,
+
   // Notification that an extension RPC was registered on an isolate.
   ServiceExtensionAdded,
 
@@ -1293,6 +1339,9 @@
   // An isolate has paused due to an exception.
   PauseException,
 
+  // An isolate has paused after a service request.
+  PausePostRequest,
+
   // An isolate has started or resumed execution.
   Resume,
 
@@ -2129,6 +2178,15 @@
 
 An _Object_ is a  persistent object that is owned by some isolate.
 
+### ReloadReport
+
+```
+class ReloadReport extends Response {
+  // Did the reload succeed or fail?
+  bool success;
+}
+```
+
 ### Response
 
 ```
@@ -2383,7 +2441,8 @@
   Into,
   Over,
   OverAsyncSuspension,
-  Out
+  Out,
+  Rewind
 }
 ```
 
@@ -2537,6 +2596,6 @@
 3.3 | Pause event now indicates if the isolate is paused at an await, yield, or yield* suspension point via the 'atAsyncSuspension' field. Resume command now supports the step parameter 'OverAsyncSuspension'. A Breakpoint added synthetically by an 'OverAsyncSuspension' resume command identifies itself as such via the 'isSyntheticAsyncContinuation' field.
 3.4 | Add the superType and mixin fields to Class. Added new pause event 'None'.
 3.5 | Add the error field to SourceReportRange.  Clarify definition of token position.  Add "Isolate must be paused" error code.
-3.6 (unreleased) | Add 'scopeStartTokenPos', 'scopeEndTokenPos', and 'declarationTokenPos' to BoundVariable.
+3.6 (unreleased) | Add 'scopeStartTokenPos', 'scopeEndTokenPos', and 'declarationTokenPos' to BoundVariable. Add 'PausePostRequest' event kind. Add 'Rewind' StepOption. Add error code 107 (isolate cannot resume). Add 'reloadSources' RPC and related error codes.
 
 [discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss
diff --git a/runtime/vm/service_isolate.cc b/runtime/vm/service_isolate.cc
index 75342b5..3350583 100644
--- a/runtime/vm/service_isolate.cc
+++ b/runtime/vm/service_isolate.cc
@@ -36,11 +36,17 @@
             false,
             "Provide extra service tracing information.");
 
-static uint8_t* allocator(uint8_t* ptr, intptr_t old_size, intptr_t new_size) {
+static uint8_t* malloc_allocator(uint8_t* ptr,
+                                 intptr_t old_size,
+                                 intptr_t new_size) {
   void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size);
   return reinterpret_cast<uint8_t*>(new_ptr);
 }
 
+static void malloc_deallocator(uint8_t* ptr) {
+  free(reinterpret_cast<void*>(ptr));
+}
+
 
 // These must be kept in sync with service/constants.dart
 #define VM_SERVICE_ISOLATE_EXIT_MESSAGE_ID 0
@@ -106,7 +112,7 @@
       sp, VM_SERVICE_SERVER_INFO_MESSAGE_ID, false /* ignored */));
   ASSERT(!message.IsNull());
   uint8_t* data = NULL;
-  MessageWriter writer(&data, &allocator, false);
+  MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
   writer.WriteMessage(message);
   intptr_t len = writer.BytesWritten();
   PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority));
@@ -118,7 +124,7 @@
       sp, VM_SERVICE_WEB_SERVER_CONTROL_MESSAGE_ID, enable));
   ASSERT(!message.IsNull());
   uint8_t* data = NULL;
-  MessageWriter writer(&data, &allocator, false);
+  MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
   writer.WriteMessage(message);
   intptr_t len = writer.BytesWritten();
   PortMap::PostMessage(new Message(port_, data, len, Message::kNormalPriority));
@@ -175,11 +181,9 @@
 
 Dart_Port ServiceIsolate::WaitForLoadPort() {
   MonitorLocker ml(monitor_);
-
   while (initializing_ && (load_port_ == ILLEGAL_PORT)) {
     ml.Wait();
   }
-
   return load_port_;
 }
 
@@ -207,7 +211,7 @@
       Dart_GetMainPortId(), VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID, name));
   ASSERT(!list.IsNull());
   uint8_t* data = NULL;
-  MessageWriter writer(&data, &allocator, false);
+  MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
   writer.WriteMessage(list);
   intptr_t len = writer.BytesWritten();
   if (FLAG_trace_service) {
@@ -236,7 +240,7 @@
       Dart_GetMainPortId(), VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID, name));
   ASSERT(!list.IsNull());
   uint8_t* data = NULL;
-  MessageWriter writer(&data, &allocator, false);
+  MessageWriter writer(&data, &malloc_allocator, &malloc_deallocator, false);
   writer.WriteMessage(list);
   intptr_t len = writer.BytesWritten();
   if (FLAG_trace_service) {
@@ -313,7 +317,8 @@
   ASSERT(exit_message_length_ == 0);
   const Array& list = Array::Handle(Z, MakeServiceExitMessage());
   ASSERT(!list.IsNull());
-  MessageWriter writer(&exit_message_, &allocator, false);
+  MessageWriter writer(&exit_message_, &malloc_allocator, &malloc_deallocator,
+                       false);
   writer.WriteMessage(list);
   exit_message_length_ = writer.BytesWritten();
   ASSERT(exit_message_ != NULL);
@@ -544,6 +549,9 @@
   const Object& result = Object::Handle(
       DartEntry::InvokeFunction(boot_function, Object::empty_array()));
   ASSERT(!result.IsNull());
+  if (result.IsUnwindError() || result.IsUnhandledException()) {
+    Exceptions::PropagateError(Error::Cast(result));
+  }
   Dart_Port port = ILLEGAL_PORT;
   if (result.IsReceivePort()) {
     port = ReceivePort::Cast(result).Id();
diff --git a/runtime/vm/service_test.cc b/runtime/vm/service_test.cc
index 0bbed74..d0d488a 100644
--- a/runtime/vm/service_test.cc
+++ b/runtime/vm/service_test.cc
@@ -33,6 +33,7 @@
   MessageStatus HandleMessage(Message* message) {
     if (_msg != NULL) {
       free(_msg);
+      _msg = NULL;
     }
 
     // Parse the message.
@@ -58,6 +59,8 @@
       _msg = strdup(reinterpret_cast<char*>(response.DataAddr(0)));
     }
 
+    delete message;
+
     return kOK;
   }
 
diff --git a/runtime/vm/simulator_arm64.cc b/runtime/vm/simulator_arm64.cc
index 65a2034..3c0c99b 100644
--- a/runtime/vm/simulator_arm64.cc
+++ b/runtime/vm/simulator_arm64.cc
@@ -2261,7 +2261,8 @@
         value &= kWRegMask;
       }
       return (static_cast<uint64_t>(value) >> amount) |
-             ((value & ((1L << amount) - 1L)) << (reg_size - amount));
+             ((static_cast<uint64_t>(value) & ((1ULL << amount) - 1ULL))
+              << (reg_size - amount));
     }
     default:
       UNIMPLEMENTED();
@@ -2656,18 +2657,30 @@
     // Format(instr, "smulh 'rd, 'rn, 'rm");
     const int64_t rn_val = get_register(rn, R31IsZR);
     const int64_t rm_val = get_register(rm, R31IsZR);
+#if defined(TARGET_OS_WINDOWS)
+    // Visual Studio does not support __int128.
+    int64_t alu_out;
+    Multiply128(rn_val, rm_val, &alu_out);
+#else
     const __int128 res =
         static_cast<__int128>(rn_val) * static_cast<__int128>(rm_val);
     const int64_t alu_out = static_cast<int64_t>(res >> 64);
+#endif  // TARGET_OS_WINDOWS
     set_register(instr, rd, alu_out, R31IsZR);
   } else if ((instr->Bits(29, 2) == 0) && (instr->Bits(21, 3) == 6) &&
              (instr->Bit(15) == 0)) {
     // Format(instr, "umulh 'rd, 'rn, 'rm");
     const uint64_t rn_val = get_register(rn, R31IsZR);
     const uint64_t rm_val = get_register(rm, R31IsZR);
-    const __int128 res =
-        static_cast<__int128>(rn_val) * static_cast<__int128>(rm_val);
-    const int64_t alu_out = static_cast<int64_t>(res >> 64);
+#if defined(TARGET_OS_WINDOWS)
+    // Visual Studio does not support __int128.
+    uint64_t alu_out;
+    UnsignedMultiply128(rn_val, rm_val, &alu_out);
+#else
+    const unsigned __int128 res = static_cast<unsigned __int128>(rn_val) *
+                                  static_cast<unsigned __int128>(rm_val);
+    const uint64_t alu_out = static_cast<uint64_t>(res >> 64);
+#endif  // TARGET_OS_WINDOWS
     set_register(instr, rd, alu_out, R31IsZR);
   } else if ((instr->Bits(29, 3) == 4) && (instr->Bits(21, 3) == 5) &&
              (instr->Bit(15) == 0)) {
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index 8febf13..b114dc6 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -61,7 +61,6 @@
     simulator_ = sim;
     link_ = sim->last_setjmp_buffer();
     sim->set_last_setjmp_buffer(this);
-    sp_ = sim->sp_;
     fp_ = sim->fp_;
   }
 
@@ -72,13 +71,11 @@
 
   SimulatorSetjmpBuffer* link() const { return link_; }
 
-  uword sp() const { return reinterpret_cast<uword>(sp_); }
   uword fp() const { return reinterpret_cast<uword>(fp_); }
 
   jmp_buf buffer_;
 
  private:
-  RawObject** sp_;
   RawObject** fp_;
   Simulator* simulator_;
   SimulatorSetjmpBuffer* link_;
@@ -510,7 +507,7 @@
 }
 
 
-Simulator::Simulator() : stack_(NULL), fp_(NULL), sp_(NULL) {
+Simulator::Simulator() : stack_(NULL), fp_(NULL) {
   // Setup simulator support first. Some of this information is needed to
   // setup the architecture state.
   // We allocate the stack here, the size is computed as the sum of
@@ -581,8 +578,8 @@
   frame[1] = Code::null();
   frame[2] = reinterpret_cast<RawObject*>(pc);
   frame[3] = reinterpret_cast<RawObject*>(base);
-  fp_ = sp_ = frame + kDartFrameFixedSize;
-  thread->set_top_exit_frame_info(reinterpret_cast<uword>(sp_));
+  fp_ = frame + kDartFrameFixedSize;
+  thread->set_top_exit_frame_info(reinterpret_cast<uword>(fp_));
 }
 
 // TODO(vegorov): Investigate advantages of using
@@ -1060,8 +1057,8 @@
     FP = reinterpret_cast<RawObject**>(fp_);                                   \
     pc = reinterpret_cast<uint32_t*>(pc_);                                     \
     if ((reinterpret_cast<uword>(pc) & 2) != 0) { /* Entry frame? */           \
-      fp_ = sp_ = reinterpret_cast<RawObject**>(fp_[0]);                       \
-      thread->set_top_exit_frame_info(reinterpret_cast<uword>(sp_));           \
+      fp_ = reinterpret_cast<RawObject**>(fp_[0]);                             \
+      thread->set_top_exit_frame_info(reinterpret_cast<uword>(fp_));           \
       thread->set_top_resource(top_resource);                                  \
       thread->set_vm_tag(vm_tag);                                              \
       return special_[kExceptionSpecialIndex];                                 \
@@ -1112,8 +1109,8 @@
   uint32_t op;  // Currently executing op.
   uint16_t rA;  // A component of the currently executing op.
 
-  if (sp_ == NULL) {
-    fp_ = sp_ = reinterpret_cast<RawObject**>(stack_);
+  if (fp_ == NULL) {
+    fp_ = reinterpret_cast<RawObject**>(stack_);
   }
 
   // Save current VM tag and mark thread as executing Dart code.
@@ -1447,6 +1444,16 @@
   }
 
   {
+    BYTECODE(CheckStackAlwaysExit, A);
+    {
+      Exit(thread, FP, SP + 1, pc);
+      NativeArguments args(thread, 0, NULL, NULL);
+      INVOKE_RUNTIME(DRT_StackOverflow, args);
+    }
+    DISPATCH();
+  }
+
+  {
     BYTECODE(DebugStep, A);
     if (thread->isolate()->single_step()) {
       Exit(thread, FP, SP + 1, pc);
@@ -2565,9 +2572,8 @@
     // Check if it is a fake PC marking the entry frame.
     if ((reinterpret_cast<uword>(pc) & 2) != 0) {
       const intptr_t argc = reinterpret_cast<uword>(pc) >> 2;
-      fp_ = sp_ =
-          reinterpret_cast<RawObject**>(FrameArguments(FP, argc + 1)[0]);
-      thread->set_top_exit_frame_info(reinterpret_cast<uword>(sp_));
+      fp_ = reinterpret_cast<RawObject**>(FrameArguments(FP, argc + 1)[0]);
+      thread->set_top_exit_frame_info(reinterpret_cast<uword>(fp_));
       thread->set_top_resource(top_resource);
       thread->set_vm_tag(vm_tag);
       return result;
@@ -3498,15 +3504,17 @@
 
   {
     BYTECODE(LoadIndexedUint32, A_B_C);
-    uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]);
-    FP[rA] = reinterpret_cast<RawObject*>(*reinterpret_cast<uintptr_t*>(data));
+    const uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]);
+    const uint32_t value = *reinterpret_cast<const uint32_t*>(data);
+    FP[rA] = reinterpret_cast<RawObject*>(value);
     DISPATCH();
   }
 
   {
     BYTECODE(LoadIndexedInt32, A_B_C);
-    uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]);
-    FP[rA] = reinterpret_cast<RawObject*>(*reinterpret_cast<intptr_t*>(data));
+    const uint8_t* data = SimulatorHelpers::GetTypedData(FP[rB], FP[rC]);
+    const int32_t value = *reinterpret_cast<const int32_t*>(data);
+    FP[rA] = reinterpret_cast<RawObject*>(value);
     DISPATCH();
   }
 
@@ -3546,19 +3554,13 @@
 
   {
     BYTECODE(Deopt, A_D);
+
+    // Note: frame translation will take care of preserving result at the
+    // top of the stack. See CompilerDeoptInfo::CreateDeoptInfo.
     const bool is_lazy = rD == 0;
 
-    // Preserve result of the previous call.
-    // TODO(vegorov) we could have actually included result into the
-    // deoptimization environment because it is passed through the stack.
-    // If we do then we could remove special result handling from this code.
-    RawObject* result = SP[0];
-
-    // When not preserving the result, we still need to preserve SP[0] as it
-    // contains some temporary expression.
-    if (!is_lazy) {
-      SP++;
-    }
+    // Make sure we preserve SP[0] when entering synthetic frame below.
+    SP++;
 
     // Leaf runtime function DeoptimizeCopyFrame expects a Dart frame.
     // The code in this frame may not cause GC.
@@ -3574,9 +3576,6 @@
 
     // We are now inside a valid frame.
     {
-      if (is_lazy) {
-        *++SP = result;  // Preserve result (call below can cause GC).
-      }
       *++SP = 0;  // Space for the result: number of materialization args.
       Exit(thread, FP, SP + 1, /*pc=*/0);
       NativeArguments native_args(thread, 0, SP, SP);
@@ -3584,10 +3583,6 @@
     }
     const intptr_t materialization_arg_count =
         Smi::Value(RAW_CAST(Smi, *SP--)) / kWordSize;
-    if (is_lazy) {
-      // Reload the result. It might have been relocated by GC.
-      result = *SP--;
-    }
 
     // Restore caller PC.
     pc = SavedCallerPC(FP);
@@ -3596,21 +3591,13 @@
     // Check if it is a fake PC marking the entry frame.
     ASSERT((reinterpret_cast<uword>(pc) & 2) == 0);
 
-    // Restore SP, FP and PP. Push result and dispatch.
-    // Note: unlike in a normal return sequence we don't need to drop
-    // arguments - those are not part of the innermost deoptimization
-    // environment they were dropped by FlowGraphCompiler::RecordAfterCall.
-
-    // If the result is not preserved, the unoptimized frame ends at the
-    // next slot.
-    SP = FrameArguments(FP, materialization_arg_count);
+    // Restore SP, FP and PP.
+    // Unoptimized frame SP is one below FrameArguments(...) because
+    // FrameArguments(...) returns a pointer to the first argument.
+    SP = FrameArguments(FP, materialization_arg_count) - 1;
     FP = SavedCallerFP(FP);
     pp = SimulatorHelpers::FrameCode(FP)->ptr()->object_pool_->ptr();
-    if (is_lazy) {
-      SP[0] = result;  // Put the result on the stack.
-    } else {
-      SP--;  // No result to push.
-    }
+
     DISPATCH();
   }
 
@@ -3711,18 +3698,28 @@
   // Clear top exit frame.
   thread->set_top_exit_frame_info(0);
 
-  sp_ = reinterpret_cast<RawObject**>(sp);
   fp_ = reinterpret_cast<RawObject**>(fp);
 
   if (pc == StubCode::RunExceptionHandler_entry()->EntryPoint()) {
-    // Instead of executing the RunException stub, we implement its
-    // behavior here.
+    // The RunExceptionHandler stub is a placeholder.  We implement
+    // its behavior here.
     RawObject* raw_exception = thread->active_exception();
     RawObject* raw_stacktrace = thread->active_stacktrace();
     ASSERT(raw_exception != Object::null());
     special_[kExceptionSpecialIndex] = raw_exception;
-    special_[kStacktraceSpecialIndex] = raw_stacktrace;
+    special_[kStackTraceSpecialIndex] = raw_stacktrace;
     pc_ = thread->resume_pc();
+  } else if (pc == StubCode::DeoptForRewind_entry()->EntryPoint()) {
+    // The DeoptForRewind stub is a placeholder.  We will eventually
+    // implement its behavior here.
+    //
+    // TODO(turnidge): Refactor the Deopt bytecode so that we can use
+    // the implementation here too.  The deopt pc is stored in
+    // Thread::resume_pc().  After invoking deoptimization, we usually
+    // call into Debugger::RewindPostDeopt(), but I need to figure out
+    // if that makes any sense (it would JumpToFrame during a
+    // JumpToFrame, which seems wrong).
+    UNIMPLEMENTED();
   } else {
     pc_ = pc;
   }
diff --git a/runtime/vm/simulator_dbc.h b/runtime/vm/simulator_dbc.h
index e0570b7..076dedc 100644
--- a/runtime/vm/simulator_dbc.h
+++ b/runtime/vm/simulator_dbc.h
@@ -66,7 +66,7 @@
 
   void JumpToFrame(uword pc, uword sp, uword fp, Thread* thread);
 
-  uword get_sp() const { return reinterpret_cast<uword>(sp_); }
+  uword get_sp() const { return reinterpret_cast<uword>(fp_); }
   uword get_fp() const { return reinterpret_cast<uword>(fp_); }
   uword get_pc() const { return reinterpret_cast<uword>(pc_); }
 
@@ -84,7 +84,7 @@
 
   enum SpecialIndex {
     kExceptionSpecialIndex,
-    kStacktraceSpecialIndex,
+    kStackTraceSpecialIndex,
     kSpecialIndexCount
   };
 
@@ -92,7 +92,6 @@
   uintptr_t* stack_;
 
   RawObject** fp_;
-  RawObject** sp_;
   uword pc_;
 
   SimulatorSetjmpBuffer* last_setjmp_buffer_;
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index b7a1b83..97f0d84 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -150,9 +150,9 @@
       return "script";
     case kMessage:
       return "message";
-    case kAppWithJIT:
+    case kAppJIT:
       return "app-jit";
-    case kAppNoJIT:
+    case kAppAOT:
       return "app-aot";
     case kNone:
       return "none";
@@ -370,7 +370,7 @@
   const Library& library = Library::Handle(zone(), Library::CoreLibrary());
   result = DartLibraryCalls::InstanceCreate(library, Symbols::ArgumentError(),
                                             Symbols::Dot(), args);
-  const Stacktrace& stacktrace = Stacktrace::Handle(zone());
+  const StackTrace& stacktrace = StackTrace::Handle(zone());
   const UnhandledException& error = UnhandledException::Handle(
       zone(), UnhandledException::New(Instance::Cast(result), stacktrace));
   thread()->long_jump_base()->Jump(1, error);
@@ -653,8 +653,9 @@
     char* actual_features =
         OS::StrNDup(features, buffer_len < 128 ? buffer_len : 128);
     OS::SNPrint(message_buffer, kMessageBufferSize,
-                "Wrong features in snapshot, expected '%s' found '%s'",
-                expected_features, actual_features);
+                "Snapshot not compatible with the current VM configuration: "
+                "the snapshot requires '%s' but the VM has '%s'",
+                actual_features, expected_features);
     free(const_cast<char*>(expected_features));
     free(actual_features);
     // This can also fail while bringing up the VM isolate, so make sure to
@@ -678,8 +679,8 @@
 }
 
 
-int32_t InstructionsWriter::GetOffsetFor(RawInstructions* instructions,
-                                         RawCode* code) {
+int32_t ImageWriter::GetOffsetFor(RawInstructions* instructions,
+                                  RawCode* code) {
 #if defined(PRODUCT)
   // Instructions are only dedup in product mode because it obfuscates profiler
   // results.
@@ -699,7 +700,7 @@
 }
 
 
-int32_t InstructionsWriter::GetObjectOffsetFor(RawObject* raw_object) {
+int32_t ImageWriter::GetObjectOffsetFor(RawObject* raw_object) {
   intptr_t heap_size = raw_object->Size();
   intptr_t offset = next_object_offset_;
   next_object_offset_ += heap_size;
@@ -708,21 +709,7 @@
 }
 
 
-static void EnsureIdentifier(char* label) {
-  for (char c = *label; c != '\0'; c = *++label) {
-    if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
-        ((c >= '0') && (c <= '9'))) {
-      continue;
-    }
-    *label = '_';
-  }
-}
-
-
-void AssemblyInstructionsWriter::Write(uint8_t* vmisolate_buffer,
-                                       intptr_t vmisolate_length,
-                                       uint8_t* isolate_buffer,
-                                       intptr_t isolate_length) {
+void ImageWriter::Write(WriteStream* clustered_stream, bool vm) {
   Thread* thread = Thread::Current();
   Zone* zone = thread->zone();
   NOT_IN_PRODUCT(TimelineDurationScope tds(thread, Timeline::GetIsolateStream(),
@@ -741,18 +728,73 @@
     data.obj_ = &Object::Handle(zone, data.raw_obj_);
   }
 
+  // Append the direct-mapped RO data objects after the clustered snapshot.
+  WriteROData(clustered_stream);
+
+  WriteText(clustered_stream, vm);
+}
+
+
+void ImageWriter::WriteROData(WriteStream* stream) {
+  stream->Align(OS::kMaxPreferredCodeAlignment);
+
+  // Heap page starts here.
+
+  stream->WriteWord(next_object_offset_);  // Data length.
+  COMPILE_ASSERT(OS::kMaxPreferredCodeAlignment >= kObjectAlignment);
+  stream->Align(OS::kMaxPreferredCodeAlignment);
+
+  // Heap page objects start here.
+
+  for (intptr_t i = 0; i < objects_.length(); i++) {
+    const Object& obj = *objects_[i].obj_;
+
+    NoSafepointScope no_safepoint;
+    uword start = reinterpret_cast<uword>(obj.raw()) - kHeapObjectTag;
+    uword end = start + obj.raw()->Size();
+
+    // Write object header with the mark and VM heap bits set.
+    uword marked_tags = obj.raw()->ptr()->tags_;
+    marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags);
+    marked_tags = RawObject::MarkBit::update(true, marked_tags);
+    stream->WriteWord(marked_tags);
+    start += sizeof(uword);
+    for (uword* cursor = reinterpret_cast<uword*>(start);
+         cursor < reinterpret_cast<uword*>(end); cursor++) {
+      stream->WriteWord(*cursor);
+    }
+  }
+}
+
+
+static void EnsureIdentifier(char* label) {
+  for (char c = *label; c != '\0'; c = *++label) {
+    if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
+        ((c >= '0') && (c <= '9'))) {
+      continue;
+    }
+    *label = '_';
+  }
+}
+
+
+void AssemblyImageWriter::WriteText(WriteStream* clustered_stream, bool vm) {
+  Zone* zone = Thread::Current()->zone();
+
+  const char* instructions_symbol =
+      vm ? "_kDartVmSnapshotInstructions" : "_kDartIsolateSnapshotInstructions";
   assembly_stream_.Print(".text\n");
-  assembly_stream_.Print(".globl _kInstructionsSnapshot\n");
+  assembly_stream_.Print(".globl %s\n", instructions_symbol);
   // Start snapshot at page boundary.
   ASSERT(VirtualMemory::PageSize() >= OS::kMaxPreferredCodeAlignment);
   assembly_stream_.Print(".balign %" Pd ", 0\n", VirtualMemory::PageSize());
-  assembly_stream_.Print("_kInstructionsSnapshot:\n");
+  assembly_stream_.Print("%s:\n", instructions_symbol);
 
   // This head also provides the gap to make the instructions snapshot
   // look like a HeapPage.
   intptr_t instructions_length = next_offset_;
   WriteWordLiteralText(instructions_length);
-  intptr_t header_words = InstructionsSnapshot::kHeaderSize / sizeof(uword);
+  intptr_t header_words = Image::kHeaderSize / sizeof(uword);
   for (intptr_t i = 1; i < header_words; i++) {
     WriteWordLiteralText(0);
   }
@@ -828,6 +870,8 @@
       }
     }
   }
+
+
 #if defined(TARGET_OS_LINUX)
   assembly_stream_.Print(".section .rodata\n");
 #elif defined(TARGET_OS_MACOS)
@@ -836,79 +880,27 @@
   // Unsupported platform.
   UNREACHABLE();
 #endif
-  assembly_stream_.Print(".globl _kDataSnapshot\n");
-  // Start snapshot at page boundary.
-  assembly_stream_.Print(".balign %" Pd ", 0\n", VirtualMemory::PageSize());
-  assembly_stream_.Print("_kDataSnapshot:\n");
-  WriteWordLiteralData(next_object_offset_);  // Data length.
-  COMPILE_ASSERT(OS::kMaxPreferredCodeAlignment >= kObjectAlignment);
+
+  const char* data_symbol =
+      vm ? "_kDartVmSnapshotData" : "_kDartIsolateSnapshotData";
+  assembly_stream_.Print(".globl %s\n", data_symbol);
   assembly_stream_.Print(".balign %" Pd ", 0\n",
                          OS::kMaxPreferredCodeAlignment);
-
-  for (intptr_t i = 0; i < objects_.length(); i++) {
-    const Object& obj = *objects_[i].obj_;
-    assembly_stream_.Print("Precompiled_Obj_%d:\n", i);
-
-    NoSafepointScope no_safepoint;
-    uword start = reinterpret_cast<uword>(obj.raw()) - kHeapObjectTag;
-    uword end = start + obj.raw()->Size();
-
-    // Write object header with the mark and VM heap bits set.
-    uword marked_tags = obj.raw()->ptr()->tags_;
-    marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags);
-    marked_tags = RawObject::MarkBit::update(true, marked_tags);
-    WriteWordLiteralData(marked_tags);
-    start += sizeof(uword);
-    for (uword* cursor = reinterpret_cast<uword*>(start);
-         cursor < reinterpret_cast<uword*>(end); cursor++) {
-      WriteWordLiteralData(*cursor);
-    }
-  }
-
-
-  assembly_stream_.Print(".globl _kVmIsolateSnapshot\n");
-  assembly_stream_.Print(".balign %" Pd ", 0\n", VirtualMemory::PageSize());
-  assembly_stream_.Print("_kVmIsolateSnapshot:\n");
-  for (intptr_t i = 0; i < vmisolate_length; i++) {
-    assembly_stream_.Print(".byte %" Pd "\n", vmisolate_buffer[i]);
-  }
-
-  assembly_stream_.Print(".globl _kIsolateSnapshot\n");
-  assembly_stream_.Print(".balign %" Pd ", 0\n", VirtualMemory::PageSize());
-  assembly_stream_.Print("_kIsolateSnapshot:\n");
-  for (intptr_t i = 0; i < isolate_length; i++) {
-    assembly_stream_.Print(".byte %" Pd "\n", isolate_buffer[i]);
+  assembly_stream_.Print("%s:\n", data_symbol);
+  uint8_t* buffer = clustered_stream->buffer();
+  intptr_t length = clustered_stream->bytes_written();
+  for (intptr_t i = 0; i < length; i++) {
+    assembly_stream_.Print(".byte %" Pd "\n", buffer[i]);
   }
 }
 
 
-void BlobInstructionsWriter::Write(uint8_t* vmisolate_buffer,
-                                   intptr_t vmisolate_len,
-                                   uint8_t* isolate_buffer,
-                                   intptr_t isolate_length) {
-  Thread* thread = Thread::Current();
-  Zone* zone = thread->zone();
-  NOT_IN_PRODUCT(TimelineDurationScope tds(thread, Timeline::GetIsolateStream(),
-                                           "WriteInstructions"));
-
-  // Handlify collected raw pointers as building the names below
-  // will allocate on the Dart heap.
-  for (intptr_t i = 0; i < instructions_.length(); i++) {
-    InstructionsData& data = instructions_[i];
-    data.insns_ = &Instructions::Handle(zone, data.raw_insns_);
-    ASSERT(data.raw_code_ != NULL);
-    data.code_ = &Code::Handle(zone, data.raw_code_);
-  }
-  for (intptr_t i = 0; i < objects_.length(); i++) {
-    ObjectData& data = objects_[i];
-    data.obj_ = &Object::Handle(zone, data.raw_obj_);
-  }
-
-  // This head also provides the gap to make the instructions snapshot
-  // look like a HeapPage.
+void BlobImageWriter::WriteText(WriteStream* clustered_stream, bool vm) {
+  // This header provides the gap to make the instructions snapshot look like a
+  // HeapPage.
   intptr_t instructions_length = next_offset_;
   instructions_blob_stream_.WriteWord(instructions_length);
-  intptr_t header_words = InstructionsSnapshot::kHeaderSize / sizeof(uword);
+  intptr_t header_words = Image::kHeaderSize / sizeof(uword);
   for (intptr_t i = 1; i < header_words; i++) {
     instructions_blob_stream_.WriteWord(0);
   }
@@ -959,38 +951,18 @@
       }
     }
   }
-
-  rodata_blob_stream_.WriteWord(next_object_offset_);  // Data length.
-  COMPILE_ASSERT(OS::kMaxPreferredCodeAlignment >= kObjectAlignment);
-  while (!Utils::IsAligned(rodata_blob_stream_.bytes_written(),
-                           OS::kMaxPreferredCodeAlignment)) {
-    rodata_blob_stream_.WriteWord(0);
-  }
-
-  for (intptr_t i = 0; i < objects_.length(); i++) {
-    const Object& obj = *objects_[i].obj_;
-
-    NoSafepointScope no_safepoint;
-    uword start = reinterpret_cast<uword>(obj.raw()) - kHeapObjectTag;
-    uword end = start + obj.raw()->Size();
-
-    // Write object header with the mark and VM heap bits set.
-    uword marked_tags = obj.raw()->ptr()->tags_;
-    marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags);
-    marked_tags = RawObject::MarkBit::update(true, marked_tags);
-    rodata_blob_stream_.WriteWord(marked_tags);
-    start += sizeof(uword);
-    for (uword* cursor = reinterpret_cast<uword*>(start);
-         cursor < reinterpret_cast<uword*>(end); cursor++) {
-      rodata_blob_stream_.WriteWord(*cursor);
-    }
-  }
 }
 
 
-uword InstructionsReader::GetInstructionsAt(int32_t offset) {
+RawInstructions* InstructionsReader::GetInstructionsAt(int32_t offset) {
   ASSERT(Utils::IsAligned(offset, OS::PreferredCodeAlignment()));
-  return reinterpret_cast<uword>(instructions_buffer_) + offset;
+
+  RawInstructions* result = reinterpret_cast<RawInstructions*>(
+      reinterpret_cast<uword>(instructions_buffer_) + offset + kHeapObjectTag);
+  ASSERT(result->IsInstructions());
+  ASSERT(result->IsMarked());
+
+  return result;
 }
 
 
@@ -1137,7 +1109,7 @@
       }
       if (newobj.raw() != objref->raw()) {
         ZoneGrowableArray<intptr_t>* patches = backref.patch_records();
-        ASSERT(newobj.IsCanonical());
+        ASSERT(newobj.IsNull() || newobj.IsCanonical());
         ASSERT(patches != NULL);
         // First we replace the back ref table with the canonical object.
         *objref = newobj.raw();
@@ -1218,10 +1190,11 @@
                                Snapshot::Kind kind,
                                uint8_t** buffer,
                                ReAlloc alloc,
+                               DeAlloc dealloc,
                                intptr_t initial_size,
                                ForwardList* forward_list,
                                bool can_send_any_object)
-    : BaseWriter(buffer, alloc, initial_size),
+    : BaseWriter(buffer, alloc, dealloc, initial_size),
       thread_(thread),
       kind_(kind),
       object_store_(isolate()->object_store()),
@@ -1883,6 +1856,7 @@
                      Snapshot::kScript,
                      buffer,
                      alloc,
+                     NULL,
                      kInitialSize,
                      &forward_list_,
                      true /* can_send_any_object */),
@@ -1932,15 +1906,19 @@
 
 MessageWriter::MessageWriter(uint8_t** buffer,
                              ReAlloc alloc,
-                             bool can_send_any_object)
+                             DeAlloc dealloc,
+                             bool can_send_any_object,
+                             intptr_t* buffer_len)
     : SnapshotWriter(Thread::Current(),
                      Snapshot::kMessage,
                      buffer,
                      alloc,
+                     dealloc,
                      kInitialSize,
                      &forward_list_,
                      can_send_any_object),
-      forward_list_(thread(), kMaxPredefinedObjectIds) {
+      forward_list_(thread(), kMaxPredefinedObjectIds),
+      buffer_len_(buffer_len) {
   ASSERT(buffer != NULL);
   ASSERT(alloc != NULL);
 }
@@ -1956,7 +1934,11 @@
   if (setjmp(*jump.Set()) == 0) {
     NoSafepointScope no_safepoint;
     WriteObject(obj.raw());
+    if (buffer_len_ != NULL) {
+      *buffer_len_ = BytesWritten();
+    }
   } else {
+    FreeBuffer();
     ThrowException(exception_type(), exception_msg());
   }
 }
diff --git a/runtime/vm/snapshot.h b/runtime/vm/snapshot.h
index 7bc946f..487aaa9 100644
--- a/runtime/vm/snapshot.h
+++ b/runtime/vm/snapshot.h
@@ -77,10 +77,11 @@
 class RawReceivePort;
 class RawRedirectionData;
 class RawScript;
+class RawSignatureData;
 class RawSendPort;
 class RawSmi;
-class RawStackmap;
-class RawStacktrace;
+class RawStackMap;
+class RawStackTrace;
 class RawSubtypeTestCache;
 class RawTokenStream;
 class RawTwoByteString;
@@ -152,17 +153,17 @@
 class Snapshot {
  public:
   enum Kind {
-    kCore = 0,    // Full snapshot of core libraries. No root library, no code.
-    kScript,      // A partial snapshot of only the application script.
-    kMessage,     // A partial snapshot used only for isolate messaging.
-    kAppWithJIT,  // Full snapshot of core libraries and application. Has some
-                  // code, but may compile in the future because we haven't
-                  // necessarily included code for every function or to
-                  // (de)optimize.
-    kAppNoJIT,    // Full snapshot of core libraries and application. Has
-                  // complete code for the application that never deopts. Will
-                  // not compile in the future.
-    kNone,        // dart_bootstrap/gen_snapshot
+    kCore = 0,  // Full snapshot of core libraries. No root library, no code.
+    kScript,    // A partial snapshot of only the application script.
+    kMessage,   // A partial snapshot used only for isolate messaging.
+    kAppJIT,    // Full snapshot of core libraries and application. Has some
+                // code, but may compile in the future because we haven't
+                // necessarily included code for every function or to
+                // (de)optimize.
+    kAppAOT,    // Full snapshot of core libraries and application. Has
+                // complete code for the application that never deopts. Will
+                // not compile in the future.
+    kNone,      // dart_bootstrap/gen_snapshot
     kInvalid
   };
   static const char* KindToCString(Kind kind);
@@ -183,13 +184,13 @@
   }
 
   static bool IsFull(Kind kind) {
-    return (kind == kCore) || (kind == kAppWithJIT) || (kind == kAppNoJIT);
+    return (kind == kCore) || (kind == kAppJIT) || (kind == kAppAOT);
   }
   static bool IncludesCode(Kind kind) {
-    return (kind == kAppWithJIT) || (kind == kAppNoJIT);
+    return (kind == kAppJIT) || (kind == kAppAOT);
   }
 
-  uint8_t* Addr() { return reinterpret_cast<uint8_t*>(this); }
+  const uint8_t* Addr() const { return reinterpret_cast<const uint8_t*>(this); }
 
   static intptr_t length_offset() {
     return OFFSET_OF(Snapshot, unaligned_length_);
@@ -210,19 +211,18 @@
 };
 
 
-class InstructionsSnapshot : ValueObject {
+class Image : ValueObject {
  public:
-  explicit InstructionsSnapshot(const void* raw_memory)
-      : raw_memory_(raw_memory) {
+  explicit Image(const void* raw_memory) : raw_memory_(raw_memory) {
     ASSERT(Utils::IsAligned(raw_memory, OS::kMaxPreferredCodeAlignment));
   }
 
-  void* instructions_start() {
+  void* object_start() {
     return reinterpret_cast<void*>(reinterpret_cast<uword>(raw_memory_) +
                                    kHeaderSize);
   }
 
-  uword instructions_size() {
+  uword object_size() {
     uword snapshot_size = *reinterpret_cast<const uword*>(raw_memory_);
     return snapshot_size - kHeaderSize;
   }
@@ -232,34 +232,7 @@
  private:
   const void* raw_memory_;  // The symbol kInstructionsSnapshot.
 
-  DISALLOW_COPY_AND_ASSIGN(InstructionsSnapshot);
-};
-
-
-class DataSnapshot : ValueObject {
- public:
-  explicit DataSnapshot(const void* raw_memory) : raw_memory_(raw_memory) {
-    ASSERT(Utils::IsAligned(raw_memory, 2 * kWordSize));  // kObjectAlignment
-  }
-
-  void* data_start() {
-    return reinterpret_cast<void*>(reinterpret_cast<uword>(raw_memory_) +
-                                   kHeaderSize);
-  }
-
-  uword data_size() {
-    uword snapshot_size = *reinterpret_cast<const uword*>(raw_memory_);
-    return snapshot_size - kHeaderSize;
-  }
-
-  // Header: data length and padding for alignment. We use the same alignment
-  // as for code for now.
-  static const intptr_t kHeaderSize = OS::kMaxPreferredCodeAlignment;
-
- private:
-  const void* raw_memory_;  // The symbol kDataSnapshot.
-
-  DISALLOW_COPY_AND_ASSIGN(DataSnapshot);
+  DISALLOW_COPY_AND_ASSIGN(Image);
 };
 
 
@@ -374,7 +347,7 @@
                             OS::PreferredCodeAlignment()));
   }
 
-  uword GetInstructionsAt(int32_t offset);
+  RawInstructions* GetInstructionsAt(int32_t offset);
   RawObject* GetObjectAt(int32_t offset);
 
  private:
@@ -542,6 +515,7 @@
   friend class PatchClass;
   friend class RedirectionData;
   friend class Script;
+  friend class SignatureData;
   friend class SubtypeTestCache;
   friend class TokenStream;
   friend class Type;
@@ -635,8 +609,13 @@
   }
 
  protected:
-  BaseWriter(uint8_t** buffer, ReAlloc alloc, intptr_t initial_size)
-      : StackResource(Thread::Current()), stream_(buffer, alloc, initial_size) {
+  BaseWriter(uint8_t** buffer,
+             ReAlloc alloc,
+             DeAlloc dealloc,
+             intptr_t initial_size)
+      : StackResource(Thread::Current()),
+        stream_(buffer, alloc, initial_size),
+        dealloc_(dealloc) {
     ASSERT(buffer != NULL);
     ASSERT(alloc != NULL);
   }
@@ -653,8 +632,14 @@
     data[Snapshot::kSnapshotFlagIndex] = kind;
   }
 
+  void FreeBuffer() {
+    dealloc_(stream_.buffer());
+    stream_.set_buffer(NULL);
+  }
+
  private:
   WriteStream stream_;
+  DeAlloc dealloc_;
 
   DISALLOW_IMPLICIT_CONSTRUCTORS(BaseWriter);
 };
@@ -715,27 +700,31 @@
 };
 
 
-class InstructionsWriter : public ZoneAllocated {
+class ImageWriter : public ZoneAllocated {
  public:
-  InstructionsWriter()
-      : next_offset_(InstructionsSnapshot::kHeaderSize),
-        next_object_offset_(DataSnapshot::kHeaderSize),
-        instructions_(),
-        objects_() {}
-  virtual ~InstructionsWriter() {}
+  ImageWriter()
+      : next_offset_(0), next_object_offset_(0), instructions_(), objects_() {
+    ResetOffsets();
+  }
+  virtual ~ImageWriter() {}
 
+  void ResetOffsets() {
+    next_offset_ = Image::kHeaderSize;
+    next_object_offset_ = Image::kHeaderSize;
+    instructions_.Clear();
+    objects_.Clear();
+  }
   int32_t GetOffsetFor(RawInstructions* instructions, RawCode* code);
-
   int32_t GetObjectOffsetFor(RawObject* raw_object);
 
-  virtual void Write(uint8_t* vmisolate_buffer,
-                     intptr_t vmisolate_length,
-                     uint8_t* isolate_buffer,
-                     intptr_t isolate_length) = 0;
+  void Write(WriteStream* clustered_stream, bool vm);
   virtual intptr_t text_size() = 0;
-  virtual intptr_t data_size() = 0;
+  intptr_t data_size() { return next_object_offset_; }
 
  protected:
+  void WriteROData(WriteStream* stream);
+  virtual void WriteText(WriteStream* clustered_stream, bool vm) = 0;
+
   struct InstructionsData {
     explicit InstructionsData(RawInstructions* insns,
                               RawCode* code,
@@ -768,26 +757,21 @@
   GrowableArray<ObjectData> objects_;
 
  private:
-  DISALLOW_COPY_AND_ASSIGN(InstructionsWriter);
+  DISALLOW_COPY_AND_ASSIGN(ImageWriter);
 };
 
 
-class AssemblyInstructionsWriter : public InstructionsWriter {
+class AssemblyImageWriter : public ImageWriter {
  public:
-  AssemblyInstructionsWriter(uint8_t** assembly_buffer,
-                             ReAlloc alloc,
-                             intptr_t initial_size)
-      : InstructionsWriter(),
+  AssemblyImageWriter(uint8_t** assembly_buffer,
+                      ReAlloc alloc,
+                      intptr_t initial_size)
+      : ImageWriter(),
         assembly_stream_(assembly_buffer, alloc, initial_size),
-        text_size_(0),
-        data_size_(0) {}
+        text_size_(0) {}
 
-  virtual void Write(uint8_t* vmisolate_buffer,
-                     intptr_t vmisolate_length,
-                     uint8_t* isolate_buffer,
-                     intptr_t isolate_length);
+  virtual void WriteText(WriteStream* clustered_stream, bool vm);
   virtual intptr_t text_size() { return text_size_; }
-  virtual intptr_t data_size() { return data_size_; }
 
   intptr_t AssemblySize() const { return assembly_stream_.bytes_written(); }
 
@@ -802,55 +786,34 @@
     text_size_ += sizeof(value);
   }
 
-  void WriteWordLiteralData(uword value) {
-// Padding is helpful for comparing the .S with --disassemble.
-#if defined(ARCH_IS_64_BIT)
-    assembly_stream_.Print(".quad 0x%0.16" Px "\n", value);
-#else
-    assembly_stream_.Print(".long 0x%0.8" Px "\n", value);
-#endif
-    data_size_ += sizeof(value);
-  }
-
   WriteStream assembly_stream_;
   intptr_t text_size_;
-  intptr_t data_size_;
 
-  DISALLOW_COPY_AND_ASSIGN(AssemblyInstructionsWriter);
+  DISALLOW_COPY_AND_ASSIGN(AssemblyImageWriter);
 };
 
 
-class BlobInstructionsWriter : public InstructionsWriter {
+class BlobImageWriter : public ImageWriter {
  public:
-  BlobInstructionsWriter(uint8_t** instructions_blob_buffer,
-                         uint8_t** rodata_blob_buffer,
-                         ReAlloc alloc,
-                         intptr_t initial_size)
-      : InstructionsWriter(),
+  BlobImageWriter(uint8_t** instructions_blob_buffer,
+                  ReAlloc alloc,
+                  intptr_t initial_size)
+      : ImageWriter(),
         instructions_blob_stream_(instructions_blob_buffer,
                                   alloc,
-                                  initial_size),
-        rodata_blob_stream_(rodata_blob_buffer, alloc, initial_size) {}
+                                  initial_size) {}
 
-  virtual void Write(uint8_t* vmisolate_buffer,
-                     intptr_t vmisolate_length,
-                     uint8_t* isolate_buffer,
-                     intptr_t isolate_length);
+  virtual void WriteText(WriteStream* clustered_stream, bool vm);
   virtual intptr_t text_size() { return InstructionsBlobSize(); }
-  virtual intptr_t data_size() { return RodataBlobSize(); }
 
   intptr_t InstructionsBlobSize() const {
     return instructions_blob_stream_.bytes_written();
   }
-  intptr_t RodataBlobSize() const {
-    return rodata_blob_stream_.bytes_written();
-  }
 
  private:
   WriteStream instructions_blob_stream_;
-  WriteStream rodata_blob_stream_;
 
-  DISALLOW_COPY_AND_ASSIGN(BlobInstructionsWriter);
+  DISALLOW_COPY_AND_ASSIGN(BlobImageWriter);
 };
 
 
@@ -860,6 +823,7 @@
                  Snapshot::Kind kind,
                  uint8_t** buffer,
                  ReAlloc alloc,
+                 DeAlloc dealloc,
                  intptr_t initial_size,
                  ForwardList* forward_list,
                  bool can_send_any_object);
@@ -958,7 +922,7 @@
   friend class RawReceivePort;
   friend class RawRegExp;
   friend class RawScript;
-  friend class RawStacktrace;
+  friend class RawStackTrace;
   friend class RawSubtypeTestCache;
   friend class RawTokenStream;
   friend class RawType;
@@ -987,16 +951,47 @@
 };
 
 
+class SerializedObjectBuffer : public StackResource {
+ public:
+  SerializedObjectBuffer()
+      : StackResource(Thread::Current()),
+        object_data_(NULL),
+        object_length_(0) {}
+
+  virtual ~SerializedObjectBuffer() { free(object_data_); }
+
+  void StealBuffer(uint8_t** out_data, intptr_t* out_length) {
+    *out_data = object_data_;
+    *out_length = object_length_;
+
+    object_data_ = NULL;
+    object_length_ = 0;
+  }
+
+  uint8_t** data_buffer() { return &object_data_; }
+  intptr_t* data_length() { return &object_length_; }
+
+ private:
+  uint8_t* object_data_;
+  intptr_t object_length_;
+};
+
+
 class MessageWriter : public SnapshotWriter {
  public:
   static const intptr_t kInitialSize = 512;
-  MessageWriter(uint8_t** buffer, ReAlloc alloc, bool can_send_any_object);
+  MessageWriter(uint8_t** buffer,
+                ReAlloc alloc,
+                DeAlloc dealloc,
+                bool can_send_any_object,
+                intptr_t* buffer_len = NULL);
   ~MessageWriter() {}
 
   void WriteMessage(const Object& obj);
 
  private:
   ForwardList forward_list_;
+  intptr_t* buffer_len_;
 
   DISALLOW_COPY_AND_ASSIGN(MessageWriter);
 };
diff --git a/runtime/vm/snapshot_test.cc b/runtime/vm/snapshot_test.cc
index 81c4342..6d5b6e6 100644
--- a/runtime/vm/snapshot_test.cc
+++ b/runtime/vm/snapshot_test.cc
@@ -57,6 +57,11 @@
 }
 
 
+static void malloc_deallocator(uint8_t* ptr) {
+  free(ptr);
+}
+
+
 static uint8_t* zone_allocator(uint8_t* ptr,
                                intptr_t old_size,
                                intptr_t new_size) {
@@ -65,6 +70,9 @@
 }
 
 
+static void zone_deallocator(uint8_t* ptr) {}
+
+
 // Compare two Dart_CObject object graphs rooted in first and
 // second. The second graph will be destroyed by this operation no matter
 // whether the graphs are equal or not.
@@ -139,6 +147,8 @@
 
   // Check that the two messages are the same.
   CompareDartCObjects(root, new_root);
+
+  free(buffer);
 }
 
 
@@ -147,6 +157,7 @@
   ApiMessageWriter writer(&buffer, &malloc_allocator);
   const bool result = writer.WriteCMessage(root);
   EXPECT_EQ(false, result);
+  free(buffer);
 }
 
 
@@ -156,7 +167,7 @@
   // Write snapshot with object content.
   const Object& null_object = Object::Handle();
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(null_object);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -181,7 +192,7 @@
   // Write snapshot with object content.
   const Smi& smi = Smi::Handle(Smi::New(124));
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(smi);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -207,7 +218,7 @@
   // Write snapshot with object content.
   const Smi& smi = Smi::Handle(Smi::New(-1));
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(smi);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -230,7 +241,7 @@
 Dart_CObject* SerializeAndDeserializeMint(const Mint& mint) {
   // Write snapshot with object content.
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(mint);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -305,7 +316,7 @@
   // Write snapshot with object content.
   const Double& dbl = Double::Handle(Double::New(101.29));
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(dbl);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -331,7 +342,7 @@
   // Write snapshot with true object.
   const Bool& bl = Bool::True();
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(bl);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -359,7 +370,7 @@
   // Write snapshot with false object.
   const Bool& bl = Bool::False();
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(bl);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -383,7 +394,7 @@
   // Write snapshot with object content.
   const Capability& capability = Capability::Handle(Capability::New(12345));
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(capability);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -413,7 +424,7 @@
   Bigint& bigint = Bigint::Handle();
   bigint ^= Integer::NewCanonical(str);
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(bigint);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -441,7 +452,7 @@
 Dart_CObject* SerializeAndDeserializeBigint(const Bigint& bigint) {
   // Write snapshot with object content.
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(bigint);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -494,7 +505,7 @@
 TEST_CASE(SerializeSingletons) {
   // Write snapshot with object content.
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &malloc_allocator, true);
+  MessageWriter writer(&buffer, &malloc_allocator, &malloc_deallocator, true);
   writer.WriteObject(Object::class_class());
   writer.WriteObject(Object::type_arguments_class());
   writer.WriteObject(Object::function_class());
@@ -536,7 +547,7 @@
   // Write snapshot with object content.
   String& str = String::Handle(String::New(cstr));
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(str);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -582,7 +593,7 @@
     array.SetAt(i, smi);
   }
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(array);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -664,7 +675,7 @@
   const int kArrayLength = 0;
   Array& array = Array::Handle(Array::New(kArrayLength));
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(array);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -694,7 +705,7 @@
     typed_data.SetUint8(i, i);
   }
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(typed_data);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -728,7 +739,7 @@
       array.Set##darttype((i * scale), i);                                     \
     }                                                                          \
     uint8_t* buffer;                                                           \
-    MessageWriter writer(&buffer, &zone_allocator, true);                      \
+    MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);   \
     writer.WriteMessage(array);                                                \
     intptr_t buffer_len = writer.BytesWritten();                               \
     MessageSnapshotReader reader(buffer, buffer_len, thread);                  \
@@ -751,7 +762,7 @@
                                reinterpret_cast<uint8_t*>(data), length));     \
     intptr_t scale = array.ElementSizeInBytes();                               \
     uint8_t* buffer;                                                           \
-    MessageWriter writer(&buffer, &zone_allocator, true);                      \
+    MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);   \
     writer.WriteMessage(array);                                                \
     intptr_t buffer_len = writer.BytesWritten();                               \
     MessageSnapshotReader reader(buffer, buffer_len, thread);                  \
@@ -798,7 +809,7 @@
   TypedData& typed_data = TypedData::Handle(
       TypedData::New(kTypedDataUint8ArrayCid, kTypedDataLength));
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteMessage(typed_data);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -828,6 +839,7 @@
                        Snapshot::kScript,
                        buffer,
                        alloc,
+                       NULL,
                        kInitialSize,
                        &forward_list_,
                        true /* can_send_any_object */),
@@ -1152,7 +1164,7 @@
       "}\n";
   Dart_Handle result;
 
-  uint8_t* isolate_snapshot_buffer;
+  uint8_t* isolate_snapshot_data_buffer;
 
   // Start an Isolate, load a script and create a full snapshot.
   Timer timer1(true, "Snapshot_test");
@@ -1172,9 +1184,9 @@
 
     // Write snapshot with object content.
     {
-      FullSnapshotWriter writer(Snapshot::kCore, NULL, &isolate_snapshot_buffer,
-                                &malloc_allocator,
-                                NULL /* instructions_writer */);
+      FullSnapshotWriter writer(
+          Snapshot::kCore, NULL, &isolate_snapshot_data_buffer,
+          &malloc_allocator, NULL, NULL /* image_writer */);
       writer.WriteFullSnapshot();
     }
   }
@@ -1183,7 +1195,7 @@
   // from the script.
   Timer timer2(true, "Snapshot_test");
   timer2.Start();
-  TestCase::CreateTestIsolateFromSnapshot(isolate_snapshot_buffer);
+  TestCase::CreateTestIsolateFromSnapshot(isolate_snapshot_data_buffer);
   {
     Dart_EnterScope();  // Start a Dart API scope for invoking API functions.
     timer2.Stop();
@@ -1196,7 +1208,7 @@
     Dart_ExitScope();
   }
   Dart_ShutdownIsolate();
-  free(isolate_snapshot_buffer);
+  free(isolate_snapshot_data_buffer);
 }
 
 
@@ -1209,7 +1221,7 @@
   };
   const char* kScriptChars = kFullSnapshotScriptChars;
 
-  uint8_t* isolate_snapshot_buffer;
+  uint8_t* isolate_snapshot_data_buffer;
 
   // Start an Isolate, load a script and create a full snapshot.
   Timer timer1(true, "Snapshot_test");
@@ -1229,9 +1241,9 @@
 
     // Write snapshot with object content.
     {
-      FullSnapshotWriter writer(Snapshot::kCore, NULL, &isolate_snapshot_buffer,
-                                &malloc_allocator,
-                                NULL /* instructions_writer */);
+      FullSnapshotWriter writer(
+          Snapshot::kCore, NULL, &isolate_snapshot_data_buffer,
+          &malloc_allocator, NULL, NULL /* image_writer */);
       writer.WriteFullSnapshot();
     }
 
@@ -1245,7 +1257,7 @@
   // from the script.
   Timer timer2(true, "Snapshot_test");
   timer2.Start();
-  TestCase::CreateTestIsolateFromSnapshot(isolate_snapshot_buffer);
+  TestCase::CreateTestIsolateFromSnapshot(isolate_snapshot_data_buffer);
   {
     Dart_EnterScope();  // Start a Dart API scope for invoking API functions.
     timer2.Stop();
@@ -1262,7 +1274,7 @@
     Dart_ExitScope();
   }
   Dart_ShutdownIsolate();
-  free(isolate_snapshot_buffer);
+  free(isolate_snapshot_data_buffer);
 }
 
 
@@ -1399,47 +1411,6 @@
     Dart_ExitScope();
     Dart_ShutdownIsolate();
   }
-  free(script_snapshot);
-
-  // Test for Dart_CreateLibrarySnapshot.
-  {
-    // Create an Isolate using the full snapshot, load a script and create
-    // a script snapshot of the script.
-    TestCase::CreateTestIsolateFromSnapshot(full_snapshot);
-    Dart_EnterScope();  // Start a Dart API scope for invoking API functions.
-
-    // Load the library.
-    Dart_Handle lib = Dart_LoadLibrary(NewString("dart_lib"), Dart_Null(),
-                                       NewString(kScriptChars), 0, 0);
-    EXPECT_VALID(lib);
-
-    // Write out the script snapshot.
-    result = Dart_CreateLibrarySnapshot(lib, &buffer, &size);
-    EXPECT_VALID(result);
-    script_snapshot = reinterpret_cast<uint8_t*>(malloc(size));
-    memmove(script_snapshot, buffer, size);
-    Dart_ExitScope();
-    Dart_ShutdownIsolate();
-  }
-
-  {
-    // Now Create an Isolate using the full snapshot and load the
-    // script snapshot created above and execute it.
-    TestCase::CreateTestIsolateFromSnapshot(full_snapshot);
-    Dart_EnterScope();  // Start a Dart API scope for invoking API functions.
-
-    // Load the test library from the snapshot.
-    EXPECT(script_snapshot != NULL);
-    result = Dart_LoadScriptFromSnapshot(script_snapshot, size);
-    EXPECT_VALID(result);
-
-    // Invoke a function which returns an object.
-    Dart_Handle cls = Dart_GetClass(result, NewString("FieldsTest"));
-    result = Dart_Invoke(cls, NewString("testMain"), 0, NULL);
-    EXPECT_VALID(result);
-    Dart_ExitScope();
-    Dart_ShutdownIsolate();
-  }
   free(full_snapshot);
   free(script_snapshot);
 }
@@ -1690,10 +1661,14 @@
     // Use a script snapshot where a full snapshot is expected.
     char* error = NULL;
     Dart_Isolate isolate = Dart_CreateIsolate(
-        "script-uri", "main", script_snapshot, NULL, NULL, &error);
+        "script-uri", "main", script_snapshot, NULL, NULL, NULL, &error);
     EXPECT(isolate == NULL);
     EXPECT(error != NULL);
-    EXPECT_SUBSTRING("got 'script', expected 'core'", error);
+    EXPECT_SUBSTRING(
+        "Incompatible snapshot kinds:"
+        " vm 'core', isolate 'script'",
+        error);
+    free(error);
   }
 
   {
@@ -1753,7 +1728,7 @@
 
   // Serialize the object into a message.
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, false);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
   writer.WriteMessage(obj);
   *buffer_len = writer.BytesWritten();
   return buffer;
@@ -1773,7 +1748,7 @@
   String& str = String::Handle();
   str ^= Api::UnwrapHandle(dart_string);
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, false);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
   writer.WriteMessage(str);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -1793,7 +1768,7 @@
   String& str = String::Handle();
   str ^= Api::UnwrapHandle(dart_string);
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, false);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
   writer.WriteMessage(str);
   intptr_t buffer_len = writer.BytesWritten();
 
@@ -1904,7 +1879,7 @@
       Smi& smi = Smi::Handle();
       smi ^= Api::UnwrapHandle(smi_result);
       uint8_t* buffer;
-      MessageWriter writer(&buffer, &zone_allocator, false);
+      MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
       writer.WriteMessage(smi);
       intptr_t buffer_len = writer.BytesWritten();
 
@@ -1922,7 +1897,7 @@
       Bigint& bigint = Bigint::Handle();
       bigint ^= Api::UnwrapHandle(bigint_result);
       uint8_t* buffer;
-      MessageWriter writer(&buffer, &zone_allocator, false);
+      MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, false);
       writer.WriteMessage(bigint);
       intptr_t buffer_len = writer.BytesWritten();
 
@@ -3027,7 +3002,7 @@
 TEST_CASE(OmittedObjectEncodingLength) {
   StackZone zone(Thread::Current());
   uint8_t* buffer;
-  MessageWriter writer(&buffer, &zone_allocator, true);
+  MessageWriter writer(&buffer, &zone_allocator, &zone_deallocator, true);
   writer.WriteInlinedObjectHeader(kOmittedObjectId);
   // For performance, we'd like single-byte headers when ids are omitted.
   // If this starts failing, consider renumbering the snapshot ids.
diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc
index a07e414..500e1ea 100644
--- a/runtime/vm/stack_frame.cc
+++ b/runtime/vm/stack_frame.cc
@@ -105,9 +105,9 @@
     // on the stack map.
     Array maps;
     maps = Array::null();
-    Stackmap map;
+    StackMap map;
     const uword start = Instructions::PayloadStart(code.instructions());
-    map = code.GetStackmap(pc() - start, &maps, &map);
+    map = code.GetStackMap(pc() - start, &maps, &map);
     if (!map.IsNull()) {
 #if !defined(TARGET_ARCH_DBC)
       RawObject** first = reinterpret_cast<RawObject**>(sp());
@@ -552,14 +552,14 @@
   for (intptr_t index = index_; index < deopt_instructions_.length(); index++) {
     DeoptInstr* deopt_instr = deopt_instructions_[index];
     if (deopt_instr->kind() == DeoptInstr::kCallerFp) {
+      intptr_t fp_offset = (index - num_materializations_);
 #if defined(TARGET_ARCH_DBC)
       // Stack on DBC is growing upwards but we record deopt commands
       // in the same order we record them on other architectures as if
       // the stack was growing downwards.
-      return dest_frame_size_ - index;
-#else
-      return (index - num_materializations_);
+      fp_offset = dest_frame_size_ - fp_offset;
 #endif
+      return fp_offset;
     }
   }
   UNREACHABLE();
diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc
index 5b6a5f5..cf77f5f 100644
--- a/runtime/vm/stub_code.cc
+++ b/runtime/vm/stub_code.cc
@@ -20,9 +20,11 @@
 
 DEFINE_FLAG(bool, disassemble_stubs, false, "Disassemble generated stubs.");
 
-#define STUB_CODE_DECLARE(name) StubEntry* StubCode::name##_entry_ = NULL;
-VM_STUB_CODE_LIST(STUB_CODE_DECLARE);
+StubEntry* StubCode::entries_[kNumStubEntries] = {
+#define STUB_CODE_DECLARE(name) NULL,
+    VM_STUB_CODE_LIST(STUB_CODE_DECLARE)
 #undef STUB_CODE_DECLARE
+};
 
 
 StubEntry::StubEntry(const Code& code)
@@ -42,16 +44,17 @@
 
 #define STUB_CODE_GENERATE(name)                                               \
   code ^= Generate("_stub_" #name, StubCode::Generate##name##Stub);            \
-  name##_entry_ = new StubEntry(code);
+  entries_[k##name##Index] = new StubEntry(code);
 
 
 void StubCode::InitOnce() {
-#if !defined(DART_PRECOMPILED_RUNTIME)
+#if defined(DART_PRECOMPILED_RUNTIME)
+  // Stubs will be loaded from the snapshot.
+  UNREACHABLE();
+#else
   // Generate all the stubs.
   Code& code = Code::Handle();
   VM_STUB_CODE_LIST(STUB_CODE_GENERATE);
-#else
-  UNREACHABLE();
 #endif  // DART_PRECOMPILED_RUNTIME
 }
 
@@ -59,30 +62,6 @@
 #undef STUB_CODE_GENERATE
 
 
-void StubCode::Push(Serializer* serializer) {
-#define WRITE_STUB(name) serializer->Push(StubCode::name##_entry()->code());
-  VM_STUB_CODE_LIST(WRITE_STUB);
-#undef WRITE_STUB
-}
-
-
-void StubCode::WriteRef(Serializer* serializer) {
-#define WRITE_STUB(name) serializer->WriteRef(StubCode::name##_entry()->code());
-  VM_STUB_CODE_LIST(WRITE_STUB);
-#undef WRITE_STUB
-}
-
-
-void StubCode::ReadRef(Deserializer* deserializer) {
-  Code& code = Code::Handle();
-#define READ_STUB(name)                                                        \
-  code ^= deserializer->ReadRef();                                             \
-  name##_entry_ = new StubEntry(code);
-  VM_STUB_CODE_LIST(READ_STUB);
-#undef READ_STUB
-}
-
-
 void StubCode::Init(Isolate* isolate) {}
 
 
diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h
index 3a2cea0..cba3cdf 100644
--- a/runtime/vm/stub_code.h
+++ b/runtime/vm/stub_code.h
@@ -17,8 +17,6 @@
 class RawCode;
 class SnapshotReader;
 class SnapshotWriter;
-class Serializer;
-class Deserializer;
 
 // List of stubs created in the VM isolate, these stubs are shared by different
 // isolates running in this dart process.
@@ -27,6 +25,7 @@
   V(GetStackPointer)                                                           \
   V(JumpToFrame)                                                               \
   V(RunExceptionHandler)                                                       \
+  V(DeoptForRewind)                                                            \
   V(UpdateStoreBuffer)                                                         \
   V(PrintStopMessage)                                                          \
   V(CallToRuntime)                                                             \
@@ -75,6 +74,7 @@
   V(LazyCompile)                                                               \
   V(OptimizeFunction)                                                          \
   V(RunExceptionHandler)                                                       \
+  V(DeoptForRewind)                                                            \
   V(FixCallersTarget)                                                          \
   V(Deoptimize)                                                                \
   V(DeoptimizeLazyFromReturn)                                                  \
@@ -123,10 +123,6 @@
   // only once and the stub code resides in the vm_isolate heap.
   static void InitOnce();
 
-  static void Push(Serializer* serializer);
-  static void WriteRef(Serializer* serializer);
-  static void ReadRef(Deserializer* deserializer);
-
   // Generate all stubs which are generated on a per isolate basis as they
   // have embedded objects which are isolate specific.
   static void Init(Isolate* isolate);
@@ -148,7 +144,7 @@
 
 // Define the shared stub code accessors.
 #define STUB_CODE_ACCESSOR(name)                                               \
-  static const StubEntry* name##_entry() { return name##_entry_; }             \
+  static const StubEntry* name##_entry() { return entries_[k##name##Index]; }  \
   static intptr_t name##Size() { return name##_entry()->Size(); }
   VM_STUB_CODE_LIST(STUB_CODE_ACCESSOR);
 #undef STUB_CODE_ACCESSOR
@@ -159,6 +155,12 @@
 
   static const intptr_t kNoInstantiator = 0;
 
+  static StubEntry* EntryAt(intptr_t index) { return entries_[index]; }
+  static void EntryAtPut(intptr_t index, StubEntry* entry) {
+    entries_[index] = entry;
+  }
+  static intptr_t NumEntries() { return kNumStubEntries; }
+
  private:
   friend class MegamorphicCacheTable;
 
@@ -166,12 +168,17 @@
 
 #define STUB_CODE_GENERATE(name)                                               \
   static void Generate##name##Stub(Assembler* assembler);
-  VM_STUB_CODE_LIST(STUB_CODE_GENERATE);
+  VM_STUB_CODE_LIST(STUB_CODE_GENERATE)
 #undef STUB_CODE_GENERATE
 
-#define STUB_CODE_ENTRY(name) static StubEntry* name##_entry_;
-  VM_STUB_CODE_LIST(STUB_CODE_ENTRY);
+  enum {
+#define STUB_CODE_ENTRY(name) k##name##Index,
+    VM_STUB_CODE_LIST(STUB_CODE_ENTRY)
 #undef STUB_CODE_ENTRY
+        kNumStubEntries
+  };
+
+  static StubEntry* entries_[kNumStubEntries];
 
   // Generate the stub and finalize the generated code into the stub
   // code executable area.
@@ -195,6 +202,12 @@
 
 enum DeoptStubKind { kLazyDeoptFromReturn, kLazyDeoptFromThrow, kEagerDeopt };
 
+// Zap value used to indicate unused CODE_REG in deopt.
+static const uword kZapCodeReg = 0xf1f1f1f1;
+
+// Zap value used to indicate unused return address in deopt.
+static const uword kZapReturnAddress = 0xe1e1e1e1;
+
 }  // namespace dart
 
 #endif  // RUNTIME_VM_STUB_CODE_H_
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index 87b054d..8b8d8e2 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -537,19 +537,20 @@
   __ LeaveStubFrame();
   // Remove materialization arguments.
   __ add(SP, SP, Operand(R2, ASR, kSmiTagSize));
-  __ Ret();
+  // The caller is responsible for emitting the return instruction.
 }
 
 
 // R0: result, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) {
   // Push zap value instead of CODE_REG for lazy deopt.
-  __ LoadImmediate(IP, 0xf1f1f1f1);
+  __ LoadImmediate(IP, kZapCodeReg);
   __ Push(IP);
   // Return address for "call" to deopt stub.
-  __ LoadImmediate(LR, 0xe1e1e1e1);
+  __ LoadImmediate(LR, kZapReturnAddress);
   __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset()));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn);
+  __ Ret();
 }
 
 
@@ -557,17 +558,19 @@
 // R1: stacktrace, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) {
   // Push zap value instead of CODE_REG for lazy deopt.
-  __ LoadImmediate(IP, 0xf1f1f1f1);
+  __ LoadImmediate(IP, kZapCodeReg);
   __ Push(IP);
   // Return address for "call" to deopt stub.
-  __ LoadImmediate(LR, 0xe1e1e1e1);
+  __ LoadImmediate(LR, kZapReturnAddress);
   __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset()));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow);
+  __ Ret();
 }
 
 
 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
   GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+  __ Ret();
 }
 
 
@@ -1891,7 +1894,7 @@
   __ LoadFromOffset(kWord, R0, THR, Thread::active_exception_offset());
   __ StoreToOffset(kWord, R2, THR, Thread::active_exception_offset());
 
-  // Stacktrace object.
+  // StackTrace object.
   __ LoadFromOffset(kWord, R1, THR, Thread::active_stacktrace_offset());
   __ StoreToOffset(kWord, R2, THR, Thread::active_stacktrace_offset());
 
@@ -1899,6 +1902,26 @@
 }
 
 
+// Deoptimize a frame on the call stack before rewinding.
+// The arguments are stored in the Thread object.
+// No result.
+void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) {
+  // Push zap value instead of CODE_REG.
+  __ LoadImmediate(IP, kZapCodeReg);
+  __ Push(IP);
+
+  // Load the deopt pc into LR.
+  __ LoadFromOffset(kWord, LR, THR, Thread::resume_pc_offset());
+  GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+
+  // After we have deoptimized, jump to the correct frame.
+  __ EnterStubFrame();
+  __ CallRuntime(kRewindPostDeoptRuntimeEntry, 0);
+  __ LeaveStubFrame();
+  __ bkpt(0);
+}
+
+
 // Calls to the runtime to optimize the given function.
 // R8: function to be reoptimized.
 // R4: argument descriptor (preserved).
diff --git a/runtime/vm/stub_code_arm64.cc b/runtime/vm/stub_code_arm64.cc
index 5a5a156..4b852a7 100644
--- a/runtime/vm/stub_code_arm64.cc
+++ b/runtime/vm/stub_code_arm64.cc
@@ -558,19 +558,20 @@
   __ LeaveStubFrame();
   // Remove materialization arguments.
   __ add(SP, SP, Operand(R2));
-  __ ret();
+  // The caller is responsible for emitting the return instruction.
 }
 
 
 // R0: result, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) {
   // Push zap value instead of CODE_REG for lazy deopt.
-  __ LoadImmediate(TMP, 0xf1f1f1f1);
+  __ LoadImmediate(TMP, kZapCodeReg);
   __ Push(TMP);
   // Return address for "call" to deopt stub.
-  __ LoadImmediate(LR, 0xe1e1e1e1);
+  __ LoadImmediate(LR, kZapReturnAddress);
   __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset()));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn);
+  __ ret();
 }
 
 
@@ -578,17 +579,19 @@
 // R1: stacktrace, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) {
   // Push zap value instead of CODE_REG for lazy deopt.
-  __ LoadImmediate(TMP, 0xf1f1f1f1);
+  __ LoadImmediate(TMP, kZapCodeReg);
   __ Push(TMP);
   // Return address for "call" to deopt stub.
-  __ LoadImmediate(LR, 0xe1e1e1e1);
+  __ LoadImmediate(LR, kZapReturnAddress);
   __ ldr(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset()));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow);
+  __ ret();
 }
 
 
 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
   GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+  __ ret();
 }
 
 
@@ -1941,7 +1944,7 @@
   __ LoadFromOffset(R0, THR, Thread::active_exception_offset());
   __ StoreToOffset(R2, THR, Thread::active_exception_offset());
 
-  // Stacktrace object.
+  // StackTrace object.
   __ LoadFromOffset(R1, THR, Thread::active_stacktrace_offset());
   __ StoreToOffset(R2, THR, Thread::active_stacktrace_offset());
 
@@ -1949,6 +1952,26 @@
 }
 
 
+// Deoptimize a frame on the call stack before rewinding.
+// The arguments are stored in the Thread object.
+// No result.
+void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) {
+  // Push zap value instead of CODE_REG.
+  __ LoadImmediate(TMP, kZapCodeReg);
+  __ Push(TMP);
+
+  // Load the deopt pc into LR.
+  __ LoadFromOffset(LR, THR, Thread::resume_pc_offset());
+  GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+
+  // After we have deoptimized, jump to the correct frame.
+  __ EnterStubFrame();
+  __ CallRuntime(kRewindPostDeoptRuntimeEntry, 0);
+  __ LeaveStubFrame();
+  __ brk(0);
+}
+
+
 // Calls to the runtime to optimize the given function.
 // R6: function to be re-optimized.
 // R4: argument descriptor (preserved).
diff --git a/runtime/vm/stub_code_dbc.cc b/runtime/vm/stub_code_dbc.cc
index da24e19..ef41182 100644
--- a/runtime/vm/stub_code_dbc.cc
+++ b/runtime/vm/stub_code_dbc.cc
@@ -47,6 +47,12 @@
 }
 
 
+// Not executed, but used as a sentinel in Simulator::JumpToFrame.
+void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) {
+  __ Trap();
+}
+
+
 // TODO(vegorov) Don't generate this stub.
 void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) {
   __ Trap();
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index ca70617..ce6521d 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -351,8 +351,6 @@
 //   +------------------+
 //   | return-address   |  (deoptimization point)
 //   +------------------+
-//   | Saved CODE_REG   |
-//   +------------------+
 //   | ...              | <- SP of optimized frame
 //
 // Parts of the code cannot GC, part of the code can GC.
@@ -462,15 +460,16 @@
   __ popl(ECX);       // Pop return address.
   __ addl(ESP, EBX);  // Remove materialization arguments.
   __ pushl(ECX);      // Push return address.
-  __ ret();
+  // The caller is responsible for emitting the return instruction.
 }
 
 
 // EAX: result, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) {
   // Return address for "call" to deopt stub.
-  __ pushl(Immediate(0xe1e1e1e1));
+  __ pushl(Immediate(kZapReturnAddress));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn);
+  __ ret();
 }
 
 
@@ -478,13 +477,15 @@
 // EDX: stacktrace, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) {
   // Return address for "call" to deopt stub.
-  __ pushl(Immediate(0xe1e1e1e1));
+  __ pushl(Immediate(kZapReturnAddress));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow);
+  __ ret();
 }
 
 
 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
   GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+  __ ret();
 }
 
 
@@ -1835,6 +1836,22 @@
 }
 
 
+// Deoptimize a frame on the call stack before rewinding.
+// The arguments are stored in the Thread object.
+// No result.
+void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) {
+  // Push the deopt pc.
+  __ pushl(Address(THR, Thread::resume_pc_offset()));
+  GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+
+  // After we have deoptimized, jump to the correct frame.
+  __ EnterStubFrame();
+  __ CallRuntime(kRewindPostDeoptRuntimeEntry, 0);
+  __ LeaveFrame();
+  __ int3();
+}
+
+
 // Calls to the runtime to optimize the given function.
 // EBX: function to be reoptimized.
 // EDX: argument descriptor (preserved).
diff --git a/runtime/vm/stub_code_mips.cc b/runtime/vm/stub_code_mips.cc
index d52e6cc..53394cf 100644
--- a/runtime/vm/stub_code_mips.cc
+++ b/runtime/vm/stub_code_mips.cc
@@ -549,18 +549,19 @@
   // Remove materialization arguments.
   __ SmiUntag(T1);
   __ addu(SP, SP, T1);
-  __ Ret();
+  // The caller is responsible for emitting the return instruction.
 }
 
 // V0: result, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) {
   // Push zap value instead of CODE_REG for lazy deopt.
-  __ LoadImmediate(TMP, 0xf1f1f1f1);
+  __ LoadImmediate(TMP, kZapCodeReg);
   __ Push(TMP);
   // Return address for "call" to deopt stub.
-  __ LoadImmediate(RA, 0xe1e1e1e1);
+  __ LoadImmediate(RA, kZapReturnAddress);
   __ lw(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset()));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn);
+  __ Ret();
 }
 
 
@@ -568,17 +569,19 @@
 // V1: stacktrace, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) {
   // Push zap value instead of CODE_REG for lazy deopt.
-  __ LoadImmediate(TMP, 0xf1f1f1f1);
+  __ LoadImmediate(TMP, kZapCodeReg);
   __ Push(TMP);
   // Return address for "call" to deopt stub.
-  __ LoadImmediate(RA, 0xe1e1e1e1);
+  __ LoadImmediate(RA, kZapReturnAddress);
   __ lw(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset()));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow);
+  __ Ret();
 }
 
 
 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
   GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+  __ Ret();
 }
 
 
@@ -2028,6 +2031,26 @@
 }
 
 
+// Deoptimize a frame on the call stack before rewinding.
+// The arguments are stored in the Thread object.
+// No result.
+void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) {
+  // Push zap value instead of CODE_REG.
+  __ LoadImmediate(TMP, kZapCodeReg);
+  __ Push(TMP);
+
+  // Load the deopt pc into RA.
+  __ lw(RA, Address(THR, Thread::resume_pc_offset()));
+  GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+
+  // After we have deoptimized, jump to the correct frame.
+  __ EnterStubFrame();
+  __ CallRuntime(kRewindPostDeoptRuntimeEntry, 0);
+  __ LeaveStubFrame();
+  __ break_(0);
+}
+
+
 // Calls to the runtime to optimize the given function.
 // T0: function to be reoptimized.
 // S4: argument descriptor (preserved).
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 167154b..b3b18da 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -498,18 +498,19 @@
   __ popq(RCX);       // Pop return address.
   __ addq(RSP, RBX);  // Remove materialization arguments.
   __ pushq(RCX);      // Push return address.
-  __ ret();
+  // The caller is responsible for emitting the return instruction.
 }
 
 
 // RAX: result, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) {
   // Push zap value instead of CODE_REG for lazy deopt.
-  __ pushq(Immediate(0xf1f1f1f1));
+  __ pushq(Immediate(kZapCodeReg));
   // Return address for "call" to deopt stub.
-  __ pushq(Immediate(0xe1e1e1e1));
+  __ pushq(Immediate(kZapReturnAddress));
   __ movq(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset()));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn);
+  __ ret();
 }
 
 
@@ -517,16 +518,18 @@
 // RDX: stacktrace, must be preserved
 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) {
   // Push zap value instead of CODE_REG for lazy deopt.
-  __ pushq(Immediate(0xf1f1f1f1));
+  __ pushq(Immediate(kZapCodeReg));
   // Return address for "call" to deopt stub.
-  __ pushq(Immediate(0xe1e1e1e1));
+  __ pushq(Immediate(kZapReturnAddress));
   __ movq(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset()));
   GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow);
+  __ ret();
 }
 
 
 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) {
   GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+  __ ret();
 }
 
 
@@ -1003,8 +1006,8 @@
   // RDX: Address being stored
   Label reload;
   __ Bind(&reload);
-  __ movq(RCX, FieldAddress(RDX, Object::tags_offset()));
-  __ testq(RCX, Immediate(1 << RawObject::kRememberedBit));
+  __ movq(RAX, FieldAddress(RDX, Object::tags_offset()));
+  __ testq(RAX, Immediate(1 << RawObject::kRememberedBit));
   __ j(EQUAL, &add_to_buffer, Assembler::kNearJump);
   __ popq(RCX);
   __ popq(RAX);
@@ -1891,6 +1894,25 @@
 }
 
 
+// Deoptimize a frame on the call stack before rewinding.
+// The arguments are stored in the Thread object.
+// No result.
+void StubCode::GenerateDeoptForRewindStub(Assembler* assembler) {
+  // Push zap value instead of CODE_REG.
+  __ pushq(Immediate(kZapCodeReg));
+
+  // Push the deopt pc.
+  __ pushq(Address(THR, Thread::resume_pc_offset()));
+  GenerateDeoptimizationSequence(assembler, kEagerDeopt);
+
+  // After we have deoptimized, jump to the correct frame.
+  __ EnterStubFrame();
+  __ CallRuntime(kRewindPostDeoptRuntimeEntry, 0);
+  __ LeaveStubFrame();
+  __ int3();
+}
+
+
 // Calls to the runtime to optimize the given function.
 // RDI: function to be reoptimized.
 // R10: argument descriptor (preserved).
diff --git a/runtime/vm/symbols.cc b/runtime/vm/symbols.cc
index 0d95289..38d5520 100644
--- a/runtime/vm/symbols.cc
+++ b/runtime/vm/symbols.cc
@@ -354,7 +354,6 @@
 }
 
 
-#if defined(DART_PRECOMPILER)
 void Symbols::Compact(Isolate* isolate) {
   ASSERT(isolate != Dart::vm_isolate());
   Zone* zone = Thread::Current()->zone();
@@ -397,7 +396,6 @@
   }
   isolate->object_store()->set_symbol_table(table.Release());
 }
-#endif  // DART_PRECOMPILER
 
 
 void Symbols::GetStats(Isolate* isolate, intptr_t* size, intptr_t* capacity) {
@@ -702,21 +700,19 @@
 }
 
 
-void Symbols::DumpStats() {
-  if (FLAG_dump_symbol_stats) {
-    intptr_t size = -1;
-    intptr_t capacity = -1;
-    // First dump VM symbol table stats.
-    GetStats(Dart::vm_isolate(), &size, &capacity);
-    OS::Print("VM Isolate: Number of symbols : %" Pd "\n", size);
-    OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity);
-    // Now dump regular isolate symbol table stats.
-    GetStats(Isolate::Current(), &size, &capacity);
-    OS::Print("Isolate: Number of symbols : %" Pd "\n", size);
-    OS::Print("Isolate: Symbol table capacity : %" Pd "\n", capacity);
-    // TODO(koda): Consider recording growth and collision stats in HashTable,
-    // in DEBUG mode.
-  }
+void Symbols::DumpStats(Isolate* isolate) {
+  intptr_t size = -1;
+  intptr_t capacity = -1;
+  // First dump VM symbol table stats.
+  GetStats(Dart::vm_isolate(), &size, &capacity);
+  OS::Print("VM Isolate: Number of symbols : %" Pd "\n", size);
+  OS::Print("VM Isolate: Symbol table capacity : %" Pd "\n", capacity);
+  // Now dump regular isolate symbol table stats.
+  GetStats(isolate, &size, &capacity);
+  OS::Print("Isolate: Number of symbols : %" Pd "\n", size);
+  OS::Print("Isolate: Symbol table capacity : %" Pd "\n", capacity);
+  // TODO(koda): Consider recording growth and collision stats in HashTable,
+  // in DEBUG mode.
 }
 
 
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index f8a7996..cbc0bf2 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -75,8 +75,7 @@
   V(_CompileTimeError, "_CompileTimeError")                                    \
   V(ThrowNew, "_throwNew")                                                     \
   V(ThrowNewIfNotLoaded, "_throwNewIfNotLoaded")                               \
-  V(CheckAssertion, "_checkAssertion")                                         \
-  V(CheckConstAssertion, "_checkConstAssertion")                               \
+  V(EvaluateAssertion, "_evaluateAssertion")                                   \
   V(Symbol, "Symbol")                                                          \
   V(SymbolCtor, "Symbol.")                                                     \
   V(List, "List")                                                              \
@@ -84,8 +83,8 @@
   V(ListFactory, "List.")                                                      \
   V(Map, "Map")                                                                \
   V(MapLiteralFactory, "Map._fromLiteral")                                     \
-  V(ImmutableMap, "ImmutableMap")                                              \
-  V(ImmutableMapConstructor, "ImmutableMap._create")                           \
+  V(ImmutableMap, "_ImmutableMap")                                             \
+  V(ImmutableMapConstructor, "_ImmutableMap._create")                          \
   V(StringBase, "_StringBase")                                                 \
   V(Interpolate, "_interpolate")                                               \
   V(InterpolateSingle, "_interpolateSingle")                                   \
@@ -128,6 +127,7 @@
   V(AwaitContextVar, ":await_ctx_var")                                         \
   V(AwaitJumpVar, ":await_jump_var")                                           \
   V(Future, "Future")                                                          \
+  V(FutureOr, "FutureOr")                                                      \
   V(FutureMicrotask, "Future.microtask")                                       \
   V(FutureValue, "Future.value")                                               \
   V(FutureThen, "then")                                                        \
@@ -142,6 +142,7 @@
   V(Native, "native")                                                          \
   V(Class, "Class")                                                            \
   V(Null, "Null")                                                              \
+  V(null, "null")                                                              \
   V(Dynamic, "dynamic")                                                        \
   V(UnresolvedClass, "UnresolvedClass")                                        \
   V(Type, "_Type")                                                             \
@@ -157,6 +158,7 @@
   V(FunctionResult, "function result")                                         \
   V(FactoryResult, "factory result")                                           \
   V(ClosureData, "ClosureData")                                                \
+  V(SignatureData, "SignatureData")                                            \
   V(RedirectionData, "RedirectionData")                                        \
   V(Field, "Field")                                                            \
   V(LiteralToken, "LiteralToken")                                              \
@@ -170,7 +172,7 @@
   V(ObjectPool, "ObjectPool")                                                  \
   V(PcDescriptors, "PcDescriptors")                                            \
   V(CodeSourceMap, "CodeSourceMap")                                            \
-  V(Stackmap, "Stackmap")                                                      \
+  V(StackMap, "StackMap")                                                      \
   V(LocalVarDescriptors, "LocalVarDescriptors")                                \
   V(ExceptionHandlers, "ExceptionHandlers")                                    \
   V(DeoptInfo, "DeoptInfo")                                                    \
@@ -218,6 +220,9 @@
   V(Float32x4, "Float32x4")                                                    \
   V(Float64x2, "Float64x2")                                                    \
   V(Int32x4, "Int32x4")                                                        \
+  V(_Float32x4, "_Float32x4")                                                  \
+  V(_Float64x2, "_Float64x2")                                                  \
+  V(_Int32x4, "_Int32x4")                                                      \
   V(Int8List, "Int8List")                                                      \
   V(Uint8List, "Uint8List")                                                    \
   V(Uint8ClampedList, "Uint8ClampedList")                                      \
@@ -232,6 +237,20 @@
   V(Float64x2List, "Float64x2List")                                            \
   V(Float32List, "Float32List")                                                \
   V(Float64List, "Float64List")                                                \
+  V(_Int8List, "_Int8List")                                                    \
+  V(_Uint8List, "_Uint8List")                                                  \
+  V(_Uint8ClampedList, "_Uint8ClampedList")                                    \
+  V(_Int16List, "_Int16List")                                                  \
+  V(_Uint16List, "_Uint16List")                                                \
+  V(_Int32List, "_Int32List")                                                  \
+  V(_Uint32List, "_Uint32List")                                                \
+  V(_Int64List, "_Int64List")                                                  \
+  V(_Uint64List, "_Uint64List")                                                \
+  V(_Float32x4List, "_Float32x4List")                                          \
+  V(_Int32x4List, "_Int32x4List")                                              \
+  V(_Float64x2List, "_Float64x2List")                                          \
+  V(_Float32List, "_Float32List")                                              \
+  V(_Float64List, "_Float64List")                                              \
   V(_Int8ArrayFactory, "Int8List.")                                            \
   V(_Uint8ArrayFactory, "Uint8List.")                                          \
   V(_Uint8ClampedArrayFactory, "Uint8ClampedList.")                            \
@@ -278,8 +297,8 @@
   V(ByteDataDot, "ByteData.")                                                  \
   V(ByteDataDot_view, "ByteData._view")                                        \
   V(_ByteDataView, "_ByteDataView")                                            \
-  V(ByteBuffer, "ByteBuffer")                                                  \
-  V(ByteBufferDot_New, "ByteBuffer._New")                                      \
+  V(_ByteBuffer, "_ByteBuffer")                                                \
+  V(_ByteBufferDot_New, "_ByteBuffer._New")                                    \
   V(_WeakProperty, "_WeakProperty")                                            \
   V(_MirrorReference, "_MirrorReference")                                      \
   V(FreeListElement, "FreeListElement")                                        \
@@ -554,10 +573,8 @@
 
   static RawArray* UnifiedSymbolTable();
 
-#if defined(DART_PRECOMPILER)
   // Treat the symbol table as weak and collect garbage.
   static void Compact(Isolate* isolate);
-#endif
 
   // Creates a Symbol given a C string that is assumed to contain
   // UTF-8 encoded characters and '\0' is considered a termination character.
@@ -620,7 +637,7 @@
     return reinterpret_cast<RawString**>(&predefined_);
   }
 
-  static void DumpStats();
+  static void DumpStats(Isolate* isolate);
 
   // Returns Symbol::Null if no symbol is found.
   template <typename StringType>
diff --git a/runtime/vm/thread.cc b/runtime/vm/thread.cc
index 709d735..3ff121d 100644
--- a/runtime/vm/thread.cc
+++ b/runtime/vm/thread.cc
@@ -8,6 +8,7 @@
 #include "vm/dart_api_state.h"
 #include "vm/growable_array.h"
 #include "vm/isolate.h"
+#include "vm/json_stream.h"
 #include "vm/lockers.h"
 #include "vm/log.h"
 #include "vm/message_handler.h"
@@ -37,6 +38,8 @@
     delete compiler_stats_;
     compiler_stats_ = NULL;
   }
+  // All zone allocated memory should be free by this point.
+  ASSERT(current_thread_memory_ == 0);
   // There should be no top api scopes at this point.
   ASSERT(api_top_scope() == NULL);
   // Delete the resusable api scope if there is one.
@@ -73,6 +76,8 @@
       os_thread_(NULL),
       thread_lock_(new Monitor()),
       zone_(NULL),
+      current_thread_memory_(0),
+      memory_high_watermark_(0),
       api_reusable_scope_(NULL),
       api_top_scope_(NULL),
       top_resource_(NULL),
@@ -90,7 +95,6 @@
       deferred_interrupts_(0),
       stack_overflow_count_(0),
       cha_(NULL),
-      type_range_cache_(NULL),
       deopt_id_(0),
       pending_functions_(GrowableObjectArray::null()),
       active_exception_(Object::null()),
@@ -205,6 +209,28 @@
 }
 
 
+#ifndef PRODUCT
+// Collect information about each individual zone associated with this thread.
+void Thread::PrintJSON(JSONStream* stream) const {
+  JSONObject jsobj(stream);
+  jsobj.AddProperty("type", "_Thread");
+  jsobj.AddPropertyF("id", "threads/%" Pd "",
+                     OSThread::ThreadIdToIntPtr(os_thread()->trace_id()));
+  jsobj.AddProperty("kind", TaskKindToCString(task_kind()));
+  jsobj.AddPropertyF("_memoryHighWatermark", "%" Pu "", memory_high_watermark_);
+  Zone* zone = zone_;
+  {
+    JSONArray zone_info_array(&jsobj, "zones");
+    zone = zone_;
+    while (zone != NULL) {
+      zone_info_array.AddValue(zone);
+      zone = zone->previous();
+    }
+  }
+}
+#endif
+
+
 RawGrowableObjectArray* Thread::pending_functions() {
   if (pending_functions_ == GrowableObjectArray::null()) {
     pending_functions_ = GrowableObjectArray::New(Heap::kOld);
@@ -245,6 +271,27 @@
 }
 
 
+const char* Thread::TaskKindToCString(TaskKind kind) {
+  switch (kind) {
+    case kUnknownTask:
+      return "kUnknownTask";
+    case kMutatorTask:
+      return "kMutatorTask";
+    case kCompilerTask:
+      return "kCompilerTask";
+    case kSweeperTask:
+      return "kSweeperTask";
+    case kMarkerTask:
+      return "kMarkerTask";
+    case kFinalizerTask:
+      return "kFinalizerTask";
+    default:
+      UNREACHABLE();
+      return "";
+  }
+}
+
+
 bool Thread::EnterIsolate(Isolate* isolate) {
   const bool kIsMutatorThread = true;
   Thread* thread = isolate->ScheduleThread(kIsMutatorThread);
@@ -465,7 +512,7 @@
   }
   if (FLAG_trace_service && FLAG_trace_service_verbose) {
     OS::Print("[+%" Pd64 "ms] Isolate %s deferring OOB interrupts\n",
-              Dart::timestamp(), isolate()->name());
+              Dart::UptimeMillis(), isolate()->name());
   }
 }
 
@@ -488,7 +535,7 @@
   }
   if (FLAG_trace_service && FLAG_trace_service_verbose) {
     OS::Print("[+%" Pd64 "ms] Isolate %s restoring OOB interrupts\n",
-              Dart::timestamp(), isolate()->name());
+              Dart::UptimeMillis(), isolate()->name());
   }
 }
 
@@ -699,6 +746,12 @@
 }
 
 
+bool Thread::IsValidHandle(Dart_Handle object) const {
+  return IsValidLocalHandle(object) || IsValidZoneHandle(object) ||
+         IsValidScopedHandle(object);
+}
+
+
 bool Thread::IsValidLocalHandle(Dart_Handle object) const {
   ApiLocalScope* scope = api_top_scope_;
   while (scope != NULL) {
@@ -711,8 +764,8 @@
 }
 
 
-int Thread::CountLocalHandles() const {
-  int total = 0;
+intptr_t Thread::CountLocalHandles() const {
+  intptr_t total = 0;
   ApiLocalScope* scope = api_top_scope_;
   while (scope != NULL) {
     total += scope->local_handles()->CountHandles();
@@ -722,6 +775,54 @@
 }
 
 
+bool Thread::IsValidZoneHandle(Dart_Handle object) const {
+  Zone* zone = zone_;
+  while (zone != NULL) {
+    if (zone->handles()->IsValidZoneHandle(reinterpret_cast<uword>(object))) {
+      return true;
+    }
+    zone = zone->previous();
+  }
+  return false;
+}
+
+
+intptr_t Thread::CountZoneHandles() const {
+  intptr_t count = 0;
+  Zone* zone = zone_;
+  while (zone != NULL) {
+    count += zone->handles()->CountZoneHandles();
+    zone = zone->previous();
+  }
+  ASSERT(count >= 0);
+  return count;
+}
+
+
+bool Thread::IsValidScopedHandle(Dart_Handle object) const {
+  Zone* zone = zone_;
+  while (zone != NULL) {
+    if (zone->handles()->IsValidScopedHandle(reinterpret_cast<uword>(object))) {
+      return true;
+    }
+    zone = zone->previous();
+  }
+  return false;
+}
+
+
+intptr_t Thread::CountScopedHandles() const {
+  intptr_t count = 0;
+  Zone* zone = zone_;
+  while (zone != NULL) {
+    count += zone->handles()->CountScopedHandles();
+    zone = zone->previous();
+  }
+  ASSERT(count >= 0);
+  return count;
+}
+
+
 int Thread::ZoneSizeInBytes() const {
   int total = 0;
   ApiLocalScope* scope = api_top_scope_;
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index a9fb55f..76a72ad 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -37,6 +37,7 @@
 class LongJumpScope;
 class Object;
 class OSThread;
+class JSONObject;
 class PcDescriptors;
 class RawBool;
 class RawObject;
@@ -51,7 +52,6 @@
 class TimelineStream;
 class TypeArguments;
 class TypeParameter;
-class TypeRangeCache;
 class Zone;
 
 #define REUSABLE_HANDLE_LIST(V)                                                \
@@ -160,6 +160,9 @@
     kMarkerTask = 0x8,
     kFinalizerTask = 0x10,
   };
+  // Converts a TaskKind to its corresponding C-String name.
+  static const char* TaskKindToCString(TaskKind kind);
+
   ~Thread();
 
   // The currently executing thread, or NULL if not yet initialized.
@@ -261,6 +264,22 @@
 
   bool ZoneIsOwnedByThread(Zone* zone) const;
 
+  void IncrementMemoryUsage(uintptr_t value) {
+    current_thread_memory_ += value;
+    if (current_thread_memory_ > memory_high_watermark_) {
+      memory_high_watermark_ = current_thread_memory_;
+    }
+  }
+
+  void DecrementMemoryUsage(uintptr_t value) {
+    ASSERT(current_thread_memory_ >= value);
+    current_thread_memory_ -= value;
+  }
+
+  uintptr_t memory_high_watermark() const { return memory_high_watermark_; }
+
+  void ResetHighWatermark() { memory_high_watermark_ = current_thread_memory_; }
+
   // The reusable api local scope for this thread.
   ApiLocalScope* api_reusable_scope() const { return api_reusable_scope_; }
   void set_api_reusable_scope(ApiLocalScope* value) {
@@ -301,11 +320,6 @@
     cha_ = value;
   }
 
-  TypeRangeCache* type_range_cache() const { return type_range_cache_; }
-  void set_type_range_cache(TypeRangeCache* value) {
-    type_range_cache_ = value;
-  }
-
   int32_t no_callback_scope_depth() const { return no_callback_scope_depth_; }
 
   void IncrementNoCallbackScopeDepth() {
@@ -639,13 +653,22 @@
   // Visit all object pointers.
   void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames);
 
+  bool IsValidHandle(Dart_Handle object) const;
   bool IsValidLocalHandle(Dart_Handle object) const;
-  int CountLocalHandles() const;
+  intptr_t CountLocalHandles() const;
+  bool IsValidZoneHandle(Dart_Handle object) const;
+  intptr_t CountZoneHandles() const;
+  bool IsValidScopedHandle(Dart_Handle object) const;
+  intptr_t CountScopedHandles() const;
   int ZoneSizeInBytes() const;
   void UnwindScopes(uword stack_marker);
 
   void InitVMConstants();
 
+#ifndef PRODUCT
+  void PrintJSON(JSONStream* stream) const;
+#endif
+
  private:
   template <class T>
   T* AllocateReusableHandle();
@@ -677,6 +700,8 @@
   OSThread* os_thread_;
   Monitor* thread_lock_;
   Zone* zone_;
+  uintptr_t current_thread_memory_;
+  uintptr_t memory_high_watermark_;
   ApiLocalScope* api_reusable_scope_;
   ApiLocalScope* api_top_scope_;
   StackResource* top_resource_;
@@ -696,7 +721,6 @@
 
   // Compiler state:
   CHA* cha_;
-  TypeRangeCache* type_range_cache_;
   intptr_t deopt_id_;  // Compilation specific counter.
   RawGrowableObjectArray* pending_functions_;
 
diff --git a/runtime/vm/thread_pool.cc b/runtime/vm/thread_pool.cc
index 40ca9d5..8050833 100644
--- a/runtime/vm/thread_pool.cc
+++ b/runtime/vm/thread_pool.cc
@@ -370,18 +370,20 @@
 
 
 static int64_t ComputeTimeout(int64_t idle_start) {
-  if (FLAG_worker_timeout_millis <= 0) {
+  int64_t worker_timeout_micros =
+      FLAG_worker_timeout_millis * kMicrosecondsPerMillisecond;
+  if (worker_timeout_micros <= 0) {
     // No timeout.
     return 0;
   } else {
-    int64_t waited = OS::GetCurrentTimeMillis() - idle_start;
-    if (waited >= FLAG_worker_timeout_millis) {
+    int64_t waited = OS::GetCurrentMonotonicMicros() - idle_start;
+    if (waited >= worker_timeout_micros) {
       // We must have gotten a spurious wakeup just before we timed
       // out.  Give the worker one last desperate chance to live.  We
       // are merciful.
       return 1;
     } else {
-      return FLAG_worker_timeout_millis - waited;
+      return worker_timeout_micros - waited;
     }
   }
 }
@@ -408,9 +410,9 @@
     }
     ASSERT(!done_);
     pool_->SetIdleAndReapExited(this);
-    idle_start = OS::GetCurrentTimeMillis();
+    idle_start = OS::GetCurrentMonotonicMicros();
     while (true) {
-      Monitor::WaitResult result = ml.Wait(ComputeTimeout(idle_start));
+      Monitor::WaitResult result = ml.WaitMicros(ComputeTimeout(idle_start));
       if (task_ != NULL) {
         // We've found a task.  Process it, regardless of whether the
         // worker is done_.
diff --git a/runtime/vm/thread_registry.cc b/runtime/vm/thread_registry.cc
index c660843..32d48a4 100644
--- a/runtime/vm/thread_registry.cc
+++ b/runtime/vm/thread_registry.cc
@@ -5,6 +5,7 @@
 #include "vm/thread_registry.h"
 
 #include "vm/isolate.h"
+#include "vm/json_stream.h"
 #include "vm/lockers.h"
 
 namespace dart {
@@ -91,6 +92,56 @@
 }
 
 
+#ifndef PRODUCT
+void ThreadRegistry::PrintJSON(JSONStream* stream) const {
+  MonitorLocker ml(threads_lock());
+  JSONArray threads(stream);
+  Thread* current = active_list_;
+  while (current != NULL) {
+    threads.AddValue(current);
+    current = current->next_;
+  }
+}
+#endif
+
+
+bool ThreadRegistry::IsValidHandle(Dart_Handle handle) const {
+  MonitorLocker ml(threads_lock());
+  Thread* current = active_list_;
+  while (current != NULL) {
+    if (current->IsValidHandle(handle)) {
+      return true;
+    }
+    current = current->next_;
+  }
+  return false;
+}
+
+
+intptr_t ThreadRegistry::CountZoneHandles() const {
+  MonitorLocker ml(threads_lock());
+  intptr_t count = 0;
+  Thread* current = active_list_;
+  while (current != NULL) {
+    count += current->CountZoneHandles();
+    current = current->next_;
+  }
+  return count;
+}
+
+
+intptr_t ThreadRegistry::CountScopedHandles() const {
+  MonitorLocker ml(threads_lock());
+  intptr_t count = 0;
+  Thread* current = active_list_;
+  while (current != NULL) {
+    count += current->CountScopedHandles();
+    current = current->next_;
+  }
+  return count;
+}
+
+
 void ThreadRegistry::AddToActiveListLocked(Thread* thread) {
   ASSERT(thread != NULL);
   ASSERT(threads_lock()->IsOwnedByCurrentThread());
@@ -132,6 +183,7 @@
   return thread;
 }
 
+
 void ThreadRegistry::ReturnToFreelistLocked(Thread* thread) {
   ASSERT(thread != NULL);
   ASSERT(thread->os_thread_ == NULL);
diff --git a/runtime/vm/thread_registry.h b/runtime/vm/thread_registry.h
index eb2d327..878479f 100644
--- a/runtime/vm/thread_registry.h
+++ b/runtime/vm/thread_registry.h
@@ -14,6 +14,11 @@
 
 namespace dart {
 
+#ifndef PRODUCT
+class JSONStream;
+class JSONArray;
+#endif
+
 // Unordered collection of threads relating to a particular isolate.
 class ThreadRegistry {
  public:
@@ -28,6 +33,17 @@
   void PrepareForGC();
   Thread* mutator_thread() const { return mutator_thread_; }
 
+#ifndef PRODUCT
+  void PrintJSON(JSONStream* stream) const;
+#endif
+
+  // Calculates the sum of the max memory usage in bytes of each thread.
+  uintptr_t ThreadHighWatermarksTotalLocked() const;
+
+  bool IsValidHandle(Dart_Handle handle) const;
+  intptr_t CountZoneHandles() const;
+  intptr_t CountScopedHandles() const;
+
  private:
   Thread* active_list() const { return active_list_; }
   Monitor* threads_lock() const { return threads_lock_; }
diff --git a/runtime/vm/thread_test.cc b/runtime/vm/thread_test.cc
index 2dcf568..b2b8d39 100644
--- a/runtime/vm/thread_test.cc
+++ b/runtime/vm/thread_test.cc
@@ -15,8 +15,8 @@
 
 UNIT_TEST_CASE(Mutex) {
   // This unit test case needs a running isolate.
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
 
   Mutex* mutex = new Mutex();
   mutex->Lock();
@@ -37,8 +37,8 @@
 
 UNIT_TEST_CASE(Monitor) {
   // This unit test case needs a running isolate.
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   OSThread* thread = OSThread::Current();
   // Thread interrupter interferes with this test, disable interrupts.
   thread->DisableThreadInterrupts();
@@ -52,16 +52,16 @@
   int attempts = 0;
   while (attempts < kNumAttempts) {
     MonitorLocker ml(monitor);
-    int64_t start = OS::GetCurrentTimeMillis();
+    int64_t start = OS::GetCurrentMonotonicMicros();
     int64_t wait_time = 2017;
     Monitor::WaitResult wait_result = ml.Wait(wait_time);
-    int64_t stop = OS::GetCurrentTimeMillis();
+    int64_t stop = OS::GetCurrentMonotonicMicros();
 
     // We expect to be timing out here.
     EXPECT_EQ(Monitor::kTimedOut, wait_result);
 
     // Check whether this attempt falls within the exptected time limits.
-    int64_t wakeup_time = stop - start;
+    int64_t wakeup_time = (stop - start) / kMicrosecondsPerMillisecond;
     OS::Print("wakeup_time: %" Pd64 "\n", wakeup_time);
     const int kAcceptableTimeJitter = 20;    // Measured in milliseconds.
     const int kAcceptableWakeupDelay = 150;  // Measured in milliseconds.
@@ -205,20 +205,190 @@
 }
 
 
+#ifndef PRODUCT
+class SimpleTaskWithZoneAllocation : public ThreadPool::Task {
+ public:
+  SimpleTaskWithZoneAllocation(intptr_t id,
+                               Isolate* isolate,
+                               Thread** thread_ptr,
+                               Monitor* sync,
+                               Monitor* monitor,
+                               intptr_t* done_count,
+                               bool* wait)
+      : id_(id),
+        isolate_(isolate),
+        thread_ptr_(thread_ptr),
+        sync_(sync),
+        monitor_(monitor),
+        done_count_(done_count),
+        wait_(wait) {}
+
+  virtual void Run() {
+    Thread::EnterIsolateAsHelper(isolate_, Thread::kUnknownTask);
+    {
+      Thread* thread = Thread::Current();
+      *thread_ptr_ = thread;
+      CreateStackZones(id_);
+    }
+    Thread::ExitIsolateAsHelper();
+    // Notify the main thread that this thread has exited.
+    {
+      MonitorLocker ml(monitor_);
+      *done_count_ += 1;
+      ml.Notify();
+    }
+  }
+
+ private:
+  void CreateStackZones(intptr_t num) {
+    Thread* thread = Thread::Current();
+    *thread_ptr_ = thread;
+
+    StackZone stack_zone(thread);
+    HANDLESCOPE(thread);
+    Zone* zone = thread->zone();
+    EXPECT_EQ(zone, stack_zone.GetZone());
+
+    // Create a zone (which is also a stack resource) and exercise it a bit.
+    ZoneGrowableArray<bool>* a0 = new (zone) ZoneGrowableArray<bool>(zone, 1);
+    GrowableArray<bool> a1(zone, 1);
+    for (intptr_t i = 0; i < 1000 * num + id_; ++i) {
+      a0->Add(true);
+      a1.Add(true);
+    }
+
+    num -= 1;
+    if (num != 0) {
+      CreateStackZones(num);
+      return;
+    }
+    {
+      // Let the main thread know we're done with memory ops on this thread.
+      MonitorLocker ml(monitor_);
+      *done_count_ += 1;
+      ml.Notify();
+    }
+    // Wait for the go-ahead from the main thread to exit.
+    {
+      MonitorLocker sync_ml(sync_);
+      while (*wait_) {
+        sync_ml.Wait();
+      }
+    }
+  }
+
+  intptr_t id_;
+  Isolate* isolate_;
+  Thread** thread_ptr_;
+  Monitor* sync_;
+  Monitor* monitor_;
+  intptr_t* done_count_;
+  bool* wait_;
+};
+
+
+TEST_CASE(ManySimpleTasksWithZones) {
+  const int kTaskCount = 10;
+  Monitor monitor;
+  Monitor sync;
+  Thread* threads[kTaskCount + 1];
+  Isolate* isolate = Thread::Current()->isolate();
+  intptr_t done_count = 0;
+  bool wait = true;
+  threads[kTaskCount] = Thread::Current();
+
+  EXPECT(isolate->heap()->GrowthControlState());
+  isolate->heap()->DisableGrowthControl();
+  for (intptr_t i = 0; i < kTaskCount; i++) {
+    Dart::thread_pool()->Run(new SimpleTaskWithZoneAllocation(
+        (i + 1), isolate, &threads[i], &sync, &monitor, &done_count, &wait));
+  }
+  // Wait until all spawned tasks finish their memory operations.
+  {
+    MonitorLocker ml(&monitor);
+    while (done_count < kTaskCount) {
+      ml.Wait();
+    }
+    // Reset the done counter for use later.
+    done_count = 0;
+  }
+
+  // Get the information for the current isolate.
+  // We only need to check the current isolate since all tasks are spawned
+  // inside this single isolate.
+  JSONStream stream;
+  isolate->PrintJSON(&stream, false);
+  const char* json = stream.ToCString();
+
+  Thread* current_thread = Thread::Current();
+
+  // Confirm all expected entries are in the JSON output.
+  for (intptr_t i = 0; i < kTaskCount + 1; i++) {
+    Thread* thread = threads[i];
+    Zone* top_zone = thread->zone();
+
+    StackZone stack_zone(current_thread);
+    Zone* current_zone = current_thread->zone();
+
+    // Check that all zones are present with correct sizes.
+    while (top_zone != NULL) {
+      char* zone_info_buf =
+          OS::SCreate(current_zone,
+                      "\"type\":\"_Zone\","
+                      "\"capacity\":%" Pd
+                      ","
+                      "\"used\":%" Pd "",
+                      top_zone->CapacityInBytes(), top_zone->SizeInBytes());
+      EXPECT_SUBSTRING(zone_info_buf, json);
+      top_zone = top_zone->previous();
+    }
+
+    // Check the thread exists and is the correct size.
+    char* thread_info_buf =
+        OS::SCreate(current_zone,
+                    "\"type\":\"_Thread\","
+                    "\"id\":\"threads\\/%" Pd
+                    "\","
+                    "\"kind\":\"%s\","
+                    "\"_memoryHighWatermark\":\"%" Pu "\"",
+                    OSThread::ThreadIdToIntPtr(thread->os_thread()->trace_id()),
+                    Thread::TaskKindToCString(thread->task_kind()),
+                    thread->memory_high_watermark());
+
+    EXPECT_SUBSTRING(thread_info_buf, json);
+  }
+
+  // Unblock the tasks so they can finish.
+  {
+    MonitorLocker sync_ml(&sync);
+    wait = false;
+    sync_ml.NotifyAll();
+  }
+  // Now wait for them all to exit before destroying the isolate.
+  {
+    MonitorLocker ml(&monitor);
+    while (done_count < kTaskCount) {
+      ml.Wait();
+    }
+  }
+}
+#endif
+
+
 TEST_CASE(ThreadRegistry) {
   Isolate* orig = Thread::Current()->isolate();
   Zone* orig_zone = Thread::Current()->zone();
   char* orig_str = orig_zone->PrintToString("foo");
   Dart_ExitIsolate();
   // Create and enter a new isolate.
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   Zone* zone0 = Thread::Current()->zone();
   EXPECT(zone0 != orig_zone);
   Dart_ShutdownIsolate();
   // Create and enter yet another isolate.
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   {
     // Create a stack resource this time, and exercise it.
     StackZone stack_zone(Thread::Current());
diff --git a/runtime/vm/timeline.cc b/runtime/vm/timeline.cc
index f0b0ee1..4c23d78 100644
--- a/runtime/vm/timeline.cc
+++ b/runtime/vm/timeline.cc
@@ -1505,6 +1505,16 @@
 TimelineEventEndlessRecorder::TimelineEventEndlessRecorder()
     : head_(NULL), block_index_(0) {}
 
+TimelineEventEndlessRecorder::~TimelineEventEndlessRecorder() {
+  TimelineEventBlock* current = head_;
+  head_ = NULL;
+
+  while (current != NULL) {
+    TimelineEventBlock* next = current->next();
+    delete current;
+    current = next;
+  }
+}
 
 void TimelineEventEndlessRecorder::PrintJSON(JSONStream* js,
                                              TimelineEventFilter* filter) {
diff --git a/runtime/vm/timeline.h b/runtime/vm/timeline.h
index cc93040..c7c6016 100644
--- a/runtime/vm/timeline.h
+++ b/runtime/vm/timeline.h
@@ -461,7 +461,7 @@
                         TimelineStream* stream,
                         const char* label);
 
-  ~TimelineDurationScope();
+  virtual ~TimelineDurationScope();
 
  private:
   int64_t timestamp_;
@@ -479,7 +479,7 @@
                         TimelineStream* stream,
                         const char* label);
 
-  ~TimelineBeginEndScope();
+  virtual ~TimelineBeginEndScope();
 
  private:
   void EmitBegin();
@@ -681,7 +681,7 @@
   static const intptr_t kDefaultCapacity = 8192;
 
   explicit TimelineEventFixedBufferRecorder(intptr_t capacity);
-  ~TimelineEventFixedBufferRecorder();
+  virtual ~TimelineEventFixedBufferRecorder();
 
   void PrintJSON(JSONStream* js, TimelineEventFilter* filter);
   void PrintTraceEvent(JSONStream* js, TimelineEventFilter* filter);
@@ -708,7 +708,7 @@
  public:
   explicit TimelineEventRingRecorder(intptr_t capacity = kDefaultCapacity)
       : TimelineEventFixedBufferRecorder(capacity) {}
-  ~TimelineEventRingRecorder() {}
+  virtual ~TimelineEventRingRecorder() {}
 
   const char* name() const { return "Ring"; }
 
@@ -723,8 +723,7 @@
 class TimelineEventSystraceRecorder : public TimelineEventFixedBufferRecorder {
  public:
   explicit TimelineEventSystraceRecorder(intptr_t capacity = kDefaultCapacity);
-
-  ~TimelineEventSystraceRecorder();
+  virtual ~TimelineEventSystraceRecorder();
 
   const char* name() const { return "Systrace"; }
 
@@ -742,7 +741,7 @@
  public:
   explicit TimelineEventStartupRecorder(intptr_t capacity = kDefaultCapacity)
       : TimelineEventFixedBufferRecorder(capacity) {}
-  ~TimelineEventStartupRecorder() {}
+  virtual ~TimelineEventStartupRecorder() {}
 
   const char* name() const { return "Startup"; }
 
@@ -756,7 +755,7 @@
 class TimelineEventCallbackRecorder : public TimelineEventRecorder {
  public:
   TimelineEventCallbackRecorder();
-  ~TimelineEventCallbackRecorder();
+  virtual ~TimelineEventCallbackRecorder();
 
   void PrintJSON(JSONStream* js, TimelineEventFilter* filter);
   void PrintTraceEvent(JSONStream* js, TimelineEventFilter* filter);
@@ -782,6 +781,7 @@
 class TimelineEventEndlessRecorder : public TimelineEventRecorder {
  public:
   TimelineEventEndlessRecorder();
+  virtual ~TimelineEventEndlessRecorder();
 
   void PrintJSON(JSONStream* js, TimelineEventFilter* filter);
   void PrintTraceEvent(JSONStream* js, TimelineEventFilter* filter);
diff --git a/runtime/vm/timeline_test.cc b/runtime/vm/timeline_test.cc
index 2266898..aa2972f 100644
--- a/runtime/vm/timeline_test.cc
+++ b/runtime/vm/timeline_test.cc
@@ -91,7 +91,7 @@
     event->Complete();
   }
 
-  static void Clear(TimelineEventEndlessRecorder* recorder) {
+  static void Clear(TimelineEventRecorder* recorder) {
     ASSERT(recorder != NULL);
     recorder->Clear();
   }
@@ -343,6 +343,8 @@
   EXPECT_EQ(0, recorder->CountFor(TimelineEvent::kAsyncEnd));
   event->Complete();
   EXPECT_EQ(1, recorder->CountFor(TimelineEvent::kAsyncEnd));
+
+  delete recorder;
 }
 
 
@@ -466,6 +468,9 @@
     EXPECT(LabelMatch(it.Next(), "F"));
     EXPECT(!it.HasNext());
   }
+
+  TimelineTestHelper::Clear(recorder);
+  delete recorder;
 }
 
 
@@ -502,6 +507,9 @@
   const char* alpha = strstr(js.ToCString(), "Alpha");
   const char* beta = strstr(js.ToCString(), "Beta");
   EXPECT(alpha < beta);
+
+  TimelineTestHelper::Clear(recorder);
+  delete recorder;
 }
 
 
@@ -674,6 +682,8 @@
     EXPECT_EQ(8, pauses.MaxExclusiveTime("a"));
   }
   TimelineTestHelper::Clear(recorder);
+
+  delete recorder;
 }
 
 
@@ -884,6 +894,8 @@
     EXPECT(pauses.has_error());
   }
   TimelineTestHelper::Clear(recorder);
+
+  delete recorder;
 }
 
 #endif  // !PRODUCT
diff --git a/runtime/vm/timer.h b/runtime/vm/timer.h
index 1cf28c9..908fa6e 100644
--- a/runtime/vm/timer.h
+++ b/runtime/vm/timer.h
@@ -23,7 +23,7 @@
 
   // Start timer.
   void Start() {
-    start_ = OS::GetCurrentTimeMicros();
+    start_ = OS::GetCurrentMonotonicMicros();
     running_ = true;
   }
 
@@ -31,7 +31,7 @@
   void Stop() {
     ASSERT(start_ != 0);
     ASSERT(running());
-    stop_ = OS::GetCurrentTimeMicros();
+    stop_ = OS::GetCurrentMonotonicMicros();
     int64_t elapsed = ElapsedMicros();
     max_contiguous_ = Utils::Maximum(max_contiguous_, elapsed);
     // Make increment atomic in case it occurs in parallel with aggregation.
@@ -43,7 +43,7 @@
   int64_t TotalElapsedTime() const {
     int64_t result = total_;
     if (running_) {
-      int64_t now = OS::GetCurrentTimeMicros();
+      int64_t now = OS::GetCurrentMonotonicMicros();
       result += (now - start_);
     }
     return result;
@@ -52,7 +52,7 @@
   int64_t MaxContiguous() const {
     int64_t result = max_contiguous_;
     if (running_) {
-      int64_t now = OS::GetCurrentTimeMicros();
+      int64_t now = OS::GetCurrentMonotonicMicros();
       result = Utils::Maximum(result, now - start_);
     }
     return result;
diff --git a/runtime/vm/token.h b/runtime/vm/token.h
index 3d2e821..376796f 100644
--- a/runtime/vm/token.h
+++ b/runtime/vm/token.h
@@ -155,6 +155,7 @@
   KW(kCLASS, "class", 0, kKeyword)                                             \
   KW(kCONST, "const", 0, kKeyword)                                             \
   KW(kCONTINUE, "continue", 0, kKeyword)                                       \
+  KW(kCOVARIANT, "covariant", 0, kPseudoKeyword)                               \
   KW(kDEFAULT, "default", 0, kKeyword)                                         \
   KW(kDO, "do", 0, kKeyword)                                                   \
   KW(kELSE, "else", 0, kKeyword)                                               \
diff --git a/runtime/vm/unit_test.cc b/runtime/vm/unit_test.cc
index c036981..cec6268 100644
--- a/runtime/vm/unit_test.cc
+++ b/runtime/vm/unit_test.cc
@@ -52,10 +52,9 @@
 
 
 Dart_Isolate TestCase::CreateIsolate(const uint8_t* buffer, const char* name) {
-  bin::IsolateData* isolate_data = new bin::IsolateData(name, NULL, NULL);
   char* err;
   Dart_Isolate isolate =
-      Dart_CreateIsolate(name, NULL, buffer, NULL, isolate_data, &err);
+      Dart_CreateIsolate(name, NULL, buffer, NULL, NULL, NULL, &err);
   if (isolate == NULL) {
     OS::Print("Creation of isolate failed '%s'\n", err);
     free(err);
diff --git a/runtime/vm/unit_test.h b/runtime/vm/unit_test.h
index c08f36e..945fd6e 100644
--- a/runtime/vm/unit_test.h
+++ b/runtime/vm/unit_test.h
@@ -11,6 +11,7 @@
 
 #include "vm/ast.h"
 #include "vm/dart.h"
+#include "vm/dart_api_state.h"
 #include "vm/globals.h"
 #include "vm/heap.h"
 #include "vm/isolate.h"
@@ -241,13 +242,11 @@
 
 
 namespace bin {
-// vm_isolate_snapshot_buffer points to a snapshot for the vm isolate if we
-// link in a snapshot otherwise it is initialized to NULL.
-extern const uint8_t* vm_isolate_snapshot_buffer;
-
-// isolate_snapshot_buffer points to a snapshot for an isolate if we link in a
-// snapshot otherwise it is initialized to NULL.
-extern const uint8_t* isolate_snapshot_buffer;
+// Snapshot pieces if we link in a snapshot, otherwise initialized to NULL.
+extern const uint8_t* vm_snapshot_data;
+extern const uint8_t* vm_snapshot_instructions;
+extern const uint8_t* core_isolate_snapshot_data;
+extern const uint8_t* core_isolate_snapshot_instructions;
 }
 
 
@@ -295,7 +294,7 @@
     return CreateIsolate(buffer, name);
   }
   static Dart_Isolate CreateTestIsolate(const char* name = NULL) {
-    return CreateIsolate(bin::isolate_snapshot_buffer, name);
+    return CreateIsolate(bin::core_isolate_snapshot_data, name);
   }
   static Dart_Handle library_handler(Dart_LibraryTag tag,
                                      Dart_Handle library,
@@ -539,6 +538,13 @@
 #define EXPECT_VALID(handle)                                                   \
   do {                                                                         \
     Dart_Handle tmp_handle = (handle);                                         \
+    if (!Api::IsValid(tmp_handle)) {                                           \
+      dart::Expect(__FILE__, __LINE__)                                         \
+          .Fail(                                                               \
+              "expected '%s' to be a valid handle but '%s' has already been "  \
+              "freed\n",                                                       \
+              #handle, #handle);                                               \
+    }                                                                          \
     if (Dart_IsError(tmp_handle)) {                                            \
       dart::Expect(__FILE__, __LINE__)                                         \
           .Fail(                                                               \
diff --git a/runtime/vm/version.h b/runtime/vm/version.h
index 2acf205..5f08dd3 100644
--- a/runtime/vm/version.h
+++ b/runtime/vm/version.h
@@ -13,10 +13,12 @@
  public:
   static const char* String();
   static const char* SnapshotString();
+  static const char* CommitString();
 
  private:
   static const char* str_;
   static const char* snapshot_hash_;
+  static const char* commit_;
 };
 
 }  // namespace dart
diff --git a/runtime/vm/version_in.cc b/runtime/vm/version_in.cc
index d196310..1857ce9 100644
--- a/runtime/vm/version_in.cc
+++ b/runtime/vm/version_in.cc
@@ -26,7 +26,13 @@
   return snapshot_hash_;
 }
 
+
+const char* Version::CommitString() {
+  return commit_;
+}
+
 const char* Version::snapshot_hash_ = "{{SNAPSHOT_HASH}}";
 const char* Version::str_ = "{{VERSION_STR}} ({{BUILD_TIME}})";
+const char* Version::commit_ = "{{VERSION_STR}}";
 
 }  // namespace dart
diff --git a/runtime/vm/virtual_memory.cc b/runtime/vm/virtual_memory.cc
index 1e62f8b..38bb4b3 100644
--- a/runtime/vm/virtual_memory.cc
+++ b/runtime/vm/virtual_memory.cc
@@ -20,7 +20,7 @@
   ASSERT(new_size <= size());
   if (try_unmap &&
       (reserved_size_ == size()) && /* Don't create holes in reservation. */
-      FreeSubSegment(reinterpret_cast<void*>(start() + new_size),
+      FreeSubSegment(handle(), reinterpret_cast<void*>(start() + new_size),
                      size() - new_size)) {
     reserved_size_ = new_size;
   }
@@ -28,12 +28,12 @@
 }
 
 
-VirtualMemory* VirtualMemory::ForExternalPage(void* pointer, uword size) {
+VirtualMemory* VirtualMemory::ForImagePage(void* pointer, uword size) {
   // Memory for precompilated instructions was allocated by the embedder, so
   // create a VirtualMemory without allocating.
   MemoryRegion region(pointer, size);
   VirtualMemory* memory = new VirtualMemory(region);
-  memory->embedder_allocated_ = true;
+  memory->vm_owns_region_ = false;
   return memory;
 }
 
diff --git a/runtime/vm/virtual_memory.h b/runtime/vm/virtual_memory.h
index a26b8ce7..4a7ecd2 100644
--- a/runtime/vm/virtual_memory.h
+++ b/runtime/vm/virtual_memory.h
@@ -64,16 +64,16 @@
   // Commit a reserved memory area, so that the memory can be accessed.
   bool Commit(uword addr, intptr_t size, bool is_executable);
 
-  bool embedder_allocated() const { return embedder_allocated_; }
+  bool vm_owns_region() const { return vm_owns_region_; }
 
-  static VirtualMemory* ForExternalPage(void* pointer, uword size);
+  static VirtualMemory* ForImagePage(void* pointer, uword size);
 
  private:
   static VirtualMemory* ReserveInternal(intptr_t size);
 
   // Free a sub segment. On operating systems that support it this
   // can give back the virtual memory to the system. Returns true on success.
-  static bool FreeSubSegment(void* address, intptr_t size);
+  static bool FreeSubSegment(int32_t handle, void* address, intptr_t size);
 
   // This constructor is only used internally when reserving new virtual spaces.
   // It does not reserve any virtual address space on its own.
@@ -81,7 +81,7 @@
       : region_(region.pointer(), region.size()),
         reserved_size_(region.size()),
         handle_(handle),
-        embedder_allocated_(false) {}
+        vm_owns_region_(true) {}
 
   MemoryRegion region_;
 
@@ -93,8 +93,10 @@
 
   static uword page_size_;
 
-  // True for a region provided by the embedder.
-  bool embedder_allocated_;
+  // False for a part of a snapshot added directly to the Dart heap, which
+  // belongs to the the embedder and must not be deallocated or have its
+  // protection status changed by the VM.
+  bool vm_owns_region_;
 
   DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory);
 };
diff --git a/runtime/vm/virtual_memory_android.cc b/runtime/vm/virtual_memory_android.cc
index 7406d22..6a151b2 100644
--- a/runtime/vm/virtual_memory_android.cc
+++ b/runtime/vm/virtual_memory_android.cc
@@ -54,13 +54,15 @@
 
 
 VirtualMemory::~VirtualMemory() {
-  if (!embedder_allocated()) {
+  if (vm_owns_region()) {
     unmap(address(), reserved_size_);
   }
 }
 
 
-bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
+bool VirtualMemory::FreeSubSegment(int32_t handle,
+                                   void* address,
+                                   intptr_t size) {
   unmap(address, size);
   return true;
 }
diff --git a/runtime/vm/virtual_memory_fuchsia.cc b/runtime/vm/virtual_memory_fuchsia.cc
index bd78bf9..08919db 100644
--- a/runtime/vm/virtual_memory_fuchsia.cc
+++ b/runtime/vm/virtual_memory_fuchsia.cc
@@ -7,15 +7,142 @@
 
 #include "vm/virtual_memory.h"
 
+#include <magenta/status.h>
 #include <magenta/syscalls.h>
-#include <unistd.h>  // NOLINT
+#include <sys/mman.h>
+#include <unistd.h>
 
 #include "platform/assert.h"
+#include "vm/allocation.h"
+#include "vm/growable_array.h"
+#include "vm/isolate.h"
+#include "vm/lockers.h"
 #include "vm/memory_region.h"
 #include "vm/os.h"
+#include "vm/os_thread.h"
+
+// #define VIRTUAL_MEMORY_LOGGING 1
+#if defined(VIRTUAL_MEMORY_LOGGING)
+#define LOG_ERR(msg, ...)                                                      \
+  OS::PrintErr("VMVM: %s:%d: " msg, __FILE__, __LINE__, ##__VA_ARGS__)
+#define LOG_INFO(msg, ...)                                                     \
+  OS::Print("VMVM: %s:%d: " msg, __FILE__, __LINE__, ##__VA_ARGS__)
+#else
+#define LOG_ERR(msg, ...)
+#define LOG_INFO(msg, ...)
+#endif  // defined(VIRTUAL_MEMORY_LOGGING)
 
 namespace dart {
 
+// The Magenta system call to protect memory regions (mx_vmar_protect) takes a
+// VM area (vmar) handle as first argument. We call VirtualMemory::Protect()
+// from the memory freelist code in vm/freelist.cc where the vmar handle is not
+// available. Additionally, there is no mx_vmar system call to retrieve a handle
+// for the leaf vmar given an address. Thus, when memory protections are
+// enabled, we maintain a sorted list of our leaf vmar handles that we can
+// query by address in calls to VirtualMemory::Protect().
+class VmarList : public AllStatic {
+ public:
+  static void AddVmar(mx_handle_t vmar, uword addr, intptr_t size);
+  static void RemoveVmar(uword addr);
+  static mx_handle_t LookupVmar(uword addr);
+
+ private:
+  static intptr_t LookupVmarIndexLocked(uword addr);
+
+  struct VmarListElement {
+    mx_handle_t vmar;
+    uword addr;
+    intptr_t size;
+  };
+
+  static Mutex* vmar_array_lock_;
+  static MallocGrowableArray<VmarListElement> vmar_array_;
+};
+
+Mutex* VmarList::vmar_array_lock_ = new Mutex();
+MallocGrowableArray<VmarList::VmarListElement> VmarList::vmar_array_;
+
+void VmarList::AddVmar(mx_handle_t vmar, uword addr, intptr_t size) {
+  MutexLocker ml(vmar_array_lock_);
+  LOG_INFO("AddVmar(%d, %lx, %ld)\n", vmar, addr, size);
+  // Sorted insert in increasing order.
+  const intptr_t length = vmar_array_.length();
+  intptr_t idx;
+  for (idx = 0; idx < length; idx++) {
+    const VmarListElement& m = vmar_array_.At(idx);
+    if (m.addr >= addr) {
+      break;
+    }
+  }
+#if defined(DEBUG)
+  if ((length > 0) && (idx < (length - 1))) {
+    const VmarListElement& m = vmar_array_.At(idx);
+    ASSERT(m.addr != addr);
+  }
+#endif
+  LOG_INFO("AddVmar(%d, %lx, %ld) at index = %ld\n", vmar, addr, size, idx);
+  VmarListElement new_mapping;
+  new_mapping.vmar = vmar;
+  new_mapping.addr = addr;
+  new_mapping.size = size;
+  vmar_array_.InsertAt(idx, new_mapping);
+}
+
+
+intptr_t VmarList::LookupVmarIndexLocked(uword addr) {
+  // Binary search for the vmar containing addr.
+  intptr_t imin = 0;
+  intptr_t imax = vmar_array_.length();
+  while (imax >= imin) {
+    const intptr_t imid = ((imax - imin) / 2) + imin;
+    const VmarListElement& mapping = vmar_array_.At(imid);
+    if ((mapping.addr + mapping.size) <= addr) {
+      imin = imid + 1;
+    } else if (mapping.addr > addr) {
+      imax = imid - 1;
+    } else {
+      return imid;
+    }
+  }
+  return -1;
+}
+
+
+mx_handle_t VmarList::LookupVmar(uword addr) {
+  MutexLocker ml(vmar_array_lock_);
+  LOG_INFO("LookupVmar(%lx)\n", addr);
+  const intptr_t idx = LookupVmarIndexLocked(addr);
+  if (idx == -1) {
+    LOG_ERR("LookupVmar(%lx) NOT FOUND\n", addr);
+    return MX_HANDLE_INVALID;
+  }
+  LOG_INFO("LookupVmar(%lx) found at %ld\n", addr, idx);
+  return vmar_array_[idx].vmar;
+}
+
+
+void VmarList::RemoveVmar(uword addr) {
+  MutexLocker ml(vmar_array_lock_);
+  LOG_INFO("RemoveVmar(%lx)\n", addr);
+  const intptr_t idx = LookupVmarIndexLocked(addr);
+  ASSERT(idx != -1);
+#if defined(DEBUG)
+  mx_handle_t vmar = vmar_array_[idx].vmar;
+#endif
+  // Swap idx to the end, and then RemoveLast()
+  const intptr_t length = vmar_array_.length();
+  for (intptr_t i = idx; i < length - 1; i++) {
+    vmar_array_.Swap(i, i + 1);
+  }
+#if defined(DEBUG)
+  const VmarListElement& mapping = vmar_array_.Last();
+  ASSERT(mapping.vmar == vmar);
+#endif
+  vmar_array_.RemoveLast();
+}
+
+
 uword VirtualMemory::page_size_ = 0;
 
 
@@ -25,65 +152,128 @@
 
 
 VirtualMemory* VirtualMemory::ReserveInternal(intptr_t size) {
-  mx_handle_t vmo = MX_HANDLE_INVALID;
-  mx_status_t status = mx_vmo_create(size, 0u, &vmo);
+  mx_handle_t vmar = MX_HANDLE_INVALID;
+  uword addr = 0;
+  const uint32_t flags = MX_VM_FLAG_COMPACT | MX_VM_FLAG_CAN_MAP_SPECIFIC |
+                         MX_VM_FLAG_CAN_MAP_READ | MX_VM_FLAG_CAN_MAP_WRITE |
+                         MX_VM_FLAG_CAN_MAP_EXECUTE;
+  mx_status_t status =
+      mx_vmar_allocate(mx_vmar_root_self(), 0, size, flags, &vmar, &addr);
   if (status != NO_ERROR) {
+    LOG_ERR("mx_vmar_allocate(size = %ld) failed: %s\n", size,
+            mx_status_get_string(status));
     return NULL;
   }
-
-  // TODO(zra): map with PERM_NONE, when that works, and relax with
-  // Commit and Protect when they are implemented.
-  // Issue MG-161.
-  const int prot =
-      MX_VM_FLAG_PERM_READ | MX_VM_FLAG_PERM_WRITE | MX_VM_FLAG_PERM_EXECUTE;
-  uintptr_t addr;
-  status = mx_process_map_vm(mx_process_self(), vmo, 0, size, &addr, prot);
-  if (status != NO_ERROR) {
-    mx_handle_close(vmo);
-    FATAL("VirtualMemory::ReserveInternal FAILED");
-    return NULL;
-  }
-
+  VmarList::AddVmar(vmar, addr, size);
   MemoryRegion region(reinterpret_cast<void*>(addr), size);
-  return new VirtualMemory(region, vmo);
+  return new VirtualMemory(region, vmar);
 }
 
 
 VirtualMemory::~VirtualMemory() {
-  if (!embedder_allocated()) {
-    // TODO(zra): Use reserved_size_.
-    // Issue MG-162.
-    uintptr_t addr = reinterpret_cast<uintptr_t>(address());
-    mx_status_t status =
-        mx_process_unmap_vm(mx_process_self(), addr, 0 /*reserved_size_*/);
+  if (vm_owns_region()) {
+    mx_handle_t vmar = static_cast<mx_handle_t>(handle());
+    mx_status_t status = mx_vmar_destroy(vmar);
     if (status != NO_ERROR) {
-      FATAL("VirtualMemory::~VirtualMemory: unamp FAILED");
+      LOG_ERR("mx_vmar_destroy failed: %s\n", mx_status_get_string(status));
     }
-
-    status = mx_handle_close(handle());
+    status = mx_handle_close(vmar);
     if (status != NO_ERROR) {
-      FATAL("VirtualMemory::~VirtualMemory: handle_close FAILED");
+      LOG_ERR("mx_handle_close failed: %s\n", mx_status_get_string(status));
     }
+    VmarList::RemoveVmar(start());
   }
 }
 
 
-bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
-  // TODO(zra): It should be possible to free a subsegment after
-  // Issue MG-162 is addressed.
-  return false;
+bool VirtualMemory::FreeSubSegment(int32_t handle,
+                                   void* address,
+                                   intptr_t size) {
+  mx_handle_t vmar = static_cast<mx_handle_t>(handle);
+  mx_status_t status =
+      mx_vmar_unmap(vmar, reinterpret_cast<uintptr_t>(address), size);
+  if (status != NO_ERROR) {
+    LOG_ERR("mx_vmar_unmap failed: %s\n", mx_status_get_string(status));
+    return false;
+  }
+  return true;
 }
 
 
 bool VirtualMemory::Commit(uword addr, intptr_t size, bool executable) {
-  // TODO(zra): Implement when the protections for a mapping can be changed.
-  // Issue MG-133.
+  ASSERT(Contains(addr));
+  ASSERT(Contains(addr + size) || (addr + size == end()));
+  mx_handle_t vmo = MX_HANDLE_INVALID;
+  mx_status_t status = mx_vmo_create(size, 0u, &vmo);
+  if (status != NO_ERROR) {
+    LOG_ERR("mx_vmo_create(%ld) failed: %s\n", size,
+            mx_status_get_string(status));
+    return false;
+  }
+
+  mx_handle_t vmar = static_cast<mx_handle_t>(handle());
+  const size_t offset = addr - start();
+  const uint32_t flags = MX_VM_FLAG_SPECIFIC | MX_VM_FLAG_PERM_READ |
+                         MX_VM_FLAG_PERM_WRITE |
+                         (executable ? MX_VM_FLAG_PERM_EXECUTE : 0);
+  uintptr_t mapped_addr;
+  status = mx_vmar_map(vmar, offset, vmo, 0, size, flags, &mapped_addr);
+  if (status != NO_ERROR) {
+    mx_handle_close(vmo);
+    LOG_ERR("mx_vmar_map(%ld, %ld, %u) failed: %s\n", offset, size, flags,
+            mx_status_get_string(status));
+    return false;
+  }
+  if (addr != mapped_addr) {
+    mx_handle_close(vmo);
+    LOG_ERR("mx_vmar_map: addr != mapped_addr: %lx != %lx\n", addr,
+            mapped_addr);
+    return false;
+  }
+  mx_handle_close(vmo);
+  LOG_INFO("Commit(%lx, %ld, %s): success\n", addr, size,
+           executable ? "executable" : "");
   return true;
 }
 
 
 bool VirtualMemory::Protect(void* address, intptr_t size, Protection mode) {
-  // TODO(zra): Implement when Fuchsia has an mprotect-like call.
+  ASSERT(Thread::Current()->IsMutatorThread() ||
+         Isolate::Current()->mutator_thread()->IsAtSafepoint());
+  const uword start_address = reinterpret_cast<uword>(address);
+  const uword end_address = start_address + size;
+  const uword page_address = Utils::RoundDown(start_address, PageSize());
+  mx_handle_t vmar = VmarList::LookupVmar(page_address);
+  ASSERT(vmar != MX_HANDLE_INVALID);
+  uint32_t prot = 0;
+  switch (mode) {
+    case kNoAccess:
+      // MG-426: mx_vmar_protect() requires at least on permission.
+      prot = MX_VM_FLAG_PERM_READ;
+      break;
+    case kReadOnly:
+      prot = MX_VM_FLAG_PERM_READ;
+      break;
+    case kReadWrite:
+      prot = MX_VM_FLAG_PERM_READ | MX_VM_FLAG_PERM_WRITE;
+      break;
+    case kReadExecute:
+      prot = MX_VM_FLAG_PERM_READ | MX_VM_FLAG_PERM_EXECUTE;
+      break;
+    case kReadWriteExecute:
+      prot = MX_VM_FLAG_PERM_READ | MX_VM_FLAG_PERM_WRITE |
+             MX_VM_FLAG_PERM_EXECUTE;
+      break;
+  }
+  mx_status_t status =
+      mx_vmar_protect(vmar, page_address, end_address - page_address, prot);
+  if (status != NO_ERROR) {
+    LOG_ERR("mx_vmar_protect(%lx, %lx, %x) success: %s\n", page_address,
+            end_address - page_address, prot, mx_status_get_string(status));
+    return false;
+  }
+  LOG_INFO("mx_vmar_protect(%lx, %lx, %x) success\n", page_address,
+           end_address - page_address, prot);
   return true;
 }
 
diff --git a/runtime/vm/virtual_memory_linux.cc b/runtime/vm/virtual_memory_linux.cc
index be3655f..cc57139 100644
--- a/runtime/vm/virtual_memory_linux.cc
+++ b/runtime/vm/virtual_memory_linux.cc
@@ -53,13 +53,15 @@
 
 
 VirtualMemory::~VirtualMemory() {
-  if (!embedder_allocated()) {
+  if (vm_owns_region()) {
     unmap(address(), reserved_size_);
   }
 }
 
 
-bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
+bool VirtualMemory::FreeSubSegment(int32_t handle,
+                                   void* address,
+                                   intptr_t size) {
   unmap(address, size);
   return true;
 }
diff --git a/runtime/vm/virtual_memory_macos.cc b/runtime/vm/virtual_memory_macos.cc
index 6f42b55..bf77b66 100644
--- a/runtime/vm/virtual_memory_macos.cc
+++ b/runtime/vm/virtual_memory_macos.cc
@@ -54,13 +54,15 @@
 
 
 VirtualMemory::~VirtualMemory() {
-  if (!embedder_allocated()) {
+  if (vm_owns_region()) {
     unmap(address(), reserved_size_);
   }
 }
 
 
-bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
+bool VirtualMemory::FreeSubSegment(int32_t handle,
+                                   void* address,
+                                   intptr_t size) {
   unmap(address, size);
   return true;
 }
diff --git a/runtime/vm/virtual_memory_win.cc b/runtime/vm/virtual_memory_win.cc
index de9156d..0f4b179 100644
--- a/runtime/vm/virtual_memory_win.cc
+++ b/runtime/vm/virtual_memory_win.cc
@@ -35,7 +35,7 @@
 
 
 VirtualMemory::~VirtualMemory() {
-  if (embedder_allocated() || (reserved_size_ == 0)) {
+  if (!vm_owns_region() || (reserved_size_ == 0)) {
     return;
   }
   if (VirtualFree(address(), 0, MEM_RELEASE) == 0) {
@@ -44,7 +44,9 @@
 }
 
 
-bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
+bool VirtualMemory::FreeSubSegment(int32_t handle,
+                                   void* address,
+                                   intptr_t size) {
   // On Windows only the entire segment returned by VirtualAlloc
   // can be freed. Therefore we will have to waste these unused
   // virtual memory sub-segments.
diff --git a/runtime/vm/vm.gypi b/runtime/vm/vm.gypi
index a072f65..1371285 100644
--- a/runtime/vm/vm.gypi
+++ b/runtime/vm/vm.gypi
@@ -30,6 +30,7 @@
     'snapshot_test_in_dat_file': 'snapshot_test_in.dat',
     'snapshot_test_dart_file': 'snapshot_test.dart',
     'typed_data_cc_file': '<(gen_source_dir)/typed_data_gen.cc',
+    'typed_data_patch_cc_file': '<(gen_source_dir)/typed_data_patch_gen.cc',
     'vmservice_cc_file': '<(gen_source_dir)/vmservice_gen.cc',
     'vmservice_patch_cc_file': '<(gen_source_dir)/vmservice_patch_gen.cc',
   },
@@ -60,6 +61,13 @@
             ],
           },
         }],
+        # The following condition should be kept in sync with the corresponding
+        # configurations in runtime/bin/bin.gypi.
+	['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
+          'defines': [
+            'DART_USE_TCMALLOC'
+          ],
+        }],
         ['OS=="android" and _toolset=="host"', {
           'link_settings': {
             'libraries': [
@@ -104,6 +112,13 @@
             ],
           },
         }],
+        # The following condition should be kept in sync with the corresponding
+        # configurations in runtime/bin/bin.gypi.
+        ['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
+          'defines': [
+            'DART_USE_TCMALLOC'
+          ],
+        }],
         ['OS=="android" and _toolset=="host"', {
           'link_settings': {
             'libraries': [
@@ -148,6 +163,13 @@
             ],
           },
         }],
+        # The following condition should be kept in sync with the corresponding
+        # configurations in runtime/bin/bin.gypi.
+        ['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
+          'defines': [
+            'DART_USE_TCMALLOC'
+          ],
+        }],
         ['OS=="android" and _toolset=="host"', {
           'link_settings': {
             'libraries': [
@@ -193,6 +215,13 @@
             ],
           },
         }],
+        # The following condition should be kept in sync with the corresponding
+        # configurations in runtime/bin/bin.gypi.
+        ['OS == "linux" and asan == 0 and msan == 0 and tsan == 0', {
+          'defines': [
+            'DART_USE_TCMALLOC'
+          ],
+        }],
         ['OS=="android" and _toolset=="host"', {
           'link_settings': {
             'libraries': [
@@ -233,6 +262,7 @@
         'generate_mirrors_patch_cc_file#host',
         'generate_profiler_cc_file#host',
         'generate_typed_data_cc_file#host',
+        'generate_typed_data_patch_cc_file#host',
         'generate_vmservice_cc_file#host',
         'generate_vmservice_patch_cc_file#host',
       ],
@@ -271,6 +301,7 @@
         '<(mirrors_patch_cc_file)',
         '<(profiler_cc_file)',
         '<(typed_data_cc_file)',
+        '<(typed_data_patch_cc_file)',
         '<(vmservice_cc_file)',
         '<(vmservice_patch_cc_file)',
       ],
@@ -967,16 +998,12 @@
       ]
     },
     {
-      # Unlike the other libraries in the SDK, dart:typed_data is not
-      # implemented as a patch applied to the base SDK implementation.
-      # Instead the VM has a complete replacement library and the
-      # implementation in the SDK is ignored.
       'target_name': 'generate_typed_data_cc_file',
       'type': 'none',
       'toolsets':['host'],
       'includes': [
         # Load the runtime implementation sources.
-        '../lib/typed_data_sources.gypi',
+        '../../sdk/lib/typed_data/typed_data_sources.gypi',
       ],
       'sources/': [
         # Exclude all .[cc|h] files.
@@ -1011,6 +1038,46 @@
       ]
     },
     {
+      'target_name': 'generate_typed_data_patch_cc_file',
+      'type': 'none',
+      'toolsets':['host'],
+      'includes': [
+        # Load the patch sources.
+        '../lib/typed_data_sources.gypi',
+      ],
+      'sources/': [
+        # Exclude all .[cc|h] files.
+        # This is only here for reference. Excludes happen after
+        # variable expansion, so the script has to do its own
+        # exclude processing of the sources being passed.
+        ['exclude', '\\.cc|h$'],
+      ],
+      'actions': [
+        {
+          'action_name': 'generate_typed_data_patch_cc',
+          'inputs': [
+            '../tools/gen_library_src_paths.py',
+            '<(libgen_in_cc_file)',
+            '<@(_sources)',
+          ],
+          'outputs': [
+            '<(typed_data_patch_cc_file)',
+          ],
+          'action': [
+            'python',
+            'tools/gen_library_src_paths.py',
+            '--output', '<(typed_data_patch_cc_file)',
+            '--input_cc', '<(libgen_in_cc_file)',
+            '--include', 'vm/bootstrap.h',
+            '--var_name', 'dart::Bootstrap::typed_data_patch_paths_',
+            '--library_name', 'dart:typed_data',
+            '<@(_sources)',
+          ],
+          'message': 'Generating ''<(typed_data_patch_cc_file)'' file.'
+        },
+      ]
+    },
+    {
       'target_name': 'generate_profiler_cc_file',
       'type': 'none',
       'toolsets':['host'],
@@ -1255,20 +1322,17 @@
         'generate_math_library_patch',
         'generate_mirrors_library_patch',
         'generate_profiler_library_patch',
+        'generate_typed_data_library_patch',
         'generate_vmservice_library_patch',
       ],
       'actions': [
         {
           'action_name': 'patch_sdk',
           'inputs': [
-            '<!@(["python", "../tools/list_files.py",' '"dart$",' '"sdk/lib"])',
+            '<!@(["python", "../tools/list_files.py", "relative",'
+                  '"dart$", "sdk/lib"])',
             '../../tools/patch_sdk.py',
             '../../tools/patch_sdk.dart',
-            # Unlike the other libraries in the SDK, dart:typed_data is not
-            # implemented as a patch applied to the base SDK implementation.
-            # Instead the VM has a complete replacement library and the
-            # implementation in the SDK is ignored.
-            '../lib/typed_data.dart',
             # Unlike the other libraries in the SDK, dart:_builtin and
             # dart:nativewrappers are only available for the Dart VM.
             '../bin/builtin.dart',
@@ -1286,6 +1350,7 @@
             '<(gen_source_dir)/patches/math_patch.dart',
             '<(gen_source_dir)/patches/mirrors_patch.dart',
             '<(gen_source_dir)/patches/profiler_patch.dart',
+            '<(gen_source_dir)/patches/typed_data_patch.dart',
             '<(gen_source_dir)/patches/vmservice_patch.dart',
           ],
           'outputs': [
@@ -1659,6 +1724,38 @@
     },
     {
       'variables': {
+        'library_name': 'typed_data',
+        'library_uri': 'dart:typed_data',
+      },
+      'target_name': 'generate_<(library_name)_library_patch',
+      'type': 'none',
+      'toolsets': ['host'],
+      'includes': [
+        '../lib/typed_data_sources.gypi',
+      ],
+      'actions': [
+        {
+          'action_name': 'concatenate_<(library_name)_patches',
+          'inputs': [
+            '../tools/concatenate_patches.py',
+            '<@(_sources)',
+          ],
+          'outputs': [
+            '<(gen_source_dir)/patches/<(library_name)_patch.dart'
+          ],
+          'action': [
+            'python',
+            'tools/concatenate_patches.py',
+            '--output',
+            '<(gen_source_dir)/patches/<(library_name)_patch.dart',
+            '<@(_sources)',
+          ],
+          'message': 'Generating <(library_uri) patch.',
+        },
+      ],
+    },
+    {
+      'variables': {
         'library_name': 'vmservice',
         'library_uri': 'dart:_vmservice',
       },
diff --git a/runtime/vm/vm_sources.gypi b/runtime/vm/vm_sources.gypi
index 83b325f..e75af23 100644
--- a/runtime/vm/vm_sources.gypi
+++ b/runtime/vm/vm_sources.gypi
@@ -269,9 +269,12 @@
     'isolate_test.cc',
     'jit_optimizer.cc',
     'jit_optimizer.h',
+    'json_parser.h',
     'json_stream.h',
     'json_stream.cc',
     'json_test.cc',
+    'kernel_isolate.cc',
+    'kernel_isolate.h',
     'locations.cc',
     'locations.h',
     'lockers.cc',
@@ -282,6 +285,9 @@
     'longjump.cc',
     'longjump.h',
     'longjump_test.cc',
+    'malloc_hooks.cc',
+    'malloc_hooks_unsupported.cc',
+    'malloc_hooks.h',
     'megamorphic_cache_table.cc',
     'megamorphic_cache_table.h',
     'memory_region.cc',
@@ -362,6 +368,8 @@
     'port_test.cc',
     'precompiler.cc',
     'precompiler.h',
+    'program_visitor.cc',
+    'program_visitor.h',
     'kernel.h',
     'kernel.cc',
     'kernel_binary.cc',
diff --git a/runtime/vm/zone.cc b/runtime/vm/zone.cc
index 45314dc..b4c8e31 100644
--- a/runtime/vm/zone.cc
+++ b/runtime/vm/zone.cc
@@ -6,6 +6,7 @@
 
 #include "platform/assert.h"
 #include "platform/utils.h"
+#include "vm/dart_api_state.h"
 #include "vm/flags.h"
 #include "vm/handles_impl.h"
 #include "vm/heap.h"
@@ -43,7 +44,14 @@
 
 void Zone::Segment::DeleteSegmentList(Segment* head) {
   Segment* current = head;
+  Thread* current_thread = Thread::Current();
   while (current != NULL) {
+    if (current_thread != NULL) {
+      current_thread->DecrementMemoryUsage(current->size());
+    } else if (ApiNativeScope::Current() != NULL) {
+      // If there is no current thread, we might be inside of a native scope.
+      ApiNativeScope::DecrementNativeScopeMemoryUsage(current->size());
+    }
     Segment* next = current->next();
 #ifdef DEBUG
     // Zap the entire current segment (including the header).
@@ -68,10 +76,19 @@
 #endif
   result->next_ = next;
   result->size_ = size;
+  Thread* current = Thread::Current();
+  if (current != NULL) {
+    current->IncrementMemoryUsage(size);
+  } else if (ApiNativeScope::Current() != NULL) {
+    // If there is no current thread, we might be inside of a native scope.
+    ApiNativeScope::IncrementNativeScopeMemoryUsage(size);
+  }
   return result;
 }
 
-
+// TODO(bkonyi): We need to account for the initial chunk size when a new zone
+// is created within a new thread or ApiNativeScope when calculating high
+// watermarks or memory consumption.
 Zone::Zone()
     : initial_buffer_(buffer_, kInitialChunkSize),
       position_(initial_buffer_.start()),
@@ -106,7 +123,6 @@
   if (large_segments_ != NULL) {
     Segment::DeleteSegmentList(large_segments_);
   }
-
 // Reset zone state.
 #ifdef DEBUG
   memset(initial_buffer_.pointer(), kZapDeletedByte, initial_buffer_.size());
@@ -136,6 +152,22 @@
 }
 
 
+intptr_t Zone::CapacityInBytes() const {
+  intptr_t size = 0;
+  for (Segment* s = large_segments_; s != NULL; s = s->next()) {
+    size += s->size();
+  }
+  if (head_ == NULL) {
+    return size + initial_buffer_.size();
+  }
+  size += initial_buffer_.size();
+  for (Segment* s = head_; s != NULL; s = s->next()) {
+    size += s->size();
+  }
+  return size;
+}
+
+
 uword Zone::AllocateExpand(intptr_t size) {
   ASSERT(size >= 0);
   if (FLAG_trace_zones) {
@@ -260,6 +292,18 @@
 }
 
 
+#ifndef PRODUCT
+void Zone::PrintJSON(JSONStream* stream) const {
+  JSONObject jsobj(stream);
+  intptr_t capacity = CapacityInBytes();
+  intptr_t used_size = SizeInBytes();
+  jsobj.AddProperty("type", "_Zone");
+  jsobj.AddProperty("capacity", capacity);
+  jsobj.AddProperty("used", used_size);
+}
+#endif
+
+
 StackZone::StackZone(Thread* thread) : StackResource(thread), zone_() {
   if (FLAG_trace_zones) {
     OS::PrintErr("*** Starting a new Stack zone 0x%" Px "(0x%" Px ")\n",
diff --git a/runtime/vm/zone.h b/runtime/vm/zone.h
index 4e2e8a9..d73398b 100644
--- a/runtime/vm/zone.h
+++ b/runtime/vm/zone.h
@@ -8,6 +8,7 @@
 #include "platform/utils.h"
 #include "vm/allocation.h"
 #include "vm/handles.h"
+#include "vm/json_stream.h"
 #include "vm/thread.h"
 #include "vm/memory_region.h"
 
@@ -65,6 +66,9 @@
   // due to internal fragmentation in the segments.
   intptr_t SizeInBytes() const;
 
+  // Computes the amount of space used in the zone.
+  intptr_t CapacityInBytes() const;
+
   // Structure for managing handles allocation.
   VMHandles* handles() { return &handles_; }
 
@@ -72,6 +76,10 @@
 
   Zone* previous() const { return previous_; }
 
+#ifndef PRODUCT
+  void PrintJSON(JSONStream* stream) const;
+#endif
+
  private:
   Zone();
   ~Zone();  // Delete all memory associated with the zone.
@@ -174,6 +182,9 @@
   // due to internal fragmentation in the segments.
   intptr_t SizeInBytes() const { return zone_.SizeInBytes(); }
 
+  // Computes the used space in the zone.
+  intptr_t CapacityInBytes() const { return zone_.CapacityInBytes(); }
+
   Zone* GetZone() { return &zone_; }
 
  private:
diff --git a/runtime/vm/zone_test.cc b/runtime/vm/zone_test.cc
index 4cb9231..21b50c0 100644
--- a/runtime/vm/zone_test.cc
+++ b/runtime/vm/zone_test.cc
@@ -14,8 +14,8 @@
 #if defined(DEBUG)
   FLAG_trace_zones = true;
 #endif
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   Thread* thread = Thread::Current();
   EXPECT(thread->zone() == NULL);
   {
@@ -76,8 +76,8 @@
 #if defined(DEBUG)
   FLAG_trace_zones = true;
 #endif
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   Thread* thread = Thread::Current();
   EXPECT(thread->zone() == NULL);
   {
@@ -100,8 +100,8 @@
 #if defined(DEBUG)
   FLAG_trace_zones = true;
 #endif
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   Thread* thread = Thread::Current();
   EXPECT(thread->zone() == NULL);
   {
@@ -119,8 +119,8 @@
 #if defined(DEBUG)
   FLAG_trace_zones = true;
 #endif
-  Dart_CreateIsolate(NULL, NULL, bin::isolate_snapshot_buffer, NULL, NULL,
-                     NULL);
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
   Thread* thread = Thread::Current();
   EXPECT(thread->zone() == NULL);
   static int marker;
@@ -169,4 +169,79 @@
   EXPECT_STREQ("Hello World!", result);
 }
 
+
+#ifndef PRODUCT
+UNIT_TEST_CASE(PrintZoneMemoryInfoToJSON) {
+#if defined(DEBUG)
+  FLAG_trace_zones = true;
+#endif
+  Dart_CreateIsolate(NULL, NULL, bin::core_isolate_snapshot_data,
+                     bin::core_isolate_snapshot_instructions, NULL, NULL, NULL);
+  Thread* thread = Thread::Current();
+  EXPECT(thread->zone() == NULL);
+  {
+    StackZone zone(thread);
+    StackZone string_stack_zone(thread);
+    EXPECT(thread->zone() != NULL);
+
+    intptr_t allocated_size = 0;
+    const intptr_t kNumElements = 1000;
+
+    zone.GetZone()->Alloc<uint32_t>(kNumElements);
+    allocated_size += sizeof(uint32_t) * kNumElements;
+
+    EXPECT_LE(allocated_size, zone.SizeInBytes());
+    {
+      JSONStream stream;
+      // Get the JSON formated zone information.
+      zone.GetZone()->PrintJSON(&stream);
+      const char* json = stream.ToCString();
+      // Ensure that  matches actual values.
+      char* size_buf =
+          OS::SCreate(string_stack_zone.GetZone(), "\"capacity\":%" Pd
+                                                   ","
+                                                   "\"used\":%" Pd "",
+                      zone.CapacityInBytes(), zone.SizeInBytes());
+      EXPECT_LE(zone.SizeInBytes(), zone.CapacityInBytes());
+      EXPECT_SUBSTRING(size_buf, json);
+    }
+
+    // Expand the zone to ensure that JSON is updated accordingly.
+    zone.GetZone()->Alloc<uint32_t>(kNumElements);
+    allocated_size += sizeof(uint32_t) * kNumElements;
+    EXPECT_LE(allocated_size, zone.SizeInBytes());
+    {
+      JSONStream stream;
+      zone.GetZone()->PrintJSON(&stream);
+      const char* json = stream.ToCString();
+      char* size_buf =
+          OS::SCreate(string_stack_zone.GetZone(), "\"capacity\":%" Pd
+                                                   ","
+                                                   "\"used\":%" Pd "",
+                      zone.CapacityInBytes(), zone.SizeInBytes());
+      EXPECT_LE(zone.SizeInBytes(), zone.CapacityInBytes());
+      EXPECT_SUBSTRING(size_buf, json);
+    }
+  }
+  EXPECT(thread->zone() == NULL);
+  Dart_ShutdownIsolate();
+}
+#endif
+
+
+UNIT_TEST_CASE(NativeScopeZoneAllocation) {
+  ASSERT(ApiNativeScope::Current() == NULL);
+  ASSERT(Thread::Current() == NULL);
+  EXPECT_EQ(0, ApiNativeScope::current_memory_usage());
+  {
+    ApiNativeScope scope;
+    EXPECT_EQ(scope.zone()->CapacityInBytes(),
+              ApiNativeScope::current_memory_usage());
+    (void)Dart_ScopeAllocate(2048);
+    EXPECT_EQ(scope.zone()->CapacityInBytes(),
+              ApiNativeScope::current_memory_usage());
+  }
+  EXPECT_EQ(0, ApiNativeScope::current_memory_usage());
+}
+
 }  // namespace dart
diff --git a/samples/samples.status b/samples/samples.status
index 2b249fd..caf91ca 100644
--- a/samples/samples.status
+++ b/samples/samples.status
@@ -23,5 +23,5 @@
 [ $compiler == precompiler ]
 sample_extension/test/*: Skip # These tests attempt to spawn another script using the precompiled runtime.
 
-[ $runtime == dart_app ]
+[ $compiler == app_jit ]
 sample_extension/test/*: Skip # Shared use of a temp directory
diff --git a/sdk/lib/_blink/dartium/_blink_dartium.dart b/sdk/lib/_blink/dartium/_blink_dartium.dart
index bb80827..eb77a67 100644
--- a/sdk/lib/_blink/dartium/_blink_dartium.dart
+++ b/sdk/lib/_blink/dartium/_blink_dartium.dart
@@ -7,8 +7,10 @@
  */
 library dart.dom._blink;
 
+import 'dart:async';
 import 'dart:js' as js;
 import 'dart:html' show DomException;
+import 'dart:_internal' as internal;
 
 // This is a place to put custom renames if we need them.
 final resolverMap = {
@@ -23275,6 +23277,15 @@
 
   static register(document, tag, customType, extendsTagName) native "Utils_register";
 
+  // Below code sets up VMLibraryHooks for resolvePackageUri.
+  static Uri resolvePackageUri(Uri packageUri) native "Utils_resolvePackageUri";
+  static Future<Uri> _resolvePackageUriFuture(Uri packageUri) async {
+      return resolvePackageUri(packageUri);
+  }
+  static void _setupHooks() {
+    internal.VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture;
+  }
+
   // Defines an interceptor if there is an appropriate JavaScript prototype to define it on.
   // In any case, returns a typed JS wrapper compatibile with dart:html and the new
   // typed JS Interop.
diff --git a/sdk/lib/_internal/js_runtime/lib/constant_map.dart b/sdk/lib/_internal/js_runtime/lib/constant_map.dart
index 9e98b13..693197b 100644
--- a/sdk/lib/_internal/js_runtime/lib/constant_map.dart
+++ b/sdk/lib/_internal/js_runtime/lib/constant_map.dart
@@ -98,8 +98,8 @@
   _fetch(key) => jsPropertyAccess(_jsObject, key);
 
   void forEach(void f(K key, V value)) {
-    // Use a JS 'cast' to get efficient loop.  Type inferrence doesn't get this
-    // since constant map representation is chosen after type inferrence and the
+    // Use a JS 'cast' to get efficient loop.  Type inference doesn't get this
+    // since constant map representation is chosen after type inference and the
     // instantiation is shortcut by the compiler.
     var keys = _keysArray;
     for (int i = 0; i < keys.length; i++) {
diff --git a/sdk/lib/_internal/js_runtime/lib/convert_patch.dart b/sdk/lib/_internal/js_runtime/lib/convert_patch.dart
index 1b987ed..65395a8 100644
--- a/sdk/lib/_internal/js_runtime/lib/convert_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/convert_patch.dart
@@ -382,7 +382,7 @@
   final Sink<Object> _sink;
 
   _JsonDecoderSink(this._reviver, this._sink)
-      : super(new StringBuffer());
+      : super(new StringBuffer(''));
 
   void close() {
     super.close();
@@ -397,7 +397,7 @@
 
 @patch class Utf8Decoder {
   @patch
-  Converter<List<int>,dynamic> fuse(Converter<String, dynamic> next) {
+  Converter<List<int>, T> fuse<T>(Converter<String, T> next) {
     return super.fuse(next);
   }
 
diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
index 5c5ec25..af96764 100644
--- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
@@ -20,7 +20,8 @@
                               patch_startup,
                               Primitives,
                               stringJoinUnchecked,
-                              getTraceFromException;
+                              getTraceFromException,
+                              RuntimeError;
 
 import 'dart:_foreign_helper' show JS;
 
@@ -46,6 +47,9 @@
 @patch
 class Object {
   @patch
+  bool operator==(other) => identical(this, other);
+
+  @patch
   int get hashCode => Primitives.objectHashCode(this);
 
 
@@ -65,6 +69,12 @@
   Type get runtimeType => getRuntimeType(this);
 }
 
+@patch
+class Null {
+  @patch
+  int get hashCode => super.hashCode;
+}
+
 // Patch for Function implementation.
 @patch
 class Function {
@@ -206,6 +216,18 @@
   StackTrace get stackTrace => Primitives.extractStackTrace(this);
 }
 
+@patch
+class FallThroughError {
+  @patch
+  String toString() => super.toString();
+}
+
+@patch
+class AbstractClassInstantiationError {
+  @patch
+  String toString() => "Cannot instantiate abstract class: '$_className'";
+}
+
 // Patch for DateTime implementation.
 @patch
 class DateTime {
@@ -460,6 +482,9 @@
     throw new UnsupportedError(
         'bool.fromEnvironment can only be used as a const constructor');
   }
+
+  @patch
+  int get hashCode => super.hashCode;
 }
 
 @patch
@@ -475,6 +500,7 @@
 }
 
 // Patch for 'identical' function.
+@NoInline() // No inlining since we recognize the call in optimizer.
 @patch
 bool identical(Object a, Object b) {
   return JS('bool', '(# == null ? # == null : # === #)', a, b, a, b);
@@ -547,8 +573,20 @@
 @patch
 class NoSuchMethodError {
   @patch
+  NoSuchMethodError(Object receiver,
+                    Symbol memberName,
+                    List positionalArguments,
+                    Map<Symbol, dynamic> namedArguments,
+                    [List existingArgumentNames = null])
+      : _receiver = receiver,
+        _memberName = memberName,
+        _arguments = positionalArguments,
+        _namedArguments = namedArguments,
+        _existingArgumentNames = existingArgumentNames;
+
+  @patch
   String toString() {
-    StringBuffer sb = new StringBuffer();
+    StringBuffer sb = new StringBuffer('');
     String comma = '';
     if (_arguments != null) {
       for (var argument in _arguments) {
@@ -620,7 +658,7 @@
 
     // Encode the string into bytes then generate an ASCII only string
     // by percent encoding selected bytes.
-    StringBuffer result = new StringBuffer();
+    StringBuffer result = new StringBuffer('');
     var bytes = encoding.encode(text);
     for (int i = 0; i < bytes.length; i++) {
       int byte = bytes[i];
@@ -667,3 +705,96 @@
     }
   }
 }
+
+// Called from kernel generated code.
+_malformedTypeError(message) => new RuntimeError(message);
+
+// Called from kernel generated code.
+_genericNoSuchMethod(receiver, memberName, positionalArguments, namedArguments,
+    existingArguments) {
+  return new NoSuchMethodError(
+      receiver,
+      memberName,
+      positionalArguments,
+      namedArguments);
+}
+
+// Called from kernel generated code.
+_unresolvedConstructorError(receiver, memberName, positionalArguments,
+    namedArguments, existingArguments) {
+  // TODO(sra): Generate an error that reads:
+  //
+  //     No constructor '$memberName' declared in class '$receiver'.
+
+  return new NoSuchMethodError(
+      receiver,
+      memberName,
+      positionalArguments,
+      namedArguments);
+}
+
+// Called from kernel generated code.
+_unresolvedStaticGetterError(receiver, memberName, positionalArguments,
+    namedArguments, existingArguments) {
+  // TODO(sra): Generate customized message.
+  return new NoSuchMethodError(
+      receiver,
+      memberName,
+      positionalArguments,
+      namedArguments);
+}
+
+// Called from kernel generated code.
+_unresolvedStaticSetterError(receiver, memberName, positionalArguments,
+    namedArguments, existingArguments) {
+  // TODO(sra): Generate customized message.
+  return new NoSuchMethodError(
+      receiver,
+      memberName,
+      positionalArguments,
+      namedArguments);
+}
+
+// Called from kernel generated code.
+_unresolvedStaticMethodError(receiver, memberName, positionalArguments,
+    namedArguments, existingArguments) {
+  // TODO(sra): Generate customized message.
+  return new NoSuchMethodError(
+      receiver,
+      memberName,
+      positionalArguments,
+      namedArguments);
+}
+
+// Called from kernel generated code.
+_unresolvedTopLevelGetterError(receiver, memberName, positionalArguments,
+    namedArguments, existingArguments) {
+  // TODO(sra): Generate customized message.
+  return new NoSuchMethodError(
+      receiver,
+      memberName,
+      positionalArguments,
+      namedArguments);
+}
+
+// Called from kernel generated code.
+_unresolvedTopLevelSetterError(receiver, memberName, positionalArguments,
+    namedArguments, existingArguments) {
+  // TODO(sra): Generate customized message.
+  return new NoSuchMethodError(
+      receiver,
+      memberName,
+      positionalArguments,
+      namedArguments);
+}
+
+// Called from kernel generated code.
+_unresolvedTopLevelMethodError(receiver, memberName, positionalArguments,
+    namedArguments, existingArguments) {
+  // TODO(sra): Generate customized message.
+  return new NoSuchMethodError(
+      receiver,
+      memberName,
+      positionalArguments,
+      namedArguments);
+}
diff --git a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
index 541658b..4cefe98 100644
--- a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
@@ -46,7 +46,7 @@
 }
 
 @patch
-_postEvent(String eventKind, String eventData) {
+void _postEvent(String eventKind, String eventData) {
   // TODO.
 }
 
@@ -129,4 +129,51 @@
 @patch
 String _getIsolateIDFromSendPort(SendPort sendPort) {
   return null;
-}
\ No newline at end of file
+}
+
+@patch
+class UserTag {
+  @patch
+  factory UserTag(String label) = _FakeUserTag;
+
+  @patch
+  static UserTag get defaultTag => _FakeUserTag._defaultTag;
+}
+
+class _FakeUserTag implements UserTag {
+  static Map _instances = {};
+
+  _FakeUserTag.real(this.label);
+
+  factory _FakeUserTag(String label) {
+    // Canonicalize by name.
+    var existingTag = _instances[label];
+    if (existingTag != null) {
+      return existingTag;
+    }
+    // Throw an exception if we've reached the maximum number of user tags.
+    if (_instances.length == UserTag.MAX_USER_TAGS) {
+      throw new UnsupportedError(
+          'UserTag instance limit (${UserTag.MAX_USER_TAGS}) reached.');
+    }
+    // Create a new instance and add it to the instance map.
+    var instance = new _FakeUserTag.real(label);
+    _instances[label] = instance;
+    return instance;
+  }
+
+  final String label;
+
+  UserTag makeCurrent() {
+    var old = _currentTag;
+    _currentTag = this;
+    return old;
+  }
+
+  static final UserTag _defaultTag = new _FakeUserTag('Default');
+}
+
+var _currentTag = _FakeUserTag._defaultTag;
+
+@patch
+UserTag getCurrentTag() => _currentTag;
diff --git a/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart b/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
index b298e0d..f321f39 100644
--- a/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
@@ -7,7 +7,7 @@
 import 'dart:_js_embedded_names' show JsGetName, JsBuiltin;
 
 /**
- * Emits a JavaScript code fragment parameterized by arguments.
+ * Emits a JavaScript code fragment parametrized by arguments.
  *
  * Hash characters `#` in the [codeTemplate] are replaced in left-to-right order
  * with expressions that contain the values of, or evaluate to, the arguments.
diff --git a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
index a0c519f..8fc8acf 100644
--- a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
@@ -22,6 +22,9 @@
     JS('', '#._hashCode = #', this, hash);
     return hash;
   }
+
+  @patch
+  toString() => 'Symbol("$_name")';
 }
 
 @patch
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index 9368930..86e80d8 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -154,6 +154,15 @@
                     JS_GET_NAME(JsGetName.FUNCTION_CLASS_TYPE_NAME));
 }
 
+/// Returns true if the given [type] is _the_ `Null` type.
+@ForceInline()
+bool isNullType(Object type) {
+  return JS_BUILTIN('returns:bool;effects:none;depends:none',
+      JsBuiltin.isGivenTypeRti,
+      type,
+      JS_GET_NAME(JsGetName.NULL_CLASS_TYPE_NAME));
+}
+
 /// Returns whether the given type is _the_ Dart Object type.
 // TODO(floitsch): move this to foreign_helper.dart or similar.
 @ForceInline()
@@ -670,11 +679,14 @@
     if (JS('bool', 'typeof # == "number"', functionType)) {
       return getType(functionType);
     } else if (JS('bool', 'typeof # == "function"', functionType)) {
-      var fakeInstance = JS('', 'new #()', jsConstructor);
-      setRuntimeTypeInfo(
-          fakeInstance, JS('JSExtendableArray', '#["<>"]', fakeInstance));
-      return JS('=Object|Null', r'#.apply({$receiver:#})',
-                functionType, fakeInstance);
+      if (jsConstructor != null) {
+        var fakeInstance = JS('', 'new #()', jsConstructor);
+        setRuntimeTypeInfo(
+            fakeInstance, JS('JSExtendableArray', '#["<>"]', fakeInstance));
+        return JS('=Object|Null', r'#.apply({$receiver:#})',
+                  functionType, fakeInstance);
+      }
+      return functionType;
     } else {
       throw new RuntimeError('Unexpected function type');
     }
@@ -2607,18 +2619,21 @@
                 })(#, #)''',
              RAW_DART_FUNCTION_REF(getType),
              functionType);
-    } else if (!isStatic
-               && JS('bool', 'typeof # == "function"', functionType)) {
-      var getReceiver = isIntercepted
-          ? RAW_DART_FUNCTION_REF(BoundClosure.receiverOf)
-          : RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
-      signatureFunction = JS(
-        '',
-        'function(f,r){'
-          'return function(){'
-            'return f.apply({\$receiver:r(this)},arguments)'
-          '}'
-        '}(#,#)', functionType, getReceiver);
+    } else if (JS('bool', 'typeof # == "function"', functionType)) {
+      if (isStatic) {
+        signatureFunction = functionType;
+      } else {
+        var getReceiver = isIntercepted
+            ? RAW_DART_FUNCTION_REF(BoundClosure.receiverOf)
+            : RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
+        signatureFunction = JS(
+          '',
+          'function(f,r){'
+            'return function(){'
+              'return f.apply({\$receiver:r(this)},arguments)'
+            '}'
+          '}(#,#)', functionType, getReceiver);
+      }
     } else {
       throw 'Error in reflectionInfo.';
     }
@@ -3394,8 +3409,8 @@
    * Normal cast error caused by a failed type cast.
    */
   CastErrorImplementation(Object actualType, Object expectedType)
-      : message = "CastError: Casting value of type $actualType to"
-                  " incompatible type $expectedType";
+      : message = "CastError: Casting value of type '$actualType' to"
+                  " incompatible type '$expectedType'";
 
   String toString() => message;
 }
@@ -3452,8 +3467,7 @@
  * field that is currently being initialized.
  */
 void throwCyclicInit(String staticName) {
-  throw new CyclicInitializationError(
-      "Cyclic initialization for static $staticName");
+  throw new CyclicInitializationError(staticName);
 }
 
 /**
@@ -3500,7 +3514,7 @@
   /// returns true if [this] is a supertype of [expression].
   @NoInline() @NoSideEffects()
   bool _isTest(expression) {
-    var functionTypeObject = _extractFunctionTypeObjectFrom(expression);
+    var functionTypeObject = extractFunctionTypeObjectFrom(expression);
     return functionTypeObject == null
         ? false
         : isFunctionSubtype(functionTypeObject, toRti());
@@ -3528,12 +3542,12 @@
     if (expression == null) return null;
     if (_isTest(expression)) return expression;
 
-    var self = new FunctionTypeInfoDecoderRing(toRti()).toString();
+    var self = runtimeTypeToString(toRti());
     if (isCast) {
-      var functionTypeObject = _extractFunctionTypeObjectFrom(expression);
+      var functionTypeObject = extractFunctionTypeObjectFrom(expression);
       var pretty;
       if (functionTypeObject != null) {
-        pretty = new FunctionTypeInfoDecoderRing(functionTypeObject).toString();
+        pretty = runtimeTypeToString(functionTypeObject);
       } else {
         pretty = Primitives.objectTypeName(expression);
       }
@@ -3544,14 +3558,6 @@
     }
   }
 
-  _extractFunctionTypeObjectFrom(o) {
-    var interceptor = getInterceptor(o);
-    var signatureName = JS_GET_NAME(JsGetName.SIGNATURE_NAME);
-    return JS('bool', '# in #', signatureName, interceptor)
-        ? JS('', '#[#]()', interceptor, JS_GET_NAME(JsGetName.SIGNATURE_NAME))
-        : null;
-  }
-
   toRti() {
     var result = createDartFunctionTypeRti();
     if (isVoid) {
@@ -3643,6 +3649,14 @@
   }
 }
 
+extractFunctionTypeObjectFrom(o) {
+  var interceptor = getInterceptor(o);
+  var signatureName = JS_GET_NAME(JsGetName.SIGNATURE_NAME);
+  return JS('bool', '# in #', signatureName, interceptor)
+      ? JS('', '#[#]()', interceptor, signatureName)
+      : null;
+}
+
 RuntimeFunctionType buildFunctionType(returnType,
                                       parameterTypes,
                                       optionalParameterTypes) {
@@ -3802,58 +3816,8 @@
     return const DynamicRuntimeType();
   }
 
-  String _convert(type) {
-    String result = runtimeTypeToString(type);
-    if (result != null) return result;
-    // Currently the [runtimeTypeToString] method doesn't handle function rtis.
-    if (JS('bool', '"func" in #', type)) {
-      return new FunctionTypeInfoDecoderRing(type).toString();
-    } else {
-      throw 'bad type';
-    }
-  }
-
   String toString() {
-    if (_cachedToString != null) return _cachedToString;
-    var s = "(";
-    var sep = '';
-    if (_hasArguments) {
-      for (var argument in _arguments) {
-        s += sep;
-        s += _convert(argument);
-        sep = ', ';
-      }
-    }
-    if (_hasOptionalArguments) {
-      s += '$sep[';
-      sep = '';
-      for (var argument in _optionalArguments) {
-        s += sep;
-        s += _convert(argument);
-        sep = ', ';
-      }
-      s += ']';
-    }
-    if (_hasNamedArguments) {
-      s += '$sep{';
-      sep = '';
-      for (var name in extractKeys(_namedArguments)) {
-        s += sep;
-        s += '$name: ';
-        s += _convert(JS('', '#[#]', _namedArguments, name));
-        sep = ', ';
-      }
-      s += '}';
-    }
-    s += ') -> ';
-    if (_isVoid) {
-      s += 'void';
-    } else if (_hasReturnType) {
-      s += _convert(_returnType);
-    } else {
-      s += 'dynamic';
-    }
-    return _cachedToString = "$s";
+    return _cachedToString ??= runtimeTypeToString(_typeData);
   }
 }
 
@@ -4046,10 +4010,9 @@
 }
 
 class _AssertionError extends AssertionError {
-  final _message;
-  _AssertionError(this._message);
+  _AssertionError(Object message) : super(message);
 
-  String toString() => "Assertion failed: " + Error.safeToString(_message);
+  String toString() => "Assertion failed: " + Error.safeToString(message);
 }
 
 
diff --git a/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart b/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart
index b554437..36924db 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_mirrors.dart
@@ -4,63 +4,60 @@
 
 library dart._js_mirrors;
 
-import 'dart:_js_embedded_names' show
-    JsGetName,
-    ALL_CLASSES,
-    LAZIES,
-    LIBRARIES,
-    STATICS,
-    TYPE_INFORMATION,
-    TYPEDEF_PREDICATE_PROPERTY_NAME,
-    TYPEDEF_TYPE_PROPERTY_NAME;
+import 'dart:_js_embedded_names'
+    show
+        JsGetName,
+        ALL_CLASSES,
+        LAZIES,
+        LIBRARIES,
+        STATICS,
+        TYPE_INFORMATION,
+        TYPEDEF_PREDICATE_PROPERTY_NAME,
+        TYPEDEF_TYPE_PROPERTY_NAME;
 
-import 'dart:collection' show
-    UnmodifiableListView,
-    UnmodifiableMapView;
+import 'dart:collection' show UnmodifiableListView, UnmodifiableMapView;
 
 import 'dart:mirrors';
 
-import 'dart:_foreign_helper' show
-    JS,
-    JS_GET_FLAG,
-    JS_GET_STATIC_STATE,
-    JS_CURRENT_ISOLATE_CONTEXT,
-    JS_EMBEDDED_GLOBAL,
-    JS_GET_NAME;
-
+import 'dart:_foreign_helper'
+    show
+        JS,
+        JS_GET_FLAG,
+        JS_GET_STATIC_STATE,
+        JS_CURRENT_ISOLATE_CONTEXT,
+        JS_EMBEDDED_GLOBAL,
+        JS_GET_NAME;
 
 import 'dart:_internal' as _symbol_dev;
 
-import 'dart:_js_helper' show
-    BoundClosure,
-    CachedInvocation,
-    Closure,
-    JSInvocationMirror,
-    JsCache,
-    Primitives,
-    ReflectionInfo,
-    RuntimeError,
-    TearOffClosure,
-    TypeVariable,
-    UnimplementedNoSuchMethodError,
-    createRuntimeType,
-    createUnmangledInvocationMirror,
-    getMangledTypeName,
-    getMetadata,
-    getType,
-    getRuntimeType,
-    isDartFunctionType,
-    runtimeTypeToString,
-    setRuntimeTypeInfo,
-    throwInvalidReflectionError,
-    TypeImpl,
-    deferredLoadHook;
+import 'dart:_js_helper'
+    show
+        BoundClosure,
+        CachedInvocation,
+        Closure,
+        JSInvocationMirror,
+        JsCache,
+        Primitives,
+        ReflectionInfo,
+        RuntimeError,
+        TearOffClosure,
+        TypeVariable,
+        UnimplementedNoSuchMethodError,
+        createRuntimeType,
+        createUnmangledInvocationMirror,
+        getMangledTypeName,
+        getMetadata,
+        getType,
+        getRuntimeType,
+        isDartFunctionType,
+        runtimeTypeToString,
+        setRuntimeTypeInfo,
+        throwInvalidReflectionError,
+        TypeImpl,
+        deferredLoadHook;
 
-import 'dart:_interceptors' show
-    Interceptor,
-    JSArray,
-    JSExtendableArray,
-    getInterceptor;
+import 'dart:_interceptors'
+    show Interceptor, JSArray, JSExtendableArray, getInterceptor;
 
 import 'dart:_js_names';
 
@@ -152,10 +149,11 @@
       if (uriString != "") {
         uri = Uri.parse(uriString);
       } else {
-        uri = new Uri(scheme: 'https',
-                      host: 'dartlang.org',
-                      path: 'dart2js-stripped-uri',
-                      queryParameters: { 'lib': name });
+        uri = new Uri(
+            scheme: 'https',
+            host: 'dartlang.org',
+            path: 'dart2js-stripped-uri',
+            queryParameters: {'lib': name});
       }
       List<String> classes = data[2];
       List<String> functions = data[3];
@@ -164,12 +162,11 @@
       bool isRoot = data[6];
       var globalObject = data[7];
       List metadata = (metadataFunction == null)
-          ? const [] : JS('List', '#()', metadataFunction);
+          ? const []
+          : JS('List', '#()', metadataFunction);
       var libraries = result.putIfAbsent(name, () => <LibraryMirror>[]);
-      libraries.add(
-          new JsLibraryMirror(
-              s(name), uri, classes, functions, metadata, fields, isRoot,
-              globalObject));
+      libraries.add(new JsLibraryMirror(s(name), uri, classes, functions,
+          metadata, fields, isRoot, globalObject));
     }
     return result;
   }
@@ -217,8 +214,8 @@
   bool get isCurrent => JS_CURRENT_ISOLATE_CONTEXT() == _isolateContext;
 
   LibraryMirror get rootLibrary {
-    return currentJsMirrorSystem.libraries.values.firstWhere(
-        (JsLibraryMirror library) => library._isRoot);
+    return currentJsMirrorSystem.libraries.values
+        .firstWhere((JsLibraryMirror library) => library._isRoot);
   }
 }
 
@@ -255,8 +252,8 @@
   final int _metadataIndex;
   TypeMirror _cachedUpperBound;
 
-  JsTypeVariableMirror(TypeVariable typeVariable, this.owner,
-                       this._metadataIndex)
+  JsTypeVariableMirror(
+      TypeVariable typeVariable, this.owner, this._metadataIndex)
       : this._typeVariable = typeVariable,
         super(s(typeVariable.name));
 
@@ -291,8 +288,7 @@
 }
 
 class JsTypeMirror extends JsDeclarationMirror implements TypeMirror {
-  JsTypeMirror(Symbol simpleName)
-      : super(simpleName);
+  JsTypeMirror(Symbol simpleName) : super(simpleName);
 
   String get _prettyName => 'TypeMirror';
 
@@ -325,7 +321,8 @@
   }
 }
 
-class JsLibraryMirror extends JsDeclarationMirror with JsObjectMirror
+class JsLibraryMirror extends JsDeclarationMirror
+    with JsObjectMirror
     implements LibraryMirror {
   final Uri _uri;
   final List<String> _classes;
@@ -345,14 +342,15 @@
   UnmodifiableMapView<Symbol, DeclarationMirror> _cachedDeclarations;
   UnmodifiableListView<InstanceMirror> _cachedMetadata;
 
-  JsLibraryMirror(Symbol simpleName,
-                  this._uri,
-                  this._classes,
-                  this._functions,
-                  this._metadata,
-                  this._compactFieldSpecification,
-                  this._isRoot,
-                  this._globalObject)
+  JsLibraryMirror(
+      Symbol simpleName,
+      this._uri,
+      this._classes,
+      this._functions,
+      this._metadata,
+      this._compactFieldSpecification,
+      this._isRoot,
+      this._globalObject)
       : super(simpleName) {
     preserveLibraryNames();
   }
@@ -379,7 +377,7 @@
       if (cls is JsClassMirror) {
         result[cls.simpleName] = cls;
         cls._owner = this;
-      } else  if (cls is JsTypedefMirror) {
+      } else if (cls is JsTypedefMirror) {
         result[cls.simpleName] = cls;
       }
     }
@@ -414,9 +412,8 @@
     return reflect(JS("", "#()", getter));
   }
 
-  InstanceMirror invoke(Symbol memberName,
-                        List positionalArguments,
-                        [Map<Symbol, dynamic> namedArguments]) {
+  InstanceMirror invoke(Symbol memberName, List positionalArguments,
+      [Map<Symbol, dynamic> namedArguments]) {
     if (namedArguments != null && !namedArguments.isEmpty) {
       throw new UnsupportedError('Named arguments are not implemented.');
     }
@@ -474,14 +471,13 @@
         continue;
       }
       bool isConstructor = unmangledName.startsWith('new ');
-      bool isStatic = !isConstructor; // Top-level functions are static, but
-                                      // constructors are not.
+      // Top-level functions are static, but constructors are not.
+      bool isStatic = !isConstructor;
       if (isConstructor) {
         unmangledName = unmangledName.substring(4).replaceAll(r'$', '.');
       }
-      JsMethodMirror mirror =
-          new JsMethodMirror.fromUnmangledName(
-              unmangledName, jsFunction, isStatic, isConstructor);
+      JsMethodMirror mirror = new JsMethodMirror.fromUnmangledName(
+          unmangledName, jsFunction, isStatic, isConstructor);
       result.add(mirror);
       mirror._owner = this;
     }
@@ -533,11 +529,12 @@
   }
 
   Map<Symbol, Mirror> get __members {
-    if (_cachedMembers !=  null) return _cachedMembers;
+    if (_cachedMembers != null) return _cachedMembers;
     Map<Symbol, Mirror> result = new Map.from(__classes);
     addToResult(Symbol key, Mirror value) {
       result[key] = value;
     }
+
     __functions.forEach(addToResult);
     __getters.forEach(addToResult);
     __setters.forEach(addToResult);
@@ -551,6 +548,7 @@
     addToResult(Symbol key, Mirror value) {
       result[key] = value;
     }
+
     __members.forEach(addToResult);
     return _cachedDeclarations =
         new UnmodifiableMapView<Symbol, DeclarationMirror>(result);
@@ -566,8 +564,8 @@
   // TODO(ahe): Test this getter.
   DeclarationMirror get owner => null;
 
-  List<LibraryDependencyMirror> get libraryDependencies
-      => throw new UnimplementedError();
+  List<LibraryDependencyMirror> get libraryDependencies =>
+      throw new UnimplementedError();
 }
 
 String n(Symbol symbol) => _symbol_dev.Symbol.getName(symbol);
@@ -589,8 +587,19 @@
   }
 }
 
-TypeMirror reflectType(Type key) {
-  return reflectClassByMangledName(getMangledTypeName(key));
+TypeMirror reflectType(Type key, [List<Type> typeArguments]) {
+  String mangledName = getMangledTypeName(key);
+  if (typeArguments != null) {
+    if (typeArguments.isEmpty || !typeArguments.every((_) => _ is TypeImpl)) {
+      var message = typeArguments.isEmpty
+          ? 'Type arguments list can not be empty.'
+          : 'Type arguments list must contain only instances of Type.';
+      throw new ArgumentError.value(typeArguments, 'typeArguments', message);
+    }
+    var mangledTypeArguments = typeArguments.map(getMangledTypeName);
+    mangledName = "${mangledName}<${mangledTypeArguments.join(', ')}>";
+  }
+  return reflectClassByMangledName(mangledName);
 }
 
 TypeMirror reflectClassByMangledName(String mangledName) {
@@ -612,11 +621,12 @@
   if (typeArgIndex != -1) {
     TypeMirror originalDeclaration =
         reflectClassByMangledName(mangledName.substring(0, typeArgIndex))
-        .originalDeclaration;
+            .originalDeclaration;
     if (originalDeclaration is JsTypedefMirror) {
       throw new UnimplementedError();
     }
-    mirror = new JsTypeBoundClassMirror(originalDeclaration,
+    mirror = new JsTypeBoundClassMirror(
+        originalDeclaration,
         // Remove the angle brackets enclosing the type arguments.
         mangledName.substring(typeArgIndex + 1, mangledName.length - 1));
     JsCache.update(classMirrors, mangledName, mirror);
@@ -635,8 +645,8 @@
   if (descriptor == null) {
     // This is a native class, or an intercepted class.
     // TODO(ahe): Preserve descriptor for such classes.
-  } else if (JS('bool', '# in #',
-                TYPEDEF_PREDICATE_PROPERTY_NAME, descriptor)) {
+  } else if (JS(
+      'bool', '# in #', TYPEDEF_PREDICATE_PROPERTY_NAME, descriptor)) {
     // Typedefs are represented as normal classes with two special properties:
     //   TYPEDEF_PREDICATE_PROPERTY_NAME and TYPEDEF_TYPE_PROPERTY_NAME.
     // For example:
@@ -688,6 +698,43 @@
   return mirror;
 }
 
+/// Splits input `typeArguments` string into a list of strings for each argument.
+/// Takes into account nested generic types.
+/// For example, `Map<int, String>, String` will become a list of two items:
+/// `Map<int, String>` and `String`.
+List<String> splitTypeArguments(String typeArguments) {
+  if (typeArguments.indexOf('<') == -1) {
+    return typeArguments.split(',');
+  }
+  var argumentList = new List<String>();
+  int level = 0;
+  String currentTypeArgument = '';
+
+  for (int i = 0; i < typeArguments.length; i++) {
+    var character = typeArguments[i];
+    if (character == ' ') {
+      continue;
+    } else if (character == '<') {
+      currentTypeArgument += character;
+      level++;
+    } else if (character == '>') {
+      currentTypeArgument += character;
+      level--;
+    } else if (character == ',') {
+      if (level > 0) {
+        currentTypeArgument += character;
+      } else {
+        argumentList.add(currentTypeArgument);
+        currentTypeArgument = '';
+      }
+    } else {
+      currentTypeArgument += character;
+    }
+  }
+  argumentList.add(currentTypeArgument);
+  return argumentList;
+}
+
 Map<Symbol, MethodMirror> filterMethods(List<MethodMirror> methods) {
   var result = new Map();
   for (JsMethodMirror method in methods) {
@@ -708,12 +755,11 @@
   return result;
 }
 
-Map<Symbol, MethodMirror> filterGetters(List<MethodMirror> methods,
-                                        Map<Symbol, VariableMirror> fields) {
+Map<Symbol, MethodMirror> filterGetters(
+    List<MethodMirror> methods, Map<Symbol, VariableMirror> fields) {
   var result = new Map();
   for (JsMethodMirror method in methods) {
     if (method.isGetter) {
-
       // TODO(ahe): This is a hack to remove getters corresponding to a field.
       if (fields[method.simpleName] != null) continue;
 
@@ -723,12 +769,11 @@
   return result;
 }
 
-Map<Symbol, MethodMirror> filterSetters(List<MethodMirror> methods,
-                                        Map<Symbol, VariableMirror> fields) {
+Map<Symbol, MethodMirror> filterSetters(
+    List<MethodMirror> methods, Map<Symbol, VariableMirror> fields) {
   var result = new Map();
   for (JsMethodMirror method in methods) {
     if (method.isSetter) {
-
       // TODO(ahe): This is a hack to remove setters corresponding to a field.
       String name = n(method.simpleName);
       name = name.substring(0, name.length - 1); // Remove '='.
@@ -740,8 +785,8 @@
   return result;
 }
 
-Map<Symbol, Mirror> filterMembers(List<MethodMirror> methods,
-                                  Map<Symbol, VariableMirror> variables) {
+Map<Symbol, Mirror> filterMembers(
+    List<MethodMirror> methods, Map<Symbol, VariableMirror> variables) {
   Map<Symbol, Mirror> result = new Map.from(variables);
   for (JsMethodMirror method in methods) {
     if (method.isSetter) {
@@ -777,15 +822,16 @@
   return superclass;
 }
 
-class JsMixinApplication extends JsTypeMirror with JsObjectMirror
+class JsMixinApplication extends JsTypeMirror
+    with JsObjectMirror
     implements ClassMirror {
   final ClassMirror superclass;
   final ClassMirror mixin;
   Symbol _cachedSimpleName;
   Map<Symbol, MethodMirror> _cachedInstanceMembers;
 
-  JsMixinApplication(ClassMirror superclass, ClassMirror mixin,
-                     String mangledName)
+  JsMixinApplication(
+      ClassMirror superclass, ClassMirror mixin, String mangledName)
       : this.superclass = superclass,
         this.mixin = mixin,
         super(s(mangledName));
@@ -833,10 +879,8 @@
 
   _asRuntimeType() => null;
 
-  InstanceMirror invoke(
-      Symbol memberName,
-      List positionalArguments,
-      [Map<Symbol,dynamic> namedArguments]) {
+  InstanceMirror invoke(Symbol memberName, List positionalArguments,
+      [Map<Symbol, dynamic> namedArguments]) {
     throw new NoSuchStaticMethodError.method(
         null, memberName, positionalArguments, namedArguments);
   }
@@ -858,10 +902,8 @@
 
   Map<Symbol, MethodMirror> get __constructors => _mixin.__constructors;
 
-  InstanceMirror newInstance(
-      Symbol constructorName,
-      List positionalArguments,
-      [Map<Symbol,dynamic> namedArguments]) {
+  InstanceMirror newInstance(Symbol constructorName, List positionalArguments,
+      [Map<Symbol, dynamic> namedArguments]) {
     throw new UnsupportedError(
         "Can't instantiate mixin application '${n(qualifiedName)}'");
   }
@@ -890,8 +932,7 @@
   bool isAssignableTo(TypeMirror other) => throw new UnimplementedError();
 }
 
-abstract class JsObjectMirror implements ObjectMirror {
-}
+abstract class JsObjectMirror implements ObjectMirror {}
 
 class JsInstanceMirror extends JsObjectMirror implements InstanceMirror {
   final reflectee;
@@ -907,19 +948,17 @@
     return reflectType(getRuntimeType(reflectee));
   }
 
-  InstanceMirror invoke(Symbol memberName,
-                        List positionalArguments,
-                        [Map<Symbol,dynamic> namedArguments]) {
+  InstanceMirror invoke(Symbol memberName, List positionalArguments,
+      [Map<Symbol, dynamic> namedArguments]) {
     if (namedArguments == null) namedArguments = const {};
     // We can safely pass positionalArguments to _invoke as it will wrap it in
     // a JSArray if needed.
-    return _invoke(memberName, JSInvocationMirror.METHOD,
-                   positionalArguments, namedArguments);
+    return _invoke(memberName, JSInvocationMirror.METHOD, positionalArguments,
+        namedArguments);
   }
 
-  InstanceMirror _invokeMethodWithNamedArguments(
-      String reflectiveName,
-      List positionalArguments, Map<Symbol,dynamic> namedArguments) {
+  InstanceMirror _invokeMethodWithNamedArguments(String reflectiveName,
+      List positionalArguments, Map<Symbol, dynamic> namedArguments) {
     assert(namedArguments.isNotEmpty);
     var interceptor = getInterceptor(reflectee);
 
@@ -983,12 +1022,13 @@
   }
 
   String _computeReflectiveName(Symbol symbolName, int type,
-                                List positionalArguments,
-                                Map<Symbol, dynamic> namedArguments) {
+      List positionalArguments, Map<Symbol, dynamic> namedArguments) {
     String name = n(symbolName);
     switch (type) {
-      case JSInvocationMirror.GETTER: return name;
-      case JSInvocationMirror.SETTER: return '$name=';
+      case JSInvocationMirror.GETTER:
+        return name;
+      case JSInvocationMirror.SETTER:
+        return '$name=';
       case JSInvocationMirror.METHOD:
         if (namedArguments.isNotEmpty) return '$name*';
         int nbArgs = positionalArguments.length as int;
@@ -1004,8 +1044,7 @@
    * Caches the result.
    */
   _getCachedInvocation(Symbol name, int type, String reflectiveName,
-      List positionalArguments, Map<Symbol,dynamic> namedArguments) {
-
+      List positionalArguments, Map<Symbol, dynamic> namedArguments) {
     var cache = _classInvocationCache;
     var cacheEntry = JsCache.fetch(cache, reflectiveName);
     var result;
@@ -1037,10 +1076,8 @@
   /// Invoke the member specified through name and type on the reflectee.
   /// As a side-effect, this populates the class-specific invocation cache
   /// for the reflectee.
-  InstanceMirror _invoke(Symbol name,
-                         int type,
-                         List positionalArguments,
-                         Map<Symbol,dynamic> namedArguments) {
+  InstanceMirror _invoke(Symbol name, int type, List positionalArguments,
+      Map<Symbol, dynamic> namedArguments) {
     String reflectiveName =
         _computeReflectiveName(name, type, positionalArguments, namedArguments);
 
@@ -1055,8 +1092,8 @@
     if (cacheEntry.isNoSuchMethod || !_isReflectable(cacheEntry)) {
       // Could be that we want to invoke a getter, or get a method.
       if (type == JSInvocationMirror.METHOD && _instanceFieldExists(name)) {
-        return getField(name).invoke(
-            #call, positionalArguments, namedArguments);
+        return getField(name)
+            .invoke(#call, positionalArguments, namedArguments);
       }
 
       if (type == JSInvocationMirror.SETTER) {
@@ -1086,15 +1123,11 @@
   }
 
   // JS helpers for getField optimizations.
-  static bool isUndefined(x)
-      => JS('bool', 'typeof # == "undefined"', x);
-  static bool isMissingCache(x)
-      => JS('bool', 'typeof # == "number"', x);
-  static bool isMissingProbe(Symbol symbol)
-      => JS('bool', 'typeof #.\$p == "undefined"', symbol);
-  static bool isEvalAllowed()
-      => !JS_GET_FLAG("USE_CONTENT_SECURITY_POLICY");
-
+  static bool isUndefined(x) => JS('bool', 'typeof # == "undefined"', x);
+  static bool isMissingCache(x) => JS('bool', 'typeof # == "number"', x);
+  static bool isMissingProbe(Symbol symbol) =>
+      JS('bool', 'typeof #.\$p == "undefined"', symbol);
+  static bool isEvalAllowed() => !JS_GET_FLAG("USE_CONTENT_SECURITY_POLICY");
 
   /// The getter cache is lazily allocated after a couple
   /// of invocations of [InstanceMirror.getField]. The delay is
@@ -1113,13 +1146,14 @@
     int getterType = JSInvocationMirror.GETTER;
     String getterName =
         _computeReflectiveName(name, getterType, const [], const {});
-    var getterCacheEntry = _getCachedInvocation(
-        name, getterType, getterName, const [], const {});
+    var getterCacheEntry =
+        _getCachedInvocation(name, getterType, getterName, const [], const {});
     return !getterCacheEntry.isNoSuchMethod && !getterCacheEntry.isGetterStub;
   }
 
   InstanceMirror getField(Symbol fieldName) {
-    FASTPATH: {
+    FASTPATH:
+    {
       var cache = _getterCache;
       if (isMissingCache(cache) || isMissingProbe(fieldName)) break FASTPATH;
       // If the [fieldName] has an associated probe function, we can use
@@ -1207,8 +1241,8 @@
     return JS('', 'new Function("o", #)', body);
   }
 
-  _newGetterNoEvalFn(n) => JS('',
-      '(function(n){return(function(o){return o[n]()})})(#)', n);
+  _newGetterNoEvalFn(n) =>
+      JS('', '(function(n){return(function(o){return o[n]()})})(#)', n);
 
   _newInterceptedGetterFn(String name, bool useEval) {
     var object = reflectee;
@@ -1219,22 +1253,20 @@
     if (!useEval) return _newInterceptGetterNoEvalFn(name, interceptor);
     String className = JS('String', '#.constructor.name', interceptor);
     String functionName = '$className\$$name';
-    String body =
-        '  function $functionName(o){return i.$name(o)}'
+    String body = '  function $functionName(o){return i.$name(o)}'
         '  return $functionName;';
     return JS('', '(new Function("i", #))(#)', body, interceptor);
   }
 
-  _newInterceptGetterNoEvalFn(n, i) => JS('',
-      '(function(n,i){return(function(o){return i[n](o)})})(#,#)', n, i);
+  _newInterceptGetterNoEvalFn(n, i) =>
+      JS('', '(function(n,i){return(function(o){return i[n](o)})})(#,#)', n, i);
 
   delegate(Invocation invocation) {
     return JSInvocationMirror.invokeFromMirror(invocation, reflectee);
   }
 
   operator ==(other) {
-    return other is JsInstanceMirror &&
-           identical(reflectee, other.reflectee);
+    return other is JsInstanceMirror && identical(reflectee, other.reflectee);
   }
 
   int get hashCode {
@@ -1332,54 +1364,25 @@
       }
     }
 
-    if (_typeArguments.indexOf('<') == -1) {
-      _typeArguments.split(',').forEach((t) => addTypeArgument(t));
-    } else {
-      int level = 0;
-      String currentTypeArgument = '';
-
-      for (int i = 0; i < _typeArguments.length; i++) {
-        var character = _typeArguments[i];
-        if (character == ' ') {
-          continue;
-        } else if (character == '<') {
-          currentTypeArgument += character;
-          level++;
-        } else if (character == '>') {
-          currentTypeArgument += character;
-          level--;
-        } else if (character == ',') {
-          if (level > 0) {
-            currentTypeArgument += character;
-          } else {
-            addTypeArgument(currentTypeArgument);
-            currentTypeArgument = '';
-          }
-        } else {
-          currentTypeArgument += character;
-        }
-      }
-      addTypeArgument(currentTypeArgument);
-    }
+    splitTypeArguments(_typeArguments).forEach(addTypeArgument);
     return _cachedTypeArguments = new UnmodifiableListView(result);
   }
 
   List<JsMethodMirror> get _methods {
     if (_cachedMethods != null) return _cachedMethods;
-    return _cachedMethods =_class._getMethodsWithOwner(this);
+    return _cachedMethods = _class._getMethodsWithOwner(this);
   }
 
   Map<Symbol, MethodMirror> get __methods {
     if (_cachedMethodsMap != null) return _cachedMethodsMap;
-    return _cachedMethodsMap = new UnmodifiableMapView<Symbol, MethodMirror>(
-        filterMethods(_methods));
+    return _cachedMethodsMap =
+        new UnmodifiableMapView<Symbol, MethodMirror>(filterMethods(_methods));
   }
 
   Map<Symbol, MethodMirror> get __constructors {
     if (_cachedConstructors != null) return _cachedConstructors;
-    return _cachedConstructors =
-        new UnmodifiableMapView<Symbol, MethodMirror>(
-            filterConstructors(_methods));
+    return _cachedConstructors = new UnmodifiableMapView<Symbol, MethodMirror>(
+        filterConstructors(_methods));
   }
 
   Map<Symbol, MethodMirror> get __getters {
@@ -1397,7 +1400,7 @@
   Map<Symbol, VariableMirror> get __variables {
     if (_cachedVariables != null) return _cachedVariables;
     var result = new Map();
-    for (JsVariableMirror mirror in  _class._getFieldsWithOwner(this)) {
+    for (JsVariableMirror mirror in _class._getFieldsWithOwner(this)) {
       result[mirror.simpleName] = mirror;
     }
     return _cachedVariables =
@@ -1451,8 +1454,10 @@
         result.addAll(superclass.instanceMembers);
       }
       declarations.values.forEach((decl) {
-        if (decl is MethodMirror && !decl.isStatic &&
-            !decl.isConstructor && !decl.isAbstract) {
+        if (decl is MethodMirror &&
+            !decl.isStatic &&
+            !decl.isConstructor &&
+            !decl.isAbstract) {
           result[decl.simpleName] = decl;
         }
         if (decl is VariableMirror && !decl.isStatic) {
@@ -1477,19 +1482,17 @@
 
   InstanceMirror getField(Symbol fieldName) => _class.getField(fieldName);
 
-  InstanceMirror newInstance(Symbol constructorName,
-                             List positionalArguments,
-                             [Map<Symbol, dynamic> namedArguments]) {
-    var instance = _class._getInvokedInstance(constructorName,
-                                              positionalArguments,
-                                              namedArguments);
+  InstanceMirror newInstance(Symbol constructorName, List positionalArguments,
+      [Map<Symbol, dynamic> namedArguments]) {
+    var instance = _class._getInvokedInstance(
+        constructorName, positionalArguments, namedArguments);
     return reflect(setRuntimeTypeInfo(
         instance, typeArguments.map((t) => t._asRuntimeType()).toList()));
   }
 
   _asRuntimeType() {
-    return [_class._jsConstructor].addAll(
-        typeArguments.map((t) => t._asRuntimeType()));
+    return [_class._jsConstructor]
+        .addAll(typeArguments.map((t) => t._asRuntimeType()));
   }
 
   JsLibraryMirror get owner => _class.owner;
@@ -1507,9 +1510,8 @@
     return _superclass = typeMirrorFromRuntimeTypeRepresentation(this, type);
   }
 
-  InstanceMirror invoke(Symbol memberName,
-                        List positionalArguments,
-                        [Map<Symbol,dynamic> namedArguments]) {
+  InstanceMirror invoke(Symbol memberName, List positionalArguments,
+      [Map<Symbol, dynamic> namedArguments]) {
     return _class.invoke(memberName, positionalArguments, namedArguments);
   }
 
@@ -1562,14 +1564,12 @@
   final bool isGetter;
   final bool isStatic;
   final bool isTopLevel;
-  final _target;  /// The field or type that introduces the synthetic accessor.
 
-  JsSyntheticAccessor(this.owner,
-                      this.simpleName,
-                      this.isGetter,
-                      this.isStatic,
-                      this.isTopLevel,
-                      this._target);
+  /// The field or type that introduces the synthetic accessor.
+  final _target;
+
+  JsSyntheticAccessor(this.owner, this.simpleName, this.isGetter, this.isStatic,
+      this.isTopLevel, this._target);
 
   bool get isSynthetic => true;
   bool get isRegularMethod => false;
@@ -1622,7 +1622,8 @@
   SourceLocation get location => throw new UnimplementedError();
 }
 
-class JsClassMirror extends JsTypeMirror with JsObjectMirror
+class JsClassMirror extends JsTypeMirror
+    with JsObjectMirror
     implements ClassMirror {
   final String _mangledName;
   final _jsConstructor;
@@ -1649,26 +1650,22 @@
   // Set as side-effect of accessing JsLibraryMirror.classes.
   JsLibraryMirror _owner;
 
-  JsClassMirror(Symbol simpleName,
-                this._mangledName,
-                this._jsConstructor,
-                this._fieldsDescriptor,
-                this._fieldsMetadata)
+  JsClassMirror(Symbol simpleName, this._mangledName, this._jsConstructor,
+      this._fieldsDescriptor, this._fieldsMetadata)
       : super(simpleName);
 
   String get _prettyName => 'ClassMirror';
 
   Map<Symbol, MethodMirror> get __constructors {
     if (_cachedConstructors != null) return _cachedConstructors;
-    return _cachedConstructors =
-        new UnmodifiableMapView<Symbol, MethodMirror>(
-            filterConstructors(_methods));
+    return _cachedConstructors = new UnmodifiableMapView<Symbol, MethodMirror>(
+        filterConstructors(_methods));
   }
 
   _asRuntimeType() {
-    if (typeVariables.isEmpty)  return _jsConstructor;
+    if (typeVariables.isEmpty) return _jsConstructor;
     var type = [_jsConstructor];
-    for (int i = 0; i < typeVariables.length; i ++) {
+    for (int i = 0; i < typeVariables.length; i++) {
       type.add(JsMirrorSystem._dynamicType._asRuntimeType);
     }
     return type;
@@ -1678,7 +1675,7 @@
     var prototype = JS('', '#.prototype', _jsConstructor);
     // The prototype might not have been processed yet, so do that now.
     JS('', '#[#]()', prototype,
-                     JS_GET_NAME(JsGetName.DEFERRED_ACTION_PROPERTY));
+        JS_GET_NAME(JsGetName.DEFERRED_ACTION_PROPERTY));
     List<String> keys = extractKeys(prototype);
     var result = <JsMethodMirror>[];
     for (String key in keys) {
@@ -1692,9 +1689,8 @@
       var function = JS('', '#[#]', prototype, key);
       if (!isOrdinaryReflectableMethod(function)) continue;
       if (isAliasedSuperMethod(function, key)) continue;
-      var mirror =
-          new JsMethodMirror.fromUnmangledName(
-              simpleName, function, false, false);
+      var mirror = new JsMethodMirror.fromUnmangledName(
+          simpleName, function, false, false);
       result.add(mirror);
       mirror._owner = methodOwner;
     }
@@ -1720,9 +1716,8 @@
         continue;
       }
       bool isStatic = !isConstructor; // Constructors are not static.
-      JsMethodMirror mirror =
-          new JsMethodMirror.fromUnmangledName(
-              unmangledName, jsFunction, isStatic, isConstructor);
+      JsMethodMirror mirror = new JsMethodMirror.fromUnmangledName(
+          unmangledName, jsFunction, isStatic, isConstructor);
       result.add(mirror);
       mirror._owner = methodOwner;
     }
@@ -1740,8 +1735,8 @@
 
     var instanceFieldSpecfication = _fieldsDescriptor.split(';')[1];
     if (_fieldsMetadata != null) {
-      instanceFieldSpecfication =
-          [instanceFieldSpecfication]..addAll(_fieldsMetadata);
+      instanceFieldSpecfication = [instanceFieldSpecfication]
+        ..addAll(_fieldsMetadata);
     }
     parseCompactFieldSpecification(
         fieldOwner, instanceFieldSpecfication, false, result);
@@ -1751,10 +1746,10 @@
     if (staticDescriptor != null) {
       parseCompactFieldSpecification(
           fieldOwner,
-          JS('', '#[#]',
-              staticDescriptor,
+          JS('', '#[#]', staticDescriptor,
               JS_GET_NAME(JsGetName.CLASS_DESCRIPTOR_PROPERTY)),
-          true, result);
+          true,
+          result);
     }
     return result;
   }
@@ -1804,6 +1799,7 @@
     addToResult(Symbol key, Mirror value) {
       result[key] = value;
     }
+
     __members.forEach(addToResult);
     __constructors.forEach(addToResult);
     typeVariables.forEach((tv) => result[tv.simpleName] = tv);
@@ -1841,8 +1837,10 @@
         result.addAll(superclass.instanceMembers);
       }
       declarations.values.forEach((decl) {
-        if (decl is MethodMirror && !decl.isStatic &&
-            !decl.isConstructor && !decl.isAbstract) {
+        if (decl is MethodMirror &&
+            !decl.isStatic &&
+            !decl.isConstructor &&
+            !decl.isAbstract) {
           result[decl.simpleName] = decl;
         }
         if (decl is VariableMirror && !decl.isStatic) {
@@ -1926,32 +1924,28 @@
     throw new NoSuchStaticMethodError.method(null, fieldName, null, null);
   }
 
-  _getInvokedInstance(Symbol constructorName,
-                      List positionalArguments,
-                      [Map<Symbol, dynamic> namedArguments]) {
-     if (namedArguments != null && !namedArguments.isEmpty) {
-       throw new UnsupportedError('Named arguments are not implemented.');
-     }
-     JsMethodMirror mirror =
-         JsCache.fetch(_jsConstructorCache, n(constructorName));
-     if (mirror == null) {
-       mirror = __constructors.values.firstWhere(
-           (m) => m.constructorName == constructorName,
-           orElse: () {
-             throw new NoSuchStaticMethodError.method(
-                 null, constructorName, positionalArguments, namedArguments);
-           });
-       JsCache.update(_jsConstructorCache, n(constructorName), mirror);
-     }
-     return mirror._invoke(positionalArguments, namedArguments);
-   }
+  _getInvokedInstance(Symbol constructorName, List positionalArguments,
+      [Map<Symbol, dynamic> namedArguments]) {
+    if (namedArguments != null && !namedArguments.isEmpty) {
+      throw new UnsupportedError('Named arguments are not implemented.');
+    }
+    JsMethodMirror mirror =
+        JsCache.fetch(_jsConstructorCache, n(constructorName));
+    if (mirror == null) {
+      mirror = __constructors.values
+          .firstWhere((m) => m.constructorName == constructorName, orElse: () {
+        throw new NoSuchStaticMethodError.method(
+            null, constructorName, positionalArguments, namedArguments);
+      });
+      JsCache.update(_jsConstructorCache, n(constructorName), mirror);
+    }
+    return mirror._invoke(positionalArguments, namedArguments);
+  }
 
-  InstanceMirror newInstance(Symbol constructorName,
-                             List positionalArguments,
-                             [Map<Symbol, dynamic> namedArguments]) {
-    return reflect(_getInvokedInstance(constructorName,
-                                       positionalArguments,
-                                       namedArguments));
+  InstanceMirror newInstance(Symbol constructorName, List positionalArguments,
+      [Map<Symbol, dynamic> namedArguments]) {
+    return reflect(_getInvokedInstance(
+        constructorName, positionalArguments, namedArguments));
   }
 
   JsLibraryMirror get owner {
@@ -2001,16 +1995,16 @@
           // Use _superclass == this to represent class with no superclass
           // (Object).
           _superclass = (superclassName == '')
-              ? this : reflectClassByMangledName(superclassName);
-          }
+              ? this
+              : reflectClassByMangledName(superclassName);
         }
       }
+    }
     return _superclass == this ? null : _superclass;
   }
 
-  InstanceMirror invoke(Symbol memberName,
-                        List positionalArguments,
-                        [Map<Symbol,dynamic> namedArguments]) {
+  InstanceMirror invoke(Symbol memberName, List positionalArguments,
+      [Map<Symbol, dynamic> namedArguments]) {
     // Mirror API gotcha: Calling [invoke] on a ClassMirror means invoke a
     // static method.
 
@@ -2065,15 +2059,15 @@
   }
 
   List<TypeVariableMirror> get typeVariables {
-   if (_cachedTypeVariables != null) return _cachedTypeVariables;
-   List result = new List();
-   List typeVariables =
+    if (_cachedTypeVariables != null) return _cachedTypeVariables;
+    List result = new List();
+    List typeVariables =
         JS('JSExtendableArray|Null', '#.prototype["<>"]', _jsConstructor);
     if (typeVariables == null) return result;
     for (int i = 0; i < typeVariables.length; i++) {
       TypeVariable typeVariable = getMetadata(typeVariables[i]);
-      result.add(new JsTypeVariableMirror(typeVariable, this,
-                                          typeVariables[i]));
+      result
+          .add(new JsTypeVariableMirror(typeVariable, this, typeVariables[i]));
     }
     return _cachedTypeVariables = new UnmodifiableListView(result);
   }
@@ -2103,8 +2097,9 @@
     }
     if (other is JsFunctionTypeMirror) {
       return false;
-    } if (other is JsClassMirror &&
-          JS('bool', '# == #', other._jsConstructor, _jsConstructor)) {
+    }
+    if (other is JsClassMirror &&
+        JS('bool', '# == #', other._jsConstructor, _jsConstructor)) {
       return true;
     } else if (superclass == null) {
       return false;
@@ -2115,7 +2110,6 @@
 }
 
 class JsVariableMirror extends JsDeclarationMirror implements VariableMirror {
-
   // TODO(ahe): The values in these fields are virtually untested.
   final String _jsName;
   final bool isFinal;
@@ -2125,19 +2119,12 @@
   final int _type;
   List _metadata;
 
-  JsVariableMirror(Symbol simpleName,
-                   this._jsName,
-                   this._type,
-                   this.isFinal,
-                   this.isStatic,
-                   this._metadataFunction,
-                   this._owner)
+  JsVariableMirror(Symbol simpleName, this._jsName, this._type, this.isFinal,
+      this.isStatic, this._metadataFunction, this._owner)
       : super(simpleName);
 
-  factory JsVariableMirror.from(String descriptor,
-                                metadataFunction,
-                                JsDeclarationMirror owner,
-                                bool isStatic) {
+  factory JsVariableMirror.from(String descriptor, metadataFunction,
+      JsDeclarationMirror owner, bool isStatic) {
     List<String> fieldInformation = descriptor.split('-');
     if (fieldInformation.length == 1) {
       // The field is not available for reflection.
@@ -2180,13 +2167,8 @@
       }
     }
     int type = int.parse(fieldInformation[1], onError: (_) => null);
-    return new JsVariableMirror(s(unmangledName),
-                                jsName,
-                                type,
-                                isFinal,
-                                isStatic,
-                                metadataFunction,
-                                owner);
+    return new JsVariableMirror(s(unmangledName), jsName, type, isFinal,
+        isStatic, metadataFunction, owner);
   }
 
   String get _prettyName => 'VariableMirror';
@@ -2201,7 +2183,8 @@
     preserveMetadata();
     if (_metadata == null) {
       _metadata = (_metadataFunction == null)
-          ? const [] : JS('', '#()', _metadataFunction);
+          ? const []
+          : JS('', '#()', _metadataFunction);
     }
     return _metadata.map(reflect).toList();
   }
@@ -2233,8 +2216,7 @@
 }
 
 class JsClosureMirror extends JsInstanceMirror implements ClosureMirror {
-  JsClosureMirror(reflectee)
-      : super(reflectee);
+  JsClosureMirror(reflectee) : super(reflectee);
 
   MethodMirror get function {
     String cacheName = Primitives.mirrorFunctionCacheName;
@@ -2262,7 +2244,8 @@
             }
             return null;
           })(#, #)''',
-        reflectee, callPrefix);
+        reflectee,
+        callPrefix);
 
     if (callName == null) {
       throw new RuntimeError('Cannot find callName on "$reflectee"');
@@ -2276,22 +2259,29 @@
       if (name == null) {
         throwInvalidReflectionError(name);
       }
-      cachedFunction = new JsMethodMirror.fromUnmangledName(
-          name, target, false, false);
+      cachedFunction =
+          new JsMethodMirror.fromUnmangledName(name, target, false, false);
     } else {
       bool isStatic = true; // TODO(ahe): Compute isStatic correctly.
       var jsFunction = JS('', '#[#]', reflectee, callName);
       var dummyOptionalParameterCount = 0;
       cachedFunction = new JsMethodMirror(
-          s(callName), jsFunction, parameterCount, dummyOptionalParameterCount,
-          false, false, isStatic, false, false);
+          s(callName),
+          jsFunction,
+          parameterCount,
+          dummyOptionalParameterCount,
+          false,
+          false,
+          isStatic,
+          false,
+          false);
     }
     JS('void', r'#.constructor[#] = #', reflectee, cacheName, cachedFunction);
     return cachedFunction;
   }
 
   InstanceMirror apply(List positionalArguments,
-                       [Map<Symbol, dynamic> namedArguments]) {
+      [Map<Symbol, dynamic> namedArguments]) {
     return reflect(
         Function.apply(reflectee, positionalArguments, namedArguments));
   }
@@ -2316,21 +2306,20 @@
   TypeMirror _returnType;
   UnmodifiableListView<ParameterMirror> _parameters;
 
-  JsMethodMirror(Symbol simpleName,
-                 this._jsFunction,
-                 this._requiredParameterCount,
-                 this._optionalParameterCount,
-                 this.isGetter,
-                 this.isSetter,
-                 this.isStatic,
-                 this.isConstructor,
-                 this.isOperator)
+  JsMethodMirror(
+      Symbol simpleName,
+      this._jsFunction,
+      this._requiredParameterCount,
+      this._optionalParameterCount,
+      this.isGetter,
+      this.isSetter,
+      this.isStatic,
+      this.isConstructor,
+      this.isOperator)
       : super(simpleName);
 
-  factory JsMethodMirror.fromUnmangledName(String name,
-                                           jsFunction,
-                                           bool isStatic,
-                                           bool isConstructor) {
+  factory JsMethodMirror.fromUnmangledName(
+      String name, jsFunction, bool isStatic, bool isConstructor) {
     List<String> info = name.split(':');
     name = info[0];
     bool isOperator = isOperatorName(name);
@@ -2349,12 +2338,19 @@
       ReflectionInfo reflectionInfo = new ReflectionInfo(jsFunction);
       requiredParameterCount = reflectionInfo.requiredParameterCount;
       optionalParameterCount = reflectionInfo.optionalParameterCount;
-      assert(int.parse(info[1]) == requiredParameterCount
-          + optionalParameterCount);
+      assert(int.parse(info[1]) ==
+          requiredParameterCount + optionalParameterCount);
     }
     return new JsMethodMirror(
-        s(name), jsFunction, requiredParameterCount, optionalParameterCount,
-        isGetter, isSetter, isStatic, isConstructor, isOperator);
+        s(name),
+        jsFunction,
+        requiredParameterCount,
+        optionalParameterCount,
+        isGetter,
+        isSetter,
+        isStatic,
+        isConstructor,
+        isOperator);
   }
 
   String get _prettyName => 'MethodMirror';
@@ -2384,8 +2380,8 @@
       var formals = new List(_parameterCount);
       ReflectionInfo info = new ReflectionInfo(_jsFunction);
       if (info != null) {
-        assert(_parameterCount
-               == info.requiredParameterCount + info.optionalParameterCount);
+        assert(_parameterCount ==
+            info.requiredParameterCount + info.optionalParameterCount);
         var functionType = info.functionType;
         var type;
         if (functionType is int) {
@@ -2397,8 +2393,7 @@
           TypeMirror ownerType = owner;
           JsClassMirror ownerClass = ownerType.originalDeclaration;
           type = new JsFunctionTypeMirror(
-              info.computeFunctionRti(ownerClass._jsConstructor),
-              owner);
+              info.computeFunctionRti(ownerClass._jsConstructor), owner);
         }
         // Constructors aren't reified with their return type.
         if (isConstructor) {
@@ -2417,9 +2412,11 @@
                 metadataList: annotations);
           } else {
             var defaultValue = info.defaultValue(i);
-            p = new JsParameterMirror(
-                name, this, parameter._type, metadataList: annotations,
-                isOptional: true, isNamed: isNamed, defaultValue: defaultValue);
+            p = new JsParameterMirror(name, this, parameter._type,
+                metadataList: annotations,
+                isOptional: true,
+                isNamed: isNamed,
+                defaultValue: defaultValue);
           }
           formals[i++] = p;
         }
@@ -2449,7 +2446,7 @@
     }
     int positionalLength = positionalArguments.length;
     if (positionalLength < _requiredParameterCount ||
-        positionalLength >  _parameterCount ||
+        positionalLength > _parameterCount ||
         _jsFunction == null) {
       // TODO(ahe): What receiver to use?
       throw new NoSuchMethodError(
@@ -2469,7 +2466,7 @@
     // care who their receiver is. But to lazy getters, it is important that
     // 'this' is '$'.
     return JS('', r'#.apply(#, #)', _jsFunction, JS_GET_STATIC_STATE(),
-              new List.from(positionalArguments));
+        new List.from(positionalArguments));
   }
 
   _getField(JsMirror receiver) {
@@ -2527,13 +2524,11 @@
 
   final List<int> metadataList;
 
-  JsParameterMirror(String unmangledName,
-                    this.owner,
-                    this._type,
-                     {this.metadataList: const <int>[],
-                     this.isOptional: false,
-                     this.isNamed: false,
-                     defaultValue})
+  JsParameterMirror(String unmangledName, this.owner, this._type,
+      {this.metadataList: const <int>[],
+      this.isOptional: false,
+      this.isNamed: false,
+      defaultValue})
       : _defaultValue = defaultValue,
         super(s(unmangledName));
 
@@ -2568,7 +2563,7 @@
   final String _mangledName;
   JsFunctionTypeMirror referent;
 
-  JsTypedefMirror(Symbol simpleName,  this._mangledName, _typeData)
+  JsTypedefMirror(Symbol simpleName, this._mangledName, _typeData)
       : super(simpleName) {
     referent = new JsFunctionTypeMirror(_typeData, this);
   }
@@ -2607,23 +2602,21 @@
   Type get reflectedType => throw new UnimplementedError();
   ClassMirror get superclass => throw new UnimplementedError();
   List<ClassMirror> get superinterfaces => throw new UnimplementedError();
-  Map<Symbol, DeclarationMirror> get declarations
-      => throw new UnimplementedError();
-  Map<Symbol, MethodMirror> get instanceMembers
-      => throw new UnimplementedError();
+  Map<Symbol, DeclarationMirror> get declarations =>
+      throw new UnimplementedError();
+  Map<Symbol, MethodMirror> get instanceMembers =>
+      throw new UnimplementedError();
   Map<Symbol, MethodMirror> get staticMembers => throw new UnimplementedError();
   ClassMirror get mixin => throw new UnimplementedError();
-  InstanceMirror newInstance(
-      Symbol constructorName,
-      List positionalArguments,
-      [Map<Symbol, dynamic> namedArguments]) => throw new UnimplementedError();
-  InstanceMirror invoke(Symbol memberName,
-                        List positionalArguments,
-                        [Map<Symbol, dynamic> namedArguments])
-      => throw new UnimplementedError();
+  InstanceMirror newInstance(Symbol constructorName, List positionalArguments,
+          [Map<Symbol, dynamic> namedArguments]) =>
+      throw new UnimplementedError();
+  InstanceMirror invoke(Symbol memberName, List positionalArguments,
+          [Map<Symbol, dynamic> namedArguments]) =>
+      throw new UnimplementedError();
   InstanceMirror getField(Symbol fieldName) => throw new UnimplementedError();
-  InstanceMirror setField(Symbol fieldName, Object value)
-      => throw new UnimplementedError();
+  InstanceMirror setField(Symbol fieldName, Object value) =>
+      throw new UnimplementedError();
   delegate(Invocation invocation) => throw new UnimplementedError();
   List<TypeVariableMirror> get typeVariables => throw new UnimplementedError();
   List<TypeMirror> get typeArguments => throw new UnimplementedError();
@@ -2662,36 +2655,39 @@
   }
 
   bool get _hasArguments {
-    return JS('bool', '# in #',
-              JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG),
-               _typeData);
+    return JS(
+        'bool',
+        '# in #',
+        JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG),
+        _typeData);
   }
+
   List get _arguments {
-    return JS('JSExtendableArray', '#[#]',
-              _typeData,
-              JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG));
+    return JS('JSExtendableArray', '#[#]', _typeData,
+        JS_GET_NAME(JsGetName.FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG));
   }
 
   bool get _hasOptionalArguments {
-    return JS('bool', '# in #',
-              JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG),
-              _typeData);
+    return JS(
+        'bool',
+        '# in #',
+        JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG),
+        _typeData);
   }
+
   List get _optionalArguments {
-    return JS('JSExtendableArray', '#[#]',
-              _typeData,
-              JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG));
+    return JS('JSExtendableArray', '#[#]', _typeData,
+        JS_GET_NAME(JsGetName.FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG));
   }
 
   bool get _hasNamedArguments {
     return JS('bool', '# in #',
-              JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG),
-              _typeData);
+        JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG), _typeData);
   }
+
   get _namedArguments {
-    return JS('=Object', '#[#]',
-              _typeData,
-              JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG));
+    return JS('=Object', '#[#]', _typeData,
+        JS_GET_NAME(JsGetName.FUNCTION_TYPE_NAMED_PARAMETERS_TAG));
   }
 
   bool get isOriginalDeclaration => true;
@@ -2730,8 +2726,8 @@
         result.add(new JsParameterMirror(name, this, type));
       }
     }
-    return _cachedParameters = new UnmodifiableListView<ParameterMirror>(
-        result);
+    return _cachedParameters =
+        new UnmodifiableListView<ParameterMirror>(result);
   }
 
   String _unmangleIfPreserved(String mangled) {
@@ -2804,10 +2800,13 @@
 }
 
 TypeMirror typeMirrorFromRuntimeTypeRepresentation(
-    DeclarationMirror owner,
-    var /*int|List|JsFunction|TypeImpl*/ type) {
+    DeclarationMirror owner, var /*int|List|JsFunction|TypeImpl*/ type) {
   // TODO(ahe): This method might benefit from using convertRtiToRuntimeType
   // instead of working on strings.
+  if (type == null) {
+    return JsMirrorSystem._dynamicType;
+  }
+
   ClassMirror ownerClass;
   DeclarationMirror context = owner;
   while (context != null) {
@@ -2821,9 +2820,7 @@
   }
 
   String representation;
-  if (type == null) {
-    return JsMirrorSystem._dynamicType;
-  } else if (type is TypeImpl) {
+  if (type is TypeImpl) {
     return reflectType(type);
   } else if (ownerClass == null) {
     representation = runtimeTypeToString(type);
@@ -2852,8 +2849,7 @@
       // [type] represents a type variable used as type argument for example
       // the type argument of Bar: class Foo<T> extends Bar<T> {}
       TypeMirror typeArgument = getTypeArgument(type);
-      if (typeArgument is JsTypeVariableMirror)
-        return typeArgument;
+      if (typeArgument is JsTypeVariableMirror) return typeArgument;
     }
     String substituteTypeVariable(int index) {
       var typeArgument = getTypeArgument(index);
@@ -2873,6 +2869,7 @@
       }
       return typeArgument._mangledName;
     }
+
     representation =
         runtimeTypeToString(type, onTypeVariable: substituteTypeVariable);
   }
@@ -2881,10 +2878,10 @@
         getMangledTypeName(createRuntimeType(representation)));
   }
   String typedefPropertyName = JS_GET_NAME(JsGetName.TYPEDEF_TAG);
-  if (type != null && JS('', '#[#]', type, typedefPropertyName) != null) {
+  if (JS('', '#[#]', type, typedefPropertyName) != null) {
     return typeMirrorFromRuntimeTypeRepresentation(
         owner, JS('', '#[#]', type, typedefPropertyName));
-  } else if (type != null && isDartFunctionType(type)) {
+  } else if (isDartFunctionType(type)) {
     return new JsFunctionTypeMirror(type, owner);
   }
   return reflectClass(Function);
@@ -2905,19 +2902,17 @@
   if (metadataFunction != null) return JS('', '#()', metadataFunction);
   if (JS('bool', 'typeof # != "function"', victim)) return const [];
   if (JS('bool', '# in #', r'$metadataIndex', victim)) {
-    return JSArray.markFixedList(
-        JS('JSExtendableArray',
-           r'#.$reflectionInfo.splice(#.$metadataIndex)', victim, victim))
-        .map((int i) => getMetadata(i)).toList();
+    return JSArray
+        .markFixedList(JS('JSExtendableArray',
+            r'#.$reflectionInfo.splice(#.$metadataIndex)', victim, victim))
+        .map((int i) => getMetadata(i))
+        .toList();
   }
   return const [];
 }
 
-void parseCompactFieldSpecification(
-    JsDeclarationMirror owner,
-    fieldSpecification,
-    bool isStatic,
-    List<Mirror> result) {
+void parseCompactFieldSpecification(JsDeclarationMirror owner,
+    fieldSpecification, bool isStatic, List<Mirror> result) {
   List fieldsMetadata = null;
   List<String> fields;
   if (fieldSpecification is List) {
@@ -2930,7 +2925,7 @@
   }
   int fieldNumber = 0;
   for (String field in fields) {
-    if (r'$ti' == field) continue;  // Strip type info pseudofield.
+    if (r'$ti' == field) continue; // Strip type info pseudofield.
     var metadata;
     if (fieldsMetadata != null) {
       metadata = fieldsMetadata[fieldNumber++];
@@ -2950,29 +2945,29 @@
 
 bool isOperatorName(String name) {
   switch (name) {
-  case '==':
-  case '[]':
-  case '*':
-  case '/':
-  case '%':
-  case '~/':
-  case '+':
-  case '<<':
-  case '>>':
-  case '>=':
-  case '>':
-  case '<=':
-  case '<':
-  case '&':
-  case '^':
-  case '|':
-  case '-':
-  case 'unary-':
-  case '[]=':
-  case '~':
-    return true;
-  default:
-    return false;
+    case '==':
+    case '[]':
+    case '*':
+    case '/':
+    case '%':
+    case '~/':
+    case '+':
+    case '<<':
+    case '>>':
+    case '>=':
+    case '>':
+    case '<=':
+    case '<':
+    case '&':
+    case '^':
+    case '|':
+    case '-':
+    case 'unary-':
+    case '[]=':
+    case '~':
+      return true;
+    default:
+      return false;
   }
 }
 
@@ -3010,35 +3005,28 @@
   final int _kind;
 
   NoSuchStaticMethodError.missingConstructor(
-      this._cls,
-      this._name,
-      this._positionalArguments,
-      this._namedArguments)
+      this._cls, this._name, this._positionalArguments, this._namedArguments)
       : _kind = MISSING_CONSTRUCTOR;
 
   /// If the given class is `null` the static method/getter/setter is top-level.
   NoSuchStaticMethodError.method(
-      this._cls,
-      this._name,
-      this._positionalArguments,
-      this._namedArguments)
+      this._cls, this._name, this._positionalArguments, this._namedArguments)
       : _kind = MISSING_METHOD;
 
   String toString() {
     // TODO(floitsch): show arguments.
-    switch(_kind) {
-    case MISSING_CONSTRUCTOR:
-      return
-          "NoSuchMethodError: No constructor named '${n(_name)}' in class"
-          " '${n(_cls.qualifiedName)}'.";
-    case MISSING_METHOD:
-      if (_cls == null) {
-        return "NoSuchMethodError: No top-level method named '${n(_name)}'.";
-      }
-      return "NoSuchMethodError: No static method named '${n(_name)}' in"
-             " class '${n(_cls.qualifiedName)}'";
-    default:
-      return 'NoSuchMethodError';
+    switch (_kind) {
+      case MISSING_CONSTRUCTOR:
+        return "NoSuchMethodError: No constructor named '${n(_name)}' in class"
+            " '${n(_cls.qualifiedName)}'.";
+      case MISSING_METHOD:
+        if (_cls == null) {
+          return "NoSuchMethodError: No top-level method named '${n(_name)}'.";
+        }
+        return "NoSuchMethodError: No static method named '${n(_name)}' in"
+            " class '${n(_cls.qualifiedName)}'";
+      default:
+        return 'NoSuchMethodError';
     }
   }
 }
@@ -3048,8 +3036,7 @@
     return new _symbol_dev.Symbol.validated(name);
   }
   if (library == null) {
-    throw new ArgumentError(
-        "Library required for private symbol name: $name");
+    throw new ArgumentError("Library required for private symbol name: $name");
   }
   if (!_symbol_dev.Symbol.isValidSymbol(name)) {
     throw new ArgumentError("Not a valid symbol name: $name");
diff --git a/sdk/lib/_internal/js_runtime/lib/js_rti.dart b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
index ba18319..de7db23 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_rti.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
@@ -159,22 +159,91 @@
 String runtimeTypeToString(var rti, {String onTypeVariable(int i)}) {
   if (rti == null) {
     return 'dynamic';
-  } else if (isJsArray(rti)) {
+  }
+  if (isJsArray(rti)) {
     // A list representing a type with arguments.
     return getRuntimeTypeAsString(rti, onTypeVariable: onTypeVariable);
-  } else if (isJsFunction(rti)) {
+  }
+  if (isJsFunction(rti)) {
     // A reference to the constructor.
     return rawRtiToJsConstructorName(rti);
-  } else if (rti is int) {
-    if (onTypeVariable == null) {
-      return rti.toString();
-    } else {
-      return onTypeVariable(rti);
-    }
-  } else {
-    // TODO(ahe): Handle function types, and be sure to always return a string.
-    return null;
   }
+  if (rti is int) {
+    return '${onTypeVariable == null ? rti : onTypeVariable(rti)}';
+  }
+  if (JS('bool', 'typeof #.func != "undefined"', rti)) {
+    // If the RTI has typedef equivalence info (via mirrors), use that since the
+    // mirrors helpers will re-parse the generated string.
+
+    String typedefPropertyName = JS_GET_NAME(JsGetName.TYPEDEF_TAG);
+    var typedefInfo = JS('', '#[#]', rti, typedefPropertyName);
+    if (typedefInfo != null) {
+      return runtimeTypeToString(typedefInfo, onTypeVariable: onTypeVariable);
+    }
+    return _functionRtiToString(rti, onTypeVariable);
+  }
+  // We should not get here.
+  return 'unknown-reified-type';
+}
+
+String _functionRtiToString(var rti, String onTypeVariable(int i)) {
+  String returnTypeText;
+  if (JS('bool', '!!#.v', rti)) {
+    returnTypeText = 'void';
+  } else {
+    var returnRti = JS('', '#.ret', rti);
+    returnTypeText =
+        runtimeTypeToString(returnRti, onTypeVariable: onTypeVariable);
+  }
+
+  String argumentsText = '';
+  String sep = '';
+
+  bool hasArguments = JS('bool', '"args" in #', rti);
+  if (hasArguments) {
+    List arguments = JS('JSFixedArray', '#.args', rti);
+    for (var argument in arguments) {
+      argumentsText += sep;
+      argumentsText +=
+          runtimeTypeToString(argument, onTypeVariable: onTypeVariable);
+      sep = ', ';
+    }
+  }
+
+  bool hasOptionalArguments = JS('bool', '"opt" in #', rti);
+  if (hasOptionalArguments) {
+    List optionalArguments = JS('JSFixedArray', '#.opt', rti);
+    argumentsText += '$sep[';
+    sep = '';
+    for (var argument in optionalArguments) {
+      argumentsText += sep;
+      argumentsText +=
+          runtimeTypeToString(argument, onTypeVariable: onTypeVariable);
+      sep = ', ';
+    }
+    argumentsText += ']';
+  }
+
+  bool hasNamedArguments = JS('bool', '"named" in #', rti);
+  if (hasNamedArguments) {
+    var namedArguments = JS('', '#.named', rti);
+    argumentsText += '$sep{';
+    sep = '';
+    for (String name in extractKeys(namedArguments)) {
+      argumentsText += sep;
+      argumentsText += runtimeTypeToString(JS('', '#[#]', namedArguments, name),
+                                           onTypeVariable: onTypeVariable);
+      argumentsText += ' $name';
+      sep = ', ';
+    }
+    argumentsText += '}';
+  }
+
+  // TODO(sra): Below is the same format as the VM. Change to:
+  //
+  //     '${returnTypeText} Function(${argumentsText})';
+  //
+  return '(${argumentsText}) => ${returnTypeText}';
 }
 
 /**
@@ -188,7 +257,7 @@
   assert(isJsArray(types));
   bool firstArgument = true;
   bool allDynamic = true;
-  StringBuffer buffer = new StringBuffer();
+  StringBuffer buffer = new StringBuffer('');
   for (int index = startIndex; index < getLength(types); index++) {
     if (firstArgument) {
       firstArgument = false;
@@ -210,6 +279,10 @@
  * In minified mode does *not* use unminified identifiers (even when present).
  */
 String getRuntimeTypeString(var object) {
+  // Check for function type first, since non-tearoff closures look like classes
+  // due to closure conversion.
+  var functionRti = extractFunctionTypeObjectFrom(object);
+  if (functionRti != null) return runtimeTypeToString(functionRti);
   String className = getClassName(object);
   if (object == null) return className;
   var rti = JS('var', r'#.$ti', object);
@@ -448,12 +521,13 @@
   if (isIdentical(s, t)) return true;
   // If either type is dynamic, [s] is a subtype of [t].
   if (s == null || t == null) return true;
+  if (isNullType(s)) return true;
   if (isDartFunctionType(t)) {
     return isFunctionSubtype(s, t);
   }
-  // Check function types against the Function class.
+  // Check function types against the Function class and the Object class.
   if (isDartFunctionType(s)) {
-    return isDartFunctionTypeRti(t);
+    return isDartFunctionTypeRti(t) || isDartObjectTypeRti(t);
   }
 
   // Get the object describing the class and check for the subtyping flag
diff --git a/sdk/lib/_internal/js_runtime/lib/mirrors_patch.dart b/sdk/lib/_internal/js_runtime/lib/mirrors_patch.dart
index 758b164..c370043 100644
--- a/sdk/lib/_internal/js_runtime/lib/mirrors_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/mirrors_patch.dart
@@ -10,6 +10,12 @@
 @patch
 class MirrorSystem {
   @patch
+  LibraryMirror findLibrary(Symbol libraryName) {
+    return libraries.values.singleWhere(
+        (library) => library.simpleName == libraryName);
+  }
+
+  @patch
   static String getName(Symbol symbol) => js.getName(symbol);
 
   @patch
@@ -37,9 +43,9 @@
 }
 
 @patch
-TypeMirror reflectType(Type key) {
+TypeMirror reflectType(Type key, [List<Type> typeArguments]) {
   if (key == dynamic) {
     return currentMirrorSystem().dynamicType;
   }
-  return js.reflectType(key);
+  return js.reflectType(key, typeArguments);
 }
diff --git a/sdk/lib/_internal/js_runtime/lib/string_helper.dart b/sdk/lib/_internal/js_runtime/lib/string_helper.dart
index 24e21f7..78a0980 100644
--- a/sdk/lib/_internal/js_runtime/lib/string_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/string_helper.dart
@@ -142,9 +142,9 @@
   if (pattern is String) {
     if (pattern == "") {
       if (receiver == "") {
-        return replacement;
+        return JS('String', '#', replacement); // help type inference.
       } else {
-        StringBuffer result = new StringBuffer();
+        StringBuffer result = new StringBuffer('');
         int length = receiver.length;
         result.write(replacement);
         for (int i = 0; i < length; i++) {
@@ -184,7 +184,7 @@
   if (pattern is! Pattern) {
     throw new ArgumentError.value(pattern, 'pattern', 'is not a Pattern');
   }
-  StringBuffer buffer = new StringBuffer();
+  StringBuffer buffer = new StringBuffer('');
   int startIndex = 0;
   for (Match match in pattern.allMatches(receiver)) {
     buffer.write(onNonMatch(receiver.substring(startIndex, match.start)));
@@ -197,7 +197,7 @@
 
 stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch) {
   // Pattern is the empty string.
-  StringBuffer buffer = new StringBuffer();
+  StringBuffer buffer = new StringBuffer('');
   int length = receiver.length;
   int i = 0;
   buffer.write(onNonMatch(""));
@@ -229,7 +229,7 @@
     return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch);
   }
   int length = receiver.length;
-  StringBuffer buffer = new StringBuffer();
+  StringBuffer buffer = new StringBuffer('');
   int startIndex = 0;
   while (startIndex < length) {
     int position = stringIndexOfStringUnchecked(receiver, pattern, startIndex);
diff --git a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
index b439338..0f59489 100644
--- a/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
+++ b/sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart
@@ -36,7 +36,6 @@
 /// Mapping of "dart:" library name (e.g. "core") to information about that
 /// library.
 const Map<String, LibraryInfo> libraries = const {
-
   "async": const LibraryInfo(
       "async/async.dart",
       categories: "Client,Server",
@@ -182,8 +181,7 @@
       "internal/internal.dart",
       categories: "",
       documented: false,
-      dart2jsPatchPath:
-          "_internal/js_runtime/lib/internal_patch.dart"),
+      dart2jsPatchPath: "_internal/js_runtime/lib/internal_patch.dart"),
 
   "_js_helper": const LibraryInfo(
       "_internal/js_runtime/lib/js_helper.dart",
@@ -250,7 +248,6 @@
  * Information about a "dart:" library.
  */
 class LibraryInfo {
-
   /**
    * Path to the library's *.dart file relative to this file.
    */
@@ -336,8 +333,6 @@
   }
 }
 
-
-
 /**
  * Abstraction to capture the maturity of a library.
  */
@@ -351,28 +346,28 @@
   String toString() => "$name: $level\n$description\n";
 
   static const Maturity DEPRECATED = const Maturity(0, "Deprecated",
-    "This library will be remove before next major release.");
+      "This library will be remove before next major release.");
 
   static const Maturity EXPERIMENTAL = const Maturity(1, "Experimental",
-    "This library is experimental and will likely change or be removed\n"
-    "in future versions.");
+      "This library is experimental and will likely change or be removed\n"
+      "in future versions.");
 
   static const Maturity UNSTABLE = const Maturity(2, "Unstable",
-    "This library is in still changing and have not yet endured\n"
-    "sufficient real-world testing.\n"
-    "Backwards-compatibility is NOT guaranteed.");
+      "This library is in still changing and have not yet endured\n"
+      "sufficient real-world testing.\n"
+      "Backwards-compatibility is NOT guaranteed.");
 
   static const Maturity WEB_STABLE = const Maturity(3, "Web Stable",
-    "This library is tracking the DOM evolution as defined by WC3.\n"
-    "Backwards-compatibility is NOT guaranteed.");
+      "This library is tracking the DOM evolution as defined by WC3.\n"
+      "Backwards-compatibility is NOT guaranteed.");
 
   static const Maturity STABLE = const Maturity(4, "Stable",
-    "The library is stable. API backwards-compatibility is guaranteed.\n"
-    "However implementation details might change.");
+      "The library is stable. API backwards-compatibility is guaranteed.\n"
+      "However implementation details might change.");
 
   static const Maturity LOCKED = const Maturity(5, "Locked",
-    "This library will not change except when serious bugs are encountered.");
+      "This library will not change except when serious bugs are encountered.");
 
   static const Maturity UNSPECIFIED = const Maturity(-1, "Unspecified",
-    "The maturity for this library has not been specified.");
+      "The maturity for this library has not been specified.");
 }
diff --git a/sdk/lib/async/async_error.dart b/sdk/lib/async/async_error.dart
index 2f3419e..62996c3 100644
--- a/sdk/lib/async/async_error.dart
+++ b/sdk/lib/async/async_error.dart
@@ -14,12 +14,12 @@
   }
 }
 
-Function _registerErrorHandler/*<R>*/(Function errorHandler, Zone zone) {
+Function _registerErrorHandler<R>(Function errorHandler, Zone zone) {
   if (errorHandler is ZoneBinaryCallback) {
-    return zone.registerBinaryCallback/*<R, dynamic, StackTrace>*/(
+    return zone.registerBinaryCallback<R, dynamic, StackTrace>(
         errorHandler as dynamic/*=ZoneBinaryCallback<R, dynamic, StackTrace>*/);
   } else {
-    return zone.registerUnaryCallback/*<R, dynamic>*/(
+    return zone.registerUnaryCallback<R, dynamic>(
         errorHandler as dynamic/*=ZoneUnaryCallback<R, dynamic>*/);
   }
 }
diff --git a/sdk/lib/async/broadcast_stream_controller.dart b/sdk/lib/async/broadcast_stream_controller.dart
index c34ec9f..22ed3e9 100644
--- a/sdk/lib/async/broadcast_stream_controller.dart
+++ b/sdk/lib/async/broadcast_stream_controller.dart
@@ -540,5 +540,5 @@
   }
   Future cancel() { return new _Future.immediate(null); }
   bool get isPaused => _pauseCount > 0;
-  Future/*<E>*/ asFuture/*<E>*/([Object/*=E*/ value]) => new _Future/*<E>*/();
+  Future<E> asFuture<E>([E value]) => new _Future<E>();
 }
diff --git a/sdk/lib/async/future.dart b/sdk/lib/async/future.dart
index 7d892c6..49b2460 100644
--- a/sdk/lib/async/future.dart
+++ b/sdk/lib/async/future.dart
@@ -4,6 +4,46 @@
 
 part of dart.async;
 
+/// A type representing values that are either `Future<T>` or `T`.
+///
+/// This class declaration is a public stand-in for an internal
+/// future-or-value generic type. References to this class are resolved to the
+/// internal type.
+///
+/// It is a compile-time error for any class to extend, mix in or implement
+/// `FutureOr`.
+///
+/// Note: the `FutureOr<T>` type is interpreted as `dynamic` in non strong-mode.
+///
+/// # Examples
+/// ``` dart
+/// // The `Future<T>.then` function takes a callback [f] that returns either
+/// // an `S` or a `Future<S>`.
+/// Future<S> then<S>(FutureOr<S> f(T x), ...);
+///
+/// // `Completer<T>.complete` takes either a `T` or `Future<T>`.
+/// void complete(FutureOr<T> value);
+/// ```
+///
+/// # Advanced
+/// The `FutureOr<int>` type is actually the "type union" of the types `int` and
+/// `Future<int>`. This type union is defined in such a way that
+/// `FutureOr<Object>` is both a super- and sub-type of `Object` (sub-type
+/// because `Object` is one of the types of the union, super-type because
+/// `Object` is a super-type of both of the types of the union). Together it
+/// means that `FutureOr<Object>` is equivalent to `Object`.
+///
+/// As a corollary, `FutureOr<Object>` is equivalent to
+/// `FutureOr<FutureOr<Object>>`, `FutureOr<Future<Object>> is equivalent to
+/// `Future<Object>`.
+abstract class FutureOr<T> {
+  // Private constructor, so that it is not subclassable, mixable, or
+  // instantiable.
+  FutureOr._() {
+    throw new UnsupportedError("FutureOr can't be instantiated");
+  }
+}
+
 /**
  * An object representing a delayed computation.
  *
@@ -254,11 +294,11 @@
    * The call to `cleanUp` should not throw. If it does, the error will be an
    * uncaught asynchronous error.
    */
-  static Future<List/*<T>*/> wait/*<T>*/(Iterable<Future/*<T>*/> futures,
+  static Future<List<T>> wait<T>(Iterable<Future<T>> futures,
                            {bool eagerError: false,
-                            void cleanUp(/*=T*/ successValue)}) {
-    final _Future<List/*<T>*/> result = new _Future<List/*<T>*/>();
-    List/*<T>*/ values;  // Collects the values. Set to null on error.
+                            void cleanUp(T successValue)}) {
+    final _Future<List<T>> result = new _Future<List<T>>();
+    List<T> values;  // Collects the values. Set to null on error.
     int remaining = 0;  // How many futures are we waiting for.
     var error;   // The first error from a future.
     StackTrace stackTrace;  // The stackTrace that came with the error.
@@ -292,7 +332,7 @@
       // position in the list of values.
       for (Future future in futures) {
         int pos = remaining;
-        future.then((Object/*=T*/ value) {
+        future.then((T value) {
           remaining--;
           if (values != null) {
             values[pos] = value;
@@ -317,7 +357,7 @@
       if (remaining == 0) {
         return new Future.value(const []);
       }
-      values = new List/*<T>*/(remaining);
+      values = new List<T>(remaining);
     } catch (e, st) {
       // The error must have been thrown while iterating over the futures
       // list, or while installing a callback handler on the future.
@@ -350,9 +390,9 @@
    * If [futures] is empty, or if none of its futures complete,
    * the returned future never completes.
    */
-  static Future/*<T>*/ any/*<T>*/(Iterable<Future/*<T>*/> futures) {
-    var completer = new Completer/*<T>*/.sync();
-    var onValue = (/*=T*/ value) {
+  static Future<T> any<T>(Iterable<Future<T>> futures) {
+    var completer = new Completer<T>.sync();
+    var onValue = (T value) {
       if (!completer.isCompleted) completer.complete(value);
     };
     var onError = (error, stack) {
@@ -457,7 +497,7 @@
    * with a `test` parameter, instead of handling both value and error in a
    * single [then] call.
    */
-  Future/*<S>*/ then/*<S>*/(onValue(T value), { Function onError });
+  Future<S> then<S>(FutureOr<S> onValue(T value), { Function onError });
 
   /**
    * Handles errors emitted by this [Future].
@@ -520,7 +560,7 @@
   // `isCheck` we should also expect functions that take a specific argument.
   // Note: making `catchError` return a `Future<T>` in non-strong mode could be
   // a breaking change.
-  Future/*<T>*/ catchError(Function onError,
+  Future<T> catchError(Function onError,
                            {bool test(Object error)});
 
   /**
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index dd07720..4e6ba42 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -128,14 +128,14 @@
   }
 
   dynamic/*T|Future<T>*/ handleValue(S sourceResult) {
-    return _zone.runUnary/*<dynamic/*T|Future<T>*/, S>*/(
+    return _zone.runUnary<dynamic/*T|Future<T>*/, S>(
         _onValue, sourceResult);
   }
 
   bool matchesErrorTest(AsyncError asyncError) {
     if (!hasErrorTest) return true;
     _FutureErrorTest test = _errorTest;
-    return _zone.runUnary/*<bool, dynamic>*/(_errorTest, asyncError.error);
+    return _zone.runUnary<bool, dynamic>(_errorTest, asyncError.error);
   }
 
   dynamic/*T|Future<T>*/ handleError(AsyncError asyncError) {
@@ -147,7 +147,7 @@
           asyncError.error,
           asyncError.stackTrace);
     } else {
-      return _zone.runUnary/*<dynamic/*T|Future<T>*/, dynamic>*/(
+      return _zone.runUnary<dynamic/*T|Future<T>*/, dynamic>(
           errorCallback, asyncError.error);
     }
   }
@@ -230,33 +230,33 @@
     _resultOrListeners = source;
   }
 
-  Future/*<E>*/ then/*<E>*/(
-      /*=dynamic/*E|Future<E>*/*/ f(T value), { Function onError }) {
+  Future<E> then<E>(
+      FutureOr<E> f(T value), { Function onError }) {
     Zone currentZone = Zone.current;
     ZoneUnaryCallback registered;
     if (!identical(currentZone, _ROOT_ZONE)) {
-      f = currentZone.registerUnaryCallback/*<dynamic, T>*/(f);
+      f = currentZone.registerUnaryCallback<FutureOr<E>, T>(f);
       if (onError != null) {
-        onError = _registerErrorHandler/*<T>*/(onError, currentZone);
+        onError = _registerErrorHandler<T>(onError, currentZone);
       }
     }
-    return _thenNoZoneRegistration/*<E>*/(f, onError);
+    return _thenNoZoneRegistration<E>(f, onError);
   }
 
   // This method is used by async/await.
-  Future/*<E>*/ _thenNoZoneRegistration/*<E>*/(f(T value), Function onError) {
-    _Future/*<E>*/ result = new _Future/*<E>*/();
-    _addListener(new _FutureListener/*<T, E>*/.then(result, f, onError));
+  Future<E> _thenNoZoneRegistration<E>(f(T value), Function onError) {
+    _Future<E> result = new _Future<E>();
+    _addListener(new _FutureListener<T, E>.then(result, f, onError));
     return result;
   }
 
-  Future/*<T>*/ catchError(Function onError, { bool test(error) }) {
-    _Future/*<T>*/ result = new _Future/*<T>*/();
+  Future<T> catchError(Function onError, { bool test(error) }) {
+    _Future<T> result = new _Future<T>();
     if (!identical(result._zone, _ROOT_ZONE)) {
-      onError = _registerErrorHandler/*<T>*/(onError, result._zone);
+      onError = _registerErrorHandler<T>(onError, result._zone);
       if (test != null) test = result._zone.registerUnaryCallback(test);
     }
-    _addListener(new _FutureListener/*<T, T>*/.catchError(
+    _addListener(new _FutureListener<T, T>.catchError(
         result, onError, test));
     return result;
   }
@@ -264,9 +264,9 @@
   Future<T> whenComplete(action()) {
     _Future<T> result = new _Future<T>();
     if (!identical(result._zone, _ROOT_ZONE)) {
-      action = result._zone.registerCallback/*<dynamic>*/(action);
+      action = result._zone.registerCallback<dynamic>(action);
     }
-    _addListener(new _FutureListener/*<T, T>*/.whenComplete(result, action));
+    _addListener(new _FutureListener<T, T>.whenComplete(result, action));
     return result;
   }
 
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index f114f8d..f484cfb 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -384,8 +384,8 @@
    * If a broadcast stream is listened to more than once, each subscription
    * will individually call [convert] on each data event.
    */
-  Stream/*<S>*/ map/*<S>*/(/*=S*/ convert(T event)) {
-    return new _MapStream<T, dynamic/*=S*/>(this, convert);
+  Stream<S> map<S>(S convert(T event)) {
+    return new _MapStream<T, S>(this, convert);
   }
 
   /**
@@ -398,15 +398,15 @@
    *
    * The returned stream is a broadcast stream if this stream is.
    */
-  Stream/*<E>*/ asyncMap/*<E>*/(convert(T event)) {
-    StreamController/*<E>*/ controller;
-    StreamSubscription/*<T>*/ subscription;
+  Stream<E> asyncMap<E>(convert(T event)) {
+    StreamController<E> controller;
+    StreamSubscription<T> subscription;
 
     void onListen() {
       final add = controller.add;
       assert(controller is _StreamController ||
              controller is _BroadcastStreamController);
-      final _EventSink/*<E>*/ eventSink =
+      final _EventSink<E> eventSink =
           controller as Object /*=_EventSink<E>*/;
       final addError = eventSink._addError;
       subscription = this.listen(
@@ -432,13 +432,13 @@
     }
 
     if (this.isBroadcast) {
-      controller = new StreamController/*<E>*/.broadcast(
+      controller = new StreamController<E>.broadcast(
         onListen: onListen,
         onCancel: () { subscription.cancel(); },
         sync: true
       );
     } else {
-      controller = new StreamController/*<E>*/(
+      controller = new StreamController<E>(
         onListen: onListen,
         onPause: () { subscription.pause(); },
         onResume: () { subscription.resume(); },
@@ -462,17 +462,17 @@
    *
    * The returned stream is a broadcast stream if this stream is.
    */
-  Stream/*<E>*/ asyncExpand/*<E>*/(Stream/*<E>*/ convert(T event)) {
-    StreamController/*<E>*/ controller;
+  Stream<E> asyncExpand<E>(Stream<E> convert(T event)) {
+    StreamController<E> controller;
     StreamSubscription<T> subscription;
     void onListen() {
       assert(controller is _StreamController ||
              controller is _BroadcastStreamController);
-      final _EventSink/*<E>*/ eventSink =
+      final _EventSink<E> eventSink =
           controller as Object /*=_EventSink<E>*/;
       subscription = this.listen(
           (T event) {
-            Stream/*<E>*/ newStream;
+            Stream<E> newStream;
             try {
               newStream = convert(event);
             } catch (e, s) {
@@ -490,13 +490,13 @@
       );
     }
     if (this.isBroadcast) {
-      controller = new StreamController/*<E>*/.broadcast(
+      controller = new StreamController<E>.broadcast(
         onListen: onListen,
         onCancel: () { subscription.cancel(); },
         sync: true
       );
     } else {
-      controller = new StreamController/*<E>*/(
+      controller = new StreamController<E>(
         onListen: onListen,
         onPause: () { subscription.pause(); },
         onResume: () { subscription.resume(); },
@@ -551,8 +551,8 @@
    * If a broadcast stream is listened to more than once, each subscription
    * will individually call `convert` and expand the events.
    */
-  Stream/*<S>*/ expand/*<S>*/(Iterable/*<S>*/ convert(T value)) {
-    return new _ExpandStream<T, dynamic/*=S*/>(this, convert);
+  Stream<S> expand<S>(Iterable<S> convert(T value)) {
+    return new _ExpandStream<T, S>(this, convert);
   }
 
   /**
@@ -585,8 +585,8 @@
    * The `streamTransformer` can decide whether it wants to return a
    * broadcast stream or not.
    */
-  Stream/*<S>*/ transform/*<S>*/(
-      StreamTransformer<T, dynamic/*=S*/ > streamTransformer) {
+  Stream<S> transform<S>(
+      StreamTransformer<T, S > streamTransformer) {
     return streamTransformer.bind(this);
   }
 
@@ -627,17 +627,17 @@
   }
 
   /** Reduces a sequence of values by repeatedly applying [combine]. */
-  Future/*<S>*/ fold/*<S>*/(var/*=S*/ initialValue,
-      /*=S*/ combine(var/*=S*/ previous, T element)) {
+  Future<S> fold<S>(S initialValue,
+      S combine(S previous, T element)) {
 
-    _Future/*<S>*/ result = new _Future/*<S>*/();
-    var/*=S*/ value = initialValue;
+    _Future<S> result = new _Future<S>();
+    S value = initialValue;
     StreamSubscription subscription;
     subscription = this.listen(
       (T element) {
         _runUserCode(
           () => combine(value, element),
-          (/*=S*/ newValue) { value = newValue; },
+          (S newValue) { value = newValue; },
           _cancelAndErrorClosure(subscription, result)
         );
       },
@@ -890,7 +890,7 @@
 
   /**
    * Discards all data on the stream, but signals when it's done or an error
-   * occured.
+   * occurred.
    *
    * When subscribing using [drain], cancelOnError will be true. This means
    * that the future will complete with the first error on the stream and then
@@ -899,8 +899,8 @@
    * In case of a `done` event the future completes with the given
    * [futureValue].
    */
-  Future/*<E>*/ drain/*<E>*/([/*=E*/ futureValue])
-      => listen(null, cancelOnError: true).asFuture/*<E>*/(futureValue);
+  Future<E> drain<E>([E futureValue])
+      => listen(null, cancelOnError: true).asFuture<E>(futureValue);
 
   /**
    * Provides at most the first [count] data events of this stream.
@@ -1351,7 +1351,7 @@
         // TODO(floitsch): the return type should be 'void', and the type
         // should be inferred.
         var registeredOnTimeout =
-            zone.registerUnaryCallback/*<dynamic, EventSink<T>>*/(onTimeout);
+            zone.registerUnaryCallback<dynamic, EventSink<T>>(onTimeout);
         _ControllerEventSinkWrapper wrapper =
             new _ControllerEventSinkWrapper(null);
         timeout = () {
@@ -1498,7 +1498,7 @@
    * In case of a `done` event the future completes with the given
    * [futureValue].
    */
-  Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]);
+  Future<E> asFuture<E>([E futureValue]);
 }
 
 
@@ -1623,7 +1623,7 @@
    * Returns the same future as [done].
    *
    * The stream sink may close before the [close] method is called, either due
-   * to an error or because it is itself provding events to someone who has
+   * to an error or because it is itself providing events to someone who has
    * stopped listening. In that case, the [done] future is completed first,
    * and the `close` method will return the `done` future when called.
    *
diff --git a/sdk/lib/async/stream_controller.dart b/sdk/lib/async/stream_controller.dart
index 87b64e8..d29fae3 100644
--- a/sdk/lib/async/stream_controller.dart
+++ b/sdk/lib/async/stream_controller.dart
@@ -780,7 +780,7 @@
 abstract class _AsyncStreamControllerDispatch<T>
     implements _StreamController<T> {
   void _sendData(T data) {
-    _subscription._addPending(new _DelayedData<dynamic /*=T*/>(data));
+    _subscription._addPending(new _DelayedData<T>(data));
   }
 
   void _sendError(Object error, StackTrace stackTrace) {
diff --git a/sdk/lib/async/stream_impl.dart b/sdk/lib/async/stream_impl.dart
index 7f89464..29cfbd1 100644
--- a/sdk/lib/async/stream_impl.dart
+++ b/sdk/lib/async/stream_impl.dart
@@ -139,14 +139,14 @@
     if (handleData == null) handleData = _nullDataHandler;
     // TODO(floitsch): the return type should be 'void', and the type
     // should be inferred.
-    _onData = _zone.registerUnaryCallback/*<dynamic, T>*/(handleData);
+    _onData = _zone.registerUnaryCallback<dynamic, T>(handleData);
   }
 
   void onError(Function handleError) {
     if (handleError == null) handleError = _nullErrorHandler;
     // We are not allowed to use 'void' as type argument for the generic type,
     // so we use 'dynamic' instead.
-    _onError = _registerErrorHandler/*<dynamic>*/(handleError, _zone);
+    _onError = _registerErrorHandler<dynamic>(handleError, _zone);
   }
 
   void onDone(void handleDone()) {
@@ -193,8 +193,8 @@
     return _cancelFuture ?? Future._nullFuture;
   }
 
-  Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]) {
-    _Future/*<E>*/ result = new _Future/*<E>*/();
+  Future<E> asFuture<E>([E futureValue]) {
+    _Future<E> result = new _Future<E>();
 
     // Overwrite the onDone and onError handlers.
     _onDone = () { result._complete(futureValue); };
@@ -257,7 +257,7 @@
     if (_canFire) {
       _sendData(data);
     } else {
-      _addPending(new _DelayedData<dynamic /*=T*/>(data));
+      _addPending(new _DelayedData<T>(data));
     }
   }
 
@@ -309,7 +309,7 @@
   void _addPending(_DelayedEvent event) {
     _StreamImplEvents<T> pending = _pending;
     if (_pending == null) {
-      pending = _pending = new _StreamImplEvents<dynamic /*=T*/>();
+      pending = _pending = new _StreamImplEvents<T>();
     }
     pending.add(event);
     if (!_hasPending) {
@@ -349,7 +349,7 @@
             as Object /*=ZoneBinaryCallback<dynamic, Object, StackTrace>*/;
         _zone.runBinaryGuarded(errorCallback, error, stackTrace);
       } else {
-        _zone.runUnaryGuarded/*<dynamic, dynamic>*/(
+        _zone.runUnaryGuarded<dynamic, dynamic>(
             _onError as Object /*=ZoneUnaryCallback<dynamic, dynamic>*/, error);
       }
       _state &= ~_STATE_IN_CALLBACK;
@@ -760,8 +760,8 @@
 
   Future cancel() => Future._nullFuture;
 
-  Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]) {
-    _Future/*<E>*/ result = new _Future/*<E>*/();
+  Future<E> asFuture<E>([E futureValue]) {
+    _Future<E> result = new _Future<E>();
     _onDone = () { result._completeWithValue(null); };
     return result;
   }
@@ -789,9 +789,9 @@
       // TODO(floitsch): the return type should be void and should be
       // inferred.
       : _onListenHandler = Zone.current.registerUnaryCallback
-            /*<dynamic, StreamSubscription<T>>*/(onListenHandler),
+            <dynamic, StreamSubscription<T>>(onListenHandler),
         _onCancelHandler = Zone.current.registerUnaryCallback
-            /*<dynamic, StreamSubscription<T>>*/(onCancelHandler),
+            <dynamic, StreamSubscription<T>>(onCancelHandler),
         _zone = Zone.current {
     _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel);
   }
@@ -903,7 +903,7 @@
     return _stream._isSubscriptionPaused;
   }
 
-  Future/*<E>*/ asFuture/*<E>*/([var/*=E*/ futureValue]) {
+  Future<E> asFuture<E>([E futureValue]) {
     throw new UnsupportedError(
         "Cannot change handlers of asBroadcastStream source subscription.");
   }
diff --git a/sdk/lib/async/stream_transformers.dart b/sdk/lib/async/stream_transformers.dart
index 7542c6b..fa32bc4 100644
--- a/sdk/lib/async/stream_transformers.dart
+++ b/sdk/lib/async/stream_transformers.dart
@@ -270,7 +270,7 @@
  *
  * Instead of implementing three classes: a [StreamTransformer], a [Stream]
  * (as the result of a `bind` call) and a [StreamSubscription] (which does the
- * actual work), this class only requires a fincution that is invoked when the
+ * actual work), this class only requires a function that is invoked when the
  * last bit (the subscription) of the transformer-workflow is needed.
  *
  * The given transformer function maps from Stream and cancelOnError to a
diff --git a/sdk/lib/async/timer.dart b/sdk/lib/async/timer.dart
index 1bbb65b..72206ff 100644
--- a/sdk/lib/async/timer.dart
+++ b/sdk/lib/async/timer.dart
@@ -78,7 +78,7 @@
     }
     // TODO(floitsch): the return type should be 'void', and the type
     // should be inferred.
-    var boundCallback = Zone.current.bindUnaryCallback/*<dynamic, Timer>*/(
+    var boundCallback = Zone.current.bindUnaryCallback<dynamic, Timer>(
         callback, runGuarded: true);
     return Zone.current.createPeriodicTimer(duration, boundCallback);
   }
diff --git a/sdk/lib/async/zone.dart b/sdk/lib/async/zone.dart
index b81a7fe..ead5b0b 100644
--- a/sdk/lib/async/zone.dart
+++ b/sdk/lib/async/zone.dart
@@ -216,17 +216,17 @@
  *   to skip zones that would just delegate to their parents.
  */
 abstract class ZoneDelegate {
-  /*=R*/ handleUncaughtError/*<R>*/(
+  R handleUncaughtError<R>(
       Zone zone, error, StackTrace stackTrace);
-  /*=R*/ run/*<R>*/(Zone zone, /*=R*/ f());
-  /*=R*/ runUnary/*<R, T>*/(Zone zone, /*=R*/ f(/*=T*/ arg), /*=T*/ arg);
-  /*=R*/ runBinary/*<R, T1, T2>*/(Zone zone,
-      /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2);
-  ZoneCallback/*<R>*/ registerCallback/*<R>*/(Zone zone, /*=R*/ f());
-  ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
-      Zone zone, /*=R*/ f(/*=T*/ arg));
-  ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
-      Zone zone, /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2));
+  R run<R>(Zone zone, R f());
+  R runUnary<R, T>(Zone zone, R f(T arg), T arg);
+  R runBinary<R, T1, T2>(Zone zone,
+      R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2);
+  ZoneCallback<R> registerCallback<R>(Zone zone, R f());
+  ZoneUnaryCallback<R, T> registerUnaryCallback<R, T>(
+      Zone zone, R f(T arg));
+  ZoneBinaryCallback<R, T1, T2> registerBinaryCallback<R, T1, T2>(
+      Zone zone, R f(T1 arg1, T2 arg2));
   AsyncError errorCallback(Zone zone, Object error, StackTrace stackTrace);
   void scheduleMicrotask(Zone zone, void f());
   Timer createTimer(Zone zone, Duration duration, void f());
@@ -322,7 +322,7 @@
    * By default, when handled by the root zone, uncaught asynchronous errors are
    * treated like uncaught synchronous exceptions.
    */
-  /*=R*/ handleUncaughtError/*<R>*/(error, StackTrace stackTrace);
+  R handleUncaughtError<R>(error, StackTrace stackTrace);
 
   /**
    * The parent zone of the this zone.
@@ -399,7 +399,7 @@
    * the current's zone behavior. All specification entries that are `null`
    * inherit the behavior from the parent zone (`this`).
    *
-   * The new zone inherits the stored values (accessed through [operator []])
+   * The new zone inherits the stored values (accessed through [[]])
    * of this zone and updates them with values from [zoneValues], which either
    * adds new values or overrides existing ones.
    *
@@ -423,7 +423,7 @@
    * [current], custom zones intercepting run should always delegate to their
    * parent zone. They may take actions before and after the call.
    */
-  /*=R*/ run/*<R>*/(/*=R*/ action());
+  R run<R>(R action());
 
   /**
    * Executes the given [action] with [argument] in this zone.
@@ -431,7 +431,7 @@
    * As [run] except that [action] is called with one [argument] instead of
    * none.
    */
-  /*=R*/ runUnary/*<R, T>*/(/*=R*/ action(/*=T*/ argument), /*=T*/ argument);
+  R runUnary<R, T>(R action(T argument), T argument);
 
   /**
    * Executes the given [action] with [argument1] and [argument2] in this
@@ -439,9 +439,9 @@
    *
    * As [run] except that [action] is called with two arguments instead of none.
    */
-  /*=R*/ runBinary/*<R, T1, T2>*/(
-      /*=R*/ action(/*=T1*/ argument1, /*=T2*/ argument2), /*=T1*/ argument1,
-      /*=T2*/ argument2);
+  R runBinary<R, T1, T2>(
+      R action(T1 argument1, T2 argument2), T1 argument1,
+      T2 argument2);
 
   /**
    * Executes the given [action] in this zone and catches synchronous
@@ -458,7 +458,7 @@
    *
    * See [run].
    */
-  /*=R*/ runGuarded/*<R>*/(/*=R*/ action());
+  R runGuarded<R>(R action());
 
   /**
    * Executes the given [action] with [argument] in this zone and
@@ -466,8 +466,8 @@
    *
    * See [runGuarded].
    */
-  /*=R*/ runUnaryGuarded/*<R, T>*/(/*=R*/ action(/*=T*/ argument),
-      /*=T*/ argument);
+  R runUnaryGuarded<R, T>(R action(T argument),
+      T argument);
 
   /**
    * Executes the given [action] with [argument1] and [argument2] in this
@@ -475,9 +475,9 @@
    *
    * See [runGuarded].
    */
-  /*=R*/ runBinaryGuarded/*<R, T1, T2>*/(
-      /*=R*/ action(/*=T1*/ argument1, /*=T2*/ argument2), /*=T1*/ argument1,
-      /*=T2*/ argument2);
+  R runBinaryGuarded<R, T1, T2>(
+      R action(T1 argument1, T2 argument2), T1 argument1,
+      T2 argument2);
 
   /**
    * Registers the given callback in this zone.
@@ -497,23 +497,23 @@
    * Custom zones may intercept this operation. The default implementation in
    * [Zone.ROOT] returns the original callback unchanged.
    */
-  ZoneCallback/*<R>*/ registerCallback/*<R>*/(/*=R*/ callback());
+  ZoneCallback<R> registerCallback<R>(R callback());
 
   /**
    * Registers the given callback in this zone.
    *
    * Similar to [registerCallback] but with a unary callback.
    */
-  ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
-      /*=R*/ callback(/*=T*/ arg));
+  ZoneUnaryCallback<R, T> registerUnaryCallback<R, T>(
+      R callback(T arg));
 
   /**
    * Registers the given callback in this zone.
    *
    * Similar to [registerCallback] but with a unary callback.
    */
-  ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
-      /*=R*/ callback(/*=T1*/ arg1, /*=T2*/ arg2));
+  ZoneBinaryCallback<R, T1, T2> registerBinaryCallback<R, T1, T2>(
+      R callback(T1 arg1, T2 arg2));
 
   /**
    *  Equivalent to:
@@ -523,8 +523,8 @@
    *      return () => this.run(registered);
    *
    */
-  ZoneCallback/*<R>*/ bindCallback/*<R>*/(
-      /*=R*/ action(), { bool runGuarded: true });
+  ZoneCallback<R> bindCallback<R>(
+      R action(), { bool runGuarded: true });
 
   /**
    *  Equivalent to:
@@ -533,8 +533,8 @@
    *      if (runGuarded) return (arg) => this.runUnaryGuarded(registered, arg);
    *      return (arg) => thin.runUnary(registered, arg);
    */
-  ZoneUnaryCallback/*<R, T>*/ bindUnaryCallback/*<R, T>*/(
-      /*=R*/ action(/*=T*/ argument), { bool runGuarded: true });
+  ZoneUnaryCallback<R, T> bindUnaryCallback<R, T>(
+      R action(T argument), { bool runGuarded: true });
 
   /**
    *  Equivalent to:
@@ -545,8 +545,8 @@
    *      }
    *      return (arg1, arg2) => thin.runBinary(registered, arg1, arg2);
    */
-  ZoneBinaryCallback/*<R, T1, T2>*/ bindBinaryCallback/*<R, T1, T2>*/(
-      /*=R*/ action(/*=T1*/ argument1, /*=T2*/ argument2),
+  ZoneBinaryCallback<R, T1, T2> bindBinaryCallback<R, T1, T2>(
+      R action(T1 argument1, T2 argument2),
       { bool runGuarded: true });
 
   /**
@@ -672,7 +672,7 @@
 
   _ZoneDelegate(this._delegationTarget);
 
-  /*=R*/ handleUncaughtError/*<R>*/(
+  R handleUncaughtError<R>(
       Zone zone, error, StackTrace stackTrace) {
     var implementation = _delegationTarget._handleUncaughtError;
     _Zone implZone = implementation.zone;
@@ -684,7 +684,7 @@
         as Object/*=R*/;
   }
 
-  /*=R*/ run/*<R>*/(Zone zone, /*=R*/ f()) {
+  R run<R>(Zone zone, R f()) {
     var implementation = _delegationTarget._run;
     _Zone implZone = implementation.zone;
     RunHandler handler = implementation.function;
@@ -694,7 +694,7 @@
         as Object/*=R*/;
   }
 
-  /*=R*/ runUnary/*<R, T>*/(Zone zone, /*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
+  R runUnary<R, T>(Zone zone, R f(T arg), T arg) {
     var implementation = _delegationTarget._runUnary;
     _Zone implZone = implementation.zone;
     RunUnaryHandler handler = implementation.function;
@@ -704,8 +704,8 @@
         implZone, _parentDelegate(implZone), zone, f, arg) as Object/*=R*/;
   }
 
-  /*=R*/ runBinary/*<R, T1, T2>*/(Zone zone,
-      /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
+  R runBinary<R, T1, T2>(Zone zone,
+      R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2) {
     var implementation = _delegationTarget._runBinary;
     _Zone implZone = implementation.zone;
     RunBinaryHandler handler = implementation.function;
@@ -716,7 +716,7 @@
         as Object/*=R*/;
   }
 
-  ZoneCallback/*<R>*/ registerCallback/*<R>*/(Zone zone, /*=R*/ f()) {
+  ZoneCallback<R> registerCallback<R>(Zone zone, R f()) {
     var implementation = _delegationTarget._registerCallback;
     _Zone implZone = implementation.zone;
     RegisterCallbackHandler handler = implementation.function;
@@ -726,8 +726,8 @@
         as Object/*=ZoneCallback<R>*/;
   }
 
-  ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
-      Zone zone, /*=R*/ f(/*=T*/ arg)) {
+  ZoneUnaryCallback<R, T> registerUnaryCallback<R, T>(
+      Zone zone, R f(T arg)) {
     var implementation = _delegationTarget._registerUnaryCallback;
     _Zone implZone = implementation.zone;
     RegisterUnaryCallbackHandler handler = implementation.function;
@@ -737,8 +737,8 @@
         as Object/*=ZoneUnaryCallback<R, T>*/;
   }
 
-  ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
-      Zone zone, /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2)) {
+  ZoneBinaryCallback<R, T1, T2> registerBinaryCallback<R, T1, T2>(
+      Zone zone, R f(T1 arg1, T2 arg2)) {
     var implementation = _delegationTarget._registerBinaryCallback;
     _Zone implZone = implementation.zone;
     RegisterBinaryCallbackHandler handler = implementation.function;
@@ -919,7 +919,7 @@
    */
   Zone get errorZone => _handleUncaughtError.zone;
 
-  /*=R*/ runGuarded/*<R>*/(/*=R*/ f()) {
+  R runGuarded<R>(R f()) {
     try {
       return run(f);
     } catch (e, s) {
@@ -927,7 +927,7 @@
     }
   }
 
-  /*=R*/ runUnaryGuarded/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
+  R runUnaryGuarded<R, T>(R f(T arg), T arg) {
     try {
       return runUnary(f, arg);
     } catch (e, s) {
@@ -935,8 +935,8 @@
     }
   }
 
-  /*=R*/ runBinaryGuarded/*<R, T1, T2>*/(
-      /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
+  R runBinaryGuarded<R, T1, T2>(
+      R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2) {
     try {
       return runBinary(f, arg1, arg2);
     } catch (e, s) {
@@ -944,8 +944,8 @@
     }
   }
 
-  ZoneCallback/*<R>*/ bindCallback/*<R>*/(
-      /*=R*/ f(), { bool runGuarded: true }) {
+  ZoneCallback<R> bindCallback<R>(
+      R f(), { bool runGuarded: true }) {
     var registered = registerCallback(f);
     if (runGuarded) {
       return () => this.runGuarded(registered);
@@ -954,8 +954,8 @@
     }
   }
 
-  ZoneUnaryCallback/*<R, T>*/ bindUnaryCallback/*<R, T>*/(
-      /*=R*/ f(/*=T*/ arg), { bool runGuarded: true }) {
+  ZoneUnaryCallback<R, T> bindUnaryCallback<R, T>(
+      R f(T arg), { bool runGuarded: true }) {
     var registered = registerUnaryCallback(f);
     if (runGuarded) {
       return (arg) => this.runUnaryGuarded(registered, arg);
@@ -964,8 +964,8 @@
     }
   }
 
-  ZoneBinaryCallback/*<R, T1, T2>*/ bindBinaryCallback/*<R, T1, T2>*/(
-      /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), { bool runGuarded: true }) {
+  ZoneBinaryCallback<R, T1, T2> bindBinaryCallback<R, T1, T2>(
+      R f(T1 arg1, T2 arg2), { bool runGuarded: true }) {
     var registered = registerBinaryCallback(f);
     if (runGuarded) {
       return (arg1, arg2) => this.runBinaryGuarded(registered, arg1, arg2);
@@ -995,7 +995,7 @@
 
   // Methods that can be customized by the zone specification.
 
-  /*=R*/ handleUncaughtError/*<R>*/(error, StackTrace stackTrace) {
+  R handleUncaughtError<R>(error, StackTrace stackTrace) {
     var implementation = this._handleUncaughtError;
     assert(implementation != null);
     ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
@@ -1016,7 +1016,7 @@
                    specification, zoneValues);
   }
 
-  /*=R*/ run/*<R>*/(/*=R*/ f()) {
+  R run<R>(R f()) {
     var implementation = this._run;
     assert(implementation != null);
     ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
@@ -1027,7 +1027,7 @@
         as Object/*=R*/;
   }
 
-  /*=R*/ runUnary/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
+  R runUnary<R, T>(R f(T arg), T arg) {
     var implementation = this._runUnary;
     assert(implementation != null);
     ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
@@ -1038,8 +1038,8 @@
         as Object/*=R*/;
   }
 
-  /*=R*/ runBinary/*<R, T1, T2>*/(
-      /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
+  R runBinary<R, T1, T2>(
+      R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2) {
     var implementation = this._runBinary;
     assert(implementation != null);
     ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
@@ -1051,7 +1051,7 @@
         as Object/*=R*/;
   }
 
-  ZoneCallback/*<R>*/ registerCallback/*<R>*/(/*=R*/ callback()) {
+  ZoneCallback<R> registerCallback<R>(R callback()) {
     var implementation = this._registerCallback;
     assert(implementation != null);
     ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
@@ -1062,8 +1062,8 @@
         as Object/*=ZoneCallback<R>*/;
   }
 
-  ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
-      /*=R*/ callback(/*=T*/ arg)) {
+  ZoneUnaryCallback<R, T> registerUnaryCallback<R, T>(
+      R callback(T arg)) {
     var implementation = this._registerUnaryCallback;
     assert(implementation != null);
     ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
@@ -1074,8 +1074,8 @@
         as Object/*=ZoneUnaryCallback<R, T>*/;
   }
 
-  ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
-      /*=R*/ callback(/*=T1*/ arg1, /*=T2*/ arg2)) {
+  ZoneBinaryCallback<R, T1, T2> registerBinaryCallback<R, T1, T2>(
+      R callback(T1 arg1, T2 arg2)) {
     var implementation = this._registerBinaryCallback;
     assert(implementation != null);
     ZoneDelegate parentDelegate = _parentDelegate(implementation.zone);
@@ -1131,7 +1131,7 @@
   }
 }
 
-/*=R*/ _rootHandleUncaughtError/*<R>*/(
+R _rootHandleUncaughtError<R>(
     Zone self, ZoneDelegate parent, Zone zone, error, StackTrace stackTrace) {
   _schedulePriorityAsyncCallback(() {
     if (error == null) error = new NullThrownError();
@@ -1142,7 +1142,7 @@
 
 external void _rethrow(Object error, StackTrace stackTrace);
 
-/*=R*/ _rootRun/*<R>*/(Zone self, ZoneDelegate parent, Zone zone, /*=R*/ f()) {
+R _rootRun<R>(Zone self, ZoneDelegate parent, Zone zone, R f()) {
   if (Zone._current == zone) return f();
 
   Zone old = Zone._enter(zone);
@@ -1153,8 +1153,8 @@
   }
 }
 
-/*=R*/ _rootRunUnary/*<R, T>*/(Zone self, ZoneDelegate parent, Zone zone,
-    /*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
+R _rootRunUnary<R, T>(Zone self, ZoneDelegate parent, Zone zone,
+    R f(T arg), T arg) {
   if (Zone._current == zone) return f(arg);
 
   Zone old = Zone._enter(zone);
@@ -1165,8 +1165,8 @@
   }
 }
 
-/*=R*/ _rootRunBinary/*<R, T1, T2>*/(Zone self, ZoneDelegate parent, Zone zone,
-    /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
+R _rootRunBinary<R, T1, T2>(Zone self, ZoneDelegate parent, Zone zone,
+    R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2) {
   if (Zone._current == zone) return f(arg1, arg2);
 
   Zone old = Zone._enter(zone);
@@ -1177,19 +1177,19 @@
   }
 }
 
-ZoneCallback/*<R>*/ _rootRegisterCallback/*<R>*/(
-    Zone self, ZoneDelegate parent, Zone zone, /*=R*/ f()) {
+ZoneCallback<R> _rootRegisterCallback<R>(
+    Zone self, ZoneDelegate parent, Zone zone, R f()) {
   return f;
 }
 
-ZoneUnaryCallback/*<R, T>*/ _rootRegisterUnaryCallback/*<R, T>*/(
-    Zone self, ZoneDelegate parent, Zone zone, /*=R*/ f(/*=T*/ arg)) {
+ZoneUnaryCallback<R, T> _rootRegisterUnaryCallback<R, T>(
+    Zone self, ZoneDelegate parent, Zone zone, R f(T arg)) {
   return f;
 }
 
-ZoneBinaryCallback/*<R, T1, T2>*/ _rootRegisterBinaryCallback/*<R, T1, T2>*/(
+ZoneBinaryCallback<R, T1, T2> _rootRegisterBinaryCallback<R, T1, T2>(
     Zone self, ZoneDelegate parent, Zone zone,
-    /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2)) {
+    R f(T1 arg1, T2 arg2)) {
   return f;
 }
 
@@ -1219,7 +1219,7 @@
     Duration duration, void callback(Timer timer)) {
   if (!identical(_ROOT_ZONE, zone)) {
     // TODO(floitsch): the return type should be 'void'.
-    callback = zone.bindUnaryCallback/*<dynamic, Timer>*/(callback);
+    callback = zone.bindUnaryCallback<dynamic, Timer>(callback);
   }
   return Timer._createPeriodicTimer(duration, callback);
 }
@@ -1321,65 +1321,65 @@
 
   // Zone interface.
 
-  /*=R*/ runGuarded/*<R>*/(/*=R*/ f()) {
+  R runGuarded<R>(R f()) {
     try {
       if (identical(_ROOT_ZONE, Zone._current)) {
         return f();
       }
-      return _rootRun/*<R>*/(null, null, this, f);
+      return _rootRun<R>(null, null, this, f);
     } catch (e, s) {
-      return handleUncaughtError/*<R>*/(e, s);
+      return handleUncaughtError<R>(e, s);
     }
   }
 
-  /*=R*/ runUnaryGuarded/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
+  R runUnaryGuarded<R, T>(R f(T arg), T arg) {
     try {
       if (identical(_ROOT_ZONE, Zone._current)) {
         return f(arg);
       }
-      return _rootRunUnary/*<R, T>*/(null, null, this, f, arg);
+      return _rootRunUnary<R, T>(null, null, this, f, arg);
     } catch (e, s) {
-      return handleUncaughtError/*<R>*/(e, s);
+      return handleUncaughtError<R>(e, s);
     }
   }
 
-  /*=R*/ runBinaryGuarded/*<R, T1, T2>*/(
-      /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
+  R runBinaryGuarded<R, T1, T2>(
+      R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2) {
     try {
       if (identical(_ROOT_ZONE, Zone._current)) {
         return f(arg1, arg2);
       }
-      return _rootRunBinary/*<R, T1, T2>*/(null, null, this, f, arg1, arg2);
+      return _rootRunBinary<R, T1, T2>(null, null, this, f, arg1, arg2);
     } catch (e, s) {
-      return handleUncaughtError/*<R>*/(e, s);
+      return handleUncaughtError<R>(e, s);
     }
   }
 
-  ZoneCallback/*<R>*/ bindCallback/*<R>*/(
-      /*=R*/ f(), { bool runGuarded: true }) {
+  ZoneCallback<R> bindCallback<R>(
+      R f(), { bool runGuarded: true }) {
     if (runGuarded) {
-      return () => this.runGuarded/*<R>*/(f);
+      return () => this.runGuarded<R>(f);
     } else {
-      return () => this.run/*<R>*/(f);
+      return () => this.run<R>(f);
     }
   }
 
-  ZoneUnaryCallback/*<R, T>*/ bindUnaryCallback/*<R, T>*/(
-      /*=R*/ f(/*=T*/ arg), { bool runGuarded: true }) {
+  ZoneUnaryCallback<R, T> bindUnaryCallback<R, T>(
+      R f(T arg), { bool runGuarded: true }) {
     if (runGuarded) {
-      return (arg) => this.runUnaryGuarded/*<R, T>*/(f, arg);
+      return (arg) => this.runUnaryGuarded<R, T>(f, arg);
     } else {
-      return (arg) => this.runUnary/*<R, T>*/(f, arg);
+      return (arg) => this.runUnary<R, T>(f, arg);
     }
   }
 
-  ZoneBinaryCallback/*<R, T1, T2>*/ bindBinaryCallback/*<R, T1, T2>*/(
-      /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), { bool runGuarded: true }) {
+  ZoneBinaryCallback<R, T1, T2> bindBinaryCallback<R, T1, T2>(
+      R f(T1 arg1, T2 arg2), { bool runGuarded: true }) {
     if (runGuarded) {
       return (arg1, arg2) =>
-          this.runBinaryGuarded/*<R, T1, T2>*/(f, arg1, arg2);
+          this.runBinaryGuarded<R, T1, T2>(f, arg1, arg2);
     } else {
-      return (arg1, arg2) => this.runBinary/*<R, T1, T2>*/(f, arg1, arg2);
+      return (arg1, arg2) => this.runBinary<R, T1, T2>(f, arg1, arg2);
     }
   }
 
@@ -1387,7 +1387,7 @@
 
   // Methods that can be customized by the zone specification.
 
-  /*=R*/ handleUncaughtError/*<R>*/(error, StackTrace stackTrace) {
+  R handleUncaughtError<R>(error, StackTrace stackTrace) {
     return _rootHandleUncaughtError(null, null, this, error, stackTrace);
   }
 
@@ -1395,29 +1395,29 @@
     return _rootFork(null, null, this, specification, zoneValues);
   }
 
-  /*=R*/ run/*<R>*/(/*=R*/ f()) {
+  R run<R>(R f()) {
     if (identical(Zone._current, _ROOT_ZONE)) return f();
     return _rootRun(null, null, this, f);
   }
 
-  /*=R*/ runUnary/*<R, T>*/(/*=R*/ f(/*=T*/ arg), /*=T*/ arg) {
+  R runUnary<R, T>(R f(T arg), T arg) {
     if (identical(Zone._current, _ROOT_ZONE)) return f(arg);
     return _rootRunUnary(null, null, this, f, arg);
   }
 
-  /*=R*/ runBinary/*<R, T1, T2>*/(
-      /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2), /*=T1*/ arg1, /*=T2*/ arg2) {
+  R runBinary<R, T1, T2>(
+      R f(T1 arg1, T2 arg2), T1 arg1, T2 arg2) {
     if (identical(Zone._current, _ROOT_ZONE)) return f(arg1, arg2);
     return _rootRunBinary(null, null, this, f, arg1, arg2);
   }
 
-  ZoneCallback/*<R>*/ registerCallback/*<R>*/(/*=R*/ f()) => f;
+  ZoneCallback<R> registerCallback<R>(R f()) => f;
 
-  ZoneUnaryCallback/*<R, T>*/ registerUnaryCallback/*<R, T>*/(
-      /*=R*/ f(/*=T*/ arg)) => f;
+  ZoneUnaryCallback<R, T> registerUnaryCallback<R, T>(
+      R f(T arg)) => f;
 
-  ZoneBinaryCallback/*<R, T1, T2>*/ registerBinaryCallback/*<R, T1, T2>*/(
-      /*=R*/ f(/*=T1*/ arg1, /*=T2*/ arg2)) => f;
+  ZoneBinaryCallback<R, T1, T2> registerBinaryCallback<R, T1, T2>(
+      R f(T1 arg1, T2 arg2)) => f;
 
   AsyncError errorCallback(Object error, StackTrace stackTrace) => null;
 
@@ -1465,7 +1465,7 @@
  *       new Future(() { throw "asynchronous error"; });
  *     }, onError: print);  // Will print "asynchronous error".
  */
-/*=R*/ runZoned/*<R>*/(/*=R*/ body(),
+R runZoned<R>(R body(),
                  { Map zoneValues,
                    ZoneSpecification zoneSpecification,
                    Function onError }) {
@@ -1474,7 +1474,7 @@
     errorHandler = (Zone self, ZoneDelegate parent, Zone zone,
                     error, StackTrace stackTrace) {
       try {
-        if (onError is ZoneBinaryCallback<dynamic/*=R*/, dynamic, StackTrace>) {
+        if (onError is ZoneBinaryCallback<R, dynamic, StackTrace>) {
           return self.parent.runBinary(onError, error, stackTrace);
         }
         return self.parent.runUnary(onError, error);
diff --git a/sdk/lib/collection/hash_map.dart b/sdk/lib/collection/hash_map.dart
index d934e8c..6824328 100644
--- a/sdk/lib/collection/hash_map.dart
+++ b/sdk/lib/collection/hash_map.dart
@@ -17,7 +17,7 @@
 /**
  * A hash-table based implementation of [Map].
  *
- * The keys of a `HashMap` must have consistent [Object.operator==]
+ * The keys of a `HashMap` must have consistent [Object.==]
  * and [Object.hashCode] implementations. This means that the `==` operator
  * must define a stable equivalence relation on the keys (reflexive,
  * symmetric, transitive, and consistent over time), and that `hashCode`
@@ -41,14 +41,14 @@
    * same as long as the map isn't changed.
    *
    * If [equals] is provided, it is used to compare the keys in the table with
-   * new keys. If [equals] is omitted, the key's own [Object.operator==] is used
+   * new keys. If [equals] is omitted, the key's own [Object.==] is used
    * instead.
    *
    * Similar, if [hashCode] is provided, it is used to produce a hash value
    * for keys in order to place them in the hash table. If it is omitted, the
    * key's own [Object.hashCode] is used.
    *
-   * If using methods like [operator[]], [remove] and [containsKey] together
+   * If using methods like [[]], [remove] and [containsKey] together
    * with a custom equality and hashcode, an extra `isValidKey` function
    * can be supplied. This function is called before calling [equals] or
    * [hashCode] with an argument that may not be a [K] instance, and if the
diff --git a/sdk/lib/collection/hash_set.dart b/sdk/lib/collection/hash_set.dart
index 8e2a2a1..8bffb34 100644
--- a/sdk/lib/collection/hash_set.dart
+++ b/sdk/lib/collection/hash_set.dart
@@ -45,9 +45,14 @@
  *
  * The set allows `null` as an element.
  *
- * Most simple operations on `HashSet` are done in (potentially amorteized)
+ * Most simple operations on `HashSet` are done in (potentially amortized)
  * constant time: [add], [contains], [remove], and [length], provided the hash
  * codes of objects are well distributed.
+ *
+ * The iteration order of the set is not specified and depends on
+ * the hashcodes of the provided elements. However, the order is stable:
+ * multiple iterations over the same set produce the same order, as long as
+ * the set is not modified.
  */
 abstract class HashSet<E> implements Set<E> {
   /**
@@ -62,7 +67,7 @@
    * to not be in the set when asking `contains`.
    *
    * If [equals] or [hashCode] are omitted, the set uses
-   * the elements' intrinsic [Object.operator==] and [Object.hashCode].
+   * the elements' intrinsic [Object.==] and [Object.hashCode].
    *
    * If you supply one of [equals] and [hashCode],
    * you should generally also to supply the other.
@@ -108,8 +113,10 @@
   /**
    * Create a hash set containing all [elements].
    *
-   * Creates a hash set as by `new HashSet<E>()` and adds each element of
-   * `elements` to this set in the order they are iterated.
+   * Creates a hash set as by `new HashSet<E>()` and adds all given [elements]
+   * to the set. The elements are added in order. If [elements] contains
+   * two entries that are equal, but not identical, then the first one is
+   * the one in the resulting set.
    *
    * All the [elements] should be assignable to [E].
    * The `elements` iterable itself may have any element type, so this
diff --git a/sdk/lib/collection/iterable.dart b/sdk/lib/collection/iterable.dart
index edfce85..c0fc812 100644
--- a/sdk/lib/collection/iterable.dart
+++ b/sdk/lib/collection/iterable.dart
@@ -15,13 +15,13 @@
   // - SetMixin
   // If changing a method here, also change the other copies.
 
-  Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
-      new MappedIterable<E, dynamic/*=T*/>(this, f);
+  Iterable<T> map<T>(T f(E element)) =>
+      new MappedIterable<E, T>(this, f);
 
   Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
 
-  Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
-      new ExpandIterable<E, dynamic/*=T*/>(this, f);
+  Iterable<T> expand<T>(Iterable<T> f(E element)) =>
+      new ExpandIterable<E, T>(this, f);
 
   bool contains(Object element) {
     for (E e in this) {
@@ -46,8 +46,8 @@
     return value;
   }
 
-  dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
-               dynamic/*=T*/ combine(var/*=T*/ previousValue, E element)) {
+  T fold<T>(T initialValue,
+               T combine(T previousValue, E element)) {
     var value = initialValue;
     for (E element in this) value = combine(value, element);
     return value;
diff --git a/sdk/lib/collection/linked_hash_map.dart b/sdk/lib/collection/linked_hash_map.dart
index d4ce4ca..fe21eea 100644
--- a/sdk/lib/collection/linked_hash_map.dart
+++ b/sdk/lib/collection/linked_hash_map.dart
@@ -15,7 +15,7 @@
  * but removing the key and adding it again
  * will make it be last in the iteration order.
  *
- * The keys of a `LinkedHashMap` must have consistent [Object.operator==]
+ * The keys of a `LinkedHashMap` must have consistent [Object.==]
  * and [Object.hashCode] implementations. This means that the `==` operator
  * must define a stable equivalence relation on the keys (reflexive,
  * symmetric, transitive, and consistent over time), and that `hashCode`
@@ -28,14 +28,14 @@
    * Creates an insertion-ordered hash-table based [Map].
    *
    * If [equals] is provided, it is used to compare the keys in the table with
-   * new keys. If [equals] is omitted, the key's own [Object.operator==] is used
+   * new keys. If [equals] is omitted, the key's own [Object.==] is used
    * instead.
    *
    * Similar, if [hashCode] is provided, it is used to produce a hash value
    * for keys in order to place them in the hash table. If it is omitted, the
    * key's own [Object.hashCode] is used.
    *
-   * If using methods like [operator[]], [remove] and [containsKey] together
+   * If using methods like [[]], [remove] and [containsKey] together
    * with a custom equality and hashcode, an extra `isValidKey` function
    * can be supplied. This function is called before calling [equals] or
    * [hashCode] with an argument that may not be a [K] instance, and if the
diff --git a/sdk/lib/collection/linked_hash_set.dart b/sdk/lib/collection/linked_hash_set.dart
index 5addba5..d07c7e9 100644
--- a/sdk/lib/collection/linked_hash_set.dart
+++ b/sdk/lib/collection/linked_hash_set.dart
@@ -10,7 +10,7 @@
  * The `LinkedHashSet` also keep track of the order that elements were inserted
  * in, and iteration happens in first-to-last insertion order.
  *
- * The elements of a `LinkedHashSet` must have consistent [Object.operator==]
+ * The elements of a `LinkedHashSet` must have consistent [Object.==]
  * and [Object.hashCode] implementations. This means that the `==` operator
  * must define a stable equivalence relation on the elements (reflexive,
  * symmetric, transitive, and consistent over time), and that `hashCode`
@@ -43,7 +43,7 @@
    * to not be in the set when asking `contains`.
    *
    * If [equals] or [hashCode] are omitted, the set uses
-   * the elements' intrinsic [Object.operator==] and [Object.hashCode],
+   * the elements' intrinsic [Object.==] and [Object.hashCode],
    * and [isValidKey] is ignored since these operations are assumed
    * to work on all objects.
    *
diff --git a/sdk/lib/collection/list.dart b/sdk/lib/collection/list.dart
index 8b6713a..b81b8dd 100644
--- a/sdk/lib/collection/list.dart
+++ b/sdk/lib/collection/list.dart
@@ -175,11 +175,11 @@
 
   Iterable<E> where(bool test(E element)) => new WhereIterable<E>(this, test);
 
-  Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
-      new MappedListIterable/*<E, T>*/(this, f);
+  Iterable<T> map<T>(T f(E element)) =>
+      new MappedListIterable<E, T>(this, f);
 
-  Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
-      new ExpandIterable<E, dynamic/*=T*/>(this, f);
+  Iterable<T> expand<T>(Iterable<T> f(E element)) =>
+      new ExpandIterable<E, T>(this, f);
 
   E reduce(E combine(E previousValue, E element)) {
     int length = this.length;
@@ -194,8 +194,8 @@
     return value;
   }
 
-  dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
-               dynamic/*=T*/ combine(var/*=T*/ previousValue, E element)) {
+  T fold<T>(T initialValue,
+               T combine(T previousValue, E element)) {
     var value = initialValue;
     int length = this.length;
     for (int i = 0; i < length; i++) {
@@ -371,7 +371,7 @@
     List<E> otherList;
     int otherStart;
     // TODO(floitsch): Make this accept more.
-    if (iterable is List/*<E>*/) {
+    if (iterable is List<E>) {
       otherList = iterable;
       otherStart = skipCount;
     } else {
diff --git a/sdk/lib/collection/maps.dart b/sdk/lib/collection/maps.dart
index d5b8621..c928287 100644
--- a/sdk/lib/collection/maps.dart
+++ b/sdk/lib/collection/maps.dart
@@ -214,8 +214,8 @@
 
 /**
  * Helper class which implements complex [Map] operations
- * in term of basic ones ([Map.keys], [Map.operator []],
- * [Map.operator []=] and [Map.remove].)  Not all methods are
+ * in term of basic ones ([Map.keys], [Map.[]],
+ * [Map.[]=] and [Map.remove].)  Not all methods are
  * necessary to implement each particular operation.
  */
 class Maps {
diff --git a/sdk/lib/collection/queue.dart b/sdk/lib/collection/queue.dart
index 2e6a24a..70f7111 100644
--- a/sdk/lib/collection/queue.dart
+++ b/sdk/lib/collection/queue.dart
@@ -322,7 +322,12 @@
   bool remove(Object o) {
     _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
     while (!identical(entry, _sentinel)) {
-      if (entry._element == o) {
+      bool equals = (entry._element == o);
+      if (!identical(this, entry._queue)) {
+        // Entry must still be in the queue.
+        throw new ConcurrentModificationError(this);
+      }
+      if (equals) {
         entry._remove();
         _elementCount--;
         return true;
@@ -335,8 +340,13 @@
   void _filter(bool test(E element), bool removeMatching) {
     _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
     while (!identical(entry, _sentinel)) {
-      _DoubleLinkedQueueEntry<E> next = entry._nextLink;
-      if (identical(removeMatching, test(entry._element))) {
+      bool matches = test(entry._element);
+      if (!identical(this, entry._queue)) {
+        // Entry must still be in the queue.
+        throw new ConcurrentModificationError(this);
+      }
+      _DoubleLinkedQueueEntry<E> next = entry._nextLink;  // Cannot be null.
+      if (identical(removeMatching, matches)) {
         entry._remove();
         _elementCount--;
       }
@@ -364,7 +374,7 @@
 
   E get single {
     // Note that this throws correctly if the queue is empty
-    // because reading element on the sentinel throws.
+    // because reading the element of the sentinel throws.
     if (identical(_sentinel._nextLink, _sentinel._previousLink)) {
       _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
       return entry._element;
@@ -372,14 +382,34 @@
     throw IterableElementError.tooMany();
   }
 
-  DoubleLinkedQueueEntry<E> lastEntry() {
-    return _sentinel.previousEntry();
-  }
-
+  /**
+   * The entry object of the first element in the queue.
+   *
+   * Each element of the queue has an associated [DoubleLinkedQueueEntry].
+   * Returns the entry object corresponding to the first element of the queue.
+   *
+   * The entry objects can also be accessed using [lastEntry],
+   * and they can be iterated using [DoubleLinkedQueueEntry.nextEntry()] and
+   * [DoubleLinkedQueueEntry.previousEntry()].
+   */
   DoubleLinkedQueueEntry<E> firstEntry() {
     return _sentinel.nextEntry();
   }
 
+  /**
+   * The entry object of the last element in the queue.
+   *
+   * Each element of the queue has an associated [DoubleLinkedQueueEntry].
+   * Returns the entry object corresponding to the last element of the queue.
+   *
+   * The entry objects can also be accessed using [firstEntry],
+   * and they can be iterated using [DoubleLinkedQueueEntry.nextEntry()] and
+   * [DoubleLinkedQueueEntry.previousEntry()].
+   */
+  DoubleLinkedQueueEntry<E> lastEntry() {
+    return _sentinel.previousEntry();
+  }
+
   bool get isEmpty {
     return (identical(_sentinel._nextLink, _sentinel));
   }
@@ -390,13 +420,40 @@
     _elementCount = 0;
   }
 
-  void forEachEntry(void f(DoubleLinkedQueueEntry<E> element)) {
+  /**
+   * Calls [action] for each entry object of this double-linked queue.
+   *
+   * Each element of the queue has an associated [DoubleLinkedQueueEntry].
+   * This method iterates the entry objects from first to last and calls
+   * [action] with each object in turn.
+   *
+   * The entry objects can also be accessed using [firstEntry] and [lastEntry],
+   * and iterated using [DoubleLinkedQueueEntry.nextEntry()] and
+   * [DoubleLinkedQueueEntry.previousEntry()].
+   *
+   * The [action] function can use methods on [DoubleLinkedQueueEntry] to remove
+   * the entry or it can insert elements before or after then entry.
+   * If the current entry is removed, iteration continues with the entry that
+   * was following the current entry when [action] was called. Any elements
+   * inserted after the current element before it is removed will not be
+   * visited by the iteration.
+   */
+  void forEachEntry(void action(DoubleLinkedQueueEntry<E> element)) {
     _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
     while (!identical(entry, _sentinel)) {
-      _DoubleLinkedQueueEntry<E> nextEntry = entry._nextLink;
       _DoubleLinkedQueueElement<E> element = entry;
-      f(element);
-      entry = nextEntry;
+      _DoubleLinkedQueueEntry<E> next = element._nextLink;
+      // Remember both entry and entry._nextLink.
+      // If someone calls `element.remove()` we continue from `next`.
+      // Otherwise we use the value of entry._nextLink which may have been
+      // updated.
+      action(element);
+      if (identical(this, entry._queue)) {
+        next = entry._nextLink;
+      } else if (!identical(this, next._queue)) {
+        throw new ConcurrentModificationError(this);
+      }
+      entry = next;
     }
   }
 
@@ -424,7 +481,7 @@
       return false;
     }
     _DoubleLinkedQueueElement<E> elementEntry = _nextEntry;
-    if (elementEntry._queue == null) {
+    if (!identical(_sentinel._queue, elementEntry._queue)) {
       throw new ConcurrentModificationError(_sentinel._queue);
     }
     _current = elementEntry._element;
@@ -553,7 +610,7 @@
   }
 
   void addAll(Iterable<E> elements) {
-    if (elements is List/*<E>*/) {
+    if (elements is List<E>) {
       List<E> list = elements;
       int addCount = list.length;
       int length = this.length;
@@ -714,7 +771,7 @@
   /**
    * Removes the element at [offset] into [_table].
    *
-   * Removal is performed by linerarly moving elements either before or after
+   * Removal is performed by linearly moving elements either before or after
    * [offset] by one position.
    *
    * Returns the new offset of the following element. This may be the same
diff --git a/sdk/lib/collection/set.dart b/sdk/lib/collection/set.dart
index 499225d..806aa80 100644
--- a/sdk/lib/collection/set.dart
+++ b/sdk/lib/collection/set.dart
@@ -27,7 +27,7 @@
 abstract class SetMixin<E> implements Set<E> {
   // This class reimplements all of [IterableMixin].
   // If/when Dart mixins get more powerful, we should just create a single
-  // Mixin class from IterableMixin and the new methods of thisclass.
+  // Mixin class from IterableMixin and the new methods of this class.
 
   bool add(E element);
 
@@ -120,8 +120,8 @@
     return result;
   }
 
-  Iterable/*<T>*/ map/*<T>*/(/*=T*/f(E element)) =>
-      new EfficientLengthMappedIterable<E, dynamic/*=T*/>(this, f);
+  Iterable<T> map<T>(T f(E element)) =>
+      new EfficientLengthMappedIterable<E, T>(this, f);
 
   E get single {
     if (length > 1) throw IterableElementError.tooMany();
@@ -138,8 +138,8 @@
 
   Iterable<E> where(bool f(E element)) => new WhereIterable<E>(this, f);
 
-  Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
-      new ExpandIterable<E, dynamic/*=T*/>(this, f);
+  Iterable<T> expand<T>(Iterable<T> f(E element)) =>
+      new ExpandIterable<E, T>(this, f);
 
   void forEach(void f(E element)) {
     for (E element in this) f(element);
@@ -157,8 +157,8 @@
     return value;
   }
 
-  dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
-      dynamic/*=T*/ combine(var/*=T*/ previousValue, E element)) {
+  T fold<T>(T initialValue,
+      T combine(T previousValue, E element)) {
     var value = initialValue;
     for (E element in this) value = combine(value, element);
     return value;
diff --git a/sdk/lib/collection/splay_tree.dart b/sdk/lib/collection/splay_tree.dart
index 9a41ef3..ef646f3 100644
--- a/sdk/lib/collection/splay_tree.dart
+++ b/sdk/lib/collection/splay_tree.dart
@@ -260,7 +260,7 @@
  * Non-comparable objects (including `null`) will not work as keys
  * in that case.
  *
- * To allow calling [operator[]], [remove] or [containsKey] with objects
+ * To allow calling [[]], [remove] or [containsKey] with objects
  * that are not supported by the `compare` function, an extra `isValidKey`
  * predicate function can be supplied. This function is tested before
  * using the `compare` function on an argument value that may not be a [K]
diff --git a/sdk/lib/convert/chunked_conversion.dart b/sdk/lib/convert/chunked_conversion.dart
index ee71f4f..d33afb7 100644
--- a/sdk/lib/convert/chunked_conversion.dart
+++ b/sdk/lib/convert/chunked_conversion.dart
@@ -84,7 +84,7 @@
   final Sink<S> _chunkedSink;
 
   _ConverterStreamEventSink(
-      Converter/*=Converter<S, T>*/ converter,
+      Converter<S, T> converter,
       EventSink<T> sink)
       : this._eventSink = sink,
         _chunkedSink = converter.startChunkedConversion(sink);
diff --git a/sdk/lib/convert/codec.dart b/sdk/lib/convert/codec.dart
index f4ff700..69028d0 100644
--- a/sdk/lib/convert/codec.dart
+++ b/sdk/lib/convert/codec.dart
@@ -60,8 +60,8 @@
    */
   // TODO(floitsch): use better example with line-splitter once that one is
   // in this library.
-  Codec<S, dynamic/*=R*/> fuse/*<R>*/(Codec<T, dynamic/*=R*/> other) {
-    return new _FusedCodec<S, T, dynamic/*=R*/>(this, other);
+  Codec<S, R> fuse<R>(Codec<T, R> other) {
+    return new _FusedCodec<S, T, R>(this, other);
   }
 
   /**
@@ -82,8 +82,8 @@
   final Codec<S, M> _first;
   final Codec<M, T> _second;
 
-  Converter<S, T> get encoder => _first.encoder.fuse/*<T>*/(_second.encoder);
-  Converter<T, S> get decoder => _second.decoder.fuse/*<S>*/(_first.decoder);
+  Converter<S, T> get encoder => _first.encoder.fuse<T>(_second.encoder);
+  Converter<T, S> get decoder => _second.decoder.fuse<S>(_first.decoder);
 
   _FusedCodec(this._first, this._second);
 }
diff --git a/sdk/lib/convert/converter.dart b/sdk/lib/convert/converter.dart
index 75d4cf0..dc0661c 100644
--- a/sdk/lib/convert/converter.dart
+++ b/sdk/lib/convert/converter.dart
@@ -10,7 +10,7 @@
  * It is recommended that implementations of `Converter` extend this class,
  * to inherit any further methods that may be added to the class.
  */
-abstract class Converter<S, T> implements StreamTransformer/*<S, T>*/ {
+abstract class Converter<S, T> implements StreamTransformer<S, T> {
   const Converter();
 
   /**
@@ -24,9 +24,8 @@
    * Encoding with the resulting converter is equivalent to converting with
    * `this` before converting with `other`.
    */
-  Converter<S, dynamic/*=TT*/> fuse/*<TT>*/(
-      Converter<T, dynamic/*=TT*/> other) {
-    return new _FusedConverter<S, T, dynamic/*=TT*/>(this, other);
+  Converter<S, TT> fuse<TT>(Converter<T, TT> other) {
+    return new _FusedConverter<S, T, TT>(this, other);
   }
 
   /**
@@ -40,8 +39,8 @@
         "This converter does not support chunked conversions: $this");
   }
 
-  Stream/*<T>*/ bind(Stream/*<S>*/ stream) {
-    return new Stream/*<T>*/.eventTransformed(
+  Stream<T> bind(Stream<S> stream) {
+    return new Stream<T>.eventTransformed(
         stream,
         (EventSink sink) => new _ConverterStreamEventSink(this, sink));
   }
diff --git a/sdk/lib/convert/html_escape.dart b/sdk/lib/convert/html_escape.dart
index 3a516bb..7070e1a 100644
--- a/sdk/lib/convert/html_escape.dart
+++ b/sdk/lib/convert/html_escape.dart
@@ -7,7 +7,7 @@
 /**
  * A `String` converter that converts characters to HTML entities.
  *
- * This is intended to sanitice text before inserting the text into an HTML
+ * This is intended to sanitize text before inserting the text into an HTML
  * document. Characters that are meaningful in HTML are converted to
  * HTML entities (like `&amp;` for `&`).
  *
@@ -134,7 +134,7 @@
 /**
  * Converter which escapes characters with special meaning in HTML.
  *
- * The converter finds characters that are siginificant in HTML source and
+ * The converter finds characters that are significant in HTML source and
  * replaces them with corresponding HTML entities.
  *
  * The characters that need escaping in HTML are:
diff --git a/sdk/lib/convert/json.dart b/sdk/lib/convert/json.dart
index 3d5ee82..712f094 100644
--- a/sdk/lib/convert/json.dart
+++ b/sdk/lib/convert/json.dart
@@ -268,13 +268,12 @@
   // Override the base class's bind, to provide a better type.
   Stream<String> bind(Stream<Object> stream) => super.bind(stream);
 
-  Converter<Object, dynamic/*=T*/> fuse/*<T>*/(
-      Converter<String, dynamic/*=T*/> other) {
+  Converter<Object, T> fuse<T>(Converter<String, T> other) {
     if (other is Utf8Encoder) {
       return new JsonUtf8Encoder(indent, _toEncodable)
           as dynamic/*=Converter<Object, T>*/;
     }
-    return super.fuse/*<T>*/(other);
+    return super.fuse<T>(other);
   }
 }
 
diff --git a/sdk/lib/convert/line_splitter.dart b/sdk/lib/convert/line_splitter.dart
index 331527e..4e3778d 100644
--- a/sdk/lib/convert/line_splitter.dart
+++ b/sdk/lib/convert/line_splitter.dart
@@ -9,7 +9,7 @@
 const int _CR = 13;
 
 /**
- * A [Converter] that splits a [String] into individual lines.
+ * A [StreamTransformer] that splits a [String] into individual lines.
  *
  * A line is terminated by either a CR (U+000D), a LF (U+000A), a
  * CR+LF sequence (DOS line ending),
@@ -17,6 +17,7 @@
  *
  * The returned lines do not contain the line terminators.
  */
+
 class LineSplitter
     extends Converter<String, List<String>>/*=Object*/
     implements ChunkedConverter<String, List<String>, String, String>
@@ -83,7 +84,7 @@
     return new _LineSplitterSink(sink);
   }
 
-  Stream/*<String>*/ bind(Stream/*<String>*/ stream) {
+  Stream/*<String>*/ bind(Stream<String> stream) {
     return new Stream<String>.eventTransformed(
           stream,
           (EventSink<String> sink) => new _LineSplitterEventSink(sink));
diff --git a/sdk/lib/convert/utf.dart b/sdk/lib/convert/utf.dart
index 86763cb..6b9fece 100644
--- a/sdk/lib/convert/utf.dart
+++ b/sdk/lib/convert/utf.dart
@@ -347,7 +347,7 @@
     StringBuffer buffer = new StringBuffer();
     _Utf8Decoder decoder = new _Utf8Decoder(buffer, _allowMalformed);
     decoder.convert(codeUnits, start, end);
-    decoder.close();
+    decoder.flush(codeUnits, end);
     return buffer.toString();
   }
 
@@ -370,8 +370,7 @@
   // Override the base-classes bind, to provide a better type.
   Stream<String> bind(Stream<List<int>> stream) => super.bind(stream);
 
-  external Converter<List<int>, dynamic/*=T*/> fuse/*<T>*/(
-      Converter<String, dynamic/*=T*/> next);
+  external Converter<List<int>, T> fuse<T>(Converter<String, T> next);
 
   external static String _convertIntercepted(
       bool allowMalformed, List<int> codeUnits, int start, int end);
@@ -432,11 +431,15 @@
    *
    * This method throws if the input was partial and the decoder was
    * constructed with `allowMalformed` set to `false`.
+   *
+   * The [source] and [offset] of the current position may be provided,
+   * and are included in the exception if one is thrown.
    */
-  void flush() {
+  void flush([List<int> source, int offset]) {
     if (hasPartialInput) {
       if (!_allowMalformed) {
-        throw new FormatException("Unfinished UTF-8 octet sequence");
+        throw new FormatException("Unfinished UTF-8 octet sequence",
+                                  source, offset);
       }
       _stringSink.writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE);
       _value = 0;
@@ -481,7 +484,8 @@
             expectedUnits = 0;
             if (!_allowMalformed) {
               throw new FormatException(
-                  "Bad UTF-8 encoding 0x${unit.toRadixString(16)}");
+                  "Bad UTF-8 encoding 0x${unit.toRadixString(16)}",
+                  codeUnits, i);
             }
             _isFirstCharacter = false;
             _stringSink.writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE);
@@ -497,7 +501,8 @@
           // encoding.
           if (!_allowMalformed) {
             throw new FormatException(
-                "Overlong encoding of 0x${value.toRadixString(16)}");
+                "Overlong encoding of 0x${value.toRadixString(16)}",
+                codeUnits, i - extraUnits - 1);
           }
           expectedUnits = extraUnits = 0;
           value = UNICODE_REPLACEMENT_CHARACTER_RUNE;
@@ -505,7 +510,8 @@
         if (value > _FOUR_BYTE_LIMIT) {
           if (!_allowMalformed) {
             throw new FormatException("Character outside valid Unicode range: "
-                                      "0x${value.toRadixString(16)}");
+                                      "0x${value.toRadixString(16)}",
+                                      codeUnits, i - extraUnits - 1);
           }
           value = UNICODE_REPLACEMENT_CHARACTER_RUNE;
         }
@@ -533,7 +539,8 @@
           // TODO(floitsch): should this be unit <= 0 ?
           if (!_allowMalformed) {
             throw new FormatException(
-                "Negative UTF-8 code unit: -0x${(-unit).toRadixString(16)}");
+                "Negative UTF-8 code unit: -0x${(-unit).toRadixString(16)}",
+                codeUnits, i - 1);
           }
           _stringSink.writeCharCode(UNICODE_REPLACEMENT_CHARACTER_RUNE);
         } else {
@@ -556,7 +563,8 @@
           }
           if (!_allowMalformed) {
             throw new FormatException(
-                "Bad UTF-8 encoding 0x${unit.toRadixString(16)}");
+                "Bad UTF-8 encoding 0x${unit.toRadixString(16)}",
+                codeUnits, i - 1);
           }
           value = UNICODE_REPLACEMENT_CHARACTER_RUNE;
           expectedUnits = extraUnits = 0;
diff --git a/sdk/lib/core/annotations.dart b/sdk/lib/core/annotations.dart
index 6a596c6..77211ab 100644
--- a/sdk/lib/core/annotations.dart
+++ b/sdk/lib/core/annotations.dart
@@ -137,7 +137,7 @@
  * so assigning it to a typed variable may fail in checked mode,
  * and testing it with the `is` operator
  * will only return true for types it actually implements or extends.
- * Accessing a member which isn't implemented by the classs
+ * Accessing a member which isn't implemented by the class
  * will cause the `noSuchMethod` method to be called normally,
  * the `@proxy` annotation merely states the intent to handle (some of) those
  * `noSuchMethod` calls gracefully.
diff --git a/sdk/lib/core/bool.dart b/sdk/lib/core/bool.dart
index d1f31d7..b22f812 100644
--- a/sdk/lib/core/bool.dart
+++ b/sdk/lib/core/bool.dart
@@ -41,6 +41,8 @@
   external const factory bool.fromEnvironment(String name,
                                               {bool defaultValue: false});
 
+  external int get hashCode;
+
   /**
    * Returns [:"true":] if the receiver is [:true:], or [:"false":] if the
    * receiver is [:false:].
diff --git a/sdk/lib/core/date_time.dart b/sdk/lib/core/date_time.dart
index 0453704..958dff2 100644
--- a/sdk/lib/core/date_time.dart
+++ b/sdk/lib/core/date_time.dart
@@ -34,7 +34,7 @@
  * For convenience and readability,
  * the DateTime class provides a constant for each day and month
  * name&mdash;for example, [AUGUST] and [FRIDAY].
- * You can use these constants to improve code readibility:
+ * You can use these constants to improve code readability:
  *
  *     DateTime berlinWallFell = new DateTime(1989, DateTime.NOVEMBER, 9);
  *     assert(berlinWallFell.weekday == DateTime.THURSDAY);
@@ -210,14 +210,15 @@
    *   then optionally a two digit minutes value,
    *   then optionally a two digit seconds value, and
    *   then optionally a '.' followed by a one-to-six digit second fraction.
-   *   The minuts and seconds may be separated from the previous parts by a ':'.
+   *   The minutes and seconds may be separated from the previous parts by a
+   *   ':'.
    *   Examples: "12", "12:30:24.124", "123010.50".
    * * An optional time-zone offset part,
    *   possibly separated from the previous by a space.
    *   The time zone is either 'z' or 'Z', or it is a signed two digit hour
    *   part and an optional two digit minute part. The sign must be either
    *   "+" or "-", and can not be omitted.
-   *   The minutes may be separted from the hours by a ':'.
+   *   The minutes may be separated from the hours by a ':'.
    *   Examples: "Z", "-10", "01:30", "1130".
    *
    * This includes the output of both [toString] and [toIso8601String], which
diff --git a/sdk/lib/core/errors.dart b/sdk/lib/core/errors.dart
index c11ea2e..16f2ffb 100644
--- a/sdk/lib/core/errors.dart
+++ b/sdk/lib/core/errors.dart
@@ -96,7 +96,9 @@
  * Error thrown by the runtime system when an assert statement fails.
  */
 class AssertionError extends Error {
-  AssertionError();
+  /** Message describing the assertion error. */
+  final Object message;
+  AssertionError([this.message]);
   String toString() => "Assertion failed";
 }
 
@@ -220,7 +222,7 @@
                     (message != null) ? message : "Value not in range");
 
   /**
-   * Create a new [RangeError] with for an invalid value being outside a range.
+   * Create a new [RangeError] for a value being outside the valid range.
    *
    * The allowed range is from [minValue] to [maxValue], inclusive.
    * If `minValue` or `maxValue` are `null`, the range is infinite in
@@ -414,6 +416,8 @@
  */
 class FallThroughError extends Error {
   FallThroughError();
+
+  external String toString();
 }
 
 /**
@@ -421,8 +425,9 @@
  */
 class AbstractClassInstantiationError extends Error {
   final String _className;
-  AbstractClassInstantiationError(String this._className);
-  String toString() => "Cannot instantiate abstract class: '$_className'";
+  AbstractClassInstantiationError(String className) : _className = className;
+
+  external String toString();
 }
 
 
@@ -459,16 +464,11 @@
    * the signature of the method that would have been called if the parameters
    * had matched.
    */
-  NoSuchMethodError(Object receiver,
-                    Symbol memberName,
-                    List positionalArguments,
-                    Map<Symbol ,dynamic> namedArguments,
-                    [List existingArgumentNames = null])
-      : _receiver = receiver,
-        _memberName = memberName,
-        _arguments = positionalArguments,
-        _namedArguments = namedArguments,
-        _existingArgumentNames = existingArgumentNames;
+  external NoSuchMethodError(Object receiver,
+                             Symbol memberName,
+                             List positionalArguments,
+                             Map<Symbol, dynamic> namedArguments,
+                             [List existingArgumentNames = null]);
 
   external String toString();
 }
diff --git a/sdk/lib/core/expando.dart b/sdk/lib/core/expando.dart
index 2ecd2dc..1e8a47a 100644
--- a/sdk/lib/core/expando.dart
+++ b/sdk/lib/core/expando.dart
@@ -10,7 +10,7 @@
  * Does not work on numbers, strings, booleans or null.
  *
  * An `Expando` does not hold on to the added property value after an object
- * becomes inacessible.
+ * becomes inaccessible.
  *
  * Since you can always create a new number that is identical to an existing
  * number, it means that an expando property on a number could never be
diff --git a/sdk/lib/core/invocation.dart b/sdk/lib/core/invocation.dart
index 7deaeec..2741841 100644
--- a/sdk/lib/core/invocation.dart
+++ b/sdk/lib/core/invocation.dart
@@ -42,7 +42,7 @@
   /**
    * Whether the invocation was a setter call.
    *
-   * If so, [arguments] has exactly one positonal argument,
+   * If so, [arguments] has exactly one positional argument,
    * and [namedArguments] is empty.
    */
   bool get isSetter;
diff --git a/sdk/lib/core/iterable.dart b/sdk/lib/core/iterable.dart
index 9ea0c02..18ec4d1 100644
--- a/sdk/lib/core/iterable.dart
+++ b/sdk/lib/core/iterable.dart
@@ -154,8 +154,7 @@
    * on any element where the result isn't needed.
    * For example, [elementAt] may call `f` only once.
    */
-  Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E e)) =>
-      new MappedIterable<E, dynamic/*=T*/>(this, f);
+  Iterable<T> map<T>(T f(E e)) => new MappedIterable<E, T>(this, f);
 
   /**
    * Returns a new lazy [Iterable] with all elements that satisfy the
@@ -193,8 +192,8 @@
    *     print(duplicated); // => [1, 1, 2, 2, 3, 3]
    *
    */
-  Iterable/*<T>*/ expand/*<T>*/(Iterable/*<T>*/ f(E element)) =>
-      new ExpandIterable<E, dynamic/*=T*/>(this, f);
+  Iterable<T> expand<T>(Iterable<T> f(E element)) =>
+      new ExpandIterable<E, T>(this, f);
 
   /**
    * Returns true if the collection contains an element equal to [element].
@@ -204,7 +203,7 @@
    * equal to [element].
    *
    * The equality used to determine whether [element] is equal to an element of
-   * the iterable defaults to the [Object.operator==] of the element.
+   * the iterable defaults to the [Object.==] of the element.
    *
    * Some types of iterable may have a different equality used for its elements.
    * For example, a [Set] may have a custom equality
@@ -280,8 +279,7 @@
    *     iterable.fold(0, (prev, element) => prev + element);
    *
    */
-  dynamic/*=T*/ fold/*<T>*/(var/*=T*/ initialValue,
-               dynamic/*=T*/ combine(var/*=T*/ previousValue, E element)) {
+  T fold<T>(T initialValue, T combine(T previousValue, E element)) {
     var value = initialValue;
     for (E element in this) value = combine(value, element);
     return value;
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 33e011c..ca0a449 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -329,7 +329,7 @@
   void setAll(int index, Iterable<E> iterable);
 
   /**
-   * Removes the first occurence of [value] from this list.
+   * Removes the first occurrence of [value] from this list.
    *
    * Returns true if [value] was in the list, false otherwise.
    *
@@ -415,12 +415,15 @@
    * Returns an [Iterable] that iterates over the objects in the range
    * [start] inclusive to [end] exclusive.
    *
-   * An error occurs if [end] is before [start].
+   * The provide range, given by [start] and [end], must be valid at the time
+   * of the call.
    *
-   * An error occurs if the [start] and [end] are not valid ranges at the time
-   * of the call to this method. The returned [Iterable] behaves like
-   * `skip(start).take(end - start)`. That is, it does not throw exceptions
-   * if `this` changes size.
+   * A range from [start] to [end] is valid if `0 <= start <= end <= len`, where
+   * `len` is this list's `length`. The range starts at `start` and has length
+   * `end - start`. An empty range (with `end == start`) is valid.
+   *
+   * The returned [Iterable] behaves like `skip(start).take(end - start)`.
+   * That is, it does *not* throw if this list changes size.
    *
    *     List<String> colors = ['red', 'green', 'blue', 'orange', 'pink'];
    *     Iterable<String> range = colors.getRange(1, 4);
@@ -441,15 +444,17 @@
    *     list1.setRange(1, 3, list2, 3);
    *     list1.join(', '); // '1, 8, 9, 4'
    *
-   * The [start] and [end] indices must satisfy `0 ≤ start ≤ end ≤ length`.
-   * If [start] equals [end], this method has no effect.
+   * The provide range, given by [start] and [end], must be valid.
+   * A range from [start] to [end] is valid if `0 <= start <= end <= len`, where
+   * `len` is this list's `length`. The range starts at `start` and has length
+   * `end - start`. An empty range (with `end == start`) is valid.
    *
    * The [iterable] must have enough objects to fill the range from `start`
    * to `end` after skipping [skipCount] objects.
    *
-   * If `iterable` is this list, the operation will copy the elements originally
-   * in the range from `skipCount` to `skipCount + (end - start)` to the
-   * range `start` to `end`, even if the two ranges overlap.
+   * If `iterable` is this list, the operation copies the elements
+   * originally in the range from `skipCount` to `skipCount + (end - start)` to
+   * the range `start` to `end`, even if the two ranges overlap.
    *
    * If `iterable` depends on this list in some other way, no guarantees are
    * made.
@@ -459,8 +464,10 @@
   /**
    * Removes the objects in the range [start] inclusive to [end] exclusive.
    *
-   * The [start] and [end] indices must be in the range
-   * `0 ≤ index ≤ length`, and `start ≤ end`.
+   * The provide range, given by [start] and [end], must be valid.
+   * A range from [start] to [end] is valid if `0 <= start <= end <= len`, where
+   * `len` is this list's `length`. The range starts at `start` and has length
+   * `end - start`. An empty range (with `end == start`) is valid.
    *
    * Throws an [UnsupportedError] if this is a fixed-length list. In that case
    * the list is not modified.
@@ -471,7 +478,10 @@
    * Sets the objects in the range [start] inclusive to [end] exclusive
    * to the given [fillValue].
    *
-   * An error occurs if [start]..[end] is not a valid range for `this`.
+   * The provide range, given by [start] and [end], must be valid.
+   * A range from [start] to [end] is valid if `0 <= start <= end <= len`, where
+   * `len` is this list's `length`. The range starts at `start` and has length
+   * `end - start`. An empty range (with `end == start`) is valid.
    */
   void fillRange(int start, int end, [E fillValue]);
 
@@ -483,7 +493,10 @@
    *     list.replaceRange(1, 4, [6, 7]);
    *     list.join(', '); // '1, 6, 7, 5'
    *
-   * An error occurs if [start]..[end] is not a valid range for `this`.
+   * The provide range, given by [start] and [end], must be valid.
+   * A range from [start] to [end] is valid if `0 <= start <= end <= len`, where
+   * `len` is this list's `length`. The range starts at `start` and has length
+   * `end - start`. An empty range (with `end == start`) is valid.
    *
    * This method does not work on fixed-length lists, even when [replacement]
    * has the same number of elements as the replaced range. In that case use
diff --git a/sdk/lib/core/map.dart b/sdk/lib/core/map.dart
index ac4581f..1c29a90 100644
--- a/sdk/lib/core/map.dart
+++ b/sdk/lib/core/map.dart
@@ -237,6 +237,9 @@
    *
    * The order of iteration is defined by the individual `Map` implementation,
    * but must be consistent between changes to the map.
+   *
+   * Modifying the map while iterating the keys
+   * may break the iteration.
    */
   Iterable<K> get keys;
 
@@ -250,6 +253,9 @@
    * The returned iterable has an efficient `length` method based on the
    * [length] of the map. Its [Iterable.contains] method is based on
    * `==` comparison.
+   *
+   * Modifying the map while iterating the
+   * values may break the iteration.
    */
   Iterable<V> get values;
 
diff --git a/sdk/lib/core/null.dart b/sdk/lib/core/null.dart
index dd914a3..f408dc2 100644
--- a/sdk/lib/core/null.dart
+++ b/sdk/lib/core/null.dart
@@ -16,6 +16,8 @@
     throw new UnsupportedError('class Null cannot be instantiated');
   }
 
+  external int get hashCode;
+
   /** Returns the string `"null"`. */
   String toString() => "null";
 }
diff --git a/sdk/lib/core/num.dart b/sdk/lib/core/num.dart
index 21f23ee..15b892d 100644
--- a/sdk/lib/core/num.dart
+++ b/sdk/lib/core/num.dart
@@ -36,8 +36,8 @@
    * will fail to work. The behavior is the standard IEEE-754 equality of
    * doubles.
    *
-   * If you can avoid NaN values, the remaining doubles do have a proper eqality
-   * relation, and can be used safely.
+   * If you can avoid NaN values, the remaining doubles do have a proper
+   * equality relation, and can be used safely.
    *
    * Use [compareTo] for a comparison that distinguishes zero and minus zero,
    * and that considers NaN values as equal.
@@ -51,7 +51,7 @@
    * for an [int] and a [double] with the same numerical value, and therefore
    * the same value for the doubles zero and minus zero.
    *
-   * No guarantees are made about the hash code of NaN.
+   * No guarantees are made about the hash code of NaN values.
    */
   int get hashCode;
 
@@ -61,21 +61,45 @@
    * Returns a negative number if `this` is less than `other`, zero if they are
    * equal, and a positive number if `this` is greater than `other`.
    *
-   * The orderding represented by this method is a total ordering of [num]
+   * The ordering represented by this method is a total ordering of [num]
    * values. All distinct doubles are non-equal, as are all distinct integers,
    * but integers are equal to doubles if they have the same numerical
    * value.
    *
-   * For ordering, the double NaN value is considered equal to itself, and
-   * greater than any numeric value (unlike its behavior in `operator==`).
+   * For doubles, the `compareTo` operation is different from the partial
+   * ordering given by [operator==], [operator<] and [operator>]. For example,
+   * IEEE doubles impose that `0.0 == -0.0` and all comparison operations on
+   * NaN return false.
    *
-   * The double value -0.0 is considered less than 0.0 (and the integer 0), but
-   * greater than any non-zero negative value.
+   * This function imposes a complete ordering for doubles. When using
+   * `compareTo` the following properties hold:
    *
-   * Positive infinity is greater than any finite value (any value apart from
-   * itself and NaN), and negative infinity is less than any other value.
+   * - All NaN values are considered equal, and greater than any numeric value.
+   * - -0.0 is less than 0.0 (and the integer 0), but greater than any non-zero
+   *    negative value.
+   * - Negative infinity is less than all other values and positive infinity is
+   *   greater than all non-NaN values.
+   * - All other values are compared using their numeric value.
    *
-   * All other values are compared using their numeric value.
+   * Examples:
+   * ```
+   * print(1.compareTo(2)); // => -1
+   * print(2.compareTo(1)); // => 1
+   * print(1.compareTo(1)); // => 0
+   *
+   * // The following comparisons yield different results than the
+   * // corresponding comparison operators.
+   * print((-0.0).compareTo(0.0));  // => -1
+   * print(double.NAN.compareTo(double.NAN));  // => 0
+   * print(double.INFINITY.compareTo(double.NAN)); // => -1
+   *
+   * // -0.0, and NaN comparison operators have rules imposed by the IEEE
+   * // standard.
+   * print(-0.0 == 0.0); // => true
+   * print(double.NAN == double.NAN);  // => false
+   * print(double.INFINITY < double.NAN);  // => false
+   * print(double.NAN < double.INFINITY);  // => false
+   * print(double.NAN == double.INFINITY);  // => false
    */
   int compareTo(num other);
 
@@ -162,7 +186,7 @@
   /**
    * True if the number is finite; otherwise, false.
    *
-   * The only non-finite numbers are NaN, positive infinitity and
+   * The only non-finite numbers are NaN, positive infinity, and
    * negative infinity.
    */
   bool get isFinite;
@@ -296,6 +320,9 @@
    * The comparison is done using [compareTo] and therefore takes `-0.0` into
    * account. This also implies that [double.NAN] is treated as the maximal
    * double value.
+   *
+   * The arguments [lowerLimit] and [upperLimit] must form a valid range where
+   * `lowerLimit.compareTo(upperLimit) <= 0`.
    */
   num clamp(num lowerLimit, num upperLimit);
 
diff --git a/sdk/lib/core/object.dart b/sdk/lib/core/object.dart
index ae0431e..c7f3fdb1 100644
--- a/sdk/lib/core/object.dart
+++ b/sdk/lib/core/object.dart
@@ -56,7 +56,7 @@
    * If a subclass overrides the equality operator it should override
    * the [hashCode] method as well to maintain consistency.
    */
-  bool operator ==(other) => identical(this, other);
+  external bool operator==(other);
 
   /**
    * Get a hash code for this object.
diff --git a/sdk/lib/core/pattern.dart b/sdk/lib/core/pattern.dart
index 7f32c72..aae9e64 100644
--- a/sdk/lib/core/pattern.dart
+++ b/sdk/lib/core/pattern.dart
@@ -9,7 +9,7 @@
  */
 abstract class Pattern {
   // NOTE: When using "start" index from the language library, call
-  // without an argument if start is zero. This allows backwards compatiblity
+  // without an argument if start is zero. This allows backwards compatibility
   // with implementations of the older interface that didn't have the start
   // index argument.
   /**
@@ -66,7 +66,7 @@
  *     my
  *     string
  *
- * Some patterns, regular expressions in particular, may record subtrings
+ * Some patterns, regular expressions in particular, may record substrings
  * that were part of the matching. These are called _groups_ in the Match
  * object. Some patterns may never have any groups, and their matches always
  * have zero [groupCount].
diff --git a/sdk/lib/core/set.dart b/sdk/lib/core/set.dart
index d2e9d8d..fe00311 100644
--- a/sdk/lib/core/set.dart
+++ b/sdk/lib/core/set.dart
@@ -21,7 +21,7 @@
  * or ordered in some way. Examples:
  *
  * * A [HashSet] is unordered, which means that its iteration order is
- *   uspecified,
+ *   unspecified,
  * * [LinkedHashSet] iterates in the insertion order of its elements, and
  * * a sorted set like [SplayTreeSet] iterates the elements in sorted order.
  *
diff --git a/sdk/lib/core/stacktrace.dart b/sdk/lib/core/stacktrace.dart
index 17abd38..e655072 100644
--- a/sdk/lib/core/stacktrace.dart
+++ b/sdk/lib/core/stacktrace.dart
@@ -46,7 +46,7 @@
    * Returns a [String] representation of the stack trace.
    *
    * The string represents the full stack trace starting from
-   * the point where a throw ocurred to the top of the current call sequence.
+   * the point where a throw occurred to the top of the current call sequence.
    *
    * The exact format of the string representation is not final.
    */
diff --git a/sdk/lib/core/stopwatch.dart b/sdk/lib/core/stopwatch.dart
index f6dd85e..cf55b89 100644
--- a/sdk/lib/core/stopwatch.dart
+++ b/sdk/lib/core/stopwatch.dart
@@ -15,7 +15,7 @@
 
   // The _start and _stop fields capture the time when [start] and [stop]
   // are called respectively.
-  // If _stop is null, the stopwatched is running.
+  // If _stop is null, the stopwatch is running.
   int _start = 0;
   int _stop = 0;
 
diff --git a/sdk/lib/core/string.dart b/sdk/lib/core/string.dart
index 39641df..bd3a15e 100644
--- a/sdk/lib/core/string.dart
+++ b/sdk/lib/core/string.dart
@@ -187,7 +187,7 @@
   /**
    * Returns a hash code derived from the code units of the string.
    *
-   * This is compatible with [operator==]. Strings with the same sequence
+   * This is compatible with [==]. Strings with the same sequence
    * of code units have the same hash code.
    */
   int get hashCode;
@@ -360,7 +360,7 @@
   String operator *(int times);
 
   /**
-   * Pads this string on the left if it is shorther than [width].
+   * Pads this string on the left if it is shorter than [width].
    *
    * Return a new string that prepends [padding] onto this string
    * one time for each position the length is less than [width].
@@ -378,7 +378,7 @@
   String padLeft(int width, [String padding = ' ']);
 
   /**
-   * Pads this string on the right if it is shorther than [width].
+   * Pads this string on the right if it is shorter than [width].
    *
    * Return a new string that appends [padding] after this string
    * one time for each position the length is less than [width].
@@ -413,7 +413,7 @@
   bool contains(Pattern other, [int startIndex = 0]);
 
   /**
-   * Returns a new string in which the first occurence of [from] in this string
+   * Returns a new string in which the first occurrence of [from] in this string
    * is replaced with [to], starting from [startIndex]:
    *
    *     '0.0001'.replaceFirst(new RegExp(r'0'), ''); // '.0001'
@@ -422,12 +422,15 @@
   String replaceFirst(Pattern from, String to, [int startIndex = 0]);
 
   /**
-   * Replace the first occurence of [from] in this string.
+   * Replace the first occurrence of [from] in this string.
    *
    * Returns a new string, which is this string
    * except that the first match of [pattern], starting from [startIndex],
    * is replaced by the result of calling [replace] with the match object.
    *
+   * The optional [startIndex] is by default set to 0. If provided, it must be
+   * an integer in the range `[0 .. len]`, where `len` is this string's length.
+   *
    * If the value returned by calling `replace` is not a [String], it
    * is converted to a `String` using its `toString` method, which must
    * then return a string.
diff --git a/sdk/lib/core/symbol.dart b/sdk/lib/core/symbol.dart
index 44e9787..fc39141 100644
--- a/sdk/lib/core/symbol.dart
+++ b/sdk/lib/core/symbol.dart
@@ -23,7 +23,7 @@
    *   (one of "`+`", "`-`", "`*`", "`/`", "`%`", "`~/`", "`&`", "`|`",
    *   "`^`", "`~`", "`<<`", "`>>`", "`<`", "`<=`", "`>`", "`>=`", "`==`",
    *   "`[]`", "`[]=`", or "`unary-`"),
-   * * any of the above preceeded by any number of qualifiers,
+   * * any of the above preceded by any number of qualifiers,
    *   where a qualifier is a non-private identifier followed by '`.`',
    * * or the empty string (the default name of a library with no library
    *   name declaration).
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index 847521a..e9a716f 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -75,7 +75,7 @@
    * default port.
    *
    * If any of `userInfo`, `host` or `port` are provided,
-   * the URI has an autority according to [hasAuthority].
+   * the URI has an authority according to [hasAuthority].
    *
    * The path component is set through either [path] or
    * [pathSegments].
@@ -379,7 +379,7 @@
   /**
    * Returns the port part of the authority component.
    *
-   * Returns the defualt port if there is no port number in the authority
+   * Returns the default port if there is no port number in the authority
    * component. That's 80 for http, 443 for https, and 0 for everything else.
    */
   int get port;
@@ -505,7 +505,8 @@
    * Returns the origin of the URI in the form scheme://host:port for the
    * schemes http and https.
    *
-   * It is an error if the scheme is not "http" or "https".
+   * It is an error if the scheme is not "http" or "https", or if the host name
+   * is missing or empty.
    *
    * See: http://www.w3.org/TR/2011/WD-html5-20110405/origin-0.html#origin
    */
@@ -612,7 +613,7 @@
    * value from this `Uri` instead.
    *
    * This method is different from [Uri.resolve] which overrides in a
-   * hierarchial manner,
+   * hierarchical manner,
    * and can instead replace each part of a `Uri` individually.
    *
    * Example:
@@ -1059,7 +1060,7 @@
    *
    * Note that decoding a URI component might change its meaning as
    * some of the decoded characters could be characters with are
-   * delimiters for a given URI componene type. Always split a URI
+   * delimiters for a given URI component type. Always split a URI
    * component using the delimiters for the component before decoding
    * the individual parts.
    *
@@ -1360,7 +1361,7 @@
   final String _fragment;
 
   /**
-   * Cache the computed return value of [pathSegements].
+   * Cache the computed return value of [pathSegments].
    */
   List<String> _pathSegments;
 
@@ -1470,10 +1471,14 @@
     path = _makePath(path, 0, _stringOrNullLength(path), pathSegments,
                      scheme, hasAuthority);
     if (scheme.isEmpty && host == null && !path.startsWith('/')) {
-      path = _normalizeRelativePath(path);
+      bool allowScheme = scheme.isNotEmpty || host != null;
+      path = _normalizeRelativePath(path, allowScheme);
     } else {
       path = _removeDotSegments(path);
     }
+    if (host == null && path.startsWith("//")) {
+      host = "";
+    }
     return new _Uri._internal(scheme, userInfo, host, port,
                               path, query, fragment);
   }
@@ -2058,7 +2063,7 @@
   /// Otherwise it follows the RFC 3986 "remove dot segments" algorithm.
   static String _normalizePath(String path, String scheme, bool hasAuthority) {
     if (scheme.isEmpty && !hasAuthority && !path.startsWith('/')) {
-      return _normalizeRelativePath(path);
+      return _normalizeRelativePath(path, scheme.isNotEmpty || hasAuthority);
     }
     return _removeDotSegments(path);
   }
@@ -2354,15 +2359,21 @@
 
   /// Removes all `.` segments and any non-leading `..` segments.
   ///
+  /// If the path starts with something that looks like a scheme,
+  /// and [allowScheme] is false, the colon is escaped.
+  ///
   /// Removing the ".." from a "bar/foo/.." sequence results in "bar/"
   /// (trailing "/"). If the entire path is removed (because it contains as
   /// many ".." segments as real segments), the result is "./".
   /// This is different from an empty string, which represents "no path",
   /// when you resolve it against a base URI with a path with a non-empty
   /// final segment.
-  static String _normalizeRelativePath(String path) {
+  static String _normalizeRelativePath(String path, bool allowScheme) {
     assert(!path.startsWith('/'));  // Only get called for relative paths.
-    if (!_mayContainDotSegments(path)) return path;
+    if (!_mayContainDotSegments(path)) {
+      if (!allowScheme) path = _escapeScheme(path);
+      return path;
+    }
     assert(path.isNotEmpty);  // An empty path would not have dot segments.
     List<String> output = [];
     bool appendSlash = false;
@@ -2385,9 +2396,27 @@
       return "./";
     }
     if (appendSlash || output.last == '..') output.add("");
+    if (!allowScheme) output[0] = _escapeScheme(output[0]);
     return output.join("/");
   }
 
+  /// If [path] starts with a valid scheme, escape the percent.
+  static String _escapeScheme(String path) {
+    if (path.length >= 2 && _isAlphabeticCharacter(path.codeUnitAt(0))) {
+      for (int i = 1; i < path.length; i++) {
+        int char = path.codeUnitAt(i);
+        if (char == _COLON) {
+          return "${path.substring(0, i)}%3A${path.substring(i + 1)}";
+        }
+        if (char > 127 ||
+            ((_schemeTable[char >> 4] & (1 << (char & 0x0f))) == 0)) {
+          break;
+        }
+      }
+    }
+    return path;
+  }
+
   Uri resolve(String reference) {
     return resolveUri(Uri.parse(reference));
   }
@@ -2459,7 +2488,8 @@
                 // If both base and reference are relative paths,
                 // allow the merged path to start with "..".
                 // The RFC only specifies the case where the base has a scheme.
-                targetPath = _normalizeRelativePath(mergedPath);
+                targetPath = _normalizeRelativePath(mergedPath,
+                  this.hasScheme || this.hasAuthority);
               }
             }
           }
@@ -2492,13 +2522,17 @@
   bool get hasAbsolutePath => _path.startsWith('/');
 
   String get origin {
-    if (scheme == "" || _host == null || _host == "") {
+    if (scheme == "") {
       throw new StateError("Cannot use origin without a scheme: $this");
     }
     if (scheme != "http" && scheme != "https") {
       throw new StateError(
         "Origin is only applicable schemes http and https: $this");
     }
+    if (_host == null || _host == "") {
+      throw new StateError(
+          "A $scheme: URI should have a non-empty host name: $this");
+    }
     if (_port == null) return "$scheme://$_host";
     return "$scheme://$_host:$_port";
   }
@@ -2596,7 +2630,7 @@
     assert(_text == null);
     StringBuffer sb = new StringBuffer();
     if (scheme.isNotEmpty) sb..write(scheme)..write(":");
-    if (hasAuthority || path.startsWith("//") || (scheme == "file")) {
+    if (hasAuthority || (scheme == "file")) {
       // File URIS always have the authority, even if it is empty.
       // The empty URI means "localhost".
       sb.write("//");
@@ -2708,7 +2742,7 @@
    * If [plusToSpace] is `true`, plus characters will be converted to spaces.
    *
    * The decoder will create a byte-list of the percent-encoded parts, and then
-   * decode the byte-list using [encoding]. The default encodingis UTF-8.
+   * decode the byte-list using [encoding]. The default encodings UTF-8.
    */
   static String _uriDecode(String text,
                            int start,
@@ -4082,13 +4116,17 @@
   String get origin {
     // Check original behavior - W3C spec is wonky!
     bool isHttp = _isHttp;
-    if (_schemeEnd < 0 || _hostStart == _portStart) {
+    if (_schemeEnd < 0) {
       throw new StateError("Cannot use origin without a scheme: $this");
     }
     if (!isHttp && !_isHttps) {
       throw new StateError(
         "Origin is only applicable schemes http and https: $this");
     }
+    if (_hostStart == _portStart) {
+      throw new StateError(
+          "A $scheme: URI should have a non-empty host name: $this");
+    }
     if (_hostStart == _schemeEnd + 3) {
       return _uri.substring(0, _pathStart);
     }
diff --git a/sdk/lib/developer/extension.dart b/sdk/lib/developer/extension.dart
index 5883fb5..e50a88d 100644
--- a/sdk/lib/developer/extension.dart
+++ b/sdk/lib/developer/extension.dart
@@ -166,7 +166,7 @@
   _postEvent(eventKind, eventDataAsString);
 }
 
-external _postEvent(String eventKind, String eventData);
+external void _postEvent(String eventKind, String eventData);
 
 // Both of these functions are written inside C++ to avoid updating the data
 // structures in Dart, getting an OOB, and observing stale state. Do not move
diff --git a/sdk/lib/developer/profiler.dart b/sdk/lib/developer/profiler.dart
index 566d015..127a48e 100644
--- a/sdk/lib/developer/profiler.dart
+++ b/sdk/lib/developer/profiler.dart
@@ -9,7 +9,7 @@
   /// The maximum number of UserTag instances that can be created by a program.
   static const MAX_USER_TAGS = 64;
 
-  factory UserTag(String label) => new _FakeUserTag(label);
+  external factory UserTag(String label);
 
   /// Label of [this].
   String get label;
@@ -19,50 +19,11 @@
   UserTag makeCurrent();
 
   /// The default [UserTag] with label 'Default'.
-  static UserTag get defaultTag => _FakeUserTag._defaultTag;
+  external static UserTag get defaultTag;
 }
 
-// This is a fake implementation of UserTag so that code can compile and run
-// in dart2js.
-class _FakeUserTag implements UserTag {
-  static Map _instances = {};
-
-  _FakeUserTag.real(this.label);
-
-  factory _FakeUserTag(String label) {
-    // Canonicalize by name.
-    var existingTag = _instances[label];
-    if (existingTag != null) {
-      return existingTag;
-    }
-    // Throw an exception if we've reached the maximum number of user tags.
-    if (_instances.length == UserTag.MAX_USER_TAGS) {
-      throw new UnsupportedError(
-          'UserTag instance limit (${UserTag.MAX_USER_TAGS}) reached.');
-    }
-    // Create a new instance and add it to the instance map.
-    var instance = new _FakeUserTag.real(label);
-    _instances[label] = instance;
-    return instance;
-  }
-
-  final String label;
-
-  UserTag makeCurrent() {
-    var old = _currentTag;
-    _currentTag = this;
-    return old;
-  }
-
-  static final UserTag _defaultTag = new _FakeUserTag('Default');
-}
-
-var _currentTag = _FakeUserTag._defaultTag;
-
 /// Returns the current [UserTag] for the isolate.
-UserTag getCurrentTag() {
-  return _currentTag;
-}
+external UserTag getCurrentTag();
 
 /// Abstract [Metric] class. Metric names must be unique, are hierarchical,
 /// and use periods as separators. For example, 'a.b.c'. Uniqueness is only
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 04ed9e6..112f7fb 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -1209,8 +1209,8 @@
     return _create_2(blobParts, bag);
   }
 
-  static _create_1(parts) => JS('Blob', 'new Blob(#)', parts);
-  static _create_2(parts, bag) => JS('Blob', 'new Blob(#, #)', parts, bag);
+  static _create_1(parts) => JS('Blob', 'new self.Blob(#)', parts);
+  static _create_2(parts, bag) => JS('Blob', 'new self.Blob(#, #)', parts, bag);
 
   static _create_bag() => JS('var', '{}');
   static _bag_set(bag, key, value) { JS('void', '#[#] = #', bag, key, value); }
@@ -39644,6 +39644,7 @@
     return value is String && _classListContains(_classListOf(_element), value);
   }
 
+  @ForceInline()
   static bool _add(Element _element, String value) {
     DomTokenList list = _classListOf(_element);
     // Compute returned result independently of action upon the set.
@@ -39652,6 +39653,7 @@
     return added;
   }
 
+  @ForceInline()
   static bool _remove(Element _element, String value) {
     DomTokenList list = _classListOf(_element);
     bool removed = _classListContainsBeforeAddOrRemove(list, value);
@@ -40075,13 +40077,21 @@
   EventListener _onData;
   final bool _useCapture;
 
-  // TODO(jacobr): for full strong mode correctness we should write
-  // _onData = onData == null ? null : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
-  // but that breaks 114 co19 tests as well as multiple html tests as it is reasonable
-  // to pass the wrong type of event object to an event listener as part of a
-  // test.
+  // TODO(leafp): It would be better to write this as
+  // _onData = onData == null ? null :
+  //   onData is _wrapZoneCallback<Event, dynamic>
+  //     ? _wrapZone/*<Event, dynamic>*/(onData)
+  //     : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
+  // In order to support existing tests which pass the wrong type of events but
+  // use a more general listener, without causing as much slowdown for things
+  // which are typed correctly.  But this currently runs afoul of restrictions
+  // on is checks for compatibility with the VM.
   _EventStreamSubscription(this._target, this._eventType, void onData(T event),
-      this._useCapture) : _onData = _wrapZone/*<Event, dynamic>*/(onData) {
+                           this._useCapture) :
+      _onData = onData == null
+      ? null
+      : _wrapZone/*<Event, dynamic>*/((e) => (onData as dynamic)(e))
+  {
     _tryResume();
   }
 
@@ -43390,23 +43400,13 @@
   // For performance reasons avoid wrapping if we are in the root zone.
   if (Zone.current == Zone.ROOT) return callback;
   if (callback == null) return null;
-  // TODO(jacobr): we cast to _wrapZoneCallback/*<A, R>*/ to hack around missing
-  // generic method support in zones.
-  // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
-  _wrapZoneCallback/*<A, R>*/ wrapped =
-      Zone.current.bindUnaryCallback(callback, runGuarded: true);
-  return wrapped;
+  return Zone.current.bindUnaryCallback/*<R, A>*/(callback, runGuarded: true);
 }
 
 _wrapZoneBinaryCallback/*<A, B, R>*/ _wrapBinaryZone/*<A, B, R>*/(_wrapZoneBinaryCallback/*<A, B, R>*/ callback) {
   if (Zone.current == Zone.ROOT) return callback;
   if (callback == null) return null;
-  // We cast to _wrapZoneBinaryCallback/*<A, B, R>*/ to hack around missing
-  // generic method support in zones.
-  // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
-  _wrapZoneBinaryCallback/*<A, B, R>*/ wrapped =
-      Zone.current.bindBinaryCallback(callback, runGuarded: true);
-  return wrapped;
+  return Zone.current.bindBinaryCallback/*<R, A, B>*/(callback, runGuarded: true);
 }
 
 /**
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index 5385090..afa40c5 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -37662,10 +37662,10 @@
     if ((blob_OR_source_OR_stream is Blob || blob_OR_source_OR_stream == null)) {
       return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
     }
-    if ((blob_OR_source_OR_stream is MediaSource)) {
+    if ((blob_OR_source_OR_stream is MediaStream)) {
       return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
     }
-    if ((blob_OR_source_OR_stream is MediaStream)) {
+    if ((blob_OR_source_OR_stream is MediaSource)) {
       return _blink.BlinkURL.instance.createObjectURL_Callback_1_(blob_OR_source_OR_stream);
     }
     throw new ArgumentError("Incorrect number or type of arguments");
@@ -44600,13 +44600,21 @@
   EventListener _onData;
   final bool _useCapture;
 
-  // TODO(jacobr): for full strong mode correctness we should write
-  // _onData = onData == null ? null : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
-  // but that breaks 114 co19 tests as well as multiple html tests as it is reasonable
-  // to pass the wrong type of event object to an event listener as part of a
-  // test.
+  // TODO(leafp): It would be better to write this as
+  // _onData = onData == null ? null :
+  //   onData is _wrapZoneCallback<Event, dynamic>
+  //     ? _wrapZone/*<Event, dynamic>*/(onData)
+  //     : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
+  // In order to support existing tests which pass the wrong type of events but
+  // use a more general listener, without causing as much slowdown for things
+  // which are typed correctly.  But this currently runs afoul of restrictions
+  // on is checks for compatibility with the VM.
   _EventStreamSubscription(this._target, this._eventType, void onData(T event),
-      this._useCapture) : _onData = _wrapZone/*<Event, dynamic>*/(onData) {
+                           this._useCapture) :
+      _onData = onData == null
+      ? null
+      : _wrapZone/*<Event, dynamic>*/((e) => (onData as dynamic)(e))
+  {
     _tryResume();
   }
 
@@ -47864,23 +47872,13 @@
   // For performance reasons avoid wrapping if we are in the root zone.
   if (Zone.current == Zone.ROOT) return callback;
   if (callback == null) return null;
-  // TODO(jacobr): we cast to _wrapZoneCallback/*<A, R>*/ to hack around missing
-  // generic method support in zones.
-  // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
-  _wrapZoneCallback/*<A, R>*/ wrapped =
-      Zone.current.bindUnaryCallback(callback, runGuarded: true);
-  return wrapped;
+  return Zone.current.bindUnaryCallback/*<R, A>*/(callback, runGuarded: true);
 }
 
 _wrapZoneBinaryCallback/*<A, B, R>*/ _wrapBinaryZone/*<A, B, R>*/(_wrapZoneBinaryCallback/*<A, B, R>*/ callback) {
   if (Zone.current == Zone.ROOT) return callback;
   if (callback == null) return null;
-  // We cast to _wrapZoneBinaryCallback/*<A, B, R>*/ to hack around missing
-  // generic method support in zones.
-  // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
-  _wrapZoneBinaryCallback/*<A, B, R>*/ wrapped =
-      Zone.current.bindBinaryCallback(callback, runGuarded: true);
-  return wrapped;
+  return Zone.current.bindBinaryCallback/*<R, A, B>*/(callback, runGuarded: true);
 }
 
 /**
diff --git a/sdk/lib/html/html_common/conversions.dart b/sdk/lib/html/html_common/conversions.dart
index 179b4e8..d66d9a0 100644
--- a/sdk/lib/html/html_common/conversions.dart
+++ b/sdk/lib/html/html_common/conversions.dart
@@ -223,7 +223,7 @@
 
     if (isJavaScriptSimpleObject(e)) {
       // TODO(sra): If mustCopy is false, swizzle the prototype for one of a Map
-      // implementation that uses the properies as storage.
+      // implementation that uses the properties as storage.
       var slot = findSlot(e);
       var copy = readSlot(slot);
       if (copy != null) return copy;
diff --git a/sdk/lib/internal/internal.dart b/sdk/lib/internal/internal.dart
index 3eda7ca..0acf068 100644
--- a/sdk/lib/internal/internal.dart
+++ b/sdk/lib/internal/internal.dart
@@ -60,3 +60,12 @@
 
   static String stringOf(CodeUnits u) => u._string;
 }
+
+/// Marks a function as an external implementation ("native" in the Dart VM).
+///
+/// Provides a backend-specific String that can be used to identify the
+/// function's implementation.
+class ExternalName {
+  final String name;
+  const ExternalName(this.name);
+}
diff --git a/sdk/lib/internal/iterable.dart b/sdk/lib/internal/iterable.dart
index 73b3669..5ab7d4c 100644
--- a/sdk/lib/internal/iterable.dart
+++ b/sdk/lib/internal/iterable.dart
@@ -172,8 +172,7 @@
 
   Iterable<E> where(bool test(E element)) => super.where(test);
 
-  Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
-      new MappedListIterable<E, dynamic/*=T*/ >(this, f);
+  Iterable<T> map<T>(T f(E element)) => new MappedListIterable<E, T>(this, f);
 
   E reduce(E combine(var value, E element)) {
     int length = this.length;
@@ -189,9 +188,7 @@
     return value;
   }
 
-  /*=T*/ fold/*<T>*/(
-      var/*=T*/ initialValue, /*=T*/ combine(
-          var/*=T*/ previousValue, E element)) {
+  T fold<T>(T initialValue, T combine(T previousValue, E element)) {
     var value = initialValue;
     int length = this.length;
     for (int i = 0; i < length; i++) {
@@ -405,8 +402,7 @@
  *
  * Expects efficient `length` and `elementAt` on the source iterable.
  */
-class MappedListIterable<S, T> extends ListIterable<T>
-                               implements EfficientLengthIterable<T> {
+class MappedListIterable<S, T> extends ListIterable<T> {
   final Iterable<S> _source;
   final _Transformation<S, T> _f;
 
@@ -428,8 +424,7 @@
   Iterator<E> get iterator => new WhereIterator<E>(_iterable.iterator, _f);
 
   // Specialization of [Iterable.map] to non-EfficientLengthIterable.
-  Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) =>
-     new MappedIterable<E, dynamic/*=T*/>._(this, f);
+  Iterable<T> map<T>(T f(E element)) => new MappedIterable<E, T>._(this, f);
 }
 
 class WhereIterator<E> extends Iterator<E> {
@@ -720,15 +715,13 @@
 
   Iterable<E> where(bool test(E element)) => this;
 
-  Iterable/*<T>*/ map/*<T>*/(/*=T*/ f(E element)) => const EmptyIterable();
+  Iterable<T> map<T>(T f(E element)) => const EmptyIterable();
 
   E reduce(E combine(E value, E element)) {
     throw IterableElementError.noElement();
   }
 
-  /*=T*/ fold/*<T>*/(
-      var/*=T*/ initialValue, /*=T*/ combine(
-          var/*=T*/ previousValue, E element)) {
+  T fold<T>(T initialValue, T combine(T previousValue, E element)) {
     return initialValue;
   }
 
diff --git a/sdk/lib/internal/sort.dart b/sdk/lib/internal/sort.dart
index 63037ea..4085000 100644
--- a/sdk/lib/internal/sort.dart
+++ b/sdk/lib/internal/sort.dart
@@ -29,7 +29,7 @@
    * The function's behavior must be consistent. It must not return different
    * results for the same values.
    */
-  static void sort/*<E>*/(List/*<E>*/ a, int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
+  static void sort<E>(List<E> a, int compare(E a, E b)) {
     _doSort(a, 0, a.length - 1, compare);
   }
 
@@ -42,7 +42,7 @@
    *
    * See [:sort:] for requirements of the [:compare:] function.
    */
-  static void sortRange/*<E>*/(List/*<E>*/ a, int from, int to, int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
+  static void sortRange<E>(List<E> a, int from, int to, int compare(E a, E b)) {
     if ((from < 0) || (to > a.length) || (to < from)) {
       throw "OutOfRange";
     }
@@ -52,7 +52,8 @@
   /**
    * Sorts the list in the interval [:left:] to [:right:] (both inclusive).
    */
-  static void _doSort/*<E>*/(List/*<E>*/ a, int left, int right, int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
+  static void _doSort<E>(List<E> a, int left, int right,
+                         int compare(E a, E b)) {
     if ((right - left) <= _INSERTION_SORT_THRESHOLD) {
       _insertionSort(a, left, right, compare);
     } else {
@@ -60,7 +61,8 @@
     }
   }
 
-  static void _insertionSort/*<E>*/(List/*<E>*/ a, int left, int right, int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
+  static void _insertionSort<E>(List<E> a, int left, int right,
+                                int compare(E a, E b)) {
     for (int i = left + 1; i <= right; i++) {
       var el = a[i];
       int j = i;
@@ -72,9 +74,8 @@
     }
   }
 
-  static void _dualPivotQuicksort/*<E>*/(List/*<E>*/ a,
-                                  int left, int right,
-                                  int compare(dynamic /*=E*/ a, dynamic /*=E*/ b)) {
+  static void _dualPivotQuicksort<E>(List<E> a, int left, int right,
+                                     int compare(E a, E b)) {
     assert(right - left > _INSERTION_SORT_THRESHOLD);
 
     // Compute the two pivots by looking at 5 elements.
@@ -106,7 +107,7 @@
     var pivot2 = el4;
 
     // el2 and el4 have been saved in the pivot variables. They will be written
-    // back, once the partioning is finished.
+    // back, once the partitioning is finished.
     a[index1] = el1;
     a[index3] = el3;
     a[index5] = el5;
@@ -120,7 +121,7 @@
     bool pivots_are_equal = (compare(pivot1, pivot2) == 0);
     if (pivots_are_equal) {
       var pivot = pivot1;
-      // Degenerated case where the partioning becomes a dutch national flag
+      // Degenerated case where the partitioning becomes a dutch national flag
       // problem.
       //
       // [ |  < pivot  | == pivot | unpartitioned | > pivot  | ]
diff --git a/sdk/lib/internal/symbol.dart b/sdk/lib/internal/symbol.dart
index 64fcdb3..85df9a7 100644
--- a/sdk/lib/internal/symbol.dart
+++ b/sdk/lib/internal/symbol.dart
@@ -45,7 +45,7 @@
    * Source of RegExp matching a declarable operator names.
    *
    * The operators that can be declared using `operator` declarations are
-   * also the only ones allowed as symbols. The name of the oeprators is
+   * also the only ones allowed as symbols. The name of the operators is
    * the same as the operator itself except for unary minus, where the name
    * is "unary-".
    */
@@ -114,7 +114,7 @@
 
   external int get hashCode;
 
-  toString() => 'Symbol("$_name")';
+  external toString();
 
   /// Platform-private accessor which cannot be called from user libraries.
   static String getName(Symbol symbol) => symbol._name;
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart
index 73668e9..cb9cdcc 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -114,7 +114,7 @@
  * data into the required format or to prepare it for output.
  *
  * You might want to use a stream to read large files,
- * to manipulate the data with tranformers,
+ * to manipulate the data with transformers,
  * or for compatibility with another API, such as [WebSocket]s.
  *
  *     import 'dart:io';
@@ -586,7 +586,7 @@
    * the bytes will be filled into [buffer] from at index [start], otherwise
    * index 0. If [end] is present, the [end] - [start] bytes will be read into
    * [buffer], otherwise up to [buffer.length]. If [end] == [start] nothing
-   * happends.
+   * happens.
    *
    * Returns a [:Future<int>:] that completes with the number of bytes read.
    */
@@ -597,7 +597,7 @@
    * is present, the bytes will be filled into [buffer] from at index [start],
    * otherwise index 0.  If [end] is present, the [end] - [start] bytes will be
    * read into [buffer], otherwise up to [buffer.length]. If [end] == [start]
-   * nothing happends.
+   * nothing happens.
    *
    * Throws a [FileSystemException] if the operation fails.
    */
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index 5b61fb3..dce4cbc 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -213,7 +213,7 @@
   }
 
   Future<File> close() =>
-      _openFuture.then/*<File>*/((openedFile) => openedFile.close());
+      _openFuture.then<File>((openedFile) => openedFile.close());
 }
 
 
diff --git a/sdk/lib/io/file_system_entity.dart b/sdk/lib/io/file_system_entity.dart
index e0b22da..41bee01 100644
--- a/sdk/lib/io/file_system_entity.dart
+++ b/sdk/lib/io/file_system_entity.dart
@@ -816,7 +816,7 @@
  */
 class FileSystemMoveEvent extends FileSystemEvent {
   /**
-   * If the underlaying implementation is able to identify the destination of
+   * If the underlying implementation is able to identify the destination of
    * the moved file, [destination] will be set. Otherwise, it will be `null`.
    */
   final String destination;
diff --git a/sdk/lib/io/http.dart b/sdk/lib/io/http.dart
index 71eff21..3a7b47d 100644
--- a/sdk/lib/io/http.dart
+++ b/sdk/lib/io/http.dart
@@ -1174,7 +1174,7 @@
    * specified using the [status] argument.
    *
    * This method will also call `close`, and the returned future is
-   * the furure returned by `close`.
+   * the future returned by `close`.
    */
   Future redirect(Uri location, {int status: HttpStatus.MOVED_TEMPORARILY});
 
@@ -1729,7 +1729,7 @@
    * [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for
    * [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and
    * [:HttpStatus.TEMPORARY_REDIRECT:] (307). For
-   * [:HttpStatus.SEE_OTHER:] (303) autmatic redirect will also happen
+   * [:HttpStatus.SEE_OTHER:] (303) automatic redirect will also happen
    * for "POST" requests with the method changed to "GET" when
    * following the redirect.
    *
diff --git a/sdk/lib/io/http_impl.dart b/sdk/lib/io/http_impl.dart
index 96005c95..a965afa 100644
--- a/sdk/lib/io/http_impl.dart
+++ b/sdk/lib/io/http_impl.dart
@@ -764,11 +764,11 @@
       if (response.redirects.length < maxRedirects) {
         // Redirect and drain response.
         future = response.drain()
-            .then/*<HttpClientResponse>*/((_) => response.redirect());
+            .then<HttpClientResponse>((_) => response.redirect());
       } else {
         // End with exception, too many redirects.
         future = response.drain()
-            .then/*<HttpClientResponse>*/((_) {
+            .then<HttpClientResponse>((_) {
           return new Future<HttpClientResponse>.error(
               new RedirectException("Redirect limit exceeded",
                   response.redirects));
@@ -1391,7 +1391,7 @@
     // data).
     _httpParser.isHead = method == "HEAD";
     _streamFuture = outgoing.done
-        .then/*<Socket>*/((Socket s) {
+        .then<Socket>((Socket s) {
           // Request sent, set up response completer.
           _nextResponseCompleter = new Completer();
 
diff --git a/sdk/lib/io/http_parser.dart b/sdk/lib/io/http_parser.dart
index c2b08e4..a52c4b6 100644
--- a/sdk/lib/io/http_parser.dart
+++ b/sdk/lib/io/http_parser.dart
@@ -120,8 +120,8 @@
 
   bool get isPaused => _subscription.isPaused;
 
-  Future/*<T>*/ asFuture/*<T>*/([/*=T*/ futureValue]) =>
-      _subscription.asFuture/*<T>*/(futureValue);
+  Future<T> asFuture<T>([T futureValue]) =>
+      _subscription.asFuture<T>(futureValue);
 
   Future cancel() {
     _isCanceled = true;
diff --git a/sdk/lib/io/io_resource_info.dart b/sdk/lib/io/io_resource_info.dart
index 317cf13..3fb6dc9 100644
--- a/sdk/lib/io/io_resource_info.dart
+++ b/sdk/lib/io/io_resource_info.dart
@@ -51,9 +51,9 @@
     lastRead = _IOResourceInfo.timestamp;
   }
 
-  // In cases where we read but did not neccesarily get any bytes, use this to
+  // In cases where we read but did not necessarily get any bytes, use this to
   // update the readCount and timestamp. Manually update totalRead if any bytes
-  // where acutally read.
+  // where actually read.
   void didRead() { addRead(0); }
 
   void addWrite(int bytes) {
diff --git a/sdk/lib/io/link.dart b/sdk/lib/io/link.dart
index 7c93725..83940b4 100644
--- a/sdk/lib/io/link.dart
+++ b/sdk/lib/io/link.dart
@@ -223,7 +223,7 @@
     // Atomically changing a link can be done by creating the new link, with
     // a different name, and using the rename() posix call to move it to
     // the old name atomically.
-    return delete().then/*<Link>*/((_) => create(target));
+    return delete().then<Link>((_) => create(target));
   }
 
   Future<Link> _delete({bool recursive: false}) {
diff --git a/sdk/lib/io/platform.dart b/sdk/lib/io/platform.dart
index d881ce5..75f7ffd 100644
--- a/sdk/lib/io/platform.dart
+++ b/sdk/lib/io/platform.dart
@@ -120,6 +120,11 @@
   static final bool isIOS = (_operatingSystem == "ios");
 
   /**
+   * Returns true if the operating system is Fuchsia
+   */
+   static final bool isFuchsia = (_operatingSystem == "fuchsia");
+
+  /**
    * Get the environment for this process.
    *
    * The returned environment is an unmodifiable map which content is
diff --git a/sdk/lib/io/platform_impl.dart b/sdk/lib/io/platform_impl.dart
index 8b83fc0..5743b9e 100644
--- a/sdk/lib/io/platform_impl.dart
+++ b/sdk/lib/io/platform_impl.dart
@@ -22,7 +22,7 @@
    * a non-empty name and a value separated by a '=' character.
    * The name does not contain a '=' character,
    * so the name is everything up to the first '=' character.
-   * Values are everything after the first '=' charcacter.
+   * Values are everything after the first '=' character.
    * A value may contain further '=' characters, and it may be empty.
    *
    * Returns an [OSError] if retrieving the environment fails.
@@ -38,7 +38,7 @@
   static String packageRoot = _packageRoot();
   static String packageConfig = _packageConfig();
 
-  // Cache the OS environemnt. This can be an OSError instance if
+  // Cache the OS environment. This can be an OSError instance if
   // retrieving the environment failed.
   static var/*OSError|Map<String,String>*/ _environmentCache;
 
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart
index 6159113..c0781fe 100644
--- a/sdk/lib/io/process.dart
+++ b/sdk/lib/io/process.dart
@@ -229,7 +229,7 @@
    * get the original 32-bit value use `(0x100000000 + exitCode) &
    * 0xffffffff`.
    */
-  Future<int> exitCode;
+  Future<int> get exitCode;
 
   /**
    * Starts a process running the [executable] with the specified
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart
index a2d6d78..a523f20 100644
--- a/sdk/lib/io/secure_socket.dart
+++ b/sdk/lib/io/secure_socket.dart
@@ -75,7 +75,7 @@
        SecurityContext context,
        bool onBadCertificate(X509Certificate certificate)}) {
     return ((socket as dynamic/*_Socket*/)._detachRaw() as Future)
-        .then/*<RawSecureSocket>*/((detachedRaw) {
+        .then<RawSecureSocket>((detachedRaw) {
           return RawSecureSocket.secure(
             detachedRaw[0] as RawSocket,
             subscription: detachedRaw[1] as StreamSubscription<RawSocketEvent>,
@@ -83,7 +83,7 @@
             context: context,
             onBadCertificate: onBadCertificate);
           })
-        .then/*<SecureSocket>*/((raw) => new SecureSocket._(raw));
+        .then<SecureSocket>((raw) => new SecureSocket._(raw));
  }
 
   /**
@@ -115,7 +115,7 @@
        bool requireClientCertificate: false,
        List<String> supportedProtocols}) {
     return ((socket as dynamic/*_Socket*/)._detachRaw() as Future)
-        .then/*<RawSecureSocket>*/((detachedRaw) {
+        .then<RawSecureSocket>((detachedRaw) {
           return RawSecureSocket.secureServer(
             detachedRaw[0] as RawSocket,
             context,
@@ -125,7 +125,7 @@
             requireClientCertificate: requireClientCertificate,
             supportedProtocols: supportedProtocols);
           })
-        .then/*<SecureSocket>*/((raw) => new SecureSocket._(raw));
+        .then<SecureSocket>((raw) => new SecureSocket._(raw));
   }
 
   /**
diff --git a/sdk/lib/io/stdio.dart b/sdk/lib/io/stdio.dart
index 67f4370..2a87848 100644
--- a/sdk/lib/io/stdio.dart
+++ b/sdk/lib/io/stdio.dart
@@ -51,7 +51,7 @@
    *
    * If end-of-file is reached after any bytes have been read from stdin,
    * that data is returned.
-   * Returns `null` if no bytes preceeded the end of input.
+   * Returns `null` if no bytes preceded the end of input.
    */
   String readLineSync({Encoding encoding: SYSTEM_ENCODING,
                        bool retainNewlines: false}) {
@@ -86,7 +86,7 @@
         line.add(byte);
       }
     } else {
-      // Case having to hande CR LF as a single unretained line terminator.
+      // Case having to handel CR LF as a single unretained line terminator.
       outer: while (true) {
         int byte = readByteSync();
         if (byte == LF) break;
@@ -216,6 +216,19 @@
   }
 }
 
+
+class StdinException implements IOException {
+  final String message;
+  final OSError osError;
+
+  const StdinException(this.message, [this.osError]);
+
+  String toString() {
+    return "StdinException: $message${osError == null ? "" : ", $osError"}";
+  }
+}
+
+
 class _StdConsumer implements StreamConsumer<List<int>> {
   final _file;
 
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index 047cf69..aa2a1e5 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -453,7 +453,7 @@
       var deflate = _negotiateCompression(request, response, compression);
 
       response.headers.contentLength = 0;
-      return response.detachSocket().then/*<WebSocket>*/((socket) =>
+      return response.detachSocket().then<WebSocket>((socket) =>
           new _WebSocketImpl._fromSocket(
               socket, protocol, compression, true, deflate));
     }
@@ -465,7 +465,7 @@
       // the lists with ', ' and then tokenize.
       protocols = _HttpParser._tokenizeFieldValue(protocols.join(', '));
       return new Future<String>(() => _protocolSelector(protocols))
-          .then/*<String>*/((protocol) {
+          .then<String>((protocol) {
         if (protocols.indexOf(protocol) < 0) {
           throw new WebSocketException(
               "Selected protocol is not in the list of available protocols");
@@ -476,7 +476,7 @@
           ..statusCode = HttpStatus.INTERNAL_SERVER_ERROR
           ..close();
         throw error;
-      }).then/*<WebSocket>*/(upgrade);
+      }).then<WebSocket>(upgrade);
     } else {
       return upgrade(null);
     }
@@ -1051,7 +1051,7 @@
       _WebSocketPerMessageDeflate deflate =
           negotiateClientCompression(response, compression);
 
-      return response.detachSocket().then/*<WebSocket>*/((socket) =>
+      return response.detachSocket().then<WebSocket>((socket) =>
           new _WebSocketImpl._fromSocket(
               socket, protocol, compression, false, deflate));
     });
diff --git a/sdk/lib/isolate/isolate.dart b/sdk/lib/isolate/isolate.dart
index 77b40c0..b398e53 100644
--- a/sdk/lib/isolate/isolate.dart
+++ b/sdk/lib/isolate/isolate.dart
@@ -50,13 +50,16 @@
  * for example by pausing the isolate or by getting events when the isolate
  * has an uncaught error.
  *
- * The [controlPort] gives access to controlling the isolate, and the
- * [pauseCapability] and [terminateCapability] guard access to some control
- * operations.
+ * The [controlPort] identifies and gives access to controlling the isolate,
+ * and the [pauseCapability] and [terminateCapability] guard access
+ * to some control operations.
+ * For example, calling [pause] on an `Isolate` object created without a
+ * [pauseCapability], has no effect.
+ *
  * The `Isolate` object provided by a spawn operation will have the
  * control port and capabilities needed to control the isolate.
- * New isolates objects can be created without some of these capabilities
- * if necessary.
+ * New isolate objects can be created without some of these capabilities
+ * if necessary, using the [Isolate.Isolate] constructor.
  *
  * An `Isolate` object cannot be sent over a `SendPort`, but the control port
  * and capabilities can be sent, and can be used to create a new functioning
@@ -71,22 +74,26 @@
   /**
    * Control port used to send control messages to the isolate.
    *
-   * This class provides helper functions that sends control messages
-   * to the control port.
-   *
    * The control port identifies the isolate.
+   *
+   * An `Isolate` object allows sending control messages
+   * through the control port.
+   *
+   * Some control messages require a specific capability to be passed along
+   * with the message (see [pauseCapability] and [terminateCapability]),
+   * otherwise the message is ignored by the isolate.
    */
   final SendPort controlPort;
 
   /**
    * Capability granting the ability to pause the isolate.
    *
-   * This capability is used by [pause].
-   * If the capability is not the correct pause capability of the isolate,
-   * including if the capability is `null`, then calls to `pause` will have no
-   * effect.
+   * This capability is required by [pause].
+   * If the capability is `null`, or if it is not the correct pause capability
+   * of the isolate identified by [controlPort],
+   * then calls to [pause] will have no effect.
    *
-   * If the isolate is started in a paused state, use this capability as
+   * If the isolate is spawned in a paused state, use this capability as
    * argument to [resume] to resume the isolate.
    */
   final Capability pauseCapability;
@@ -94,10 +101,10 @@
   /**
    * Capability granting the ability to terminate the isolate.
    *
-   * This capability is used by [kill] and [setErrorsFatal].
-   * If the capability is not the correct termination capability of the isolate,
-   * including if the capability is `null`, then calls to those methods will
-   * have no effect.
+   * This capability is required by [kill] and [setErrorsFatal].
+   * If the capability is `null`, or if it is not the correct termination
+   * capability of the isolate identified by [controlPort],
+   * then calls to those methods will have no effect.
    */
   final Capability terminateCapability;
 
@@ -113,20 +120,35 @@
    * anywhere else, so the capabilities should come from the same isolate as
    * the control port.
    *
-   * If all the available capabilities are included,
-   * there is no reason to create a new object,
-   * since the behavior is defined entirely
-   * by the control port and capabilities.
+   * Can also be used to create an [Isolate] object from a control port, and
+   * any available capabilities, that have been sent through a [SendPort].
+   *
+   * Example:
+   * ```dart
+   * Isolate isolate = findSomeIsolate();
+   * Isolate restrictedIsolate = new Isolate(isolate.controlPort);
+   * untrustedCode(restrictedIsolate);
+   * ```
+   * This example creates a new `Isolate` object that cannot be used to
+   * pause or terminate the isolate. All the untrusted code can do is to
+   * inspect the isolate and see uncaught errors or when it terminates.
    */
   Isolate(this.controlPort, {this.pauseCapability,
                              this.terminateCapability});
 
   /**
-   * Return the current [Isolate].
+   * Return an [Isolate] object representing the current isolate.
    *
-   * The isolate gives access to the capabilities needed to inspect,
+   * The current isolate for code using [current]
+   * is the isolate running the code.
+   *
+   * The isolate object provides the capabilities required to inspect,
    * pause or kill the isolate, and allows granting these capabilities
    * to others.
+   *
+   * It is possible to pause the current isolate, but doing so *without*
+   * first passing the ability to resume it again to another isolate,
+   * is a sure way to hang your program.
    */
   external static Isolate get current;
 
@@ -305,17 +327,18 @@
    * When the isolate receives the pause command, it stops
    * processing events from the event loop queue.
    * It may still add new events to the queue in response to, e.g., timers
-   * or receive-port messages. When the isolate is resumed, it handles
-   * the already enqueued events.
+   * or receive-port messages. When the isolate is resumed,
+   * it starts handling the already enqueued events.
    *
    * The pause request is sent through the isolate's command port,
    * which bypasses the receiving isolate's event loop.
    * The pause takes effect when it is received, pausing the event loop
    * as it is at that time.
    *
-   * If [resumeCapability] is provided, it is used to identity the pause,
+   * The [resumeCapability] is used to identity the pause,
    * and must be used again to end the pause using [resume].
-   * Otherwise a new resume capability is created and returned.
+   * If [resumeCapability] is omitted, a new capability object is created
+   * and used instead.
    *
    * If an isolate is paused more than once using the same capability,
    * only one resume with that capability is needed to end the pause.
@@ -324,6 +347,12 @@
    * each pause must be individually ended before the isolate resumes.
    *
    * Returns the capability that must be used to end the pause.
+   * This is either [resumeCapability], or a new capability when
+   * [resumeCapability] is omitted.
+   *
+   * If [pauseCapability] is `null`, or it's not the pause capability
+   * of the isolate identified by [controlPort],
+   * the pause request is ignored by the receiving isolate.
    */
   Capability pause([Capability resumeCapability]) {
     resumeCapability ??= new Capability();
@@ -338,13 +367,14 @@
    * Resumes a paused isolate.
    *
    * Sends a message to an isolate requesting that it ends a pause
-   * that was requested using the [resumeCapability].
+   * that was previously requested.
    *
    * When all active pause requests have been cancelled, the isolate
    * will continue processing events and handling normal messages.
    *
-   * The capability must be one returned by a call to [pause] on this
-   * isolate, otherwise the resume call does nothing.
+   * If the [resumeCapability] is not one that has previously been used
+   * to pause the isolate, or it has already been used to resume from
+   * that pause, the resume call has no effect.
    */
   external void resume(Capability resumeCapability);
 
@@ -359,7 +389,9 @@
    * message, using the last response value that was added.
    *
    * If the isolate is already dead, no message will be sent.
-   * If `response` cannot be sent to the isolate, then the request is ignored.
+   *
+   * The [response] object must follow the same restrictions as enforced by
+   * [SendPort.send].
    * It is recommended to only use simple values that can be sent to all
    * isolates, like `null`, booleans, numbers or strings.
    *
@@ -393,7 +425,7 @@
    * event loop and shut down the isolate.
    *
    * This call requires the [terminateCapability] for the isolate.
-   * If the capability is not correct, no change is made.
+   * If the capability absent or wrong, no change is made.
    *
    * Since isolates run concurrently, it's possible for it to exit due to an
    * error before errors are set non-fatal.
@@ -409,7 +441,8 @@
    * The isolate is requested to terminate itself.
    * The [priority] argument specifies when this must happen.
    *
-   * The [priority] must be one of [IMMEDIATE] or [BEFORE_NEXT_EVENT].
+   * The [priority], when provided, must be one of [IMMEDIATE] or
+   * [BEFORE_NEXT_EVENT] (the default).
    * The shutdown is performed at different times depending on the priority:
    *
    * * `IMMEDIATE`: The isolate shuts down as soon as possible.
@@ -423,12 +456,21 @@
    *     control returns to the event loop of the receiving isolate,
    *     after the current event, and any already scheduled control events,
    *     are completed.
+   *
+   * If [terminateCapability] is `null`, or it's not the terminate capability
+   * of the isolate identified by [controlPort],
+   * the kill request is ignored by the receiving isolate.
    */
   external void kill({int priority: BEFORE_NEXT_EVENT});
 
   /**
    * Request that the isolate send [response] on the [responsePort].
    *
+   * The [response] object must follow the same restrictions as enforced by
+   * [SendPort.send].
+   * It is recommended to only use simple values that can be sent to all
+   * isolates, like `null`, booleans, numbers or strings.
+   *
    * If the isolate is alive, it will eventually send `response`
    * (defaulting to `null`) on the response port.
    *
@@ -443,10 +485,6 @@
    *     control returns to the event loop of the receiving isolate,
    *     after the current event, and any already scheduled control events,
    *     are completed.
-   *
-   * If `response` cannot be sent to the isolate, then the request is ignored.
-   * It is recommended to only use simple values that can be sent to all
-   * isolates, like `null`, booleans, numbers or strings.
    */
   external void ping(SendPort responsePort, {Object response,
                                              int priority: IMMEDIATE});
diff --git a/sdk/lib/js/dart2js/js_dart2js.dart b/sdk/lib/js/dart2js/js_dart2js.dart
index b08f7ac..fd612c0 100644
--- a/sdk/lib/js/dart2js/js_dart2js.dart
+++ b/sdk/lib/js/dart2js/js_dart2js.dart
@@ -629,7 +629,7 @@
   }
 }
 
-JsObject _wrapToDart(o) {
+Object _wrapToDart(o) {
   if (JS('bool', 'typeof # == "function"', o)) {
     return _getDartProxy(
         o, DART_CLOSURE_PROPERTY_NAME, (o) => new JsFunction._fromJs(o));
diff --git a/sdk/lib/math/math.dart b/sdk/lib/math/math.dart
index 73768c9..46fe338 100644
--- a/sdk/lib/math/math.dart
+++ b/sdk/lib/math/math.dart
@@ -67,7 +67,7 @@
   * same mathematical value) then it is unspecified which of the two arguments
   * is returned.
   */
-num/*=T*/ min/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) {
+T min<T extends num>(T a, T b) {
   // These partially redundant type checks improve code quality for dart2js.
   // Most of the improvement is at call sites from the inferred non-null num
   // return type.
@@ -102,7 +102,7 @@
   * otherwise equal (including int and doubles with the same mathematical value)
   * then it is unspecified which of the two arguments is returned.
   */
-num/*=T*/ max/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) {
+T max<T extends num>(T a, T b) {
   // These partially redundant type checks improve code quality for dart2js.
   // Most of the improvement is at call sites from the inferred non-null num
   // return type.
diff --git a/sdk/lib/math/rectangle.dart b/sdk/lib/math/rectangle.dart
index 6fe2075..66a2fc3 100644
--- a/sdk/lib/math/rectangle.dart
+++ b/sdk/lib/math/rectangle.dart
@@ -15,7 +15,7 @@
  *
  * The rectangle is the set of points with representable coordinates greater
  * than or equal to left/top, and with distance to left/top no greater than
- * width/height (to the limit of the precission of the coordinates).
+ * width/height (to the limit of the precision of the coordinates).
  */
 abstract class _RectangleBase<T extends num> {
   const _RectangleBase();
@@ -209,8 +209,8 @@
    * point `(left, top)`.
    */
   MutableRectangle(this.left, this.top, T width, T height)
-      : this._width = (width < 0) ? _clampToZero/*<T>*/(width) : width,
-        this._height = (height < 0) ? _clampToZero/*<T>*/(height) : height;
+      : this._width = (width < 0) ? _clampToZero<T>(width) : width,
+        this._height = (height < 0) ? _clampToZero<T>(height) : height;
 
   /**
    * Create a mutable rectangle spanned by the points [a] and [b];
@@ -244,7 +244,7 @@
    * but will not change [left].
    */
   void set width(T width) {
-    if (width < 0) width = _clampToZero/*<T>*/(width);
+    if (width < 0) width = _clampToZero<T>(width);
     _width = width;
   }
 
@@ -260,7 +260,7 @@
    * but will not change [top].
    */
   void set height(T height) {
-    if (height < 0) height = _clampToZero/*<T>*/(height);
+    if (height < 0) height = _clampToZero<T>(height);
     _height = height;
   }
 }
@@ -270,7 +270,7 @@
  *
  * Returns `0` if value is int, `0.0` if value is double.
  */
-num/*=T*/ _clampToZero/*<T extends num>*/(num/*=T*/ value) {
+T _clampToZero<T extends num>(T value) {
   assert(value < 0);
   return -value * 0;
 }
diff --git a/sdk/lib/mirrors/mirrors.dart b/sdk/lib/mirrors/mirrors.dart
index 206410a..4cfbf19 100644
--- a/sdk/lib/mirrors/mirrors.dart
+++ b/sdk/lib/mirrors/mirrors.dart
@@ -87,10 +87,7 @@
    *
    * If no unique library exists, an error is thrown.
    */
-  LibraryMirror findLibrary(Symbol libraryName) {
-    return libraries.values.singleWhere(
-        (library) => library.simpleName == libraryName);
-  }
+  external LibraryMirror findLibrary(Symbol libraryName);
 
   /**
    * A mirror on the isolate associated with this [MirrorSystem].
@@ -174,11 +171,16 @@
  * If [key] is not an instance of [Type], then this function throws an
  * [ArgumentError].
  *
+ * Optionally takes a list of [typeArguments] for generic classes. If the list
+ * is provided, then the [key] must be a generic class type, and the number of
+ * the provided type arguments must be equal to the number of type variables 
+ * declared by the class.
+ *
  * Note that since one cannot obtain a [Type] object from another isolate, this
  * function can only be used to obtain type mirrors on types of the current
  * isolate.
  */
-external TypeMirror reflectType(Type key);
+external TypeMirror reflectType(Type key, [List<Type> typeArguments]);
 
 /**
  * A [Mirror] reflects some Dart language entity.
@@ -1232,7 +1234,7 @@
  * see the comments for [symbols], [targets], [metaTargets] and [override].
  *
  * An import of `dart:mirrors` may have multiple [MirrorsUsed] annotations. This
- * is particularly helpful to specify overrides for specific libraries. For 
+ * is particularly helpful to specify overrides for specific libraries. For
  * example:
  *
  *     @MirrorsUsed(targets: 'foo.Bar', override: 'foo')
@@ -1244,7 +1246,7 @@
  */
 class MirrorsUsed {
   // Note: the fields of this class are untyped.  This is because the most
-  // convenient way to specify symbols today is using a single string. In 
+  // convenient way to specify symbols today is using a single string. In
   // some cases, a const list of classes might be convenient. Some
   // might prefer to use a const list of symbols.
 
@@ -1261,7 +1263,7 @@
    *
    * Dart2js currently supports the following formats to specify symbols:
    *
-   * * A constant [List] of [String] constants representing symbol names, 
+   * * A constant [List] of [String] constants representing symbol names,
    *   e.g., `const ['foo', 'bar']`.
    * * A single [String] constant whose value is a comma-separated list of
    *   symbol names, e.g., `"foo, bar"`.
@@ -1309,14 +1311,14 @@
    * 1. If the qualified name matches a library name, the matching library is
    *    the target.
    * 2. Else, find the longest prefix of the name such that the prefix ends
-   *    just before a `.` and is a library name. 
+   *    just before a `.` and is a library name.
    * 3. Use that library as current scope. If no matching prefix was found, use
-   *    the current library, i.e., the library where the [MirrorsUsed] 
+   *    the current library, i.e., the library where the [MirrorsUsed]
    *    annotation was placed.
    * 4. Split the remaining suffix (the entire name if no library name was
-   *    found in step 3) into a list of [String] using `.` as a 
+   *    found in step 3) into a list of [String] using `.` as a
    *    separator.
-   * 5. Select all targets in the current scope whose name matches a [String] 
+   * 5. Select all targets in the current scope whose name matches a [String]
    *    from the list.
    *
    * For example:
@@ -1332,11 +1334,11 @@
    *     @MirrorsUsed(targets: "my.library.one.A.aField")
    *     import "dart:mirrors";
    *
-   * The [MirrorsUsed] annotation specifies `A` and `aField` from library 
+   * The [MirrorsUsed] annotation specifies `A` and `aField` from library
    * `my.library.one` as targets. This will mark the class `A` as a reflective
    * target. The target specification for `aField` has no effect, as there is
-   * no target in `my.library.one` with that name. 
-   * 
+   * no target in `my.library.one` with that name.
+   *
    * Note that everything within a target also is available for reflection.
    * So, if a library is specified as target, all classes in that library
    * become targets for reflection. Likewise, if a class is a target, all
@@ -1358,9 +1360,9 @@
    * effect. In particular, adding a library to [metaTargets] does not make
    * the library's classes valid metadata annotations to enable reflection.
    *
-   * If an instance of a class specified in [metaTargets] is used as 
+   * If an instance of a class specified in [metaTargets] is used as
    * metadata annotation on a library, class, field or method, that library,
-   * class, field or  method is added to the set of targets for reflection. 
+   * class, field or  method is added to the set of targets for reflection.
    *
    * Example usage:
    *
@@ -1380,10 +1382,10 @@
    *     }
    *
    * In the above example. `reflectableMethod` is marked as reflectable by
-   * using the `Reflectable` class, which in turn is specified in the 
+   * using the `Reflectable` class, which in turn is specified in the
    * [metaTargets] annotation.
    *
-   * The method `nonReflectableMethod` lacks a metadata annotation and thus 
+   * The method `nonReflectableMethod` lacks a metadata annotation and thus
    * will not be reflectable at runtime.
    */
   final metaTargets;
@@ -1393,7 +1395,7 @@
    *
    * When used as metadata on an import of "dart:mirrors", this metadata does
    * not apply to the library in which the annotation is used, but instead
-   * applies to the other libraries (all libraries if "*" is used). 
+   * applies to the other libraries (all libraries if "*" is used).
    *
    * The following text is non-normative:
    *
@@ -1403,31 +1405,31 @@
    *   libraries.
    * * A single [String] constant whose value is a comma-separated list of
    *   library names.
-   * 
-   * Conceptually, a [MirrorsUsed] annotation with [override] has the same 
+   *
+   * Conceptually, a [MirrorsUsed] annotation with [override] has the same
    * effect as placing the annotation directly on the import of `dart:mirrors`
-   * in each of the referenced libraries. Thus, if the library had no 
-   * [MirrorsUsed] annotation before, its unconditional import of 
+   * in each of the referenced libraries. Thus, if the library had no
+   * [MirrorsUsed] annotation before, its unconditional import of
    * `dart:mirrors` is overridden by an annotated import.
-   * 
+   *
    * Note that, like multiple explicit [MirrorsUsed] annotations, using
    * override on a library with an existing [MirrorsUsed] annotation is
    * additive. That is, the overall set of reflective targets is the union
    * of the reflective targets that arise from the original and the
-   * overriding [MirrorsUsed] annotations. 
+   * overriding [MirrorsUsed] annotations.
    *
-   * The use of [override] is only meaningful for libraries that have an 
+   * The use of [override] is only meaningful for libraries that have an
    * import of `dart:mirrors` without annotation because otherwise it would
    * work exactly the same way without the [override] parameter.
    *
    * While the annotation will apply to the given target libraries, the
-   * [symbols], [targets] and [metaTargets] are still evaluated in the 
+   * [symbols], [targets] and [metaTargets] are still evaluated in the
    * scope of the annotation. Thus, to select a target from library `foo`,
    * a qualified name has to be used or, if the target is visible in the
    * current scope, its type may be referenced.
-   * 
+   *
    * For example, the following code marks all targets in the library `foo`
-   * as reflectable that have a metadata annotation using the `Reflectable` 
+   * as reflectable that have a metadata annotation using the `Reflectable`
    * class from the same library.
    *
    *     @MirrorsUsed(metaTargets: "foo.Reflectable", override: "foo")
@@ -1441,8 +1443,8 @@
   final override;
 
   /**
-   * See the documentation for [MirrorsUsed.symbols], [MirrorsUsed.targets], 
-   * [MirrorsUsed.metaTargets] and [MirrorsUsed.override] for documentation 
+   * See the documentation for [MirrorsUsed.symbols], [MirrorsUsed.targets],
+   * [MirrorsUsed.metaTargets] and [MirrorsUsed.override] for documentation
    * of the parameters.
    */
   const MirrorsUsed(
diff --git a/sdk/lib/vmservice/asset.dart b/sdk/lib/vmservice/asset.dart
index b8f6c20..db0d978 100644
--- a/sdk/lib/vmservice/asset.dart
+++ b/sdk/lib/vmservice/asset.dart
@@ -38,23 +38,7 @@
   }
 
   /// Call to request assets from the embedder.
-  static HashMap<String, Asset> request() {
-    HashMap<String, Asset> assets = new HashMap<String, Asset>();
-    Uint8List tarBytes = _requestAssets();
-    if (tarBytes == null) {
-      return assets;
-    }
-    _TarArchive archive = new _TarArchive(tarBytes);
-    while (archive.hasNext()) {
-      Asset asset = archive.next();
-      if (asset == null) {
-        // Skip over special files.
-        continue;
-      }
-      assets[asset.name] = asset;
-    }
-    return assets;
-  }
+  external static HashMap<String, Asset> request();
 
   String toString() => '$name ($mimeType)';
 }
diff --git a/tests/benchmark_smoke/benchmark_smoke.status b/tests/benchmark_smoke/benchmark_smoke.status
index 056911f..de17765 100644
--- a/tests/benchmark_smoke/benchmark_smoke.status
+++ b/tests/benchmark_smoke/benchmark_smoke.status
@@ -2,7 +2,7 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 *: Skip
 
 [ $compiler == dart2js && $runtime == none ]
diff --git a/tests/co19/co19-analyzer2.status b/tests/co19/co19-analyzer2.status
index 990fb9c..618fb0e 100644
--- a/tests/co19/co19-analyzer2.status
+++ b/tests/co19/co19-analyzer2.status
@@ -4,21 +4,12 @@
 
 [ $compiler == dart2analyzer ]
 
-Language/Functions/Formal_Parameters/syntax_t05: StaticWarning # Issue 26644
 Language/Classes/Classes/method_definition_t06: MissingStaticWarning # Please triage this failure.
 Language/Classes/Getters/static_getter_t02: CompileTimeError # Issue 24534
 Language/Classes/Getters/static_t01: StaticWarning # Please triage this failure.
 Language/Classes/Getters/type_object_t01: StaticWarning # Please triage this failure.
 Language/Classes/Getters/type_object_t02: StaticWarning # Please triage this failure.
 Language/Classes/Instance_Variables/definition_t03: StaticWarning # Please triage this failure.
-Language/Classes/Setters/name_t08: CompileTimeError # Issue 23777
-Language/Classes/Setters/name_t09: CompileTimeError # Issue 23777
-Language/Classes/Setters/name_t10: CompileTimeError # Issue 23777
-Language/Classes/Setters/name_t11: CompileTimeError # Issue 23777
-Language/Classes/Setters/name_t12: CompileTimeError # Issue 23777
-Language/Classes/Setters/name_t13: CompileTimeError # Issue 23777
-Language/Classes/Setters/name_t14: CompileTimeError # Issue 23777
-Language/Classes/Setters/name_t15: CompileTimeError # Issue 23777
 Language/Classes/Setters/type_object_t01: StaticWarning # Please triage this failure.
 Language/Classes/Setters/type_object_t02: StaticWarning # Please triage this failure.
 Language/Classes/Static_Methods/same_name_method_and_setter_t01: MissingStaticWarning # Please triage this failure.
@@ -76,83 +67,6 @@
 Language/Expressions/Method_Invocation/Super_Invocation/accessible_instance_member_t03: StaticWarning # Please triage this failure.
 Language/Expressions/Method_Invocation/Super_Invocation/accessible_instance_member_t04: StaticWarning # Please triage this failure.
 Language/Expressions/Method_Invocation/Super_Invocation/accessible_instance_member_t05: StaticWarning # Please triage this failure.
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t01: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t02: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t03: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/named_parameters_t01: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/positional_parameters_t01: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t01: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t02: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t03: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t01: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t02: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t03: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t04: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t05: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t06: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t07: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t08: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t09: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t01: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t02: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t03: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t04: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t05: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t06: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t07: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t01: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t02: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t03: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t04: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t05: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t06: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t07: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t08: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t01: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t02: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t03: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t04: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t05: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t06: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t07: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t08: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t09: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t01: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t02: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t03: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t04: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t05: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t06: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t07: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/General_Super_Property_Extraction: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t01: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t02: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t03: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t04: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t05: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t06: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t07: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t08: MissingCompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/expression_evaluation_t07: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/no_such_method_t01: StaticWarning # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/proxy_annotation_t05: StaticWarning # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/proxy_annotation_t06: StaticWarning # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/proxy_annotation_t07: StaticWarning # Please triage this failure.
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/proxy_annotation_t08: StaticWarning # Please triage this failure.
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t01: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t02: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/named_parameters_t01: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/positional_parameters_t01: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/deferred_type_t01: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malformed_type_t01: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malformed_type_t02: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t01: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t02: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t03: CompileTimeError # Please triage this failure.
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization: CompileTimeError # Issue 23777
-Language/Expressions/Property_Extraction/Super_Closurization: CompileTimeError # Issue 23777
 Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/inheritance_t03: StaticWarning # Please triage this failure.
 Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t01: CompileTimeError # Please triage this failure.
 Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t02: CompileTimeError # Please triage this failure.
@@ -182,8 +96,9 @@
 Language/Mixins/Mixin_Application/warning_t02: MissingStaticWarning # Please triage this failure.
 Language/Mixins/declaring_constructor_t05: MissingCompileTimeError # Issue 24767
 Language/Mixins/declaring_constructor_t06: MissingCompileTimeError # Issue 24767
-Language/Statements/Assert/type_t04: MissingStaticWarning
-Language/Statements/Switch/last_statement_t03: MissingStaticWarning
+Language/Statements/Assert/syntax_t04: MissingCompileTimeError # Assert messages are enabled by default
+Language/Statements/Assert/type_t04: MissingStaticWarning # Please triage this failure
+Language/Statements/Switch/last_statement_t03: MissingStaticWarning # Please triage this failure
 Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t01: MissingCompileTimeError # Issue 25495
 Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t03: MissingCompileTimeError # Issue 25495
 Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t05: MissingCompileTimeError # Issue 25495
diff --git a/tests/co19/co19-co19.status b/tests/co19/co19-co19.status
index 957c549..8a8254d 100644
--- a/tests/co19/co19-co19.status
+++ b/tests/co19/co19-co19.status
@@ -14,6 +14,7 @@
 [ $runtime == vm || $runtime != vm ]
 # Tests that fail everywhere, including the analyzer.
 
+Language/Statements/Assert/syntax_t04: Pass, Fail # assert now has an optional second parameter.
 LibTest/typed_data/ByteData/buffer_A01_t01: Fail # co19 r736 bug - sent comment.
 LibTest/core/RegExp/firstMatch_A01_t01: Fail # co19 issue 742
 
@@ -67,8 +68,3 @@
 
 [ $runtime == dartium || $compiler == dart2js ]
 LibTest/async/Future/Future.delayed_A01_t02: Pass, Fail # Issue 15524
-
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && ($runtime == vm || $runtime == drt || $runtime == dart_precompiled || $runtime == dart_app) ]
-# Optional trailing commas for argument and parameter lists added to language.
-# https://github.com/dart-lang/co19/issues/68
-Language/Functions/Formal_Parameters/syntax_t05: Fail, OK
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index ba7e90e..491c274 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -3,7 +3,6 @@
 # BSD-style license that can be found in the LICENSE file.
 
 [ $compiler == dart2js ]
-Language/Functions/Formal_Parameters/syntax_t05: RuntimeError # Issue 26644
 
 Language/Classes/Constructors/Generative_Constructors/execution_of_a_superinitializer_t01: RuntimeError # compiler cancelled: cannot resolve type T
 Language/Classes/Constructors/Generative_Constructors/execution_of_a_superinitializer_t01: RuntimeError, OK # co19 issue 258
@@ -17,14 +16,6 @@
 Language/Classes/Setters/name_t02: CompileTimeError # Issue 5023
 Language/Classes/Setters/name_t03: RuntimeError # Issue 5023
 Language/Classes/Setters/name_t07: CompileTimeError # Issue 5023
-Language/Classes/Setters/name_t08: CompileTimeError # Please triage this failure
-Language/Classes/Setters/name_t09: CompileTimeError # Please triage this failure
-Language/Classes/Setters/name_t10: CompileTimeError # Please triage this failure
-Language/Classes/Setters/name_t11: CompileTimeError # Please triage this failure
-Language/Classes/Setters/name_t12: CompileTimeError # Please triage this failure
-Language/Classes/Setters/name_t13: CompileTimeError # Please triage this failure
-Language/Classes/Setters/name_t14: CompileTimeError # Please triage this failure
-Language/Classes/Setters/name_t15: CompileTimeError # Please triage this failure
 Language/Classes/Setters/static_setter_t06: RuntimeError  # Please triage this failure
 Language/Classes/Setters/type_object_t01: RuntimeError # Please triage this failure
 Language/Classes/Setters/type_object_t02: RuntimeError # Please triage this failure
@@ -89,146 +80,6 @@
 Language/Expressions/Object_Identity/double_t02: RuntimeError # Please triage this failure
 Language/Expressions/Object_Identity/double_t03: RuntimeError # Please triage this failure
 Language/Expressions/Object_Identity/object_t02: RuntimeError # Issue 1533 (int/double related)
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t01: CompileTimeError # Issue 24607
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t02: CompileTimeError # Issue 24607
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/named_parameters_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/positional_parameters_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/closurization_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/closurization_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/closurization_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/deferred_type_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malbounded_type_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malbounded_type_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malformed_type_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malformed_type_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/no_such_method_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/no_such_method_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/not_class_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/not_class_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/not_class_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/static_type_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/static_type_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/static_type_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t04: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t05: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t06: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t07: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t08: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t09: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t04: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t05: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t06: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t07: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t04: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t05: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t06: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t07: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t08: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t04: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t05: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t06: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t07: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t08: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t09: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t04: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t05: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t06: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t07: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Super_Property_Extraction: CompileTimeError # Issue 26287
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t01: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t02: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t03: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t04: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t05: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t06: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t07: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t08: MissingCompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/expression_evaluation_t07: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/no_such_method_t01: RuntimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/named_parameters_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/positional_parameters_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/closurization_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/closurization_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/deferred_type_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malbounded_type_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malbounded_type_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malformed_type_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malformed_type_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/no_such_method_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/no_such_method_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t04: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t04: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t05: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t06: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t07: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t08: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_named_params_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_named_params_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_positional_params_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_positional_params_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_identical_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_identical_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_identical_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_list_access_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_list_assignment_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t04: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t05: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t06: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t07: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t08: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t09: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t10: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t11: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t12: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t13: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t14: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t15: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t16: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t17: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_unary_bitwise_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t01: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t03: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t04: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t05: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t06: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t07: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t08: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Super_Closurization: CompileTimeError # Issue 26287
-Language/Expressions/Property_Extraction/Super_Getter_Access_and_Method_Closurization/no_such_method_t01: RuntimeError # Please triage this failure
 Language/Expressions/Shift/syntax_t01/14: MissingRuntimeError # Please triage this failure
 Language/Functions/External_Functions/not_connected_to_a_body_t01: CompileTimeError, OK # Issue 5021
 Language/Generics/syntax_t17: fail # Issue 21203
@@ -266,6 +117,7 @@
 Language/Reference/Lexical_Rules/Reserved_Words/whitespace_t04: MissingCompileTimeError # Checks that other Unicode whitespaces are not allowed:  check NO-BREAK SPACE (U+00A0)
 Language/Reference/Lexical_Rules/whitespace_t06: MissingCompileTimeError # Checks that Unicode whitespaces other than WHITESPACE are not permitted in the source code. Checks symbol U+00a0.
 Language/Reference/Operator_Precedence/precedence_15_unary_prefix_t08: RuntimeError # Please triage this failure
+Language/Statements/Assert/syntax_t04: MissingCompileTimeError # This is legal Dart
 Language/Statements/Continue/async_loops_t09: Crash # Please triage this failure
 Language/Statements/Local_Function_Declaration/reference_before_declaration_t01: MissingCompileTimeError # Issue 21050
 Language/Statements/Local_Function_Declaration/reference_before_declaration_t03: MissingCompileTimeError # Issue 21050
@@ -471,11 +323,11 @@
 Language/Expressions/Function_Expressions/static_type_form_3_syncs_t03: RuntimeError # Please triage this failure
 Language/Expressions/If_null_Expressions/static_type_t01: RuntimeError # Please triage this failure
 Language/Expressions/If_null_Expressions/static_type_t02: RuntimeError # Please triage this failure
-Language/Expressions/Property_Extraction/General_Super_Property_Extraction/getter_lookup_t02: CompileTimeError # Please triage this failure
-Language/Expressions/Property_Extraction/Super_Closurization/setter_closurization_t09: Timeout, Skip  # Please triage this failure
 Language/Functions/async_return_type_t01: RuntimeError # Please triage this failure
 Language/Functions/generator_return_type_t01: RuntimeError # Please triage this failure
 Language/Functions/generator_return_type_t02: RuntimeError # Please triage this failure
+Language/Statements/Assert/execution_t03: RuntimeError # Please triage this failure
+Language/Statements/Assert/execution_t11: RuntimeError # Please triage this failure
 Language/Statements/Switch/execution_t01: Fail # Missing type check in switch expression
 Language/Statements/Switch/type_t01: RuntimeError # Issue 16089
 Language/Statements/Return/runtime_type_t04: RuntimeError # Issue 26584
@@ -483,11 +335,14 @@
 Language/Types/Dynamic_Type_System/malbounded_type_error_t01: RuntimeError # Issue 21088
 Language/Types/Parameterized_Types/malbounded_t06: RuntimeError # Issue 21088
 LibTest/collection/DoubleLinkedQueue/DoubleLinkedQueue_class_A01_t01: Skip # Timesout. Please triage this failure.
-LibTest/core/Map/Map_class_A01_t04: Slow, Pass
-LibTest/core/Uri/Uri_A06_t03: Slow, Pass
+LibTest/core/Map/Map_class_A01_t04: Slow, Pass # Please triage this failure
+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 && $runtime != d8]
+LayoutTests/fast/canvas/webgl/framebuffer-object-attachment_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/canvas/webgl/read-pixels-test_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/inline/empty-inline-before-collapsed-space_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/parser/pre-first-line-break_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/url/trivial_t01: RuntimeError # Please triage this failure
@@ -666,10 +521,6 @@
 WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/test-005_t01: Fail # please triage
 WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/test-007_t01: Fail # please triage
 
-[ $compiler == dart2js && $checked != true ]
-Language/Expressions/Property_Extraction/General_Super_Property_Extraction/getter_lookup_t02: Timeout, Skip # Please triage this failure
-Language/Expressions/Property_Extraction/Super_Closurization/setter_closurization_t09: CompileTimeError # Please triage this failure
-
 [ $compiler == dart2js && $checked != true && $runtime != d8 && $runtime != jsshell]
 LayoutTests/fast/xpath/invalid-resolver_t01: RuntimeError # Please triage this failure
 
@@ -765,23 +616,17 @@
 LibTest/isolate/ReceivePort/asBroadcastStream_A03_t01: RuntimeError # Issue 7728, timer not supported in jsshell
 LibTest/isolate/ReceivePort/asBroadcastStream_A04_t03: RuntimeError # Issue 7728, timer not supported in jsshell
 LibTest/isolate/ReceivePort/close_A01_t01: RuntimeError # Issue 7728, timer not supported in jsshell
-LibTest/typed_data/Float32List/Float32List.view_A06_t01: fail # co19-roll r587: Please triage this failure
 LibTest/typed_data/Float32List/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
 LibTest/typed_data/Float32x4List/Float32x4List.view_A06_t01: fail # co19-roll r587: Please triage this failure
-LibTest/typed_data/Float64List/Float64List.view_A06_t01: fail # co19-roll r587: Please triage this failure
 LibTest/typed_data/Float64List/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
-LibTest/typed_data/Int16List/Int16List.view_A06_t01: fail # co19-roll r587: Please triage this failure
 LibTest/typed_data/Int16List/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
 LibTest/typed_data/Int16List/toList_A01_t01: fail # co19-roll r559: Please triage this failure
-LibTest/typed_data/Int32List/Int32List.view_A06_t01: fail # co19-roll r587: Please triage this failure
 LibTest/typed_data/Int32List/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
 LibTest/typed_data/Int32List/toList_A01_t01: fail # co19-roll r559: Please triage this failure
 LibTest/typed_data/Int32x4/operator_OR_A01_t01: RuntimeError # Issue 7728, timer not supported in jsshell
 LibTest/typed_data/Int8List/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
-LibTest/typed_data/Uint16List/Uint16List.view_A06_t01: fail # co19-roll r587: Please triage this failure
 LibTest/typed_data/Uint16List/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
 LibTest/typed_data/Uint16List/toList_A01_t01: fail # co19-roll r559: Please triage this failure
-LibTest/typed_data/Uint32List/Uint32List.view_A06_t01: fail # co19-roll r587: Please triage this failure
 LibTest/typed_data/Uint32List/toList_A01_t01: Skip # issue 16934, co19-roll r559: Please triage this failure
 LibTest/typed_data/Uint8ClampedList/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
 LibTest/typed_data/Uint8List/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
@@ -1002,6 +847,8 @@
 LayoutTests/fast/canvas/webgl/buffer-data-array-buffer_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias-t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/context-lost-restored_t01: Pass, Timeout # Please triage this failure
+LayoutTests/fast/canvas/webgl/gl-get-calls_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/canvas/webgl/object-deletion-behaviour_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/oes-vertex-array-object_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-rgb565_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-rgba4444_t01: RuntimeError # Please triage this failure
@@ -1097,7 +944,6 @@
 LayoutTests/fast/css/getComputedStyle/computed-style-border-image_t01: RuntimeError # co19 issue 14
 LayoutTests/fast/css/getComputedStyle/computed-style-cross-fade_t01: RuntimeError # co19 issue 14
 LayoutTests/fast/css/getComputedStyle/font-family-fallback-reset_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/css/getComputedStyle/getComputedStyle-zIndex-auto_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/css/getPropertyValue-border_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/css/html-attr-case-sensitivity_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/css/id-or-class-before-stylesheet_t01: RuntimeError # Please triage this failure
@@ -1168,6 +1014,7 @@
 LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-protocol_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-search_t01: Pass, RuntimeError # Please triage this failure
 LayoutTests/fast/dom/HTMLDialogElement/dialog-autofocus_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/dom/HTMLDialogElement/dialog-close-event_t01: RuntimeError
 LayoutTests/fast/dom/HTMLDialogElement/dialog-scrolled-viewport_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unfocusable_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/HTMLDialogElement/inert-node-is-unselectable_t01: RuntimeError # Please triage this failure
@@ -1205,6 +1052,7 @@
 LayoutTests/fast/dom/HTMLTemplateElement/innerHTML_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/HTMLTemplateElement/ownerDocumentXHTML_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/MutationObserver/observe-childList_t01: RuntimeError # Issue 18253
+LayoutTests/fast/dom/MutationObserver/removed-out-of-order_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/MutationObserver/weak-callback-gc-crash_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/Node/fragment-mutation_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/Node/initial-values_t01: RuntimeError # Please triage this failure
@@ -1262,6 +1110,7 @@
 LayoutTests/fast/dom/partial-layout-overlay-scrollbars_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/set-innerHTML_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/shadow/content-pseudo-element-css-text_t01: RuntimeError # https://github.com/dart-lang/co19/issues/49
+LayoutTests/fast/dom/shadow/distribution-update-recalcs-style_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/shadow/event-path_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/shadow/host-context-pseudo-class-css-text_t01: RuntimeError # https://github.com/dart-lang/co19/issues/49
 LayoutTests/fast/dom/shadow/host-pseudo-class-css-text_t01: RuntimeError # https://github.com/dart-lang/co19/issues/49
@@ -1328,7 +1177,9 @@
 LayoutTests/fast/filesystem/async-operations_t01: Pass, RuntimeError # Please triage this failure
 LayoutTests/fast/filesystem/directory-entry-to-uri_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/filesystem/file-entry-to-uri_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/filesystem/file-writer-abort-continue_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/filesystem/filesystem-reference_t01: Pass, RuntimeError # Please triage this failure
+LayoutTests/fast/filesystem/file-writer-abort-continue_t01: RuntimeError
 LayoutTests/fast/forms/ValidityState-tooLong-input_t01: RuntimeError # https://github.com/dart-lang/co19/issues/48
 LayoutTests/fast/forms/ValidityState-tooLong-textarea_t01: RuntimeError # https://github.com/dart-lang/co19/issues/48
 LayoutTests/fast/forms/autofocus-focus-only-once_t01: Skip # Times out. Please triage this failure
@@ -1372,6 +1223,7 @@
 LayoutTests/fast/forms/setCustomValidity-existence_t01: RuntimeError # Issue 25155
 LayoutTests/fast/forms/setrangetext_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/forms/submit-form-attributes_t01: RuntimeError # co19 issue 14
+LayoutTests/fast/forms/textarea-maxlength_t01: RuntimeError # Please triage this failure. Started failing in chrome 55
 LayoutTests/fast/forms/textarea-paste-newline_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/forms/textfield-focus-out_t01: Skip # Times out. Please triage this failure
 LayoutTests/fast/forms/validationMessage_t01: RuntimeError # Please triage this failure
@@ -1556,6 +1408,7 @@
 LibTest/html/Document/clone_A01_t01: RuntimeError # Please triage this failure
 LibTest/html/Document/clone_A01_t02: RuntimeError # Please triage this failure
 LibTest/html/Document/securityPolicy_A01_t01: RuntimeError # Please triage this failure
+LibTest/html/Element/Element.tag_A01_t01: RuntimeError # Test seems invalid in Chrome 55.
 LibTest/html/Element/blur_A01_t01: Skip # Times out. Please triage this failure
 LibTest/html/Element/borderEdge_A01_t01: RuntimeError # Issue 16574
 LibTest/html/Element/contentEdge_A01_t01: RuntimeError # Issue 16574
@@ -1871,6 +1724,7 @@
 WebPlatformTest/html-templates/parsing-html-templates/clearing-the-stack-back-to-a-given-context/clearing-stack-back-to-a-table-row-context_t01: RuntimeError # Please triage this failure
 WebPlatformTest/html/dom/elements/global-attributes/dataset-enumeration_t01: RuntimeError # Please triage this failure
 WebPlatformTest/html/semantics/forms/textfieldselection/selection_t01: RuntimeError # Please triage this failure
+WebPlatformTest/shadow-dom/html-elements-in-shadow-trees/html-forms/test-001_t01: RuntimeError # Please triage this failure
 WebPlatformTest/shadow-dom/shadow-trees/upper-boundary-encapsulation/ownerdocument-001_t01: RuntimeError # Please triage this failure
 
 [ $compiler == dart2js && $runtime == chrome && $system == macos ]
@@ -1927,7 +1781,6 @@
 LayoutTests/fast/canvas/webgl/gl-bind-attrib-location-test_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/gl-enable-enum-test_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/gl-enum-tests_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/gl-get-calls_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/gl-getshadersource_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/gl-getstring_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/gl-object-get-calls_t01: RuntimeError # Please triage this failure
@@ -1949,7 +1802,6 @@
 LayoutTests/fast/canvas/webgl/is-object_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/null-object-behaviour_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/null-uniform-location_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/object-deletion-behaviour_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/oes-element-index-uint_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/point-size_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/premultiplyalpha-test_t01: RuntimeError # Please triage this failure
@@ -2296,6 +2148,7 @@
 LayoutTests/fast/files/xhr-response-blob_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/filesystem/directory-entry-to-uri_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/filesystem/file-entry-to-uri_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/filesystem/file-writer-abort-continue_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/forms/autofocus-focus-only-once_t01: Skip # Times out.
 LayoutTests/fast/forms/date/input-valueasdate-date_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/forms/datetimelocal/input-valueasdate-datetimelocal_t01: RuntimeError # Please triage this failure
@@ -2835,12 +2688,12 @@
 LayoutTests/fast/canvas/getPutImageDataPairTest_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/rgba-parsing_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/WebGLContextEvent_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/buffer-data-array-buffer_t01: RuntimeError # Issue 27872
+LayoutTests/fast/canvas/webgl/buffer-data-array-buffer_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias-t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/context-destroyed-crash_t01: Pass, RuntimeError # Issue 26898
 LayoutTests/fast/canvas/webgl/context-lost-restored_t01: Pass, RuntimeError # Issue 26898
 LayoutTests/fast/canvas/webgl/context-lost_t01: Pass, RuntimeError # Issue 26898
-LayoutTests/fast/canvas/webgl/gl-enum-tests_t01: RuntimeError # Issue 27872
+LayoutTests/fast/canvas/webgl/gl-enum-tests_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/gl-get-calls_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/renderer-and-vendor-strings_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-array-buffer-view_t01: Skip # Times out.
@@ -2848,7 +2701,6 @@
 LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-rgba4444_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-rgba5551_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-image_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/webgl/tex-input-validation_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/texture-transparent-pixels-initialized_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/uniform-location_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/webgl/uninitialized-test_t01: RuntimeError # Please triage this failure
@@ -3228,12 +3080,12 @@
 LayoutTests/fast/dom/click-method-on-html-element_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/client-width-height-quirks_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/containerNode_t01: Skip # Times out. Please triage this failure
-LayoutTests/fast/dom/createElementNS-namespace-errors_t01: RuntimeError # Issue 27873
 LayoutTests/fast/dom/css-delete-doc_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/css-rule-functions_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/css-selectorText_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/css-shortHands_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/css-shorthand-common-value_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/dom/createElementNS-namespace-errors_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/custom/attribute-changed-callback_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/custom/constructor-calls-created-synchronously_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/dom/custom/created-callback_t01: RuntimeError # Please triage this failure
@@ -4134,15 +3986,12 @@
 
 [ $compiler == dart2js && $runtime == ff && $system == macos]
 LayoutTests/fast/canvas/canvas-modify-emptyPath_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/innerHTML/005_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/html/draggable_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/ruby/modify-positioned-ruby-text-crash_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/table/margins-perpendicular-containing-block_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/table/table-colgroup-present-after-table-row_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/table/table-rowspan-cell-with-empty-cell_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/text-autosizing/vertical-writing-mode_t01: RuntimeError # Please triage this failure
-LibTest/core/RegExp/Pattern_semantics/firstMatch_Atom_A03_t03: RuntimeError # Please triage this failure
 
 [ $compiler == dart2js && $runtime == ff && $checked]
 LayoutTests/fast/css-intrinsic-dimensions/width-shrinks-avoid-floats_t01: RuntimeError # Please triage this failure
@@ -4186,6 +4035,7 @@
 
 [ $compiler == dart2js && $runtime == ff && $system != windows ]
 LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/canvas/webgl/tex-input-validation_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/xpath/4XPath/Core/test_parser_t01: RuntimeError # Dartium JSInterop failure
 LayoutTests/fast/xpath/py-dom-xpath/abbreviations_t01: RuntimeError # Dartium JSInterop failure
 
@@ -5027,8 +4877,7 @@
 LibTest/html/Element/getBoundingClientRect_A01_t02: Pass, RuntimeError # Issue 53
 LibTest/html/Element/getClientRects_A01_t02: RuntimeError # Please triage this failure
 LibTest/html/Element/getNamespacedAttributes_A01_t01: RuntimeError # Please triage this failure
-LibTest/html/Element/isContentEditable_A01_t01: RuntimeError # Fails 10 out of 10.
-LibTest/html/Element/isContentEditable_A01_t01: RuntimeError # Please triage this failure
+LibTest/html/Element/isContentEditable_A01_t01: Pass, RuntimeError # Issue 28187
 LibTest/html/Element/isContentEditable_A02_t01: RuntimeError # Fails 10 out of 10.
 LibTest/html/Element/isTagSupported_A01_t01: RuntimeError # Please triage this failure
 LibTest/html/Element/isTagSupported_A01_t02: RuntimeError # Please triage this failure
@@ -6736,7 +6585,7 @@
 LayoutTests/fast/canvas/canvas-blending-text_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/canvas-blending-transforms_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/canvas-clip-rule_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/canvas/canvas-composite-canvas_t01: Pass, RuntimeError # Please triage this failure
+LayoutTests/fast/canvas/canvas-composite-canvas_t01: Pass, RuntimeError, Timeout # Please triage this failure
 LayoutTests/fast/canvas/canvas-composite-image_t01: Pass, RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/canvas-currentColor_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/canvas/canvas-currentTransform_t01: RuntimeError # Feature is not implemented
@@ -8102,7 +7951,7 @@
 LayoutTests/fast/xsl/xslt-string-parameters_t01: RuntimeError # Please triage this failure
 LayoutTests/fast/xsl/xslt-transform-to-fragment-crash_t01: RuntimeError # Please triage this failure
 LibTest/async/Future/doWhile_A05_t01: Pass, RuntimeError # Sometimes passes on windows 8. Please triage this failure
-LibTest/async/Future/forEach_A04_t02: RuntimeError # Please triage this failure
+LibTest/async/Future/forEach_A04_t02: Pass, RuntimeError # Sometimes passes on windows 7 and windows 8. Please triage this failure
 LibTest/async/Stream/Stream.periodic_A01_t01: Pass, RuntimeError # Please triage this failure
 LibTest/async/Stream/timeout_A01_t01: Pass, RuntimeError # Sometimes passes on windows 8. Please triage this failure
 LibTest/async/Stream/timeout_A03_t01: Pass, RuntimeError # Sometimes passes on windows 8. Please triage this failure
diff --git a/tests/co19/co19-dartium.status b/tests/co19/co19-dartium.status
index 3f61aa96..76d0c26 100644
--- a/tests/co19/co19-dartium.status
+++ b/tests/co19/co19-dartium.status
@@ -69,13 +69,7 @@
 Language/Expressions/Identifier_Reference/built_in_not_dynamic_t19: Fail # Issue 25772
 Language/Expressions/Instance_Creation/New/execution_t04: Fail, OK
 Language/Expressions/Instance_Creation/New/execution_t06: Fail, OK
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t01: RuntimeError # Issue 24607
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t02: RuntimeError # Issue 24607
-Language/Expressions/Property_Extraction/General_Super_Property_Extraction: RuntimeError # Issue 26287
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t01: RuntimeError # Issue 24607
-Language/Expressions/Property_Extraction/Super_Closurization: RuntimeError # Issue 26287
 Language/Expressions/Spawning_an_Isolate/new_isolate_t01: RuntimeError, OK  # Uses Isolate.spawn.
-Language/Functions/Formal_Parameters/syntax_t05: RuntimeError # Issue 26644
 Language/Libraries_and_Scripts/Exports/reexport_t01: fail # Dart issue 12916
 Language/Libraries_and_Scripts/Exports/reexport_t02: fail # Dart issue 12916
 Language/Libraries_and_Scripts/Parts/compilation_t02: Skip # Please triage this failure.
@@ -1215,11 +1209,11 @@
 WebPlatformTest/custom-elements/concepts/type_A07_t01: Skip # Timing out on the bots. Please triage this failure.
 
 [ $compiler == none && $runtime == dartium && $system == windows ]
+LayoutTests/fast/css/MarqueeLayoutTest_t01: Pass, RuntimeError # Please triage this failure
 LayoutTests/fast/writing-mode/vertical-inline-block-hittest_t01: Pass, RuntimeError # Issue 21605
 WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-001_t01: Skip # Timesout Issue 26134
 WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-002_t01: Skip # Timesout sporadically
 WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-003_t01: Skip # Timesout sporadically
-LayoutTests/fast/css/MarqueeLayoutTest_t01: Pass, RuntimeError # Please triage this failure
 
 [ $compiler == none && $runtime == dartium && $system != windows ]
 LayoutTests/fast/css/font-face-unicode-range-monospace_t01: RuntimeError # co19-roll r761: Please triage this failure.
@@ -1258,8 +1252,6 @@
 WebPlatformTest/html/semantics/forms/the-datalist-element/datalistoptions_t01: Skip # Issue 20540.
 
 [ $compiler == none && $runtime == dartium && $checked ]
-LayoutTests/fast/parser/pre-first-line-break_t01: RuntimeError # co19-roll r801: Please triage this failure.
-LayoutTests/fast/xpath/ambiguous-operators_t01: RuntimeError # co19-roll r761: Please triage this failure.
 Language/Errors_and_Warnings/static_warning_t02: RuntimeError # Please triage this failure.
 Language/Errors_and_Warnings/static_warning_t03: RuntimeError # Please triage this failure.
 Language/Errors_and_Warnings/static_warning_t04: RuntimeError # Please triage this failure.
@@ -1309,6 +1301,7 @@
 LayoutTests/fast/lists/marker-preferred-margins_t01: RuntimeError # co19-roll r801: Please triage this failure.
 LayoutTests/fast/multicol/fixed-column-percent-logical-height-orthogonal-writing-mode_t01: RuntimeError # co19-roll r801: Please triage this failure.
 LayoutTests/fast/multicol/vertical-lr/image-inside-nested-blocks-with-border_t01: RuntimeError # co19-roll r801: Please triage this failure.
+LayoutTests/fast/parser/pre-first-line-break_t01: RuntimeError # co19-roll r801: Please triage this failure.
 LayoutTests/fast/replaced/available-height-for-content_t01: RuntimeError # co19-roll r801: Please triage this failure.
 LayoutTests/fast/replaced/computed-image-width-with-percent-height-and-fixed-ancestor-vertical-lr_t01: Pass, RuntimeError # co19-roll r801: Please triage this failure.
 LayoutTests/fast/replaced/computed-image-width-with-percent-height-and-fixed-ancestor_t01: Pass, RuntimeError # co19-roll r801: Please triage this failure.
@@ -1317,8 +1310,8 @@
 LayoutTests/fast/shapes/parsing/parsing-shape-image-threshold_t01: RuntimeError # co19-roll r801: Please triage this failure.
 LayoutTests/fast/shapes/parsing/parsing-shape-margin_t01: RuntimeError # co19-roll r801: Please triage this failure.
 LayoutTests/fast/table/absolute-table-percent-lengths_t01: RuntimeError # co19-roll r786: Please triage this failure.
-LayoutTests/fast/table/css-table-width_t01: RuntimeError # co19-roll r786: Please triage this failure.
 LayoutTests/fast/table/css-table-width-with-border-padding_t01: RuntimeError # Please triage this failure.
+LayoutTests/fast/table/css-table-width_t01: RuntimeError # co19-roll r786: Please triage this failure.
 LayoutTests/fast/table/fixed-table-layout-width-change_t01: RuntimeError # co19-roll r786: Please triage this failure.
 LayoutTests/fast/table/html-table-width-max-width-constrained_t01: RuntimeError # co19-roll r786: Please triage this failure.
 LayoutTests/fast/table/margins-flipped-text-direction_t01: RuntimeError # co19-roll r786: Please triage this failure.
@@ -1334,6 +1327,7 @@
 LayoutTests/fast/url/trivial-segments_t01: RuntimeError # co19-roll r786: Please triage this failure.
 LayoutTests/fast/url/trivial_t01: RuntimeError # co19-roll r786: Please triage this failure.
 LayoutTests/fast/writing-mode/auto-sizing-orthogonal-flows_t01: RuntimeError # Please triage this failure.
+LayoutTests/fast/xpath/ambiguous-operators_t01: RuntimeError # co19-roll r761: Please triage this failure.
 LayoutTests/fast/xpath/xpath-result-eventlistener-crash_t01: RuntimeError # co19-roll r761: Please triage this failure.
 LibTest/html/Node/ownerDocument_A01_t01: RuntimeError # co19-roll r722: Issue 18251
 WebPlatformTest/DOMEvents/approved/Propagation.path.target.removed_t01: RuntimeError # co19-roll r738: Please triage this failure.
diff --git a/tests/co19/co19-kernel.status b/tests/co19/co19-kernel.status
index 6b4334a..894669a 100644
--- a/tests/co19/co19-kernel.status
+++ b/tests/co19/co19-kernel.status
@@ -3,59 +3,44 @@
 # BSD-style license that can be found in the LICENSE file.
 
 # Disable tests globally for kernel.
-[ $compiler == rasta || $compiler == rastap || $compiler == dartk || $compiler == dartkp ]
+[ $compiler == dartk || $compiler == dartkp ]
 Language/Libraries_and_Scripts/Imports/static_type_t01: Skip # No support for deferred libraries.
-Language/Metadata/*: Skip # No support for metadata ATM.
 LibTest/async/DeferredLibrary/DeferredLibrary_A01_t01: Skip # No support for deferred libraries.
 LibTest/isolate/*: Skip # No support for isolates ATM.
 
+Language/Metadata/before_export_t01: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_import_t01: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_library_t01: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t01: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t02: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t03: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t04: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t05: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t06: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t07: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t08: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_param_t09: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_type_param_t01: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_typedef_t01: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_variable_t01: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+Language/Metadata/before_variable_t02: RuntimeError  # Issue 28434: Kernel IR misses these annotations.
+
+
 # Override tests marked as failing elsewhere.
 [ $compiler == dartk || $compiler == dartkp ]
 Language/Libraries_and_Scripts/Exports/reexport_t01: Pass
 Language/Functions/Formal_Parameters/Optional_Formals/syntax_t14: Pass
 
-# dartk: JIT failures
-[ $compiler == dartk && $runtime == vm ]
-Language/Classes/Constructors/Generative_Constructors/execution_of_a_superinitializer_t01: RuntimeError
-Language/Classes/Constructors/Generative_Constructors/execution_of_an_initializer_t02: RuntimeError
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t01: Crash
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t03: Crash
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t04: Crash
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t05: Crash
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t06: Crash
-Language/Classes/Constructors/Generative_Constructors/initializing_formals_execution_t02: RuntimeError
-Language/Classes/Constructors/Generative_Constructors/initializing_this_t02: Crash
-Language/Classes/Getters/static_getter_t02: CompileTimeError
-Language/Classes/Setters/name_t08: CompileTimeError
-Language/Classes/Setters/name_t09: CompileTimeError
-Language/Classes/Setters/name_t10: CompileTimeError
-Language/Classes/Setters/name_t11: CompileTimeError
-Language/Classes/Setters/name_t12: CompileTimeError
-Language/Classes/Setters/name_t13: CompileTimeError
-Language/Classes/Setters/name_t14: CompileTimeError
-Language/Classes/Setters/name_t15: CompileTimeError
-Language/Classes/definition_t23: CompileTimeError
-Language/Enums/declaration_equivalent_t01: RuntimeError
+###############################################################################
+# Dartk Entries
+###############################################################################
+
+[ $compiler == dartk || $compiler == dartkp ]
+Language/Classes/Getters/static_getter_t02: DartkCompileTimeError
 Language/Enums/syntax_t08: MissingCompileTimeError
 Language/Enums/syntax_t09: MissingCompileTimeError
-Language/Expressions/Constants/exception_t01: MissingCompileTimeError
-Language/Expressions/Constants/exception_t02: MissingCompileTimeError
-Language/Expressions/Constants/string_length_t01: Crash
-Language/Expressions/Function_Invocation/Function_Expression_Invocation/not_a_function_expression_t01: RuntimeError
-Language/Expressions/Function_Invocation/Unqualified_Invocation/function_expr_invocation_t03: RuntimeError
-Language/Expressions/Function_Invocation/Unqualified_Invocation/function_expr_invocation_t04: RuntimeError
 Language/Expressions/Function_Invocation/Unqualified_Invocation/instance_context_invocation_t03: MissingCompileTimeError
 Language/Expressions/Function_Invocation/Unqualified_Invocation/instance_context_invocation_t04: MissingCompileTimeError
-Language/Expressions/Function_Invocation/Unqualified_Invocation/static_method_invocation_t02: RuntimeError
-Language/Expressions/Function_Invocation/async_cleanup_t07: Fail
-Language/Expressions/Function_Invocation/async_cleanup_t08: Fail
-Language/Expressions/Function_Invocation/async_generator_invokation_t05: RuntimeError
-Language/Expressions/Function_Invocation/async_generator_invokation_t06: RuntimeError
-Language/Expressions/Function_Invocation/async_generator_invokation_t09: RuntimeError
-Language/Expressions/Identifier_Reference/built_in_identifier_t35: Pass
-Language/Expressions/Identifier_Reference/built_in_identifier_t36: Pass
-Language/Expressions/Identifier_Reference/built_in_identifier_t37: Pass
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t14: Pass
 Language/Expressions/Identifier_Reference/built_in_not_dynamic_t17: MissingCompileTimeError
 Language/Expressions/Identifier_Reference/built_in_not_dynamic_t18: MissingCompileTimeError
 Language/Expressions/Identifier_Reference/built_in_not_dynamic_t21: MissingCompileTimeError
@@ -70,173 +55,13 @@
 Language/Expressions/Identifier_Reference/built_in_not_dynamic_t30: MissingCompileTimeError
 Language/Expressions/Identifier_Reference/built_in_not_dynamic_t31: MissingCompileTimeError
 Language/Expressions/Identifier_Reference/built_in_not_dynamic_t32: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/evaluation_property_extraction_t03: RuntimeError
-Language/Expressions/Identifier_Reference/evaluation_type_parameter_t01: RuntimeError
-Language/Expressions/Identifier_Reference/evaluation_type_parameter_t02: MissingCompileTimeError
-Language/Expressions/Instance_Creation/Const/canonicalized_t05: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t12: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t19: RuntimeError
-Language/Expressions/Instance_Creation/New/evaluation_t20: RuntimeError
-Language/Expressions/Lookup/Method_Lookup/superclass_t08: RuntimeError
-Language/Expressions/Method_Invocation/Ordinary_Invocation/accessible_instance_member_t05: RuntimeError
-Language/Expressions/Method_Invocation/Ordinary_Invocation/evaluation_t07: RuntimeError
-Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t18: RuntimeError
-Language/Expressions/Object_Identity/string_t01: RuntimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/named_parameters_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/positional_parameters_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/closurization_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/deferred_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malbounded_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malbounded_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malformed_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malformed_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/no_such_method_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/no_such_method_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/not_class_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/not_class_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/not_class_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/static_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/static_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/static_type_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t01: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t02: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t03: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t04: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t05: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t06: Pass
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t07: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t08: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t09: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t07: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t07: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t08: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t07: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t08: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t09: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/expression_evaluation_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/named_parameters_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/positional_parameters_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/deferred_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malbounded_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malbounded_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malformed_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malformed_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/no_such_method_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/no_such_method_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t04: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t04: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t05: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t06: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t08: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_named_params_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_named_params_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_positional_params_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_positional_params_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_identical_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_identical_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_identical_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_list_access_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_list_assignment_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t04: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t05: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t06: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t08: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t09: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t10: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t11: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t12: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t13: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t14: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t15: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t16: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t17: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_unary_bitwise_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t04: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t05: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t06: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t08: CompileTimeError
-Language/Expressions/Strings/adjacent_strings_t02: RuntimeError
-Language/Expressions/Type_Test/evaluation_t10: RuntimeError
-Language/Functions/External_Functions/not_connected_to_a_body_t01: RuntimeError
-Language/Functions/Formal_Parameters/syntax_t05: RuntimeError
-Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t01: CompileTimeError
-Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t02: CompileTimeError
-Language/Libraries_and_Scripts/Exports/invalid_uri_t02: Pass
+Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t01: DartkCompileTimeError
+Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t02: DartkCompileTimeError
 Language/Libraries_and_Scripts/Exports/syntax_t01: MissingCompileTimeError
 Language/Libraries_and_Scripts/Exports/syntax_t04: MissingCompileTimeError
 Language/Libraries_and_Scripts/Exports/syntax_t05: MissingCompileTimeError
 Language/Libraries_and_Scripts/Exports/syntax_t06: MissingCompileTimeError
-Language/Libraries_and_Scripts/Imports/deferred_import_t01: RuntimeError
-Language/Libraries_and_Scripts/Imports/deferred_import_t02: RuntimeError
-Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t01/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t02: CompileTimeError
-Language/Libraries_and_Scripts/Imports/invalid_uri_t02: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01: RuntimeError
-Language/Libraries_and_Scripts/Parts/compilation_t02: Pass Crash
-Language/Libraries_and_Scripts/Parts/syntax_t06: Pass
-Language/Libraries_and_Scripts/Scripts/top_level_main_t01: Crash
-Language/Libraries_and_Scripts/Scripts/top_level_main_t02: Crash
+Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t02: DartkCompileTimeError
 Language/Libraries_and_Scripts/definition_syntax_t01: MissingCompileTimeError
 Language/Libraries_and_Scripts/definition_syntax_t03: MissingCompileTimeError
 Language/Libraries_and_Scripts/definition_syntax_t04: MissingCompileTimeError
@@ -258,6 +83,7 @@
 Language/Libraries_and_Scripts/definition_syntax_t26: MissingCompileTimeError
 Language/Libraries_and_Scripts/definition_syntax_t27: MissingCompileTimeError
 Language/Libraries_and_Scripts/definition_syntax_t29: MissingCompileTimeError
+Language/Libraries_and_Scripts/Scripts/top_level_main_t05: RuntimeError # 'main' getter not supported
 Language/Libraries_and_Scripts/top_level_syntax_t02: MissingCompileTimeError
 Language/Libraries_and_Scripts/top_level_syntax_t03: MissingCompileTimeError
 Language/Libraries_and_Scripts/top_level_syntax_t04: MissingCompileTimeError
@@ -276,114 +102,48 @@
 Language/Libraries_and_Scripts/top_level_syntax_t17: MissingCompileTimeError
 Language/Libraries_and_Scripts/top_level_syntax_t18: MissingCompileTimeError
 Language/Libraries_and_Scripts/top_level_syntax_t19: MissingCompileTimeError
-Language/Mixins/Mixin_Application/error_t01: MissingCompileTimeError
-Language/Mixins/Mixin_Application/error_t02: MissingCompileTimeError
-Language/Mixins/Mixin_Application/syntax_t16: Crash
+Language/Statements/Assert/syntax_t04: MissingCompileTimeError
 Language/Statements/Break/label_t03: MissingCompileTimeError
 Language/Statements/Break/label_t04: MissingCompileTimeError
 Language/Statements/Continue/label_t07: MissingCompileTimeError
-Language/Statements/Labels/syntax_t03: Pass
-Language/Statements/Rethrow/execution_t04: RuntimeError
-Language/Statements/Switch/syntax_t02: Pass
-Language/Statements/Try/catch_scope_t01: RuntimeError
-Language/Statements/Yield_and_Yield_Each/Yield/execution_async_t04: Fail
-Language/Statements/Yield_and_Yield_Each/Yield/execution_async_t05: Fail
-Language/Statements/Yield_and_Yield_Each/Yield/execution_async_t06: Fail
-Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t01: RuntimeError
-Language/Types/Interface_Types/subtype_t44: RuntimeError
-Language/Types/Static_Types/deferred_type_t01: RuntimeError
 Language/Variables/final_or_static_initialization_t01: MissingCompileTimeError
 Language/Variables/final_or_static_initialization_t02: MissingCompileTimeError
 Language/Variables/final_or_static_initialization_t03: MissingCompileTimeError
-Language/Variables/final_t01/01: MissingRuntimeError
-Language/Variables/final_t02/01: MissingRuntimeError
 Language/Variables/final_t04: MissingCompileTimeError
 Language/Variables/final_t05: MissingCompileTimeError
 Language/Variables/final_t06: MissingCompileTimeError
 Language/Variables/final_t07: MissingCompileTimeError
+Language/Mixins/Mixin_Application/error_t01: MissingCompileTimeError # Missing compile-time error from analyzer
+Language/Mixins/Mixin_Application/error_t02: MissingCompileTimeError
 
-# These tests should throw RuntimeError but they Pass instead.
-Language/Libraries_and_Scripts/Imports/static_type_t01/04: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/06: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/01: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/05: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/03: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/07: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/02: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/04: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/06: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/01: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/05: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/03: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/07: Pass
-Language/Libraries_and_Scripts/Imports/static_type_t01/02: Pass
-
-# dartk: JIT failures (debug)
-[ $compiler == dartk && $runtime == vm && $mode == debug ]
-Language/Expressions/Shift/syntax_t15: Crash  # Invalid class id during isolate shutdown Heap::VerifyGC
-Language/Expressions/Spawning_an_Isolate/new_isolate_t01: Crash  # Class finalization issue
-Language/Libraries_and_Scripts/Scripts/top_level_main_t05: Crash  # !main_obj.IsNull()
-LibTest/typed_data/ByteBuffer/runtimeType_A01_t02: Pass, Crash  # Out of memory
-LibTest/collection/DoubleLinkedQueue/every_A01_t02: Pass, Crash  # Out of memory
+# dartk: JIT failures
+[ $compiler == dartk && $runtime == vm ]
+Language/Expressions/Constants/exception_t01: MissingCompileTimeError
+Language/Expressions/Constants/exception_t02: MissingCompileTimeError
+Language/Expressions/Identifier_Reference/evaluation_type_parameter_t02: MissingCompileTimeError
+Language/Mixins/Mixin_Application/syntax_t16: DartkCrash
 
 # dartk: precompilation failures
 [ $compiler == dartkp && $runtime == dart_precompiled ]
-Language/Classes/Constructors/Generative_Constructors/execution_of_a_superinitializer_t01: RuntimeError
+
+###############################################################################
+# VM Entries
+###############################################################################
+
+# dartk: Shared JIT & Precompiled failures
+[ ($compiler == dartk && $runtime == vm) || ($compiler == dartkp && $runtime == dart_precompiled) ]
 Language/Classes/Constructors/Generative_Constructors/execution_of_an_initializer_t02: RuntimeError
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t01: Crash
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t03: Crash
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t04: Crash
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t05: Crash
-Language/Classes/Constructors/Generative_Constructors/formal_parameter_t06: Crash
 Language/Classes/Constructors/Generative_Constructors/initializing_formals_execution_t02: RuntimeError
-Language/Classes/Constructors/Generative_Constructors/initializing_this_t02: Crash
-Language/Classes/Getters/static_getter_t02: CompileTimeError
-Language/Classes/Setters/name_t08: CompileTimeError
-Language/Classes/Setters/name_t09: CompileTimeError
-Language/Classes/Setters/name_t10: CompileTimeError
-Language/Classes/Setters/name_t11: CompileTimeError
-Language/Classes/Setters/name_t12: CompileTimeError
-Language/Classes/Setters/name_t13: CompileTimeError
-Language/Classes/Setters/name_t14: CompileTimeError
-Language/Classes/Setters/name_t15: CompileTimeError
 Language/Classes/definition_t23: CompileTimeError
-Language/Enums/declaration_equivalent_t01: RuntimeError
-Language/Enums/syntax_t08: MissingCompileTimeError
-Language/Enums/syntax_t09: MissingCompileTimeError
-Language/Expressions/Constants/exception_t01: Crash
-Language/Expressions/Constants/exception_t02: Crash
-Language/Expressions/Constants/string_length_t01: Crash
 Language/Expressions/Function_Invocation/Function_Expression_Invocation/not_a_function_expression_t01: RuntimeError
 Language/Expressions/Function_Invocation/Unqualified_Invocation/function_expr_invocation_t03: RuntimeError
 Language/Expressions/Function_Invocation/Unqualified_Invocation/function_expr_invocation_t04: RuntimeError
-Language/Expressions/Function_Invocation/Unqualified_Invocation/instance_context_invocation_t03: MissingCompileTimeError
-Language/Expressions/Function_Invocation/Unqualified_Invocation/instance_context_invocation_t04: MissingCompileTimeError
 Language/Expressions/Function_Invocation/Unqualified_Invocation/static_method_invocation_t02: RuntimeError
-Language/Expressions/Function_Invocation/async_cleanup_t07: RuntimeError
-Language/Expressions/Function_Invocation/async_cleanup_t08: RuntimeError
-Language/Expressions/Function_Invocation/async_generator_invokation_t05: RuntimeError
-Language/Expressions/Function_Invocation/async_generator_invokation_t06: RuntimeError
-Language/Expressions/Function_Invocation/async_generator_invokation_t09: RuntimeError
 Language/Expressions/Identifier_Reference/built_in_identifier_t35: Pass
 Language/Expressions/Identifier_Reference/built_in_identifier_t36: Pass
 Language/Expressions/Identifier_Reference/built_in_identifier_t37: Pass
 Language/Expressions/Identifier_Reference/built_in_not_dynamic_t14: Pass
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t17: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t18: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t21: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t22: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t23: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t24: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t25: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t26: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t27: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t28: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t29: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t30: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t31: MissingCompileTimeError
-Language/Expressions/Identifier_Reference/built_in_not_dynamic_t32: MissingCompileTimeError
 Language/Expressions/Identifier_Reference/evaluation_property_extraction_t03: RuntimeError
-Language/Expressions/Identifier_Reference/evaluation_type_parameter_t01: RuntimeError
 Language/Expressions/Instance_Creation/New/evaluation_t12: RuntimeError
 Language/Expressions/Instance_Creation/New/evaluation_t19: RuntimeError
 Language/Expressions/Instance_Creation/New/evaluation_t20: RuntimeError
@@ -391,223 +151,44 @@
 Language/Expressions/Method_Invocation/Ordinary_Invocation/accessible_instance_member_t05: RuntimeError
 Language/Expressions/Method_Invocation/Ordinary_Invocation/evaluation_t07: RuntimeError
 Language/Expressions/Method_Invocation/Ordinary_Invocation/method_lookup_failed_t18: RuntimeError
-Language/Expressions/Null/instance_of_class_null_t01: Crash
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/named_parameters_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/positional_parameters_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/closurization_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/deferred_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malbounded_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malbounded_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malformed_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/malformed_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/no_such_method_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/no_such_method_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/not_class_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/not_class_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/not_class_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/static_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/static_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/static_type_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t01: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t02: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t03: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t04: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t05: Pass
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t06: Pass
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/expression_evaluation_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t07: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t08: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/getter_lookup_t09: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/method_lookup_t07: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t07: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/no_accessible_member_t08: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t07: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t08: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/setter_lookup_t09: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t03: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t04: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t05: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t06: CompileTimeError
-Language/Expressions/Property_Extraction/General_Closurization/static_type_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/expression_evaluation_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/named_parameters_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/positional_parameters_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/deferred_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malbounded_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malbounded_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malformed_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/malformed_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/no_such_method_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/no_such_method_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/not_class_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/static_type_t04: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t04: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t05: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t06: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/getter_closurization_t08: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_named_params_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_named_params_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_positional_params_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_closurization_positional_params_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_identical_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_identical_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/method_identical_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_list_access_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_list_assignment_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t04: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t05: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t06: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t08: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t09: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t10: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t11: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t12: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t13: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t14: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t15: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t16: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_t17: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/operator_closurization_unary_bitwise_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t01: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t02: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t03: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t04: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t05: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t06: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t07: CompileTimeError
-Language/Expressions/Property_Extraction/Ordinary_Member_Closurization/setter_closurization_t08: CompileTimeError
 Language/Expressions/Type_Test/evaluation_t10: RuntimeError
 Language/Functions/External_Functions/not_connected_to_a_body_t01: RuntimeError
-Language/Functions/Formal_Parameters/syntax_t05: RuntimeError
-Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t01: CompileTimeError
-Language/Interfaces/Superinterfaces/Inheritance_and_Overriding/same_name_method_and_getter_t02: CompileTimeError
 Language/Libraries_and_Scripts/Exports/invalid_uri_t02: Pass
-Language/Libraries_and_Scripts/Exports/syntax_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/Exports/syntax_t04: MissingCompileTimeError
-Language/Libraries_and_Scripts/Exports/syntax_t05: MissingCompileTimeError
-Language/Libraries_and_Scripts/Exports/syntax_t06: MissingCompileTimeError
 Language/Libraries_and_Scripts/Imports/deferred_import_t01: RuntimeError
 Language/Libraries_and_Scripts/Imports/deferred_import_t02: RuntimeError
 Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t01/01: MissingRuntimeError
-Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t02: CompileTimeError
 Language/Libraries_and_Scripts/Imports/invalid_uri_t02: Pass
 Language/Libraries_and_Scripts/Parts/syntax_t06: Pass
-Language/Libraries_and_Scripts/Scripts/top_level_main_t01: Crash
-Language/Libraries_and_Scripts/Scripts/top_level_main_t02: Crash
-Language/Libraries_and_Scripts/definition_syntax_t01: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t03: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t04: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t06: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t08: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t09: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t10: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t15: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t17: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t18: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t19: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t20: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t21: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t22: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t23: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t24: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t25: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t26: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t27: MissingCompileTimeError
-Language/Libraries_and_Scripts/definition_syntax_t29: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t02: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t03: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t04: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t05: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t06: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t07: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t08: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t09: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t10: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t11: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t12: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t13: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t14: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t15: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t16: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t17: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t18: MissingCompileTimeError
-Language/Libraries_and_Scripts/top_level_syntax_t19: MissingCompileTimeError
-Language/Statements/Break/label_t03: MissingCompileTimeError
-Language/Statements/Break/label_t04: MissingCompileTimeError
-Language/Statements/Continue/label_t07: MissingCompileTimeError
 Language/Statements/Labels/syntax_t03: Pass
-Language/Statements/Rethrow/execution_t04: RuntimeError
 Language/Statements/Switch/syntax_t02: Pass
 Language/Statements/Try/catch_scope_t01: RuntimeError
-Language/Statements/Yield_and_Yield_Each/Yield/execution_async_t04: Fail
-Language/Statements/Yield_and_Yield_Each/Yield/execution_async_t05: Fail
-Language/Statements/Yield_and_Yield_Each/Yield/execution_async_t06: Fail
-Language/Statements/Yield_and_Yield_Each/Yield_Each/execution_async_t01: RuntimeError
-Language/Types/Interface_Types/subtype_t44: RuntimeError
 Language/Types/Static_Types/deferred_type_t01: RuntimeError
-Language/Variables/final_or_static_initialization_t01: MissingCompileTimeError
-Language/Variables/final_or_static_initialization_t02: MissingCompileTimeError
-Language/Variables/final_or_static_initialization_t03: MissingCompileTimeError
 Language/Variables/final_t01/01: MissingRuntimeError
 Language/Variables/final_t02/01: MissingRuntimeError
-Language/Variables/final_t04: MissingCompileTimeError
-Language/Variables/final_t05: MissingCompileTimeError
-Language/Variables/final_t06: MissingCompileTimeError
-Language/Variables/final_t07: MissingCompileTimeError
-LibTest/core/StringBuffer/StringBuffer_A01_t02: RuntimeError
-LibTest/core/StringBuffer/write_A01_t02: RuntimeError
+
+# dartk: JIT failures
+[ $compiler == dartk && $runtime == vm ]
+Language/Expressions/Instance_Creation/Const/canonicalized_t05: RuntimeError
+Language/Expressions/Object_Identity/string_t01: RuntimeError
+Language/Expressions/Strings/adjacent_strings_t02: RuntimeError
+Language/Libraries_and_Scripts/Imports/static_type_t01: RuntimeError
+
+# These tests should throw RuntimeError but they Pass instead.
+Language/Libraries_and_Scripts/Imports/static_type_t01/01: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/02: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/03: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/04: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/05: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/06: Pass
+Language/Libraries_and_Scripts/Imports/static_type_t01/07: Pass
+
+# dartk: JIT failures (debug)
+[ $compiler == dartk && $runtime == vm && $mode == debug ]
+
+# dartk: precompilation failures
+[ $compiler == dartkp && $runtime == dart_precompiled ]
+Language/Expressions/Constants/exception_t01: Crash
+Language/Expressions/Constants/exception_t02: Crash
 
 # dartk: precompilation failures (debug)
-[ $compiler == dartkp && $runtime == dart_precompiled && $mode == debug ]
-Language/Libraries_and_Scripts/Scripts/top_level_main_t05: Crash  # !main_obj.IsNull()
+[ $compiler == dartkp && $runtime == dart_precompiled && $mode == debug ]
\ No newline at end of file
diff --git a/tests/co19/co19-runtime.status b/tests/co19/co19-runtime.status
index a0e3bc4..05b9fe2 100644
--- a/tests/co19/co19-runtime.status
+++ b/tests/co19/co19-runtime.status
@@ -2,8 +2,7 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 
 # Failures ok in tests below. VM moves super initializer to end of list.
 Language/Classes/Constructors/Generative_Constructors/execution_t03: Fail, OK
@@ -38,7 +37,7 @@
 LibTest/core/Symbol/Symbol_A01_t03: RuntimeError # Issue 13596
 LibTest/core/Symbol/Symbol_A01_t05: RuntimeError # Issue 13596
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 LibTest/typed_data/Float32x4/reciprocalSqrt_A01_t01: Pass, Fail # co19 issue 599
 LibTest/typed_data/Float32x4/reciprocal_A01_t01: Pass, Fail # co19 issue 599
 # With asynchronous loading, the load errors in these tests are no longer recognized as compile errors:
@@ -46,13 +45,11 @@
 Language/Libraries_and_Scripts/Exports/invalid_uri_t02: Fail
 Language/Libraries_and_Scripts/Parts/syntax_t06: Fail
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug ]
+[ ($runtime == vm || $runtime == dart_precompiled ) && $mode == debug ]
 LibTest/core/List/List_class_A01_t02: Pass, Slow
+LibTest/isolate/Isolate/spawn_A04_t01: Pass, Fail  # Issue 28269
 
-[ ($runtime == dart_precompiled || $runtime == dart_app) && $mode == debug ]
-Language/Libraries_and_Scripts/Imports/deferred_import_t02: Crash # Issue 27201
-
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && ($arch != x64 && $arch != simarm64 && $arch != arm64 && $arch != simdbc64 && $arch != simdbc) ]
+[ ($runtime == vm || $runtime == dart_precompiled) && ($arch != x64 && $arch != simarm64 && $arch != arm64 && $arch != simdbc64 && $arch != simdbc) ]
 LibTest/core/int/operator_left_shift_A01_t02: Fail # co19 issue 129
 
 [ ($compiler == none || $compiler == precompiler) && ($runtime == vm || $runtime == dart_precompiled) && ($arch == mips || $arch == arm64) ]
@@ -62,7 +59,7 @@
 LibTest/collection/ListMixin/ListMixin_class_A01_t02: Skip # co19 issue 673
 LibTest/collection/ListBase/ListBase_class_A01_t02: Skip # co19 issue 673
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && ($arch == simarm || $arch == simarmv6 || $arch == simarmv5te || $arch == simmips || $arch == simarm64 || $arch == simdbc || $arch == simdbc64) ]
+[ ($runtime == vm || $runtime == dart_precompiled) && ($arch == simarm || $arch == simarmv6 || $arch == simarmv5te || $arch == simmips || $arch == simarm64 || $arch == simdbc || $arch == simdbc64) ]
 LibTest/collection/DoubleLinkedQueue/DoubleLinkedQueue_class_A01_t01: Skip  # Timeout
 LibTest/collection/IterableBase/IterableBase_class_A01_t02: Skip  # Timeout
 LibTest/collection/IterableMixin/IterableMixin_class_A02_t01: Skip  # Timeout
@@ -76,16 +73,16 @@
 LibTest/collection/ListMixin/ListMixin_class_A01_t02: Pass, Slow
 LibTest/collection/ListBase/ListBase_class_A01_t02: Pass, Slow
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 LibTest/isolate/Isolate/spawn_A02_t01: Skip # co19 issue 667
 LibTest/html/*: SkipByDesign # dart:html not supported on VM.
 LayoutTests/fast/*: SkipByDesign # DOM not supported on VM.
 WebPlatformTest/*: SkipByDesign # dart:html not supported on VM.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug && $builder_tag == asan ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $mode == debug && $builder_tag == asan ]
 Language/Types/Interface_Types/subtype_t27: Skip  # Issue 21174.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 # co19 update Sep 29, 2015 (3ed795ea02e022ef19c77cf1b6095b7c8f5584d0)
 Language/Classes/Getters/type_object_t01: RuntimeError # Issue 23721
 Language/Classes/Getters/type_object_t02: RuntimeError # Issue 23721
@@ -93,20 +90,6 @@
 Language/Classes/Setters/type_object_t02: RuntimeError # Issue 23721
 Language/Classes/Static_Methods/type_object_t01: RuntimeError # Issue 23721
 Language/Classes/Static_Methods/type_object_t02: RuntimeError # Issue 23721
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t01: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t02: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t03: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t04: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t05: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/General_Closurization/class_object_member_t06: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t01: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t02: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t03: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t04: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t05: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t06: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t07: MissingCompileTimeError # Issue 24472
-Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t08: MissingCompileTimeError # Issue 24472
 Language/Expressions/Identifier_Reference/built_in_identifier_t35: MissingCompileTimeError # Issue 25732
 Language/Expressions/Identifier_Reference/built_in_identifier_t36: MissingCompileTimeError # Issue 25732
 Language/Expressions/Identifier_Reference/built_in_identifier_t37: MissingCompileTimeError # Issue 25732
@@ -130,13 +113,9 @@
 Language/Expressions/Identifier_Reference/built_in_not_dynamic_t19: MissingCompileTimeError # Issue 25772
 Language/Expressions/Method_Invocation/Ordinary_Invocation/object_method_invocation_t01: MissingCompileTimeError # Issue 25496
 Language/Expressions/Method_Invocation/Ordinary_Invocation/object_method_invocation_t02: MissingCompileTimeError # Issue 25496
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t01: RuntimeError # Issue 24607
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t01: RuntimeError # Issue 24607
-Language/Expressions/Property_Extraction/Named_Constructor_Closurization/identical_t01: RuntimeError # Issue 24607
 Language/Expressions/Assignment/super_assignment_failed_t05: RuntimeError # Issue 25671
 Language/Expressions/Function_Invocation/async_generator_invokation_t08: Fail # Issue 25967
 Language/Expressions/Function_Invocation/async_generator_invokation_t10: Fail # Issue 25967
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Closurization/identical_t02: RuntimeError # Issue 24607
 Language/Mixins/Mixin_Application/syntax_t16: CompileTimeError # Issue 25765
 Language/Mixins/declaring_constructor_t05: MissingCompileTimeError # Issue 24767
 Language/Mixins/declaring_constructor_t06: MissingCompileTimeError # Issue 24767
@@ -148,29 +127,26 @@
 Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t03: MissingCompileTimeError # Issue 25495
 Language/Statements/Yield_and_Yield_Each/Yield_Each/location_t05: MissingCompileTimeError # Issue 25495
 
-Language/Expressions/Property_Extraction/General_Super_Property_Extraction: CompileTimeError # Issue 26287
-Language/Expressions/Property_Extraction/Super_Closurization: CompileTimeError # Issue 26287
-
-[ $noopt || $compiler == precompiler || $mode == product ]
+[ $runtime == dart_precompiled || $mode == product ]
 Language/Metadata/*: SkipByDesign # Uses dart:mirrors
 Language/Expressions/Null/instance_of_class_null_t01: Skip # Uses dart:mirrors
 
-[ $noopt || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit || $mode == product ]
+[ $compiler == precompiler || $compiler == app_jit || $mode == product ]
 Language/Libraries_and_Scripts/Imports/deferred_import_t01: Skip # Eager loading
 Language/Libraries_and_Scripts/Imports/deferred_import_t02: Skip # Eager loading
 Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t01: Skip # Eager loading
 Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t02: Skip # Eager loading
 
-[ $runtime == dart_precompiled || $runtime == dart_app ]
+[ $runtime == dart_precompiled ]
 LibTest/isolate/Isolate/spawnUri*: SkipByDesign # Isolate.spawnUri
 
-[ $noopt || $compiler == precompiler ]
+[ $compiler == precompiler ]
 LibTest/collection/ListBase/ListBase_class_A01_t02: Pass, Timeout
 LibTest/collection/ListMixin/ListMixin_class_A01_t02: Pass, Timeout
 LibTest/core/Map/Map_class_A01_t04: Pass, Timeout
 LibTest/core/Uri/encodeQueryComponent_A01_t02: Pass, Timeout
 
-[ $noopt || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
+[ $compiler == precompiler || $compiler == app_jit ]
 Language/Mixins/Mixin_Application/error_t01: Pass
 Language/Mixins/Mixin_Application/error_t02: Pass
 Language/Mixins/declaring_constructor_t01: Pass
@@ -202,8 +178,6 @@
 Language/Expressions/Instance_Creation/Const/deferred_type_t02: Skip # Requires deferred libraries
 Language/Expressions/Instance_Creation/New/evaluation_t19: Skip # Requires deferred libraries
 Language/Expressions/Instance_Creation/New/evaluation_t20: Skip # Requires deferred libraries
-Language/Expressions/Property_Extraction/Anonymous_Constructor_Extraction/deferred_type_t01: Skip # Requires deferred libraries
-Language/Expressions/Property_Extraction/Named_Constructor_Extraction/deferred_type_t01: Skip # Requires deferred libraries
 Language/Expressions/Type_Cast/evaluation_t10: Skip # Requires deferred libraries
 Language/Expressions/Type_Test/evaluation_t10: Skip # Requires deferred libraries
 Language/Libraries_and_Scripts/Imports/deferred_import_t01: Skip # Requires deferred libraries
@@ -231,3 +205,6 @@
 LibTest/isolate/Isolate/spawnUri_A01_t06: Pass, Fail # Timing dependent
 LibTest/isolate/Isolate/spawnUri_A01_t07: Pass, Fail # Timing dependent
 LibTest/isolate/ReceivePort/take_A01_t02: Skip # Issue 27773
+
+[ $runtime == vm && $mode == release && $system == linux && ($arch == x64 || $arch == ia32)]
+LibTest/isolate/Isolate/spawn_A04_t05: Pass, Slow
diff --git a/tests/compiler/dart2js/all_native_test.dart b/tests/compiler/dart2js/all_native_test.dart
new file mode 100644
index 0000000..24cbdb2
--- /dev/null
+++ b/tests/compiler/dart2js/all_native_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/common/names.dart';
+import 'package:compiler/src/commandline_options.dart';
+import 'package:expect/expect.dart';
+import 'memory_compiler.dart';
+
+main() {
+  asyncTest(() async {
+    DiagnosticCollector collector = new DiagnosticCollector();
+    await runCompiler(
+        entryPoint: Uris.dart_html,
+        diagnosticHandler: collector,
+        options: [Flags.analyzeAll, Flags.verbose]);
+    int allNativeUsedCount =
+        collector.verboseInfos.where((CollectedMessage message) {
+      return message.text.startsWith('All native types marked as used due to ');
+    }).length;
+    Expect.equals(
+        1, allNativeUsedCount, "Unexpected message count: $allNativeUsedCount");
+  });
+}
diff --git a/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart b/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart
index c5cd57e..fe8672b 100644
--- a/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart
+++ b/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart
@@ -12,7 +12,8 @@
 import 'package:compiler/src/commandline_options.dart';
 import 'package:compiler/src/constants/expressions.dart'
     show ConstructedConstantExpression;
-import 'package:compiler/src/dart_types.dart' show InterfaceType;
+import 'package:compiler/src/elements/resolution_types.dart'
+    show ResolutionInterfaceType;
 import 'package:compiler/src/diagnostics/source_span.dart' show SourceSpan;
 import 'package:compiler/src/elements/elements.dart';
 import 'package:compiler/src/filenames.dart' show nativeToUriPath;
@@ -161,7 +162,7 @@
   void visitGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -173,7 +174,7 @@
   void visitRedirectingGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -185,7 +186,7 @@
   void visitFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       _) {
@@ -197,9 +198,9 @@
   void visitRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       ConstructorElement effectiveTarget,
-      InterfaceType effectiveTargetType,
+      ResolutionInterfaceType effectiveTargetType,
       NodeList arguments,
       CallStructure callStructure,
       _) {
diff --git a/tests/compiler/dart2js/annotated_code_helper.dart b/tests/compiler/dart2js/annotated_code_helper.dart
new file mode 100644
index 0000000..4d6f8ec
--- /dev/null
+++ b/tests/compiler/dart2js/annotated_code_helper.dart
@@ -0,0 +1,100 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const int _LF = 0x0A;
+const int _CR = 0x0D;
+const int _LBRACE = 0x7B;
+
+class Annotation {
+  /// 1-based line number of the annotation.
+  final int lineNo;
+
+  /// 1-based column number of the annotation.
+  final int columnNo;
+
+  /// 0-based character offset  of the annotation within the source text.
+  final int offset;
+
+  /// The text in the annotation.
+  final String text;
+
+  Annotation(this.lineNo, this.columnNo, this.offset, this.text);
+}
+
+/// A source code text with annotated positions.
+///
+/// An [AnnotatedCode] can be created from a [String] of source code where
+/// annotated positions are embedded using the syntax `@{text}`. For instance
+///
+///     main() {
+///       @{foo-call}foo();
+///       bar@{bar-args}();
+///     }
+///
+///  the position of `foo` call will hold an annotation with text 'foo-call' and
+///  the position of `bar` arguments will hold an annotation with text
+///  'bar-args'.
+///
+///  Annotation text cannot span multiple lines and cannot contain '}'.
+class AnnotatedCode {
+  /// The source code without annotations.
+  final String sourceCode;
+
+  /// The annotations for the source code.
+  final List<Annotation> annotations;
+
+  AnnotatedCode.internal(this.sourceCode, this.annotations);
+
+  /// Creates an [AnnotatedCode] by processing [annotatedCode]. Annotation of
+  /// the form `@{...}` are converted into [Annotation]s and removed from the
+  /// [annotatedCode] to process the source code.
+  factory AnnotatedCode(String annotatedCode) {
+    StringBuffer codeBuffer = new StringBuffer();
+    List<Annotation> annotations = <Annotation>[];
+    int index = 0;
+    int offset = 0;
+    int lineNo = 1;
+    int columnNo = 1;
+    while (index < annotatedCode.length) {
+      int charCode = annotatedCode.codeUnitAt(index);
+      switch (charCode) {
+        case _LF:
+          codeBuffer.write('\n');
+          offset++;
+          lineNo++;
+          columnNo = 1;
+          break;
+        case _CR:
+          if (index + 1 < annotatedCode.length &&
+              annotatedCode.codeUnitAt(index + 1) == _LF) {
+            index++;
+          }
+          codeBuffer.write('\n');
+          offset++;
+          lineNo++;
+          columnNo = 1;
+          break;
+        case 0x40:
+          if (index + 1 < annotatedCode.length &&
+              annotatedCode.codeUnitAt(index + 1) == _LBRACE) {
+            int endIndex = annotatedCode.indexOf('}', index);
+            String text = annotatedCode.substring(index + 2, endIndex);
+            annotations.add(new Annotation(lineNo, columnNo, offset, text));
+            index = endIndex;
+          } else {
+            codeBuffer.writeCharCode(charCode);
+            offset++;
+            columnNo++;
+          }
+          break;
+        default:
+          codeBuffer.writeCharCode(charCode);
+          offset++;
+          columnNo++;
+      }
+      index++;
+    }
+    return new AnnotatedCode.internal(codeBuffer.toString(), annotations);
+  }
+}
diff --git a/tests/compiler/dart2js/assert_message_throw_test.dart b/tests/compiler/dart2js/assert_message_throw_test.dart
index 75a5bb4..a876232 100644
--- a/tests/compiler/dart2js/assert_message_throw_test.dart
+++ b/tests/compiler/dart2js/assert_message_throw_test.dart
@@ -7,6 +7,7 @@
 import 'package:compiler/src/compiler.dart';
 import 'package:compiler/src/elements/elements.dart';
 import 'package:compiler/src/types/masks.dart';
+import 'package:compiler/src/world.dart' show ClosedWorld;
 import 'package:expect/expect.dart';
 import 'memory_compiler.dart';
 import 'type_mask_test_helper.dart';
@@ -58,19 +59,21 @@
         memorySourceFiles: {'main.dart': SOURCE},
         options: [Flags.enableCheckedMode, Flags.enableAssertMessage]);
     Compiler compiler = result.compiler;
+    ClosedWorld closedWorld =
+        compiler.resolutionWorldBuilder.closedWorldForTesting;
 
     void check(String methodName, TypeMask expectedReturnType) {
       Element element = compiler.mainApp.find(methodName);
       TypeMask typeMask = simplify(
           compiler.globalInference.results.resultOf(element).returnType,
-          compiler);
+          closedWorld);
       Expect.equals(expectedReturnType, typeMask,
           "Unexpected return type on method '$methodName'.");
     }
 
-    check('test0', compiler.closedWorld.commonMasks.growableListType);
-    check('test1', compiler.closedWorld.commonMasks.nullType);
-    check('test2', compiler.closedWorld.commonMasks.uint31Type.nullable());
-    check('test3', compiler.closedWorld.commonMasks.intType);
+    check('test0', closedWorld.commonMasks.growableListType);
+    check('test1', closedWorld.commonMasks.nullType);
+    check('test2', closedWorld.commonMasks.uint31Type.nullable());
+    check('test3', closedWorld.commonMasks.intType);
   });
 }
diff --git a/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart b/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart
index f12fe38..44ea2ba 100644
--- a/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart
+++ b/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart
@@ -2,8 +2,9 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/types/masks.dart';
 import 'package:expect/expect.dart';
-import "package:async_helper/async_helper.dart";
 
 import 'compiler_helper.dart';
 import 'type_mask_test_helper.dart';
@@ -206,109 +207,85 @@
   }
 """;
 
-void doTest(String test, bool enableInlining, Function f) {
+typedef List<TypeMask> TestCallback(CommonMasks masks);
+
+void doTest(String test, bool enableInlining, TestCallback f) {
   compileAndFind(test, 'A', 'x', enableInlining, (compiler, element) {
-    var expectedTypes = f(compiler);
+    var inferrer = compiler.globalInference.typesInferrerInternal;
+    var closedWorld = inferrer.closedWorld;
+    var expectedTypes = f(closedWorld.commonMasks);
     var signature = element.functionSignature;
     int index = 0;
-    var inferrer = compiler.globalInference.typesInferrerInternal;
     signature.forEachParameter((Element element) {
       Expect.equals(expectedTypes[index++],
-          simplify(inferrer.getTypeOfElement(element), compiler), test);
+          simplify(inferrer.getTypeOfElement(element), closedWorld), test);
     });
     Expect.equals(index, expectedTypes.length);
   });
 }
 
-void runTest(String test, Function f) {
+void runTest(String test, TestCallback f) {
   doTest(test, false, f);
   doTest(test, true, f);
 }
 
-subclassOfInterceptor(compiler) {
-  return findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
-}
-
 void test() {
-  runTest(TEST_1, (compiler) => [compiler.closedWorld.commonMasks.stringType]);
-  runTest(TEST_2, (compiler) => [compiler.closedWorld.commonMasks.uint31Type]);
-  runTest(TEST_3, (compiler) => [compiler.closedWorld.commonMasks.intType]);
-  runTest(TEST_4, (compiler) => [compiler.closedWorld.commonMasks.numType]);
-  runTest(TEST_5, (compiler) => [compiler.closedWorld.commonMasks.numType]);
-  runTest(TEST_6, (compiler) => [compiler.closedWorld.commonMasks.numType]);
-  runTest(TEST_7a, (compiler) => [subclassOfInterceptor(compiler)]);
-  runTest(
-      TEST_7b,
-      (compiler) =>
-          [compiler.closedWorld.commonMasks.dynamicType.nonNullable()]);
+  runTest(TEST_1, (commonMasks) => [commonMasks.stringType]);
+  runTest(TEST_2, (commonMasks) => [commonMasks.uint31Type]);
+  runTest(TEST_3, (commonMasks) => [commonMasks.intType]);
+  runTest(TEST_4, (commonMasks) => [commonMasks.numType]);
+  runTest(TEST_5, (commonMasks) => [commonMasks.numType]);
+  runTest(TEST_6, (commonMasks) => [commonMasks.numType]);
+  runTest(TEST_7a, (commonMasks) => [commonMasks.interceptorType]);
+  runTest(TEST_7b, (commonMasks) => [commonMasks.dynamicType.nonNullable()]);
 
   runTest(
       TEST_8,
-      (compiler) => [
-            compiler.closedWorld.commonMasks.uint31Type,
-            subclassOfInterceptor(compiler),
-            compiler.closedWorld.commonMasks.dynamicType.nonNullable()
+      (commonMasks) => [
+            commonMasks.uint31Type,
+            commonMasks.interceptorType,
+            commonMasks.dynamicType.nonNullable()
           ]);
-  runTest(
-      TEST_9,
-      (compiler) => [
-            compiler.closedWorld.commonMasks.uint31Type,
-            compiler.closedWorld.commonMasks.uint31Type
-          ]);
-  runTest(
-      TEST_10,
-      (compiler) => [
-            compiler.closedWorld.commonMasks.uint31Type,
-            compiler.closedWorld.commonMasks.uint31Type
-          ]);
+  runTest(TEST_9,
+      (commonMasks) => [commonMasks.uint31Type, commonMasks.uint31Type]);
+  runTest(TEST_10,
+      (commonMasks) => [commonMasks.uint31Type, commonMasks.uint31Type]);
   runTest(
       TEST_11,
-      (compiler) =>
-          [subclassOfInterceptor(compiler), subclassOfInterceptor(compiler)]);
+      (commonMasks) =>
+          [commonMasks.interceptorType, commonMasks.interceptorType]);
+
+  runTest(TEST_12,
+      (commonMasks) => [commonMasks.stringType, commonMasks.uint31Type]);
+
+  runTest(TEST_13, (commonMasks) => [commonMasks.numType]);
+
+  runTest(TEST_14,
+      (commonMasks) => [commonMasks.uint31Type, commonMasks.stringType]);
 
   runTest(
-      TEST_12,
-      (compiler) => [
-            compiler.closedWorld.commonMasks.stringType,
-            compiler.closedWorld.commonMasks.uint31Type
-          ]);
-
-  runTest(TEST_13, (compiler) => [compiler.closedWorld.commonMasks.numType]);
-
-  runTest(
-      TEST_14,
-      (compiler) => [
-            compiler.closedWorld.commonMasks.uint31Type,
-            compiler.closedWorld.commonMasks.stringType
-          ]);
-
-  runTest(
-      TEST_15,
-      (compiler) => [
-            compiler.closedWorld.commonMasks.stringType,
-            compiler.closedWorld.commonMasks.boolType
-          ]);
+      TEST_15, (commonMasks) => [commonMasks.stringType, commonMasks.boolType]);
 
   runTest(
       TEST_16,
-      (compiler) => [
-            compiler.closedWorld.commonMasks.uint31Type,
-            compiler.closedWorld.commonMasks.uint31Type,
-            compiler.closedWorld.commonMasks.stringType
+      (commonMasks) => [
+            commonMasks.uint31Type,
+            commonMasks.uint31Type,
+            commonMasks.stringType
           ]);
 
   runTest(
       TEST_17,
-      (compiler) => [
-            compiler.closedWorld.commonMasks.uint31Type,
-            compiler.closedWorld.commonMasks.boolType,
-            compiler.closedWorld.commonMasks.doubleType
+      (commonMasks) => [
+            commonMasks.uint31Type,
+            commonMasks.boolType,
+            commonMasks.doubleType
           ]);
 
   runTest(
       TEST_18,
-      (compiler) =>
-          [subclassOfInterceptor(compiler), subclassOfInterceptor(compiler)]);
+      (commonMasks) =>
+          [commonMasks.interceptorType, commonMasks.interceptorType]);
 }
 
 void main() {
diff --git a/tests/compiler/dart2js/categories_test.dart b/tests/compiler/dart2js/categories_test.dart
index 677d1a8..48fef4c 100644
--- a/tests/compiler/dart2js/categories_test.dart
+++ b/tests/compiler/dart2js/categories_test.dart
@@ -25,7 +25,5 @@
     await runTest("import 'dart:html'; main() {}", "Server", 1);
     await runTest("import 'dart:io'; main() {}", "Client", 1);
     await runTest("import 'dart:io'; main() {}", "Server", 0);
-    await runTest("import 'dart:_internal'; main() {}", "Client", 1);
-    await runTest("import 'dart:_internal'; main() {}", "Server", 1);
   });
 }
diff --git a/tests/compiler/dart2js/check_elements_invariants_test.dart b/tests/compiler/dart2js/check_elements_invariants_test.dart
index e0c5ee5..fa6bd53 100644
--- a/tests/compiler/dart2js/check_elements_invariants_test.dart
+++ b/tests/compiler/dart2js/check_elements_invariants_test.dart
@@ -19,8 +19,8 @@
 
 Iterable<ClassElement> computeLiveClasses(CompilerImpl compiler) {
   return new Set<ClassElement>()
-    ..addAll(compiler.resolverWorld.directlyInstantiatedClasses)
-    ..addAll(compiler.codegenWorld.directlyInstantiatedClasses);
+    ..addAll(compiler.resolutionWorldBuilder.directlyInstantiatedClasses)
+    ..addAll(compiler.codegenWorldBuilder.directlyInstantiatedClasses);
 }
 
 void checkClassInvariants(ClassElement cls) {
diff --git a/tests/compiler/dart2js/class_set_test.dart b/tests/compiler/dart2js/class_set_test.dart
index 9eea4f1..d5e6624 100644
--- a/tests/compiler/dart2js/class_set_test.dart
+++ b/tests/compiler/dart2js/class_set_test.dart
@@ -50,7 +50,7 @@
       }
       """,
       useMockCompiler: false);
-  ClosedWorld world = env.compiler.closedWorld;
+  ClosedWorld world = env.closedWorld;
 
   ClassElement A = env.getElement("A");
   ClassElement B = env.getElement("B");
@@ -383,7 +383,7 @@
       }
       """,
       useMockCompiler: false);
-  ClosedWorld world = env.compiler.closedWorld;
+  ClosedWorld world = env.closedWorld;
 
   ClassElement A = env.getElement("A");
   ClassElement B = env.getElement("B");
diff --git a/tests/compiler/dart2js/closure_tracer_test.dart b/tests/compiler/dart2js/closure_tracer_test.dart
index f76bea1..b585ea4 100644
--- a/tests/compiler/dart2js/closure_tracer_test.dart
+++ b/tests/compiler/dart2js/closure_tracer_test.dart
@@ -154,13 +154,14 @@
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
-        var commonMasks = compiler.closedWorld.commonMasks;
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
+        var commonMasks = closedWorld.commonMasks;
 
         checkType(String name, type) {
           var element = findElement(compiler, name);
           var mask = typesInferrer.getReturnTypeOfElement(element);
-          Expect.equals(type.nullable(), simplify(mask, compiler), name);
+          Expect.equals(type.nullable(), simplify(mask, closedWorld), name);
         }
 
         checkType('testFunctionStatement', commonMasks.uint31Type);
diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart
index ff3dffa..c21397e 100644
--- a/tests/compiler/dart2js/compiler_helper.dart
+++ b/tests/compiler/dart2js/compiler_helper.dart
@@ -75,11 +75,10 @@
     compiler.enqueuer.resolution
         .applyImpact(compiler.backend.computeHelpersImpact());
     compiler.processQueue(compiler.enqueuer.resolution, element);
-    compiler.openWorld.closeWorld(compiler.reporter);
-    compiler.backend.onResolutionComplete();
     ResolutionWorkItem resolutionWork =
         new ResolutionWorkItem(compiler.resolution, element);
     resolutionWork.run();
+    compiler.closeResolution();
     CodegenWorkItem work = new CodegenWorkItem(compiler.backend, element);
     compiler.phase = Compiler.PHASE_COMPILING;
     work.run();
@@ -198,35 +197,6 @@
   return element;
 }
 
-types.TypeMask findTypeMask(compiler, String name,
-    [String how = 'nonNullExact']) {
-  var sourceName = name;
-  var element = compiler.mainApp.find(sourceName);
-  if (element == null) {
-    element = compiler.backend.helpers.interceptorsLibrary.find(sourceName);
-  }
-  if (element == null) {
-    element = compiler.commonElements.coreLibrary.find(sourceName);
-  }
-  Expect.isNotNull(element, 'Could not locate $name');
-  switch (how) {
-    case 'exact':
-      return new types.TypeMask.exact(element, compiler.closedWorld);
-    case 'nonNullExact':
-      return new types.TypeMask.nonNullExact(element, compiler.closedWorld);
-    case 'subclass':
-      return new types.TypeMask.subclass(element, compiler.closedWorld);
-    case 'nonNullSubclass':
-      return new types.TypeMask.nonNullSubclass(element, compiler.closedWorld);
-    case 'subtype':
-      return new types.TypeMask.subtype(element, compiler.closedWorld);
-    case 'nonNullSubtype':
-      return new types.TypeMask.nonNullSubtype(element, compiler.closedWorld);
-  }
-  Expect.fail('Unknown TypeMask constructor $how');
-  return null;
-}
-
 String anyIdentifier = "[a-zA-Z][a-zA-Z0-9]*";
 
 String getIntTypeCheck(String variable) {
diff --git a/tests/compiler/dart2js/concrete_type_inference_test.dart b/tests/compiler/dart2js/concrete_type_inference_test.dart
index ce5b556..7f6b8cc 100644
--- a/tests/compiler/dart2js/concrete_type_inference_test.dart
+++ b/tests/compiler/dart2js/concrete_type_inference_test.dart
@@ -16,49 +16,52 @@
   });
 }
 
-void checkPrintType(String expression, checkType(compiler, type)) {
+void checkPrintType(String expression, checkType(closedWorld, type)) {
   asyncTest(() => compileAndFind('main() { print($expression); }', 'print',
           (compiler, printElement) {
         var parameter = printElement.functionSignature.requiredParameters.first;
-        checkType(compiler, _typeOf(compiler, parameter));
+        checkType(compiler.resolutionWorldBuilder.closedWorldForTesting,
+            _typeOf(compiler, parameter));
       }));
 
   asyncTest(() =>
       compileAndFind('main() { var x = print; print($expression); }', 'print',
           (compiler, printElement) {
         var parameter = printElement.functionSignature.requiredParameters.first;
-        checkType(compiler, _typeOf(compiler, parameter));
+        checkType(compiler.resolutionWorldBuilder.closedWorldForTesting,
+            _typeOf(compiler, parameter));
       }));
 
   asyncTest(() => compileAndFind(
           'main() { print($expression); print($expression); }', 'print',
           (compiler, printElement) {
         var parameter = printElement.functionSignature.requiredParameters.first;
-        checkType(compiler, _typeOf(compiler, parameter));
+        checkType(compiler.resolutionWorldBuilder.closedWorldForTesting,
+            _typeOf(compiler, parameter));
       }));
 }
 
 void testBasicTypes() {
-  checkPrintType('true', (compiler, type) {
+  checkPrintType('true', (closedWorld, type) {
     if (type.isForwarding) type = type.forwardTo;
-    Expect.identical(compiler.closedWorld.commonMasks.boolType, type);
+    Expect.identical(closedWorld.commonMasks.boolType, type);
   });
-  checkPrintType('1.5', (compiler, type) {
-    Expect.identical(compiler.closedWorld.commonMasks.doubleType, type);
+  checkPrintType('1.5', (closedWorld, type) {
+    Expect.identical(closedWorld.commonMasks.doubleType, type);
   });
-  checkPrintType('1', (compiler, type) {
-    Expect.identical(compiler.closedWorld.commonMasks.uint31Type, type);
+  checkPrintType('1', (closedWorld, type) {
+    Expect.identical(closedWorld.commonMasks.uint31Type, type);
   });
-  checkPrintType('[]', (compiler, type) {
+  checkPrintType('[]', (closedWorld, type) {
     if (type.isForwarding) type = type.forwardTo;
-    Expect.identical(compiler.closedWorld.commonMasks.growableListType, type);
+    Expect.identical(closedWorld.commonMasks.growableListType, type);
   });
-  checkPrintType('null', (compiler, type) {
-    Expect.identical(compiler.closedWorld.commonMasks.nullType, type);
+  checkPrintType('null', (closedWorld, type) {
+    Expect.identical(closedWorld.commonMasks.nullType, type);
   });
-  checkPrintType('"foo"', (compiler, type) {
-    Expect.isTrue(compiler.closedWorld.commonMasks.stringType
-        .containsOnlyString(compiler.closedWorld));
+  checkPrintType('"foo"', (closedWorld, type) {
+    Expect.isTrue(
+        closedWorld.commonMasks.stringType.containsOnlyString(closedWorld));
   });
 }
 
@@ -68,7 +71,8 @@
     var firstParameter = fiskElement.functionSignature.requiredParameters[0];
     var secondParameter = fiskElement.functionSignature.optionalParameters[0];
     var thirdParameter = fiskElement.functionSignature.optionalParameters[1];
-    var commonMasks = compiler.closedWorld.commonMasks;
+    var commonMasks =
+        compiler.resolutionWorldBuilder.closedWorldForTesting.commonMasks;
     Expect.identical(commonMasks.uint31Type, _typeOf(compiler, firstParameter));
     Expect.identical(commonMasks.nullType, _typeOf(compiler, secondParameter));
     Expect.identical(commonMasks.nullType, _typeOf(compiler, thirdParameter));
diff --git a/tests/compiler/dart2js/container_mask_equal_test.dart b/tests/compiler/dart2js/container_mask_equal_test.dart
index 9f67840..5bb5298 100644
--- a/tests/compiler/dart2js/container_mask_equal_test.dart
+++ b/tests/compiler/dart2js/container_mask_equal_test.dart
@@ -31,6 +31,7 @@
     var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
     var compiler = result.compiler;
     var typesInferrer = compiler.globalInference.typesInferrerInternal;
+    var closedWorld = typesInferrer.closedWorld;
 
     var element = compiler.mainApp.find('a');
     var mask1 = typesInferrer.getReturnTypeOfElement(element);
@@ -44,7 +45,7 @@
     element = compiler.mainApp.find('d');
     var mask4 = typesInferrer.getReturnTypeOfElement(element);
 
-    Expect.notEquals(mask1.union(mask2, compiler.closedWorld),
-        mask3.union(mask4, compiler.closedWorld));
+    Expect.notEquals(
+        mask1.union(mask2, closedWorld), mask3.union(mask4, closedWorld));
   });
 }
diff --git a/tests/compiler/dart2js/diagnose_ambiguous_test.dart b/tests/compiler/dart2js/diagnose_ambiguous_test.dart
index 8867a36..268db44 100644
--- a/tests/compiler/dart2js/diagnose_ambiguous_test.dart
+++ b/tests/compiler/dart2js/diagnose_ambiguous_test.dart
@@ -23,9 +23,9 @@
     diagnostics.sort();
     var expected = [
       "MessageKind.AMBIGUOUS_LOCATION:"
-          "memory:exporter.dart:43:47:'hest' is defined here.:info",
+          "memory:exporter.dart:43:49:'hest' is defined here.:info",
       "MessageKind.AMBIGUOUS_LOCATION:"
-          "memory:library.dart:41:45:'hest' is defined here.:info",
+          "memory:library.dart:41:47:'hest' is defined here.:info",
       "MessageKind.DUPLICATE_IMPORT:"
           "memory:main.dart:86:92:Duplicate import of 'hest'.:warning",
       "MessageKind.IMPORTED_HERE:"
diff --git a/tests/compiler/dart2js/diagnostic_helper.dart b/tests/compiler/dart2js/diagnostic_helper.dart
index 7d82a3d..6f63e8a 100644
--- a/tests/compiler/dart2js/diagnostic_helper.dart
+++ b/tests/compiler/dart2js/diagnostic_helper.dart
@@ -65,6 +65,10 @@
     return filterMessagesByKinds([Diagnostic.CRASH]);
   }
 
+  Iterable<CollectedMessage> get verboseInfos {
+    return filterMessagesByKinds([Diagnostic.VERBOSE_INFO]);
+  }
+
   /// `true` if non-verbose messages has been collected.
   bool get hasRegularMessages {
     return messages.any((m) => m.kind != Diagnostic.VERBOSE_INFO);
diff --git a/tests/compiler/dart2js/dictionary_types_test.dart b/tests/compiler/dart2js/dictionary_types_test.dart
index 15a4e57..ff37cab 100644
--- a/tests/compiler/dart2js/dictionary_types_test.dart
+++ b/tests/compiler/dart2js/dictionary_types_test.dart
@@ -105,19 +105,18 @@
 
 void main() {
   asyncTest(() async {
-    await compileAndTest("AddAll.dart", (types, getType, compiler) {
+    await compileAndTest("AddAll.dart", (types, getType, closedWorld) {
       Expect.equals(getType('int'), types.uint31Type);
       Expect.equals(getType('anotherInt'), types.uint31Type);
       Expect.equals(getType('dynamic'), types.dynamicType);
       Expect.equals(getType('nullOrInt'), types.uint31Type.nullable());
     });
-    await compileAndTest("Union.dart", (types, getType, compiler) {
+    await compileAndTest("Union.dart", (types, getType, closedWorld) {
       Expect.equals(getType('nullOrInt'), types.uint31Type.nullable());
-      Expect
-          .isTrue(getType('aString').containsOnlyString(compiler.closedWorld));
+      Expect.isTrue(getType('aString').containsOnlyString(closedWorld));
       Expect.equals(getType('doubleOrNull'), types.doubleType.nullable());
     });
-    await compileAndTest("ValueType.dart", (types, getType, compiler) {
+    await compileAndTest("ValueType.dart", (types, getType, closedWorld) {
       Expect.equals(getType('knownDouble'), types.doubleType);
       Expect.equals(getType('intOrNull'), types.uint31Type.nullable());
       Expect.equals(getType('justNull'), types.nullType);
@@ -125,7 +124,7 @@
     await compileAndTest("Propagation.dart", (code) {
       Expect.isFalse(code.contains("J.\$add\$ns"));
     }, createCode: true);
-    await compileAndTest("Bailout.dart", (types, getType, compiler) {
+    await compileAndTest("Bailout.dart", (types, getType, closedWorld) {
       Expect.equals(getType('notInt'), types.dynamicType);
       Expect.equals(getType('alsoNotInt'), types.dynamicType);
       Expect.isFalse(getType('dict').isDictionary);
@@ -141,15 +140,16 @@
         compiler.stopAfterTypeInference = !createCode;
       });
   var compiler = result.compiler;
-  var commonMasks = compiler.closedWorld.commonMasks;
   var typesInferrer = compiler.globalInference.typesInferrerInternal;
+  var closedWorld = typesInferrer.closedWorld;
+  var commonMasks = closedWorld.commonMasks;
   getType(String name) {
     var element = findElement(compiler, name);
     return typesInferrer.getTypeOfElement(element);
   }
 
   if (!createCode) {
-    checker(commonMasks, getType, compiler);
+    checker(commonMasks, getType, closedWorld);
   } else {
     var element = compiler.mainFunction;
     var code = compiler.backend.getGeneratedCode(element);
diff --git a/tests/compiler/dart2js/dump_info_test.dart b/tests/compiler/dart2js/dump_info_test.dart
index 4d55317..b25f243 100644
--- a/tests/compiler/dart2js/dump_info_test.dart
+++ b/tests/compiler/dart2js/dump_info_test.dart
@@ -104,7 +104,8 @@
   var dumpTask = compiler.dumpInfoTask;
 
   StringBuffer sb = new StringBuffer();
-  dumpTask.dumpInfoJson(sb);
+  dumpTask.dumpInfoJson(
+      sb, compiler.resolutionWorldBuilder.closedWorldForTesting);
   String json = sb.toString();
   Map<String, dynamic> map = JSON.decode(json);
 
diff --git a/tests/compiler/dart2js/embedded_category_api_boundary_test.dart b/tests/compiler/dart2js/embedded_category_api_boundary_test.dart
index c6e391d..1240132 100644
--- a/tests/compiler/dart2js/embedded_category_api_boundary_test.dart
+++ b/tests/compiler/dart2js/embedded_category_api_boundary_test.dart
@@ -37,7 +37,7 @@
 ]);
 
 bool checkResults(Compiler compiler, CollectingDiagnosticHandler handler) {
-  return compiler.enqueuer.resolution.processedElements
+  return compiler.enqueuer.resolution.processedEntities
       .every((Element element) {
     if (whiteList.contains("$element")) return true;
     LibraryInfo info = libraries[element.library.canonicalUri.path];
diff --git a/tests/compiler/dart2js/exit_code_test.dart b/tests/compiler/dart2js/exit_code_test.dart
index 8478d42..dfca8b34 100644
--- a/tests/compiler/dart2js/exit_code_test.dart
+++ b/tests/compiler/dart2js/exit_code_test.dart
@@ -169,8 +169,7 @@
 
   TestResolver(TestCompiler compiler, ConstantCompiler constantCompiler)
       : this.compiler = compiler,
-        super(compiler.resolution, constantCompiler, compiler.openWorld,
-            compiler.measurer);
+        super(compiler.resolution, constantCompiler, compiler.measurer);
 
   void computeClassMembers(ClassElement element) {
     compiler.test('ResolverTask.computeClassMembers');
diff --git a/tests/compiler/dart2js/expect_annotations_test.dart b/tests/compiler/dart2js/expect_annotations_test.dart
index c9c47e0..851dc65 100644
--- a/tests/compiler/dart2js/expect_annotations_test.dart
+++ b/tests/compiler/dart2js/expect_annotations_test.dart
@@ -8,6 +8,7 @@
 import 'package:compiler/src/elements/elements.dart';
 import 'package:compiler/src/js_backend/js_backend.dart';
 import 'package:compiler/src/types/types.dart';
+import 'package:compiler/src/world.dart' show ClosedWorld;
 import 'type_mask_test_helper.dart';
 import 'memory_compiler.dart';
 
@@ -51,6 +52,8 @@
     CompilationResult result =
         await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
     Compiler compiler = result.compiler;
+    ClosedWorld closedWorld =
+        compiler.resolutionWorldBuilder.closedWorldForTesting;
     Expect.isFalse(compiler.compilationFailed, 'Unsuccessful compilation');
     JavaScriptBackend backend = compiler.backend;
     Expect.isNotNull(backend.annotations.expectNoInlineClass,
@@ -65,12 +68,12 @@
       for (ParameterElement parameter in function.parameters) {
         TypeMask type = inferrer.getTypeOfElement(parameter);
         Expect.equals(
-            expectedParameterType, simplify(type, compiler), "$parameter");
+            expectedParameterType, simplify(type, closedWorld), "$parameter");
       }
       if (expectedReturnType != null) {
         TypeMask type = inferrer.getReturnTypeOfElement(function);
         Expect.equals(
-            expectedReturnType, simplify(type, compiler), "$function");
+            expectedReturnType, simplify(type, closedWorld), "$function");
       }
     }
 
@@ -97,15 +100,15 @@
         testTypeMatch(
             method, expectedParameterType, expectedReturnType, inferrer);
       } else if (expectAssumeDynamic) {
-        testTypeMatch(method, compiler.closedWorld.commonMasks.dynamicType,
-            null, inferrer);
+        testTypeMatch(
+            method, closedWorld.commonMasks.dynamicType, null, inferrer);
       }
     }
 
-    TypeMask jsStringType = compiler.closedWorld.commonMasks.stringType;
-    TypeMask jsIntType = compiler.closedWorld.commonMasks.intType;
+    TypeMask jsStringType = closedWorld.commonMasks.stringType;
+    TypeMask jsIntType = closedWorld.commonMasks.intType;
     TypeMask coreStringType = new TypeMask.subtype(
-        compiler.coreClasses.stringClass, compiler.closedWorld);
+        closedWorld.commonElements.stringClass, closedWorld);
 
     test('method');
     test('methodAssumeDynamic', expectAssumeDynamic: true);
diff --git a/tests/compiler/dart2js/field_type_simple_inferer_test.dart b/tests/compiler/dart2js/field_type_simple_inferer_test.dart
index 0e930a0..98defee 100644
--- a/tests/compiler/dart2js/field_type_simple_inferer_test.dart
+++ b/tests/compiler/dart2js/field_type_simple_inferer_test.dart
@@ -5,8 +5,7 @@
 import 'package:expect/expect.dart';
 import 'package:async_helper/async_helper.dart';
 import 'package:compiler/src/types/types.dart' show TypeMask;
-import 'package:compiler/src/types/masks.dart' show CommonMasks;
-import 'package:compiler/src/compiler.dart' show Compiler;
+import 'package:compiler/src/world.dart' show ClosedWorld;
 
 import 'compiler_helper.dart';
 import 'type_mask_test_helper.dart';
@@ -471,16 +470,17 @@
   }
 """;
 
-typedef TypeMask TestCallback(Compiler compiler, CommonMasks masks);
+typedef TypeMask TestCallback(ClosedWorld closedWorld);
 
 void doTest(
     String test, bool disableInlining, Map<String, TestCallback> fields) {
   fields.forEach((String name, TestCallback f) {
     compileAndFind(test, 'A', name, disableInlining, (compiler, field) {
-      TypeMask type = f(compiler, compiler.closedWorld.commonMasks);
       var inferrer = compiler.globalInference.typesInferrerInternal;
+      var closedWorld = inferrer.closedWorld;
+      TypeMask type = f(closedWorld);
       TypeMask inferredType =
-          simplify(inferrer.getTypeOfElement(field), inferrer.compiler);
+          simplify(inferrer.getTypeOfElement(field), closedWorld);
       Expect.equals(type, inferredType, test);
     });
   });
@@ -492,114 +492,122 @@
 }
 
 void test() {
-  TypeMask subclassOfInterceptor(Compiler compiler, CommonMasks types) =>
-      findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
-
-  runTest(
-      TEST_1, <String, TestCallback>{'f': (compiler, types) => types.nullType});
+  runTest(TEST_1, <String, TestCallback>{
+    'f': (closedWorld) => closedWorld.commonMasks.nullType
+  });
   runTest(TEST_2, <String, TestCallback>{
-    'f1': (compiler, types) => types.nullType,
-    'f2': (compiler, types) => types.uint31Type
+    'f1': (closedWorld) => closedWorld.commonMasks.nullType,
+    'f2': (closedWorld) => closedWorld.commonMasks.uint31Type
   });
   runTest(TEST_3, <String, TestCallback>{
-    'f1': (compiler, types) => types.uint31Type,
-    'f2': (compiler, types) => types.uint31Type.nullable()
+    'f1': (closedWorld) => closedWorld.commonMasks.uint31Type,
+    'f2': (closedWorld) => closedWorld.commonMasks.uint31Type.nullable()
   });
   runTest(TEST_4, <String, TestCallback>{
-    'f1': subclassOfInterceptor,
-    'f2': (compiler, types) => types.stringType.nullable()
+    'f1': (closedWorld) => closedWorld.commonMasks.interceptorType,
+    'f2': (closedWorld) => closedWorld.commonMasks.stringType.nullable()
   });
 
   // TODO(ngeoffray): We should try to infer that the initialization
   // code at the declaration site of the fields does not matter.
   runTest(TEST_5, <String, TestCallback>{
-    'f1': subclassOfInterceptor,
-    'f2': subclassOfInterceptor
+    'f1': (closedWorld) => closedWorld.commonMasks.interceptorType,
+    'f2': (closedWorld) => closedWorld.commonMasks.interceptorType,
   });
   runTest(TEST_6, <String, TestCallback>{
-    'f1': subclassOfInterceptor,
-    'f2': subclassOfInterceptor
+    'f1': (closedWorld) => closedWorld.commonMasks.interceptorType,
+    'f2': (closedWorld) => closedWorld.commonMasks.interceptorType,
   });
   runTest(TEST_7, <String, TestCallback>{
-    'f1': subclassOfInterceptor,
-    'f2': subclassOfInterceptor
+    'f1': (closedWorld) => closedWorld.commonMasks.interceptorType,
+    'f2': (closedWorld) => closedWorld.commonMasks.interceptorType,
   });
 
   runTest(TEST_8, <String, TestCallback>{
-    'f': (compiler, types) => types.stringType.nullable()
+    'f': (closedWorld) => closedWorld.commonMasks.stringType.nullable()
   });
   runTest(TEST_9, <String, TestCallback>{
-    'f': (compiler, types) => types.stringType.nullable()
+    'f': (closedWorld) => closedWorld.commonMasks.stringType.nullable()
   });
-  runTest(TEST_10,
-      <String, TestCallback>{'f': (compiler, types) => types.uint31Type});
-  runTest(TEST_11,
-      <String, TestCallback>{'fs': (compiler, types) => types.uint31Type});
+  runTest(TEST_10, <String, TestCallback>{
+    'f': (closedWorld) => closedWorld.commonMasks.uint31Type
+  });
+  runTest(TEST_11, <String, TestCallback>{
+    'fs': (closedWorld) => closedWorld.commonMasks.uint31Type
+  });
 
   // TODO(ngeoffray): We should try to infer that the initialization
   // code at the declaration site of the fields does not matter.
-  runTest(TEST_12, <String, TestCallback>{'fs': subclassOfInterceptor});
+  runTest(TEST_12, <String, TestCallback>{
+    'fs': (closedWorld) => closedWorld.commonMasks.interceptorType
+  });
 
-  runTest(TEST_13,
-      <String, TestCallback>{'fs': (compiler, types) => types.uint31Type});
-  runTest(TEST_14,
-      <String, TestCallback>{'f': (compiler, types) => types.uint31Type});
+  runTest(TEST_13, <String, TestCallback>{
+    'fs': (closedWorld) => closedWorld.commonMasks.uint31Type
+  });
+  runTest(TEST_14, <String, TestCallback>{
+    'f': (closedWorld) => closedWorld.commonMasks.uint31Type
+  });
   runTest(TEST_15, <String, TestCallback>{
-    'f': (compiler, types) {
-      ClassElement cls = compiler.backend.helpers.jsIndexableClass;
-      return new TypeMask.nonNullSubtype(cls, compiler.closedWorld);
+    'f': (closedWorld) {
+      ClassElement cls = closedWorld.backendClasses.indexableImplementation;
+      return new TypeMask.nonNullSubtype(cls, closedWorld);
     }
   });
-  runTest(TEST_16, <String, TestCallback>{'f': subclassOfInterceptor});
+  runTest(TEST_16, <String, TestCallback>{
+    'f': (closedWorld) => closedWorld.commonMasks.interceptorType
+  });
   runTest(TEST_17, <String, TestCallback>{
-    'f': (compiler, types) => types.uint31Type.nullable()
+    'f': (closedWorld) => closedWorld.commonMasks.uint31Type.nullable()
   });
   runTest(TEST_18, <String, TestCallback>{
-    'f1': (compiler, types) => types.uint31Type,
-    'f2': (compiler, types) => types.stringType,
-    'f3': (compiler, types) => types.dynamicType
+    'f1': (closedWorld) => closedWorld.commonMasks.uint31Type,
+    'f2': (closedWorld) => closedWorld.commonMasks.stringType,
+    'f3': (closedWorld) => closedWorld.commonMasks.dynamicType
   });
   runTest(TEST_19, <String, TestCallback>{
-    'f1': (compiler, types) => types.uint31Type,
-    'f2': (compiler, types) => types.stringType,
-    'f3': (compiler, types) => types.dynamicType
+    'f1': (closedWorld) => closedWorld.commonMasks.uint31Type,
+    'f2': (closedWorld) => closedWorld.commonMasks.stringType,
+    'f3': (closedWorld) => closedWorld.commonMasks.dynamicType
   });
   runTest(TEST_20, <String, TestCallback>{
-    'f': (compiler, types) => types.uint31Type.nullable()
+    'f': (closedWorld) => closedWorld.commonMasks.uint31Type.nullable()
   });
   runTest(TEST_21, <String, TestCallback>{
-    'f': (compiler, types) => types.uint31Type.nullable()
+    'f': (closedWorld) => closedWorld.commonMasks.uint31Type.nullable()
   });
 
   runTest(TEST_22, <String, TestCallback>{
-    'f1': (compiler, types) => types.uint31Type,
-    'f2': (compiler, types) => types.uint31Type,
-    'f3': (compiler, types) => types.stringType.nullable()
+    'f1': (closedWorld) => closedWorld.commonMasks.uint31Type,
+    'f2': (closedWorld) => closedWorld.commonMasks.uint31Type,
+    'f3': (closedWorld) => closedWorld.commonMasks.stringType.nullable()
   });
 
   runTest(TEST_23, <String, TestCallback>{
-    'f1': (compiler, types) => types.uint31Type.nullable(),
-    'f2': (compiler, types) => types.uint31Type.nullable(),
-    'f3': (compiler, types) => types.uint31Type.nullable(),
-    'f4': (compiler, types) => types.uint31Type.nullable()
+    'f1': (closedWorld) => closedWorld.commonMasks.uint31Type.nullable(),
+    'f2': (closedWorld) => closedWorld.commonMasks.uint31Type.nullable(),
+    'f3': (closedWorld) => closedWorld.commonMasks.uint31Type.nullable(),
+    'f4': (closedWorld) => closedWorld.commonMasks.uint31Type.nullable()
   });
 
   runTest(TEST_24, <String, TestCallback>{
-    'f1': (compiler, types) => types.positiveIntType,
-    'f2': (compiler, types) => types.positiveIntType,
-    'f3': (compiler, types) => types.uint31Type,
-    'f4': (compiler, types) => types.uint31Type,
-    'f5': (compiler, types) => types.numType.nullable(),
-    'f6': (compiler, types) => types.stringType.nullable()
+    'f1': (closedWorld) => closedWorld.commonMasks.positiveIntType,
+    'f2': (closedWorld) => closedWorld.commonMasks.positiveIntType,
+    'f3': (closedWorld) => closedWorld.commonMasks.uint31Type,
+    'f4': (closedWorld) => closedWorld.commonMasks.uint31Type,
+    'f5': (closedWorld) => closedWorld.commonMasks.numType.nullable(),
+    'f6': (closedWorld) => closedWorld.commonMasks.stringType.nullable()
   });
 
-  runTest(TEST_25,
-      <String, TestCallback>{'f1': (compiler, types) => types.uint31Type});
-  runTest(TEST_26,
-      <String, TestCallback>{'f1': (compiler, types) => types.positiveIntType});
+  runTest(TEST_25, <String, TestCallback>{
+    'f1': (closedWorld) => closedWorld.commonMasks.uint31Type
+  });
+  runTest(TEST_26, <String, TestCallback>{
+    'f1': (closedWorld) => closedWorld.commonMasks.positiveIntType
+  });
   runTest(TEST_27, <String, TestCallback>{
-    'f1': (compiler, types) => types.uint31Type,
-    'f2': (compiler, types) => types.uint31Type.nullable()
+    'f1': (closedWorld) => closedWorld.commonMasks.uint31Type,
+    'f2': (closedWorld) => closedWorld.commonMasks.uint31Type.nullable()
   });
 }
 
diff --git a/tests/compiler/dart2js/flatten_test.dart b/tests/compiler/dart2js/flatten_test.dart
index 4b60d02..c624e48 100644
--- a/tests/compiler/dart2js/flatten_test.dart
+++ b/tests/compiler/dart2js/flatten_test.dart
@@ -7,7 +7,7 @@
 import 'package:expect/expect.dart';
 import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import "package:compiler/src/elements/elements.dart" show Element, ClassElement;
 
 void main() {
@@ -16,8 +16,9 @@
       abstract class G<T> implements Future<G<T>> {}
       abstract class H<T> implements Future<H<H<T>>> {}
       """).then((env) {
-        void check(DartType T, DartType expectedFlattenedType) {
-          DartType flattenedType = env.flatten(T);
+        void check(
+            ResolutionDartType T, ResolutionDartType expectedFlattenedType) {
+          ResolutionDartType flattenedType = env.flatten(T);
           Expect.equals(
               expectedFlattenedType,
               flattenedType,
@@ -29,13 +30,13 @@
         ClassElement F = env.getElement('F');
         ClassElement G = env.getElement('G');
         ClassElement H = env.getElement('H');
-        DartType int_ = env['int'];
-        DartType dynamic_ = env['dynamic'];
-        DartType Future_int = instantiate(Future_, [int_]);
-        DartType F_int = instantiate(F, [int_]);
-        DartType G_int = instantiate(G, [int_]);
-        DartType H_int = instantiate(H, [int_]);
-        DartType H_H_int = instantiate(H, [H_int]);
+        ResolutionDartType int_ = env['int'];
+        ResolutionDartType dynamic_ = env['dynamic'];
+        ResolutionDartType Future_int = instantiate(Future_, [int_]);
+        ResolutionDartType F_int = instantiate(F, [int_]);
+        ResolutionDartType G_int = instantiate(G, [int_]);
+        ResolutionDartType H_int = instantiate(H, [int_]);
+        ResolutionDartType H_H_int = instantiate(H, [H_int]);
 
         // flatten(int) = int
         check(int_, int_);
diff --git a/tests/compiler/dart2js/generic_method_type_usage_test.dart b/tests/compiler/dart2js/generic_method_type_usage_test.dart
index bbaae78..9354cba 100644
--- a/tests/compiler/dart2js/generic_method_type_usage_test.dart
+++ b/tests/compiler/dart2js/generic_method_type_usage_test.dart
@@ -69,13 +69,18 @@
   aFunction<Set>();
 }
 ''',
-
   'dynamic_as_type_argument.dart': '''
 main() {
   method<dynamic>();
 }
 method<T>() {}
 ''',
+  'malformed_type_argument.dart': '''
+main() {
+  method<Unresolved>();
+}
+method<T>() {}
+''',
 };
 
 Future runTest(Uri main, {MessageKind warning, MessageKind info}) async {
@@ -114,5 +119,8 @@
         warning: MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE);
 
     await runTest(Uri.parse('memory:dynamic_as_type_argument.dart'));
+
+    await runTest(Uri.parse('memory:malformed_type_argument.dart'),
+        warning: MessageKind.CANNOT_RESOLVE_TYPE);
   });
 }
diff --git a/tests/compiler/dart2js/gvn_dynamic_field_get_test.dart b/tests/compiler/dart2js/gvn_dynamic_field_get_test.dart
index eb58e74..205682c 100644
--- a/tests/compiler/dart2js/gvn_dynamic_field_get_test.dart
+++ b/tests/compiler/dart2js/gvn_dynamic_field_get_test.dart
@@ -36,7 +36,7 @@
         var element = cls.lookupLocalMember(name);
         Expect.isNotNull(element);
         Selector selector = new Selector.getter(new PublicName(name));
-        Expect.isFalse(
-            compiler.closedWorld.hasAnyUserDefinedGetter(selector, null));
+        Expect.isFalse(compiler.resolutionWorldBuilder.closedWorldForTesting
+            .hasAnyUserDefinedGetter(selector, null));
       }));
 }
diff --git a/tests/compiler/dart2js/inference/enumerator.dart b/tests/compiler/dart2js/inference/enumerator.dart
new file mode 100644
index 0000000..07328da
--- /dev/null
+++ b/tests/compiler/dart2js/inference/enumerator.dart
@@ -0,0 +1,52 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:compiler/src/resolution/access_semantics.dart';
+import 'package:compiler/src/resolution/send_structure.dart';
+import 'package:compiler/src/resolution/tree_elements.dart';
+import 'package:compiler/src/tree/nodes.dart' as ast;
+
+/// Id for a code point with type inference information.
+// TODO(johnniwinther): Create an [Id]-based equivalence with the kernel IR.
+class Id {
+  final int value;
+
+  const Id(this.value);
+
+  int get hashCode => value.hashCode;
+
+  bool operator ==(other) {
+    if (identical(this, other)) return true;
+    if (other is! Id) return false;
+    return value == other.value;
+  }
+
+  String toString() => value.toString();
+}
+
+abstract class AstEnumeratorMixin {
+  TreeElements get elements;
+
+  Id computeAccessId(ast.Send node, AccessSemantics access) {
+    switch (access.kind) {
+      case AccessKind.DYNAMIC_PROPERTY:
+        return new Id(node.selector.getBeginToken().charOffset);
+      default:
+        return new Id(node.getBeginToken().charOffset);
+    }
+  }
+
+  Id computeId(ast.Send node) {
+    var sendStructure = elements.getSendStructure(node);
+    if (sendStructure == null) return null;
+    switch (sendStructure.kind) {
+      case SendStructureKind.GET:
+      case SendStructureKind.INVOKE:
+      case SendStructureKind.INCOMPATIBLE_INVOKE:
+        return computeAccessId(node, sendStructure.semantics);
+      default:
+        return new Id(node.getBeginToken().charOffset);
+    }
+  }
+}
diff --git a/tests/compiler/dart2js/inference/inference_test_helper.dart b/tests/compiler/dart2js/inference/inference_test_helper.dart
new file mode 100644
index 0000000..4a916af
--- /dev/null
+++ b/tests/compiler/dart2js/inference/inference_test_helper.dart
@@ -0,0 +1,106 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:compiler/src/common.dart';
+import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/elements/elements.dart';
+import 'package:compiler/src/resolution/tree_elements.dart';
+import 'package:compiler/src/tree/nodes.dart';
+import 'package:compiler/src/types/types.dart';
+import 'package:expect/expect.dart';
+
+import '../annotated_code_helper.dart';
+import '../memory_compiler.dart';
+import 'enumerator.dart';
+
+checkCode(String annotatedCode) async {
+  AnnotatedCode code = new AnnotatedCode(annotatedCode);
+  Map<Id, String> expectedMap = computeExpectedMap(code);
+  Compiler compiler =
+      compilerFor(memorySourceFiles: {'main.dart': code.sourceCode});
+  compiler.stopAfterTypeInference = true;
+  Uri mainUri = Uri.parse('memory:main.dart');
+  await compiler.run(mainUri);
+  compiler.mainApp.forEachLocalMember((member) {
+    if (member.isFunction) {
+      checkMember(compiler, expectedMap, member);
+    } else if (member.isClass) {
+      member.forEachLocalMember((member) {
+        checkMember(compiler, expectedMap, member);
+      });
+    }
+  });
+  expectedMap.forEach((Id id, String expected) {
+    reportHere(
+        compiler.reporter,
+        new SourceSpan(mainUri, id.value, id.value + 1),
+        'expected:${expected},actual:null');
+  });
+}
+
+void checkMember(
+    Compiler compiler, Map<Id, String> expectedMap, MemberElement member) {
+  ResolvedAst resolvedAst = member.resolvedAst;
+  if (resolvedAst.kind != ResolvedAstKind.PARSED) return;
+  compiler.reporter.withCurrentElement(member.implementation, () {
+    resolvedAst.node.accept(new TypeMaskChecker(
+        compiler.reporter,
+        expectedMap,
+        resolvedAst.elements,
+        compiler.globalInference.results.resultOf(member)));
+  });
+}
+
+Map<Id, String> computeExpectedMap(AnnotatedCode code) {
+  Map<Id, String> map = <Id, String>{};
+  for (Annotation annotation in code.annotations) {
+    map[new Id(annotation.offset)] = annotation.text;
+  }
+  return map;
+}
+
+class TypeMaskChecker extends Visitor with AstEnumeratorMixin {
+  final DiagnosticReporter reporter;
+  final Map<Id, String> expectedMap;
+  final TreeElements elements;
+  final GlobalTypeInferenceElementResult result;
+
+  TypeMaskChecker(this.reporter, this.expectedMap, this.elements, this.result);
+
+  visitNode(Node node) {
+    node.visitChildren(this);
+  }
+
+  String annotationForId(Id id) {
+    if (id == null) return null;
+    return expectedMap.remove(id);
+  }
+
+  void checkValue(Node node, String expected, TypeMask value) {
+    if (value != null || expected != null) {
+      String valueText = '$value';
+      if (valueText != expected) {
+        reportHere(reporter, node, 'expected:${expected},actual:${value}');
+      }
+      Expect.equals(expected, valueText);
+    }
+  }
+
+  void checkSend(Send node) {
+    Id id = computeId(node);
+    TypeMask value = result.typeOfSend(node);
+    String expected = annotationForId(id);
+    checkValue(node, expected, value);
+  }
+
+  visitSend(Send node) {
+    checkSend(node);
+    visitNode(node);
+  }
+
+  visitSendSet(SendSet node) {
+    checkSend(node);
+    visitNode(node);
+  }
+}
diff --git a/tests/compiler/dart2js/inference/send_test.dart b/tests/compiler/dart2js/inference/send_test.dart
new file mode 100644
index 0000000..4aaae6d
--- /dev/null
+++ b/tests/compiler/dart2js/inference/send_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:async_helper/async_helper.dart';
+import 'inference_test_helper.dart';
+
+const List<String> TESTS = const <String>[
+  '''
+class Super {
+  var field = 42;
+}
+class Sub extends Super {
+  method() {
+   var a = super.field = new Sub();
+   return a.@{[exact=Sub]}method;
+  }
+}
+main() {
+  new Sub().@{[exact=Sub]}method();
+}
+''',
+];
+
+main() {
+  asyncTest(() async {
+    for (String annotatedCode in TESTS) {
+      await checkCode(annotatedCode);
+    }
+  });
+}
diff --git a/tests/compiler/dart2js/instantiated_classes_test.dart b/tests/compiler/dart2js/instantiated_classes_test.dart
index adeca4c..35232db 100644
--- a/tests/compiler/dart2js/instantiated_classes_test.dart
+++ b/tests/compiler/dart2js/instantiated_classes_test.dart
@@ -93,7 +93,7 @@
     Iterable<ClassElement> expectedClasses =
         directlyInstantiatedClasses.map(env.getElement);
     Iterable<ClassElement> actualClasses = env
-        .compiler.resolverWorld.directlyInstantiatedClasses
+        .compiler.resolutionWorldBuilder.directlyInstantiatedClasses
         .where((c) => c.library == env.compiler.mainApp);
     Expect.setEquals(expectedClasses, actualClasses);
   });
diff --git a/tests/compiler/dart2js/issue13354_test.dart b/tests/compiler/dart2js/issue13354_test.dart
index ecf8dba..cf87020 100644
--- a/tests/compiler/dart2js/issue13354_test.dart
+++ b/tests/compiler/dart2js/issue13354_test.dart
@@ -29,14 +29,16 @@
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
-        var commonMasks = compiler.closedWorld.commonMasks;
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
+        var commonMasks = closedWorld.commonMasks;
 
         checkReturn(String name, type) {
           var element = findElement(compiler, name);
           Expect.equals(
               type,
-              simplify(typesInferrer.getReturnTypeOfElement(element), compiler),
+              simplify(
+                  typesInferrer.getReturnTypeOfElement(element), closedWorld),
               name);
         }
 
@@ -46,7 +48,7 @@
           Expect.equals(
               type,
               simplify(
-                  typesInferrer.getReturnTypeOfElement(element), compiler));
+                  typesInferrer.getReturnTypeOfElement(element), closedWorld));
         }
 
         checkReturn('bar', commonMasks.uint31Type);
diff --git a/tests/compiler/dart2js/jsinterop/world_test.dart b/tests/compiler/dart2js/jsinterop/world_test.dart
index 074860f..bed24f3 100644
--- a/tests/compiler/dart2js/jsinterop/world_test.dart
+++ b/tests/compiler/dart2js/jsinterop/world_test.dart
@@ -7,8 +7,10 @@
 import 'package:expect/expect.dart';
 import 'package:async_helper/async_helper.dart';
 import 'package:compiler/src/common.dart';
-import 'package:compiler/src/elements/elements.dart' show Element, ClassElement;
+import 'package:compiler/src/elements/elements.dart'
+    show ClassElement, PublicName;
 import 'package:compiler/src/js_backend/js_backend.dart';
+import 'package:compiler/src/universe/selector.dart';
 import 'package:compiler/src/world.dart';
 import '../type_test_helper.dart';
 
@@ -87,9 +89,10 @@
       return cls;
     }
 
-    ClosedWorld world = env.compiler.closedWorld;
+    ClosedWorld world = env.closedWorld;
     JavaScriptBackend backend = env.compiler.backend;
-    ClassElement Object_ = registerClass(env.compiler.coreClasses.objectClass);
+    ClassElement Object_ =
+        registerClass(env.compiler.commonElements.objectClass);
     ClassElement Interceptor =
         registerClass(backend.helpers.jsInterceptorClass);
     ClassElement JavaScriptObject =
@@ -101,6 +104,8 @@
     ClassElement E = registerClass(env.getElement('E'));
     ClassElement F = registerClass(env.getElement('F'));
 
+    Selector nonExisting = new Selector.getter(const PublicName('nonExisting'));
+
     Expect.equals(Interceptor.superclass, Object_);
     Expect.equals(JavaScriptObject.superclass, Interceptor);
 
@@ -127,6 +132,15 @@
             world.isAbstractlyInstantiated(cls),
             "Expected $name to be abstractly instantiated in `${mainSource}`:"
             "\n${world.dump(cls)}");
+        Expect.isTrue(
+            world.needsNoSuchMethod(cls, nonExisting, ClassQuery.EXACT),
+            "Expected $name to need noSuchMethod for $nonExisting.");
+        Expect.isTrue(
+            world.needsNoSuchMethod(cls, nonExisting, ClassQuery.SUBCLASS),
+            "Expected $name to need noSuchMethod for $nonExisting.");
+        Expect.isTrue(
+            world.needsNoSuchMethod(cls, nonExisting, ClassQuery.SUBTYPE),
+            "Expected $name to need noSuchMethod for $nonExisting.");
       }
       if (indirectlyInstantiated.contains(name)) {
         isInstantiated = true;
diff --git a/tests/compiler/dart2js/kernel/assert_test.dart b/tests/compiler/dart2js/kernel/assert_test.dart
index 48c8997..700bf42 100644
--- a/tests/compiler/dart2js/kernel/assert_test.dart
+++ b/tests/compiler/dart2js/kernel/assert_test.dart
@@ -23,10 +23,9 @@
 main() {
   assert(foo(), "foo failed");
 }''';
-    return check(code,
-        extraOptions: const <String>[
-          Flags.enableCheckedMode,
-          Flags.enableAssertMessage,
-        ]);
+    return check(code, extraOptions: const <String>[
+      Flags.enableCheckedMode,
+      Flags.enableAssertMessage,
+    ]);
   });
 }
diff --git a/tests/compiler/dart2js/kernel/class_hierarchy_test.dart b/tests/compiler/dart2js/kernel/class_hierarchy_test.dart
index 9b6aa08..bb90c67 100644
--- a/tests/compiler/dart2js/kernel/class_hierarchy_test.dart
+++ b/tests/compiler/dart2js/kernel/class_hierarchy_test.dart
@@ -31,12 +31,13 @@
       '''
   }, options: [
     Flags.analyzeOnly,
-    Flags.analyzeMain,
+    Flags.analyzeAll,
     Flags.useKernel
   ]);
   test('mixin', () async {
     Uri mainUri = Uri.parse('memory:main.dart');
-    LibraryElement library = await compiler.analyzeUri(mainUri);
+    await compiler.run(mainUri);
+    LibraryElement library = await compiler.libraryLoader.loadLibrary(mainUri);
     JavaScriptBackend backend = compiler.backend;
     ir.Program program = backend.kernelTask.buildProgram(library);
     ClassHierarchy hierarchy = new ClassHierarchy(program);
diff --git a/tests/compiler/dart2js/kernel/closed_world_test.dart b/tests/compiler/dart2js/kernel/closed_world_test.dart
index cf642fa..6a3f583 100644
--- a/tests/compiler/dart2js/kernel/closed_world_test.dart
+++ b/tests/compiler/dart2js/kernel/closed_world_test.dart
@@ -11,7 +11,7 @@
 import 'package:compiler/src/common.dart';
 import 'package:compiler/src/common/resolution.dart';
 import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/elements/elements.dart';
 import 'package:compiler/src/enqueue.dart';
 import 'package:compiler/src/js_backend/backend.dart';
@@ -76,11 +76,11 @@
           Flags.enableAssertMessage
         ]);
     ResolutionWorldBuilderImpl worldBuilder =
-        compiler.enqueuer.resolution.universe;
+        compiler.enqueuer.resolution.worldBuilder;
     worldBuilder.useInstantiationMap = true;
     compiler.resolution.retainCachesForTesting = true;
     await compiler.run(entryPoint);
-    compiler.openWorld.closeWorld(compiler.reporter);
+    compiler.resolutionWorldBuilder.closeWorld(compiler.reporter);
 
     JavaScriptBackend backend = compiler.backend;
     // Create a new resolution enqueuer and feed it with the [WorldImpact]s
@@ -92,7 +92,6 @@
         const TreeShakingEnqueuerStrategy(),
         compiler.globalDependencies,
         backend,
-        compiler.commonElements,
         compiler.cacheStrategy,
         'enqueuer from kernel');
     // TODO(johnniwinther): Store backend info separately. This replacement is
@@ -113,14 +112,13 @@
       ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst);
       WorldImpact worldImpact = compiler.backend.impactTransformer
           .transformResolutionImpact(enqueuer, resolutionImpact);
-      enqueuer.registerProcessedElement(element);
       enqueuer.applyImpact(worldImpact, impactSource: element);
     });
     ClosedWorld closedWorld =
-        enqueuer.universe.openWorld.closeWorld(compiler.reporter);
+        enqueuer.worldBuilder.closeWorld(compiler.reporter);
 
     checkResolutionEnqueuers(compiler.enqueuer.resolution, enqueuer,
-        typeEquivalence: (DartType a, DartType b) {
+        typeEquivalence: (ResolutionDartType a, ResolutionDartType b) {
       return areTypesEquivalent(unalias(a), unalias(b));
     }, elementFilter: (Element element) {
       if (element is ConstructorElement && element.isRedirectingFactory) {
@@ -138,7 +136,8 @@
       }
       return true;
     }, verbose: arguments.verbose);
-    checkClosedWorlds(compiler.closedWorld, closedWorld,
+    checkClosedWorlds(
+        compiler.resolutionWorldBuilder.closedWorldForTesting, closedWorld,
         verbose: arguments.verbose);
   });
 }
diff --git a/tests/compiler/dart2js/kernel/constructors_test.dart b/tests/compiler/dart2js/kernel/constructors_test.dart
index 1d30c1c..2664910 100644
--- a/tests/compiler/dart2js/kernel/constructors_test.dart
+++ b/tests/compiler/dart2js/kernel/constructors_test.dart
@@ -33,6 +33,40 @@
 }''';
     return check(code, lookup: defaultConstructorFor('A'));
   });
+
+  test('redirecting constructor with field', () {
+    String code = '''
+class Foo {
+  final int value;
+  const Foo({int number: 0}) : this.poodle(number * 2);
+  const Foo.poodle(this.value);
+}
+
+main() => new Foo(number: 3);
+''';
+    return check(code, lookup: defaultConstructorFor('Foo'));
+  });
+
+  // TODO(efortuna): Kernel needs to have some additional constructor
+  // implementaion work before this is legitimately equivalent code to the
+  // original AST.
+/*  test('initialized field and constructor', () {
+    String code = '''
+import 'dart:_foreign_helper' show JS, JS_EMBEDDED_GLOBAL;
+import 'package:expect/expect.dart';
+
+
+class Foo {
+  final value = JS('bool', '#()', JS_EMBEDDED_GLOBAL('', 'foo'));
+  Foo() {
+    print('hello world');
+  }
+}
+
+main() => new Foo();
+''';
+    return check(code, lookup: defaultConstructorFor('Foo'));
+  });*/
 }
 
 defaultConstructorFor(String className) => (Compiler compiler) {
diff --git a/tests/compiler/dart2js/kernel/impact_test.dart b/tests/compiler/dart2js/kernel/impact_test.dart
index fd2467f..e011e2d 100644
--- a/tests/compiler/dart2js/kernel/impact_test.dart
+++ b/tests/compiler/dart2js/kernel/impact_test.dart
@@ -11,7 +11,7 @@
 import 'package:compiler/src/common/resolution.dart';
 import 'package:compiler/src/compiler.dart';
 import 'package:compiler/src/constants/expressions.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/elements/elements.dart';
 import 'package:compiler/src/resolution/registry.dart';
 import 'package:compiler/src/resolution/tree_elements.dart';
@@ -168,6 +168,8 @@
   testForwardingConstructorTyped();
   testForwardingConstructorGeneric();
   testEnum();
+  testStaticGenericMethod();
+  testInstanceGenericMethod();
 }
 
 testEmpty() {}
@@ -583,6 +585,15 @@
 
 enum Enum { A }
 testEnum() => Enum.A;
+
+List<T> staticGenericMethod<T>(T arg) => [arg];
+testStaticGenericMethod() {
+  staticGenericMethod<int>(0);
+}
+
+testInstanceGenericMethod() {
+  new GenericClass<int, String>.generative().genericMethod<bool>(false);
+}
 ''',
   'helper.dart': '''
 class Class {
@@ -594,6 +605,8 @@
   const GenericClass.generative();
   factory GenericClass.fact() => null;
   const factory GenericClass.redirect() = GenericClass<X, Y>.generative;
+
+  Map<X, T> genericMethod<T>(T arg) => { null: arg };
 }
 typedef Typedef();
 typedef X GenericTypedef<X, Y>(Y y);
@@ -601,6 +614,7 @@
 };
 
 main(List<String> args) {
+  bool fullTest = args.contains('--full');
   asyncTest(() async {
     enableDebugMode();
     Uri entryPoint = Uri.parse('memory:main.dart');
@@ -608,15 +622,20 @@
         entryPoint: entryPoint,
         memorySourceFiles: SOURCE,
         options: [
-          Flags.analyzeAll,
+          fullTest ? Flags.analyzeAll : Flags.analyzeOnly,
           Flags.useKernel,
           Flags.enableAssertMessage
         ]);
     compiler.resolution.retainCachesForTesting = true;
     await compiler.run(entryPoint);
-    compiler.libraryLoader.libraries.forEach((LibraryElement library) {
-      checkLibrary(compiler, library, fullTest: args.contains('--full'));
-    });
+    checkLibrary(compiler, compiler.mainApp, fullTest: fullTest);
+    if (fullTest) {
+      // TODO(johnniwinther): Handle all libraries for `!fullTest`.
+      compiler.libraryLoader.libraries.forEach((LibraryElement library) {
+        if (library == compiler.mainApp) return;
+        checkLibrary(compiler, library, fullTest: fullTest);
+      });
+    }
   });
 }
 
@@ -640,6 +659,7 @@
     {bool fullTest: false}) {
   if (!fullTest) {
     if (element.library.isPlatformLibrary) {
+      // TODO(johnniwinther): Enqueue these elements for `!fullTest`.
       // Test only selected elements in web-related platform libraries since
       // this unittest otherwise takes too long to run.
       switch (element.library.canonicalUri.path) {
@@ -652,9 +672,9 @@
         case 'web_gl':
           if ('$element' ==
               'function(RenderingContext#getFramebufferAttachmentParameter)') {
-            return;
+            break;
           }
-          break;
+          return;
         case 'indexed_db':
           if ('$element' == 'field(ObjectStore#keyPath)') {
             break;
@@ -672,6 +692,9 @@
       return;
     }
   }
+  if (!fullTest && !compiler.resolution.hasResolutionImpact(element)) {
+    return;
+  }
   ResolutionImpact astImpact = compiler.resolution.getResolutionImpact(element);
   astImpact = laxImpact(compiler, element, astImpact);
   ResolutionImpact kernelImpact = build(compiler, element.resolvedAst);
@@ -692,14 +715,16 @@
       case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
         ConstructorElement constructor = staticUse.element;
         ConstructorElement effectiveTarget = constructor.effectiveTarget;
-        DartType effectiveTargetType =
+        ResolutionDartType effectiveTargetType =
             constructor.computeEffectiveTargetType(staticUse.type);
+        ConstructorElement effectiveTargetDeclaration =
+            effectiveTarget.declaration;
         builder.registerStaticUse(
             staticUse.kind == StaticUseKind.CONST_CONSTRUCTOR_INVOKE
                 ? new StaticUse.constConstructorInvoke(
-                    effectiveTarget.declaration, null, effectiveTargetType)
+                    effectiveTargetDeclaration, null, effectiveTargetType)
                 : new StaticUse.typedConstructorInvoke(
-                    effectiveTarget.declaration, null, effectiveTargetType));
+                    effectiveTargetDeclaration, null, effectiveTargetType));
         break;
       default:
         builder.registerStaticUse(staticUse);
@@ -776,31 +801,33 @@
 }
 
 /// Visitor the performers unaliasing of all typedefs nested within a
-/// [DartType].
-class Unaliaser extends BaseDartTypeVisitor<dynamic, DartType> {
+/// [ResolutionDartType].
+class Unaliaser extends BaseDartTypeVisitor<dynamic, ResolutionDartType> {
   const Unaliaser();
 
   @override
-  DartType visit(DartType type, [_]) => type.accept(this, null);
+  ResolutionDartType visit(ResolutionDartType type, [_]) =>
+      type.accept(this, null);
 
   @override
-  DartType visitType(DartType type, _) => type;
+  ResolutionDartType visitType(ResolutionDartType type, _) => type;
 
-  List<DartType> visitList(List<DartType> types) => types.map(visit).toList();
+  List<ResolutionDartType> visitList(List<ResolutionDartType> types) =>
+      types.map(visit).toList();
 
   @override
-  DartType visitInterfaceType(InterfaceType type, _) {
+  ResolutionDartType visitInterfaceType(ResolutionInterfaceType type, _) {
     return type.createInstantiation(visitList(type.typeArguments));
   }
 
   @override
-  DartType visitTypedefType(TypedefType type, _) {
+  ResolutionDartType visitTypedefType(ResolutionTypedefType type, _) {
     return visit(type.unaliased);
   }
 
   @override
-  DartType visitFunctionType(FunctionType type, _) {
-    return new FunctionType.synthesized(
+  ResolutionDartType visitFunctionType(ResolutionFunctionType type, _) {
+    return new ResolutionFunctionType.synthesized(
         visit(type.returnType),
         visitList(type.parameterTypes),
         visitList(type.optionalParameterTypes),
@@ -809,7 +836,7 @@
   }
 }
 
-/// Perform unaliasing of all typedefs nested within a [DartType].
-DartType unalias(DartType type) {
+/// Perform unaliasing of all typedefs nested within a [ResolutionDartType].
+ResolutionDartType unalias(ResolutionDartType type) {
   return const Unaliaser().visit(type);
 }
diff --git a/tests/compiler/dart2js/kernel/literals_test.dart b/tests/compiler/dart2js/kernel/literals_test.dart
index 4bdf271..5cc337a 100644
--- a/tests/compiler/dart2js/kernel/literals_test.dart
+++ b/tests/compiler/dart2js/kernel/literals_test.dart
@@ -19,4 +19,7 @@
   test('compile function that returns a const map', () {
     return check('main() { return const {"a": 1, "b": 2, "c": 3}; }');
   });
+  test('compile top level string field ', () {
+    return check('String foo = (() { return "a";})(); main() { return foo; }');
+  });
 }
diff --git a/tests/compiler/dart2js/kernel/loops_test.dart b/tests/compiler/dart2js/kernel/loops_test.dart
index a619c36..b257e4b 100644
--- a/tests/compiler/dart2js/kernel/loops_test.dart
+++ b/tests/compiler/dart2js/kernel/loops_test.dart
@@ -31,6 +31,18 @@
     return check(code);
   });
 
+  test('do-while loop', () {
+    String code = '''
+main() {
+  var a = 0;
+  do {
+    a *= 2;
+  } while (a < 100);
+  return a;
+}''';
+    return check(code);
+  });
+
   test('for-in loop', () {
     String code = '''
 main() {
@@ -72,4 +84,21 @@
 }''';
     return check(code, disableTypeInference: false);
   });
+
+  test('for loop with break to label', () {
+    String code = '''
+var a = 0;
+main() {
+  var sum = 0;
+  outer: for (a in [1, 2, 3]) {
+    for (int i = 0; i < 10; i++) {
+      sum += a;
+      if (a + i < 5)
+        break outer;
+    }
+  }
+  return sum;
+}''';
+    return check(code, disableTypeInference: false);
+  });
 }
diff --git a/tests/compiler/dart2js/kernel/switch_test.dart b/tests/compiler/dart2js/kernel/switch_test.dart
new file mode 100644
index 0000000..10bfdbf
--- /dev/null
+++ b/tests/compiler/dart2js/kernel/switch_test.dart
@@ -0,0 +1,184 @@
+import 'package:test/test.dart';
+
+import 'helper.dart' show check;
+
+main() {
+  test('simple switch statement', () {
+    String code = '''
+main() {
+  int x = 2;
+  switch(x) {
+    case 1:
+      print('spider');
+      break;
+    case 2:
+      print('grasshopper');
+      break;
+  }
+}''';
+    return check(code);
+  });
+
+  test('switch with default', () {
+    String code = '''
+main() {
+  int x = 5;
+  switch(x) {
+    case 1:
+      print('spider');
+      break;
+    case 2:
+      print('grasshopper');
+      break;
+    default:
+      print('ladybug');
+
+  }
+}''';
+    return check(code);
+  });
+
+/*
+  // TODO(efortuna): Uncomment. Because of patch file weirdness, the original
+  // SSA vs the Kernel version is instantiating a subclass of the
+  // FallThroughError, so it produces slightly different code. Fix that.
+  test('switch with fall through error', () {
+    String code = '''
+main() {
+  int x = 2;
+  switch(x) {
+    case 1:
+      print('spider');
+      break;
+    case 2:
+      print('grasshopper');
+    case 3:
+      print('ant');
+      break;
+    default:
+      print('ladybug');
+  }
+}''';
+    return check(code);
+  });
+*/
+  test('switch with multi-case branch', () {
+    String code = '''
+main() {
+  int x = 3;
+  switch(x) {
+    case 1:
+      print('spider');
+      break;
+    case 2:
+    case 3:
+    case 4:
+      print('grasshopper');
+      print('ant');
+      break;
+  }
+}''';
+    return check(code);
+  });
+
+  test('switch with weird fall-through end case', () {
+    String code = '''
+main() {
+    int x = 6;
+  switch(x) {
+    case 1:
+      print('spider');
+      break;
+    case 5:
+      print('beetle');
+      break;
+    case 6:
+  }
+}''';
+    return check(code);
+  });
+
+  test('switch with labeled continue', () {
+    String code = '''
+main() {
+    int x = 1;
+  switch(x) {
+    case 1:
+      print('spider');
+      continue world;
+    case 5:
+      print('beetle');
+      break;
+    world:
+    case 6:
+      print('cricket');
+      break;
+    default:
+      print('bat');
+  }
+}''';
+    return check(code);
+  });
+
+  test('switch with continue to fall through', () {
+    String code = '''
+main() {
+    int x = 1;
+  switch(x) {
+    case 1:
+      print('spider');
+      continue world;
+    world:
+    case 5:
+      print('beetle');
+      break;
+    case 6:
+      print('cricket');
+      break;
+    default:
+      print('bat');
+  }
+}''';
+    return check(code);
+  });
+
+  test('switch with continue without default case', () {
+    String code = '''
+main() {
+    int x = 1;
+  switch(x) {
+    case 1:
+      print('spider');
+      continue world;
+    world:
+    case 5:
+      print('beetle');
+      break;
+    case 6:
+      print('cricket');
+      break;
+  }
+}''';
+    return check(code);
+  });
+
+  test('switch with continue without default case', () {
+    String code = '''
+main() {
+    int x = 8;
+  switch(x) {
+    case 1:
+      print('spider');
+      continue world;
+    world:
+    case 5:
+      print('beetle');
+      break;
+    case 6:
+      print('cricket');
+      break;
+  }
+}''';
+    return check(code);
+  });
+}
diff --git a/tests/compiler/dart2js/kernel/try_catch_test.dart b/tests/compiler/dart2js/kernel/try_catch_test.dart
new file mode 100644
index 0000000..77a1afd
--- /dev/null
+++ b/tests/compiler/dart2js/kernel/try_catch_test.dart
@@ -0,0 +1,95 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test/test.dart';
+
+import 'helper.dart' show check;
+
+main() {
+  test('try catch', () {
+    String code = '''
+main() {
+  try {
+    print('hi');
+  } catch (e, s) {
+    print(e);
+    print(s);
+    print('bye');
+  }
+}''';
+    return check(code);
+  });
+
+  test('try omit catch', () {
+    String code = '''
+main() {
+  try {
+    print('hi');
+  } on ArgumentError {
+    print('howdy');
+  }
+}''';
+    return check(code);
+  });
+
+  test('try finally', () {
+    String code = '''
+main() {
+  try {
+    print('hi');
+  } finally {
+    print('bye');
+  }
+}''';
+    return check(code);
+  });
+
+  test('try catch finally', () {
+    String code = '''
+main() {
+  try {
+    print('hi');
+  } catch(e) {
+    print('howdy');
+  } finally {
+    print('bye');
+  }
+}''';
+    return check(code);
+  });
+
+  test('try multi catch', () {
+    String code = '''
+main() {
+  try {
+    print('hi');
+  } on String catch(e) {
+    print('hola');
+  } on int catch(e) {
+    print('halo');
+  } catch (e) {
+    print('howdy');
+  }
+}''';
+    return check(code);
+  });
+
+  test('try multi-catch finally', () {
+    String code = '''
+main() {
+  try {
+    print('hi');
+  } on String catch(e) {
+    print('hola');
+  } on int catch(e) {
+    print('halo');
+  } catch (e) {
+    print('howdy');
+  } finally {
+    print('bye');
+  }
+}''';
+    return check(code);
+  });
+}
diff --git a/tests/compiler/dart2js/kernel/visitor_test.dart b/tests/compiler/dart2js/kernel/visitor_test.dart
index d632442..c66801f 100644
--- a/tests/compiler/dart2js/kernel/visitor_test.dart
+++ b/tests/compiler/dart2js/kernel/visitor_test.dart
@@ -6,6 +6,7 @@
 /// defined by kernel spec-mode test files.
 
 import 'dart:io';
+import 'dart:async';
 import 'package:compiler/src/compiler.dart' show Compiler;
 import 'package:compiler/src/elements/elements.dart';
 import 'package:compiler/src/js_backend/backend.dart' show JavaScriptBackend;
@@ -26,9 +27,7 @@
   'external',
 ];
 
-main(List<String> arguments) {
-  Compiler compiler = compilerFor(
-      options: [Flags.analyzeOnly, Flags.analyzeMain, Flags.useKernel]);
+main(List<String> arguments) async {
   Directory directory = new Directory('${TESTCASE_DIR}/input');
   for (FileSystemEntity file in directory.listSync()) {
     if (file is File && file.path.endsWith('.dart')) {
@@ -40,7 +39,10 @@
       }
 
       test(name, () async {
-        LibraryElement library = await compiler.analyzeUri(file.absolute.uri);
+        var compiler = await newCompiler();
+        await compiler.run(file.absolute.uri);
+        LibraryElement library =
+            await compiler.libraryLoader.loadLibrary(file.absolute.uri);
         JavaScriptBackend backend = compiler.backend;
         StringBuffer buffer = new StringBuffer();
         Program program = backend.kernelTask.buildProgram(library);
@@ -68,3 +70,17 @@
     }
   }
 }
+
+Future<Compiler> newCompiler() async {
+  var compiler = compilerFor(
+      options: [Flags.analyzeOnly, Flags.analyzeAll, Flags.useKernel]);
+  await compiler.setupSdk();
+
+  // The visitor no longer enqueues elements that are not reachable from the
+  // program. The mixin-full resolution transform run by the test expects to
+  // find dart.core::Iterator.
+  var core = await compiler.libraryLoader.loadLibrary(Uri.parse('dart:core'));
+  var cls = core.implementation.localLookup('Iterator');
+  cls.ensureResolved(compiler.resolution);
+  return compiler;
+}
diff --git a/tests/compiler/dart2js/least_upper_bound_test.dart b/tests/compiler/dart2js/least_upper_bound_test.dart
index c184635..dab1188 100644
--- a/tests/compiler/dart2js/least_upper_bound_test.dart
+++ b/tests/compiler/dart2js/least_upper_bound_test.dart
@@ -6,7 +6,7 @@
 
 import 'package:expect/expect.dart';
 import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/elements/elements.dart' show Element, ClassElement;
 
 import 'type_test_helper.dart';
@@ -27,14 +27,15 @@
       class I implements A, B {}
       class J implements A, B {}
       """).then((env) {
-        DartType Object_ = env['Object'];
-        DartType A = env['A'];
-        DartType B = env['B'];
-        DartType I = env['I'];
-        DartType J = env['J'];
+        ResolutionDartType Object_ = env['Object'];
+        ResolutionDartType A = env['A'];
+        ResolutionDartType B = env['B'];
+        ResolutionDartType I = env['I'];
+        ResolutionDartType J = env['J'];
 
-        checkLub(DartType a, DartType b, DartType expect) {
-          DartType lub = env.computeLeastUpperBound(a, b);
+        checkLub(ResolutionDartType a, ResolutionDartType b,
+            ResolutionDartType expect) {
+          ResolutionDartType lub = env.computeLeastUpperBound(a, b);
           Expect.equals(
               expect, lub, 'Unexpected lub($a,$b) = $lub, expected $expect.');
         }
@@ -79,15 +80,16 @@
       class I implements A, C {}
       class J implements A, C {}
       """).then((env) {
-        DartType Object_ = env['Object'];
-        DartType A = env['A'];
-        DartType B = env['B'];
-        DartType C = env['C'];
-        DartType I = env['I'];
-        DartType J = env['J'];
+        ResolutionDartType Object_ = env['Object'];
+        ResolutionDartType A = env['A'];
+        ResolutionDartType B = env['B'];
+        ResolutionDartType C = env['C'];
+        ResolutionDartType I = env['I'];
+        ResolutionDartType J = env['J'];
 
-        checkLub(DartType a, DartType b, DartType expectedLub) {
-          DartType lub = env.computeLeastUpperBound(a, b);
+        checkLub(ResolutionDartType a, ResolutionDartType b,
+            ResolutionDartType expectedLub) {
+          ResolutionDartType lub = env.computeLeastUpperBound(a, b);
           Expect.equals(expectedLub, lub,
               'Unexpected lub($a,$b) = $lub, expected $expectedLub');
         }
@@ -143,17 +145,18 @@
       class C extends B {}
       class I<T> {}
       """).then((env) {
-        DartType Object_ = env['Object'];
-        DartType A = env['A'];
-        DartType B = env['B'];
-        DartType C = env['C'];
+        ResolutionDartType Object_ = env['Object'];
+        ResolutionDartType A = env['A'];
+        ResolutionDartType B = env['B'];
+        ResolutionDartType C = env['C'];
         ClassElement I = env.getElement('I');
-        DartType I_A = instantiate(I, [A]);
-        DartType I_B = instantiate(I, [B]);
-        DartType I_C = instantiate(I, [C]);
+        ResolutionDartType I_A = instantiate(I, [A]);
+        ResolutionDartType I_B = instantiate(I, [B]);
+        ResolutionDartType I_C = instantiate(I, [C]);
 
-        checkLub(DartType a, DartType b, DartType expectedLub) {
-          DartType lub = env.computeLeastUpperBound(a, b);
+        checkLub(ResolutionDartType a, ResolutionDartType b,
+            ResolutionDartType expectedLub) {
+          ResolutionDartType lub = env.computeLeastUpperBound(a, b);
           Expect.equals(expectedLub, lub,
               'Unexpected lub($a,$b) = $lub, expected $expectedLub');
         }
@@ -226,17 +229,18 @@
       class I2 extends Object with A, B implements A, D {}
       class J extends Object with B, A implements A, D {}
       """).then((env) {
-        DartType Object_ = env['Object'];
-        DartType A = env['A'];
-        DartType B = env['B'];
-        DartType C = env['C'];
-        DartType D = env['D'];
-        DartType I = env['I'];
-        DartType I2 = env['I2'];
-        DartType J = env['J'];
+        ResolutionDartType Object_ = env['Object'];
+        ResolutionDartType A = env['A'];
+        ResolutionDartType B = env['B'];
+        ResolutionDartType C = env['C'];
+        ResolutionDartType D = env['D'];
+        ResolutionDartType I = env['I'];
+        ResolutionDartType I2 = env['I2'];
+        ResolutionDartType J = env['J'];
 
-        checkLub(DartType a, DartType b, DartType expectedLub) {
-          DartType lub = env.computeLeastUpperBound(a, b);
+        checkLub(ResolutionDartType a, ResolutionDartType b,
+            ResolutionDartType expectedLub) {
+          ResolutionDartType lub = env.computeLeastUpperBound(a, b);
           Expect.equals(expectedLub, lub,
               'Unexpected lub($a,$b) = $lub, expected $expectedLub');
         }
@@ -340,37 +344,41 @@
       typedef void void____B_C({B a, C b});
       typedef void void____C_C({C a, C b});
       """).then((env) {
-        DartType Object_ = env['Object'];
-        DartType Function_ = env['Function'];
-        DartType dynamic__ = env['dynamic__'];
-        DartType void__ = env['void__'];
-        DartType A__ = env['A__'];
-        DartType B__ = env['B__'];
-        DartType C__ = env['C__'];
-        DartType void__A_B = env['void__A_B'];
-        DartType void__A_C = env['void__A_C'];
-        DartType void__B_A = env['void__B_A'];
-        DartType void__B_C = env['void__B_C'];
-        DartType void___B = env['void___B'];
-        DartType void___B_C = env['void___B_C'];
-        DartType void___C_C = env['void___C_C'];
-        DartType void____B = env['void____B'];
-        DartType void____B_C = env['void____B_C'];
-        DartType void____C_C = env['void____C_C'];
+        ResolutionDartType Object_ = env['Object'];
+        ResolutionDartType Function_ = env['Function'];
+        ResolutionDartType dynamic__ = env['dynamic__'];
+        ResolutionDartType void__ = env['void__'];
+        ResolutionDartType A__ = env['A__'];
+        ResolutionDartType B__ = env['B__'];
+        ResolutionDartType C__ = env['C__'];
+        ResolutionDartType void__A_B = env['void__A_B'];
+        ResolutionDartType void__A_C = env['void__A_C'];
+        ResolutionDartType void__B_A = env['void__B_A'];
+        ResolutionDartType void__B_C = env['void__B_C'];
+        ResolutionDartType void___B = env['void___B'];
+        ResolutionDartType void___B_C = env['void___B_C'];
+        ResolutionDartType void___C_C = env['void___C_C'];
+        ResolutionDartType void____B = env['void____B'];
+        ResolutionDartType void____B_C = env['void____B_C'];
+        ResolutionDartType void____C_C = env['void____C_C'];
 
         // Types used only for checking results.
-        DartType void_ = env['void'];
-        DartType B = env['B'];
-        DartType C = env['C'];
-        FunctionType Object__ = env.functionType(Object_, []);
-        FunctionType void__Object_Object =
+        ResolutionDartType void_ = env['void'];
+        ResolutionDartType B = env['B'];
+        ResolutionDartType C = env['C'];
+        ResolutionFunctionType Object__ = env.functionType(Object_, []);
+        ResolutionFunctionType void__Object_Object =
             env.functionType(void_, [Object_, Object_]);
-        FunctionType void__Object_B = env.functionType(void_, [Object_, B]);
-        FunctionType void__Object_C = env.functionType(void_, [Object_, C]);
-        FunctionType void__B_Object = env.functionType(void_, [B, Object_]);
+        ResolutionFunctionType void__Object_B =
+            env.functionType(void_, [Object_, B]);
+        ResolutionFunctionType void__Object_C =
+            env.functionType(void_, [Object_, C]);
+        ResolutionFunctionType void__B_Object =
+            env.functionType(void_, [B, Object_]);
 
-        checkLub(DartType a, DartType b, DartType expectedLub) {
-          DartType lub = env.computeLeastUpperBound(a, b);
+        checkLub(ResolutionDartType a, ResolutionDartType b,
+            ResolutionDartType expectedLub) {
+          ResolutionDartType lub = env.computeLeastUpperBound(a, b);
           if (a != b) {
             expectedLub = expectedLub.unaliased;
             lub = lub.unaliased;
@@ -711,20 +719,21 @@
         //   /
         //  W
 
-        DartType Object_ = env['Object'];
-        DartType A = env['A'];
-        DartType B = env['B'];
-        DartType C = env['C'];
+        ResolutionDartType Object_ = env['Object'];
+        ResolutionDartType A = env['A'];
+        ResolutionDartType B = env['B'];
+        ResolutionDartType C = env['C'];
         ClassElement I = env.getElement('I');
-        DartType S = I.typeVariables[0];
-        DartType T = I.typeVariables[1];
-        DartType U = I.typeVariables[2];
-        DartType V = I.typeVariables[3];
-        DartType W = I.typeVariables[4];
-        DartType X = I.typeVariables[5];
+        ResolutionDartType S = I.typeVariables[0];
+        ResolutionDartType T = I.typeVariables[1];
+        ResolutionDartType U = I.typeVariables[2];
+        ResolutionDartType V = I.typeVariables[3];
+        ResolutionDartType W = I.typeVariables[4];
+        ResolutionDartType X = I.typeVariables[5];
 
-        checkLub(DartType a, DartType b, DartType expectedLub) {
-          DartType lub = env.computeLeastUpperBound(a, b);
+        checkLub(ResolutionDartType a, ResolutionDartType b,
+            ResolutionDartType expectedLub) {
+          ResolutionDartType lub = env.computeLeastUpperBound(a, b);
           Expect.equals(expectedLub, lub,
               'Unexpected lub($a,$b) = $lub, expected $expectedLub');
         }
diff --git a/tests/compiler/dart2js/list_tracer2_test.dart b/tests/compiler/dart2js/list_tracer2_test.dart
index c0a5166..215b84a 100644
--- a/tests/compiler/dart2js/list_tracer2_test.dart
+++ b/tests/compiler/dart2js/list_tracer2_test.dart
@@ -25,13 +25,14 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkType(String name, type) {
           var element = findElement(compiler, name);
           ContainerTypeMask mask = typesInferrer.getTypeOfElement(element);
-          Expect.equals(type, simplify(mask.elementType, compiler), name);
+          Expect.equals(type, simplify(mask.elementType, closedWorld), name);
         }
 
-        checkType('myList', compiler.closedWorld.commonMasks.uint31Type);
+        checkType('myList', typesInferrer.closedWorld.commonMasks.uint31Type);
       }));
 }
diff --git a/tests/compiler/dart2js/list_tracer3_test.dart b/tests/compiler/dart2js/list_tracer3_test.dart
index 1e61858..599933c3 100644
--- a/tests/compiler/dart2js/list_tracer3_test.dart
+++ b/tests/compiler/dart2js/list_tracer3_test.dart
@@ -27,16 +27,16 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkType(String name, type) {
           var element = findElement(compiler, name);
           ContainerTypeMask mask = typesInferrer.getTypeOfElement(element);
-          Expect.equals(type, simplify(mask.elementType, compiler), name);
+          Expect.equals(type, simplify(mask.elementType, closedWorld), name);
         }
 
         var interceptorType =
-            findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
-
+            typesInferrer.closedWorld.commonMasks.interceptorType;
         checkType('myList', interceptorType);
       }));
 }
diff --git a/tests/compiler/dart2js/list_tracer_test.dart b/tests/compiler/dart2js/list_tracer_test.dart
index c407ce8..e577c9f 100644
--- a/tests/compiler/dart2js/list_tracer_test.dart
+++ b/tests/compiler/dart2js/list_tracer_test.dart
@@ -198,14 +198,15 @@
   var compiler = compilerFor(generateTest(allocation), uri,
       expectedErrors: 0, expectedWarnings: 1);
   asyncTest(() => compiler.run(uri).then((_) {
-        var commonMasks = compiler.closedWorld.commonMasks;
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
+        var commonMasks = closedWorld.commonMasks;
 
         checkType(String name, type) {
           var element = findElement(compiler, name);
           ContainerTypeMask mask = typesInferrer.getTypeOfElement(element);
           if (nullify) type = type.nullable();
-          Expect.equals(type, simplify(mask.elementType, compiler), name);
+          Expect.equals(type, simplify(mask.elementType, closedWorld), name);
         }
 
         checkType('listInField', commonMasks.numType);
diff --git a/tests/compiler/dart2js/list_tracer_typed_data_length_test.dart b/tests/compiler/dart2js/list_tracer_typed_data_length_test.dart
index ee15963..59ede2b 100644
--- a/tests/compiler/dart2js/list_tracer_typed_data_length_test.dart
+++ b/tests/compiler/dart2js/list_tracer_typed_data_length_test.dart
@@ -6,6 +6,7 @@
 import 'package:async_helper/async_helper.dart';
 import 'package:compiler/src/types/types.dart' show ContainerTypeMask, TypeMask;
 import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/world.dart' show ClosedWorld;
 
 import 'memory_compiler.dart';
 import 'compiler_helper.dart' show findElement;
@@ -30,17 +31,18 @@
     CompilationResult result = await runCompiler(memorySourceFiles: TEST);
     Compiler compiler = result.compiler;
     var typesInferrer = compiler.globalInference.typesInferrerInternal;
+    ClosedWorld closedWorld = typesInferrer.closedWorld;
 
     checkType(String name, type, length) {
       var element = findElement(compiler, name);
       TypeMask mask = typesInferrer.getTypeOfElement(element);
       Expect.isTrue(mask.isContainer);
       ContainerTypeMask container = mask;
-      Expect.equals(type, simplify(container.elementType, compiler), name);
+      Expect.equals(type, simplify(container.elementType, closedWorld), name);
       Expect.equals(container.length, length);
     }
 
-    checkType('myList', compiler.closedWorld.commonMasks.numType, 42);
-    checkType('myOtherList', compiler.closedWorld.commonMasks.uint31Type, 32);
+    checkType('myList', closedWorld.commonMasks.numType, 42);
+    checkType('myOtherList', closedWorld.commonMasks.uint31Type, 32);
   });
 }
diff --git a/tests/compiler/dart2js/lookup_member_test.dart b/tests/compiler/dart2js/lookup_member_test.dart
index 27f49c7..386f58b 100644
--- a/tests/compiler/dart2js/lookup_member_test.dart
+++ b/tests/compiler/dart2js/lookup_member_test.dart
@@ -7,7 +7,7 @@
 import 'package:expect/expect.dart';
 import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import "package:compiler/src/elements/elements.dart"
     show Element, ClassElement, MemberSignature, PublicName;
 
@@ -30,46 +30,46 @@
         V boz;
       }
       """).then((env) {
-        void expect(InterfaceType receiverType, String memberName,
-            DartType expectedType) {
+        void expect(ResolutionInterfaceType receiverType, String memberName,
+            ResolutionDartType expectedType) {
           MemberSignature member =
               receiverType.lookupInterfaceMember(new PublicName(memberName));
           Expect.isNotNull(member);
-          DartType memberType = member.type;
+          ResolutionDartType memberType = member.type;
           Expect.equals(expectedType, memberType,
               'Wrong member type for $receiverType.$memberName.');
         }
 
-        DartType int_ = env['int'];
-        DartType String_ = env['String'];
+        ResolutionDartType int_ = env['int'];
+        ResolutionDartType String_ = env['String'];
 
         ClassElement A = env.getElement('A');
-        DartType T = A.typeVariables.first;
-        DartType A_T = A.thisType;
+        ResolutionDartType T = A.typeVariables.first;
+        ResolutionDartType A_T = A.thisType;
         expect(A_T, 'foo', T);
 
-        DartType A_int = instantiate(A, [int_]);
+        ResolutionDartType A_int = instantiate(A, [int_]);
         expect(A_int, 'foo', int_);
 
         ClassElement B = env.getElement('B');
-        DartType S = B.typeVariables.first;
-        DartType B_S = B.thisType;
+        ResolutionDartType S = B.typeVariables.first;
+        ResolutionDartType B_S = B.thisType;
         expect(B_S, 'foo', instantiate(A, [S]));
         expect(B_S, 'bar', S);
 
-        DartType B_int = instantiate(B, [int_]);
+        ResolutionDartType B_int = instantiate(B, [int_]);
         expect(B_int, 'foo', A_int);
         expect(B_int, 'bar', int_);
 
         ClassElement C = env.getElement('C');
-        DartType U = C.typeVariables.first;
-        DartType C_U = C.thisType;
+        ResolutionDartType U = C.typeVariables.first;
+        ResolutionDartType C_U = C.thisType;
         expect(C_U, 'foo', instantiate(A, [String_]));
         expect(C_U, 'bar', String_);
         expect(C_U, 'baz', U);
         expect(C_U, 'boz', instantiate(B, [U]));
 
-        DartType C_int = instantiate(C, [int_]);
+        ResolutionDartType C_int = instantiate(C, [int_]);
         expect(C_int, 'foo', instantiate(A, [String_]));
         expect(C_int, 'bar', String_);
         expect(C_int, 'baz', int_);
diff --git a/tests/compiler/dart2js/map_tracer_const_test.dart b/tests/compiler/dart2js/map_tracer_const_test.dart
index 69d9554..69da6a5 100644
--- a/tests/compiler/dart2js/map_tracer_const_test.dart
+++ b/tests/compiler/dart2js/map_tracer_const_test.dart
@@ -33,10 +33,11 @@
   var compiler = compilerFor(TEST, uri, expectedErrors: 0, expectedWarnings: 0);
   compiler.stopAfterTypeInference = true;
   asyncTest(() => compiler.run(uri).then((_) {
-        var commonMasks = compiler.closedWorld.commonMasks;
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
+        var commonMasks = closedWorld.commonMasks;
         var element = findElement(compiler, 'closure');
         var mask = typesInferrer.getReturnTypeOfElement(element);
-        Expect.equals(commonMasks.numType, simplify(mask, compiler));
+        Expect.equals(commonMasks.numType, simplify(mask, closedWorld));
       }));
 }
diff --git a/tests/compiler/dart2js/map_tracer_keys_test.dart b/tests/compiler/dart2js/map_tracer_keys_test.dart
index 4394879..91c1bf3 100644
--- a/tests/compiler/dart2js/map_tracer_keys_test.dart
+++ b/tests/compiler/dart2js/map_tracer_keys_test.dart
@@ -57,8 +57,8 @@
   var compiler = compilerFor(generateTest(key, value, initial), uri,
       expectedErrors: 0, expectedWarnings: 0);
   asyncTest(() => compiler.run(uri).then((_) {
-        var commonMasks = compiler.closedWorld.commonMasks;
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var commonMasks = typesInferrer.closedWorld.commonMasks;
         var aDoubleType =
             typesInferrer.getTypeOfElement(findElement(compiler, 'aDouble'));
         var aListType =
diff --git a/tests/compiler/dart2js/map_tracer_test.dart b/tests/compiler/dart2js/map_tracer_test.dart
index 571450c..bab5e22 100644
--- a/tests/compiler/dart2js/map_tracer_test.dart
+++ b/tests/compiler/dart2js/map_tracer_test.dart
@@ -211,11 +211,12 @@
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(generateTest(allocation), uri,
       expectedErrors: 0, expectedWarnings: 1);
-  var closedWorld = compiler.openWorld.closeWorld(compiler.reporter);
+  compiler.closeResolution();
   asyncTest(() => compiler.run(uri).then((_) {
         var keyType, valueType;
-        var commonMasks = compiler.closedWorld.commonMasks;
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
+        var commonMasks = closedWorld.commonMasks;
         var emptyType = new TypeMask.nonNullEmpty();
         var aKeyType =
             typesInferrer.getTypeOfElement(findElement(compiler, 'aKey'));
@@ -233,14 +234,15 @@
         checkType(String name, keyType, valueType) {
           var element = findElement(compiler, name);
           MapTypeMask mask = typesInferrer.getTypeOfElement(element);
-          Expect.equals(keyType, simplify(mask.keyType, compiler), name);
-          Expect.equals(valueType, simplify(mask.valueType, compiler), name);
+          Expect.equals(keyType, simplify(mask.keyType, closedWorld), name);
+          Expect.equals(valueType, simplify(mask.valueType, closedWorld), name);
         }
 
         K(TypeMask other) =>
-            simplify(keyType.union(other, closedWorld), compiler);
+            simplify(keyType.union(other, closedWorld), closedWorld);
         V(TypeMask other) =>
-            simplify(valueType.union(other, closedWorld), compiler).nullable();
+            simplify(valueType.union(other, closedWorld), closedWorld)
+                .nullable();
 
         checkType('mapInField', K(aKeyType), V(commonMasks.numType));
         checkType('mapPassedToMethod', K(aKeyType), V(commonMasks.numType));
diff --git a/tests/compiler/dart2js/members_test.dart b/tests/compiler/dart2js/members_test.dart
index c058761..5b6c69d 100644
--- a/tests/compiler/dart2js/members_test.dart
+++ b/tests/compiler/dart2js/members_test.dart
@@ -7,7 +7,7 @@
 import 'package:expect/expect.dart';
 import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import "package:compiler/src/elements/elements.dart"
     show Element, ClassElement, MemberSignature, Name, PublicName, Member;
 import "package:compiler/src/resolution/class_members.dart"
@@ -21,7 +21,7 @@
   testMixinMembersWithoutImplements();
 }
 
-MemberSignature getMember(InterfaceType cls, String name,
+MemberSignature getMember(ResolutionInterfaceType cls, String name,
     {bool isSetter: false, int checkType: CHECK_INTERFACE}) {
   Name memberName = new Name(name, cls.element.library, isSetter: isSetter);
   MemberSignature member = checkType == CHECK_CLASS
@@ -66,16 +66,16 @@
  * If [isClassMember] is `true` it is checked that the member is also a class
  * member.
  */
-MemberSignature checkMember(InterfaceType cls, String name,
+MemberSignature checkMember(ResolutionInterfaceType cls, String name,
     {bool isStatic: false,
     bool isSetter: false,
     bool isGetter: false,
-    InterfaceType declarer,
-    DartType type,
-    FunctionType functionType,
-    InterfaceType inheritedFrom,
-    List<InterfaceType> synthesizedFrom,
-    List<InterfaceType> erroneousFrom,
+    ResolutionInterfaceType declarer,
+    ResolutionDartType type,
+    ResolutionFunctionType functionType,
+    ResolutionInterfaceType inheritedFrom,
+    List<ResolutionInterfaceType> synthesizedFrom,
+    List<ResolutionInterfaceType> erroneousFrom,
     int checkType: ALSO_CLASS_MEMBER}) {
   String memberKind = checkType == CHECK_CLASS ? 'class' : 'interface';
   MemberSignature member =
@@ -113,7 +113,7 @@
       }
       Set<MemberSignature> members = new Set<MemberSignature>();
       List from = synthesizedFrom != null ? synthesizedFrom : erroneousFrom;
-      for (InterfaceType type in from) {
+      for (ResolutionInterfaceType type in from) {
         DeclaredMember inheritedMember =
             type.element.lookupInterfaceMember(memberName);
         Expect.isNotNull(inheritedMember);
@@ -150,7 +150,7 @@
   return member;
 }
 
-void checkMemberCount(InterfaceType cls, int expectedCount,
+void checkMemberCount(ResolutionInterfaceType cls, int expectedCount,
     {bool interfaceMembers: true}) {
   int count = 0;
   if (interfaceMembers) {
@@ -191,16 +191,16 @@
     """,
               useMockCompiler: false)
           .then((env) {
-        InterfaceType bool_ = env['bool'];
-        InterfaceType String_ = env['String'];
-        InterfaceType num_ = env['num'];
-        InterfaceType int_ = env['int'];
-        DynamicType dynamic_ = env['dynamic'];
-        VoidType void_ = env['void'];
-        InterfaceType Type_ = env['Type'];
-        InterfaceType Invocation_ = env['Invocation'];
+        ResolutionInterfaceType bool_ = env['bool'];
+        ResolutionInterfaceType String_ = env['String'];
+        ResolutionInterfaceType num_ = env['num'];
+        ResolutionInterfaceType int_ = env['int'];
+        ResolutionDynamicType dynamic_ = env['dynamic'];
+        ResolutionVoidType void_ = env['void'];
+        ResolutionInterfaceType Type_ = env['Type'];
+        ResolutionInterfaceType Invocation_ = env['Invocation'];
 
-        InterfaceType Object_ = env['Object'];
+        ResolutionInterfaceType Object_ = env['Object'];
         checkMemberCount(Object_, 5 /*declared*/, interfaceMembers: true);
         checkMemberCount(Object_, 5 /*declared*/, interfaceMembers: false);
 
@@ -219,7 +219,7 @@
         checkMember(Object_, 'toString',
             functionType: env.functionType(String_, []));
 
-        InterfaceType A = env['A'];
+        ResolutionInterfaceType A = env['A'];
         MembersCreator.computeAllClassMembers(env.resolution, A.element);
 
         checkMemberCount(A, 5 /*inherited*/ + 9 /*non-static declared*/,
@@ -289,8 +289,8 @@
 
         ClassElement B = env.getElement('B');
         MembersCreator.computeAllClassMembers(env.resolution, B);
-        InterfaceType B_this = B.thisType;
-        TypeVariableType B_T = B_this.typeArguments.first;
+        ResolutionInterfaceType B_this = B.thisType;
+        ResolutionTypeVariableType B_T = B_this.typeArguments.first;
         checkMemberCount(B_this, 4 /*inherited*/ + 4 /*non-static declared*/,
             interfaceMembers: true);
         checkMemberCount(B_this, 4 /*inherited*/ + 5 /*declared*/,
@@ -319,11 +319,11 @@
 
         ClassElement C = env.getElement('C');
         MembersCreator.computeAllClassMembers(env.resolution, C);
-        InterfaceType C_this = C.thisType;
-        TypeVariableType C_S = C_this.typeArguments.first;
+        ResolutionInterfaceType C_this = C.thisType;
+        ResolutionTypeVariableType C_S = C_this.typeArguments.first;
         checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: true);
         checkMemberCount(C_this, 8 /*inherited*/, interfaceMembers: false);
-        InterfaceType B_S = instantiate(B, [C_S]);
+        ResolutionInterfaceType B_S = instantiate(B, [C_S]);
 
         checkMember(C_this, '==', inheritedFrom: Object_);
         checkMember(C_this, 'hashCode', inheritedFrom: Object_);
@@ -347,11 +347,11 @@
             functionType:
                 env.functionType(dynamic_, [], optionalParameters: [C_S]));
 
-        InterfaceType D = env['D'];
+        ResolutionInterfaceType D = env['D'];
         MembersCreator.computeAllClassMembers(env.resolution, D.element);
         checkMemberCount(D, 8 /*inherited*/, interfaceMembers: true);
         checkMemberCount(D, 8 /*inherited*/, interfaceMembers: false);
-        InterfaceType B_int = instantiate(B, [int_]);
+        ResolutionInterfaceType B_int = instantiate(B, [int_]);
 
         checkMember(D, '==', inheritedFrom: Object_);
         checkMember(D, 'hashCode', inheritedFrom: Object_);
@@ -375,7 +375,7 @@
             functionType:
                 env.functionType(dynamic_, [], optionalParameters: [int_]));
 
-        InterfaceType E = env['E'];
+        ResolutionInterfaceType E = env['E'];
         MembersCreator.computeAllClassMembers(env.resolution, E.element);
         checkMemberCount(E, 8 /*inherited*/, interfaceMembers: true);
         checkMemberCount(E, 8 /*inherited*/, interfaceMembers: false);
@@ -450,15 +450,15 @@
     }
     abstract class D implements A, B, C {}
     """).then((env) {
-        DynamicType dynamic_ = env['dynamic'];
-        VoidType void_ = env['void'];
-        InterfaceType num_ = env['num'];
-        InterfaceType int_ = env['int'];
+        ResolutionDynamicType dynamic_ = env['dynamic'];
+        ResolutionVoidType void_ = env['void'];
+        ResolutionInterfaceType num_ = env['num'];
+        ResolutionInterfaceType int_ = env['int'];
 
-        InterfaceType A = env['A'];
-        InterfaceType B = env['B'];
-        InterfaceType C = env['C'];
-        InterfaceType D = env['D'];
+        ResolutionInterfaceType A = env['A'];
+        ResolutionInterfaceType B = env['B'];
+        ResolutionInterfaceType C = env['C'];
+        ResolutionInterfaceType D = env['D'];
 
         // Ensure that members have been computed on all classes.
         MembersCreator.computeAllClassMembers(env.resolution, D.element);
@@ -620,14 +620,14 @@
     }
     abstract class C extends A implements B {}
     """).then((env) {
-        DynamicType dynamic_ = env['dynamic'];
-        VoidType void_ = env['void'];
-        InterfaceType num_ = env['num'];
-        InterfaceType int_ = env['int'];
+        ResolutionDynamicType dynamic_ = env['dynamic'];
+        ResolutionVoidType void_ = env['void'];
+        ResolutionInterfaceType num_ = env['num'];
+        ResolutionInterfaceType int_ = env['int'];
 
-        InterfaceType A = env['A'];
-        InterfaceType B = env['B'];
-        InterfaceType C = env['C'];
+        ResolutionInterfaceType A = env['A'];
+        ResolutionInterfaceType B = env['B'];
+        ResolutionInterfaceType C = env['C'];
 
         // Ensure that members have been computed on all classes.
         MembersCreator.computeAllClassMembers(env.resolution, C.element);
@@ -674,19 +674,19 @@
     }
     abstract class C<U, V> extends Object with A<U> implements B<V> {}
     """).then((env) {
-        DynamicType dynamic_ = env['dynamic'];
-        VoidType void_ = env['void'];
-        InterfaceType num_ = env['num'];
-        InterfaceType int_ = env['int'];
+        ResolutionDynamicType dynamic_ = env['dynamic'];
+        ResolutionVoidType void_ = env['void'];
+        ResolutionInterfaceType num_ = env['num'];
+        ResolutionInterfaceType int_ = env['int'];
 
         ClassElement A = env.getElement('A');
         ClassElement B = env.getElement('B');
         ClassElement C = env.getElement('C');
-        InterfaceType C_this = C.thisType;
-        TypeVariableType C_U = C_this.typeArguments[0];
-        TypeVariableType C_V = C_this.typeArguments[1];
-        InterfaceType A_U = instantiate(A, [C_U]);
-        InterfaceType B_V = instantiate(B, [C_V]);
+        ResolutionInterfaceType C_this = C.thisType;
+        ResolutionTypeVariableType C_U = C_this.typeArguments[0];
+        ResolutionTypeVariableType C_V = C_this.typeArguments[1];
+        ResolutionInterfaceType A_U = instantiate(A, [C_U]);
+        ResolutionInterfaceType B_V = instantiate(B, [C_V]);
 
         // Ensure that members have been computed on all classes.
         MembersCreator.computeAllClassMembers(env.resolution, C);
@@ -746,14 +746,14 @@
     }
     abstract class C extends Object with B {}
     """).then((env) {
-        DynamicType dynamic_ = env['dynamic'];
-        VoidType void_ = env['void'];
-        InterfaceType num_ = env['num'];
-        InterfaceType int_ = env['int'];
+        ResolutionDynamicType dynamic_ = env['dynamic'];
+        ResolutionVoidType void_ = env['void'];
+        ResolutionInterfaceType num_ = env['num'];
+        ResolutionInterfaceType int_ = env['int'];
 
-        InterfaceType A = env['A'];
-        InterfaceType B = env['B'];
-        InterfaceType C = env['C'];
+        ResolutionInterfaceType A = env['A'];
+        ResolutionInterfaceType B = env['B'];
+        ResolutionInterfaceType C = env['C'];
 
         // Ensure that members have been computed on all classes.
         MembersCreator.computeAllClassMembers(env.resolution, C.element);
diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart
index 240da71..89661da 100644
--- a/tests/compiler/dart2js/memory_compiler.dart
+++ b/tests/compiler/dart2js/memory_compiler.dart
@@ -183,10 +183,10 @@
         .copyConstantValues(cachedCompiler.backend.constantCompilerTask);
 
     Iterable cachedTreeElements =
-        cachedCompiler.enqueuer.resolution.processedElements;
+        cachedCompiler.enqueuer.resolution.processedEntities;
     cachedTreeElements.forEach((element) {
       if (element.library.isPlatformLibrary) {
-        compiler.enqueuer.resolution.registerProcessedElement(element);
+        compiler.enqueuer.resolution.registerProcessedElementInternal(element);
       }
     });
 
diff --git a/tests/compiler/dart2js/minimal_resolution_test.dart b/tests/compiler/dart2js/minimal_resolution_test.dart
index 4304afa..a267acc 100644
--- a/tests/compiler/dart2js/minimal_resolution_test.dart
+++ b/tests/compiler/dart2js/minimal_resolution_test.dart
@@ -25,8 +25,8 @@
 void checkInstantiated(Compiler compiler, ClassElement cls, bool expected) {
   ResolutionEnqueuer enqueuer = compiler.enqueuer.resolution;
   bool isInstantiated =
-      enqueuer.universe.directlyInstantiatedClasses.contains(cls);
-  bool isProcessed = enqueuer.isClassProcessed(cls);
+      enqueuer.worldBuilder.directlyInstantiatedClasses.contains(cls);
+  bool isProcessed = enqueuer.processedClasses.contains(cls);
   Expect.equals(expected, isInstantiated,
       'Unexpected instantiation state of class $cls.');
   Expect.equals(
@@ -44,12 +44,10 @@
       compiler.resolution.wasProxyConstantComputedTestingOnly,
       "Unexpected computation of proxy constant.");
 
+  LibraryElement coreLibrary = compiler.commonElements.coreLibrary;
   checkInstantiated(
-      compiler,
-      compiler.commonElements.coreLibrary.find('_Proxy'),
-      proxyConstantComputed);
-  checkInstantiated(compiler,
-      compiler.commonElements.coreLibrary.find('Deprecated'), deprecatedClass);
+      compiler, coreLibrary.find('_Proxy'), proxyConstantComputed);
+  checkInstantiated(compiler, coreLibrary.find('Deprecated'), deprecatedClass);
 
   LibraryElement jsHelperLibrary =
       compiler.libraryLoader.lookupLibrary(BackendHelpers.DART_JS_HELPER);
diff --git a/tests/compiler/dart2js/mirror_final_field_inferrer2_test.dart b/tests/compiler/dart2js/mirror_final_field_inferrer2_test.dart
index 3d5ce6d..4563009 100644
--- a/tests/compiler/dart2js/mirror_final_field_inferrer2_test.dart
+++ b/tests/compiler/dart2js/mirror_final_field_inferrer2_test.dart
@@ -28,9 +28,12 @@
     var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
     var compiler = result.compiler;
     var element = findElement(compiler, 'field');
-    var commonMasks = compiler.closedWorld.commonMasks;
     var typesInferrer = compiler.globalInference.typesInferrerInternal;
-    Expect.equals(commonMasks.uint31Type,
-        simplify(typesInferrer.getTypeOfElement(element), compiler), 'field');
+    var closedWorld = typesInferrer.closedWorld;
+    var commonMasks = closedWorld.commonMasks;
+    Expect.equals(
+        commonMasks.uint31Type,
+        simplify(typesInferrer.getTypeOfElement(element), closedWorld),
+        'field');
   });
 }
diff --git a/tests/compiler/dart2js/mirror_final_field_inferrer_test.dart b/tests/compiler/dart2js/mirror_final_field_inferrer_test.dart
index 78ea487..0934e37 100644
--- a/tests/compiler/dart2js/mirror_final_field_inferrer_test.dart
+++ b/tests/compiler/dart2js/mirror_final_field_inferrer_test.dart
@@ -28,9 +28,12 @@
     var result = await runCompiler(memorySourceFiles: MEMORY_SOURCE_FILES);
     var compiler = result.compiler;
     var element = findElement(compiler, 'field');
-    var commonMasks = compiler.closedWorld.commonMasks;
     var typesInferrer = compiler.globalInference.typesInferrerInternal;
-    Expect.equals(commonMasks.uint31Type,
-        simplify(typesInferrer.getTypeOfElement(element), compiler), 'field');
+    var closedWorld = typesInferrer.closedWorld;
+    var commonMasks = closedWorld.commonMasks;
+    Expect.equals(
+        commonMasks.uint31Type,
+        simplify(typesInferrer.getTypeOfElement(element), closedWorld),
+        'field');
   });
 }
diff --git a/tests/compiler/dart2js/mirrors_used_test.dart b/tests/compiler/dart2js/mirrors_used_test.dart
index 1befda9..3975516 100644
--- a/tests/compiler/dart2js/mirrors_used_test.dart
+++ b/tests/compiler/dart2js/mirrors_used_test.dart
@@ -50,9 +50,9 @@
         diagnosticHandler: new LegacyCompilerDiagnostics(expectOnlyVerboseInfo),
         options: ['--enable-experimental-mirrors']);
     CompilerImpl compiler = result.compiler;
+    JavaScriptBackend backend = compiler.backend;
     print('');
-    List generatedCode =
-        Elements.sortedByPosition(compiler.enqueuer.codegen.processedEntities);
+    List generatedCode = Elements.sortedByPosition(backend.generatedCode.keys);
     for (var element in generatedCode) {
       print(element);
     }
@@ -84,15 +84,14 @@
 
     // We always include the names of some native classes.
     List<Element> nativeClasses = [
-      compiler.coreClasses.intClass,
-      compiler.coreClasses.doubleClass,
-      compiler.coreClasses.numClass,
-      compiler.coreClasses.stringClass,
-      compiler.coreClasses.boolClass,
-      compiler.coreClasses.nullClass,
-      compiler.coreClasses.listClass
+      compiler.commonElements.intClass,
+      compiler.commonElements.doubleClass,
+      compiler.commonElements.numClass,
+      compiler.commonElements.stringClass,
+      compiler.commonElements.boolClass,
+      compiler.commonElements.nullClass,
+      compiler.commonElements.listClass
     ];
-    JavaScriptBackend backend = compiler.backend;
     Iterable<String> nativeNames = nativeClasses.map(backend.namer.className);
     expectedNames = expectedNames.map(backend.namer.asName).toList();
     expectedNames.addAll(nativeNames);
@@ -127,7 +126,7 @@
     Set<ConstantValue> compiledConstants = backend.constants.compiledConstants;
     // Make sure that most of the metadata constants aren't included in the
     // generated code.
-    backend.processMetadata(compiler.enqueuer.resolution.processedElements,
+    backend.processMetadata(compiler.enqueuer.resolution.processedEntities,
         (metadata) {
       ConstantValue constant =
           backend.constants.getConstantValueForMetadata(metadata);
diff --git a/tests/compiler/dart2js/mixin_typevariable_test.dart b/tests/compiler/dart2js/mixin_typevariable_test.dart
index c57a6bb..deb26ab 100644
--- a/tests/compiler/dart2js/mixin_typevariable_test.dart
+++ b/tests/compiler/dart2js/mixin_typevariable_test.dart
@@ -7,7 +7,7 @@
 import 'package:expect/expect.dart';
 import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import "package:compiler/src/elements/elements.dart" show Element, ClassElement;
 
 void main() {
@@ -50,7 +50,8 @@
             Expect.equals(
                 element, element.typeVariables.first.element.enclosingElement);
           }
-          for (InterfaceType supertype in element.allSupertypesAndSelf.types) {
+          for (ResolutionInterfaceType supertype
+              in element.allSupertypesAndSelf.types) {
             if (!supertype.typeArguments.isEmpty) {
               Expect.listEquals(element.typeVariables, supertype.typeArguments,
                   "Type argument mismatch on supertype $supertype of $element.");
@@ -96,8 +97,8 @@
       """,
               expectNoWarningsOrErrors: true)
           .then((env) {
-        DartType _dynamic = env['dynamic'];
-        DartType _ = env['_'];
+        ResolutionDartType _dynamic = env['dynamic'];
+        ResolutionDartType _ = env['_'];
 
         ClassElement Object = env.getElement('Object');
         ClassElement A = env.getElement('A');
@@ -117,13 +118,14 @@
         ClassElement F1_A_B = F1.superclass;
 
         void testSupertypes(ClassElement element,
-            Map<ClassElement, List<DartType>> typeArguments) {
+            Map<ClassElement, List<ResolutionDartType>> typeArguments) {
           if (element != Object) {
             Expect.isTrue(element.typeVariables.length == 1);
             Expect.equals(
                 element, element.typeVariables.first.element.enclosingElement);
           }
-          for (InterfaceType supertype in element.allSupertypesAndSelf.types) {
+          for (ResolutionInterfaceType supertype
+              in element.allSupertypesAndSelf.types) {
             if (typeArguments.containsKey(supertype.element)) {
               Expect.listEquals(
                   typeArguments[supertype.element],
@@ -151,7 +153,7 @@
           B: [_dynamic, _dynamic]
         });
 
-        DartType D1_T = D1.typeVariables.first;
+        ResolutionDartType D1_T = D1.typeVariables.first;
         testSupertypes(D1, {
           A: [D1_T],
           B: [
@@ -159,7 +161,7 @@
             instantiate(A, [D1_T])
           ]
         });
-        DartType D1_superclass_T = D1.superclass.typeVariables.first;
+        ResolutionDartType D1_superclass_T = D1.superclass.typeVariables.first;
         testSupertypes(D1.superclass, {
           A: [D1_superclass_T],
           B: [
@@ -167,7 +169,7 @@
             instantiate(A, [D1_superclass_T])
           ]
         });
-        DartType D2_T = D2.typeVariables.first;
+        ResolutionDartType D2_T = D2.typeVariables.first;
         testSupertypes(D2, {
           A: [D2_T],
           B: [
@@ -198,7 +200,7 @@
           ]
         });
 
-        DartType F1_T = F1.typeVariables.first;
+        ResolutionDartType F1_T = F1.typeVariables.first;
         testSupertypes(F1, {
           A: [_],
           B: [
@@ -206,7 +208,7 @@
             instantiate(B, [F1_T, _])
           ]
         });
-        DartType F1_superclass_T = F1.superclass.typeVariables.first;
+        ResolutionDartType F1_superclass_T = F1.superclass.typeVariables.first;
         testSupertypes(F1.superclass, {
           A: [_],
           B: [
@@ -214,7 +216,7 @@
             instantiate(B, [F1_superclass_T, _])
           ]
         });
-        DartType F2_T = F2.typeVariables.first;
+        ResolutionDartType F2_T = F2.typeVariables.first;
         testSupertypes(F2, {
           A: [_],
           B: [
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index 7469f0c..1f74b77 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -10,7 +10,8 @@
 import 'package:compiler/compiler.dart' as api;
 import 'package:compiler/src/common/names.dart' show Uris;
 import 'package:compiler/src/constants/expressions.dart';
-import 'package:compiler/src/dart_types.dart' show DartType;
+import 'package:compiler/src/elements/resolution_types.dart'
+    show ResolutionDartType;
 import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
 import 'package:compiler/src/diagnostics/source_span.dart';
 import 'package:compiler/src/diagnostics/spannable.dart';
@@ -148,7 +149,8 @@
       // dynamic invocation the ArgumentTypesRegistry eventually iterates over
       // the interfaces of the Object class which would be 'null' if the class
       // wasn't resolved.
-      coreClasses.objectClass.ensureResolved(resolution);
+      ClassElement objectClass = commonElements.objectClass;
+      objectClass.ensureResolved(resolution);
     }).then((_) => uri);
   }
 
@@ -290,7 +292,7 @@
   static final _emptySet = new Set();
 
   Uri translate(LibraryElement importingLibrary, Uri resolvedUri,
-          [Spannable spannable]) =>
+          Spannable spannable) =>
       resolvedUri;
   Set<Uri> get disallowedLibraryUris => _emptySet;
   bool get mockableLibraryUsed => false;
@@ -321,7 +323,7 @@
 
 class MockTypeVariablesScope extends TypeVariablesScope {
   @override
-  List<DartType> get typeVariables => <DartType>[];
+  List<ResolutionDartType> get typeVariables => <ResolutionDartType>[];
   MockTypeVariablesScope(Scope parent) : super(parent);
   String toString() => 'MockTypeVariablesScope($parent)';
 }
diff --git a/tests/compiler/dart2js/mock_libraries.dart b/tests/compiler/dart2js/mock_libraries.dart
index 867bf4d..c6506fd 100644
--- a/tests/compiler/dart2js/mock_libraries.dart
+++ b/tests/compiler/dart2js/mock_libraries.dart
@@ -101,6 +101,9 @@
   'Symbol': 'class Symbol { final name; const Symbol(this.name); }',
   'Type': 'class Type {}',
   'Pattern': 'abstract class Pattern {}',
+  '_genericNoSuchMethod': '_genericNoSuchMethod(a,b,c,d,e) {}',
+  '_unresolvedConstructorError': '_unresolvedConstructorError(a,b,c,d,e) {}',
+  '_malformedTypeError': '_malformedTypeError(message) {}',
 };
 
 const String DEFAULT_PATCH_CORE_SOURCE = r'''
diff --git a/tests/compiler/dart2js/modulo_remainder_test.dart b/tests/compiler/dart2js/modulo_remainder_test.dart
new file mode 100644
index 0000000..a391a34
--- /dev/null
+++ b/tests/compiler/dart2js/modulo_remainder_test.dart
@@ -0,0 +1,100 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+import 'package:async_helper/async_helper.dart';
+import 'compiler_helper.dart';
+
+const String MOD1 = r"""
+foo(param) {
+  var a = param ? 0xFFFFFFFF : 1;
+  return a % 2;
+  // present: ' % 2'
+  // absent: '$mod'
+}
+""";
+
+const String MOD2 = r"""
+foo(param) {
+  var a = param ? 0xFFFFFFFF : -0.0;
+  return a % 2;
+  // Cannot optimize due to potential -0.
+  // present: '$mod'
+  // absent: ' % 2'
+}
+""";
+
+const String MOD3 = r"""
+foo(param) {
+  var a = param ? 0xFFFFFFFF : -0.0;
+  return (a + 1) % 2;
+  // 'a + 1' cannot be -0.0, so we can optimize.
+  // present: ' % 2'
+  // absent: '$mod'
+}
+""";
+
+const String REM1 = r"""
+foo(param) {
+  var a = param ? 0xFFFFFFFF : 1;
+  return a.remainder(2);
+  // Above can be compiled to '%'.
+  // present: ' % 2'
+  // absent: 'remainder'
+}
+""";
+
+const String REM2 = r"""
+foo(param) {
+  var a = param ? 123.4 : -1;
+  return a.remainder(3);
+  // Above can be compiled to '%'.
+  // present: ' % 3'
+  // absent: 'remainder'
+}
+""";
+
+const String REM3 = r"""
+foo(param) {
+  var a = param ? 123 : null;
+  return 100.remainder(a);
+  // No specialization for possibly null inputs.
+  // present: 'remainder'
+  // absent: '%'
+}
+""";
+
+main() {
+  RegExp directivePattern = new RegExp(
+      //      \1                    \2        \3
+      r'''// *(present|absent): (?:"([^"]*)"|'([^'']*)')''',
+      multiLine: true);
+
+  Future check(String test) {
+    return compile(test, entry: 'foo', check: (String generated) {
+      for (Match match in directivePattern.allMatches(test)) {
+        String directive = match.group(1);
+        String pattern = match.groups([2, 3]).where((s) => s != null).single;
+        if (directive == 'present') {
+          Expect.isTrue(generated.contains(pattern),
+              "Cannot find '$pattern' in:\n$generated");
+        } else {
+          assert(directive == 'absent');
+          Expect.isFalse(generated.contains(pattern),
+              "Must not find '$pattern' in:\n$generated");
+        }
+      }
+    });
+  }
+
+  asyncTest(() => Future.wait([
+        check(MOD1),
+        check(MOD2),
+        check(MOD3),
+        check(REM1),
+        check(REM2),
+        check(REM3),
+      ]));
+}
diff --git a/tests/compiler/dart2js/needs_no_such_method_test.dart b/tests/compiler/dart2js/needs_no_such_method_test.dart
index 892087e..6cd1ae6 100644
--- a/tests/compiler/dart2js/needs_no_such_method_test.dart
+++ b/tests/compiler/dart2js/needs_no_such_method_test.dart
@@ -52,7 +52,7 @@
     bar = new Selector.call(const PublicName('bar'), CallStructure.NO_ARGS);
     baz = new Selector.call(const PublicName('baz'), CallStructure.NO_ARGS);
 
-    closedWorld = env.compiler.closedWorld;
+    closedWorld = env.closedWorld;
     superclass = env.getElement('Superclass');
     subclass = env.getElement('Subclass');
     subtype = env.getElement('Subtype');
diff --git a/tests/compiler/dart2js/null_is_bottom_test.dart b/tests/compiler/dart2js/null_is_bottom_test.dart
new file mode 100644
index 0000000..4d2ca6b
--- /dev/null
+++ b/tests/compiler/dart2js/null_is_bottom_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test that dart2js produces the expected static type warnings for proxy
+// language tests. This ensures that the analyzer and dart2js agrees on these
+// tests.
+
+import 'warnings_checker.dart';
+
+/// Map from test files to a map of their expected status. If the status map is
+/// `null` no warnings must be missing or unexpected, otherwise the status map
+/// can contain a list of line numbers for keys 'missing' and 'unexpected' for
+/// the warnings of each category.
+const Map<String, dynamic> TESTS = const {
+  'language/null_is_bottom_type_test.dart': null,
+};
+
+void main(List<String> args) {
+  checkWarnings(TESTS, args);
+}
diff --git a/tests/compiler/dart2js/partial_parser_test.dart b/tests/compiler/dart2js/partial_parser_test.dart
index 8cf82ae..0bc4de2 100644
--- a/tests/compiler/dart2js/partial_parser_test.dart
+++ b/tests/compiler/dart2js/partial_parser_test.dart
@@ -11,8 +11,7 @@
 }
 
 void testSkipExpression() {
-  PartialParser parser =
-      new PartialParser(new Listener());
+  PartialParser parser = new PartialParser(new Listener());
   Token token = scan('a < b;');
   token = parser.skipExpression(token);
   Expect.equals(';', token.value);
diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart
index 95ee5c3..c95cd5d 100644
--- a/tests/compiler/dart2js/patch_test.dart
+++ b/tests/compiler/dart2js/patch_test.dart
@@ -166,6 +166,59 @@
       "Unexpected patch metadata: ${patch.metadata}.");
 }
 
+Future testPatchFunctionGeneric() async {
+  var compiler = await applyPatch(
+      "external T test<T>();", "@patch T test<T>() { return null; } ");
+  Element origin = ensure(
+      compiler, "test", compiler.commonElements.coreLibrary.find,
+      expectIsPatched: true, checkHasBody: true);
+  ensure(compiler, "test", compiler.commonElements.coreLibrary.patch.find,
+      expectIsPatch: true, checkHasBody: true);
+  compiler.resolver.resolve(origin);
+
+  DiagnosticCollector collector = compiler.diagnosticCollector;
+  Expect.isTrue(
+      collector.warnings.isEmpty, "Unexpected warnings: ${collector.warnings}");
+  Expect.isTrue(
+      collector.errors.isEmpty, "Unexpected errors: ${collector.errors}");
+}
+
+Future testPatchFunctionGenericExtraTypeVariable() async {
+  var compiler = await applyPatch(
+      "external T test<T>();", "@patch T test<T, S>() { return null; } ");
+  Element origin = ensure(
+      compiler, "test", compiler.commonElements.coreLibrary.find,
+      expectIsPatched: true, checkHasBody: true);
+  ensure(compiler, "test", compiler.commonElements.coreLibrary.patch.find,
+      expectIsPatch: true, checkHasBody: true);
+  compiler.resolver.resolve(origin);
+
+  DiagnosticCollector collector = compiler.diagnosticCollector;
+  Expect.isTrue(
+      collector.warnings.isEmpty, "Unexpected warnings: ${collector.warnings}");
+  Expect.equals(1, collector.errors.length);
+  Expect.isTrue(collector.errors.first.message.kind ==
+      MessageKind.PATCH_TYPE_VARIABLES_MISMATCH);
+}
+
+Future testPatchFunctionGenericDifferentNames() async {
+  var compiler = await applyPatch(
+      "external T test<T, S>();", "@patch T test<S, T>() { return null; } ");
+  Element origin = ensure(
+      compiler, "test", compiler.commonElements.coreLibrary.find,
+      expectIsPatched: true, checkHasBody: true);
+  ensure(compiler, "test", compiler.commonElements.coreLibrary.patch.find,
+      expectIsPatch: true, checkHasBody: true);
+  compiler.resolver.resolve(origin);
+
+  DiagnosticCollector collector = compiler.diagnosticCollector;
+  Expect.isTrue(
+      collector.warnings.isEmpty, "Unexpected warnings: ${collector.warnings}");
+  Expect.equals(1, collector.errors.length);
+  Expect.isTrue(collector.errors.first.message.kind ==
+      MessageKind.PATCH_TYPE_VARIABLES_MISMATCH);
+}
+
 Future testPatchVersioned() async {
   String fullPatch = "test(){return 'string';}";
   String lazyPatch = "test(){return 'new and improved string';}";
@@ -920,7 +973,8 @@
       """,
       runCompiler: true,
       analyzeOnly: true);
-  ClosedWorld world = compiler.openWorld.closeWorld(compiler.reporter);
+  compiler.closeResolution();
+  ClosedWorld world = compiler.resolutionWorldBuilder.closedWorldForTesting;
 
   ClassElement cls = ensure(
       compiler, "A", compiler.commonElements.coreLibrary.find,
@@ -940,7 +994,7 @@
   Selector selector =
       new Selector.call(const PublicName('method'), CallStructure.NO_ARGS);
   TypeMask typeMask = new TypeMask.exact(cls, world);
-  FunctionElement method = cls.implementation.lookupLocalMember('method');
+  MethodElement method = cls.implementation.lookupLocalMember('method');
   method.computeType(compiler.resolution);
   Expect.isTrue(selector.applies(method));
   Expect.isTrue(typeMask.canHit(method, selector, world));
@@ -1086,6 +1140,9 @@
     await testPatchRedirectingConstructor();
     await testPatchFunction();
     await testPatchFunctionMetadata();
+    await testPatchFunctionGeneric();
+    await testPatchFunctionGenericExtraTypeVariable();
+    await testPatchFunctionGenericDifferentNames();
     await testPatchMember();
     await testPatchGetter();
     await testRegularMember();
diff --git a/tests/compiler/dart2js/related_types.dart b/tests/compiler/dart2js/related_types.dart
index a2516f7..99d9c31 100644
--- a/tests/compiler/dart2js/related_types.dart
+++ b/tests/compiler/dart2js/related_types.dart
@@ -7,7 +7,7 @@
 import 'package:compiler/src/commandline_options.dart';
 import 'package:compiler/src/compiler.dart';
 import 'package:compiler/src/core_types.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
 import 'package:compiler/src/diagnostics/messages.dart';
 import 'package:compiler/src/elements/elements.dart';
@@ -35,7 +35,7 @@
 
 /// Check all loaded libraries in [compiler] for unrelated types.
 void checkRelatedTypes(Compiler compiler) {
-  compiler.openWorld.closeWorld(compiler.reporter);
+  compiler.closeResolution();
   for (LibraryElement library in compiler.libraryLoader.libraries) {
     checkLibraryElement(compiler, library);
   }
@@ -69,7 +69,8 @@
   }
 }
 
-class RelatedTypesChecker extends TraversalVisitor<DartType, dynamic> {
+class RelatedTypesChecker
+    extends TraversalVisitor<ResolutionDartType, dynamic> {
   final Compiler compiler;
   final ResolvedAst resolvedAst;
 
@@ -77,18 +78,18 @@
       : this.resolvedAst = resolvedAst,
         super(resolvedAst.elements);
 
-  ClosedWorld get world => compiler.closedWorld;
+  ClosedWorld get world =>
+      compiler.resolutionWorldBuilder.closedWorldForTesting;
 
-  CoreClasses get coreClasses => compiler.coreClasses;
-
-  CoreTypes get coreTypes => compiler.coreTypes;
+  CommonElements get commonElements => compiler.commonElements;
 
   DiagnosticReporter get reporter => compiler.reporter;
 
-  InterfaceType get thisType => resolvedAst.element.enclosingClass.thisType;
+  ResolutionInterfaceType get thisType =>
+      resolvedAst.element.enclosingClass.thisType;
 
   /// Returns `true` if there exists no common subtype of [left] and [right].
-  bool hasEmptyIntersection(DartType left, DartType right) {
+  bool hasEmptyIntersection(ResolutionDartType left, ResolutionDartType right) {
     if (left == right) return false;
     if (left == null || right == null) return false;
     ClassElement leftClass = const ClassFinder().findClass(left);
@@ -101,7 +102,8 @@
 
   /// Checks that there exists a common subtype of [left] and [right] or report
   /// a hint otherwise.
-  void checkRelated(Node node, DartType left, DartType right) {
+  void checkRelated(
+      Node node, ResolutionDartType left, ResolutionDartType right) {
     if (hasEmptyIntersection(left, right)) {
       reporter.reportHintMessage(
           node, MessageKind.NO_COMMON_SUBTYPES, {'left': left, 'right': right});
@@ -110,39 +112,39 @@
 
   /// Check weakly typed collection methods, like `Map.containsKey`,
   /// `Map.containsValue` and `Iterable.contains`.
-  void checkDynamicInvoke(Node node, DartType receiverType,
-      List<DartType> argumentTypes, Selector selector) {
+  void checkDynamicInvoke(Node node, ResolutionDartType receiverType,
+      List<ResolutionDartType> argumentTypes, Selector selector) {
     if (selector.name == 'containsKey' &&
         selector.callStructure == CallStructure.ONE_ARG) {
-      InterfaceType mapType = findMapType(receiverType);
+      ResolutionInterfaceType mapType = findMapType(receiverType);
       if (mapType != null) {
-        DartType keyType = findMapKeyType(mapType);
+        ResolutionDartType keyType = findMapKeyType(mapType);
         checkRelated(node, keyType, argumentTypes.first);
       }
     } else if (selector.name == 'containsValue' &&
         selector.callStructure == CallStructure.ONE_ARG) {
-      InterfaceType mapType = findMapType(receiverType);
+      ResolutionInterfaceType mapType = findMapType(receiverType);
       if (mapType != null) {
-        DartType valueType = findMapValueType(mapType);
+        ResolutionDartType valueType = findMapValueType(mapType);
         checkRelated(node, valueType, argumentTypes.first);
       }
     } else if (selector.name == 'contains' &&
         selector.callStructure == CallStructure.ONE_ARG) {
-      InterfaceType iterableType = findIterableType(receiverType);
+      ResolutionInterfaceType iterableType = findIterableType(receiverType);
       if (iterableType != null) {
-        DartType elementType = findIterableElementType(iterableType);
+        ResolutionDartType elementType = findIterableElementType(iterableType);
         checkRelated(node, elementType, argumentTypes.first);
       }
     } else if (selector.name == 'remove' &&
         selector.callStructure == CallStructure.ONE_ARG) {
-      InterfaceType mapType = findMapType(receiverType);
+      ResolutionInterfaceType mapType = findMapType(receiverType);
       if (mapType != null) {
-        DartType keyType = findMapKeyType(mapType);
+        ResolutionDartType keyType = findMapKeyType(mapType);
         checkRelated(node, keyType, argumentTypes.first);
       }
-      InterfaceType listType = findListType(receiverType);
+      ResolutionInterfaceType listType = findListType(receiverType);
       if (listType != null) {
-        DartType valueType = findListElementType(listType);
+        ResolutionDartType valueType = findListElementType(listType);
         checkRelated(node, valueType, argumentTypes.first);
       }
     }
@@ -150,74 +152,76 @@
 
   /// Return the interface type implemented by [type] or `null` if no interface
   /// type is implied by [type].
-  InterfaceType findInterfaceType(DartType type) {
+  ResolutionInterfaceType findInterfaceType(ResolutionDartType type) {
     return Types.computeInterfaceType(compiler.resolution, type);
   }
 
   /// Returns the supertype of [receiver] that implements [cls], if any.
-  InterfaceType findClassType(DartType receiver, ClassElement cls) {
-    InterfaceType interfaceType = findInterfaceType(receiver);
+  ResolutionInterfaceType findClassType(
+      ResolutionDartType receiver, ClassElement cls) {
+    ResolutionInterfaceType interfaceType = findInterfaceType(receiver);
     if (interfaceType == null) return null;
-    InterfaceType mapType = interfaceType.asInstanceOf(cls);
+    ResolutionInterfaceType mapType = interfaceType.asInstanceOf(cls);
     if (mapType == null) return null;
     return mapType;
   }
 
   /// Returns the supertype of [receiver] that implements `Iterable`, if any.
-  InterfaceType findIterableType(DartType receiver) {
-    return findClassType(receiver, coreClasses.iterableClass);
+  ResolutionInterfaceType findIterableType(ResolutionDartType receiver) {
+    return findClassType(receiver, commonElements.iterableClass);
   }
 
   /// Returns the element type of the supertype of [receiver] that implements
   /// `Iterable`, if any.
-  DartType findIterableElementType(InterfaceType iterableType) {
+  ResolutionDartType findIterableElementType(
+      ResolutionInterfaceType iterableType) {
     if (iterableType == null) return null;
     return iterableType.typeArguments[0];
   }
 
   /// Returns the supertype of [receiver] that implements `Map`, if any.
-  InterfaceType findMapType(DartType receiver) {
-    return findClassType(receiver, coreClasses.mapClass);
+  ResolutionInterfaceType findMapType(ResolutionDartType receiver) {
+    return findClassType(receiver, commonElements.mapClass);
   }
 
   /// Returns the key type of the supertype of [receiver] that implements
   /// `Map`, if any.
-  DartType findMapKeyType(InterfaceType mapType) {
+  ResolutionDartType findMapKeyType(ResolutionInterfaceType mapType) {
     if (mapType == null) return null;
     return mapType.typeArguments[0];
   }
 
   /// Returns the value type of the supertype of [receiver] that implements
   /// `Map`, if any.
-  DartType findMapValueType(InterfaceType mapType) {
+  ResolutionDartType findMapValueType(ResolutionInterfaceType mapType) {
     if (mapType == null) return null;
     return mapType.typeArguments[1];
   }
 
   /// Returns the supertype of [receiver] that implements `List`, if any.
-  InterfaceType findListType(DartType receiver) {
-    return findClassType(receiver, coreClasses.listClass);
+  ResolutionInterfaceType findListType(ResolutionDartType receiver) {
+    return findClassType(receiver, commonElements.listClass);
   }
 
   /// Returns the element type of the supertype of [receiver] that implements
   /// `List`, if any.
-  DartType findListElementType(InterfaceType listType) {
+  ResolutionDartType findListElementType(ResolutionInterfaceType listType) {
     if (listType == null) return null;
     return listType.typeArguments[0];
   }
 
   /// Returns the implied return type of [type] or `dynamic` if no return type
   /// is implied.
-  DartType findReturnType(DartType type) {
-    if (type is FunctionType) {
+  ResolutionDartType findReturnType(ResolutionDartType type) {
+    if (type is ResolutionFunctionType) {
       return type.returnType;
     }
-    return const DynamicType();
+    return const ResolutionDynamicType();
   }
 
   /// Visits [arguments] and returns the list of their corresponding types.
-  List<DartType> findArgumentTypes(NodeList arguments) {
-    List<DartType> argumentTypes = <DartType>[];
+  List<ResolutionDartType> findArgumentTypes(NodeList arguments) {
+    List<ResolutionDartType> argumentTypes = <ResolutionDartType>[];
     for (Node argument in arguments) {
       argumentTypes.add(apply(argument));
     }
@@ -225,179 +229,193 @@
   }
 
   /// Finds the [MemberSignature] of the [name] property on [type], if any.
-  MemberSignature lookupInterfaceMember(DartType type, Name name) {
-    InterfaceType interfaceType = findInterfaceType(type);
+  MemberSignature lookupInterfaceMember(ResolutionDartType type, Name name) {
+    ResolutionInterfaceType interfaceType = findInterfaceType(type);
     if (interfaceType == null) return null;
     return interfaceType.lookupInterfaceMember(name);
   }
 
   /// Returns the type of an access of the [name] property on [type], or
   /// `dynamic` if no property was found.
-  DartType lookupInterfaceMemberAccessType(DartType type, Name name) {
+  ResolutionDartType lookupInterfaceMemberAccessType(
+      ResolutionDartType type, Name name) {
     MemberSignature member = lookupInterfaceMember(type, name);
-    if (member == null) return const DynamicType();
+    if (member == null) return const ResolutionDynamicType();
     return member.type;
   }
 
   /// Returns the function type of the [name] property on [type], or
   /// `dynamic` if no property was found.
-  FunctionType lookupInterfaceMemberInvocationType(DartType type, Name name) {
+  ResolutionFunctionType lookupInterfaceMemberInvocationType(
+      ResolutionDartType type, Name name) {
     MemberSignature member = lookupInterfaceMember(type, name);
     if (member == null) return null;
     return member.functionType;
   }
 
-  DartType apply(Node node, [_]) {
-    DartType type = node.accept(this);
+  ResolutionDartType apply(Node node, [_]) {
+    ResolutionDartType type = node.accept(this);
     if (type == null) {
-      type = const DynamicType();
+      type = const ResolutionDynamicType();
     }
     return type;
   }
 
   @override
-  DartType visitEquals(Send node, Node left, Node right, _) {
-    DartType leftType = apply(left);
-    DartType rightType = apply(right);
+  ResolutionInterfaceType visitEquals(Send node, Node left, Node right, _) {
+    ResolutionDartType leftType = apply(left);
+    ResolutionDartType rightType = apply(right);
     checkRelated(node, leftType, rightType);
-    return coreTypes.boolType;
+    return commonElements.boolType;
   }
 
   @override
-  DartType visitNotEquals(Send node, Node left, Node right, _) {
-    DartType leftType = apply(left);
-    DartType rightType = apply(right);
+  ResolutionInterfaceType visitNotEquals(Send node, Node left, Node right, _) {
+    ResolutionDartType leftType = apply(left);
+    ResolutionDartType rightType = apply(right);
     checkRelated(node, leftType, rightType);
-    return coreTypes.boolType;
+    return commonElements.boolType;
   }
 
   @override
-  DartType visitIndex(Send node, Node receiver, Node index, _) {
-    DartType receiverType = apply(receiver);
-    DartType indexType = apply(index);
-    InterfaceType mapType = findMapType(receiverType);
-    DartType keyType = findMapKeyType(mapType);
-    DartType valueType = findMapValueType(mapType);
+  ResolutionDartType visitIndex(Send node, Node receiver, Node index, _) {
+    ResolutionDartType receiverType = apply(receiver);
+    ResolutionDartType indexType = apply(index);
+    ResolutionInterfaceType mapType = findMapType(receiverType);
+    ResolutionDartType keyType = findMapKeyType(mapType);
+    ResolutionDartType valueType = findMapValueType(mapType);
     checkRelated(index, keyType, indexType);
     return valueType;
   }
 
   @override
-  DartType visitLiteralInt(LiteralInt node) {
-    return coreTypes.intType;
+  ResolutionInterfaceType visitLiteralInt(LiteralInt node) {
+    return commonElements.intType;
   }
 
   @override
-  DartType visitLiteralString(LiteralString node) {
-    return coreTypes.stringType;
+  ResolutionInterfaceType visitLiteralString(LiteralString node) {
+    return commonElements.stringType;
   }
 
   @override
-  DartType visitLiteralBool(LiteralBool node) {
-    return coreTypes.boolType;
+  ResolutionInterfaceType visitLiteralBool(LiteralBool node) {
+    return commonElements.boolType;
   }
 
   @override
-  DartType visitLiteralMap(LiteralMap node) {
+  ResolutionDartType visitLiteralMap(LiteralMap node) {
     return elements.getType(node);
   }
 
   @override
-  DartType visitLiteralList(LiteralList node) {
+  ResolutionDartType visitLiteralList(LiteralList node) {
     return elements.getType(node);
   }
 
   @override
-  DartType visitLiteralNull(LiteralNull node) {
+  ResolutionDartType visitLiteralNull(LiteralNull node) {
     return elements.getType(node);
   }
 
   @override
-  DartType visitLocalVariableGet(Send node, LocalVariableElement variable, _) {
+  ResolutionDartType visitLocalVariableGet(
+      Send node, LocalVariableElement variable, _) {
     return variable.type;
   }
 
   @override
-  DartType visitLocalFunctionGet(Send node, LocalFunctionElement function, _) {
+  ResolutionDartType visitLocalFunctionGet(
+      Send node, LocalFunctionElement function, _) {
     return function.type;
   }
 
   @override
-  DartType visitParameterGet(Send node, ParameterElement parameter, _) {
+  ResolutionDartType visitParameterGet(
+      Send node, ParameterElement parameter, _) {
     return parameter.type;
   }
 
   @override
-  DartType visitThisPropertyGet(Send node, Name name, _) {
+  ResolutionDartType visitThisPropertyGet(Send node, Name name, _) {
     return lookupInterfaceMemberAccessType(thisType, name);
   }
 
   @override
-  DartType visitDynamicPropertyGet(Send node, Node receiver, Name name, _) {
-    DartType receiverType = apply(receiver);
-    return lookupInterfaceMemberAccessType(receiverType, name);
-  }
-
-  @override
-  DartType visitIfNotNullDynamicPropertyGet(
+  ResolutionDartType visitDynamicPropertyGet(
       Send node, Node receiver, Name name, _) {
-    DartType receiverType = apply(receiver);
+    ResolutionDartType receiverType = apply(receiver);
     return lookupInterfaceMemberAccessType(receiverType, name);
   }
 
   @override
-  DartType visitStaticFieldGet(Send node, FieldElement field, _) {
+  ResolutionDartType visitIfNotNullDynamicPropertyGet(
+      Send node, Node receiver, Name name, _) {
+    ResolutionDartType receiverType = apply(receiver);
+    return lookupInterfaceMemberAccessType(receiverType, name);
+  }
+
+  @override
+  ResolutionDartType visitStaticFieldGet(Send node, FieldElement field, _) {
     return field.type;
   }
 
   @override
-  DartType visitTopLevelFieldGet(Send node, FieldElement field, _) {
+  ResolutionDartType visitTopLevelFieldGet(Send node, FieldElement field, _) {
     return field.type;
   }
 
   @override
-  DartType visitDynamicPropertyInvoke(
+  ResolutionDartType visitDynamicPropertyInvoke(
       Send node, Node receiver, NodeList arguments, Selector selector, _) {
-    DartType receiverType = apply(receiver);
-    List<DartType> argumentTypes = findArgumentTypes(arguments);
-    FunctionType methodType =
+    ResolutionDartType receiverType = apply(receiver);
+    List<ResolutionDartType> argumentTypes = findArgumentTypes(arguments);
+    ResolutionFunctionType methodType =
         lookupInterfaceMemberInvocationType(receiverType, selector.memberName);
     checkDynamicInvoke(node, receiverType, argumentTypes, selector);
     return findReturnType(methodType);
   }
 
   @override
-  DartType visitThisPropertyInvoke(
+  ResolutionDartType visitThisPropertyInvoke(
       Send node, NodeList arguments, Selector selector, _) {
-    DartType receiverType = thisType;
-    List<DartType> argumentTypes = findArgumentTypes(arguments);
-    FunctionType methodType =
+    ResolutionDartType receiverType = thisType;
+    List<ResolutionDartType> argumentTypes = findArgumentTypes(arguments);
+    ResolutionFunctionType methodType =
         lookupInterfaceMemberInvocationType(receiverType, selector.memberName);
     checkDynamicInvoke(node, receiverType, argumentTypes, selector);
     return findReturnType(methodType);
   }
 
   @override
-  DartType visitIfNotNullDynamicPropertyInvoke(
+  ResolutionDartType visitIfNotNullDynamicPropertyInvoke(
       Send node, Node receiver, NodeList arguments, Selector selector, _) {
-    DartType receiverType = apply(receiver);
-    List<DartType> argumentTypes = findArgumentTypes(arguments);
-    FunctionType methodType =
+    ResolutionDartType receiverType = apply(receiver);
+    List<ResolutionDartType> argumentTypes = findArgumentTypes(arguments);
+    ResolutionFunctionType methodType =
         lookupInterfaceMemberInvocationType(receiverType, selector.memberName);
     checkDynamicInvoke(node, receiverType, argumentTypes, selector);
     return findReturnType(methodType);
   }
 
   @override
-  DartType visitTopLevelFunctionInvoke(Send node, MethodElement function,
-      NodeList arguments, CallStructure callStructure, _) {
+  ResolutionDartType visitTopLevelFunctionInvoke(
+      Send node,
+      MethodElement function,
+      NodeList arguments,
+      CallStructure callStructure,
+      _) {
     apply(arguments);
     return findReturnType(function.type);
   }
 
   @override
-  DartType visitStaticFunctionInvoke(Send node, MethodElement function,
-      NodeList arguments, CallStructure callStructure, _) {
+  ResolutionDartType visitStaticFunctionInvoke(
+      Send node,
+      MethodElement function,
+      NodeList arguments,
+      CallStructure callStructure,
+      _) {
     apply(arguments);
     return findReturnType(function.type);
   }
@@ -408,13 +426,13 @@
 class ClassFinder extends BaseDartTypeVisitor<ClassElement, dynamic> {
   const ClassFinder();
 
-  ClassElement findClass(DartType type) => type.accept(this, null);
+  ClassElement findClass(ResolutionDartType type) => type.accept(this, null);
 
   @override
-  ClassElement visitType(DartType type, _) => null;
+  ClassElement visitType(ResolutionDartType type, _) => null;
 
   @override
-  ClassElement visitInterfaceType(InterfaceType type, _) {
+  ClassElement visitInterfaceType(ResolutionInterfaceType type, _) {
     return type.element;
   }
 }
diff --git a/tests/compiler/dart2js/related_types_test.dart b/tests/compiler/dart2js/related_types_test.dart
index 6711fb2..e256ac8 100644
--- a/tests/compiler/dart2js/related_types_test.dart
+++ b/tests/compiler/dart2js/related_types_test.dart
@@ -267,7 +267,7 @@
     Expect.isFalse(
         collector.hasRegularMessages, "Unexpected analysis messages.");
     Compiler compiler = result.compiler;
-    compiler.openWorld.closeWorld(compiler.reporter);
+    compiler.closeResolution();
 
     void checkMember(MemberElement member) {
       if (!member.name.startsWith('test_')) return;
diff --git a/tests/compiler/dart2js/resolution_test.dart b/tests/compiler/dart2js/resolution_test.dart
index cfca9a8..8ad71c2 100644
--- a/tests/compiler/dart2js/resolution_test.dart
+++ b/tests/compiler/dart2js/resolution_test.dart
@@ -103,14 +103,16 @@
 void testHasRuntimeType(String code) {
   test(code, (compiler) {
     var element = compiler.backend.helpers.createRuntimeType;
-    Expect.isTrue(compiler.enqueuer.resolution.isProcessed(element));
+    Expect.isTrue(
+        compiler.enqueuer.resolution.processedEntities.contains(element));
   });
 }
 
 main() {
   test(NO_RUNTIME_TYPE, (compiler) {
     var element = compiler.backend.helpers.createRuntimeType;
-    Expect.isFalse(compiler.enqueuer.resolution.isProcessed(element));
+    Expect.isFalse(
+        compiler.enqueuer.resolution.processedEntities.contains(element));
   });
 
   testHasRuntimeType(HAS_RUNTIME_TYPE_1);
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index 7be75ef1..3035fbf 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -8,7 +8,7 @@
 import 'package:async_helper/async_helper.dart';
 import 'package:expect/expect.dart';
 import 'package:compiler/src/constants/expressions.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/elements/modelx.dart';
 import 'package:compiler/src/resolution/constructors.dart';
 import 'package:compiler/src/resolution/members.dart';
@@ -147,11 +147,12 @@
   matchResolvedTypes(visitor, text, name, expectedElements) {
     VariableDefinitions definition = parseStatement(text);
     visitor.visit(definition.type);
-    InterfaceType type = visitor.registry.mapping.getType(definition.type);
+    ResolutionInterfaceType type =
+        visitor.registry.mapping.getType(definition.type);
     Expect.equals(
         definition.type.typeArguments.slowLength(), type.typeArguments.length);
     int index = 0;
-    for (DartType argument in type.typeArguments) {
+    for (ResolutionDartType argument in type.typeArguments) {
       Expect.equals(true, index < expectedElements.length);
       Expect.equals(expectedElements[index], argument.element);
       index++;
@@ -164,8 +165,10 @@
       ResolverVisitor visitor = compiler.resolverVisitor();
       compiler.parseScript('class Foo<T, U> {}');
       ClassElement foo = compiler.mainApp.find('Foo');
-      matchResolvedTypes(visitor, 'Foo<int, String> x;', 'Foo',
-          [compiler.coreClasses.intClass, compiler.coreClasses.stringClass]);
+      matchResolvedTypes(visitor, 'Foo<int, String> x;', 'Foo', [
+        compiler.commonElements.intClass,
+        compiler.commonElements.stringClass
+      ]);
       matchResolvedTypes(visitor, 'Foo<Foo, Foo> x;', 'Foo', [foo, foo]);
     }),
     MockCompiler.create((MockCompiler compiler) {
@@ -801,7 +804,7 @@
       Expect.equals(0, collector.warnings.length);
       Expect.equals(0, collector.errors.length);
       ClassElement aElement = compiler.mainApp.find("A");
-      Link<DartType> supertypes = aElement.allSupertypes;
+      Link<ResolutionDartType> supertypes = aElement.allSupertypes;
       Expect.equals(<String>['B', 'C', 'Object'].toString(),
           asSortedStrings(supertypes).toString());
     }),
@@ -818,7 +821,7 @@
       Expect.equals(0, collector.warnings.length);
       Expect.equals(0, collector.errors.length);
       ClassElement aElement = compiler.mainApp.find("C");
-      Link<DartType> supertypes = aElement.allSupertypes;
+      Link<ResolutionDartType> supertypes = aElement.allSupertypes;
       // Object is once per inheritance path, that is from both A and I.
       Expect.equals(
           <String>[
@@ -840,7 +843,7 @@
       Expect.equals(0, collector.warnings.length);
       Expect.equals(0, collector.errors.length);
       ClassElement aElement = compiler.mainApp.find("E");
-      Link<DartType> supertypes = aElement.allSupertypes;
+      Link<ResolutionDartType> supertypes = aElement.allSupertypes;
       Expect.equals(<String>['A<E>', 'D', 'Object'].toString(),
           asSortedStrings(supertypes).toString());
     }),
diff --git a/tests/compiler/dart2js/semantic_visitor_test.dart b/tests/compiler/dart2js/semantic_visitor_test.dart
index 615852b..1966a04 100644
--- a/tests/compiler/dart2js/semantic_visitor_test.dart
+++ b/tests/compiler/dart2js/semantic_visitor_test.dart
@@ -10,7 +10,7 @@
 import 'package:expect/expect.dart';
 import 'package:compiler/src/commandline_options.dart';
 import 'package:compiler/src/constants/expressions.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/diagnostics/spannable.dart';
 import 'package:compiler/src/diagnostics/messages.dart' show MessageKind;
 import 'package:compiler/src/compiler.dart';
diff --git a/tests/compiler/dart2js/semantic_visitor_test_decl_visitor.dart b/tests/compiler/dart2js/semantic_visitor_test_decl_visitor.dart
index 86b1a3f..41055c6 100644
--- a/tests/compiler/dart2js/semantic_visitor_test_decl_visitor.dart
+++ b/tests/compiler/dart2js/semantic_visitor_test_decl_visitor.dart
@@ -91,7 +91,7 @@
       FunctionExpression node,
       ConstructorElement constructor,
       NodeList parameters,
-      InterfaceType redirectionType,
+      ResolutionInterfaceType redirectionType,
       ConstructorElement redirectionTarget,
       arg) {
     visits.add(new Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,
@@ -131,7 +131,7 @@
   visitSuperConstructorInvoke(
       Send node,
       ConstructorElement superConstructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       arg) {
@@ -146,7 +146,7 @@
 
   @override
   visitImplicitSuperConstructorInvoke(FunctionExpression node,
-      ConstructorElement superConstructor, InterfaceType type, arg) {
+      ConstructorElement superConstructor, ResolutionInterfaceType type, arg) {
     visits.add(new Visit(VisitKind.VISIT_IMPLICIT_SUPER_CONSTRUCTOR_INVOKE,
         element: superConstructor, type: type));
     super
diff --git a/tests/compiler/dart2js/semantic_visitor_test_send_visitor.dart b/tests/compiler/dart2js/semantic_visitor_test_send_visitor.dart
index c16454e..4077d2d 100644
--- a/tests/compiler/dart2js/semantic_visitor_test_send_visitor.dart
+++ b/tests/compiler/dart2js/semantic_visitor_test_send_visitor.dart
@@ -8,7 +8,7 @@
   SemanticSendTestVisitor(TreeElements elements) : super(elements);
 
   @override
-  visitAs(Send node, Node expression, DartType type, arg) {
+  visitAs(Send node, Node expression, ResolutionDartType type, arg) {
     visits
         .add(new Visit(VisitKind.VISIT_AS, expression: expression, type: type));
     apply(expression, arg);
@@ -256,14 +256,14 @@
   }
 
   @override
-  visitIs(Send node, Node expression, DartType type, arg) {
+  visitIs(Send node, Node expression, ResolutionDartType type, arg) {
     visits
         .add(new Visit(VisitKind.VISIT_IS, expression: expression, type: type));
     apply(expression, arg);
   }
 
   @override
-  visitIsNot(Send node, Node expression, DartType type, arg) {
+  visitIsNot(Send node, Node expression, ResolutionDartType type, arg) {
     visits.add(
         new Visit(VisitKind.VISIT_IS_NOT, expression: expression, type: type));
     apply(expression, arg);
@@ -1697,7 +1697,7 @@
 
   @override
   visitUnresolvedClassConstructorInvoke(NewExpression node, Element constructor,
-      DartType type, NodeList arguments, Selector selector, arg) {
+      ResolutionDartType type, NodeList arguments, Selector selector, arg) {
     // TODO(johnniwinther): Test [type] when it is not `dynamic`.
     visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE,
         arguments: arguments));
@@ -1706,7 +1706,7 @@
 
   @override
   visitUnresolvedConstructorInvoke(NewExpression node, Element constructor,
-      DartType type, NodeList arguments, Selector selector, arg) {
+      ResolutionDartType type, NodeList arguments, Selector selector, arg) {
     // TODO(johnniwinther): Test [type] when it is not `dynamic`.
     visits.add(new Visit(VisitKind.VISIT_UNRESOLVED_CONSTRUCTOR_INVOKE,
         arguments: arguments));
@@ -1749,8 +1749,13 @@
   }
 
   @override
-  errorNonConstantConstructorInvoke(NewExpression node, Element element,
-      DartType type, NodeList arguments, CallStructure callStructure, arg) {
+  errorNonConstantConstructorInvoke(
+      NewExpression node,
+      Element element,
+      ResolutionDartType type,
+      NodeList arguments,
+      CallStructure callStructure,
+      arg) {
     visits.add(new Visit(VisitKind.ERROR_NON_CONSTANT_CONSTRUCTOR_INVOKE,
         element: element,
         type: type,
@@ -1764,7 +1769,7 @@
   visitConstructorIncompatibleInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       arg) {
@@ -1781,7 +1786,7 @@
   visitFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       arg) {
@@ -1797,7 +1802,7 @@
   visitGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       arg) {
@@ -1813,9 +1818,9 @@
   visitRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       ConstructorElement effectiveTarget,
-      InterfaceType effectiveTargetType,
+      ResolutionInterfaceType effectiveTargetType,
       NodeList arguments,
       CallStructure callStructure,
       arg) {
@@ -1833,7 +1838,7 @@
   visitRedirectingGenerativeConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       arg) {
@@ -1850,7 +1855,7 @@
   visitAbstractClassConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       arg) {
@@ -1866,7 +1871,7 @@
   visitUnresolvedRedirectingFactoryConstructorInvoke(
       NewExpression node,
       ConstructorElement constructor,
-      InterfaceType type,
+      ResolutionInterfaceType type,
       NodeList arguments,
       CallStructure callStructure,
       arg) {
diff --git a/tests/compiler/dart2js/serialization/members_test.dart b/tests/compiler/dart2js/serialization/members_test.dart
index 22e0899..42b9c87 100644
--- a/tests/compiler/dart2js/serialization/members_test.dart
+++ b/tests/compiler/dart2js/serialization/members_test.dart
@@ -87,12 +87,13 @@
 
 Name convertName(Name name, Compiler compiler) {
   if (name.isPrivate) {
-    LibraryElement library =
-        compiler.libraryLoader.lookupLibrary(name.library.canonicalUri);
-    if (!areElementsEquivalent(name.library, library)) {
-      throw 'Libraries ${name.library} and ${library} are not equivalent';
+    LibraryElement library1 = name.library;
+    LibraryElement library2 =
+        compiler.libraryLoader.lookupLibrary(library1.canonicalUri);
+    if (!areElementsEquivalent(library1, library2)) {
+      throw 'Libraries ${library1} and ${library2} are not equivalent';
     }
-    name = new Name(name.text, library, isSetter: name.isSetter);
+    name = new Name(name.text, library2, isSetter: name.isSetter);
   }
   return name;
 }
diff --git a/tests/compiler/dart2js/serialization/model_test_helper.dart b/tests/compiler/dart2js/serialization/model_test_helper.dart
index e3e6614..66e73cb 100644
--- a/tests/compiler/dart2js/serialization/model_test_helper.dart
+++ b/tests/compiler/dart2js/serialization/model_test_helper.dart
@@ -13,7 +13,7 @@
 import 'package:compiler/src/common.dart';
 import 'package:compiler/src/constants/values.dart';
 import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/deferred_load.dart';
 import 'package:compiler/src/elements/elements.dart';
 import 'package:compiler/src/enqueue.dart';
@@ -99,7 +99,8 @@
         compilerDeserialized.enqueuer.resolution,
         verbose: verbose);
     checkClosedWorlds(
-        compilerNormal.closedWorld, compilerDeserialized.closedWorld,
+        compilerNormal.resolutionWorldBuilder.closedWorldForTesting,
+        compilerDeserialized.resolutionWorldBuilder.closedWorldForTesting,
         verbose: verbose);
     checkBackendInfo(compilerNormal, compilerDeserialized, verbose: verbose);
   });
@@ -107,15 +108,16 @@
 
 void checkResolutionEnqueuers(
     ResolutionEnqueuer enqueuer1, ResolutionEnqueuer enqueuer2,
-    {bool typeEquivalence(DartType a, DartType b): areTypesEquivalent,
+    {bool typeEquivalence(ResolutionDartType a, ResolutionDartType b):
+        areTypesEquivalent,
     bool elementFilter(Element element),
     bool verbose: false}) {
-  checkSets(enqueuer1.processedElements, enqueuer2.processedElements,
+  checkSets(enqueuer1.processedEntities, enqueuer2.processedEntities,
       "Processed element mismatch", areElementsEquivalent,
       elementFilter: elementFilter, verbose: verbose);
 
-  ResolutionWorldBuilderImpl worldBuilder1 = enqueuer1.universe;
-  ResolutionWorldBuilderImpl worldBuilder2 = enqueuer2.universe;
+  ResolutionWorldBuilderImpl worldBuilder1 = enqueuer1.worldBuilder;
+  ResolutionWorldBuilderImpl worldBuilder2 = enqueuer2.worldBuilder;
 
   checkMaps(
       worldBuilder1.getInstantiationMap(),
@@ -126,39 +128,35 @@
       verbose: verbose);
 
   checkSets(
-      enqueuer1.universe.directlyInstantiatedClasses,
-      enqueuer2.universe.directlyInstantiatedClasses,
+      enqueuer1.worldBuilder.directlyInstantiatedClasses,
+      enqueuer2.worldBuilder.directlyInstantiatedClasses,
       "Directly instantiated classes mismatch",
       areElementsEquivalent,
       verbose: verbose);
 
   checkSets(
-      enqueuer1.universe.instantiatedTypes,
-      enqueuer2.universe.instantiatedTypes,
+      enqueuer1.worldBuilder.instantiatedTypes,
+      enqueuer2.worldBuilder.instantiatedTypes,
       "Instantiated types mismatch",
       typeEquivalence,
       verbose: verbose);
 
-  checkSets(enqueuer1.universe.isChecks, enqueuer2.universe.isChecks,
+  checkSets(enqueuer1.worldBuilder.isChecks, enqueuer2.worldBuilder.isChecks,
       "Is-check mismatch", typeEquivalence,
       verbose: verbose);
 
   JavaScriptBackend backend1 = enqueuer1.backend;
   JavaScriptBackend backend2 = enqueuer2.backend;
   Expect.equals(backend1.hasInvokeOnSupport, backend2.hasInvokeOnSupport,
-      "Compiler.enabledInvokeOn mismatch");
+      "JavaScriptBackend.hasInvokeOnSupport mismatch");
   Expect.equals(
-      enqueuer1.universe.hasFunctionApplySupport,
-      enqueuer2.universe.hasFunctionApplySupport,
-      "ResolutionEnqueuer.universe.hasFunctionApplySupport mismatch");
-  Expect.equals(
-      enqueuer1.universe.hasRuntimeTypeSupport,
-      enqueuer2.universe.hasRuntimeTypeSupport,
-      "ResolutionEnqueuer.universe.hasRuntimeTypeSupport mismatch");
-  Expect.equals(
-      enqueuer1.universe.hasIsolateSupport,
-      enqueuer2.universe.hasIsolateSupport,
-      "ResolutionEnqueuer.universe.hasIsolateSupport mismatch");
+      backend1.hasFunctionApplySupport,
+      backend2.hasFunctionApplySupport,
+      "JavaScriptBackend.hasFunctionApplySupport mismatch");
+  Expect.equals(backend1.hasRuntimeTypeSupport, backend2.hasRuntimeTypeSupport,
+      "JavaScriptBackend.hasRuntimeTypeSupport mismatch");
+  Expect.equals(backend1.hasIsolateSupport, backend2.hasIsolateSupport,
+      "JavaScriptBackend.hasIsolateSupport mismatch");
 }
 
 void checkClosedWorlds(ClosedWorld closedWorld1, ClosedWorld closedWorld2,
@@ -166,16 +164,18 @@
   checkClassHierarchyNodes(
       closedWorld1,
       closedWorld2,
-      closedWorld1.getClassHierarchyNode(closedWorld1.coreClasses.objectClass),
-      closedWorld2.getClassHierarchyNode(closedWorld2.coreClasses.objectClass),
+      closedWorld1
+          .getClassHierarchyNode(closedWorld1.commonElements.objectClass),
+      closedWorld2
+          .getClassHierarchyNode(closedWorld2.commonElements.objectClass),
       verbose: verbose);
 }
 
 void checkBackendInfo(Compiler compilerNormal, Compiler compilerDeserialized,
     {bool verbose: false}) {
   checkSets(
-      compilerNormal.enqueuer.resolution.processedElements,
-      compilerDeserialized.enqueuer.resolution.processedElements,
+      compilerNormal.enqueuer.resolution.processedEntities,
+      compilerDeserialized.enqueuer.resolution.processedEntities,
       "Processed element mismatch",
       areElementsEquivalent, onSameElement: (a, b) {
     checkElements(compilerNormal, compilerDeserialized, a, b, verbose: verbose);
@@ -338,10 +338,10 @@
       if (child.isInstantiated) {
         print('Missing subclass ${child.cls} of ${node1.cls} '
             'in ${node2.directSubclasses}');
-        print(closedWorld1
-            .dump(verbose ? closedWorld1.coreClasses.objectClass : node1.cls));
-        print(closedWorld2
-            .dump(verbose ? closedWorld2.coreClasses.objectClass : node2.cls));
+        print(closedWorld1.dump(
+            verbose ? closedWorld1.commonElements.objectClass : node1.cls));
+        print(closedWorld2.dump(
+            verbose ? closedWorld2.commonElements.objectClass : node2.cls));
       }
       Expect.isFalse(
           child.isInstantiated,
@@ -426,8 +426,10 @@
       (a, b) => areElementsEquivalent(a.declaration, b.declaration));
 }
 
-bool areInstantiationInfosEquivalent(InstantiationInfo info1,
-    InstantiationInfo info2, bool typeEquivalence(DartType a, DartType b)) {
+bool areInstantiationInfosEquivalent(
+    InstantiationInfo info1,
+    InstantiationInfo info2,
+    bool typeEquivalence(ResolutionDartType a, ResolutionDartType b)) {
   checkMaps(
       info1.instantiationMap,
       info2.instantiationMap,
@@ -440,7 +442,7 @@
 }
 
 bool areInstancesEquivalent(Instance instance1, Instance instance2,
-    bool typeEquivalence(DartType a, DartType b)) {
+    bool typeEquivalence(ResolutionDartType a, ResolutionDartType b)) {
   return typeEquivalence(instance1.type, instance2.type) &&
       instance1.kind == instance2.kind &&
       instance1.isRedirection == instance2.isRedirection;
diff --git a/tests/compiler/dart2js/serialization/test_helper.dart b/tests/compiler/dart2js/serialization/test_helper.dart
index 1808b7f..a07dfe2 100644
--- a/tests/compiler/dart2js/serialization/test_helper.dart
+++ b/tests/compiler/dart2js/serialization/test_helper.dart
@@ -8,7 +8,7 @@
 import 'package:compiler/src/common/resolution.dart';
 import 'package:compiler/src/constants/expressions.dart';
 import 'package:compiler/src/constants/values.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/compiler.dart';
 import 'package:compiler/src/elements/elements.dart';
 import 'package:compiler/src/serialization/equivalence.dart';
@@ -103,7 +103,7 @@
 
   @override
   bool testTypes(Object object1, Object object2, String property,
-      DartType type1, DartType type2) {
+      ResolutionDartType type1, ResolutionDartType type2) {
     return checkTypes(object1, object2, property, type1, type2);
   }
 
@@ -121,7 +121,7 @@
 
   @override
   bool testTypeLists(Object object1, Object object2, String property,
-      List<DartType> list1, List<DartType> list2) {
+      List<ResolutionDartType> list1, List<ResolutionDartType> list2) {
     return checkTypeLists(object1, object2, property, list1, list2);
   }
 
@@ -301,8 +301,8 @@
 /// Checks the equivalence of [type1] and [type2].
 ///
 /// Uses [object1], [object2] and [property] to provide context for failures.
-bool checkTypes(Object object1, Object object2, String property, DartType type1,
-    DartType type2) {
+bool checkTypes(Object object1, Object object2, String property,
+    ResolutionDartType type1, ResolutionDartType type2) {
   if (identical(type1, type2)) return true;
   if (type1 == null || type2 == null) {
     return check(object1, object2, property, type1, type2);
@@ -316,7 +316,7 @@
 ///
 /// Uses [object1], [object2] and [property] to provide context for failures.
 bool checkTypeLists(Object object1, Object object2, String property,
-    List<DartType> list1, List<DartType> list2) {
+    List<ResolutionDartType> list1, List<ResolutionDartType> list2) {
   return checkListEquivalence(
       object1, object2, property, list1, list2, checkTypes);
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_and_or_test.dart b/tests/compiler/dart2js/simple_inferrer_and_or_test.dart
index 2c81edc..edb66ec 100644
--- a/tests/compiler/dart2js/simple_inferrer_and_or_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_and_or_test.dart
@@ -97,32 +97,31 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkReturn(String name, type) {
           var element = findElement(compiler, name);
           Expect.equals(
               type,
               simplify(
-                  typesInferrer.getReturnTypeOfElement(element), compiler));
+                  typesInferrer.getReturnTypeOfElement(element), closedWorld));
         }
 
-        var subclassOfInterceptor =
-            findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
+        var subclassOfInterceptor = closedWorld.commonMasks.interceptorType;
 
         checkReturn('returnDyn1', subclassOfInterceptor);
         checkReturn('returnDyn2', subclassOfInterceptor);
         checkReturn('returnDyn3', subclassOfInterceptor);
-        checkReturn('returnDyn4',
-            compiler.closedWorld.commonMasks.dynamicType.nonNullable());
-        checkReturn('returnDyn5',
-            compiler.closedWorld.commonMasks.dynamicType.nonNullable());
-        checkReturn('returnDyn6',
-            compiler.closedWorld.commonMasks.dynamicType.nonNullable());
+        checkReturn(
+            'returnDyn4', closedWorld.commonMasks.dynamicType.nonNullable());
+        checkReturn(
+            'returnDyn5', closedWorld.commonMasks.dynamicType.nonNullable());
+        checkReturn(
+            'returnDyn6', closedWorld.commonMasks.dynamicType.nonNullable());
         checkReturn('returnDyn7', subclassOfInterceptor);
         checkReturn('returnDyn7b', subclassOfInterceptor);
         checkReturn('returnDyn8', subclassOfInterceptor);
         checkReturn('returnDyn9', subclassOfInterceptor);
-        checkReturn(
-            'returnString', compiler.closedWorld.commonMasks.stringType);
+        checkReturn('returnString', closedWorld.commonMasks.stringType);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_callers_test.dart b/tests/compiler/dart2js/simple_inferrer_callers_test.dart
index 41b9457..6bf7e6a 100644
--- a/tests/compiler/dart2js/simple_inferrer_callers_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_callers_test.dart
@@ -8,6 +8,7 @@
 import 'package:async_helper/async_helper.dart';
 import 'package:expect/expect.dart';
 import 'package:compiler/src/inferrer/type_graph_inferrer.dart';
+import 'package:compiler/src/world.dart' show ClosedWorld, ClosedWorldRefiner;
 
 import 'compiler_helper.dart';
 
@@ -29,7 +30,8 @@
 // Create our own type inferrer to avoid clearing out the internal
 // data structures.
 class MyInferrer extends TypeGraphInferrer {
-  MyInferrer(compiler, commonMasks) : super(compiler, commonMasks);
+  MyInferrer(compiler, closedWorld, closedWorldRefiner)
+      : super(compiler, closedWorld, closedWorldRefiner);
   clear() {}
 }
 
@@ -37,11 +39,14 @@
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri, analyzeOnly: true);
   asyncTest(() => compiler.run(uri).then((_) {
-        compiler.closeResolution();
+        ClosedWorldRefiner closedWorldRefiner = compiler.closeResolution();
+        ClosedWorld closedWorld =
+            compiler.resolutionWorldBuilder.closedWorldForTesting;
         var inferrer =
-            new MyInferrer(compiler, compiler.closedWorld.commonMasks);
+            new MyInferrer(compiler, closedWorld, closedWorldRefiner);
         compiler.globalInference.typesInferrerInternal = inferrer;
-        compiler.globalInference.runGlobalTypeInference(compiler.mainFunction);
+        compiler.globalInference.runGlobalTypeInference(
+            compiler.mainFunction, closedWorld, closedWorldRefiner);
         var mainElement = findElement(compiler, 'main');
         var classA = findElement(compiler, 'A');
         var fieldA = classA.lookupLocalMember('field');
diff --git a/tests/compiler/dart2js/simple_inferrer_closure_test.dart b/tests/compiler/dart2js/simple_inferrer_closure_test.dart
index 109f197..39e5811 100644
--- a/tests/compiler/dart2js/simple_inferrer_closure_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_closure_test.dart
@@ -119,29 +119,31 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkReturn(String name, type) {
           var element = findElement(compiler, name);
           Expect.equals(
               type,
-              simplify(typesInferrer.getReturnTypeOfElement(element), compiler),
+              simplify(
+                  typesInferrer.getReturnTypeOfElement(element), closedWorld),
               name);
         }
 
-        checkReturn('returnInt1', compiler.closedWorld.commonMasks.uint31Type);
-        checkReturn('returnInt2', compiler.closedWorld.commonMasks.uint31Type);
-        checkReturn('returnInt3', compiler.closedWorld.commonMasks.uint31Type);
-        checkReturn('returnInt4', compiler.closedWorld.commonMasks.uint31Type);
-        checkReturn('returnIntOrNull',
-            compiler.closedWorld.commonMasks.uint31Type.nullable());
+        checkReturn('returnInt1', closedWorld.commonMasks.uint31Type);
+        checkReturn('returnInt2', closedWorld.commonMasks.uint31Type);
+        checkReturn('returnInt3', closedWorld.commonMasks.uint31Type);
+        checkReturn('returnInt4', closedWorld.commonMasks.uint31Type);
+        checkReturn(
+            'returnIntOrNull', closedWorld.commonMasks.uint31Type.nullable());
 
-        checkReturn('returnDyn1',
-            compiler.closedWorld.commonMasks.dynamicType.nonNullable());
-        checkReturn('returnDyn2',
-            compiler.closedWorld.commonMasks.dynamicType.nonNullable());
-        checkReturn('returnDyn3',
-            compiler.closedWorld.commonMasks.dynamicType.nonNullable());
-        checkReturn('returnNum1', compiler.closedWorld.commonMasks.numType);
+        checkReturn(
+            'returnDyn1', closedWorld.commonMasks.dynamicType.nonNullable());
+        checkReturn(
+            'returnDyn2', closedWorld.commonMasks.dynamicType.nonNullable());
+        checkReturn(
+            'returnDyn3', closedWorld.commonMasks.dynamicType.nonNullable());
+        checkReturn('returnNum1', closedWorld.commonMasks.numType);
 
         checkReturnInClass(String className, String methodName, type) {
           var cls = findElement(compiler, className);
@@ -149,11 +151,11 @@
           Expect.equals(
               type,
               simplify(
-                  typesInferrer.getReturnTypeOfElement(element), compiler));
+                  typesInferrer.getReturnTypeOfElement(element), closedWorld));
         }
 
         var cls = findElement(compiler, 'A');
         checkReturnInClass(
-            'A', 'foo', new TypeMask.nonNullExact(cls, compiler.closedWorld));
+            'A', 'foo', new TypeMask.nonNullExact(cls, closedWorld));
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_const_closure2_test.dart b/tests/compiler/dart2js/simple_inferrer_const_closure2_test.dart
index 2e59a21..c4c9194 100644
--- a/tests/compiler/dart2js/simple_inferrer_const_closure2_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_const_closure2_test.dart
@@ -29,6 +29,7 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkReturn(String name, type) {
           var element = findElement(compiler, name);
@@ -38,7 +39,7 @@
               name);
         }
 
-        checkReturn('method', compiler.closedWorld.commonMasks.numType);
-        checkReturn('returnNum', compiler.closedWorld.commonMasks.numType);
+        checkReturn('method', closedWorld.commonMasks.numType);
+        checkReturn('returnNum', closedWorld.commonMasks.numType);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_const_closure3_test.dart b/tests/compiler/dart2js/simple_inferrer_const_closure3_test.dart
index a354985..af85fa9 100644
--- a/tests/compiler/dart2js/simple_inferrer_const_closure3_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_const_closure3_test.dart
@@ -29,6 +29,7 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkArgument(String functionName, type) {
           var functionElement = findElement(compiler, functionName);
@@ -36,10 +37,10 @@
           var element = signature.requiredParameters.first;
           Expect.equals(
               type,
-              simplify(typesInferrer.getTypeOfElement(element), compiler),
+              simplify(typesInferrer.getTypeOfElement(element), closedWorld),
               functionName);
         }
 
-        checkArgument('method', compiler.closedWorld.commonMasks.uint31Type);
+        checkArgument('method', closedWorld.commonMasks.uint31Type);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_const_closure4_test.dart b/tests/compiler/dart2js/simple_inferrer_const_closure4_test.dart
index eeeeb02..2a2fd62 100644
--- a/tests/compiler/dart2js/simple_inferrer_const_closure4_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_const_closure4_test.dart
@@ -30,6 +30,7 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkArgument(String functionName, type) {
           var functionElement = findElement(compiler, functionName);
@@ -37,11 +38,11 @@
           var element = signature.requiredParameters.first;
           Expect.equals(
               type,
-              simplify(typesInferrer.getTypeOfElement(element), compiler),
+              simplify(typesInferrer.getTypeOfElement(element), closedWorld),
               functionName);
         }
 
-        checkArgument('method', compiler.closedWorld.commonMasks.numType);
-        checkArgument('returnNum', compiler.closedWorld.commonMasks.numType);
+        checkArgument('method', closedWorld.commonMasks.numType);
+        checkArgument('returnNum', closedWorld.commonMasks.numType);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_const_closure5_test.dart b/tests/compiler/dart2js/simple_inferrer_const_closure5_test.dart
index a41c254..41b5feb 100644
--- a/tests/compiler/dart2js/simple_inferrer_const_closure5_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_const_closure5_test.dart
@@ -30,6 +30,7 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkArgument(String functionName, type) {
           var functionElement = findElement(compiler, functionName);
@@ -37,10 +38,10 @@
           var element = signature.requiredParameters.first;
           Expect.equals(
               type,
-              simplify(typesInferrer.getTypeOfElement(element), compiler),
+              simplify(typesInferrer.getTypeOfElement(element), closedWorld),
               functionName);
         }
 
-        checkArgument('method', compiler.closedWorld.commonMasks.numType);
+        checkArgument('method', typesInferrer.closedWorld.commonMasks.numType);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_const_closure_default_test.dart b/tests/compiler/dart2js/simple_inferrer_const_closure_default_test.dart
index f2d38c6..ce1cc2c 100644
--- a/tests/compiler/dart2js/simple_inferrer_const_closure_default_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_const_closure_default_test.dart
@@ -43,6 +43,7 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkArgument(String functionName, type) {
           var functionElement = findElement(compiler, functionName);
@@ -52,7 +53,7 @@
               : signature.optionalParameters.first;
           Expect.equals(
               type,
-              simplify(typesInferrer.getTypeOfElement(element), compiler),
+              simplify(typesInferrer.getTypeOfElement(element), closedWorld),
               functionName);
         }
 
@@ -62,51 +63,45 @@
           var element = signature.optionalParameters.first;
           Expect.equals(
               type,
-              simplify(typesInferrer.getTypeOfElement(element), compiler),
+              simplify(typesInferrer.getTypeOfElement(element), closedWorld),
               functionName);
         }
 
-        checkArgument('foo1', compiler.closedWorld.commonMasks.functionType);
+        checkArgument('foo1', closedWorld.commonMasks.functionType);
 
         /// 01: ok
-        checkArgument('foo2', compiler.closedWorld.commonMasks.functionType);
+        checkArgument('foo2', closedWorld.commonMasks.functionType);
 
         /// 02: ok
-        checkArgument('foo3', compiler.closedWorld.commonMasks.functionType);
+        checkArgument('foo3', closedWorld.commonMasks.functionType);
 
         /// 03: ok
-        checkArgument('foo4', compiler.closedWorld.commonMasks.functionType);
+        checkArgument('foo4', closedWorld.commonMasks.functionType);
 
         /// 04: ok
-        checkArgument('foo5', compiler.closedWorld.commonMasks.dynamicType);
+        checkArgument('foo5', closedWorld.commonMasks.dynamicType);
 
         /// 05: ok
-        checkArgument('foo6', compiler.closedWorld.commonMasks.dynamicType);
+        checkArgument('foo6', closedWorld.commonMasks.dynamicType);
 
         /// 06: ok
 
-        checkArgument(
-            'defaultFn1', compiler.closedWorld.commonMasks.uint31Type);
+        checkArgument('defaultFn1', closedWorld.commonMasks.uint31Type);
 
         /// 07: ok
-        checkArgument(
-            'defaultFn2', compiler.closedWorld.commonMasks.uint31Type);
+        checkArgument('defaultFn2', closedWorld.commonMasks.uint31Type);
 
         /// 08: ok
-        checkArgument(
-            'defaultFn3', compiler.closedWorld.commonMasks.uint31Type);
+        checkArgument('defaultFn3', closedWorld.commonMasks.uint31Type);
 
         /// 09: ok
-        checkArgument(
-            'defaultFn4', compiler.closedWorld.commonMasks.uint31Type);
+        checkArgument('defaultFn4', closedWorld.commonMasks.uint31Type);
 
         /// 10: ok
-        checkArgument(
-            'defaultFn5', compiler.closedWorld.commonMasks.uint31Type);
+        checkArgument('defaultFn5', closedWorld.commonMasks.uint31Type);
 
         /// 11: ok
-        checkArgument(
-            'defaultFn6', compiler.closedWorld.commonMasks.uint31Type);
+        checkArgument('defaultFn6', closedWorld.commonMasks.uint31Type);
 
         /// 12: ok
       }));
diff --git a/tests/compiler/dart2js/simple_inferrer_const_closure_test.dart b/tests/compiler/dart2js/simple_inferrer_const_closure_test.dart
index 6dbd781..6183de0 100644
--- a/tests/compiler/dart2js/simple_inferrer_const_closure_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_const_closure_test.dart
@@ -38,6 +38,7 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkReturn(String name, type) {
           var element = findElement(compiler, name);
@@ -47,10 +48,10 @@
               name);
         }
 
-        checkReturn('method1', compiler.closedWorld.commonMasks.uint31Type);
-        checkReturn('returnInt1', compiler.closedWorld.commonMasks.uint31Type);
+        checkReturn('method1', closedWorld.commonMasks.uint31Type);
+        checkReturn('returnInt1', closedWorld.commonMasks.uint31Type);
 
-        checkReturn('method2', compiler.closedWorld.commonMasks.uint31Type);
-        checkReturn('returnInt2', compiler.closedWorld.commonMasks.uint31Type);
+        checkReturn('method2', closedWorld.commonMasks.uint31Type);
+        checkReturn('returnInt2', closedWorld.commonMasks.uint31Type);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_final_field3_test.dart b/tests/compiler/dart2js/simple_inferrer_final_field3_test.dart
index 7eeefae..c321c54 100644
--- a/tests/compiler/dart2js/simple_inferrer_final_field3_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_final_field3_test.dart
@@ -28,15 +28,16 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkFieldTypeInClass(String className, String fieldName, type) {
           var cls = findElement(compiler, className);
           var element = cls.lookupLocalMember(fieldName);
           Expect.equals(type,
-              simplify(typesInferrer.getTypeOfElement(element), compiler));
+              simplify(typesInferrer.getTypeOfElement(element), closedWorld));
         }
 
-        checkFieldTypeInClass('A', 'dynamicField',
-            findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'));
+        checkFieldTypeInClass(
+            'A', 'dynamicField', closedWorld.commonMasks.interceptorType);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_final_field_test.dart b/tests/compiler/dart2js/simple_inferrer_final_field_test.dart
index 78b3ebc..7b14057 100644
--- a/tests/compiler/dart2js/simple_inferrer_final_field_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_final_field_test.dart
@@ -32,21 +32,22 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkFieldTypeInClass(String className, String fieldName, type) {
           var cls = findElement(compiler, className);
           var element = cls.lookupLocalMember(fieldName);
           Expect.equals(type,
-              simplify(typesInferrer.getTypeOfElement(element), compiler));
+              simplify(typesInferrer.getTypeOfElement(element), closedWorld));
         }
 
         checkFieldTypeInClass(
-            'A', 'intField', compiler.closedWorld.commonMasks.uint31Type);
-        checkFieldTypeInClass('A', 'giveUpField1',
-            findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'));
-        checkFieldTypeInClass('A', 'giveUpField2',
-            compiler.closedWorld.commonMasks.dynamicType.nonNullable());
+            'A', 'intField', closedWorld.commonMasks.uint31Type);
         checkFieldTypeInClass(
-            'A', 'fieldParameter', compiler.closedWorld.commonMasks.uint31Type);
+            'A', 'giveUpField1', closedWorld.commonMasks.interceptorType);
+        checkFieldTypeInClass('A', 'giveUpField2',
+            closedWorld.commonMasks.dynamicType.nonNullable());
+        checkFieldTypeInClass(
+            'A', 'fieldParameter', closedWorld.commonMasks.uint31Type);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_global_field_closure2_test.dart b/tests/compiler/dart2js/simple_inferrer_global_field_closure2_test.dart
index 01a896a..35969e1 100644
--- a/tests/compiler/dart2js/simple_inferrer_global_field_closure2_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_global_field_closure2_test.dart
@@ -29,6 +29,7 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkArgument(String functionName, type) {
           var functionElement = findElement(compiler, functionName);
@@ -36,10 +37,10 @@
           var element = signature.requiredParameters.first;
           Expect.equals(
               type,
-              simplify(typesInferrer.getTypeOfElement(element), compiler),
+              simplify(typesInferrer.getTypeOfElement(element), closedWorld),
               functionName);
         }
 
-        checkArgument('method', compiler.closedWorld.commonMasks.uint31Type);
+        checkArgument('method', closedWorld.commonMasks.uint31Type);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_global_field_closure_test.dart b/tests/compiler/dart2js/simple_inferrer_global_field_closure_test.dart
index f20912a..430f464 100644
--- a/tests/compiler/dart2js/simple_inferrer_global_field_closure_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_global_field_closure_test.dart
@@ -38,6 +38,7 @@
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         checkReturn(String name, type) {
           var element = findElement(compiler, name);
@@ -47,10 +48,10 @@
               name);
         }
 
-        checkReturn('method1', compiler.closedWorld.commonMasks.uint31Type);
-        checkReturn('returnInt1', compiler.closedWorld.commonMasks.uint31Type);
+        checkReturn('method1', closedWorld.commonMasks.uint31Type);
+        checkReturn('returnInt1', closedWorld.commonMasks.uint31Type);
 
-        checkReturn('method2', compiler.closedWorld.commonMasks.uint31Type);
-        checkReturn('returnInt2', compiler.closedWorld.commonMasks.uint31Type);
+        checkReturn('method2', closedWorld.commonMasks.uint31Type);
+        checkReturn('returnInt2', closedWorld.commonMasks.uint31Type);
       }));
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart b/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
index a68120c..b54fd01 100644
--- a/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_no_such_method_test.dart
@@ -160,88 +160,82 @@
 }
 """;
 
-main() {
+checkReturn(MockCompiler compiler, String name, type) {
+  var typesInferrer = compiler.globalInference.typesInferrerInternal;
+  var element = findElement(compiler, name);
+  Expect.equals(
+      type,
+      simplify(typesInferrer.getReturnTypeOfElement(element),
+          typesInferrer.closedWorld),
+      name);
+}
+
+test1() async {
   Uri uri = new Uri(scheme: 'source');
+  var compiler = compilerFor(TEST1, uri);
+  await compiler.run(uri);
+  var closedWorld = compiler.resolutionWorldBuilder.closedWorldForTesting;
+  checkReturn(compiler, 'test1', closedWorld.commonMasks.uint31Type);
+  checkReturn(
+      compiler, 'test2', closedWorld.commonMasks.dynamicType.nonNullable());
+  checkReturn(compiler, 'test3', closedWorld.commonMasks.uint31Type);
+  checkReturn(compiler, 'test4', closedWorld.commonMasks.mapType);
+  checkReturn(
+      compiler, 'test5', closedWorld.commonMasks.dynamicType.nonNullable());
+  checkReturn(
+      compiler, 'test6', closedWorld.commonMasks.dynamicType.nonNullable());
+}
 
-  checkReturn(MockCompiler compiler, String name, type) {
-    var typesInferrer = compiler.globalInference.typesInferrerInternal;
-    var element = findElement(compiler, name);
-    Expect.equals(
-        type,
-        simplify(typesInferrer.getReturnTypeOfElement(element), compiler),
-        name);
-  }
+test2() async {
+  Uri uri = new Uri(scheme: 'source');
+  var compiler = compilerFor(TEST2, uri);
+  await compiler.run(uri);
+  var closedWorld = compiler.resolutionWorldBuilder.closedWorldForTesting;
+  checkReturn(compiler, 'test1', closedWorld.commonMasks.mapType.nonNullable());
+  checkReturn(compiler, 'test2', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test3', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test4', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test5', closedWorld.commonMasks.mapType);
 
-  var compiler1 = compilerFor(TEST1, uri);
-  asyncTest(() => compiler1.run(uri).then((_) {
-        checkReturn(
-            compiler1, 'test1', compiler1.closedWorld.commonMasks.uint31Type);
-        checkReturn(compiler1, 'test2',
-            compiler1.closedWorld.commonMasks.dynamicType.nonNullable());
-        checkReturn(
-            compiler1, 'test3', compiler1.closedWorld.commonMasks.uint31Type);
-        checkReturn(
-            compiler1, 'test4', compiler1.closedWorld.commonMasks.mapType);
-        checkReturn(compiler1, 'test5',
-            compiler1.closedWorld.commonMasks.dynamicType.nonNullable());
-        checkReturn(compiler1, 'test6',
-            compiler1.closedWorld.commonMasks.dynamicType.nonNullable());
-      }));
+  checkReturn(compiler, 'test6', closedWorld.commonMasks.numType);
+  checkReturn(compiler, 'test7', closedWorld.commonMasks.uint31Type);
+  checkReturn(compiler, 'test8', closedWorld.commonMasks.uint31Type);
+  checkReturn(compiler, 'test9', closedWorld.commonMasks.uint31Type);
+  checkReturn(compiler, 'test10', closedWorld.commonMasks.numType);
+  checkReturn(compiler, 'test11', closedWorld.commonMasks.doubleType);
+}
 
-  var compiler2 = compilerFor(TEST2, uri);
-  asyncTest(() => compiler2.run(uri).then((_) {
-        checkReturn(compiler2, 'test1',
-            compiler2.closedWorld.commonMasks.mapType.nonNullable());
-        checkReturn(
-            compiler2, 'test2', compiler2.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler2, 'test3', compiler2.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler2, 'test4', compiler2.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler2, 'test5', compiler2.closedWorld.commonMasks.mapType);
+test3() async {
+  Uri uri = new Uri(scheme: 'source');
+  var compiler = compilerFor(TEST3, uri);
+  await compiler.run(uri);
+  var closedWorld = compiler.resolutionWorldBuilder.closedWorldForTesting;
+  checkReturn(compiler, 'test1', const TypeMask.nonNullEmpty());
+  checkReturn(compiler, 'test2', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test3', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test4', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test5', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test6', closedWorld.commonMasks.mapType);
+}
 
-        checkReturn(
-            compiler2, 'test6', compiler2.closedWorld.commonMasks.numType);
-        checkReturn(
-            compiler2, 'test7', compiler2.closedWorld.commonMasks.uint31Type);
-        checkReturn(
-            compiler2, 'test8', compiler2.closedWorld.commonMasks.uint31Type);
-        checkReturn(
-            compiler2, 'test9', compiler2.closedWorld.commonMasks.uint31Type);
-        checkReturn(
-            compiler2, 'test10', compiler2.closedWorld.commonMasks.numType);
-        checkReturn(
-            compiler2, 'test11', compiler2.closedWorld.commonMasks.doubleType);
-      }));
+test4() async {
+  Uri uri = new Uri(scheme: 'source');
+  var compiler = compilerFor(TEST4, uri);
+  await compiler.run(uri);
+  var closedWorld = compiler.resolutionWorldBuilder.closedWorldForTesting;
+  checkReturn(compiler, 'test1', const TypeMask.nonNullEmpty());
+  checkReturn(compiler, 'test2', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test3', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test4', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test5', closedWorld.commonMasks.mapType);
+  checkReturn(compiler, 'test6', closedWorld.commonMasks.mapType);
+}
 
-  var compiler3 = compilerFor(TEST3, uri);
-  asyncTest(() => compiler3.run(uri).then((_) {
-        checkReturn(compiler3, 'test1', const TypeMask.nonNullEmpty());
-        checkReturn(
-            compiler3, 'test2', compiler3.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler3, 'test3', compiler3.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler3, 'test4', compiler3.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler3, 'test5', compiler3.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler3, 'test6', compiler3.closedWorld.commonMasks.mapType);
-      }));
-
-  var compiler4 = compilerFor(TEST4, uri);
-  asyncTest(() => compiler4.run(uri).then((_) {
-        checkReturn(compiler4, 'test1', const TypeMask.nonNullEmpty());
-        checkReturn(
-            compiler4, 'test2', compiler4.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler4, 'test3', compiler4.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler4, 'test4', compiler4.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler4, 'test5', compiler4.closedWorld.commonMasks.mapType);
-        checkReturn(
-            compiler4, 'test6', compiler4.closedWorld.commonMasks.mapType);
-      }));
+main() {
+  asyncTest(() async {
+    await test1();
+    await test2();
+    await test3();
+    await test4();
+  });
 }
diff --git a/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart b/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart
index 3d37e58..27ed1a4 100644
--- a/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_postfix_prefix_test.dart
@@ -66,20 +66,21 @@
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
-        var commonMasks = compiler.closedWorld.commonMasks;
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
+        var commonMasks = closedWorld.commonMasks;
 
         checkReturnInClass(String className, String methodName, type) {
           var cls = findElement(compiler, className);
           var element = cls.lookupLocalMember(methodName);
           Expect.equals(
               type,
-              simplify(typesInferrer.getReturnTypeOfElement(element), compiler),
+              simplify(
+                  typesInferrer.getReturnTypeOfElement(element), closedWorld),
               methodName);
         }
 
-        var subclassOfInterceptor =
-            findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
+        var subclassOfInterceptor = commonMasks.interceptorType;
 
         checkReturnInClass('A', 'returnNum1', commonMasks.numType);
         checkReturnInClass('A', 'returnNum2', commonMasks.numType);
diff --git a/tests/compiler/dart2js/simple_inferrer_test.dart b/tests/compiler/dart2js/simple_inferrer_test.dart
index cf29a1a..f3dbf3e 100644
--- a/tests/compiler/dart2js/simple_inferrer_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_test.dart
@@ -727,20 +727,20 @@
   var compiler = compilerFor(TEST, uri);
   compiler.diagnosticHandler = createHandler(compiler, TEST);
   asyncTest(() => compiler.run(uri).then((_) {
-        var commonMasks = compiler.closedWorld.commonMasks;
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
-        var world = compiler.closedWorld;
+        var closedWorld = typesInferrer.closedWorld;
+        var commonMasks = closedWorld.commonMasks;
 
         checkReturn(String name, type) {
           var element = findElement(compiler, name);
           Expect.equals(
               type,
-              simplify(typesInferrer.getReturnTypeOfElement(element), compiler),
+              simplify(
+                  typesInferrer.getReturnTypeOfElement(element), closedWorld),
               name);
         }
 
-        var interceptorType =
-            findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
+        var interceptorType = commonMasks.interceptorType;
 
         checkReturn('returnNum1', commonMasks.numType);
         checkReturn('returnNum2', commonMasks.numType);
@@ -761,7 +761,7 @@
         checkReturn('returnEmpty1', const TypeMask.nonNullEmpty());
         checkReturn('returnEmpty2', const TypeMask.nonNullEmpty());
         TypeMask intType = new TypeMask.nonNullSubtype(
-            compiler.coreClasses.intClass, compiler.closedWorld);
+            compiler.commonElements.intClass, closedWorld);
         checkReturn('testIsCheck1', intType);
         checkReturn('testIsCheck2', intType);
         checkReturn('testIsCheck3', intType.nullable());
@@ -796,7 +796,7 @@
         checkReturn(
             'returnAsString',
             new TypeMask.subtype(
-                compiler.coreClasses.stringClass, compiler.closedWorld));
+                compiler.commonElements.stringClass, closedWorld));
         checkReturn('returnIntAsNum', commonMasks.uint31Type);
         checkReturn('returnAsTypedef', commonMasks.functionType.nullable());
         checkReturn('returnTopLevelGetter', commonMasks.uint31Type);
@@ -806,9 +806,9 @@
             'testSwitch1',
             simplify(
                 commonMasks.intType
-                    .union(commonMasks.doubleType, compiler.closedWorld)
+                    .union(commonMasks.doubleType, closedWorld)
                     .nullable(),
-                compiler));
+                closedWorld));
         checkReturn('testSwitch2', commonMasks.uint31Type);
         checkReturn('testSwitch3', interceptorType.nullable());
         checkReturn('testSwitch4', commonMasks.uint31Type);
@@ -832,7 +832,8 @@
           var element = cls.lookupLocalMember(methodName);
           Expect.equals(
               type,
-              simplify(typesInferrer.getReturnTypeOfElement(element), compiler),
+              simplify(
+                  typesInferrer.getReturnTypeOfElement(element), closedWorld),
               '$className:$methodName');
         }
 
@@ -864,17 +865,16 @@
         checkFactoryConstructor(String className, String factoryName) {
           var cls = findElement(compiler, className);
           var element = cls.localLookup(factoryName);
-          Expect.equals(new TypeMask.nonNullExact(cls, world),
+          Expect.equals(new TypeMask.nonNullExact(cls, closedWorld),
               typesInferrer.getReturnTypeOfElement(element));
         }
 
         checkFactoryConstructor('A', '');
 
         checkReturn('testCascade1', commonMasks.growableListType);
-        checkReturn(
-            'testCascade2',
-            new TypeMask.nonNullExact(
-                findElement(compiler, 'CascadeHelper'), world));
+        ClassElement clsCascadeHelper = findElement(compiler, 'CascadeHelper');
+        checkReturn('testCascade2',
+            new TypeMask.nonNullExact(clsCascadeHelper, closedWorld));
         checkReturn('testSpecialization1', commonMasks.numType);
         checkReturn('testSpecialization2', commonMasks.dynamicType);
         checkReturn('testSpecialization3', commonMasks.uint31Type.nullable());
diff --git a/tests/compiler/dart2js/simple_inferrer_try_catch_test.dart b/tests/compiler/dart2js/simple_inferrer_try_catch_test.dart
index 207a861..e02a22b 100644
--- a/tests/compiler/dart2js/simple_inferrer_try_catch_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_try_catch_test.dart
@@ -167,15 +167,16 @@
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
   asyncTest(() => compiler.run(uri).then((_) {
-        var commonMasks = compiler.closedWorld.commonMasks;
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
+        var commonMasks = closedWorld.commonMasks;
 
         checkReturn(String name, type) {
           var element = findElement(compiler, name);
           Expect.equals(
               type,
               simplify(
-                  typesInferrer.getReturnTypeOfElement(element), compiler));
+                  typesInferrer.getReturnTypeOfElement(element), closedWorld));
         }
 
         checkReturn('returnInt1', commonMasks.uint31Type);
@@ -186,10 +187,9 @@
         checkReturn(
             'returnInt6',
             new TypeMask.nonNullSubtype(
-                compiler.coreClasses.intClass, compiler.closedWorld));
+                closedWorld.commonElements.intClass, closedWorld));
 
-        var subclassOfInterceptor =
-            findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
+        var subclassOfInterceptor = commonMasks.interceptorType;
 
         checkReturn('returnDyn1', subclassOfInterceptor);
         checkReturn('returnDyn2', subclassOfInterceptor);
diff --git a/tests/compiler/dart2js/simple_inferrer_unregister_call_test.dart b/tests/compiler/dart2js/simple_inferrer_unregister_call_test.dart
index f0be6f8..8456a95 100644
--- a/tests/compiler/dart2js/simple_inferrer_unregister_call_test.dart
+++ b/tests/compiler/dart2js/simple_inferrer_unregister_call_test.dart
@@ -41,6 +41,6 @@
         }
 
         checkReturnInClass(
-            'A', '+', compiler.closedWorld.commonMasks.uint31Type);
+            'A', '+', typesInferrer.closedWorld.commonMasks.uint31Type);
       }));
 }
diff --git a/tests/compiler/dart2js/sourcemaps/diff.dart b/tests/compiler/dart2js/sourcemaps/diff.dart
index 9627b3c..7505892 100644
--- a/tests/compiler/dart2js/sourcemaps/diff.dart
+++ b/tests/compiler/dart2js/sourcemaps/diff.dart
@@ -11,7 +11,11 @@
 import 'sourcemap_helper.dart';
 import 'sourcemap_html_helper.dart';
 
-enum DiffKind { UNMATCHED, MATCHING, IDENTICAL, }
+enum DiffKind {
+  UNMATCHED,
+  MATCHING,
+  IDENTICAL,
+}
 
 /// Id for an output column.
 class DiffColumn {
diff --git a/tests/compiler/dart2js/sourcemaps/html_parts.dart b/tests/compiler/dart2js/sourcemaps/html_parts.dart
index d4e809f..2691a09 100644
--- a/tests/compiler/dart2js/sourcemaps/html_parts.dart
+++ b/tests/compiler/dart2js/sourcemaps/html_parts.dart
@@ -125,7 +125,15 @@
   }
 }
 
-enum HtmlPartKind { CODE, LINE, CONST, NEWLINE, TEXT, TAG, LINE_NUMBER, }
+enum HtmlPartKind {
+  CODE,
+  LINE,
+  CONST,
+  NEWLINE,
+  TEXT,
+  TAG,
+  LINE_NUMBER,
+}
 
 abstract class HtmlPart {
   void printHtmlOn(StringBuffer buffer, HtmlPrintContext context);
diff --git a/tests/compiler/dart2js/sourcemaps/js_tracer.dart b/tests/compiler/dart2js/sourcemaps/js_tracer.dart
index 6faf88e..6901e40 100644
--- a/tests/compiler/dart2js/sourcemaps/js_tracer.dart
+++ b/tests/compiler/dart2js/sourcemaps/js_tracer.dart
@@ -82,6 +82,8 @@
         js.Switch switchNode = node;
         text = ['switch(', switchNode.key, ') ...'];
         break;
+      case StepKind.NO_INFO:
+        break;
     }
     createTraceStep(kind, node,
         offset: offset,
diff --git a/tests/compiler/dart2js/sourcemaps/load.dart b/tests/compiler/dart2js/sourcemaps/load.dart
index 29cb8e0..d2ef009 100644
--- a/tests/compiler/dart2js/sourcemaps/load.dart
+++ b/tests/compiler/dart2js/sourcemaps/load.dart
@@ -74,17 +74,19 @@
       } else {
         position = '$line,$columnStart-';
       }
-      if (entry.sourceUrlId != null) {
-        int sourceUrlId = entry.sourceUrlId;
-        int sourceLine = entry.sourceLine + 1;
-        int sourceColumn = entry.sourceColumn + 1;
+      if (entry.sourceUrlId != null || columnEnd == null) {
         if (needsComma) {
           sb.write(',\n');
         }
         sb.write('    {"target": "$position"');
-        sb.write(', "source": "$sourceUrlId:$sourceLine,$sourceColumn"');
-        if (entry.sourceNameId != null) {
-          sb.write(', "name": "${sourceMap.names[entry.sourceNameId]}"');
+        if (entry.sourceUrlId != null) {
+          int sourceUrlId = entry.sourceUrlId;
+          int sourceLine = entry.sourceLine + 1;
+          int sourceColumn = entry.sourceColumn + 1;
+          sb.write(', "source": "$sourceUrlId:$sourceLine,$sourceColumn"');
+          if (entry.sourceNameId != null) {
+            sb.write(', "name": "${sourceMap.names[entry.sourceNameId]}"');
+          }
         }
         sb.write('}');
         needsComma = true;
diff --git a/tests/compiler/dart2js/sourcemaps/output_structure.dart b/tests/compiler/dart2js/sourcemaps/output_structure.dart
index 21a5bc3..648973a 100644
--- a/tests/compiler/dart2js/sourcemaps/output_structure.dart
+++ b/tests/compiler/dart2js/sourcemaps/output_structure.dart
@@ -637,7 +637,11 @@
   String toString() => '[$from,$to[';
 }
 
-enum CodeKind { LIBRARY, CLASS, MEMBER, }
+enum CodeKind {
+  LIBRARY,
+  CLASS,
+  MEMBER,
+}
 
 class CodeLocation {
   final Uri uri;
diff --git a/tests/compiler/dart2js/sourcemaps/sourcemap_visualizer.dart b/tests/compiler/dart2js/sourcemaps/sourcemap_visualizer.dart
new file mode 100644
index 0000000..3b6a96d
--- /dev/null
+++ b/tests/compiler/dart2js/sourcemaps/sourcemap_visualizer.dart
@@ -0,0 +1,194 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Tool for visualizing the source mapped parts of a generated JS file.
+
+import 'dart:convert';
+import 'dart:io';
+import 'package:source_maps/source_maps.dart';
+import 'sourcemap_html_helper.dart';
+
+main(List<String> args) {
+  String jsFileName = 'out.js';
+  if (args.length > 0) {
+    jsFileName = args[0];
+  }
+  String jsMapFileName = '$jsFileName.map';
+  if (args.length > 1) {
+    jsMapFileName = args[1];
+  }
+  generateHtml(jsFileName, jsMapFileName);
+}
+
+class MappingState {
+  final String cssClass;
+  final int _continuedState;
+  final int _nextState;
+
+  const MappingState(this.cssClass, this._continuedState, this._nextState);
+
+  MappingState get continuedState => values[_continuedState];
+
+  MappingState get nextState => values[_nextState];
+
+  static const MappingState INITIAL = const MappingState('initial', 0, 1);
+  static const MappingState MAPPED0 = const MappingState('mapped0', 2, 3);
+  static const MappingState MAPPED0_CONTINUED =
+      const MappingState('mapped0continued', 2, 3);
+  static const MappingState MAPPED1 = const MappingState('mapped1', 4, 1);
+  static const MappingState MAPPED1_CONTINUED =
+      const MappingState('mapped1continued', 4, 1);
+  static const MappingState UNMAPPED = const MappingState('unmapped', 5, 1);
+
+  static const List<MappingState> values = const <MappingState>[
+    INITIAL,
+    MAPPED0,
+    MAPPED0_CONTINUED,
+    MAPPED1,
+    MAPPED1_CONTINUED,
+    UNMAPPED
+  ];
+}
+
+void generateHtml(String jsFileName, String jsMapFileName) {
+  String jsFile = new File(jsFileName).readAsStringSync();
+  String jsMapFile = new File(jsMapFileName).readAsStringSync();
+  SingleMapping mapping = new SingleMapping.fromJson(JSON.decode(jsMapFile));
+  StringBuffer output = new StringBuffer();
+  output.write('''
+<html>
+  <head>
+    <title>${escape(jsFileName)} / ${escape(jsMapFileName)}</title>
+    <style type="text/css">
+      .initial{
+        background-color: #FFFFFF;
+      }
+      .mapped0 {
+        background-color: #E0E0C0;
+      }
+      .mapped0continued {
+        background-color: #F8F8D8;
+      }
+      .mapped1 {
+        background-color: #C0E0E0;
+      }
+      .mapped1continued {
+        background-color: #D8F8F8;
+      }
+      .unmapped {
+        background-color: #E0E0E0;
+      }
+      .code {
+        font-family: monospace;
+        white-space: pre;
+        font-size: smaller;
+      }
+      .lineNumber {
+        color: #C0C0C0;
+        font-size: small;
+      }
+      .legend {
+        position: fixed;
+        top: 5px;
+        right: 5px;
+        border: 1px solid black;
+        padding: 5px;
+        background-color: #F0F0F0;
+      }
+      .box {
+        border: 1px solid grey;
+      }
+    </style>
+  </head>
+  <body>
+  <div class="legend">
+    <span class="initial">&nbsp;&nbsp;&nbsp;&nbsp;</span> no mapping (yet)<br/>
+    <span class="mapped0">&nbsp;&nbsp;</span>
+      <span class="mapped1">&nbsp;&nbsp;</span> mapped<br/>
+    <span class="mapped0continued">&nbsp;&nbsp;</span>
+      <span class="mapped1continued">&nbsp;&nbsp;</span> mapping
+        continued from previous line<br/>
+    <span class="unmapped">&nbsp;&nbsp;&nbsp;&nbsp;</span> mapping off<br/>
+  </div>
+  <pre class="code">
+''');
+
+  MappingState state = MappingState.INITIAL;
+  TargetEntry lastEntry;
+
+  void write(String text, TargetEntry entry) {
+    output.write('<span class="${state.cssClass}"');
+    String prefix = '';
+    if (entry == lastEntry) {
+      prefix = 'continued: ';
+    }
+    lastEntry = entry;
+    if (lastEntry != null) {
+      if (lastEntry.sourceUrlId != null) {
+        output.write(' title="$prefix');
+        output.write(escape(mapping.urls[lastEntry.sourceUrlId]));
+        output.write(
+            ':${lastEntry.sourceLine + 1}:${lastEntry.sourceColumn + 1}');
+        if (lastEntry.sourceNameId != null) {
+          output.write(' (');
+          output.write(escape(mapping.names[lastEntry.sourceNameId]));
+          output.write(')');
+        }
+        output.write('"');
+      } else {
+        output.write(' title="unmapped"');
+      }
+    }
+    output.write('>');
+    output.write(escape(text));
+    output.write('</span>');
+  }
+
+  int nextTargetLineIndex = 0;
+  List<String> lines = jsFile.split('\n');
+  int lineNoWidth = '${lines.length}'.length;
+  for (int lineNo = 0; lineNo < lines.length; lineNo++) {
+    output.write(lineNumber(lineNo, width: lineNoWidth));
+    String line = lines[lineNo];
+    TargetLineEntry targetLineEntry;
+    while (nextTargetLineIndex < mapping.lines.length) {
+      TargetLineEntry entry = mapping.lines[nextTargetLineIndex];
+      if (entry.line == lineNo) {
+        targetLineEntry = entry;
+        nextTargetLineIndex++;
+        break;
+      } else if (entry.line > lineNo) {
+        break;
+      } else {
+        nextTargetLineIndex++;
+      }
+    }
+    if (targetLineEntry != null) {
+      int columnNo = 0;
+      for (int index = 0; index < targetLineEntry.entries.length; index++) {
+        TargetEntry entry = targetLineEntry.entries[index];
+        if (entry.column > columnNo) {
+          write(line.substring(columnNo, entry.column), lastEntry);
+          columnNo = entry.column;
+        }
+        state =
+            entry.sourceUrlId != null ? state.nextState : MappingState.UNMAPPED;
+        int end;
+        if (index + 1 < targetLineEntry.entries.length) {
+          end = targetLineEntry.entries[index + 1].column;
+        } else {
+          end = line.length;
+        }
+        write(line.substring(entry.column, end), entry);
+        columnNo = end;
+      }
+    } else {
+      write(line, lastEntry);
+    }
+    output.write('\n');
+    state = state.continuedState;
+  }
+  output.write('</pre></body></html>');
+  new File('out.js.map.html').writeAsStringSync(output.toString());
+}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
index 89d1ff7..185b8a5 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
@@ -15,6 +15,7 @@
 import 'package:source_maps/source_maps.dart';
 import 'package:source_maps/src/utils.dart';
 
+import '../annotated_code_helper.dart';
 import '../source_map_validator_helper.dart';
 
 const String EXCEPTION_MARKER = '>ExceptionMarker<';
@@ -116,6 +117,19 @@
   '''
 import 'package:expect/expect.dart';
 main() {
+  @{1:main}test(new Class());
+}
+@NoInline()
+test(c) {
+  @{2:test}c.field.method();
+}
+class Class {
+  var field;
+}
+''',
+  '''
+import 'package:expect/expect.dart';
+main() {
   // This call is no longer on the stack when the error is thrown.
   @{:main}test();
 }
@@ -184,60 +198,28 @@
 const int _LBRACE = 0x7B;
 
 Test processTestCode(String code) {
-  StringBuffer codeBuffer = new StringBuffer();
   Map<int, StackTraceLine> stackTraceMap = <int, StackTraceLine>{};
   List<StackTraceLine> unexpectedLines = <StackTraceLine>[];
-  int index = 0;
-  int lineNo = 1;
-  int columnNo = 1;
-  while (index < code.length) {
-    int charCode = code.codeUnitAt(index);
-    switch (charCode) {
-      case _LF:
-        codeBuffer.write('\n');
-        lineNo++;
-        columnNo = 1;
-        break;
-      case _CR:
-        if (index + 1 < code.length && code.codeUnitAt(index + 1) == _LF) {
-          index++;
-        }
-        codeBuffer.write('\n');
-        lineNo++;
-        columnNo = 1;
-        break;
-      case 0x40:
-        if (index + 1 < code.length && code.codeUnitAt(index + 1) == _LBRACE) {
-          int colonIndex = code.indexOf(':', index);
-          int endIndex = code.indexOf('}', index);
-          String methodName = code.substring(colonIndex + 1, endIndex);
-          String indexText = code.substring(index + 2, colonIndex);
-          StackTraceLine stackTraceLine =
-              new StackTraceLine(methodName, INPUT_FILE_NAME, lineNo, columnNo);
-          if (indexText == '') {
-            unexpectedLines.add(stackTraceLine);
-          } else {
-            int stackTraceIndex = int.parse(indexText);
-            assert(!stackTraceMap.containsKey(stackTraceIndex));
-            stackTraceMap[stackTraceIndex] = stackTraceLine;
-          }
-          index = endIndex;
-        } else {
-          codeBuffer.writeCharCode(charCode);
-          columnNo++;
-        }
-        break;
-      default:
-        codeBuffer.writeCharCode(charCode);
-        columnNo++;
+  AnnotatedCode annotatedCode = new AnnotatedCode(code);
+  for (Annotation annotation in annotatedCode.annotations) {
+    int colonIndex = annotation.text.indexOf(':');
+    String indexText = annotation.text.substring(0, colonIndex);
+    String methodName = annotation.text.substring(colonIndex + 1);
+    StackTraceLine stackTraceLine = new StackTraceLine(
+        methodName, INPUT_FILE_NAME, annotation.lineNo, annotation.columnNo);
+    if (indexText == '') {
+      unexpectedLines.add(stackTraceLine);
+    } else {
+      int stackTraceIndex = int.parse(indexText);
+      assert(!stackTraceMap.containsKey(stackTraceIndex));
+      stackTraceMap[stackTraceIndex] = stackTraceLine;
     }
-    index++;
   }
   List<StackTraceLine> expectedLines = <StackTraceLine>[];
   for (int stackTraceIndex in (stackTraceMap.keys.toList()..sort()).reversed) {
     expectedLines.add(stackTraceMap[stackTraceIndex]);
   }
-  return new Test(codeBuffer.toString(), expectedLines, unexpectedLines);
+  return new Test(annotatedCode.sourceCode, expectedLines, unexpectedLines);
 }
 
 void main(List<String> arguments) {
@@ -308,15 +290,9 @@
   }
   List<String> lines = out.split(new RegExp(r'(\r|\n|\r\n)'));
   List<StackTraceLine> jsStackTrace = <StackTraceLine>[];
-  bool seenMarker = false;
   for (String line in lines) {
-    if (seenMarker) {
-      line = line.trim();
-      if (line.startsWith('at ')) {
-        jsStackTrace.add(new StackTraceLine.fromText(line));
-      }
-    } else if (line == EXCEPTION_MARKER) {
-      seenMarker = true;
+    if (line.startsWith('    at ')) {
+      jsStackTrace.add(new StackTraceLine.fromText(line));
     }
   }
 
@@ -324,15 +300,15 @@
   for (StackTraceLine line in jsStackTrace) {
     TargetEntry targetEntry = _findColumn(line.lineNo - 1, line.columnNo - 1,
         _findLine(sourceMap, line.lineNo - 1));
-    if (targetEntry == null) {
+    if (targetEntry == null || targetEntry.sourceUrlId == null) {
       dartStackTrace.add(line);
     } else {
       String methodName;
-      if (targetEntry.sourceNameId != 0) {
+      if (targetEntry.sourceNameId != null) {
         methodName = sourceMap.names[targetEntry.sourceNameId];
       }
       String fileName;
-      if (targetEntry.sourceUrlId != 0) {
+      if (targetEntry.sourceUrlId != null) {
         fileName = sourceMap.urls[targetEntry.sourceUrlId];
       }
       dartStackTrace.add(new StackTraceLine(methodName, fileName,
diff --git a/tests/compiler/dart2js/subtype_test.dart b/tests/compiler/dart2js/subtype_test.dart
index ad8fba5..41e2003 100644
--- a/tests/compiler/dart2js/subtype_test.dart
+++ b/tests/compiler/dart2js/subtype_test.dart
@@ -7,7 +7,7 @@
 import 'package:expect/expect.dart';
 import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import "package:compiler/src/elements/elements.dart" show Element, ClassElement;
 
 void main() {
@@ -22,8 +22,8 @@
   testTypeVariableSubtype();
 }
 
-void testTypes(TypeEnvironment env, DartType subtype, DartType supertype,
-    bool expectSubtype, bool expectMoreSpecific) {
+void testTypes(TypeEnvironment env, ResolutionDartType subtype,
+    ResolutionDartType supertype, bool expectSubtype, bool expectMoreSpecific) {
   if (expectMoreSpecific == null) expectMoreSpecific = expectSubtype;
   Expect.equals(expectSubtype, env.isSubtype(subtype, supertype),
       '$subtype <: $supertype');
@@ -33,8 +33,8 @@
 
 void testElementTypes(TypeEnvironment env, String subname, String supername,
     bool expectSubtype, bool expectMoreSpecific) {
-  DartType subtype = env.getElementType(subname);
-  DartType supertype = env.getElementType(supername);
+  ResolutionDartType subtype = env.getElementType(subname);
+  ResolutionDartType supertype = env.getElementType(supername);
   testTypes(env, subtype, supertype, expectSubtype, expectMoreSpecific);
 }
 
@@ -46,7 +46,8 @@
       // currently not supported by the implementation.
       class C<T1, T2> extends B<T2, T1> /*implements A<A<T1>>*/ {}
       """).then((env) {
-        void expect(bool expectSubtype, DartType T, DartType S,
+        void expect(
+            bool expectSubtype, ResolutionDartType T, ResolutionDartType S,
             {bool expectMoreSpecific}) {
           testTypes(env, T, S, expectSubtype, expectMoreSpecific);
         }
@@ -54,12 +55,13 @@
         ClassElement A = env.getElement('A');
         ClassElement B = env.getElement('B');
         ClassElement C = env.getElement('C');
-        DartType Object_ = env['Object'];
-        DartType num_ = env['num'];
-        DartType int_ = env['int'];
-        DartType String_ = env['String'];
-        DartType dynamic_ = env['dynamic'];
-        DartType void_ = env['void'];
+        ResolutionDartType Object_ = env['Object'];
+        ResolutionDartType num_ = env['num'];
+        ResolutionDartType int_ = env['int'];
+        ResolutionDartType String_ = env['String'];
+        ResolutionDartType dynamic_ = env['dynamic'];
+        ResolutionDartType void_ = env['void'];
+        ResolutionDartType Null_ = env['Null'];
 
         expect(true, void_, void_);
         expect(true, void_, dynamic_);
@@ -67,84 +69,113 @@
         expect(true, dynamic_, void_, expectMoreSpecific: false);
         expect(false, void_, Object_);
         expect(false, Object_, void_);
+        expect(true, Null_, void_);
 
         expect(true, Object_, Object_);
         expect(true, num_, Object_);
         expect(true, int_, Object_);
         expect(true, String_, Object_);
         expect(true, dynamic_, Object_, expectMoreSpecific: false);
+        expect(true, Null_, Object_);
 
         expect(false, Object_, num_);
         expect(true, num_, num_);
         expect(true, int_, num_);
         expect(false, String_, num_);
         expect(true, dynamic_, num_, expectMoreSpecific: false);
+        expect(true, Null_, num_);
 
         expect(false, Object_, int_);
         expect(false, num_, int_);
         expect(true, int_, int_);
         expect(false, String_, int_);
         expect(true, dynamic_, int_, expectMoreSpecific: false);
+        expect(true, Null_, int_);
 
         expect(false, Object_, String_);
         expect(false, num_, String_);
         expect(false, int_, String_);
         expect(true, String_, String_);
         expect(true, dynamic_, String_, expectMoreSpecific: false);
+        expect(true, Null_, String_);
 
         expect(true, Object_, dynamic_);
         expect(true, num_, dynamic_);
         expect(true, int_, dynamic_);
         expect(true, String_, dynamic_);
         expect(true, dynamic_, dynamic_);
+        expect(true, Null_, dynamic_);
 
-        DartType A_Object = instantiate(A, [Object_]);
-        DartType A_num = instantiate(A, [num_]);
-        DartType A_int = instantiate(A, [int_]);
-        DartType A_String = instantiate(A, [String_]);
-        DartType A_dynamic = instantiate(A, [dynamic_]);
+        expect(false, Object_, Null_);
+        expect(false, num_, Null_);
+        expect(false, int_, Null_);
+        expect(false, String_, Null_);
+        expect(true, dynamic_, Null_, expectMoreSpecific: false);
+        expect(true, Null_, Null_);
+
+        ResolutionDartType A_Object = instantiate(A, [Object_]);
+        ResolutionDartType A_num = instantiate(A, [num_]);
+        ResolutionDartType A_int = instantiate(A, [int_]);
+        ResolutionDartType A_String = instantiate(A, [String_]);
+        ResolutionDartType A_dynamic = instantiate(A, [dynamic_]);
+        ResolutionDartType A_Null = instantiate(A, [Null_]);
 
         expect(true, A_Object, Object_);
         expect(false, A_Object, num_);
         expect(false, A_Object, int_);
         expect(false, A_Object, String_);
         expect(true, A_Object, dynamic_);
+        expect(false, A_Object, Null_);
 
         expect(true, A_Object, A_Object);
         expect(true, A_num, A_Object);
         expect(true, A_int, A_Object);
         expect(true, A_String, A_Object);
         expect(true, A_dynamic, A_Object, expectMoreSpecific: false);
+        expect(true, A_Null, A_Object);
 
         expect(false, A_Object, A_num);
         expect(true, A_num, A_num);
         expect(true, A_int, A_num);
         expect(false, A_String, A_num);
         expect(true, A_dynamic, A_num, expectMoreSpecific: false);
+        expect(true, A_Null, A_num);
 
         expect(false, A_Object, A_int);
         expect(false, A_num, A_int);
         expect(true, A_int, A_int);
         expect(false, A_String, A_int);
         expect(true, A_dynamic, A_int, expectMoreSpecific: false);
+        expect(true, A_Null, A_int);
 
         expect(false, A_Object, A_String);
         expect(false, A_num, A_String);
         expect(false, A_int, A_String);
         expect(true, A_String, A_String);
         expect(true, A_dynamic, A_String, expectMoreSpecific: false);
+        expect(true, A_Null, A_String);
 
         expect(true, A_Object, A_dynamic);
         expect(true, A_num, A_dynamic);
         expect(true, A_int, A_dynamic);
         expect(true, A_String, A_dynamic);
         expect(true, A_dynamic, A_dynamic);
+        expect(true, A_Null, A_dynamic);
 
-        DartType B_Object_Object = instantiate(B, [Object_, Object_]);
-        DartType B_num_num = instantiate(B, [num_, num_]);
-        DartType B_int_num = instantiate(B, [int_, num_]);
-        DartType B_dynamic_dynamic = instantiate(B, [dynamic_, dynamic_]);
-        DartType B_String_dynamic = instantiate(B, [String_, dynamic_]);
+        expect(false, A_Object, A_Null);
+        expect(false, A_num, A_Null);
+        expect(false, A_int, A_Null);
+        expect(false, A_String, A_Null);
+        expect(true, A_dynamic, A_Null, expectMoreSpecific: false);
+        expect(true, A_Null, A_Null);
+
+        ResolutionDartType B_Object_Object = instantiate(B, [Object_, Object_]);
+        ResolutionDartType B_num_num = instantiate(B, [num_, num_]);
+        ResolutionDartType B_int_num = instantiate(B, [int_, num_]);
+        ResolutionDartType B_dynamic_dynamic =
+            instantiate(B, [dynamic_, dynamic_]);
+        ResolutionDartType B_String_dynamic =
+            instantiate(B, [String_, dynamic_]);
 
         expect(true, B_Object_Object, Object_);
         expect(true, B_Object_Object, A_Object);
@@ -214,10 +245,11 @@
             expectMoreSpecific: false);
         expect(true, B_String_dynamic, B_String_dynamic);
 
-        DartType C_Object_Object = instantiate(C, [Object_, Object_]);
-        DartType C_num_num = instantiate(C, [num_, num_]);
-        DartType C_int_String = instantiate(C, [int_, String_]);
-        DartType C_dynamic_dynamic = instantiate(C, [dynamic_, dynamic_]);
+        ResolutionDartType C_Object_Object = instantiate(C, [Object_, Object_]);
+        ResolutionDartType C_num_num = instantiate(C, [num_, num_]);
+        ResolutionDartType C_int_String = instantiate(C, [int_, String_]);
+        ResolutionDartType C_dynamic_dynamic =
+            instantiate(C, [dynamic_, dynamic_]);
 
         expect(true, C_Object_Object, B_Object_Object);
         expect(false, C_Object_Object, B_num_num);
@@ -269,20 +301,21 @@
         void m5(V v, int i);
       }
       """).then((env) {
-        void expect(bool expectSubtype, DartType T, DartType S,
+        void expect(
+            bool expectSubtype, ResolutionDartType T, ResolutionDartType S,
             {bool expectMoreSpecific}) {
           testTypes(env, T, S, expectSubtype, expectMoreSpecific);
         }
 
         ClassElement classA = env.getElement('A');
-        DartType A = classA.rawType;
-        DartType function = env['Function'];
-        DartType call = env.getMemberType(classA, 'call');
-        DartType m1 = env.getMemberType(classA, 'm1');
-        DartType m2 = env.getMemberType(classA, 'm2');
-        DartType m3 = env.getMemberType(classA, 'm3');
-        DartType m4 = env.getMemberType(classA, 'm4');
-        DartType m5 = env.getMemberType(classA, 'm5');
+        ResolutionDartType A = classA.rawType;
+        ResolutionDartType function = env['Function'];
+        ResolutionDartType call = env.getMemberType(classA, 'call');
+        ResolutionDartType m1 = env.getMemberType(classA, 'm1');
+        ResolutionDartType m2 = env.getMemberType(classA, 'm2');
+        ResolutionDartType m3 = env.getMemberType(classA, 'm3');
+        ResolutionDartType m4 = env.getMemberType(classA, 'm4');
+        ResolutionDartType m5 = env.getMemberType(classA, 'm5');
 
         expect(true, A, function);
         expect(true, A, call);
@@ -554,44 +587,45 @@
       class I<T extends S, S extends U, U extends T> {}
       class J<T extends S, S extends U, U extends S> {}
       """).then((env) {
-        void expect(bool expectSubtype, DartType T, DartType S,
+        void expect(
+            bool expectSubtype, ResolutionDartType T, ResolutionDartType S,
             {bool expectMoreSpecific}) {
           testTypes(env, T, S, expectSubtype, expectMoreSpecific);
         }
 
         ClassElement A = env.getElement('A');
-        TypeVariableType A_T = A.thisType.typeArguments[0];
+        ResolutionTypeVariableType A_T = A.thisType.typeArguments[0];
         ClassElement B = env.getElement('B');
-        TypeVariableType B_T = B.thisType.typeArguments[0];
+        ResolutionTypeVariableType B_T = B.thisType.typeArguments[0];
         ClassElement C = env.getElement('C');
-        TypeVariableType C_T = C.thisType.typeArguments[0];
+        ResolutionTypeVariableType C_T = C.thisType.typeArguments[0];
         ClassElement D = env.getElement('D');
-        TypeVariableType D_T = D.thisType.typeArguments[0];
+        ResolutionTypeVariableType D_T = D.thisType.typeArguments[0];
         ClassElement E = env.getElement('E');
-        TypeVariableType E_T = E.thisType.typeArguments[0];
-        TypeVariableType E_S = E.thisType.typeArguments[1];
+        ResolutionTypeVariableType E_T = E.thisType.typeArguments[0];
+        ResolutionTypeVariableType E_S = E.thisType.typeArguments[1];
         ClassElement F = env.getElement('F');
-        TypeVariableType F_T = F.thisType.typeArguments[0];
-        TypeVariableType F_S = F.thisType.typeArguments[1];
+        ResolutionTypeVariableType F_T = F.thisType.typeArguments[0];
+        ResolutionTypeVariableType F_S = F.thisType.typeArguments[1];
         ClassElement G = env.getElement('G');
-        TypeVariableType G_T = G.thisType.typeArguments[0];
+        ResolutionTypeVariableType G_T = G.thisType.typeArguments[0];
         ClassElement H = env.getElement('H');
-        TypeVariableType H_T = H.thisType.typeArguments[0];
-        TypeVariableType H_S = H.thisType.typeArguments[1];
+        ResolutionTypeVariableType H_T = H.thisType.typeArguments[0];
+        ResolutionTypeVariableType H_S = H.thisType.typeArguments[1];
         ClassElement I = env.getElement('I');
-        TypeVariableType I_T = I.thisType.typeArguments[0];
-        TypeVariableType I_S = I.thisType.typeArguments[1];
-        TypeVariableType I_U = I.thisType.typeArguments[2];
+        ResolutionTypeVariableType I_T = I.thisType.typeArguments[0];
+        ResolutionTypeVariableType I_S = I.thisType.typeArguments[1];
+        ResolutionTypeVariableType I_U = I.thisType.typeArguments[2];
         ClassElement J = env.getElement('J');
-        TypeVariableType J_T = J.thisType.typeArguments[0];
-        TypeVariableType J_S = J.thisType.typeArguments[1];
-        TypeVariableType J_U = J.thisType.typeArguments[2];
+        ResolutionTypeVariableType J_T = J.thisType.typeArguments[0];
+        ResolutionTypeVariableType J_S = J.thisType.typeArguments[1];
+        ResolutionTypeVariableType J_U = J.thisType.typeArguments[2];
 
-        DartType Object_ = env['Object'];
-        DartType num_ = env['num'];
-        DartType int_ = env['int'];
-        DartType String_ = env['String'];
-        DartType dynamic_ = env['dynamic'];
+        ResolutionDartType Object_ = env['Object'];
+        ResolutionDartType num_ = env['num'];
+        ResolutionDartType int_ = env['int'];
+        ResolutionDartType String_ = env['String'];
+        ResolutionDartType dynamic_ = env['dynamic'];
 
         // class A<T> {}
         expect(true, A_T, Object_);
diff --git a/tests/compiler/dart2js/subtypeset_test.dart b/tests/compiler/dart2js/subtypeset_test.dart
index 1f0fd7f..418e547 100644
--- a/tests/compiler/dart2js/subtypeset_test.dart
+++ b/tests/compiler/dart2js/subtypeset_test.dart
@@ -47,7 +47,7 @@
       """,
               useMockCompiler: false)
           .then((env) {
-        ClosedWorld world = env.compiler.closedWorld;
+        ClosedWorld world = env.closedWorld;
 
         ClassElement A = env.getElement("A");
         ClassElement B = env.getElement("B");
diff --git a/tests/compiler/dart2js/trust_type_annotations_test.dart b/tests/compiler/dart2js/trust_type_annotations_test.dart
index 764e5ef..abf00f0 100644
--- a/tests/compiler/dart2js/trust_type_annotations_test.dart
+++ b/tests/compiler/dart2js/trust_type_annotations_test.dart
@@ -51,6 +51,7 @@
   var compiler = compilerFor(TEST, uri, trustTypeAnnotations: true);
   asyncTest(() => compiler.run(uri).then((_) {
         var typesInferrer = compiler.globalInference.typesInferrerInternal;
+        var closedWorld = typesInferrer.closedWorld;
 
         ClassElement classA = findElement(compiler, "A");
 
@@ -58,18 +59,17 @@
           var element = classA.lookupMember(name);
           var mask = typesInferrer.getReturnTypeOfElement(element);
           Expect.isTrue(type.containsMask(
-              typesInferrer.getReturnTypeOfElement(element),
-              compiler.closedWorld));
+              typesInferrer.getReturnTypeOfElement(element), closedWorld));
         }
 
         checkType(String name, type) {
           var element = classA.lookupMember(name);
           Expect.isTrue(type.containsMask(
-              typesInferrer.getTypeOfElement(element), compiler.closedWorld));
+              typesInferrer.getTypeOfElement(element), closedWorld));
         }
 
-        var intMask = new TypeMask.subtype(
-            compiler.coreClasses.intClass, compiler.closedWorld);
+        var intMask =
+            new TypeMask.subtype(compiler.commonElements.intClass, closedWorld);
 
         checkReturn('foo', intMask);
         checkReturn('faa', intMask);
diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index 96dba28..b41971d 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -7,7 +7,7 @@
 import 'package:async_helper/async_helper.dart';
 import 'package:expect/expect.dart';
 
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/diagnostics/messages.dart';
 import 'package:compiler/src/elements/elements.dart';
 import 'package:compiler/src/elements/modelx.dart'
@@ -71,14 +71,14 @@
 }
 
 testSimpleTypes(MockCompiler compiler) {
-  checkType(DartType type, String code) {
+  checkType(ResolutionInterfaceType type, String code) {
     Expect.equals(type, analyzeType(compiler, code));
   }
 
-  checkType(compiler.coreTypes.intType, "3");
-  checkType(compiler.coreTypes.boolType, "false");
-  checkType(compiler.coreTypes.boolType, "true");
-  checkType(compiler.coreTypes.stringType, "'hestfisk'");
+  checkType(compiler.commonElements.intType, "3");
+  checkType(compiler.commonElements.boolType, "false");
+  checkType(compiler.commonElements.boolType, "true");
+  checkType(compiler.commonElements.stringType, "'hestfisk'");
 }
 
 Future testReturn(MockCompiler compiler) {
@@ -2649,7 +2649,7 @@
   return compiler.init("import 'dart:async';").then((_) => test(compiler));
 }
 
-DartType analyzeType(MockCompiler compiler, String text) {
+ResolutionDartType analyzeType(MockCompiler compiler, String text) {
   var node = parseExpression(text);
   TypeCheckerVisitor visitor = new TypeCheckerVisitor(
       compiler, new TreeElementMapping(null), compiler.types);
@@ -2699,7 +2699,7 @@
         new TypeCheckerVisitor(compiler, mapping, compiler.types);
     DiagnosticCollector collector = compiler.diagnosticCollector;
     collector.clear();
-    checker.analyze(node);
+    checker.analyze(node, mustHaveType: false);
     compareWarningKinds(text, expectedWarnings, collector.warnings);
 
     compiler.diagnosticHandler = null;
@@ -2736,7 +2736,7 @@
       new TypeCheckerVisitor(compiler, elements, compiler.types);
   DiagnosticCollector collector = compiler.diagnosticCollector;
   collector.clear();
-  checker.analyze(node);
+  checker.analyze(node, mustHaveType: false);
   if (flushDeferred) {
     compiler.enqueuer.resolution.emptyDeferredQueueForTesting();
   }
@@ -2777,7 +2777,7 @@
       new TypeCheckerVisitor(compiler, elements, compiler.types);
   DiagnosticCollector collector = compiler.diagnosticCollector;
   collector.clear();
-  checker.analyze(node);
+  checker.analyze(node, mustHaveType: false);
   generateOutput(compiler, text);
   compareWarningKinds(text, warnings, collector.warnings);
   compareWarningKinds(text, hints, collector.hints);
diff --git a/tests/compiler/dart2js/type_combination_test.dart b/tests/compiler/dart2js/type_combination_test.dart
index bde511b..f54364e 100644
--- a/tests/compiler/dart2js/type_combination_test.dart
+++ b/tests/compiler/dart2js/type_combination_test.dart
@@ -102,8 +102,10 @@
 }
 
 void testUnion(MockCompiler compiler) {
-  RuleSet ruleSet = new RuleSet('union',
-      (t1, t2) => simplify(t1.union(t2, compiler.closedWorld), compiler));
+  ClosedWorld closedWorld =
+      compiler.resolutionWorldBuilder.closedWorldForTesting;
+  RuleSet ruleSet = new RuleSet(
+      'union', (t1, t2) => simplify(t1.union(t2, closedWorld), closedWorld));
   rule(type1, type2, result) => ruleSet.rule(type1, type2, result);
   check(type1, type2, predicate) => ruleSet.check(type1, type2, predicate);
 
@@ -415,8 +417,10 @@
 void testIntersection(MockCompiler compiler) {
   JavaScriptBackend backend = compiler.backend;
   BackendHelpers helpers = backend.helpers;
-  RuleSet ruleSet = new RuleSet(
-      'intersection', (t1, t2) => t1.intersection(t2, compiler.closedWorld));
+  ClosedWorld closedWorld =
+      compiler.resolutionWorldBuilder.closedWorldForTesting;
+  RuleSet ruleSet =
+      new RuleSet('intersection', (t1, t2) => t1.intersection(t2, closedWorld));
   rule(type1, type2, result) => ruleSet.rule(type1, type2, result);
 
   rule(emptyType, emptyType, emptyType);
@@ -557,9 +561,9 @@
   rule(jsIndexable, nonPrimitive1, emptyType);
   rule(jsIndexable, nonPrimitive2, emptyType);
   rule(jsIndexable, potentialArray,
-      new TypeMask.nonNullSubtype(helpers.jsArrayClass, compiler.closedWorld));
+      new TypeMask.nonNullSubtype(helpers.jsArrayClass, closedWorld));
   rule(jsIndexable, potentialString,
-      new TypeMask.nonNullSubtype(helpers.jsStringClass, compiler.closedWorld));
+      new TypeMask.nonNullSubtype(helpers.jsStringClass, closedWorld));
   rule(jsIndexable, jsBooleanOrNull, emptyType);
   rule(jsIndexable, jsNumberOrNull, emptyType);
   rule(jsIndexable, jsIntegerOrNull, emptyType);
@@ -724,10 +728,12 @@
 }
 
 void testRegressions(MockCompiler compiler) {
+  ClosedWorld closedWorld =
+      compiler.resolutionWorldBuilder.closedWorldForTesting;
   TypeMask nonNullPotentialString =
-      new TypeMask.nonNullSubtype(patternClass, compiler.closedWorld);
+      new TypeMask.nonNullSubtype(patternClass, closedWorld);
   Expect.equals(potentialString,
-      jsStringOrNull.union(nonNullPotentialString, compiler.closedWorld));
+      jsStringOrNull.union(nonNullPotentialString, closedWorld));
 }
 
 void main() {
@@ -738,7 +744,6 @@
     """);
     JavaScriptBackend backend = compiler.backend;
     BackendHelpers helpers = backend.helpers;
-    ClosedWorld world = compiler.openWorld.closeWorld(compiler.reporter);
     WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
     helpers.interceptorsLibrary.forEachLocalMember((element) {
       if (element.isClass) {
@@ -751,63 +756,71 @@
     patternImplClass.ensureResolved(compiler.resolution);
 
     impactBuilder.registerTypeUse(
-        new TypeUse.instantiation(compiler.coreTypes.mapType()));
+        new TypeUse.instantiation(compiler.commonElements.mapType()));
     impactBuilder.registerTypeUse(
-        new TypeUse.instantiation(compiler.coreTypes.functionType));
+        new TypeUse.instantiation(compiler.commonElements.functionType));
     impactBuilder
         .registerTypeUse(new TypeUse.instantiation(patternImplClass.rawType));
     compiler.enqueuer.resolution.applyImpact(impactBuilder);
-    compiler.openWorld.closeWorld(compiler.reporter);
+    compiler.closeResolution();
+    ClosedWorld closedWorld =
+        compiler.resolutionWorldBuilder.closedWorldForTesting;
 
     // Grab hold of a supertype for String so we can produce potential
     // string types.
-    patternClass = compiler.commonElements.coreLibrary.find('Pattern');
+    LibraryElement coreLibrary = closedWorld.commonElements.coreLibrary;
+    patternClass = coreLibrary.find('Pattern');
 
-    nonPrimitive1 =
-        new TypeMask.nonNullSubtype(compiler.coreClasses.mapClass, world);
-    nonPrimitive2 =
-        new TypeMask.nonNullSubtype(compiler.coreClasses.functionClass, world);
+    nonPrimitive1 = new TypeMask.nonNullSubtype(
+        closedWorld.commonElements.mapClass, closedWorld);
+    nonPrimitive2 = new TypeMask.nonNullSubtype(
+        closedWorld.commonElements.functionClass, closedWorld);
     potentialArray =
-        new TypeMask.subtype(compiler.coreClasses.listClass, world);
-    potentialString = new TypeMask.subtype(patternClass, world);
+        new TypeMask.subtype(closedWorld.commonElements.listClass, closedWorld);
+    potentialString = new TypeMask.subtype(patternClass, closedWorld);
     jsInterceptor =
-        new TypeMask.nonNullSubclass(helpers.jsInterceptorClass, world);
-    jsArrayOrNull = new TypeMask.subclass(helpers.jsArrayClass, world);
-    jsReadableArray = new TypeMask.nonNullSubclass(helpers.jsArrayClass, world);
+        new TypeMask.nonNullSubclass(helpers.jsInterceptorClass, closedWorld);
+    jsArrayOrNull = new TypeMask.subclass(helpers.jsArrayClass, closedWorld);
+    jsReadableArray =
+        new TypeMask.nonNullSubclass(helpers.jsArrayClass, closedWorld);
     jsMutableArrayOrNull =
-        new TypeMask.subclass(helpers.jsMutableArrayClass, world);
+        new TypeMask.subclass(helpers.jsMutableArrayClass, closedWorld);
     jsMutableArray =
-        new TypeMask.nonNullSubclass(helpers.jsMutableArrayClass, world);
-    jsFixedArrayOrNull = new TypeMask.exact(helpers.jsFixedArrayClass, world);
-    jsFixedArray = new TypeMask.nonNullExact(helpers.jsFixedArrayClass, world);
+        new TypeMask.nonNullSubclass(helpers.jsMutableArrayClass, closedWorld);
+    jsFixedArrayOrNull =
+        new TypeMask.exact(helpers.jsFixedArrayClass, closedWorld);
+    jsFixedArray =
+        new TypeMask.nonNullExact(helpers.jsFixedArrayClass, closedWorld);
     jsExtendableArrayOrNull =
-        new TypeMask.exact(helpers.jsExtendableArrayClass, world);
+        new TypeMask.exact(helpers.jsExtendableArrayClass, closedWorld);
     jsExtendableArray =
-        new TypeMask.nonNullExact(helpers.jsExtendableArrayClass, world);
+        new TypeMask.nonNullExact(helpers.jsExtendableArrayClass, closedWorld);
     jsUnmodifiableArrayOrNull =
-        new TypeMask.exact(helpers.jsUnmodifiableArrayClass, world);
-    jsUnmodifiableArray =
-        new TypeMask.nonNullExact(helpers.jsUnmodifiableArrayClass, world);
-    jsIndexableOrNull = new TypeMask.subtype(helpers.jsIndexableClass, world);
-    jsIndexable = new TypeMask.nonNullSubtype(helpers.jsIndexableClass, world);
+        new TypeMask.exact(helpers.jsUnmodifiableArrayClass, closedWorld);
+    jsUnmodifiableArray = new TypeMask.nonNullExact(
+        helpers.jsUnmodifiableArrayClass, closedWorld);
+    jsIndexableOrNull =
+        new TypeMask.subtype(helpers.jsIndexableClass, closedWorld);
+    jsIndexable =
+        new TypeMask.nonNullSubtype(helpers.jsIndexableClass, closedWorld);
     jsInterceptorOrNull =
-        new TypeMask.subclass(helpers.jsInterceptorClass, world);
-    jsStringOrNull = new TypeMask.exact(helpers.jsStringClass, world);
-    jsString = new TypeMask.nonNullExact(helpers.jsStringClass, world);
-    jsBoolean = new TypeMask.nonNullExact(helpers.jsBoolClass, world);
-    jsNumber = new TypeMask.nonNullSubclass(helpers.jsNumberClass, world);
-    jsInteger = new TypeMask.nonNullExact(helpers.jsIntClass, world);
-    jsDouble = new TypeMask.nonNullExact(helpers.jsDoubleClass, world);
-    jsBooleanOrNull = new TypeMask.exact(helpers.jsBoolClass, world);
-    jsNumberOrNull = new TypeMask.subclass(helpers.jsNumberClass, world);
-    jsIntegerOrNull = new TypeMask.exact(helpers.jsIntClass, world);
-    jsDoubleOrNull = new TypeMask.exact(helpers.jsDoubleClass, world);
+        new TypeMask.subclass(helpers.jsInterceptorClass, closedWorld);
+    jsStringOrNull = new TypeMask.exact(helpers.jsStringClass, closedWorld);
+    jsString = new TypeMask.nonNullExact(helpers.jsStringClass, closedWorld);
+    jsBoolean = new TypeMask.nonNullExact(helpers.jsBoolClass, closedWorld);
+    jsNumber = new TypeMask.nonNullSubclass(helpers.jsNumberClass, closedWorld);
+    jsInteger = new TypeMask.nonNullExact(helpers.jsIntClass, closedWorld);
+    jsDouble = new TypeMask.nonNullExact(helpers.jsDoubleClass, closedWorld);
+    jsBooleanOrNull = new TypeMask.exact(helpers.jsBoolClass, closedWorld);
+    jsNumberOrNull = new TypeMask.subclass(helpers.jsNumberClass, closedWorld);
+    jsIntegerOrNull = new TypeMask.exact(helpers.jsIntClass, closedWorld);
+    jsDoubleOrNull = new TypeMask.exact(helpers.jsDoubleClass, closedWorld);
     nullType = const TypeMask.empty();
-    objectType =
-        new TypeMask.nonNullSubclass(compiler.coreClasses.objectClass, world);
+    objectType = new TypeMask.nonNullSubclass(
+        closedWorld.commonElements.objectClass, closedWorld);
     emptyType = const TypeMask.nonNullEmpty();
-    dynamicType =
-        new TypeMask.subclass(compiler.coreClasses.objectClass, world);
+    dynamicType = new TypeMask.subclass(
+        closedWorld.commonElements.objectClass, closedWorld);
 
     Expect.notEquals(
         emptyType, nonPrimitive1, "nonPrimitive1 expected to be non-empty.");
diff --git a/tests/compiler/dart2js/type_equals_test.dart b/tests/compiler/dart2js/type_equals_test.dart
index 3da5afe..4dab03e 100644
--- a/tests/compiler/dart2js/type_equals_test.dart
+++ b/tests/compiler/dart2js/type_equals_test.dart
@@ -4,7 +4,7 @@
 
 import "package:expect/expect.dart";
 import "package:async_helper/async_helper.dart";
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import "compiler_helper.dart";
 
 bool test(compiler, String name1, String name2, {bool expect}) {
@@ -28,8 +28,8 @@
   //
   // Only a single type is used from each signature. That is, it is not the
   // intention to check the whole signatures against eachother.
-  DartType type1;
-  DartType type2;
+  ResolutionDartType type1;
+  ResolutionDartType type2;
   if (signature1.requiredParameterCount == 0) {
     // If parameters is empty, use return type.
     type1 = signature1.type.returnType;
diff --git a/tests/compiler/dart2js/type_inference6_test.dart b/tests/compiler/dart2js/type_inference6_test.dart
index a9cdc0a..ce18f9b 100644
--- a/tests/compiler/dart2js/type_inference6_test.dart
+++ b/tests/compiler/dart2js/type_inference6_test.dart
@@ -24,11 +24,12 @@
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST, uri);
   return compiler.run(uri).then((_) {
-    var commonMasks = compiler.closedWorld.commonMasks;
     var typesInferrer = compiler.globalInference.typesInferrerInternal;
+    var closedWorld = typesInferrer.closedWorld;
+    var commonMasks = closedWorld.commonMasks;
     var element = findElement(compiler, "foo");
     var mask = typesInferrer.getReturnTypeOfElement(element);
-    Expect.equals(commonMasks.uint31Type, simplify(mask, compiler));
+    Expect.equals(commonMasks.uint31Type, simplify(mask, closedWorld));
   });
 }
 
diff --git a/tests/compiler/dart2js/type_inference7_test.dart b/tests/compiler/dart2js/type_inference7_test.dart
index a8ebbb0..e4ec10f 100644
--- a/tests/compiler/dart2js/type_inference7_test.dart
+++ b/tests/compiler/dart2js/type_inference7_test.dart
@@ -23,13 +23,15 @@
     // Assertions enabled:
     var compiler = compilerFor(TEST, uri, enableUserAssertions: true);
     await compiler.run(uri);
-    var commonMasks = compiler.closedWorld.commonMasks;
     var typesInferrer = compiler.globalInference.typesInferrerInternal;
+    var closedWorld = typesInferrer.closedWorld;
+    var commonMasks = closedWorld.commonMasks;
     var foo = findElement(compiler, "foo");
     // Return type is null|bool.
     var mask = typesInferrer.getReturnTypeOfElement(foo);
     Expect.isTrue(mask.isNullable);
-    Expect.equals(commonMasks.boolType, simplify(mask.nonNullable(), compiler));
+    Expect.equals(
+        commonMasks.boolType, simplify(mask.nonNullable(), closedWorld));
     // First parameter is uint31|String|bool.
     var mask1 = typesInferrer.getTypeOfElement(foo.parameters[0]);
     Expect.isTrue(mask1.isUnion);
@@ -37,7 +39,7 @@
         [commonMasks.uint31Type, commonMasks.stringType, commonMasks.boolType]);
     for (var typeMask in mask1.disjointMasks) {
       Expect.isFalse(typeMask.isNullable);
-      var simpleType = simplify(typeMask, compiler);
+      var simpleType = simplify(typeMask, closedWorld);
       Expect.isTrue(expectedTypes.remove(simpleType), "$simpleType");
     }
     Expect.isTrue(expectedTypes.isEmpty);
@@ -45,15 +47,16 @@
     var mask2 = typesInferrer.getTypeOfElement(foo.parameters[1]);
     Expect.isTrue(mask2.isNullable);
     Expect.equals(
-        commonMasks.boolType, simplify(mask2.nonNullable(), compiler));
+        commonMasks.boolType, simplify(mask2.nonNullable(), closedWorld));
   }
 
   {
     // Assertions disabled:
     var compiler = compilerFor(TEST, uri, enableUserAssertions: false);
     await compiler.run(uri);
-    var commonMasks = compiler.closedWorld.commonMasks;
     var typesInferrer = compiler.globalInference.typesInferrerInternal;
+    var closedWorld = typesInferrer.closedWorld;
+    var commonMasks = closedWorld.commonMasks;
     var foo = findElement(compiler, "foo");
     // Return type is null.
     var mask = typesInferrer.getReturnTypeOfElement(foo);
@@ -62,11 +65,11 @@
     // First parameter is uint31.
     var mask1 = typesInferrer.getTypeOfElement(foo.parameters[0]);
     Expect.isFalse(mask1.isNullable);
-    Expect.equals(commonMasks.uint31Type, simplify(mask1, compiler));
+    Expect.equals(commonMasks.uint31Type, simplify(mask1, closedWorld));
     // Second parameter is null.
     var mask2 = typesInferrer.getTypeOfElement(foo.parameters[1]);
     Expect.isTrue(mask2.isNullable);
-    Expect.isTrue(simplify(mask2.nonNullable(), compiler).isEmpty);
+    Expect.isTrue(simplify(mask2.nonNullable(), closedWorld).isEmpty);
   }
 }
 
diff --git a/tests/compiler/dart2js/type_inference8_test.dart b/tests/compiler/dart2js/type_inference8_test.dart
index fb4717c..bc629d8 100644
--- a/tests/compiler/dart2js/type_inference8_test.dart
+++ b/tests/compiler/dart2js/type_inference8_test.dart
@@ -34,8 +34,8 @@
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST1, uri);
   return compiler.run(uri).then((_) {
-    var commonMasks = compiler.closedWorld.commonMasks;
     var typesInferrer = compiler.globalInference.typesInferrerInternal;
+    var commonMasks = typesInferrer.closedWorld.commonMasks;
     var element = findElement(compiler, "foo");
     var mask = typesInferrer.getReturnTypeOfElement(element);
     var falseType =
@@ -77,8 +77,8 @@
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(TEST2, uri);
   return compiler.run(uri).then((_) {
-    var commonMasks = compiler.closedWorld.commonMasks;
     var typesInferrer = compiler.globalInference.typesInferrerInternal;
+    var commonMasks = typesInferrer.closedWorld.commonMasks;
     var element = findElement(compiler, "foo");
     var mask = typesInferrer.getReturnTypeOfElement(element);
     // Can't infer value for foo's return type, it could be either true or false
diff --git a/tests/compiler/dart2js/type_inference_switch_test.dart b/tests/compiler/dart2js/type_inference_switch_test.dart
index 181fc41..f28444b 100644
--- a/tests/compiler/dart2js/type_inference_switch_test.dart
+++ b/tests/compiler/dart2js/type_inference_switch_test.dart
@@ -133,17 +133,18 @@
 Future runTest(String test, checker) {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(test, uri);
-
-  checkTypeOf(String name, TypeMask type) {
-    var commonMasks = compiler.closedWorld.commonMasks;
-    var typesInferrer = compiler.globalInference.typesInferrerInternal;
-    var element = findElement(compiler, name);
-    var mask = typesInferrer.getReturnTypeOfElement(element);
-    Expect.equals(type, simplify(mask, compiler));
-  }
-
   return compiler.run(uri).then((_) {
-    checker(compiler.closedWorld.commonMasks, checkTypeOf);
+    var typesInferrer = compiler.globalInference.typesInferrerInternal;
+    var closedWorld = typesInferrer.closedWorld;
+    var commonMasks = closedWorld.commonMasks;
+
+    checkTypeOf(String name, TypeMask type) {
+      var element = findElement(compiler, name);
+      var mask = typesInferrer.getReturnTypeOfElement(element);
+      Expect.equals(type, simplify(mask, closedWorld));
+    }
+
+    checker(commonMasks, checkTypeOf);
   });
 }
 
diff --git a/tests/compiler/dart2js/type_mask2_test.dart b/tests/compiler/dart2js/type_mask2_test.dart
index 78791cb..609cac7 100644
--- a/tests/compiler/dart2js/type_mask2_test.dart
+++ b/tests/compiler/dart2js/type_mask2_test.dart
@@ -104,7 +104,7 @@
       """,
       useMockCompiler: false);
 
-  ClosedWorld closedWorld = env.compiler.closedWorld;
+  ClosedWorld closedWorld = env.closedWorld;
 
   ClassElement Object_ = env.getElement("Object");
   ClassElement A = env.getElement("A");
@@ -213,12 +213,11 @@
       }
       """,
       useMockCompiler: false);
-  var closedWorld = env.compiler.closedWorld;
-  var backend = env.compiler.backend;
+  ClosedWorld closedWorld = env.closedWorld;
 
   ClassElement Object_ = env.getElement("Object");
   ClassElement String_ = env.getElement("String");
-  ClassElement JSString = backend.helpers.jsStringClass;
+  ClassElement JSString = closedWorld.backendClasses.stringImplementation;
 
   List<ClassElement> allClasses = <ClassElement>[Object_, String_];
 
diff --git a/tests/compiler/dart2js/type_mask_disjoint_test.dart b/tests/compiler/dart2js/type_mask_disjoint_test.dart
index 7c643a5..48d3a98 100644
--- a/tests/compiler/dart2js/type_mask_disjoint_test.dart
+++ b/tests/compiler/dart2js/type_mask_disjoint_test.dart
@@ -36,7 +36,7 @@
 
 Uri uri = new Uri(scheme: 'source');
 var compiler = compilerFor(CODE, uri);
-var world = compiler.closedWorld;
+var world = compiler.resolutionWorldBuilder.closedWorldForTesting;
 
 main() {
   asyncTest(() => compiler.run(uri).then((_) {
diff --git a/tests/compiler/dart2js/type_mask_test.dart b/tests/compiler/dart2js/type_mask_test.dart
index 3cb01a0..e3fd1cb 100644
--- a/tests/compiler/dart2js/type_mask_test.dart
+++ b/tests/compiler/dart2js/type_mask_test.dart
@@ -21,7 +21,8 @@
 main() {
   Uri uri = new Uri(scheme: 'source');
   var compiler = compilerFor(CODE, uri);
-  var closedWorld = compiler.openWorld.closeWorld(compiler.reporter);
+  compiler.closeResolution();
+  var closedWorld = compiler.resolutionWorldBuilder.closedWorldForTesting;
 
   asyncTest(() => compiler.run(uri).then((_) {
         var classA = findElement(compiler, 'A');
@@ -38,7 +39,7 @@
         var subtypeA = new TypeMask.nonNullSubtype(classA, closedWorld);
 
         var subclassObject = new TypeMask.nonNullSubclass(
-            compiler.coreClasses.objectClass, closedWorld);
+            compiler.commonElements.objectClass, closedWorld);
 
         var unionABC =
             UnionTypeMask.unionOf([exactA, exactB, exactC], closedWorld);
diff --git a/tests/compiler/dart2js/type_mask_test_helper.dart b/tests/compiler/dart2js/type_mask_test_helper.dart
index a6c8604..414d259 100644
--- a/tests/compiler/dart2js/type_mask_test_helper.dart
+++ b/tests/compiler/dart2js/type_mask_test_helper.dart
@@ -5,13 +5,13 @@
 library type_mask_test_helper;
 
 import 'package:compiler/src/types/types.dart';
-import 'package:compiler/src/compiler.dart' show Compiler;
+import 'package:compiler/src/world.dart' show ClosedWorld;
 
-TypeMask simplify(TypeMask mask, Compiler compiler) {
+TypeMask simplify(TypeMask mask, ClosedWorld closedWorld) {
   if (mask is ForwardingTypeMask) {
-    return simplify(mask.forwardTo, compiler);
+    return simplify(mask.forwardTo, closedWorld);
   } else if (mask is UnionTypeMask) {
-    return UnionTypeMask.flatten(mask.disjointMasks, compiler.closedWorld);
+    return UnionTypeMask.flatten(mask.disjointMasks, closedWorld);
   } else {
     return mask;
   }
diff --git a/tests/compiler/dart2js/type_order_test.dart b/tests/compiler/dart2js/type_order_test.dart
index 5fa8087..c74a0ff 100644
--- a/tests/compiler/dart2js/type_order_test.dart
+++ b/tests/compiler/dart2js/type_order_test.dart
@@ -7,7 +7,7 @@
 import 'package:expect/expect.dart';
 import 'package:async_helper/async_helper.dart';
 import 'type_test_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import "package:compiler/src/elements/elements.dart"
     show Element, ClassElement, TypedefElement;
 
@@ -21,42 +21,43 @@
       class Z {}
       """).then((env) {
         List types = [];
-        DartType add(DartType type) {
+        ResolutionDartType add(ResolutionDartType type) {
           types.add(type);
           return type;
         }
 
-        DartType dynamic_ = add(env['dynamic']);
-        DartType void_ = add(env['void']);
+        ResolutionDartType dynamic_ = add(env['dynamic']);
+        ResolutionDartType void_ = add(env['void']);
 
         ClassElement A = env.getElement('A');
         TypedefElement B = env.getElement('B');
         ClassElement C = env.getElement('C');
-        DartType X = add(env['X']);
-        DartType Y = add(env['Y']);
-        DartType Z = add(env['Z']);
+        ResolutionDartType X = add(env['X']);
+        ResolutionDartType Y = add(env['Y']);
+        ResolutionDartType Z = add(env['Z']);
 
-        InterfaceType A_this = add(A.thisType);
-        InterfaceType A_raw = add(A.rawType);
-        TypeVariableType AT = add(A_this.typeArguments[0]);
-        TypeVariableType AS = add(A_this.typeArguments[1]);
-        InterfaceType A_X_Y = add(instantiate(A, [X, Y]));
-        InterfaceType A_Y_X = add(instantiate(A, [Y, X]));
+        ResolutionInterfaceType A_this = add(A.thisType);
+        ResolutionInterfaceType A_raw = add(A.rawType);
+        ResolutionTypeVariableType AT = add(A_this.typeArguments[0]);
+        ResolutionTypeVariableType AS = add(A_this.typeArguments[1]);
+        ResolutionInterfaceType A_X_Y = add(instantiate(A, [X, Y]));
+        ResolutionInterfaceType A_Y_X = add(instantiate(A, [Y, X]));
 
-        TypedefType B_this = add(B.computeType(env.compiler.resolution));
-        TypedefType B_raw = add(B.rawType);
-        TypeVariableType BT = add(B_this.typeArguments[0]);
-        TypeVariableType BS = add(B_this.typeArguments[1]);
-        FunctionType B_this_alias = add(B.alias);
-        TypedefType B_X_Y = add(instantiate(B, [X, Y]));
-        FunctionType B_X_Y_alias = add(B_X_Y.unaliased);
-        TypedefType B_Y_X = add(instantiate(B, [Y, X]));
-        FunctionType B_Y_X_alias = add(B_Y_X.unaliased);
+        ResolutionTypedefType B_this =
+            add(B.computeType(env.compiler.resolution));
+        ResolutionTypedefType B_raw = add(B.rawType);
+        ResolutionTypeVariableType BT = add(B_this.typeArguments[0]);
+        ResolutionTypeVariableType BS = add(B_this.typeArguments[1]);
+        ResolutionFunctionType B_this_alias = add(B.alias);
+        ResolutionTypedefType B_X_Y = add(instantiate(B, [X, Y]));
+        ResolutionFunctionType B_X_Y_alias = add(B_X_Y.unaliased);
+        ResolutionTypedefType B_Y_X = add(instantiate(B, [Y, X]));
+        ResolutionFunctionType B_Y_X_alias = add(B_Y_X.unaliased);
 
-        InterfaceType C_this = add(C.thisType);
-        InterfaceType C_raw = add(C.rawType);
-        TypeVariableType CT = add(C_this.typeArguments[0]);
-        TypeVariableType CS = add(C_this.typeArguments[1]);
+        ResolutionInterfaceType C_this = add(C.thisType);
+        ResolutionInterfaceType C_raw = add(C.rawType);
+        ResolutionTypeVariableType CT = add(C_this.typeArguments[0]);
+        ResolutionTypeVariableType CS = add(C_this.typeArguments[1]);
 
         Expect.listEquals([
           void_,
diff --git a/tests/compiler/dart2js/type_representation_test.dart b/tests/compiler/dart2js/type_representation_test.dart
index 2b16579..6fe0889 100644
--- a/tests/compiler/dart2js/type_representation_test.dart
+++ b/tests/compiler/dart2js/type_representation_test.dart
@@ -7,7 +7,7 @@
 import 'package:expect/expect.dart';
 import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/js/js.dart';
 import 'package:compiler/src/elements/elements.dart' show Element, ClassElement;
 import 'package:compiler/src/js_backend/js_backend.dart'
@@ -41,10 +41,12 @@
       m9(int a, String b, {List<int> c, d}) {}
       m10(void f(int a, [b])) {}
       """).then((env) {
+        var closedWorld = env.compiler.closeResolution();
+        env.compiler.backend.onCodegenStart(closedWorld);
         TypeRepresentationGenerator typeRepresentation =
             new TypeRepresentationGenerator(env.compiler);
 
-        Expression onVariable(TypeVariableType variable) {
+        Expression onVariable(ResolutionTypeVariableType variable) {
           return new VariableUse(variable.name);
         }
 
@@ -52,7 +54,7 @@
           return prettyPrint(expression, env.compiler);
         }
 
-        void expect(DartType type, String expectedRepresentation,
+        void expect(ResolutionDartType type, String expectedRepresentation,
             [String expectedTypedefRepresentation]) {
           bool encodeTypedefName = false;
           Expression expression = typeRepresentation.getTypeRepresentation(
@@ -84,25 +86,25 @@
         String typedefTag = backend.namer.typedefTag;
 
         ClassElement List_ = env.getElement('List');
-        TypeVariableType List_E = List_.typeVariables[0];
+        ResolutionTypeVariableType List_E = List_.typeVariables[0];
         ClassElement Map_ = env.getElement('Map');
-        TypeVariableType Map_K = Map_.typeVariables[0];
-        TypeVariableType Map_V = Map_.typeVariables[1];
+        ResolutionTypeVariableType Map_K = Map_.typeVariables[0];
+        ResolutionTypeVariableType Map_V = Map_.typeVariables[1];
 
-        DartType Object_ = env['Object'];
-        DartType int_ = env['int'];
-        DartType String_ = env['String'];
-        DartType dynamic_ = env['dynamic'];
-        DartType Typedef_ = env['Typedef'];
-        DartType Typedef2_ = env['Typedef2'];
-        DartType Typedef3_ = env['Typedef3'];
-        DartType Typedef4_ = env['Typedef4'];
-        DartType Typedef5_ = env['Typedef5'];
-        DartType Typedef6_ = env['Typedef6'];
-        DartType Typedef7_ = env['Typedef7'];
-        DartType Typedef8_ = env['Typedef8'];
-        DartType Typedef9_ = env['Typedef9'];
-        DartType Typedef10_ = env['Typedef10'];
+        ResolutionDartType Object_ = env['Object'];
+        ResolutionDartType int_ = env['int'];
+        ResolutionDartType String_ = env['String'];
+        ResolutionDartType dynamic_ = env['dynamic'];
+        ResolutionDartType Typedef_ = env['Typedef'];
+        ResolutionDartType Typedef2_ = env['Typedef2'];
+        ResolutionDartType Typedef3_ = env['Typedef3'];
+        ResolutionDartType Typedef4_ = env['Typedef4'];
+        ResolutionDartType Typedef5_ = env['Typedef5'];
+        ResolutionDartType Typedef6_ = env['Typedef6'];
+        ResolutionDartType Typedef7_ = env['Typedef7'];
+        ResolutionDartType Typedef8_ = env['Typedef8'];
+        ResolutionDartType Typedef9_ = env['Typedef9'];
+        ResolutionDartType Typedef10_ = env['Typedef10'];
 
         String List_rep = getJsName(List_);
         String List_E_rep = stringify(onVariable(List_E));
diff --git a/tests/compiler/dart2js/type_substitution_test.dart b/tests/compiler/dart2js/type_substitution_test.dart
index 0114b32..2b537c4 100644
--- a/tests/compiler/dart2js/type_substitution_test.dart
+++ b/tests/compiler/dart2js/type_substitution_test.dart
@@ -6,11 +6,11 @@
 
 import 'package:expect/expect.dart';
 import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'compiler_helper.dart';
 import 'type_test_helper.dart';
 
-DartType getType(compiler, String name) {
+ResolutionDartType getType(compiler, String name) {
   var clazz = findElement(compiler, "Class");
   clazz.ensureResolved(compiler.resolution);
   var element = clazz.buildScope().lookup(name);
@@ -57,25 +57,26 @@
         ClassElement E = env.getElement("E");
         ClassElement F = env.getElement("F");
 
-        DartType numType = env['num'];
-        DartType intType = env['int'];
-        DartType stringType = env['String'];
+        ResolutionDartType numType = env['num'];
+        ResolutionDartType intType = env['int'];
+        ResolutionDartType stringType = env['String'];
 
-        InterfaceType C_int = instantiate(C, [intType]);
+        ResolutionInterfaceType C_int = instantiate(C, [intType]);
         Expect.equals(instantiate(C, [intType]), C_int);
         Expect.equals(instantiate(A, [intType]), C_int.asInstanceOf(A));
 
-        InterfaceType D_int = instantiate(D, [stringType]);
+        ResolutionInterfaceType D_int = instantiate(D, [stringType]);
         Expect.equals(instantiate(A, [intType]), D_int.asInstanceOf(A));
 
-        InterfaceType E_int = instantiate(E, [intType]);
+        ResolutionInterfaceType E_int = instantiate(E, [intType]);
         Expect.equals(
             instantiate(A, [
               instantiate(A, [intType])
             ]),
             E_int.asInstanceOf(A));
 
-        InterfaceType F_int_string = instantiate(F, [intType, stringType]);
+        ResolutionInterfaceType F_int_string =
+            instantiate(F, [intType, stringType]);
         Expect.equals(
             instantiate(B, [
               instantiate(F, [intType, stringType])
@@ -98,9 +99,9 @@
  */
 void testSubstitution(
     compiler, arguments, parameters, String name1, String name2) {
-  DartType type1 = getType(compiler, name1);
-  DartType type2 = getType(compiler, name2);
-  DartType subst = type1.subst(arguments, parameters);
+  ResolutionDartType type1 = getType(compiler, name1);
+  ResolutionDartType type2 = getType(compiler, name2);
+  ResolutionDartType subst = type1.subst(arguments, parameters);
   Expect.equals(
       type2, subst, "$type1.subst($arguments,$parameters)=$subst != $type2");
 }
@@ -161,29 +162,33 @@
       """).then((env) {
         var compiler = env.compiler;
 
-        InterfaceType Class_T_S = env["Class"];
+        ResolutionInterfaceType Class_T_S = env["Class"];
         Expect.isNotNull(Class_T_S);
-        Expect.identical(Class_T_S.kind, TypeKind.INTERFACE);
+        Expect.identical(Class_T_S.kind, ResolutionTypeKind.INTERFACE);
         Expect.equals(2, Class_T_S.typeArguments.length);
 
-        DartType T = Class_T_S.typeArguments[0];
+        ResolutionDartType T = Class_T_S.typeArguments[0];
         Expect.isNotNull(T);
-        Expect.identical(T.kind, TypeKind.TYPE_VARIABLE);
+        Expect.identical(T.kind, ResolutionTypeKind.TYPE_VARIABLE);
 
-        DartType S = Class_T_S.typeArguments[1];
+        ResolutionDartType S = Class_T_S.typeArguments[1];
         Expect.isNotNull(S);
-        Expect.identical(S.kind, TypeKind.TYPE_VARIABLE);
+        Expect.identical(S.kind, ResolutionTypeKind.TYPE_VARIABLE);
 
-        DartType intType = env['int']; //getType(compiler, "int1");
+        ResolutionDartType intType = env['int']; //getType(compiler, "int1");
         Expect.isNotNull(intType);
-        Expect.identical(intType.kind, TypeKind.INTERFACE);
+        Expect.identical(intType.kind, ResolutionTypeKind.INTERFACE);
 
-        DartType StringType = env['String']; //getType(compiler, "String1");
+        ResolutionDartType StringType =
+            env['String']; //getType(compiler, "String1");
         Expect.isNotNull(StringType);
-        Expect.identical(StringType.kind, TypeKind.INTERFACE);
+        Expect.identical(StringType.kind, ResolutionTypeKind.INTERFACE);
 
-        List<DartType> parameters = <DartType>[T, S];
-        List<DartType> arguments = <DartType>[intType, StringType];
+        List<ResolutionDartType> parameters = <ResolutionDartType>[T, S];
+        List<ResolutionDartType> arguments = <ResolutionDartType>[
+          intType,
+          StringType
+        ];
 
         // TODO(johnniwinther): Create types directly from strings to improve test
         // readability.
@@ -231,19 +236,21 @@
             compiler, arguments, parameters, "Typedef1e", "Typedef2e");
 
         // Substitution in unalias.
-        DartType Typedef2_int_String = getType(compiler, "Typedef2a");
+        ResolutionDartType Typedef2_int_String = getType(compiler, "Typedef2a");
         Expect.isNotNull(Typedef2_int_String);
-        DartType Function_int_String = getType(compiler, "Function2b");
+        ResolutionDartType Function_int_String =
+            getType(compiler, "Function2b");
         Expect.isNotNull(Function_int_String);
-        DartType unalias1 = Typedef2_int_String.unaliased;
+        ResolutionDartType unalias1 = Typedef2_int_String.unaliased;
         Expect.equals(Function_int_String, unalias1,
             '$Typedef2_int_String.unalias=$unalias1 != $Function_int_String');
 
-        DartType Typedef1 = getType(compiler, "Typedef1c");
+        ResolutionDartType Typedef1 = getType(compiler, "Typedef1c");
         Expect.isNotNull(Typedef1);
-        DartType Function_dynamic_dynamic = getType(compiler, "Function1c");
+        ResolutionDartType Function_dynamic_dynamic =
+            getType(compiler, "Function1c");
         Expect.isNotNull(Function_dynamic_dynamic);
-        DartType unalias2 = Typedef1.unaliased;
+        ResolutionDartType unalias2 = Typedef1.unaliased;
         Expect.equals(Function_dynamic_dynamic, unalias2,
             '$Typedef1.unalias=$unalias2 != $Function_dynamic_dynamic');
       }));
diff --git a/tests/compiler/dart2js/type_test_helper.dart b/tests/compiler/dart2js/type_test_helper.dart
index cc0ae90..10a5cea 100644
--- a/tests/compiler/dart2js/type_test_helper.dart
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -10,18 +10,19 @@
 import 'memory_compiler.dart' as memory;
 import 'package:compiler/src/common/resolution.dart';
 import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import 'package:compiler/src/compiler.dart' show Compiler;
 import 'package:compiler/src/elements/elements.dart'
     show Element, MemberElement, TypeDeclarationElement, ClassElement;
+import 'package:compiler/src/world.dart' show ClosedWorld;
 
 GenericType instantiate(
-    TypeDeclarationElement element, List<DartType> arguments) {
+    TypeDeclarationElement element, List<ResolutionDartType> arguments) {
   if (element.isClass) {
-    return new InterfaceType(element, arguments);
+    return new ResolutionInterfaceType(element, arguments);
   } else {
     assert(element.isTypedef);
-    return new TypedefType(element, arguments);
+    return new ResolutionTypedefType(element, arguments);
   }
 }
 
@@ -93,50 +94,59 @@
     return element;
   }
 
-  DartType getElementType(String name) {
+  ClassElement getClass(String name) => getElement(name);
+
+  ResolutionDartType getElementType(String name) {
     var element = getElement(name);
     return element.computeType(compiler.resolution);
   }
 
-  DartType operator [](String name) {
-    if (name == 'dynamic') return const DynamicType();
-    if (name == 'void') return const VoidType();
+  ResolutionDartType operator [](String name) {
+    if (name == 'dynamic') return const ResolutionDynamicType();
+    if (name == 'void') return const ResolutionVoidType();
     return getElementType(name);
   }
 
-  DartType getMemberType(ClassElement element, String name) {
+  ResolutionDartType getMemberType(ClassElement element, String name) {
     MemberElement member = element.localLookup(name);
     return member.computeType(compiler.resolution);
   }
 
-  bool isSubtype(DartType T, DartType S) {
+  bool isSubtype(ResolutionDartType T, ResolutionDartType S) {
     return compiler.types.isSubtype(T, S);
   }
 
-  bool isMoreSpecific(DartType T, DartType S) {
+  bool isMoreSpecific(ResolutionDartType T, ResolutionDartType S) {
     return compiler.types.isMoreSpecific(T, S);
   }
 
-  DartType computeLeastUpperBound(DartType T, DartType S) {
+  ResolutionDartType computeLeastUpperBound(
+      ResolutionDartType T, ResolutionDartType S) {
     return compiler.types.computeLeastUpperBound(T, S);
   }
 
-  DartType flatten(DartType T) {
+  ResolutionDartType flatten(ResolutionDartType T) {
     return compiler.types.flatten(T);
   }
 
-  FunctionType functionType(DartType returnType, List<DartType> parameters,
-      {List<DartType> optionalParameters: const <DartType>[],
-      Map<String, DartType> namedParameters}) {
+  ResolutionFunctionType functionType(
+      ResolutionDartType returnType, List<ResolutionDartType> parameters,
+      {List<ResolutionDartType> optionalParameters:
+          const <ResolutionDartType>[],
+      Map<String, ResolutionDartType> namedParameters}) {
     List<String> namedParameterNames = <String>[];
-    List<DartType> namedParameterTypes = <DartType>[];
+    List<ResolutionDartType> namedParameterTypes = <ResolutionDartType>[];
     if (namedParameters != null) {
-      namedParameters.forEach((String name, DartType type) {
+      namedParameters.forEach((String name, ResolutionDartType type) {
         namedParameterNames.add(name);
         namedParameterTypes.add(type);
       });
     }
-    return new FunctionType.synthesized(returnType, parameters,
+    return new ResolutionFunctionType.synthesized(returnType, parameters,
         optionalParameters, namedParameterNames, namedParameterTypes);
   }
+
+  ClosedWorld get closedWorld {
+    return compiler.resolutionWorldBuilder.closedWorldForTesting;
+  }
 }
diff --git a/tests/compiler/dart2js/type_variable_occurrence_test.dart b/tests/compiler/dart2js/type_variable_occurrence_test.dart
index 6816288..04d3ffd 100644
--- a/tests/compiler/dart2js/type_variable_occurrence_test.dart
+++ b/tests/compiler/dart2js/type_variable_occurrence_test.dart
@@ -7,7 +7,7 @@
 import 'package:expect/expect.dart';
 import "package:async_helper/async_helper.dart";
 import 'type_test_helper.dart';
-import 'package:compiler/src/dart_types.dart';
+import 'package:compiler/src/elements/resolution_types.dart';
 import "package:compiler/src/elements/elements.dart" show Element, ClassElement;
 
 void main() {
@@ -56,8 +56,9 @@
         ClassElement A = env.getElement('A');
 
         expect(bool expectResult, String memberName) {
-          DartType memberType = env.getMemberType(A, memberName);
-          TypeVariableType typeVariable = memberType.typeVariableOccurrence;
+          ResolutionDartType memberType = env.getMemberType(A, memberName);
+          ResolutionTypeVariableType typeVariable =
+              memberType.typeVariableOccurrence;
           if (expectResult) {
             Expect.isNotNull(typeVariable);
             Expect.equals(A, Types.getClassContext(memberType));
diff --git a/tests/compiler/dart2js/union_type_test.dart b/tests/compiler/dart2js/union_type_test.dart
index 65e6da6..28edfa5 100644
--- a/tests/compiler/dart2js/union_type_test.dart
+++ b/tests/compiler/dart2js/union_type_test.dart
@@ -22,10 +22,10 @@
       }
       """,
         useMockCompiler: false);
-    ClosedWorld world =
-        env.compiler.openWorld.closeWorld(env.compiler.reporter);
-    FlatTypeMask mask1 = new FlatTypeMask.exact(env.getElement('A'));
-    FlatTypeMask mask2 = new FlatTypeMask.exact(env.getElement('B'));
+    env.compiler.closeResolution();
+    ClosedWorld world = env.closedWorld;
+    FlatTypeMask mask1 = new FlatTypeMask.exact(env.getClass('A'));
+    FlatTypeMask mask2 = new FlatTypeMask.exact(env.getClass('B'));
     UnionTypeMask union1 = mask1.nonNullable().union(mask2, world);
     UnionTypeMask union2 = mask2.nonNullable().union(mask1, world);
     Expect.equals(union1, union2);
diff --git a/tests/compiler/dart2js/world_test.dart b/tests/compiler/dart2js/world_test.dart
index 4e29307..6b03817 100644
--- a/tests/compiler/dart2js/world_test.dart
+++ b/tests/compiler/dart2js/world_test.dart
@@ -11,13 +11,14 @@
 import 'package:compiler/src/elements/elements.dart'
     show Element, ClassElement, LibraryElement;
 import 'package:compiler/src/universe/class_set.dart';
-import 'package:compiler/src/world.dart' show ClosedWorld;
+import 'package:compiler/src/world.dart' show ClassQuery, ClosedWorld;
 
 void main() {
   asyncTest(() async {
     await testClassSets();
     await testProperties();
     await testNativeClasses();
+    await testCommonSubclasses();
   });
 }
 
@@ -49,7 +50,7 @@
       }
       """,
       useMockCompiler: false);
-  ClosedWorld closedWorld = env.compiler.closedWorld;
+  ClosedWorld closedWorld = env.closedWorld;
 
   ClassElement Object_ = env.getElement("Object");
   ClassElement A = env.getElement("A");
@@ -69,7 +70,7 @@
           foundClasses.contains(expectedClass),
           "Expect $expectedClass in '$property' on $cls. "
           "Found:\n ${foundClasses.join('\n ')}\n"
-          "${env.compiler.closedWorld.dump(cls)}");
+          "${closedWorld.dump(cls)}");
     }
     if (exact) {
       Expect.equals(
@@ -78,7 +79,7 @@
           "Unexpected classes "
           "${foundClasses.where((c) => !expectedClasses.contains(c))} "
           "in '$property' on $cls.\n"
-          "${env.compiler.closedWorld.dump(cls)}");
+          "${closedWorld.dump(cls)}");
     }
   }
 
@@ -104,7 +105,7 @@
           expectedClasses.length,
           count,
           "Unexpected class count in '$property' on $cls.\n"
-          "${env.compiler.closedWorld.dump(cls)}");
+          "${closedWorld.dump(cls)}");
     }
   }
 
@@ -239,7 +240,7 @@
       }
       """,
       useMockCompiler: false);
-  ClosedWorld closedWorld = env.compiler.closedWorld;
+  ClosedWorld closedWorld = env.closedWorld;
 
   check(String name, {bool hasStrictSubtype, bool hasOnlySubclasses}) {
     ClassElement cls = env.getElement(name);
@@ -316,7 +317,7 @@
       }
       """,
       useMockCompiler: false);
-  ClosedWorld closedWorld = env.compiler.closedWorld;
+  ClosedWorld closedWorld = env.closedWorld;
   LibraryElement dart_html =
       env.compiler.libraryLoader.lookupLibrary(Uris.dart_html);
 
@@ -510,3 +511,99 @@
       instantiatedSubclassCount: 0,
       instantiatedSubtypeCount: 0);
 }
+
+testCommonSubclasses() async {
+  var env = await TypeEnvironment.create('',
+      mainSource: r"""
+      class A {}
+      class B {}
+      class C extends A {}
+      class D implements A {}
+      class E extends B {}
+      class F implements C, E {}
+      class G extends C implements E {}
+      class H implements C {}
+      class I extends D implements E {}
+      class J extends E implements D {}
+      main() {
+        new A();
+        new B();
+        new C();
+        new D();
+        new E();
+        new F();
+        new G();
+        new H();
+        new I();
+        new J();
+      }
+      """,
+      useMockCompiler: false);
+  ClosedWorld closedWorld = env.closedWorld;
+
+  ClassElement Object_ = env.getElement("Object");
+  ClassElement A = env.getElement("A");
+  ClassElement B = env.getElement("B");
+  ClassElement C = env.getElement("C");
+  ClassElement D = env.getElement("D");
+  ClassElement F = env.getElement("F");
+  ClassElement G = env.getElement("G");
+  ClassElement H = env.getElement("H");
+  ClassElement I = env.getElement("I");
+  ClassElement J = env.getElement("J");
+
+  void check(ClassElement cls1, ClassQuery query1, ClassElement cls2,
+      ClassQuery query2, List<ClassElement> expectedResult) {
+    Iterable<ClassElement> result1 =
+        closedWorld.commonSubclasses(cls1, query1, cls2, query2);
+    Iterable<ClassElement> result2 =
+        closedWorld.commonSubclasses(cls2, query2, cls1, query1);
+    Expect.setEquals(
+        result1,
+        result2,
+        "Asymmetric results for ($cls1,$query1) vs ($cls2,$query2):"
+        "\n a vs b: $result1\n b vs a: $result2");
+    Expect.setEquals(
+        expectedResult,
+        result1,
+        "Unexpected results for ($cls1,$query1) vs ($cls2,$query2):"
+        "\n expected: $expectedResult\n actual: $result1");
+  }
+
+  check(A, ClassQuery.EXACT, A, ClassQuery.EXACT, []);
+  check(A, ClassQuery.EXACT, A, ClassQuery.SUBCLASS, []);
+  check(A, ClassQuery.EXACT, A, ClassQuery.SUBTYPE, []);
+  check(A, ClassQuery.SUBCLASS, A, ClassQuery.SUBCLASS, [C]);
+  check(A, ClassQuery.SUBCLASS, A, ClassQuery.SUBTYPE, [C]);
+  check(A, ClassQuery.SUBTYPE, A, ClassQuery.SUBTYPE, [C, D]);
+
+  check(A, ClassQuery.EXACT, B, ClassQuery.EXACT, []);
+  check(A, ClassQuery.EXACT, B, ClassQuery.SUBCLASS, []);
+  check(A, ClassQuery.SUBCLASS, B, ClassQuery.EXACT, []);
+  check(A, ClassQuery.EXACT, B, ClassQuery.SUBTYPE, []);
+  check(A, ClassQuery.SUBTYPE, B, ClassQuery.EXACT, []);
+  check(A, ClassQuery.SUBCLASS, B, ClassQuery.SUBCLASS, []);
+  check(A, ClassQuery.SUBCLASS, B, ClassQuery.SUBTYPE, [G]);
+  check(A, ClassQuery.SUBTYPE, B, ClassQuery.SUBCLASS, [J]);
+  check(A, ClassQuery.SUBTYPE, B, ClassQuery.SUBTYPE, [F, G, I, J]);
+
+  check(A, ClassQuery.EXACT, C, ClassQuery.EXACT, []);
+  check(A, ClassQuery.EXACT, C, ClassQuery.SUBCLASS, []);
+  check(A, ClassQuery.SUBCLASS, C, ClassQuery.EXACT, []);
+  check(A, ClassQuery.EXACT, C, ClassQuery.SUBTYPE, []);
+  check(A, ClassQuery.SUBTYPE, C, ClassQuery.EXACT, []);
+  check(A, ClassQuery.SUBCLASS, C, ClassQuery.SUBCLASS, [G]);
+  check(A, ClassQuery.SUBCLASS, C, ClassQuery.SUBTYPE, [G]);
+  check(A, ClassQuery.SUBTYPE, C, ClassQuery.SUBCLASS, [G]);
+  check(A, ClassQuery.SUBTYPE, C, ClassQuery.SUBTYPE, [F, G, H]);
+
+  check(B, ClassQuery.EXACT, C, ClassQuery.EXACT, []);
+  check(B, ClassQuery.EXACT, C, ClassQuery.SUBCLASS, []);
+  check(B, ClassQuery.SUBCLASS, C, ClassQuery.EXACT, []);
+  check(B, ClassQuery.EXACT, C, ClassQuery.SUBTYPE, []);
+  check(B, ClassQuery.SUBTYPE, C, ClassQuery.EXACT, []);
+  check(B, ClassQuery.SUBCLASS, C, ClassQuery.SUBCLASS, []);
+  check(B, ClassQuery.SUBCLASS, C, ClassQuery.SUBTYPE, []);
+  check(B, ClassQuery.SUBTYPE, C, ClassQuery.SUBCLASS, [G]);
+  check(B, ClassQuery.SUBTYPE, C, ClassQuery.SUBTYPE, [F, G]);
+}
diff --git a/tests/compiler/dart2js_extra/mirror_printer_test.dart b/tests/compiler/dart2js_extra/mirror_printer_test.dart
index bc40d4d..8d6c129 100644
--- a/tests/compiler/dart2js_extra/mirror_printer_test.dart
+++ b/tests/compiler/dart2js_extra/mirror_printer_test.dart
@@ -20,7 +20,7 @@
 import 'crash_library_metadata.dart'; // This would crash dart2js.
 
 // Importing dart:html to make things interesting.
-import 'dart:html';
+import 'dart:html'; /// 01: ok
 
 class MirrorPrinter {
   final StringBuffer buffer;
@@ -185,5 +185,5 @@
   print(MirrorPrinter.stringify(currentMirrorSystem().libraries));
   // Clear the nodes to avoid confusing the fine test framework (by "fine" I
   // mean something else) -- ahe.
-  document.body.nodes.clear();
+  document.body.nodes.clear(); /// 01: continued
 }
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index 48cfb52..f64a564 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -14,7 +14,7 @@
 string_from_environment3_test: Skip
 string_from_environment_test: Skip
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) ]
+[ $compiler == none || $compiler == precompiler || $compiler == app_jit ]
 unicode_test: Fail        # Bug 6706
 compare_to2_test: Fail    # Bug 4018
 
@@ -30,7 +30,7 @@
 string_case_test/01: Fail # Bug 18061
 
 # #void should be a valid symbol.
-[ $compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit || $compiler == dart2js ]
+[ $compiler == none || $compiler == precompiler || $compiler == app_jit || $compiler == dart2js ]
 symbol_reserved_word_test/02: CompileTimeError # bug 20191
 symbol_reserved_word_test/05: CompileTimeError # bug 20191
 
@@ -61,7 +61,7 @@
 [ $compiler == dart2js && $fast_startup ]
 apply3_test: Fail # mirrors not supported
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $runtime != dartium && $runtime != drt ]
+[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $runtime != dartium && $runtime != drt ]
 symbol_test/02: MissingCompileTimeError # bug 11669
 symbol_test/03: MissingCompileTimeError # bug 11669
 
@@ -122,6 +122,8 @@
 
 [ $compiler == dart2js && ($runtime == ff || $runtime == jsshell) ]
 string_case_test/01: Fail, OK  # Bug in Firefox.
+list_test/none: Fail # Issue 28014
+list_test/01: Fail # Issue 28014
 
 [ $compiler == dart2js && $runtime == dartium ]
 string_case_test/02: Fail, OK  # Bug in dartium version of V8.
@@ -156,10 +158,11 @@
 # The regexp tests are not verified to work on non d8/vm platforms yet.
 regexp/*: Skip
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 regexp/global_test: Skip # Timeout. Issue 21709 and 21708
+regexp/pcre_test: Pass, Slow, Timeout # Issues 21593 and 22008
 
-[ $runtime != vm && $runtime != dart_precompiled && $runtime != dart_app && $compiler != dart2analyzer]
+[ $runtime != vm && $runtime != dart_precompiled && $compiler != dart2analyzer]
 data_resource_test: RuntimeError # Issue 23825 (not implemented yet).
 file_resource_test: Skip, OK # VM specific test, uses dart:io.
 http_resource_test: Skip, OK # VM specific test, uses dart:io.
@@ -170,7 +173,7 @@
 [ $mode == debug ]
 regexp/pcre_test: Pass, Slow # Timeout. Issue 22008
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $arch == simarmv5te ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $arch == simarmv5te ]
 int_parse_radix_test/*: Pass, Slow
 big_integer_parsed_mul_div_vm_test: Pass, Slow
 
@@ -185,21 +188,20 @@
 regexp/pcre_test: Crash # Stack Overflow
 collection_removes_test: Crash # Issue 25911
 
-[ $noopt || $compiler == precompiler ]
+[ $compiler == precompiler || $mode == product ]
+apply3_test: SkipByDesign # Imports dart:mirrors
+
+[ $compiler == precompiler ]
 # Stacktraces in precompilation omit inlined frames.
 stacktrace_current_test: Pass, RuntimeError
 error_stack_trace1_test: Pass, RuntimeError
 
-[ $noopt || $compiler == precompiler || $mode == product ]
-apply3_test: SkipByDesign # Imports dart:mirrors
-
-[ $noopt || $compiler == precompiler ]
 regexp/stack-overflow_test: RuntimeError, OK # Smaller limit with irregex interpreter
 big_integer_huge_mul_vm_test: Pass, Timeout # --no_intrinsify
 big_integer_parsed_mul_div_vm_test: Pass, Timeout # --no_intrinsify
 int_parse_radix_test: Pass, Timeout # --no_intrinsify
 
-[ $compiler == precompiler || $runtime == dart_app ]
+[ $compiler == precompiler || $compiler == app_jit ]
 data_resource_test: Skip # Resolve URI not supported yet in product mode.
 package_resource_test: Skip # Resolve URI not supported yet in product mode.
 file_resource_test: Skip # Resolve URI not supported yet in product mode.
diff --git a/tests/corelib/iterable_generate_test.dart b/tests/corelib/iterable_generate_test.dart
index 170dba9..abcae06 100644
--- a/tests/corelib/iterable_generate_test.dart
+++ b/tests/corelib/iterable_generate_test.dart
@@ -59,7 +59,12 @@
 
   // Invalid types:
   Expect.throws(() => new Iterable<String>.generate(5));
-  Expect.throws(() => new Iterable<Null>.generate(5));
+  if (checkedMode) {                                                  /// 01: ok
+    Expect.throws(() => new Iterable<Null>.generate(5).elementAt(2)); /// 01: continued
+  } else {                                                            /// 01: continued
+    Iterable<dynamic> iter5 = new Iterable<Null>.generate(5);         /// 01: continued
+    Expect.equals(2, iter5.elementAt(2));                             /// 01: continued
+  }                                                                   /// 01: continued
   Expect.throws(() => new Iterable<bool>.generate(5));
 
   // Regression: https://github.com/dart-lang/sdk/issues/26358
diff --git a/tests/corelib/uri_test.dart b/tests/corelib/uri_test.dart
index 9e4b24f..bcd0976 100644
--- a/tests/corelib/uri_test.dart
+++ b/tests/corelib/uri_test.dart
@@ -755,6 +755,25 @@
   Expect.equals("s://:1/b/c?d#e", uri.replace(host: "").toString());
 }
 
+void testRegression28359() {
+  var uri = new Uri(path: "//");
+  // This is an invalid path for a URI reference with no authority
+  // since it looks like an authority.
+  // Normalized to have an authority.
+  Expect.equals("////", "$uri");
+  Expect.equals("//", uri.path);
+  Expect.isTrue(uri.hasAuthority, "$uri has authority");
+
+  uri = new Uri(path: "file:///wat");
+  // This is an invalid path for a URI reference with no authority or scheme
+  // since the path looks like it starts with a scheme.
+  // Normalized by escaping the ":".
+  Expect.equals("file%3A///wat", uri.path);
+  Expect.equals("file%3A///wat", "$uri");
+  Expect.isFalse(uri.hasAuthority);
+  Expect.isFalse(uri.hasScheme);
+}
+
 main() {
   testUri("http:", true);
   testUri("file:///", true);
@@ -816,7 +835,7 @@
   Expect.throws(
       () => Uri.parse("http:").origin,
       (e) { return e is StateError; },
-      "origin for uri with empty host should fail");
+      "origin for URI with empty host should fail");
   Expect.throws(
       () => new Uri(
           scheme: "http",
@@ -827,7 +846,7 @@
           query: "query",
           fragment: "fragment").origin,
       (e) { return e is StateError; },
-      "origin for uri with empty host should fail");
+      "origin for URI with empty host should fail");
   Expect.throws(
       () => new Uri(
           scheme: null,
@@ -838,7 +857,7 @@
           query: "query",
           fragment: "fragment").origin,
       (e) { return e is StateError; },
-      "origin for uri with empty scheme should fail");
+      "origin for URI with empty scheme should fail");
   Expect.throws(
       () => new Uri(
           scheme: "http",
@@ -849,11 +868,11 @@
           query: "query",
           fragment: "fragment").origin,
       (e) { return e is StateError; },
-      "origin for uri with empty host should fail");
+      "origin for URI with empty host should fail");
   Expect.throws(
       () => Uri.parse("http://:80").origin,
       (e) { return e is StateError; },
-      "origin for uri with empty host should fail");
+      "origin for URI with empty host should fail");
   Expect.throws(
       () => Uri.parse("file://localhost/test.txt").origin,
       (e) { return e is StateError; },
@@ -921,6 +940,7 @@
   testInvalidUrls();
   testNormalization();
   testReplace();
+  testRegression28359();
 }
 
 String dump(Uri uri) {
diff --git a/pkg/dev_compiler/test/codegen/corelib/apply2_test.dart b/tests/corelib_strong/apply2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/apply2_test.dart
rename to tests/corelib_strong/apply2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/apply3_test.dart b/tests/corelib_strong/apply3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/apply3_test.dart
rename to tests/corelib_strong/apply3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/apply4_test.dart b/tests/corelib_strong/apply4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/apply4_test.dart
rename to tests/corelib_strong/apply4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/apply_test.dart b/tests/corelib_strong/apply_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/apply_test.dart
rename to tests/corelib_strong/apply_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/big_integer_arith_vm_test.dart b/tests/corelib_strong/big_integer_arith_vm_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/big_integer_arith_vm_test.dart
rename to tests/corelib_strong/big_integer_arith_vm_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/big_integer_huge_mul_vm_test.dart b/tests/corelib_strong/big_integer_huge_mul_vm_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/big_integer_huge_mul_vm_test.dart
rename to tests/corelib_strong/big_integer_huge_mul_vm_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/big_integer_parsed_arith_vm_test.dart b/tests/corelib_strong/big_integer_parsed_arith_vm_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/big_integer_parsed_arith_vm_test.dart
rename to tests/corelib_strong/big_integer_parsed_arith_vm_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/big_integer_parsed_div_rem_vm_test.dart b/tests/corelib_strong/big_integer_parsed_div_rem_vm_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/big_integer_parsed_div_rem_vm_test.dart
rename to tests/corelib_strong/big_integer_parsed_div_rem_vm_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/big_integer_parsed_mul_div_vm_test.dart b/tests/corelib_strong/big_integer_parsed_mul_div_vm_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/big_integer_parsed_mul_div_vm_test.dart
rename to tests/corelib_strong/big_integer_parsed_mul_div_vm_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/bit_twiddling_bigint_test.dart b/tests/corelib_strong/bit_twiddling_bigint_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/bit_twiddling_bigint_test.dart
rename to tests/corelib_strong/bit_twiddling_bigint_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/bit_twiddling_test.dart b/tests/corelib_strong/bit_twiddling_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/bit_twiddling_test.dart
rename to tests/corelib_strong/bit_twiddling_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/bool_from_environment2_test.dart b/tests/corelib_strong/bool_from_environment2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/bool_from_environment2_test.dart
rename to tests/corelib_strong/bool_from_environment2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/bool_from_environment_test.dart b/tests/corelib_strong/bool_from_environment_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/bool_from_environment_test.dart
rename to tests/corelib_strong/bool_from_environment_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/bool_hashcode_test.dart b/tests/corelib_strong/bool_hashcode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/bool_hashcode_test.dart
rename to tests/corelib_strong/bool_hashcode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/collection_from_test.dart b/tests/corelib_strong/collection_from_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/collection_from_test.dart
rename to tests/corelib_strong/collection_from_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/collection_length_test.dart b/tests/corelib_strong/collection_length_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/collection_length_test.dart
rename to tests/corelib_strong/collection_length_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/collection_removes_test.dart b/tests/corelib_strong/collection_removes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/collection_removes_test.dart
rename to tests/corelib_strong/collection_removes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/collection_test.dart b/tests/corelib_strong/collection_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/collection_test.dart
rename to tests/corelib_strong/collection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/collection_to_string_test.dart b/tests/corelib_strong/collection_to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/collection_to_string_test.dart
rename to tests/corelib_strong/collection_to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/compare_to2_test.dart b/tests/corelib_strong/compare_to2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/compare_to2_test.dart
rename to tests/corelib_strong/compare_to2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/compare_to_test.dart b/tests/corelib_strong/compare_to_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/compare_to_test.dart
rename to tests/corelib_strong/compare_to_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/const_list_literal_test.dart b/tests/corelib_strong/const_list_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/const_list_literal_test.dart
rename to tests/corelib_strong/const_list_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/const_list_remove_range_test.dart b/tests/corelib_strong/const_list_remove_range_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/const_list_remove_range_test.dart
rename to tests/corelib_strong/const_list_remove_range_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/const_list_set_range_test.dart b/tests/corelib_strong/const_list_set_range_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/const_list_set_range_test.dart
rename to tests/corelib_strong/const_list_set_range_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/core_runtime_types_test.dart b/tests/corelib_strong/core_runtime_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/core_runtime_types_test.dart
rename to tests/corelib_strong/core_runtime_types_test.dart
diff --git a/tests/corelib_strong/corelib_strong.status b/tests/corelib_strong/corelib_strong.status
new file mode 100644
index 0000000..fb98cba
--- /dev/null
+++ b/tests/corelib_strong/corelib_strong.status
@@ -0,0 +1,56 @@
+# Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# Skip entire suite if not running in strong mode.
+[ $strong == false ]
+*: SkipByDesign
+
+# Skip tests that are not yet strong-mode clean.
+[ $strong == true ]
+big_integer_arith_vm_test: Skip
+bool_from_environment2_test: Skip
+core_runtime_types_test: Skip
+data_resource_test: Skip
+duration2_test: Skip
+error_stack_trace_test: Skip
+file_resource_test: Skip
+from_environment_const_type_test: Skip
+from_environment_const_type_undefined_test: Skip
+growable_list_test: Skip
+hash_set_type_check_test: Skip
+http_resource_test: Skip
+int_from_environment3_test: Skip
+iterable_contains2_test: Skip
+iterable_element_at_test: Skip
+iterable_fold_test: Skip
+iterable_mapping_test: Skip
+iterable_reduce_test: Skip
+iterable_to_list_test: Skip
+iterable_to_set_test: Skip
+linked_hash_map_from_iterable_test: Skip
+list_contains_argument_order_test: Skip
+list_filled_type_argument_test: Skip
+list_index_of2_test: Skip
+list_test: Skip
+list_unmodifiable_test: Skip
+map_test: Skip
+num_clamp_test: Skip
+package_resource_test: Skip
+print_test: Skip
+queue_test: Skip
+regexp/global_test: Skip
+regexp/regexp_test: Skip
+regexp/regress-regexp-codeflush_test: Skip
+regexp/standalones_test: Skip
+splay_tree_test: Skip
+string_base_vm_test: Skip
+string_from_environment3_test: Skip
+string_from_list_test: Skip
+string_replace_test: Skip
+string_test: Skip
+symbol_operator_test: Skip
+symbol_reserved_word_test: Skip
+symbol_test: Skip
+uri_path_test: Skip
+uri_query_test: Skip
diff --git a/tests/corelib_strong/corelib_strong_kernel.status b/tests/corelib_strong/corelib_strong_kernel.status
new file mode 100644
index 0000000..8b36750
--- /dev/null
+++ b/tests/corelib_strong/corelib_strong_kernel.status
@@ -0,0 +1,37 @@
+# Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+[ $compiler == dartk && $runtime == vm ]
+apply3_test: DartkCompileTimeError
+bool_from_environment_test: RuntimeError
+compare_to2_test: RuntimeError
+const_list_remove_range_test: DartkCompileTimeError
+const_list_set_range_test: DartkCompileTimeError
+hash_map2_test: Crash # VM does not support BottomType
+int_from_environment_test: RuntimeError
+iterable_return_type_test/01: RuntimeError
+iterable_return_type_test/02: RuntimeError
+iterable_return_type_test/none: RuntimeError
+iterable_skip_test: DartkCompileTimeError
+iterable_skip_while_test: DartkCompileTimeError
+iterable_take_test: DartkCompileTimeError
+iterable_take_while_test: DartkCompileTimeError
+list_fill_range_test: DartkCompileTimeError
+list_get_range_test: DartkCompileTimeError
+list_insert_all_test: DartkCompileTimeError
+list_map_test: DartkCompileTimeError
+list_remove_range_test: DartkCompileTimeError
+list_replace_range_test: DartkCompileTimeError
+list_set_all_test: DartkCompileTimeError
+list_set_range_test: DartkCompileTimeError
+list_sublist_test: DartkCompileTimeError
+map_keys2_test: RuntimeError
+set_test: DartkCompileTimeError
+shuffle_test: DartkCompileTimeError
+sort_test: DartkCompileTimeError
+splay_tree_from_iterable_test: DartkCompileTimeError
+string_case_test/01: RuntimeError
+string_from_environment2_test: RuntimeError
+string_from_environment_test: RuntimeError
+unicode_test: RuntimeError
diff --git a/pkg/dev_compiler/test/codegen/corelib/data_resource_test.dart b/tests/corelib_strong/data_resource_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/data_resource_test.dart
rename to tests/corelib_strong/data_resource_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/data_uri_test.dart b/tests/corelib_strong/data_uri_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/data_uri_test.dart
rename to tests/corelib_strong/data_uri_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time2_test.dart b/tests/corelib_strong/date_time2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time2_test.dart
rename to tests/corelib_strong/date_time2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time3_test.dart b/tests/corelib_strong/date_time3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time3_test.dart
rename to tests/corelib_strong/date_time3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time4_test.dart b/tests/corelib_strong/date_time4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time4_test.dart
rename to tests/corelib_strong/date_time4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time5_test.dart b/tests/corelib_strong/date_time5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time5_test.dart
rename to tests/corelib_strong/date_time5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time6_test.dart b/tests/corelib_strong/date_time6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time6_test.dart
rename to tests/corelib_strong/date_time6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time7_test.dart b/tests/corelib_strong/date_time7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time7_test.dart
rename to tests/corelib_strong/date_time7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time8_test.dart b/tests/corelib_strong/date_time8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time8_test.dart
rename to tests/corelib_strong/date_time8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time9_test.dart b/tests/corelib_strong/date_time9_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time9_test.dart
rename to tests/corelib_strong/date_time9_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time_parse_test.dart b/tests/corelib_strong/date_time_parse_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time_parse_test.dart
rename to tests/corelib_strong/date_time_parse_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/date_time_test.dart b/tests/corelib_strong/date_time_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/date_time_test.dart
rename to tests/corelib_strong/date_time_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_ceil2_test.dart b/tests/corelib_strong/double_ceil2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_ceil2_test.dart
rename to tests/corelib_strong/double_ceil2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_ceil_test.dart b/tests/corelib_strong/double_ceil_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_ceil_test.dart
rename to tests/corelib_strong/double_ceil_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_ceil_to_double_test.dart b/tests/corelib_strong/double_ceil_to_double_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_ceil_to_double_test.dart
rename to tests/corelib_strong/double_ceil_to_double_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_compare_test.dart b/tests/corelib_strong/double_compare_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_compare_test.dart
rename to tests/corelib_strong/double_compare_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_floor2_test.dart b/tests/corelib_strong/double_floor2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_floor2_test.dart
rename to tests/corelib_strong/double_floor2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_floor_test.dart b/tests/corelib_strong/double_floor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_floor_test.dart
rename to tests/corelib_strong/double_floor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_floor_to_double_test.dart b/tests/corelib_strong/double_floor_to_double_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_floor_to_double_test.dart
rename to tests/corelib_strong/double_floor_to_double_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_parse_test.dart b/tests/corelib_strong/double_parse_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_parse_test.dart
rename to tests/corelib_strong/double_parse_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_round2_test.dart b/tests/corelib_strong/double_round2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_round2_test.dart
rename to tests/corelib_strong/double_round2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_round3_test.dart b/tests/corelib_strong/double_round3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_round3_test.dart
rename to tests/corelib_strong/double_round3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_round4_test.dart b/tests/corelib_strong/double_round4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_round4_test.dart
rename to tests/corelib_strong/double_round4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_round_test.dart b/tests/corelib_strong/double_round_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_round_test.dart
rename to tests/corelib_strong/double_round_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_round_to_double2_test.dart b/tests/corelib_strong/double_round_to_double2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_round_to_double2_test.dart
rename to tests/corelib_strong/double_round_to_double2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_round_to_double3_test.dart b/tests/corelib_strong/double_round_to_double3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_round_to_double3_test.dart
rename to tests/corelib_strong/double_round_to_double3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_round_to_double_test.dart b/tests/corelib_strong/double_round_to_double_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_round_to_double_test.dart
rename to tests/corelib_strong/double_round_to_double_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_truncate2_test.dart b/tests/corelib_strong/double_truncate2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_truncate2_test.dart
rename to tests/corelib_strong/double_truncate2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_truncate_test.dart b/tests/corelib_strong/double_truncate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_truncate_test.dart
rename to tests/corelib_strong/double_truncate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/double_truncate_to_double_test.dart b/tests/corelib_strong/double_truncate_to_double_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/double_truncate_to_double_test.dart
rename to tests/corelib_strong/double_truncate_to_double_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/duration2_test.dart b/tests/corelib_strong/duration2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/duration2_test.dart
rename to tests/corelib_strong/duration2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/duration_big_num_test.dart b/tests/corelib_strong/duration_big_num_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/duration_big_num_test.dart
rename to tests/corelib_strong/duration_big_num_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/duration_double_multiplication_test.dart b/tests/corelib_strong/duration_double_multiplication_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/duration_double_multiplication_test.dart
rename to tests/corelib_strong/duration_double_multiplication_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/duration_test.dart b/tests/corelib_strong/duration_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/duration_test.dart
rename to tests/corelib_strong/duration_test.dart
diff --git a/tests/corelib_strong/dynamic_nosuchmethod_test.dart b/tests/corelib_strong/dynamic_nosuchmethod_test.dart
new file mode 100644
index 0000000..03c0a80
--- /dev/null
+++ b/tests/corelib_strong/dynamic_nosuchmethod_test.dart
@@ -0,0 +1,77 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import 'dart:mirrors';
+
+// Test that noSuchMethod calls behave as expected for dynamic object invocations.
+class BaseClass {
+  final dynamic finalField = "final!";
+
+  baz() => "baz!!";
+  get bla => (() => "bla!!");
+}
+
+class ReturnInvocationName extends BaseClass {
+  var _bar;
+
+  ReturnInvocationName(this._bar);
+
+  noSuchMethod(Invocation invocation) {
+    return MirrorSystem.getName(invocation.memberName);
+  }
+
+  bar() {
+    return _bar;
+  }
+}
+
+class Foo {}
+
+main() {
+  dynamic x = new ReturnInvocationName(42);
+  Expect.equals('final!', x.finalField);
+
+  // https://github.com/dart-lang/sdk/issues/28363
+  // Expect.throws(() => x.finalField = "foo",
+  //              (e) => e is NoSuchMethodError);
+  Expect.equals('final!', x.finalField);
+
+  Expect.equals('_prototype', x._prototype);
+  Expect.equals('_prototype', x._prototype());
+
+  Expect.equals('prototype', x.prototype);
+  Expect.equals('prototype', x.prototype());
+
+  Expect.equals('constructor', x.constructor);
+  Expect.equals('constructor', x.constructor());
+
+  Expect.equals('__proto__', x.__proto__);
+  Expect.equals('__proto__', x.__proto__);
+
+  Expect.equals(42, x.bar());
+  Expect.equals(42, (x.bar)());
+
+  Expect.equals('unary-', -x);
+  Expect.equals('+', x + 42);
+  Expect.equals('[]', x[4]);
+
+  // Verify that noSuchMethod errors are triggered even when the JS object
+  // happens to have a matching member name.
+  dynamic f = new Foo();
+  Expect.throws(() => f.prototype, (e) => e is NoSuchMethodError);
+  Expect.throws(() => f.prototype(), (e) => e is NoSuchMethodError);
+  Expect.throws(() => f.prototype = 42, (e) => e is NoSuchMethodError);
+
+  Expect.throws(() => f.constructor, (e) => e is NoSuchMethodError);
+  Expect.throws(() => f.constructor(), (e) => e is NoSuchMethodError);
+  Expect.throws(() => f.constructor = 42, (e) => e is NoSuchMethodError);
+
+  Expect.throws(() => f.__proto__, (e) => e is NoSuchMethodError);
+
+  // These are valid JS properties but not Dart methods.
+  Expect.throws(() => f.toLocaleString, (e) => e is NoSuchMethodError);
+
+  Expect.throws(() => f.hasOwnProperty, (e) => e is NoSuchMethodError);
+}
diff --git a/pkg/dev_compiler/test/codegen/corelib/error_stack_trace1_test.dart b/tests/corelib_strong/error_stack_trace1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/error_stack_trace1_test.dart
rename to tests/corelib_strong/error_stack_trace1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/error_stack_trace2_test.dart b/tests/corelib_strong/error_stack_trace2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/error_stack_trace2_test.dart
rename to tests/corelib_strong/error_stack_trace2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/error_stack_trace_test.dart b/tests/corelib_strong/error_stack_trace_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/error_stack_trace_test.dart
rename to tests/corelib_strong/error_stack_trace_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/errors_test.dart b/tests/corelib_strong/errors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/errors_test.dart
rename to tests/corelib_strong/errors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/exception_implementation_test.dart b/tests/corelib_strong/exception_implementation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/exception_implementation_test.dart
rename to tests/corelib_strong/exception_implementation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/expando_test.dart b/tests/corelib_strong/expando_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/expando_test.dart
rename to tests/corelib_strong/expando_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/expression_test.dart b/tests/corelib_strong/expression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/expression_test.dart
rename to tests/corelib_strong/expression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/file_resource_test.dart b/tests/corelib_strong/file_resource_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/file_resource_test.dart
rename to tests/corelib_strong/file_resource_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/for_in_test.dart b/tests/corelib_strong/for_in_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/for_in_test.dart
rename to tests/corelib_strong/for_in_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/format_exception_test.dart b/tests/corelib_strong/format_exception_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/format_exception_test.dart
rename to tests/corelib_strong/format_exception_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/from_environment_const_type_test.dart b/tests/corelib_strong/from_environment_const_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/from_environment_const_type_test.dart
rename to tests/corelib_strong/from_environment_const_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/from_environment_const_type_undefined_test.dart b/tests/corelib_strong/from_environment_const_type_undefined_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/from_environment_const_type_undefined_test.dart
rename to tests/corelib_strong/from_environment_const_type_undefined_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/growable_list_test.dart b/tests/corelib_strong/growable_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/growable_list_test.dart
rename to tests/corelib_strong/growable_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/has_next_iterator_test.dart b/tests/corelib_strong/has_next_iterator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/has_next_iterator_test.dart
rename to tests/corelib_strong/has_next_iterator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/hash_map2_test.dart b/tests/corelib_strong/hash_map2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/hash_map2_test.dart
rename to tests/corelib_strong/hash_map2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/hash_map_test.dart b/tests/corelib_strong/hash_map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/hash_map_test.dart
rename to tests/corelib_strong/hash_map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/hash_set_test.dart b/tests/corelib_strong/hash_set_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/hash_set_test.dart
rename to tests/corelib_strong/hash_set_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/hash_set_type_check_test.dart b/tests/corelib_strong/hash_set_type_check_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/hash_set_type_check_test.dart
rename to tests/corelib_strong/hash_set_type_check_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/hashcode_boxed_test.dart b/tests/corelib_strong/hashcode_boxed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/hashcode_boxed_test.dart
rename to tests/corelib_strong/hashcode_boxed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/hashcode_test.dart b/tests/corelib_strong/hashcode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/hashcode_test.dart
rename to tests/corelib_strong/hashcode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/hidden_library2_test.dart b/tests/corelib_strong/hidden_library2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/hidden_library2_test.dart
rename to tests/corelib_strong/hidden_library2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/http_resource_test.dart b/tests/corelib_strong/http_resource_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/http_resource_test.dart
rename to tests/corelib_strong/http_resource_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/indexed_list_access_test.dart b/tests/corelib_strong/indexed_list_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/indexed_list_access_test.dart
rename to tests/corelib_strong/indexed_list_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_ceil_test.dart b/tests/corelib_strong/int_ceil_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_ceil_test.dart
rename to tests/corelib_strong/int_ceil_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_ceil_to_double_test.dart b/tests/corelib_strong/int_ceil_to_double_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_ceil_to_double_test.dart
rename to tests/corelib_strong/int_ceil_to_double_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_floor_test.dart b/tests/corelib_strong/int_floor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_floor_test.dart
rename to tests/corelib_strong/int_floor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_floor_to_double_test.dart b/tests/corelib_strong/int_floor_to_double_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_floor_to_double_test.dart
rename to tests/corelib_strong/int_floor_to_double_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_from_environment2_test.dart b/tests/corelib_strong/int_from_environment2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_from_environment2_test.dart
rename to tests/corelib_strong/int_from_environment2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_from_environment3_test.dart b/tests/corelib_strong/int_from_environment3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_from_environment3_test.dart
rename to tests/corelib_strong/int_from_environment3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_from_environment_test.dart b/tests/corelib_strong/int_from_environment_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_from_environment_test.dart
rename to tests/corelib_strong/int_from_environment_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_modulo_arith_test.dart b/tests/corelib_strong/int_modulo_arith_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_modulo_arith_test.dart
rename to tests/corelib_strong/int_modulo_arith_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_parse_radix_test.dart b/tests/corelib_strong/int_parse_radix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_parse_radix_test.dart
rename to tests/corelib_strong/int_parse_radix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_round_test.dart b/tests/corelib_strong/int_round_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_round_test.dart
rename to tests/corelib_strong/int_round_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_round_to_double_test.dart b/tests/corelib_strong/int_round_to_double_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_round_to_double_test.dart
rename to tests/corelib_strong/int_round_to_double_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_to_int_test.dart b/tests/corelib_strong/int_to_int_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_to_int_test.dart
rename to tests/corelib_strong/int_to_int_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_truncate_test.dart b/tests/corelib_strong/int_truncate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_truncate_test.dart
rename to tests/corelib_strong/int_truncate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/int_truncate_to_double_test.dart b/tests/corelib_strong/int_truncate_to_double_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/int_truncate_to_double_test.dart
rename to tests/corelib_strong/int_truncate_to_double_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/integer_to_radix_string_test.dart b/tests/corelib_strong/integer_to_radix_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/integer_to_radix_string_test.dart
rename to tests/corelib_strong/integer_to_radix_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/integer_to_string_test.dart b/tests/corelib_strong/integer_to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/integer_to_string_test.dart
rename to tests/corelib_strong/integer_to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/is_operator_basic_types_test.dart b/tests/corelib_strong/is_operator_basic_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/is_operator_basic_types_test.dart
rename to tests/corelib_strong/is_operator_basic_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_contains2_test.dart b/tests/corelib_strong/iterable_contains2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_contains2_test.dart
rename to tests/corelib_strong/iterable_contains2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_contains_test.dart b/tests/corelib_strong/iterable_contains_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_contains_test.dart
rename to tests/corelib_strong/iterable_contains_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_element_at_test.dart b/tests/corelib_strong/iterable_element_at_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_element_at_test.dart
rename to tests/corelib_strong/iterable_element_at_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_empty_test.dart b/tests/corelib_strong/iterable_empty_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_empty_test.dart
rename to tests/corelib_strong/iterable_empty_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_expand_test.dart b/tests/corelib_strong/iterable_expand_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_expand_test.dart
rename to tests/corelib_strong/iterable_expand_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_first_test.dart b/tests/corelib_strong/iterable_first_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_first_test.dart
rename to tests/corelib_strong/iterable_first_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_first_where_test.dart b/tests/corelib_strong/iterable_first_where_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_first_where_test.dart
rename to tests/corelib_strong/iterable_first_where_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_fold_test.dart b/tests/corelib_strong/iterable_fold_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_fold_test.dart
rename to tests/corelib_strong/iterable_fold_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_generate_test.dart b/tests/corelib_strong/iterable_generate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_generate_test.dart
rename to tests/corelib_strong/iterable_generate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_join_test.dart b/tests/corelib_strong/iterable_join_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_join_test.dart
rename to tests/corelib_strong/iterable_join_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_last_test.dart b/tests/corelib_strong/iterable_last_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_last_test.dart
rename to tests/corelib_strong/iterable_last_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_last_where_test.dart b/tests/corelib_strong/iterable_last_where_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_last_where_test.dart
rename to tests/corelib_strong/iterable_last_where_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_length_test.dart b/tests/corelib_strong/iterable_length_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_length_test.dart
rename to tests/corelib_strong/iterable_length_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_mapping_test.dart b/tests/corelib_strong/iterable_mapping_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_mapping_test.dart
rename to tests/corelib_strong/iterable_mapping_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_reduce_test.dart b/tests/corelib_strong/iterable_reduce_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_reduce_test.dart
rename to tests/corelib_strong/iterable_reduce_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_return_type_test.dart b/tests/corelib_strong/iterable_return_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_return_type_test.dart
rename to tests/corelib_strong/iterable_return_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_single_test.dart b/tests/corelib_strong/iterable_single_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_single_test.dart
rename to tests/corelib_strong/iterable_single_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_single_where_test.dart b/tests/corelib_strong/iterable_single_where_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_single_where_test.dart
rename to tests/corelib_strong/iterable_single_where_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_skip_test.dart b/tests/corelib_strong/iterable_skip_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_skip_test.dart
rename to tests/corelib_strong/iterable_skip_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_skip_while_test.dart b/tests/corelib_strong/iterable_skip_while_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_skip_while_test.dart
rename to tests/corelib_strong/iterable_skip_while_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_take_test.dart b/tests/corelib_strong/iterable_take_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_take_test.dart
rename to tests/corelib_strong/iterable_take_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_take_while_test.dart b/tests/corelib_strong/iterable_take_while_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_take_while_test.dart
rename to tests/corelib_strong/iterable_take_while_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_test.dart b/tests/corelib_strong/iterable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_test.dart
rename to tests/corelib_strong/iterable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_to_list_test.dart b/tests/corelib_strong/iterable_to_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_to_list_test.dart
rename to tests/corelib_strong/iterable_to_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_to_set_test.dart b/tests/corelib_strong/iterable_to_set_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_to_set_test.dart
rename to tests/corelib_strong/iterable_to_set_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/iterable_tostring_test.dart b/tests/corelib_strong/iterable_tostring_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/iterable_tostring_test.dart
rename to tests/corelib_strong/iterable_tostring_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/json_map_test.dart b/tests/corelib_strong/json_map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/json_map_test.dart
rename to tests/corelib_strong/json_map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/linked_hash_map_from_iterable_test.dart b/tests/corelib_strong/linked_hash_map_from_iterable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/linked_hash_map_from_iterable_test.dart
rename to tests/corelib_strong/linked_hash_map_from_iterable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/linked_hash_map_from_iterables_test.dart b/tests/corelib_strong/linked_hash_map_from_iterables_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/linked_hash_map_from_iterables_test.dart
rename to tests/corelib_strong/linked_hash_map_from_iterables_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/linked_hash_map_test.dart b/tests/corelib_strong/linked_hash_map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/linked_hash_map_test.dart
rename to tests/corelib_strong/linked_hash_map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_as_map_test.dart b/tests/corelib_strong/list_as_map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_as_map_test.dart
rename to tests/corelib_strong/list_as_map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_contains_argument_order_test.dart b/tests/corelib_strong/list_contains_argument_order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_contains_argument_order_test.dart
rename to tests/corelib_strong/list_contains_argument_order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_fill_range_test.dart b/tests/corelib_strong/list_fill_range_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_fill_range_test.dart
rename to tests/corelib_strong/list_fill_range_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_filled_type_argument_test.dart b/tests/corelib_strong/list_filled_type_argument_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_filled_type_argument_test.dart
rename to tests/corelib_strong/list_filled_type_argument_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_first_test.dart b/tests/corelib_strong/list_first_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_first_test.dart
rename to tests/corelib_strong/list_first_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_fixed_test.dart b/tests/corelib_strong/list_fixed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_fixed_test.dart
rename to tests/corelib_strong/list_fixed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_for_each_test.dart b/tests/corelib_strong/list_for_each_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_for_each_test.dart
rename to tests/corelib_strong/list_for_each_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_get_range_test.dart b/tests/corelib_strong/list_get_range_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_get_range_test.dart
rename to tests/corelib_strong/list_get_range_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_growable_test.dart b/tests/corelib_strong/list_growable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_growable_test.dart
rename to tests/corelib_strong/list_growable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_index_of2_test.dart b/tests/corelib_strong/list_index_of2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_index_of2_test.dart
rename to tests/corelib_strong/list_index_of2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_index_of_test.dart b/tests/corelib_strong/list_index_of_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_index_of_test.dart
rename to tests/corelib_strong/list_index_of_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_insert_all_test.dart b/tests/corelib_strong/list_insert_all_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_insert_all_test.dart
rename to tests/corelib_strong/list_insert_all_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_insert_test.dart b/tests/corelib_strong/list_insert_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_insert_test.dart
rename to tests/corelib_strong/list_insert_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_iterators_test.dart b/tests/corelib_strong/list_iterators_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_iterators_test.dart
rename to tests/corelib_strong/list_iterators_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_last_test.dart b/tests/corelib_strong/list_last_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_last_test.dart
rename to tests/corelib_strong/list_last_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_literal_is_growable_test.dart b/tests/corelib_strong/list_literal_is_growable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_literal_is_growable_test.dart
rename to tests/corelib_strong/list_literal_is_growable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_literal_test.dart b/tests/corelib_strong/list_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_literal_test.dart
rename to tests/corelib_strong/list_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_map_test.dart b/tests/corelib_strong/list_map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_map_test.dart
rename to tests/corelib_strong/list_map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_remove_range_test.dart b/tests/corelib_strong/list_remove_range_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_remove_range_test.dart
rename to tests/corelib_strong/list_remove_range_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_removeat_test.dart b/tests/corelib_strong/list_removeat_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_removeat_test.dart
rename to tests/corelib_strong/list_removeat_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_replace_range_test.dart b/tests/corelib_strong/list_replace_range_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_replace_range_test.dart
rename to tests/corelib_strong/list_replace_range_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_reversed_test.dart b/tests/corelib_strong/list_reversed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_reversed_test.dart
rename to tests/corelib_strong/list_reversed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_set_all_test.dart b/tests/corelib_strong/list_set_all_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_set_all_test.dart
rename to tests/corelib_strong/list_set_all_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_set_range_test.dart b/tests/corelib_strong/list_set_range_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_set_range_test.dart
rename to tests/corelib_strong/list_set_range_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_sort_test.dart b/tests/corelib_strong/list_sort_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_sort_test.dart
rename to tests/corelib_strong/list_sort_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_sublist_test.dart b/tests/corelib_strong/list_sublist_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_sublist_test.dart
rename to tests/corelib_strong/list_sublist_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_test.dart b/tests/corelib_strong/list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_test.dart
rename to tests/corelib_strong/list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_to_string2_test.dart b/tests/corelib_strong/list_to_string2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_to_string2_test.dart
rename to tests/corelib_strong/list_to_string2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_to_string_test.dart b/tests/corelib_strong/list_to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_to_string_test.dart
rename to tests/corelib_strong/list_to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/list_unmodifiable_test.dart b/tests/corelib_strong/list_unmodifiable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/list_unmodifiable_test.dart
rename to tests/corelib_strong/list_unmodifiable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/main_test.dart b/tests/corelib_strong/main_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/main_test.dart
rename to tests/corelib_strong/main_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_contains_key_test.dart b/tests/corelib_strong/map_contains_key_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_contains_key_test.dart
rename to tests/corelib_strong/map_contains_key_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_contains_value_test.dart b/tests/corelib_strong/map_contains_value_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_contains_value_test.dart
rename to tests/corelib_strong/map_contains_value_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_from_iterable_test.dart b/tests/corelib_strong/map_from_iterable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_from_iterable_test.dart
rename to tests/corelib_strong/map_from_iterable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_from_iterables_test.dart b/tests/corelib_strong/map_from_iterables_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_from_iterables_test.dart
rename to tests/corelib_strong/map_from_iterables_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_from_test.dart b/tests/corelib_strong/map_from_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_from_test.dart
rename to tests/corelib_strong/map_from_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_index_test.dart b/tests/corelib_strong/map_index_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_index_test.dart
rename to tests/corelib_strong/map_index_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_keys2_test.dart b/tests/corelib_strong/map_keys2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_keys2_test.dart
rename to tests/corelib_strong/map_keys2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_keys_test.dart b/tests/corelib_strong/map_keys_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_keys_test.dart
rename to tests/corelib_strong/map_keys_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_remove_test.dart b/tests/corelib_strong/map_remove_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_remove_test.dart
rename to tests/corelib_strong/map_remove_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_test.dart b/tests/corelib_strong/map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_test.dart
rename to tests/corelib_strong/map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_to_string_test.dart b/tests/corelib_strong/map_to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_to_string_test.dart
rename to tests/corelib_strong/map_to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_values2_test.dart b/tests/corelib_strong/map_values2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_values2_test.dart
rename to tests/corelib_strong/map_values2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_values3_test.dart b/tests/corelib_strong/map_values3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_values3_test.dart
rename to tests/corelib_strong/map_values3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_values4_test.dart b/tests/corelib_strong/map_values4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_values4_test.dart
rename to tests/corelib_strong/map_values4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/map_values_test.dart b/tests/corelib_strong/map_values_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/map_values_test.dart
rename to tests/corelib_strong/map_values_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/maps_test.dart b/tests/corelib_strong/maps_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/maps_test.dart
rename to tests/corelib_strong/maps_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/nan_infinity_test.dart b/tests/corelib_strong/nan_infinity_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/nan_infinity_test.dart
rename to tests/corelib_strong/nan_infinity_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/null_nosuchmethod_test.dart b/tests/corelib_strong/null_nosuchmethod_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/null_nosuchmethod_test.dart
rename to tests/corelib_strong/null_nosuchmethod_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/null_test.dart b/tests/corelib_strong/null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/null_test.dart
rename to tests/corelib_strong/null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/num_clamp_test.dart b/tests/corelib_strong/num_clamp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/num_clamp_test.dart
rename to tests/corelib_strong/num_clamp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/num_parse_test.dart b/tests/corelib_strong/num_parse_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/num_parse_test.dart
rename to tests/corelib_strong/num_parse_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/num_sign_test.dart b/tests/corelib_strong/num_sign_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/num_sign_test.dart
rename to tests/corelib_strong/num_sign_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/package_resource_test.dart b/tests/corelib_strong/package_resource_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/package_resource_test.dart
rename to tests/corelib_strong/package_resource_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/print_test.dart b/tests/corelib_strong/print_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/print_test.dart
rename to tests/corelib_strong/print_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/queue_first_test.dart b/tests/corelib_strong/queue_first_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/queue_first_test.dart
rename to tests/corelib_strong/queue_first_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/queue_iterator_test.dart b/tests/corelib_strong/queue_iterator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/queue_iterator_test.dart
rename to tests/corelib_strong/queue_iterator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/queue_last_test.dart b/tests/corelib_strong/queue_last_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/queue_last_test.dart
rename to tests/corelib_strong/queue_last_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/queue_single_test.dart b/tests/corelib_strong/queue_single_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/queue_single_test.dart
rename to tests/corelib_strong/queue_single_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/queue_test.dart b/tests/corelib_strong/queue_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/queue_test.dart
rename to tests/corelib_strong/queue_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/range_error_test.dart b/tests/corelib_strong/range_error_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/range_error_test.dart
rename to tests/corelib_strong/range_error_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp1_test.dart b/tests/corelib_strong/reg_exp1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp1_test.dart
rename to tests/corelib_strong/reg_exp1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp4_test.dart b/tests/corelib_strong/reg_exp4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp4_test.dart
rename to tests/corelib_strong/reg_exp4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp5_test.dart b/tests/corelib_strong/reg_exp5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp5_test.dart
rename to tests/corelib_strong/reg_exp5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp_all_matches_test.dart b/tests/corelib_strong/reg_exp_all_matches_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp_all_matches_test.dart
rename to tests/corelib_strong/reg_exp_all_matches_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp_first_match_test.dart b/tests/corelib_strong/reg_exp_first_match_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp_first_match_test.dart
rename to tests/corelib_strong/reg_exp_first_match_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp_group_test.dart b/tests/corelib_strong/reg_exp_group_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp_group_test.dart
rename to tests/corelib_strong/reg_exp_group_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp_groups_test.dart b/tests/corelib_strong/reg_exp_groups_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp_groups_test.dart
rename to tests/corelib_strong/reg_exp_groups_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp_has_match_test.dart b/tests/corelib_strong/reg_exp_has_match_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp_has_match_test.dart
rename to tests/corelib_strong/reg_exp_has_match_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp_pattern_test.dart b/tests/corelib_strong/reg_exp_pattern_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp_pattern_test.dart
rename to tests/corelib_strong/reg_exp_pattern_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp_start_end_test.dart b/tests/corelib_strong/reg_exp_start_end_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp_start_end_test.dart
rename to tests/corelib_strong/reg_exp_start_end_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/reg_exp_string_match_test.dart b/tests/corelib_strong/reg_exp_string_match_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/reg_exp_string_match_test.dart
rename to tests/corelib_strong/reg_exp_string_match_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/UC16_test.dart b/tests/corelib_strong/regexp/UC16_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/UC16_test.dart
rename to tests/corelib_strong/regexp/UC16_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/alternative-length-miscalculation_test.dart b/tests/corelib_strong/regexp/alternative-length-miscalculation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/alternative-length-miscalculation_test.dart
rename to tests/corelib_strong/regexp/alternative-length-miscalculation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/alternatives_test.dart b/tests/corelib_strong/regexp/alternatives_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/alternatives_test.dart
rename to tests/corelib_strong/regexp/alternatives_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/ascii-regexp-subject_test.dart b/tests/corelib_strong/regexp/ascii-regexp-subject_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/ascii-regexp-subject_test.dart
rename to tests/corelib_strong/regexp/ascii-regexp-subject_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/assertion_test.dart b/tests/corelib_strong/regexp/assertion_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/assertion_test.dart
rename to tests/corelib_strong/regexp/assertion_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/backreferences_test.dart b/tests/corelib_strong/regexp/backreferences_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/backreferences_test.dart
rename to tests/corelib_strong/regexp/backreferences_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/bol-with-multiline_test.dart b/tests/corelib_strong/regexp/bol-with-multiline_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/bol-with-multiline_test.dart
rename to tests/corelib_strong/regexp/bol-with-multiline_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/bol_test.dart b/tests/corelib_strong/regexp/bol_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/bol_test.dart
rename to tests/corelib_strong/regexp/bol_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/capture-3_test.dart b/tests/corelib_strong/regexp/capture-3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/capture-3_test.dart
rename to tests/corelib_strong/regexp/capture-3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/capture_test.dart b/tests/corelib_strong/regexp/capture_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/capture_test.dart
rename to tests/corelib_strong/regexp/capture_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/captures_test.dart b/tests/corelib_strong/regexp/captures_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/captures_test.dart
rename to tests/corelib_strong/regexp/captures_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/char-insensitive_test.dart b/tests/corelib_strong/regexp/char-insensitive_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/char-insensitive_test.dart
rename to tests/corelib_strong/regexp/char-insensitive_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/character-match-out-of-order_test.dart b/tests/corelib_strong/regexp/character-match-out-of-order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/character-match-out-of-order_test.dart
rename to tests/corelib_strong/regexp/character-match-out-of-order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/compile-crash_test.dart b/tests/corelib_strong/regexp/compile-crash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/compile-crash_test.dart
rename to tests/corelib_strong/regexp/compile-crash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/compile_test.dart b/tests/corelib_strong/regexp/compile_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/compile_test.dart
rename to tests/corelib_strong/regexp/compile_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/constructor_test.dart b/tests/corelib_strong/regexp/constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/constructor_test.dart
rename to tests/corelib_strong/regexp/constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/default_arguments_test.dart b/tests/corelib_strong/regexp/default_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/default_arguments_test.dart
rename to tests/corelib_strong/regexp/default_arguments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/dotstar_test.dart b/tests/corelib_strong/regexp/dotstar_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/dotstar_test.dart
rename to tests/corelib_strong/regexp/dotstar_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/early-acid3-86_test.dart b/tests/corelib_strong/regexp/early-acid3-86_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/early-acid3-86_test.dart
rename to tests/corelib_strong/regexp/early-acid3-86_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/ecma-regex-examples_test.dart b/tests/corelib_strong/regexp/ecma-regex-examples_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/ecma-regex-examples_test.dart
rename to tests/corelib_strong/regexp/ecma-regex-examples_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/extended-characters-match_test.dart b/tests/corelib_strong/regexp/extended-characters-match_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/extended-characters-match_test.dart
rename to tests/corelib_strong/regexp/extended-characters-match_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/extended-characters-more_test.dart b/tests/corelib_strong/regexp/extended-characters-more_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/extended-characters-more_test.dart
rename to tests/corelib_strong/regexp/extended-characters-more_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/find-first-asserted_test.dart b/tests/corelib_strong/regexp/find-first-asserted_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/find-first-asserted_test.dart
rename to tests/corelib_strong/regexp/find-first-asserted_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/global_test.dart b/tests/corelib_strong/regexp/global_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/global_test.dart
rename to tests/corelib_strong/regexp/global_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/indexof_test.dart b/tests/corelib_strong/regexp/indexof_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/indexof_test.dart
rename to tests/corelib_strong/regexp/indexof_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/invalid-range-in-class_test.dart b/tests/corelib_strong/regexp/invalid-range-in-class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/invalid-range-in-class_test.dart
rename to tests/corelib_strong/regexp/invalid-range-in-class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/issue_19193_test.dart b/tests/corelib_strong/regexp/issue_19193_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/issue_19193_test.dart
rename to tests/corelib_strong/regexp/issue_19193_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/lastindex_test.dart b/tests/corelib_strong/regexp/lastindex_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/lastindex_test.dart
rename to tests/corelib_strong/regexp/lastindex_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/look-ahead_test.dart b/tests/corelib_strong/regexp/look-ahead_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/look-ahead_test.dart
rename to tests/corelib_strong/regexp/look-ahead_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/lookahead_test.dart b/tests/corelib_strong/regexp/lookahead_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/lookahead_test.dart
rename to tests/corelib_strong/regexp/lookahead_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/loop-capture_test.dart b/tests/corelib_strong/regexp/loop-capture_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/loop-capture_test.dart
rename to tests/corelib_strong/regexp/loop-capture_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/malformed-escapes_test.dart b/tests/corelib_strong/regexp/malformed-escapes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/malformed-escapes_test.dart
rename to tests/corelib_strong/regexp/malformed-escapes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/many-brackets_test.dart b/tests/corelib_strong/regexp/many-brackets_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/many-brackets_test.dart
rename to tests/corelib_strong/regexp/many-brackets_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/multiline_test.dart b/tests/corelib_strong/regexp/multiline_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/multiline_test.dart
rename to tests/corelib_strong/regexp/multiline_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/negative-special-characters_test.dart b/tests/corelib_strong/regexp/negative-special-characters_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/negative-special-characters_test.dart
rename to tests/corelib_strong/regexp/negative-special-characters_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/no-extensions_test.dart b/tests/corelib_strong/regexp/no-extensions_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/no-extensions_test.dart
rename to tests/corelib_strong/regexp/no-extensions_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/non-bmp_test.dart b/tests/corelib_strong/regexp/non-bmp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/non-bmp_test.dart
rename to tests/corelib_strong/regexp/non-bmp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/non-capturing-backtracking_test.dart b/tests/corelib_strong/regexp/non-capturing-backtracking_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/non-capturing-backtracking_test.dart
rename to tests/corelib_strong/regexp/non-capturing-backtracking_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/non-capturing-groups_test.dart b/tests/corelib_strong/regexp/non-capturing-groups_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/non-capturing-groups_test.dart
rename to tests/corelib_strong/regexp/non-capturing-groups_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/non-character_test.dart b/tests/corelib_strong/regexp/non-character_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/non-character_test.dart
rename to tests/corelib_strong/regexp/non-character_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/non-greedy-parentheses_test.dart b/tests/corelib_strong/regexp/non-greedy-parentheses_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/non-greedy-parentheses_test.dart
rename to tests/corelib_strong/regexp/non-greedy-parentheses_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/norepeat_test.dart b/tests/corelib_strong/regexp/norepeat_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/norepeat_test.dart
rename to tests/corelib_strong/regexp/norepeat_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/overflow_test.dart b/tests/corelib_strong/regexp/overflow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/overflow_test.dart
rename to tests/corelib_strong/regexp/overflow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/parentheses_test.dart b/tests/corelib_strong/regexp/parentheses_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/parentheses_test.dart
rename to tests/corelib_strong/regexp/parentheses_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/pcre-test-4_test.dart b/tests/corelib_strong/regexp/pcre-test-4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/pcre-test-4_test.dart
rename to tests/corelib_strong/regexp/pcre-test-4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/pcre_test.dart b/tests/corelib_strong/regexp/pcre_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/pcre_test.dart
rename to tests/corelib_strong/regexp/pcre_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/quantified-assertions_test.dart b/tests/corelib_strong/regexp/quantified-assertions_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/quantified-assertions_test.dart
rename to tests/corelib_strong/regexp/quantified-assertions_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/range-bound-ffff_test.dart b/tests/corelib_strong/regexp/range-bound-ffff_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/range-bound-ffff_test.dart
rename to tests/corelib_strong/regexp/range-bound-ffff_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/range-out-of-order_test.dart b/tests/corelib_strong/regexp/range-out-of-order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/range-out-of-order_test.dart
rename to tests/corelib_strong/regexp/range-out-of-order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/ranges-and-escaped-hyphens_test.dart b/tests/corelib_strong/regexp/ranges-and-escaped-hyphens_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/ranges-and-escaped-hyphens_test.dart
rename to tests/corelib_strong/regexp/ranges-and-escaped-hyphens_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/regexp_kde_test.dart b/tests/corelib_strong/regexp/regexp_kde_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/regexp_kde_test.dart
rename to tests/corelib_strong/regexp/regexp_kde_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/regexp_test.dart b/tests/corelib_strong/regexp/regexp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/regexp_test.dart
rename to tests/corelib_strong/regexp/regexp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/regress-6-9-regexp_test.dart b/tests/corelib_strong/regexp/regress-6-9-regexp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/regress-6-9-regexp_test.dart
rename to tests/corelib_strong/regexp/regress-6-9-regexp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/regress-regexp-codeflush_test.dart b/tests/corelib_strong/regexp/regress-regexp-codeflush_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/regress-regexp-codeflush_test.dart
rename to tests/corelib_strong/regexp/regress-regexp-codeflush_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/regress-regexp-construct-result_test.dart b/tests/corelib_strong/regexp/regress-regexp-construct-result_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/regress-regexp-construct-result_test.dart
rename to tests/corelib_strong/regexp/regress-regexp-construct-result_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/repeat-match-waldemar_test.dart b/tests/corelib_strong/regexp/repeat-match-waldemar_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/repeat-match-waldemar_test.dart
rename to tests/corelib_strong/regexp/repeat-match-waldemar_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/results-cache_test.dart b/tests/corelib_strong/regexp/results-cache_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/results-cache_test.dart
rename to tests/corelib_strong/regexp/results-cache_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/stack-overflow2_test.dart b/tests/corelib_strong/regexp/stack-overflow2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/stack-overflow2_test.dart
rename to tests/corelib_strong/regexp/stack-overflow2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/stack-overflow_test.dart b/tests/corelib_strong/regexp/stack-overflow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/stack-overflow_test.dart
rename to tests/corelib_strong/regexp/stack-overflow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/standalones_test.dart b/tests/corelib_strong/regexp/standalones_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/standalones_test.dart
rename to tests/corelib_strong/regexp/standalones_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/toString_test.dart b/tests/corelib_strong/regexp/toString_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/toString_test.dart
rename to tests/corelib_strong/regexp/toString_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/unicode-handling_test.dart b/tests/corelib_strong/regexp/unicode-handling_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/unicode-handling_test.dart
rename to tests/corelib_strong/regexp/unicode-handling_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/unicodeCaseInsensitive_test.dart b/tests/corelib_strong/regexp/unicodeCaseInsensitive_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/unicodeCaseInsensitive_test.dart
rename to tests/corelib_strong/regexp/unicodeCaseInsensitive_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/v8_regexp_utils.dart b/tests/corelib_strong/regexp/v8_regexp_utils.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/v8_regexp_utils.dart
rename to tests/corelib_strong/regexp/v8_regexp_utils.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regexp/zero-length-alternatives_test.dart b/tests/corelib_strong/regexp/zero-length-alternatives_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regexp/zero-length-alternatives_test.dart
rename to tests/corelib_strong/regexp/zero-length-alternatives_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regress_11099_test.dart b/tests/corelib_strong/regress_11099_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regress_11099_test.dart
rename to tests/corelib_strong/regress_11099_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/regress_r21715_test.dart b/tests/corelib_strong/regress_r21715_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/regress_r21715_test.dart
rename to tests/corelib_strong/regress_r21715_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/safe_to_string_test.dart b/tests/corelib_strong/safe_to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/safe_to_string_test.dart
rename to tests/corelib_strong/safe_to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/set_containsAll_test.dart b/tests/corelib_strong/set_containsAll_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/set_containsAll_test.dart
rename to tests/corelib_strong/set_containsAll_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/set_contains_test.dart b/tests/corelib_strong/set_contains_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/set_contains_test.dart
rename to tests/corelib_strong/set_contains_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/set_intersection_test.dart b/tests/corelib_strong/set_intersection_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/set_intersection_test.dart
rename to tests/corelib_strong/set_intersection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/set_iterator_test.dart b/tests/corelib_strong/set_iterator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/set_iterator_test.dart
rename to tests/corelib_strong/set_iterator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/set_removeAll_test.dart b/tests/corelib_strong/set_removeAll_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/set_removeAll_test.dart
rename to tests/corelib_strong/set_removeAll_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/set_remove_test.dart b/tests/corelib_strong/set_remove_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/set_remove_test.dart
rename to tests/corelib_strong/set_remove_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/set_retainAll_test.dart b/tests/corelib_strong/set_retainAll_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/set_retainAll_test.dart
rename to tests/corelib_strong/set_retainAll_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/set_test.dart b/tests/corelib_strong/set_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/set_test.dart
rename to tests/corelib_strong/set_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/set_to_string_test.dart b/tests/corelib_strong/set_to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/set_to_string_test.dart
rename to tests/corelib_strong/set_to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/shuffle_test.dart b/tests/corelib_strong/shuffle_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/shuffle_test.dart
rename to tests/corelib_strong/shuffle_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/sort_helper.dart b/tests/corelib_strong/sort_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/sort_helper.dart
rename to tests/corelib_strong/sort_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/sort_test.dart b/tests/corelib_strong/sort_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/sort_test.dart
rename to tests/corelib_strong/sort_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/splay_tree_from_iterable_test.dart b/tests/corelib_strong/splay_tree_from_iterable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/splay_tree_from_iterable_test.dart
rename to tests/corelib_strong/splay_tree_from_iterable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/splay_tree_from_iterables_test.dart b/tests/corelib_strong/splay_tree_from_iterables_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/splay_tree_from_iterables_test.dart
rename to tests/corelib_strong/splay_tree_from_iterables_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/splay_tree_test.dart b/tests/corelib_strong/splay_tree_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/splay_tree_test.dart
rename to tests/corelib_strong/splay_tree_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/stacktrace_current_test.dart b/tests/corelib_strong/stacktrace_current_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/stacktrace_current_test.dart
rename to tests/corelib_strong/stacktrace_current_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/stacktrace_fromstring_test.dart b/tests/corelib_strong/stacktrace_fromstring_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/stacktrace_fromstring_test.dart
rename to tests/corelib_strong/stacktrace_fromstring_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/stopwatch2_test.dart b/tests/corelib_strong/stopwatch2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/stopwatch2_test.dart
rename to tests/corelib_strong/stopwatch2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/stopwatch_test.dart b/tests/corelib_strong/stopwatch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/stopwatch_test.dart
rename to tests/corelib_strong/stopwatch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_base_vm_test.dart b/tests/corelib_strong/string_base_vm_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_base_vm_test.dart
rename to tests/corelib_strong/string_base_vm_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_buffer_test.dart b/tests/corelib_strong/string_buffer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_buffer_test.dart
rename to tests/corelib_strong/string_buffer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_case_test.dart b/tests/corelib_strong/string_case_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_case_test.dart
rename to tests/corelib_strong/string_case_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_codeunits_test.dart b/tests/corelib_strong/string_codeunits_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_codeunits_test.dart
rename to tests/corelib_strong/string_codeunits_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_from_environment2_test.dart b/tests/corelib_strong/string_from_environment2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_from_environment2_test.dart
rename to tests/corelib_strong/string_from_environment2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_from_environment3_test.dart b/tests/corelib_strong/string_from_environment3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_from_environment3_test.dart
rename to tests/corelib_strong/string_from_environment3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_from_environment_test.dart b/tests/corelib_strong/string_from_environment_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_from_environment_test.dart
rename to tests/corelib_strong/string_from_environment_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_from_list_test.dart b/tests/corelib_strong/string_from_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_from_list_test.dart
rename to tests/corelib_strong/string_from_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_fromcharcode_test.dart b/tests/corelib_strong/string_fromcharcode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_fromcharcode_test.dart
rename to tests/corelib_strong/string_fromcharcode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_fromcharcodes_test.dart b/tests/corelib_strong/string_fromcharcodes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_fromcharcodes_test.dart
rename to tests/corelib_strong/string_fromcharcodes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_operations_with_null_test.dart b/tests/corelib_strong/string_operations_with_null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_operations_with_null_test.dart
rename to tests/corelib_strong/string_operations_with_null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_pattern_test.dart b/tests/corelib_strong/string_pattern_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_pattern_test.dart
rename to tests/corelib_strong/string_pattern_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_replace_all_test.dart b/tests/corelib_strong/string_replace_all_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_replace_all_test.dart
rename to tests/corelib_strong/string_replace_all_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_replace_dollar_test.dart b/tests/corelib_strong/string_replace_dollar_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_replace_dollar_test.dart
rename to tests/corelib_strong/string_replace_dollar_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_replace_test.dart b/tests/corelib_strong/string_replace_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_replace_test.dart
rename to tests/corelib_strong/string_replace_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_runes_test.dart b/tests/corelib_strong/string_runes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_runes_test.dart
rename to tests/corelib_strong/string_runes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_source_test.dart b/tests/corelib_strong/string_source_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_source_test.dart
rename to tests/corelib_strong/string_source_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_split_test.dart b/tests/corelib_strong/string_split_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_split_test.dart
rename to tests/corelib_strong/string_split_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_substring_test.dart b/tests/corelib_strong/string_substring_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_substring_test.dart
rename to tests/corelib_strong/string_substring_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_test.dart b/tests/corelib_strong/string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_test.dart
rename to tests/corelib_strong/string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_to_lower_case_test.dart b/tests/corelib_strong/string_to_lower_case_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_to_lower_case_test.dart
rename to tests/corelib_strong/string_to_lower_case_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_trim2_test.dart b/tests/corelib_strong/string_trim2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_trim2_test.dart
rename to tests/corelib_strong/string_trim2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_trim_test.dart b/tests/corelib_strong/string_trim_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_trim_test.dart
rename to tests/corelib_strong/string_trim_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/string_trimlr_test.dart b/tests/corelib_strong/string_trimlr_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/string_trimlr_test.dart
rename to tests/corelib_strong/string_trimlr_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/strings_test.dart b/tests/corelib_strong/strings_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/strings_test.dart
rename to tests/corelib_strong/strings_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/symbol_map_helper.dart b/tests/corelib_strong/symbol_map_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/symbol_map_helper.dart
rename to tests/corelib_strong/symbol_map_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/symbol_operator_test.dart b/tests/corelib_strong/symbol_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/symbol_operator_test.dart
rename to tests/corelib_strong/symbol_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/symbol_reserved_word_test.dart b/tests/corelib_strong/symbol_reserved_word_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/symbol_reserved_word_test.dart
rename to tests/corelib_strong/symbol_reserved_word_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/symbol_test.dart b/tests/corelib_strong/symbol_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/symbol_test.dart
rename to tests/corelib_strong/symbol_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/throw_half_surrogate_pair_test.dart b/tests/corelib_strong/throw_half_surrogate_pair_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/throw_half_surrogate_pair_test.dart
rename to tests/corelib_strong/throw_half_surrogate_pair_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/toInt_test.dart b/tests/corelib_strong/toInt_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/toInt_test.dart
rename to tests/corelib_strong/toInt_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/type_hashcode_test.dart b/tests/corelib_strong/type_hashcode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/type_hashcode_test.dart
rename to tests/corelib_strong/type_hashcode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/unicode2_test.dart b/tests/corelib_strong/unicode2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/unicode2_test.dart
rename to tests/corelib_strong/unicode2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/unicode_test.dart b/tests/corelib_strong/unicode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/unicode_test.dart
rename to tests/corelib_strong/unicode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_base_test.dart b/tests/corelib_strong/uri_base_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_base_test.dart
rename to tests/corelib_strong/uri_base_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_file_test.dart b/tests/corelib_strong/uri_file_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_file_test.dart
rename to tests/corelib_strong/uri_file_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_http_test.dart b/tests/corelib_strong/uri_http_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_http_test.dart
rename to tests/corelib_strong/uri_http_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_ipv4_test.dart b/tests/corelib_strong/uri_ipv4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_ipv4_test.dart
rename to tests/corelib_strong/uri_ipv4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_ipv6_test.dart b/tests/corelib_strong/uri_ipv6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_ipv6_test.dart
rename to tests/corelib_strong/uri_ipv6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_normalize_path_test.dart b/tests/corelib_strong/uri_normalize_path_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_normalize_path_test.dart
rename to tests/corelib_strong/uri_normalize_path_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_normalize_test.dart b/tests/corelib_strong/uri_normalize_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_normalize_test.dart
rename to tests/corelib_strong/uri_normalize_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_parameters_all_test.dart b/tests/corelib_strong/uri_parameters_all_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_parameters_all_test.dart
rename to tests/corelib_strong/uri_parameters_all_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_parse_test.dart b/tests/corelib_strong/uri_parse_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_parse_test.dart
rename to tests/corelib_strong/uri_parse_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_path_test.dart b/tests/corelib_strong/uri_path_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_path_test.dart
rename to tests/corelib_strong/uri_path_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_query_test.dart b/tests/corelib_strong/uri_query_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_query_test.dart
rename to tests/corelib_strong/uri_query_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_scheme_test.dart b/tests/corelib_strong/uri_scheme_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_scheme_test.dart
rename to tests/corelib_strong/uri_scheme_test.dart
diff --git a/pkg/dev_compiler/test/codegen/corelib/uri_test.dart b/tests/corelib_strong/uri_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/corelib/uri_test.dart
rename to tests/corelib_strong/uri_test.dart
diff --git a/tests/html/html.status b/tests/html/html.status
index b3aece5..0bf4421 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -47,7 +47,6 @@
 [ $compiler == dart2js && $browser ]
 custom/created_callback_test: Fail # Support for created constructor. Issue 14835
 fontface_loaded_test: Fail # Support for promises.
-js_test/JsArray: RuntimeError # Issue 26197
 
 [ $compiler == dart2js && ($runtime == safari || $runtime == safarimobilesim || $runtime == ff  || $ie) ]
 custom/entered_left_view_test/viewless_document: Fail # Polyfill does not handle this
@@ -79,9 +78,12 @@
 worker_test/functional: Pass, Crash # Issue 9929.
 
 [ $compiler == dart2js && $runtime == chrome ]
-fileapi_test/entry: Fail # TODO(dart2js-team): Please triage this failure.
+fileapi_test/entry: Pass, Fail # TODO(dart2js-team): Please triage this failure.
 fileapi_test/getDirectory: Fail # TODO(dart2js-team): Please triage this failure.
 fileapi_test/getFile: Fail # TODO(dart2js-team): Please triage this failure.
+media_stream_test/supported_MediaStreamEvent: RuntimeError # Please triage.
+media_stream_test/supported_MediaStreamTrackEvent: RuntimeError # Please triage.
+speechrecognition_test/types: RuntimeError # Please triage.
 
 [ $compiler == dart2js && $runtime == chromeOnAndroid ]
 crypto_test/functional: Pass, Slow # TODO(dart2js-team): Please triage this failure.
@@ -320,7 +322,6 @@
 indexeddb_5_test: RuntimeError # Issue 21433
 
 
-js_test/JsArray: RuntimeError # Fails 10 out of 10.
 indexeddb_3_test: Skip # Times out 1 out of 10.
 
 [  $compiler == dart2js && $runtime == ff ]
@@ -353,7 +354,7 @@
 
 # 'html' tests import the HTML library, so they only make sense in
 # a browser environment.
-[ $runtime == vm || $runtime == dart_precompiled || $runtime == dart_app ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 *: Skip
 
 [ $compiler == dart2js && ($runtime == drt || $runtime == ff) ]
diff --git a/tests/html/js_test.dart b/tests/html/js_test.dart
index c554081..c429cd8 100644
--- a/tests/html/js_test.dart
+++ b/tests/html/js_test.dart
@@ -515,8 +515,6 @@
 
     test('pass Array to JS', () {
       context['a'] = [1, 2, 3];
-      expect(context.callMethod('isPropertyInstanceOf',
-          ['a', context['Array']]), isTrue);
       var a = context['a'];
       expect(a, new isInstanceOf<List>());
       expect(a, isNot(new isInstanceOf<JsArray>()));
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 8274317..f9ff809 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -2,17 +2,17 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 browser/*: SkipByDesign  # Browser specific tests
 isolate_stress_test: Skip # Issue 12588: Uses dart:html. This should be able to pass when we have wrapper-less tests.
 
-[ $runtime != vm || $mode == product ]
+[ $runtime != vm || $mode == product || $compiler == app_jit ]
 checked_test: Skip # Unsupported.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $arch == mips && $mode == debug ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $arch == mips && $mode == debug ]
 mandel_isolate_test: Skip # Uses 600 MB Ram on our 1 GB test device.
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) ]
+[ $compiler == none || $compiler == precompiler || $compiler == app_jit ]
 compile_time_error_test/01: Skip # Issue 12587
 ping_test: Skip           # Resolve test issues
 ping_pause_test: Skip     # Resolve test issues
@@ -89,7 +89,7 @@
 
 [ $csp ]
 deferred_in_isolate2_test: Skip # Issue 16898. Deferred loading does not work from an isolate in CSP-mode
-browser/package_resolve_browser_hook_test: RuntimeError # CSP violation. Issue 27914
+browser/package_resolve_browser_hook_test: SkipByDesign # Test written in a way that violates CSP.
 
 [ $compiler == dart2js && $runtime == chromeOnAndroid ]
 isolate_stress_test: Pass, Slow # TODO(kasperl): Please triage.
@@ -154,7 +154,13 @@
 simple_message_test/none: RuntimeError, OK  # Uses Isolate.spawn.
 start_paused_test: RuntimeError, OK  # Uses Isolate.spawn.
 message3_test/int32x4: RuntimeError, OK  # Uses Isolate.spawn.
-browser/package_*: Skip # Issue 25594 (missing implementation in Dartium).
+browser/package_resolve_browser_hook*: Skip # Tests that use defaultPackagesBase (not supported in Dartium).
+
+[ ($compiler == none) && ( $runtime == dartium || $runtime == drt) ]
+browser/package_resolve_browser_test: Fail # Issue 28382
+
+[ ($compiler == none) && ( $runtime == dartium || $runtime == drt) && ($system == windows) ]
+browser/package_resolve_browser_test: Skip # Temporarily disabled working on CL to fix under Windows.
 
 [ $compiler == dart2analyzer ]
 browser/typed_data_message_test: StaticWarning
@@ -170,7 +176,7 @@
 spawn_uri_fail_test: SkipByDesign  # Uses dart:io.
 scenarios/*: SkipByDesign  # Use automatic package resolution, spawnFunction and .dart URIs.
 
-[ $noopt || $compiler == precompiler || $mode == product ]
+[ $compiler == precompiler || $mode == product ]
 # Imports dart:mirrors
 count_test: SkipByDesign
 cross_isolate_message_test: SkipByDesign
@@ -191,7 +197,7 @@
 static_function_test: SkipByDesign
 unresolved_ports_test: SkipByDesign
 
-[ $runtime == dart_precompiled || $runtime == dart_app ]
+[ $runtime == dart_precompiled ]
 count_test: Skip # Isolate.spawnUri
 cross_isolate_message_test: Skip # Isolate.spawnUri
 deferred_in_isolate2_test: Skip # Isolate.spawnUri
@@ -236,3 +242,4 @@
 deferred_in_isolate_test: Crash # Requires deferred libraries
 deferred_in_isolate2_test: Crash # Requires deferred libraries
 issue_21398_parent_isolate2_test: Crash # Requires deferred libraries
+spawn_uri_nested_vm_test: Pass, Crash # Issue 28192
diff --git a/tests/language/assert_message_test.dart b/tests/language/assert_message_test.dart
new file mode 100644
index 0000000..28499ed
--- /dev/null
+++ b/tests/language/assert_message_test.dart
@@ -0,0 +1,104 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// SharedOptions=--assert-message
+
+import "dart:async";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+main() {
+  // Only run with asserts enabled mode.
+  bool assertsEnabled = false;
+  assert(assertsEnabled = true);
+  if (!assertsEnabled) return;
+
+  // Basics.
+  assert(true, "");
+  assert(() => true, "");
+
+  int x = null;
+  // Successful asserts won't execute message.
+  assert(true, x + 42);
+  assert(true, throw "unreachable");
+
+  // Can use any value as message.
+  try {
+    assert(false, 42);
+  } on AssertionError catch (e) {
+    Expect.equals(42, e.message);
+  }
+
+  try {
+    assert(false, "");
+  } on AssertionError catch (e) {
+    Expect.equals("", e.message);
+  }
+
+  try {
+    assert(false, null);
+  } on AssertionError catch (e) {
+    Expect.equals(null, e.message);
+  }
+
+  // Test expression can throw.
+  try {
+    assert(throw "test", throw "message");
+  } on String catch (e) {
+    Expect.equals("test", e);
+  }
+
+  // Message expression can throw.
+  try {
+    assert(false, throw "message");
+  } on String catch (e) {
+    Expect.equals("message", e);
+  }
+
+  // Failing asserts evaluate message after test.
+  var list = [];
+  try {
+    assert((list..add(1)).isEmpty, (list..add(3)).length);
+  } on AssertionError catch (e) {
+    Expect.equals(2, e.message);
+    Expect.listEquals([1, 3], list);
+  }
+
+  asyncStart();
+  asyncTests().then((_) { asyncEnd(); });
+}
+
+
+Future asyncTests() async {
+  // You can await in both condition and message.
+  assert(true, await 0);
+  assert(await true, 1);
+  assert(await true, await 2);
+
+  // Successful asserts won't await/evaluate message.
+  void unreachable() => throw "unreachable";
+  assert(await true, await unreachable());
+
+  try {
+    assert(false, await 3);
+  } on AssertionError catch (e) {
+    Expect.equals(3, e.message);
+  }
+
+  var falseFuture = new Future.value(false);
+  var numFuture = new Future.value(4);
+
+  try {
+    assert(await falseFuture, await numFuture);
+  } on AssertionError catch (e) {
+    Expect.equals(4, e.message);
+  }
+
+  try {
+    assert(await falseFuture, await new Future.error("error"));
+  } on String catch (e) {
+    Expect.equals("error", e);
+  }
+}
diff --git a/tests/language/bad_constructor_test.dart b/tests/language/bad_constructor_test.dart
index 02ac4e5..4c0b17e 100644
--- a/tests/language/bad_constructor_test.dart
+++ b/tests/language/bad_constructor_test.dart
@@ -13,9 +13,9 @@
   var m;
   A.m() { m = 0; }  /// 04: compile-time error
 
-  set q(var value) { m = q; }  // No name conflict with q=.
-  // The runtime error occurs because main calls new A() instead of new A.q().
-  A.q();   /// 05: runtime error
+  set q(var value) { m = 0; }  // No name conflict with q=.
+  A.q();   /// 05: ok
+  A();     /// 05: ok
 
   A.foo() : m = 0;  /// 06: compile-time error
   int foo(int a, int b) => a + b * m;
diff --git a/tests/language/bad_typedef_test.dart b/tests/language/bad_typedef_test.dart
new file mode 100644
index 0000000..cbc271e
--- /dev/null
+++ b/tests/language/bad_typedef_test.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test for a function type test that cannot be eliminated at compile time.
+
+import "package:expect/expect.dart";
+
+typedef int H(Function
+    Function   /// 00: compile-time error
+    x);
+
+main() {
+  bool b = true;
+  Expect.isFalse(b is H);
+}
diff --git a/tests/language/config_import_corelib_general.dart b/tests/language/config_import_corelib_general.dart
new file mode 100644
index 0000000..04d3b5c
--- /dev/null
+++ b/tests/language/config_import_corelib_general.dart
@@ -0,0 +1,10 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class Classy {
+  String get name => "classy general";
+}
+
+bool general() => true;
+final String name = "general";
diff --git a/tests/language/config_import_corelib_http.dart b/tests/language/config_import_corelib_http.dart
new file mode 100644
index 0000000..292e091
--- /dev/null
+++ b/tests/language/config_import_corelib_http.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:http";
+
+class Classy {
+  String get name => "classy http";
+  String httpSpecific() => "classy http";
+}
+
+bool general() => true;
+bool httpSpecific() => true;
+final String name = "http";
diff --git a/tests/language/config_import_corelib_io.dart b/tests/language/config_import_corelib_io.dart
new file mode 100644
index 0000000..d5b594a
--- /dev/null
+++ b/tests/language/config_import_corelib_io.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "dart:io";
+
+class Classy {
+  String get name => "classy io";
+  String ioSpecific() => "classy io";
+}
+
+bool general() => true;
+bool ioSpecific() => true;
+final String name = "io";
diff --git a/tests/language/config_import_corelib_test.dart b/tests/language/config_import_corelib_test.dart
new file mode 100644
index 0000000..6536426
--- /dev/null
+++ b/tests/language/config_import_corelib_test.dart
@@ -0,0 +1,53 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+import 'config_import_corelib_general.dart'
+  if (dart.library.io) 'config_import_corelib_io.dart'
+  if (dart.library.http) 'config_import_corelib_http.dart'
+  as lib;
+
+class SubClassy extends lib.Classy {
+  String get superName => super.name;
+}
+
+main() {
+  var io = const bool.fromEnvironment("dart.library.io");
+  var http = const bool.fromEnvironment("dart.library.http");
+
+  var cy = new SubClassy();
+
+  if (io) {
+    Expect.isTrue(lib.general());
+    Expect.equals("io", lib.name);
+    Expect.equals("classy io", cy.name);
+
+    Expect.isTrue(lib.ioSpecific());
+    Expect.equals("classy io", cy.ioSpecific());
+
+    Expect.throws(() { lib.httpSpecific(); });
+    Expect.throws(() { cy.httpSpecific(); });
+  } else if (http) {
+    Expect.isTrue(lib.general());
+    Expect.equals("http", lib.name);
+    Expect.equals("classy http", cy.name);
+
+    Expect.throws(() { lib.ioSpecific(); });
+    Expect.throws(() { cy.ioSpecific(); });
+
+    Expect.isTrue(lib.httpSpecific());
+    Expect.equals("classy http", cy.httpSpecific());
+  } else {
+    Expect.isTrue(lib.general());
+    Expect.equals("general", lib.name);
+    Expect.equals("classy general", cy.name);
+
+    Expect.throws(() { lib.ioSpecific(); });
+    Expect.throws(() { cy.ioSpecific(); });
+
+    Expect.throws(() { lib.httpSpecific(); });
+    Expect.throws(() { cy.httpSpecific(); });
+  }
+}
diff --git a/tests/language/covariant_override_test.dart b/tests/language/covariant_override_test.dart
new file mode 100644
index 0000000..7a91126
--- /dev/null
+++ b/tests/language/covariant_override_test.dart
@@ -0,0 +1,92 @@
+
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library covariant_override_test;
+
+// This test contains cases where `covariant` is used as intended.
+
+abstract class A {
+  A(this.f1, this.f2, this.f3);
+
+  // Normal usage, "by design": superclass requests covariance.
+  void m1(covariant Object o);
+
+  // Normal usage, "ad hoc": subclass requests covariance.
+  void m2(Object o);
+
+  // Syntactic special case: omit the type in subclass.
+  void m3(Object o);
+
+  // Positional optional arguments.
+  void m4([covariant Object o]);
+  void m5([Object o]);
+  void m6([Object o]);
+
+  // Named arguments.
+  void m7({covariant Object arg});
+  void m8({Object arg});
+  void m9({Object arg});
+
+  // Normal usage on field, "by design": superclass requests covariance.
+  covariant Object f1;
+
+  // Normal usage on field, "ad hoc": subclass requests covariance.
+  Object f2;
+
+  // Syntactic special case.
+  Object f3;
+}
+
+abstract class B extends A {
+  B(num f1, num f2, num f3): super(f1, f2, f3);
+
+  void m1(num n);
+  void m2(covariant num n);
+  void m3(covariant n);
+  void m4([num n]);
+  void m5([covariant num n]);
+  void m6([covariant n]);
+  void m7({num arg});
+  void m8({covariant num arg});
+  void m9({covariant arg});
+  void set f1(num n);
+  void set f2(covariant num n);
+  void set f3(covariant n);
+}
+
+class C extends B {
+  C(int f1, int f2, int f3): super(f1, f2, f3);
+  
+  void m1(int i) {}
+  void m2(int i) {}
+  void m3(int i) {}
+  void m4([int i]) {}
+  void m5([int i]) {}
+  void m6([int i]) {}
+  void m7({int arg}) {}
+  void m8({int arg}) {}
+  void m9({int arg}) {}
+  void set f1(int i) {}
+  void set f2(int i) {}
+  void set f3(int i) {}
+}
+
+main() {
+  // For Dart 1.x, `covariant` has no runtime semantics; we just ensure
+  // that the code is not unused, such that we know it will be parsed.
+  A a = new C(39, 40, 41);
+  a.m1(42);
+  a.m2(42);
+  a.m3(42);
+  a.m4(42);
+  a.m5(42);
+  a.m6(42);
+  a.m7(arg: 42);
+  a.m8(arg: 42);
+  a.m9(arg: 42);
+  a.f1 = 42;
+  a.f2 = 42;
+  a.f3 = 42;
+}
diff --git a/tests/language/covariant_test.dart b/tests/language/covariant_test.dart
new file mode 100644
index 0000000..c98fbb0
--- /dev/null
+++ b/tests/language/covariant_test.dart
@@ -0,0 +1,424 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test that `covariant` can be parsed (and ignored) by
+// dart2js and the VM.
+// This test only checks for non-strong mode behavior.
+//
+// Generally, `covariant` should be ignored, when it is used in the right
+// places.
+
+import 'package:expect/expect.dart';
+
+// Top level field may not have a covariant.
+// Would be considered a minor (acceptable) bug, if it was accepted here too.
+covariant  /// 00: compile-time error
+int x0;
+
+covariant int covariant;  /// 00b: compile-time error
+
+int covariant;  /// 00c: ok
+
+// Getters may never have `covariant`. (Neither on the top-level nor as members)
+covariant  /// 01: compile-time error
+int get x1 => 499;
+
+// Top level setters may not have a covariant.
+// Would be considered a minor (acceptable) bug, if it was accepted here too.
+void set x2(
+    covariant /// 02: compile-time error
+    int val) {}
+
+// Same as above, but with `covariant` in different positions.
+// The `covariant` is just wrong there.
+
+int
+covariant  /// 03: compile-time error
+x3;
+
+int
+covariant  /// 04: compile-time error
+get x4 => 499;
+
+void set x5(
+    int
+    covariant /// 05: compile-time error
+    val) {}
+
+
+// Same without types.
+
+// Since `covariant` is a built-in identifier, it is not allowed here.
+covariant x6;  /// 06: compile-time error
+
+covariant covariant;  /// 06b: compile-time error
+
+// Getters may never have `covariant`.
+covariant  /// 07: compile-time error
+get x7 => 499;
+
+// Top level setters may not have a covariant.
+// Would be considered a minor (acceptable) bug, if it was accepted here too.
+void set x8(
+    covariant /// 08: compile-time error
+    val) {}
+
+// If there is no type, then `covariant` is simply the parameter name:
+void set x9(covariant) {}
+
+// Covariant won't work on return types.
+covariant  /// 10: compile-time error
+int f10() => 499;
+
+// Covariant won't work as a return type.
+covariant  /// 11: compile-time error
+f11() => 499;
+
+// Covariant should not work on top-level methods.
+// It's a minor (acceptable) bug to not error out here.
+int f12(
+    covariant /// 12: compile-time error
+    int x) => 499;
+
+// `Covariant` must be in front of the types.
+int f13(
+    int
+    covariant /// 13: compile-time error
+    x) => 499;
+
+// Covariant should not work on top-level methods.
+// It's a minor (acceptable) bug to not error out here.
+int f14(
+    covariant /// 14: compile-time error
+    final
+    x) => 499;
+
+// `Covariant` must be in front of modifiers.
+int f15(
+    final
+    covariant /// 15: compile-time error
+    x) => 499;
+
+// Covariant should not work on top-level methods.
+// It's a minor (acceptable) bug to not error out here.
+int f16(
+    covariant /// 16: compile-time error
+    final
+    int
+    x) => 499;
+
+// `Covariant` must be in front of modifiers.
+int f17(
+    final
+    covariant /// 17: compile-time error
+    int
+    x) => 499;
+
+// On its own, `covariant` is just a parameter name.
+int f18(covariant) => covariant;
+
+covariant;  /// 19: compile-time error
+
+// All of the above as statics in a class.
+class A {
+  // Static fields may not have a covariant.
+  // Would be considered a minor (acceptable) bug, if it was accepted here too.
+  static
+  covariant  /// 20: compile-time error
+  int x20;
+
+  static covariant int covariant  /// 20b: compile-time error
+
+  static int covariant;  /// 20c: ok
+
+  // Getters may never have `covariant`.
+  static
+  covariant  /// 21: compile-time error
+  int get x21 => 499;
+
+  // Getters may never have `covariant`.
+  covariant  /// 21b: compile-time error
+  static
+  int get x21b => 499;
+
+  // Static setters may not have a covariant.
+  // Would be considered a minor (acceptable) bug, if it was accepted here too.
+  static void set x22(
+      covariant /// 22: compile-time error
+      int val) {}
+
+  // Same as above, but with `covariant` in different positions.
+  // The `covariant` is just wrong there.
+
+  static int
+  covariant  /// 23: compile-time error
+  x23;
+
+  static int
+  covariant  /// 24: compile-time error
+  get x24 => 499;
+
+  static void set x25(
+    int
+    covariant /// 25: compile-time error
+    val) {}
+
+  // Since `covariant` is a built-in identifier, it is not allowed here.
+  static covariant x26; /// 26: compile-time error
+  static covariant covariant; /// 26b: compile-time error
+
+  // Getters may never have `covariant`.
+  static
+  covariant  /// 27: compile-time error
+  get x27 => 499;
+
+  covariant  /// 27b: compile-time error
+  static
+  get x27b => 499;
+
+  // Static setters may not have a covariant.
+  // Would be considered a minor (acceptable) bug, if it was accepted here too.
+  static void set x28(
+      covariant /// 28: compile-time error
+      val) {}
+
+  // If there is no type, then `covariant` is simply the parameter name:
+  static void set x29(covariant) {}
+
+  // Covariant won't work on return types.
+  static
+  covariant  /// 30: compile-time error
+  int f30() => 499;
+
+  covariant  /// 30b: compile-time error
+  static
+  int f30b() => 499;
+
+  // Covariant won't work as a return type.
+  static
+  covariant  /// 31: compile-time error
+  f31() => 499;
+
+  covariant  /// 31b: compile-time error
+  static
+  f31b() => 499;
+
+  // Covariant should not work on static methods.
+  // It's a minor (acceptable) bug to not error out here.
+  static int f32(
+      covariant /// 32: compile-time error
+      int x) => 499;
+
+  // `Covariant` must be in front of the types.
+  static int f33(
+      int
+      covariant /// 33: compile-time error
+      x) => 499;
+
+  // Covariant should not work on top-level methods.
+  // It's a minor (acceptable) bug to not error out here.
+  static int f34(
+      covariant /// 34: compile-time error
+      final
+      x) => 499;
+
+  // `Covariant` must be in front of modifiers.
+  static int f35(
+      final
+      covariant /// 35: compile-time error
+      x) => 499;
+
+  // Covariant should not work on top-level methods.
+  // It's a minor (acceptable) bug to not error out here.
+  static int f36(
+      covariant /// 36: compile-time error
+      final
+      int
+      x) => 499;
+
+  // `Covariant` must be in front of modifiers.
+  static int f37(
+      final
+      covariant /// 37: compile-time error
+      int
+      x) => 499;
+
+  // `Covariant` on its own is just a parameter name.
+  static int f38(covariant) => covariant;
+
+  static covariant;  /// 39: compile-time error
+
+}
+
+// All of the above as instance members in a class.
+class B {
+  covariant  /// 40: ok
+  int x40;
+
+  covariant int covariant;  /// 40b: ok
+
+  int covariant;            /// 40c: ok
+
+  // Getters may never have `covariant`.
+  covariant  /// 41: compile-time error
+  int get x41 => 499;
+
+  void set x42(
+      covariant  /// 42: ok
+      int val) {}
+
+  // `covariant` in the wrong position.
+  int
+  covariant  /// 43: compile-time error
+  x43;
+
+  // `covariant` in the wrong position.
+  int
+  covariant  /// 44: compile-time error
+  get x44 => 499;
+
+  void set x45(
+    int
+    covariant /// 45: compile-time error
+    val) {}
+
+  // Since `covariant` is a built-in identifier, it is not allowed here.
+  covariant x46; /// 46: compile-time error
+  covariant covariant; /// 46b: compile-time error
+
+  // Getters may never have `covariant`.
+  covariant  /// 47: compile-time error
+  get x47 => 499;
+
+  void set x48(
+      covariant  /// 48: ok
+      val) {}
+
+  // If there is no type, then `covariant` is simply the parameter name:
+  void set x49(covariant) {}
+
+  // Covariant won't work on return types.
+  covariant  /// 50: compile-time error
+  int f50() => 499;
+
+  // Covariant won't work as a return type.
+  covariant  /// 51: compile-time error
+  f51() => 499;
+
+  int f52(
+      covariant  /// 52: ok
+      int x) => 499;
+
+  // `Covariant` must be in front of the types.
+  int f53(
+      int
+      covariant /// 53: compile-time error
+      x) => 499;
+
+  int f54(
+      covariant  /// 54: ok
+      final x) => 499;
+
+  // `Covariant` must be in front of modifiers.
+  int f55(
+      final
+      covariant /// 55: compile-time error
+      x) => 499;
+
+  int f56(
+      covariant  /// 56: ok
+      final int x) => 499;
+
+  // `Covariant` must be in front of modifiers.
+  int f57(
+      final
+      covariant /// 57: compile-time error
+      int
+      x) => 499;
+
+  // `Covariant` on its own is just a parameter name.
+  int f58(covariant) => covariant;
+
+  covariant;  /// 59: compile-time error
+}
+
+void use(x) {}
+
+main() {
+  x0 = 0;
+  covariant = 0;  /// 00b: continued
+  covariant = 0;  /// 00c: continued
+  use(x1);
+  x2 = 499;
+  use(x3);
+  use(x4);
+  x5 = 42;
+  x6 = 0; /// 06: continued
+  covariant = 0; /// 06b: continued
+  use(x7);
+  x8 = 11;
+  x9 = 12;
+  use(f10());
+  use(f11());
+  use(f12(2));
+  use(f13(3));
+  use(f14(3));
+  use(f15(3));
+  use(f16(3));
+  use(f17(3));
+  Expect.equals(123, f18(123));
+  use(covariant);  /// 19: continued
+
+  A.x20 = 0;
+  A.covariant = 0;  /// 20b: continued
+  A.covariant = 0;  /// 20c: continued
+  use(A.x21);
+  use(A.x21b);
+  A.x22 = 499;
+  use(A.x23);
+  use(A.x24);
+  A.x25 = 42;
+  A.x26 = 0; /// 26: continued
+  A.covariant = 0; /// 26b: continued
+  use(A.x27);
+  use(A.x27b);
+  A.x28 = 11;
+  A.x29 = 12;
+  use(A.f30());
+  use(A.f31());
+  use(A.f31b());
+  use(A.f32(2));
+  use(A.f33(3));
+  use(A.f34(3));
+  use(A.f35(3));
+  use(A.f36(3));
+  use(A.f37(3));
+  Expect.equals(1234, A.f38(1234));
+  use(A.covariant);  /// 39: continued
+
+  var b = new B();
+  b.x40 = 0;
+  b.covariant = 0;  /// 40b: continued
+  b.covariant = 0;  /// 40c: continued
+  use(b.x41);
+  b.x42 = 499;
+  use(b.x43);
+  use(b.x44);
+  b.x45 = 42;
+  b.x46 = 0; /// 46: continued
+  b.covariant = 0; /// 46b: continued
+  use(b.x47);
+  b.x48 = 11;
+  b.x49 = 12;
+  use(b.f50());
+  use(b.f51());
+  use(b.f52(2));
+  use(b.f53(2));
+  use(b.f54(3));
+  use(b.f55(3));
+  use(b.f56(3));
+  use(b.f57(3));
+  Expect.equals(12345, b.f58(12345));
+  use(B.covariant);  /// 59: continued
+}
\ No newline at end of file
diff --git a/tests/language/enum_test.dart b/tests/language/enum_test.dart
index a3b4586..7cdcee4 100644
--- a/tests/language/enum_test.dart
+++ b/tests/language/enum_test.dart
@@ -20,7 +20,7 @@
   Expect.equals('Enum2.A', Enum2.A.toString());
   Expect.equals(0, Enum2.A.index);
   Expect.listEquals([Enum2.A], Enum2.values);
-  Expect.identical(const [Enum2.A], Enum2.values);
+  Expect.identical(const <Enum2>[Enum2.A], Enum2.values);
   Enum2.values.forEach(test2);
 
   Expect.equals('Enum3.B', Enum3.B.toString());
diff --git a/tests/language/function_subtype0_test.dart b/tests/language/function_subtype0_test.dart
index 1a39d92..4cc4809 100644
--- a/tests/language/function_subtype0_test.dart
+++ b/tests/language/function_subtype0_test.dart
@@ -36,6 +36,7 @@
 int int__int2(int i) => 0;
 int int__Object(Object o) => 0;
 Object Object__int(int i) => null;
+void void__Object(Object o) => null;
 int int__double(double d) => 0;
 int int__int_int(int i1, int i2) => 0;
 void inline_void_(void f()) {}
@@ -82,6 +83,8 @@
   Expect.isFalse(int__int_int is t_int__int);
   // (()->void) -> void <: ((int)->void) -> void
   Expect.isFalse(inline_void_ is t_inline_void__int);
+  // (Object) -> void <: ((int)->void) -> void
+  Expect.isTrue(void__Object is t_inline_void__int);
   // ((int)->void) -> void <: (()->void) -> void
   Expect.isFalse(inline_void__int is t_inline_void_);
 }
diff --git a/tests/language/function_subtype1_test.dart b/tests/language/function_subtype1_test.dart
index a7bd199..1938ebe 100644
--- a/tests/language/function_subtype1_test.dart
+++ b/tests/language/function_subtype1_test.dart
@@ -17,6 +17,7 @@
 typedef Object Object_();
 typedef double double_();
 typedef void void__int(int i);
+typedef void void__Object(Object o);
 typedef int int__int(int i);
 typedef int int__int2(int i);
 typedef int int__Object(Object o);
@@ -69,6 +70,8 @@
   Expect.isFalse(new C<int__int_int>() is C<int__int>);
   // (()->void) -> void <: ((int)->void) -> void
   Expect.isFalse(new C<inline_void_>() is C<inline_void__int>);
+  // (Object) -> void <: ((int)->void) -> void
+  Expect.isTrue(new C<void__Object>() is C<inline_void__int>);
   // ((int)->void) -> void <: (()->void) -> void
   Expect.isFalse(new C<inline_void__int>() is C<inline_void_>);
 }
diff --git a/tests/language/generic_method_types_test.dart b/tests/language/generic_method_types_test.dart
new file mode 100644
index 0000000..4db4ba2
--- /dev/null
+++ b/tests/language/generic_method_types_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+
+typedef O Convert<I, O>(I input);
+typedef Other(a, b);
+
+class Mixin<E> {
+  E convert1<I>(I input) => null;
+}
+
+class Class<F> extends Object with Mixin<F> {
+  O convert2<O>(F input) => null;
+}
+
+O convert<I, O>(I input) => null;
+
+test1() {
+  var val = new Class<String>();
+  Expect.isTrue(val.convert1 is Convert);
+  Expect.isTrue(val.convert1 is Convert<String, String>);
+  Expect.isTrue(val.convert1 is Convert<int, String>);
+  Expect.isFalse(val.convert1 is Convert<String, int>);
+  Expect.isFalse(val.convert1 is Other);
+}
+
+test2() {
+  var val = new Class<String>();
+  Expect.isTrue(val.convert2 is Convert);
+  Expect.isTrue(val.convert2 is Convert<String, String>);
+  Expect.isTrue(val.convert2 is Convert<String, int>);
+  Expect.isFalse(val.convert2 is Convert<int, String>);
+  Expect.isFalse(val.convert2 is Other);
+}
+
+test3() {
+  Expect.isTrue(convert is Convert);
+  Expect.isTrue(convert is Convert<String, String>);
+  Expect.isTrue(convert is Convert<String, int>);
+  Expect.isTrue(convert is Convert<int, String>);
+  Expect.isFalse(convert is Other);
+}
+
+main() {
+  test1(); /// 01: ok
+  test2(); /// 02: ok
+  test3(); /// 03: ok
+}
\ No newline at end of file
diff --git a/tests/language/generic_methods_generic_function_parameter_test.dart b/tests/language/generic_methods_generic_function_parameter_test.dart
index 45014c4..3992286 100644
--- a/tests/language/generic_methods_generic_function_parameter_test.dart
+++ b/tests/language/generic_methods_generic_function_parameter_test.dart
@@ -7,11 +7,11 @@
 import "package:expect/expect.dart";
 
 class C<T> {
-  bar<V>(T t, int u, V v) => t + u + v;
-  foo<U>(bar<V>(T t, U u, V v)) => bar<int>(1, 2, 3);
+  bar<V>(T t, int u, V v) => t.toString() + u.toString() + v.toString();
+  foo<U>(bar<V>(T t, U u, V v)) => bar<int>(1 as T, 2 as U, 3);
 }
 
 main() {
   var c = new C<int>();
-  Expect.equals(6, c.foo<int>(c.bar));
+  Expect.equals("123", c.foo<int>(c.bar));
 }
diff --git a/tests/language/generic_methods_type_expression_test.dart b/tests/language/generic_methods_type_expression_test.dart
index ccf24bc..4597370 100644
--- a/tests/language/generic_methods_type_expression_test.dart
+++ b/tests/language/generic_methods_type_expression_test.dart
@@ -12,11 +12,11 @@
 
 import "package:expect/expect.dart";
 
-bool f1<T>(Object o) => o is T;
+bool f1<T>(Object o) => o is T;   /// 01: static type warning
 
 bool f2<T>(Object o) => o is List<T>;
 
-bool f3<T>(Object o) => o is! T;
+bool f3<T>(Object o) => o is! T;   /// 03: static type warning
 
 bool f4<T>(Object o) => o is! List<T>;
 
@@ -42,12 +42,12 @@
 main() {
   String s = "Hello!";
   List<String> ss = <String>[s];
-  Expect.throws(() => f1<int>(42), (e) => e is TypeError);
-  Expect.throws(() => f1<String>(42), (e) => e is TypeError);
+  Expect.throws(() => f1<int>(42), (e) => e is TypeError);  /// 01: continued
+  Expect.throws(() => f1<String>(42), (e) => e is TypeError);  /// 01: continued
   Expect.equals(f2<int>(<int>[42]), true);
   Expect.equals(f2<String>(<int>[42]), true); // `is List<dynamic>` is true.
-  Expect.throws(() => f3<int>(42), (e) => e is TypeError);
-  Expect.throws(() => f3<String>(42), (e) => e is TypeError);
+  Expect.throws(() => f3<int>(42), (e) => e is TypeError);  /// 03: continued
+  Expect.throws(() => f3<String>(42), (e) => e is TypeError);  /// 03: continued
   Expect.equals(f4<int>(<int>[42]), false);
   Expect.equals(f4<String>(<int>[42]), false); // `is! List<dynamic>` is false.
   Expect.equals(f5<String>(s), s); // `s as dynamic == s`
diff --git a/tests/language/initializing_formal_access_test.dart b/tests/language/initializing_formal_access_test.dart
index 71f445e..79ce73f 100644
--- a/tests/language/initializing_formal_access_test.dart
+++ b/tests/language/initializing_formal_access_test.dart
@@ -1,9 +1,6 @@
 // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-//
-// DartOptions=--initializing-formal-access
-// VMOptions=--initializing-formal-access
 
 import "package:expect/expect.dart";
 
diff --git a/tests/language/initializing_formal_capture_test.dart b/tests/language/initializing_formal_capture_test.dart
index 8257d4f..3fd2d2c 100644
--- a/tests/language/initializing_formal_capture_test.dart
+++ b/tests/language/initializing_formal_capture_test.dart
@@ -1,9 +1,6 @@
 // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-//
-// DartOptions=--initializing-formal-access
-// VMOptions=--initializing-formal-access
 
 import "package:expect/expect.dart";
 
diff --git a/tests/language/initializing_formal_final_test.dart b/tests/language/initializing_formal_final_test.dart
index 3df4ba5..9cda9fe 100644
--- a/tests/language/initializing_formal_final_test.dart
+++ b/tests/language/initializing_formal_final_test.dart
@@ -1,9 +1,6 @@
 // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-//
-// DartOptions=--initializing-formal-access
-// VMOptions=--initializing-formal-access
 
 import "package:expect/expect.dart";
 
diff --git a/tests/language/initializing_formal_promotion_test.dart b/tests/language/initializing_formal_promotion_test.dart
index 89ec79e..822d2d21 100644
--- a/tests/language/initializing_formal_promotion_test.dart
+++ b/tests/language/initializing_formal_promotion_test.dart
@@ -1,9 +1,6 @@
 // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-//
-// DartOptions=--initializing-formal-access
-// VMOptions=--initializing-formal-access
 
 import "package:expect/expect.dart";
 
diff --git a/tests/language/initializing_formal_scope_test.dart b/tests/language/initializing_formal_scope_test.dart
index 5544a8e..f75308f 100644
--- a/tests/language/initializing_formal_scope_test.dart
+++ b/tests/language/initializing_formal_scope_test.dart
@@ -1,9 +1,6 @@
 // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-//
-// DartOptions=--initializing-formal-access
-// VMOptions=--initializing-formal-access
 
 import "package:expect/expect.dart";
 
diff --git a/tests/language/initializing_formal_type_test.dart b/tests/language/initializing_formal_type_test.dart
index af44444..5f3134c 100644
--- a/tests/language/initializing_formal_type_test.dart
+++ b/tests/language/initializing_formal_type_test.dart
@@ -1,9 +1,6 @@
 // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
-//
-// DartOptions=--initializing-formal-access
-// VMOptions=--initializing-formal-access
 
 import "package:expect/expect.dart";
 
diff --git a/tests/language/language.status b/tests/language/language.status
index c0489a5..717b3d4 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -5,10 +5,9 @@
 # This directory contains tests that are intended to show the
 # current state of the language.
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) ]
-tearoff_constructor_basic_test: Skip # Crashes in checked mode -- hausner investigating
-generic_methods_type_expression_test: RuntimeError # Issue 25869
-
+# These test entries will be valid for vm/dartium (with and without kernel).
+[ $compiler == none || $compiler == app_jit || $compiler == dartk || $runtime == dart_precompiled ]
+async_star_cancel_while_paused_test: RuntimeError
 # This is OK for now, but we may want to change the semantics to match the test.
 async_star_pause_test: Fail, OK
 
@@ -22,6 +21,8 @@
 constructor5_test: Fail # Issue 6422
 constructor6_test: Fail # Issue 6422
 
+generic_methods_type_expression_test: RuntimeError # Issue 25869 / 27460
+
 # Failures related to super call in ctor initializer list
 super_test: Fail, OK
 final_field_initialization_order_test: Fail, OK
@@ -30,28 +31,25 @@
 constructor3_test: Fail, OK
 constructor2_test: Fail, OK
 
-dynamic_prefix_core_test/01: RuntimeError # Issue 12478
-multiline_strings_test: Fail # Issue 23020
-
 # Regular bugs which should be fixed.
 duplicate_export_negative_test: Fail # Issue 6134
 
-deferred_redirecting_factory_test: Fail # Issue 23408
-redirecting_constructor_initializer_test: RuntimeError # Issue 23488
-
 # Non-contractive types are not supported in the vm.
 cyclic_type_test/02: Fail, OK
 cyclic_type_test/04: Fail, OK
 cyclic_type2_test: Fail, OK
 least_upper_bound_expansive_test/*: Fail, OK
 
+[ $compiler == none || $compiler == precompiler || $compiler == app_jit ]
+dynamic_prefix_core_test/01: RuntimeError # Issue 12478
+multiline_strings_test: Fail # Issue 23020
+
+deferred_redirecting_factory_test: Fail # Issue 23408
+redirecting_constructor_initializer_test: RuntimeError # Issue 23488
+
 async_star_regression_2238_test: CompileTimeError, RuntimeError # drt only runtime-errs.
-async_star_cancel_while_paused_test: RuntimeError
 
-# Fails because `as T` is an error rather than being treated like `as dynamic`.
-generic_methods_type_expression_test: RuntimeError # Issue 27460
-
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $checked ]
+[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $checked ]
 # These generic functions tests pass for the wrong reason in checked mode,
 # because the parsed type parameters are mapped to dynamic type.
 generic_methods_function_type_test: Pass # Issue 25869
@@ -61,17 +59,15 @@
 generic_functions_test: Pass # Issue 25869
 generic_methods_generic_function_parameter_test: Pass # Issue 25869
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
-
+[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && ($runtime == vm || $runtime == dart_precompiled) ]
 class_keyword_test/02: MissingCompileTimeError # Issue 13627
 unicode_bom_test: Fail # Issue 16067
 vm/debug_break_enabled_vm_test/01: Crash, OK # Expected to hit breakpoint.
-try_catch_optimized1_test: Skip # Srdjan investigating
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $checked ]
+[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $checked ]
 type_variable_bounds4_test/01: Fail # Issue 14006
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && (($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) || $runtime == drt || $runtime == dartium) ]
+[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && (($runtime == vm || $runtime == dart_precompiled) || $runtime == drt || $runtime == dartium) ]
 dynamic_prefix_core_test/none: Fail # Issue 12478
 export_ambiguous_main_negative_test: Fail # Issue 14763
 
@@ -89,6 +85,7 @@
 vm/type_vm_test: Fail # Issue 14651.
 
 [ $compiler == none && ($runtime == dartium || $runtime == drt) ]
+# Other issues.
 issue13474_test: Pass, Fail # Issue 14651.
 config_import_test: Fail # Issue 14651.
 vm/optimized_guarded_field_isolates_test: RuntimeError, OK  # Uses Isolate.spawn.
@@ -100,6 +97,7 @@
 main_test/42: Fail # Issue 20028
 mirror_in_static_init_test: Fail # Issue 22071
 vm/debug_break_enabled_vm_test/*: Skip # Issue 14651.
+vm/regress_28325_test: SkipByDesign  # Requires dart:io
 
 # These tests need the flag --initializing-formal-access to pass:
 initializing_formal_access_test: Skip
@@ -130,16 +128,16 @@
 [ $compiler == none && $runtime == drt ]
 disassemble_test: Pass, Fail # Issue 18122
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $arch == mips && $mode == debug ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $arch == mips && $mode == debug ]
 large_class_declaration_test: SkipSlow # Times out. Issue 20352
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $arch == arm64 ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $arch == arm64 ]
 large_class_declaration_test: SkipSlow # Uses too much memory.
 
 [ $compiler == none && ($runtime == dartium || $runtime == drt) && $mode == debug ]
 large_class_declaration_test: SkipSlow # Times out. Issue 20352
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && ( $arch == simarm || $arch == arm || $arch == simarmv6 || $arch == armv6 || $arch == simarmv5te || $arch == armv5te || $arch == simarm64 || $arch == arm64 || $arch == simmips || $arch == mips) ]
+[ ($runtime == vm || $runtime == dart_precompiled) && ( $arch == simarm || $arch == arm || $arch == simarmv6 || $arch == armv6 || $arch == simarmv5te || $arch == armv5te || $arch == simarm64 || $arch == arm64 || $arch == simmips || $arch == mips) ]
 vm/load_to_load_unaligned_forwarding_vm_test: Pass, Crash # Unaligned offset. Issue 22151
 vm/unaligned_float_access_literal_index_test: Pass, Crash # Unaligned offset. Issue 22151
 vm/unaligned_float_access_literal_index_test: Pass, Crash # Unaligned offset. Issue 22151
@@ -148,13 +146,13 @@
 [ $compiler == none && ($runtime == dartium || $runtime == drt) ]
 issue23244_test: Fail # Issue 23244
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && (($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) || $runtime == drt || $runtime == dartium) && $arch == ia32 ]
+[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && (($runtime == vm || $runtime == dart_precompiled) || $runtime == drt || $runtime == dartium) && $arch == ia32 ]
 vm/regress_24517_test: Pass, Fail # Issue 24517.
 
 [ $compiler == precompiler && $runtime == dart_precompiled ]
 vm/regress_27671_test: Skip # Unsupported
 
-[ $noopt || $compiler == precompiler ]
+[ $runtime == dart_precompiled ]
 # Stacktraces in precompilation omit inlined frames.
 full_stacktrace1_test: Pass, RuntimeError
 full_stacktrace2_test: Pass, RuntimeError
@@ -163,9 +161,10 @@
 stacktrace_rethrow_error_test: Pass, RuntimeError
 stacktrace_rethrow_nonerror_test: Pass, RuntimeError
 stacktrace_test: Pass, RuntimeError
-regress_26948_test: Skip # Crashes, regis investigating
+vm/regress_28325_test: RuntimeError  # Missing source position in AOT.
 
-[ $noopt || $compiler == precompiler || $mode == product ]
+
+[ $runtime == dart_precompiled || $mode == product ]
 # Imports dart:mirrors
 const_evaluation_test: SkipByDesign
 deferred_constraints_constants_test: SkipByDesign
@@ -187,28 +186,15 @@
 super_call4_test: SkipByDesign
 super_getter_setter_test: SkipByDesign
 vm/reflect_core_vm_test: SkipByDesign
+regress_28255_test: SkipByDesign
 
-[ $noopt ]
-# Deferred loading happens eagerly. Issue #27587
-regress_23408_test: Fail
-deferred_inheritance_constraints_test/redirecting_constructor: Fail
-deferred_global_test: Fail
-deferred_load_constants_test/02: Fail
-deferred_load_constants_test/03: Fail
-deferred_load_constants_test/05: Fail
-tearoff_basic_test: Fail
-regress_22443_test: Fail
-deferred_not_loaded_check_test: Fail
-vm/regress_27201_test: Fail
-
-[ $mode == product || $compiler == dart2appjit || $compiler == dart2app || $compiler == precompiler ]
+[ $mode == product || $compiler == app_jit || $compiler == precompiler ]
 # Deferred loading happens eagerly. Issue #27587
 regress_23408_test: Fail
 deferred_inheritance_constraints_test/redirecting_constructor: Fail
 deferred_load_constants_test/02: Fail
 deferred_load_constants_test/03: Fail
 deferred_load_constants_test/05: Fail
-tearoff_basic_test: Fail
 deferred_not_loaded_check_test: Fail
 vm/regress_27201_test: Fail
 
@@ -217,15 +203,13 @@
 deferred_global_test: Fail
 vm/regress_27201_test: Fail
 
-[ $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
-ct_const2_test: Skip # Incompatible flag: --compile_all
-hello_dart_test: Skip # Incompatible flag: --compile_all
-
 [ $compiler == precompiler ]
 implicit_closure_test: Skip # Incompatible flag: --use_slow_path
 deopt_inlined_function_lazy_test: Skip # Incompatible flag: --deoptimize-alot
 
-[ $noopt || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
+[ $runtime == dart_precompiled || $compiler == app_jit ]
+ct_const2_test: Skip # Incompatible flag: --compile_all
+hello_dart_test: Skip # Incompatible flag: --compile_all
 vm/type_vm_test: RuntimeError # Expects line and column numbers
 vm/type_cast_vm_test: RuntimeError # Expects line and column numbers
 
@@ -245,21 +229,21 @@
 vm/type_vm_test: Fail,OK  # Expects exact type name.
 
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $browser ]
+[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $browser ]
 # The following tests are supposed to fail.
 library_env_test/has_io_support: RuntimeError, OK
 library_env_test/has_no_html_support: RuntimeError, OK
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $browser != true ]
+[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) && $browser != true ]
 # The following tests are supposed to fail.
 library_env_test/has_html_support: RuntimeError, OK
 library_env_test/has_no_io_support: RuntimeError, OK
 
-[ ($compiler == none || $compiler == dart2app || $compiler == dart2appjit) && $noopt == false && $mode != product ]
+[ ($compiler == none || $compiler == app_jit) && $mode != product ]
 # The following tests are supposed to fail.
 library_env_test/has_no_mirror_support: RuntimeError, OK
 
-[ $noopt || $compiler == precompiler || $mode == product ]
+[ $runtime == dart_precompiled || $mode == product ]
 # The following tests are supposed to fail.
 library_env_test/has_mirror_support: RuntimeError, OK
 
@@ -296,7 +280,7 @@
 issue_1751477_test: Crash # Requires deferred libraries
 regress_23408_test: Crash # Requires deferred libraries
 regress_22443_test: Crash # Requires deferred libraries
-tearoff_basic_test: Crash # Requires deferred libraries
+regress_28278_test: Crash # Requires deferred libraries
 conditional_import_test: Crash # Requires deferred libraries
 conditional_import_string_test: Crash # Requires deferred libraries
 override_field_method1_negative_test: Pass, Crash # Issue 27835
@@ -320,5 +304,17 @@
 [$runtime == vm && $compiler == none]
 duplicate_part_test/01: MissingCompileTimeError # Issue 27516
 
+[$runtime == vm && $compiler == none && $system == windows && $arch == ia32]
+vm/optimized_stacktrace_test: Pass, Crash # Issue 28276
+
+[$runtime == vm && $compiler == none && $system == fuchsia]
+# Use package:unittest
+async_await_test: RuntimeError
+async_star_test: RuntimeError
+# TODO(zra): Investigate
+vm/regress_28325_test: RuntimeError
+closure_cycles_test: Crash
+
 [$compiler == dart2analyzer]
 vm/regress_27201_test: SkipByDesign # Loads bad library, so will always crash.
+config_import_corelib_test: StaticWarning, OK
diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status
index 72203db..a0d13a5 100644
--- a/tests/language/language_analyzer2.status
+++ b/tests/language/language_analyzer2.status
@@ -10,15 +10,15 @@
 # Runtime negative test. No static errors or warnings.
 closure_call_wrong_argument_count_negative_test: skip
 
+# No longer support the old use of typedef to define a mixin
+mixin_illegal_syntax_test/00: Crash
+
 deep_nesting1_negative_test: Crash # Issue 25558
 deep_nesting2_negative_test: Crash # Issue 25558
 
 enum_syntax_test/05: Fail # 21649
 enum_syntax_test/06: Fail # 21649
 
-tearoff_basic_test: Skip # Tear-off not supported
-tearoff_constructor_basic_test: Skip # Tear-off not supported
-
 regress_17382_test: Skip # don't care about the static warning.
 regress_23408_test: Skip # don't care about the static warning.
 regress_25246_test: Skip
@@ -45,6 +45,10 @@
 
 const_for_in_variable_test/01: MissingCompileTimeError # Issue 25161
 
+generic_function_typedef_test: Crash # Issue 27969
+generic_function_typedef2_test: Crash # Issue 27969
+generalized_function_type_test: Crash # Issue 27969
+
 # Please add new failing tests before this line.
 # Section below is for invalid tests.
 #
@@ -69,9 +73,6 @@
 interface_test/none: fail # Issue 11575
 syntax_test/none: fail # Issue 11575
 
-# test issue 11576
-bad_constructor_test/none: fail # Issue 11576
-
 # test issue 11577, has return type for []=
 cascade_test/none: fail # Issue 11577
 
@@ -156,9 +157,6 @@
 # test issue 14228
 black_listed_test/none: fail # test issue 14228, warnings are required but not expected
 
-# test issue 14410, "typedef C = " is now really illegal syntax
-mixin_illegal_syntax_test/none: fail
-
 # test issue 14736, It is a static warning if a class C declares an instance method named n and has a setter named n=.
 setter4_test: StaticWarning
 
@@ -182,7 +180,6 @@
 # The following tests are currently assumed to be failing because the test is wrong.
 #
 application_negative_test: CompileTimeError # Test Issue 14528
-bad_constructor_test/05: CompileTimeError # Test Issue 5337
 bad_initializer1_negative_test: CompileTimeError # Test Issue 14529
 bad_named_constructor_negative_test: CompileTimeError # Test Issue 18693
 body_less_constructor_wrong_arg_negative_test: CompileTimeError # Test Issue 18695
@@ -292,7 +289,6 @@
 method_override6_test: StaticWarning
 method_override_test: StaticWarning
 mixin_illegal_static_access_test: StaticWarning
-mixin_illegal_syntax_test/13: CompileTimeError
 mixin_type_parameters_mixin_extends_test: StaticWarning
 mixin_type_parameters_mixin_test: StaticWarning
 mixin_type_parameters_super_extends_test: StaticWarning
@@ -496,10 +492,6 @@
 for_in3_test: StaticWarning, OK # Test should have warning by design.
 for_in_side_effects_test: StaticWarning, OK # Test uses custom class that does not implement Iterable in for-in.
 
-# Experimental feature: Syntactic support for generic methods.
-generic_methods_type_expression_test: StaticWarning # Issue 25868
-generic_methods_generic_function_parameter_test: StaticWarning # Issue 25868
-
 # Experimental feature: Use initializing formals in initializers and constructor body.
 initializing_formal_type_test: StaticWarning # Issue 26658
 
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 4d5379c..49d844c 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -3,14 +3,14 @@
 # BSD-style license that can be found in the LICENSE file.
 
 [ $compiler == dart2js ]
+enum_test: Fail # Issue 28340
+regress_28341_test: Fail # Issue 28340
 deferred_not_loaded_check_test: Fail # Issue 27577
 getter_setter_in_lib_test: Fail # Issue 23288
 method_name_test: Fail # issue 25574
 setter4_test: CompileTimeError # issue 13639
 
 async_star_cancel_while_paused_test: RuntimeError # Issue 22853
-tearoff_basic_test: Skip # Tear-off not supported
-tearoff_constructor_basic_test: Skip # Tear-off not supported
 
 try_catch_on_syntax_test/10: Fail # Issue 19823
 try_catch_on_syntax_test/11: Fail # Issue 19823
@@ -39,6 +39,19 @@
 
 duplicate_part_test/01: MissingCompileTimeError # Issue 27517
 
+bad_typedef_test/00: Crash # Issue 28214
+
+covariant_test/02: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+covariant_test/08: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+covariant_test/12: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+covariant_test/14: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+covariant_test/16: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+covariant_test/22: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+covariant_test/28: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+covariant_test/32: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+covariant_test/34: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+covariant_test/36: MissingCompileTimeError, OK # Accepts `covariant` for statics/top-level.
+
 [ $compiler == dart2js && $fast_startup ]
 const_evaluation_test/*: Fail # mirrors not supported
 deferred_constraints_constants_test/none: Fail # mirrors not supported
@@ -62,14 +75,11 @@
 regress_13462_0_test: Fail # mirrors not supported
 regress_13462_1_test: Fail # mirrors not supported
 regress_18535_test: Fail # mirrors not supported
+regress_28255_test: Fail # mirrors not supported
 super_call4_test: Fail # mirrors not supported
 super_getter_setter_test: Fail # mirrors not supported
 vm/reflect_core_vm_test: Fail # mirrors not supported
 
-[ $compiler == dart2js && $fast_startup && $checked ]
-generic_local_functions_test: Fail # reified type for generic function not generated correctly
-generic_methods_generic_function_parameter_test: Fail # reified type for generic function not generated correctly
-
 [ $compiler == dart2js && $runtime == jsshell ]
 await_for_test: Skip # Jsshell does not provide periodic timers, Issue 7728
 async_star_test: RuntimeError # Jsshell does not provide non-zero timers, Issue 7728
@@ -183,6 +193,7 @@
 cyclic_type_test/0*: Fail # Issue 12605
 cyclic_type2_test: Fail # Issue 12605
 f_bounded_quantification4_test: Fail, OK # Issue 12605
+generic_closure_test: Fail # Issue 12605
 mixin_generic_test: Fail # Issue 12605
 mixin_mixin2_test: Fail # Issue 12605
 mixin_mixin3_test: Fail # Issue 12605
@@ -217,7 +228,6 @@
 modulo_test: RuntimeError # Issue 15246
 truncdiv_test: RuntimeError # Issue 15246
 invocation_mirror2_test: RuntimeError # Issue 6490 (wrong retval).
-generic_closure_test: RuntimeError # Issue 12605
 const_switch_test/02: RuntimeError # Issue 17960
 const_switch_test/04: RuntimeError # Issue 17960
 
diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status
index b5cc7b3..c53b287 100644
--- a/tests/language/language_kernel.status
+++ b/tests/language/language_kernel.status
@@ -3,409 +3,102 @@
 # BSD-style license that can be found in the LICENSE file.
 
 # These tests currently take too long. Remove when they are fixed.
-[ $compiler == dartk || $compiler == rasta ]
-large_class_declaration_test: Skip
-large_implicit_getter_test: Skip
-larger_implicit_getter_test: Skip
+[ $compiler == dartk || $compiler == dartkp ]
+large_class_declaration_test: SkipSlow  # KernelVM Issue 28312
+
+###############################################################################
+# Dartk Entries
+###############################################################################
+
+[ $compiler == dartk || $compiler == dartkp ]
+conditional_import_string_test: DartkCompileTimeError
+conditional_import_test: DartkCompileTimeError
+conflicting_type_variable_and_setter_test: DartkCompileTimeError
+const_for_in_variable_test/01: MissingCompileTimeError
+constructor_duplicate_final_test/03: MissingCompileTimeError
+deep_nesting1_negative_test: DartkCrash
+deep_nesting2_negative_test: DartkCrash
+enum_syntax_test/05: MissingCompileTimeError
+enum_syntax_test/06: MissingCompileTimeError
+external_test/21: MissingCompileTimeError
+external_test/24: MissingCompileTimeError
+external_test/25: MissingCompileTimeError
+final_syntax_test/01: MissingCompileTimeError
+final_syntax_test/02: MissingCompileTimeError
+final_syntax_test/03: MissingCompileTimeError
+final_syntax_test/04: MissingCompileTimeError
+metadata_test: DartkCompileTimeError
+multiline_newline_test/01: DartkCompileTimeError
+multiline_newline_test/02: DartkCompileTimeError
+multiline_newline_test/03: DartkCompileTimeError
+multiline_newline_test/04: MissingCompileTimeError
+multiline_newline_test/05: MissingCompileTimeError
+multiline_newline_test/06: MissingCompileTimeError
+not_enough_positional_arguments_test/01: DartkCompileTimeError
+regress_27617_test/1: MissingCompileTimeError
+type_variable_conflict2_test/02: MissingCompileTimeError
+vm/debug_break_enabled_vm_test/01: DartkCompileTimeError
+vm/debug_break_enabled_vm_test/none: DartkCompileTimeError
+vm/reflect_core_vm_test: DartkCompileTimeError
+vm/regress_27201_test: DartkCompileTimeError
+vm/regress_28325_test: RuntimeError  # Issue 28055.
+
+# dartk: temporary failure
+mixin_illegal_syntax_test/00: DartkCrash
+
+# Passing for the wrong reason
+language/main_not_a_function_test/01: Pass # Fails if tree shaking is disabled
 
 # dartk: JIT failures
 [ $compiler == dartk && $runtime == vm ]
-accessor_conflict_export2_test: RuntimeError
-accessor_conflict_export_test: RuntimeError
-accessor_conflict_import2_test: RuntimeError
-accessor_conflict_import_prefixed2_test: RuntimeError
-accessor_conflict_import_prefixed_test: RuntimeError
-accessor_conflict_import_test: RuntimeError
-assertion_test: RuntimeError
-async_await_test: RuntimeError
-async_star_cancel_and_throw_in_finally_test: RuntimeError
-async_star_cancel_while_paused_test: RuntimeError
-async_star_pause_test: RuntimeError
-async_star_regression_fisk_test: Timeout
-async_star_stream_take_test: Timeout
-async_star_take_reyield_test: Timeout
-async_star_test: Timeout
-asyncstar_throw_in_catch_test: Timeout
-asyncstar_yield_test: Timeout
-asyncstar_yieldstar_test: Timeout
-bad_constructor_test/05: CompileTimeError
-bad_raw_string_negative_test: Fail
-cha_deopt1_test: RuntimeError
-cha_deopt2_test: RuntimeError
-cha_deopt3_test: RuntimeError
-closure_type_variable_test: RuntimeError
-closures_initializer_test: RuntimeError
-compile_time_constant12_test: Crash
-compile_time_constant_k_test/01: RuntimeError
-compile_time_constant_k_test/02: RuntimeError
-compile_time_constant_k_test/03: RuntimeError
-compile_time_constant_o_test/01: RuntimeError
-compile_time_constant_o_test/02: RuntimeError
-conditional_import_string_test: CompileTimeError
-conditional_import_test: CompileTimeError
-config_import_test: RuntimeError
-conflicting_type_variable_and_setter_test: CompileTimeError
-const_dynamic_type_literal_test/02: RuntimeError
-const_error_multiply_initialized_test/02: RuntimeError
-const_error_multiply_initialized_test/04: RuntimeError
-const_evaluation_test/01: RuntimeError
-const_for_in_variable_test/01: MissingCompileTimeError
-const_locals_test: RuntimeError
-const_nested_test: RuntimeError
-const_string_test: RuntimeError
-constructor2_test: RuntimeError
-constructor3_test: RuntimeError
-constructor5_test: RuntimeError
-constructor6_test: RuntimeError
-constructor_duplicate_final_test/01: MissingRuntimeError
-constructor_duplicate_final_test/02: MissingRuntimeError
-constructor_duplicate_final_test/03: MissingCompileTimeError
-constructor_named_arguments_test/01: Crash
-custom_await_stack_trace_test: RuntimeError
-cyclic_type2_test: CompileTimeError
-cyclic_type_test/00: RuntimeError
-cyclic_type_test/01: RuntimeError
-cyclic_type_test/02: CompileTimeError
-cyclic_type_test/03: RuntimeError
-cyclic_type_test/04: CompileTimeError
-cyclic_type_variable_test/01: Crash
-cyclic_type_variable_test/02: Crash
-cyclic_type_variable_test/03: Crash
-cyclic_type_variable_test/04: Crash
-cyclic_type_variable_test/none: Crash
-deep_nesting1_negative_test: Crash
-deep_nesting2_negative_test: Crash
-deferred_call_empty_before_load_test: RuntimeError
-deferred_closurize_load_library_test: Crash
-deferred_constant_list_test: RuntimeError
-deferred_constraints_constants_test/none: RuntimeError
-deferred_constraints_constants_test/reference_after_load: RuntimeError
-deferred_constraints_type_annotation_test/as_operation: RuntimeError
-deferred_constraints_type_annotation_test/catch_check: RuntimeError
-deferred_constraints_type_annotation_test/is_check: RuntimeError
-deferred_constraints_type_annotation_test/new: RuntimeError
-deferred_constraints_type_annotation_test/new_before_load: RuntimeError
-deferred_constraints_type_annotation_test/new_generic1: RuntimeError
-deferred_constraints_type_annotation_test/new_generic2: RuntimeError
-deferred_constraints_type_annotation_test/new_generic3: RuntimeError
-deferred_constraints_type_annotation_test/none: RuntimeError
-deferred_constraints_type_annotation_test/static_method: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation1: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_generic1: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_generic2: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_generic3: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_generic4: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_non_deferred: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_null: RuntimeError
-deferred_constraints_type_annotation_test/type_annotation_top_level: RuntimeError
-deferred_function_type_test: RuntimeError
-deferred_global_test: RuntimeError
-deferred_import_core_test: RuntimeError
-deferred_inheritance_constraints_test/redirecting_constructor: RuntimeError
-deferred_inlined_test: RuntimeError
-deferred_load_constants_test/none: RuntimeError
-deferred_load_inval_code_test: RuntimeError
-deferred_load_library_wrong_args_test/none: RuntimeError
-deferred_mixin_test: RuntimeError
-deferred_no_such_method_test: RuntimeError
-deferred_not_loaded_check_test: RuntimeError
-deferred_only_constant_test: RuntimeError
-deferred_optimized_test: RuntimeError
-deferred_redirecting_factory_test: RuntimeError
-deferred_regression_22995_test: RuntimeError
-deferred_shadow_load_library_test: RuntimeError
-deferred_shared_and_unshared_classes_test: RuntimeError
-deferred_static_seperate_test: RuntimeError
-deferred_super_dependency_test/01: RuntimeError
-deferred_type_dependency_test/as: RuntimeError
-deferred_type_dependency_test/is: RuntimeError
-deferred_type_dependency_test/none: RuntimeError
-deferred_type_dependency_test/type_annotation: RuntimeError
-duplicate_export_negative_test: Fail
-enum_duplicate_test/01: RuntimeError
-enum_duplicate_test/02: RuntimeError
-enum_duplicate_test/none: RuntimeError
-enum_mirror_test: RuntimeError
-enum_private_test/01: RuntimeError
-enum_private_test/02: RuntimeError
-enum_private_test/none: RuntimeError
-enum_syntax_test/05: MissingCompileTimeError
-enum_syntax_test/06: MissingCompileTimeError
-enum_test: RuntimeError
-evaluation_redirecting_constructor_test: RuntimeError
-example_constructor_test: RuntimeError
-export_double_same_main_test: Crash
-export_main_test: Crash
-external_test/10: MissingRuntimeError
-external_test/13: MissingRuntimeError
-external_test/20: MissingRuntimeError
-external_test/21: MissingCompileTimeError
-external_test/24: MissingCompileTimeError
-external_test/25: MissingCompileTimeError
-f_bounded_equality_test: RuntimeError
-field_initialization_order_test: RuntimeError
-final_field_initialization_order_test: RuntimeError
-final_syntax_test/01: MissingCompileTimeError
-final_syntax_test/02: MissingCompileTimeError
-final_syntax_test/03: MissingCompileTimeError
-final_syntax_test/04: MissingCompileTimeError
-fixed_type_variable2_test/02: RuntimeError
-fixed_type_variable2_test/04: RuntimeError
-fixed_type_variable2_test/06: RuntimeError
-fixed_type_variable_test/01: RuntimeError
-fixed_type_variable_test/02: RuntimeError
-fixed_type_variable_test/03: RuntimeError
-fixed_type_variable_test/04: RuntimeError
-fixed_type_variable_test/05: RuntimeError
-fixed_type_variable_test/06: RuntimeError
-for2_test: RuntimeError
-for_variable_capture_test: RuntimeError
-function_subtype2_test: RuntimeError
-function_subtype_bound_closure3_test: RuntimeError
-function_subtype_bound_closure4_test: RuntimeError
-function_subtype_cast1_test: RuntimeError
-function_subtype_inline0_test: RuntimeError
-function_subtype_local3_test: RuntimeError
-function_subtype_local4_test: RuntimeError
-function_subtype_not1_test: RuntimeError
-function_type_alias2_test: RuntimeError
-function_type_alias3_test: RuntimeError
-function_type_alias4_test: RuntimeError
-generic2_test: RuntimeError
-generic_closure_test: RuntimeError
-generic_creation_test: RuntimeError
-generic_field_mixin2_test: RuntimeError
-generic_field_mixin4_test: RuntimeError
-generic_field_mixin5_test: RuntimeError
-generic_functions_test: Crash
-generic_inheritance_test: RuntimeError
-generic_local_functions_test: Crash
-generic_methods_function_type_test: Crash
-generic_methods_generic_function_parameter_test: Crash
-generic_methods_new_test: Crash
-generic_methods_test: Crash
-generic_methods_type_expression_test: Crash
-generic_test: RuntimeError
-getter_closure_execution_order_test: RuntimeError
-getter_setter_in_lib_test: RuntimeError
-inferrer_closure_test: RuntimeError
-initializing_formal_final_test: RuntimeError
-instance_creation_in_function_annotation_test: RuntimeError
-is_not_class2_test: RuntimeError
-issue13474_test: RuntimeError
-issue_1751477_test: RuntimeError
-least_upper_bound_expansive_test/01: CompileTimeError
-least_upper_bound_expansive_test/02: CompileTimeError
-least_upper_bound_expansive_test/03: CompileTimeError
-least_upper_bound_expansive_test/04: CompileTimeError
-least_upper_bound_expansive_test/05: CompileTimeError
-least_upper_bound_expansive_test/06: CompileTimeError
-least_upper_bound_expansive_test/07: CompileTimeError
-least_upper_bound_expansive_test/08: CompileTimeError
-least_upper_bound_expansive_test/09: CompileTimeError
-least_upper_bound_expansive_test/10: CompileTimeError
-least_upper_bound_expansive_test/11: CompileTimeError
-least_upper_bound_expansive_test/12: CompileTimeError
-least_upper_bound_expansive_test/none: CompileTimeError
-library_env_test/has_html_support: RuntimeError
-library_env_test/has_no_io_support: RuntimeError
-library_env_test/has_no_mirror_support: RuntimeError
-list_literal4_test: RuntimeError
-main_not_a_function_test/01: Crash
-malformed_test/none: RuntimeError
-map_literal3_test: RuntimeError
-map_literal4_test: RuntimeError
-map_literal6_test: RuntimeError
-metadata_test: CompileTimeError
-method_override_test: RuntimeError
-mixin_generic_test: RuntimeError
-mixin_illegal_super_use_test/01: MissingCompileTimeError
-mixin_illegal_super_use_test/02: MissingCompileTimeError
-mixin_illegal_super_use_test/03: MissingCompileTimeError
-mixin_illegal_super_use_test/04: MissingCompileTimeError
-mixin_illegal_super_use_test/05: MissingCompileTimeError
-mixin_illegal_super_use_test/06: MissingCompileTimeError
-mixin_illegal_super_use_test/07: MissingCompileTimeError
-mixin_illegal_super_use_test/08: MissingCompileTimeError
-mixin_illegal_super_use_test/09: MissingCompileTimeError
-mixin_illegal_super_use_test/10: MissingCompileTimeError
-mixin_illegal_super_use_test/11: MissingCompileTimeError
-mixin_illegal_superclass_test/01: MissingCompileTimeError
-mixin_illegal_superclass_test/02: MissingCompileTimeError
-mixin_illegal_superclass_test/03: MissingCompileTimeError
-mixin_illegal_superclass_test/04: MissingCompileTimeError
-mixin_illegal_superclass_test/05: MissingCompileTimeError
-mixin_illegal_superclass_test/06: MissingCompileTimeError
-mixin_illegal_superclass_test/07: MissingCompileTimeError
-mixin_illegal_superclass_test/08: MissingCompileTimeError
-mixin_illegal_superclass_test/09: MissingCompileTimeError
-mixin_illegal_superclass_test/10: MissingCompileTimeError
-mixin_illegal_superclass_test/11: MissingCompileTimeError
-mixin_illegal_superclass_test/12: MissingCompileTimeError
-mixin_illegal_superclass_test/13: MissingCompileTimeError
-mixin_illegal_superclass_test/14: MissingCompileTimeError
-mixin_illegal_superclass_test/15: MissingCompileTimeError
-mixin_illegal_superclass_test/16: MissingCompileTimeError
-mixin_illegal_superclass_test/17: MissingCompileTimeError
-mixin_illegal_superclass_test/18: MissingCompileTimeError
-mixin_illegal_superclass_test/19: MissingCompileTimeError
-mixin_illegal_superclass_test/20: MissingCompileTimeError
-mixin_illegal_superclass_test/21: MissingCompileTimeError
-mixin_illegal_superclass_test/22: MissingCompileTimeError
-mixin_illegal_superclass_test/23: MissingCompileTimeError
-mixin_illegal_superclass_test/24: MissingCompileTimeError
-mixin_illegal_superclass_test/25: MissingCompileTimeError
-mixin_illegal_superclass_test/26: MissingCompileTimeError
-mixin_illegal_superclass_test/27: MissingCompileTimeError
-mixin_illegal_superclass_test/28: MissingCompileTimeError
-mixin_illegal_superclass_test/29: MissingCompileTimeError
-mixin_illegal_superclass_test/30: MissingCompileTimeError
-mixin_illegal_syntax_test/13: CompileTimeError
-mixin_illegal_syntax_test/none: CompileTimeError
-mixin_mixin2_test: RuntimeError
-mixin_mixin3_test: RuntimeError
-mixin_mixin4_test: RuntimeError
-mixin_mixin5_test: RuntimeError
-mixin_mixin_bound2_test: RuntimeError
-mixin_mixin_bound_test: RuntimeError
-mixin_super_test: RuntimeError
-mixin_type_parameters_simple_test: RuntimeError
-mixin_type_parameters_super_extends_test: RuntimeError
-mixin_type_parameters_super_test: RuntimeError
-multiline_newline_test/01: CompileTimeError
-multiline_newline_test/02: CompileTimeError
-multiline_newline_test/03: CompileTimeError
-multiline_newline_test/04: MissingCompileTimeError
-multiline_newline_test/05: MissingCompileTimeError
-multiline_newline_test/06: MissingCompileTimeError
-multiline_newline_test/none: RuntimeError
-named_parameters_type_test/01: MissingRuntimeError
-named_parameters_type_test/02: MissingRuntimeError
-named_parameters_type_test/03: MissingRuntimeError
-no_main_test/01: Crash
-not_enough_positional_arguments_test/01: CompileTimeError
-not_enough_positional_arguments_test/02: MissingRuntimeError
-not_enough_positional_arguments_test/05: MissingRuntimeError
-null_test/none: RuntimeError
-number_identifier_test/05: RuntimeError
-positional_parameters_type_test/01: MissingRuntimeError
-positional_parameters_type_test/02: MissingRuntimeError
-prefix10_negative_test: Fail
-prefix21_test: RuntimeError
-redirecting_constructor_initializer_test: RuntimeError
-redirecting_factory_reflection_test: RuntimeError
-regress_18713_test: RuntimeError
-regress_22443_test: RuntimeError
-regress_22700_test: RuntimeError
-regress_23408_test: RuntimeError
-regress_27164_test: CompileTimeError
-regress_27617_test/1: MissingCompileTimeError
-regress_r24720_test: RuntimeError
+config_import_corelib_test: RuntimeError
 reify_typevar_static_test/00: MissingCompileTimeError
-reify_typevar_test: RuntimeError
-script1_negative_test: Fail
-script2_negative_test: Fail
-setter_no_getter_call_test/none: RuntimeError
-static_setter_get_test/01: RuntimeError
-super_call3_test/01: Crash
-super_test: RuntimeError
-switch7_negative_test: Fail
-switch_try_catch_test: RuntimeError
-sync_generator3_test/test2: RuntimeError
-tearoff_basic_test: CompileTimeError
-tearoff_constructor_basic_test: CompileTimeError
-try_catch_on_syntax_test/10: MissingRuntimeError
-try_catch_on_syntax_test/11: MissingRuntimeError
-try_finally_regress_25654_test: RuntimeError
-type_checks_in_factory_method_test: RuntimeError
-type_parameter_literal_test: RuntimeError
-type_variable_conflict2_test/02: MissingCompileTimeError
 type_variable_conflict2_test/06: MissingCompileTimeError
 type_variable_conflict2_test/08: MissingCompileTimeError
 type_variable_conflict2_test/10: MissingCompileTimeError
-type_variable_function_type_test: RuntimeError
-vm/debug_break_enabled_vm_test/01: CompileTimeError
-vm/debug_break_enabled_vm_test/none: CompileTimeError
-vm/reflect_core_vm_test: CompileTimeError
-vm/type_cast_vm_test: RuntimeError
-vm/type_vm_test: RuntimeError
-
-# dartk: JIT failures (debug)
-[ $compiler == dartk && $runtime == vm && $mode == debug ]
-async_star_regression_fisk_test: Crash  # Stack mismatch during expression translation.
-async_star_test: Crash  # Stack mismatch during expression translation.
-issue23244_test: Crash  # Class finalization issue
-not_enough_positional_arguments_test/02: Crash  # Crash
-not_enough_positional_arguments_test/05: Crash  # Crash
-vm/optimized_guarded_field_isolates_test: Crash  # Class finalization issue
-generic_sends_test: Crash  # Crash
 
 # dartk: precompilation failures
 [ $compiler == dartkp && $runtime == dart_precompiled ]
+config_import_corelib_test: RuntimeError
+
+###############################################################################
+# VM Entries
+###############################################################################
+
+# dartk: Shared JIT & Precompilation failures
+[ ($compiler == dartk && $runtime == vm) || ($compiler == dartkp && $runtime == dart_precompiled) ]
 accessor_conflict_export2_test: RuntimeError
 accessor_conflict_export_test: RuntimeError
 accessor_conflict_import2_test: RuntimeError
 accessor_conflict_import_prefixed2_test: RuntimeError
 accessor_conflict_import_prefixed_test: RuntimeError
 accessor_conflict_import_test: RuntimeError
-assertion_test: RuntimeError
-async_await_test: RuntimeError
-async_star_cancel_and_throw_in_finally_test: RuntimeError
-async_star_cancel_while_paused_test: RuntimeError
-async_star_pause_test: RuntimeError
-async_star_regression_fisk_test: Timeout
-async_star_stream_take_test: Timeout
-async_star_take_reyield_test: Timeout
-async_star_test: Timeout
-asyncstar_throw_in_catch_test: Timeout
-asyncstar_yield_test: Timeout
-asyncstar_yieldstar_test: Timeout
-bad_constructor_test/05: CompileTimeError
 bad_raw_string_negative_test: Fail
-cha_deopt1_test: RuntimeError
-cha_deopt2_test: RuntimeError
-cha_deopt3_test: RuntimeError
-closure_type_variable_test: RuntimeError
-closures_initializer_test: RuntimeError
-compile_time_constant12_test: Crash
+cha_deopt1_test: RuntimeError  # Deferred Loading Issue 28335
+cha_deopt2_test: RuntimeError  # Deferred Loading Issue 28335
+cha_deopt3_test: RuntimeError  # Deferred Loading Issue 28335
 compile_time_constant_k_test/01: RuntimeError
 compile_time_constant_k_test/02: RuntimeError
 compile_time_constant_k_test/03: RuntimeError
 compile_time_constant_o_test/01: RuntimeError
 compile_time_constant_o_test/02: RuntimeError
-conditional_import_string_test: CompileTimeError
-conditional_import_test: CompileTimeError
 config_import_test: RuntimeError
-conflicting_type_variable_and_setter_test: CompileTimeError
 const_dynamic_type_literal_test/02: RuntimeError
 const_error_multiply_initialized_test/02: RuntimeError
 const_error_multiply_initialized_test/04: RuntimeError
-const_evaluation_test/01: Crash
-const_for_in_variable_test/01: MissingCompileTimeError
 const_nested_test: RuntimeError
-constructor2_test: RuntimeError
-constructor3_test: RuntimeError
-constructor5_test: RuntimeError
-constructor6_test: RuntimeError
 constructor_duplicate_final_test/01: MissingRuntimeError
 constructor_duplicate_final_test/02: MissingRuntimeError
-constructor_duplicate_final_test/03: MissingCompileTimeError
-custom_await_stack_trace_test: RuntimeError
-cyclic_type2_test: CompileTimeError
 cyclic_type_test/00: RuntimeError
 cyclic_type_test/01: RuntimeError
-cyclic_type_test/02: CompileTimeError
 cyclic_type_test/03: RuntimeError
-cyclic_type_test/04: CompileTimeError
 cyclic_type_variable_test/01: Crash
 cyclic_type_variable_test/02: Crash
 cyclic_type_variable_test/03: Crash
 cyclic_type_variable_test/04: Crash
 cyclic_type_variable_test/none: Crash
-deep_nesting1_negative_test: Crash
-deep_nesting2_negative_test: Crash
-deferred_call_empty_before_load_test: RuntimeError
-deferred_closurize_load_library_test: Crash
+deferred_call_empty_before_load_test: RuntimeError # Deferred Loading Issue 28335
+deferred_closurize_load_library_test: RuntimeError
 deferred_constant_list_test: RuntimeError
 deferred_constraints_constants_test/none: RuntimeError
 deferred_constraints_constants_test/reference_after_load: RuntimeError
@@ -450,47 +143,12 @@
 deferred_type_dependency_test/is: RuntimeError
 deferred_type_dependency_test/none: RuntimeError
 deferred_type_dependency_test/type_annotation: RuntimeError
-duplicate_export_negative_test: Fail
-enum_duplicate_test/01: RuntimeError
-enum_duplicate_test/02: RuntimeError
-enum_duplicate_test/none: RuntimeError
-enum_mirror_test: RuntimeError
-enum_private_test/01: RuntimeError
-enum_private_test/02: RuntimeError
-enum_private_test/none: RuntimeError
-enum_syntax_test/06: MissingCompileTimeError
-enum_test: RuntimeError
 evaluation_redirecting_constructor_test: RuntimeError
-example_constructor_test: RuntimeError
-export_double_same_main_test: Crash
-export_main_test: Crash
 external_test/10: MissingRuntimeError
 external_test/13: MissingRuntimeError
 external_test/20: MissingRuntimeError
-external_test/21: MissingCompileTimeError
-external_test/24: MissingCompileTimeError
-external_test/25: MissingCompileTimeError
-f_bounded_equality_test: RuntimeError
-field_initialization_order_test: RuntimeError
-final_field_initialization_order_test: RuntimeError
-final_syntax_test/01: MissingCompileTimeError
-final_syntax_test/02: MissingCompileTimeError
-final_syntax_test/03: MissingCompileTimeError
-final_syntax_test/04: MissingCompileTimeError
-fixed_type_variable2_test/02: RuntimeError
-fixed_type_variable2_test/04: RuntimeError
-fixed_type_variable2_test/06: RuntimeError
-fixed_type_variable_test/01: RuntimeError
-fixed_type_variable_test/02: RuntimeError
-fixed_type_variable_test/03: RuntimeError
-fixed_type_variable_test/04: RuntimeError
-fixed_type_variable_test/05: RuntimeError
-fixed_type_variable_test/06: RuntimeError
 for2_test: RuntimeError
 for_variable_capture_test: RuntimeError
-full_stacktrace1_test: RuntimeError
-full_stacktrace2_test: RuntimeError
-full_stacktrace3_test: RuntimeError
 function_subtype2_test: RuntimeError
 function_subtype_bound_closure3_test: RuntimeError
 function_subtype_bound_closure4_test: RuntimeError
@@ -502,175 +160,106 @@
 function_type_alias2_test: RuntimeError
 function_type_alias3_test: RuntimeError
 function_type_alias4_test: RuntimeError
-generic2_test: RuntimeError
 generic_closure_test: RuntimeError
-generic_creation_test: RuntimeError
-generic_field_mixin2_test: RuntimeError
 generic_field_mixin4_test: RuntimeError
-generic_field_mixin5_test: RuntimeError
-generic_functions_test: Crash
-generic_inheritance_test: RuntimeError
-generic_local_functions_test: Crash
-generic_methods_function_type_test: Crash
-generic_methods_generic_function_parameter_test: Crash
-generic_methods_new_test: Crash
-generic_methods_test: Crash
-generic_methods_type_expression_test: Crash
-generic_test: RuntimeError
+generic_method_types_test: Pass, RuntimeError
 getter_closure_execution_order_test: RuntimeError
 getter_setter_in_lib_test: RuntimeError
-if_null_assignment_static_test/35: Crash
 inferrer_closure_test: RuntimeError
 initializing_formal_final_test: RuntimeError
-instance_creation_in_function_annotation_test: Crash
-invocation_mirror_invoke_on2_test: Crash
 is_not_class2_test: RuntimeError
 issue13474_test: RuntimeError
-issue21079_test: Crash
 issue_1751477_test: RuntimeError
-large_class_declaration_test: Timeout
-least_upper_bound_expansive_test/01: CompileTimeError
-least_upper_bound_expansive_test/02: CompileTimeError
-least_upper_bound_expansive_test/03: CompileTimeError
-least_upper_bound_expansive_test/04: CompileTimeError
-least_upper_bound_expansive_test/05: CompileTimeError
-least_upper_bound_expansive_test/06: CompileTimeError
-least_upper_bound_expansive_test/07: CompileTimeError
-least_upper_bound_expansive_test/08: CompileTimeError
-least_upper_bound_expansive_test/09: CompileTimeError
-least_upper_bound_expansive_test/10: CompileTimeError
-least_upper_bound_expansive_test/11: CompileTimeError
-least_upper_bound_expansive_test/12: CompileTimeError
-least_upper_bound_expansive_test/none: CompileTimeError
 library_env_test/has_html_support: RuntimeError
-library_env_test/has_mirror_support: RuntimeError
 library_env_test/has_no_io_support: RuntimeError
 list_literal4_test: RuntimeError
-main_not_a_function_test/01: Crash
 malformed_test/none: RuntimeError
 map_literal3_test: RuntimeError
-map_literal4_test: RuntimeError
+map_literal4_test: RuntimeError  # VM checked mode Issue 28420
 map_literal6_test: RuntimeError
-metadata_test: CompileTimeError
 method_override_test: RuntimeError
-mixin_generic_test: RuntimeError
-mixin_illegal_super_use_test/01: MissingCompileTimeError
-mixin_illegal_super_use_test/02: MissingCompileTimeError
-mixin_illegal_super_use_test/03: MissingCompileTimeError
-mixin_illegal_super_use_test/04: MissingCompileTimeError
-mixin_illegal_super_use_test/05: MissingCompileTimeError
-mixin_illegal_super_use_test/06: MissingCompileTimeError
-mixin_illegal_super_use_test/07: MissingCompileTimeError
-mixin_illegal_super_use_test/08: MissingCompileTimeError
-mixin_illegal_super_use_test/09: MissingCompileTimeError
-mixin_illegal_super_use_test/10: MissingCompileTimeError
-mixin_illegal_super_use_test/11: MissingCompileTimeError
-mixin_illegal_superclass_test/01: MissingCompileTimeError
-mixin_illegal_superclass_test/02: MissingCompileTimeError
-mixin_illegal_superclass_test/03: MissingCompileTimeError
-mixin_illegal_superclass_test/04: MissingCompileTimeError
-mixin_illegal_superclass_test/05: MissingCompileTimeError
-mixin_illegal_superclass_test/06: MissingCompileTimeError
-mixin_illegal_superclass_test/07: MissingCompileTimeError
-mixin_illegal_superclass_test/08: MissingCompileTimeError
-mixin_illegal_superclass_test/09: MissingCompileTimeError
-mixin_illegal_superclass_test/10: MissingCompileTimeError
-mixin_illegal_superclass_test/11: MissingCompileTimeError
-mixin_illegal_superclass_test/12: MissingCompileTimeError
-mixin_illegal_superclass_test/13: MissingCompileTimeError
-mixin_illegal_superclass_test/14: MissingCompileTimeError
-mixin_illegal_superclass_test/15: MissingCompileTimeError
-mixin_illegal_superclass_test/16: MissingCompileTimeError
-mixin_illegal_superclass_test/17: MissingCompileTimeError
-mixin_illegal_superclass_test/18: MissingCompileTimeError
-mixin_illegal_superclass_test/19: MissingCompileTimeError
-mixin_illegal_superclass_test/20: MissingCompileTimeError
-mixin_illegal_superclass_test/21: MissingCompileTimeError
-mixin_illegal_superclass_test/22: MissingCompileTimeError
-mixin_illegal_superclass_test/23: MissingCompileTimeError
-mixin_illegal_superclass_test/24: MissingCompileTimeError
-mixin_illegal_superclass_test/25: MissingCompileTimeError
-mixin_illegal_superclass_test/26: MissingCompileTimeError
-mixin_illegal_superclass_test/27: MissingCompileTimeError
-mixin_illegal_superclass_test/28: MissingCompileTimeError
-mixin_illegal_superclass_test/29: MissingCompileTimeError
-mixin_illegal_superclass_test/30: MissingCompileTimeError
-mixin_illegal_syntax_test/13: CompileTimeError
-mixin_illegal_syntax_test/none: CompileTimeError
-mixin_mixin2_test: RuntimeError
-mixin_mixin3_test: RuntimeError
-mixin_mixin4_test: RuntimeError
-mixin_mixin5_test: RuntimeError
-mixin_mixin_bound2_test: RuntimeError
-mixin_mixin_bound_test: RuntimeError
-mixin_super_test: RuntimeError
-mixin_type_parameters_simple_test: RuntimeError
 mixin_type_parameters_super_extends_test: RuntimeError
 mixin_type_parameters_super_test: RuntimeError
-multiline_newline_test/01: CompileTimeError
-multiline_newline_test/02: CompileTimeError
-multiline_newline_test/03: CompileTimeError
-multiline_newline_test/04: MissingCompileTimeError
-multiline_newline_test/05: MissingCompileTimeError
-multiline_newline_test/06: MissingCompileTimeError
 multiline_newline_test/none: RuntimeError
 named_parameters_type_test/01: MissingRuntimeError
 named_parameters_type_test/02: MissingRuntimeError
 named_parameters_type_test/03: MissingRuntimeError
-no_main_test/01: Crash
-not_enough_positional_arguments_test/01: CompileTimeError
-not_enough_positional_arguments_test/02: MissingRuntimeError
-not_enough_positional_arguments_test/05: MissingRuntimeError
-null_test/none: RuntimeError
+not_enough_positional_arguments_test/02: MissingRuntimeError  # Dartk Issue 28301
+not_enough_positional_arguments_test/05: MissingRuntimeError  # Dartk Issue 28301
 number_identifier_test/05: RuntimeError
 positional_parameters_type_test/01: MissingRuntimeError
 positional_parameters_type_test/02: MissingRuntimeError
 prefix10_negative_test: Fail
 prefix21_test: RuntimeError
 redirecting_constructor_initializer_test: RuntimeError
-redirecting_factory_reflection_test: Crash
-regress_18535_test: Crash
-regress_18713_test: RuntimeError
-regress_22443_test: RuntimeError
-regress_22700_test: RuntimeError
-regress_23408_test: RuntimeError
-regress_27164_test: CompileTimeError
-regress_27617_test/1: MissingCompileTimeError
-regress_r24720_test: RuntimeError
-reify_typevar_test: RuntimeError
+regress_22443_test: RuntimeError  # Deferred Loading Issue 28335
+regress_23408_test: RuntimeError  # Deferred Loading Issue 28335
+regress_28278_test: RuntimeError  # Mirrors Issue
 script1_negative_test: Fail
 script2_negative_test: Fail
-setter_no_getter_call_test/none: RuntimeError
-stack_trace_test: RuntimeError
-stacktrace_rethrow_error_test/none: RuntimeError
-stacktrace_rethrow_error_test/withtraceparameter: RuntimeError
-stacktrace_rethrow_nonerror_test: RuntimeError
-static_setter_get_test/01: RuntimeError
-string_interpolation7_test: RuntimeError
-super_call3_test/01: Crash
-super_call4_test: RuntimeError
-super_test: RuntimeError
-switch7_negative_test: Fail
-switch_try_catch_test: RuntimeError
-sync_generator3_test/test2: RuntimeError
-tearoff_basic_test: CompileTimeError
-tearoff_constructor_basic_test: CompileTimeError
-try_catch_on_syntax_test/10: MissingRuntimeError
-try_catch_on_syntax_test/11: MissingRuntimeError
-try_finally_regress_25654_test: RuntimeError
+setter_no_getter_call_test/none: RuntimeError  # Dartk Issue 28418
+static_setter_get_test/01: RuntimeError  # Dartk Issue 28417
+switch7_negative_test: Fail  # Dartk Issue 28416
+try_catch_on_syntax_test/10: MissingRuntimeError  # Dartk Issue 28410
+try_catch_on_syntax_test/11: MissingRuntimeError  # Dartk Issue 28410
 type_checks_in_factory_method_test: RuntimeError
-type_parameter_literal_test: RuntimeError
-type_variable_conflict2_test/02: MissingCompileTimeError
 type_variable_function_type_test: RuntimeError
-vm/debug_break_enabled_vm_test/01: CompileTimeError
-vm/debug_break_enabled_vm_test/none: CompileTimeError
-vm/reflect_core_vm_test: CompileTimeError
 vm/type_cast_vm_test: RuntimeError
 vm/type_vm_test: RuntimeError
 
+# dartk: JIT failures
+[ $compiler == dartk && $runtime == vm ]
+const_locals_test: RuntimeError
+constructor_named_arguments_test/01: Crash  # Dartk Issue 28301
+const_string_test: RuntimeError  # Dartk Issue 28306
+library_env_test/has_no_mirror_support: RuntimeError
+redirecting_factory_reflection_test: RuntimeError
+
+# dartk: JIT failures (debug)
+[ $compiler == dartk && $runtime == vm && $mode == debug ]
+not_enough_positional_arguments_test/02: Crash  # Dartk Issue 28301
+not_enough_positional_arguments_test/05: Crash  # Dartk Issue 28301
+
+# dartk: precompilation failures
+[ $compiler == dartkp && $runtime == dart_precompiled ]
+if_null_assignment_static_test/35: Crash  # Dartk Issue 28302
+
 # dartk: precompilation failures (debug)
 [ $compiler == dartkp && $runtime == dart_precompiled && $mode == debug ]
-constructor_named_arguments_test/01: Crash
-enum_syntax_test/05: Crash
-generic_sends_test: Crash
-not_enough_positional_arguments_test/05: Crash
+constructor_named_arguments_test/01: Crash  # Dartk Issue 28301
+not_enough_positional_arguments_test/05: Crash  # Dartk Issue 28301
+
+
+# New failures after respecting VMOptions in test files
+[ $compiler == dartk || $compiler == dartkp ]
+vm/regress_27671_test: RuntimeError
+
+# New failures after respecting VMOptions in test files
+[ $compiler == dartk && $runtime == vm && $mode == debug]
+hello_dart_test: Crash  # error: expected: cls.is_type_finalized()
+
+# New failures after respecting VMOptions in test files
+[ $compiler == dartk && $runtime == vm ]
+hello_dart_test: CompileTimeError  # VMOptions=--compile-all causes us to hit "native function VMServiceIO_Shutdown cannot be resolved"
+ct_const2_test: Pass, CompileTimeError  # VMOptions=--compile-all causes us to hit "native function VMServiceIO_Shutdown cannot be resolved"
+disassemble_test: Pass, Crash  # Multitest via multiple VMOptions!
+
+# Failures during Gardening shift: To be triaged!
+[ $compiler == dartk || $compiler == dartkp ]
+runtime_type_function_test: RuntimeError
+
+# Failures during Gardening shift: To be triaged!
+[ $compiler == dartkp && $runtime == dart_precompiled ]
+assert_with_type_test_or_cast_test: Pass, Crash  # Multitest via multiple VMOptions.
+named_parameters_type_test/01: Crash
+named_parameters_type_test/02: Crash
+named_parameters_type_test/03: Crash
+positional_parameters_type_test/01: Crash
+positional_parameters_type_test/02: Crash
+type_checks_in_factory_method_test: Crash
+vm/regress_27671_test: Crash
+vm/type_vm_test: Crash
+
+# Triaged checked mode failures
+[ ($compiler == dartk || $compiler == dartkp) && $checked ]
+language/regress_22728_test: Fail # Dartk Issue 28498
diff --git a/tests/language/lazy_static8_test.dart b/tests/language/lazy_static8_test.dart
new file mode 100644
index 0000000..812219f
--- /dev/null
+++ b/tests/language/lazy_static8_test.dart
@@ -0,0 +1,73 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+// Test re-entrant initializer - calls throw CyclicInitializationError.
+
+var trace;
+
+final foo = bar;
+
+get bar {
+  trace.add('bar');
+  try {
+    return foo ?? 1;
+  } catch (e) {
+    trace.add(e is CyclicInitializationError);
+  }
+  try {
+    return foo ?? 2;
+  } catch (e) {
+    trace.add(e is CyclicInitializationError);
+  }
+  return 42;  
+}
+
+void testTopLevel() {
+  trace = [];
+  var result = foo;
+  Expect.equals(42, result);
+  Expect.equals('bar,true,true', trace.join(','));
+  trace = [];
+  result = foo;
+  Expect.equals(42, result);
+  Expect.equals('', trace.join(','));
+
+}
+
+class X {
+  static final foo = X.bar;
+
+  static get bar {
+    trace.add('X.bar');
+    try {
+      return foo ?? 1;
+    } catch (e) {
+      trace.add(e is CyclicInitializationError);
+    }
+    try {
+      return foo ?? 2;
+    } catch (e) {
+      trace.add(e is CyclicInitializationError);
+    }
+    return 49;  
+  }
+}
+
+void testClassStatic() {
+  trace = [];
+  var result = X.foo;
+  Expect.equals(49, result);
+  Expect.equals('X.bar,true,true', trace.join(','));
+  trace = [];
+  result = X.foo;
+  Expect.equals(49, result);
+  Expect.equals('', trace.join(','));
+}
+
+main() {
+  testTopLevel();
+  testClassStatic();
+}
diff --git a/tests/language/mixin_illegal_syntax_test.dart b/tests/language/mixin_illegal_syntax_test.dart
index c9bb069..167304d 100644
--- a/tests/language/mixin_illegal_syntax_test.dart
+++ b/tests/language/mixin_illegal_syntax_test.dart
@@ -6,8 +6,9 @@
 class G<T> { }
 class M { }
 
-typedef T0 = abstract S with M;
-abstract class T0A = S with M;
+class T = S with M;
+typedef T0 = S with M;         /// 00: compile-time error
+abstract class TA = S with M;
 class T1 = final S with M;     /// 01: compile-time error
 class T2 = var S with M;       /// 02: compile-time error
 class T3 = const S with M;     /// 03: compile-time error
@@ -29,13 +30,13 @@
     implements M  /// 12: compile-time error
     implements M { }
 
-class D1 extends T0 { }
+class D1 extends T { }
 
 class X = S;   /// 14: compile-time error
 
 main() {
-  new T0();  /// 13: static type warning, runtime error
-  new T0A();  /// 13: static type warning, runtime error
+  new T();
+  new TA();  /// 13: static type warning, runtime error
   new T1();  /// 01: continued
   new T2();  /// 02: continued
   new T3();  /// 03: continued
diff --git a/tests/language/mixin_proto_test.dart b/tests/language/mixin_proto_test.dart
new file mode 100644
index 0000000..e195d90
--- /dev/null
+++ b/tests/language/mixin_proto_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Tests that a program in csp mode doesn't access the prototype chain
+// on platforms that don't support direct access to __proto__.
+// This test is most useful with --csp and on a platform that doesn't support
+// __proto__ access (such as Rhino).
+// See http://dartbug.com/27290 .
+
+import 'package:expect/expect.dart';
+
+class A {
+  var x;
+  foo() => 44;
+  bar() => 22;
+}
+
+class B {
+  var y;
+  foo() => 42;
+}
+
+class C extends A with B {
+  var z;
+  bar() => 499;
+}
+
+main() {
+  var all = [new A(), new B(), new C()];
+  Expect.equals(44, all[0].foo());
+  Expect.equals(22, all[0].bar());
+  Expect.equals(42, all[1].foo());
+  Expect.equals(42, all[2].foo());
+  Expect.equals(499, all[2].bar());
+}
\ No newline at end of file
diff --git a/tests/language/null_bottom_test.dart b/tests/language/null_bottom_test.dart
new file mode 100644
index 0000000..53e866a
--- /dev/null
+++ b/tests/language/null_bottom_test.dart
@@ -0,0 +1,137 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// Dart test for testing the ternary operator.
+
+import "package:expect/expect.dart";
+
+// Test that `Null` acts like the bottom type - less than any other type.
+
+bool isCheckedMode = () { bool c = false; assert(c = true); return c; } ();
+
+typedef R Fun<A, R>(A argument);
+
+class C<T> {
+  const C();
+  T returns() => null;
+  void accepts(T x) {}
+}
+
+class NullBound<T extends num> {}
+
+class ListBound<T extends Iterable<Null>> {}
+
+main() {
+  testClassTypes();
+  testFunctionTypes();
+}
+
+void testClassTypes() {
+  var cn = new C<Null>();
+
+  Expect.isTrue(cn is C<Null>, "C<Null> is C<Null>");
+  Expect.isTrue(cn is C<Object>, "C<Null> is C<Object>");
+  Expect.isTrue(cn is C<int>, "C<Null> is C<int>");
+
+  Expect.isNotNull(cn as C<Null>, "C<Null> as C<Null>");
+  Expect.isNotNull(cn as C<Object>, "C<Null> as C<Object>");
+  Expect.isNotNull(cn as C<int>, "C<Null> as C<int>");
+
+  var ccn = new C<C<Null>>();
+
+  Expect.isTrue(ccn is C<C<Null>>);
+  Expect.isTrue(ccn is C<C<Object>>);
+  Expect.isTrue(ccn is C<C<int>>);
+
+  Expect.isNotNull(ccn as C<C<Null>>);
+  Expect.isNotNull(ccn as C<C<Object>>);
+  Expect.isNotNull(ccn as C<C<int>>);
+
+  var ci = new C<int>();
+  Expect.isFalse(ci is C<Null>);
+
+  var co = new C<Object>();
+  Expect.isFalse(co is C<Null>);
+
+  if (!isCheckedMode) return;
+
+  List<int> li1 = const <Null>[];
+
+  C<Null> x1 = cn;
+  C<Object> x2 = cn;
+
+  Expect.identical(x1 , cn);
+  Expect.identical(x2 , cn);
+
+  const C<Null> cocn = const C<Null>();
+  const C<Object> coco = cocn;
+  const C<int> coci = cocn;
+
+  Expect.identical(cocn, coco);
+  Expect.identical(cocn, coci);
+
+  Expect.throws(() {
+    Null x = "string" as dynamic;
+    use(x);  // Avoid "x unused" warning.
+  });
+
+  Expect.throws(() {
+    Null x = new Object();
+    use(x);  // Avoid "x unused" warning.
+  });
+
+  NullBound<int> nb = new NullBound<Null>();  // Should not fail.
+  use(nb);  // Avoid "nb unused" warning.
+  ListBound<List<Null>> lb = new ListBound<Null>();  // Should not fails
+  use(lb);  // Avoid "nb unused" warning.
+}
+
+void testFunctionTypes() {
+  T1 t1 = new T1();
+  T2 t2 = new T2();
+  T1 t = t2;
+
+  Fun<int, Null> f1 = t1.foo;
+  Fun<Null, int> f2 = t.bar;
+  f1 = t1.baz;
+  f2 = t.qux;
+  use(f1);
+  use(f2);
+
+  var l = new List<Fun<Null, Null>>();
+  Expect.isTrue(l is List<Fun<Null, int>>);
+  l = new List<Fun<int, int>>();
+  Expect.isTrue(l is List<Fun<Null, num>>);
+
+  Expect.isTrue(((int _) => null) is Fun<int, Null>);
+
+  Null fun(int x) => null;
+  Fun<Null, int> fun2 = fun;  // Safe assignment.
+  if (fun2 is Fun<int, Null>) {
+    // If int->Null is *subtype* of Null->int (which it should be),
+    // then type promotion succeeds.
+    // If type promotion succeeds, the static type is int->Null, otherwise
+    // it's Null->int.
+    fun2(42);  // Should not give a warning after type promotion.
+    fun2(null).abs();  /// 03: runtime error
+  }
+}
+
+class T1 {
+  Null foo(int x) => null;
+  int bar(Null x) => null;
+  Null baz(int x) => null;
+  int qux(Null x) => null;
+}
+
+class T2 extends T1 {
+  Null foo(Null x) => null;
+  Null bar(Null x) => null;
+  int baz(int x) => x;
+  int qux(int x) => x;
+}
+
+// Avoid "variable not used" warnings.
+use(x) {
+  return identical(x, x);
+}
diff --git a/tests/language/null_is_bottom_test.dart b/tests/language/null_is_bottom_test.dart
new file mode 100644
index 0000000..e2ab54a
--- /dev/null
+++ b/tests/language/null_is_bottom_test.dart
@@ -0,0 +1,142 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test that Null is a subtype of any other type.
+
+import 'package:expect/expect.dart';
+
+class A {}
+typedef A ReturnA();
+typedef TakeA(A a);
+typedef Null ReturnNull();
+typedef TakeNull(Null n);
+
+@NoInline()
+testA(A a) {}
+
+@NoInline()
+testListA(List<A> list) {}
+
+@NoInline()
+testIsListA(var a) => a is List<A>;
+
+@NoInline()
+testAsListA(var a) => a as List<A>;
+
+@NoInline()
+testNull(Null n) {}
+
+@NoInline()
+testListNull(List<Null> list) {}
+
+@NoInline()
+testIsListNull(var a) => a is List<Null>;
+
+@NoInline()
+testAsListNull(var a) => a as List<Null>;
+
+@NoInline()
+testReturnA(ReturnA f) {}
+
+@NoInline()
+testIsReturnA(var f) => f is ReturnA;
+
+@NoInline()
+testAsReturnA(var f) => f as ReturnA;
+
+@NoInline()
+testReturnNull(ReturnNull f) {}
+
+@NoInline()
+testIsReturnNull(var f) => f is ReturnNull;
+
+@NoInline()
+testAsReturnNull(var f) => f as ReturnNull;
+
+@NoInline()
+testTakeA(TakeA f) {}
+
+@NoInline()
+testIsTakeA(var f) => f is TakeA;
+
+@NoInline()
+testAsTakeA(var f) => f as TakeA;
+
+@NoInline()
+testTakeNull(TakeNull f) {}
+
+@NoInline()
+testIsTakeNull(var f) => f is TakeNull;
+
+@NoInline()
+testAsTakeNull(var f) => f as TakeNull;
+
+Null returnNullFunc() => null;
+takeNullFunc(Null n) {}
+A returnAFunc() => null;
+takeAFunc(A a) {}
+
+main() {
+  var n = null;
+  var listNull = new List<Null>();
+  var a = new A();
+  var listA = new List<A>();
+
+  testA(n);                                                          /// 01: ok
+  testA(a);                                                          /// 02: ok
+  testListA(listNull);                                               /// 03: ok
+  testListA(listA);                                                  /// 04: ok
+  Expect.isTrue(testIsListA(listNull));                              /// 05: ok
+  Expect.isTrue(testIsListA(listA));                                 /// 06: ok
+  testAsListA(listNull);                                             /// 07: ok
+  testAsListA(listA);                                                /// 08: ok
+
+  testNull(n);                                                       /// 09: ok
+  testNull(a);                                       /// 10: dynamic type error
+  testListNull(listNull);                                            /// 11: ok
+  testListNull(listA);                               /// 12: dynamic type error
+  Expect.isTrue(testIsListNull(listNull));                           /// 13: ok
+  Expect.isFalse(testIsListNull(listA));                             /// 14: ok
+  testAsListNull(listNull);                                          /// 15: ok
+  Expect.throws(() => testAsListNull(listA), (e) => e is CastError); /// 16: ok
+
+  var returnNull = returnNullFunc;
+  var takeNull = takeNullFunc;
+  var returnA = returnAFunc;
+  var takeA = takeAFunc;
+
+  testReturnA(returnA);                                              /// 17: ok
+  testReturnA(returnNull);                                           /// 18: ok
+  Expect.isTrue(testIsReturnA(returnA));                             /// 19: ok
+  Expect.isTrue(testIsReturnA(returnNull));                          /// 20: ok
+  testAsReturnA(returnA);                                            /// 21: ok
+  testAsReturnA(returnNull);                                         /// 22: ok
+
+  // This is not valid in strong-mode: ()->A <: ()->Null
+  testReturnNull(returnA);                                           /// 23: ok
+  testReturnNull(returnNull);                                        /// 24: ok
+  // This is not valid in strong-mode: ()->A <: ()->Null
+  Expect.isTrue(testIsReturnNull(returnA));                          /// 25: ok
+  Expect.isTrue(testIsReturnNull(returnNull));                       /// 26: ok
+  // This is not valid in strong-mode: ()->A <: ()->Null
+  testAsReturnNull(returnA);                                         /// 27: ok
+  testAsReturnNull(returnNull);                                      /// 28: ok
+
+  testTakeA(takeA);                                                  /// 29: ok
+  // This is not valid in strong-mode: (Null)-> <: (A)->
+  testTakeA(takeNull);                                               /// 30: ok
+  Expect.isTrue(testIsTakeA(takeA));                                 /// 31: ok
+  // This is not valid in strong-mode: (Null)-> <: (A)->
+  Expect.isTrue(testIsTakeA(takeNull));                              /// 32: ok
+  testAsTakeA(takeA);                                                /// 33: ok
+  // This is not valid in strong-mode: (Null)-> <: (A)->
+  testAsTakeA(takeNull);                                             /// 34: ok
+
+  testTakeNull(takeA);                                               /// 35: ok
+  testTakeNull(takeNull);                                            /// 36: ok
+  Expect.isTrue(testIsTakeNull(takeA));                              /// 37: ok
+  Expect.isTrue(testIsTakeNull(takeNull));                           /// 38: ok
+  testAsTakeNull(takeA);                                             /// 39: ok
+  testAsTakeNull(takeNull);                                          /// 40: ok
+}
\ No newline at end of file
diff --git a/tests/language/null_is_bottom_type_test.dart b/tests/language/null_is_bottom_type_test.dart
new file mode 100644
index 0000000..b12137e
--- /dev/null
+++ b/tests/language/null_is_bottom_type_test.dart
@@ -0,0 +1,60 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test that Null is a subtype of any other type.
+
+import 'package:expect/expect.dart';
+
+class A {}
+typedef A ReturnA();
+typedef TakeA(A a);
+typedef Null ReturnNull();
+typedef TakeNull(Null n);
+
+testA(A a) {}
+testListA(List<A> list) {}
+testNull(Null n) {}
+testListNull(List<Null> list) {}
+testReturnA(ReturnA f) {}
+testReturnNull(ReturnNull f) {}
+testTakeA(TakeA f) {}
+testTakeNull(TakeNull f) {}
+
+Null returnNull() => null;
+takeNull(Null n) {}
+A returnA() => null;
+takeA(A a) {}
+
+main() {
+  if (false) test(); // Perform static checks only.
+}
+
+test() {
+  Null n;
+  List<Null> listNull;
+  A a = new A();
+  List<A> listA;
+
+  testA(n);                                                          /// 01: ok
+  testA(a);                                                          /// 02: ok
+  testListA(listNull);                                               /// 03: ok
+  testListA(listA);                                                  /// 04: ok
+
+  testNull(n);                                                       /// 05: ok
+  testNull(a);                                                       /// 06: ok
+  testListNull(listNull);                                            /// 07: ok
+  testListNull(listA);                                               /// 08: ok
+
+  testReturnA(returnA);                                              /// 09: ok
+  testReturnA(returnNull);                                           /// 10: ok
+
+  testReturnNull(returnA);                                           /// 11: ok
+  testReturnNull(returnNull);                                        /// 12: ok
+
+  testTakeA(takeA);                                                  /// 13: ok
+  testTakeA(takeNull);                                               /// 14: ok
+
+  testTakeNull(takeA);                                               /// 15: ok
+  testTakeNull(takeNull);                                            /// 16: ok
+}
\ No newline at end of file
diff --git a/tests/language/parameter_initializer5_test.dart b/tests/language/parameter_initializer5_test.dart
index eb7208d..0e93202 100644
--- a/tests/language/parameter_initializer5_test.dart
+++ b/tests/language/parameter_initializer5_test.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.
-//
-// DartOptions=--initializing-formal-access
-// VMOptions=--initializing-formal-access
 
 // Use the this.x parameter in an initializer expression.
 
diff --git a/tests/language/regress_27700_test.dart b/tests/language/regress_27700_test.dart
new file mode 100644
index 0000000..4366962
--- /dev/null
+++ b/tests/language/regress_27700_test.dart
@@ -0,0 +1,10 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for issue 27700.
+
+main(){
+  var x = new List(0);
+  var z = "$x";
+}
\ No newline at end of file
diff --git a/tests/language/regress_28255_test.dart b/tests/language/regress_28255_test.dart
new file mode 100644
index 0000000..118fc6e
--- /dev/null
+++ b/tests/language/regress_28255_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Regression test for issue 28255
+
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+class Class {
+  noSuchMethod(i) => true;
+
+  foo() {
+    var o = this;
+    Expect.isFalse(o.bar is Null);
+    Expect.isTrue(o.bar != null);
+    Expect.equals(true.runtimeType, o.bar.runtimeType);
+  }
+}
+
+main() {
+  reflectClass(Class).newInstance(const Symbol(''), []).reflectee.foo();
+}
diff --git a/tests/language/regress_28278_lib.dart b/tests/language/regress_28278_lib.dart
new file mode 100644
index 0000000..0bc67f1
--- /dev/null
+++ b/tests/language/regress_28278_lib.dart
@@ -0,0 +1,5 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+foo(x) => x + "Hello";
diff --git a/tests/language/regress_28278_test.dart b/tests/language/regress_28278_test.dart
new file mode 100644
index 0000000..08d276f
--- /dev/null
+++ b/tests/language/regress_28278_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--load-deferred-eagerly
+// VMOptions=
+
+import "package:expect/expect.dart";
+
+import "regress_28278_lib.dart" deferred as def;
+
+var result = "";
+
+class D {
+  m() async {
+    await def.loadLibrary();
+    result = def.foo(result += "Here");
+  }
+
+}
+
+main() async {
+  var d = new D();
+  await d.m();
+  await d.m();
+  Expect.equals("HereHelloHereHello", result);
+}
+
diff --git a/tests/language/regress_28341_test.dart b/tests/language/regress_28341_test.dart
new file mode 100644
index 0000000..9fedfa5
--- /dev/null
+++ b/tests/language/regress_28341_test.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+enum E {
+  A
+}
+
+main() {
+  Expect.isTrue(E.values == const <E>[E.A]);
+  Expect.isFalse(E.values == const [E.A]);
+}
diff --git a/tests/language/runtime_type_function_test.dart b/tests/language/runtime_type_function_test.dart
new file mode 100644
index 0000000..8d7e980
--- /dev/null
+++ b/tests/language/runtime_type_function_test.dart
@@ -0,0 +1,80 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+typedef String F(String returns, String arguments);
+F fn;
+
+String form1(String returns, String arguments) => '$arguments => $returns';
+String form2(String returns, String arguments) => '$returns Function$arguments';
+
+F detectForm() {
+  var s = main.runtimeType.toString();
+  if (s.contains('=>')) return form1;
+  if (s.contains('Function')) return form2;
+  Expect.fail('"$s" contains neither "=>" nor "Function"');
+}
+
+main() {
+  fn = detectForm();
+
+  // Types that do not use class names - these can be checked on dart2js in
+  // minified mode.
+
+  check(fn('dynamic', '()'), main);        // Top-level tear-off.
+  check(fn('void', '()'), Xyzzy.foo);      // Class static member tear-off.
+  check(fn('void', '(dynamic)'), [].add);  // Instance tear-off.
+  check(fn('dynamic', '()'), ()=>1);       // closure.
+
+  var s = new Xyzzy().runtimeType.toString();
+  if (s.length <= 3) return; // dart2js --minify has minified names.
+
+  Expect.equals('Xyzzy', s, 'runtime type of plain class prints as class name');
+
+  check(fn('void', '(String, dynamic)'), check);
+
+  // Class static member tear-offs.
+  check(fn('String', '(String, [String, dynamic])'), Xyzzy.opt);
+  check(fn('String', '(String, {String a, dynamic b})'), Xyzzy.nam);
+
+  // Instance method tear-offs.
+  check(fn('void', '(String)'), <String>[].add);
+  check(fn('void', '(int)'), <int>[].add);
+
+  check(fn('String', '(int)'), new G<String, int>().foo);
+
+  // Instance method with function parameter.
+  var string2int = fn('int', '(String)');
+  check(fn('String', '($string2int)'), new G<String, int>().moo);
+
+  // Closures.
+  String localFunc(String a, String b) => a + b;
+  void localFunc2(int a) { print(a); }
+  Expect.isTrue(localFunc is F);
+  check(fn('String', '(String, String)'), localFunc);
+  check(fn('void', '(int)'), localFunc2);
+}
+
+void check(String text, var thing) {
+  var type = thing.runtimeType.toString();
+  if (type == text) return;
+  Expect.fail("""
+Type print string does not match expectation
+  Expected: '$text'
+  Actual: '$type'
+""");
+}
+
+
+class Xyzzy {
+  static void foo() {}
+  static String opt(String x, [String a, b]) {}
+  static String nam(String x, {String a, b}) {}
+}
+
+class G<U, V> {
+  U foo(V x) => null;
+  U moo(V f(U x)) => null;
+}
diff --git a/tests/language/tearoff_basic_lib.dart b/tests/language/tearoff_basic_lib.dart
deleted file mode 100644
index fe9fc07..0000000
--- a/tests/language/tearoff_basic_lib.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library tearoff_basic_lib;
-
-cfunc() => "cfunc";
-
-set cset(a) { cvar = a; }
-
-get cget => "cget";
-
-var cvar = 1+2+3;
-
-final cfinvar = "set in stone";
-
-class ZZ { }
diff --git a/tests/language/tearoff_basic_test.dart b/tests/language/tearoff_basic_test.dart
deleted file mode 100644
index 303d38e..0000000
--- a/tests/language/tearoff_basic_test.dart
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Basic test for tear-off closures.
-
-import "package:expect/expect.dart";
-import "tearoff_basic_lib.dart" as P;
-import "tearoff_basic_lib.dart" deferred as D;
-
-class C {
-  var v = 99;
-  final fv = 444;
-
-  operator + (a) { return v + a; }
-  get sugus => "sugus";
-  set frosch(a) { v = "ribbit $a"; }
-  foo() => "kuh";
-
-  static var st;
-  static final stfin = 1000;
-  static stfoo([p1 = 100]) => p1 * 10;
-  static get stg => "stg";
-  static set sts(x) { st = x; }
-}
-
-
-testStatic() {
-  // Closurize static variable.
-  var a = C#st=;
-  a(100);
-  Expect.equals(100, C.st);
-  var b = C#st;
-  Expect.equals(100, b());
-
-  // Closurize static final variable.
-  a = C#stfin;
-  Expect.equals(1000, a());
-  Expect.throws(() => C#stfin= );  // Final variable has no setter.
-
-  // Closurize static method.
-  a = C#stfoo;
-  Expect.equals(1000, a());
-  Expect.equals(90, a(9));
-
-  // Closurize static getter.
-  a = C#stg;
-  Expect.equals("stg", a());
-
-  // Closurize static setter.
-  Expect.throws(() => C#sts);  // No setter/method named sts exists.
-  a = C#sts=;
-  a("pflug");
-  Expect.equals("pflug", C.st);
-
-  // Can't closurize instance method via class literal.
-  Expect.throws(() => C#foo);
-
-  // Extracted closures must be equal.
-  Expect.isTrue(C#st == C#st);
-  Expect.isTrue(C#st= == C#st=);
-  Expect.isTrue(C#stfin == C#stfin);
-  Expect.isTrue(C#stfoo == C#stfoo);
-  Expect.isTrue(C#stg == C#stg);
-  Expect.isTrue(C#sts= == C#sts=);
-}
-
-testInstance() {
-  var o = new C();
-  var p = new C();
-  var a, b;
-
-  // Closurize instance variable.
-  a = o#v;
-  Expect.equals(99, a());
-  b = p#v=;
-  b(999);
-  Expect.equals(999, p.v);
-  Expect.equals(99, a());
-
-  // Closurize final instance variable.
-  Expect.throws(() => o#fv=);  // Final variable has not setter.
-  a = o#fv;
-  Expect.equals(444, a());
-
-  // Closurize instance method.
-  a = o#foo;
-  Expect.equals("kuh", a());
-
-  // Closurize operator.
-  a = o#+;
-  Expect.equals(100, o + 1);
-  Expect.equals(100, a(1));
-
-  // Closurize instance getter.
-  a = o#sugus;
-  Expect.equals("sugus", a());
-  Expect.throws(() => o#sugus=);
-
-  // Closurize instance setter.
-  a = o#frosch=;
-  a("!");
-  Expect.equals("ribbit !", o.v);
-  Expect.throws(() => o#frosch);
-
-  // Extracted closures must be equal.
-  Expect.isTrue(o#v == o#v);
-  Expect.isTrue(o#v= == o#v=);
-  Expect.isTrue(o#fv == o#fv);
-  Expect.isTrue(o#foo == o#foo);
-  Expect.isTrue(o#+ == o#+);
-  Expect.isTrue(o#sugus == o#sugus);
-  Expect.isTrue(o#frosch= == o#frosch=);
-}
-
-testPrefix() {
-  // Closurize top-level variable.
-  var a = P#cvar;
-  Expect.equals(6, a());
-  var b = P#cvar=;
-  b(7);
-  Expect.equals(7, a());
-
-  // Closurize final top-level variable.
-  a = P#cfinvar;
-  Expect.equals("set in stone", a());
-  Expect.throws(() => P#cfinvar=);
-
-  // Closurize top-level function.
-  a = P#cfunc;
-  Expect.equals("cfunc", a());
-
-  // Closurize top-level getter.
-  a = P#cget;
-  Expect.equals("cget", a());
-
-  // Closurize top-level getter.
-  a = P#cset=;
-  a(99);
-  Expect.equals(99, P.cvar);
-
-  Expect.throws(() => P#ZZ);  // Cannot closurize class.
-
-  // Extracted closures must be equal.
-  Expect.isTrue(P#cvar == P#cvar);
-  Expect.isTrue(P#cvar= == P#cvar=);
-  Expect.isTrue(P#cfinvar == P#cfinvar);
-  Expect.isTrue(P#cfunc == P#cfunc);
-  Expect.isTrue(P#cget == P#cget);
-  Expect.isTrue(P#cset= == P#cset=);
-}
-
-testDeferred() {
-  Expect.throws(() => D#cfunc);
-  D.loadLibrary().then((_) {
-    var a = D#cfunc;
-    Expect.equals("cfunc", a());
-  });
-}
-
-main() {
-  testStatic();
-  testInstance();
-  testPrefix();
-  testDeferred();
-}
diff --git a/tests/language/tearoff_constructor_basic_test.dart b/tests/language/tearoff_constructor_basic_test.dart
deleted file mode 100644
index 27c34d9..0000000
--- a/tests/language/tearoff_constructor_basic_test.dart
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Basic test for tear-off constructor closures.
-
-import "package:expect/expect.dart";
-
-class A {
-  // Implicit constructor A();
-  var f1 = "A.f1";
-}
-
-class P {
-  var x, y;
-  P(this.x, this.y);
-  factory P.origin() { return new P(0,0); }
-  factory P.ursprung() = P.origin;
-  P.onXAxis(x) : this(x, 0);
-}
-
-class C<T> {
-  T f1;
-  C(T p) : f1 = p;
-  C.n([T p]) : f1 = p;
-  listMaker() { return new List<T>#; }  // Closurize type parameter.
-}
-
-
-testMalformed() {
-  Expect.throws(() => new NoSuchClass#);
-  Expect.throws(() => new A#noSuchContstructor);
-}
-
-testA() {
-  var cc = new A#;  // Closurize implicit constructor.
-  var o = cc();
-  Expect.equals("A.f1", o.f1);
-  Expect.equals("A.f1", (new A#)().f1);
-  Expect.throws(() => new A#foo);
-}
-
-testP() {
-  var cc = new P#origin;
-  var o = cc();
-  Expect.equals(0, o.x);
-  cc = new P#ursprung;
-  o = cc();
-  Expect.equals(0, o.x);
-  cc = new P#onXAxis;
-  o = cc(5);
-  Expect.equals(0, o.y);
-  Expect.equals(5, o.x);
-  Expect.throws(() => cc(1, 1));  // Too many arguments.
-}
-
-testC() {
-  var cc = new C<int>#;
-  var o = cc(5);
-  Expect.equals("int", "${o.f1.runtimeType}");
-  Expect.throws(() => cc());  // Missing constructor parameter.
-
-  cc = new C<String>#n;
-  o = cc("foo");
-  Expect.equals("String", "${o.f1.runtimeType}");
-  o = cc();
-  Expect.equals(null, o.f1);
-
-  cc = o.listMaker();
-  Expect.isTrue(cc is Function);
-  var l = cc();
-  Expect.equals("List<String>", "${l.runtimeType}");
-}
-
-main() {
-  testA();
-  testC();
-  testP();
-  testMalformed();
-}
diff --git a/tests/language/vm/async_await_catch_stacktrace_test.dart b/tests/language/vm/async_await_catch_stacktrace_test.dart
new file mode 100644
index 0000000..f49ce15
--- /dev/null
+++ b/tests/language/vm/async_await_catch_stacktrace_test.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+void main() {
+  x() async {
+    print("Starting!");
+    try {
+      await runAsync();
+    } catch (e, st) {
+      print("Got exception and stacktrace:");
+      var stText = st.toString();
+      print(e);
+      print(stText);
+      // Stacktrace should be something like
+      // #0      runAsync.<runAsync_async_body> (this file)
+      // #1      Future.Future.microtask.<anonymous closure> (dart:async/future.dart:184)
+      // #2      _microtaskLoop (dart:async/schedule_microtask.dart:41)
+      // #3      _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
+      // #4      _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
+      // #5      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:149)
+
+      // if exception and stacktrace is rethrown correctly, NOT
+
+      // #0      main.<anonymous closure>.async_op (this file)
+      // #1      _asyncErrorWrapperHelper.<anonymous closure> (dart:async:134:33)
+      // #2      _RootZone.runBinary (dart:async/zone.dart:1410:54)
+      // #3      _FutureListener.handleError (dart:async/future_impl.dart:146:20)
+      // #4      _Future._propagateToListeners.handleError (dart:async/future_impl.dart:649:47)
+      // #5      _Future._propagateToListeners (dart:async/future_impl.dart:671:13)
+      // #6      _Future._completeError (dart:async/future_impl.dart:485:5)
+      // #7      _SyncCompleter._completeError (dart:async/future_impl.dart:56:12)
+      // #8      _Completer.completeError (dart:async/future_impl.dart:27:5)
+      // #9      runAsync.async_op (this file)
+      // #10     Future.Future.microtask.<anonymous closure> (dart:async/future.dart:184:26)
+      // #11     _microtaskLoop (dart:async/schedule_microtask.dart:41:5)
+      // #12     _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
+      // #13     _runPendingImmediateCallback (dart:isolate:1054:5)
+      // #14     _RawReceivePortImpl._handleMessage (dart:isolate:1104:5)
+
+      Expect.isFalse(stText.contains("propagateToListeners"));
+      Expect.isFalse(stText.contains("_completeError"));
+      Expect.isFalse(stText.contains("main"));
+    }
+    print("Ending!");
+  }
+
+  asyncStart();
+  x().then((_) => asyncEnd());
+}
+
+runAsync() async {
+  throw 'oh no!';
+}
diff --git a/tests/language/vm/lazy_deopt_vm_test.dart b/tests/language/vm/lazy_deopt_vm_test.dart
new file mode 100644
index 0000000..17c7430
--- /dev/null
+++ b/tests/language/vm/lazy_deopt_vm_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+// VMOptions=--optimization-filter=foo --deoptimize_every=10 --optimization-counter-threshold=10  --no-background-compilation
+
+// Test that lazy deoptimization on stack checks does not damage unoptimized
+// frame.
+
+import 'package:expect/expect.dart';
+
+
+foo() {
+  var a = 0;
+  var b = 1;
+  var c = 2;
+  var d = 3;
+  var e = 4;
+  for (var i = 0; i < 10; i++) {
+    a++;
+    b++;
+    c++;
+    d++;
+    e++;
+  }
+  Expect.equals(10, a);
+  Expect.equals(11, b);
+  Expect.equals(12, c);
+  Expect.equals(13, d);
+  Expect.equals(14, e);
+}
+
+main() {
+  for (var i = 0; i < 10; ++i) {
+    foo();
+  }
+}
+
+
diff --git a/tests/language/vm/regress_28325_test.dart b/tests/language/vm/regress_28325_test.dart
new file mode 100644
index 0000000..5276381
--- /dev/null
+++ b/tests/language/vm/regress_28325_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Test source positions in async errors.
+
+import "package:expect/expect.dart";
+import "dart:io";
+
+main() async {
+  try {
+    await Socket.connect("localhost", 0);
+    Expect.isTrue(false);  // Unreachable.
+  } catch (e, s) {
+    Expect.isTrue(e is SocketException);
+    Expect.isTrue(s.toString().contains("regress_28325_test.dart"));
+    print(s);
+    Expect.isTrue(s.toString().contains(":12"));  // Line number of "await".
+  }
+}
diff --git a/pkg/dev_compiler/test/codegen/language/aborting_switch_case_test.dart b/tests/language_strong/aborting_switch_case_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/aborting_switch_case_test.dart
rename to tests/language_strong/aborting_switch_case_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/abstract_exact_selector_test.dart b/tests/language_strong/abstract_exact_selector_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/abstract_exact_selector_test.dart
rename to tests/language_strong/abstract_exact_selector_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/abstract_factory_constructor_test.dart b/tests/language_strong/abstract_factory_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/abstract_factory_constructor_test.dart
rename to tests/language_strong/abstract_factory_constructor_test.dart
diff --git a/tests/language_strong/abstract_getter2_test.dart b/tests/language_strong/abstract_getter2_test.dart
new file mode 100644
index 0000000..9553ba4
--- /dev/null
+++ b/tests/language_strong/abstract_getter2_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+class A {
+  int get x => 100;
+}
+
+abstract class B extends A {
+  int _x;
+
+  int get x;
+  set x(int v) { _x = v; }
+}
+
+class C extends B {
+  int get x => super.x;
+}
+
+void main() {
+  B b = new C();
+  b.x = 42;
+  Expect.equals(b._x, 42);
+  Expect.equals(b.x, 100);
+}
diff --git a/pkg/dev_compiler/test/codegen/language/abstract_getter_test.dart b/tests/language_strong/abstract_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/abstract_getter_test.dart
rename to tests/language_strong/abstract_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/abstract_method_test.dart b/tests/language_strong/abstract_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/abstract_method_test.dart
rename to tests/language_strong/abstract_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/abstract_object_method_test.dart b/tests/language_strong/abstract_object_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/abstract_object_method_test.dart
rename to tests/language_strong/abstract_object_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/abstract_runtime_error_test.dart b/tests/language_strong/abstract_runtime_error_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/abstract_runtime_error_test.dart
rename to tests/language_strong/abstract_runtime_error_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/abstract_syntax_test.dart b/tests/language_strong/abstract_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/abstract_syntax_test.dart
rename to tests/language_strong/abstract_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/ackermann_test.dart b/tests/language_strong/ackermann_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/ackermann_test.dart
rename to tests/language_strong/ackermann_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/adjacent_const_string_literals_test.dart b/tests/language_strong/adjacent_const_string_literals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/adjacent_const_string_literals_test.dart
rename to tests/language_strong/adjacent_const_string_literals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/adjacent_string_literals_test.dart b/tests/language_strong/adjacent_string_literals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/adjacent_string_literals_test.dart
rename to tests/language_strong/adjacent_string_literals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/allocate_large_object_test.dart b/tests/language_strong/allocate_large_object_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/allocate_large_object_test.dart
rename to tests/language_strong/allocate_large_object_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/allocate_test.dart b/tests/language_strong/allocate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/allocate_test.dart
rename to tests/language_strong/allocate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/allocation_sinking_inlining_test.dart b/tests/language_strong/allocation_sinking_inlining_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/allocation_sinking_inlining_test.dart
rename to tests/language_strong/allocation_sinking_inlining_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/and_operation_on_non_integer_operand_test.dart b/tests/language_strong/and_operation_on_non_integer_operand_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/and_operation_on_non_integer_operand_test.dart
rename to tests/language_strong/and_operation_on_non_integer_operand_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/application_negative_test.dart b/tests/language_strong/application_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/application_negative_test.dart
rename to tests/language_strong/application_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/application_test.dart b/tests/language_strong/application_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/application_test.dart
rename to tests/language_strong/application_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/argument_definition_test.dart b/tests/language_strong/argument_definition_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/argument_definition_test.dart
rename to tests/language_strong/argument_definition_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/arithmetic2_test.dart b/tests/language_strong/arithmetic2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/arithmetic2_test.dart
rename to tests/language_strong/arithmetic2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/arithmetic_canonicalization_test.dart b/tests/language_strong/arithmetic_canonicalization_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/arithmetic_canonicalization_test.dart
rename to tests/language_strong/arithmetic_canonicalization_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/arithmetic_smi_overflow_test.dart b/tests/language_strong/arithmetic_smi_overflow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/arithmetic_smi_overflow_test.dart
rename to tests/language_strong/arithmetic_smi_overflow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/arithmetic_test.dart b/tests/language_strong/arithmetic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/arithmetic_test.dart
rename to tests/language_strong/arithmetic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/assert_assignable_type_test.dart b/tests/language_strong/assert_assignable_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/assert_assignable_type_test.dart
rename to tests/language_strong/assert_assignable_type_test.dart
diff --git a/tests/language_strong/assert_with_message_test.dart b/tests/language_strong/assert_with_message_test.dart
new file mode 100644
index 0000000..878bd71
--- /dev/null
+++ b/tests/language_strong/assert_with_message_test.dart
@@ -0,0 +1,88 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+main() {
+  var assertsEnabled = false;
+  assert((assertsEnabled = true));
+  if (!assertsEnabled) return;
+
+  // TODO(rnystrom): Test cases where the first argument to assert() is a
+  // function.
+
+  testAssertFails();
+  testAssertDoesNotFail();
+  testNullMessage();
+  testDoesNotEvaluateMessageIfAssertSucceeds();
+  testMessageExpressionThatThrows();
+  testCallsToStringOnMessageLazily();
+}
+
+/// A class with a custom toString() that tracks when it is called.
+class ToString {
+  bool calledToString = false;
+
+  String toString() {
+    calledToString = true;
+    return "toString!";
+  }
+}
+
+testAssertFails() {
+  try {
+    assert(false, "Oops");
+    Expect.fail("Assert should throw.");
+  } catch (e) {
+    Expect.isTrue(e.toString().contains("Oops"));
+  }
+}
+
+testAssertDoesNotFail() {
+  try {
+    assert(true, "Oops");
+  } catch (e) {
+    Expect.fail("Assert should not throw.");
+  }
+}
+
+testNullMessage() {
+  try {
+    assert(false, null);
+    Expect.fail("Assert should throw.");
+  } catch (e) {
+    Expect.isTrue(e.toString().contains("null"));
+  }
+}
+
+testDoesNotEvaluateMessageIfAssertSucceeds() {
+  try {
+    var evaluated = false;
+    assert(true, evaluated = true);
+    Expect.isFalse(evaluated);
+  } catch (e) {
+    Expect.fail("Assert should not throw.");
+  }
+}
+
+testMessageExpressionThatThrows() {
+  try {
+    assert(false, throw "dang");
+    Expect.fail("Should throw");
+  } catch (e) {
+    Expect.equals(e, "dang");
+  }
+}
+
+testCallsToStringOnMessageLazily() {
+  var toString = new ToString();
+  try {
+    assert(false, toString);
+    Expect.fail("Assert should throw.");
+  } catch (e) {
+    Expect.isFalse(toString.calledToString);
+    Expect.isTrue(e.toString().contains("toString!"));
+    Expect.isTrue(toString.calledToString);
+  }
+}
diff --git a/pkg/dev_compiler/test/codegen/language/assert_with_type_test_or_cast_test.dart b/tests/language_strong/assert_with_type_test_or_cast_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/assert_with_type_test_or_cast_test.dart
rename to tests/language_strong/assert_with_type_test_or_cast_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/assertion_test.dart b/tests/language_strong/assertion_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/assertion_test.dart
rename to tests/language_strong/assertion_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/assign_instance_method_negative_test.dart b/tests/language_strong/assign_instance_method_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/assign_instance_method_negative_test.dart
rename to tests/language_strong/assign_instance_method_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/assign_op_test.dart b/tests/language_strong/assign_op_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/assign_op_test.dart
rename to tests/language_strong/assign_op_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/assign_static_type_test.dart b/tests/language_strong/assign_static_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/assign_static_type_test.dart
rename to tests/language_strong/assign_static_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/assign_to_type_test.dart b/tests/language_strong/assign_to_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/assign_to_type_test.dart
rename to tests/language_strong/assign_to_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/assign_top_method_test.dart b/tests/language_strong/assign_top_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/assign_top_method_test.dart
rename to tests/language_strong/assign_top_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/assignable_expression_test.dart b/tests/language_strong/assignable_expression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/assignable_expression_test.dart
rename to tests/language_strong/assignable_expression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_and_or_test.dart b/tests/language_strong/async_and_or_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_and_or_test.dart
rename to tests/language_strong/async_and_or_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_await_catch_regression_test.dart b/tests/language_strong/async_await_catch_regression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_await_catch_regression_test.dart
rename to tests/language_strong/async_await_catch_regression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_await_syntax_test.dart b/tests/language_strong/async_await_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_await_syntax_test.dart
rename to tests/language_strong/async_await_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_await_test.dart b/tests/language_strong/async_await_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_await_test.dart
rename to tests/language_strong/async_await_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_backwards_compatibility_1_test.dart b/tests/language_strong/async_backwards_compatibility_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_backwards_compatibility_1_test.dart
rename to tests/language_strong/async_backwards_compatibility_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_backwards_compatibility_2_test.dart b/tests/language_strong/async_backwards_compatibility_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_backwards_compatibility_2_test.dart
rename to tests/language_strong/async_backwards_compatibility_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_break_in_finally_test.dart b/tests/language_strong/async_break_in_finally_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_break_in_finally_test.dart
rename to tests/language_strong/async_break_in_finally_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_continue_label_test.dart b/tests/language_strong/async_continue_label_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_continue_label_test.dart
rename to tests/language_strong/async_continue_label_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_control_structures_test.dart b/tests/language_strong/async_control_structures_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_control_structures_test.dart
rename to tests/language_strong/async_control_structures_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_finally_rethrow_test.dart b/tests/language_strong/async_finally_rethrow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_finally_rethrow_test.dart
rename to tests/language_strong/async_finally_rethrow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_helper_lib.dart b/tests/language_strong/async_helper_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_helper_lib.dart
rename to tests/language_strong/async_helper_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_or_generator_return_type_stacktrace_test.dart b/tests/language_strong/async_or_generator_return_type_stacktrace_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_or_generator_return_type_stacktrace_test.dart
rename to tests/language_strong/async_or_generator_return_type_stacktrace_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_regression_23058_test.dart b/tests/language_strong/async_regression_23058_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_regression_23058_test.dart
rename to tests/language_strong/async_regression_23058_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_rethrow_test.dart b/tests/language_strong/async_rethrow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_rethrow_test.dart
rename to tests/language_strong/async_rethrow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_return_types_test.dart b/tests/language_strong/async_return_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_return_types_test.dart
rename to tests/language_strong/async_return_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_star_await_pauses_test.dart b/tests/language_strong/async_star_await_pauses_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_star_await_pauses_test.dart
rename to tests/language_strong/async_star_await_pauses_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_star_cancel_and_throw_in_finally_test.dart b/tests/language_strong/async_star_cancel_and_throw_in_finally_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_star_cancel_and_throw_in_finally_test.dart
rename to tests/language_strong/async_star_cancel_and_throw_in_finally_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_star_cancel_while_paused_test.dart b/tests/language_strong/async_star_cancel_while_paused_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_star_cancel_while_paused_test.dart
rename to tests/language_strong/async_star_cancel_while_paused_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_star_regression_2238_test.dart b/tests/language_strong/async_star_regression_2238_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_star_regression_2238_test.dart
rename to tests/language_strong/async_star_regression_2238_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_star_regression_23116_test.dart b/tests/language_strong/async_star_regression_23116_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_star_regression_23116_test.dart
rename to tests/language_strong/async_star_regression_23116_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_star_regression_fisk_test.dart b/tests/language_strong/async_star_regression_fisk_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_star_regression_fisk_test.dart
rename to tests/language_strong/async_star_regression_fisk_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_star_stream_take_test.dart b/tests/language_strong/async_star_stream_take_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_star_stream_take_test.dart
rename to tests/language_strong/async_star_stream_take_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_star_take_reyield_test.dart b/tests/language_strong/async_star_take_reyield_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_star_take_reyield_test.dart
rename to tests/language_strong/async_star_take_reyield_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_star_test.dart b/tests/language_strong/async_star_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_star_test.dart
rename to tests/language_strong/async_star_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_switch_test.dart b/tests/language_strong/async_switch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_switch_test.dart
rename to tests/language_strong/async_switch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_test.dart b/tests/language_strong/async_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_test.dart
rename to tests/language_strong/async_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_this_bound_test.dart b/tests/language_strong/async_this_bound_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_this_bound_test.dart
rename to tests/language_strong/async_this_bound_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/async_throw_in_catch_test.dart b/tests/language_strong/async_throw_in_catch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/async_throw_in_catch_test.dart
rename to tests/language_strong/async_throw_in_catch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/asyncstar_concat_test.dart b/tests/language_strong/asyncstar_concat_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/asyncstar_concat_test.dart
rename to tests/language_strong/asyncstar_concat_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/asyncstar_throw_in_catch_test.dart b/tests/language_strong/asyncstar_throw_in_catch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/asyncstar_throw_in_catch_test.dart
rename to tests/language_strong/asyncstar_throw_in_catch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/asyncstar_yield_test.dart b/tests/language_strong/asyncstar_yield_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/asyncstar_yield_test.dart
rename to tests/language_strong/asyncstar_yield_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/asyncstar_yieldstar_test.dart b/tests/language_strong/asyncstar_yieldstar_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/asyncstar_yieldstar_test.dart
rename to tests/language_strong/asyncstar_yieldstar_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_backwards_compatibility_test.dart b/tests/language_strong/await_backwards_compatibility_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_backwards_compatibility_test.dart
rename to tests/language_strong/await_backwards_compatibility_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_exceptions_test.dart b/tests/language_strong/await_exceptions_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_exceptions_test.dart
rename to tests/language_strong/await_exceptions_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_for_cancel_test.dart b/tests/language_strong/await_for_cancel_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_for_cancel_test.dart
rename to tests/language_strong/await_for_cancel_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_for_test.dart b/tests/language_strong/await_for_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_for_test.dart
rename to tests/language_strong/await_for_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_for_use_local_test.dart b/tests/language_strong/await_for_use_local_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_for_use_local_test.dart
rename to tests/language_strong/await_for_use_local_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_future_test.dart b/tests/language_strong/await_future_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_future_test.dart
rename to tests/language_strong/await_future_test.dart
diff --git a/tests/language_strong/await_in_cascade_test.dart b/tests/language_strong/await_in_cascade_test.dart
new file mode 100644
index 0000000..7049e73
--- /dev/null
+++ b/tests/language_strong/await_in_cascade_test.dart
@@ -0,0 +1,15 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+
+class C {
+  Future<List<int>> m() async => []..add(await _m());
+  Future<int> _m() async => 42;
+}
+
+main() async {
+  Expect.equals((await new C().m()).first, 42);
+}
diff --git a/pkg/dev_compiler/test/codegen/language/await_nonfuture_test.dart b/tests/language_strong/await_nonfuture_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_nonfuture_test.dart
rename to tests/language_strong/await_nonfuture_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_not_started_immediately_test.dart b/tests/language_strong/await_not_started_immediately_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_not_started_immediately_test.dart
rename to tests/language_strong/await_not_started_immediately_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_postfix_expr_test.dart b/tests/language_strong/await_postfix_expr_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_postfix_expr_test.dart
rename to tests/language_strong/await_postfix_expr_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_regression_test.dart b/tests/language_strong/await_regression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_regression_test.dart
rename to tests/language_strong/await_regression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/await_test.dart b/tests/language_strong/await_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/await_test.dart
rename to tests/language_strong/await_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bad_constructor_test.dart b/tests/language_strong/bad_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bad_constructor_test.dart
rename to tests/language_strong/bad_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bad_initializer1_negative_test.dart b/tests/language_strong/bad_initializer1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bad_initializer1_negative_test.dart
rename to tests/language_strong/bad_initializer1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bad_initializer2_negative_test.dart b/tests/language_strong/bad_initializer2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bad_initializer2_negative_test.dart
rename to tests/language_strong/bad_initializer2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bad_named_constructor_negative_test.dart b/tests/language_strong/bad_named_constructor_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bad_named_constructor_negative_test.dart
rename to tests/language_strong/bad_named_constructor_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bad_named_parameters2_test.dart b/tests/language_strong/bad_named_parameters2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bad_named_parameters2_test.dart
rename to tests/language_strong/bad_named_parameters2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bad_named_parameters_test.dart b/tests/language_strong/bad_named_parameters_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bad_named_parameters_test.dart
rename to tests/language_strong/bad_named_parameters_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bad_override_test.dart b/tests/language_strong/bad_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bad_override_test.dart
rename to tests/language_strong/bad_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bad_raw_string_negative_test.dart b/tests/language_strong/bad_raw_string_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bad_raw_string_negative_test.dart
rename to tests/language_strong/bad_raw_string_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bailout2_test.dart b/tests/language_strong/bailout2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bailout2_test.dart
rename to tests/language_strong/bailout2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bailout3_test.dart b/tests/language_strong/bailout3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bailout3_test.dart
rename to tests/language_strong/bailout3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bailout4_test.dart b/tests/language_strong/bailout4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bailout4_test.dart
rename to tests/language_strong/bailout4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bailout5_test.dart b/tests/language_strong/bailout5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bailout5_test.dart
rename to tests/language_strong/bailout5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bailout6_test.dart b/tests/language_strong/bailout6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bailout6_test.dart
rename to tests/language_strong/bailout6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bailout7_test.dart b/tests/language_strong/bailout7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bailout7_test.dart
rename to tests/language_strong/bailout7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bailout_container_type_test.dart b/tests/language_strong/bailout_container_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bailout_container_type_test.dart
rename to tests/language_strong/bailout_container_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bailout_test.dart b/tests/language_strong/bailout_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bailout_test.dart
rename to tests/language_strong/bailout_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bind_test.dart b/tests/language_strong/bind_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bind_test.dart
rename to tests/language_strong/bind_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bit_operations_test.dart b/tests/language_strong/bit_operations_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bit_operations_test.dart
rename to tests/language_strong/bit_operations_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bit_shift_test.dart b/tests/language_strong/bit_shift_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bit_shift_test.dart
rename to tests/language_strong/bit_shift_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/black_listed_test.dart b/tests/language_strong/black_listed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/black_listed_test.dart
rename to tests/language_strong/black_listed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/body_less_constructor_wrong_arg_negative_test.dart b/tests/language_strong/body_less_constructor_wrong_arg_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/body_less_constructor_wrong_arg_negative_test.dart
rename to tests/language_strong/body_less_constructor_wrong_arg_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bool_check_test.dart b/tests/language_strong/bool_check_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bool_check_test.dart
rename to tests/language_strong/bool_check_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bool_condition_check_test.dart b/tests/language_strong/bool_condition_check_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bool_condition_check_test.dart
rename to tests/language_strong/bool_condition_check_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bool_test.dart b/tests/language_strong/bool_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bool_test.dart
rename to tests/language_strong/bool_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bootstrap_test.dart b/tests/language_strong/bootstrap_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bootstrap_test.dart
rename to tests/language_strong/bootstrap_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bound_closure_equality_test.dart b/tests/language_strong/bound_closure_equality_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bound_closure_equality_test.dart
rename to tests/language_strong/bound_closure_equality_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/bound_closure_primitives_test.dart b/tests/language_strong/bound_closure_primitives_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/bound_closure_primitives_test.dart
rename to tests/language_strong/bound_closure_primitives_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/branch_canonicalization_test.dart b/tests/language_strong/branch_canonicalization_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/branch_canonicalization_test.dart
rename to tests/language_strong/branch_canonicalization_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/branches_test.dart b/tests/language_strong/branches_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/branches_test.dart
rename to tests/language_strong/branches_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/break_test.dart b/tests/language_strong/break_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/break_test.dart
rename to tests/language_strong/break_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_illegal_test.dart b/tests/language_strong/built_in_identifier_illegal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_illegal_test.dart
rename to tests/language_strong/built_in_identifier_illegal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_abstract.dart b/tests/language_strong/built_in_identifier_prefix_library_abstract.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_abstract.dart
rename to tests/language_strong/built_in_identifier_prefix_library_abstract.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_as.dart b/tests/language_strong/built_in_identifier_prefix_library_as.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_as.dart
rename to tests/language_strong/built_in_identifier_prefix_library_as.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_dynamic.dart b/tests/language_strong/built_in_identifier_prefix_library_dynamic.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_dynamic.dart
rename to tests/language_strong/built_in_identifier_prefix_library_dynamic.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_export.dart b/tests/language_strong/built_in_identifier_prefix_library_export.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_export.dart
rename to tests/language_strong/built_in_identifier_prefix_library_export.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_external.dart b/tests/language_strong/built_in_identifier_prefix_library_external.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_external.dart
rename to tests/language_strong/built_in_identifier_prefix_library_external.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_factory.dart b/tests/language_strong/built_in_identifier_prefix_library_factory.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_factory.dart
rename to tests/language_strong/built_in_identifier_prefix_library_factory.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_get.dart b/tests/language_strong/built_in_identifier_prefix_library_get.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_get.dart
rename to tests/language_strong/built_in_identifier_prefix_library_get.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_implements.dart b/tests/language_strong/built_in_identifier_prefix_library_implements.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_implements.dart
rename to tests/language_strong/built_in_identifier_prefix_library_implements.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_import.dart b/tests/language_strong/built_in_identifier_prefix_library_import.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_import.dart
rename to tests/language_strong/built_in_identifier_prefix_library_import.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_library.dart b/tests/language_strong/built_in_identifier_prefix_library_library.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_library.dart
rename to tests/language_strong/built_in_identifier_prefix_library_library.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_operator.dart b/tests/language_strong/built_in_identifier_prefix_library_operator.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_operator.dart
rename to tests/language_strong/built_in_identifier_prefix_library_operator.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_part.dart b/tests/language_strong/built_in_identifier_prefix_library_part.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_part.dart
rename to tests/language_strong/built_in_identifier_prefix_library_part.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_set.dart b/tests/language_strong/built_in_identifier_prefix_library_set.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_set.dart
rename to tests/language_strong/built_in_identifier_prefix_library_set.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_static.dart b/tests/language_strong/built_in_identifier_prefix_library_static.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_static.dart
rename to tests/language_strong/built_in_identifier_prefix_library_static.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_typedef.dart b/tests/language_strong/built_in_identifier_prefix_library_typedef.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_library_typedef.dart
rename to tests/language_strong/built_in_identifier_prefix_library_typedef.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_test.dart b/tests/language_strong/built_in_identifier_prefix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_prefix_test.dart
rename to tests/language_strong/built_in_identifier_prefix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/built_in_identifier_test.dart b/tests/language_strong/built_in_identifier_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/built_in_identifier_test.dart
rename to tests/language_strong/built_in_identifier_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_argument_inference_test.dart b/tests/language_strong/call_argument_inference_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_argument_inference_test.dart
rename to tests/language_strong/call_argument_inference_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_closurization_test.dart b/tests/language_strong/call_closurization_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_closurization_test.dart
rename to tests/language_strong/call_closurization_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_constructor_on_unresolvable_class_test.dart b/tests/language_strong/call_constructor_on_unresolvable_class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_constructor_on_unresolvable_class_test.dart
rename to tests/language_strong/call_constructor_on_unresolvable_class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_function2_test.dart b/tests/language_strong/call_function2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_function2_test.dart
rename to tests/language_strong/call_function2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_function_apply_test.dart b/tests/language_strong/call_function_apply_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_function_apply_test.dart
rename to tests/language_strong/call_function_apply_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_function_test.dart b/tests/language_strong/call_function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_function_test.dart
rename to tests/language_strong/call_function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_non_method_field_test.dart b/tests/language_strong/call_non_method_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_non_method_field_test.dart
rename to tests/language_strong/call_non_method_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_nonexistent_constructor_test.dart b/tests/language_strong/call_nonexistent_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_nonexistent_constructor_test.dart
rename to tests/language_strong/call_nonexistent_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_nonexistent_static_test.dart b/tests/language_strong/call_nonexistent_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_nonexistent_static_test.dart
rename to tests/language_strong/call_nonexistent_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_operator_test.dart b/tests/language_strong/call_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_operator_test.dart
rename to tests/language_strong/call_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_property_test.dart b/tests/language_strong/call_property_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_property_test.dart
rename to tests/language_strong/call_property_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_test.dart b/tests/language_strong/call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_test.dart
rename to tests/language_strong/call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_this_test.dart b/tests/language_strong/call_this_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_this_test.dart
rename to tests/language_strong/call_this_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_through_getter_test.dart b/tests/language_strong/call_through_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_through_getter_test.dart
rename to tests/language_strong/call_through_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_through_null_getter_test.dart b/tests/language_strong/call_through_null_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_through_null_getter_test.dart
rename to tests/language_strong/call_through_null_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_type_literal_test.dart b/tests/language_strong/call_type_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_type_literal_test.dart
rename to tests/language_strong/call_type_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/call_with_no_such_method_test.dart b/tests/language_strong/call_with_no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/call_with_no_such_method_test.dart
rename to tests/language_strong/call_with_no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/callable_test.dart b/tests/language_strong/callable_test.dart
similarity index 87%
rename from pkg/dev_compiler/test/codegen/language/callable_test.dart
rename to tests/language_strong/callable_test.dart
index 57e7ffb..7865d20 100644
--- a/pkg/dev_compiler/test/codegen/language/callable_test.dart
+++ b/tests/language_strong/callable_test.dart
@@ -8,6 +8,10 @@
   call() => 42;
 }
 
+class XX extends X {
+  XX.named();
+}
+
 class Y {
   call(int x) => 87 + x;
 
@@ -24,6 +28,7 @@
 
 typedef F(int x);
 typedef G(String y);
+typedef H();
 
 main() {
   X x = new X();
@@ -44,4 +49,10 @@
 
   Expect.equals(Y.staticMethod(6), 7);
   Expect.equals(Z.staticMethod(6), 7);
+
+  var xx = new XX.named();
+  Expect.equals(xx(), 42);
+
+  H xx2 = new XX.named();
+  Expect.equals(xx2(), 42);
 }
diff --git a/pkg/dev_compiler/test/codegen/language/canonical_const2_test.dart b/tests/language_strong/canonical_const2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/canonical_const2_test.dart
rename to tests/language_strong/canonical_const2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/canonical_const3_test.dart b/tests/language_strong/canonical_const3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/canonical_const3_test.dart
rename to tests/language_strong/canonical_const3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/canonical_const_test.dart b/tests/language_strong/canonical_const_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/canonical_const_test.dart
rename to tests/language_strong/canonical_const_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cascade2_test.dart b/tests/language_strong/cascade2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cascade2_test.dart
rename to tests/language_strong/cascade2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cascade_2_test.dart b/tests/language_strong/cascade_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cascade_2_test.dart
rename to tests/language_strong/cascade_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cascade_in_expression_function_test.dart b/tests/language_strong/cascade_in_expression_function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cascade_in_expression_function_test.dart
rename to tests/language_strong/cascade_in_expression_function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cascade_in_initializer_list_test.dart b/tests/language_strong/cascade_in_initializer_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cascade_in_initializer_list_test.dart
rename to tests/language_strong/cascade_in_initializer_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cascade_nested_test.dart b/tests/language_strong/cascade_nested_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cascade_nested_test.dart
rename to tests/language_strong/cascade_nested_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cascade_precedence_test.dart b/tests/language_strong/cascade_precedence_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cascade_precedence_test.dart
rename to tests/language_strong/cascade_precedence_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cascade_test.dart b/tests/language_strong/cascade_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cascade_test.dart
rename to tests/language_strong/cascade_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cast2_test.dart b/tests/language_strong/cast2_test.dart
similarity index 89%
rename from pkg/dev_compiler/test/codegen/language/cast2_test.dart
rename to tests/language_strong/cast2_test.dart
index d67c89b..4f613b7 100644
--- a/pkg/dev_compiler/test/codegen/language/cast2_test.dart
+++ b/tests/language_strong/cast2_test.dart
@@ -22,7 +22,7 @@
   C oc = new C();
   D od = new D();
 
-  (oc as dynamic).bar;  /// 01: runtime error
+  Expect.throws(() => (oc as dynamic).bar, (e) => e is NoSuchMethodError);
 
   // Casts should always evaluate the left-hand side, if only for its effects.
   oc.inc() as dynamic;
diff --git a/pkg/dev_compiler/test/codegen/language/cast_test.dart b/tests/language_strong/cast_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cast_test.dart
rename to tests/language_strong/cast_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/catch_liveness_test.dart b/tests/language_strong/catch_liveness_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/catch_liveness_test.dart
rename to tests/language_strong/catch_liveness_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cha_deopt1_deferred_lib.dart b/tests/language_strong/cha_deopt1_deferred_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cha_deopt1_deferred_lib.dart
rename to tests/language_strong/cha_deopt1_deferred_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cha_deopt1_lib.dart b/tests/language_strong/cha_deopt1_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cha_deopt1_lib.dart
rename to tests/language_strong/cha_deopt1_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cha_deopt1_test.dart b/tests/language_strong/cha_deopt1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cha_deopt1_test.dart
rename to tests/language_strong/cha_deopt1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cha_deopt2_deferred_lib.dart b/tests/language_strong/cha_deopt2_deferred_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cha_deopt2_deferred_lib.dart
rename to tests/language_strong/cha_deopt2_deferred_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cha_deopt2_lib.dart b/tests/language_strong/cha_deopt2_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cha_deopt2_lib.dart
rename to tests/language_strong/cha_deopt2_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cha_deopt2_test.dart b/tests/language_strong/cha_deopt2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cha_deopt2_test.dart
rename to tests/language_strong/cha_deopt2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cha_deopt3_deferred_lib.dart b/tests/language_strong/cha_deopt3_deferred_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cha_deopt3_deferred_lib.dart
rename to tests/language_strong/cha_deopt3_deferred_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cha_deopt3_lib.dart b/tests/language_strong/cha_deopt3_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cha_deopt3_lib.dart
rename to tests/language_strong/cha_deopt3_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cha_deopt3_test.dart b/tests/language_strong/cha_deopt3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cha_deopt3_test.dart
rename to tests/language_strong/cha_deopt3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/char_escape_test.dart b/tests/language_strong/char_escape_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/char_escape_test.dart
rename to tests/language_strong/char_escape_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/check_member_static_test.dart b/tests/language_strong/check_member_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/check_member_static_test.dart
rename to tests/language_strong/check_member_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/check_method_override_test.dart b/tests/language_strong/check_method_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/check_method_override_test.dart
rename to tests/language_strong/check_method_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/checked_mode_helper.dart b/tests/language_strong/checked_mode_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/checked_mode_helper.dart
rename to tests/language_strong/checked_mode_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/language/checked_null_test.dart b/tests/language_strong/checked_null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/checked_null_test.dart
rename to tests/language_strong/checked_null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/checked_setter2_test.dart b/tests/language_strong/checked_setter2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/checked_setter2_test.dart
rename to tests/language_strong/checked_setter2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/checked_setter3_test.dart b/tests/language_strong/checked_setter3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/checked_setter3_test.dart
rename to tests/language_strong/checked_setter3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/checked_setter_test.dart b/tests/language_strong/checked_setter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/checked_setter_test.dart
rename to tests/language_strong/checked_setter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/class_codegen_test.dart b/tests/language_strong/class_codegen_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/class_codegen_test.dart
rename to tests/language_strong/class_codegen_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/class_cycle2_test.dart b/tests/language_strong/class_cycle2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/class_cycle2_test.dart
rename to tests/language_strong/class_cycle2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/class_cycle_test.dart b/tests/language_strong/class_cycle_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/class_cycle_test.dart
rename to tests/language_strong/class_cycle_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/class_keyword_test.dart b/tests/language_strong/class_keyword_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/class_keyword_test.dart
rename to tests/language_strong/class_keyword_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/class_literal_test.dart b/tests/language_strong/class_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/class_literal_test.dart
rename to tests/language_strong/class_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/class_override_test.dart b/tests/language_strong/class_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/class_override_test.dart
rename to tests/language_strong/class_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/class_syntax2_test.dart b/tests/language_strong/class_syntax2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/class_syntax2_test.dart
rename to tests/language_strong/class_syntax2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/class_syntax_test.dart b/tests/language_strong/class_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/class_syntax_test.dart
rename to tests/language_strong/class_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/class_test.dart b/tests/language_strong/class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/class_test.dart
rename to tests/language_strong/class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/classes_static_method_clash_test.dart b/tests/language_strong/classes_static_method_clash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/classes_static_method_clash_test.dart
rename to tests/language_strong/classes_static_method_clash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure2_test.dart b/tests/language_strong/closure2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure2_test.dart
rename to tests/language_strong/closure2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure3_test.dart b/tests/language_strong/closure3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure3_test.dart
rename to tests/language_strong/closure3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure4_test.dart b/tests/language_strong/closure4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure4_test.dart
rename to tests/language_strong/closure4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure5_test.dart b/tests/language_strong/closure5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure5_test.dart
rename to tests/language_strong/closure5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure6_test.dart b/tests/language_strong/closure6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure6_test.dart
rename to tests/language_strong/closure6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure7_test.dart b/tests/language_strong/closure7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure7_test.dart
rename to tests/language_strong/closure7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure8_test.dart b/tests/language_strong/closure8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure8_test.dart
rename to tests/language_strong/closure8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_break1_test.dart b/tests/language_strong/closure_break1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_break1_test.dart
rename to tests/language_strong/closure_break1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_break2_test.dart b/tests/language_strong/closure_break2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_break2_test.dart
rename to tests/language_strong/closure_break2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_break_test.dart b/tests/language_strong/closure_break_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_break_test.dart
rename to tests/language_strong/closure_break_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_call_wrong_argument_count_negative_test.dart b/tests/language_strong/closure_call_wrong_argument_count_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_call_wrong_argument_count_negative_test.dart
rename to tests/language_strong/closure_call_wrong_argument_count_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_cycles_test.dart b/tests/language_strong/closure_cycles_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_cycles_test.dart
rename to tests/language_strong/closure_cycles_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_in_constructor_test.dart b/tests/language_strong/closure_in_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_in_constructor_test.dart
rename to tests/language_strong/closure_in_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_in_field_initializer_test.dart b/tests/language_strong/closure_in_field_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_in_field_initializer_test.dart
rename to tests/language_strong/closure_in_field_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_in_initializer2_test.dart b/tests/language_strong/closure_in_initializer2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_in_initializer2_test.dart
rename to tests/language_strong/closure_in_initializer2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_in_initializer_test.dart b/tests/language_strong/closure_in_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_in_initializer_test.dart
rename to tests/language_strong/closure_in_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_internals_test.dart b/tests/language_strong/closure_internals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_internals_test.dart
rename to tests/language_strong/closure_internals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_parameter_types_test.dart b/tests/language_strong/closure_parameter_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_parameter_types_test.dart
rename to tests/language_strong/closure_parameter_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_self_reference_test.dart b/tests/language_strong/closure_self_reference_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_self_reference_test.dart
rename to tests/language_strong/closure_self_reference_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_shared_state_test.dart b/tests/language_strong/closure_shared_state_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_shared_state_test.dart
rename to tests/language_strong/closure_shared_state_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_side_effect_test.dart b/tests/language_strong/closure_side_effect_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_side_effect_test.dart
rename to tests/language_strong/closure_side_effect_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_test.dart b/tests/language_strong/closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_test.dart
rename to tests/language_strong/closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_type_test.dart b/tests/language_strong/closure_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_type_test.dart
rename to tests/language_strong/closure_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_type_variable_test.dart b/tests/language_strong/closure_type_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_type_variable_test.dart
rename to tests/language_strong/closure_type_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_type_variables_test.dart b/tests/language_strong/closure_type_variables_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_type_variables_test.dart
rename to tests/language_strong/closure_type_variables_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_variable_shadow_test.dart b/tests/language_strong/closure_variable_shadow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_variable_shadow_test.dart
rename to tests/language_strong/closure_variable_shadow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closure_with_super_field_test.dart b/tests/language_strong/closure_with_super_field_test.dart
similarity index 88%
rename from pkg/dev_compiler/test/codegen/language/closure_with_super_field_test.dart
rename to tests/language_strong/closure_with_super_field_test.dart
index 67f75d1..d98470a 100644
--- a/pkg/dev_compiler/test/codegen/language/closure_with_super_field_test.dart
+++ b/tests/language_strong/closure_with_super_field_test.dart
@@ -3,9 +3,10 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:meta/meta.dart" show virtual;
 
 class A {
-  int a;
+  @virtual int a;
   A(): a = 42;
 }
 
diff --git a/pkg/dev_compiler/test/codegen/language/closure_with_super_send_test.dart b/tests/language_strong/closure_with_super_send_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closure_with_super_send_test.dart
rename to tests/language_strong/closure_with_super_send_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closures_initializer2_test.dart b/tests/language_strong/closures_initializer2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closures_initializer2_test.dart
rename to tests/language_strong/closures_initializer2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closures_initializer_test.dart b/tests/language_strong/closures_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closures_initializer_test.dart
rename to tests/language_strong/closures_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/closures_with_complex_params_test.dart b/tests/language_strong/closures_with_complex_params_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/closures_with_complex_params_test.dart
rename to tests/language_strong/closures_with_complex_params_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/code_after_try_is_executed_test.dart b/tests/language_strong/code_after_try_is_executed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/code_after_try_is_executed_test.dart
rename to tests/language_strong/code_after_try_is_executed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/code_motion_crash_test.dart b/tests/language_strong/code_motion_crash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/code_motion_crash_test.dart
rename to tests/language_strong/code_motion_crash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/comparison_test.dart b/tests/language_strong/comparison_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/comparison_test.dart
rename to tests/language_strong/comparison_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant10_test.dart b/tests/language_strong/compile_time_constant10_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant10_test.dart
rename to tests/language_strong/compile_time_constant10_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant11_test.dart b/tests/language_strong/compile_time_constant11_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant11_test.dart
rename to tests/language_strong/compile_time_constant11_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant12_test.dart b/tests/language_strong/compile_time_constant12_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant12_test.dart
rename to tests/language_strong/compile_time_constant12_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant13_test.dart b/tests/language_strong/compile_time_constant13_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant13_test.dart
rename to tests/language_strong/compile_time_constant13_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant2_test.dart b/tests/language_strong/compile_time_constant2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant2_test.dart
rename to tests/language_strong/compile_time_constant2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant3_test.dart b/tests/language_strong/compile_time_constant3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant3_test.dart
rename to tests/language_strong/compile_time_constant3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant5_test.dart b/tests/language_strong/compile_time_constant5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant5_test.dart
rename to tests/language_strong/compile_time_constant5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant6_test.dart b/tests/language_strong/compile_time_constant6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant6_test.dart
rename to tests/language_strong/compile_time_constant6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant7_test.dart b/tests/language_strong/compile_time_constant7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant7_test.dart
rename to tests/language_strong/compile_time_constant7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant8_test.dart b/tests/language_strong/compile_time_constant8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant8_test.dart
rename to tests/language_strong/compile_time_constant8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant9_test.dart b/tests/language_strong/compile_time_constant9_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant9_test.dart
rename to tests/language_strong/compile_time_constant9_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_a_test.dart b/tests/language_strong/compile_time_constant_a_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_a_test.dart
rename to tests/language_strong/compile_time_constant_a_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_arguments_test.dart b/tests/language_strong/compile_time_constant_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_arguments_test.dart
rename to tests/language_strong/compile_time_constant_arguments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_b_test.dart b/tests/language_strong/compile_time_constant_b_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_b_test.dart
rename to tests/language_strong/compile_time_constant_b_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_c_test.dart b/tests/language_strong/compile_time_constant_c_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_c_test.dart
rename to tests/language_strong/compile_time_constant_c_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_checked2_test.dart b/tests/language_strong/compile_time_constant_checked2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_checked2_test.dart
rename to tests/language_strong/compile_time_constant_checked2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_checked3_test.dart b/tests/language_strong/compile_time_constant_checked3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_checked3_test.dart
rename to tests/language_strong/compile_time_constant_checked3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_checked4_test.dart b/tests/language_strong/compile_time_constant_checked4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_checked4_test.dart
rename to tests/language_strong/compile_time_constant_checked4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_checked5_test.dart b/tests/language_strong/compile_time_constant_checked5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_checked5_test.dart
rename to tests/language_strong/compile_time_constant_checked5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_checked_test.dart b/tests/language_strong/compile_time_constant_checked_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_checked_test.dart
rename to tests/language_strong/compile_time_constant_checked_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_d_test.dart b/tests/language_strong/compile_time_constant_d_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_d_test.dart
rename to tests/language_strong/compile_time_constant_d_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_e_test.dart b/tests/language_strong/compile_time_constant_e_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_e_test.dart
rename to tests/language_strong/compile_time_constant_e_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_f_test.dart b/tests/language_strong/compile_time_constant_f_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_f_test.dart
rename to tests/language_strong/compile_time_constant_f_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_g_test.dart b/tests/language_strong/compile_time_constant_g_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_g_test.dart
rename to tests/language_strong/compile_time_constant_g_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_h_test.dart b/tests/language_strong/compile_time_constant_h_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_h_test.dart
rename to tests/language_strong/compile_time_constant_h_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_i_test.dart b/tests/language_strong/compile_time_constant_i_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_i_test.dart
rename to tests/language_strong/compile_time_constant_i_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_j_test.dart b/tests/language_strong/compile_time_constant_j_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_j_test.dart
rename to tests/language_strong/compile_time_constant_j_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_k_test.dart b/tests/language_strong/compile_time_constant_k_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_k_test.dart
rename to tests/language_strong/compile_time_constant_k_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_l_test.dart b/tests/language_strong/compile_time_constant_l_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_l_test.dart
rename to tests/language_strong/compile_time_constant_l_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_m_test.dart b/tests/language_strong/compile_time_constant_m_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_m_test.dart
rename to tests/language_strong/compile_time_constant_m_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_n_test.dart b/tests/language_strong/compile_time_constant_n_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_n_test.dart
rename to tests/language_strong/compile_time_constant_n_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_o_test.dart b/tests/language_strong/compile_time_constant_o_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_o_test.dart
rename to tests/language_strong/compile_time_constant_o_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_p_test.dart b/tests/language_strong/compile_time_constant_p_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_p_test.dart
rename to tests/language_strong/compile_time_constant_p_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_q_test.dart b/tests/language_strong/compile_time_constant_q_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_q_test.dart
rename to tests/language_strong/compile_time_constant_q_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_r_test.dart b/tests/language_strong/compile_time_constant_r_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_r_test.dart
rename to tests/language_strong/compile_time_constant_r_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compile_time_constant_test.dart b/tests/language_strong/compile_time_constant_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compile_time_constant_test.dart
rename to tests/language_strong/compile_time_constant_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compiler_annotations.dart b/tests/language_strong/compiler_annotations.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compiler_annotations.dart
rename to tests/language_strong/compiler_annotations.dart
diff --git a/pkg/dev_compiler/test/codegen/language/compound_assignment_operator_test.dart b/tests/language_strong/compound_assignment_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/compound_assignment_operator_test.dart
rename to tests/language_strong/compound_assignment_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cond_expr_test.dart b/tests/language_strong/cond_expr_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cond_expr_test.dart
rename to tests/language_strong/cond_expr_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/condition_bailout_test.dart b/tests/language_strong/condition_bailout_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/condition_bailout_test.dart
rename to tests/language_strong/condition_bailout_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/conditional_access_helper.dart b/tests/language_strong/conditional_access_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/conditional_access_helper.dart
rename to tests/language_strong/conditional_access_helper.dart
diff --git a/tests/language_strong/conditional_import_string_test.dart b/tests/language_strong/conditional_import_string_test.dart
new file mode 100644
index 0000000..d7506bd
--- /dev/null
+++ b/tests/language_strong/conditional_import_string_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+// All three libraries have an HttpRequest class.
+import "conditional_import_string_test.dart"
+    if (dart.library.io == "true") "dart:io"
+    if (dart.library.html == "true") "dart:html"
+    deferred as d show HttpRequest;
+
+class HttpRequest {}
+
+void main() {
+  asyncStart();
+  var io = const String.fromEnvironment("dart.library.io");
+  var html = const String.fromEnvironment("dart.library.html");
+  () async {
+    // Shouldn't fail. Shouldn't time out.
+    await d.loadLibrary().timeout(const Duration(seconds: 5));
+    if (io == "true") {
+      print("io");
+      Expect.throws(() => new d.HttpRequest());  // Class is abstract in dart:io
+    } else if (html == "true") {
+      print("html");
+      dynamic r = new d.HttpRequest();  // Shouldn't throw
+      var o = r.open;  // Shouldn't fail, the open method is there.
+    } else {
+      print("none");
+      dynamic r = new d.HttpRequest();
+      Expect.isTrue(r is HttpRequest);
+    }
+    asyncEnd();
+  }();
+}
+
diff --git a/tests/language_strong/conditional_import_test.dart b/tests/language_strong/conditional_import_test.dart
new file mode 100644
index 0000000..0eeff70
--- /dev/null
+++ b/tests/language_strong/conditional_import_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+// All three libraries have an HttpRequest class.
+import "conditional_import_test.dart"
+    if (dart.library.io) "dart:io"
+    if (dart.library.html) "dart:html"
+    deferred as d show HttpRequest;
+
+class HttpRequest {}
+
+void main() {
+  asyncStart();
+  var io = const bool.fromEnvironment("dart.library.io");
+  var html = const bool.fromEnvironment("dart.library.html");
+  () async {
+    // Shouldn't fail. Shouldn't time out.
+    await d.loadLibrary().timeout(const Duration(seconds: 5));
+    if (io) {
+      print("io");
+      Expect.throws(() => new d.HttpRequest());  // Class is abstract in dart:io
+    } else if (html) {
+      print("html");
+      dynamic r = new d.HttpRequest();  // Shouldn't throw
+      var o = r.open;  // Shouldn't fail, the open method is there.
+    } else {
+      print("none");
+      dynamic r = new d.HttpRequest();
+      Expect.isTrue(r is HttpRequest);
+    }
+    asyncEnd();
+  }();
+}
+
diff --git a/pkg/dev_compiler/test/codegen/language/conditional_method_invocation_test.dart b/tests/language_strong/conditional_method_invocation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/conditional_method_invocation_test.dart
rename to tests/language_strong/conditional_method_invocation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/conditional_property_access_test.dart b/tests/language_strong/conditional_property_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/conditional_property_access_test.dart
rename to tests/language_strong/conditional_property_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/conditional_property_assignment_test.dart b/tests/language_strong/conditional_property_assignment_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/conditional_property_assignment_test.dart
rename to tests/language_strong/conditional_property_assignment_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/conditional_property_increment_decrement_test.dart b/tests/language_strong/conditional_property_increment_decrement_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/conditional_property_increment_decrement_test.dart
rename to tests/language_strong/conditional_property_increment_decrement_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/conditional_rewrite_test.dart b/tests/language_strong/conditional_rewrite_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/conditional_rewrite_test.dart
rename to tests/language_strong/conditional_rewrite_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_conditional_test.dart b/tests/language_strong/const_conditional_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_conditional_test.dart
rename to tests/language_strong/const_conditional_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_constructor2_test.dart b/tests/language_strong/const_constructor2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_constructor2_test.dart
rename to tests/language_strong/const_constructor2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_constructor3_test.dart b/tests/language_strong/const_constructor3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_constructor3_test.dart
rename to tests/language_strong/const_constructor3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_constructor_mixin2_test.dart b/tests/language_strong/const_constructor_mixin2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_constructor_mixin2_test.dart
rename to tests/language_strong/const_constructor_mixin2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_constructor_mixin3_test.dart b/tests/language_strong/const_constructor_mixin3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_constructor_mixin3_test.dart
rename to tests/language_strong/const_constructor_mixin3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_constructor_mixin_test.dart b/tests/language_strong/const_constructor_mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_constructor_mixin_test.dart
rename to tests/language_strong/const_constructor_mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_constructor_nonconst_field_test.dart b/tests/language_strong/const_constructor_nonconst_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_constructor_nonconst_field_test.dart
rename to tests/language_strong/const_constructor_nonconst_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_constructor_super_test.dart b/tests/language_strong/const_constructor_super_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_constructor_super_test.dart
rename to tests/language_strong/const_constructor_super_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_constructor_syntax_test.dart b/tests/language_strong/const_constructor_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_constructor_syntax_test.dart
rename to tests/language_strong/const_constructor_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_constructor_test.dart b/tests/language_strong/const_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_constructor_test.dart
rename to tests/language_strong/const_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_counter_negative_test.dart b/tests/language_strong/const_counter_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_counter_negative_test.dart
rename to tests/language_strong/const_counter_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_dynamic_type_literal_test.dart b/tests/language_strong/const_dynamic_type_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_dynamic_type_literal_test.dart
rename to tests/language_strong/const_dynamic_type_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_error_multiply_initialized_test.dart b/tests/language_strong/const_error_multiply_initialized_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_error_multiply_initialized_test.dart
rename to tests/language_strong/const_error_multiply_initialized_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_escape_frog_test.dart b/tests/language_strong/const_escape_frog_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_escape_frog_test.dart
rename to tests/language_strong/const_escape_frog_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_evaluation_test.dart b/tests/language_strong/const_evaluation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_evaluation_test.dart
rename to tests/language_strong/const_evaluation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_factory_redirection_test.dart b/tests/language_strong/const_factory_redirection_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_factory_redirection_test.dart
rename to tests/language_strong/const_factory_redirection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_factory_with_body_test.dart b/tests/language_strong/const_factory_with_body_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_factory_with_body_test.dart
rename to tests/language_strong/const_factory_with_body_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_global_test.dart b/tests/language_strong/const_global_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_global_test.dart
rename to tests/language_strong/const_global_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_init2_test.dart b/tests/language_strong/const_init2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_init2_test.dart
rename to tests/language_strong/const_init2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_init_test.dart b/tests/language_strong/const_init_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_init_test.dart
rename to tests/language_strong/const_init_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_instance_field_test.dart b/tests/language_strong/const_instance_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_instance_field_test.dart
rename to tests/language_strong/const_instance_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_list_test.dart b/tests/language_strong/const_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_list_test.dart
rename to tests/language_strong/const_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_local_test.dart b/tests/language_strong/const_local_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_local_test.dart
rename to tests/language_strong/const_local_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_locals_test.dart b/tests/language_strong/const_locals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_locals_test.dart
rename to tests/language_strong/const_locals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_map2_test.dart b/tests/language_strong/const_map2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_map2_test.dart
rename to tests/language_strong/const_map2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_map3_test.dart b/tests/language_strong/const_map3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_map3_test.dart
rename to tests/language_strong/const_map3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_map4_test.dart b/tests/language_strong/const_map4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_map4_test.dart
rename to tests/language_strong/const_map4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_map_test.dart b/tests/language_strong/const_map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_map_test.dart
rename to tests/language_strong/const_map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_named_test.dart b/tests/language_strong/const_named_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_named_test.dart
rename to tests/language_strong/const_named_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_native_factory_test.dart b/tests/language_strong/const_native_factory_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_native_factory_test.dart
rename to tests/language_strong/const_native_factory_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_nested_test.dart b/tests/language_strong/const_nested_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_nested_test.dart
rename to tests/language_strong/const_nested_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_objects_are_immutable_test.dart b/tests/language_strong/const_objects_are_immutable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_objects_are_immutable_test.dart
rename to tests/language_strong/const_objects_are_immutable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_optional_args_negative_test.dart b/tests/language_strong/const_optional_args_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_optional_args_negative_test.dart
rename to tests/language_strong/const_optional_args_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_redirecting_factory_test.dart b/tests/language_strong/const_redirecting_factory_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_redirecting_factory_test.dart
rename to tests/language_strong/const_redirecting_factory_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_string_test.dart b/tests/language_strong/const_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_string_test.dart
rename to tests/language_strong/const_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_switch2_test.dart b/tests/language_strong/const_switch2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_switch2_test.dart
rename to tests/language_strong/const_switch2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_switch_test.dart b/tests/language_strong/const_switch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_switch_test.dart
rename to tests/language_strong/const_switch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_syntax_test.dart b/tests/language_strong/const_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_syntax_test.dart
rename to tests/language_strong/const_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_test.dart b/tests/language_strong/const_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_test.dart
rename to tests/language_strong/const_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_types_test.dart b/tests/language_strong/const_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_types_test.dart
rename to tests/language_strong/const_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_var_helper.dart b/tests/language_strong/const_var_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_var_helper.dart
rename to tests/language_strong/const_var_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/language/const_var_test.dart b/tests/language_strong/const_var_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/const_var_test.dart
rename to tests/language_strong/const_var_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constant_fold_equals_test.dart b/tests/language_strong/constant_fold_equals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constant_fold_equals_test.dart
rename to tests/language_strong/constant_fold_equals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constant_locals_test.dart b/tests/language_strong/constant_locals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constant_locals_test.dart
rename to tests/language_strong/constant_locals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constant_propagation_phis_test.dart b/tests/language_strong/constant_propagation_phis_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constant_propagation_phis_test.dart
rename to tests/language_strong/constant_propagation_phis_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constant_string_interpolation_test.dart b/tests/language_strong/constant_string_interpolation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constant_string_interpolation_test.dart
rename to tests/language_strong/constant_string_interpolation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constant_type_literal_test.dart b/tests/language_strong/constant_type_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constant_type_literal_test.dart
rename to tests/language_strong/constant_type_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor10_test.dart b/tests/language_strong/constructor10_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor10_test.dart
rename to tests/language_strong/constructor10_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor11_test.dart b/tests/language_strong/constructor11_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor11_test.dart
rename to tests/language_strong/constructor11_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor12_test.dart b/tests/language_strong/constructor12_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor12_test.dart
rename to tests/language_strong/constructor12_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor2_test.dart b/tests/language_strong/constructor2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor2_test.dart
rename to tests/language_strong/constructor2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor3_negative_test.dart b/tests/language_strong/constructor3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor3_negative_test.dart
rename to tests/language_strong/constructor3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor3_test.dart b/tests/language_strong/constructor3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor3_test.dart
rename to tests/language_strong/constructor3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor4_test.dart b/tests/language_strong/constructor4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor4_test.dart
rename to tests/language_strong/constructor4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor5_test.dart b/tests/language_strong/constructor5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor5_test.dart
rename to tests/language_strong/constructor5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor6_test.dart b/tests/language_strong/constructor6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor6_test.dart
rename to tests/language_strong/constructor6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor7_test.dart b/tests/language_strong/constructor7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor7_test.dart
rename to tests/language_strong/constructor7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor8_test.dart b/tests/language_strong/constructor8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor8_test.dart
rename to tests/language_strong/constructor8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor9_test.dart b/tests/language_strong/constructor9_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor9_test.dart
rename to tests/language_strong/constructor9_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_body_test.dart b/tests/language_strong/constructor_body_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_body_test.dart
rename to tests/language_strong/constructor_body_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_call_as_function_test.dart b/tests/language_strong/constructor_call_as_function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_call_as_function_test.dart
rename to tests/language_strong/constructor_call_as_function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_call_wrong_argument_count_negative_test.dart b/tests/language_strong/constructor_call_wrong_argument_count_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_call_wrong_argument_count_negative_test.dart
rename to tests/language_strong/constructor_call_wrong_argument_count_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_default_test.dart b/tests/language_strong/constructor_default_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_default_test.dart
rename to tests/language_strong/constructor_default_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_duplicate_final_test.dart b/tests/language_strong/constructor_duplicate_final_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_duplicate_final_test.dart
rename to tests/language_strong/constructor_duplicate_final_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_duplicate_initializers_test.dart b/tests/language_strong/constructor_duplicate_initializers_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_duplicate_initializers_test.dart
rename to tests/language_strong/constructor_duplicate_initializers_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_initializer_test.dart b/tests/language_strong/constructor_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_initializer_test.dart
rename to tests/language_strong/constructor_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_name_clash_lib.dart b/tests/language_strong/constructor_name_clash_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_name_clash_lib.dart
rename to tests/language_strong/constructor_name_clash_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_name_clash_test.dart b/tests/language_strong/constructor_name_clash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_name_clash_test.dart
rename to tests/language_strong/constructor_name_clash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_name_test.dart b/tests/language_strong/constructor_name_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_name_test.dart
rename to tests/language_strong/constructor_name_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_named_arguments_test.dart b/tests/language_strong/constructor_named_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_named_arguments_test.dart
rename to tests/language_strong/constructor_named_arguments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_redirect1_negative_test.dart b/tests/language_strong/constructor_redirect1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_redirect1_negative_test.dart
rename to tests/language_strong/constructor_redirect1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_redirect2_negative_test.dart b/tests/language_strong/constructor_redirect2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_redirect2_negative_test.dart
rename to tests/language_strong/constructor_redirect2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_redirect2_test.dart b/tests/language_strong/constructor_redirect2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_redirect2_test.dart
rename to tests/language_strong/constructor_redirect2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_redirect_test.dart b/tests/language_strong/constructor_redirect_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_redirect_test.dart
rename to tests/language_strong/constructor_redirect_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_return_test.dart b/tests/language_strong/constructor_return_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_return_test.dart
rename to tests/language_strong/constructor_return_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_setter_negative_test.dart b/tests/language_strong/constructor_setter_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_setter_negative_test.dart
rename to tests/language_strong/constructor_setter_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_test.dart b/tests/language_strong/constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_test.dart
rename to tests/language_strong/constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/constructor_with_mixin_test.dart b/tests/language_strong/constructor_with_mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/constructor_with_mixin_test.dart
rename to tests/language_strong/constructor_with_mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/context2_test.dart b/tests/language_strong/context2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/context2_test.dart
rename to tests/language_strong/context2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/context_args_with_defaults_test.dart b/tests/language_strong/context_args_with_defaults_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/context_args_with_defaults_test.dart
rename to tests/language_strong/context_args_with_defaults_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/context_test.dart b/tests/language_strong/context_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/context_test.dart
rename to tests/language_strong/context_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/continue_test.dart b/tests/language_strong/continue_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/continue_test.dart
rename to tests/language_strong/continue_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/core_type_check_test.dart b/tests/language_strong/core_type_check_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/core_type_check_test.dart
rename to tests/language_strong/core_type_check_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/checked_covariant_overrides_test.dart b/tests/language_strong/covariant_override/runtime_check_test.dart
similarity index 76%
rename from pkg/dev_compiler/test/codegen/language/checked_covariant_overrides_test.dart
rename to tests/language_strong/covariant_override/runtime_check_test.dart
index 6f538dc..a47118fe 100644
--- a/pkg/dev_compiler/test/codegen/language/checked_covariant_overrides_test.dart
+++ b/tests/language_strong/covariant_override/runtime_check_test.dart
@@ -3,17 +3,14 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
-import 'package:meta/meta.dart' show checked;
-
-// Test runtime behavior of @checked
 
 class View {
   addChild(View v) {}
   transform(View fn(View v)) {}
 }
 class MyView extends View {
-  addChild(@checked MyView v) {}
-  transform(@checked MyView fn(Object v)) {}
+  addChild(covariant MyView v) {}
+  transform(covariant MyView fn(Object v)) {}
 }
 
 main() {
@@ -25,7 +22,7 @@
 
   mv.transform((_) => new MyView());
 
-  // TODO(jmesserly): these *should* be a cast failures, but DDC is currently
+  // TODO(jmesserly): these *should* be cast failures, but DDC is currently
   // ignoring function type failures w/ a warning at the console...
 
   // * -> * not a subtype of Object -> MyView
diff --git a/tests/language_strong/covariant_override/tear_off_type_test.dart b/tests/language_strong/covariant_override/tear_off_type_test.dart
new file mode 100644
index 0000000..587c5e2
--- /dev/null
+++ b/tests/language_strong/covariant_override/tear_off_type_test.dart
@@ -0,0 +1,157 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+// If a parameter is directly or indirectly a covariant override, its type in
+// the method tear-off should become Object.
+
+typedef void TakeInts(int a, int b, int c, int d, int e);
+typedef void TakeObjectsAndInts(Object a, int b, Object c, int d, int e);
+typedef void TakeObjects(Object a, Object b, Object c, Object d, Object e);
+
+typedef void TakeOptionalInts([int a, int b, int c, int d]);
+typedef void TakeOptionalObjectsAndInts([Object a, int b, Object c, int d]);
+
+typedef void TakeNamedInts({int a, int b, int c, int d});
+typedef void TakeNamedObjectsAndInts({Object a, int b, Object c, int d});
+
+class M1 {
+  method(covariant int a, int b) {}
+}
+
+class M2 {
+  method(int a, covariant int b) {}
+}
+
+class C extends Object with M1, M2 {}
+
+class Direct {
+  void positional(covariant int a, int b, covariant int c, int d, int e) {}
+  void optional([covariant int a, int b, covariant int c, int d]) {}
+  void named({covariant int a, int b, covariant int c, int d}) {}
+}
+
+class Inherited extends Direct {}
+
+// ---
+
+class Override1 {
+  void method(covariant int a, int b, int c, int d, int e) {}
+}
+
+class Override2 extends Override1 {
+  void method(int a, int b, covariant int c, int d, int e) {}
+}
+
+class Override3 extends Override2 {
+  void method(int a, int b, int c, int d, int e) {}
+}
+
+// ---
+
+abstract class Implement1 {
+  void method(covariant int a, int b, int c, int d, int e) {}
+}
+
+class Implement2 {
+  void method(int a, covariant int b, int c, int d, int e) {}
+}
+
+class Implement3 {
+  void method(int a, int b, covariant int c, int d, int e) {}
+}
+
+class Implement4 implements Implement3 {
+  void method(int a, int b, int c, covariant int d, int e) {}
+}
+
+class Implement5 implements Implement1, Implement2, Implement4 {
+  void method(int a, int b, int c, int d, covariant int e) {}
+}
+
+// ---
+
+class Interface1 {
+  void method(covariant int a, int b, int c, int d, int e) {}
+}
+
+class Interface2 {
+  void method(int a, covariant int b, int c, int d, int e) {}
+}
+
+class Mixin1 {
+  void method(int a, int b, covariant int c, int d, int e) {}
+}
+
+class Mixin2 {
+  void method(int a, int b, int c, covariant int d, int e) {}
+}
+
+class Superclass {
+  void method(int a, int b, int c, int d, covariant int e) {}
+}
+
+class Mixed extends Superclass
+    with Mixin1, Mixin2
+    implements Interface1, Interface2 {}
+
+void main() {
+  testDirect();
+  testInherited();
+  testOverriden();
+  testImplemented();
+  testMixed();
+}
+
+void testDirect() {
+  var positional = new Direct().positional;
+  Expect.isTrue(positional is TakeInts);
+  Expect.isTrue(positional is TakeObjectsAndInts);
+
+  var optional = new Direct().optional;
+  Expect.isTrue(optional is TakeOptionalInts);
+  Expect.isTrue(optional is TakeOptionalObjectsAndInts);
+
+  var named = new Direct().named;
+  Expect.isTrue(named is TakeNamedInts);
+  Expect.isTrue(named is TakeNamedObjectsAndInts);
+}
+
+void testInherited() {
+  var positional = new Inherited().positional;
+  Expect.isTrue(positional is TakeInts);
+  Expect.isTrue(positional is TakeObjectsAndInts);
+
+  var optional = new Inherited().optional;
+  Expect.isTrue(optional is TakeOptionalInts);
+  Expect.isTrue(optional is TakeOptionalObjectsAndInts);
+
+  var named = new Inherited().named;
+  Expect.isTrue(named is TakeNamedInts);
+  Expect.isTrue(named is TakeNamedObjectsAndInts);
+}
+
+void testOverriden() {
+  var method2 = new Override2().method;
+  Expect.isTrue(method2 is TakeInts);
+  Expect.isTrue(method2 is TakeObjectsAndInts);
+
+  var method3 = new Override3().method;
+  Expect.isTrue(method3 is TakeInts);
+  Expect.isTrue(method3 is TakeObjectsAndInts);
+}
+
+void testImplemented() {
+  var method = new Implement5().method;
+  Expect.isTrue(method is TakeInts);
+  Expect.isTrue(method is TakeObjects);
+}
+
+void testMixed() {
+  // TODO(rnystrom): https://github.com/dart-lang/sdk/issues/28395
+  // var method = new Mixed().method;
+  // Expect.isTrue(method is TakeInts);
+  // Expect.isTrue(method is TakeObjects);
+}
diff --git a/tests/language_strong/covariant_subtyping_unsafe_call1_test.dart b/tests/language_strong/covariant_subtyping_unsafe_call1_test.dart
new file mode 100644
index 0000000..79fced2
--- /dev/null
+++ b/tests/language_strong/covariant_subtyping_unsafe_call1_test.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+import 'package:expect/expect.dart';
+
+class Foo<T> {
+  method(T x) {}
+}
+
+main() {
+  Foo<int> intFoo = new Foo<int>();
+  Foo<num> numFoo = intFoo;
+  Expect.throws(() => numFoo.method(2.5));
+}
diff --git a/tests/language_strong/covariant_subtyping_unsafe_call2_test.dart b/tests/language_strong/covariant_subtyping_unsafe_call2_test.dart
new file mode 100644
index 0000000..ea59203
--- /dev/null
+++ b/tests/language_strong/covariant_subtyping_unsafe_call2_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+import 'package:expect/expect.dart';
+
+class Implementation {
+  method(int x) {}
+}
+
+abstract class Interface<T> {
+  method(T x);
+}
+
+class Subclass extends Implementation implements Interface<int> {}
+
+main() {
+  Subclass subclass = new Subclass();
+  Interface<int> intInterface = subclass;
+  Interface<num> numInterface = intInterface;
+  Expect.throws(() => numInterface.method(2.5));
+}
diff --git a/pkg/dev_compiler/test/codegen/language/crash_12118_test.dart b/tests/language_strong/crash_12118_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/crash_12118_test.dart
rename to tests/language_strong/crash_12118_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/crash_6725_part.dart b/tests/language_strong/crash_6725_part.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/crash_6725_part.dart
rename to tests/language_strong/crash_6725_part.dart
diff --git a/pkg/dev_compiler/test/codegen/language/crash_6725_test.dart b/tests/language_strong/crash_6725_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/crash_6725_test.dart
rename to tests/language_strong/crash_6725_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/create_unresolved_type_test.dart b/tests/language_strong/create_unresolved_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/create_unresolved_type_test.dart
rename to tests/language_strong/create_unresolved_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/critical_edge2_test.dart b/tests/language_strong/critical_edge2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/critical_edge2_test.dart
rename to tests/language_strong/critical_edge2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/critical_edge_test.dart b/tests/language_strong/critical_edge_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/critical_edge_test.dart
rename to tests/language_strong/critical_edge_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/ct_const2_test.dart b/tests/language_strong/ct_const2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/ct_const2_test.dart
rename to tests/language_strong/ct_const2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/ct_const3_test.dart b/tests/language_strong/ct_const3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/ct_const3_test.dart
rename to tests/language_strong/ct_const3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/ct_const4_lib.dart b/tests/language_strong/ct_const4_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/ct_const4_lib.dart
rename to tests/language_strong/ct_const4_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/ct_const4_test.dart b/tests/language_strong/ct_const4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/ct_const4_test.dart
rename to tests/language_strong/ct_const4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/ct_const_test.dart b/tests/language_strong/ct_const_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/ct_const_test.dart
rename to tests/language_strong/ct_const_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/custom_await_stack_trace_test.dart b/tests/language_strong/custom_await_stack_trace_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/custom_await_stack_trace_test.dart
rename to tests/language_strong/custom_await_stack_trace_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cyclic_class_member_test.dart b/tests/language_strong/cyclic_class_member_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cyclic_class_member_test.dart
rename to tests/language_strong/cyclic_class_member_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cyclic_constructor_test.dart b/tests/language_strong/cyclic_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cyclic_constructor_test.dart
rename to tests/language_strong/cyclic_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cyclic_default_values_test.dart b/tests/language_strong/cyclic_default_values_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cyclic_default_values_test.dart
rename to tests/language_strong/cyclic_default_values_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cyclic_import_test.dart b/tests/language_strong/cyclic_import_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cyclic_import_test.dart
rename to tests/language_strong/cyclic_import_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cyclic_metadata_test.dart b/tests/language_strong/cyclic_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cyclic_metadata_test.dart
rename to tests/language_strong/cyclic_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cyclic_type2_test.dart b/tests/language_strong/cyclic_type2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cyclic_type2_test.dart
rename to tests/language_strong/cyclic_type2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cyclic_type_test.dart b/tests/language_strong/cyclic_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cyclic_type_test.dart
rename to tests/language_strong/cyclic_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cyclic_type_variable_test.dart b/tests/language_strong/cyclic_type_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cyclic_type_variable_test.dart
rename to tests/language_strong/cyclic_type_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/cyclic_typedef_test.dart b/tests/language_strong/cyclic_typedef_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/cyclic_typedef_test.dart
rename to tests/language_strong/cyclic_typedef_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/dangling_else_test.dart b/tests/language_strong/dangling_else_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/dangling_else_test.dart
rename to tests/language_strong/dangling_else_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/dead_field_access_test.dart b/tests/language_strong/dead_field_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/dead_field_access_test.dart
rename to tests/language_strong/dead_field_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/default_class_implicit_constructor_test.dart b/tests/language_strong/default_class_implicit_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/default_class_implicit_constructor_test.dart
rename to tests/language_strong/default_class_implicit_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/default_factory2_test.dart b/tests/language_strong/default_factory2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/default_factory2_test.dart
rename to tests/language_strong/default_factory2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/default_factory3_test.dart b/tests/language_strong/default_factory3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/default_factory3_test.dart
rename to tests/language_strong/default_factory3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/default_factory_library.dart b/tests/language_strong/default_factory_library.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/default_factory_library.dart
rename to tests/language_strong/default_factory_library.dart
diff --git a/pkg/dev_compiler/test/codegen/language/default_factory_library_test.dart b/tests/language_strong/default_factory_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/default_factory_library_test.dart
rename to tests/language_strong/default_factory_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/default_factory_test.dart b/tests/language_strong/default_factory_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/default_factory_test.dart
rename to tests/language_strong/default_factory_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/default_implementation2_test.dart b/tests/language_strong/default_implementation2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/default_implementation2_test.dart
rename to tests/language_strong/default_implementation2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/default_implementation_test.dart b/tests/language_strong/default_implementation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/default_implementation_test.dart
rename to tests/language_strong/default_implementation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/default_init_test.dart b/tests/language_strong/default_init_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/default_init_test.dart
rename to tests/language_strong/default_init_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_call_empty_before_load_lib.dart b/tests/language_strong/deferred_call_empty_before_load_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_call_empty_before_load_lib.dart
rename to tests/language_strong/deferred_call_empty_before_load_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_call_empty_before_load_test.dart b/tests/language_strong/deferred_call_empty_before_load_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_call_empty_before_load_test.dart
rename to tests/language_strong/deferred_call_empty_before_load_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_closurize_load_library_lib.dart b/tests/language_strong/deferred_closurize_load_library_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_closurize_load_library_lib.dart
rename to tests/language_strong/deferred_closurize_load_library_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_closurize_load_library_test.dart b/tests/language_strong/deferred_closurize_load_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_closurize_load_library_test.dart
rename to tests/language_strong/deferred_closurize_load_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_constant_list_lib.dart b/tests/language_strong/deferred_constant_list_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_constant_list_lib.dart
rename to tests/language_strong/deferred_constant_list_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_constant_list_test.dart b/tests/language_strong/deferred_constant_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_constant_list_test.dart
rename to tests/language_strong/deferred_constant_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_constraints_constants_lib.dart b/tests/language_strong/deferred_constraints_constants_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_constraints_constants_lib.dart
rename to tests/language_strong/deferred_constraints_constants_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_constraints_constants_test.dart b/tests/language_strong/deferred_constraints_constants_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_constraints_constants_test.dart
rename to tests/language_strong/deferred_constraints_constants_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_constraints_lib.dart b/tests/language_strong/deferred_constraints_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_constraints_lib.dart
rename to tests/language_strong/deferred_constraints_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_constraints_lib2.dart b/tests/language_strong/deferred_constraints_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_constraints_lib2.dart
rename to tests/language_strong/deferred_constraints_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_constraints_type_annotation_test.dart b/tests/language_strong/deferred_constraints_type_annotation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_constraints_type_annotation_test.dart
rename to tests/language_strong/deferred_constraints_type_annotation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_duplicate_prefix1_test.dart b/tests/language_strong/deferred_duplicate_prefix1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_duplicate_prefix1_test.dart
rename to tests/language_strong/deferred_duplicate_prefix1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_duplicate_prefix2_test.dart b/tests/language_strong/deferred_duplicate_prefix2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_duplicate_prefix2_test.dart
rename to tests/language_strong/deferred_duplicate_prefix2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_duplicate_prefix3_test.dart b/tests/language_strong/deferred_duplicate_prefix3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_duplicate_prefix3_test.dart
rename to tests/language_strong/deferred_duplicate_prefix3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_function_type_lib.dart b/tests/language_strong/deferred_function_type_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_function_type_lib.dart
rename to tests/language_strong/deferred_function_type_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_function_type_test.dart b/tests/language_strong/deferred_function_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_function_type_test.dart
rename to tests/language_strong/deferred_function_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_global_lib.dart b/tests/language_strong/deferred_global_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_global_lib.dart
rename to tests/language_strong/deferred_global_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_global_test.dart b/tests/language_strong/deferred_global_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_global_test.dart
rename to tests/language_strong/deferred_global_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_inheritance_constraints_lib.dart b/tests/language_strong/deferred_inheritance_constraints_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_inheritance_constraints_lib.dart
rename to tests/language_strong/deferred_inheritance_constraints_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_inheritance_constraints_test.dart b/tests/language_strong/deferred_inheritance_constraints_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_inheritance_constraints_test.dart
rename to tests/language_strong/deferred_inheritance_constraints_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_inlined_test.dart b/tests/language_strong/deferred_inlined_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_inlined_test.dart
rename to tests/language_strong/deferred_inlined_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_load_constants.dart b/tests/language_strong/deferred_load_constants.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_load_constants.dart
rename to tests/language_strong/deferred_load_constants.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_load_constants_test.dart b/tests/language_strong/deferred_load_constants_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_load_constants_test.dart
rename to tests/language_strong/deferred_load_constants_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_load_inval_code_lib.dart b/tests/language_strong/deferred_load_inval_code_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_load_inval_code_lib.dart
rename to tests/language_strong/deferred_load_inval_code_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_load_inval_code_test.dart b/tests/language_strong/deferred_load_inval_code_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_load_inval_code_test.dart
rename to tests/language_strong/deferred_load_inval_code_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_load_library_wrong_args_lib.dart b/tests/language_strong/deferred_load_library_wrong_args_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_load_library_wrong_args_lib.dart
rename to tests/language_strong/deferred_load_library_wrong_args_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_load_library_wrong_args_test.dart b/tests/language_strong/deferred_load_library_wrong_args_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_load_library_wrong_args_test.dart
rename to tests/language_strong/deferred_load_library_wrong_args_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_mixin_lib1.dart b/tests/language_strong/deferred_mixin_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_mixin_lib1.dart
rename to tests/language_strong/deferred_mixin_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_mixin_lib2.dart b/tests/language_strong/deferred_mixin_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_mixin_lib2.dart
rename to tests/language_strong/deferred_mixin_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_mixin_shared.dart b/tests/language_strong/deferred_mixin_shared.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_mixin_shared.dart
rename to tests/language_strong/deferred_mixin_shared.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_mixin_test.dart b/tests/language_strong/deferred_mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_mixin_test.dart
rename to tests/language_strong/deferred_mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_no_prefix_test.dart b/tests/language_strong/deferred_no_prefix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_no_prefix_test.dart
rename to tests/language_strong/deferred_no_prefix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_no_such_method_lib.dart b/tests/language_strong/deferred_no_such_method_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_no_such_method_lib.dart
rename to tests/language_strong/deferred_no_such_method_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_no_such_method_test.dart b/tests/language_strong/deferred_no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_no_such_method_test.dart
rename to tests/language_strong/deferred_no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_not_loaded_check_lib.dart b/tests/language_strong/deferred_not_loaded_check_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_not_loaded_check_lib.dart
rename to tests/language_strong/deferred_not_loaded_check_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_not_loaded_check_test.dart b/tests/language_strong/deferred_not_loaded_check_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_not_loaded_check_test.dart
rename to tests/language_strong/deferred_not_loaded_check_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_only_constant_lib.dart b/tests/language_strong/deferred_only_constant_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_only_constant_lib.dart
rename to tests/language_strong/deferred_only_constant_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_only_constant_test.dart b/tests/language_strong/deferred_only_constant_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_only_constant_test.dart
rename to tests/language_strong/deferred_only_constant_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_optimized_test.dart b/tests/language_strong/deferred_optimized_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_optimized_test.dart
rename to tests/language_strong/deferred_optimized_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_prefix_constraints_lib.dart b/tests/language_strong/deferred_prefix_constraints_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_prefix_constraints_lib.dart
rename to tests/language_strong/deferred_prefix_constraints_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_prefix_constraints_lib2.dart b/tests/language_strong/deferred_prefix_constraints_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_prefix_constraints_lib2.dart
rename to tests/language_strong/deferred_prefix_constraints_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_redirecting_factory_lib1.dart b/tests/language_strong/deferred_redirecting_factory_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_redirecting_factory_lib1.dart
rename to tests/language_strong/deferred_redirecting_factory_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_redirecting_factory_lib2.dart b/tests/language_strong/deferred_redirecting_factory_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_redirecting_factory_lib2.dart
rename to tests/language_strong/deferred_redirecting_factory_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_redirecting_factory_test.dart b/tests/language_strong/deferred_redirecting_factory_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_redirecting_factory_test.dart
rename to tests/language_strong/deferred_redirecting_factory_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_regression_22995_lib.dart b/tests/language_strong/deferred_regression_22995_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_regression_22995_lib.dart
rename to tests/language_strong/deferred_regression_22995_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_regression_22995_test.dart b/tests/language_strong/deferred_regression_22995_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_regression_22995_test.dart
rename to tests/language_strong/deferred_regression_22995_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_shadow_load_library_lib.dart b/tests/language_strong/deferred_shadow_load_library_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_shadow_load_library_lib.dart
rename to tests/language_strong/deferred_shadow_load_library_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_shadow_load_library_test.dart b/tests/language_strong/deferred_shadow_load_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_shadow_load_library_test.dart
rename to tests/language_strong/deferred_shadow_load_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_shared_and_unshared_classes_lib1.dart b/tests/language_strong/deferred_shared_and_unshared_classes_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_shared_and_unshared_classes_lib1.dart
rename to tests/language_strong/deferred_shared_and_unshared_classes_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_shared_and_unshared_classes_lib2.dart b/tests/language_strong/deferred_shared_and_unshared_classes_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_shared_and_unshared_classes_lib2.dart
rename to tests/language_strong/deferred_shared_and_unshared_classes_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_shared_and_unshared_classes_lib_shared.dart b/tests/language_strong/deferred_shared_and_unshared_classes_lib_shared.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_shared_and_unshared_classes_lib_shared.dart
rename to tests/language_strong/deferred_shared_and_unshared_classes_lib_shared.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_shared_and_unshared_classes_test.dart b/tests/language_strong/deferred_shared_and_unshared_classes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_shared_and_unshared_classes_test.dart
rename to tests/language_strong/deferred_shared_and_unshared_classes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_static_seperate_lib1.dart b/tests/language_strong/deferred_static_seperate_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_static_seperate_lib1.dart
rename to tests/language_strong/deferred_static_seperate_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_static_seperate_lib2.dart b/tests/language_strong/deferred_static_seperate_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_static_seperate_lib2.dart
rename to tests/language_strong/deferred_static_seperate_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_static_seperate_test.dart b/tests/language_strong/deferred_static_seperate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_static_seperate_test.dart
rename to tests/language_strong/deferred_static_seperate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_type_dependency_lib1.dart b/tests/language_strong/deferred_type_dependency_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_type_dependency_lib1.dart
rename to tests/language_strong/deferred_type_dependency_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_type_dependency_lib2.dart b/tests/language_strong/deferred_type_dependency_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_type_dependency_lib2.dart
rename to tests/language_strong/deferred_type_dependency_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_type_dependency_lib3.dart b/tests/language_strong/deferred_type_dependency_lib3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_type_dependency_lib3.dart
rename to tests/language_strong/deferred_type_dependency_lib3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deferred_type_dependency_test.dart b/tests/language_strong/deferred_type_dependency_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deferred_type_dependency_test.dart
rename to tests/language_strong/deferred_type_dependency_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deopt_inlined_function_lazy_test.dart b/tests/language_strong/deopt_inlined_function_lazy_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deopt_inlined_function_lazy_test.dart
rename to tests/language_strong/deopt_inlined_function_lazy_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deopt_inlined_function_test.dart b/tests/language_strong/deopt_inlined_function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deopt_inlined_function_test.dart
rename to tests/language_strong/deopt_inlined_function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deopt_lazy_finalization_test.dart b/tests/language_strong/deopt_lazy_finalization_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deopt_lazy_finalization_test.dart
rename to tests/language_strong/deopt_lazy_finalization_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deopt_no_feedback_test.dart b/tests/language_strong/deopt_no_feedback_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deopt_no_feedback_test.dart
rename to tests/language_strong/deopt_no_feedback_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deopt_smi_op_test.dart b/tests/language_strong/deopt_smi_op_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deopt_smi_op_test.dart
rename to tests/language_strong/deopt_smi_op_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/deoptimized_function_on_stack_test.dart b/tests/language_strong/deoptimized_function_on_stack_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/deoptimized_function_on_stack_test.dart
rename to tests/language_strong/deoptimized_function_on_stack_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/disassemble_test.dart b/tests/language_strong/disassemble_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/disassemble_test.dart
rename to tests/language_strong/disassemble_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/div_by_zero_test.dart b/tests/language_strong/div_by_zero_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/div_by_zero_test.dart
rename to tests/language_strong/div_by_zero_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/div_with_power_of_two2_test.dart b/tests/language_strong/div_with_power_of_two2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/div_with_power_of_two2_test.dart
rename to tests/language_strong/div_with_power_of_two2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/div_with_power_of_two_test.dart b/tests/language_strong/div_with_power_of_two_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/div_with_power_of_two_test.dart
rename to tests/language_strong/div_with_power_of_two_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/do_while2_test.dart b/tests/language_strong/do_while2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/do_while2_test.dart
rename to tests/language_strong/do_while2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/do_while3_test.dart b/tests/language_strong/do_while3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/do_while3_test.dart
rename to tests/language_strong/do_while3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/do_while4_test.dart b/tests/language_strong/do_while4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/do_while4_test.dart
rename to tests/language_strong/do_while4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/do_while_test.dart b/tests/language_strong/do_while_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/do_while_test.dart
rename to tests/language_strong/do_while_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_comparison_test.dart b/tests/language_strong/double_comparison_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_comparison_test.dart
rename to tests/language_strong/double_comparison_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_int_addition_test.dart b/tests/language_strong/double_int_addition_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_int_addition_test.dart
rename to tests/language_strong/double_int_addition_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_int_to_string_test.dart b/tests/language_strong/double_int_to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_int_to_string_test.dart
rename to tests/language_strong/double_int_to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_modulo_test.dart b/tests/language_strong/double_modulo_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_modulo_test.dart
rename to tests/language_strong/double_modulo_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_nan_comparison_test.dart b/tests/language_strong/double_nan_comparison_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_nan_comparison_test.dart
rename to tests/language_strong/double_nan_comparison_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_to_string_as_exponential2_test.dart b/tests/language_strong/double_to_string_as_exponential2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_to_string_as_exponential2_test.dart
rename to tests/language_strong/double_to_string_as_exponential2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_to_string_as_exponential3_test.dart b/tests/language_strong/double_to_string_as_exponential3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_to_string_as_exponential3_test.dart
rename to tests/language_strong/double_to_string_as_exponential3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_to_string_as_exponential_test.dart b/tests/language_strong/double_to_string_as_exponential_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_to_string_as_exponential_test.dart
rename to tests/language_strong/double_to_string_as_exponential_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_to_string_as_fixed2_test.dart b/tests/language_strong/double_to_string_as_fixed2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_to_string_as_fixed2_test.dart
rename to tests/language_strong/double_to_string_as_fixed2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_to_string_as_fixed_test.dart b/tests/language_strong/double_to_string_as_fixed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_to_string_as_fixed_test.dart
rename to tests/language_strong/double_to_string_as_fixed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_to_string_as_precision2_test.dart b/tests/language_strong/double_to_string_as_precision2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_to_string_as_precision2_test.dart
rename to tests/language_strong/double_to_string_as_precision2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_to_string_as_precision3_test.dart b/tests/language_strong/double_to_string_as_precision3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_to_string_as_precision3_test.dart
rename to tests/language_strong/double_to_string_as_precision3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_to_string_as_precision_test.dart b/tests/language_strong/double_to_string_as_precision_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_to_string_as_precision_test.dart
rename to tests/language_strong/double_to_string_as_precision_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/double_to_string_test.dart b/tests/language_strong/double_to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/double_to_string_test.dart
rename to tests/language_strong/double_to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_constructor_test.dart b/tests/language_strong/duplicate_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_constructor_test.dart
rename to tests/language_strong/duplicate_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_export_liba.dart b/tests/language_strong/duplicate_export_liba.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_export_liba.dart
rename to tests/language_strong/duplicate_export_liba.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_export_negative_test.dart b/tests/language_strong/duplicate_export_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_export_negative_test.dart
rename to tests/language_strong/duplicate_export_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_export_test.dart b/tests/language_strong/duplicate_export_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_export_test.dart
rename to tests/language_strong/duplicate_export_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_implements_test.dart b/tests/language_strong/duplicate_implements_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_implements_test.dart
rename to tests/language_strong/duplicate_implements_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_import_liba.dart b/tests/language_strong/duplicate_import_liba.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_import_liba.dart
rename to tests/language_strong/duplicate_import_liba.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_import_libb.dart b/tests/language_strong/duplicate_import_libb.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_import_libb.dart
rename to tests/language_strong/duplicate_import_libb.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_import_libc.dart b/tests/language_strong/duplicate_import_libc.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_import_libc.dart
rename to tests/language_strong/duplicate_import_libc.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_import_libd.dart b/tests/language_strong/duplicate_import_libd.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_import_libd.dart
rename to tests/language_strong/duplicate_import_libd.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_import_prefix_test.dart b/tests/language_strong/duplicate_import_prefix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_import_prefix_test.dart
rename to tests/language_strong/duplicate_import_prefix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_interface_lib.dart b/tests/language_strong/duplicate_interface_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_interface_lib.dart
rename to tests/language_strong/duplicate_interface_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_interface_negative_test.dart b/tests/language_strong/duplicate_interface_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_interface_negative_test.dart
rename to tests/language_strong/duplicate_interface_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/duplicate_interface_test.dart b/tests/language_strong/duplicate_interface_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/duplicate_interface_test.dart
rename to tests/language_strong/duplicate_interface_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/dynamic2_test.dart b/tests/language_strong/dynamic2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/dynamic2_test.dart
rename to tests/language_strong/dynamic2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/dynamic_call_test.dart b/tests/language_strong/dynamic_call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/dynamic_call_test.dart
rename to tests/language_strong/dynamic_call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/dynamic_field_test.dart b/tests/language_strong/dynamic_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/dynamic_field_test.dart
rename to tests/language_strong/dynamic_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/dynamic_prefix_core_test.dart b/tests/language_strong/dynamic_prefix_core_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/dynamic_prefix_core_test.dart
rename to tests/language_strong/dynamic_prefix_core_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/dynamic_test.dart b/tests/language_strong/dynamic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/dynamic_test.dart
rename to tests/language_strong/dynamic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/dynamic_type_literal_test.dart b/tests/language_strong/dynamic_type_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/dynamic_type_literal_test.dart
rename to tests/language_strong/dynamic_type_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/emit_const_fields_test.dart b/tests/language_strong/emit_const_fields_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/emit_const_fields_test.dart
rename to tests/language_strong/emit_const_fields_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/empty_block_case_test.dart b/tests/language_strong/empty_block_case_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/empty_block_case_test.dart
rename to tests/language_strong/empty_block_case_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/empty_library.dart b/tests/language_strong/empty_library.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/empty_library.dart
rename to tests/language_strong/empty_library.dart
diff --git a/pkg/dev_compiler/test/codegen/language/empty_main.dart b/tests/language_strong/empty_main.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/empty_main.dart
rename to tests/language_strong/empty_main.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_duplicate_lib.dart b/tests/language_strong/enum_duplicate_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_duplicate_lib.dart
rename to tests/language_strong/enum_duplicate_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_duplicate_test.dart b/tests/language_strong/enum_duplicate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_duplicate_test.dart
rename to tests/language_strong/enum_duplicate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_index_test.dart b/tests/language_strong/enum_index_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_index_test.dart
rename to tests/language_strong/enum_index_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_is_keyword_test.dart b/tests/language_strong/enum_is_keyword_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_is_keyword_test.dart
rename to tests/language_strong/enum_is_keyword_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_mirror_test.dart b/tests/language_strong/enum_mirror_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_mirror_test.dart
rename to tests/language_strong/enum_mirror_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_private_lib.dart b/tests/language_strong/enum_private_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_private_lib.dart
rename to tests/language_strong/enum_private_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_private_test.dart b/tests/language_strong/enum_private_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_private_test.dart
rename to tests/language_strong/enum_private_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_syntax_test.dart b/tests/language_strong/enum_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_syntax_test.dart
rename to tests/language_strong/enum_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_test.dart b/tests/language_strong/enum_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_test.dart
rename to tests/language_strong/enum_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/enum_value_name_test.dart b/tests/language_strong/enum_value_name_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/enum_value_name_test.dart
rename to tests/language_strong/enum_value_name_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/equality_test.dart b/tests/language_strong/equality_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/equality_test.dart
rename to tests/language_strong/equality_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/error_stacktrace_test.dart b/tests/language_strong/error_stacktrace_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/error_stacktrace_test.dart
rename to tests/language_strong/error_stacktrace_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/evaluation_redirecting_constructor_test.dart b/tests/language_strong/evaluation_redirecting_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/evaluation_redirecting_constructor_test.dart
rename to tests/language_strong/evaluation_redirecting_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/example_constructor_test.dart b/tests/language_strong/example_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/example_constructor_test.dart
rename to tests/language_strong/example_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/exception_identity_test.dart b/tests/language_strong/exception_identity_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/exception_identity_test.dart
rename to tests/language_strong/exception_identity_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/exception_in_increment_test.dart b/tests/language_strong/exception_in_increment_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/exception_in_increment_test.dart
rename to tests/language_strong/exception_in_increment_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/exception_test.dart b/tests/language_strong/exception_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/exception_test.dart
rename to tests/language_strong/exception_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally10_test.dart b/tests/language_strong/execute_finally10_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally10_test.dart
rename to tests/language_strong/execute_finally10_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally11_test.dart b/tests/language_strong/execute_finally11_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally11_test.dart
rename to tests/language_strong/execute_finally11_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally12_test.dart b/tests/language_strong/execute_finally12_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally12_test.dart
rename to tests/language_strong/execute_finally12_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally1_test.dart b/tests/language_strong/execute_finally1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally1_test.dart
rename to tests/language_strong/execute_finally1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally2_test.dart b/tests/language_strong/execute_finally2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally2_test.dart
rename to tests/language_strong/execute_finally2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally3_test.dart b/tests/language_strong/execute_finally3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally3_test.dart
rename to tests/language_strong/execute_finally3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally4_test.dart b/tests/language_strong/execute_finally4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally4_test.dart
rename to tests/language_strong/execute_finally4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally5_test.dart b/tests/language_strong/execute_finally5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally5_test.dart
rename to tests/language_strong/execute_finally5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally6_test.dart b/tests/language_strong/execute_finally6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally6_test.dart
rename to tests/language_strong/execute_finally6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally7_test.dart b/tests/language_strong/execute_finally7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally7_test.dart
rename to tests/language_strong/execute_finally7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally8_test.dart b/tests/language_strong/execute_finally8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally8_test.dart
rename to tests/language_strong/execute_finally8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/execute_finally9_test.dart b/tests/language_strong/execute_finally9_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/execute_finally9_test.dart
rename to tests/language_strong/execute_finally9_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/exhaustive_for_test.dart b/tests/language_strong/exhaustive_for_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/exhaustive_for_test.dart
rename to tests/language_strong/exhaustive_for_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/expect_test.dart b/tests/language_strong/expect_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/expect_test.dart
rename to tests/language_strong/expect_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export1_lib.dart b/tests/language_strong/export1_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export1_lib.dart
rename to tests/language_strong/export1_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_ambiguous_main_a.dart b/tests/language_strong/export_ambiguous_main_a.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_ambiguous_main_a.dart
rename to tests/language_strong/export_ambiguous_main_a.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_ambiguous_main_b.dart b/tests/language_strong/export_ambiguous_main_b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_ambiguous_main_b.dart
rename to tests/language_strong/export_ambiguous_main_b.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_ambiguous_main_negative_test.dart b/tests/language_strong/export_ambiguous_main_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_ambiguous_main_negative_test.dart
rename to tests/language_strong/export_ambiguous_main_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_cyclic_helper1.dart b/tests/language_strong/export_cyclic_helper1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_cyclic_helper1.dart
rename to tests/language_strong/export_cyclic_helper1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_cyclic_helper2.dart b/tests/language_strong/export_cyclic_helper2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_cyclic_helper2.dart
rename to tests/language_strong/export_cyclic_helper2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_cyclic_helper3.dart b/tests/language_strong/export_cyclic_helper3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_cyclic_helper3.dart
rename to tests/language_strong/export_cyclic_helper3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_cyclic_test.dart b/tests/language_strong/export_cyclic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_cyclic_test.dart
rename to tests/language_strong/export_cyclic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_double_same_main_test.dart b/tests/language_strong/export_double_same_main_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_double_same_main_test.dart
rename to tests/language_strong/export_double_same_main_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_helper1.dart b/tests/language_strong/export_helper1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_helper1.dart
rename to tests/language_strong/export_helper1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_helper2.dart b/tests/language_strong/export_helper2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_helper2.dart
rename to tests/language_strong/export_helper2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_helper3.dart b/tests/language_strong/export_helper3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_helper3.dart
rename to tests/language_strong/export_helper3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_helper4.dart b/tests/language_strong/export_helper4.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_helper4.dart
rename to tests/language_strong/export_helper4.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_main_override_test.dart b/tests/language_strong/export_main_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_main_override_test.dart
rename to tests/language_strong/export_main_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_main_test.dart b/tests/language_strong/export_main_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_main_test.dart
rename to tests/language_strong/export_main_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_order_helper1.dart b/tests/language_strong/export_order_helper1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_order_helper1.dart
rename to tests/language_strong/export_order_helper1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_order_helper2.dart b/tests/language_strong/export_order_helper2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_order_helper2.dart
rename to tests/language_strong/export_order_helper2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_order_test.dart b/tests/language_strong/export_order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_order_test.dart
rename to tests/language_strong/export_order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_private_test.dart b/tests/language_strong/export_private_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_private_test.dart
rename to tests/language_strong/export_private_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/export_test.dart b/tests/language_strong/export_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/export_test.dart
rename to tests/language_strong/export_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/extend_type_parameter2_negative_test.dart b/tests/language_strong/extend_type_parameter2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/extend_type_parameter2_negative_test.dart
rename to tests/language_strong/extend_type_parameter2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/extend_type_parameter_negative_test.dart b/tests/language_strong/extend_type_parameter_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/extend_type_parameter_negative_test.dart
rename to tests/language_strong/extend_type_parameter_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/extends_test.dart b/tests/language_strong/extends_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/extends_test.dart
rename to tests/language_strong/extends_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/extends_test_lib.dart b/tests/language_strong/extends_test_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/extends_test_lib.dart
rename to tests/language_strong/extends_test_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/external_test.dart b/tests/language_strong/external_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/external_test.dart
rename to tests/language_strong/external_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/f_bounded_equality_test.dart b/tests/language_strong/f_bounded_equality_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/f_bounded_equality_test.dart
rename to tests/language_strong/f_bounded_equality_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/f_bounded_quantification2_test.dart b/tests/language_strong/f_bounded_quantification2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/f_bounded_quantification2_test.dart
rename to tests/language_strong/f_bounded_quantification2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/f_bounded_quantification3_test.dart b/tests/language_strong/f_bounded_quantification3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/f_bounded_quantification3_test.dart
rename to tests/language_strong/f_bounded_quantification3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/f_bounded_quantification4_test.dart b/tests/language_strong/f_bounded_quantification4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/f_bounded_quantification4_test.dart
rename to tests/language_strong/f_bounded_quantification4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/f_bounded_quantification5_test.dart b/tests/language_strong/f_bounded_quantification5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/f_bounded_quantification5_test.dart
rename to tests/language_strong/f_bounded_quantification5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/f_bounded_quantification_test.dart b/tests/language_strong/f_bounded_quantification_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/f_bounded_quantification_test.dart
rename to tests/language_strong/f_bounded_quantification_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory1_test.dart b/tests/language_strong/factory1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory1_test.dart
rename to tests/language_strong/factory1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory2_negative_test.dart b/tests/language_strong/factory2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory2_negative_test.dart
rename to tests/language_strong/factory2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory2_test.dart b/tests/language_strong/factory2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory2_test.dart
rename to tests/language_strong/factory2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory3_negative_test.dart b/tests/language_strong/factory3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory3_negative_test.dart
rename to tests/language_strong/factory3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory3_test.dart b/tests/language_strong/factory3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory3_test.dart
rename to tests/language_strong/factory3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory4_test.dart b/tests/language_strong/factory4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory4_test.dart
rename to tests/language_strong/factory4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory5_test.dart b/tests/language_strong/factory5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory5_test.dart
rename to tests/language_strong/factory5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_arrow_test.dart b/tests/language_strong/factory_arrow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_arrow_test.dart
rename to tests/language_strong/factory_arrow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_implementation_test.dart b/tests/language_strong/factory_implementation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_implementation_test.dart
rename to tests/language_strong/factory_implementation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_negative_test.dart b/tests/language_strong/factory_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_negative_test.dart
rename to tests/language_strong/factory_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_redirection2_test.dart b/tests/language_strong/factory_redirection2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_redirection2_test.dart
rename to tests/language_strong/factory_redirection2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_redirection3_cyclic_test.dart b/tests/language_strong/factory_redirection3_cyclic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_redirection3_cyclic_test.dart
rename to tests/language_strong/factory_redirection3_cyclic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_redirection_test.dart b/tests/language_strong/factory_redirection_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_redirection_test.dart
rename to tests/language_strong/factory_redirection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_return_type_checked_test.dart b/tests/language_strong/factory_return_type_checked_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_return_type_checked_test.dart
rename to tests/language_strong/factory_return_type_checked_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_test.dart b/tests/language_strong/factory_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_test.dart
rename to tests/language_strong/factory_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_type_parameter2_test.dart b/tests/language_strong/factory_type_parameter2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_type_parameter2_test.dart
rename to tests/language_strong/factory_type_parameter2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/factory_type_parameter_test.dart b/tests/language_strong/factory_type_parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/factory_type_parameter_test.dart
rename to tests/language_strong/factory_type_parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/failing_main.dart b/tests/language_strong/failing_main.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/failing_main.dart
rename to tests/language_strong/failing_main.dart
diff --git a/pkg/dev_compiler/test/codegen/language/fannkuch_test.dart b/tests/language_strong/fannkuch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/fannkuch_test.dart
rename to tests/language_strong/fannkuch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/fast_method_extraction_test.dart b/tests/language_strong/fast_method_extraction_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/fast_method_extraction_test.dart
rename to tests/language_strong/fast_method_extraction_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/fauxverride_test.dart b/tests/language_strong/fauxverride_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/fauxverride_test.dart
rename to tests/language_strong/fauxverride_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/fibo_test.dart b/tests/language_strong/fibo_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/fibo_test.dart
rename to tests/language_strong/fibo_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field1_negative_test.dart b/tests/language_strong/field1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field1_negative_test.dart
rename to tests/language_strong/field1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field2_negative_test.dart b/tests/language_strong/field2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field2_negative_test.dart
rename to tests/language_strong/field2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field3_negative_test.dart b/tests/language_strong/field3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field3_negative_test.dart
rename to tests/language_strong/field3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field3a_negative_test.dart b/tests/language_strong/field3a_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field3a_negative_test.dart
rename to tests/language_strong/field3a_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field4_negative_test.dart b/tests/language_strong/field4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field4_negative_test.dart
rename to tests/language_strong/field4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field5_negative_test.dart b/tests/language_strong/field5_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field5_negative_test.dart
rename to tests/language_strong/field5_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field6_negative_test.dart b/tests/language_strong/field6_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field6_negative_test.dart
rename to tests/language_strong/field6_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field6a_negative_test.dart b/tests/language_strong/field6a_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field6a_negative_test.dart
rename to tests/language_strong/field6a_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_decl_missing_var_type_test.dart b/tests/language_strong/field_decl_missing_var_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_decl_missing_var_type_test.dart
rename to tests/language_strong/field_decl_missing_var_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_increment_bailout_test.dart b/tests/language_strong/field_increment_bailout_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_increment_bailout_test.dart
rename to tests/language_strong/field_increment_bailout_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_inference_test.dart b/tests/language_strong/field_inference_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_inference_test.dart
rename to tests/language_strong/field_inference_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_initialization_order_test.dart b/tests/language_strong/field_initialization_order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_initialization_order_test.dart
rename to tests/language_strong/field_initialization_order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_method4_negative_test.dart b/tests/language_strong/field_method4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_method4_negative_test.dart
rename to tests/language_strong/field_method4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_method_test.dart b/tests/language_strong/field_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_method_test.dart
rename to tests/language_strong/field_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_optimization2_test.dart b/tests/language_strong/field_optimization2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_optimization2_test.dart
rename to tests/language_strong/field_optimization2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_optimization3_test.dart b/tests/language_strong/field_optimization3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_optimization3_test.dart
rename to tests/language_strong/field_optimization3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_optimization_test.dart b/tests/language_strong/field_optimization_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_optimization_test.dart
rename to tests/language_strong/field_optimization_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_override2_test.dart b/tests/language_strong/field_override2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_override2_test.dart
rename to tests/language_strong/field_override2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_override3_test.dart b/tests/language_strong/field_override3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_override3_test.dart
rename to tests/language_strong/field_override3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_override4_test.dart b/tests/language_strong/field_override4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_override4_test.dart
rename to tests/language_strong/field_override4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_override_test.dart b/tests/language_strong/field_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_override_test.dart
rename to tests/language_strong/field_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_parameter_test.dart b/tests/language_strong/field_parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_parameter_test.dart
rename to tests/language_strong/field_parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_super_access2_test.dart b/tests/language_strong/field_super_access2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_super_access2_test.dart
rename to tests/language_strong/field_super_access2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_super_access_test.dart b/tests/language_strong/field_super_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_super_access_test.dart
rename to tests/language_strong/field_super_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_test.dart b/tests/language_strong/field_test.dart
similarity index 94%
rename from pkg/dev_compiler/test/codegen/language/field_test.dart
rename to tests/language_strong/field_test.dart
index ca41740..0a34813 100644
--- a/pkg/dev_compiler/test/codegen/language/field_test.dart
+++ b/tests/language_strong/field_test.dart
@@ -4,11 +4,12 @@
 // Dart test program for testing setting/getting of instance fields.
 
 import "package:expect/expect.dart";
+import "package:meta/meta.dart" show virtual;
 
 class First {
   First() {}
-  var a;
-  var b;
+  @virtual var a;
+  @virtual var b;
 
   addFields() {
     return a + b;
diff --git a/pkg/dev_compiler/test/codegen/language/field_type_check2_test.dart b/tests/language_strong/field_type_check2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_type_check2_test.dart
rename to tests/language_strong/field_type_check2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/field_type_check_test.dart b/tests/language_strong/field_type_check_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/field_type_check_test.dart
rename to tests/language_strong/field_type_check_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/final_field_initialization_order_test.dart b/tests/language_strong/final_field_initialization_order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/final_field_initialization_order_test.dart
rename to tests/language_strong/final_field_initialization_order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/final_field_override_test.dart b/tests/language_strong/final_field_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/final_field_override_test.dart
rename to tests/language_strong/final_field_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/final_for_in_variable_test.dart b/tests/language_strong/final_for_in_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/final_for_in_variable_test.dart
rename to tests/language_strong/final_for_in_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/final_is_not_const_test.dart b/tests/language_strong/final_is_not_const_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/final_is_not_const_test.dart
rename to tests/language_strong/final_is_not_const_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/final_param_test.dart b/tests/language_strong/final_param_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/final_param_test.dart
rename to tests/language_strong/final_param_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/final_super_field_set_test.dart b/tests/language_strong/final_super_field_set_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/final_super_field_set_test.dart
rename to tests/language_strong/final_super_field_set_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/final_syntax_test.dart b/tests/language_strong/final_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/final_syntax_test.dart
rename to tests/language_strong/final_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/final_used_in_try_test.dart b/tests/language_strong/final_used_in_try_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/final_used_in_try_test.dart
rename to tests/language_strong/final_used_in_try_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/final_variable_assignment_test.dart b/tests/language_strong/final_variable_assignment_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/final_variable_assignment_test.dart
rename to tests/language_strong/final_variable_assignment_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/finally_test.dart b/tests/language_strong/finally_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/finally_test.dart
rename to tests/language_strong/finally_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/first_class_types_constants_test.dart b/tests/language_strong/first_class_types_constants_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/first_class_types_constants_test.dart
rename to tests/language_strong/first_class_types_constants_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/first_class_types_lib1.dart b/tests/language_strong/first_class_types_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/first_class_types_lib1.dart
rename to tests/language_strong/first_class_types_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/first_class_types_lib2.dart b/tests/language_strong/first_class_types_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/first_class_types_lib2.dart
rename to tests/language_strong/first_class_types_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/first_class_types_libraries_test.dart b/tests/language_strong/first_class_types_libraries_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/first_class_types_libraries_test.dart
rename to tests/language_strong/first_class_types_libraries_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/first_class_types_literals_test.dart b/tests/language_strong/first_class_types_literals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/first_class_types_literals_test.dart
rename to tests/language_strong/first_class_types_literals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/first_class_types_test.dart b/tests/language_strong/first_class_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/first_class_types_test.dart
rename to tests/language_strong/first_class_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/first_test.dart b/tests/language_strong/first_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/first_test.dart
rename to tests/language_strong/first_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/fixed_length_test.dart b/tests/language_strong/fixed_length_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/fixed_length_test.dart
rename to tests/language_strong/fixed_length_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/fixed_type_variable2_test.dart b/tests/language_strong/fixed_type_variable2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/fixed_type_variable2_test.dart
rename to tests/language_strong/fixed_type_variable2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/fixed_type_variable_test.dart b/tests/language_strong/fixed_type_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/fixed_type_variable_test.dart
rename to tests/language_strong/fixed_type_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/flatten_test.dart b/tests/language_strong/flatten_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/flatten_test.dart
rename to tests/language_strong/flatten_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/for2_test.dart b/tests/language_strong/for2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/for2_test.dart
rename to tests/language_strong/for2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/for_in2_test.dart b/tests/language_strong/for_in2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/for_in2_test.dart
rename to tests/language_strong/for_in2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/for_in_side_effects_test.dart b/tests/language_strong/for_in_side_effects_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/for_in_side_effects_test.dart
rename to tests/language_strong/for_in_side_effects_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/for_in_test.dart b/tests/language_strong/for_in_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/for_in_test.dart
rename to tests/language_strong/for_in_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/for_inlining_test.dart b/tests/language_strong/for_inlining_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/for_inlining_test.dart
rename to tests/language_strong/for_inlining_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/for_test.dart b/tests/language_strong/for_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/for_test.dart
rename to tests/language_strong/for_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/for_variable_capture_test.dart b/tests/language_strong/for_variable_capture_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/for_variable_capture_test.dart
rename to tests/language_strong/for_variable_capture_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/for_without_condition_test.dart b/tests/language_strong/for_without_condition_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/for_without_condition_test.dart
rename to tests/language_strong/for_without_condition_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/forwarding_factory_constructor_default_values_test.dart b/tests/language_strong/forwarding_factory_constructor_default_values_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/forwarding_factory_constructor_default_values_test.dart
rename to tests/language_strong/forwarding_factory_constructor_default_values_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/full_stacktrace1_test.dart b/tests/language_strong/full_stacktrace1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/full_stacktrace1_test.dart
rename to tests/language_strong/full_stacktrace1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/full_stacktrace2_test.dart b/tests/language_strong/full_stacktrace2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/full_stacktrace2_test.dart
rename to tests/language_strong/full_stacktrace2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/full_stacktrace3_test.dart b/tests/language_strong/full_stacktrace3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/full_stacktrace3_test.dart
rename to tests/language_strong/full_stacktrace3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_argument_test.dart b/tests/language_strong/function_argument_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_argument_test.dart
rename to tests/language_strong/function_argument_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_field_test.dart b/tests/language_strong/function_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_field_test.dart
rename to tests/language_strong/function_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_getter_test.dart b/tests/language_strong/function_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_getter_test.dart
rename to tests/language_strong/function_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_literals2_test.dart b/tests/language_strong/function_literals2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_literals2_test.dart
rename to tests/language_strong/function_literals2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_literals_test.dart b/tests/language_strong/function_literals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_literals_test.dart
rename to tests/language_strong/function_literals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_malformed_result_type_test.dart b/tests/language_strong/function_malformed_result_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_malformed_result_type_test.dart
rename to tests/language_strong/function_malformed_result_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_propagation_test.dart b/tests/language_strong/function_propagation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_propagation_test.dart
rename to tests/language_strong/function_propagation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype0_test.dart b/tests/language_strong/function_subtype0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype0_test.dart
rename to tests/language_strong/function_subtype0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype1_test.dart b/tests/language_strong/function_subtype1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype1_test.dart
rename to tests/language_strong/function_subtype1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype2_test.dart b/tests/language_strong/function_subtype2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype2_test.dart
rename to tests/language_strong/function_subtype2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype3_test.dart b/tests/language_strong/function_subtype3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype3_test.dart
rename to tests/language_strong/function_subtype3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure0_test.dart b/tests/language_strong/function_subtype_bound_closure0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure0_test.dart
rename to tests/language_strong/function_subtype_bound_closure0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure1_test.dart b/tests/language_strong/function_subtype_bound_closure1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure1_test.dart
rename to tests/language_strong/function_subtype_bound_closure1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure2_test.dart b/tests/language_strong/function_subtype_bound_closure2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure2_test.dart
rename to tests/language_strong/function_subtype_bound_closure2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure3_test.dart b/tests/language_strong/function_subtype_bound_closure3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure3_test.dart
rename to tests/language_strong/function_subtype_bound_closure3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure4_test.dart b/tests/language_strong/function_subtype_bound_closure4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure4_test.dart
rename to tests/language_strong/function_subtype_bound_closure4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure5_test.dart b/tests/language_strong/function_subtype_bound_closure5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure5_test.dart
rename to tests/language_strong/function_subtype_bound_closure5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure5a_test.dart b/tests/language_strong/function_subtype_bound_closure5a_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure5a_test.dart
rename to tests/language_strong/function_subtype_bound_closure5a_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure6_test.dart b/tests/language_strong/function_subtype_bound_closure6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure6_test.dart
rename to tests/language_strong/function_subtype_bound_closure6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure7_test.dart b/tests/language_strong/function_subtype_bound_closure7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_bound_closure7_test.dart
rename to tests/language_strong/function_subtype_bound_closure7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_call0_test.dart b/tests/language_strong/function_subtype_call0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_call0_test.dart
rename to tests/language_strong/function_subtype_call0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_call1_test.dart b/tests/language_strong/function_subtype_call1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_call1_test.dart
rename to tests/language_strong/function_subtype_call1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_call2_test.dart b/tests/language_strong/function_subtype_call2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_call2_test.dart
rename to tests/language_strong/function_subtype_call2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_cast0_test.dart b/tests/language_strong/function_subtype_cast0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_cast0_test.dart
rename to tests/language_strong/function_subtype_cast0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_cast1_test.dart b/tests/language_strong/function_subtype_cast1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_cast1_test.dart
rename to tests/language_strong/function_subtype_cast1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_cast2_test.dart b/tests/language_strong/function_subtype_cast2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_cast2_test.dart
rename to tests/language_strong/function_subtype_cast2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_cast3_test.dart b/tests/language_strong/function_subtype_cast3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_cast3_test.dart
rename to tests/language_strong/function_subtype_cast3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_checked0_test.dart b/tests/language_strong/function_subtype_checked0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_checked0_test.dart
rename to tests/language_strong/function_subtype_checked0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_closure0_test.dart b/tests/language_strong/function_subtype_closure0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_closure0_test.dart
rename to tests/language_strong/function_subtype_closure0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_closure1_test.dart b/tests/language_strong/function_subtype_closure1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_closure1_test.dart
rename to tests/language_strong/function_subtype_closure1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_factory0_test.dart b/tests/language_strong/function_subtype_factory0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_factory0_test.dart
rename to tests/language_strong/function_subtype_factory0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_factory1_test.dart b/tests/language_strong/function_subtype_factory1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_factory1_test.dart
rename to tests/language_strong/function_subtype_factory1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_inline0_test.dart b/tests/language_strong/function_subtype_inline0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_inline0_test.dart
rename to tests/language_strong/function_subtype_inline0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_inline1_test.dart b/tests/language_strong/function_subtype_inline1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_inline1_test.dart
rename to tests/language_strong/function_subtype_inline1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_inline2_test.dart b/tests/language_strong/function_subtype_inline2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_inline2_test.dart
rename to tests/language_strong/function_subtype_inline2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_local0_test.dart b/tests/language_strong/function_subtype_local0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_local0_test.dart
rename to tests/language_strong/function_subtype_local0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_local1_test.dart b/tests/language_strong/function_subtype_local1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_local1_test.dart
rename to tests/language_strong/function_subtype_local1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_local2_test.dart b/tests/language_strong/function_subtype_local2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_local2_test.dart
rename to tests/language_strong/function_subtype_local2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_local3_test.dart b/tests/language_strong/function_subtype_local3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_local3_test.dart
rename to tests/language_strong/function_subtype_local3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_local4_test.dart b/tests/language_strong/function_subtype_local4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_local4_test.dart
rename to tests/language_strong/function_subtype_local4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_local5_test.dart b/tests/language_strong/function_subtype_local5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_local5_test.dart
rename to tests/language_strong/function_subtype_local5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_local6_test.dart b/tests/language_strong/function_subtype_local6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_local6_test.dart
rename to tests/language_strong/function_subtype_local6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_named1_test.dart b/tests/language_strong/function_subtype_named1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_named1_test.dart
rename to tests/language_strong/function_subtype_named1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_named2_test.dart b/tests/language_strong/function_subtype_named2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_named2_test.dart
rename to tests/language_strong/function_subtype_named2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_not0_test.dart b/tests/language_strong/function_subtype_not0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_not0_test.dart
rename to tests/language_strong/function_subtype_not0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_not1_test.dart b/tests/language_strong/function_subtype_not1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_not1_test.dart
rename to tests/language_strong/function_subtype_not1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_not2_test.dart b/tests/language_strong/function_subtype_not2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_not2_test.dart
rename to tests/language_strong/function_subtype_not2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_not3_test.dart b/tests/language_strong/function_subtype_not3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_not3_test.dart
rename to tests/language_strong/function_subtype_not3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_null.dart b/tests/language_strong/function_subtype_null.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_null.dart
rename to tests/language_strong/function_subtype_null.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_optional1_test.dart b/tests/language_strong/function_subtype_optional1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_optional1_test.dart
rename to tests/language_strong/function_subtype_optional1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_optional2_test.dart b/tests/language_strong/function_subtype_optional2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_optional2_test.dart
rename to tests/language_strong/function_subtype_optional2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_regression_ddc_588_test.dart b/tests/language_strong/function_subtype_regression_ddc_588_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_regression_ddc_588_test.dart
rename to tests/language_strong/function_subtype_regression_ddc_588_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_setter0_test.dart b/tests/language_strong/function_subtype_setter0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_setter0_test.dart
rename to tests/language_strong/function_subtype_setter0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_simple0_test.dart b/tests/language_strong/function_subtype_simple0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_simple0_test.dart
rename to tests/language_strong/function_subtype_simple0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_simple1_test.dart b/tests/language_strong/function_subtype_simple1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_simple1_test.dart
rename to tests/language_strong/function_subtype_simple1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_simple2_test.dart b/tests/language_strong/function_subtype_simple2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_simple2_test.dart
rename to tests/language_strong/function_subtype_simple2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_top_level0_test.dart b/tests/language_strong/function_subtype_top_level0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_top_level0_test.dart
rename to tests/language_strong/function_subtype_top_level0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_top_level1_test.dart b/tests/language_strong/function_subtype_top_level1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_top_level1_test.dart
rename to tests/language_strong/function_subtype_top_level1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_typearg0_test.dart b/tests/language_strong/function_subtype_typearg0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_typearg0_test.dart
rename to tests/language_strong/function_subtype_typearg0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_typearg1_test.dart b/tests/language_strong/function_subtype_typearg1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_typearg1_test.dart
rename to tests/language_strong/function_subtype_typearg1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_typearg2_test.dart b/tests/language_strong/function_subtype_typearg2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_typearg2_test.dart
rename to tests/language_strong/function_subtype_typearg2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_typearg3_test.dart b/tests/language_strong/function_subtype_typearg3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_typearg3_test.dart
rename to tests/language_strong/function_subtype_typearg3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_subtype_typearg4_test.dart b/tests/language_strong/function_subtype_typearg4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_subtype_typearg4_test.dart
rename to tests/language_strong/function_subtype_typearg4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_syntax_test.dart b/tests/language_strong/function_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_syntax_test.dart
rename to tests/language_strong/function_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_test.dart b/tests/language_strong/function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_test.dart
rename to tests/language_strong/function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type2_test.dart b/tests/language_strong/function_type2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type2_test.dart
rename to tests/language_strong/function_type2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type3_test.dart b/tests/language_strong/function_type3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type3_test.dart
rename to tests/language_strong/function_type3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_alias2_test.dart b/tests/language_strong/function_type_alias2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_alias2_test.dart
rename to tests/language_strong/function_type_alias2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_alias3_test.dart b/tests/language_strong/function_type_alias3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_alias3_test.dart
rename to tests/language_strong/function_type_alias3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_alias4_test.dart b/tests/language_strong/function_type_alias4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_alias4_test.dart
rename to tests/language_strong/function_type_alias4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_alias5_test.dart b/tests/language_strong/function_type_alias5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_alias5_test.dart
rename to tests/language_strong/function_type_alias5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_alias6_test.dart b/tests/language_strong/function_type_alias6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_alias6_test.dart
rename to tests/language_strong/function_type_alias6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_alias7_test.dart b/tests/language_strong/function_type_alias7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_alias7_test.dart
rename to tests/language_strong/function_type_alias7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_alias8_test.dart b/tests/language_strong/function_type_alias8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_alias8_test.dart
rename to tests/language_strong/function_type_alias8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_alias9_test.dart b/tests/language_strong/function_type_alias9_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_alias9_test.dart
rename to tests/language_strong/function_type_alias9_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_alias_test.dart b/tests/language_strong/function_type_alias_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_alias_test.dart
rename to tests/language_strong/function_type_alias_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_call_getter2_test.dart b/tests/language_strong/function_type_call_getter2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_call_getter2_test.dart
rename to tests/language_strong/function_type_call_getter2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_call_getter_test.dart b/tests/language_strong/function_type_call_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_call_getter_test.dart
rename to tests/language_strong/function_type_call_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_parameter2_negative_test.dart b/tests/language_strong/function_type_parameter2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_parameter2_negative_test.dart
rename to tests/language_strong/function_type_parameter2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_parameter2_test.dart b/tests/language_strong/function_type_parameter2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_parameter2_test.dart
rename to tests/language_strong/function_type_parameter2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_parameter_negative_test.dart b/tests/language_strong/function_type_parameter_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_parameter_negative_test.dart
rename to tests/language_strong/function_type_parameter_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_parameter_test.dart b/tests/language_strong/function_type_parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_parameter_test.dart
rename to tests/language_strong/function_type_parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_test.dart b/tests/language_strong/function_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_test.dart
rename to tests/language_strong/function_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/function_type_this_parameter_test.dart b/tests/language_strong/function_type_this_parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/function_type_this_parameter_test.dart
rename to tests/language_strong/function_type_this_parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/gc_test.dart b/tests/language_strong/gc_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/gc_test.dart
rename to tests/language_strong/gc_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic2_test.dart b/tests/language_strong/generic2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic2_test.dart
rename to tests/language_strong/generic2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_async_star_test.dart b/tests/language_strong/generic_async_star_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_async_star_test.dart
rename to tests/language_strong/generic_async_star_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_async_test.dart b/tests/language_strong/generic_async_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_async_test.dart
rename to tests/language_strong/generic_async_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_closure_test.dart b/tests/language_strong/generic_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_closure_test.dart
rename to tests/language_strong/generic_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_constructor_mixin2_test.dart b/tests/language_strong/generic_constructor_mixin2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_constructor_mixin2_test.dart
rename to tests/language_strong/generic_constructor_mixin2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_constructor_mixin3_test.dart b/tests/language_strong/generic_constructor_mixin3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_constructor_mixin3_test.dart
rename to tests/language_strong/generic_constructor_mixin3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_constructor_mixin_test.dart b/tests/language_strong/generic_constructor_mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_constructor_mixin_test.dart
rename to tests/language_strong/generic_constructor_mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_creation_test.dart b/tests/language_strong/generic_creation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_creation_test.dart
rename to tests/language_strong/generic_creation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_deep_test.dart b/tests/language_strong/generic_deep_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_deep_test.dart
rename to tests/language_strong/generic_deep_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_field_mixin2_test.dart b/tests/language_strong/generic_field_mixin2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_field_mixin2_test.dart
rename to tests/language_strong/generic_field_mixin2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_field_mixin3_test.dart b/tests/language_strong/generic_field_mixin3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_field_mixin3_test.dart
rename to tests/language_strong/generic_field_mixin3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_field_mixin4_test.dart b/tests/language_strong/generic_field_mixin4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_field_mixin4_test.dart
rename to tests/language_strong/generic_field_mixin4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_field_mixin5_test.dart b/tests/language_strong/generic_field_mixin5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_field_mixin5_test.dart
rename to tests/language_strong/generic_field_mixin5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_field_mixin6_test.dart b/tests/language_strong/generic_field_mixin6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_field_mixin6_test.dart
rename to tests/language_strong/generic_field_mixin6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_field_mixin_test.dart b/tests/language_strong/generic_field_mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_field_mixin_test.dart
rename to tests/language_strong/generic_field_mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_inheritance_test.dart b/tests/language_strong/generic_inheritance_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_inheritance_test.dart
rename to tests/language_strong/generic_inheritance_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_instanceof.dart b/tests/language_strong/generic_instanceof.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_instanceof.dart
rename to tests/language_strong/generic_instanceof.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_instanceof2_test.dart b/tests/language_strong/generic_instanceof2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_instanceof2_test.dart
rename to tests/language_strong/generic_instanceof2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_instanceof3_test.dart b/tests/language_strong/generic_instanceof3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_instanceof3_test.dart
rename to tests/language_strong/generic_instanceof3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_instanceof4_test.dart b/tests/language_strong/generic_instanceof4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_instanceof4_test.dart
rename to tests/language_strong/generic_instanceof4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_instanceof5_test.dart b/tests/language_strong/generic_instanceof5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_instanceof5_test.dart
rename to tests/language_strong/generic_instanceof5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_instanceof_test.dart b/tests/language_strong/generic_instanceof_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_instanceof_test.dart
rename to tests/language_strong/generic_instanceof_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_is_check_test.dart b/tests/language_strong/generic_is_check_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_is_check_test.dart
rename to tests/language_strong/generic_is_check_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_list_checked_test.dart b/tests/language_strong/generic_list_checked_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_list_checked_test.dart
rename to tests/language_strong/generic_list_checked_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_native_test.dart b/tests/language_strong/generic_native_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_native_test.dart
rename to tests/language_strong/generic_native_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_object_type_test.dart b/tests/language_strong/generic_object_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_object_type_test.dart
rename to tests/language_strong/generic_object_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_parameterized_extends_test.dart b/tests/language_strong/generic_parameterized_extends_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_parameterized_extends_test.dart
rename to tests/language_strong/generic_parameterized_extends_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_self_reference_test.dart b/tests/language_strong/generic_self_reference_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_self_reference_test.dart
rename to tests/language_strong/generic_self_reference_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_sync_star_test.dart b/tests/language_strong/generic_sync_star_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_sync_star_test.dart
rename to tests/language_strong/generic_sync_star_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_syntax_test.dart b/tests/language_strong/generic_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_syntax_test.dart
rename to tests/language_strong/generic_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_tearoff_test.dart b/tests/language_strong/generic_tearoff_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_tearoff_test.dart
rename to tests/language_strong/generic_tearoff_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generic_test.dart b/tests/language_strong/generic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generic_test.dart
rename to tests/language_strong/generic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generics2_test.dart b/tests/language_strong/generics2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generics2_test.dart
rename to tests/language_strong/generics2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generics3_test.dart b/tests/language_strong/generics3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generics3_test.dart
rename to tests/language_strong/generics3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/generics_test.dart b/tests/language_strong/generics_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/generics_test.dart
rename to tests/language_strong/generics_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/get_set_syntax_test.dart b/tests/language_strong/get_set_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/get_set_syntax_test.dart
rename to tests/language_strong/get_set_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_closure_execution_order_test.dart b/tests/language_strong/getter_closure_execution_order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_closure_execution_order_test.dart
rename to tests/language_strong/getter_closure_execution_order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_declaration_negative_test.dart b/tests/language_strong/getter_declaration_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_declaration_negative_test.dart
rename to tests/language_strong/getter_declaration_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_no_setter2_test.dart b/tests/language_strong/getter_no_setter2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_no_setter2_test.dart
rename to tests/language_strong/getter_no_setter2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_no_setter_test.dart b/tests/language_strong/getter_no_setter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_no_setter_test.dart
rename to tests/language_strong/getter_no_setter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_override2_test.dart b/tests/language_strong/getter_override2_test.dart
similarity index 87%
rename from pkg/dev_compiler/test/codegen/language/getter_override2_test.dart
rename to tests/language_strong/getter_override2_test.dart
index ec162de..0fc4c5a 100644
--- a/pkg/dev_compiler/test/codegen/language/getter_override2_test.dart
+++ b/tests/language_strong/getter_override2_test.dart
@@ -6,9 +6,10 @@
 // with an inherited instance method of the same name.
 
 import "package:expect/expect.dart";
+import "package:meta/meta.dart" show virtual;
 
 class A {
-  var foo = 42;  /// 00: ok
+  @virtual var foo = 42;  /// 00: ok
   get foo => 42;  /// 01: ok
   foo() => 42;  /// 02: compile-time error
   set foo(value) { }  /// 03: ok
diff --git a/pkg/dev_compiler/test/codegen/language/getter_override3_test.dart b/tests/language_strong/getter_override3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_override3_test.dart
rename to tests/language_strong/getter_override3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_override_test.dart b/tests/language_strong/getter_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_override_test.dart
rename to tests/language_strong/getter_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_parameters_test.dart b/tests/language_strong/getter_parameters_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_parameters_test.dart
rename to tests/language_strong/getter_parameters_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_setter_in_lib.dart b/tests/language_strong/getter_setter_in_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_setter_in_lib.dart
rename to tests/language_strong/getter_setter_in_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_setter_in_lib2.dart b/tests/language_strong/getter_setter_in_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_setter_in_lib2.dart
rename to tests/language_strong/getter_setter_in_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_setter_in_lib3.dart b/tests/language_strong/getter_setter_in_lib3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_setter_in_lib3.dart
rename to tests/language_strong/getter_setter_in_lib3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_setter_in_lib_test.dart b/tests/language_strong/getter_setter_in_lib_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_setter_in_lib_test.dart
rename to tests/language_strong/getter_setter_in_lib_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_setter_interceptor_test.dart b/tests/language_strong/getter_setter_interceptor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_setter_interceptor_test.dart
rename to tests/language_strong/getter_setter_interceptor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getter_setter_order_test.dart b/tests/language_strong/getter_setter_order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getter_setter_order_test.dart
rename to tests/language_strong/getter_setter_order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getters_setters2_test.dart b/tests/language_strong/getters_setters2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getters_setters2_test.dart
rename to tests/language_strong/getters_setters2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getters_setters_test.dart b/tests/language_strong/getters_setters_test.dart
similarity index 96%
rename from pkg/dev_compiler/test/codegen/language/getters_setters_test.dart
rename to tests/language_strong/getters_setters_test.dart
index 1511e77..315da2e 100644
--- a/pkg/dev_compiler/test/codegen/language/getters_setters_test.dart
+++ b/tests/language_strong/getters_setters_test.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:meta/meta.dart" show virtual;
 
 class GettersSettersTest {
 
@@ -61,7 +62,7 @@
 }
 
 class A {
-  int x_;
+  @virtual int x_;
   static int foo;
 
   static get bar {
diff --git a/pkg/dev_compiler/test/codegen/language/getters_setters_type2_test.dart b/tests/language_strong/getters_setters_type2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getters_setters_type2_test.dart
rename to tests/language_strong/getters_setters_type2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getters_setters_type3_test.dart b/tests/language_strong/getters_setters_type3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getters_setters_type3_test.dart
rename to tests/language_strong/getters_setters_type3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/getters_setters_type_test.dart b/tests/language_strong/getters_setters_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/getters_setters_type_test.dart
rename to tests/language_strong/getters_setters_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/guess_cid_test.dart b/tests/language_strong/guess_cid_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/guess_cid_test.dart
rename to tests/language_strong/guess_cid_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/gvn_field_access_test.dart b/tests/language_strong/gvn_field_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/gvn_field_access_test.dart
rename to tests/language_strong/gvn_field_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/gvn_interceptor_test.dart b/tests/language_strong/gvn_interceptor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/gvn_interceptor_test.dart
rename to tests/language_strong/gvn_interceptor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/gvn_test.dart b/tests/language_strong/gvn_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/gvn_test.dart
rename to tests/language_strong/gvn_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/hash_code_mangling_test.dart b/tests/language_strong/hash_code_mangling_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/hash_code_mangling_test.dart
rename to tests/language_strong/hash_code_mangling_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/hash_map_null_key_foreach_test.dart b/tests/language_strong/hash_map_null_key_foreach_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/hash_map_null_key_foreach_test.dart
rename to tests/language_strong/hash_map_null_key_foreach_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/hashcode_dynamic_test.dart b/tests/language_strong/hashcode_dynamic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/hashcode_dynamic_test.dart
rename to tests/language_strong/hashcode_dynamic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/hello_dart_test.dart b/tests/language_strong/hello_dart_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/hello_dart_test.dart
rename to tests/language_strong/hello_dart_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/hello_script_lib.dart b/tests/language_strong/hello_script_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/hello_script_lib.dart
rename to tests/language_strong/hello_script_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/hello_script_lib_source.dart b/tests/language_strong/hello_script_lib_source.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/hello_script_lib_source.dart
rename to tests/language_strong/hello_script_lib_source.dart
diff --git a/pkg/dev_compiler/test/codegen/language/hello_script_test.dart b/tests/language_strong/hello_script_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/hello_script_test.dart
rename to tests/language_strong/hello_script_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/hidden_import_lib.dart b/tests/language_strong/hidden_import_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/hidden_import_lib.dart
rename to tests/language_strong/hidden_import_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/hidden_import_test.dart b/tests/language_strong/hidden_import_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/hidden_import_test.dart
rename to tests/language_strong/hidden_import_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/identical_closure2_test.dart b/tests/language_strong/identical_closure2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/identical_closure2_test.dart
rename to tests/language_strong/identical_closure2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/identical_closure_test.dart b/tests/language_strong/identical_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/identical_closure_test.dart
rename to tests/language_strong/identical_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/identical_const_test.dart b/tests/language_strong/identical_const_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/identical_const_test.dart
rename to tests/language_strong/identical_const_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/identical_test.dart b/tests/language_strong/identical_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/identical_test.dart
rename to tests/language_strong/identical_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/if_and_test.dart b/tests/language_strong/if_and_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/if_and_test.dart
rename to tests/language_strong/if_and_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/if_null_assignment_behavior_test.dart b/tests/language_strong/if_null_assignment_behavior_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/if_null_assignment_behavior_test.dart
rename to tests/language_strong/if_null_assignment_behavior_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/if_null_assignment_helper.dart b/tests/language_strong/if_null_assignment_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/if_null_assignment_helper.dart
rename to tests/language_strong/if_null_assignment_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/language/if_null_assignment_static_test.dart b/tests/language_strong/if_null_assignment_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/if_null_assignment_static_test.dart
rename to tests/language_strong/if_null_assignment_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/if_null_behavior_test.dart b/tests/language_strong/if_null_behavior_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/if_null_behavior_test.dart
rename to tests/language_strong/if_null_behavior_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/if_null_evaluation_order_test.dart b/tests/language_strong/if_null_evaluation_order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/if_null_evaluation_order_test.dart
rename to tests/language_strong/if_null_evaluation_order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/if_null_precedence_test.dart b/tests/language_strong/if_null_precedence_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/if_null_precedence_test.dart
rename to tests/language_strong/if_null_precedence_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/if_test.dart b/tests/language_strong/if_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/if_test.dart
rename to tests/language_strong/if_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/illegal_declaration_test.dart b/tests/language_strong/illegal_declaration_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/illegal_declaration_test.dart
rename to tests/language_strong/illegal_declaration_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/illegal_initializer_test.dart b/tests/language_strong/illegal_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/illegal_initializer_test.dart
rename to tests/language_strong/illegal_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/illegal_invocation_lib.dart b/tests/language_strong/illegal_invocation_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/illegal_invocation_lib.dart
rename to tests/language_strong/illegal_invocation_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/illegal_invocation_test.dart b/tests/language_strong/illegal_invocation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/illegal_invocation_test.dart
rename to tests/language_strong/illegal_invocation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/implicit_closure1_test.dart b/tests/language_strong/implicit_closure1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/implicit_closure1_test.dart
rename to tests/language_strong/implicit_closure1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/implicit_closure2_test.dart b/tests/language_strong/implicit_closure2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/implicit_closure2_test.dart
rename to tests/language_strong/implicit_closure2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/implicit_closure_test.dart b/tests/language_strong/implicit_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/implicit_closure_test.dart
rename to tests/language_strong/implicit_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/implicit_scope_test.dart b/tests/language_strong/implicit_scope_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/implicit_scope_test.dart
rename to tests/language_strong/implicit_scope_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/implicit_super_constructor_call_test.dart b/tests/language_strong/implicit_super_constructor_call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/implicit_super_constructor_call_test.dart
rename to tests/language_strong/implicit_super_constructor_call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/implicit_super_constructor_test.dart b/tests/language_strong/implicit_super_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/implicit_super_constructor_test.dart
rename to tests/language_strong/implicit_super_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/implicit_this_test.dart b/tests/language_strong/implicit_this_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/implicit_this_test.dart
rename to tests/language_strong/implicit_this_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/implied_interface_test.dart b/tests/language_strong/implied_interface_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/implied_interface_test.dart
rename to tests/language_strong/implied_interface_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import1_lib.dart b/tests/language_strong/import1_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import1_lib.dart
rename to tests/language_strong/import1_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_collection_no_prefix_test.dart b/tests/language_strong/import_collection_no_prefix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_collection_no_prefix_test.dart
rename to tests/language_strong/import_collection_no_prefix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_combinators_negative_test.dart b/tests/language_strong/import_combinators_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_combinators_negative_test.dart
rename to tests/language_strong/import_combinators_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_combinators_part.dart b/tests/language_strong/import_combinators_part.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_combinators_part.dart
rename to tests/language_strong/import_combinators_part.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_combinators_test.dart b/tests/language_strong/import_combinators_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_combinators_test.dart
rename to tests/language_strong/import_combinators_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_core_no_prefix_test.dart b/tests/language_strong/import_core_no_prefix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_core_no_prefix_test.dart
rename to tests/language_strong/import_core_no_prefix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_core_prefix_test.dart b/tests/language_strong/import_core_prefix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_core_prefix_test.dart
rename to tests/language_strong/import_core_prefix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_core_test.dart b/tests/language_strong/import_core_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_core_test.dart
rename to tests/language_strong/import_core_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_private_test.dart b/tests/language_strong/import_private_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_private_test.dart
rename to tests/language_strong/import_private_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_self_test.dart b/tests/language_strong/import_self_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_self_test.dart
rename to tests/language_strong/import_self_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_show_lib.dart b/tests/language_strong/import_show_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_show_lib.dart
rename to tests/language_strong/import_show_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/import_show_test.dart b/tests/language_strong/import_show_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/import_show_test.dart
rename to tests/language_strong/import_show_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/incr_op_test.dart b/tests/language_strong/incr_op_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/incr_op_test.dart
rename to tests/language_strong/incr_op_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/index_test.dart b/tests/language_strong/index_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/index_test.dart
rename to tests/language_strong/index_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/indirect_const_null_test.dart b/tests/language_strong/indirect_const_null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/indirect_const_null_test.dart
rename to tests/language_strong/indirect_const_null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inference_captured_variable2_test.dart b/tests/language_strong/inference_captured_variable2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inference_captured_variable2_test.dart
rename to tests/language_strong/inference_captured_variable2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inference_captured_variable_test.dart b/tests/language_strong/inference_captured_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inference_captured_variable_test.dart
rename to tests/language_strong/inference_captured_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inference_list_or_null_test.dart b/tests/language_strong/inference_list_or_null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inference_list_or_null_test.dart
rename to tests/language_strong/inference_list_or_null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inference_mixin_field_test.dart b/tests/language_strong/inference_mixin_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inference_mixin_field_test.dart
rename to tests/language_strong/inference_mixin_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inference_super_constructor_call_test.dart b/tests/language_strong/inference_super_constructor_call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inference_super_constructor_call_test.dart
rename to tests/language_strong/inference_super_constructor_call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_closure_test.dart b/tests/language_strong/inferrer_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_closure_test.dart
rename to tests/language_strong/inferrer_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_constructor2_test.dart b/tests/language_strong/inferrer_constructor2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_constructor2_test.dart
rename to tests/language_strong/inferrer_constructor2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_constructor3_test.dart b/tests/language_strong/inferrer_constructor3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_constructor3_test.dart
rename to tests/language_strong/inferrer_constructor3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_constructor4_test.dart b/tests/language_strong/inferrer_constructor4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_constructor4_test.dart
rename to tests/language_strong/inferrer_constructor4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_constructor5_test.dart b/tests/language_strong/inferrer_constructor5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_constructor5_test.dart
rename to tests/language_strong/inferrer_constructor5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_constructor_test.dart b/tests/language_strong/inferrer_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_constructor_test.dart
rename to tests/language_strong/inferrer_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_named_parameter_test.dart b/tests/language_strong/inferrer_named_parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_named_parameter_test.dart
rename to tests/language_strong/inferrer_named_parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_synthesized_constructor_test.dart b/tests/language_strong/inferrer_synthesized_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_synthesized_constructor_test.dart
rename to tests/language_strong/inferrer_synthesized_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_synthesized_super_constructor2_test.dart b/tests/language_strong/inferrer_synthesized_super_constructor2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_synthesized_super_constructor2_test.dart
rename to tests/language_strong/inferrer_synthesized_super_constructor2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_synthesized_super_constructor_test.dart b/tests/language_strong/inferrer_synthesized_super_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_synthesized_super_constructor_test.dart
rename to tests/language_strong/inferrer_synthesized_super_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inferrer_this_access_test.dart b/tests/language_strong/inferrer_this_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inferrer_this_access_test.dart
rename to tests/language_strong/inferrer_this_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/infinite_switch_label_test.dart b/tests/language_strong/infinite_switch_label_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/infinite_switch_label_test.dart
rename to tests/language_strong/infinite_switch_label_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/infinity_test.dart b/tests/language_strong/infinity_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/infinity_test.dart
rename to tests/language_strong/infinity_test.dart
diff --git a/tests/language_strong/initializing_formal_access_test.dart b/tests/language_strong/initializing_formal_access_test.dart
new file mode 100644
index 0000000..71f445e
--- /dev/null
+++ b/tests/language_strong/initializing_formal_access_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// DartOptions=--initializing-formal-access
+// VMOptions=--initializing-formal-access
+
+import "package:expect/expect.dart";
+
+class C {
+  final int x;
+  final int y;
+
+  const C.constant(this.x) : y = x + 1;
+
+  C(this.x) : y = x + 1 {
+    int z = x + 2;
+    assert(z == y + 1);
+  }
+}
+
+main() {
+  C c = new C(2);
+  Expect.equals(c.x, 2);
+  Expect.equals(c.y, 3);
+  const C cc = const C.constant(4);
+  Expect.equals(cc.x, 4);
+  Expect.equals(cc.y, 5);
+}
diff --git a/tests/language_strong/initializing_formal_capture_test.dart b/tests/language_strong/initializing_formal_capture_test.dart
new file mode 100644
index 0000000..8257d4f
--- /dev/null
+++ b/tests/language_strong/initializing_formal_capture_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// DartOptions=--initializing-formal-access
+// VMOptions=--initializing-formal-access
+
+import "package:expect/expect.dart";
+
+class A {
+  var x, y;
+  A(this.x) : y = (() => x);
+}
+
+main() {
+  A a = new A(2);
+  a.x = 3;
+  Expect.equals(a.x, 3);
+  Expect.equals(a.y(), 2);
+}
diff --git a/tests/language_strong/initializing_formal_final_test.dart b/tests/language_strong/initializing_formal_final_test.dart
new file mode 100644
index 0000000..3df4ba5
--- /dev/null
+++ b/tests/language_strong/initializing_formal_final_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// DartOptions=--initializing-formal-access
+// VMOptions=--initializing-formal-access
+
+import "package:expect/expect.dart";
+
+class A {
+  var x, y;
+  // This should cause a warning because `x` is final when
+  // accessed as an initializing formal.
+  A(this.x) : y = (() { x = 3; });
+}
+
+main() {
+  A a = new A(2);
+  Expect.equals(a.x, 2);
+  Expect.throws(() => a.y(), (e) => e is NoSuchMethodError);
+}
diff --git a/tests/language_strong/initializing_formal_promotion_test.dart b/tests/language_strong/initializing_formal_promotion_test.dart
new file mode 100644
index 0000000..89ec79e
--- /dev/null
+++ b/tests/language_strong/initializing_formal_promotion_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// DartOptions=--initializing-formal-access
+// VMOptions=--initializing-formal-access
+
+import "package:expect/expect.dart";
+
+class B {}
+
+class A {
+  B x, y;
+  // Promotion occurs for the initializing formal because C <: B.
+  A(this.x) : y = (x is C) ? x.x : x;
+}
+
+class C extends A implements B {
+  C(B x) : super(x);
+}
+
+main() {
+  C c = new C(null);
+  C cc = new C(c);
+  Expect.equals(c.y, null);
+  Expect.equals(cc.y, null);
+}
diff --git a/tests/language_strong/initializing_formal_scope_test.dart b/tests/language_strong/initializing_formal_scope_test.dart
new file mode 100644
index 0000000..5544a8e
--- /dev/null
+++ b/tests/language_strong/initializing_formal_scope_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// DartOptions=--initializing-formal-access
+// VMOptions=--initializing-formal-access
+
+import "package:expect/expect.dart";
+
+// Duplicate definition checks for `this.x` will check the scopes associated
+// with the constructor, not all enclosing scopes; so this is not a conflict.
+var x;
+
+class A {
+  var x;
+  A(this.x) {
+    // In the body the field is in scope, not the initializing formal;
+    // so we can use the setter.
+    x += 1;
+  }
+}
+
+main() {
+  A a = new A(2);
+  Expect.equals(a.x, 3);
+}
diff --git a/tests/language_strong/initializing_formal_type_test.dart b/tests/language_strong/initializing_formal_type_test.dart
new file mode 100644
index 0000000..af44444
--- /dev/null
+++ b/tests/language_strong/initializing_formal_type_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// DartOptions=--initializing-formal-access
+// VMOptions=--initializing-formal-access
+
+import "package:expect/expect.dart";
+
+class A {
+  num x;
+  double y;
+  // Finding the type of an initializing formal: should cause a warning
+  // in the initializer but not the body, because the former has type
+  // `int` and the latter has type `num`.
+  A(int this.x) : y = x {
+    y = x;
+  }
+}
+
+main() {
+  A a = new A(null);
+  Expect.equals(a.x, null);
+  Expect.equals(a.y, null);
+}
diff --git a/pkg/dev_compiler/test/codegen/language/inline_add_constants_to_initial_env_test.dart b/tests/language_strong/inline_add_constants_to_initial_env_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_add_constants_to_initial_env_test.dart
rename to tests/language_strong/inline_add_constants_to_initial_env_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_argument_test.dart b/tests/language_strong/inline_argument_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_argument_test.dart
rename to tests/language_strong/inline_argument_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_closure_with_constant_arguments_test.dart b/tests/language_strong/inline_closure_with_constant_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_closure_with_constant_arguments_test.dart
rename to tests/language_strong/inline_closure_with_constant_arguments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_effect_context_test.dart b/tests/language_strong/inline_effect_context_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_effect_context_test.dart
rename to tests/language_strong/inline_effect_context_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_getter_test.dart b/tests/language_strong/inline_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_getter_test.dart
rename to tests/language_strong/inline_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_in_for_initializer_and_bailout_test.dart b/tests/language_strong/inline_in_for_initializer_and_bailout_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_in_for_initializer_and_bailout_test.dart
rename to tests/language_strong/inline_in_for_initializer_and_bailout_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_super_field_lib.dart b/tests/language_strong/inline_super_field_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_super_field_lib.dart
rename to tests/language_strong/inline_super_field_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_super_field_test.dart b/tests/language_strong/inline_super_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_super_field_test.dart
rename to tests/language_strong/inline_super_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_super_part.dart b/tests/language_strong/inline_super_part.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_super_part.dart
rename to tests/language_strong/inline_super_part.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_super_test.dart b/tests/language_strong/inline_super_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_super_test.dart
rename to tests/language_strong/inline_super_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_test.dart b/tests/language_strong/inline_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_test.dart
rename to tests/language_strong/inline_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_test_context_test.dart b/tests/language_strong/inline_test_context_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_test_context_test.dart
rename to tests/language_strong/inline_test_context_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inline_value_context_test.dart b/tests/language_strong/inline_value_context_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inline_value_context_test.dart
rename to tests/language_strong/inline_value_context_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inlined_conditional_test.dart b/tests/language_strong/inlined_conditional_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inlined_conditional_test.dart
rename to tests/language_strong/inlined_conditional_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inlined_throw_test.dart b/tests/language_strong/inlined_throw_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inlined_throw_test.dart
rename to tests/language_strong/inlined_throw_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inst_field_initializer1_negative_test.dart b/tests/language_strong/inst_field_initializer1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inst_field_initializer1_negative_test.dart
rename to tests/language_strong/inst_field_initializer1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/inst_field_initializer_test.dart b/tests/language_strong/inst_field_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/inst_field_initializer_test.dart
rename to tests/language_strong/inst_field_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instance_call_wrong_argument_count_negative_test.dart b/tests/language_strong/instance_call_wrong_argument_count_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instance_call_wrong_argument_count_negative_test.dart
rename to tests/language_strong/instance_call_wrong_argument_count_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instance_compound_assignment_operator_test.dart b/tests/language_strong/instance_compound_assignment_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instance_compound_assignment_operator_test.dart
rename to tests/language_strong/instance_compound_assignment_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instance_creation_in_function_annotation_test.dart b/tests/language_strong/instance_creation_in_function_annotation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instance_creation_in_function_annotation_test.dart
rename to tests/language_strong/instance_creation_in_function_annotation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instance_field_initializer_test.dart b/tests/language_strong/instance_field_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instance_field_initializer_test.dart
rename to tests/language_strong/instance_field_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instance_incr_deopt_test.dart b/tests/language_strong/instance_incr_deopt_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instance_incr_deopt_test.dart
rename to tests/language_strong/instance_incr_deopt_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instance_inline_test.dart b/tests/language_strong/instance_inline_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instance_inline_test.dart
rename to tests/language_strong/instance_inline_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instance_method2_negative_test.dart b/tests/language_strong/instance_method2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instance_method2_negative_test.dart
rename to tests/language_strong/instance_method2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instance_method_negative_test.dart b/tests/language_strong/instance_method_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instance_method_negative_test.dart
rename to tests/language_strong/instance_method_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instanceof2_test.dart b/tests/language_strong/instanceof2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instanceof2_test.dart
rename to tests/language_strong/instanceof2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instanceof3_test.dart b/tests/language_strong/instanceof3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instanceof3_test.dart
rename to tests/language_strong/instanceof3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instanceof4_test.dart b/tests/language_strong/instanceof4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instanceof4_test.dart
rename to tests/language_strong/instanceof4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instanceof_optimized_test.dart b/tests/language_strong/instanceof_optimized_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instanceof_optimized_test.dart
rename to tests/language_strong/instanceof_optimized_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instanceof_test.dart b/tests/language_strong/instanceof_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instanceof_test.dart
rename to tests/language_strong/instanceof_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/instantiate_type_variable_test.dart b/tests/language_strong/instantiate_type_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/instantiate_type_variable_test.dart
rename to tests/language_strong/instantiate_type_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/int2_test.dart b/tests/language_strong/int2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/int2_test.dart
rename to tests/language_strong/int2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/int_test.dart b/tests/language_strong/int_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/int_test.dart
rename to tests/language_strong/int_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/integer_division_by_zero_test.dart b/tests/language_strong/integer_division_by_zero_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/integer_division_by_zero_test.dart
rename to tests/language_strong/integer_division_by_zero_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interceptor2_test.dart b/tests/language_strong/interceptor2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interceptor2_test.dart
rename to tests/language_strong/interceptor2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interceptor3_test.dart b/tests/language_strong/interceptor3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interceptor3_test.dart
rename to tests/language_strong/interceptor3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interceptor4_test.dart b/tests/language_strong/interceptor4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interceptor4_test.dart
rename to tests/language_strong/interceptor4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interceptor5_test.dart b/tests/language_strong/interceptor5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interceptor5_test.dart
rename to tests/language_strong/interceptor5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interceptor6_test.dart b/tests/language_strong/interceptor6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interceptor6_test.dart
rename to tests/language_strong/interceptor6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interceptor7_test.dart b/tests/language_strong/interceptor7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interceptor7_test.dart
rename to tests/language_strong/interceptor7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interceptor8_test.dart b/tests/language_strong/interceptor8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interceptor8_test.dart
rename to tests/language_strong/interceptor8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interceptor9_test.dart b/tests/language_strong/interceptor9_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interceptor9_test.dart
rename to tests/language_strong/interceptor9_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interceptor_test.dart b/tests/language_strong/interceptor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interceptor_test.dart
rename to tests/language_strong/interceptor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interface2_negative_test.dart b/tests/language_strong/interface2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interface2_negative_test.dart
rename to tests/language_strong/interface2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interface_constants_test.dart b/tests/language_strong/interface_constants_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interface_constants_test.dart
rename to tests/language_strong/interface_constants_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interface_cycle_test.dart b/tests/language_strong/interface_cycle_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interface_cycle_test.dart
rename to tests/language_strong/interface_cycle_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interface_inherit_field_test.dart b/tests/language_strong/interface_inherit_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interface_inherit_field_test.dart
rename to tests/language_strong/interface_inherit_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interface_injection1_negative_test.dart b/tests/language_strong/interface_injection1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interface_injection1_negative_test.dart
rename to tests/language_strong/interface_injection1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interface_injection2_negative_test.dart b/tests/language_strong/interface_injection2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interface_injection2_negative_test.dart
rename to tests/language_strong/interface_injection2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interface_static_method_negative_test.dart b/tests/language_strong/interface_static_method_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interface_static_method_negative_test.dart
rename to tests/language_strong/interface_static_method_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interface_static_non_final_fields_negative_test.dart b/tests/language_strong/interface_static_non_final_fields_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interface_static_non_final_fields_negative_test.dart
rename to tests/language_strong/interface_static_non_final_fields_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/interface_test.dart b/tests/language_strong/interface_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/interface_test.dart
rename to tests/language_strong/interface_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/internal_library_test.dart b/tests/language_strong/internal_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/internal_library_test.dart
rename to tests/language_strong/internal_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/intrinsified_methods_test.dart b/tests/language_strong/intrinsified_methods_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/intrinsified_methods_test.dart
rename to tests/language_strong/intrinsified_methods_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/invocation_mirror2_test.dart b/tests/language_strong/invocation_mirror2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/invocation_mirror2_test.dart
rename to tests/language_strong/invocation_mirror2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/invocation_mirror_invoke_on2_test.dart b/tests/language_strong/invocation_mirror_invoke_on2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/invocation_mirror_invoke_on2_test.dart
rename to tests/language_strong/invocation_mirror_invoke_on2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/invocation_mirror_invoke_on_test.dart b/tests/language_strong/invocation_mirror_invoke_on_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/invocation_mirror_invoke_on_test.dart
rename to tests/language_strong/invocation_mirror_invoke_on_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/invocation_mirror_test.dart b/tests/language_strong/invocation_mirror_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/invocation_mirror_test.dart
rename to tests/language_strong/invocation_mirror_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_function_test.dart b/tests/language_strong/is_function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_function_test.dart
rename to tests/language_strong/is_function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_interfaces2_test.dart b/tests/language_strong/is_interfaces2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_interfaces2_test.dart
rename to tests/language_strong/is_interfaces2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_interfaces_test.dart b/tests/language_strong/is_interfaces_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_interfaces_test.dart
rename to tests/language_strong/is_interfaces_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_malformed_type_test.dart b/tests/language_strong/is_malformed_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_malformed_type_test.dart
rename to tests/language_strong/is_malformed_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_nan_test.dart b/tests/language_strong/is_nan_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_nan_test.dart
rename to tests/language_strong/is_nan_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_not_class1_negative_test.dart b/tests/language_strong/is_not_class1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_not_class1_negative_test.dart
rename to tests/language_strong/is_not_class1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_not_class2_test.dart b/tests/language_strong/is_not_class2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_not_class2_test.dart
rename to tests/language_strong/is_not_class2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_not_class4_negative_test.dart b/tests/language_strong/is_not_class4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_not_class4_negative_test.dart
rename to tests/language_strong/is_not_class4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_object_test.dart b/tests/language_strong/is_object_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_object_test.dart
rename to tests/language_strong/is_object_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_operator_clash_test.dart b/tests/language_strong/is_operator_clash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_operator_clash_test.dart
rename to tests/language_strong/is_operator_clash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/is_operator_test.dart b/tests/language_strong/is_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/is_operator_test.dart
rename to tests/language_strong/is_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/isnot_malformed_type_test.dart b/tests/language_strong/isnot_malformed_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/isnot_malformed_type_test.dart
rename to tests/language_strong/isnot_malformed_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue10204_test.dart b/tests/language_strong/issue10204_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue10204_test.dart
rename to tests/language_strong/issue10204_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue10321_test.dart b/tests/language_strong/issue10321_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue10321_test.dart
rename to tests/language_strong/issue10321_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue10561_test.dart b/tests/language_strong/issue10561_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue10561_test.dart
rename to tests/language_strong/issue10561_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue10581_test.dart b/tests/language_strong/issue10581_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue10581_test.dart
rename to tests/language_strong/issue10581_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue10721_test.dart b/tests/language_strong/issue10721_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue10721_test.dart
rename to tests/language_strong/issue10721_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue10747_test.dart b/tests/language_strong/issue10747_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue10747_test.dart
rename to tests/language_strong/issue10747_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue10783_test.dart b/tests/language_strong/issue10783_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue10783_test.dart
rename to tests/language_strong/issue10783_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue11724_test.dart b/tests/language_strong/issue11724_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue11724_test.dart
rename to tests/language_strong/issue11724_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue11793_test.dart b/tests/language_strong/issue11793_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue11793_test.dart
rename to tests/language_strong/issue11793_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue12023_test.dart b/tests/language_strong/issue12023_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue12023_test.dart
rename to tests/language_strong/issue12023_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue12284_test.dart b/tests/language_strong/issue12284_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue12284_test.dart
rename to tests/language_strong/issue12284_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue12288_test.dart b/tests/language_strong/issue12288_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue12288_test.dart
rename to tests/language_strong/issue12288_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue12336_test.dart b/tests/language_strong/issue12336_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue12336_test.dart
rename to tests/language_strong/issue12336_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue13179_test.dart b/tests/language_strong/issue13179_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue13179_test.dart
rename to tests/language_strong/issue13179_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue13474_test.dart b/tests/language_strong/issue13474_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue13474_test.dart
rename to tests/language_strong/issue13474_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue13556_test.dart b/tests/language_strong/issue13556_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue13556_test.dart
rename to tests/language_strong/issue13556_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue1363_lib.dart b/tests/language_strong/issue1363_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue1363_lib.dart
rename to tests/language_strong/issue1363_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue1363_test.dart b/tests/language_strong/issue1363_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue1363_test.dart
rename to tests/language_strong/issue1363_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue13673_test.dart b/tests/language_strong/issue13673_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue13673_test.dart
rename to tests/language_strong/issue13673_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue14014_2_test.dart b/tests/language_strong/issue14014_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue14014_2_test.dart
rename to tests/language_strong/issue14014_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue14014_3_test.dart b/tests/language_strong/issue14014_3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue14014_3_test.dart
rename to tests/language_strong/issue14014_3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue14014_test.dart b/tests/language_strong/issue14014_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue14014_test.dart
rename to tests/language_strong/issue14014_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue14242_test.dart b/tests/language_strong/issue14242_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue14242_test.dart
rename to tests/language_strong/issue14242_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue15606_test.dart b/tests/language_strong/issue15606_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue15606_test.dart
rename to tests/language_strong/issue15606_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue15702_test.dart b/tests/language_strong/issue15702_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue15702_test.dart
rename to tests/language_strong/issue15702_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue15720_test.dart b/tests/language_strong/issue15720_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue15720_test.dart
rename to tests/language_strong/issue15720_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue1578_negative_test.dart b/tests/language_strong/issue1578_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue1578_negative_test.dart
rename to tests/language_strong/issue1578_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue18628_1_test.dart b/tests/language_strong/issue18628_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue18628_1_test.dart
rename to tests/language_strong/issue18628_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue18628_2_test.dart b/tests/language_strong/issue18628_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue18628_2_test.dart
rename to tests/language_strong/issue18628_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue20476_test.dart b/tests/language_strong/issue20476_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue20476_test.dart
rename to tests/language_strong/issue20476_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue21079_test.dart b/tests/language_strong/issue21079_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue21079_test.dart
rename to tests/language_strong/issue21079_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue21159_test.dart b/tests/language_strong/issue21159_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue21159_test.dart
rename to tests/language_strong/issue21159_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue21957_test.dart b/tests/language_strong/issue21957_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue21957_test.dart
rename to tests/language_strong/issue21957_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue22800_test.dart b/tests/language_strong/issue22800_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue22800_test.dart
rename to tests/language_strong/issue22800_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue23244_test.dart b/tests/language_strong/issue23244_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue23244_test.dart
rename to tests/language_strong/issue23244_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue3806_test.dart b/tests/language_strong/issue3806_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue3806_test.dart
rename to tests/language_strong/issue3806_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue4157508_test.dart b/tests/language_strong/issue4157508_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue4157508_test.dart
rename to tests/language_strong/issue4157508_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue4295001_test.dart b/tests/language_strong/issue4295001_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue4295001_test.dart
rename to tests/language_strong/issue4295001_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue4515170_test.dart b/tests/language_strong/issue4515170_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue4515170_test.dart
rename to tests/language_strong/issue4515170_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue7513_test.dart b/tests/language_strong/issue7513_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue7513_test.dart
rename to tests/language_strong/issue7513_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue7525_test.dart b/tests/language_strong/issue7525_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue7525_test.dart
rename to tests/language_strong/issue7525_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue9602_other.dart b/tests/language_strong/issue9602_other.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue9602_other.dart
rename to tests/language_strong/issue9602_other.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue9602_test.dart b/tests/language_strong/issue9602_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue9602_test.dart
rename to tests/language_strong/issue9602_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue9664_test.dart b/tests/language_strong/issue9664_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue9664_test.dart
rename to tests/language_strong/issue9664_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue9687_test.dart b/tests/language_strong/issue9687_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue9687_test.dart
rename to tests/language_strong/issue9687_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue9939_test.dart b/tests/language_strong/issue9939_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue9939_test.dart
rename to tests/language_strong/issue9939_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue9949_test.dart b/tests/language_strong/issue9949_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue9949_test.dart
rename to tests/language_strong/issue9949_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib1.dart b/tests/language_strong/issue_1751477_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib1.dart
rename to tests/language_strong/issue_1751477_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib11.dart b/tests/language_strong/issue_1751477_lib11.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib11.dart
rename to tests/language_strong/issue_1751477_lib11.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib2.dart b/tests/language_strong/issue_1751477_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib2.dart
rename to tests/language_strong/issue_1751477_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib21.dart b/tests/language_strong/issue_1751477_lib21.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib21.dart
rename to tests/language_strong/issue_1751477_lib21.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib3.dart b/tests/language_strong/issue_1751477_lib3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib3.dart
rename to tests/language_strong/issue_1751477_lib3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib31.dart b/tests/language_strong/issue_1751477_lib31.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib31.dart
rename to tests/language_strong/issue_1751477_lib31.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib4.dart b/tests/language_strong/issue_1751477_lib4.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib4.dart
rename to tests/language_strong/issue_1751477_lib4.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib41.dart b/tests/language_strong/issue_1751477_lib41.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib41.dart
rename to tests/language_strong/issue_1751477_lib41.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib5.dart b/tests/language_strong/issue_1751477_lib5.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib5.dart
rename to tests/language_strong/issue_1751477_lib5.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib51.dart b/tests/language_strong/issue_1751477_lib51.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib51.dart
rename to tests/language_strong/issue_1751477_lib51.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib6.dart b/tests/language_strong/issue_1751477_lib6.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib6.dart
rename to tests/language_strong/issue_1751477_lib6.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib61.dart b/tests/language_strong/issue_1751477_lib61.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib61.dart
rename to tests/language_strong/issue_1751477_lib61.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib7.dart b/tests/language_strong/issue_1751477_lib7.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib7.dart
rename to tests/language_strong/issue_1751477_lib7.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib71.dart b/tests/language_strong/issue_1751477_lib71.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib71.dart
rename to tests/language_strong/issue_1751477_lib71.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib8.dart b/tests/language_strong/issue_1751477_lib8.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib8.dart
rename to tests/language_strong/issue_1751477_lib8.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib81.dart b/tests/language_strong/issue_1751477_lib81.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib81.dart
rename to tests/language_strong/issue_1751477_lib81.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib9.dart b/tests/language_strong/issue_1751477_lib9.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib9.dart
rename to tests/language_strong/issue_1751477_lib9.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_lib91.dart b/tests/language_strong/issue_1751477_lib91.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_lib91.dart
rename to tests/language_strong/issue_1751477_lib91.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_1751477_test.dart b/tests/language_strong/issue_1751477_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_1751477_test.dart
rename to tests/language_strong/issue_1751477_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_22780_test.dart b/tests/language_strong/issue_22780_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_22780_test.dart
rename to tests/language_strong/issue_22780_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/issue_23914_test.dart b/tests/language_strong/issue_23914_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/issue_23914_test.dart
rename to tests/language_strong/issue_23914_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/js_properties_test.dart b/tests/language_strong/js_properties_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/js_properties_test.dart
rename to tests/language_strong/js_properties_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/keyword_type_expression_test.dart b/tests/language_strong/keyword_type_expression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/keyword_type_expression_test.dart
rename to tests/language_strong/keyword_type_expression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/label2_negative_test.dart b/tests/language_strong/label2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/label2_negative_test.dart
rename to tests/language_strong/label2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/label3_negative_test.dart b/tests/language_strong/label3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/label3_negative_test.dart
rename to tests/language_strong/label3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/label5_negative_test.dart b/tests/language_strong/label5_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/label5_negative_test.dart
rename to tests/language_strong/label5_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/label6_negative_test.dart b/tests/language_strong/label6_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/label6_negative_test.dart
rename to tests/language_strong/label6_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/label8_negative_test.dart b/tests/language_strong/label8_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/label8_negative_test.dart
rename to tests/language_strong/label8_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/label_test.dart b/tests/language_strong/label_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/label_test.dart
rename to tests/language_strong/label_test.dart
diff --git a/tests/language_strong/language_strong.status b/tests/language_strong/language_strong.status
new file mode 100644
index 0000000..dadc4a0
--- /dev/null
+++ b/tests/language_strong/language_strong.status
@@ -0,0 +1,682 @@
+# Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# Skip entire suite if not running in strong mode.
+[ $strong == false ]
+*: SkipByDesign
+
+# Skip tests that are not yet strong-mode clean.
+[ $strong == true ]
+abstract_exact_selector_test: Skip
+abstract_factory_constructor_test: Skip
+abstract_getter_test: Skip
+abstract_runtime_error_test: Skip
+abstract_syntax_test: Skip
+application_negative_test: Skip
+argument_definition_test: Skip
+arithmetic_test: Skip
+assign_instance_method_negative_test: Skip
+assign_static_type_test: Skip
+assign_to_type_test: Skip
+assign_top_method_test: Skip
+assignable_expression_test: Skip
+async_await_syntax_test: Skip
+async_or_generator_return_type_stacktrace_test: Skip
+async_return_types_test: Skip
+await_backwards_compatibility_test: Skip
+await_test: Skip
+bad_constructor_test: Skip
+bad_initializer1_negative_test: Skip
+bad_initializer2_negative_test: Skip
+bad_named_constructor_negative_test: Skip
+bad_named_parameters2_test: Skip
+bad_named_parameters_test: Skip
+bad_override_test: Skip
+black_listed_test: Skip
+body_less_constructor_wrong_arg_negative_test: Skip
+bool_check_test: Skip
+bound_closure_equality_test: Skip
+bound_closure_primitives_test: Skip
+built_in_identifier_illegal_test: Skip
+built_in_identifier_prefix_test: Skip
+call_constructor_on_unresolvable_class_test: Skip
+call_non_method_field_test: Skip
+call_nonexistent_constructor_test: Skip
+call_nonexistent_static_test: Skip
+call_test: Skip
+call_through_getter_test: Skip
+call_type_literal_test: Skip
+callable_test: Skip
+canonical_const3_test: Skip
+cascade_test: Skip
+cast_test: Skip
+check_member_static_test: Skip
+check_method_override_test: Skip
+checked_null_test: Skip
+checked_setter2_test: Skip
+checked_setter3_test: Skip
+checked_setter_test: Skip
+class_cycle2_test: Skip
+class_cycle_test: Skip
+class_keyword_test: Skip
+class_literal_test: Skip
+class_override_test: Skip
+class_syntax_test: Skip
+closure_in_initializer_test: Skip
+closure_internals_test: Skip
+closure_type_test: Skip
+closure_with_super_field_test: Skip
+compile_time_constant10_test: Skip
+compile_time_constant13_test: Skip
+compile_time_constant_arguments_test: Skip
+compile_time_constant_c_test: Skip
+compile_time_constant_checked2_test: Skip
+compile_time_constant_checked3_test: Skip
+compile_time_constant_checked4_test: Skip
+compile_time_constant_checked5_test: Skip
+compile_time_constant_checked_test: Skip
+compile_time_constant_e_test: Skip
+compile_time_constant_h_test: Skip
+compile_time_constant_k_test: Skip
+compile_time_constant_o_test: Skip
+compile_time_constant_p_test: Skip
+compile_time_constant_r_test: Skip
+compile_time_constant_test: Skip
+conditional_method_invocation_test: Skip
+conditional_property_access_test: Skip
+conditional_property_assignment_test: Skip
+conditional_property_increment_decrement_test: Skip
+const_conditional_test: Skip
+const_constructor2_test: Skip
+const_constructor3_test: Skip
+const_constructor_mixin2_test: Skip
+const_constructor_mixin3_test: Skip
+const_constructor_mixin_test: Skip
+const_constructor_nonconst_field_test: Skip
+const_constructor_super_test: Skip
+const_constructor_syntax_test: Skip
+const_constructor_test: Skip
+const_counter_negative_test: Skip
+const_dynamic_type_literal_test: Skip
+const_error_multiply_initialized_test: Skip
+const_factory_with_body_test: Skip
+const_init2_test: Skip
+const_instance_field_test: Skip
+const_list_test: Skip
+const_map2_test: Skip
+const_map3_test: Skip
+const_map4_test: Skip
+const_native_factory_test: Skip
+const_objects_are_immutable_test: Skip
+const_optional_args_negative_test: Skip
+const_redirecting_factory_test: Skip
+const_switch2_test: Skip
+const_syntax_test: Skip
+const_types_test: Skip
+constant_fold_equals_test: Skip
+constant_locals_test: Skip
+constructor10_test: Skip
+constructor2_test: Skip
+constructor3_negative_test: Skip
+constructor3_test: Skip
+constructor5_test: Skip
+constructor6_test: Skip
+constructor_call_as_function_test: Skip
+constructor_call_wrong_argument_count_negative_test: Skip
+constructor_duplicate_final_test: Skip
+constructor_duplicate_initializers_test: Skip
+constructor_initializer_test: Skip
+constructor_name_test: Skip
+constructor_named_arguments_test: Skip
+constructor_redirect1_negative_test: Skip
+constructor_redirect2_negative_test: Skip
+constructor_redirect2_test: Skip
+constructor_redirect_test: Skip
+constructor_return_test: Skip
+constructor_setter_negative_test: Skip
+constructor_test: Skip
+constructor_with_mixin_test: Skip
+crash_6725_test: Skip
+create_unresolved_type_test: Skip
+ct_const_test: Skip
+cyclic_class_member_test: Skip
+cyclic_constructor_test: Skip
+cyclic_default_values_test: Skip
+cyclic_import_test: Skip
+cyclic_type_variable_test: Skip
+cyclic_typedef_test: Skip
+default_factory2_test: Skip
+default_factory_library_test: Skip
+default_factory_test: Skip
+deferred_constraints_constants_test: Skip
+deferred_constraints_constants_test_default: Skip
+deferred_constraints_constants_test: Skip
+deferred_constraints_type_annotation_test_as: Skip
+deferred_constraints_type_annotation_test_catch: Skip
+deferred_constraints_type_annotation_test_is: Skip
+deferred_constraints_type_annotation_test_new_before: Skip
+deferred_constraints_type_annotation_test_new: Skip
+deferred_constraints_type_annotation_test_type: Skip
+deferred_constraints_type_annotation_test_type_annotation: Skip
+deferred_constraints_type_annotation_test_type_annotation_top: Skip
+deferred_duplicate_prefix1_test: Skip
+deferred_duplicate_prefix2_test: Skip
+deferred_duplicate_prefix3_test: Skip
+deferred_global_test: Skip
+deferred_inheritance_constraints_test: Skip
+deferred_inheritance_constraints_test_redirecting: Skip
+deferred_load_constants_test: Skip
+deferred_no_prefix_test: Skip
+deopt_inlined_function_test: Skip
+double_to_string_as_exponential2_test: Skip
+double_to_string_as_fixed2_test: Skip
+double_to_string_as_precision2_test: Skip
+duplicate_constructor_test: Skip
+duplicate_export_negative_test: Skip
+duplicate_implements_test: Skip
+duplicate_interface_negative_test: Skip
+dynamic2_test: Skip
+dynamic_field_test: Skip
+dynamic_prefix_core_test: Skip
+emit_const_fields_test: Skip
+empty_block_case_test: Skip
+enum_is_keyword_test: Skip
+enum_private_test: Skip
+enum_syntax_test: Skip
+error_stacktrace_test: Skip
+example_constructor_test: Skip
+export_ambiguous_main_negative_test: Skip
+extend_type_parameter2_negative_test: Skip
+extend_type_parameter_negative_test: Skip
+external_test: Skip
+f_bounded_quantification2_test: Skip
+f_bounded_quantification4_test: Skip
+f_bounded_quantification5_test: Skip
+f_bounded_quantification_test: Skip
+factory1_test: Skip
+factory2_negative_test: Skip
+factory2_test: Skip
+factory3_negative_test: Skip
+factory3_test: Skip
+factory4_test: Skip
+factory5_test: Skip
+factory_implementation_test: Skip
+factory_negative_test: Skip
+factory_redirection2_test: Skip
+factory_redirection3_cyclic_test: Skip
+factory_redirection_test: Skip
+factory_return_type_checked_test: Skip
+fauxverride_test: Skip
+field1_negative_test: Skip
+field2_negative_test: Skip
+field3_negative_test: Skip
+field4_negative_test: Skip
+field5_negative_test: Skip
+field6_negative_test: Skip
+field6a_negative_test: Skip
+field_decl_missing_var_type_test: Skip
+field_initialization_order_test: Skip
+field_method4_negative_test: Skip
+field_override2_test: Skip
+field_override3_test: Skip
+field_override4_test: Skip
+field_override_test: Skip
+field_test: Skip
+field_type_check_test: Skip
+final_field_initialization_order_test: Skip
+final_for_in_variable_test: Skip
+final_is_not_const_test: Skip
+final_param_test: Skip
+final_super_field_set_test: Skip
+final_syntax_test: Skip
+final_variable_assignment_test: Skip
+first_class_types_literals_test: Skip
+for_in_side_effects_test: Skip
+function_literals2_test: Skip
+function_literals_test: Skip
+function_malformed_result_type_test: Skip
+function_subtype_bound_closure7_test: Skip
+function_subtype_checked0_test: Skip
+function_subtype_closure0_test: Skip
+function_subtype_closure1_test: Skip
+function_subtype_factory1_test: Skip
+function_subtype_inline1_test: Skip
+function_subtype_inline2_test: Skip
+function_subtype_setter0_test: Skip
+function_syntax_test: Skip
+function_test: Skip
+function_type2_test: Skip
+function_type_alias5_test: Skip
+function_type_alias6_test: Skip
+function_type_alias7_test: Skip
+function_type_alias9_test: Skip
+function_type_alias_test: Skip
+function_type_call_getter2_test: Skip
+function_type_parameter2_negative_test: Skip
+function_type_parameter_negative_test: Skip
+function_type_test: Skip
+generic_closure_test: Skip
+generic_constructor_mixin2_test: Skip
+generic_constructor_mixin3_test: Skip
+generic_constructor_mixin_test: Skip
+generic_field_mixin6_test: Skip
+generic_list_checked_test: Skip
+generic_tearoff_test: Skip
+generic_test: Skip
+generics_test: Skip
+get_set_syntax_test: Skip
+getter_declaration_negative_test: Skip
+getter_no_setter2_test: Skip
+getter_no_setter_test: Skip
+getter_override2_test: Skip
+getter_override_test: Skip
+getter_parameters_test: Skip
+getter_setter_in_lib_test: Skip
+getters_setters2_test: Skip
+getters_setters_test: Skip
+hidden_import_test: Skip
+identical_const_test: Skip
+if_null_assignment_behavior_test: Skip
+if_null_assignment_static_test: Skip
+if_null_behavior_test: Skip
+if_null_precedence_test: Skip
+illegal_declaration_test: Skip
+illegal_initializer_test: Skip
+illegal_invocation_test: Skip
+implicit_this_test: Skip
+implied_interface_test: Skip
+import_combinators_negative_test: Skip
+import_combinators_test: Skip
+import_core_prefix_test: Skip
+import_self_test: Skip
+inference_captured_variable2_test: Skip
+inference_captured_variable_test: Skip
+inferrer_constructor5_test: Skip
+inferrer_this_access_test: Skip
+initializing_formal_type_test: Skip
+inline_effect_context_test: Skip
+inline_in_for_initializer_and_bailout_test: Skip
+inline_test_context_test: Skip
+inline_value_context_test: Skip
+inlined_throw_test: Skip
+inst_field_initializer1_negative_test: Skip
+instance_call_wrong_argument_count_negative_test: Skip
+instance_method2_negative_test: Skip
+instance_method_negative_test: Skip
+instanceof3_test: Skip
+instantiate_type_variable_test: Skip
+interceptor2_test: Skip
+interceptor3_test: Skip
+interceptor6_test: Skip
+interceptor7_test: Skip
+interceptor_test: Skip
+interface2_negative_test: Skip
+interface_cycle_test: Skip
+interface_injection1_negative_test: Skip
+interface_injection2_negative_test: Skip
+interface_static_method_negative_test: Skip
+interface_static_non_final_fields_negative_test: Skip
+interface_test: Skip
+invocation_mirror2_test: Skip
+invocation_mirror_invoke_on2_test: Skip
+invocation_mirror_invoke_on_test: Skip
+invocation_mirror_test: Skip
+is_function_test: Skip
+is_malformed_type_test: Skip
+is_not_class1_negative_test: Skip
+is_not_class2_test: Skip
+is_not_class4_negative_test: Skip
+is_object_test: Skip
+isnot_malformed_type_test: Skip
+issue11724_test: Skip
+issue11793_test: Skip
+issue13474_test: Skip
+issue1363_test: Skip
+issue15606_test: Skip
+issue1578_negative_test: Skip
+issue18628_1_test: Skip
+issue18628_2_test: Skip
+issue21159_test: Skip
+issue3806_test: Skip
+keyword_type_expression_test: Skip
+label2_negative_test: Skip
+label3_negative_test: Skip
+label5_negative_test: Skip
+label6_negative_test: Skip
+label8_negative_test: Skip
+label_test: Skip
+least_upper_bound_expansive_test: Skip
+least_upper_bound_test: Skip
+library_ambiguous_test: Skip
+library_negative_test: Skip
+list_double_index_in_loop2_test: Skip
+list_double_index_in_loop_test: Skip
+list_literal1_test: Skip
+list_literal2_negative_test: Skip
+list_literal4_test: Skip
+list_literal_negative_test: Skip
+list_literal_syntax_test: Skip
+list_literal_test: Skip
+list_test: Skip
+literal_unary_plus_test: Skip
+local_function2_test: Skip
+local_function3_test: Skip
+local_function_test: Skip
+logical_expression3_test: Skip
+malbounded_instantiation_test: Skip
+malbounded_redirecting_factory2_test: Skip
+malbounded_redirecting_factory_test: Skip
+malbounded_type_cast2_test: Skip
+malbounded_type_cast_test: Skip
+malbounded_type_literal_test: Skip
+malbounded_type_test2_test: Skip
+malbounded_type_test_test: Skip
+malformed2_test: Skip
+malformed_bound_test: Skip
+malformed_inheritance_test: Skip
+malformed_test: Skip
+malformed_type_test: Skip
+many_overridden_no_such_method_test: Skip
+map_literal1_test: Skip
+map_literal2_negative_test: Skip
+map_literal3_test: Skip
+map_literal4_test: Skip
+map_literal6_test: Skip
+map_literal8_test: Skip
+map_literal_negative_test: Skip
+metadata_test: Skip
+method_override2_test: Skip
+method_override3_test: Skip
+method_override4_test: Skip
+method_override5_test: Skip
+method_override6_test: Skip
+method_override7_test: Skip
+method_override8_test: Skip
+method_override_test: Skip
+minify_closure_variable_collision_test: Skip
+missing_const_constructor_test: Skip
+missing_part_of_tag_test: Skip
+mixin_black_listed_test: Skip
+mixin_cyclic_test: Skip
+mixin_extends_field_test: Skip
+mixin_extends_method_test: Skip
+mixin_field_test: Skip
+mixin_forwarding_constructor4_test: Skip
+mixin_illegal_constructor_test: Skip
+mixin_illegal_cycles_test: Skip
+mixin_illegal_object_test: Skip
+mixin_illegal_static_access_test: Skip
+mixin_illegal_super_use_test: Skip
+mixin_illegal_superclass_test: Skip
+mixin_illegal_syntax_test: Skip
+mixin_invalid_bound2_test: Skip
+mixin_invalid_bound_test: Skip
+mixin_invalid_inheritance1_test: Skip
+mixin_invalid_inheritance2_test: Skip
+mixin_lib_extends_field_test: Skip
+mixin_lib_extends_method_test: Skip
+mixin_method_test: Skip
+mixin_super_bound2_test: Skip
+mixin_super_bound_test: Skip
+mixin_super_constructor2_test: Skip
+mixin_super_constructor_default_test: Skip
+mixin_super_constructor_named_test: Skip
+mixin_super_constructor_positionals_test: Skip
+mixin_super_constructor_test: Skip
+mixin_super_test: Skip
+mixin_type_parameter4_test: Skip
+mixin_type_parameters_errors_test: Skip
+mixin_type_parameters_mixin_extends_test: Skip
+mixin_type_parameters_mixin_test: Skip
+mixin_type_parameters_simple_test: Skip
+mixin_type_parameters_super_extends_test: Skip
+mixin_type_parameters_super_test: Skip
+mixin_with_two_implicit_constructors_test: Skip
+multiline_newline_test: Skip
+named_constructor_test: Skip
+named_parameters2_test: Skip
+named_parameters3_test: Skip
+named_parameters4_test: Skip
+named_parameters_aggregated_test: Skip
+named_parameters_test: Skip
+named_parameters_type_test: Skip
+naming3_test: Skip
+naming_test: Skip
+new_expression1_negative_test: Skip
+new_expression2_negative_test: Skip
+new_expression3_negative_test: Skip
+new_expression_type_args_test: Skip
+new_prefix_test: Skip
+no_such_constructor2_test: Skip
+no_such_constructor_test: Skip
+no_such_method2_test: Skip
+no_such_method_dispatcher_test: Skip
+no_such_method_empty_selector_test: Skip
+no_such_method_mock_test: Skip
+no_such_method_negative_test: Skip
+no_such_method_test: Skip
+non_const_super_negative_test: Skip
+non_parameterized_factory2_test: Skip
+non_parameterized_factory_test: Skip
+not_enough_positional_arguments_test: Skip
+null_test: Skip
+number_identifier_test: Skip
+number_identity_test: Skip
+on_catch_malformed_type_test: Skip
+operator1_negative_test: Skip
+operator2_negative_test: Skip
+operator5_test: Skip
+operator_equals_test: Skip
+operator_test: Skip
+optimized_constant_array_string_access_test: Skip
+optional_named_parameters_test: Skip
+overridden_no_such_method_test: Skip
+override_field_method1_negative_test: Skip
+override_field_method2_negative_test: Skip
+override_field_method4_negative_test: Skip
+override_field_method5_negative_test: Skip
+override_field_test: Skip
+override_inheritance_abstract_test: Skip
+override_inheritance_field_test: Skip
+override_inheritance_generic_test: Skip
+override_inheritance_method_test: Skip
+override_inheritance_mixed_test: Skip
+override_inheritance_no_such_method_test: Skip
+override_method_with_field_test: Skip
+parameter_default_test: Skip
+parameter_initializer1_negative_test: Skip
+parameter_initializer2_negative_test: Skip
+parameter_initializer3_negative_test: Skip
+parameter_initializer4_negative_test: Skip
+parameter_initializer6_negative_test: Skip
+parameter_initializer_test: Skip
+parser_quirks_test: Skip
+part2_test: Skip
+positional_parameters_type_test: Skip
+prefix11_negative_test: Skip
+prefix12_negative_test: Skip
+prefix13_negative_test: Skip
+prefix14_test: Skip
+prefix15_negative_test: Skip
+prefix15_test: Skip
+prefix16_test: Skip
+prefix18_negative_test: Skip
+prefix1_negative_test: Skip
+prefix22_test: Skip
+prefix23_test: Skip
+prefix2_negative_test: Skip
+prefix3_negative_test: Skip
+prefix4_negative_test: Skip
+prefix5_negative_test: Skip
+prefix6_negative_test: Skip
+prefix7_negative_test: Skip
+prefix8_negative_test: Skip
+prefix_assignment_test: Skip
+prefix_identifier_reference_test: Skip
+prefix_unqualified_invocation_test: Skip
+private3_test: Skip
+private_access_test: Skip
+private_member1_negative_test: Skip
+private_member2_negative_test: Skip
+private_member3_negative_test: Skip
+private_mixin2_test: Skip
+private_test: Skip
+propagated_argument_type_check_test: Skip
+property_field_override_test: Skip
+proxy2_test: Skip
+proxy3_test: Skip
+proxy_test: Skip
+redirecting_constructor_initializer_test: Skip
+redirecting_factory_default_values_test: Skip
+redirecting_factory_incompatible_signature_test: Skip
+redirecting_factory_infinite_steps_test: Skip
+redirecting_factory_long_test: Skip
+redirecting_factory_malbounded_test: Skip
+ref_before_declaration_test: Skip
+regress_12561_test: Skip
+regress_13494_test: Skip
+regress_14348_test: Skip
+regress_17382_test: Skip
+regress_19413_test: Skip
+regress_19728_test: Skip
+regress_20394_test: Skip
+regress_21793_test: Skip
+regress_21912_test: Skip
+regress_22438_test: Skip
+regress_22936_test: Skip
+regress_23038_test: Skip
+regress_23051_test: Skip
+regress_23408_test: Skip
+return_type_test: Skip
+rewrite_implicit_this_test: Skip
+scope_variable_test: Skip
+script1_negative_test: Skip
+script2_negative_test: Skip
+setter4_test: Skip
+setter_declaration2_negative_test: Skip
+setter_declaration_negative_test: Skip
+setter_no_getter_call_test: Skip
+setter_override2_test: Skip
+setter_override_test: Skip
+source_self_negative_test: Skip
+static_call_wrong_argument_count_negative_test: Skip
+static_field1_test: Skip
+static_field1a_test: Skip
+static_field2_test: Skip
+static_field2a_test: Skip
+static_field3_test: Skip
+static_field_test: Skip
+static_final_field2_test: Skip
+static_getter_no_setter1_test: Skip
+static_getter_no_setter2_test: Skip
+static_getter_no_setter3_test: Skip
+static_initializer_type_error_test: Skip
+static_parameter_test: Skip
+static_setter_get_test: Skip
+static_top_level_test: Skip
+string_escape4_negative_test: Skip
+string_interpolate1_negative_test: Skip
+string_interpolate2_negative_test: Skip
+string_interpolate_test: Skip
+string_interpolation1_negative_test: Skip
+string_interpolation2_negative_test: Skip
+string_interpolation3_negative_test: Skip
+string_interpolation4_negative_test: Skip
+string_interpolation5_negative_test: Skip
+string_interpolation6_negative_test: Skip
+string_interpolation9_test: Skip
+string_interpolation_and_buffer_test: Skip
+string_interpolation_test: Skip
+string_no_operator_test: Skip
+string_split_test: Skip
+string_supertype_checked_test: Skip
+string_test: Skip
+string_unicode1_negative_test: Skip
+string_unicode2_negative_test: Skip
+string_unicode3_negative_test: Skip
+string_unicode4_negative_test: Skip
+substring_test: Skip
+super_assign_test: Skip
+super_bound_closure_test: Skip
+super_call3_test: Skip
+super_call4_test: Skip
+super_conditional_operator_test: Skip
+super_field_2_test: Skip
+super_field_access_test: Skip
+super_field_test: Skip
+super_first_constructor_test: Skip
+super_getter_setter_test: Skip
+super_operator_index5_test: Skip
+super_operator_index6_test: Skip
+super_operator_index7_test: Skip
+super_operator_index8_test: Skip
+super_operator_index_test: Skip
+super_operator_test: Skip
+super_test: Skip
+switch1_negative_test: Skip
+switch3_negative_test: Skip
+switch4_negative_test: Skip
+switch5_negative_test: Skip
+switch7_negative_test: Skip
+switch_bad_case_test: Skip
+switch_case_test: Skip
+switch_fallthru_test: Skip
+symbol_conflict_test: Skip
+symbol_literal_test: Skip
+sync_generator1_test: Skip
+sync_generator2_test: Skip
+syntax_test: Skip
+test_negative_test: Skip
+third_test: Skip
+this_conditional_operator_test: Skip
+this_test: Skip
+throw_expr_test: Skip
+top_level_getter_no_setter1_test: Skip
+top_level_getter_no_setter2_test: Skip
+toplevel_collision1_test: Skip
+toplevel_collision2_test: Skip
+transitive_private_library_access_test: Skip
+try_catch_on_syntax_test: Skip
+try_catch_syntax_test: Skip
+try_catch_test: Skip
+type_argument_in_super_type_test: Skip
+type_check_const_function_typedef2_test: Skip
+type_checks_in_factory_method_test: Skip
+type_literal_prefix_call_test: Skip
+type_parameter_test: Skip
+type_promotion_assign_test: Skip
+type_promotion_closure_test: Skip
+type_promotion_functions_test: Skip
+type_promotion_local_test: Skip
+type_promotion_logical_and_test: Skip
+type_promotion_more_specific_test: Skip
+type_promotion_multiple_test: Skip
+type_promotion_parameter_test: Skip
+type_variable_bounds2_test: Skip
+type_variable_bounds3_test: Skip
+type_variable_bounds4_test: Skip
+type_variable_bounds_test: Skip
+type_variable_conflict2_test: Skip
+type_variable_conflict_test: Skip
+type_variable_function_type_test: Skip
+type_variable_identifier_expression_test: Skip
+type_variable_scope2_test: Skip
+type_variable_scope3_test: Skip
+type_variable_scope_test: Skip
+type_variable_static_context_negative_test: Skip
+typed_selector2_test: Skip
+typevariable_substitution2_test: Skip
+unary_plus_negative_test: Skip
+unbalanced_brace_test: Skip
+unbound_getter_test: Skip
+unhandled_exception_negative_test: Skip
+unresolved_default_constructor_test: Skip
+unresolved_in_factory_negative_test: Skip
+unresolved_top_level_method_negative_test: Skip
+unresolved_top_level_var_negative_test: Skip
+unsigned_right_shift_test: Skip
+unsupported_operators_test: Skip
+variable_declaration_metadata_test: Skip
+void_type_test: Skip
+wrong_number_type_arguments_test: Skip
diff --git a/tests/language_strong/language_strong_kernel.status b/tests/language_strong/language_strong_kernel.status
new file mode 100644
index 0000000..559b419
--- /dev/null
+++ b/tests/language_strong/language_strong_kernel.status
@@ -0,0 +1,167 @@
+# Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+[ $compiler == dartk && $runtime == vm ]
+arithmetic2_test: RuntimeError # Throws CastError instead of TypeError
+assertion_test: RuntimeError
+async_await_test/02: DartkCompileTimeError
+async_await_test/03: DartkCompileTimeError
+async_await_test/none: DartkCompileTimeError
+async_star_cancel_and_throw_in_finally_test: RuntimeError
+async_star_cancel_while_paused_test: RuntimeError
+async_star_regression_fisk_test: Timeout
+async_star_stream_take_test: Timeout
+async_star_take_reyield_test: Timeout
+async_star_test/01: DartkCompileTimeError
+async_star_test/02: DartkCompileTimeError
+async_star_test/03: DartkCompileTimeError
+async_star_test/04: DartkCompileTimeError
+async_star_test/05: DartkCompileTimeError
+async_star_test/none: DartkCompileTimeError
+asyncstar_throw_in_catch_test: Timeout
+asyncstar_yield_test: Timeout
+asyncstar_yieldstar_test: Timeout
+await_in_cascade_test: RuntimeError
+bad_raw_string_negative_test: Fail
+bool_test: RuntimeError # Throws CastError instead of TypeError
+cha_deopt1_test: RuntimeError
+cha_deopt2_test: RuntimeError
+cha_deopt3_test: RuntimeError
+closure_type_variable_test: RuntimeError
+closures_initializer_test: RuntimeError
+compile_time_constant12_test: Crash
+conditional_import_string_test: DartkCompileTimeError
+conditional_import_test: DartkCompileTimeError
+const_evaluation_test/01: RuntimeError
+const_locals_test: RuntimeError
+const_nested_test: RuntimeError
+const_string_test: RuntimeError
+covariant_override/runtime_check_test: RuntimeError
+custom_await_stack_trace_test: RuntimeError
+cyclic_type2_test: CompileTimeError
+cyclic_type_test/00: RuntimeError
+cyclic_type_test/01: RuntimeError
+cyclic_type_test/02: CompileTimeError
+cyclic_type_test/03: RuntimeError
+cyclic_type_test/04: CompileTimeError
+deferred_call_empty_before_load_test: RuntimeError
+deferred_closurize_load_library_test: DartkCrash
+deferred_constant_list_test: RuntimeError
+deferred_constraints_type_annotation_test/as_operation: RuntimeError
+deferred_constraints_type_annotation_test/catch_check: RuntimeError
+deferred_constraints_type_annotation_test/is_check: RuntimeError
+deferred_constraints_type_annotation_test/new: RuntimeError
+deferred_constraints_type_annotation_test/new_before_load: RuntimeError
+deferred_constraints_type_annotation_test/new_generic1: RuntimeError
+deferred_constraints_type_annotation_test/new_generic2: RuntimeError
+deferred_constraints_type_annotation_test/new_generic3: RuntimeError
+deferred_constraints_type_annotation_test/none: RuntimeError
+deferred_constraints_type_annotation_test/static_method: RuntimeError
+deferred_constraints_type_annotation_test/type_annotation1: RuntimeError
+deferred_constraints_type_annotation_test/type_annotation_generic1: RuntimeError
+deferred_constraints_type_annotation_test/type_annotation_generic2: RuntimeError
+deferred_constraints_type_annotation_test/type_annotation_generic3: RuntimeError
+deferred_constraints_type_annotation_test/type_annotation_generic4: RuntimeError
+deferred_constraints_type_annotation_test/type_annotation_non_deferred: RuntimeError
+deferred_constraints_type_annotation_test/type_annotation_null: RuntimeError
+deferred_constraints_type_annotation_test/type_annotation_top_level: RuntimeError
+deferred_function_type_test: RuntimeError
+deferred_inlined_test: RuntimeError
+deferred_load_inval_code_test: RuntimeError
+deferred_load_library_wrong_args_test/none: RuntimeError
+deferred_mixin_test: RuntimeError
+deferred_no_such_method_test: RuntimeError
+deferred_not_loaded_check_test: RuntimeError
+deferred_only_constant_test: RuntimeError
+deferred_optimized_test: RuntimeError
+deferred_redirecting_factory_test: RuntimeError
+deferred_regression_22995_test: RuntimeError
+deferred_shadow_load_library_test: RuntimeError
+deferred_shared_and_unshared_classes_test: RuntimeError
+deferred_static_seperate_test: RuntimeError
+deferred_type_dependency_test/as: RuntimeError
+deferred_type_dependency_test/is: RuntimeError
+deferred_type_dependency_test/none: RuntimeError
+deferred_type_dependency_test/type_annotation: RuntimeError
+enum_duplicate_test/01: RuntimeError
+enum_duplicate_test/02: RuntimeError
+enum_duplicate_test/none: RuntimeError
+enum_mirror_test: RuntimeError
+enum_test: RuntimeError
+evaluation_redirecting_constructor_test: RuntimeError
+export_double_same_main_test: DartkCrash
+export_main_test: DartkCrash
+f_bounded_equality_test: RuntimeError
+first_class_types_test: RuntimeError
+fixed_type_variable2_test/02: RuntimeError
+fixed_type_variable2_test/04: RuntimeError
+fixed_type_variable2_test/06: RuntimeError
+fixed_type_variable_test/01: RuntimeError
+fixed_type_variable_test/02: RuntimeError
+fixed_type_variable_test/03: RuntimeError
+fixed_type_variable_test/04: RuntimeError
+fixed_type_variable_test/05: RuntimeError
+fixed_type_variable_test/06: RuntimeError
+flatten_test/05: MissingRuntimeError
+flatten_test/08: MissingRuntimeError
+flatten_test/09: MissingRuntimeError
+flatten_test/12: MissingRuntimeError
+for2_test: RuntimeError
+for_variable_capture_test: RuntimeError
+function_subtype2_test: RuntimeError
+function_subtype_bound_closure3_test: RuntimeError
+function_subtype_bound_closure4_test: RuntimeError
+function_subtype_cast1_test: RuntimeError
+function_subtype_inline0_test: RuntimeError
+function_subtype_local3_test: RuntimeError
+function_subtype_local4_test: RuntimeError
+function_subtype_not1_test: RuntimeError
+function_subtype_regression_ddc_588_test: RuntimeError
+function_type_alias2_test: RuntimeError
+function_type_alias3_test: RuntimeError
+function_type_alias4_test: RuntimeError
+generic2_test: RuntimeError
+generic_creation_test: RuntimeError
+generic_field_mixin2_test: RuntimeError
+generic_field_mixin4_test: DartkCompileTimeError
+generic_field_mixin5_test: DartkCompileTimeError
+generic_inheritance_test: RuntimeError
+generic_tearoff_test: Crash
+getter_closure_execution_order_test: RuntimeError
+if_null_evaluation_order_test: Crash # VM does not support BottomType
+inferrer_closure_test: RuntimeError
+initializing_formal_final_test: RuntimeError
+instance_creation_in_function_annotation_test: RuntimeError
+instanceof4_test/01: RuntimeError
+instanceof4_test/none: RuntimeError
+issue_1751477_test: RuntimeError
+lazy_static7_test: DartkCompileTimeError
+main_not_a_function_test/01: DartkCrash
+many_named_arguments_test: DartkCompileTimeError
+map_literal11_test: RuntimeError
+map_literal7_test: RuntimeError
+mixin_generic_test: RuntimeError
+mixin_mixin2_test: RuntimeError
+mixin_mixin3_test: RuntimeError
+mixin_mixin4_test: RuntimeError
+mixin_mixin5_test: RuntimeError
+mixin_mixin_bound2_test: RuntimeError
+mixin_mixin_bound_test: RuntimeError
+no_main_test/01: DartkCrash
+operator4_test: RuntimeError # Throws CastError instead of TypeError
+prefix10_negative_test: Fail
+prefix21_test: RuntimeError
+recursive_generic_test: RuntimeError
+redirecting_factory_reflection_test: RuntimeError
+regress_22443_test: RuntimeError
+regress_22700_test: RuntimeError
+regress_r24720_test: RuntimeError
+reify_typevar_static_test/00: MissingCompileTimeError
+reify_typevar_test: RuntimeError
+setter_no_getter_test/01: Crash # VM does not support BottomType
+switch_try_catch_test: RuntimeError
+sync_generator3_test/test2: RuntimeError
+type_error_test: RuntimeError # Throws CastError instead of TypeError
+type_literal_test: RuntimeError
+type_parameter_literal_test: RuntimeError
diff --git a/pkg/dev_compiler/test/codegen/language/large_class_declaration_test.dart b/tests/language_strong/large_class_declaration_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/large_class_declaration_test.dart
rename to tests/language_strong/large_class_declaration_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/large_implicit_getter_test.dart b/tests/language_strong/large_implicit_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/large_implicit_getter_test.dart
rename to tests/language_strong/large_implicit_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/larger_implicit_getter_test.dart b/tests/language_strong/larger_implicit_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/larger_implicit_getter_test.dart
rename to tests/language_strong/larger_implicit_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/lazy_map_test.dart b/tests/language_strong/lazy_map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/lazy_map_test.dart
rename to tests/language_strong/lazy_map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/lazy_static2_test.dart b/tests/language_strong/lazy_static2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/lazy_static2_test.dart
rename to tests/language_strong/lazy_static2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/lazy_static3_test.dart b/tests/language_strong/lazy_static3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/lazy_static3_test.dart
rename to tests/language_strong/lazy_static3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/lazy_static4_test.dart b/tests/language_strong/lazy_static4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/lazy_static4_test.dart
rename to tests/language_strong/lazy_static4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/lazy_static5_test.dart b/tests/language_strong/lazy_static5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/lazy_static5_test.dart
rename to tests/language_strong/lazy_static5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/lazy_static6_src.dart b/tests/language_strong/lazy_static6_src.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/lazy_static6_src.dart
rename to tests/language_strong/lazy_static6_src.dart
diff --git a/pkg/dev_compiler/test/codegen/language/lazy_static6_test.dart b/tests/language_strong/lazy_static6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/lazy_static6_test.dart
rename to tests/language_strong/lazy_static6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/lazy_static7_test.dart b/tests/language_strong/lazy_static7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/lazy_static7_test.dart
rename to tests/language_strong/lazy_static7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/lazy_static_test.dart b/tests/language_strong/lazy_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/lazy_static_test.dart
rename to tests/language_strong/lazy_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/least_upper_bound_expansive_test.dart b/tests/language_strong/least_upper_bound_expansive_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/least_upper_bound_expansive_test.dart
rename to tests/language_strong/least_upper_bound_expansive_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/least_upper_bound_test.dart b/tests/language_strong/least_upper_bound_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/least_upper_bound_test.dart
rename to tests/language_strong/least_upper_bound_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/left_shift_test.dart b/tests/language_strong/left_shift_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/left_shift_test.dart
rename to tests/language_strong/left_shift_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library1.dart b/tests/language_strong/library1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library1.dart
rename to tests/language_strong/library1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library10.dart b/tests/language_strong/library10.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library10.dart
rename to tests/language_strong/library10.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library11.dart b/tests/language_strong/library11.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library11.dart
rename to tests/language_strong/library11.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library12.dart b/tests/language_strong/library12.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library12.dart
rename to tests/language_strong/library12.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library1_lib.dart b/tests/language_strong/library1_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library1_lib.dart
rename to tests/language_strong/library1_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library1_lib.lib b/tests/language_strong/library1_lib.lib
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library1_lib.lib
rename to tests/language_strong/library1_lib.lib
diff --git a/pkg/dev_compiler/test/codegen/language/library1_test.dart b/tests/language_strong/library1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library1_test.dart
rename to tests/language_strong/library1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library2.dart b/tests/language_strong/library2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library2.dart
rename to tests/language_strong/library2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library3.dart b/tests/language_strong/library3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library3.dart
rename to tests/language_strong/library3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library4.dart b/tests/language_strong/library4.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library4.dart
rename to tests/language_strong/library4.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library5_test.dart b/tests/language_strong/library5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library5_test.dart
rename to tests/language_strong/library5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library5a.dart b/tests/language_strong/library5a.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library5a.dart
rename to tests/language_strong/library5a.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library5b.dart b/tests/language_strong/library5b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library5b.dart
rename to tests/language_strong/library5b.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library6.dart b/tests/language_strong/library6.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library6.dart
rename to tests/language_strong/library6.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_a.dart b/tests/language_strong/library_a.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_a.dart
rename to tests/language_strong/library_a.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_ambiguous_test.dart b/tests/language_strong/library_ambiguous_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_ambiguous_test.dart
rename to tests/language_strong/library_ambiguous_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_b.dart b/tests/language_strong/library_b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_b.dart
rename to tests/language_strong/library_b.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_c.dart b/tests/language_strong/library_c.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_c.dart
rename to tests/language_strong/library_c.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_d.dart b/tests/language_strong/library_d.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_d.dart
rename to tests/language_strong/library_d.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_e.dart b/tests/language_strong/library_e.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_e.dart
rename to tests/language_strong/library_e.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_f.dart b/tests/language_strong/library_f.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_f.dart
rename to tests/language_strong/library_f.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_juxtaposition_lib.dart b/tests/language_strong/library_juxtaposition_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_juxtaposition_lib.dart
rename to tests/language_strong/library_juxtaposition_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_juxtaposition_part.dart b/tests/language_strong/library_juxtaposition_part.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_juxtaposition_part.dart
rename to tests/language_strong/library_juxtaposition_part.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_juxtaposition_test.dart b/tests/language_strong/library_juxtaposition_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_juxtaposition_test.dart
rename to tests/language_strong/library_juxtaposition_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_negative_test.dart b/tests/language_strong/library_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_negative_test.dart
rename to tests/language_strong/library_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_prefixes.dart b/tests/language_strong/library_prefixes.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_prefixes.dart
rename to tests/language_strong/library_prefixes.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_prefixes.lib b/tests/language_strong/library_prefixes.lib
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_prefixes.lib
rename to tests/language_strong/library_prefixes.lib
diff --git a/pkg/dev_compiler/test/codegen/language/library_prefixes_test.dart b/tests/language_strong/library_prefixes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_prefixes_test.dart
rename to tests/language_strong/library_prefixes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_prefixes_test1.dart b/tests/language_strong/library_prefixes_test1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_prefixes_test1.dart
rename to tests/language_strong/library_prefixes_test1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_prefixes_test1.lib b/tests/language_strong/library_prefixes_test1.lib
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_prefixes_test1.lib
rename to tests/language_strong/library_prefixes_test1.lib
diff --git a/pkg/dev_compiler/test/codegen/language/library_prefixes_test2.dart b/tests/language_strong/library_prefixes_test2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_prefixes_test2.dart
rename to tests/language_strong/library_prefixes_test2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_prefixes_test2.lib b/tests/language_strong/library_prefixes_test2.lib
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_prefixes_test2.lib
rename to tests/language_strong/library_prefixes_test2.lib
diff --git a/pkg/dev_compiler/test/codegen/language/library_private_in_constructor_a.dart b/tests/language_strong/library_private_in_constructor_a.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_private_in_constructor_a.dart
rename to tests/language_strong/library_private_in_constructor_a.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_private_in_constructor_b.dart b/tests/language_strong/library_private_in_constructor_b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_private_in_constructor_b.dart
rename to tests/language_strong/library_private_in_constructor_b.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_private_in_constructor_test.dart b/tests/language_strong/library_private_in_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_private_in_constructor_test.dart
rename to tests/language_strong/library_private_in_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_same_name_used_lib1.dart b/tests/language_strong/library_same_name_used_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_same_name_used_lib1.dart
rename to tests/language_strong/library_same_name_used_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_same_name_used_lib2.dart b/tests/language_strong/library_same_name_used_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_same_name_used_lib2.dart
rename to tests/language_strong/library_same_name_used_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/library_same_name_used_test.dart b/tests/language_strong/library_same_name_used_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/library_same_name_used_test.dart
rename to tests/language_strong/library_same_name_used_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/licm2_test.dart b/tests/language_strong/licm2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/licm2_test.dart
rename to tests/language_strong/licm2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/licm3_test.dart b/tests/language_strong/licm3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/licm3_test.dart
rename to tests/language_strong/licm3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/licm_test.dart b/tests/language_strong/licm_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/licm_test.dart
rename to tests/language_strong/licm_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_double_index_in_loop2_test.dart b/tests/language_strong/list_double_index_in_loop2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_double_index_in_loop2_test.dart
rename to tests/language_strong/list_double_index_in_loop2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_double_index_in_loop_test.dart b/tests/language_strong/list_double_index_in_loop_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_double_index_in_loop_test.dart
rename to tests/language_strong/list_double_index_in_loop_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_in_closure_test.dart b/tests/language_strong/list_in_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_in_closure_test.dart
rename to tests/language_strong/list_in_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_is_test.dart b/tests/language_strong/list_is_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_is_test.dart
rename to tests/language_strong/list_is_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_length_tracer_test.dart b/tests/language_strong/list_length_tracer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_length_tracer_test.dart
rename to tests/language_strong/list_length_tracer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_literal1_test.dart b/tests/language_strong/list_literal1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_literal1_test.dart
rename to tests/language_strong/list_literal1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_literal2_negative_test.dart b/tests/language_strong/list_literal2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_literal2_negative_test.dart
rename to tests/language_strong/list_literal2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_literal2_test.dart b/tests/language_strong/list_literal2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_literal2_test.dart
rename to tests/language_strong/list_literal2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_literal3_test.dart b/tests/language_strong/list_literal3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_literal3_test.dart
rename to tests/language_strong/list_literal3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_literal4_test.dart b/tests/language_strong/list_literal4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_literal4_test.dart
rename to tests/language_strong/list_literal4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_literal_negative_test.dart b/tests/language_strong/list_literal_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_literal_negative_test.dart
rename to tests/language_strong/list_literal_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_literal_syntax_test.dart b/tests/language_strong/list_literal_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_literal_syntax_test.dart
rename to tests/language_strong/list_literal_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_literal_test.dart b/tests/language_strong/list_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_literal_test.dart
rename to tests/language_strong/list_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_mixin_test.dart b/tests/language_strong/list_mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_mixin_test.dart
rename to tests/language_strong/list_mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_test.dart b/tests/language_strong/list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_test.dart
rename to tests/language_strong/list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_tracer_call_last_test.dart b/tests/language_strong/list_tracer_call_last_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_tracer_call_last_test.dart
rename to tests/language_strong/list_tracer_call_last_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_tracer_closure_test.dart b/tests/language_strong/list_tracer_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_tracer_closure_test.dart
rename to tests/language_strong/list_tracer_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_tracer_in_list_test.dart b/tests/language_strong/list_tracer_in_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_tracer_in_list_test.dart
rename to tests/language_strong/list_tracer_in_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_tracer_in_map_test.dart b/tests/language_strong/list_tracer_in_map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_tracer_in_map_test.dart
rename to tests/language_strong/list_tracer_in_map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/list_tracer_return_from_tearoff_closure_test.dart b/tests/language_strong/list_tracer_return_from_tearoff_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/list_tracer_return_from_tearoff_closure_test.dart
rename to tests/language_strong/list_tracer_return_from_tearoff_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/literal_unary_plus_test.dart b/tests/language_strong/literal_unary_plus_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/literal_unary_plus_test.dart
rename to tests/language_strong/literal_unary_plus_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/liveness_test.dart b/tests/language_strong/liveness_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/liveness_test.dart
rename to tests/language_strong/liveness_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/load_indexed_constant_test.dart b/tests/language_strong/load_indexed_constant_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/load_indexed_constant_test.dart
rename to tests/language_strong/load_indexed_constant_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/local_export_a.dart b/tests/language_strong/local_export_a.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/local_export_a.dart
rename to tests/language_strong/local_export_a.dart
diff --git a/pkg/dev_compiler/test/codegen/language/local_export_a_export.dart b/tests/language_strong/local_export_a_export.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/local_export_a_export.dart
rename to tests/language_strong/local_export_a_export.dart
diff --git a/pkg/dev_compiler/test/codegen/language/local_export_test.dart b/tests/language_strong/local_export_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/local_export_test.dart
rename to tests/language_strong/local_export_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/local_function2_test.dart b/tests/language_strong/local_function2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/local_function2_test.dart
rename to tests/language_strong/local_function2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/local_function3_test.dart b/tests/language_strong/local_function3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/local_function3_test.dart
rename to tests/language_strong/local_function3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/local_function_non_equal_test.dart b/tests/language_strong/local_function_non_equal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/local_function_non_equal_test.dart
rename to tests/language_strong/local_function_non_equal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/local_function_test.dart b/tests/language_strong/local_function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/local_function_test.dart
rename to tests/language_strong/local_function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/logical_expression2_test.dart b/tests/language_strong/logical_expression2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/logical_expression2_test.dart
rename to tests/language_strong/logical_expression2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/logical_expression3_test.dart b/tests/language_strong/logical_expression3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/logical_expression3_test.dart
rename to tests/language_strong/logical_expression3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/logical_expression4_test.dart b/tests/language_strong/logical_expression4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/logical_expression4_test.dart
rename to tests/language_strong/logical_expression4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/logical_expression5_test.dart b/tests/language_strong/logical_expression5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/logical_expression5_test.dart
rename to tests/language_strong/logical_expression5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/logical_expression_test.dart b/tests/language_strong/logical_expression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/logical_expression_test.dart
rename to tests/language_strong/logical_expression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/loop_exchange2_test.dart b/tests/language_strong/loop_exchange2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/loop_exchange2_test.dart
rename to tests/language_strong/loop_exchange2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/loop_exchange3_test.dart b/tests/language_strong/loop_exchange3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/loop_exchange3_test.dart
rename to tests/language_strong/loop_exchange3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/loop_exchange4_test.dart b/tests/language_strong/loop_exchange4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/loop_exchange4_test.dart
rename to tests/language_strong/loop_exchange4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/loop_exchange_test.dart b/tests/language_strong/loop_exchange_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/loop_exchange_test.dart
rename to tests/language_strong/loop_exchange_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/loop_hoist_test.dart b/tests/language_strong/loop_hoist_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/loop_hoist_test.dart
rename to tests/language_strong/loop_hoist_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/main_not_a_function_test.dart b/tests/language_strong/main_not_a_function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/main_not_a_function_test.dart
rename to tests/language_strong/main_not_a_function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/main_test.dart b/tests/language_strong/main_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/main_test.dart
rename to tests/language_strong/main_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malbounded_instantiation_test.dart b/tests/language_strong/malbounded_instantiation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malbounded_instantiation_test.dart
rename to tests/language_strong/malbounded_instantiation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malbounded_redirecting_factory2_test.dart b/tests/language_strong/malbounded_redirecting_factory2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malbounded_redirecting_factory2_test.dart
rename to tests/language_strong/malbounded_redirecting_factory2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malbounded_redirecting_factory_test.dart b/tests/language_strong/malbounded_redirecting_factory_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malbounded_redirecting_factory_test.dart
rename to tests/language_strong/malbounded_redirecting_factory_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malbounded_type_cast2_test.dart b/tests/language_strong/malbounded_type_cast2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malbounded_type_cast2_test.dart
rename to tests/language_strong/malbounded_type_cast2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malbounded_type_cast_test.dart b/tests/language_strong/malbounded_type_cast_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malbounded_type_cast_test.dart
rename to tests/language_strong/malbounded_type_cast_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malbounded_type_literal_test.dart b/tests/language_strong/malbounded_type_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malbounded_type_literal_test.dart
rename to tests/language_strong/malbounded_type_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malbounded_type_test2_test.dart b/tests/language_strong/malbounded_type_test2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malbounded_type_test2_test.dart
rename to tests/language_strong/malbounded_type_test2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malbounded_type_test_test.dart b/tests/language_strong/malbounded_type_test_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malbounded_type_test_test.dart
rename to tests/language_strong/malbounded_type_test_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malformed2_lib.dart b/tests/language_strong/malformed2_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malformed2_lib.dart
rename to tests/language_strong/malformed2_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malformed2_test.dart b/tests/language_strong/malformed2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malformed2_test.dart
rename to tests/language_strong/malformed2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malformed_bound_test.dart b/tests/language_strong/malformed_bound_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malformed_bound_test.dart
rename to tests/language_strong/malformed_bound_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malformed_inheritance_test.dart b/tests/language_strong/malformed_inheritance_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malformed_inheritance_test.dart
rename to tests/language_strong/malformed_inheritance_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malformed_test.dart b/tests/language_strong/malformed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malformed_test.dart
rename to tests/language_strong/malformed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/malformed_type_test.dart b/tests/language_strong/malformed_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/malformed_type_test.dart
rename to tests/language_strong/malformed_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/many_calls_test.dart b/tests/language_strong/many_calls_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/many_calls_test.dart
rename to tests/language_strong/many_calls_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/many_generic_instanceof_test.dart b/tests/language_strong/many_generic_instanceof_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/many_generic_instanceof_test.dart
rename to tests/language_strong/many_generic_instanceof_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/many_method_calls_test.dart b/tests/language_strong/many_method_calls_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/many_method_calls_test.dart
rename to tests/language_strong/many_method_calls_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/many_named_arguments_test.dart b/tests/language_strong/many_named_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/many_named_arguments_test.dart
rename to tests/language_strong/many_named_arguments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/many_overridden_no_such_method_test.dart b/tests/language_strong/many_overridden_no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/many_overridden_no_such_method_test.dart
rename to tests/language_strong/many_overridden_no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal10_test.dart b/tests/language_strong/map_literal10_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal10_test.dart
rename to tests/language_strong/map_literal10_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal11_test.dart b/tests/language_strong/map_literal11_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal11_test.dart
rename to tests/language_strong/map_literal11_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal1_test.dart b/tests/language_strong/map_literal1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal1_test.dart
rename to tests/language_strong/map_literal1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal2_negative_test.dart b/tests/language_strong/map_literal2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal2_negative_test.dart
rename to tests/language_strong/map_literal2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal2_test.dart b/tests/language_strong/map_literal2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal2_test.dart
rename to tests/language_strong/map_literal2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal3_test.dart b/tests/language_strong/map_literal3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal3_test.dart
rename to tests/language_strong/map_literal3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal4_test.dart b/tests/language_strong/map_literal4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal4_test.dart
rename to tests/language_strong/map_literal4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal5_test.dart b/tests/language_strong/map_literal5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal5_test.dart
rename to tests/language_strong/map_literal5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal6_test.dart b/tests/language_strong/map_literal6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal6_test.dart
rename to tests/language_strong/map_literal6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal7_test.dart b/tests/language_strong/map_literal7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal7_test.dart
rename to tests/language_strong/map_literal7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal8_test.dart b/tests/language_strong/map_literal8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal8_test.dart
rename to tests/language_strong/map_literal8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal9_test.dart b/tests/language_strong/map_literal9_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal9_test.dart
rename to tests/language_strong/map_literal9_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal_negative_test.dart b/tests/language_strong/map_literal_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal_negative_test.dart
rename to tests/language_strong/map_literal_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal_syntax_test.dart b/tests/language_strong/map_literal_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal_syntax_test.dart
rename to tests/language_strong/map_literal_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_literal_test.dart b/tests/language_strong/map_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_literal_test.dart
rename to tests/language_strong/map_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/map_test.dart b/tests/language_strong/map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/map_test.dart
rename to tests/language_strong/map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mega_load_test.dart b/tests/language_strong/mega_load_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mega_load_test.dart
rename to tests/language_strong/mega_load_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/megamorphic_no_such_method_test.dart b/tests/language_strong/megamorphic_no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/megamorphic_no_such_method_test.dart
rename to tests/language_strong/megamorphic_no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/memory_swap_test.dart b/tests/language_strong/memory_swap_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/memory_swap_test.dart
rename to tests/language_strong/memory_swap_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/metadata_lib.dart b/tests/language_strong/metadata_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/metadata_lib.dart
rename to tests/language_strong/metadata_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/metadata_scope1_test.dart b/tests/language_strong/metadata_scope1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/metadata_scope1_test.dart
rename to tests/language_strong/metadata_scope1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/metadata_scope2_test.dart b/tests/language_strong/metadata_scope2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/metadata_scope2_test.dart
rename to tests/language_strong/metadata_scope2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/metadata_self_test.dart b/tests/language_strong/metadata_self_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/metadata_self_test.dart
rename to tests/language_strong/metadata_self_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/metadata_test.dart b/tests/language_strong/metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/metadata_test.dart
rename to tests/language_strong/metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_binding_test.dart b/tests/language_strong/method_binding_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_binding_test.dart
rename to tests/language_strong/method_binding_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_invocation_test.dart b/tests/language_strong/method_invocation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_invocation_test.dart
rename to tests/language_strong/method_invocation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_name_test.dart b/tests/language_strong/method_name_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_name_test.dart
rename to tests/language_strong/method_name_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_override2_test.dart b/tests/language_strong/method_override2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_override2_test.dart
rename to tests/language_strong/method_override2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_override3_test.dart b/tests/language_strong/method_override3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_override3_test.dart
rename to tests/language_strong/method_override3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_override4_test.dart b/tests/language_strong/method_override4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_override4_test.dart
rename to tests/language_strong/method_override4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_override5_test.dart b/tests/language_strong/method_override5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_override5_test.dart
rename to tests/language_strong/method_override5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_override6_test.dart b/tests/language_strong/method_override6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_override6_test.dart
rename to tests/language_strong/method_override6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_override7_test.dart b/tests/language_strong/method_override7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_override7_test.dart
rename to tests/language_strong/method_override7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_override8_test.dart b/tests/language_strong/method_override8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_override8_test.dart
rename to tests/language_strong/method_override8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/method_override_test.dart b/tests/language_strong/method_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/method_override_test.dart
rename to tests/language_strong/method_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/methods_as_constants2_test.dart b/tests/language_strong/methods_as_constants2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/methods_as_constants2_test.dart
rename to tests/language_strong/methods_as_constants2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/methods_as_constants_test.dart b/tests/language_strong/methods_as_constants_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/methods_as_constants_test.dart
rename to tests/language_strong/methods_as_constants_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/minify_closure_variable_collision_test.dart b/tests/language_strong/minify_closure_variable_collision_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/minify_closure_variable_collision_test.dart
rename to tests/language_strong/minify_closure_variable_collision_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mint_arithmetic_test.dart b/tests/language_strong/mint_arithmetic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mint_arithmetic_test.dart
rename to tests/language_strong/mint_arithmetic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mint_compares_test.dart b/tests/language_strong/mint_compares_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mint_compares_test.dart
rename to tests/language_strong/mint_compares_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/missing_const_constructor_test.dart b/tests/language_strong/missing_const_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/missing_const_constructor_test.dart
rename to tests/language_strong/missing_const_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/missing_part_of_tag_part.dart b/tests/language_strong/missing_part_of_tag_part.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/missing_part_of_tag_part.dart
rename to tests/language_strong/missing_part_of_tag_part.dart
diff --git a/pkg/dev_compiler/test/codegen/language/missing_part_of_tag_test.dart b/tests/language_strong/missing_part_of_tag_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/missing_part_of_tag_test.dart
rename to tests/language_strong/missing_part_of_tag_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_abstract_getter_test.dart b/tests/language_strong/mixin_abstract_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_abstract_getter_test.dart
rename to tests/language_strong/mixin_abstract_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_black_listed_test.dart b/tests/language_strong/mixin_black_listed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_black_listed_test.dart
rename to tests/language_strong/mixin_black_listed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_bound_test.dart b/tests/language_strong/mixin_bound_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_bound_test.dart
rename to tests/language_strong/mixin_bound_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_cyclic_test.dart b/tests/language_strong/mixin_cyclic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_cyclic_test.dart
rename to tests/language_strong/mixin_cyclic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_extends_field_test.dart b/tests/language_strong/mixin_extends_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_extends_field_test.dart
rename to tests/language_strong/mixin_extends_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_extends_is_test.dart b/tests/language_strong/mixin_extends_is_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_extends_is_test.dart
rename to tests/language_strong/mixin_extends_is_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_extends_method_test.dart b/tests/language_strong/mixin_extends_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_extends_method_test.dart
rename to tests/language_strong/mixin_extends_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_field_initializer_test.dart b/tests/language_strong/mixin_field_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_field_initializer_test.dart
rename to tests/language_strong/mixin_field_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_field_test.dart b/tests/language_strong/mixin_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_field_test.dart
rename to tests/language_strong/mixin_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_forwarding_constructor1_test.dart b/tests/language_strong/mixin_forwarding_constructor1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_forwarding_constructor1_test.dart
rename to tests/language_strong/mixin_forwarding_constructor1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_forwarding_constructor2_test.dart b/tests/language_strong/mixin_forwarding_constructor2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_forwarding_constructor2_test.dart
rename to tests/language_strong/mixin_forwarding_constructor2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_forwarding_constructor3_test.dart b/tests/language_strong/mixin_forwarding_constructor3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_forwarding_constructor3_test.dart
rename to tests/language_strong/mixin_forwarding_constructor3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_forwarding_constructor4_test.dart b/tests/language_strong/mixin_forwarding_constructor4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_forwarding_constructor4_test.dart
rename to tests/language_strong/mixin_forwarding_constructor4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_generic_test.dart b/tests/language_strong/mixin_generic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_generic_test.dart
rename to tests/language_strong/mixin_generic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_getter_regression_test.dart b/tests/language_strong/mixin_getter_regression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_getter_regression_test.dart
rename to tests/language_strong/mixin_getter_regression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_illegal_constructor_test.dart b/tests/language_strong/mixin_illegal_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_illegal_constructor_test.dart
rename to tests/language_strong/mixin_illegal_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_illegal_cycles_test.dart b/tests/language_strong/mixin_illegal_cycles_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_illegal_cycles_test.dart
rename to tests/language_strong/mixin_illegal_cycles_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_illegal_object_test.dart b/tests/language_strong/mixin_illegal_object_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_illegal_object_test.dart
rename to tests/language_strong/mixin_illegal_object_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_illegal_static_access_test.dart b/tests/language_strong/mixin_illegal_static_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_illegal_static_access_test.dart
rename to tests/language_strong/mixin_illegal_static_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_illegal_super_use_test.dart b/tests/language_strong/mixin_illegal_super_use_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_illegal_super_use_test.dart
rename to tests/language_strong/mixin_illegal_super_use_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_illegal_superclass_test.dart b/tests/language_strong/mixin_illegal_superclass_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_illegal_superclass_test.dart
rename to tests/language_strong/mixin_illegal_superclass_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_illegal_syntax_test.dart b/tests/language_strong/mixin_illegal_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_illegal_syntax_test.dart
rename to tests/language_strong/mixin_illegal_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_implements2_test.dart b/tests/language_strong/mixin_implements2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_implements2_test.dart
rename to tests/language_strong/mixin_implements2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_implements_test.dart b/tests/language_strong/mixin_implements_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_implements_test.dart
rename to tests/language_strong/mixin_implements_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_invalid_bound2_test.dart b/tests/language_strong/mixin_invalid_bound2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_invalid_bound2_test.dart
rename to tests/language_strong/mixin_invalid_bound2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_invalid_bound_test.dart b/tests/language_strong/mixin_invalid_bound_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_invalid_bound_test.dart
rename to tests/language_strong/mixin_invalid_bound_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_invalid_inheritance1_test.dart b/tests/language_strong/mixin_invalid_inheritance1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_invalid_inheritance1_test.dart
rename to tests/language_strong/mixin_invalid_inheritance1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_invalid_inheritance2_test.dart b/tests/language_strong/mixin_invalid_inheritance2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_invalid_inheritance2_test.dart
rename to tests/language_strong/mixin_invalid_inheritance2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_is_test.dart b/tests/language_strong/mixin_is_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_is_test.dart
rename to tests/language_strong/mixin_is_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_issue10216_2_test.dart b/tests/language_strong/mixin_issue10216_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_issue10216_2_test.dart
rename to tests/language_strong/mixin_issue10216_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_issue10216_test.dart b/tests/language_strong/mixin_issue10216_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_issue10216_test.dart
rename to tests/language_strong/mixin_issue10216_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_lib_extends_field_lib.dart b/tests/language_strong/mixin_lib_extends_field_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_lib_extends_field_lib.dart
rename to tests/language_strong/mixin_lib_extends_field_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_lib_extends_field_test.dart b/tests/language_strong/mixin_lib_extends_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_lib_extends_field_test.dart
rename to tests/language_strong/mixin_lib_extends_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_lib_extends_method_lib.dart b/tests/language_strong/mixin_lib_extends_method_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_lib_extends_method_lib.dart
rename to tests/language_strong/mixin_lib_extends_method_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_lib_extends_method_test.dart b/tests/language_strong/mixin_lib_extends_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_lib_extends_method_test.dart
rename to tests/language_strong/mixin_lib_extends_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_method_test.dart b/tests/language_strong/mixin_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_method_test.dart
rename to tests/language_strong/mixin_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_mixin2_test.dart b/tests/language_strong/mixin_mixin2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_mixin2_test.dart
rename to tests/language_strong/mixin_mixin2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_mixin3_test.dart b/tests/language_strong/mixin_mixin3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_mixin3_test.dart
rename to tests/language_strong/mixin_mixin3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_mixin4_test.dart b/tests/language_strong/mixin_mixin4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_mixin4_test.dart
rename to tests/language_strong/mixin_mixin4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_mixin5_test.dart b/tests/language_strong/mixin_mixin5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_mixin5_test.dart
rename to tests/language_strong/mixin_mixin5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_mixin6_test.dart b/tests/language_strong/mixin_mixin6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_mixin6_test.dart
rename to tests/language_strong/mixin_mixin6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_mixin7_test.dart b/tests/language_strong/mixin_mixin7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_mixin7_test.dart
rename to tests/language_strong/mixin_mixin7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_mixin_bound2_test.dart b/tests/language_strong/mixin_mixin_bound2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_mixin_bound2_test.dart
rename to tests/language_strong/mixin_mixin_bound2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_mixin_bound_test.dart b/tests/language_strong/mixin_mixin_bound_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_mixin_bound_test.dart
rename to tests/language_strong/mixin_mixin_bound_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_mixin_test.dart b/tests/language_strong/mixin_mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_mixin_test.dart
rename to tests/language_strong/mixin_mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_naming_test.dart b/tests/language_strong/mixin_naming_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_naming_test.dart
rename to tests/language_strong/mixin_naming_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_only_for_rti_test.dart b/tests/language_strong/mixin_only_for_rti_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_only_for_rti_test.dart
rename to tests/language_strong/mixin_only_for_rti_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_override_regression_test.dart b/tests/language_strong/mixin_override_regression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_override_regression_test.dart
rename to tests/language_strong/mixin_override_regression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_prefix_lib.dart b/tests/language_strong/mixin_prefix_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_prefix_lib.dart
rename to tests/language_strong/mixin_prefix_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_prefix_test.dart b/tests/language_strong/mixin_prefix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_prefix_test.dart
rename to tests/language_strong/mixin_prefix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_regress_11398_test.dart b/tests/language_strong/mixin_regress_11398_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_regress_11398_test.dart
rename to tests/language_strong/mixin_regress_11398_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_regress_13688_test.dart b/tests/language_strong/mixin_regress_13688_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_regress_13688_test.dart
rename to tests/language_strong/mixin_regress_13688_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_super_bound2_test.dart b/tests/language_strong/mixin_super_bound2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_super_bound2_test.dart
rename to tests/language_strong/mixin_super_bound2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_super_bound_test.dart b/tests/language_strong/mixin_super_bound_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_super_bound_test.dart
rename to tests/language_strong/mixin_super_bound_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_super_constructor2_test.dart b/tests/language_strong/mixin_super_constructor2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_super_constructor2_test.dart
rename to tests/language_strong/mixin_super_constructor2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_super_constructor_default_test.dart b/tests/language_strong/mixin_super_constructor_default_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_super_constructor_default_test.dart
rename to tests/language_strong/mixin_super_constructor_default_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_super_constructor_multiple_test.dart b/tests/language_strong/mixin_super_constructor_multiple_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_super_constructor_multiple_test.dart
rename to tests/language_strong/mixin_super_constructor_multiple_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_super_constructor_named_test.dart b/tests/language_strong/mixin_super_constructor_named_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_super_constructor_named_test.dart
rename to tests/language_strong/mixin_super_constructor_named_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_super_constructor_positionals_test.dart b/tests/language_strong/mixin_super_constructor_positionals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_super_constructor_positionals_test.dart
rename to tests/language_strong/mixin_super_constructor_positionals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_super_constructor_test.dart b/tests/language_strong/mixin_super_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_super_constructor_test.dart
rename to tests/language_strong/mixin_super_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_super_test.dart b/tests/language_strong/mixin_super_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_super_test.dart
rename to tests/language_strong/mixin_super_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_this_use_test.dart b/tests/language_strong/mixin_this_use_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_this_use_test.dart
rename to tests/language_strong/mixin_this_use_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameter1_test.dart b/tests/language_strong/mixin_type_parameter1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameter1_test.dart
rename to tests/language_strong/mixin_type_parameter1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameter2_test.dart b/tests/language_strong/mixin_type_parameter2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameter2_test.dart
rename to tests/language_strong/mixin_type_parameter2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameter3_test.dart b/tests/language_strong/mixin_type_parameter3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameter3_test.dart
rename to tests/language_strong/mixin_type_parameter3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameter4_test.dart b/tests/language_strong/mixin_type_parameter4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameter4_test.dart
rename to tests/language_strong/mixin_type_parameter4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameter5_test.dart b/tests/language_strong/mixin_type_parameter5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameter5_test.dart
rename to tests/language_strong/mixin_type_parameter5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameter6_test.dart b/tests/language_strong/mixin_type_parameter6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameter6_test.dart
rename to tests/language_strong/mixin_type_parameter6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameters_errors_test.dart b/tests/language_strong/mixin_type_parameters_errors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameters_errors_test.dart
rename to tests/language_strong/mixin_type_parameters_errors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameters_mixin_extends_test.dart b/tests/language_strong/mixin_type_parameters_mixin_extends_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameters_mixin_extends_test.dart
rename to tests/language_strong/mixin_type_parameters_mixin_extends_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameters_mixin_test.dart b/tests/language_strong/mixin_type_parameters_mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameters_mixin_test.dart
rename to tests/language_strong/mixin_type_parameters_mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameters_simple_test.dart b/tests/language_strong/mixin_type_parameters_simple_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameters_simple_test.dart
rename to tests/language_strong/mixin_type_parameters_simple_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameters_super_extends_test.dart b/tests/language_strong/mixin_type_parameters_super_extends_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameters_super_extends_test.dart
rename to tests/language_strong/mixin_type_parameters_super_extends_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_parameters_super_test.dart b/tests/language_strong/mixin_type_parameters_super_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_parameters_super_test.dart
rename to tests/language_strong/mixin_type_parameters_super_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_type_variable_test.dart b/tests/language_strong/mixin_type_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_type_variable_test.dart
rename to tests/language_strong/mixin_type_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_typedef_constructor_test.dart b/tests/language_strong/mixin_typedef_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_typedef_constructor_test.dart
rename to tests/language_strong/mixin_typedef_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mixin_with_two_implicit_constructors_test.dart b/tests/language_strong/mixin_with_two_implicit_constructors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mixin_with_two_implicit_constructors_test.dart
rename to tests/language_strong/mixin_with_two_implicit_constructors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/modulo_test.dart b/tests/language_strong/modulo_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/modulo_test.dart
rename to tests/language_strong/modulo_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/mul_recipr_test.dart b/tests/language_strong/mul_recipr_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/mul_recipr_test.dart
rename to tests/language_strong/mul_recipr_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multi_assign_test.dart b/tests/language_strong/multi_assign_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multi_assign_test.dart
rename to tests/language_strong/multi_assign_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multi_pass2_test.dart b/tests/language_strong/multi_pass2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multi_pass2_test.dart
rename to tests/language_strong/multi_pass2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multi_pass_a.dart b/tests/language_strong/multi_pass_a.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multi_pass_a.dart
rename to tests/language_strong/multi_pass_a.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multi_pass_b.dart b/tests/language_strong/multi_pass_b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multi_pass_b.dart
rename to tests/language_strong/multi_pass_b.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multi_pass_test.dart b/tests/language_strong/multi_pass_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multi_pass_test.dart
rename to tests/language_strong/multi_pass_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multiline_newline_cr.dart b/tests/language_strong/multiline_newline_cr.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multiline_newline_cr.dart
rename to tests/language_strong/multiline_newline_cr.dart
Binary files differ
diff --git a/pkg/dev_compiler/test/codegen/language/multiline_newline_crlf.dart b/tests/language_strong/multiline_newline_crlf.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multiline_newline_crlf.dart
rename to tests/language_strong/multiline_newline_crlf.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multiline_newline_lf.dart b/tests/language_strong/multiline_newline_lf.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multiline_newline_lf.dart
rename to tests/language_strong/multiline_newline_lf.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multiline_newline_test.dart b/tests/language_strong/multiline_newline_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multiline_newline_test.dart
rename to tests/language_strong/multiline_newline_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multiline_strings_test.dart b/tests/language_strong/multiline_strings_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multiline_strings_test.dart
rename to tests/language_strong/multiline_strings_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/multiple_field_assignment_constructor_test.dart b/tests/language_strong/multiple_field_assignment_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/multiple_field_assignment_constructor_test.dart
rename to tests/language_strong/multiple_field_assignment_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_argument_in_const_creation_test.dart b/tests/language_strong/named_argument_in_const_creation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_argument_in_const_creation_test.dart
rename to tests/language_strong/named_argument_in_const_creation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_argument_test.dart b/tests/language_strong/named_argument_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_argument_test.dart
rename to tests/language_strong/named_argument_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_constructor_lib.dart b/tests/language_strong/named_constructor_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_constructor_lib.dart
rename to tests/language_strong/named_constructor_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_constructor_test.dart b/tests/language_strong/named_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_constructor_test.dart
rename to tests/language_strong/named_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameter_clash_test.dart b/tests/language_strong/named_parameter_clash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameter_clash_test.dart
rename to tests/language_strong/named_parameter_clash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameter_regression_test.dart b/tests/language_strong/named_parameter_regression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameter_regression_test.dart
rename to tests/language_strong/named_parameter_regression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters2_test.dart b/tests/language_strong/named_parameters2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters2_test.dart
rename to tests/language_strong/named_parameters2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters3_test.dart b/tests/language_strong/named_parameters3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters3_test.dart
rename to tests/language_strong/named_parameters3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters4_test.dart b/tests/language_strong/named_parameters4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters4_test.dart
rename to tests/language_strong/named_parameters4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_aggregated_test.dart b/tests/language_strong/named_parameters_aggregated_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_aggregated_test.dart
rename to tests/language_strong/named_parameters_aggregated_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_named_count_test.dart b/tests/language_strong/named_parameters_named_count_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_named_count_test.dart
rename to tests/language_strong/named_parameters_named_count_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_passing_false_test.dart b/tests/language_strong/named_parameters_passing_false_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_passing_false_test.dart
rename to tests/language_strong/named_parameters_passing_false_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_passing_falsy_test.dart b/tests/language_strong/named_parameters_passing_falsy_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_passing_falsy_test.dart
rename to tests/language_strong/named_parameters_passing_falsy_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_passing_null_test.dart b/tests/language_strong/named_parameters_passing_null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_passing_null_test.dart
rename to tests/language_strong/named_parameters_passing_null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_passing_zero_test.dart b/tests/language_strong/named_parameters_passing_zero_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_passing_zero_test.dart
rename to tests/language_strong/named_parameters_passing_zero_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_test.dart b/tests/language_strong/named_parameters_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_test.dart
rename to tests/language_strong/named_parameters_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_type_test.dart b/tests/language_strong/named_parameters_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_type_test.dart
rename to tests/language_strong/named_parameters_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_with_conversions_test.dart b/tests/language_strong/named_parameters_with_conversions_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_with_conversions_test.dart
rename to tests/language_strong/named_parameters_with_conversions_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_with_dollars_test.dart b/tests/language_strong/named_parameters_with_dollars_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_with_dollars_test.dart
rename to tests/language_strong/named_parameters_with_dollars_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/named_parameters_with_object_property_names_test.dart b/tests/language_strong/named_parameters_with_object_property_names_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/named_parameters_with_object_property_names_test.dart
rename to tests/language_strong/named_parameters_with_object_property_names_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/namer2_test.dart b/tests/language_strong/namer2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/namer2_test.dart
rename to tests/language_strong/namer2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/namer_test.dart b/tests/language_strong/namer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/namer_test.dart
rename to tests/language_strong/namer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/naming2_test.dart b/tests/language_strong/naming2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/naming2_test.dart
rename to tests/language_strong/naming2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/naming3_test.dart b/tests/language_strong/naming3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/naming3_test.dart
rename to tests/language_strong/naming3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/naming_test.dart b/tests/language_strong/naming_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/naming_test.dart
rename to tests/language_strong/naming_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/nan_identical_test.dart b/tests/language_strong/nan_identical_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/nan_identical_test.dart
rename to tests/language_strong/nan_identical_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/native_test.dart b/tests/language_strong/native_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/native_test.dart
rename to tests/language_strong/native_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/nested_comments_test.dart b/tests/language_strong/nested_comments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/nested_comments_test.dart
rename to tests/language_strong/nested_comments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/nested_if_test.dart b/tests/language_strong/nested_if_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/nested_if_test.dart
rename to tests/language_strong/nested_if_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/nested_switch_label_test.dart b/tests/language_strong/nested_switch_label_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/nested_switch_label_test.dart
rename to tests/language_strong/nested_switch_label_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/new_expression1_negative_test.dart b/tests/language_strong/new_expression1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/new_expression1_negative_test.dart
rename to tests/language_strong/new_expression1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/new_expression2_negative_test.dart b/tests/language_strong/new_expression2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/new_expression2_negative_test.dart
rename to tests/language_strong/new_expression2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/new_expression3_negative_test.dart b/tests/language_strong/new_expression3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/new_expression3_negative_test.dart
rename to tests/language_strong/new_expression3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/new_expression_type_args_test.dart b/tests/language_strong/new_expression_type_args_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/new_expression_type_args_test.dart
rename to tests/language_strong/new_expression_type_args_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/new_prefix_test.dart b/tests/language_strong/new_prefix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/new_prefix_test.dart
rename to tests/language_strong/new_prefix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/new_statement_test.dart b/tests/language_strong/new_statement_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/new_statement_test.dart
rename to tests/language_strong/new_statement_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_main_test.dart b/tests/language_strong/no_main_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_main_test.dart
rename to tests/language_strong/no_main_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_constructor2_test.dart b/tests/language_strong/no_such_constructor2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_constructor2_test.dart
rename to tests/language_strong/no_such_constructor2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_constructor_test.dart b/tests/language_strong/no_such_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_constructor_test.dart
rename to tests/language_strong/no_such_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_method2_test.dart b/tests/language_strong/no_such_method2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_method2_test.dart
rename to tests/language_strong/no_such_method2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_method3_test.dart b/tests/language_strong/no_such_method3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_method3_test.dart
rename to tests/language_strong/no_such_method3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_method_dispatcher_test.dart b/tests/language_strong/no_such_method_dispatcher_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_method_dispatcher_test.dart
rename to tests/language_strong/no_such_method_dispatcher_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_method_empty_selector_test.dart b/tests/language_strong/no_such_method_empty_selector_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_method_empty_selector_test.dart
rename to tests/language_strong/no_such_method_empty_selector_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_method_mock_test.dart b/tests/language_strong/no_such_method_mock_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_method_mock_test.dart
rename to tests/language_strong/no_such_method_mock_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_method_native_test.dart b/tests/language_strong/no_such_method_native_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_method_native_test.dart
rename to tests/language_strong/no_such_method_native_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_method_negative_test.dart b/tests/language_strong/no_such_method_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_method_negative_test.dart
rename to tests/language_strong/no_such_method_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_method_subtype_test.dart b/tests/language_strong/no_such_method_subtype_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_method_subtype_test.dart
rename to tests/language_strong/no_such_method_subtype_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/no_such_method_test.dart b/tests/language_strong/no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/no_such_method_test.dart
rename to tests/language_strong/no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/non_const_constructor_without_body_test.dart b/tests/language_strong/non_const_constructor_without_body_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/non_const_constructor_without_body_test.dart
rename to tests/language_strong/non_const_constructor_without_body_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/non_const_super_negative_test.dart b/tests/language_strong/non_const_super_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/non_const_super_negative_test.dart
rename to tests/language_strong/non_const_super_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/non_dominating_loop_test.dart b/tests/language_strong/non_dominating_loop_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/non_dominating_loop_test.dart
rename to tests/language_strong/non_dominating_loop_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/non_parameterized_factory2_test.dart b/tests/language_strong/non_parameterized_factory2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/non_parameterized_factory2_test.dart
rename to tests/language_strong/non_parameterized_factory2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/non_parameterized_factory_test.dart b/tests/language_strong/non_parameterized_factory_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/non_parameterized_factory_test.dart
rename to tests/language_strong/non_parameterized_factory_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/not_enough_positional_arguments_test.dart b/tests/language_strong/not_enough_positional_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/not_enough_positional_arguments_test.dart
rename to tests/language_strong/not_enough_positional_arguments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null2_test.dart b/tests/language_strong/null2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null2_test.dart
rename to tests/language_strong/null2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null_access_error_test.dart b/tests/language_strong/null_access_error_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null_access_error_test.dart
rename to tests/language_strong/null_access_error_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null_inline_test.dart b/tests/language_strong/null_inline_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null_inline_test.dart
rename to tests/language_strong/null_inline_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null_is2_test.dart b/tests/language_strong/null_is2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null_is2_test.dart
rename to tests/language_strong/null_is2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null_is_test.dart b/tests/language_strong/null_is_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null_is_test.dart
rename to tests/language_strong/null_is_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null_method_test.dart b/tests/language_strong/null_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null_method_test.dart
rename to tests/language_strong/null_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null_no_such_method_test.dart b/tests/language_strong/null_no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null_no_such_method_test.dart
rename to tests/language_strong/null_no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null_test.dart b/tests/language_strong/null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null_test.dart
rename to tests/language_strong/null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null_to_string2_test.dart b/tests/language_strong/null_to_string2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null_to_string2_test.dart
rename to tests/language_strong/null_to_string2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/null_to_string_test.dart b/tests/language_strong/null_to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/null_to_string_test.dart
rename to tests/language_strong/null_to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/nullaware_opt_test.dart b/tests/language_strong/nullaware_opt_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/nullaware_opt_test.dart
rename to tests/language_strong/nullaware_opt_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/number_constant_folding1_test.dart b/tests/language_strong/number_constant_folding1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/number_constant_folding1_test.dart
rename to tests/language_strong/number_constant_folding1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/number_identifier_test.dart b/tests/language_strong/number_identifier_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/number_identifier_test.dart
rename to tests/language_strong/number_identifier_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/number_identity2_test.dart b/tests/language_strong/number_identity2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/number_identity2_test.dart
rename to tests/language_strong/number_identity2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/number_identity_test.dart b/tests/language_strong/number_identity_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/number_identity_test.dart
rename to tests/language_strong/number_identity_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/number_syntax_test.dart b/tests/language_strong/number_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/number_syntax_test.dart
rename to tests/language_strong/number_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/numbers_test.dart b/tests/language_strong/numbers_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/numbers_test.dart
rename to tests/language_strong/numbers_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/on_catch_malformed_type_test.dart b/tests/language_strong/on_catch_malformed_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/on_catch_malformed_type_test.dart
rename to tests/language_strong/on_catch_malformed_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator1_negative_test.dart b/tests/language_strong/operator1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator1_negative_test.dart
rename to tests/language_strong/operator1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator2_negative_test.dart b/tests/language_strong/operator2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator2_negative_test.dart
rename to tests/language_strong/operator2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator2_test.dart b/tests/language_strong/operator2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator2_test.dart
rename to tests/language_strong/operator2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator3_test.dart b/tests/language_strong/operator3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator3_test.dart
rename to tests/language_strong/operator3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator4_test.dart b/tests/language_strong/operator4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator4_test.dart
rename to tests/language_strong/operator4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator5_test.dart b/tests/language_strong/operator5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator5_test.dart
rename to tests/language_strong/operator5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator6_test.dart b/tests/language_strong/operator6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator6_test.dart
rename to tests/language_strong/operator6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator_equals_test.dart b/tests/language_strong/operator_equals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator_equals_test.dart
rename to tests/language_strong/operator_equals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator_index_evaluation_order_test.dart b/tests/language_strong/operator_index_evaluation_order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator_index_evaluation_order_test.dart
rename to tests/language_strong/operator_index_evaluation_order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator_negate_and_method_negate_test.dart b/tests/language_strong/operator_negate_and_method_negate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator_negate_and_method_negate_test.dart
rename to tests/language_strong/operator_negate_and_method_negate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/operator_test.dart b/tests/language_strong/operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/operator_test.dart
rename to tests/language_strong/operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/optimize_redundant_array_load_test.dart b/tests/language_strong/optimize_redundant_array_load_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/optimize_redundant_array_load_test.dart
rename to tests/language_strong/optimize_redundant_array_load_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/optimized_constant_array_string_access_test.dart b/tests/language_strong/optimized_constant_array_string_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/optimized_constant_array_string_access_test.dart
rename to tests/language_strong/optimized_constant_array_string_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/optimized_hoisting_checked_mode_assert_test.dart b/tests/language_strong/optimized_hoisting_checked_mode_assert_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/optimized_hoisting_checked_mode_assert_test.dart
rename to tests/language_strong/optimized_hoisting_checked_mode_assert_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/optimized_isempty_test.dart b/tests/language_strong/optimized_isempty_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/optimized_isempty_test.dart
rename to tests/language_strong/optimized_isempty_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/optimized_lists_test.dart b/tests/language_strong/optimized_lists_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/optimized_lists_test.dart
rename to tests/language_strong/optimized_lists_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/optimized_setter_test.dart b/tests/language_strong/optimized_setter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/optimized_setter_test.dart
rename to tests/language_strong/optimized_setter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/optimized_string_charat_test.dart b/tests/language_strong/optimized_string_charat_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/optimized_string_charat_test.dart
rename to tests/language_strong/optimized_string_charat_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/optimized_string_charcodeat_test.dart b/tests/language_strong/optimized_string_charcodeat_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/optimized_string_charcodeat_test.dart
rename to tests/language_strong/optimized_string_charcodeat_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/optional_named_parameters_test.dart b/tests/language_strong/optional_named_parameters_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/optional_named_parameters_test.dart
rename to tests/language_strong/optional_named_parameters_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/ordered_maps_test.dart b/tests/language_strong/ordered_maps_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/ordered_maps_test.dart
rename to tests/language_strong/ordered_maps_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/osr_test.dart b/tests/language_strong/osr_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/osr_test.dart
rename to tests/language_strong/osr_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/other_library.dart b/tests/language_strong/other_library.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/other_library.dart
rename to tests/language_strong/other_library.dart
diff --git a/pkg/dev_compiler/test/codegen/language/overridden_no_such_method.dart b/tests/language_strong/overridden_no_such_method.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/overridden_no_such_method.dart
rename to tests/language_strong/overridden_no_such_method.dart
diff --git a/pkg/dev_compiler/test/codegen/language/overridden_no_such_method_test.dart b/tests/language_strong/overridden_no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/overridden_no_such_method_test.dart
rename to tests/language_strong/overridden_no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_field_method1_negative_test.dart b/tests/language_strong/override_field_method1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_field_method1_negative_test.dart
rename to tests/language_strong/override_field_method1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_field_method2_negative_test.dart b/tests/language_strong/override_field_method2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_field_method2_negative_test.dart
rename to tests/language_strong/override_field_method2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_field_method4_negative_test.dart b/tests/language_strong/override_field_method4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_field_method4_negative_test.dart
rename to tests/language_strong/override_field_method4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_field_method5_negative_test.dart b/tests/language_strong/override_field_method5_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_field_method5_negative_test.dart
rename to tests/language_strong/override_field_method5_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_field_test.dart b/tests/language_strong/override_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_field_test.dart
rename to tests/language_strong/override_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_inheritance_abstract_test.dart b/tests/language_strong/override_inheritance_abstract_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_inheritance_abstract_test.dart
rename to tests/language_strong/override_inheritance_abstract_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_inheritance_field_test.dart b/tests/language_strong/override_inheritance_field_test.dart
similarity index 97%
rename from pkg/dev_compiler/test/codegen/language/override_inheritance_field_test.dart
rename to tests/language_strong/override_inheritance_field_test.dart
index 7e2b28b..dbb17fa 100644
--- a/pkg/dev_compiler/test/codegen/language/override_inheritance_field_test.dart
+++ b/tests/language_strong/override_inheritance_field_test.dart
@@ -2,6 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import "package:meta/meta.dart" show virtual;
+
 class A {
   get getter1 => null; /// 01: ok
   num get getter2 => null; /// 02: ok
@@ -24,12 +26,12 @@
   set setter10(int _) => null; /// 30: static type warning
   set setter11(int _) => null; /// 31: static type warning
 
-  int field1; /// 41: ok
+  @virtual int field1; /// 41: ok
   num field2; /// 42: ok
   int field3; /// 43: ok
   int field4; /// 44: static type warning
   int field5; /// 45: ok
-  num field6; /// 46: ok
+  @virtual num field6; /// 46: ok
   num field7; /// 47: static type warning
   num get field8 => null; /// 48: static type warning
   num field9; /// 49: ok
diff --git a/pkg/dev_compiler/test/codegen/language/override_inheritance_generic_test.dart b/tests/language_strong/override_inheritance_generic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_inheritance_generic_test.dart
rename to tests/language_strong/override_inheritance_generic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_inheritance_method_test.dart b/tests/language_strong/override_inheritance_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_inheritance_method_test.dart
rename to tests/language_strong/override_inheritance_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_inheritance_mixed_test.dart b/tests/language_strong/override_inheritance_mixed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_inheritance_mixed_test.dart
rename to tests/language_strong/override_inheritance_mixed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_inheritance_no_such_method_test.dart b/tests/language_strong/override_inheritance_no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_inheritance_no_such_method_test.dart
rename to tests/language_strong/override_inheritance_no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/override_method_with_field_test.dart b/tests/language_strong/override_method_with_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/override_method_with_field_test.dart
rename to tests/language_strong/override_method_with_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/param1_test.dart b/tests/language_strong/param1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/param1_test.dart
rename to tests/language_strong/param1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/param2_test.dart b/tests/language_strong/param2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/param2_test.dart
rename to tests/language_strong/param2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/param_test.dart b/tests/language_strong/param_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/param_test.dart
rename to tests/language_strong/param_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_default_test.dart b/tests/language_strong/parameter_default_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_default_test.dart
rename to tests/language_strong/parameter_default_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_initializer1_negative_test.dart b/tests/language_strong/parameter_initializer1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_initializer1_negative_test.dart
rename to tests/language_strong/parameter_initializer1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_initializer2_negative_test.dart b/tests/language_strong/parameter_initializer2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_initializer2_negative_test.dart
rename to tests/language_strong/parameter_initializer2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_initializer2_test.dart b/tests/language_strong/parameter_initializer2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_initializer2_test.dart
rename to tests/language_strong/parameter_initializer2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_initializer3_negative_test.dart b/tests/language_strong/parameter_initializer3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_initializer3_negative_test.dart
rename to tests/language_strong/parameter_initializer3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_initializer4_negative_test.dart b/tests/language_strong/parameter_initializer4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_initializer4_negative_test.dart
rename to tests/language_strong/parameter_initializer4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_initializer5_test.dart b/tests/language_strong/parameter_initializer5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_initializer5_test.dart
rename to tests/language_strong/parameter_initializer5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_initializer6_negative_test.dart b/tests/language_strong/parameter_initializer6_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_initializer6_negative_test.dart
rename to tests/language_strong/parameter_initializer6_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_initializer_test.dart b/tests/language_strong/parameter_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_initializer_test.dart
rename to tests/language_strong/parameter_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_metadata_test.dart b/tests/language_strong/parameter_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_metadata_test.dart
rename to tests/language_strong/parameter_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_name_conflict_test.dart b/tests/language_strong/parameter_name_conflict_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_name_conflict_test.dart
rename to tests/language_strong/parameter_name_conflict_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_types_specialization_test.dart b/tests/language_strong/parameter_types_specialization_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parameter_types_specialization_test.dart
rename to tests/language_strong/parameter_types_specialization_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parse_closures_in_initializers_test.dart b/tests/language_strong/parse_closures_in_initializers_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parse_closures_in_initializers_test.dart
rename to tests/language_strong/parse_closures_in_initializers_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parse_types_test.dart b/tests/language_strong/parse_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parse_types_test.dart
rename to tests/language_strong/parse_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/parser_quirks_test.dart b/tests/language_strong/parser_quirks_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/parser_quirks_test.dart
rename to tests/language_strong/parser_quirks_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/part2_test.dart b/tests/language_strong/part2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/part2_test.dart
rename to tests/language_strong/part2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/part_part.dart b/tests/language_strong/part_part.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/part_part.dart
rename to tests/language_strong/part_part.dart
diff --git a/pkg/dev_compiler/test/codegen/language/part_test.dart b/tests/language_strong/part_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/part_test.dart
rename to tests/language_strong/part_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/partial_min_test.dart b/tests/language_strong/partial_min_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/partial_min_test.dart
rename to tests/language_strong/partial_min_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/patch_test.dart b/tests/language_strong/patch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/patch_test.dart
rename to tests/language_strong/patch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/phi_merge_test.dart b/tests/language_strong/phi_merge_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/phi_merge_test.dart
rename to tests/language_strong/phi_merge_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/positional_parameters_type_test.dart b/tests/language_strong/positional_parameters_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/positional_parameters_type_test.dart
rename to tests/language_strong/positional_parameters_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/positive_bit_operations_test.dart b/tests/language_strong/positive_bit_operations_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/positive_bit_operations_test.dart
rename to tests/language_strong/positive_bit_operations_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix101_test.dart b/tests/language_strong/prefix101_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix101_test.dart
rename to tests/language_strong/prefix101_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix10_negative_test.dart b/tests/language_strong/prefix10_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix10_negative_test.dart
rename to tests/language_strong/prefix10_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix10_test.dart b/tests/language_strong/prefix10_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix10_test.dart
rename to tests/language_strong/prefix10_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix11_negative_test.dart b/tests/language_strong/prefix11_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix11_negative_test.dart
rename to tests/language_strong/prefix11_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix11_test.dart b/tests/language_strong/prefix11_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix11_test.dart
rename to tests/language_strong/prefix11_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix12_negative_test.dart b/tests/language_strong/prefix12_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix12_negative_test.dart
rename to tests/language_strong/prefix12_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix12_test.dart b/tests/language_strong/prefix12_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix12_test.dart
rename to tests/language_strong/prefix12_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix13_negative_test.dart b/tests/language_strong/prefix13_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix13_negative_test.dart
rename to tests/language_strong/prefix13_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix14_test.dart b/tests/language_strong/prefix14_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix14_test.dart
rename to tests/language_strong/prefix14_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix15_negative_test.dart b/tests/language_strong/prefix15_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix15_negative_test.dart
rename to tests/language_strong/prefix15_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix15_test.dart b/tests/language_strong/prefix15_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix15_test.dart
rename to tests/language_strong/prefix15_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix16_test.dart b/tests/language_strong/prefix16_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix16_test.dart
rename to tests/language_strong/prefix16_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix17_test.dart b/tests/language_strong/prefix17_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix17_test.dart
rename to tests/language_strong/prefix17_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix18_negative_test.dart b/tests/language_strong/prefix18_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix18_negative_test.dart
rename to tests/language_strong/prefix18_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix1_negative_test.dart b/tests/language_strong/prefix1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix1_negative_test.dart
rename to tests/language_strong/prefix1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix21_bad_lib.dart b/tests/language_strong/prefix21_bad_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix21_bad_lib.dart
rename to tests/language_strong/prefix21_bad_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix21_good_lib.dart b/tests/language_strong/prefix21_good_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix21_good_lib.dart
rename to tests/language_strong/prefix21_good_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix21_test.dart b/tests/language_strong/prefix21_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix21_test.dart
rename to tests/language_strong/prefix21_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix22_test.dart b/tests/language_strong/prefix22_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix22_test.dart
rename to tests/language_strong/prefix22_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix23_test.dart b/tests/language_strong/prefix23_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix23_test.dart
rename to tests/language_strong/prefix23_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix24_lib1.dart b/tests/language_strong/prefix24_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix24_lib1.dart
rename to tests/language_strong/prefix24_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix24_lib2.dart b/tests/language_strong/prefix24_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix24_lib2.dart
rename to tests/language_strong/prefix24_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix24_lib3.dart b/tests/language_strong/prefix24_lib3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix24_lib3.dart
rename to tests/language_strong/prefix24_lib3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix24_test.dart b/tests/language_strong/prefix24_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix24_test.dart
rename to tests/language_strong/prefix24_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix2_negative_test.dart b/tests/language_strong/prefix2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix2_negative_test.dart
rename to tests/language_strong/prefix2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix3_negative_test.dart b/tests/language_strong/prefix3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix3_negative_test.dart
rename to tests/language_strong/prefix3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix4_negative_test.dart b/tests/language_strong/prefix4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix4_negative_test.dart
rename to tests/language_strong/prefix4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix5_negative_test.dart b/tests/language_strong/prefix5_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix5_negative_test.dart
rename to tests/language_strong/prefix5_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix6_negative_test.dart b/tests/language_strong/prefix6_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix6_negative_test.dart
rename to tests/language_strong/prefix6_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix7_negative_test.dart b/tests/language_strong/prefix7_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix7_negative_test.dart
rename to tests/language_strong/prefix7_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix8_negative_test.dart b/tests/language_strong/prefix8_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix8_negative_test.dart
rename to tests/language_strong/prefix8_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix_assignment_test.dart b/tests/language_strong/prefix_assignment_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix_assignment_test.dart
rename to tests/language_strong/prefix_assignment_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix_identifier_reference_test.dart b/tests/language_strong/prefix_identifier_reference_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix_identifier_reference_test.dart
rename to tests/language_strong/prefix_identifier_reference_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix_new_test.dart b/tests/language_strong/prefix_new_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix_new_test.dart
rename to tests/language_strong/prefix_new_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix_new_test1.dart b/tests/language_strong/prefix_new_test1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix_new_test1.dart
rename to tests/language_strong/prefix_new_test1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix_new_test2.dart b/tests/language_strong/prefix_new_test2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix_new_test2.dart
rename to tests/language_strong/prefix_new_test2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix_test.dart b/tests/language_strong/prefix_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix_test.dart
rename to tests/language_strong/prefix_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix_test1.dart b/tests/language_strong/prefix_test1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix_test1.dart
rename to tests/language_strong/prefix_test1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix_test2.dart b/tests/language_strong/prefix_test2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix_test2.dart
rename to tests/language_strong/prefix_test2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/prefix_unqualified_invocation_test.dart b/tests/language_strong/prefix_unqualified_invocation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/prefix_unqualified_invocation_test.dart
rename to tests/language_strong/prefix_unqualified_invocation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private1.dart b/tests/language_strong/private1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private1.dart
rename to tests/language_strong/private1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private2.dart b/tests/language_strong/private2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private2.dart
rename to tests/language_strong/private2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private2_lib.dart b/tests/language_strong/private2_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private2_lib.dart
rename to tests/language_strong/private2_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private2_lib.lib b/tests/language_strong/private2_lib.lib
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private2_lib.lib
rename to tests/language_strong/private2_lib.lib
diff --git a/pkg/dev_compiler/test/codegen/language/private2_main.dart b/tests/language_strong/private2_main.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private2_main.dart
rename to tests/language_strong/private2_main.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private2_test.dart b/tests/language_strong/private2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private2_test.dart
rename to tests/language_strong/private2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private3.dart b/tests/language_strong/private3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private3.dart
rename to tests/language_strong/private3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private3_test.dart b/tests/language_strong/private3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private3_test.dart
rename to tests/language_strong/private3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private4_test.dart b/tests/language_strong/private4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private4_test.dart
rename to tests/language_strong/private4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_access_lib.dart b/tests/language_strong/private_access_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_access_lib.dart
rename to tests/language_strong/private_access_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_access_test.dart b/tests/language_strong/private_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_access_test.dart
rename to tests/language_strong/private_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_clash_lib.dart b/tests/language_strong/private_clash_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_clash_lib.dart
rename to tests/language_strong/private_clash_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_clash_test.dart b/tests/language_strong/private_clash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_clash_test.dart
rename to tests/language_strong/private_clash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_lib b/tests/language_strong/private_lib
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_lib
rename to tests/language_strong/private_lib
diff --git a/pkg/dev_compiler/test/codegen/language/private_lib.dart b/tests/language_strong/private_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_lib.dart
rename to tests/language_strong/private_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_main.dart b/tests/language_strong/private_main.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_main.dart
rename to tests/language_strong/private_main.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_member1_lib_b.dart b/tests/language_strong/private_member1_lib_b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_member1_lib_b.dart
rename to tests/language_strong/private_member1_lib_b.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_member1_negative_test.dart b/tests/language_strong/private_member1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_member1_negative_test.dart
rename to tests/language_strong/private_member1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_member2_lib_b.dart b/tests/language_strong/private_member2_lib_b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_member2_lib_b.dart
rename to tests/language_strong/private_member2_lib_b.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_member2_negative_test.dart b/tests/language_strong/private_member2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_member2_negative_test.dart
rename to tests/language_strong/private_member2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_member3_lib_b.dart b/tests/language_strong/private_member3_lib_b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_member3_lib_b.dart
rename to tests/language_strong/private_member3_lib_b.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_member3_negative_test.dart b/tests/language_strong/private_member3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_member3_negative_test.dart
rename to tests/language_strong/private_member3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_member_lib_b.dart b/tests/language_strong/private_member_lib_b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_member_lib_b.dart
rename to tests/language_strong/private_member_lib_b.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_member_test.dart b/tests/language_strong/private_member_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_member_test.dart
rename to tests/language_strong/private_member_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_mixin2_test.dart b/tests/language_strong/private_mixin2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_mixin2_test.dart
rename to tests/language_strong/private_mixin2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_mixin_exception_throw_test.dart b/tests/language_strong/private_mixin_exception_throw_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_mixin_exception_throw_test.dart
rename to tests/language_strong/private_mixin_exception_throw_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_other.dart b/tests/language_strong/private_other.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_other.dart
rename to tests/language_strong/private_other.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_other.lib b/tests/language_strong/private_other.lib
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_other.lib
rename to tests/language_strong/private_other.lib
diff --git a/pkg/dev_compiler/test/codegen/language/private_other_mixin2.lib b/tests/language_strong/private_other_mixin2.lib
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_other_mixin2.lib
rename to tests/language_strong/private_other_mixin2.lib
diff --git a/pkg/dev_compiler/test/codegen/language/private_selector_lib.dart b/tests/language_strong/private_selector_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_selector_lib.dart
rename to tests/language_strong/private_selector_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_selector_test.dart b/tests/language_strong/private_selector_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_selector_test.dart
rename to tests/language_strong/private_selector_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/private_test.dart b/tests/language_strong/private_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/private_test.dart
rename to tests/language_strong/private_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/propagate_past_constant_test.dart b/tests/language_strong/propagate_past_constant_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/propagate_past_constant_test.dart
rename to tests/language_strong/propagate_past_constant_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/propagated_argument_type_check_test.dart b/tests/language_strong/propagated_argument_type_check_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/propagated_argument_type_check_test.dart
rename to tests/language_strong/propagated_argument_type_check_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/property_field_override_test.dart b/tests/language_strong/property_field_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/property_field_override_test.dart
rename to tests/language_strong/property_field_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/proxy2_test.dart b/tests/language_strong/proxy2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/proxy2_test.dart
rename to tests/language_strong/proxy2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/proxy3_test.dart b/tests/language_strong/proxy3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/proxy3_test.dart
rename to tests/language_strong/proxy3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/proxy_test.dart b/tests/language_strong/proxy_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/proxy_test.dart
rename to tests/language_strong/proxy_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/pure_function2_test.dart b/tests/language_strong/pure_function2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/pure_function2_test.dart
rename to tests/language_strong/pure_function2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/pure_function_test.dart b/tests/language_strong/pure_function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/pure_function_test.dart
rename to tests/language_strong/pure_function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/range_analysis2_test.dart b/tests/language_strong/range_analysis2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/range_analysis2_test.dart
rename to tests/language_strong/range_analysis2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/range_analysis3_test.dart b/tests/language_strong/range_analysis3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/range_analysis3_test.dart
rename to tests/language_strong/range_analysis3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/range_analysis_test.dart b/tests/language_strong/range_analysis_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/range_analysis_test.dart
rename to tests/language_strong/range_analysis_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/raw_string_test.dart b/tests/language_strong/raw_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/raw_string_test.dart
rename to tests/language_strong/raw_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/readuntil_test.dat b/tests/language_strong/readuntil_test.dat
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/readuntil_test.dat
rename to tests/language_strong/readuntil_test.dat
diff --git a/pkg/dev_compiler/test/codegen/language/recursive_calls_test.dart b/tests/language_strong/recursive_calls_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/recursive_calls_test.dart
rename to tests/language_strong/recursive_calls_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/recursive_generic_test.dart b/tests/language_strong/recursive_generic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/recursive_generic_test.dart
rename to tests/language_strong/recursive_generic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/recursive_inheritance_test.dart b/tests/language_strong/recursive_inheritance_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/recursive_inheritance_test.dart
rename to tests/language_strong/recursive_inheritance_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/recursive_loop_phis_test.dart b/tests/language_strong/recursive_loop_phis_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/recursive_loop_phis_test.dart
rename to tests/language_strong/recursive_loop_phis_test.dart
diff --git a/tests/language_strong/recursive_mixin_test.dart b/tests/language_strong/recursive_mixin_test.dart
new file mode 100644
index 0000000..b2c1e3c
--- /dev/null
+++ b/tests/language_strong/recursive_mixin_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "package:expect/expect.dart";
+
+class A<T> {
+  bool foo(T x) => true;
+}
+
+class B extends Object with A<B> {}
+
+main() {
+  var b = new B();
+  Expect.isTrue(b is B);
+  Expect.isTrue(b is A);
+
+  // Verify that runtime checking enforces A<B> instead of A
+  dynamic d = b;
+  Expect.isTrue(d.foo(b));
+  Expect.throws(() => d.foo(42));
+}
diff --git a/pkg/dev_compiler/test/codegen/language/redirecting_constructor_initializer_test.dart b/tests/language_strong/redirecting_constructor_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/redirecting_constructor_initializer_test.dart
rename to tests/language_strong/redirecting_constructor_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/redirecting_factory_default_values_test.dart b/tests/language_strong/redirecting_factory_default_values_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/redirecting_factory_default_values_test.dart
rename to tests/language_strong/redirecting_factory_default_values_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/redirecting_factory_incompatible_signature_test.dart b/tests/language_strong/redirecting_factory_incompatible_signature_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/redirecting_factory_incompatible_signature_test.dart
rename to tests/language_strong/redirecting_factory_incompatible_signature_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/redirecting_factory_infinite_steps_test.dart b/tests/language_strong/redirecting_factory_infinite_steps_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/redirecting_factory_infinite_steps_test.dart
rename to tests/language_strong/redirecting_factory_infinite_steps_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/redirecting_factory_long_test.dart b/tests/language_strong/redirecting_factory_long_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/redirecting_factory_long_test.dart
rename to tests/language_strong/redirecting_factory_long_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/redirecting_factory_malbounded_test.dart b/tests/language_strong/redirecting_factory_malbounded_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/redirecting_factory_malbounded_test.dart
rename to tests/language_strong/redirecting_factory_malbounded_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/redirecting_factory_reflection_test.dart b/tests/language_strong/redirecting_factory_reflection_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/redirecting_factory_reflection_test.dart
rename to tests/language_strong/redirecting_factory_reflection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/reexport_core_helper.dart b/tests/language_strong/reexport_core_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/reexport_core_helper.dart
rename to tests/language_strong/reexport_core_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/language/reexport_core_test.dart b/tests/language_strong/reexport_core_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/reexport_core_test.dart
rename to tests/language_strong/reexport_core_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/ref_before_declaration_test.dart b/tests/language_strong/ref_before_declaration_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/ref_before_declaration_test.dart
rename to tests/language_strong/ref_before_declaration_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/refine_receiver_null_test.dart b/tests/language_strong/refine_receiver_null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/refine_receiver_null_test.dart
rename to tests/language_strong/refine_receiver_null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/reg_ex2_test.dart b/tests/language_strong/reg_ex2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/reg_ex2_test.dart
rename to tests/language_strong/reg_ex2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/reg_exp2_test.dart b/tests/language_strong/reg_exp2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/reg_exp2_test.dart
rename to tests/language_strong/reg_exp2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/reg_exp3_test.dart b/tests/language_strong/reg_exp3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/reg_exp3_test.dart
rename to tests/language_strong/reg_exp3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/reg_exp_test.dart b/tests/language_strong/reg_exp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/reg_exp_test.dart
rename to tests/language_strong/reg_exp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_10996_lib.dart b/tests/language_strong/regress_10996_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_10996_lib.dart
rename to tests/language_strong/regress_10996_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_10996_test.dart b/tests/language_strong/regress_10996_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_10996_test.dart
rename to tests/language_strong/regress_10996_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_11010_test.dart b/tests/language_strong/regress_11010_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_11010_test.dart
rename to tests/language_strong/regress_11010_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_11800_test.dart b/tests/language_strong/regress_11800_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_11800_test.dart
rename to tests/language_strong/regress_11800_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_12561_test.dart b/tests/language_strong/regress_12561_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_12561_test.dart
rename to tests/language_strong/regress_12561_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_12615_test.dart b/tests/language_strong/regress_12615_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_12615_test.dart
rename to tests/language_strong/regress_12615_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_13462_0_test.dart b/tests/language_strong/regress_13462_0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_13462_0_test.dart
rename to tests/language_strong/regress_13462_0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_13462_1_test.dart b/tests/language_strong/regress_13462_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_13462_1_test.dart
rename to tests/language_strong/regress_13462_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_13494_test.dart b/tests/language_strong/regress_13494_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_13494_test.dart
rename to tests/language_strong/regress_13494_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_14105_test.dart b/tests/language_strong/regress_14105_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_14105_test.dart
rename to tests/language_strong/regress_14105_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_14348_test.dart b/tests/language_strong/regress_14348_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_14348_test.dart
rename to tests/language_strong/regress_14348_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_16640_test.dart b/tests/language_strong/regress_16640_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_16640_test.dart
rename to tests/language_strong/regress_16640_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_17382_test.dart b/tests/language_strong/regress_17382_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_17382_test.dart
rename to tests/language_strong/regress_17382_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_18435_test.dart b/tests/language_strong/regress_18435_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_18435_test.dart
rename to tests/language_strong/regress_18435_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_18535_test.dart b/tests/language_strong/regress_18535_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_18535_test.dart
rename to tests/language_strong/regress_18535_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_18865_test.dart b/tests/language_strong/regress_18865_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_18865_test.dart
rename to tests/language_strong/regress_18865_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_19413_bar.dart b/tests/language_strong/regress_19413_bar.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_19413_bar.dart
rename to tests/language_strong/regress_19413_bar.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_19413_foo.dart b/tests/language_strong/regress_19413_foo.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_19413_foo.dart
rename to tests/language_strong/regress_19413_foo.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_19413_test.dart b/tests/language_strong/regress_19413_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_19413_test.dart
rename to tests/language_strong/regress_19413_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_19728_test.dart b/tests/language_strong/regress_19728_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_19728_test.dart
rename to tests/language_strong/regress_19728_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_20074_test.dart b/tests/language_strong/regress_20074_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_20074_test.dart
rename to tests/language_strong/regress_20074_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_20394_lib.dart b/tests/language_strong/regress_20394_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_20394_lib.dart
rename to tests/language_strong/regress_20394_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_20394_test.dart b/tests/language_strong/regress_20394_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_20394_test.dart
rename to tests/language_strong/regress_20394_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_20840_test.dart b/tests/language_strong/regress_20840_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_20840_test.dart
rename to tests/language_strong/regress_20840_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21016_test.dart b/tests/language_strong/regress_21016_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21016_test.dart
rename to tests/language_strong/regress_21016_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21793_test.dart b/tests/language_strong/regress_21793_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21793_test.dart
rename to tests/language_strong/regress_21793_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21795_test.dart b/tests/language_strong/regress_21795_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21795_test.dart
rename to tests/language_strong/regress_21795_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21912_test.dart b/tests/language_strong/regress_21912_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21912_test.dart
rename to tests/language_strong/regress_21912_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21998_1_test.dart b/tests/language_strong/regress_21998_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21998_1_test.dart
rename to tests/language_strong/regress_21998_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21998_2_test.dart b/tests/language_strong/regress_21998_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21998_2_test.dart
rename to tests/language_strong/regress_21998_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21998_3_test.dart b/tests/language_strong/regress_21998_3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21998_3_test.dart
rename to tests/language_strong/regress_21998_3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21998_4_test.dart b/tests/language_strong/regress_21998_4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21998_4_test.dart
rename to tests/language_strong/regress_21998_4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21998_lib1.dart b/tests/language_strong/regress_21998_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21998_lib1.dart
rename to tests/language_strong/regress_21998_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21998_lib2.dart b/tests/language_strong/regress_21998_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21998_lib2.dart
rename to tests/language_strong/regress_21998_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_21998_lib3.dart b/tests/language_strong/regress_21998_lib3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_21998_lib3.dart
rename to tests/language_strong/regress_21998_lib3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22438_test.dart b/tests/language_strong/regress_22438_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22438_test.dart
rename to tests/language_strong/regress_22438_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22443_lib.dart b/tests/language_strong/regress_22443_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22443_lib.dart
rename to tests/language_strong/regress_22443_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22443_test.dart b/tests/language_strong/regress_22443_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22443_test.dart
rename to tests/language_strong/regress_22443_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22445_test.dart b/tests/language_strong/regress_22445_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22445_test.dart
rename to tests/language_strong/regress_22445_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22579_test.dart b/tests/language_strong/regress_22579_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22579_test.dart
rename to tests/language_strong/regress_22579_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22666_test.dart b/tests/language_strong/regress_22666_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22666_test.dart
rename to tests/language_strong/regress_22666_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22700_test.dart b/tests/language_strong/regress_22700_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22700_test.dart
rename to tests/language_strong/regress_22700_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22719_test.dart b/tests/language_strong/regress_22719_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22719_test.dart
rename to tests/language_strong/regress_22719_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22728_test.dart b/tests/language_strong/regress_22728_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22728_test.dart
rename to tests/language_strong/regress_22728_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22777_test.dart b/tests/language_strong/regress_22777_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22777_test.dart
rename to tests/language_strong/regress_22777_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22822_test.dart b/tests/language_strong/regress_22822_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22822_test.dart
rename to tests/language_strong/regress_22822_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22858_test.dart b/tests/language_strong/regress_22858_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22858_test.dart
rename to tests/language_strong/regress_22858_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22936_test.dart b/tests/language_strong/regress_22936_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22936_test.dart
rename to tests/language_strong/regress_22936_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_22976_test.dart b/tests/language_strong/regress_22976_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_22976_test.dart
rename to tests/language_strong/regress_22976_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23038_test.dart b/tests/language_strong/regress_23038_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23038_test.dart
rename to tests/language_strong/regress_23038_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23046_test.dart b/tests/language_strong/regress_23046_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23046_test.dart
rename to tests/language_strong/regress_23046_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23051_test.dart b/tests/language_strong/regress_23051_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23051_test.dart
rename to tests/language_strong/regress_23051_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23089_test.dart b/tests/language_strong/regress_23089_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23089_test.dart
rename to tests/language_strong/regress_23089_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23408_lib.dart b/tests/language_strong/regress_23408_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23408_lib.dart
rename to tests/language_strong/regress_23408_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23408_test.dart b/tests/language_strong/regress_23408_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23408_test.dart
rename to tests/language_strong/regress_23408_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23498_test.dart b/tests/language_strong/regress_23498_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23498_test.dart
rename to tests/language_strong/regress_23498_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23500_test.dart b/tests/language_strong/regress_23500_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23500_test.dart
rename to tests/language_strong/regress_23500_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23537_test.dart b/tests/language_strong/regress_23537_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23537_test.dart
rename to tests/language_strong/regress_23537_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_23650_test.dart b/tests/language_strong/regress_23650_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_23650_test.dart
rename to tests/language_strong/regress_23650_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/regress_r24720_test.dart b/tests/language_strong/regress_r24720_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/regress_r24720_test.dart
rename to tests/language_strong/regress_r24720_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/reify_typevar_static_test.dart b/tests/language_strong/reify_typevar_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/reify_typevar_static_test.dart
rename to tests/language_strong/reify_typevar_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/reify_typevar_test.dart b/tests/language_strong/reify_typevar_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/reify_typevar_test.dart
rename to tests/language_strong/reify_typevar_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/resolution_test.dart b/tests/language_strong/resolution_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/resolution_test.dart
rename to tests/language_strong/resolution_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/resolve_test.dart b/tests/language_strong/resolve_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/resolve_test.dart
rename to tests/language_strong/resolve_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rethrow_test.dart b/tests/language_strong/rethrow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rethrow_test.dart
rename to tests/language_strong/rethrow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/return_in_loop_test.dart b/tests/language_strong/return_in_loop_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/return_in_loop_test.dart
rename to tests/language_strong/return_in_loop_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/return_this_type_test.dart b/tests/language_strong/return_this_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/return_this_type_test.dart
rename to tests/language_strong/return_this_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/return_type_test.dart b/tests/language_strong/return_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/return_type_test.dart
rename to tests/language_strong/return_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_assign_test.dart b/tests/language_strong/rewrite_assign_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_assign_test.dart
rename to tests/language_strong/rewrite_assign_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_compound_assign_test.dart b/tests/language_strong/rewrite_compound_assign_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_compound_assign_test.dart
rename to tests/language_strong/rewrite_compound_assign_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_conditional_test.dart b/tests/language_strong/rewrite_conditional_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_conditional_test.dart
rename to tests/language_strong/rewrite_conditional_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_for_update_order_test.dart b/tests/language_strong/rewrite_for_update_order_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_for_update_order_test.dart
rename to tests/language_strong/rewrite_for_update_order_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_if_empty_then_test.dart b/tests/language_strong/rewrite_if_empty_then_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_if_empty_then_test.dart
rename to tests/language_strong/rewrite_if_empty_then_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_if_return_test.dart b/tests/language_strong/rewrite_if_return_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_if_return_test.dart
rename to tests/language_strong/rewrite_if_return_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_if_swap_test.dart b/tests/language_strong/rewrite_if_swap_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_if_swap_test.dart
rename to tests/language_strong/rewrite_if_swap_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_implicit_this_test.dart b/tests/language_strong/rewrite_implicit_this_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_implicit_this_test.dart
rename to tests/language_strong/rewrite_implicit_this_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_logical_test.dart b/tests/language_strong/rewrite_logical_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_logical_test.dart
rename to tests/language_strong/rewrite_logical_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_nested_if1_test.dart b/tests/language_strong/rewrite_nested_if1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_nested_if1_test.dart
rename to tests/language_strong/rewrite_nested_if1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_nested_if2_test.dart b/tests/language_strong/rewrite_nested_if2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_nested_if2_test.dart
rename to tests/language_strong/rewrite_nested_if2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_nested_if3_test.dart b/tests/language_strong/rewrite_nested_if3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_nested_if3_test.dart
rename to tests/language_strong/rewrite_nested_if3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_swap_test.dart b/tests/language_strong/rewrite_swap_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_swap_test.dart
rename to tests/language_strong/rewrite_swap_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_variable_initializer_test.dart b/tests/language_strong/rewrite_variable_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_variable_initializer_test.dart
rename to tests/language_strong/rewrite_variable_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_while_many_exits_test.dart b/tests/language_strong/rewrite_while_many_exits_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_while_many_exits_test.dart
rename to tests/language_strong/rewrite_while_many_exits_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/rewrite_while_test.dart b/tests/language_strong/rewrite_while_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/rewrite_while_test.dart
rename to tests/language_strong/rewrite_while_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/round_test.dart b/tests/language_strong/round_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/round_test.dart
rename to tests/language_strong/round_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/runtime_type_test.dart b/tests/language_strong/runtime_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/runtime_type_test.dart
rename to tests/language_strong/runtime_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/savannah_test.dart b/tests/language_strong/savannah_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/savannah_test.dart
rename to tests/language_strong/savannah_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/scanner_test.dart b/tests/language_strong/scanner_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/scanner_test.dart
rename to tests/language_strong/scanner_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/scope_variable_test.dart b/tests/language_strong/scope_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/scope_variable_test.dart
rename to tests/language_strong/scope_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/scoped_variables_try_catch_test.dart b/tests/language_strong/scoped_variables_try_catch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/scoped_variables_try_catch_test.dart
rename to tests/language_strong/scoped_variables_try_catch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/script1_negative_lib.dart b/tests/language_strong/script1_negative_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/script1_negative_lib.dart
rename to tests/language_strong/script1_negative_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/script1_negative_test.dart b/tests/language_strong/script1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/script1_negative_test.dart
rename to tests/language_strong/script1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/script2_negative_lib.dart b/tests/language_strong/script2_negative_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/script2_negative_lib.dart
rename to tests/language_strong/script2_negative_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/script2_negative_source.dart b/tests/language_strong/script2_negative_source.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/script2_negative_source.dart
rename to tests/language_strong/script2_negative_source.dart
diff --git a/pkg/dev_compiler/test/codegen/language/script2_negative_test.dart b/tests/language_strong/script2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/script2_negative_test.dart
rename to tests/language_strong/script2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/script_lib.dart b/tests/language_strong/script_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/script_lib.dart
rename to tests/language_strong/script_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/language/script_source.dart b/tests/language_strong/script_source.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/script_source.dart
rename to tests/language_strong/script_source.dart
diff --git a/pkg/dev_compiler/test/codegen/language/second_test.dart b/tests/language_strong/second_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/second_test.dart
rename to tests/language_strong/second_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter0_test.dart b/tests/language_strong/setter0_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter0_test.dart
rename to tests/language_strong/setter0_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter1_test.dart b/tests/language_strong/setter1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter1_test.dart
rename to tests/language_strong/setter1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter2_test.dart b/tests/language_strong/setter2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter2_test.dart
rename to tests/language_strong/setter2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter3_test.dart b/tests/language_strong/setter3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter3_test.dart
rename to tests/language_strong/setter3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter4_test.dart b/tests/language_strong/setter4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter4_test.dart
rename to tests/language_strong/setter4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter_declaration2_negative_test.dart b/tests/language_strong/setter_declaration2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter_declaration2_negative_test.dart
rename to tests/language_strong/setter_declaration2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter_declaration_negative_test.dart b/tests/language_strong/setter_declaration_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter_declaration_negative_test.dart
rename to tests/language_strong/setter_declaration_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter_no_getter_call_test.dart b/tests/language_strong/setter_no_getter_call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter_no_getter_call_test.dart
rename to tests/language_strong/setter_no_getter_call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter_no_getter_test.dart b/tests/language_strong/setter_no_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter_no_getter_test.dart
rename to tests/language_strong/setter_no_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter_override2_test.dart b/tests/language_strong/setter_override2_test.dart
similarity index 89%
rename from pkg/dev_compiler/test/codegen/language/setter_override2_test.dart
rename to tests/language_strong/setter_override2_test.dart
index e5ac9d0..d54f747 100644
--- a/pkg/dev_compiler/test/codegen/language/setter_override2_test.dart
+++ b/tests/language_strong/setter_override2_test.dart
@@ -7,9 +7,10 @@
 // named foo, or an instance setter named foo=.
 
 import "package:expect/expect.dart";
+import "package:meta/meta.dart" show virtual;
 
 class A {
-  var foo = 42;  /// 00: ok
+  @virtual var foo = 42;  /// 00: ok
   get foo => 42;  /// 01: ok
   foo() => 42;  /// 02: ok
   set foo(value) { }  /// 03: ok
diff --git a/pkg/dev_compiler/test/codegen/language/setter_override3_test.dart b/tests/language_strong/setter_override3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter_override3_test.dart
rename to tests/language_strong/setter_override3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/setter_override_test.dart b/tests/language_strong/setter_override_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/setter_override_test.dart
rename to tests/language_strong/setter_override_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/side_effect_throw_test.dart b/tests/language_strong/side_effect_throw_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/side_effect_throw_test.dart
rename to tests/language_strong/side_effect_throw_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/skip_expression_test.dart b/tests/language_strong/skip_expression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/skip_expression_test.dart
rename to tests/language_strong/skip_expression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/smaller_4_Interface_Types_A11_t01_test.dart b/tests/language_strong/smaller_4_Interface_Types_A11_t01_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/smaller_4_Interface_Types_A11_t01_test.dart
rename to tests/language_strong/smaller_4_Interface_Types_A11_t01_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/smaller_4_Interface_Types_A11_t02_test.dart b/tests/language_strong/smaller_4_Interface_Types_A11_t02_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/smaller_4_Interface_Types_A11_t02_test.dart
rename to tests/language_strong/smaller_4_Interface_Types_A11_t02_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/smi_type_test.dart b/tests/language_strong/smi_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/smi_type_test.dart
rename to tests/language_strong/smi_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/source_self_negative_test.dart b/tests/language_strong/source_self_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/source_self_negative_test.dart
rename to tests/language_strong/source_self_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/stack_overflow_stacktrace_test.dart b/tests/language_strong/stack_overflow_stacktrace_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/stack_overflow_stacktrace_test.dart
rename to tests/language_strong/stack_overflow_stacktrace_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/stack_overflow_test.dart b/tests/language_strong/stack_overflow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/stack_overflow_test.dart
rename to tests/language_strong/stack_overflow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/stack_trace_test.dart b/tests/language_strong/stack_trace_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/stack_trace_test.dart
rename to tests/language_strong/stack_trace_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/stacktrace_rethrow_error_test.dart b/tests/language_strong/stacktrace_rethrow_error_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/stacktrace_rethrow_error_test.dart
rename to tests/language_strong/stacktrace_rethrow_error_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/stacktrace_rethrow_nonerror_test.dart b/tests/language_strong/stacktrace_rethrow_nonerror_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/stacktrace_rethrow_nonerror_test.dart
rename to tests/language_strong/stacktrace_rethrow_nonerror_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/stacktrace_test.dart b/tests/language_strong/stacktrace_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/stacktrace_test.dart
rename to tests/language_strong/stacktrace_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/state_mangling2_test.dart b/tests/language_strong/state_mangling2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/state_mangling2_test.dart
rename to tests/language_strong/state_mangling2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/state_mangling3_test.dart b/tests/language_strong/state_mangling3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/state_mangling3_test.dart
rename to tests/language_strong/state_mangling3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/state_mangling4_test.dart b/tests/language_strong/state_mangling4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/state_mangling4_test.dart
rename to tests/language_strong/state_mangling4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/state_mangling_test.dart b/tests/language_strong/state_mangling_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/state_mangling_test.dart
rename to tests/language_strong/state_mangling_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/statement_test.dart b/tests/language_strong/statement_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/statement_test.dart
rename to tests/language_strong/statement_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_call_wrong_argument_count_negative_test.dart b/tests/language_strong/static_call_wrong_argument_count_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_call_wrong_argument_count_negative_test.dart
rename to tests/language_strong/static_call_wrong_argument_count_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_closure_identical_test.dart b/tests/language_strong/static_closure_identical_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_closure_identical_test.dart
rename to tests/language_strong/static_closure_identical_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_const_field_reserved_name_test.dart b/tests/language_strong/static_const_field_reserved_name_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_const_field_reserved_name_test.dart
rename to tests/language_strong/static_const_field_reserved_name_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_const_field_test.dart b/tests/language_strong/static_const_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_const_field_test.dart
rename to tests/language_strong/static_const_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_field1_test.dart b/tests/language_strong/static_field1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_field1_test.dart
rename to tests/language_strong/static_field1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_field1a_test.dart b/tests/language_strong/static_field1a_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_field1a_test.dart
rename to tests/language_strong/static_field1a_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_field2_test.dart b/tests/language_strong/static_field2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_field2_test.dart
rename to tests/language_strong/static_field2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_field2a_test.dart b/tests/language_strong/static_field2a_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_field2a_test.dart
rename to tests/language_strong/static_field2a_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_field3_test.dart b/tests/language_strong/static_field3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_field3_test.dart
rename to tests/language_strong/static_field3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_field_override1_test.dart b/tests/language_strong/static_field_override1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_field_override1_test.dart
rename to tests/language_strong/static_field_override1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_field_override2_test.dart b/tests/language_strong/static_field_override2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_field_override2_test.dart
rename to tests/language_strong/static_field_override2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_field_override3_test.dart b/tests/language_strong/static_field_override3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_field_override3_test.dart
rename to tests/language_strong/static_field_override3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_field_test.dart b/tests/language_strong/static_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_field_test.dart
rename to tests/language_strong/static_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_final_field2_test.dart b/tests/language_strong/static_final_field2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_final_field2_test.dart
rename to tests/language_strong/static_final_field2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_getter_no_setter1_test.dart b/tests/language_strong/static_getter_no_setter1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_getter_no_setter1_test.dart
rename to tests/language_strong/static_getter_no_setter1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_getter_no_setter2_test.dart b/tests/language_strong/static_getter_no_setter2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_getter_no_setter2_test.dart
rename to tests/language_strong/static_getter_no_setter2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_getter_no_setter3_test.dart b/tests/language_strong/static_getter_no_setter3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_getter_no_setter3_test.dart
rename to tests/language_strong/static_getter_no_setter3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_implicit_closure_test.dart b/tests/language_strong/static_implicit_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_implicit_closure_test.dart
rename to tests/language_strong/static_implicit_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_initializer_type_error_test.dart b/tests/language_strong/static_initializer_type_error_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_initializer_type_error_test.dart
rename to tests/language_strong/static_initializer_type_error_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_inline_test.dart b/tests/language_strong/static_inline_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_inline_test.dart
rename to tests/language_strong/static_inline_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_parameter_test.dart b/tests/language_strong/static_parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_parameter_test.dart
rename to tests/language_strong/static_parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_postfix_operator_test.dart b/tests/language_strong/static_postfix_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_postfix_operator_test.dart
rename to tests/language_strong/static_postfix_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_setter_get_test.dart b/tests/language_strong/static_setter_get_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_setter_get_test.dart
rename to tests/language_strong/static_setter_get_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/static_top_level_test.dart b/tests/language_strong/static_top_level_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/static_top_level_test.dart
rename to tests/language_strong/static_top_level_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/strict_equal_test.dart b/tests/language_strong/strict_equal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/strict_equal_test.dart
rename to tests/language_strong/strict_equal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_charcode_test.dart b/tests/language_strong/string_charcode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_charcode_test.dart
rename to tests/language_strong/string_charcode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_escape2_negative_test_helper.dart b/tests/language_strong/string_escape2_negative_test_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_escape2_negative_test_helper.dart
rename to tests/language_strong/string_escape2_negative_test_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_escape3_negative_test_helper.dart b/tests/language_strong/string_escape3_negative_test_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_escape3_negative_test_helper.dart
rename to tests/language_strong/string_escape3_negative_test_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_escape4_negative_test.dart b/tests/language_strong/string_escape4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_escape4_negative_test.dart
rename to tests/language_strong/string_escape4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_escapes_test.dart b/tests/language_strong/string_escapes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_escapes_test.dart
rename to tests/language_strong/string_escapes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolate1_negative_test.dart b/tests/language_strong/string_interpolate1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolate1_negative_test.dart
rename to tests/language_strong/string_interpolate1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolate2_negative_test.dart b/tests/language_strong/string_interpolate2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolate2_negative_test.dart
rename to tests/language_strong/string_interpolate2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolate2_test.dart b/tests/language_strong/string_interpolate2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolate2_test.dart
rename to tests/language_strong/string_interpolate2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolate_null_test.dart b/tests/language_strong/string_interpolate_null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolate_null_test.dart
rename to tests/language_strong/string_interpolate_null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolate_test.dart b/tests/language_strong/string_interpolate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolate_test.dart
rename to tests/language_strong/string_interpolate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation1_negative_test.dart b/tests/language_strong/string_interpolation1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation1_negative_test.dart
rename to tests/language_strong/string_interpolation1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation2_negative_test.dart b/tests/language_strong/string_interpolation2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation2_negative_test.dart
rename to tests/language_strong/string_interpolation2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation3_negative_test.dart b/tests/language_strong/string_interpolation3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation3_negative_test.dart
rename to tests/language_strong/string_interpolation3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation4_negative_test.dart b/tests/language_strong/string_interpolation4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation4_negative_test.dart
rename to tests/language_strong/string_interpolation4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation5_negative_test.dart b/tests/language_strong/string_interpolation5_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation5_negative_test.dart
rename to tests/language_strong/string_interpolation5_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation6_negative_test.dart b/tests/language_strong/string_interpolation6_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation6_negative_test.dart
rename to tests/language_strong/string_interpolation6_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation7_test.dart b/tests/language_strong/string_interpolation7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation7_test.dart
rename to tests/language_strong/string_interpolation7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation8_test.dart b/tests/language_strong/string_interpolation8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation8_test.dart
rename to tests/language_strong/string_interpolation8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation9_test.dart b/tests/language_strong/string_interpolation9_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation9_test.dart
rename to tests/language_strong/string_interpolation9_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation_and_buffer_test.dart b/tests/language_strong/string_interpolation_and_buffer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation_and_buffer_test.dart
rename to tests/language_strong/string_interpolation_and_buffer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation_newline_test.dart b/tests/language_strong/string_interpolation_newline_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation_newline_test.dart
rename to tests/language_strong/string_interpolation_newline_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_interpolation_test.dart b/tests/language_strong/string_interpolation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_interpolation_test.dart
rename to tests/language_strong/string_interpolation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_intrinsics_test.dart b/tests/language_strong/string_intrinsics_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_intrinsics_test.dart
rename to tests/language_strong/string_intrinsics_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_join_test.dart b/tests/language_strong/string_join_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_join_test.dart
rename to tests/language_strong/string_join_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_no_operator_test.dart b/tests/language_strong/string_no_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_no_operator_test.dart
rename to tests/language_strong/string_no_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_optimizations_test.dart b/tests/language_strong/string_optimizations_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_optimizations_test.dart
rename to tests/language_strong/string_optimizations_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_overflow.dart b/tests/language_strong/string_overflow.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_overflow.dart
rename to tests/language_strong/string_overflow.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_split_test.dart b/tests/language_strong/string_split_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_split_test.dart
rename to tests/language_strong/string_split_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_supertype_checked_test.dart b/tests/language_strong/string_supertype_checked_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_supertype_checked_test.dart
rename to tests/language_strong/string_supertype_checked_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_test.dart b/tests/language_strong/string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_test.dart
rename to tests/language_strong/string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_unicode1_negative_test.dart b/tests/language_strong/string_unicode1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_unicode1_negative_test.dart
rename to tests/language_strong/string_unicode1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_unicode2_negative_test.dart b/tests/language_strong/string_unicode2_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_unicode2_negative_test.dart
rename to tests/language_strong/string_unicode2_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_unicode3_negative_test.dart b/tests/language_strong/string_unicode3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_unicode3_negative_test.dart
rename to tests/language_strong/string_unicode3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/string_unicode4_negative_test.dart b/tests/language_strong/string_unicode4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/string_unicode4_negative_test.dart
rename to tests/language_strong/string_unicode4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/sub/sub.dart b/tests/language_strong/sub/sub.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/sub/sub.dart
rename to tests/language_strong/sub/sub.dart
diff --git a/pkg/dev_compiler/test/codegen/language/substring_test.dart b/tests/language_strong/substring_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/substring_test.dart
rename to tests/language_strong/substring_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_abstract_method_test.dart b/tests/language_strong/super_abstract_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_abstract_method_test.dart
rename to tests/language_strong/super_abstract_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_all_named_constructor_test.dart b/tests/language_strong/super_all_named_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_all_named_constructor_test.dart
rename to tests/language_strong/super_all_named_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_assign_test.dart b/tests/language_strong/super_assign_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_assign_test.dart
rename to tests/language_strong/super_assign_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_bound_closure_test.dart b/tests/language_strong/super_bound_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_bound_closure_test.dart
rename to tests/language_strong/super_bound_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_call2_test.dart b/tests/language_strong/super_call2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_call2_test.dart
rename to tests/language_strong/super_call2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_call3_test.dart b/tests/language_strong/super_call3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_call3_test.dart
rename to tests/language_strong/super_call3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_call4_test.dart b/tests/language_strong/super_call4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_call4_test.dart
rename to tests/language_strong/super_call4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_call_test.dart b/tests/language_strong/super_call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_call_test.dart
rename to tests/language_strong/super_call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_closure_test.dart b/tests/language_strong/super_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_closure_test.dart
rename to tests/language_strong/super_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_conditional_operator_test.dart b/tests/language_strong/super_conditional_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_conditional_operator_test.dart
rename to tests/language_strong/super_conditional_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_field_2_test.dart b/tests/language_strong/super_field_2_test.dart
similarity index 96%
rename from pkg/dev_compiler/test/codegen/language/super_field_2_test.dart
rename to tests/language_strong/super_field_2_test.dart
index 7c53c43..304e4ef 100644
--- a/pkg/dev_compiler/test/codegen/language/super_field_2_test.dart
+++ b/tests/language_strong/super_field_2_test.dart
@@ -3,9 +3,10 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import "package:expect/expect.dart";
+import "package:meta/meta.dart" show virtual;
 
 class A {
-  var foo;
+  @virtual var foo;
   A(this.foo);
 
   B_Sfoo() => 'A.B_Sfoo()';
diff --git a/pkg/dev_compiler/test/codegen/language/super_field_access_test.dart b/tests/language_strong/super_field_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_field_access_test.dart
rename to tests/language_strong/super_field_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_field_test.dart b/tests/language_strong/super_field_test.dart
similarity index 93%
rename from pkg/dev_compiler/test/codegen/language/super_field_test.dart
rename to tests/language_strong/super_field_test.dart
index 5d51cb2..15b4671 100644
--- a/pkg/dev_compiler/test/codegen/language/super_field_test.dart
+++ b/tests/language_strong/super_field_test.dart
@@ -4,7 +4,7 @@
 // Dart test for testing super field access.
 
 import "package:expect/expect.dart";
-
+import "package:meta/meta.dart" show virtual;
 
 class A {
   A() {
@@ -13,7 +13,7 @@
   String greeting() {
     return "Gruezi";
   }
-  String city;
+  @virtual String city;
 }
 
 
diff --git a/pkg/dev_compiler/test/codegen/language/super_first_constructor_test.dart b/tests/language_strong/super_first_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_first_constructor_test.dart
rename to tests/language_strong/super_first_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_getter_setter_test.dart b/tests/language_strong/super_getter_setter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_getter_setter_test.dart
rename to tests/language_strong/super_getter_setter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_implicit_closure_test.dart b/tests/language_strong/super_implicit_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_implicit_closure_test.dart
rename to tests/language_strong/super_implicit_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_in_async1_test.dart b/tests/language_strong/super_in_async1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_in_async1_test.dart
rename to tests/language_strong/super_in_async1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_in_async2_test.dart b/tests/language_strong/super_in_async2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_in_async2_test.dart
rename to tests/language_strong/super_in_async2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_in_async3_test.dart b/tests/language_strong/super_in_async3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_in_async3_test.dart
rename to tests/language_strong/super_in_async3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_in_async4_test.dart b/tests/language_strong/super_in_async4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_in_async4_test.dart
rename to tests/language_strong/super_in_async4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_in_async5_test.dart b/tests/language_strong/super_in_async5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_in_async5_test.dart
rename to tests/language_strong/super_in_async5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_in_async6_test.dart b/tests/language_strong/super_in_async6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_in_async6_test.dart
rename to tests/language_strong/super_in_async6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_in_finally_test.dart b/tests/language_strong/super_in_finally_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_in_finally_test.dart
rename to tests/language_strong/super_in_finally_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_inferrer_test.dart b/tests/language_strong/super_inferrer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_inferrer_test.dart
rename to tests/language_strong/super_inferrer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_operator_index2_test.dart b/tests/language_strong/super_operator_index2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_operator_index2_test.dart
rename to tests/language_strong/super_operator_index2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_operator_index3_test.dart b/tests/language_strong/super_operator_index3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_operator_index3_test.dart
rename to tests/language_strong/super_operator_index3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_operator_index4_test.dart b/tests/language_strong/super_operator_index4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_operator_index4_test.dart
rename to tests/language_strong/super_operator_index4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_operator_index5_test.dart b/tests/language_strong/super_operator_index5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_operator_index5_test.dart
rename to tests/language_strong/super_operator_index5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_operator_index6_test.dart b/tests/language_strong/super_operator_index6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_operator_index6_test.dart
rename to tests/language_strong/super_operator_index6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_operator_index7_test.dart b/tests/language_strong/super_operator_index7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_operator_index7_test.dart
rename to tests/language_strong/super_operator_index7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_operator_index8_test.dart b/tests/language_strong/super_operator_index8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_operator_index8_test.dart
rename to tests/language_strong/super_operator_index8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_operator_index_test.dart b/tests/language_strong/super_operator_index_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_operator_index_test.dart
rename to tests/language_strong/super_operator_index_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_operator_test.dart b/tests/language_strong/super_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_operator_test.dart
rename to tests/language_strong/super_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_setter_interceptor_test.dart b/tests/language_strong/super_setter_interceptor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_setter_interceptor_test.dart
rename to tests/language_strong/super_setter_interceptor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_setter_test.dart b/tests/language_strong/super_setter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_setter_test.dart
rename to tests/language_strong/super_setter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/super_test.dart b/tests/language_strong/super_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/super_test.dart
rename to tests/language_strong/super_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch1_negative_test.dart b/tests/language_strong/switch1_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch1_negative_test.dart
rename to tests/language_strong/switch1_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch3_negative_test.dart b/tests/language_strong/switch3_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch3_negative_test.dart
rename to tests/language_strong/switch3_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch4_negative_test.dart b/tests/language_strong/switch4_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch4_negative_test.dart
rename to tests/language_strong/switch4_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch5_negative_test.dart b/tests/language_strong/switch5_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch5_negative_test.dart
rename to tests/language_strong/switch5_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch6_test.dart b/tests/language_strong/switch6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch6_test.dart
rename to tests/language_strong/switch6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch7_negative_test.dart b/tests/language_strong/switch7_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch7_negative_test.dart
rename to tests/language_strong/switch7_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch8_test.dart b/tests/language_strong/switch8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch8_test.dart
rename to tests/language_strong/switch8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch_bad_case_test.dart b/tests/language_strong/switch_bad_case_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch_bad_case_test.dart
rename to tests/language_strong/switch_bad_case_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch_case_static_const_test.dart b/tests/language_strong/switch_case_static_const_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch_case_static_const_test.dart
rename to tests/language_strong/switch_case_static_const_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch_case_test.dart b/tests/language_strong/switch_case_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch_case_test.dart
rename to tests/language_strong/switch_case_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch_fallthru_test.dart b/tests/language_strong/switch_fallthru_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch_fallthru_test.dart
rename to tests/language_strong/switch_fallthru_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch_label2_test.dart b/tests/language_strong/switch_label2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch_label2_test.dart
rename to tests/language_strong/switch_label2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch_label_test.dart b/tests/language_strong/switch_label_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch_label_test.dart
rename to tests/language_strong/switch_label_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch_scope_test.dart b/tests/language_strong/switch_scope_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch_scope_test.dart
rename to tests/language_strong/switch_scope_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch_test.dart b/tests/language_strong/switch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch_test.dart
rename to tests/language_strong/switch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/switch_try_catch_test.dart b/tests/language_strong/switch_try_catch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/switch_try_catch_test.dart
rename to tests/language_strong/switch_try_catch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/symbol_conflict_test.dart b/tests/language_strong/symbol_conflict_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/symbol_conflict_test.dart
rename to tests/language_strong/symbol_conflict_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/symbol_literal_test.dart b/tests/language_strong/symbol_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/symbol_literal_test.dart
rename to tests/language_strong/symbol_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/sync_generator1_test.dart b/tests/language_strong/sync_generator1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/sync_generator1_test.dart
rename to tests/language_strong/sync_generator1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/sync_generator2_test.dart b/tests/language_strong/sync_generator2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/sync_generator2_test.dart
rename to tests/language_strong/sync_generator2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/sync_generator3_test.dart b/tests/language_strong/sync_generator3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/sync_generator3_test.dart
rename to tests/language_strong/sync_generator3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/syncstar_less_than_test.dart b/tests/language_strong/syncstar_less_than_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/syncstar_less_than_test.dart
rename to tests/language_strong/syncstar_less_than_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/syncstar_yield_test.dart b/tests/language_strong/syncstar_yield_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/syncstar_yield_test.dart
rename to tests/language_strong/syncstar_yield_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/syncstar_yieldstar_test.dart b/tests/language_strong/syncstar_yieldstar_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/syncstar_yieldstar_test.dart
rename to tests/language_strong/syncstar_yieldstar_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/syntax_test.dart b/tests/language_strong/syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/syntax_test.dart
rename to tests/language_strong/syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/temp_mangling_test.dart b/tests/language_strong/temp_mangling_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/temp_mangling_test.dart
rename to tests/language_strong/temp_mangling_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/ternary_test.dart b/tests/language_strong/ternary_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/ternary_test.dart
rename to tests/language_strong/ternary_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/test_negative_test.dart b/tests/language_strong/test_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/test_negative_test.dart
rename to tests/language_strong/test_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/third_test.dart b/tests/language_strong/third_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/third_test.dart
rename to tests/language_strong/third_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/this_conditional_operator_test.dart b/tests/language_strong/this_conditional_operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/this_conditional_operator_test.dart
rename to tests/language_strong/this_conditional_operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/this_test.dart b/tests/language_strong/this_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/this_test.dart
rename to tests/language_strong/this_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throw1_test.dart b/tests/language_strong/throw1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throw1_test.dart
rename to tests/language_strong/throw1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throw2_test.dart b/tests/language_strong/throw2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throw2_test.dart
rename to tests/language_strong/throw2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throw3_test.dart b/tests/language_strong/throw3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throw3_test.dart
rename to tests/language_strong/throw3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throw4_test.dart b/tests/language_strong/throw4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throw4_test.dart
rename to tests/language_strong/throw4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throw5_test.dart b/tests/language_strong/throw5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throw5_test.dart
rename to tests/language_strong/throw5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throw6_test.dart b/tests/language_strong/throw6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throw6_test.dart
rename to tests/language_strong/throw6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throw8_test.dart b/tests/language_strong/throw8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throw8_test.dart
rename to tests/language_strong/throw8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throw_expr_test.dart b/tests/language_strong/throw_expr_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throw_expr_test.dart
rename to tests/language_strong/throw_expr_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throw_test.dart b/tests/language_strong/throw_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throw_test.dart
rename to tests/language_strong/throw_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/throwing_lazy_variable_test.dart b/tests/language_strong/throwing_lazy_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/throwing_lazy_variable_test.dart
rename to tests/language_strong/throwing_lazy_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_entry.dart b/tests/language_strong/top_level_entry.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_entry.dart
rename to tests/language_strong/top_level_entry.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_entry_test.dart b/tests/language_strong/top_level_entry_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_entry_test.dart
rename to tests/language_strong/top_level_entry_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_file1.dart b/tests/language_strong/top_level_file1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_file1.dart
rename to tests/language_strong/top_level_file1.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_file2.dart b/tests/language_strong/top_level_file2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_file2.dart
rename to tests/language_strong/top_level_file2.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_file3.dart b/tests/language_strong/top_level_file3.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_file3.dart
rename to tests/language_strong/top_level_file3.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_func_test.dart b/tests/language_strong/top_level_func_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_func_test.dart
rename to tests/language_strong/top_level_func_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_getter_arrow_syntax_test.dart b/tests/language_strong/top_level_getter_arrow_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_getter_arrow_syntax_test.dart
rename to tests/language_strong/top_level_getter_arrow_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_getter_no_setter1_test.dart b/tests/language_strong/top_level_getter_no_setter1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_getter_no_setter1_test.dart
rename to tests/language_strong/top_level_getter_no_setter1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_getter_no_setter2_test.dart b/tests/language_strong/top_level_getter_no_setter2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_getter_no_setter2_test.dart
rename to tests/language_strong/top_level_getter_no_setter2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_in_initializer_test.dart b/tests/language_strong/top_level_in_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_in_initializer_test.dart
rename to tests/language_strong/top_level_in_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_method_test.dart b/tests/language_strong/top_level_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_method_test.dart
rename to tests/language_strong/top_level_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_multiple_files_test.dart b/tests/language_strong/top_level_multiple_files_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_multiple_files_test.dart
rename to tests/language_strong/top_level_multiple_files_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_non_prefixed_library_test.dart b/tests/language_strong/top_level_non_prefixed_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_non_prefixed_library_test.dart
rename to tests/language_strong/top_level_non_prefixed_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_prefixed_declaration_test.dart b/tests/language_strong/top_level_prefixed_declaration_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_prefixed_declaration_test.dart
rename to tests/language_strong/top_level_prefixed_declaration_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_prefixed_library_test.lib b/tests/language_strong/top_level_prefixed_library_test.lib
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_prefixed_library_test.lib
rename to tests/language_strong/top_level_prefixed_library_test.lib
diff --git a/pkg/dev_compiler/test/codegen/language/top_level_var_test.dart b/tests/language_strong/top_level_var_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/top_level_var_test.dart
rename to tests/language_strong/top_level_var_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/toplevel_collision1_test.dart b/tests/language_strong/toplevel_collision1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/toplevel_collision1_test.dart
rename to tests/language_strong/toplevel_collision1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/toplevel_collision2_test.dart b/tests/language_strong/toplevel_collision2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/toplevel_collision2_test.dart
rename to tests/language_strong/toplevel_collision2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/transitive_private_library_access_test.dart b/tests/language_strong/transitive_private_library_access_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/transitive_private_library_access_test.dart
rename to tests/language_strong/transitive_private_library_access_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/tree_shake_typed_selector_test.dart b/tests/language_strong/tree_shake_typed_selector_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/tree_shake_typed_selector_test.dart
rename to tests/language_strong/tree_shake_typed_selector_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/truncdiv_test.dart b/tests/language_strong/truncdiv_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/truncdiv_test.dart
rename to tests/language_strong/truncdiv_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/truncdiv_uint32_test.dart b/tests/language_strong/truncdiv_uint32_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/truncdiv_uint32_test.dart
rename to tests/language_strong/truncdiv_uint32_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch2_test.dart b/tests/language_strong/try_catch2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch2_test.dart
rename to tests/language_strong/try_catch2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch3_test.dart b/tests/language_strong/try_catch3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch3_test.dart
rename to tests/language_strong/try_catch3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch4_test.dart b/tests/language_strong/try_catch4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch4_test.dart
rename to tests/language_strong/try_catch4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch5_test.dart b/tests/language_strong/try_catch5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch5_test.dart
rename to tests/language_strong/try_catch5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch_on_syntax_test.dart b/tests/language_strong/try_catch_on_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch_on_syntax_test.dart
rename to tests/language_strong/try_catch_on_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch_optimized1_test.dart b/tests/language_strong/try_catch_optimized1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch_optimized1_test.dart
rename to tests/language_strong/try_catch_optimized1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch_optimized2_test.dart b/tests/language_strong/try_catch_optimized2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch_optimized2_test.dart
rename to tests/language_strong/try_catch_optimized2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch_optimized3_test.dart b/tests/language_strong/try_catch_optimized3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch_optimized3_test.dart
rename to tests/language_strong/try_catch_optimized3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch_optimized4_test.dart b/tests/language_strong/try_catch_optimized4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch_optimized4_test.dart
rename to tests/language_strong/try_catch_optimized4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch_osr_test.dart b/tests/language_strong/try_catch_osr_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch_osr_test.dart
rename to tests/language_strong/try_catch_osr_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch_syntax_test.dart b/tests/language_strong/try_catch_syntax_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch_syntax_test.dart
rename to tests/language_strong/try_catch_syntax_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/try_catch_test.dart b/tests/language_strong/try_catch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/try_catch_test.dart
rename to tests/language_strong/try_catch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_argument_in_super_type_test.dart b/tests/language_strong/type_argument_in_super_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_argument_in_super_type_test.dart
rename to tests/language_strong/type_argument_in_super_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_argument_substitution_test.dart b/tests/language_strong/type_argument_substitution_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_argument_substitution_test.dart
rename to tests/language_strong/type_argument_substitution_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_check_const_function_typedef2_test.dart b/tests/language_strong/type_check_const_function_typedef2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_check_const_function_typedef2_test.dart
rename to tests/language_strong/type_check_const_function_typedef2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_check_const_function_typedef_test.dart b/tests/language_strong/type_check_const_function_typedef_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_check_const_function_typedef_test.dart
rename to tests/language_strong/type_check_const_function_typedef_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_check_test.dart b/tests/language_strong/type_check_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_check_test.dart
rename to tests/language_strong/type_check_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_checks_in_factory_method_test.dart b/tests/language_strong/type_checks_in_factory_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_checks_in_factory_method_test.dart
rename to tests/language_strong/type_checks_in_factory_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_conversion_ssa_test.dart b/tests/language_strong/type_conversion_ssa_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_conversion_ssa_test.dart
rename to tests/language_strong/type_conversion_ssa_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_error_test.dart b/tests/language_strong/type_error_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_error_test.dart
rename to tests/language_strong/type_error_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_guard_conversion_test.dart b/tests/language_strong/type_guard_conversion_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_guard_conversion_test.dart
rename to tests/language_strong/type_guard_conversion_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_hoisting_test.dart b/tests/language_strong/type_hoisting_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_hoisting_test.dart
rename to tests/language_strong/type_hoisting_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_intersection_test.dart b/tests/language_strong/type_intersection_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_intersection_test.dart
rename to tests/language_strong/type_intersection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_literal_prefix_call_test.dart b/tests/language_strong/type_literal_prefix_call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_literal_prefix_call_test.dart
rename to tests/language_strong/type_literal_prefix_call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_literal_test.dart b/tests/language_strong/type_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_literal_test.dart
rename to tests/language_strong/type_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_no_hoisting_test.dart b/tests/language_strong/type_no_hoisting_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_no_hoisting_test.dart
rename to tests/language_strong/type_no_hoisting_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_parameter_literal_test.dart b/tests/language_strong/type_parameter_literal_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_parameter_literal_test.dart
rename to tests/language_strong/type_parameter_literal_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_parameter_test.dart b/tests/language_strong/type_parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_parameter_test.dart
rename to tests/language_strong/type_parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_promotion_assign_test.dart b/tests/language_strong/type_promotion_assign_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_promotion_assign_test.dart
rename to tests/language_strong/type_promotion_assign_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_promotion_closure_test.dart b/tests/language_strong/type_promotion_closure_test.dart
similarity index 94%
rename from pkg/dev_compiler/test/codegen/language/type_promotion_closure_test.dart
rename to tests/language_strong/type_promotion_closure_test.dart
index 5c59443..5b0b2c0 100644
--- a/pkg/dev_compiler/test/codegen/language/type_promotion_closure_test.dart
+++ b/tests/language_strong/type_promotion_closure_test.dart
@@ -4,18 +4,20 @@
 
 // Test type promotion of locals potentially mutated in closures.
 
+import "package:meta/meta.dart" show virtual;
+
 class A {
-  var a = "a";
+  @virtual var a = "a";
   A operator +(int i) => this;
 }
 class B extends A {
-  var b = "b";
+  @virtual var b = "b";
 }
 class C extends B {
-  var c = "c";
+  @virtual var c = "c";
 }
 class D extends A {
-  var d = "d";
+  @virtual var d = "d";
 }
 class E extends D implements C {
   var a = "";
diff --git a/pkg/dev_compiler/test/codegen/language/type_promotion_functions_test.dart b/tests/language_strong/type_promotion_functions_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_promotion_functions_test.dart
rename to tests/language_strong/type_promotion_functions_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_promotion_local_test.dart b/tests/language_strong/type_promotion_local_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_promotion_local_test.dart
rename to tests/language_strong/type_promotion_local_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_promotion_logical_and_test.dart b/tests/language_strong/type_promotion_logical_and_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_promotion_logical_and_test.dart
rename to tests/language_strong/type_promotion_logical_and_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_promotion_more_specific_test.dart b/tests/language_strong/type_promotion_more_specific_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_promotion_more_specific_test.dart
rename to tests/language_strong/type_promotion_more_specific_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_promotion_multiple_test.dart b/tests/language_strong/type_promotion_multiple_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_promotion_multiple_test.dart
rename to tests/language_strong/type_promotion_multiple_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_promotion_parameter_test.dart b/tests/language_strong/type_promotion_parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_promotion_parameter_test.dart
rename to tests/language_strong/type_promotion_parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_propagation2_test.dart b/tests/language_strong/type_propagation2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_propagation2_test.dart
rename to tests/language_strong/type_propagation2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_propagation3_test.dart b/tests/language_strong/type_propagation3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_propagation3_test.dart
rename to tests/language_strong/type_propagation3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_propagation_assert_assignable_test.dart b/tests/language_strong/type_propagation_assert_assignable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_propagation_assert_assignable_test.dart
rename to tests/language_strong/type_propagation_assert_assignable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_propagation_in_for_update_test.dart b/tests/language_strong/type_propagation_in_for_update_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_propagation_in_for_update_test.dart
rename to tests/language_strong/type_propagation_in_for_update_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_propagation_phi_test.dart b/tests/language_strong/type_propagation_phi_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_propagation_phi_test.dart
rename to tests/language_strong/type_propagation_phi_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_propagation_test.dart b/tests/language_strong/type_propagation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_propagation_test.dart
rename to tests/language_strong/type_propagation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_bounds2_test.dart b/tests/language_strong/type_variable_bounds2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_bounds2_test.dart
rename to tests/language_strong/type_variable_bounds2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_bounds3_test.dart b/tests/language_strong/type_variable_bounds3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_bounds3_test.dart
rename to tests/language_strong/type_variable_bounds3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_bounds4_test.dart b/tests/language_strong/type_variable_bounds4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_bounds4_test.dart
rename to tests/language_strong/type_variable_bounds4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_bounds_test.dart b/tests/language_strong/type_variable_bounds_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_bounds_test.dart
rename to tests/language_strong/type_variable_bounds_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_closure2_test.dart b/tests/language_strong/type_variable_closure2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_closure2_test.dart
rename to tests/language_strong/type_variable_closure2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_closure_test.dart b/tests/language_strong/type_variable_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_closure_test.dart
rename to tests/language_strong/type_variable_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_conflict2_test.dart b/tests/language_strong/type_variable_conflict2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_conflict2_test.dart
rename to tests/language_strong/type_variable_conflict2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_conflict_test.dart b/tests/language_strong/type_variable_conflict_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_conflict_test.dart
rename to tests/language_strong/type_variable_conflict_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_field_initializer_closure_test.dart b/tests/language_strong/type_variable_field_initializer_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_field_initializer_closure_test.dart
rename to tests/language_strong/type_variable_field_initializer_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_field_initializer_test.dart b/tests/language_strong/type_variable_field_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_field_initializer_test.dart
rename to tests/language_strong/type_variable_field_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_function_type_test.dart b/tests/language_strong/type_variable_function_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_function_type_test.dart
rename to tests/language_strong/type_variable_function_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_identifier_expression_test.dart b/tests/language_strong/type_variable_identifier_expression_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_identifier_expression_test.dart
rename to tests/language_strong/type_variable_identifier_expression_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_initializer_test.dart b/tests/language_strong/type_variable_initializer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_initializer_test.dart
rename to tests/language_strong/type_variable_initializer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_nested_test.dart b/tests/language_strong/type_variable_nested_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_nested_test.dart
rename to tests/language_strong/type_variable_nested_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_scope2_test.dart b/tests/language_strong/type_variable_scope2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_scope2_test.dart
rename to tests/language_strong/type_variable_scope2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_scope3_test.dart b/tests/language_strong/type_variable_scope3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_scope3_test.dart
rename to tests/language_strong/type_variable_scope3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_scope_test.dart b/tests/language_strong/type_variable_scope_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_scope_test.dart
rename to tests/language_strong/type_variable_scope_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_static_context_negative_test.dart b/tests/language_strong/type_variable_static_context_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_static_context_negative_test.dart
rename to tests/language_strong/type_variable_static_context_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/type_variable_typedef_test.dart b/tests/language_strong/type_variable_typedef_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/type_variable_typedef_test.dart
rename to tests/language_strong/type_variable_typedef_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/typed_equality_test.dart b/tests/language_strong/typed_equality_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/typed_equality_test.dart
rename to tests/language_strong/typed_equality_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/typed_selector2_test.dart b/tests/language_strong/typed_selector2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/typed_selector2_test.dart
rename to tests/language_strong/typed_selector2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/typed_selector_test.dart b/tests/language_strong/typed_selector_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/typed_selector_test.dart
rename to tests/language_strong/typed_selector_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/typedef_is_test.dart b/tests/language_strong/typedef_is_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/typedef_is_test.dart
rename to tests/language_strong/typedef_is_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/typevariable_substitution2_test.dart b/tests/language_strong/typevariable_substitution2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/typevariable_substitution2_test.dart
rename to tests/language_strong/typevariable_substitution2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unary2_test.dart b/tests/language_strong/unary2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unary2_test.dart
rename to tests/language_strong/unary2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unary_plus_negative_test.dart b/tests/language_strong/unary_plus_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unary_plus_negative_test.dart
rename to tests/language_strong/unary_plus_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unary_test.dart b/tests/language_strong/unary_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unary_test.dart
rename to tests/language_strong/unary_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unbalanced_brace_test.dart b/tests/language_strong/unbalanced_brace_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unbalanced_brace_test.dart
rename to tests/language_strong/unbalanced_brace_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unbound_getter_test.dart b/tests/language_strong/unbound_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unbound_getter_test.dart
rename to tests/language_strong/unbound_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unconditional_break.dart b/tests/language_strong/unconditional_break.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unconditional_break.dart
rename to tests/language_strong/unconditional_break.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unhandled_exception_negative_test.dart b/tests/language_strong/unhandled_exception_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unhandled_exception_negative_test.dart
rename to tests/language_strong/unhandled_exception_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unicode_bom_middle_test.dart b/tests/language_strong/unicode_bom_middle_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unicode_bom_middle_test.dart
rename to tests/language_strong/unicode_bom_middle_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unicode_bom_test.dart b/tests/language_strong/unicode_bom_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unicode_bom_test.dart
rename to tests/language_strong/unicode_bom_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unicode_hash_test.dart b/tests/language_strong/unicode_hash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unicode_hash_test.dart
rename to tests/language_strong/unicode_hash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unnamed_closure_test.dart b/tests/language_strong/unnamed_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unnamed_closure_test.dart
rename to tests/language_strong/unnamed_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unqual_name_test.dart b/tests/language_strong/unqual_name_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unqual_name_test.dart
rename to tests/language_strong/unqual_name_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unresolved_default_constructor_test.dart b/tests/language_strong/unresolved_default_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unresolved_default_constructor_test.dart
rename to tests/language_strong/unresolved_default_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unresolved_in_factory_negative_test.dart b/tests/language_strong/unresolved_in_factory_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unresolved_in_factory_negative_test.dart
rename to tests/language_strong/unresolved_in_factory_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unresolved_top_level_method_negative_test.dart b/tests/language_strong/unresolved_top_level_method_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unresolved_top_level_method_negative_test.dart
rename to tests/language_strong/unresolved_top_level_method_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unresolved_top_level_var_negative_test.dart b/tests/language_strong/unresolved_top_level_var_negative_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unresolved_top_level_var_negative_test.dart
rename to tests/language_strong/unresolved_top_level_var_negative_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unsigned_right_shift_test.dart b/tests/language_strong/unsigned_right_shift_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unsigned_right_shift_test.dart
rename to tests/language_strong/unsigned_right_shift_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/unsupported_operators_test.dart b/tests/language_strong/unsupported_operators_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/unsupported_operators_test.dart
rename to tests/language_strong/unsupported_operators_test.dart
diff --git a/tests/language_strong/unused_overridden_async_test.dart b/tests/language_strong/unused_overridden_async_test.dart
new file mode 100644
index 0000000..37286bb
--- /dev/null
+++ b/tests/language_strong/unused_overridden_async_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+import 'dart:async';
+
+class Base {
+  Future<int> method() async {
+    throw 'Should be unused';
+  }
+}
+
+class Sub1 extends Base {
+  @override
+  Future<int> method() async {
+    return 1;
+  }
+}
+
+class Sub2 extends Base {
+  @override
+  Future<int> method() async {
+    return 2;
+  }
+}
+
+help(Base object) async {
+  print(await object.method());
+}
+
+main() async {
+  await help(new Sub1());
+  await help(new Sub2());
+}
diff --git a/pkg/dev_compiler/test/codegen/language/value_range2_test.dart b/tests/language_strong/value_range2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/value_range2_test.dart
rename to tests/language_strong/value_range2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/value_range3_test.dart b/tests/language_strong/value_range3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/value_range3_test.dart
rename to tests/language_strong/value_range3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/value_range_test.dart b/tests/language_strong/value_range_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/value_range_test.dart
rename to tests/language_strong/value_range_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/var_init_test.dart b/tests/language_strong/var_init_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/var_init_test.dart
rename to tests/language_strong/var_init_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/variable_declaration_metadata_test.dart b/tests/language_strong/variable_declaration_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/variable_declaration_metadata_test.dart
rename to tests/language_strong/variable_declaration_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/variable_named_dart_test.dart b/tests/language_strong/variable_named_dart_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/variable_named_dart_test.dart
rename to tests/language_strong/variable_named_dart_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/void_subtype_test.dart b/tests/language_strong/void_subtype_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/void_subtype_test.dart
rename to tests/language_strong/void_subtype_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/void_type_test.dart b/tests/language_strong/void_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/void_type_test.dart
rename to tests/language_strong/void_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/while_test.dart b/tests/language_strong/while_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/while_test.dart
rename to tests/language_strong/while_test.dart
diff --git a/pkg/dev_compiler/test/codegen/language/wrong_number_type_arguments_test.dart b/tests/language_strong/wrong_number_type_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/language/wrong_number_type_arguments_test.dart
rename to tests/language_strong/wrong_number_type_arguments_test.dart
diff --git a/tests/lib/async/future_or_bad_type_test.dart b/tests/lib/async/future_or_bad_type_test.dart
new file mode 100644
index 0000000..f0faf53
--- /dev/null
+++ b/tests/lib/async/future_or_bad_type_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// In non strong-mode, `FutureOr<T>` is dynamic, even if `T` doesn't exist.
+// `FutureOr<T>` can not be used as superclass, mixin, nor can it be
+// implemented (as interface).
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+
+class A
+    extends FutureOr<String>  /// extends: compile-time error
+    extends Object with FutureOr<bool>  /// with: compile-time error
+    implements FutureOr<int>  /// implements: compile-time error
+{
+}
+
+main() {
+  // FutureOr<T> should be treated like `dynamic`. Dynamically the `T` is
+  // completely ignored. It can be a malformed type.
+  Expect.isTrue(499 is FutureOr<A>);
+  Expect.isTrue(499 is FutureOr<Does<Not<Exist>>>);  /// 00: static type warning
+  Expect.isTrue(499 is FutureOr<A, A>);              /// 01: static type warning
+
+  var a = new A();
+  Expect.isTrue(a.toString() is String);
+}
diff --git a/tests/lib/async/future_or_non_strong_test.dart b/tests/lib/async/future_or_non_strong_test.dart
new file mode 100644
index 0000000..ec95115
--- /dev/null
+++ b/tests/lib/async/future_or_non_strong_test.dart
@@ -0,0 +1,118 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// In non strong-mode, `FutureOr` should just behave like dynamic.
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+
+
+typedef void FunTakes<T>(T x);
+typedef T FunReturns<T>();
+
+main() {
+  Expect.isTrue(499 is FutureOr);
+  Expect.isTrue(499 is FutureOr<String>);
+  Expect.isTrue(499 is FutureOr<int>);
+
+  Expect.isTrue(new Future.value(499) is FutureOr);
+  Expect.isTrue(new Future.value(499) is FutureOr<int>);
+  Expect.isTrue(new Future.value(499) is FutureOr<String>);
+
+
+  void foo(FutureOr x) {}
+
+  Expect.isTrue(foo is FunTakes<dynamic>);
+  Expect.isTrue(foo is FunTakes<Object>);
+  Expect.isTrue(foo is FunTakes<int>);
+  Expect.isTrue(foo is FunTakes<String>);
+  Expect.isTrue(foo is FunTakes<Future<int>>);
+  Expect.isTrue(foo is FunTakes<Future<String>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<Object>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<int>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<String>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<FutureOr<Object>>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<FutureOr<int>>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<FutureOr<String>>>);
+
+
+  FutureOr bar() => 499;
+
+  Expect.isTrue(bar is FunReturns<dynamic>);
+  Expect.isTrue(bar is FunReturns<Object>);
+  Expect.isTrue(bar is FunReturns<int>);
+  Expect.isTrue(bar is FunReturns<String>);
+  Expect.isTrue(bar is FunReturns<Future<int>>);
+  Expect.isTrue(bar is FunReturns<Future<String>>);
+  Expect.isTrue(bar is FunReturns<FutureOr<Object>>);
+  Expect.isTrue(bar is FunReturns<FutureOr<int>>);
+  Expect.isTrue(bar is FunReturns<FutureOr<String>>);
+  Expect.isTrue(bar is FunReturns<FutureOr<FutureOr<Object>>>);
+  Expect.isTrue(bar is FunReturns<FutureOr<FutureOr<int>>>);
+  Expect.isTrue(bar is FunReturns<FutureOr<FutureOr<String>>>);
+
+
+  void foo2(FutureOr<String> x) {}
+
+  Expect.isTrue(foo2 is FunTakes<dynamic>);
+  Expect.isTrue(foo2 is FunTakes<Object>);
+  Expect.isTrue(foo2 is FunTakes<int>);
+  Expect.isTrue(foo2 is FunTakes<String>);
+  Expect.isTrue(foo2 is FunTakes<Future<int>>);
+  Expect.isTrue(foo2 is FunTakes<Future<String>>);
+  Expect.isTrue(foo2 is FunTakes<FutureOr<Object>>);
+  Expect.isTrue(foo2 is FunTakes<FutureOr<int>>);
+  Expect.isTrue(foo2 is FunTakes<FutureOr<String>>);
+  Expect.isTrue(foo2 is FunTakes<FutureOr<FutureOr<Object>>>);
+  Expect.isTrue(foo2 is FunTakes<FutureOr<FutureOr<int>>>);
+  Expect.isTrue(foo2 is FunTakes<FutureOr<FutureOr<String>>>);
+
+
+  FutureOr<int> bar2() => 499;
+
+  Expect.isTrue(bar2 is FunReturns<dynamic>);
+  Expect.isTrue(bar2 is FunReturns<Object>);
+  Expect.isTrue(bar2 is FunReturns<int>);
+  Expect.isTrue(bar2 is FunReturns<String>);
+  Expect.isTrue(bar2 is FunReturns<Future<int>>);
+  Expect.isTrue(bar2 is FunReturns<Future<String>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<Object>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<int>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<String>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<FutureOr<Object>>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<FutureOr<int>>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<FutureOr<String>>>);
+
+
+  void foo3(String x) {}
+
+  Expect.isTrue(foo3 is FunTakes<dynamic>);
+  Expect.isTrue(foo3 is FunTakes<Object>);
+  Expect.isFalse(foo3 is FunTakes<int>);
+  Expect.isTrue(foo3 is FunTakes<String>);
+  Expect.isFalse(foo3 is FunTakes<Future<int>>);
+  Expect.isFalse(foo3 is FunTakes<Future<String>>);
+  Expect.isTrue(foo3 is FunTakes<FutureOr<Object>>);
+  Expect.isTrue(foo3 is FunTakes<FutureOr<int>>);
+  Expect.isTrue(foo3 is FunTakes<FutureOr<String>>);
+  Expect.isTrue(foo3 is FunTakes<FutureOr<FutureOr<Object>>>);
+  Expect.isTrue(foo3 is FunTakes<FutureOr<FutureOr<int>>>);
+  Expect.isTrue(foo3 is FunTakes<FutureOr<FutureOr<String>>>);
+
+
+  int bar3() => 499;
+
+  Expect.isTrue(bar3 is FunReturns<dynamic>);
+  Expect.isTrue(bar3 is FunReturns<Object>);
+  Expect.isTrue(bar3 is FunReturns<int>);
+  Expect.isFalse(bar3 is FunReturns<String>);
+  Expect.isFalse(bar3 is FunReturns<Future<int>>);
+  Expect.isFalse(bar3 is FunReturns<Future<String>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<Object>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<int>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<String>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<FutureOr<Object>>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<FutureOr<int>>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<FutureOr<String>>>);
+}
diff --git a/tests/lib/async/future_or_only_in_async_test.dart b/tests/lib/async/future_or_only_in_async_test.dart
new file mode 100644
index 0000000..9942443
--- /dev/null
+++ b/tests/lib/async/future_or_only_in_async_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// `FutureOr<T>` is only visible when `dart:async` is imported.
+
+dynamic foo(dynamic x) {
+  return x as
+      FutureOr<  /// 00: runtime error, static type warning
+        int
+      >          /// 00: continued
+  ;
+}
+
+main() {
+  if (499 != foo(499)) throw "bad";
+}
diff --git a/tests/lib/async/future_or_strong_test.dart b/tests/lib/async/future_or_strong_test.dart
new file mode 100644
index 0000000..65be597
--- /dev/null
+++ b/tests/lib/async/future_or_strong_test.dart
@@ -0,0 +1,126 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// In strong mode, `FutureOr` should be equivalent to the union of `Future<T>`
+// and `T`.
+
+import 'dart:async';
+import 'package:expect/expect.dart';
+
+
+typedef void FunTakes<T>(T x);
+typedef T FunReturns<T>();
+
+main() {
+  Expect.isTrue(499 is FutureOr);  // Same as `is Object`.
+  Expect.isTrue(499 is FutureOr<int>);
+  Expect.isFalse(499 is FutureOr<String>);
+
+  Expect.isTrue(new Future.value(499) is FutureOr);  // Same as `is Object`.
+  Expect.isTrue(new Future.value(499) is FutureOr<int>);
+  Expect.isFalse(new Future.value(499) is FutureOr<String>);
+
+
+  void foo(FutureOr x) {}  // Equivalent to `void bar(Object x) {}`.
+
+  // A function that takes Object takes everything.
+  Expect.isTrue(foo is FunTakes<dynamic>);
+  Expect.isTrue(foo is FunTakes<Object>);
+  Expect.isTrue(foo is FunTakes<int>);
+  Expect.isTrue(foo is FunTakes<String>);
+  Expect.isTrue(foo is FunTakes<Future<int>>);
+  Expect.isTrue(foo is FunTakes<Future<String>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<Object>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<int>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<String>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<FutureOr<Object>>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<FutureOr<int>>>);
+  Expect.isTrue(foo is FunTakes<FutureOr<FutureOr<String>>>);
+
+
+  FutureOr bar() => 499;  // Equivalent to `Object foo() => 499`.
+
+  Expect.isTrue(bar is FunReturns<dynamic>);
+  Expect.isTrue(bar is FunReturns<Object>);
+  Expect.isFalse(bar is FunReturns<int>);
+  Expect.isFalse(bar is FunReturns<String>);
+  Expect.isFalse(bar is FunReturns<Future<int>>);
+  Expect.isFalse(bar is FunReturns<Future<String>>);
+  Expect.isTrue(bar is FunReturns<FutureOr<Object>>);
+  Expect.isFalse(bar is FunReturns<FutureOr<int>>);
+  Expect.isFalse(bar is FunReturns<FutureOr<String>>);
+  Expect.isTrue(bar is FunReturns<FutureOr<FutureOr<Object>>>);
+  Expect.isFalse(bar is FunReturns<FutureOr<FutureOr<int>>>);
+  Expect.isFalse(bar is FunReturns<FutureOr<FutureOr<String>>>);
+
+
+  void foo2(FutureOr<String> x) {}
+
+  // In is-checks `dynamic` is treat specially (counting as bottom in parameter
+  // positions).
+  Expect.isTrue(foo2 is FunTakes<dynamic>);
+
+  Expect.isFalse(foo2 is FunTakes<Object>);
+  Expect.isFalse(foo2 is FunTakes<int>);
+  Expect.isTrue(foo2 is FunTakes<String>);
+  Expect.isFalse(foo2 is FunTakes<Future<int>>);
+  Expect.isTrue(foo2 is FunTakes<Future<String>>);
+  Expect.isFalse(foo2 is FunTakes<FutureOr<Object>>);
+  Expect.isFalse(foo2 is FunTakes<FutureOr<int>>);
+  Expect.isTrue(foo2 is FunTakes<FutureOr<String>>);
+  Expect.isFalse(foo2 is FunTakes<FutureOr<FutureOr<Object>>>);
+  Expect.isFalse(foo2 is FunTakes<FutureOr<FutureOr<int>>>);
+  Expect.isFalse(foo2 is FunTakes<FutureOr<FutureOr<String>>>);
+
+
+  FutureOr<int> bar2() => 499;
+
+  Expect.isTrue(bar2 is FunReturns<dynamic>);
+  Expect.isTrue(bar2 is FunReturns<Object>);
+  Expect.isFalse(bar2 is FunReturns<int>);
+  Expect.isFalse(bar2 is FunReturns<String>);
+  Expect.isFalse(bar2 is FunReturns<Future<int>>);
+  Expect.isFalse(bar2 is FunReturns<Future<String>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<Object>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<int>>);
+  Expect.isFalse(bar2 is FunReturns<FutureOr<String>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<FutureOr<Object>>>);
+  Expect.isTrue(bar2 is FunReturns<FutureOr<FutureOr<int>>>);
+  Expect.isFalse(bar2 is FunReturns<FutureOr<FutureOr<String>>>);
+
+
+  void foo3(String x) {}
+
+  // In is-checks `dynamic` is treat specially (counting as bottom in parameter
+  // positions).
+  Expect.isTrue(foo3 is FunTakes<dynamic>);
+
+  Expect.isFalse(foo3 is FunTakes<Object>);
+  Expect.isFalse(foo3 is FunTakes<int>);
+  Expect.isTrue(foo3 is FunTakes<String>);
+  Expect.isFalse(foo3 is FunTakes<Future<int>>);
+  Expect.isFalse(foo3 is FunTakes<Future<String>>);
+  Expect.isFalse(foo3 is FunTakes<FutureOr<Object>>);
+  Expect.isFalse(foo3 is FunTakes<FutureOr<int>>);
+  Expect.isFalse(foo3 is FunTakes<FutureOr<String>>);
+  Expect.isFalse(foo3 is FunTakes<FutureOr<FutureOr<Object>>>);
+  Expect.isFalse(foo3 is FunTakes<FutureOr<FutureOr<int>>>);
+  Expect.isFalse(foo3 is FunTakes<FutureOr<FutureOr<String>>>);
+
+
+  int bar3() => 499;
+
+  Expect.isTrue(bar3 is FunReturns<dynamic>);
+  Expect.isTrue(bar3 is FunReturns<Object>);
+  Expect.isTrue(bar3 is FunReturns<int>);
+  Expect.isFalse(bar3 is FunReturns<String>);
+  Expect.isFalse(bar3 is FunReturns<Future<int>>);
+  Expect.isFalse(bar3 is FunReturns<Future<String>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<Object>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<int>>);
+  Expect.isFalse(bar3 is FunReturns<FutureOr<String>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<FutureOr<Object>>>);
+  Expect.isTrue(bar3 is FunReturns<FutureOr<FutureOr<int>>>);
+  Expect.isFalse(bar3 is FunReturns<FutureOr<FutureOr<String>>>);
+}
diff --git a/tests/lib/convert/chunked_conversion1_test.dart b/tests/lib/convert/chunked_conversion1_test.dart
index 0bbe44b..7aa24e3 100644
--- a/tests/lib/convert/chunked_conversion1_test.dart
+++ b/tests/lib/convert/chunked_conversion1_test.dart
@@ -54,8 +54,8 @@
   specialB(o) => add(o);
 }
 
-class IntBoolConverter1 extends Converter<List<int>, List<bool>> {
-  List<bool> convert(List<int> input) => input.map((x) => x > 0).toList();
+class IntBoolConverter1 extends Converter<int, bool> {
+  bool convert(int input) => input > 0;
 
   startChunkedConversion(sink) {
     if (sink is! MyChunkedBoolSink) sink = new MyChunkedBoolSink.from(sink);
@@ -63,8 +63,8 @@
   }
 }
 
-class BoolIntConverter1 extends Converter<List<bool>, List<int>> {
-  List<int> convert(List<bool> input) => input.map((x) => x ? 1 : 0).toList();
+class BoolIntConverter1 extends Converter<bool, int> {
+  int convert(bool input) => input ? 1 : 0;
 
   startChunkedConversion(sink) {
     if (sink is! MyChunkedIntSink) sink = new MyChunkedIntSink.from(sink);
@@ -125,7 +125,8 @@
 
   // Test int->bool converter individually.
   converter1 = new IntBoolConverter1();
-  Expect.listEquals([true, false, true], converter1.convert([2, -2, 2]));
+  Expect.listEquals([true, false, true],
+                    [2, -2, 2].map(converter1.convert).toList());
   hasExecuted = false;
   boolSink = new MyChunkedBoolSink.withCallback((value) {
     hasExecuted = true;
@@ -143,7 +144,8 @@
 
   // Test bool->int converter individually.
   converter2 = new BoolIntConverter1();
-  Expect.listEquals([1, 0, 1], converter2.convert([true, false, true]));
+  Expect.listEquals([1, 0, 1],
+                    [true, false, true].map(converter2.convert).toList());
   hasExecuted = false;
   intSink = new MyChunkedIntSink.withCallback((value) {
     hasExecuted = true;
@@ -174,7 +176,7 @@
 
   // Test fused converters.
   fused = converter1.fuse(converter2);
-  Expect.listEquals([1, 0, 1], fused.convert([2, -2, 2]));
+  Expect.listEquals([1, 0, 1], [2, -2, 2].map(fused.convert).toList());
   hasExecuted = false;
   intSink2 = new MyChunkedIntSink.withCallback((value) {
     hasExecuted = true;
@@ -234,7 +236,7 @@
 
   // With identity between the two converters.
   fused = converter1.fuse(converter3).fuse(converter2);
-  Expect.listEquals([1, 0, 1], fused.convert([2, -2, 2]));
+  Expect.listEquals([1, 0, 1], [2, -2, 2].map(fused.convert).toList());
   hasExecuted = false;
   intSink2 = new MyChunkedIntSink.withCallback((value) {
     hasExecuted = true;
diff --git a/tests/lib/convert/utf8_test.dart b/tests/lib/convert/utf8_test.dart
index cc4c7f5..f24dffc 100644
--- a/tests/lib/convert/utf8_test.dart
+++ b/tests/lib/convert/utf8_test.dart
@@ -16,6 +16,7 @@
   }
 
   testDecodeSlice();
+  testErrorOffset();
 }
 
 void testDecodeSlice() {
@@ -43,3 +44,40 @@
   Expect.throws(() => decoder.convert(utf8, 0, 1));
   Expect.throws(() => decoder.convert(utf8, 2, 5));
 }
+
+void testErrorOffset() {
+  // Test that failed convert calls have an offset in the exception.
+  testExn(input, offset) {
+    Expect.throws(() { UTF8.decoder.convert(input); },
+                  (e) => e is FormatException &&
+                         input == e.source &&
+                         offset == e.offset);
+  }
+
+  // Bad encoding, points to first bad byte.
+  testExn([0x80, 0x00], 0);
+  testExn([0xC0, 0x00], 1);
+  testExn([0xE0, 0x00], 1);
+  testExn([0xE0, 0x80, 0x00], 2);
+  testExn([0xF0, 0x00], 1);
+  testExn([0xF0, 0x80, 0x00], 2);
+  testExn([0xF0, 0x80, 0x80, 0x00], 3);
+  testExn([0xF8, 0x00], 0);
+  // Short encoding, points to end.
+  testExn([0xC0], 1);
+  testExn([0xE0], 1);
+  testExn([0xE0, 0x80], 2);
+  testExn([0xF0], 1);
+  testExn([0xF0, 0x80], 2);
+  testExn([0xF0, 0x80, 0x80], 3);
+  // Overlong encoding, points to start of encoding.
+  testExn([0xC0, 0x80], 0);
+  testExn([0xC1, 0xBF], 0);
+  testExn([0xE0, 0x80, 0x80], 0);
+  testExn([0xE0, 0x9F, 0xBF], 0);
+  testExn([0xF0, 0x80, 0x80, 0x80], 0);
+  testExn([0xF0, 0x8F, 0xBF, 0xBF], 0);
+  // Invalid character (value too large, over 0x10FFFF).
+  testExn([0xF4, 0x90, 0x80, 0x80], 0);
+  testExn([0xF7, 0xBF, 0xBF, 0xBF], 0);
+}
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 2a84f7b..c064cd7 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -8,6 +8,8 @@
 [ $compiler == dart2js ]
 async/schedule_microtask6_test: RuntimeError # global error handling is not supported. Issue 5958
 
+async/future_or_strong_test: RuntimeError, OK
+
 math/double_pow_test: RuntimeError
 math/low_test: RuntimeError
 math/random_big_test: RuntimeError  # Using bigint seeds for random.
@@ -103,6 +105,18 @@
 mirrors/raw_type_test/01: RuntimeError # Issue 6490
 mirrors/mirrors_reader_test: Slow, RuntimeError # Issue 16589
 mirrors/regress_26187_test: RuntimeError # Issue 6490
+mirrors/reflected_type_generics_test/01: Fail # Issues in reflecting generic typedefs.
+mirrors/reflected_type_generics_test/02: Fail # Issues in reflecting bounded type variables.
+# The following tests fail because we have disabled a test in
+# `reflectClassByName`. `MirrorsUsed` leads to classes not having the
+# information necessary to correctly handle these checks.
+mirrors/reflected_type_generics_test/03: Fail # Issues in reflecting generic typedefs.
+mirrors/reflected_type_generics_test/04: Fail # Issues in reflecting bounded type variables.
+mirrors/reflected_type_generics_test/05: Fail # Issues in reflecting generic typedefs.
+mirrors/reflected_type_generics_test/06: Fail # Issues in reflecting bounded type variables.
+
+[ $compiler == none && $unchecked ]
+mirrors/reflected_type_generics_test/02: Fail, Ok # Type check for a bounded type argument.
 
 [ $compiler == dart2js && $fast_startup ]
 mirrors/*: Fail # mirrors not supported
@@ -209,14 +223,11 @@
 
 # 'js' tests import the dart:js library, so they only make sense in
 # a browser environment.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 js/*: Skip
 
-# 'js' tests import the dart:js library, so they only make sense in
-# a browser environment.
-[ $runtime == dart_app ]
-js/*: SkipByDesign
-mirrors/*: SkipByDesign
+[ $compiler == app_jit ]
+mirrors/*: Skip # Issue 27929: Triage
 
 [ $compiler == dart2js && $minified ]
 mirrors/mirrors_used_get_name_test: RuntimeError
@@ -255,20 +266,24 @@
 [ $runtime == vm ]
 convert/streamed_conversion_json_utf8_decode_test: Pass, Slow # Infrequent timeouts.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 async/timer_not_available_test: Fail, OK
 mirrors/native_class_test: Fail, OK # This test is meant to run in a browser.
 mirrors/deferred_type_test: CompileTimeError, OK # Don't have a multitest marker for dynamic compile time errors.
 mirrors/initializing_formals_test/01: Fail # initializing formals are implicitly final as of Dart 1.21
 
-[ $compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
+[ $compiler == none || $compiler == precompiler || $compiler == app_jit ]
 async/timer_not_available_test: SkipByDesign # only meant to test when there is no way to implement timer (currently only in d8)
 
 mirrors/symbol_validation_test: RuntimeError # Issue 13596
 
 mirrors/mirrors_used*: SkipByDesign # Invalid tests. MirrorsUsed does not have a specification, and dart:mirrors is not required to hide declarations that are not covered by any MirrorsUsed annotation.
 
+async/future_or_strong_test: RuntimeError, OK
+
 [ $compiler == none && ($runtime == drt || $runtime == dartium) ]
+async/future_or_bad_type_test/implements: Pass # Issue 28084
+
 mirrors/initializing_formals_test/01: Fail # initializing formals are implicitly final as of Dart 1.21
 async/schedule_microtask6_test: Fail # Issue 10910
 async/timer_test: Fail, Pass # Issue 15487
@@ -321,6 +336,7 @@
 profiler/metrics_test: Fail # Issue 20309
 profiler/metrics_num_test: Fail # Issue 20309
 
+
 [ ($compiler == dartanalyzer || $compiler == dart2analyzer) && $checked ]
 mirrors/regress_16321_test/01: MissingCompileTimeError # Issue 16391
 
@@ -331,8 +347,8 @@
 [ $compiler == dart2js && $mode == debug ]
 mirrors/native_class_test: Pass, Slow
 
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $arch == mips ]
-async/timer_regress22626_test: Pass, RuntimeError # Issue 22626
+[ ($compiler == none || $compiler == precompiler || $compiler == app_jit) ]
+async/timer_regress22626_test: Pass, RuntimeError # Issue 28254
 
 [ $arch == simarm || $arch == simarmv6 || $arch == simarmv5te ]
 convert/chunked_conversion_utf88_test: Skip  # Pass, Slow Issue 12644.
@@ -354,13 +370,13 @@
 [ $mode == debug && $arch == ia32 && $system == windows ]
 convert/streamed_conversion_json_utf8_decode_test: Skip  # Verification OOM.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug && $arch == x64 && $system == windows ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $mode == debug && $arch == x64 && $system == windows ]
 convert/streamed_conversion_json_utf8_decode_test: Pass, Slow
 
 [ $mode == debug && $arch != ia32 && $arch != x64 && $arch != simarm && $arch != simarmv6 && $arch != simarmv5te ]
 convert/streamed_conversion_json_utf8_decode_test: Skip  # Verification not yet implemented.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug && $builder_tag == asan ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $mode == debug && $builder_tag == asan ]
 mirrors/immutable_collections_test: SkipSlow  # Timeout.
 convert/streamed_conversion_json_utf8_decode_test: Skip  # Timeout.
 
@@ -387,13 +403,10 @@
 [ $compiler != dart2js ]
 async/dart2js_uncaught_error_test: Skip  # JS-integration only test
 
-[ $noopt && $arch == simarm64 ]
-async/slow_consumer2_test: Pass, RuntimeError # Issue 25726
-
-[ $noopt || $compiler == precompiler || $mode == product ]
+[ $compiler == precompiler || $mode == product ]
 mirrors/*: SkipByDesign
 
-[ $noopt || $compiler == precompiler ]
+[ $compiler == precompiler ]
 convert/chunked_conversion_utf88_test: Pass, Timeout
 convert/utf85_test: Pass, Timeout
 
@@ -414,6 +427,5 @@
 
 [ $hot_reload ]
 mirrors/generic_bounded_test/02: Fail # Type equality - Issue 26869
-mirrors/typedef_reflected_type_test/01: Fail # Type equality - Issue 26869
 mirrors/generic_bounded_by_type_parameter_test/02: Fail # Type equality - Issue 26869
 async/timer_regress22626_test: Pass, RuntimeError # Timing dependent.
diff --git a/tests/lib/mirrors/hierarchy_invariants_test.dart b/tests/lib/mirrors/hierarchy_invariants_test.dart
index e35a076..e2b73ca 100644
--- a/tests/lib/mirrors/hierarchy_invariants_test.dart
+++ b/tests/lib/mirrors/hierarchy_invariants_test.dart
@@ -24,7 +24,9 @@
   }
   Expect.isTrue(classMirror.superinterfaces is List);
   if (classMirror.superclass == null) {
-    Expect.equals(reflectClass(Object), classMirror);
+    Expect.isTrue(classMirror == reflectClass(Object) ||
+                  // Type FutureOr is mapped to dynamic in the VM.
+                  classMirror.toString() == "ClassMirror on 'FutureOr'");
   } else {
     checkClass(classMirror.superclass);
   }
diff --git a/tests/lib/mirrors/mirrors_used_generic_types_test.dart b/tests/lib/mirrors/mirrors_used_generic_types_test.dart
new file mode 100644
index 0000000..5962214
--- /dev/null
+++ b/tests/lib/mirrors/mirrors_used_generic_types_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library Test;
+
+@MirrorsUsed(targets: const ["Test"])
+import 'dart:mirrors';
+import 'dart:async';
+
+import 'package:expect/expect.dart';
+
+class A {
+  // Because of the `mirrors-used` annotation, the types `List` and `Future`
+  // are not reflectable.
+  // However, we still need to be able to create a Mirror for them, when we
+  // create a mirror for `foo`. In particular, it must be able to create a
+  // mirror, even though there are generic types.
+  List<int> foo(Future<int> x) {
+    return null;
+  }
+}
+
+void main() {
+  var m = reflect(new A()).type.instanceMembers[#foo];
+  Expect.equals(#List, m.returnType.simpleName);
+  Expect.equals(#Future, m.parameters[0].type.simpleName);
+}
diff --git a/tests/lib/mirrors/reflected_type_generics_test.dart b/tests/lib/mirrors/reflected_type_generics_test.dart
new file mode 100644
index 0000000..f10425c
--- /dev/null
+++ b/tests/lib/mirrors/reflected_type_generics_test.dart
@@ -0,0 +1,99 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.reflected_type_generics_test;
+
+@MirrorsUsed(targets: "test.reflected_type_generics_test")
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+import 'reflected_type_helper.dart';
+
+class A<T> {}
+
+class P {}
+
+class B extends A<P> {}
+
+class C<K, V> {}
+
+class D<T> extends A<T> {}
+
+class E<K> extends C<K, int> {}
+
+class F<G> {}
+
+typedef bool Predicate<T>(T arg);
+
+class FBounded<S extends FBounded> {}
+
+class Helper<T> {
+  Type get param => T;
+}
+
+class Mixin<T extends P> {}
+
+class Composite<K extends P, V> extends Object with Mixin<K> {}
+
+main() {
+  // "Happy" paths:
+  expectReflectedType(reflectType(A, [P]), new A<P>().runtimeType);
+  expectReflectedType(reflectType(C, [B, P]), new C<B, P>().runtimeType);
+  expectReflectedType(reflectType(D, [P]), new D<P>().runtimeType);
+  expectReflectedType(reflectType(E, [P]), new E<P>().runtimeType);
+  expectReflectedType(
+      reflectType(FBounded, [FBounded]), new FBounded<FBounded>().runtimeType);
+
+  var predicateHelper = new Helper<Predicate<P>>();
+  expectReflectedType(reflectType(Predicate, [P]), predicateHelper.param); /// 01: ok
+  var composite = new Composite<P, int>();
+  expectReflectedType(reflectType(Composite, [P, int]), composite.runtimeType);
+
+  // Edge cases:
+  Expect.throws(
+      () => reflectType(P, []),
+      (e) => e is ArgumentError && e.invalidValue is List,
+      "Should throw an ArgumentError if reflecting not a generic class with "
+      "empty list of type arguments");
+  Expect.throws(                                                              /// 03: ok
+      () => reflectType(P, [B]),                                              /// 03: continued
+      (e) => e is Error,                                                      /// 03: continued
+      "Should throw an ArgumentError if reflecting not a generic class with " /// 03: continued
+      "some type arguments");                                                 /// 03: continued
+  Expect.throws(
+      () => reflectType(A, []),
+      (e) => e is ArgumentError && e.invalidValue is List,
+      "Should throw an ArgumentError if type argument list is empty for a "
+      "generic class");
+  Expect.throws(                                                              /// 04: ok
+      () => reflectType(A, [P, B]),                                           /// 04: continued
+      (e) => e is ArgumentError && e.invalidValue is List,                    /// 04: continued
+      "Should throw an ArgumentError if number of type arguments is not "     /// 04: continued
+      "correct");                                                             /// 04: continued
+  Expect.throws(() => reflectType(B, [P]), (e) => e is Error,             /// 05: ok
+      "Should throw an ArgumentError for non-generic class extending "    /// 05: continued
+      "generic one");                                                     /// 05: continued
+  Expect.throws(
+      () => reflectType(A, ["non-type"]),
+      (e) => e is ArgumentError && e.invalidValue is List,
+      "Should throw an ArgumentError when any of type arguments is not a Type");
+  Expect.throws(                                                                 /// 06: ok
+      () => reflectType(A, [P, B]),                                               /// 06: continued
+      (e) => e is ArgumentError && e.invalidValue is List,                        /// 06: continued
+      "Should throw an ArgumentError if number of type arguments is not correct " /// 06: continued
+      "for generic extending another generic");                                   /// 06: continued
+  Expect.throws(
+      () => reflectType(reflectType(F).typeVariables[0].reflectedType, [int]));
+  Expect.throws(() => reflectType(FBounded, [int])); /// 02: ok
+  var boundedType =
+      reflectType(FBounded).typeVariables[0].upperBound.reflectedType;
+  Expect.throws(() => reflectType(boundedType, [int])); /// 02: ok
+  Expect.throws(() => reflectType(Composite, [int, int])); /// 02: ok
+
+  // Instantiation of a generic class preserves type information:
+  ClassMirror m = reflectType(A, [P]) as ClassMirror;
+  var instance = m.newInstance(const Symbol(""), []).reflectee;
+  Expect.equals(new A<P>().runtimeType, instance.runtimeType);
+}
diff --git a/tests/lib/mirrors/reflected_type_helper.dart b/tests/lib/mirrors/reflected_type_helper.dart
index e973854..bc47152 100644
--- a/tests/lib/mirrors/reflected_type_helper.dart
+++ b/tests/lib/mirrors/reflected_type_helper.dart
@@ -4,6 +4,7 @@
 
 library test.reflected_type_helper;
 
+@MirrorsUsed(targets: "test.reflected_type_helper")
 import 'dart:mirrors';
 import 'package:expect/expect.dart';
 
diff --git a/tests/lib/mirrors/relation_assignable_test.dart b/tests/lib/mirrors/relation_assignable_test.dart
index 970aedf..8014a82 100644
--- a/tests/lib/mirrors/relation_assignable_test.dart
+++ b/tests/lib/mirrors/relation_assignable_test.dart
@@ -33,11 +33,13 @@
   TypeMirror Sub1 = thisLibrary.declarations[#Subclass1];
   TypeMirror Sub2 = thisLibrary.declarations[#Subclass2];
   TypeMirror Obj = coreLibrary.declarations[#Object];
+  TypeMirror Nul = coreLibrary.declarations[#Null];
 
   Expect.isTrue(Obj.isAssignableTo(Obj));
   Expect.isTrue(Super.isAssignableTo(Super));
   Expect.isTrue(Sub1.isAssignableTo(Sub1));
   Expect.isTrue(Sub2.isAssignableTo(Sub2));
+  Expect.isTrue(Nul.isAssignableTo(Nul));
 
   Expect.isTrue(Sub1.isAssignableTo(Super));
   Expect.isTrue(Super.isAssignableTo(Sub1));
@@ -57,6 +59,10 @@
   Expect.isTrue(Super.isAssignableTo(Obj));
   Expect.isTrue(Obj.isAssignableTo(Super));
 
+  Expect.isTrue(Nul.isAssignableTo(Obj));
+  Expect.isTrue(Obj.isAssignableTo(Nul));
+  Expect.isTrue(Nul.isAssignableTo(Super));  // Null type is bottom type.
+  Expect.isTrue(Super.isAssignableTo(Nul));
 
   // Function typedef - argument type.
   TypeMirror Func = coreLibrary.declarations[#Function];
diff --git a/tests/lib/mirrors/relation_subclass_test.dart b/tests/lib/mirrors/relation_subclass_test.dart
index 2e8bbc2..c0c7927 100644
--- a/tests/lib/mirrors/relation_subclass_test.dart
+++ b/tests/lib/mirrors/relation_subclass_test.dart
@@ -28,11 +28,13 @@
   ClassMirror Sub1 = thisLibrary.declarations[#Subclass1];
   ClassMirror Sub2 = thisLibrary.declarations[#Subclass2];
   ClassMirror Obj = coreLibrary.declarations[#Object];
+  ClassMirror Nul = coreLibrary.declarations[#Null];
 
   Expect.isTrue(Obj.isSubclassOf(Obj));
   Expect.isTrue(Super.isSubclassOf(Super));
   Expect.isTrue(Sub1.isSubclassOf(Sub1));
   Expect.isTrue(Sub2.isSubclassOf(Sub2));
+  Expect.isTrue(Nul.isSubclassOf(Nul));
 
   Expect.isTrue(Sub1.isSubclassOf(Super));
   Expect.isFalse(Super.isSubclassOf(Sub1));
@@ -52,6 +54,11 @@
   Expect.isTrue(Super.isSubclassOf(Obj));
   Expect.isFalse(Obj.isSubclassOf(Super));
 
+  Expect.isTrue(Nul.isSubclassOf(Obj));
+  Expect.isFalse(Obj.isSubclassOf(Nul));
+  Expect.isFalse(Nul.isSubclassOf(Super));
+  Expect.isFalse(Super.isSubclassOf(Nul));
+
   var Func = coreLibrary.declarations[#Function];
   Expect.isTrue(Func.isSubclassOf(Obj));
   Expect.isFalse(Obj.isSubclassOf(Func));
diff --git a/tests/lib/mirrors/relation_subtype_test.dart b/tests/lib/mirrors/relation_subtype_test.dart
index 9504c8c..ab015ce 100644
--- a/tests/lib/mirrors/relation_subtype_test.dart
+++ b/tests/lib/mirrors/relation_subtype_test.dart
@@ -33,11 +33,13 @@
   TypeMirror Sub1 = thisLibrary.declarations[#Subclass1];
   TypeMirror Sub2 = thisLibrary.declarations[#Subclass2];
   TypeMirror Obj = coreLibrary.declarations[#Object];
+  TypeMirror Nul = coreLibrary.declarations[#Null];
 
   Expect.isTrue(Obj.isSubtypeOf(Obj));
   Expect.isTrue(Super.isSubtypeOf(Super));
   Expect.isTrue(Sub1.isSubtypeOf(Sub1));
   Expect.isTrue(Sub2.isSubtypeOf(Sub2));
+  Expect.isTrue(Nul.isSubtypeOf(Nul));
 
   Expect.isTrue(Sub1.isSubtypeOf(Super));
   Expect.isFalse(Super.isSubtypeOf(Sub1));
@@ -57,6 +59,10 @@
   Expect.isTrue(Super.isSubtypeOf(Obj));
   Expect.isFalse(Obj.isSubtypeOf(Super));
 
+  Expect.isTrue(Nul.isSubtypeOf(Obj));
+  Expect.isFalse(Obj.isSubtypeOf(Nul));
+  Expect.isTrue(Nul.isSubtypeOf(Super));  // Null type is bottom type.
+  Expect.isFalse(Super.isSubtypeOf(Nul));
 
   // Function typedef - argument type.
   TypeMirror Func = coreLibrary.declarations[#Function];
diff --git a/pkg/dev_compiler/test/codegen/lib/collection/hash_map_test.dart b/tests/lib_strong/collection/hash_map_test.dart
similarity index 88%
rename from pkg/dev_compiler/test/codegen/lib/collection/hash_map_test.dart
rename to tests/lib_strong/collection/hash_map_test.dart
index f0f1d54..5a6b52e9 100644
--- a/pkg/dev_compiler/test/codegen/lib/collection/hash_map_test.dart
+++ b/tests/lib_strong/collection/hash_map_test.dart
@@ -9,8 +9,8 @@
   // Test customized maps.
   // Regression test for issue http://dartbug.com/18109
 
-  hash(s) => s.toLowerCase().hashCode;
-  equals(a, b) => a.toLowerCase() == b.toLowerCase();
+  int hash(s) => s.toLowerCase().hashCode;
+  bool equals(a, b) => a.toLowerCase() == b.toLowerCase();
 
   for (var m in [
     new HashMap<String,int>(equals: equals, hashCode: hash),
@@ -25,8 +25,8 @@
     }
   }
 
-  abshash(n) => n.abs();
-  abseq(a, b) => a.abs() == b.abs();
+  int abshash(n) => n.abs();
+  bool abseq(a, b) => a.abs() == b.abs();
   for (var m in [
     new HashMap<int,int>(equals: abseq, hashCode: abshash),
     new LinkedHashMap<int,int>(equals: abseq, hashCode: abshash),
diff --git a/pkg/dev_compiler/test/codegen/lib/collection/hash_set_test.dart b/tests/lib_strong/collection/hash_set_test.dart
similarity index 88%
rename from pkg/dev_compiler/test/codegen/lib/collection/hash_set_test.dart
rename to tests/lib_strong/collection/hash_set_test.dart
index ab03284..c8ede1f 100644
--- a/pkg/dev_compiler/test/codegen/lib/collection/hash_set_test.dart
+++ b/tests/lib_strong/collection/hash_set_test.dart
@@ -9,8 +9,8 @@
   // Test customized sets.
   // Regression test for issue http://dartbug.com/18109
 
-  hash(s) => s.toLowerCase().hashCode;
-  equals(a, b) => a.toLowerCase() == b.toLowerCase();
+  int hash(s) => s.toLowerCase().hashCode;
+  bool equals(a, b) => a.toLowerCase() == b.toLowerCase();
 
   for (var m in [
     new HashSet<String>(equals: equals, hashCode: hash),
@@ -27,8 +27,8 @@
     }
   }
 
-  abshash(n) => n.abs();
-  abseq(a, b) => a.abs() == b.abs();
+  int abshash(n) => n.abs();
+  bool abseq(a, b) => a.abs() == b.abs();
   for (var m in [
     new HashSet<int>(equals: abseq, hashCode: abshash),
     new LinkedHashSet<int>(equals: abseq, hashCode: abshash),
diff --git a/pkg/dev_compiler/test/codegen/lib/collection/linked_list_test.dart b/tests/lib_strong/collection/linked_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/collection/linked_list_test.dart
rename to tests/lib_strong/collection/linked_list_test.dart
diff --git a/tests/lib_strong/collection/list_test.dart b/tests/lib_strong/collection/list_test.dart
new file mode 100644
index 0000000..a2ce141
--- /dev/null
+++ b/tests/lib_strong/collection/list_test.dart
@@ -0,0 +1,155 @@
+// Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:collection';
+import "package:expect/expect.dart";
+
+class MyList<E> extends Object with ListMixin<E> implements List<E> {
+  List<E> _list;
+
+  MyList(List<E> this._list);
+
+  int get length => _list.length;
+
+  void set length(int x) {
+    _list.length = x;
+  }
+
+  E operator [](int idx) => _list[idx];
+
+  void operator []=(int idx, E value) {
+    _list[idx] = value;
+  }
+}
+
+class MyNoSuchMethodList<E> extends Object
+    with ListMixin<E>
+    implements List<E> {
+  List<E> _list;
+
+  MyNoSuchMethodList(List<E> this._list);
+
+  noSuchMethod(Invocation invocation) {
+    if (invocation.memberName == #length) {
+      if (invocation.isGetter) return _list.length;
+      if (invocation.isSetter) {
+        _list.length = invocation.positionalArguments.first;
+        return null;
+      }
+      return super.noSuchMethod(invocation);
+    }
+    if (invocation.memberName == new Symbol("[]") &&
+        invocation.positionalArguments.length == 1) {
+      return _list[invocation.positionalArguments.first];
+    }
+    if (invocation.memberName == new Symbol("[]=") &&
+        invocation.positionalArguments.length == 2) {
+      _list[invocation.positionalArguments.first] =
+          invocation.positionalArguments[1];
+      return null;
+    }
+    return super.noSuchMethod(invocation);
+  }
+}
+
+// Class that behaves like a list but does not implement List.
+class MyIndexableNoSuchMethod<E> {
+  List<E> _list;
+
+  MyIndexableNoSuchMethod(List<E> this._list);
+
+  noSuchMethod(Invocation invocation) {
+    if (invocation.memberName == #length) {
+      if (invocation.isGetter) return _list.length;
+      if (invocation.isSetter) {
+        _list.length = invocation.positionalArguments.first;
+        return null;
+      }
+      return super.noSuchMethod(invocation);
+    }
+    if (invocation.memberName == new Symbol("prototype")) {
+      return 42;
+    }
+
+    if (invocation.memberName == new Symbol("[]") &&
+        invocation.positionalArguments.length == 1) {
+      return _list[invocation.positionalArguments.first];
+    }
+    if (invocation.memberName == new Symbol("[]=") &&
+        invocation.positionalArguments.length == 2) {
+      _list[invocation.positionalArguments.first] =
+          invocation.positionalArguments[1];
+      return null;
+    }
+    return super.noSuchMethod(invocation);
+  }
+}
+
+void testRetainWhere() {
+  List<int> list = <int>[1, 2, 3];
+  list.retainWhere((x) => x % 2 == 0);
+  Expect.equals(1, list.length);
+  Expect.equals(2, list.first);
+  Expect.equals(2, list[0]);
+
+  list = new MyList<int>([1, 2, 3]);
+  list.retainWhere((x) => x % 2 == 0);
+  Expect.equals(1, list.length);
+  Expect.equals(2, list.first);
+  Expect.equals(2, list[0]);
+
+  list = new MyNoSuchMethodList<int>([1, 2, 3]);
+  list.retainWhere((x) => x % 2 == 0);
+  Expect.equals(1, list.length);
+  Expect.equals(2, list.first);
+  Expect.equals(2, list[0]);
+
+  // Equivalent tests where the type of the List is known statically.
+  {
+    var l = new MyList<int>([1, 2, 3]);
+    l.retainWhere((x) => x % 2 == 0);
+    Expect.equals(1, l.length);
+    Expect.equals(2, l.first);
+    Expect.equals(2, l[0]);
+  }
+
+  {
+    var l = new MyNoSuchMethodList<int>([1, 2, 3]);
+    l.retainWhere((x) => x % 2 == 0);
+    Expect.equals(1, l.length);
+    Expect.equals(2, l.first);
+    Expect.equals(2, l[0]);
+  }
+
+  // Equivalent tests where the type of the List is not known.
+  {
+    dynamic l = new MyList<int>([1, 2, 3]);
+    l.retainWhere((x) => x % 2 == 0);
+    Expect.equals(1, l.length);
+    Expect.equals(2, l.first);
+    Expect.equals(2, l[0]);
+  }
+
+  {
+    dynamic l = new MyNoSuchMethodList<int>([1, 2, 3]);
+    l.retainWhere((x) => x % 2 == 0);
+    Expect.equals(1, l.length);
+    Expect.equals(2, l.first);
+    Expect.equals(2, l[0]);
+  }
+
+  {
+    dynamic indexable = new MyIndexableNoSuchMethod<int>([1,2,3]);
+    Expect.equals(3, indexable.length);
+    Expect.equals(1, indexable[0]);
+    Expect.equals(3, indexable[2]);
+    indexable.length = 2;
+    Expect.equals(2, indexable.length);
+    Expect.equals(42, indexable.prototype);
+  }
+}
+
+void main() {
+  testRetainWhere();
+}
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/ascii_test.dart b/tests/lib_strong/convert/ascii_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/ascii_test.dart
rename to tests/lib_strong/convert/ascii_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/base64_test.dart b/tests/lib_strong/convert/base64_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/base64_test.dart
rename to tests/lib_strong/convert/base64_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion1_test.dart b/tests/lib_strong/convert/chunked_conversion1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion1_test.dart
rename to tests/lib_strong/convert/chunked_conversion1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion2_test.dart b/tests/lib_strong/convert/chunked_conversion2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion2_test.dart
rename to tests/lib_strong/convert/chunked_conversion2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_json_decode1_test.dart b/tests/lib_strong/convert/chunked_conversion_json_decode1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_json_decode1_test.dart
rename to tests/lib_strong/convert/chunked_conversion_json_decode1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_json_encode1_test.dart b/tests/lib_strong/convert/chunked_conversion_json_encode1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_json_encode1_test.dart
rename to tests/lib_strong/convert/chunked_conversion_json_encode1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf82_test.dart b/tests/lib_strong/convert/chunked_conversion_utf82_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf82_test.dart
rename to tests/lib_strong/convert/chunked_conversion_utf82_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf83_test.dart b/tests/lib_strong/convert/chunked_conversion_utf83_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf83_test.dart
rename to tests/lib_strong/convert/chunked_conversion_utf83_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf84_test.dart b/tests/lib_strong/convert/chunked_conversion_utf84_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf84_test.dart
rename to tests/lib_strong/convert/chunked_conversion_utf84_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf85_test.dart b/tests/lib_strong/convert/chunked_conversion_utf85_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf85_test.dart
rename to tests/lib_strong/convert/chunked_conversion_utf85_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf86_test.dart b/tests/lib_strong/convert/chunked_conversion_utf86_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf86_test.dart
rename to tests/lib_strong/convert/chunked_conversion_utf86_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf87_test.dart b/tests/lib_strong/convert/chunked_conversion_utf87_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf87_test.dart
rename to tests/lib_strong/convert/chunked_conversion_utf87_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf88_test.dart b/tests/lib_strong/convert/chunked_conversion_utf88_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf88_test.dart
rename to tests/lib_strong/convert/chunked_conversion_utf88_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf89_test.dart b/tests/lib_strong/convert/chunked_conversion_utf89_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf89_test.dart
rename to tests/lib_strong/convert/chunked_conversion_utf89_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf8_test.dart b/tests/lib_strong/convert/chunked_conversion_utf8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/chunked_conversion_utf8_test.dart
rename to tests/lib_strong/convert/chunked_conversion_utf8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/close_test.dart b/tests/lib_strong/convert/close_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/close_test.dart
rename to tests/lib_strong/convert/close_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/codec1_test.dart b/tests/lib_strong/convert/codec1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/codec1_test.dart
rename to tests/lib_strong/convert/codec1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/codec2_test.dart b/tests/lib_strong/convert/codec2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/codec2_test.dart
rename to tests/lib_strong/convert/codec2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/encoding_test.dart b/tests/lib_strong/convert/encoding_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/encoding_test.dart
rename to tests/lib_strong/convert/encoding_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/html_escape_test.dart b/tests/lib_strong/convert/html_escape_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/html_escape_test.dart
rename to tests/lib_strong/convert/html_escape_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/json_chunk_test.dart b/tests/lib_strong/convert/json_chunk_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/json_chunk_test.dart
rename to tests/lib_strong/convert/json_chunk_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/json_lib_test.dart b/tests/lib_strong/convert/json_lib_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/json_lib_test.dart
rename to tests/lib_strong/convert/json_lib_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/json_pretty_test.dart b/tests/lib_strong/convert/json_pretty_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/json_pretty_test.dart
rename to tests/lib_strong/convert/json_pretty_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/json_test.dart b/tests/lib_strong/convert/json_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/json_test.dart
rename to tests/lib_strong/convert/json_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/json_toEncodable_reviver_test.dart b/tests/lib_strong/convert/json_toEncodable_reviver_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/json_toEncodable_reviver_test.dart
rename to tests/lib_strong/convert/json_toEncodable_reviver_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/json_unicode_tests.dart b/tests/lib_strong/convert/json_unicode_tests.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/json_unicode_tests.dart
rename to tests/lib_strong/convert/json_unicode_tests.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/json_utf8_chunk_test.dart b/tests/lib_strong/convert/json_utf8_chunk_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/json_utf8_chunk_test.dart
rename to tests/lib_strong/convert/json_utf8_chunk_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/json_util_test.dart b/tests/lib_strong/convert/json_util_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/json_util_test.dart
rename to tests/lib_strong/convert/json_util_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/latin1_test.dart b/tests/lib_strong/convert/latin1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/latin1_test.dart
rename to tests/lib_strong/convert/latin1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/line_splitter_test.dart b/tests/lib_strong/convert/line_splitter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/line_splitter_test.dart
rename to tests/lib_strong/convert/line_splitter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_json_decode1_test.dart b/tests/lib_strong/convert/streamed_conversion_json_decode1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_json_decode1_test.dart
rename to tests/lib_strong/convert/streamed_conversion_json_decode1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_json_encode1_test.dart b/tests/lib_strong/convert/streamed_conversion_json_encode1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_json_encode1_test.dart
rename to tests/lib_strong/convert/streamed_conversion_json_encode1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_json_utf8_decode_test.dart b/tests/lib_strong/convert/streamed_conversion_json_utf8_decode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_json_utf8_decode_test.dart
rename to tests/lib_strong/convert/streamed_conversion_json_utf8_decode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_json_utf8_encode_test.dart b/tests/lib_strong/convert/streamed_conversion_json_utf8_encode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_json_utf8_encode_test.dart
rename to tests/lib_strong/convert/streamed_conversion_json_utf8_encode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_utf8_decode_test.dart b/tests/lib_strong/convert/streamed_conversion_utf8_decode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_utf8_decode_test.dart
rename to tests/lib_strong/convert/streamed_conversion_utf8_decode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_utf8_encode_test.dart b/tests/lib_strong/convert/streamed_conversion_utf8_encode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/streamed_conversion_utf8_encode_test.dart
rename to tests/lib_strong/convert/streamed_conversion_utf8_encode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/unicode_tests.dart b/tests/lib_strong/convert/unicode_tests.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/unicode_tests.dart
rename to tests/lib_strong/convert/unicode_tests.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/utf82_test.dart b/tests/lib_strong/convert/utf82_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/utf82_test.dart
rename to tests/lib_strong/convert/utf82_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/utf83_test.dart b/tests/lib_strong/convert/utf83_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/utf83_test.dart
rename to tests/lib_strong/convert/utf83_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/utf84_test.dart b/tests/lib_strong/convert/utf84_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/utf84_test.dart
rename to tests/lib_strong/convert/utf84_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/utf85_test.dart b/tests/lib_strong/convert/utf85_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/utf85_test.dart
rename to tests/lib_strong/convert/utf85_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/utf8_encode_test.dart b/tests/lib_strong/convert/utf8_encode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/utf8_encode_test.dart
rename to tests/lib_strong/convert/utf8_encode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/convert/utf8_test.dart b/tests/lib_strong/convert/utf8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/convert/utf8_test.dart
rename to tests/lib_strong/convert/utf8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/Ahem.ttf b/tests/lib_strong/html/Ahem.ttf
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/Ahem.ttf
rename to tests/lib_strong/html/Ahem.ttf
Binary files differ
diff --git a/pkg/dev_compiler/test/codegen/lib/html/async_cancellingisolate.dart b/tests/lib_strong/html/async_cancellingisolate.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/async_cancellingisolate.dart
rename to tests/lib_strong/html/async_cancellingisolate.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/async_oneshot.dart b/tests/lib_strong/html/async_oneshot.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/async_oneshot.dart
rename to tests/lib_strong/html/async_oneshot.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/async_periodictimer.dart b/tests/lib_strong/html/async_periodictimer.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/async_periodictimer.dart
rename to tests/lib_strong/html/async_periodictimer.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/async_spawnuri_test.dart b/tests/lib_strong/html/async_spawnuri_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/async_spawnuri_test.dart
rename to tests/lib_strong/html/async_spawnuri_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/async_test.dart b/tests/lib_strong/html/async_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/async_test.dart
rename to tests/lib_strong/html/async_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/audiobuffersourcenode_test.dart b/tests/lib_strong/html/audiobuffersourcenode_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/audiobuffersourcenode_test.dart
rename to tests/lib_strong/html/audiobuffersourcenode_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/audiocontext_test.dart b/tests/lib_strong/html/audiocontext_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/audiocontext_test.dart
rename to tests/lib_strong/html/audiocontext_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/audioelement_test.dart b/tests/lib_strong/html/audioelement_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/audioelement_test.dart
rename to tests/lib_strong/html/audioelement_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/b_element_test.dart b/tests/lib_strong/html/b_element_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/b_element_test.dart
rename to tests/lib_strong/html/b_element_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/blob_constructor_test.dart b/tests/lib_strong/html/blob_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/blob_constructor_test.dart
rename to tests/lib_strong/html/blob_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/cache_test.dart b/tests/lib_strong/html/cache_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/cache_test.dart
rename to tests/lib_strong/html/cache_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/callbacks_test.dart b/tests/lib_strong/html/callbacks_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/callbacks_test.dart
rename to tests/lib_strong/html/callbacks_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/canvas_pixel_array_type_alias_test.dart b/tests/lib_strong/html/canvas_pixel_array_type_alias_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/canvas_pixel_array_type_alias_test.dart
rename to tests/lib_strong/html/canvas_pixel_array_type_alias_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/canvas_test.dart b/tests/lib_strong/html/canvas_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/canvas_test.dart
rename to tests/lib_strong/html/canvas_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/canvasrenderingcontext2d_test.dart b/tests/lib_strong/html/canvasrenderingcontext2d_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/canvasrenderingcontext2d_test.dart
rename to tests/lib_strong/html/canvasrenderingcontext2d_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/cdata_test.dart b/tests/lib_strong/html/cdata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/cdata_test.dart
rename to tests/lib_strong/html/cdata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/client_rect_test.dart b/tests/lib_strong/html/client_rect_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/client_rect_test.dart
rename to tests/lib_strong/html/client_rect_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/cross_domain_iframe_script.html b/tests/lib_strong/html/cross_domain_iframe_script.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/cross_domain_iframe_script.html
rename to tests/lib_strong/html/cross_domain_iframe_script.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/cross_domain_iframe_script.js b/tests/lib_strong/html/cross_domain_iframe_script.js
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/cross_domain_iframe_script.js
rename to tests/lib_strong/html/cross_domain_iframe_script.js
diff --git a/pkg/dev_compiler/test/codegen/lib/html/cross_domain_iframe_test.dart b/tests/lib_strong/html/cross_domain_iframe_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/cross_domain_iframe_test.dart
rename to tests/lib_strong/html/cross_domain_iframe_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/cross_frame_test.dart b/tests/lib_strong/html/cross_frame_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/cross_frame_test.dart
rename to tests/lib_strong/html/cross_frame_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/crypto_test.dart b/tests/lib_strong/html/crypto_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/crypto_test.dart
rename to tests/lib_strong/html/crypto_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/css_rule_list_test.dart b/tests/lib_strong/html/css_rule_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/css_rule_list_test.dart
rename to tests/lib_strong/html/css_rule_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/css_test.dart b/tests/lib_strong/html/css_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/css_test.dart
rename to tests/lib_strong/html/css_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/cssstyledeclaration_test.dart b/tests/lib_strong/html/cssstyledeclaration_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/cssstyledeclaration_test.dart
rename to tests/lib_strong/html/cssstyledeclaration_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/attribute_changed_callback_test.dart b/tests/lib_strong/html/custom/attribute_changed_callback_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/attribute_changed_callback_test.dart
rename to tests/lib_strong/html/custom/attribute_changed_callback_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/attribute_changed_callback_test.html b/tests/lib_strong/html/custom/attribute_changed_callback_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/attribute_changed_callback_test.html
rename to tests/lib_strong/html/custom/attribute_changed_callback_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/constructor_calls_created_synchronously_test.dart b/tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/constructor_calls_created_synchronously_test.dart
rename to tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/constructor_calls_created_synchronously_test.html b/tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/constructor_calls_created_synchronously_test.html
rename to tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/created_callback_test.dart b/tests/lib_strong/html/custom/created_callback_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/created_callback_test.dart
rename to tests/lib_strong/html/custom/created_callback_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/created_callback_test.html b/tests/lib_strong/html/custom/created_callback_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/created_callback_test.html
rename to tests/lib_strong/html/custom/created_callback_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_basic_test.dart b/tests/lib_strong/html/custom/document_register_basic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/document_register_basic_test.dart
rename to tests/lib_strong/html/custom/document_register_basic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_basic_test.html b/tests/lib_strong/html/custom/document_register_basic_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/document_register_basic_test.html
rename to tests/lib_strong/html/custom/document_register_basic_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_type_extensions_test.dart b/tests/lib_strong/html/custom/document_register_type_extensions_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/document_register_type_extensions_test.dart
rename to tests/lib_strong/html/custom/document_register_type_extensions_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/document_register_type_extensions_test.html b/tests/lib_strong/html/custom/document_register_type_extensions_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/document_register_type_extensions_test.html
rename to tests/lib_strong/html/custom/document_register_type_extensions_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/element_upgrade_test.dart b/tests/lib_strong/html/custom/element_upgrade_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/element_upgrade_test.dart
rename to tests/lib_strong/html/custom/element_upgrade_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/element_upgrade_test.html b/tests/lib_strong/html/custom/element_upgrade_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/element_upgrade_test.html
rename to tests/lib_strong/html/custom/element_upgrade_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/entered_left_view_test.dart b/tests/lib_strong/html/custom/entered_left_view_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/entered_left_view_test.dart
rename to tests/lib_strong/html/custom/entered_left_view_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/entered_left_view_test.html b/tests/lib_strong/html/custom/entered_left_view_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/entered_left_view_test.html
rename to tests/lib_strong/html/custom/entered_left_view_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/js_custom_test.dart b/tests/lib_strong/html/custom/js_custom_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/js_custom_test.dart
rename to tests/lib_strong/html/custom/js_custom_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/js_custom_test.html b/tests/lib_strong/html/custom/js_custom_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/js_custom_test.html
rename to tests/lib_strong/html/custom/js_custom_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/mirrors_test.dart b/tests/lib_strong/html/custom/mirrors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/mirrors_test.dart
rename to tests/lib_strong/html/custom/mirrors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/mirrors_test.html b/tests/lib_strong/html/custom/mirrors_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/mirrors_test.html
rename to tests/lib_strong/html/custom/mirrors_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom/regress_194523002_test.dart b/tests/lib_strong/html/custom/regress_194523002_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom/regress_194523002_test.dart
rename to tests/lib_strong/html/custom/regress_194523002_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom_element_method_clash_test.dart b/tests/lib_strong/html/custom_element_method_clash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom_element_method_clash_test.dart
rename to tests/lib_strong/html/custom_element_method_clash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom_element_method_clash_test.html b/tests/lib_strong/html/custom_element_method_clash_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom_element_method_clash_test.html
rename to tests/lib_strong/html/custom_element_method_clash_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom_element_name_clash_test.dart b/tests/lib_strong/html/custom_element_name_clash_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom_element_name_clash_test.dart
rename to tests/lib_strong/html/custom_element_name_clash_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom_element_name_clash_test.html b/tests/lib_strong/html/custom_element_name_clash_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom_element_name_clash_test.html
rename to tests/lib_strong/html/custom_element_name_clash_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom_elements_23127_test.dart b/tests/lib_strong/html/custom_elements_23127_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom_elements_23127_test.dart
rename to tests/lib_strong/html/custom_elements_23127_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom_elements_23127_test.html b/tests/lib_strong/html/custom_elements_23127_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom_elements_23127_test.html
rename to tests/lib_strong/html/custom_elements_23127_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom_elements_test.dart b/tests/lib_strong/html/custom_elements_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom_elements_test.dart
rename to tests/lib_strong/html/custom_elements_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom_elements_test.html b/tests/lib_strong/html/custom_elements_test.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom_elements_test.html
rename to tests/lib_strong/html/custom_elements_test.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/custom_tags_test.dart b/tests/lib_strong/html/custom_tags_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/custom_tags_test.dart
rename to tests/lib_strong/html/custom_tags_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/dart_object_local_storage_test.dart b/tests/lib_strong/html/dart_object_local_storage_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/dart_object_local_storage_test.dart
rename to tests/lib_strong/html/dart_object_local_storage_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/datalistelement_test.dart b/tests/lib_strong/html/datalistelement_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/datalistelement_test.dart
rename to tests/lib_strong/html/datalistelement_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/deferred_multi_app.dart b/tests/lib_strong/html/deferred_multi_app.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/deferred_multi_app.dart
rename to tests/lib_strong/html/deferred_multi_app.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/deferred_multi_app_htmltest.html b/tests/lib_strong/html/deferred_multi_app_htmltest.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/deferred_multi_app_htmltest.html
rename to tests/lib_strong/html/deferred_multi_app_htmltest.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/deferred_multi_app_lib.dart b/tests/lib_strong/html/deferred_multi_app_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/deferred_multi_app_lib.dart
rename to tests/lib_strong/html/deferred_multi_app_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/document_test.dart b/tests/lib_strong/html/document_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/document_test.dart
rename to tests/lib_strong/html/document_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/documentfragment_test.dart b/tests/lib_strong/html/documentfragment_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/documentfragment_test.dart
rename to tests/lib_strong/html/documentfragment_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/dom_constructors_test.dart b/tests/lib_strong/html/dom_constructors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/dom_constructors_test.dart
rename to tests/lib_strong/html/dom_constructors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/dom_isolates_test.dart.child_isolate.dart b/tests/lib_strong/html/dom_isolates_test.dart.child_isolate.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/dom_isolates_test.dart.child_isolate.dart
rename to tests/lib_strong/html/dom_isolates_test.dart.child_isolate.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/domparser_test.dart b/tests/lib_strong/html/domparser_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/domparser_test.dart
rename to tests/lib_strong/html/domparser_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_add_test.dart b/tests/lib_strong/html/element_add_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_add_test.dart
rename to tests/lib_strong/html/element_add_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_animate_test.dart b/tests/lib_strong/html/element_animate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_animate_test.dart
rename to tests/lib_strong/html/element_animate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_classes_svg_test.dart b/tests/lib_strong/html/element_classes_svg_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_classes_svg_test.dart
rename to tests/lib_strong/html/element_classes_svg_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_classes_test.dart b/tests/lib_strong/html/element_classes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_classes_test.dart
rename to tests/lib_strong/html/element_classes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_constructor_1_test.dart b/tests/lib_strong/html/element_constructor_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_constructor_1_test.dart
rename to tests/lib_strong/html/element_constructor_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_dimensions_test.dart b/tests/lib_strong/html/element_dimensions_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_dimensions_test.dart
rename to tests/lib_strong/html/element_dimensions_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_offset_test.dart b/tests/lib_strong/html/element_offset_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_offset_test.dart
rename to tests/lib_strong/html/element_offset_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_test.dart b/tests/lib_strong/html/element_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_test.dart
rename to tests/lib_strong/html/element_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_types_constructors1_test.dart b/tests/lib_strong/html/element_types_constructors1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_types_constructors1_test.dart
rename to tests/lib_strong/html/element_types_constructors1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_types_constructors2_test.dart b/tests/lib_strong/html/element_types_constructors2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_types_constructors2_test.dart
rename to tests/lib_strong/html/element_types_constructors2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_types_constructors3_test.dart b/tests/lib_strong/html/element_types_constructors3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_types_constructors3_test.dart
rename to tests/lib_strong/html/element_types_constructors3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_types_constructors4_test.dart b/tests/lib_strong/html/element_types_constructors4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_types_constructors4_test.dart
rename to tests/lib_strong/html/element_types_constructors4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_types_constructors5_test.dart b/tests/lib_strong/html/element_types_constructors5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_types_constructors5_test.dart
rename to tests/lib_strong/html/element_types_constructors5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_types_constructors6_test.dart b/tests/lib_strong/html/element_types_constructors6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_types_constructors6_test.dart
rename to tests/lib_strong/html/element_types_constructors6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/element_types_test.dart b/tests/lib_strong/html/element_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/element_types_test.dart
rename to tests/lib_strong/html/element_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/event_customevent_test.dart b/tests/lib_strong/html/event_customevent_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/event_customevent_test.dart
rename to tests/lib_strong/html/event_customevent_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/event_test.dart b/tests/lib_strong/html/event_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/event_test.dart
rename to tests/lib_strong/html/event_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/events_test.dart b/tests/lib_strong/html/events_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/events_test.dart
rename to tests/lib_strong/html/events_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/exceptions_test.dart b/tests/lib_strong/html/exceptions_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/exceptions_test.dart
rename to tests/lib_strong/html/exceptions_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/fileapi_test.dart b/tests/lib_strong/html/fileapi_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/fileapi_test.dart
rename to tests/lib_strong/html/fileapi_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/filereader_test.dart b/tests/lib_strong/html/filereader_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/filereader_test.dart
rename to tests/lib_strong/html/filereader_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/filteredelementlist_test.dart b/tests/lib_strong/html/filteredelementlist_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/filteredelementlist_test.dart
rename to tests/lib_strong/html/filteredelementlist_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/fontface_loaded_test.dart b/tests/lib_strong/html/fontface_loaded_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/fontface_loaded_test.dart
rename to tests/lib_strong/html/fontface_loaded_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/fontface_test.dart b/tests/lib_strong/html/fontface_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/fontface_test.dart
rename to tests/lib_strong/html/fontface_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/form_data_test.dart b/tests/lib_strong/html/form_data_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/form_data_test.dart
rename to tests/lib_strong/html/form_data_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/form_element_test.dart b/tests/lib_strong/html/form_element_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/form_element_test.dart
rename to tests/lib_strong/html/form_element_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/geolocation_test.dart b/tests/lib_strong/html/geolocation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/geolocation_test.dart
rename to tests/lib_strong/html/geolocation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/hidden_dom_1_test.dart b/tests/lib_strong/html/hidden_dom_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/hidden_dom_1_test.dart
rename to tests/lib_strong/html/hidden_dom_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/hidden_dom_2_test.dart b/tests/lib_strong/html/hidden_dom_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/hidden_dom_2_test.dart
rename to tests/lib_strong/html/hidden_dom_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/history_test.dart b/tests/lib_strong/html/history_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/history_test.dart
rename to tests/lib_strong/html/history_test.dart
diff --git a/tests/lib_strong/html/html_mock_test.dart b/tests/lib_strong/html/html_mock_test.dart
new file mode 100644
index 0000000..9b6daf8
--- /dev/null
+++ b/tests/lib_strong/html/html_mock_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:html';
+
+import 'package:expect/minitest.dart';
+
+class Mock {
+  noSuchMethod(Invocation i) => document;
+}
+
+@proxy
+class MockWindow extends Mock implements Window {}
+
+main() {
+  test('is', () {
+    var win = new MockWindow();
+    expect(win is Window, isTrue);
+  });
+
+  test('getter', () {
+    var win = new MockWindow();
+    expect(win.document, equals(document));
+  });
+}
diff --git a/pkg/dev_compiler/test/codegen/lib/html/htmlcollection_test.dart b/tests/lib_strong/html/htmlcollection_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/htmlcollection_test.dart
rename to tests/lib_strong/html/htmlcollection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/htmlelement_test.dart b/tests/lib_strong/html/htmlelement_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/htmlelement_test.dart
rename to tests/lib_strong/html/htmlelement_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/htmloptionscollection_test.dart b/tests/lib_strong/html/htmloptionscollection_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/htmloptionscollection_test.dart
rename to tests/lib_strong/html/htmloptionscollection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/indexeddb_1_test.dart b/tests/lib_strong/html/indexeddb_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/indexeddb_1_test.dart
rename to tests/lib_strong/html/indexeddb_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/indexeddb_2_test.dart b/tests/lib_strong/html/indexeddb_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/indexeddb_2_test.dart
rename to tests/lib_strong/html/indexeddb_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/indexeddb_3_test.dart b/tests/lib_strong/html/indexeddb_3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/indexeddb_3_test.dart
rename to tests/lib_strong/html/indexeddb_3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/indexeddb_4_test.dart b/tests/lib_strong/html/indexeddb_4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/indexeddb_4_test.dart
rename to tests/lib_strong/html/indexeddb_4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/indexeddb_5_test.dart b/tests/lib_strong/html/indexeddb_5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/indexeddb_5_test.dart
rename to tests/lib_strong/html/indexeddb_5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/input_element_test.dart b/tests/lib_strong/html/input_element_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/input_element_test.dart
rename to tests/lib_strong/html/input_element_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/instance_of_test.dart b/tests/lib_strong/html/instance_of_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/instance_of_test.dart
rename to tests/lib_strong/html/instance_of_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/interactive_test.dart b/tests/lib_strong/html/interactive_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/interactive_test.dart
rename to tests/lib_strong/html/interactive_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/isolates_test.dart b/tests/lib_strong/html/isolates_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/isolates_test.dart
rename to tests/lib_strong/html/isolates_test.dart
diff --git a/tests/lib_strong/html/js_extend_class_test.dart b/tests/lib_strong/html/js_extend_class_test.dart
new file mode 100644
index 0000000..eb6ea57
--- /dev/null
+++ b/tests/lib_strong/html/js_extend_class_test.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+@JS()
+library js_extend_class_test;
+
+import 'dart:html';
+
+import 'package:js/js.dart';
+import 'package:js/js_util.dart' as js_util;
+import 'package:expect/minitest.dart';
+
+@JS('Date')
+class JSDate {
+  external get jsField;
+  external get jsMethod;
+}
+
+@JS('Date.prototype.jsField')
+external set datePrototypeJSField(v);
+
+@JS('Date.prototype.jsMethod')
+external set datePrototypeJSMethod(v);
+
+// Extending a JS class with a Dart class is only supported by DDC for now.
+// We extend the Date class instead of a user defined JS class to avoid the
+// hassle of ensuring the JS class exists before we use it.
+class DartJsDate extends JSDate {
+  get dartField => 100;
+  int dartMethod(x) {
+    return x * 2;
+  }
+}
+
+main() {
+  // Monkey-patch the JS Date class.
+  datePrototypeJSField = 42;
+  datePrototypeJSMethod = allowInterop((x) => x * 10);
+
+  group('extend js class', () {
+    test('js class members', () {
+      var bar = new DartJsDate();
+      expect(bar.jsField, equals(42));
+      expect(bar.jsMethod(5), equals(50));
+
+      expect(bar.dartField, equals(100));
+      expect(bar.dartMethod(4), equals(8));
+    });
+
+    test('dart subclass members', () {
+      var bar = new DartJsDate();
+      expect(bar.dartField, equals(100));
+      expect(bar.dartMethod(4), equals(8));
+    });
+  });
+}
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_function_getter_test.dart b/tests/lib_strong/html/js_function_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_function_getter_test.dart
rename to tests/lib_strong/html/js_function_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_function_getter_trust_types_test.dart b/tests/lib_strong/html/js_function_getter_trust_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_function_getter_trust_types_test.dart
rename to tests/lib_strong/html/js_function_getter_trust_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_interop_1_test.dart b/tests/lib_strong/html/js_interop_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_interop_1_test.dart
rename to tests/lib_strong/html/js_interop_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_test.dart b/tests/lib_strong/html/js_test.dart
similarity index 94%
rename from pkg/dev_compiler/test/codegen/lib/html/js_test.dart
rename to tests/lib_strong/html/js_test.dart
index 675ddde..c55b926 100644
--- a/pkg/dev_compiler/test/codegen/lib/html/js_test.dart
+++ b/tests/lib_strong/html/js_test.dart
@@ -3,9 +3,10 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:html';
-import 'dart:typed_data' show ByteBuffer, Int32List;
+import 'dart:typed_data' show Int32List;
 import 'dart:indexed_db' show IdbFactory, KeyRange;
 import 'dart:js';
+import 'package:js/js_util.dart' as js_util;
 
 import 'package:expect/minitest.dart';
 
@@ -508,8 +509,6 @@
 
     test('pass Array to JS', () {
       context['a'] = [1, 2, 3];
-      expect(context.callMethod('isPropertyInstanceOf',
-          ['a', context['Array']]), isTrue);
       var a = context['a'];
       expect(a is List, isTrue);
       expect(a is JsArray, isFalse);
@@ -650,6 +649,13 @@
       context.deleteProperty('callback');
     });
 
+    test('pass a Dart function to JS and back', () {
+      var dartFunction = () => 42;
+      context['dartFunction'] = dartFunction;
+      expect(identical(context['dartFunction'], dartFunction), isTrue);
+      context.deleteProperty('dartFunction');
+    });
+
     test('callback as parameter', () {
       expect(context.callMethod('getTypeOf', [context['razzle']]),
           equals("function"));
@@ -842,8 +848,6 @@
         expect(context['window'] is Window, isTrue);
       });
 
-      // Bug: dartbug.com/24520
-      /*
       test('foreign browser objects should be proxied', () {
         var iframe = new IFrameElement();
         document.body.children.add(iframe);
@@ -851,26 +855,48 @@
 
         // Window
         var contentWindow = proxy['contentWindow'];
-        expect(contentWindow, isNot(new isInstanceOf<Window>()));
-        expect(contentWindow, new isInstanceOf<JsObject>());
+        expect(contentWindow is! Window, isTrue);
+        expect(contentWindow is JsObject, isTrue);
 
         // Node
         var foreignDoc = contentWindow['document'];
-        expect(foreignDoc, isNot(new isInstanceOf<Node>()));
-        expect(foreignDoc, new isInstanceOf<JsObject>());
+        expect(foreignDoc is! Node, isTrue);
+        expect(foreignDoc is JsObject, isTrue);
 
         // Event
         var clicked = false;
         foreignDoc['onclick'] = (e) {
-          expect(e, isNot(new isInstanceOf<Event>()));
-          expect(e, new isInstanceOf<JsObject>());
+          expect(e is! Event, isTrue);
+          expect(e is JsObject, isTrue);
           clicked = true;
         };
 
         context.callMethod('fireClickEvent', [contentWindow]);
         expect(clicked, isTrue);
       });
-      */
+
+      test('foreign functions pass function is checks', () {
+        var iframe = new IFrameElement();
+        document.body.children.add(iframe);
+        var proxy = new JsObject.fromBrowserObject(iframe);
+
+        var contentWindow = proxy['contentWindow'];
+        var foreignDoc = contentWindow['document'];
+
+        // Function
+        var foreignFunction = foreignDoc['createElement'];
+        expect(foreignFunction is JsFunction, isTrue);
+
+        // Verify that internal isChecks in callMethod work.
+        foreignDoc.callMethod('createElement', ['div']);
+
+        var typedContentWindow = js_util.getProperty(iframe, 'contentWindow');
+        var typedForeignDoc = js_util.getProperty(typedContentWindow, 'document');
+
+        var typedForeignFunction = js_util.getProperty(typedForeignDoc, 'createElement');
+        expect(typedForeignFunction is Function, isTrue);
+        js_util.callMethod(typedForeignDoc, 'createElement', ['div']);
+      });
 
       test('document', () {
         expect(context['document'] is Document, isTrue);
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous2_exp_test.dart b/tests/lib_strong/html/js_typed_interop_anonymous2_exp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous2_exp_test.dart
rename to tests/lib_strong/html/js_typed_interop_anonymous2_exp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous2_test.dart b/tests/lib_strong/html/js_typed_interop_anonymous2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous2_test.dart
rename to tests/lib_strong/html/js_typed_interop_anonymous2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous_exp_test.dart b/tests/lib_strong/html/js_typed_interop_anonymous_exp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous_exp_test.dart
rename to tests/lib_strong/html/js_typed_interop_anonymous_exp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous_test.dart b/tests/lib_strong/html/js_typed_interop_anonymous_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous_test.dart
rename to tests/lib_strong/html/js_typed_interop_anonymous_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous_unreachable_exp_test.dart b/tests/lib_strong/html/js_typed_interop_anonymous_unreachable_exp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous_unreachable_exp_test.dart
rename to tests/lib_strong/html/js_typed_interop_anonymous_unreachable_exp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous_unreachable_test.dart b/tests/lib_strong/html/js_typed_interop_anonymous_unreachable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_anonymous_unreachable_test.dart
rename to tests/lib_strong/html/js_typed_interop_anonymous_unreachable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_default_arg_test.dart b/tests/lib_strong/html/js_typed_interop_default_arg_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_default_arg_test.dart
rename to tests/lib_strong/html/js_typed_interop_default_arg_test.dart
diff --git a/tests/lib_strong/html/js_typed_interop_dynamic_test.dart b/tests/lib_strong/html/js_typed_interop_dynamic_test.dart
new file mode 100644
index 0000000..9c77cd8
--- /dev/null
+++ b/tests/lib_strong/html/js_typed_interop_dynamic_test.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2015, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+@JS()
+library js_typed_interop_anonymous_test;
+
+import 'dart:html';
+import 'dart:js' as js;
+
+import 'package:js/js.dart';
+import 'package:js/js_util.dart' as js_util;
+import 'package:expect/minitest.dart';
+
+@JS()
+@anonymous
+class Literal {
+  external factory Literal({int x, String y, num z, Function foo});
+
+  external int get x;
+  external String get y;
+  external num get z;
+  external Function get foo;
+}
+
+@JS()
+@anonymous
+class FunctionWithExpando {
+  external int call();
+  external String get myExpando;
+}
+
+main() {
+  test('object', () {
+    dynamic l = new Literal(x: 3, y: 'foo', foo: allowInterop((x) => x * 2));
+    expect(l.x, equals(3));
+    expect(l.y, equals('foo'));
+    expect(l.z, isNull);
+    expect(l.foo(4), equals(8));
+  });
+
+  test('function', () {
+    // Get a JS function.
+    dynamic f = js_util.getProperty(window, 'addEventListener');
+    js_util.setProperty(f, 'myExpando', 'foo');
+    expect(f.myExpando, equals('foo'));
+  });
+
+  test('dart object', () {
+    dynamic o = new Object();
+    js_util.setProperty(o, 'x', 3);
+    expect(() => o.x, throwsNoSuchMethodError);
+    expect(() => o.foo(), throwsNoSuchMethodError);
+  });
+}
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_lazy_test.dart b/tests/lib_strong/html/js_typed_interop_lazy_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_lazy_test.dart
rename to tests/lib_strong/html/js_typed_interop_lazy_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_rename_static_test.dart b/tests/lib_strong/html/js_typed_interop_rename_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_rename_static_test.dart
rename to tests/lib_strong/html/js_typed_interop_rename_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_side_cast_exp_test.dart b/tests/lib_strong/html/js_typed_interop_side_cast_exp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_side_cast_exp_test.dart
rename to tests/lib_strong/html/js_typed_interop_side_cast_exp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_side_cast_test.dart b/tests/lib_strong/html/js_typed_interop_side_cast_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_side_cast_test.dart
rename to tests/lib_strong/html/js_typed_interop_side_cast_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_test.dart b/tests/lib_strong/html/js_typed_interop_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_test.dart
rename to tests/lib_strong/html/js_typed_interop_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_util_test.dart b/tests/lib_strong/html/js_util_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/js_util_test.dart
rename to tests/lib_strong/html/js_util_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/json_helper.dart b/tests/lib_strong/html/json_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/json_helper.dart
rename to tests/lib_strong/html/json_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/keyboard_event_test.dart b/tests/lib_strong/html/keyboard_event_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/keyboard_event_test.dart
rename to tests/lib_strong/html/keyboard_event_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/localstorage_test.dart b/tests/lib_strong/html/localstorage_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/localstorage_test.dart
rename to tests/lib_strong/html/localstorage_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/location_test.dart b/tests/lib_strong/html/location_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/location_test.dart
rename to tests/lib_strong/html/location_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/media_stream_test.dart b/tests/lib_strong/html/media_stream_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/media_stream_test.dart
rename to tests/lib_strong/html/media_stream_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/mediasource_test.dart b/tests/lib_strong/html/mediasource_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/mediasource_test.dart
rename to tests/lib_strong/html/mediasource_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/messageevent_test.dart b/tests/lib_strong/html/messageevent_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/messageevent_test.dart
rename to tests/lib_strong/html/messageevent_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/mirrors_js_typed_interop_test.dart b/tests/lib_strong/html/mirrors_js_typed_interop_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/mirrors_js_typed_interop_test.dart
rename to tests/lib_strong/html/mirrors_js_typed_interop_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/mouse_event_test.dart b/tests/lib_strong/html/mouse_event_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/mouse_event_test.dart
rename to tests/lib_strong/html/mouse_event_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/mutationobserver_test.dart b/tests/lib_strong/html/mutationobserver_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/mutationobserver_test.dart
rename to tests/lib_strong/html/mutationobserver_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/native_gc_test.dart b/tests/lib_strong/html/native_gc_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/native_gc_test.dart
rename to tests/lib_strong/html/native_gc_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/navigator_test.dart b/tests/lib_strong/html/navigator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/navigator_test.dart
rename to tests/lib_strong/html/navigator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/no_linked_scripts_htmltest.html b/tests/lib_strong/html/no_linked_scripts_htmltest.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/no_linked_scripts_htmltest.html
rename to tests/lib_strong/html/no_linked_scripts_htmltest.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/node_test.dart b/tests/lib_strong/html/node_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/node_test.dart
rename to tests/lib_strong/html/node_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart b/tests/lib_strong/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart
rename to tests/lib_strong/html/node_validator_important_if_you_suppress_make_the_bug_critical_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/non_instantiated_is_test.dart b/tests/lib_strong/html/non_instantiated_is_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/non_instantiated_is_test.dart
rename to tests/lib_strong/html/non_instantiated_is_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/notification_test.dart b/tests/lib_strong/html/notification_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/notification_test.dart
rename to tests/lib_strong/html/notification_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/performance_api_test.dart b/tests/lib_strong/html/performance_api_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/performance_api_test.dart
rename to tests/lib_strong/html/performance_api_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/postmessage_structured_test.dart b/tests/lib_strong/html/postmessage_structured_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/postmessage_structured_test.dart
rename to tests/lib_strong/html/postmessage_structured_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/private_extension_member_test.dart b/tests/lib_strong/html/private_extension_member_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/private_extension_member_test.dart
rename to tests/lib_strong/html/private_extension_member_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/query_test.dart b/tests/lib_strong/html/query_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/query_test.dart
rename to tests/lib_strong/html/query_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/queryall_test.dart b/tests/lib_strong/html/queryall_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/queryall_test.dart
rename to tests/lib_strong/html/queryall_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/range_test.dart b/tests/lib_strong/html/range_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/range_test.dart
rename to tests/lib_strong/html/range_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/request_animation_frame_test.dart b/tests/lib_strong/html/request_animation_frame_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/request_animation_frame_test.dart
rename to tests/lib_strong/html/request_animation_frame_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/resource_data.txt b/tests/lib_strong/html/resource_data.txt
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/resource_data.txt
rename to tests/lib_strong/html/resource_data.txt
diff --git a/pkg/dev_compiler/test/codegen/lib/html/resource_http_test.dart b/tests/lib_strong/html/resource_http_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/resource_http_test.dart
rename to tests/lib_strong/html/resource_http_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/rtc_test.dart b/tests/lib_strong/html/rtc_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/rtc_test.dart
rename to tests/lib_strong/html/rtc_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/scripts_htmltest.html b/tests/lib_strong/html/scripts_htmltest.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/scripts_htmltest.html
rename to tests/lib_strong/html/scripts_htmltest.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/scripts_test_dart.dart b/tests/lib_strong/html/scripts_test_dart.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/scripts_test_dart.dart
rename to tests/lib_strong/html/scripts_test_dart.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/scripts_test_js.js b/tests/lib_strong/html/scripts_test_js.js
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/scripts_test_js.js
rename to tests/lib_strong/html/scripts_test_js.js
diff --git a/pkg/dev_compiler/test/codegen/lib/html/selectelement_test.dart b/tests/lib_strong/html/selectelement_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/selectelement_test.dart
rename to tests/lib_strong/html/selectelement_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/serialized_script_value_test.dart b/tests/lib_strong/html/serialized_script_value_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/serialized_script_value_test.dart
rename to tests/lib_strong/html/serialized_script_value_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/shadow_dom_test.dart b/tests/lib_strong/html/shadow_dom_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/shadow_dom_test.dart
rename to tests/lib_strong/html/shadow_dom_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/shadowroot_test.dart b/tests/lib_strong/html/shadowroot_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/shadowroot_test.dart
rename to tests/lib_strong/html/shadowroot_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/small.mp4 b/tests/lib_strong/html/small.mp4
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/small.mp4
rename to tests/lib_strong/html/small.mp4
Binary files differ
diff --git a/pkg/dev_compiler/test/codegen/lib/html/small.webm b/tests/lib_strong/html/small.webm
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/small.webm
rename to tests/lib_strong/html/small.webm
Binary files differ
diff --git a/pkg/dev_compiler/test/codegen/lib/html/speechrecognition_test.dart b/tests/lib_strong/html/speechrecognition_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/speechrecognition_test.dart
rename to tests/lib_strong/html/speechrecognition_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/storage_test.dart b/tests/lib_strong/html/storage_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/storage_test.dart
rename to tests/lib_strong/html/storage_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/streams_test.dart b/tests/lib_strong/html/streams_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/streams_test.dart
rename to tests/lib_strong/html/streams_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/svg_test.dart b/tests/lib_strong/html/svg_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/svg_test.dart
rename to tests/lib_strong/html/svg_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/svgelement_test.dart b/tests/lib_strong/html/svgelement_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/svgelement_test.dart
rename to tests/lib_strong/html/svgelement_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/table_test.dart b/tests/lib_strong/html/table_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/table_test.dart
rename to tests/lib_strong/html/table_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/text_event_test.dart b/tests/lib_strong/html/text_event_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/text_event_test.dart
rename to tests/lib_strong/html/text_event_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/touchevent_test.dart b/tests/lib_strong/html/touchevent_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/touchevent_test.dart
rename to tests/lib_strong/html/touchevent_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/track_element_constructor_test.dart b/tests/lib_strong/html/track_element_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/track_element_constructor_test.dart
rename to tests/lib_strong/html/track_element_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/transferables_test.dart b/tests/lib_strong/html/transferables_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/transferables_test.dart
rename to tests/lib_strong/html/transferables_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/transition_event_test.dart b/tests/lib_strong/html/transition_event_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/transition_event_test.dart
rename to tests/lib_strong/html/transition_event_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/trusted_html_tree_sanitizer_test.dart b/tests/lib_strong/html/trusted_html_tree_sanitizer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/trusted_html_tree_sanitizer_test.dart
rename to tests/lib_strong/html/trusted_html_tree_sanitizer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/two_scripts_htmltest.html b/tests/lib_strong/html/two_scripts_htmltest.html
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/two_scripts_htmltest.html
rename to tests/lib_strong/html/two_scripts_htmltest.html
diff --git a/pkg/dev_compiler/test/codegen/lib/html/two_scripts_test_first.dart b/tests/lib_strong/html/two_scripts_test_first.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/two_scripts_test_first.dart
rename to tests/lib_strong/html/two_scripts_test_first.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/two_scripts_test_second.dart b/tests/lib_strong/html/two_scripts_test_second.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/two_scripts_test_second.dart
rename to tests/lib_strong/html/two_scripts_test_second.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_1_test.dart b/tests/lib_strong/html/typed_arrays_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typed_arrays_1_test.dart
rename to tests/lib_strong/html/typed_arrays_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_2_test.dart b/tests/lib_strong/html/typed_arrays_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typed_arrays_2_test.dart
rename to tests/lib_strong/html/typed_arrays_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_3_test.dart b/tests/lib_strong/html/typed_arrays_3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typed_arrays_3_test.dart
rename to tests/lib_strong/html/typed_arrays_3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_4_test.dart b/tests/lib_strong/html/typed_arrays_4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typed_arrays_4_test.dart
rename to tests/lib_strong/html/typed_arrays_4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_5_test.dart b/tests/lib_strong/html/typed_arrays_5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typed_arrays_5_test.dart
rename to tests/lib_strong/html/typed_arrays_5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_arraybuffer_test.dart b/tests/lib_strong/html/typed_arrays_arraybuffer_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typed_arrays_arraybuffer_test.dart
rename to tests/lib_strong/html/typed_arrays_arraybuffer_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_dataview_test.dart b/tests/lib_strong/html/typed_arrays_dataview_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typed_arrays_dataview_test.dart
rename to tests/lib_strong/html/typed_arrays_dataview_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_range_checks_test.dart b/tests/lib_strong/html/typed_arrays_range_checks_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typed_arrays_range_checks_test.dart
rename to tests/lib_strong/html/typed_arrays_range_checks_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typed_arrays_simd_test.dart b/tests/lib_strong/html/typed_arrays_simd_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typed_arrays_simd_test.dart
rename to tests/lib_strong/html/typed_arrays_simd_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/typing_test.dart b/tests/lib_strong/html/typing_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/typing_test.dart
rename to tests/lib_strong/html/typing_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/unknownelement_test.dart b/tests/lib_strong/html/unknownelement_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/unknownelement_test.dart
rename to tests/lib_strong/html/unknownelement_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/uri_test.dart b/tests/lib_strong/html/uri_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/uri_test.dart
rename to tests/lib_strong/html/uri_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/url_test.dart b/tests/lib_strong/html/url_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/url_test.dart
rename to tests/lib_strong/html/url_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/util.dart b/tests/lib_strong/html/util.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/util.dart
rename to tests/lib_strong/html/util.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/utils.dart b/tests/lib_strong/html/utils.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/utils.dart
rename to tests/lib_strong/html/utils.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/webgl_1_test.dart b/tests/lib_strong/html/webgl_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/webgl_1_test.dart
rename to tests/lib_strong/html/webgl_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/websocket_test.dart b/tests/lib_strong/html/websocket_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/websocket_test.dart
rename to tests/lib_strong/html/websocket_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/websql_test.dart b/tests/lib_strong/html/websql_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/websql_test.dart
rename to tests/lib_strong/html/websql_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/wheelevent_test.dart b/tests/lib_strong/html/wheelevent_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/wheelevent_test.dart
rename to tests/lib_strong/html/wheelevent_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/window_eq_test.dart b/tests/lib_strong/html/window_eq_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/window_eq_test.dart
rename to tests/lib_strong/html/window_eq_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/window_mangling_test.dart b/tests/lib_strong/html/window_mangling_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/window_mangling_test.dart
rename to tests/lib_strong/html/window_mangling_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/window_nosuchmethod_test.dart b/tests/lib_strong/html/window_nosuchmethod_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/window_nosuchmethod_test.dart
rename to tests/lib_strong/html/window_nosuchmethod_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/window_test.dart b/tests/lib_strong/html/window_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/window_test.dart
rename to tests/lib_strong/html/window_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/worker_api_test.dart b/tests/lib_strong/html/worker_api_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/worker_api_test.dart
rename to tests/lib_strong/html/worker_api_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/worker_test.dart b/tests/lib_strong/html/worker_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/worker_test.dart
rename to tests/lib_strong/html/worker_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/wrapping_collections_test.dart b/tests/lib_strong/html/wrapping_collections_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/wrapping_collections_test.dart
rename to tests/lib_strong/html/wrapping_collections_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/xhr_cross_origin_data.txt b/tests/lib_strong/html/xhr_cross_origin_data.txt
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/xhr_cross_origin_data.txt
rename to tests/lib_strong/html/xhr_cross_origin_data.txt
diff --git a/pkg/dev_compiler/test/codegen/lib/html/xhr_cross_origin_test.dart b/tests/lib_strong/html/xhr_cross_origin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/xhr_cross_origin_test.dart
rename to tests/lib_strong/html/xhr_cross_origin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/xhr_test.dart b/tests/lib_strong/html/xhr_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/xhr_test.dart
rename to tests/lib_strong/html/xhr_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/html/xsltprocessor_test.dart b/tests/lib_strong/html/xsltprocessor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/html/xsltprocessor_test.dart
rename to tests/lib_strong/html/xsltprocessor_test.dart
diff --git a/tests/lib_strong/lib_strong.status b/tests/lib_strong/lib_strong.status
new file mode 100644
index 0000000..99f3ea5
--- /dev/null
+++ b/tests/lib_strong/lib_strong.status
@@ -0,0 +1,132 @@
+# Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# Skip entire suite if not running in strong mode.
+[ $strong == false ]
+*: SkipByDesign
+
+# Skip tests that are not yet strong-mode clean.
+[ $strong == true ]
+convert/chunked_conversion1_test: Skip
+convert/chunked_conversion_json_encode1_test: Skip
+convert/chunked_conversion_utf84_test: Skip
+convert/chunked_conversion_utf88_test: Skip
+convert/chunked_conversion_utf8_test: Skip
+convert/line_splitter_test: Skip
+html/cross_frame_test: Skip
+html/element_test: Skip
+html/events_test: Skip
+html/fileapi_test: Skip
+html/filereader_test: Skip
+html/fontface_loaded_test: Skip
+html/js_function_getter_trust_types_test: Skip
+html/js_typed_interop_side_cast_exp_test: Skip
+html/js_typed_interop_side_cast_test: Skip
+html/keyboard_event_test: Skip
+html/mutationobserver_test: Skip
+html/postmessage_structured_test: Skip
+html/resource_http_test: Skip
+html/transferables_test: Skip
+html/webgl_1_test: Skip
+html/wrapping_collections_test: Skip
+math/min_max_test: Skip
+mirrors/abstract_class_test: Skip
+mirrors/abstract_test: Skip
+mirrors/circular_factory_redirection_test: Skip
+mirrors/class_declarations_test: Skip
+mirrors/closures_test: Skip
+mirrors/constructors_test: Skip
+mirrors/dart2js_mirrors_test: Skip
+mirrors/deferred_type_test: Skip
+mirrors/delegate_call_through_getter_test: Skip
+mirrors/delegate_class_test: Skip
+mirrors/delegate_function_invocation_test: Skip
+mirrors/delegate_library_test: Skip
+mirrors/delegate_test: Skip
+mirrors/enum_test: Skip
+mirrors/fake_function_without_call_test: Skip
+mirrors/generic_bounded_by_type_parameter_test: Skip
+mirrors/generic_bounded_test: Skip
+mirrors/generic_class_declaration_test: Skip
+mirrors/generic_f_bounded_mixin_application_test: Skip
+mirrors/generic_interface_test: Skip
+mirrors/generics_test: Skip
+mirrors/get_symbol_name_no_such_method_test: Skip
+mirrors/immutable_collections_test: Skip
+mirrors/inference_and_no_such_method_test: Skip
+mirrors/inherit_field_test: Skip
+mirrors/initializing_formals_test: Skip
+mirrors/instance_members_easier_test: Skip
+mirrors/instance_members_test: Skip
+mirrors/instance_members_with_override_test: Skip
+mirrors/intercepted_class_test: Skip
+mirrors/intercepted_object_test: Skip
+mirrors/invoke_call_through_getter_previously_accessed_test: Skip
+mirrors/invoke_call_through_getter_test: Skip
+mirrors/invoke_call_through_implicit_getter_previously_accessed_test: Skip
+mirrors/invoke_call_through_implicit_getter_test: Skip
+mirrors/lazy_static_test: Skip
+mirrors/library_declarations_test: Skip
+mirrors/library_exports_hidden_test: Skip
+mirrors/library_exports_shown_test: Skip
+mirrors/library_import_deferred_loading_test: Skip
+mirrors/library_imports_bad_metadata_test: Skip
+mirrors/library_imports_deferred_test: Skip
+mirrors/library_imports_hidden_test: Skip
+mirrors/library_imports_metadata_test: Skip
+mirrors/library_imports_prefixed_show_hide_test: Skip
+mirrors/library_imports_prefixed_test: Skip
+mirrors/library_imports_shown_test: Skip
+mirrors/library_metadata2_test: Skip
+mirrors/load_library_test: Skip
+mirrors/metadata_allowed_values_test: Skip
+mirrors/metadata_constructor_arguments_test: Skip
+mirrors/metadata_nested_constructor_call_test: Skip
+mirrors/metadata_scope_test: Skip
+mirrors/method_mirror_name_test: Skip
+mirrors/method_mirror_properties_test: Skip
+mirrors/mirror_in_static_init_test: Skip
+mirrors/mirrors_nsm_mismatch_test: Skip
+mirrors/mirrors_nsm_test: Skip
+mirrors/mirrors_test: Skip
+mirrors/mirrors_used_get_name2_test: Skip
+mirrors/mirrors_used_get_name_test: Skip
+mirrors/mirrors_used_inheritance_test: Skip
+mirrors/mixin_application_test: Skip
+mirrors/mixin_members_test: Skip
+mirrors/model_test: Skip
+mirrors/native_class_test: Skip
+mirrors/no_metadata_test: Skip
+mirrors/operator_test: Skip
+mirrors/parameter_is_const_test: Skip
+mirrors/parameter_of_mixin_app_constructor_test: Skip
+mirrors/parameter_test: Skip
+mirrors/private_symbol_test: Skip
+mirrors/redirecting_factory_different_type_test: Skip
+mirrors/redirecting_factory_test: Skip
+mirrors/reflect_class_test: Skip
+mirrors/reflect_model_test: Skip
+mirrors/reflected_type_classes_test: Skip
+mirrors/reflected_type_test: Skip
+mirrors/regress_16321_test: Skip
+mirrors/regress_19731_test: Skip
+mirrors/relation_subclass_test: Skip
+mirrors/removed_api_test: Skip
+mirrors/repeated_private_anon_mixin_app_test: Skip
+mirrors/return_type_test: Skip
+mirrors/set_field_with_final_inheritance_test: Skip
+mirrors/static_members_easier_test: Skip
+mirrors/static_members_test: Skip
+mirrors/static_test: Skip
+mirrors/syntax_error_test: Skip
+mirrors/synthetic_accessor_properties_test: Skip
+mirrors/top_level_accessors_test: Skip
+mirrors/type_mirror_for_type_test: Skip
+mirrors/typearguments_mirror_test: Skip
+mirrors/typedef_in_signature_test: Skip
+mirrors/typedef_reflected_type_test: Skip
+mirrors/variable_is_const_test: Skip
+typed_data/float32x4_test: Skip
+typed_data/float64x2_functional_test: Skip
+typed_data/int32x4_test: Skip
diff --git a/tests/lib_strong/lib_strong_kernel.status b/tests/lib_strong/lib_strong_kernel.status
new file mode 100644
index 0000000..ccbc515
--- /dev/null
+++ b/tests/lib_strong/lib_strong_kernel.status
@@ -0,0 +1,259 @@
+# Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+[ $compiler == dartk && $runtime == vm ]
+convert/ascii_test: DartkCompileTimeError
+convert/chunked_conversion_json_decode1_test: DartkCompileTimeError
+convert/chunked_conversion_utf82_test: DartkCompileTimeError
+convert/chunked_conversion_utf83_test: DartkCompileTimeError
+convert/chunked_conversion_utf85_test: DartkCompileTimeError
+convert/encoding_test: DartkCompileTimeError
+convert/json_toEncodable_reviver_test: Crash # Type error in constant
+convert/json_utf8_chunk_test: DartkCompileTimeError
+convert/latin1_test: DartkCompileTimeError
+convert/streamed_conversion_json_encode1_test: RuntimeError
+convert/streamed_conversion_json_utf8_decode_test: DartkCompileTimeError
+convert/streamed_conversion_json_utf8_encode_test: DartkCompileTimeError
+convert/streamed_conversion_utf8_decode_test: DartkCompileTimeError
+convert/streamed_conversion_utf8_encode_test: DartkCompileTimeError
+convert/utf8_encode_test: DartkCompileTimeError
+convert/utf8_test: DartkCompileTimeError
+html/async_spawnuri_test: DartkCompileTimeError
+html/async_test: DartkCompileTimeError
+html/audiobuffersourcenode_test: DartkCompileTimeError
+html/audiocontext_test: DartkCompileTimeError
+html/audioelement_test: DartkCompileTimeError
+html/b_element_test: DartkCompileTimeError
+html/blob_constructor_test: DartkCompileTimeError
+html/cache_test: DartkCompileTimeError
+html/callbacks_test: DartkCompileTimeError
+html/canvas_pixel_array_type_alias_test: DartkCompileTimeError
+html/canvas_test: DartkCompileTimeError
+html/canvasrenderingcontext2d_test: DartkCompileTimeError
+html/cdata_test: DartkCompileTimeError
+html/client_rect_test: DartkCompileTimeError
+html/cross_domain_iframe_test: DartkCompileTimeError
+html/crypto_test: DartkCompileTimeError
+html/css_rule_list_test: DartkCompileTimeError
+html/css_test: DartkCompileTimeError
+html/cssstyledeclaration_test: DartkCompileTimeError
+html/custom/attribute_changed_callback_test: DartkCompileTimeError
+html/custom/constructor_calls_created_synchronously_test: DartkCompileTimeError
+html/custom/created_callback_test: DartkCompileTimeError
+html/custom/document_register_basic_test: DartkCompileTimeError
+html/custom/document_register_type_extensions_test: DartkCompileTimeError
+html/custom/element_upgrade_test: DartkCompileTimeError
+html/custom/entered_left_view_test: DartkCompileTimeError
+html/custom/js_custom_test: DartkCompileTimeError
+html/custom/mirrors_test: DartkCompileTimeError
+html/custom/regress_194523002_test: DartkCompileTimeError
+html/custom_element_method_clash_test: DartkCompileTimeError
+html/custom_element_name_clash_test: DartkCompileTimeError
+html/custom_elements_23127_test: DartkCompileTimeError
+html/custom_elements_test: DartkCompileTimeError
+html/custom_tags_test: DartkCompileTimeError
+html/dart_object_local_storage_test: DartkCompileTimeError
+html/datalistelement_test: DartkCompileTimeError
+html/document_test: DartkCompileTimeError
+html/documentfragment_test: DartkCompileTimeError
+html/dom_constructors_test: DartkCompileTimeError
+html/domparser_test: DartkCompileTimeError
+html/element_add_test: DartkCompileTimeError
+html/element_animate_test: DartkCompileTimeError
+html/element_classes_svg_test: DartkCompileTimeError
+html/element_classes_test: DartkCompileTimeError
+html/element_constructor_1_test: DartkCompileTimeError
+html/element_dimensions_test: DartkCompileTimeError
+html/element_offset_test: DartkCompileTimeError
+html/element_types_constructors1_test: DartkCompileTimeError
+html/element_types_constructors2_test: DartkCompileTimeError
+html/element_types_constructors3_test: DartkCompileTimeError
+html/element_types_constructors4_test: DartkCompileTimeError
+html/element_types_constructors5_test: DartkCompileTimeError
+html/element_types_constructors6_test: DartkCompileTimeError
+html/element_types_test: DartkCompileTimeError
+html/event_customevent_test: DartkCompileTimeError
+html/event_test: DartkCompileTimeError
+html/exceptions_test: DartkCompileTimeError
+html/filteredelementlist_test: DartkCompileTimeError
+html/fontface_test: DartkCompileTimeError
+html/form_data_test: DartkCompileTimeError
+html/form_element_test: DartkCompileTimeError
+html/geolocation_test: DartkCompileTimeError
+html/hidden_dom_1_test: DartkCompileTimeError
+html/hidden_dom_2_test: DartkCompileTimeError
+html/history_test: DartkCompileTimeError
+html/htmlcollection_test: DartkCompileTimeError
+html/htmlelement_test: DartkCompileTimeError
+html/htmloptionscollection_test: DartkCompileTimeError
+html/indexeddb_1_test: DartkCompileTimeError
+html/indexeddb_2_test: DartkCompileTimeError
+html/indexeddb_3_test: DartkCompileTimeError
+html/indexeddb_4_test: DartkCompileTimeError
+html/indexeddb_5_test: DartkCompileTimeError
+html/input_element_test: DartkCompileTimeError
+html/instance_of_test: DartkCompileTimeError
+html/interactive_test: DartkCompileTimeError
+html/isolates_test: DartkCompileTimeError
+html/js_function_getter_test: DartkCompileTimeError
+html/js_interop_1_test: DartkCompileTimeError
+html/js_test: DartkCompileTimeError
+html/js_typed_interop_anonymous2_exp_test: DartkCompileTimeError
+html/js_typed_interop_anonymous2_test: DartkCompileTimeError
+html/js_typed_interop_anonymous_exp_test: DartkCompileTimeError
+html/js_typed_interop_anonymous_test: DartkCompileTimeError
+html/js_typed_interop_anonymous_unreachable_exp_test: DartkCompileTimeError
+html/js_typed_interop_anonymous_unreachable_test: DartkCompileTimeError
+html/js_typed_interop_default_arg_test/explicit_argument: DartkCompileTimeError
+html/js_typed_interop_default_arg_test/none: DartkCompileTimeError
+html/js_typed_interop_lazy_test: DartkCompileTimeError
+html/js_typed_interop_rename_static_test: DartkCompileTimeError
+html/js_typed_interop_test: DartkCompileTimeError
+html/js_util_test: DartkCompileTimeError
+html/localstorage_test: DartkCompileTimeError
+html/location_test: DartkCompileTimeError
+html/media_stream_test: DartkCompileTimeError
+html/mediasource_test: DartkCompileTimeError
+html/messageevent_test: DartkCompileTimeError
+html/mirrors_js_typed_interop_test: DartkCompileTimeError
+html/mouse_event_test: DartkCompileTimeError
+html/native_gc_test: DartkCompileTimeError
+html/navigator_test: DartkCompileTimeError
+html/node_test: DartkCompileTimeError
+html/node_validator_important_if_you_suppress_make_the_bug_critical_test: DartkCompileTimeError
+html/non_instantiated_is_test: DartkCompileTimeError
+html/notification_test: DartkCompileTimeError
+html/performance_api_test: DartkCompileTimeError
+html/private_extension_member_test: DartkCompileTimeError
+html/query_test: DartkCompileTimeError
+html/queryall_test: DartkCompileTimeError
+html/range_test: DartkCompileTimeError
+html/request_animation_frame_test: DartkCompileTimeError
+html/rtc_test: DartkCompileTimeError
+html/selectelement_test: DartkCompileTimeError
+html/serialized_script_value_test: DartkCompileTimeError
+html/shadow_dom_test: DartkCompileTimeError
+html/shadowroot_test: DartkCompileTimeError
+html/speechrecognition_test: DartkCompileTimeError
+html/storage_test: DartkCompileTimeError
+html/streams_test: DartkCompileTimeError
+html/svg_test: DartkCompileTimeError
+html/svgelement_test: DartkCompileTimeError
+html/table_test: DartkCompileTimeError
+html/text_event_test: DartkCompileTimeError
+html/touchevent_test: DartkCompileTimeError
+html/track_element_constructor_test: DartkCompileTimeError
+html/transition_event_test: DartkCompileTimeError
+html/trusted_html_tree_sanitizer_test: DartkCompileTimeError
+html/typed_arrays_1_test: DartkCompileTimeError
+html/typed_arrays_2_test: DartkCompileTimeError
+html/typed_arrays_3_test: DartkCompileTimeError
+html/typed_arrays_4_test: DartkCompileTimeError
+html/typed_arrays_5_test: DartkCompileTimeError
+html/typed_arrays_arraybuffer_test: DartkCompileTimeError
+html/typed_arrays_dataview_test: DartkCompileTimeError
+html/typed_arrays_range_checks_test: DartkCompileTimeError
+html/typed_arrays_simd_test: DartkCompileTimeError
+html/typing_test: DartkCompileTimeError
+html/unknownelement_test: DartkCompileTimeError
+html/uri_test: DartkCompileTimeError
+html/url_test: DartkCompileTimeError
+html/websocket_test: DartkCompileTimeError
+html/websql_test: DartkCompileTimeError
+html/wheelevent_test: DartkCompileTimeError
+html/window_eq_test: DartkCompileTimeError
+html/window_mangling_test: DartkCompileTimeError
+html/window_nosuchmethod_test: DartkCompileTimeError
+html/window_test: DartkCompileTimeError
+html/worker_api_test: DartkCompileTimeError
+html/worker_test: DartkCompileTimeError
+html/xhr_cross_origin_test: DartkCompileTimeError
+html/xhr_test: DartkCompileTimeError
+html/xsltprocessor_test: DartkCompileTimeError
+mirrors/basic_types_in_dart_core_test: RuntimeError
+mirrors/class_mirror_location_test: RuntimeError
+mirrors/constructor_kinds_test/01: RuntimeError
+mirrors/constructor_kinds_test/none: RuntimeError
+mirrors/constructor_optional_args_test: CompileTimeError
+mirrors/constructor_private_name_test: RuntimeError
+mirrors/deferred_mirrors_metadata_test: RuntimeError
+mirrors/deferred_mirrors_metatarget_test: RuntimeError
+mirrors/deferred_mirrors_update_test: RuntimeError
+mirrors/empty_test: RuntimeError
+mirrors/equality_test: RuntimeError
+mirrors/fake_function_with_call_test: Crash
+mirrors/field_type_test: RuntimeError
+mirrors/function_type_mirror_test: RuntimeError
+mirrors/generic_function_typedef_test: RuntimeError
+mirrors/generic_local_function_test: RuntimeError
+mirrors/generic_mixin_applications_test: RuntimeError
+mirrors/generic_mixin_test: RuntimeError
+mirrors/generic_type_mirror_test: RuntimeError
+mirrors/generics_double_substitution_test/01: RuntimeError
+mirrors/generics_double_substitution_test/none: RuntimeError
+mirrors/generics_dynamic_test: Crash
+mirrors/generics_substitution_test: RuntimeError
+mirrors/globalized_closures2_test/00: RuntimeError
+mirrors/globalized_closures2_test/none: RuntimeError
+mirrors/globalized_closures_test/00: RuntimeError
+mirrors/globalized_closures_test/none: RuntimeError
+mirrors/hierarchy_invariants_test: RuntimeError
+mirrors/hot_get_field_test: RuntimeError
+mirrors/hot_set_field_test: RuntimeError
+mirrors/inherited_metadata_test: RuntimeError
+mirrors/invocation_fuzz_test/emptyarray: Crash
+mirrors/invocation_fuzz_test/false: Crash
+mirrors/invocation_fuzz_test/none: Crash
+mirrors/invocation_fuzz_test/smi: Crash
+mirrors/invocation_fuzz_test/string: Crash
+mirrors/invoke_import_test: RuntimeError
+mirrors/invoke_private_test: RuntimeError
+mirrors/invoke_private_wrong_library_test: RuntimeError
+mirrors/invoke_test: RuntimeError
+mirrors/invoke_throws_test: RuntimeError
+mirrors/libraries_test: RuntimeError
+mirrors/library_enumeration_deferred_loading_test: RuntimeError
+mirrors/library_metadata_test: RuntimeError
+mirrors/library_uri_io_test: DartkCompileTimeError
+mirrors/library_uri_package_test: DartkCompileTimeError
+mirrors/list_constructor_test/01: RuntimeError
+mirrors/list_constructor_test/none: RuntimeError
+mirrors/metadata_constructed_constant_test: RuntimeError
+mirrors/metadata_test: RuntimeError
+mirrors/method_mirror_location_test: RuntimeError
+mirrors/method_mirror_returntype_test: RuntimeError
+mirrors/method_mirror_source_line_ending_test: Crash
+mirrors/method_mirror_source_test: Crash
+mirrors/mirrors_reader_test: Crash
+mirrors/mirrors_used_typedef_declaration_test/01: RuntimeError
+mirrors/mirrors_used_typedef_declaration_test/none: RuntimeError
+mirrors/mixin_simple_test: RuntimeError
+mirrors/mixin_test: RuntimeError
+mirrors/new_instance_with_type_arguments_test: RuntimeError
+mirrors/other_declarations_location_test: RuntimeError
+mirrors/parameter_annotation_mirror_test: RuntimeError
+mirrors/parameter_metadata_test: Crash
+mirrors/private_class_field_test: RuntimeError
+mirrors/private_field_test: RuntimeError
+mirrors/private_symbol_mangling_test: RuntimeError
+mirrors/private_types_test: RuntimeError
+mirrors/reflect_runtime_type_test: RuntimeError
+mirrors/reflect_uninstantiated_class_test: RuntimeError
+mirrors/reflected_type_function_type_test: RuntimeError
+mirrors/reflected_type_special_types_test: RuntimeError
+mirrors/reflected_type_typedefs_test: RuntimeError
+mirrors/reflected_type_typevars_test: RuntimeError
+mirrors/regress_26187_test: RuntimeError
+mirrors/relation_assignable_test: RuntimeError
+mirrors/relation_subtype_test: RuntimeError
+mirrors/symbol_validation_test/01: RuntimeError
+mirrors/symbol_validation_test/none: RuntimeError
+mirrors/to_string_test: RuntimeError
+mirrors/type_variable_is_static_test: RuntimeError
+mirrors/type_variable_owner_test/01: RuntimeError
+mirrors/typedef_deferred_library_test: RuntimeError
+mirrors/typedef_library_test: RuntimeError
+mirrors/typedef_metadata_test: RuntimeError
+mirrors/typedef_test: RuntimeError
+mirrors/typevariable_mirror_metadata_test: RuntimeError
diff --git a/pkg/dev_compiler/test/codegen/lib/math/coin_test.dart b/tests/lib_strong/math/coin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/coin_test.dart
rename to tests/lib_strong/math/coin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/double_pow_test.dart b/tests/lib_strong/math/double_pow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/double_pow_test.dart
rename to tests/lib_strong/math/double_pow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/implement_rectangle_test.dart b/tests/lib_strong/math/implement_rectangle_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/implement_rectangle_test.dart
rename to tests/lib_strong/math/implement_rectangle_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/low_test.dart b/tests/lib_strong/math/low_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/low_test.dart
rename to tests/lib_strong/math/low_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/math2_test.dart b/tests/lib_strong/math/math2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/math2_test.dart
rename to tests/lib_strong/math/math2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/math_parse_double_test.dart b/tests/lib_strong/math/math_parse_double_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/math_parse_double_test.dart
rename to tests/lib_strong/math/math_parse_double_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/math_test.dart b/tests/lib_strong/math/math_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/math_test.dart
rename to tests/lib_strong/math/math_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/min_max_test.dart b/tests/lib_strong/math/min_max_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/min_max_test.dart
rename to tests/lib_strong/math/min_max_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/pi_test.dart b/tests/lib_strong/math/pi_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/pi_test.dart
rename to tests/lib_strong/math/pi_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/point_test.dart b/tests/lib_strong/math/point_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/point_test.dart
rename to tests/lib_strong/math/point_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/random_big_test.dart b/tests/lib_strong/math/random_big_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/random_big_test.dart
rename to tests/lib_strong/math/random_big_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/random_secure_test.dart b/tests/lib_strong/math/random_secure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/random_secure_test.dart
rename to tests/lib_strong/math/random_secure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/random_test.dart b/tests/lib_strong/math/random_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/random_test.dart
rename to tests/lib_strong/math/random_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/math/rectangle_test.dart b/tests/lib_strong/math/rectangle_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/math/rectangle_test.dart
rename to tests/lib_strong/math/rectangle_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/abstract_class_test.dart b/tests/lib_strong/mirrors/abstract_class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/abstract_class_test.dart
rename to tests/lib_strong/mirrors/abstract_class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/abstract_test.dart b/tests/lib_strong/mirrors/abstract_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/abstract_test.dart
rename to tests/lib_strong/mirrors/abstract_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/accessor_cache_overflow_test.dart b/tests/lib_strong/mirrors/accessor_cache_overflow_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/accessor_cache_overflow_test.dart
rename to tests/lib_strong/mirrors/accessor_cache_overflow_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/array_tracing2_test.dart b/tests/lib_strong/mirrors/array_tracing2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/array_tracing2_test.dart
rename to tests/lib_strong/mirrors/array_tracing2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/array_tracing3_test.dart b/tests/lib_strong/mirrors/array_tracing3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/array_tracing3_test.dart
rename to tests/lib_strong/mirrors/array_tracing3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/array_tracing_test.dart b/tests/lib_strong/mirrors/array_tracing_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/array_tracing_test.dart
rename to tests/lib_strong/mirrors/array_tracing_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/basic_types_in_dart_core_test.dart b/tests/lib_strong/mirrors/basic_types_in_dart_core_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/basic_types_in_dart_core_test.dart
rename to tests/lib_strong/mirrors/basic_types_in_dart_core_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/circular_factory_redirection_test.dart b/tests/lib_strong/mirrors/circular_factory_redirection_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/circular_factory_redirection_test.dart
rename to tests/lib_strong/mirrors/circular_factory_redirection_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/class_declarations_test.dart b/tests/lib_strong/mirrors/class_declarations_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/class_declarations_test.dart
rename to tests/lib_strong/mirrors/class_declarations_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_location_other.dart b/tests/lib_strong/mirrors/class_mirror_location_other.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_location_other.dart
rename to tests/lib_strong/mirrors/class_mirror_location_other.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_location_test.dart b/tests/lib_strong/mirrors/class_mirror_location_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_location_test.dart
rename to tests/lib_strong/mirrors/class_mirror_location_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_type_variables_data.dart b/tests/lib_strong/mirrors/class_mirror_type_variables_data.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_type_variables_data.dart
rename to tests/lib_strong/mirrors/class_mirror_type_variables_data.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_type_variables_expect.dart b/tests/lib_strong/mirrors/class_mirror_type_variables_expect.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_type_variables_expect.dart
rename to tests/lib_strong/mirrors/class_mirror_type_variables_expect.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_type_variables_test.dart b/tests/lib_strong/mirrors/class_mirror_type_variables_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/class_mirror_type_variables_test.dart
rename to tests/lib_strong/mirrors/class_mirror_type_variables_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/closure_mirror_import1.dart b/tests/lib_strong/mirrors/closure_mirror_import1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/closure_mirror_import1.dart
rename to tests/lib_strong/mirrors/closure_mirror_import1.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/closure_mirror_import2.dart b/tests/lib_strong/mirrors/closure_mirror_import2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/closure_mirror_import2.dart
rename to tests/lib_strong/mirrors/closure_mirror_import2.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/closures_test.dart b/tests/lib_strong/mirrors/closures_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/closures_test.dart
rename to tests/lib_strong/mirrors/closures_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/closurization_equivalence_test.dart b/tests/lib_strong/mirrors/closurization_equivalence_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/closurization_equivalence_test.dart
rename to tests/lib_strong/mirrors/closurization_equivalence_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/constructor_kinds_test.dart b/tests/lib_strong/mirrors/constructor_kinds_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/constructor_kinds_test.dart
rename to tests/lib_strong/mirrors/constructor_kinds_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/constructor_optional_args_test.dart b/tests/lib_strong/mirrors/constructor_optional_args_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/constructor_optional_args_test.dart
rename to tests/lib_strong/mirrors/constructor_optional_args_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/constructor_private_name_test.dart b/tests/lib_strong/mirrors/constructor_private_name_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/constructor_private_name_test.dart
rename to tests/lib_strong/mirrors/constructor_private_name_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/constructors_test.dart b/tests/lib_strong/mirrors/constructors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/constructors_test.dart
rename to tests/lib_strong/mirrors/constructors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/dart2js_mirrors_test.dart b/tests/lib_strong/mirrors/dart2js_mirrors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/dart2js_mirrors_test.dart
rename to tests/lib_strong/mirrors/dart2js_mirrors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/declarations_model.dart b/tests/lib_strong/mirrors/declarations_model.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/declarations_model.dart
rename to tests/lib_strong/mirrors/declarations_model.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/declarations_model_easier.dart b/tests/lib_strong/mirrors/declarations_model_easier.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/declarations_model_easier.dart
rename to tests/lib_strong/mirrors/declarations_model_easier.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/declarations_type_test.dart b/tests/lib_strong/mirrors/declarations_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/declarations_type_test.dart
rename to tests/lib_strong/mirrors/declarations_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_metadata_lib.dart b/tests/lib_strong/mirrors/deferred_mirrors_metadata_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_metadata_lib.dart
rename to tests/lib_strong/mirrors/deferred_mirrors_metadata_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_metadata_test.dart b/tests/lib_strong/mirrors/deferred_mirrors_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_metadata_test.dart
rename to tests/lib_strong/mirrors/deferred_mirrors_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_metatarget_lib.dart b/tests/lib_strong/mirrors/deferred_mirrors_metatarget_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_metatarget_lib.dart
rename to tests/lib_strong/mirrors/deferred_mirrors_metatarget_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_metatarget_test.dart b/tests/lib_strong/mirrors/deferred_mirrors_metatarget_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_metatarget_test.dart
rename to tests/lib_strong/mirrors/deferred_mirrors_metatarget_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_update_lib.dart b/tests/lib_strong/mirrors/deferred_mirrors_update_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_update_lib.dart
rename to tests/lib_strong/mirrors/deferred_mirrors_update_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_update_test.dart b/tests/lib_strong/mirrors/deferred_mirrors_update_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/deferred_mirrors_update_test.dart
rename to tests/lib_strong/mirrors/deferred_mirrors_update_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/deferred_type_other.dart b/tests/lib_strong/mirrors/deferred_type_other.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/deferred_type_other.dart
rename to tests/lib_strong/mirrors/deferred_type_other.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/deferred_type_test.dart b/tests/lib_strong/mirrors/deferred_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/deferred_type_test.dart
rename to tests/lib_strong/mirrors/deferred_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/delegate_call_through_getter_test.dart b/tests/lib_strong/mirrors/delegate_call_through_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/delegate_call_through_getter_test.dart
rename to tests/lib_strong/mirrors/delegate_call_through_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/delegate_class_test.dart b/tests/lib_strong/mirrors/delegate_class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/delegate_class_test.dart
rename to tests/lib_strong/mirrors/delegate_class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/delegate_function_invocation_test.dart b/tests/lib_strong/mirrors/delegate_function_invocation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/delegate_function_invocation_test.dart
rename to tests/lib_strong/mirrors/delegate_function_invocation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/delegate_library_test.dart b/tests/lib_strong/mirrors/delegate_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/delegate_library_test.dart
rename to tests/lib_strong/mirrors/delegate_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/delegate_test.dart b/tests/lib_strong/mirrors/delegate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/delegate_test.dart
rename to tests/lib_strong/mirrors/delegate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/disable_tree_shaking_test.dart b/tests/lib_strong/mirrors/disable_tree_shaking_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/disable_tree_shaking_test.dart
rename to tests/lib_strong/mirrors/disable_tree_shaking_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/empty.dart b/tests/lib_strong/mirrors/empty.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/empty.dart
rename to tests/lib_strong/mirrors/empty.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/empty_test.dart b/tests/lib_strong/mirrors/empty_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/empty_test.dart
rename to tests/lib_strong/mirrors/empty_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/enum_test.dart b/tests/lib_strong/mirrors/enum_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/enum_test.dart
rename to tests/lib_strong/mirrors/enum_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/equality_test.dart b/tests/lib_strong/mirrors/equality_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/equality_test.dart
rename to tests/lib_strong/mirrors/equality_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/fake_function_with_call_test.dart b/tests/lib_strong/mirrors/fake_function_with_call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/fake_function_with_call_test.dart
rename to tests/lib_strong/mirrors/fake_function_with_call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/fake_function_without_call_test.dart b/tests/lib_strong/mirrors/fake_function_without_call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/fake_function_without_call_test.dart
rename to tests/lib_strong/mirrors/fake_function_without_call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/field_type_test.dart b/tests/lib_strong/mirrors/field_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/field_type_test.dart
rename to tests/lib_strong/mirrors/field_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/function_apply_mirrors_lib.dart b/tests/lib_strong/mirrors/function_apply_mirrors_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/function_apply_mirrors_lib.dart
rename to tests/lib_strong/mirrors/function_apply_mirrors_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/function_apply_mirrors_test.dart b/tests/lib_strong/mirrors/function_apply_mirrors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/function_apply_mirrors_test.dart
rename to tests/lib_strong/mirrors/function_apply_mirrors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/function_type_mirror_test.dart b/tests/lib_strong/mirrors/function_type_mirror_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/function_type_mirror_test.dart
rename to tests/lib_strong/mirrors/function_type_mirror_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_bounded_by_type_parameter_test.dart b/tests/lib_strong/mirrors/generic_bounded_by_type_parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_bounded_by_type_parameter_test.dart
rename to tests/lib_strong/mirrors/generic_bounded_by_type_parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_bounded_test.dart b/tests/lib_strong/mirrors/generic_bounded_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_bounded_test.dart
rename to tests/lib_strong/mirrors/generic_bounded_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_class_declaration_test.dart b/tests/lib_strong/mirrors/generic_class_declaration_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_class_declaration_test.dart
rename to tests/lib_strong/mirrors/generic_class_declaration_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_f_bounded_mixin_application_test.dart b/tests/lib_strong/mirrors/generic_f_bounded_mixin_application_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_f_bounded_mixin_application_test.dart
rename to tests/lib_strong/mirrors/generic_f_bounded_mixin_application_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_f_bounded_test.dart b/tests/lib_strong/mirrors/generic_f_bounded_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_f_bounded_test.dart
rename to tests/lib_strong/mirrors/generic_f_bounded_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_function_typedef_test.dart b/tests/lib_strong/mirrors/generic_function_typedef_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_function_typedef_test.dart
rename to tests/lib_strong/mirrors/generic_function_typedef_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_interface_test.dart b/tests/lib_strong/mirrors/generic_interface_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_interface_test.dart
rename to tests/lib_strong/mirrors/generic_interface_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_list_test.dart b/tests/lib_strong/mirrors/generic_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_list_test.dart
rename to tests/lib_strong/mirrors/generic_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_local_function_test.dart b/tests/lib_strong/mirrors/generic_local_function_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_local_function_test.dart
rename to tests/lib_strong/mirrors/generic_local_function_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_mixin_applications_test.dart b/tests/lib_strong/mirrors/generic_mixin_applications_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_mixin_applications_test.dart
rename to tests/lib_strong/mirrors/generic_mixin_applications_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_mixin_test.dart b/tests/lib_strong/mirrors/generic_mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_mixin_test.dart
rename to tests/lib_strong/mirrors/generic_mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_superclass_test.dart b/tests/lib_strong/mirrors/generic_superclass_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_superclass_test.dart
rename to tests/lib_strong/mirrors/generic_superclass_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generic_type_mirror_test.dart b/tests/lib_strong/mirrors/generic_type_mirror_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generic_type_mirror_test.dart
rename to tests/lib_strong/mirrors/generic_type_mirror_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generics_double_substitution_test.dart b/tests/lib_strong/mirrors/generics_double_substitution_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generics_double_substitution_test.dart
rename to tests/lib_strong/mirrors/generics_double_substitution_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generics_dynamic_test.dart b/tests/lib_strong/mirrors/generics_dynamic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generics_dynamic_test.dart
rename to tests/lib_strong/mirrors/generics_dynamic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generics_helper.dart b/tests/lib_strong/mirrors/generics_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generics_helper.dart
rename to tests/lib_strong/mirrors/generics_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generics_special_types_test.dart b/tests/lib_strong/mirrors/generics_special_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generics_special_types_test.dart
rename to tests/lib_strong/mirrors/generics_special_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generics_substitution_test.dart b/tests/lib_strong/mirrors/generics_substitution_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generics_substitution_test.dart
rename to tests/lib_strong/mirrors/generics_substitution_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/generics_test.dart b/tests/lib_strong/mirrors/generics_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/generics_test.dart
rename to tests/lib_strong/mirrors/generics_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/get_field_cache_test.dart b/tests/lib_strong/mirrors/get_field_cache_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/get_field_cache_test.dart
rename to tests/lib_strong/mirrors/get_field_cache_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/get_field_static_test.dart b/tests/lib_strong/mirrors/get_field_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/get_field_static_test.dart
rename to tests/lib_strong/mirrors/get_field_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/get_field_test.dart b/tests/lib_strong/mirrors/get_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/get_field_test.dart
rename to tests/lib_strong/mirrors/get_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/get_symbol_name_no_such_method_test.dart b/tests/lib_strong/mirrors/get_symbol_name_no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/get_symbol_name_no_such_method_test.dart
rename to tests/lib_strong/mirrors/get_symbol_name_no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/get_symbol_name_test.dart b/tests/lib_strong/mirrors/get_symbol_name_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/get_symbol_name_test.dart
rename to tests/lib_strong/mirrors/get_symbol_name_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/globalized_closures2_test.dart b/tests/lib_strong/mirrors/globalized_closures2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/globalized_closures2_test.dart
rename to tests/lib_strong/mirrors/globalized_closures2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/globalized_closures_test.dart b/tests/lib_strong/mirrors/globalized_closures_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/globalized_closures_test.dart
rename to tests/lib_strong/mirrors/globalized_closures_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/hierarchy_invariants_test.dart b/tests/lib_strong/mirrors/hierarchy_invariants_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/hierarchy_invariants_test.dart
rename to tests/lib_strong/mirrors/hierarchy_invariants_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/hot_get_field_test.dart b/tests/lib_strong/mirrors/hot_get_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/hot_get_field_test.dart
rename to tests/lib_strong/mirrors/hot_get_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/hot_set_field_test.dart b/tests/lib_strong/mirrors/hot_set_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/hot_set_field_test.dart
rename to tests/lib_strong/mirrors/hot_set_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/immutable_collections_test.dart b/tests/lib_strong/mirrors/immutable_collections_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/immutable_collections_test.dart
rename to tests/lib_strong/mirrors/immutable_collections_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/inference_and_no_such_method_test.dart b/tests/lib_strong/mirrors/inference_and_no_such_method_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/inference_and_no_such_method_test.dart
rename to tests/lib_strong/mirrors/inference_and_no_such_method_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/inherit_field_test.dart b/tests/lib_strong/mirrors/inherit_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/inherit_field_test.dart
rename to tests/lib_strong/mirrors/inherit_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/inherited_metadata_test.dart b/tests/lib_strong/mirrors/inherited_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/inherited_metadata_test.dart
rename to tests/lib_strong/mirrors/inherited_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/initializing_formals_test.dart b/tests/lib_strong/mirrors/initializing_formals_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/initializing_formals_test.dart
rename to tests/lib_strong/mirrors/initializing_formals_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/instance_members_easier_test.dart b/tests/lib_strong/mirrors/instance_members_easier_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/instance_members_easier_test.dart
rename to tests/lib_strong/mirrors/instance_members_easier_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/instance_members_test.dart b/tests/lib_strong/mirrors/instance_members_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/instance_members_test.dart
rename to tests/lib_strong/mirrors/instance_members_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/instance_members_unimplemented_interface_test.dart b/tests/lib_strong/mirrors/instance_members_unimplemented_interface_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/instance_members_unimplemented_interface_test.dart
rename to tests/lib_strong/mirrors/instance_members_unimplemented_interface_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/instance_members_with_override_test.dart b/tests/lib_strong/mirrors/instance_members_with_override_test.dart
similarity index 95%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/instance_members_with_override_test.dart
rename to tests/lib_strong/mirrors/instance_members_with_override_test.dart
index 6c75085..17c0b35 100644
--- a/pkg/dev_compiler/test/codegen/lib/mirrors/instance_members_with_override_test.dart
+++ b/tests/lib_strong/mirrors/instance_members_with_override_test.dart
@@ -6,10 +6,11 @@
 
 import 'dart:mirrors';
 import 'package:expect/expect.dart';
+import 'package:meta/meta.dart' show virtual;
 
 class S {
-  var field;
-  final finalField = 0;
+  @virtual var field;
+  @virtual final finalField = 0;
   method() {}
   get getter {}
   set setter(x) {}
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/instantiate_abstract_class_test.dart b/tests/lib_strong/mirrors/instantiate_abstract_class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/instantiate_abstract_class_test.dart
rename to tests/lib_strong/mirrors/instantiate_abstract_class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/intercepted_cache_test.dart b/tests/lib_strong/mirrors/intercepted_cache_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/intercepted_cache_test.dart
rename to tests/lib_strong/mirrors/intercepted_cache_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/intercepted_class_test.dart b/tests/lib_strong/mirrors/intercepted_class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/intercepted_class_test.dart
rename to tests/lib_strong/mirrors/intercepted_class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/intercepted_object_test.dart b/tests/lib_strong/mirrors/intercepted_object_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/intercepted_object_test.dart
rename to tests/lib_strong/mirrors/intercepted_object_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/intercepted_superclass_test.dart b/tests/lib_strong/mirrors/intercepted_superclass_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/intercepted_superclass_test.dart
rename to tests/lib_strong/mirrors/intercepted_superclass_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invocation_cache_test.dart b/tests/lib_strong/mirrors/invocation_cache_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invocation_cache_test.dart
rename to tests/lib_strong/mirrors/invocation_cache_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invocation_fuzz_test.dart b/tests/lib_strong/mirrors/invocation_fuzz_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invocation_fuzz_test.dart
rename to tests/lib_strong/mirrors/invocation_fuzz_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_on_closure_test.dart b/tests/lib_strong/mirrors/invoke_call_on_closure_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_on_closure_test.dart
rename to tests/lib_strong/mirrors/invoke_call_on_closure_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_through_getter_previously_accessed_test.dart b/tests/lib_strong/mirrors/invoke_call_through_getter_previously_accessed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_through_getter_previously_accessed_test.dart
rename to tests/lib_strong/mirrors/invoke_call_through_getter_previously_accessed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_through_getter_test.dart b/tests/lib_strong/mirrors/invoke_call_through_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_through_getter_test.dart
rename to tests/lib_strong/mirrors/invoke_call_through_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_through_implicit_getter_previously_accessed_test.dart b/tests/lib_strong/mirrors/invoke_call_through_implicit_getter_previously_accessed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_through_implicit_getter_previously_accessed_test.dart
rename to tests/lib_strong/mirrors/invoke_call_through_implicit_getter_previously_accessed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_through_implicit_getter_test.dart b/tests/lib_strong/mirrors/invoke_call_through_implicit_getter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_call_through_implicit_getter_test.dart
rename to tests/lib_strong/mirrors/invoke_call_through_implicit_getter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_closurization2_test.dart b/tests/lib_strong/mirrors/invoke_closurization2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_closurization2_test.dart
rename to tests/lib_strong/mirrors/invoke_closurization2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_closurization_test.dart b/tests/lib_strong/mirrors/invoke_closurization_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_closurization_test.dart
rename to tests/lib_strong/mirrors/invoke_closurization_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_import_test.dart b/tests/lib_strong/mirrors/invoke_import_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_import_test.dart
rename to tests/lib_strong/mirrors/invoke_import_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_named_test.dart b/tests/lib_strong/mirrors/invoke_named_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_named_test.dart
rename to tests/lib_strong/mirrors/invoke_named_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_natives_malicious_test.dart b/tests/lib_strong/mirrors/invoke_natives_malicious_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_natives_malicious_test.dart
rename to tests/lib_strong/mirrors/invoke_natives_malicious_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_private_test.dart b/tests/lib_strong/mirrors/invoke_private_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_private_test.dart
rename to tests/lib_strong/mirrors/invoke_private_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_private_wrong_library_test.dart b/tests/lib_strong/mirrors/invoke_private_wrong_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_private_wrong_library_test.dart
rename to tests/lib_strong/mirrors/invoke_private_wrong_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_test.dart b/tests/lib_strong/mirrors/invoke_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_test.dart
rename to tests/lib_strong/mirrors/invoke_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/invoke_throws_test.dart b/tests/lib_strong/mirrors/invoke_throws_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/invoke_throws_test.dart
rename to tests/lib_strong/mirrors/invoke_throws_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/io_html_mutual_exclusion_test.dart b/tests/lib_strong/mirrors/io_html_mutual_exclusion_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/io_html_mutual_exclusion_test.dart
rename to tests/lib_strong/mirrors/io_html_mutual_exclusion_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/is_odd_test.dart b/tests/lib_strong/mirrors/is_odd_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/is_odd_test.dart
rename to tests/lib_strong/mirrors/is_odd_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/lazy_static_test.dart b/tests/lib_strong/mirrors/lazy_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/lazy_static_test.dart
rename to tests/lib_strong/mirrors/lazy_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/libraries_test.dart b/tests/lib_strong/mirrors/libraries_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/libraries_test.dart
rename to tests/lib_strong/mirrors/libraries_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_declarations_test.dart b/tests/lib_strong/mirrors/library_declarations_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_declarations_test.dart
rename to tests/lib_strong/mirrors/library_declarations_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_enumeration_deferred_loading_test.dart b/tests/lib_strong/mirrors/library_enumeration_deferred_loading_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_enumeration_deferred_loading_test.dart
rename to tests/lib_strong/mirrors/library_enumeration_deferred_loading_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_exports_hidden.dart b/tests/lib_strong/mirrors/library_exports_hidden.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_exports_hidden.dart
rename to tests/lib_strong/mirrors/library_exports_hidden.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_exports_hidden_test.dart b/tests/lib_strong/mirrors/library_exports_hidden_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_exports_hidden_test.dart
rename to tests/lib_strong/mirrors/library_exports_hidden_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_exports_shown.dart b/tests/lib_strong/mirrors/library_exports_shown.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_exports_shown.dart
rename to tests/lib_strong/mirrors/library_exports_shown.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_exports_shown_test.dart b/tests/lib_strong/mirrors/library_exports_shown_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_exports_shown_test.dart
rename to tests/lib_strong/mirrors/library_exports_shown_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_import_deferred_loading_test.dart b/tests/lib_strong/mirrors/library_import_deferred_loading_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_import_deferred_loading_test.dart
rename to tests/lib_strong/mirrors/library_import_deferred_loading_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_a.dart b/tests/lib_strong/mirrors/library_imports_a.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_a.dart
rename to tests/lib_strong/mirrors/library_imports_a.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_b.dart b/tests/lib_strong/mirrors/library_imports_b.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_b.dart
rename to tests/lib_strong/mirrors/library_imports_b.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_bad_metadata_test.dart b/tests/lib_strong/mirrors/library_imports_bad_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_bad_metadata_test.dart
rename to tests/lib_strong/mirrors/library_imports_bad_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_deferred_test.dart b/tests/lib_strong/mirrors/library_imports_deferred_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_deferred_test.dart
rename to tests/lib_strong/mirrors/library_imports_deferred_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_hidden.dart b/tests/lib_strong/mirrors/library_imports_hidden.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_hidden.dart
rename to tests/lib_strong/mirrors/library_imports_hidden.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_hidden_test.dart b/tests/lib_strong/mirrors/library_imports_hidden_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_hidden_test.dart
rename to tests/lib_strong/mirrors/library_imports_hidden_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_metadata.dart b/tests/lib_strong/mirrors/library_imports_metadata.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_metadata.dart
rename to tests/lib_strong/mirrors/library_imports_metadata.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_metadata_test.dart b/tests/lib_strong/mirrors/library_imports_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_metadata_test.dart
rename to tests/lib_strong/mirrors/library_imports_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_prefixed.dart b/tests/lib_strong/mirrors/library_imports_prefixed.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_prefixed.dart
rename to tests/lib_strong/mirrors/library_imports_prefixed.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_prefixed_show_hide.dart b/tests/lib_strong/mirrors/library_imports_prefixed_show_hide.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_prefixed_show_hide.dart
rename to tests/lib_strong/mirrors/library_imports_prefixed_show_hide.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_prefixed_show_hide_test.dart b/tests/lib_strong/mirrors/library_imports_prefixed_show_hide_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_prefixed_show_hide_test.dart
rename to tests/lib_strong/mirrors/library_imports_prefixed_show_hide_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_prefixed_test.dart b/tests/lib_strong/mirrors/library_imports_prefixed_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_prefixed_test.dart
rename to tests/lib_strong/mirrors/library_imports_prefixed_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_shown.dart b/tests/lib_strong/mirrors/library_imports_shown.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_shown.dart
rename to tests/lib_strong/mirrors/library_imports_shown.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_shown_test.dart b/tests/lib_strong/mirrors/library_imports_shown_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_imports_shown_test.dart
rename to tests/lib_strong/mirrors/library_imports_shown_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_metadata2_lib1.dart b/tests/lib_strong/mirrors/library_metadata2_lib1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_metadata2_lib1.dart
rename to tests/lib_strong/mirrors/library_metadata2_lib1.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_metadata2_lib2.dart b/tests/lib_strong/mirrors/library_metadata2_lib2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_metadata2_lib2.dart
rename to tests/lib_strong/mirrors/library_metadata2_lib2.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_metadata2_test.dart b/tests/lib_strong/mirrors/library_metadata2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_metadata2_test.dart
rename to tests/lib_strong/mirrors/library_metadata2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_metadata_test.dart b/tests/lib_strong/mirrors/library_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_metadata_test.dart
rename to tests/lib_strong/mirrors/library_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_metatarget_test.dart b/tests/lib_strong/mirrors/library_metatarget_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_metatarget_test.dart
rename to tests/lib_strong/mirrors/library_metatarget_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_metatarget_test_annotations_lib.dart b/tests/lib_strong/mirrors/library_metatarget_test_annotations_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_metatarget_test_annotations_lib.dart
rename to tests/lib_strong/mirrors/library_metatarget_test_annotations_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_metatarget_test_lib.dart b/tests/lib_strong/mirrors/library_metatarget_test_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_metatarget_test_lib.dart
rename to tests/lib_strong/mirrors/library_metatarget_test_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_uri_io_test.dart b/tests/lib_strong/mirrors/library_uri_io_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_uri_io_test.dart
rename to tests/lib_strong/mirrors/library_uri_io_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_uri_package_test.dart b/tests/lib_strong/mirrors/library_uri_package_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_uri_package_test.dart
rename to tests/lib_strong/mirrors/library_uri_package_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_with_annotated_declaration.dart b/tests/lib_strong/mirrors/library_with_annotated_declaration.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_with_annotated_declaration.dart
rename to tests/lib_strong/mirrors/library_with_annotated_declaration.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/library_without_declaration.dart b/tests/lib_strong/mirrors/library_without_declaration.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/library_without_declaration.dart
rename to tests/lib_strong/mirrors/library_without_declaration.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/list_constructor_test.dart b/tests/lib_strong/mirrors/list_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/list_constructor_test.dart
rename to tests/lib_strong/mirrors/list_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/load_library_test.dart b/tests/lib_strong/mirrors/load_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/load_library_test.dart
rename to tests/lib_strong/mirrors/load_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/local_function_is_static_test.dart b/tests/lib_strong/mirrors/local_function_is_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/local_function_is_static_test.dart
rename to tests/lib_strong/mirrors/local_function_is_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/local_isolate_test.dart b/tests/lib_strong/mirrors/local_isolate_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/local_isolate_test.dart
rename to tests/lib_strong/mirrors/local_isolate_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/metadata_allowed_values_import.dart b/tests/lib_strong/mirrors/metadata_allowed_values_import.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/metadata_allowed_values_import.dart
rename to tests/lib_strong/mirrors/metadata_allowed_values_import.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/metadata_allowed_values_test.dart b/tests/lib_strong/mirrors/metadata_allowed_values_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/metadata_allowed_values_test.dart
rename to tests/lib_strong/mirrors/metadata_allowed_values_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/metadata_class_mirror_test.dart b/tests/lib_strong/mirrors/metadata_class_mirror_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/metadata_class_mirror_test.dart
rename to tests/lib_strong/mirrors/metadata_class_mirror_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/metadata_const_map_test.dart b/tests/lib_strong/mirrors/metadata_const_map_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/metadata_const_map_test.dart
rename to tests/lib_strong/mirrors/metadata_const_map_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/metadata_constructed_constant_test.dart b/tests/lib_strong/mirrors/metadata_constructed_constant_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/metadata_constructed_constant_test.dart
rename to tests/lib_strong/mirrors/metadata_constructed_constant_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/metadata_constructor_arguments_test.dart b/tests/lib_strong/mirrors/metadata_constructor_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/metadata_constructor_arguments_test.dart
rename to tests/lib_strong/mirrors/metadata_constructor_arguments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/metadata_nested_constructor_call_test.dart b/tests/lib_strong/mirrors/metadata_nested_constructor_call_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/metadata_nested_constructor_call_test.dart
rename to tests/lib_strong/mirrors/metadata_nested_constructor_call_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/metadata_scope_test.dart b/tests/lib_strong/mirrors/metadata_scope_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/metadata_scope_test.dart
rename to tests/lib_strong/mirrors/metadata_scope_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/metadata_test.dart b/tests/lib_strong/mirrors/metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/metadata_test.dart
rename to tests/lib_strong/mirrors/metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_location_other.dart b/tests/lib_strong/mirrors/method_mirror_location_other.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_location_other.dart
rename to tests/lib_strong/mirrors/method_mirror_location_other.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_location_test.dart b/tests/lib_strong/mirrors/method_mirror_location_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_location_test.dart
rename to tests/lib_strong/mirrors/method_mirror_location_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_name_test.dart b/tests/lib_strong/mirrors/method_mirror_name_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_name_test.dart
rename to tests/lib_strong/mirrors/method_mirror_name_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_properties_test.dart b/tests/lib_strong/mirrors/method_mirror_properties_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_properties_test.dart
rename to tests/lib_strong/mirrors/method_mirror_properties_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_returntype_test.dart b/tests/lib_strong/mirrors/method_mirror_returntype_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_returntype_test.dart
rename to tests/lib_strong/mirrors/method_mirror_returntype_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_cr.dart b/tests/lib_strong/mirrors/method_mirror_source_line_ending_cr.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_cr.dart
rename to tests/lib_strong/mirrors/method_mirror_source_line_ending_cr.dart
Binary files differ
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_crlf.dart b/tests/lib_strong/mirrors/method_mirror_source_line_ending_crlf.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_crlf.dart
rename to tests/lib_strong/mirrors/method_mirror_source_line_ending_crlf.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_lf.dart b/tests/lib_strong/mirrors/method_mirror_source_line_ending_lf.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_lf.dart
rename to tests/lib_strong/mirrors/method_mirror_source_line_ending_lf.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_test.dart b/tests/lib_strong/mirrors/method_mirror_source_line_ending_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_line_ending_test.dart
rename to tests/lib_strong/mirrors/method_mirror_source_line_ending_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_other.dart b/tests/lib_strong/mirrors/method_mirror_source_other.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_other.dart
rename to tests/lib_strong/mirrors/method_mirror_source_other.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_test.dart b/tests/lib_strong/mirrors/method_mirror_source_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/method_mirror_source_test.dart
rename to tests/lib_strong/mirrors/method_mirror_source_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirror_in_static_init_test.dart b/tests/lib_strong/mirrors/mirror_in_static_init_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirror_in_static_init_test.dart
rename to tests/lib_strong/mirrors/mirror_in_static_init_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_nsm_mismatch_test.dart b/tests/lib_strong/mirrors/mirrors_nsm_mismatch_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_nsm_mismatch_test.dart
rename to tests/lib_strong/mirrors/mirrors_nsm_mismatch_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_nsm_test.dart b/tests/lib_strong/mirrors/mirrors_nsm_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_nsm_test.dart
rename to tests/lib_strong/mirrors/mirrors_nsm_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_reader.dart b/tests/lib_strong/mirrors/mirrors_reader.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_reader.dart
rename to tests/lib_strong/mirrors/mirrors_reader.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_reader_test.dart b/tests/lib_strong/mirrors/mirrors_reader_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_reader_test.dart
rename to tests/lib_strong/mirrors/mirrors_reader_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_resolve_fields_test.dart b/tests/lib_strong/mirrors/mirrors_resolve_fields_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_resolve_fields_test.dart
rename to tests/lib_strong/mirrors/mirrors_resolve_fields_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_test.dart b/tests/lib_strong/mirrors/mirrors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_test.dart
rename to tests/lib_strong/mirrors/mirrors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_get_name2_test.dart b/tests/lib_strong/mirrors/mirrors_used_get_name2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_get_name2_test.dart
rename to tests/lib_strong/mirrors/mirrors_used_get_name2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_get_name_test.dart b/tests/lib_strong/mirrors/mirrors_used_get_name_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_get_name_test.dart
rename to tests/lib_strong/mirrors/mirrors_used_get_name_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_inheritance_test.dart b/tests/lib_strong/mirrors/mirrors_used_inheritance_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_inheritance_test.dart
rename to tests/lib_strong/mirrors/mirrors_used_inheritance_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_merge_test.dart b/tests/lib_strong/mirrors/mirrors_used_merge_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_merge_test.dart
rename to tests/lib_strong/mirrors/mirrors_used_merge_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_typedef_declaration_test.dart b/tests/lib_strong/mirrors/mirrors_used_typedef_declaration_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_used_typedef_declaration_test.dart
rename to tests/lib_strong/mirrors/mirrors_used_typedef_declaration_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_visitor.dart b/tests/lib_strong/mirrors/mirrors_visitor.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mirrors_visitor.dart
rename to tests/lib_strong/mirrors/mirrors_visitor.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mixin_application_test.dart b/tests/lib_strong/mirrors/mixin_application_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mixin_application_test.dart
rename to tests/lib_strong/mirrors/mixin_application_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mixin_members_test.dart b/tests/lib_strong/mirrors/mixin_members_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mixin_members_test.dart
rename to tests/lib_strong/mirrors/mixin_members_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mixin_simple_test.dart b/tests/lib_strong/mirrors/mixin_simple_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mixin_simple_test.dart
rename to tests/lib_strong/mirrors/mixin_simple_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mixin_test.dart b/tests/lib_strong/mirrors/mixin_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/mixin_test.dart
rename to tests/lib_strong/mirrors/mixin_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/model.dart b/tests/lib_strong/mirrors/model.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/model.dart
rename to tests/lib_strong/mirrors/model.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/model_test.dart b/tests/lib_strong/mirrors/model_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/model_test.dart
rename to tests/lib_strong/mirrors/model_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/native_class_test.dart b/tests/lib_strong/mirrors/native_class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/native_class_test.dart
rename to tests/lib_strong/mirrors/native_class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/new_instance_optional_arguments_test.dart b/tests/lib_strong/mirrors/new_instance_optional_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/new_instance_optional_arguments_test.dart
rename to tests/lib_strong/mirrors/new_instance_optional_arguments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/new_instance_with_type_arguments_test.dart b/tests/lib_strong/mirrors/new_instance_with_type_arguments_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/new_instance_with_type_arguments_test.dart
rename to tests/lib_strong/mirrors/new_instance_with_type_arguments_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/no_metadata_test.dart b/tests/lib_strong/mirrors/no_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/no_metadata_test.dart
rename to tests/lib_strong/mirrors/no_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/null2_test.dart b/tests/lib_strong/mirrors/null2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/null2_test.dart
rename to tests/lib_strong/mirrors/null2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/null_test.dart b/tests/lib_strong/mirrors/null_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/null_test.dart
rename to tests/lib_strong/mirrors/null_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/operator_test.dart b/tests/lib_strong/mirrors/operator_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/operator_test.dart
rename to tests/lib_strong/mirrors/operator_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/optional_parameters_test.dart b/tests/lib_strong/mirrors/optional_parameters_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/optional_parameters_test.dart
rename to tests/lib_strong/mirrors/optional_parameters_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/other_declarations_location_test.dart b/tests/lib_strong/mirrors/other_declarations_location_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/other_declarations_location_test.dart
rename to tests/lib_strong/mirrors/other_declarations_location_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/other_library.dart b/tests/lib_strong/mirrors/other_library.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/other_library.dart
rename to tests/lib_strong/mirrors/other_library.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/parameter_annotation_mirror_test.dart b/tests/lib_strong/mirrors/parameter_annotation_mirror_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/parameter_annotation_mirror_test.dart
rename to tests/lib_strong/mirrors/parameter_annotation_mirror_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/parameter_is_const_test.dart b/tests/lib_strong/mirrors/parameter_is_const_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/parameter_is_const_test.dart
rename to tests/lib_strong/mirrors/parameter_is_const_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/parameter_metadata_test.dart b/tests/lib_strong/mirrors/parameter_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/parameter_metadata_test.dart
rename to tests/lib_strong/mirrors/parameter_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/parameter_of_mixin_app_constructor_test.dart b/tests/lib_strong/mirrors/parameter_of_mixin_app_constructor_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/parameter_of_mixin_app_constructor_test.dart
rename to tests/lib_strong/mirrors/parameter_of_mixin_app_constructor_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/parameter_test.dart b/tests/lib_strong/mirrors/parameter_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/parameter_test.dart
rename to tests/lib_strong/mirrors/parameter_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_class_field_other.dart b/tests/lib_strong/mirrors/private_class_field_other.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/private_class_field_other.dart
rename to tests/lib_strong/mirrors/private_class_field_other.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_class_field_test.dart b/tests/lib_strong/mirrors/private_class_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/private_class_field_test.dart
rename to tests/lib_strong/mirrors/private_class_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_field_helper.dart b/tests/lib_strong/mirrors/private_field_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/private_field_helper.dart
rename to tests/lib_strong/mirrors/private_field_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_field_test.dart b/tests/lib_strong/mirrors/private_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/private_field_test.dart
rename to tests/lib_strong/mirrors/private_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_symbol_mangling_lib.dart b/tests/lib_strong/mirrors/private_symbol_mangling_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/private_symbol_mangling_lib.dart
rename to tests/lib_strong/mirrors/private_symbol_mangling_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_symbol_mangling_test.dart b/tests/lib_strong/mirrors/private_symbol_mangling_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/private_symbol_mangling_test.dart
rename to tests/lib_strong/mirrors/private_symbol_mangling_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_symbol_test.dart b/tests/lib_strong/mirrors/private_symbol_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/private_symbol_test.dart
rename to tests/lib_strong/mirrors/private_symbol_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_types_test.dart b/tests/lib_strong/mirrors/private_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/private_types_test.dart
rename to tests/lib_strong/mirrors/private_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/proxy_type_test.dart b/tests/lib_strong/mirrors/proxy_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/proxy_type_test.dart
rename to tests/lib_strong/mirrors/proxy_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/raw_type_test.dart b/tests/lib_strong/mirrors/raw_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/raw_type_test.dart
rename to tests/lib_strong/mirrors/raw_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/redirecting_factory_different_type_test.dart b/tests/lib_strong/mirrors/redirecting_factory_different_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/redirecting_factory_different_type_test.dart
rename to tests/lib_strong/mirrors/redirecting_factory_different_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/redirecting_factory_test.dart b/tests/lib_strong/mirrors/redirecting_factory_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/redirecting_factory_test.dart
rename to tests/lib_strong/mirrors/redirecting_factory_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflect_class_test.dart b/tests/lib_strong/mirrors/reflect_class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflect_class_test.dart
rename to tests/lib_strong/mirrors/reflect_class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflect_model_test.dart b/tests/lib_strong/mirrors/reflect_model_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflect_model_test.dart
rename to tests/lib_strong/mirrors/reflect_model_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflect_runtime_type_test.dart b/tests/lib_strong/mirrors/reflect_runtime_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflect_runtime_type_test.dart
rename to tests/lib_strong/mirrors/reflect_runtime_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflect_two_classes_test.dart b/tests/lib_strong/mirrors/reflect_two_classes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflect_two_classes_test.dart
rename to tests/lib_strong/mirrors/reflect_two_classes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflect_uninstantiated_class_test.dart b/tests/lib_strong/mirrors/reflect_uninstantiated_class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflect_uninstantiated_class_test.dart
rename to tests/lib_strong/mirrors/reflect_uninstantiated_class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_classes_test.dart b/tests/lib_strong/mirrors/reflected_type_classes_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_classes_test.dart
rename to tests/lib_strong/mirrors/reflected_type_classes_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_function_type_test.dart b/tests/lib_strong/mirrors/reflected_type_function_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_function_type_test.dart
rename to tests/lib_strong/mirrors/reflected_type_function_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_helper.dart b/tests/lib_strong/mirrors/reflected_type_helper.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_helper.dart
rename to tests/lib_strong/mirrors/reflected_type_helper.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_special_types_test.dart b/tests/lib_strong/mirrors/reflected_type_special_types_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_special_types_test.dart
rename to tests/lib_strong/mirrors/reflected_type_special_types_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_test.dart b/tests/lib_strong/mirrors/reflected_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_test.dart
rename to tests/lib_strong/mirrors/reflected_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_typedefs_test.dart b/tests/lib_strong/mirrors/reflected_type_typedefs_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_typedefs_test.dart
rename to tests/lib_strong/mirrors/reflected_type_typedefs_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_typevars_test.dart b/tests/lib_strong/mirrors/reflected_type_typevars_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflected_type_typevars_test.dart
rename to tests/lib_strong/mirrors/reflected_type_typevars_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/reflectively_instantiate_uninstantiated_class_test.dart b/tests/lib_strong/mirrors/reflectively_instantiate_uninstantiated_class_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/reflectively_instantiate_uninstantiated_class_test.dart
rename to tests/lib_strong/mirrors/reflectively_instantiate_uninstantiated_class_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/regress_14304_test.dart b/tests/lib_strong/mirrors/regress_14304_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/regress_14304_test.dart
rename to tests/lib_strong/mirrors/regress_14304_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/regress_16321_test.dart b/tests/lib_strong/mirrors/regress_16321_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/regress_16321_test.dart
rename to tests/lib_strong/mirrors/regress_16321_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/regress_19731_test.dart b/tests/lib_strong/mirrors/regress_19731_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/regress_19731_test.dart
rename to tests/lib_strong/mirrors/regress_19731_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/regress_26187_test.dart b/tests/lib_strong/mirrors/regress_26187_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/regress_26187_test.dart
rename to tests/lib_strong/mirrors/regress_26187_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/relation_assignable_test.dart b/tests/lib_strong/mirrors/relation_assignable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/relation_assignable_test.dart
rename to tests/lib_strong/mirrors/relation_assignable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/relation_subclass_test.dart b/tests/lib_strong/mirrors/relation_subclass_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/relation_subclass_test.dart
rename to tests/lib_strong/mirrors/relation_subclass_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/relation_subtype_test.dart b/tests/lib_strong/mirrors/relation_subtype_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/relation_subtype_test.dart
rename to tests/lib_strong/mirrors/relation_subtype_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/removed_api_test.dart b/tests/lib_strong/mirrors/removed_api_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/removed_api_test.dart
rename to tests/lib_strong/mirrors/removed_api_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/repeated_private_anon_mixin_app1.dart b/tests/lib_strong/mirrors/repeated_private_anon_mixin_app1.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/repeated_private_anon_mixin_app1.dart
rename to tests/lib_strong/mirrors/repeated_private_anon_mixin_app1.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/repeated_private_anon_mixin_app2.dart b/tests/lib_strong/mirrors/repeated_private_anon_mixin_app2.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/repeated_private_anon_mixin_app2.dart
rename to tests/lib_strong/mirrors/repeated_private_anon_mixin_app2.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/repeated_private_anon_mixin_app_test.dart b/tests/lib_strong/mirrors/repeated_private_anon_mixin_app_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/repeated_private_anon_mixin_app_test.dart
rename to tests/lib_strong/mirrors/repeated_private_anon_mixin_app_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/return_type_test.dart b/tests/lib_strong/mirrors/return_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/return_type_test.dart
rename to tests/lib_strong/mirrors/return_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/runtime_type_test.dart b/tests/lib_strong/mirrors/runtime_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/runtime_type_test.dart
rename to tests/lib_strong/mirrors/runtime_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/set_field_with_final_inheritance_test.dart b/tests/lib_strong/mirrors/set_field_with_final_inheritance_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/set_field_with_final_inheritance_test.dart
rename to tests/lib_strong/mirrors/set_field_with_final_inheritance_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/set_field_with_final_test.dart b/tests/lib_strong/mirrors/set_field_with_final_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/set_field_with_final_test.dart
rename to tests/lib_strong/mirrors/set_field_with_final_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/spawn_function_root_library_test.dart b/tests/lib_strong/mirrors/spawn_function_root_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/spawn_function_root_library_test.dart
rename to tests/lib_strong/mirrors/spawn_function_root_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/static_const_field_test.dart b/tests/lib_strong/mirrors/static_const_field_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/static_const_field_test.dart
rename to tests/lib_strong/mirrors/static_const_field_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/static_members_easier_test.dart b/tests/lib_strong/mirrors/static_members_easier_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/static_members_easier_test.dart
rename to tests/lib_strong/mirrors/static_members_easier_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/static_members_test.dart b/tests/lib_strong/mirrors/static_members_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/static_members_test.dart
rename to tests/lib_strong/mirrors/static_members_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/static_metatarget_test.dart b/tests/lib_strong/mirrors/static_metatarget_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/static_metatarget_test.dart
rename to tests/lib_strong/mirrors/static_metatarget_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/static_test.dart b/tests/lib_strong/mirrors/static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/static_test.dart
rename to tests/lib_strong/mirrors/static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/stringify.dart b/tests/lib_strong/mirrors/stringify.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/stringify.dart
rename to tests/lib_strong/mirrors/stringify.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/superclass2_test.dart b/tests/lib_strong/mirrors/superclass2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/superclass2_test.dart
rename to tests/lib_strong/mirrors/superclass2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/superclass_test.dart b/tests/lib_strong/mirrors/superclass_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/superclass_test.dart
rename to tests/lib_strong/mirrors/superclass_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/symbol_validation_test.dart b/tests/lib_strong/mirrors/symbol_validation_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/symbol_validation_test.dart
rename to tests/lib_strong/mirrors/symbol_validation_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/syntax_error_test.dart b/tests/lib_strong/mirrors/syntax_error_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/syntax_error_test.dart
rename to tests/lib_strong/mirrors/syntax_error_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/synthetic_accessor_properties_test.dart b/tests/lib_strong/mirrors/synthetic_accessor_properties_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/synthetic_accessor_properties_test.dart
rename to tests/lib_strong/mirrors/synthetic_accessor_properties_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/to_string_test.dart b/tests/lib_strong/mirrors/to_string_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/to_string_test.dart
rename to tests/lib_strong/mirrors/to_string_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/top_level_accessors_test.dart b/tests/lib_strong/mirrors/top_level_accessors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/top_level_accessors_test.dart
rename to tests/lib_strong/mirrors/top_level_accessors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/type_argument_is_type_variable_test.dart b/tests/lib_strong/mirrors/type_argument_is_type_variable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/type_argument_is_type_variable_test.dart
rename to tests/lib_strong/mirrors/type_argument_is_type_variable_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/type_mirror_for_type_test.dart b/tests/lib_strong/mirrors/type_mirror_for_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/type_mirror_for_type_test.dart
rename to tests/lib_strong/mirrors/type_mirror_for_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/type_variable_is_static_test.dart b/tests/lib_strong/mirrors/type_variable_is_static_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/type_variable_is_static_test.dart
rename to tests/lib_strong/mirrors/type_variable_is_static_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/type_variable_owner_test.dart b/tests/lib_strong/mirrors/type_variable_owner_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/type_variable_owner_test.dart
rename to tests/lib_strong/mirrors/type_variable_owner_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/typearguments_mirror_test.dart b/tests/lib_strong/mirrors/typearguments_mirror_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/typearguments_mirror_test.dart
rename to tests/lib_strong/mirrors/typearguments_mirror_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/typedef_deferred_library_test.dart b/tests/lib_strong/mirrors/typedef_deferred_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/typedef_deferred_library_test.dart
rename to tests/lib_strong/mirrors/typedef_deferred_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/typedef_in_signature_test.dart b/tests/lib_strong/mirrors/typedef_in_signature_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/typedef_in_signature_test.dart
rename to tests/lib_strong/mirrors/typedef_in_signature_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/typedef_library.dart b/tests/lib_strong/mirrors/typedef_library.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/typedef_library.dart
rename to tests/lib_strong/mirrors/typedef_library.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/typedef_library_test.dart b/tests/lib_strong/mirrors/typedef_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/typedef_library_test.dart
rename to tests/lib_strong/mirrors/typedef_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/typedef_metadata_test.dart b/tests/lib_strong/mirrors/typedef_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/typedef_metadata_test.dart
rename to tests/lib_strong/mirrors/typedef_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/typedef_reflected_type_test.dart b/tests/lib_strong/mirrors/typedef_reflected_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/typedef_reflected_type_test.dart
rename to tests/lib_strong/mirrors/typedef_reflected_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/typedef_test.dart b/tests/lib_strong/mirrors/typedef_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/typedef_test.dart
rename to tests/lib_strong/mirrors/typedef_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/typevariable_mirror_metadata_test.dart b/tests/lib_strong/mirrors/typevariable_mirror_metadata_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/typevariable_mirror_metadata_test.dart
rename to tests/lib_strong/mirrors/typevariable_mirror_metadata_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unmangled_type_test.dart b/tests/lib_strong/mirrors/unmangled_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unmangled_type_test.dart
rename to tests/lib_strong/mirrors/unmangled_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unnamed_library_test.dart b/tests/lib_strong/mirrors/unnamed_library_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unnamed_library_test.dart
rename to tests/lib_strong/mirrors/unnamed_library_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors2_test.dart b/tests/lib_strong/mirrors/unused_mirrors2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors2_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors3_test.dart b/tests/lib_strong/mirrors/unused_mirrors3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors3_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors4_test.dart b/tests/lib_strong/mirrors/unused_mirrors4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors4_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors5_test.dart b/tests/lib_strong/mirrors/unused_mirrors5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors5_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors6_test.dart b/tests/lib_strong/mirrors/unused_mirrors6_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors6_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors6_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors7_test.dart b/tests/lib_strong/mirrors/unused_mirrors7_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors7_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors7_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors8_test.dart b/tests/lib_strong/mirrors/unused_mirrors8_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors8_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors8_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors9_test.dart b/tests/lib_strong/mirrors/unused_mirrors9_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors9_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors9_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors_test.dart b/tests/lib_strong/mirrors/unused_mirrors_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors_used_test.dart b/tests/lib_strong/mirrors/unused_mirrors_used_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/unused_mirrors_used_test.dart
rename to tests/lib_strong/mirrors/unused_mirrors_used_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/variable_is_const_test.dart b/tests/lib_strong/mirrors/variable_is_const_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/mirrors/variable_is_const_test.dart
rename to tests/lib_strong/mirrors/variable_is_const_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/byte_data_test.dart b/tests/lib_strong/typed_data/byte_data_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/byte_data_test.dart
rename to tests/lib_strong/typed_data/byte_data_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/constructor_checks_test.dart b/tests/lib_strong/typed_data/constructor_checks_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/constructor_checks_test.dart
rename to tests/lib_strong/typed_data/constructor_checks_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/endianness_test.dart b/tests/lib_strong/typed_data/endianness_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/endianness_test.dart
rename to tests/lib_strong/typed_data/endianness_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_clamp_test.dart b/tests/lib_strong/typed_data/float32x4_clamp_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_clamp_test.dart
rename to tests/lib_strong/typed_data/float32x4_clamp_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_cross_test.dart b/tests/lib_strong/typed_data/float32x4_cross_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_cross_test.dart
rename to tests/lib_strong/typed_data/float32x4_cross_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_list_test.dart b/tests/lib_strong/typed_data/float32x4_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_list_test.dart
rename to tests/lib_strong/typed_data/float32x4_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_shuffle_test.dart b/tests/lib_strong/typed_data/float32x4_shuffle_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_shuffle_test.dart
rename to tests/lib_strong/typed_data/float32x4_shuffle_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_sign_mask_test.dart b/tests/lib_strong/typed_data/float32x4_sign_mask_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_sign_mask_test.dart
rename to tests/lib_strong/typed_data/float32x4_sign_mask_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_test.dart b/tests/lib_strong/typed_data/float32x4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_test.dart
rename to tests/lib_strong/typed_data/float32x4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_transpose_test.dart b/tests/lib_strong/typed_data/float32x4_transpose_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_transpose_test.dart
rename to tests/lib_strong/typed_data/float32x4_transpose_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_two_arg_shuffle_test.dart b/tests/lib_strong/typed_data/float32x4_two_arg_shuffle_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_two_arg_shuffle_test.dart
rename to tests/lib_strong/typed_data/float32x4_two_arg_shuffle_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_unbox_phi_test.dart b/tests/lib_strong/typed_data/float32x4_unbox_phi_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_unbox_phi_test.dart
rename to tests/lib_strong/typed_data/float32x4_unbox_phi_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_unbox_regress_test.dart b/tests/lib_strong/typed_data/float32x4_unbox_regress_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float32x4_unbox_regress_test.dart
rename to tests/lib_strong/typed_data/float32x4_unbox_regress_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float64x2_functional_test.dart b/tests/lib_strong/typed_data/float64x2_functional_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float64x2_functional_test.dart
rename to tests/lib_strong/typed_data/float64x2_functional_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/float64x2_typed_list_test.dart b/tests/lib_strong/typed_data/float64x2_typed_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/float64x2_typed_list_test.dart
rename to tests/lib_strong/typed_data/float64x2_typed_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_arithmetic_test.dart b/tests/lib_strong/typed_data/int32x4_arithmetic_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_arithmetic_test.dart
rename to tests/lib_strong/typed_data/int32x4_arithmetic_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_bigint_test.dart b/tests/lib_strong/typed_data/int32x4_bigint_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_bigint_test.dart
rename to tests/lib_strong/typed_data/int32x4_bigint_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_list_test.dart b/tests/lib_strong/typed_data/int32x4_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_list_test.dart
rename to tests/lib_strong/typed_data/int32x4_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_shuffle_test.dart b/tests/lib_strong/typed_data/int32x4_shuffle_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_shuffle_test.dart
rename to tests/lib_strong/typed_data/int32x4_shuffle_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_sign_mask_test.dart b/tests/lib_strong/typed_data/int32x4_sign_mask_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_sign_mask_test.dart
rename to tests/lib_strong/typed_data/int32x4_sign_mask_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_test.dart b/tests/lib_strong/typed_data/int32x4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/int32x4_test.dart
rename to tests/lib_strong/typed_data/int32x4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/int64_list_load_store_test.dart b/tests/lib_strong/typed_data/int64_list_load_store_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/int64_list_load_store_test.dart
rename to tests/lib_strong/typed_data/int64_list_load_store_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/native_interceptor_no_own_method_to_intercept_test.dart b/tests/lib_strong/typed_data/native_interceptor_no_own_method_to_intercept_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/native_interceptor_no_own_method_to_intercept_test.dart
rename to tests/lib_strong/typed_data/native_interceptor_no_own_method_to_intercept_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/setRange_1_test.dart b/tests/lib_strong/typed_data/setRange_1_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/setRange_1_test.dart
rename to tests/lib_strong/typed_data/setRange_1_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/setRange_2_test.dart b/tests/lib_strong/typed_data/setRange_2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/setRange_2_test.dart
rename to tests/lib_strong/typed_data/setRange_2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/setRange_3_test.dart b/tests/lib_strong/typed_data/setRange_3_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/setRange_3_test.dart
rename to tests/lib_strong/typed_data/setRange_3_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/setRange_4_test.dart b/tests/lib_strong/typed_data/setRange_4_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/setRange_4_test.dart
rename to tests/lib_strong/typed_data/setRange_4_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/setRange_5_test.dart b/tests/lib_strong/typed_data/setRange_5_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/setRange_5_test.dart
rename to tests/lib_strong/typed_data/setRange_5_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/setRange_lib.dart b/tests/lib_strong/typed_data/setRange_lib.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/setRange_lib.dart
rename to tests/lib_strong/typed_data/setRange_lib.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/simd_store_to_load_forward_test.dart b/tests/lib_strong/typed_data/simd_store_to_load_forward_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/simd_store_to_load_forward_test.dart
rename to tests/lib_strong/typed_data/simd_store_to_load_forward_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/simd_type_check_removal.dart b/tests/lib_strong/typed_data/simd_type_check_removal.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/simd_type_check_removal.dart
rename to tests/lib_strong/typed_data/simd_type_check_removal.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_from_list_test.dart b/tests/lib_strong/typed_data/typed_data_from_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_from_list_test.dart
rename to tests/lib_strong/typed_data/typed_data_from_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_hierarchy_int64_test.dart b/tests/lib_strong/typed_data/typed_data_hierarchy_int64_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_hierarchy_int64_test.dart
rename to tests/lib_strong/typed_data/typed_data_hierarchy_int64_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_hierarchy_test.dart b/tests/lib_strong/typed_data/typed_data_hierarchy_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_hierarchy_test.dart
rename to tests/lib_strong/typed_data/typed_data_hierarchy_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_list_test.dart b/tests/lib_strong/typed_data/typed_data_list_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_list_test.dart
rename to tests/lib_strong/typed_data/typed_data_list_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_load2_test.dart b/tests/lib_strong/typed_data/typed_data_load2_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_load2_test.dart
rename to tests/lib_strong/typed_data/typed_data_load2_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_load_test.dart b/tests/lib_strong/typed_data/typed_data_load_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_load_test.dart
rename to tests/lib_strong/typed_data/typed_data_load_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_sublist_type_test.dart b/tests/lib_strong/typed_data/typed_data_sublist_type_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/typed_data_sublist_type_test.dart
rename to tests/lib_strong/typed_data/typed_data_sublist_type_test.dart
diff --git a/pkg/dev_compiler/test/codegen/lib/typed_data/typed_list_iterable_test.dart b/tests/lib_strong/typed_data/typed_list_iterable_test.dart
similarity index 100%
rename from pkg/dev_compiler/test/codegen/lib/typed_data/typed_list_iterable_test.dart
rename to tests/lib_strong/typed_data/typed_list_iterable_test.dart
diff --git a/tests/standalone/io/directory_test.dart b/tests/standalone/io/directory_test.dart
index 14685b1..dd86dc6 100644
--- a/tests/standalone/io/directory_test.dart
+++ b/tests/standalone/io/directory_test.dart
@@ -603,14 +603,27 @@
   Expect.isTrue(temp2.existsSync());
   Expect.equals(temp3.path, temp2.path);
 
-  temp2.rename(temp1.path).then((temp4) {
-    Expect.isFalse(temp3.existsSync());
-    Expect.isFalse(temp2.existsSync());
-    Expect.isTrue(temp1.existsSync());
-    Expect.isTrue(temp4.existsSync());
-    Expect.equals(temp1.path, temp4.path);
-    temp1.deleteSync(recursive: true);
-  });
+  var temp4 = temp2.renameSync(temp1.path);
+  Expect.isFalse(temp3.existsSync());
+  Expect.isFalse(temp2.existsSync());
+  Expect.isTrue(temp1.existsSync());
+  Expect.isTrue(temp4.existsSync());
+  Expect.equals(temp1.path, temp4.path);
+
+  String foo = '${temp4.path}/foo';
+  String bar = '${temp4.path}/bar';
+  new File(foo).createSync();
+  try {
+    new Directory(foo).renameSync(bar);
+    Expect.fail('Directory.rename should fail to rename a non-directory');
+  } catch (e) {
+    Expect.isTrue(e is FileSystemException);
+    if (Platform.isLinux || Platform.isMacOS) {
+      Expect.isTrue(e.osError.message.contains('Not a directory'));
+    }
+  }
+
+  temp1.deleteSync(recursive: true);
 }
 
 main() {
diff --git a/tests/standalone/io/file_blocking_lock_test.dart b/tests/standalone/io/file_blocking_lock_test.dart
index 9f665b6..5fd6e55 100644
--- a/tests/standalone/io/file_blocking_lock_test.dart
+++ b/tests/standalone/io/file_blocking_lock_test.dart
@@ -39,7 +39,7 @@
   });
 }
 
-const int peerTimeoutMilliseconds = 10000;
+const int peerTimeoutMilliseconds = 30000;
 
 Future<bool> waitForPeer(RandomAccessFile raf, int length) async {
   Stopwatch s = new Stopwatch();
@@ -70,8 +70,13 @@
   await raf.lock(FileLock.BLOCKING_EXCLUSIVE, 0, length);
   Process peer = await runPeer(file.path, length, FileLock.BLOCKING_EXCLUSIVE);
 
-  // Waits for the peer to take the lock, then takes the lock.
-  Expect.isTrue(await waitForPeer(raf, length));
+  // If the peer doesn't come up within the timeout, then give up on the test
+  // to avoid the test being flaky.
+  if (!await waitForPeer(raf, length)) {
+    await raf.close();
+    await directory.delete(recursive: true);
+    return;
+  }
 
   // Check that the peer wrote to the file.
   int p = 0;
diff --git a/tests/standalone/io/file_create_test.dart b/tests/standalone/io/file_create_test.dart
new file mode 100644
index 0000000..f35c43d
--- /dev/null
+++ b/tests/standalone/io/file_create_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+//
+// Dart test program for testing file creation.
+
+import 'dart:async';
+import 'dart:io';
+
+import "package:expect/expect.dart";
+import "package:path/path.dart";
+
+testCreate() async {
+  Directory tmp = await Directory.systemTemp.createTemp('file_test_create');
+  Expect.isTrue(await tmp.exists());
+  String filePath = "${tmp.path}/foo";
+  File file = new File(filePath);
+  File createdFile = await file.create();
+  Expect.equals(file, createdFile);
+  Expect.isTrue(await createdFile.exists());
+  await tmp.delete(recursive: true);
+}
+
+testBadCreate() async {
+  Directory tmp = await Directory.systemTemp.createTemp('file_test_create');
+  Expect.isTrue(await tmp.exists());
+  Directory tmp2 = await tmp.createTemp('file_test_create');
+  Expect.isTrue(await tmp2.exists());
+  String badFilePath = tmp2.path;
+  File badFile = new File(badFilePath);
+  try {
+    await badFile.create();
+    Expect.fail('Should be unreachable');
+  } catch(e) {
+    Expect.isTrue(e is FileSystemException);
+    Expect.isNotNull(e.osError);
+  }
+  await tmp.delete(recursive: true);
+}
+
+main() async {
+  await testCreate();
+  await testBadCreate();
+}
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart
index 8a8d681..7c3295d 100644
--- a/tests/standalone/io/file_test.dart
+++ b/tests/standalone/io/file_test.dart
@@ -584,6 +584,28 @@
     });
   }
 
+  static void testWriteFromOffset() {
+    Directory tmp;
+    RandomAccessFile raf;
+    try {
+      tmp = tempDirectory.createTempSync('write_from_offset_test_');
+      File f = new File('${tmp.path}/file')..createSync();
+      f.writeAsStringSync('pre-existing content\n', flush: true);
+      raf = f.openSync(mode: FileMode.APPEND);
+      String truth = "Hello world";
+      raf.writeFromSync(UTF8.encode('Hello world'), 2, 5);
+      raf.flushSync();
+      Expect.equals(f.readAsStringSync(), 'pre-existing content\nllo');
+    } finally {
+      if (raf != null) {
+        raf.closeSync();
+      }
+      if (tmp != null) {
+        tmp.deleteSync(recursive: true);
+      }
+    }
+  }
+
   static void testDirectory() {
     asyncTestStarted();
     var tempDir = tempDirectory.path;
@@ -642,6 +664,23 @@
     openedFile.closeSync();
   }
 
+  static void testLengthSyncDirectory() {
+    Directory tmp = tempDirectory.createTempSync('file_length_test_');
+    String dirPath = '${tmp.path}/dir';
+    new Directory(dirPath).createSync();
+    try {
+      new File(dirPath).lengthSync();
+      Expect.fail('Expected operation to throw');
+    } catch (e) {
+      if (e is! FileSystemException) {
+        print(e);
+      }
+      Expect.isTrue(e is FileSystemException);
+    } finally {
+      tmp.deleteSync(recursive: true);
+    }
+  }
+
   // Test for file position functionality.
   static void testPosition() {
     asyncTestStarted();
@@ -1251,6 +1290,23 @@
     Expect.isTrue(modified.isBefore(new DateTime.now()));
   }
 
+  static void testLastModifiedSyncDirectory() {
+    Directory tmp = tempDirectory.createTempSync('file_last_modified_test_');
+    String dirPath = '${tmp.path}/dir';
+    new Directory(dirPath).createSync();
+    try {
+      new File(dirPath).lastModifiedSync();
+      Expect.fail('Expected operation to throw');
+    } catch (e) {
+      if (e is! FileSystemException) {
+        print(e);
+      }
+      Expect.isTrue(e is FileSystemException);
+    } finally {
+      tmp.deleteSync(recursive: true);
+    }
+  }
+
   // Test that opens the same file for writing then for appending to test
   // that the file is not truncated when opened for appending.
   static void testAppend() {
@@ -1428,6 +1484,7 @@
 
     createTempDirectory(() {
       testLength();
+      testLengthSyncDirectory();
       testReadWrite();
       testReadWriteSync();
       testReadWriteNoArgsSync();
@@ -1457,6 +1514,7 @@
       testOutputStreamWriteAppend();
       testOutputStreamWriteString();
       testWriteVariousLists();
+      testWriteFromOffset();
       testDirectory();
       testDirectorySync();
       testWriteStringUtf8();
@@ -1466,6 +1524,7 @@
       testRename(targetExists: true);
       testRenameSync(targetExists: true);
       testLastModified();
+      testLastModifiedSyncDirectory();
       testDoubleAsyncOperation();
       asyncEnd();
     });
diff --git a/tests/standalone/io/http_client_stays_alive_test.dart b/tests/standalone/io/http_client_stays_alive_test.dart
index 171eb38..d6a1587 100644
--- a/tests/standalone/io/http_client_stays_alive_test.dart
+++ b/tests/standalone/io/http_client_stays_alive_test.dart
@@ -54,7 +54,7 @@
       // NOTE: There is a slight chance this will cause flakiness, but there is
       // no other good way of testing correctness of timing-dependent code
       // form the outside.
-      if (seconds < SECONDS || (SECONDS + 10) < seconds) {
+      if (seconds < SECONDS || (SECONDS + 30) < seconds) {
         throw "Child did exit within $seconds seconds, but expected it to take "
               "roughly $SECONDS seconds.";
       }
diff --git a/tests/standalone/io/named_pipe_script_test.dart b/tests/standalone/io/named_pipe_script_test.dart
index 83df737..ed5a659 100644
--- a/tests/standalone/io/named_pipe_script_test.dart
+++ b/tests/standalone/io/named_pipe_script_test.dart
@@ -6,27 +6,53 @@
 import "dart:convert";
 import "dart:io";
 
+import "package:async_helper/async_helper.dart";
 import "package:expect/expect.dart";
 
-main() {
+main() async {
+  asyncStart();
   // Reading a script from a named pipe is only supported on Linux and MacOS.
   if (!Platform.isLinux && !Platform.isMacOS) {
+    print("This test is only supported on Linux and MacOS.");
+    asyncEnd();
     return;
   }
 
-  final String script = 'int main() {print("Hello, World!");}';
+  final String script = 'main() { print("Hello, World!"); }';
   final String stdinPipePath = '/dev/fd/0';
+
+  // If there's no file system access to the pipe, then we can't do a meaningful
+  // test.
+  if (!await (new File(stdinPipePath).exists())) {
+    print("Couldn't find $stdinPipePath.");
+    asyncEnd();
+    return;
+  }
+
   StringBuffer output = new StringBuffer();
-  Process.start(Platform.executable, [stdinPipePath]).then((Process process) {
-    process.stdout.transform(UTF8.decoder).listen(output.write);
-    process.stderr.transform(UTF8.decoder).listen((data) {
+  Process process =
+      await Process.start(Platform.executable, [stdinPipePath]);
+  bool stdinWriteFailed = false;
+  process.stdout.transform(UTF8.decoder).listen(output.write);
+  process.stderr.transform(UTF8.decoder).listen((data) {
+    if (!stdinWriteFailed) {
       Expect.fail(data);
-    });
-    process.stdin.writeln(script);
-    process.stdin.close();
-    process.exitCode.then((int status) {
-      Expect.equals(0, status);
-      Expect.equals("Hello, World!\n", output.toString());
-    });
+      process.kill();
+    }
   });
+  process.stdin.done.catchError((e) {
+    // If the write to stdin fails, then give up. We can't test the thing we
+    // wanted to test.
+    stdinWriteFailed = true;
+    process.kill();
+  });
+  process.stdin.writeln(script);
+  process.stdin.close();
+
+  int status = await process.exitCode;
+  if (!stdinWriteFailed) {
+    Expect.equals(0, status);
+    Expect.equals("Hello, World!\n", output.toString());
+  }
+  asyncEnd();
 }
diff --git a/tests/standalone/io/process_start_exception_test.dart b/tests/standalone/io/process_start_exception_test.dart
index a1f891e..2bf38cc 100644
--- a/tests/standalone/io/process_start_exception_test.dart
+++ b/tests/standalone/io/process_start_exception_test.dart
@@ -8,26 +8,38 @@
 import 'dart:async';
 import 'dart:io';
 
+// ENOENT and ERROR_FILE_NOT_FOUND on Windows both have the same value.
+// Note: we are setting PATH to an empty string in tests below because on
+// POSIX systems if target binary name does not contain `/` then it is
+// searched through PATH and if it is not found anywhere in the PATH
+// but some folder in PATH is inaccessible then underlying execvp(...)
+// call will return EACCES (13) instead of ENOENT.
+// For example on some Android devices PATH would include /sbin with is
+// inaccessible - so this test will fail.
+const ENOENT = 2;
+
 testStartError() {
   Future<Process> processFuture =
       Process.start("__path_to_something_that_should_not_exist__",
-                    const []);
+                    const [],
+                    environment: {"PATH": ""});
   processFuture.then((p) => Expect.fail('got process despite start error'))
   .catchError((error) {
     Expect.isTrue(error is ProcessException);
-    Expect.equals(2, error.errorCode, error.toString());
+    Expect.equals(ENOENT, error.errorCode, error.toString());
   });
 }
 
 testRunError() {
   Future<ProcessResult> processFuture =
       Process.run("__path_to_something_that_should_not_exist__",
-                  const []);
+                  const [],
+                  environment: {"PATH": ""});
 
   processFuture.then((result) => Expect.fail("exit handler called"))
   .catchError((error) {
     Expect.isTrue(error is ProcessException);
-    Expect.equals(2, error.errorCode, error.toString());
+    Expect.equals(ENOENT, error.errorCode, error.toString());
   });
 }
 
diff --git a/tests/standalone/io/raw_secure_server_socket_test.dart b/tests/standalone/io/raw_secure_server_socket_test.dart
index 7b5ef57..1ab22db 100644
--- a/tests/standalone/io/raw_secure_server_socket_test.dart
+++ b/tests/standalone/io/raw_secure_server_socket_test.dart
@@ -30,10 +30,12 @@
   ..setTrustedCertificates(localFile('certificates/trusted_certs.pem'));
 
 void testSimpleBind() {
+  print("asyncStart testSimpleBind");
   asyncStart();
   RawSecureServerSocket.bind(HOST, 0, serverContext).then((s) {
     Expect.isTrue(s.port > 0);
     s.close();
+    print("asyncEnd testSimpleBind");
     asyncEnd();
   });
 }
@@ -43,24 +45,29 @@
 
   // Bind to a unknown DNS name.
   asyncStart();
+  print("asyncStart testInvalidBind");
   RawSecureServerSocket.bind("ko.faar.__hest__", 0, serverContext).then((_) {
     Expect.fail("Failure expected");
   }).catchError((error) {
     Expect.isTrue(error is SocketException);
+    print("asyncEnd testInvalidBind");
     asyncEnd();
   });
 
   // Bind to an unavaliable IP-address.
   asyncStart();
+  print("asyncStart testInvalidBind 2");
   RawSecureServerSocket.bind("8.8.8.8", 0, serverContext).then((_) {
     Expect.fail("Failure expected");
   }).catchError((error) {
     Expect.isTrue(error is SocketException);
+    print("asyncEnd testInvalidBind 2");
     asyncEnd();
   });
 
   // Bind to a port already in use.
   asyncStart();
+  print("asyncStart testInvalidBind 3");
   RawSecureServerSocket.bind(HOST, 0, serverContext).then((s) {
     RawSecureServerSocket.bind(HOST,
                                s.port,
@@ -72,12 +79,14 @@
     .catchError((error) {
       Expect.isTrue(error is SocketException);
       s.close();
+      print("asyncEnd testInvalidBind 3");
       asyncEnd();
     });
   });
 }
 
 void testSimpleConnect() {
+  print("asyncStart testSimpleConnect");
   asyncStart();
   RawSecureServerSocket.bind(HOST, 0, serverContext).then((server) {
     var clientEndFuture =
@@ -88,13 +97,17 @@
         clientEnd.shutdown(SocketDirection.SEND);
         serverEnd.shutdown(SocketDirection.SEND);
         server.close();
+        print("asyncEnd testSimpleConnect");
         asyncEnd();
       });
     });
   });
 }
 
+int debugTestSimpleConnectFailCounter = 0;
 void testSimpleConnectFail(SecurityContext context, bool cancelOnError) {
+  var counter = debugTestSimpleConnectFailCounter++;
+  print("asyncStart testSimpleConnectFail $counter");
   asyncStart();
   RawSecureServerSocket.bind(HOST, 0, context).then((server) {
     var clientEndFuture =
@@ -114,6 +127,7 @@
                     error is HandshakeException);
       clientEndFuture.then((_) {
         if (!cancelOnError) server.close();
+        print("asyncEnd testSimpleConnectFail $counter");
         asyncEnd();
       });
     },
@@ -122,6 +136,7 @@
 }
 
 void testServerListenAfterConnect() {
+  print("asyncStart testServerListenAfterConnect");
   asyncStart();
   RawSecureServerSocket.bind(HOST, 0, serverContext).then((server) {
     Expect.isTrue(server.port > 0);
@@ -133,6 +148,7 @@
           clientEnd.shutdown(SocketDirection.SEND);
           serverEnd.shutdown(SocketDirection.SEND);
           server.close();
+          print("asyncEnd testServerListenAfterConnect");
           asyncEnd();
         });
       });
@@ -182,6 +198,8 @@
     Expect.fail("Invalid arguments to testSimpleReadWrite");
   }
 
+  print("asyncStart testSimpleReadWrite($listenSecure, $connectSecure, "
+       "$handshakeBeforeSecure, $postponeSecure, $dropReads");
   asyncStart();
 
   const messageSize = 1000;
@@ -479,6 +497,8 @@
 
     connectClient(server.port).then(runClient).then((socket) {
       socket.close();
+      print("asyncEnd testSimpleReadWrite($listenSecure, $connectSecure, "
+       "$handshakeBeforeSecure, $postponeSecure, $dropReads");
       asyncEnd();
     });
   }
@@ -492,6 +512,8 @@
 }
 
 testPausedSecuringSubscription(bool pausedServer, bool pausedClient) {
+  print(
+      "asyncStart testPausedSecuringSubscription $pausedServer $pausedClient");
   asyncStart();
   var clientComplete = new Completer();
   RawServerSocket.bind(HOST, 0).then((server) {
@@ -505,6 +527,8 @@
           server.close();
           clientComplete.future.then((_) {
             client.close();
+            print("asyncEnd testPausedSecuringSubscription "
+                "$pausedServer $pausedClient");
             asyncEnd();
           });
         }
@@ -562,10 +586,12 @@
 }
 
 main() {
+  print("asyncStart main");
   asyncStart();
   InternetAddress.lookup("localhost").then((hosts) {
     HOST = hosts.first;
     runTests();
+    print("asyncEnd main");
     asyncEnd();
   });
 }
diff --git a/tests/standalone/io/socket_bind_test.dart b/tests/standalone/io/socket_bind_test.dart
index f701f0c..08963eb 100644
--- a/tests/standalone/io/socket_bind_test.dart
+++ b/tests/standalone/io/socket_bind_test.dart
@@ -4,11 +4,12 @@
 
 import 'dart:async';
 import 'dart:io';
-import 'dart:convert';
 
 import 'package:async_helper/async_helper.dart';
 import 'package:expect/expect.dart';
 
+import 'test_utils.dart' show freeIPv4AndIPv6Port, retry;
+
 testBindShared(String host, bool v6Only) {
   asyncStart();
   ServerSocket.bind(
@@ -112,27 +113,6 @@
   asyncEnd();
 }
 
-Future<int> freeIPv4AndIPv6Port() async {
-  var socket =
-    await ServerSocket.bind(InternetAddress.ANY_IP_V6, 0, v6Only: false);
-  int port = socket.port;
-  await socket.close();
-  return port;
-}
-
-Future retry(Future fun(), {int maxCount: 10}) async {
-  for (int i = 0; i < maxCount; i++) {
-    try {
-      // If there is no exception this will simply return, otherwise we keep
-      // trying.
-      return await fun();
-    } catch (_) {}
-    print("Failed to execute test closure in attempt $i "
-          "(${maxCount - i} retries left).");
-  }
-  return await fun();
-}
-
 main() async {
   asyncStart();
 
diff --git a/tests/standalone/io/socket_ipv6_test.dart b/tests/standalone/io/socket_ipv6_test.dart
index e3a2e91..8eaa662 100644
--- a/tests/standalone/io/socket_ipv6_test.dart
+++ b/tests/standalone/io/socket_ipv6_test.dart
@@ -3,17 +3,19 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'dart:io';
+import 'dart:async';
 
 import "package:async_helper/async_helper.dart";
 import "package:expect/expect.dart";
+import "test_utils.dart" show retry;
 
 const ANY = InternetAddressType.ANY;
 
-void testIPv6toIPv6() {
+Future testIPv6toIPv6() {
   asyncStart();
-  InternetAddress.lookup("::0", type: ANY).then((serverAddr) {
-    InternetAddress.lookup("::1", type: ANY).then((clientAddr) {
-        ServerSocket.bind(serverAddr.first, 0).then((server) {
+  return InternetAddress.lookup("::0", type: ANY).then((serverAddr) {
+    return InternetAddress.lookup("::1", type: ANY).then((clientAddr) {
+      return ServerSocket.bind(serverAddr.first, 0).then((server) {
         Expect.equals('::0', server.address.host);
         Expect.equals('::', server.address.address);
         server.listen((socket) {
@@ -21,7 +23,7 @@
           server.close();
           asyncEnd();
         });
-        Socket.connect(clientAddr.first, server.port).then((socket) {
+        return Socket.connect(clientAddr.first, server.port).then((socket) {
           socket.destroy();
         });
       });
@@ -29,10 +31,10 @@
   });
 }
 
-void testIPv4toIPv6() {
+Future testIPv4toIPv6() {
   asyncStart();
-  InternetAddress.lookup("::0", type: ANY).then((serverAddr) {
-      ServerSocket.bind(serverAddr.first, 0).then((server) {
+  return InternetAddress.lookup("::0", type: ANY).then((serverAddr) {
+    return ServerSocket.bind(serverAddr.first, 0).then((server) {
       Expect.equals('::0', server.address.host);
       Expect.equals('::', server.address.address);
       server.listen((socket) {
@@ -40,23 +42,26 @@
         server.close();
         asyncEnd();
       });
-      Socket.connect("127.0.0.1", server.port).then((socket) {
+      return Socket.connect("127.0.0.1", server.port).then((socket) {
         socket.destroy();
       });
     });
   });
 }
 
-void testIPv6toIPv4() {
+Future testIPv6toIPv4() {
   asyncStart();
-  InternetAddress.lookup("::1", type: ANY).then((clientAddr) {
-      ServerSocket.bind("127.0.0.1", 0).then((server) {
+  return InternetAddress.lookup("::1", type: ANY).then((clientAddr) {
+    return ServerSocket.bind("127.0.0.1", 0).then((server) {
       Expect.equals('127.0.0.1', server.address.host);
       Expect.equals('127.0.0.1', server.address.address);
       server.listen((socket) {
         throw "Unexpected socket";
       });
-      Socket.connect(clientAddr.first, server.port).catchError((e) {
+      return Socket.connect(clientAddr.first, server.port).then((socket) {
+        socket.destroy();
+        throw "Unexpected connect";
+      }, onError: (e) {}).whenComplete(() {
         server.close();
         asyncEnd();
       });
@@ -64,9 +69,9 @@
   });
 }
 
-void testIPv4toIPv4() {
+Future testIPv4toIPv4() {
   asyncStart();
-  ServerSocket.bind("127.0.0.1", 0).then((server) {
+  return ServerSocket.bind("127.0.0.1", 0).then((server) {
     Expect.equals('127.0.0.1', server.address.host);
     Expect.equals('127.0.0.1', server.address.address);
     server.listen((socket) {
@@ -74,15 +79,15 @@
       server.close();
       asyncEnd();
     });
-    Socket.connect("127.0.0.1", server.port).then((socket) {
+    return Socket.connect("127.0.0.1", server.port).then((socket) {
       socket.destroy();
     });
   });
 }
 
-void testIPv6Lookup() {
+Future testIPv6Lookup() {
   asyncStart();
-  InternetAddress.lookup("::0", type: ANY).then((list) {
+  return InternetAddress.lookup("::0", type: ANY).then((list) {
     if (list.length < 0) throw "no address";
     for (var entry in list) {
       if (entry.type != InternetAddressType.IP_V6) {
@@ -93,9 +98,9 @@
   });
 }
 
-void testIPv4Lookup() {
+Future testIPv4Lookup() {
   asyncStart();
-  InternetAddress.lookup("127.0.0.1").then((list) {
+  return InternetAddress.lookup("127.0.0.1").then((list) {
     if (list.length < 0) throw "no address";
     for (var entry in list) {
       if (entry.type != InternetAddressType.IP_V4) {
@@ -106,30 +111,31 @@
   });
 }
 
-void testIPv4toIPv6_IPV6Only() {
+Future testIPv4toIPv6_IPV6Only() {
   asyncStart();
-  InternetAddress.lookup("::0", type: ANY)
-      .then((serverAddr) {
-        ServerSocket.bind(serverAddr.first, 0, v6Only: true)
-            .then((server) {
-              server.listen((socket) {
-                throw "Unexpected socket";
-              });
-              Socket.connect("127.0.0.1", server.port).catchError((error) {
-                server.close();
-                asyncEnd();
-              });
-            });
+  return InternetAddress.lookup("::0", type: ANY).then((serverAddr) {
+    return ServerSocket.bind(serverAddr.first, 0, v6Only: true).then((server) {
+      server.listen((socket) {
+        throw "Unexpected socket";
       });
+      return Socket.connect("127.0.0.1", server.port).then((socket) {
+        socket.destroy();
+        throw "Unexpected connect";
+      }, onError: (e) {}).whenComplete(() {
+        server.close();
+        asyncEnd();
+      });
+    });
+  });
 }
 
-void main() {
-  testIPv6toIPv6();
-  testIPv4toIPv6();
-  testIPv6toIPv4();
-  testIPv4toIPv4();
-  testIPv6Lookup();
-  testIPv4Lookup();
+main() async {
+  await testIPv6toIPv6();                /// 01: ok
+  await testIPv4toIPv6();                /// 02: ok
+  await testIPv4toIPv4();                /// 03: ok
+  await testIPv6Lookup();                /// 04: ok
+  await testIPv4Lookup();                /// 05: ok
 
-  testIPv4toIPv6_IPV6Only();
+  await retry(testIPv6toIPv4);           /// 06: ok
+  await retry(testIPv4toIPv6_IPV6Only);  /// 07: ok
 }
diff --git a/tests/standalone/io/socket_source_address_test.dart b/tests/standalone/io/socket_source_address_test.dart
index 64dc490..8f076ed 100644
--- a/tests/standalone/io/socket_source_address_test.dart
+++ b/tests/standalone/io/socket_source_address_test.dart
@@ -9,6 +9,8 @@
 import "package:async_helper/async_helper.dart";
 import "package:expect/expect.dart";
 
+import 'test_utils.dart' show freeIPv4AndIPv6Port, retry;
+
 Future throws(Function f, Function check) async {
   try {
     await f();
@@ -23,9 +25,12 @@
 }
 
 Future testArguments(connectFunction) async {
+  int freePort = await freeIPv4AndIPv6Port();
+
   var sourceAddress;
   asyncStart();
-  var server = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0);
+  var server = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4,
+                                       freePort);
   server.listen((_) {
     throw 'Unexpected connection from address $sourceAddress';
   }, onDone: () => asyncEnd());
@@ -73,6 +78,8 @@
                    bool v6Only,
                    Function connectFunction,
                    Function closeDestroyFunction) async {
+  int freePort = await freeIPv4AndIPv6Port();
+
   var successCount = 0;
   if (!v6Only) successCount += ipV4SourceAddresses.length;
   if (bindAddress.type == InternetAddressType.IP_V6) {
@@ -83,7 +90,7 @@
   if (successCount == 0) allConnected.complete();
 
   asyncStart();
-  var server = await ServerSocket.bind(bindAddress, 0, v6Only: v6Only);
+  var server = await ServerSocket.bind(bindAddress, freePort, v6Only: v6Only);
   server.listen((s) {
     s.destroy();
     count++;
@@ -130,19 +137,40 @@
   asyncEnd();
 }
 
-main() {
-  testArguments(RawSocket.connect);
-  testArguments(Socket.connect);
-  testConnect(
-      InternetAddress.ANY_IP_V4, false, RawSocket.connect, (s) => s.close());
-  testConnect(
-      InternetAddress.ANY_IP_V4, false, Socket.connect, (s) => s.destroy());
-  testConnect(
-      InternetAddress.ANY_IP_V6, false, RawSocket.connect, (s) => s.close());
-  testConnect(
-      InternetAddress.ANY_IP_V6, false, Socket.connect, (s) => s.destroy());
-  testConnect(
-      InternetAddress.ANY_IP_V6, true, RawSocket.connect, (s) => s.close());
-  testConnect(
-      InternetAddress.ANY_IP_V6, true, Socket.connect, (s) => s.destroy());
+main() async {
+  asyncStart();
+
+  await retry(() async {
+    await testArguments(RawSocket.connect);
+  });
+  await retry(() async {
+    await testArguments(Socket.connect);
+  });
+
+  await retry(() async {
+    await testConnect(
+        InternetAddress.ANY_IP_V4, false, RawSocket.connect, (s) => s.close());
+  });
+  await retry(() async {
+    await testConnect(
+        InternetAddress.ANY_IP_V4, false, Socket.connect, (s) => s.destroy());
+  });
+  await retry(() async {
+    await testConnect(
+        InternetAddress.ANY_IP_V6, false, RawSocket.connect, (s) => s.close());
+  });
+  await retry(() async {
+    await testConnect(
+        InternetAddress.ANY_IP_V6, false, Socket.connect, (s) => s.destroy());
+  });
+  await retry(() async {
+    await testConnect(
+        InternetAddress.ANY_IP_V6, true, RawSocket.connect, (s) => s.close());
+  });
+  await retry(() async {
+    await testConnect(
+        InternetAddress.ANY_IP_V6, true, Socket.connect, (s) => s.destroy());
+  });
+
+  asyncEnd();
 }
diff --git a/tests/standalone/io/test_utils.dart b/tests/standalone/io/test_utils.dart
new file mode 100644
index 0000000..ace6603
--- /dev/null
+++ b/tests/standalone/io/test_utils.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:io';
+
+Future<int> freeIPv4AndIPv6Port() async {
+  var socket =
+    await ServerSocket.bind(InternetAddress.ANY_IP_V6, 0, v6Only: false);
+  int port = socket.port;
+  await socket.close();
+  return port;
+}
+
+int lastRetryId = 0;
+
+Future retry(Future fun(), {int maxCount: 10}) async {
+  final int id = lastRetryId++;
+  for (int i = 0; i < maxCount; i++) {
+    try {
+      // If there is no exception this will simply return, otherwise we keep
+      // trying.
+      return await fun();
+    } catch (e, stack) {
+      print("Failed to execute test closure (retry id: ${id}) in attempt $i "
+            "(${maxCount - i} retries left).");
+      print("Exception: ${e}");
+      print("Stacktrace: ${stack}");
+    }
+  }
+  return await fun();
+}
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index dfc31c0..98f7d8f 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -7,6 +7,9 @@
 # listed in tests/lib/analyzer/analyze_tests.status without the "standalone"
 # prefix.
 
+io/raw_socket_test: Pass, RuntimeError # Issue 28288
+io/http_close_test: Pass, RuntimeError # Issue 28380
+
 packages_file_test: Skip # Issue 26715
 packages_file_test/none: Skip   # contains no tests.
 
@@ -19,16 +22,16 @@
 
 issue14236_test: Pass # Do not remove this line. It serves as a marker for Issue 14516 comment #4.
 
-[ ($runtime != vm && $runtime != dart_precompiled && $runtime != dart_app) && ($runtime != drt || $compiler != none)) ]
+[ ($runtime != vm && $runtime != dart_precompiled) && ($runtime != drt || $compiler != none) ]
 no_assert_test: Fail, OK # This is testing a vm flag.
 env_test: Skip # This is testing a vm command line parsing scenario.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 package/package_isolate_test: Fail # Issue 12474
 io/observatory_test: Fail
 package/scenarios/invalid/same_package_twice_test: Pass # Issue 24119
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $checked ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $checked ]
 # These tests have type errors on purpose.
 io/process_invalid_arguments_test: Fail, OK
 io/directory_invalid_arguments_test: Fail, OK
@@ -41,13 +44,17 @@
 io/file_fuzz_test: Skip
 io/directory_fuzz_test: Skip
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $system == macos ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $system == macos ]
 # This test fails with "Too many open files" on the Mac OS buildbot.
 # This is expected as MacOS by default runs with a very low number
 # of allowed open files ('ulimit -n' says something like 256).
 io/socket_many_connections_test: Skip
 # Re-enable once the bots have been updated. Issue #26057
 io/secure_server_client_certificate_test: Skip
+io/socket_test: Pass, Timeout # Issue 27453
+
+# This test sometimes hangs on Mac.
+io/raw_server_socket_cancel_test: Skip # Issue 28182
 
 [ $runtime == vm && $system == linux ]
 # These tests have started timing out and issue 25649 has been filed to
@@ -56,6 +63,11 @@
 io/http_proxy_test: Skip
 io/secure_builtin_roots_test: Skip
 
+# These tests might be slow on an opt counter threshold bot.
+# They also time out on the bot occasionally => flaky test issue 28046
+io/http_basic_test: Pass, Slow, Timeout  # Issue 28046
+io/http_launch_test: Pass, Slow, Timeout  # Issue 28046
+
 
 [ $compiler == none && ($runtime == drt || $runtime == dartium) ]
 typed_array_test: RuntimeError, OK  # Uses Isolate.spawn
@@ -114,7 +126,7 @@
 [ $compiler == dart2js && $cps_ir && $checked ]
 *: Skip # `assert` not implemented
 
-[ ($runtime == vm || $runtime == dart_app) && ($arch == arm || $arch == arm64) ]
+[ $runtime == vm && ($arch == arm || $arch == arm64) ]
 io/file_stream_test: Skip # Issue 26109
 io/file_typed_data_test: Skip # Issue 26109
 io/file_input_stream_test: Skip # Issue 26109
@@ -143,7 +155,10 @@
 out_of_memory_test: Skip # passes on Mac, crashes on Linux
 oom_error_stacktrace_test: Skip # Fails on Linux
 
-[ $arch == simarm && $mode == debug && $checked ]
+[ $arch == simmips ]
+io/socket_bind_test: Pass, Fail # Issue 28315
+
+[ ($arch == simarm || $arch == simdbc || $arch == simdbc64) && $mode == debug && $checked ]
 io/web_socket_test: Pass, Fail # Issue 26814
 
 [ $arch == mips ]
@@ -196,13 +211,14 @@
 io/process_sync_test: Pass, Timeout # Issue 24596
 io/sleep_test: Pass, Fail # Issue 25757
 io/socket_info_ipv6_test: RuntimeError # Issue 27876
+io/http_server_early_client_close2_test: Pass, Crash  # Issue 28197
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug && $builder_tag == asan ]
+[ ($runtime == vm || $runtime == dart_precompiled) && $mode == debug && $builder_tag == asan ]
 io/file_lock_test: Skip  # Timeout.
 io/test_runner_test: Skip  # Timeout.
 io/http_client_stays_alive_test: Skip  # Timeout.
 
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
+[ $runtime == vm || $runtime == dart_precompiled ]
 # Failures in secure networking while NSS is replaced with BoringSSL
 io/https_client_certificate_test: RuntimeError # Issue 24070
 io/secure_socket_renegotiate_test: RuntimeError
@@ -212,18 +228,16 @@
 no_allow_absolute_addresses_test: SkipByDesign # Not supported.
 link_natives_lazily_test: SkipByDesign # Not supported.
 
-[ $noopt || $compiler == precompiler ]
+[ $compiler == precompiler ]
 # Stacktraces in precompilation omit inlined frames.
 assert_test: Pass, RuntimeError
-
-[ $noopt || $compiler == precompiler ]
 map_insert_remove_oom_test: Skip # Heap limit too low. Increasing iteration count to make a higher limit a meaningful test makes it too slow for simarm[64] bots.
 io/web_socket_test: Pass, RuntimeError # Issue 24674
 
-[ $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
+[ $compiler == precompiler || $compiler == app_jit ]
 io/compile_all_test: Skip # Incompatible flag --compile_all
 
-[ $runtime == dart_app ]
+[ $compiler == app_jit ]
 io/stdout_bad_argument_test: Skip # Test exits and so can't generate snapshot.
 io/directory_list_sync_test: Skip # Snapshot path differs from script path.
 io/test_extension_test: Skip # Snapshot path differs from script path.
@@ -271,12 +285,22 @@
 io/platform_test: RuntimeError # Expects to be running from 'dart' instead of 'dart_precompiled_runtime'
 io/directory_list_sync_test: Timeout, Skip # Expects to find the test directory relative to the script.
 
+[ $runtime == vm && $system == windows && $mode == release ]
+io/http_server_close_response_after_error_test: Pass, Timeout # Issue 28370: timeout.
+io/regress_7191_test: Pass, Timeout # Issue 28374: timeout.
+
+[ $runtime == vm && $system == linux && $mode == release && $arch == ia32 && $builder_tag == asan ]
+io/socket_close_test: Pass, Timeout # Issue 28502: timeout.
+
 [ $runtime == dart_precompiled || $mode == product ]
 io/skipping_dart2js_compilations_test: CompileTimeError # Imports dart:mirrors
 io/test_harness_analyzer_test: CompileTimeError # Imports dart:mirrors
 io/test_runner_test: CompileTimeError # Imports dart:mirrors
 
-[ $runtime == dart_precompiled || $runtime == dart_app || $mode == product ]
+[ $compiler == app_jit ]
+assert_test: RuntimeError # Script name change?
+
+[ $runtime == dart_precompiled || $mode == product ]
 assert_test: SkipByDesign # Requires checked mode.
 no_assert_test: SkipByDesign # Requires checked mode.
 io/code_collection_test: Skip # Incompatible flags
@@ -293,7 +317,7 @@
 io/stdio_implicit_close_test: Skip # SkipByDesign
 
 # Following tests are skipped on dart_app as package mapping is not supported.
-[ $runtime == dart_precompiled || $runtime == dart_app ]
+[ $runtime == dart_precompiled || $compiler == app_jit ]
 package/scenarios/packages_file_strange_formatting/mixed_line_ends_test: Skip
 package/scenarios/packages_file_strange_formatting/empty_lines_test: Skip
 package/scenarios/invalid/invalid_utf8_test: Skip
@@ -342,7 +366,10 @@
 io/https_bad_certificate_test: RuntimeError
 io/secure_server_closing_test: RuntimeError
 
-[ $runtime == vm || $runtime == dart_app || $runtime == dart_precompiled ]
+[ $system == android && $runtime == dart_precompiled && $mode == release && $arch == arm]
+io/stdout_stderr_non_blocking_test: Pass, Timeout # Issue 28426
+
+[ $runtime == vm || $runtime == dart_precompiled ]
 deferred_transitive_import_error_test: Skip # Contains intentional errors.
 
 [ $hot_reload || $hot_reload_rollback ]
@@ -361,3 +388,7 @@
 io/http_ipv6_test: SkipByDesign
 io/socket_ipv6_test: SkipByDesign
 io/socket_info_ipv6_test: SkipByDesign
+
+[ $builder_tag == asan && $arch == x64 ]
+io/process_detached_test: Pass, Slow
+io/named_pipe_script_test: RuntimeError
diff --git a/third_party/firefox_jsshell/README.google b/third_party/firefox_jsshell/README.google
index 7868748..8a02b18 100644
--- a/third_party/firefox_jsshell/README.google
+++ b/third_party/firefox_jsshell/README.google
@@ -1,8 +1,8 @@
 Name: Firefox command line javascript shell.
 Short Name: js-shell
-URL: http://ftp.mozilla.org/pub/firefox/candidates/47.0-candidates/build2/
-Version: JavaScript-C47
-Date: June 3, 2016
+URL: http://ftp.mozilla.org/pub/firefox/candidates/50.0-candidates/build2/
+Version: JavaScript-C50
+Date: December 6, 2016
 License: MPL, http://www.mozilla.org/MPL
 
 Description:
diff --git a/third_party/firefox_jsshell/linux/jsshell.tar.gz.sha1 b/third_party/firefox_jsshell/linux/jsshell.tar.gz.sha1
index 1348fe9..4262db5 100644
--- a/third_party/firefox_jsshell/linux/jsshell.tar.gz.sha1
+++ b/third_party/firefox_jsshell/linux/jsshell.tar.gz.sha1
@@ -1 +1 @@
-f44ede84757b76c86bc6dc8aee8f24699390623f
\ No newline at end of file
+4b9a595ea8d8eb1932d6f291010cfbd71dfa0061
\ No newline at end of file
diff --git a/third_party/firefox_jsshell/mac/jsshell.tar.gz.sha1 b/third_party/firefox_jsshell/mac/jsshell.tar.gz.sha1
index 952f5cc..f172154 100644
--- a/third_party/firefox_jsshell/mac/jsshell.tar.gz.sha1
+++ b/third_party/firefox_jsshell/mac/jsshell.tar.gz.sha1
@@ -1 +1 @@
-3d866ec4efe98698381671b25940b8ed1926ac4a
\ No newline at end of file
+5561bf72dd5d675c7a3e953233cc98bb688bf5ec
\ No newline at end of file
diff --git a/third_party/firefox_jsshell/win/jsshell.tar.gz.sha1 b/third_party/firefox_jsshell/win/jsshell.tar.gz.sha1
index f8c7c1b..c6f0f848 100644
--- a/third_party/firefox_jsshell/win/jsshell.tar.gz.sha1
+++ b/third_party/firefox_jsshell/win/jsshell.tar.gz.sha1
@@ -1 +1 @@
-354b952f339d454fb89f2a8288f755d37eae6443
\ No newline at end of file
+c0f0c3347a1eb9ebc6a920d2d5c2f9c2b8371d0a
\ No newline at end of file
diff --git a/tools/FAKE_COMMITS b/tools/FAKE_COMMITS
index cc5aa2f..8d4d095 100644
--- a/tools/FAKE_COMMITS
+++ b/tools/FAKE_COMMITS
@@ -18,4 +18,7 @@
 CIT outage - all slaves rebooted
 Authentication failure flake - rerun all bots
 Trigger bots after master restart - switch dart2js bots to use downloaded sdk.
-Trigger bots after master restart.
\ No newline at end of file
+Trigger bots after master restart.
+Trigger mirroring of github repository
+Trigger mirroring of github repository
+Trigger mirroring of github repository
diff --git a/tools/VERSION b/tools/VERSION
index 2d040d1..9b5dcb4 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -25,7 +25,7 @@
 #
 CHANNEL stable
 MAJOR 1
-MINOR 21
-PATCH 1
+MINOR 22
+PATCH 0
 PRERELEASE 0
 PRERELEASE_PATCH 0
diff --git a/tools/bots/cross-vm.py b/tools/bots/cross-vm.py
index 9865547..461123b 100644
--- a/tools/bots/cross-vm.py
+++ b/tools/bots/cross-vm.py
@@ -68,8 +68,7 @@
   test_py = os.path.join('tools', 'test.py')
   test_args = [sys.executable, test_py, '--progress=line', '--report',
                '--time', '--compiler=none', '--runtime=vm', '--write-debug-log',
-               '--write-test-outcome-log', '--mode=' + mode, '--arch=' + arch,
-               '--exclude-suite=pkg']
+               '--write-test-outcome-log', '--mode=' + mode, '--arch=' + arch]
   if total_shards and shard_index:
     test_args.append('--shards=%s' % total_shards)
     test_args.append('--shard=%s' % shard_index)
diff --git a/tools/bots/dart_sdk.py b/tools/bots/dart_sdk.py
index 588061a..3b70f46 100644
--- a/tools/bots/dart_sdk.py
+++ b/tools/bots/dart_sdk.py
@@ -22,26 +22,14 @@
 
 def BuildSDK():
   with bot.BuildStep('Build SDK'):
-    sysroot_env =  dict(os.environ)
     if BUILD_OS == 'linux':
-      ia32root = os.path.join(bot_utils.DART_DIR, '..', 'sysroots',
-                              'build', 'linux', 'debian_wheezy_i386-sysroot')
-      sysroot_env['CXXFLAGS'] = ("--sysroot=%s -I=/usr/include/c++/4.6 "
-               "-I=/usr/include/c++/4.6/i486-linux-gnu") % ia32root
-      sysroot_env['LDFLAGS'] = '--sysroot=%s' % ia32root
-      sysroot_env['CFLAGS'] = '--sysroot=%s' % ia32root
+      sysroot_env = dict(os.environ)
+      sysroot_env['DART_USE_WHEEZY'] = '1'
+      Run([sys.executable, './tools/generate_buildfiles.py'], env=sysroot_env)
     Run([sys.executable, './tools/build.py', '--mode=release',
-         '--arch=ia32', 'create_sdk'], env=sysroot_env)
-
-    x64root = os.path.join(bot_utils.DART_DIR, '..', 'sysroots', 'build',
-                           'linux', 'debian_wheezy_amd64-sysroot')
-    if BUILD_OS == 'linux':
-      sysroot_env['CXXFLAGS'] = ("--sysroot=%s -I=/usr/include/c++/4.6 "
-              "-I=/usr/include/c++/4.6/x86_64-linux-gnu") % x64root
-      sysroot_env['LDFLAGS'] = '--sysroot=%s' % x64root
-      sysroot_env['CFLAGS'] = '--sysroot=%s' % x64root
+         '--arch=ia32', 'create_sdk'])
     Run([sys.executable, './tools/build.py', '--mode=release',
-         '--arch=x64', 'create_sdk'], env=sysroot_env)
+         '--arch=x64', 'create_sdk'])
 
 def BuildDartdocAPIDocs(dirname):
   dart_sdk = os.path.join(bot_utils.DART_DIR,
diff --git a/tools/bots/ddc_tests.py b/tools/bots/ddc_tests.py
index fc6830f..5d66bef 100644
--- a/tools/bots/ddc_tests.py
+++ b/tools/bots/ddc_tests.py
@@ -22,11 +22,13 @@
 
 if __name__ == '__main__':
   with utils.ChangedWorkingDirectory('pkg/dev_compiler'):
-    with bot.BuildStep('npm install'):
-      bot.RunProcess(['npm', 'install'])
+    dart_exe = utils.CheckedInSdkExecutable()
 
-    with bot.BuildStep('Compile tests and run unit tests'):
-      bot.RunProcess([utils.CheckedInSdkExecutable(), 'test/all_tests.dart'])
+    # These two calls mirror pkg/dev_compiler/tool/test.sh.
+    bot.RunProcess([dart_exe, 'tool/build_pkgs.dart', 'test'])
+    bot.RunProcess([dart_exe, 'test/all_tests.dart'])
 
-    with bot.BuildStep('Execute compiled tests'):
-      bot.RunProcess(['npm', 'test'])
+    # TODO(vsm): Our bots do not have node / npm installed.
+    # These mirror pkg/dev_compiler/tool/browser_test.sh.
+    # bot.RunProcess(['npm', 'install'])
+    # bot.RunProcess(['npm', 'test'], {'CHROME_BIN': 'chrome'})
diff --git a/tools/bots/gn_build.py b/tools/bots/gn_build.py
index 0fe2298..4518c99 100644
--- a/tools/bots/gn_build.py
+++ b/tools/bots/gn_build.py
@@ -14,7 +14,7 @@
 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..', '..'))
 
 def main(argv):
-  os.environ["DART_USE_GN"] = "1"
+  os.environ["DART_USE_GYP"] = "1"
   generate_buildfiles = os.path.join(
       DART_ROOT, 'tools', 'generate_buildfiles.py')
   gclient_result = subprocess.call(['python', generate_buildfiles])
diff --git a/tools/bots/gn_tests.py b/tools/bots/gn_tests.py
index 1f44d69..2c4b428 100755
--- a/tools/bots/gn_tests.py
+++ b/tools/bots/gn_tests.py
@@ -16,7 +16,7 @@
 def main(argv):
   test_py = os.path.join(DART_ROOT, 'tools', 'test.py')
   build_result = subprocess.call(
-      ['python', test_py, '--builder-tag=no_ipv6', '--exclude-suite=pkg']
+      ['python', test_py, '--builder-tag=no_ipv6']
       + argv[1:])
   if build_result != 0:
     return build_result
diff --git a/tools/build.py b/tools/build.py
index 4f5d2e1..48062b3 100755
--- a/tools/build.py
+++ b/tools/build.py
@@ -44,11 +44,11 @@
 
 unless you really intend to use a non-default Makefile.""" % DART_ROOT
 
-DART_USE_GN = "DART_USE_GN"
+DART_USE_GYP = "DART_USE_GYP"
 
 
-def use_gn():
-  return DART_USE_GN in os.environ
+def use_gyp():
+  return DART_USE_GYP in os.environ
 
 
 def BuildOptions():
@@ -84,9 +84,9 @@
       help='Name of the devenv.com/msbuild executable on Windows (varies for '
            'different versions of Visual Studio)',
       default=vs_executable)
-  result.add_option("--gn",
-      help='Build with GN/Ninja',
-      default=use_gn(),
+  result.add_option("--gyp",
+      help='Build with gyp.',
+      default=use_gyp(),
       action='store_true')
   return result
 
@@ -114,7 +114,7 @@
   for arch in options.arch:
     archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6',
              'simarmv5te', 'armv5te', 'simmips', 'mips', 'simarm64', 'arm64',
-             'simdbc', 'simdbc64', 'armsimdbc']
+             'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64']
     if not arch in archs:
       print "Unknown arch %s" % arch
       return False
@@ -416,13 +416,63 @@
     print ("Tried to run GN, but it failed. Try running it manually: \n\t$ " +
            ' '.join(gn_command))
 
+
+def ShouldRunGN(out_dir):
+  return (not os.path.exists(out_dir) or
+          not os.path.isfile(os.path.join(out_dir, 'args.gn')))
+
+
+def UseGoma(out_dir):
+  args_gn = os.path.join(out_dir, 'args.gn')
+  return 'use_goma = true' in open(args_gn, 'r').read()
+
+
+# Try to start goma, but don't bail out if we can't. Instead print an error
+# message, and let the build fail with its own error messages as well.
+def EnsureGomaStarted(out_dir):
+  args_gn_path = os.path.join(out_dir, 'args.gn')
+  goma_dir = None
+  with open(args_gn_path, 'r') as fp:
+    for line in fp:
+      if 'goma_dir' in line:
+        words = line.split()
+        goma_dir = words[2][1:-1]  # goma_dir = "/path/to/goma"
+  if not goma_dir:
+    print 'Could not find goma for ' + out_dir
+    return False
+  if not os.path.exists(goma_dir) or not os.path.isdir(goma_dir):
+    print 'Could not find goma at ' + goma_dir
+    return False
+  goma_ctl = os.path.join(goma_dir, 'goma_ctl.py')
+  goma_ctl_command = [
+    'python',
+    goma_ctl,
+    'ensure_start',
+  ]
+  process = subprocess.Popen(goma_ctl_command)
+  process.wait()
+  if process.returncode != 0:
+    print ("Tried to run goma_ctl.py, but it failed. Try running it manually: "
+           + "\n\t" + ' '.join(goma_ctl_command))
+    return False
+  return True
+
+
+
 def BuildNinjaCommand(options, target, target_os, mode, arch):
   out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os)
-  if not os.path.exists(out_dir):
+  if ShouldRunGN(out_dir):
     RunGN(target_os, mode, arch)
   command = ['ninja', '-C', out_dir]
   if options.verbose:
     command += ['-v']
+  if UseGoma(out_dir):
+    if EnsureGomaStarted(out_dir):
+      command += ['-j1000']
+    else:
+      # If we couldn't ensure that goma is started, let the build start, but
+      # slowly so we can see any helpful error messages that pop out.
+      command += ['-j1']
   command += [target]
   return command
 
@@ -433,7 +483,7 @@
   start_time = time.time()
   args = []
   build_config = utils.GetBuildConf(mode, arch, target_os)
-  if options.gn:
+  if not options.gyp:
     args = BuildNinjaCommand(options, target, target_os, mode, arch)
   else:
     os.environ['DART_BUILD_MODE'] = mode
@@ -442,6 +492,8 @@
       project_file = 'dart.xcodeproj'
       if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()):
         project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName()
+      if target == 'all':
+        target = 'All'
       args = ['xcodebuild',
               '-project',
               project_file,
@@ -577,10 +629,7 @@
     return 1
   # Determine which targets to build. By default we build the "all" target.
   if len(args) == 0:
-    if HOST_OS == 'macos':
-      targets = ['All']
-    else:
-      targets = ['all']
+    targets = ['all']
   else:
     targets = args
 
diff --git a/tools/create_pkg_manifest.py b/tools/create_pkg_manifest.py
new file mode 100755
index 0000000..bc450bc
--- /dev/null
+++ b/tools/create_pkg_manifest.py
@@ -0,0 +1,108 @@
+#!/usr/bin/env python
+# Copyright 2016 The Dart project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Usage: create_pkg_manifest.py --deps <DEPS file> --output <jiri manifest>
+#
+# This script parses the DEPS file, extracts dependencies that live under
+# third_party/pkg, and writes them to a file suitable for consumption as a
+# jiri manifest for Fuchsia. It is assumed that the Dart tree is under
+# //dart in the Fuchsia world, and so the dependencies extracted by this script
+# will go under //dart/third_party/pkg.
+
+import argparse
+import os
+import sys
+import utils
+
+SCRIPT_DIR = os.path.dirname(sys.argv[0])
+DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
+
+# Used in parsing the DEPS file.
+class VarImpl(object):
+  def __init__(self, local_scope):
+    self._local_scope = local_scope
+
+  def Lookup(self, var_name):
+    """Implements the Var syntax."""
+    if var_name in self._local_scope.get("vars", {}):
+      return self._local_scope["vars"][var_name]
+    raise Exception("Var is not defined: %s" % var_name)
+
+
+def ParseDepsFile(deps_file):
+  local_scope = {}
+  var = VarImpl(local_scope)
+  global_scope = {
+    'Var': var.Lookup,
+    'deps_os': {},
+  }
+  # Read the content.
+  with open(deps_file, 'r') as fp:
+    deps_content = fp.read()
+
+  # Eval the content.
+  exec(deps_content, global_scope, local_scope)
+
+  # Extract the deps and filter.
+  deps = local_scope.get('deps', {})
+  filtered_deps = {}
+  for k, v in deps.iteritems():
+    if 'sdk/third_party/pkg' in k:
+      new_key = k.replace('sdk', 'dart', 1)
+      filtered_deps[new_key] = v
+
+  return filtered_deps
+
+
+def WriteManifest(deps, manifest_file):
+  project_template = """
+    <project name="%s"
+             path="%s"
+             remote="%s"
+             revision="%s"/>
+"""
+  warning = ('<!-- This file is generated by '
+             '//dart/tools/create_pkg_manifest.py. DO NOT EDIT -->\n')
+  with open(manifest_file, 'w') as manifest:
+    manifest.write('<?xml version="1.0" encoding="UTF-8"?>\n')
+    manifest.write(warning)
+    manifest.write('<manifest>\n')
+    manifest.write('  <projects>\n')
+    for path, remote in sorted(deps.iteritems()):
+      remote_components = remote.split('@')
+      remote_url = remote_components[0]
+      remote_version = remote_components[1]
+      manifest.write(
+          project_template % (path, path, remote_url, remote_version))
+    manifest.write('  </projects>\n')
+    manifest.write('</manifest>\n')
+
+
+def ParseArgs(args):
+  args = args[1:]
+  parser = argparse.ArgumentParser(
+      description='A script to generate a jiri manifest for third_party/pkg.')
+
+  parser.add_argument('--deps', '-d',
+      type=str,
+      help='Input DEPS file.',
+      default=os.path.join(DART_ROOT, 'DEPS'))
+  parser.add_argument('--output', '-o',
+      type=str,
+      help='Output jiri manifest.',
+      default=os.path.join(DART_ROOT, 'dart_third_party_pkg.manifest'))
+
+  return parser.parse_args(args)
+
+
+def Main(argv):
+  args = ParseArgs(argv)
+  deps = ParseDepsFile(args.deps)
+  WriteManifest(deps, args.output)
+  return 0
+
+
+if __name__ == '__main__':
+  sys.exit(Main(sys.argv))
diff --git a/tools/create_sdk.py b/tools/create_sdk.py
index 160844c..f461d3b 100755
--- a/tools/create_sdk.py
+++ b/tools/create_sdk.py
@@ -93,6 +93,9 @@
       help='Where to output the sdk')
   options.add_option("--snapshot_location",
       help='Location of the snapshots.')
+  options.add_option("--copy_libs",
+      action="store_true", default=False,
+      help='Copy dynamically linked libraries to the SDK bin directory.')
   return options.parse_args()
 
 
@@ -131,6 +134,20 @@
   Copy(src, dest)
 
 
+def CopyLibs(out_dir, bin_dir):
+  for library in ['libcrypto', 'libssl']:
+    ext = '.so'
+    if HOST_OS == 'macos':
+      ext = '.dylib'
+    elif HOST_OS == 'win32':
+      ext = '.dll'
+    src = os.path.join(out_dir, library + ext)
+    dst = os.path.join(bin_dir, library + ext)
+    if os.path.isfile(src):
+      copyfile(src, dst)
+      copymode(src, dst)
+
+
 def CopyDartScripts(home, sdk_root):
   for executable in ['dart2js_sdk', 'dartanalyzer_sdk', 'dartfmt_sdk',
                      'pub_sdk', 'dartdoc', 'dartdevc_sdk']:
@@ -313,6 +330,9 @@
   CopyAnalysisSummaries(SNAPSHOT, LIB)
   CopyDevCompilerSdk(HOME, LIB)
 
+  if options.copy_libs:
+    CopyLibs(build_dir, BIN)
+
   # Write the 'version' file
   version = utils.GetVersion()
   versionFile = open(os.path.join(SDK_tmp, 'version'), 'w')
diff --git a/tools/create_timestamp_file.py b/tools/create_timestamp_file.py
old mode 100644
new mode 100755
index 7a1d4d3..0a97edc
--- a/tools/create_timestamp_file.py
+++ b/tools/create_timestamp_file.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python
 # 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.
diff --git a/tools/deps/dartium.deps/DEPS b/tools/deps/dartium.deps/DEPS
index c1a89e7..91c3241 100644
--- a/tools/deps/dartium.deps/DEPS
+++ b/tools/deps/dartium.deps/DEPS
@@ -9,7 +9,7 @@
 
 vars.update({
   "dartium_chromium_commit": "7558afb6379171d7f96b2db68ae9d2b64b2c5544",
-  "dartium_webkit_commit": "e46ac6cf905ae6be30852fbee231cfd385c24420",
+  "dartium_webkit_commit": "8c167a4ffeaa5402dde4d9e113bb272b2e4640d2",
   "chromium_base_revision": "338390",
 
   # We use mirrors of all github repos to guarantee reproducibility and
@@ -47,11 +47,11 @@
   "oauth2_rev": "@1bff41f4d54505c36f2d1a001b83b8b745c452f5",
   "observatory_pub_packages_rev": "@26aad88f1c1915d39bbcbff3cad589e2402fdcf1",
   "package_config_rev": "@0.1.3",
-  "package_resolver_tag": "@1.0.2",
+  "package_resolver_tag": "@1.0.2+1",
   "path_rev": "@b657c0854d1cf41c014986fa9d2321f1173df805",
   "plugin_tag": "@0.1.0",
   "pool_rev": "@22e12aeb16ad0b626900dbe79e4a25391ddfb28c",
-  "pub_rev": "@9d707158fedc86fc2b02f62cdfe804902b098d9d",
+  "pub_rev": "@d7649be15213c43669a40c33af516d8eb210e876",
   "pub_semver_tag": "@1.2.0",
   "quiver_tag": "@0.21.4",
   "root_certificates_rev": "@aed07942ce98507d2be28cbd29e879525410c7fc",
@@ -69,7 +69,7 @@
   "web_components_rev": "@6349e09f9118dce7ae1b309af5763745e25a9d61",
   "WebCore_rev": "@a86fe28efadcfc781f836037a80f27e22a5dad17",
 
-  "co19_rev": "@f05d5aee5930bfd487aedf832fbd7b832f502b15",
+  "co19_rev": "@cf831f58ac65f68f14824c0b1515f6b7814d94b8",
 })
 
 deps.update({
diff --git a/tools/dom/scripts/css_code_generator.py b/tools/dom/scripts/css_code_generator.py
index ef7555a..b3b9f21 100644
--- a/tools/dom/scripts/css_code_generator.py
+++ b/tools/dom/scripts/css_code_generator.py
@@ -112,6 +112,11 @@
     return style;
   }
 
+  /// Returns the value of the property if the provided *CSS* property
+  /// name is supported on this element and if the value is set. Otherwise
+  /// returns an empty string.
+  ///
+  /// Please note the property name uses camelCase, not-hyphens.
   String getPropertyValue(String propertyName) {
     var propValue = _getPropertyValueHelper(propertyName);
     return propValue != null ? propValue : '';
diff --git a/tools/dom/scripts/generate_blink_file.py b/tools/dom/scripts/generate_blink_file.py
index dee266c..2b119ed 100644
--- a/tools/dom/scripts/generate_blink_file.py
+++ b/tools/dom/scripts/generate_blink_file.py
@@ -96,8 +96,10 @@
  */
 library dart.dom._blink;
 
+import 'dart:async';
 import 'dart:js' as js;
 import 'dart:html' show DomException;
+import 'dart:_internal' as internal;
 // This is a place to put custom renames if we need them.
 final resolverMap = {
 };
@@ -127,6 +129,15 @@
 
   static register(document, tag, customType, extendsTagName) native "Utils_register";
 
+  // Below code sets up VMLibraryHooks for resolvePackageUri.
+  static Uri resolvePackageUri(Uri packageUri) native "Utils_resolvePackageUri";
+  static Future<Uri> _resolvePackageUriFuture(Uri packageUri) async {
+      return resolvePackageUri(packageUri);
+  }
+  static void _setupHooks() {
+    internal.VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture;
+  }
+
   // Defines an interceptor if there is an appropriate JavaScript prototype to define it on.
   // In any case, returns a typed JS wrapper compatibile with dart:html and the new
   // typed JS Interop.
diff --git a/tools/dom/src/EventStreamProvider.dart b/tools/dom/src/EventStreamProvider.dart
index 474a143..9a75afd 100644
--- a/tools/dom/src/EventStreamProvider.dart
+++ b/tools/dom/src/EventStreamProvider.dart
@@ -226,13 +226,21 @@
   EventListener _onData;
   final bool _useCapture;
 
-  // TODO(jacobr): for full strong mode correctness we should write
-  // _onData = onData == null ? null : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
-  // but that breaks 114 co19 tests as well as multiple html tests as it is reasonable
-  // to pass the wrong type of event object to an event listener as part of a
-  // test.
+  // TODO(leafp): It would be better to write this as
+  // _onData = onData == null ? null :
+  //   onData is _wrapZoneCallback<Event, dynamic>
+  //     ? _wrapZone/*<Event, dynamic>*/(onData)
+  //     : _wrapZone/*<Event, dynamic>*/((e) => onData(e as T))
+  // In order to support existing tests which pass the wrong type of events but
+  // use a more general listener, without causing as much slowdown for things
+  // which are typed correctly.  But this currently runs afoul of restrictions
+  // on is checks for compatibility with the VM.
   _EventStreamSubscription(this._target, this._eventType, void onData(T event),
-      this._useCapture) : _onData = _wrapZone/*<Event, dynamic>*/(onData) {
+                           this._useCapture) :
+      _onData = onData == null
+      ? null
+      : _wrapZone/*<Event, dynamic>*/((e) => (onData as dynamic)(e))
+  {
     _tryResume();
   }
 
diff --git a/tools/dom/src/dart2js_CssClassSet.dart b/tools/dom/src/dart2js_CssClassSet.dart
index 087685f..758419d 100644
--- a/tools/dom/src/dart2js_CssClassSet.dart
+++ b/tools/dom/src/dart2js_CssClassSet.dart
@@ -140,6 +140,7 @@
     return value is String && _classListContains(_classListOf(_element), value);
   }
 
+  @ForceInline()
   static bool _add(Element _element, String value) {
     DomTokenList list = _classListOf(_element);
     // Compute returned result independently of action upon the set.
@@ -148,6 +149,7 @@
     return added;
   }
 
+  @ForceInline()
   static bool _remove(Element _element, String value) {
     DomTokenList list = _classListOf(_element);
     bool removed = _classListContainsBeforeAddOrRemove(list, value);
diff --git a/tools/dom/src/shared_html.dart b/tools/dom/src/shared_html.dart
index 7342cdf..b76b37b 100644
--- a/tools/dom/src/shared_html.dart
+++ b/tools/dom/src/shared_html.dart
@@ -12,23 +12,13 @@
   // For performance reasons avoid wrapping if we are in the root zone.
   if (Zone.current == Zone.ROOT) return callback;
   if (callback == null) return null;
-  // TODO(jacobr): we cast to _wrapZoneCallback/*<A, R>*/ to hack around missing
-  // generic method support in zones.
-  // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
-  _wrapZoneCallback/*<A, R>*/ wrapped =
-      Zone.current.bindUnaryCallback(callback, runGuarded: true);
-  return wrapped;
+  return Zone.current.bindUnaryCallback/*<R, A>*/(callback, runGuarded: true);
 }
 
 _wrapZoneBinaryCallback/*<A, B, R>*/ _wrapBinaryZone/*<A, B, R>*/(_wrapZoneBinaryCallback/*<A, B, R>*/ callback) {
   if (Zone.current == Zone.ROOT) return callback;
   if (callback == null) return null;
-  // We cast to _wrapZoneBinaryCallback/*<A, B, R>*/ to hack around missing
-  // generic method support in zones.
-  // ignore: STRONG_MODE_DOWN_CAST_COMPOSITE
-  _wrapZoneBinaryCallback/*<A, B, R>*/ wrapped =
-      Zone.current.bindBinaryCallback(callback, runGuarded: true);
-  return wrapped;
+  return Zone.current.bindBinaryCallback/*<R, A, B>*/(callback, runGuarded: true);
 }
 
 /**
diff --git a/tools/dom/templates/html/impl/impl_Blob.darttemplate b/tools/dom/templates/html/impl/impl_Blob.darttemplate
index e2617c2..8cf70b9 100644
--- a/tools/dom/templates/html/impl/impl_Blob.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Blob.darttemplate
@@ -20,8 +20,8 @@
     return _create_2(blobParts, bag);
   }
 
-  static _create_1(parts) => JS('Blob', 'new Blob(#)', parts);
-  static _create_2(parts, bag) => JS('Blob', 'new Blob(#, #)', parts, bag);
+  static _create_1(parts) => JS('Blob', 'new self.Blob(#)', parts);
+  static _create_2(parts, bag) => JS('Blob', 'new self.Blob(#, #)', parts, bag);
 
   static _create_bag() => JS('var', '{}');
   static _bag_set(bag, key, value) { JS('void', '#[#] = #', bag, key, value); }
diff --git a/tools/download_prebuilt_sdk.py b/tools/download_prebuilt_sdk.py
new file mode 100755
index 0000000..f3c4385
--- /dev/null
+++ b/tools/download_prebuilt_sdk.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# Copyright 2016 The Dart project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import subprocess
+import sys
+import tarfile
+import urllib
+import utils
+
+HOST_OS = utils.GuessOS()
+HOST_ARCH = utils.GuessArchitecture()
+SCRIPT_DIR = os.path.dirname(sys.argv[0])
+DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
+
+BUCKET_NAME = 'dart-dependencies'
+
+def host_os_for_sdk(host_os):
+  if host_os.startswith('macos'):
+    return 'mac'
+  if host_os.startswith('win'):
+    return 'win'
+  return host_os
+
+def main(argv):
+  host_os = host_os_for_sdk(HOST_OS)
+  sdk_path = os.path.join(DART_ROOT, 'tools', 'sdks', host_os)
+  stamp_path = os.path.join(sdk_path, 'dart-sdk.tar.gz.stamp')
+  sha_path = os.path.join(sdk_path, 'dart-sdk.tar.gz.sha1')
+  tgz_path = os.path.join(sdk_path, 'dart-sdk.tar.gz')
+
+  stamp = ''
+  if os.path.isfile(stamp_path):
+    with open(stamp_path, 'r') as fp:
+      stamp = fp.read()
+
+  with open(sha_path, 'r') as fp:
+    sha = fp.read()
+
+  if stamp != sha:
+    url = ('https://%s.storage.googleapis.com/%s' % (BUCKET_NAME, sha))
+    print 'Downloading prebuilt Dart SDK from: ' + url
+    urllib.urlretrieve(url, tgz_path)
+    with tarfile.open(tgz_path) as tar:
+      tar.extractall(sdk_path)
+    with open(stamp_path, 'w') as fp:
+      fp.write(sha)
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv))
diff --git a/tools/gen_fuchsia_test_manifest.py b/tools/gen_fuchsia_test_manifest.py
new file mode 100755
index 0000000..7993178
--- /dev/null
+++ b/tools/gen_fuchsia_test_manifest.py
@@ -0,0 +1,92 @@
+#!/usr/bin/env python
+# Copyright 2017 The Dart project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This script creates a qemu image manifest for Fuchsia that contains the
+# Dart tree. In particular in contains Dart's test suite, and test harness.
+
+import argparse
+import json
+import os
+import sys
+import utils
+
+SCRIPT_DIR = os.path.dirname(sys.argv[0])
+DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
+FUCHSIA_ROOT= os.path.realpath(os.path.join(DART_ROOT, '..'))
+
+FUCHSIA_TEST_MANIFEST_PREFIX = os.path.join('test', 'dart')
+
+EXCLUDE_DIRS = [ '.git', 'out', '.jiri' ]
+
+BINARY_FILES = [ 'dart', 'run_vm_tests', 'process_test' ]
+
+def parse_args(args):
+  args = args[1:]
+  parser = argparse.ArgumentParser(
+      description='A script that generates Dart/Fuchsia test commands.')
+
+  parser.add_argument('--arch', '-a',
+      type=str,
+      help='Target architectures (comma-separated).',
+      metavar='[x64]',
+      default='x64')
+  parser.add_argument('--mode', '-m',
+      type=str,
+      help='Build variant',
+      metavar='[debug,release]',
+      default='debug')
+  parser.add_argument('--output', '-o',
+      type=str,
+      help='Path to output file prefix.')
+  parser.add_argument('--user-manifest', '-u',
+      type=str,
+      help='Path to base userspace manifest.')
+  parser.add_argument("-v", "--verbose",
+      help='Verbose output.',
+      default=False,
+      action="store_true")
+
+  return parser.parse_args(args)
+
+
+def fuchsia_arch(arch):
+  if arch is 'x64':
+    return 'x86-64'
+  return None
+
+
+def main(argv):
+  args = parse_args(argv)
+
+  manifest_output = args.output + '.manifest'
+  with open(manifest_output, 'w') as manifest:
+    # First copy the main user manifest.
+    with open(args.user_manifest, 'r') as user_manifest:
+      for line in user_manifest:
+        if '=' in line:
+          manifest.write(line)
+
+    # Now, write the Dart tree.
+    for root, dirs, files in os.walk(DART_ROOT):
+      dirs[:] = [d for d in dirs if d not in EXCLUDE_DIRS]
+      for file in files:
+        filepath = os.path.join(root, file)
+        relpath = filepath[len(DART_ROOT) + 1:]
+        fuchsiapath = os.path.join(FUCHSIA_TEST_MANIFEST_PREFIX, relpath)
+        manifest.write('%s=%s\n' % (fuchsiapath, os.path.join(root, file)))
+
+    dart_conf = utils.GetBuildConf(args.mode, args.arch)
+    dart_out = os.path.join(FUCHSIA_TEST_MANIFEST_PREFIX, 'out', dart_conf)
+    fuchsia_conf = '%s-%s' % (args.mode, fuchsia_arch(args.arch))
+    fuchsia_out = os.path.join(FUCHSIA_ROOT, 'out', fuchsia_conf)
+    for file in BINARY_FILES:
+      manifest.write('%s=%s\n' % (os.path.join(dart_out, file),
+                                  os.path.join(fuchsia_out, file)))
+
+  return 0
+
+
+if __name__ == '__main__':
+  sys.exit(main(sys.argv))
diff --git a/tools/generate_buildfiles.py b/tools/generate_buildfiles.py
old mode 100644
new mode 100755
index 9aa26e7..b6be5a4
--- a/tools/generate_buildfiles.py
+++ b/tools/generate_buildfiles.py
@@ -11,12 +11,12 @@
 
 SCRIPT_DIR = os.path.dirname(sys.argv[0])
 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
-DART_USE_GN = "DART_USE_GN"
+DART_USE_GYP = "DART_USE_GYP"
 DART_DISABLE_BUILDFILES = "DART_DISABLE_BUILDFILES"
 
 
-def use_gn():
-  return DART_USE_GN in os.environ
+def use_gyp():
+  return DART_USE_GYP in os.environ
 
 
 def disable_buildfiles():
@@ -29,21 +29,26 @@
   return process.returncode
 
 
-def run_gn():
+def run_gn(options):
   gn_command = [
     'python',
     os.path.join(DART_ROOT, 'tools', 'gn.py'),
     '-m', 'all',
     '-a', 'all',
   ]
+  if options.verbose:
+    gn_command.append('-v')
+    print ' '.join(gn_command)
   return execute(gn_command)
 
 
-def run_gyp():
+def run_gyp(options):
   gyp_command = [
     'python',
     os.path.join(DART_ROOT, 'tools', 'gyp_dart.py'),
   ]
+  if options.verbose:
+    print ' '.join(gyp_command)
   return execute(gyp_command)
 
 
@@ -58,17 +63,17 @@
       action="store_true")
   parser.add_argument("--gn",
       help='Use GN',
-      default=use_gn(),
+      default=not use_gyp(),
       action='store_true')
   parser.add_argument("--gyp",
       help='Use gyp',
-      default=not use_gn(),
+      default=use_gyp(),
       action='store_true')
 
   options = parser.parse_args(args)
-  # If gn is enabled one way or another, then disable gyp
-  if options.gn:
-    options.gyp = False
+  # If gyp is enabled one way or another, then disable gn
+  if options.gyp:
+    options.gn = False
   return options
 
 
@@ -78,9 +83,9 @@
     return 0
   options = parse_args(argv)
   if options.gn:
-    return run_gn()
+    return run_gn(options)
   else:
-    return run_gyp()
+    return run_gyp(options)
 
 
 if __name__ == '__main__':
diff --git a/tools/gn.py b/tools/gn.py
index fd9a1b7..b30d774 100755
--- a/tools/gn.py
+++ b/tools/gn.py
@@ -16,6 +16,41 @@
 SCRIPT_DIR = os.path.dirname(sys.argv[0])
 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
 
+# Environment variables for default settings.
+DART_USE_ASAN = "DART_USE_ASAN"  # Use instead of --asan
+DART_USE_MSAN = "DART_USE_MSAN"  # Use instead of --msan
+DART_USE_TSAN = "DART_USE_TSAN"  # Use instead of --tsan
+DART_USE_WHEEZY = "DART_USE_WHEEZY"  # Use instread of --wheezy
+DART_USE_TOOLCHAIN = "DART_USE_TOOLCHAIN"  # Use instread of --toolchain-prefix
+DART_USE_SYSROOT = "DART_USE_SYSROOT"  # Use instead of --target-sysroot
+
+def use_asan():
+  return DART_USE_ASAN in os.environ
+
+
+def use_msan():
+  return DART_USE_MSAN in os.environ
+
+
+def use_tsan():
+  return DART_USE_TSAN in os.environ
+
+
+def use_wheezy():
+  return DART_USE_WHEEZY in os.environ
+
+
+def toolchain_prefix(args):
+  if args.toolchain_prefix:
+    return args.toolchain_prefix
+  return os.environ.get(DART_USE_TOOLCHAIN)
+
+
+def target_sysroot(args):
+  if args.target_sysroot:
+    return args.target_sysroot
+  return os.environ.get(DART_USE_SYSROOT)
+
 
 def get_out_dir(mode, arch, target_os):
   return utils.GetBuildRoot(HOST_OS, mode, arch, target_os)
@@ -31,9 +66,10 @@
 
 def host_cpu_for_arch(arch):
   if arch in ['ia32', 'arm', 'armv6', 'armv5te', 'mips',
-              'simarm', 'simarmv6', 'simarmv5te', 'simmips', 'simdbc']:
+              'simarm', 'simarmv6', 'simarmv5te', 'simmips', 'simdbc',
+              'armsimdbc']:
     return 'x86'
-  if arch in ['x64', 'arm64', 'simarm64', 'simdbc64']:
+  if arch in ['x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64']:
     return 'x64'
 
 
@@ -48,6 +84,10 @@
     return 'arm' if target_os == 'android' else 'x86'
   if arch == 'simdbc64':
     return 'arm64' if target_os == 'android' else 'x64'
+  if arch == 'armsimdbc':
+    return 'arm'
+  if arch == 'armsimdbc64':
+    return 'arm64'
   return arch
 
 
@@ -59,6 +99,16 @@
   return host_os
 
 
+# Where string_map is formatted as X1=Y1,X2=Y2 etc.
+# If key is X1, returns Y1.
+def parse_string_map(key, string_map):
+  for m in string_map.split(','):
+    l = m.split('=')
+    if l[0] == key:
+      return l[1]
+  return None
+
+
 def to_gn_args(args, mode, arch, target_os):
   gn_args = {}
 
@@ -85,17 +135,22 @@
   gn_args['dart_zlib_path'] = "//runtime/bin/zlib"
 
   # Use tcmalloc only when targeting Linux and when not using ASAN.
-  gn_args['dart_use_tcmalloc'] = (gn_args['target_os'] == 'linux'
-                                  and not args.asan)
+  gn_args['dart_use_tcmalloc'] = ((gn_args['target_os'] == 'linux')
+                                  and not args.asan
+                                  and not args.msan
+                                  and not args.tsan)
 
-  # Force -mfloat-abi=hard and -mfpu=neon on Linux as we're specifying
-  # a gnueabihf compiler in //build/toolchain/linux BUILD.gn.
-  # TODO(zra): This will likely need some adjustment to build for armv6 etc.
-  hard_float = (gn_args['target_cpu'].startswith('arm') and
-                gn_args['target_os'] == 'linux')
-  if hard_float:
-    gn_args['arm_float_abi'] = 'hard'
-    gn_args['arm_use_neon'] = True
+  if gn_args['target_os'] == 'linux':
+    if gn_args['target_cpu'] == 'arm':
+      # Force -mfloat-abi=hard and -mfpu=neon for arm on Linux as we're
+      # specifying a gnueabihf compiler in //build/toolchain/linux BUILD.gn.
+      gn_args['arm_arch'] = 'armv7'
+      gn_args['arm_float_abi'] = 'hard'
+      gn_args['arm_use_neon'] = True
+    elif gn_args['target_cpu'] == 'armv6':
+      raise Exception("GN support for armv6 unimplemented")
+    elif gn_args['target_cpu'] == 'armv5te':
+      raise Exception("GN support for armv5te unimplemented")
 
   gn_args['is_debug'] = mode == 'debug'
   gn_args['is_release'] = mode == 'release'
@@ -109,27 +164,34 @@
 
   # TODO(zra): Investigate using clang with these configurations.
   # Clang compiles tcmalloc's inline assembly for ia32 on Linux wrong, so we
-  # don't use clang in that configuration.
+  # don't use clang in that configuration. Thus, we use gcc for ia32 *unless*
+  # asan or tsan is specified.
   has_clang = (host_os != 'win'
                and args.os not in ['android']
-               and not (gn_args['target_os'] == 'linux' and
-                        gn_args['host_cpu'] == 'x86' and
-                        not args.asan)  # Use clang for asan builds.
                and not gn_args['target_cpu'].startswith('arm')
-               and not gn_args['target_cpu'].startswith('mips'))
+               and not gn_args['target_cpu'].startswith('mips')
+               and not ((gn_args['target_os'] == 'linux')
+                        and (gn_args['host_cpu'] == 'x86')
+                        and not args.asan
+                        and not args.msan
+                        and not args.tsan))  # Use clang for sanitizer builds.
   gn_args['is_clang'] = args.clang and has_clang
 
   gn_args['is_asan'] = args.asan and gn_args['is_clang']
+  gn_args['is_msan'] = args.msan and gn_args['is_clang']
+  gn_args['is_tsan'] = args.tsan and gn_args['is_clang']
 
   # Setup the user-defined sysroot.
   if gn_args['target_os'] == 'linux' and args.wheezy:
     gn_args['dart_use_wheezy_sysroot'] = True
   else:
-    if args.target_sysroot:
-      gn_args['target_sysroot'] = args.target_sysroot
+    sysroot = target_sysroot(args)
+    if sysroot:
+      gn_args['target_sysroot'] = parse_string_map(arch, sysroot)
 
-    if args.toolchain_prefix:
-      gn_args['toolchain_prefix'] = args.toolchain_prefix
+    toolchain = toolchain_prefix(args)
+    if toolchain:
+      gn_args['toolchain_prefix'] = parse_string_map(arch, toolchain)
 
   goma_dir = os.environ.get('GOMA_DIR')
   goma_home_dir = os.path.join(os.getenv('HOME', ''), 'goma')
@@ -143,6 +205,10 @@
     gn_args['use_goma'] = False
     gn_args['goma_dir'] = None
 
+  if args.debug_opt_level:
+    gn_args['dart_debug_optimization_level'] = args.debug_opt_level
+    gn_args['debug_optimization_level'] = args.debug_opt_level
+
   return gn_args
 
 
@@ -169,7 +235,7 @@
   for arch in args.arch:
     archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6',
              'simarmv5te', 'armv5te', 'simmips', 'mips', 'simarm64', 'arm64',
-             'simdbc', 'simdbc64', 'armsimdbc']
+             'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64']
     if not arch in archs:
       print "Unknown arch %s" % arch
       return False
@@ -207,84 +273,97 @@
     return '--ide=json'
 
 
-# Environment variables for default settings.
-DART_USE_ASAN = "DART_USE_ASAN"
-DART_USE_WHEEZY = "DART_USE_WHEEZY"
-
-def use_asan():
-  return DART_USE_ASAN in os.environ
-
-
-def use_wheezy():
-  return DART_USE_WHEEZY in os.environ
-
-
 def parse_args(args):
   args = args[1:]
-  parser = argparse.ArgumentParser(description='A script to run `gn gen`.')
+  parser = argparse.ArgumentParser(
+      description='A script to run `gn gen`.',
+      formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+  common_group = parser.add_argument_group('Common Arguments')
+  other_group = parser.add_argument_group('Other Arguments')
 
-  parser.add_argument("-v", "--verbose",
-      help='Verbose output.',
-      default=False, action="store_true")
-  parser.add_argument('--mode', '-m',
-      type=str,
-      help='Build variants (comma-separated).',
-      metavar='[all,debug,release,product]',
-      default='debug')
-  parser.add_argument('--os',
-      type=str,
-      help='Target OSs (comma-separated).',
-      metavar='[all,host,android]',
-      default='host')
-  parser.add_argument('--arch', '-a',
+  common_group.add_argument('--arch', '-a',
       type=str,
       help='Target architectures (comma-separated).',
       metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,'
               'simmips,mips,simarm64,arm64,simdbc,armsimdbc]',
       default='x64')
-  parser.add_argument('--asan',
+  common_group.add_argument('--mode', '-m',
+      type=str,
+      help='Build variants (comma-separated).',
+      metavar='[all,debug,release,product]',
+      default='debug')
+  common_group.add_argument('--os',
+      type=str,
+      help='Target OSs (comma-separated).',
+      metavar='[all,host,android]',
+      default='host')
+  common_group.add_argument("-v", "--verbose",
+      help='Verbose output.',
+      default=False, action="store_true")
+
+  other_group.add_argument('--asan',
       help='Build with ASAN',
       default=use_asan(),
       action='store_true')
-  parser.add_argument('--no-asan',
+  other_group.add_argument('--no-asan',
       help='Disable ASAN',
       dest='asan',
       action='store_false')
-  parser.add_argument('--wheezy',
-      help='Use the Debian wheezy sysroot on Linux',
-      default=use_wheezy(),
-      action='store_true')
-  parser.add_argument('--no-wheezy',
-      help='Disable the Debian wheezy sysroot on Linux',
-      dest='wheezy',
-      action='store_false')
-  parser.add_argument('--goma',
-      help='Use goma',
-      default=True,
-      action='store_true')
-  parser.add_argument('--no-goma',
-      help='Disable goma',
-      dest='goma',
-      action='store_false')
-  parser.add_argument('--clang',
+  other_group.add_argument('--clang',
       help='Use Clang',
       default=True,
       action='store_true')
-  parser.add_argument('--no-clang',
+  other_group.add_argument('--no-clang',
       help='Disable Clang',
       dest='clang',
       action='store_false')
-  parser.add_argument('--ide',
+  other_group.add_argument('--debug-opt-level',
+      '-d',
+      help='The optimization level to use for debug builds',
+      type=str)
+  other_group.add_argument('--goma',
+      help='Use goma',
+      default=True,
+      action='store_true')
+  other_group.add_argument('--no-goma',
+      help='Disable goma',
+      dest='goma',
+      action='store_false')
+  other_group.add_argument('--ide',
       help='Generate an IDE file.',
       default=os_has_ide(HOST_OS),
       action='store_true')
-  parser.add_argument('--target-sysroot', '-s',
+  other_group.add_argument('--msan',
+      help='Build with MSAN',
+      default=use_msan(),
+      action='store_true')
+  other_group.add_argument('--no-msan',
+      help='Disable MSAN',
+      dest='msan',
+      action='store_false')
+  other_group.add_argument('--target-sysroot', '-s',
       type=str,
-      help='Path to the toolchain sysroot')
-  parser.add_argument('--toolchain-prefix', '-t',
+      help='Comma-separated list of arch=/path/to/sysroot mappings')
+  other_group.add_argument('--toolchain-prefix', '-t',
       type=str,
-      help='Path to the toolchain prefix')
-  parser.add_argument('--workers', '-w',
+      help='Comma-separated list of arch=/path/to/toolchain-prefix mappings')
+  other_group.add_argument('--tsan',
+      help='Build with TSAN',
+      default=use_tsan(),
+      action='store_true')
+  other_group.add_argument('--no-tsan',
+      help='Disable TSAN',
+      dest='tsan',
+      action='store_false')
+  other_group.add_argument('--wheezy',
+      help='Use the Debian wheezy sysroot on Linux',
+      default=use_wheezy(),
+      action='store_true')
+  other_group.add_argument('--no-wheezy',
+      help='Disable the Debian wheezy sysroot on Linux',
+      dest='wheezy',
+      action='store_false')
+  other_group.add_argument('--workers', '-w',
       type=int,
       help='Number of simultaneous GN invocations',
       dest='workers',
diff --git a/tools/gyp/all.gypi b/tools/gyp/all.gypi
index 980b5c5..1db7dea 100644
--- a/tools/gyp/all.gypi
+++ b/tools/gyp/all.gypi
@@ -16,6 +16,8 @@
     'asan%': 0,
     # Flag that tells us whether this is a MSAN build.
     'msan%': 0,
+    # Flag that teslls us whether this is a TSAN build.
+    'tsan%': 0,
   },
   'conditions': [
     [ 'OS=="linux"', {
diff --git a/tools/list_dart_files.py b/tools/list_dart_files.py
index 60d2295..7a9ee8a 100755
--- a/tools/list_dart_files.py
+++ b/tools/list_dart_files.py
@@ -5,8 +5,12 @@
 
 """Tool for listing Dart source files.
 
+If the first argument is 'relative', the script produces paths relative to the
+current working directory. If the first argument is 'absolute', the script
+produces absolute paths.
+
 Usage:
-  python tools/list_dart_files.py <directory> <root directory pattern>
+  python tools/list_dart_files.py {absolute, relative} <directory> <pattern>
 """
 
 import os
@@ -15,11 +19,16 @@
 
 
 def main(argv):
-  directory = argv[1]
+  mode = argv[1]
+  if mode not in ['absolute', 'relative']:
+    raise Exception("First argument must be 'absolute' or 'relative'")
+  directory = argv[2]
+  if mode in 'absolute' and not os.path.isabs(directory):
+    directory = os.path.realpath(directory)
 
   pattern = None
-  if len(argv) > 2:
-    pattern = re.compile(argv[2])
+  if len(argv) > 3:
+    pattern = re.compile(argv[3])
 
   for root, directories, files in os.walk(directory):
     # We only care about actual source files, not generated code or tests.
@@ -34,7 +43,10 @@
 
     for filename in files:
       if filename.endswith('.dart') and not filename.endswith('_test.dart'):
-        fullname = os.path.relpath(os.path.join(root, filename))
+        if mode in 'absolute':
+          fullname = os.path.join(directory, root, filename)
+        else:
+          fullname = os.path.relpath(os.path.join(root, filename))
         fullname = fullname.replace(os.sep, '/')
         print fullname
 
diff --git a/tools/list_files.py b/tools/list_files.py
index ad277e8..b63d6ab 100755
--- a/tools/list_files.py
+++ b/tools/list_files.py
@@ -5,8 +5,12 @@
 
 """Tool for listing files whose name match a pattern.
 
+If the first argument is 'relative', the script produces paths relative to the
+current working directory. If the first argument is 'absolute', the script
+produces absolute paths.
+
 Usage:
-  python tools/list_files.py PATTERN DIRECTORY...
+  python tools/list_files.py {absolute, relative} PATTERN DIRECTORY...
 """
 
 import os
@@ -15,13 +19,21 @@
 
 
 def main(argv):
-  pattern = re.compile(argv[1])
-  for directory in argv[2:]:
+  mode = argv[1]
+  if mode not in ['absolute', 'relative']:
+    raise Exception("First argument must be 'absolute' or 'relative'")
+  pattern = re.compile(argv[2])
+  for directory in argv[3:]:
+    if mode in 'absolute' and not os.path.isabs(directory):
+      directory = os.path.realpath(directory)
     for root, directories, files in os.walk(directory):
       if '.git' in directories:
         directories.remove('.git')
       for filename in files:
-        fullname = os.path.relpath(os.path.join(root, filename))
+        if mode in 'absolute':
+          fullname = os.path.join(directory, root, filename)
+        else:
+          fullname = os.path.relpath(os.path.join(root, filename))
         fullname = fullname.replace(os.sep, '/')
         if re.search(pattern, fullname):
           print fullname
diff --git a/tools/observatory_tool.py b/tools/observatory_tool.py
index f54c93d..e82c72c 100755
--- a/tools/observatory_tool.py
+++ b/tools/observatory_tool.py
@@ -38,6 +38,19 @@
 
 usage = """observatory_tool.py [options]"""
 
+# Run |command|. If its return code is 0, return 0 and swallow its output.
+# If its return code is non-zero, emit its output unless |always_silent| is
+# True, and return the return code.
+def RunCommand(command, always_silent=False):
+  try:
+    subprocess.check_output(command, stderr=subprocess.STDOUT)
+    return 0
+  except subprocess.CalledProcessError as e:
+    if not always_silent:
+      print ("Command failed: " + ' '.join(command) + "\n" +
+              "output: " + e.output)
+    return e.returncode
+
 def CreateTimestampFile(options):
   if options.stamp != '':
     dir_name = os.path.dirname(options.stamp)
@@ -75,45 +88,41 @@
     print "--sdk expects 'True' or 'False' argument."
     return False
 
-  with open(os.devnull, 'wb') as silent_sink:
-    # Required options.
-    if options.command is None or options.directory is None:
-      return False
+  # Required options.
+  if options.command is None or options.directory is None:
+    return False
 
-    # Set a default value for pub_snapshot.
-    options.pub_snapshot = None
+  # Set a default value for pub_snapshot.
+  options.pub_snapshot = None
 
-    # If we have a working pub executable, try and use that.
-    # TODO(whesse): Drop the pub-executable option if it isn't used.
-    if options.pub_executable is not None:
-      try:
-        if 0 == subprocess.call([options.pub_executable, '--version'],
-                                stdout=silent_sink,
-                                stderr=silent_sink):
-          return True
-      except OSError as e:
-        pass
-    options.pub_executable = None
+  # If we have a working pub executable, try and use that.
+  # TODO(whesse): Drop the pub-executable option if it isn't used.
+  if options.pub_executable is not None:
+    try:
+      if 0 == RunCommand([options.pub_executable, '--version'],
+                         always_silent=True):
+        return True
+    except OSError as e:
+      pass
+  options.pub_executable = None
 
-    if options.sdk and utils.CheckedInSdkCheckExecutable():
-      # Use the checked in pub executable.
-      options.pub_snapshot = os.path.join(utils.CheckedInSdkPath(),
-                                          'bin',
-                                          'snapshots',
-                                          'pub.dart.snapshot');
-      try:
-        if 0 == subprocess.call([utils.CheckedInSdkExecutable(),
-                                 options.pub_snapshot,
-                                 '--version'],
-                                 stdout=silent_sink,
-                                 stderr=silent_sink):
-          return True
-      except OSError as e:
-        pass
-    options.pub_snapshot = None
+  if options.sdk and utils.CheckedInSdkCheckExecutable():
+    # Use the checked in pub executable.
+    options.pub_snapshot = os.path.join(utils.CheckedInSdkPath(),
+                                        'bin',
+                                        'snapshots',
+                                        'pub.dart.snapshot');
+    try:
+      if 0 == RunCommand([utils.CheckedInSdkExecutable(),
+                          options.pub_snapshot,
+                          '--version'], always_silent=True):
+        return True
+    except OSError as e:
+      pass
+  options.pub_snapshot = None
 
-    # We need a dart executable.
-    return (options.dart_executable is not None)
+  # We need a dart executable.
+  return (options.dart_executable is not None)
 
 def ChangeDirectory(directory):
   os.chdir(directory);
@@ -138,23 +147,21 @@
                pub_snapshot,
                command,
                silent):
-  with open(os.devnull, 'wb') as silent_sink:
-    if pub_executable is not None:
-      executable = [pub_executable]
-    elif pub_snapshot is not None:
-      executable = [utils.CheckedInSdkExecutable(), pub_snapshot]
-    else:
-      DisplayBootstrapWarning()
-      executable = [dart_executable, PUB_PATH]
-      # Prevent the bootstrap Dart executable from running in regular
-      # development flow.
-      # REMOVE THE FOLLOWING LINE TO USE the dart_bootstrap binary.
-      # return False
+  if pub_executable is not None:
+    executable = [pub_executable]
+  elif pub_snapshot is not None:
+    executable = [utils.CheckedInSdkExecutable(), pub_snapshot]
+  else:
     if not silent:
-      print >> sys.stderr, ('Running command "%s"') % (executable + command)
-    return subprocess.call(executable + command,
-                           stdout=silent_sink if silent else None,
-                           stderr=silent_sink if silent else None)
+      DisplayBootstrapWarning()
+    executable = [dart_executable, PUB_PATH]
+    # Prevent the bootstrap Dart executable from running in regular
+    # development flow.
+    # REMOVE THE FOLLOWING LINE TO USE the dart_bootstrap binary.
+    # return False
+  if not silent:
+    print >> sys.stderr, ('Running command "%s"') % (executable + command)
+  return RunCommand(executable + command)
 
 def Deploy(input_dir, output_dir):
   shutil.rmtree(output_dir)
@@ -188,7 +195,7 @@
                       options.pub_executable,
                       options.pub_snapshot,
                       ['build',
-                       '-DOBS_VER=' + utils.GetVersion(),
+                       '-DOBS_VER=' + utils.GetVersion(ignore_svn_revision=True),
                        '--output', args[0]],
                       options.silent)
   elif (cmd == 'deploy'):
diff --git a/tools/patch_sdk.dart b/tools/patch_sdk.dart
index d92f0a6..e9980ea 100644
--- a/tools/patch_sdk.dart
+++ b/tools/patch_sdk.dart
@@ -110,14 +110,7 @@
 
     var libraryOut = path.join(sdkLibIn, library.path);
     var libraryIn;
-    if (mode == 'vm' && library.path.contains('typed_data.dart')) {
-      // dart:typed_data is unlike the other libraries in the SDK. The VM does
-      // not apply a patch to the base SDK implementation of the library.
-      // Instead, the VM provides a replacement implementation and ignores the
-      // sources in the SDK.
-      libraryIn =
-          path.join(dartDir, 'runtime', 'lib', 'typed_data.dart');
-    } else if (mode == 'ddc' && library.path.contains(INTERNAL_PATH)) {
+    if (mode == 'ddc' && library.path.contains(INTERNAL_PATH)) {
       libraryIn =
           path.join(privateIn, library.path.replaceAll(INTERNAL_PATH, ''));
     } else {
@@ -182,20 +175,6 @@
         }
 
         for (var i = 0; i < outPaths.length; i++) {
-          if (path.basename(outPaths[i]) == 'internal.dart') {
-            contents[i] += '''
-
-/// Marks a function as an external implementation ("native" in the Dart VM).
-///
-/// Provides a backend-specific String that can be used to identify the
-/// function's implementation
-class ExternalName {
-  final String name;
-  const ExternalName(this.name);
-}
-''';
-          }
-
           _writeSync(outPaths[i], contents[i]);
         }
       }
diff --git a/tools/patch_sdk.py b/tools/patch_sdk.py
index f87addb..25e553e 100755
--- a/tools/patch_sdk.py
+++ b/tools/patch_sdk.py
@@ -25,7 +25,13 @@
 
 def BuildArguments():
   result = argparse.ArgumentParser(usage=usage)
-  result.add_argument("--dart-executable", help="dart executable", default=None)
+  result.add_argument("-q", "--quiet",
+                      help="emit no output",
+                      default=False,
+                      action="store_true")
+  result.add_argument("--dart-executable",
+                      help="dart executable",
+                      default=None)
   return result
 
 def main():
@@ -35,7 +41,8 @@
   if utils.CheckedInSdkCheckExecutable():
     options.dart_executable = utils.CheckedInSdkExecutable()
   elif options.dart_executable is not None:
-    DisplayBootstrapWarning()
+    if not options.quiet:
+      DisplayBootstrapWarning()
     options.dart_executable = os.path.abspath(options.dart_executable)
   else:
     print >> sys.stderr, 'ERROR: cannot locate dart executable'
diff --git a/tools/task_kill.py b/tools/task_kill.py
index ab07e8a..ed8b555 100755
--- a/tools/task_kill.py
+++ b/tools/task_kill.py
@@ -63,6 +63,12 @@
   'linux': POSIX_INFO,
 }
 
+STACK_INFO_COMMAND = {
+  'win32': None,
+  'macos': '/usr/bin/sample %s 1 4000 -mayDie',
+  'linux': '/usr/bin/eu-stack -p %s',
+}
+
 def GetOptions():
   parser = optparse.OptionParser("usage: %prog [options]")
   parser.add_option("--kill_dart", default=True,
@@ -124,7 +130,26 @@
   else:
     return GetPidsPosix(process_name)
 
-def PrintPidInfo(pid):
+def PrintPidStackInfo(pid):
+  command_pattern = STACK_INFO_COMMAND.get(os_name, False)
+  if command_pattern:
+    p = subprocess.Popen(command_pattern % pid,
+                         stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE,
+                         shell=True)
+    stdout, stderr = p.communicate()
+    stdout = stdout.splitlines()
+    stderr = stderr.splitlines()
+
+    print "  Stack:"
+    for line in stdout:
+      print "    %s" % line
+    if stderr:
+      print "  Stack (stderr):"
+      for line in stderr:
+        print "    %s" % line
+
+def PrintPidInfo(pid, dump_stacks):
   # We assume that the list command will return lines in the format:
   # EXECUTABLE_PATH ARGS
   # There may be blank strings in the output
@@ -137,13 +162,15 @@
 
   # Pop the header
   lines.pop(0)
+
+  print "Hanging process info:"
+  print "  PID: %s" % pid
   for line in lines:
     # wmic will output a bunch of empty strings, we ignore these
-    if len(line) >= 1:
-      print("Hanging process info:")
-      print("  PID: %s" % pid)
-      print("  Command line: %s" % line)
+    if line: print "  Command line: %s" % line
 
+  if dump_stacks:
+    PrintPidStackInfo(pid)
 
 def KillPosix(pid):
   try:
@@ -161,14 +188,14 @@
                        shell=True)
   p.communicate()
 
-def Kill(name):
+def Kill(name, dump_stacks=False):
   if name not in EXECUTABLE_NAMES[os_name]:
     return 0
   print("***************** Killing %s *****************" % name)
   platform_name = EXECUTABLE_NAMES[os_name][name]
   pids = GetPids(platform_name)
   for pid in pids:
-    PrintPidInfo(pid)
+    PrintPidInfo(pid, dump_stacks)
     if os_name == "win32":
       KillWindows(pid)
     else:
@@ -194,7 +221,7 @@
   return status
 
 def KillDart():
-  status = Kill("dart")
+  status = Kill("dart", dump_stacks=True)
   return status
 
 def KillFletch():
diff --git a/tools/test.py b/tools/test.py
index 8db546e..d954855 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -28,7 +28,9 @@
     os.environ['PATH'] = '%s%s%s' % (
             os.environ['PATH'], os.pathsep, android_platform_tools)
 
-  exit_code = subprocess.call(command)
+  with utils.CoreDumpArchiver(args):
+    exit_code = subprocess.call(command)
+
   utils.DiagnoseExitCode(exit_code, command)
   return exit_code
 
diff --git a/tools/testing/dart/browser_controller.dart b/tools/testing/dart/browser_controller.dart
index cacdd2a..9b1a5db 100644
--- a/tools/testing/dart/browser_controller.dart
+++ b/tools/testing/dart/browser_controller.dart
@@ -699,21 +699,23 @@
   static const String viewAction = 'android.intent.action.VIEW';
   static const String mainAction = 'android.intent.action.MAIN';
   static const String chromePackage = 'com.android.chrome';
+  static const String chromeActivity = '.Main';
   static const String browserPackage = 'com.android.browser';
+  static const String browserActivity = '.BrowserActivity';
   static const String firefoxPackage = 'org.mozilla.firefox';
+  static const String firefoxActivity = '.App';
   static const String turnScreenOnPackage = 'com.google.dart.turnscreenon';
+  static const String turnScreenOnActivity = '.Main';
 
   AdbDevice _adbDevice;
 
   AndroidChrome(this._adbDevice);
 
   Future<bool> start(String url) {
-    var browserIntent =
-        new Intent(viewAction, browserPackage, '.BrowserActivity', url);
-    var chromeIntent = new Intent(viewAction, chromePackage, '.Main', url);
-    var firefoxIntent = new Intent(viewAction, firefoxPackage, '.App', url);
+    var chromeIntent =
+        new Intent(viewAction, chromePackage, chromeActivity, url);
     var turnScreenOnIntent =
-        new Intent(mainAction, turnScreenOnPackage, '.Main');
+        new Intent(mainAction, turnScreenOnPackage, turnScreenOnActivity);
 
     var testing_resources_dir =
         new Path('third_party/android_testing_resources');
@@ -1551,7 +1553,7 @@
 
       // Object that holds the state of an HTML test
       var html_test;
-  
+
       function newTaskHandler() {
         if (this.readyState == this.DONE) {
           if (this.status == 200) {
@@ -1577,7 +1579,7 @@
                 }
               } else {
                 html_test = null;
-              }               
+              }
               run(url);
             }
           } else {
@@ -1611,10 +1613,10 @@
       function childError(message, filename, lineno, colno, error) {
         sendStatusUpdate();
         if (error) {
-          reportMessage('FAIL:' + filename + ':' + lineno + 
+          reportMessage('FAIL:' + filename + ':' + lineno +
                ':' + colno + ':' + message + '\\n' + error.stack, false, false);
         } else if (filename) {
-          reportMessage('FAIL:' + filename + ':' + lineno + 
+          reportMessage('FAIL:' + filename + ':' + lineno +
                ':' + colno + ':' + message, false, false);
         } else {
           reportMessage('FAIL: ' + message, false, false);
@@ -1806,7 +1808,7 @@
           html_test.found_messages[msg]++;
           if (html_test.found_messages[msg] == 1) {
             html_test.found_message_count++;
-          } else {  
+          } else {
             html_test.double_received_messages.push(msg);
             sendStatusUpdate();
           }
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 0a15772..aeb7fae 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -7,11 +7,20 @@
 import 'dart:io' show Platform;
 
 import 'runtime_configuration.dart' show RuntimeConfiguration;
-
+import 'runtime_configuration.dart' show DartPrecompiledAdbRuntimeConfiguration;
 import 'test_runner.dart' show Command, CommandBuilder, CompilationCommand;
-
 import 'test_suite.dart' show TestInformation, TestUtils;
 
+List<String> replaceDartFileWith(List<String> list, String replacement) {
+  var copy = new List<String>.from(list);
+  for (var i = 0; i < copy.length; i++) {
+    if (copy[i].endsWith(".dart")) {
+      copy[i] = replacement;
+    }
+  }
+  return copy;
+}
+
 /// Grouping of a command with its expected result.
 class CommandArtifact {
   final List<Command> commands;
@@ -79,10 +88,9 @@
             useFastStartup: useFastStartup,
             extraDart2jsOptions:
                 TestUtils.getExtraOptions(configuration, 'dart2js_options'));
-      case 'dart2appjit':
-      case 'dart2app':
+      case 'app_jit':
         return new Dart2AppSnapshotCompilerConfiguration(
-            isDebug: isDebug, isChecked: isChecked, useBlobs: useBlobs);
+            isDebug: isDebug, isChecked: isChecked);
       case 'precompiler':
         return new PrecompilerCompilerConfiguration(
             isDebug: isDebug,
@@ -92,17 +100,21 @@
             isAndroid: configuration['system'] == 'android');
       case 'dartk':
         return ComposedCompilerConfiguration.createDartKConfiguration(
+            isChecked: isChecked,
             isHostChecked: isHostChecked,
             useSdk: useSdk,
-            verify: verifyKernel);
+            verify: verifyKernel,
+            strong: isStrong);
       case 'dartkp':
         return ComposedCompilerConfiguration.createDartKPConfiguration(
+            isChecked: isChecked,
             isHostChecked: isHostChecked,
             arch: configuration['arch'],
             useBlobs: useBlobs,
             isAndroid: configuration['system'] == 'android',
             useSdk: useSdk,
-            verify: verifyKernel);
+            verify: verifyKernel,
+            strong: isStrong);
       case 'none':
         return new NoneCompilerConfiguration(
             isDebug: isDebug,
@@ -215,10 +227,12 @@
 
 /// The "dartk" compiler.
 class DartKCompilerConfiguration extends CompilerConfiguration {
-  final bool verify;
+  final bool verify, strong;
 
-  DartKCompilerConfiguration({bool isHostChecked, bool useSdk, this.verify})
-      : super._subclass(isHostChecked: isHostChecked, useSdk: useSdk);
+  DartKCompilerConfiguration({bool isChecked, bool isHostChecked, bool useSdk,
+        this.verify, this.strong})
+      : super._subclass(isChecked: isChecked, isHostChecked: isHostChecked,
+                        useSdk: useSdk);
 
   @override
   String computeCompilerPath(String buildDir) {
@@ -236,6 +250,7 @@
       '$buildDir/patched_sdk',
       '--link',
       '--target=vm',
+      strong ? '--strong' : null,
       verify ? '--verify-ir' : null,
       '--out',
       outputFileName
@@ -261,6 +276,29 @@
           CommandBuilder.instance, arguments, environmentOverrides)
     ], '$tempDir/out.dill', 'application/dart');
   }
+
+  List<String> computeRuntimeArguments(
+      RuntimeConfiguration runtimeConfiguration,
+      String buildDir,
+      TestInformation info,
+      List<String> vmOptions,
+      List<String> sharedOptions,
+      List<String> originalArguments,
+      CommandArtifact artifact) {
+    List<String> args = [];
+    if (isChecked) {
+      args.add('--enable_asserts');
+      args.add('--enable_type_checks');
+    }
+
+    var newOriginalArguments = replaceDartFileWith(
+        originalArguments, artifact.filename);
+
+    return args
+      ..addAll(vmOptions)
+      ..addAll(sharedOptions)
+      ..addAll(newOriginalArguments);
+  }
 }
 
 typedef List<String> CompilerArgumentsFunction(
@@ -298,7 +336,7 @@
     return new PipelineCommand._(conf, (List<String> globalArguments,
                                         String previousOutput) {
       assert(previousOutput.endsWith('.dill'));
-      return [previousOutput];
+      return replaceDartFileWith(globalArguments, previousOutput);
     });
   }
 
@@ -310,10 +348,8 @@
 
 class ComposedCompilerConfiguration extends CompilerConfiguration {
   final List<PipelineCommand> pipelineCommands;
-  final bool isPrecompiler;
 
-  ComposedCompilerConfiguration(this.pipelineCommands, {this.isPrecompiler: false})
-      : super._subclass();
+  ComposedCompilerConfiguration(this.pipelineCommands) : super._subclass();
 
   CommandArtifact computeCompilationArtifact(
       String buildDir,
@@ -350,7 +386,7 @@
   List<String> computeCompilerArguments(vmOptions, sharedOptions, args) {
     // The result will be passed as an input to [extractArguments]
     // (i.e. the arguments to the [PipelineCommand]).
-    return new List<String>.from(sharedOptions)..addAll(args);
+    return <String>[]..addAll(vmOptions)..addAll(sharedOptions)..addAll(args);
   }
 
   List<String> computeRuntimeArguments(
@@ -361,38 +397,45 @@
       List<String> sharedOptions,
       List<String> originalArguments,
       CommandArtifact artifact) {
-    final String suffix = isPrecompiler ? "/out.aotsnapshot" : "";
-    return <String>["${artifact.filename}${suffix}"];
+    CompilerConfiguration lastCompilerConfiguration =
+        pipelineCommands.last.compilerConfiguration;
+    return lastCompilerConfiguration.computeRuntimeArguments(
+        runtimeConfiguration, buildDir, info, vmOptions, sharedOptions,
+        originalArguments, artifact);
   }
 
   static ComposedCompilerConfiguration createDartKPConfiguration(
-      {bool isHostChecked, String arch, bool useBlobs, bool isAndroid,
-       bool useSdk, bool verify}) {
+      {bool isChecked, bool isHostChecked, String arch, bool useBlobs,
+       bool isAndroid, bool useSdk, bool verify, bool strong}) {
     var nested = [];
 
     // Compile with dartk.
     nested.add(new PipelineCommand.runWithGlobalArguments(
-        new DartKCompilerConfiguration(isHostChecked: isHostChecked,
-            useSdk: useSdk, verify: verify)));
+        new DartKCompilerConfiguration(isChecked: isChecked,
+            isHostChecked: isHostChecked, useSdk: useSdk, verify: verify,
+            strong: strong)));
 
     // Run the normal precompiler.
     nested.add(new PipelineCommand.runWithPreviousKernelOutput(
         new PrecompilerCompilerConfiguration(
-          arch: arch, useBlobs: useBlobs, isAndroid: isAndroid)));
+          isChecked: isChecked, arch: arch, useBlobs: useBlobs,
+          isAndroid: isAndroid)));
 
-    return new ComposedCompilerConfiguration(nested, isPrecompiler: true);
+    return new ComposedCompilerConfiguration(nested);
   }
 
   static ComposedCompilerConfiguration createDartKConfiguration(
-      {bool isHostChecked, bool useSdk, bool verify}) {
+      {bool isChecked, bool isHostChecked, bool useSdk, bool verify,
+       bool strong}) {
     var nested = [];
 
     // Compile with dartk.
     nested.add(new PipelineCommand.runWithGlobalArguments(
-        new DartKCompilerConfiguration(isHostChecked: isHostChecked,
-            useSdk: useSdk, verify: verify)));
+        new DartKCompilerConfiguration(isChecked: isChecked,
+            isHostChecked: isHostChecked, useSdk: useSdk,
+            verify: verify, strong: strong)));
 
-    return new ComposedCompilerConfiguration(nested, isPrecompiler: false);
+    return new ComposedCompilerConfiguration(nested);
   }
 }
 
@@ -562,7 +605,12 @@
       CommandBuilder commandBuilder,
       List arguments,
       Map<String, String> environmentOverrides) {
-    var exec = "$buildDir/dart_bootstrap";
+    var exec;
+    if (isAndroid && arch == 'arm') {
+      exec = "$buildDir/clang_x86/dart_bootstrap";
+    } else {
+      exec = "$buildDir/dart_bootstrap";
+    }
     var args = new List();
     args.add("--snapshot-kind=app-aot");
     if (useBlobs) {
@@ -689,6 +737,16 @@
       args.add('--enable_asserts');
       args.add('--enable_type_checks');
     }
+
+    var dir = artifact.filename;
+    if (runtimeConfiguration is DartPrecompiledAdbRuntimeConfiguration) {
+      // On android the precompiled snapshot will be pushed to a different
+      // directory on the device, use that one instead.
+      dir = DartPrecompiledAdbRuntimeConfiguration.DeviceTestDir;
+    }
+    originalArguments = replaceDartFileWith(
+        originalArguments, "$dir/out.aotsnapshot");
+
     return args
       ..addAll(vmOptions)
       ..addAll(sharedOptions)
@@ -697,9 +755,8 @@
 }
 
 class Dart2AppSnapshotCompilerConfiguration extends CompilerConfiguration {
-  final bool useBlobs;
-  Dart2AppSnapshotCompilerConfiguration({bool isDebug, bool isChecked, bool useBlobs})
-      : super._subclass(isDebug: isDebug, isChecked: isChecked), this.useBlobs = useBlobs;
+  Dart2AppSnapshotCompilerConfiguration({bool isDebug, bool isChecked})
+      : super._subclass(isDebug: isDebug, isChecked: isChecked);
 
   int computeTimeoutMultiplier() {
     int multiplier = 2;
@@ -714,10 +771,11 @@
       CommandBuilder commandBuilder,
       List arguments,
       Map<String, String> environmentOverrides) {
+    var snapshot = "$tempDir/out.jitsnapshot";
     return new CommandArtifact(<Command>[
       this.computeCompilationCommand(tempDir, buildDir,
           CommandBuilder.instance, arguments, environmentOverrides)
-    ], tempDir, 'application/dart-snapshot');
+    ], snapshot, 'application/dart-snapshot');
   }
 
   CompilationCommand computeCompilationCommand(
@@ -728,15 +786,13 @@
       Map<String, String> environmentOverrides) {
     var exec = "$buildDir/dart";
     var args = new List();
-    args.add("--snapshot=$tempDir/out.jitsnapshot");
+    var snapshot = "$tempDir/out.jitsnapshot";
+    args.add("--snapshot=$snapshot");
     args.add("--snapshot-kind=app-jit");
-    if (useBlobs) {
-      args.add("--use-blobs");
-    }
     args.addAll(arguments);
 
     return commandBuilder.getCompilationCommand(
-        'dart2snapshot',
+        'app_jit',
         tempDir,
         !useSdk,
         bootstrapDependencies(buildDir),
@@ -771,10 +827,16 @@
       args.add('--enable_asserts');
       args.add('--enable_type_checks');
     }
-    return args
+    args
       ..addAll(vmOptions)
       ..addAll(sharedOptions)
       ..addAll(originalArguments);
+    for (var i = 0; i < args.length; i++) {
+      if (args[i].endsWith(".dart")) {
+        args[i] = artifact.filename;
+      }
+    }
+    return args;
   }
 }
 
diff --git a/tools/testing/dart/pubspec.yaml b/tools/testing/dart/pubspec.yaml
new file mode 100644
index 0000000..0bcb25f
--- /dev/null
+++ b/tools/testing/dart/pubspec.yaml
@@ -0,0 +1,6 @@
+# Copyright (c) 2017, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# This file is only here that so certain Dart editors recognize this is a Dart
+# project.
diff --git a/tools/testing/dart/runtime_configuration.dart b/tools/testing/dart/runtime_configuration.dart
index 97c918a..c077e7d 100644
--- a/tools/testing/dart/runtime_configuration.dart
+++ b/tools/testing/dart/runtime_configuration.dart
@@ -4,16 +4,22 @@
 
 library runtime_configuration;
 
-import 'dart:io' show Platform;
+import 'dart:io' show Directory, File;
 
 import 'compiler_configuration.dart' show CommandArtifact;
 
 // TODO(ahe): Remove this import, we can precompute all the values required
 // from TestSuite once the refactoring is complete.
-import 'test_suite.dart' show TestSuite;
+import 'test_suite.dart' show TestSuite, TestUtils;
 
 import 'test_runner.dart' show Command, CommandBuilder;
 
+/// Describes the commands to run a given test case or its compiled output.
+///
+/// A single runtime configuration object exists per test suite, and is thus
+/// shared between multiple test cases, it should not be mutated after
+/// construction.
+//
 // TODO(ahe): I expect this class will become abstract very soon.
 class RuntimeConfiguration {
   // TODO(ahe): Remove this constructor and move the switch to
@@ -52,8 +58,8 @@
       case 'vm':
         return new StandaloneDartRuntimeConfiguration();
 
-      case 'dart_app':
-        return new DartAppRuntimeConfiguration(useBlobs: useBlobs);
+      case 'flutter':
+        return new StandaloneFlutterEngineConfiguration();
 
       case 'dart_precompiled':
         if (configuration['system'] == 'android') {
@@ -64,6 +70,9 @@
       case 'drt':
         return new DrtRuntimeConfiguration();
 
+      case 'self_check':
+        return new SelfCheckRuntimeConfiguration();
+
       default:
         throw "Unknown runtime '$runtime'";
     }
@@ -87,6 +96,8 @@
   }
 
   List<String> dart2jsPreambles(Uri preambleDir) => [];
+
+  bool get shouldSkipNegativeTests => false;
 }
 
 /// The 'none' runtime configuration.
@@ -218,22 +229,20 @@
       Map<String, String> environmentOverrides) {
     String script = artifact.filename;
     String type = artifact.mimeType;
-    if (script != null && type != 'application/dart') {
+    if (script != null &&
+        type != 'application/dart' &&
+        type != 'application/dart-snapshot') {
       throw "Dart VM cannot run files of type '$type'.";
     }
-    String executable = suite.configuration['noopt']
-        ? suite.dartVmNooptBinaryFileName
-        : suite.dartVmBinaryFileName;
+    String executable = suite.dartVmBinaryFileName;
     return <Command>[
       commandBuilder.getVmCommand(executable, arguments, environmentOverrides)
     ];
   }
 }
 
-class DartAppRuntimeConfiguration extends DartVmRuntimeConfiguration {
-  final bool useBlobs;
-  DartAppRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs;
-
+/// The flutter engine binary, "sky_shell".
+class StandaloneFlutterEngineConfiguration extends DartVmRuntimeConfiguration {
   List<Command> computeRuntimeCommands(
       TestSuite suite,
       CommandBuilder commandBuilder,
@@ -242,21 +251,15 @@
       Map<String, String> environmentOverrides) {
     String script = artifact.filename;
     String type = artifact.mimeType;
-    if (script != null && type != 'application/dart-snapshot') {
-      throw "dart_app cannot run files of type '$type'.";
+    if (script != null &&
+        type != 'application/dart' &&
+        type != 'application/dart-snapshot') {
+      throw "Flutter Engine cannot run files of type '$type'.";
     }
-
-    var args = new List();
-    args.addAll(arguments);
-    for (var i = 0; i < args.length; i++) {
-      if (args[i].endsWith(".dart")) {
-        args[i] = "${artifact.filename}/out.jitsnapshot";
-      }
-    }
-
+    String executable = suite.flutterEngineBinaryFileName;
+    var args = <String>['--non-interactive']..addAll(arguments);
     return <Command>[
-      commandBuilder.getVmCommand(suite.dartVmBinaryFileName,
-          args, environmentOverrides)
+      commandBuilder.getVmCommand(executable, args, environmentOverrides)
     ];
   }
 }
@@ -277,23 +280,20 @@
       throw "dart_precompiled cannot run files of type '$type'.";
     }
 
-    var args = new List();
-    args.addAll(arguments);
-    for (var i = 0; i < args.length; i++) {
-      if (args[i].endsWith(".dart")) {
-        args[i] = "${artifact.filename}/out.aotsnapshot";
-      }
-    }
-
     return <Command>[
       commandBuilder.getVmCommand(suite.dartPrecompiledBinaryFileName,
-          args, environmentOverrides)
+          arguments, environmentOverrides)
     ];
   }
 }
 
 class DartPrecompiledAdbRuntimeConfiguration
       extends DartVmRuntimeConfiguration {
+  static const String DeviceDir =
+      '/data/local/tmp/precompilation-testing';
+  static const String DeviceTestDir =
+      '/data/local/tmp/precompilation-testing/test';
+
   final bool useBlobs;
   DartPrecompiledAdbRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs;
 
@@ -321,6 +321,40 @@
   }
 }
 
+class SelfCheckRuntimeConfiguration extends DartVmRuntimeConfiguration {
+  final List<String> selfCheckers = <String>[];
+
+  SelfCheckRuntimeConfiguration() {
+    searchForSelfCheckers();
+  }
+
+  void searchForSelfCheckers() {
+    Uri pkg = TestUtils.dartDirUri.resolve('pkg');
+    for (var entry in  new Directory.fromUri(pkg).listSync(recursive: true)) {
+      if (entry is File && entry.path.endsWith('_self_check.dart')) {
+        selfCheckers.add(entry.path);
+      }
+    }
+  }
+
+  List<Command> computeRuntimeCommands(
+      TestSuite suite,
+      CommandBuilder commandBuilder,
+      CommandArtifact artifact,
+      List<String> arguments,
+      Map<String, String> environmentOverrides) {
+    String executable = suite.dartVmBinaryFileName;
+    return selfCheckers
+        .map((String tester) => commandBuilder.getVmBatchCommand(
+            executable, tester, arguments, environmentOverrides,
+            checked: suite.configuration['checked']))
+        .toList();
+  }
+
+  @override
+  bool get shouldSkipNegativeTests => true;
+}
+
 /// Temporary runtime configuration for browser runtimes that haven't been
 /// migrated yet.
 // TODO(ahe): Remove this class.
diff --git a/tools/testing/dart/status_file_parser.dart b/tools/testing/dart/status_file_parser.dart
index c4be801..3ede28c 100644
--- a/tools/testing/dart/status_file_parser.dart
+++ b/tools/testing/dart/status_file_parser.dart
@@ -28,6 +28,15 @@
   static Expectation MISSING_STATIC_WARNING = byName('MissingStaticWarning');
   static Expectation PUB_GET_ERROR = byName('PubGetError');
 
+  // Special 'CRASH' cases
+  static Expectation DARTK_CRASH = byName('DartkCrash');
+
+  // Special 'TIMEOUT' cases
+  static Expectation DARTK_TIMEOUT = byName('DartkTimeout');
+
+  // Special 'COMPILETIME_ERROR'
+  static Expectation DARTK_COMPILETIME_ERROR = byName('DartkCompileTimeError');
+
   // "meta expectations"
   static Expectation OK = byName('Ok');
   static Expectation SLOW = byName('Slow');
@@ -63,15 +72,20 @@
       }
 
       var fail = build("Fail");
+      var crash = build("Crash");
+      var timeout = build("Timeout");
       build("Pass");
-      build("Crash");
-      build("Timeout");
 
+      var compileError = build("CompileTimeError", group: fail);
       build("MissingCompileTimeError", group: fail);
       build("MissingRuntimeError", group: fail);
-      build("CompileTimeError", group: fail);
       build("RuntimeError", group: fail);
 
+      // Dartk sub expectations
+      build("DartkCrash", group: crash);
+      build("DartkTimeout", group: timeout);
+      build("DartkCompileTimeError", group: compileError);
+
       build("MissingStaticWarning", group: fail);
       build("StaticWarning", group: fail);
 
diff --git a/tools/testing/dart/status_reporter.dart b/tools/testing/dart/status_reporter.dart
index 0f5e37b..37f66ae 100644
--- a/tools/testing/dart/status_reporter.dart
+++ b/tools/testing/dart/status_reporter.dart
@@ -30,6 +30,12 @@
     'archs': ['ia32'],
     'compiler': 'none'
   },
+  {
+    'runtimes': ['flutter_engine'],
+    'modes': ['debug', 'release'],
+    'archs': ['x64'],
+    'compiler': 'none'
+  },
 ];
 
 List<Map> MACOS_COMBINATIONS = [
diff --git a/tools/testing/dart/test_configurations.dart b/tools/testing/dart/test_configurations.dart
index d9e7128..ee68349 100644
--- a/tools/testing/dart/test_configurations.dart
+++ b/tools/testing/dart/test_configurations.dart
@@ -40,11 +40,14 @@
   new Path('tests/compiler/dart2js_extra'),
   new Path('tests/compiler/dart2js_native'),
   new Path('tests/corelib'),
+  new Path('tests/corelib_strong'),
   new Path('tests/html'),
   new Path('tests/isolate'),
   new Path('tests/kernel'),
   new Path('tests/language'),
+  new Path('tests/language_strong'),
   new Path('tests/lib'),
+  new Path('tests/lib_strong'),
   new Path('tests/standalone'),
   new Path('tests/utils'),
   new Path('utils/tests/css'),
@@ -104,7 +107,6 @@
           .toList();
       if (conf['checked']) settings.add('checked');
       if (conf['strong']) settings.add('strong');
-      if (conf['noopt']) settings.add('noopt');
       output_words.add(settings.join('_'));
     }
     print(output_words.join(' '));
diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart
index 83856fe..194f834 100644
--- a/tools/testing/dart/test_options.dart
+++ b/tools/testing/dart/test_options.dart
@@ -23,7 +23,6 @@
   'benchmark_smoke',
   'utils',
   'lib',
-  'pkg',
   'analyze_library',
   'service',
   'kernel',
@@ -64,7 +63,7 @@
           '''Specify any compilation step (if needed).
 
    none: Do not compile the Dart code (run native Dart code on the VM).
-         (only valid with the following runtimes: vm, drt)
+         (only valid with the following runtimes: vm, flutter, drt)
 
    dart2js: Compile dart code to JavaScript by running dart2js.
          (only valid with the following runtimes: d8, drt, chrome,
@@ -88,8 +87,7 @@
             'precompiler',
             'dart2js',
             'dart2analyzer',
-            'dart2app',
-            'dart2appjit',
+            'app_jit',
             'dartk',
             'dartkp'
           ],
@@ -100,11 +98,11 @@
           '''Where the tests should be run.
     vm: Run Dart code on the standalone dart vm.
 
+    flutter: Run Dart code on the flutter engine.
+
     dart_precompiled: Run a precompiled snapshot on a variant of the standalone
                       dart vm lacking a JIT.
 
-    dart_app: Run a full app snapshot, with or without cached unoptimized code.
-
     d8: Run JavaScript from the command line using v8.
 
     jsshell: Run JavaScript from the command line using firefox js-shell.
@@ -122,13 +120,18 @@
     [ff | chrome | safari | ie9 | ie10 | ie11 | opera | chromeOnAndroid]:
         Run JavaScript in the specified browser.
 
+    self_check: Pass each test or its compiled output to every file under
+        `pkg` whose name ends with `_self_check.dart`.
+        Each test is given to the self_check tester as a filename on stdin using
+        the batch-mode protocol.
+
     none: No runtime, compile only (for example, used for dart2analyzer static
           analysis tests).''',
           ['-r', '--runtime'],
           [
             'vm',
+            'flutter',
             'dart_precompiled',
-            'dart_app',
             'd8',
             'jsshell',
             'drt',
@@ -145,6 +148,7 @@
             'safarimobilesim',
             'ContentShellOnAndroid',
             'DartiumOnAndroid',
+            'self_check',
             'none'
           ],
           'vm'),
@@ -203,9 +207,6 @@
           false,
           type: 'bool'),
       new _TestOptionSpecification(
-          'noopt', 'Run an in-place precompilation', ['--noopt'], [], false,
-          type: 'bool'),
-      new _TestOptionSpecification(
           'fast_startup',
           'Pass the --fast-startup flag to dart2js',
           ['--fast-startup'],
@@ -305,6 +306,8 @@
       new _TestOptionSpecification(
           'dart', 'Path to dart executable', ['--dart'], [], ''),
       new _TestOptionSpecification(
+          'flutter', 'Path to flutter executable', ['--flutter'], [], ''),
+      new _TestOptionSpecification(
           'drt', // TODO(antonm): fix the option name.
           'Path to content shell executable',
           ['--drt'],
@@ -478,8 +481,19 @@
           'Exclude suites from default selector, only works when no'
           ' selector has been specified on the command line',
           ['--exclude-suite'],
-          defaultTestSelectors,
+          [],
           null),
+      new _TestOptionSpecification(
+          'skip-compilation',
+          'Skip the compilation step, using the compilation artifacts left in '
+          ' the output folder from a previous run.'
+          'This flag will often cause false positves and negatives, but can be'
+          ' useful for quick-and-dirty offline testing when not making changes'
+          ' that affect the compiler.',
+          ['--skip-compilation'],
+          [],
+          false,
+          type: 'bool')
     ];
   }
 
@@ -613,6 +627,7 @@
     'chrome',
     'copy_coredumps',
     'dart',
+    'flutter',
     'dartium',
     'drt',
     'exclude_suite',
@@ -696,22 +711,18 @@
       case 'dart2analyzer':
         validRuntimes = const ['none'];
         break;
-      case 'dart2app':
-      case 'dart2appjit':
-        validRuntimes = const ['dart_app'];
+      case 'app_jit':
+      case 'dartk':
+        validRuntimes = const ['vm', 'self_check', 'none'];
         break;
       case 'precompiler':
-        validRuntimes = const ['dart_precompiled'];
-        break;
-      case 'dartk':
-        validRuntimes = const ['vm'];
-        break;
       case 'dartkp':
         validRuntimes = const ['dart_precompiled'];
         break;
       case 'none':
         validRuntimes = const [
           'vm',
+          'flutter',
           'drt',
           'dartium',
           'ContentShellOnAndroid',
@@ -727,7 +738,7 @@
     }
     if (config['ie'] && Platform.operatingSystem != 'windows') {
       isValid = false;
-      print("Warning cannot run Internet Explorer on non-Windows operating"
+      print("Warning: cannot run Internet Explorer on non-Windows operating"
           " system.");
     }
     if (config['shard'] < 1 || config['shard'] > config['shards']) {
@@ -741,6 +752,15 @@
       print("Cannot have both --use-repository-packages and "
           "--use-public-packages");
     }
+    if ((config['runtime'] == 'flutter') && (config['flutter'] == '')) {
+      isValid = false;
+      print("-rflutter requires the flutter engine executable to "
+          "be specified using --flutter=");
+    }
+    if ((config['runtime'] == 'flutter') && (config['arch'] != 'x64')) {
+      isValid = false;
+      print("-rflutter is applicable only for --arch=x64");
+    }
 
     return isValid;
   }
@@ -812,8 +832,7 @@
           if (selectors.contains(exclude)) {
             selectors.remove(exclude);
           } else {
-            print("Error: default selectors does not contain $exclude");
-            exit(1);
+            print("Warning: default selectors does not contain $exclude");
           }
         }
       }
@@ -996,6 +1015,7 @@
     }
     print('Unknown test option $name');
     exit(1);
+    return null; // Unreachable.
   }
 
   List<_TestOptionSpecification> _options;
diff --git a/tools/testing/dart/test_progress.dart b/tools/testing/dart/test_progress.dart
index f09372a..7e57a60 100644
--- a/tools/testing/dart/test_progress.dart
+++ b/tools/testing/dart/test_progress.dart
@@ -316,25 +316,52 @@
 }
 
 class UnexpectedCrashDumpArchiver extends EventListener {
+  final archivedBinaries = <String, String>{};
+
   void done(TestCase test) {
-    if (test.unexpectedOutput && test.result == Expectation.CRASH) {
-      var name = "core.dart.${test.lastCommandOutput.pid}";
-      var file = new File(name);
-      if (file.existsSync()) {
-        // Find the binary - we assume this is the first part of the command
-        var binName = test.lastCommandExecuted.toString().split(' ').first;
-        var binFile = new File(binName);
-        var binBaseName = new Path(binName).filename;
-        if (binFile.existsSync()) {
-          var tmpPath = new Path(Directory.systemTemp.path);
-          var dir = new Path(TestUtils
-              .mkdirRecursive(
-                  tmpPath, new Path('coredump_${test.lastCommandOutput.pid}'))
-              .path);
-          TestUtils.copyFile(new Path(name), dir.append(name));
-          TestUtils.copyFile(new Path(binName), dir.append(binBaseName));
-          print("\nCopied core dump and binary for unexpected crash to: "
-              "$dir");
+    if (test.unexpectedOutput &&
+        test.result == Expectation.CRASH &&
+        test.lastCommandExecuted is ProcessCommand) {
+      final name = "core.${test.lastCommandOutput.pid}";
+      final file = new File(name);
+      final exists = file.existsSync();
+      if (exists) {
+        final lastCommand = test.lastCommandExecuted as ProcessCommand;
+        // We have a coredump for the process. This coredump will be archived by
+        // CoreDumpArchiver (see tools/utils.py). For debugging purposes we
+        // need to archive the crashed binary as well. To simplify the
+        // archiving code we simply copy binaries into current folder next to
+        // core dumps and name them `core.${mode}_${arch}_${binary_name}`.
+        final binName = lastCommand.executable;
+        final binFile = new File(binName);
+        final binBaseName = new Path(binName).filename;
+        if (!archivedBinaries.containsKey(binName) &&
+            binFile.existsSync()) {
+          final mode = test.configuration['mode'];
+          final arch = test.configuration['arch'];
+          final archived = "binary.${mode}_${arch}_${binBaseName}";
+          TestUtils.copyFile(new Path(binName), new Path(archived));
+          archivedBinaries[binName] = archived;
+        }
+
+        if (archivedBinaries.containsKey(binName)) {
+          // We have found and copied the binary.
+          var coredumpsList;
+          try {
+            coredumpsList =
+                new File('coredumps').openSync(mode: FileMode.APPEND);
+            coredumpsList.writeStringSync(
+                "${test.displayName},${name},${archivedBinaries[binName]}\n");
+          } catch (e) {
+            print('Failed to add crash to coredumps list: ${e}');
+          } finally {
+            try {
+              if (coredumpsList != null)
+                coredumpsList.closeSync();
+            } catch (e) {
+              print('Failed to close coredumps list: ${e}');
+            }
+          }
         }
       }
     }
@@ -694,6 +721,6 @@
       return new BuildbotProgressIndicator(startTime);
     default:
       assert(false);
-      break;
+      return null;
   }
 }
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index 1cb1a39..ac80516 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -22,14 +22,15 @@
 import 'package:yaml/yaml.dart';
 
 import 'android.dart';
-import 'dependency_graph.dart' as dgraph;
 import "browser_controller.dart";
+import 'dependency_graph.dart' as dgraph;
 import "path.dart";
+import 'record_and_replay.dart';
+import "runtime_configuration.dart";
 import "status_file_parser.dart";
 import "test_progress.dart";
 import "test_suite.dart";
 import "utils.dart";
-import 'record_and_replay.dart';
 
 const int CRASHING_BROWSER_EXITCODE = -10;
 const int SLOW_TIMEOUT_MULTIPLIER = 4;
@@ -139,7 +140,7 @@
         (io.Platform.operatingSystem == 'windows')
             ? env.write('set $key=${escapeCommandLineArgument(value)} & ')
             : env.write('$key=${escapeCommandLineArgument(value)} '));
-    var command = ([executable]..addAll(arguments))
+    var command = ([executable]..addAll(batchArguments)..addAll(arguments))
         .map(escapeCommandLineArgument)
         .join(' ');
     if (workingDirectory != null) {
@@ -149,6 +150,11 @@
   }
 
   Future<bool> get outputIsUpToDate => new Future.value(false);
+
+  /// Arguments that are passed to the process when starting batch mode.
+  ///
+  /// In non-batch mode, they should be passed before [arguments].
+  List<String> get batchArguments => const [];
 }
 
 class CompilationCommand extends ProcessCommand {
@@ -233,6 +239,8 @@
       : super._(displayName, outputFile, neverSkipCompilation,
                 bootstrapDependencies, executable, arguments,
                 environmentOverrides);
+
+  int get maxNumRetries => 1;
 }
 
 /// This is just a Pair(String, Map) class with hashCode and operator ==
@@ -362,6 +370,35 @@
       : super._("vm", executable, arguments, environmentOverrides);
 }
 
+class VmBatchCommand extends ProcessCommand implements VmCommand {
+  final String dartFile;
+  final bool checked;
+
+  VmBatchCommand._(String executable, String dartFile, List<String> arguments,
+      Map<String, String> environmentOverrides, {this.checked: true})
+      : this.dartFile = dartFile,
+        super._('vm-batch', executable, arguments, environmentOverrides);
+
+  @override
+  List<String> get batchArguments => checked
+      ? ['--checked', dartFile]
+      : [dartFile];
+
+  @override
+  bool _equal(VmBatchCommand other) {
+    return super._equal(other) &&
+        dartFile == other.dartFile &&
+        checked == other.checked;
+  }
+
+  @override
+  void _buildHashCode(HashCodeBuilder builder) {
+    super._buildHashCode(builder);
+    builder.addJson(dartFile);
+    builder.addJson(checked);
+  }
+}
+
 class AdbPrecompilationCommand extends Command {
   final String precompiledRunnerFilename;
   final String processTestFilename;
@@ -701,6 +738,15 @@
     return _getUniqueCommand(command);
   }
 
+  VmBatchCommand getVmBatchCommand(String executable, String tester,
+      List<String> arguments, Map<String, String> environmentOverrides,
+      {bool checked: true}) {
+    var command =
+        new VmBatchCommand._(executable, tester, arguments, environmentOverrides,
+            checked: checked);
+    return _getUniqueCommand(command);
+  }
+
   AdbPrecompilationCommand getAdbPrecompiledCommand(String precompiledRunner,
                                                     String processTest,
                                                     String testDirectory,
@@ -848,7 +894,7 @@
   bool get expectCompileError => _expectations & EXPECT_COMPILE_ERROR != 0;
 
   bool get unexpectedOutput {
-    var outcome = lastCommandOutput.result(this);
+    var outcome = this.result;
     return !expectedOutcomes.any((expectation) {
       return outcome.canBeOutcomeOf(expectation);
     });
@@ -1664,6 +1710,18 @@
     return !hasCrashed && !timedOut && exitCode == 0;
   }
 
+  Expectation result(TestCase testCase) {
+    Expectation result = super.result(testCase);
+    if (result.canBeOutcomeOf(Expectation.CRASH)) {
+      return Expectation.DARTK_CRASH;
+    } else if (result.canBeOutcomeOf(Expectation.TIMEOUT)) {
+      return Expectation.DARTK_TIMEOUT;
+    } else if (result.canBeOutcomeOf(Expectation.COMPILETIME_ERROR)) {
+      return Expectation.DARTK_COMPILETIME_ERROR;
+    }
+    return result;
+  }
+
   // If the compiler was able to produce a Kernel IR file we want to run the
   // result on the Dart VM.  We therefore mark the [KernelCompilationCommand] as
   // successful.
@@ -1754,7 +1812,7 @@
         command, exitCode, timedOut, stdout, stderr, time, pid);
   } else if (command is CompilationCommand) {
     if (command.displayName == 'precompiler' ||
-        command.displayName == 'dart2snapshot') {
+        command.displayName == 'app_jit') {
       return new VmCommandOutputImpl(
           command, exitCode, timedOut, stdout, stderr, time, pid);
     }
@@ -2167,7 +2225,7 @@
   _startProcess(callback) {
     assert(_command is ProcessCommand);
     var executable = _command.executable;
-    var arguments = ['--batch'];
+    var arguments = []..addAll(_command.batchArguments)..add('--batch');
     var environment = new Map.from(io.Platform.environment);
     if (_processEnvironmentOverrides != null) {
       for (var key in _processEnvironmentOverrides.keys) {
@@ -2628,6 +2686,10 @@
           adbDevicePool.releaseDevice(device);
         });
       });
+    } else if (command is VmBatchCommand) {
+      var name = command.displayName;
+      return _getBatchRunner(command.displayName + command.dartFile)
+          .runCommand(name, command, timeout, command.arguments);
     } else {
       return new RunningProcess(command, timeout).run();
     }
@@ -2639,8 +2701,8 @@
     var processTest = command.processTestFilename;
     var testdir = command.precompiledTestDirectory;
     var arguments = command.arguments;
-    var devicedir = '/data/local/tmp/precompilation-testing';
-    var deviceTestDir = '/data/local/tmp/precompilation-testing/test';
+    var devicedir = DartPrecompiledAdbRuntimeConfiguration.DeviceDir;
+    var deviceTestDir = DartPrecompiledAdbRuntimeConfiguration.DeviceTestDir;
 
     // We copy all the files which the vm precompiler puts into the test
     // directory.
@@ -2672,18 +2734,10 @@
           .runAdbCommand(['push', '$testdir/$file', '$deviceTestDir/$file']));
     }
 
-    var args = new List();
-    args.addAll(arguments);
-    for (var i = 0; i < args.length; i++) {
-      if (args[i].endsWith(".dart")) {
-        args[i] = "$deviceTestDir/out.aotsnapshot";
-      }
-    }
-
     steps.add(() => device.runAdbShellCommand(
         [
           '$devicedir/dart_precompiled_runtime',
-        ]..addAll(args),
+        ]..addAll(arguments),
         timeout: timeoutDuration));
 
     var stopwatch = new Stopwatch()..start();
@@ -2829,6 +2883,31 @@
       }
     }
 
+    final command = output.command;
+
+    // The dartk batch compiler sometimes runs out of memory. In such a case we
+    // will retry running it.
+    if (command is KernelCompilationCommand) {
+      if (output.hasCrashed) {
+        bool containsOutOfMemoryMessage(String line) {
+          return line.contains('Exhausted heap space, trying to allocat');
+        }
+
+        decodeOutput();
+        if (stdout.any(containsOutOfMemoryMessage) ||
+            stderr.any(containsOutOfMemoryMessage)) {
+          return true;
+        }
+      }
+    }
+
+    // We currently rerun dartium tests, see issue 14074.
+    if (command is BrowserTestCommand &&
+        command.retry &&
+        command.browser == 'dartium') {
+      return true;
+    }
+
     if (io.Platform.operatingSystem == 'linux') {
       decodeOutput();
       // No matter which command we ran: If we get failures due to the
@@ -2842,13 +2921,6 @@
       }
     }
 
-    // We currently rerun dartium tests, see issue 14074.
-    final command = output.command;
-    if (command is BrowserTestCommand &&
-        command.retry &&
-        command.browser == 'dartium') {
-      return true;
-    }
   }
   return false;
 }
@@ -3060,7 +3132,7 @@
       });
 
       // Queue commands as they become "runnable"
-      var commandEnqueuer = new CommandEnqueuer(_graph);
+      new CommandEnqueuer(_graph);
 
       // CommandExecutor will execute commands
       var executor;
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index c13b69a..a556912 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -123,6 +123,7 @@
   // This function is set by subclasses before enqueueing starts.
   Function doTest;
   Map<String, String> _environmentOverrides;
+  RuntimeConfiguration runtimeConfiguration;
 
   TestSuite(this.configuration, this.suiteName) {
     TestUtils.buildDir(configuration); // Sets configuration_directory.
@@ -131,6 +132,7 @@
         'DART_CONFIGURATION': configuration['configuration_directory']
       };
     }
+    runtimeConfiguration = new RuntimeConfiguration(configuration);
   }
 
   Map<String, String> get environmentOverrides => _environmentOverrides;
@@ -206,19 +208,12 @@
     return dartExecutable;
   }
 
-  String get dartVmNooptBinaryFileName {
-    // Controlled by user with the option "--dart".
-    String dartExecutable = configuration['dart'];
-
-    if (dartExecutable == '') {
-      String suffix = executableBinarySuffix;
-      dartExecutable = useSdk
-          ? '$buildDir/dart-sdk/bin/dart_noopt$suffix'
-          : '$buildDir/dart_noopt$suffix';
-    }
-
-    TestUtils.ensureExists(dartExecutable, configuration);
-    return dartExecutable;
+  /// Returns the name of the flutter engine executable.
+  String get flutterEngineBinaryFileName {
+    // Controlled by user with the option "--flutter".
+    String flutterExecutable = configuration['flutter'];
+    TestUtils.ensureExists(flutterExecutable, configuration);
+    return flutterExecutable;
   }
 
   String get dartPrecompiledBinaryFileName {
@@ -293,6 +288,9 @@
   //  - test if the selector matches
   // and will enqueue the test (if necessary).
   void enqueueNewTestCase(TestCase testCase) {
+    if (testCase.isNegative && runtimeConfiguration.shouldSkipNegativeTests) {
+      return;
+    }
     var expectations = testCase.expectedOutcomes;
 
     // Handle sharding based on the original test path (i.e. all multitests
@@ -1081,7 +1079,6 @@
       List<String> otherResources = info.optionsFromFile['otherResources'];
       for (String name in otherResources) {
         Path namePath = new Path(name);
-        String fileName = namePath.filename;
         Path fromPath = info.filePath.directoryPath.join(namePath);
         new File('$tempDir/$name').parent.createSync(recursive: true);
         new File(fromPath.toNativePath()).copySync('$tempDir/$name');
@@ -1095,7 +1092,9 @@
             CommandBuilder.instance,
             compileTimeArguments,
             environmentOverrides);
-    commands.addAll(compilationArtifact.commands);
+    if (!configuration['skip-compilation']) {
+      commands.addAll(compilationArtifact.commands);
+    }
 
     if (expectCompileError(info) && compilerConfiguration.hasCompiler) {
       // Do not attempt to run the compiled result. A compilation
@@ -1103,8 +1102,6 @@
       return commands;
     }
 
-    RuntimeConfiguration runtimeConfiguration =
-        new RuntimeConfiguration(configuration);
     List<String> runtimeArguments =
         compilerConfiguration.computeRuntimeArguments(
             runtimeConfiguration,
@@ -1173,6 +1170,7 @@
     // Unreachable
     print("Cannot create URL for path $file. Not in build or dart directory.");
     exit(1);
+    return null;
   }
 
   Uri _getUriForBrowserTest(String pathComponent, String subtestName) {
@@ -1831,11 +1829,10 @@
   }
 
   List<List<String>> getVmOptions(Map optionsFromFile) {
-    var COMPILERS = const ['none', 'precompiler', 'dart2app', 'dart2appjit'];
+    var COMPILERS = const ['none', 'dartk', 'dartkp', 'precompiler', 'app_jit'];
     var RUNTIMES = const [
       'none',
       'dart_precompiled',
-      'dart_app',
       'vm',
       'drt',
       'dartium',
@@ -2305,7 +2302,10 @@
   static String outputDir(Map configuration) {
     var result = '';
     var system = configuration['system'];
-    if (system == 'linux' || system == 'android' || system == 'windows') {
+    if (system == 'fuchsia' ||
+        system == 'linux' ||
+        system == 'android' ||
+        system == 'windows') {
       result = 'out/';
     } else if (system == 'macos') {
       result = 'xcodebuild/';
@@ -2415,6 +2415,7 @@
       case 'android':
         os = 'Android';
         break;
+      case 'fuchsia':
       case 'linux':
       case 'macos':
       case 'windows':
diff --git a/tools/testing/dart/utils.dart b/tools/testing/dart/utils.dart
index fd2245e..28eccbe 100644
--- a/tools/testing/dart/utils.dart
+++ b/tools/testing/dart/utils.dart
@@ -14,9 +14,9 @@
 const Duration MAX_STDIO_DELAY = const Duration(seconds: 30);
 
 String MAX_STDIO_DELAY_PASSED_MESSAGE =
-    """Not waiting for stdout/stderr from subprocess anymore 
-($MAX_STDIO_DELAY passed). Please note that this could be an indicator 
-that there is a hanging process which we were unable to kill.""";
+    """Not waiting for stdout/stderr from subprocess anymore
+ ($MAX_STDIO_DELAY passed). Please note that this could be an indicator
+ that there is a hanging process which we were unable to kill.""";
 
 class DebugLogger {
   static IOSink _sink;
diff --git a/tools/utils.py b/tools/utils.py
index 51a3a03..87ee907 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -7,14 +7,31 @@
 
 import commands
 import datetime
+import glob
+import imp
 import json
 import os
 import platform
 import re
 import shutil
 import subprocess
-import tempfile
 import sys
+import tarfile
+import tempfile
+import uuid
+
+try:
+  # Not available on Windows.
+  import resource
+except:
+  pass
+
+DART_DIR = os.path.abspath(
+    os.path.normpath(os.path.join(__file__, '..', '..')))
+
+def GetBotUtils():
+  '''Dynamically load the tools/bots/bot_utils.py python module.'''
+  return imp.load_source('bot_utils', os.path.join(DART_DIR, 'tools', 'bots', 'bot_utils.py'))
 
 class Version(object):
   def __init__(self, channel, major, minor, patch, prerelease,
@@ -243,6 +260,7 @@
   'simdbc': 'ia32',
   'simdbc64': 'ia32',
   'armsimdbc': 'arm',
+  'armsimdbc64': 'arm',
 }
 
 ARCH_GUESS = GuessArchitecture()
@@ -316,8 +334,8 @@
 
   return '%s.%s.%s%s' % (version.major, version.minor, version.patch, postfix)
 
-def GetVersion():
-  return GetSemanticSDKVersion()
+def GetVersion(ignore_svn_revision=False):
+  return GetSemanticSDKVersion(ignore_svn_revision)
 
 # The editor used to produce the VERSION file put on gcs. We now produce this
 # in the bots archiving the sdk.
@@ -656,6 +674,152 @@
     print "Enter directory = ", self._old_cwd
     os.chdir(self._old_cwd)
 
+class CoreDump(object):
+  def __init__(self, test, core, binary):
+    self.test = test
+    self.core = core
+    self.binary = binary
+
+  def __str__(self):
+    return "%s: %s %s" % (self.test, self.binary, self.core)
+
+class CoreDumpArchiver(object):
+  """This class reads coredumps file written by UnexpectedCrashDumpArchiver
+  into the current working directory and uploads all cores and binaries
+  listed in it into Cloud Storage (see tools/testing/dart/test_progress.dart).
+  """
+
+  def __init__(self, args):
+    self._enabled = '--copy-coredumps' in args and GuessOS() == 'linux'
+    self._search_dir = os.getcwd()
+    self._bucket = 'dart-temp-crash-archive'
+    self._old_limits = None
+
+  def __enter__(self):
+    if not self._enabled:
+      return
+
+    # Cleanup any stale coredumps
+    if self._cleanup():
+      print "WARNING: Found and removed stale coredumps"
+
+    self._old_limits = resource.getrlimit(resource.RLIMIT_CORE)
+
+    # Bump core limits to unlimited if core_pattern is correctly configured.
+    if self._check_core_dump_pattern(fatal=False):
+      resource.setrlimit(resource.RLIMIT_CORE, (-1, -1))
+
+  def __exit__(self, *_):
+    if not self._enabled:
+      return
+
+    try:
+      # Restore old core limit.
+      resource.setrlimit(resource.RLIMIT_CORE, self._old_limits)
+
+      # Check that kernel was correctly configured to use core.%p
+      # core_pattern.
+      self._check_core_dump_pattern(fatal=True)
+
+      coredumps = self._find_coredumps()
+      if coredumps:
+        # If we get a ton of crashes, only archive 10 dumps.
+        archive_coredumps = coredumps[:10]
+        print 'Archiving coredumps:'
+        for core in archive_coredumps:
+          print '----> %s' % core
+
+        sys.stdout.flush()
+        self._archive(archive_coredumps)
+
+    finally:
+      self._cleanup()
+
+  def _cleanup(self):
+    found = False
+    for core in glob.glob(os.path.join(self._search_dir, 'core.*')):
+      found = True
+      os.unlink(core)
+    for binary in glob.glob(os.path.join(self._search_dir, 'binary.*')):
+      found = True
+      os.unlink(binary)
+    try:
+      os.unlink(os.path.join(self._search_dir, 'coredumps'))
+      found = True
+    except:
+      pass
+
+    return found
+
+  def _find_coredumps(self):
+    """Load coredumps file. Each line has the following format:
+
+              test-name,core-file,binary-file
+    """
+    try:
+      with open('coredumps') as f:
+        return [CoreDump(*ln.strip('\n').split(',')) for ln in f.readlines()]
+    except:
+      return []
+
+  def _archive(self, coredumps):
+    files = set()
+    for core in coredumps:
+      files.add(core.core)
+      files.add(core.binary)
+    self._upload(files)
+
+  def _upload(self, files):
+    bot_utils = GetBotUtils()
+    gsutil = bot_utils.GSUtil()
+    storage_path = '%s/%s/' % (self._bucket, uuid.uuid4())
+    gs_prefix = 'gs://%s' % storage_path
+    http_prefix = 'https://storage.cloud.google.com/%s' % storage_path
+
+    print '\n--- Uploading into %s (%s) ---' % (gs_prefix, http_prefix)
+    for file in files:
+      # Sanitize the name: actual cores follow 'core.%d' pattern, crashed
+      # binaries are copied next to cores and named 'binary.<binary_name>'.
+      name = os.path.basename(file)
+      (prefix, suffix) = name.split('.', 1)
+      if prefix == 'binary':
+        name = suffix
+
+      tarname = '%s.tar.gz' % name
+
+      # Compress the file.
+      tar = tarfile.open(tarname, mode='w:gz')
+      tar.add(file, arcname=name)
+      tar.close()
+
+      # Remove / from absolute path to not have // in gs path.
+      gs_url = '%s%s' % (gs_prefix, tarname)
+      http_url = '%s%s' % (http_prefix, tarname)
+
+      try:
+        gsutil.upload(tarname, gs_url)
+        print '+++ Uploaded %s (%s)' % (gs_url, http_url)
+      except Exception as error:
+        print '!!! Failed to upload %s, error: %s' % (tarname, error)
+
+      os.unlink(tarname)
+    print '--- Done ---\n'
+
+  def _check_core_dump_pattern(self, fatal=False):
+    core_pattern_file = '/proc/sys/kernel/core_pattern'
+    core_pattern = open(core_pattern_file).read()
+
+    expected_core_pattern = 'core.%p'
+    if core_pattern.strip() != expected_core_pattern:
+      if fatal:
+        message = ('Invalid core_pattern configuration. '
+            'The configuration of core dump handling is *not* correct for '
+            'a buildbot. The content of {0} must be "{1}" instead of "{2}".'
+            .format(core_pattern_file, expected_core_pattern, core_pattern))
+        raise Exception(message)
+      else:
+        return False
+    return True
 
 if __name__ == "__main__":
   import sys
diff --git a/utils/application_snapshot.gni b/utils/application_snapshot.gni
index 0f36737..8899703e 100644
--- a/utils/application_snapshot.gni
+++ b/utils/application_snapshot.gni
@@ -2,7 +2,7 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-import("//build/compiled_action.gni")
+import("../build/compiled_action.gni")
 
 _dart_root = rebase_path("..")
 
diff --git a/utils/compiler/BUILD.gn b/utils/compiler/BUILD.gn
index 9ec1093..19d7bea 100644
--- a/utils/compiler/BUILD.gn
+++ b/utils/compiler/BUILD.gn
@@ -2,13 +2,13 @@
 # for 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("//build/compiled_action.gni")
+import("../../build/compiled_action.gni")
 import("../create_timestamp.gni")
 import("../application_snapshot.gni")
 
 create_timestamp_file("dart2js_files_stamp") {
   path = rebase_path("../../pkg/compiler/lib")
-  output = "$root_gen_dir/dart2js_files.stamp"
+  output = "$target_gen_dir/dart2js_files.stamp"
 }
 
 create_timestamp_file("runtime_lib_files_stamp") {
@@ -31,17 +31,17 @@
 
   dot_packages = rebase_path("../../.packages")
   create_snapshot_entry = rebase_path("create_snapshot_entry.dart")
-  output_dir = rebase_path(root_gen_dir)
+  output_dir = rebase_path(target_gen_dir)
 
   inputs = [
     "../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart",
     create_snapshot_entry,
-    "$root_gen_dir/dart2js_files.stamp",
+    "$target_gen_dir/dart2js_files.stamp",
     "../../tools/VERSION",
   ]
 
-  utils_output = "$root_gen_dir/utils_wrapper.dart"
-  dart2js_output = "$root_gen_dir/dart2js.dart"
+  utils_output = "$target_gen_dir/utils_wrapper.dart"
+  dart2js_output = "$target_gen_dir/dart2js.dart"
   outputs = [
     utils_output,
     dart2js_output,
@@ -59,11 +59,12 @@
   deps = [
     ":dart2js_create_snapshot_entries",
   ]
-  main_dart = "$root_gen_dir/dart2js.dart"
+  main_dart = "$target_gen_dir/dart2js.dart"
   training_args = [
+    "--packages=" + rebase_path("../../.packages"),
     "--library-root=" + rebase_path("../../sdk"),
     "--categories=all",
-    rebase_path("$root_gen_dir/dart2js.dart"),
+    rebase_path("$target_gen_dir/dart2js.dart"),
   ]
 }
 
@@ -71,6 +72,6 @@
   deps = [
     ":dart2js_create_snapshot_entries",
   ]
-  main_dart = "$root_gen_dir/utils_wrapper.dart"
+  main_dart = "$target_gen_dir/utils_wrapper.dart"
   training_args = [ "--help" ]
 }
diff --git a/utils/compiler/compiler.gyp b/utils/compiler/compiler.gyp
index 63c4dae..272dd0a 100644
--- a/utils/compiler/compiler.gyp
+++ b/utils/compiler/compiler.gyp
@@ -20,7 +20,10 @@
           'inputs': [
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
             '../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../runtime/lib", "../../sdk/lib/_internal/dartdoc"])',
+            '<!@(["python", "../../tools/list_files.py",  "relative", '
+                '"\\.dart$", '
+                '"../../runtime/lib", '
+                '"../../sdk/lib/_internal/dartdoc"])',
             'create_snapshot.dart',
             '<(SHARED_INTERMEDIATE_DIR)/dart2js_files.stamp',
             '../../tools/VERSION',
@@ -51,7 +54,8 @@
           'action_name': 'make_dart2js_files_stamp',
           'inputs': [
             '../../tools/create_timestamp_file.py',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$",'
+            '<!@(["python", "../../tools/list_files.py", "relative", '
+                '"\\.dart$", '
                 ' "../../pkg/compiler/lib"])',
           ],
           'outputs': [
diff --git a/utils/create_timestamp.gni b/utils/create_timestamp.gni
index c579da1..75ae4cd 100644
--- a/utils/create_timestamp.gni
+++ b/utils/create_timestamp.gni
@@ -7,14 +7,6 @@
 template("create_timestamp_file") {
   assert(defined(invoker.path), "Must specify 'path'")
   assert(defined(invoker.output), "Must specify 'output'")
-  new_base = "."
-  if (defined(invoker.new_base)) {
-    new_base = invoker.new_base
-  }
-  current_base = "."
-  if (defined(invoker.current_base)) {
-    current_base = invoker.current_base
-  }
   path = invoker.path
   output = invoker.output
   action(target_name) {
@@ -23,10 +15,9 @@
       list_args += [ invoker.pattern ]
     }
     files = exec_script("$_dart_root/tools/list_dart_files.py",
-                        list_args,
+                        [ "absolute" ] + list_args,
                         "list lines")
-    inputs = [ "$_dart_root/tools/list_dart_files.py" ] +
-             rebase_path(files, new_base, current_base)
+    inputs = [ "$_dart_root/tools/list_dart_files.py" ] + files
     outputs = [
       output,
     ]
diff --git a/utils/dartanalyzer/BUILD.gn b/utils/dartanalyzer/BUILD.gn
index dbefeec..47467e9 100644
--- a/utils/dartanalyzer/BUILD.gn
+++ b/utils/dartanalyzer/BUILD.gn
@@ -2,7 +2,7 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-import("//build/compiled_action.gni")
+import("../../build/compiled_action.gni")
 import("../application_snapshot.gni")
 
 group("dartanalyzer") {
@@ -14,7 +14,7 @@
 }
 
 analyzer_files = exec_script("../../tools/list_dart_files.py",
-                             [ rebase_path("../../pkg/analyzer") ],
+                             [ "absolute", rebase_path("../../pkg/analyzer") ],
                              "list lines")
 
 application_snapshot("generate_dartanalyzer_snapshot") {
@@ -25,13 +25,13 @@
   ]
   name = "dartanalyzer"
   cli_files = exec_script("../../tools/list_dart_files.py",
-                          [ rebase_path("../../pkg/analyzer_cli") ],
+                          [ "absolute", rebase_path("../../pkg/analyzer_cli") ],
                           "list lines")
   inputs = cli_files + analyzer_files
 }
 
 sdk_lib_files = exec_script("../../tools/list_dart_files.py",
-                            [ rebase_path("../../sdk/lib") ],
+                            [ "absolute", rebase_path("../../sdk/lib") ],
                             "list lines")
 
 template("generate_summary") {
@@ -50,13 +50,12 @@
     dot_packages = rebase_path("../../.packages")
     build_sdk_summaries =
         rebase_path("../../pkg/analyzer/tool/summary/build_sdk_summaries.dart")
-    abs_output = rebase_path(output)
 
     args = [
       "--packages=$dot_packages",
       build_sdk_summaries,
       "build-$type",
-      abs_output,
+      rebase_path(output),
       rebase_path("../../sdk"),
     ]
   }
diff --git a/utils/dartanalyzer/dartanalyzer.gyp b/utils/dartanalyzer/dartanalyzer.gyp
index daf226c..282d304 100644
--- a/utils/dartanalyzer/dartanalyzer.gyp
+++ b/utils/dartanalyzer/dartanalyzer.gyp
@@ -16,8 +16,10 @@
           'inputs': [
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
             '../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/analyzer_cli"])',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/analyzer"])',
+            '<!@(["python", "../../tools/list_dart_files.py", "relative", '
+                '"../../pkg/analyzer_cli"])',
+            '<!@(["python", "../../tools/list_dart_files.py", "relative", '
+                '"../../pkg/analyzer"])',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/dartanalyzer.dart.snapshot',
@@ -33,8 +35,10 @@
           'action_name': 'generate_summary_spec',
           'inputs': [
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../sdk/lib"])',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/analyzer"])',
+            '<!@(["python", "../../tools/list_dart_files.py", "relative", '
+                '"../../sdk/lib"])',
+            '<!@(["python", "../../tools/list_dart_files.py", "relative", '
+                '"../../pkg/analyzer"])',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/spec.sum',
@@ -51,8 +55,10 @@
           'action_name': 'generate_summary_strong',
           'inputs': [
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../sdk/lib"])',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/analyzer"])',
+            '<!@(["python", "../../tools/list_dart_files.py", "relative", '
+                '"../../sdk/lib"])',
+            '<!@(["python", "../../tools/list_dart_files.py", "relative", '
+                '"../../pkg/analyzer"])',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/strong.sum',
diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn
index 0c93423..ba51ab4 100644
--- a/utils/dartdevc/BUILD.gn
+++ b/utils/dartdevc/BUILD.gn
@@ -14,6 +14,7 @@
     "--help",
   ]
   inputs = exec_script("../../tools/list_dart_files.py",
-                       [ rebase_path("../../pkg/dev_compiler/bin") ],
+                       [ "absolute",
+                         rebase_path("../../pkg/dev_compiler/bin") ],
                        "list lines")
 }
diff --git a/utils/dartdevc/dartdevc.gyp b/utils/dartdevc/dartdevc.gyp
index 167327e..b141bc5 100644
--- a/utils/dartdevc/dartdevc.gyp
+++ b/utils/dartdevc/dartdevc.gyp
@@ -16,7 +16,8 @@
           'inputs': [
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
             '../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../pkg/dev_compiler/bin"])',
+            '<!@(["python", "../../tools/list_dart_files.py", "relative", '
+                '"../../pkg/dev_compiler/bin"])',
             '<(SHARED_INTERMEDIATE_DIR)/pkg_files.stamp',
           ],
           'outputs': [
diff --git a/utils/dartdoc/BUILD.gn b/utils/dartdoc/BUILD.gn
index 6abdc9a..ac302a8 100644
--- a/utils/dartdoc/BUILD.gn
+++ b/utils/dartdoc/BUILD.gn
@@ -8,6 +8,7 @@
   main_dart = "../../third_party/pkg/dartdoc/bin/dartdoc.dart"
   training_args = [ "--help" ]
   inputs = exec_script("../../tools/list_dart_files.py",
-                       [ rebase_path("../../third_party/pkg/dartdoc") ],
+                       [ "absolute",
+                         rebase_path("../../third_party/pkg/dartdoc") ],
                        "list lines")
 }
diff --git a/utils/dartdoc/dartdoc.gyp b/utils/dartdoc/dartdoc.gyp
index dc5e414..e5327c0 100644
--- a/utils/dartdoc/dartdoc.gyp
+++ b/utils/dartdoc/dartdoc.gyp
@@ -16,7 +16,8 @@
           'inputs': [
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
             '../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../third_party/pkg/dartdoc"])',
+            '<!@(["python", "../../tools/list_dart_files.py", "relative", '
+                '"../../third_party/pkg/dartdoc"])',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/dartdoc.dart.snapshot',
@@ -31,4 +32,4 @@
       ],
     },
   ],
-}
\ No newline at end of file
+}
diff --git a/utils/dartfmt/BUILD.gn b/utils/dartfmt/BUILD.gn
index 41c5bc4..7c688a3 100644
--- a/utils/dartfmt/BUILD.gn
+++ b/utils/dartfmt/BUILD.gn
@@ -9,6 +9,7 @@
   training_args = [ "--help" ]
   inputs =
       exec_script("../../tools/list_dart_files.py",
-                  [ rebase_path("../../third_party/pkg_tested/dart_style") ],
+                  [ "absolute",
+                    rebase_path("../../third_party/pkg_tested/dart_style") ],
                   "list lines")
 }
diff --git a/utils/dartfmt/dartfmt.gyp b/utils/dartfmt/dartfmt.gyp
index a59ef9a..5590883 100644
--- a/utils/dartfmt/dartfmt.gyp
+++ b/utils/dartfmt/dartfmt.gyp
@@ -16,7 +16,8 @@
           'inputs': [
             '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)dart<(EXECUTABLE_SUFFIX)',
             '../../sdk/lib/_internal/sdk_library_metadata/lib/libraries.dart',
-            '<!@(["python", "../../tools/list_files.py", "\\.dart$", "../../third_party/pkg_tested/dart_style"])',
+            '<!@(["python", "../../tools/list_dart_files.py", "relative", '
+                '"../../third_party/pkg_tested/dart_style"])',
           ],
           'outputs': [
             '<(SHARED_INTERMEDIATE_DIR)/dartfmt.dart.snapshot',
diff --git a/utils/pub/BUILD.gn b/utils/pub/BUILD.gn
index 82669cb..33cea34 100644
--- a/utils/pub/BUILD.gn
+++ b/utils/pub/BUILD.gn
@@ -10,7 +10,9 @@
   deps = [
     "../compiler:dart2js_files_stamp",
   ]
+  dart2js_gen_dir =
+      get_label_info("../compiler:dart2js_files_stamp", "target_gen_dir")
   inputs = [
-    "$root_gen_dir/dart2js_files.stamp",
+    "$dart2js_gen_dir/dart2js_files.stamp",
   ]
 }